From: support Date: Fri, 29 Apr 2022 09:49:09 +0000 (+0000) Subject: Built motion from commit 4c46af6b.|2.6.9 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22card-image.png//%22?a=commitdiff_plain;h=b632a7dbcff53b0bbafe5e1325633562feb59e9e;p=motion2.git Built motion from commit 4c46af6b.|2.6.9 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c24de0d..c72356a 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-29T09:13:01.042Z", + "time": "2022-04-29T09:41:06.226Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7f3c0b6..e1954e5 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-29T09:13:01.042Z", + "time": "2022-04-29T09:41:06.226Z", "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 da7106c..e8c3926 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 _0x1ffe=['getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x13e1c5,_0x1b5009){_0x13e1c5=_0x13e1c5-0x0;var _0xc5a3a5=_0x1ffe[_0x13e1c5];return _0xc5a3a5;};'use strict';var Sequelize=require(_0xe1ff('0x0'));module[_0xe1ff('0x1')]={'name':{'type':Sequelize[_0xe1ff('0x2')],'get':function(_0x359b77){return this[_0xe1ff('0x3')](_0xe1ff('0x4'));}},'action':{'type':Sequelize[_0xe1ff('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe1ff('0x6'),_0xe1ff('0x7'),_0xe1ff('0x8'),_0xe1ff('0x9'),_0xe1ff('0xa'),'browser','bot',_0xe1ff('0xb')]],'msg':_0xe1ff('0xc')}},'comment':_0xe1ff('0xc')},'data1':{'type':Sequelize[_0xe1ff('0x5')](0x1000),'comment':_0xe1ff('0xd')},'data2':{'type':Sequelize[_0xe1ff('0x5')](0x1000),'comment':_0xe1ff('0xe')},'data3':{'type':Sequelize[_0xe1ff('0x5')](0x1000),'comment':_0xe1ff('0xf')},'data4':{'type':Sequelize[_0xe1ff('0x5')](0x1000),'comments':_0xe1ff('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xe1ff('0x11')},'data6':{'type':Sequelize[_0xe1ff('0x5')],'comments':_0xe1ff('0x12')},'data7':{'type':Sequelize[_0xe1ff('0x13')],'comments':_0xe1ff('0x14')}}; \ No newline at end of file +var _0xde1d=['urlForward','browser','bot','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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','exports','VIRTUAL','getDataValue','STRING','integration','motionbar','jscripty'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xde1d,0x109));var _0xdde1=function(_0x98417d,_0x2d249c){_0x98417d=_0x98417d-0x0;var _0x51ee3c=_0xde1d[_0x98417d];return _0x51ee3c;};'use strict';var Sequelize=require('sequelize');module[_0xdde1('0x0')]={'name':{'type':Sequelize[_0xdde1('0x1')],'get':function(_0xb89f4b){return this[_0xdde1('0x2')]('action');}},'action':{'type':Sequelize[_0xdde1('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xdde1('0x4'),_0xdde1('0x5'),_0xdde1('0x6'),_0xdde1('0x7'),_0xdde1('0x8'),_0xdde1('0x9'),'script']],'msg':_0xdde1('0xa')}},'comment':_0xdde1('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xdde1('0xb')},'data2':{'type':Sequelize[_0xdde1('0x3')](0x1000),'comment':_0xdde1('0xc')},'data3':{'type':Sequelize[_0xdde1('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xdde1('0x3')](0x1000),'comments':_0xdde1('0xd')},'data5':{'type':Sequelize[_0xdde1('0x3')](0x1000),'comments':_0xdde1('0xe')},'data6':{'type':Sequelize[_0xdde1('0x3')],'comments':_0xdde1('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 78fad9a..2d62736 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 _0x0cba=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','update','body','Action','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1f2ed8,_0x47b363){var _0x29c197=function(_0x458870){while(--_0x458870){_0x1f2ed8['push'](_0x1f2ed8['shift']());}};_0x29c197(++_0x47b363);}(_0x0cba,0x124));var _0xa0cb=function(_0x3d773f,_0x3462b3){_0x3d773f=_0x3d773f-0x0;var _0x22bf3a=_0x0cba[_0x3d773f];return _0x22bf3a;};'use strict';var emlformat=require(_0xa0cb('0x0'));var rimraf=require(_0xa0cb('0x1'));var zipdir=require(_0xa0cb('0x2'));var jsonpatch=require(_0xa0cb('0x3'));var rp=require(_0xa0cb('0x4'));var moment=require('moment');var BPromise=require(_0xa0cb('0x5'));var Mustache=require(_0xa0cb('0x6'));var util=require('util');var path=require(_0xa0cb('0x7'));var sox=require('sox');var csv=require(_0xa0cb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0cb('0x9'));var _=require(_0xa0cb('0xa'));var squel=require('squel');var crypto=require(_0xa0cb('0xb'));var jsforce=require(_0xa0cb('0xc'));var deskjs=require(_0xa0cb('0xd'));var toCsv=require(_0xa0cb('0x8'));var querystring=require(_0xa0cb('0xe'));var Papa=require(_0xa0cb('0xf'));var Redis=require('ioredis');var authService=require(_0xa0cb('0x10'));var qs=require(_0xa0cb('0x11'));var as=require(_0xa0cb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0cb('0x13'))(_0xa0cb('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0cb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307c16,_0x152720){_0x152720=_0x152720||0xcc;return function(_0x3c25d7){if(_0x3c25d7){return _0x307c16['sendStatus'](_0x152720);}return _0x307c16[_0xa0cb('0x16')](_0x152720)['end']();};}function respondWithResult(_0x358def,_0x7a31e9){_0x7a31e9=_0x7a31e9||0xc8;return function(_0x5089e9){if(_0x5089e9){return _0x358def[_0xa0cb('0x16')](_0x7a31e9)[_0xa0cb('0x17')](_0x5089e9);}};}function respondWithFilteredResult(_0x216270,_0x5ba60a){return function(_0xb73b75){if(_0xb73b75){var _0x4364d6=typeof _0x5ba60a['offset']===_0xa0cb('0x18')&&typeof _0x5ba60a[_0xa0cb('0x19')]==='undefined';var _0x10b5b9=_0xb73b75['count'];var _0x1eb549=_0x4364d6?0x0:_0x5ba60a['offset'];var _0x53bf81=_0x4364d6?_0xb73b75[_0xa0cb('0x1a')]:_0x5ba60a[_0xa0cb('0x1b')]+_0x5ba60a[_0xa0cb('0x19')];var _0x3eda19;if(_0x53bf81>=_0x10b5b9){_0x53bf81=_0x10b5b9;_0x3eda19=0xc8;}else{_0x3eda19=0xce;}_0x216270[_0xa0cb('0x16')](_0x3eda19);return _0x216270['set']('Content-Range',_0x1eb549+'-'+_0x53bf81+'/'+_0x10b5b9)[_0xa0cb('0x17')](_0xb73b75);}return null;};}function patchUpdates(_0x48f39e){return function(_0x34a899){try{jsonpatch[_0xa0cb('0x1c')](_0x34a899,_0x48f39e,!![]);}catch(_0x3e115a){return BPromise[_0xa0cb('0x1d')](_0x3e115a);}return _0x34a899[_0xa0cb('0x1e')]();};}function saveUpdates(_0x178911,_0x9bd8be){return function(_0x114afa){if(_0x114afa){return _0x114afa['update'](_0x178911)[_0xa0cb('0x1f')](function(_0x54dd8c){return _0x54dd8c;});}return null;};}function removeEntity(_0x126229,_0x213288){return function(_0x57b543){if(_0x57b543){return _0x57b543[_0xa0cb('0x20')]()[_0xa0cb('0x1f')](function(){_0x126229[_0xa0cb('0x16')](0xcc)[_0xa0cb('0x21')]();});}};}function handleEntityNotFound(_0x1580f5,_0x2026ce){return function(_0x4cf614){if(!_0x4cf614){_0x1580f5[_0xa0cb('0x22')](0x194);}return _0x4cf614;};}function handleError(_0x3b1305,_0x166878){_0x166878=_0x166878||0x1f4;return function(_0x559bf1){logger[_0xa0cb('0x23')](_0x559bf1[_0xa0cb('0x24')]);if(_0x559bf1[_0xa0cb('0x25')]){delete _0x559bf1[_0xa0cb('0x25')];}_0x3b1305[_0xa0cb('0x16')](_0x166878)[_0xa0cb('0x26')](_0x559bf1);};}exports[_0xa0cb('0x27')]=function(_0x33ec0f,_0x3df22d){if(_0x33ec0f[_0xa0cb('0x28')]['id']){delete _0x33ec0f[_0xa0cb('0x28')]['id'];}return db[_0xa0cb('0x29')]['find']({'where':{'id':_0x33ec0f[_0xa0cb('0x2a')]['id']}})[_0xa0cb('0x1f')](handleEntityNotFound(_0x3df22d,null))[_0xa0cb('0x1f')](saveUpdates(_0x33ec0f[_0xa0cb('0x28')],null))['then'](respondWithResult(_0x3df22d,null))[_0xa0cb('0x2b')](handleError(_0x3df22d,null));};exports[_0xa0cb('0x20')]=function(_0x579ba2,_0x3508fd){return db[_0xa0cb('0x29')]['find']({'where':{'id':_0x579ba2[_0xa0cb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3508fd,null))['then'](removeEntity(_0x3508fd,null))[_0xa0cb('0x2b')](handleError(_0x3508fd,null));}; \ No newline at end of file +var _0xdb57=['fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0xdb57,0xdc));var _0x7db5=function(_0x25f8b7,_0x25840a){_0x25f8b7=_0x25f8b7-0x0;var _0x5cbfb2=_0xdb57[_0x25f8b7];return _0x5cbfb2;};'use strict';var emlformat=require(_0x7db5('0x0'));var rimraf=require(_0x7db5('0x1'));var zipdir=require(_0x7db5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7db5('0x3'));var moment=require(_0x7db5('0x4'));var BPromise=require(_0x7db5('0x5'));var Mustache=require(_0x7db5('0x6'));var util=require(_0x7db5('0x7'));var path=require('path');var sox=require(_0x7db5('0x8'));var csv=require(_0x7db5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7db5('0xa'));var _=require('lodash');var squel=require(_0x7db5('0xb'));var crypto=require(_0x7db5('0xc'));var jsforce=require(_0x7db5('0xd'));var deskjs=require(_0x7db5('0xe'));var toCsv=require(_0x7db5('0x9'));var querystring=require(_0x7db5('0xf'));var Papa=require('papaparse');var Redis=require(_0x7db5('0x10'));var authService=require(_0x7db5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7db5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7db5('0x13'));var utils=require(_0x7db5('0x14'));var config=require(_0x7db5('0x15'));var licenseUtil=require(_0x7db5('0x16'));var db=require(_0x7db5('0x17'))['db'];function respondWithStatusCode(_0x43fe95,_0x5824cd){_0x5824cd=_0x5824cd||0xcc;return function(_0x3b5952){if(_0x3b5952){return _0x43fe95[_0x7db5('0x18')](_0x5824cd);}return _0x43fe95[_0x7db5('0x19')](_0x5824cd)[_0x7db5('0x1a')]();};}function respondWithResult(_0x50fa05,_0x46fc53){_0x46fc53=_0x46fc53||0xc8;return function(_0xb59480){if(_0xb59480){return _0x50fa05[_0x7db5('0x19')](_0x46fc53)[_0x7db5('0x1b')](_0xb59480);}};}function respondWithFilteredResult(_0x239281,_0x1d6f7c){return function(_0x497e82){if(_0x497e82){var _0x236655=typeof _0x1d6f7c[_0x7db5('0x1c')]===_0x7db5('0x1d')&&typeof _0x1d6f7c[_0x7db5('0x1e')]===_0x7db5('0x1d');var _0x3f6702=_0x497e82[_0x7db5('0x1f')];var _0x2c94e0=_0x236655?0x0:_0x1d6f7c[_0x7db5('0x1c')];var _0x57f2b3=_0x236655?_0x497e82['count']:_0x1d6f7c[_0x7db5('0x1c')]+_0x1d6f7c['limit'];var _0x5aedbe;if(_0x57f2b3>=_0x3f6702){_0x57f2b3=_0x3f6702;_0x5aedbe=0xc8;}else{_0x5aedbe=0xce;}_0x239281['status'](_0x5aedbe);return _0x239281['set']('Content-Range',_0x2c94e0+'-'+_0x57f2b3+'/'+_0x3f6702)['json'](_0x497e82);}return null;};}function patchUpdates(_0x3676a8){return function(_0x344e02){try{jsonpatch[_0x7db5('0x20')](_0x344e02,_0x3676a8,!![]);}catch(_0x55c93d){return BPromise[_0x7db5('0x21')](_0x55c93d);}return _0x344e02[_0x7db5('0x22')]();};}function saveUpdates(_0x524edb,_0x78546b){return function(_0x127e14){if(_0x127e14){return _0x127e14[_0x7db5('0x23')](_0x524edb)['then'](function(_0x4d01fd){return _0x4d01fd;});}return null;};}function removeEntity(_0x4ea1ab,_0x122b82){return function(_0x10d5f2){if(_0x10d5f2){return _0x10d5f2[_0x7db5('0x24')]()[_0x7db5('0x25')](function(){_0x4ea1ab[_0x7db5('0x19')](0xcc)[_0x7db5('0x1a')]();});}};}function handleEntityNotFound(_0x530908,_0x56d739){return function(_0x398b05){if(!_0x398b05){_0x530908[_0x7db5('0x18')](0x194);}return _0x398b05;};}function handleError(_0x102bbe,_0x2a086){_0x2a086=_0x2a086||0x1f4;return function(_0x50cbb7){logger[_0x7db5('0x26')](_0x50cbb7[_0x7db5('0x27')]);if(_0x50cbb7['name']){delete _0x50cbb7['name'];}_0x102bbe[_0x7db5('0x19')](_0x2a086)[_0x7db5('0x28')](_0x50cbb7);};}exports[_0x7db5('0x23')]=function(_0x2180be,_0x3d6e6d){if(_0x2180be[_0x7db5('0x29')]['id']){delete _0x2180be[_0x7db5('0x29')]['id'];}return db[_0x7db5('0x2a')][_0x7db5('0x2b')]({'where':{'id':_0x2180be[_0x7db5('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3d6e6d,null))[_0x7db5('0x25')](saveUpdates(_0x2180be[_0x7db5('0x29')],null))[_0x7db5('0x25')](respondWithResult(_0x3d6e6d,null))[_0x7db5('0x2d')](handleError(_0x3d6e6d,null));};exports[_0x7db5('0x24')]=function(_0x56f9da,_0x5550d1){return db[_0x7db5('0x2a')][_0x7db5('0x2b')]({'where':{'id':_0x56f9da[_0x7db5('0x2c')]['id']}})[_0x7db5('0x25')](handleEntityNotFound(_0x5550d1,null))[_0x7db5('0x25')](removeEntity(_0x5550d1,null))['catch'](handleError(_0x5550d1,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 8768ada..342682b 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 _0x9c32=['../../config/logger','moment','path','rimraf','./action.attributes','Action','tools_actions','lodash','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9c32,0x15d));var _0x29c3=function(_0x47c0b5,_0x251a8d){_0x47c0b5=_0x47c0b5-0x0;var _0x484ae5=_0x9c32[_0x47c0b5];return _0x484ae5;};'use strict';var _=require(_0x29c3('0x0'));var util=require(_0x29c3('0x1'));var logger=require(_0x29c3('0x2'))('api');var moment=require(_0x29c3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29c3('0x4'));var rimraf=require(_0x29c3('0x5'));var config=require('../../config/environment');var attributes=require(_0x29c3('0x6'));module['exports']=function(_0xd8ab32,_0x597fa9){return _0xd8ab32['define'](_0x29c3('0x7'),attributes,{'tableName':_0x29c3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf9f=['lodash','util','bluebird','path','rimraf','../../config/environment','define','Action'];(function(_0x5bc73f,_0x228b4a){var _0xe2f07b=function(_0x576392){while(--_0x576392){_0x5bc73f['push'](_0x5bc73f['shift']());}};_0xe2f07b(++_0x228b4a);}(_0xcf9f,0x178));var _0xfcf9=function(_0x273e0d,_0x57ced8){_0x273e0d=_0x273e0d-0x0;var _0x251355=_0xcf9f[_0x273e0d];return _0x251355;};'use strict';var _=require(_0xfcf9('0x0'));var util=require(_0xfcf9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfcf9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcf9('0x3'));var rimraf=require(_0xfcf9('0x4'));var config=require(_0xfcf9('0x5'));var attributes=require('./action.attributes');module['exports']=function(_0x1b7701,_0x5d7c40){return _0x1b7701[_0xfcf9('0x6')](_0xfcf9('0x7'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 3af0465..1be1e49 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x419b61,_0x321d9e){var _0xe8258a=function(_0x1c02eb){while(--_0x1c02eb){_0x419b61['push'](_0x419b61['shift']());}};_0xe8258a(++_0x321d9e);}(_0xe14b,0x93));var _0xbe14=function(_0x34c7ce,_0x319aa8){_0x34c7ce=_0x34c7ce-0x0;var _0x5c1da4=_0xe14b[_0x34c7ce];return _0x5c1da4;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x4975,0x86));var _0x5497=function(_0x2ba242,_0x1dab70){_0x2ba242=_0x2ba242-0x0;var _0x33935c=_0x4975[_0x2ba242];return _0x33935c;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 9694bbf..0c893d9 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 _0x9e44=['../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x9e44,0xe9));var _0x49e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x49e4('0x0'));var util=require('util');var path=require(_0x49e4('0x1'));var timeout=require('connect-timeout');var express=require(_0x49e4('0x2'));var router=express['Router']();var fs_extra=require(_0x49e4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x49e4('0x4'));var config=require(_0x49e4('0x5'));var controller=require(_0x49e4('0x6'));router[_0x49e4('0x7')](_0x49e4('0x8'),auth['isAuthenticated'](),controller[_0x49e4('0x9')]);router[_0x49e4('0xa')]('/:id',auth[_0x49e4('0xb')](),controller[_0x49e4('0xc')]);module[_0x49e4('0xd')]=router; \ No newline at end of file +var _0xc2ca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','isAuthenticated','update','/:id','destroy','exports','path'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0xc2ca,0xa7));var _0xac2c=function(_0x323fff,_0x38f93e){_0x323fff=_0x323fff-0x0;var _0x326de5=_0xc2ca[_0x323fff];return _0x326de5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xac2c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac2c('0x1')]();var fs_extra=require(_0xac2c('0x2'));var auth=require(_0xac2c('0x3'));var interaction=require(_0xac2c('0x4'));var config=require('../../config/environment');var controller=require(_0xac2c('0x5'));router[_0xac2c('0x6')]('/:id',auth[_0xac2c('0x7')](),controller[_0xac2c('0x8')]);router['delete'](_0xac2c('0x9'),auth[_0xac2c('0x7')](),controller[_0xac2c('0xa')]);module[_0xac2c('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 5e92844..c094923 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 _0x5d58=['TEXT','STRING'];(function(_0x34ce06,_0x13c64a){var _0x2a323a=function(_0x397005){while(--_0x397005){_0x34ce06['push'](_0x34ce06['shift']());}};_0x2a323a(++_0x13c64a);}(_0x5d58,0x187));var _0x85d5=function(_0x2bc7ba,_0x59b561){_0x2bc7ba=_0x2bc7ba-0x0;var _0x2fb86f=_0x5d58[_0x2bc7ba];return _0x2fb86f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0xf96fa3,_0x5ad3ec){var _0x58c0fa=function(_0x2059b9){while(--_0x2059b9){_0xf96fa3['push'](_0xf96fa3['shift']());}};_0x58c0fa(++_0x5ad3ec);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5ed168,_0x5693f1){_0x5ed168=_0x5ed168-0x0;var _0x34edca=_0x3eea[_0x5ed168];return _0x34edca;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index bcb6b94..259e3bc 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 _0xf00a=['ValidationErrorItem','%s.%s\x20=\x20%s.%s','web','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','runReport','getFields','select','groupBy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','then','CustomReports','sendStatus','error','stack','name','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','include','findAll','rows','params','AnalyticCustomReport','rawAttributes','includeAll','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','group','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','debug','Limited\x20Query:','sequelize','toString','SELECT','COUNT(%s)','MIN(%s)','IS\x20EMPTY'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xf00a,0x164));var _0xaf00=function(_0x392890,_0xb8d3dd){_0x392890=_0x392890-0x0;var _0x2b2e30=_0xf00a[_0x392890];return _0x2b2e30;};'use strict';var emlformat=require(_0xaf00('0x0'));var rimraf=require(_0xaf00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf00('0x2'));var rp=require(_0xaf00('0x3'));var moment=require(_0xaf00('0x4'));var BPromise=require(_0xaf00('0x5'));var Mustache=require('mustache');var util=require(_0xaf00('0x6'));var path=require(_0xaf00('0x7'));var sox=require(_0xaf00('0x8'));var csv=require('to-csv');var ejs=require(_0xaf00('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf00('0xa'));var squel=require('squel');var crypto=require(_0xaf00('0xb'));var jsforce=require(_0xaf00('0xc'));var deskjs=require(_0xaf00('0xd'));var toCsv=require(_0xaf00('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaf00('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaf00('0x10'));var hardwareService=require(_0xaf00('0x11'));var logger=require(_0xaf00('0x12'))(_0xaf00('0x13'));var utils=require('../../config/utils');var config=require(_0xaf00('0x14'));var licenseUtil=require(_0xaf00('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0xaf00('0x16'))[_0xaf00('0x17')];function respondWithStatusCode(_0x405404,_0x5ca0b1){_0x5ca0b1=_0x5ca0b1||0xcc;return function(_0x469456){if(_0x469456){return _0x405404['sendStatus'](_0x5ca0b1);}return _0x405404['status'](_0x5ca0b1)[_0xaf00('0x18')]();};}function respondWithResult(_0x545352,_0x5c8983){_0x5c8983=_0x5c8983||0xc8;return function(_0x4b593e){if(_0x4b593e){return _0x545352['status'](_0x5c8983)[_0xaf00('0x19')](_0x4b593e);}};}function respondWithFilteredResult(_0x2c16ab,_0x4c9d9b){return function(_0x4693ae){if(_0x4693ae){var _0x2fc929=typeof _0x4c9d9b[_0xaf00('0x1a')]===_0xaf00('0x1b')&&typeof _0x4c9d9b[_0xaf00('0x1c')]===_0xaf00('0x1b');var _0x1fc69d=_0x4693ae['count'];var _0x37ec53=_0x2fc929?0x0:_0x4c9d9b[_0xaf00('0x1a')];var _0x395e8b=_0x2fc929?_0x4693ae[_0xaf00('0x1d')]:_0x4c9d9b[_0xaf00('0x1a')]+_0x4c9d9b[_0xaf00('0x1c')];var _0x30f5cf;if(_0x395e8b>=_0x1fc69d){_0x395e8b=_0x1fc69d;_0x30f5cf=0xc8;}else{_0x30f5cf=0xce;}_0x2c16ab[_0xaf00('0x1e')](_0x30f5cf);return _0x2c16ab[_0xaf00('0x1f')](_0xaf00('0x20'),_0x37ec53+'-'+_0x395e8b+'/'+_0x1fc69d)[_0xaf00('0x19')](_0x4693ae);}return null;};}function patchUpdates(_0x43386a){return function(_0x1abf93){try{jsonpatch[_0xaf00('0x21')](_0x1abf93,_0x43386a,!![]);}catch(_0x129609){return BPromise[_0xaf00('0x22')](_0x129609);}return _0x1abf93['save']();};}function saveUpdates(_0x12a18d,_0x5d3ec5){return function(_0x25902d){if(_0x25902d){return _0x25902d[_0xaf00('0x23')](_0x12a18d)['then'](function(_0x54f017){return _0x54f017;});}return null;};}function removeEntity(_0x24a835,_0x3398fe){return function(_0x1b77c9){if(_0x1b77c9){return _0x1b77c9[_0xaf00('0x24')]()[_0xaf00('0x25')](function(){var _0xd9ff38=_0x1b77c9['get']({'plain':!![]});var _0x397bd2=_0xaf00('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x397bd2,'resourceId':_0xd9ff38['id']}})[_0xaf00('0x25')](function(){return _0x1b77c9;});})[_0xaf00('0x25')](function(){_0x24a835[_0xaf00('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f920b,_0x16809a){return function(_0x4eaa0f){if(!_0x4eaa0f){_0x4f920b[_0xaf00('0x27')](0x194);}return _0x4eaa0f;};}function handleError(_0x2d4ad3,_0xd2f80d){_0xd2f80d=_0xd2f80d||0x1f4;return function(_0x1151b4){logger[_0xaf00('0x28')](_0x1151b4[_0xaf00('0x29')]);if(_0x1151b4[_0xaf00('0x2a')]){delete _0x1151b4[_0xaf00('0x2a')];}_0x2d4ad3[_0xaf00('0x1e')](_0xd2f80d)['send'](_0x1151b4);};}exports[_0xaf00('0x2b')]=function(_0x24bcf6,_0x4b56d7){var _0x3dc74b={},_0x56abf4={},_0x1ed42f={'count':0x0,'rows':[]};var _0x26f222=_[_0xaf00('0x2c')](db['AnalyticCustomReport']['rawAttributes'],function(_0x2ac08f){return{'name':_0x2ac08f[_0xaf00('0x2d')],'type':_0x2ac08f[_0xaf00('0x2e')][_0xaf00('0x2f')]};});_0x56abf4['model']=_[_0xaf00('0x2c')](_0x26f222,_0xaf00('0x2a'));_0x56abf4[_0xaf00('0x30')]=_[_0xaf00('0x31')](_0x24bcf6['query']);_0x56abf4[_0xaf00('0x32')]=_['intersection'](_0x56abf4[_0xaf00('0x33')],_0x56abf4[_0xaf00('0x30')]);_0x3dc74b[_0xaf00('0x34')]=_[_0xaf00('0x35')](_0x56abf4[_0xaf00('0x33')],qs[_0xaf00('0x36')](_0x24bcf6['query'][_0xaf00('0x36')]));_0x3dc74b[_0xaf00('0x34')]=_0x3dc74b[_0xaf00('0x34')][_0xaf00('0x37')]?_0x3dc74b[_0xaf00('0x34')]:_0x56abf4[_0xaf00('0x33')];if(!_0x24bcf6['query'][_0xaf00('0x38')]('nolimit')){_0x3dc74b[_0xaf00('0x1c')]=qs[_0xaf00('0x1c')](_0x24bcf6[_0xaf00('0x30')][_0xaf00('0x1c')]);_0x3dc74b[_0xaf00('0x1a')]=qs['offset'](_0x24bcf6[_0xaf00('0x30')][_0xaf00('0x1a')]);}_0x3dc74b[_0xaf00('0x39')]=qs[_0xaf00('0x3a')](_0x24bcf6['query'][_0xaf00('0x3a')]);_0x3dc74b['where']=qs[_0xaf00('0x32')](_[_0xaf00('0x3b')](_0x24bcf6[_0xaf00('0x30')],_0x56abf4['filters']),_0x26f222);if(_0x24bcf6[_0xaf00('0x30')]['filter']){_0x3dc74b[_0xaf00('0x3c')]=_[_0xaf00('0x3d')](_0x3dc74b['where'],{'$or':_['map'](_0x26f222,function(_0x4b03b3){if(_0x4b03b3[_0xaf00('0x2e')]!=='VIRTUAL'){var _0x304fd5={};_0x304fd5[_0x4b03b3[_0xaf00('0x2a')]]={'$like':'%'+_0x24bcf6[_0xaf00('0x30')]['filter']+'%'};return _0x304fd5;}})});}_0x3dc74b=_[_0xaf00('0x3d')]({},_0x3dc74b,_0x24bcf6['options']);var _0x24abc4={'where':_0x3dc74b[_0xaf00('0x3c')]};return db['AnalyticCustomReport']['count'](_0x24abc4)[_0xaf00('0x25')](function(_0x27f5fc){_0x1ed42f[_0xaf00('0x1d')]=_0x27f5fc;if(_0x24bcf6[_0xaf00('0x30')]['includeAll']){_0x3dc74b[_0xaf00('0x3e')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xaf00('0x3f')](_0x3dc74b);})['then'](function(_0x4c24ba){_0x1ed42f[_0xaf00('0x40')]=_0x4c24ba;return _0x1ed42f;})['then'](respondWithFilteredResult(_0x4b56d7,_0x3dc74b))['catch'](handleError(_0x4b56d7,null));};exports['show']=function(_0x5322f2,_0x2a28f4){var _0x15e76e={'raw':![],'where':{'id':_0x5322f2[_0xaf00('0x41')]['id']}},_0xaeef8={};_0xaeef8['model']=_['keys'](db[_0xaf00('0x42')][_0xaf00('0x43')]);_0xaeef8[_0xaf00('0x30')]=_[_0xaf00('0x31')](_0x5322f2[_0xaf00('0x30')]);_0xaeef8['filters']=_[_0xaf00('0x35')](_0xaeef8[_0xaf00('0x33')],_0xaeef8[_0xaf00('0x30')]);_0x15e76e[_0xaf00('0x34')]=_['intersection'](_0xaeef8['model'],qs[_0xaf00('0x36')](_0x5322f2['query']['fields']));_0x15e76e['attributes']=_0x15e76e[_0xaf00('0x34')][_0xaf00('0x37')]?_0x15e76e[_0xaf00('0x34')]:_0xaeef8[_0xaf00('0x33')];if(_0x5322f2[_0xaf00('0x30')][_0xaf00('0x44')]){_0x15e76e['include']=[{'all':!![]}];}_0x15e76e=_[_0xaf00('0x3d')]({},_0x15e76e,_0x5322f2[_0xaf00('0x45')]);return db['AnalyticCustomReport'][_0xaf00('0x46')](_0x15e76e)[_0xaf00('0x25')](handleEntityNotFound(_0x2a28f4,null))['then'](respondWithResult(_0x2a28f4,null))['catch'](handleError(_0x2a28f4,null));};exports[_0xaf00('0x47')]=function(_0x10980f,_0x3e0819){return db[_0xaf00('0x42')][_0xaf00('0x47')](_0x10980f['body'],{})[_0xaf00('0x25')](function(_0x22017e){var _0x3d99d4=_0x10980f['user'][_0xaf00('0x48')]({'plain':!![]});if(!_0x3d99d4)throw new Error(_0xaf00('0x49'));if(_0x3d99d4[_0xaf00('0x4a')]===_0xaf00('0x4b')){var _0x34a52a=_0x22017e[_0xaf00('0x48')]({'plain':!![]});var _0x451960=_0xaf00('0x4c');return db[_0xaf00('0x4d')][_0xaf00('0x46')]({'where':{'name':_0x451960,'userProfileId':_0x3d99d4[_0xaf00('0x4e')]},'raw':!![]})['then'](function(_0xd3286f){if(_0xd3286f&&_0xd3286f[_0xaf00('0x4f')]===0x0){return db[_0xaf00('0x50')][_0xaf00('0x47')]({'name':_0x34a52a[_0xaf00('0x2a')],'resourceId':_0x34a52a['id'],'type':'CustomReports','sectionId':_0xd3286f['id']},{})[_0xaf00('0x25')](function(){return _0x22017e;});}else{return _0x22017e;}})[_0xaf00('0x51')](function(_0x6ca5a7){logger[_0xaf00('0x28')](_0xaf00('0x52'),_0x6ca5a7);throw _0x6ca5a7;});}return _0x22017e;})[_0xaf00('0x25')](respondWithResult(_0x3e0819,0xc9))[_0xaf00('0x51')](handleError(_0x3e0819,null));};exports[_0xaf00('0x23')]=function(_0x3b4069,_0x5c2df0){if(_0x3b4069[_0xaf00('0x53')]['id']){delete _0x3b4069[_0xaf00('0x53')]['id'];}return db['AnalyticCustomReport'][_0xaf00('0x46')]({'where':{'id':_0x3b4069['params']['id']}})[_0xaf00('0x25')](handleEntityNotFound(_0x5c2df0,null))[_0xaf00('0x25')](saveUpdates(_0x3b4069['body'],null))[_0xaf00('0x25')](respondWithResult(_0x5c2df0,null))['catch'](handleError(_0x5c2df0,null));};exports[_0xaf00('0x24')]=function(_0x13d8fc,_0x5c9606){return db[_0xaf00('0x42')][_0xaf00('0x46')]({'where':{'id':_0x13d8fc[_0xaf00('0x41')]['id']}})[_0xaf00('0x25')](handleEntityNotFound(_0x5c9606,null))[_0xaf00('0x25')](removeEntity(_0x5c9606,null))['catch'](handleError(_0x5c9606,null));};exports[_0xaf00('0x54')]=function(_0x3894ab,_0x311495){var _0x21f5de=0xa;var _0x6b1a14=[_0xaf00('0x55'),_0xaf00('0x56'),_0xaf00('0x57'),_0xaf00('0x58')];var _0x100038={'SUM':_0xaf00('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xaf00('0x5a'),'MAX':_0xaf00('0x5b'),'MIN':'MIN(%s)','AVG':_0xaf00('0x5c'),'GROUP_CONCAT':_0xaf00('0x5d'),'GROUP_CONCAT ASC':_0xaf00('0x5e'),'GROUP_CONCAT DESC':_0xaf00('0x5f')};var _0x188eba={'SEC_TO_TIME':_0xaf00('0x60'),'DATE':_0xaf00('0x61'),'HOUR':_0xaf00('0x62'),'ROUND':_0xaf00('0x63'),'UNIX_TIMESTAMP':_0xaf00('0x64')};var _0x283bc0=function(_0x4ff521){return!_[_0xaf00('0x65')]([_0xaf00('0x66'),_0xaf00('0x67'),'IS\x20EMPTY',_0xaf00('0x68')],_0x4ff521);};var _0x1ee3f2=function(_0x30692e){if(!_0x30692e||!_0x30692e['rules']['length']){return'';}for(var _0x1c3fb2='(',_0x1f8725=0x0;_0x1f8725<_0x30692e[_0xaf00('0x69')][_0xaf00('0x37')];_0x1f8725+=0x1){_0x1f8725>0x0&&(_0x1c3fb2+='\x20'+_0x30692e[_0xaf00('0x6a')]+'\x20');_0x1c3fb2+=_0x30692e[_0xaf00('0x69')][_0x1f8725]['group']?_0x1ee3f2(_0x30692e[_0xaf00('0x69')][_0x1f8725]['group']):_0x30692e[_0xaf00('0x69')][_0x1f8725][_0xaf00('0x6b')]+'\x20'+_0x30692e[_0xaf00('0x69')][_0x1f8725][_0xaf00('0x6c')]+(_0x283bc0(_0x30692e[_0xaf00('0x69')][_0x1f8725][_0xaf00('0x6c')])?'\x20'+_0x30692e['rules'][_0x1f8725][_0xaf00('0x6d')]:'');}return _0x1c3fb2+')';};var _0x25c4f3={'where':{'id':_0x3894ab[_0xaf00('0x41')]['id']}},_0x227cc2,_0x4bf782,_0x509be9,_0x389cf8,_0x21e76;_0x25c4f3=_[_0xaf00('0x3d')]({},_0x25c4f3,_0x3894ab[_0xaf00('0x45')]);return db[_0xaf00('0x42')]['find'](_0x25c4f3)[_0xaf00('0x25')](function(_0x367e69){if(_0x367e69){_0x227cc2=_0x367e69;return _0x367e69['getFields']();}return null;})[_0xaf00('0x25')](function(_0x3a4377){if(_0x3a4377){if(!_0x3a4377[_0xaf00('0x37')]){throw new db[(_0xaf00('0x6e'))]['ValidationErrorItem'](_0xaf00('0x6f'),0x193);}_0x4bf782=_0x3a4377;return db[_0xaf00('0x70')][_0xaf00('0x3f')]({'raw':!![]});}return null;})[_0xaf00('0x25')](function(_0x264cc4){if(_0x264cc4){_0x509be9=_[_0xaf00('0x71')](_0x264cc4,'id');var _0x4202e6;var _0x5cf247=squel['select']();_0x5cf247[_0xaf00('0x72')](_0x227cc2[_0xaf00('0x73')]);for(var _0xdca4e4=0x0;_0xdca4e4<_0x4bf782[_0xaf00('0x37')];_0xdca4e4+=0x1){_0x4202e6=_0x4bf782[_0xdca4e4]['MetricId']?_0x509be9[_0x4bf782[_0xdca4e4][_0xaf00('0x74')]][_0xaf00('0x75')]:_0x4bf782[_0xdca4e4][_0xaf00('0x6b')];_0x4202e6=_0x4bf782[_0xdca4e4][_0xaf00('0x76')]?_['replace'](_0x100038[_0x4bf782[_0xdca4e4]['function']],'%s',_0x4202e6):_0x4202e6;_0x4202e6=_0x4bf782[_0xdca4e4]['format']?_[_0xaf00('0x77')](_0x188eba[_0x4bf782[_0xdca4e4][_0xaf00('0x78')]],'%s',_0x4202e6):_0x4202e6;if(_0x4bf782[_0xdca4e4]['groupBy']){_0x5cf247[_0xaf00('0x79')](_0x4202e6);}_0x4bf782[_0xdca4e4][_0xaf00('0x7a')]&&_0x5cf247[_0xaf00('0x39')](_0x4202e6,_0x4bf782[_0xdca4e4]['orderBy']===_0xaf00('0x7b')?![]:!![]);_0x5cf247[_0xaf00('0x6b')](_0x4202e6,_0x4bf782[_0xdca4e4][_0xaf00('0x7c')]||_0x4202e6);}if(_0x227cc2[_0xaf00('0x7d')]){_0x227cc2[_0xaf00('0x7d')]=JSON[_0xaf00('0x7e')](_0x227cc2['joins']);for(var _0x883595=0x0;_0x883595<_0x227cc2[_0xaf00('0x7d')]['length'];_0x883595+=0x1){if(_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x2e')]&&_['includes'](_0x6b1a14,_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x2e')])&&_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x7f')]&&_0x227cc2[_0xaf00('0x7d')][_0x883595]['foreignTable']&&_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x80')]){_0x5cf247[_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x2e')]](_0x227cc2['joins'][_0x883595][_0xaf00('0x81')],null,util[_0xaf00('0x78')]('%s.%s\x20=\x20%s.%s',_0x227cc2[_0xaf00('0x73')],_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x7f')],_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x81')],_0x227cc2[_0xaf00('0x7d')][_0x883595][_0xaf00('0x80')]));}}}if(_0x227cc2[_0xaf00('0x82')]){_0x227cc2[_0xaf00('0x82')]=JSON[_0xaf00('0x7e')](_0x227cc2[_0xaf00('0x82')]);_0x5cf247[_0xaf00('0x3c')](_0x1ee3f2(_0x227cc2['conditions'][_0xaf00('0x79')]));}_0x21e76=_0x5cf247['clone']();_0x5cf247[_0xaf00('0x1c')](_0x21f5de);_0x5cf247[_0xaf00('0x1a')](0x0);logger[_0xaf00('0x83')](_0xaf00('0x84'),_0x5cf247['toString']());return dbH[_0xaf00('0x85')][_0xaf00('0x30')](_0x5cf247[_0xaf00('0x86')](),{'type':dbH[_0xaf00('0x85')]['QueryTypes'][_0xaf00('0x87')]});}})[_0xaf00('0x25')](respondWithResult(_0x311495,null))[_0xaf00('0x51')](handleError(_0x311495,null));};function runReport(_0x2e9dc7,_0x38fc3b,_0x441762){var _0x36dee1=_0x38fc3b[_0xaf00('0x2a')];var _0x5c0a1a=0xa;var _0x4aa395=[_0xaf00('0x55'),_0xaf00('0x56'),_0xaf00('0x57'),_0xaf00('0x58')];var _0x80036c={'SUM':_0xaf00('0x59'),'COUNT':_0xaf00('0x88'),'COUNT DISTINCT':_0xaf00('0x5a'),'MAX':_0xaf00('0x5b'),'MIN':_0xaf00('0x89'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xaf00('0x5d'),'GROUP_CONCAT ASC':_0xaf00('0x5e'),'GROUP_CONCAT DESC':_0xaf00('0x5f')};var _0x1b58bd={'SEC_TO_TIME':_0xaf00('0x60'),'DATE':_0xaf00('0x61'),'HOUR':_0xaf00('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd73371=function(_0x230e8e){return!_['includes']([_0xaf00('0x66'),'IS\x20NOT\x20NULL',_0xaf00('0x8a'),_0xaf00('0x68')],_0x230e8e);};var _0x332adc=function(_0x2b912c){if(!_0x2b912c||!_0x2b912c[_0xaf00('0x69')][_0xaf00('0x37')]){return'';}for(var _0x35a5a4='(',_0x2d98a3=0x0;_0x2d98a3<_0x2b912c['rules'][_0xaf00('0x37')];_0x2d98a3+=0x1){_0x2d98a3>0x0&&(_0x35a5a4+='\x20'+_0x2b912c[_0xaf00('0x6a')]+'\x20');_0x35a5a4+=_0x2b912c['rules'][_0x2d98a3][_0xaf00('0x79')]?_0x332adc(_0x2b912c[_0xaf00('0x69')][_0x2d98a3]['group']):_0x2b912c[_0xaf00('0x69')][_0x2d98a3]['field']+'\x20'+_0x2b912c['rules'][_0x2d98a3][_0xaf00('0x6c')]+(_0xd73371(_0x2b912c[_0xaf00('0x69')][_0x2d98a3][_0xaf00('0x6c')])?'\x20'+_0x2b912c[_0xaf00('0x69')][_0x2d98a3]['value']:'');}return _0x35a5a4+')';};var _0x10aa7d={'where':{'id':_0x2e9dc7['id']}},_0x30f6e4,_0x4b87e8,_0x112a9b,_0x40c950,_0x1f0cf6;_0x10aa7d=_[_0xaf00('0x3d')]({},_0x10aa7d,_0x441762);return db['AnalyticCustomReport'][_0xaf00('0x46')](_0x10aa7d)['then'](function(_0x19f227){if(_0x19f227){_0x30f6e4=_0x19f227;return _0x19f227['getFields']();}return null;})[_0xaf00('0x25')](function(_0x559a43){if(_0x559a43){if(!_0x559a43[_0xaf00('0x37')]){throw new db[(_0xaf00('0x6e'))][(_0xaf00('0x8b'))](_0xaf00('0x6f'),0x193);}_0x4b87e8=_0x559a43;return db['AnalyticMetric'][_0xaf00('0x3f')]({'raw':!![]});}return null;})[_0xaf00('0x25')](function(_0xbb24eb){if(_0xbb24eb){_0x112a9b=_['keyBy'](_0xbb24eb,'id');var _0x194a68;var _0x44016c=squel['select']();_0x44016c['from'](_0x30f6e4[_0xaf00('0x73')]);for(var _0xd615e4=0x0;_0xd615e4<_0x4b87e8[_0xaf00('0x37')];_0xd615e4+=0x1){_0x194a68=_0x4b87e8[_0xd615e4][_0xaf00('0x74')]?_0x112a9b[_0x4b87e8[_0xd615e4][_0xaf00('0x74')]][_0xaf00('0x75')]:_0x4b87e8[_0xd615e4]['field'];_0x194a68=_0x4b87e8[_0xd615e4][_0xaf00('0x76')]?_[_0xaf00('0x77')](_0x80036c[_0x4b87e8[_0xd615e4][_0xaf00('0x76')]],'%s',_0x194a68):_0x194a68;_0x194a68=_0x4b87e8[_0xd615e4][_0xaf00('0x78')]?_[_0xaf00('0x77')](_0x1b58bd[_0x4b87e8[_0xd615e4]['format']],'%s',_0x194a68):_0x194a68;if(_0x4b87e8[_0xd615e4]['groupBy']){_0x44016c[_0xaf00('0x79')](_0x194a68);}_0x4b87e8[_0xd615e4][_0xaf00('0x7a')]&&_0x44016c[_0xaf00('0x39')](_0x194a68,_0x4b87e8[_0xd615e4][_0xaf00('0x7a')]===_0xaf00('0x7b')?![]:!![]);_0x44016c['field'](_0x194a68,_0x4b87e8[_0xd615e4][_0xaf00('0x7c')]||_0x194a68);}if(_0x30f6e4[_0xaf00('0x7d')]){_0x30f6e4[_0xaf00('0x7d')]=JSON[_0xaf00('0x7e')](_0x30f6e4['joins']);for(var _0x42499d=0x0;_0x42499d<_0x30f6e4[_0xaf00('0x7d')][_0xaf00('0x37')];_0x42499d+=0x1){if(_0x30f6e4[_0xaf00('0x7d')][_0x42499d][_0xaf00('0x2e')]&&_[_0xaf00('0x65')](_0x4aa395,_0x30f6e4[_0xaf00('0x7d')][_0x42499d][_0xaf00('0x2e')])&&_0x30f6e4[_0xaf00('0x7d')][_0x42499d][_0xaf00('0x7f')]&&_0x30f6e4[_0xaf00('0x7d')][_0x42499d][_0xaf00('0x81')]&&_0x30f6e4[_0xaf00('0x7d')][_0x42499d]['foreignKey']){_0x44016c[_0x30f6e4['joins'][_0x42499d][_0xaf00('0x2e')]](_0x30f6e4[_0xaf00('0x7d')][_0x42499d]['foreignTable'],null,util[_0xaf00('0x78')](_0xaf00('0x8c'),_0x30f6e4['table'],_0x30f6e4[_0xaf00('0x7d')][_0x42499d][_0xaf00('0x7f')],_0x30f6e4['joins'][_0x42499d][_0xaf00('0x81')],_0x30f6e4[_0xaf00('0x7d')][_0x42499d][_0xaf00('0x80')]));}}}if(_0x30f6e4[_0xaf00('0x82')]){_0x30f6e4[_0xaf00('0x82')]=JSON[_0xaf00('0x7e')](_0x30f6e4[_0xaf00('0x82')]);_0x44016c[_0xaf00('0x3c')](_0x332adc(_0x30f6e4[_0xaf00('0x82')][_0xaf00('0x79')]));}_0x1f0cf6=_0x44016c['clone']();_0x44016c[_0xaf00('0x1c')](_0x5c0a1a);_0x44016c[_0xaf00('0x1a')](0x0);return;}})[_0xaf00('0x25')](function(){if(_0x38fc3b['output']===_0xaf00('0x8d')){return null;}var _0x5b4322=_['merge'](_0x38fc3b,{'name':_0x38fc3b['fullPath']||_0x38fc3b[_0xaf00('0x2a')]||_0x30f6e4[_0xaf00('0x2a')],'basename':_0x36dee1,'savename':util[_0xaf00('0x78')](_0xaf00('0x8e'),_0x38fc3b[_0xaf00('0x2a')]||_0x30f6e4[_0xaf00('0x2a')],require(_0xaf00('0x8f'))[_0xaf00('0x90')](0x4),_0x38fc3b[_0xaf00('0x91')]||_0xaf00('0x92')),'reportId':_0x30f6e4['id'],'reportType':_0xaf00('0x93')});return db[_0xaf00('0x94')][_0xaf00('0x47')](_0x5b4322,{'raw':!![]});})[_0xaf00('0x25')](function(_0x4f81da){if(_0x30f6e4[_0xaf00('0x73')]===_0xaf00('0x95')){_0x1f0cf6[_0xaf00('0x3c')](_0x30f6e4[_0xaf00('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x38fc3b['startDate'],_0x38fc3b[_0xaf00('0x96')]);}else{_0x1f0cf6[_0xaf00('0x3c')](_0x30f6e4[_0xaf00('0x73')]+_0xaf00('0x97'),_0x38fc3b['startDate'],_0x38fc3b[_0xaf00('0x96')]);}if(_0x4f81da){logger[_0xaf00('0x98')](_0xaf00('0x99'),_0x1f0cf6[_0xaf00('0x86')]());require('child_process')[_0xaf00('0x9a')](path[_0xaf00('0x55')](__dirname,_0xaf00('0x9b'),_0x4f81da[_0xaf00('0x91')]),[_0x4f81da['id'],_0x1f0cf6['toString'](),path[_0xaf00('0x55')](__dirname,_0xaf00('0x9c'),_0x4f81da[_0xaf00('0x9d')]),_0x36dee1]);return _0x4f81da;}else{var _0x20fcd5=squel['select']();_0x20fcd5['from']('('+_0x1f0cf6[_0xaf00('0x86')]()+')',_0xaf00('0x9e'));_0x20fcd5['field'](_0xaf00('0x9f'),_0xaf00('0x1d'));_0x1f0cf6['limit'](_0x38fc3b['limit']||_0x5c0a1a);_0x1f0cf6[_0xaf00('0x1a')](_0x38fc3b['offset']||0x0);return dbH[_0xaf00('0x85')][_0xaf00('0x30')](_0x20fcd5[_0xaf00('0x86')](),{'type':dbH[_0xaf00('0x85')]['QueryTypes'][_0xaf00('0x87')]})[_0xaf00('0x25')](function(_0x55ebdf){if(!_0x55ebdf[_0xaf00('0x37')]){_0x40c950=0x0;}else{_0x40c950=_0x55ebdf[0x0][_0xaf00('0x1d')]||0x0;}return dbH[_0xaf00('0x85')][_0xaf00('0x30')](_0x1f0cf6['toString'](),{'type':dbH['sequelize'][_0xaf00('0xa0')][_0xaf00('0x87')]});})['then'](function(_0x4b01e3){return{'rows':_0x4b01e3||[],'count':_0x40c950};});}});}exports['run']=function(_0x478cd4,_0x36f05b){return runReport(_0x478cd4[_0xaf00('0x41')],_0x478cd4['query'],_0x478cd4[_0xaf00('0x45')])[_0xaf00('0x25')](respondWithResult(_0x36f05b,null))['catch'](handleError(_0x36f05b,null));};exports[_0xaf00('0xa1')]=runReport;exports['query']=function(_0x56c473,_0x59d944){var _0x3cab4f=0xa;var _0x3b9750=[_0xaf00('0x55'),_0xaf00('0x56'),'right_join',_0xaf00('0x58')];var _0x55aa21={'SUM':_0xaf00('0x59'),'COUNT':_0xaf00('0x88'),'COUNT DISTINCT':_0xaf00('0x5a'),'MAX':_0xaf00('0x5b'),'MIN':_0xaf00('0x89'),'AVG':_0xaf00('0x5c'),'GROUP_CONCAT':_0xaf00('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xaf00('0x5f')};var _0x301fd8={'SEC_TO_TIME':_0xaf00('0x60'),'DATE':_0xaf00('0x61'),'HOUR':_0xaf00('0x62'),'ROUND':_0xaf00('0x63'),'UNIX_TIMESTAMP':_0xaf00('0x64')};var _0x3402a1=function(_0x564e51){return!_[_0xaf00('0x65')]([_0xaf00('0x66'),'IS\x20NOT\x20NULL',_0xaf00('0x8a'),'IS\x20NOT\x20EMPTY'],_0x564e51);};var _0x3b4913=function(_0x5889bc){if(!_0x5889bc||!_0x5889bc[_0xaf00('0x69')][_0xaf00('0x37')]){return'';}for(var _0x31350e='(',_0x97914=0x0;_0x97914<_0x5889bc[_0xaf00('0x69')]['length'];_0x97914+=0x1){_0x97914>0x0&&(_0x31350e+='\x20'+_0x5889bc[_0xaf00('0x6a')]+'\x20');_0x31350e+=_0x5889bc[_0xaf00('0x69')][_0x97914][_0xaf00('0x79')]?_0x3b4913(_0x5889bc[_0xaf00('0x69')][_0x97914][_0xaf00('0x79')]):_0x5889bc['rules'][_0x97914]['field']+'\x20'+_0x5889bc[_0xaf00('0x69')][_0x97914][_0xaf00('0x6c')]+(_0x3402a1(_0x5889bc['rules'][_0x97914][_0xaf00('0x6c')])?'\x20'+_0x5889bc[_0xaf00('0x69')][_0x97914][_0xaf00('0x6d')]:'');}return _0x31350e+')';};var _0x3f2409={'where':{'id':_0x56c473[_0xaf00('0x41')]['id']}},_0x55f37c,_0x54a6db,_0x4a6a2b,_0x41d18f,_0x157e79;_0x3f2409=_[_0xaf00('0x3d')]({},_0x3f2409,_0x56c473[_0xaf00('0x45')]);return db[_0xaf00('0x42')]['find'](_0x3f2409)[_0xaf00('0x25')](function(_0x2d67e3){if(_0x2d67e3){_0x55f37c=_0x2d67e3;return _0x2d67e3[_0xaf00('0xa2')]();}return null;})[_0xaf00('0x25')](function(_0x4a24d2){if(_0x4a24d2){if(!_0x4a24d2[_0xaf00('0x37')]){throw new db[(_0xaf00('0x6e'))]['ValidationErrorItem'](_0xaf00('0x6f'),0x193);}_0x54a6db=_0x4a24d2;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xaf00('0x25')](function(_0xc74eb0){if(_0xc74eb0){_0x4a6a2b=_['keyBy'](_0xc74eb0,'id');var _0x217a35;var _0x4c651a=squel[_0xaf00('0xa3')]();_0x4c651a[_0xaf00('0x72')](_0x55f37c[_0xaf00('0x73')]);for(var _0x182b57=0x0;_0x182b57<_0x54a6db['length'];_0x182b57+=0x1){_0x217a35=_0x54a6db[_0x182b57]['MetricId']?_0x4a6a2b[_0x54a6db[_0x182b57]['MetricId']][_0xaf00('0x75')]:_0x54a6db[_0x182b57]['field'];_0x217a35=_0x54a6db[_0x182b57][_0xaf00('0x76')]?_[_0xaf00('0x77')](_0x55aa21[_0x54a6db[_0x182b57][_0xaf00('0x76')]],'%s',_0x217a35):_0x217a35;_0x217a35=_0x54a6db[_0x182b57]['format']?_['replace'](_0x301fd8[_0x54a6db[_0x182b57][_0xaf00('0x78')]],'%s',_0x217a35):_0x217a35;if(_0x54a6db[_0x182b57][_0xaf00('0xa4')]){_0x4c651a[_0xaf00('0x79')](_0x217a35);}_0x54a6db[_0x182b57][_0xaf00('0x7a')]&&_0x4c651a['order'](_0x217a35,_0x54a6db[_0x182b57]['orderBy']===_0xaf00('0x7b')?![]:!![]);_0x4c651a[_0xaf00('0x6b')](_0x217a35,_0x54a6db[_0x182b57][_0xaf00('0x7c')]||_0x217a35);}if(_0x55f37c[_0xaf00('0x7d')]){_0x55f37c[_0xaf00('0x7d')]=JSON[_0xaf00('0x7e')](_0x55f37c[_0xaf00('0x7d')]);for(var _0x1f055a=0x0;_0x1f055a<_0x55f37c['joins'][_0xaf00('0x37')];_0x1f055a+=0x1){if(_0x55f37c[_0xaf00('0x7d')][_0x1f055a][_0xaf00('0x2e')]&&_['includes'](_0x3b9750,_0x55f37c['joins'][_0x1f055a]['type'])&&_0x55f37c['joins'][_0x1f055a][_0xaf00('0x7f')]&&_0x55f37c[_0xaf00('0x7d')][_0x1f055a][_0xaf00('0x81')]&&_0x55f37c[_0xaf00('0x7d')][_0x1f055a][_0xaf00('0x80')]){_0x4c651a[_0x55f37c[_0xaf00('0x7d')][_0x1f055a][_0xaf00('0x2e')]](_0x55f37c[_0xaf00('0x7d')][_0x1f055a]['foreignTable'],null,util[_0xaf00('0x78')](_0xaf00('0x8c'),_0x55f37c[_0xaf00('0x73')],_0x55f37c['joins'][_0x1f055a]['parentKey'],_0x55f37c['joins'][_0x1f055a][_0xaf00('0x81')],_0x55f37c[_0xaf00('0x7d')][_0x1f055a][_0xaf00('0x80')]));}}}if(_0x55f37c[_0xaf00('0x82')]){_0x55f37c[_0xaf00('0x82')]=JSON['parse'](_0x55f37c['conditions']);_0x4c651a[_0xaf00('0x3c')](_0x3b4913(_0x55f37c[_0xaf00('0x82')][_0xaf00('0x79')]));}_0x157e79=_0x4c651a['clone']();_0x4c651a[_0xaf00('0x1c')](_0x3cab4f);_0x4c651a[_0xaf00('0x1a')](0x0);logger[_0xaf00('0x83')](_0xaf00('0x84'),_0x4c651a[_0xaf00('0x86')]());return dbH[_0xaf00('0x85')][_0xaf00('0x30')](_0x4c651a[_0xaf00('0x86')](),{'type':dbH[_0xaf00('0x85')]['QueryTypes'][_0xaf00('0x87')]});}})[_0xaf00('0x25')](function(){return{'sql':_0x157e79[_0xaf00('0x86')]()};})[_0xaf00('0x25')](respondWithResult(_0x59d944,null))[_0xaf00('0x51')](handleError(_0x59d944,null));}; \ No newline at end of file +var _0x7f66=['QueryTypes','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','json','offset','limit','undefined','count','apply','update','then','CustomReports','UserProfileResource','destroy','error','stack','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','name','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','includeAll','include','rows','catch','filters','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','MIN(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','getFields','Sequelize','select','metric','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x554dfa,_0x2cf08d){var _0x32a8db=function(_0x58c112){while(--_0x58c112){_0x554dfa['push'](_0x554dfa['shift']());}};_0x32a8db(++_0x2cf08d);}(_0x7f66,0x14f));var _0x67f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7f66[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x67f6('0x0'));var rimraf=require(_0x67f6('0x1'));var zipdir=require(_0x67f6('0x2'));var jsonpatch=require(_0x67f6('0x3'));var rp=require('request-promise');var moment=require(_0x67f6('0x4'));var BPromise=require(_0x67f6('0x5'));var Mustache=require(_0x67f6('0x6'));var util=require(_0x67f6('0x7'));var path=require(_0x67f6('0x8'));var sox=require(_0x67f6('0x9'));var csv=require(_0x67f6('0xa'));var ejs=require(_0x67f6('0xb'));var fs=require('fs');var fs_extra=require(_0x67f6('0xc'));var _=require(_0x67f6('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x67f6('0xe'));var deskjs=require(_0x67f6('0xf'));var toCsv=require(_0x67f6('0xa'));var querystring=require(_0x67f6('0x10'));var Papa=require(_0x67f6('0x11'));var Redis=require('ioredis');var authService=require(_0x67f6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67f6('0x13'));var logger=require(_0x67f6('0x14'))(_0x67f6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x67f6('0x16'))[_0x67f6('0x17')];function respondWithStatusCode(_0x5a5e19,_0x3143dd){_0x3143dd=_0x3143dd||0xcc;return function(_0x197ade){if(_0x197ade){return _0x5a5e19[_0x67f6('0x18')](_0x3143dd);}return _0x5a5e19['status'](_0x3143dd)['end']();};}function respondWithResult(_0x423dcd,_0x466487){_0x466487=_0x466487||0xc8;return function(_0x3c691a){if(_0x3c691a){return _0x423dcd[_0x67f6('0x19')](_0x466487)[_0x67f6('0x1a')](_0x3c691a);}};}function respondWithFilteredResult(_0x530835,_0x21b9ed){return function(_0x123650){if(_0x123650){var _0x7d9a33=typeof _0x21b9ed[_0x67f6('0x1b')]==='undefined'&&typeof _0x21b9ed[_0x67f6('0x1c')]===_0x67f6('0x1d');var _0x2dcd7c=_0x123650['count'];var _0xe5eb=_0x7d9a33?0x0:_0x21b9ed[_0x67f6('0x1b')];var _0x3c502c=_0x7d9a33?_0x123650[_0x67f6('0x1e')]:_0x21b9ed[_0x67f6('0x1b')]+_0x21b9ed['limit'];var _0x5f225c;if(_0x3c502c>=_0x2dcd7c){_0x3c502c=_0x2dcd7c;_0x5f225c=0xc8;}else{_0x5f225c=0xce;}_0x530835['status'](_0x5f225c);return _0x530835['set']('Content-Range',_0xe5eb+'-'+_0x3c502c+'/'+_0x2dcd7c)[_0x67f6('0x1a')](_0x123650);}return null;};}function patchUpdates(_0x1aeee7){return function(_0x417256){try{jsonpatch[_0x67f6('0x1f')](_0x417256,_0x1aeee7,!![]);}catch(_0x3a037c){return BPromise['reject'](_0x3a037c);}return _0x417256['save']();};}function saveUpdates(_0x39812b,_0x56b48c){return function(_0x3ab62e){if(_0x3ab62e){return _0x3ab62e[_0x67f6('0x20')](_0x39812b)[_0x67f6('0x21')](function(_0x37b1b9){return _0x37b1b9;});}return null;};}function removeEntity(_0x1c1522,_0x5e9e1f){return function(_0x829191){if(_0x829191){return _0x829191['destroy']()[_0x67f6('0x21')](function(){var _0x5a12c2=_0x829191['get']({'plain':!![]});var _0xbf48c4=_0x67f6('0x22');return db[_0x67f6('0x23')][_0x67f6('0x24')]({'where':{'type':_0xbf48c4,'resourceId':_0x5a12c2['id']}})[_0x67f6('0x21')](function(){return _0x829191;});})[_0x67f6('0x21')](function(){_0x1c1522['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1923,_0x109ec1){return function(_0x521dcb){if(!_0x521dcb){_0x3d1923['sendStatus'](0x194);}return _0x521dcb;};}function handleError(_0xef86e3,_0x2b9fd4){_0x2b9fd4=_0x2b9fd4||0x1f4;return function(_0x488679){logger[_0x67f6('0x25')](_0x488679[_0x67f6('0x26')]);if(_0x488679['name']){delete _0x488679['name'];}_0xef86e3[_0x67f6('0x19')](_0x2b9fd4)[_0x67f6('0x27')](_0x488679);};}exports['index']=function(_0x3b361e,_0x25ec42){var _0x252cdd={},_0x3b1b3c={},_0x4763f8={'count':0x0,'rows':[]};var _0x338a52=_[_0x67f6('0x28')](db[_0x67f6('0x29')][_0x67f6('0x2a')],function(_0x2d2790){return{'name':_0x2d2790[_0x67f6('0x2b')],'type':_0x2d2790[_0x67f6('0x2c')][_0x67f6('0x2d')]};});_0x3b1b3c['model']=_['map'](_0x338a52,_0x67f6('0x2e'));_0x3b1b3c[_0x67f6('0x2f')]=_[_0x67f6('0x30')](_0x3b361e[_0x67f6('0x2f')]);_0x3b1b3c['filters']=_['intersection'](_0x3b1b3c[_0x67f6('0x31')],_0x3b1b3c[_0x67f6('0x2f')]);_0x252cdd[_0x67f6('0x32')]=_[_0x67f6('0x33')](_0x3b1b3c[_0x67f6('0x31')],qs[_0x67f6('0x34')](_0x3b361e['query'][_0x67f6('0x34')]));_0x252cdd[_0x67f6('0x32')]=_0x252cdd['attributes'][_0x67f6('0x35')]?_0x252cdd[_0x67f6('0x32')]:_0x3b1b3c['model'];if(!_0x3b361e[_0x67f6('0x2f')][_0x67f6('0x36')](_0x67f6('0x37'))){_0x252cdd[_0x67f6('0x1c')]=qs[_0x67f6('0x1c')](_0x3b361e[_0x67f6('0x2f')][_0x67f6('0x1c')]);_0x252cdd[_0x67f6('0x1b')]=qs[_0x67f6('0x1b')](_0x3b361e[_0x67f6('0x2f')][_0x67f6('0x1b')]);}_0x252cdd[_0x67f6('0x38')]=qs[_0x67f6('0x39')](_0x3b361e[_0x67f6('0x2f')]['sort']);_0x252cdd['where']=qs['filters'](_[_0x67f6('0x3a')](_0x3b361e['query'],_0x3b1b3c['filters']),_0x338a52);if(_0x3b361e[_0x67f6('0x2f')]['filter']){_0x252cdd[_0x67f6('0x3b')]=_[_0x67f6('0x3c')](_0x252cdd[_0x67f6('0x3b')],{'$or':_[_0x67f6('0x28')](_0x338a52,function(_0x5c5273){if(_0x5c5273['type']!==_0x67f6('0x3d')){var _0x3457f8={};_0x3457f8[_0x5c5273['name']]={'$like':'%'+_0x3b361e['query']['filter']+'%'};return _0x3457f8;}})});}_0x252cdd=_[_0x67f6('0x3c')]({},_0x252cdd,_0x3b361e['options']);var _0x11c712={'where':_0x252cdd[_0x67f6('0x3b')]};return db[_0x67f6('0x29')]['count'](_0x11c712)['then'](function(_0x38d382){_0x4763f8['count']=_0x38d382;if(_0x3b361e['query'][_0x67f6('0x3e')]){_0x252cdd[_0x67f6('0x3f')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x252cdd);})[_0x67f6('0x21')](function(_0x2127f5){_0x4763f8[_0x67f6('0x40')]=_0x2127f5;return _0x4763f8;})[_0x67f6('0x21')](respondWithFilteredResult(_0x25ec42,_0x252cdd))[_0x67f6('0x41')](handleError(_0x25ec42,null));};exports['show']=function(_0x49aa44,_0x5b0621){var _0x4b9397={'raw':![],'where':{'id':_0x49aa44['params']['id']}},_0x345e94={};_0x345e94[_0x67f6('0x31')]=_[_0x67f6('0x30')](db['AnalyticCustomReport']['rawAttributes']);_0x345e94[_0x67f6('0x2f')]=_[_0x67f6('0x30')](_0x49aa44[_0x67f6('0x2f')]);_0x345e94[_0x67f6('0x42')]=_['intersection'](_0x345e94['model'],_0x345e94[_0x67f6('0x2f')]);_0x4b9397[_0x67f6('0x32')]=_[_0x67f6('0x33')](_0x345e94['model'],qs['fields'](_0x49aa44[_0x67f6('0x2f')][_0x67f6('0x34')]));_0x4b9397[_0x67f6('0x32')]=_0x4b9397[_0x67f6('0x32')][_0x67f6('0x35')]?_0x4b9397[_0x67f6('0x32')]:_0x345e94[_0x67f6('0x31')];if(_0x49aa44[_0x67f6('0x2f')][_0x67f6('0x3e')]){_0x4b9397[_0x67f6('0x3f')]=[{'all':!![]}];}_0x4b9397=_[_0x67f6('0x3c')]({},_0x4b9397,_0x49aa44[_0x67f6('0x43')]);return db[_0x67f6('0x29')][_0x67f6('0x44')](_0x4b9397)['then'](handleEntityNotFound(_0x5b0621,null))[_0x67f6('0x21')](respondWithResult(_0x5b0621,null))['catch'](handleError(_0x5b0621,null));};exports[_0x67f6('0x45')]=function(_0x3e4770,_0xb47d29){return db[_0x67f6('0x29')][_0x67f6('0x45')](_0x3e4770[_0x67f6('0x46')],{})[_0x67f6('0x21')](function(_0x3a8d0f){var _0x638416=_0x3e4770['user'][_0x67f6('0x47')]({'plain':!![]});if(!_0x638416)throw new Error(_0x67f6('0x48'));if(_0x638416[_0x67f6('0x49')]===_0x67f6('0x4a')){var _0x28f7c6=_0x3a8d0f[_0x67f6('0x47')]({'plain':!![]});var _0x4a0865=_0x67f6('0x4b');return db[_0x67f6('0x4c')][_0x67f6('0x44')]({'where':{'name':_0x4a0865,'userProfileId':_0x638416['userProfileId']},'raw':!![]})[_0x67f6('0x21')](function(_0x2b7fc5){if(_0x2b7fc5&&_0x2b7fc5['autoAssociation']===0x0){return db[_0x67f6('0x23')][_0x67f6('0x45')]({'name':_0x28f7c6['name'],'resourceId':_0x28f7c6['id'],'type':'CustomReports','sectionId':_0x2b7fc5['id']},{})['then'](function(){return _0x3a8d0f;});}else{return _0x3a8d0f;}})[_0x67f6('0x41')](function(_0x24bce1){logger[_0x67f6('0x25')](_0x67f6('0x4d'),_0x24bce1);throw _0x24bce1;});}return _0x3a8d0f;})[_0x67f6('0x21')](respondWithResult(_0xb47d29,0xc9))[_0x67f6('0x41')](handleError(_0xb47d29,null));};exports['update']=function(_0x281945,_0x554ca7){if(_0x281945[_0x67f6('0x46')]['id']){delete _0x281945[_0x67f6('0x46')]['id'];}return db['AnalyticCustomReport'][_0x67f6('0x44')]({'where':{'id':_0x281945[_0x67f6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x554ca7,null))['then'](saveUpdates(_0x281945[_0x67f6('0x46')],null))['then'](respondWithResult(_0x554ca7,null))[_0x67f6('0x41')](handleError(_0x554ca7,null));};exports[_0x67f6('0x24')]=function(_0x39a754,_0x2c3104){return db[_0x67f6('0x29')]['find']({'where':{'id':_0x39a754[_0x67f6('0x4e')]['id']}})[_0x67f6('0x21')](handleEntityNotFound(_0x2c3104,null))[_0x67f6('0x21')](removeEntity(_0x2c3104,null))[_0x67f6('0x41')](handleError(_0x2c3104,null));};exports[_0x67f6('0x4f')]=function(_0x52671a,_0x4510be){var _0x529d15=0xa;var _0x35d966=[_0x67f6('0x50'),_0x67f6('0x51'),_0x67f6('0x52'),_0x67f6('0x53')];var _0x1e4f96={'SUM':_0x67f6('0x54'),'COUNT':_0x67f6('0x55'),'COUNT DISTINCT':_0x67f6('0x56'),'MAX':_0x67f6('0x57'),'MIN':'MIN(%s)','AVG':_0x67f6('0x58'),'GROUP_CONCAT':_0x67f6('0x59'),'GROUP_CONCAT ASC':_0x67f6('0x5a'),'GROUP_CONCAT DESC':_0x67f6('0x5b')};var _0x518e63={'SEC_TO_TIME':_0x67f6('0x5c'),'DATE':_0x67f6('0x5d'),'HOUR':_0x67f6('0x5e'),'ROUND':_0x67f6('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4dee0f=function(_0x2a4113){return!_[_0x67f6('0x60')]([_0x67f6('0x61'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x67f6('0x62')],_0x2a4113);};var _0x10d3fd=function(_0x234a67){if(!_0x234a67||!_0x234a67[_0x67f6('0x63')][_0x67f6('0x35')]){return'';}for(var _0x24f46c='(',_0x32f893=0x0;_0x32f893<_0x234a67[_0x67f6('0x63')][_0x67f6('0x35')];_0x32f893+=0x1){_0x32f893>0x0&&(_0x24f46c+='\x20'+_0x234a67[_0x67f6('0x64')]+'\x20');_0x24f46c+=_0x234a67['rules'][_0x32f893][_0x67f6('0x65')]?_0x10d3fd(_0x234a67[_0x67f6('0x63')][_0x32f893][_0x67f6('0x65')]):_0x234a67['rules'][_0x32f893][_0x67f6('0x66')]+'\x20'+_0x234a67['rules'][_0x32f893]['condition']+(_0x4dee0f(_0x234a67[_0x67f6('0x63')][_0x32f893][_0x67f6('0x67')])?'\x20'+_0x234a67['rules'][_0x32f893][_0x67f6('0x68')]:'');}return _0x24f46c+')';};var _0x1b6a67={'where':{'id':_0x52671a[_0x67f6('0x4e')]['id']}},_0x27b8c1,_0x1a0330,_0x46a2d3,_0x2d4526,_0x159185;_0x1b6a67=_[_0x67f6('0x3c')]({},_0x1b6a67,_0x52671a['options']);return db[_0x67f6('0x29')][_0x67f6('0x44')](_0x1b6a67)[_0x67f6('0x21')](function(_0x61518c){if(_0x61518c){_0x27b8c1=_0x61518c;return _0x61518c['getFields']();}return null;})[_0x67f6('0x21')](function(_0xbecda0){if(_0xbecda0){if(!_0xbecda0[_0x67f6('0x35')]){throw new db['Sequelize'][(_0x67f6('0x69'))](_0x67f6('0x6a'),0x193);}_0x1a0330=_0xbecda0;return db[_0x67f6('0x6b')][_0x67f6('0x6c')]({'raw':!![]});}return null;})[_0x67f6('0x21')](function(_0x1c57ee){if(_0x1c57ee){_0x46a2d3=_[_0x67f6('0x6d')](_0x1c57ee,'id');var _0x52f6b6;var _0x590309=squel['select']();_0x590309[_0x67f6('0x6e')](_0x27b8c1['table']);for(var _0x3bfdfc=0x0;_0x3bfdfc<_0x1a0330[_0x67f6('0x35')];_0x3bfdfc+=0x1){_0x52f6b6=_0x1a0330[_0x3bfdfc][_0x67f6('0x6f')]?_0x46a2d3[_0x1a0330[_0x3bfdfc][_0x67f6('0x6f')]]['metric']:_0x1a0330[_0x3bfdfc][_0x67f6('0x66')];_0x52f6b6=_0x1a0330[_0x3bfdfc][_0x67f6('0x70')]?_[_0x67f6('0x71')](_0x1e4f96[_0x1a0330[_0x3bfdfc][_0x67f6('0x70')]],'%s',_0x52f6b6):_0x52f6b6;_0x52f6b6=_0x1a0330[_0x3bfdfc][_0x67f6('0x72')]?_[_0x67f6('0x71')](_0x518e63[_0x1a0330[_0x3bfdfc]['format']],'%s',_0x52f6b6):_0x52f6b6;if(_0x1a0330[_0x3bfdfc][_0x67f6('0x73')]){_0x590309[_0x67f6('0x65')](_0x52f6b6);}_0x1a0330[_0x3bfdfc][_0x67f6('0x74')]&&_0x590309[_0x67f6('0x38')](_0x52f6b6,_0x1a0330[_0x3bfdfc][_0x67f6('0x74')]==='DESC'?![]:!![]);_0x590309[_0x67f6('0x66')](_0x52f6b6,_0x1a0330[_0x3bfdfc][_0x67f6('0x75')]||_0x52f6b6);}if(_0x27b8c1[_0x67f6('0x76')]){_0x27b8c1[_0x67f6('0x76')]=JSON['parse'](_0x27b8c1[_0x67f6('0x76')]);for(var _0x13a7d0=0x0;_0x13a7d0<_0x27b8c1['joins'][_0x67f6('0x35')];_0x13a7d0+=0x1){if(_0x27b8c1[_0x67f6('0x76')][_0x13a7d0][_0x67f6('0x2c')]&&_[_0x67f6('0x60')](_0x35d966,_0x27b8c1['joins'][_0x13a7d0][_0x67f6('0x2c')])&&_0x27b8c1[_0x67f6('0x76')][_0x13a7d0][_0x67f6('0x77')]&&_0x27b8c1['joins'][_0x13a7d0][_0x67f6('0x78')]&&_0x27b8c1['joins'][_0x13a7d0][_0x67f6('0x79')]){_0x590309[_0x27b8c1[_0x67f6('0x76')][_0x13a7d0][_0x67f6('0x2c')]](_0x27b8c1[_0x67f6('0x76')][_0x13a7d0][_0x67f6('0x78')],null,util[_0x67f6('0x72')](_0x67f6('0x7a'),_0x27b8c1[_0x67f6('0x7b')],_0x27b8c1[_0x67f6('0x76')][_0x13a7d0][_0x67f6('0x77')],_0x27b8c1['joins'][_0x13a7d0][_0x67f6('0x78')],_0x27b8c1[_0x67f6('0x76')][_0x13a7d0][_0x67f6('0x79')]));}}}if(_0x27b8c1['conditions']){_0x27b8c1[_0x67f6('0x7c')]=JSON[_0x67f6('0x7d')](_0x27b8c1[_0x67f6('0x7c')]);_0x590309['where'](_0x10d3fd(_0x27b8c1[_0x67f6('0x7c')]['group']));}_0x159185=_0x590309[_0x67f6('0x7e')]();_0x590309[_0x67f6('0x1c')](_0x529d15);_0x590309['offset'](0x0);logger[_0x67f6('0x7f')](_0x67f6('0x80'),_0x590309[_0x67f6('0x81')]());return dbH[_0x67f6('0x82')][_0x67f6('0x2f')](_0x590309[_0x67f6('0x81')](),{'type':dbH[_0x67f6('0x82')]['QueryTypes'][_0x67f6('0x83')]});}})[_0x67f6('0x21')](respondWithResult(_0x4510be,null))[_0x67f6('0x41')](handleError(_0x4510be,null));};function runReport(_0x40824a,_0x375de0,_0xd63724){var _0xd3a126=_0x375de0['name'];var _0x5eba3d=0xa;var _0xb8a0cd=[_0x67f6('0x50'),_0x67f6('0x51'),_0x67f6('0x52'),_0x67f6('0x53')];var _0x5d34f6={'SUM':'SUM(%s)','COUNT':_0x67f6('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x67f6('0x57'),'MIN':_0x67f6('0x84'),'AVG':_0x67f6('0x58'),'GROUP_CONCAT':_0x67f6('0x59'),'GROUP_CONCAT ASC':_0x67f6('0x5a'),'GROUP_CONCAT DESC':_0x67f6('0x5b')};var _0x4dcde9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x67f6('0x5d'),'HOUR':_0x67f6('0x5e'),'ROUND':_0x67f6('0x5f'),'UNIX_TIMESTAMP':_0x67f6('0x85')};var _0x3b0c54=function(_0x3f7db6){return!_[_0x67f6('0x60')](['IS\x20NULL',_0x67f6('0x86'),_0x67f6('0x87'),_0x67f6('0x62')],_0x3f7db6);};var _0x31c9bd=function(_0x3244f6){if(!_0x3244f6||!_0x3244f6[_0x67f6('0x63')][_0x67f6('0x35')]){return'';}for(var _0xa774da='(',_0xba7798=0x0;_0xba7798<_0x3244f6[_0x67f6('0x63')][_0x67f6('0x35')];_0xba7798+=0x1){_0xba7798>0x0&&(_0xa774da+='\x20'+_0x3244f6[_0x67f6('0x64')]+'\x20');_0xa774da+=_0x3244f6[_0x67f6('0x63')][_0xba7798][_0x67f6('0x65')]?_0x31c9bd(_0x3244f6['rules'][_0xba7798][_0x67f6('0x65')]):_0x3244f6[_0x67f6('0x63')][_0xba7798][_0x67f6('0x66')]+'\x20'+_0x3244f6[_0x67f6('0x63')][_0xba7798][_0x67f6('0x67')]+(_0x3b0c54(_0x3244f6[_0x67f6('0x63')][_0xba7798][_0x67f6('0x67')])?'\x20'+_0x3244f6[_0x67f6('0x63')][_0xba7798]['value']:'');}return _0xa774da+')';};var _0x449757={'where':{'id':_0x40824a['id']}},_0x4dc2d8,_0x3acbf0,_0x4a7804,_0x145706,_0x2c1404;_0x449757=_['merge']({},_0x449757,_0xd63724);return db[_0x67f6('0x29')][_0x67f6('0x44')](_0x449757)[_0x67f6('0x21')](function(_0x3c9609){if(_0x3c9609){_0x4dc2d8=_0x3c9609;return _0x3c9609[_0x67f6('0x88')]();}return null;})['then'](function(_0x1ff730){if(_0x1ff730){if(!_0x1ff730[_0x67f6('0x35')]){throw new db[(_0x67f6('0x89'))][(_0x67f6('0x69'))](_0x67f6('0x6a'),0x193);}_0x3acbf0=_0x1ff730;return db['AnalyticMetric'][_0x67f6('0x6c')]({'raw':!![]});}return null;})[_0x67f6('0x21')](function(_0x1f3c18){if(_0x1f3c18){_0x4a7804=_[_0x67f6('0x6d')](_0x1f3c18,'id');var _0x5c4014;var _0x5da9ec=squel[_0x67f6('0x8a')]();_0x5da9ec[_0x67f6('0x6e')](_0x4dc2d8[_0x67f6('0x7b')]);for(var _0x374a8b=0x0;_0x374a8b<_0x3acbf0[_0x67f6('0x35')];_0x374a8b+=0x1){_0x5c4014=_0x3acbf0[_0x374a8b]['MetricId']?_0x4a7804[_0x3acbf0[_0x374a8b][_0x67f6('0x6f')]][_0x67f6('0x8b')]:_0x3acbf0[_0x374a8b][_0x67f6('0x66')];_0x5c4014=_0x3acbf0[_0x374a8b][_0x67f6('0x70')]?_[_0x67f6('0x71')](_0x5d34f6[_0x3acbf0[_0x374a8b][_0x67f6('0x70')]],'%s',_0x5c4014):_0x5c4014;_0x5c4014=_0x3acbf0[_0x374a8b][_0x67f6('0x72')]?_['replace'](_0x4dcde9[_0x3acbf0[_0x374a8b][_0x67f6('0x72')]],'%s',_0x5c4014):_0x5c4014;if(_0x3acbf0[_0x374a8b][_0x67f6('0x73')]){_0x5da9ec[_0x67f6('0x65')](_0x5c4014);}_0x3acbf0[_0x374a8b][_0x67f6('0x74')]&&_0x5da9ec[_0x67f6('0x38')](_0x5c4014,_0x3acbf0[_0x374a8b][_0x67f6('0x74')]===_0x67f6('0x8c')?![]:!![]);_0x5da9ec[_0x67f6('0x66')](_0x5c4014,_0x3acbf0[_0x374a8b][_0x67f6('0x75')]||_0x5c4014);}if(_0x4dc2d8[_0x67f6('0x76')]){_0x4dc2d8[_0x67f6('0x76')]=JSON['parse'](_0x4dc2d8[_0x67f6('0x76')]);for(var _0x5528dd=0x0;_0x5528dd<_0x4dc2d8['joins'][_0x67f6('0x35')];_0x5528dd+=0x1){if(_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x2c')]&&_['includes'](_0xb8a0cd,_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x2c')])&&_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x77')]&&_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x78')]&&_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x79')]){_0x5da9ec[_0x4dc2d8['joins'][_0x5528dd]['type']](_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x78')],null,util[_0x67f6('0x72')]('%s.%s\x20=\x20%s.%s',_0x4dc2d8[_0x67f6('0x7b')],_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x77')],_0x4dc2d8[_0x67f6('0x76')][_0x5528dd][_0x67f6('0x78')],_0x4dc2d8[_0x67f6('0x76')][_0x5528dd]['foreignKey']));}}}if(_0x4dc2d8[_0x67f6('0x7c')]){_0x4dc2d8[_0x67f6('0x7c')]=JSON[_0x67f6('0x7d')](_0x4dc2d8[_0x67f6('0x7c')]);_0x5da9ec[_0x67f6('0x3b')](_0x31c9bd(_0x4dc2d8[_0x67f6('0x7c')][_0x67f6('0x65')]));}_0x2c1404=_0x5da9ec[_0x67f6('0x7e')]();_0x5da9ec[_0x67f6('0x1c')](_0x5eba3d);_0x5da9ec['offset'](0x0);return;}})['then'](function(){if(_0x375de0[_0x67f6('0x8d')]===_0x67f6('0x8e')){return null;}var _0x50865d=_[_0x67f6('0x3c')](_0x375de0,{'name':_0x375de0[_0x67f6('0x8f')]||_0x375de0[_0x67f6('0x2e')]||_0x4dc2d8[_0x67f6('0x2e')],'basename':_0xd3a126,'savename':util[_0x67f6('0x72')](_0x67f6('0x90'),_0x375de0[_0x67f6('0x2e')]||_0x4dc2d8[_0x67f6('0x2e')],require(_0x67f6('0x91'))[_0x67f6('0x92')](0x4),_0x375de0[_0x67f6('0x8d')]||_0x67f6('0x93')),'reportId':_0x4dc2d8['id'],'reportType':_0x67f6('0x94')});return db[_0x67f6('0x95')][_0x67f6('0x45')](_0x50865d,{'raw':!![]});})[_0x67f6('0x21')](function(_0x5f03e4){if(_0x4dc2d8[_0x67f6('0x7b')]===_0x67f6('0x96')){_0x2c1404[_0x67f6('0x3b')](_0x4dc2d8[_0x67f6('0x7b')]+_0x67f6('0x97'),_0x375de0[_0x67f6('0x98')],_0x375de0[_0x67f6('0x99')]);}else{_0x2c1404[_0x67f6('0x3b')](_0x4dc2d8['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x375de0[_0x67f6('0x98')],_0x375de0[_0x67f6('0x99')]);}if(_0x5f03e4){logger[_0x67f6('0x9a')](_0x67f6('0x9b'),_0x2c1404[_0x67f6('0x81')]());require(_0x67f6('0x9c'))[_0x67f6('0x9d')](path[_0x67f6('0x50')](__dirname,_0x67f6('0x9e'),_0x5f03e4[_0x67f6('0x8d')]),[_0x5f03e4['id'],_0x2c1404[_0x67f6('0x81')](),path[_0x67f6('0x50')](__dirname,_0x67f6('0x9f'),_0x5f03e4[_0x67f6('0xa0')]),_0xd3a126]);return _0x5f03e4;}else{var _0x1cfc8a=squel[_0x67f6('0x8a')]();_0x1cfc8a[_0x67f6('0x6e')]('('+_0x2c1404[_0x67f6('0x81')]()+')',_0x67f6('0xa1'));_0x1cfc8a['field'](_0x67f6('0xa2'),_0x67f6('0x1e'));_0x2c1404[_0x67f6('0x1c')](_0x375de0['limit']||_0x5eba3d);_0x2c1404[_0x67f6('0x1b')](_0x375de0[_0x67f6('0x1b')]||0x0);return dbH[_0x67f6('0x82')][_0x67f6('0x2f')](_0x1cfc8a[_0x67f6('0x81')](),{'type':dbH[_0x67f6('0x82')][_0x67f6('0xa3')][_0x67f6('0x83')]})[_0x67f6('0x21')](function(_0x5afdeb){if(!_0x5afdeb['length']){_0x145706=0x0;}else{_0x145706=_0x5afdeb[0x0]['count']||0x0;}return dbH['sequelize'][_0x67f6('0x2f')](_0x2c1404[_0x67f6('0x81')](),{'type':dbH[_0x67f6('0x82')]['QueryTypes'][_0x67f6('0x83')]});})[_0x67f6('0x21')](function(_0x451bcc){return{'rows':_0x451bcc||[],'count':_0x145706};});}});}exports[_0x67f6('0xa4')]=function(_0x2a4282,_0x9ee773){return runReport(_0x2a4282[_0x67f6('0x4e')],_0x2a4282[_0x67f6('0x2f')],_0x2a4282[_0x67f6('0x43')])['then'](respondWithResult(_0x9ee773,null))[_0x67f6('0x41')](handleError(_0x9ee773,null));};exports[_0x67f6('0xa5')]=runReport;exports[_0x67f6('0x2f')]=function(_0x2b9daf,_0x4468c7){var _0x49cf35=0xa;var _0x144c73=[_0x67f6('0x50'),_0x67f6('0x51'),_0x67f6('0x52'),_0x67f6('0x53')];var _0x4b61ad={'SUM':_0x67f6('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x67f6('0x56'),'MAX':_0x67f6('0x57'),'MIN':_0x67f6('0x84'),'AVG':_0x67f6('0x58'),'GROUP_CONCAT':_0x67f6('0x59'),'GROUP_CONCAT ASC':_0x67f6('0x5a'),'GROUP_CONCAT DESC':_0x67f6('0x5b')};var _0xe09489={'SEC_TO_TIME':_0x67f6('0x5c'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x67f6('0x5f'),'UNIX_TIMESTAMP':_0x67f6('0x85')};var _0x303667=function(_0xf84e4e){return!_[_0x67f6('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x67f6('0x87'),_0x67f6('0x62')],_0xf84e4e);};var _0x542709=function(_0x49d73b){if(!_0x49d73b||!_0x49d73b[_0x67f6('0x63')][_0x67f6('0x35')]){return'';}for(var _0x5e1653='(',_0x308c3a=0x0;_0x308c3a<_0x49d73b['rules'][_0x67f6('0x35')];_0x308c3a+=0x1){_0x308c3a>0x0&&(_0x5e1653+='\x20'+_0x49d73b['operator']+'\x20');_0x5e1653+=_0x49d73b[_0x67f6('0x63')][_0x308c3a][_0x67f6('0x65')]?_0x542709(_0x49d73b[_0x67f6('0x63')][_0x308c3a][_0x67f6('0x65')]):_0x49d73b[_0x67f6('0x63')][_0x308c3a][_0x67f6('0x66')]+'\x20'+_0x49d73b[_0x67f6('0x63')][_0x308c3a][_0x67f6('0x67')]+(_0x303667(_0x49d73b[_0x67f6('0x63')][_0x308c3a]['condition'])?'\x20'+_0x49d73b[_0x67f6('0x63')][_0x308c3a]['value']:'');}return _0x5e1653+')';};var _0x190831={'where':{'id':_0x2b9daf['params']['id']}},_0x4cfc05,_0x3b63d1,_0xa794dc,_0x1ff148,_0x2a5d75;_0x190831=_[_0x67f6('0x3c')]({},_0x190831,_0x2b9daf[_0x67f6('0x43')]);return db[_0x67f6('0x29')][_0x67f6('0x44')](_0x190831)[_0x67f6('0x21')](function(_0x142f85){if(_0x142f85){_0x4cfc05=_0x142f85;return _0x142f85['getFields']();}return null;})[_0x67f6('0x21')](function(_0x3ad03b){if(_0x3ad03b){if(!_0x3ad03b[_0x67f6('0x35')]){throw new db[(_0x67f6('0x89'))][(_0x67f6('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3b63d1=_0x3ad03b;return db[_0x67f6('0x6b')][_0x67f6('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x3e1de8){if(_0x3e1de8){_0xa794dc=_[_0x67f6('0x6d')](_0x3e1de8,'id');var _0xccf85c;var _0x57bd20=squel[_0x67f6('0x8a')]();_0x57bd20[_0x67f6('0x6e')](_0x4cfc05[_0x67f6('0x7b')]);for(var _0x5eb5a4=0x0;_0x5eb5a4<_0x3b63d1[_0x67f6('0x35')];_0x5eb5a4+=0x1){_0xccf85c=_0x3b63d1[_0x5eb5a4]['MetricId']?_0xa794dc[_0x3b63d1[_0x5eb5a4][_0x67f6('0x6f')]]['metric']:_0x3b63d1[_0x5eb5a4][_0x67f6('0x66')];_0xccf85c=_0x3b63d1[_0x5eb5a4]['function']?_['replace'](_0x4b61ad[_0x3b63d1[_0x5eb5a4][_0x67f6('0x70')]],'%s',_0xccf85c):_0xccf85c;_0xccf85c=_0x3b63d1[_0x5eb5a4][_0x67f6('0x72')]?_[_0x67f6('0x71')](_0xe09489[_0x3b63d1[_0x5eb5a4]['format']],'%s',_0xccf85c):_0xccf85c;if(_0x3b63d1[_0x5eb5a4]['groupBy']){_0x57bd20[_0x67f6('0x65')](_0xccf85c);}_0x3b63d1[_0x5eb5a4]['orderBy']&&_0x57bd20[_0x67f6('0x38')](_0xccf85c,_0x3b63d1[_0x5eb5a4][_0x67f6('0x74')]===_0x67f6('0x8c')?![]:!![]);_0x57bd20[_0x67f6('0x66')](_0xccf85c,_0x3b63d1[_0x5eb5a4]['alias']||_0xccf85c);}if(_0x4cfc05['joins']){_0x4cfc05['joins']=JSON[_0x67f6('0x7d')](_0x4cfc05[_0x67f6('0x76')]);for(var _0x23e866=0x0;_0x23e866<_0x4cfc05['joins'][_0x67f6('0x35')];_0x23e866+=0x1){if(_0x4cfc05[_0x67f6('0x76')][_0x23e866][_0x67f6('0x2c')]&&_[_0x67f6('0x60')](_0x144c73,_0x4cfc05[_0x67f6('0x76')][_0x23e866][_0x67f6('0x2c')])&&_0x4cfc05[_0x67f6('0x76')][_0x23e866][_0x67f6('0x77')]&&_0x4cfc05['joins'][_0x23e866]['foreignTable']&&_0x4cfc05[_0x67f6('0x76')][_0x23e866][_0x67f6('0x79')]){_0x57bd20[_0x4cfc05[_0x67f6('0x76')][_0x23e866]['type']](_0x4cfc05[_0x67f6('0x76')][_0x23e866][_0x67f6('0x78')],null,util[_0x67f6('0x72')]('%s.%s\x20=\x20%s.%s',_0x4cfc05['table'],_0x4cfc05['joins'][_0x23e866]['parentKey'],_0x4cfc05['joins'][_0x23e866]['foreignTable'],_0x4cfc05[_0x67f6('0x76')][_0x23e866][_0x67f6('0x79')]));}}}if(_0x4cfc05[_0x67f6('0x7c')]){_0x4cfc05['conditions']=JSON[_0x67f6('0x7d')](_0x4cfc05['conditions']);_0x57bd20['where'](_0x542709(_0x4cfc05[_0x67f6('0x7c')][_0x67f6('0x65')]));}_0x2a5d75=_0x57bd20[_0x67f6('0x7e')]();_0x57bd20[_0x67f6('0x1c')](_0x49cf35);_0x57bd20[_0x67f6('0x1b')](0x0);logger[_0x67f6('0x7f')](_0x67f6('0x80'),_0x57bd20[_0x67f6('0x81')]());return dbH[_0x67f6('0x82')][_0x67f6('0x2f')](_0x57bd20[_0x67f6('0x81')](),{'type':dbH[_0x67f6('0x82')][_0x67f6('0xa3')][_0x67f6('0x83')]});}})[_0x67f6('0x21')](function(){return{'sql':_0x2a5d75[_0x67f6('0x81')]()};})[_0x67f6('0x21')](respondWithResult(_0x4468c7,null))['catch'](handleError(_0x4468c7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 7f576a3..778d779 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 _0x965f=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','api','moment','bluebird','request-promise','path'];(function(_0x1325f9,_0x4e6528){var _0x404d99=function(_0x4be0a3){while(--_0x4be0a3){_0x1325f9['push'](_0x1325f9['shift']());}};_0x404d99(++_0x4e6528);}(_0x965f,0x96));var _0xf965=function(_0x3fd7a3,_0x38776d){_0x3fd7a3=_0x3fd7a3-0x0;var _0x517d27=_0x965f[_0x3fd7a3];return _0x517d27;};'use strict';var _=require(_0xf965('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf965('0x1'));var moment=require(_0xf965('0x2'));var BPromise=require(_0xf965('0x3'));var rp=require(_0xf965('0x4'));var fs=require('fs');var path=require(_0xf965('0x5'));var rimraf=require(_0xf965('0x6'));var config=require(_0xf965('0x7'));var attributes=require(_0xf965('0x8'));module[_0xf965('0x9')]=function(_0x288d15,_0x8c6319){return _0x288d15[_0xf965('0xa')](_0xf965('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc63d=['api','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc63d,0x174));var _0xdc63=function(_0x2f9485,_0x5b080a){_0x2f9485=_0x2f9485-0x0;var _0x14266f=_0xc63d[_0x2f9485];return _0x14266f;};'use strict';var _=require(_0xdc63('0x0'));var util=require(_0xdc63('0x1'));var logger=require('../../config/logger')(_0xdc63('0x2'));var moment=require('moment');var BPromise=require(_0xdc63('0x3'));var rp=require(_0xdc63('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc63('0x5'));var config=require(_0xdc63('0x6'));var attributes=require(_0xdc63('0x7'));module[_0xdc63('0x8')]=function(_0x203956,_0x1fefa9){return _0x203956[_0xdc63('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xdc63('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9e52ea3..422df93 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 _0x618d=['jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x15b14d,_0x4c34f5){var _0x30f46b=function(_0x4ca84e){while(--_0x4ca84e){_0x15b14d['push'](_0x15b14d['shift']());}};_0x30f46b(++_0x4c34f5);}(_0x618d,0x159));var _0xd618=function(_0x1894a0,_0x580322){_0x1894a0=_0x1894a0-0x0;var _0x85e30c=_0x618d[_0x1894a0];return _0x85e30c;};'use strict';var _=require('lodash');var util=require(_0xd618('0x0'));var moment=require('moment');var BPromise=require(_0xd618('0x1'));var rs=require(_0xd618('0x2'));var fs=require('fs');var Redis=require(_0xd618('0x3'));var db=require(_0xd618('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd618('0x5'))(_0xd618('0x6'));var config=require('../../config/environment');var jayson=require(_0xd618('0x7'));var client=jayson[_0xd618('0x8')][_0xd618('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e7de4,_0x4161ba,_0x11a8c6){return new BPromise(function(_0xcf46e0,_0x347d17){return client[_0xd618('0xa')](_0x2e7de4,_0x11a8c6)['then'](function(_0xed426d){logger[_0xd618('0xb')](_0xd618('0xc'),_0x4161ba,_0xd618('0xd'));logger[_0xd618('0xe')](_0xd618('0xf'),_0x4161ba,'request\x20sent',JSON[_0xd618('0x10')](_0xed426d));if(_0xed426d['error']){if(_0xed426d[_0xd618('0x11')][_0xd618('0x12')]===0x1f4){logger['error'](_0xd618('0xc'),_0x4161ba,_0xed426d[_0xd618('0x11')][_0xd618('0x13')]);return _0x347d17(_0xed426d[_0xd618('0x11')][_0xd618('0x13')]);}logger[_0xd618('0x11')](_0xd618('0xc'),_0x4161ba,_0xed426d[_0xd618('0x11')][_0xd618('0x13')]);return _0xcf46e0(_0xed426d[_0xd618('0x11')]['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4161ba,'request\x20sent');_0xcf46e0(_0xed426d[_0xd618('0x14')][_0xd618('0x13')]);}})[_0xd618('0x15')](function(_0x3dc542){logger[_0xd618('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4161ba,_0x3dc542);_0x347d17(_0x3dc542);});});} \ No newline at end of file +var _0xa2a2=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x3b1eac,_0x3ac441){var _0x253c04=function(_0x48b2e2){while(--_0x48b2e2){_0x3b1eac['push'](_0x3b1eac['shift']());}};_0x253c04(++_0x3ac441);}(_0xa2a2,0x1d7));var _0x2a2a=function(_0x4c5bd6,_0x499296){_0x4c5bd6=_0x4c5bd6-0x0;var _0xa95866=_0xa2a2[_0x4c5bd6];return _0xa95866;};'use strict';var _=require(_0x2a2a('0x0'));var util=require(_0x2a2a('0x1'));var moment=require(_0x2a2a('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2a2a('0x4'));var logger=require(_0x2a2a('0x5'))(_0x2a2a('0x6'));var config=require(_0x2a2a('0x7'));var jayson=require(_0x2a2a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f39c9,_0x4e5d7a,_0x3f835a){return new BPromise(function(_0x381b8b,_0x3caa57){return client[_0x2a2a('0x9')](_0x2f39c9,_0x3f835a)[_0x2a2a('0xa')](function(_0x1bdbc4){logger[_0x2a2a('0xb')](_0x2a2a('0xc'),_0x4e5d7a,_0x2a2a('0xd'));logger['debug'](_0x2a2a('0xe'),_0x4e5d7a,_0x2a2a('0xd'),JSON[_0x2a2a('0xf')](_0x1bdbc4));if(_0x1bdbc4['error']){if(_0x1bdbc4[_0x2a2a('0x10')][_0x2a2a('0x11')]===0x1f4){logger[_0x2a2a('0x10')](_0x2a2a('0xc'),_0x4e5d7a,_0x1bdbc4[_0x2a2a('0x10')]['message']);return _0x3caa57(_0x1bdbc4['error'][_0x2a2a('0x12')]);}logger[_0x2a2a('0x10')](_0x2a2a('0xc'),_0x4e5d7a,_0x1bdbc4[_0x2a2a('0x10')][_0x2a2a('0x12')]);return _0x381b8b(_0x1bdbc4[_0x2a2a('0x10')]['message']);}else{logger[_0x2a2a('0xb')](_0x2a2a('0xc'),_0x4e5d7a,'request\x20sent');_0x381b8b(_0x1bdbc4[_0x2a2a('0x13')][_0x2a2a('0x12')]);}})[_0x2a2a('0x14')](function(_0x5cdf95){logger[_0x2a2a('0x10')](_0x2a2a('0xc'),_0x4e5d7a,_0x5cdf95);_0x3caa57(_0x5cdf95);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9e49126..a945dc8 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 _0x10fe=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','/:id/preview','preview','run','get','/:id/query','query','post','create','update','destroy','multer','util','path','connect-timeout'];(function(_0xd06c4d,_0x2e72f0){var _0x2f996e=function(_0x4796b0){while(--_0x4796b0){_0xd06c4d['push'](_0xd06c4d['shift']());}};_0x2f996e(++_0x2e72f0);}(_0x10fe,0x7a));var _0xe10f=function(_0x151ad0,_0x2c006c){_0x151ad0=_0x151ad0-0x0;var _0x1ffbb6=_0x10fe[_0x151ad0];return _0x1ffbb6;};'use strict';var multer=require(_0xe10f('0x0'));var util=require(_0xe10f('0x1'));var path=require(_0xe10f('0x2'));var timeout=require(_0xe10f('0x3'));var express=require('express');var router=express[_0xe10f('0x4')]();var fs_extra=require(_0xe10f('0x5'));var auth=require(_0xe10f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe10f('0x7'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xe10f('0x8')](),controller[_0xe10f('0x9')]);router['get'](_0xe10f('0xa'),auth[_0xe10f('0x8')](),controller['show']);router['get'](_0xe10f('0xb'),auth['isAuthenticated'](),controller[_0xe10f('0xc')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xe10f('0xd')]);router[_0xe10f('0xe')](_0xe10f('0xf'),auth['isAuthenticated'](),controller[_0xe10f('0x10')]);router[_0xe10f('0x11')]('/',auth[_0xe10f('0x8')](),controller[_0xe10f('0x12')]);router['put'](_0xe10f('0xa'),auth[_0xe10f('0x8')](),controller[_0xe10f('0x13')]);router['delete'](_0xe10f('0xa'),auth[_0xe10f('0x8')](),controller[_0xe10f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6829=['/:id/query','query','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run'];(function(_0x4c0e31,_0xa79bf2){var _0x41707d=function(_0x5020d1){while(--_0x5020d1){_0x4c0e31['push'](_0x4c0e31['shift']());}};_0x41707d(++_0xa79bf2);}(_0x6829,0x8a));var _0x9682=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6829[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var path=require(_0x9682('0x2'));var timeout=require(_0x9682('0x3'));var express=require(_0x9682('0x4'));var router=express[_0x9682('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9682('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9682('0x7'));var controller=require(_0x9682('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9682('0x9')](_0x9682('0xa'),auth[_0x9682('0xb')](),controller[_0x9682('0xc')]);router[_0x9682('0x9')](_0x9682('0xd'),auth['isAuthenticated'](),controller[_0x9682('0xe')]);router[_0x9682('0x9')](_0x9682('0xf'),auth[_0x9682('0xb')](),controller['run']);router[_0x9682('0x9')](_0x9682('0x10'),auth[_0x9682('0xb')](),controller[_0x9682('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9682('0x12')]);router[_0x9682('0x13')](_0x9682('0xa'),auth[_0x9682('0xb')](),controller[_0x9682('0x14')]);router[_0x9682('0x15')](_0x9682('0xa'),auth[_0x9682('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e287bbc..d51ede9 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x1ea384,_0x3847ca){var _0x49c296=function(_0x545e94){while(--_0x545e94){_0x1ea384['push'](_0x1ea384['shift']());}};_0x49c296(++_0x3847ca);}(_0x814b,0x1a2));var _0xb814=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x814b[_0x516ffb];return _0x319667;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x8508e6,_0x117bc5){var _0x251ccf=function(_0x23d066){while(--_0x23d066){_0x8508e6['push'](_0x8508e6['shift']());}};_0x251ccf(++_0x117bc5);}(_0xb138,0x1dd));var _0x8b13=function(_0x1b23f0,_0x3bcfb6){_0x1b23f0=_0x1b23f0-0x0;var _0x47b98a=_0xb138[_0x1b23f0];return _0x47b98a;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7fc73c7..b5a4d73 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 _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x7042f8,_0x468bfb){_0x7042f8=_0x7042f8-0x0;var _0x6ac658=_0xdbf5[_0x7042f8];return _0x6ac658;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file +var _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x687b[_0x1ebc6c];return _0x3a826d;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6e0be9f..3e8482e 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 _0x244a=['AnalyticDefaultReport','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x244a,0x173));var _0xa244=function(_0x832ad2,_0x1fe8a0){_0x832ad2=_0x832ad2-0x0;var _0x57094e=_0x244a[_0x832ad2];return _0x57094e;};'use strict';var _=require(_0xa244('0x0'));var util=require(_0xa244('0x1'));var logger=require(_0xa244('0x2'))(_0xa244('0x3'));var moment=require(_0xa244('0x4'));var BPromise=require('bluebird');var rp=require(_0xa244('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa244('0x6'));var config=require('../../config/environment');var attributes=require(_0xa244('0x7'));module[_0xa244('0x8')]=function(_0x391a92,_0x52801b){return _0x391a92['define'](_0xa244('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x543b=['exports','define','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0xcfc4cc,_0x46860a){var _0x55abc2=function(_0x4dd68e){while(--_0x4dd68e){_0xcfc4cc['push'](_0xcfc4cc['shift']());}};_0x55abc2(++_0x46860a);}(_0x543b,0x192));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb543('0x0'))(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require(_0xb543('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb543('0x4'));var rimraf=require(_0xb543('0x5'));var config=require(_0xb543('0x6'));var attributes=require(_0xb543('0x7'));module[_0xb543('0x8')]=function(_0x22c1f0,_0x3efa6e){return _0x22c1f0[_0xb543('0x9')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','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 829d269..116a87f 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 _0x3b25=['../../config/utils','../../config/logger','rpc','../../config/environment','request','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3ebfb3,_0x111c2d){var _0x111741=function(_0x4479c2){while(--_0x4479c2){_0x3ebfb3['push'](_0x3ebfb3['shift']());}};_0x111741(++_0x111c2d);}(_0x3b25,0x1af));var _0x53b2=function(_0x2743ca,_0x3c69b0){_0x2743ca=_0x2743ca-0x0;var _0x23a633=_0x3b25[_0x2743ca];return _0x23a633;};'use strict';var _=require(_0x53b2('0x0'));var util=require(_0x53b2('0x1'));var moment=require('moment');var BPromise=require(_0x53b2('0x2'));var rs=require(_0x53b2('0x3'));var fs=require('fs');var Redis=require(_0x53b2('0x4'));var db=require(_0x53b2('0x5'))['db'];var utils=require(_0x53b2('0x6'));var logger=require(_0x53b2('0x7'))(_0x53b2('0x8'));var config=require(_0x53b2('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47f07b,_0x527460,_0x2a6c8e){return new BPromise(function(_0x495fec,_0x5f0ac4){return client[_0x53b2('0xa')](_0x47f07b,_0x2a6c8e)['then'](function(_0x2a6754){logger[_0x53b2('0xb')](_0x53b2('0xc'),_0x527460,'request\x20sent');logger[_0x53b2('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x527460,'request\x20sent',JSON['stringify'](_0x2a6754));if(_0x2a6754[_0x53b2('0xe')]){if(_0x2a6754[_0x53b2('0xe')][_0x53b2('0xf')]===0x1f4){logger[_0x53b2('0xe')](_0x53b2('0xc'),_0x527460,_0x2a6754[_0x53b2('0xe')][_0x53b2('0x10')]);return _0x5f0ac4(_0x2a6754[_0x53b2('0xe')][_0x53b2('0x10')]);}logger[_0x53b2('0xe')](_0x53b2('0xc'),_0x527460,_0x2a6754[_0x53b2('0xe')]['message']);return _0x495fec(_0x2a6754[_0x53b2('0xe')]['message']);}else{logger[_0x53b2('0xb')](_0x53b2('0xc'),_0x527460,'request\x20sent');_0x495fec(_0x2a6754[_0x53b2('0x11')][_0x53b2('0x10')]);}})[_0x53b2('0x12')](function(_0x130ec2){logger[_0x53b2('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x527460,_0x130ec2);_0x5f0ac4(_0x130ec2);});});} \ No newline at end of file +var _0x113d=['jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e7d3c,_0x42973c){var _0x5c862e=function(_0x30f34f){while(--_0x30f34f){_0x3e7d3c['push'](_0x3e7d3c['shift']());}};_0x5c862e(++_0x42973c);}(_0x113d,0x184));var _0xd113=function(_0x3fdd5f,_0x105fe7){_0x3fdd5f=_0x3fdd5f-0x0;var _0x412cd1=_0x113d[_0x3fdd5f];return _0x412cd1;};'use strict';var _=require('lodash');var util=require(_0xd113('0x0'));var moment=require(_0xd113('0x1'));var BPromise=require(_0xd113('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd113('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd113('0x4'));var logger=require(_0xd113('0x5'))(_0xd113('0x6'));var config=require(_0xd113('0x7'));var jayson=require(_0xd113('0x8'));var client=jayson[_0xd113('0x9')][_0xd113('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55fcd6,_0x1fa316,_0x1e17dd){return new BPromise(function(_0x26ec13,_0x4709cc){return client[_0xd113('0xb')](_0x55fcd6,_0x1e17dd)[_0xd113('0xc')](function(_0x1cb017){logger['info'](_0xd113('0xd'),_0x1fa316,_0xd113('0xe'));logger['debug'](_0xd113('0xf'),_0x1fa316,_0xd113('0xe'),JSON[_0xd113('0x10')](_0x1cb017));if(_0x1cb017[_0xd113('0x11')]){if(_0x1cb017[_0xd113('0x11')][_0xd113('0x12')]===0x1f4){logger[_0xd113('0x11')](_0xd113('0xd'),_0x1fa316,_0x1cb017[_0xd113('0x11')][_0xd113('0x13')]);return _0x4709cc(_0x1cb017[_0xd113('0x11')][_0xd113('0x13')]);}logger['error'](_0xd113('0xd'),_0x1fa316,_0x1cb017[_0xd113('0x11')][_0xd113('0x13')]);return _0x26ec13(_0x1cb017[_0xd113('0x11')][_0xd113('0x13')]);}else{logger['info'](_0xd113('0xd'),_0x1fa316,_0xd113('0xe'));_0x26ec13(_0x1cb017[_0xd113('0x14')][_0xd113('0x13')]);}})[_0xd113('0x15')](function(_0x57488c){logger[_0xd113('0x11')](_0xd113('0xd'),_0x1fa316,_0x57488c);_0x4709cc(_0x57488c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4ec48f0..d0dc61f 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 _0xc15b=['preview','run','/:id/query','query','create','put','/:id','update','delete','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show','/:id/preview'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xc15b,0x159));var _0xbc15=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xc15b[_0x377a6e];return _0x37f751;};'use strict';var multer=require(_0xbc15('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc15('0x1'));var router=express[_0xbc15('0x2')]();var fs_extra=require(_0xbc15('0x3'));var auth=require(_0xbc15('0x4'));var interaction=require(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var controller=require(_0xbc15('0x7'));router[_0xbc15('0x8')]('/',auth[_0xbc15('0x9')](),controller['index']);router[_0xbc15('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbc15('0xa')]);router[_0xbc15('0x8')](_0xbc15('0xb'),auth['isAuthenticated'](),controller[_0xbc15('0xc')]);router[_0xbc15('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xbc15('0xd')]);router[_0xbc15('0x8')](_0xbc15('0xe'),auth['isAuthenticated'](),controller[_0xbc15('0xf')]);router['post']('/',auth[_0xbc15('0x9')](),controller[_0xbc15('0x10')]);router[_0xbc15('0x11')](_0xbc15('0x12'),auth['isAuthenticated'](),controller[_0xbc15('0x13')]);router[_0xbc15('0x14')]('/:id',auth[_0xbc15('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x51ca=['run','/:id/query','query','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','preview'];(function(_0x37b972,_0x4d06c2){var _0x5604f3=function(_0x12ed67){while(--_0x12ed67){_0x37b972['push'](_0x37b972['shift']());}};_0x5604f3(++_0x4d06c2);}(_0x51ca,0x1ea));var _0xa51c=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x51ca[_0x4ae829];return _0x256b31;};'use strict';var multer=require(_0xa51c('0x0'));var util=require(_0xa51c('0x1'));var path=require(_0xa51c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa51c('0x3'));var router=express[_0xa51c('0x4')]();var fs_extra=require(_0xa51c('0x5'));var auth=require(_0xa51c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa51c('0x7'));var controller=require(_0xa51c('0x8'));router[_0xa51c('0x9')]('/',auth[_0xa51c('0xa')](),controller[_0xa51c('0xb')]);router[_0xa51c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa51c('0xc')]);router[_0xa51c('0x9')]('/:id/preview',auth[_0xa51c('0xa')](),controller[_0xa51c('0xd')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xa51c('0xe')]);router['get'](_0xa51c('0xf'),auth[_0xa51c('0xa')](),controller[_0xa51c('0x10')]);router[_0xa51c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa51c('0x12')](_0xa51c('0x13'),auth['isAuthenticated'](),controller[_0xa51c('0x14')]);router[_0xa51c('0x15')](_0xa51c('0x13'),auth['isAuthenticated'](),controller[_0xa51c('0x16')]);module[_0xa51c('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ad081c1..d0d1392 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 _0x2a85=['manual','scheduled','INTEGER','moment','exports','STRING','csv','pdf','xlsx','DATE'];(function(_0x434ea7,_0x4ba9fe){var _0x3be82=function(_0x4ea8b8){while(--_0x4ea8b8){_0x434ea7['push'](_0x434ea7['shift']());}};_0x3be82(++_0x4ba9fe);}(_0x2a85,0x189));var _0x52a8=function(_0x49ec50,_0x2f90f7){_0x49ec50=_0x49ec50-0x0;var _0x2c50b6=_0x2a85[_0x49ec50];return _0x2c50b6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x52a8('0x0'));module[_0x52a8('0x1')]={'name':{'type':Sequelize[_0x52a8('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x52a8('0x3'),_0x52a8('0x4'),_0x52a8('0x5')),'allowNull':![],'defaultValue':_0x52a8('0x3')},'savename':{'type':Sequelize[_0x52a8('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x52a8('0x6')]},'status':{'type':Sequelize[_0x52a8('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x52a8('0x7'),_0x52a8('0x8')),'allowNull':![],'defaultValue':_0x52a8('0x7')},'reportId':{'type':Sequelize[_0x52a8('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ef0=['Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x4f1ded,_0x40f1de){var _0x5824cf=function(_0x204323){while(--_0x204323){_0x4f1ded['push'](_0x4f1ded['shift']());}};_0x5824cf(++_0x40f1de);}(_0x9ef0,0xbb));var _0x09ef=function(_0x383932,_0x469985){_0x383932=_0x383932-0x0;var _0x14aa67=_0x9ef0[_0x383932];return _0x14aa67;};'use strict';var Sequelize=require(_0x09ef('0x0'));var moment=require(_0x09ef('0x1'));module[_0x09ef('0x2')]={'name':{'type':Sequelize[_0x09ef('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x09ef('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x09ef('0x4')](_0x09ef('0x5'),_0x09ef('0x6'),_0x09ef('0x7')),'allowNull':![],'defaultValue':_0x09ef('0x5')},'savename':{'type':Sequelize[_0x09ef('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x09ef('0x8')]},'endDate':{'type':Sequelize[_0x09ef('0x8')]},'status':{'type':Sequelize[_0x09ef('0x3')],'defaultValue':_0x09ef('0x9')},'type':{'type':Sequelize['ENUM'](_0x09ef('0xa'),_0x09ef('0xb')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x09ef('0xc')](0xb)[_0x09ef('0xd')]},'reportType':{'type':Sequelize[_0x09ef('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8d4d402..52c8d99 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 _0xc25e=['count','limit','set','reject','save','update','then','get','ExtractedReports','error','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','rows','catch','show','params','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','download','basename','existsSync','join','root','savename','Sequelize','exists','format','%s.%s','output','toLowerCase','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x8e4cd2,_0x1080e5){var _0x37a4aa=function(_0x34baf1){while(--_0x34baf1){_0x8e4cd2['push'](_0x8e4cd2['shift']());}};_0x37a4aa(++_0x1080e5);}(_0xc25e,0x1a0));var _0xec25=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc25e[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0xec25('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xec25('0x1'));var rp=require(_0xec25('0x2'));var moment=require(_0xec25('0x3'));var BPromise=require(_0xec25('0x4'));var Mustache=require(_0xec25('0x5'));var util=require(_0xec25('0x6'));var path=require(_0xec25('0x7'));var sox=require('sox');var csv=require(_0xec25('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec25('0x9'));var _=require(_0xec25('0xa'));var squel=require(_0xec25('0xb'));var crypto=require('crypto');var jsforce=require(_0xec25('0xc'));var deskjs=require(_0xec25('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xec25('0xe'));var Redis=require(_0xec25('0xf'));var authService=require(_0xec25('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xec25('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec25('0x12'))(_0xec25('0x13'));var utils=require(_0xec25('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xec25('0x15'));var db=require(_0xec25('0x16'))['db'];function respondWithStatusCode(_0xb7b998,_0x2fc060){_0x2fc060=_0x2fc060||0xcc;return function(_0x3d97bf){if(_0x3d97bf){return _0xb7b998[_0xec25('0x17')](_0x2fc060);}return _0xb7b998[_0xec25('0x18')](_0x2fc060)[_0xec25('0x19')]();};}function respondWithResult(_0x535962,_0x478114){_0x478114=_0x478114||0xc8;return function(_0xd9b73){if(_0xd9b73){return _0x535962[_0xec25('0x18')](_0x478114)[_0xec25('0x1a')](_0xd9b73);}};}function respondWithFilteredResult(_0x575165,_0x13e46c){return function(_0x4771f3){if(_0x4771f3){var _0x116448=typeof _0x13e46c[_0xec25('0x1b')]===_0xec25('0x1c')&&typeof _0x13e46c['limit']===_0xec25('0x1c');var _0x3de735=_0x4771f3['count'];var _0xc3dda1=_0x116448?0x0:_0x13e46c[_0xec25('0x1b')];var _0x3392aa=_0x116448?_0x4771f3[_0xec25('0x1d')]:_0x13e46c[_0xec25('0x1b')]+_0x13e46c[_0xec25('0x1e')];var _0x300666;if(_0x3392aa>=_0x3de735){_0x3392aa=_0x3de735;_0x300666=0xc8;}else{_0x300666=0xce;}_0x575165[_0xec25('0x18')](_0x300666);return _0x575165[_0xec25('0x1f')]('Content-Range',_0xc3dda1+'-'+_0x3392aa+'/'+_0x3de735)['json'](_0x4771f3);}return null;};}function patchUpdates(_0x4e2bbe){return function(_0x3cae23){try{jsonpatch['apply'](_0x3cae23,_0x4e2bbe,!![]);}catch(_0x53eafc){return BPromise[_0xec25('0x20')](_0x53eafc);}return _0x3cae23[_0xec25('0x21')]();};}function saveUpdates(_0x6d1783,_0x100e0a){return function(_0x208013){if(_0x208013){return _0x208013[_0xec25('0x22')](_0x6d1783)[_0xec25('0x23')](function(_0x8940b0){return _0x8940b0;});}return null;};}function removeEntity(_0x31dda2,_0x100031){return function(_0xfc39e6){if(_0xfc39e6){return _0xfc39e6['destroy']()[_0xec25('0x23')](function(){var _0x47ca05=_0xfc39e6[_0xec25('0x24')]({'plain':!![]});var _0x6004f0=_0xec25('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x6004f0,'resourceId':_0x47ca05['id']}})[_0xec25('0x23')](function(){return _0xfc39e6;});})[_0xec25('0x23')](function(){_0x31dda2[_0xec25('0x18')](0xcc)[_0xec25('0x19')]();});}};}function handleEntityNotFound(_0x53fc55,_0x25d9fc){return function(_0x5422e0){if(!_0x5422e0){_0x53fc55[_0xec25('0x17')](0x194);}return _0x5422e0;};}function handleError(_0x1f69b0,_0x19f291){_0x19f291=_0x19f291||0x1f4;return function(_0xafed99){logger[_0xec25('0x26')](_0xafed99['stack']);if(_0xafed99[_0xec25('0x27')]){delete _0xafed99[_0xec25('0x27')];}_0x1f69b0[_0xec25('0x18')](_0x19f291)['send'](_0xafed99);};}exports[_0xec25('0x28')]=function(_0x5c8bf7,_0x1402b3){var _0x19e9a8={},_0x21f86e={},_0x52c5ec={'count':0x0,'rows':[]};var _0x527e72=_[_0xec25('0x29')](db['AnalyticExtractedReport'][_0xec25('0x2a')],function(_0x8241f8){return{'name':_0x8241f8['fieldName'],'type':_0x8241f8[_0xec25('0x2b')]['key']};});_0x21f86e[_0xec25('0x2c')]=_['map'](_0x527e72,'name');_0x21f86e[_0xec25('0x2d')]=_[_0xec25('0x2e')](_0x5c8bf7[_0xec25('0x2d')]);_0x21f86e[_0xec25('0x2f')]=_[_0xec25('0x30')](_0x21f86e['model'],_0x21f86e[_0xec25('0x2d')]);_0x19e9a8[_0xec25('0x31')]=_[_0xec25('0x30')](_0x21f86e[_0xec25('0x2c')],qs[_0xec25('0x32')](_0x5c8bf7[_0xec25('0x2d')][_0xec25('0x32')]));_0x19e9a8[_0xec25('0x31')]=_0x19e9a8[_0xec25('0x31')]['length']?_0x19e9a8[_0xec25('0x31')]:_0x21f86e[_0xec25('0x2c')];if(!_0x5c8bf7[_0xec25('0x2d')][_0xec25('0x33')]('nolimit')){_0x19e9a8['limit']=qs[_0xec25('0x1e')](_0x5c8bf7[_0xec25('0x2d')][_0xec25('0x1e')]);_0x19e9a8['offset']=qs[_0xec25('0x1b')](_0x5c8bf7[_0xec25('0x2d')][_0xec25('0x1b')]);}_0x19e9a8[_0xec25('0x34')]=qs['sort'](_0x5c8bf7[_0xec25('0x2d')][_0xec25('0x35')]);_0x19e9a8[_0xec25('0x36')]=qs['filters'](_[_0xec25('0x37')](_0x5c8bf7[_0xec25('0x2d')],_0x21f86e[_0xec25('0x2f')]),_0x527e72);if(_0x5c8bf7['query'][_0xec25('0x38')]){_0x19e9a8[_0xec25('0x36')]=_[_0xec25('0x39')](_0x19e9a8[_0xec25('0x36')],{'$or':_[_0xec25('0x29')](_0x527e72,function(_0x43815d){if(_0x43815d['type']!==_0xec25('0x3a')){var _0x229a58={};_0x229a58[_0x43815d[_0xec25('0x27')]]={'$like':'%'+_0x5c8bf7[_0xec25('0x2d')]['filter']+'%'};return _0x229a58;}})});}_0x19e9a8=_[_0xec25('0x39')]({},_0x19e9a8,_0x5c8bf7[_0xec25('0x3b')]);var _0x2694ff={'where':_0x19e9a8[_0xec25('0x36')]};return db[_0xec25('0x3c')][_0xec25('0x1d')](_0x2694ff)[_0xec25('0x23')](function(_0x52043c){_0x52c5ec[_0xec25('0x1d')]=_0x52043c;if(_0x5c8bf7[_0xec25('0x2d')]['includeAll']){_0x19e9a8['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x19e9a8);})['then'](function(_0x130ac5){_0x52c5ec[_0xec25('0x3d')]=_0x130ac5;return _0x52c5ec;})[_0xec25('0x23')](respondWithFilteredResult(_0x1402b3,_0x19e9a8))[_0xec25('0x3e')](handleError(_0x1402b3,null));};exports[_0xec25('0x3f')]=function(_0x33020f,_0x86b038){var _0x2bbd58={'raw':!![],'where':{'id':_0x33020f[_0xec25('0x40')]['id']}},_0xbc94a1={};_0xbc94a1[_0xec25('0x2c')]=_[_0xec25('0x2e')](db['AnalyticExtractedReport'][_0xec25('0x2a')]);_0xbc94a1['query']=_[_0xec25('0x2e')](_0x33020f[_0xec25('0x2d')]);_0xbc94a1[_0xec25('0x2f')]=_[_0xec25('0x30')](_0xbc94a1[_0xec25('0x2c')],_0xbc94a1['query']);_0x2bbd58[_0xec25('0x31')]=_[_0xec25('0x30')](_0xbc94a1[_0xec25('0x2c')],qs['fields'](_0x33020f[_0xec25('0x2d')][_0xec25('0x32')]));_0x2bbd58['attributes']=_0x2bbd58[_0xec25('0x31')][_0xec25('0x41')]?_0x2bbd58[_0xec25('0x31')]:_0xbc94a1[_0xec25('0x2c')];if(_0x33020f[_0xec25('0x2d')][_0xec25('0x42')]){_0x2bbd58[_0xec25('0x43')]=[{'all':!![]}];}_0x2bbd58=_[_0xec25('0x39')]({},_0x2bbd58,_0x33020f[_0xec25('0x3b')]);return db[_0xec25('0x3c')][_0xec25('0x44')](_0x2bbd58)['then'](handleEntityNotFound(_0x86b038,null))[_0xec25('0x23')](respondWithResult(_0x86b038,null))[_0xec25('0x3e')](handleError(_0x86b038,null));};exports[_0xec25('0x45')]=function(_0x1605fa,_0x5899a2){return db['AnalyticExtractedReport'][_0xec25('0x45')](_0x1605fa[_0xec25('0x46')],{})['then'](function(_0x45b7be){var _0x5e80b1=_0x1605fa[_0xec25('0x47')][_0xec25('0x24')]({'plain':!![]});if(!_0x5e80b1)throw new Error(_0xec25('0x48'));if(_0x5e80b1[_0xec25('0x49')]===_0xec25('0x47')){var _0x37cb9d=_0x45b7be[_0xec25('0x24')]({'plain':!![]});var _0x53c8eb=_0xec25('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x53c8eb,'userProfileId':_0x5e80b1['userProfileId']},'raw':!![]})['then'](function(_0x3b15d1){if(_0x3b15d1&&_0x3b15d1[_0xec25('0x4a')]===0x0){return db['UserProfileResource'][_0xec25('0x45')]({'name':_0x37cb9d['name'],'resourceId':_0x37cb9d['id'],'type':_0x3b15d1[_0xec25('0x27')],'sectionId':_0x3b15d1['id']},{})['then'](function(){return _0x45b7be;});}else{return _0x45b7be;}})[_0xec25('0x3e')](function(_0x679d26){logger[_0xec25('0x26')](_0xec25('0x4b'),_0x679d26);throw _0x679d26;});}return _0x45b7be;})[_0xec25('0x23')](respondWithResult(_0x5899a2,0xc9))['catch'](handleError(_0x5899a2,null));};exports['update']=function(_0x1651ba,_0x24649e){if(_0x1651ba[_0xec25('0x46')]['id']){delete _0x1651ba[_0xec25('0x46')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1651ba[_0xec25('0x40')]['id']}})['then'](handleEntityNotFound(_0x24649e,null))[_0xec25('0x23')](saveUpdates(_0x1651ba[_0xec25('0x46')],null))[_0xec25('0x23')](respondWithResult(_0x24649e,null))['catch'](handleError(_0x24649e,null));};exports[_0xec25('0x4c')]=function(_0x4b8b93,_0x337ae7){return db['AnalyticExtractedReport'][_0xec25('0x44')]({'where':{'id':_0x4b8b93[_0xec25('0x40')]['id']}})[_0xec25('0x23')](handleEntityNotFound(_0x337ae7,null))[_0xec25('0x23')](removeEntity(_0x337ae7,null))[_0xec25('0x3e')](handleError(_0x337ae7,null));};exports[_0xec25('0x4d')]=function(_0x1d400c,_0x2701a5,_0x18b55c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1d400c[_0xec25('0x40')]['id']},'attributes':['name',_0xec25('0x4e'),'savename','output'],'raw':!![]})['then'](handleEntityNotFound(_0x2701a5,null))[_0xec25('0x23')](function(_0x3ee345){if(_0x3ee345){if(!fs[_0xec25('0x4f')](path[_0xec25('0x50')](config[_0xec25('0x51')],'server/files/reports',_0x3ee345[_0xec25('0x52')]))){throw new db[(_0xec25('0x53'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1d400c[_0xec25('0x2d')][_0xec25('0x54')]){return _0x2701a5[_0xec25('0x17')](0xc8);}return _0x2701a5[_0xec25('0x4d')](path['join'](config[_0xec25('0x51')],'server/files/reports',_0x3ee345[_0xec25('0x52')]),util[_0xec25('0x55')](_0xec25('0x56'),_0x3ee345[_0xec25('0x4e')]||_0x3ee345[_0xec25('0x27')],_0x3ee345[_0xec25('0x57')][_0xec25('0x58')]()));}})[_0xec25('0x3e')](handleError(_0x2701a5,null));}; \ No newline at end of file +var _0xa7c3=['sox','fs-extra','lodash','crypto','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','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa7c3,0x178));var _0x3a7c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa7c3[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a7c('0x0'));var zipdir=require(_0x3a7c('0x1'));var jsonpatch=require(_0x3a7c('0x2'));var rp=require(_0x3a7c('0x3'));var moment=require('moment');var BPromise=require(_0x3a7c('0x4'));var Mustache=require(_0x3a7c('0x5'));var util=require(_0x3a7c('0x6'));var path=require(_0x3a7c('0x7'));var sox=require(_0x3a7c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a7c('0x9'));var _=require(_0x3a7c('0xa'));var squel=require('squel');var crypto=require(_0x3a7c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3a7c('0xc'));var toCsv=require(_0x3a7c('0xd'));var querystring=require(_0x3a7c('0xe'));var Papa=require(_0x3a7c('0xf'));var Redis=require('ioredis');var authService=require(_0x3a7c('0x10'));var qs=require(_0x3a7c('0x11'));var as=require(_0x3a7c('0x12'));var hardwareService=require(_0x3a7c('0x13'));var logger=require(_0x3a7c('0x14'))(_0x3a7c('0x15'));var utils=require(_0x3a7c('0x16'));var config=require(_0x3a7c('0x17'));var licenseUtil=require(_0x3a7c('0x18'));var db=require(_0x3a7c('0x19'))['db'];function respondWithStatusCode(_0x3a99bd,_0x530fd1){_0x530fd1=_0x530fd1||0xcc;return function(_0x14a624){if(_0x14a624){return _0x3a99bd[_0x3a7c('0x1a')](_0x530fd1);}return _0x3a99bd[_0x3a7c('0x1b')](_0x530fd1)[_0x3a7c('0x1c')]();};}function respondWithResult(_0x47b231,_0x638459){_0x638459=_0x638459||0xc8;return function(_0x1d7cf5){if(_0x1d7cf5){return _0x47b231[_0x3a7c('0x1b')](_0x638459)['json'](_0x1d7cf5);}};}function respondWithFilteredResult(_0x3ef9a5,_0x207e64){return function(_0x249f00){if(_0x249f00){var _0x3cd08d=typeof _0x207e64[_0x3a7c('0x1d')]==='undefined'&&typeof _0x207e64[_0x3a7c('0x1e')]===_0x3a7c('0x1f');var _0x4ce62e=_0x249f00[_0x3a7c('0x20')];var _0x3b1ca0=_0x3cd08d?0x0:_0x207e64['offset'];var _0xa7cbbf=_0x3cd08d?_0x249f00[_0x3a7c('0x20')]:_0x207e64[_0x3a7c('0x1d')]+_0x207e64[_0x3a7c('0x1e')];var _0x3a3c9a;if(_0xa7cbbf>=_0x4ce62e){_0xa7cbbf=_0x4ce62e;_0x3a3c9a=0xc8;}else{_0x3a3c9a=0xce;}_0x3ef9a5[_0x3a7c('0x1b')](_0x3a3c9a);return _0x3ef9a5[_0x3a7c('0x21')](_0x3a7c('0x22'),_0x3b1ca0+'-'+_0xa7cbbf+'/'+_0x4ce62e)[_0x3a7c('0x23')](_0x249f00);}return null;};}function patchUpdates(_0x3aee11){return function(_0x5686b1){try{jsonpatch[_0x3a7c('0x24')](_0x5686b1,_0x3aee11,!![]);}catch(_0x14f6b7){return BPromise[_0x3a7c('0x25')](_0x14f6b7);}return _0x5686b1[_0x3a7c('0x26')]();};}function saveUpdates(_0x56ef50,_0x2d196c){return function(_0x2f9f29){if(_0x2f9f29){return _0x2f9f29[_0x3a7c('0x27')](_0x56ef50)[_0x3a7c('0x28')](function(_0x5b3595){return _0x5b3595;});}return null;};}function removeEntity(_0xeab041,_0x2c0508){return function(_0x4e3d30){if(_0x4e3d30){return _0x4e3d30[_0x3a7c('0x29')]()[_0x3a7c('0x28')](function(){var _0x4d8e28=_0x4e3d30[_0x3a7c('0x2a')]({'plain':!![]});var _0xd4026e='ExtractedReports';return db[_0x3a7c('0x2b')]['destroy']({'where':{'type':_0xd4026e,'resourceId':_0x4d8e28['id']}})[_0x3a7c('0x28')](function(){return _0x4e3d30;});})[_0x3a7c('0x28')](function(){_0xeab041[_0x3a7c('0x1b')](0xcc)[_0x3a7c('0x1c')]();});}};}function handleEntityNotFound(_0x3e1f01,_0x36f398){return function(_0x228cd2){if(!_0x228cd2){_0x3e1f01[_0x3a7c('0x1a')](0x194);}return _0x228cd2;};}function handleError(_0x120f86,_0x357b19){_0x357b19=_0x357b19||0x1f4;return function(_0x367445){logger['error'](_0x367445[_0x3a7c('0x2c')]);if(_0x367445['name']){delete _0x367445[_0x3a7c('0x2d')];}_0x120f86[_0x3a7c('0x1b')](_0x357b19)['send'](_0x367445);};}exports[_0x3a7c('0x2e')]=function(_0x19cfaa,_0x49f886){var _0x5d8c94={},_0x5b650b={},_0x21e3db={'count':0x0,'rows':[]};var _0x64eca8=_[_0x3a7c('0x2f')](db['AnalyticExtractedReport'][_0x3a7c('0x30')],function(_0x47a0f4){return{'name':_0x47a0f4[_0x3a7c('0x31')],'type':_0x47a0f4[_0x3a7c('0x32')][_0x3a7c('0x33')]};});_0x5b650b[_0x3a7c('0x34')]=_['map'](_0x64eca8,_0x3a7c('0x2d'));_0x5b650b[_0x3a7c('0x35')]=_[_0x3a7c('0x36')](_0x19cfaa['query']);_0x5b650b[_0x3a7c('0x37')]=_[_0x3a7c('0x38')](_0x5b650b[_0x3a7c('0x34')],_0x5b650b['query']);_0x5d8c94[_0x3a7c('0x39')]=_[_0x3a7c('0x38')](_0x5b650b['model'],qs[_0x3a7c('0x3a')](_0x19cfaa[_0x3a7c('0x35')]['fields']));_0x5d8c94[_0x3a7c('0x39')]=_0x5d8c94[_0x3a7c('0x39')]['length']?_0x5d8c94[_0x3a7c('0x39')]:_0x5b650b['model'];if(!_0x19cfaa['query'][_0x3a7c('0x3b')]('nolimit')){_0x5d8c94[_0x3a7c('0x1e')]=qs[_0x3a7c('0x1e')](_0x19cfaa['query'][_0x3a7c('0x1e')]);_0x5d8c94[_0x3a7c('0x1d')]=qs[_0x3a7c('0x1d')](_0x19cfaa['query'][_0x3a7c('0x1d')]);}_0x5d8c94['order']=qs[_0x3a7c('0x3c')](_0x19cfaa[_0x3a7c('0x35')]['sort']);_0x5d8c94['where']=qs[_0x3a7c('0x37')](_['pick'](_0x19cfaa['query'],_0x5b650b[_0x3a7c('0x37')]),_0x64eca8);if(_0x19cfaa[_0x3a7c('0x35')][_0x3a7c('0x3d')]){_0x5d8c94[_0x3a7c('0x3e')]=_[_0x3a7c('0x3f')](_0x5d8c94[_0x3a7c('0x3e')],{'$or':_[_0x3a7c('0x2f')](_0x64eca8,function(_0xc04ff9){if(_0xc04ff9[_0x3a7c('0x32')]!==_0x3a7c('0x40')){var _0x4f7324={};_0x4f7324[_0xc04ff9[_0x3a7c('0x2d')]]={'$like':'%'+_0x19cfaa[_0x3a7c('0x35')][_0x3a7c('0x3d')]+'%'};return _0x4f7324;}})});}_0x5d8c94=_['merge']({},_0x5d8c94,_0x19cfaa[_0x3a7c('0x41')]);var _0x119d2c={'where':_0x5d8c94['where']};return db[_0x3a7c('0x42')][_0x3a7c('0x20')](_0x119d2c)[_0x3a7c('0x28')](function(_0x33a646){_0x21e3db[_0x3a7c('0x20')]=_0x33a646;if(_0x19cfaa[_0x3a7c('0x35')][_0x3a7c('0x43')]){_0x5d8c94[_0x3a7c('0x44')]=[{'all':!![]}];}return db[_0x3a7c('0x42')][_0x3a7c('0x45')](_0x5d8c94);})[_0x3a7c('0x28')](function(_0x141d30){_0x21e3db[_0x3a7c('0x46')]=_0x141d30;return _0x21e3db;})[_0x3a7c('0x28')](respondWithFilteredResult(_0x49f886,_0x5d8c94))['catch'](handleError(_0x49f886,null));};exports[_0x3a7c('0x47')]=function(_0x102c61,_0x34ea07){var _0x4dbb80={'raw':!![],'where':{'id':_0x102c61[_0x3a7c('0x48')]['id']}},_0x359abd={};_0x359abd[_0x3a7c('0x34')]=_['keys'](db[_0x3a7c('0x42')][_0x3a7c('0x30')]);_0x359abd[_0x3a7c('0x35')]=_[_0x3a7c('0x36')](_0x102c61[_0x3a7c('0x35')]);_0x359abd[_0x3a7c('0x37')]=_[_0x3a7c('0x38')](_0x359abd['model'],_0x359abd['query']);_0x4dbb80[_0x3a7c('0x39')]=_[_0x3a7c('0x38')](_0x359abd[_0x3a7c('0x34')],qs[_0x3a7c('0x3a')](_0x102c61[_0x3a7c('0x35')][_0x3a7c('0x3a')]));_0x4dbb80[_0x3a7c('0x39')]=_0x4dbb80[_0x3a7c('0x39')]['length']?_0x4dbb80['attributes']:_0x359abd[_0x3a7c('0x34')];if(_0x102c61[_0x3a7c('0x35')][_0x3a7c('0x43')]){_0x4dbb80[_0x3a7c('0x44')]=[{'all':!![]}];}_0x4dbb80=_['merge']({},_0x4dbb80,_0x102c61[_0x3a7c('0x41')]);return db[_0x3a7c('0x42')][_0x3a7c('0x49')](_0x4dbb80)[_0x3a7c('0x28')](handleEntityNotFound(_0x34ea07,null))[_0x3a7c('0x28')](respondWithResult(_0x34ea07,null))[_0x3a7c('0x4a')](handleError(_0x34ea07,null));};exports['create']=function(_0x1012eb,_0xd4f1ed){return db['AnalyticExtractedReport'][_0x3a7c('0x4b')](_0x1012eb[_0x3a7c('0x4c')],{})['then'](function(_0x250165){var _0x120046=_0x1012eb[_0x3a7c('0x4d')][_0x3a7c('0x2a')]({'plain':!![]});if(!_0x120046)throw new Error(_0x3a7c('0x4e'));if(_0x120046[_0x3a7c('0x4f')]===_0x3a7c('0x4d')){var _0x599dad=_0x250165[_0x3a7c('0x2a')]({'plain':!![]});var _0x1122b1=_0x3a7c('0x50');return db[_0x3a7c('0x51')][_0x3a7c('0x49')]({'where':{'name':_0x1122b1,'userProfileId':_0x120046[_0x3a7c('0x52')]},'raw':!![]})[_0x3a7c('0x28')](function(_0x4613e7){if(_0x4613e7&&_0x4613e7[_0x3a7c('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x599dad[_0x3a7c('0x2d')],'resourceId':_0x599dad['id'],'type':_0x4613e7[_0x3a7c('0x2d')],'sectionId':_0x4613e7['id']},{})[_0x3a7c('0x28')](function(){return _0x250165;});}else{return _0x250165;}})[_0x3a7c('0x4a')](function(_0x460902){logger[_0x3a7c('0x54')](_0x3a7c('0x55'),_0x460902);throw _0x460902;});}return _0x250165;})[_0x3a7c('0x28')](respondWithResult(_0xd4f1ed,0xc9))[_0x3a7c('0x4a')](handleError(_0xd4f1ed,null));};exports['update']=function(_0x11aae3,_0x3d6b6e){if(_0x11aae3['body']['id']){delete _0x11aae3[_0x3a7c('0x4c')]['id'];}return db[_0x3a7c('0x42')][_0x3a7c('0x49')]({'where':{'id':_0x11aae3[_0x3a7c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d6b6e,null))[_0x3a7c('0x28')](saveUpdates(_0x11aae3[_0x3a7c('0x4c')],null))[_0x3a7c('0x28')](respondWithResult(_0x3d6b6e,null))[_0x3a7c('0x4a')](handleError(_0x3d6b6e,null));};exports['destroy']=function(_0x2541fa,_0x419729){return db[_0x3a7c('0x42')][_0x3a7c('0x49')]({'where':{'id':_0x2541fa[_0x3a7c('0x48')]['id']}})[_0x3a7c('0x28')](handleEntityNotFound(_0x419729,null))[_0x3a7c('0x28')](removeEntity(_0x419729,null))[_0x3a7c('0x4a')](handleError(_0x419729,null));};exports[_0x3a7c('0x56')]=function(_0x392955,_0x305c99,_0x569c48){return db[_0x3a7c('0x42')][_0x3a7c('0x49')]({'where':{'id':_0x392955[_0x3a7c('0x48')]['id']},'attributes':['name',_0x3a7c('0x57'),_0x3a7c('0x58'),_0x3a7c('0x59')],'raw':!![]})[_0x3a7c('0x28')](handleEntityNotFound(_0x305c99,null))[_0x3a7c('0x28')](function(_0x1c6e0c){if(_0x1c6e0c){if(!fs['existsSync'](path[_0x3a7c('0x5a')](config[_0x3a7c('0x5b')],_0x3a7c('0x5c'),_0x1c6e0c[_0x3a7c('0x58')]))){throw new db[(_0x3a7c('0x5d'))][(_0x3a7c('0x5e'))](_0x3a7c('0x5f'));}if(_0x392955[_0x3a7c('0x35')]['exists']){return _0x305c99[_0x3a7c('0x1a')](0xc8);}return _0x305c99[_0x3a7c('0x56')](path['join'](config['root'],_0x3a7c('0x5c'),_0x1c6e0c[_0x3a7c('0x58')]),util['format']('%s.%s',_0x1c6e0c[_0x3a7c('0x57')]||_0x1c6e0c[_0x3a7c('0x2d')],_0x1c6e0c[_0x3a7c('0x59')]['toLowerCase']()));}})['catch'](handleError(_0x305c99,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0afa756..d01da29 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 _0xc9b4=['../../config/environment','./analyticExtractedReport.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x4c02e7,_0x3986c1){var _0x2f7549=function(_0x36ba2f){while(--_0x36ba2f){_0x4c02e7['push'](_0x4c02e7['shift']());}};_0x2f7549(++_0x3986c1);}(_0xc9b4,0x7d));var _0x4c9b=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0xc9b4[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x4c9b('0x0'));var util=require(_0x4c9b('0x1'));var logger=require(_0x4c9b('0x2'))(_0x4c9b('0x3'));var moment=require('moment');var BPromise=require(_0x4c9b('0x4'));var rp=require(_0x4c9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c9b('0x6'));var config=require(_0x4c9b('0x7'));var attributes=require(_0x4c9b('0x8'));module[_0x4c9b('0x9')]=function(_0x5ebae1,_0x12051e){return _0x5ebae1[_0x4c9b('0xa')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c05=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','rimraf','../../config/environment'];(function(_0x307a74,_0x27c112){var _0x12a0f5=function(_0x4199f3){while(--_0x4199f3){_0x307a74['push'](_0x307a74['shift']());}};_0x12a0f5(++_0x27c112);}(_0x0c05,0x79));var _0x50c0=function(_0x67c7e2,_0x5f02ee){_0x67c7e2=_0x67c7e2-0x0;var _0x52b665=_0x0c05[_0x67c7e2];return _0x52b665;};'use strict';var _=require('lodash');var util=require(_0x50c0('0x0'));var logger=require(_0x50c0('0x1'))(_0x50c0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50c0('0x3'));var config=require(_0x50c0('0x4'));var attributes=require('./analyticExtractedReport.attributes');module[_0x50c0('0x5')]=function(_0x261a9d,_0x59093a){return _0x261a9d[_0x50c0('0x6')](_0x50c0('0x7'),attributes,{'tableName':_0x50c0('0x8'),'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 15352fb..cd69fe9 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 _0xb528=['http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x398306,_0x560fd1){var _0x42644b=function(_0x49bae1){while(--_0x49bae1){_0x398306['push'](_0x398306['shift']());}};_0x42644b(++_0x560fd1);}(_0xb528,0x18e));var _0x8b52=function(_0x484093,_0x223761){_0x484093=_0x484093-0x0;var _0x5160a5=_0xb528[_0x484093];return _0x5160a5;};'use strict';var _=require(_0x8b52('0x0'));var util=require('util');var moment=require(_0x8b52('0x1'));var BPromise=require(_0x8b52('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b52('0x3'));var db=require(_0x8b52('0x4'))['db'];var utils=require(_0x8b52('0x5'));var logger=require(_0x8b52('0x6'))('rpc');var config=require(_0x8b52('0x7'));var jayson=require(_0x8b52('0x8'));var client=jayson[_0x8b52('0x9')][_0x8b52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x466a46,_0x37facc,_0x4bd034){return new BPromise(function(_0x2b04d0,_0x21ef2a){return client[_0x8b52('0xb')](_0x466a46,_0x4bd034)[_0x8b52('0xc')](function(_0x3e43ca){logger[_0x8b52('0xd')](_0x8b52('0xe'),_0x37facc,'request\x20sent');logger[_0x8b52('0xf')](_0x8b52('0x10'),_0x37facc,_0x8b52('0x11'),JSON[_0x8b52('0x12')](_0x3e43ca));if(_0x3e43ca[_0x8b52('0x13')]){if(_0x3e43ca['error'][_0x8b52('0x14')]===0x1f4){logger['error'](_0x8b52('0xe'),_0x37facc,_0x3e43ca[_0x8b52('0x13')][_0x8b52('0x15')]);return _0x21ef2a(_0x3e43ca[_0x8b52('0x13')][_0x8b52('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x37facc,_0x3e43ca[_0x8b52('0x13')]['message']);return _0x2b04d0(_0x3e43ca['error']['message']);}else{logger[_0x8b52('0xd')](_0x8b52('0xe'),_0x37facc,'request\x20sent');_0x2b04d0(_0x3e43ca[_0x8b52('0x16')][_0x8b52('0x15')]);}})[_0x8b52('0x17')](function(_0x251320){logger['error'](_0x8b52('0xe'),_0x37facc,_0x251320);_0x21ef2a(_0x251320);});});} \ No newline at end of file +var _0x4227=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4437c6,_0x2261b4){var _0x414a34=function(_0x2eb9f7){while(--_0x2eb9f7){_0x4437c6['push'](_0x4437c6['shift']());}};_0x414a34(++_0x2261b4);}(_0x4227,0x89));var _0x7422=function(_0x11266e,_0x4a1ad0){_0x11266e=_0x11266e-0x0;var _0x1e71a4=_0x4227[_0x11266e];return _0x1e71a4;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3432,_0xe99299,_0x45ca1a){return new BPromise(function(_0x12965e,_0x599d78){return client[_0x7422('0xa')](_0x2b3432,_0x45ca1a)[_0x7422('0xb')](function(_0x25de34){logger['info'](_0x7422('0xc'),_0xe99299,'request\x20sent');logger[_0x7422('0xd')](_0x7422('0xe'),_0xe99299,_0x7422('0xf'),JSON[_0x7422('0x10')](_0x25de34));if(_0x25de34[_0x7422('0x11')]){if(_0x25de34['error'][_0x7422('0x12')]===0x1f4){logger[_0x7422('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe99299,_0x25de34[_0x7422('0x11')][_0x7422('0x13')]);return _0x599d78(_0x25de34['error'][_0x7422('0x13')]);}logger[_0x7422('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe99299,_0x25de34['error'][_0x7422('0x13')]);return _0x12965e(_0x25de34['error'][_0x7422('0x13')]);}else{logger[_0x7422('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe99299,_0x7422('0xf'));_0x12965e(_0x25de34[_0x7422('0x15')][_0x7422('0x13')]);}})[_0x7422('0x16')](function(_0x2946ca){logger[_0x7422('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe99299,_0x2946ca);_0x599d78(_0x2946ca);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 425dff3..8d17290 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 _0x3297=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x184d24,_0x4838a2){var _0x458562=function(_0x28d5a3){while(--_0x28d5a3){_0x184d24['push'](_0x184d24['shift']());}};_0x458562(++_0x4838a2);}(_0x3297,0x6b));var _0x7329=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x3297[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x7329('0x0'));var util=require('util');var path=require(_0x7329('0x1'));var timeout=require(_0x7329('0x2'));var express=require('express');var router=express[_0x7329('0x3')]();var fs_extra=require(_0x7329('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7329('0x5'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x7329('0x6')]('/',auth[_0x7329('0x7')](),controller[_0x7329('0x8')]);router['get'](_0x7329('0x9'),auth[_0x7329('0x7')](),controller[_0x7329('0xa')]);router['get']('/:id/download',auth[_0x7329('0x7')](),controller['download']);router[_0x7329('0xb')]('/',auth[_0x7329('0x7')](),controller[_0x7329('0xc')]);router[_0x7329('0xd')](_0x7329('0x9'),auth[_0x7329('0x7')](),controller[_0x7329('0xe')]);router[_0x7329('0xf')](_0x7329('0x9'),auth[_0x7329('0x7')](),controller[_0x7329('0x10')]);module[_0x7329('0x11')]=router; \ No newline at end of file +var _0x0d3b=['../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','show','/:id/download','download','post','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x5c4986,_0x5001a4){var _0x3bb2f3=function(_0x320a6a){while(--_0x320a6a){_0x5c4986['push'](_0x5c4986['shift']());}};_0x3bb2f3(++_0x5001a4);}(_0x0d3b,0x189));var _0xb0d3=function(_0x210119,_0x104b64){_0x210119=_0x210119-0x0;var _0x5aebe3=_0x0d3b[_0x210119];return _0x5aebe3;};'use strict';var multer=require(_0xb0d3('0x0'));var util=require('util');var path=require(_0xb0d3('0x1'));var timeout=require(_0xb0d3('0x2'));var express=require(_0xb0d3('0x3'));var router=express['Router']();var fs_extra=require(_0xb0d3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb0d3('0x5'));var config=require(_0xb0d3('0x6'));var controller=require(_0xb0d3('0x7'));router['get']('/',auth[_0xb0d3('0x8')](),controller[_0xb0d3('0x9')]);router[_0xb0d3('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb0d3('0xb')]);router[_0xb0d3('0xa')](_0xb0d3('0xc'),auth[_0xb0d3('0x8')](),controller[_0xb0d3('0xd')]);router[_0xb0d3('0xe')]('/',auth[_0xb0d3('0x8')](),controller['create']);router['put'](_0xb0d3('0xf'),auth[_0xb0d3('0x8')](),controller[_0xb0d3('0x10')]);router[_0xb0d3('0x11')](_0xb0d3('0xf'),auth[_0xb0d3('0x8')](),controller[_0xb0d3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 25a3893..580403d 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 _0xd0e3=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd0e3,0xd5));var _0x3d0e=function(_0x268ed3,_0x43aee8){_0x268ed3=_0x268ed3-0x0;var _0xb821fe=_0xd0e3[_0x268ed3];return _0xb821fe;};'use strict';var Sequelize=require(_0x3d0e('0x0'));module[_0x3d0e('0x1')]={'field':{'type':Sequelize[_0x3d0e('0x2')]},'alias':{'type':Sequelize[_0x3d0e('0x3')]},'function':{'type':Sequelize[_0x3d0e('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x3d0e('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3d0e('0x3')]},'custom':{'type':Sequelize[_0x3d0e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x972c=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x333675,_0x42a6d6){var _0x16e247=function(_0x12e805){while(--_0x12e805){_0x333675['push'](_0x333675['shift']());}};_0x16e247(++_0x42a6d6);}(_0x972c,0x1a8));var _0xc972=function(_0x58957c,_0x4d5c01){_0x58957c=_0x58957c-0x0;var _0x323a89=_0x972c[_0x58957c];return _0x323a89;};'use strict';var Sequelize=require(_0xc972('0x0'));module[_0xc972('0x1')]={'field':{'type':Sequelize[_0xc972('0x2')]},'alias':{'type':Sequelize[_0xc972('0x3')]},'function':{'type':Sequelize[_0xc972('0x3')]},'format':{'type':Sequelize[_0xc972('0x3')]},'groupBy':{'type':Sequelize[_0xc972('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc972('0x3')]},'custom':{'type':Sequelize[_0xc972('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 4601155..58827ab 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 _0x8595=['limit','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticFieldReport','include','findAll','show','includeAll','find','create','bulkCreate','body','catch','params','bulkDestroy','ids','addFields','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined'];(function(_0x21fbc2,_0x667a40){var _0x2b8d80=function(_0x44b2dc){while(--_0x44b2dc){_0x21fbc2['push'](_0x21fbc2['shift']());}};_0x2b8d80(++_0x667a40);}(_0x8595,0x1b8));var _0x5859=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x8595[_0x53cf8e];return _0x459197;};'use strict';var emlformat=require(_0x5859('0x0'));var rimraf=require(_0x5859('0x1'));var zipdir=require(_0x5859('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5859('0x3'));var moment=require(_0x5859('0x4'));var BPromise=require(_0x5859('0x5'));var Mustache=require('mustache');var util=require(_0x5859('0x6'));var path=require(_0x5859('0x7'));var sox=require(_0x5859('0x8'));var csv=require('to-csv');var ejs=require(_0x5859('0x9'));var fs=require('fs');var fs_extra=require(_0x5859('0xa'));var _=require(_0x5859('0xb'));var squel=require(_0x5859('0xc'));var crypto=require(_0x5859('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5859('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5859('0xf'));var Redis=require('ioredis');var authService=require(_0x5859('0x10'));var qs=require(_0x5859('0x11'));var as=require(_0x5859('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5859('0x13'))('api');var utils=require(_0x5859('0x14'));var config=require(_0x5859('0x15'));var licenseUtil=require(_0x5859('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x319829,_0x9e499c){_0x9e499c=_0x9e499c||0xcc;return function(_0x41ddee){if(_0x41ddee){return _0x319829['sendStatus'](_0x9e499c);}return _0x319829['status'](_0x9e499c)[_0x5859('0x17')]();};}function respondWithResult(_0x540edc,_0x47d6e2){_0x47d6e2=_0x47d6e2||0xc8;return function(_0x8a8f9){if(_0x8a8f9){return _0x540edc[_0x5859('0x18')](_0x47d6e2)[_0x5859('0x19')](_0x8a8f9);}};}function respondWithFilteredResult(_0x1d6e90,_0x41a11d){return function(_0x235faa){if(_0x235faa){var _0x430440=typeof _0x41a11d[_0x5859('0x1a')]===_0x5859('0x1b')&&typeof _0x41a11d['limit']===_0x5859('0x1b');var _0x49fe09=_0x235faa['count'];var _0x5d5f04=_0x430440?0x0:_0x41a11d[_0x5859('0x1a')];var _0x5be6b2=_0x430440?_0x235faa['count']:_0x41a11d[_0x5859('0x1a')]+_0x41a11d[_0x5859('0x1c')];var _0x12ec0a;if(_0x5be6b2>=_0x49fe09){_0x5be6b2=_0x49fe09;_0x12ec0a=0xc8;}else{_0x12ec0a=0xce;}_0x1d6e90[_0x5859('0x18')](_0x12ec0a);return _0x1d6e90[_0x5859('0x1d')]('Content-Range',_0x5d5f04+'-'+_0x5be6b2+'/'+_0x49fe09)['json'](_0x235faa);}return null;};}function patchUpdates(_0x35d58f){return function(_0x33fcd1){try{jsonpatch[_0x5859('0x1e')](_0x33fcd1,_0x35d58f,!![]);}catch(_0xcf4c4c){return BPromise[_0x5859('0x1f')](_0xcf4c4c);}return _0x33fcd1[_0x5859('0x20')]();};}function saveUpdates(_0x211546,_0x22d1ec){return function(_0x331755){if(_0x331755){return _0x331755[_0x5859('0x21')](_0x211546)[_0x5859('0x22')](function(_0x1ee54c){return _0x1ee54c;});}return null;};}function removeEntity(_0x5b6be0,_0x4c8991){return function(_0x10bd3a){if(_0x10bd3a){return _0x10bd3a[_0x5859('0x23')]()[_0x5859('0x22')](function(){_0x5b6be0['status'](0xcc)[_0x5859('0x17')]();});}};}function handleEntityNotFound(_0x470bcf,_0x16e626){return function(_0x1024bf){if(!_0x1024bf){_0x470bcf[_0x5859('0x24')](0x194);}return _0x1024bf;};}function handleError(_0xd9f4ed,_0x1c69ae){_0x1c69ae=_0x1c69ae||0x1f4;return function(_0x2d347b){logger[_0x5859('0x25')](_0x2d347b['stack']);if(_0x2d347b[_0x5859('0x26')]){delete _0x2d347b[_0x5859('0x26')];}_0xd9f4ed['status'](_0x1c69ae)[_0x5859('0x27')](_0x2d347b);};}exports[_0x5859('0x28')]=function(_0x275b06,_0x4c0619){var _0x55fb20={},_0x3dfb71={},_0x1c9bf8={'count':0x0,'rows':[]};var _0x1b3b13=_[_0x5859('0x29')](db['AnalyticFieldReport'][_0x5859('0x2a')],function(_0x34d1bd){return{'name':_0x34d1bd[_0x5859('0x2b')],'type':_0x34d1bd['type'][_0x5859('0x2c')]};});_0x3dfb71[_0x5859('0x2d')]=_[_0x5859('0x29')](_0x1b3b13,_0x5859('0x26'));_0x3dfb71['query']=_['keys'](_0x275b06[_0x5859('0x2e')]);_0x3dfb71[_0x5859('0x2f')]=_[_0x5859('0x30')](_0x3dfb71[_0x5859('0x2d')],_0x3dfb71['query']);_0x55fb20[_0x5859('0x31')]=_[_0x5859('0x30')](_0x3dfb71[_0x5859('0x2d')],qs[_0x5859('0x32')](_0x275b06['query'][_0x5859('0x32')]));_0x55fb20['attributes']=_0x55fb20[_0x5859('0x31')][_0x5859('0x33')]?_0x55fb20[_0x5859('0x31')]:_0x3dfb71[_0x5859('0x2d')];if(!_0x275b06[_0x5859('0x2e')][_0x5859('0x34')](_0x5859('0x35'))){_0x55fb20[_0x5859('0x1c')]=qs[_0x5859('0x1c')](_0x275b06['query'][_0x5859('0x1c')]);_0x55fb20[_0x5859('0x1a')]=qs['offset'](_0x275b06[_0x5859('0x2e')][_0x5859('0x1a')]);}_0x55fb20[_0x5859('0x36')]=qs[_0x5859('0x37')](_0x275b06[_0x5859('0x2e')][_0x5859('0x37')]);_0x55fb20[_0x5859('0x38')]=qs['filters'](_['pick'](_0x275b06[_0x5859('0x2e')],_0x3dfb71['filters']),_0x1b3b13);if(_0x275b06[_0x5859('0x2e')][_0x5859('0x39')]){_0x55fb20[_0x5859('0x38')]=_[_0x5859('0x3a')](_0x55fb20['where'],{'$or':_[_0x5859('0x29')](_0x1b3b13,function(_0x40b064){if(_0x40b064['type']!==_0x5859('0x3b')){var _0x36e006={};_0x36e006[_0x40b064[_0x5859('0x26')]]={'$like':'%'+_0x275b06[_0x5859('0x2e')][_0x5859('0x39')]+'%'};return _0x36e006;}})});}_0x55fb20=_[_0x5859('0x3a')]({},_0x55fb20,_0x275b06[_0x5859('0x3c')]);var _0x52c30e={'where':_0x55fb20['where']};return db[_0x5859('0x3d')]['count'](_0x52c30e)['then'](function(_0x47f13c){_0x1c9bf8['count']=_0x47f13c;if(_0x275b06['query']['includeAll']){_0x55fb20[_0x5859('0x3e')]=[{'all':!![]}];}return db[_0x5859('0x3d')][_0x5859('0x3f')](_0x55fb20);})['then'](function(_0x270b61){_0x1c9bf8['rows']=_0x270b61;return _0x1c9bf8;})[_0x5859('0x22')](respondWithFilteredResult(_0x4c0619,_0x55fb20))['catch'](handleError(_0x4c0619,null));};exports[_0x5859('0x40')]=function(_0x2f82f4,_0x4db190){var _0x551652={'raw':![],'where':{'id':_0x2f82f4['params']['id']}},_0x5b7b12={};_0x5b7b12[_0x5859('0x2d')]=_['keys'](db[_0x5859('0x3d')][_0x5859('0x2a')]);_0x5b7b12[_0x5859('0x2e')]=_['keys'](_0x2f82f4[_0x5859('0x2e')]);_0x5b7b12['filters']=_[_0x5859('0x30')](_0x5b7b12[_0x5859('0x2d')],_0x5b7b12[_0x5859('0x2e')]);_0x551652[_0x5859('0x31')]=_['intersection'](_0x5b7b12['model'],qs[_0x5859('0x32')](_0x2f82f4[_0x5859('0x2e')][_0x5859('0x32')]));_0x551652[_0x5859('0x31')]=_0x551652['attributes'][_0x5859('0x33')]?_0x551652[_0x5859('0x31')]:_0x5b7b12[_0x5859('0x2d')];if(_0x2f82f4[_0x5859('0x2e')][_0x5859('0x41')]){_0x551652['include']=[{'all':!![]}];}_0x551652=_[_0x5859('0x3a')]({},_0x551652,_0x2f82f4[_0x5859('0x3c')]);return db[_0x5859('0x3d')][_0x5859('0x42')](_0x551652)[_0x5859('0x22')](handleEntityNotFound(_0x4db190,null))['then'](respondWithResult(_0x4db190,null))['catch'](handleError(_0x4db190,null));};exports[_0x5859('0x43')]=function(_0x3492c3,_0x3b2db2){return db['AnalyticFieldReport']['create'](_0x3492c3['body'],{})[_0x5859('0x22')](respondWithResult(_0x3b2db2,0xc9))['catch'](handleError(_0x3b2db2,null));};exports['bulkCreate']=function(_0x414649,_0x33048c){return db[_0x5859('0x3d')][_0x5859('0x44')](_0x414649[_0x5859('0x45')],{'raw':![],'individualHooks':!![]})[_0x5859('0x22')](respondWithResult(_0x33048c,0xc9))[_0x5859('0x46')](handleError(_0x33048c,null));};exports['update']=function(_0x4ee848,_0x2e4752){if(_0x4ee848[_0x5859('0x45')]['id']){delete _0x4ee848[_0x5859('0x45')]['id'];}return db[_0x5859('0x3d')][_0x5859('0x42')]({'where':{'id':_0x4ee848[_0x5859('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e4752,null))[_0x5859('0x22')](saveUpdates(_0x4ee848[_0x5859('0x45')],null))[_0x5859('0x22')](respondWithResult(_0x2e4752,null))['catch'](handleError(_0x2e4752,null));};exports[_0x5859('0x23')]=function(_0x47722a,_0x2dc3f7){return db['AnalyticFieldReport'][_0x5859('0x42')]({'where':{'id':_0x47722a['params']['id']}})['then'](handleEntityNotFound(_0x2dc3f7,null))['then'](removeEntity(_0x2dc3f7,null))['catch'](handleError(_0x2dc3f7,null));};exports[_0x5859('0x48')]=function(_0x4db318,_0x3eb44b){return db['AnalyticFieldReport'][_0x5859('0x23')]({'where':{'id':_0x4db318[_0x5859('0x2e')][_0x5859('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x5859('0x22')](respondWithResult(_0x3eb44b,0xcc))[_0x5859('0x46')](handleError(_0x3eb44b,null));};exports[_0x5859('0x4a')]=function(_0x3a76ed,_0x11ff51,_0x1d076f){return db['AnalyticCustomReport'][_0x5859('0x4b')]({'where':{'id':_0x3a76ed[_0x5859('0x47')]['id']}})[_0x5859('0x22')](handleEntityNotFound(_0x11ff51,null))[_0x5859('0x22')](function(_0xd950f2){if(_0xd950f2){return db[_0x5859('0x4c')]['transaction'](function(_0x15459b){return db[_0x5859('0x3d')][_0x5859('0x23')]({'where':{'CustomReportId':_0x3a76ed[_0x5859('0x47')]['id']},'transaction':_0x15459b})[_0x5859('0x22')](function(_0x1a3bb8){var _0xfa5fc9=_[_0x5859('0x29')](_0x3a76ed[_0x5859('0x45')],function(_0x3a33ef){delete _0x3a33ef['id'];_0x3a33ef[_0x5859('0x4d')]=_0x3a76ed[_0x5859('0x47')]['id'];return _0x3a33ef;});return db['AnalyticFieldReport'][_0x5859('0x44')](_0xfa5fc9,{'transaction':_0x15459b});});})['then'](function(){return db[_0x5859('0x3d')]['findAll']({'where':{'CustomReportId':_0x3a76ed[_0x5859('0x47')]['id']}});});}})[_0x5859('0x22')](respondWithResult(_0x11ff51,null))[_0x5859('0x46')](handleError(_0x11ff51,null));}; \ No newline at end of file +var _0xe54a=['stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','keys','create','body','bulkCreate','find','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','end'];(function(_0x1f146c,_0xfb86d6){var _0x2354fb=function(_0x2078d0){while(--_0x2078d0){_0x1f146c['push'](_0x1f146c['shift']());}};_0x2354fb(++_0xfb86d6);}(_0xe54a,0xcf));var _0xae54=function(_0x5966a9,_0x40ed08){_0x5966a9=_0x5966a9-0x0;var _0x1b0c39=_0xe54a[_0x5966a9];return _0x1b0c39;};'use strict';var emlformat=require(_0xae54('0x0'));var rimraf=require(_0xae54('0x1'));var zipdir=require(_0xae54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae54('0x3'));var moment=require(_0xae54('0x4'));var BPromise=require(_0xae54('0x5'));var Mustache=require('mustache');var util=require(_0xae54('0x6'));var path=require(_0xae54('0x7'));var sox=require(_0xae54('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae54('0x9'));var _=require(_0xae54('0xa'));var squel=require(_0xae54('0xb'));var crypto=require(_0xae54('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xae54('0xd'));var Papa=require(_0xae54('0xe'));var Redis=require(_0xae54('0xf'));var authService=require(_0xae54('0x10'));var qs=require(_0xae54('0x11'));var as=require(_0xae54('0x12'));var hardwareService=require(_0xae54('0x13'));var logger=require(_0xae54('0x14'))(_0xae54('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae54('0x16'))['db'];function respondWithStatusCode(_0x2a3c7b,_0x3cec48){_0x3cec48=_0x3cec48||0xcc;return function(_0x1c89f7){if(_0x1c89f7){return _0x2a3c7b[_0xae54('0x17')](_0x3cec48);}return _0x2a3c7b[_0xae54('0x18')](_0x3cec48)['end']();};}function respondWithResult(_0x5024d4,_0x3ebdbd){_0x3ebdbd=_0x3ebdbd||0xc8;return function(_0x5d0473){if(_0x5d0473){return _0x5024d4['status'](_0x3ebdbd)[_0xae54('0x19')](_0x5d0473);}};}function respondWithFilteredResult(_0x290c39,_0x2d3cdc){return function(_0x247355){if(_0x247355){var _0x216893=typeof _0x2d3cdc[_0xae54('0x1a')]===_0xae54('0x1b')&&typeof _0x2d3cdc['limit']==='undefined';var _0x764bed=_0x247355['count'];var _0x1e0b80=_0x216893?0x0:_0x2d3cdc[_0xae54('0x1a')];var _0x5b1c98=_0x216893?_0x247355['count']:_0x2d3cdc['offset']+_0x2d3cdc[_0xae54('0x1c')];var _0x5aaf9b;if(_0x5b1c98>=_0x764bed){_0x5b1c98=_0x764bed;_0x5aaf9b=0xc8;}else{_0x5aaf9b=0xce;}_0x290c39[_0xae54('0x18')](_0x5aaf9b);return _0x290c39[_0xae54('0x1d')](_0xae54('0x1e'),_0x1e0b80+'-'+_0x5b1c98+'/'+_0x764bed)[_0xae54('0x19')](_0x247355);}return null;};}function patchUpdates(_0xa0cc62){return function(_0x58725a){try{jsonpatch[_0xae54('0x1f')](_0x58725a,_0xa0cc62,!![]);}catch(_0x25c556){return BPromise[_0xae54('0x20')](_0x25c556);}return _0x58725a['save']();};}function saveUpdates(_0x2abfb1,_0x56845e){return function(_0x522143){if(_0x522143){return _0x522143[_0xae54('0x21')](_0x2abfb1)[_0xae54('0x22')](function(_0x55601c){return _0x55601c;});}return null;};}function removeEntity(_0x57b6ab,_0x17280e){return function(_0x518508){if(_0x518508){return _0x518508['destroy']()[_0xae54('0x22')](function(){_0x57b6ab[_0xae54('0x18')](0xcc)[_0xae54('0x23')]();});}};}function handleEntityNotFound(_0x197be8,_0x2acdfd){return function(_0x314492){if(!_0x314492){_0x197be8[_0xae54('0x17')](0x194);}return _0x314492;};}function handleError(_0x1748d4,_0x4d8405){_0x4d8405=_0x4d8405||0x1f4;return function(_0x5403fb){logger['error'](_0x5403fb[_0xae54('0x24')]);if(_0x5403fb[_0xae54('0x25')]){delete _0x5403fb[_0xae54('0x25')];}_0x1748d4['status'](_0x4d8405)[_0xae54('0x26')](_0x5403fb);};}exports[_0xae54('0x27')]=function(_0x3ec28e,_0xf3484c){var _0x4bf430={},_0x32cd08={},_0x8f2b09={'count':0x0,'rows':[]};var _0x320b87=_[_0xae54('0x28')](db[_0xae54('0x29')][_0xae54('0x2a')],function(_0x1afd58){return{'name':_0x1afd58[_0xae54('0x2b')],'type':_0x1afd58[_0xae54('0x2c')][_0xae54('0x2d')]};});_0x32cd08[_0xae54('0x2e')]=_['map'](_0x320b87,'name');_0x32cd08[_0xae54('0x2f')]=_['keys'](_0x3ec28e[_0xae54('0x2f')]);_0x32cd08[_0xae54('0x30')]=_['intersection'](_0x32cd08[_0xae54('0x2e')],_0x32cd08[_0xae54('0x2f')]);_0x4bf430['attributes']=_[_0xae54('0x31')](_0x32cd08[_0xae54('0x2e')],qs[_0xae54('0x32')](_0x3ec28e[_0xae54('0x2f')][_0xae54('0x32')]));_0x4bf430['attributes']=_0x4bf430[_0xae54('0x33')][_0xae54('0x34')]?_0x4bf430[_0xae54('0x33')]:_0x32cd08[_0xae54('0x2e')];if(!_0x3ec28e[_0xae54('0x2f')][_0xae54('0x35')]('nolimit')){_0x4bf430[_0xae54('0x1c')]=qs[_0xae54('0x1c')](_0x3ec28e['query'][_0xae54('0x1c')]);_0x4bf430['offset']=qs[_0xae54('0x1a')](_0x3ec28e[_0xae54('0x2f')][_0xae54('0x1a')]);}_0x4bf430[_0xae54('0x36')]=qs[_0xae54('0x37')](_0x3ec28e['query']['sort']);_0x4bf430[_0xae54('0x38')]=qs['filters'](_['pick'](_0x3ec28e[_0xae54('0x2f')],_0x32cd08[_0xae54('0x30')]),_0x320b87);if(_0x3ec28e[_0xae54('0x2f')]['filter']){_0x4bf430[_0xae54('0x38')]=_[_0xae54('0x39')](_0x4bf430[_0xae54('0x38')],{'$or':_['map'](_0x320b87,function(_0x2f30a9){if(_0x2f30a9[_0xae54('0x2c')]!==_0xae54('0x3a')){var _0x4ab4b0={};_0x4ab4b0[_0x2f30a9['name']]={'$like':'%'+_0x3ec28e['query'][_0xae54('0x3b')]+'%'};return _0x4ab4b0;}})});}_0x4bf430=_[_0xae54('0x39')]({},_0x4bf430,_0x3ec28e[_0xae54('0x3c')]);var _0x26ff64={'where':_0x4bf430['where']};return db[_0xae54('0x29')][_0xae54('0x3d')](_0x26ff64)[_0xae54('0x22')](function(_0x3eb4cd){_0x8f2b09['count']=_0x3eb4cd;if(_0x3ec28e[_0xae54('0x2f')][_0xae54('0x3e')]){_0x4bf430['include']=[{'all':!![]}];}return db[_0xae54('0x29')][_0xae54('0x3f')](_0x4bf430);})['then'](function(_0xbe96bb){_0x8f2b09[_0xae54('0x40')]=_0xbe96bb;return _0x8f2b09;})[_0xae54('0x22')](respondWithFilteredResult(_0xf3484c,_0x4bf430))[_0xae54('0x41')](handleError(_0xf3484c,null));};exports[_0xae54('0x42')]=function(_0x4e428b,_0x45e43b){var _0x57ca76={'raw':![],'where':{'id':_0x4e428b[_0xae54('0x43')]['id']}},_0xe0bcc9={};_0xe0bcc9[_0xae54('0x2e')]=_[_0xae54('0x44')](db[_0xae54('0x29')]['rawAttributes']);_0xe0bcc9[_0xae54('0x2f')]=_[_0xae54('0x44')](_0x4e428b['query']);_0xe0bcc9[_0xae54('0x30')]=_[_0xae54('0x31')](_0xe0bcc9[_0xae54('0x2e')],_0xe0bcc9[_0xae54('0x2f')]);_0x57ca76['attributes']=_[_0xae54('0x31')](_0xe0bcc9[_0xae54('0x2e')],qs[_0xae54('0x32')](_0x4e428b[_0xae54('0x2f')][_0xae54('0x32')]));_0x57ca76['attributes']=_0x57ca76[_0xae54('0x33')]['length']?_0x57ca76[_0xae54('0x33')]:_0xe0bcc9[_0xae54('0x2e')];if(_0x4e428b['query'][_0xae54('0x3e')]){_0x57ca76['include']=[{'all':!![]}];}_0x57ca76=_['merge']({},_0x57ca76,_0x4e428b[_0xae54('0x3c')]);return db[_0xae54('0x29')]['find'](_0x57ca76)['then'](handleEntityNotFound(_0x45e43b,null))[_0xae54('0x22')](respondWithResult(_0x45e43b,null))[_0xae54('0x41')](handleError(_0x45e43b,null));};exports[_0xae54('0x45')]=function(_0x3c60c8,_0x1927d4){return db[_0xae54('0x29')][_0xae54('0x45')](_0x3c60c8[_0xae54('0x46')],{})[_0xae54('0x22')](respondWithResult(_0x1927d4,0xc9))[_0xae54('0x41')](handleError(_0x1927d4,null));};exports[_0xae54('0x47')]=function(_0x3a81ab,_0x4c06ba){return db[_0xae54('0x29')]['bulkCreate'](_0x3a81ab[_0xae54('0x46')],{'raw':![],'individualHooks':!![]})[_0xae54('0x22')](respondWithResult(_0x4c06ba,0xc9))[_0xae54('0x41')](handleError(_0x4c06ba,null));};exports[_0xae54('0x21')]=function(_0x1f1b7b,_0x4b58dd){if(_0x1f1b7b[_0xae54('0x46')]['id']){delete _0x1f1b7b[_0xae54('0x46')]['id'];}return db[_0xae54('0x29')][_0xae54('0x48')]({'where':{'id':_0x1f1b7b[_0xae54('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b58dd,null))[_0xae54('0x22')](saveUpdates(_0x1f1b7b[_0xae54('0x46')],null))[_0xae54('0x22')](respondWithResult(_0x4b58dd,null))['catch'](handleError(_0x4b58dd,null));};exports[_0xae54('0x49')]=function(_0x503a40,_0x10e304){return db[_0xae54('0x29')][_0xae54('0x48')]({'where':{'id':_0x503a40[_0xae54('0x43')]['id']}})['then'](handleEntityNotFound(_0x10e304,null))['then'](removeEntity(_0x10e304,null))[_0xae54('0x41')](handleError(_0x10e304,null));};exports[_0xae54('0x4a')]=function(_0x54cfd7,_0x1a4c6f){return db[_0xae54('0x29')][_0xae54('0x49')]({'where':{'id':_0x54cfd7[_0xae54('0x2f')][_0xae54('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xae54('0x22')](respondWithResult(_0x1a4c6f,0xcc))[_0xae54('0x41')](handleError(_0x1a4c6f,null));};exports[_0xae54('0x4c')]=function(_0x946b0a,_0xebcb1e,_0x2047bb){return db[_0xae54('0x4d')][_0xae54('0x4e')]({'where':{'id':_0x946b0a[_0xae54('0x43')]['id']}})[_0xae54('0x22')](handleEntityNotFound(_0xebcb1e,null))['then'](function(_0x1a9107){if(_0x1a9107){return db[_0xae54('0x4f')]['transaction'](function(_0x4e918b){return db['AnalyticFieldReport'][_0xae54('0x49')]({'where':{'CustomReportId':_0x946b0a[_0xae54('0x43')]['id']},'transaction':_0x4e918b})[_0xae54('0x22')](function(_0x385b0c){var _0x390172=_[_0xae54('0x28')](_0x946b0a['body'],function(_0xc19549){delete _0xc19549['id'];_0xc19549[_0xae54('0x50')]=_0x946b0a[_0xae54('0x43')]['id'];return _0xc19549;});return db['AnalyticFieldReport'][_0xae54('0x47')](_0x390172,{'transaction':_0x4e918b});});})[_0xae54('0x22')](function(){return db[_0xae54('0x29')][_0xae54('0x3f')]({'where':{'CustomReportId':_0x946b0a[_0xae54('0x43')]['id']}});});}})[_0xae54('0x22')](respondWithResult(_0xebcb1e,null))[_0xae54('0x41')](handleError(_0xebcb1e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a97c047..b672f43 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 _0x1f8b=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1f8b,0x1c0));var _0xb1f8=function(_0x26b190,_0x58755){_0x26b190=_0x26b190-0x0;var _0xe1d133=_0x1f8b[_0x26b190];return _0xe1d133;};'use strict';var _=require(_0xb1f8('0x0'));var util=require(_0xb1f8('0x1'));var logger=require(_0xb1f8('0x2'))('api');var moment=require(_0xb1f8('0x3'));var BPromise=require(_0xb1f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb1f8('0x5'));var config=require(_0xb1f8('0x6'));var attributes=require(_0xb1f8('0x7'));module['exports']=function(_0x314e91,_0xc0154d){return _0x314e91[_0xb1f8('0x8')](_0xb1f8('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe57f=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe57f,0x125));var _0xfe57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe57f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xfe57('0x0'));var util=require(_0xfe57('0x1'));var logger=require(_0xfe57('0x2'))('api');var moment=require(_0xfe57('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe57('0x4'));var rimraf=require(_0xfe57('0x5'));var config=require(_0xfe57('0x6'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x324078,_0x305914){return _0x324078[_0xfe57('0x7')](_0xfe57('0x8'),attributes,{'tableName':_0xfe57('0x9'),'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 31bbb5b..a052c54 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 _0x53cd=['info','AnalyticFieldReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4aec3f,_0x2de89f){var _0x4f10cc=function(_0x325664){while(--_0x325664){_0x4aec3f['push'](_0x4aec3f['shift']());}};_0x4f10cc(++_0x2de89f);}(_0x53cd,0x8d));var _0xd53c=function(_0x3a2c96,_0x2eaac9){_0x3a2c96=_0x3a2c96-0x0;var _0x41ade7=_0x53cd[_0x3a2c96];return _0x41ade7;};'use strict';var _=require(_0xd53c('0x0'));var util=require('util');var moment=require(_0xd53c('0x1'));var BPromise=require(_0xd53c('0x2'));var rs=require(_0xd53c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd53c('0x4'))['db'];var utils=require(_0xd53c('0x5'));var logger=require(_0xd53c('0x6'))(_0xd53c('0x7'));var config=require(_0xd53c('0x8'));var jayson=require(_0xd53c('0x9'));var client=jayson['client'][_0xd53c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa66e89,_0x92c521,_0x446c09){return new BPromise(function(_0x32d56f,_0x2ad88e){return client[_0xd53c('0xb')](_0xa66e89,_0x446c09)[_0xd53c('0xc')](function(_0x441636){logger[_0xd53c('0xd')](_0xd53c('0xe'),_0x92c521,'request\x20sent');logger[_0xd53c('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x92c521,'request\x20sent',JSON[_0xd53c('0x10')](_0x441636));if(_0x441636[_0xd53c('0x11')]){if(_0x441636[_0xd53c('0x11')]['code']===0x1f4){logger['error'](_0xd53c('0xe'),_0x92c521,_0x441636['error']['message']);return _0x2ad88e(_0x441636[_0xd53c('0x11')][_0xd53c('0x12')]);}logger[_0xd53c('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x92c521,_0x441636[_0xd53c('0x11')][_0xd53c('0x12')]);return _0x32d56f(_0x441636[_0xd53c('0x11')]['message']);}else{logger[_0xd53c('0xd')](_0xd53c('0xe'),_0x92c521,_0xd53c('0x13'));_0x32d56f(_0x441636[_0xd53c('0x14')][_0xd53c('0x12')]);}})[_0xd53c('0x15')](function(_0x5cb9ce){logger[_0xd53c('0x11')](_0xd53c('0xe'),_0x92c521,_0x5cb9ce);_0x2ad88e(_0x5cb9ce);});});} \ No newline at end of file +var _0x08e2=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x08e2,0xe0));var _0x208e=function(_0x2b134c,_0x27ebeb){_0x2b134c=_0x2b134c-0x0;var _0x2d33ec=_0x08e2[_0x2b134c];return _0x2d33ec;};'use strict';var _=require(_0x208e('0x0'));var util=require(_0x208e('0x1'));var moment=require(_0x208e('0x2'));var BPromise=require(_0x208e('0x3'));var rs=require(_0x208e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x208e('0x5'));var logger=require(_0x208e('0x6'))(_0x208e('0x7'));var config=require(_0x208e('0x8'));var jayson=require(_0x208e('0x9'));var client=jayson[_0x208e('0xa')][_0x208e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17e1fe,_0x4eb19c,_0x584658){return new BPromise(function(_0x3b5841,_0x19b511){return client[_0x208e('0xc')](_0x17e1fe,_0x584658)[_0x208e('0xd')](function(_0x3babaf){logger['info'](_0x208e('0xe'),_0x4eb19c,_0x208e('0xf'));logger[_0x208e('0x10')](_0x208e('0x11'),_0x4eb19c,_0x208e('0xf'),JSON[_0x208e('0x12')](_0x3babaf));if(_0x3babaf[_0x208e('0x13')]){if(_0x3babaf[_0x208e('0x13')][_0x208e('0x14')]===0x1f4){logger[_0x208e('0x13')](_0x208e('0xe'),_0x4eb19c,_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);return _0x19b511(_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);}logger[_0x208e('0x13')](_0x208e('0xe'),_0x4eb19c,_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);return _0x3b5841(_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);}else{logger[_0x208e('0x16')](_0x208e('0xe'),_0x4eb19c,'request\x20sent');_0x3b5841(_0x3babaf['result'][_0x208e('0x15')]);}})[_0x208e('0x17')](function(_0x1223d2){logger[_0x208e('0x13')](_0x208e('0xe'),_0x4eb19c,_0x1223d2);_0x19b511(_0x1223d2);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4d9565f..990ebb8 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(_0x1f5871,_0x2eb0f1){var _0x53375e=function(_0x4af597){while(--_0x4af597){_0x1f5871['push'](_0x1f5871['shift']());}};_0x53375e(++_0x2eb0f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0xdf7bdd,_0x575cb9){var _0x23b9f2=function(_0x6047ce){while(--_0x6047ce){_0xdf7bdd['push'](_0xdf7bdd['shift']());}};_0x23b9f2(++_0x575cb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 fb2f091..d4f2e11 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 _0x83cd=['exports','STRING','name','sequelize'];(function(_0x13b796,_0x19507b){var _0x54757d=function(_0x5805ea){while(--_0x5805ea){_0x13b796['push'](_0x13b796['shift']());}};_0x54757d(++_0x19507b);}(_0x83cd,0x17b));var _0xd83c=function(_0x27bf23,_0xff7a37){_0x27bf23=_0x27bf23-0x0;var _0x5befd0=_0x83cd[_0x27bf23];return _0x5befd0;};'use strict';var Sequelize=require(_0xd83c('0x0'));module[_0xd83c('0x1')]={'name':{'type':Sequelize[_0xd83c('0x2')],'allowNull':![],'unique':_0xd83c('0x3')},'table':{'type':Sequelize[_0xd83c('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xd83c('0x2')]}}; \ No newline at end of file +var _0x1b32=['TEXT','exports','STRING','name'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1b32,0x85));var _0x21b3=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x1b32[_0x4dc7b9];return _0x3ab114;};'use strict';var Sequelize=require('sequelize');module[_0x21b3('0x0')]={'name':{'type':Sequelize[_0x21b3('0x1')],'allowNull':![],'unique':_0x21b3('0x2')},'table':{'type':Sequelize[_0x21b3('0x1')]},'metric':{'type':Sequelize[_0x21b3('0x3')]},'description':{'type':Sequelize[_0x21b3('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e4ab7cb..7741580 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 _0x008c=['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','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x14f6db,_0x4d9f26){var _0x45344d=function(_0x44cace){while(--_0x44cace){_0x14f6db['push'](_0x14f6db['shift']());}};_0x45344d(++_0x4d9f26);}(_0x008c,0x188));var _0xc008=function(_0x1153ff,_0x2bb354){_0x1153ff=_0x1153ff-0x0;var _0xbc230a=_0x008c[_0x1153ff];return _0xbc230a;};'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(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x464c1a,_0x5e7d37){var _0x307d0b=function(_0x3d00f5){while(--_0x3d00f5){_0x464c1a['push'](_0x464c1a['shift']());}};_0x307d0b(++_0x5e7d37);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x5fc3[_0x1d83db];return _0x2dc1d1;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 87c87f8..da09eae 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 _0x9505=['request-promise','path','./analyticMetric.attributes','exports','analytics_metrics','lodash','util','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9505,0x1e5));var _0x5950=function(_0x59daf0,_0x5d0805){_0x59daf0=_0x59daf0-0x0;var _0x2a0352=_0x9505[_0x59daf0];return _0x2a0352;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require(_0x5950('0x4'));var rp=require(_0x5950('0x5'));var fs=require('fs');var path=require(_0x5950('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5950('0x7'));module[_0x5950('0x8')]=function(_0x3ac153,_0x3a5973){return _0x3ac153['define']('AnalyticMetric',attributes,{'tableName':_0x5950('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3641=['define','AnalyticMetric','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3253e3,_0x19d384){var _0x10ca3e=function(_0x4dee6d){while(--_0x4dee6d){_0x3253e3['push'](_0x3253e3['shift']());}};_0x10ca3e(++_0x19d384);}(_0x3641,0x173));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1364('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1364('0x1'));var BPromise=require(_0x1364('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1364('0x3'));var rimraf=require(_0x1364('0x4'));var config=require(_0x1364('0x5'));var attributes=require('./analyticMetric.attributes');module[_0x1364('0x6')]=function(_0x4bcb69,_0x169527){return _0x4bcb69[_0x1364('0x7')](_0x1364('0x8'),attributes,{'tableName':'analytics_metrics','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 9ba71e6..934a264 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 _0x1e5f=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15338c,_0x3a78f8){var _0x2ee911=function(_0x58af05){while(--_0x58af05){_0x15338c['push'](_0x15338c['shift']());}};_0x2ee911(++_0x3a78f8);}(_0x1e5f,0xbf));var _0xf1e5=function(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0x1e5f[_0x45d5ef];return _0x474d19;};'use strict';var _=require(_0xf1e5('0x0'));var util=require(_0xf1e5('0x1'));var moment=require(_0xf1e5('0x2'));var BPromise=require(_0xf1e5('0x3'));var rs=require(_0xf1e5('0x4'));var fs=require('fs');var Redis=require(_0xf1e5('0x5'));var db=require(_0xf1e5('0x6'))['db'];var utils=require(_0xf1e5('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf1e5('0x8'));var client=jayson[_0xf1e5('0x9')][_0xf1e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b4530,_0x46e74,_0xb43f93){return new BPromise(function(_0x2a5313,_0x4eaaa5){return client['request'](_0x1b4530,_0xb43f93)[_0xf1e5('0xb')](function(_0x475d29){logger[_0xf1e5('0xc')](_0xf1e5('0xd'),_0x46e74,_0xf1e5('0xe'));logger[_0xf1e5('0xf')](_0xf1e5('0x10'),_0x46e74,_0xf1e5('0xe'),JSON[_0xf1e5('0x11')](_0x475d29));if(_0x475d29[_0xf1e5('0x12')]){if(_0x475d29[_0xf1e5('0x12')][_0xf1e5('0x13')]===0x1f4){logger[_0xf1e5('0x12')](_0xf1e5('0xd'),_0x46e74,_0x475d29[_0xf1e5('0x12')][_0xf1e5('0x14')]);return _0x4eaaa5(_0x475d29[_0xf1e5('0x12')]['message']);}logger[_0xf1e5('0x12')](_0xf1e5('0xd'),_0x46e74,_0x475d29[_0xf1e5('0x12')][_0xf1e5('0x14')]);return _0x2a5313(_0x475d29[_0xf1e5('0x12')][_0xf1e5('0x14')]);}else{logger[_0xf1e5('0xc')](_0xf1e5('0xd'),_0x46e74,_0xf1e5('0xe'));_0x2a5313(_0x475d29[_0xf1e5('0x15')][_0xf1e5('0x14')]);}})[_0xf1e5('0x16')](function(_0x2c0a5b){logger[_0xf1e5('0x12')](_0xf1e5('0xd'),_0x46e74,_0x2c0a5b);_0x4eaaa5(_0x2c0a5b);});});} \ No newline at end of file +var _0x506b=['request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2180c9,_0x3bc262){var _0x4caed4=function(_0x24a976){while(--_0x24a976){_0x2180c9['push'](_0x2180c9['shift']());}};_0x4caed4(++_0x3bc262);}(_0x506b,0x139));var _0xb506=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0x506b[_0x260073];return _0x4ff033;};'use strict';var _=require('lodash');var util=require(_0xb506('0x0'));var moment=require(_0xb506('0x1'));var BPromise=require(_0xb506('0x2'));var rs=require(_0xb506('0x3'));var fs=require('fs');var Redis=require(_0xb506('0x4'));var db=require(_0xb506('0x5'))['db'];var utils=require(_0xb506('0x6'));var logger=require(_0xb506('0x7'))(_0xb506('0x8'));var config=require(_0xb506('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb506('0xa')][_0xb506('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2faf97,_0x24cc75,_0x50beae){return new BPromise(function(_0x2ceac9,_0x754f88){return client[_0xb506('0xc')](_0x2faf97,_0x50beae)[_0xb506('0xd')](function(_0x5e4cad){logger['info'](_0xb506('0xe'),_0x24cc75,_0xb506('0xf'));logger[_0xb506('0x10')](_0xb506('0x11'),_0x24cc75,_0xb506('0xf'),JSON[_0xb506('0x12')](_0x5e4cad));if(_0x5e4cad[_0xb506('0x13')]){if(_0x5e4cad[_0xb506('0x13')][_0xb506('0x14')]===0x1f4){logger[_0xb506('0x13')](_0xb506('0xe'),_0x24cc75,_0x5e4cad['error'][_0xb506('0x15')]);return _0x754f88(_0x5e4cad[_0xb506('0x13')][_0xb506('0x15')]);}logger[_0xb506('0x13')](_0xb506('0xe'),_0x24cc75,_0x5e4cad[_0xb506('0x13')][_0xb506('0x15')]);return _0x2ceac9(_0x5e4cad['error'][_0xb506('0x15')]);}else{logger[_0xb506('0x16')]('AnalyticMetric,\x20%s,\x20%s',_0x24cc75,'request\x20sent');_0x2ceac9(_0x5e4cad[_0xb506('0x17')]['message']);}})[_0xb506('0x18')](function(_0x2062e4){logger[_0xb506('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x24cc75,_0x2062e4);_0x754f88(_0x2062e4);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c6baa6e..aced482 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 _0xda19=['isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0xda19,0xd5));var _0x9da1=function(_0x432df3,_0x5992e4){_0x432df3=_0x432df3-0x0;var _0x394ede=_0xda19[_0x432df3];return _0x394ede;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9da1('0xc')]('/:id',auth[_0x9da1('0x8')](),controller[_0x9da1('0xd')]);router[_0x9da1('0xe')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xf')]);module[_0x9da1('0x10')]=router; \ No newline at end of file +var _0xf1c6=['post','put','update','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0xe7ea76,_0x1573e3){var _0x5ebdf3=function(_0x1de1e0){while(--_0x1de1e0){_0xe7ea76['push'](_0xe7ea76['shift']());}};_0x5ebdf3(++_0x1573e3);}(_0xf1c6,0x145));var _0x6f1c=function(_0x336104,_0x3b28bf){_0x336104=_0x336104-0x0;var _0x5eca5a=_0xf1c6[_0x336104];return _0x5eca5a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f1c('0x0'));var timeout=require(_0x6f1c('0x1'));var express=require(_0x6f1c('0x2'));var router=express[_0x6f1c('0x3')]();var fs_extra=require(_0x6f1c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f1c('0x5'));var controller=require('./analyticMetric.controller');router[_0x6f1c('0x6')]('/',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0x8')]);router['get'](_0x6f1c('0x9'),auth['isAuthenticated'](),controller[_0x6f1c('0xa')]);router[_0x6f1c('0xb')]('/',auth[_0x6f1c('0x7')](),controller['create']);router[_0x6f1c('0xc')]('/:id',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0xd')]);router['delete'](_0x6f1c('0x9'),auth[_0x6f1c('0x7')](),controller['destroy']);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 6691e09..ccbd296 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 _0x4264=['exports','TEXT','sequelize'];(function(_0x37a73b,_0x569e74){var _0x39cee2=function(_0x61c7a9){while(--_0x61c7a9){_0x37a73b['push'](_0x37a73b['shift']());}};_0x39cee2(++_0x569e74);}(_0x4264,0x6e));var _0x4426=function(_0x34debe,_0x4e2560){_0x34debe=_0x34debe-0x0;var _0x5c7380=_0x4264[_0x34debe];return _0x5c7380;};'use strict';var Sequelize=require(_0x4426('0x0'));module[_0x4426('0x1')]={'tree':{'type':Sequelize[_0x4426('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0498=['sequelize'];(function(_0x4ce258,_0x82ae9c){var _0x540200=function(_0x10304c){while(--_0x10304c){_0x4ce258['push'](_0x4ce258['shift']());}};_0x540200(++_0x82ae9c);}(_0x0498,0x193));var _0x8049=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0498[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x8049('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index c7cb89a..3d96295 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 _0xd2bd=['show','params','include','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','reject','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch'];(function(_0x1f8999,_0x58ef02){var _0x4a4d99=function(_0x3ed847){while(--_0x3ed847){_0x1f8999['push'](_0x1f8999['shift']());}};_0x4a4d99(++_0x58ef02);}(_0xd2bd,0xe2));var _0xdd2b=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xd2bd[_0xb8cfbe];return _0x227d51;};'use strict';var emlformat=require(_0xdd2b('0x0'));var rimraf=require(_0xdd2b('0x1'));var zipdir=require(_0xdd2b('0x2'));var jsonpatch=require(_0xdd2b('0x3'));var rp=require(_0xdd2b('0x4'));var moment=require(_0xdd2b('0x5'));var BPromise=require(_0xdd2b('0x6'));var Mustache=require(_0xdd2b('0x7'));var util=require(_0xdd2b('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdd2b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd2b('0xa'));var crypto=require(_0xdd2b('0xb'));var jsforce=require(_0xdd2b('0xc'));var deskjs=require(_0xdd2b('0xd'));var toCsv=require(_0xdd2b('0xe'));var querystring=require(_0xdd2b('0xf'));var Papa=require(_0xdd2b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdd2b('0x11'));var as=require(_0xdd2b('0x12'));var hardwareService=require(_0xdd2b('0x13'));var logger=require(_0xdd2b('0x14'))(_0xdd2b('0x15'));var utils=require(_0xdd2b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdd2b('0x17'))['db'];function respondWithStatusCode(_0x252dcd,_0x2dd83c){_0x2dd83c=_0x2dd83c||0xcc;return function(_0x20a02a){if(_0x20a02a){return _0x252dcd[_0xdd2b('0x18')](_0x2dd83c);}return _0x252dcd[_0xdd2b('0x19')](_0x2dd83c)[_0xdd2b('0x1a')]();};}function respondWithResult(_0x116ebc,_0x5a5042){_0x5a5042=_0x5a5042||0xc8;return function(_0x4ffc2d){if(_0x4ffc2d){return _0x116ebc['status'](_0x5a5042)['json'](_0x4ffc2d);}};}function respondWithFilteredResult(_0x168d81,_0x5d6e7e){return function(_0x3dc86c){if(_0x3dc86c){var _0x369445=typeof _0x5d6e7e[_0xdd2b('0x1b')]===_0xdd2b('0x1c')&&typeof _0x5d6e7e[_0xdd2b('0x1d')]==='undefined';var _0x42a7ee=_0x3dc86c['count'];var _0x3216e8=_0x369445?0x0:_0x5d6e7e[_0xdd2b('0x1b')];var _0x342369=_0x369445?_0x3dc86c['count']:_0x5d6e7e[_0xdd2b('0x1b')]+_0x5d6e7e[_0xdd2b('0x1d')];var _0xeb3904;if(_0x342369>=_0x42a7ee){_0x342369=_0x42a7ee;_0xeb3904=0xc8;}else{_0xeb3904=0xce;}_0x168d81[_0xdd2b('0x19')](_0xeb3904);return _0x168d81[_0xdd2b('0x1e')](_0xdd2b('0x1f'),_0x3216e8+'-'+_0x342369+'/'+_0x42a7ee)[_0xdd2b('0x20')](_0x3dc86c);}return null;};}function patchUpdates(_0x2b4fbb){return function(_0x10bd4b){try{jsonpatch['apply'](_0x10bd4b,_0x2b4fbb,!![]);}catch(_0x4d5e19){return BPromise[_0xdd2b('0x21')](_0x4d5e19);}return _0x10bd4b['save']();};}function saveUpdates(_0x596395,_0x32f26b){return function(_0x300856){if(_0x300856){return _0x300856['update'](_0x596395)[_0xdd2b('0x22')](function(_0x36b6c9){return _0x36b6c9;});}return null;};}function removeEntity(_0x1e4d8b,_0x5af851){return function(_0x3e53bb){if(_0x3e53bb){return _0x3e53bb[_0xdd2b('0x23')]()[_0xdd2b('0x22')](function(){_0x1e4d8b['status'](0xcc)[_0xdd2b('0x1a')]();});}};}function handleEntityNotFound(_0x34a63f,_0x59abba){return function(_0xfae651){if(!_0xfae651){_0x34a63f['sendStatus'](0x194);}return _0xfae651;};}function handleError(_0x1903d,_0x19f35e){_0x19f35e=_0x19f35e||0x1f4;return function(_0x37d0d5){logger[_0xdd2b('0x24')](_0x37d0d5[_0xdd2b('0x25')]);if(_0x37d0d5[_0xdd2b('0x26')]){delete _0x37d0d5['name'];}_0x1903d[_0xdd2b('0x19')](_0x19f35e)['send'](_0x37d0d5);};}exports[_0xdd2b('0x27')]=function(_0x32289e,_0x21fd41){var _0x2f6f9a={},_0x99e374={},_0x1df5cf={'count':0x0,'rows':[]};var _0x2d114b=_[_0xdd2b('0x28')](db[_0xdd2b('0x29')][_0xdd2b('0x2a')],function(_0x7676c9){return{'name':_0x7676c9[_0xdd2b('0x2b')],'type':_0x7676c9[_0xdd2b('0x2c')][_0xdd2b('0x2d')]};});_0x99e374['model']=_[_0xdd2b('0x28')](_0x2d114b,_0xdd2b('0x26'));_0x99e374[_0xdd2b('0x2e')]=_[_0xdd2b('0x2f')](_0x32289e[_0xdd2b('0x2e')]);_0x99e374['filters']=_[_0xdd2b('0x30')](_0x99e374[_0xdd2b('0x31')],_0x99e374[_0xdd2b('0x2e')]);_0x2f6f9a[_0xdd2b('0x32')]=_[_0xdd2b('0x30')](_0x99e374[_0xdd2b('0x31')],qs[_0xdd2b('0x33')](_0x32289e[_0xdd2b('0x2e')]['fields']));_0x2f6f9a[_0xdd2b('0x32')]=_0x2f6f9a[_0xdd2b('0x32')]['length']?_0x2f6f9a['attributes']:_0x99e374['model'];if(!_0x32289e['query'][_0xdd2b('0x34')](_0xdd2b('0x35'))){_0x2f6f9a[_0xdd2b('0x1d')]=qs[_0xdd2b('0x1d')](_0x32289e['query'][_0xdd2b('0x1d')]);_0x2f6f9a['offset']=qs['offset'](_0x32289e[_0xdd2b('0x2e')][_0xdd2b('0x1b')]);}_0x2f6f9a['order']=qs[_0xdd2b('0x36')](_0x32289e[_0xdd2b('0x2e')][_0xdd2b('0x36')]);_0x2f6f9a['where']=qs[_0xdd2b('0x37')](_[_0xdd2b('0x38')](_0x32289e['query'],_0x99e374[_0xdd2b('0x37')]),_0x2d114b);if(_0x32289e[_0xdd2b('0x2e')][_0xdd2b('0x39')]){_0x2f6f9a[_0xdd2b('0x3a')]=_[_0xdd2b('0x3b')](_0x2f6f9a[_0xdd2b('0x3a')],{'$or':_[_0xdd2b('0x28')](_0x2d114b,function(_0x3c73b9){if(_0x3c73b9[_0xdd2b('0x2c')]!=='VIRTUAL'){var _0x1e9957={};_0x1e9957[_0x3c73b9['name']]={'$like':'%'+_0x32289e[_0xdd2b('0x2e')][_0xdd2b('0x39')]+'%'};return _0x1e9957;}})});}_0x2f6f9a=_['merge']({},_0x2f6f9a,_0x32289e[_0xdd2b('0x3c')]);var _0x4d96cd={'where':_0x2f6f9a[_0xdd2b('0x3a')]};return db[_0xdd2b('0x29')][_0xdd2b('0x3d')](_0x4d96cd)['then'](function(_0x2786ae){_0x1df5cf[_0xdd2b('0x3d')]=_0x2786ae;if(_0x32289e['query'][_0xdd2b('0x3e')]){_0x2f6f9a['include']=[{'all':!![]}];}return db[_0xdd2b('0x29')][_0xdd2b('0x3f')](_0x2f6f9a);})['then'](function(_0x17e07e){_0x1df5cf[_0xdd2b('0x40')]=_0x17e07e;return _0x1df5cf;})[_0xdd2b('0x22')](respondWithFilteredResult(_0x21fd41,_0x2f6f9a))[_0xdd2b('0x41')](handleError(_0x21fd41,null));};exports[_0xdd2b('0x42')]=function(_0x237a92,_0x1dc56d){var _0x56c355={'raw':!![],'where':{'id':_0x237a92[_0xdd2b('0x43')]['id']}},_0x22ba4a={};_0x22ba4a[_0xdd2b('0x31')]=_['keys'](db[_0xdd2b('0x29')][_0xdd2b('0x2a')]);_0x22ba4a[_0xdd2b('0x2e')]=_[_0xdd2b('0x2f')](_0x237a92[_0xdd2b('0x2e')]);_0x22ba4a[_0xdd2b('0x37')]=_[_0xdd2b('0x30')](_0x22ba4a[_0xdd2b('0x31')],_0x22ba4a[_0xdd2b('0x2e')]);_0x56c355[_0xdd2b('0x32')]=_[_0xdd2b('0x30')](_0x22ba4a['model'],qs['fields'](_0x237a92[_0xdd2b('0x2e')]['fields']));_0x56c355[_0xdd2b('0x32')]=_0x56c355[_0xdd2b('0x32')]['length']?_0x56c355[_0xdd2b('0x32')]:_0x22ba4a['model'];if(_0x237a92[_0xdd2b('0x2e')]['includeAll']){_0x56c355[_0xdd2b('0x44')]=[{'all':!![]}];}_0x56c355=_[_0xdd2b('0x3b')]({},_0x56c355,_0x237a92[_0xdd2b('0x3c')]);return db[_0xdd2b('0x29')][_0xdd2b('0x45')](_0x56c355)[_0xdd2b('0x22')](handleEntityNotFound(_0x1dc56d,null))[_0xdd2b('0x22')](respondWithResult(_0x1dc56d,null))['catch'](handleError(_0x1dc56d,null));};exports[_0xdd2b('0x46')]=function(_0x568a27,_0x5632d4){return db[_0xdd2b('0x29')]['create'](_0x568a27['body'],{})['then'](respondWithResult(_0x5632d4,0xc9))['catch'](handleError(_0x5632d4,null));};exports[_0xdd2b('0x47')]=function(_0x4b59f6,_0x29bbe4){if(_0x4b59f6[_0xdd2b('0x48')]['id']){delete _0x4b59f6[_0xdd2b('0x48')]['id'];}return db[_0xdd2b('0x29')][_0xdd2b('0x45')]({'where':{'id':_0x4b59f6[_0xdd2b('0x43')]['id']}})['then'](handleEntityNotFound(_0x29bbe4,null))[_0xdd2b('0x22')](saveUpdates(_0x4b59f6[_0xdd2b('0x48')],null))[_0xdd2b('0x22')](respondWithResult(_0x29bbe4,null))[_0xdd2b('0x41')](handleError(_0x29bbe4,null));};exports[_0xdd2b('0x23')]=function(_0x26e59e,_0x3f66b9){return db[_0xdd2b('0x29')][_0xdd2b('0x45')]({'where':{'id':_0x26e59e['params']['id']}})['then'](handleEntityNotFound(_0x3f66b9,null))['then'](removeEntity(_0x3f66b9,null))['catch'](handleError(_0x3f66b9,null));}; \ No newline at end of file +var _0xa7f1=['stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','catch','includeAll','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error'];(function(_0x42c2b6,_0x2a1cc2){var _0x2a7876=function(_0x120932){while(--_0x120932){_0x42c2b6['push'](_0x42c2b6['shift']());}};_0x2a7876(++_0x2a1cc2);}(_0xa7f1,0x14a));var _0x1a7f=function(_0x76fea7,_0x164167){_0x76fea7=_0x76fea7-0x0;var _0x3183c0=_0xa7f1[_0x76fea7];return _0x3183c0;};'use strict';var emlformat=require(_0x1a7f('0x0'));var rimraf=require(_0x1a7f('0x1'));var zipdir=require(_0x1a7f('0x2'));var jsonpatch=require(_0x1a7f('0x3'));var rp=require(_0x1a7f('0x4'));var moment=require('moment');var BPromise=require(_0x1a7f('0x5'));var Mustache=require(_0x1a7f('0x6'));var util=require('util');var path=require(_0x1a7f('0x7'));var sox=require(_0x1a7f('0x8'));var csv=require('to-csv');var ejs=require(_0x1a7f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a7f('0xa'));var squel=require(_0x1a7f('0xb'));var crypto=require(_0x1a7f('0xc'));var jsforce=require(_0x1a7f('0xd'));var deskjs=require(_0x1a7f('0xe'));var toCsv=require(_0x1a7f('0xf'));var querystring=require(_0x1a7f('0x10'));var Papa=require(_0x1a7f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1a7f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a7f('0x13'));var logger=require(_0x1a7f('0x14'))(_0x1a7f('0x15'));var utils=require(_0x1a7f('0x16'));var config=require(_0x1a7f('0x17'));var licenseUtil=require(_0x1a7f('0x18'));var db=require(_0x1a7f('0x19'))['db'];function respondWithStatusCode(_0x9db36c,_0x92d866){_0x92d866=_0x92d866||0xcc;return function(_0x143dbe){if(_0x143dbe){return _0x9db36c['sendStatus'](_0x92d866);}return _0x9db36c[_0x1a7f('0x1a')](_0x92d866)[_0x1a7f('0x1b')]();};}function respondWithResult(_0x154f74,_0x59c862){_0x59c862=_0x59c862||0xc8;return function(_0x42b47c){if(_0x42b47c){return _0x154f74[_0x1a7f('0x1a')](_0x59c862)[_0x1a7f('0x1c')](_0x42b47c);}};}function respondWithFilteredResult(_0x500ec5,_0x495aba){return function(_0x297b85){if(_0x297b85){var _0x2c3b19=typeof _0x495aba[_0x1a7f('0x1d')]===_0x1a7f('0x1e')&&typeof _0x495aba[_0x1a7f('0x1f')]===_0x1a7f('0x1e');var _0x459f4a=_0x297b85['count'];var _0x27d5c4=_0x2c3b19?0x0:_0x495aba['offset'];var _0x517f22=_0x2c3b19?_0x297b85[_0x1a7f('0x20')]:_0x495aba[_0x1a7f('0x1d')]+_0x495aba[_0x1a7f('0x1f')];var _0x3d47ee;if(_0x517f22>=_0x459f4a){_0x517f22=_0x459f4a;_0x3d47ee=0xc8;}else{_0x3d47ee=0xce;}_0x500ec5['status'](_0x3d47ee);return _0x500ec5['set'](_0x1a7f('0x21'),_0x27d5c4+'-'+_0x517f22+'/'+_0x459f4a)[_0x1a7f('0x1c')](_0x297b85);}return null;};}function patchUpdates(_0x93d51e){return function(_0x4ef4e4){try{jsonpatch[_0x1a7f('0x22')](_0x4ef4e4,_0x93d51e,!![]);}catch(_0x1a80f6){return BPromise['reject'](_0x1a80f6);}return _0x4ef4e4[_0x1a7f('0x23')]();};}function saveUpdates(_0x401946,_0x9864be){return function(_0x2672ca){if(_0x2672ca){return _0x2672ca[_0x1a7f('0x24')](_0x401946)[_0x1a7f('0x25')](function(_0x57aa69){return _0x57aa69;});}return null;};}function removeEntity(_0x483968,_0x2c674a){return function(_0x542c21){if(_0x542c21){return _0x542c21[_0x1a7f('0x26')]()[_0x1a7f('0x25')](function(){_0x483968[_0x1a7f('0x1a')](0xcc)[_0x1a7f('0x1b')]();});}};}function handleEntityNotFound(_0x9571fd,_0x1583eb){return function(_0x3fbc05){if(!_0x3fbc05){_0x9571fd['sendStatus'](0x194);}return _0x3fbc05;};}function handleError(_0x5c67be,_0x3b3d9e){_0x3b3d9e=_0x3b3d9e||0x1f4;return function(_0x276349){logger[_0x1a7f('0x27')](_0x276349[_0x1a7f('0x28')]);if(_0x276349[_0x1a7f('0x29')]){delete _0x276349['name'];}_0x5c67be[_0x1a7f('0x1a')](_0x3b3d9e)[_0x1a7f('0x2a')](_0x276349);};}exports[_0x1a7f('0x2b')]=function(_0xe913f5,_0xc76d03){var _0x1d38bf={},_0x57dc13={},_0x100f58={'count':0x0,'rows':[]};var _0x1129c0=_[_0x1a7f('0x2c')](db[_0x1a7f('0x2d')][_0x1a7f('0x2e')],function(_0x47c6f0){return{'name':_0x47c6f0['fieldName'],'type':_0x47c6f0[_0x1a7f('0x2f')][_0x1a7f('0x30')]};});_0x57dc13['model']=_[_0x1a7f('0x2c')](_0x1129c0,_0x1a7f('0x29'));_0x57dc13['query']=_[_0x1a7f('0x31')](_0xe913f5[_0x1a7f('0x32')]);_0x57dc13[_0x1a7f('0x33')]=_[_0x1a7f('0x34')](_0x57dc13[_0x1a7f('0x35')],_0x57dc13['query']);_0x1d38bf['attributes']=_[_0x1a7f('0x34')](_0x57dc13[_0x1a7f('0x35')],qs[_0x1a7f('0x36')](_0xe913f5[_0x1a7f('0x32')][_0x1a7f('0x36')]));_0x1d38bf[_0x1a7f('0x37')]=_0x1d38bf[_0x1a7f('0x37')][_0x1a7f('0x38')]?_0x1d38bf[_0x1a7f('0x37')]:_0x57dc13['model'];if(!_0xe913f5['query'][_0x1a7f('0x39')](_0x1a7f('0x3a'))){_0x1d38bf[_0x1a7f('0x1f')]=qs['limit'](_0xe913f5[_0x1a7f('0x32')][_0x1a7f('0x1f')]);_0x1d38bf[_0x1a7f('0x1d')]=qs[_0x1a7f('0x1d')](_0xe913f5[_0x1a7f('0x32')][_0x1a7f('0x1d')]);}_0x1d38bf[_0x1a7f('0x3b')]=qs['sort'](_0xe913f5[_0x1a7f('0x32')]['sort']);_0x1d38bf[_0x1a7f('0x3c')]=qs[_0x1a7f('0x33')](_[_0x1a7f('0x3d')](_0xe913f5[_0x1a7f('0x32')],_0x57dc13[_0x1a7f('0x33')]),_0x1129c0);if(_0xe913f5[_0x1a7f('0x32')][_0x1a7f('0x3e')]){_0x1d38bf[_0x1a7f('0x3c')]=_[_0x1a7f('0x3f')](_0x1d38bf[_0x1a7f('0x3c')],{'$or':_[_0x1a7f('0x2c')](_0x1129c0,function(_0xab2334){if(_0xab2334[_0x1a7f('0x2f')]!==_0x1a7f('0x40')){var _0x504678={};_0x504678[_0xab2334[_0x1a7f('0x29')]]={'$like':'%'+_0xe913f5[_0x1a7f('0x32')]['filter']+'%'};return _0x504678;}})});}_0x1d38bf=_[_0x1a7f('0x3f')]({},_0x1d38bf,_0xe913f5[_0x1a7f('0x41')]);var _0x2f5dc9={'where':_0x1d38bf[_0x1a7f('0x3c')]};return db[_0x1a7f('0x2d')][_0x1a7f('0x20')](_0x2f5dc9)[_0x1a7f('0x25')](function(_0xac3441){_0x100f58['count']=_0xac3441;if(_0xe913f5[_0x1a7f('0x32')]['includeAll']){_0x1d38bf['include']=[{'all':!![]}];}return db[_0x1a7f('0x2d')][_0x1a7f('0x42')](_0x1d38bf);})[_0x1a7f('0x25')](function(_0x34f6a8){_0x100f58['rows']=_0x34f6a8;return _0x100f58;})[_0x1a7f('0x25')](respondWithFilteredResult(_0xc76d03,_0x1d38bf))[_0x1a7f('0x43')](handleError(_0xc76d03,null));};exports['show']=function(_0x41e814,_0x354763){var _0x3a7ac7={'raw':!![],'where':{'id':_0x41e814['params']['id']}},_0x58998e={};_0x58998e[_0x1a7f('0x35')]=_[_0x1a7f('0x31')](db[_0x1a7f('0x2d')]['rawAttributes']);_0x58998e[_0x1a7f('0x32')]=_[_0x1a7f('0x31')](_0x41e814[_0x1a7f('0x32')]);_0x58998e[_0x1a7f('0x33')]=_[_0x1a7f('0x34')](_0x58998e[_0x1a7f('0x35')],_0x58998e[_0x1a7f('0x32')]);_0x3a7ac7[_0x1a7f('0x37')]=_['intersection'](_0x58998e['model'],qs[_0x1a7f('0x36')](_0x41e814[_0x1a7f('0x32')][_0x1a7f('0x36')]));_0x3a7ac7['attributes']=_0x3a7ac7['attributes']['length']?_0x3a7ac7['attributes']:_0x58998e['model'];if(_0x41e814[_0x1a7f('0x32')][_0x1a7f('0x44')]){_0x3a7ac7[_0x1a7f('0x45')]=[{'all':!![]}];}_0x3a7ac7=_[_0x1a7f('0x3f')]({},_0x3a7ac7,_0x41e814['options']);return db[_0x1a7f('0x2d')][_0x1a7f('0x46')](_0x3a7ac7)['then'](handleEntityNotFound(_0x354763,null))['then'](respondWithResult(_0x354763,null))['catch'](handleError(_0x354763,null));};exports['create']=function(_0x390b73,_0xd03fd3){return db[_0x1a7f('0x2d')][_0x1a7f('0x47')](_0x390b73[_0x1a7f('0x48')],{})[_0x1a7f('0x25')](respondWithResult(_0xd03fd3,0xc9))[_0x1a7f('0x43')](handleError(_0xd03fd3,null));};exports[_0x1a7f('0x24')]=function(_0x3dbac5,_0x3082c2){if(_0x3dbac5[_0x1a7f('0x48')]['id']){delete _0x3dbac5[_0x1a7f('0x48')]['id'];}return db[_0x1a7f('0x2d')][_0x1a7f('0x46')]({'where':{'id':_0x3dbac5[_0x1a7f('0x49')]['id']}})[_0x1a7f('0x25')](handleEntityNotFound(_0x3082c2,null))['then'](saveUpdates(_0x3dbac5[_0x1a7f('0x48')],null))[_0x1a7f('0x25')](respondWithResult(_0x3082c2,null))[_0x1a7f('0x43')](handleError(_0x3082c2,null));};exports[_0x1a7f('0x26')]=function(_0x38ad4c,_0x360605){return db['AnalyticTreeReport'][_0x1a7f('0x46')]({'where':{'id':_0x38ad4c[_0x1a7f('0x49')]['id']}})['then'](handleEntityNotFound(_0x360605,null))[_0x1a7f('0x25')](removeEntity(_0x360605,null))[_0x1a7f('0x43')](handleError(_0x360605,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 714c779..e40bd14 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 _0xecd8=['request-promise','path','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x5ca784,_0x28bea2){var _0x5aa579=function(_0x531234){while(--_0x531234){_0x5ca784['push'](_0x5ca784['shift']());}};_0x5aa579(++_0x28bea2);}(_0xecd8,0x1db));var _0x8ecd=function(_0x395ad0,_0x1f57c3){_0x395ad0=_0x395ad0-0x0;var _0x3e05f1=_0xecd8[_0x395ad0];return _0x3e05f1;};'use strict';var _=require(_0x8ecd('0x0'));var util=require(_0x8ecd('0x1'));var logger=require(_0x8ecd('0x2'))(_0x8ecd('0x3'));var moment=require(_0x8ecd('0x4'));var BPromise=require('bluebird');var rp=require(_0x8ecd('0x5'));var fs=require('fs');var path=require(_0x8ecd('0x6'));var rimraf=require(_0x8ecd('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ecd('0x8'));module['exports']=function(_0x12bf0b,_0x1190a2){return _0x12bf0b[_0x8ecd('0x9')](_0x8ecd('0xa'),attributes,{'tableName':_0x8ecd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb303=['moment','bluebird','request-promise','path','rimraf','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb303,0x1c5));var _0x3b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb303[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3b30('0x0'));var util=require(_0x3b30('0x1'));var logger=require('../../config/logger')(_0x3b30('0x2'));var moment=require(_0x3b30('0x3'));var BPromise=require(_0x3b30('0x4'));var rp=require(_0x3b30('0x5'));var fs=require('fs');var path=require(_0x3b30('0x6'));var rimraf=require(_0x3b30('0x7'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x3b30('0x8')]=function(_0x2f4f3d,_0x2c6356){return _0x2f4f3d[_0x3b30('0x9')](_0x3b30('0xa'),attributes,{'tableName':_0x3b30('0xb'),'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 7ad050a..2348e8a 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x38cb26,_0x52efe3){var _0x33be08=function(_0x235f44){while(--_0x235f44){_0x38cb26['push'](_0x38cb26['shift']());}};_0x33be08(++_0x52efe3);}(_0xdb28,0x106));var _0x8db2=function(_0xde9b02,_0x5191db){_0xde9b02=_0xde9b02-0x0;var _0x1e2586=_0xdb28[_0xde9b02];return _0x1e2586;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x47bf8b,_0x5c377e){var _0x2d71ff=function(_0x96d3b2){while(--_0x96d3b2){_0x47bf8b['push'](_0x47bf8b['shift']());}};_0x2d71ff(++_0x5c377e);}(_0xadb5,0xad));var _0x5adb=function(_0xdc6777,_0x233900){_0xdc6777=_0xdc6777-0x0;var _0x133f4d=_0xadb5[_0xdc6777];return _0x133f4d;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e36dcb9..30679f8 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 _0x71c3=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete'];(function(_0x1feb01,_0x556ccb){var _0x3e5169=function(_0x47bd7d){while(--_0x47bd7d){_0x1feb01['push'](_0x1feb01['shift']());}};_0x3e5169(++_0x556ccb);}(_0x71c3,0x1dd));var _0x371c=function(_0x403b12,_0x279d4d){_0x403b12=_0x403b12-0x0;var _0x8e0998=_0x71c3[_0x403b12];return _0x8e0998;};'use strict';var multer=require(_0x371c('0x0'));var util=require(_0x371c('0x1'));var path=require('path');var timeout=require(_0x371c('0x2'));var express=require('express');var router=express[_0x371c('0x3')]();var fs_extra=require(_0x371c('0x4'));var auth=require(_0x371c('0x5'));var interaction=require(_0x371c('0x6'));var config=require('../../config/environment');var controller=require(_0x371c('0x7'));router[_0x371c('0x8')]('/',auth['isAuthenticated'](),controller[_0x371c('0x9')]);router[_0x371c('0x8')]('/:id',auth[_0x371c('0xa')](),controller[_0x371c('0xb')]);router[_0x371c('0xc')]('/',auth[_0x371c('0xa')](),controller['create']);router[_0x371c('0xd')](_0x371c('0xe'),auth[_0x371c('0xa')](),controller[_0x371c('0xf')]);router[_0x371c('0x10')]('/:id',auth[_0x371c('0xa')](),controller[_0x371c('0x11')]);module[_0x371c('0x12')]=router; \ No newline at end of file +var _0x8814=['../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53a820,_0x372df3){var _0x31e060=function(_0x175234){while(--_0x175234){_0x53a820['push'](_0x53a820['shift']());}};_0x31e060(++_0x372df3);}(_0x8814,0x1ec));var _0x4881=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x8814[_0x382e89];return _0x3a1318;};'use strict';var multer=require(_0x4881('0x0'));var util=require(_0x4881('0x1'));var path=require(_0x4881('0x2'));var timeout=require(_0x4881('0x3'));var express=require(_0x4881('0x4'));var router=express['Router']();var fs_extra=require(_0x4881('0x5'));var auth=require(_0x4881('0x6'));var interaction=require(_0x4881('0x7'));var config=require(_0x4881('0x8'));var controller=require(_0x4881('0x9'));router['get']('/',auth[_0x4881('0xa')](),controller['index']);router[_0x4881('0xb')](_0x4881('0xc'),auth['isAuthenticated'](),controller[_0x4881('0xd')]);router[_0x4881('0xe')]('/',auth['isAuthenticated'](),controller[_0x4881('0xf')]);router['put'](_0x4881('0xc'),auth[_0x4881('0xa')](),controller[_0x4881('0x10')]);router[_0x4881('0x11')](_0x4881('0xc'),auth['isAuthenticated'](),controller[_0x4881('0x12')]);module[_0x4881('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 44caa5e..fcd6212 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 _0xea89=['exports','STRING','sequelize'];(function(_0x33983f,_0x73a09a){var _0x3d53b0=function(_0x207845){while(--_0x207845){_0x33983f['push'](_0x33983f['shift']());}};_0x3d53b0(++_0x73a09a);}(_0xea89,0x1e2));var _0x9ea8=function(_0x5df5e1,_0x3e0305){_0x5df5e1=_0x5df5e1-0x0;var _0x2fffd3=_0xea89[_0x5df5e1];return _0x2fffd3;};'use strict';var Sequelize=require(_0x9ea8('0x0'));module[_0x9ea8('0x1')]={'name':{'type':Sequelize[_0x9ea8('0x2')]},'basename':{'type':Sequelize[_0x9ea8('0x2')]},'type':{'type':Sequelize[_0x9ea8('0x2')]}}; \ No newline at end of file +var _0x402f=['STRING','sequelize'];(function(_0x15cd2d,_0x3dc95a){var _0x13816c=function(_0x2c7f01){while(--_0x2c7f01){_0x15cd2d['push'](_0x15cd2d['shift']());}};_0x13816c(++_0x3dc95a);}(_0x402f,0x6f));var _0xf402=function(_0x231103,_0x1f1970){_0x231103=_0x231103-0x0;var _0x8cf36b=_0x402f[_0x231103];return _0x8cf36b;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'name':{'type':Sequelize[_0xf402('0x1')]},'basename':{'type':Sequelize['STRING']},'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 6dcd37f..a2b47cf 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 _0xc756=['create','file','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','params','Attachment','include','find','catch','get','body','omit','createdAt','updatedAt'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xc756,0xbe));var _0x6c75=function(_0x531968,_0x4f2457){_0x531968=_0x531968-0x0;var _0x5789b9=_0xc756[_0x531968];return _0x5789b9;};'use strict';var emlformat=require(_0x6c75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c75('0x1'));var jsonpatch=require(_0x6c75('0x2'));var rp=require('request-promise');var moment=require(_0x6c75('0x3'));var BPromise=require(_0x6c75('0x4'));var Mustache=require(_0x6c75('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6c75('0x6'));var csv=require(_0x6c75('0x7'));var ejs=require(_0x6c75('0x8'));var fs=require('fs');var fs_extra=require(_0x6c75('0x9'));var _=require(_0x6c75('0xa'));var squel=require(_0x6c75('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c75('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6c75('0x7'));var querystring=require('querystring');var Papa=require(_0x6c75('0xd'));var Redis=require(_0x6c75('0xe'));var authService=require(_0x6c75('0xf'));var qs=require(_0x6c75('0x10'));var as=require(_0x6c75('0x11'));var hardwareService=require(_0x6c75('0x12'));var logger=require(_0x6c75('0x13'))(_0x6c75('0x14'));var utils=require(_0x6c75('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6c75('0x16'));var db=require(_0x6c75('0x17'))['db'];function respondWithStatusCode(_0x59d01e,_0x42e126){_0x42e126=_0x42e126||0xcc;return function(_0x50709a){if(_0x50709a){return _0x59d01e[_0x6c75('0x18')](_0x42e126);}return _0x59d01e['status'](_0x42e126)[_0x6c75('0x19')]();};}function respondWithResult(_0x5f4f3e,_0x4a3081){_0x4a3081=_0x4a3081||0xc8;return function(_0x3bed87){if(_0x3bed87){return _0x5f4f3e[_0x6c75('0x1a')](_0x4a3081)[_0x6c75('0x1b')](_0x3bed87);}};}function respondWithFilteredResult(_0x17b5d8,_0x31708f){return function(_0x5d6a5e){if(_0x5d6a5e){var _0x2894e7=typeof _0x31708f[_0x6c75('0x1c')]===_0x6c75('0x1d')&&typeof _0x31708f[_0x6c75('0x1e')]===_0x6c75('0x1d');var _0x51b4c2=_0x5d6a5e[_0x6c75('0x1f')];var _0x42b87d=_0x2894e7?0x0:_0x31708f[_0x6c75('0x1c')];var _0x1b5eae=_0x2894e7?_0x5d6a5e[_0x6c75('0x1f')]:_0x31708f[_0x6c75('0x1c')]+_0x31708f['limit'];var _0x2c8e0b;if(_0x1b5eae>=_0x51b4c2){_0x1b5eae=_0x51b4c2;_0x2c8e0b=0xc8;}else{_0x2c8e0b=0xce;}_0x17b5d8[_0x6c75('0x1a')](_0x2c8e0b);return _0x17b5d8[_0x6c75('0x20')](_0x6c75('0x21'),_0x42b87d+'-'+_0x1b5eae+'/'+_0x51b4c2)[_0x6c75('0x1b')](_0x5d6a5e);}return null;};}function patchUpdates(_0x8d9673){return function(_0x258cbc){try{jsonpatch[_0x6c75('0x22')](_0x258cbc,_0x8d9673,!![]);}catch(_0x3c1fca){return BPromise[_0x6c75('0x23')](_0x3c1fca);}return _0x258cbc[_0x6c75('0x24')]();};}function saveUpdates(_0x9ed5a9,_0x1e9b50){return function(_0xb002df){if(_0xb002df){return _0xb002df[_0x6c75('0x25')](_0x9ed5a9)[_0x6c75('0x26')](function(_0x555075){return _0x555075;});}return null;};}function removeEntity(_0x51a3ca,_0x508a6c){return function(_0x5b1289){if(_0x5b1289){return _0x5b1289[_0x6c75('0x27')]()[_0x6c75('0x26')](function(){_0x51a3ca[_0x6c75('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2aee8,_0x3a9b8b){return function(_0x2dcae1){if(!_0x2dcae1){_0xa2aee8[_0x6c75('0x18')](0x194);}return _0x2dcae1;};}function handleError(_0xe1f6bf,_0x291b45){_0x291b45=_0x291b45||0x1f4;return function(_0x5ee089){logger[_0x6c75('0x28')](_0x5ee089[_0x6c75('0x29')]);if(_0x5ee089['name']){delete _0x5ee089[_0x6c75('0x2a')];}_0xe1f6bf[_0x6c75('0x1a')](_0x291b45)[_0x6c75('0x2b')](_0x5ee089);};}exports['index']=function(_0x8c1a8e,_0x3b051d){var _0x2fb0db={},_0x391f0d={},_0x40fb69={'count':0x0,'rows':[]};var _0x511541=_[_0x6c75('0x2c')](db['Attachment'][_0x6c75('0x2d')],function(_0x1de97c){return{'name':_0x1de97c['fieldName'],'type':_0x1de97c['type']['key']};});_0x391f0d[_0x6c75('0x2e')]=_[_0x6c75('0x2c')](_0x511541,_0x6c75('0x2a'));_0x391f0d[_0x6c75('0x2f')]=_[_0x6c75('0x30')](_0x8c1a8e[_0x6c75('0x2f')]);_0x391f0d[_0x6c75('0x31')]=_[_0x6c75('0x32')](_0x391f0d[_0x6c75('0x2e')],_0x391f0d[_0x6c75('0x2f')]);_0x2fb0db[_0x6c75('0x33')]=_['intersection'](_0x391f0d['model'],qs[_0x6c75('0x34')](_0x8c1a8e[_0x6c75('0x2f')][_0x6c75('0x34')]));_0x2fb0db[_0x6c75('0x33')]=_0x2fb0db[_0x6c75('0x33')][_0x6c75('0x35')]?_0x2fb0db[_0x6c75('0x33')]:_0x391f0d['model'];if(!_0x8c1a8e[_0x6c75('0x2f')][_0x6c75('0x36')](_0x6c75('0x37'))){_0x2fb0db[_0x6c75('0x1e')]=qs[_0x6c75('0x1e')](_0x8c1a8e[_0x6c75('0x2f')]['limit']);_0x2fb0db[_0x6c75('0x1c')]=qs[_0x6c75('0x1c')](_0x8c1a8e[_0x6c75('0x2f')][_0x6c75('0x1c')]);}_0x2fb0db[_0x6c75('0x38')]=qs['sort'](_0x8c1a8e['query'][_0x6c75('0x39')]);_0x2fb0db[_0x6c75('0x3a')]=qs['filters'](_[_0x6c75('0x3b')](_0x8c1a8e[_0x6c75('0x2f')],_0x391f0d[_0x6c75('0x31')]),_0x511541);if(_0x8c1a8e[_0x6c75('0x2f')]['filter']){_0x2fb0db[_0x6c75('0x3a')]=_[_0x6c75('0x3c')](_0x2fb0db[_0x6c75('0x3a')],{'$or':_['map'](_0x511541,function(_0x528801){if(_0x528801[_0x6c75('0x3d')]!==_0x6c75('0x3e')){var _0x4a3f09={};_0x4a3f09[_0x528801[_0x6c75('0x2a')]]={'$like':'%'+_0x8c1a8e[_0x6c75('0x2f')][_0x6c75('0x3f')]+'%'};return _0x4a3f09;}})});}_0x2fb0db=_[_0x6c75('0x3c')]({},_0x2fb0db,_0x8c1a8e[_0x6c75('0x40')]);var _0x2361ab={'where':_0x2fb0db[_0x6c75('0x3a')]};return db['Attachment'][_0x6c75('0x1f')](_0x2361ab)[_0x6c75('0x26')](function(_0x2a2f67){_0x40fb69[_0x6c75('0x1f')]=_0x2a2f67;if(_0x8c1a8e[_0x6c75('0x2f')][_0x6c75('0x41')]){_0x2fb0db['include']=[{'all':!![]}];}return db['Attachment']['findAll'](_0x2fb0db);})['then'](function(_0x20865f){_0x40fb69[_0x6c75('0x42')]=_0x20865f;return _0x40fb69;})[_0x6c75('0x26')](respondWithFilteredResult(_0x3b051d,_0x2fb0db))['catch'](handleError(_0x3b051d,null));};exports['show']=function(_0x8f525c,_0x55f2a1){var _0x248122={'raw':!![],'where':{'id':_0x8f525c[_0x6c75('0x43')]['id']}},_0x2d8859={};_0x2d8859[_0x6c75('0x2e')]=_['keys'](db[_0x6c75('0x44')]['rawAttributes']);_0x2d8859[_0x6c75('0x2f')]=_[_0x6c75('0x30')](_0x8f525c[_0x6c75('0x2f')]);_0x2d8859[_0x6c75('0x31')]=_['intersection'](_0x2d8859['model'],_0x2d8859[_0x6c75('0x2f')]);_0x248122[_0x6c75('0x33')]=_[_0x6c75('0x32')](_0x2d8859['model'],qs[_0x6c75('0x34')](_0x8f525c[_0x6c75('0x2f')][_0x6c75('0x34')]));_0x248122[_0x6c75('0x33')]=_0x248122['attributes'][_0x6c75('0x35')]?_0x248122[_0x6c75('0x33')]:_0x2d8859['model'];if(_0x8f525c['query'][_0x6c75('0x41')]){_0x248122[_0x6c75('0x45')]=[{'all':!![]}];}_0x248122=_[_0x6c75('0x3c')]({},_0x248122,_0x8f525c[_0x6c75('0x40')]);return db[_0x6c75('0x44')][_0x6c75('0x46')](_0x248122)[_0x6c75('0x26')](handleEntityNotFound(_0x55f2a1,null))['then'](respondWithResult(_0x55f2a1,null))[_0x6c75('0x47')](handleError(_0x55f2a1,null));};exports['clone']=function(_0x33d278,_0x179096){var _0x3fba69={'where':{'id':_0x33d278['params']['id']}},_0x1a034f={};_0x1a034f['model']=_['keys'](db['Attachment'][_0x6c75('0x2d')]);_0x3fba69[_0x6c75('0x33')]=_[_0x6c75('0x32')](_0x1a034f[_0x6c75('0x2e')],qs[_0x6c75('0x34')](_0x33d278[_0x6c75('0x2f')][_0x6c75('0x34')]));_0x3fba69[_0x6c75('0x33')]=_0x3fba69[_0x6c75('0x33')][_0x6c75('0x35')]?_0x3fba69['attributes']:_0x1a034f[_0x6c75('0x2e')];if(_0x33d278[_0x6c75('0x2f')][_0x6c75('0x41')]){_0x3fba69['include']=[{'all':!![]}];}_0x3fba69=_['merge']({},_0x3fba69,_0x33d278[_0x6c75('0x40')]);return db[_0x6c75('0x44')][_0x6c75('0x46')](_0x3fba69)[_0x6c75('0x26')](handleEntityNotFound(_0x179096,null))[_0x6c75('0x26')](function(_0x12a797){if(_0x12a797){var _0x4383e5=_0x12a797[_0x6c75('0x48')]({'plain':!![]});_0x4383e5=qs['omit'](_0x4383e5,['id','createdAt','updatedAt']);_0x33d278[_0x6c75('0x49')]=_[_0x6c75('0x4a')](_0x33d278[_0x6c75('0x49')],['id',_0x6c75('0x4b'),_0x6c75('0x4c')]);return db['Attachment'][_0x6c75('0x4d')](_[_0x6c75('0x3c')](_0x4383e5,_0x33d278[_0x6c75('0x49')]),{'include':_0x33d278[_0x6c75('0x2f')][_0x6c75('0x41')]?[{'all':!![]}]:undefined});}})[_0x6c75('0x26')](respondWithResult(_0x179096,0xc9))[_0x6c75('0x47')](handleError(_0x179096,null));};exports[_0x6c75('0x25')]=function(_0x35a2e6,_0x4cbf5c){if(_0x35a2e6[_0x6c75('0x49')]['id']){delete _0x35a2e6[_0x6c75('0x49')]['id'];}return db['Attachment'][_0x6c75('0x46')]({'where':{'id':_0x35a2e6[_0x6c75('0x43')]['id']}})[_0x6c75('0x26')](handleEntityNotFound(_0x4cbf5c,null))[_0x6c75('0x26')](saveUpdates(_0x35a2e6[_0x6c75('0x49')],null))['then'](respondWithResult(_0x4cbf5c,null))['catch'](handleError(_0x4cbf5c,null));};exports['destroy']=function(_0x17d853,_0x30b49a){return db[_0x6c75('0x44')][_0x6c75('0x46')]({'where':{'id':_0x17d853[_0x6c75('0x43')]['id']}})[_0x6c75('0x26')](handleEntityNotFound(_0x30b49a,null))['then'](removeEntity(_0x30b49a,null))[_0x6c75('0x47')](handleError(_0x30b49a,null));};exports[_0x6c75('0x4d')]=function(_0x1943c9,_0x699edf,_0x4fb2df){_0x1943c9[_0x6c75('0x49')]['name']=_0x1943c9[_0x6c75('0x4e')]['originalname'];_0x1943c9[_0x6c75('0x49')][_0x6c75('0x4f')]=_0x1943c9[_0x6c75('0x4e')][_0x6c75('0x50')];_0x1943c9[_0x6c75('0x49')][_0x6c75('0x3d')]=_0x1943c9[_0x6c75('0x4e')][_0x6c75('0x51')];return db[_0x6c75('0x44')][_0x6c75('0x4d')](_0x1943c9[_0x6c75('0x49')])[_0x6c75('0x26')](respondWithResult(_0x699edf,0xc9))[_0x6c75('0x47')](handleError(_0x699edf,null));};exports[_0x6c75('0x52')]=function(_0x51ce40,_0x121f7b,_0x3bc88e){return db[_0x6c75('0x44')][_0x6c75('0x53')]({'where':{'id':_0x51ce40[_0x6c75('0x43')]['id']},'raw':!![]})[_0x6c75('0x26')](handleEntityNotFound(_0x121f7b,null))[_0x6c75('0x26')](function(_0x5a12cf){if(_0x5a12cf){var _0x1ec334=_0x5a12cf[_0x6c75('0x54')]!==null;var _0x19785f=path['join'](config[_0x6c75('0x55')],_0x6c75('0x56'));if(_0x1ec334){_0x19785f=path[_0x6c75('0x57')](_0x19785f,_0x6c75('0x58'));}var _0x1c0326=path[_0x6c75('0x57')](_0x19785f,_0x5a12cf[_0x6c75('0x4f')]);return _0x121f7b[_0x6c75('0x52')](_0x1c0326);}})[_0x6c75('0x47')](handleError(_0x121f7b,null));}; \ No newline at end of file +var _0x7831=['model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','clone','get','omit','createdAt','updatedAt','body','create','file','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','end','error','name','send','index','Attachment','rawAttributes','fieldName','type','key','map','query','filters','intersection'];(function(_0x444c38,_0x3de330){var _0x37c629=function(_0x1d8b17){while(--_0x1d8b17){_0x444c38['push'](_0x444c38['shift']());}};_0x37c629(++_0x3de330);}(_0x7831,0xdc));var _0x1783=function(_0x4f6e2e,_0xf29874){_0x4f6e2e=_0x4f6e2e-0x0;var _0x8be0a7=_0x7831[_0x4f6e2e];return _0x8be0a7;};'use strict';var emlformat=require(_0x1783('0x0'));var rimraf=require(_0x1783('0x1'));var zipdir=require(_0x1783('0x2'));var jsonpatch=require(_0x1783('0x3'));var rp=require('request-promise');var moment=require(_0x1783('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1783('0x5'));var util=require(_0x1783('0x6'));var path=require(_0x1783('0x7'));var sox=require(_0x1783('0x8'));var csv=require(_0x1783('0x9'));var ejs=require(_0x1783('0xa'));var fs=require('fs');var fs_extra=require(_0x1783('0xb'));var _=require(_0x1783('0xc'));var squel=require(_0x1783('0xd'));var crypto=require('crypto');var jsforce=require(_0x1783('0xe'));var deskjs=require(_0x1783('0xf'));var toCsv=require(_0x1783('0x9'));var querystring=require(_0x1783('0x10'));var Papa=require(_0x1783('0x11'));var Redis=require(_0x1783('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1783('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1783('0x14'));var logger=require('../../config/logger')(_0x1783('0x15'));var utils=require(_0x1783('0x16'));var config=require(_0x1783('0x17'));var licenseUtil=require(_0x1783('0x18'));var db=require(_0x1783('0x19'))['db'];function respondWithStatusCode(_0x4245d1,_0x202d78){_0x202d78=_0x202d78||0xcc;return function(_0x3004ba){if(_0x3004ba){return _0x4245d1[_0x1783('0x1a')](_0x202d78);}return _0x4245d1['status'](_0x202d78)['end']();};}function respondWithResult(_0x4a9319,_0x2bbaa7){_0x2bbaa7=_0x2bbaa7||0xc8;return function(_0x21244d){if(_0x21244d){return _0x4a9319['status'](_0x2bbaa7)[_0x1783('0x1b')](_0x21244d);}};}function respondWithFilteredResult(_0xe5e78,_0x259b90){return function(_0x49a127){if(_0x49a127){var _0x1ce21d=typeof _0x259b90[_0x1783('0x1c')]===_0x1783('0x1d')&&typeof _0x259b90[_0x1783('0x1e')]===_0x1783('0x1d');var _0x5fb3be=_0x49a127[_0x1783('0x1f')];var _0x1ba50b=_0x1ce21d?0x0:_0x259b90[_0x1783('0x1c')];var _0x552e76=_0x1ce21d?_0x49a127[_0x1783('0x1f')]:_0x259b90[_0x1783('0x1c')]+_0x259b90['limit'];var _0x4ff8ec;if(_0x552e76>=_0x5fb3be){_0x552e76=_0x5fb3be;_0x4ff8ec=0xc8;}else{_0x4ff8ec=0xce;}_0xe5e78[_0x1783('0x20')](_0x4ff8ec);return _0xe5e78[_0x1783('0x21')](_0x1783('0x22'),_0x1ba50b+'-'+_0x552e76+'/'+_0x5fb3be)['json'](_0x49a127);}return null;};}function patchUpdates(_0x5c2493){return function(_0x3f27aa){try{jsonpatch['apply'](_0x3f27aa,_0x5c2493,!![]);}catch(_0x5cec9d){return BPromise[_0x1783('0x23')](_0x5cec9d);}return _0x3f27aa['save']();};}function saveUpdates(_0xd22f42,_0x4850f5){return function(_0xc4904c){if(_0xc4904c){return _0xc4904c[_0x1783('0x24')](_0xd22f42)[_0x1783('0x25')](function(_0x41e3e7){return _0x41e3e7;});}return null;};}function removeEntity(_0x38b9d3,_0x244ad0){return function(_0x49015a){if(_0x49015a){return _0x49015a[_0x1783('0x26')]()[_0x1783('0x25')](function(){_0x38b9d3[_0x1783('0x20')](0xcc)[_0x1783('0x27')]();});}};}function handleEntityNotFound(_0x547c5e,_0x335b70){return function(_0x29a6fe){if(!_0x29a6fe){_0x547c5e['sendStatus'](0x194);}return _0x29a6fe;};}function handleError(_0x4e05a6,_0x4ede4a){_0x4ede4a=_0x4ede4a||0x1f4;return function(_0x381eb2){logger[_0x1783('0x28')](_0x381eb2['stack']);if(_0x381eb2[_0x1783('0x29')]){delete _0x381eb2['name'];}_0x4e05a6[_0x1783('0x20')](_0x4ede4a)[_0x1783('0x2a')](_0x381eb2);};}exports[_0x1783('0x2b')]=function(_0x114e34,_0x936a2e){var _0x1df44f={},_0x6b143f={},_0x45ecfe={'count':0x0,'rows':[]};var _0x440a62=_['map'](db[_0x1783('0x2c')][_0x1783('0x2d')],function(_0x293994){return{'name':_0x293994[_0x1783('0x2e')],'type':_0x293994[_0x1783('0x2f')][_0x1783('0x30')]};});_0x6b143f['model']=_[_0x1783('0x31')](_0x440a62,_0x1783('0x29'));_0x6b143f['query']=_['keys'](_0x114e34[_0x1783('0x32')]);_0x6b143f[_0x1783('0x33')]=_[_0x1783('0x34')](_0x6b143f['model'],_0x6b143f[_0x1783('0x32')]);_0x1df44f['attributes']=_[_0x1783('0x34')](_0x6b143f[_0x1783('0x35')],qs[_0x1783('0x36')](_0x114e34[_0x1783('0x32')][_0x1783('0x36')]));_0x1df44f['attributes']=_0x1df44f[_0x1783('0x37')][_0x1783('0x38')]?_0x1df44f['attributes']:_0x6b143f[_0x1783('0x35')];if(!_0x114e34[_0x1783('0x32')][_0x1783('0x39')]('nolimit')){_0x1df44f[_0x1783('0x1e')]=qs[_0x1783('0x1e')](_0x114e34[_0x1783('0x32')][_0x1783('0x1e')]);_0x1df44f[_0x1783('0x1c')]=qs['offset'](_0x114e34['query']['offset']);}_0x1df44f[_0x1783('0x3a')]=qs[_0x1783('0x3b')](_0x114e34[_0x1783('0x32')][_0x1783('0x3b')]);_0x1df44f[_0x1783('0x3c')]=qs[_0x1783('0x33')](_[_0x1783('0x3d')](_0x114e34[_0x1783('0x32')],_0x6b143f[_0x1783('0x33')]),_0x440a62);if(_0x114e34['query'][_0x1783('0x3e')]){_0x1df44f[_0x1783('0x3c')]=_[_0x1783('0x3f')](_0x1df44f[_0x1783('0x3c')],{'$or':_[_0x1783('0x31')](_0x440a62,function(_0x2abf40){if(_0x2abf40[_0x1783('0x2f')]!==_0x1783('0x40')){var _0x5884ef={};_0x5884ef[_0x2abf40['name']]={'$like':'%'+_0x114e34['query'][_0x1783('0x3e')]+'%'};return _0x5884ef;}})});}_0x1df44f=_[_0x1783('0x3f')]({},_0x1df44f,_0x114e34[_0x1783('0x41')]);var _0x207c60={'where':_0x1df44f[_0x1783('0x3c')]};return db[_0x1783('0x2c')]['count'](_0x207c60)[_0x1783('0x25')](function(_0x3e22d7){_0x45ecfe[_0x1783('0x1f')]=_0x3e22d7;if(_0x114e34[_0x1783('0x32')][_0x1783('0x42')]){_0x1df44f[_0x1783('0x43')]=[{'all':!![]}];}return db[_0x1783('0x2c')][_0x1783('0x44')](_0x1df44f);})[_0x1783('0x25')](function(_0x21c926){_0x45ecfe[_0x1783('0x45')]=_0x21c926;return _0x45ecfe;})['then'](respondWithFilteredResult(_0x936a2e,_0x1df44f))[_0x1783('0x46')](handleError(_0x936a2e,null));};exports['show']=function(_0x15a02b,_0x1a677a){var _0x3f5b48={'raw':!![],'where':{'id':_0x15a02b[_0x1783('0x47')]['id']}},_0x2fb7c5={};_0x2fb7c5[_0x1783('0x35')]=_['keys'](db[_0x1783('0x2c')][_0x1783('0x2d')]);_0x2fb7c5[_0x1783('0x32')]=_[_0x1783('0x48')](_0x15a02b[_0x1783('0x32')]);_0x2fb7c5['filters']=_[_0x1783('0x34')](_0x2fb7c5[_0x1783('0x35')],_0x2fb7c5['query']);_0x3f5b48[_0x1783('0x37')]=_[_0x1783('0x34')](_0x2fb7c5[_0x1783('0x35')],qs[_0x1783('0x36')](_0x15a02b[_0x1783('0x32')]['fields']));_0x3f5b48['attributes']=_0x3f5b48['attributes'][_0x1783('0x38')]?_0x3f5b48[_0x1783('0x37')]:_0x2fb7c5[_0x1783('0x35')];if(_0x15a02b[_0x1783('0x32')]['includeAll']){_0x3f5b48['include']=[{'all':!![]}];}_0x3f5b48=_['merge']({},_0x3f5b48,_0x15a02b[_0x1783('0x41')]);return db[_0x1783('0x2c')][_0x1783('0x49')](_0x3f5b48)['then'](handleEntityNotFound(_0x1a677a,null))['then'](respondWithResult(_0x1a677a,null))['catch'](handleError(_0x1a677a,null));};exports[_0x1783('0x4a')]=function(_0x7d7557,_0x5235ff){var _0x56cf7d={'where':{'id':_0x7d7557['params']['id']}},_0x28273d={};_0x28273d[_0x1783('0x35')]=_['keys'](db[_0x1783('0x2c')][_0x1783('0x2d')]);_0x56cf7d[_0x1783('0x37')]=_[_0x1783('0x34')](_0x28273d[_0x1783('0x35')],qs[_0x1783('0x36')](_0x7d7557[_0x1783('0x32')][_0x1783('0x36')]));_0x56cf7d[_0x1783('0x37')]=_0x56cf7d[_0x1783('0x37')]['length']?_0x56cf7d[_0x1783('0x37')]:_0x28273d[_0x1783('0x35')];if(_0x7d7557[_0x1783('0x32')][_0x1783('0x42')]){_0x56cf7d[_0x1783('0x43')]=[{'all':!![]}];}_0x56cf7d=_[_0x1783('0x3f')]({},_0x56cf7d,_0x7d7557[_0x1783('0x41')]);return db['Attachment'][_0x1783('0x49')](_0x56cf7d)[_0x1783('0x25')](handleEntityNotFound(_0x5235ff,null))[_0x1783('0x25')](function(_0x391289){if(_0x391289){var _0x51d6de=_0x391289[_0x1783('0x4b')]({'plain':!![]});_0x51d6de=qs[_0x1783('0x4c')](_0x51d6de,['id',_0x1783('0x4d'),_0x1783('0x4e')]);_0x7d7557[_0x1783('0x4f')]=_[_0x1783('0x4c')](_0x7d7557[_0x1783('0x4f')],['id',_0x1783('0x4d'),_0x1783('0x4e')]);return db['Attachment'][_0x1783('0x50')](_[_0x1783('0x3f')](_0x51d6de,_0x7d7557['body']),{'include':_0x7d7557['query'][_0x1783('0x42')]?[{'all':!![]}]:undefined});}})[_0x1783('0x25')](respondWithResult(_0x5235ff,0xc9))[_0x1783('0x46')](handleError(_0x5235ff,null));};exports[_0x1783('0x24')]=function(_0x58d6e2,_0x318335){if(_0x58d6e2[_0x1783('0x4f')]['id']){delete _0x58d6e2[_0x1783('0x4f')]['id'];}return db['Attachment'][_0x1783('0x49')]({'where':{'id':_0x58d6e2['params']['id']}})[_0x1783('0x25')](handleEntityNotFound(_0x318335,null))[_0x1783('0x25')](saveUpdates(_0x58d6e2[_0x1783('0x4f')],null))['then'](respondWithResult(_0x318335,null))[_0x1783('0x46')](handleError(_0x318335,null));};exports[_0x1783('0x26')]=function(_0x4598ba,_0x6207c5){return db[_0x1783('0x2c')][_0x1783('0x49')]({'where':{'id':_0x4598ba['params']['id']}})[_0x1783('0x25')](handleEntityNotFound(_0x6207c5,null))[_0x1783('0x25')](removeEntity(_0x6207c5,null))[_0x1783('0x46')](handleError(_0x6207c5,null));};exports['create']=function(_0x39fb6d,_0xffb0dc,_0x1ad4a4){_0x39fb6d[_0x1783('0x4f')][_0x1783('0x29')]=_0x39fb6d[_0x1783('0x51')]['originalname'];_0x39fb6d[_0x1783('0x4f')][_0x1783('0x52')]=_0x39fb6d[_0x1783('0x51')][_0x1783('0x53')];_0x39fb6d[_0x1783('0x4f')]['type']=_0x39fb6d['file'][_0x1783('0x54')];return db[_0x1783('0x2c')]['create'](_0x39fb6d['body'])[_0x1783('0x25')](respondWithResult(_0xffb0dc,0xc9))[_0x1783('0x46')](handleError(_0xffb0dc,null));};exports[_0x1783('0x55')]=function(_0x5a9015,_0x2c05a3,_0x2f8e01){return db[_0x1783('0x2c')]['findOne']({'where':{'id':_0x5a9015[_0x1783('0x47')]['id']},'raw':!![]})[_0x1783('0x25')](handleEntityNotFound(_0x2c05a3,null))['then'](function(_0x299fd1){if(_0x299fd1){var _0xef3b22=_0x299fd1[_0x1783('0x56')]!==null;var _0x49fd3d=path[_0x1783('0x57')](config[_0x1783('0x58')],_0x1783('0x59'));if(_0xef3b22){_0x49fd3d=path[_0x1783('0x57')](_0x49fd3d,_0x1783('0x5a'));}var _0x16f47a=path[_0x1783('0x57')](_0x49fd3d,_0x299fd1[_0x1783('0x52')]);return _0x2c05a3['download'](_0x16f47a);}})['catch'](handleError(_0x2c05a3,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1a1425a..8e0e0be 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 _0x5868=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments'];(function(_0x2a217b,_0xb039df){var _0x29a6ac=function(_0x36071f){while(--_0x36071f){_0x2a217b['push'](_0x2a217b['shift']());}};_0x29a6ac(++_0xb039df);}(_0x5868,0x1e4));var _0x8586=function(_0x2b2a02,_0x42eb6e){_0x2b2a02=_0x2b2a02-0x0;var _0x2418d7=_0x5868[_0x2b2a02];return _0x2418d7;};'use strict';var _=require(_0x8586('0x0'));var util=require('util');var logger=require(_0x8586('0x1'))('api');var moment=require(_0x8586('0x2'));var BPromise=require('bluebird');var rp=require(_0x8586('0x3'));var fs=require('fs');var path=require(_0x8586('0x4'));var rimraf=require(_0x8586('0x5'));var config=require(_0x8586('0x6'));var attributes=require(_0x8586('0x7'));module[_0x8586('0x8')]=function(_0x330aa0,_0x42a316){return _0x330aa0[_0x8586('0x9')]('Attachment',attributes,{'tableName':_0x8586('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x498e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','Attachment','attachments'];(function(_0x59a784,_0x21447d){var _0x3e3eee=function(_0x3ef20a){while(--_0x3ef20a){_0x59a784['push'](_0x59a784['shift']());}};_0x3e3eee(++_0x21447d);}(_0x498e,0xe7));var _0xe498=function(_0x2865a4,_0x36d05a){_0x2865a4=_0x2865a4-0x0;var _0x3b2973=_0x498e[_0x2865a4];return _0x3b2973;};'use strict';var _=require(_0xe498('0x0'));var util=require(_0xe498('0x1'));var logger=require(_0xe498('0x2'))('api');var moment=require(_0xe498('0x3'));var BPromise=require(_0xe498('0x4'));var rp=require(_0xe498('0x5'));var fs=require('fs');var path=require(_0xe498('0x6'));var rimraf=require('rimraf');var config=require(_0xe498('0x7'));var attributes=require(_0xe498('0x8'));module['exports']=function(_0x24e074,_0x373802){return _0x24e074['define'](_0xe498('0x9'),attributes,{'tableName':_0xe498('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 18962c8..ff8add0 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 _0xf403=['client','http','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Attachment,\x20%s,\x20%s','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ff2a9,_0x3f3884){var _0xeb6853=function(_0x3a69de){while(--_0x3a69de){_0x1ff2a9['push'](_0x1ff2a9['shift']());}};_0xeb6853(++_0x3f3884);}(_0xf403,0x1d3));var _0x3f40=function(_0x3e9c14,_0x22a93e){_0x3e9c14=_0x3e9c14-0x0;var _0x296299=_0xf403[_0x3e9c14];return _0x296299;};'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')]('Attachment,\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')]('Attachment,\x20%s,\x20%s',_0x1f21fa,_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);return _0x1dffe8(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}else{logger[_0x3f40('0xc')]('Attachment,\x20%s,\x20%s',_0x1f21fa,_0x3f40('0xf'));_0x1dffe8(_0xb4a314[_0x3f40('0x14')]['message']);}})['catch'](function(_0x54f596){logger[_0x3f40('0x10')](_0x3f40('0x12'),_0x1f21fa,_0x54f596);_0x4c1694(_0x54f596);});});}exports[_0x3f40('0x15')]=function(_0x131e55){var _0x374644=this;return new Promise(function(_0x5b4ebc,_0x2639ef){return db[_0x3f40('0x16')][_0x3f40('0x17')](_0x131e55[_0x3f40('0x18')],{'raw':_0x131e55[_0x3f40('0x19')]?_0x131e55['options'][_0x3f40('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x12aabf){logger[_0x3f40('0xc')](_0x3f40('0x15'),_0x131e55);logger[_0x3f40('0xd')](_0x3f40('0x15'),_0x131e55,JSON['stringify'](_0x12aabf));_0x5b4ebc(_0x12aabf);})[_0x3f40('0x1b')](function(_0x379b4e){logger[_0x3f40('0x10')](_0x3f40('0x15'),_0x379b4e[_0x3f40('0x13')],_0x131e55);_0x2639ef(_0x374644[_0x3f40('0x10')](0x1f4,_0x379b4e['message']));});});}; \ No newline at end of file +var _0x2504=['catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','Attachment,\x20%s,\x20%s','message','result'];(function(_0x347e0,_0x2c734d){var _0x12cb1b=function(_0x56b95c){while(--_0x56b95c){_0x347e0['push'](_0x347e0['shift']());}};_0x12cb1b(++_0x2c734d);}(_0x2504,0xee));var _0x4250=function(_0x7c4fd,_0x5c2e1f){_0x7c4fd=_0x7c4fd-0x0;var _0x13ed8c=_0x2504[_0x7c4fd];return _0x13ed8c;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e177e,_0x5a5286,_0x370998){return new BPromise(function(_0x477312,_0x1a3b57){return client[_0x4250('0xd')](_0x4e177e,_0x370998)[_0x4250('0xe')](function(_0x51ea6f){logger[_0x4250('0xf')]('Attachment,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'));logger[_0x4250('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'),JSON['stringify'](_0x51ea6f));if(_0x51ea6f['error']){if(_0x51ea6f[_0x4250('0x12')][_0x4250('0x13')]===0x1f4){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')]['message']);return _0x1a3b57(_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);}logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);return _0x477312(_0x51ea6f['error'][_0x4250('0x15')]);}else{logger[_0x4250('0xf')](_0x4250('0x14'),_0x5a5286,_0x4250('0x10'));_0x477312(_0x51ea6f[_0x4250('0x16')][_0x4250('0x15')]);}})[_0x4250('0x17')](function(_0x4e70fc){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x4e70fc);_0x1a3b57(_0x4e70fc);});});}exports[_0x4250('0x18')]=function(_0x17a8a9){var _0x369010=this;return new Promise(function(_0x30e48c,_0x14d590){return db['Attachment'][_0x4250('0x19')](_0x17a8a9['body'],{'raw':_0x17a8a9['options']?_0x17a8a9[_0x4250('0x1a')][_0x4250('0x1b')]===undefined?!![]:![]:!![]})[_0x4250('0xe')](function(_0x42c331){logger[_0x4250('0xf')](_0x4250('0x18'),_0x17a8a9);logger[_0x4250('0x11')](_0x4250('0x18'),_0x17a8a9,JSON[_0x4250('0x1c')](_0x42c331));_0x30e48c(_0x42c331);})[_0x4250('0x17')](function(_0x728862){logger[_0x4250('0x12')]('CreateAttachment',_0x728862[_0x4250('0x15')],_0x17a8a9);_0x14d590(_0x369010[_0x4250('0x12')](0x1f4,_0x728862[_0x4250('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 593f5b7..f7d9b6d 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0x0b0e[_0x75267d];return _0x21ccec;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 20c0029..6427bdc 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 _0xd761=['message','ad-login','role','signToken','json','User','passport-local','Strategy','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','name','password','disabled','blocked','online','admin','user','then','blockedAt','minutes','clearBlockUser','getLicense','send'];(function(_0x46d720,_0x5d1597){var _0x195ad7=function(_0x31f929){while(--_0x31f929){_0x46d720['push'](_0x46d720['shift']());}};_0x195ad7(++_0x5d1597);}(_0xd761,0x1ea));var _0x1d76=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0xd761[_0x24cc72];return _0xd49f1e;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x1d76('0x0'))[_0x1d76('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x1d76('0x2'));var BPromise=require('bluebird');var util=require(_0x1d76('0x3'));var db=require(_0x1d76('0x4'))['db'];var authService=require(_0x1d76('0x5'));var utils=require(_0x1d76('0x6'));var config=require(_0x1d76('0x7'));var logger=require(_0x1d76('0x8'))(_0x1d76('0x9'));function isActiveDirectoryConfigured(_0x40255b){var _0x35ff09=![];if(typeof _0x40255b[_0x1d76('0xa')]!==_0x1d76('0xb')){_0x35ff09=_0x40255b[_0x1d76('0xa')][_0x1d76('0xc')]&&_0x40255b[_0x1d76('0xa')]['url']&&_0x40255b[_0x1d76('0xa')][_0x1d76('0xd')];}return _0x35ff09;}function adAuthenticate(_0x28c1b6,_0x18fc69,_0x31a52a){return new BPromise(function(_0xcfa6bf,_0x37fcb3){try{var _0xa3e46c=new ActiveDirectory(_0x28c1b6);_0xa3e46c[_0x1d76('0xe')](_0x18fc69,_0x31a52a,function(_0x2bab5c,_0x33a6f8){if(_0x2bab5c){logger[_0x1d76('0xf')](_0x1d76('0x10'),_0x18fc69,util[_0x1d76('0x11')](_0x2bab5c,{'showHidden':![],'depth':null}));_0x37fcb3(_0x1d76('0x12'));}else if(!_0x33a6f8){logger[_0x1d76('0xf')](_0x1d76('0x13'),_0x18fc69);_0x37fcb3(_0x1d76('0x12'));}else{_0xcfa6bf(_0x33a6f8);}});}catch(_0x405991){_0x37fcb3(_0x405991);}});}function ActiveDirectoryAuthenticate(_0x570495,_0x398adc,_0x336817,_0x3986e4){var _0x43ac16,_0x3dcea6;if(!isActiveDirectoryConfigured(config)){logger[_0x1d76('0xf')](_0x1d76('0x14'),_0x398adc);return _0x3986e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x1d76('0x15')][_0x1d76('0x16')]({'where':{'id':0x1},'attributes':[_0x1d76('0x17'),_0x1d76('0x18')],'raw':!![]})['then'](function(_0x171ebe){_0x43ac16=_0x171ebe;if(!_0x43ac16['adSsoEnabled']){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x398adc);throw new Error(_0x1d76('0x12'));}return _0x570495[_0x1d76('0x16')]({'attributes':['id',_0x1d76('0x19'),_0x1d76('0x1a'),'salt','role',_0x1d76('0x1b'),_0x1d76('0x1c'),'blockedAt',_0x1d76('0x1d')],'where':{'name':_0x398adc,'role':{'$or':[_0x1d76('0x1e'),_0x1d76('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0x1d76('0x20')](function(_0x38f0ef){if(!_0x38f0ef||_0x38f0ef&&_0x38f0ef[_0x1d76('0x19')]!==_0x398adc){throw new Error(_0x1d76('0x12'));}_0x3dcea6=_0x38f0ef;var _0x40f00b=_0x3dcea6[_0x1d76('0x19')]+'@'+config['activedirectory'][_0x1d76('0xd')];return adAuthenticate(config[_0x1d76('0xa')],_0x40f00b,_0x336817);})[_0x1d76('0x20')](function(_0x7f80b0){if(_0x3dcea6[_0x1d76('0x1b')]){throw new Error(_0x1d76('0x12'));}if(_0x43ac16[_0x1d76('0x18')]>0x0){if(_0x3dcea6['blocked']){if(moment(_0x3dcea6[_0x1d76('0x21')])['add'](_0x43ac16[_0x1d76('0x18')],_0x1d76('0x22'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x1d76('0x23')](_0x3dcea6,0x0,![],null)[_0x1d76('0x20')](function(){return utils[_0x1d76('0x24')](_0x3dcea6);})[_0x1d76('0x20')](function(){return _0x3986e4(null,_0x3dcea6);});}else{return utils[_0x1d76('0x24')](_0x3dcea6)[_0x1d76('0x20')](function(){return _0x3986e4(null,_0x3dcea6);});}}else{return utils[_0x1d76('0x24')](_0x3dcea6)[_0x1d76('0x20')](function(){return _0x3986e4(null,_0x3dcea6);});}})['catch'](function(_0x3998a0){return _0x3986e4(null,![],_0x3998a0);});}function handleError(_0x2fc93c,_0x51342a,_0x50d513){return _0x2fc93c['status'](_0x51342a||0x1f4)[_0x1d76('0x25')]({'message':_0x50d513?_0x50d513[_0x1d76('0x26')]||_0x50d513:''});}exports['login']=function(_0x573e6c,_0x2018fe,_0xc47da7){passport[_0x1d76('0xe')](_0x1d76('0x27'),function(_0x42b9c0,_0x2a4c29,_0x26100d){var _0x271544=_0x42b9c0||_0x26100d;if(_0x271544){return handleError(_0x2018fe,0x191,_0x271544);}if(!_0x2a4c29){return handleError(_0x2018fe,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2f63ed={'payload':{'id':_0x2a4c29['id'],'role':_0x2a4c29[_0x1d76('0x28')]},'options':{'expiresIn':0x15180}};return authService[_0x1d76('0x29')](_0x2f63ed)[_0x1d76('0x20')](function(_0x70024c){_0x2018fe[_0x1d76('0x2a')]({'id':_0x2a4c29['id'],'token':_0x70024c,'statusCall':'','isAlreadyLogged':_0x2a4c29[_0x1d76('0x1d')]});});}})(_0x573e6c,_0x2018fe,_0xc47da7);};passport['use'](_0x1d76('0x27'),new LocalStrategy({'usernameField':'name','passwordField':_0x1d76('0x1a')},function(_0x5d92b5,_0x1524e7,_0x377279){return ActiveDirectoryAuthenticate(db[_0x1d76('0x2b')],_0x5d92b5,_0x1524e7,_0x377279);})); \ No newline at end of file +var _0x3d42=['ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport','passport-local','activedirectory2','bluebird','util','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','then','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','blocked','blockedAt','online','admin','user','agent','add','minutes','clearBlockUser','getLicense','status','send','message','login'];(function(_0x27a591,_0x24c79b){var _0x2de723=function(_0x5c409f){while(--_0x5c409f){_0x27a591['push'](_0x27a591['shift']());}};_0x2de723(++_0x24c79b);}(_0x3d42,0x10d));var _0x23d4=function(_0x33907f,_0x470945){_0x33907f=_0x33907f-0x0;var _0x28118d=_0x3d42[_0x33907f];return _0x28118d;};'use strict';var passport=require(_0x23d4('0x0'));var LocalStrategy=require(_0x23d4('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x23d4('0x2'));var BPromise=require(_0x23d4('0x3'));var util=require(_0x23d4('0x4'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x23d4('0x5'));var config=require('../../config/environment');var logger=require(_0x23d4('0x6'))(_0x23d4('0x7'));function isActiveDirectoryConfigured(_0x59f284){var _0x398944=![];if(typeof _0x59f284[_0x23d4('0x8')]!==_0x23d4('0x9')){_0x398944=_0x59f284[_0x23d4('0x8')][_0x23d4('0xa')]&&_0x59f284[_0x23d4('0x8')][_0x23d4('0xb')]&&_0x59f284[_0x23d4('0x8')][_0x23d4('0xc')];}return _0x398944;}function adAuthenticate(_0x3c726d,_0x50d36f,_0x29a318){return new BPromise(function(_0x307a93,_0x5d0569){try{var _0x316729=new ActiveDirectory(_0x3c726d);_0x316729[_0x23d4('0xd')](_0x50d36f,_0x29a318,function(_0x57f9aa,_0xd36163){if(_0x57f9aa){logger['error'](_0x23d4('0xe'),_0x50d36f,util['inspect'](_0x57f9aa,{'showHidden':![],'depth':null}));_0x5d0569('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0xd36163){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x50d36f);_0x5d0569(_0x23d4('0xf'));}else{_0x307a93(_0xd36163);}});}catch(_0x466718){_0x5d0569(_0x466718);}});}function ActiveDirectoryAuthenticate(_0x4def80,_0x3d8cea,_0x3c469d,_0x752b85){var _0x54d15c,_0x2db926;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3d8cea);return _0x752b85(null,![],{'message':_0x23d4('0xf')});}return db[_0x23d4('0x10')]['findOne']({'where':{'id':0x1},'attributes':[_0x23d4('0x11'),_0x23d4('0x12')],'raw':!![]})[_0x23d4('0x13')](function(_0x4d84ac){_0x54d15c=_0x4d84ac;if(!_0x54d15c[_0x23d4('0x11')]){logger[_0x23d4('0x14')](_0x23d4('0x15'),_0x3d8cea);throw new Error(_0x23d4('0xf'));}return _0x4def80[_0x23d4('0x16')]({'attributes':['id',_0x23d4('0x17'),_0x23d4('0x18'),'salt','role','disabled',_0x23d4('0x19'),_0x23d4('0x1a'),_0x23d4('0x1b')],'where':{'name':_0x3d8cea,'role':{'$or':[_0x23d4('0x1c'),_0x23d4('0x1d'),_0x23d4('0x1e')]},'adSsoEnabled':!![]}});})[_0x23d4('0x13')](function(_0x350234){if(!_0x350234||_0x350234&&_0x350234[_0x23d4('0x17')]!==_0x3d8cea){throw new Error(_0x23d4('0xf'));}_0x2db926=_0x350234;var _0x5a10ab=_0x2db926[_0x23d4('0x17')]+'@'+config[_0x23d4('0x8')][_0x23d4('0xc')];return adAuthenticate(config[_0x23d4('0x8')],_0x5a10ab,_0x3c469d);})['then'](function(_0x1839cd){if(_0x2db926['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x54d15c['blockDuration']>0x0){if(_0x2db926[_0x23d4('0x19')]){if(moment(_0x2db926['blockedAt'])[_0x23d4('0x1f')](_0x54d15c[_0x23d4('0x12')],_0x23d4('0x20'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x23d4('0x21')](_0x2db926,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2db926);})['then'](function(){return _0x752b85(null,_0x2db926);});}else{return utils[_0x23d4('0x22')](_0x2db926)['then'](function(){return _0x752b85(null,_0x2db926);});}}else{return utils[_0x23d4('0x22')](_0x2db926)[_0x23d4('0x13')](function(){return _0x752b85(null,_0x2db926);});}})['catch'](function(_0x7d16dc){return _0x752b85(null,![],_0x7d16dc);});}function handleError(_0x39825a,_0x4ff13b,_0x4e3b3d){return _0x39825a[_0x23d4('0x23')](_0x4ff13b||0x1f4)[_0x23d4('0x24')]({'message':_0x4e3b3d?_0x4e3b3d[_0x23d4('0x25')]||_0x4e3b3d:''});}exports[_0x23d4('0x26')]=function(_0x415eef,_0x5bc27d,_0x2ea879){passport[_0x23d4('0xd')](_0x23d4('0x27'),function(_0x4cbf37,_0x232d15,_0x11536f){var _0x744e0c=_0x4cbf37||_0x11536f;if(_0x744e0c){return handleError(_0x5bc27d,0x191,_0x744e0c);}if(!_0x232d15){return handleError(_0x5bc27d,0x194,{'message':_0x23d4('0x28')});}else{var _0x246188={'payload':{'id':_0x232d15['id'],'role':_0x232d15['role']},'options':{'expiresIn':0x15180}};return authService[_0x23d4('0x29')](_0x246188)[_0x23d4('0x13')](function(_0x25d161){_0x5bc27d['json']({'id':_0x232d15['id'],'token':_0x25d161,'statusCall':'','isAlreadyLogged':_0x232d15[_0x23d4('0x1b')]});});}})(_0x415eef,_0x5bc27d,_0x2ea879);};passport[_0x23d4('0x2a')](_0x23d4('0x27'),new LocalStrategy({'usernameField':_0x23d4('0x17'),'passwordField':_0x23d4('0x18')},function(_0x40dc0f,_0x213bb6,_0x22fe20){return ActiveDirectoryAuthenticate(db[_0x23d4('0x2b')],_0x40dc0f,_0x213bb6,_0x22fe20);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 353c235..6e8867c 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 _0x21b8=['./authActiveDirectory.controller','login','exports','express','Router'];(function(_0x57a01b,_0x174e7b){var _0x252fd6=function(_0x3ded47){while(--_0x3ded47){_0x57a01b['push'](_0x57a01b['shift']());}};_0x252fd6(++_0x174e7b);}(_0x21b8,0x1de));var _0x821b=function(_0x506da8,_0x2728bb){_0x506da8=_0x506da8-0x0;var _0x4eab9b=_0x21b8[_0x506da8];return _0x4eab9b;};'use strict';var express=require(_0x821b('0x0'));var router=express[_0x821b('0x1')]();var controller=require(_0x821b('0x2'));router['post']('/',controller[_0x821b('0x3')]);module[_0x821b('0x4')]=router; \ No newline at end of file +var _0xc0ef=['post','login','express','Router'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xc0ef,0xba));var _0xfc0e=function(_0x18a6de,_0x1cd3e1){_0x18a6de=_0x18a6de-0x0;var _0x22ff9b=_0xc0ef[_0x18a6de];return _0x22ff9b;};'use strict';var express=require(_0xfc0e('0x0'));var router=express[_0xfc0e('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xfc0e('0x2')]('/',controller[_0xfc0e('0x3')]);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 e99064c..ada381b 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x58200b,_0x184495){var _0x3c5124=function(_0x48393d){while(--_0x48393d){_0x58200b['push'](_0x58200b['shift']());}};_0x3c5124(++_0x184495);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x311d08,_0x573ad0){var _0x37de45=function(_0x447b72){while(--_0x447b72){_0x311d08['push'](_0x311d08['shift']());}};_0x37de45(++_0x573ad0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 861ce41..6229456 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 _0x5e97=['exports','express','passport','./authGoogle.controller','../user/user.controller.js','get','login','/callback','isMiddleware','setTokenCookie'];(function(_0x428983,_0x3b4777){var _0x58cc88=function(_0x31e430){while(--_0x31e430){_0x428983['push'](_0x428983['shift']());}};_0x58cc88(++_0x3b4777);}(_0x5e97,0x155));var _0x75e9=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5e97[_0x1035c1];return _0x308d67;};'use strict';var express=require(_0x75e9('0x0'));var passport=require(_0x75e9('0x1'));var router=express['Router']();var controller=require(_0x75e9('0x2'));var userController=require(_0x75e9('0x3'));var authService=require('../../components/auth/service');router[_0x75e9('0x4')]('/',controller[_0x75e9('0x5')]);router[_0x75e9('0x4')](_0x75e9('0x6'),controller['callback'],authService[_0x75e9('0x7')],userController[_0x75e9('0x5')],authService[_0x75e9('0x8')]);module[_0x75e9('0x9')]=router; \ No newline at end of file +var _0x9bc7=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x5a6761,_0x180bb4){var _0x2ba5e9=function(_0x36a404){while(--_0x36a404){_0x5a6761['push'](_0x5a6761['shift']());}};_0x2ba5e9(++_0x180bb4);}(_0x9bc7,0xda));var _0x79bc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9bc7[_0x3bf83f];return _0x22c4a9;};'use strict';var express=require(_0x79bc('0x0'));var passport=require(_0x79bc('0x1'));var router=express[_0x79bc('0x2')]();var controller=require(_0x79bc('0x3'));var userController=require(_0x79bc('0x4'));var authService=require(_0x79bc('0x5'));router[_0x79bc('0x6')]('/',controller[_0x79bc('0x7')]);router[_0x79bc('0x6')](_0x79bc('0x8'),controller[_0x79bc('0x9')],authService[_0x79bc('0xa')],userController[_0x79bc('0x7')],authService[_0x79bc('0xb')]);module[_0x79bc('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index aa6fc50..5c595a9 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 _0xbc6a=['Reset\x20Email\x20sent!','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','clearBlockUser','add','minutes','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','request','error','status','send','message','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'];(function(_0x21e877,_0x3cfe80){var _0x1cffdf=function(_0x2ef58e){while(--_0x2ef58e){_0x21e877['push'](_0x21e877['shift']());}};_0x1cffdf(++_0x3cfe80);}(_0xbc6a,0xf6));var _0xabc6=function(_0x84516f,_0x1baf4a){_0x84516f=_0x84516f-0x0;var _0x56fc50=_0xbc6a[_0x84516f];return _0x56fc50;};'use strict';var util=require(_0xabc6('0x0'));var passport=require('passport');var LocalStrategy=require(_0xabc6('0x1'))[_0xabc6('0x2')];var jayson=require(_0xabc6('0x3'));var _=require(_0xabc6('0x4'));var rs=require(_0xabc6('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xabc6('0x6'));var utils=require(_0xabc6('0x7'));var client=jayson[_0xabc6('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x58cff1,_0x29907f,_0x1244a6,_0x3b9f85){var _0x54a85d,_0x3a9718;return db[_0xabc6('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xabc6('0xa'),_0xabc6('0xb')],'raw':!![]})[_0xabc6('0xc')](function(_0x3350b4){_0x54a85d=_0x3350b4;return _0x58cff1[_0xabc6('0xd')]({'attributes':['id',_0xabc6('0xe'),_0xabc6('0xf'),_0xabc6('0x10'),_0xabc6('0x11'),'disabled',_0xabc6('0x12'),_0xabc6('0x13'),_0xabc6('0x14')],'where':{'name':_0x29907f,'role':{'$or':[_0xabc6('0x15'),_0xabc6('0x16'),_0xabc6('0x17')]}}});})['then'](function(_0x3e3bc6){if(!_0x3e3bc6||_0x3e3bc6&&_0x3e3bc6[_0xabc6('0xe')]!==_0x29907f){throw new Error(_0xabc6('0x18'));}else{_0x3a9718=_0x3e3bc6;return _0x3a9718;}})[_0xabc6('0xc')](function(){_0x3a9718[_0xabc6('0x19')](_0x1244a6,function(_0x20e382,_0x1d8acc){var _0x402b64=_0x3a9718[_0xabc6('0x14')]+0x1;if(_0x20e382){return _0x3b9f85(_0x20e382);}else if(!_0x1d8acc){if(_0x3a9718[_0xabc6('0x1a')]){return _0x3b9f85(null,![],{'message':_0xabc6('0x18')});}else if(_0x54a85d[_0xabc6('0xa')]>0x0){if(_0x3a9718[_0xabc6('0x12')]){if(_0x54a85d['blockDuration']>0x0){if(moment(_0x3a9718[_0xabc6('0x13')])['add'](_0x54a85d[_0xabc6('0xb')],'minutes')>moment()){return _0x3b9f85(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xabc6('0x1b')](_0x3a9718,_0x402b64,![],null)['then'](function(){return _0x3b9f85(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3b9f85(null,![],{'message':_0xabc6('0x18')});}}else{if(_0x402b64>=_0x54a85d[_0xabc6('0xa')]){return utils[_0xabc6('0x1b')](_0x3a9718,0x0,!![],moment())[_0xabc6('0xc')](function(){return _0x3b9f85(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xabc6('0x1b')](_0x3a9718,_0x402b64,![],null)[_0xabc6('0xc')](function(){return _0x3b9f85(null,![],{'message':_0xabc6('0x18')});});}}}else{return _0x3b9f85(null,![],{'message':_0xabc6('0x18')});}}else{if(_0x3a9718['disabled']){return _0x3b9f85(null,![],{'message':_0xabc6('0x18')});}else if(_0x54a85d[_0xabc6('0xa')]>0x0){if(_0x3a9718['blocked']){if(_0x54a85d['blockDuration']>0x0){if(moment(_0x3a9718['blockedAt'])[_0xabc6('0x1c')](_0x54a85d[_0xabc6('0xb')],_0xabc6('0x1d'))>moment()){return _0x3b9f85(null,![],{'message':_0xabc6('0x18')});}else{return utils[_0xabc6('0x1b')](_0x3a9718,0x0,![],null)[_0xabc6('0xc')](function(){return utils[_0xabc6('0x1e')](_0x3a9718);})[_0xabc6('0xc')](function(){return _0x3b9f85(null,_0x3a9718);});}}else{return _0x3b9f85(null,![],{'message':_0xabc6('0x18')});}}else{return utils[_0xabc6('0x1b')](_0x3a9718,0x0,![],null)[_0xabc6('0xc')](function(){return utils[_0xabc6('0x1e')](_0x3a9718);})[_0xabc6('0xc')](function(){return _0x3b9f85(null,_0x3a9718);})['catch'](function(_0x291e92){return _0x3b9f85(null,![],_0x291e92);});}}else{if(_0x3a9718['blocked']){return _0x3b9f85(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xabc6('0x1e')](_0x3a9718)['then'](function(){return _0x3b9f85(null,_0x3a9718);});}}}});})[_0xabc6('0x1f')](function(_0x4c0ec7){return _0x3b9f85(null,![],_0x4c0ec7);});}function sendServiceMail(_0x3fa734){return db[_0xabc6('0x20')]['find']({'where':{'service':!![]},'attributes':['id','name',_0xabc6('0x21')],'include':[{'model':db[_0xabc6('0x22')],'as':_0xabc6('0x23'),'include':[{'model':db[_0xabc6('0x24')],'as':_0xabc6('0x24')}]}]})['then'](function(_0x37a14b){if(!_0x37a14b){throw new Error(_0xabc6('0x25'));}var _0x30eab0=_0x37a14b[_0xabc6('0x26')]();var _0x195e27={'account':_0x30eab0,'message':_[_0xabc6('0x27')]({'from':util[_0xabc6('0x28')]('\x22%s\x22\x20<%s>',_0x37a14b[_0xabc6('0xe')],_0x37a14b[_0xabc6('0x21')]||_0x37a14b[_0xabc6('0x23')][_0xabc6('0x16')])},_0x3fa734)};return client[_0xabc6('0x29')]('SendMail',_0x195e27);})[_0xabc6('0xc')](function(_0xdb6327){if(_0xdb6327[_0xabc6('0x2a')]){throw new Error(util[_0xabc6('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xdb6327[_0xabc6('0x2a')]['message']||JSON['stringify'](_0xdb6327[_0xabc6('0x2a')])));}return!![];});}function handleError(_0x4d9145,_0x38cc3a,_0x15ee14){return _0x4d9145[_0xabc6('0x2b')](_0x38cc3a||0x1f4)[_0xabc6('0x2c')]({'message':_0x15ee14?_0x15ee14[_0xabc6('0x2d')]||_0x15ee14:''});}exports['login']=function(_0x5886fb,_0x56f045,_0x59965a){passport['authenticate'](_0xabc6('0x2e'),function(_0x1f57d6,_0x563902,_0x487d1e){var _0x3a3c26=_0x1f57d6||_0x487d1e;if(_0x3a3c26){return handleError(_0x56f045,0x191,_0x3a3c26);}if(!_0x563902){return handleError(_0x56f045,0x194,{'message':_0xabc6('0x2f')});}else{var _0x170244={'payload':{'id':_0x563902['id'],'role':_0x563902[_0xabc6('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xabc6('0x30')](_0x170244)[_0xabc6('0xc')](function(_0x2b9f14){_0x56f045[_0xabc6('0x31')]({'id':_0x563902['id'],'token':_0x2b9f14,'statusCall':'','isAlreadyLogged':_0x563902[_0xabc6('0x32')]});});}})(_0x5886fb,_0x56f045,_0x59965a);};exports[_0xabc6('0x33')]=function(_0x53b959,_0x360aa3){if(!_0x53b959[_0xabc6('0x34')][_0xabc6('0x21')]){return handleError(_0x360aa3,0x1f4,{'message':_0xabc6('0x35')});}var _0x453c2b=rs[_0xabc6('0x36')]();_0x53b959['body'][_0xabc6('0x21')]=_0x53b959[_0xabc6('0x34')][_0xabc6('0x21')][_0xabc6('0x37')]()['toLowerCase']();var _0x3c5582;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xabc6('0xa'),_0xabc6('0xb')],'raw':!![]})[_0xabc6('0xc')](function(_0x437767){_0x3c5582=_0x437767;return db[_0xabc6('0x38')][_0xabc6('0x39')]({'where':{'email':_0x53b959['body'][_0xabc6('0x21')]}});})[_0xabc6('0xc')](function(_0x46ddb2){if(!_0x46ddb2){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x46ddb2[_0xabc6('0x1a')]){throw new Error(_0xabc6('0x3a'));}if(_0x46ddb2[_0xabc6('0x12')]){if(moment(_0x46ddb2[_0xabc6('0x13')])[_0xabc6('0x1c')](_0x3c5582['blockDuration'],_0xabc6('0x1d'))>moment()){throw new Error(_0xabc6('0x3b'));}else{_0x46ddb2[_0xabc6('0x12')]=![];_0x46ddb2[_0xabc6('0x13')]=null;}}_0x46ddb2[_0xabc6('0x3c')]=_0x453c2b;_0x46ddb2[_0xabc6('0x3d')]=Date[_0xabc6('0x3e')]()+0x36ee80;return _0x46ddb2[_0xabc6('0x3f')]();})[_0xabc6('0xc')](function(){return sendServiceMail({'to':_0x53b959[_0xabc6('0x34')][_0xabc6('0x21')],'subject':_0xabc6('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xabc6('0x41')+_0xabc6('0x42')+_0x53b959[_0xabc6('0x43')][_0xabc6('0x44')]+'/reset/'+_0x453c2b+'\x0a\x0a'+_0xabc6('0x45')});})[_0xabc6('0xc')](function(){_0x360aa3['status'](0xc8)['send']({'message':_0xabc6('0x46')});})['catch'](function(_0x37e388){return handleError(_0x360aa3,0x1f4,_0x37e388);});};exports['reset']=function(_0x177620,_0x13d43e){return db[_0xabc6('0x38')][_0xabc6('0x39')]({'where':{'resetPasswordToken':_0x177620['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xabc6('0xc')](function(_0x53c53e){if(!_0x53c53e){throw new Error(_0xabc6('0x47'));}return db[_0xabc6('0x9')][_0xabc6('0xd')]({'attributes':['id',_0xabc6('0x48'),_0xabc6('0x49'),_0xabc6('0x4a')]})[_0xabc6('0xc')](function(_0x2eada3){if(_0x2eada3[_0xabc6('0x48')])authService[_0xabc6('0x4b')](_0x177620[_0xabc6('0x34')][_0xabc6('0xf')]);if(!_0x2eada3[_0xabc6('0x49')]||!_0x53c53e[_0xabc6('0x4c')])return _0x53c53e;authService['validatePasswordHistory'](_0x177620[_0xabc6('0x34')][_0xabc6('0xf')],_0x53c53e[_0xabc6('0x4c')],_0x2eada3[_0xabc6('0x4a')]);return _0x53c53e;})[_0xabc6('0xc')](function(){_0x53c53e[_0xabc6('0xf')]=_0x177620[_0xabc6('0x34')]['password'];_0x53c53e[_0xabc6('0x3c')]=null;_0x53c53e['resetPasswordExpires']=null;return _0x53c53e['save']();});})[_0xabc6('0xc')](function(){_0x13d43e[_0xabc6('0x2b')](0xc8)[_0xabc6('0x2c')]({'message':_0xabc6('0x4d')});})[_0xabc6('0x1f')](function(_0x373a58){return handleError(_0x13d43e,0x1f4,_0x373a58);});};passport[_0xabc6('0x4e')](_0xabc6('0x2e'),new LocalStrategy({'usernameField':_0xabc6('0xe'),'passwordField':_0xabc6('0xf')},function(_0x5a461e,_0x2eaffd,_0xb35772){return localAuthenticate(db[_0xabc6('0x38')],_0x5a461e,_0x2eaffd,_0xb35772);})); \ No newline at end of file +var _0x0ef1=['user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','blockedAt','minutes','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','status','Reset\x20Email\x20sent!','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt','disabled','blocked','loginAttempts','admin'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0ef1,0x95));var _0x10ef=function(_0x1c694a,_0x38976c){_0x1c694a=_0x1c694a-0x0;var _0x15e2a1=_0x0ef1[_0x1c694a];return _0x15e2a1;};'use strict';var util=require('util');var passport=require(_0x10ef('0x0'));var LocalStrategy=require(_0x10ef('0x1'))[_0x10ef('0x2')];var jayson=require(_0x10ef('0x3'));var _=require(_0x10ef('0x4'));var rs=require('randomstring');var moment=require(_0x10ef('0x5'));var db=require(_0x10ef('0x6'))['db'];var authService=require(_0x10ef('0x7'));var utils=require(_0x10ef('0x8'));var client=jayson['client'][_0x10ef('0x9')]({'port':0x232b});function localAuthenticate(_0x23ec14,_0x23be13,_0x1ca1e5,_0x306672){var _0x531aa5,_0xee9815;return db[_0x10ef('0xa')][_0x10ef('0xb')]({'where':{'id':0x1},'attributes':[_0x10ef('0xc'),_0x10ef('0xd')],'raw':!![]})['then'](function(_0x5bbd06){_0x531aa5=_0x5bbd06;return _0x23ec14[_0x10ef('0xb')]({'attributes':['id',_0x10ef('0xe'),_0x10ef('0xf'),_0x10ef('0x10'),'role',_0x10ef('0x11'),_0x10ef('0x12'),'blockedAt',_0x10ef('0x13')],'where':{'name':_0x23be13,'role':{'$or':[_0x10ef('0x14'),_0x10ef('0x15'),_0x10ef('0x16')]}}});})[_0x10ef('0x17')](function(_0x4ef175){if(!_0x4ef175||_0x4ef175&&_0x4ef175[_0x10ef('0xe')]!==_0x23be13){throw new Error(_0x10ef('0x18'));}else{_0xee9815=_0x4ef175;return _0xee9815;}})[_0x10ef('0x17')](function(){_0xee9815[_0x10ef('0x19')](_0x1ca1e5,function(_0x793843,_0x582296){var _0x1f4a03=_0xee9815[_0x10ef('0x13')]+0x1;if(_0x793843){return _0x306672(_0x793843);}else if(!_0x582296){if(_0xee9815[_0x10ef('0x11')]){return _0x306672(null,![],{'message':_0x10ef('0x18')});}else if(_0x531aa5[_0x10ef('0xc')]>0x0){if(_0xee9815[_0x10ef('0x12')]){if(_0x531aa5[_0x10ef('0xd')]>0x0){if(moment(_0xee9815['blockedAt'])[_0x10ef('0x1a')](_0x531aa5[_0x10ef('0xd')],'minutes')>moment()){return _0x306672(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x10ef('0x1b')](_0xee9815,_0x1f4a03,![],null)[_0x10ef('0x17')](function(){return _0x306672(null,![],{'message':_0x10ef('0x18')});});}}else{return _0x306672(null,![],{'message':_0x10ef('0x18')});}}else{if(_0x1f4a03>=_0x531aa5[_0x10ef('0xc')]){return utils[_0x10ef('0x1b')](_0xee9815,0x0,!![],moment())[_0x10ef('0x17')](function(){return _0x306672(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x10ef('0x1b')](_0xee9815,_0x1f4a03,![],null)[_0x10ef('0x17')](function(){return _0x306672(null,![],{'message':_0x10ef('0x18')});});}}}else{return _0x306672(null,![],{'message':_0x10ef('0x18')});}}else{if(_0xee9815[_0x10ef('0x11')]){return _0x306672(null,![],{'message':_0x10ef('0x18')});}else if(_0x531aa5[_0x10ef('0xc')]>0x0){if(_0xee9815['blocked']){if(_0x531aa5[_0x10ef('0xd')]>0x0){if(moment(_0xee9815[_0x10ef('0x1c')])['add'](_0x531aa5[_0x10ef('0xd')],_0x10ef('0x1d'))>moment()){return _0x306672(null,![],{'message':_0x10ef('0x18')});}else{return utils[_0x10ef('0x1b')](_0xee9815,0x0,![],null)['then'](function(){return utils[_0x10ef('0x1e')](_0xee9815);})[_0x10ef('0x17')](function(){return _0x306672(null,_0xee9815);});}}else{return _0x306672(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x10ef('0x1b')](_0xee9815,0x0,![],null)['then'](function(){return utils[_0x10ef('0x1e')](_0xee9815);})['then'](function(){return _0x306672(null,_0xee9815);})[_0x10ef('0x1f')](function(_0x496102){return _0x306672(null,![],_0x496102);});}}else{if(_0xee9815['blocked']){return _0x306672(null,![],{'message':_0x10ef('0x18')});}else{return utils[_0x10ef('0x1e')](_0xee9815)['then'](function(){return _0x306672(null,_0xee9815);});}}}});})['catch'](function(_0x4b38ff){return _0x306672(null,![],_0x4b38ff);});}function sendServiceMail(_0x44823e){return db['MailAccount'][_0x10ef('0x20')]({'where':{'service':!![]},'attributes':['id',_0x10ef('0xe'),_0x10ef('0x21')],'include':[{'model':db[_0x10ef('0x22')],'as':'Smtp','include':[{'model':db[_0x10ef('0x23')],'as':_0x10ef('0x23')}]}]})[_0x10ef('0x17')](function(_0x2498a6){if(!_0x2498a6){throw new Error(_0x10ef('0x24'));}var _0x153667=_0x2498a6[_0x10ef('0x25')]();var _0x4153cd={'account':_0x153667,'message':_[_0x10ef('0x26')]({'from':util[_0x10ef('0x27')](_0x10ef('0x28'),_0x2498a6[_0x10ef('0xe')],_0x2498a6[_0x10ef('0x21')]||_0x2498a6[_0x10ef('0x29')][_0x10ef('0x15')])},_0x44823e)};return client[_0x10ef('0x2a')](_0x10ef('0x2b'),_0x4153cd);})[_0x10ef('0x17')](function(_0x3ed788){if(_0x3ed788[_0x10ef('0x2c')]){throw new Error(util[_0x10ef('0x27')](_0x10ef('0x2d'),_0x3ed788[_0x10ef('0x2c')][_0x10ef('0x2e')]||JSON['stringify'](_0x3ed788['error'])));}return!![];});}function handleError(_0x329850,_0x321b4f,_0x13093a){return _0x329850['status'](_0x321b4f||0x1f4)[_0x10ef('0x2f')]({'message':_0x13093a?_0x13093a[_0x10ef('0x2e')]||_0x13093a:''});}exports[_0x10ef('0x30')]=function(_0x28f280,_0x17d316,_0x299685){passport[_0x10ef('0x19')](_0x10ef('0x31'),function(_0x2455ed,_0x109ed6,_0x14f739){var _0x24af73=_0x2455ed||_0x14f739;if(_0x24af73){return handleError(_0x17d316,0x191,_0x24af73);}if(!_0x109ed6){return handleError(_0x17d316,0x194,{'message':_0x10ef('0x32')});}else{var _0x21f747={'payload':{'id':_0x109ed6['id'],'role':_0x109ed6[_0x10ef('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0x10ef('0x34')](_0x21f747)[_0x10ef('0x17')](function(_0x40035a){_0x17d316[_0x10ef('0x35')]({'id':_0x109ed6['id'],'token':_0x40035a,'statusCall':'','isAlreadyLogged':_0x109ed6[_0x10ef('0x36')]});});}})(_0x28f280,_0x17d316,_0x299685);};exports[_0x10ef('0x37')]=function(_0x107fb0,_0x13168c){if(!_0x107fb0[_0x10ef('0x38')][_0x10ef('0x21')]){return handleError(_0x13168c,0x1f4,{'message':_0x10ef('0x39')});}var _0x24cf92=rs[_0x10ef('0x3a')]();_0x107fb0[_0x10ef('0x38')][_0x10ef('0x21')]=_0x107fb0[_0x10ef('0x38')][_0x10ef('0x21')]['trim']()[_0x10ef('0x3b')]();var _0xa64139;return db[_0x10ef('0xa')][_0x10ef('0xb')]({'where':{'id':0x1},'attributes':[_0x10ef('0xc'),_0x10ef('0xd')],'raw':!![]})[_0x10ef('0x17')](function(_0x203f38){_0xa64139=_0x203f38;return db[_0x10ef('0x3c')][_0x10ef('0x20')]({'where':{'email':_0x107fb0[_0x10ef('0x38')][_0x10ef('0x21')]}});})['then'](function(_0x129daf){if(!_0x129daf){throw new Error(_0x10ef('0x3d'));}if(_0x129daf[_0x10ef('0x11')]){throw new Error(_0x10ef('0x3e'));}if(_0x129daf[_0x10ef('0x12')]){if(moment(_0x129daf['blockedAt'])[_0x10ef('0x1a')](_0xa64139[_0x10ef('0xd')],_0x10ef('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x129daf['blocked']=![];_0x129daf[_0x10ef('0x1c')]=null;}}_0x129daf[_0x10ef('0x3f')]=_0x24cf92;_0x129daf[_0x10ef('0x40')]=Date['now']()+0x36ee80;return _0x129daf[_0x10ef('0x41')]();})[_0x10ef('0x17')](function(){return sendServiceMail({'to':_0x107fb0[_0x10ef('0x38')][_0x10ef('0x21')],'subject':_0x10ef('0x42'),'text':_0x10ef('0x43')+_0x10ef('0x44')+_0x10ef('0x45')+_0x107fb0[_0x10ef('0x46')]['host']+_0x10ef('0x47')+_0x24cf92+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x10ef('0x17')](function(){_0x13168c[_0x10ef('0x48')](0xc8)[_0x10ef('0x2f')]({'message':_0x10ef('0x49')});})['catch'](function(_0x4e8cd1){return handleError(_0x13168c,0x1f4,_0x4e8cd1);});};exports[_0x10ef('0x4a')]=function(_0x377334,_0x1eb658){return db[_0x10ef('0x3c')][_0x10ef('0x20')]({'where':{'resetPasswordToken':_0x377334[_0x10ef('0x4b')]['token'],'resetPasswordExpires':{'$gt':Date[_0x10ef('0x4c')]()}}})[_0x10ef('0x17')](function(_0x526d61){if(!_0x526d61){throw new Error(_0x10ef('0x4d'));}return db['Setting']['findOne']({'attributes':['id','securePassword',_0x10ef('0x4e'),_0x10ef('0x4f')]})[_0x10ef('0x17')](function(_0x22eac0){if(_0x22eac0[_0x10ef('0x50')])authService[_0x10ef('0x51')](_0x377334['body'][_0x10ef('0xf')]);if(!_0x22eac0[_0x10ef('0x4e')]||!_0x526d61[_0x10ef('0x52')])return _0x526d61;authService[_0x10ef('0x53')](_0x377334[_0x10ef('0x38')]['password'],_0x526d61[_0x10ef('0x52')],_0x22eac0['passwordHistoryLimit']);return _0x526d61;})[_0x10ef('0x17')](function(){_0x526d61[_0x10ef('0xf')]=_0x377334[_0x10ef('0x38')][_0x10ef('0xf')];_0x526d61[_0x10ef('0x3f')]=null;_0x526d61['resetPasswordExpires']=null;return _0x526d61[_0x10ef('0x41')]();});})['then'](function(){_0x1eb658[_0x10ef('0x48')](0xc8)[_0x10ef('0x2f')]({'message':_0x10ef('0x54')});})[_0x10ef('0x1f')](function(_0x1aa8fa){return handleError(_0x1eb658,0x1f4,_0x1aa8fa);});};passport['use'](_0x10ef('0x31'),new LocalStrategy({'usernameField':'name','passwordField':_0x10ef('0xf')},function(_0x5cfbe8,_0x3c15fe,_0x40f2a8){return localAuthenticate(db[_0x10ef('0x3c')],_0x5cfbe8,_0x3c15fe,_0x40f2a8);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8462c96..6fd7f04 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 _0xd067=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','exports','express'];(function(_0x2f3b0f,_0x43062e){var _0x5d6901=function(_0x1fa382){while(--_0x1fa382){_0x2f3b0f['push'](_0x2f3b0f['shift']());}};_0x5d6901(++_0x43062e);}(_0xd067,0x10d));var _0x7d06=function(_0xc80a70,_0x103366){_0xc80a70=_0xc80a70-0x0;var _0x5ac657=_0xd067[_0xc80a70];return _0x5ac657;};'use strict';var express=require(_0x7d06('0x0'));var router=express[_0x7d06('0x1')]();var controller=require(_0x7d06('0x2'));router[_0x7d06('0x3')]('/',controller[_0x7d06('0x4')]);router[_0x7d06('0x3')](_0x7d06('0x5'),controller[_0x7d06('0x6')]);router[_0x7d06('0x3')](_0x7d06('0x7'),controller['reset']);module[_0x7d06('0x8')]=router; \ No newline at end of file +var _0xe0d3=['/reset/:token','express','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0xeb5c5c,_0x13e753){var _0x3c001c=function(_0x58ebfe){while(--_0x58ebfe){_0xeb5c5c['push'](_0xeb5c5c['shift']());}};_0x3c001c(++_0x13e753);}(_0xe0d3,0xe1));var _0x3e0d=function(_0x3f19ff,_0xd5b68){_0x3f19ff=_0x3f19ff-0x0;var _0x28310a=_0xe0d3[_0x3f19ff];return _0x28310a;};'use strict';var express=require(_0x3e0d('0x0'));var router=express[_0x3e0d('0x1')]();var controller=require(_0x3e0d('0x2'));router[_0x3e0d('0x3')]('/',controller[_0x3e0d('0x4')]);router[_0x3e0d('0x3')](_0x3e0d('0x5'),controller[_0x3e0d('0x6')]);router['post'](_0x3e0d('0x7'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 16c04c8..35c5ba8 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 _0x3cee=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x589abf,_0x487e83){var _0x212c2e=function(_0x3641a9){while(--_0x3641a9){_0x589abf['push'](_0x589abf['shift']());}};_0x212c2e(++_0x487e83);}(_0x3cee,0xd9));var _0xe3ce=function(_0x495964,_0xcb2072){_0x495964=_0x495964-0x0;var _0x51f8b5=_0x3cee[_0x495964];return _0x51f8b5;};'use strict';var Sequelize=require(_0xe3ce('0x0'));module[_0xe3ce('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe3ce('0x2')]},'status':{'type':Sequelize[_0xe3ce('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe3ce('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x978b=['INTEGER','sequelize','exports','STRING'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x978b,0x195));var _0xb978=function(_0xe3753b,_0x32beed){_0xe3753b=_0xe3753b-0x0;var _0x5f0dcb=_0x978b[_0xe3753b];return _0x5f0dcb;};'use strict';var Sequelize=require(_0xb978('0x0'));module[_0xb978('0x1')]={'name':{'type':Sequelize[_0xb978('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb978('0x2')]},'description':{'type':Sequelize[_0xb978('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb978('0x3')],'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 ba4ce0c..97be55f 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 _0xe352=['pick','filter','merge','type','options','Automation','includeAll','include','rows','catch','params','keys','find','create','body','addConditions','ids','getConditions','Condition','addActions','Action','omit','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters'];(function(_0x2ba425,_0x58d262){var _0x5dee4f=function(_0x4f74a6){while(--_0x4f74a6){_0x2ba425['push'](_0x2ba425['shift']());}};_0x5dee4f(++_0x58d262);}(_0xe352,0x1b7));var _0x2e35=function(_0x5a6716,_0x34cc82){_0x5a6716=_0x5a6716-0x0;var _0x21e961=_0xe352[_0x5a6716];return _0x21e961;};'use strict';var emlformat=require(_0x2e35('0x0'));var rimraf=require(_0x2e35('0x1'));var zipdir=require(_0x2e35('0x2'));var jsonpatch=require(_0x2e35('0x3'));var rp=require(_0x2e35('0x4'));var moment=require(_0x2e35('0x5'));var BPromise=require(_0x2e35('0x6'));var Mustache=require(_0x2e35('0x7'));var util=require(_0x2e35('0x8'));var path=require(_0x2e35('0x9'));var sox=require('sox');var csv=require(_0x2e35('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e35('0xb'));var _=require(_0x2e35('0xc'));var squel=require(_0x2e35('0xd'));var crypto=require(_0x2e35('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2e35('0xf'));var toCsv=require(_0x2e35('0xa'));var querystring=require(_0x2e35('0x10'));var Papa=require(_0x2e35('0x11'));var Redis=require('ioredis');var authService=require(_0x2e35('0x12'));var qs=require(_0x2e35('0x13'));var as=require(_0x2e35('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e35('0x15'))(_0x2e35('0x16'));var utils=require('../../config/utils');var config=require(_0x2e35('0x17'));var licenseUtil=require(_0x2e35('0x18'));var db=require(_0x2e35('0x19'))['db'];function respondWithStatusCode(_0x424211,_0x588b92){_0x588b92=_0x588b92||0xcc;return function(_0x4079f0){if(_0x4079f0){return _0x424211[_0x2e35('0x1a')](_0x588b92);}return _0x424211[_0x2e35('0x1b')](_0x588b92)[_0x2e35('0x1c')]();};}function respondWithResult(_0x490f84,_0x1f78d8){_0x1f78d8=_0x1f78d8||0xc8;return function(_0x17d911){if(_0x17d911){return _0x490f84['status'](_0x1f78d8)['json'](_0x17d911);}};}function respondWithFilteredResult(_0x379d8e,_0x1a645e){return function(_0x5f24b2){if(_0x5f24b2){var _0x5df162=typeof _0x1a645e[_0x2e35('0x1d')]===_0x2e35('0x1e')&&typeof _0x1a645e[_0x2e35('0x1f')]===_0x2e35('0x1e');var _0x3f677c=_0x5f24b2[_0x2e35('0x20')];var _0xd47c23=_0x5df162?0x0:_0x1a645e[_0x2e35('0x1d')];var _0x33d670=_0x5df162?_0x5f24b2[_0x2e35('0x20')]:_0x1a645e[_0x2e35('0x1d')]+_0x1a645e[_0x2e35('0x1f')];var _0x25c391;if(_0x33d670>=_0x3f677c){_0x33d670=_0x3f677c;_0x25c391=0xc8;}else{_0x25c391=0xce;}_0x379d8e[_0x2e35('0x1b')](_0x25c391);return _0x379d8e[_0x2e35('0x21')](_0x2e35('0x22'),_0xd47c23+'-'+_0x33d670+'/'+_0x3f677c)[_0x2e35('0x23')](_0x5f24b2);}return null;};}function patchUpdates(_0x190be1){return function(_0x45d7a3){try{jsonpatch['apply'](_0x45d7a3,_0x190be1,!![]);}catch(_0x421077){return BPromise[_0x2e35('0x24')](_0x421077);}return _0x45d7a3[_0x2e35('0x25')]();};}function saveUpdates(_0x5eda48,_0x228724){return function(_0x131151){if(_0x131151){return _0x131151[_0x2e35('0x26')](_0x5eda48)[_0x2e35('0x27')](function(_0x3e25d5){return _0x3e25d5;});}return null;};}function removeEntity(_0x32699c,_0x59808d){return function(_0x40b221){if(_0x40b221){return _0x40b221[_0x2e35('0x28')]()[_0x2e35('0x27')](function(){_0x32699c[_0x2e35('0x1b')](0xcc)[_0x2e35('0x1c')]();});}};}function handleEntityNotFound(_0x14a75b,_0x3938ce){return function(_0x421b65){if(!_0x421b65){_0x14a75b[_0x2e35('0x1a')](0x194);}return _0x421b65;};}function handleError(_0x1eae83,_0x443987){_0x443987=_0x443987||0x1f4;return function(_0x2a8862){logger['error'](_0x2a8862[_0x2e35('0x29')]);if(_0x2a8862[_0x2e35('0x2a')]){delete _0x2a8862['name'];}_0x1eae83[_0x2e35('0x1b')](_0x443987)[_0x2e35('0x2b')](_0x2a8862);};}exports['index']=function(_0x2779cf,_0x504d93){var _0x3bd520={},_0x33a553={},_0x3f6483={'count':0x0,'rows':[]};var _0x226789=_[_0x2e35('0x2c')](db['Automation'][_0x2e35('0x2d')],function(_0x27b6ba){return{'name':_0x27b6ba[_0x2e35('0x2e')],'type':_0x27b6ba['type'][_0x2e35('0x2f')]};});_0x33a553[_0x2e35('0x30')]=_[_0x2e35('0x2c')](_0x226789,'name');_0x33a553[_0x2e35('0x31')]=_['keys'](_0x2779cf[_0x2e35('0x31')]);_0x33a553['filters']=_[_0x2e35('0x32')](_0x33a553[_0x2e35('0x30')],_0x33a553[_0x2e35('0x31')]);_0x3bd520[_0x2e35('0x33')]=_[_0x2e35('0x32')](_0x33a553[_0x2e35('0x30')],qs[_0x2e35('0x34')](_0x2779cf[_0x2e35('0x31')][_0x2e35('0x34')]));_0x3bd520[_0x2e35('0x33')]=_0x3bd520[_0x2e35('0x33')][_0x2e35('0x35')]?_0x3bd520[_0x2e35('0x33')]:_0x33a553['model'];if(!_0x2779cf['query']['hasOwnProperty'](_0x2e35('0x36'))){_0x3bd520[_0x2e35('0x1f')]=qs['limit'](_0x2779cf[_0x2e35('0x31')][_0x2e35('0x1f')]);_0x3bd520[_0x2e35('0x1d')]=qs[_0x2e35('0x1d')](_0x2779cf[_0x2e35('0x31')][_0x2e35('0x1d')]);}_0x3bd520[_0x2e35('0x37')]=qs[_0x2e35('0x38')](_0x2779cf[_0x2e35('0x31')][_0x2e35('0x38')]);_0x3bd520[_0x2e35('0x39')]=qs[_0x2e35('0x3a')](_[_0x2e35('0x3b')](_0x2779cf['query'],_0x33a553['filters']),_0x226789);if(_0x2779cf['query'][_0x2e35('0x3c')]){_0x3bd520[_0x2e35('0x39')]=_[_0x2e35('0x3d')](_0x3bd520[_0x2e35('0x39')],{'$or':_[_0x2e35('0x2c')](_0x226789,function(_0x107c5f){if(_0x107c5f[_0x2e35('0x3e')]!=='VIRTUAL'){var _0x3e851f={};_0x3e851f[_0x107c5f[_0x2e35('0x2a')]]={'$like':'%'+_0x2779cf['query']['filter']+'%'};return _0x3e851f;}})});}_0x3bd520=_[_0x2e35('0x3d')]({},_0x3bd520,_0x2779cf[_0x2e35('0x3f')]);var _0x521307={'where':_0x3bd520[_0x2e35('0x39')]};return db[_0x2e35('0x40')][_0x2e35('0x20')](_0x521307)[_0x2e35('0x27')](function(_0xb4e1c2){_0x3f6483[_0x2e35('0x20')]=_0xb4e1c2;if(_0x2779cf[_0x2e35('0x31')][_0x2e35('0x41')]){_0x3bd520[_0x2e35('0x42')]=[{'all':!![]}];}return db[_0x2e35('0x40')]['findAll'](_0x3bd520);})[_0x2e35('0x27')](function(_0x3ea134){_0x3f6483[_0x2e35('0x43')]=_0x3ea134;return _0x3f6483;})['then'](respondWithFilteredResult(_0x504d93,_0x3bd520))[_0x2e35('0x44')](handleError(_0x504d93,null));};exports['show']=function(_0x41fa28,_0x44cda2){var _0x5214a3={'raw':![],'where':{'id':_0x41fa28[_0x2e35('0x45')]['id']}},_0x26afe7={};_0x26afe7[_0x2e35('0x30')]=_[_0x2e35('0x46')](db[_0x2e35('0x40')][_0x2e35('0x2d')]);_0x26afe7[_0x2e35('0x31')]=_[_0x2e35('0x46')](_0x41fa28[_0x2e35('0x31')]);_0x26afe7[_0x2e35('0x3a')]=_['intersection'](_0x26afe7[_0x2e35('0x30')],_0x26afe7['query']);_0x5214a3[_0x2e35('0x33')]=_[_0x2e35('0x32')](_0x26afe7['model'],qs[_0x2e35('0x34')](_0x41fa28['query'][_0x2e35('0x34')]));_0x5214a3[_0x2e35('0x33')]=_0x5214a3['attributes'][_0x2e35('0x35')]?_0x5214a3[_0x2e35('0x33')]:_0x26afe7[_0x2e35('0x30')];if(_0x41fa28[_0x2e35('0x31')]['includeAll']){_0x5214a3[_0x2e35('0x42')]=[{'all':!![]}];}_0x5214a3=_['merge']({},_0x5214a3,_0x41fa28['options']);return db[_0x2e35('0x40')][_0x2e35('0x47')](_0x5214a3)[_0x2e35('0x27')](handleEntityNotFound(_0x44cda2,null))[_0x2e35('0x27')](respondWithResult(_0x44cda2,null))['catch'](handleError(_0x44cda2,null));};exports[_0x2e35('0x48')]=function(_0x261025,_0x3bdda2){return db[_0x2e35('0x40')][_0x2e35('0x48')](_0x261025[_0x2e35('0x49')],{})[_0x2e35('0x27')](respondWithResult(_0x3bdda2,0xc9))[_0x2e35('0x44')](handleError(_0x3bdda2,null));};exports[_0x2e35('0x26')]=function(_0x370803,_0x18af0f){if(_0x370803[_0x2e35('0x49')]['id']){delete _0x370803[_0x2e35('0x49')]['id'];}return db[_0x2e35('0x40')][_0x2e35('0x47')]({'where':{'id':_0x370803[_0x2e35('0x45')]['id']}})[_0x2e35('0x27')](handleEntityNotFound(_0x18af0f,null))[_0x2e35('0x27')](saveUpdates(_0x370803[_0x2e35('0x49')],null))[_0x2e35('0x27')](respondWithResult(_0x18af0f,null))[_0x2e35('0x44')](handleError(_0x18af0f,null));};exports[_0x2e35('0x28')]=function(_0x5ebb01,_0x1adb67){return db[_0x2e35('0x40')][_0x2e35('0x47')]({'where':{'id':_0x5ebb01['params']['id']}})[_0x2e35('0x27')](handleEntityNotFound(_0x1adb67,null))[_0x2e35('0x27')](removeEntity(_0x1adb67,null))['catch'](handleError(_0x1adb67,null));};exports[_0x2e35('0x4a')]=function(_0x162e91,_0x28b52,_0x313e8d){return db['Condition'][_0x2e35('0x47')]({'where':{'id':_0x162e91[_0x2e35('0x45')]['id']}})[_0x2e35('0x27')](handleEntityNotFound(_0x28b52,null))[_0x2e35('0x27')](function(_0x5ac27d){if(_0x5ac27d){return _0x5ac27d[_0x2e35('0x4a')](_0x162e91[_0x2e35('0x49')][_0x2e35('0x4b')],_['omit'](_0x162e91['body'],['ids','id'])||{});}})[_0x2e35('0x27')](respondWithResult(_0x28b52,null))[_0x2e35('0x44')](handleError(_0x28b52,null));};exports[_0x2e35('0x4c')]=function(_0x5294ef,_0x249c2a,_0x5a3bd7){var _0xd33268={};var _0x1a6453={};var _0x4e2e03;var _0x2e8e20;return db['Automation']['findOne']({'where':{'id':_0x5294ef[_0x2e35('0x45')]['id']}})[_0x2e35('0x27')](handleEntityNotFound(_0x249c2a,null))['then'](function(_0x8e8d2a){if(_0x8e8d2a){_0x4e2e03=_0x8e8d2a;_0x1a6453[_0x2e35('0x30')]=_[_0x2e35('0x46')](db[_0x2e35('0x4d')][_0x2e35('0x2d')]);_0x1a6453[_0x2e35('0x31')]=_[_0x2e35('0x46')](_0x5294ef[_0x2e35('0x31')]);_0x1a6453['filters']=_[_0x2e35('0x32')](_0x1a6453[_0x2e35('0x30')],_0x1a6453[_0x2e35('0x31')]);_0xd33268['attributes']=_[_0x2e35('0x32')](_0x1a6453[_0x2e35('0x30')],qs['fields'](_0x5294ef['query']['fields']));_0xd33268['attributes']=_0xd33268['attributes'][_0x2e35('0x35')]?_0xd33268[_0x2e35('0x33')]:_0x1a6453['model'];_0xd33268[_0x2e35('0x37')]=qs['sort'](_0x5294ef['query'][_0x2e35('0x38')]);_0xd33268[_0x2e35('0x39')]=qs[_0x2e35('0x3a')](_['pick'](_0x5294ef[_0x2e35('0x31')],_0x1a6453[_0x2e35('0x3a')]));if(_0x5294ef['query'][_0x2e35('0x3c')]){_0xd33268[_0x2e35('0x39')]=_[_0x2e35('0x3d')](_0xd33268['where'],{'$or':_[_0x2e35('0x2c')](_0xd33268[_0x2e35('0x33')],function(_0x3f4692){var _0x2de419={};_0x2de419[_0x3f4692]={'$like':'%'+_0x5294ef['query'][_0x2e35('0x3c')]+'%'};return _0x2de419;})});}_0xd33268=_[_0x2e35('0x3d')]({},_0xd33268,_0x5294ef[_0x2e35('0x3f')]);return _0x4e2e03[_0x2e35('0x4c')](_0xd33268);}})[_0x2e35('0x27')](function(_0x408d8a){if(_0x408d8a){_0x2e8e20=_0x408d8a[_0x2e35('0x35')];if(!_0x5294ef[_0x2e35('0x31')]['hasOwnProperty'](_0x2e35('0x36'))){_0xd33268['limit']=qs[_0x2e35('0x1f')](_0x5294ef[_0x2e35('0x31')][_0x2e35('0x1f')]);_0xd33268[_0x2e35('0x1d')]=qs['offset'](_0x5294ef[_0x2e35('0x31')]['offset']);}return _0x4e2e03[_0x2e35('0x4c')](_0xd33268);}})[_0x2e35('0x27')](function(_0x515e36){if(_0x515e36){return _0x515e36?{'count':_0x2e8e20,'rows':_0x515e36}:null;}})['then'](respondWithResult(_0x249c2a,null))[_0x2e35('0x44')](handleError(_0x249c2a,null));};exports[_0x2e35('0x4e')]=function(_0x31e74d,_0xe7c05a,_0x23f5da){return db[_0x2e35('0x4f')][_0x2e35('0x47')]({'where':{'id':_0x31e74d[_0x2e35('0x45')]['id']}})['then'](handleEntityNotFound(_0xe7c05a,null))[_0x2e35('0x27')](function(_0xab6cd8){if(_0xab6cd8){return _0xab6cd8[_0x2e35('0x4e')](_0x31e74d['body']['ids'],_[_0x2e35('0x50')](_0x31e74d[_0x2e35('0x49')],['ids','id'])||{});}})[_0x2e35('0x27')](respondWithResult(_0xe7c05a,null))['catch'](handleError(_0xe7c05a,null));};exports[_0x2e35('0x51')]=function(_0x4a0d7b,_0x25bc85,_0x470d0a){var _0x30ea0a={};var _0x331d04={};var _0x5e9775;var _0x397495;return db[_0x2e35('0x40')]['findOne']({'where':{'id':_0x4a0d7b[_0x2e35('0x45')]['id']}})[_0x2e35('0x27')](handleEntityNotFound(_0x25bc85,null))['then'](function(_0x16e08b){if(_0x16e08b){_0x5e9775=_0x16e08b;_0x331d04['model']=_[_0x2e35('0x46')](db[_0x2e35('0x4f')][_0x2e35('0x2d')]);_0x331d04[_0x2e35('0x31')]=_['keys'](_0x4a0d7b[_0x2e35('0x31')]);_0x331d04[_0x2e35('0x3a')]=_[_0x2e35('0x32')](_0x331d04['model'],_0x331d04[_0x2e35('0x31')]);_0x30ea0a['attributes']=_[_0x2e35('0x32')](_0x331d04['model'],qs[_0x2e35('0x34')](_0x4a0d7b[_0x2e35('0x31')]['fields']));_0x30ea0a[_0x2e35('0x33')]=_0x30ea0a['attributes'][_0x2e35('0x35')]?_0x30ea0a[_0x2e35('0x33')]:_0x331d04[_0x2e35('0x30')];_0x30ea0a[_0x2e35('0x37')]=qs['sort'](_0x4a0d7b['query'][_0x2e35('0x38')]);_0x30ea0a[_0x2e35('0x39')]=qs[_0x2e35('0x3a')](_[_0x2e35('0x3b')](_0x4a0d7b[_0x2e35('0x31')],_0x331d04[_0x2e35('0x3a')]));if(_0x4a0d7b[_0x2e35('0x31')]['filter']){_0x30ea0a[_0x2e35('0x39')]=_['merge'](_0x30ea0a[_0x2e35('0x39')],{'$or':_['map'](_0x30ea0a[_0x2e35('0x33')],function(_0x351dae){var _0x59c90d={};_0x59c90d[_0x351dae]={'$like':'%'+_0x4a0d7b[_0x2e35('0x31')][_0x2e35('0x3c')]+'%'};return _0x59c90d;})});}_0x30ea0a=_['merge']({},_0x30ea0a,_0x4a0d7b[_0x2e35('0x3f')]);return _0x5e9775[_0x2e35('0x51')](_0x30ea0a);}})[_0x2e35('0x27')](function(_0x328a40){if(_0x328a40){_0x397495=_0x328a40[_0x2e35('0x35')];if(!_0x4a0d7b[_0x2e35('0x31')][_0x2e35('0x52')]('nolimit')){_0x30ea0a['limit']=qs[_0x2e35('0x1f')](_0x4a0d7b[_0x2e35('0x31')]['limit']);_0x30ea0a[_0x2e35('0x1d')]=qs[_0x2e35('0x1d')](_0x4a0d7b['query'][_0x2e35('0x1d')]);}return _0x5e9775[_0x2e35('0x51')](_0x30ea0a);}})[_0x2e35('0x27')](function(_0x186620){if(_0x186620){return _0x186620?{'count':_0x397495,'rows':_0x186620}:null;}})[_0x2e35('0x27')](respondWithResult(_0x25bc85,null))[_0x2e35('0x44')](handleError(_0x25bc85,null));}; \ No newline at end of file +var _0x6338=['to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','pick','getActions','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6338,0x197));var _0x8633=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6338[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8633('0x0'));var zipdir=require(_0x8633('0x1'));var jsonpatch=require(_0x8633('0x2'));var rp=require(_0x8633('0x3'));var moment=require(_0x8633('0x4'));var BPromise=require(_0x8633('0x5'));var Mustache=require(_0x8633('0x6'));var util=require(_0x8633('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8633('0x8'));var ejs=require(_0x8633('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(_0x8633('0xa'));var deskjs=require(_0x8633('0xb'));var toCsv=require(_0x8633('0x8'));var querystring=require(_0x8633('0xc'));var Papa=require(_0x8633('0xd'));var Redis=require(_0x8633('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8633('0xf'));var as=require(_0x8633('0x10'));var hardwareService=require(_0x8633('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8633('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8633('0x13'));var db=require(_0x8633('0x14'))['db'];function respondWithStatusCode(_0x5ddd4b,_0x2f3803){_0x2f3803=_0x2f3803||0xcc;return function(_0x4fe29b){if(_0x4fe29b){return _0x5ddd4b['sendStatus'](_0x2f3803);}return _0x5ddd4b[_0x8633('0x15')](_0x2f3803)[_0x8633('0x16')]();};}function respondWithResult(_0xac1be1,_0x63fa8b){_0x63fa8b=_0x63fa8b||0xc8;return function(_0x507c38){if(_0x507c38){return _0xac1be1[_0x8633('0x15')](_0x63fa8b)[_0x8633('0x17')](_0x507c38);}};}function respondWithFilteredResult(_0x4593ee,_0x297b57){return function(_0xf280cf){if(_0xf280cf){var _0x205ebc=typeof _0x297b57[_0x8633('0x18')]===_0x8633('0x19')&&typeof _0x297b57[_0x8633('0x1a')]===_0x8633('0x19');var _0x11cbdf=_0xf280cf['count'];var _0x464246=_0x205ebc?0x0:_0x297b57[_0x8633('0x18')];var _0x4a995f=_0x205ebc?_0xf280cf[_0x8633('0x1b')]:_0x297b57[_0x8633('0x18')]+_0x297b57[_0x8633('0x1a')];var _0x9e19fc;if(_0x4a995f>=_0x11cbdf){_0x4a995f=_0x11cbdf;_0x9e19fc=0xc8;}else{_0x9e19fc=0xce;}_0x4593ee[_0x8633('0x15')](_0x9e19fc);return _0x4593ee[_0x8633('0x1c')](_0x8633('0x1d'),_0x464246+'-'+_0x4a995f+'/'+_0x11cbdf)['json'](_0xf280cf);}return null;};}function patchUpdates(_0x46cd95){return function(_0x39f60d){try{jsonpatch[_0x8633('0x1e')](_0x39f60d,_0x46cd95,!![]);}catch(_0xdce4e3){return BPromise[_0x8633('0x1f')](_0xdce4e3);}return _0x39f60d['save']();};}function saveUpdates(_0x4f2eca,_0x17c9dd){return function(_0x5eb28c){if(_0x5eb28c){return _0x5eb28c[_0x8633('0x20')](_0x4f2eca)[_0x8633('0x21')](function(_0x455f97){return _0x455f97;});}return null;};}function removeEntity(_0x57ac43,_0x28c31f){return function(_0x5db064){if(_0x5db064){return _0x5db064[_0x8633('0x22')]()[_0x8633('0x21')](function(){_0x57ac43[_0x8633('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44ca52,_0x3d0d45){return function(_0x4f939c){if(!_0x4f939c){_0x44ca52[_0x8633('0x23')](0x194);}return _0x4f939c;};}function handleError(_0x3ae588,_0x5b51f5){_0x5b51f5=_0x5b51f5||0x1f4;return function(_0x3d973f){logger[_0x8633('0x24')](_0x3d973f[_0x8633('0x25')]);if(_0x3d973f[_0x8633('0x26')]){delete _0x3d973f[_0x8633('0x26')];}_0x3ae588[_0x8633('0x15')](_0x5b51f5)[_0x8633('0x27')](_0x3d973f);};}exports[_0x8633('0x28')]=function(_0x53abf7,_0x5ef233){var _0x22eaf6={},_0x36fece={},_0x8ab118={'count':0x0,'rows':[]};var _0x3a51c9=_[_0x8633('0x29')](db[_0x8633('0x2a')]['rawAttributes'],function(_0x4f1793){return{'name':_0x4f1793[_0x8633('0x2b')],'type':_0x4f1793[_0x8633('0x2c')][_0x8633('0x2d')]};});_0x36fece[_0x8633('0x2e')]=_[_0x8633('0x29')](_0x3a51c9,'name');_0x36fece[_0x8633('0x2f')]=_['keys'](_0x53abf7[_0x8633('0x2f')]);_0x36fece[_0x8633('0x30')]=_['intersection'](_0x36fece[_0x8633('0x2e')],_0x36fece[_0x8633('0x2f')]);_0x22eaf6[_0x8633('0x31')]=_[_0x8633('0x32')](_0x36fece['model'],qs[_0x8633('0x33')](_0x53abf7['query']['fields']));_0x22eaf6[_0x8633('0x31')]=_0x22eaf6[_0x8633('0x31')][_0x8633('0x34')]?_0x22eaf6[_0x8633('0x31')]:_0x36fece['model'];if(!_0x53abf7[_0x8633('0x2f')][_0x8633('0x35')]('nolimit')){_0x22eaf6[_0x8633('0x1a')]=qs[_0x8633('0x1a')](_0x53abf7[_0x8633('0x2f')][_0x8633('0x1a')]);_0x22eaf6['offset']=qs[_0x8633('0x18')](_0x53abf7[_0x8633('0x2f')][_0x8633('0x18')]);}_0x22eaf6[_0x8633('0x36')]=qs[_0x8633('0x37')](_0x53abf7[_0x8633('0x2f')][_0x8633('0x37')]);_0x22eaf6['where']=qs[_0x8633('0x30')](_['pick'](_0x53abf7[_0x8633('0x2f')],_0x36fece[_0x8633('0x30')]),_0x3a51c9);if(_0x53abf7['query'][_0x8633('0x38')]){_0x22eaf6[_0x8633('0x39')]=_['merge'](_0x22eaf6['where'],{'$or':_[_0x8633('0x29')](_0x3a51c9,function(_0x5c9d9d){if(_0x5c9d9d[_0x8633('0x2c')]!==_0x8633('0x3a')){var _0x1953e2={};_0x1953e2[_0x5c9d9d[_0x8633('0x26')]]={'$like':'%'+_0x53abf7['query']['filter']+'%'};return _0x1953e2;}})});}_0x22eaf6=_[_0x8633('0x3b')]({},_0x22eaf6,_0x53abf7[_0x8633('0x3c')]);var _0x160e1b={'where':_0x22eaf6[_0x8633('0x39')]};return db[_0x8633('0x2a')][_0x8633('0x1b')](_0x160e1b)['then'](function(_0x200b79){_0x8ab118[_0x8633('0x1b')]=_0x200b79;if(_0x53abf7[_0x8633('0x2f')][_0x8633('0x3d')]){_0x22eaf6[_0x8633('0x3e')]=[{'all':!![]}];}return db[_0x8633('0x2a')]['findAll'](_0x22eaf6);})[_0x8633('0x21')](function(_0xf5bf1){_0x8ab118[_0x8633('0x3f')]=_0xf5bf1;return _0x8ab118;})[_0x8633('0x21')](respondWithFilteredResult(_0x5ef233,_0x22eaf6))[_0x8633('0x40')](handleError(_0x5ef233,null));};exports[_0x8633('0x41')]=function(_0x152739,_0x45934d){var _0x48bbb6={'raw':![],'where':{'id':_0x152739['params']['id']}},_0x286f49={};_0x286f49[_0x8633('0x2e')]=_[_0x8633('0x42')](db[_0x8633('0x2a')][_0x8633('0x43')]);_0x286f49['query']=_[_0x8633('0x42')](_0x152739['query']);_0x286f49[_0x8633('0x30')]=_[_0x8633('0x32')](_0x286f49[_0x8633('0x2e')],_0x286f49[_0x8633('0x2f')]);_0x48bbb6[_0x8633('0x31')]=_[_0x8633('0x32')](_0x286f49[_0x8633('0x2e')],qs[_0x8633('0x33')](_0x152739[_0x8633('0x2f')][_0x8633('0x33')]));_0x48bbb6[_0x8633('0x31')]=_0x48bbb6[_0x8633('0x31')][_0x8633('0x34')]?_0x48bbb6['attributes']:_0x286f49[_0x8633('0x2e')];if(_0x152739[_0x8633('0x2f')][_0x8633('0x3d')]){_0x48bbb6[_0x8633('0x3e')]=[{'all':!![]}];}_0x48bbb6=_['merge']({},_0x48bbb6,_0x152739[_0x8633('0x3c')]);return db['Automation'][_0x8633('0x44')](_0x48bbb6)[_0x8633('0x21')](handleEntityNotFound(_0x45934d,null))[_0x8633('0x21')](respondWithResult(_0x45934d,null))[_0x8633('0x40')](handleError(_0x45934d,null));};exports[_0x8633('0x45')]=function(_0x1251ba,_0xaa21a){return db[_0x8633('0x2a')][_0x8633('0x45')](_0x1251ba['body'],{})[_0x8633('0x21')](respondWithResult(_0xaa21a,0xc9))[_0x8633('0x40')](handleError(_0xaa21a,null));};exports[_0x8633('0x20')]=function(_0xa92ef3,_0x49be23){if(_0xa92ef3[_0x8633('0x46')]['id']){delete _0xa92ef3['body']['id'];}return db[_0x8633('0x2a')][_0x8633('0x44')]({'where':{'id':_0xa92ef3[_0x8633('0x47')]['id']}})['then'](handleEntityNotFound(_0x49be23,null))[_0x8633('0x21')](saveUpdates(_0xa92ef3[_0x8633('0x46')],null))[_0x8633('0x21')](respondWithResult(_0x49be23,null))[_0x8633('0x40')](handleError(_0x49be23,null));};exports[_0x8633('0x22')]=function(_0x29f2dc,_0x47a323){return db[_0x8633('0x2a')][_0x8633('0x44')]({'where':{'id':_0x29f2dc[_0x8633('0x47')]['id']}})[_0x8633('0x21')](handleEntityNotFound(_0x47a323,null))[_0x8633('0x21')](removeEntity(_0x47a323,null))[_0x8633('0x40')](handleError(_0x47a323,null));};exports[_0x8633('0x48')]=function(_0x413ad9,_0x241039,_0x6430b0){return db[_0x8633('0x49')][_0x8633('0x44')]({'where':{'id':_0x413ad9[_0x8633('0x47')]['id']}})['then'](handleEntityNotFound(_0x241039,null))[_0x8633('0x21')](function(_0x4aea68){if(_0x4aea68){return _0x4aea68[_0x8633('0x48')](_0x413ad9[_0x8633('0x46')][_0x8633('0x4a')],_[_0x8633('0x4b')](_0x413ad9[_0x8633('0x46')],['ids','id'])||{});}})[_0x8633('0x21')](respondWithResult(_0x241039,null))['catch'](handleError(_0x241039,null));};exports[_0x8633('0x4c')]=function(_0x2594b8,_0x255b40,_0x493479){var _0x19c1a6={};var _0x2cb3c2={};var _0x4645d4;var _0x5d5474;return db[_0x8633('0x2a')][_0x8633('0x4d')]({'where':{'id':_0x2594b8['params']['id']}})[_0x8633('0x21')](handleEntityNotFound(_0x255b40,null))['then'](function(_0x45942a){if(_0x45942a){_0x4645d4=_0x45942a;_0x2cb3c2[_0x8633('0x2e')]=_[_0x8633('0x42')](db[_0x8633('0x49')]['rawAttributes']);_0x2cb3c2['query']=_[_0x8633('0x42')](_0x2594b8[_0x8633('0x2f')]);_0x2cb3c2[_0x8633('0x30')]=_[_0x8633('0x32')](_0x2cb3c2[_0x8633('0x2e')],_0x2cb3c2[_0x8633('0x2f')]);_0x19c1a6[_0x8633('0x31')]=_[_0x8633('0x32')](_0x2cb3c2[_0x8633('0x2e')],qs[_0x8633('0x33')](_0x2594b8['query'][_0x8633('0x33')]));_0x19c1a6[_0x8633('0x31')]=_0x19c1a6['attributes'][_0x8633('0x34')]?_0x19c1a6[_0x8633('0x31')]:_0x2cb3c2[_0x8633('0x2e')];_0x19c1a6[_0x8633('0x36')]=qs[_0x8633('0x37')](_0x2594b8[_0x8633('0x2f')]['sort']);_0x19c1a6[_0x8633('0x39')]=qs['filters'](_['pick'](_0x2594b8[_0x8633('0x2f')],_0x2cb3c2[_0x8633('0x30')]));if(_0x2594b8['query'][_0x8633('0x38')]){_0x19c1a6[_0x8633('0x39')]=_['merge'](_0x19c1a6[_0x8633('0x39')],{'$or':_[_0x8633('0x29')](_0x19c1a6['attributes'],function(_0x198d3d){var _0x2620ed={};_0x2620ed[_0x198d3d]={'$like':'%'+_0x2594b8['query'][_0x8633('0x38')]+'%'};return _0x2620ed;})});}_0x19c1a6=_[_0x8633('0x3b')]({},_0x19c1a6,_0x2594b8[_0x8633('0x3c')]);return _0x4645d4[_0x8633('0x4c')](_0x19c1a6);}})[_0x8633('0x21')](function(_0x144258){if(_0x144258){_0x5d5474=_0x144258[_0x8633('0x34')];if(!_0x2594b8[_0x8633('0x2f')][_0x8633('0x35')]('nolimit')){_0x19c1a6[_0x8633('0x1a')]=qs[_0x8633('0x1a')](_0x2594b8[_0x8633('0x2f')][_0x8633('0x1a')]);_0x19c1a6[_0x8633('0x18')]=qs[_0x8633('0x18')](_0x2594b8[_0x8633('0x2f')]['offset']);}return _0x4645d4[_0x8633('0x4c')](_0x19c1a6);}})[_0x8633('0x21')](function(_0x4fee0d){if(_0x4fee0d){return _0x4fee0d?{'count':_0x5d5474,'rows':_0x4fee0d}:null;}})[_0x8633('0x21')](respondWithResult(_0x255b40,null))[_0x8633('0x40')](handleError(_0x255b40,null));};exports[_0x8633('0x4e')]=function(_0x243247,_0x5dde08,_0x1979b8){return db[_0x8633('0x4f')]['find']({'where':{'id':_0x243247[_0x8633('0x47')]['id']}})[_0x8633('0x21')](handleEntityNotFound(_0x5dde08,null))[_0x8633('0x21')](function(_0x49a86f){if(_0x49a86f){return _0x49a86f[_0x8633('0x4e')](_0x243247[_0x8633('0x46')]['ids'],_['omit'](_0x243247['body'],[_0x8633('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x5dde08,null))[_0x8633('0x40')](handleError(_0x5dde08,null));};exports['getActions']=function(_0x4f9053,_0x270c00,_0x2ab8d3){var _0x288a37={};var _0x28a6f5={};var _0x66fe9a;var _0x3d52ec;return db[_0x8633('0x2a')][_0x8633('0x4d')]({'where':{'id':_0x4f9053['params']['id']}})[_0x8633('0x21')](handleEntityNotFound(_0x270c00,null))[_0x8633('0x21')](function(_0x4bdd57){if(_0x4bdd57){_0x66fe9a=_0x4bdd57;_0x28a6f5[_0x8633('0x2e')]=_['keys'](db[_0x8633('0x4f')][_0x8633('0x43')]);_0x28a6f5[_0x8633('0x2f')]=_[_0x8633('0x42')](_0x4f9053[_0x8633('0x2f')]);_0x28a6f5['filters']=_['intersection'](_0x28a6f5[_0x8633('0x2e')],_0x28a6f5[_0x8633('0x2f')]);_0x288a37[_0x8633('0x31')]=_[_0x8633('0x32')](_0x28a6f5[_0x8633('0x2e')],qs['fields'](_0x4f9053['query'][_0x8633('0x33')]));_0x288a37[_0x8633('0x31')]=_0x288a37[_0x8633('0x31')][_0x8633('0x34')]?_0x288a37['attributes']:_0x28a6f5['model'];_0x288a37['order']=qs[_0x8633('0x37')](_0x4f9053[_0x8633('0x2f')][_0x8633('0x37')]);_0x288a37[_0x8633('0x39')]=qs[_0x8633('0x30')](_[_0x8633('0x50')](_0x4f9053[_0x8633('0x2f')],_0x28a6f5['filters']));if(_0x4f9053[_0x8633('0x2f')][_0x8633('0x38')]){_0x288a37['where']=_[_0x8633('0x3b')](_0x288a37[_0x8633('0x39')],{'$or':_[_0x8633('0x29')](_0x288a37[_0x8633('0x31')],function(_0x352b0d){var _0x151797={};_0x151797[_0x352b0d]={'$like':'%'+_0x4f9053['query'][_0x8633('0x38')]+'%'};return _0x151797;})});}_0x288a37=_[_0x8633('0x3b')]({},_0x288a37,_0x4f9053[_0x8633('0x3c')]);return _0x66fe9a[_0x8633('0x51')](_0x288a37);}})['then'](function(_0x2ad36b){if(_0x2ad36b){_0x3d52ec=_0x2ad36b['length'];if(!_0x4f9053[_0x8633('0x2f')][_0x8633('0x35')](_0x8633('0x52'))){_0x288a37[_0x8633('0x1a')]=qs[_0x8633('0x1a')](_0x4f9053['query'][_0x8633('0x1a')]);_0x288a37['offset']=qs[_0x8633('0x18')](_0x4f9053[_0x8633('0x2f')]['offset']);}return _0x66fe9a[_0x8633('0x51')](_0x288a37);}})['then'](function(_0x3224c2){if(_0x3224c2){return _0x3224c2?{'count':_0x3d52ec,'rows':_0x3224c2}:null;}})[_0x8633('0x21')](respondWithResult(_0x270c00,null))['catch'](handleError(_0x270c00,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2967169..0cc12b7 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 _0xa1ef=['tools_automations','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa1ef,0x13c));var _0xfa1e=function(_0x1c5db9,_0x2ec26d){_0x1c5db9=_0x1c5db9-0x0;var _0x34ebeb=_0xa1ef[_0x1c5db9];return _0x34ebeb;};'use strict';var _=require(_0xfa1e('0x0'));var util=require('util');var logger=require(_0xfa1e('0x1'))('api');var moment=require(_0xfa1e('0x2'));var BPromise=require(_0xfa1e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfa1e('0x4'));var config=require(_0xfa1e('0x5'));var attributes=require(_0xfa1e('0x6'));module[_0xfa1e('0x7')]=function(_0xcc307a,_0x307f19){return _0xcc307a['define']('Automation',attributes,{'tableName':_0xfa1e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfabc=['bluebird','request-promise','path','rimraf','../../config/environment','define','Automation','lodash','../../config/logger','api','moment'];(function(_0xe9a5bb,_0x1e2fe8){var _0x56fbad=function(_0x5856bf){while(--_0x5856bf){_0xe9a5bb['push'](_0xe9a5bb['shift']());}};_0x56fbad(++_0x1e2fe8);}(_0xfabc,0x19e));var _0xcfab=function(_0x23a70f,_0x5c5a99){_0x23a70f=_0x23a70f-0x0;var _0x42ac61=_0xfabc[_0x23a70f];return _0x42ac61;};'use strict';var _=require(_0xcfab('0x0'));var util=require('util');var logger=require(_0xcfab('0x1'))(_0xcfab('0x2'));var moment=require(_0xcfab('0x3'));var BPromise=require(_0xcfab('0x4'));var rp=require(_0xcfab('0x5'));var fs=require('fs');var path=require(_0xcfab('0x6'));var rimraf=require(_0xcfab('0x7'));var config=require(_0xcfab('0x8'));var attributes=require('./automation.attributes');module['exports']=function(_0x2bec16,_0x4b5b45){return _0x2bec16[_0xcfab('0x9')](_0xcfab('0xa'),attributes,{'tableName':'tools_automations','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 378e908..4704a38 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 _0x9c9b=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x613e6d,_0x2035c4){var _0x44e722=function(_0x1fc96e){while(--_0x1fc96e){_0x613e6d['push'](_0x613e6d['shift']());}};_0x44e722(++_0x2035c4);}(_0x9c9b,0x194));var _0xb9c9=function(_0x3b5796,_0x3160c5){_0x3b5796=_0x3b5796-0x0;var _0x9633cf=_0x9c9b[_0x3b5796];return _0x9633cf;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var moment=require(_0xb9c9('0x1'));var BPromise=require(_0xb9c9('0x2'));var rs=require(_0xb9c9('0x3'));var fs=require('fs');var Redis=require(_0xb9c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c9('0x5'));var logger=require(_0xb9c9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb9c9('0x7')][_0xb9c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x726f01,_0x3ccb91,_0x16158b){return new BPromise(function(_0x9dc3da,_0x32ff81){return client[_0xb9c9('0x9')](_0x726f01,_0x16158b)[_0xb9c9('0xa')](function(_0x131b42){logger[_0xb9c9('0xb')](_0xb9c9('0xc'),_0x3ccb91,_0xb9c9('0xd'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3ccb91,_0xb9c9('0xd'),JSON[_0xb9c9('0xe')](_0x131b42));if(_0x131b42[_0xb9c9('0xf')]){if(_0x131b42[_0xb9c9('0xf')][_0xb9c9('0x10')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x3ccb91,_0x131b42['error'][_0xb9c9('0x11')]);return _0x32ff81(_0x131b42['error'][_0xb9c9('0x11')]);}logger[_0xb9c9('0xf')]('Automation,\x20%s,\x20%s',_0x3ccb91,_0x131b42['error'][_0xb9c9('0x11')]);return _0x9dc3da(_0x131b42[_0xb9c9('0xf')][_0xb9c9('0x11')]);}else{logger['info'](_0xb9c9('0xc'),_0x3ccb91,_0xb9c9('0xd'));_0x9dc3da(_0x131b42[_0xb9c9('0x12')][_0xb9c9('0x11')]);}})[_0xb9c9('0x13')](function(_0x49f17c){logger[_0xb9c9('0xf')](_0xb9c9('0xc'),_0x3ccb91,_0x49f17c);_0x32ff81(_0x49f17c);});});} \ No newline at end of file +var _0xfb0b=['../../config/environment','jayson/promise','client','http','request','then','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger'];(function(_0x37f2a7,_0x4c881c){var _0x5d6541=function(_0x5ed84a){while(--_0x5ed84a){_0x37f2a7['push'](_0x37f2a7['shift']());}};_0x5d6541(++_0x4c881c);}(_0xfb0b,0x94));var _0xbfb0=function(_0x1b1c94,_0x40e8d5){_0x1b1c94=_0x1b1c94-0x0;var _0x57b231=_0xfb0b[_0x1b1c94];return _0x57b231;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var moment=require(_0xbfb0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x3'));var fs=require('fs');var Redis=require(_0xbfb0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfb0('0x5'))('rpc');var config=require(_0xbfb0('0x6'));var jayson=require(_0xbfb0('0x7'));var client=jayson[_0xbfb0('0x8')][_0xbfb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3840,_0x46166a,_0x52eba3){return new BPromise(function(_0x3491c7,_0x1afe32){return client[_0xbfb0('0xa')](_0x2b3840,_0x52eba3)[_0xbfb0('0xb')](function(_0x4c2cee){logger['info']('Automation,\x20%s,\x20%s',_0x46166a,'request\x20sent');logger[_0xbfb0('0xc')](_0xbfb0('0xd'),_0x46166a,_0xbfb0('0xe'),JSON['stringify'](_0x4c2cee));if(_0x4c2cee[_0xbfb0('0xf')]){if(_0x4c2cee['error'][_0xbfb0('0x10')]===0x1f4){logger[_0xbfb0('0xf')](_0xbfb0('0x11'),_0x46166a,_0x4c2cee[_0xbfb0('0xf')][_0xbfb0('0x12')]);return _0x1afe32(_0x4c2cee[_0xbfb0('0xf')]['message']);}logger[_0xbfb0('0xf')]('Automation,\x20%s,\x20%s',_0x46166a,_0x4c2cee['error']['message']);return _0x3491c7(_0x4c2cee[_0xbfb0('0xf')][_0xbfb0('0x12')]);}else{logger[_0xbfb0('0x13')](_0xbfb0('0x11'),_0x46166a,_0xbfb0('0xe'));_0x3491c7(_0x4c2cee[_0xbfb0('0x14')][_0xbfb0('0x12')]);}})[_0xbfb0('0x15')](function(_0x315b80){logger[_0xbfb0('0xf')](_0xbfb0('0x11'),_0x46166a,_0x315b80);_0x1afe32(_0x315b80);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index bfdf6bf..98e6c4c 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 _0xa25a=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','put','delete','destroy','exports'];(function(_0x4f4c8c,_0x14aefa){var _0x1a3c9c=function(_0x570a47){while(--_0x570a47){_0x4f4c8c['push'](_0x4f4c8c['shift']());}};_0x1a3c9c(++_0x14aefa);}(_0xa25a,0x160));var _0xaa25=function(_0x45e841,_0x4bab77){_0x45e841=_0x45e841-0x0;var _0x520d9b=_0xa25a[_0x45e841];return _0x520d9b;};'use strict';var multer=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var path=require(_0xaa25('0x2'));var timeout=require(_0xaa25('0x3'));var express=require(_0xaa25('0x4'));var router=express[_0xaa25('0x5')]();var fs_extra=require(_0xaa25('0x6'));var auth=require(_0xaa25('0x7'));var interaction=require(_0xaa25('0x8'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0xaa25('0x9')]('/',auth[_0xaa25('0xa')](),controller['index']);router[_0xaa25('0x9')](_0xaa25('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaa25('0x9')](_0xaa25('0xc'),auth['isAuthenticated'](),controller[_0xaa25('0xd')]);router['get'](_0xaa25('0xe'),auth['isAuthenticated'](),controller[_0xaa25('0xf')]);router[_0xaa25('0x10')]('/',auth['isAuthenticated'](),controller[_0xaa25('0x11')]);router[_0xaa25('0x10')]('/:id/conditions',auth[_0xaa25('0xa')](),controller['addConditions']);router['post'](_0xaa25('0xe'),auth[_0xaa25('0xa')](),controller['addActions']);router[_0xaa25('0x12')]('/:id',auth[_0xaa25('0xa')](),controller['update']);router[_0xaa25('0x13')](_0xaa25('0xb'),auth[_0xaa25('0xa')](),controller[_0xaa25('0x14')]);module[_0xaa25('0x15')]=router; \ No newline at end of file +var _0x64b3=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x64b3,0x1de));var _0x364b=function(_0x3a0131,_0x1020c2){_0x3a0131=_0x3a0131-0x0;var _0x432541=_0x64b3[_0x3a0131];return _0x432541;};'use strict';var multer=require(_0x364b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x364b('0x1'));var express=require(_0x364b('0x2'));var router=express[_0x364b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x364b('0x4'));var interaction=require(_0x364b('0x5'));var config=require(_0x364b('0x6'));var controller=require(_0x364b('0x7'));router[_0x364b('0x8')]('/',auth[_0x364b('0x9')](),controller['index']);router['get'](_0x364b('0xa'),auth[_0x364b('0x9')](),controller[_0x364b('0xb')]);router[_0x364b('0x8')](_0x364b('0xc'),auth[_0x364b('0x9')](),controller[_0x364b('0xd')]);router[_0x364b('0x8')](_0x364b('0xe'),auth[_0x364b('0x9')](),controller[_0x364b('0xf')]);router[_0x364b('0x10')]('/',auth[_0x364b('0x9')](),controller[_0x364b('0x11')]);router[_0x364b('0x10')]('/:id/conditions',auth[_0x364b('0x9')](),controller[_0x364b('0x12')]);router[_0x364b('0x10')](_0x364b('0xe'),auth[_0x364b('0x9')](),controller[_0x364b('0x13')]);router[_0x364b('0x14')]('/:id',auth[_0x364b('0x9')](),controller[_0x364b('0x15')]);router[_0x364b('0x16')](_0x364b('0xa'),auth[_0x364b('0x9')](),controller[_0x364b('0x17')]);module[_0x364b('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3a2c598..2502ed1 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 _0x8a80=['#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)','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x8a80,0x1c1));var _0x08a8=function(_0x2b321c,_0x525b85){_0x2b321c=_0x2b321c-0x0;var _0x2d8312=_0x8a80[_0x2b321c];return _0x2d8312;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x08a8('0x0')],'unique':_0x08a8('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x08a8('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x08a8('0x0')]},'active':{'type':Sequelize[_0x08a8('0x3')],'defaultValue':0x0,'comment':_0x08a8('0x4')},'limitCalls':{'type':Sequelize[_0x08a8('0x5')](0x4)[_0x08a8('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x08a8('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x08a8('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x08a8('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08a8('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x08a8('0x5')](0x3)[_0x08a8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08a8('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x08a8('0x5')](0x5)[_0x08a8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x08a8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08a8('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x08a8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x08a8('0x5')](0x3)[_0x08a8('0x6')],'defaultValue':0x3,'comment':_0x08a8('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x08a8('0x5')](0x5)[_0x08a8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x08a8('0x5')](0x3)[_0x08a8('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x08a8('0xf')},'dialTimezone':{'type':Sequelize[_0x08a8('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x08a8('0x0')],'defaultValue':_0x08a8('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x08a8('0x11')](_0x08a8('0x12'),_0x08a8('0x13'),_0x08a8('0x14')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x08a8('0x3')],'defaultValue':0x0,'comment':_0x08a8('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x08a8('0x16')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x08a8('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x08a8('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x08a8('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x08a8('0x5')](0x9)[_0x08a8('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x08a8('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x08a8('0x5')](0x9)[_0x08a8('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x08a8('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x08a8('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x08a8('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x08a8('0x5')](0x5)[_0x08a8('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x08a8('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x08a8('0x5')](0x9)[_0x08a8('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x08a8('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x08a8('0x11')](_0x08a8('0x1c'),_0x08a8('0x1d')),'defaultValue':_0x08a8('0x1c')},'dialPrefix':{'type':Sequelize[_0x08a8('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x08a8('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x08a8('0x1e')},'dialCutDigit':{'type':Sequelize[_0x08a8('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x08a8('0x5')](0x3)[_0x08a8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08a8('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x08a8('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x08a8('0x5')](0x3)[_0x08a8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08a8('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x08a8('0x5')](0x5)[_0x08a8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x08a8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x08a8('0x5')](0x5)[_0x08a8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x08a8('0x5')](0x3)[_0x08a8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08a8('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x08a8('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x08a8('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x08a8('0x5')](0x5)[_0x08a8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x08a8('0x27')}}; \ No newline at end of file +var _0xaf68=['onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xaf68,0xbc));var _0x8af6=function(_0x241d33,_0x36a983){_0x241d33=_0x241d33-0x0;var _0x15a313=_0xaf68[_0x241d33];return _0x15a313;};'use strict';var Sequelize=require(_0x8af6('0x0'));module[_0x8af6('0x1')]={'name':{'type':Sequelize[_0x8af6('0x2')],'unique':_0x8af6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x8af6('0x2')]},'active':{'type':Sequelize[_0x8af6('0x4')],'defaultValue':0x0,'comment':_0x8af6('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8af6('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8af6('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8af6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8af6('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'comment':_0x8af6('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0xb')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8af6('0xc')},'dialTimezone':{'type':Sequelize[_0x8af6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8af6('0xd')](_0x8af6('0xe'),_0x8af6('0xf'),_0x8af6('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x8af6('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8af6('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x8af6('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8af6('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8af6('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8af6('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8af6('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8af6('0x8')](0x9)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8af6('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8af6('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8af6('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8af6('0xd')](_0x8af6('0x16'),_0x8af6('0x17')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x8af6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8af6('0x18')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8af6('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x8af6('0x8')](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8af6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8af6('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8af6('0x8')](0x5)[_0x8af6('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8af6('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 854738d..141d5d9 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 _0x9990=['get','IvrCampaigns','UserProfileResource','error','name','send','index','map','Campaign','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','destroy','findOne','nolimit','CampaignId','CmHopper','rows','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','field','phone','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','CampaignId\x20=\x20?','cmHopperId','ci.item','ci.OrderBY','OrderBy','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then'];(function(_0x3ca2df,_0x27ee97){var _0x14e23a=function(_0x5d9e52){while(--_0x5d9e52){_0x3ca2df['push'](_0x3ca2df['shift']());}};_0x14e23a(++_0x27ee97);}(_0x9990,0xf6));var _0x0999=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x9990[_0x333798];return _0x389f4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0999('0x0'));var zipdir=require(_0x0999('0x1'));var jsonpatch=require(_0x0999('0x2'));var rp=require(_0x0999('0x3'));var moment=require(_0x0999('0x4'));var BPromise=require(_0x0999('0x5'));var Mustache=require(_0x0999('0x6'));var util=require(_0x0999('0x7'));var path=require('path');var sox=require(_0x0999('0x8'));var csv=require(_0x0999('0x9'));var ejs=require(_0x0999('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0999('0xb'));var squel=require(_0x0999('0xc'));var crypto=require(_0x0999('0xd'));var jsforce=require(_0x0999('0xe'));var deskjs=require(_0x0999('0xf'));var toCsv=require(_0x0999('0x9'));var querystring=require(_0x0999('0x10'));var Papa=require('papaparse');var Redis=require(_0x0999('0x11'));var authService=require(_0x0999('0x12'));var qs=require(_0x0999('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0999('0x14'));var logger=require(_0x0999('0x15'))(_0x0999('0x16'));var utils=require('../../config/utils');var config=require(_0x0999('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0999('0x18'))['db'];function respondWithStatusCode(_0x36133e,_0x2ea251){_0x2ea251=_0x2ea251||0xcc;return function(_0x428b59){if(_0x428b59){return _0x36133e[_0x0999('0x19')](_0x2ea251);}return _0x36133e['status'](_0x2ea251)[_0x0999('0x1a')]();};}function respondWithResult(_0x2fa8e0,_0x39cba9){_0x39cba9=_0x39cba9||0xc8;return function(_0x4011bf){if(_0x4011bf){return _0x2fa8e0[_0x0999('0x1b')](_0x39cba9)['json'](_0x4011bf);}};}function respondWithFilteredResult(_0x137083,_0x3757ae){return function(_0x6bf882){if(_0x6bf882){var _0x4e4e53=typeof _0x3757ae[_0x0999('0x1c')]===_0x0999('0x1d')&&typeof _0x3757ae[_0x0999('0x1e')]==='undefined';var _0xa82828=_0x6bf882[_0x0999('0x1f')];var _0x4f6440=_0x4e4e53?0x0:_0x3757ae[_0x0999('0x1c')];var _0x5b14a3=_0x4e4e53?_0x6bf882['count']:_0x3757ae[_0x0999('0x1c')]+_0x3757ae[_0x0999('0x1e')];var _0x220cc3;if(_0x5b14a3>=_0xa82828){_0x5b14a3=_0xa82828;_0x220cc3=0xc8;}else{_0x220cc3=0xce;}_0x137083[_0x0999('0x1b')](_0x220cc3);return _0x137083[_0x0999('0x20')](_0x0999('0x21'),_0x4f6440+'-'+_0x5b14a3+'/'+_0xa82828)[_0x0999('0x22')](_0x6bf882);}return null;};}function patchUpdates(_0x113017){return function(_0x8a5ef6){try{jsonpatch['apply'](_0x8a5ef6,_0x113017,!![]);}catch(_0xe118ec){return BPromise[_0x0999('0x23')](_0xe118ec);}return _0x8a5ef6['save']();};}function saveUpdates(_0x505372,_0x19ddc0){return function(_0xf2820c){if(_0xf2820c){return _0xf2820c[_0x0999('0x24')](_0x505372)[_0x0999('0x25')](function(_0x6c9bd9){return _0x6c9bd9;});}return null;};}function removeEntity(_0x15a7e8,_0x4d4f38){return function(_0x20ba88){if(_0x20ba88){return _0x20ba88['destroy']()[_0x0999('0x25')](function(){var _0x5618b3=_0x20ba88[_0x0999('0x26')]({'plain':!![]});var _0x106669=_0x0999('0x27');return db[_0x0999('0x28')]['destroy']({'where':{'type':_0x106669,'resourceId':_0x5618b3['id']}})['then'](function(){return _0x20ba88;});})[_0x0999('0x25')](function(){_0x15a7e8['status'](0xcc)[_0x0999('0x1a')]();});}};}function handleEntityNotFound(_0x4ba497,_0x2273ad){return function(_0x85cd84){if(!_0x85cd84){_0x4ba497[_0x0999('0x19')](0x194);}return _0x85cd84;};}function handleError(_0xf63dc7,_0x358f45){_0x358f45=_0x358f45||0x1f4;return function(_0x155d79){logger[_0x0999('0x29')](_0x155d79['stack']);if(_0x155d79[_0x0999('0x2a')]){delete _0x155d79[_0x0999('0x2a')];}_0xf63dc7[_0x0999('0x1b')](_0x358f45)[_0x0999('0x2b')](_0x155d79);};}exports[_0x0999('0x2c')]=function(_0x552f69,_0x106bf9){var _0x1cc07f={},_0x11c884={},_0x50f12d={'count':0x0,'rows':[]};var _0x586644=_[_0x0999('0x2d')](db[_0x0999('0x2e')]['rawAttributes'],function(_0xdf8b8b){return{'name':_0xdf8b8b[_0x0999('0x2f')],'type':_0xdf8b8b[_0x0999('0x30')]['key']};});_0x11c884[_0x0999('0x31')]=_['map'](_0x586644,_0x0999('0x2a'));_0x11c884[_0x0999('0x32')]=_[_0x0999('0x33')](_0x552f69[_0x0999('0x32')]);_0x11c884[_0x0999('0x34')]=_['intersection'](_0x11c884['model'],_0x11c884[_0x0999('0x32')]);_0x1cc07f[_0x0999('0x35')]=_[_0x0999('0x36')](_0x11c884[_0x0999('0x31')],qs['fields'](_0x552f69[_0x0999('0x32')][_0x0999('0x37')]));_0x1cc07f['attributes']=_0x1cc07f[_0x0999('0x35')][_0x0999('0x38')]?_0x1cc07f[_0x0999('0x35')]:_0x11c884[_0x0999('0x31')];if(!_0x552f69[_0x0999('0x32')][_0x0999('0x39')]('nolimit')){_0x1cc07f[_0x0999('0x1e')]=qs['limit'](_0x552f69[_0x0999('0x32')][_0x0999('0x1e')]);_0x1cc07f[_0x0999('0x1c')]=qs['offset'](_0x552f69[_0x0999('0x32')][_0x0999('0x1c')]);}_0x1cc07f[_0x0999('0x3a')]=qs[_0x0999('0x3b')](_0x552f69[_0x0999('0x32')][_0x0999('0x3b')]);_0x1cc07f[_0x0999('0x3c')]=qs[_0x0999('0x34')](_[_0x0999('0x3d')](_0x552f69[_0x0999('0x32')],_0x11c884['filters']),_0x586644);if(_0x552f69[_0x0999('0x32')][_0x0999('0x3e')]){_0x1cc07f['where']=_[_0x0999('0x3f')](_0x1cc07f[_0x0999('0x3c')],{'$or':_[_0x0999('0x2d')](_0x586644,function(_0xb96f4a){if(_0xb96f4a[_0x0999('0x30')]!=='VIRTUAL'){var _0x16820b={};_0x16820b[_0xb96f4a[_0x0999('0x2a')]]={'$like':'%'+_0x552f69[_0x0999('0x32')]['filter']+'%'};return _0x16820b;}})});}_0x1cc07f=_[_0x0999('0x3f')]({},_0x1cc07f,_0x552f69[_0x0999('0x40')]);var _0x2600e1={'where':_0x1cc07f[_0x0999('0x3c')]};return db[_0x0999('0x2e')][_0x0999('0x1f')](_0x2600e1)[_0x0999('0x25')](function(_0x315ca3){_0x50f12d[_0x0999('0x1f')]=_0x315ca3;if(_0x552f69[_0x0999('0x32')][_0x0999('0x41')]){_0x1cc07f[_0x0999('0x42')]=[{'all':!![]}];}return db['Campaign'][_0x0999('0x43')](_0x1cc07f);})[_0x0999('0x25')](function(_0x47edb3){_0x50f12d['rows']=_0x47edb3;return _0x50f12d;})[_0x0999('0x25')](respondWithFilteredResult(_0x106bf9,_0x1cc07f))['catch'](handleError(_0x106bf9,null));};exports['show']=function(_0x119722,_0x5e6bdf){var _0x144507={'raw':![],'where':{'id':_0x119722[_0x0999('0x44')]['id']}},_0xdf9219={};_0xdf9219[_0x0999('0x31')]=_[_0x0999('0x33')](db[_0x0999('0x2e')][_0x0999('0x45')]);_0xdf9219[_0x0999('0x32')]=_[_0x0999('0x33')](_0x119722['query']);_0xdf9219['filters']=_[_0x0999('0x36')](_0xdf9219[_0x0999('0x31')],_0xdf9219[_0x0999('0x32')]);_0x144507[_0x0999('0x35')]=_[_0x0999('0x36')](_0xdf9219[_0x0999('0x31')],qs[_0x0999('0x37')](_0x119722[_0x0999('0x32')]['fields']));_0x144507['attributes']=_0x144507[_0x0999('0x35')][_0x0999('0x38')]?_0x144507['attributes']:_0xdf9219[_0x0999('0x31')];if(_0x119722['query']['includeAll']){_0x144507[_0x0999('0x42')]=[{'all':!![]}];}_0x144507=_[_0x0999('0x3f')]({},_0x144507,_0x119722[_0x0999('0x40')]);return db[_0x0999('0x2e')][_0x0999('0x46')](_0x144507)[_0x0999('0x25')](handleEntityNotFound(_0x5e6bdf,null))[_0x0999('0x25')](respondWithResult(_0x5e6bdf,null))[_0x0999('0x47')](handleError(_0x5e6bdf,null));};exports[_0x0999('0x48')]=function(_0x508e42,_0x2ee544){return db[_0x0999('0x2e')][_0x0999('0x48')](_0x508e42[_0x0999('0x49')],{})[_0x0999('0x25')](function(_0x2e0e6b){var _0x3a51d1=_0x508e42[_0x0999('0x4a')][_0x0999('0x26')]({'plain':!![]});if(!_0x3a51d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a51d1[_0x0999('0x4b')]==='user'){var _0x28924a=_0x2e0e6b[_0x0999('0x26')]({'plain':!![]});var _0x318345=_0x0999('0x27');return db[_0x0999('0x4c')]['find']({'where':{'name':_0x318345,'userProfileId':_0x3a51d1[_0x0999('0x4d')]},'raw':!![]})[_0x0999('0x25')](function(_0x3de0bf){if(_0x3de0bf&&_0x3de0bf[_0x0999('0x4e')]===0x0){return db[_0x0999('0x28')][_0x0999('0x48')]({'name':_0x28924a['name'],'resourceId':_0x28924a['id'],'type':_0x3de0bf[_0x0999('0x2a')],'sectionId':_0x3de0bf['id']},{})[_0x0999('0x25')](function(){return _0x2e0e6b;});}else{return _0x2e0e6b;}})[_0x0999('0x47')](function(_0x2113e8){logger[_0x0999('0x29')](_0x0999('0x4f'),_0x2113e8);throw _0x2113e8;});}return _0x2e0e6b;})[_0x0999('0x25')](respondWithResult(_0x2ee544,0xc9))['catch'](handleError(_0x2ee544,null));};exports[_0x0999('0x50')]=function(_0x1df925,_0x7039aa){var _0x18c346={'where':{'id':_0x1df925[_0x0999('0x44')]['id']}},_0x49fdef={};_0x49fdef[_0x0999('0x31')]=_[_0x0999('0x33')](db['Campaign'][_0x0999('0x45')]);_0x18c346[_0x0999('0x35')]=_[_0x0999('0x36')](_0x49fdef['model'],qs[_0x0999('0x37')](_0x1df925[_0x0999('0x32')][_0x0999('0x37')]));_0x18c346[_0x0999('0x35')]=_0x18c346[_0x0999('0x35')][_0x0999('0x38')]?_0x18c346[_0x0999('0x35')]:_0x49fdef[_0x0999('0x31')];if(_0x1df925[_0x0999('0x32')]['includeAll']){_0x18c346[_0x0999('0x42')]=[{'all':!![]}];}_0x18c346=_[_0x0999('0x3f')]({},_0x18c346,_0x1df925[_0x0999('0x40')]);return db[_0x0999('0x2e')][_0x0999('0x46')](_0x18c346)['then'](handleEntityNotFound(_0x7039aa,null))['then'](function(_0x295376){if(_0x295376){var _0x194a81=_0x295376['get']({'plain':!![]});_0x194a81=qs['omit'](_0x194a81,['id','createdAt',_0x0999('0x51')]);_0x1df925[_0x0999('0x49')]=_[_0x0999('0x52')](_0x1df925[_0x0999('0x49')],['id',_0x0999('0x53'),_0x0999('0x51')]);return db[_0x0999('0x2e')][_0x0999('0x48')](_[_0x0999('0x3f')](_0x194a81,_0x1df925['body']),{'include':_0x1df925[_0x0999('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x0999('0x25')](function(_0x13f9c4){var _0x466a10=_0x1df925[_0x0999('0x4a')][_0x0999('0x26')]({'plain':!![]});if(!_0x466a10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x466a10['role']===_0x0999('0x4a')){var _0xfebea3=_0x13f9c4[_0x0999('0x26')]({'plain':!![]});var _0x23e16b=_0x0999('0x27');return db['UserProfileSection'][_0x0999('0x46')]({'where':{'name':_0x23e16b,'userProfileId':_0x466a10[_0x0999('0x4d')]},'raw':!![]})[_0x0999('0x25')](function(_0x27a4ae){if(_0x27a4ae&&_0x27a4ae[_0x0999('0x4e')]===0x0){return db[_0x0999('0x28')][_0x0999('0x48')]({'name':_0xfebea3[_0x0999('0x2a')],'resourceId':_0xfebea3['id'],'type':_0x27a4ae[_0x0999('0x2a')],'sectionId':_0x27a4ae['id']},{})[_0x0999('0x25')](function(){return _0x13f9c4;});}else{return _0x13f9c4;}})['catch'](function(_0x182d8b){logger[_0x0999('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x182d8b);throw _0x182d8b;});}return _0x13f9c4;});}})[_0x0999('0x25')](respondWithResult(_0x7039aa,0xc9))[_0x0999('0x47')](handleError(_0x7039aa,null));};exports[_0x0999('0x24')]=function(_0xb953f2,_0x5be19c){if(_0xb953f2[_0x0999('0x49')]['id']){delete _0xb953f2[_0x0999('0x49')]['id'];}return db[_0x0999('0x2e')]['find']({'where':{'id':_0xb953f2['params']['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x5be19c,null))[_0x0999('0x25')](saveUpdates(_0xb953f2[_0x0999('0x49')],null))['then'](respondWithResult(_0x5be19c,null))[_0x0999('0x47')](handleError(_0x5be19c,null));};exports[_0x0999('0x54')]=function(_0x353a8f,_0x49a856){return db['Campaign'][_0x0999('0x46')]({'where':{'id':_0x353a8f[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x49a856,null))[_0x0999('0x25')](removeEntity(_0x49a856,null))[_0x0999('0x47')](handleError(_0x49a856,null));};exports['getHoppers']=function(_0x511941,_0x4953dc,_0x279204){var _0xf80a13={'raw':!![],'where':{}};var _0x32b038={};var _0x4b9c7e={'count':0x0,'rows':[]};return db[_0x0999('0x2e')][_0x0999('0x55')]({'where':{'id':_0x511941[_0x0999('0x44')]['id']}})['then'](handleEntityNotFound(_0x4953dc,null))[_0x0999('0x25')](function(_0x11b119){if(_0x11b119){_0x32b038[_0x0999('0x31')]=_['keys'](db['CmHopper'][_0x0999('0x45')]);_0x32b038['query']=_[_0x0999('0x33')](_0x511941['query']);_0x32b038[_0x0999('0x34')]=_[_0x0999('0x36')](_0x32b038[_0x0999('0x31')],_0x32b038['query']);_0xf80a13[_0x0999('0x35')]=_['intersection'](_0x32b038[_0x0999('0x31')],qs[_0x0999('0x37')](_0x511941[_0x0999('0x32')][_0x0999('0x37')]));_0xf80a13[_0x0999('0x35')]=_0xf80a13[_0x0999('0x35')][_0x0999('0x38')]?_0xf80a13[_0x0999('0x35')]:_0x32b038[_0x0999('0x31')];if(!_0x511941[_0x0999('0x32')][_0x0999('0x39')](_0x0999('0x56'))){_0xf80a13['limit']=qs[_0x0999('0x1e')](_0x511941[_0x0999('0x32')]['limit']);_0xf80a13[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x511941[_0x0999('0x32')][_0x0999('0x1c')]);}_0xf80a13[_0x0999('0x3a')]=qs[_0x0999('0x3b')](_0x511941[_0x0999('0x32')][_0x0999('0x3b')]);_0xf80a13[_0x0999('0x3c')]=qs['filters'](_[_0x0999('0x3d')](_0x511941['query'],_0x32b038[_0x0999('0x34')]));_0xf80a13[_0x0999('0x3c')][_0x0999('0x57')]=_0x11b119['id'];if(_0x511941[_0x0999('0x32')][_0x0999('0x3e')]){_0xf80a13['where']=_[_0x0999('0x3f')](_0xf80a13['where'],{'$or':_[_0x0999('0x2d')](_0xf80a13[_0x0999('0x35')],function(_0x26b778){var _0x46fabd={};_0x46fabd[_0x26b778]={'$like':'%'+_0x511941[_0x0999('0x32')][_0x0999('0x3e')]+'%'};return _0x46fabd;})});}_0xf80a13=_['merge']({},_0xf80a13,_0x511941['options']);return db[_0x0999('0x58')][_0x0999('0x1f')]({'where':_0xf80a13['where']})[_0x0999('0x25')](function(_0x1d7821){_0x4b9c7e[_0x0999('0x1f')]=_0x1d7821;if(_0x511941['query'][_0x0999('0x41')]){_0xf80a13[_0x0999('0x42')]=[{'all':!![]}];}return db['CmHopper'][_0x0999('0x43')](_0xf80a13);})[_0x0999('0x25')](function(_0x55c64e){_0x4b9c7e[_0x0999('0x59')]=_0x55c64e;return _0x4b9c7e;});}})[_0x0999('0x25')](respondWithFilteredResult(_0x4953dc,_0xf80a13))[_0x0999('0x47')](handleError(_0x4953dc,null));};exports['getHopperHistories']=function(_0x198620,_0x4e8b45,_0x57086c){var _0x3b0a34={'raw':!![],'where':{}};var _0x5daaab={};var _0x108973={'count':0x0,'rows':[]};return db[_0x0999('0x2e')][_0x0999('0x55')]({'where':{'id':_0x198620[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x4e8b45,null))[_0x0999('0x25')](function(_0x776b81){if(_0x776b81){_0x5daaab['model']=_[_0x0999('0x33')](db['CmHopperHistory']['rawAttributes']);_0x5daaab[_0x0999('0x32')]=_[_0x0999('0x33')](_0x198620[_0x0999('0x32')]);_0x5daaab['filters']=_['intersection'](_0x5daaab['model'],_0x5daaab['query']);_0x3b0a34[_0x0999('0x35')]=_[_0x0999('0x36')](_0x5daaab[_0x0999('0x31')],qs['fields'](_0x198620[_0x0999('0x32')][_0x0999('0x37')]));_0x3b0a34[_0x0999('0x35')]=_0x3b0a34[_0x0999('0x35')][_0x0999('0x38')]?_0x3b0a34['attributes']:_0x5daaab[_0x0999('0x31')];if(!_0x198620['query'][_0x0999('0x39')](_0x0999('0x56'))){_0x3b0a34[_0x0999('0x1e')]=qs[_0x0999('0x1e')](_0x198620[_0x0999('0x32')][_0x0999('0x1e')]);_0x3b0a34[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x198620[_0x0999('0x32')][_0x0999('0x1c')]);}_0x3b0a34['order']=qs[_0x0999('0x3b')](_0x198620[_0x0999('0x32')][_0x0999('0x3b')]);_0x3b0a34[_0x0999('0x3c')]=qs[_0x0999('0x34')](_[_0x0999('0x3d')](_0x198620[_0x0999('0x32')],_0x5daaab[_0x0999('0x34')]));_0x3b0a34[_0x0999('0x3c')][_0x0999('0x57')]=_0x776b81['id'];if(_0x198620[_0x0999('0x32')][_0x0999('0x3e')]){_0x3b0a34[_0x0999('0x3c')]=_[_0x0999('0x3f')](_0x3b0a34[_0x0999('0x3c')],{'$or':_['map'](_0x3b0a34[_0x0999('0x35')],function(_0x247221){var _0x489189={};_0x489189[_0x247221]={'$like':'%'+_0x198620[_0x0999('0x32')][_0x0999('0x3e')]+'%'};return _0x489189;})});}_0x3b0a34=_[_0x0999('0x3f')]({},_0x3b0a34,_0x198620[_0x0999('0x40')]);return db[_0x0999('0x5a')][_0x0999('0x1f')]({'where':_0x3b0a34[_0x0999('0x3c')]})[_0x0999('0x25')](function(_0x555745){_0x108973[_0x0999('0x1f')]=_0x555745;if(_0x198620['query'][_0x0999('0x41')]){_0x3b0a34['include']=[{'all':!![]}];}return db[_0x0999('0x5a')][_0x0999('0x43')](_0x3b0a34);})[_0x0999('0x25')](function(_0x14bf9c){_0x108973[_0x0999('0x59')]=_0x14bf9c;return _0x108973;});}})[_0x0999('0x25')](respondWithFilteredResult(_0x4e8b45,_0x3b0a34))[_0x0999('0x47')](handleError(_0x4e8b45,null));};exports['getHopperFinals']=function(_0x25c8e6,_0x18b1e3,_0x2db077){var _0x2e2b27={'raw':!![],'where':{}};var _0x546896={};var _0x37a5a6={'count':0x0,'rows':[]};return db['Campaign'][_0x0999('0x55')]({'where':{'id':_0x25c8e6[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x18b1e3,null))['then'](function(_0x28fed5){if(_0x28fed5){_0x546896[_0x0999('0x31')]=_[_0x0999('0x33')](db['CmHopperFinal'][_0x0999('0x45')]);_0x546896[_0x0999('0x32')]=_[_0x0999('0x33')](_0x25c8e6[_0x0999('0x32')]);_0x546896['filters']=_[_0x0999('0x36')](_0x546896[_0x0999('0x31')],_0x546896[_0x0999('0x32')]);_0x2e2b27['attributes']=_[_0x0999('0x36')](_0x546896['model'],qs['fields'](_0x25c8e6[_0x0999('0x32')][_0x0999('0x37')]));_0x2e2b27[_0x0999('0x35')]=_0x2e2b27[_0x0999('0x35')][_0x0999('0x38')]?_0x2e2b27['attributes']:_0x546896[_0x0999('0x31')];if(!_0x25c8e6[_0x0999('0x32')][_0x0999('0x39')](_0x0999('0x56'))){_0x2e2b27[_0x0999('0x1e')]=qs['limit'](_0x25c8e6[_0x0999('0x32')][_0x0999('0x1e')]);_0x2e2b27['offset']=qs['offset'](_0x25c8e6[_0x0999('0x32')]['offset']);}_0x2e2b27['order']=qs[_0x0999('0x3b')](_0x25c8e6['query'][_0x0999('0x3b')]);_0x2e2b27[_0x0999('0x3c')]=qs[_0x0999('0x34')](_[_0x0999('0x3d')](_0x25c8e6['query'],_0x546896[_0x0999('0x34')]));_0x2e2b27[_0x0999('0x3c')]['CampaignId']=_0x28fed5['id'];if(_0x25c8e6[_0x0999('0x32')]['filter']){_0x2e2b27['where']=_[_0x0999('0x3f')](_0x2e2b27[_0x0999('0x3c')],{'$or':_[_0x0999('0x2d')](_0x2e2b27[_0x0999('0x35')],function(_0x4218a2){var _0x1df3da={};_0x1df3da[_0x4218a2]={'$like':'%'+_0x25c8e6[_0x0999('0x32')][_0x0999('0x3e')]+'%'};return _0x1df3da;})});}_0x2e2b27=_[_0x0999('0x3f')]({},_0x2e2b27,_0x25c8e6['options']);return db[_0x0999('0x5b')]['count']({'where':_0x2e2b27[_0x0999('0x3c')]})['then'](function(_0x55b105){_0x37a5a6[_0x0999('0x1f')]=_0x55b105;if(_0x25c8e6['query'][_0x0999('0x41')]){_0x2e2b27[_0x0999('0x42')]=[{'all':!![]}];}return db[_0x0999('0x5b')][_0x0999('0x43')](_0x2e2b27);})[_0x0999('0x25')](function(_0x2dc875){_0x37a5a6[_0x0999('0x59')]=_0x2dc875;return _0x37a5a6;});}})[_0x0999('0x25')](respondWithFilteredResult(_0x18b1e3,_0x2e2b27))[_0x0999('0x47')](handleError(_0x18b1e3,null));};exports[_0x0999('0x5c')]=function(_0x32fdf9,_0xcc3b62,_0x24f851){var _0x29488d={'raw':!![],'where':{}};var _0x1fb3bb={};var _0x403461={'count':0x0,'rows':[]};return db[_0x0999('0x2e')][_0x0999('0x55')]({'where':{'id':_0x32fdf9[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0xcc3b62,null))[_0x0999('0x25')](function(_0x32ec9a){if(_0x32ec9a){_0x1fb3bb[_0x0999('0x31')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x1fb3bb['query']=_[_0x0999('0x33')](_0x32fdf9[_0x0999('0x32')]);_0x1fb3bb[_0x0999('0x34')]=_[_0x0999('0x36')](_0x1fb3bb['model'],_0x1fb3bb[_0x0999('0x32')]);_0x29488d[_0x0999('0x35')]=_['intersection'](_0x1fb3bb['model'],qs[_0x0999('0x37')](_0x32fdf9['query'][_0x0999('0x37')]));_0x29488d[_0x0999('0x35')]=_0x29488d[_0x0999('0x35')][_0x0999('0x38')]?_0x29488d['attributes']:_0x1fb3bb[_0x0999('0x31')];if(!_0x32fdf9[_0x0999('0x32')]['hasOwnProperty'](_0x0999('0x56'))){_0x29488d[_0x0999('0x1e')]=qs[_0x0999('0x1e')](_0x32fdf9[_0x0999('0x32')][_0x0999('0x1e')]);_0x29488d[_0x0999('0x1c')]=qs['offset'](_0x32fdf9[_0x0999('0x32')][_0x0999('0x1c')]);}_0x29488d[_0x0999('0x3a')]=qs[_0x0999('0x3b')](_0x32fdf9[_0x0999('0x32')][_0x0999('0x3b')]);_0x29488d[_0x0999('0x3c')]=qs[_0x0999('0x34')](_[_0x0999('0x3d')](_0x32fdf9[_0x0999('0x32')],_0x1fb3bb[_0x0999('0x34')]));_0x29488d[_0x0999('0x3c')][_0x0999('0x57')]=_0x32ec9a['id'];if(_0x32fdf9[_0x0999('0x32')][_0x0999('0x3e')]){_0x29488d['where']=_[_0x0999('0x3f')](_0x29488d['where'],{'$or':_[_0x0999('0x2d')](_0x29488d[_0x0999('0x35')],function(_0x374d62){var _0x40e402={};_0x40e402[_0x374d62]={'$like':'%'+_0x32fdf9[_0x0999('0x32')][_0x0999('0x3e')]+'%'};return _0x40e402;})});}_0x29488d=_[_0x0999('0x3f')]({},_0x29488d,_0x32fdf9[_0x0999('0x40')]);return db[_0x0999('0x5d')][_0x0999('0x1f')]({'where':_0x29488d['where']})[_0x0999('0x25')](function(_0x34eb2a){_0x403461[_0x0999('0x1f')]=_0x34eb2a;if(_0x32fdf9[_0x0999('0x32')][_0x0999('0x41')]){_0x29488d[_0x0999('0x42')]=[{'all':!![]}];}return db[_0x0999('0x5d')][_0x0999('0x43')](_0x29488d);})[_0x0999('0x25')](function(_0x4605dc){_0x403461[_0x0999('0x59')]=_0x4605dc;return _0x403461;});}})[_0x0999('0x25')](respondWithFilteredResult(_0xcc3b62,_0x29488d))[_0x0999('0x47')](handleError(_0xcc3b62,null));};exports[_0x0999('0x5e')]=function(_0x38e78c,_0xc1961c,_0x36aa38){var _0x49e845={};var _0x37ec1f={};var _0x21021b;var _0x2f5841;return db['Campaign']['findOne']({'where':{'id':_0x38e78c[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0xc1961c,null))[_0x0999('0x25')](function(_0x27adfb){if(_0x27adfb){_0x21021b=_0x27adfb;_0x37ec1f[_0x0999('0x31')]=_['keys'](db[_0x0999('0x5f')][_0x0999('0x45')]);_0x37ec1f['query']=_['keys'](_0x38e78c['query']);_0x37ec1f['filters']=_[_0x0999('0x36')](_0x37ec1f['model'],_0x37ec1f['query']);_0x49e845[_0x0999('0x35')]=_[_0x0999('0x36')](_0x37ec1f[_0x0999('0x31')],qs['fields'](_0x38e78c[_0x0999('0x32')][_0x0999('0x37')]));_0x49e845['attributes']=_0x49e845[_0x0999('0x35')][_0x0999('0x38')]?_0x49e845['attributes']:_0x37ec1f[_0x0999('0x31')];_0x49e845['order']=qs[_0x0999('0x3b')](_0x38e78c[_0x0999('0x32')]['sort']);_0x49e845[_0x0999('0x3c')]=qs[_0x0999('0x34')](_[_0x0999('0x3d')](_0x38e78c[_0x0999('0x32')],_0x37ec1f[_0x0999('0x34')]));if(_0x38e78c[_0x0999('0x32')][_0x0999('0x3e')]){_0x49e845[_0x0999('0x3c')]=_['merge'](_0x49e845[_0x0999('0x3c')],{'$or':_['map'](_0x49e845[_0x0999('0x35')],function(_0x52a54f){var _0x3c84dc={};_0x3c84dc[_0x52a54f]={'$like':'%'+_0x38e78c[_0x0999('0x32')][_0x0999('0x3e')]+'%'};return _0x3c84dc;})});}_0x49e845=_[_0x0999('0x3f')]({},_0x49e845,_0x38e78c[_0x0999('0x40')]);return _0x21021b['getLists'](_0x49e845);}})['then'](function(_0x4dcafa){if(_0x4dcafa){_0x2f5841=_0x4dcafa[_0x0999('0x38')];if(!_0x38e78c[_0x0999('0x32')]['hasOwnProperty']('nolimit')){_0x49e845[_0x0999('0x1e')]=qs[_0x0999('0x1e')](_0x38e78c[_0x0999('0x32')][_0x0999('0x1e')]);_0x49e845[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x38e78c[_0x0999('0x32')][_0x0999('0x1c')]);}return _0x21021b[_0x0999('0x5e')](_0x49e845);}})[_0x0999('0x25')](function(_0x4e5dff){if(_0x4e5dff){return _0x4e5dff?{'count':_0x2f5841,'rows':_0x4e5dff}:null;}})[_0x0999('0x25')](respondWithResult(_0xc1961c,null))[_0x0999('0x47')](handleError(_0xc1961c,null));};exports[_0x0999('0x60')]=function(_0x1b6b6d,_0x3ff8c7,_0x37a697){var _0x5513b6,_0x2f9f90;var _0xbdd061=[];var _0x3ddfaa=moment()['format'](_0x0999('0x61'));return db[_0x0999('0x2e')][_0x0999('0x46')]({'where':{'id':_0x1b6b6d[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x3ff8c7,null))[_0x0999('0x25')](function(_0x2aa3b3){if(_0x2aa3b3){_0x2f9f90=_0x2aa3b3;return _0x2aa3b3['addLists'](_0x1b6b6d[_0x0999('0x49')][_0x0999('0x62')],_[_0x0999('0x52')](_0x1b6b6d[_0x0999('0x49')],['ids','id'])||{});}return null;})[_0x0999('0x63')](function(_0x1e1cde){var _0x5be633;var _0x1c7e6b;_0x5513b6=_0x1e1cde||[];var _0x146c6e=[];if(_0x1e1cde){for(var _0x2cc9f7=0x0;_0x2cc9f7<_0x1e1cde[_0x0999('0x38')];_0x2cc9f7+=0x1){var _0x4d8b43=_0x1e1cde[_0x2cc9f7]['get']({'plain':!![]});_0x2f9f90[_0x0999('0x64')]=_0x1b6b6d[_0x0999('0x49')][_0x0999('0x64')]?_0x1b6b6d[_0x0999('0x49')][_0x0999('0x64')]:_0x2f9f90[_0x0999('0x64')];switch(_0x2f9f90[_0x0999('0x64')]){case'always':_0x5be633=squel[_0x0999('0x65')]()[_0x0999('0x66')](_0x0999('0x67'))[_0x0999('0x68')](['phone','scheduledAt',_0x0999('0x69'),_0x0999('0x6a'),_0x0999('0x57'),'createdAt','updatedAt'],squel[_0x0999('0x6b')]()[_0x0999('0x6c')](_0x0999('0x6d'),'phone')[_0x0999('0x6c')](_0x0999('0x6e'),_0x0999('0x6f'))['field']('id','ContactId')['field'](_0x4d8b43[_0x0999('0x70')][_0x0999('0x71')](),_0x0999('0x6a'))['field'](_0x1b6b6d[_0x0999('0x44')]['id'][_0x0999('0x71')](),_0x0999('0x57'))[_0x0999('0x6c')]('\x27'+_0x3ddfaa+'\x27',_0x0999('0x53'))[_0x0999('0x6c')]('\x27'+_0x3ddfaa+'\x27','updatedAt')[_0x0999('0x72')](_0x0999('0x73'))[_0x0999('0x3c')](_0x0999('0x74'))['where'](_0x0999('0x75'),_0x4d8b43['CmListId']['toString']())[_0x0999('0x3c')](_0x0999('0x76'))[_0x0999('0x3c')](_0x0999('0x77'),squel[_0x0999('0x6b')]()[_0x0999('0x6c')](_0x0999('0x78'))[_0x0999('0x72')](_0x0999('0x79'))[_0x0999('0x3c')]('CampaignId\x20=\x20?',_0x1b6b6d['params']['id'][_0x0999('0x71')]()))[_0x0999('0x3c')](_0x0999('0x77'),squel[_0x0999('0x6b')]()['field'](_0x0999('0x7a'))[_0x0999('0x72')](_0x0999('0x67'))['where']('CampaignId\x20=\x20?',_0x1b6b6d[_0x0999('0x44')]['id'][_0x0999('0x71')]())))[_0x0999('0x71')]();break;case _0x0999('0x7b'):_0x5be633=squel['insert']()[_0x0999('0x66')](_0x0999('0x67'))['fromQuery']([_0x0999('0x6d'),_0x0999('0x6f'),'ContactId',_0x0999('0x6a'),'CampaignId',_0x0999('0x53'),_0x0999('0x51')],squel['select']()[_0x0999('0x6c')](_0x0999('0x6d'),_0x0999('0x6d'))[_0x0999('0x6c')](_0x0999('0x6e'),_0x0999('0x6f'))[_0x0999('0x6c')]('id',_0x0999('0x69'))[_0x0999('0x6c')](_0x4d8b43[_0x0999('0x70')]['toString'](),_0x0999('0x6a'))['field'](_0x1b6b6d['params']['id'][_0x0999('0x71')](),_0x0999('0x57'))[_0x0999('0x6c')]('\x27'+_0x3ddfaa+'\x27','createdAt')[_0x0999('0x6c')]('\x27'+_0x3ddfaa+'\x27',_0x0999('0x51'))['from']('cm_contacts')[_0x0999('0x3c')](_0x0999('0x74'))[_0x0999('0x3c')](_0x0999('0x75'),_0x4d8b43[_0x0999('0x70')][_0x0999('0x71')]())[_0x0999('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0999('0x3c')](_0x0999('0x77'),squel[_0x0999('0x6b')]()['field'](_0x0999('0x7a'))[_0x0999('0x72')]('cm_hopper')[_0x0999('0x3c')](_0x0999('0x7c'),_0x1b6b6d[_0x0999('0x44')]['id'][_0x0999('0x71')]())))[_0x0999('0x71')]();break;default:_0x5be633=squel[_0x0999('0x65')]()[_0x0999('0x66')]('cm_hopper')[_0x0999('0x68')]([_0x0999('0x6d'),_0x0999('0x6f'),'ContactId',_0x0999('0x6a'),'CampaignId',_0x0999('0x53'),_0x0999('0x51')],squel[_0x0999('0x6b')]()[_0x0999('0x6c')](_0x0999('0x6d'),'phone')['field'](_0x0999('0x6e'),'scheduledAt')['field']('id','ContactId')[_0x0999('0x6c')](_0x4d8b43[_0x0999('0x70')][_0x0999('0x71')](),_0x0999('0x6a'))[_0x0999('0x6c')](_0x1b6b6d['params']['id'][_0x0999('0x71')](),_0x0999('0x57'))[_0x0999('0x6c')]('\x27'+_0x3ddfaa+'\x27',_0x0999('0x53'))['field']('\x27'+_0x3ddfaa+'\x27','updatedAt')['from'](_0x0999('0x73'))[_0x0999('0x3c')](_0x0999('0x74'))[_0x0999('0x3c')](_0x0999('0x75'),_0x4d8b43['CmListId'][_0x0999('0x71')]())[_0x0999('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x1c7e6b=squel[_0x0999('0x65')]()[_0x0999('0x66')]('cm_hopper_additional_phones')['fromQuery']([_0x0999('0x7d'),_0x0999('0x6f'),_0x0999('0x6d'),'OrderBy','createdAt','updatedAt'],squel[_0x0999('0x6b')]()[_0x0999('0x6c')]('h.id','id')[_0x0999('0x6c')]('NOW()','scheduledAt')['field'](_0x0999('0x7e'),_0x0999('0x6d'))[_0x0999('0x6c')](_0x0999('0x7f'),_0x0999('0x80'))['field']('\x27'+_0x3ddfaa+'\x27',_0x0999('0x53'))['field']('\x27'+_0x3ddfaa+'\x27',_0x0999('0x51'))[_0x0999('0x72')]('cm_contact_has_items','ci')[_0x0999('0x81')](_0x0999('0x67'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x0999('0x82'),_0x4d8b43[_0x0999('0x70')][_0x0999('0x71')]())[_0x0999('0x3c')](_0x0999('0x83'),_0x1b6b6d[_0x0999('0x44')]['id'][_0x0999('0x71')]())[_0x0999('0x3c')](_0x0999('0x84'),_0x3ddfaa))[_0x0999('0x71')]();_0x146c6e[_0x0999('0x85')](db[_0x0999('0x86')][_0x0999('0x32')](_0x5be633));_0xbdd061['push'](db[_0x0999('0x86')][_0x0999('0x32')](_0x1c7e6b));}return BPromise[_0x0999('0x87')](_0x146c6e);}})[_0x0999('0x25')](function(){return BPromise[_0x0999('0x87')](_0xbdd061);})[_0x0999('0x25')](function(){return _0x5513b6;})[_0x0999('0x25')](respondWithResult(_0x3ff8c7,null))[_0x0999('0x47')](handleError(_0x3ff8c7,null));};exports['removeLists']=function(_0x3195d8,_0x2ca285,_0x20df10){return db['Campaign'][_0x0999('0x46')]({'where':{'id':_0x3195d8[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x2ca285,null))[_0x0999('0x25')](function(_0x241535){if(_0x241535){return _0x241535[_0x0999('0x88')](_0x3195d8['query'][_0x0999('0x62')]);}})['then'](function(_0xe82bd4){if(_0xe82bd4){return db[_0x0999('0x58')][_0x0999('0x54')]({'where':{'ListId':_0x3195d8[_0x0999('0x32')][_0x0999('0x62')],'CampaignId':_0x3195d8['params']['id']}})[_0x0999('0x25')](function(){return _0xe82bd4;});}})[_0x0999('0x25')](respondWithStatusCode(_0x2ca285,null))[_0x0999('0x47')](handleError(_0x2ca285,null));};exports[_0x0999('0x89')]=function(_0x3f1a54,_0x1c0056,_0x2e1e9c){var _0x5581de={};var _0x56d410={};var _0x111160;var _0x473eb8;return db[_0x0999('0x2e')][_0x0999('0x55')]({'where':{'id':_0x3f1a54['params']['id']}})['then'](handleEntityNotFound(_0x1c0056,null))[_0x0999('0x25')](function(_0x3d28bd){if(_0x3d28bd){_0x111160=_0x3d28bd;_0x56d410[_0x0999('0x31')]=_[_0x0999('0x33')](db[_0x0999('0x5f')][_0x0999('0x45')]);_0x56d410[_0x0999('0x32')]=_['keys'](_0x3f1a54[_0x0999('0x32')]);_0x56d410[_0x0999('0x34')]=_[_0x0999('0x36')](_0x56d410[_0x0999('0x31')],_0x56d410['query']);_0x5581de[_0x0999('0x35')]=_[_0x0999('0x36')](_0x56d410['model'],qs['fields'](_0x3f1a54[_0x0999('0x32')][_0x0999('0x37')]));_0x5581de[_0x0999('0x35')]=_0x5581de[_0x0999('0x35')]['length']?_0x5581de[_0x0999('0x35')]:_0x56d410[_0x0999('0x31')];_0x5581de[_0x0999('0x3a')]=qs['sort'](_0x3f1a54['query'][_0x0999('0x3b')]);_0x5581de[_0x0999('0x3c')]=qs[_0x0999('0x34')](_[_0x0999('0x3d')](_0x3f1a54[_0x0999('0x32')],_0x56d410[_0x0999('0x34')]));if(_0x3f1a54[_0x0999('0x32')][_0x0999('0x3e')]){_0x5581de[_0x0999('0x3c')]=_[_0x0999('0x3f')](_0x5581de[_0x0999('0x3c')],{'$or':_[_0x0999('0x2d')](_0x5581de[_0x0999('0x35')],function(_0x4e8cc3){var _0x1f43db={};_0x1f43db[_0x4e8cc3]={'$like':'%'+_0x3f1a54[_0x0999('0x32')][_0x0999('0x3e')]+'%'};return _0x1f43db;})});}_0x5581de=_[_0x0999('0x3f')]({},_0x5581de,_0x3f1a54[_0x0999('0x40')]);return _0x111160['getBlackLists'](_0x5581de);}})['then'](function(_0x2a3a44){if(_0x2a3a44){_0x473eb8=_0x2a3a44[_0x0999('0x38')];if(!_0x3f1a54[_0x0999('0x32')]['hasOwnProperty'](_0x0999('0x56'))){_0x5581de[_0x0999('0x1e')]=qs[_0x0999('0x1e')](_0x3f1a54[_0x0999('0x32')][_0x0999('0x1e')]);_0x5581de[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x3f1a54[_0x0999('0x32')][_0x0999('0x1c')]);}return _0x111160[_0x0999('0x89')](_0x5581de);}})[_0x0999('0x25')](function(_0x585ff7){if(_0x585ff7){return _0x585ff7?{'count':_0x473eb8,'rows':_0x585ff7}:null;}})['then'](respondWithResult(_0x1c0056,null))[_0x0999('0x47')](handleError(_0x1c0056,null));};exports[_0x0999('0x8a')]=function(_0x60edb0,_0x1d9c9f,_0x4232ea){var _0x525242,_0x5c97eb;var _0x516016=[];var _0x942884=moment()[_0x0999('0x8b')](_0x0999('0x61'));return db[_0x0999('0x2e')]['find']({'where':{'id':_0x60edb0[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x1d9c9f,null))[_0x0999('0x25')](function(_0x4b3e3b){if(_0x4b3e3b){_0x5c97eb=_0x4b3e3b;return _0x4b3e3b[_0x0999('0x8a')](_0x60edb0[_0x0999('0x49')][_0x0999('0x62')],_[_0x0999('0x52')](_0x60edb0[_0x0999('0x49')],[_0x0999('0x62'),'id'])||{});}return null;})[_0x0999('0x63')](function(_0xfdf58f){var _0x55ca8b;var _0x16541a;_0x525242=_0xfdf58f||[];var _0x2fea0f=[];if(_0xfdf58f){for(var _0x15401a=0x0;_0x15401a<_0xfdf58f['length'];_0x15401a+=0x1){var _0xab16b9=_0xfdf58f[_0x15401a]['get']({'plain':!![]});_0x55ca8b=squel['insert']()[_0x0999('0x66')](_0x0999('0x8c'))[_0x0999('0x68')]([_0x0999('0x6d'),_0x0999('0x69'),_0x0999('0x6a'),'CampaignId','createdAt',_0x0999('0x51')],squel['select']()[_0x0999('0x6c')](_0x0999('0x6d'),'phone')[_0x0999('0x6c')]('id',_0x0999('0x69'))['field'](_0xab16b9['CmListId']['toString'](),_0x0999('0x6a'))[_0x0999('0x6c')](_0x60edb0[_0x0999('0x44')]['id'][_0x0999('0x71')](),'CampaignId')[_0x0999('0x6c')]('NOW()',_0x0999('0x53'))['field'](_0x0999('0x6e'),'updatedAt')[_0x0999('0x72')](_0x0999('0x73'))['where'](_0x0999('0x74'))[_0x0999('0x3c')](_0x0999('0x75'),_0xab16b9[_0x0999('0x70')][_0x0999('0x71')]())[_0x0999('0x3c')](_0x0999('0x76')))[_0x0999('0x71')]();_0x2fea0f[_0x0999('0x85')](db[_0x0999('0x86')][_0x0999('0x32')](_0x55ca8b));}return BPromise['all'](_0x2fea0f);}})[_0x0999('0x25')](function(){return _0x525242;})[_0x0999('0x25')](respondWithResult(_0x1d9c9f,null))[_0x0999('0x47')](handleError(_0x1d9c9f,null));};exports[_0x0999('0x8d')]=function(_0x269752,_0x48289,_0x71211a){return db['Campaign'][_0x0999('0x46')]({'where':{'id':_0x269752[_0x0999('0x44')]['id']}})[_0x0999('0x25')](handleEntityNotFound(_0x48289,null))[_0x0999('0x25')](function(_0x2bdfb4){if(_0x2bdfb4){return _0x2bdfb4[_0x0999('0x8d')](_0x269752[_0x0999('0x32')]['ids']);}})[_0x0999('0x25')](function(_0x272ec2){if(_0x272ec2){return db[_0x0999('0x5d')][_0x0999('0x54')]({'where':{'ListId':_0x269752[_0x0999('0x32')][_0x0999('0x62')],'CampaignId':_0x269752[_0x0999('0x44')]['id']}})['then'](function(){return _0x272ec2;});}})[_0x0999('0x25')](respondWithStatusCode(_0x48289,null))[_0x0999('0x47')](handleError(_0x48289,null));}; \ No newline at end of file +var _0x7033=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','get','UserProfileResource','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','Campaign','count','includeAll','include','findAll','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','IvrCampaigns','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','userProfileId','update','getHoppers','CmHopper','sort','CampaignId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','findOne','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','phone','NOW()','field','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper_additional_phones','h.id','ci.item','ci.OrderBY','OrderBy','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis'];(function(_0x368203,_0x497fb5){var _0x1b1afe=function(_0x3457fe){while(--_0x3457fe){_0x368203['push'](_0x368203['shift']());}};_0x1b1afe(++_0x497fb5);}(_0x7033,0x19e));var _0x3703=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7033[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x3703('0x0'));var rimraf=require(_0x3703('0x1'));var zipdir=require(_0x3703('0x2'));var jsonpatch=require(_0x3703('0x3'));var rp=require('request-promise');var moment=require(_0x3703('0x4'));var BPromise=require(_0x3703('0x5'));var Mustache=require(_0x3703('0x6'));var util=require(_0x3703('0x7'));var path=require(_0x3703('0x8'));var sox=require(_0x3703('0x9'));var csv=require(_0x3703('0xa'));var ejs=require(_0x3703('0xb'));var fs=require('fs');var fs_extra=require(_0x3703('0xc'));var _=require(_0x3703('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3703('0xe'));var toCsv=require(_0x3703('0xa'));var querystring=require(_0x3703('0xf'));var Papa=require(_0x3703('0x10'));var Redis=require(_0x3703('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3703('0x12'));var as=require(_0x3703('0x13'));var hardwareService=require(_0x3703('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3703('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3703('0x16'));var db=require(_0x3703('0x17'))['db'];function respondWithStatusCode(_0x31c0df,_0x41af55){_0x41af55=_0x41af55||0xcc;return function(_0x520ce3){if(_0x520ce3){return _0x31c0df['sendStatus'](_0x41af55);}return _0x31c0df[_0x3703('0x18')](_0x41af55)[_0x3703('0x19')]();};}function respondWithResult(_0x44d586,_0x6318f2){_0x6318f2=_0x6318f2||0xc8;return function(_0x25d3ef){if(_0x25d3ef){return _0x44d586[_0x3703('0x18')](_0x6318f2)[_0x3703('0x1a')](_0x25d3ef);}};}function respondWithFilteredResult(_0x12d16c,_0x23b04e){return function(_0x2457c1){if(_0x2457c1){var _0x3a8a89=typeof _0x23b04e[_0x3703('0x1b')]===_0x3703('0x1c')&&typeof _0x23b04e[_0x3703('0x1d')]==='undefined';var _0x3cbbce=_0x2457c1['count'];var _0x10ff16=_0x3a8a89?0x0:_0x23b04e['offset'];var _0x433d67=_0x3a8a89?_0x2457c1['count']:_0x23b04e[_0x3703('0x1b')]+_0x23b04e[_0x3703('0x1d')];var _0x5deb5b;if(_0x433d67>=_0x3cbbce){_0x433d67=_0x3cbbce;_0x5deb5b=0xc8;}else{_0x5deb5b=0xce;}_0x12d16c[_0x3703('0x18')](_0x5deb5b);return _0x12d16c[_0x3703('0x1e')](_0x3703('0x1f'),_0x10ff16+'-'+_0x433d67+'/'+_0x3cbbce)[_0x3703('0x1a')](_0x2457c1);}return null;};}function patchUpdates(_0x2a4983){return function(_0x51b1c8){try{jsonpatch[_0x3703('0x20')](_0x51b1c8,_0x2a4983,!![]);}catch(_0xc45c46){return BPromise[_0x3703('0x21')](_0xc45c46);}return _0x51b1c8['save']();};}function saveUpdates(_0x386c4a,_0x255266){return function(_0x10c74d){if(_0x10c74d){return _0x10c74d['update'](_0x386c4a)['then'](function(_0x4b9d6f){return _0x4b9d6f;});}return null;};}function removeEntity(_0x425388,_0x34aaf8){return function(_0x306905){if(_0x306905){return _0x306905[_0x3703('0x22')]()['then'](function(){var _0x4fe6dd=_0x306905[_0x3703('0x23')]({'plain':!![]});var _0x5e68f2='IvrCampaigns';return db[_0x3703('0x24')][_0x3703('0x22')]({'where':{'type':_0x5e68f2,'resourceId':_0x4fe6dd['id']}})['then'](function(){return _0x306905;});})[_0x3703('0x25')](function(){_0x425388[_0x3703('0x18')](0xcc)[_0x3703('0x19')]();});}};}function handleEntityNotFound(_0x2f0fe9,_0x42b15c){return function(_0x59c6ca){if(!_0x59c6ca){_0x2f0fe9['sendStatus'](0x194);}return _0x59c6ca;};}function handleError(_0x375f6a,_0x5bfc23){_0x5bfc23=_0x5bfc23||0x1f4;return function(_0x1e280c){logger[_0x3703('0x26')](_0x1e280c['stack']);if(_0x1e280c['name']){delete _0x1e280c[_0x3703('0x27')];}_0x375f6a[_0x3703('0x18')](_0x5bfc23)[_0x3703('0x28')](_0x1e280c);};}exports[_0x3703('0x29')]=function(_0x2c6c19,_0x2be412){var _0x465bca={},_0xed6e41={},_0x1737c4={'count':0x0,'rows':[]};var _0xe2cdf=_[_0x3703('0x2a')](db['Campaign'][_0x3703('0x2b')],function(_0x40778a){return{'name':_0x40778a[_0x3703('0x2c')],'type':_0x40778a[_0x3703('0x2d')][_0x3703('0x2e')]};});_0xed6e41[_0x3703('0x2f')]=_[_0x3703('0x2a')](_0xe2cdf,_0x3703('0x27'));_0xed6e41[_0x3703('0x30')]=_[_0x3703('0x31')](_0x2c6c19[_0x3703('0x30')]);_0xed6e41[_0x3703('0x32')]=_[_0x3703('0x33')](_0xed6e41[_0x3703('0x2f')],_0xed6e41[_0x3703('0x30')]);_0x465bca[_0x3703('0x34')]=_[_0x3703('0x33')](_0xed6e41[_0x3703('0x2f')],qs[_0x3703('0x35')](_0x2c6c19[_0x3703('0x30')][_0x3703('0x35')]));_0x465bca[_0x3703('0x34')]=_0x465bca['attributes'][_0x3703('0x36')]?_0x465bca['attributes']:_0xed6e41[_0x3703('0x2f')];if(!_0x2c6c19['query'][_0x3703('0x37')](_0x3703('0x38'))){_0x465bca[_0x3703('0x1d')]=qs[_0x3703('0x1d')](_0x2c6c19[_0x3703('0x30')]['limit']);_0x465bca[_0x3703('0x1b')]=qs['offset'](_0x2c6c19[_0x3703('0x30')][_0x3703('0x1b')]);}_0x465bca[_0x3703('0x39')]=qs['sort'](_0x2c6c19[_0x3703('0x30')]['sort']);_0x465bca[_0x3703('0x3a')]=qs[_0x3703('0x32')](_[_0x3703('0x3b')](_0x2c6c19[_0x3703('0x30')],_0xed6e41[_0x3703('0x32')]),_0xe2cdf);if(_0x2c6c19[_0x3703('0x30')]['filter']){_0x465bca['where']=_[_0x3703('0x3c')](_0x465bca[_0x3703('0x3a')],{'$or':_['map'](_0xe2cdf,function(_0x32f35a){if(_0x32f35a[_0x3703('0x2d')]!==_0x3703('0x3d')){var _0x12ee82={};_0x12ee82[_0x32f35a[_0x3703('0x27')]]={'$like':'%'+_0x2c6c19[_0x3703('0x30')][_0x3703('0x3e')]+'%'};return _0x12ee82;}})});}_0x465bca=_[_0x3703('0x3c')]({},_0x465bca,_0x2c6c19[_0x3703('0x3f')]);var _0x5997f4={'where':_0x465bca['where']};return db[_0x3703('0x40')][_0x3703('0x41')](_0x5997f4)['then'](function(_0x39760d){_0x1737c4[_0x3703('0x41')]=_0x39760d;if(_0x2c6c19[_0x3703('0x30')][_0x3703('0x42')]){_0x465bca[_0x3703('0x43')]=[{'all':!![]}];}return db[_0x3703('0x40')][_0x3703('0x44')](_0x465bca);})[_0x3703('0x25')](function(_0x1d39c7){_0x1737c4['rows']=_0x1d39c7;return _0x1737c4;})['then'](respondWithFilteredResult(_0x2be412,_0x465bca))[_0x3703('0x45')](handleError(_0x2be412,null));};exports['show']=function(_0x535d21,_0x17d1ca){var _0x3e7b9f={'raw':![],'where':{'id':_0x535d21[_0x3703('0x46')]['id']}},_0x93eb29={};_0x93eb29[_0x3703('0x2f')]=_[_0x3703('0x31')](db[_0x3703('0x40')]['rawAttributes']);_0x93eb29[_0x3703('0x30')]=_[_0x3703('0x31')](_0x535d21[_0x3703('0x30')]);_0x93eb29[_0x3703('0x32')]=_['intersection'](_0x93eb29['model'],_0x93eb29[_0x3703('0x30')]);_0x3e7b9f[_0x3703('0x34')]=_[_0x3703('0x33')](_0x93eb29[_0x3703('0x2f')],qs[_0x3703('0x35')](_0x535d21[_0x3703('0x30')][_0x3703('0x35')]));_0x3e7b9f['attributes']=_0x3e7b9f[_0x3703('0x34')][_0x3703('0x36')]?_0x3e7b9f[_0x3703('0x34')]:_0x93eb29[_0x3703('0x2f')];if(_0x535d21['query']['includeAll']){_0x3e7b9f['include']=[{'all':!![]}];}_0x3e7b9f=_['merge']({},_0x3e7b9f,_0x535d21[_0x3703('0x3f')]);return db[_0x3703('0x40')][_0x3703('0x47')](_0x3e7b9f)['then'](handleEntityNotFound(_0x17d1ca,null))[_0x3703('0x25')](respondWithResult(_0x17d1ca,null))['catch'](handleError(_0x17d1ca,null));};exports[_0x3703('0x48')]=function(_0x2ab470,_0x2e19f6){return db['Campaign'][_0x3703('0x48')](_0x2ab470[_0x3703('0x49')],{})[_0x3703('0x25')](function(_0x176585){var _0x59bc2c=_0x2ab470['user']['get']({'plain':!![]});if(!_0x59bc2c)throw new Error(_0x3703('0x4a'));if(_0x59bc2c['role']===_0x3703('0x4b')){var _0x528db8=_0x176585[_0x3703('0x23')]({'plain':!![]});var _0x518544=_0x3703('0x4c');return db[_0x3703('0x4d')][_0x3703('0x47')]({'where':{'name':_0x518544,'userProfileId':_0x59bc2c['userProfileId']},'raw':!![]})[_0x3703('0x25')](function(_0x19f974){if(_0x19f974&&_0x19f974[_0x3703('0x4e')]===0x0){return db[_0x3703('0x24')][_0x3703('0x48')]({'name':_0x528db8['name'],'resourceId':_0x528db8['id'],'type':_0x19f974[_0x3703('0x27')],'sectionId':_0x19f974['id']},{})['then'](function(){return _0x176585;});}else{return _0x176585;}})[_0x3703('0x45')](function(_0x4a09f8){logger[_0x3703('0x26')](_0x3703('0x4f'),_0x4a09f8);throw _0x4a09f8;});}return _0x176585;})[_0x3703('0x25')](respondWithResult(_0x2e19f6,0xc9))[_0x3703('0x45')](handleError(_0x2e19f6,null));};exports['clone']=function(_0x47fbc7,_0x18cd07){var _0x150ed5={'where':{'id':_0x47fbc7[_0x3703('0x46')]['id']}},_0x168437={};_0x168437[_0x3703('0x2f')]=_['keys'](db[_0x3703('0x40')][_0x3703('0x2b')]);_0x150ed5[_0x3703('0x34')]=_[_0x3703('0x33')](_0x168437[_0x3703('0x2f')],qs[_0x3703('0x35')](_0x47fbc7['query'][_0x3703('0x35')]));_0x150ed5[_0x3703('0x34')]=_0x150ed5[_0x3703('0x34')][_0x3703('0x36')]?_0x150ed5[_0x3703('0x34')]:_0x168437[_0x3703('0x2f')];if(_0x47fbc7[_0x3703('0x30')][_0x3703('0x42')]){_0x150ed5['include']=[{'all':!![]}];}_0x150ed5=_[_0x3703('0x3c')]({},_0x150ed5,_0x47fbc7[_0x3703('0x3f')]);return db[_0x3703('0x40')][_0x3703('0x47')](_0x150ed5)[_0x3703('0x25')](handleEntityNotFound(_0x18cd07,null))[_0x3703('0x25')](function(_0xc00cc4){if(_0xc00cc4){var _0x4bd09b=_0xc00cc4[_0x3703('0x23')]({'plain':!![]});_0x4bd09b=qs[_0x3703('0x50')](_0x4bd09b,['id',_0x3703('0x51'),_0x3703('0x52')]);_0x47fbc7[_0x3703('0x49')]=_[_0x3703('0x50')](_0x47fbc7[_0x3703('0x49')],['id',_0x3703('0x51'),_0x3703('0x52')]);return db[_0x3703('0x40')][_0x3703('0x48')](_['merge'](_0x4bd09b,_0x47fbc7['body']),{'include':_0x47fbc7[_0x3703('0x30')][_0x3703('0x42')]?[{'all':!![]}]:undefined})[_0x3703('0x25')](function(_0x4f39ef){var _0x432741=_0x47fbc7[_0x3703('0x4b')]['get']({'plain':!![]});if(!_0x432741)throw new Error(_0x3703('0x4a'));if(_0x432741['role']===_0x3703('0x4b')){var _0x11be13=_0x4f39ef[_0x3703('0x23')]({'plain':!![]});var _0x599b8b='IvrCampaigns';return db[_0x3703('0x4d')]['find']({'where':{'name':_0x599b8b,'userProfileId':_0x432741[_0x3703('0x53')]},'raw':!![]})[_0x3703('0x25')](function(_0x373ec9){if(_0x373ec9&&_0x373ec9[_0x3703('0x4e')]===0x0){return db[_0x3703('0x24')][_0x3703('0x48')]({'name':_0x11be13[_0x3703('0x27')],'resourceId':_0x11be13['id'],'type':_0x373ec9[_0x3703('0x27')],'sectionId':_0x373ec9['id']},{})[_0x3703('0x25')](function(){return _0x4f39ef;});}else{return _0x4f39ef;}})[_0x3703('0x45')](function(_0x3975c2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3975c2);throw _0x3975c2;});}return _0x4f39ef;});}})[_0x3703('0x25')](respondWithResult(_0x18cd07,0xc9))['catch'](handleError(_0x18cd07,null));};exports[_0x3703('0x54')]=function(_0x5c0e9d,_0x56e877){if(_0x5c0e9d[_0x3703('0x49')]['id']){delete _0x5c0e9d['body']['id'];}return db['Campaign'][_0x3703('0x47')]({'where':{'id':_0x5c0e9d[_0x3703('0x46')]['id']}})['then'](handleEntityNotFound(_0x56e877,null))[_0x3703('0x25')](saveUpdates(_0x5c0e9d['body'],null))[_0x3703('0x25')](respondWithResult(_0x56e877,null))['catch'](handleError(_0x56e877,null));};exports[_0x3703('0x22')]=function(_0x4c1584,_0x391b57){return db[_0x3703('0x40')][_0x3703('0x47')]({'where':{'id':_0x4c1584[_0x3703('0x46')]['id']}})['then'](handleEntityNotFound(_0x391b57,null))[_0x3703('0x25')](removeEntity(_0x391b57,null))[_0x3703('0x45')](handleError(_0x391b57,null));};exports[_0x3703('0x55')]=function(_0x2dc403,_0x57c825,_0x5e6bb8){var _0x3eea4f={'raw':!![],'where':{}};var _0x4f8963={};var _0x32127e={'count':0x0,'rows':[]};return db[_0x3703('0x40')]['findOne']({'where':{'id':_0x2dc403['params']['id']}})['then'](handleEntityNotFound(_0x57c825,null))['then'](function(_0x480d5e){if(_0x480d5e){_0x4f8963[_0x3703('0x2f')]=_[_0x3703('0x31')](db[_0x3703('0x56')][_0x3703('0x2b')]);_0x4f8963[_0x3703('0x30')]=_[_0x3703('0x31')](_0x2dc403[_0x3703('0x30')]);_0x4f8963[_0x3703('0x32')]=_[_0x3703('0x33')](_0x4f8963[_0x3703('0x2f')],_0x4f8963['query']);_0x3eea4f[_0x3703('0x34')]=_['intersection'](_0x4f8963[_0x3703('0x2f')],qs[_0x3703('0x35')](_0x2dc403[_0x3703('0x30')][_0x3703('0x35')]));_0x3eea4f[_0x3703('0x34')]=_0x3eea4f['attributes']['length']?_0x3eea4f[_0x3703('0x34')]:_0x4f8963['model'];if(!_0x2dc403['query'][_0x3703('0x37')](_0x3703('0x38'))){_0x3eea4f[_0x3703('0x1d')]=qs['limit'](_0x2dc403[_0x3703('0x30')][_0x3703('0x1d')]);_0x3eea4f[_0x3703('0x1b')]=qs[_0x3703('0x1b')](_0x2dc403[_0x3703('0x30')]['offset']);}_0x3eea4f[_0x3703('0x39')]=qs['sort'](_0x2dc403[_0x3703('0x30')][_0x3703('0x57')]);_0x3eea4f[_0x3703('0x3a')]=qs[_0x3703('0x32')](_[_0x3703('0x3b')](_0x2dc403[_0x3703('0x30')],_0x4f8963[_0x3703('0x32')]));_0x3eea4f[_0x3703('0x3a')][_0x3703('0x58')]=_0x480d5e['id'];if(_0x2dc403['query']['filter']){_0x3eea4f[_0x3703('0x3a')]=_['merge'](_0x3eea4f[_0x3703('0x3a')],{'$or':_[_0x3703('0x2a')](_0x3eea4f['attributes'],function(_0x20ab73){var _0xb32369={};_0xb32369[_0x20ab73]={'$like':'%'+_0x2dc403[_0x3703('0x30')][_0x3703('0x3e')]+'%'};return _0xb32369;})});}_0x3eea4f=_['merge']({},_0x3eea4f,_0x2dc403[_0x3703('0x3f')]);return db[_0x3703('0x56')][_0x3703('0x41')]({'where':_0x3eea4f['where']})[_0x3703('0x25')](function(_0x582ea8){_0x32127e[_0x3703('0x41')]=_0x582ea8;if(_0x2dc403['query'][_0x3703('0x42')]){_0x3eea4f[_0x3703('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0x3703('0x44')](_0x3eea4f);})['then'](function(_0x56a0cc){_0x32127e[_0x3703('0x59')]=_0x56a0cc;return _0x32127e;});}})[_0x3703('0x25')](respondWithFilteredResult(_0x57c825,_0x3eea4f))['catch'](handleError(_0x57c825,null));};exports['getHopperHistories']=function(_0xfc1b50,_0x4f25f8,_0x17617b){var _0x285edd={'raw':!![],'where':{}};var _0x543a5c={};var _0x44939f={'count':0x0,'rows':[]};return db[_0x3703('0x40')]['findOne']({'where':{'id':_0xfc1b50['params']['id']}})[_0x3703('0x25')](handleEntityNotFound(_0x4f25f8,null))[_0x3703('0x25')](function(_0x232120){if(_0x232120){_0x543a5c['model']=_[_0x3703('0x31')](db[_0x3703('0x5a')][_0x3703('0x2b')]);_0x543a5c[_0x3703('0x30')]=_[_0x3703('0x31')](_0xfc1b50[_0x3703('0x30')]);_0x543a5c[_0x3703('0x32')]=_[_0x3703('0x33')](_0x543a5c[_0x3703('0x2f')],_0x543a5c[_0x3703('0x30')]);_0x285edd[_0x3703('0x34')]=_[_0x3703('0x33')](_0x543a5c['model'],qs[_0x3703('0x35')](_0xfc1b50[_0x3703('0x30')][_0x3703('0x35')]));_0x285edd['attributes']=_0x285edd[_0x3703('0x34')][_0x3703('0x36')]?_0x285edd[_0x3703('0x34')]:_0x543a5c[_0x3703('0x2f')];if(!_0xfc1b50[_0x3703('0x30')][_0x3703('0x37')]('nolimit')){_0x285edd[_0x3703('0x1d')]=qs[_0x3703('0x1d')](_0xfc1b50[_0x3703('0x30')]['limit']);_0x285edd['offset']=qs[_0x3703('0x1b')](_0xfc1b50[_0x3703('0x30')][_0x3703('0x1b')]);}_0x285edd[_0x3703('0x39')]=qs[_0x3703('0x57')](_0xfc1b50['query']['sort']);_0x285edd[_0x3703('0x3a')]=qs[_0x3703('0x32')](_[_0x3703('0x3b')](_0xfc1b50[_0x3703('0x30')],_0x543a5c['filters']));_0x285edd[_0x3703('0x3a')]['CampaignId']=_0x232120['id'];if(_0xfc1b50[_0x3703('0x30')][_0x3703('0x3e')]){_0x285edd[_0x3703('0x3a')]=_[_0x3703('0x3c')](_0x285edd[_0x3703('0x3a')],{'$or':_[_0x3703('0x2a')](_0x285edd['attributes'],function(_0xc3c303){var _0x28a843={};_0x28a843[_0xc3c303]={'$like':'%'+_0xfc1b50['query'][_0x3703('0x3e')]+'%'};return _0x28a843;})});}_0x285edd=_[_0x3703('0x3c')]({},_0x285edd,_0xfc1b50['options']);return db[_0x3703('0x5a')]['count']({'where':_0x285edd[_0x3703('0x3a')]})[_0x3703('0x25')](function(_0x16af58){_0x44939f[_0x3703('0x41')]=_0x16af58;if(_0xfc1b50[_0x3703('0x30')]['includeAll']){_0x285edd[_0x3703('0x43')]=[{'all':!![]}];}return db[_0x3703('0x5a')]['findAll'](_0x285edd);})[_0x3703('0x25')](function(_0x58ee32){_0x44939f[_0x3703('0x59')]=_0x58ee32;return _0x44939f;});}})[_0x3703('0x25')](respondWithFilteredResult(_0x4f25f8,_0x285edd))[_0x3703('0x45')](handleError(_0x4f25f8,null));};exports[_0x3703('0x5b')]=function(_0x16575d,_0x520722,_0x5b889e){var _0x3ac92b={'raw':!![],'where':{}};var _0x15ba31={};var _0x38118a={'count':0x0,'rows':[]};return db[_0x3703('0x40')]['findOne']({'where':{'id':_0x16575d['params']['id']}})['then'](handleEntityNotFound(_0x520722,null))[_0x3703('0x25')](function(_0x391d30){if(_0x391d30){_0x15ba31[_0x3703('0x2f')]=_[_0x3703('0x31')](db[_0x3703('0x5c')][_0x3703('0x2b')]);_0x15ba31[_0x3703('0x30')]=_[_0x3703('0x31')](_0x16575d[_0x3703('0x30')]);_0x15ba31['filters']=_[_0x3703('0x33')](_0x15ba31[_0x3703('0x2f')],_0x15ba31[_0x3703('0x30')]);_0x3ac92b[_0x3703('0x34')]=_[_0x3703('0x33')](_0x15ba31[_0x3703('0x2f')],qs[_0x3703('0x35')](_0x16575d[_0x3703('0x30')]['fields']));_0x3ac92b[_0x3703('0x34')]=_0x3ac92b[_0x3703('0x34')]['length']?_0x3ac92b['attributes']:_0x15ba31[_0x3703('0x2f')];if(!_0x16575d[_0x3703('0x30')]['hasOwnProperty'](_0x3703('0x38'))){_0x3ac92b[_0x3703('0x1d')]=qs[_0x3703('0x1d')](_0x16575d[_0x3703('0x30')][_0x3703('0x1d')]);_0x3ac92b[_0x3703('0x1b')]=qs['offset'](_0x16575d[_0x3703('0x30')][_0x3703('0x1b')]);}_0x3ac92b[_0x3703('0x39')]=qs[_0x3703('0x57')](_0x16575d[_0x3703('0x30')][_0x3703('0x57')]);_0x3ac92b[_0x3703('0x3a')]=qs['filters'](_[_0x3703('0x3b')](_0x16575d[_0x3703('0x30')],_0x15ba31['filters']));_0x3ac92b[_0x3703('0x3a')][_0x3703('0x58')]=_0x391d30['id'];if(_0x16575d[_0x3703('0x30')][_0x3703('0x3e')]){_0x3ac92b[_0x3703('0x3a')]=_['merge'](_0x3ac92b[_0x3703('0x3a')],{'$or':_['map'](_0x3ac92b[_0x3703('0x34')],function(_0x4481e7){var _0x2a1a10={};_0x2a1a10[_0x4481e7]={'$like':'%'+_0x16575d[_0x3703('0x30')]['filter']+'%'};return _0x2a1a10;})});}_0x3ac92b=_[_0x3703('0x3c')]({},_0x3ac92b,_0x16575d[_0x3703('0x3f')]);return db[_0x3703('0x5c')]['count']({'where':_0x3ac92b[_0x3703('0x3a')]})[_0x3703('0x25')](function(_0x648474){_0x38118a['count']=_0x648474;if(_0x16575d['query'][_0x3703('0x42')]){_0x3ac92b[_0x3703('0x43')]=[{'all':!![]}];}return db[_0x3703('0x5c')][_0x3703('0x44')](_0x3ac92b);})[_0x3703('0x25')](function(_0x4e750b){_0x38118a[_0x3703('0x59')]=_0x4e750b;return _0x38118a;});}})['then'](respondWithFilteredResult(_0x520722,_0x3ac92b))[_0x3703('0x45')](handleError(_0x520722,null));};exports['getHopperBlacks']=function(_0x3ac210,_0x83d572,_0x500145){var _0x51d5fd={'raw':!![],'where':{}};var _0x90ba0b={};var _0x41372f={'count':0x0,'rows':[]};return db[_0x3703('0x40')][_0x3703('0x5d')]({'where':{'id':_0x3ac210[_0x3703('0x46')]['id']}})[_0x3703('0x25')](handleEntityNotFound(_0x83d572,null))['then'](function(_0x234e96){if(_0x234e96){_0x90ba0b[_0x3703('0x2f')]=_[_0x3703('0x31')](db[_0x3703('0x5e')][_0x3703('0x2b')]);_0x90ba0b['query']=_['keys'](_0x3ac210[_0x3703('0x30')]);_0x90ba0b[_0x3703('0x32')]=_[_0x3703('0x33')](_0x90ba0b[_0x3703('0x2f')],_0x90ba0b[_0x3703('0x30')]);_0x51d5fd[_0x3703('0x34')]=_['intersection'](_0x90ba0b[_0x3703('0x2f')],qs[_0x3703('0x35')](_0x3ac210[_0x3703('0x30')][_0x3703('0x35')]));_0x51d5fd['attributes']=_0x51d5fd['attributes'][_0x3703('0x36')]?_0x51d5fd[_0x3703('0x34')]:_0x90ba0b[_0x3703('0x2f')];if(!_0x3ac210['query'][_0x3703('0x37')](_0x3703('0x38'))){_0x51d5fd[_0x3703('0x1d')]=qs[_0x3703('0x1d')](_0x3ac210[_0x3703('0x30')]['limit']);_0x51d5fd['offset']=qs['offset'](_0x3ac210[_0x3703('0x30')][_0x3703('0x1b')]);}_0x51d5fd[_0x3703('0x39')]=qs[_0x3703('0x57')](_0x3ac210[_0x3703('0x30')][_0x3703('0x57')]);_0x51d5fd[_0x3703('0x3a')]=qs[_0x3703('0x32')](_[_0x3703('0x3b')](_0x3ac210[_0x3703('0x30')],_0x90ba0b[_0x3703('0x32')]));_0x51d5fd[_0x3703('0x3a')][_0x3703('0x58')]=_0x234e96['id'];if(_0x3ac210[_0x3703('0x30')][_0x3703('0x3e')]){_0x51d5fd[_0x3703('0x3a')]=_['merge'](_0x51d5fd[_0x3703('0x3a')],{'$or':_['map'](_0x51d5fd[_0x3703('0x34')],function(_0x4a5619){var _0x3dde43={};_0x3dde43[_0x4a5619]={'$like':'%'+_0x3ac210[_0x3703('0x30')][_0x3703('0x3e')]+'%'};return _0x3dde43;})});}_0x51d5fd=_[_0x3703('0x3c')]({},_0x51d5fd,_0x3ac210['options']);return db['CmHopperBlack'][_0x3703('0x41')]({'where':_0x51d5fd[_0x3703('0x3a')]})[_0x3703('0x25')](function(_0x3d519f){_0x41372f['count']=_0x3d519f;if(_0x3ac210[_0x3703('0x30')][_0x3703('0x42')]){_0x51d5fd[_0x3703('0x43')]=[{'all':!![]}];}return db[_0x3703('0x5e')][_0x3703('0x44')](_0x51d5fd);})[_0x3703('0x25')](function(_0x2b69e3){_0x41372f[_0x3703('0x59')]=_0x2b69e3;return _0x41372f;});}})[_0x3703('0x25')](respondWithFilteredResult(_0x83d572,_0x51d5fd))['catch'](handleError(_0x83d572,null));};exports[_0x3703('0x5f')]=function(_0x23eb2e,_0x16456a,_0x49c07a){var _0x46be23={};var _0x449625={};var _0x433179;var _0xc01dcd;return db[_0x3703('0x40')][_0x3703('0x5d')]({'where':{'id':_0x23eb2e[_0x3703('0x46')]['id']}})['then'](handleEntityNotFound(_0x16456a,null))[_0x3703('0x25')](function(_0x58698a){if(_0x58698a){_0x433179=_0x58698a;_0x449625[_0x3703('0x2f')]=_[_0x3703('0x31')](db[_0x3703('0x60')]['rawAttributes']);_0x449625[_0x3703('0x30')]=_[_0x3703('0x31')](_0x23eb2e['query']);_0x449625[_0x3703('0x32')]=_[_0x3703('0x33')](_0x449625['model'],_0x449625[_0x3703('0x30')]);_0x46be23[_0x3703('0x34')]=_[_0x3703('0x33')](_0x449625['model'],qs[_0x3703('0x35')](_0x23eb2e[_0x3703('0x30')][_0x3703('0x35')]));_0x46be23[_0x3703('0x34')]=_0x46be23[_0x3703('0x34')][_0x3703('0x36')]?_0x46be23[_0x3703('0x34')]:_0x449625['model'];_0x46be23[_0x3703('0x39')]=qs['sort'](_0x23eb2e[_0x3703('0x30')][_0x3703('0x57')]);_0x46be23[_0x3703('0x3a')]=qs[_0x3703('0x32')](_[_0x3703('0x3b')](_0x23eb2e[_0x3703('0x30')],_0x449625[_0x3703('0x32')]));if(_0x23eb2e['query'][_0x3703('0x3e')]){_0x46be23['where']=_[_0x3703('0x3c')](_0x46be23[_0x3703('0x3a')],{'$or':_[_0x3703('0x2a')](_0x46be23[_0x3703('0x34')],function(_0x327b06){var _0xfcec4f={};_0xfcec4f[_0x327b06]={'$like':'%'+_0x23eb2e[_0x3703('0x30')][_0x3703('0x3e')]+'%'};return _0xfcec4f;})});}_0x46be23=_[_0x3703('0x3c')]({},_0x46be23,_0x23eb2e['options']);return _0x433179[_0x3703('0x5f')](_0x46be23);}})['then'](function(_0x40e73e){if(_0x40e73e){_0xc01dcd=_0x40e73e[_0x3703('0x36')];if(!_0x23eb2e[_0x3703('0x30')]['hasOwnProperty'](_0x3703('0x38'))){_0x46be23['limit']=qs[_0x3703('0x1d')](_0x23eb2e[_0x3703('0x30')][_0x3703('0x1d')]);_0x46be23[_0x3703('0x1b')]=qs[_0x3703('0x1b')](_0x23eb2e['query'][_0x3703('0x1b')]);}return _0x433179[_0x3703('0x5f')](_0x46be23);}})[_0x3703('0x25')](function(_0x2714fe){if(_0x2714fe){return _0x2714fe?{'count':_0xc01dcd,'rows':_0x2714fe}:null;}})[_0x3703('0x25')](respondWithResult(_0x16456a,null))[_0x3703('0x45')](handleError(_0x16456a,null));};exports[_0x3703('0x61')]=function(_0x310553,_0x2fc8d4,_0x3b11af){var _0x248362,_0x755570;var _0x48fb79=[];var _0x19afe4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3703('0x40')][_0x3703('0x47')]({'where':{'id':_0x310553[_0x3703('0x46')]['id']}})[_0x3703('0x25')](handleEntityNotFound(_0x2fc8d4,null))[_0x3703('0x25')](function(_0x300756){if(_0x300756){_0x755570=_0x300756;return _0x300756[_0x3703('0x61')](_0x310553['body'][_0x3703('0x62')],_[_0x3703('0x50')](_0x310553[_0x3703('0x49')],['ids','id'])||{});}return null;})[_0x3703('0x63')](function(_0x2063e3){var _0x5b2cc9;var _0x2cf7a0;_0x248362=_0x2063e3||[];var _0x438bdf=[];if(_0x2063e3){for(var _0x513a5c=0x0;_0x513a5c<_0x2063e3[_0x3703('0x36')];_0x513a5c+=0x1){var _0x462819=_0x2063e3[_0x513a5c]['get']({'plain':!![]});_0x755570['dialCheckDuplicateType']=_0x310553['body'][_0x3703('0x64')]?_0x310553[_0x3703('0x49')][_0x3703('0x64')]:_0x755570[_0x3703('0x64')];switch(_0x755570['dialCheckDuplicateType']){case'always':_0x5b2cc9=squel[_0x3703('0x65')]()[_0x3703('0x66')](_0x3703('0x67'))[_0x3703('0x68')](['phone',_0x3703('0x69'),'ContactId','ListId',_0x3703('0x58'),_0x3703('0x51'),_0x3703('0x52')],squel['select']()['field'](_0x3703('0x6a'),_0x3703('0x6a'))['field'](_0x3703('0x6b'),'scheduledAt')[_0x3703('0x6c')]('id',_0x3703('0x6d'))[_0x3703('0x6c')](_0x462819[_0x3703('0x6e')][_0x3703('0x6f')](),_0x3703('0x70'))[_0x3703('0x6c')](_0x310553[_0x3703('0x46')]['id'][_0x3703('0x6f')](),_0x3703('0x58'))[_0x3703('0x6c')]('\x27'+_0x19afe4+'\x27','createdAt')[_0x3703('0x6c')]('\x27'+_0x19afe4+'\x27',_0x3703('0x52'))['from'](_0x3703('0x71'))[_0x3703('0x3a')](_0x3703('0x72'))['where'](_0x3703('0x73'),_0x462819[_0x3703('0x6e')][_0x3703('0x6f')]())[_0x3703('0x3a')](_0x3703('0x74'))[_0x3703('0x3a')](_0x3703('0x75'),squel[_0x3703('0x76')]()[_0x3703('0x6c')](_0x3703('0x77'))[_0x3703('0x78')](_0x3703('0x79'))[_0x3703('0x3a')]('CampaignId\x20=\x20?',_0x310553[_0x3703('0x46')]['id']['toString']()))[_0x3703('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3703('0x76')]()[_0x3703('0x6c')](_0x3703('0x7a'))[_0x3703('0x78')](_0x3703('0x67'))[_0x3703('0x3a')](_0x3703('0x7b'),_0x310553['params']['id'][_0x3703('0x6f')]())))[_0x3703('0x6f')]();break;case _0x3703('0x7c'):_0x5b2cc9=squel[_0x3703('0x65')]()[_0x3703('0x66')](_0x3703('0x67'))[_0x3703('0x68')](['phone',_0x3703('0x69'),_0x3703('0x6d'),_0x3703('0x70'),_0x3703('0x58'),_0x3703('0x51'),_0x3703('0x52')],squel[_0x3703('0x76')]()[_0x3703('0x6c')](_0x3703('0x6a'),_0x3703('0x6a'))[_0x3703('0x6c')](_0x3703('0x6b'),_0x3703('0x69'))[_0x3703('0x6c')]('id','ContactId')['field'](_0x462819['CmListId']['toString'](),_0x3703('0x70'))['field'](_0x310553[_0x3703('0x46')]['id'][_0x3703('0x6f')](),_0x3703('0x58'))[_0x3703('0x6c')]('\x27'+_0x19afe4+'\x27',_0x3703('0x51'))[_0x3703('0x6c')]('\x27'+_0x19afe4+'\x27','updatedAt')[_0x3703('0x78')](_0x3703('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0x3703('0x3a')](_0x3703('0x73'),_0x462819[_0x3703('0x6e')][_0x3703('0x6f')]())[_0x3703('0x3a')](_0x3703('0x74'))[_0x3703('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3703('0x76')]()[_0x3703('0x6c')]('COALESCE(phone,\x27\x27)')[_0x3703('0x78')]('cm_hopper')[_0x3703('0x3a')](_0x3703('0x7b'),_0x310553['params']['id'][_0x3703('0x6f')]())))[_0x3703('0x6f')]();break;default:_0x5b2cc9=squel[_0x3703('0x65')]()[_0x3703('0x66')]('cm_hopper')['fromQuery']([_0x3703('0x6a'),_0x3703('0x69'),_0x3703('0x6d'),_0x3703('0x70'),_0x3703('0x58'),'createdAt',_0x3703('0x52')],squel[_0x3703('0x76')]()[_0x3703('0x6c')](_0x3703('0x6a'),'phone')['field']('NOW()','scheduledAt')['field']('id',_0x3703('0x6d'))[_0x3703('0x6c')](_0x462819[_0x3703('0x6e')][_0x3703('0x6f')](),_0x3703('0x70'))[_0x3703('0x6c')](_0x310553['params']['id'][_0x3703('0x6f')](),_0x3703('0x58'))[_0x3703('0x6c')]('\x27'+_0x19afe4+'\x27','createdAt')['field']('\x27'+_0x19afe4+'\x27',_0x3703('0x52'))[_0x3703('0x78')](_0x3703('0x71'))[_0x3703('0x3a')]('deletedAt\x20IS\x20NULL')[_0x3703('0x3a')](_0x3703('0x73'),_0x462819[_0x3703('0x6e')][_0x3703('0x6f')]())[_0x3703('0x3a')](_0x3703('0x74')))[_0x3703('0x6f')]();}_0x2cf7a0=squel['insert']()[_0x3703('0x66')](_0x3703('0x7d'))[_0x3703('0x68')](['cmHopperId',_0x3703('0x69'),_0x3703('0x6a'),'OrderBy',_0x3703('0x51'),'updatedAt'],squel[_0x3703('0x76')]()['field'](_0x3703('0x7e'),'id')[_0x3703('0x6c')](_0x3703('0x6b'),_0x3703('0x69'))[_0x3703('0x6c')](_0x3703('0x7f'),_0x3703('0x6a'))[_0x3703('0x6c')](_0x3703('0x80'),_0x3703('0x81'))[_0x3703('0x6c')]('\x27'+_0x19afe4+'\x27',_0x3703('0x51'))['field']('\x27'+_0x19afe4+'\x27','updatedAt')[_0x3703('0x78')]('cm_contact_has_items','ci')[_0x3703('0x82')](_0x3703('0x67'),'h',_0x3703('0x83'))[_0x3703('0x3a')](_0x3703('0x84'),_0x462819[_0x3703('0x6e')][_0x3703('0x6f')]())[_0x3703('0x3a')](_0x3703('0x85'),_0x310553['params']['id'][_0x3703('0x6f')]())[_0x3703('0x3a')](_0x3703('0x86'),_0x19afe4))[_0x3703('0x6f')]();_0x438bdf[_0x3703('0x87')](db[_0x3703('0x88')][_0x3703('0x30')](_0x5b2cc9));_0x48fb79[_0x3703('0x87')](db[_0x3703('0x88')][_0x3703('0x30')](_0x2cf7a0));}return BPromise[_0x3703('0x89')](_0x438bdf);}})[_0x3703('0x25')](function(){return BPromise['all'](_0x48fb79);})[_0x3703('0x25')](function(){return _0x248362;})[_0x3703('0x25')](respondWithResult(_0x2fc8d4,null))[_0x3703('0x45')](handleError(_0x2fc8d4,null));};exports[_0x3703('0x8a')]=function(_0x202a8d,_0x535c8b,_0xe6d548){return db[_0x3703('0x40')][_0x3703('0x47')]({'where':{'id':_0x202a8d[_0x3703('0x46')]['id']}})[_0x3703('0x25')](handleEntityNotFound(_0x535c8b,null))[_0x3703('0x25')](function(_0x37a659){if(_0x37a659){return _0x37a659['removeLists'](_0x202a8d[_0x3703('0x30')]['ids']);}})[_0x3703('0x25')](function(_0x54432d){if(_0x54432d){return db['CmHopper'][_0x3703('0x22')]({'where':{'ListId':_0x202a8d[_0x3703('0x30')][_0x3703('0x62')],'CampaignId':_0x202a8d[_0x3703('0x46')]['id']}})[_0x3703('0x25')](function(){return _0x54432d;});}})[_0x3703('0x25')](respondWithStatusCode(_0x535c8b,null))[_0x3703('0x45')](handleError(_0x535c8b,null));};exports['getBlackLists']=function(_0x303195,_0x4caee4,_0x5417ea){var _0xa43f39={};var _0x5d3e2d={};var _0x5b9cb4;var _0xd5ac19;return db[_0x3703('0x40')][_0x3703('0x5d')]({'where':{'id':_0x303195[_0x3703('0x46')]['id']}})['then'](handleEntityNotFound(_0x4caee4,null))[_0x3703('0x25')](function(_0x460b01){if(_0x460b01){_0x5b9cb4=_0x460b01;_0x5d3e2d[_0x3703('0x2f')]=_[_0x3703('0x31')](db[_0x3703('0x60')][_0x3703('0x2b')]);_0x5d3e2d[_0x3703('0x30')]=_[_0x3703('0x31')](_0x303195[_0x3703('0x30')]);_0x5d3e2d[_0x3703('0x32')]=_[_0x3703('0x33')](_0x5d3e2d[_0x3703('0x2f')],_0x5d3e2d[_0x3703('0x30')]);_0xa43f39['attributes']=_['intersection'](_0x5d3e2d[_0x3703('0x2f')],qs[_0x3703('0x35')](_0x303195[_0x3703('0x30')][_0x3703('0x35')]));_0xa43f39[_0x3703('0x34')]=_0xa43f39[_0x3703('0x34')][_0x3703('0x36')]?_0xa43f39[_0x3703('0x34')]:_0x5d3e2d['model'];_0xa43f39['order']=qs[_0x3703('0x57')](_0x303195[_0x3703('0x30')]['sort']);_0xa43f39[_0x3703('0x3a')]=qs[_0x3703('0x32')](_['pick'](_0x303195[_0x3703('0x30')],_0x5d3e2d['filters']));if(_0x303195[_0x3703('0x30')][_0x3703('0x3e')]){_0xa43f39['where']=_[_0x3703('0x3c')](_0xa43f39[_0x3703('0x3a')],{'$or':_[_0x3703('0x2a')](_0xa43f39[_0x3703('0x34')],function(_0x253334){var _0x38c39f={};_0x38c39f[_0x253334]={'$like':'%'+_0x303195[_0x3703('0x30')][_0x3703('0x3e')]+'%'};return _0x38c39f;})});}_0xa43f39=_[_0x3703('0x3c')]({},_0xa43f39,_0x303195[_0x3703('0x3f')]);return _0x5b9cb4[_0x3703('0x8b')](_0xa43f39);}})[_0x3703('0x25')](function(_0x3d0c4c){if(_0x3d0c4c){_0xd5ac19=_0x3d0c4c[_0x3703('0x36')];if(!_0x303195['query']['hasOwnProperty'](_0x3703('0x38'))){_0xa43f39['limit']=qs[_0x3703('0x1d')](_0x303195['query'][_0x3703('0x1d')]);_0xa43f39[_0x3703('0x1b')]=qs[_0x3703('0x1b')](_0x303195[_0x3703('0x30')][_0x3703('0x1b')]);}return _0x5b9cb4[_0x3703('0x8b')](_0xa43f39);}})['then'](function(_0x417e6a){if(_0x417e6a){return _0x417e6a?{'count':_0xd5ac19,'rows':_0x417e6a}:null;}})[_0x3703('0x25')](respondWithResult(_0x4caee4,null))[_0x3703('0x45')](handleError(_0x4caee4,null));};exports[_0x3703('0x8c')]=function(_0x9fe43d,_0x49bbb3,_0x47c8f9){var _0x44c85b,_0x4a5958;var _0x9de845=[];var _0xda21e6=moment()[_0x3703('0x8d')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3703('0x40')][_0x3703('0x47')]({'where':{'id':_0x9fe43d[_0x3703('0x46')]['id']}})['then'](handleEntityNotFound(_0x49bbb3,null))[_0x3703('0x25')](function(_0x48124d){if(_0x48124d){_0x4a5958=_0x48124d;return _0x48124d['addBlackLists'](_0x9fe43d[_0x3703('0x49')][_0x3703('0x62')],_[_0x3703('0x50')](_0x9fe43d['body'],[_0x3703('0x62'),'id'])||{});}return null;})[_0x3703('0x63')](function(_0x5dd35c){var _0x349242;var _0x1cbd15;_0x44c85b=_0x5dd35c||[];var _0x55b945=[];if(_0x5dd35c){for(var _0x47f87e=0x0;_0x47f87e<_0x5dd35c['length'];_0x47f87e+=0x1){var _0x1d6fad=_0x5dd35c[_0x47f87e][_0x3703('0x23')]({'plain':!![]});_0x349242=squel[_0x3703('0x65')]()[_0x3703('0x66')](_0x3703('0x8e'))[_0x3703('0x68')](['phone',_0x3703('0x6d'),_0x3703('0x70'),_0x3703('0x58'),_0x3703('0x51'),'updatedAt'],squel[_0x3703('0x76')]()['field'](_0x3703('0x6a'),_0x3703('0x6a'))['field']('id',_0x3703('0x6d'))[_0x3703('0x6c')](_0x1d6fad[_0x3703('0x6e')]['toString'](),_0x3703('0x70'))[_0x3703('0x6c')](_0x9fe43d[_0x3703('0x46')]['id'][_0x3703('0x6f')](),_0x3703('0x58'))[_0x3703('0x6c')](_0x3703('0x6b'),'createdAt')[_0x3703('0x6c')](_0x3703('0x6b'),_0x3703('0x52'))[_0x3703('0x78')](_0x3703('0x71'))['where'](_0x3703('0x72'))[_0x3703('0x3a')]('ListId\x20=\x20?',_0x1d6fad[_0x3703('0x6e')][_0x3703('0x6f')]())['where'](_0x3703('0x74')))[_0x3703('0x6f')]();_0x55b945[_0x3703('0x87')](db['sequelize'][_0x3703('0x30')](_0x349242));}return BPromise[_0x3703('0x89')](_0x55b945);}})[_0x3703('0x25')](function(){return _0x44c85b;})[_0x3703('0x25')](respondWithResult(_0x49bbb3,null))[_0x3703('0x45')](handleError(_0x49bbb3,null));};exports[_0x3703('0x8f')]=function(_0x8a3cfc,_0xa8a5d1,_0x4008f5){return db[_0x3703('0x40')][_0x3703('0x47')]({'where':{'id':_0x8a3cfc[_0x3703('0x46')]['id']}})[_0x3703('0x25')](handleEntityNotFound(_0xa8a5d1,null))['then'](function(_0xcf73ca){if(_0xcf73ca){return _0xcf73ca[_0x3703('0x8f')](_0x8a3cfc['query'][_0x3703('0x62')]);}})[_0x3703('0x25')](function(_0x5f0a53){if(_0x5f0a53){return db[_0x3703('0x5e')][_0x3703('0x22')]({'where':{'ListId':_0x8a3cfc[_0x3703('0x30')]['ids'],'CampaignId':_0x8a3cfc[_0x3703('0x46')]['id']}})[_0x3703('0x25')](function(){return _0x5f0a53;});}})[_0x3703('0x25')](respondWithStatusCode(_0xa8a5d1,null))[_0x3703('0x45')](handleError(_0xa8a5d1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b765832..7620474 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(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x861e02,_0x33f772){var _0x48fc24=function(_0x21b4d3){while(--_0x21b4d3){_0x861e02['push'](_0x861e02['shift']());}};_0x48fc24(++_0x33f772);}(_0x7a54,0x106));var _0x47a5=function(_0x3377bd,_0x104d31){_0x3377bd=_0x3377bd-0x0;var _0x25dd08=_0x7a54[_0x3377bd];return _0x25dd08;};'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 df79421..91b9479 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 _0xaaa2=['where','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','Campaign,\x20%s,\x20%s','message','info','result','GetCampaign','findAll','options','raw'];(function(_0x616e0b,_0x45296f){var _0x525b28=function(_0x19b617){while(--_0x19b617){_0x616e0b['push'](_0x616e0b['shift']());}};_0x525b28(++_0x45296f);}(_0xaaa2,0xac));var _0x2aaa=function(_0x11473a,_0x48a352){_0x11473a=_0x11473a-0x0;var _0x1b8cfb=_0xaaa2[_0x11473a];return _0x1b8cfb;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106af9,_0x4f51e6,_0x2f16d7){return new BPromise(function(_0x514c32,_0x505fe8){return client[_0x2aaa('0xc')](_0x106af9,_0x2f16d7)['then'](function(_0x1ad6e9){logger['info']('Campaign,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));logger[_0x2aaa('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x1ad6e9));if(_0x1ad6e9[_0x2aaa('0x10')]){if(_0x1ad6e9['error'][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x505fe8(_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x514c32(_0x1ad6e9[_0x2aaa('0x10')]['message']);}else{logger[_0x2aaa('0x14')]('Campaign,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));_0x514c32(_0x1ad6e9[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x50a767){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x50a767);_0x505fe8(_0x50a767);});});}exports[_0x2aaa('0x16')]=function(_0x3b94bf){var _0x1cae3e=this;return new Promise(function(_0xdaa445,_0x38a049){return db['Campaign'][_0x2aaa('0x17')]({'raw':_0x3b94bf[_0x2aaa('0x18')]?_0x3b94bf['options'][_0x2aaa('0x19')]===undefined?!![]:![]:!![],'where':_0x3b94bf['options']?_0x3b94bf['options'][_0x2aaa('0x1a')]||null:null,'attributes':_0x3b94bf[_0x2aaa('0x18')]?_0x3b94bf[_0x2aaa('0x18')][_0x2aaa('0x1b')]||null:null,'limit':_0x3b94bf[_0x2aaa('0x18')]?_0x3b94bf[_0x2aaa('0x18')][_0x2aaa('0x1c')]||null:null,'include':_0x3b94bf[_0x2aaa('0x18')]?_0x3b94bf['options'][_0x2aaa('0x1d')]?_[_0x2aaa('0x1e')](_0x3b94bf['options']['include'],function(_0x19153e){return{'model':db[_0x19153e['model']],'as':_0x19153e['as'],'attributes':_0x19153e[_0x2aaa('0x1b')],'include':_0x19153e[_0x2aaa('0x1d')]?_['map'](_0x19153e[_0x2aaa('0x1d')],function(_0x3b99d8){return{'model':db[_0x3b99d8['model']],'as':_0x3b99d8['as'],'attributes':_0x3b99d8[_0x2aaa('0x1b')],'include':_0x3b99d8[_0x2aaa('0x1d')]?_[_0x2aaa('0x1e')](_0x3b99d8['include'],function(_0x1f626b){return{'model':db[_0x1f626b[_0x2aaa('0x1f')]],'as':_0x1f626b['as'],'attributes':_0x1f626b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3af929){logger[_0x2aaa('0x14')](_0x2aaa('0x16'),_0x3b94bf);logger[_0x2aaa('0xe')](_0x2aaa('0x16'),_0x3b94bf,JSON[_0x2aaa('0xf')](_0x3af929));_0xdaa445(_0x3af929);})[_0x2aaa('0x20')](function(_0x166dc0){logger[_0x2aaa('0x10')](_0x2aaa('0x16'),_0x166dc0[_0x2aaa('0x13')],_0x3b94bf);_0x38a049(_0x1cae3e[_0x2aaa('0x10')](0x1f4,_0x166dc0['message']));});});}; \ No newline at end of file +var _0xbd3b=['include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetCampaign','Campaign','options','raw','where','attributes'];(function(_0x186281,_0x2d1e34){var _0xf9956a=function(_0x57db03){while(--_0x57db03){_0x186281['push'](_0x186281['shift']());}};_0xf9956a(++_0x2d1e34);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x163555,_0x27ce78){_0x163555=_0x163555-0x0;var _0x250307=_0xbd3b[_0x163555];return _0x250307;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var moment=require(_0xbbd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbd3('0x3'));var fs=require('fs');var Redis=require(_0xbbd3('0x4'));var db=require(_0xbbd3('0x5'))['db'];var utils=require(_0xbbd3('0x6'));var logger=require('../../config/logger')(_0xbbd3('0x7'));var config=require(_0xbbd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbd3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc5d9,_0x232ede,_0x44f331){return new BPromise(function(_0x4b8667,_0x3d3f9f){return client[_0xbbd3('0xa')](_0x3cc5d9,_0x44f331)[_0xbbd3('0xb')](function(_0x229f59){logger['info'](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));logger[_0xbbd3('0xe')](_0xbbd3('0xf'),_0x232ede,'request\x20sent',JSON[_0xbbd3('0x10')](_0x229f59));if(_0x229f59['error']){if(_0x229f59['error'][_0xbbd3('0x11')]===0x1f4){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);return _0x3d3f9f(_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);}logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')]['message']);return _0x4b8667(_0x229f59['error'][_0xbbd3('0x13')]);}else{logger[_0xbbd3('0x14')](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));_0x4b8667(_0x229f59[_0xbbd3('0x15')]['message']);}})[_0xbbd3('0x16')](function(_0x49d6b9){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x49d6b9);_0x3d3f9f(_0x49d6b9);});});}exports[_0xbbd3('0x17')]=function(_0x240a46){var _0x5f3952=this;return new Promise(function(_0x50b6e4,_0x12954a){return db[_0xbbd3('0x18')]['findAll']({'raw':_0x240a46[_0xbbd3('0x19')]?_0x240a46['options'][_0xbbd3('0x1a')]===undefined?!![]:![]:!![],'where':_0x240a46[_0xbbd3('0x19')]?_0x240a46[_0xbbd3('0x19')][_0xbbd3('0x1b')]||null:null,'attributes':_0x240a46[_0xbbd3('0x19')]?_0x240a46[_0xbbd3('0x19')][_0xbbd3('0x1c')]||null:null,'limit':_0x240a46['options']?_0x240a46[_0xbbd3('0x19')]['limit']||null:null,'include':_0x240a46['options']?_0x240a46[_0xbbd3('0x19')][_0xbbd3('0x1d')]?_[_0xbbd3('0x1e')](_0x240a46[_0xbbd3('0x19')]['include'],function(_0x79e118){return{'model':db[_0x79e118['model']],'as':_0x79e118['as'],'attributes':_0x79e118[_0xbbd3('0x1c')],'include':_0x79e118['include']?_['map'](_0x79e118['include'],function(_0x51e13a){return{'model':db[_0x51e13a[_0xbbd3('0x1f')]],'as':_0x51e13a['as'],'attributes':_0x51e13a[_0xbbd3('0x1c')],'include':_0x51e13a['include']?_[_0xbbd3('0x1e')](_0x51e13a[_0xbbd3('0x1d')],function(_0x276f43){return{'model':db[_0x276f43[_0xbbd3('0x1f')]],'as':_0x276f43['as'],'attributes':_0x276f43['attributes']};}):[]};}):[]};}):[]:[]})[_0xbbd3('0xb')](function(_0x4b8dfa){logger[_0xbbd3('0x14')](_0xbbd3('0x17'),_0x240a46);logger['debug'](_0xbbd3('0x17'),_0x240a46,JSON[_0xbbd3('0x10')](_0x4b8dfa));_0x50b6e4(_0x4b8dfa);})[_0xbbd3('0x16')](function(_0x1c241f){logger[_0xbbd3('0x12')](_0xbbd3('0x17'),_0x1c241f[_0xbbd3('0x13')],_0x240a46);_0x12954a(_0x5f3952[_0xbbd3('0x12')](0x1f4,_0x1c241f[_0xbbd3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 004d0b7..62045f9 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 _0x6d5e=['getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','put','update','delete','destroy','removeLists','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0x3f2855,_0x220576){var _0x20c16f=function(_0x38da20){while(--_0x38da20){_0x3f2855['push'](_0x3f2855['shift']());}};_0x20c16f(++_0x220576);}(_0x6d5e,0xf4));var _0xe6d5=function(_0x1fceac,_0x16c280){_0x1fceac=_0x1fceac-0x0;var _0x512640=_0x6d5e[_0x1fceac];return _0x512640;};'use strict';var multer=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var path=require('path');var timeout=require(_0xe6d5('0x2'));var express=require(_0xe6d5('0x3'));var router=express[_0xe6d5('0x4')]();var fs_extra=require(_0xe6d5('0x5'));var auth=require(_0xe6d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe6d5('0x7'));var controller=require(_0xe6d5('0x8'));router['get']('/',auth[_0xe6d5('0x9')](),controller[_0xe6d5('0xa')]);router[_0xe6d5('0xb')](_0xe6d5('0xc'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0xd')]);router[_0xe6d5('0xb')]('/:id/hoppers',auth[_0xe6d5('0x9')](),controller[_0xe6d5('0xe')]);router[_0xe6d5('0xb')](_0xe6d5('0xf'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x10')]);router[_0xe6d5('0xb')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xe6d5('0xb')](_0xe6d5('0x11'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x12')]);router[_0xe6d5('0xb')](_0xe6d5('0x13'),auth['isAuthenticated'](),controller[_0xe6d5('0x14')]);router[_0xe6d5('0xb')](_0xe6d5('0x15'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x16')]);router[_0xe6d5('0x17')]('/',auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x18')]);router[_0xe6d5('0x17')](_0xe6d5('0x19'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x1a')]);router['post'](_0xe6d5('0x13'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x1b')]);router[_0xe6d5('0x17')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0xe6d5('0x1c')](_0xe6d5('0xc'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x1d')]);router[_0xe6d5('0x1e')](_0xe6d5('0xc'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x1f')]);router[_0xe6d5('0x1e')](_0xe6d5('0x13'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x20')]);router[_0xe6d5('0x1e')](_0xe6d5('0x15'),auth[_0xe6d5('0x9')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x0830=['index','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','/:id/clone','/:id/lists','addBlackLists','put','/:id','destroy','delete','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x3ce431,_0x29a207){var _0x10d255=function(_0x157ef8){while(--_0x157ef8){_0x3ce431['push'](_0x3ce431['shift']());}};_0x10d255(++_0x29a207);}(_0x0830,0xd0));var _0x0083=function(_0x499603,_0x4ca954){_0x499603=_0x499603-0x0;var _0x1c0227=_0x0830[_0x499603];return _0x1c0227;};'use strict';var multer=require(_0x0083('0x0'));var util=require(_0x0083('0x1'));var path=require('path');var timeout=require(_0x0083('0x2'));var express=require('express');var router=express[_0x0083('0x3')]();var fs_extra=require(_0x0083('0x4'));var auth=require(_0x0083('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0083('0x6'));var controller=require('./campaign.controller');router[_0x0083('0x7')]('/',auth[_0x0083('0x8')](),controller[_0x0083('0x9')]);router[_0x0083('0x7')]('/:id',auth[_0x0083('0x8')](),controller[_0x0083('0xa')]);router[_0x0083('0x7')]('/:id/hoppers',auth[_0x0083('0x8')](),controller[_0x0083('0xb')]);router[_0x0083('0x7')](_0x0083('0xc'),auth[_0x0083('0x8')](),controller[_0x0083('0xd')]);router['get'](_0x0083('0xe'),auth[_0x0083('0x8')](),controller[_0x0083('0xf')]);router[_0x0083('0x7')](_0x0083('0x10'),auth[_0x0083('0x8')](),controller[_0x0083('0x11')]);router['get']('/:id/lists',auth[_0x0083('0x8')](),controller[_0x0083('0x12')]);router[_0x0083('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0083('0x13')]);router['post']('/',auth[_0x0083('0x8')](),controller['create']);router[_0x0083('0x14')](_0x0083('0x15'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x0083('0x16'),auth[_0x0083('0x8')](),controller['addLists']);router['post']('/:id/blacklists',auth[_0x0083('0x8')](),controller[_0x0083('0x17')]);router[_0x0083('0x18')](_0x0083('0x19'),auth[_0x0083('0x8')](),controller['update']);router['delete'](_0x0083('0x19'),auth[_0x0083('0x8')](),controller[_0x0083('0x1a')]);router[_0x0083('0x1b')]('/:id/lists',auth[_0x0083('0x8')](),controller[_0x0083('0x1c')]);router[_0x0083('0x1b')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0083('0x1d')]);module[_0x0083('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4a19fae..adf6902 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 _0xf23c=['key','STRING','VIRTUAL','getDataValue'];(function(_0x3c9524,_0x2347d5){var _0x289be8=function(_0xbcc2c1){while(--_0xbcc2c1){_0x3c9524['push'](_0x3c9524['shift']());}};_0x289be8(++_0x2347d5);}(_0xf23c,0x129));var _0xcf23=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0xf23c[_0x466af7];return _0x348c96;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0xcf23('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xcf23('0x0')]},'name':{'type':Sequelize[_0xcf23('0x1')],'get':function(){return this[_0xcf23('0x2')](_0xcf23('0x3'));}}}; \ No newline at end of file +var _0xa121=['VIRTUAL','getDataValue','key','TEXT','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa121,0x125));var _0x1a12=function(_0x5d05c6,_0x482c6e){_0x5d05c6=_0x5d05c6-0x0;var _0x52403a=_0xa121[_0x5d05c6];return _0x52403a;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x1a12('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x1a12('0x1')]},'name':{'type':Sequelize[_0x1a12('0x2')],'get':function(){return this[_0x1a12('0x3')](_0x1a12('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 74e4815..f812677 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 _0x555b=['OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','offset','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','create','MailAccountId','SmsAccountId'];(function(_0x5a1a3a,_0x5b7233){var _0x321e89=function(_0x4837bc){while(--_0x4837bc){_0x5a1a3a['push'](_0x5a1a3a['shift']());}};_0x321e89(++_0x5b7233);}(_0x555b,0x1c0));var _0xb555=function(_0x30df65,_0x2e814c){_0x30df65=_0x30df65-0x0;var _0xf7b8f3=_0x555b[_0x30df65];return _0xf7b8f3;};'use strict';var emlformat=require(_0xb555('0x0'));var rimraf=require(_0xb555('0x1'));var zipdir=require(_0xb555('0x2'));var jsonpatch=require(_0xb555('0x3'));var rp=require(_0xb555('0x4'));var moment=require(_0xb555('0x5'));var BPromise=require(_0xb555('0x6'));var Mustache=require(_0xb555('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb555('0x8'));var csv=require(_0xb555('0x9'));var ejs=require(_0xb555('0xa'));var fs=require('fs');var fs_extra=require(_0xb555('0xb'));var _=require(_0xb555('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb555('0xd'));var deskjs=require(_0xb555('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb555('0xf'));var Redis=require(_0xb555('0x10'));var authService=require(_0xb555('0x11'));var qs=require(_0xb555('0x12'));var as=require(_0xb555('0x13'));var hardwareService=require(_0xb555('0x14'));var logger=require(_0xb555('0x15'))(_0xb555('0x16'));var utils=require(_0xb555('0x17'));var config=require(_0xb555('0x18'));var licenseUtil=require(_0xb555('0x19'));var db=require(_0xb555('0x1a'))['db'];function respondWithStatusCode(_0x1224be,_0x49deca){_0x49deca=_0x49deca||0xcc;return function(_0x3ff732){if(_0x3ff732){return _0x1224be[_0xb555('0x1b')](_0x49deca);}return _0x1224be[_0xb555('0x1c')](_0x49deca)[_0xb555('0x1d')]();};}function respondWithResult(_0x349494,_0x55c45b){_0x55c45b=_0x55c45b||0xc8;return function(_0x2a2e79){if(_0x2a2e79){return _0x349494[_0xb555('0x1c')](_0x55c45b)[_0xb555('0x1e')](_0x2a2e79);}};}function respondWithFilteredResult(_0xe0976b,_0x2a7086){return function(_0x1f180d){if(_0x1f180d){var _0x1294b4=typeof _0x2a7086['offset']===_0xb555('0x1f')&&typeof _0x2a7086[_0xb555('0x20')]===_0xb555('0x1f');var _0x64d6ec=_0x1f180d[_0xb555('0x21')];var _0x9ea3d2=_0x1294b4?0x0:_0x2a7086['offset'];var _0x35aed5=_0x1294b4?_0x1f180d[_0xb555('0x21')]:_0x2a7086['offset']+_0x2a7086[_0xb555('0x20')];var _0x136e39;if(_0x35aed5>=_0x64d6ec){_0x35aed5=_0x64d6ec;_0x136e39=0xc8;}else{_0x136e39=0xce;}_0xe0976b['status'](_0x136e39);return _0xe0976b[_0xb555('0x22')](_0xb555('0x23'),_0x9ea3d2+'-'+_0x35aed5+'/'+_0x64d6ec)[_0xb555('0x1e')](_0x1f180d);}return null;};}function patchUpdates(_0x2ded14){return function(_0x5642b6){try{jsonpatch[_0xb555('0x24')](_0x5642b6,_0x2ded14,!![]);}catch(_0x5203ce){return BPromise['reject'](_0x5203ce);}return _0x5642b6['save']();};}function saveUpdates(_0xaa57fd,_0x30766f){return function(_0x2eb5fc){if(_0x2eb5fc){return _0x2eb5fc[_0xb555('0x25')](_0xaa57fd)[_0xb555('0x26')](function(_0xddf9d8){return _0xddf9d8;});}return null;};}function removeEntity(_0x5e01e1,_0x2584f1){return function(_0x6f10be){if(_0x6f10be){return _0x6f10be[_0xb555('0x27')]()[_0xb555('0x26')](function(){var _0x4ff4b4=_0x6f10be[_0xb555('0x28')]({'plain':!![]});var _0x3bfbc9=_0xb555('0x29');return db[_0xb555('0x2a')][_0xb555('0x27')]({'where':{'type':_0x3bfbc9,'resourceId':_0x4ff4b4['id']}})['then'](function(){return _0x6f10be;});})[_0xb555('0x26')](function(){_0x5e01e1['status'](0xcc)[_0xb555('0x1d')]();});}};}function handleEntityNotFound(_0x3e6f4c,_0x20c82e){return function(_0x47191d){if(!_0x47191d){_0x3e6f4c[_0xb555('0x1b')](0x194);}return _0x47191d;};}function handleError(_0x293048,_0x1c5188){_0x1c5188=_0x1c5188||0x1f4;return function(_0x114c7e){logger[_0xb555('0x2b')](_0x114c7e['stack']);if(_0x114c7e[_0xb555('0x2c')]){delete _0x114c7e[_0xb555('0x2c')];}_0x293048[_0xb555('0x1c')](_0x1c5188)[_0xb555('0x2d')](_0x114c7e);};}exports[_0xb555('0x2e')]=function(_0x1b391b,_0x5e905f){var _0x17d1d8={},_0x3af6b3={},_0x5353f0={'count':0x0,'rows':[]};var _0x8b3c42=_[_0xb555('0x2f')](db[_0xb555('0x30')][_0xb555('0x31')],function(_0x183c49){return{'name':_0x183c49[_0xb555('0x32')],'type':_0x183c49[_0xb555('0x33')][_0xb555('0x34')]};});_0x3af6b3['model']=_[_0xb555('0x2f')](_0x8b3c42,_0xb555('0x2c'));_0x3af6b3[_0xb555('0x35')]=_['keys'](_0x1b391b['query']);_0x3af6b3[_0xb555('0x36')]=_[_0xb555('0x37')](_0x3af6b3[_0xb555('0x38')],_0x3af6b3['query']);_0x17d1d8[_0xb555('0x39')]=_['intersection'](_0x3af6b3[_0xb555('0x38')],qs[_0xb555('0x3a')](_0x1b391b[_0xb555('0x35')][_0xb555('0x3a')]));_0x17d1d8['attributes']=_0x17d1d8[_0xb555('0x39')][_0xb555('0x3b')]?_0x17d1d8[_0xb555('0x39')]:_0x3af6b3[_0xb555('0x38')];if(!_0x1b391b['query']['hasOwnProperty'](_0xb555('0x3c'))){_0x17d1d8['limit']=qs['limit'](_0x1b391b[_0xb555('0x35')][_0xb555('0x20')]);_0x17d1d8[_0xb555('0x3d')]=qs['offset'](_0x1b391b[_0xb555('0x35')][_0xb555('0x3d')]);}_0x17d1d8['order']=qs['sort'](_0x1b391b[_0xb555('0x35')][_0xb555('0x3e')]);_0x17d1d8['where']=qs['filters'](_[_0xb555('0x3f')](_0x1b391b[_0xb555('0x35')],_0x3af6b3[_0xb555('0x36')]),_0x8b3c42);if(_0x1b391b[_0xb555('0x35')][_0xb555('0x40')]){_0x17d1d8[_0xb555('0x41')]=_['merge'](_0x17d1d8['where'],{'$or':[{'key':{'$like':'%'+_0x1b391b['query']['filter']+'%'}},{'value':{'$like':'%'+_0x1b391b[_0xb555('0x35')][_0xb555('0x40')]+'%'}}]});}_0x17d1d8=_[_0xb555('0x42')]({},_0x17d1d8,_0x1b391b[_0xb555('0x43')]);var _0xf7da39={'where':_0x17d1d8[_0xb555('0x41')]};return db['CannedAnswer'][_0xb555('0x21')](_0xf7da39)[_0xb555('0x26')](function(_0x16a1d5){_0x5353f0['count']=_0x16a1d5;if(_0x1b391b[_0xb555('0x35')][_0xb555('0x44')]){_0x17d1d8[_0xb555('0x45')]=[{'all':!![]}];}return db[_0xb555('0x30')][_0xb555('0x46')](_0x17d1d8);})['then'](function(_0x4d9af2){_0x5353f0[_0xb555('0x47')]=_0x4d9af2;return _0x5353f0;})['then'](respondWithFilteredResult(_0x5e905f,_0x17d1d8))[_0xb555('0x48')](handleError(_0x5e905f,null));};exports['show']=function(_0x3903ea,_0x173cac){var _0x47b2b8={'raw':!![],'where':{'id':_0x3903ea[_0xb555('0x49')]['id']}},_0x44fc28={};_0x44fc28[_0xb555('0x38')]=_[_0xb555('0x4a')](db['CannedAnswer'][_0xb555('0x31')]);_0x44fc28[_0xb555('0x35')]=_[_0xb555('0x4a')](_0x3903ea['query']);_0x44fc28[_0xb555('0x36')]=_['intersection'](_0x44fc28[_0xb555('0x38')],_0x44fc28['query']);_0x47b2b8['attributes']=_[_0xb555('0x37')](_0x44fc28[_0xb555('0x38')],qs[_0xb555('0x3a')](_0x3903ea[_0xb555('0x35')][_0xb555('0x3a')]));_0x47b2b8[_0xb555('0x39')]=_0x47b2b8['attributes'][_0xb555('0x3b')]?_0x47b2b8['attributes']:_0x44fc28[_0xb555('0x38')];if(_0x3903ea[_0xb555('0x35')][_0xb555('0x44')]){_0x47b2b8[_0xb555('0x45')]=[{'all':!![]}];}_0x47b2b8=_[_0xb555('0x42')]({},_0x47b2b8,_0x3903ea[_0xb555('0x43')]);return db[_0xb555('0x30')][_0xb555('0x4b')](_0x47b2b8)[_0xb555('0x26')](handleEntityNotFound(_0x173cac,null))[_0xb555('0x26')](respondWithResult(_0x173cac,null))[_0xb555('0x48')](handleError(_0x173cac,null));};exports[_0xb555('0x25')]=function(_0xfc4b0a,_0x50f9fb){if(_0xfc4b0a[_0xb555('0x4c')]['id']){delete _0xfc4b0a['body']['id'];}return db['CannedAnswer'][_0xb555('0x4b')]({'where':{'id':_0xfc4b0a[_0xb555('0x49')]['id']}})['then'](handleEntityNotFound(_0x50f9fb,null))[_0xb555('0x26')](saveUpdates(_0xfc4b0a[_0xb555('0x4c')],null))[_0xb555('0x26')](respondWithResult(_0x50f9fb,null))[_0xb555('0x48')](handleError(_0x50f9fb,null));};exports[_0xb555('0x27')]=function(_0x566b20,_0x2f8076){return db[_0xb555('0x30')]['find']({'where':{'id':_0x566b20[_0xb555('0x49')]['id']}})[_0xb555('0x26')](handleEntityNotFound(_0x2f8076,null))['then'](removeEntity(_0x2f8076,null))[_0xb555('0x48')](handleError(_0x2f8076,null));};exports[_0xb555('0x4d')]=function(_0x348cc8,_0x368b67){var _0x38fb9b={'key':_0x348cc8[_0xb555('0x4c')][_0xb555('0x34')]};if(_0x348cc8['body']['MailAccountId']){_0x38fb9b[_0xb555('0x4e')]=_0x348cc8['body'][_0xb555('0x4e')];}else if(_0x348cc8[_0xb555('0x4c')]['SmsAccountId']){_0x38fb9b[_0xb555('0x4f')]=_0x348cc8[_0xb555('0x4c')]['SmsAccountId'];}else if(_0x348cc8[_0xb555('0x4c')]['OpenchannelAccountId']){_0x38fb9b[_0xb555('0x50')]=_0x348cc8[_0xb555('0x4c')][_0xb555('0x50')];}else if(_0x348cc8[_0xb555('0x4c')][_0xb555('0x51')]){_0x38fb9b[_0xb555('0x51')]=_0x348cc8[_0xb555('0x4c')][_0xb555('0x51')];}return db[_0xb555('0x30')][_0xb555('0x4b')]({'where':_0x38fb9b})[_0xb555('0x26')](function(_0x1fb5bb){if(_0x1fb5bb){throw new db['Sequelize'][(_0xb555('0x52'))](_0xb555('0x53'));}return db[_0xb555('0x30')][_0xb555('0x4d')](_0x348cc8[_0xb555('0x4c')]);})['then'](function(_0x2da60f){var _0x91c09=_0x348cc8['user'][_0xb555('0x28')]({'plain':!![]});if(!_0x91c09)throw new Error(_0xb555('0x54'));if(_0x91c09[_0xb555('0x55')]==='user'){var _0x5ebd19=_0x2da60f['get']({'plain':!![]});return db['UserProfileSection'][_0xb555('0x4b')]({'where':{'name':_0xb555('0x29'),'userProfileId':_0x91c09['userProfileId']},'raw':!![]})[_0xb555('0x26')](function(_0x126d47){if(_0x126d47&&_0x126d47[_0xb555('0x56')]===0x0){return db[_0xb555('0x2a')][_0xb555('0x4d')]({'name':_0x5ebd19[_0xb555('0x2c')],'resourceId':_0x5ebd19['id'],'type':_0x126d47[_0xb555('0x2c')],'sectionId':_0x126d47['id']},{})[_0xb555('0x26')](function(){return _0x2da60f;});}else{return _0x2da60f;}})['catch'](function(_0x197cd7){logger['error'](_0xb555('0x57'),_0x197cd7);throw _0x197cd7;});}return _0x2da60f;})['then'](respondWithResult(_0x368b67,0xc9))[_0xb555('0x48')](handleError(_0x368b67,null));}; \ No newline at end of file +var _0x4abc=['error','stack','name','index','map','CannedAnswer','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','findAll','rows','show','rawAttributes','includeAll','include','find','body','params','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','save','then','destroy','get','UserProfileResource'];(function(_0x4822b2,_0x4b8fb1){var _0x35bb92=function(_0x45cc9b){while(--_0x45cc9b){_0x4822b2['push'](_0x4822b2['shift']());}};_0x35bb92(++_0x4b8fb1);}(_0x4abc,0xdb));var _0xc4ab=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x4abc[_0x368fb9];return _0x4892fb;};'use strict';var emlformat=require(_0xc4ab('0x0'));var rimraf=require(_0xc4ab('0x1'));var zipdir=require(_0xc4ab('0x2'));var jsonpatch=require(_0xc4ab('0x3'));var rp=require(_0xc4ab('0x4'));var moment=require(_0xc4ab('0x5'));var BPromise=require(_0xc4ab('0x6'));var Mustache=require(_0xc4ab('0x7'));var util=require(_0xc4ab('0x8'));var path=require(_0xc4ab('0x9'));var sox=require(_0xc4ab('0xa'));var csv=require(_0xc4ab('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4ab('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc4ab('0xd'));var jsforce=require(_0xc4ab('0xe'));var deskjs=require(_0xc4ab('0xf'));var toCsv=require(_0xc4ab('0xb'));var querystring=require(_0xc4ab('0x10'));var Papa=require(_0xc4ab('0x11'));var Redis=require(_0xc4ab('0x12'));var authService=require(_0xc4ab('0x13'));var qs=require(_0xc4ab('0x14'));var as=require(_0xc4ab('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc4ab('0x16'));var utils=require(_0xc4ab('0x17'));var config=require(_0xc4ab('0x18'));var licenseUtil=require(_0xc4ab('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x525c18,_0x1d5ce1){_0x1d5ce1=_0x1d5ce1||0xcc;return function(_0x268ce0){if(_0x268ce0){return _0x525c18[_0xc4ab('0x1a')](_0x1d5ce1);}return _0x525c18[_0xc4ab('0x1b')](_0x1d5ce1)[_0xc4ab('0x1c')]();};}function respondWithResult(_0x5ce36f,_0x3d0e5e){_0x3d0e5e=_0x3d0e5e||0xc8;return function(_0x1ae03b){if(_0x1ae03b){return _0x5ce36f['status'](_0x3d0e5e)[_0xc4ab('0x1d')](_0x1ae03b);}};}function respondWithFilteredResult(_0x5a370d,_0x45f5da){return function(_0x3ce360){if(_0x3ce360){var _0xb47ed6=typeof _0x45f5da[_0xc4ab('0x1e')]===_0xc4ab('0x1f')&&typeof _0x45f5da['limit']==='undefined';var _0x20f7ae=_0x3ce360['count'];var _0x50413b=_0xb47ed6?0x0:_0x45f5da['offset'];var _0x9732cc=_0xb47ed6?_0x3ce360['count']:_0x45f5da['offset']+_0x45f5da[_0xc4ab('0x20')];var _0x4609ca;if(_0x9732cc>=_0x20f7ae){_0x9732cc=_0x20f7ae;_0x4609ca=0xc8;}else{_0x4609ca=0xce;}_0x5a370d['status'](_0x4609ca);return _0x5a370d['set']('Content-Range',_0x50413b+'-'+_0x9732cc+'/'+_0x20f7ae)[_0xc4ab('0x1d')](_0x3ce360);}return null;};}function patchUpdates(_0x14826b){return function(_0x563b87){try{jsonpatch[_0xc4ab('0x21')](_0x563b87,_0x14826b,!![]);}catch(_0x1ce42a){return BPromise['reject'](_0x1ce42a);}return _0x563b87[_0xc4ab('0x22')]();};}function saveUpdates(_0x16b91a,_0x463c56){return function(_0x38043a){if(_0x38043a){return _0x38043a['update'](_0x16b91a)[_0xc4ab('0x23')](function(_0x3b6f95){return _0x3b6f95;});}return null;};}function removeEntity(_0x431167,_0xcafa59){return function(_0x1acdf0){if(_0x1acdf0){return _0x1acdf0[_0xc4ab('0x24')]()[_0xc4ab('0x23')](function(){var _0x4080bd=_0x1acdf0[_0xc4ab('0x25')]({'plain':!![]});var _0x105b6a='CannedAnswers';return db[_0xc4ab('0x26')][_0xc4ab('0x24')]({'where':{'type':_0x105b6a,'resourceId':_0x4080bd['id']}})[_0xc4ab('0x23')](function(){return _0x1acdf0;});})[_0xc4ab('0x23')](function(){_0x431167[_0xc4ab('0x1b')](0xcc)[_0xc4ab('0x1c')]();});}};}function handleEntityNotFound(_0x1f2eb0,_0xfb6c36){return function(_0x53c729){if(!_0x53c729){_0x1f2eb0['sendStatus'](0x194);}return _0x53c729;};}function handleError(_0x1757e4,_0x8b2605){_0x8b2605=_0x8b2605||0x1f4;return function(_0x348149){logger[_0xc4ab('0x27')](_0x348149[_0xc4ab('0x28')]);if(_0x348149[_0xc4ab('0x29')]){delete _0x348149[_0xc4ab('0x29')];}_0x1757e4[_0xc4ab('0x1b')](_0x8b2605)['send'](_0x348149);};}exports[_0xc4ab('0x2a')]=function(_0x3edfa6,_0x2e5c89){var _0x401281={},_0x7df83c={},_0x10a9e7={'count':0x0,'rows':[]};var _0x5ba069=_[_0xc4ab('0x2b')](db[_0xc4ab('0x2c')]['rawAttributes'],function(_0x5b2ab3){return{'name':_0x5b2ab3['fieldName'],'type':_0x5b2ab3['type'][_0xc4ab('0x2d')]};});_0x7df83c[_0xc4ab('0x2e')]=_[_0xc4ab('0x2b')](_0x5ba069,'name');_0x7df83c['query']=_[_0xc4ab('0x2f')](_0x3edfa6['query']);_0x7df83c[_0xc4ab('0x30')]=_[_0xc4ab('0x31')](_0x7df83c[_0xc4ab('0x2e')],_0x7df83c[_0xc4ab('0x32')]);_0x401281[_0xc4ab('0x33')]=_[_0xc4ab('0x31')](_0x7df83c['model'],qs[_0xc4ab('0x34')](_0x3edfa6[_0xc4ab('0x32')][_0xc4ab('0x34')]));_0x401281['attributes']=_0x401281[_0xc4ab('0x33')][_0xc4ab('0x35')]?_0x401281[_0xc4ab('0x33')]:_0x7df83c[_0xc4ab('0x2e')];if(!_0x3edfa6['query'][_0xc4ab('0x36')]('nolimit')){_0x401281['limit']=qs['limit'](_0x3edfa6[_0xc4ab('0x32')]['limit']);_0x401281['offset']=qs[_0xc4ab('0x1e')](_0x3edfa6[_0xc4ab('0x32')][_0xc4ab('0x1e')]);}_0x401281[_0xc4ab('0x37')]=qs[_0xc4ab('0x38')](_0x3edfa6[_0xc4ab('0x32')]['sort']);_0x401281[_0xc4ab('0x39')]=qs[_0xc4ab('0x30')](_[_0xc4ab('0x3a')](_0x3edfa6[_0xc4ab('0x32')],_0x7df83c[_0xc4ab('0x30')]),_0x5ba069);if(_0x3edfa6[_0xc4ab('0x32')]['filter']){_0x401281[_0xc4ab('0x39')]=_['merge'](_0x401281[_0xc4ab('0x39')],{'$or':[{'key':{'$like':'%'+_0x3edfa6[_0xc4ab('0x32')][_0xc4ab('0x3b')]+'%'}},{'value':{'$like':'%'+_0x3edfa6[_0xc4ab('0x32')][_0xc4ab('0x3b')]+'%'}}]});}_0x401281=_[_0xc4ab('0x3c')]({},_0x401281,_0x3edfa6[_0xc4ab('0x3d')]);var _0x56a41a={'where':_0x401281[_0xc4ab('0x39')]};return db[_0xc4ab('0x2c')][_0xc4ab('0x3e')](_0x56a41a)[_0xc4ab('0x23')](function(_0x2f5840){_0x10a9e7[_0xc4ab('0x3e')]=_0x2f5840;if(_0x3edfa6[_0xc4ab('0x32')]['includeAll']){_0x401281['include']=[{'all':!![]}];}return db[_0xc4ab('0x2c')][_0xc4ab('0x3f')](_0x401281);})[_0xc4ab('0x23')](function(_0x547db9){_0x10a9e7[_0xc4ab('0x40')]=_0x547db9;return _0x10a9e7;})['then'](respondWithFilteredResult(_0x2e5c89,_0x401281))['catch'](handleError(_0x2e5c89,null));};exports[_0xc4ab('0x41')]=function(_0x4ef823,_0x5f072a){var _0xeaa25d={'raw':!![],'where':{'id':_0x4ef823['params']['id']}},_0x21dbe8={};_0x21dbe8['model']=_[_0xc4ab('0x2f')](db[_0xc4ab('0x2c')][_0xc4ab('0x42')]);_0x21dbe8[_0xc4ab('0x32')]=_['keys'](_0x4ef823['query']);_0x21dbe8[_0xc4ab('0x30')]=_[_0xc4ab('0x31')](_0x21dbe8[_0xc4ab('0x2e')],_0x21dbe8[_0xc4ab('0x32')]);_0xeaa25d[_0xc4ab('0x33')]=_[_0xc4ab('0x31')](_0x21dbe8[_0xc4ab('0x2e')],qs[_0xc4ab('0x34')](_0x4ef823[_0xc4ab('0x32')][_0xc4ab('0x34')]));_0xeaa25d[_0xc4ab('0x33')]=_0xeaa25d[_0xc4ab('0x33')][_0xc4ab('0x35')]?_0xeaa25d[_0xc4ab('0x33')]:_0x21dbe8[_0xc4ab('0x2e')];if(_0x4ef823[_0xc4ab('0x32')][_0xc4ab('0x43')]){_0xeaa25d[_0xc4ab('0x44')]=[{'all':!![]}];}_0xeaa25d=_[_0xc4ab('0x3c')]({},_0xeaa25d,_0x4ef823[_0xc4ab('0x3d')]);return db[_0xc4ab('0x2c')][_0xc4ab('0x45')](_0xeaa25d)[_0xc4ab('0x23')](handleEntityNotFound(_0x5f072a,null))['then'](respondWithResult(_0x5f072a,null))['catch'](handleError(_0x5f072a,null));};exports['update']=function(_0x3790ea,_0x4b2e50){if(_0x3790ea['body']['id']){delete _0x3790ea[_0xc4ab('0x46')]['id'];}return db[_0xc4ab('0x2c')][_0xc4ab('0x45')]({'where':{'id':_0x3790ea[_0xc4ab('0x47')]['id']}})[_0xc4ab('0x23')](handleEntityNotFound(_0x4b2e50,null))[_0xc4ab('0x23')](saveUpdates(_0x3790ea[_0xc4ab('0x46')],null))[_0xc4ab('0x23')](respondWithResult(_0x4b2e50,null))[_0xc4ab('0x48')](handleError(_0x4b2e50,null));};exports[_0xc4ab('0x24')]=function(_0x383521,_0x53ea2e){return db[_0xc4ab('0x2c')]['find']({'where':{'id':_0x383521['params']['id']}})[_0xc4ab('0x23')](handleEntityNotFound(_0x53ea2e,null))[_0xc4ab('0x23')](removeEntity(_0x53ea2e,null))['catch'](handleError(_0x53ea2e,null));};exports[_0xc4ab('0x49')]=function(_0x567b6a,_0x2102c3){var _0x1747bb={'key':_0x567b6a[_0xc4ab('0x46')][_0xc4ab('0x2d')]};if(_0x567b6a['body']['MailAccountId']){_0x1747bb[_0xc4ab('0x4a')]=_0x567b6a[_0xc4ab('0x46')]['MailAccountId'];}else if(_0x567b6a[_0xc4ab('0x46')][_0xc4ab('0x4b')]){_0x1747bb['SmsAccountId']=_0x567b6a['body']['SmsAccountId'];}else if(_0x567b6a[_0xc4ab('0x46')][_0xc4ab('0x4c')]){_0x1747bb[_0xc4ab('0x4c')]=_0x567b6a[_0xc4ab('0x46')][_0xc4ab('0x4c')];}else if(_0x567b6a['body'][_0xc4ab('0x4d')]){_0x1747bb[_0xc4ab('0x4d')]=_0x567b6a[_0xc4ab('0x46')]['ChatWebsiteId'];}return db['CannedAnswer'][_0xc4ab('0x45')]({'where':_0x1747bb})[_0xc4ab('0x23')](function(_0x4dd6b2){if(_0x4dd6b2){throw new db['Sequelize'][(_0xc4ab('0x4e'))](_0xc4ab('0x4f'));}return db[_0xc4ab('0x2c')]['create'](_0x567b6a[_0xc4ab('0x46')]);})['then'](function(_0x3dd2c1){var _0x1e4041=_0x567b6a[_0xc4ab('0x50')][_0xc4ab('0x25')]({'plain':!![]});if(!_0x1e4041)throw new Error(_0xc4ab('0x51'));if(_0x1e4041[_0xc4ab('0x52')]===_0xc4ab('0x50')){var _0x4d46a4=_0x3dd2c1['get']({'plain':!![]});return db[_0xc4ab('0x53')][_0xc4ab('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x1e4041[_0xc4ab('0x54')]},'raw':!![]})[_0xc4ab('0x23')](function(_0xd4b629){if(_0xd4b629&&_0xd4b629[_0xc4ab('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x4d46a4['name'],'resourceId':_0x4d46a4['id'],'type':_0xd4b629[_0xc4ab('0x29')],'sectionId':_0xd4b629['id']},{})['then'](function(){return _0x3dd2c1;});}else{return _0x3dd2c1;}})['catch'](function(_0x33326c){logger[_0xc4ab('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33326c);throw _0x33326c;});}return _0x3dd2c1;})[_0xc4ab('0x23')](respondWithResult(_0x2102c3,0xc9))[_0xc4ab('0x48')](handleError(_0x2102c3,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 08e512d..5c3c4cb 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 _0xec24=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x5086d7,_0x98d6e5){var _0x197a58=function(_0x5c05be){while(--_0x5c05be){_0x5086d7['push'](_0x5086d7['shift']());}};_0x197a58(++_0x98d6e5);}(_0xec24,0x13d));var _0x4ec2=function(_0x2769fc,_0xabd20){_0x2769fc=_0x2769fc-0x0;var _0x245851=_0xec24[_0x2769fc];return _0x245851;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ec2('0x0'))(_0x4ec2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ec2('0x2'));var fs=require('fs');var path=require(_0x4ec2('0x3'));var rimraf=require(_0x4ec2('0x4'));var config=require(_0x4ec2('0x5'));var attributes=require(_0x4ec2('0x6'));module[_0x4ec2('0x7')]=function(_0x39b8c8,_0x42843f){return _0x39b8c8[_0x4ec2('0x8')](_0x4ec2('0x9'),attributes,{'tableName':_0x4ec2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ec2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6c76=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6c76,0x184));var _0x66c7=function(_0xf6dc14,_0x113164){_0xf6dc14=_0xf6dc14-0x0;var _0x2643c0=_0x6c76[_0xf6dc14];return _0x2643c0;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x66c7('0x9'),'collate':_0x66c7('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 79aa152..f24a47c 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(_0x455b0c,_0x2ebbed){var _0x560ce2=function(_0x191c21){while(--_0x191c21){_0x455b0c['push'](_0x455b0c['shift']());}};_0x560ce2(++_0x2ebbed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3ed191,_0x58f521){var _0x1d5bc9=function(_0x7a59f5){while(--_0x7a59f5){_0x3ed191['push'](_0x3ed191['shift']());}};_0x1d5bc9(++_0x58f521);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 052aeef..4398aae 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 _0xaa6a=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','post','create','update','delete','exports'];(function(_0x371d87,_0x147fab){var _0x31100e=function(_0x34bb16){while(--_0x34bb16){_0x371d87['push'](_0x371d87['shift']());}};_0x31100e(++_0x147fab);}(_0xaa6a,0x132));var _0xaaa6=function(_0x57c2d5,_0xe46633){_0x57c2d5=_0x57c2d5-0x0;var _0xd2d03e=_0xaa6a[_0x57c2d5];return _0xd2d03e;};'use strict';var multer=require(_0xaaa6('0x0'));var util=require('util');var path=require(_0xaaa6('0x1'));var timeout=require(_0xaaa6('0x2'));var express=require(_0xaaa6('0x3'));var router=express[_0xaaa6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaaa6('0x5'));var config=require(_0xaaa6('0x6'));var controller=require(_0xaaa6('0x7'));router['get']('/',auth[_0xaaa6('0x8')](),controller[_0xaaa6('0x9')]);router[_0xaaa6('0xa')](_0xaaa6('0xb'),auth[_0xaaa6('0x8')](),controller['show']);router[_0xaaa6('0xc')]('/',auth[_0xaaa6('0x8')](),controller[_0xaaa6('0xd')]);router['put'](_0xaaa6('0xb'),auth[_0xaaa6('0x8')](),controller[_0xaaa6('0xe')]);router[_0xaaa6('0xf')](_0xaaa6('0xb'),auth[_0xaaa6('0x8')](),controller['destroy']);module[_0xaaa6('0x10')]=router; \ No newline at end of file +var _0xb721=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','destroy','exports','multer','util','express'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0xb721,0x11a));var _0x1b72=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xb721[_0x249e96];return _0x17444c;};'use strict';var multer=require(_0x1b72('0x0'));var util=require(_0x1b72('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1b72('0x2'));var router=express['Router']();var fs_extra=require(_0x1b72('0x3'));var auth=require(_0x1b72('0x4'));var interaction=require(_0x1b72('0x5'));var config=require(_0x1b72('0x6'));var controller=require(_0x1b72('0x7'));router[_0x1b72('0x8')]('/',auth[_0x1b72('0x9')](),controller[_0x1b72('0xa')]);router[_0x1b72('0x8')](_0x1b72('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1b72('0xc')]('/',auth[_0x1b72('0x9')](),controller['create']);router['put']('/:id',auth[_0x1b72('0x9')](),controller['update']);router['delete'](_0x1b72('0xb'),auth[_0x1b72('0x9')](),controller[_0x1b72('0xd')]);module[_0x1b72('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5ad6e55..990df4c 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 _0x0da6=['INTEGER','exports','DATE','STRING'];(function(_0x4116fb,_0x38f1e9){var _0x2d8883=function(_0x3f41b2){while(--_0x3f41b2){_0x4116fb['push'](_0x4116fb['shift']());}};_0x2d8883(++_0x38f1e9);}(_0x0da6,0x71));var _0x60da=function(_0x3d3fe5,_0x2fcf2b){_0x3d3fe5=_0x3d3fe5-0x0;var _0xb4ce88=_0x0da6[_0x3d3fe5];return _0xb4ce88;};'use strict';var Sequelize=require('sequelize');module[_0x60da('0x0')]={'calldate':{'type':Sequelize[_0x60da('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x60da('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x60da('0x2')]},'dcontext':{'type':Sequelize[_0x60da('0x2')]},'channel':{'type':Sequelize[_0x60da('0x2')]},'dstchannel':{'type':Sequelize[_0x60da('0x2')]},'lastapp':{'type':Sequelize[_0x60da('0x2')]},'lastdata':{'type':Sequelize[_0x60da('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x60da('0x2')]},'amaflags':{'type':Sequelize[_0x60da('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x60da('0x2')]},'userfield':{'type':Sequelize[_0x60da('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x60da('0x2')]},'type':{'type':Sequelize[_0x60da('0x2')]},'tag':{'type':Sequelize[_0x60da('0x2')]}}; \ No newline at end of file +var _0x7eee=['1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x475eac,_0x2fa495){var _0x4ad158=function(_0x2d7c4c){while(--_0x2d7c4c){_0x475eac['push'](_0x475eac['shift']());}};_0x4ad158(++_0x2fa495);}(_0x7eee,0x1bb));var _0xe7ee=function(_0x259e81,_0x41e829){_0x259e81=_0x259e81-0x0;var _0x4b4588=_0x7eee[_0x259e81];return _0x4b4588;};'use strict';var Sequelize=require('sequelize');module[_0xe7ee('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xe7ee('0x1')},'clid':{'type':Sequelize[_0xe7ee('0x2')]},'src':{'type':Sequelize[_0xe7ee('0x2')]},'dst':{'type':Sequelize[_0xe7ee('0x2')]},'dcontext':{'type':Sequelize[_0xe7ee('0x2')]},'channel':{'type':Sequelize[_0xe7ee('0x2')]},'dstchannel':{'type':Sequelize[_0xe7ee('0x2')]},'lastapp':{'type':Sequelize[_0xe7ee('0x2')]},'lastdata':{'type':Sequelize[_0xe7ee('0x2')]},'duration':{'type':Sequelize[_0xe7ee('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe7ee('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe7ee('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe7ee('0x2')]},'userfield':{'type':Sequelize[_0xe7ee('0x2')]},'uniqueid':{'type':Sequelize[_0xe7ee('0x2')]},'linkedid':{'type':Sequelize[_0xe7ee('0x2')]},'sequence':{'type':Sequelize[_0xe7ee('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xe7ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 66ee251..816d1d9 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 _0xeec6=['includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','Cdr','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','count','include','findAll','catch','params'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xeec6,0x1c2));var _0x6eec=function(_0x24b773,_0x392c26){_0x24b773=_0x24b773-0x0;var _0x35f6c9=_0xeec6[_0x24b773];return _0x35f6c9;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require('request-promise');var moment=require(_0x6eec('0x4'));var BPromise=require(_0x6eec('0x5'));var Mustache=require(_0x6eec('0x6'));var util=require(_0x6eec('0x7'));var path=require(_0x6eec('0x8'));var sox=require(_0x6eec('0x9'));var csv=require('to-csv');var ejs=require(_0x6eec('0xa'));var fs=require('fs');var fs_extra=require(_0x6eec('0xb'));var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=typeof _0x393271['offset']===_0x6eec('0x1b')&&typeof _0x393271['limit']===_0x6eec('0x1b');var _0x45aa3f=_0x34a7fc['count'];var _0x3ee353=_0x2ac797?0x0:_0x393271[_0x6eec('0x1c')];var _0xb1eab7=_0x2ac797?_0x34a7fc['count']:_0x393271[_0x6eec('0x1c')]+_0x393271[_0x6eec('0x1d')];var _0x3c7152;if(_0xb1eab7>=_0x45aa3f){_0xb1eab7=_0x45aa3f;_0x3c7152=0xc8;}else{_0x3c7152=0xce;}_0x345852[_0x6eec('0x19')](_0x3c7152);return _0x345852[_0x6eec('0x1e')](_0x6eec('0x1f'),_0x3ee353+'-'+_0xb1eab7+'/'+_0x45aa3f)['json'](_0x34a7fc);}return null;};}function patchUpdates(_0x328693){return function(_0x2f843e){try{jsonpatch[_0x6eec('0x20')](_0x2f843e,_0x328693,!![]);}catch(_0x34522a){return BPromise[_0x6eec('0x21')](_0x34522a);}return _0x2f843e[_0x6eec('0x22')]();};}function saveUpdates(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')](_0x52f941)[_0x6eec('0x24')](function(_0x409b26){return _0x409b26;});}return null;};}function removeEntity(_0x13863c,_0x573249){return function(_0x384586){if(_0x384586){return _0x384586[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x13863c[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x1f386c,_0x29879c){return function(_0x20bed3){if(!_0x20bed3){_0x1f386c[_0x6eec('0x17')](0x194);}return _0x20bed3;};}function handleError(_0x58f95c,_0x1d750c){_0x1d750c=_0x1d750c||0x1f4;return function(_0x44b31c){logger[_0x6eec('0x26')](_0x44b31c[_0x6eec('0x27')]);if(_0x44b31c['name']){delete _0x44b31c[_0x6eec('0x28')];}_0x58f95c[_0x6eec('0x19')](_0x1d750c)['send'](_0x44b31c);};}exports['index']=function(_0x3240c3,_0x47ed95){var _0x20a130={},_0xede270={},_0x3bbdf8={'count':0x0,'rows':[]};var _0x34bdea=_[_0x6eec('0x29')](db[_0x6eec('0x2a')][_0x6eec('0x2b')],function(_0x33e4a1){return{'name':_0x33e4a1[_0x6eec('0x2c')],'type':_0x33e4a1[_0x6eec('0x2d')]['key']};});_0xede270[_0x6eec('0x2e')]=_['map'](_0x34bdea,_0x6eec('0x28'));_0xede270[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x3240c3['query']);_0xede270['filters']=_['intersection'](_0xede270[_0x6eec('0x2e')],_0xede270[_0x6eec('0x2f')]);_0x20a130[_0x6eec('0x31')]=_[_0x6eec('0x32')](_0xede270[_0x6eec('0x2e')],qs[_0x6eec('0x33')](_0x3240c3[_0x6eec('0x2f')][_0x6eec('0x33')]));_0x20a130[_0x6eec('0x31')]=_0x20a130[_0x6eec('0x31')][_0x6eec('0x34')]?_0x20a130[_0x6eec('0x31')]:_0xede270['model'];if(!_0x3240c3[_0x6eec('0x2f')][_0x6eec('0x35')](_0x6eec('0x36'))){_0x20a130['limit']=qs[_0x6eec('0x1d')](_0x3240c3[_0x6eec('0x2f')][_0x6eec('0x1d')]);_0x20a130[_0x6eec('0x1c')]=qs[_0x6eec('0x1c')](_0x3240c3[_0x6eec('0x2f')]['offset']);}_0x20a130[_0x6eec('0x37')]=qs[_0x6eec('0x38')](_0x3240c3[_0x6eec('0x2f')]['sort']);_0x20a130['where']=qs[_0x6eec('0x39')](_[_0x6eec('0x3a')](_0x3240c3[_0x6eec('0x2f')],_0xede270[_0x6eec('0x39')]),_0x34bdea);if(_0x3240c3[_0x6eec('0x2f')]['filter']){_0x20a130[_0x6eec('0x3b')]=_[_0x6eec('0x3c')](_0x20a130[_0x6eec('0x3b')],{'$or':_[_0x6eec('0x29')](_0x34bdea,function(_0x15918c){if(_0x15918c[_0x6eec('0x2d')]!==_0x6eec('0x3d')){var _0x1deed2={};_0x1deed2[_0x15918c['name']]={'$like':'%'+_0x3240c3[_0x6eec('0x2f')][_0x6eec('0x3e')]+'%'};return _0x1deed2;}})});}_0x20a130=_['merge']({},_0x20a130,_0x3240c3['options']);var _0x160fc0={'where':_0x20a130[_0x6eec('0x3b')]};return db[_0x6eec('0x2a')][_0x6eec('0x3f')](_0x160fc0)['then'](function(_0x5dfbac){_0x3bbdf8[_0x6eec('0x3f')]=_0x5dfbac;if(_0x3240c3['query']['includeAll']){_0x20a130[_0x6eec('0x40')]=[{'all':!![]}];}return db[_0x6eec('0x2a')][_0x6eec('0x41')](_0x20a130);})[_0x6eec('0x24')](function(_0x25d3f3){_0x3bbdf8['rows']=_0x25d3f3;return _0x3bbdf8;})[_0x6eec('0x24')](respondWithFilteredResult(_0x47ed95,_0x20a130))[_0x6eec('0x42')](handleError(_0x47ed95,null));};exports['show']=function(_0x2fd444,_0x241512){var _0x5028a2={'raw':!![],'where':{'id':_0x2fd444[_0x6eec('0x43')]['id']}},_0x2d39bf={};_0x2d39bf['model']=_[_0x6eec('0x30')](db[_0x6eec('0x2a')][_0x6eec('0x2b')]);_0x2d39bf[_0x6eec('0x2f')]=_['keys'](_0x2fd444[_0x6eec('0x2f')]);_0x2d39bf[_0x6eec('0x39')]=_[_0x6eec('0x32')](_0x2d39bf[_0x6eec('0x2e')],_0x2d39bf[_0x6eec('0x2f')]);_0x5028a2['attributes']=_['intersection'](_0x2d39bf[_0x6eec('0x2e')],qs[_0x6eec('0x33')](_0x2fd444[_0x6eec('0x2f')][_0x6eec('0x33')]));_0x5028a2[_0x6eec('0x31')]=_0x5028a2['attributes'][_0x6eec('0x34')]?_0x5028a2['attributes']:_0x2d39bf[_0x6eec('0x2e')];if(_0x2fd444[_0x6eec('0x2f')][_0x6eec('0x44')]){_0x5028a2['include']=[{'all':!![]}];}_0x5028a2=_[_0x6eec('0x3c')]({},_0x5028a2,_0x2fd444[_0x6eec('0x45')]);return db[_0x6eec('0x2a')][_0x6eec('0x46')](_0x5028a2)[_0x6eec('0x24')](handleEntityNotFound(_0x241512,null))['then'](respondWithResult(_0x241512,null))[_0x6eec('0x42')](handleError(_0x241512,null));};exports['create']=function(_0x51fbf9,_0x2529ad){return db['Cdr'][_0x6eec('0x47')](_0x51fbf9[_0x6eec('0x48')],{})[_0x6eec('0x24')](respondWithResult(_0x2529ad,0xc9))['catch'](handleError(_0x2529ad,null));};exports['update']=function(_0x6b200d,_0x142914){if(_0x6b200d[_0x6eec('0x48')]['id']){delete _0x6b200d[_0x6eec('0x48')]['id'];}return db[_0x6eec('0x2a')][_0x6eec('0x46')]({'where':{'id':_0x6b200d[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x142914,null))[_0x6eec('0x24')](saveUpdates(_0x6b200d[_0x6eec('0x48')],null))['then'](respondWithResult(_0x142914,null))['catch'](handleError(_0x142914,null));};exports[_0x6eec('0x25')]=function(_0x2270ce,_0x38e836){return db['Cdr'][_0x6eec('0x46')]({'where':{'id':_0x2270ce[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x38e836,null))[_0x6eec('0x24')](removeEntity(_0x38e836,null))[_0x6eec('0x42')](handleError(_0x38e836,null));};exports[_0x6eec('0x49')]=function(_0x10c10a,_0x413de9){return db['Cdr'][_0x6eec('0x49')]()[_0x6eec('0x24')](respondWithResult(_0x413de9,null))[_0x6eec('0x42')](handleError(_0x413de9,null));}; \ No newline at end of file +var _0x56a4=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Cdr','then','count','includeAll','findAll','rows','catch','show','keys','length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js'];(function(_0x2ca262,_0x3fafa5){var _0x409e2b=function(_0xfc8c1b){while(--_0xfc8c1b){_0x2ca262['push'](_0x2ca262['shift']());}};_0x409e2b(++_0x3fafa5);}(_0x56a4,0x11b));var _0x456a=function(_0x404f13,_0x4fa35f){_0x404f13=_0x404f13-0x0;var _0x1f9dbb=_0x56a4[_0x404f13];return _0x1f9dbb;};'use strict';var emlformat=require(_0x456a('0x0'));var rimraf=require(_0x456a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x456a('0x2'));var rp=require(_0x456a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x456a('0x4'));var util=require(_0x456a('0x5'));var path=require(_0x456a('0x6'));var sox=require(_0x456a('0x7'));var csv=require(_0x456a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x456a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x456a('0xa'));var jsforce=require(_0x456a('0xb'));var deskjs=require(_0x456a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x456a('0xd'));var Papa=require('papaparse');var Redis=require(_0x456a('0xe'));var authService=require(_0x456a('0xf'));var qs=require(_0x456a('0x10'));var as=require(_0x456a('0x11'));var hardwareService=require(_0x456a('0x12'));var logger=require(_0x456a('0x13'))(_0x456a('0x14'));var utils=require(_0x456a('0x15'));var config=require(_0x456a('0x16'));var licenseUtil=require(_0x456a('0x17'));var db=require(_0x456a('0x18'))['db'];function respondWithStatusCode(_0x479993,_0x2f4b75){_0x2f4b75=_0x2f4b75||0xcc;return function(_0x5284ce){if(_0x5284ce){return _0x479993['sendStatus'](_0x2f4b75);}return _0x479993[_0x456a('0x19')](_0x2f4b75)[_0x456a('0x1a')]();};}function respondWithResult(_0xa5b5d8,_0xc01cbb){_0xc01cbb=_0xc01cbb||0xc8;return function(_0x50c03a){if(_0x50c03a){return _0xa5b5d8[_0x456a('0x19')](_0xc01cbb)[_0x456a('0x1b')](_0x50c03a);}};}function respondWithFilteredResult(_0x57f10b,_0x78c2ec){return function(_0x1e91f3){if(_0x1e91f3){var _0x108ead=typeof _0x78c2ec['offset']===_0x456a('0x1c')&&typeof _0x78c2ec[_0x456a('0x1d')]===_0x456a('0x1c');var _0x1d4e7e=_0x1e91f3['count'];var _0x200eda=_0x108ead?0x0:_0x78c2ec[_0x456a('0x1e')];var _0x7b2cac=_0x108ead?_0x1e91f3['count']:_0x78c2ec[_0x456a('0x1e')]+_0x78c2ec['limit'];var _0x550c4e;if(_0x7b2cac>=_0x1d4e7e){_0x7b2cac=_0x1d4e7e;_0x550c4e=0xc8;}else{_0x550c4e=0xce;}_0x57f10b[_0x456a('0x19')](_0x550c4e);return _0x57f10b['set'](_0x456a('0x1f'),_0x200eda+'-'+_0x7b2cac+'/'+_0x1d4e7e)['json'](_0x1e91f3);}return null;};}function patchUpdates(_0x962b6d){return function(_0x17d0ae){try{jsonpatch['apply'](_0x17d0ae,_0x962b6d,!![]);}catch(_0x55a795){return BPromise['reject'](_0x55a795);}return _0x17d0ae[_0x456a('0x20')]();};}function saveUpdates(_0x9d76bf,_0xb8d35c){return function(_0x525a17){if(_0x525a17){return _0x525a17[_0x456a('0x21')](_0x9d76bf)['then'](function(_0x5aa5da){return _0x5aa5da;});}return null;};}function removeEntity(_0x59b47e,_0x47747a){return function(_0x301d4e){if(_0x301d4e){return _0x301d4e[_0x456a('0x22')]()['then'](function(){_0x59b47e[_0x456a('0x19')](0xcc)[_0x456a('0x1a')]();});}};}function handleEntityNotFound(_0x5b3bef,_0x4619f6){return function(_0x561097){if(!_0x561097){_0x5b3bef['sendStatus'](0x194);}return _0x561097;};}function handleError(_0xb15319,_0x5441d1){_0x5441d1=_0x5441d1||0x1f4;return function(_0x3ec309){logger['error'](_0x3ec309[_0x456a('0x23')]);if(_0x3ec309[_0x456a('0x24')]){delete _0x3ec309[_0x456a('0x24')];}_0xb15319[_0x456a('0x19')](_0x5441d1)[_0x456a('0x25')](_0x3ec309);};}exports[_0x456a('0x26')]=function(_0x46f3b3,_0x25da31){var _0x5912f6={},_0x5597f6={},_0x48205d={'count':0x0,'rows':[]};var _0x38912b=_[_0x456a('0x27')](db['Cdr'][_0x456a('0x28')],function(_0x374149){return{'name':_0x374149[_0x456a('0x29')],'type':_0x374149[_0x456a('0x2a')][_0x456a('0x2b')]};});_0x5597f6['model']=_[_0x456a('0x27')](_0x38912b,_0x456a('0x24'));_0x5597f6[_0x456a('0x2c')]=_['keys'](_0x46f3b3[_0x456a('0x2c')]);_0x5597f6[_0x456a('0x2d')]=_['intersection'](_0x5597f6[_0x456a('0x2e')],_0x5597f6[_0x456a('0x2c')]);_0x5912f6[_0x456a('0x2f')]=_[_0x456a('0x30')](_0x5597f6[_0x456a('0x2e')],qs['fields'](_0x46f3b3[_0x456a('0x2c')][_0x456a('0x31')]));_0x5912f6[_0x456a('0x2f')]=_0x5912f6['attributes']['length']?_0x5912f6[_0x456a('0x2f')]:_0x5597f6['model'];if(!_0x46f3b3['query']['hasOwnProperty'](_0x456a('0x32'))){_0x5912f6[_0x456a('0x1d')]=qs[_0x456a('0x1d')](_0x46f3b3[_0x456a('0x2c')]['limit']);_0x5912f6[_0x456a('0x1e')]=qs[_0x456a('0x1e')](_0x46f3b3['query'][_0x456a('0x1e')]);}_0x5912f6[_0x456a('0x33')]=qs[_0x456a('0x34')](_0x46f3b3[_0x456a('0x2c')][_0x456a('0x34')]);_0x5912f6['where']=qs[_0x456a('0x2d')](_[_0x456a('0x35')](_0x46f3b3['query'],_0x5597f6[_0x456a('0x2d')]),_0x38912b);if(_0x46f3b3[_0x456a('0x2c')][_0x456a('0x36')]){_0x5912f6[_0x456a('0x37')]=_[_0x456a('0x38')](_0x5912f6[_0x456a('0x37')],{'$or':_[_0x456a('0x27')](_0x38912b,function(_0x1f8f02){if(_0x1f8f02['type']!==_0x456a('0x39')){var _0x1e862d={};_0x1e862d[_0x1f8f02[_0x456a('0x24')]]={'$like':'%'+_0x46f3b3[_0x456a('0x2c')][_0x456a('0x36')]+'%'};return _0x1e862d;}})});}_0x5912f6=_['merge']({},_0x5912f6,_0x46f3b3[_0x456a('0x3a')]);var _0x587387={'where':_0x5912f6[_0x456a('0x37')]};return db[_0x456a('0x3b')]['count'](_0x587387)[_0x456a('0x3c')](function(_0x3515f5){_0x48205d[_0x456a('0x3d')]=_0x3515f5;if(_0x46f3b3['query'][_0x456a('0x3e')]){_0x5912f6['include']=[{'all':!![]}];}return db['Cdr'][_0x456a('0x3f')](_0x5912f6);})['then'](function(_0x13c52c){_0x48205d[_0x456a('0x40')]=_0x13c52c;return _0x48205d;})['then'](respondWithFilteredResult(_0x25da31,_0x5912f6))[_0x456a('0x41')](handleError(_0x25da31,null));};exports[_0x456a('0x42')]=function(_0x14a1c6,_0x16ccaa){var _0x355ae8={'raw':!![],'where':{'id':_0x14a1c6['params']['id']}},_0x341310={};_0x341310[_0x456a('0x2e')]=_['keys'](db[_0x456a('0x3b')][_0x456a('0x28')]);_0x341310[_0x456a('0x2c')]=_[_0x456a('0x43')](_0x14a1c6[_0x456a('0x2c')]);_0x341310['filters']=_[_0x456a('0x30')](_0x341310[_0x456a('0x2e')],_0x341310[_0x456a('0x2c')]);_0x355ae8[_0x456a('0x2f')]=_[_0x456a('0x30')](_0x341310[_0x456a('0x2e')],qs[_0x456a('0x31')](_0x14a1c6['query'][_0x456a('0x31')]));_0x355ae8[_0x456a('0x2f')]=_0x355ae8[_0x456a('0x2f')][_0x456a('0x44')]?_0x355ae8[_0x456a('0x2f')]:_0x341310['model'];if(_0x14a1c6[_0x456a('0x2c')][_0x456a('0x3e')]){_0x355ae8['include']=[{'all':!![]}];}_0x355ae8=_['merge']({},_0x355ae8,_0x14a1c6[_0x456a('0x3a')]);return db['Cdr'][_0x456a('0x45')](_0x355ae8)['then'](handleEntityNotFound(_0x16ccaa,null))[_0x456a('0x3c')](respondWithResult(_0x16ccaa,null))[_0x456a('0x41')](handleError(_0x16ccaa,null));};exports['create']=function(_0x4d76de,_0x4bd87c){return db[_0x456a('0x3b')][_0x456a('0x46')](_0x4d76de['body'],{})['then'](respondWithResult(_0x4bd87c,0xc9))[_0x456a('0x41')](handleError(_0x4bd87c,null));};exports['update']=function(_0x4e1e36,_0xd08a6d){if(_0x4e1e36[_0x456a('0x47')]['id']){delete _0x4e1e36['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x4e1e36[_0x456a('0x48')]['id']}})[_0x456a('0x3c')](handleEntityNotFound(_0xd08a6d,null))[_0x456a('0x3c')](saveUpdates(_0x4e1e36['body'],null))[_0x456a('0x3c')](respondWithResult(_0xd08a6d,null))[_0x456a('0x41')](handleError(_0xd08a6d,null));};exports[_0x456a('0x22')]=function(_0x2cecc7,_0x1506ba){return db[_0x456a('0x3b')][_0x456a('0x45')]({'where':{'id':_0x2cecc7[_0x456a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1506ba,null))[_0x456a('0x3c')](removeEntity(_0x1506ba,null))[_0x456a('0x41')](handleError(_0x1506ba,null));};exports['describe']=function(_0x239862,_0x299f15){return db['Cdr'][_0x456a('0x49')]()[_0x456a('0x3c')](respondWithResult(_0x299f15,null))['catch'](handleError(_0x299f15,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8acb0b9..4a5ec70 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x92b44,_0x11f9dc){var _0xb7f900=function(_0x4a0f1b){while(--_0x4a0f1b){_0x92b44['push'](_0x92b44['shift']());}};_0xb7f900(++_0x11f9dc);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x38bb6c,_0x3fcb1a){var _0x221764=function(_0x3c2c79){while(--_0x3c2c79){_0x38bb6c['push'](_0x38bb6c['shift']());}};_0x221764(++_0x3fcb1a);}(_0x7a54,0x106));var _0x47a5=function(_0x4b4c54,_0x1dc221){_0x4b4c54=_0x4b4c54-0x0;var _0x6c1923=_0x7a54[_0x4b4c54];return _0x6c1923;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 08c74a8..769832a 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 _0xc0c2=['../../config/utils','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis'];(function(_0x2c5092,_0x36ced3){var _0x5946a8=function(_0x4a84a8){while(--_0x4a84a8){_0x2c5092['push'](_0x2c5092['shift']());}};_0x5946a8(++_0x36ced3);}(_0xc0c2,0x19b));var _0x2c0c=function(_0x276221,_0x378da4){_0x276221=_0x276221-0x0;var _0x4fa716=_0xc0c2[_0x276221];return _0x4fa716;};'use strict';var _=require(_0x2c0c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c0c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c0c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c0c('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2c0c('0x4'));var client=jayson['client'][_0x2c0c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4532ac,_0x4ad244,_0x4f8578){return new BPromise(function(_0x2180fe,_0x2367a5){return client[_0x2c0c('0x6')](_0x4532ac,_0x4f8578)[_0x2c0c('0x7')](function(_0x5eff86){logger[_0x2c0c('0x8')]('Cdr,\x20%s,\x20%s',_0x4ad244,'request\x20sent');logger['debug'](_0x2c0c('0x9'),_0x4ad244,_0x2c0c('0xa'),JSON[_0x2c0c('0xb')](_0x5eff86));if(_0x5eff86[_0x2c0c('0xc')]){if(_0x5eff86[_0x2c0c('0xc')][_0x2c0c('0xd')]===0x1f4){logger[_0x2c0c('0xc')](_0x2c0c('0xe'),_0x4ad244,_0x5eff86[_0x2c0c('0xc')][_0x2c0c('0xf')]);return _0x2367a5(_0x5eff86[_0x2c0c('0xc')][_0x2c0c('0xf')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x4ad244,_0x5eff86[_0x2c0c('0xc')]['message']);return _0x2180fe(_0x5eff86[_0x2c0c('0xc')][_0x2c0c('0xf')]);}else{logger[_0x2c0c('0x8')](_0x2c0c('0xe'),_0x4ad244,'request\x20sent');_0x2180fe(_0x5eff86[_0x2c0c('0x10')][_0x2c0c('0xf')]);}})[_0x2c0c('0x11')](function(_0xf820d0){logger['error'](_0x2c0c('0xe'),_0x4ad244,_0xf820d0);_0x2367a5(_0xf820d0);});});} \ No newline at end of file +var _0xc6f0=['rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5cfa35,_0x5eb7f0){var _0xf7dffb=function(_0x15ce7f){while(--_0x15ce7f){_0x5cfa35['push'](_0x5cfa35['shift']());}};_0xf7dffb(++_0x5eb7f0);}(_0xc6f0,0x1c2));var _0x0c6f=function(_0x421830,_0x13bcda){_0x421830=_0x421830-0x0;var _0x2d10f0=_0xc6f0[_0x421830];return _0x2d10f0;};'use strict';var _=require(_0x0c6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0c6f('0x1'));var rs=require(_0x0c6f('0x2'));var fs=require('fs');var Redis=require(_0x0c6f('0x3'));var db=require(_0x0c6f('0x4'))['db'];var utils=require(_0x0c6f('0x5'));var logger=require('../../config/logger')(_0x0c6f('0x6'));var config=require(_0x0c6f('0x7'));var jayson=require(_0x0c6f('0x8'));var client=jayson[_0x0c6f('0x9')][_0x0c6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e607d,_0x261a18,_0x5b8c42){return new BPromise(function(_0x2dc9a8,_0x5e8356){return client['request'](_0x3e607d,_0x5b8c42)[_0x0c6f('0xb')](function(_0x50b650){logger[_0x0c6f('0xc')](_0x0c6f('0xd'),_0x261a18,'request\x20sent');logger[_0x0c6f('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x261a18,'request\x20sent',JSON[_0x0c6f('0xf')](_0x50b650));if(_0x50b650[_0x0c6f('0x10')]){if(_0x50b650[_0x0c6f('0x10')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x261a18,_0x50b650[_0x0c6f('0x10')]['message']);return _0x5e8356(_0x50b650[_0x0c6f('0x10')][_0x0c6f('0x11')]);}logger['error'](_0x0c6f('0xd'),_0x261a18,_0x50b650[_0x0c6f('0x10')][_0x0c6f('0x11')]);return _0x2dc9a8(_0x50b650['error'][_0x0c6f('0x11')]);}else{logger[_0x0c6f('0xc')](_0x0c6f('0xd'),_0x261a18,_0x0c6f('0x12'));_0x2dc9a8(_0x50b650['result'][_0x0c6f('0x11')]);}})['catch'](function(_0x1b955a){logger['error'](_0x0c6f('0xd'),_0x261a18,_0x1b955a);_0x5e8356(_0x1b955a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5eb6a2d..b8b065a 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x11c431,_0x31025a){var _0x427deb=function(_0x23fb48){while(--_0x23fb48){_0x11c431['push'](_0x11c431['shift']());}};_0x427deb(++_0x31025a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x45c536,_0x52a556){var _0x10e06d=function(_0x3fcca0){while(--_0x3fcca0){_0x45c536['push'](_0x45c536['shift']());}};_0x10e06d(++_0x52a556);}(_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('./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 7d70b8b..4649f42 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 _0x1378=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x1af655,_0x28b928){var _0x29da01=function(_0x508209){while(--_0x508209){_0x1af655['push'](_0x1af655['shift']());}};_0x29da01(++_0x28b928);}(_0x1378,0x160));var _0x8137=function(_0x5354b1,_0x42b116){_0x5354b1=_0x5354b1-0x0;var _0x25d89f=_0x1378[_0x5354b1];return _0x25d89f;};'use strict';var Sequelize=require(_0x8137('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8137('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8137('0x2')],'allowNull':![],'defaultValue':_0x8137('0x3')},'appdata':{'type':Sequelize[_0x8137('0x4')]()},'description':{'type':Sequelize[_0x8137('0x2')]},'interval':{'type':Sequelize[_0x8137('0x2')],'defaultValue':_0x8137('0x5')}}; \ No newline at end of file +var _0x6580=['INTEGER','STRING','sequelize'];(function(_0x1dd6e2,_0x22b32c){var _0x135426=function(_0x540aee){while(--_0x540aee){_0x1dd6e2['push'](_0x1dd6e2['shift']());}};_0x135426(++_0x22b32c);}(_0x6580,0x143));var _0x0658=function(_0x38c529,_0x4eca17){_0x38c529=_0x38c529-0x0;var _0x56c753=_0x6580[_0x38c529];return _0x56c753;};'use strict';var Sequelize=require(_0x0658('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0658('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0658('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0658('0x2')]},'interval':{'type':Sequelize[_0x0658('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 15817b4..97fb73f 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 _0x1ae3=['rawAttributes','query','attributes','intersection','fields','length','include','merge','options','find','catch','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','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','error','stack','name','send','model','keys','ChatApplication'];(function(_0xe8e014,_0x3f00d4){var _0x2b5c86=function(_0x224b80){while(--_0x224b80){_0xe8e014['push'](_0xe8e014['shift']());}};_0x2b5c86(++_0x3f00d4);}(_0x1ae3,0x139));var _0x31ae=function(_0x74188c,_0x5d84b1){_0x74188c=_0x74188c-0x0;var _0x31ae82=_0x1ae3[_0x74188c];return _0x31ae82;};'use strict';var emlformat=require(_0x31ae('0x0'));var rimraf=require(_0x31ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31ae('0x2'));var rp=require(_0x31ae('0x3'));var moment=require(_0x31ae('0x4'));var BPromise=require(_0x31ae('0x5'));var Mustache=require('mustache');var util=require(_0x31ae('0x6'));var path=require(_0x31ae('0x7'));var sox=require(_0x31ae('0x8'));var csv=require(_0x31ae('0x9'));var ejs=require(_0x31ae('0xa'));var fs=require('fs');var fs_extra=require(_0x31ae('0xb'));var _=require(_0x31ae('0xc'));var squel=require(_0x31ae('0xd'));var crypto=require(_0x31ae('0xe'));var jsforce=require(_0x31ae('0xf'));var deskjs=require(_0x31ae('0x10'));var toCsv=require(_0x31ae('0x9'));var querystring=require(_0x31ae('0x11'));var Papa=require(_0x31ae('0x12'));var Redis=require(_0x31ae('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31ae('0x14'));var as=require(_0x31ae('0x15'));var hardwareService=require(_0x31ae('0x16'));var logger=require('../../config/logger')(_0x31ae('0x17'));var utils=require(_0x31ae('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x31ae('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff0f5,_0x2ea4b0){_0x2ea4b0=_0x2ea4b0||0xcc;return function(_0x2e75ef){if(_0x2e75ef){return _0x3ff0f5['sendStatus'](_0x2ea4b0);}return _0x3ff0f5[_0x31ae('0x1a')](_0x2ea4b0)[_0x31ae('0x1b')]();};}function respondWithResult(_0x201e43,_0x3ba04a){_0x3ba04a=_0x3ba04a||0xc8;return function(_0x2b1fc2){if(_0x2b1fc2){return _0x201e43[_0x31ae('0x1a')](_0x3ba04a)['json'](_0x2b1fc2);}};}function respondWithFilteredResult(_0x331134,_0x11abd4){return function(_0x1ec358){if(_0x1ec358){var _0x314849=typeof _0x11abd4[_0x31ae('0x1c')]===_0x31ae('0x1d')&&typeof _0x11abd4[_0x31ae('0x1e')]===_0x31ae('0x1d');var _0x5aa824=_0x1ec358[_0x31ae('0x1f')];var _0x58d574=_0x314849?0x0:_0x11abd4[_0x31ae('0x1c')];var _0x1698d7=_0x314849?_0x1ec358[_0x31ae('0x1f')]:_0x11abd4[_0x31ae('0x1c')]+_0x11abd4[_0x31ae('0x1e')];var _0x26699c;if(_0x1698d7>=_0x5aa824){_0x1698d7=_0x5aa824;_0x26699c=0xc8;}else{_0x26699c=0xce;}_0x331134[_0x31ae('0x1a')](_0x26699c);return _0x331134[_0x31ae('0x20')](_0x31ae('0x21'),_0x58d574+'-'+_0x1698d7+'/'+_0x5aa824)[_0x31ae('0x22')](_0x1ec358);}return null;};}function patchUpdates(_0x3917af){return function(_0x1e4e63){try{jsonpatch['apply'](_0x1e4e63,_0x3917af,!![]);}catch(_0x448cc2){return BPromise[_0x31ae('0x23')](_0x448cc2);}return _0x1e4e63[_0x31ae('0x24')]();};}function saveUpdates(_0x23d875,_0x5c60ef){return function(_0x2729b0){if(_0x2729b0){return _0x2729b0[_0x31ae('0x25')](_0x23d875)['then'](function(_0x27ccad){return _0x27ccad;});}return null;};}function removeEntity(_0x4969e3,_0xd24bd5){return function(_0x56f9c4){if(_0x56f9c4){return _0x56f9c4['destroy']()[_0x31ae('0x26')](function(){_0x4969e3[_0x31ae('0x1a')](0xcc)[_0x31ae('0x1b')]();});}};}function handleEntityNotFound(_0x4c86ba,_0x4d18c0){return function(_0x4c0246){if(!_0x4c0246){_0x4c86ba[_0x31ae('0x27')](0x194);}return _0x4c0246;};}function handleError(_0x579cbe,_0x43ca3d){_0x43ca3d=_0x43ca3d||0x1f4;return function(_0x2b5230){logger[_0x31ae('0x28')](_0x2b5230[_0x31ae('0x29')]);if(_0x2b5230[_0x31ae('0x2a')]){delete _0x2b5230[_0x31ae('0x2a')];}_0x579cbe[_0x31ae('0x1a')](_0x43ca3d)[_0x31ae('0x2b')](_0x2b5230);};}exports['show']=function(_0x258e48,_0xdc9774){var _0x1681ab={'raw':!![],'where':{'id':_0x258e48['params']['id']}},_0x2000aa={};_0x2000aa[_0x31ae('0x2c')]=_[_0x31ae('0x2d')](db[_0x31ae('0x2e')][_0x31ae('0x2f')]);_0x2000aa[_0x31ae('0x30')]=_[_0x31ae('0x2d')](_0x258e48[_0x31ae('0x30')]);_0x2000aa['filters']=_['intersection'](_0x2000aa[_0x31ae('0x2c')],_0x2000aa['query']);_0x1681ab[_0x31ae('0x31')]=_[_0x31ae('0x32')](_0x2000aa['model'],qs[_0x31ae('0x33')](_0x258e48[_0x31ae('0x30')][_0x31ae('0x33')]));_0x1681ab[_0x31ae('0x31')]=_0x1681ab['attributes'][_0x31ae('0x34')]?_0x1681ab[_0x31ae('0x31')]:_0x2000aa['model'];if(_0x258e48['query']['includeAll']){_0x1681ab[_0x31ae('0x35')]=[{'all':!![]}];}_0x1681ab=_[_0x31ae('0x36')]({},_0x1681ab,_0x258e48[_0x31ae('0x37')]);return db[_0x31ae('0x2e')][_0x31ae('0x38')](_0x1681ab)['then'](handleEntityNotFound(_0xdc9774,null))[_0x31ae('0x26')](respondWithResult(_0xdc9774,null))[_0x31ae('0x39')](handleError(_0xdc9774,null));};exports[_0x31ae('0x25')]=function(_0x3506e0,_0x3cf048){if(_0x3506e0[_0x31ae('0x3a')]['id']){delete _0x3506e0[_0x31ae('0x3a')]['id'];}return db[_0x31ae('0x2e')][_0x31ae('0x38')]({'where':{'id':_0x3506e0[_0x31ae('0x3b')]['id']}})[_0x31ae('0x26')](handleEntityNotFound(_0x3cf048,null))[_0x31ae('0x26')](saveUpdates(_0x3506e0['body'],null))[_0x31ae('0x26')](respondWithResult(_0x3cf048,null))[_0x31ae('0x39')](handleError(_0x3cf048,null));};exports['destroy']=function(_0x4403bd,_0x457dac){return db[_0x31ae('0x2e')][_0x31ae('0x38')]({'where':{'id':_0x4403bd[_0x31ae('0x3b')]['id']}})['then'](handleEntityNotFound(_0x457dac,null))[_0x31ae('0x26')](removeEntity(_0x457dac,null))['catch'](handleError(_0x457dac,null));}; \ No newline at end of file +var _0xa047=['merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','params','model','ChatApplication','query','keys','filters','intersection','attributes','fields','includeAll','include'];(function(_0xffad61,_0x5f0282){var _0x33ef10=function(_0x54fde3){while(--_0x54fde3){_0xffad61['push'](_0xffad61['shift']());}};_0x33ef10(++_0x5f0282);}(_0xa047,0x1c5));var _0x7a04=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xa047[_0x5311e8];return _0x582ad8;};'use strict';var emlformat=require(_0x7a04('0x0'));var rimraf=require(_0x7a04('0x1'));var zipdir=require(_0x7a04('0x2'));var jsonpatch=require(_0x7a04('0x3'));var rp=require('request-promise');var moment=require(_0x7a04('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7a04('0x5'));var util=require(_0x7a04('0x6'));var path=require(_0x7a04('0x7'));var sox=require(_0x7a04('0x8'));var csv=require(_0x7a04('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a04('0xa'));var _=require(_0x7a04('0xb'));var squel=require(_0x7a04('0xc'));var crypto=require('crypto');var jsforce=require(_0x7a04('0xd'));var deskjs=require(_0x7a04('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7a04('0xf'));var Papa=require(_0x7a04('0x10'));var Redis=require('ioredis');var authService=require(_0x7a04('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a04('0x12'));var logger=require(_0x7a04('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a04('0x14'));var db=require(_0x7a04('0x15'))['db'];function respondWithStatusCode(_0x3e8692,_0x15a002){_0x15a002=_0x15a002||0xcc;return function(_0x10931c){if(_0x10931c){return _0x3e8692[_0x7a04('0x16')](_0x15a002);}return _0x3e8692[_0x7a04('0x17')](_0x15a002)[_0x7a04('0x18')]();};}function respondWithResult(_0x3630a2,_0x5ae457){_0x5ae457=_0x5ae457||0xc8;return function(_0x3b601d){if(_0x3b601d){return _0x3630a2[_0x7a04('0x17')](_0x5ae457)[_0x7a04('0x19')](_0x3b601d);}};}function respondWithFilteredResult(_0x377fa1,_0x2bb838){return function(_0x328973){if(_0x328973){var _0x4f434f=typeof _0x2bb838[_0x7a04('0x1a')]===_0x7a04('0x1b')&&typeof _0x2bb838[_0x7a04('0x1c')]==='undefined';var _0x5cf6ba=_0x328973[_0x7a04('0x1d')];var _0x4310a2=_0x4f434f?0x0:_0x2bb838[_0x7a04('0x1a')];var _0x5716f5=_0x4f434f?_0x328973[_0x7a04('0x1d')]:_0x2bb838[_0x7a04('0x1a')]+_0x2bb838['limit'];var _0x1ba187;if(_0x5716f5>=_0x5cf6ba){_0x5716f5=_0x5cf6ba;_0x1ba187=0xc8;}else{_0x1ba187=0xce;}_0x377fa1['status'](_0x1ba187);return _0x377fa1[_0x7a04('0x1e')]('Content-Range',_0x4310a2+'-'+_0x5716f5+'/'+_0x5cf6ba)[_0x7a04('0x19')](_0x328973);}return null;};}function patchUpdates(_0x10c327){return function(_0x51b13b){try{jsonpatch[_0x7a04('0x1f')](_0x51b13b,_0x10c327,!![]);}catch(_0x298006){return BPromise['reject'](_0x298006);}return _0x51b13b[_0x7a04('0x20')]();};}function saveUpdates(_0x258346,_0x57eaa5){return function(_0x281562){if(_0x281562){return _0x281562[_0x7a04('0x21')](_0x258346)[_0x7a04('0x22')](function(_0x212d52){return _0x212d52;});}return null;};}function removeEntity(_0x2f8ff6,_0x21b668){return function(_0x1deb47){if(_0x1deb47){return _0x1deb47[_0x7a04('0x23')]()['then'](function(){_0x2f8ff6[_0x7a04('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x303004,_0x415d54){return function(_0x2da06b){if(!_0x2da06b){_0x303004[_0x7a04('0x16')](0x194);}return _0x2da06b;};}function handleError(_0x1162ac,_0x1ff41b){_0x1ff41b=_0x1ff41b||0x1f4;return function(_0x3743b3){logger[_0x7a04('0x24')](_0x3743b3[_0x7a04('0x25')]);if(_0x3743b3[_0x7a04('0x26')]){delete _0x3743b3[_0x7a04('0x26')];}_0x1162ac['status'](_0x1ff41b)[_0x7a04('0x27')](_0x3743b3);};}exports['show']=function(_0x2cfd76,_0x246310){var _0x1b6eba={'raw':!![],'where':{'id':_0x2cfd76[_0x7a04('0x28')]['id']}},_0x3a9d10={};_0x3a9d10[_0x7a04('0x29')]=_['keys'](db[_0x7a04('0x2a')]['rawAttributes']);_0x3a9d10[_0x7a04('0x2b')]=_[_0x7a04('0x2c')](_0x2cfd76['query']);_0x3a9d10[_0x7a04('0x2d')]=_[_0x7a04('0x2e')](_0x3a9d10['model'],_0x3a9d10['query']);_0x1b6eba[_0x7a04('0x2f')]=_[_0x7a04('0x2e')](_0x3a9d10[_0x7a04('0x29')],qs[_0x7a04('0x30')](_0x2cfd76[_0x7a04('0x2b')][_0x7a04('0x30')]));_0x1b6eba[_0x7a04('0x2f')]=_0x1b6eba[_0x7a04('0x2f')]['length']?_0x1b6eba[_0x7a04('0x2f')]:_0x3a9d10[_0x7a04('0x29')];if(_0x2cfd76['query'][_0x7a04('0x31')]){_0x1b6eba[_0x7a04('0x32')]=[{'all':!![]}];}_0x1b6eba=_[_0x7a04('0x33')]({},_0x1b6eba,_0x2cfd76[_0x7a04('0x34')]);return db[_0x7a04('0x2a')][_0x7a04('0x35')](_0x1b6eba)[_0x7a04('0x22')](handleEntityNotFound(_0x246310,null))['then'](respondWithResult(_0x246310,null))[_0x7a04('0x36')](handleError(_0x246310,null));};exports[_0x7a04('0x21')]=function(_0x5b9339,_0x4ac74f){if(_0x5b9339[_0x7a04('0x37')]['id']){delete _0x5b9339['body']['id'];}return db[_0x7a04('0x2a')]['find']({'where':{'id':_0x5b9339[_0x7a04('0x28')]['id']}})[_0x7a04('0x22')](handleEntityNotFound(_0x4ac74f,null))[_0x7a04('0x22')](saveUpdates(_0x5b9339[_0x7a04('0x37')],null))[_0x7a04('0x22')](respondWithResult(_0x4ac74f,null))[_0x7a04('0x36')](handleError(_0x4ac74f,null));};exports[_0x7a04('0x23')]=function(_0x39ede8,_0x4151e3){return db['ChatApplication']['find']({'where':{'id':_0x39ede8['params']['id']}})['then'](handleEntityNotFound(_0x4151e3,null))[_0x7a04('0x22')](removeEntity(_0x4151e3,null))['catch'](handleError(_0x4151e3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5ffd6b7..cbb57c5 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 _0x30d6=['path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x4a273d,_0xb315b6){var _0x2ac050=function(_0x2ff5b1){while(--_0x2ff5b1){_0x4a273d['push'](_0x4a273d['shift']());}};_0x2ac050(++_0xb315b6);}(_0x30d6,0x80));var _0x630d=function(_0x3f5f68,_0xa3bc8f){_0x3f5f68=_0x3f5f68-0x0;var _0x412342=_0x30d6[_0x3f5f68];return _0x412342;};'use strict';var _=require('lodash');var util=require(_0x630d('0x0'));var logger=require(_0x630d('0x1'))(_0x630d('0x2'));var moment=require(_0x630d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x630d('0x4'));var rimraf=require(_0x630d('0x5'));var config=require(_0x630d('0x6'));var attributes=require(_0x630d('0x7'));module['exports']=function(_0x318f72,_0x114b34){return _0x318f72[_0x630d('0x8')](_0x630d('0x9'),attributes,{'tableName':_0x630d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x630d('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa6f6=['chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x3d892c,_0x53c367){var _0x1d9ac2=function(_0x452028){while(--_0x452028){_0x3d892c['push'](_0x3d892c['shift']());}};_0x1d9ac2(++_0x53c367);}(_0xa6f6,0x16b));var _0x6a6f=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xa6f6[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x6a6f('0x0'));var util=require(_0x6a6f('0x1'));var logger=require('../../config/logger')(_0x6a6f('0x2'));var moment=require(_0x6a6f('0x3'));var BPromise=require(_0x6a6f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a6f('0x5'));var rimraf=require(_0x6a6f('0x6'));var config=require(_0x6a6f('0x7'));var attributes=require(_0x6a6f('0x8'));module[_0x6a6f('0x9')]=function(_0x38d498,_0x458043){return _0x38d498[_0x6a6f('0xa')](_0x6a6f('0xb'),attributes,{'tableName':_0x6a6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6a6f('0xd'),'collate':_0x6a6f('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e3fc9f7..5af4d25 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 _0xfa44=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xfa44,0xae));var _0x4fa4=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xfa44[_0x497b1e];return _0x3f72e1;};'use strict';var _=require(_0x4fa4('0x0'));var util=require('util');var moment=require(_0x4fa4('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fa4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4fa4('0x3'));var logger=require(_0x4fa4('0x4'))(_0x4fa4('0x5'));var config=require(_0x4fa4('0x6'));var jayson=require(_0x4fa4('0x7'));var client=jayson[_0x4fa4('0x8')][_0x4fa4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34c893,_0x18e05c,_0x29ab3d){return new BPromise(function(_0x268d84,_0x2d8043){return client[_0x4fa4('0xa')](_0x34c893,_0x29ab3d)[_0x4fa4('0xb')](function(_0x3967a6){logger[_0x4fa4('0xc')](_0x4fa4('0xd'),_0x18e05c,_0x4fa4('0xe'));logger['debug'](_0x4fa4('0xf'),_0x18e05c,_0x4fa4('0xe'),JSON[_0x4fa4('0x10')](_0x3967a6));if(_0x3967a6['error']){if(_0x3967a6[_0x4fa4('0x11')]['code']===0x1f4){logger[_0x4fa4('0x11')](_0x4fa4('0xd'),_0x18e05c,_0x3967a6['error'][_0x4fa4('0x12')]);return _0x2d8043(_0x3967a6[_0x4fa4('0x11')][_0x4fa4('0x12')]);}logger[_0x4fa4('0x11')]('ChatApplication,\x20%s,\x20%s',_0x18e05c,_0x3967a6[_0x4fa4('0x11')]['message']);return _0x268d84(_0x3967a6[_0x4fa4('0x11')][_0x4fa4('0x12')]);}else{logger[_0x4fa4('0xc')](_0x4fa4('0xd'),_0x18e05c,_0x4fa4('0xe'));_0x268d84(_0x3967a6[_0x4fa4('0x13')][_0x4fa4('0x12')]);}})[_0x4fa4('0x14')](function(_0x30783f){logger[_0x4fa4('0x11')](_0x4fa4('0xd'),_0x18e05c,_0x30783f);_0x2d8043(_0x30783f);});});} \ No newline at end of file +var _0x6432=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils'];(function(_0x484fae,_0x37c7ed){var _0x2df2a7=function(_0x23603d){while(--_0x23603d){_0x484fae['push'](_0x484fae['shift']());}};_0x2df2a7(++_0x37c7ed);}(_0x6432,0x8f));var _0x2643=function(_0x36eda0,_0x18d161){_0x36eda0=_0x36eda0-0x0;var _0x2ee4f8=_0x6432[_0x36eda0];return _0x2ee4f8;};'use strict';var _=require(_0x2643('0x0'));var util=require('util');var moment=require(_0x2643('0x1'));var BPromise=require(_0x2643('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2643('0x3'));var logger=require(_0x2643('0x4'))(_0x2643('0x5'));var config=require(_0x2643('0x6'));var jayson=require(_0x2643('0x7'));var client=jayson[_0x2643('0x8')][_0x2643('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c0169,_0x140db3,_0x24ba3a){return new BPromise(function(_0x422928,_0x2cb8e4){return client[_0x2643('0xa')](_0x5c0169,_0x24ba3a)[_0x2643('0xb')](function(_0x4cedb2){logger[_0x2643('0xc')](_0x2643('0xd'),_0x140db3,_0x2643('0xe'));logger[_0x2643('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x140db3,_0x2643('0xe'),JSON['stringify'](_0x4cedb2));if(_0x4cedb2[_0x2643('0x10')]){if(_0x4cedb2[_0x2643('0x10')][_0x2643('0x11')]===0x1f4){logger[_0x2643('0x10')](_0x2643('0xd'),_0x140db3,_0x4cedb2[_0x2643('0x10')][_0x2643('0x12')]);return _0x2cb8e4(_0x4cedb2[_0x2643('0x10')][_0x2643('0x12')]);}logger['error'](_0x2643('0xd'),_0x140db3,_0x4cedb2[_0x2643('0x10')][_0x2643('0x12')]);return _0x422928(_0x4cedb2['error'][_0x2643('0x12')]);}else{logger[_0x2643('0xc')](_0x2643('0xd'),_0x140db3,_0x2643('0xe'));_0x422928(_0x4cedb2[_0x2643('0x13')][_0x2643('0x12')]);}})[_0x2643('0x14')](function(_0x3e1180){logger['error'](_0x2643('0xd'),_0x140db3,_0x3e1180);_0x2cb8e4(_0x3e1180);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1ca0e01..e3aeae8 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 _0x39a5=['/:id','put','update','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x39a5,0xc1));var _0x539a=function(_0x23a246,_0x4eb2c5){_0x23a246=_0x23a246-0x0;var _0x4684a9=_0x39a5[_0x23a246];return _0x4684a9;};'use strict';var multer=require(_0x539a('0x0'));var util=require('util');var path=require(_0x539a('0x1'));var timeout=require(_0x539a('0x2'));var express=require(_0x539a('0x3'));var router=express[_0x539a('0x4')]();var fs_extra=require(_0x539a('0x5'));var auth=require(_0x539a('0x6'));var interaction=require(_0x539a('0x7'));var config=require(_0x539a('0x8'));var controller=require(_0x539a('0x9'));router[_0x539a('0xa')](_0x539a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x539a('0xc')](_0x539a('0xb'),auth['isAuthenticated'](),controller[_0x539a('0xd')]);router['delete']('/:id',auth[_0x539a('0xe')](),controller[_0x539a('0xf')]);module[_0x539a('0x10')]=router; \ No newline at end of file +var _0xa854=['../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa854,0x77));var _0x4a85=function(_0x433ce8,_0x1f95d1){_0x433ce8=_0x433ce8-0x0;var _0x431172=_0xa854[_0x433ce8];return _0x431172;};'use strict';var multer=require(_0x4a85('0x0'));var util=require(_0x4a85('0x1'));var path=require(_0x4a85('0x2'));var timeout=require(_0x4a85('0x3'));var express=require(_0x4a85('0x4'));var router=express[_0x4a85('0x5')]();var fs_extra=require(_0x4a85('0x6'));var auth=require(_0x4a85('0x7'));var interaction=require(_0x4a85('0x8'));var config=require('../../config/environment');var controller=require(_0x4a85('0x9'));router[_0x4a85('0xa')](_0x4a85('0xb'),auth[_0x4a85('0xc')](),controller['show']);router[_0x4a85('0xd')]('/:id',auth[_0x4a85('0xc')](),controller[_0x4a85('0xe')]);router[_0x4a85('0xf')](_0x4a85('0xb'),auth[_0x4a85('0xc')](),controller[_0x4a85('0x10')]);module[_0x4a85('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 68aa207..40f3d12 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 _0xe491=['exports','STRING','BOOLEAN'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0xe491,0x18c));var _0x1e49=function(_0x420a71,_0x4f438e){_0x420a71=_0x420a71-0x0;var _0x5ed086=_0xe491[_0x420a71];return _0x5ed086;};'use strict';var Sequelize=require('sequelize');module[_0x1e49('0x0')]={'name':{'type':Sequelize[_0x1e49('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x1e49('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfa0b=['BOOLEAN','sequelize','STRING'];(function(_0x74900f,_0x20ab0f){var _0x196d8c=function(_0x499e10){while(--_0x499e10){_0x74900f['push'](_0x74900f['shift']());}};_0x196d8c(++_0x20ab0f);}(_0xfa0b,0x1cc));var _0xbfa0=function(_0x1c1820,_0x18bb79){_0x1c1820=_0x1c1820-0x0;var _0x6690e6=_0xfa0b[_0x1c1820];return _0x6690e6;};'use strict';var Sequelize=require(_0xbfa0('0x0'));module['exports']={'name':{'type':Sequelize[_0xbfa0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbfa0('0x1')]},'write':{'type':Sequelize[_0xbfa0('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 872424e..b4cba74 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 _0x38f1=['ChatGroupId','getMessages','findOne','$gte','split','format','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatGroup','include','rows','catch','show','params','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','User','removeMembers','addMessage'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x38f1,0x1e2));var _0x138f=function(_0x1ef446,_0x213fe7){_0x1ef446=_0x1ef446-0x0;var _0x4dbc00=_0x38f1[_0x1ef446];return _0x4dbc00;};'use strict';var emlformat=require(_0x138f('0x0'));var rimraf=require(_0x138f('0x1'));var zipdir=require(_0x138f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x138f('0x3'));var moment=require('moment');var BPromise=require(_0x138f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x138f('0x5'));var sox=require(_0x138f('0x6'));var csv=require('to-csv');var ejs=require(_0x138f('0x7'));var fs=require('fs');var fs_extra=require(_0x138f('0x8'));var _=require(_0x138f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x138f('0xa'));var deskjs=require(_0x138f('0xb'));var toCsv=require(_0x138f('0xc'));var querystring=require(_0x138f('0xd'));var Papa=require(_0x138f('0xe'));var Redis=require(_0x138f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x138f('0x10'));var logger=require(_0x138f('0x11'))(_0x138f('0x12'));var utils=require(_0x138f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x138f('0x14'));var db=require(_0x138f('0x15'))['db'];config[_0x138f('0x16')]=_['defaults'](config[_0x138f('0x16')],{'host':_0x138f('0x17'),'port':0x18eb});var socket=require(_0x138f('0x18'))(new Redis(config[_0x138f('0x16')]));require(_0x138f('0x19'))['register'](socket);function respondWithStatusCode(_0x2da071,_0x313e5e){_0x313e5e=_0x313e5e||0xcc;return function(_0x4b355d){if(_0x4b355d){return _0x2da071[_0x138f('0x1a')](_0x313e5e);}return _0x2da071['status'](_0x313e5e)[_0x138f('0x1b')]();};}function respondWithResult(_0x1f1728,_0x363c65){_0x363c65=_0x363c65||0xc8;return function(_0x2459d7){if(_0x2459d7){return _0x1f1728[_0x138f('0x1c')](_0x363c65)[_0x138f('0x1d')](_0x2459d7);}};}function respondWithFilteredResult(_0x16ff6a,_0x548769){return function(_0x2a1963){if(_0x2a1963){var _0x584bda=typeof _0x548769[_0x138f('0x1e')]===_0x138f('0x1f')&&typeof _0x548769[_0x138f('0x20')]===_0x138f('0x1f');var _0xba46e2=_0x2a1963[_0x138f('0x21')];var _0x363787=_0x584bda?0x0:_0x548769[_0x138f('0x1e')];var _0x7109cc=_0x584bda?_0x2a1963[_0x138f('0x21')]:_0x548769['offset']+_0x548769[_0x138f('0x20')];var _0xd279eb;if(_0x7109cc>=_0xba46e2){_0x7109cc=_0xba46e2;_0xd279eb=0xc8;}else{_0xd279eb=0xce;}_0x16ff6a[_0x138f('0x1c')](_0xd279eb);return _0x16ff6a[_0x138f('0x22')](_0x138f('0x23'),_0x363787+'-'+_0x7109cc+'/'+_0xba46e2)[_0x138f('0x1d')](_0x2a1963);}return null;};}function patchUpdates(_0x568dae){return function(_0x37044e){try{jsonpatch['apply'](_0x37044e,_0x568dae,!![]);}catch(_0x5f2663){return BPromise[_0x138f('0x24')](_0x5f2663);}return _0x37044e[_0x138f('0x25')]();};}function saveUpdates(_0x301a89,_0x3881e1){return function(_0x35492c){if(_0x35492c){return _0x35492c[_0x138f('0x26')](_0x301a89)[_0x138f('0x27')](function(_0x586d5d){return _0x586d5d;});}return null;};}function removeEntity(_0x4f0e2c,_0x330b30){return function(_0x55a980){if(_0x55a980){return _0x55a980['destroy']()[_0x138f('0x27')](function(){_0x4f0e2c[_0x138f('0x1c')](0xcc)[_0x138f('0x1b')]();});}};}function handleEntityNotFound(_0x439a9d,_0x102c3c){return function(_0x62b06c){if(!_0x62b06c){_0x439a9d[_0x138f('0x1a')](0x194);}return _0x62b06c;};}function handleError(_0x239960,_0x318d8e){_0x318d8e=_0x318d8e||0x1f4;return function(_0x519234){logger[_0x138f('0x28')](_0x519234[_0x138f('0x29')]);if(_0x519234[_0x138f('0x2a')]){delete _0x519234[_0x138f('0x2a')];}_0x239960[_0x138f('0x1c')](_0x318d8e)[_0x138f('0x2b')](_0x519234);};}exports[_0x138f('0x2c')]=function(_0x3b700c,_0x3bdc8d){var _0x2179c4={},_0x392df6={},_0x1c9138={'count':0x0,'rows':[]};var _0x4ba8ac=_[_0x138f('0x2d')](db['ChatGroup'][_0x138f('0x2e')],function(_0x4ef8d2){return{'name':_0x4ef8d2[_0x138f('0x2f')],'type':_0x4ef8d2[_0x138f('0x30')][_0x138f('0x31')]};});_0x392df6[_0x138f('0x32')]=_[_0x138f('0x2d')](_0x4ba8ac,_0x138f('0x2a'));_0x392df6[_0x138f('0x33')]=_[_0x138f('0x34')](_0x3b700c[_0x138f('0x33')]);_0x392df6[_0x138f('0x35')]=_[_0x138f('0x36')](_0x392df6[_0x138f('0x32')],_0x392df6[_0x138f('0x33')]);_0x2179c4[_0x138f('0x37')]=_[_0x138f('0x36')](_0x392df6[_0x138f('0x32')],qs[_0x138f('0x38')](_0x3b700c[_0x138f('0x33')]['fields']));_0x2179c4['attributes']=_0x2179c4[_0x138f('0x37')][_0x138f('0x39')]?_0x2179c4[_0x138f('0x37')]:_0x392df6[_0x138f('0x32')];if(!_0x3b700c[_0x138f('0x33')]['hasOwnProperty']('nolimit')){_0x2179c4[_0x138f('0x20')]=qs[_0x138f('0x20')](_0x3b700c[_0x138f('0x33')]['limit']);_0x2179c4[_0x138f('0x1e')]=qs[_0x138f('0x1e')](_0x3b700c['query'][_0x138f('0x1e')]);}_0x2179c4[_0x138f('0x3a')]=qs[_0x138f('0x3b')](_0x3b700c[_0x138f('0x33')][_0x138f('0x3b')]);_0x2179c4[_0x138f('0x3c')]=qs[_0x138f('0x35')](_[_0x138f('0x3d')](_0x3b700c[_0x138f('0x33')],_0x392df6[_0x138f('0x35')]),_0x4ba8ac);if(_0x3b700c[_0x138f('0x33')]['filter']){_0x2179c4[_0x138f('0x3c')]=_[_0x138f('0x3e')](_0x2179c4['where'],{'$or':_[_0x138f('0x2d')](_0x4ba8ac,function(_0x5d83c1){if(_0x5d83c1['type']!==_0x138f('0x3f')){var _0x308462={};_0x308462[_0x5d83c1[_0x138f('0x2a')]]={'$like':'%'+_0x3b700c[_0x138f('0x33')][_0x138f('0x40')]+'%'};return _0x308462;}})});}_0x2179c4=_[_0x138f('0x3e')]({},_0x2179c4,_0x3b700c[_0x138f('0x41')]);var _0x525e6f={'where':_0x2179c4[_0x138f('0x3c')]};return db[_0x138f('0x42')][_0x138f('0x21')](_0x525e6f)['then'](function(_0x88636b){_0x1c9138[_0x138f('0x21')]=_0x88636b;if(_0x3b700c[_0x138f('0x33')]['includeAll']){_0x2179c4[_0x138f('0x43')]=[{'all':!![]}];}return db[_0x138f('0x42')]['findAll'](_0x2179c4);})['then'](function(_0xc7695f){_0x1c9138[_0x138f('0x44')]=_0xc7695f;return _0x1c9138;})[_0x138f('0x27')](respondWithFilteredResult(_0x3bdc8d,_0x2179c4))[_0x138f('0x45')](handleError(_0x3bdc8d,null));};exports[_0x138f('0x46')]=function(_0x32fe80,_0x51a879){var _0x1d60ba={'raw':!![],'where':{'id':_0x32fe80[_0x138f('0x47')]['id']}},_0x3e7ce4={};_0x3e7ce4['model']=_[_0x138f('0x34')](db['ChatGroup'][_0x138f('0x2e')]);_0x3e7ce4[_0x138f('0x33')]=_[_0x138f('0x34')](_0x32fe80['query']);_0x3e7ce4[_0x138f('0x35')]=_[_0x138f('0x36')](_0x3e7ce4[_0x138f('0x32')],_0x3e7ce4[_0x138f('0x33')]);_0x1d60ba['attributes']=_[_0x138f('0x36')](_0x3e7ce4['model'],qs['fields'](_0x32fe80[_0x138f('0x33')][_0x138f('0x38')]));_0x1d60ba['attributes']=_0x1d60ba['attributes']['length']?_0x1d60ba[_0x138f('0x37')]:_0x3e7ce4[_0x138f('0x32')];if(_0x32fe80[_0x138f('0x33')][_0x138f('0x48')]){_0x1d60ba['include']=[{'all':!![]}];}_0x1d60ba=_[_0x138f('0x3e')]({},_0x1d60ba,_0x32fe80[_0x138f('0x41')]);return db[_0x138f('0x42')][_0x138f('0x49')](_0x1d60ba)[_0x138f('0x27')](handleEntityNotFound(_0x51a879,null))[_0x138f('0x27')](respondWithResult(_0x51a879,null))['catch'](handleError(_0x51a879,null));};exports[_0x138f('0x4a')]=function(_0x9256e,_0x74b749){return db[_0x138f('0x42')][_0x138f('0x4a')](_0x9256e[_0x138f('0x4b')],{})['then'](respondWithResult(_0x74b749,0xc9))['catch'](handleError(_0x74b749,null));};exports[_0x138f('0x26')]=function(_0x25d3de,_0xb5a837){if(_0x25d3de['body']['id']){delete _0x25d3de[_0x138f('0x4b')]['id'];}return db['ChatGroup'][_0x138f('0x49')]({'where':{'id':_0x25d3de[_0x138f('0x47')]['id']}})[_0x138f('0x27')](handleEntityNotFound(_0xb5a837,null))['then'](saveUpdates(_0x25d3de['body'],null))[_0x138f('0x27')](respondWithResult(_0xb5a837,null))[_0x138f('0x45')](handleError(_0xb5a837,null));};exports['destroy']=function(_0x18dd8c,_0x245a31){return db[_0x138f('0x42')][_0x138f('0x49')]({'where':{'id':_0x18dd8c['params']['id']}})['then'](handleEntityNotFound(_0x245a31,null))['then'](removeEntity(_0x245a31,null))['catch'](handleError(_0x245a31,null));};exports[_0x138f('0x4c')]=function(_0x55ccd7,_0x4c92ca){return db[_0x138f('0x42')][_0x138f('0x4c')]()['then'](respondWithResult(_0x4c92ca,null))[_0x138f('0x45')](handleError(_0x4c92ca,null));};exports[_0x138f('0x4d')]=function(_0x5192f5,_0x4766ba,_0x2f2fa8){return db[_0x138f('0x4e')][_0x138f('0x21')]({'where':{'ChatGroupId':_0x5192f5[_0x138f('0x47')]['id'],'ToId':_0x5192f5[_0x138f('0x4f')]['id'],'read':![]}})[_0x138f('0x27')](function(_0x44ba16){return{'id':_[_0x138f('0x50')](_0x5192f5[_0x138f('0x47')]['id']),'count':_0x44ba16};})[_0x138f('0x27')](respondWithResult(_0x4766ba,null))['catch'](handleError(_0x4766ba,null));};exports[_0x138f('0x51')]=function(_0x352dde,_0x3741cf,_0x2601f1){return db[_0x138f('0x42')][_0x138f('0x49')]({'where':{'id':_0x352dde[_0x138f('0x47')]['id']}})[_0x138f('0x27')](handleEntityNotFound(_0x3741cf,null))['then'](function(_0x1c63b2){if(_0x1c63b2){return _0x1c63b2[_0x138f('0x51')](_0x352dde[_0x138f('0x4b')][_0x138f('0x52')],_[_0x138f('0x53')](_0x352dde[_0x138f('0x4b')],[_0x138f('0x52'),'id'])||{});}})['then'](respondWithResult(_0x3741cf,null))['catch'](handleError(_0x3741cf,null));};exports[_0x138f('0x54')]=function(_0x351b2b,_0x4e2034,_0x306dbf){var _0x5c8ba1={};var _0x4020e8={};var _0x554b65;var _0x5917b3;return db[_0x138f('0x42')]['findOne']({'where':{'id':_0x351b2b[_0x138f('0x47')]['id']}})[_0x138f('0x27')](handleEntityNotFound(_0x4e2034,null))[_0x138f('0x27')](function(_0x1b9919){if(_0x1b9919){_0x554b65=_0x1b9919;_0x4020e8['model']=_[_0x138f('0x34')](db[_0x138f('0x55')][_0x138f('0x2e')]);_0x4020e8['query']=_[_0x138f('0x34')](_0x351b2b[_0x138f('0x33')]);_0x4020e8[_0x138f('0x35')]=_[_0x138f('0x36')](_0x4020e8[_0x138f('0x32')],_0x4020e8[_0x138f('0x33')]);_0x5c8ba1[_0x138f('0x37')]=_[_0x138f('0x36')](_0x4020e8[_0x138f('0x32')],qs[_0x138f('0x38')](_0x351b2b['query']['fields']));_0x5c8ba1[_0x138f('0x37')]=_0x5c8ba1[_0x138f('0x37')][_0x138f('0x39')]?_0x5c8ba1[_0x138f('0x37')]:_0x4020e8[_0x138f('0x32')];_0x5c8ba1[_0x138f('0x3a')]=qs['sort'](_0x351b2b[_0x138f('0x33')][_0x138f('0x3b')]);_0x5c8ba1['where']=qs['filters'](_['pick'](_0x351b2b[_0x138f('0x33')],_0x4020e8[_0x138f('0x35')]));if(_0x351b2b['query']['filter']){_0x5c8ba1[_0x138f('0x3c')]=_[_0x138f('0x3e')](_0x5c8ba1[_0x138f('0x3c')],{'$or':_[_0x138f('0x2d')](_0x5c8ba1[_0x138f('0x37')],function(_0x571a80){var _0x273c15={};_0x273c15[_0x571a80]={'$like':'%'+_0x351b2b['query']['filter']+'%'};return _0x273c15;})});}_0x5c8ba1=_[_0x138f('0x3e')]({},_0x5c8ba1,_0x351b2b['options']);return _0x554b65[_0x138f('0x54')](_0x5c8ba1);}})['then'](function(_0x51f672){if(_0x51f672){_0x5917b3=_0x51f672[_0x138f('0x39')];if(!_0x351b2b[_0x138f('0x33')]['hasOwnProperty']('nolimit')){_0x5c8ba1['limit']=qs['limit'](_0x351b2b[_0x138f('0x33')][_0x138f('0x20')]);_0x5c8ba1[_0x138f('0x1e')]=qs[_0x138f('0x1e')](_0x351b2b[_0x138f('0x33')]['offset']);}return _0x554b65[_0x138f('0x54')](_0x5c8ba1);}})[_0x138f('0x27')](function(_0x12e5be){if(_0x12e5be){return _0x12e5be?{'count':_0x5917b3,'rows':_0x12e5be}:null;}})[_0x138f('0x27')](respondWithResult(_0x4e2034,null))[_0x138f('0x45')](handleError(_0x4e2034,null));};exports[_0x138f('0x56')]=function(_0x3da749,_0x4d6fa0,_0x11d99f){return db[_0x138f('0x42')][_0x138f('0x49')]({'where':{'id':_0x3da749[_0x138f('0x47')]['id']}})[_0x138f('0x27')](handleEntityNotFound(_0x4d6fa0,null))['then'](function(_0x738f49){if(_0x738f49){return _0x738f49[_0x138f('0x56')](_0x3da749[_0x138f('0x33')][_0x138f('0x52')]);}})['then'](respondWithStatusCode(_0x4d6fa0,null))[_0x138f('0x45')](handleError(_0x4d6fa0,null));};exports[_0x138f('0x57')]=function(_0x42eb14,_0x4a73bb,_0x4455fe){if(_0x42eb14['body']['id']){delete _0x42eb14['body']['id'];}return db['ChatGroup'][_0x138f('0x49')]({'where':{'id':_0x42eb14[_0x138f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a73bb,null))[_0x138f('0x27')](function(_0x2589a3){if(_0x2589a3){_0x42eb14[_0x138f('0x4b')][_0x138f('0x58')]=_0x2589a3['id'];return db['ChatInternalMessage'][_0x138f('0x4a')](_0x42eb14[_0x138f('0x4b')]);}})[_0x138f('0x27')](respondWithResult(_0x4a73bb,null))['catch'](handleError(_0x4a73bb,null));};exports[_0x138f('0x59')]=function(_0x547349,_0x414306,_0x4d0221){var _0x5b2e08={};var _0x22200b={};var _0x21d621;var _0x1219f3;return db[_0x138f('0x42')][_0x138f('0x5a')]({'where':{'id':_0x547349['params']['id']}})[_0x138f('0x27')](handleEntityNotFound(_0x414306,null))[_0x138f('0x27')](function(_0x18ab6b){if(_0x18ab6b){_0x21d621=_0x18ab6b;_0x22200b['model']=_[_0x138f('0x34')](db[_0x138f('0x4e')][_0x138f('0x2e')]);_0x22200b[_0x138f('0x33')]=_['keys'](_0x547349[_0x138f('0x33')]);_0x22200b[_0x138f('0x35')]=_[_0x138f('0x36')](_0x22200b[_0x138f('0x32')],_0x22200b[_0x138f('0x33')]);_0x5b2e08[_0x138f('0x37')]=_['intersection'](_0x22200b[_0x138f('0x32')],qs[_0x138f('0x38')](_0x547349[_0x138f('0x33')]['fields']));_0x5b2e08[_0x138f('0x37')]=_0x5b2e08[_0x138f('0x37')][_0x138f('0x39')]?_0x5b2e08['attributes']:_0x22200b['model'];_0x5b2e08['order']=qs[_0x138f('0x3b')](_0x547349[_0x138f('0x33')]['sort']);_0x5b2e08['where']=qs[_0x138f('0x35')](_[_0x138f('0x3d')](_0x547349['query'],_0x22200b[_0x138f('0x35')]));if(_0x547349[_0x138f('0x33')][_0x138f('0x40')]){_0x5b2e08['where']=_[_0x138f('0x3e')](_0x5b2e08[_0x138f('0x3c')],{'$or':_['map'](_0x5b2e08['attributes'],function(_0x1e3168){var _0x2af5b2={};_0x2af5b2[_0x1e3168]={'$like':'%'+_0x547349[_0x138f('0x33')][_0x138f('0x40')]+'%'};return _0x2af5b2;})});}if(_0x547349[_0x138f('0x33')][_0x138f('0x5b')]){var _0x21dfef=_0x547349[_0x138f('0x33')][_0x138f('0x5b')][_0x138f('0x5c')](',');var _0x5b27cb={};_0x5b27cb[_0x21dfef[0x0]]={'$gte':moment(_0x21dfef[0x1])[_0x138f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b2e08['where']=_['merge'](_0x5b2e08['where'],_0x5b27cb);}_0x5b2e08=_[_0x138f('0x3e')]({},_0x5b2e08,_0x547349[_0x138f('0x41')]);return _0x21d621[_0x138f('0x59')](_0x5b2e08);}})[_0x138f('0x27')](function(_0x2c3a43){if(_0x2c3a43){_0x1219f3=_0x2c3a43['length'];if(!_0x547349['query'][_0x138f('0x5e')]('nolimit')){_0x5b2e08[_0x138f('0x20')]=qs['limit'](_0x547349[_0x138f('0x33')]['limit']);_0x5b2e08[_0x138f('0x1e')]=qs[_0x138f('0x1e')](_0x547349[_0x138f('0x33')][_0x138f('0x1e')]);}return _0x21d621[_0x138f('0x59')](_0x5b2e08);}})[_0x138f('0x27')](function(_0x348b2e){if(_0x348b2e){return _0x348b2e?{'count':_0x1219f3,'rows':_0x348b2e}:null;}})[_0x138f('0x27')](respondWithResult(_0x414306,null))['catch'](handleError(_0x414306,null));}; \ No newline at end of file +var _0x852c=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','findAll','rows','catch','show','params','length','include','merge','options','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','User','filter','removeMembers','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0x852c,0x18e));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc852('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc852('0x1'));var moment=require(_0xc852('0x2'));var BPromise=require(_0xc852('0x3'));var Mustache=require(_0xc852('0x4'));var util=require(_0xc852('0x5'));var path=require(_0xc852('0x6'));var sox=require('sox');var csv=require(_0xc852('0x7'));var ejs=require(_0xc852('0x8'));var fs=require('fs');var fs_extra=require(_0xc852('0x9'));var _=require(_0xc852('0xa'));var squel=require(_0xc852('0xb'));var crypto=require(_0xc852('0xc'));var jsforce=require(_0xc852('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc852('0xe'));var Papa=require(_0xc852('0xf'));var Redis=require(_0xc852('0x10'));var authService=require(_0xc852('0x11'));var qs=require(_0xc852('0x12'));var as=require(_0xc852('0x13'));var hardwareService=require(_0xc852('0x14'));var logger=require(_0xc852('0x15'))(_0xc852('0x16'));var utils=require(_0xc852('0x17'));var config=require(_0xc852('0x18'));var licenseUtil=require(_0xc852('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc852('0x1a')](config[_0xc852('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc852('0x1c'))(new Redis(config[_0xc852('0x1b')]));require(_0xc852('0x1d'))[_0xc852('0x1e')](socket);function respondWithStatusCode(_0x38e65b,_0x36697e){_0x36697e=_0x36697e||0xcc;return function(_0x4d9c3a){if(_0x4d9c3a){return _0x38e65b[_0xc852('0x1f')](_0x36697e);}return _0x38e65b[_0xc852('0x20')](_0x36697e)[_0xc852('0x21')]();};}function respondWithResult(_0x4a466b,_0x2ad0f7){_0x2ad0f7=_0x2ad0f7||0xc8;return function(_0x56fb75){if(_0x56fb75){return _0x4a466b[_0xc852('0x20')](_0x2ad0f7)['json'](_0x56fb75);}};}function respondWithFilteredResult(_0x4d9864,_0x1c39cf){return function(_0x1ec983){if(_0x1ec983){var _0xe4720f=typeof _0x1c39cf[_0xc852('0x22')]===_0xc852('0x23')&&typeof _0x1c39cf['limit']==='undefined';var _0x264744=_0x1ec983[_0xc852('0x24')];var _0x20a8d7=_0xe4720f?0x0:_0x1c39cf['offset'];var _0x2a4638=_0xe4720f?_0x1ec983['count']:_0x1c39cf[_0xc852('0x22')]+_0x1c39cf['limit'];var _0xe742a3;if(_0x2a4638>=_0x264744){_0x2a4638=_0x264744;_0xe742a3=0xc8;}else{_0xe742a3=0xce;}_0x4d9864[_0xc852('0x20')](_0xe742a3);return _0x4d9864[_0xc852('0x25')](_0xc852('0x26'),_0x20a8d7+'-'+_0x2a4638+'/'+_0x264744)[_0xc852('0x27')](_0x1ec983);}return null;};}function patchUpdates(_0x1969e2){return function(_0x2cb7d2){try{jsonpatch[_0xc852('0x28')](_0x2cb7d2,_0x1969e2,!![]);}catch(_0x1b0cef){return BPromise[_0xc852('0x29')](_0x1b0cef);}return _0x2cb7d2[_0xc852('0x2a')]();};}function saveUpdates(_0x2164cc,_0x109b4b){return function(_0x4b8173){if(_0x4b8173){return _0x4b8173[_0xc852('0x2b')](_0x2164cc)[_0xc852('0x2c')](function(_0x4b8b21){return _0x4b8b21;});}return null;};}function removeEntity(_0x400910,_0x326185){return function(_0x1bf89b){if(_0x1bf89b){return _0x1bf89b[_0xc852('0x2d')]()[_0xc852('0x2c')](function(){_0x400910[_0xc852('0x20')](0xcc)[_0xc852('0x21')]();});}};}function handleEntityNotFound(_0x64c03c,_0x254b0d){return function(_0x3a59f4){if(!_0x3a59f4){_0x64c03c['sendStatus'](0x194);}return _0x3a59f4;};}function handleError(_0x542905,_0x4738f1){_0x4738f1=_0x4738f1||0x1f4;return function(_0x8def74){logger[_0xc852('0x2e')](_0x8def74[_0xc852('0x2f')]);if(_0x8def74[_0xc852('0x30')]){delete _0x8def74[_0xc852('0x30')];}_0x542905[_0xc852('0x20')](_0x4738f1)[_0xc852('0x31')](_0x8def74);};}exports[_0xc852('0x32')]=function(_0x4922bc,_0x11bcce){var _0x400ced={},_0x28fbaf={},_0x544481={'count':0x0,'rows':[]};var _0x2f1130=_[_0xc852('0x33')](db[_0xc852('0x34')][_0xc852('0x35')],function(_0x3184d8){return{'name':_0x3184d8[_0xc852('0x36')],'type':_0x3184d8[_0xc852('0x37')][_0xc852('0x38')]};});_0x28fbaf[_0xc852('0x39')]=_['map'](_0x2f1130,'name');_0x28fbaf[_0xc852('0x3a')]=_[_0xc852('0x3b')](_0x4922bc['query']);_0x28fbaf[_0xc852('0x3c')]=_[_0xc852('0x3d')](_0x28fbaf['model'],_0x28fbaf['query']);_0x400ced[_0xc852('0x3e')]=_['intersection'](_0x28fbaf[_0xc852('0x39')],qs[_0xc852('0x3f')](_0x4922bc[_0xc852('0x3a')][_0xc852('0x3f')]));_0x400ced[_0xc852('0x3e')]=_0x400ced[_0xc852('0x3e')]['length']?_0x400ced[_0xc852('0x3e')]:_0x28fbaf[_0xc852('0x39')];if(!_0x4922bc[_0xc852('0x3a')][_0xc852('0x40')](_0xc852('0x41'))){_0x400ced[_0xc852('0x42')]=qs[_0xc852('0x42')](_0x4922bc[_0xc852('0x3a')][_0xc852('0x42')]);_0x400ced[_0xc852('0x22')]=qs[_0xc852('0x22')](_0x4922bc[_0xc852('0x3a')]['offset']);}_0x400ced[_0xc852('0x43')]=qs[_0xc852('0x44')](_0x4922bc['query'][_0xc852('0x44')]);_0x400ced[_0xc852('0x45')]=qs[_0xc852('0x3c')](_[_0xc852('0x46')](_0x4922bc['query'],_0x28fbaf[_0xc852('0x3c')]),_0x2f1130);if(_0x4922bc[_0xc852('0x3a')]['filter']){_0x400ced[_0xc852('0x45')]=_['merge'](_0x400ced['where'],{'$or':_[_0xc852('0x33')](_0x2f1130,function(_0x486de0){if(_0x486de0[_0xc852('0x37')]!==_0xc852('0x47')){var _0x54bb7a={};_0x54bb7a[_0x486de0[_0xc852('0x30')]]={'$like':'%'+_0x4922bc[_0xc852('0x3a')]['filter']+'%'};return _0x54bb7a;}})});}_0x400ced=_['merge']({},_0x400ced,_0x4922bc['options']);var _0x2ef619={'where':_0x400ced['where']};return db[_0xc852('0x34')][_0xc852('0x24')](_0x2ef619)[_0xc852('0x2c')](function(_0x15f025){_0x544481[_0xc852('0x24')]=_0x15f025;if(_0x4922bc[_0xc852('0x3a')]['includeAll']){_0x400ced['include']=[{'all':!![]}];}return db['ChatGroup'][_0xc852('0x48')](_0x400ced);})[_0xc852('0x2c')](function(_0xa14fde){_0x544481[_0xc852('0x49')]=_0xa14fde;return _0x544481;})[_0xc852('0x2c')](respondWithFilteredResult(_0x11bcce,_0x400ced))[_0xc852('0x4a')](handleError(_0x11bcce,null));};exports[_0xc852('0x4b')]=function(_0x34350d,_0x9a632c){var _0x5c0ddb={'raw':!![],'where':{'id':_0x34350d[_0xc852('0x4c')]['id']}},_0x30eba8={};_0x30eba8['model']=_[_0xc852('0x3b')](db['ChatGroup'][_0xc852('0x35')]);_0x30eba8['query']=_[_0xc852('0x3b')](_0x34350d[_0xc852('0x3a')]);_0x30eba8[_0xc852('0x3c')]=_['intersection'](_0x30eba8[_0xc852('0x39')],_0x30eba8['query']);_0x5c0ddb[_0xc852('0x3e')]=_[_0xc852('0x3d')](_0x30eba8[_0xc852('0x39')],qs['fields'](_0x34350d['query']['fields']));_0x5c0ddb[_0xc852('0x3e')]=_0x5c0ddb['attributes'][_0xc852('0x4d')]?_0x5c0ddb['attributes']:_0x30eba8[_0xc852('0x39')];if(_0x34350d[_0xc852('0x3a')]['includeAll']){_0x5c0ddb[_0xc852('0x4e')]=[{'all':!![]}];}_0x5c0ddb=_[_0xc852('0x4f')]({},_0x5c0ddb,_0x34350d[_0xc852('0x50')]);return db[_0xc852('0x34')][_0xc852('0x51')](_0x5c0ddb)[_0xc852('0x2c')](handleEntityNotFound(_0x9a632c,null))[_0xc852('0x2c')](respondWithResult(_0x9a632c,null))[_0xc852('0x4a')](handleError(_0x9a632c,null));};exports[_0xc852('0x52')]=function(_0x22436a,_0x1cc4fa){return db[_0xc852('0x34')][_0xc852('0x52')](_0x22436a[_0xc852('0x53')],{})[_0xc852('0x2c')](respondWithResult(_0x1cc4fa,0xc9))[_0xc852('0x4a')](handleError(_0x1cc4fa,null));};exports['update']=function(_0xfebbb0,_0x135f5d){if(_0xfebbb0[_0xc852('0x53')]['id']){delete _0xfebbb0[_0xc852('0x53')]['id'];}return db[_0xc852('0x34')]['find']({'where':{'id':_0xfebbb0['params']['id']}})['then'](handleEntityNotFound(_0x135f5d,null))['then'](saveUpdates(_0xfebbb0[_0xc852('0x53')],null))[_0xc852('0x2c')](respondWithResult(_0x135f5d,null))['catch'](handleError(_0x135f5d,null));};exports[_0xc852('0x2d')]=function(_0xfffd3c,_0x56a415){return db[_0xc852('0x34')]['find']({'where':{'id':_0xfffd3c[_0xc852('0x4c')]['id']}})[_0xc852('0x2c')](handleEntityNotFound(_0x56a415,null))[_0xc852('0x2c')](removeEntity(_0x56a415,null))['catch'](handleError(_0x56a415,null));};exports[_0xc852('0x54')]=function(_0x4c5c2a,_0x30380b){return db['ChatGroup'][_0xc852('0x54')]()[_0xc852('0x2c')](respondWithResult(_0x30380b,null))[_0xc852('0x4a')](handleError(_0x30380b,null));};exports[_0xc852('0x55')]=function(_0x4205a0,_0x194984,_0x400039){return db['ChatInternalMessage'][_0xc852('0x24')]({'where':{'ChatGroupId':_0x4205a0[_0xc852('0x4c')]['id'],'ToId':_0x4205a0[_0xc852('0x56')]['id'],'read':![]}})[_0xc852('0x2c')](function(_0x288a60){return{'id':_[_0xc852('0x57')](_0x4205a0[_0xc852('0x4c')]['id']),'count':_0x288a60};})[_0xc852('0x2c')](respondWithResult(_0x194984,null))[_0xc852('0x4a')](handleError(_0x194984,null));};exports[_0xc852('0x58')]=function(_0x4a5ff9,_0x5c2012,_0x187768){return db[_0xc852('0x34')][_0xc852('0x51')]({'where':{'id':_0x4a5ff9['params']['id']}})[_0xc852('0x2c')](handleEntityNotFound(_0x5c2012,null))[_0xc852('0x2c')](function(_0x43ccae){if(_0x43ccae){return _0x43ccae['addMembers'](_0x4a5ff9[_0xc852('0x53')][_0xc852('0x59')],_['omit'](_0x4a5ff9[_0xc852('0x53')],[_0xc852('0x59'),'id'])||{});}})['then'](respondWithResult(_0x5c2012,null))['catch'](handleError(_0x5c2012,null));};exports[_0xc852('0x5a')]=function(_0x532ce7,_0x529fc5,_0x21e92c){var _0x23844e={};var _0x251f2c={};var _0x563acb;var _0x500d4f;return db[_0xc852('0x34')][_0xc852('0x5b')]({'where':{'id':_0x532ce7['params']['id']}})[_0xc852('0x2c')](handleEntityNotFound(_0x529fc5,null))[_0xc852('0x2c')](function(_0x518f4e){if(_0x518f4e){_0x563acb=_0x518f4e;_0x251f2c[_0xc852('0x39')]=_[_0xc852('0x3b')](db[_0xc852('0x5c')][_0xc852('0x35')]);_0x251f2c['query']=_[_0xc852('0x3b')](_0x532ce7['query']);_0x251f2c[_0xc852('0x3c')]=_[_0xc852('0x3d')](_0x251f2c[_0xc852('0x39')],_0x251f2c[_0xc852('0x3a')]);_0x23844e['attributes']=_[_0xc852('0x3d')](_0x251f2c[_0xc852('0x39')],qs[_0xc852('0x3f')](_0x532ce7[_0xc852('0x3a')][_0xc852('0x3f')]));_0x23844e[_0xc852('0x3e')]=_0x23844e['attributes'][_0xc852('0x4d')]?_0x23844e[_0xc852('0x3e')]:_0x251f2c[_0xc852('0x39')];_0x23844e[_0xc852('0x43')]=qs[_0xc852('0x44')](_0x532ce7[_0xc852('0x3a')][_0xc852('0x44')]);_0x23844e['where']=qs[_0xc852('0x3c')](_['pick'](_0x532ce7[_0xc852('0x3a')],_0x251f2c['filters']));if(_0x532ce7[_0xc852('0x3a')][_0xc852('0x5d')]){_0x23844e[_0xc852('0x45')]=_[_0xc852('0x4f')](_0x23844e[_0xc852('0x45')],{'$or':_['map'](_0x23844e['attributes'],function(_0x5ee3c1){var _0x31ff27={};_0x31ff27[_0x5ee3c1]={'$like':'%'+_0x532ce7['query'][_0xc852('0x5d')]+'%'};return _0x31ff27;})});}_0x23844e=_[_0xc852('0x4f')]({},_0x23844e,_0x532ce7[_0xc852('0x50')]);return _0x563acb[_0xc852('0x5a')](_0x23844e);}})[_0xc852('0x2c')](function(_0x20cc91){if(_0x20cc91){_0x500d4f=_0x20cc91['length'];if(!_0x532ce7[_0xc852('0x3a')][_0xc852('0x40')]('nolimit')){_0x23844e[_0xc852('0x42')]=qs[_0xc852('0x42')](_0x532ce7[_0xc852('0x3a')]['limit']);_0x23844e[_0xc852('0x22')]=qs[_0xc852('0x22')](_0x532ce7[_0xc852('0x3a')]['offset']);}return _0x563acb[_0xc852('0x5a')](_0x23844e);}})[_0xc852('0x2c')](function(_0x19cc87){if(_0x19cc87){return _0x19cc87?{'count':_0x500d4f,'rows':_0x19cc87}:null;}})['then'](respondWithResult(_0x529fc5,null))[_0xc852('0x4a')](handleError(_0x529fc5,null));};exports[_0xc852('0x5e')]=function(_0x17ec3f,_0x15dafb,_0x45b4b9){return db[_0xc852('0x34')][_0xc852('0x51')]({'where':{'id':_0x17ec3f[_0xc852('0x4c')]['id']}})[_0xc852('0x2c')](handleEntityNotFound(_0x15dafb,null))['then'](function(_0x406ee1){if(_0x406ee1){return _0x406ee1[_0xc852('0x5e')](_0x17ec3f[_0xc852('0x3a')][_0xc852('0x59')]);}})[_0xc852('0x2c')](respondWithStatusCode(_0x15dafb,null))['catch'](handleError(_0x15dafb,null));};exports['addMessage']=function(_0x1cd82d,_0x247b43,_0x23bb11){if(_0x1cd82d['body']['id']){delete _0x1cd82d[_0xc852('0x53')]['id'];}return db[_0xc852('0x34')][_0xc852('0x51')]({'where':{'id':_0x1cd82d[_0xc852('0x4c')]['id']}})[_0xc852('0x2c')](handleEntityNotFound(_0x247b43,null))[_0xc852('0x2c')](function(_0xf40ae4){if(_0xf40ae4){_0x1cd82d[_0xc852('0x53')][_0xc852('0x5f')]=_0xf40ae4['id'];return db[_0xc852('0x60')][_0xc852('0x52')](_0x1cd82d[_0xc852('0x53')]);}})[_0xc852('0x2c')](respondWithResult(_0x247b43,null))[_0xc852('0x4a')](handleError(_0x247b43,null));};exports[_0xc852('0x61')]=function(_0x535325,_0x4d1ff0,_0x194e59){var _0x460812={};var _0x2a3207={};var _0x35c7f7;var _0x175db7;return db[_0xc852('0x34')][_0xc852('0x5b')]({'where':{'id':_0x535325[_0xc852('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d1ff0,null))['then'](function(_0x125f9c){if(_0x125f9c){_0x35c7f7=_0x125f9c;_0x2a3207[_0xc852('0x39')]=_[_0xc852('0x3b')](db[_0xc852('0x60')][_0xc852('0x35')]);_0x2a3207['query']=_['keys'](_0x535325[_0xc852('0x3a')]);_0x2a3207[_0xc852('0x3c')]=_[_0xc852('0x3d')](_0x2a3207[_0xc852('0x39')],_0x2a3207[_0xc852('0x3a')]);_0x460812[_0xc852('0x3e')]=_[_0xc852('0x3d')](_0x2a3207[_0xc852('0x39')],qs[_0xc852('0x3f')](_0x535325[_0xc852('0x3a')][_0xc852('0x3f')]));_0x460812[_0xc852('0x3e')]=_0x460812[_0xc852('0x3e')][_0xc852('0x4d')]?_0x460812['attributes']:_0x2a3207[_0xc852('0x39')];_0x460812[_0xc852('0x43')]=qs[_0xc852('0x44')](_0x535325[_0xc852('0x3a')][_0xc852('0x44')]);_0x460812[_0xc852('0x45')]=qs[_0xc852('0x3c')](_['pick'](_0x535325['query'],_0x2a3207[_0xc852('0x3c')]));if(_0x535325[_0xc852('0x3a')]['filter']){_0x460812[_0xc852('0x45')]=_['merge'](_0x460812[_0xc852('0x45')],{'$or':_['map'](_0x460812[_0xc852('0x3e')],function(_0x391c6e){var _0x56172e={};_0x56172e[_0x391c6e]={'$like':'%'+_0x535325['query'][_0xc852('0x5d')]+'%'};return _0x56172e;})});}if(_0x535325[_0xc852('0x3a')][_0xc852('0x62')]){var _0x2b0720=_0x535325[_0xc852('0x3a')]['$gte'][_0xc852('0x63')](',');var _0xd3347e={};_0xd3347e[_0x2b0720[0x0]]={'$gte':moment(_0x2b0720[0x1])['format'](_0xc852('0x64'))};_0x460812[_0xc852('0x45')]=_[_0xc852('0x4f')](_0x460812[_0xc852('0x45')],_0xd3347e);}_0x460812=_['merge']({},_0x460812,_0x535325[_0xc852('0x50')]);return _0x35c7f7[_0xc852('0x61')](_0x460812);}})[_0xc852('0x2c')](function(_0x35b866){if(_0x35b866){_0x175db7=_0x35b866['length'];if(!_0x535325[_0xc852('0x3a')][_0xc852('0x40')](_0xc852('0x41'))){_0x460812[_0xc852('0x42')]=qs['limit'](_0x535325['query'][_0xc852('0x42')]);_0x460812[_0xc852('0x22')]=qs[_0xc852('0x22')](_0x535325[_0xc852('0x3a')]['offset']);}return _0x35c7f7[_0xc852('0x61')](_0x460812);}})[_0xc852('0x2c')](function(_0xad1697){if(_0xad1697){return _0xad1697?{'count':_0x175db7,'rows':_0xad1697}:null;}})[_0xc852('0x2c')](respondWithResult(_0x4d1ff0,null))['catch'](handleError(_0x4d1ff0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ed7bb1f..3decd5a 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 _0xbda9=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x5c4268,_0x13f15d){var _0x44a915=function(_0x2b1db1){while(--_0x2b1db1){_0x5c4268['push'](_0x5c4268['shift']());}};_0x44a915(++_0x13f15d);}(_0xbda9,0x146));var _0x9bda=function(_0x5a6a1f,_0x5ce170){_0x5a6a1f=_0x5a6a1f-0x0;var _0x1a17bd=_0xbda9[_0x5a6a1f];return _0x1a17bd;};'use strict';var EventEmitter=require(_0x9bda('0x0'));var ChatGroup=require(_0x9bda('0x1'))['db'][_0x9bda('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9bda('0x3')](0x0);var events={'afterCreate':_0x9bda('0x4'),'afterUpdate':_0x9bda('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3b0b02){return function(_0x14e41a,_0x59ac61,_0x425749){ChatGroupEvents[_0x9bda('0x6')](_0x3b0b02+':'+_0x14e41a['id'],_0x14e41a);ChatGroupEvents[_0x9bda('0x6')](_0x3b0b02,_0x14e41a);_0x425749(null);};}for(var e in events){if(events[_0x9bda('0x7')](e)){var event=events[e];ChatGroup[_0x9bda('0x8')](e,emitEvent(event));}}module[_0x9bda('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xe3a5=['../../mysqldb','ChatGroup','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x722545,_0x536493){var _0x54c95d=function(_0x2efbea){while(--_0x2efbea){_0x722545['push'](_0x722545['shift']());}};_0x54c95d(++_0x536493);}(_0xe3a5,0x127));var _0x5e3a=function(_0xbced2,_0x2e330f){_0xbced2=_0xbced2-0x0;var _0x1df67f=_0xe3a5[_0xbced2];return _0x1df67f;};'use strict';var EventEmitter=require(_0x5e3a('0x0'));var ChatGroup=require(_0x5e3a('0x1'))['db'][_0x5e3a('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e3a('0x3'),'afterDestroy':_0x5e3a('0x4')};function emitEvent(_0x1e867c){return function(_0x597a22,_0x40aa58,_0x30f110){ChatGroupEvents[_0x5e3a('0x5')](_0x1e867c+':'+_0x597a22['id'],_0x597a22);ChatGroupEvents[_0x5e3a('0x5')](_0x1e867c,_0x597a22);_0x30f110(null);};}for(var e in events){if(events[_0x5e3a('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x5e3a('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c1f8e7c..ca2bdca 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 _0xb6be=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','util'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb6be,0x13a));var _0xeb6b=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xb6be[_0x484c03];return _0x294127;};'use strict';var _=require('lodash');var util=require(_0xeb6b('0x0'));var logger=require('../../config/logger')(_0xeb6b('0x1'));var moment=require(_0xeb6b('0x2'));var BPromise=require(_0xeb6b('0x3'));var rp=require(_0xeb6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb6b('0x5'));var config=require(_0xeb6b('0x6'));var attributes=require('./chatGroup.attributes');module[_0xeb6b('0x7')]=function(_0x3270ae,_0x4a62ef){return _0x3270ae[_0xeb6b('0x8')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdb9=['util','api','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xfdb9,0x137));var _0x9fdb=function(_0x2e93b2,_0x84d86c){_0x2e93b2=_0x2e93b2-0x0;var _0x5dd5c4=_0xfdb9[_0x2e93b2];return _0x5dd5c4;};'use strict';var _=require(_0x9fdb('0x0'));var util=require(_0x9fdb('0x1'));var logger=require('../../config/logger')(_0x9fdb('0x2'));var moment=require(_0x9fdb('0x3'));var BPromise=require(_0x9fdb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fdb('0x5'));var rimraf=require(_0x9fdb('0x6'));var config=require(_0x9fdb('0x7'));var attributes=require(_0x9fdb('0x8'));module[_0x9fdb('0x9')]=function(_0x90caf9,_0xf2dbc8){return _0x90caf9[_0x9fdb('0xa')](_0x9fdb('0xb'),attributes,{'tableName':_0x9fdb('0xc'),'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 1961967..5d80eaf 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 _0xa1db=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatGroup,\x20%s,\x20%s'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0xa1db,0xb0));var _0xba1d=function(_0x491082,_0x28f78b){_0x491082=_0x491082-0x0;var _0x5797d9=_0xa1db[_0x491082];return _0x5797d9;};'use strict';var _=require(_0xba1d('0x0'));var util=require(_0xba1d('0x1'));var moment=require(_0xba1d('0x2'));var BPromise=require(_0xba1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba1d('0x4'))['db'];var utils=require(_0xba1d('0x5'));var logger=require('../../config/logger')(_0xba1d('0x6'));var config=require(_0xba1d('0x7'));var jayson=require(_0xba1d('0x8'));var client=jayson[_0xba1d('0x9')][_0xba1d('0xa')]({'port':0x232a});config[_0xba1d('0xb')]=_[_0xba1d('0xc')](config[_0xba1d('0xb')],{'host':_0xba1d('0xd'),'port':0x18eb});var socket=require(_0xba1d('0xe'))(new Redis(config[_0xba1d('0xb')]));require(_0xba1d('0xf'))[_0xba1d('0x10')](socket);function respondWithRpcPromise(_0x4e9713,_0x13e642,_0x39bcb4){return new BPromise(function(_0x3548c9,_0x280d91){return client[_0xba1d('0x11')](_0x4e9713,_0x39bcb4)[_0xba1d('0x12')](function(_0x34ac7d){logger[_0xba1d('0x13')]('ChatGroup,\x20%s,\x20%s',_0x13e642,_0xba1d('0x14'));logger[_0xba1d('0x15')](_0xba1d('0x16'),_0x13e642,_0xba1d('0x14'),JSON[_0xba1d('0x17')](_0x34ac7d));if(_0x34ac7d['error']){if(_0x34ac7d['error'][_0xba1d('0x18')]===0x1f4){logger[_0xba1d('0x19')](_0xba1d('0x1a'),_0x13e642,_0x34ac7d[_0xba1d('0x19')][_0xba1d('0x1b')]);return _0x280d91(_0x34ac7d[_0xba1d('0x19')]['message']);}logger['error'](_0xba1d('0x1a'),_0x13e642,_0x34ac7d[_0xba1d('0x19')][_0xba1d('0x1b')]);return _0x3548c9(_0x34ac7d['error'][_0xba1d('0x1b')]);}else{logger[_0xba1d('0x13')](_0xba1d('0x1a'),_0x13e642,_0xba1d('0x14'));_0x3548c9(_0x34ac7d[_0xba1d('0x1c')][_0xba1d('0x1b')]);}})['catch'](function(_0x3110c2){logger[_0xba1d('0x19')](_0xba1d('0x1a'),_0x13e642,_0x3110c2);_0x280d91(_0x3110c2);});});} \ No newline at end of file +var _0x9933=['ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9933,0xe5));var _0x3993=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9933[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x3993('0x0'));var util=require(_0x3993('0x1'));var moment=require('moment');var BPromise=require(_0x3993('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3993('0x3'));var db=require(_0x3993('0x4'))['db'];var utils=require(_0x3993('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3993('0x6'));var client=jayson['client'][_0x3993('0x7')]({'port':0x232a});config[_0x3993('0x8')]=_[_0x3993('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3993('0xa'))(new Redis(config[_0x3993('0x8')]));require(_0x3993('0xb'))[_0x3993('0xc')](socket);function respondWithRpcPromise(_0x550c32,_0x4995c7,_0x3f8ec9){return new BPromise(function(_0x209f83,_0x2d8ade){return client['request'](_0x550c32,_0x3f8ec9)[_0x3993('0xd')](function(_0x2bb278){logger[_0x3993('0xe')]('ChatGroup,\x20%s,\x20%s',_0x4995c7,_0x3993('0xf'));logger[_0x3993('0x10')](_0x3993('0x11'),_0x4995c7,_0x3993('0xf'),JSON[_0x3993('0x12')](_0x2bb278));if(_0x2bb278[_0x3993('0x13')]){if(_0x2bb278[_0x3993('0x13')][_0x3993('0x14')]===0x1f4){logger['error'](_0x3993('0x15'),_0x4995c7,_0x2bb278[_0x3993('0x13')]['message']);return _0x2d8ade(_0x2bb278[_0x3993('0x13')][_0x3993('0x16')]);}logger[_0x3993('0x13')]('ChatGroup,\x20%s,\x20%s',_0x4995c7,_0x2bb278[_0x3993('0x13')][_0x3993('0x16')]);return _0x209f83(_0x2bb278[_0x3993('0x13')]['message']);}else{logger[_0x3993('0xe')](_0x3993('0x15'),_0x4995c7,_0x3993('0xf'));_0x209f83(_0x2bb278[_0x3993('0x17')][_0x3993('0x16')]);}})[_0x3993('0x18')](function(_0xcd5761){logger[_0x3993('0x13')](_0x3993('0x15'),_0x4995c7,_0xcd5761);_0x2d8ade(_0xcd5761);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 365050f..704b817 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 _0x5ce9=['remove','length','chatGroup:','save'];(function(_0x27259d,_0x20b590){var _0x4c41fc=function(_0x447762){while(--_0x447762){_0x27259d['push'](_0x27259d['shift']());}};_0x4c41fc(++_0x20b590);}(_0x5ce9,0xd7));var _0x95ce=function(_0x49e4c6,_0x5ea169){_0x49e4c6=_0x49e4c6-0x0;var _0x2bacd7=_0x5ce9[_0x49e4c6];return _0x2bacd7;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x95ce('0x0'),_0x95ce('0x1'),'update'];function createListener(_0x1f4b8e,_0x1bfd40){return function(_0x1ec090){_0x1bfd40['emit'](_0x1f4b8e,_0x1ec090);};}function removeListener(_0x425376,_0x450965){return function(){ChatGroupEvents['removeListener'](_0x425376,_0x450965);};}exports['register']=function(_0x1ae7f1){for(var _0x7b378d=0x0,_0x1a2bfc=events[_0x95ce('0x2')];_0x7b378d<_0x1a2bfc;_0x7b378d++){var _0x469948=events[_0x7b378d];var _0x5b4e40=createListener(_0x95ce('0x3')+_0x469948,_0x1ae7f1);ChatGroupEvents['on'](_0x469948,_0x5b4e40);}}; \ No newline at end of file +var _0x1fc0=['save','remove','update','emit','length','chatGroup:'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x1fc0,0x1ce));var _0x01fc=function(_0x1b97fc,_0x1d4e89){_0x1b97fc=_0x1b97fc-0x0;var _0x17fa2c=_0x1fc0[_0x1b97fc];return _0x17fa2c;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x01fc('0x0'),_0x01fc('0x1'),_0x01fc('0x2')];function createListener(_0x2544da,_0x497374){return function(_0x321896){_0x497374[_0x01fc('0x3')](_0x2544da,_0x321896);};}function removeListener(_0x32901e,_0xcea12d){return function(){ChatGroupEvents['removeListener'](_0x32901e,_0xcea12d);};}exports['register']=function(_0x77a806){for(var _0x4af92c=0x0,_0x14b893=events[_0x01fc('0x4')];_0x4af92c<_0x14b893;_0x4af92c++){var _0x4cccd4=events[_0x4af92c];var _0x4d746f=createListener(_0x01fc('0x5')+_0x4cccd4,_0x77a806);ChatGroupEvents['on'](_0x4cccd4,_0x4d746f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ce658bb..62d0c3b 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 _0xad60=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id/unread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','put','/:id','update','delete','destroy','removeMembers'];(function(_0x250807,_0x291679){var _0x20ea15=function(_0x512ed2){while(--_0x512ed2){_0x250807['push'](_0x250807['shift']());}};_0x20ea15(++_0x291679);}(_0xad60,0x1a5));var _0x0ad6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xad60[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x0ad6('0x0'));var util=require(_0x0ad6('0x1'));var path=require(_0x0ad6('0x2'));var timeout=require(_0x0ad6('0x3'));var express=require(_0x0ad6('0x4'));var router=express[_0x0ad6('0x5')]();var fs_extra=require(_0x0ad6('0x6'));var auth=require(_0x0ad6('0x7'));var interaction=require(_0x0ad6('0x8'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x0ad6('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ad6('0xa')]);router[_0x0ad6('0x9')](_0x0ad6('0xb'),auth[_0x0ad6('0xc')](),controller['describe']);router[_0x0ad6('0x9')]('/:id',auth[_0x0ad6('0xc')](),controller['show']);router[_0x0ad6('0x9')](_0x0ad6('0xd'),auth['isAuthenticated'](),controller['getUnread']);router[_0x0ad6('0x9')]('/:id/members',auth[_0x0ad6('0xc')](),controller[_0x0ad6('0xe')]);router[_0x0ad6('0x9')](_0x0ad6('0xf'),auth[_0x0ad6('0xc')](),controller[_0x0ad6('0x10')]);router[_0x0ad6('0x11')]('/',auth[_0x0ad6('0xc')](),controller[_0x0ad6('0x12')]);router['post'](_0x0ad6('0x13'),auth[_0x0ad6('0xc')](),controller[_0x0ad6('0x14')]);router[_0x0ad6('0x11')](_0x0ad6('0xf'),auth[_0x0ad6('0xc')](),controller['addMessage']);router[_0x0ad6('0x15')](_0x0ad6('0x16'),auth['isAuthenticated'](),controller[_0x0ad6('0x17')]);router[_0x0ad6('0x18')](_0x0ad6('0x16'),auth[_0x0ad6('0xc')](),controller[_0x0ad6('0x19')]);router[_0x0ad6('0x18')](_0x0ad6('0x13'),auth[_0x0ad6('0xc')](),controller[_0x0ad6('0x1a')]);module[_0x0ad6('0x1b')]=router; \ No newline at end of file +var _0x71a0=['/describe','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','put','update','destroy','delete','removeMembers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x149db1,_0x2d8ec7){var _0x2ba4f5=function(_0x5f2e48){while(--_0x5f2e48){_0x149db1['push'](_0x149db1['shift']());}};_0x2ba4f5(++_0x2d8ec7);}(_0x71a0,0xe9));var _0x071a=function(_0x281820,_0x47572b){_0x281820=_0x281820-0x0;var _0x2d05f6=_0x71a0[_0x281820];return _0x2d05f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x071a('0x0'));var timeout=require(_0x071a('0x1'));var express=require(_0x071a('0x2'));var router=express[_0x071a('0x3')]();var fs_extra=require(_0x071a('0x4'));var auth=require(_0x071a('0x5'));var interaction=require(_0x071a('0x6'));var config=require(_0x071a('0x7'));var controller=require('./chatGroup.controller');router[_0x071a('0x8')]('/',auth[_0x071a('0x9')](),controller['index']);router[_0x071a('0x8')](_0x071a('0xa'),auth[_0x071a('0x9')](),controller[_0x071a('0xb')]);router[_0x071a('0x8')](_0x071a('0xc'),auth[_0x071a('0x9')](),controller['show']);router[_0x071a('0x8')](_0x071a('0xd'),auth[_0x071a('0x9')](),controller[_0x071a('0xe')]);router['get'](_0x071a('0xf'),auth[_0x071a('0x9')](),controller[_0x071a('0x10')]);router['get'](_0x071a('0x11'),auth[_0x071a('0x9')](),controller[_0x071a('0x12')]);router[_0x071a('0x13')]('/',auth[_0x071a('0x9')](),controller['create']);router['post'](_0x071a('0xf'),auth[_0x071a('0x9')](),controller[_0x071a('0x14')]);router[_0x071a('0x13')](_0x071a('0x11'),auth['isAuthenticated'](),controller['addMessage']);router[_0x071a('0x15')](_0x071a('0xc'),auth[_0x071a('0x9')](),controller[_0x071a('0x16')]);router['delete'](_0x071a('0xc'),auth[_0x071a('0x9')](),controller[_0x071a('0x17')]);router[_0x071a('0x18')](_0x071a('0xf'),auth[_0x071a('0x9')](),controller[_0x071a('0x19')]);module[_0x071a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4f7c8fd..2b2ada4 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 _0x3c0d=['DATE','long','out','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x1eef3f,_0x2d48c5){var _0x29e3f5=function(_0x5a4c06){while(--_0x5a4c06){_0x1eef3f['push'](_0x1eef3f['shift']());}};_0x29e3f5(++_0x2d48c5);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x38c536,_0x111f5a){_0x38c536=_0x38c536-0x0;var _0x4de55b=_0x3c0d[_0x38c536];return _0x4de55b;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd3c0('0x0')]},'ratingType':{'type':Sequelize[_0xd3c0('0x1')](_0xd3c0('0x2'),_0xd3c0('0x3')),'defaultValue':_0xd3c0('0x2')},'ratingMessage':{'type':Sequelize[_0xd3c0('0x4')]},'pathTranscript':{'type':Sequelize[_0xd3c0('0x4')]},'mailTranscript':{'type':Sequelize[_0xd3c0('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd3c0('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd3c0('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd3c0('0x5')]},'browserName':{'type':Sequelize[_0xd3c0('0x5')]},'browserVersion':{'type':Sequelize[_0xd3c0('0x5')]},'osName':{'type':Sequelize[_0xd3c0('0x5')]},'osVersion':{'type':Sequelize[_0xd3c0('0x5')]},'deviceModel':{'type':Sequelize[_0xd3c0('0x5')]},'deviceVendor':{'type':Sequelize[_0xd3c0('0x5')]},'deviceType':{'type':Sequelize[_0xd3c0('0x5')]},'referer':{'type':Sequelize[_0xd3c0('0x4')]},'customerIp':{'type':Sequelize[_0xd3c0('0x5')]},'formData':{'type':Sequelize['TEXT'](_0xd3c0('0x7'))},'read1stAt':{'type':Sequelize[_0xd3c0('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd3c0('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd3c0('0x5')]},'customerPort':{'type':Sequelize[_0xd3c0('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xd3c0('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbaf0=['out','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x2e7508,_0x3f915a){var _0x1b9bf9=function(_0x42b239){while(--_0x42b239){_0x2e7508['push'](_0x2e7508['shift']());}};_0x1b9bf9(++_0x3f915a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'closed':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0baf('0x2')]},'ratingType':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x4'),_0x0baf('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x0baf('0x6')]},'pathTranscript':{'type':Sequelize[_0x0baf('0x6')]},'mailTranscript':{'type':Sequelize[_0x0baf('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0baf('0x8')]},'disposition':{'type':Sequelize[_0x0baf('0x7')]},'secondDisposition':{'type':Sequelize[_0x0baf('0x7')]},'thirdDisposition':{'type':Sequelize[_0x0baf('0x7')]},'note':{'type':Sequelize[_0x0baf('0x7')]},'browserName':{'type':Sequelize[_0x0baf('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x0baf('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x0baf('0x7')]},'deviceVendor':{'type':Sequelize[_0x0baf('0x7')]},'deviceType':{'type':Sequelize[_0x0baf('0x7')]},'referer':{'type':Sequelize[_0x0baf('0x6')]},'customerIp':{'type':Sequelize[_0x0baf('0x7')]},'formData':{'type':Sequelize[_0x0baf('0x6')](_0x0baf('0x9'))},'read1stAt':{'type':Sequelize[_0x0baf('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x3')]('in',_0x0baf('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x0baf('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 403fab8..39e7ecf 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 _0x1243=['now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','UserId','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','System','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','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','length','nolimit','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','push','addTags','spread','Tag','color','chatInteractionTags:save','removeTags','toString','files','tmp','server','transcript-%d-%s.zip','firstName','lastName','attachments','direction','read','Owner','get','mkdirSync','Account','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','value','views','transcript-','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','end','stack','name','send','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','type','key','findAll','query','user','params','model','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','update','body','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format'];(function(_0x1c04c3,_0x50e158){var _0x36d86d=function(_0x533a01){while(--_0x533a01){_0x1c04c3['push'](_0x1c04c3['shift']());}};_0x36d86d(++_0x50e158);}(_0x1243,0x128));var _0x3124=function(_0x2288bd,_0x4a7e82){_0x2288bd=_0x2288bd-0x0;var _0x467464=_0x1243[_0x2288bd];return _0x467464;};'use strict';var rimraf=require(_0x3124('0x0'));var zipdir=require(_0x3124('0x1'));var rp=require(_0x3124('0x2'));var moment=require('moment');var BPromise=require(_0x3124('0x3'));var Mustache=require(_0x3124('0x4'));var util=require(_0x3124('0x5'));var path=require(_0x3124('0x6'));var ejs=require(_0x3124('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x3124('0x8'));var interaction=require(_0x3124('0x9'));var qs=require(_0x3124('0xa'));var pdf=require(_0x3124('0xb'));var logger=require('../../config/logger')(_0x3124('0xc'));var config=require(_0x3124('0xd'));var db=require(_0x3124('0xe'))['db'];config[_0x3124('0xf')]=_[_0x3124('0x10')](config[_0x3124('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x3124('0x11'))(new Redis(config[_0x3124('0xf')]));require(_0x3124('0x12'))['register'](socket);var jayson=require(_0x3124('0x13'));var client=jayson[_0x3124('0x14')][_0x3124('0x15')]({'port':0x232b});var client9004=jayson[_0x3124('0x14')][_0x3124('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x4f0b85,_0x5e71fd,_0x473c4e,_0x174172){return new BPromise(function(_0x35c133,_0x4bf358){var _0x48edf8=_0x174172||client;return _0x48edf8['request'](_0x4f0b85,_0x473c4e)[_0x3124('0x16')](function(_0x4b05cd){logger[_0x3124('0x17')](_0x3124('0x18'),_0x5e71fd,_0x3124('0x19'));logger[_0x3124('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5e71fd,'request\x20sent',JSON[_0x3124('0x1b')](_0x4b05cd));if(_0x4b05cd['error']){if(_0x4b05cd[_0x3124('0x1c')][_0x3124('0x1d')]===0x1f4){logger[_0x3124('0x1c')](_0x3124('0x18'),_0x5e71fd,_0x4b05cd[_0x3124('0x1c')][_0x3124('0x1e')]);return _0x4bf358(_0x4b05cd[_0x3124('0x1c')][_0x3124('0x1e')]);}logger[_0x3124('0x1c')](_0x3124('0x18'),_0x5e71fd,_0x4b05cd['error'][_0x3124('0x1e')]);return _0x35c133(_0x4b05cd[_0x3124('0x1c')][_0x3124('0x1e')]);}else{logger[_0x3124('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x5e71fd,'request\x20sent');_0x35c133(_0x4b05cd[_0x3124('0x1f')][_0x3124('0x1e')]);}})[_0x3124('0x20')](function(_0x33cdbb){logger[_0x3124('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x5e71fd,_0x33cdbb);_0x4bf358(_0x33cdbb);});});}function respondWithStatusCode(_0x257004,_0xa63e34){_0xa63e34=_0xa63e34||0xcc;return function(_0x597a99){if(_0x597a99){return _0x257004[_0x3124('0x21')](_0xa63e34);}return _0x257004[_0x3124('0x22')](_0xa63e34)['end']();};}function respondWithResult(_0x4671a5,_0x2fcb1a){_0x2fcb1a=_0x2fcb1a||0xc8;return function(_0x3fb48a){if(_0x3fb48a){return _0x4671a5[_0x3124('0x22')](_0x2fcb1a)['json'](_0x3fb48a);}};}function respondWithFilteredResult(_0x5d85dc,_0x1bff52){return function(_0x15f2fc){if(_0x15f2fc){var _0x1d196a=typeof _0x1bff52[_0x3124('0x23')]===_0x3124('0x24')&&typeof _0x1bff52[_0x3124('0x25')]===_0x3124('0x24');var _0x334bc8=_0x15f2fc['count'];var _0x6054c9=_0x1d196a?0x0:_0x1bff52[_0x3124('0x23')];var _0x4ea3c2=_0x1d196a?_0x15f2fc[_0x3124('0x26')]:_0x1bff52[_0x3124('0x23')]+_0x1bff52[_0x3124('0x25')];var _0x4b36bb;if(_0x4ea3c2>=_0x334bc8){_0x4ea3c2=_0x334bc8;_0x4b36bb=0xc8;}else{_0x4b36bb=0xce;}_0x5d85dc['status'](_0x4b36bb);return _0x5d85dc[_0x3124('0x27')]('Content-Range',_0x6054c9+'-'+_0x4ea3c2+'/'+_0x334bc8)[_0x3124('0x28')](_0x15f2fc);}return null;};}function saveUpdates(_0x49c574){return function(_0x56b138){if(_0x56b138){return _0x56b138['update'](_0x49c574)[_0x3124('0x16')](function(_0x42339e){return _0x42339e;});}return null;};}function removeEntity(_0x5d0a46){return function(_0xc04a1b){if(_0xc04a1b){return _0xc04a1b['destroy']()[_0x3124('0x16')](function(){_0x5d0a46[_0x3124('0x22')](0xcc)[_0x3124('0x29')]();});}};}function handleEntityNotFound(_0x40f7f8){return function(_0x1b9b91){if(!_0x1b9b91){_0x40f7f8[_0x3124('0x21')](0x194);}return _0x1b9b91;};}function handleError(_0x2864d8,_0x20971b){_0x20971b=_0x20971b||0x1f4;return function(_0x178fab){logger[_0x3124('0x1c')](_0x178fab[_0x3124('0x2a')]);if(_0x178fab[_0x3124('0x2b')]){delete _0x178fab[_0x3124('0x2b')];}_0x2864d8['status'](_0x20971b)[_0x3124('0x2c')](_0x178fab);};}function getMustacheRender(_0x513564,_0x2cbf38){return Mustache[_0x3124('0x2d')](_0x513564,_[_0x3124('0x2e')](_0x2cbf38['body'],{'contact':_0x2cbf38[_0x3124('0x2f')],'message':_0x2cbf38[_0x3124('0x1e')],'agent':_0x2cbf38[_0x3124('0x30')],'interaction':_0x2cbf38[_0x3124('0x31')],'account':_0x2cbf38[_0x3124('0x32')]}))||'';}exports[_0x3124('0x33')]=function(_0x3dade8,_0x381dd6){var _0xce55b6={};var _0x328462=_[_0x3124('0x34')](db[_0x3124('0x35')][_0x3124('0x36')],function(_0x87afae){return{'name':_0x87afae['fieldName'],'type':_0x87afae[_0x3124('0x37')][_0x3124('0x38')]};});_0xce55b6=qs['getOptions'](_0x328462,_0x3dade8);return interaction[_0x3124('0x39')]('chat',_0x3dade8[_0x3124('0x3a')],_0x3dade8[_0x3124('0x3b')],_0xce55b6,_0x328462)['then'](respondWithFilteredResult(_0x381dd6,_0xce55b6))[_0x3124('0x20')](handleError(_0x381dd6,null));};exports['show']=function(_0x5c80cd,_0x1663bd){var _0x4a5288={'raw':![],'where':{'id':_0x5c80cd[_0x3124('0x3c')]['id']}},_0x3c1324={};_0x3c1324[_0x3124('0x3d')]=_[_0x3124('0x3e')](db['ChatInteraction'][_0x3124('0x36')]);_0x3c1324['query']=_[_0x3124('0x3e')](_0x5c80cd[_0x3124('0x3a')]);_0x3c1324[_0x3124('0x3f')]=_[_0x3124('0x40')](_0x3c1324[_0x3124('0x3d')],_0x3c1324['query']);_0x4a5288[_0x3124('0x41')]=_['intersection'](_0x3c1324[_0x3124('0x3d')],qs[_0x3124('0x42')](_0x5c80cd[_0x3124('0x3a')]['fields']));_0x4a5288[_0x3124('0x41')]=_0x4a5288[_0x3124('0x41')]['length']?_0x4a5288[_0x3124('0x41')]:_0x3c1324['model'];if(_0x5c80cd['query'][_0x3124('0x43')]){_0x4a5288[_0x3124('0x44')]=[{'all':!![]}];}_0x4a5288=_[_0x3124('0x2e')]({},_0x4a5288,_0x5c80cd[_0x3124('0x45')]);return db[_0x3124('0x35')][_0x3124('0x46')](_0x4a5288)[_0x3124('0x16')](handleEntityNotFound(_0x1663bd,null))['then'](respondWithResult(_0x1663bd,null))['catch'](handleError(_0x1663bd,null));};exports['create']=function(_0x4ed6d5,_0x571c5d){return db[_0x3124('0x35')][_0x3124('0x47')](_0x4ed6d5['body'],{})[_0x3124('0x16')](respondWithResult(_0x571c5d,0xc9))[_0x3124('0x20')](handleError(_0x571c5d,null));};exports[_0x3124('0x48')]=function(_0x11e5d6,_0x532317){if(_0x11e5d6[_0x3124('0x49')]['id']){delete _0x11e5d6[_0x3124('0x49')]['id'];}return db['ChatInteraction'][_0x3124('0x46')]({'where':{'id':_0x11e5d6[_0x3124('0x3c')]['id']}})[_0x3124('0x16')](handleEntityNotFound(_0x532317,null))[_0x3124('0x16')](saveUpdates(_0x11e5d6['body'],null))[_0x3124('0x16')](respondWithResult(_0x532317,null))['catch'](handleError(_0x532317,null));};exports[_0x3124('0x4a')]=function(_0x1aa123,_0x290124){return db[_0x3124('0x35')][_0x3124('0x46')]({'where':{'id':_0x1aa123['params']['id']}})[_0x3124('0x16')](handleEntityNotFound(_0x290124,null))[_0x3124('0x16')](removeEntity(_0x290124,null))['catch'](handleError(_0x290124,null));};exports[_0x3124('0x4b')]=function(_0x4ed3b1,_0x104288){return db[_0x3124('0x35')][_0x3124('0x4b')]()['then'](respondWithResult(_0x104288,null))[_0x3124('0x20')](handleError(_0x104288,null));};exports[_0x3124('0x4c')]=function(_0x5ee062,_0x1ebc2f){var _0x510065=_0x5ee062[_0x3124('0x3c')]['id'];var _0x598587;var _0x5135f6;var _0x20669a;return db['ChatInteraction'][_0x3124('0x4d')]({'where':{'id':_0x510065}})[_0x3124('0x16')](function(_0x2457eb){_0x598587=_0x2457eb;return db[_0x3124('0x4e')][_0x3124('0x4d')]({'where':{'id':_0x2457eb[_0x3124('0x4f')]},'attributes':['id',_0x3124('0x50'),_0x3124('0x51'),_0x3124('0x52'),_0x3124('0x53'),_0x3124('0x54')],'raw':!![]});})[_0x3124('0x16')](function(_0x389015){if(_0x389015&&_0x389015[_0x3124('0x50')]&&_0x389015[_0x3124('0x51')]){_0x5135f6=_0x389015;var _0x4df6af={'interaction':{'id':_0x510065},'agent':{'id':_0x5ee062['user']['id'],'name':_0x5ee062['user'][_0x3124('0x2b')],'fullname':_0x5ee062[_0x3124('0x3b')]['fullname'],'email':_0x5ee062[_0x3124('0x3b')][_0x3124('0x55')]},'contact':_0x5ee062[_0x3124('0x49')]['contact'],'account':_0x5ee062[_0x3124('0x49')][_0x3124('0x32')]};var _0x5bf47c={'rejectUnauthorized':![],'method':'POST','url':_0x3124('0x56'),'headers':{'X-APIKEY':_0x389015[_0x3124('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5ee062[_0x3124('0x3b')]['email']],'buttons':null,'topic':_0x5135f6['vidaooTopic'],'note':_['isNull'](_0x5135f6[_0x3124('0x53')])?null:getMustacheRender(_0x5135f6['vidaooNote'],_0x4df6af),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x3124('0x57')](_0x5135f6[_0x3124('0x54')])){var _0x478fbc=getMustacheRender(_0x5135f6[_0x3124('0x54')],_0x4df6af);var _0x5ce580=JSON[_0x3124('0x58')](_0x478fbc);_0x5bf47c[_0x3124('0x49')][_0x3124('0x59')]=_0x5ce580;}}catch(_0x1216ac){throw new db[(_0x3124('0x5a'))][(_0x3124('0x5b'))](_0x3124('0x5c'));}return rp(_0x5bf47c);}else{throw new db[(_0x3124('0x5a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x32ecab){_0x20669a=_0x32ecab;if(_0x20669a['id']){var _0x59c556={'body':_0x20669a[_0x3124('0x5d')],'ChatWebsiteId':_0x5135f6['id'],'ChatInteractionId':_0x598587['id'],'direction':'out','UserId':_0x5ee062[_0x3124('0x3b')]['id']};return db[_0x3124('0x5e')][_0x3124('0x47')](_0x59c556,{});}else{throw new db[(_0x3124('0x5a'))][(_0x3124('0x5b'))](_0x3124('0x5f'));}})[_0x3124('0x16')](function(){return _0x598587[_0x3124('0x60')]({'vidaooSessionId':_0x20669a['id']});})[_0x3124('0x16')](respondWithResult(_0x1ebc2f,null))['catch'](handleError(_0x1ebc2f,null));};exports[_0x3124('0x61')]=function(_0x1d94d0,_0x4d6be9){if(_0x1d94d0[_0x3124('0x49')]['id']){delete _0x1d94d0[_0x3124('0x49')]['id'];}return db[_0x3124('0x35')]['find']({'where':{'id':_0x1d94d0[_0x3124('0x3c')]['id']},'include':[{'model':db[_0x3124('0x62')],'as':_0x3124('0x63')}]})[_0x3124('0x16')](handleEntityNotFound(_0x4d6be9,null))[_0x3124('0x16')](saveUpdates(_0x1d94d0[_0x3124('0x49')],null))[_0x3124('0x16')](respondWithResult(_0x4d6be9,null))[_0x3124('0x20')](handleError(_0x4d6be9,null));};exports[_0x3124('0x64')]=function(_0x235274,_0x35713c){if(_0x235274[_0x3124('0x49')]['id']){delete _0x235274[_0x3124('0x49')]['id'];}return db[_0x3124('0x35')][_0x3124('0x46')]({'where':{'id':_0x235274[_0x3124('0x3c')]['id']}})[_0x3124('0x16')](function(_0x2f314c){if(!_0x2f314c){logger[_0x3124('0x1c')](_0x3124('0x65'),_0x3124('0x64'),0x194,'entity\x20not\x20found');_0x35713c['sendStatus'](0x194);}else{if(_0x2f314c['UserId']){throw new db[(_0x3124('0x5a'))][(_0x3124('0x5b'))]('Interaction\x20already\x20assigned');}}return _0x2f314c;})['then'](function(_0x2effe0){if(_0x2effe0){return _0x2effe0[_0x3124('0x48')]({'closed':_0x235274[_0x3124('0x49')]['closed'],'disposition':_0x235274[_0x3124('0x49')][_0x3124('0x66')]})[_0x3124('0x16')](function(_0x82d209){return _0x82d209;});}})['then'](function(){return respondWithRpcPromise(_0x3124('0x67'),_0x3124('0x64'),_0x235274[_0x3124('0x49')],client9004);})['then'](respondWithResult(_0x35713c,null))[_0x3124('0x20')](handleError(_0x35713c,null));};exports[_0x3124('0x68')]=function(_0x2384de,_0x59e627){_0x2384de[_0x3124('0x49')][_0x3124('0x2b')]=_0x2384de['file'][_0x3124('0x69')];_0x2384de[_0x3124('0x49')][_0x3124('0x6a')]=_0x2384de[_0x3124('0x6b')][_0x3124('0x6c')];_0x2384de['body'][_0x3124('0x37')]=_0x2384de['file'][_0x3124('0x6d')];return db[_0x3124('0x6e')][_0x3124('0x47')](_0x2384de['body'])['then'](respondWithResult(_0x59e627,0xc9))['catch'](handleError(_0x59e627,null));};exports[_0x3124('0x6f')]=function(_0x525a67,_0x3280ca){return db[_0x3124('0x35')][_0x3124('0x4d')]({'where':{'id':_0x525a67[_0x3124('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3280ca,null))[_0x3124('0x16')](function(_0x22c3b4){if(_0x22c3b4){if(_0x22c3b4[_0x3124('0x70')]){return _0x3280ca[_0x3124('0x22')](0x193)[_0x3124('0x28')]({'status':0x193,'message':_0x3124('0x71')});}return db['Attachment'][_0x3124('0x4d')]({'where':{'id':_0x525a67[_0x3124('0x3a')][_0x3124('0x72')]},'raw':!![]})[_0x3124('0x16')](handleEntityNotFound(_0x3280ca,null));}})['then'](function(_0x2fc29b){if(_0x2fc29b){var _0x58e2e3=_0x2fc29b['ChatOfflineMessageId']!==null;var _0x325acf=path['join'](config['root'],_0x3124('0x73'));if(_0x58e2e3){_0x325acf=path[_0x3124('0x74')](_0x325acf,_0x3124('0x75'));}var _0x290c75=path[_0x3124('0x74')](_0x325acf,_0x2fc29b[_0x3124('0x6a')]);return _0x3280ca[_0x3124('0x76')](_0x290c75);}})[_0x3124('0x20')](handleError(_0x3280ca,null));};exports[_0x3124('0x77')]=function(_0x503c3b,_0xd9d513){var _0xb8358b=null;var _0xbabe28=null;var _0x27e6d2=null;if(_0x503c3b[_0x3124('0x49')]['id']){delete _0x503c3b[_0x3124('0x49')]['id'];}if(_0x503c3b[_0x3124('0x49')][_0x3124('0x78')]){_0x27e6d2=path['join'](config[_0x3124('0x79')],_0x3124('0x7a'),util[_0x3124('0x7b')]('transcript-%s.txt',Date[_0x3124('0x7c')]()));_0x503c3b[_0x3124('0x49')][_0x3124('0x7d')]=_0x27e6d2;}return db['ChatInteraction']['find']({'where':{'id':_0x503c3b[_0x3124('0x3c')]['id']},'include':[{'model':db[_0x3124('0x5e')],'as':_0x3124('0x7e'),'include':[{'model':db[_0x3124('0x7f')],'as':'User'}]}]})[_0x3124('0x16')](handleEntityNotFound(_0xd9d513,null))[_0x3124('0x16')](saveUpdates(_0x503c3b['body'],null))[_0x3124('0x16')](function(_0x5ed67f){if(_0x5ed67f){_0xb8358b=_0x5ed67f;return db[_0x3124('0x4e')][_0x3124('0x46')]({'where':{'id':_0xb8358b[_0x3124('0x4f')]}});}})[_0x3124('0x16')](function(_0x3a55dc){if(_0x3a55dc){_0xbabe28=_0x3a55dc;return db[_0x3124('0x62')][_0x3124('0x46')]({'where':{'id':_0xb8358b[_0x3124('0x80')]}});}})[_0x3124('0x16')](function(_0x2844de){if(_0x2844de){if(_0x27e6d2){var _0x14b764=null;for(var _0x12a91b=0x1;_0x12a91b<_0xb8358b[_0x3124('0x7e')]['length'];++_0x12a91b){_0x14b764=_0xb8358b[_0x3124('0x7e')][_0x12a91b];var _0x48c08d=_0x14b764['UserId']?util[_0x3124('0x7b')](_0x3124('0x81'),_0xbabe28[_0x3124('0x82')],_0x14b764[_0x3124('0x83')]):'System';var _0x4ca9ed=_0x503c3b[_0x3124('0x49')][_0x3124('0x84')]||util[_0x3124('0x7b')]('%s%d',_0x3124('0x85'),_0x14b764[_0x3124('0x80')]);switch(_0xbabe28[_0x3124('0x86')]){case _0x3124('0x87'):_0x48c08d=_0x14b764[_0x3124('0x83')]?util[_0x3124('0x7b')](_0x3124('0x81'),_0xbabe28['agentAlias'],_0x14b764[_0x3124('0x83')]):'System';break;case _0x3124('0x88'):_0x48c08d=_0x14b764[_0x3124('0x83')]?_0x14b764[_0x3124('0x7f')][_0x3124('0x89')]||_0x14b764[_0x3124('0x7f')][_0x3124('0x8a')]:'System';break;case _0x3124('0x8b'):_0x48c08d=_0x14b764[_0x3124('0x83')]?_0x14b764['User']['fullname']:_0x3124('0x8c');break;default:_0x48c08d=_0x14b764['UserId']?util[_0x3124('0x7b')](_0x3124('0x81'),_0xbabe28[_0x3124('0x82')],_0x14b764[_0x3124('0x83')]):_0x3124('0x8c');}var _0x3b2815=util['format'](_0x3124('0x8d'),moment(_0x14b764[_0x3124('0x8e')])['format'](_0x3124('0x8f')),_0x14b764['direction']==='in'?_0x4ca9ed:_0x48c08d,_0x14b764[_0x3124('0x49')]);if(!_0x14b764[_0x3124('0x90')]){fs[_0x3124('0x91')](_0x27e6d2,_0x3b2815);}}return db[_0x3124('0x92')][_0x3124('0x4d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x3124('0x93'),'raw':!![],'include':[{'model':db[_0x3124('0x94')],'as':_0x3124('0x94'),'raw':!![]}]}]});}}})[_0x3124('0x16')](function(_0x147a3a){if(!_0x147a3a||!_0x147a3a[_0x3124('0x93')]||!_0x503c3b[_0x3124('0x49')])return _0xb8358b;var _0x177e54=_0x147a3a[_0x3124('0x95')]();return respondWithRpcPromise(_0x3124('0x96'),_0x3124('0x97'),{'account':_0x177e54,'message':{'from':util['format'](_0x3124('0x98'),_0x147a3a[_0x3124('0x2b')],_0x147a3a[_0x3124('0x55')]||_0x147a3a[_0x3124('0x93')][_0x3124('0x3b')]),'to':_0x503c3b[_0x3124('0x49')][_0x3124('0x78')],'subject':_0x3124('0x99'),'text':util['format'](_0x3124('0x9a'),_0x503c3b[_0x3124('0x49')][_0x3124('0x78')]),'attachments':[{'path':_0x27e6d2}]}})['then'](function(){return _0xb8358b;})[_0x3124('0x20')](function(_0x2bfd4f){logger[_0x3124('0x1c')](_0x2bfd4f);});})[_0x3124('0x16')](respondWithStatusCode(_0xd9d513,0xc8))[_0x3124('0x20')](handleError(_0xd9d513,null));};exports[_0x3124('0x9b')]=function(_0x4116f4,_0x3dc13d){return db['ChatMessage']['find']({'where':{'id':_0x4116f4[_0x3124('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3dc13d,null))[_0x3124('0x16')](function(_0x32b9fc){if(_0x32b9fc){return _0x32b9fc[_0x3124('0x9b')](_0x4116f4[_0x3124('0x49')][_0x3124('0x9c')],_[_0x3124('0x9d')](_0x4116f4[_0x3124('0x49')],[_0x3124('0x9c'),'id'])||{});}})['then'](respondWithResult(_0x3dc13d,null))[_0x3124('0x20')](handleError(_0x3dc13d,null));};exports['getMessages']=function(_0x6b5752,_0x350d54){var _0x5cd96d={'raw':![],'where':{}};var _0x36e8ea={};var _0x1ed325={'count':0x0,'rows':[]};return db[_0x3124('0x35')]['findOne']({'where':{'id':_0x6b5752[_0x3124('0x3c')]['id']}})[_0x3124('0x16')](handleEntityNotFound(_0x350d54,null))['then'](function(_0x1cd4ab){if(_0x1cd4ab){_0x36e8ea[_0x3124('0x3d')]=_[_0x3124('0x3e')](db['ChatMessage'][_0x3124('0x36')]);_0x36e8ea[_0x3124('0x3a')]=_['keys'](_0x6b5752['query']);_0x36e8ea['filters']=_[_0x3124('0x40')](_0x36e8ea[_0x3124('0x3d')],_0x36e8ea['query']);_0x5cd96d[_0x3124('0x41')]=_[_0x3124('0x40')](_0x36e8ea[_0x3124('0x3d')],qs[_0x3124('0x42')](_0x6b5752[_0x3124('0x3a')][_0x3124('0x42')]));_0x5cd96d['attributes']=_0x5cd96d['attributes'][_0x3124('0x9e')]?_0x5cd96d[_0x3124('0x41')]:_0x36e8ea[_0x3124('0x3d')];if(!_0x6b5752[_0x3124('0x3a')]['hasOwnProperty'](_0x3124('0x9f'))){_0x5cd96d[_0x3124('0x25')]=qs[_0x3124('0x25')](_0x6b5752[_0x3124('0x3a')][_0x3124('0x25')]);_0x5cd96d[_0x3124('0x23')]=qs[_0x3124('0x23')](_0x6b5752[_0x3124('0x3a')][_0x3124('0x23')]);}_0x5cd96d[_0x3124('0xa0')]=qs[_0x3124('0xa1')](_0x6b5752[_0x3124('0x3a')][_0x3124('0xa1')]);_0x5cd96d['where']=qs[_0x3124('0x3f')](_[_0x3124('0xa2')](_0x6b5752[_0x3124('0x3a')],_0x36e8ea[_0x3124('0x3f')]));_0x5cd96d[_0x3124('0xa3')][_0x3124('0xa4')]=_0x1cd4ab['id'];if(_0x6b5752[_0x3124('0x3a')][_0x3124('0xa5')]){_0x5cd96d[_0x3124('0xa3')]=_[_0x3124('0x2e')](_0x5cd96d[_0x3124('0xa3')],{'$or':_[_0x3124('0x34')](_0x5cd96d[_0x3124('0x41')],function(_0x3ec717){var _0x2d023b={};_0x2d023b[_0x3ec717]={'$like':'%'+_0x6b5752[_0x3124('0x3a')]['filter']+'%'};return _0x2d023b;})});}if(_0x6b5752[_0x3124('0x3a')][_0x3124('0xa6')]){var _0x3d7507=_0x6b5752[_0x3124('0x3a')][_0x3124('0xa6')][_0x3124('0xa7')](',');var _0x29fc55={};_0x29fc55[_0x3d7507[0x0]]={'$gte':moment(_0x3d7507[0x1])[_0x3124('0x7b')](_0x3124('0xa8'))};_0x5cd96d['where']=_[_0x3124('0x2e')](_0x5cd96d[_0x3124('0xa3')],_0x29fc55);}_0x5cd96d=_[_0x3124('0x2e')]({},_0x5cd96d,_0x6b5752['options']);return db[_0x3124('0x5e')][_0x3124('0x26')]({'where':_0x5cd96d[_0x3124('0xa3')]})[_0x3124('0x16')](function(_0x2846ae){_0x1ed325['count']=_0x2846ae;if(_0x6b5752[_0x3124('0x3a')][_0x3124('0x43')]){_0x5cd96d[_0x3124('0x44')]=[{'all':!![]}];}return db[_0x3124('0x5e')][_0x3124('0x39')](_0x5cd96d);})['then'](function(_0x8a9767){_0x1ed325[_0x3124('0xa9')]=_0x8a9767;return _0x1ed325;});}})['then'](respondWithFilteredResult(_0x350d54,_0x5cd96d))[_0x3124('0x20')](handleError(_0x350d54,null));};exports[_0x3124('0xaa')]=function(_0x40c437,_0x19bc61){var _0x4062b9={'where':{}},_0xbf4fdd={},_0x163d6c={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x40c437[_0x3124('0x3c')]['id']}})[_0x3124('0x16')](handleEntityNotFound(_0x19bc61,null))[_0x3124('0x16')](function(_0x4fe1b9){if(_0x4fe1b9){_0xbf4fdd[_0x3124('0x3d')]=_['keys'](db['ChatMessage']['rawAttributes']);_0xbf4fdd['query']=_[_0x3124('0x3e')](_0x40c437[_0x3124('0x3a')]);_0xbf4fdd[_0x3124('0x3f')]=_[_0x3124('0x40')](_0xbf4fdd['model'],_0xbf4fdd[_0x3124('0x3a')]);_0x4062b9['attributes']=_[_0x3124('0x40')](_0xbf4fdd[_0x3124('0x3d')],qs[_0x3124('0x42')](_0x40c437[_0x3124('0x3a')][_0x3124('0x42')]));_0x4062b9[_0x3124('0x41')]=_0x4062b9['attributes'][_0x3124('0x9e')]?_0x4062b9[_0x3124('0x41')]:_0xbf4fdd['model'];if(!_0x40c437['query']['hasOwnProperty']('nolimit')){_0x4062b9[_0x3124('0x25')]=qs[_0x3124('0x25')](_0x40c437[_0x3124('0x3a')][_0x3124('0x25')]);_0x4062b9[_0x3124('0x23')]=qs['offset'](_0x40c437[_0x3124('0x3a')][_0x3124('0x23')]);}_0x4062b9[_0x3124('0xa0')]=qs['sort'](_0x40c437['query'][_0x3124('0xa1')]);_0x4062b9['where']=qs[_0x3124('0x3f')](_[_0x3124('0xa2')](_0x40c437[_0x3124('0x3a')],_0xbf4fdd[_0x3124('0x3f')]));_0x4062b9[_0x3124('0xa3')][_0x3124('0xa4')]=_0x4fe1b9['id'];if(_0x40c437[_0x3124('0x3a')][_0x3124('0xa5')]){_0x4062b9['where']=_[_0x3124('0x2e')](_0x4062b9[_0x3124('0xa3')],{'$or':_[_0x3124('0x34')](_0x4062b9['attributes'],function(_0x5c0374){var _0x1b1909={};_0x1b1909[_0x5c0374]={'$like':'%'+_0x40c437['query'][_0x3124('0xa5')]+'%'};return _0x1b1909;})});}_0x4062b9[_0x3124('0xa3')][_0x3124('0x90')]=![];if(_0x40c437[_0x3124('0x3a')]['id']){_0x4062b9['where']['id']={'$gt':_0x40c437[_0x3124('0x3a')]['id']};}_0x4062b9=_[_0x3124('0x2e')]({},_0x4062b9,_0x40c437['options']);return db[_0x3124('0x5e')][_0x3124('0x26')]({'where':_0x4062b9[_0x3124('0xa3')]})[_0x3124('0x16')](function(_0x233603){_0x163d6c[_0x3124('0x26')]=_0x233603;_0x4062b9[_0x3124('0x44')]=[];if(_0x40c437['query'][_0x3124('0xab')]){_0x4062b9['include'][_0x3124('0xac')]({'model':db['User'],'as':_0x3124('0x7f'),'attributes':['id','fullname','alias']});}if(_0x40c437['query']['includeAll']){_0x4062b9[_0x3124('0x44')]=[{'all':!![]}];}return db['ChatMessage'][_0x3124('0x39')](_0x4062b9);})[_0x3124('0x16')](function(_0x3e1108){_0x163d6c['rows']=_0x3e1108;return _0x163d6c;});}})[_0x3124('0x16')](respondWithFilteredResult(_0x19bc61,_0x4062b9))[_0x3124('0x20')](handleError(_0x19bc61,null));};exports[_0x3124('0xad')]=function(_0x249cd6,_0x4cdf7c){return db['ChatInteraction'][_0x3124('0x46')]({'where':{'id':_0x249cd6['params']['id']}})[_0x3124('0x16')](handleEntityNotFound(_0x4cdf7c,null))[_0x3124('0x16')](function(_0x6feb4f){if(_0x6feb4f){return _0x6feb4f['setTags'](_0x249cd6[_0x3124('0x49')][_0x3124('0x9c')],_[_0x3124('0x9d')](_0x249cd6['body'],['ids','id'])||{})[_0x3124('0xae')](function(){return db[_0x3124('0xaf')][_0x3124('0x39')]({'attributes':['id',_0x3124('0x2b'),_0x3124('0xb0')],'where':{'id':_0x249cd6[_0x3124('0x49')]['ids']}});})[_0x3124('0x16')](function(_0x1d49dd){socket['emit'](_0x3124('0xb1'),{'id':Number(_0x249cd6[_0x3124('0x3c')]['id']),'tags':_0x1d49dd||[]});return{'id':Number(_0x249cd6['params']['id']),'tags':_0x1d49dd||[]};});}})['then'](respondWithResult(_0x4cdf7c,null))['catch'](handleError(_0x4cdf7c,null));};exports[_0x3124('0xb2')]=function(_0x23e3e9,_0x52eb59){return db[_0x3124('0x35')]['find']({'where':{'id':_0x23e3e9[_0x3124('0x3c')]['id']}})[_0x3124('0x16')](handleEntityNotFound(_0x52eb59,null))['then'](function(_0x2c12af){if(_0x2c12af){return _0x2c12af[_0x3124('0xb2')](_0x23e3e9[_0x3124('0x3a')][_0x3124('0x9c')]);}})[_0x3124('0x16')](respondWithStatusCode(_0x52eb59,null))[_0x3124('0x20')](handleError(_0x52eb59,null));};exports[_0x3124('0x76')]=function(_0x526238,_0x19f4e9){var _0x2a8d88=moment()['unix']()[_0x3124('0xb3')]();var _0x1b424b=path[_0x3124('0x74')](config[_0x3124('0x79')],'server',_0x3124('0xb4'),_0x3124('0xb5'));var _0x4f58fe=path['join'](config[_0x3124('0x79')],_0x3124('0xb6'),_0x3124('0xb4'),'attachments');var _0x1f6ed7=path[_0x3124('0x74')](_0x1b424b,_0x2a8d88);var _0x37e380=util['format'](_0x3124('0xb7'),_0x526238[_0x3124('0x3c')]['id'],_0x2a8d88);var _0x311c07=path[_0x3124('0x74')](_0x1b424b,_0x37e380);var _0x5c5eef=[];_0x5c5eef[_0x3124('0xac')]({'model':db[_0x3124('0x7f')],'as':_0x3124('0x7f'),'attributes':['id',_0x3124('0x8a')],'raw':!![]});_0x5c5eef[_0x3124('0xac')]({'model':db[_0x3124('0x62')],'as':'Contact','attributes':['id',_0x3124('0xb8'),_0x3124('0xb9')],'raw':!![]});if(_0x526238[_0x3124('0x3a')][_0x3124('0xba')]){_0x5c5eef['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x30e4b=[{'model':db[_0x3124('0x5e')],'as':_0x3124('0x7e'),'attributes':['id','body',_0x3124('0x8e'),_0x3124('0xbb'),_0x3124('0x90'),_0x3124('0xbc')],'include':_0x5c5eef}];_0x30e4b['push']({'model':db[_0x3124('0x4e')],'as':'Account','attributes':['id',_0x3124('0x2b')]});_0x30e4b[_0x3124('0xac')]({'model':db['User'],'as':_0x3124('0xbd'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x3124('0x46')]({'where':{'id':_0x526238[_0x3124('0x3c')]['id']},'include':_0x30e4b})[_0x3124('0x16')](handleEntityNotFound(_0x19f4e9,null))[_0x3124('0x16')](function(_0x5ccd0a){if(_0x5ccd0a){var _0x5aa13e=_0x5ccd0a[_0x3124('0xbe')]({'plain':!![]});fs[_0x3124('0xbf')](_0x1f6ed7);var _0x2a1bf7={'channel':'Chat','account':_0x5aa13e[_0x3124('0xc0')][_0x3124('0x2b')],'agent':_0x5aa13e[_0x3124('0xbd')]?_0x5aa13e[_0x3124('0xbd')][_0x3124('0x8a')]:_0x3124('0xc1'),'createdAt':moment(_0x5aa13e[_0x3124('0x8e')])[_0x3124('0x7b')](_0x3124('0xa8'))[_0x3124('0xb3')](),'closedAt':_0x5aa13e[_0x3124('0x70')]?moment(_0x5aa13e[_0x3124('0xc2')])['format'](_0x3124('0xa8'))[_0x3124('0xb3')]():'','disposition':_0x5aa13e[_0x3124('0x66')],'chatInfo':{'browser':_0x5aa13e[_0x3124('0xc3')],'os':_0x5aa13e[_0x3124('0xc4')],'referer':_0x5aa13e[_0x3124('0xc5')],'customerIp':_0x5aa13e[_0x3124('0xc6')],'customerPort':_0x5aa13e['customerPort']?_0x5aa13e[_0x3124('0xc7')]:_0x3124('0xc1')},'messages':_(_0x5aa13e[_0x3124('0x7e')])[_0x3124('0xc8')]()['filter']({'secret':![]})[_0x3124('0x34')](function(_0x5959c4){if(_0x5959c4['Attachment']){var _0x57c2ba=path[_0x3124('0x74')](_0x4f58fe,_0x5959c4[_0x3124('0x6e')][_0x3124('0x6a')]);if(fs[_0x3124('0xc9')](_0x57c2ba)){fs[_0x3124('0xca')](_0x57c2ba)[_0x3124('0xcb')](fs[_0x3124('0xcc')](path['join'](_0x1f6ed7,_0x5959c4[_0x3124('0x6e')][_0x3124('0x6a')])));}}return{'date':moment(_0x5959c4[_0x3124('0x8e')])[_0x3124('0x7b')](_0x3124('0xa8'))['toString'](),'sender':_0x5959c4[_0x3124('0xbb')]===_0x3124('0xcd')?_0x5959c4[_0x3124('0x7f')]?_0x5959c4[_0x3124('0x7f')][_0x3124('0x8a')]:_0x3124('0x8c'):_0x5959c4[_0x3124('0x63')][_0x3124('0xb8')]+(_0x5959c4[_0x3124('0x63')]['lastName']?'\x20'+_0x5959c4[_0x3124('0x63')]['lastName']:''),'body':_0x5959c4[_0x3124('0x6e')]?_0x5959c4[_0x3124('0x6e')][_0x3124('0x6a')]:_0x5959c4[_0x3124('0x49')],'direction':_0x5959c4['direction']===_0x3124('0xcd')?'A':'C','secret':_0x5959c4[_0x3124('0x90')],'read':_0x5959c4[_0x3124('0xbc')],'attachment':_0x5959c4[_0x3124('0x6e')]};})[_0x3124('0xce')]()};return ejs['renderFile'](path[_0x3124('0x74')](config[_0x3124('0x79')],'server',_0x3124('0xcf'),'downloadInteraction.ejs'),{'interaction':_0x2a1bf7})[_0x3124('0x16')](function(_0xa4f17){var _0x3c444c=path[_0x3124('0x74')](_0x1f6ed7,_0x3124('0xd0')+_0x5aa13e['id']+'-'+_0x2a8d88+'.pdf');var _0x218660={'path':_0x3c444c,'channel':'Chat','interactionId':_0x5aa13e['id']};return pdf['createPdfFromHTML'](_0xa4f17,_0x218660);})[_0x3124('0x16')](function(){return new Promise(function(_0x48fd14,_0x382b4d){zipdir(_0x1f6ed7,{'saveTo':_0x311c07},function(_0x38f0ea,_0x30b372){if(_0x38f0ea)return _0x382b4d(_0x38f0ea);return _0x48fd14(_0x30b372);});})[_0x3124('0x16')](function(){return new BPromise(function(_0x3c6fb1,_0x5214b6){rimraf(_0x1f6ed7,function(_0x3130e4){if(_0x3130e4)_0x5214b6(_0x3130e4);return _0x3c6fb1();});});})[_0x3124('0x16')](function(){return _0x19f4e9[_0x3124('0x76')](_0x311c07,_0x37e380,function(_0x3743c2){if(_0x3743c2){logger[_0x3124('0x1c')]('err',_0x3743c2);}else{fs[_0x3124('0xd1')](_0x311c07);}});});});}else{return _0x19f4e9[_0x3124('0x21')](0xc8);}})['catch'](handleError(_0x19f4e9,null));}; \ No newline at end of file +var _0xca9b=['renderFile','downloadInteraction.ejs','transcript-','.pdf','download','err','unlinkSync','sendStatus','rimraf','request-promise','moment','mustache','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','defaults','localhost','socket.io-emitter','redis','register','http','client','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','stack','name','send','render','merge','body','agent','interaction','account','map','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','model','keys','ChatInteraction','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','contact','POST','isNull','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','join','root','server/files/attachments/','offline-chat/','close','format','transcript-%s.txt','now','pathTranscript','User','ChatWebsiteId','ContactId','Messages','agentAlias','System','customer','%s%d','agentIdentifier','website_alias','agent_alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','order','includeAgent','push','alias','setTags','spread','Tag','color','emit','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','lastName','Account','Owner','get','mkdirSync','N.A.','closedAt','toString','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','direction','read','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca9b,0xd9));var _0xbca9=function(_0x510692,_0x33f9d3){_0x510692=_0x510692-0x0;var _0x61c12c=_0xca9b[_0x510692];return _0x61c12c;};'use strict';var rimraf=require(_0xbca9('0x0'));var zipdir=require('zip-dir');var rp=require(_0xbca9('0x1'));var moment=require(_0xbca9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbca9('0x3'));var util=require('util');var path=require(_0xbca9('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbca9('0x5'));var Redis=require(_0xbca9('0x6'));var interaction=require(_0xbca9('0x7'));var qs=require(_0xbca9('0x8'));var pdf=require(_0xbca9('0x9'));var logger=require(_0xbca9('0xa'))(_0xbca9('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbca9('0xc')](config['redis'],{'host':_0xbca9('0xd'),'port':0x18eb});var socket=require(_0xbca9('0xe'))(new Redis(config[_0xbca9('0xf')]));require('./chatInteraction.socket')[_0xbca9('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xbca9('0x11')]({'port':0x232b});var client9004=jayson[_0xbca9('0x12')][_0xbca9('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x56a4d2,_0x18337d,_0x5c4c2c,_0x49f0e1){return new BPromise(function(_0x30f71f,_0x454a17){var _0x2cf9a2=_0x49f0e1||client;return _0x2cf9a2[_0xbca9('0x13')](_0x56a4d2,_0x5c4c2c)['then'](function(_0x41b413){logger[_0xbca9('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x18337d,_0xbca9('0x15'));logger[_0xbca9('0x16')](_0xbca9('0x17'),_0x18337d,_0xbca9('0x15'),JSON[_0xbca9('0x18')](_0x41b413));if(_0x41b413['error']){if(_0x41b413[_0xbca9('0x19')][_0xbca9('0x1a')]===0x1f4){logger['error'](_0xbca9('0x1b'),_0x18337d,_0x41b413['error']['message']);return _0x454a17(_0x41b413[_0xbca9('0x19')][_0xbca9('0x1c')]);}logger[_0xbca9('0x19')](_0xbca9('0x1b'),_0x18337d,_0x41b413[_0xbca9('0x19')][_0xbca9('0x1c')]);return _0x30f71f(_0x41b413['error'][_0xbca9('0x1c')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x18337d,'request\x20sent');_0x30f71f(_0x41b413['result'][_0xbca9('0x1c')]);}})[_0xbca9('0x1d')](function(_0x5ce00f){logger[_0xbca9('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x18337d,_0x5ce00f);_0x454a17(_0x5ce00f);});});}function respondWithStatusCode(_0x16bc94,_0x13c2b0){_0x13c2b0=_0x13c2b0||0xcc;return function(_0x1b66c8){if(_0x1b66c8){return _0x16bc94['sendStatus'](_0x13c2b0);}return _0x16bc94[_0xbca9('0x1e')](_0x13c2b0)[_0xbca9('0x1f')]();};}function respondWithResult(_0x2b5c97,_0x39a868){_0x39a868=_0x39a868||0xc8;return function(_0x2b3620){if(_0x2b3620){return _0x2b5c97[_0xbca9('0x1e')](_0x39a868)['json'](_0x2b3620);}};}function respondWithFilteredResult(_0x1b13e1,_0x499e70){return function(_0x3481bf){if(_0x3481bf){var _0x434f3d=typeof _0x499e70[_0xbca9('0x20')]===_0xbca9('0x21')&&typeof _0x499e70['limit']===_0xbca9('0x21');var _0xd0ffac=_0x3481bf[_0xbca9('0x22')];var _0x3ca8a3=_0x434f3d?0x0:_0x499e70[_0xbca9('0x20')];var _0x29e2a2=_0x434f3d?_0x3481bf[_0xbca9('0x22')]:_0x499e70['offset']+_0x499e70[_0xbca9('0x23')];var _0x33fc2f;if(_0x29e2a2>=_0xd0ffac){_0x29e2a2=_0xd0ffac;_0x33fc2f=0xc8;}else{_0x33fc2f=0xce;}_0x1b13e1[_0xbca9('0x1e')](_0x33fc2f);return _0x1b13e1[_0xbca9('0x24')](_0xbca9('0x25'),_0x3ca8a3+'-'+_0x29e2a2+'/'+_0xd0ffac)[_0xbca9('0x26')](_0x3481bf);}return null;};}function saveUpdates(_0x21fbfb){return function(_0x14d2ae){if(_0x14d2ae){return _0x14d2ae[_0xbca9('0x27')](_0x21fbfb)[_0xbca9('0x28')](function(_0xf0bc0b){return _0xf0bc0b;});}return null;};}function removeEntity(_0x222496){return function(_0x2779e6){if(_0x2779e6){return _0x2779e6[_0xbca9('0x29')]()[_0xbca9('0x28')](function(){_0x222496[_0xbca9('0x1e')](0xcc)[_0xbca9('0x1f')]();});}};}function handleEntityNotFound(_0x4ebf90){return function(_0x42631f){if(!_0x42631f){_0x4ebf90['sendStatus'](0x194);}return _0x42631f;};}function handleError(_0x9b6f65,_0x960385){_0x960385=_0x960385||0x1f4;return function(_0x212dc5){logger[_0xbca9('0x19')](_0x212dc5[_0xbca9('0x2a')]);if(_0x212dc5[_0xbca9('0x2b')]){delete _0x212dc5[_0xbca9('0x2b')];}_0x9b6f65[_0xbca9('0x1e')](_0x960385)[_0xbca9('0x2c')](_0x212dc5);};}function getMustacheRender(_0x292440,_0x2478ad){return Mustache[_0xbca9('0x2d')](_0x292440,_[_0xbca9('0x2e')](_0x2478ad[_0xbca9('0x2f')],{'contact':_0x2478ad['contact'],'message':_0x2478ad[_0xbca9('0x1c')],'agent':_0x2478ad[_0xbca9('0x30')],'interaction':_0x2478ad[_0xbca9('0x31')],'account':_0x2478ad[_0xbca9('0x32')]}))||'';}exports['index']=function(_0x2c0018,_0x5eea62){var _0xfcd356={};var _0x5c0f17=_[_0xbca9('0x33')](db['ChatInteraction'][_0xbca9('0x34')],function(_0x1b1d1c){return{'name':_0x1b1d1c[_0xbca9('0x35')],'type':_0x1b1d1c[_0xbca9('0x36')][_0xbca9('0x37')]};});_0xfcd356=qs[_0xbca9('0x38')](_0x5c0f17,_0x2c0018);return interaction[_0xbca9('0x39')](_0xbca9('0x3a'),_0x2c0018[_0xbca9('0x3b')],_0x2c0018[_0xbca9('0x3c')],_0xfcd356,_0x5c0f17)[_0xbca9('0x28')](respondWithFilteredResult(_0x5eea62,_0xfcd356))[_0xbca9('0x1d')](handleError(_0x5eea62,null));};exports[_0xbca9('0x3d')]=function(_0xe8e422,_0x26677c){var _0x26938c={'raw':![],'where':{'id':_0xe8e422['params']['id']}},_0x20dc44={};_0x20dc44[_0xbca9('0x3e')]=_[_0xbca9('0x3f')](db[_0xbca9('0x40')][_0xbca9('0x34')]);_0x20dc44['query']=_[_0xbca9('0x3f')](_0xe8e422[_0xbca9('0x3b')]);_0x20dc44[_0xbca9('0x41')]=_[_0xbca9('0x42')](_0x20dc44['model'],_0x20dc44[_0xbca9('0x3b')]);_0x26938c['attributes']=_[_0xbca9('0x42')](_0x20dc44[_0xbca9('0x3e')],qs[_0xbca9('0x43')](_0xe8e422[_0xbca9('0x3b')][_0xbca9('0x43')]));_0x26938c['attributes']=_0x26938c[_0xbca9('0x44')][_0xbca9('0x45')]?_0x26938c[_0xbca9('0x44')]:_0x20dc44[_0xbca9('0x3e')];if(_0xe8e422[_0xbca9('0x3b')][_0xbca9('0x46')]){_0x26938c[_0xbca9('0x47')]=[{'all':!![]}];}_0x26938c=_[_0xbca9('0x2e')]({},_0x26938c,_0xe8e422[_0xbca9('0x48')]);return db[_0xbca9('0x40')][_0xbca9('0x49')](_0x26938c)[_0xbca9('0x28')](handleEntityNotFound(_0x26677c,null))[_0xbca9('0x28')](respondWithResult(_0x26677c,null))[_0xbca9('0x1d')](handleError(_0x26677c,null));};exports[_0xbca9('0x4a')]=function(_0x401719,_0x3a8fc2){return db[_0xbca9('0x40')][_0xbca9('0x4a')](_0x401719[_0xbca9('0x2f')],{})['then'](respondWithResult(_0x3a8fc2,0xc9))[_0xbca9('0x1d')](handleError(_0x3a8fc2,null));};exports[_0xbca9('0x27')]=function(_0x281379,_0xf06da4){if(_0x281379[_0xbca9('0x2f')]['id']){delete _0x281379['body']['id'];}return db[_0xbca9('0x40')][_0xbca9('0x49')]({'where':{'id':_0x281379[_0xbca9('0x4b')]['id']}})[_0xbca9('0x28')](handleEntityNotFound(_0xf06da4,null))[_0xbca9('0x28')](saveUpdates(_0x281379['body'],null))[_0xbca9('0x28')](respondWithResult(_0xf06da4,null))[_0xbca9('0x1d')](handleError(_0xf06da4,null));};exports[_0xbca9('0x29')]=function(_0x383116,_0x153b73){return db['ChatInteraction']['find']({'where':{'id':_0x383116[_0xbca9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x153b73,null))[_0xbca9('0x28')](removeEntity(_0x153b73,null))['catch'](handleError(_0x153b73,null));};exports[_0xbca9('0x4c')]=function(_0x56d4e9,_0x24c2f8){return db[_0xbca9('0x40')][_0xbca9('0x4c')]()['then'](respondWithResult(_0x24c2f8,null))['catch'](handleError(_0x24c2f8,null));};exports[_0xbca9('0x4d')]=function(_0x34f473,_0x5505c1){var _0x5bdb6a=_0x34f473[_0xbca9('0x4b')]['id'];var _0x41e809;var _0x3f8db2;var _0x3fd9dc;return db[_0xbca9('0x40')][_0xbca9('0x4e')]({'where':{'id':_0x5bdb6a}})[_0xbca9('0x28')](function(_0x3c8df9){_0x41e809=_0x3c8df9;return db['ChatWebsite'][_0xbca9('0x4e')]({'where':{'id':_0x3c8df9['ChatWebsiteId']},'attributes':['id',_0xbca9('0x4f'),'vidaooEscalation',_0xbca9('0x50'),_0xbca9('0x51'),_0xbca9('0x52')],'raw':!![]});})[_0xbca9('0x28')](function(_0x408464){if(_0x408464&&_0x408464[_0xbca9('0x4f')]&&_0x408464[_0xbca9('0x53')]){_0x3f8db2=_0x408464;var _0x2c6aac={'interaction':{'id':_0x5bdb6a},'agent':{'id':_0x34f473['user']['id'],'name':_0x34f473[_0xbca9('0x3c')][_0xbca9('0x2b')],'fullname':_0x34f473[_0xbca9('0x3c')]['fullname'],'email':_0x34f473[_0xbca9('0x3c')][_0xbca9('0x54')]},'contact':_0x34f473[_0xbca9('0x2f')][_0xbca9('0x55')],'account':_0x34f473['body']['account']};var _0x29f9bc={'rejectUnauthorized':![],'method':_0xbca9('0x56'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x408464['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x34f473['user'][_0xbca9('0x54')]],'buttons':null,'topic':_0x3f8db2[_0xbca9('0x50')],'note':_[_0xbca9('0x57')](_0x3f8db2[_0xbca9('0x51')])?null:getMustacheRender(_0x3f8db2[_0xbca9('0x51')],_0x2c6aac),'metadata':null},'redirect':_0xbca9('0x58'),'json':!![]};try{if(!_[_0xbca9('0x57')](_0x3f8db2[_0xbca9('0x52')])){var _0x5e315f=getMustacheRender(_0x3f8db2[_0xbca9('0x52')],_0x2c6aac);var _0x4fe067=JSON[_0xbca9('0x59')](_0x5e315f);_0x29f9bc[_0xbca9('0x2f')][_0xbca9('0x5a')]=_0x4fe067;}}catch(_0x15d309){throw new db['Sequelize'][(_0xbca9('0x5b'))](_0xbca9('0x5c'));}return rp(_0x29f9bc);}else{throw new db[(_0xbca9('0x5d'))][(_0xbca9('0x5b'))](_0xbca9('0x5e'));}})[_0xbca9('0x28')](function(_0x11bdeb){_0x3fd9dc=_0x11bdeb;if(_0x3fd9dc['id']){var _0x16dfb5={'body':_0x3fd9dc[_0xbca9('0x5f')],'ChatWebsiteId':_0x3f8db2['id'],'ChatInteractionId':_0x41e809['id'],'direction':_0xbca9('0x60'),'UserId':_0x34f473[_0xbca9('0x3c')]['id']};return db[_0xbca9('0x61')][_0xbca9('0x4a')](_0x16dfb5,{});}else{throw new db[(_0xbca9('0x5d'))][(_0xbca9('0x5b'))](_0xbca9('0x62'));}})[_0xbca9('0x28')](function(){return _0x41e809[_0xbca9('0x63')]({'vidaooSessionId':_0x3fd9dc['id']});})[_0xbca9('0x28')](respondWithResult(_0x5505c1,null))[_0xbca9('0x1d')](handleError(_0x5505c1,null));};exports[_0xbca9('0x64')]=function(_0x5dd916,_0x56fcec){if(_0x5dd916['body']['id']){delete _0x5dd916[_0xbca9('0x2f')]['id'];}return db[_0xbca9('0x40')]['find']({'where':{'id':_0x5dd916[_0xbca9('0x4b')]['id']},'include':[{'model':db[_0xbca9('0x65')],'as':'Contact'}]})[_0xbca9('0x28')](handleEntityNotFound(_0x56fcec,null))[_0xbca9('0x28')](saveUpdates(_0x5dd916[_0xbca9('0x2f')],null))['then'](respondWithResult(_0x56fcec,null))[_0xbca9('0x1d')](handleError(_0x56fcec,null));};exports[_0xbca9('0x66')]=function(_0x186f8c,_0x5a43ab){if(_0x186f8c[_0xbca9('0x2f')]['id']){delete _0x186f8c[_0xbca9('0x2f')]['id'];}return db[_0xbca9('0x40')][_0xbca9('0x49')]({'where':{'id':_0x186f8c['params']['id']}})[_0xbca9('0x28')](function(_0x3d4eb4){if(!_0x3d4eb4){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xbca9('0x66'),0x194,'entity\x20not\x20found');_0x5a43ab['sendStatus'](0x194);}else{if(_0x3d4eb4[_0xbca9('0x67')]){throw new db[(_0xbca9('0x5d'))][(_0xbca9('0x5b'))]('Interaction\x20already\x20assigned');}}return _0x3d4eb4;})[_0xbca9('0x28')](function(_0x5b9f31){if(_0x5b9f31){return _0x5b9f31['update']({'closed':_0x186f8c[_0xbca9('0x2f')][_0xbca9('0x68')],'disposition':_0x186f8c['body'][_0xbca9('0x69')]})['then'](function(_0x2a2c28){return _0x2a2c28;});}})[_0xbca9('0x28')](function(){return respondWithRpcPromise(_0xbca9('0x6a'),_0xbca9('0x66'),_0x186f8c[_0xbca9('0x2f')],client9004);})[_0xbca9('0x28')](respondWithResult(_0x5a43ab,null))[_0xbca9('0x1d')](handleError(_0x5a43ab,null));};exports[_0xbca9('0x6b')]=function(_0x1f6c7d,_0x28fe7a){_0x1f6c7d[_0xbca9('0x2f')][_0xbca9('0x2b')]=_0x1f6c7d[_0xbca9('0x6c')][_0xbca9('0x6d')];_0x1f6c7d[_0xbca9('0x2f')][_0xbca9('0x6e')]=_0x1f6c7d[_0xbca9('0x6c')][_0xbca9('0x6f')];_0x1f6c7d['body']['type']=_0x1f6c7d['file'][_0xbca9('0x70')];return db[_0xbca9('0x71')][_0xbca9('0x4a')](_0x1f6c7d[_0xbca9('0x2f')])['then'](respondWithResult(_0x28fe7a,0xc9))['catch'](handleError(_0x28fe7a,null));};exports[_0xbca9('0x72')]=function(_0x258b9,_0x421bd5){return db[_0xbca9('0x40')][_0xbca9('0x4e')]({'where':{'id':_0x258b9['params']['id']},'raw':!![]})[_0xbca9('0x28')](handleEntityNotFound(_0x421bd5,null))[_0xbca9('0x28')](function(_0x5d6ce3){if(_0x5d6ce3){if(_0x5d6ce3['closed']){return _0x421bd5[_0xbca9('0x1e')](0x193)[_0xbca9('0x26')]({'status':0x193,'message':'Unauthorized'});}return db[_0xbca9('0x71')][_0xbca9('0x4e')]({'where':{'id':_0x258b9[_0xbca9('0x3b')]['attachId']},'raw':!![]})[_0xbca9('0x28')](handleEntityNotFound(_0x421bd5,null));}})[_0xbca9('0x28')](function(_0xa49de7){if(_0xa49de7){var _0x30345c=_0xa49de7['ChatOfflineMessageId']!==null;var _0x342f24=path[_0xbca9('0x73')](config[_0xbca9('0x74')],_0xbca9('0x75'));if(_0x30345c){_0x342f24=path[_0xbca9('0x73')](_0x342f24,_0xbca9('0x76'));}var _0x3821b2=path[_0xbca9('0x73')](_0x342f24,_0xa49de7[_0xbca9('0x6e')]);return _0x421bd5['download'](_0x3821b2);}})[_0xbca9('0x1d')](handleError(_0x421bd5,null));};exports[_0xbca9('0x77')]=function(_0x13d046,_0x3409da){var _0x1c843d=null;var _0x327bf2=null;var _0x2665e7=null;if(_0x13d046[_0xbca9('0x2f')]['id']){delete _0x13d046['body']['id'];}if(_0x13d046[_0xbca9('0x2f')]['mailTranscript']){_0x2665e7=path[_0xbca9('0x73')](config[_0xbca9('0x74')],'server/files/chat/upload/',util[_0xbca9('0x78')](_0xbca9('0x79'),Date[_0xbca9('0x7a')]()));_0x13d046[_0xbca9('0x2f')][_0xbca9('0x7b')]=_0x2665e7;}return db[_0xbca9('0x40')]['find']({'where':{'id':_0x13d046[_0xbca9('0x4b')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xbca9('0x7c')],'as':'User'}]}]})[_0xbca9('0x28')](handleEntityNotFound(_0x3409da,null))[_0xbca9('0x28')](saveUpdates(_0x13d046[_0xbca9('0x2f')],null))[_0xbca9('0x28')](function(_0xdbbe37){if(_0xdbbe37){_0x1c843d=_0xdbbe37;return db['ChatWebsite'][_0xbca9('0x49')]({'where':{'id':_0x1c843d[_0xbca9('0x7d')]}});}})[_0xbca9('0x28')](function(_0xaba1c6){if(_0xaba1c6){_0x327bf2=_0xaba1c6;return db[_0xbca9('0x65')][_0xbca9('0x49')]({'where':{'id':_0x1c843d[_0xbca9('0x7e')]}});}})[_0xbca9('0x28')](function(_0x29148c){if(_0x29148c){if(_0x2665e7){var _0x4b0117=null;for(var _0x4fe987=0x1;_0x4fe987<_0x1c843d['Messages']['length'];++_0x4fe987){_0x4b0117=_0x1c843d[_0xbca9('0x7f')][_0x4fe987];var _0xfa213d=_0x4b0117['UserId']?util[_0xbca9('0x78')]('%s%d',_0x327bf2[_0xbca9('0x80')],_0x4b0117[_0xbca9('0x67')]):_0xbca9('0x81');var _0x5a4e11=_0x13d046[_0xbca9('0x2f')][_0xbca9('0x82')]||util['format'](_0xbca9('0x83'),'Visitor',_0x4b0117[_0xbca9('0x7e')]);switch(_0x327bf2[_0xbca9('0x84')]){case _0xbca9('0x85'):_0xfa213d=_0x4b0117[_0xbca9('0x67')]?util[_0xbca9('0x78')]('%s%d',_0x327bf2['agentAlias'],_0x4b0117['UserId']):_0xbca9('0x81');break;case _0xbca9('0x86'):_0xfa213d=_0x4b0117[_0xbca9('0x67')]?_0x4b0117['User']['alias']||_0x4b0117[_0xbca9('0x7c')][_0xbca9('0x87')]:_0xbca9('0x81');break;case'agent_fullname':_0xfa213d=_0x4b0117[_0xbca9('0x67')]?_0x4b0117['User'][_0xbca9('0x87')]:'System';break;default:_0xfa213d=_0x4b0117[_0xbca9('0x67')]?util[_0xbca9('0x78')](_0xbca9('0x83'),_0x327bf2[_0xbca9('0x80')],_0x4b0117[_0xbca9('0x67')]):_0xbca9('0x81');}var _0x1372a1=util[_0xbca9('0x78')](_0xbca9('0x88'),moment(_0x4b0117[_0xbca9('0x89')])['format'](_0xbca9('0x8a')),_0x4b0117['direction']==='in'?_0x5a4e11:_0xfa213d,_0x4b0117[_0xbca9('0x2f')]);if(!_0x4b0117[_0xbca9('0x8b')]){fs['appendFileSync'](_0x2665e7,_0x1372a1);}}return db['MailAccount'][_0xbca9('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0xbca9('0x8c')],'as':_0xbca9('0x8d'),'raw':!![],'include':[{'model':db[_0xbca9('0x8e')],'as':_0xbca9('0x8e'),'raw':!![]}]}]});}}})[_0xbca9('0x28')](function(_0x2ad606){if(!_0x2ad606||!_0x2ad606[_0xbca9('0x8d')]||!_0x13d046[_0xbca9('0x2f')])return _0x1c843d;var _0x365956=_0x2ad606[_0xbca9('0x8f')]();return respondWithRpcPromise(_0xbca9('0x90'),_0xbca9('0x91'),{'account':_0x365956,'message':{'from':util[_0xbca9('0x78')](_0xbca9('0x92'),_0x2ad606[_0xbca9('0x2b')],_0x2ad606[_0xbca9('0x54')]||_0x2ad606['Smtp'][_0xbca9('0x3c')]),'to':_0x13d046[_0xbca9('0x2f')][_0xbca9('0x93')],'subject':'Mail\x20Transcript','text':util[_0xbca9('0x78')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x13d046[_0xbca9('0x2f')][_0xbca9('0x93')]),'attachments':[{'path':_0x2665e7}]}})[_0xbca9('0x28')](function(){return _0x1c843d;})['catch'](function(_0x1543ae){logger[_0xbca9('0x19')](_0x1543ae);});})[_0xbca9('0x28')](respondWithStatusCode(_0x3409da,0xc8))[_0xbca9('0x1d')](handleError(_0x3409da,null));};exports['addMessage']=function(_0x28d409,_0x32e5ff){return db['ChatMessage']['find']({'where':{'id':_0x28d409[_0xbca9('0x4b')]['id']}})[_0xbca9('0x28')](handleEntityNotFound(_0x32e5ff,null))[_0xbca9('0x28')](function(_0x4e4f82){if(_0x4e4f82){return _0x4e4f82[_0xbca9('0x94')](_0x28d409[_0xbca9('0x2f')][_0xbca9('0x95')],_[_0xbca9('0x96')](_0x28d409['body'],['ids','id'])||{});}})[_0xbca9('0x28')](respondWithResult(_0x32e5ff,null))[_0xbca9('0x1d')](handleError(_0x32e5ff,null));};exports[_0xbca9('0x97')]=function(_0x207190,_0x46657e){var _0x36e128={'raw':![],'where':{}};var _0x3e8513={};var _0xe43d57={'count':0x0,'rows':[]};return db[_0xbca9('0x40')][_0xbca9('0x4e')]({'where':{'id':_0x207190[_0xbca9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46657e,null))[_0xbca9('0x28')](function(_0x18ead3){if(_0x18ead3){_0x3e8513[_0xbca9('0x3e')]=_[_0xbca9('0x3f')](db[_0xbca9('0x61')][_0xbca9('0x34')]);_0x3e8513[_0xbca9('0x3b')]=_['keys'](_0x207190[_0xbca9('0x3b')]);_0x3e8513[_0xbca9('0x41')]=_[_0xbca9('0x42')](_0x3e8513[_0xbca9('0x3e')],_0x3e8513[_0xbca9('0x3b')]);_0x36e128[_0xbca9('0x44')]=_[_0xbca9('0x42')](_0x3e8513[_0xbca9('0x3e')],qs['fields'](_0x207190[_0xbca9('0x3b')][_0xbca9('0x43')]));_0x36e128[_0xbca9('0x44')]=_0x36e128[_0xbca9('0x44')][_0xbca9('0x45')]?_0x36e128[_0xbca9('0x44')]:_0x3e8513[_0xbca9('0x3e')];if(!_0x207190[_0xbca9('0x3b')][_0xbca9('0x98')](_0xbca9('0x99'))){_0x36e128[_0xbca9('0x23')]=qs['limit'](_0x207190[_0xbca9('0x3b')]['limit']);_0x36e128['offset']=qs['offset'](_0x207190[_0xbca9('0x3b')][_0xbca9('0x20')]);}_0x36e128['order']=qs['sort'](_0x207190[_0xbca9('0x3b')][_0xbca9('0x9a')]);_0x36e128[_0xbca9('0x9b')]=qs[_0xbca9('0x41')](_[_0xbca9('0x9c')](_0x207190['query'],_0x3e8513[_0xbca9('0x41')]));_0x36e128[_0xbca9('0x9b')][_0xbca9('0x9d')]=_0x18ead3['id'];if(_0x207190[_0xbca9('0x3b')][_0xbca9('0x9e')]){_0x36e128['where']=_['merge'](_0x36e128[_0xbca9('0x9b')],{'$or':_[_0xbca9('0x33')](_0x36e128[_0xbca9('0x44')],function(_0x3f62f5){var _0x4f7c8f={};_0x4f7c8f[_0x3f62f5]={'$like':'%'+_0x207190['query'][_0xbca9('0x9e')]+'%'};return _0x4f7c8f;})});}if(_0x207190['query'][_0xbca9('0x9f')]){var _0x18ffd4=_0x207190[_0xbca9('0x3b')][_0xbca9('0x9f')][_0xbca9('0xa0')](',');var _0x3405df={};_0x3405df[_0x18ffd4[0x0]]={'$gte':moment(_0x18ffd4[0x1])['format'](_0xbca9('0xa1'))};_0x36e128['where']=_[_0xbca9('0x2e')](_0x36e128['where'],_0x3405df);}_0x36e128=_[_0xbca9('0x2e')]({},_0x36e128,_0x207190[_0xbca9('0x48')]);return db[_0xbca9('0x61')]['count']({'where':_0x36e128[_0xbca9('0x9b')]})[_0xbca9('0x28')](function(_0x406b6c){_0xe43d57['count']=_0x406b6c;if(_0x207190[_0xbca9('0x3b')][_0xbca9('0x46')]){_0x36e128['include']=[{'all':!![]}];}return db['ChatMessage'][_0xbca9('0x39')](_0x36e128);})[_0xbca9('0x28')](function(_0x2deda3){_0xe43d57[_0xbca9('0xa2')]=_0x2deda3;return _0xe43d57;});}})[_0xbca9('0x28')](respondWithFilteredResult(_0x46657e,_0x36e128))[_0xbca9('0x1d')](handleError(_0x46657e,null));};exports[_0xbca9('0xa3')]=function(_0x50316e,_0xb46c2f){var _0xee4f50={'where':{}},_0x20e922={},_0x17280f={'count':0x0,'rows':[]};return db[_0xbca9('0x40')][_0xbca9('0x4e')]({'where':{'id':_0x50316e[_0xbca9('0x4b')]['id']}})[_0xbca9('0x28')](handleEntityNotFound(_0xb46c2f,null))['then'](function(_0x1c5ffb){if(_0x1c5ffb){_0x20e922[_0xbca9('0x3e')]=_['keys'](db[_0xbca9('0x61')][_0xbca9('0x34')]);_0x20e922['query']=_[_0xbca9('0x3f')](_0x50316e[_0xbca9('0x3b')]);_0x20e922['filters']=_[_0xbca9('0x42')](_0x20e922[_0xbca9('0x3e')],_0x20e922[_0xbca9('0x3b')]);_0xee4f50[_0xbca9('0x44')]=_[_0xbca9('0x42')](_0x20e922[_0xbca9('0x3e')],qs[_0xbca9('0x43')](_0x50316e[_0xbca9('0x3b')][_0xbca9('0x43')]));_0xee4f50[_0xbca9('0x44')]=_0xee4f50[_0xbca9('0x44')][_0xbca9('0x45')]?_0xee4f50['attributes']:_0x20e922['model'];if(!_0x50316e['query'][_0xbca9('0x98')](_0xbca9('0x99'))){_0xee4f50[_0xbca9('0x23')]=qs[_0xbca9('0x23')](_0x50316e[_0xbca9('0x3b')][_0xbca9('0x23')]);_0xee4f50[_0xbca9('0x20')]=qs[_0xbca9('0x20')](_0x50316e['query'][_0xbca9('0x20')]);}_0xee4f50[_0xbca9('0xa4')]=qs[_0xbca9('0x9a')](_0x50316e['query'][_0xbca9('0x9a')]);_0xee4f50[_0xbca9('0x9b')]=qs['filters'](_[_0xbca9('0x9c')](_0x50316e[_0xbca9('0x3b')],_0x20e922[_0xbca9('0x41')]));_0xee4f50[_0xbca9('0x9b')][_0xbca9('0x9d')]=_0x1c5ffb['id'];if(_0x50316e[_0xbca9('0x3b')][_0xbca9('0x9e')]){_0xee4f50['where']=_[_0xbca9('0x2e')](_0xee4f50[_0xbca9('0x9b')],{'$or':_[_0xbca9('0x33')](_0xee4f50[_0xbca9('0x44')],function(_0x4a7c85){var _0x1897d0={};_0x1897d0[_0x4a7c85]={'$like':'%'+_0x50316e['query'][_0xbca9('0x9e')]+'%'};return _0x1897d0;})});}_0xee4f50[_0xbca9('0x9b')]['secret']=![];if(_0x50316e[_0xbca9('0x3b')]['id']){_0xee4f50['where']['id']={'$gt':_0x50316e[_0xbca9('0x3b')]['id']};}_0xee4f50=_[_0xbca9('0x2e')]({},_0xee4f50,_0x50316e[_0xbca9('0x48')]);return db['ChatMessage'][_0xbca9('0x22')]({'where':_0xee4f50[_0xbca9('0x9b')]})[_0xbca9('0x28')](function(_0x425acf){_0x17280f['count']=_0x425acf;_0xee4f50[_0xbca9('0x47')]=[];if(_0x50316e['query'][_0xbca9('0xa5')]){_0xee4f50['include'][_0xbca9('0xa6')]({'model':db[_0xbca9('0x7c')],'as':_0xbca9('0x7c'),'attributes':['id',_0xbca9('0x87'),_0xbca9('0xa7')]});}if(_0x50316e[_0xbca9('0x3b')][_0xbca9('0x46')]){_0xee4f50['include']=[{'all':!![]}];}return db[_0xbca9('0x61')]['findAll'](_0xee4f50);})['then'](function(_0x2b25c8){_0x17280f[_0xbca9('0xa2')]=_0x2b25c8;return _0x17280f;});}})['then'](respondWithFilteredResult(_0xb46c2f,_0xee4f50))['catch'](handleError(_0xb46c2f,null));};exports['addTags']=function(_0xe711b7,_0x1bba6b){return db['ChatInteraction'][_0xbca9('0x49')]({'where':{'id':_0xe711b7[_0xbca9('0x4b')]['id']}})[_0xbca9('0x28')](handleEntityNotFound(_0x1bba6b,null))[_0xbca9('0x28')](function(_0x11e211){if(_0x11e211){return _0x11e211[_0xbca9('0xa8')](_0xe711b7['body'][_0xbca9('0x95')],_[_0xbca9('0x96')](_0xe711b7[_0xbca9('0x2f')],[_0xbca9('0x95'),'id'])||{})[_0xbca9('0xa9')](function(){return db[_0xbca9('0xaa')]['findAll']({'attributes':['id',_0xbca9('0x2b'),_0xbca9('0xab')],'where':{'id':_0xe711b7[_0xbca9('0x2f')]['ids']}});})['then'](function(_0x3514c3){socket[_0xbca9('0xac')]('chatInteractionTags:save',{'id':Number(_0xe711b7['params']['id']),'tags':_0x3514c3||[]});return{'id':Number(_0xe711b7[_0xbca9('0x4b')]['id']),'tags':_0x3514c3||[]};});}})[_0xbca9('0x28')](respondWithResult(_0x1bba6b,null))[_0xbca9('0x1d')](handleError(_0x1bba6b,null));};exports[_0xbca9('0xad')]=function(_0x387fb2,_0x1c62c7){return db[_0xbca9('0x40')]['find']({'where':{'id':_0x387fb2[_0xbca9('0x4b')]['id']}})[_0xbca9('0x28')](handleEntityNotFound(_0x1c62c7,null))['then'](function(_0xe7059c){if(_0xe7059c){return _0xe7059c[_0xbca9('0xad')](_0x387fb2[_0xbca9('0x3b')][_0xbca9('0x95')]);}})['then'](respondWithStatusCode(_0x1c62c7,null))['catch'](handleError(_0x1c62c7,null));};exports['download']=function(_0x15b581,_0x3769c7){var _0x53db89=moment()[_0xbca9('0xae')]()['toString']();var _0x4df5e4=path[_0xbca9('0x73')](config[_0xbca9('0x74')],_0xbca9('0xaf'),_0xbca9('0xb0'),_0xbca9('0xb1'));var _0x2130e5=path[_0xbca9('0x73')](config['root'],_0xbca9('0xaf'),_0xbca9('0xb0'),_0xbca9('0xb2'));var _0x425bec=path[_0xbca9('0x73')](_0x4df5e4,_0x53db89);var _0xc351a5=util[_0xbca9('0x78')](_0xbca9('0xb3'),_0x15b581[_0xbca9('0x4b')]['id'],_0x53db89);var _0x470190=path[_0xbca9('0x73')](_0x4df5e4,_0xc351a5);var _0x468638=[];_0x468638['push']({'model':db[_0xbca9('0x7c')],'as':_0xbca9('0x7c'),'attributes':['id',_0xbca9('0x87')],'raw':!![]});_0x468638[_0xbca9('0xa6')]({'model':db['CmContact'],'as':_0xbca9('0xb4'),'attributes':['id','firstName',_0xbca9('0xb5')],'raw':!![]});if(_0x15b581[_0xbca9('0x3b')]['attachments']){_0x468638[_0xbca9('0xa6')]({'model':db['Attachment'],'as':_0xbca9('0x71'),'raw':!![]});}var _0x93a5e2=[{'model':db[_0xbca9('0x61')],'as':_0xbca9('0x7f'),'attributes':['id',_0xbca9('0x2f'),_0xbca9('0x89'),'direction',_0xbca9('0x8b'),'read'],'include':_0x468638}];_0x93a5e2[_0xbca9('0xa6')]({'model':db['ChatWebsite'],'as':_0xbca9('0xb6'),'attributes':['id',_0xbca9('0x2b')]});_0x93a5e2[_0xbca9('0xa6')]({'model':db[_0xbca9('0x7c')],'as':_0xbca9('0xb7'),'attributes':['id',_0xbca9('0x87')]});return db[_0xbca9('0x40')]['find']({'where':{'id':_0x15b581[_0xbca9('0x4b')]['id']},'include':_0x93a5e2})[_0xbca9('0x28')](handleEntityNotFound(_0x3769c7,null))['then'](function(_0x5aceef){if(_0x5aceef){var _0x4e0789=_0x5aceef[_0xbca9('0xb8')]({'plain':!![]});fs[_0xbca9('0xb9')](_0x425bec);var _0x4772cc={'channel':'Chat','account':_0x4e0789[_0xbca9('0xb6')]['name'],'agent':_0x4e0789[_0xbca9('0xb7')]?_0x4e0789[_0xbca9('0xb7')][_0xbca9('0x87')]:_0xbca9('0xba'),'createdAt':moment(_0x4e0789[_0xbca9('0x89')])['format'](_0xbca9('0xa1'))['toString'](),'closedAt':_0x4e0789['closed']?moment(_0x4e0789[_0xbca9('0xbb')])['format'](_0xbca9('0xa1'))[_0xbca9('0xbc')]():'','disposition':_0x4e0789[_0xbca9('0x69')],'chatInfo':{'browser':_0x4e0789[_0xbca9('0xbd')],'os':_0x4e0789['osName'],'referer':_0x4e0789[_0xbca9('0xbe')],'customerIp':_0x4e0789[_0xbca9('0xbf')],'customerPort':_0x4e0789['customerPort']?_0x4e0789[_0xbca9('0xc0')]:_0xbca9('0xba')},'messages':_(_0x4e0789['Messages'])[_0xbca9('0xc1')]()[_0xbca9('0x9e')]({'secret':![]})[_0xbca9('0x33')](function(_0x110ff7){if(_0x110ff7[_0xbca9('0x71')]){var _0xd4fdb0=path[_0xbca9('0x73')](_0x2130e5,_0x110ff7['Attachment'][_0xbca9('0x6e')]);if(fs[_0xbca9('0xc2')](_0xd4fdb0)){fs[_0xbca9('0xc3')](_0xd4fdb0)[_0xbca9('0xc4')](fs[_0xbca9('0xc5')](path['join'](_0x425bec,_0x110ff7[_0xbca9('0x71')][_0xbca9('0x6e')])));}}return{'date':moment(_0x110ff7[_0xbca9('0x89')])['format'](_0xbca9('0xa1'))[_0xbca9('0xbc')](),'sender':_0x110ff7[_0xbca9('0xc6')]===_0xbca9('0x60')?_0x110ff7[_0xbca9('0x7c')]?_0x110ff7[_0xbca9('0x7c')][_0xbca9('0x87')]:'System':_0x110ff7['Contact']['firstName']+(_0x110ff7['Contact']['lastName']?'\x20'+_0x110ff7[_0xbca9('0xb4')][_0xbca9('0xb5')]:''),'body':_0x110ff7[_0xbca9('0x71')]?_0x110ff7[_0xbca9('0x71')][_0xbca9('0x6e')]:_0x110ff7[_0xbca9('0x2f')],'direction':_0x110ff7['direction']===_0xbca9('0x60')?'A':'C','secret':_0x110ff7[_0xbca9('0x8b')],'read':_0x110ff7[_0xbca9('0xc7')],'attachment':_0x110ff7[_0xbca9('0x71')]};})[_0xbca9('0xc8')]()};return ejs[_0xbca9('0xc9')](path[_0xbca9('0x73')](config['root'],'server','views',_0xbca9('0xca')),{'interaction':_0x4772cc})[_0xbca9('0x28')](function(_0x5a40d7){var _0x41c9ba=path['join'](_0x425bec,_0xbca9('0xcb')+_0x4e0789['id']+'-'+_0x53db89+_0xbca9('0xcc'));var _0x27b29d={'path':_0x41c9ba,'channel':'Chat','interactionId':_0x4e0789['id']};return pdf['createPdfFromHTML'](_0x5a40d7,_0x27b29d);})[_0xbca9('0x28')](function(){return new Promise(function(_0x483983,_0x2b718a){zipdir(_0x425bec,{'saveTo':_0x470190},function(_0x51fcc2,_0x57298c){if(_0x51fcc2)return _0x2b718a(_0x51fcc2);return _0x483983(_0x57298c);});})['then'](function(){return new BPromise(function(_0x570089,_0x2f3db5){rimraf(_0x425bec,function(_0x4104e0){if(_0x4104e0)_0x2f3db5(_0x4104e0);return _0x570089();});});})[_0xbca9('0x28')](function(){return _0x3769c7[_0xbca9('0xcd')](_0x470190,_0xc351a5,function(_0x21713d){if(_0x21713d){logger[_0xbca9('0x19')](_0xbca9('0xce'),_0x21713d);}else{fs[_0xbca9('0xcf')](_0x470190);}});});});}else{return _0x3769c7[_0xbca9('0xd0')](0xc8);}})[_0xbca9('0x1d')](handleError(_0x3769c7,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 918f8e7..12971bc 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 _0x2682=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2682,0x93));var _0x2268=function(_0x352e8c,_0x1ad4ad){_0x352e8c=_0x352e8c-0x0;var _0x238005=_0x2682[_0x352e8c];return _0x238005;};'use strict';var EventEmitter=require(_0x2268('0x0'));var ChatInteraction=require(_0x2268('0x1'))['db'][_0x2268('0x2')];var ChatMessage=require(_0x2268('0x1'))['db'][_0x2268('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2268('0x4')](0x0);var events={'afterCreate':_0x2268('0x5'),'afterUpdate':'update','afterDestroy':_0x2268('0x6')};function emitEvent(_0x58b3b4){return function(_0x3a3512,_0x44d389,_0x4375ad){_0x3a3512[_0x2268('0x7')]({'attributes':['id'],'raw':!![]})[_0x2268('0x8')](function(_0x30e0ce){_0x3a3512[_0x2268('0x9')]('Users',_0x30e0ce[_0x2268('0xa')](function(_0x4d8a76){return{'id':_0x4d8a76['id']};}));return ChatMessage[_0x2268('0xb')]({'where':{'ChatInteractionId':_0x3a3512['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2268('0x8')](function(_0x29ff90){_0x3a3512[_0x2268('0x9')](_0x2268('0xc'),_0x29ff90['length']);ChatInteractionEvents[_0x2268('0xd')](_0x58b3b4+':'+_0x3a3512['id'],_0x3a3512);ChatInteractionEvents['emit'](_0x58b3b4,_0x3a3512);_0x4375ad(null);})['catch'](_0x4375ad(null));};}for(var e in events){if(events[_0x2268('0xe')](e)){var event=events[e];ChatInteraction[_0x2268('0xf')](e,emitEvent(event));}}module[_0x2268('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xd09a=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x83356b,_0x2bbd80){var _0x30d199=function(_0x29bc87){while(--_0x29bc87){_0x83356b['push'](_0x83356b['shift']());}};_0x30d199(++_0x2bbd80);}(_0xd09a,0xd9));var _0xad09=function(_0x546844,_0xd302d4){_0x546844=_0x546844-0x0;var _0x4d6b48=_0xd09a[_0x546844];return _0x4d6b48;};'use strict';var EventEmitter=require(_0xad09('0x0'));var ChatInteraction=require(_0xad09('0x1'))['db'][_0xad09('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xad09('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xad09('0x4')](0x0);var events={'afterCreate':_0xad09('0x5'),'afterUpdate':_0xad09('0x6'),'afterDestroy':_0xad09('0x7')};function emitEvent(_0x5104a8){return function(_0x167616,_0x471956,_0x3f8aaf){_0x167616[_0xad09('0x8')]({'attributes':['id'],'raw':!![]})[_0xad09('0x9')](function(_0x492546){_0x167616[_0xad09('0xa')](_0xad09('0xb'),_0x492546[_0xad09('0xc')](function(_0x23cb8b){return{'id':_0x23cb8b['id']};}));return ChatMessage[_0xad09('0xd')]({'where':{'ChatInteractionId':_0x167616['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2ebf57){_0x167616[_0xad09('0xa')](_0xad09('0xe'),_0x2ebf57[_0xad09('0xf')]);ChatInteractionEvents[_0xad09('0x10')](_0x5104a8+':'+_0x167616['id'],_0x167616);ChatInteractionEvents['emit'](_0x5104a8,_0x167616);_0x3f8aaf(null);})[_0xad09('0x11')](_0x3f8aaf(null));};}for(var e in events){if(events[_0xad09('0x12')](e)){var event=events[e];ChatInteraction[_0xad09('0x13')](e,emitEvent(event));}}module[_0xad09('0x14')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e43b18c..785f2fe 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 _0x8886=['request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8886,0x13b));var _0x6888=function(_0x2d7428,_0x4925a7){_0x2d7428=_0x2d7428-0x0;var _0x3a2c93=_0x8886[_0x2d7428];return _0x3a2c93;};'use strict';var _=require(_0x6888('0x0'));var util=require(_0x6888('0x1'));var logger=require(_0x6888('0x2'))(_0x6888('0x3'));var moment=require('moment');var BPromise=require(_0x6888('0x4'));var rp=require(_0x6888('0x5'));var fs=require('fs');var path=require(_0x6888('0x6'));var rimraf=require(_0x6888('0x7'));var config=require(_0x6888('0x8'));var attributes=require(_0x6888('0x9'));module[_0x6888('0xa')]=function(_0x5d170f,_0x30f933){return _0x5d170f[_0x6888('0xb')](_0x6888('0xc'),attributes,{'tableName':_0x6888('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x276e56,_0x22e9b0,_0x504bdd){if(_0x276e56[_0x6888('0xe')](_0x6888('0xf'))){_0x276e56[_0x6888('0x10')]=moment()[_0x6888('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x504bdd(null,_0x276e56);}},'charset':_0x6888('0x12'),'collate':_0x6888('0x13')});}; \ No newline at end of file +var _0x092e=['changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x092e,0x146));var _0xe092=function(_0x3093c0,_0x3a3b64){_0x3093c0=_0x3093c0-0x0;var _0x46e4c2=_0x092e[_0x3093c0];return _0x46e4c2;};'use strict';var _=require(_0xe092('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe092('0x1'));var fs=require('fs');var path=require(_0xe092('0x2'));var rimraf=require(_0xe092('0x3'));var config=require(_0xe092('0x4'));var attributes=require(_0xe092('0x5'));module[_0xe092('0x6')]=function(_0x511bfb,_0xb11106){return _0x511bfb[_0xe092('0x7')](_0xe092('0x8'),attributes,{'tableName':_0xe092('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e12a5,_0x40e77a,_0x4e97f2){if(_0x4e12a5[_0xe092('0xa')]('closed')){_0x4e12a5['closedAt']=moment()[_0xe092('0xb')](_0xe092('0xc'));}_0x4e97f2(null,_0x4e12a5);}},'charset':'utf8mb4','collate':_0xe092('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 97a53aa..59b01c6 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 _0xa240=['AddTags','stringify','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','then','AddTagsToChatInteraction','find','addTags','ids','omit','spread'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0xa240,0x113));var _0x0a24=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0xa240[_0x27c068];return _0xe5a67f;};'use strict';var _=require('lodash');var util=require(_0x0a24('0x0'));var moment=require('moment');var BPromise=require(_0x0a24('0x1'));var rs=require(_0x0a24('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a24('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a24('0x4'))(_0x0a24('0x5'));var config=require(_0x0a24('0x6'));var jayson=require(_0x0a24('0x7'));var client=jayson['client'][_0x0a24('0x8')]({'port':0x232a});config[_0x0a24('0x9')]=_[_0x0a24('0xa')](config[_0x0a24('0x9')],{'host':_0x0a24('0xb'),'port':0x18eb});var socket=require(_0x0a24('0xc'))(new Redis(config[_0x0a24('0x9')]));require('./chatInteraction.socket')[_0x0a24('0xd')](socket);function respondWithRpcPromise(_0x11df32,_0x1d1925,_0x5931b9){return new BPromise(function(_0x18fc8c,_0x54e201){return client['request'](_0x11df32,_0x5931b9)['then'](function(_0x4ac28e){logger[_0x0a24('0xe')](_0x0a24('0xf'),_0x1d1925,_0x0a24('0x10'));logger[_0x0a24('0x11')](_0x0a24('0x12'),_0x1d1925,'request\x20sent',JSON['stringify'](_0x4ac28e));if(_0x4ac28e[_0x0a24('0x13')]){if(_0x4ac28e['error']['code']===0x1f4){logger[_0x0a24('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x1d1925,_0x4ac28e[_0x0a24('0x13')][_0x0a24('0x14')]);return _0x54e201(_0x4ac28e[_0x0a24('0x13')][_0x0a24('0x14')]);}logger[_0x0a24('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x1d1925,_0x4ac28e[_0x0a24('0x13')][_0x0a24('0x14')]);return _0x18fc8c(_0x4ac28e[_0x0a24('0x13')][_0x0a24('0x14')]);}else{logger['info'](_0x0a24('0xf'),_0x1d1925,_0x0a24('0x10'));_0x18fc8c(_0x4ac28e[_0x0a24('0x15')][_0x0a24('0x14')]);}})[_0x0a24('0x16')](function(_0x55e3ba){logger['error'](_0x0a24('0xf'),_0x1d1925,_0x55e3ba);_0x54e201(_0x55e3ba);});});}exports[_0x0a24('0x17')]=function(_0x135234){var _0x4d0bda=this;return new Promise(function(_0x4873a0,_0x3f06a3){return db[_0x0a24('0x18')]['update'](_0x135234[_0x0a24('0x19')],{'raw':_0x135234[_0x0a24('0x1a')]?_0x135234['options'][_0x0a24('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x135234[_0x0a24('0x1a')]?_0x135234[_0x0a24('0x1a')][_0x0a24('0x1c')]||null:null,'attributes':_0x135234['options']?_0x135234[_0x0a24('0x1a')][_0x0a24('0x1d')]||null:null,'limit':_0x135234[_0x0a24('0x1a')]?_0x135234[_0x0a24('0x1a')]['limit']||null:null})[_0x0a24('0x1e')](function(_0x104986){logger[_0x0a24('0xe')]('UpdateChatInteraction',_0x135234);logger[_0x0a24('0x11')](_0x0a24('0x17'),_0x135234,JSON['stringify'](_0x104986));_0x4873a0(_0x104986);})[_0x0a24('0x16')](function(_0x12e80b){logger[_0x0a24('0x13')](_0x0a24('0x17'),_0x12e80b['message'],_0x135234);_0x3f06a3(_0x4d0bda[_0x0a24('0x13')](0x1f4,_0x12e80b[_0x0a24('0x14')]));});});};exports[_0x0a24('0x1f')]=function(_0x1f8de3){return new Promise(function(_0x5e70a4,_0x277ebd){return db[_0x0a24('0x18')][_0x0a24('0x20')]({'where':_0x1f8de3[_0x0a24('0x1a')]?_0x1f8de3[_0x0a24('0x1a')][_0x0a24('0x1c')]||null:null})['then'](function(_0x5a8168){if(_0x5a8168){return _0x5a8168[_0x0a24('0x21')](_0x1f8de3[_0x0a24('0x19')][_0x0a24('0x22')],_[_0x0a24('0x23')](_0x1f8de3[_0x0a24('0x19')],[_0x0a24('0x22'),'id'])||{});}})[_0x0a24('0x24')](function(_0x3d75c8){logger[_0x0a24('0xe')]('AddTags',_0x1f8de3);logger[_0x0a24('0x11')](_0x0a24('0x25'),_0x1f8de3,JSON[_0x0a24('0x26')](_0x3d75c8));_0x5e70a4(_0x3d75c8);})[_0x0a24('0x16')](function(_0x42c836){logger[_0x0a24('0x13')](_0x0a24('0x25'),_0x42c836[_0x0a24('0x14')],_0x1f8de3);_0x277ebd(_this[_0x0a24('0x13')](0x1f4,_0x42c836[_0x0a24('0x14')]));});});}; \ No newline at end of file +var _0x4efe=['options','where','attributes','AddTagsToChatInteraction','find','omit','ids','AddTags','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','raw'];(function(_0x11447b,_0x52f18d){var _0x58795b=function(_0x342d74){while(--_0x342d74){_0x11447b['push'](_0x11447b['shift']());}};_0x58795b(++_0x52f18d);}(_0x4efe,0x18b));var _0xe4ef=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x4efe[_0x2652ef];return _0x2db578;};'use strict';var _=require(_0xe4ef('0x0'));var util=require(_0xe4ef('0x1'));var moment=require('moment');var BPromise=require(_0xe4ef('0x2'));var rs=require(_0xe4ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe4ef('0x4'));var logger=require(_0xe4ef('0x5'))(_0xe4ef('0x6'));var config=require(_0xe4ef('0x7'));var jayson=require(_0xe4ef('0x8'));var client=jayson[_0xe4ef('0x9')][_0xe4ef('0xa')]({'port':0x232a});config[_0xe4ef('0xb')]=_[_0xe4ef('0xc')](config[_0xe4ef('0xb')],{'host':_0xe4ef('0xd'),'port':0x18eb});var socket=require(_0xe4ef('0xe'))(new Redis(config[_0xe4ef('0xb')]));require(_0xe4ef('0xf'))[_0xe4ef('0x10')](socket);function respondWithRpcPromise(_0x38f2f7,_0x220dce,_0x54cd09){return new BPromise(function(_0x448375,_0x1ccd12){return client[_0xe4ef('0x11')](_0x38f2f7,_0x54cd09)[_0xe4ef('0x12')](function(_0x2aaf55){logger[_0xe4ef('0x13')](_0xe4ef('0x14'),_0x220dce,_0xe4ef('0x15'));logger[_0xe4ef('0x16')](_0xe4ef('0x17'),_0x220dce,'request\x20sent',JSON[_0xe4ef('0x18')](_0x2aaf55));if(_0x2aaf55['error']){if(_0x2aaf55[_0xe4ef('0x19')][_0xe4ef('0x1a')]===0x1f4){logger[_0xe4ef('0x19')](_0xe4ef('0x14'),_0x220dce,_0x2aaf55[_0xe4ef('0x19')][_0xe4ef('0x1b')]);return _0x1ccd12(_0x2aaf55[_0xe4ef('0x19')][_0xe4ef('0x1b')]);}logger[_0xe4ef('0x19')](_0xe4ef('0x14'),_0x220dce,_0x2aaf55['error']['message']);return _0x448375(_0x2aaf55['error'][_0xe4ef('0x1b')]);}else{logger['info'](_0xe4ef('0x14'),_0x220dce,'request\x20sent');_0x448375(_0x2aaf55[_0xe4ef('0x1c')][_0xe4ef('0x1b')]);}})[_0xe4ef('0x1d')](function(_0x175623){logger[_0xe4ef('0x19')](_0xe4ef('0x14'),_0x220dce,_0x175623);_0x1ccd12(_0x175623);});});}exports[_0xe4ef('0x1e')]=function(_0x2f4e1c){var _0x3089ce=this;return new Promise(function(_0xf896a5,_0x542f21){return db[_0xe4ef('0x1f')][_0xe4ef('0x20')](_0x2f4e1c[_0xe4ef('0x21')],{'raw':_0x2f4e1c['options']?_0x2f4e1c['options'][_0xe4ef('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f4e1c[_0xe4ef('0x23')]?_0x2f4e1c[_0xe4ef('0x23')][_0xe4ef('0x24')]||null:null,'attributes':_0x2f4e1c['options']?_0x2f4e1c[_0xe4ef('0x23')][_0xe4ef('0x25')]||null:null,'limit':_0x2f4e1c['options']?_0x2f4e1c['options']['limit']||null:null})[_0xe4ef('0x12')](function(_0x5b6e38){logger[_0xe4ef('0x13')](_0xe4ef('0x1e'),_0x2f4e1c);logger[_0xe4ef('0x16')](_0xe4ef('0x1e'),_0x2f4e1c,JSON[_0xe4ef('0x18')](_0x5b6e38));_0xf896a5(_0x5b6e38);})[_0xe4ef('0x1d')](function(_0x4da5b5){logger[_0xe4ef('0x19')](_0xe4ef('0x1e'),_0x4da5b5['message'],_0x2f4e1c);_0x542f21(_0x3089ce[_0xe4ef('0x19')](0x1f4,_0x4da5b5[_0xe4ef('0x1b')]));});});};exports[_0xe4ef('0x26')]=function(_0x27d160){return new Promise(function(_0xbacea2,_0x59124e){return db['ChatInteraction'][_0xe4ef('0x27')]({'where':_0x27d160['options']?_0x27d160[_0xe4ef('0x23')][_0xe4ef('0x24')]||null:null})['then'](function(_0xa33f50){if(_0xa33f50){return _0xa33f50['addTags'](_0x27d160[_0xe4ef('0x21')]['ids'],_[_0xe4ef('0x28')](_0x27d160[_0xe4ef('0x21')],[_0xe4ef('0x29'),'id'])||{});}})['spread'](function(_0x3a05c1){logger[_0xe4ef('0x13')](_0xe4ef('0x2a'),_0x27d160);logger[_0xe4ef('0x16')](_0xe4ef('0x2a'),_0x27d160,JSON[_0xe4ef('0x18')](_0x3a05c1));_0xbacea2(_0x3a05c1);})[_0xe4ef('0x1d')](function(_0x3c8c9e){logger[_0xe4ef('0x19')](_0xe4ef('0x2a'),_0x3c8c9e['message'],_0x27d160);_0x59124e(_this['error'](0x1f4,_0x3c8c9e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1e492f0..b9e21fd 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 _0xa01c=['register','length','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa01c,0x14b));var _0xca01=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa01c[_0x2dafbe];return _0x58a45a;};'use strict';var ChatInteractionEvents=require(_0xca01('0x0'));var events=[_0xca01('0x1'),_0xca01('0x2'),'update'];function createListener(_0x57c6f1,_0x22c14d){return function(_0x2e9845){_0x22c14d[_0xca01('0x3')](_0x57c6f1,_0x2e9845);};}function removeListener(_0x378607,_0x48acdd){return function(){ChatInteractionEvents[_0xca01('0x4')](_0x378607,_0x48acdd);};}exports[_0xca01('0x5')]=function(_0x2afdbc){for(var _0x41ec54=0x0,_0x551eb0=events[_0xca01('0x6')];_0x41ec54<_0x551eb0;_0x41ec54++){var _0x5a42c5=events[_0x41ec54];var _0x50774c=createListener(_0xca01('0x7')+_0x5a42c5,_0x2afdbc);ChatInteractionEvents['on'](_0x5a42c5,_0x50774c);}}; \ No newline at end of file +var _0x7c92=['save','remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x5a4b16,_0x294bb1){var _0x5236dc=function(_0x33e049){while(--_0x33e049){_0x5a4b16['push'](_0x5a4b16['shift']());}};_0x5236dc(++_0x294bb1);}(_0x7c92,0x110));var _0x27c9=function(_0x56705b,_0x5af2fc){_0x56705b=_0x56705b-0x0;var _0x3d185f=_0x7c92[_0x56705b];return _0x3d185f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x27c9('0x0'),_0x27c9('0x1'),_0x27c9('0x2')];function createListener(_0x21fa38,_0x2e3fc3){return function(_0x2585a6){_0x2e3fc3[_0x27c9('0x3')](_0x21fa38,_0x2585a6);};}function removeListener(_0x2689af,_0x58e08b){return function(){ChatInteractionEvents[_0x27c9('0x4')](_0x2689af,_0x58e08b);};}exports[_0x27c9('0x5')]=function(_0x5ab768){for(var _0x2b4d59=0x0,_0x4ce72c=events[_0x27c9('0x6')];_0x2b4d59<_0x4ce72c;_0x2b4d59++){var _0x3331fa=events[_0x2b4d59];var _0x9cc79d=createListener(_0x27c9('0x7')+_0x3331fa,_0x5ab768);ChatInteractionEvents['on'](_0x3331fa,_0x9cc79d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ad32fbc..2e7f92d 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 _0x8103=['tracked','chatinteraction:addtags','addTags','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','put','/:id/close','close','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','isAuthenticated','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','format','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8103,0x119));var _0x3810=function(_0x5dea13,_0x5450bd){_0x5dea13=_0x5dea13-0x0;var _0x2bd4ce=_0x8103[_0x5dea13];return _0x2bd4ce;};'use strict';var multer=require(_0x3810('0x0'));var util=require(_0x3810('0x1'));var path=require(_0x3810('0x2'));var timeout=require(_0x3810('0x3'));var express=require(_0x3810('0x4'));var router=express[_0x3810('0x5')]();var fs_extra=require(_0x3810('0x6'));var auth=require(_0x3810('0x7'));var interaction=require(_0x3810('0x8'));var config=require(_0x3810('0x9'));var controller=require(_0x3810('0xa'));router[_0x3810('0xb')]('/',auth['isAuthenticated'](),controller[_0x3810('0xc')]);router[_0x3810('0xb')](_0x3810('0xd'),auth['isAuthenticated'](),controller[_0x3810('0xe')]);router['get'](_0x3810('0xf'),auth[_0x3810('0x10')](),controller['show']);router[_0x3810('0xb')](_0x3810('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x3810('0x12')]);router['get'](_0x3810('0x13'),auth[_0x3810('0x14')](),controller['getMessages']);router['get'](_0x3810('0x15'),auth[_0x3810('0x10')](),controller[_0x3810('0x16')]);router['get']('/:id/download',auth[_0x3810('0x14')](),controller[_0x3810('0x17')]);router[_0x3810('0x18')]('/',auth['isAuthenticated'](),controller[_0x3810('0x19')]);router[_0x3810('0x18')](_0x3810('0x1a'),auth[_0x3810('0x14')](),controller[_0x3810('0x1b')]);var upload=multer({'storage':multer[_0x3810('0x1c')]({'destination':function(_0x318df4,_0x9fdc75,_0xcbc16d){_0xcbc16d(null,path['join'](config[_0x3810('0x1d')],'server/files/attachments/'));},'filename':function(_0x198cba,_0x415019,_0x1cf131){_0x1cf131(null,util[_0x3810('0x1e')]('%s-%s',Date['now'](),_0x415019[_0x3810('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3810('0x18')](_0x3810('0x20'),upload[_0x3810('0x21')](_0x3810('0x22')),controller[_0x3810('0x23')]);router['post'](_0x3810('0x13'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0x3810('0x24'),auth[_0x3810('0x14')](),interaction[_0x3810('0x25')]('chat',_0x3810('0x26')),controller[_0x3810('0x27')]);router['put'](_0x3810('0xf'),auth[_0x3810('0x14')](),interaction[_0x3810('0x25')](_0x3810('0x28'),_0x3810('0x29')),controller[_0x3810('0x2a')]);router['put'](_0x3810('0x2b'),controller[_0x3810('0x2c')]);router['put']('/:id/abandon',auth[_0x3810('0x10')](),controller[_0x3810('0x2d')]);router[_0x3810('0x2e')](_0x3810('0x2f'),controller[_0x3810('0x30')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x3810('0x25')](_0x3810('0x28'),_0x3810('0x31')),controller[_0x3810('0x32')]);router['delete'](_0x3810('0x24'),auth['isAuthenticated'](),controller[_0x3810('0x33')]);module[_0x3810('0x34')]=router; \ No newline at end of file +var _0xe7fb=['removeTags','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy'];(function(_0x2787bf,_0x2e6a9e){var _0x4b2a50=function(_0x2f6086){while(--_0x2f6086){_0x2787bf['push'](_0x2787bf['shift']());}};_0x4b2a50(++_0x2e6a9e);}(_0xe7fb,0x192));var _0xbe7f=function(_0x5350a7,_0x235178){_0x5350a7=_0x5350a7-0x0;var _0x1862bb=_0xe7fb[_0x5350a7];return _0x1862bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe7f('0x0'));var timeout=require(_0xbe7f('0x1'));var express=require(_0xbe7f('0x2'));var router=express['Router']();var fs_extra=require(_0xbe7f('0x3'));var auth=require(_0xbe7f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbe7f('0x5'));var controller=require('./chatInteraction.controller');router[_0xbe7f('0x6')]('/',auth[_0xbe7f('0x7')](),controller[_0xbe7f('0x8')]);router[_0xbe7f('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbe7f('0x6')](_0xbe7f('0x9'),auth[_0xbe7f('0xa')](),controller[_0xbe7f('0xb')]);router[_0xbe7f('0x6')](_0xbe7f('0xc'),auth[_0xbe7f('0xa')](),controller[_0xbe7f('0xd')]);router[_0xbe7f('0x6')]('/:id/messages',auth[_0xbe7f('0x7')](),controller[_0xbe7f('0xe')]);router['get'](_0xbe7f('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xbe7f('0x10')]);router[_0xbe7f('0x6')](_0xbe7f('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xbe7f('0x12')]('/',auth[_0xbe7f('0x7')](),controller[_0xbe7f('0x13')]);router[_0xbe7f('0x12')](_0xbe7f('0x14'),auth[_0xbe7f('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xbe7f('0x15')]({'destination':function(_0x25fe54,_0xc2b5c1,_0x257d2a){_0x257d2a(null,path[_0xbe7f('0x16')](config['root'],_0xbe7f('0x17')));},'filename':function(_0x4bd991,_0x16fb83,_0x2979d4){_0x2979d4(null,util[_0xbe7f('0x18')](_0xbe7f('0x19'),Date[_0xbe7f('0x1a')](),_0x16fb83[_0xbe7f('0x1b')][_0xbe7f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbe7f('0x12')](_0xbe7f('0x1d'),upload[_0xbe7f('0x1e')](_0xbe7f('0x1f')),controller[_0xbe7f('0x20')]);router[_0xbe7f('0x12')]('/:id/messages',auth[_0xbe7f('0xa')](),controller[_0xbe7f('0x21')]);router['post'](_0xbe7f('0x22'),auth[_0xbe7f('0x7')](),interaction[_0xbe7f('0x23')](_0xbe7f('0x24'),_0xbe7f('0x25')),controller[_0xbe7f('0x26')]);router[_0xbe7f('0x27')]('/:id',auth[_0xbe7f('0x7')](),interaction[_0xbe7f('0x23')](_0xbe7f('0x24'),_0xbe7f('0x28')),controller['update']);router[_0xbe7f('0x27')]('/:id/custom_update',controller[_0xbe7f('0x29')]);router[_0xbe7f('0x27')](_0xbe7f('0x2a'),auth[_0xbe7f('0xa')](),controller[_0xbe7f('0x2b')]);router[_0xbe7f('0x27')]('/:id/close',controller[_0xbe7f('0x2c')]);router[_0xbe7f('0x2d')]('/:id',auth[_0xbe7f('0x7')](),interaction[_0xbe7f('0x23')](_0xbe7f('0x24'),_0xbe7f('0x2e')),controller[_0xbe7f('0x2f')]);router[_0xbe7f('0x2d')](_0xbe7f('0x22'),auth['isAuthenticated'](),controller[_0xbe7f('0x30')]);module[_0xbe7f('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 3d12378..c15c1d1 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 _0x36ba=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x2e6215,_0x482408){var _0xa5630=function(_0x157766){while(--_0x157766){_0x2e6215['push'](_0x2e6215['shift']());}};_0xa5630(++_0x482408);}(_0x36ba,0xbb));var _0xa36b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x36ba[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xa36b('0x0'));module['exports']={'body':{'type':Sequelize[_0xa36b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa36b('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa36b('0x3')]}}; \ No newline at end of file +var _0x4396=['sequelize','exports','TEXT','medium','INTEGER'];(function(_0xe4a0f6,_0xa0a973){var _0x13d7e0=function(_0xda678d){while(--_0xda678d){_0xe4a0f6['push'](_0xe4a0f6['shift']());}};_0x13d7e0(++_0xa0a973);}(_0x4396,0x195));var _0x6439=function(_0x1a9709,_0x2c9f31){_0x1a9709=_0x1a9709-0x0;var _0x471907=_0x4396[_0x1a9709];return _0x471907;};'use strict';var Sequelize=require(_0x6439('0x0'));module[_0x6439('0x1')]={'body':{'type':Sequelize[_0x6439('0x2')](_0x6439('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6439('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index dfd4fba..fe38362 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 _0x6ca3=['agent','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','User'];(function(_0x5be628,_0x19b98a){var _0x38846b=function(_0x388e7b){while(--_0x388e7b){_0x5be628['push'](_0x5be628['shift']());}};_0x38846b(++_0x19b98a);}(_0x6ca3,0x89));var _0x36ca=function(_0x435d49,_0xe63b56){_0x435d49=_0x435d49-0x0;var _0x40a43d=_0x6ca3[_0x435d49];return _0x40a43d;};'use strict';var emlformat=require(_0x36ca('0x0'));var rimraf=require(_0x36ca('0x1'));var zipdir=require(_0x36ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36ca('0x3'));var moment=require(_0x36ca('0x4'));var BPromise=require(_0x36ca('0x5'));var Mustache=require(_0x36ca('0x6'));var util=require('util');var path=require(_0x36ca('0x7'));var sox=require(_0x36ca('0x8'));var csv=require(_0x36ca('0x9'));var ejs=require(_0x36ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36ca('0xb'));var squel=require(_0x36ca('0xc'));var crypto=require(_0x36ca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x36ca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x36ca('0xf'));var Papa=require(_0x36ca('0x10'));var Redis=require(_0x36ca('0x11'));var authService=require(_0x36ca('0x12'));var qs=require(_0x36ca('0x13'));var as=require(_0x36ca('0x14'));var hardwareService=require(_0x36ca('0x15'));var logger=require('../../config/logger')(_0x36ca('0x16'));var utils=require('../../config/utils');var config=require(_0x36ca('0x17'));var licenseUtil=require(_0x36ca('0x18'));var db=require(_0x36ca('0x19'))['db'];config[_0x36ca('0x1a')]=_[_0x36ca('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x36ca('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x36ca('0x1d')](socket);function respondWithStatusCode(_0x423d2a,_0x190f2b){_0x190f2b=_0x190f2b||0xcc;return function(_0x4decac){if(_0x4decac){return _0x423d2a[_0x36ca('0x1e')](_0x190f2b);}return _0x423d2a[_0x36ca('0x1f')](_0x190f2b)[_0x36ca('0x20')]();};}function respondWithResult(_0x5e7adc,_0x1f91ce){_0x1f91ce=_0x1f91ce||0xc8;return function(_0x38840e){if(_0x38840e){return _0x5e7adc[_0x36ca('0x1f')](_0x1f91ce)[_0x36ca('0x21')](_0x38840e);}};}function respondWithFilteredResult(_0x29e6f7,_0x2960ee){return function(_0x13c2db){if(_0x13c2db){var _0x454bcf=typeof _0x2960ee[_0x36ca('0x22')]===_0x36ca('0x23')&&typeof _0x2960ee[_0x36ca('0x24')]===_0x36ca('0x23');var _0x50dded=_0x13c2db[_0x36ca('0x25')];var _0x384f79=_0x454bcf?0x0:_0x2960ee['offset'];var _0x90f576=_0x454bcf?_0x13c2db[_0x36ca('0x25')]:_0x2960ee[_0x36ca('0x22')]+_0x2960ee['limit'];var _0xc99a4a;if(_0x90f576>=_0x50dded){_0x90f576=_0x50dded;_0xc99a4a=0xc8;}else{_0xc99a4a=0xce;}_0x29e6f7[_0x36ca('0x1f')](_0xc99a4a);return _0x29e6f7[_0x36ca('0x26')](_0x36ca('0x27'),_0x384f79+'-'+_0x90f576+'/'+_0x50dded)[_0x36ca('0x21')](_0x13c2db);}return null;};}function patchUpdates(_0x122be1){return function(_0x274239){try{jsonpatch[_0x36ca('0x28')](_0x274239,_0x122be1,!![]);}catch(_0x99bb4c){return BPromise[_0x36ca('0x29')](_0x99bb4c);}return _0x274239[_0x36ca('0x2a')]();};}function saveUpdates(_0xcef4d4,_0x501d96){return function(_0x4031a9){if(_0x4031a9){return _0x4031a9[_0x36ca('0x2b')](_0xcef4d4)['then'](function(_0x25e987){return _0x25e987;});}return null;};}function removeEntity(_0x4b246c,_0x23ff8c){return function(_0x3f8abc){if(_0x3f8abc){return _0x3f8abc[_0x36ca('0x2c')]()[_0x36ca('0x2d')](function(){_0x4b246c[_0x36ca('0x1f')](0xcc)[_0x36ca('0x20')]();});}};}function handleEntityNotFound(_0x3308cd,_0x1d0896){return function(_0x4d105e){if(!_0x4d105e){_0x3308cd[_0x36ca('0x1e')](0x194);}return _0x4d105e;};}function handleError(_0x4e0224,_0xddd8cf){_0xddd8cf=_0xddd8cf||0x1f4;return function(_0x3436c4){logger[_0x36ca('0x2e')](_0x3436c4['stack']);if(_0x3436c4[_0x36ca('0x2f')]){delete _0x3436c4[_0x36ca('0x2f')];}_0x4e0224[_0x36ca('0x1f')](_0xddd8cf)[_0x36ca('0x30')](_0x3436c4);};}exports[_0x36ca('0x31')]=function(_0x5475ef,_0x23f95){var _0x143f7b={},_0x56afbd={},_0x2da0e4={'count':0x0,'rows':[]};var _0x2333b2=_[_0x36ca('0x32')](db[_0x36ca('0x33')][_0x36ca('0x34')],function(_0x5c7cd9){return{'name':_0x5c7cd9['fieldName'],'type':_0x5c7cd9[_0x36ca('0x35')][_0x36ca('0x36')]};});_0x56afbd[_0x36ca('0x37')]=_[_0x36ca('0x32')](_0x2333b2,'name');_0x56afbd[_0x36ca('0x38')]=_[_0x36ca('0x39')](_0x5475ef[_0x36ca('0x38')]);_0x56afbd['filters']=_[_0x36ca('0x3a')](_0x56afbd[_0x36ca('0x37')],_0x56afbd['query']);_0x143f7b[_0x36ca('0x3b')]=_[_0x36ca('0x3a')](_0x56afbd[_0x36ca('0x37')],qs[_0x36ca('0x3c')](_0x5475ef[_0x36ca('0x38')]['fields']));_0x143f7b[_0x36ca('0x3b')]=_0x143f7b['attributes'][_0x36ca('0x3d')]?_0x143f7b['attributes']:_0x56afbd['model'];if(!_0x5475ef['query'][_0x36ca('0x3e')](_0x36ca('0x3f'))){_0x143f7b['limit']=qs[_0x36ca('0x24')](_0x5475ef['query'][_0x36ca('0x24')]);_0x143f7b[_0x36ca('0x22')]=qs[_0x36ca('0x22')](_0x5475ef[_0x36ca('0x38')][_0x36ca('0x22')]);}_0x143f7b[_0x36ca('0x40')]=qs['sort'](_0x5475ef[_0x36ca('0x38')][_0x36ca('0x41')]);_0x143f7b['where']=qs[_0x36ca('0x42')](_[_0x36ca('0x43')](_0x5475ef[_0x36ca('0x38')],_0x56afbd[_0x36ca('0x42')]),_0x2333b2);if(_0x5475ef[_0x36ca('0x38')][_0x36ca('0x44')]){_0x143f7b[_0x36ca('0x45')]=_['merge'](_0x143f7b['where'],{'$or':_[_0x36ca('0x32')](_0x2333b2,function(_0x268c93){if(_0x268c93['type']!==_0x36ca('0x46')){var _0x3f4e31={};_0x3f4e31[_0x268c93[_0x36ca('0x2f')]]={'$like':'%'+_0x5475ef['query'][_0x36ca('0x44')]+'%'};return _0x3f4e31;}})});}_0x143f7b=_[_0x36ca('0x47')]({},_0x143f7b,_0x5475ef[_0x36ca('0x48')]);var _0x49ef27={'where':_0x143f7b[_0x36ca('0x45')]};return db[_0x36ca('0x33')][_0x36ca('0x25')](_0x49ef27)[_0x36ca('0x2d')](function(_0x4b0af3){_0x2da0e4['count']=_0x4b0af3;if(_0x5475ef['query'][_0x36ca('0x49')]){_0x143f7b['include']=[{'all':!![]}];}return db[_0x36ca('0x33')][_0x36ca('0x4a')](_0x143f7b);})[_0x36ca('0x2d')](function(_0xd9c5f){_0x2da0e4[_0x36ca('0x4b')]=_0xd9c5f;return _0x2da0e4;})['then'](respondWithFilteredResult(_0x23f95,_0x143f7b))[_0x36ca('0x4c')](handleError(_0x23f95,null));};exports[_0x36ca('0x4d')]=function(_0x11b94a,_0x53828c){var _0x4de21b={'raw':!![],'where':{'id':_0x11b94a['params']['id']}},_0x3f9509={};_0x3f9509[_0x36ca('0x37')]=_['keys'](db[_0x36ca('0x33')]['rawAttributes']);_0x3f9509['query']=_[_0x36ca('0x39')](_0x11b94a[_0x36ca('0x38')]);_0x3f9509['filters']=_[_0x36ca('0x3a')](_0x3f9509[_0x36ca('0x37')],_0x3f9509['query']);_0x4de21b['attributes']=_[_0x36ca('0x3a')](_0x3f9509['model'],qs['fields'](_0x11b94a[_0x36ca('0x38')][_0x36ca('0x3c')]));_0x4de21b[_0x36ca('0x3b')]=_0x4de21b[_0x36ca('0x3b')]['length']?_0x4de21b[_0x36ca('0x3b')]:_0x3f9509['model'];if(_0x11b94a[_0x36ca('0x38')]['includeAll']){_0x4de21b[_0x36ca('0x4e')]=[{'all':!![]}];}_0x4de21b=_[_0x36ca('0x47')]({},_0x4de21b,_0x11b94a[_0x36ca('0x48')]);return db['ChatInternalMessage'][_0x36ca('0x4f')](_0x4de21b)[_0x36ca('0x2d')](handleEntityNotFound(_0x53828c,null))[_0x36ca('0x2d')](respondWithResult(_0x53828c,null))[_0x36ca('0x4c')](handleError(_0x53828c,null));};exports[_0x36ca('0x50')]=function(_0x5f23c0,_0x9b9af1){return db['ChatInternalMessage'][_0x36ca('0x50')](_0x5f23c0['body'],{})[_0x36ca('0x2d')](respondWithResult(_0x9b9af1,0xc9))['catch'](handleError(_0x9b9af1,null));};exports['update']=function(_0x5469db,_0x3c632e){if(_0x5469db[_0x36ca('0x51')]['id']){delete _0x5469db['body']['id'];}return db[_0x36ca('0x33')][_0x36ca('0x4f')]({'where':{'id':_0x5469db['params']['id']}})[_0x36ca('0x2d')](handleEntityNotFound(_0x3c632e,null))[_0x36ca('0x2d')](saveUpdates(_0x5469db['body'],null))['then'](respondWithResult(_0x3c632e,null))[_0x36ca('0x4c')](handleError(_0x3c632e,null));};exports[_0x36ca('0x2c')]=function(_0x30e70a,_0x39ae39){return db[_0x36ca('0x33')]['find']({'where':{'id':_0x30e70a[_0x36ca('0x52')]['id']}})['then'](handleEntityNotFound(_0x39ae39,null))['then'](removeEntity(_0x39ae39,null))[_0x36ca('0x4c')](handleError(_0x39ae39,null));};exports[_0x36ca('0x53')]=function(_0x4332ea,_0x57cd12){return db[_0x36ca('0x33')]['describe']()[_0x36ca('0x2d')](respondWithResult(_0x57cd12,null))['catch'](handleError(_0x57cd12,null));};function wrapUser(_0xf9ae9b){return function(_0x51d7f3){var _0x2ec4ae=_0xf9ae9b[_0x36ca('0x54')]({'plain':!![]});_0x2ec4ae[_0x36ca('0x55')]=[];if(_0x51d7f3){_0x2ec4ae[_0x36ca('0x56')]=_0x51d7f3[_0x36ca('0x57')];_0x2ec4ae['lastMessage']=_0x51d7f3;}else{_0x2ec4ae['lastMessageAt']=moment(0x0)[_0x36ca('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ec4ae[_0x36ca('0x59')]={};}return _0x2ec4ae;};}exports['getUsers']=function(_0x9c71c6,_0xe3d52f,_0x54c02f){var _0x19fe85=[];return db[_0x36ca('0x5a')][_0x36ca('0x4a')]({'where':{'role':[_0x36ca('0x5b'),'admin',_0x36ca('0x5c')]},'attributes':['id',_0x36ca('0x5d'),'name',_0x36ca('0x5e'),'userpic',_0x36ca('0x5f'),_0x36ca('0x60'),_0x36ca('0x61'),_0x36ca('0x62'),_0x36ca('0x63')],'order':qs[_0x36ca('0x41')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x36ca('0x64'),'attributes':['id',_0x36ca('0x2f'),_0x36ca('0x35')],'through':{'attributes':[]}}]})[_0x36ca('0x2d')](function(_0x418947){if(_0x418947){var _0x5e5ddd=_0x9c71c6[_0x36ca('0x5c')][_0x36ca('0x54')]({'plain':!![]});if(!_0x5e5ddd)throw new Error(_0x36ca('0x65'));if(_0x5e5ddd[_0x36ca('0x5e')]===_0x36ca('0x5c')){return db[_0x36ca('0x66')][_0x36ca('0x4f')]({'where':{'name':_0x36ca('0x67'),'userProfileId':_0x5e5ddd[_0x36ca('0x68')]},'raw':!![]})[_0x36ca('0x2d')](function(_0x359f47){if(_0x359f47){if(_0x359f47[_0x36ca('0x69')]===0x0){return db[_0x36ca('0x6a')][_0x36ca('0x4a')]({'where':{'sectionId':_0x359f47['id']},'raw':!![]})[_0x36ca('0x2d')](function(_0x270481){var _0x2f452f=[];if(_[_0x36ca('0x6b')](_0x270481)){_0x2f452f=_['filter'](_0x418947,function(_0x46726c){if(_0x46726c[_0x36ca('0x5e')]!==_0x36ca('0x5b')){return _0x46726c;}});return _0x2f452f;}else{for(var _0x4bd5fa=0x0;_0x4bd5fa<_0x418947['length'];_0x4bd5fa++){var _0x520967=_0x418947[_0x4bd5fa];if(_0x520967[_0x36ca('0x5e')]===_0x36ca('0x5b')){var _0x4b8057=_[_0x36ca('0x4f')](_0x270481,function(_0x43c425){return _0x43c425[_0x36ca('0x6c')]===_0x520967['id'];});if(_0x4b8057)_0x2f452f['push'](_0x520967);}else{_0x2f452f[_0x36ca('0x6d')](_0x520967);}}return _0x2f452f;}});}else{return _0x418947;}}else{var _0x47a0e2=_['filter'](_0x418947,function(_0xf39c73){if(_0xf39c73[_0x36ca('0x5e')]!=='agent'){return _0xf39c73;}});return _0x47a0e2;}});}else{return _0x418947;}}})['then'](function(_0x3fa230){var _0x2be8ce=[];if(_0x3fa230){_0x19fe85=_0x3fa230;for(var _0x32cfcd=0x0;_0x32cfcd<_0x3fa230[_0x36ca('0x3d')];_0x32cfcd+=0x1){_0x19fe85[_0x32cfcd][_0x36ca('0x55')]=[];_0x2be8ce['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x9c71c6[_0x36ca('0x5c')]['id'],_0x3fa230[_0x32cfcd]['id']],'ToId':[_0x9c71c6['user']['id'],_0x3fa230[_0x32cfcd]['id']],'ChatGroupId':null},'attributes':['id',_0x36ca('0x57'),'FromId',_0x36ca('0x6e'),_0x36ca('0x6f'),_0x36ca('0x51')],'order':qs[_0x36ca('0x41')](_0x36ca('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x36ca('0x2d')](wrapUser(_0x3fa230[_0x32cfcd])));}return BPromise[_0x36ca('0x71')](_0x2be8ce);}return[];})['then'](function(_0x39ed2e){return{'rows':_0x39ed2e,'count':_0x39ed2e['length']};})[_0x36ca('0x2d')](respondWithResult(_0xe3d52f,null))[_0x36ca('0x4c')](handleError(_0xe3d52f,null));}; \ No newline at end of file +var _0x77c0=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ChatInternalMessage','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4728e4,_0x55f332){var _0x44ee3c=function(_0x371ceb){while(--_0x371ceb){_0x4728e4['push'](_0x4728e4['shift']());}};_0x44ee3c(++_0x55f332);}(_0x77c0,0xcf));var _0x077c=function(_0x2400b3,_0x570a48){_0x2400b3=_0x2400b3-0x0;var _0x15c59b=_0x77c0[_0x2400b3];return _0x15c59b;};'use strict';var emlformat=require(_0x077c('0x0'));var rimraf=require(_0x077c('0x1'));var zipdir=require(_0x077c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x077c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x077c('0x4'));var util=require('util');var path=require(_0x077c('0x5'));var sox=require('sox');var csv=require(_0x077c('0x6'));var ejs=require(_0x077c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x077c('0x8'));var squel=require(_0x077c('0x9'));var crypto=require(_0x077c('0xa'));var jsforce=require(_0x077c('0xb'));var deskjs=require(_0x077c('0xc'));var toCsv=require(_0x077c('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x077c('0xd'));var qs=require(_0x077c('0xe'));var as=require(_0x077c('0xf'));var hardwareService=require(_0x077c('0x10'));var logger=require(_0x077c('0x11'))(_0x077c('0x12'));var utils=require('../../config/utils');var config=require(_0x077c('0x13'));var licenseUtil=require(_0x077c('0x14'));var db=require('../../mysqldb')['db'];config[_0x077c('0x15')]=_[_0x077c('0x16')](config[_0x077c('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x077c('0x17'))(new Redis(config[_0x077c('0x15')]));require(_0x077c('0x18'))[_0x077c('0x19')](socket);function respondWithStatusCode(_0x40df28,_0x15dd9d){_0x15dd9d=_0x15dd9d||0xcc;return function(_0x30cbc9){if(_0x30cbc9){return _0x40df28[_0x077c('0x1a')](_0x15dd9d);}return _0x40df28[_0x077c('0x1b')](_0x15dd9d)['end']();};}function respondWithResult(_0x1152f6,_0x48ca2c){_0x48ca2c=_0x48ca2c||0xc8;return function(_0x40b6b1){if(_0x40b6b1){return _0x1152f6[_0x077c('0x1b')](_0x48ca2c)[_0x077c('0x1c')](_0x40b6b1);}};}function respondWithFilteredResult(_0x5610bd,_0x34f7f8){return function(_0x5304f3){if(_0x5304f3){var _0x3796b2=typeof _0x34f7f8[_0x077c('0x1d')]===_0x077c('0x1e')&&typeof _0x34f7f8[_0x077c('0x1f')]===_0x077c('0x1e');var _0x3ee528=_0x5304f3[_0x077c('0x20')];var _0x5d8def=_0x3796b2?0x0:_0x34f7f8[_0x077c('0x1d')];var _0x3fd8b4=_0x3796b2?_0x5304f3['count']:_0x34f7f8['offset']+_0x34f7f8[_0x077c('0x1f')];var _0x479eda;if(_0x3fd8b4>=_0x3ee528){_0x3fd8b4=_0x3ee528;_0x479eda=0xc8;}else{_0x479eda=0xce;}_0x5610bd[_0x077c('0x1b')](_0x479eda);return _0x5610bd['set'](_0x077c('0x21'),_0x5d8def+'-'+_0x3fd8b4+'/'+_0x3ee528)['json'](_0x5304f3);}return null;};}function patchUpdates(_0x498203){return function(_0x7fed8a){try{jsonpatch[_0x077c('0x22')](_0x7fed8a,_0x498203,!![]);}catch(_0x14edcc){return BPromise[_0x077c('0x23')](_0x14edcc);}return _0x7fed8a[_0x077c('0x24')]();};}function saveUpdates(_0x39ff20,_0x25f082){return function(_0x3bb6c3){if(_0x3bb6c3){return _0x3bb6c3[_0x077c('0x25')](_0x39ff20)[_0x077c('0x26')](function(_0x1350f5){return _0x1350f5;});}return null;};}function removeEntity(_0x3a50f8,_0x20f9b2){return function(_0xc638c2){if(_0xc638c2){return _0xc638c2[_0x077c('0x27')]()[_0x077c('0x26')](function(){_0x3a50f8[_0x077c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f2e2,_0x29d133){return function(_0xad8604){if(!_0xad8604){_0x18f2e2['sendStatus'](0x194);}return _0xad8604;};}function handleError(_0x26f5a9,_0x5e0a3d){_0x5e0a3d=_0x5e0a3d||0x1f4;return function(_0x46b723){logger[_0x077c('0x28')](_0x46b723['stack']);if(_0x46b723[_0x077c('0x29')]){delete _0x46b723['name'];}_0x26f5a9[_0x077c('0x1b')](_0x5e0a3d)[_0x077c('0x2a')](_0x46b723);};}exports['index']=function(_0x45bace,_0x56d39b){var _0x444a47={},_0x4fc9b8={},_0x233bb9={'count':0x0,'rows':[]};var _0x5bb627=_[_0x077c('0x2b')](db[_0x077c('0x2c')][_0x077c('0x2d')],function(_0x3c1975){return{'name':_0x3c1975['fieldName'],'type':_0x3c1975[_0x077c('0x2e')]['key']};});_0x4fc9b8[_0x077c('0x2f')]=_[_0x077c('0x2b')](_0x5bb627,_0x077c('0x29'));_0x4fc9b8['query']=_[_0x077c('0x30')](_0x45bace[_0x077c('0x31')]);_0x4fc9b8[_0x077c('0x32')]=_[_0x077c('0x33')](_0x4fc9b8[_0x077c('0x2f')],_0x4fc9b8[_0x077c('0x31')]);_0x444a47[_0x077c('0x34')]=_[_0x077c('0x33')](_0x4fc9b8['model'],qs[_0x077c('0x35')](_0x45bace[_0x077c('0x31')][_0x077c('0x35')]));_0x444a47['attributes']=_0x444a47[_0x077c('0x34')][_0x077c('0x36')]?_0x444a47[_0x077c('0x34')]:_0x4fc9b8['model'];if(!_0x45bace[_0x077c('0x31')][_0x077c('0x37')](_0x077c('0x38'))){_0x444a47[_0x077c('0x1f')]=qs[_0x077c('0x1f')](_0x45bace['query'][_0x077c('0x1f')]);_0x444a47[_0x077c('0x1d')]=qs[_0x077c('0x1d')](_0x45bace[_0x077c('0x31')][_0x077c('0x1d')]);}_0x444a47[_0x077c('0x39')]=qs[_0x077c('0x3a')](_0x45bace[_0x077c('0x31')][_0x077c('0x3a')]);_0x444a47[_0x077c('0x3b')]=qs[_0x077c('0x32')](_['pick'](_0x45bace[_0x077c('0x31')],_0x4fc9b8[_0x077c('0x32')]),_0x5bb627);if(_0x45bace[_0x077c('0x31')][_0x077c('0x3c')]){_0x444a47[_0x077c('0x3b')]=_[_0x077c('0x3d')](_0x444a47[_0x077c('0x3b')],{'$or':_[_0x077c('0x2b')](_0x5bb627,function(_0x546cf7){if(_0x546cf7[_0x077c('0x2e')]!==_0x077c('0x3e')){var _0x315544={};_0x315544[_0x546cf7[_0x077c('0x29')]]={'$like':'%'+_0x45bace['query'][_0x077c('0x3c')]+'%'};return _0x315544;}})});}_0x444a47=_[_0x077c('0x3d')]({},_0x444a47,_0x45bace[_0x077c('0x3f')]);var _0x32c7e0={'where':_0x444a47[_0x077c('0x3b')]};return db['ChatInternalMessage']['count'](_0x32c7e0)[_0x077c('0x26')](function(_0x359502){_0x233bb9[_0x077c('0x20')]=_0x359502;if(_0x45bace[_0x077c('0x31')]['includeAll']){_0x444a47[_0x077c('0x40')]=[{'all':!![]}];}return db[_0x077c('0x2c')][_0x077c('0x41')](_0x444a47);})[_0x077c('0x26')](function(_0x48464f){_0x233bb9[_0x077c('0x42')]=_0x48464f;return _0x233bb9;})[_0x077c('0x26')](respondWithFilteredResult(_0x56d39b,_0x444a47))[_0x077c('0x43')](handleError(_0x56d39b,null));};exports[_0x077c('0x44')]=function(_0x3ba9e3,_0x3679eb){var _0x487128={'raw':!![],'where':{'id':_0x3ba9e3[_0x077c('0x45')]['id']}},_0x7915e9={};_0x7915e9[_0x077c('0x2f')]=_[_0x077c('0x30')](db[_0x077c('0x2c')][_0x077c('0x2d')]);_0x7915e9['query']=_['keys'](_0x3ba9e3[_0x077c('0x31')]);_0x7915e9['filters']=_[_0x077c('0x33')](_0x7915e9[_0x077c('0x2f')],_0x7915e9[_0x077c('0x31')]);_0x487128['attributes']=_[_0x077c('0x33')](_0x7915e9[_0x077c('0x2f')],qs[_0x077c('0x35')](_0x3ba9e3[_0x077c('0x31')][_0x077c('0x35')]));_0x487128[_0x077c('0x34')]=_0x487128['attributes'][_0x077c('0x36')]?_0x487128[_0x077c('0x34')]:_0x7915e9['model'];if(_0x3ba9e3[_0x077c('0x31')][_0x077c('0x46')]){_0x487128[_0x077c('0x40')]=[{'all':!![]}];}_0x487128=_[_0x077c('0x3d')]({},_0x487128,_0x3ba9e3['options']);return db[_0x077c('0x2c')][_0x077c('0x47')](_0x487128)[_0x077c('0x26')](handleEntityNotFound(_0x3679eb,null))[_0x077c('0x26')](respondWithResult(_0x3679eb,null))[_0x077c('0x43')](handleError(_0x3679eb,null));};exports['create']=function(_0x2aefb7,_0x344c93){return db['ChatInternalMessage'][_0x077c('0x48')](_0x2aefb7[_0x077c('0x49')],{})[_0x077c('0x26')](respondWithResult(_0x344c93,0xc9))[_0x077c('0x43')](handleError(_0x344c93,null));};exports[_0x077c('0x25')]=function(_0x48bf2b,_0x51fa0a){if(_0x48bf2b[_0x077c('0x49')]['id']){delete _0x48bf2b[_0x077c('0x49')]['id'];}return db[_0x077c('0x2c')][_0x077c('0x47')]({'where':{'id':_0x48bf2b[_0x077c('0x45')]['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x51fa0a,null))[_0x077c('0x26')](saveUpdates(_0x48bf2b['body'],null))['then'](respondWithResult(_0x51fa0a,null))[_0x077c('0x43')](handleError(_0x51fa0a,null));};exports[_0x077c('0x27')]=function(_0x2de425,_0x14be7a){return db[_0x077c('0x2c')][_0x077c('0x47')]({'where':{'id':_0x2de425['params']['id']}})['then'](handleEntityNotFound(_0x14be7a,null))[_0x077c('0x26')](removeEntity(_0x14be7a,null))['catch'](handleError(_0x14be7a,null));};exports['describe']=function(_0x2f7f4b,_0x35668f){return db[_0x077c('0x2c')]['describe']()[_0x077c('0x26')](respondWithResult(_0x35668f,null))['catch'](handleError(_0x35668f,null));};function wrapUser(_0x191047){return function(_0x346b8f){var _0x34239a=_0x191047[_0x077c('0x4a')]({'plain':!![]});_0x34239a[_0x077c('0x4b')]=[];if(_0x346b8f){_0x34239a['lastMessageAt']=_0x346b8f[_0x077c('0x4c')];_0x34239a[_0x077c('0x4d')]=_0x346b8f;}else{_0x34239a[_0x077c('0x4e')]=moment(0x0)[_0x077c('0x4f')](_0x077c('0x50'));_0x34239a['lastMessage']={};}return _0x34239a;};}exports[_0x077c('0x51')]=function(_0x28753c,_0x48bb4f,_0x1d51f1){var _0x38b1c5=[];return db[_0x077c('0x52')][_0x077c('0x41')]({'where':{'role':[_0x077c('0x53'),'admin',_0x077c('0x54')]},'attributes':['id',_0x077c('0x55'),_0x077c('0x29'),_0x077c('0x56'),_0x077c('0x57'),_0x077c('0x58'),_0x077c('0x59'),_0x077c('0x5a'),_0x077c('0x5b'),_0x077c('0x5c')],'order':qs[_0x077c('0x3a')](_0x077c('0x5d')),'include':[{'model':db[_0x077c('0x5e')],'as':_0x077c('0x5f'),'attributes':['id',_0x077c('0x29'),_0x077c('0x2e')],'through':{'attributes':[]}}]})['then'](function(_0x1a3202){if(_0x1a3202){var _0x4fd0a8=_0x28753c['user']['get']({'plain':!![]});if(!_0x4fd0a8)throw new Error(_0x077c('0x60'));if(_0x4fd0a8[_0x077c('0x56')]===_0x077c('0x54')){return db[_0x077c('0x61')][_0x077c('0x47')]({'where':{'name':_0x077c('0x62'),'userProfileId':_0x4fd0a8[_0x077c('0x63')]},'raw':!![]})[_0x077c('0x26')](function(_0x29c4b5){if(_0x29c4b5){if(_0x29c4b5[_0x077c('0x64')]===0x0){return db[_0x077c('0x65')][_0x077c('0x41')]({'where':{'sectionId':_0x29c4b5['id']},'raw':!![]})[_0x077c('0x26')](function(_0x3e9089){var _0x185fca=[];if(_[_0x077c('0x66')](_0x3e9089)){_0x185fca=_['filter'](_0x1a3202,function(_0x35e921){if(_0x35e921[_0x077c('0x56')]!==_0x077c('0x53')){return _0x35e921;}});return _0x185fca;}else{for(var _0x392d2b=0x0;_0x392d2b<_0x1a3202['length'];_0x392d2b++){var _0x47a8f4=_0x1a3202[_0x392d2b];if(_0x47a8f4['role']===_0x077c('0x53')){var _0x5695e9=_[_0x077c('0x47')](_0x3e9089,function(_0x10541e){return _0x10541e[_0x077c('0x67')]===_0x47a8f4['id'];});if(_0x5695e9)_0x185fca[_0x077c('0x68')](_0x47a8f4);}else{_0x185fca[_0x077c('0x68')](_0x47a8f4);}}return _0x185fca;}});}else{return _0x1a3202;}}else{var _0x2f0e7e=_[_0x077c('0x3c')](_0x1a3202,function(_0x446c10){if(_0x446c10[_0x077c('0x56')]!==_0x077c('0x53')){return _0x446c10;}});return _0x2f0e7e;}});}else{return _0x1a3202;}}})['then'](function(_0x45207b){var _0x4ff3e3=[];if(_0x45207b){_0x38b1c5=_0x45207b;for(var _0x2c0530=0x0;_0x2c0530<_0x45207b['length'];_0x2c0530+=0x1){_0x38b1c5[_0x2c0530][_0x077c('0x4b')]=[];_0x4ff3e3[_0x077c('0x68')](db[_0x077c('0x2c')][_0x077c('0x47')]({'where':{'FromId':[_0x28753c[_0x077c('0x54')]['id'],_0x45207b[_0x2c0530]['id']],'ToId':[_0x28753c[_0x077c('0x54')]['id'],_0x45207b[_0x2c0530]['id']],'ChatGroupId':null},'attributes':['id',_0x077c('0x4c'),_0x077c('0x69'),_0x077c('0x6a'),_0x077c('0x6b'),'body'],'order':qs[_0x077c('0x3a')](_0x077c('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x077c('0x26')](wrapUser(_0x45207b[_0x2c0530])));}return BPromise[_0x077c('0x6d')](_0x4ff3e3);}return[];})['then'](function(_0x39554c){return{'rows':_0x39554c,'count':_0x39554c[_0x077c('0x36')]};})[_0x077c('0x26')](respondWithResult(_0x48bb4f,null))[_0x077c('0x43')](handleError(_0x48bb4f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 97606ba..f08b34d 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 _0xb5fc=['exports','events','ChatInternalMessage','save','update','remove','emit','hasOwnProperty'];(function(_0xab328c,_0x4a357a){var _0x1a3418=function(_0x6468ff){while(--_0x6468ff){_0xab328c['push'](_0xab328c['shift']());}};_0x1a3418(++_0x4a357a);}(_0xb5fc,0x1e9));var _0xcb5f=function(_0x5f4e48,_0x5baef9){_0x5f4e48=_0x5f4e48-0x0;var _0x17833f=_0xb5fc[_0x5f4e48];return _0x17833f;};'use strict';var EventEmitter=require(_0xcb5f('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xcb5f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb5f('0x2'),'afterUpdate':_0xcb5f('0x3'),'afterDestroy':_0xcb5f('0x4')};function emitEvent(_0x46626d){return function(_0x28f3af,_0xf1945f,_0x73cbfe){ChatInternalMessageEvents['emit'](_0x46626d+':'+_0x28f3af['id'],_0x28f3af);ChatInternalMessageEvents[_0xcb5f('0x5')](_0x46626d,_0x28f3af);_0x73cbfe(null);};}for(var e in events){if(events[_0xcb5f('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcb5f('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x5c70=['emit','hasOwnProperty','hook','events','../../mysqldb','save','update','remove'];(function(_0x351a2f,_0x21ea93){var _0x3f8ec7=function(_0x26803c){while(--_0x26803c){_0x351a2f['push'](_0x351a2f['shift']());}};_0x3f8ec7(++_0x21ea93);}(_0x5c70,0x123));var _0x05c7=function(_0x42d48d,_0xc7ecc){_0x42d48d=_0x42d48d-0x0;var _0x2fd8e0=_0x5c70[_0x42d48d];return _0x2fd8e0;};'use strict';var EventEmitter=require(_0x05c7('0x0'));var ChatInternalMessage=require(_0x05c7('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05c7('0x2'),'afterUpdate':_0x05c7('0x3'),'afterDestroy':_0x05c7('0x4')};function emitEvent(_0x372263){return function(_0x264dbe,_0x40209f,_0x5b9fc6){ChatInternalMessageEvents[_0x05c7('0x5')](_0x372263+':'+_0x264dbe['id'],_0x264dbe);ChatInternalMessageEvents['emit'](_0x372263,_0x264dbe);_0x5b9fc6(null);};}for(var e in events){if(events[_0x05c7('0x6')](e)){var event=events[e];ChatInternalMessage[_0x05c7('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cfc714a..bed6602 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 _0x41c2=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x41c2,0x104));var _0x241c=function(_0x228356,_0x621ba3){_0x228356=_0x228356-0x0;var _0x223053=_0x41c2[_0x228356];return _0x223053;};'use strict';var _=require('lodash');var util=require(_0x241c('0x0'));var logger=require(_0x241c('0x1'))(_0x241c('0x2'));var moment=require(_0x241c('0x3'));var BPromise=require(_0x241c('0x4'));var rp=require(_0x241c('0x5'));var fs=require('fs');var path=require(_0x241c('0x6'));var rimraf=require(_0x241c('0x7'));var config=require(_0x241c('0x8'));var attributes=require(_0x241c('0x9'));module['exports']=function(_0x20ff12,_0x1b7e6c){return _0x20ff12[_0x241c('0xa')](_0x241c('0xb'),attributes,{'tableName':_0x241c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x241c('0xd')});}; \ No newline at end of file +var _0x1f01=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x1f01,0x1b4));var _0x11f0=function(_0x2378ef,_0x1b182e){_0x2378ef=_0x2378ef-0x0;var _0x9dc6fb=_0x1f01[_0x2378ef];return _0x9dc6fb;};'use strict';var _=require(_0x11f0('0x0'));var util=require('util');var logger=require(_0x11f0('0x1'))(_0x11f0('0x2'));var moment=require(_0x11f0('0x3'));var BPromise=require(_0x11f0('0x4'));var rp=require(_0x11f0('0x5'));var fs=require('fs');var path=require(_0x11f0('0x6'));var rimraf=require('rimraf');var config=require(_0x11f0('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x11f0('0x8')]=function(_0x3d22f6,_0x501955){return _0x3d22f6[_0x11f0('0x9')](_0x11f0('0xa'),attributes,{'tableName':_0x11f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x11f0('0xc'),'collate':_0x11f0('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6c617d9..293a557 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 _0x613d=['./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x5a8978,_0x1e103c){var _0x57460b=function(_0x3a3dec){while(--_0x3a3dec){_0x5a8978['push'](_0x5a8978['shift']());}};_0x57460b(++_0x1e103c);}(_0x613d,0x177));var _0xd613=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x613d[_0xb5fc3e];return _0x2efc3c;};'use strict';var _=require(_0xd613('0x0'));var util=require(_0xd613('0x1'));var moment=require(_0xd613('0x2'));var BPromise=require('bluebird');var rs=require(_0xd613('0x3'));var fs=require('fs');var Redis=require(_0xd613('0x4'));var db=require(_0xd613('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd613('0x6'))(_0xd613('0x7'));var config=require(_0xd613('0x8'));var jayson=require(_0xd613('0x9'));var client=jayson[_0xd613('0xa')][_0xd613('0xb')]({'port':0x232a});config[_0xd613('0xc')]=_[_0xd613('0xd')](config[_0xd613('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd613('0xe'))(new Redis(config['redis']));require(_0xd613('0xf'))[_0xd613('0x10')](socket);function respondWithRpcPromise(_0x1b87a6,_0x116950,_0x17341e){return new BPromise(function(_0x30d423,_0x2f4dda){return client[_0xd613('0x11')](_0x1b87a6,_0x17341e)[_0xd613('0x12')](function(_0x2c44d7){logger[_0xd613('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x116950,_0xd613('0x14'));logger[_0xd613('0x15')](_0xd613('0x16'),_0x116950,_0xd613('0x14'),JSON[_0xd613('0x17')](_0x2c44d7));if(_0x2c44d7[_0xd613('0x18')]){if(_0x2c44d7[_0xd613('0x18')][_0xd613('0x19')]===0x1f4){logger[_0xd613('0x18')](_0xd613('0x1a'),_0x116950,_0x2c44d7[_0xd613('0x18')][_0xd613('0x1b')]);return _0x2f4dda(_0x2c44d7[_0xd613('0x18')][_0xd613('0x1b')]);}logger[_0xd613('0x18')](_0xd613('0x1a'),_0x116950,_0x2c44d7[_0xd613('0x18')][_0xd613('0x1b')]);return _0x30d423(_0x2c44d7[_0xd613('0x18')][_0xd613('0x1b')]);}else{logger[_0xd613('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x116950,_0xd613('0x14'));_0x30d423(_0x2c44d7[_0xd613('0x1c')][_0xd613('0x1b')]);}})[_0xd613('0x1d')](function(_0x1277c5){logger[_0xd613('0x18')](_0xd613('0x1a'),_0x116950,_0x1277c5);_0x2f4dda(_0x1277c5);});});} \ No newline at end of file +var _0xd2ba=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0xd2ba,0x108));var _0xad2b=function(_0x1f5e25,_0x171656){_0x1f5e25=_0x1f5e25-0x0;var _0x2fbb0a=_0xd2ba[_0x1f5e25];return _0x2fbb0a;};'use strict';var _=require(_0xad2b('0x0'));var util=require(_0xad2b('0x1'));var moment=require(_0xad2b('0x2'));var BPromise=require(_0xad2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad2b('0x4'));var db=require(_0xad2b('0x5'))['db'];var utils=require(_0xad2b('0x6'));var logger=require(_0xad2b('0x7'))(_0xad2b('0x8'));var config=require('../../config/environment');var jayson=require(_0xad2b('0x9'));var client=jayson[_0xad2b('0xa')][_0xad2b('0xb')]({'port':0x232a});config[_0xad2b('0xc')]=_[_0xad2b('0xd')](config[_0xad2b('0xc')],{'host':_0xad2b('0xe'),'port':0x18eb});var socket=require(_0xad2b('0xf'))(new Redis(config[_0xad2b('0xc')]));require(_0xad2b('0x10'))['register'](socket);function respondWithRpcPromise(_0x43b25b,_0x252d0b,_0x335aee){return new BPromise(function(_0x3e11b9,_0x18fb62){return client[_0xad2b('0x11')](_0x43b25b,_0x335aee)[_0xad2b('0x12')](function(_0x2f1bd2){logger[_0xad2b('0x13')](_0xad2b('0x14'),_0x252d0b,'request\x20sent');logger[_0xad2b('0x15')](_0xad2b('0x16'),_0x252d0b,_0xad2b('0x17'),JSON[_0xad2b('0x18')](_0x2f1bd2));if(_0x2f1bd2[_0xad2b('0x19')]){if(_0x2f1bd2[_0xad2b('0x19')][_0xad2b('0x1a')]===0x1f4){logger[_0xad2b('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x252d0b,_0x2f1bd2['error'][_0xad2b('0x1b')]);return _0x18fb62(_0x2f1bd2[_0xad2b('0x19')][_0xad2b('0x1b')]);}logger['error'](_0xad2b('0x14'),_0x252d0b,_0x2f1bd2[_0xad2b('0x19')]['message']);return _0x3e11b9(_0x2f1bd2[_0xad2b('0x19')][_0xad2b('0x1b')]);}else{logger['info'](_0xad2b('0x14'),_0x252d0b,_0xad2b('0x17'));_0x3e11b9(_0x2f1bd2[_0xad2b('0x1c')][_0xad2b('0x1b')]);}})[_0xad2b('0x1d')](function(_0x1eb48d){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x252d0b,_0x1eb48d);_0x18fb62(_0x1eb48d);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6f887fc..35c7158 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 _0x5e5f=['register','length','chatInternalMessage:','save','update','emit','removeListener'];(function(_0x18fae7,_0x1a9ef1){var _0x5e86e9=function(_0x3a519f){while(--_0x3a519f){_0x18fae7['push'](_0x18fae7['shift']());}};_0x5e86e9(++_0x1a9ef1);}(_0x5e5f,0x161));var _0xf5e5=function(_0x567bf6,_0x195a72){_0x567bf6=_0x567bf6-0x0;var _0xb223bd=_0x5e5f[_0x567bf6];return _0xb223bd;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xf5e5('0x0'),'remove',_0xf5e5('0x1')];function createListener(_0x483a6c,_0x5d10cd){return function(_0x46c923){_0x5d10cd[_0xf5e5('0x2')](_0x483a6c,_0x46c923);};}function removeListener(_0x351d13,_0x274e5b){return function(){ChatInternalMessageEvents[_0xf5e5('0x3')](_0x351d13,_0x274e5b);};}exports[_0xf5e5('0x4')]=function(_0x3a0faf){for(var _0x1aaf07=0x0,_0x282284=events[_0xf5e5('0x5')];_0x1aaf07<_0x282284;_0x1aaf07++){var _0x403aba=events[_0x1aaf07];var _0x5eeeb6=createListener(_0xf5e5('0x6')+_0x403aba,_0x3a0faf);ChatInternalMessageEvents['on'](_0x403aba,_0x5eeeb6);}}; \ No newline at end of file +var _0xa826=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa826,0x1bb));var _0x6a82=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa826[_0x5b644e];return _0x49c6bf;};'use strict';var ChatInternalMessageEvents=require(_0x6a82('0x0'));var events=[_0x6a82('0x1'),_0x6a82('0x2'),_0x6a82('0x3')];function createListener(_0xb853c8,_0x1fde65){return function(_0x3252f0){_0x1fde65[_0x6a82('0x4')](_0xb853c8,_0x3252f0);};}function removeListener(_0x4ee956,_0x5a59d6){return function(){ChatInternalMessageEvents['removeListener'](_0x4ee956,_0x5a59d6);};}exports[_0x6a82('0x5')]=function(_0x1d4e3f){for(var _0x47fbc9=0x0,_0x3c1994=events['length'];_0x47fbc9<_0x3c1994;_0x47fbc9++){var _0x16e89c=events[_0x47fbc9];var _0x270f6a=createListener(_0x6a82('0x6')+_0x16e89c,_0x1d4e3f);ChatInternalMessageEvents['on'](_0x16e89c,_0x270f6a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 58239b7..3be743d 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 _0xa0e8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','getUsers','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x38e449,_0x388d80){var _0x5e908f=function(_0x18bdea){while(--_0x18bdea){_0x38e449['push'](_0x38e449['shift']());}};_0x5e908f(++_0x388d80);}(_0xa0e8,0xbd));var _0x8a0e=function(_0x453f54,_0x28ebf2){_0x453f54=_0x453f54-0x0;var _0x46f6cc=_0xa0e8[_0x453f54];return _0x46f6cc;};'use strict';var multer=require(_0x8a0e('0x0'));var util=require(_0x8a0e('0x1'));var path=require(_0x8a0e('0x2'));var timeout=require(_0x8a0e('0x3'));var express=require(_0x8a0e('0x4'));var router=express[_0x8a0e('0x5')]();var fs_extra=require(_0x8a0e('0x6'));var auth=require(_0x8a0e('0x7'));var interaction=require(_0x8a0e('0x8'));var config=require(_0x8a0e('0x9'));var controller=require(_0x8a0e('0xa'));router[_0x8a0e('0xb')]('/',auth[_0x8a0e('0xc')](),controller[_0x8a0e('0xd')]);router[_0x8a0e('0xb')]('/describe',auth[_0x8a0e('0xc')](),controller[_0x8a0e('0xe')]);router[_0x8a0e('0xb')]('/users',auth[_0x8a0e('0xc')](),controller[_0x8a0e('0xf')]);router[_0x8a0e('0xb')](_0x8a0e('0x10'),auth['isAuthenticated'](),controller[_0x8a0e('0x11')]);router[_0x8a0e('0x12')]('/',auth['isAuthenticated'](),controller[_0x8a0e('0x13')]);router[_0x8a0e('0x14')]('/:id',controller[_0x8a0e('0x15')]);router[_0x8a0e('0x16')](_0x8a0e('0x10'),auth[_0x8a0e('0xc')](),controller[_0x8a0e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x9de7=['path','express','Router','fs-extra','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id','post','create','put','update','multer','util'];(function(_0x2e17ee,_0x561e29){var _0x3d79e4=function(_0x4fbcf9){while(--_0x4fbcf9){_0x2e17ee['push'](_0x2e17ee['shift']());}};_0x3d79e4(++_0x561e29);}(_0x9de7,0x11b));var _0x79de=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9de7[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x79de('0x0'));var util=require(_0x79de('0x1'));var path=require(_0x79de('0x2'));var timeout=require('connect-timeout');var express=require(_0x79de('0x3'));var router=express[_0x79de('0x4')]();var fs_extra=require(_0x79de('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x79de('0x6'));var controller=require(_0x79de('0x7'));router[_0x79de('0x8')]('/',auth[_0x79de('0x9')](),controller['index']);router[_0x79de('0x8')](_0x79de('0xa'),auth[_0x79de('0x9')](),controller[_0x79de('0xb')]);router[_0x79de('0x8')](_0x79de('0xc'),auth[_0x79de('0x9')](),controller[_0x79de('0xd')]);router[_0x79de('0x8')](_0x79de('0xe'),auth[_0x79de('0x9')](),controller['show']);router[_0x79de('0xf')]('/',auth[_0x79de('0x9')](),controller[_0x79de('0x10')]);router[_0x79de('0x11')](_0x79de('0xe'),controller[_0x79de('0x12')]);router['delete'](_0x79de('0xe'),auth[_0x79de('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 04996f3..3b344bc 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 _0x7497=['TEXT','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x25f6f8,_0x21b860){var _0x5c0e75=function(_0x4c0bb9){while(--_0x4c0bb9){_0x25f6f8['push'](_0x25f6f8['shift']());}};_0x5c0e75(++_0x21b860);}(_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 _0x80ed=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0x1f31c1,_0x31150d){var _0x359e23=function(_0x36c601){while(--_0x36c601){_0x1f31c1['push'](_0x1f31c1['shift']());}};_0x359e23(++_0x31150d);}(_0x80ed,0x11c));var _0xd80e=function(_0x26b076,_0x5d3368){_0x26b076=_0x26b076-0x0;var _0x1c34a2=_0x80ed[_0x26b076];return _0x1c34a2;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'body':{'type':Sequelize[_0xd80e('0x1')](_0xd80e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd80e('0x4')]('in',_0xd80e('0x5')),'defaultValue':_0xd80e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd80e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd80e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5cda6ac..af8c564 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 _0x4cdc=['localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','name','send','map','ChatMessage','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','include','findAll','show','params','find','create','body','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','ChatInteraction','ChatInteractionId','isNil','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','contact','fullname','interface','rejectmessage','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x3213b7,_0x6789ca){var _0xb960bf=function(_0x2f7f04){while(--_0x2f7f04){_0x3213b7['push'](_0x3213b7['shift']());}};_0xb960bf(++_0x6789ca);}(_0x4cdc,0xe7));var _0xc4cd=function(_0x54266c,_0x1092f7){_0x54266c=_0x54266c-0x0;var _0xc4b733=_0x4cdc[_0x54266c];return _0xc4b733;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4cd('0x0'));var moment=require(_0xc4cd('0x1'));var BPromise=require(_0xc4cd('0x2'));var Mustache=require(_0xc4cd('0x3'));var util=require(_0xc4cd('0x4'));var path=require('path');var sox=require(_0xc4cd('0x5'));var csv=require(_0xc4cd('0x6'));var ejs=require(_0xc4cd('0x7'));var fs=require('fs');var fs_extra=require(_0xc4cd('0x8'));var _=require(_0xc4cd('0x9'));var squel=require('squel');var crypto=require(_0xc4cd('0xa'));var jsforce=require(_0xc4cd('0xb'));var deskjs=require(_0xc4cd('0xc'));var toCsv=require(_0xc4cd('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4cd('0xd'));var authService=require(_0xc4cd('0xe'));var qs=require(_0xc4cd('0xf'));var as=require(_0xc4cd('0x10'));var hardwareService=require(_0xc4cd('0x11'));var logger=require('../../config/logger')(_0xc4cd('0x12'));var utils=require(_0xc4cd('0x13'));var config=require(_0xc4cd('0x14'));var licenseUtil=require(_0xc4cd('0x15'));var db=require(_0xc4cd('0x16'))['db'];config[_0xc4cd('0x17')]=_[_0xc4cd('0x18')](config[_0xc4cd('0x17')],{'host':_0xc4cd('0x19'),'port':0x18eb});var socket=require(_0xc4cd('0x1a'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xc4cd('0x1b')](socket);var jayson=require(_0xc4cd('0x1c'));var client=jayson[_0xc4cd('0x1d')][_0xc4cd('0x1e')]({'port':0x232c});var client9002=jayson[_0xc4cd('0x1d')][_0xc4cd('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc53ade,_0x258997,_0x5ea742,_0x25ff26){return new BPromise(function(_0x25463c,_0x31b9a5){var _0x5c5623=_0x25ff26||client;return _0x5c5623[_0xc4cd('0x1f')](_0xc53ade,_0x5ea742)['then'](function(_0x9fbaad){logger[_0xc4cd('0x20')](_0xc4cd('0x21'),_0x258997,_0xc4cd('0x22'));logger[_0xc4cd('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x258997,'request\x20sent',JSON[_0xc4cd('0x24')](_0x9fbaad));if(_0x9fbaad['error']){if(_0x9fbaad[_0xc4cd('0x25')][_0xc4cd('0x26')]===0x1f4){logger[_0xc4cd('0x25')](_0xc4cd('0x21'),_0x258997,_0x9fbaad[_0xc4cd('0x25')]['message']);return _0x31b9a5(_0x9fbaad[_0xc4cd('0x25')][_0xc4cd('0x27')]);}logger[_0xc4cd('0x25')](_0xc4cd('0x21'),_0x258997,_0x9fbaad[_0xc4cd('0x25')][_0xc4cd('0x27')]);return _0x25463c(_0x9fbaad[_0xc4cd('0x25')][_0xc4cd('0x27')]);}else{logger[_0xc4cd('0x20')](_0xc4cd('0x21'),_0x258997,_0xc4cd('0x22'));_0x25463c(_0x9fbaad['result'][_0xc4cd('0x27')]);}})[_0xc4cd('0x28')](function(_0x4900fe){logger['error']('ChatMessage,\x20%s,\x20%s',_0x258997,_0x4900fe);_0x31b9a5(_0x4900fe);});});}function respondWithStatusCode(_0x1c8169,_0x48b037){_0x48b037=_0x48b037||0xcc;return function(_0x2294d6){if(_0x2294d6){return _0x1c8169['sendStatus'](_0x48b037);}return _0x1c8169[_0xc4cd('0x29')](_0x48b037)[_0xc4cd('0x2a')]();};}function respondWithResult(_0x35618c,_0x30bc4b){_0x30bc4b=_0x30bc4b||0xc8;return function(_0x1c7c36){if(_0x1c7c36){return _0x35618c[_0xc4cd('0x29')](_0x30bc4b)[_0xc4cd('0x2b')](_0x1c7c36);}};}function respondWithFilteredResult(_0xc6f3af,_0x52740f){return function(_0x4a654c){if(_0x4a654c){var _0x46d159=typeof _0x52740f[_0xc4cd('0x2c')]===_0xc4cd('0x2d')&&typeof _0x52740f['limit']===_0xc4cd('0x2d');var _0x54088d=_0x4a654c[_0xc4cd('0x2e')];var _0x1252fb=_0x46d159?0x0:_0x52740f[_0xc4cd('0x2c')];var _0x1b6063=_0x46d159?_0x4a654c['count']:_0x52740f[_0xc4cd('0x2c')]+_0x52740f[_0xc4cd('0x2f')];var _0x43a9ed;if(_0x1b6063>=_0x54088d){_0x1b6063=_0x54088d;_0x43a9ed=0xc8;}else{_0x43a9ed=0xce;}_0xc6f3af[_0xc4cd('0x29')](_0x43a9ed);return _0xc6f3af[_0xc4cd('0x30')](_0xc4cd('0x31'),_0x1252fb+'-'+_0x1b6063+'/'+_0x54088d)[_0xc4cd('0x2b')](_0x4a654c);}return null;};}function patchUpdates(_0x33cde1){return function(_0x25545e){try{jsonpatch['apply'](_0x25545e,_0x33cde1,!![]);}catch(_0x2f7e3f){return BPromise[_0xc4cd('0x32')](_0x2f7e3f);}return _0x25545e[_0xc4cd('0x33')]();};}function saveUpdates(_0x51bab9,_0x28a70c){return function(_0x3e230b){if(_0x3e230b){return _0x3e230b[_0xc4cd('0x34')](_0x51bab9)[_0xc4cd('0x35')](function(_0x22de47){return _0x22de47;});}return null;};}function removeEntity(_0x47029c,_0x13aed2){return function(_0x4aef61){if(_0x4aef61){return _0x4aef61[_0xc4cd('0x36')]()[_0xc4cd('0x35')](function(){_0x47029c['status'](0xcc)[_0xc4cd('0x2a')]();});}};}function handleEntityNotFound(_0x4ccffc,_0x37b90d){return function(_0x4afe48){if(!_0x4afe48){_0x4ccffc[_0xc4cd('0x37')](0x194);}return _0x4afe48;};}function handleError(_0xe6dc9d,_0x2e2867){_0x2e2867=_0x2e2867||0x1f4;return function(_0x1f25fe){logger[_0xc4cd('0x25')](_0x1f25fe['stack']);if(_0x1f25fe[_0xc4cd('0x38')]){delete _0x1f25fe[_0xc4cd('0x38')];}_0xe6dc9d[_0xc4cd('0x29')](_0x2e2867)[_0xc4cd('0x39')](_0x1f25fe);};}exports['index']=function(_0xebe63e,_0x5e1664){var _0x243fda={},_0x5e42c7={},_0x5ebd14={'count':0x0,'rows':[]};var _0x39365b=_[_0xc4cd('0x3a')](db[_0xc4cd('0x3b')][_0xc4cd('0x3c')],function(_0x6a93b0){return{'name':_0x6a93b0['fieldName'],'type':_0x6a93b0[_0xc4cd('0x3d')][_0xc4cd('0x3e')]};});_0x5e42c7[_0xc4cd('0x3f')]=_['map'](_0x39365b,'name');_0x5e42c7['query']=_[_0xc4cd('0x40')](_0xebe63e['query']);_0x5e42c7[_0xc4cd('0x41')]=_[_0xc4cd('0x42')](_0x5e42c7[_0xc4cd('0x3f')],_0x5e42c7[_0xc4cd('0x43')]);_0x243fda[_0xc4cd('0x44')]=_[_0xc4cd('0x42')](_0x5e42c7[_0xc4cd('0x3f')],qs[_0xc4cd('0x45')](_0xebe63e[_0xc4cd('0x43')][_0xc4cd('0x45')]));_0x243fda[_0xc4cd('0x44')]=_0x243fda['attributes'][_0xc4cd('0x46')]?_0x243fda[_0xc4cd('0x44')]:_0x5e42c7[_0xc4cd('0x3f')];if(!_0xebe63e['query']['hasOwnProperty'](_0xc4cd('0x47'))){_0x243fda[_0xc4cd('0x2f')]=qs['limit'](_0xebe63e['query'][_0xc4cd('0x2f')]);_0x243fda[_0xc4cd('0x2c')]=qs[_0xc4cd('0x2c')](_0xebe63e[_0xc4cd('0x43')][_0xc4cd('0x2c')]);}_0x243fda['order']=qs[_0xc4cd('0x48')](_0xebe63e['query']['sort']);_0x243fda['where']=qs[_0xc4cd('0x41')](_['pick'](_0xebe63e[_0xc4cd('0x43')],_0x5e42c7[_0xc4cd('0x41')]),_0x39365b);if(_0xebe63e[_0xc4cd('0x43')][_0xc4cd('0x49')]){_0x243fda[_0xc4cd('0x4a')]=_[_0xc4cd('0x4b')](_0x243fda[_0xc4cd('0x4a')],{'$or':_[_0xc4cd('0x3a')](_0x39365b,function(_0xca7ce1){if(_0xca7ce1['type']!==_0xc4cd('0x4c')){var _0x6a4ba9={};_0x6a4ba9[_0xca7ce1[_0xc4cd('0x38')]]={'$like':'%'+_0xebe63e[_0xc4cd('0x43')][_0xc4cd('0x49')]+'%'};return _0x6a4ba9;}})});}_0x243fda=_[_0xc4cd('0x4b')]({},_0x243fda,_0xebe63e[_0xc4cd('0x4d')]);var _0x3cee0b={'where':_0x243fda['where']};return db[_0xc4cd('0x3b')][_0xc4cd('0x2e')](_0x3cee0b)[_0xc4cd('0x35')](function(_0x3d0289){_0x5ebd14[_0xc4cd('0x2e')]=_0x3d0289;if(_0xebe63e[_0xc4cd('0x43')]['includeAll']){_0x243fda[_0xc4cd('0x4e')]=[{'all':!![]}];}return db[_0xc4cd('0x3b')][_0xc4cd('0x4f')](_0x243fda);})[_0xc4cd('0x35')](function(_0x4b38b4){_0x5ebd14['rows']=_0x4b38b4;return _0x5ebd14;})[_0xc4cd('0x35')](respondWithFilteredResult(_0x5e1664,_0x243fda))[_0xc4cd('0x28')](handleError(_0x5e1664,null));};exports[_0xc4cd('0x50')]=function(_0x5c089d,_0x4c1f3c){var _0x5920af={'raw':!![],'where':{'id':_0x5c089d[_0xc4cd('0x51')]['id']}},_0x36e58d={};_0x36e58d[_0xc4cd('0x3f')]=_[_0xc4cd('0x40')](db[_0xc4cd('0x3b')][_0xc4cd('0x3c')]);_0x36e58d[_0xc4cd('0x43')]=_[_0xc4cd('0x40')](_0x5c089d[_0xc4cd('0x43')]);_0x36e58d[_0xc4cd('0x41')]=_['intersection'](_0x36e58d[_0xc4cd('0x3f')],_0x36e58d['query']);_0x5920af['attributes']=_['intersection'](_0x36e58d['model'],qs[_0xc4cd('0x45')](_0x5c089d['query'][_0xc4cd('0x45')]));_0x5920af['attributes']=_0x5920af[_0xc4cd('0x44')][_0xc4cd('0x46')]?_0x5920af[_0xc4cd('0x44')]:_0x36e58d[_0xc4cd('0x3f')];if(_0x5c089d[_0xc4cd('0x43')]['includeAll']){_0x5920af['include']=[{'all':!![]}];}_0x5920af=_[_0xc4cd('0x4b')]({},_0x5920af,_0x5c089d['options']);return db[_0xc4cd('0x3b')][_0xc4cd('0x52')](_0x5920af)[_0xc4cd('0x35')](handleEntityNotFound(_0x4c1f3c,null))[_0xc4cd('0x35')](respondWithResult(_0x4c1f3c,null))[_0xc4cd('0x28')](handleError(_0x4c1f3c,null));};exports[_0xc4cd('0x53')]=function(_0x2ded1e,_0x4fba3){return db['ChatMessage']['create'](_0x2ded1e[_0xc4cd('0x54')],{})[_0xc4cd('0x35')](respondWithResult(_0x4fba3,0xc9))[_0xc4cd('0x28')](handleError(_0x4fba3,null));};exports[_0xc4cd('0x34')]=function(_0x5d2665,_0x20b42a){if(_0x5d2665[_0xc4cd('0x54')]['id']){delete _0x5d2665[_0xc4cd('0x54')]['id'];}return db[_0xc4cd('0x3b')][_0xc4cd('0x52')]({'where':{'id':_0x5d2665[_0xc4cd('0x51')]['id']}})[_0xc4cd('0x35')](handleEntityNotFound(_0x20b42a,null))['then'](saveUpdates(_0x5d2665[_0xc4cd('0x54')],null))[_0xc4cd('0x35')](respondWithResult(_0x20b42a,null))[_0xc4cd('0x28')](handleError(_0x20b42a,null));};exports[_0xc4cd('0x36')]=function(_0x2ff283,_0x5997b7){return db[_0xc4cd('0x3b')][_0xc4cd('0x52')]({'where':{'id':_0x2ff283['params']['id']}})[_0xc4cd('0x35')](handleEntityNotFound(_0x5997b7,null))[_0xc4cd('0x35')](removeEntity(_0x5997b7,null))[_0xc4cd('0x28')](handleError(_0x5997b7,null));};exports[_0xc4cd('0x55')]=function(_0x5dc5e1,_0x4f8535){return db[_0xc4cd('0x3b')]['describe']()[_0xc4cd('0x35')](respondWithResult(_0x4f8535,null))[_0xc4cd('0x28')](handleError(_0x4f8535,null));};var interaction_log=require(_0xc4cd('0x56'))(_0xc4cd('0x57'));exports[_0xc4cd('0x58')]=function(_0x3962fa,_0x2f588c,_0x222646){var _0x463ea3={'agent':{},'channel':_0xc4cd('0x59')};if(_0x3962fa[_0xc4cd('0x54')]['id']){delete _0x3962fa[_0xc4cd('0x54')]['id'];}_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x5a')]=!![];_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x5b')]=moment()[_0xc4cd('0x5c')](_0xc4cd('0x5d'));_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x5e')]=_0x3962fa['body'][_0xc4cd('0x5e')]||_0x3962fa['user']['id'];_0x463ea3[_0xc4cd('0x5f')]['id']=_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x5e')];return db[_0xc4cd('0x3b')]['find']({'where':{'id':_0x3962fa[_0xc4cd('0x51')]['id'],'UserId':null}})[_0xc4cd('0x35')](handleEntityNotFound(_0x2f588c,null))[_0xc4cd('0x35')](saveUpdates(_0x3962fa[_0xc4cd('0x54')],null))[_0xc4cd('0x35')](function(_0x3dec82){if(_0x3dec82){_0x463ea3[_0xc4cd('0x27')]=_0x3dec82['get']({'plain':!![]});return db[_0xc4cd('0x60')][_0xc4cd('0x52')]({'where':{'id':_0x3dec82[_0xc4cd('0x61')]}});}return null;})[_0xc4cd('0x35')](handleEntityNotFound(_0x2f588c,null))[_0xc4cd('0x35')](function(_0x6cdfed){if(_0x6cdfed){return _0x6cdfed['update']({'UserId':_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x5e')],'read1stAt':_[_0xc4cd('0x62')](_0x6cdfed['read1stAt'])?moment()['format'](_0xc4cd('0x5d')):undefined});}return null;})[_0xc4cd('0x35')](function(_0x11c1fe){if(_0x11c1fe){_0x463ea3[_0xc4cd('0x63')]=_0x11c1fe[_0xc4cd('0x64')]({'plain':!![]});interaction_log['info'](_0xc4cd('0x65'),_0x3962fa[_0xc4cd('0x66')]['id'],_0x3962fa['user'][_0xc4cd('0x38')],_0x3962fa[_0xc4cd('0x66')][_0xc4cd('0x67')],_0x463ea3['interaction']['id'],_0x3962fa[_0xc4cd('0x54')]?JSON['stringify'](_0x3962fa[_0xc4cd('0x54')]):_0xc4cd('0x68'));return respondWithRpcPromise(_0xc4cd('0x69'),'acceptMessage',_0x463ea3);}return null;})['then'](function(_0x171a3c){var _0x296426=_0xc4cd('0x6a')+_0x171a3c[_0xc4cd('0x27')][_0xc4cd('0x6b')];return db['sequelize'][_0xc4cd('0x43')](_0x296426,{'type':db['Sequelize'][_0xc4cd('0x6c')][_0xc4cd('0x6d')],'raw':!![]})[_0xc4cd('0x35')](function(_0x287ac8){return _0x287ac8;});})['then'](function(_0x4b7454){if(_0x4b7454){_0x463ea3[_0xc4cd('0x27')]['contact']=_0x4b7454[0x0];if(!_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x5e')])return;return db['User'][_0xc4cd('0x52')]({'where':{'id':_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x5e')],'role':_0xc4cd('0x5f')},'attributes':['id',_0xc4cd('0x38'),'fullname',_0xc4cd('0x6e'),_0xc4cd('0x6f')],'raw':!![]});}return null;})[_0xc4cd('0x35')](function(_0x44325a){if(!_0x44325a)return null;_0x463ea3['message'][_0xc4cd('0x5f')]=_0x44325a;return _0x463ea3;})['then'](function(_0x2a2ec4){if(_0x2a2ec4){if(_0x3962fa[_0xc4cd('0x54')][_0xc4cd('0x70')]){_0x463ea3['message']['interface']=util['format'](_0xc4cd('0x71'),_0x3962fa[_0xc4cd('0x66')][_0xc4cd('0x38')]);_0x463ea3['message'][_0xc4cd('0x72')]=_0x463ea3[_0xc4cd('0x72')];_0x463ea3[_0xc4cd('0x27')][_0xc4cd('0x73')]=_0x463ea3[_0xc4cd('0x72')];_0x463ea3[_0xc4cd('0x27')][_0xc4cd('0x74')]=_0xc4cd('0x58');return respondWithRpcPromise(_0xc4cd('0x75'),_0xc4cd('0x75'),{'event':_0xc4cd('0x76'),'message':_[_0xc4cd('0x4b')](_0x463ea3[_0xc4cd('0x27')],JSON[_0xc4cd('0x77')](_0x463ea3[_0xc4cd('0x63')][_0xc4cd('0x78')]))},client9002)['then'](function(){return _0x463ea3;});}return _0x463ea3;}return null;})['then'](respondWithResult(_0x2f588c,null))[_0xc4cd('0x28')](handleError(_0x2f588c,null));};var interaction_log=require(_0xc4cd('0x56'))(_0xc4cd('0x57'));exports[_0xc4cd('0x32')]=function(_0x17b2e9,_0x7a8fe6,_0x3f0cde){var _0x427cb5={'agent':{},'channel':'chat'};if(_0x17b2e9[_0xc4cd('0x54')]['id']){delete _0x17b2e9['body']['id'];}_0x17b2e9['body'][_0xc4cd('0x5e')]=_0x17b2e9[_0xc4cd('0x54')][_0xc4cd('0x5e')]||_0x17b2e9['user']['id'];_0x427cb5[_0xc4cd('0x5f')]['id']=_0x17b2e9[_0xc4cd('0x54')][_0xc4cd('0x5e')];return db[_0xc4cd('0x3b')][_0xc4cd('0x52')]({'where':{'id':_0x17b2e9[_0xc4cd('0x51')]['id'],'UserId':null}})[_0xc4cd('0x35')](handleEntityNotFound(_0x7a8fe6,null))[_0xc4cd('0x35')](function(_0x1b3404){if(_0x1b3404){_0x427cb5[_0xc4cd('0x27')]=_0x1b3404[_0xc4cd('0x64')]({'plain':!![]});return db[_0xc4cd('0x60')][_0xc4cd('0x52')]({'where':{'id':_0x1b3404['ChatInteractionId']}});}return null;})[_0xc4cd('0x35')](handleEntityNotFound(_0x7a8fe6,null))[_0xc4cd('0x35')](function(_0xd45d71){if(_0xd45d71){_0x427cb5['interaction']=_0xd45d71[_0xc4cd('0x64')]({'plain':!![]});interaction_log[_0xc4cd('0x20')](_0xc4cd('0x79'),_0x17b2e9['user']['id'],_0x17b2e9[_0xc4cd('0x66')][_0xc4cd('0x38')],_0x17b2e9[_0xc4cd('0x66')][_0xc4cd('0x67')],_0x427cb5['interaction']['id'],_0x17b2e9['body']?JSON[_0xc4cd('0x24')](_0x17b2e9[_0xc4cd('0x54')]):_0xc4cd('0x68'));return respondWithRpcPromise(_0xc4cd('0x7a'),'rejectMessage',_0x427cb5);}return null;})[_0xc4cd('0x35')](function(_0x35a89b){var _0x4ba64b=_0xc4cd('0x6a')+_0x35a89b[_0xc4cd('0x27')][_0xc4cd('0x6b')];return db[_0xc4cd('0x7b')][_0xc4cd('0x43')](_0x4ba64b,{'type':db['Sequelize']['QueryTypes'][_0xc4cd('0x6d')],'raw':!![]})[_0xc4cd('0x35')](function(_0x2dee72){return _0x2dee72;});})[_0xc4cd('0x35')](function(_0x3c7dfa){if(_0x3c7dfa){_0x427cb5[_0xc4cd('0x27')][_0xc4cd('0x7c')]=_0x3c7dfa[0x0];if(!_0x17b2e9[_0xc4cd('0x54')][_0xc4cd('0x5e')])return;return db['User'][_0xc4cd('0x52')]({'where':{'id':_0x17b2e9[_0xc4cd('0x54')][_0xc4cd('0x5e')],'role':_0xc4cd('0x5f')},'attributes':['id','name',_0xc4cd('0x7d'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x4582df){if(!_0x4582df)return null;_0x427cb5[_0xc4cd('0x27')]['agent']=_0x4582df;return _0x427cb5;})[_0xc4cd('0x35')](function(_0x4570cb){if(_0x4570cb){_0x4570cb[_0xc4cd('0x27')][_0xc4cd('0x7e')]=util[_0xc4cd('0x5c')]('SIP/%s',_0x17b2e9['user'][_0xc4cd('0x38')]);_0x4570cb[_0xc4cd('0x27')][_0xc4cd('0x72')]=_0x427cb5[_0xc4cd('0x72')];_0x4570cb[_0xc4cd('0x27')][_0xc4cd('0x73')]=_0x427cb5[_0xc4cd('0x72')];_0x4570cb[_0xc4cd('0x27')][_0xc4cd('0x74')]='reject';respondWithRpcPromise(_0xc4cd('0x75'),'EventManager',{'event':_0xc4cd('0x7f'),'message':_['merge'](_0x427cb5[_0xc4cd('0x27')],JSON[_0xc4cd('0x77')](_0x427cb5['interaction'][_0xc4cd('0x78')]))},client9002);return _0x427cb5;}return null;})[_0xc4cd('0x35')](respondWithResult(_0x7a8fe6,null))[_0xc4cd('0x28')](handleError(_0x7a8fe6,null));}; \ No newline at end of file +var _0x9892=['then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','sendStatus','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','length','includeAll','options','ChatMessage','find','create','body','update','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','event','rejectmessage','rimraf','request-promise','mustache','path','sox','to-csv','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','./chatMessage.socket','client','http','request'];(function(_0x409819,_0x1a88c9){var _0x35b040=function(_0x12a9f2){while(--_0x12a9f2){_0x409819['push'](_0x409819['shift']());}};_0x35b040(++_0x1a88c9);}(_0x9892,0x66));var _0x2989=function(_0xee62c5,_0x1ac575){_0xee62c5=_0xee62c5-0x0;var _0x4eef5f=_0x9892[_0xee62c5];return _0x4eef5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2989('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2989('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2989('0x2'));var util=require('util');var path=require(_0x2989('0x3'));var sox=require(_0x2989('0x4'));var csv=require(_0x2989('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2989('0x6'));var squel=require('squel');var crypto=require(_0x2989('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2989('0x8'));var Papa=require('papaparse');var Redis=require(_0x2989('0x9'));var authService=require(_0x2989('0xa'));var qs=require(_0x2989('0xb'));var as=require(_0x2989('0xc'));var hardwareService=require(_0x2989('0xd'));var logger=require(_0x2989('0xe'))(_0x2989('0xf'));var utils=require(_0x2989('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2989('0x11'));var db=require('../../mysqldb')['db'];config[_0x2989('0x12')]=_['defaults'](config[_0x2989('0x12')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2989('0x12')]));require(_0x2989('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2989('0x14')][_0x2989('0x15')]({'port':0x232c});var client9002=jayson[_0x2989('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3b83e,_0x3398bc,_0x1fd32d,_0x20120b){return new BPromise(function(_0x331d31,_0x47a816){var _0x229d6d=_0x20120b||client;return _0x229d6d[_0x2989('0x16')](_0xd3b83e,_0x1fd32d)[_0x2989('0x17')](function(_0xb5ef09){logger['info'](_0x2989('0x18'),_0x3398bc,_0x2989('0x19'));logger[_0x2989('0x1a')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3398bc,_0x2989('0x19'),JSON[_0x2989('0x1b')](_0xb5ef09));if(_0xb5ef09[_0x2989('0x1c')]){if(_0xb5ef09[_0x2989('0x1c')][_0x2989('0x1d')]===0x1f4){logger[_0x2989('0x1c')](_0x2989('0x18'),_0x3398bc,_0xb5ef09[_0x2989('0x1c')][_0x2989('0x1e')]);return _0x47a816(_0xb5ef09[_0x2989('0x1c')][_0x2989('0x1e')]);}logger['error'](_0x2989('0x18'),_0x3398bc,_0xb5ef09[_0x2989('0x1c')][_0x2989('0x1e')]);return _0x331d31(_0xb5ef09['error'][_0x2989('0x1e')]);}else{logger[_0x2989('0x1f')](_0x2989('0x18'),_0x3398bc,_0x2989('0x19'));_0x331d31(_0xb5ef09[_0x2989('0x20')][_0x2989('0x1e')]);}})[_0x2989('0x21')](function(_0x32159c){logger[_0x2989('0x1c')](_0x2989('0x18'),_0x3398bc,_0x32159c);_0x47a816(_0x32159c);});});}function respondWithStatusCode(_0x8e971c,_0x263075){_0x263075=_0x263075||0xcc;return function(_0x10f067){if(_0x10f067){return _0x8e971c['sendStatus'](_0x263075);}return _0x8e971c[_0x2989('0x22')](_0x263075)[_0x2989('0x23')]();};}function respondWithResult(_0x295f7b,_0x15216f){_0x15216f=_0x15216f||0xc8;return function(_0x4cebca){if(_0x4cebca){return _0x295f7b[_0x2989('0x22')](_0x15216f)[_0x2989('0x24')](_0x4cebca);}};}function respondWithFilteredResult(_0x2c0500,_0x473da2){return function(_0x5e77e8){if(_0x5e77e8){var _0x3302c3=typeof _0x473da2[_0x2989('0x25')]===_0x2989('0x26')&&typeof _0x473da2[_0x2989('0x27')]===_0x2989('0x26');var _0x285180=_0x5e77e8[_0x2989('0x28')];var _0x38b96e=_0x3302c3?0x0:_0x473da2[_0x2989('0x25')];var _0x408485=_0x3302c3?_0x5e77e8[_0x2989('0x28')]:_0x473da2['offset']+_0x473da2[_0x2989('0x27')];var _0x3438e6;if(_0x408485>=_0x285180){_0x408485=_0x285180;_0x3438e6=0xc8;}else{_0x3438e6=0xce;}_0x2c0500['status'](_0x3438e6);return _0x2c0500[_0x2989('0x29')]('Content-Range',_0x38b96e+'-'+_0x408485+'/'+_0x285180)[_0x2989('0x24')](_0x5e77e8);}return null;};}function patchUpdates(_0x418076){return function(_0x3b2b4b){try{jsonpatch[_0x2989('0x2a')](_0x3b2b4b,_0x418076,!![]);}catch(_0x149dce){return BPromise[_0x2989('0x2b')](_0x149dce);}return _0x3b2b4b[_0x2989('0x2c')]();};}function saveUpdates(_0x3b4e8c,_0x444760){return function(_0x26325c){if(_0x26325c){return _0x26325c['update'](_0x3b4e8c)[_0x2989('0x17')](function(_0x7434b6){return _0x7434b6;});}return null;};}function removeEntity(_0x115ad9,_0x4a7aef){return function(_0x4c8d7f){if(_0x4c8d7f){return _0x4c8d7f[_0x2989('0x2d')]()[_0x2989('0x17')](function(){_0x115ad9[_0x2989('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259ae6,_0x237aab){return function(_0xbde017){if(!_0xbde017){_0x259ae6[_0x2989('0x2e')](0x194);}return _0xbde017;};}function handleError(_0x2e7c47,_0x49083d){_0x49083d=_0x49083d||0x1f4;return function(_0x37112b){logger[_0x2989('0x1c')](_0x37112b[_0x2989('0x2f')]);if(_0x37112b[_0x2989('0x30')]){delete _0x37112b[_0x2989('0x30')];}_0x2e7c47[_0x2989('0x22')](_0x49083d)[_0x2989('0x31')](_0x37112b);};}exports['index']=function(_0x4f5fe4,_0x2da981){var _0x463661={},_0x47e3fe={},_0x9c7eb5={'count':0x0,'rows':[]};var _0x39cce3=_[_0x2989('0x32')](db['ChatMessage'][_0x2989('0x33')],function(_0x1eaea1){return{'name':_0x1eaea1['fieldName'],'type':_0x1eaea1[_0x2989('0x34')][_0x2989('0x35')]};});_0x47e3fe[_0x2989('0x36')]=_[_0x2989('0x32')](_0x39cce3,_0x2989('0x30'));_0x47e3fe[_0x2989('0x37')]=_[_0x2989('0x38')](_0x4f5fe4['query']);_0x47e3fe[_0x2989('0x39')]=_[_0x2989('0x3a')](_0x47e3fe['model'],_0x47e3fe[_0x2989('0x37')]);_0x463661['attributes']=_['intersection'](_0x47e3fe[_0x2989('0x36')],qs[_0x2989('0x3b')](_0x4f5fe4[_0x2989('0x37')][_0x2989('0x3b')]));_0x463661[_0x2989('0x3c')]=_0x463661[_0x2989('0x3c')]['length']?_0x463661[_0x2989('0x3c')]:_0x47e3fe[_0x2989('0x36')];if(!_0x4f5fe4[_0x2989('0x37')]['hasOwnProperty'](_0x2989('0x3d'))){_0x463661['limit']=qs['limit'](_0x4f5fe4[_0x2989('0x37')][_0x2989('0x27')]);_0x463661[_0x2989('0x25')]=qs[_0x2989('0x25')](_0x4f5fe4[_0x2989('0x37')]['offset']);}_0x463661[_0x2989('0x3e')]=qs[_0x2989('0x3f')](_0x4f5fe4['query']['sort']);_0x463661[_0x2989('0x40')]=qs[_0x2989('0x39')](_[_0x2989('0x41')](_0x4f5fe4['query'],_0x47e3fe[_0x2989('0x39')]),_0x39cce3);if(_0x4f5fe4[_0x2989('0x37')][_0x2989('0x42')]){_0x463661[_0x2989('0x40')]=_[_0x2989('0x43')](_0x463661['where'],{'$or':_[_0x2989('0x32')](_0x39cce3,function(_0x797ec8){if(_0x797ec8[_0x2989('0x34')]!=='VIRTUAL'){var _0x577e4b={};_0x577e4b[_0x797ec8[_0x2989('0x30')]]={'$like':'%'+_0x4f5fe4[_0x2989('0x37')][_0x2989('0x42')]+'%'};return _0x577e4b;}})});}_0x463661=_[_0x2989('0x43')]({},_0x463661,_0x4f5fe4['options']);var _0x30c6a3={'where':_0x463661[_0x2989('0x40')]};return db['ChatMessage'][_0x2989('0x28')](_0x30c6a3)[_0x2989('0x17')](function(_0xff660d){_0x9c7eb5['count']=_0xff660d;if(_0x4f5fe4[_0x2989('0x37')]['includeAll']){_0x463661[_0x2989('0x44')]=[{'all':!![]}];}return db['ChatMessage'][_0x2989('0x45')](_0x463661);})['then'](function(_0x2bcafa){_0x9c7eb5[_0x2989('0x46')]=_0x2bcafa;return _0x9c7eb5;})[_0x2989('0x17')](respondWithFilteredResult(_0x2da981,_0x463661))['catch'](handleError(_0x2da981,null));};exports[_0x2989('0x47')]=function(_0x1dc334,_0x3a1a88){var _0xe4c387={'raw':!![],'where':{'id':_0x1dc334[_0x2989('0x48')]['id']}},_0x278aad={};_0x278aad[_0x2989('0x36')]=_[_0x2989('0x38')](db['ChatMessage'][_0x2989('0x33')]);_0x278aad['query']=_[_0x2989('0x38')](_0x1dc334[_0x2989('0x37')]);_0x278aad['filters']=_[_0x2989('0x3a')](_0x278aad[_0x2989('0x36')],_0x278aad[_0x2989('0x37')]);_0xe4c387[_0x2989('0x3c')]=_[_0x2989('0x3a')](_0x278aad[_0x2989('0x36')],qs[_0x2989('0x3b')](_0x1dc334['query'][_0x2989('0x3b')]));_0xe4c387[_0x2989('0x3c')]=_0xe4c387[_0x2989('0x3c')][_0x2989('0x49')]?_0xe4c387[_0x2989('0x3c')]:_0x278aad[_0x2989('0x36')];if(_0x1dc334[_0x2989('0x37')][_0x2989('0x4a')]){_0xe4c387[_0x2989('0x44')]=[{'all':!![]}];}_0xe4c387=_[_0x2989('0x43')]({},_0xe4c387,_0x1dc334[_0x2989('0x4b')]);return db[_0x2989('0x4c')][_0x2989('0x4d')](_0xe4c387)[_0x2989('0x17')](handleEntityNotFound(_0x3a1a88,null))[_0x2989('0x17')](respondWithResult(_0x3a1a88,null))['catch'](handleError(_0x3a1a88,null));};exports[_0x2989('0x4e')]=function(_0x5eefe5,_0x16acd8){return db[_0x2989('0x4c')][_0x2989('0x4e')](_0x5eefe5[_0x2989('0x4f')],{})[_0x2989('0x17')](respondWithResult(_0x16acd8,0xc9))['catch'](handleError(_0x16acd8,null));};exports[_0x2989('0x50')]=function(_0x2907a6,_0x20b15b){if(_0x2907a6['body']['id']){delete _0x2907a6[_0x2989('0x4f')]['id'];}return db['ChatMessage'][_0x2989('0x4d')]({'where':{'id':_0x2907a6[_0x2989('0x48')]['id']}})[_0x2989('0x17')](handleEntityNotFound(_0x20b15b,null))[_0x2989('0x17')](saveUpdates(_0x2907a6['body'],null))['then'](respondWithResult(_0x20b15b,null))[_0x2989('0x21')](handleError(_0x20b15b,null));};exports[_0x2989('0x2d')]=function(_0x4d2871,_0x45b421){return db[_0x2989('0x4c')][_0x2989('0x4d')]({'where':{'id':_0x4d2871[_0x2989('0x48')]['id']}})[_0x2989('0x17')](handleEntityNotFound(_0x45b421,null))[_0x2989('0x17')](removeEntity(_0x45b421,null))[_0x2989('0x21')](handleError(_0x45b421,null));};exports['describe']=function(_0x23520a,_0x23dfe5){return db['ChatMessage'][_0x2989('0x51')]()[_0x2989('0x17')](respondWithResult(_0x23dfe5,null))['catch'](handleError(_0x23dfe5,null));};var interaction_log=require(_0x2989('0xe'))('chat-interactions');exports[_0x2989('0x52')]=function(_0x97ed6f,_0x481325,_0x144b06){var _0x45e7e7={'agent':{},'channel':'chat'};if(_0x97ed6f['body']['id']){delete _0x97ed6f['body']['id'];}_0x97ed6f[_0x2989('0x4f')][_0x2989('0x53')]=!![];_0x97ed6f['body'][_0x2989('0x54')]=moment()[_0x2989('0x55')](_0x2989('0x56'));_0x97ed6f[_0x2989('0x4f')][_0x2989('0x57')]=_0x97ed6f['body'][_0x2989('0x57')]||_0x97ed6f[_0x2989('0x58')]['id'];_0x45e7e7[_0x2989('0x59')]['id']=_0x97ed6f['body'][_0x2989('0x57')];return db[_0x2989('0x4c')][_0x2989('0x4d')]({'where':{'id':_0x97ed6f[_0x2989('0x48')]['id'],'UserId':null}})[_0x2989('0x17')](handleEntityNotFound(_0x481325,null))[_0x2989('0x17')](saveUpdates(_0x97ed6f[_0x2989('0x4f')],null))[_0x2989('0x17')](function(_0x3f3038){if(_0x3f3038){_0x45e7e7[_0x2989('0x1e')]=_0x3f3038[_0x2989('0x5a')]({'plain':!![]});return db[_0x2989('0x5b')][_0x2989('0x4d')]({'where':{'id':_0x3f3038[_0x2989('0x5c')]}});}return null;})[_0x2989('0x17')](handleEntityNotFound(_0x481325,null))[_0x2989('0x17')](function(_0x3db992){if(_0x3db992){return _0x3db992[_0x2989('0x50')]({'UserId':_0x97ed6f[_0x2989('0x4f')][_0x2989('0x57')],'read1stAt':_[_0x2989('0x5d')](_0x3db992[_0x2989('0x5e')])?moment()[_0x2989('0x55')](_0x2989('0x56')):undefined});}return null;})[_0x2989('0x17')](function(_0x170069){if(_0x170069){_0x45e7e7[_0x2989('0x5f')]=_0x170069[_0x2989('0x5a')]({'plain':!![]});interaction_log[_0x2989('0x1f')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x97ed6f[_0x2989('0x58')]['id'],_0x97ed6f[_0x2989('0x58')][_0x2989('0x30')],_0x97ed6f[_0x2989('0x58')]['role'],_0x45e7e7['interaction']['id'],_0x97ed6f[_0x2989('0x4f')]?JSON[_0x2989('0x1b')](_0x97ed6f[_0x2989('0x4f')]):_0x2989('0x60'));return respondWithRpcPromise(_0x2989('0x61'),_0x2989('0x62'),_0x45e7e7);}return null;})[_0x2989('0x17')](function(_0xbfce1f){var _0x13f5b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbfce1f[_0x2989('0x1e')][_0x2989('0x63')];return db[_0x2989('0x64')]['query'](_0x13f5b6,{'type':db[_0x2989('0x65')][_0x2989('0x66')][_0x2989('0x67')],'raw':!![]})[_0x2989('0x17')](function(_0x5e15eb){return _0x5e15eb;});})[_0x2989('0x17')](function(_0x4a925e){if(_0x4a925e){_0x45e7e7[_0x2989('0x1e')][_0x2989('0x68')]=_0x4a925e[0x0];if(!_0x97ed6f[_0x2989('0x4f')][_0x2989('0x57')])return;return db['User'][_0x2989('0x4d')]({'where':{'id':_0x97ed6f[_0x2989('0x4f')][_0x2989('0x57')],'role':_0x2989('0x59')},'attributes':['id',_0x2989('0x30'),_0x2989('0x69'),_0x2989('0x6a'),_0x2989('0x6b')],'raw':!![]});}return null;})[_0x2989('0x17')](function(_0x1363c8){if(!_0x1363c8)return null;_0x45e7e7[_0x2989('0x1e')][_0x2989('0x59')]=_0x1363c8;return _0x45e7e7;})[_0x2989('0x17')](function(_0x36beee){if(_0x36beee){if(_0x97ed6f[_0x2989('0x4f')][_0x2989('0x6c')]){_0x45e7e7['message']['interface']=util[_0x2989('0x55')](_0x2989('0x6d'),_0x97ed6f[_0x2989('0x58')][_0x2989('0x30')]);_0x45e7e7[_0x2989('0x1e')][_0x2989('0x6e')]=_0x45e7e7[_0x2989('0x6e')];_0x45e7e7[_0x2989('0x1e')][_0x2989('0x6f')]=_0x45e7e7['channel'];_0x45e7e7[_0x2989('0x1e')]['event']=_0x2989('0x52');return respondWithRpcPromise(_0x2989('0x70'),_0x2989('0x70'),{'event':_0x2989('0x71'),'message':_[_0x2989('0x43')](_0x45e7e7['message'],JSON[_0x2989('0x72')](_0x45e7e7[_0x2989('0x5f')][_0x2989('0x73')]))},client9002)[_0x2989('0x17')](function(){return _0x45e7e7;});}return _0x45e7e7;}return null;})['then'](respondWithResult(_0x481325,null))['catch'](handleError(_0x481325,null));};var interaction_log=require(_0x2989('0xe'))(_0x2989('0x74'));exports[_0x2989('0x2b')]=function(_0x4ab8eb,_0x2e438a,_0x3a3715){var _0xf93e20={'agent':{},'channel':_0x2989('0x75')};if(_0x4ab8eb['body']['id']){delete _0x4ab8eb[_0x2989('0x4f')]['id'];}_0x4ab8eb[_0x2989('0x4f')][_0x2989('0x57')]=_0x4ab8eb[_0x2989('0x4f')][_0x2989('0x57')]||_0x4ab8eb['user']['id'];_0xf93e20[_0x2989('0x59')]['id']=_0x4ab8eb['body'][_0x2989('0x57')];return db[_0x2989('0x4c')]['find']({'where':{'id':_0x4ab8eb[_0x2989('0x48')]['id'],'UserId':null}})[_0x2989('0x17')](handleEntityNotFound(_0x2e438a,null))['then'](function(_0xf1666b){if(_0xf1666b){_0xf93e20[_0x2989('0x1e')]=_0xf1666b['get']({'plain':!![]});return db[_0x2989('0x5b')]['find']({'where':{'id':_0xf1666b[_0x2989('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x2e438a,null))['then'](function(_0xd1a663){if(_0xd1a663){_0xf93e20[_0x2989('0x5f')]=_0xd1a663['get']({'plain':!![]});interaction_log[_0x2989('0x1f')](_0x2989('0x76'),_0x4ab8eb[_0x2989('0x58')]['id'],_0x4ab8eb['user'][_0x2989('0x30')],_0x4ab8eb[_0x2989('0x58')]['role'],_0xf93e20[_0x2989('0x5f')]['id'],_0x4ab8eb[_0x2989('0x4f')]?JSON[_0x2989('0x1b')](_0x4ab8eb[_0x2989('0x4f')]):'null');return respondWithRpcPromise(_0x2989('0x77'),_0x2989('0x78'),_0xf93e20);}return null;})[_0x2989('0x17')](function(_0x37047f){var _0x5e6b90=_0x2989('0x79')+_0x37047f['message'][_0x2989('0x63')];return db[_0x2989('0x64')][_0x2989('0x37')](_0x5e6b90,{'type':db[_0x2989('0x65')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x5a8452){return _0x5a8452;});})['then'](function(_0x1d4371){if(_0x1d4371){_0xf93e20['message']['contact']=_0x1d4371[0x0];if(!_0x4ab8eb[_0x2989('0x4f')][_0x2989('0x57')])return;return db['User'][_0x2989('0x4d')]({'where':{'id':_0x4ab8eb['body']['UserId'],'role':_0x2989('0x59')},'attributes':['id','name',_0x2989('0x69'),_0x2989('0x6a'),_0x2989('0x6b')],'raw':!![]});}return null;})[_0x2989('0x17')](function(_0x415224){if(!_0x415224)return null;_0xf93e20[_0x2989('0x1e')][_0x2989('0x59')]=_0x415224;return _0xf93e20;})[_0x2989('0x17')](function(_0x222b92){if(_0x222b92){_0x222b92[_0x2989('0x1e')][_0x2989('0x7a')]=util[_0x2989('0x55')]('SIP/%s',_0x4ab8eb['user'][_0x2989('0x30')]);_0x222b92[_0x2989('0x1e')][_0x2989('0x6e')]=_0xf93e20[_0x2989('0x6e')];_0x222b92[_0x2989('0x1e')][_0x2989('0x6f')]=_0xf93e20['channel'];_0x222b92[_0x2989('0x1e')][_0x2989('0x7b')]=_0x2989('0x2b');respondWithRpcPromise(_0x2989('0x70'),_0x2989('0x70'),{'event':_0x2989('0x7c'),'message':_[_0x2989('0x43')](_0xf93e20[_0x2989('0x1e')],JSON['parse'](_0xf93e20[_0x2989('0x5f')][_0x2989('0x73')]))},client9002);return _0xf93e20;}return null;})[_0x2989('0x17')](respondWithResult(_0x2e438a,null))[_0x2989('0x21')](handleError(_0x2e438a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1899358..200a720 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 _0xfb50=['events','ChatMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0xfb50,0x100));var _0x0fb5=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xfb50[_0x3b1b23];return _0x1efc85;};'use strict';var EventEmitter=require(_0x0fb5('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x0fb5('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0fb5('0x2'),'afterUpdate':_0x0fb5('0x3'),'afterDestroy':_0x0fb5('0x4')};function emitEvent(_0x116113){return function(_0x344d1e,_0x99c4d8,_0x1a285e){ChatMessageEvents[_0x0fb5('0x5')](_0x116113+':'+_0x344d1e['id'],_0x344d1e);ChatMessageEvents[_0x0fb5('0x5')](_0x116113,_0x344d1e);_0x1a285e(null);};}for(var e in events){if(events[_0x0fb5('0x6')](e)){var event=events[e];ChatMessage[_0x0fb5('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xa6d8=['exports','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x350796,_0x1bf21f){var _0x126f19=function(_0x4d7591){while(--_0x4d7591){_0x350796['push'](_0x350796['shift']());}};_0x126f19(++_0x1bf21f);}(_0xa6d8,0x191));var _0x8a6d=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0xa6d8[_0x390143];return _0x11361b;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8a6d('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3f1d31){return function(_0x18ffd5,_0x472832,_0x1cfc4e){ChatMessageEvents[_0x8a6d('0x1')](_0x3f1d31+':'+_0x18ffd5['id'],_0x18ffd5);ChatMessageEvents[_0x8a6d('0x1')](_0x3f1d31,_0x18ffd5);_0x1cfc4e(null);};}for(var e in events){if(events[_0x8a6d('0x2')](e)){var event=events[e];ChatMessage[_0x8a6d('0x3')](e,emitEvent(event));}}module[_0x8a6d('0x4')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f182cdb..396f5b1 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 _0x294b=['isNil','UserId','ChatInteraction','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./chatMessage.attributes','exports','define','chat_messages','get','direction','toLowerCase','out','secret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require('util');var logger=require(_0xb294('0x1'))(_0xb294('0x2'));var moment=require(_0xb294('0x3'));var BPromise=require(_0xb294('0x4'));var rp=require(_0xb294('0x5'));var fs=require('fs');var path=require(_0xb294('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb294('0x7'));module[_0xb294('0x8')]=function(_0xaa6a67,_0x181f5e){return _0xaa6a67[_0xb294('0x9')]('ChatMessage',attributes,{'tableName':_0xb294('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f7677,_0x33f8e5,_0x222992){var _0x4f0a43=_0xaa6a67['models'];var _0x4d3c40=_0x1f7677[_0xb294('0xb')]({'plain':!![]});if(_0x4d3c40[_0xb294('0xc')][_0xb294('0xd')]()==='in'||_0x4d3c40[_0xb294('0xc')][_0xb294('0xd')]()===_0xb294('0xe')&&!_0x4d3c40[_0xb294('0xf')]&&!_[_0xb294('0x10')](_0x4d3c40[_0xb294('0x11')])){_0x4f0a43[_0xb294('0x12')]['findOne']({'where':{'id':_0x4d3c40['ChatInteractionId']}})[_0xb294('0x13')](function(_0x4c0959){if(_0x4c0959){_0x4c0959['update']({'lastMsgAt':_0x4d3c40[_0xb294('0x14')],'lastMsgDirection':_0x4d3c40[_0xb294('0xc')][_0xb294('0xd')]()});}})[_0xb294('0x15')](function(_0x3f7323){console[_0xb294('0x16')](_0x3f7323);});}_0x222992();}},'charset':_0xb294('0x17'),'collate':_0xb294('0x18')});}; \ No newline at end of file +var _0xa2ad=['ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa2ad,0xa3));var _0xda2a=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xa2ad[_0x644ecd];return _0x1c66ce;};'use strict';var _=require(_0xda2a('0x0'));var util=require(_0xda2a('0x1'));var logger=require(_0xda2a('0x2'))(_0xda2a('0x3'));var moment=require(_0xda2a('0x4'));var BPromise=require(_0xda2a('0x5'));var rp=require(_0xda2a('0x6'));var fs=require('fs');var path=require(_0xda2a('0x7'));var rimraf=require(_0xda2a('0x8'));var config=require(_0xda2a('0x9'));var attributes=require(_0xda2a('0xa'));module[_0xda2a('0xb')]=function(_0x23c0cd,_0x6ccbde){return _0x23c0cd[_0xda2a('0xc')]('ChatMessage',attributes,{'tableName':_0xda2a('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xda2a('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcf07a6,_0x45419a,_0x560346){var _0x97de42=_0x23c0cd[_0xda2a('0xf')];var _0x38afdc=_0xcf07a6[_0xda2a('0x10')]({'plain':!![]});if(_0x38afdc[_0xda2a('0x11')]['toLowerCase']()==='in'||_0x38afdc[_0xda2a('0x11')][_0xda2a('0x12')]()===_0xda2a('0x13')&&!_0x38afdc[_0xda2a('0x14')]&&!_[_0xda2a('0x15')](_0x38afdc[_0xda2a('0x16')])){_0x97de42[_0xda2a('0x17')][_0xda2a('0x18')]({'where':{'id':_0x38afdc[_0xda2a('0x19')]}})[_0xda2a('0x1a')](function(_0x40ca2e){if(_0x40ca2e){_0x40ca2e[_0xda2a('0x1b')]({'lastMsgAt':_0x38afdc[_0xda2a('0x1c')],'lastMsgDirection':_0x38afdc['direction']['toLowerCase']()});}})['catch'](function(_0x2c8f25){console[_0xda2a('0x1d')](_0x2c8f25);});}_0x560346();}},'charset':_0xda2a('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 1ae043d..bc213f7 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 _0xda30=['client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0xda30,0x130));var _0x0da3=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xda30[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0x0da3('0x0'));var util=require(_0x0da3('0x1'));var moment=require(_0x0da3('0x2'));var BPromise=require(_0x0da3('0x3'));var rs=require(_0x0da3('0x4'));var fs=require('fs');var Redis=require(_0x0da3('0x5'));var db=require(_0x0da3('0x6'))['db'];var utils=require(_0x0da3('0x7'));var logger=require(_0x0da3('0x8'))('rpc');var config=require(_0x0da3('0x9'));var jayson=require(_0x0da3('0xa'));var client=jayson[_0x0da3('0xb')][_0x0da3('0xc')]({'port':0x232a});config['redis']=_[_0x0da3('0xd')](config[_0x0da3('0xe')],{'host':_0x0da3('0xf'),'port':0x18eb});var socket=require(_0x0da3('0x10'))(new Redis(config[_0x0da3('0xe')]));require(_0x0da3('0x11'))[_0x0da3('0x12')](socket);function respondWithRpcPromise(_0x1ae2d7,_0x1fa7c6,_0x378486){return new BPromise(function(_0x4ef08a,_0x5e7a56){return client[_0x0da3('0x13')](_0x1ae2d7,_0x378486)[_0x0da3('0x14')](function(_0x4668ac){logger['info'](_0x0da3('0x15'),_0x1fa7c6,'request\x20sent');logger['debug'](_0x0da3('0x16'),_0x1fa7c6,_0x0da3('0x17'),JSON['stringify'](_0x4668ac));if(_0x4668ac['error']){if(_0x4668ac[_0x0da3('0x18')][_0x0da3('0x19')]===0x1f4){logger[_0x0da3('0x18')](_0x0da3('0x15'),_0x1fa7c6,_0x4668ac[_0x0da3('0x18')][_0x0da3('0x1a')]);return _0x5e7a56(_0x4668ac[_0x0da3('0x18')][_0x0da3('0x1a')]);}logger[_0x0da3('0x18')](_0x0da3('0x15'),_0x1fa7c6,_0x4668ac[_0x0da3('0x18')]['message']);return _0x4ef08a(_0x4668ac[_0x0da3('0x18')][_0x0da3('0x1a')]);}else{logger[_0x0da3('0x1b')](_0x0da3('0x15'),_0x1fa7c6,'request\x20sent');_0x4ef08a(_0x4668ac['result'][_0x0da3('0x1a')]);}})['catch'](function(_0x2c9d63){logger[_0x0da3('0x18')]('ChatMessage,\x20%s,\x20%s',_0x1fa7c6,_0x2c9d63);_0x5e7a56(_0x2c9d63);});});}exports[_0x0da3('0x1c')]=function(_0x4e86e9){var _0x21eb6f=this;return new Promise(function(_0x5cefac,_0x5ebd10){return db[_0x0da3('0x1d')][_0x0da3('0x1e')](_0x4e86e9[_0x0da3('0x1f')],{'raw':_0x4e86e9[_0x0da3('0x20')]?_0x4e86e9[_0x0da3('0x20')][_0x0da3('0x21')]===undefined?!![]:![]:!![]})[_0x0da3('0x14')](function(_0x3ba1b6){logger[_0x0da3('0x1b')](_0x0da3('0x1c'),_0x4e86e9);logger[_0x0da3('0x22')]('CreateChatMessage',_0x4e86e9,JSON['stringify'](_0x3ba1b6));_0x5cefac(_0x3ba1b6);})['catch'](function(_0x18b94c){logger[_0x0da3('0x18')](_0x0da3('0x1c'),_0x18b94c[_0x0da3('0x1a')],_0x4e86e9);_0x5ebd10(_0x21eb6f['error'](0x1f4,_0x18b94c[_0x0da3('0x1a')]));});});}; \ No newline at end of file +var _0x430a=['localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults'];(function(_0x169ea9,_0xf9fc24){var _0x1ab3e3=function(_0x2a2c45){while(--_0x2a2c45){_0x169ea9['push'](_0x169ea9['shift']());}};_0x1ab3e3(++_0xf9fc24);}(_0x430a,0xaf));var _0xa430=function(_0x1d3722,_0x2f0d1a){_0x1d3722=_0x1d3722-0x0;var _0x44f53e=_0x430a[_0x1d3722];return _0x44f53e;};'use strict';var _=require(_0xa430('0x0'));var util=require('util');var moment=require(_0xa430('0x1'));var BPromise=require(_0xa430('0x2'));var rs=require(_0xa430('0x3'));var fs=require('fs');var Redis=require(_0xa430('0x4'));var db=require(_0xa430('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa430('0x6'));var client=jayson[_0xa430('0x7')][_0xa430('0x8')]({'port':0x232a});config[_0xa430('0x9')]=_[_0xa430('0xa')](config[_0xa430('0x9')],{'host':_0xa430('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa430('0x9')]));require('./chatMessage.socket')[_0xa430('0xc')](socket);function respondWithRpcPromise(_0x23e25d,_0x5b13d5,_0x2e3f8e){return new BPromise(function(_0x10f3bc,_0x160e82){return client[_0xa430('0xd')](_0x23e25d,_0x2e3f8e)[_0xa430('0xe')](function(_0x2cb82b){logger[_0xa430('0xf')](_0xa430('0x10'),_0x5b13d5,_0xa430('0x11'));logger[_0xa430('0x12')](_0xa430('0x13'),_0x5b13d5,'request\x20sent',JSON[_0xa430('0x14')](_0x2cb82b));if(_0x2cb82b[_0xa430('0x15')]){if(_0x2cb82b['error'][_0xa430('0x16')]===0x1f4){logger[_0xa430('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5b13d5,_0x2cb82b[_0xa430('0x15')]['message']);return _0x160e82(_0x2cb82b[_0xa430('0x15')]['message']);}logger[_0xa430('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5b13d5,_0x2cb82b[_0xa430('0x15')][_0xa430('0x17')]);return _0x10f3bc(_0x2cb82b[_0xa430('0x15')][_0xa430('0x17')]);}else{logger[_0xa430('0xf')](_0xa430('0x10'),_0x5b13d5,_0xa430('0x11'));_0x10f3bc(_0x2cb82b[_0xa430('0x18')]['message']);}})[_0xa430('0x19')](function(_0x4f8e5f){logger['error'](_0xa430('0x10'),_0x5b13d5,_0x4f8e5f);_0x160e82(_0x4f8e5f);});});}exports[_0xa430('0x1a')]=function(_0x20b41a){var _0x21cbf4=this;return new Promise(function(_0x4d86da,_0x351b85){return db[_0xa430('0x1b')][_0xa430('0x1c')](_0x20b41a['body'],{'raw':_0x20b41a[_0xa430('0x1d')]?_0x20b41a[_0xa430('0x1d')][_0xa430('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x732f14){logger['info'](_0xa430('0x1a'),_0x20b41a);logger[_0xa430('0x12')](_0xa430('0x1a'),_0x20b41a,JSON['stringify'](_0x732f14));_0x4d86da(_0x732f14);})[_0xa430('0x19')](function(_0x5b60e3){logger[_0xa430('0x15')](_0xa430('0x1a'),_0x5b60e3[_0xa430('0x17')],_0x20b41a);_0x351b85(_0x21cbf4[_0xa430('0x15')](0x1f4,_0x5b60e3[_0xa430('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a4f3e90..4bd9665 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 _0x919e=['save','remove','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0xfa5872,_0x2e79b3){var _0x2258be=function(_0x940eaa){while(--_0x940eaa){_0xfa5872['push'](_0xfa5872['shift']());}};_0x2258be(++_0x2e79b3);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var ChatMessageEvents=require(_0xe919('0x0'));var events=[_0xe919('0x1'),_0xe919('0x2'),'update'];function createListener(_0x115b01,_0x55cc54){return function(_0x4f9fcd){_0x55cc54[_0xe919('0x3')](_0x115b01,_0x4f9fcd);};}function removeListener(_0x3a1192,_0x2bf552){return function(){ChatMessageEvents[_0xe919('0x4')](_0x3a1192,_0x2bf552);};}exports[_0xe919('0x5')]=function(_0x5a27ad){for(var _0x1225a5=0x0,_0x493b47=events[_0xe919('0x6')];_0x1225a5<_0x493b47;_0x1225a5++){var _0x2ceb41=events[_0x1225a5];var _0x57c3fe=createListener(_0xe919('0x7')+_0x2ceb41,_0x5a27ad);ChatMessageEvents['on'](_0x2ceb41,_0x57c3fe);}}; \ No newline at end of file +var _0x0734=['./chatMessage.events','save','remove','update','emit','length'];(function(_0x35fa92,_0x767876){var _0x325ee7=function(_0x3a8106){while(--_0x3a8106){_0x35fa92['push'](_0x35fa92['shift']());}};_0x325ee7(++_0x767876);}(_0x0734,0xba));var _0x4073=function(_0x42bb77,_0x1dbacb){_0x42bb77=_0x42bb77-0x0;var _0x216d35=_0x0734[_0x42bb77];return _0x216d35;};'use strict';var ChatMessageEvents=require(_0x4073('0x0'));var events=[_0x4073('0x1'),_0x4073('0x2'),_0x4073('0x3')];function createListener(_0x180ec1,_0x4f26bb){return function(_0x3f9666){_0x4f26bb[_0x4073('0x4')](_0x180ec1,_0x3f9666);};}function removeListener(_0x1103ae,_0x415321){return function(){ChatMessageEvents['removeListener'](_0x1103ae,_0x415321);};}exports['register']=function(_0x9d7fe4){for(var _0x547688=0x0,_0x2c3c14=events[_0x4073('0x5')];_0x547688<_0x2c3c14;_0x547688++){var _0x1251bd=events[_0x547688];var _0x22a33d=createListener('chatMessage:'+_0x1251bd,_0x9d7fe4);ChatMessageEvents['on'](_0x1251bd,_0x22a33d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index eb8668c..382ffaa 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 _0xb889=['../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1db714,_0x2dd048){var _0x1ec556=function(_0x4d35fe){while(--_0x4d35fe){_0x1db714['push'](_0x1db714['shift']());}};_0x1ec556(++_0x2dd048);}(_0xb889,0x68));var _0x9b88=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xb889[_0x32b542];return _0x554d54;};'use strict';var multer=require(_0x9b88('0x0'));var util=require(_0x9b88('0x1'));var path=require(_0x9b88('0x2'));var timeout=require(_0x9b88('0x3'));var express=require(_0x9b88('0x4'));var router=express['Router']();var fs_extra=require(_0x9b88('0x5'));var auth=require(_0x9b88('0x6'));var interaction=require(_0x9b88('0x7'));var config=require(_0x9b88('0x8'));var controller=require(_0x9b88('0x9'));router[_0x9b88('0xa')]('/',auth[_0x9b88('0xb')](),controller['index']);router[_0x9b88('0xa')](_0x9b88('0xc'),auth[_0x9b88('0xb')](),controller[_0x9b88('0xd')]);router[_0x9b88('0xa')](_0x9b88('0xe'),auth[_0x9b88('0xb')](),controller[_0x9b88('0xf')]);router[_0x9b88('0x10')]('/',auth[_0x9b88('0xb')](),interaction[_0x9b88('0x11')](_0x9b88('0x12'),_0x9b88('0x13')),controller[_0x9b88('0x14')]);router[_0x9b88('0x15')](_0x9b88('0xe'),controller[_0x9b88('0x16')]);router['put'](_0x9b88('0x17'),auth[_0x9b88('0xb')](),controller['accept']);router[_0x9b88('0x15')](_0x9b88('0x18'),auth[_0x9b88('0xb')](),controller[_0x9b88('0x19')]);router[_0x9b88('0x1a')]('/:id',auth[_0x9b88('0xb')](),controller[_0x9b88('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xaf3e=['/:id','show','post','tracked','create','put','/:id/accept','accept','reject','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1eee0f,_0x5780a8){var _0x367d3a=function(_0x3b5c82){while(--_0x3b5c82){_0x1eee0f['push'](_0x1eee0f['shift']());}};_0x367d3a(++_0x5780a8);}(_0xaf3e,0x1a3));var _0xeaf3=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0xaf3e[_0x18546c];return _0x46ef43;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xeaf3('0x0'));var express=require(_0xeaf3('0x1'));var router=express[_0xeaf3('0x2')]();var fs_extra=require(_0xeaf3('0x3'));var auth=require(_0xeaf3('0x4'));var interaction=require(_0xeaf3('0x5'));var config=require(_0xeaf3('0x6'));var controller=require(_0xeaf3('0x7'));router[_0xeaf3('0x8')]('/',auth[_0xeaf3('0x9')](),controller[_0xeaf3('0xa')]);router['get'](_0xeaf3('0xb'),auth[_0xeaf3('0x9')](),controller[_0xeaf3('0xc')]);router[_0xeaf3('0x8')](_0xeaf3('0xd'),auth[_0xeaf3('0x9')](),controller[_0xeaf3('0xe')]);router[_0xeaf3('0xf')]('/',auth[_0xeaf3('0x9')](),interaction[_0xeaf3('0x10')]('chat','chatmessage:create'),controller[_0xeaf3('0x11')]);router[_0xeaf3('0x12')](_0xeaf3('0xd'),controller['update']);router['put'](_0xeaf3('0x13'),auth[_0xeaf3('0x9')](),controller[_0xeaf3('0x14')]);router['put']('/:id/reject',auth[_0xeaf3('0x9')](),controller[_0xeaf3('0x15')]);router[_0xeaf3('0x16')]('/:id',auth[_0xeaf3('0x9')](),controller['destroy']);module[_0xeaf3('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0127302..25c3359 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 _0x2032=['medium','exports','TEXT'];(function(_0x371b36,_0x8606f7){var _0x449638=function(_0x4ed4eb){while(--_0x4ed4eb){_0x371b36['push'](_0x371b36['shift']());}};_0x449638(++_0x8606f7);}(_0x2032,0xd9));var _0x2203=function(_0x125d00,_0x4e3d1c){_0x125d00=_0x125d00-0x0;var _0x1a3181=_0x2032[_0x125d00];return _0x1a3181;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x5ee4ec,_0x2b5aad){var _0x27fa20=function(_0x59fbd4){while(--_0x59fbd4){_0x5ee4ec['push'](_0x5ee4ec['shift']());}};_0x27fa20(++_0x2b5aad);}(_0xadb5,0xad));var _0x5adb=function(_0x3c10e9,_0x317ad6){_0x3c10e9=_0x3c10e9-0x0;var _0x131077=_0xadb5[_0x3c10e9];return _0x131077;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index bd47a93..24ed192 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(_0x31b493,_0x536ddc){var _0x1c6566=function(_0x38b18a){while(--_0x38b18a){_0x31b493['push'](_0x31b493['shift']());}};_0x1c6566(++_0x536ddc);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x25830b,_0x59e715){var _0x359662=function(_0x4663cc){while(--_0x4663cc){_0x25830b['push'](_0x25830b['shift']());}};_0x359662(++_0x59e715);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 9b8c98d..29ba0ae 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 _0x11ea=['setMaxListeners','save','update','remove','emit','hook','events','ChatOfflineMessage'];(function(_0x37c80b,_0x5b90a5){var _0x4ea485=function(_0x27520f){while(--_0x27520f){_0x37c80b['push'](_0x37c80b['shift']());}};_0x4ea485(++_0x5b90a5);}(_0x11ea,0x16e));var _0xa11e=function(_0x2e63bb,_0x499a97){_0x2e63bb=_0x2e63bb-0x0;var _0x4694e4=_0x11ea[_0x2e63bb];return _0x4694e4;};'use strict';var EventEmitter=require(_0xa11e('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xa11e('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa11e('0x2')](0x0);var events={'afterCreate':_0xa11e('0x3'),'afterUpdate':_0xa11e('0x4'),'afterDestroy':_0xa11e('0x5')};function emitEvent(_0x26dbb4){return function(_0x36c909,_0x4c5200,_0x2b2ffe){ChatOfflineMessageEvents['emit'](_0x26dbb4+':'+_0x36c909['id'],_0x36c909);ChatOfflineMessageEvents[_0xa11e('0x6')](_0x26dbb4,_0x36c909);_0x2b2ffe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xa11e('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x8e08=['update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x51dcd0,_0x3d2fac){var _0x47278c=function(_0x393f55){while(--_0x393f55){_0x51dcd0['push'](_0x51dcd0['shift']());}};_0x47278c(++_0x3d2fac);}(_0x8e08,0xf9));var _0x88e0=function(_0x2e2896,_0x4aa82e){_0x2e2896=_0x2e2896-0x0;var _0x5f1c23=_0x8e08[_0x2e2896];return _0x5f1c23;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x88e0('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x88e0('0x1')](0x0);var events={'afterCreate':_0x88e0('0x2'),'afterUpdate':_0x88e0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x402087){return function(_0x1a2af9,_0x492263,_0x49d228){ChatOfflineMessageEvents['emit'](_0x402087+':'+_0x1a2af9['id'],_0x1a2af9);ChatOfflineMessageEvents[_0x88e0('0x4')](_0x402087,_0x1a2af9);_0x49d228(null);};}for(var e in events){if(events[_0x88e0('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x88e0('0x6')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6b24501..b92ed17 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 _0xc843=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','chat_offline_messages'];(function(_0x18e345,_0x347ce1){var _0x553323=function(_0x3993b0){while(--_0x3993b0){_0x18e345['push'](_0x18e345['shift']());}};_0x553323(++_0x347ce1);}(_0xc843,0x14c));var _0x3c84=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0xc843[_0x374ccf];return _0x443cde;};'use strict';var attributes=require(_0x3c84('0x0'));module[_0x3c84('0x1')]=function(_0x273ee9){return _0x273ee9[_0x3c84('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x3c84('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c84('0x4'),'collate':_0x3c84('0x5')});}; \ No newline at end of file +var _0x6a7d=['exports','define','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x6a7d,0x1f3));var _0xd6a7=function(_0x22cea4,_0x54f16a){_0x22cea4=_0x22cea4-0x0;var _0x59d75b=_0x6a7d[_0x22cea4];return _0x59d75b;};'use strict';var attributes=require(_0xd6a7('0x0'));module[_0xd6a7('0x1')]=function(_0x436810){return _0x436810[_0xd6a7('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xd6a7('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd6a7('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c050563..54a2b09 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 _0x4756=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x3bbc10,_0x57c99a){var _0x2a0139=function(_0x5f2ae0){while(--_0x5f2ae0){_0x3bbc10['push'](_0x3bbc10['shift']());}};_0x2a0139(++_0x57c99a);}(_0x4756,0xa6));var _0x6475=function(_0x457607,_0x657f97){_0x457607=_0x457607-0x0;var _0x6060e9=_0x4756[_0x457607];return _0x6060e9;};'use strict';var _=require(_0x6475('0x0'));var util=require(_0x6475('0x1'));var moment=require(_0x6475('0x2'));var BPromise=require(_0x6475('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6475('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6475('0x5')][_0x6475('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39056b,_0x4bdf64,_0x187a38){return new BPromise(function(_0x1b71c6,_0x5b68ed){return client['request'](_0x39056b,_0x187a38)[_0x6475('0x7')](function(_0x1abecd){logger[_0x6475('0x8')](_0x6475('0x9'),_0x4bdf64,_0x6475('0xa'));logger[_0x6475('0xb')](_0x6475('0xc'),_0x4bdf64,_0x6475('0xa'),JSON['stringify'](_0x1abecd));if(_0x1abecd[_0x6475('0xd')]){if(_0x1abecd[_0x6475('0xd')][_0x6475('0xe')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4bdf64,_0x1abecd[_0x6475('0xd')][_0x6475('0xf')]);return _0x5b68ed(_0x1abecd[_0x6475('0xd')][_0x6475('0xf')]);}logger[_0x6475('0xd')](_0x6475('0x9'),_0x4bdf64,_0x1abecd['error'][_0x6475('0xf')]);return _0x1b71c6(_0x1abecd[_0x6475('0xd')][_0x6475('0xf')]);}else{logger[_0x6475('0x8')](_0x6475('0x9'),_0x4bdf64,_0x6475('0xa'));_0x1b71c6(_0x1abecd[_0x6475('0x10')][_0x6475('0xf')]);}})[_0x6475('0x11')](function(_0x35ac0a){logger[_0x6475('0xd')](_0x6475('0x9'),_0x4bdf64,_0x35ac0a);_0x5b68ed(_0x35ac0a);});});} \ No newline at end of file +var _0x0d4e=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x15c9fb,_0x4275b4){var _0x2c1ef2=function(_0x3d8374){while(--_0x3d8374){_0x15c9fb['push'](_0x15c9fb['shift']());}};_0x2c1ef2(++_0x4275b4);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0d4e[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xe0d4('0x0'));var util=require(_0xe0d4('0x1'));var moment=require(_0xe0d4('0x2'));var BPromise=require(_0xe0d4('0x3'));var rs=require(_0xe0d4('0x4'));var fs=require('fs');var Redis=require(_0xe0d4('0x5'));var db=require(_0xe0d4('0x6'))['db'];var utils=require(_0xe0d4('0x7'));var logger=require(_0xe0d4('0x8'))('rpc');var config=require(_0xe0d4('0x9'));var jayson=require(_0xe0d4('0xa'));var client=jayson[_0xe0d4('0xb')][_0xe0d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54a11f,_0x4a2a87,_0x312e09){return new BPromise(function(_0x1ba14d,_0x151e51){return client[_0xe0d4('0xd')](_0x54a11f,_0x312e09)[_0xe0d4('0xe')](function(_0x11aa34){logger[_0xe0d4('0xf')](_0xe0d4('0x10'),_0x4a2a87,_0xe0d4('0x11'));logger[_0xe0d4('0x12')](_0xe0d4('0x13'),_0x4a2a87,_0xe0d4('0x11'),JSON[_0xe0d4('0x14')](_0x11aa34));if(_0x11aa34['error']){if(_0x11aa34[_0xe0d4('0x15')][_0xe0d4('0x16')]===0x1f4){logger[_0xe0d4('0x15')](_0xe0d4('0x10'),_0x4a2a87,_0x11aa34[_0xe0d4('0x15')][_0xe0d4('0x17')]);return _0x151e51(_0x11aa34[_0xe0d4('0x15')][_0xe0d4('0x17')]);}logger[_0xe0d4('0x15')](_0xe0d4('0x10'),_0x4a2a87,_0x11aa34[_0xe0d4('0x15')][_0xe0d4('0x17')]);return _0x1ba14d(_0x11aa34[_0xe0d4('0x15')][_0xe0d4('0x17')]);}else{logger[_0xe0d4('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4a2a87,_0xe0d4('0x11'));_0x1ba14d(_0x11aa34[_0xe0d4('0x18')][_0xe0d4('0x17')]);}})['catch'](function(_0x4d0f7c){logger[_0xe0d4('0x15')](_0xe0d4('0x10'),_0x4a2a87,_0x4d0f7c);_0x151e51(_0x4d0f7c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 93dc13c..7516088 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 _0x2056=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x2056,0x6e));var _0x6205=function(_0xbfbef0,_0x218b21){_0xbfbef0=_0xbfbef0-0x0;var _0x3fdf6f=_0x2056[_0xbfbef0];return _0x3fdf6f;};'use strict';var multer=require(_0x6205('0x0'));var util=require(_0x6205('0x1'));var path=require('path');var timeout=require(_0x6205('0x2'));var express=require(_0x6205('0x3'));var router=express[_0x6205('0x4')]();var fs_extra=require(_0x6205('0x5'));var auth=require(_0x6205('0x6'));var interaction=require(_0x6205('0x7'));var config=require(_0x6205('0x8'));var controller=require(_0x6205('0x9'));router[_0x6205('0xa')]('/',auth[_0x6205('0xb')](),controller[_0x6205('0xc')]);router[_0x6205('0xa')](_0x6205('0xd'),auth[_0x6205('0xb')](),controller[_0x6205('0xe')]);router[_0x6205('0xa')](_0x6205('0xf'),auth[_0x6205('0xb')](),controller[_0x6205('0x10')]);router[_0x6205('0x11')]('/',auth[_0x6205('0xb')](),controller[_0x6205('0x12')]);router[_0x6205('0x13')](_0x6205('0xf'),auth['isAuthenticated'](),controller[_0x6205('0x14')]);router[_0x6205('0x15')](_0x6205('0xf'),auth[_0x6205('0xb')](),controller[_0x6205('0x16')]);module[_0x6205('0x17')]=router; \ No newline at end of file +var _0xf7e7=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x22b9b9,_0x4987b6){var _0x30adb8=function(_0x2d6eef){while(--_0x2d6eef){_0x22b9b9['push'](_0x22b9b9['shift']());}};_0x30adb8(++_0x4987b6);}(_0xf7e7,0xb3));var _0x7f7e=function(_0x19f300,_0x95df0b){_0x19f300=_0x19f300-0x0;var _0x26f674=_0xf7e7[_0x19f300];return _0x26f674;};'use strict';var multer=require(_0x7f7e('0x0'));var util=require(_0x7f7e('0x1'));var path=require('path');var timeout=require(_0x7f7e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f7e('0x3'));var auth=require(_0x7f7e('0x4'));var interaction=require(_0x7f7e('0x5'));var config=require(_0x7f7e('0x6'));var controller=require(_0x7f7e('0x7'));router[_0x7f7e('0x8')]('/',auth[_0x7f7e('0x9')](),controller['index']);router[_0x7f7e('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7f7e('0xa')]);router['get'](_0x7f7e('0xb'),auth['isAuthenticated'](),controller[_0x7f7e('0xc')]);router[_0x7f7e('0xd')]('/',auth[_0x7f7e('0x9')](),controller['create']);router[_0x7f7e('0xe')](_0x7f7e('0xb'),auth[_0x7f7e('0x9')](),controller[_0x7f7e('0xf')]);router[_0x7f7e('0x10')]('/:id',auth[_0x7f7e('0x9')](),controller[_0x7f7e('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 7962aaa..99b2a16 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 _0x5a96=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x55a7ee,_0x2b5443){var _0x1743ae=function(_0x1775fe){while(--_0x1775fe){_0x55a7ee['push'](_0x55a7ee['shift']());}};_0x1743ae(++_0x2b5443);}(_0x5a96,0xdc));var _0x65a9=function(_0x1731d7,_0x2873b4){_0x1731d7=_0x1731d7-0x0;var _0x4951e2=_0x5a96[_0x1731d7];return _0x4951e2;};'use strict';var Sequelize=require(_0x65a9('0x0'));module[_0x65a9('0x1')]={'name':{'type':Sequelize[_0x65a9('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x65a9('0x3'),_0x65a9('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x65a9('0x5')]}}; \ No newline at end of file +var _0xcb30=['exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xcb30,0x1e0));var _0x0cb3=function(_0x5d21a1,_0x113855){_0x5d21a1=_0x5d21a1-0x0;var _0x5730ca=_0xcb30[_0x5d21a1];return _0x5730ca;};'use strict';var Sequelize=require('sequelize');module[_0x0cb3('0x0')]={'name':{'type':Sequelize[_0x0cb3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0cb3('0x2')](_0x0cb3('0x3'),_0x0cb3('0x4')),'defaultValue':_0x0cb3('0x3')},'selector':{'type':Sequelize[_0x0cb3('0x1')]},'timeout':{'type':Sequelize[_0x0cb3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2102045..d7f41a1 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 _0xe799=['query','filters','intersection','attributes','fields','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','params','model','keys'];(function(_0x3ed1fe,_0x138740){var _0x16b599=function(_0x270d52){while(--_0x270d52){_0x3ed1fe['push'](_0x3ed1fe['shift']());}};_0x16b599(++_0x138740);}(_0xe799,0x170));var _0x9e79=function(_0x2da537,_0x42024b){_0x2da537=_0x2da537-0x0;var _0x5b73b9=_0xe799[_0x2da537];return _0x5b73b9;};'use strict';var emlformat=require(_0x9e79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e79('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e79('0x2'));var moment=require(_0x9e79('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9e79('0x4'));var util=require(_0x9e79('0x5'));var path=require(_0x9e79('0x6'));var sox=require('sox');var csv=require(_0x9e79('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e79('0x8'));var _=require(_0x9e79('0x9'));var squel=require(_0x9e79('0xa'));var crypto=require('crypto');var jsforce=require(_0x9e79('0xb'));var deskjs=require(_0x9e79('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9e79('0xd'));var Papa=require(_0x9e79('0xe'));var Redis=require(_0x9e79('0xf'));var authService=require(_0x9e79('0x10'));var qs=require(_0x9e79('0x11'));var as=require(_0x9e79('0x12'));var hardwareService=require(_0x9e79('0x13'));var logger=require('../../config/logger')(_0x9e79('0x14'));var utils=require(_0x9e79('0x15'));var config=require(_0x9e79('0x16'));var licenseUtil=require(_0x9e79('0x17'));var db=require(_0x9e79('0x18'))['db'];function respondWithStatusCode(_0x4cf63d,_0x27f4cb){_0x27f4cb=_0x27f4cb||0xcc;return function(_0x139a06){if(_0x139a06){return _0x4cf63d[_0x9e79('0x19')](_0x27f4cb);}return _0x4cf63d[_0x9e79('0x1a')](_0x27f4cb)[_0x9e79('0x1b')]();};}function respondWithResult(_0x9dc07c,_0xc939){_0xc939=_0xc939||0xc8;return function(_0x444aa6){if(_0x444aa6){return _0x9dc07c[_0x9e79('0x1a')](_0xc939)[_0x9e79('0x1c')](_0x444aa6);}};}function respondWithFilteredResult(_0x425a31,_0x107233){return function(_0x55becf){if(_0x55becf){var _0xcf0458=typeof _0x107233['offset']===_0x9e79('0x1d')&&typeof _0x107233[_0x9e79('0x1e')]==='undefined';var _0x1311cf=_0x55becf[_0x9e79('0x1f')];var _0x51b095=_0xcf0458?0x0:_0x107233['offset'];var _0x3cd5d7=_0xcf0458?_0x55becf[_0x9e79('0x1f')]:_0x107233[_0x9e79('0x20')]+_0x107233[_0x9e79('0x1e')];var _0x214d0e;if(_0x3cd5d7>=_0x1311cf){_0x3cd5d7=_0x1311cf;_0x214d0e=0xc8;}else{_0x214d0e=0xce;}_0x425a31['status'](_0x214d0e);return _0x425a31[_0x9e79('0x21')](_0x9e79('0x22'),_0x51b095+'-'+_0x3cd5d7+'/'+_0x1311cf)[_0x9e79('0x1c')](_0x55becf);}return null;};}function patchUpdates(_0x2f499b){return function(_0x5a0891){try{jsonpatch[_0x9e79('0x23')](_0x5a0891,_0x2f499b,!![]);}catch(_0x396a3d){return BPromise['reject'](_0x396a3d);}return _0x5a0891[_0x9e79('0x24')]();};}function saveUpdates(_0x222fb5,_0x4d76be){return function(_0x499783){if(_0x499783){return _0x499783['update'](_0x222fb5)['then'](function(_0x4d3138){return _0x4d3138;});}return null;};}function removeEntity(_0xa55ae0,_0x57cb8f){return function(_0x270e75){if(_0x270e75){return _0x270e75[_0x9e79('0x25')]()[_0x9e79('0x26')](function(){_0xa55ae0[_0x9e79('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2969df,_0x24b092){return function(_0x56f151){if(!_0x56f151){_0x2969df[_0x9e79('0x19')](0x194);}return _0x56f151;};}function handleError(_0x2ca4ad,_0x56df10){_0x56df10=_0x56df10||0x1f4;return function(_0x3bd860){logger[_0x9e79('0x27')](_0x3bd860[_0x9e79('0x28')]);if(_0x3bd860[_0x9e79('0x29')]){delete _0x3bd860[_0x9e79('0x29')];}_0x2ca4ad[_0x9e79('0x1a')](_0x56df10)['send'](_0x3bd860);};}exports['show']=function(_0x488e3e,_0x164a6c){var _0x2b5d54={'raw':!![],'where':{'id':_0x488e3e[_0x9e79('0x2a')]['id']}},_0x1ab1ab={};_0x1ab1ab[_0x9e79('0x2b')]=_[_0x9e79('0x2c')](db['ChatProactiveAction']['rawAttributes']);_0x1ab1ab[_0x9e79('0x2d')]=_[_0x9e79('0x2c')](_0x488e3e['query']);_0x1ab1ab[_0x9e79('0x2e')]=_[_0x9e79('0x2f')](_0x1ab1ab['model'],_0x1ab1ab[_0x9e79('0x2d')]);_0x2b5d54[_0x9e79('0x30')]=_['intersection'](_0x1ab1ab['model'],qs[_0x9e79('0x31')](_0x488e3e[_0x9e79('0x2d')]['fields']));_0x2b5d54[_0x9e79('0x30')]=_0x2b5d54[_0x9e79('0x30')][_0x9e79('0x32')]?_0x2b5d54[_0x9e79('0x30')]:_0x1ab1ab['model'];if(_0x488e3e[_0x9e79('0x2d')][_0x9e79('0x33')]){_0x2b5d54['include']=[{'all':!![]}];}_0x2b5d54=_[_0x9e79('0x34')]({},_0x2b5d54,_0x488e3e[_0x9e79('0x35')]);return db[_0x9e79('0x36')][_0x9e79('0x37')](_0x2b5d54)[_0x9e79('0x26')](handleEntityNotFound(_0x164a6c,null))[_0x9e79('0x26')](respondWithResult(_0x164a6c,null))[_0x9e79('0x38')](handleError(_0x164a6c,null));};exports[_0x9e79('0x39')]=function(_0x4ee45d,_0x17ad7d){return db['ChatProactiveAction'][_0x9e79('0x39')](_0x4ee45d[_0x9e79('0x3a')],{})[_0x9e79('0x26')](respondWithResult(_0x17ad7d,0xc9))[_0x9e79('0x38')](handleError(_0x17ad7d,null));};exports['update']=function(_0x1ef8f6,_0x11687e){if(_0x1ef8f6['body']['id']){delete _0x1ef8f6[_0x9e79('0x3a')]['id'];}return db[_0x9e79('0x36')][_0x9e79('0x37')]({'where':{'id':_0x1ef8f6[_0x9e79('0x2a')]['id']}})[_0x9e79('0x26')](handleEntityNotFound(_0x11687e,null))[_0x9e79('0x26')](saveUpdates(_0x1ef8f6[_0x9e79('0x3a')],null))[_0x9e79('0x26')](respondWithResult(_0x11687e,null))[_0x9e79('0x38')](handleError(_0x11687e,null));};exports[_0x9e79('0x25')]=function(_0x20c90c,_0x260094){return db[_0x9e79('0x36')]['find']({'where':{'id':_0x20c90c['params']['id']}})['then'](handleEntityNotFound(_0x260094,null))[_0x9e79('0x26')](removeEntity(_0x260094,null))[_0x9e79('0x38')](handleError(_0x260094,null));}; \ No newline at end of file +var _0x7a59=['fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','update','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','params','keys','rawAttributes','query','model','attributes'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x7a59,0x16e));var _0x97a5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7a59[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x97a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97a5('0x1'));var rp=require(_0x97a5('0x2'));var moment=require(_0x97a5('0x3'));var BPromise=require(_0x97a5('0x4'));var Mustache=require(_0x97a5('0x5'));var util=require('util');var path=require(_0x97a5('0x6'));var sox=require(_0x97a5('0x7'));var csv=require(_0x97a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a5('0x9'));var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0x8'));var querystring=require('querystring');var Papa=require(_0x97a5('0xf'));var Redis=require(_0x97a5('0x10'));var authService=require(_0x97a5('0x11'));var qs=require(_0x97a5('0x12'));var as=require(_0x97a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x14'));var utils=require(_0x97a5('0x15'));var config=require(_0x97a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a5('0x17'))['db'];function respondWithStatusCode(_0x350720,_0x55305a){_0x55305a=_0x55305a||0xcc;return function(_0x4f85a0){if(_0x4f85a0){return _0x350720[_0x97a5('0x18')](_0x55305a);}return _0x350720[_0x97a5('0x19')](_0x55305a)['end']();};}function respondWithResult(_0x595437,_0x51d5e2){_0x51d5e2=_0x51d5e2||0xc8;return function(_0x5a4471){if(_0x5a4471){return _0x595437[_0x97a5('0x19')](_0x51d5e2)[_0x97a5('0x1a')](_0x5a4471);}};}function respondWithFilteredResult(_0x3603e4,_0x4d8ba7){return function(_0x1a7a62){if(_0x1a7a62){var _0x3fa986=typeof _0x4d8ba7['offset']===_0x97a5('0x1b')&&typeof _0x4d8ba7['limit']===_0x97a5('0x1b');var _0x55071b=_0x1a7a62['count'];var _0x52ce92=_0x3fa986?0x0:_0x4d8ba7[_0x97a5('0x1c')];var _0x5c5740=_0x3fa986?_0x1a7a62[_0x97a5('0x1d')]:_0x4d8ba7[_0x97a5('0x1c')]+_0x4d8ba7[_0x97a5('0x1e')];var _0x1efe8c;if(_0x5c5740>=_0x55071b){_0x5c5740=_0x55071b;_0x1efe8c=0xc8;}else{_0x1efe8c=0xce;}_0x3603e4['status'](_0x1efe8c);return _0x3603e4['set'](_0x97a5('0x1f'),_0x52ce92+'-'+_0x5c5740+'/'+_0x55071b)[_0x97a5('0x1a')](_0x1a7a62);}return null;};}function patchUpdates(_0x4e3386){return function(_0x51858b){try{jsonpatch[_0x97a5('0x20')](_0x51858b,_0x4e3386,!![]);}catch(_0x3d7dba){return BPromise[_0x97a5('0x21')](_0x3d7dba);}return _0x51858b['save']();};}function saveUpdates(_0x34fb55,_0x3a5849){return function(_0x23f4f8){if(_0x23f4f8){return _0x23f4f8['update'](_0x34fb55)[_0x97a5('0x22')](function(_0x33d6da){return _0x33d6da;});}return null;};}function removeEntity(_0x4e2074,_0x5e731e){return function(_0x469592){if(_0x469592){return _0x469592[_0x97a5('0x23')]()[_0x97a5('0x22')](function(){_0x4e2074[_0x97a5('0x19')](0xcc)[_0x97a5('0x24')]();});}};}function handleEntityNotFound(_0x302d78,_0xf7ad1e){return function(_0x4743e0){if(!_0x4743e0){_0x302d78['sendStatus'](0x194);}return _0x4743e0;};}function handleError(_0x2038dd,_0x46ee45){_0x46ee45=_0x46ee45||0x1f4;return function(_0x2ca97c){logger[_0x97a5('0x25')](_0x2ca97c[_0x97a5('0x26')]);if(_0x2ca97c[_0x97a5('0x27')]){delete _0x2ca97c['name'];}_0x2038dd[_0x97a5('0x19')](_0x46ee45)[_0x97a5('0x28')](_0x2ca97c);};}exports['show']=function(_0x274ccb,_0x52248f){var _0x48f1c1={'raw':!![],'where':{'id':_0x274ccb[_0x97a5('0x29')]['id']}},_0x1bdb74={};_0x1bdb74['model']=_[_0x97a5('0x2a')](db['ChatProactiveAction'][_0x97a5('0x2b')]);_0x1bdb74[_0x97a5('0x2c')]=_[_0x97a5('0x2a')](_0x274ccb[_0x97a5('0x2c')]);_0x1bdb74['filters']=_['intersection'](_0x1bdb74[_0x97a5('0x2d')],_0x1bdb74[_0x97a5('0x2c')]);_0x48f1c1[_0x97a5('0x2e')]=_['intersection'](_0x1bdb74[_0x97a5('0x2d')],qs[_0x97a5('0x2f')](_0x274ccb['query'][_0x97a5('0x2f')]));_0x48f1c1[_0x97a5('0x2e')]=_0x48f1c1['attributes'][_0x97a5('0x30')]?_0x48f1c1[_0x97a5('0x2e')]:_0x1bdb74[_0x97a5('0x2d')];if(_0x274ccb['query'][_0x97a5('0x31')]){_0x48f1c1[_0x97a5('0x32')]=[{'all':!![]}];}_0x48f1c1=_[_0x97a5('0x33')]({},_0x48f1c1,_0x274ccb[_0x97a5('0x34')]);return db[_0x97a5('0x35')][_0x97a5('0x36')](_0x48f1c1)[_0x97a5('0x22')](handleEntityNotFound(_0x52248f,null))['then'](respondWithResult(_0x52248f,null))[_0x97a5('0x37')](handleError(_0x52248f,null));};exports[_0x97a5('0x38')]=function(_0xcb2c5b,_0x393994){return db[_0x97a5('0x35')][_0x97a5('0x38')](_0xcb2c5b[_0x97a5('0x39')],{})[_0x97a5('0x22')](respondWithResult(_0x393994,0xc9))[_0x97a5('0x37')](handleError(_0x393994,null));};exports[_0x97a5('0x3a')]=function(_0x1c007d,_0x1d5c4a){if(_0x1c007d[_0x97a5('0x39')]['id']){delete _0x1c007d['body']['id'];}return db[_0x97a5('0x35')][_0x97a5('0x36')]({'where':{'id':_0x1c007d[_0x97a5('0x29')]['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x1d5c4a,null))[_0x97a5('0x22')](saveUpdates(_0x1c007d['body'],null))['then'](respondWithResult(_0x1d5c4a,null))[_0x97a5('0x37')](handleError(_0x1d5c4a,null));};exports[_0x97a5('0x23')]=function(_0x52d774,_0x45a548){return db[_0x97a5('0x35')][_0x97a5('0x36')]({'where':{'id':_0x52d774['params']['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x45a548,null))['then'](removeEntity(_0x45a548,null))[_0x97a5('0x37')](handleError(_0x45a548,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 72eb288..820d6ec 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 _0x6a77=['ChatProactiveAction','chat_proactive_actions','util','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x146048,_0x3ae028){var _0x1ed95a=function(_0x91643c){while(--_0x91643c){_0x146048['push'](_0x146048['shift']());}};_0x1ed95a(++_0x3ae028);}(_0x6a77,0x122));var _0x76a7=function(_0x5c147b,_0x8faca0){_0x5c147b=_0x5c147b-0x0;var _0x17cb1c=_0x6a77[_0x5c147b];return _0x17cb1c;};'use strict';var _=require('lodash');var util=require(_0x76a7('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x76a7('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76a7('0x2'));var rimraf=require(_0x76a7('0x3'));var config=require(_0x76a7('0x4'));var attributes=require('./chatProactiveAction.attributes');module[_0x76a7('0x5')]=function(_0x13a89b,_0x4fb9f9){return _0x13a89b[_0x76a7('0x6')](_0x76a7('0x7'),attributes,{'tableName':_0x76a7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5407=['request-promise','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x5407,0x193));var _0x7540=function(_0x330e61,_0x316f1f){_0x330e61=_0x330e61-0x0;var _0x586015=_0x5407[_0x330e61];return _0x586015;};'use strict';var _=require('lodash');var util=require(_0x7540('0x0'));var logger=require(_0x7540('0x1'))(_0x7540('0x2'));var moment=require(_0x7540('0x3'));var BPromise=require('bluebird');var rp=require(_0x7540('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7540('0x5'));var attributes=require(_0x7540('0x6'));module[_0x7540('0x7')]=function(_0x356ec5,_0xb7ee40){return _0x356ec5[_0x7540('0x8')](_0x7540('0x9'),attributes,{'tableName':_0x7540('0xa'),'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 87cdcd0..4a5ca38 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 _0xa1cf=['debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x5365d5,_0x51aa66){var _0x1d3d0e=function(_0x3d1e01){while(--_0x3d1e01){_0x5365d5['push'](_0x5365d5['shift']());}};_0x1d3d0e(++_0x51aa66);}(_0xa1cf,0x6a));var _0xfa1c=function(_0x2a49c1,_0xb510de){_0x2a49c1=_0x2a49c1-0x0;var _0x38ec9e=_0xa1cf[_0x2a49c1];return _0x38ec9e;};'use strict';var _=require('lodash');var util=require(_0xfa1c('0x0'));var moment=require(_0xfa1c('0x1'));var BPromise=require(_0xfa1c('0x2'));var rs=require(_0xfa1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa1c('0x4'))['db'];var utils=require(_0xfa1c('0x5'));var logger=require(_0xfa1c('0x6'))(_0xfa1c('0x7'));var config=require('../../config/environment');var jayson=require(_0xfa1c('0x8'));var client=jayson['client'][_0xfa1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e9b34,_0x1f0d83,_0x105c7a){return new BPromise(function(_0x5a2936,_0x5bb2d5){return client[_0xfa1c('0xa')](_0x4e9b34,_0x105c7a)['then'](function(_0x2921e1){logger[_0xfa1c('0xb')](_0xfa1c('0xc'),_0x1f0d83,_0xfa1c('0xd'));logger[_0xfa1c('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1f0d83,'request\x20sent',JSON[_0xfa1c('0xf')](_0x2921e1));if(_0x2921e1['error']){if(_0x2921e1[_0xfa1c('0x10')]['code']===0x1f4){logger['error'](_0xfa1c('0xc'),_0x1f0d83,_0x2921e1['error'][_0xfa1c('0x11')]);return _0x5bb2d5(_0x2921e1[_0xfa1c('0x10')][_0xfa1c('0x11')]);}logger[_0xfa1c('0x10')](_0xfa1c('0xc'),_0x1f0d83,_0x2921e1[_0xfa1c('0x10')]['message']);return _0x5a2936(_0x2921e1[_0xfa1c('0x10')][_0xfa1c('0x11')]);}else{logger[_0xfa1c('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x1f0d83,_0xfa1c('0xd'));_0x5a2936(_0x2921e1[_0xfa1c('0x12')][_0xfa1c('0x11')]);}})[_0xfa1c('0x13')](function(_0x4a393e){logger[_0xfa1c('0x10')](_0xfa1c('0xc'),_0x1f0d83,_0x4a393e);_0x5bb2d5(_0x4a393e);});});} \ No newline at end of file +var _0x15b7=['info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','ChatProactiveAction,\x20%s,\x20%s','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b7,0x13a));var _0x715b=function(_0x575fe5,_0x194d51){_0x575fe5=_0x575fe5-0x0;var _0x576c7a=_0x15b7[_0x575fe5];return _0x576c7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x715b('0x0'));var BPromise=require('bluebird');var rs=require(_0x715b('0x1'));var fs=require('fs');var Redis=require(_0x715b('0x2'));var db=require(_0x715b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x715b('0x4'))(_0x715b('0x5'));var config=require(_0x715b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x715b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d29e8,_0xc2f0ca,_0x6e2d6b){return new BPromise(function(_0x59fc8d,_0x5d446e){return client[_0x715b('0x8')](_0x1d29e8,_0x6e2d6b)['then'](function(_0xa271d4){logger[_0x715b('0x9')]('ChatProactiveAction,\x20%s,\x20%s',_0xc2f0ca,_0x715b('0xa'));logger[_0x715b('0xb')](_0x715b('0xc'),_0xc2f0ca,_0x715b('0xa'),JSON['stringify'](_0xa271d4));if(_0xa271d4[_0x715b('0xd')]){if(_0xa271d4[_0x715b('0xd')]['code']===0x1f4){logger[_0x715b('0xd')](_0x715b('0xe'),_0xc2f0ca,_0xa271d4[_0x715b('0xd')][_0x715b('0xf')]);return _0x5d446e(_0xa271d4[_0x715b('0xd')]['message']);}logger[_0x715b('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0xc2f0ca,_0xa271d4[_0x715b('0xd')][_0x715b('0xf')]);return _0x59fc8d(_0xa271d4['error'][_0x715b('0xf')]);}else{logger[_0x715b('0x9')]('ChatProactiveAction,\x20%s,\x20%s',_0xc2f0ca,_0x715b('0xa'));_0x59fc8d(_0xa271d4[_0x715b('0x10')][_0x715b('0xf')]);}})['catch'](function(_0x13cc0b){logger[_0x715b('0xd')](_0x715b('0xe'),_0xc2f0ca,_0x13cc0b);_0x5d446e(_0x13cc0b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 65e8d97..627eee9 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 _0x7fbe=['show','post','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0xc3b992,_0x49e807){var _0x212dc0=function(_0x286251){while(--_0x286251){_0xc3b992['push'](_0xc3b992['shift']());}};_0x212dc0(++_0x49e807);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57aa9d,_0x40382c){_0x57aa9d=_0x57aa9d-0x0;var _0x43fd79=_0x7fbe[_0x57aa9d];return _0x43fd79;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0xc')]);router[_0xe7fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller['update']);router['delete'](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0x10')]);module[_0xe7fb('0x11')]=router; \ No newline at end of file +var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x2d0988,_0x599375){var _0x56549a=function(_0x21cbed){while(--_0x21cbed){_0x2d0988['push'](_0x2d0988['shift']());}};_0x56549a(++_0x599375);}(_0xeda8,0x104));var _0x8eda=function(_0x2da24b,_0x1dffbb){_0x2da24b=_0x2da24b-0x0;var _0x53047e=_0xeda8[_0x2da24b];return _0x53047e;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('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 96dfc64..66957a2 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 _0xc2d2=['rrmemory','beepall','sequelize','exports','name','INTEGER'];(function(_0x1aa1a8,_0x5f2839){var _0x3377cf=function(_0x6ccab1){while(--_0x6ccab1){_0x1aa1a8['push'](_0x1aa1a8['shift']());}};_0x3377cf(++_0x5f2839);}(_0xc2d2,0x176));var _0x2c2d=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0xc2d2[_0x5a8aa3];return _0x5d0458;};'use strict';var Sequelize=require(_0x2c2d('0x0'));module[_0x2c2d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2c2d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2c2d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2c2d('0x4'),_0x2c2d('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x4150=['STRING','INTEGER','rrmemory','beepall','sequelize','exports','name'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x4150,0x123));var _0x0415=function(_0x2e6b31,_0xc7f1ff){_0x2e6b31=_0x2e6b31-0x0;var _0x3e572c=_0x4150[_0x2e6b31];return _0x3e572c;};'use strict';var Sequelize=require(_0x0415('0x0'));module[_0x0415('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0415('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0415('0x3')]},'timeout':{'type':Sequelize[_0x0415('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0415('0x5'),_0x0415('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d970a72..d7e979d 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 _0xec58=['ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','filters','pick','User','findAndCountAll','UserId','agent','chatPause','format','%s/%s','SIP','createdAt','updatedAt','findOne','Team','nolimit','getTeams','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','UserChatQueue','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','ids','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','./chatQueue.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0xec58,0x7c));var _0x8ec5=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0xec58[_0x16938f];return _0x5c66e9;};'use strict';var emlformat=require(_0x8ec5('0x0'));var rimraf=require(_0x8ec5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ec5('0x2'));var rp=require(_0x8ec5('0x3'));var moment=require(_0x8ec5('0x4'));var BPromise=require(_0x8ec5('0x5'));var Mustache=require(_0x8ec5('0x6'));var util=require(_0x8ec5('0x7'));var path=require(_0x8ec5('0x8'));var sox=require(_0x8ec5('0x9'));var csv=require(_0x8ec5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ec5('0xb'));var _=require(_0x8ec5('0xc'));var squel=require(_0x8ec5('0xd'));var crypto=require(_0x8ec5('0xe'));var jsforce=require(_0x8ec5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8ec5('0xa'));var querystring=require(_0x8ec5('0x10'));var Papa=require(_0x8ec5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8ec5('0x12'));var as=require(_0x8ec5('0x13'));var hardwareService=require(_0x8ec5('0x14'));var logger=require(_0x8ec5('0x15'))(_0x8ec5('0x16'));var utils=require(_0x8ec5('0x17'));var config=require(_0x8ec5('0x18'));var licenseUtil=require(_0x8ec5('0x19'));var db=require(_0x8ec5('0x1a'))['db'];config[_0x8ec5('0x1b')]=_[_0x8ec5('0x1c')](config[_0x8ec5('0x1b')],{'host':_0x8ec5('0x1d'),'port':0x18eb});var socket=require(_0x8ec5('0x1e'))(new Redis(config['redis']));require(_0x8ec5('0x1f'))[_0x8ec5('0x20')](socket);var jayson=require(_0x8ec5('0x21'));var client=jayson[_0x8ec5('0x22')][_0x8ec5('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x12cee2,_0x490300,_0x3d2d46,_0x2f122d){return new BPromise(function(_0x48656c,_0x15fda8){var _0x30a1c7=_0x2f122d||client;return _0x30a1c7[_0x8ec5('0x24')](_0x12cee2,_0x3d2d46)['then'](function(_0x48d6ee){logger[_0x8ec5('0x25')]('ChatQueue,\x20%s,\x20%s',_0x490300,_0x8ec5('0x26'));logger[_0x8ec5('0x27')](_0x8ec5('0x28'),_0x490300,_0x8ec5('0x26'),JSON['stringify'](_0x48d6ee));if(_0x48d6ee['error']){if(_0x48d6ee[_0x8ec5('0x29')][_0x8ec5('0x2a')]===0x1f4){logger[_0x8ec5('0x29')]('ChatQueue,\x20%s,\x20%s',_0x490300,_0x48d6ee[_0x8ec5('0x29')][_0x8ec5('0x2b')]);return _0x15fda8(_0x48d6ee[_0x8ec5('0x29')][_0x8ec5('0x2b')]);}logger[_0x8ec5('0x29')]('ChatQueue,\x20%s,\x20%s',_0x490300,_0x48d6ee['error']['message']);return _0x48656c(_0x48d6ee[_0x8ec5('0x29')][_0x8ec5('0x2b')]);}else{logger[_0x8ec5('0x25')](_0x8ec5('0x2c'),_0x490300,_0x8ec5('0x26'));_0x48656c(_0x48d6ee[_0x8ec5('0x2d')][_0x8ec5('0x2b')]);}})[_0x8ec5('0x2e')](function(_0x1ac16b){logger[_0x8ec5('0x29')](_0x8ec5('0x2c'),_0x490300,_0x1ac16b);_0x15fda8(_0x1ac16b);});});}function respondWithStatusCode(_0xb06207,_0xf7612b){_0xf7612b=_0xf7612b||0xcc;return function(_0x53d2e7){if(_0x53d2e7){return _0xb06207[_0x8ec5('0x2f')](_0xf7612b);}return _0xb06207[_0x8ec5('0x30')](_0xf7612b)[_0x8ec5('0x31')]();};}function respondWithResult(_0xe06957,_0x4fad06){_0x4fad06=_0x4fad06||0xc8;return function(_0x56d84c){if(_0x56d84c){return _0xe06957[_0x8ec5('0x30')](_0x4fad06)[_0x8ec5('0x32')](_0x56d84c);}};}function respondWithFilteredResult(_0x1cb182,_0x272ada){return function(_0x8cda66){if(_0x8cda66){var _0x2208bd=typeof _0x272ada[_0x8ec5('0x33')]===_0x8ec5('0x34')&&typeof _0x272ada[_0x8ec5('0x35')]==='undefined';var _0x3f571e=_0x8cda66[_0x8ec5('0x36')];var _0x4b74a5=_0x2208bd?0x0:_0x272ada[_0x8ec5('0x33')];var _0x5ab687=_0x2208bd?_0x8cda66[_0x8ec5('0x36')]:_0x272ada[_0x8ec5('0x33')]+_0x272ada[_0x8ec5('0x35')];var _0x3453dd;if(_0x5ab687>=_0x3f571e){_0x5ab687=_0x3f571e;_0x3453dd=0xc8;}else{_0x3453dd=0xce;}_0x1cb182[_0x8ec5('0x30')](_0x3453dd);return _0x1cb182[_0x8ec5('0x37')](_0x8ec5('0x38'),_0x4b74a5+'-'+_0x5ab687+'/'+_0x3f571e)[_0x8ec5('0x32')](_0x8cda66);}return null;};}function patchUpdates(_0x106ce5){return function(_0x47376f){try{jsonpatch['apply'](_0x47376f,_0x106ce5,!![]);}catch(_0x2f40c8){return BPromise[_0x8ec5('0x39')](_0x2f40c8);}return _0x47376f[_0x8ec5('0x3a')]();};}function saveUpdates(_0xa5cecd,_0x3e88d8){return function(_0x178f47){if(_0x178f47){return _0x178f47['update'](_0xa5cecd)[_0x8ec5('0x3b')](function(_0x284a07){return _0x284a07;});}return null;};}function removeEntity(_0x16b797,_0x21050b){return function(_0x22a26a){if(_0x22a26a){return _0x22a26a['destroy']()[_0x8ec5('0x3b')](function(){var _0x1e49d4=_0x22a26a[_0x8ec5('0x3c')]({'plain':!![]});var _0x2f525b=_0x8ec5('0x3d');return db[_0x8ec5('0x3e')][_0x8ec5('0x3f')]({'where':{'type':_0x2f525b,'resourceId':_0x1e49d4['id']}})['then'](function(){return _0x22a26a;});})[_0x8ec5('0x3b')](function(){_0x16b797[_0x8ec5('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11c4ca,_0x21d9b7){return function(_0x2e4da5){if(!_0x2e4da5){_0x11c4ca[_0x8ec5('0x2f')](0x194);}return _0x2e4da5;};}function handleError(_0x113113,_0x3ece82){_0x3ece82=_0x3ece82||0x1f4;return function(_0x3b2dab){logger[_0x8ec5('0x29')](_0x3b2dab[_0x8ec5('0x40')]);if(_0x3b2dab[_0x8ec5('0x41')]){delete _0x3b2dab[_0x8ec5('0x41')];}_0x113113['status'](_0x3ece82)[_0x8ec5('0x42')](_0x3b2dab);};}exports[_0x8ec5('0x43')]=function(_0x4c40e1,_0x14619e){var _0x30c160={},_0x4f053f={},_0x325512={'count':0x0,'rows':[]};var _0x1ca03f=_[_0x8ec5('0x44')](db[_0x8ec5('0x45')][_0x8ec5('0x46')],function(_0x5a375e){return{'name':_0x5a375e[_0x8ec5('0x47')],'type':_0x5a375e[_0x8ec5('0x48')]['key']};});_0x4f053f[_0x8ec5('0x49')]=_[_0x8ec5('0x44')](_0x1ca03f,'name');_0x4f053f[_0x8ec5('0x4a')]=_[_0x8ec5('0x4b')](_0x4c40e1[_0x8ec5('0x4a')]);_0x4f053f['filters']=_[_0x8ec5('0x4c')](_0x4f053f[_0x8ec5('0x49')],_0x4f053f[_0x8ec5('0x4a')]);_0x30c160['attributes']=_[_0x8ec5('0x4c')](_0x4f053f[_0x8ec5('0x49')],qs[_0x8ec5('0x4d')](_0x4c40e1['query'][_0x8ec5('0x4d')]));_0x30c160[_0x8ec5('0x4e')]=_0x30c160[_0x8ec5('0x4e')][_0x8ec5('0x4f')]?_0x30c160['attributes']:_0x4f053f[_0x8ec5('0x49')];if(!_0x4c40e1[_0x8ec5('0x4a')][_0x8ec5('0x50')]('nolimit')){_0x30c160['limit']=qs[_0x8ec5('0x35')](_0x4c40e1[_0x8ec5('0x4a')]['limit']);_0x30c160[_0x8ec5('0x33')]=qs['offset'](_0x4c40e1[_0x8ec5('0x4a')][_0x8ec5('0x33')]);}_0x30c160[_0x8ec5('0x51')]=qs['sort'](_0x4c40e1[_0x8ec5('0x4a')][_0x8ec5('0x52')]);_0x30c160['where']=qs['filters'](_['pick'](_0x4c40e1[_0x8ec5('0x4a')],_0x4f053f['filters']),_0x1ca03f);if(_0x4c40e1[_0x8ec5('0x4a')][_0x8ec5('0x53')]){_0x30c160[_0x8ec5('0x54')]=_[_0x8ec5('0x55')](_0x30c160[_0x8ec5('0x54')],{'$or':_['map'](_0x1ca03f,function(_0x5c6c77){if(_0x5c6c77[_0x8ec5('0x48')]!==_0x8ec5('0x56')){var _0x48a6d3={};_0x48a6d3[_0x5c6c77[_0x8ec5('0x41')]]={'$like':'%'+_0x4c40e1[_0x8ec5('0x4a')][_0x8ec5('0x53')]+'%'};return _0x48a6d3;}})});}_0x30c160=_[_0x8ec5('0x55')]({},_0x30c160,_0x4c40e1['options']);var _0x5e07d7={'where':_0x30c160['where']};return db['ChatQueue']['count'](_0x5e07d7)[_0x8ec5('0x3b')](function(_0x257cb4){_0x325512[_0x8ec5('0x36')]=_0x257cb4;if(_0x4c40e1[_0x8ec5('0x4a')][_0x8ec5('0x57')]){_0x30c160[_0x8ec5('0x58')]=[{'all':!![]}];}return db[_0x8ec5('0x45')][_0x8ec5('0x59')](_0x30c160);})[_0x8ec5('0x3b')](function(_0x53a69f){_0x325512[_0x8ec5('0x5a')]=_0x53a69f;return _0x325512;})['then'](respondWithFilteredResult(_0x14619e,_0x30c160))[_0x8ec5('0x2e')](handleError(_0x14619e,null));};exports[_0x8ec5('0x5b')]=function(_0x3c734d,_0x51bd92){var _0x542458={'raw':!![],'where':{'id':_0x3c734d[_0x8ec5('0x5c')]['id']}},_0x15dacf={};_0x15dacf[_0x8ec5('0x49')]=_['keys'](db[_0x8ec5('0x45')][_0x8ec5('0x46')]);_0x15dacf[_0x8ec5('0x4a')]=_[_0x8ec5('0x4b')](_0x3c734d[_0x8ec5('0x4a')]);_0x15dacf['filters']=_[_0x8ec5('0x4c')](_0x15dacf[_0x8ec5('0x49')],_0x15dacf[_0x8ec5('0x4a')]);_0x542458[_0x8ec5('0x4e')]=_[_0x8ec5('0x4c')](_0x15dacf[_0x8ec5('0x49')],qs[_0x8ec5('0x4d')](_0x3c734d[_0x8ec5('0x4a')]['fields']));_0x542458['attributes']=_0x542458['attributes'][_0x8ec5('0x4f')]?_0x542458['attributes']:_0x15dacf['model'];if(_0x3c734d[_0x8ec5('0x4a')]['includeAll']){_0x542458[_0x8ec5('0x58')]=[{'all':!![]}];}_0x542458=_[_0x8ec5('0x55')]({},_0x542458,_0x3c734d[_0x8ec5('0x5d')]);return db[_0x8ec5('0x45')][_0x8ec5('0x5e')](_0x542458)['then'](handleEntityNotFound(_0x51bd92,null))[_0x8ec5('0x3b')](respondWithResult(_0x51bd92,null))[_0x8ec5('0x2e')](handleError(_0x51bd92,null));};exports[_0x8ec5('0x5f')]=function(_0x305be7,_0x2792db){return db[_0x8ec5('0x45')][_0x8ec5('0x5f')](_0x305be7[_0x8ec5('0x60')],{})[_0x8ec5('0x3b')](function(_0x1701f5){var _0x10b554=_0x305be7[_0x8ec5('0x61')][_0x8ec5('0x3c')]({'plain':!![]});if(!_0x10b554)throw new Error(_0x8ec5('0x62'));if(_0x10b554[_0x8ec5('0x63')]==='user'){var _0x1222d1=_0x1701f5[_0x8ec5('0x3c')]({'plain':!![]});var _0xe8076b=_0x8ec5('0x3d');return db[_0x8ec5('0x64')][_0x8ec5('0x5e')]({'where':{'name':_0xe8076b,'userProfileId':_0x10b554[_0x8ec5('0x65')]},'raw':!![]})['then'](function(_0x6df8d3){if(_0x6df8d3&&_0x6df8d3[_0x8ec5('0x66')]===0x0){return db['UserProfileResource']['create']({'name':_0x1222d1[_0x8ec5('0x41')],'resourceId':_0x1222d1['id'],'type':_0x6df8d3[_0x8ec5('0x41')],'sectionId':_0x6df8d3['id']},{})['then'](function(){return _0x1701f5;});}else{return _0x1701f5;}})[_0x8ec5('0x2e')](function(_0x523e98){logger[_0x8ec5('0x29')](_0x8ec5('0x67'),_0x523e98);throw _0x523e98;});}return _0x1701f5;})[_0x8ec5('0x3b')](respondWithResult(_0x2792db,0xc9))['catch'](handleError(_0x2792db,null));};exports[_0x8ec5('0x68')]=function(_0x2e8fff,_0x2d576b){if(_0x2e8fff[_0x8ec5('0x60')]['id']){delete _0x2e8fff[_0x8ec5('0x60')]['id'];}return db[_0x8ec5('0x45')]['find']({'where':{'id':_0x2e8fff[_0x8ec5('0x5c')]['id']}})[_0x8ec5('0x3b')](handleEntityNotFound(_0x2d576b,null))['then'](saveUpdates(_0x2e8fff['body'],null))[_0x8ec5('0x3b')](respondWithResult(_0x2d576b,null))[_0x8ec5('0x2e')](handleError(_0x2d576b,null));};exports[_0x8ec5('0x3f')]=function(_0x167727,_0x5c9a9){return db['ChatQueue'][_0x8ec5('0x5e')]({'where':{'id':_0x167727[_0x8ec5('0x5c')]['id']}})[_0x8ec5('0x3b')](handleEntityNotFound(_0x5c9a9,null))[_0x8ec5('0x3b')](removeEntity(_0x5c9a9,null))['catch'](handleError(_0x5c9a9,null));};exports['describe']=function(_0x49ee62,_0x493dd0){return db[_0x8ec5('0x45')]['describe']()[_0x8ec5('0x3b')](respondWithResult(_0x493dd0,null))[_0x8ec5('0x2e')](handleError(_0x493dd0,null));};exports[_0x8ec5('0x69')]=function(_0x929be,_0x548b2,_0x27517d){var _0xcb0a8a={'raw':!![],'where':{}},_0x386ad5={},_0xfc6d6a;return db[_0x8ec5('0x45')]['findOne']({'where':{'id':_0x929be['params']['id']}})['then'](handleEntityNotFound(_0x548b2,null))[_0x8ec5('0x3b')](function(_0x1c9190){if(_0x1c9190){_0xfc6d6a=_0x1c9190[_0x8ec5('0x3c')]({'plain':!![]});_0x386ad5[_0x8ec5('0x49')]=_['keys'](db['UserChatQueue'][_0x8ec5('0x46')]);_0x386ad5[_0x8ec5('0x4a')]=_[_0x8ec5('0x4b')](_0x929be[_0x8ec5('0x4a')]);_0x386ad5['filters']=_['intersection'](_0x386ad5['model'],_0x386ad5[_0x8ec5('0x4a')]);_0xcb0a8a['attributes']=_[_0x8ec5('0x4c')](_0x386ad5[_0x8ec5('0x49')],qs[_0x8ec5('0x4d')](_0x929be[_0x8ec5('0x4a')][_0x8ec5('0x4d')]));_0xcb0a8a[_0x8ec5('0x4e')]=_0xcb0a8a[_0x8ec5('0x4e')][_0x8ec5('0x4f')]?_0xcb0a8a[_0x8ec5('0x4e')]:_0x386ad5['model'];if(!_0x929be[_0x8ec5('0x4a')][_0x8ec5('0x50')]('nolimit')){_0xcb0a8a[_0x8ec5('0x35')]=qs[_0x8ec5('0x35')](_0x929be[_0x8ec5('0x4a')]['limit']);_0xcb0a8a[_0x8ec5('0x33')]=qs[_0x8ec5('0x33')](_0x929be[_0x8ec5('0x4a')][_0x8ec5('0x33')]);}_0xcb0a8a[_0x8ec5('0x51')]=qs[_0x8ec5('0x52')](_0x929be['query'][_0x8ec5('0x52')]);_0xcb0a8a[_0x8ec5('0x54')]=qs[_0x8ec5('0x6a')](_[_0x8ec5('0x6b')](_0x929be[_0x8ec5('0x4a')],_0x386ad5[_0x8ec5('0x6a')]));_0xcb0a8a['where']['ChatQueueId']=_0x1c9190['id'];if(_0x929be[_0x8ec5('0x4a')][_0x8ec5('0x53')]){_0xcb0a8a[_0x8ec5('0x54')]=_[_0x8ec5('0x55')](_0xcb0a8a[_0x8ec5('0x54')],{'$or':_[_0x8ec5('0x44')](_0xcb0a8a[_0x8ec5('0x4e')],function(_0x2f4c9e){var _0x303976={};_0x303976[_0x2f4c9e]={'$like':'%'+_0x929be[_0x8ec5('0x4a')]['filter']+'%'};return _0x303976;})});}_0xcb0a8a=_[_0x8ec5('0x55')]({},_0xcb0a8a,_0x929be['options']);return db['UserChatQueue']['findAll'](_0xcb0a8a);}})[_0x8ec5('0x3b')](function(_0x289638){if(_0x289638){return db[_0x8ec5('0x6c')][_0x8ec5('0x6d')]({'where':{'id':_[_0x8ec5('0x44')](_0x289638,_0x8ec5('0x6e')),'role':_0x8ec5('0x6f')},'attributes':['id',_0x8ec5('0x41'),_0x8ec5('0x70'),'updatedAt','createdAt']});}})[_0x8ec5('0x3b')](function(_0x58df57){if(_0x58df57){return{'count':_0x58df57[_0x8ec5('0x36')],'rows':_[_0x8ec5('0x44')](_0x58df57[_0x8ec5('0x5a')],function(_0x44a2f3){return{'membername':_0x44a2f3[_0x8ec5('0x41')],'UserId':_0x44a2f3['id'],'queue_name':_0xfc6d6a[_0x8ec5('0x41')],'ChatQueueId':_0xfc6d6a['id'],'interface':util[_0x8ec5('0x71')](_0x8ec5('0x72'),_0x8ec5('0x73'),_0x44a2f3['name']),'penalty':0x0,'paused':_0x44a2f3[_0x8ec5('0x70')],'createdAt':_0x44a2f3[_0x8ec5('0x74')],'updatedAt':_0x44a2f3[_0x8ec5('0x75')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8ec5('0x3b')](respondWithFilteredResult(_0x548b2,_0xcb0a8a))[_0x8ec5('0x2e')](handleError(_0x548b2,null));};exports['getTeams']=function(_0x401e18,_0x35c974,_0x5e7006){var _0x163860={};var _0x1a8f8c={};var _0x51d77f;var _0x54ccea;return db[_0x8ec5('0x45')][_0x8ec5('0x76')]({'where':{'id':_0x401e18[_0x8ec5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x35c974,null))['then'](function(_0x137a10){if(_0x137a10){_0x51d77f=_0x137a10;_0x1a8f8c[_0x8ec5('0x49')]=_[_0x8ec5('0x4b')](db[_0x8ec5('0x77')][_0x8ec5('0x46')]);_0x1a8f8c[_0x8ec5('0x4a')]=_[_0x8ec5('0x4b')](_0x401e18['query']);_0x1a8f8c[_0x8ec5('0x6a')]=_['intersection'](_0x1a8f8c[_0x8ec5('0x49')],_0x1a8f8c[_0x8ec5('0x4a')]);_0x163860['attributes']=_[_0x8ec5('0x4c')](_0x1a8f8c['model'],qs['fields'](_0x401e18[_0x8ec5('0x4a')]['fields']));_0x163860['attributes']=_0x163860[_0x8ec5('0x4e')][_0x8ec5('0x4f')]?_0x163860[_0x8ec5('0x4e')]:_0x1a8f8c[_0x8ec5('0x49')];_0x163860[_0x8ec5('0x51')]=qs['sort'](_0x401e18[_0x8ec5('0x4a')][_0x8ec5('0x52')]);_0x163860[_0x8ec5('0x54')]=qs[_0x8ec5('0x6a')](_[_0x8ec5('0x6b')](_0x401e18[_0x8ec5('0x4a')],_0x1a8f8c['filters']));if(_0x401e18[_0x8ec5('0x4a')][_0x8ec5('0x53')]){_0x163860['where']=_['merge'](_0x163860[_0x8ec5('0x54')],{'$or':_[_0x8ec5('0x44')](_0x163860[_0x8ec5('0x4e')],function(_0x563c79){var _0x48c757={};_0x48c757[_0x563c79]={'$like':'%'+_0x401e18[_0x8ec5('0x4a')]['filter']+'%'};return _0x48c757;})});}_0x163860=_[_0x8ec5('0x55')]({},_0x163860,_0x401e18[_0x8ec5('0x5d')]);return _0x51d77f['getTeams'](_0x163860);}})['then'](function(_0x27ced9){if(_0x27ced9){_0x54ccea=_0x27ced9[_0x8ec5('0x4f')];if(!_0x401e18[_0x8ec5('0x4a')][_0x8ec5('0x50')](_0x8ec5('0x78'))){_0x163860[_0x8ec5('0x35')]=qs[_0x8ec5('0x35')](_0x401e18[_0x8ec5('0x4a')][_0x8ec5('0x35')]);_0x163860[_0x8ec5('0x33')]=qs[_0x8ec5('0x33')](_0x401e18[_0x8ec5('0x4a')]['offset']);}return _0x51d77f[_0x8ec5('0x79')](_0x163860);}})[_0x8ec5('0x3b')](function(_0x45bce7){if(_0x45bce7){return _0x45bce7?{'count':_0x54ccea,'rows':_0x45bce7}:null;}})[_0x8ec5('0x3b')](respondWithResult(_0x35c974,null))[_0x8ec5('0x2e')](handleError(_0x35c974,null));};exports[_0x8ec5('0x7a')]=function(_0x50cee4,_0x1edba1,_0x4d0415){var _0x1e3628=_0x50cee4[_0x8ec5('0x60')]['ids'];return db[_0x8ec5('0x77')]['findAll']({'where':{'id':_0x1e3628},'attributes':['id'],'include':[{'model':db[_0x8ec5('0x6c')],'as':_0x8ec5('0x7b'),'attributes':['id',_0x8ec5('0x41'),_0x8ec5('0x7c'),_0x8ec5('0x7d'),'interface'],'raw':!![]}]})['then'](function(_0x3e567a){if(_0x3e567a){var _0x519e98=_[_0x8ec5('0x7e')](_0x3e567a,function(_0x394f5a){var _0x492b87=_0x394f5a[_0x8ec5('0x3c')]({'plain':!![]});return _0x492b87['Agents'];});return db[_0x8ec5('0x45')][_0x8ec5('0x5e')]({'where':{'id':_0x50cee4[_0x8ec5('0x5c')]['id']}})[_0x8ec5('0x3b')](function(_0x41685e){return db[_0x8ec5('0x7f')][_0x8ec5('0x80')](function(_0x42d8dc){return _0x41685e[_0x8ec5('0x7a')](_0x1e3628,{'transaction':_0x42d8dc})['then'](function(){return BPromise['each'](_0x519e98,function(_0x5e7867){return db[_0x8ec5('0x81')][_0x8ec5('0x82')]({'where':{'UserId':_0x5e7867['id'],'ChatQueueId':_0x50cee4[_0x8ec5('0x5c')]['id']},'transaction':_0x42d8dc});});})[_0x8ec5('0x3b')](function(){_0x519e98[_0x8ec5('0x83')](function(_0x3163ba){socket['emit'](_0x8ec5('0x84'),{'UserId':_0x3163ba['id'],'ChatQueueId':_0x41685e['id']});});});});});}})['then'](respondWithStatusCode(_0x1edba1,null))[_0x8ec5('0x2e')](handleError(_0x1edba1,null));};exports[_0x8ec5('0x85')]=function(_0x4b8fa7,_0x8b367f,_0x549532){return db['Team'][_0x8ec5('0x59')]({'where':{'id':_0x4b8fa7[_0x8ec5('0x4a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8ec5('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8ec5('0x3b')](handleEntityNotFound(_0x8b367f,null))['then'](function(_0x150824){var _0x31ea34=_[_0x8ec5('0x44')](_0x150824,'id');var _0xa72dfb=[];var _0x5bdf32=[];var _0xf00c2b=squel[_0x8ec5('0x86')]();_0xf00c2b[_0x8ec5('0x87')](_0x8ec5('0x88'))[_0x8ec5('0x89')](_0x8ec5('0x8a'),'tq')[_0x8ec5('0x8b')](_0x8ec5('0x8c'),'ut',_0x8ec5('0x8d'))['where'](_0x8ec5('0x8e'),_0x4b8fa7['params']['id']);for(var _0x2c4b34=0x0;_0x2c4b34<_0x150824[_0x8ec5('0x4f')];_0x2c4b34+=0x1){let _0x11a476=_0x150824[_0x2c4b34];for(var _0xc18e6=0x0;_0xc18e6<_0x11a476[_0x8ec5('0x7b')]['length'];_0xc18e6+=0x1){let _0x1c1b57=_0x11a476[_0x8ec5('0x7b')][_0xc18e6];var _0x1b80bc=_0xf00c2b[_0x8ec5('0x8f')]();_0x1b80bc[_0x8ec5('0x54')](_0x8ec5('0x90'),_0x1c1b57['id']);_0x5bdf32[_0x8ec5('0x91')](db['sequelize'][_0x8ec5('0x4a')](_0x1b80bc[_0x8ec5('0x92')](),{'type':db[_0x8ec5('0x7f')][_0x8ec5('0x93')][_0x8ec5('0x94')]})['then'](function(_0x2711c6){if(_0x2711c6['length']===0x1){return _0x1c1b57['id'];}else{var _0x468e8f=_[_0x8ec5('0x95')](_[_0x8ec5('0x44')](_0x2711c6,_0x8ec5('0x96')),function(_0x893ae5){return _[_0x8ec5('0x97')](_0x31ea34,_0x893ae5);});if(_0x468e8f){return _0x1c1b57['id'];}}}));}}return BPromise[_0x8ec5('0x98')](_0x5bdf32)['then'](function(_0x434766){_0xa72dfb=_(_0xa72dfb)[_0x8ec5('0x99')](_0x434766)[_0x8ec5('0x9a')]()['value']();return db['ChatQueue'][_0x8ec5('0x5e')]({'where':{'id':_0x4b8fa7['params']['id']}})[_0x8ec5('0x3b')](function(_0x2c9825){return db[_0x8ec5('0x7f')][_0x8ec5('0x80')](function(_0x5af4f0){return _0x2c9825[_0x8ec5('0x85')](_0x4b8fa7[_0x8ec5('0x4a')]['ids'],{'transaction':_0x5af4f0})['then'](function(){if(!_[_0x8ec5('0x9b')](_0xa72dfb)){return _0x2c9825[_0x8ec5('0x9c')](_0xa72dfb,{'transaction':_0x5af4f0});}})[_0x8ec5('0x3b')](function(){_0xa72dfb[_0x8ec5('0x83')](function(_0x42f168){socket[_0x8ec5('0x9d')](_0x8ec5('0x9e'),{'UserId':_0x42f168,'ChatQueueId':_0x2c9825['id']});});});});});});})['then'](respondWithStatusCode(_0x8b367f,null))[_0x8ec5('0x2e')](handleError(_0x8b367f,null));};exports[_0x8ec5('0x9f')]=function(_0xdeff5c,_0x2fe01a,_0x4f4546){return db[_0x8ec5('0x45')]['find']({'where':{'id':_0xdeff5c['params']['id']}})[_0x8ec5('0x3b')](handleEntityNotFound(_0x2fe01a,null))[_0x8ec5('0x3b')](function(_0xf1b21a){if(_0xf1b21a){return _0xf1b21a[_0x8ec5('0x9f')](_0xdeff5c[_0x8ec5('0x60')]['ids'],_[_0x8ec5('0xa0')](_0xdeff5c[_0x8ec5('0x60')],[_0x8ec5('0xa1'),'id'])||{})['spread'](function(_0x37aebb){for(var _0x280c5a=0x0;_0x280c5a<_0xdeff5c[_0x8ec5('0x60')]['ids'][_0x8ec5('0x4f')];_0x280c5a+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0xdeff5c[_0x8ec5('0x60')][_0x8ec5('0xa1')][_0x280c5a]),'ChatQueueId':Number(_0xdeff5c[_0x8ec5('0x5c')]['id'])});}return _0x37aebb;});}})['then'](respondWithResult(_0x2fe01a,null))['catch'](handleError(_0x2fe01a,null));};exports['removeAgents']=function(_0xa289a5,_0x1d965a,_0x42f4c5){return db[_0x8ec5('0x45')][_0x8ec5('0x5e')]({'where':{'id':_0xa289a5['params']['id']}})[_0x8ec5('0x3b')](handleEntityNotFound(_0x1d965a,null))[_0x8ec5('0x3b')](function(_0x20c660){if(_0x20c660){return _0x20c660[_0x8ec5('0x9c')](_0xa289a5[_0x8ec5('0x4a')][_0x8ec5('0xa1')])[_0x8ec5('0x3b')](function(){if(_[_0x8ec5('0xa2')](_0xa289a5[_0x8ec5('0x4a')][_0x8ec5('0xa1')])){for(var _0x102ecd=0x0;_0x102ecd<_0xa289a5[_0x8ec5('0x4a')][_0x8ec5('0xa1')][_0x8ec5('0x4f')];_0x102ecd+=0x1){socket[_0x8ec5('0x9d')](_0x8ec5('0x9e'),{'UserId':Number(_0xa289a5[_0x8ec5('0x4a')][_0x8ec5('0xa1')][_0x102ecd]),'ChatQueueId':Number(_0xa289a5[_0x8ec5('0x5c')]['id'])});}}else{socket[_0x8ec5('0x9d')]('userChatQueue:remove',{'UserId':Number(_0xa289a5['query'][_0x8ec5('0xa1')]),'ChatQueueId':Number(_0xa289a5[_0x8ec5('0x5c')]['id'])});}});}})[_0x8ec5('0x3b')](respondWithStatusCode(_0x1d965a,null))['catch'](handleError(_0x1d965a,null));};exports[_0x8ec5('0xa3')]=function(_0x21fbf4,_0x2f240f,_0xb20bef){var _0x28b46a={};var _0x442722={};var _0x1bf66e;var _0xf8f4dc;return db['ChatQueue'][_0x8ec5('0x76')]({'where':{'id':_0x21fbf4['params']['id']}})['then'](handleEntityNotFound(_0x2f240f,null))[_0x8ec5('0x3b')](function(_0x566b5c){if(_0x566b5c){_0x1bf66e=_0x566b5c;_0x442722['model']=_[_0x8ec5('0x4b')](db[_0x8ec5('0x6c')][_0x8ec5('0x46')]);_0x442722['query']=_[_0x8ec5('0x4b')](_0x21fbf4['query']);_0x442722[_0x8ec5('0x6a')]=_[_0x8ec5('0x4c')](_0x442722[_0x8ec5('0x49')],_0x442722['query']);_0x28b46a['attributes']=_[_0x8ec5('0x4c')](_0x442722[_0x8ec5('0x49')],qs[_0x8ec5('0x4d')](_0x21fbf4['query']['fields']));_0x28b46a['attributes']=_0x28b46a[_0x8ec5('0x4e')][_0x8ec5('0x4f')]?_0x28b46a[_0x8ec5('0x4e')]:_0x442722[_0x8ec5('0x49')];_0x28b46a[_0x8ec5('0x51')]=qs[_0x8ec5('0x52')](_0x21fbf4[_0x8ec5('0x4a')][_0x8ec5('0x52')]);_0x28b46a[_0x8ec5('0x54')]=qs[_0x8ec5('0x6a')](_[_0x8ec5('0x6b')](_0x21fbf4[_0x8ec5('0x4a')],_0x442722[_0x8ec5('0x6a')]));if(_0x21fbf4[_0x8ec5('0x4a')]['filter']){_0x28b46a['where']=_[_0x8ec5('0x55')](_0x28b46a[_0x8ec5('0x54')],{'$or':_[_0x8ec5('0x44')](_0x28b46a[_0x8ec5('0x4e')],function(_0x37bb7a){var _0x4f292c={};_0x4f292c[_0x37bb7a]={'$like':'%'+_0x21fbf4[_0x8ec5('0x4a')][_0x8ec5('0x53')]+'%'};return _0x4f292c;})});}_0x28b46a=_['merge']({},_0x28b46a,_0x21fbf4[_0x8ec5('0x5d')]);return _0x1bf66e[_0x8ec5('0xa3')](_0x28b46a);}})[_0x8ec5('0x3b')](function(_0x176ae4){if(_0x176ae4){_0xf8f4dc=_0x176ae4[_0x8ec5('0x4f')];if(!_0x21fbf4[_0x8ec5('0x4a')]['hasOwnProperty'](_0x8ec5('0x78'))){_0x28b46a[_0x8ec5('0x35')]=qs[_0x8ec5('0x35')](_0x21fbf4[_0x8ec5('0x4a')][_0x8ec5('0x35')]);_0x28b46a[_0x8ec5('0x33')]=qs['offset'](_0x21fbf4[_0x8ec5('0x4a')][_0x8ec5('0x33')]);}return _0x1bf66e['getAgents'](_0x28b46a);}})[_0x8ec5('0x3b')](function(_0x42e26d){if(_0x42e26d){return _0x42e26d?{'count':_0xf8f4dc,'rows':_0x42e26d}:null;}})[_0x8ec5('0x3b')](respondWithResult(_0x2f240f,null))[_0x8ec5('0x2e')](handleError(_0x2f240f,null));}; \ No newline at end of file +var _0x7203=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','User','findAndCountAll','agent','updatedAt','createdAt','format','SIP','chatPause','getTeams','Team','addTeams','ids','findAll','Agents','voicePause','sequelize','transaction','each','UserChatQueue','emit','userChatQueue:save','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','union','compact','value','removeTeams','forEach','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','rows','show','params','find','body','role','user'];(function(_0xcc6d3f,_0x45a0b7){var _0x52811a=function(_0x9b2d22){while(--_0x9b2d22){_0xcc6d3f['push'](_0xcc6d3f['shift']());}};_0x52811a(++_0x45a0b7);}(_0x7203,0x1d4));var _0x3720=function(_0x10dfc9,_0x25b62c){_0x10dfc9=_0x10dfc9-0x0;var _0x154afc=_0x7203[_0x10dfc9];return _0x154afc;};'use strict';var emlformat=require(_0x3720('0x0'));var rimraf=require(_0x3720('0x1'));var zipdir=require(_0x3720('0x2'));var jsonpatch=require(_0x3720('0x3'));var rp=require(_0x3720('0x4'));var moment=require(_0x3720('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3720('0x6'));var path=require(_0x3720('0x7'));var sox=require(_0x3720('0x8'));var csv=require('to-csv');var ejs=require(_0x3720('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3720('0xa'));var squel=require(_0x3720('0xb'));var crypto=require(_0x3720('0xc'));var jsforce=require(_0x3720('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3720('0xe'));var querystring=require(_0x3720('0xf'));var Papa=require(_0x3720('0x10'));var Redis=require(_0x3720('0x11'));var authService=require(_0x3720('0x12'));var qs=require(_0x3720('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3720('0x14'))('api');var utils=require(_0x3720('0x15'));var config=require(_0x3720('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3720('0x17'))['db'];config[_0x3720('0x18')]=_[_0x3720('0x19')](config['redis'],{'host':_0x3720('0x1a'),'port':0x18eb});var socket=require(_0x3720('0x1b'))(new Redis(config[_0x3720('0x18')]));require(_0x3720('0x1c'))['register'](socket);var jayson=require(_0x3720('0x1d'));var client=jayson[_0x3720('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301fed,_0x1d6918,_0x35a4d0,_0x19e5a6){return new BPromise(function(_0x34f69b,_0x1ebd71){var _0x122292=_0x19e5a6||client;return _0x122292[_0x3720('0x1f')](_0x301fed,_0x35a4d0)[_0x3720('0x20')](function(_0x13eb08){logger[_0x3720('0x21')](_0x3720('0x22'),_0x1d6918,_0x3720('0x23'));logger[_0x3720('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1d6918,_0x3720('0x23'),JSON[_0x3720('0x25')](_0x13eb08));if(_0x13eb08[_0x3720('0x26')]){if(_0x13eb08[_0x3720('0x26')][_0x3720('0x27')]===0x1f4){logger[_0x3720('0x26')](_0x3720('0x22'),_0x1d6918,_0x13eb08[_0x3720('0x26')][_0x3720('0x28')]);return _0x1ebd71(_0x13eb08[_0x3720('0x26')][_0x3720('0x28')]);}logger['error'](_0x3720('0x22'),_0x1d6918,_0x13eb08[_0x3720('0x26')]['message']);return _0x34f69b(_0x13eb08[_0x3720('0x26')][_0x3720('0x28')]);}else{logger[_0x3720('0x21')](_0x3720('0x22'),_0x1d6918,_0x3720('0x23'));_0x34f69b(_0x13eb08[_0x3720('0x29')][_0x3720('0x28')]);}})[_0x3720('0x2a')](function(_0xa40189){logger[_0x3720('0x26')](_0x3720('0x22'),_0x1d6918,_0xa40189);_0x1ebd71(_0xa40189);});});}function respondWithStatusCode(_0x208553,_0x59ecc7){_0x59ecc7=_0x59ecc7||0xcc;return function(_0x27dd55){if(_0x27dd55){return _0x208553[_0x3720('0x2b')](_0x59ecc7);}return _0x208553[_0x3720('0x2c')](_0x59ecc7)[_0x3720('0x2d')]();};}function respondWithResult(_0x4f63e9,_0x4c21ca){_0x4c21ca=_0x4c21ca||0xc8;return function(_0x5e799b){if(_0x5e799b){return _0x4f63e9[_0x3720('0x2c')](_0x4c21ca)['json'](_0x5e799b);}};}function respondWithFilteredResult(_0x15ff3f,_0x30201d){return function(_0x2030b5){if(_0x2030b5){var _0x85a1da=typeof _0x30201d['offset']===_0x3720('0x2e')&&typeof _0x30201d[_0x3720('0x2f')]===_0x3720('0x2e');var _0x24b2b9=_0x2030b5[_0x3720('0x30')];var _0x5b8757=_0x85a1da?0x0:_0x30201d['offset'];var _0x8b4db2=_0x85a1da?_0x2030b5['count']:_0x30201d[_0x3720('0x31')]+_0x30201d[_0x3720('0x2f')];var _0x37fb8a;if(_0x8b4db2>=_0x24b2b9){_0x8b4db2=_0x24b2b9;_0x37fb8a=0xc8;}else{_0x37fb8a=0xce;}_0x15ff3f[_0x3720('0x2c')](_0x37fb8a);return _0x15ff3f['set'](_0x3720('0x32'),_0x5b8757+'-'+_0x8b4db2+'/'+_0x24b2b9)['json'](_0x2030b5);}return null;};}function patchUpdates(_0x4d4f8a){return function(_0x523ac8){try{jsonpatch[_0x3720('0x33')](_0x523ac8,_0x4d4f8a,!![]);}catch(_0x43379b){return BPromise[_0x3720('0x34')](_0x43379b);}return _0x523ac8[_0x3720('0x35')]();};}function saveUpdates(_0x54d92f,_0x388767){return function(_0x33bf8e){if(_0x33bf8e){return _0x33bf8e[_0x3720('0x36')](_0x54d92f)[_0x3720('0x20')](function(_0x36a3d0){return _0x36a3d0;});}return null;};}function removeEntity(_0x59cd25,_0x5d435e){return function(_0xd05d0e){if(_0xd05d0e){return _0xd05d0e[_0x3720('0x37')]()[_0x3720('0x20')](function(){var _0x265ef9=_0xd05d0e[_0x3720('0x38')]({'plain':!![]});var _0x397396=_0x3720('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x397396,'resourceId':_0x265ef9['id']}})['then'](function(){return _0xd05d0e;});})['then'](function(){_0x59cd25['status'](0xcc)[_0x3720('0x2d')]();});}};}function handleEntityNotFound(_0x18aca3,_0x306a71){return function(_0x2c7930){if(!_0x2c7930){_0x18aca3[_0x3720('0x2b')](0x194);}return _0x2c7930;};}function handleError(_0x4ea38e,_0x43e245){_0x43e245=_0x43e245||0x1f4;return function(_0x4d923f){logger[_0x3720('0x26')](_0x4d923f[_0x3720('0x3a')]);if(_0x4d923f[_0x3720('0x3b')]){delete _0x4d923f['name'];}_0x4ea38e['status'](_0x43e245)[_0x3720('0x3c')](_0x4d923f);};}exports[_0x3720('0x3d')]=function(_0x60ce84,_0x3137ad){var _0x5327ee={},_0x130cdb={},_0x2a4b28={'count':0x0,'rows':[]};var _0xaf92b3=_[_0x3720('0x3e')](db[_0x3720('0x3f')][_0x3720('0x40')],function(_0x2330d9){return{'name':_0x2330d9[_0x3720('0x41')],'type':_0x2330d9['type'][_0x3720('0x42')]};});_0x130cdb[_0x3720('0x43')]=_[_0x3720('0x3e')](_0xaf92b3,_0x3720('0x3b'));_0x130cdb['query']=_[_0x3720('0x44')](_0x60ce84['query']);_0x130cdb[_0x3720('0x45')]=_[_0x3720('0x46')](_0x130cdb['model'],_0x130cdb[_0x3720('0x47')]);_0x5327ee['attributes']=_[_0x3720('0x46')](_0x130cdb[_0x3720('0x43')],qs[_0x3720('0x48')](_0x60ce84['query'][_0x3720('0x48')]));_0x5327ee[_0x3720('0x49')]=_0x5327ee[_0x3720('0x49')][_0x3720('0x4a')]?_0x5327ee[_0x3720('0x49')]:_0x130cdb[_0x3720('0x43')];if(!_0x60ce84[_0x3720('0x47')][_0x3720('0x4b')]('nolimit')){_0x5327ee[_0x3720('0x2f')]=qs[_0x3720('0x2f')](_0x60ce84[_0x3720('0x47')][_0x3720('0x2f')]);_0x5327ee[_0x3720('0x31')]=qs['offset'](_0x60ce84[_0x3720('0x47')][_0x3720('0x31')]);}_0x5327ee[_0x3720('0x4c')]=qs['sort'](_0x60ce84['query'][_0x3720('0x4d')]);_0x5327ee['where']=qs['filters'](_[_0x3720('0x4e')](_0x60ce84['query'],_0x130cdb[_0x3720('0x45')]),_0xaf92b3);if(_0x60ce84[_0x3720('0x47')][_0x3720('0x4f')]){_0x5327ee[_0x3720('0x50')]=_[_0x3720('0x51')](_0x5327ee[_0x3720('0x50')],{'$or':_[_0x3720('0x3e')](_0xaf92b3,function(_0x8bccfa){if(_0x8bccfa['type']!=='VIRTUAL'){var _0x73f8cb={};_0x73f8cb[_0x8bccfa[_0x3720('0x3b')]]={'$like':'%'+_0x60ce84[_0x3720('0x47')][_0x3720('0x4f')]+'%'};return _0x73f8cb;}})});}_0x5327ee=_['merge']({},_0x5327ee,_0x60ce84[_0x3720('0x52')]);var _0x44005b={'where':_0x5327ee['where']};return db[_0x3720('0x3f')][_0x3720('0x30')](_0x44005b)[_0x3720('0x20')](function(_0x500984){_0x2a4b28[_0x3720('0x30')]=_0x500984;if(_0x60ce84[_0x3720('0x47')][_0x3720('0x53')]){_0x5327ee[_0x3720('0x54')]=[{'all':!![]}];}return db[_0x3720('0x3f')]['findAll'](_0x5327ee);})[_0x3720('0x20')](function(_0x45e419){_0x2a4b28[_0x3720('0x55')]=_0x45e419;return _0x2a4b28;})['then'](respondWithFilteredResult(_0x3137ad,_0x5327ee))[_0x3720('0x2a')](handleError(_0x3137ad,null));};exports[_0x3720('0x56')]=function(_0x404951,_0x29ece4){var _0x1201f9={'raw':!![],'where':{'id':_0x404951[_0x3720('0x57')]['id']}},_0x2845f9={};_0x2845f9[_0x3720('0x43')]=_[_0x3720('0x44')](db[_0x3720('0x3f')][_0x3720('0x40')]);_0x2845f9[_0x3720('0x47')]=_[_0x3720('0x44')](_0x404951[_0x3720('0x47')]);_0x2845f9[_0x3720('0x45')]=_[_0x3720('0x46')](_0x2845f9[_0x3720('0x43')],_0x2845f9[_0x3720('0x47')]);_0x1201f9[_0x3720('0x49')]=_[_0x3720('0x46')](_0x2845f9[_0x3720('0x43')],qs[_0x3720('0x48')](_0x404951[_0x3720('0x47')]['fields']));_0x1201f9[_0x3720('0x49')]=_0x1201f9['attributes']['length']?_0x1201f9[_0x3720('0x49')]:_0x2845f9['model'];if(_0x404951['query'][_0x3720('0x53')]){_0x1201f9[_0x3720('0x54')]=[{'all':!![]}];}_0x1201f9=_[_0x3720('0x51')]({},_0x1201f9,_0x404951['options']);return db['ChatQueue'][_0x3720('0x58')](_0x1201f9)[_0x3720('0x20')](handleEntityNotFound(_0x29ece4,null))[_0x3720('0x20')](respondWithResult(_0x29ece4,null))[_0x3720('0x2a')](handleError(_0x29ece4,null));};exports['create']=function(_0x4318c4,_0x355941){return db['ChatQueue']['create'](_0x4318c4[_0x3720('0x59')],{})[_0x3720('0x20')](function(_0xc8f17a){var _0x4ec85a=_0x4318c4['user']['get']({'plain':!![]});if(!_0x4ec85a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec85a[_0x3720('0x5a')]===_0x3720('0x5b')){var _0x5c6889=_0xc8f17a[_0x3720('0x38')]({'plain':!![]});var _0x41125f=_0x3720('0x39');return db['UserProfileSection'][_0x3720('0x58')]({'where':{'name':_0x41125f,'userProfileId':_0x4ec85a['userProfileId']},'raw':!![]})[_0x3720('0x20')](function(_0x224226){if(_0x224226&&_0x224226[_0x3720('0x5c')]===0x0){return db['UserProfileResource'][_0x3720('0x5d')]({'name':_0x5c6889[_0x3720('0x3b')],'resourceId':_0x5c6889['id'],'type':_0x224226['name'],'sectionId':_0x224226['id']},{})['then'](function(){return _0xc8f17a;});}else{return _0xc8f17a;}})[_0x3720('0x2a')](function(_0x1b1297){logger[_0x3720('0x26')](_0x3720('0x5e'),_0x1b1297);throw _0x1b1297;});}return _0xc8f17a;})[_0x3720('0x20')](respondWithResult(_0x355941,0xc9))[_0x3720('0x2a')](handleError(_0x355941,null));};exports[_0x3720('0x36')]=function(_0x2af6ed,_0x29a2c2){if(_0x2af6ed[_0x3720('0x59')]['id']){delete _0x2af6ed[_0x3720('0x59')]['id'];}return db[_0x3720('0x3f')][_0x3720('0x58')]({'where':{'id':_0x2af6ed[_0x3720('0x57')]['id']}})[_0x3720('0x20')](handleEntityNotFound(_0x29a2c2,null))[_0x3720('0x20')](saveUpdates(_0x2af6ed[_0x3720('0x59')],null))['then'](respondWithResult(_0x29a2c2,null))[_0x3720('0x2a')](handleError(_0x29a2c2,null));};exports[_0x3720('0x37')]=function(_0x42f259,_0x5dfbb0){return db[_0x3720('0x3f')][_0x3720('0x58')]({'where':{'id':_0x42f259[_0x3720('0x57')]['id']}})[_0x3720('0x20')](handleEntityNotFound(_0x5dfbb0,null))[_0x3720('0x20')](removeEntity(_0x5dfbb0,null))[_0x3720('0x2a')](handleError(_0x5dfbb0,null));};exports[_0x3720('0x5f')]=function(_0x460c4c,_0x51eaf4){return db[_0x3720('0x3f')][_0x3720('0x5f')]()[_0x3720('0x20')](respondWithResult(_0x51eaf4,null))[_0x3720('0x2a')](handleError(_0x51eaf4,null));};exports[_0x3720('0x60')]=function(_0x5eefa3,_0x2920bc,_0x5c16a9){var _0x51db32={'raw':!![],'where':{}},_0x2a81f9={},_0x4cf321;return db['ChatQueue'][_0x3720('0x61')]({'where':{'id':_0x5eefa3[_0x3720('0x57')]['id']}})[_0x3720('0x20')](handleEntityNotFound(_0x2920bc,null))[_0x3720('0x20')](function(_0x3d5042){if(_0x3d5042){_0x4cf321=_0x3d5042['get']({'plain':!![]});_0x2a81f9[_0x3720('0x43')]=_[_0x3720('0x44')](db['UserChatQueue']['rawAttributes']);_0x2a81f9['query']=_[_0x3720('0x44')](_0x5eefa3[_0x3720('0x47')]);_0x2a81f9[_0x3720('0x45')]=_[_0x3720('0x46')](_0x2a81f9[_0x3720('0x43')],_0x2a81f9['query']);_0x51db32[_0x3720('0x49')]=_[_0x3720('0x46')](_0x2a81f9['model'],qs['fields'](_0x5eefa3['query']['fields']));_0x51db32[_0x3720('0x49')]=_0x51db32[_0x3720('0x49')]['length']?_0x51db32['attributes']:_0x2a81f9[_0x3720('0x43')];if(!_0x5eefa3['query']['hasOwnProperty'](_0x3720('0x62'))){_0x51db32['limit']=qs[_0x3720('0x2f')](_0x5eefa3[_0x3720('0x47')][_0x3720('0x2f')]);_0x51db32['offset']=qs[_0x3720('0x31')](_0x5eefa3[_0x3720('0x47')][_0x3720('0x31')]);}_0x51db32['order']=qs['sort'](_0x5eefa3[_0x3720('0x47')]['sort']);_0x51db32[_0x3720('0x50')]=qs[_0x3720('0x45')](_[_0x3720('0x4e')](_0x5eefa3[_0x3720('0x47')],_0x2a81f9[_0x3720('0x45')]));_0x51db32[_0x3720('0x50')]['ChatQueueId']=_0x3d5042['id'];if(_0x5eefa3[_0x3720('0x47')][_0x3720('0x4f')]){_0x51db32[_0x3720('0x50')]=_[_0x3720('0x51')](_0x51db32[_0x3720('0x50')],{'$or':_['map'](_0x51db32[_0x3720('0x49')],function(_0x236e7e){var _0x247a9b={};_0x247a9b[_0x236e7e]={'$like':'%'+_0x5eefa3[_0x3720('0x47')][_0x3720('0x4f')]+'%'};return _0x247a9b;})});}_0x51db32=_[_0x3720('0x51')]({},_0x51db32,_0x5eefa3[_0x3720('0x52')]);return db['UserChatQueue']['findAll'](_0x51db32);}})[_0x3720('0x20')](function(_0x415509){if(_0x415509){return db[_0x3720('0x63')][_0x3720('0x64')]({'where':{'id':_['map'](_0x415509,'UserId'),'role':_0x3720('0x65')},'attributes':['id',_0x3720('0x3b'),'chatPause',_0x3720('0x66'),_0x3720('0x67')]});}})[_0x3720('0x20')](function(_0x2e4529){if(_0x2e4529){return{'count':_0x2e4529[_0x3720('0x30')],'rows':_[_0x3720('0x3e')](_0x2e4529[_0x3720('0x55')],function(_0x207f31){return{'membername':_0x207f31[_0x3720('0x3b')],'UserId':_0x207f31['id'],'queue_name':_0x4cf321[_0x3720('0x3b')],'ChatQueueId':_0x4cf321['id'],'interface':util[_0x3720('0x68')]('%s/%s',_0x3720('0x69'),_0x207f31[_0x3720('0x3b')]),'penalty':0x0,'paused':_0x207f31[_0x3720('0x6a')],'createdAt':_0x207f31[_0x3720('0x67')],'updatedAt':_0x207f31['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3720('0x20')](respondWithFilteredResult(_0x2920bc,_0x51db32))[_0x3720('0x2a')](handleError(_0x2920bc,null));};exports[_0x3720('0x6b')]=function(_0x5f20fc,_0x364f53,_0x1ce1d9){var _0x1e67df={};var _0x24dac7={};var _0xbeedb1;var _0x4cf368;return db['ChatQueue'][_0x3720('0x61')]({'where':{'id':_0x5f20fc[_0x3720('0x57')]['id']}})[_0x3720('0x20')](handleEntityNotFound(_0x364f53,null))[_0x3720('0x20')](function(_0x1c4505){if(_0x1c4505){_0xbeedb1=_0x1c4505;_0x24dac7['model']=_[_0x3720('0x44')](db[_0x3720('0x6c')][_0x3720('0x40')]);_0x24dac7[_0x3720('0x47')]=_[_0x3720('0x44')](_0x5f20fc[_0x3720('0x47')]);_0x24dac7[_0x3720('0x45')]=_['intersection'](_0x24dac7['model'],_0x24dac7[_0x3720('0x47')]);_0x1e67df[_0x3720('0x49')]=_['intersection'](_0x24dac7[_0x3720('0x43')],qs[_0x3720('0x48')](_0x5f20fc[_0x3720('0x47')][_0x3720('0x48')]));_0x1e67df[_0x3720('0x49')]=_0x1e67df[_0x3720('0x49')][_0x3720('0x4a')]?_0x1e67df['attributes']:_0x24dac7['model'];_0x1e67df['order']=qs[_0x3720('0x4d')](_0x5f20fc[_0x3720('0x47')]['sort']);_0x1e67df[_0x3720('0x50')]=qs['filters'](_[_0x3720('0x4e')](_0x5f20fc[_0x3720('0x47')],_0x24dac7['filters']));if(_0x5f20fc[_0x3720('0x47')]['filter']){_0x1e67df[_0x3720('0x50')]=_[_0x3720('0x51')](_0x1e67df[_0x3720('0x50')],{'$or':_[_0x3720('0x3e')](_0x1e67df[_0x3720('0x49')],function(_0x8db0ea){var _0x30b490={};_0x30b490[_0x8db0ea]={'$like':'%'+_0x5f20fc['query'][_0x3720('0x4f')]+'%'};return _0x30b490;})});}_0x1e67df=_['merge']({},_0x1e67df,_0x5f20fc[_0x3720('0x52')]);return _0xbeedb1[_0x3720('0x6b')](_0x1e67df);}})[_0x3720('0x20')](function(_0xc558c2){if(_0xc558c2){_0x4cf368=_0xc558c2['length'];if(!_0x5f20fc['query'][_0x3720('0x4b')](_0x3720('0x62'))){_0x1e67df[_0x3720('0x2f')]=qs[_0x3720('0x2f')](_0x5f20fc[_0x3720('0x47')]['limit']);_0x1e67df[_0x3720('0x31')]=qs[_0x3720('0x31')](_0x5f20fc[_0x3720('0x47')][_0x3720('0x31')]);}return _0xbeedb1[_0x3720('0x6b')](_0x1e67df);}})['then'](function(_0x467fac){if(_0x467fac){return _0x467fac?{'count':_0x4cf368,'rows':_0x467fac}:null;}})[_0x3720('0x20')](respondWithResult(_0x364f53,null))['catch'](handleError(_0x364f53,null));};exports[_0x3720('0x6d')]=function(_0x12c8a0,_0x5547ec,_0xc55b40){var _0x5b91ef=_0x12c8a0[_0x3720('0x59')][_0x3720('0x6e')];return db['Team'][_0x3720('0x6f')]({'where':{'id':_0x5b91ef},'attributes':['id'],'include':[{'model':db[_0x3720('0x63')],'as':_0x3720('0x70'),'attributes':['id','name','online',_0x3720('0x71'),'interface'],'raw':!![]}]})['then'](function(_0x55e2b1){if(_0x55e2b1){var _0x217827=_['flatMap'](_0x55e2b1,function(_0x15a51f){var _0x4b3ca7=_0x15a51f[_0x3720('0x38')]({'plain':!![]});return _0x4b3ca7[_0x3720('0x70')];});return db[_0x3720('0x3f')][_0x3720('0x58')]({'where':{'id':_0x12c8a0[_0x3720('0x57')]['id']}})[_0x3720('0x20')](function(_0x3ad503){return db[_0x3720('0x72')][_0x3720('0x73')](function(_0x13c4a4){return _0x3ad503[_0x3720('0x6d')](_0x5b91ef,{'transaction':_0x13c4a4})[_0x3720('0x20')](function(){return BPromise[_0x3720('0x74')](_0x217827,function(_0x5191df){return db[_0x3720('0x75')]['findOrCreate']({'where':{'UserId':_0x5191df['id'],'ChatQueueId':_0x12c8a0['params']['id']},'transaction':_0x13c4a4});});})['then'](function(){_0x217827['forEach'](function(_0x4d3600){socket[_0x3720('0x76')](_0x3720('0x77'),{'UserId':_0x4d3600['id'],'ChatQueueId':_0x3ad503['id']});});});});});}})[_0x3720('0x20')](respondWithStatusCode(_0x5547ec,null))['catch'](handleError(_0x5547ec,null));};exports['removeTeams']=function(_0x151d84,_0x3c635c,_0x3cb5fd){return db['Team'][_0x3720('0x6f')]({'where':{'id':_0x151d84[_0x3720('0x47')][_0x3720('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x3720('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3720('0x20')](handleEntityNotFound(_0x3c635c,null))[_0x3720('0x20')](function(_0x9d6b03){var _0x3ff82f=_[_0x3720('0x3e')](_0x9d6b03,'id');var _0x222882=[];var _0x34f60a=[];var _0x88810d=squel['select']();_0x88810d[_0x3720('0x78')]('tq.TeamId')[_0x3720('0x79')]('team_has_chat_queues','tq')[_0x3720('0x7a')](_0x3720('0x7b'),'ut',_0x3720('0x7c'))[_0x3720('0x50')]('ChatQueueId\x20=\x20?',_0x151d84[_0x3720('0x57')]['id']);for(var _0x4dfe4c=0x0;_0x4dfe4c<_0x9d6b03[_0x3720('0x4a')];_0x4dfe4c+=0x1){let _0x334d15=_0x9d6b03[_0x4dfe4c];for(var _0x5c6686=0x0;_0x5c6686<_0x334d15[_0x3720('0x70')][_0x3720('0x4a')];_0x5c6686+=0x1){let _0x10d813=_0x334d15[_0x3720('0x70')][_0x5c6686];var _0x25b932=_0x88810d['clone']();_0x25b932[_0x3720('0x50')](_0x3720('0x7d'),_0x10d813['id']);_0x34f60a[_0x3720('0x7e')](db[_0x3720('0x72')][_0x3720('0x47')](_0x25b932[_0x3720('0x7f')](),{'type':db[_0x3720('0x72')]['QueryTypes']['SELECT']})['then'](function(_0x5a1e4e){if(_0x5a1e4e[_0x3720('0x4a')]===0x1){return _0x10d813['id'];}else{var _0x1859e1=_['every'](_[_0x3720('0x3e')](_0x5a1e4e,'TeamId'),function(_0xba16b3){return _['includes'](_0x3ff82f,_0xba16b3);});if(_0x1859e1){return _0x10d813['id'];}}}));}}return BPromise['all'](_0x34f60a)[_0x3720('0x20')](function(_0x3a150f){_0x222882=_(_0x222882)[_0x3720('0x80')](_0x3a150f)[_0x3720('0x81')]()[_0x3720('0x82')]();return db[_0x3720('0x3f')][_0x3720('0x58')]({'where':{'id':_0x151d84[_0x3720('0x57')]['id']}})[_0x3720('0x20')](function(_0x111699){return db[_0x3720('0x72')][_0x3720('0x73')](function(_0x252e62){return _0x111699[_0x3720('0x83')](_0x151d84[_0x3720('0x47')][_0x3720('0x6e')],{'transaction':_0x252e62})[_0x3720('0x20')](function(){if(!_['isEmpty'](_0x222882)){return _0x111699['removeAgents'](_0x222882,{'transaction':_0x252e62});}})[_0x3720('0x20')](function(){_0x222882[_0x3720('0x84')](function(_0x26384c){socket[_0x3720('0x76')]('userChatQueue:remove',{'UserId':_0x26384c,'ChatQueueId':_0x111699['id']});});});});});});})[_0x3720('0x20')](respondWithStatusCode(_0x3c635c,null))['catch'](handleError(_0x3c635c,null));};exports[_0x3720('0x85')]=function(_0x1330b1,_0x1bfd79,_0x2ffab0){return db[_0x3720('0x3f')]['find']({'where':{'id':_0x1330b1[_0x3720('0x57')]['id']}})['then'](handleEntityNotFound(_0x1bfd79,null))[_0x3720('0x20')](function(_0x6378c8){if(_0x6378c8){return _0x6378c8[_0x3720('0x85')](_0x1330b1[_0x3720('0x59')][_0x3720('0x6e')],_[_0x3720('0x86')](_0x1330b1[_0x3720('0x59')],[_0x3720('0x6e'),'id'])||{})[_0x3720('0x87')](function(_0x25eae0){for(var _0x51e436=0x0;_0x51e436<_0x1330b1['body'][_0x3720('0x6e')][_0x3720('0x4a')];_0x51e436+=0x1){socket['emit'](_0x3720('0x77'),{'UserId':Number(_0x1330b1['body'][_0x3720('0x6e')][_0x51e436]),'ChatQueueId':Number(_0x1330b1[_0x3720('0x57')]['id'])});}return _0x25eae0;});}})[_0x3720('0x20')](respondWithResult(_0x1bfd79,null))['catch'](handleError(_0x1bfd79,null));};exports[_0x3720('0x88')]=function(_0x39bd47,_0x55e1b6,_0x1f1de1){return db['ChatQueue'][_0x3720('0x58')]({'where':{'id':_0x39bd47['params']['id']}})[_0x3720('0x20')](handleEntityNotFound(_0x55e1b6,null))['then'](function(_0x58b22a){if(_0x58b22a){return _0x58b22a['removeAgents'](_0x39bd47[_0x3720('0x47')][_0x3720('0x6e')])[_0x3720('0x20')](function(){if(_[_0x3720('0x89')](_0x39bd47['query'][_0x3720('0x6e')])){for(var _0x42abbe=0x0;_0x42abbe<_0x39bd47['query'][_0x3720('0x6e')][_0x3720('0x4a')];_0x42abbe+=0x1){socket[_0x3720('0x76')]('userChatQueue:remove',{'UserId':Number(_0x39bd47[_0x3720('0x47')][_0x3720('0x6e')][_0x42abbe]),'ChatQueueId':Number(_0x39bd47[_0x3720('0x57')]['id'])});}}else{socket[_0x3720('0x76')](_0x3720('0x8a'),{'UserId':Number(_0x39bd47[_0x3720('0x47')][_0x3720('0x6e')]),'ChatQueueId':Number(_0x39bd47[_0x3720('0x57')]['id'])});}});}})[_0x3720('0x20')](respondWithStatusCode(_0x55e1b6,null))['catch'](handleError(_0x55e1b6,null));};exports[_0x3720('0x8b')]=function(_0x58e9d2,_0x4efc35,_0x5b1284){var _0x89046d={};var _0x10d3ba={};var _0x2ef1cc;var _0x23b324;return db['ChatQueue']['findOne']({'where':{'id':_0x58e9d2['params']['id']}})[_0x3720('0x20')](handleEntityNotFound(_0x4efc35,null))[_0x3720('0x20')](function(_0x50e625){if(_0x50e625){_0x2ef1cc=_0x50e625;_0x10d3ba[_0x3720('0x43')]=_[_0x3720('0x44')](db[_0x3720('0x63')][_0x3720('0x40')]);_0x10d3ba[_0x3720('0x47')]=_[_0x3720('0x44')](_0x58e9d2[_0x3720('0x47')]);_0x10d3ba[_0x3720('0x45')]=_[_0x3720('0x46')](_0x10d3ba[_0x3720('0x43')],_0x10d3ba['query']);_0x89046d[_0x3720('0x49')]=_['intersection'](_0x10d3ba[_0x3720('0x43')],qs[_0x3720('0x48')](_0x58e9d2['query']['fields']));_0x89046d[_0x3720('0x49')]=_0x89046d['attributes'][_0x3720('0x4a')]?_0x89046d[_0x3720('0x49')]:_0x10d3ba[_0x3720('0x43')];_0x89046d[_0x3720('0x4c')]=qs['sort'](_0x58e9d2['query'][_0x3720('0x4d')]);_0x89046d[_0x3720('0x50')]=qs[_0x3720('0x45')](_[_0x3720('0x4e')](_0x58e9d2[_0x3720('0x47')],_0x10d3ba[_0x3720('0x45')]));if(_0x58e9d2[_0x3720('0x47')]['filter']){_0x89046d['where']=_['merge'](_0x89046d[_0x3720('0x50')],{'$or':_[_0x3720('0x3e')](_0x89046d[_0x3720('0x49')],function(_0x1e22db){var _0x259881={};_0x259881[_0x1e22db]={'$like':'%'+_0x58e9d2[_0x3720('0x47')][_0x3720('0x4f')]+'%'};return _0x259881;})});}_0x89046d=_['merge']({},_0x89046d,_0x58e9d2[_0x3720('0x52')]);return _0x2ef1cc[_0x3720('0x8b')](_0x89046d);}})[_0x3720('0x20')](function(_0x263496){if(_0x263496){_0x23b324=_0x263496[_0x3720('0x4a')];if(!_0x58e9d2['query'][_0x3720('0x4b')](_0x3720('0x62'))){_0x89046d[_0x3720('0x2f')]=qs[_0x3720('0x2f')](_0x58e9d2['query'][_0x3720('0x2f')]);_0x89046d[_0x3720('0x31')]=qs[_0x3720('0x31')](_0x58e9d2[_0x3720('0x47')]['offset']);}return _0x2ef1cc[_0x3720('0x8b')](_0x89046d);}})[_0x3720('0x20')](function(_0x2a17c5){if(_0x2a17c5){return _0x2a17c5?{'count':_0x23b324,'rows':_0x2a17c5}:null;}})[_0x3720('0x20')](respondWithResult(_0x4efc35,null))[_0x3720('0x2a')](handleError(_0x4efc35,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 560308c..83fc9b8 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 _0xf890=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0xf890,0xa3));var _0x0f89=function(_0x1e2447,_0x5fea89){_0x1e2447=_0x1e2447-0x0;var _0x306f03=_0xf890[_0x1e2447];return _0x306f03;};'use strict';var EventEmitter=require(_0x0f89('0x0'));var ChatQueue=require(_0x0f89('0x1'))['db'][_0x0f89('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0f89('0x3')](0x0);var events={'afterCreate':_0x0f89('0x4'),'afterUpdate':_0x0f89('0x5'),'afterDestroy':_0x0f89('0x6')};function emitEvent(_0x563cf1){return function(_0x4c5665,_0xc6ad86,_0x38e7ed){ChatQueueEvents[_0x0f89('0x7')](_0x563cf1+':'+_0x4c5665['id'],_0x4c5665);ChatQueueEvents['emit'](_0x563cf1,_0x4c5665);_0x38e7ed(null);};}for(var e in events){if(events[_0x0f89('0x8')](e)){var event=events[e];ChatQueue[_0x0f89('0x9')](e,emitEvent(event));}}module[_0x0f89('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xc653=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0xc653,0x6e));var _0x3c65=function(_0x173ee2,_0x1cde73){_0x173ee2=_0x173ee2-0x0;var _0xcea9e2=_0xc653[_0x173ee2];return _0xcea9e2;};'use strict';var EventEmitter=require(_0x3c65('0x0'));var ChatQueue=require(_0x3c65('0x1'))['db'][_0x3c65('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3c65('0x3')](0x0);var events={'afterCreate':_0x3c65('0x4'),'afterUpdate':_0x3c65('0x5'),'afterDestroy':_0x3c65('0x6')};function emitEvent(_0x1a0b8f){return function(_0x34302f,_0x328fac,_0x1da8bc){ChatQueueEvents[_0x3c65('0x7')](_0x1a0b8f+':'+_0x34302f['id'],_0x34302f);ChatQueueEvents[_0x3c65('0x7')](_0x1a0b8f,_0x34302f);_0x1da8bc(null);};}for(var e in events){if(events[_0x3c65('0x8')](e)){var event=events[e];ChatQueue[_0x3c65('0x9')](e,emitEvent(event));}}module[_0x3c65('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e1e3c7f..7797dca 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 _0x85f0=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatQueue','chat_queues'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x85f0,0x1d4));var _0x085f=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x85f0[_0x1ac6e5];return _0x5877dc;};'use strict';var _=require(_0x085f('0x0'));var util=require(_0x085f('0x1'));var logger=require(_0x085f('0x2'))(_0x085f('0x3'));var moment=require('moment');var BPromise=require(_0x085f('0x4'));var rp=require(_0x085f('0x5'));var fs=require('fs');var path=require(_0x085f('0x6'));var rimraf=require(_0x085f('0x7'));var config=require(_0x085f('0x8'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x5f4202,_0x17622d){return _0x5f4202[_0x085f('0x9')](_0x085f('0xa'),attributes,{'tableName':_0x085f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x751e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x30a00f,_0x533dbe){var _0x113458=function(_0x1a5cb8){while(--_0x1a5cb8){_0x30a00f['push'](_0x30a00f['shift']());}};_0x113458(++_0x533dbe);}(_0x751e,0x8b));var _0xe751=function(_0x3a74ad,_0x31f6bc){_0x3a74ad=_0x3a74ad-0x0;var _0xea02d0=_0x751e[_0x3a74ad];return _0xea02d0;};'use strict';var _=require(_0xe751('0x0'));var util=require(_0xe751('0x1'));var logger=require(_0xe751('0x2'))('api');var moment=require(_0xe751('0x3'));var BPromise=require(_0xe751('0x4'));var rp=require(_0xe751('0x5'));var fs=require('fs');var path=require(_0xe751('0x6'));var rimraf=require(_0xe751('0x7'));var config=require(_0xe751('0x8'));var attributes=require(_0xe751('0x9'));module[_0xe751('0xa')]=function(_0x2ccde4,_0x2621f8){return _0x2ccde4[_0xe751('0xb')](_0xe751('0xc'),attributes,{'tableName':_0xe751('0xd'),'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 2d4b985..b3510c2 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 _0xe6e4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','raw','attributes','limit','include','map','model','ShowChatQueue','find','where','lodash','util'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0xe6e4[_0x5e238b];return _0x389bea;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var moment=require(_0x4e6e('0x2'));var BPromise=require(_0x4e6e('0x3'));var rs=require(_0x4e6e('0x4'));var fs=require('fs');var Redis=require(_0x4e6e('0x5'));var db=require(_0x4e6e('0x6'))['db'];var utils=require(_0x4e6e('0x7'));var logger=require(_0x4e6e('0x8'))('rpc');var config=require(_0x4e6e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e6e('0xa')]({'port':0x232a});config[_0x4e6e('0xb')]=_['defaults'](config[_0x4e6e('0xb')],{'host':_0x4e6e('0xc'),'port':0x18eb});var socket=require(_0x4e6e('0xd'))(new Redis(config[_0x4e6e('0xb')]));require(_0x4e6e('0xe'))['register'](socket);function respondWithRpcPromise(_0x2a5eb1,_0x382c9d,_0x3fc2c5){return new BPromise(function(_0x1021f1,_0xc33fd8){return client['request'](_0x2a5eb1,_0x3fc2c5)[_0x4e6e('0xf')](function(_0x1640d6){logger['info'](_0x4e6e('0x10'),_0x382c9d,_0x4e6e('0x11'));logger[_0x4e6e('0x12')](_0x4e6e('0x13'),_0x382c9d,_0x4e6e('0x11'),JSON[_0x4e6e('0x14')](_0x1640d6));if(_0x1640d6[_0x4e6e('0x15')]){if(_0x1640d6['error'][_0x4e6e('0x16')]===0x1f4){logger[_0x4e6e('0x15')](_0x4e6e('0x10'),_0x382c9d,_0x1640d6[_0x4e6e('0x15')][_0x4e6e('0x17')]);return _0xc33fd8(_0x1640d6[_0x4e6e('0x15')]['message']);}logger['error'](_0x4e6e('0x10'),_0x382c9d,_0x1640d6[_0x4e6e('0x15')]['message']);return _0x1021f1(_0x1640d6[_0x4e6e('0x15')][_0x4e6e('0x17')]);}else{logger[_0x4e6e('0x18')](_0x4e6e('0x10'),_0x382c9d,'request\x20sent');_0x1021f1(_0x1640d6[_0x4e6e('0x19')][_0x4e6e('0x17')]);}})[_0x4e6e('0x1a')](function(_0x3dbc30){logger[_0x4e6e('0x15')]('ChatQueue,\x20%s,\x20%s',_0x382c9d,_0x3dbc30);_0xc33fd8(_0x3dbc30);});});}exports[_0x4e6e('0x1b')]=function(_0x5cb1d4){var _0x3205af=this;return new Promise(function(_0x1f0cec,_0x143333){return db[_0x4e6e('0x1c')]['findAll']({'raw':_0x5cb1d4[_0x4e6e('0x1d')]?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5cb1d4['options']?_0x5cb1d4[_0x4e6e('0x1d')]['where']||null:null,'attributes':_0x5cb1d4[_0x4e6e('0x1d')]?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x1f')]||null:null,'limit':_0x5cb1d4['options']?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x20')]||null:null,'include':_0x5cb1d4['options']?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x21')]?_[_0x4e6e('0x22')](_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x21')],function(_0x3e7bce){return{'model':db[_0x3e7bce[_0x4e6e('0x23')]],'as':_0x3e7bce['as'],'attributes':_0x3e7bce[_0x4e6e('0x1f')],'include':_0x3e7bce['include']?_['map'](_0x3e7bce['include'],function(_0x4f6279){return{'model':db[_0x4f6279['model']],'as':_0x4f6279['as'],'attributes':_0x4f6279['attributes'],'include':_0x4f6279[_0x4e6e('0x21')]?_['map'](_0x4f6279[_0x4e6e('0x21')],function(_0x3ab5b8){return{'model':db[_0x3ab5b8['model']],'as':_0x3ab5b8['as'],'attributes':_0x3ab5b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e6e('0xf')](function(_0x282075){logger[_0x4e6e('0x18')](_0x4e6e('0x1b'),_0x5cb1d4);logger[_0x4e6e('0x12')](_0x4e6e('0x1b'),_0x5cb1d4,JSON[_0x4e6e('0x14')](_0x282075));_0x1f0cec(_0x282075);})[_0x4e6e('0x1a')](function(_0x5aa252){logger[_0x4e6e('0x15')](_0x4e6e('0x1b'),_0x5aa252[_0x4e6e('0x17')],_0x5cb1d4);_0x143333(_0x3205af['error'](0x1f4,_0x5aa252[_0x4e6e('0x17')]));});});};exports[_0x4e6e('0x24')]=function(_0x219329){var _0x1ee22e=this;return new Promise(function(_0x13cec0,_0x2c9a09){return db[_0x4e6e('0x1c')][_0x4e6e('0x25')]({'raw':_0x219329[_0x4e6e('0x1d')]?_0x219329[_0x4e6e('0x1d')][_0x4e6e('0x1e')]===undefined?!![]:![]:!![],'where':_0x219329[_0x4e6e('0x1d')]?_0x219329['options'][_0x4e6e('0x26')]||null:null,'attributes':_0x219329[_0x4e6e('0x1d')]?_0x219329[_0x4e6e('0x1d')][_0x4e6e('0x1f')]||null:null,'include':_0x219329[_0x4e6e('0x1d')]?_0x219329[_0x4e6e('0x1d')]['include']?_[_0x4e6e('0x22')](_0x219329[_0x4e6e('0x1d')][_0x4e6e('0x21')],function(_0x46deb5){return{'model':db[_0x46deb5[_0x4e6e('0x23')]],'as':_0x46deb5['as'],'attributes':_0x46deb5[_0x4e6e('0x1f')],'include':_0x46deb5[_0x4e6e('0x21')]?_[_0x4e6e('0x22')](_0x46deb5[_0x4e6e('0x21')],function(_0x21fdaa){return{'model':db[_0x21fdaa[_0x4e6e('0x23')]],'as':_0x21fdaa['as'],'attributes':_0x21fdaa[_0x4e6e('0x1f')],'include':_0x21fdaa[_0x4e6e('0x21')]?_['map'](_0x21fdaa[_0x4e6e('0x21')],function(_0x20da75){return{'model':db[_0x20da75[_0x4e6e('0x23')]],'as':_0x20da75['as'],'attributes':_0x20da75[_0x4e6e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4e6e('0xf')](function(_0x52953e){logger[_0x4e6e('0x18')](_0x4e6e('0x24'),_0x219329);logger[_0x4e6e('0x12')](_0x4e6e('0x24'),_0x219329,JSON['stringify'](_0x52953e));_0x13cec0(_0x52953e);})[_0x4e6e('0x1a')](function(_0x3a54c2){logger['error']('ShowChatQueue',_0x3a54c2['message'],_0x219329);_0x2c9a09(_0x1ee22e[_0x4e6e('0x15')](0x1f4,_0x3a54c2['message']));});});}; \ No newline at end of file +var _0x0e6b=['request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','map','include','model','debug','where','ShowChatQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e6b,0x17d));var _0xb0e6=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x0e6b[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xb0e6('0x0'));var util=require('util');var moment=require(_0xb0e6('0x1'));var BPromise=require('bluebird');var rs=require(_0xb0e6('0x2'));var fs=require('fs');var Redis=require(_0xb0e6('0x3'));var db=require(_0xb0e6('0x4'))['db'];var utils=require(_0xb0e6('0x5'));var logger=require(_0xb0e6('0x6'))(_0xb0e6('0x7'));var config=require('../../config/environment');var jayson=require(_0xb0e6('0x8'));var client=jayson[_0xb0e6('0x9')][_0xb0e6('0xa')]({'port':0x232a});config[_0xb0e6('0xb')]=_['defaults'](config[_0xb0e6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb0e6('0xc'))(new Redis(config[_0xb0e6('0xb')]));require(_0xb0e6('0xd'))[_0xb0e6('0xe')](socket);function respondWithRpcPromise(_0x394ae2,_0x2eebba,_0x4a1ca1){return new BPromise(function(_0x457081,_0x4c66a3){return client[_0xb0e6('0xf')](_0x394ae2,_0x4a1ca1)[_0xb0e6('0x10')](function(_0x3b8dfb){logger[_0xb0e6('0x11')](_0xb0e6('0x12'),_0x2eebba,_0xb0e6('0x13'));logger['debug'](_0xb0e6('0x14'),_0x2eebba,'request\x20sent',JSON[_0xb0e6('0x15')](_0x3b8dfb));if(_0x3b8dfb[_0xb0e6('0x16')]){if(_0x3b8dfb['error'][_0xb0e6('0x17')]===0x1f4){logger[_0xb0e6('0x16')](_0xb0e6('0x12'),_0x2eebba,_0x3b8dfb[_0xb0e6('0x16')][_0xb0e6('0x18')]);return _0x4c66a3(_0x3b8dfb[_0xb0e6('0x16')][_0xb0e6('0x18')]);}logger[_0xb0e6('0x16')]('ChatQueue,\x20%s,\x20%s',_0x2eebba,_0x3b8dfb[_0xb0e6('0x16')][_0xb0e6('0x18')]);return _0x457081(_0x3b8dfb[_0xb0e6('0x16')][_0xb0e6('0x18')]);}else{logger[_0xb0e6('0x11')](_0xb0e6('0x12'),_0x2eebba,'request\x20sent');_0x457081(_0x3b8dfb[_0xb0e6('0x19')][_0xb0e6('0x18')]);}})[_0xb0e6('0x1a')](function(_0x5d486a){logger[_0xb0e6('0x16')](_0xb0e6('0x12'),_0x2eebba,_0x5d486a);_0x4c66a3(_0x5d486a);});});}exports[_0xb0e6('0x1b')]=function(_0x22c2b0){var _0x253cf5=this;return new Promise(function(_0x1e21cf,_0x2ec80d){return db[_0xb0e6('0x1c')][_0xb0e6('0x1d')]({'raw':_0x22c2b0['options']?_0x22c2b0[_0xb0e6('0x1e')][_0xb0e6('0x1f')]===undefined?!![]:![]:!![],'where':_0x22c2b0[_0xb0e6('0x1e')]?_0x22c2b0[_0xb0e6('0x1e')]['where']||null:null,'attributes':_0x22c2b0[_0xb0e6('0x1e')]?_0x22c2b0[_0xb0e6('0x1e')][_0xb0e6('0x20')]||null:null,'limit':_0x22c2b0[_0xb0e6('0x1e')]?_0x22c2b0[_0xb0e6('0x1e')][_0xb0e6('0x21')]||null:null,'include':_0x22c2b0[_0xb0e6('0x1e')]?_0x22c2b0[_0xb0e6('0x1e')]['include']?_[_0xb0e6('0x22')](_0x22c2b0[_0xb0e6('0x1e')][_0xb0e6('0x23')],function(_0x5e7119){return{'model':db[_0x5e7119[_0xb0e6('0x24')]],'as':_0x5e7119['as'],'attributes':_0x5e7119[_0xb0e6('0x20')],'include':_0x5e7119['include']?_[_0xb0e6('0x22')](_0x5e7119['include'],function(_0x1fdd6b){return{'model':db[_0x1fdd6b[_0xb0e6('0x24')]],'as':_0x1fdd6b['as'],'attributes':_0x1fdd6b[_0xb0e6('0x20')],'include':_0x1fdd6b[_0xb0e6('0x23')]?_[_0xb0e6('0x22')](_0x1fdd6b[_0xb0e6('0x23')],function(_0x4555ef){return{'model':db[_0x4555ef[_0xb0e6('0x24')]],'as':_0x4555ef['as'],'attributes':_0x4555ef[_0xb0e6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb0e6('0x10')](function(_0xfde378){logger[_0xb0e6('0x11')](_0xb0e6('0x1b'),_0x22c2b0);logger[_0xb0e6('0x25')](_0xb0e6('0x1b'),_0x22c2b0,JSON[_0xb0e6('0x15')](_0xfde378));_0x1e21cf(_0xfde378);})[_0xb0e6('0x1a')](function(_0x5b5629){logger[_0xb0e6('0x16')](_0xb0e6('0x1b'),_0x5b5629['message'],_0x22c2b0);_0x2ec80d(_0x253cf5[_0xb0e6('0x16')](0x1f4,_0x5b5629['message']));});});};exports['ShowChatQueue']=function(_0x64115){var _0xb7eea7=this;return new Promise(function(_0x8aacb,_0xab22c1){return db['ChatQueue']['find']({'raw':_0x64115[_0xb0e6('0x1e')]?_0x64115[_0xb0e6('0x1e')][_0xb0e6('0x1f')]===undefined?!![]:![]:!![],'where':_0x64115[_0xb0e6('0x1e')]?_0x64115['options'][_0xb0e6('0x26')]||null:null,'attributes':_0x64115[_0xb0e6('0x1e')]?_0x64115[_0xb0e6('0x1e')][_0xb0e6('0x20')]||null:null,'include':_0x64115[_0xb0e6('0x1e')]?_0x64115[_0xb0e6('0x1e')][_0xb0e6('0x23')]?_[_0xb0e6('0x22')](_0x64115[_0xb0e6('0x1e')][_0xb0e6('0x23')],function(_0x47975f){return{'model':db[_0x47975f[_0xb0e6('0x24')]],'as':_0x47975f['as'],'attributes':_0x47975f[_0xb0e6('0x20')],'include':_0x47975f[_0xb0e6('0x23')]?_[_0xb0e6('0x22')](_0x47975f['include'],function(_0xe7adc6){return{'model':db[_0xe7adc6[_0xb0e6('0x24')]],'as':_0xe7adc6['as'],'attributes':_0xe7adc6[_0xb0e6('0x20')],'include':_0xe7adc6[_0xb0e6('0x23')]?_['map'](_0xe7adc6['include'],function(_0x5e2e3a){return{'model':db[_0x5e2e3a[_0xb0e6('0x24')]],'as':_0x5e2e3a['as'],'attributes':_0x5e2e3a[_0xb0e6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb0e6('0x10')](function(_0x517012){logger['info'](_0xb0e6('0x27'),_0x64115);logger[_0xb0e6('0x25')](_0xb0e6('0x27'),_0x64115,JSON[_0xb0e6('0x15')](_0x517012));_0x8aacb(_0x517012);})[_0xb0e6('0x1a')](function(_0x3db840){logger[_0xb0e6('0x16')]('ShowChatQueue',_0x3db840[_0xb0e6('0x18')],_0x64115);_0xab22c1(_0xb7eea7['error'](0x1f4,_0x3db840[_0xb0e6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 63a1824..6237699 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 _0xb4e6=['removeListener','register','./chatQueue.events','remove','update','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0xb4e6[_0x3b711c];return _0x2685f0;};'use strict';var ChatQueueEvents=require(_0x6b4e('0x0'));var events=['save',_0x6b4e('0x1'),_0x6b4e('0x2')];function createListener(_0x365912,_0x25ffcb){return function(_0x44e781){_0x25ffcb[_0x6b4e('0x3')](_0x365912,_0x44e781);};}function removeListener(_0x1929b8,_0x52313b){return function(){ChatQueueEvents[_0x6b4e('0x4')](_0x1929b8,_0x52313b);};}exports[_0x6b4e('0x5')]=function(_0x1f67a2){for(var _0x49de51=0x0,_0xd3138f=events['length'];_0x49de51<_0xd3138f;_0x49de51++){var _0x4f00be=events[_0x49de51];var _0x2311d9=createListener('chatQueue:'+_0x4f00be,_0x1f67a2);ChatQueueEvents['on'](_0x4f00be,_0x2311d9);}}; \ No newline at end of file +var _0xb66c=['chatQueue:','./chatQueue.events','remove','removeListener','register','length'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xb66c,0x175));var _0xcb66=function(_0x2bf4fe,_0x6f62c2){_0x2bf4fe=_0x2bf4fe-0x0;var _0x22e14e=_0xb66c[_0x2bf4fe];return _0x22e14e;};'use strict';var ChatQueueEvents=require(_0xcb66('0x0'));var events=['save',_0xcb66('0x1'),'update'];function createListener(_0x2afcb8,_0x24ea13){return function(_0xf7ccc5){_0x24ea13['emit'](_0x2afcb8,_0xf7ccc5);};}function removeListener(_0x35d439,_0x386241){return function(){ChatQueueEvents[_0xcb66('0x2')](_0x35d439,_0x386241);};}exports[_0xcb66('0x3')]=function(_0x5d766d){for(var _0x518163=0x0,_0x19adf5=events[_0xcb66('0x4')];_0x518163<_0x19adf5;_0x518163++){var _0xa3993=events[_0x518163];var _0x439f3d=createListener(_0xcb66('0x5')+_0xa3993,_0x5d766d);ChatQueueEvents['on'](_0xa3993,_0x439f3d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 81f63cf..b9e9a04 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x55e6cf,_0x5c15bb){_0x55e6cf=_0x55e6cf-0x0;var _0x36baf4=_0x3e74[_0x55e6cf];return _0x36baf4;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x436248,_0x2bfff4){var _0x34e6e8=function(_0x387f0f){while(--_0x387f0f){_0x436248['push'](_0x436248['shift']());}};_0x34e6e8(++_0x2bfff4);}(_0x008c,0x188));var _0xc008=function(_0x14e393,_0x5ef7b3){_0x14e393=_0x14e393-0x0;var _0x5b5ffa=_0x008c[_0x14e393];return _0x5b5ffa;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 9d7ebd2..568fdc9 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 _0xd0a4=['moment','sequelize','STRING','DATE'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xd0a4,0x158));var _0x4d0a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0a4[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x4d0a('0x0'));var Sequelize=require(_0x4d0a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4d0a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4d0a('0x3')]},'leaveAt':{'type':Sequelize[_0x4d0a('0x3')]},'acceptAt':{'type':Sequelize[_0x4d0a('0x3')]},'exitAt':{'type':Sequelize[_0x4d0a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x112f=['DATE','moment','exports','STRING'];(function(_0x1efdf4,_0x3d19c3){var _0x1aba2b=function(_0x206de6){while(--_0x206de6){_0x1efdf4['push'](_0x1efdf4['shift']());}};_0x1aba2b(++_0x3d19c3);}(_0x112f,0x155));var _0xf112=function(_0x461b58,_0x14df97){_0x461b58=_0x461b58-0x0;var _0x26780f=_0x112f[_0x461b58];return _0x26780f;};'use strict';var moment=require(_0xf112('0x0'));var Sequelize=require('sequelize');module[_0xf112('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf112('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf112('0x3')]},'exitAt':{'type':Sequelize[_0xf112('0x3')]},'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 9a158b0..fe8bce8 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 _0x869e=['undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatQueueReport','includeAll','findAll','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x869e,0x15c));var _0xe869=function(_0x10b21f,_0x1fecda){_0x10b21f=_0x10b21f-0x0;var _0x1fed07=_0x869e[_0x10b21f];return _0x1fed07;};'use strict';var emlformat=require(_0xe869('0x0'));var rimraf=require(_0xe869('0x1'));var zipdir=require(_0xe869('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe869('0x3'));var moment=require(_0xe869('0x4'));var BPromise=require(_0xe869('0x5'));var Mustache=require(_0xe869('0x6'));var util=require(_0xe869('0x7'));var path=require('path');var sox=require(_0xe869('0x8'));var csv=require(_0xe869('0x9'));var ejs=require(_0xe869('0xa'));var fs=require('fs');var fs_extra=require(_0xe869('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe869('0xc'));var jsforce=require(_0xe869('0xd'));var deskjs=require(_0xe869('0xe'));var toCsv=require(_0xe869('0x9'));var querystring=require(_0xe869('0xf'));var Papa=require(_0xe869('0x10'));var Redis=require(_0xe869('0x11'));var authService=require(_0xe869('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe869('0x13'));var logger=require(_0xe869('0x14'))(_0xe869('0x15'));var utils=require(_0xe869('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe869('0x17'))['db'];function respondWithStatusCode(_0x5a5197,_0x907d3f){_0x907d3f=_0x907d3f||0xcc;return function(_0x412429){if(_0x412429){return _0x5a5197['sendStatus'](_0x907d3f);}return _0x5a5197[_0xe869('0x18')](_0x907d3f)[_0xe869('0x19')]();};}function respondWithResult(_0x3239d1,_0x17ee8f){_0x17ee8f=_0x17ee8f||0xc8;return function(_0x4046e4){if(_0x4046e4){return _0x3239d1['status'](_0x17ee8f)['json'](_0x4046e4);}};}function respondWithFilteredResult(_0x52fd40,_0x262f2f){return function(_0x4ed173){if(_0x4ed173){var _0x201091=typeof _0x262f2f[_0xe869('0x1a')]===_0xe869('0x1b')&&typeof _0x262f2f['limit']===_0xe869('0x1b');var _0x10f5e1=_0x4ed173['count'];var _0x33f5a7=_0x201091?0x0:_0x262f2f['offset'];var _0x26c67c=_0x201091?_0x4ed173[_0xe869('0x1c')]:_0x262f2f['offset']+_0x262f2f['limit'];var _0x40692c;if(_0x26c67c>=_0x10f5e1){_0x26c67c=_0x10f5e1;_0x40692c=0xc8;}else{_0x40692c=0xce;}_0x52fd40['status'](_0x40692c);return _0x52fd40[_0xe869('0x1d')](_0xe869('0x1e'),_0x33f5a7+'-'+_0x26c67c+'/'+_0x10f5e1)[_0xe869('0x1f')](_0x4ed173);}return null;};}function patchUpdates(_0x3e8c47){return function(_0x171c18){try{jsonpatch[_0xe869('0x20')](_0x171c18,_0x3e8c47,!![]);}catch(_0xa13c53){return BPromise[_0xe869('0x21')](_0xa13c53);}return _0x171c18[_0xe869('0x22')]();};}function saveUpdates(_0x10de1e,_0x59e73f){return function(_0x1a30e8){if(_0x1a30e8){return _0x1a30e8[_0xe869('0x23')](_0x10de1e)[_0xe869('0x24')](function(_0x342640){return _0x342640;});}return null;};}function removeEntity(_0x9c22cd,_0x4ddc31){return function(_0x429301){if(_0x429301){return _0x429301[_0xe869('0x25')]()[_0xe869('0x24')](function(){_0x9c22cd[_0xe869('0x18')](0xcc)[_0xe869('0x19')]();});}};}function handleEntityNotFound(_0x42320b,_0x311be8){return function(_0x44efa3){if(!_0x44efa3){_0x42320b[_0xe869('0x26')](0x194);}return _0x44efa3;};}function handleError(_0x30df68,_0x2775bc){_0x2775bc=_0x2775bc||0x1f4;return function(_0x31fec7){logger[_0xe869('0x27')](_0x31fec7['stack']);if(_0x31fec7[_0xe869('0x28')]){delete _0x31fec7[_0xe869('0x28')];}_0x30df68[_0xe869('0x18')](_0x2775bc)[_0xe869('0x29')](_0x31fec7);};}exports[_0xe869('0x2a')]=function(_0x22a823,_0x4f0e7f){var _0x367969={},_0x3f3574={},_0x57e22c={'count':0x0,'rows':[]};var _0x558c32=_[_0xe869('0x2b')](db['ChatQueueReport'][_0xe869('0x2c')],function(_0x4ed370){return{'name':_0x4ed370['fieldName'],'type':_0x4ed370[_0xe869('0x2d')][_0xe869('0x2e')]};});_0x3f3574[_0xe869('0x2f')]=_['map'](_0x558c32,_0xe869('0x28'));_0x3f3574['query']=_[_0xe869('0x30')](_0x22a823[_0xe869('0x31')]);_0x3f3574[_0xe869('0x32')]=_[_0xe869('0x33')](_0x3f3574[_0xe869('0x2f')],_0x3f3574[_0xe869('0x31')]);_0x367969[_0xe869('0x34')]=_['intersection'](_0x3f3574[_0xe869('0x2f')],qs[_0xe869('0x35')](_0x22a823[_0xe869('0x31')]['fields']));_0x367969['attributes']=_0x367969[_0xe869('0x34')]['length']?_0x367969['attributes']:_0x3f3574[_0xe869('0x2f')];if(!_0x22a823[_0xe869('0x31')]['hasOwnProperty'](_0xe869('0x36'))){_0x367969[_0xe869('0x37')]=qs[_0xe869('0x37')](_0x22a823[_0xe869('0x31')]['limit']);_0x367969[_0xe869('0x1a')]=qs[_0xe869('0x1a')](_0x22a823[_0xe869('0x31')]['offset']);}_0x367969[_0xe869('0x38')]=qs[_0xe869('0x39')](_0x22a823['query'][_0xe869('0x39')]);_0x367969[_0xe869('0x3a')]=qs['filters'](_[_0xe869('0x3b')](_0x22a823['query'],_0x3f3574[_0xe869('0x32')]),_0x558c32);if(_0x22a823[_0xe869('0x31')]['filter']){_0x367969[_0xe869('0x3a')]=_[_0xe869('0x3c')](_0x367969[_0xe869('0x3a')],{'$or':_[_0xe869('0x2b')](_0x558c32,function(_0x15502e){if(_0x15502e['type']!==_0xe869('0x3d')){var _0xee8898={};_0xee8898[_0x15502e[_0xe869('0x28')]]={'$like':'%'+_0x22a823['query'][_0xe869('0x3e')]+'%'};return _0xee8898;}})});}_0x367969=_[_0xe869('0x3c')]({},_0x367969,_0x22a823[_0xe869('0x3f')]);var _0x3bf052={'where':_0x367969[_0xe869('0x3a')]};return db[_0xe869('0x40')]['count'](_0x3bf052)[_0xe869('0x24')](function(_0x3352a7){_0x57e22c[_0xe869('0x1c')]=_0x3352a7;if(_0x22a823['query'][_0xe869('0x41')]){_0x367969['include']=[{'all':!![]}];}return db[_0xe869('0x40')][_0xe869('0x42')](_0x367969);})[_0xe869('0x24')](function(_0x14398a){_0x57e22c['rows']=_0x14398a;return _0x57e22c;})[_0xe869('0x24')](respondWithFilteredResult(_0x4f0e7f,_0x367969))[_0xe869('0x43')](handleError(_0x4f0e7f,null));};exports['show']=function(_0x1e550e,_0x3d55df){var _0x26ebd8={'raw':!![],'where':{'id':_0x1e550e[_0xe869('0x44')]['id']}},_0x4130a6={};_0x4130a6[_0xe869('0x2f')]=_['keys'](db[_0xe869('0x40')]['rawAttributes']);_0x4130a6[_0xe869('0x31')]=_[_0xe869('0x30')](_0x1e550e[_0xe869('0x31')]);_0x4130a6[_0xe869('0x32')]=_[_0xe869('0x33')](_0x4130a6[_0xe869('0x2f')],_0x4130a6[_0xe869('0x31')]);_0x26ebd8[_0xe869('0x34')]=_[_0xe869('0x33')](_0x4130a6[_0xe869('0x2f')],qs[_0xe869('0x35')](_0x1e550e[_0xe869('0x31')][_0xe869('0x35')]));_0x26ebd8[_0xe869('0x34')]=_0x26ebd8['attributes'][_0xe869('0x45')]?_0x26ebd8[_0xe869('0x34')]:_0x4130a6['model'];if(_0x1e550e[_0xe869('0x31')]['includeAll']){_0x26ebd8[_0xe869('0x46')]=[{'all':!![]}];}_0x26ebd8=_[_0xe869('0x3c')]({},_0x26ebd8,_0x1e550e[_0xe869('0x3f')]);return db[_0xe869('0x40')][_0xe869('0x47')](_0x26ebd8)[_0xe869('0x24')](handleEntityNotFound(_0x3d55df,null))[_0xe869('0x24')](respondWithResult(_0x3d55df,null))[_0xe869('0x43')](handleError(_0x3d55df,null));};exports[_0xe869('0x48')]=function(_0x39e5e9,_0x5d5349){return db[_0xe869('0x40')][_0xe869('0x48')](_0x39e5e9[_0xe869('0x49')],{})[_0xe869('0x24')](respondWithResult(_0x5d5349,0xc9))[_0xe869('0x43')](handleError(_0x5d5349,null));};exports[_0xe869('0x23')]=function(_0x5aa2b5,_0x1976c0){if(_0x5aa2b5['body']['id']){delete _0x5aa2b5[_0xe869('0x49')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5aa2b5[_0xe869('0x44')]['id']}})['then'](handleEntityNotFound(_0x1976c0,null))['then'](saveUpdates(_0x5aa2b5[_0xe869('0x49')],null))[_0xe869('0x24')](respondWithResult(_0x1976c0,null))[_0xe869('0x43')](handleError(_0x1976c0,null));};exports[_0xe869('0x25')]=function(_0x2acfee,_0x59bae1){return db['ChatQueueReport']['find']({'where':{'id':_0x2acfee[_0xe869('0x44')]['id']}})['then'](handleEntityNotFound(_0x59bae1,null))[_0xe869('0x24')](removeEntity(_0x59bae1,null))[_0xe869('0x43')](handleError(_0x59bae1,null));};exports['describe']=function(_0x98ee8f,_0x5ec184){return db[_0xe869('0x40')][_0xe869('0x4a')]()[_0xe869('0x24')](respondWithResult(_0x5ec184,null))[_0xe869('0x43')](handleError(_0x5ec184,null));}; \ No newline at end of file +var _0x855f=['include','findAll','rows','catch','show','params','keys','length','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatQueueReport','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','then','includeAll'];(function(_0x21c8cf,_0x93644c){var _0x29ba94=function(_0x4de07c){while(--_0x4de07c){_0x21c8cf['push'](_0x21c8cf['shift']());}};_0x29ba94(++_0x93644c);}(_0x855f,0x145));var _0xf855=function(_0x4e9ab7,_0x3e282a){_0x4e9ab7=_0x4e9ab7-0x0;var _0x264658=_0x855f[_0x4e9ab7];return _0x264658;};'use strict';var emlformat=require(_0xf855('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf855('0x1'));var jsonpatch=require(_0xf855('0x2'));var rp=require(_0xf855('0x3'));var moment=require(_0xf855('0x4'));var BPromise=require(_0xf855('0x5'));var Mustache=require('mustache');var util=require(_0xf855('0x6'));var path=require(_0xf855('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf855('0x8'));var fs=require('fs');var fs_extra=require(_0xf855('0x9'));var _=require(_0xf855('0xa'));var squel=require(_0xf855('0xb'));var crypto=require(_0xf855('0xc'));var jsforce=require(_0xf855('0xd'));var deskjs=require(_0xf855('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf855('0xf'));var Papa=require(_0xf855('0x10'));var Redis=require(_0xf855('0x11'));var authService=require(_0xf855('0x12'));var qs=require(_0xf855('0x13'));var as=require(_0xf855('0x14'));var hardwareService=require(_0xf855('0x15'));var logger=require(_0xf855('0x16'))('api');var utils=require(_0xf855('0x17'));var config=require(_0xf855('0x18'));var licenseUtil=require(_0xf855('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x188ec1,_0x9d4e0e){_0x9d4e0e=_0x9d4e0e||0xcc;return function(_0x460257){if(_0x460257){return _0x188ec1[_0xf855('0x1a')](_0x9d4e0e);}return _0x188ec1[_0xf855('0x1b')](_0x9d4e0e)[_0xf855('0x1c')]();};}function respondWithResult(_0x5877b,_0x5e0f8c){_0x5e0f8c=_0x5e0f8c||0xc8;return function(_0x42edd8){if(_0x42edd8){return _0x5877b[_0xf855('0x1b')](_0x5e0f8c)[_0xf855('0x1d')](_0x42edd8);}};}function respondWithFilteredResult(_0x3016da,_0x1db3c2){return function(_0x310fc3){if(_0x310fc3){var _0x1db377=typeof _0x1db3c2['offset']==='undefined'&&typeof _0x1db3c2[_0xf855('0x1e')]===_0xf855('0x1f');var _0x31e76d=_0x310fc3['count'];var _0x2301a2=_0x1db377?0x0:_0x1db3c2[_0xf855('0x20')];var _0x56438d=_0x1db377?_0x310fc3['count']:_0x1db3c2[_0xf855('0x20')]+_0x1db3c2[_0xf855('0x1e')];var _0x14aa2a;if(_0x56438d>=_0x31e76d){_0x56438d=_0x31e76d;_0x14aa2a=0xc8;}else{_0x14aa2a=0xce;}_0x3016da[_0xf855('0x1b')](_0x14aa2a);return _0x3016da[_0xf855('0x21')](_0xf855('0x22'),_0x2301a2+'-'+_0x56438d+'/'+_0x31e76d)[_0xf855('0x1d')](_0x310fc3);}return null;};}function patchUpdates(_0xdefc1c){return function(_0x1995f7){try{jsonpatch[_0xf855('0x23')](_0x1995f7,_0xdefc1c,!![]);}catch(_0x329687){return BPromise[_0xf855('0x24')](_0x329687);}return _0x1995f7[_0xf855('0x25')]();};}function saveUpdates(_0x59021f,_0x343712){return function(_0x247345){if(_0x247345){return _0x247345[_0xf855('0x26')](_0x59021f)['then'](function(_0x3b0973){return _0x3b0973;});}return null;};}function removeEntity(_0x5a18c6,_0x2eaa3d){return function(_0xffd637){if(_0xffd637){return _0xffd637[_0xf855('0x27')]()['then'](function(){_0x5a18c6[_0xf855('0x1b')](0xcc)[_0xf855('0x1c')]();});}};}function handleEntityNotFound(_0x53719d,_0x1fcdda){return function(_0x15f9d5){if(!_0x15f9d5){_0x53719d[_0xf855('0x1a')](0x194);}return _0x15f9d5;};}function handleError(_0x2c87ab,_0x3506c7){_0x3506c7=_0x3506c7||0x1f4;return function(_0x5c0210){logger['error'](_0x5c0210[_0xf855('0x28')]);if(_0x5c0210[_0xf855('0x29')]){delete _0x5c0210['name'];}_0x2c87ab[_0xf855('0x1b')](_0x3506c7)[_0xf855('0x2a')](_0x5c0210);};}exports[_0xf855('0x2b')]=function(_0x353a5d,_0xffb3c2){var _0x34e8b9={},_0x27897a={},_0x1ffc8a={'count':0x0,'rows':[]};var _0x8b8416=_[_0xf855('0x2c')](db[_0xf855('0x2d')]['rawAttributes'],function(_0x2416ff){return{'name':_0x2416ff['fieldName'],'type':_0x2416ff['type']['key']};});_0x27897a[_0xf855('0x2e')]=_[_0xf855('0x2c')](_0x8b8416,_0xf855('0x29'));_0x27897a[_0xf855('0x2f')]=_['keys'](_0x353a5d[_0xf855('0x2f')]);_0x27897a[_0xf855('0x30')]=_[_0xf855('0x31')](_0x27897a[_0xf855('0x2e')],_0x27897a['query']);_0x34e8b9[_0xf855('0x32')]=_[_0xf855('0x31')](_0x27897a[_0xf855('0x2e')],qs[_0xf855('0x33')](_0x353a5d['query']['fields']));_0x34e8b9[_0xf855('0x32')]=_0x34e8b9[_0xf855('0x32')]['length']?_0x34e8b9[_0xf855('0x32')]:_0x27897a['model'];if(!_0x353a5d[_0xf855('0x2f')][_0xf855('0x34')](_0xf855('0x35'))){_0x34e8b9[_0xf855('0x1e')]=qs[_0xf855('0x1e')](_0x353a5d[_0xf855('0x2f')][_0xf855('0x1e')]);_0x34e8b9[_0xf855('0x20')]=qs[_0xf855('0x20')](_0x353a5d[_0xf855('0x2f')][_0xf855('0x20')]);}_0x34e8b9[_0xf855('0x36')]=qs[_0xf855('0x37')](_0x353a5d[_0xf855('0x2f')][_0xf855('0x37')]);_0x34e8b9[_0xf855('0x38')]=qs[_0xf855('0x30')](_[_0xf855('0x39')](_0x353a5d['query'],_0x27897a[_0xf855('0x30')]),_0x8b8416);if(_0x353a5d[_0xf855('0x2f')][_0xf855('0x3a')]){_0x34e8b9['where']=_[_0xf855('0x3b')](_0x34e8b9[_0xf855('0x38')],{'$or':_[_0xf855('0x2c')](_0x8b8416,function(_0x5d2822){if(_0x5d2822[_0xf855('0x3c')]!==_0xf855('0x3d')){var _0x39fb76={};_0x39fb76[_0x5d2822[_0xf855('0x29')]]={'$like':'%'+_0x353a5d[_0xf855('0x2f')][_0xf855('0x3a')]+'%'};return _0x39fb76;}})});}_0x34e8b9=_[_0xf855('0x3b')]({},_0x34e8b9,_0x353a5d['options']);var _0x385775={'where':_0x34e8b9[_0xf855('0x38')]};return db[_0xf855('0x2d')][_0xf855('0x3e')](_0x385775)[_0xf855('0x3f')](function(_0x3ab673){_0x1ffc8a[_0xf855('0x3e')]=_0x3ab673;if(_0x353a5d[_0xf855('0x2f')][_0xf855('0x40')]){_0x34e8b9[_0xf855('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xf855('0x42')](_0x34e8b9);})[_0xf855('0x3f')](function(_0x20ad7e){_0x1ffc8a[_0xf855('0x43')]=_0x20ad7e;return _0x1ffc8a;})[_0xf855('0x3f')](respondWithFilteredResult(_0xffb3c2,_0x34e8b9))[_0xf855('0x44')](handleError(_0xffb3c2,null));};exports[_0xf855('0x45')]=function(_0x5d8575,_0x29f0ba){var _0x2c2ea2={'raw':!![],'where':{'id':_0x5d8575[_0xf855('0x46')]['id']}},_0x3a4436={};_0x3a4436[_0xf855('0x2e')]=_['keys'](db[_0xf855('0x2d')]['rawAttributes']);_0x3a4436['query']=_[_0xf855('0x47')](_0x5d8575['query']);_0x3a4436[_0xf855('0x30')]=_['intersection'](_0x3a4436[_0xf855('0x2e')],_0x3a4436[_0xf855('0x2f')]);_0x2c2ea2['attributes']=_[_0xf855('0x31')](_0x3a4436[_0xf855('0x2e')],qs[_0xf855('0x33')](_0x5d8575[_0xf855('0x2f')][_0xf855('0x33')]));_0x2c2ea2[_0xf855('0x32')]=_0x2c2ea2[_0xf855('0x32')][_0xf855('0x48')]?_0x2c2ea2[_0xf855('0x32')]:_0x3a4436[_0xf855('0x2e')];if(_0x5d8575[_0xf855('0x2f')]['includeAll']){_0x2c2ea2[_0xf855('0x41')]=[{'all':!![]}];}_0x2c2ea2=_[_0xf855('0x3b')]({},_0x2c2ea2,_0x5d8575[_0xf855('0x49')]);return db[_0xf855('0x2d')][_0xf855('0x4a')](_0x2c2ea2)['then'](handleEntityNotFound(_0x29f0ba,null))[_0xf855('0x3f')](respondWithResult(_0x29f0ba,null))[_0xf855('0x44')](handleError(_0x29f0ba,null));};exports[_0xf855('0x4b')]=function(_0x454289,_0x31488b){return db[_0xf855('0x2d')][_0xf855('0x4b')](_0x454289[_0xf855('0x4c')],{})[_0xf855('0x3f')](respondWithResult(_0x31488b,0xc9))[_0xf855('0x44')](handleError(_0x31488b,null));};exports[_0xf855('0x26')]=function(_0xecf524,_0x384ae3){if(_0xecf524[_0xf855('0x4c')]['id']){delete _0xecf524[_0xf855('0x4c')]['id'];}return db['ChatQueueReport'][_0xf855('0x4a')]({'where':{'id':_0xecf524[_0xf855('0x46')]['id']}})['then'](handleEntityNotFound(_0x384ae3,null))[_0xf855('0x3f')](saveUpdates(_0xecf524['body'],null))[_0xf855('0x3f')](respondWithResult(_0x384ae3,null))['catch'](handleError(_0x384ae3,null));};exports[_0xf855('0x27')]=function(_0xd50432,_0x3fad9f){return db['ChatQueueReport'][_0xf855('0x4a')]({'where':{'id':_0xd50432['params']['id']}})['then'](handleEntityNotFound(_0x3fad9f,null))[_0xf855('0x3f')](removeEntity(_0x3fad9f,null))[_0xf855('0x44')](handleError(_0x3fad9f,null));};exports['describe']=function(_0x356bde,_0x53b471){return db['ChatQueueReport'][_0xf855('0x4d')]()[_0xf855('0x3f')](respondWithResult(_0x53b471,null))[_0xf855('0x44')](handleError(_0x53b471,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 22bb2ba..c9e7507 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x889780,_0x11fc34){var _0x3fd252=function(_0x50c3a5){while(--_0x50c3a5){_0x889780['push'](_0x889780['shift']());}};_0x3fd252(++_0x11fc34);}(_0x757a,0xde));var _0xa757=function(_0x544081,_0x38638b){_0x544081=_0x544081-0x0;var _0x1be971=_0x757a[_0x544081];return _0x1be971;};'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 +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c0b6390..94d5f3a 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 _0xdc09=['options','raw','UpdateChatQueueReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x47242f,_0x357295){var _0x1fac06=function(_0x3c0ed9){while(--_0x3c0ed9){_0x47242f['push'](_0x47242f['shift']());}};_0x1fac06(++_0x357295);}(_0xdc09,0xc2));var _0x9dc0=function(_0x218c0c,_0x2b21e3){_0x218c0c=_0x218c0c-0x0;var _0xf0347d=_0xdc09[_0x218c0c];return _0xf0347d;};'use strict';var _=require('lodash');var util=require(_0x9dc0('0x0'));var moment=require(_0x9dc0('0x1'));var BPromise=require(_0x9dc0('0x2'));var rs=require(_0x9dc0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9dc0('0x4'));var logger=require(_0x9dc0('0x5'))('rpc');var config=require(_0x9dc0('0x6'));var jayson=require(_0x9dc0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16b586,_0x12a353,_0x2a7fb8){return new BPromise(function(_0x1abd4e,_0x353fb1){return client[_0x9dc0('0x8')](_0x16b586,_0x2a7fb8)[_0x9dc0('0x9')](function(_0xbb57ec){logger[_0x9dc0('0xa')](_0x9dc0('0xb'),_0x12a353,_0x9dc0('0xc'));logger[_0x9dc0('0xd')](_0x9dc0('0xe'),_0x12a353,'request\x20sent',JSON[_0x9dc0('0xf')](_0xbb57ec));if(_0xbb57ec[_0x9dc0('0x10')]){if(_0xbb57ec[_0x9dc0('0x10')]['code']===0x1f4){logger[_0x9dc0('0x10')](_0x9dc0('0xb'),_0x12a353,_0xbb57ec[_0x9dc0('0x10')][_0x9dc0('0x11')]);return _0x353fb1(_0xbb57ec[_0x9dc0('0x10')][_0x9dc0('0x11')]);}logger[_0x9dc0('0x10')](_0x9dc0('0xb'),_0x12a353,_0xbb57ec[_0x9dc0('0x10')]['message']);return _0x1abd4e(_0xbb57ec[_0x9dc0('0x10')]['message']);}else{logger[_0x9dc0('0xa')](_0x9dc0('0xb'),_0x12a353,_0x9dc0('0xc'));_0x1abd4e(_0xbb57ec[_0x9dc0('0x12')][_0x9dc0('0x11')]);}})[_0x9dc0('0x13')](function(_0xce7ffc){logger['error'](_0x9dc0('0xb'),_0x12a353,_0xce7ffc);_0x353fb1(_0xce7ffc);});});}exports[_0x9dc0('0x14')]=function(_0x4dda7c){var _0x41b62b=this;return new Promise(function(_0x375b33,_0x20627a){return db[_0x9dc0('0x15')][_0x9dc0('0x16')](_0x4dda7c['body'],{'raw':_0x4dda7c[_0x9dc0('0x17')]?_0x4dda7c[_0x9dc0('0x17')][_0x9dc0('0x18')]===undefined?!![]:![]:!![]})[_0x9dc0('0x9')](function(_0x39e389){logger['info'](_0x9dc0('0x14'),_0x4dda7c);logger[_0x9dc0('0xd')]('CreateChatQueueReport',_0x4dda7c,JSON[_0x9dc0('0xf')](_0x39e389));_0x375b33(_0x39e389);})[_0x9dc0('0x13')](function(_0x544add){logger[_0x9dc0('0x10')](_0x9dc0('0x14'),_0x544add[_0x9dc0('0x11')],_0x4dda7c);_0x20627a(_0x41b62b[_0x9dc0('0x10')](0x1f4,_0x544add[_0x9dc0('0x11')]));});});};exports[_0x9dc0('0x19')]=function(_0x5e0e6c){var _0x2977e7=this;return new Promise(function(_0x5cc26a,_0x487a93){return db[_0x9dc0('0x15')][_0x9dc0('0x1a')](_0x5e0e6c[_0x9dc0('0x1b')],{'raw':_0x5e0e6c[_0x9dc0('0x17')]?_0x5e0e6c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e0e6c[_0x9dc0('0x17')]?_0x5e0e6c['options'][_0x9dc0('0x1c')]||null:null,'attributes':_0x5e0e6c['options']?_0x5e0e6c[_0x9dc0('0x17')][_0x9dc0('0x1d')]||null:null,'limit':_0x5e0e6c[_0x9dc0('0x17')]?_0x5e0e6c[_0x9dc0('0x17')][_0x9dc0('0x1e')]||null:null})[_0x9dc0('0x9')](function(_0x49550c){logger[_0x9dc0('0xa')]('UpdateChatQueueReport',_0x5e0e6c);logger[_0x9dc0('0xd')](_0x9dc0('0x19'),_0x5e0e6c,JSON[_0x9dc0('0xf')](_0x49550c));_0x5cc26a(_0x49550c);})[_0x9dc0('0x13')](function(_0x19ab37){logger[_0x9dc0('0x10')](_0x9dc0('0x19'),_0x19ab37[_0x9dc0('0x11')],_0x5e0e6c);_0x487a93(_0x2977e7[_0x9dc0('0x10')](0x1f4,_0x19ab37[_0x9dc0('0x11')]));});});}; \ No newline at end of file +var _0x5348=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateChatQueueReport','body','options','raw','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','lodash','util'];(function(_0xf89c1b,_0x3c6782){var _0xded031=function(_0x3aa22a){while(--_0x3aa22a){_0xf89c1b['push'](_0xf89c1b['shift']());}};_0xded031(++_0x3c6782);}(_0x5348,0x1de));var _0x8534=function(_0x175c18,_0x15337d){_0x175c18=_0x175c18-0x0;var _0x554e7a=_0x5348[_0x175c18];return _0x554e7a;};'use strict';var _=require(_0x8534('0x0'));var util=require(_0x8534('0x1'));var moment=require(_0x8534('0x2'));var BPromise=require(_0x8534('0x3'));var rs=require(_0x8534('0x4'));var fs=require('fs');var Redis=require(_0x8534('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8534('0x6'));var logger=require(_0x8534('0x7'))(_0x8534('0x8'));var config=require(_0x8534('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8534('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb95f,_0x3a4348,_0x2c74e1){return new BPromise(function(_0x3ab496,_0x54d233){return client['request'](_0x2cb95f,_0x2c74e1)[_0x8534('0xb')](function(_0x30a584){logger['info'](_0x8534('0xc'),_0x3a4348,'request\x20sent');logger[_0x8534('0xd')](_0x8534('0xe'),_0x3a4348,_0x8534('0xf'),JSON[_0x8534('0x10')](_0x30a584));if(_0x30a584[_0x8534('0x11')]){if(_0x30a584[_0x8534('0x11')][_0x8534('0x12')]===0x1f4){logger['error'](_0x8534('0xc'),_0x3a4348,_0x30a584[_0x8534('0x11')]['message']);return _0x54d233(_0x30a584[_0x8534('0x11')][_0x8534('0x13')]);}logger[_0x8534('0x11')](_0x8534('0xc'),_0x3a4348,_0x30a584[_0x8534('0x11')]['message']);return _0x3ab496(_0x30a584[_0x8534('0x11')][_0x8534('0x13')]);}else{logger[_0x8534('0x14')](_0x8534('0xc'),_0x3a4348,_0x8534('0xf'));_0x3ab496(_0x30a584[_0x8534('0x15')][_0x8534('0x13')]);}})[_0x8534('0x16')](function(_0x210bb5){logger[_0x8534('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3a4348,_0x210bb5);_0x54d233(_0x210bb5);});});}exports[_0x8534('0x17')]=function(_0x43d19a){var _0x2aba33=this;return new Promise(function(_0x19ec22,_0xc845ac){return db['ChatQueueReport']['create'](_0x43d19a[_0x8534('0x18')],{'raw':_0x43d19a[_0x8534('0x19')]?_0x43d19a[_0x8534('0x19')][_0x8534('0x1a')]===undefined?!![]:![]:!![]})[_0x8534('0xb')](function(_0x251a65){logger[_0x8534('0x14')](_0x8534('0x17'),_0x43d19a);logger[_0x8534('0xd')]('CreateChatQueueReport',_0x43d19a,JSON[_0x8534('0x10')](_0x251a65));_0x19ec22(_0x251a65);})['catch'](function(_0x3e582b){logger[_0x8534('0x11')]('CreateChatQueueReport',_0x3e582b[_0x8534('0x13')],_0x43d19a);_0xc845ac(_0x2aba33[_0x8534('0x11')](0x1f4,_0x3e582b['message']));});});};exports[_0x8534('0x1b')]=function(_0x290c3f){var _0x29b34e=this;return new Promise(function(_0x40df5a,_0x50d474){return db[_0x8534('0x1c')][_0x8534('0x1d')](_0x290c3f[_0x8534('0x18')],{'raw':_0x290c3f[_0x8534('0x19')]?_0x290c3f['options'][_0x8534('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x290c3f[_0x8534('0x19')]?_0x290c3f[_0x8534('0x19')][_0x8534('0x1e')]||null:null,'attributes':_0x290c3f[_0x8534('0x19')]?_0x290c3f['options'][_0x8534('0x1f')]||null:null,'limit':_0x290c3f[_0x8534('0x19')]?_0x290c3f[_0x8534('0x19')]['limit']||null:null})['then'](function(_0x4fcc53){logger[_0x8534('0x14')]('UpdateChatQueueReport',_0x290c3f);logger[_0x8534('0xd')](_0x8534('0x1b'),_0x290c3f,JSON[_0x8534('0x10')](_0x4fcc53));_0x40df5a(_0x4fcc53);})[_0x8534('0x16')](function(_0x28c692){logger[_0x8534('0x11')](_0x8534('0x1b'),_0x28c692[_0x8534('0x13')],_0x290c3f);_0x50d474(_0x29b34e[_0x8534('0x11')](0x1f4,_0x28c692[_0x8534('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 24be0f9..3308237 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 _0x0476=['./chatQueueReport.controller','index','/describe','describe','get','/:id','show','post','isAuthenticated','put','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32da7c,_0x1fb1eb){var _0x208f77=function(_0x42f3fd){while(--_0x42f3fd){_0x32da7c['push'](_0x32da7c['shift']());}};_0x208f77(++_0x1fb1eb);}(_0x0476,0x6b));var _0x6047=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x0476[_0x120376];return _0x28c529;};'use strict';var multer=require(_0x6047('0x0'));var util=require(_0x6047('0x1'));var path=require('path');var timeout=require(_0x6047('0x2'));var express=require('express');var router=express[_0x6047('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6047('0x4'));var interaction=require(_0x6047('0x5'));var config=require(_0x6047('0x6'));var controller=require(_0x6047('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6047('0x8')]);router['get'](_0x6047('0x9'),auth['isAuthenticated'](),controller[_0x6047('0xa')]);router[_0x6047('0xb')](_0x6047('0xc'),auth['isAuthenticated'](),controller[_0x6047('0xd')]);router[_0x6047('0xe')]('/',auth[_0x6047('0xf')](),controller['create']);router[_0x6047('0x10')](_0x6047('0xc'),auth[_0x6047('0xf')](),controller['update']);router['delete'](_0x6047('0xc'),auth['isAuthenticated'](),controller[_0x6047('0x11')]);module[_0x6047('0x12')]=router; \ No newline at end of file +var _0x7243=['index','/describe','describe','/:id','post','create','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x7243,0x178));var _0x3724=function(_0x5cf559,_0x4544c0){_0x5cf559=_0x5cf559-0x0;var _0x3a85a8=_0x7243[_0x5cf559];return _0x3a85a8;};'use strict';var multer=require(_0x3724('0x0'));var util=require(_0x3724('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3724('0x2'));var router=express['Router']();var fs_extra=require(_0x3724('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3724('0x4'));var config=require('../../config/environment');var controller=require(_0x3724('0x5'));router[_0x3724('0x6')]('/',auth[_0x3724('0x7')](),controller[_0x3724('0x8')]);router[_0x3724('0x6')](_0x3724('0x9'),auth['isAuthenticated'](),controller[_0x3724('0xa')]);router[_0x3724('0x6')](_0x3724('0xb'),auth[_0x3724('0x7')](),controller['show']);router[_0x3724('0xc')]('/',auth[_0x3724('0x7')](),controller[_0x3724('0xd')]);router['put'](_0x3724('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3724('0x7')](),controller[_0x3724('0xe')]);module[_0x3724('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 2a96078..2d620be 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3fff6d,_0x48ae4c){var _0x173887=function(_0x7e9ff0){while(--_0x7e9ff0){_0x3fff6d['push'](_0x3fff6d['shift']());}};_0x173887(++_0x48ae4c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xcb91[_0x3cec8c];return _0x38032e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x83ee0a,_0x44947d){var _0x5dc29f=function(_0x3e1433){while(--_0x3e1433){_0x83ee0a['push'](_0x83ee0a['shift']());}};_0x5dc29f(++_0x44947d);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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 f70752f..2c5eb76 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 _0xb24f=['pick','filter','merge','type','VIRTUAL','includeAll','rows','catch','show','params','keys','rawAttributes','intersection','include','options','find','create','body','describe','eml-format','zip-dir','moment','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatTransferReport','key','model','query','filters','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0x647460,_0x4324b7){var _0xf375e=function(_0x40b3ae){while(--_0x40b3ae){_0x647460['push'](_0x647460['shift']());}};_0xf375e(++_0x4324b7);}(_0xb24f,0x1c9));var _0xfb24=function(_0x366d28,_0x39dbb4){_0x366d28=_0x366d28-0x0;var _0x2d06ec=_0xb24f[_0x366d28];return _0x2d06ec;};'use strict';var emlformat=require(_0xfb24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb24('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfb24('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfb24('0x3'));var sox=require(_0xfb24('0x4'));var csv=require(_0xfb24('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb24('0x6'));var _=require('lodash');var squel=require(_0xfb24('0x7'));var crypto=require(_0xfb24('0x8'));var jsforce=require(_0xfb24('0x9'));var deskjs=require(_0xfb24('0xa'));var toCsv=require(_0xfb24('0x5'));var querystring=require('querystring');var Papa=require(_0xfb24('0xb'));var Redis=require(_0xfb24('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfb24('0xd'));var hardwareService=require(_0xfb24('0xe'));var logger=require(_0xfb24('0xf'))(_0xfb24('0x10'));var utils=require(_0xfb24('0x11'));var config=require(_0xfb24('0x12'));var licenseUtil=require(_0xfb24('0x13'));var db=require(_0xfb24('0x14'))['db'];function respondWithStatusCode(_0x505a16,_0x59b133){_0x59b133=_0x59b133||0xcc;return function(_0x2608a1){if(_0x2608a1){return _0x505a16[_0xfb24('0x15')](_0x59b133);}return _0x505a16['status'](_0x59b133)[_0xfb24('0x16')]();};}function respondWithResult(_0xf41606,_0x1eb2e6){_0x1eb2e6=_0x1eb2e6||0xc8;return function(_0x1dbdbc){if(_0x1dbdbc){return _0xf41606['status'](_0x1eb2e6)[_0xfb24('0x17')](_0x1dbdbc);}};}function respondWithFilteredResult(_0x498fab,_0x1c9809){return function(_0x4b52fc){if(_0x4b52fc){var _0x6ff83f=typeof _0x1c9809['offset']===_0xfb24('0x18')&&typeof _0x1c9809[_0xfb24('0x19')]==='undefined';var _0x10c921=_0x4b52fc[_0xfb24('0x1a')];var _0x364db5=_0x6ff83f?0x0:_0x1c9809[_0xfb24('0x1b')];var _0x4dc4e5=_0x6ff83f?_0x4b52fc[_0xfb24('0x1a')]:_0x1c9809[_0xfb24('0x1b')]+_0x1c9809[_0xfb24('0x19')];var _0x1694a9;if(_0x4dc4e5>=_0x10c921){_0x4dc4e5=_0x10c921;_0x1694a9=0xc8;}else{_0x1694a9=0xce;}_0x498fab[_0xfb24('0x1c')](_0x1694a9);return _0x498fab[_0xfb24('0x1d')](_0xfb24('0x1e'),_0x364db5+'-'+_0x4dc4e5+'/'+_0x10c921)['json'](_0x4b52fc);}return null;};}function patchUpdates(_0x103e7a){return function(_0x3d2d8b){try{jsonpatch[_0xfb24('0x1f')](_0x3d2d8b,_0x103e7a,!![]);}catch(_0x548778){return BPromise[_0xfb24('0x20')](_0x548778);}return _0x3d2d8b[_0xfb24('0x21')]();};}function saveUpdates(_0x45b1cd,_0x59ce9e){return function(_0xb8fcfe){if(_0xb8fcfe){return _0xb8fcfe[_0xfb24('0x22')](_0x45b1cd)['then'](function(_0x2729ba){return _0x2729ba;});}return null;};}function removeEntity(_0x33d039,_0x51a8b2){return function(_0x170d2c){if(_0x170d2c){return _0x170d2c[_0xfb24('0x23')]()[_0xfb24('0x24')](function(){_0x33d039[_0xfb24('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5b8f,_0x56e85f){return function(_0x2f37a7){if(!_0x2f37a7){_0x1b5b8f[_0xfb24('0x15')](0x194);}return _0x2f37a7;};}function handleError(_0x15ca54,_0x5828ce){_0x5828ce=_0x5828ce||0x1f4;return function(_0x198b9c){logger[_0xfb24('0x25')](_0x198b9c[_0xfb24('0x26')]);if(_0x198b9c[_0xfb24('0x27')]){delete _0x198b9c[_0xfb24('0x27')];}_0x15ca54['status'](_0x5828ce)[_0xfb24('0x28')](_0x198b9c);};}exports[_0xfb24('0x29')]=function(_0x1cb4d6,_0x17b140){var _0x895e4a={},_0x44c00b={},_0x55f930={'count':0x0,'rows':[]};var _0x406a5e=_[_0xfb24('0x2a')](db[_0xfb24('0x2b')]['rawAttributes'],function(_0x2aeece){return{'name':_0x2aeece['fieldName'],'type':_0x2aeece['type'][_0xfb24('0x2c')]};});_0x44c00b[_0xfb24('0x2d')]=_[_0xfb24('0x2a')](_0x406a5e,'name');_0x44c00b[_0xfb24('0x2e')]=_['keys'](_0x1cb4d6['query']);_0x44c00b[_0xfb24('0x2f')]=_['intersection'](_0x44c00b['model'],_0x44c00b[_0xfb24('0x2e')]);_0x895e4a['attributes']=_['intersection'](_0x44c00b[_0xfb24('0x2d')],qs['fields'](_0x1cb4d6[_0xfb24('0x2e')][_0xfb24('0x30')]));_0x895e4a[_0xfb24('0x31')]=_0x895e4a[_0xfb24('0x31')]['length']?_0x895e4a[_0xfb24('0x31')]:_0x44c00b[_0xfb24('0x2d')];if(!_0x1cb4d6['query'][_0xfb24('0x32')]('nolimit')){_0x895e4a['limit']=qs[_0xfb24('0x19')](_0x1cb4d6[_0xfb24('0x2e')]['limit']);_0x895e4a[_0xfb24('0x1b')]=qs[_0xfb24('0x1b')](_0x1cb4d6[_0xfb24('0x2e')][_0xfb24('0x1b')]);}_0x895e4a[_0xfb24('0x33')]=qs['sort'](_0x1cb4d6[_0xfb24('0x2e')][_0xfb24('0x34')]);_0x895e4a[_0xfb24('0x35')]=qs[_0xfb24('0x2f')](_[_0xfb24('0x36')](_0x1cb4d6['query'],_0x44c00b[_0xfb24('0x2f')]),_0x406a5e);if(_0x1cb4d6[_0xfb24('0x2e')][_0xfb24('0x37')]){_0x895e4a[_0xfb24('0x35')]=_[_0xfb24('0x38')](_0x895e4a[_0xfb24('0x35')],{'$or':_[_0xfb24('0x2a')](_0x406a5e,function(_0x1dfed0){if(_0x1dfed0[_0xfb24('0x39')]!==_0xfb24('0x3a')){var _0x3b50ce={};_0x3b50ce[_0x1dfed0['name']]={'$like':'%'+_0x1cb4d6['query'][_0xfb24('0x37')]+'%'};return _0x3b50ce;}})});}_0x895e4a=_[_0xfb24('0x38')]({},_0x895e4a,_0x1cb4d6['options']);var _0x3d6193={'where':_0x895e4a[_0xfb24('0x35')]};return db[_0xfb24('0x2b')][_0xfb24('0x1a')](_0x3d6193)[_0xfb24('0x24')](function(_0x36ef7e){_0x55f930[_0xfb24('0x1a')]=_0x36ef7e;if(_0x1cb4d6[_0xfb24('0x2e')][_0xfb24('0x3b')]){_0x895e4a['include']=[{'all':!![]}];}return db[_0xfb24('0x2b')]['findAll'](_0x895e4a);})[_0xfb24('0x24')](function(_0x131858){_0x55f930[_0xfb24('0x3c')]=_0x131858;return _0x55f930;})[_0xfb24('0x24')](respondWithFilteredResult(_0x17b140,_0x895e4a))[_0xfb24('0x3d')](handleError(_0x17b140,null));};exports[_0xfb24('0x3e')]=function(_0x5c0cae,_0x2a4671){var _0x312f0a={'raw':!![],'where':{'id':_0x5c0cae[_0xfb24('0x3f')]['id']}},_0xb16e2d={};_0xb16e2d[_0xfb24('0x2d')]=_[_0xfb24('0x40')](db[_0xfb24('0x2b')][_0xfb24('0x41')]);_0xb16e2d[_0xfb24('0x2e')]=_['keys'](_0x5c0cae[_0xfb24('0x2e')]);_0xb16e2d[_0xfb24('0x2f')]=_[_0xfb24('0x42')](_0xb16e2d[_0xfb24('0x2d')],_0xb16e2d[_0xfb24('0x2e')]);_0x312f0a[_0xfb24('0x31')]=_[_0xfb24('0x42')](_0xb16e2d[_0xfb24('0x2d')],qs['fields'](_0x5c0cae['query'][_0xfb24('0x30')]));_0x312f0a[_0xfb24('0x31')]=_0x312f0a[_0xfb24('0x31')]['length']?_0x312f0a[_0xfb24('0x31')]:_0xb16e2d['model'];if(_0x5c0cae[_0xfb24('0x2e')]['includeAll']){_0x312f0a[_0xfb24('0x43')]=[{'all':!![]}];}_0x312f0a=_[_0xfb24('0x38')]({},_0x312f0a,_0x5c0cae[_0xfb24('0x44')]);return db['ChatTransferReport'][_0xfb24('0x45')](_0x312f0a)[_0xfb24('0x24')](handleEntityNotFound(_0x2a4671,null))[_0xfb24('0x24')](respondWithResult(_0x2a4671,null))[_0xfb24('0x3d')](handleError(_0x2a4671,null));};exports[_0xfb24('0x46')]=function(_0x2958c6,_0x561008){return db[_0xfb24('0x2b')][_0xfb24('0x46')](_0x2958c6[_0xfb24('0x47')],{})[_0xfb24('0x24')](respondWithResult(_0x561008,0xc9))[_0xfb24('0x3d')](handleError(_0x561008,null));};exports[_0xfb24('0x22')]=function(_0x457125,_0x1b0f88){if(_0x457125[_0xfb24('0x47')]['id']){delete _0x457125['body']['id'];}return db[_0xfb24('0x2b')]['find']({'where':{'id':_0x457125[_0xfb24('0x3f')]['id']}})[_0xfb24('0x24')](handleEntityNotFound(_0x1b0f88,null))[_0xfb24('0x24')](saveUpdates(_0x457125['body'],null))[_0xfb24('0x24')](respondWithResult(_0x1b0f88,null))[_0xfb24('0x3d')](handleError(_0x1b0f88,null));};exports['destroy']=function(_0x9a566d,_0x3fc1fd){return db['ChatTransferReport'][_0xfb24('0x45')]({'where':{'id':_0x9a566d['params']['id']}})[_0xfb24('0x24')](handleEntityNotFound(_0x3fc1fd,null))[_0xfb24('0x24')](removeEntity(_0x3fc1fd,null))[_0xfb24('0x3d')](handleError(_0x3fc1fd,null));};exports[_0xfb24('0x48')]=function(_0x21f918,_0x7a7d3a){return db[_0xfb24('0x2b')][_0xfb24('0x48')]()[_0xfb24('0x24')](respondWithResult(_0x7a7d3a,null))[_0xfb24('0x3d')](handleError(_0x7a7d3a,null));}; \ No newline at end of file +var _0x8e23=['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/environment','../../config/license/util','status','undefined','limit','count','Content-Range','reject','then','destroy','end','sendStatus','error','name','send','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','rawAttributes','length','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x8e23,0xd9));var _0x38e2=function(_0x46ed77,_0x15e3c1){_0x46ed77=_0x46ed77-0x0;var _0x3f1077=_0x8e23[_0x46ed77];return _0x3f1077;};'use strict';var emlformat=require(_0x38e2('0x0'));var rimraf=require(_0x38e2('0x1'));var zipdir=require(_0x38e2('0x2'));var jsonpatch=require(_0x38e2('0x3'));var rp=require('request-promise');var moment=require(_0x38e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x38e2('0x5'));var util=require(_0x38e2('0x6'));var path=require(_0x38e2('0x7'));var sox=require('sox');var csv=require(_0x38e2('0x8'));var ejs=require(_0x38e2('0x9'));var fs=require('fs');var fs_extra=require(_0x38e2('0xa'));var _=require(_0x38e2('0xb'));var squel=require(_0x38e2('0xc'));var crypto=require(_0x38e2('0xd'));var jsforce=require(_0x38e2('0xe'));var deskjs=require(_0x38e2('0xf'));var toCsv=require(_0x38e2('0x8'));var querystring=require(_0x38e2('0x10'));var Papa=require(_0x38e2('0x11'));var Redis=require(_0x38e2('0x12'));var authService=require(_0x38e2('0x13'));var qs=require(_0x38e2('0x14'));var as=require(_0x38e2('0x15'));var hardwareService=require(_0x38e2('0x16'));var logger=require(_0x38e2('0x17'))('api');var utils=require(_0x38e2('0x18'));var config=require(_0x38e2('0x19'));var licenseUtil=require(_0x38e2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11d5bb,_0xf0ec66){_0xf0ec66=_0xf0ec66||0xcc;return function(_0x48e7d9){if(_0x48e7d9){return _0x11d5bb['sendStatus'](_0xf0ec66);}return _0x11d5bb[_0x38e2('0x1b')](_0xf0ec66)['end']();};}function respondWithResult(_0x32b8fe,_0x1845d2){_0x1845d2=_0x1845d2||0xc8;return function(_0x24b406){if(_0x24b406){return _0x32b8fe[_0x38e2('0x1b')](_0x1845d2)['json'](_0x24b406);}};}function respondWithFilteredResult(_0x18e962,_0x5882ce){return function(_0x58cb1f){if(_0x58cb1f){var _0x2a4cf8=typeof _0x5882ce['offset']===_0x38e2('0x1c')&&typeof _0x5882ce[_0x38e2('0x1d')]===_0x38e2('0x1c');var _0xc8ab27=_0x58cb1f[_0x38e2('0x1e')];var _0x25b120=_0x2a4cf8?0x0:_0x5882ce['offset'];var _0x36469b=_0x2a4cf8?_0x58cb1f[_0x38e2('0x1e')]:_0x5882ce['offset']+_0x5882ce[_0x38e2('0x1d')];var _0x3e465b;if(_0x36469b>=_0xc8ab27){_0x36469b=_0xc8ab27;_0x3e465b=0xc8;}else{_0x3e465b=0xce;}_0x18e962['status'](_0x3e465b);return _0x18e962['set'](_0x38e2('0x1f'),_0x25b120+'-'+_0x36469b+'/'+_0xc8ab27)['json'](_0x58cb1f);}return null;};}function patchUpdates(_0x4a5c46){return function(_0x210d13){try{jsonpatch['apply'](_0x210d13,_0x4a5c46,!![]);}catch(_0x2f8a95){return BPromise[_0x38e2('0x20')](_0x2f8a95);}return _0x210d13['save']();};}function saveUpdates(_0x1c9f4c,_0x5a4226){return function(_0x338274){if(_0x338274){return _0x338274['update'](_0x1c9f4c)[_0x38e2('0x21')](function(_0x1981df){return _0x1981df;});}return null;};}function removeEntity(_0x57e4ae,_0x45413a){return function(_0x2ad9fa){if(_0x2ad9fa){return _0x2ad9fa[_0x38e2('0x22')]()[_0x38e2('0x21')](function(){_0x57e4ae[_0x38e2('0x1b')](0xcc)[_0x38e2('0x23')]();});}};}function handleEntityNotFound(_0x124ef6,_0x146854){return function(_0x14cddf){if(!_0x14cddf){_0x124ef6[_0x38e2('0x24')](0x194);}return _0x14cddf;};}function handleError(_0x20cddf,_0x5ebd99){_0x5ebd99=_0x5ebd99||0x1f4;return function(_0x66cb){logger[_0x38e2('0x25')](_0x66cb['stack']);if(_0x66cb[_0x38e2('0x26')]){delete _0x66cb['name'];}_0x20cddf[_0x38e2('0x1b')](_0x5ebd99)[_0x38e2('0x27')](_0x66cb);};}exports['index']=function(_0x23be5c,_0x44c70f){var _0x4a9d36={},_0x6923d2={},_0x58153a={'count':0x0,'rows':[]};var _0x54bdfa=_[_0x38e2('0x28')](db[_0x38e2('0x29')]['rawAttributes'],function(_0x5eadf8){return{'name':_0x5eadf8[_0x38e2('0x2a')],'type':_0x5eadf8[_0x38e2('0x2b')][_0x38e2('0x2c')]};});_0x6923d2[_0x38e2('0x2d')]=_[_0x38e2('0x28')](_0x54bdfa,_0x38e2('0x26'));_0x6923d2[_0x38e2('0x2e')]=_[_0x38e2('0x2f')](_0x23be5c['query']);_0x6923d2[_0x38e2('0x30')]=_[_0x38e2('0x31')](_0x6923d2[_0x38e2('0x2d')],_0x6923d2[_0x38e2('0x2e')]);_0x4a9d36['attributes']=_[_0x38e2('0x31')](_0x6923d2[_0x38e2('0x2d')],qs[_0x38e2('0x32')](_0x23be5c[_0x38e2('0x2e')][_0x38e2('0x32')]));_0x4a9d36[_0x38e2('0x33')]=_0x4a9d36[_0x38e2('0x33')]['length']?_0x4a9d36['attributes']:_0x6923d2[_0x38e2('0x2d')];if(!_0x23be5c[_0x38e2('0x2e')][_0x38e2('0x34')](_0x38e2('0x35'))){_0x4a9d36['limit']=qs[_0x38e2('0x1d')](_0x23be5c[_0x38e2('0x2e')][_0x38e2('0x1d')]);_0x4a9d36[_0x38e2('0x36')]=qs['offset'](_0x23be5c[_0x38e2('0x2e')][_0x38e2('0x36')]);}_0x4a9d36['order']=qs[_0x38e2('0x37')](_0x23be5c[_0x38e2('0x2e')]['sort']);_0x4a9d36[_0x38e2('0x38')]=qs[_0x38e2('0x30')](_[_0x38e2('0x39')](_0x23be5c[_0x38e2('0x2e')],_0x6923d2[_0x38e2('0x30')]),_0x54bdfa);if(_0x23be5c['query'][_0x38e2('0x3a')]){_0x4a9d36[_0x38e2('0x38')]=_['merge'](_0x4a9d36[_0x38e2('0x38')],{'$or':_[_0x38e2('0x28')](_0x54bdfa,function(_0x302777){if(_0x302777[_0x38e2('0x2b')]!==_0x38e2('0x3b')){var _0x1b88f9={};_0x1b88f9[_0x302777[_0x38e2('0x26')]]={'$like':'%'+_0x23be5c['query'][_0x38e2('0x3a')]+'%'};return _0x1b88f9;}})});}_0x4a9d36=_[_0x38e2('0x3c')]({},_0x4a9d36,_0x23be5c[_0x38e2('0x3d')]);var _0x151334={'where':_0x4a9d36[_0x38e2('0x38')]};return db[_0x38e2('0x29')][_0x38e2('0x1e')](_0x151334)['then'](function(_0x3ee906){_0x58153a[_0x38e2('0x1e')]=_0x3ee906;if(_0x23be5c['query']['includeAll']){_0x4a9d36[_0x38e2('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x38e2('0x3f')](_0x4a9d36);})['then'](function(_0x1062d3){_0x58153a[_0x38e2('0x40')]=_0x1062d3;return _0x58153a;})['then'](respondWithFilteredResult(_0x44c70f,_0x4a9d36))[_0x38e2('0x41')](handleError(_0x44c70f,null));};exports['show']=function(_0x400d8f,_0x32ff88){var _0x3d31bf={'raw':!![],'where':{'id':_0x400d8f[_0x38e2('0x42')]['id']}},_0x19a43a={};_0x19a43a[_0x38e2('0x2d')]=_[_0x38e2('0x2f')](db['ChatTransferReport'][_0x38e2('0x43')]);_0x19a43a[_0x38e2('0x2e')]=_[_0x38e2('0x2f')](_0x400d8f[_0x38e2('0x2e')]);_0x19a43a[_0x38e2('0x30')]=_[_0x38e2('0x31')](_0x19a43a[_0x38e2('0x2d')],_0x19a43a[_0x38e2('0x2e')]);_0x3d31bf[_0x38e2('0x33')]=_[_0x38e2('0x31')](_0x19a43a[_0x38e2('0x2d')],qs[_0x38e2('0x32')](_0x400d8f[_0x38e2('0x2e')][_0x38e2('0x32')]));_0x3d31bf[_0x38e2('0x33')]=_0x3d31bf['attributes'][_0x38e2('0x44')]?_0x3d31bf[_0x38e2('0x33')]:_0x19a43a[_0x38e2('0x2d')];if(_0x400d8f[_0x38e2('0x2e')][_0x38e2('0x45')]){_0x3d31bf[_0x38e2('0x3e')]=[{'all':!![]}];}_0x3d31bf=_[_0x38e2('0x3c')]({},_0x3d31bf,_0x400d8f[_0x38e2('0x3d')]);return db[_0x38e2('0x29')][_0x38e2('0x46')](_0x3d31bf)[_0x38e2('0x21')](handleEntityNotFound(_0x32ff88,null))[_0x38e2('0x21')](respondWithResult(_0x32ff88,null))[_0x38e2('0x41')](handleError(_0x32ff88,null));};exports[_0x38e2('0x47')]=function(_0x4e7a41,_0x567ff0){return db[_0x38e2('0x29')]['create'](_0x4e7a41[_0x38e2('0x48')],{})[_0x38e2('0x21')](respondWithResult(_0x567ff0,0xc9))[_0x38e2('0x41')](handleError(_0x567ff0,null));};exports[_0x38e2('0x49')]=function(_0x5bece1,_0x141477){if(_0x5bece1[_0x38e2('0x48')]['id']){delete _0x5bece1[_0x38e2('0x48')]['id'];}return db['ChatTransferReport'][_0x38e2('0x46')]({'where':{'id':_0x5bece1[_0x38e2('0x42')]['id']}})[_0x38e2('0x21')](handleEntityNotFound(_0x141477,null))['then'](saveUpdates(_0x5bece1[_0x38e2('0x48')],null))[_0x38e2('0x21')](respondWithResult(_0x141477,null))[_0x38e2('0x41')](handleError(_0x141477,null));};exports[_0x38e2('0x22')]=function(_0x1a80eb,_0x44d175){return db[_0x38e2('0x29')][_0x38e2('0x46')]({'where':{'id':_0x1a80eb['params']['id']}})['then'](handleEntityNotFound(_0x44d175,null))[_0x38e2('0x21')](removeEntity(_0x44d175,null))['catch'](handleError(_0x44d175,null));};exports[_0x38e2('0x4a')]=function(_0x192529,_0x1585f0){return db[_0x38e2('0x29')]['describe']()[_0x38e2('0x21')](respondWithResult(_0x1585f0,null))[_0x38e2('0x41')](handleError(_0x1585f0,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f52a69e..e749a5d 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 _0x8a32=['bluebird','request-promise','path','rimraf','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8a32,0x11d));var _0x28a3=function(_0x31b88f,_0x503a2a){_0x31b88f=_0x31b88f-0x0;var _0x48540c=_0x8a32[_0x31b88f];return _0x48540c;};'use strict';var _=require(_0x28a3('0x0'));var util=require('util');var logger=require(_0x28a3('0x1'))(_0x28a3('0x2'));var moment=require('moment');var BPromise=require(_0x28a3('0x3'));var rp=require(_0x28a3('0x4'));var fs=require('fs');var path=require(_0x28a3('0x5'));var rimraf=require(_0x28a3('0x6'));var config=require('../../config/environment');var attributes=require(_0x28a3('0x7'));module['exports']=function(_0x16695d,_0xcf91f6){return _0x16695d[_0x28a3('0x8')](_0x28a3('0x9'),attributes,{'tableName':_0x28a3('0xa'),'paranoid':![],'indexes':[{'name':_0x28a3('0xb'),'fields':[_0x28a3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9df2=['uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x5d7c9d,_0x3ad2b1){var _0x4a7651=function(_0x26b681){while(--_0x26b681){_0x5d7c9d['push'](_0x5d7c9d['shift']());}};_0x4a7651(++_0x3ad2b1);}(_0x9df2,0x90));var _0x29df=function(_0x1063b7,_0x1cbadb){_0x1063b7=_0x1063b7-0x0;var _0xf28ab7=_0x9df2[_0x1063b7];return _0xf28ab7;};'use strict';var _=require(_0x29df('0x0'));var util=require('util');var logger=require(_0x29df('0x1'))(_0x29df('0x2'));var moment=require(_0x29df('0x3'));var BPromise=require('bluebird');var rp=require(_0x29df('0x4'));var fs=require('fs');var path=require(_0x29df('0x5'));var rimraf=require(_0x29df('0x6'));var config=require(_0x29df('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0x29df('0x8')]=function(_0x542511,_0x52a912){return _0x542511[_0x29df('0x9')](_0x29df('0xa'),attributes,{'tableName':_0x29df('0xb'),'paranoid':![],'indexes':[{'name':_0x29df('0xc'),'fields':[_0x29df('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d9a41bd..6e2ad55 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 _0x1a06=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','lodash','util'];(function(_0x13bf04,_0x265a36){var _0x470ef9=function(_0x2f6fa0){while(--_0x2f6fa0){_0x13bf04['push'](_0x13bf04['shift']());}};_0x470ef9(++_0x265a36);}(_0x1a06,0x1e2));var _0x61a0=function(_0x577916,_0x1057ba){_0x577916=_0x577916-0x0;var _0x5b638d=_0x1a06[_0x577916];return _0x5b638d;};'use strict';var _=require(_0x61a0('0x0'));var util=require(_0x61a0('0x1'));var moment=require(_0x61a0('0x2'));var BPromise=require(_0x61a0('0x3'));var rs=require(_0x61a0('0x4'));var fs=require('fs');var Redis=require(_0x61a0('0x5'));var db=require(_0x61a0('0x6'))['db'];var utils=require(_0x61a0('0x7'));var logger=require('../../config/logger')(_0x61a0('0x8'));var config=require(_0x61a0('0x9'));var jayson=require(_0x61a0('0xa'));var client=jayson[_0x61a0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109955,_0x242954,_0x9a144a){return new BPromise(function(_0x3e0b2c,_0x4aa813){return client['request'](_0x109955,_0x9a144a)[_0x61a0('0xc')](function(_0x4577f2){logger[_0x61a0('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x242954,_0x61a0('0xe'));logger[_0x61a0('0xf')](_0x61a0('0x10'),_0x242954,_0x61a0('0xe'),JSON[_0x61a0('0x11')](_0x4577f2));if(_0x4577f2[_0x61a0('0x12')]){if(_0x4577f2['error'][_0x61a0('0x13')]===0x1f4){logger['error'](_0x61a0('0x14'),_0x242954,_0x4577f2[_0x61a0('0x12')][_0x61a0('0x15')]);return _0x4aa813(_0x4577f2['error'][_0x61a0('0x15')]);}logger[_0x61a0('0x12')](_0x61a0('0x14'),_0x242954,_0x4577f2[_0x61a0('0x12')][_0x61a0('0x15')]);return _0x3e0b2c(_0x4577f2[_0x61a0('0x12')][_0x61a0('0x15')]);}else{logger['info'](_0x61a0('0x14'),_0x242954,_0x61a0('0xe'));_0x3e0b2c(_0x4577f2['result'][_0x61a0('0x15')]);}})['catch'](function(_0x2cc34d){logger[_0x61a0('0x12')](_0x61a0('0x14'),_0x242954,_0x2cc34d);_0x4aa813(_0x2cc34d);});});} \ No newline at end of file +var _0xc958=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x3de459,_0x545b11){var _0x8dfb5f=function(_0x1ae3ac){while(--_0x1ae3ac){_0x3de459['push'](_0x3de459['shift']());}};_0x8dfb5f(++_0x545b11);}(_0xc958,0x71));var _0x8c95=function(_0x1f76cb,_0x459a21){_0x1f76cb=_0x1f76cb-0x0;var _0xf7ceb1=_0xc958[_0x1f76cb];return _0xf7ceb1;};'use strict';var _=require(_0x8c95('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c95('0x1'));var rs=require(_0x8c95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c95('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c95('0x4'))(_0x8c95('0x5'));var config=require(_0x8c95('0x6'));var jayson=require(_0x8c95('0x7'));var client=jayson[_0x8c95('0x8')][_0x8c95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfb2105,_0x4780e6,_0x1ebb5c){return new BPromise(function(_0x436a52,_0x5b2604){return client['request'](_0xfb2105,_0x1ebb5c)[_0x8c95('0xa')](function(_0x1eba40){logger[_0x8c95('0xb')](_0x8c95('0xc'),_0x4780e6,_0x8c95('0xd'));logger[_0x8c95('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4780e6,_0x8c95('0xd'),JSON[_0x8c95('0xf')](_0x1eba40));if(_0x1eba40[_0x8c95('0x10')]){if(_0x1eba40['error'][_0x8c95('0x11')]===0x1f4){logger[_0x8c95('0x10')](_0x8c95('0xc'),_0x4780e6,_0x1eba40[_0x8c95('0x10')][_0x8c95('0x12')]);return _0x5b2604(_0x1eba40['error'][_0x8c95('0x12')]);}logger[_0x8c95('0x10')](_0x8c95('0xc'),_0x4780e6,_0x1eba40[_0x8c95('0x10')][_0x8c95('0x12')]);return _0x436a52(_0x1eba40[_0x8c95('0x10')][_0x8c95('0x12')]);}else{logger[_0x8c95('0xb')](_0x8c95('0xc'),_0x4780e6,_0x8c95('0xd'));_0x436a52(_0x1eba40[_0x8c95('0x13')]['message']);}})[_0x8c95('0x14')](function(_0x329390){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4780e6,_0x329390);_0x5b2604(_0x329390);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2f675bd..01e5ec9 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 _0x3cfa=['isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x59cceb,_0x4257cf){var _0x6d1166=function(_0x310325){while(--_0x310325){_0x59cceb['push'](_0x59cceb['shift']());}};_0x6d1166(++_0x4257cf);}(_0x3cfa,0xc8));var _0xa3cf=function(_0x2d39b2,_0x23bd7e){_0x2d39b2=_0x2d39b2-0x0;var _0x44e183=_0x3cfa[_0x2d39b2];return _0x44e183;};'use strict';var multer=require(_0xa3cf('0x0'));var util=require('util');var path=require(_0xa3cf('0x1'));var timeout=require(_0xa3cf('0x2'));var express=require(_0xa3cf('0x3'));var router=express[_0xa3cf('0x4')]();var fs_extra=require(_0xa3cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa3cf('0x6'));var config=require(_0xa3cf('0x7'));var controller=require(_0xa3cf('0x8'));router[_0xa3cf('0x9')]('/',auth[_0xa3cf('0xa')](),controller[_0xa3cf('0xb')]);router[_0xa3cf('0x9')](_0xa3cf('0xc'),auth[_0xa3cf('0xa')](),controller[_0xa3cf('0xd')]);router[_0xa3cf('0x9')](_0xa3cf('0xe'),auth['isAuthenticated'](),controller[_0xa3cf('0xf')]);router[_0xa3cf('0x10')]('/',auth[_0xa3cf('0xa')](),controller['create']);router[_0xa3cf('0x11')](_0xa3cf('0xe'),auth[_0xa3cf('0xa')](),controller[_0xa3cf('0x12')]);router[_0xa3cf('0x13')](_0xa3cf('0xe'),auth['isAuthenticated'](),controller[_0xa3cf('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2b6f=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','create','put','/:id','update'];(function(_0x29a011,_0x52a382){var _0x4b00b5=function(_0x92cb7){while(--_0x92cb7){_0x29a011['push'](_0x29a011['shift']());}};_0x4b00b5(++_0x52a382);}(_0x2b6f,0xf3));var _0xf2b6=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x2b6f[_0x2718c7];return _0x59d89c;};'use strict';var multer=require(_0xf2b6('0x0'));var util=require(_0xf2b6('0x1'));var path=require(_0xf2b6('0x2'));var timeout=require(_0xf2b6('0x3'));var express=require(_0xf2b6('0x4'));var router=express['Router']();var fs_extra=require(_0xf2b6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf2b6('0x6'));var controller=require(_0xf2b6('0x7'));router[_0xf2b6('0x8')]('/',auth[_0xf2b6('0x9')](),controller[_0xf2b6('0xa')]);router[_0xf2b6('0x8')](_0xf2b6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xf2b6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf2b6('0xc')]);router['post']('/',auth[_0xf2b6('0x9')](),controller[_0xf2b6('0xd')]);router[_0xf2b6('0xe')](_0xf2b6('0xf'),auth['isAuthenticated'](),controller[_0xf2b6('0x10')]);router[_0xf2b6('0x11')](_0xf2b6('0xf'),auth['isAuthenticated'](),controller[_0xf2b6('0x12')]);module[_0xf2b6('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 974e88f..889de78 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 _0xb58b=['alternate','#fafafa','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}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM','squared','rounded','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','TEXT','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x4b886a,_0x554079){var _0x54b933=function(_0x42746b){while(--_0x42746b){_0x4b886a['push'](_0x4b886a['shift']());}};_0x54b933(++_0x554079);}(_0xb58b,0x1f1));var _0xbb58=function(_0x49bdad,_0x2b5106){_0x49bdad=_0x49bdad-0x0;var _0x33f57e=_0xb58b[_0x49bdad];return _0x33f57e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbb58('0x0'));module[_0xbb58('0x1')]={'name':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbb58('0x3')},'description':{'type':Sequelize[_0xbb58('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'key':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbb58('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbb58('0x8')]('rounded',_0xbb58('0x9')),'defaultValue':_0xbb58('0xa')},'header_online':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0xc')},'offline_chat_button':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xd')},'download_transcript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbb58('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x11')},'closingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x12')},'conditionAgreement':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xbb58('0x8')](_0xbb58('0x13'),_0xbb58('0x14')),'defaultValue':_0xbb58('0x13')},'ratingStarsNumber':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'variable':null,'config':{'placeholder':_0xbb58('0x17'),'type':'text','required':!![]},'props':{'title':_0xbb58('0x17'),'helpText':''}},{'type':'input','props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x19'))?JSON[_0xbb58('0x1a')](this[_0xbb58('0x18')](_0xbb58('0x19'))):{};},'set':function(_0x4e0303){return this[_0xbb58('0x1b')](_0xbb58('0x19'),JSON[_0xbb58('0x15')](_0x4e0303));}},'offlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null},{'type':_0xbb58('0x1c'),'config':{'placeholder':_0xbb58('0x1d')},'props':{'title':_0xbb58('0x1d'),'helpText':_0xbb58('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x1f'))?JSON['parse'](this[_0xbb58('0x18')](_0xbb58('0x1f'))):{};},'set':function(_0x12b3eb){return this[_0xbb58('0x1b')](_0xbb58('0x1f'),JSON[_0xbb58('0x15')](_0x12b3eb));}},'token':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return rs[_0xbb58('0x20')]();}},'autoclose':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbb58('0x2')]},'forwardOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbb58('0x2')]},'waitingTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x21')},'waitingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x22')},'offlineMessageSubject':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x23')},'offlineMessageBody':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x12')},'sendUnmanaged':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbb58('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbb58('0x26');}},'notificationSound':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x27')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x29')},'messagesAlignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x2a')},'defaultTitle':{'type':Sequelize[_0xbb58('0x2')]},'customerAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbb58('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb58('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xbb58('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb58('0x7')],'comment':_0xbb58('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xc29171){if(!_0xc29171)this[_0xbb58('0x1b')](_0xbb58('0x2d'),null);this[_0xbb58('0x1b')](_0xbb58('0x2e'),_0xc29171);}},'vidaooEscalation':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x2f')},'vidaooNote':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return _0xbb58('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4522=['mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','email','Agent','#011F6A','#ffffff','rounded','squared','We\x20are\x20here!','Chat','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Send','Feedback','ENUM','star','INTEGER','input','name','text','getDataValue','onlineForm','parse','stringify','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4522,0x1a0));var _0x2452=function(_0x4d6cc5,_0x47cc26){_0x4d6cc5=_0x4d6cc5-0x0;var _0x43c3aa=_0x4522[_0x4d6cc5];return _0x43c3aa;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x2452('0x0')]={'name':{'type':Sequelize[_0x2452('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x2452('0x1')]},'mapKey':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x2')},'mapKeyOffline':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x2')},'key':{'type':Sequelize[_0x2452('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x3')},'customerAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2452('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x2452('0x6'),_0x2452('0x7')),'defaultValue':_0x2452('0x6')},'header_online':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x8')},'start_chat_button':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x9')},'offline_chat_button':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2452('0xb')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0xc')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0xd')},'formSubmitFailureMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0xe')},'noteTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0xf')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x10')},'skipMessageButton':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x11')},'ratingType':{'type':Sequelize[_0x2452('0x12')](_0x2452('0x13'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x2452('0x14')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2452('0x15'),'variable':null,'config':{'placeholder':_0x2452('0x16'),'type':_0x2452('0x17'),'required':!![]},'props':{'title':_0x2452('0x16'),'helpText':''}},{'type':_0x2452('0x15'),'props':{'title':_0x2452('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x2452('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2452('0x18')](_0x2452('0x19'))?JSON[_0x2452('0x1a')](this[_0x2452('0x18')](_0x2452('0x19'))):{};},'set':function(_0x516fcf){return this['setDataValue'](_0x2452('0x19'),JSON[_0x2452('0x1b')](_0x516fcf));}},'offlineForm':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return JSON[_0x2452('0x1b')]({'items':[{'type':_0x2452('0x15'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2452('0x2'),'type':_0x2452('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x2452('0x1c'),'helpText':_0x2452('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0x2452('0x18')](_0x2452('0x1e'))?JSON[_0x2452('0x1a')](this[_0x2452('0x18')]('offlineForm')):{};},'set':function(_0x5da9aa){return this[_0x2452('0x1f')](_0x2452('0x1e'),JSON[_0x2452('0x1b')](_0x5da9aa));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2452('0x20')]();}},'autoclose':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2452('0x1')]},'forwardOffline':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2452('0x1')]},'waitingTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x21')},'waitingMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x23')},'offlineMessageBody':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0x25')},'skipUnmanaged':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2452('0x1')]},'notificationTemplate':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x27')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x28')},'defaultTitle':{'type':Sequelize[_0x2452('0x1')]},'customerAvatar':{'type':Sequelize[_0x2452('0xb')]},'showCustomerAvatar':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x2452('0xb')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2452('0x14')],'comment':_0x2452('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![],'comment':_0x2452('0x2a'),'set':function(_0x112849){if(!_0x112849)this[_0x2452('0x1f')](_0x2452('0x2b'),null);this['setDataValue'](_0x2452('0x2c'),_0x112849);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2452('0x1')]},'vidaooTopic':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x2452('0x1')],'defaultValue':function(){return _0x2452('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x2452('0xb')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2452('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 219a740..c9ff29a 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 _0xb543=['findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','getLogo','join','../../config/license/util','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','headers','getResult','chat','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','Applications','account','applications','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','push','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','offline','CompanyId','from\x20is\x20mandatory','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','offlineMessageBody','fromString','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','format','\x22%s\x22\x20<%s>','email','offlineMessageSubject','originalname','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','x-real-ip','connection','replace','render','alignment','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','online','false','items','fromKey','getOfflineMessages','Attachments','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','lodash','querystring','../../config/logger','api','../../config/environment','redis','defaults','localhost','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','update','destroy','ChatWebsites','UserProfileResource','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','name','includeAll','include','rows','params','keys','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xb543,0x1dc));var _0x3b54=function(_0x1f9e30,_0x517ae0){_0x1f9e30=_0x1f9e30-0x0;var _0x32f2ea=_0xb543[_0x1f9e30];return _0x32f2ea;};'use strict';var BPromise=require(_0x3b54('0x0'));var Mustache=require(_0x3b54('0x1'));var util=require(_0x3b54('0x2'));var path=require('path');var ejs=require(_0x3b54('0x3'));var fs=require('fs');var fs_extra=require(_0x3b54('0x4'));var _=require(_0x3b54('0x5'));var querystring=require(_0x3b54('0x6'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3b54('0x7'))(_0x3b54('0x8'));var config=require(_0x3b54('0x9'));var db=require('../../mysqldb')['db'];config[_0x3b54('0xa')]=_[_0x3b54('0xb')](config[_0x3b54('0xa')],{'host':_0x3b54('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b54('0xa')]));require(_0x3b54('0xd'))[_0x3b54('0xe')](socket);var htmlToText=require(_0x3b54('0xf'));var jayson=require(_0x3b54('0x10'));var client=jayson['client'][_0x3b54('0x11')]({'port':0x232c});var client9002=jayson[_0x3b54('0x12')]['http']({'port':0x232a});var client9003=jayson['client'][_0x3b54('0x11')]({'port':0x232b});var client9001=jayson[_0x3b54('0x12')][_0x3b54('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x4079bc,_0xa73ad2,_0x3ebe70,_0x3e3c2a){return new BPromise(function(_0x210d22,_0x161b9d){var _0x49b1c7=_0x3e3c2a||client;return _0x49b1c7[_0x3b54('0x13')](_0x4079bc,_0x3ebe70)[_0x3b54('0x14')](function(_0x21ee72){logger['info'](_0x3b54('0x15'),_0xa73ad2,'request\x20sent');logger[_0x3b54('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xa73ad2,_0x3b54('0x17'),JSON[_0x3b54('0x18')](_0x21ee72));if(_0x21ee72[_0x3b54('0x19')]){if(_0x21ee72[_0x3b54('0x19')][_0x3b54('0x1a')]===0x1f4){logger[_0x3b54('0x19')](_0x3b54('0x15'),_0xa73ad2,_0x21ee72[_0x3b54('0x19')][_0x3b54('0x1b')]);return _0x161b9d(_0x21ee72[_0x3b54('0x19')][_0x3b54('0x1b')]);}logger[_0x3b54('0x19')](_0x3b54('0x15'),_0xa73ad2,_0x21ee72[_0x3b54('0x19')][_0x3b54('0x1b')]);return _0x210d22(_0x21ee72[_0x3b54('0x19')][_0x3b54('0x1b')]);}else{logger['info'](_0x3b54('0x15'),_0xa73ad2,_0x3b54('0x17'));_0x210d22(_0x21ee72[_0x3b54('0x1c')][_0x3b54('0x1b')]);}})[_0x3b54('0x1d')](function(_0x47b473){logger['error'](_0x3b54('0x15'),_0xa73ad2,_0x47b473);_0x161b9d(_0x47b473);});});}function respondWithStatusCode(_0x49c23c,_0x2168de){_0x2168de=_0x2168de||0xcc;return function(_0x19659a){if(_0x19659a){return _0x49c23c[_0x3b54('0x1e')](_0x2168de);}return _0x49c23c[_0x3b54('0x1f')](_0x2168de)[_0x3b54('0x20')]();};}function respondWithResult(_0x4e009a,_0x1b70d0){_0x1b70d0=_0x1b70d0||0xc8;return function(_0x3cf8fe){if(_0x3cf8fe){return _0x4e009a['status'](_0x1b70d0)[_0x3b54('0x21')](_0x3cf8fe);}};}function respondWithFilteredResult(_0x1bbb87,_0x436406){return function(_0x25c5e2){if(_0x25c5e2){var _0x44cf0f=typeof _0x436406['offset']===_0x3b54('0x22')&&typeof _0x436406[_0x3b54('0x23')]==='undefined';var _0x33d1fa=_0x25c5e2[_0x3b54('0x24')];var _0x456bfa=_0x44cf0f?0x0:_0x436406[_0x3b54('0x25')];var _0x521afb=_0x44cf0f?_0x25c5e2[_0x3b54('0x24')]:_0x436406[_0x3b54('0x25')]+_0x436406['limit'];var _0xe3ef75;if(_0x521afb>=_0x33d1fa){_0x521afb=_0x33d1fa;_0xe3ef75=0xc8;}else{_0xe3ef75=0xce;}_0x1bbb87[_0x3b54('0x1f')](_0xe3ef75);return _0x1bbb87['set']('Content-Range',_0x456bfa+'-'+_0x521afb+'/'+_0x33d1fa)[_0x3b54('0x21')](_0x25c5e2);}return null;};}function saveUpdates(_0x5df3fd){return function(_0x52186a){if(_0x52186a){return _0x52186a[_0x3b54('0x26')](_0x5df3fd)['then'](function(_0x2fd0cc){return _0x2fd0cc;});}return null;};}function removeEntity(_0xe2543d){return function(_0x4394a7){if(_0x4394a7){return _0x4394a7[_0x3b54('0x27')]()['then'](function(){var _0x5bab08=_0x4394a7['get']({'plain':!![]});var _0x1d7577=_0x3b54('0x28');return db[_0x3b54('0x29')][_0x3b54('0x27')]({'where':{'type':_0x1d7577,'resourceId':_0x5bab08['id']}})[_0x3b54('0x14')](function(){return _0x4394a7;});})['then'](function(){_0xe2543d['status'](0xcc)[_0x3b54('0x20')]();});}};}function handleEntityNotFound(_0x26e22b){return function(_0x535cd8){if(!_0x535cd8){_0x26e22b[_0x3b54('0x1e')](0x194);}return _0x535cd8;};}function handleError(_0x259904,_0xee2203){_0xee2203=_0xee2203||0x1f4;return function(_0x5726e8){logger[_0x3b54('0x19')](_0x5726e8['stack']);if(_0x5726e8['name']){delete _0x5726e8['name'];}_0x259904[_0x3b54('0x1f')](_0xee2203)[_0x3b54('0x2a')](_0x5726e8);};}exports[_0x3b54('0x2b')]=function(_0x3ca930,_0x48b3ba){var _0x2c1927={'include':[{'model':db[_0x3b54('0x2c')],'as':_0x3b54('0x2d')}]},_0x2b4372={},_0x4ff3bd={'count':0x0,'rows':[]};var _0x2e6dd4=_['map'](db[_0x3b54('0x2e')][_0x3b54('0x2f')],function(_0x37811f){return{'name':_0x37811f['fieldName'],'type':_0x37811f[_0x3b54('0x30')][_0x3b54('0x31')]};});_0x2b4372[_0x3b54('0x32')]=_[_0x3b54('0x33')](_0x2e6dd4,'name');_0x2b4372[_0x3b54('0x34')]=_['keys'](_0x3ca930[_0x3b54('0x34')]);_0x2b4372['filters']=_['intersection'](_0x2b4372['model'],_0x2b4372[_0x3b54('0x34')]);_0x2c1927['attributes']=_[_0x3b54('0x35')](_0x2b4372['model'],qs[_0x3b54('0x36')](_0x3ca930['query'][_0x3b54('0x36')]));_0x2c1927['attributes']=_0x2c1927[_0x3b54('0x37')][_0x3b54('0x38')]?_0x2c1927['attributes']:_0x2b4372[_0x3b54('0x32')];if(!_0x3ca930['query'][_0x3b54('0x39')](_0x3b54('0x3a'))){_0x2c1927[_0x3b54('0x23')]=qs[_0x3b54('0x23')](_0x3ca930[_0x3b54('0x34')][_0x3b54('0x23')]);_0x2c1927['offset']=qs[_0x3b54('0x25')](_0x3ca930[_0x3b54('0x34')]['offset']);}_0x2c1927[_0x3b54('0x3b')]=qs[_0x3b54('0x3c')](_0x3ca930[_0x3b54('0x34')][_0x3b54('0x3c')]);_0x2c1927[_0x3b54('0x3d')]=qs[_0x3b54('0x3e')](_['pick'](_0x3ca930['query'],_0x2b4372[_0x3b54('0x3e')]),_0x2e6dd4);if(_0x3ca930[_0x3b54('0x34')][_0x3b54('0x3f')]){_0x2c1927[_0x3b54('0x3d')]=_[_0x3b54('0x40')](_0x2c1927[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x33')](_0x2e6dd4,function(_0x58c4de){if(_0x58c4de['type']!=='VIRTUAL'){var _0x451052={};_0x451052[_0x58c4de[_0x3b54('0x41')]]={'$like':'%'+_0x3ca930[_0x3b54('0x34')][_0x3b54('0x3f')]+'%'};return _0x451052;}})});}_0x2c1927=_['merge']({},_0x2c1927,_0x3ca930['options']);var _0x42fd68={'where':_0x2c1927[_0x3b54('0x3d')]};return db[_0x3b54('0x2e')]['count'](_0x42fd68)[_0x3b54('0x14')](function(_0x48f5a2){_0x4ff3bd[_0x3b54('0x24')]=_0x48f5a2;if(_0x3ca930[_0x3b54('0x34')][_0x3b54('0x42')]){_0x2c1927[_0x3b54('0x43')]=[{'all':!![]}];}return db[_0x3b54('0x2e')]['findAll'](_0x2c1927);})['then'](function(_0x100f3a){_0x4ff3bd[_0x3b54('0x44')]=_0x100f3a;return _0x4ff3bd;})[_0x3b54('0x14')](respondWithFilteredResult(_0x48b3ba,_0x2c1927))[_0x3b54('0x1d')](handleError(_0x48b3ba,null));};exports['show']=function(_0x33ca61,_0x26682a){var _0x20ef4f={'raw':![],'where':{'id':_0x33ca61[_0x3b54('0x45')]['id']},'include':[{'model':db['Pause'],'as':_0x3b54('0x2d')}]},_0x54fa62={};_0x54fa62[_0x3b54('0x32')]=_[_0x3b54('0x46')](db[_0x3b54('0x2e')]['rawAttributes']);_0x54fa62[_0x3b54('0x34')]=_['keys'](_0x33ca61[_0x3b54('0x34')]);_0x54fa62[_0x3b54('0x3e')]=_[_0x3b54('0x35')](_0x54fa62['model'],_0x54fa62[_0x3b54('0x34')]);_0x20ef4f[_0x3b54('0x37')]=_['intersection'](_0x54fa62[_0x3b54('0x32')],qs[_0x3b54('0x36')](_0x33ca61[_0x3b54('0x34')][_0x3b54('0x36')]));_0x20ef4f['attributes']=_0x20ef4f[_0x3b54('0x37')][_0x3b54('0x38')]?_0x20ef4f[_0x3b54('0x37')]:_0x54fa62[_0x3b54('0x32')];if(_0x33ca61[_0x3b54('0x34')][_0x3b54('0x42')]){_0x20ef4f[_0x3b54('0x43')]=[{'all':!![]}];}_0x20ef4f=_[_0x3b54('0x40')]({},_0x20ef4f,_0x33ca61[_0x3b54('0x47')]);return db[_0x3b54('0x2e')]['find'](_0x20ef4f)['then'](handleEntityNotFound(_0x26682a,null))['then'](respondWithResult(_0x26682a,null))[_0x3b54('0x1d')](handleError(_0x26682a,null));};exports[_0x3b54('0x48')]=function(_0x2c1127,_0xfb6223){return db[_0x3b54('0x2e')]['create'](_0x2c1127['body'],{})[_0x3b54('0x14')](function(_0x407b9d){var _0x472d39=_0x2c1127[_0x3b54('0x49')][_0x3b54('0x4a')]({'plain':!![]});if(!_0x472d39)throw new Error(_0x3b54('0x4b'));if(_0x472d39[_0x3b54('0x4c')]===_0x3b54('0x49')){var _0x21fd5e=_0x407b9d[_0x3b54('0x4a')]({'plain':!![]});var _0x8a0dc7=_0x3b54('0x28');return db[_0x3b54('0x4d')][_0x3b54('0x4e')]({'where':{'name':_0x8a0dc7,'userProfileId':_0x472d39[_0x3b54('0x4f')]},'raw':!![]})['then'](function(_0xd94d47){if(_0xd94d47&&_0xd94d47[_0x3b54('0x50')]===0x0){return db[_0x3b54('0x29')]['create']({'name':_0x21fd5e[_0x3b54('0x41')],'resourceId':_0x21fd5e['id'],'type':_0xd94d47[_0x3b54('0x41')],'sectionId':_0xd94d47['id']},{})['then'](function(){return _0x407b9d;});}else{return _0x407b9d;}})[_0x3b54('0x1d')](function(_0x2ee270){logger[_0x3b54('0x19')](_0x3b54('0x51'),_0x2ee270);throw _0x2ee270;});}return _0x407b9d;})[_0x3b54('0x14')](respondWithResult(_0xfb6223,0xc9))[_0x3b54('0x1d')](handleError(_0xfb6223,null));};exports[_0x3b54('0x26')]=function(_0x5d72e7,_0x1fed1d){if(_0x5d72e7[_0x3b54('0x52')]['id']){delete _0x5d72e7[_0x3b54('0x52')]['id'];}return db[_0x3b54('0x2e')]['find']({'where':{'id':_0x5d72e7[_0x3b54('0x45')]['id']},'include':[{'model':db[_0x3b54('0x2c')],'as':'mandatoryDispositionPause'}]})[_0x3b54('0x14')](handleEntityNotFound(_0x1fed1d,null))['then'](saveUpdates(_0x5d72e7[_0x3b54('0x52')],null))['then'](respondWithResult(_0x1fed1d,null))[_0x3b54('0x1d')](handleError(_0x1fed1d,null));};exports[_0x3b54('0x27')]=function(_0xaea5d8,_0x592b87){return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0xaea5d8['params']['id']}})['then'](handleEntityNotFound(_0x592b87,null))[_0x3b54('0x14')](removeEntity(_0x592b87,null))['catch'](handleError(_0x592b87,null));};exports['describe']=function(_0x25cb73,_0x503128){return db[_0x3b54('0x2e')][_0x3b54('0x53')]()[_0x3b54('0x14')](respondWithResult(_0x503128,null))[_0x3b54('0x1d')](handleError(_0x503128,null));};exports[_0x3b54('0x54')]=function(_0x5aa534,_0x1729f0){if(_0x5aa534[_0x3b54('0x52')]['id']){delete _0x5aa534[_0x3b54('0x52')]['id'];}return db[_0x3b54('0x2e')]['find']({'where':{'id':_0x5aa534[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x1729f0,null))['then'](function(_0x3acc7a){if(_0x3acc7a){_0x5aa534[_0x3b54('0x52')][_0x3b54('0x55')]=_0x3acc7a['id'];return db[_0x3b54('0x56')][_0x3b54('0x48')](_0x5aa534[_0x3b54('0x52')]);}})[_0x3b54('0x14')](respondWithResult(_0x1729f0,null))['catch'](handleError(_0x1729f0,null));};exports[_0x3b54('0x57')]=function(_0x5e0cf8,_0x291134){var _0x54cea8={'raw':![],'where':{}};var _0xe77501={};var _0x2dec2a={'count':0x0,'rows':[]};return db[_0x3b54('0x2e')][_0x3b54('0x58')]({'where':{'id':_0x5e0cf8[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x291134,null))[_0x3b54('0x14')](function(_0x1b3f38){if(_0x1b3f38){_0xe77501['model']=_[_0x3b54('0x46')](db['Disposition'][_0x3b54('0x2f')]);_0xe77501[_0x3b54('0x34')]=_[_0x3b54('0x46')](_0x5e0cf8[_0x3b54('0x34')]);_0xe77501[_0x3b54('0x3e')]=_[_0x3b54('0x35')](_0xe77501[_0x3b54('0x32')],_0xe77501[_0x3b54('0x34')]);_0x54cea8[_0x3b54('0x37')]=_[_0x3b54('0x35')](_0xe77501[_0x3b54('0x32')],qs['fields'](_0x5e0cf8[_0x3b54('0x34')][_0x3b54('0x36')]));_0x54cea8[_0x3b54('0x37')]=_0x54cea8[_0x3b54('0x37')][_0x3b54('0x38')]?_0x54cea8[_0x3b54('0x37')]:_0xe77501[_0x3b54('0x32')];if(!_0x5e0cf8[_0x3b54('0x34')][_0x3b54('0x39')](_0x3b54('0x3a'))){_0x54cea8[_0x3b54('0x23')]=qs[_0x3b54('0x23')](_0x5e0cf8['query']['limit']);_0x54cea8['offset']=qs[_0x3b54('0x25')](_0x5e0cf8[_0x3b54('0x34')][_0x3b54('0x25')]);}_0x54cea8['order']=qs[_0x3b54('0x3c')](_0x5e0cf8[_0x3b54('0x34')][_0x3b54('0x3c')]);_0x54cea8[_0x3b54('0x3d')]=qs[_0x3b54('0x3e')](_[_0x3b54('0x59')](_0x5e0cf8['query'],_0xe77501[_0x3b54('0x3e')]));_0x54cea8['where']['ChatWebsiteId']=_0x1b3f38['id'];if(_0x5e0cf8[_0x3b54('0x34')][_0x3b54('0x3f')]){_0x54cea8['where']=_[_0x3b54('0x40')](_0x54cea8[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x33')](_0x54cea8[_0x3b54('0x37')],function(_0x29b7e3){var _0x6075c4={};_0x6075c4[_0x29b7e3]={'$like':'%'+_0x5e0cf8[_0x3b54('0x34')]['filter']+'%'};return _0x6075c4;})});}_0x54cea8=_[_0x3b54('0x40')]({},_0x54cea8,_0x5e0cf8[_0x3b54('0x47')]);return db['Disposition'][_0x3b54('0x24')]({'where':_0x54cea8['where']})[_0x3b54('0x14')](function(_0x4f3249){_0x2dec2a[_0x3b54('0x24')]=_0x4f3249;if(_0x5e0cf8['query'][_0x3b54('0x42')]){_0x54cea8['include']=[{'all':!![]}];}return db[_0x3b54('0x56')][_0x3b54('0x5a')](_0x54cea8);})['then'](function(_0x184a60){_0x2dec2a[_0x3b54('0x44')]=_0x184a60;return _0x2dec2a;});}})[_0x3b54('0x14')](respondWithFilteredResult(_0x291134,_0x54cea8))[_0x3b54('0x1d')](handleError(_0x291134,null));};exports[_0x3b54('0x5b')]=function(_0x511c87,_0x470332){return db[_0x3b54('0x2e')]['find']({'where':{'id':_0x511c87[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x470332,null))['then'](function(_0x43d405){if(_0x43d405){return _0x43d405['removeDispositions'](_0x511c87[_0x3b54('0x34')][_0x3b54('0x5c')]);}})[_0x3b54('0x14')](respondWithStatusCode(_0x470332,null))[_0x3b54('0x1d')](handleError(_0x470332,null));};exports[_0x3b54('0x5d')]=function(_0x4fd5cf,_0x434495){if(_0x4fd5cf['body']['id']){delete _0x4fd5cf[_0x3b54('0x52')]['id'];}return db['ChatWebsite'][_0x3b54('0x4e')]({'where':{'id':_0x4fd5cf[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x434495,null))['then'](function(_0xf0f16){if(_0xf0f16){_0x4fd5cf[_0x3b54('0x52')]['ChatWebsiteId']=_0xf0f16['id'];return db[_0x3b54('0x5e')][_0x3b54('0x48')](_0x4fd5cf[_0x3b54('0x52')]);}})[_0x3b54('0x14')](respondWithResult(_0x434495,null))['catch'](handleError(_0x434495,null));};exports[_0x3b54('0x5f')]=function(_0x2086b4,_0x379be9){var _0x12018a={'raw':![],'where':{}};var _0x44633c={};var _0x59e13c={'count':0x0,'rows':[]};return db[_0x3b54('0x2e')]['findOne']({'where':{'id':_0x2086b4[_0x3b54('0x45')]['id']}})['then'](handleEntityNotFound(_0x379be9,null))[_0x3b54('0x14')](function(_0x257f80){if(_0x257f80){_0x44633c[_0x3b54('0x32')]=_[_0x3b54('0x46')](db[_0x3b54('0x5e')][_0x3b54('0x2f')]);_0x44633c[_0x3b54('0x34')]=_['keys'](_0x2086b4['query']);_0x44633c[_0x3b54('0x3e')]=_[_0x3b54('0x35')](_0x44633c[_0x3b54('0x32')],_0x44633c[_0x3b54('0x34')]);_0x12018a[_0x3b54('0x37')]=_[_0x3b54('0x35')](_0x44633c[_0x3b54('0x32')],qs['fields'](_0x2086b4[_0x3b54('0x34')][_0x3b54('0x36')]));_0x12018a['attributes']=_0x12018a['attributes'][_0x3b54('0x38')]?_0x12018a[_0x3b54('0x37')]:_0x44633c[_0x3b54('0x32')];if(!_0x2086b4[_0x3b54('0x34')]['hasOwnProperty']('nolimit')){_0x12018a[_0x3b54('0x23')]=qs[_0x3b54('0x23')](_0x2086b4[_0x3b54('0x34')]['limit']);_0x12018a[_0x3b54('0x25')]=qs[_0x3b54('0x25')](_0x2086b4['query']['offset']);}_0x12018a['order']=qs[_0x3b54('0x3c')](_0x2086b4[_0x3b54('0x34')]['sort']);_0x12018a['where']=qs['filters'](_[_0x3b54('0x59')](_0x2086b4[_0x3b54('0x34')],_0x44633c[_0x3b54('0x3e')]));_0x12018a[_0x3b54('0x3d')]['ChatWebsiteId']=_0x257f80['id'];if(_0x2086b4['query'][_0x3b54('0x3f')]){_0x12018a[_0x3b54('0x3d')]=_[_0x3b54('0x40')](_0x12018a[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x33')](_0x12018a[_0x3b54('0x37')],function(_0x288c48){var _0x5146a2={};_0x5146a2[_0x288c48]={'$like':'%'+_0x2086b4[_0x3b54('0x34')][_0x3b54('0x3f')]+'%'};return _0x5146a2;})});}_0x12018a=_[_0x3b54('0x40')]({},_0x12018a,_0x2086b4[_0x3b54('0x47')]);return db[_0x3b54('0x5e')][_0x3b54('0x24')]({'where':_0x12018a['where']})[_0x3b54('0x14')](function(_0x320566){_0x59e13c['count']=_0x320566;if(_0x2086b4['query'][_0x3b54('0x42')]){_0x12018a[_0x3b54('0x43')]=[{'all':!![]}];}return db[_0x3b54('0x5e')][_0x3b54('0x5a')](_0x12018a);})[_0x3b54('0x14')](function(_0xc995e3){_0x59e13c['rows']=_0xc995e3;return _0x59e13c;});}})[_0x3b54('0x14')](respondWithFilteredResult(_0x379be9,_0x12018a))['catch'](handleError(_0x379be9,null));};exports[_0x3b54('0x60')]=function(_0x30919f,_0x1ad601){return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0x30919f[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x1ad601,null))[_0x3b54('0x14')](function(_0x593a58){if(_0x593a58){return _0x593a58[_0x3b54('0x60')](_0x30919f[_0x3b54('0x34')][_0x3b54('0x5c')]);}})[_0x3b54('0x14')](respondWithStatusCode(_0x1ad601,null))[_0x3b54('0x1d')](handleError(_0x1ad601,null));};exports['addLogo']=function(_0x22de6c,_0x2b5dfa){_0x22de6c[_0x3b54('0x52')][_0x3b54('0x61')]=_0x22de6c[_0x3b54('0x62')][_0x3b54('0x63')];return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0x22de6c['params']['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x2b5dfa,null))[_0x3b54('0x14')](saveUpdates(_0x22de6c[_0x3b54('0x52')],null))[_0x3b54('0x14')](respondWithResult(_0x2b5dfa,null))[_0x3b54('0x1d')](handleError(_0x2b5dfa,null));};exports[_0x3b54('0x64')]=function(_0x286932,_0x94a36f){_0x286932[_0x3b54('0x52')][_0x3b54('0x65')]=_0x286932[_0x3b54('0x62')][_0x3b54('0x63')];return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0x286932[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x94a36f,null))['then'](saveUpdates(_0x286932[_0x3b54('0x52')],null))['then'](respondWithResult(_0x94a36f,null))['catch'](handleError(_0x94a36f,null));};exports[_0x3b54('0x66')]=function(_0x3c3647,_0x11c1bf){_0x3c3647['body'][_0x3b54('0x67')]=_0x3c3647[_0x3b54('0x62')][_0x3b54('0x63')];return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0x3c3647[_0x3b54('0x45')]['id']}})['then'](handleEntityNotFound(_0x11c1bf,null))['then'](saveUpdates(_0x3c3647[_0x3b54('0x52')],null))[_0x3b54('0x14')](respondWithResult(_0x11c1bf,null))['catch'](handleError(_0x11c1bf,null));};exports['addSystemAvatar']=function(_0x4208f8,_0x1dff3b){_0x4208f8[_0x3b54('0x52')]['systemAvatar']=_0x4208f8[_0x3b54('0x62')][_0x3b54('0x63')];return db[_0x3b54('0x2e')]['find']({'where':{'id':_0x4208f8['params']['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x1dff3b,null))[_0x3b54('0x14')](saveUpdates(_0x4208f8[_0x3b54('0x52')],null))[_0x3b54('0x14')](respondWithResult(_0x1dff3b,null))[_0x3b54('0x1d')](handleError(_0x1dff3b,null));};exports[_0x3b54('0x68')]=function(_0x489bdd,_0x3486c6){var _0x317f88=path[_0x3b54('0x69')](config['root'],'server/files/images/logos/default_logo.svg');var _0x5fe7d4={'where':{'id':_0x489bdd[_0x3b54('0x45')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1f443c=![];return require(_0x3b54('0x6a'))['getLicense']()[_0x3b54('0x14')](function(_0x4db2f7){if(_0x4db2f7){_0x1f443c=_0x4db2f7['custom'];}})[_0x3b54('0x14')](function(){return db['ChatWebsite'][_0x3b54('0x4e')](_0x5fe7d4);})[_0x3b54('0x14')](handleEntityNotFound(_0x3486c6,null))[_0x3b54('0x14')](function(_0x5169cf){if(_0x5169cf){if(!_['isNil'](_0x5169cf[_0x3b54('0x61')])){if(fs[_0x3b54('0x6b')](path[_0x3b54('0x69')](config['root'],_0x3b54('0x6c'),_0x5169cf[_0x3b54('0x61')]))&&_0x1f443c){_0x317f88=path[_0x3b54('0x69')](config[_0x3b54('0x6d')],_0x3b54('0x6c'),_0x5169cf['sitepic']);}}return _0x3486c6[_0x3b54('0x6e')](_0x317f88);}})[_0x3b54('0x1d')](handleError(_0x3486c6,null));};exports[_0x3b54('0x6f')]=function(_0x3e4712,_0x1e2960){var _0x2121b5=path[_0x3b54('0x69')](config[_0x3b54('0x6d')],_0x3b54('0x70'));var _0x319693={'where':{'id':_0x3e4712[_0x3b54('0x45')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x3b54('0x2e')][_0x3b54('0x4e')](_0x319693)['then'](handleEntityNotFound(_0x1e2960,null))[_0x3b54('0x14')](function(_0x43b590){if(_0x43b590){if(!_[_0x3b54('0x71')](_0x43b590[_0x3b54('0x65')])){if(fs[_0x3b54('0x6b')](path[_0x3b54('0x69')](config[_0x3b54('0x6d')],'server/files/images/avatars/',_0x43b590[_0x3b54('0x65')]))){_0x2121b5=path[_0x3b54('0x69')](config['root'],_0x3b54('0x72'),_0x43b590[_0x3b54('0x65')]);}}return _0x1e2960[_0x3b54('0x6e')](_0x2121b5);}})[_0x3b54('0x1d')](handleError(_0x1e2960,null));};exports[_0x3b54('0x73')]=function(_0x49a103,_0x39e35c){var _0x39a08b=path[_0x3b54('0x69')](config[_0x3b54('0x6d')],_0x3b54('0x74'));var _0x5909ed={'where':{'id':_0x49a103['params']['id']},'attributes':['id',_0x3b54('0x67'),_0x3b54('0x75')],'raw':!![]};return db[_0x3b54('0x2e')]['find'](_0x5909ed)[_0x3b54('0x14')](handleEntityNotFound(_0x39e35c,null))[_0x3b54('0x14')](function(_0x35df11){if(_0x35df11){if(!_['isNil'](_0x35df11[_0x3b54('0x67')])){if(fs[_0x3b54('0x6b')](path[_0x3b54('0x69')](config[_0x3b54('0x6d')],_0x3b54('0x72'),_0x35df11[_0x3b54('0x67')]))&&_0x35df11[_0x3b54('0x75')]){_0x39a08b=path[_0x3b54('0x69')](config['root'],'server/files/images/avatars/',_0x35df11[_0x3b54('0x67')]);}}return _0x39e35c[_0x3b54('0x6e')](_0x39a08b);}})['catch'](handleError(_0x39e35c,null));};exports[_0x3b54('0x76')]=function(_0x40c366,_0x4ecd8b){var _0xfa32cc=path[_0x3b54('0x69')](config[_0x3b54('0x6d')],_0x3b54('0x77'));var _0x6de993={'where':{'id':_0x40c366['params']['id']},'attributes':['id',_0x3b54('0x78')],'raw':!![]};return db['ChatWebsite'][_0x3b54('0x4e')](_0x6de993)[_0x3b54('0x14')](handleEntityNotFound(_0x4ecd8b,null))['then'](function(_0x32d3a0){if(_0x32d3a0){if(!_[_0x3b54('0x71')](_0x32d3a0[_0x3b54('0x78')])){if(fs[_0x3b54('0x6b')](path['join'](config['root'],_0x3b54('0x72'),_0x32d3a0[_0x3b54('0x78')]))){_0xfa32cc=path['join'](config['root'],'server/files/images/avatars/',_0x32d3a0[_0x3b54('0x78')]);}}return _0x4ecd8b['download'](_0xfa32cc);}})[_0x3b54('0x1d')](handleError(_0x4ecd8b,null));};exports[_0x3b54('0x79')]=function(_0x43e269,_0x2806e9){var _0x2a0c5e=require(_0x3b54('0x7a'));var _0x225a86=new _0x2a0c5e();var _0x2fbb07=_0x225a86['setUA'](_0x43e269[_0x3b54('0x7b')]['user-agent'])[_0x3b54('0x7c')]();var _0x57cf6d={'body':_0x43e269['body'],'channel':_0x3b54('0x7d')};var _0x5ebd89=[];var _0x1c0c9b=[];var _0x27a40b={};var _0x536476=![];return db['CmContact'][_0x3b54('0x53')]()['then'](function(_0x409d7){if(!_0x409d7){throw new db['Sequelize'][(_0x3b54('0x7e'))](_0x3b54('0x7f'));}_0x5ebd89=_[_0x3b54('0x80')](_[_0x3b54('0x46')](_0x409d7),['createdAt',_0x3b54('0x81')]);_0x1c0c9b=_[_0x3b54('0x80')](_[_0x3b54('0x46')](_0x409d7),[_0x3b54('0x82'),_0x3b54('0x81'),'CompanyId',_0x3b54('0x83')]);if(_0x43e269[_0x3b54('0x52')]['id']){delete _0x43e269[_0x3b54('0x52')]['id'];}if(_[_0x3b54('0x71')](_0x43e269['body'][_0x3b54('0x84')])){throw new db[(_0x3b54('0x85'))][(_0x3b54('0x7e'))]('from\x20is\x20mandatory');}if(_[_0x3b54('0x71')](_0x43e269[_0x3b54('0x52')][_0x3b54('0x52')])||_0x43e269[_0x3b54('0x52')][_0x3b54('0x52')]===''){throw new db[(_0x3b54('0x85'))][(_0x3b54('0x7e'))](_0x3b54('0x86'));}if(_[_0x3b54('0x71')](_0x43e269[_0x3b54('0x52')][_0x3b54('0x87')])){throw new db[(_0x3b54('0x85'))][(_0x3b54('0x7e'))](_0x3b54('0x88')+_0x1c0c9b);}if(!_[_0x3b54('0x89')](_0x1c0c9b,_0x43e269[_0x3b54('0x52')]['mapKey'])){throw new db['Sequelize'][(_0x3b54('0x7e'))](_0x3b54('0x8a')+_0x1c0c9b);}_0x27a40b[_0x43e269[_0x3b54('0x52')][_0x3b54('0x87')]]=_0x43e269[_0x3b54('0x52')][_0x3b54('0x84')];})['then'](function(){return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0x43e269['params']['id']},'include':[{'model':db[_0x3b54('0x8b')],'as':_0x3b54('0x8c'),'include':[{'model':db[_0x3b54('0x8d')],'as':_0x3b54('0x8e'),'where':_0x27a40b,'limit':0x1,'order':[[_0x3b54('0x81'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x3b54('0x8f')}]});})['then'](handleEntityNotFound(_0x2806e9,null))[_0x3b54('0x14')](function(_0x1cb4c1){if(_0x1cb4c1&&_0x1cb4c1[_0x3b54('0x8c')]){_0x57cf6d[_0x3b54('0x90')]=_0x1cb4c1;_0x57cf6d[_0x3b54('0x91')]=_0x1cb4c1[_0x3b54('0x8f')];_0x57cf6d['list']=_0x1cb4c1['List'];_0x57cf6d[_0x3b54('0x91')]=_[_0x3b54('0x92')](_0x57cf6d['applications'],[_0x3b54('0x93')],[_0x3b54('0x94')]);if(_0x57cf6d[_0x3b54('0x90')][_0x3b54('0x8f')]){delete _0x57cf6d[_0x3b54('0x90')][_0x3b54('0x8f')];}if(_0x57cf6d[_0x3b54('0x90')][_0x3b54('0x8c')]&&_0x57cf6d['account'][_0x3b54('0x8c')]['Contacts'][_0x3b54('0x38')]){return _0x57cf6d[_0x3b54('0x90')][_0x3b54('0x8c')][_0x3b54('0x8e')][0x0];}var _0xb38c4a=_['defaults'](_0x43e269[_0x3b54('0x52')],{'firstName':_0x43e269[_0x3b54('0x52')][_0x3b54('0x84')],'ListId':_0x1cb4c1[_0x3b54('0x83')]});_0xb38c4a[_0x43e269[_0x3b54('0x52')][_0x3b54('0x87')]]=_0x43e269[_0x3b54('0x52')][_0x3b54('0x84')];return db[_0x3b54('0x8d')][_0x3b54('0x48')](_0xb38c4a,{'fields':_0x5ebd89,'raw':!![]});}})[_0x3b54('0x14')](handleEntityNotFound(_0x2806e9,null))[_0x3b54('0x14')](function(_0x2e3e24){_0x57cf6d[_0x3b54('0x95')]=_0x2e3e24;var _0x45a1de=_0x43e269[_0x3b54('0x52')]['customerIp'];if(_0x43e269[_0x3b54('0x7b')][_0x3b54('0x96')]){_0x45a1de=_0x43e269[_0x3b54('0x7b')][_0x3b54('0x96')];}else if(_0x43e269['headers'][_0x3b54('0x97')]){_0x45a1de=_[_0x3b54('0x98')](_0x43e269[_0x3b54('0x7b')]['x-forwarded-for'][_0x3b54('0x99')](','));}if(_0x2e3e24){var _0x2b4bf4={'ContactId':_0x2e3e24['id'],'ChatWebsiteId':_0x43e269[_0x3b54('0x45')]['id'],'from':(_0x2e3e24[_0x3b54('0x9a')]||'')+'\x20'+(_0x2e3e24[_0x3b54('0x9b')]||''),'customerIp':_0x45a1de,'customerPort':_0x43e269[_0x3b54('0x7b')]['x-real-port']?_0x43e269[_0x3b54('0x7b')][_0x3b54('0x9c')]:null,'referer':_0x43e269[_0x3b54('0x52')][_0x3b54('0x9d')],'browserName':_0x2fbb07['browser'][_0x3b54('0x41')]&&_0x2fbb07[_0x3b54('0x9e')][_0x3b54('0x9f')]?util['format'](_0x3b54('0xa0'),_0x2fbb07[_0x3b54('0x9e')][_0x3b54('0x41')],_0x2fbb07[_0x3b54('0x9e')][_0x3b54('0x9f')]):_0x3b54('0xa1'),'browserVersion':_0x2fbb07[_0x3b54('0x9e')][_0x3b54('0x9f')]||_0x3b54('0xa1'),'osName':util['format'](_0x3b54('0xa0'),_0x2fbb07['os']['name'],_0x2fbb07['os'][_0x3b54('0x9f')]),'osVersion':_0x2fbb07['os'][_0x3b54('0x9f')],'deviceModel':_0x2fbb07[_0x3b54('0xa2')][_0x3b54('0x32')]&&_0x2fbb07[_0x3b54('0xa2')][_0x3b54('0xa3')]?util['format']('%s\x20%s\x20%s',_0x2fbb07[_0x3b54('0xa2')][_0x3b54('0x32')],_0x2fbb07[_0x3b54('0xa2')][_0x3b54('0xa3')],_0x2fbb07['device']['type']):null,'deviceVendor':_0x2fbb07[_0x3b54('0xa2')][_0x3b54('0xa3')],'deviceType':_0x2fbb07[_0x3b54('0xa2')][_0x3b54('0x30')],'formData':JSON['stringify'](_0x43e269[_0x3b54('0x52')])};var _0x3fffe4={'ChatWebsiteId':_0x43e269[_0x3b54('0x45')]['id'],'closed':![]};if(_0x43e269['body']['threadId']){_0x3fffe4[_0x3b54('0xa4')]=_0x43e269[_0x3b54('0x52')][_0x3b54('0xa4')];return db[_0x3b54('0xa5')][_0x3b54('0x4e')]({'where':_0x3fffe4})[_0x3b54('0x14')](function(_0x46b379){if(_0x46b379){return[_0x46b379,![]];}_0x2b4bf4['threadId']=_0x43e269[_0x3b54('0x52')][_0x3b54('0xa4')];_0x2b4bf4[_0x3b54('0xa6')]=_0x43e269[_0x3b54('0x52')][_0x3b54('0xa6')];return db[_0x3b54('0xa5')][_0x3b54('0x48')](_0x2b4bf4)[_0x3b54('0x14')](function(_0x1f6fa4){return[_0x1f6fa4,!![]];});});}_0x3fffe4['ContactId']=_0x2e3e24['id'];if(_0x43e269[_0x3b54('0x52')][_0x3b54('0xa7')]&&_0x43e269[_0x3b54('0x52')]['interaction']['id']){_0x3fffe4['id']=_0x43e269[_0x3b54('0x52')][_0x3b54('0xa7')]['id'];return db[_0x3b54('0xa5')][_0x3b54('0x4e')]({'where':_0x3fffe4})[_0x3b54('0x14')](function(_0x31dae3){if(_0x31dae3){return[_0x31dae3,![]];}return db['ChatInteraction'][_0x3b54('0x48')](_0x2b4bf4)[_0x3b54('0x14')](function(_0x21cd73){return[_0x21cd73,!![]];});});}return db['ChatInteraction'][_0x3b54('0x48')](_0x2b4bf4)[_0x3b54('0x14')](function(_0xb59a47){return[_0xb59a47,!![]];});}})[_0x3b54('0xa8')](function(_0x572cc9,_0x34afa9){if(_0x572cc9){_0x536476=_0x34afa9;if(!_0x34afa9){var _0x2e091e={'from':(_0x57cf6d[_0x3b54('0x95')]['firstName']||'')+'\x20'+(_0x57cf6d[_0x3b54('0x95')][_0x3b54('0x9b')]||'')};if(_0x43e269[_0x3b54('0x52')]['threadId']&&_0x43e269['body'][_0x3b54('0xa9')]&&_0x43e269[_0x3b54('0x52')][_0x3b54('0xa4')]!=_0x43e269[_0x3b54('0x52')][_0x3b54('0xa9')]){_0x2e091e[_0x3b54('0xa4')]=_0x43e269[_0x3b54('0x52')][_0x3b54('0xa9')];}return _0x572cc9[_0x3b54('0x26')](_0x2e091e);}else{return _0x572cc9;}}})[_0x3b54('0x14')](function(_0x33ee13){_0x57cf6d[_0x3b54('0xa7')]=_0x33ee13[_0x3b54('0x4a')]({'plain':!![]});_0x57cf6d['interaction']['created']=_0x536476;if(_0x57cf6d[_0x3b54('0xa7')]['created']){if(_0x57cf6d[_0x3b54('0x90')]['autoclose']){_0x57cf6d[_0x3b54('0x91')][_0x3b54('0xaa')]({'id':0x0,'priority':_0x57cf6d['applications'][_0x3b54('0x38')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x3b54('0xab')});}}return db[_0x3b54('0xac')]['create']({'body':_0x43e269['body'][_0x3b54('0x52')],'ChatWebsiteId':_0x43e269['params']['id'],'ChatInteractionId':_0x33ee13['id'],'direction':'in','ContactId':_0x57cf6d[_0x3b54('0x95')]['id'],'AttachmentId':_0x43e269[_0x3b54('0x52')][_0x3b54('0xad')]});})[_0x3b54('0x14')](function(_0x4ed2ae){_0x57cf6d[_0x3b54('0x1b')]=_0x4ed2ae;if(_0x57cf6d[_0x3b54('0xa7')][_0x3b54('0xae')]){return db[_0x3b54('0xaf')]['find']({'attributes':['id',_0x3b54('0x41')],'where':{'id':_0x57cf6d['interaction'][_0x3b54('0xae')]}})[_0x3b54('0x14')](function(_0x2184e2){if(_0x2184e2){_0x57cf6d[_0x3b54('0x91')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3b54('0xb0'),'appdata':_0x2184e2['name']+','+(_0x57cf6d[_0x3b54('0x90')][_0x3b54('0xb1')]||0xa),'interval':_0x3b54('0xab')});_0x57cf6d[_0x3b54('0xb2')]=!![];}return respondWithRpcPromise(_0x3b54('0xb3'),_0x3b54('0xb4'),_0x57cf6d);});}return respondWithRpcPromise('Start',_0x3b54('0xb4'),_0x57cf6d);})['then'](function(_0x1b0c93){respondWithRpcPromise('EventManager','EventManager',{'event':_0x3b54('0x79'),'message':_0x1b0c93},client9002);return _0x1b0c93;})[_0x3b54('0x14')](respondWithResult(_0x2806e9,null))['catch'](handleError(_0x2806e9,null));};exports[_0x3b54('0xb5')]=function(_0x5edd82,_0x48e5fb){var _0x544f0b,_0x298e13,_0x1e9193;var _0x3a29e3=[];var _0x22984a={};var _0x255abb=_0x5edd82['files']||[];var _0xf16e48=[];var _0x1bb65f;return db[_0x3b54('0x8d')]['describe']()[_0x3b54('0x14')](function(_0x113238){if(!_0x113238){throw new db[(_0x3b54('0x85'))]['ValidationError']('no\x20available\x20attributes');}_0x3a29e3=_['difference'](_[_0x3b54('0x46')](_0x113238),[_0x3b54('0x82'),_0x3b54('0x81'),_0x3b54('0xb6'),'ListId']);if(_0x5edd82[_0x3b54('0x52')]['id']){delete _0x5edd82[_0x3b54('0x52')]['id'];}if(_[_0x3b54('0x71')](_0x5edd82[_0x3b54('0x52')]['from'])){throw _0x48e5fb[_0x3b54('0x1f')](0x1f4)[_0x3b54('0x2a')](new db[(_0x3b54('0x85'))][(_0x3b54('0x7e'))](_0x3b54('0xb7')));}if(_[_0x3b54('0x71')](_0x5edd82[_0x3b54('0x52')][_0x3b54('0x52')])||_0x5edd82[_0x3b54('0x52')][_0x3b54('0x52')]===''){throw _0x48e5fb['status'](0x1f4)[_0x3b54('0x2a')](new db[(_0x3b54('0x85'))][(_0x3b54('0x7e'))](_0x3b54('0x86')));}if(_[_0x3b54('0x71')](_0x5edd82['body'][_0x3b54('0xb8')])){throw _0x48e5fb[_0x3b54('0x1f')](0x1f4)[_0x3b54('0x2a')](new db['Sequelize'][(_0x3b54('0x7e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a29e3));}if(!_[_0x3b54('0x89')](_0x3a29e3,_0x5edd82[_0x3b54('0x52')][_0x3b54('0xb8')])){throw _0x48e5fb[_0x3b54('0x1f')](0x1f4)[_0x3b54('0x2a')](new db[(_0x3b54('0x85'))][(_0x3b54('0x7e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a29e3));}_0x22984a[_0x5edd82[_0x3b54('0x52')][_0x3b54('0xb8')]]=_0x5edd82[_0x3b54('0x52')]['from'];})[_0x3b54('0x14')](function(){return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0x5edd82['params']['id']},'include':[{'model':db[_0x3b54('0x8b')],'as':'List'},{'model':db[_0x3b54('0xb9')],'as':_0x3b54('0xb9')}]});})[_0x3b54('0x14')](handleEntityNotFound(_0x48e5fb,null))[_0x3b54('0x14')](function(_0x23ffa5){if(_0x23ffa5&&_0x23ffa5[_0x3b54('0x8c')]){_0x298e13=_0x23ffa5;var _0x1cd35f=_[_0x3b54('0xb')](_0x5edd82[_0x3b54('0x52')],{'firstName':_0x5edd82[_0x3b54('0x52')][_0x3b54('0x84')],'phone':_0x5edd82[_0x3b54('0x52')]['from'],'ListId':_0x23ffa5['ListId']});_0x1cd35f[_0x5edd82[_0x3b54('0x52')]['mapKeyOffline']]=_0x5edd82['body'][_0x3b54('0x84')];return db[_0x3b54('0x8d')][_0x3b54('0xba')]({'where':_0x22984a,'defaults':_0x1cd35f});}})['spread'](function(_0x46621b){if(_0x46621b){_0x1e9193=_0x46621b;var _0x33218c=fs[_0x3b54('0xbb')](path[_0x3b54('0x69')](config[_0x3b54('0x6d')],'server/files/templates/chatOfflineMessage.ejs'),_0x3b54('0xbc'));var _0x5d3f20=ejs['render'](_0x33218c,{'body':_['toPairs'](_0x5edd82[_0x3b54('0x52')][_0x3b54('0x52')]),'bodyTitle':_0x298e13[_0x3b54('0xbd')]});return db['ChatOfflineMessage'][_0x3b54('0x48')]({'body':_0x5d3f20,'plainBody':htmlToText[_0x3b54('0xbe')](_0x5d3f20),'ContactId':_0x46621b['id'],'ChatWebsiteId':_0x298e13['id']});}})[_0x3b54('0x14')](function(_0x36a817){_0x1bb65f=_0x36a817;if(_0x255abb[_0x3b54('0x38')]){var _0x159465=_0x255abb['map'](function(_0x2e8eab){return{'name':_0x2e8eab['originalname'],'basename':_0x2e8eab[_0x3b54('0x63')],'type':_0x2e8eab['mimetype'],'ChatOfflineMessageId':_0x36a817['id']};});_0xf16e48=_0x159465[_0x3b54('0x33')](_0x11d7ae=>{var _0x485848={'filename':_0x11d7ae[_0x3b54('0x41')],'path':path[_0x3b54('0x69')](config[_0x3b54('0x6d')],_0x3b54('0xbf'),_0x3b54('0xc0'),_0x3b54('0xc1'),_0x3b54('0xc2'),_0x11d7ae['basename'])};return _0x485848;});if(!_0x298e13[_0x3b54('0xc3')]){return db[_0x3b54('0xc4')][_0x3b54('0xc5')](function(_0xf8cf9){return db[_0x3b54('0xc6')][_0x3b54('0xc7')](_0x159465,{'transaction':_0xf8cf9});});}}})['then'](function(){if(_0x1bb65f){_0x544f0b=_0x1bb65f;return db['MailAccount'][_0x3b54('0x58')]({'where':{'service':!![]},'include':[{'model':db[_0x3b54('0xc8')],'as':_0x3b54('0xc9'),'raw':!![],'include':[{'model':db[_0x3b54('0xca')],'as':_0x3b54('0xca'),'raw':!![]}]}]});}})['then'](function(_0x46c1b6){if(_0x46c1b6&&_0x46c1b6[_0x3b54('0xc9')]&&_0x298e13[_0x3b54('0xcb')]&&_0x298e13[_0x3b54('0xcc')]){var _0x350e51=_0x46c1b6['getSmtpOptions']();return respondWithRpcPromise(_0x3b54('0xcd'),'sendMail',{'account':_0x350e51,'message':{'from':util[_0x3b54('0xce')](_0x3b54('0xcf'),_0x46c1b6['name'],_0x46c1b6[_0x3b54('0xd0')]||_0x46c1b6[_0x3b54('0xc9')]['user']),'to':_0x298e13[_0x3b54('0xcc')],'subject':_0x298e13[_0x3b54('0xd1')],'html':_0x544f0b[_0x3b54('0x52')],'attachments':_0xf16e48}},client9003)[_0x3b54('0x14')](function(){return _0x544f0b;})['catch'](function(_0x55342e){logger[_0x3b54('0x19')](_0x55342e);});}})[_0x3b54('0x14')](function(){if(_0x298e13&&_0x298e13[_0x3b54('0xc3')]&&_0x298e13['MailAccountId']){var _0x8c2848=[];if(_0x255abb['length']){_0x8c2848=_0x255abb[_0x3b54('0x33')](function(_0x41c6e4){return{'name':_0x41c6e4[_0x3b54('0xd2')],'basename':_0x41c6e4[_0x3b54('0x63')],'type':_0x41c6e4['mimetype'],'ChatOfflineMessageId':_0x1bb65f['id']};});}var _0x2de7e8;if(!_['isNil'](_0x298e13[_0x3b54('0xd3')])){var _0x529680=_['map'](_0x5edd82['body'],function(_0x309c19){return _0x309c19;});var _0x1a0393=_[_0x3b54('0xd4')](_0x529680)[0x0];var _0x30a061=_[_0x3b54('0xd5')](_0x1a0393,function(_0x33e16c){return _0x33e16c;});_0x2de7e8=_0x30a061[0x1][_0x298e13[_0x3b54('0xd3')]];}var _0x2d399c={'from':_0x1e9193[_0x3b54('0xd0')],'firstName':_0x1e9193[_0x3b54('0x9a')],'lastName':_0x1e9193[_0x3b54('0x9b')],'mapKey':'email','message':{'from':_0x1e9193[_0x3b54('0xd0')],'to':_0x298e13[_0x3b54('0xb9')][_0x3b54('0xd0')],'cc':'','subject':_['isNil'](_0x2de7e8)?_0x298e13[_0x3b54('0xd1')]:_0x2de7e8,'messageId':'','sentAt':new Date(),'attach':_0x8c2848[_0x3b54('0x38')],'attachments':_0x8c2848,'originChannel':_0x3b54('0xd6'),'ChatWebsiteId':_0x298e13['id'],'ChatOfflineMessageId':_0x544f0b['id'],'originTo':_0x298e13['MailAccount'][_0x3b54('0xd0')]},'body':_0x544f0b[_0x3b54('0x52')]};var _0x30e61c={'account':{'id':_0x298e13[_0x3b54('0xd7')]},'body':_0x2d399c,'log':_0x3b54('0xd8')};return respondWithRpcPromise('NotifyMailAccount',_0x3b54('0xd9'),_0x30e61c,client9001)[_0x3b54('0x14')](function(){return _0x544f0b;})[_0x3b54('0x1d')](function(_0x3ef3f9){logger[_0x3b54('0x19')](_0x3ef3f9);});}return;})[_0x3b54('0x14')](function(){if(_0x544f0b){return _0x544f0b;}})['then'](respondWithResult(_0x48e5fb,null))[_0x3b54('0x1d')](function(_0x944e24){logger['error'](_0x3b54('0x1d'),_0x944e24);for(var _0x4b81b3 of _0x255abb){var _0x4afff2=path[_0x3b54('0x69')](config[_0x3b54('0x6d')],_0x3b54('0xbf'),'files',_0x3b54('0xc1'),_0x3b54('0xc2'),_0x4b81b3['filename']);fs_extra[_0x3b54('0xda')](_0x4afff2)[_0x3b54('0x1d')](function(_0x313f2a){logger[_0x3b54('0x19')](_0x3b54('0xdb'),_0x4afff2,_0x313f2a);});}});};exports[_0x3b54('0xdc')]=function(_0xcdca31,_0x19394){return db[_0x3b54('0xa5')][_0x3b54('0x4e')]({'where':{'id':_0xcdca31['params']['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x19394,null))['then'](function(_0x3a3198){if(_0x3a3198){return _0x3a3198[_0x3b54('0xdc')](_0xcdca31['body'][_0x3b54('0x5c')],_[_0x3b54('0xdd')](_0xcdca31[_0x3b54('0x52')],[_0x3b54('0x5c'),'id'])||{});}})[_0x3b54('0x14')](respondWithResult(_0x19394,null))[_0x3b54('0x1d')](handleError(_0x19394,null));};exports[_0x3b54('0xde')]=function(_0x2322ee,_0x38fef8){var _0x539d05={'raw':![],'where':{}};var _0x222a11={};var _0x10e8bd={'count':0x0,'rows':[]};return db[_0x3b54('0x2e')][_0x3b54('0x58')]({'where':{'id':_0x2322ee[_0x3b54('0x45')]['id']}})['then'](handleEntityNotFound(_0x38fef8,null))[_0x3b54('0x14')](function(_0xd4c831){if(_0xd4c831){_0x222a11[_0x3b54('0x32')]=_[_0x3b54('0x46')](db[_0x3b54('0xa5')][_0x3b54('0x2f')]);_0x222a11[_0x3b54('0x34')]=_['keys'](_0x2322ee[_0x3b54('0x34')]);_0x222a11['filters']=_[_0x3b54('0x35')](_0x222a11[_0x3b54('0x32')],_0x222a11['query']);_0x539d05[_0x3b54('0x37')]=_['intersection'](_0x222a11['model'],qs[_0x3b54('0x36')](_0x2322ee[_0x3b54('0x34')][_0x3b54('0x36')]));_0x539d05[_0x3b54('0x37')]=_0x539d05[_0x3b54('0x37')][_0x3b54('0x38')]?_0x539d05[_0x3b54('0x37')]:_0x222a11['model'];if(!_0x2322ee[_0x3b54('0x34')][_0x3b54('0x39')](_0x3b54('0x3a'))){_0x539d05[_0x3b54('0x23')]=qs[_0x3b54('0x23')](_0x2322ee[_0x3b54('0x34')]['limit']);_0x539d05[_0x3b54('0x25')]=qs[_0x3b54('0x25')](_0x2322ee['query'][_0x3b54('0x25')]);}_0x539d05[_0x3b54('0x3b')]=qs['sort'](_0x2322ee['query'][_0x3b54('0x3c')]);_0x539d05[_0x3b54('0x3d')]=qs[_0x3b54('0x3e')](_['pick'](_0x2322ee['query'],_0x222a11[_0x3b54('0x3e')]));_0x539d05[_0x3b54('0x3d')][_0x3b54('0x55')]=_0xd4c831['id'];if(_0x2322ee[_0x3b54('0x34')][_0x3b54('0x3f')]){_0x539d05[_0x3b54('0x3d')]=_['merge'](_0x539d05[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x33')](_0x539d05[_0x3b54('0x37')],function(_0x1b8d0a){var _0x941b1a={};_0x941b1a[_0x1b8d0a]={'$like':'%'+_0x2322ee[_0x3b54('0x34')][_0x3b54('0x3f')]+'%'};return _0x941b1a;})});}_0x539d05=_[_0x3b54('0x40')]({},_0x539d05,_0x2322ee['options']);return db[_0x3b54('0xa5')][_0x3b54('0x24')]({'where':_0x539d05[_0x3b54('0x3d')]})[_0x3b54('0x14')](function(_0x2ed6ed){_0x10e8bd['count']=_0x2ed6ed;if(_0x2322ee['query'][_0x3b54('0x42')]){_0x539d05[_0x3b54('0x43')]=[{'model':db[_0x3b54('0x8d')],'as':_0x3b54('0xdf'),'required':![]},{'model':db[_0x3b54('0xaf')],'as':_0x3b54('0xe0'),'attributes':[_0x3b54('0x41'),_0x3b54('0xe1'),_0x3b54('0xe2')],'required':![]},{'model':db[_0x3b54('0xe3')],'as':_0x3b54('0xe4'),'attributes':['id','name',_0x3b54('0xe5')],'where':_0x2322ee[_0x3b54('0x34')]['tag']?{'id':_0x2322ee['query'][_0x3b54('0xe6')]}:undefined,'required':_0x2322ee['query'][_0x3b54('0xe6')]?!![]:![]}];}return db[_0x3b54('0xa5')][_0x3b54('0x5a')](_0x539d05);})[_0x3b54('0x14')](function(_0x243334){_0x10e8bd[_0x3b54('0x44')]=_0x243334;return _0x10e8bd;});}})['then'](respondWithFilteredResult(_0x38fef8,_0x539d05))[_0x3b54('0x1d')](handleError(_0x38fef8,null));};function iftimePromise(_0x50e0fc,_0x3d1b45){return respondWithRpcPromise(_0x3b54('0xe7'),_0x3b54('0xe8'),{'command':_0x3d1b45[_0x3b54('0xe9')]?util['format'](_0x3b54('0xea'),_0x50e0fc[_0x3b54('0xeb')],_0x3d1b45[_0x3b54('0xe9')]):util[_0x3b54('0xce')](_0x3b54('0xec'),_0x50e0fc[_0x3b54('0xeb')])},client9002)[_0x3b54('0x14')](function(_0x108847){var _0x2a45e3=_0x108847&&_0x108847[_0x3b54('0xed')](_0x3b54('0xee'))>=0x0?!![]:![];logger['info'](_0x3b54('0xef'),_0x3d1b45['id'],_0x50e0fc['id'],_0x50e0fc[_0x3b54('0xeb')],_0x2a45e3?_0x3b54('0xf0'):_0x3b54('0xf1'),_0x3d1b45[_0x3b54('0xe9')]?_0x3d1b45[_0x3b54('0xe9')]:_0x3b54('0xf2'));return _0x2a45e3;})[_0x3b54('0x1d')](function(_0x168252){logger[_0x3b54('0x19')](_0x3b54('0xef'),_0x3d1b45['id'],_0x50e0fc['id'],_0x50e0fc[_0x3b54('0xeb')],util[_0x3b54('0xf3')](_0x168252,{'showHidden':![],'depth':null}),_0x3d1b45['timezone']?_0x3d1b45[_0x3b54('0xe9')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x516d6c,_0x421a22){var _0x577652=0x0;var _0x5803e7=0x0;var _0x4e98b0=![];var _0x2d5412;var _0x44db6a;return db[_0x3b54('0x2e')][_0x3b54('0x4e')]({'where':{'id':_0x516d6c['params']['id']},'include':[{'model':db[_0x3b54('0xf4')],'as':'Interval','include':[{'model':db['Interval'],'as':_0x3b54('0xf5'),'attributes':['id',_0x3b54('0xeb')],'raw':!![]}]}]})[_0x3b54('0x14')](handleEntityNotFound(_0x421a22,null))['then'](function(_0x1c096a){if(_0x1c096a){_0x2d5412=_0x1c096a;return _0x1c096a[_0x3b54('0xf6')]({'raw':!![]});}})[_0x3b54('0x14')](function(_0x43e453){if(_0x2d5412){if(_0x43e453){_0x44db6a=_0x43e453;}}return require(_0x3b54('0x6a'))['getLicense']();})['then'](function(_0x25cef0){if(_0x25cef0){_0x5803e7=_0x25cef0[_0x3b54('0xf7')];_0x4e98b0=_0x25cef0['custom'];}})[_0x3b54('0x14')](function(){return db['ChatInteraction'][_0x3b54('0x24')]({'where':{'closed':![]}});})['then'](function(_0x5f5e08){_0x577652=_0x5f5e08;if(_0x5803e7&&_0x5f5e08>_0x5803e7){return db['License'][_0x3b54('0x58')]({'where':{'id':0x1}})[_0x3b54('0x14')](function(_0x59ae70){if(_0x59ae70){_0x59ae70[_0x3b54('0xf8')](_0x3b54('0xf9'));}});}})[_0x3b54('0x14')](function(){if(_0x2d5412['Interval']&&_0x2d5412[_0x3b54('0xf4')]['Intervals']){var _0x202047=[];for(var _0xb0d41d=0x0;_0xb0d41d<_0x2d5412[_0x3b54('0xf4')][_0x3b54('0xf5')][_0x3b54('0x38')];_0xb0d41d++){var _0x28bdce=_0x2d5412[_0x3b54('0xf4')][_0x3b54('0xf5')][_0xb0d41d]['get']({'plain':!![]});_0x202047['push'](iftimePromise(_0x28bdce,_0x2d5412));}return BPromise[_0x3b54('0xfa')](_0x202047)['then'](function(_0x7b4b9){return _['some'](_0x7b4b9);});}else{return!![];}})[_0x3b54('0x14')](function(_0x5f0a34){var _0x3dd62a=fs['readFileSync'](path[_0x3b54('0x69')](config[_0x3b54('0x6d')],'server/files/chat/iframe.ejs'),_0x3b54('0xbc'));var _0x44e04e={'remote':_0x2d5412['remote'],'query':querystring['stringify'](_[_0x3b54('0x40')](_0x2d5412[_0x3b54('0x4a')]({'plain':!![]}),{'customerIp':_0x516d6c['headers']['x-forwarded-for']||_0x516d6c[_0x3b54('0x7b')][_0x3b54('0xfb')]||_0x516d6c[_0x3b54('0xfc')]['remoteAddress']||_0x516d6c['ip'],'referer':_0x516d6c['headers'][_0x3b54('0x9d')],'openedInteractions':_0x577652,'maxInteractions':_0x5803e7,'virtual':_0x4e98b0[_0x3b54('0xf7')],'online':_0x5f0a34,'custom':_0x4e98b0}))[_0x3b54('0xfd')](/'/g,'\x5c\x27')};_0x421a22[_0x3b54('0x2a')](ejs['render'](Mustache[_0x3b54('0xfe')](_0x3dd62a,_0x44e04e),{'proactiveActions':_0x44db6a,'alignment':_0x2d5412[_0x3b54('0xff')],'verticalAlignment':_0x2d5412['verticalAlignment'],'div_color':_0x2d5412[_0x3b54('0xe5')],'labelText':_0x2d5412['labelText'],'text_color':_0x2d5412['textColor'],'text_button_color':_0x2d5412[_0x3b54('0x100')],'button_color':_0x2d5412[_0x3b54('0x101')],'background_color':_0x2d5412[_0x3b54('0x102')],'hideWhenOffline':_0x2d5412['hideWhenOffline'],'interval':_0x2d5412[_0x3b54('0x103')]}));})[_0x3b54('0x1d')](handleError(_0x421a22,null));};exports[_0x3b54('0x104')]=function(_0x4d8f35,_0x497a90){var _0x2e8a48=_0x4d8f35[_0x3b54('0x45')]['id'];var _0x407b08=_0x4d8f35[_0x3b54('0x52')];var _0x4da3b4=0xc8;var _0x5ce6cf=null;return db[_0x3b54('0xc4')]['transaction']({'isolationLevel':db[_0x3b54('0xc4')][_0x3b54('0x105')]['ISOLATION_LEVELS'][_0x3b54('0x106')]},function(_0x4879f8){return db['ChatWebsite']['findOne']({'where':{'id':_0x2e8a48},'transaction':_0x4879f8})['then'](function(_0x113068){if(_0x113068){return db[_0x3b54('0x107')]['destroy']({'where':{'ChatWebsiteId':_0x2e8a48},'transaction':_0x4879f8})['then'](function(){var _0x5adb10=_[_0x3b54('0x33')](_0x407b08,function(_0x260bdd){_0x260bdd[_0x3b54('0x55')]=_0x2e8a48;return _0x260bdd;});return db[_0x3b54('0x107')]['bulkCreate'](_0x5adb10,{'transaction':_0x4879f8});});}else{_0x4da3b4=0x194;_0x5ce6cf=[];}});})[_0x3b54('0x14')](function(){if(_0x4da3b4!==0x194){return db[_0x3b54('0x107')][_0x3b54('0x108')]({'where':{'ChatWebsiteId':_0x2e8a48},'order':_0x3b54('0x93')})[_0x3b54('0x14')](function(_0x2fdd35){_0x5ce6cf=_0x2fdd35;});}})['catch'](function(_0x11bd6f){_0x4da3b4=0x1f4;logger[_0x3b54('0x19')](_0x11bd6f['stack']);if(_0x11bd6f[_0x3b54('0x41')]){delete _0x11bd6f[_0x3b54('0x41')];}_0x5ce6cf=_0x11bd6f;})[_0x3b54('0x109')](function(){if(_0x5ce6cf===null){_0x497a90[_0x3b54('0x1e')](_0x4da3b4);}else{if(_0x4da3b4===0x1f4){_0x497a90[_0x3b54('0x1f')](_0x4da3b4)[_0x3b54('0x2a')](_0x5ce6cf);}else{_0x497a90[_0x3b54('0x1f')](_0x4da3b4)[_0x3b54('0x21')](_0x5ce6cf);}}});};exports[_0x3b54('0x10a')]=function(_0x57179b,_0x3e49e1){var _0xa116={};var _0x5e6c7e={};var _0x1691a1;var _0xf220cc;return db[_0x3b54('0x2e')][_0x3b54('0x58')]({'where':{'id':_0x57179b[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x3e49e1,null))[_0x3b54('0x14')](function(_0xe00311){if(_0xe00311){_0x1691a1=_0xe00311;_0x5e6c7e[_0x3b54('0x32')]=_[_0x3b54('0x46')](db[_0x3b54('0x107')][_0x3b54('0x2f')]);_0x5e6c7e[_0x3b54('0x34')]=_[_0x3b54('0x46')](_0x57179b[_0x3b54('0x34')]);_0x5e6c7e['filters']=_[_0x3b54('0x35')](_0x5e6c7e[_0x3b54('0x32')],_0x5e6c7e[_0x3b54('0x34')]);_0xa116[_0x3b54('0x37')]=_[_0x3b54('0x35')](_0x5e6c7e[_0x3b54('0x32')],qs[_0x3b54('0x36')](_0x57179b[_0x3b54('0x34')][_0x3b54('0x36')]));_0xa116[_0x3b54('0x37')]=_0xa116[_0x3b54('0x37')][_0x3b54('0x38')]?_0xa116[_0x3b54('0x37')]:_0x5e6c7e[_0x3b54('0x32')];_0xa116['order']=qs[_0x3b54('0x3c')](_0x57179b[_0x3b54('0x34')]['sort']);_0xa116[_0x3b54('0x3d')]=qs[_0x3b54('0x3e')](_[_0x3b54('0x59')](_0x57179b[_0x3b54('0x34')],_0x5e6c7e[_0x3b54('0x3e')]));if(_0x57179b[_0x3b54('0x34')][_0x3b54('0x3f')]){_0xa116[_0x3b54('0x3d')]=_[_0x3b54('0x40')](_0xa116[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x33')](_0xa116[_0x3b54('0x37')],function(_0x340dea){var _0x5ab343={};_0x5ab343[_0x340dea]={'$like':'%'+_0x57179b['query'][_0x3b54('0x3f')]+'%'};return _0x5ab343;})});}_0xa116=_[_0x3b54('0x40')]({},_0xa116,_0x57179b[_0x3b54('0x47')]);return _0x1691a1[_0x3b54('0x10a')](_0xa116);}})[_0x3b54('0x14')](function(_0xbdf26){if(_0xbdf26){_0xf220cc=_0xbdf26[_0x3b54('0x38')];if(!_0x57179b[_0x3b54('0x34')][_0x3b54('0x39')](_0x3b54('0x3a'))){_0xa116[_0x3b54('0x23')]=qs['limit'](_0x57179b[_0x3b54('0x34')][_0x3b54('0x23')]);_0xa116[_0x3b54('0x25')]=qs[_0x3b54('0x25')](_0x57179b[_0x3b54('0x34')]['offset']);}return _0x1691a1[_0x3b54('0x10a')](_0xa116);}})[_0x3b54('0x14')](function(_0x9c46a6){if(_0x9c46a6){return _0x9c46a6?{'count':_0xf220cc,'rows':_0x9c46a6}:null;}})[_0x3b54('0x14')](respondWithResult(_0x3e49e1,null))[_0x3b54('0x1d')](handleError(_0x3e49e1,null));};exports['addProactiveActions']=function(_0x27f6fc,_0x457c3b){return db[_0x3b54('0x10b')][_0x3b54('0x4e')]({'where':{'id':_0x27f6fc[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x457c3b,null))[_0x3b54('0x14')](function(_0x4ba6e9){if(_0x4ba6e9){return _0x4ba6e9[_0x3b54('0x10c')](_0x27f6fc['body'][_0x3b54('0x5c')],_[_0x3b54('0xdd')](_0x27f6fc[_0x3b54('0x52')],['ids','id'])||{});}})['then'](respondWithResult(_0x457c3b,null))[_0x3b54('0x1d')](handleError(_0x457c3b,null));};exports[_0x3b54('0xf6')]=function(_0x259444,_0x5923c3){var _0x4abf64={};var _0x10b788={};var _0x5cfe78;var _0x5c31bc;return db['ChatWebsite'][_0x3b54('0x58')]({'where':{'id':_0x259444['params']['id']}})['then'](handleEntityNotFound(_0x5923c3,null))[_0x3b54('0x14')](function(_0xb3f0c1){if(_0xb3f0c1){_0x5cfe78=_0xb3f0c1;_0x10b788[_0x3b54('0x32')]=_[_0x3b54('0x46')](db[_0x3b54('0x10d')][_0x3b54('0x2f')]);_0x10b788[_0x3b54('0x34')]=_[_0x3b54('0x46')](_0x259444[_0x3b54('0x34')]);_0x10b788[_0x3b54('0x3e')]=_['intersection'](_0x10b788[_0x3b54('0x32')],_0x10b788[_0x3b54('0x34')]);_0x4abf64[_0x3b54('0x37')]=_[_0x3b54('0x35')](_0x10b788[_0x3b54('0x32')],qs[_0x3b54('0x36')](_0x259444['query'][_0x3b54('0x36')]));_0x4abf64[_0x3b54('0x37')]=_0x4abf64[_0x3b54('0x37')][_0x3b54('0x38')]?_0x4abf64[_0x3b54('0x37')]:_0x10b788[_0x3b54('0x32')];_0x4abf64[_0x3b54('0x3b')]=qs[_0x3b54('0x3c')](_0x259444[_0x3b54('0x34')]['sort']);_0x4abf64['where']=qs['filters'](_['pick'](_0x259444[_0x3b54('0x34')],_0x10b788['filters']));if(_0x259444[_0x3b54('0x34')][_0x3b54('0x3f')]){_0x4abf64['where']=_['merge'](_0x4abf64[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x33')](_0x4abf64['attributes'],function(_0x36dfb9){var _0x40f9b9={};_0x40f9b9[_0x36dfb9]={'$like':'%'+_0x259444[_0x3b54('0x34')]['filter']+'%'};return _0x40f9b9;})});}_0x4abf64=_['merge']({},_0x4abf64,_0x259444['options']);return _0x5cfe78[_0x3b54('0xf6')](_0x4abf64);}})['then'](function(_0x476a54){if(_0x476a54){_0x5c31bc=_0x476a54[_0x3b54('0x38')];if(!_0x259444[_0x3b54('0x34')][_0x3b54('0x39')](_0x3b54('0x3a'))){_0x4abf64[_0x3b54('0x23')]=qs[_0x3b54('0x23')](_0x259444[_0x3b54('0x34')]['limit']);_0x4abf64[_0x3b54('0x25')]=qs[_0x3b54('0x25')](_0x259444[_0x3b54('0x34')][_0x3b54('0x25')]);}return _0x5cfe78['getProactiveActions'](_0x4abf64);}})[_0x3b54('0x14')](function(_0x5c1c07){if(_0x5c1c07){return _0x5c1c07?{'count':_0x5c31bc,'rows':_0x5c1c07}:null;}})['then'](respondWithResult(_0x5923c3,null))[_0x3b54('0x1d')](handleError(_0x5923c3,null));};exports['getFields']=function(_0x19f474,_0x1234ad){var _0x482b89=_0x19f474['query'][_0x3b54('0x10e')]===_0x3b54('0x10f')?'offlineForm':'onlineForm';return db[_0x3b54('0x2e')]['find']({'attributes':['id',_0x482b89],'where':{'id':_0x19f474[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x1234ad,null))[_0x3b54('0x14')](function(_0x48f26a){if(_0x48f26a){var _0x3fb1d6=_0x48f26a[_0x482b89];var _0x4ddbaa=_0x3fb1d6&&_0x3fb1d6[_0x3b54('0x110')]?_0x3fb1d6[_0x3b54('0x110')]:[];_0x1234ad[_0x3b54('0x2a')]({'fromKey':_[_0x3b54('0x71')](_0x3fb1d6[_0x3b54('0x111')])?undefined:_0x3fb1d6['fromKey'],'count':_0x4ddbaa[_0x3b54('0x38')],'rows':_0x4ddbaa});}})['catch'](handleError(_0x1234ad,null));};exports[_0x3b54('0x112')]=function(_0x27939a,_0x3c22c5){var _0x247139={'raw':![],'where':{}};var _0x3adfee={};var _0x5a31b6={'count':0x0,'rows':[]};return db[_0x3b54('0x2e')][_0x3b54('0x58')]({'where':{'id':_0x27939a[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x3c22c5,null))[_0x3b54('0x14')](function(_0x257458){if(_0x257458){_0x3adfee[_0x3b54('0x32')]=_[_0x3b54('0x46')](db['ChatOfflineMessage'][_0x3b54('0x2f')]);_0x3adfee[_0x3b54('0x34')]=_[_0x3b54('0x46')](_0x27939a[_0x3b54('0x34')]);_0x3adfee[_0x3b54('0x3e')]=_[_0x3b54('0x35')](_0x3adfee[_0x3b54('0x32')],_0x3adfee['query']);_0x247139[_0x3b54('0x37')]=_['intersection'](_0x3adfee[_0x3b54('0x32')],qs[_0x3b54('0x36')](_0x27939a[_0x3b54('0x34')][_0x3b54('0x36')]));_0x247139['attributes']=_0x247139[_0x3b54('0x37')][_0x3b54('0x38')]?_0x247139['attributes']:_0x3adfee['model'];if(!_0x27939a[_0x3b54('0x34')][_0x3b54('0x39')](_0x3b54('0x3a'))){_0x247139['limit']=qs[_0x3b54('0x23')](_0x27939a[_0x3b54('0x34')][_0x3b54('0x23')]);_0x247139['offset']=qs[_0x3b54('0x25')](_0x27939a[_0x3b54('0x34')][_0x3b54('0x25')]);}_0x247139[_0x3b54('0x3b')]=qs[_0x3b54('0x3c')](_0x27939a[_0x3b54('0x34')][_0x3b54('0x3c')]);_0x247139['where']=qs[_0x3b54('0x3e')](_[_0x3b54('0x59')](_0x27939a[_0x3b54('0x34')],_0x3adfee['filters']));_0x247139[_0x3b54('0x3d')]['ChatWebsiteId']=_0x257458['id'];if(_0x27939a[_0x3b54('0x34')][_0x3b54('0x3f')]){_0x247139['where']=_[_0x3b54('0x40')](_0x247139[_0x3b54('0x3d')],{'$or':_['map'](_0x247139['attributes'],function(_0x50ff70){var _0x45f5c2={};_0x45f5c2[_0x50ff70]={'$like':'%'+_0x27939a[_0x3b54('0x34')][_0x3b54('0x3f')]+'%'};return _0x45f5c2;})});}_0x247139=_[_0x3b54('0x40')]({},_0x247139,_0x27939a[_0x3b54('0x47')]);return db['ChatOfflineMessage']['count']({'where':_0x247139[_0x3b54('0x3d')]})[_0x3b54('0x14')](function(_0x19dceb){_0x5a31b6[_0x3b54('0x24')]=_0x19dceb;if(_0x27939a[_0x3b54('0x34')][_0x3b54('0x42')]){_0x247139['include']=[{'all':!![]}];}else{_0x247139['include']=[{'model':db[_0x3b54('0x8d')],'as':_0x3b54('0xdf'),'required':![]},{'model':db[_0x3b54('0xc6')],'as':_0x3b54('0x113'),'required':![]}];}return db[_0x3b54('0x114')]['findAll'](_0x247139);})[_0x3b54('0x14')](function(_0x15287d){_0x5a31b6[_0x3b54('0x44')]=_0x15287d;return _0x5a31b6;});}})['then'](respondWithFilteredResult(_0x3c22c5,_0x247139))['catch'](handleError(_0x3c22c5,null));};exports[_0x3b54('0x115')]=function(_0x16a2f2,_0x49690d){return db[_0x3b54('0x2e')]['find']({'where':{'id':_0x16a2f2[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x49690d,null))[_0x3b54('0x14')](function(_0x313b2b){if(_0x313b2b){return _0x313b2b[_0x3b54('0x115')](_0x16a2f2[_0x3b54('0x52')][_0x3b54('0x5c')],_[_0x3b54('0xdd')](_0x16a2f2['body'],[_0x3b54('0x5c'),'id'])||{})[_0x3b54('0xa8')](function(_0x5a9a1b){for(var _0x292b1a=0x0;_0x292b1a<_0x16a2f2[_0x3b54('0x52')][_0x3b54('0x5c')][_0x3b54('0x38')];_0x292b1a+=0x1){socket[_0x3b54('0x116')](_0x3b54('0x117'),{'UserId':Number(_0x16a2f2['body'][_0x3b54('0x5c')][_0x292b1a]),'ChatWebsiteId':Number(_0x16a2f2[_0x3b54('0x45')]['id'])});}return _0x5a9a1b;});}})[_0x3b54('0x14')](respondWithResult(_0x49690d,null))[_0x3b54('0x1d')](handleError(_0x49690d,null));};exports[_0x3b54('0x118')]=function(_0x2a60e7,_0x4ca7e6){return db['ChatWebsite']['find']({'where':{'id':_0x2a60e7[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x4ca7e6,null))[_0x3b54('0x14')](function(_0x4028c5){if(_0x4028c5){return _0x4028c5['removeAgents'](_0x2a60e7[_0x3b54('0x34')][_0x3b54('0x5c')])['then'](function(){if(_['isArray'](_0x2a60e7[_0x3b54('0x34')][_0x3b54('0x5c')])){for(var _0x217b82=0x0;_0x217b82<_0x2a60e7[_0x3b54('0x34')][_0x3b54('0x5c')][_0x3b54('0x38')];_0x217b82+=0x1){socket[_0x3b54('0x116')](_0x3b54('0x119'),{'UserId':Number(_0x2a60e7[_0x3b54('0x34')][_0x3b54('0x5c')][_0x217b82]),'ChatWebsiteId':Number(_0x2a60e7[_0x3b54('0x45')]['id'])});}}else{socket[_0x3b54('0x116')](_0x3b54('0x119'),{'UserId':Number(_0x2a60e7[_0x3b54('0x34')]['ids']),'ChatWebsiteId':Number(_0x2a60e7[_0x3b54('0x45')]['id'])});}});}})[_0x3b54('0x14')](respondWithStatusCode(_0x4ca7e6,null))['catch'](handleError(_0x4ca7e6,null));};exports[_0x3b54('0x11a')]=function(_0xbc507d,_0x276ae4){var _0x18bd3b={};var _0x2e50e7={};var _0x39b391;var _0x357fa3;return db[_0x3b54('0x2e')]['findOne']({'where':{'id':_0xbc507d[_0x3b54('0x45')]['id']}})[_0x3b54('0x14')](handleEntityNotFound(_0x276ae4,null))['then'](function(_0x25fb8b){if(_0x25fb8b){_0x39b391=_0x25fb8b;_0x2e50e7[_0x3b54('0x32')]=_[_0x3b54('0x46')](db[_0x3b54('0xaf')][_0x3b54('0x2f')]);_0x2e50e7[_0x3b54('0x34')]=_[_0x3b54('0x46')](_0xbc507d[_0x3b54('0x34')]);_0x2e50e7[_0x3b54('0x3e')]=_['intersection'](_0x2e50e7[_0x3b54('0x32')],_0x2e50e7['query']);_0x18bd3b[_0x3b54('0x37')]=_[_0x3b54('0x35')](_0x2e50e7[_0x3b54('0x32')],qs['fields'](_0xbc507d[_0x3b54('0x34')][_0x3b54('0x36')]));_0x18bd3b[_0x3b54('0x37')]=_0x18bd3b[_0x3b54('0x37')][_0x3b54('0x38')]?_0x18bd3b[_0x3b54('0x37')]:_0x2e50e7[_0x3b54('0x32')];_0x18bd3b[_0x3b54('0x3b')]=qs['sort'](_0xbc507d[_0x3b54('0x34')][_0x3b54('0x3c')]);_0x18bd3b[_0x3b54('0x3d')]=qs[_0x3b54('0x3e')](_[_0x3b54('0x59')](_0xbc507d[_0x3b54('0x34')],_0x2e50e7[_0x3b54('0x3e')]));if(_0xbc507d['query']['filter']){_0x18bd3b[_0x3b54('0x3d')]=_[_0x3b54('0x40')](_0x18bd3b[_0x3b54('0x3d')],{'$or':_[_0x3b54('0x33')](_0x18bd3b[_0x3b54('0x37')],function(_0x4f2b34){var _0x32e627={};_0x32e627[_0x4f2b34]={'$like':'%'+_0xbc507d[_0x3b54('0x34')][_0x3b54('0x3f')]+'%'};return _0x32e627;})});}_0x18bd3b=_[_0x3b54('0x40')]({},_0x18bd3b,_0xbc507d[_0x3b54('0x47')]);return _0x39b391['getAgents'](_0x18bd3b);}})[_0x3b54('0x14')](function(_0xdd8397){if(_0xdd8397){_0x357fa3=_0xdd8397[_0x3b54('0x38')];if(!_0xbc507d[_0x3b54('0x34')]['hasOwnProperty'](_0x3b54('0x3a'))){_0x18bd3b[_0x3b54('0x23')]=qs[_0x3b54('0x23')](_0xbc507d['query'][_0x3b54('0x23')]);_0x18bd3b[_0x3b54('0x25')]=qs[_0x3b54('0x25')](_0xbc507d[_0x3b54('0x34')][_0x3b54('0x25')]);}return _0x39b391[_0x3b54('0x11a')](_0x18bd3b);}})[_0x3b54('0x14')](function(_0x53bc82){if(_0x53bc82){return _0x53bc82?{'count':_0x357fa3,'rows':_0x53bc82}:null;}})[_0x3b54('0x14')](respondWithResult(_0x276ae4,null))[_0x3b54('0x1d')](handleError(_0x276ae4,null));}; \ No newline at end of file +var _0xca49=['bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','undefined','limit','count','json','update','ChatWebsites','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','map','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','Pause','includeAll','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','catch','destroy','describe','ChatWebsiteId','Disposition','getDispositions','keys','pick','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','getLicense','custom','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','asc','Contacts','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','ContactId','interaction','spread','messageId','close','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','stringify','x-real-ip','connection','remoteAddress','referer','virtual','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','User'];(function(_0x4efd4f,_0x285f74){var _0x4533ad=function(_0x2cd9e0){while(--_0x2cd9e0){_0x4efd4f['push'](_0x4efd4f['shift']());}};_0x4533ad(++_0x285f74);}(_0xca49,0x12e));var _0x9ca4=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xca49[_0x228641];return _0x5d5d78;};'use strict';var BPromise=require(_0x9ca4('0x0'));var Mustache=require(_0x9ca4('0x1'));var util=require(_0x9ca4('0x2'));var path=require(_0x9ca4('0x3'));var ejs=require(_0x9ca4('0x4'));var fs=require('fs');var fs_extra=require(_0x9ca4('0x5'));var _=require(_0x9ca4('0x6'));var querystring=require(_0x9ca4('0x7'));var Redis=require(_0x9ca4('0x8'));var qs=require(_0x9ca4('0x9'));var logger=require(_0x9ca4('0xa'))(_0x9ca4('0xb'));var config=require(_0x9ca4('0xc'));var db=require(_0x9ca4('0xd'))['db'];config[_0x9ca4('0xe')]=_['defaults'](config[_0x9ca4('0xe')],{'host':_0x9ca4('0xf'),'port':0x18eb});var socket=require(_0x9ca4('0x10'))(new Redis(config[_0x9ca4('0xe')]));require(_0x9ca4('0x11'))[_0x9ca4('0x12')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x9ca4('0x13'));var client=jayson[_0x9ca4('0x14')][_0x9ca4('0x15')]({'port':0x232c});var client9002=jayson[_0x9ca4('0x14')]['http']({'port':0x232a});var client9003=jayson[_0x9ca4('0x14')]['http']({'port':0x232b});var client9001=jayson[_0x9ca4('0x14')][_0x9ca4('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x535001,_0x448f9d,_0x597d54,_0x3f03c2){return new BPromise(function(_0xa469ce,_0x2c70ec){var _0x341dde=_0x3f03c2||client;return _0x341dde[_0x9ca4('0x16')](_0x535001,_0x597d54)[_0x9ca4('0x17')](function(_0x5858d7){logger[_0x9ca4('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x448f9d,_0x9ca4('0x19'));logger[_0x9ca4('0x1a')](_0x9ca4('0x1b'),_0x448f9d,_0x9ca4('0x19'),JSON['stringify'](_0x5858d7));if(_0x5858d7[_0x9ca4('0x1c')]){if(_0x5858d7[_0x9ca4('0x1c')][_0x9ca4('0x1d')]===0x1f4){logger['error'](_0x9ca4('0x1e'),_0x448f9d,_0x5858d7[_0x9ca4('0x1c')][_0x9ca4('0x1f')]);return _0x2c70ec(_0x5858d7['error']['message']);}logger[_0x9ca4('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x448f9d,_0x5858d7[_0x9ca4('0x1c')]['message']);return _0xa469ce(_0x5858d7[_0x9ca4('0x1c')]['message']);}else{logger[_0x9ca4('0x18')](_0x9ca4('0x1e'),_0x448f9d,_0x9ca4('0x19'));_0xa469ce(_0x5858d7[_0x9ca4('0x20')]['message']);}})['catch'](function(_0x2b9749){logger[_0x9ca4('0x1c')](_0x9ca4('0x1e'),_0x448f9d,_0x2b9749);_0x2c70ec(_0x2b9749);});});}function respondWithStatusCode(_0x41634d,_0x170dd2){_0x170dd2=_0x170dd2||0xcc;return function(_0x4816c1){if(_0x4816c1){return _0x41634d[_0x9ca4('0x21')](_0x170dd2);}return _0x41634d[_0x9ca4('0x22')](_0x170dd2)[_0x9ca4('0x23')]();};}function respondWithResult(_0x54f4c6,_0x5dc9f0){_0x5dc9f0=_0x5dc9f0||0xc8;return function(_0x30c495){if(_0x30c495){return _0x54f4c6['status'](_0x5dc9f0)['json'](_0x30c495);}};}function respondWithFilteredResult(_0x4c9ace,_0x1b1a08){return function(_0x279be3){if(_0x279be3){var _0x2512cb=typeof _0x1b1a08[_0x9ca4('0x24')]===_0x9ca4('0x25')&&typeof _0x1b1a08[_0x9ca4('0x26')]==='undefined';var _0x56e510=_0x279be3[_0x9ca4('0x27')];var _0x1276e5=_0x2512cb?0x0:_0x1b1a08['offset'];var _0x124eb8=_0x2512cb?_0x279be3['count']:_0x1b1a08[_0x9ca4('0x24')]+_0x1b1a08[_0x9ca4('0x26')];var _0x591e60;if(_0x124eb8>=_0x56e510){_0x124eb8=_0x56e510;_0x591e60=0xc8;}else{_0x591e60=0xce;}_0x4c9ace[_0x9ca4('0x22')](_0x591e60);return _0x4c9ace['set']('Content-Range',_0x1276e5+'-'+_0x124eb8+'/'+_0x56e510)[_0x9ca4('0x28')](_0x279be3);}return null;};}function saveUpdates(_0x1490e5){return function(_0x3ae4df){if(_0x3ae4df){return _0x3ae4df[_0x9ca4('0x29')](_0x1490e5)[_0x9ca4('0x17')](function(_0x25f6fa){return _0x25f6fa;});}return null;};}function removeEntity(_0x232dfd){return function(_0x2ae28e){if(_0x2ae28e){return _0x2ae28e['destroy']()[_0x9ca4('0x17')](function(){var _0x5de20a=_0x2ae28e['get']({'plain':!![]});var _0x22b323=_0x9ca4('0x2a');return db[_0x9ca4('0x2b')]['destroy']({'where':{'type':_0x22b323,'resourceId':_0x5de20a['id']}})[_0x9ca4('0x17')](function(){return _0x2ae28e;});})[_0x9ca4('0x17')](function(){_0x232dfd[_0x9ca4('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c64cb){return function(_0xc105be){if(!_0xc105be){_0x5c64cb[_0x9ca4('0x21')](0x194);}return _0xc105be;};}function handleError(_0x93f20,_0x527461){_0x527461=_0x527461||0x1f4;return function(_0x577986){logger[_0x9ca4('0x1c')](_0x577986[_0x9ca4('0x2c')]);if(_0x577986['name']){delete _0x577986[_0x9ca4('0x2d')];}_0x93f20['status'](_0x527461)[_0x9ca4('0x2e')](_0x577986);};}exports[_0x9ca4('0x2f')]=function(_0x31e054,_0x59381e){var _0xa2d4ac={'include':[{'model':db['Pause'],'as':_0x9ca4('0x30')}]},_0x3c30b4={},_0x3016d1={'count':0x0,'rows':[]};var _0x3b2552=_['map'](db[_0x9ca4('0x31')][_0x9ca4('0x32')],function(_0x462ca1){return{'name':_0x462ca1[_0x9ca4('0x33')],'type':_0x462ca1['type'][_0x9ca4('0x34')]};});_0x3c30b4['model']=_[_0x9ca4('0x35')](_0x3b2552,_0x9ca4('0x2d'));_0x3c30b4['query']=_['keys'](_0x31e054['query']);_0x3c30b4['filters']=_[_0x9ca4('0x36')](_0x3c30b4['model'],_0x3c30b4[_0x9ca4('0x37')]);_0xa2d4ac[_0x9ca4('0x38')]=_[_0x9ca4('0x36')](_0x3c30b4[_0x9ca4('0x39')],qs[_0x9ca4('0x3a')](_0x31e054[_0x9ca4('0x37')]['fields']));_0xa2d4ac['attributes']=_0xa2d4ac[_0x9ca4('0x38')][_0x9ca4('0x3b')]?_0xa2d4ac[_0x9ca4('0x38')]:_0x3c30b4[_0x9ca4('0x39')];if(!_0x31e054[_0x9ca4('0x37')][_0x9ca4('0x3c')](_0x9ca4('0x3d'))){_0xa2d4ac['limit']=qs['limit'](_0x31e054[_0x9ca4('0x37')]['limit']);_0xa2d4ac[_0x9ca4('0x24')]=qs[_0x9ca4('0x24')](_0x31e054['query']['offset']);}_0xa2d4ac[_0x9ca4('0x3e')]=qs[_0x9ca4('0x3f')](_0x31e054['query'][_0x9ca4('0x3f')]);_0xa2d4ac[_0x9ca4('0x40')]=qs[_0x9ca4('0x41')](_['pick'](_0x31e054[_0x9ca4('0x37')],_0x3c30b4[_0x9ca4('0x41')]),_0x3b2552);if(_0x31e054[_0x9ca4('0x37')]['filter']){_0xa2d4ac['where']=_[_0x9ca4('0x42')](_0xa2d4ac['where'],{'$or':_[_0x9ca4('0x35')](_0x3b2552,function(_0x269e5c){if(_0x269e5c[_0x9ca4('0x43')]!==_0x9ca4('0x44')){var _0x209721={};_0x209721[_0x269e5c[_0x9ca4('0x2d')]]={'$like':'%'+_0x31e054['query'][_0x9ca4('0x45')]+'%'};return _0x209721;}})});}_0xa2d4ac=_[_0x9ca4('0x42')]({},_0xa2d4ac,_0x31e054[_0x9ca4('0x46')]);var _0x1eca7f={'where':_0xa2d4ac[_0x9ca4('0x40')]};return db[_0x9ca4('0x31')]['count'](_0x1eca7f)[_0x9ca4('0x17')](function(_0x19d4a8){_0x3016d1[_0x9ca4('0x27')]=_0x19d4a8;if(_0x31e054[_0x9ca4('0x37')]['includeAll']){_0xa2d4ac[_0x9ca4('0x47')]=[{'all':!![]}];}return db['ChatWebsite'][_0x9ca4('0x48')](_0xa2d4ac);})['then'](function(_0x2d3008){_0x3016d1[_0x9ca4('0x49')]=_0x2d3008;return _0x3016d1;})['then'](respondWithFilteredResult(_0x59381e,_0xa2d4ac))['catch'](handleError(_0x59381e,null));};exports[_0x9ca4('0x4a')]=function(_0xeea767,_0x395979){var _0xe1ef25={'raw':![],'where':{'id':_0xeea767[_0x9ca4('0x4b')]['id']},'include':[{'model':db[_0x9ca4('0x4c')],'as':_0x9ca4('0x30')}]},_0x5689f5={};_0x5689f5[_0x9ca4('0x39')]=_['keys'](db[_0x9ca4('0x31')][_0x9ca4('0x32')]);_0x5689f5[_0x9ca4('0x37')]=_['keys'](_0xeea767[_0x9ca4('0x37')]);_0x5689f5[_0x9ca4('0x41')]=_[_0x9ca4('0x36')](_0x5689f5['model'],_0x5689f5[_0x9ca4('0x37')]);_0xe1ef25['attributes']=_[_0x9ca4('0x36')](_0x5689f5['model'],qs[_0x9ca4('0x3a')](_0xeea767[_0x9ca4('0x37')]['fields']));_0xe1ef25[_0x9ca4('0x38')]=_0xe1ef25[_0x9ca4('0x38')][_0x9ca4('0x3b')]?_0xe1ef25[_0x9ca4('0x38')]:_0x5689f5[_0x9ca4('0x39')];if(_0xeea767[_0x9ca4('0x37')][_0x9ca4('0x4d')]){_0xe1ef25[_0x9ca4('0x47')]=[{'all':!![]}];}_0xe1ef25=_['merge']({},_0xe1ef25,_0xeea767[_0x9ca4('0x46')]);return db[_0x9ca4('0x31')][_0x9ca4('0x4e')](_0xe1ef25)[_0x9ca4('0x17')](handleEntityNotFound(_0x395979,null))[_0x9ca4('0x17')](respondWithResult(_0x395979,null))['catch'](handleError(_0x395979,null));};exports[_0x9ca4('0x4f')]=function(_0x5a4703,_0x5b10a2){return db['ChatWebsite'][_0x9ca4('0x4f')](_0x5a4703[_0x9ca4('0x50')],{})['then'](function(_0x2e04ca){var _0x5b897e=_0x5a4703[_0x9ca4('0x51')]['get']({'plain':!![]});if(!_0x5b897e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b897e[_0x9ca4('0x52')]===_0x9ca4('0x51')){var _0x35c26f=_0x2e04ca[_0x9ca4('0x53')]({'plain':!![]});var _0x18daeb=_0x9ca4('0x2a');return db[_0x9ca4('0x54')][_0x9ca4('0x4e')]({'where':{'name':_0x18daeb,'userProfileId':_0x5b897e[_0x9ca4('0x55')]},'raw':!![]})['then'](function(_0x3da398){if(_0x3da398&&_0x3da398[_0x9ca4('0x56')]===0x0){return db['UserProfileResource'][_0x9ca4('0x4f')]({'name':_0x35c26f[_0x9ca4('0x2d')],'resourceId':_0x35c26f['id'],'type':_0x3da398['name'],'sectionId':_0x3da398['id']},{})[_0x9ca4('0x17')](function(){return _0x2e04ca;});}else{return _0x2e04ca;}})['catch'](function(_0xc08c23){logger[_0x9ca4('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc08c23);throw _0xc08c23;});}return _0x2e04ca;})[_0x9ca4('0x17')](respondWithResult(_0x5b10a2,0xc9))[_0x9ca4('0x57')](handleError(_0x5b10a2,null));};exports[_0x9ca4('0x29')]=function(_0x23cfdb,_0x35d93a){if(_0x23cfdb[_0x9ca4('0x50')]['id']){delete _0x23cfdb[_0x9ca4('0x50')]['id'];}return db['ChatWebsite'][_0x9ca4('0x4e')]({'where':{'id':_0x23cfdb[_0x9ca4('0x4b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9ca4('0x17')](handleEntityNotFound(_0x35d93a,null))[_0x9ca4('0x17')](saveUpdates(_0x23cfdb[_0x9ca4('0x50')],null))[_0x9ca4('0x17')](respondWithResult(_0x35d93a,null))[_0x9ca4('0x57')](handleError(_0x35d93a,null));};exports[_0x9ca4('0x58')]=function(_0x57a1c3,_0x308c1d){return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x57a1c3[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x308c1d,null))[_0x9ca4('0x17')](removeEntity(_0x308c1d,null))[_0x9ca4('0x57')](handleError(_0x308c1d,null));};exports[_0x9ca4('0x59')]=function(_0x113ac1,_0x1366fc){return db[_0x9ca4('0x31')][_0x9ca4('0x59')]()[_0x9ca4('0x17')](respondWithResult(_0x1366fc,null))['catch'](handleError(_0x1366fc,null));};exports['addDisposition']=function(_0x3766c3,_0x587a1d){if(_0x3766c3['body']['id']){delete _0x3766c3[_0x9ca4('0x50')]['id'];}return db['ChatWebsite'][_0x9ca4('0x4e')]({'where':{'id':_0x3766c3[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x587a1d,null))[_0x9ca4('0x17')](function(_0x5207da){if(_0x5207da){_0x3766c3['body'][_0x9ca4('0x5a')]=_0x5207da['id'];return db[_0x9ca4('0x5b')][_0x9ca4('0x4f')](_0x3766c3[_0x9ca4('0x50')]);}})[_0x9ca4('0x17')](respondWithResult(_0x587a1d,null))[_0x9ca4('0x57')](handleError(_0x587a1d,null));};exports[_0x9ca4('0x5c')]=function(_0x18b624,_0x482e35){var _0x1e3cb4={'raw':![],'where':{}};var _0x2396c3={};var _0x17b065={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x18b624[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x482e35,null))[_0x9ca4('0x17')](function(_0x55990d){if(_0x55990d){_0x2396c3[_0x9ca4('0x39')]=_[_0x9ca4('0x5d')](db[_0x9ca4('0x5b')][_0x9ca4('0x32')]);_0x2396c3['query']=_[_0x9ca4('0x5d')](_0x18b624['query']);_0x2396c3[_0x9ca4('0x41')]=_['intersection'](_0x2396c3[_0x9ca4('0x39')],_0x2396c3['query']);_0x1e3cb4[_0x9ca4('0x38')]=_[_0x9ca4('0x36')](_0x2396c3[_0x9ca4('0x39')],qs[_0x9ca4('0x3a')](_0x18b624[_0x9ca4('0x37')][_0x9ca4('0x3a')]));_0x1e3cb4['attributes']=_0x1e3cb4[_0x9ca4('0x38')]['length']?_0x1e3cb4[_0x9ca4('0x38')]:_0x2396c3[_0x9ca4('0x39')];if(!_0x18b624[_0x9ca4('0x37')][_0x9ca4('0x3c')](_0x9ca4('0x3d'))){_0x1e3cb4[_0x9ca4('0x26')]=qs[_0x9ca4('0x26')](_0x18b624[_0x9ca4('0x37')]['limit']);_0x1e3cb4[_0x9ca4('0x24')]=qs[_0x9ca4('0x24')](_0x18b624[_0x9ca4('0x37')]['offset']);}_0x1e3cb4[_0x9ca4('0x3e')]=qs['sort'](_0x18b624[_0x9ca4('0x37')][_0x9ca4('0x3f')]);_0x1e3cb4[_0x9ca4('0x40')]=qs[_0x9ca4('0x41')](_[_0x9ca4('0x5e')](_0x18b624[_0x9ca4('0x37')],_0x2396c3['filters']));_0x1e3cb4[_0x9ca4('0x40')][_0x9ca4('0x5a')]=_0x55990d['id'];if(_0x18b624[_0x9ca4('0x37')][_0x9ca4('0x45')]){_0x1e3cb4[_0x9ca4('0x40')]=_[_0x9ca4('0x42')](_0x1e3cb4[_0x9ca4('0x40')],{'$or':_[_0x9ca4('0x35')](_0x1e3cb4['attributes'],function(_0x1ec785){var _0x4e2d1d={};_0x4e2d1d[_0x1ec785]={'$like':'%'+_0x18b624[_0x9ca4('0x37')][_0x9ca4('0x45')]+'%'};return _0x4e2d1d;})});}_0x1e3cb4=_[_0x9ca4('0x42')]({},_0x1e3cb4,_0x18b624[_0x9ca4('0x46')]);return db[_0x9ca4('0x5b')]['count']({'where':_0x1e3cb4['where']})[_0x9ca4('0x17')](function(_0x59c0a2){_0x17b065[_0x9ca4('0x27')]=_0x59c0a2;if(_0x18b624['query'][_0x9ca4('0x4d')]){_0x1e3cb4[_0x9ca4('0x47')]=[{'all':!![]}];}return db[_0x9ca4('0x5b')]['findAll'](_0x1e3cb4);})[_0x9ca4('0x17')](function(_0x4934d9){_0x17b065[_0x9ca4('0x49')]=_0x4934d9;return _0x17b065;});}})['then'](respondWithFilteredResult(_0x482e35,_0x1e3cb4))[_0x9ca4('0x57')](handleError(_0x482e35,null));};exports['removeDispositions']=function(_0x2398cd,_0x4e0fd0){return db[_0x9ca4('0x31')]['find']({'where':{'id':_0x2398cd[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x4e0fd0,null))['then'](function(_0x2fcec9){if(_0x2fcec9){return _0x2fcec9[_0x9ca4('0x5f')](_0x2398cd['query'][_0x9ca4('0x60')]);}})['then'](respondWithStatusCode(_0x4e0fd0,null))[_0x9ca4('0x57')](handleError(_0x4e0fd0,null));};exports[_0x9ca4('0x61')]=function(_0x5dd6d4,_0x1e4278){if(_0x5dd6d4[_0x9ca4('0x50')]['id']){delete _0x5dd6d4[_0x9ca4('0x50')]['id'];}return db['ChatWebsite'][_0x9ca4('0x4e')]({'where':{'id':_0x5dd6d4['params']['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x1e4278,null))['then'](function(_0x369bad){if(_0x369bad){_0x5dd6d4['body'][_0x9ca4('0x5a')]=_0x369bad['id'];return db[_0x9ca4('0x62')][_0x9ca4('0x4f')](_0x5dd6d4[_0x9ca4('0x50')]);}})['then'](respondWithResult(_0x1e4278,null))['catch'](handleError(_0x1e4278,null));};exports['getAnswers']=function(_0x4aeda7,_0x17b2e2){var _0x3bde60={'raw':![],'where':{}};var _0x33342e={};var _0x5afa20={'count':0x0,'rows':[]};return db[_0x9ca4('0x31')][_0x9ca4('0x63')]({'where':{'id':_0x4aeda7['params']['id']}})['then'](handleEntityNotFound(_0x17b2e2,null))[_0x9ca4('0x17')](function(_0x594f7a){if(_0x594f7a){_0x33342e['model']=_[_0x9ca4('0x5d')](db[_0x9ca4('0x62')]['rawAttributes']);_0x33342e[_0x9ca4('0x37')]=_[_0x9ca4('0x5d')](_0x4aeda7[_0x9ca4('0x37')]);_0x33342e[_0x9ca4('0x41')]=_[_0x9ca4('0x36')](_0x33342e['model'],_0x33342e[_0x9ca4('0x37')]);_0x3bde60[_0x9ca4('0x38')]=_['intersection'](_0x33342e['model'],qs['fields'](_0x4aeda7['query']['fields']));_0x3bde60['attributes']=_0x3bde60[_0x9ca4('0x38')][_0x9ca4('0x3b')]?_0x3bde60['attributes']:_0x33342e[_0x9ca4('0x39')];if(!_0x4aeda7[_0x9ca4('0x37')][_0x9ca4('0x3c')]('nolimit')){_0x3bde60[_0x9ca4('0x26')]=qs[_0x9ca4('0x26')](_0x4aeda7[_0x9ca4('0x37')][_0x9ca4('0x26')]);_0x3bde60[_0x9ca4('0x24')]=qs['offset'](_0x4aeda7[_0x9ca4('0x37')][_0x9ca4('0x24')]);}_0x3bde60[_0x9ca4('0x3e')]=qs[_0x9ca4('0x3f')](_0x4aeda7[_0x9ca4('0x37')][_0x9ca4('0x3f')]);_0x3bde60['where']=qs[_0x9ca4('0x41')](_[_0x9ca4('0x5e')](_0x4aeda7[_0x9ca4('0x37')],_0x33342e['filters']));_0x3bde60[_0x9ca4('0x40')][_0x9ca4('0x5a')]=_0x594f7a['id'];if(_0x4aeda7[_0x9ca4('0x37')][_0x9ca4('0x45')]){_0x3bde60[_0x9ca4('0x40')]=_[_0x9ca4('0x42')](_0x3bde60[_0x9ca4('0x40')],{'$or':_[_0x9ca4('0x35')](_0x3bde60['attributes'],function(_0x3e365d){var _0x142fbe={};_0x142fbe[_0x3e365d]={'$like':'%'+_0x4aeda7[_0x9ca4('0x37')]['filter']+'%'};return _0x142fbe;})});}_0x3bde60=_['merge']({},_0x3bde60,_0x4aeda7[_0x9ca4('0x46')]);return db[_0x9ca4('0x62')][_0x9ca4('0x27')]({'where':_0x3bde60[_0x9ca4('0x40')]})[_0x9ca4('0x17')](function(_0x888d96){_0x5afa20[_0x9ca4('0x27')]=_0x888d96;if(_0x4aeda7['query']['includeAll']){_0x3bde60[_0x9ca4('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9ca4('0x48')](_0x3bde60);})[_0x9ca4('0x17')](function(_0x98ee84){_0x5afa20[_0x9ca4('0x49')]=_0x98ee84;return _0x5afa20;});}})[_0x9ca4('0x17')](respondWithFilteredResult(_0x17b2e2,_0x3bde60))[_0x9ca4('0x57')](handleError(_0x17b2e2,null));};exports[_0x9ca4('0x64')]=function(_0x388dfd,_0x2893ed){return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x388dfd['params']['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x2893ed,null))['then'](function(_0x389646){if(_0x389646){return _0x389646['removeAnswers'](_0x388dfd[_0x9ca4('0x37')][_0x9ca4('0x60')]);}})[_0x9ca4('0x17')](respondWithStatusCode(_0x2893ed,null))['catch'](handleError(_0x2893ed,null));};exports[_0x9ca4('0x65')]=function(_0x43acd3,_0x89bf6b){_0x43acd3['body'][_0x9ca4('0x66')]=_0x43acd3[_0x9ca4('0x67')][_0x9ca4('0x68')];return db['ChatWebsite'][_0x9ca4('0x4e')]({'where':{'id':_0x43acd3[_0x9ca4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x89bf6b,null))[_0x9ca4('0x17')](saveUpdates(_0x43acd3[_0x9ca4('0x50')],null))[_0x9ca4('0x17')](respondWithResult(_0x89bf6b,null))[_0x9ca4('0x57')](handleError(_0x89bf6b,null));};exports['addAvatar']=function(_0x553f64,_0x53f9a7){_0x553f64[_0x9ca4('0x50')][_0x9ca4('0x69')]=_0x553f64[_0x9ca4('0x67')][_0x9ca4('0x68')];return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x553f64['params']['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x53f9a7,null))['then'](saveUpdates(_0x553f64[_0x9ca4('0x50')],null))[_0x9ca4('0x17')](respondWithResult(_0x53f9a7,null))[_0x9ca4('0x57')](handleError(_0x53f9a7,null));};exports[_0x9ca4('0x6a')]=function(_0x37a194,_0x33c5dd){_0x37a194['body'][_0x9ca4('0x6b')]=_0x37a194['file'][_0x9ca4('0x68')];return db[_0x9ca4('0x31')]['find']({'where':{'id':_0x37a194[_0x9ca4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33c5dd,null))[_0x9ca4('0x17')](saveUpdates(_0x37a194['body'],null))[_0x9ca4('0x17')](respondWithResult(_0x33c5dd,null))['catch'](handleError(_0x33c5dd,null));};exports[_0x9ca4('0x6c')]=function(_0x47ab2a,_0x48e5fd){_0x47ab2a[_0x9ca4('0x50')][_0x9ca4('0x6d')]=_0x47ab2a[_0x9ca4('0x67')][_0x9ca4('0x68')];return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x47ab2a['params']['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x48e5fd,null))['then'](saveUpdates(_0x47ab2a['body'],null))[_0x9ca4('0x17')](respondWithResult(_0x48e5fd,null))[_0x9ca4('0x57')](handleError(_0x48e5fd,null));};exports[_0x9ca4('0x6e')]=function(_0x3754bf,_0x1219fe){var _0x561952=path[_0x9ca4('0x6f')](config['root'],'server/files/images/logos/default_logo.svg');var _0x142a1b={'where':{'id':_0x3754bf[_0x9ca4('0x4b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4a1bfc=![];return require('../../config/license/util')[_0x9ca4('0x70')]()[_0x9ca4('0x17')](function(_0x11ad55){if(_0x11ad55){_0x4a1bfc=_0x11ad55[_0x9ca4('0x71')];}})[_0x9ca4('0x17')](function(){return db[_0x9ca4('0x31')]['find'](_0x142a1b);})[_0x9ca4('0x17')](handleEntityNotFound(_0x1219fe,null))['then'](function(_0x14b758){if(_0x14b758){if(!_[_0x9ca4('0x72')](_0x14b758[_0x9ca4('0x66')])){if(fs['existsSync'](path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0x74'),_0x14b758['sitepic']))&&_0x4a1bfc){_0x561952=path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0x74'),_0x14b758[_0x9ca4('0x66')]);}}return _0x1219fe[_0x9ca4('0x75')](_0x561952);}})[_0x9ca4('0x57')](handleError(_0x1219fe,null));};exports[_0x9ca4('0x76')]=function(_0x2e298b,_0x2b09fb){var _0x17626d=path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0x77'));var _0x55d79b={'where':{'id':_0x2e298b[_0x9ca4('0x4b')]['id']},'attributes':['id',_0x9ca4('0x69')],'raw':!![]};return db['ChatWebsite'][_0x9ca4('0x4e')](_0x55d79b)[_0x9ca4('0x17')](handleEntityNotFound(_0x2b09fb,null))['then'](function(_0x426e64){if(_0x426e64){if(!_[_0x9ca4('0x72')](_0x426e64[_0x9ca4('0x69')])){if(fs[_0x9ca4('0x78')](path[_0x9ca4('0x6f')](config['root'],_0x9ca4('0x79'),_0x426e64['agentAvatar']))){_0x17626d=path['join'](config[_0x9ca4('0x73')],'server/files/images/avatars/',_0x426e64[_0x9ca4('0x69')]);}}return _0x2b09fb[_0x9ca4('0x75')](_0x17626d);}})[_0x9ca4('0x57')](handleError(_0x2b09fb,null));};exports[_0x9ca4('0x7a')]=function(_0x144c33,_0x124628){var _0x3ab823=path[_0x9ca4('0x6f')](config['root'],_0x9ca4('0x7b'));var _0x3ed0c8={'where':{'id':_0x144c33['params']['id']},'attributes':['id',_0x9ca4('0x6b'),_0x9ca4('0x7c')],'raw':!![]};return db[_0x9ca4('0x31')][_0x9ca4('0x4e')](_0x3ed0c8)[_0x9ca4('0x17')](handleEntityNotFound(_0x124628,null))[_0x9ca4('0x17')](function(_0x1c5932){if(_0x1c5932){if(!_[_0x9ca4('0x72')](_0x1c5932['customerAvatar'])){if(fs[_0x9ca4('0x78')](path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0x79'),_0x1c5932[_0x9ca4('0x6b')]))&&_0x1c5932[_0x9ca4('0x7c')]){_0x3ab823=path['join'](config[_0x9ca4('0x73')],'server/files/images/avatars/',_0x1c5932['customerAvatar']);}}return _0x124628[_0x9ca4('0x75')](_0x3ab823);}})[_0x9ca4('0x57')](handleError(_0x124628,null));};exports[_0x9ca4('0x7d')]=function(_0x3f7c16,_0x22353b){var _0x4e4c64=path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],'server/files/images/avatars/system_avatar.png');var _0x29ed8f={'where':{'id':_0x3f7c16[_0x9ca4('0x4b')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x9ca4('0x31')][_0x9ca4('0x4e')](_0x29ed8f)[_0x9ca4('0x17')](handleEntityNotFound(_0x22353b,null))[_0x9ca4('0x17')](function(_0x54f178){if(_0x54f178){if(!_[_0x9ca4('0x72')](_0x54f178[_0x9ca4('0x6d')])){if(fs[_0x9ca4('0x78')](path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0x79'),_0x54f178[_0x9ca4('0x6d')]))){_0x4e4c64=path[_0x9ca4('0x6f')](config['root'],_0x9ca4('0x79'),_0x54f178[_0x9ca4('0x6d')]);}}return _0x22353b[_0x9ca4('0x75')](_0x4e4c64);}})[_0x9ca4('0x57')](handleError(_0x22353b,null));};exports[_0x9ca4('0x7e')]=function(_0x3f620a,_0x5b0249){var _0x5a9b09=require(_0x9ca4('0x7f'));var _0x5e6d5d=new _0x5a9b09();var _0x35ac31=_0x5e6d5d[_0x9ca4('0x80')](_0x3f620a[_0x9ca4('0x81')][_0x9ca4('0x82')])[_0x9ca4('0x83')]();var _0x59e70a={'body':_0x3f620a[_0x9ca4('0x50')],'channel':'chat'};var _0x5d262b=[];var _0x2bee75=[];var _0x3213b8={};var _0x4909a3=![];return db[_0x9ca4('0x84')][_0x9ca4('0x59')]()['then'](function(_0x15a9f0){if(!_0x15a9f0){throw new db[(_0x9ca4('0x85'))][(_0x9ca4('0x86'))](_0x9ca4('0x87'));}_0x5d262b=_[_0x9ca4('0x88')](_[_0x9ca4('0x5d')](_0x15a9f0),[_0x9ca4('0x89'),_0x9ca4('0x8a')]);_0x2bee75=_['difference'](_[_0x9ca4('0x5d')](_0x15a9f0),['createdAt',_0x9ca4('0x8a'),_0x9ca4('0x8b'),_0x9ca4('0x8c')]);if(_0x3f620a[_0x9ca4('0x50')]['id']){delete _0x3f620a[_0x9ca4('0x50')]['id'];}if(_[_0x9ca4('0x72')](_0x3f620a['body'][_0x9ca4('0x8d')])){throw new db[(_0x9ca4('0x85'))][(_0x9ca4('0x86'))](_0x9ca4('0x8e'));}if(_[_0x9ca4('0x72')](_0x3f620a[_0x9ca4('0x50')]['body'])||_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0x50')]===''){throw new db[(_0x9ca4('0x85'))][(_0x9ca4('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9ca4('0x72')](_0x3f620a['body'][_0x9ca4('0x8f')])){throw new db['Sequelize'][(_0x9ca4('0x86'))](_0x9ca4('0x90')+_0x2bee75);}if(!_[_0x9ca4('0x91')](_0x2bee75,_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0x8f')])){throw new db[(_0x9ca4('0x85'))][(_0x9ca4('0x86'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2bee75);}_0x3213b8[_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0x8f')]]=_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0x8d')];})['then'](function(){return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x3f620a[_0x9ca4('0x4b')]['id']},'include':[{'model':db[_0x9ca4('0x92')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3213b8,'limit':0x1,'order':[[_0x9ca4('0x8a'),_0x9ca4('0x93')]]}]},{'model':db[_0x9ca4('0x94')],'as':_0x9ca4('0x95')}]});})['then'](handleEntityNotFound(_0x5b0249,null))[_0x9ca4('0x17')](function(_0x29c842){if(_0x29c842&&_0x29c842[_0x9ca4('0x96')]){_0x59e70a[_0x9ca4('0x97')]=_0x29c842;_0x59e70a[_0x9ca4('0x98')]=_0x29c842[_0x9ca4('0x95')];_0x59e70a[_0x9ca4('0x99')]=_0x29c842['List'];_0x59e70a[_0x9ca4('0x98')]=_[_0x9ca4('0x9a')](_0x59e70a[_0x9ca4('0x98')],['priority'],[_0x9ca4('0x9b')]);if(_0x59e70a[_0x9ca4('0x97')][_0x9ca4('0x95')]){delete _0x59e70a[_0x9ca4('0x97')][_0x9ca4('0x95')];}if(_0x59e70a[_0x9ca4('0x97')]['List']&&_0x59e70a['account'][_0x9ca4('0x96')][_0x9ca4('0x9c')]['length']){return _0x59e70a[_0x9ca4('0x97')][_0x9ca4('0x96')][_0x9ca4('0x9c')][0x0];}var _0x512bc3=_[_0x9ca4('0x9d')](_0x3f620a[_0x9ca4('0x50')],{'firstName':_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0x8d')],'ListId':_0x29c842[_0x9ca4('0x8c')]});_0x512bc3[_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0x8f')]]=_0x3f620a['body']['from'];return db[_0x9ca4('0x84')][_0x9ca4('0x4f')](_0x512bc3,{'fields':_0x5d262b,'raw':!![]});}})[_0x9ca4('0x17')](handleEntityNotFound(_0x5b0249,null))[_0x9ca4('0x17')](function(_0x54b193){_0x59e70a[_0x9ca4('0x9e')]=_0x54b193;var _0x225fe3=_0x3f620a['body'][_0x9ca4('0x9f')];if(_0x3f620a[_0x9ca4('0x81')]['cf-connecting-ip']){_0x225fe3=_0x3f620a[_0x9ca4('0x81')][_0x9ca4('0xa0')];}else if(_0x3f620a[_0x9ca4('0x81')][_0x9ca4('0xa1')]){_0x225fe3=_[_0x9ca4('0xa2')](_0x3f620a[_0x9ca4('0x81')][_0x9ca4('0xa1')][_0x9ca4('0xa3')](','));}if(_0x54b193){var _0x32cb28={'ContactId':_0x54b193['id'],'ChatWebsiteId':_0x3f620a[_0x9ca4('0x4b')]['id'],'from':(_0x54b193[_0x9ca4('0xa4')]||'')+'\x20'+(_0x54b193[_0x9ca4('0xa5')]||''),'customerIp':_0x225fe3,'customerPort':_0x3f620a[_0x9ca4('0x81')][_0x9ca4('0xa6')]?_0x3f620a['headers'][_0x9ca4('0xa6')]:null,'referer':_0x3f620a['body']['referer'],'browserName':_0x35ac31[_0x9ca4('0xa7')][_0x9ca4('0x2d')]&&_0x35ac31[_0x9ca4('0xa7')][_0x9ca4('0xa8')]?util[_0x9ca4('0xa9')](_0x9ca4('0xaa'),_0x35ac31[_0x9ca4('0xa7')][_0x9ca4('0x2d')],_0x35ac31[_0x9ca4('0xa7')][_0x9ca4('0xa8')]):_0x9ca4('0xab'),'browserVersion':_0x35ac31[_0x9ca4('0xa7')]['version']||_0x9ca4('0xab'),'osName':util[_0x9ca4('0xa9')](_0x9ca4('0xaa'),_0x35ac31['os'][_0x9ca4('0x2d')],_0x35ac31['os'][_0x9ca4('0xa8')]),'osVersion':_0x35ac31['os'][_0x9ca4('0xa8')],'deviceModel':_0x35ac31[_0x9ca4('0xac')]['model']&&_0x35ac31[_0x9ca4('0xac')]['vendor']?util['format'](_0x9ca4('0xad'),_0x35ac31[_0x9ca4('0xac')][_0x9ca4('0x39')],_0x35ac31[_0x9ca4('0xac')]['vendor'],_0x35ac31[_0x9ca4('0xac')][_0x9ca4('0x43')]):null,'deviceVendor':_0x35ac31[_0x9ca4('0xac')][_0x9ca4('0xae')],'deviceType':_0x35ac31[_0x9ca4('0xac')][_0x9ca4('0x43')],'formData':JSON['stringify'](_0x3f620a['body'])};var _0x248bc8={'ChatWebsiteId':_0x3f620a[_0x9ca4('0x4b')]['id'],'closed':![]};if(_0x3f620a['body']['threadId']){_0x248bc8[_0x9ca4('0xaf')]=_0x3f620a[_0x9ca4('0x50')]['threadId'];return db[_0x9ca4('0xb0')][_0x9ca4('0x4e')]({'where':_0x248bc8})[_0x9ca4('0x17')](function(_0x45afaa){if(_0x45afaa){return[_0x45afaa,![]];}_0x32cb28[_0x9ca4('0xaf')]=_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0xaf')];_0x32cb28['externalUrl']=_0x3f620a[_0x9ca4('0x50')]['externalUrl'];return db[_0x9ca4('0xb0')]['create'](_0x32cb28)['then'](function(_0xdf6d48){return[_0xdf6d48,!![]];});});}_0x248bc8[_0x9ca4('0xb1')]=_0x54b193['id'];if(_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0xb2')]&&_0x3f620a['body'][_0x9ca4('0xb2')]['id']){_0x248bc8['id']=_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0xb2')]['id'];return db[_0x9ca4('0xb0')][_0x9ca4('0x4e')]({'where':_0x248bc8})[_0x9ca4('0x17')](function(_0x90e42d){if(_0x90e42d){return[_0x90e42d,![]];}return db[_0x9ca4('0xb0')]['create'](_0x32cb28)[_0x9ca4('0x17')](function(_0x52a04c){return[_0x52a04c,!![]];});});}return db[_0x9ca4('0xb0')][_0x9ca4('0x4f')](_0x32cb28)[_0x9ca4('0x17')](function(_0x14e4e9){return[_0x14e4e9,!![]];});}})[_0x9ca4('0xb3')](function(_0x43bcc9,_0x19b876){if(_0x43bcc9){_0x4909a3=_0x19b876;if(!_0x19b876){var _0x2de46a={'from':(_0x59e70a[_0x9ca4('0x9e')]['firstName']||'')+'\x20'+(_0x59e70a[_0x9ca4('0x9e')][_0x9ca4('0xa5')]||'')};if(_0x3f620a[_0x9ca4('0x50')]['threadId']&&_0x3f620a[_0x9ca4('0x50')]['messageId']&&_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0xaf')]!=_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0xb4')]){_0x2de46a[_0x9ca4('0xaf')]=_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0xb4')];}return _0x43bcc9[_0x9ca4('0x29')](_0x2de46a);}else{return _0x43bcc9;}}})[_0x9ca4('0x17')](function(_0x2e53f1){_0x59e70a[_0x9ca4('0xb2')]=_0x2e53f1['get']({'plain':!![]});_0x59e70a['interaction']['created']=_0x4909a3;if(_0x59e70a['interaction']['created']){if(_0x59e70a[_0x9ca4('0x97')]['autoclose']){_0x59e70a[_0x9ca4('0x98')]['push']({'id':0x0,'priority':_0x59e70a[_0x9ca4('0x98')][_0x9ca4('0x3b')]+0x1,'app':_0x9ca4('0xb5'),'appdata':'unmanaged','interval':_0x9ca4('0xb6')});}}return db['ChatMessage']['create']({'body':_0x3f620a[_0x9ca4('0x50')][_0x9ca4('0x50')],'ChatWebsiteId':_0x3f620a[_0x9ca4('0x4b')]['id'],'ChatInteractionId':_0x2e53f1['id'],'direction':'in','ContactId':_0x59e70a['contact']['id'],'AttachmentId':_0x3f620a['body'][_0x9ca4('0xb7')]});})[_0x9ca4('0x17')](function(_0x24f27f){_0x59e70a[_0x9ca4('0x1f')]=_0x24f27f;if(_0x59e70a[_0x9ca4('0xb2')]['UserId']){return db['User'][_0x9ca4('0x4e')]({'attributes':['id','name'],'where':{'id':_0x59e70a[_0x9ca4('0xb2')][_0x9ca4('0xb8')]}})['then'](function(_0x32222d){if(_0x32222d){_0x59e70a[_0x9ca4('0x98')][_0x9ca4('0xb9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x32222d[_0x9ca4('0x2d')]+','+(_0x59e70a[_0x9ca4('0x97')][_0x9ca4('0xba')]||0xa),'interval':_0x9ca4('0xb6')});_0x59e70a[_0x9ca4('0xbb')]=!![];}return respondWithRpcPromise(_0x9ca4('0xbc'),_0x9ca4('0xbd'),_0x59e70a);});}return respondWithRpcPromise('Start','startRouting',_0x59e70a);})[_0x9ca4('0x17')](function(_0x1a8e4d){respondWithRpcPromise(_0x9ca4('0xbe'),_0x9ca4('0xbe'),{'event':'notify','message':_0x1a8e4d},client9002);return _0x1a8e4d;})[_0x9ca4('0x17')](respondWithResult(_0x5b0249,null))[_0x9ca4('0x57')](handleError(_0x5b0249,null));};exports[_0x9ca4('0xbf')]=function(_0x25a5b2,_0x1c8dcd){var _0x1ef16d,_0x5a5a74,_0x3e7de8;var _0x2ae3ab=[];var _0x56eca3={};var _0x50606f=_0x25a5b2['files']||[];var _0x7c264c=[];var _0x3f7244;return db[_0x9ca4('0x84')]['describe']()[_0x9ca4('0x17')](function(_0x554375){if(!_0x554375){throw new db[(_0x9ca4('0x85'))][(_0x9ca4('0x86'))](_0x9ca4('0x87'));}_0x2ae3ab=_[_0x9ca4('0x88')](_[_0x9ca4('0x5d')](_0x554375),[_0x9ca4('0x89'),_0x9ca4('0x8a'),_0x9ca4('0x8b'),_0x9ca4('0x8c')]);if(_0x25a5b2[_0x9ca4('0x50')]['id']){delete _0x25a5b2[_0x9ca4('0x50')]['id'];}if(_[_0x9ca4('0x72')](_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0x8d')])){throw _0x1c8dcd[_0x9ca4('0x22')](0x1f4)['send'](new db['Sequelize'][(_0x9ca4('0x86'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0x50')])||_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0x50')]===''){throw _0x1c8dcd['status'](0x1f4)['send'](new db[(_0x9ca4('0x85'))]['ValidationError'](_0x9ca4('0xc0')));}if(_[_0x9ca4('0x72')](_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0xc1')])){throw _0x1c8dcd[_0x9ca4('0x22')](0x1f4)['send'](new db[(_0x9ca4('0x85'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ae3ab));}if(!_[_0x9ca4('0x91')](_0x2ae3ab,_0x25a5b2['body'][_0x9ca4('0xc1')])){throw _0x1c8dcd[_0x9ca4('0x22')](0x1f4)[_0x9ca4('0x2e')](new db['Sequelize']['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ae3ab));}_0x56eca3[_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0xc1')]]=_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0x8d')];})[_0x9ca4('0x17')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x25a5b2['params']['id']},'include':[{'model':db[_0x9ca4('0x92')],'as':_0x9ca4('0x96')},{'model':db[_0x9ca4('0xc2')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x1c8dcd,null))[_0x9ca4('0x17')](function(_0x220f79){if(_0x220f79&&_0x220f79[_0x9ca4('0x96')]){_0x5a5a74=_0x220f79;var _0x5bcf9f=_[_0x9ca4('0x9d')](_0x25a5b2[_0x9ca4('0x50')],{'firstName':_0x25a5b2['body'][_0x9ca4('0x8d')],'phone':_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0x8d')],'ListId':_0x220f79['ListId']});_0x5bcf9f[_0x25a5b2[_0x9ca4('0x50')]['mapKeyOffline']]=_0x25a5b2['body']['from'];return db[_0x9ca4('0x84')][_0x9ca4('0xc3')]({'where':_0x56eca3,'defaults':_0x5bcf9f});}})[_0x9ca4('0xb3')](function(_0x458927){if(_0x458927){_0x3e7de8=_0x458927;var _0x963553=fs[_0x9ca4('0xc4')](path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0xc5')),'utf8');var _0x4fa3d2=ejs['render'](_0x963553,{'body':_[_0x9ca4('0xc6')](_0x25a5b2[_0x9ca4('0x50')][_0x9ca4('0x50')]),'bodyTitle':_0x5a5a74['offlineMessageBody']});return db[_0x9ca4('0xc7')][_0x9ca4('0x4f')]({'body':_0x4fa3d2,'plainBody':htmlToText[_0x9ca4('0xc8')](_0x4fa3d2),'ContactId':_0x458927['id'],'ChatWebsiteId':_0x5a5a74['id']});}})['then'](function(_0x9bcc61){_0x3f7244=_0x9bcc61;if(_0x50606f['length']){var _0x4c41be=_0x50606f[_0x9ca4('0x35')](function(_0x544b16){return{'name':_0x544b16[_0x9ca4('0xc9')],'basename':_0x544b16[_0x9ca4('0x68')],'type':_0x544b16[_0x9ca4('0xca')],'ChatOfflineMessageId':_0x9bcc61['id']};});_0x7c264c=_0x4c41be[_0x9ca4('0x35')](_0x3fe6f0=>{var _0x3ffd3a={'filename':_0x3fe6f0['name'],'path':path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0xcb'),'files',_0x9ca4('0xcc'),_0x9ca4('0xcd'),_0x3fe6f0[_0x9ca4('0xce')])};return _0x3ffd3a;});if(!_0x5a5a74[_0x9ca4('0xcf')]){return db[_0x9ca4('0xd0')][_0x9ca4('0xd1')](function(_0x7d3f6b){return db[_0x9ca4('0xd2')]['bulkCreate'](_0x4c41be,{'transaction':_0x7d3f6b});});}}})['then'](function(){if(_0x3f7244){_0x1ef16d=_0x3f7244;return db[_0x9ca4('0xc2')][_0x9ca4('0x63')]({'where':{'service':!![]},'include':[{'model':db[_0x9ca4('0xd3')],'as':_0x9ca4('0xd4'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x9ca4('0x17')](function(_0x26486){if(_0x26486&&_0x26486[_0x9ca4('0xd4')]&&_0x5a5a74[_0x9ca4('0xd5')]&&_0x5a5a74[_0x9ca4('0xd6')]){var _0x467067=_0x26486[_0x9ca4('0xd7')]();return respondWithRpcPromise(_0x9ca4('0xd8'),_0x9ca4('0xd9'),{'account':_0x467067,'message':{'from':util[_0x9ca4('0xa9')](_0x9ca4('0xda'),_0x26486[_0x9ca4('0x2d')],_0x26486[_0x9ca4('0xdb')]||_0x26486[_0x9ca4('0xd4')][_0x9ca4('0x51')]),'to':_0x5a5a74['forwardOfflineAddress'],'subject':_0x5a5a74[_0x9ca4('0xdc')],'html':_0x1ef16d['body'],'attachments':_0x7c264c}},client9003)[_0x9ca4('0x17')](function(){return _0x1ef16d;})[_0x9ca4('0x57')](function(_0x39377e){logger[_0x9ca4('0x1c')](_0x39377e);});}})[_0x9ca4('0x17')](function(){if(_0x5a5a74&&_0x5a5a74[_0x9ca4('0xcf')]&&_0x5a5a74['MailAccountId']){var _0x4cafe0=[];if(_0x50606f['length']){_0x4cafe0=_0x50606f[_0x9ca4('0x35')](function(_0xa4ec73){return{'name':_0xa4ec73['originalname'],'basename':_0xa4ec73[_0x9ca4('0x68')],'type':_0xa4ec73[_0x9ca4('0xca')],'ChatOfflineMessageId':_0x3f7244['id']};});}var _0x39d835;if(!_['isNil'](_0x5a5a74[_0x9ca4('0xdd')])){var _0x156e68=_[_0x9ca4('0x35')](_0x25a5b2[_0x9ca4('0x50')],function(_0x5b5a1b){return _0x5b5a1b;});var _0x37ec51=_['toPairsIn'](_0x156e68)[0x0];var _0x347de5=_[_0x9ca4('0xde')](_0x37ec51,function(_0x1492bb){return _0x1492bb;});_0x39d835=_0x347de5[0x1][_0x5a5a74[_0x9ca4('0xdd')]];}var _0x1abdea={'from':_0x3e7de8[_0x9ca4('0xdb')],'firstName':_0x3e7de8[_0x9ca4('0xa4')],'lastName':_0x3e7de8[_0x9ca4('0xa5')],'mapKey':_0x9ca4('0xdb'),'message':{'from':_0x3e7de8[_0x9ca4('0xdb')],'to':_0x5a5a74[_0x9ca4('0xc2')][_0x9ca4('0xdb')],'cc':'','subject':_[_0x9ca4('0x72')](_0x39d835)?_0x5a5a74['offlineMessageSubject']:_0x39d835,'messageId':'','sentAt':new Date(),'attach':_0x4cafe0['length'],'attachments':_0x4cafe0,'originChannel':_0x9ca4('0xdf'),'ChatWebsiteId':_0x5a5a74['id'],'ChatOfflineMessageId':_0x1ef16d['id'],'originTo':_0x5a5a74[_0x9ca4('0xc2')][_0x9ca4('0xdb')]},'body':_0x1ef16d['body']};var _0x4fe787={'account':{'id':_0x5a5a74['MailAccountId']},'body':_0x1abdea,'log':_0x9ca4('0xe0')};return respondWithRpcPromise(_0x9ca4('0xe0'),_0x9ca4('0xe1'),_0x4fe787,client9001)[_0x9ca4('0x17')](function(){return _0x1ef16d;})[_0x9ca4('0x57')](function(_0x5c24a5){logger['error'](_0x5c24a5);});}return;})[_0x9ca4('0x17')](function(){if(_0x1ef16d){return _0x1ef16d;}})['then'](respondWithResult(_0x1c8dcd,null))[_0x9ca4('0x57')](function(_0x1706d6){logger[_0x9ca4('0x1c')](_0x9ca4('0x57'),_0x1706d6);for(var _0x477808 of _0x50606f){var _0x2cb511=path[_0x9ca4('0x6f')](config['root'],'server',_0x9ca4('0xe2'),_0x9ca4('0xcc'),_0x9ca4('0xcd'),_0x477808[_0x9ca4('0x68')]);fs_extra[_0x9ca4('0xe3')](_0x2cb511)[_0x9ca4('0x57')](function(_0x245b35){logger[_0x9ca4('0x1c')](_0x9ca4('0xe4'),_0x2cb511,_0x245b35);});}});};exports['addInteraction']=function(_0x4e6f4a,_0xd1f084){return db['ChatInteraction']['find']({'where':{'id':_0x4e6f4a[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0xd1f084,null))[_0x9ca4('0x17')](function(_0x5edc11){if(_0x5edc11){return _0x5edc11[_0x9ca4('0xe5')](_0x4e6f4a[_0x9ca4('0x50')]['ids'],_['omit'](_0x4e6f4a['body'],['ids','id'])||{});}})[_0x9ca4('0x17')](respondWithResult(_0xd1f084,null))[_0x9ca4('0x57')](handleError(_0xd1f084,null));};exports[_0x9ca4('0xe6')]=function(_0x489bbc,_0x8e45bf){var _0x1bf00c={'raw':![],'where':{}};var _0x52c162={};var _0x248bdc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9ca4('0x63')]({'where':{'id':_0x489bbc[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x8e45bf,null))[_0x9ca4('0x17')](function(_0x55ec45){if(_0x55ec45){_0x52c162['model']=_[_0x9ca4('0x5d')](db[_0x9ca4('0xb0')][_0x9ca4('0x32')]);_0x52c162[_0x9ca4('0x37')]=_[_0x9ca4('0x5d')](_0x489bbc[_0x9ca4('0x37')]);_0x52c162['filters']=_[_0x9ca4('0x36')](_0x52c162['model'],_0x52c162[_0x9ca4('0x37')]);_0x1bf00c['attributes']=_['intersection'](_0x52c162[_0x9ca4('0x39')],qs[_0x9ca4('0x3a')](_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x3a')]));_0x1bf00c[_0x9ca4('0x38')]=_0x1bf00c['attributes'][_0x9ca4('0x3b')]?_0x1bf00c[_0x9ca4('0x38')]:_0x52c162[_0x9ca4('0x39')];if(!_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x3c')](_0x9ca4('0x3d'))){_0x1bf00c['limit']=qs[_0x9ca4('0x26')](_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x26')]);_0x1bf00c[_0x9ca4('0x24')]=qs[_0x9ca4('0x24')](_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x24')]);}_0x1bf00c[_0x9ca4('0x3e')]=qs[_0x9ca4('0x3f')](_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x3f')]);_0x1bf00c[_0x9ca4('0x40')]=qs[_0x9ca4('0x41')](_[_0x9ca4('0x5e')](_0x489bbc['query'],_0x52c162[_0x9ca4('0x41')]));_0x1bf00c[_0x9ca4('0x40')]['ChatWebsiteId']=_0x55ec45['id'];if(_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x45')]){_0x1bf00c['where']=_[_0x9ca4('0x42')](_0x1bf00c[_0x9ca4('0x40')],{'$or':_[_0x9ca4('0x35')](_0x1bf00c[_0x9ca4('0x38')],function(_0x512cf0){var _0x408ea1={};_0x408ea1[_0x512cf0]={'$like':'%'+_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x45')]+'%'};return _0x408ea1;})});}_0x1bf00c=_[_0x9ca4('0x42')]({},_0x1bf00c,_0x489bbc[_0x9ca4('0x46')]);return db[_0x9ca4('0xb0')][_0x9ca4('0x27')]({'where':_0x1bf00c[_0x9ca4('0x40')]})[_0x9ca4('0x17')](function(_0x3cba97){_0x248bdc['count']=_0x3cba97;if(_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0x4d')]){_0x1bf00c[_0x9ca4('0x47')]=[{'model':db[_0x9ca4('0x84')],'as':_0x9ca4('0xe7'),'required':![]},{'model':db['User'],'as':_0x9ca4('0xe8'),'attributes':[_0x9ca4('0x2d'),_0x9ca4('0xe9'),_0x9ca4('0xea')],'required':![]},{'model':db[_0x9ca4('0xeb')],'as':'Tags','attributes':['id',_0x9ca4('0x2d'),_0x9ca4('0xec')],'where':_0x489bbc['query']['tag']?{'id':_0x489bbc['query']['tag']}:undefined,'required':_0x489bbc[_0x9ca4('0x37')][_0x9ca4('0xed')]?!![]:![]}];}return db[_0x9ca4('0xb0')][_0x9ca4('0x48')](_0x1bf00c);})[_0x9ca4('0x17')](function(_0x31723b){_0x248bdc[_0x9ca4('0x49')]=_0x31723b;return _0x248bdc;});}})[_0x9ca4('0x17')](respondWithFilteredResult(_0x8e45bf,_0x1bf00c))['catch'](handleError(_0x8e45bf,null));};function iftimePromise(_0x1ebb10,_0xcfae49){return respondWithRpcPromise('Command',_0x9ca4('0xee'),{'command':_0xcfae49['timezone']?util[_0x9ca4('0xa9')](_0x9ca4('0xef'),_0x1ebb10[_0x9ca4('0xf0')],_0xcfae49[_0x9ca4('0xf1')]):util[_0x9ca4('0xa9')](_0x9ca4('0xf2'),_0x1ebb10['interval'])},client9002)['then'](function(_0x1edbeb){var _0x13e369=_0x1edbeb&&_0x1edbeb[_0x9ca4('0xf3')](_0x9ca4('0xf4'))>=0x0?!![]:![];logger['info'](_0x9ca4('0xf5'),_0xcfae49['id'],_0x1ebb10['id'],_0x1ebb10['interval'],_0x13e369?_0x9ca4('0xf6'):_0x9ca4('0xf7'),_0xcfae49[_0x9ca4('0xf1')]?_0xcfae49['timezone']:_0x9ca4('0xf8'));return _0x13e369;})[_0x9ca4('0x57')](function(_0x58dca0){logger[_0x9ca4('0x1c')](_0x9ca4('0xf5'),_0xcfae49['id'],_0x1ebb10['id'],_0x1ebb10['interval'],util[_0x9ca4('0xf9')](_0x58dca0,{'showHidden':![],'depth':null}),_0xcfae49[_0x9ca4('0xf1')]?_0xcfae49['timezone']:_0x9ca4('0xf8'));return![];});}exports[_0x9ca4('0xee')]=function(_0x13856c,_0x172a6c){var _0x54c516=0x0;var _0x56aa51=0x0;var _0x4c45be=![];var _0x11b43e;var _0xc2f29e;return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x13856c['params']['id']},'include':[{'model':db[_0x9ca4('0xfa')],'as':_0x9ca4('0xfa'),'include':[{'model':db['Interval'],'as':_0x9ca4('0xfb'),'attributes':['id',_0x9ca4('0xf0')],'raw':!![]}]}]})[_0x9ca4('0x17')](handleEntityNotFound(_0x172a6c,null))['then'](function(_0xfeff4d){if(_0xfeff4d){_0x11b43e=_0xfeff4d;return _0xfeff4d[_0x9ca4('0xfc')]({'raw':!![]});}})['then'](function(_0x1cf507){if(_0x11b43e){if(_0x1cf507){_0xc2f29e=_0x1cf507;}}return require(_0x9ca4('0xfd'))[_0x9ca4('0x70')]();})[_0x9ca4('0x17')](function(_0x3031eb){if(_0x3031eb){_0x56aa51=_0x3031eb['virtual'];_0x4c45be=_0x3031eb[_0x9ca4('0x71')];}})[_0x9ca4('0x17')](function(){return db['ChatInteraction'][_0x9ca4('0x27')]({'where':{'closed':![]}});})['then'](function(_0xdb36f4){_0x54c516=_0xdb36f4;if(_0x56aa51&&_0xdb36f4>_0x56aa51){return db[_0x9ca4('0xfe')]['findOne']({'where':{'id':0x1}})[_0x9ca4('0x17')](function(_0x3eed63){if(_0x3eed63){_0x3eed63[_0x9ca4('0xff')](_0x9ca4('0x100'));}});}})[_0x9ca4('0x17')](function(){if(_0x11b43e['Interval']&&_0x11b43e['Interval'][_0x9ca4('0xfb')]){var _0x593745=[];for(var _0x43b413=0x0;_0x43b413<_0x11b43e[_0x9ca4('0xfa')]['Intervals'][_0x9ca4('0x3b')];_0x43b413++){var _0x53a6e1=_0x11b43e[_0x9ca4('0xfa')][_0x9ca4('0xfb')][_0x43b413][_0x9ca4('0x53')]({'plain':!![]});_0x593745['push'](iftimePromise(_0x53a6e1,_0x11b43e));}return BPromise[_0x9ca4('0x101')](_0x593745)[_0x9ca4('0x17')](function(_0x599137){return _[_0x9ca4('0x102')](_0x599137);});}else{return!![];}})[_0x9ca4('0x17')](function(_0x1a5445){var _0xa284c8=fs[_0x9ca4('0xc4')](path[_0x9ca4('0x6f')](config[_0x9ca4('0x73')],_0x9ca4('0x103')),'utf8');var _0xc536b8={'remote':_0x11b43e[_0x9ca4('0x104')],'query':querystring[_0x9ca4('0x105')](_[_0x9ca4('0x42')](_0x11b43e[_0x9ca4('0x53')]({'plain':!![]}),{'customerIp':_0x13856c[_0x9ca4('0x81')]['x-forwarded-for']||_0x13856c[_0x9ca4('0x81')][_0x9ca4('0x106')]||_0x13856c[_0x9ca4('0x107')][_0x9ca4('0x108')]||_0x13856c['ip'],'referer':_0x13856c['headers'][_0x9ca4('0x109')],'openedInteractions':_0x54c516,'maxInteractions':_0x56aa51,'virtual':_0x4c45be[_0x9ca4('0x10a')],'online':_0x1a5445,'custom':_0x4c45be}))[_0x9ca4('0x10b')](/'/g,'\x5c\x27')};_0x172a6c[_0x9ca4('0x2e')](ejs[_0x9ca4('0x10c')](Mustache[_0x9ca4('0x10c')](_0xa284c8,_0xc536b8),{'proactiveActions':_0xc2f29e,'alignment':_0x11b43e[_0x9ca4('0x10d')],'verticalAlignment':_0x11b43e[_0x9ca4('0x10e')],'div_color':_0x11b43e[_0x9ca4('0xec')],'labelText':_0x11b43e[_0x9ca4('0x10f')],'text_color':_0x11b43e[_0x9ca4('0x110')],'text_button_color':_0x11b43e[_0x9ca4('0x111')],'button_color':_0x11b43e[_0x9ca4('0x112')],'background_color':_0x11b43e[_0x9ca4('0x113')],'hideWhenOffline':_0x11b43e['hideWhenOffline'],'interval':_0x11b43e[_0x9ca4('0x114')]}));})[_0x9ca4('0x57')](handleError(_0x172a6c,null));};exports[_0x9ca4('0x115')]=function(_0x595193,_0x39356e){var _0xa3b0ef=_0x595193[_0x9ca4('0x4b')]['id'];var _0xefb32c=_0x595193['body'];var _0x5a846b=0xc8;var _0x4a6821=null;return db['sequelize'][_0x9ca4('0xd1')]({'isolationLevel':db[_0x9ca4('0xd0')][_0x9ca4('0x116')][_0x9ca4('0x117')][_0x9ca4('0x118')]},function(_0x1a050f){return db[_0x9ca4('0x31')]['findOne']({'where':{'id':_0xa3b0ef},'transaction':_0x1a050f})['then'](function(_0x18bb8f){if(_0x18bb8f){return db[_0x9ca4('0x94')][_0x9ca4('0x58')]({'where':{'ChatWebsiteId':_0xa3b0ef},'transaction':_0x1a050f})[_0x9ca4('0x17')](function(){var _0x3db992=_['map'](_0xefb32c,function(_0x265ff5){_0x265ff5[_0x9ca4('0x5a')]=_0xa3b0ef;return _0x265ff5;});return db['ChatApplication']['bulkCreate'](_0x3db992,{'transaction':_0x1a050f});});}else{_0x5a846b=0x194;_0x4a6821=[];}});})[_0x9ca4('0x17')](function(){if(_0x5a846b!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0xa3b0ef},'order':'priority'})[_0x9ca4('0x17')](function(_0x22c00b){_0x4a6821=_0x22c00b;});}})[_0x9ca4('0x57')](function(_0x27314e){_0x5a846b=0x1f4;logger[_0x9ca4('0x1c')](_0x27314e['stack']);if(_0x27314e[_0x9ca4('0x2d')]){delete _0x27314e[_0x9ca4('0x2d')];}_0x4a6821=_0x27314e;})[_0x9ca4('0x119')](function(){if(_0x4a6821===null){_0x39356e['sendStatus'](_0x5a846b);}else{if(_0x5a846b===0x1f4){_0x39356e[_0x9ca4('0x22')](_0x5a846b)['send'](_0x4a6821);}else{_0x39356e['status'](_0x5a846b)['json'](_0x4a6821);}}});};exports['getApplications']=function(_0x5895a5,_0x22dcfc){var _0xb33616={};var _0x1b7881={};var _0x38eb02;var _0x4899e6;return db[_0x9ca4('0x31')]['findOne']({'where':{'id':_0x5895a5[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x22dcfc,null))[_0x9ca4('0x17')](function(_0x15c63b){if(_0x15c63b){_0x38eb02=_0x15c63b;_0x1b7881[_0x9ca4('0x39')]=_[_0x9ca4('0x5d')](db[_0x9ca4('0x94')][_0x9ca4('0x32')]);_0x1b7881[_0x9ca4('0x37')]=_['keys'](_0x5895a5[_0x9ca4('0x37')]);_0x1b7881['filters']=_['intersection'](_0x1b7881[_0x9ca4('0x39')],_0x1b7881[_0x9ca4('0x37')]);_0xb33616[_0x9ca4('0x38')]=_[_0x9ca4('0x36')](_0x1b7881[_0x9ca4('0x39')],qs[_0x9ca4('0x3a')](_0x5895a5[_0x9ca4('0x37')][_0x9ca4('0x3a')]));_0xb33616[_0x9ca4('0x38')]=_0xb33616[_0x9ca4('0x38')][_0x9ca4('0x3b')]?_0xb33616[_0x9ca4('0x38')]:_0x1b7881[_0x9ca4('0x39')];_0xb33616[_0x9ca4('0x3e')]=qs['sort'](_0x5895a5[_0x9ca4('0x37')][_0x9ca4('0x3f')]);_0xb33616[_0x9ca4('0x40')]=qs[_0x9ca4('0x41')](_[_0x9ca4('0x5e')](_0x5895a5[_0x9ca4('0x37')],_0x1b7881['filters']));if(_0x5895a5[_0x9ca4('0x37')][_0x9ca4('0x45')]){_0xb33616[_0x9ca4('0x40')]=_[_0x9ca4('0x42')](_0xb33616[_0x9ca4('0x40')],{'$or':_[_0x9ca4('0x35')](_0xb33616[_0x9ca4('0x38')],function(_0xe875c7){var _0x1921fb={};_0x1921fb[_0xe875c7]={'$like':'%'+_0x5895a5[_0x9ca4('0x37')][_0x9ca4('0x45')]+'%'};return _0x1921fb;})});}_0xb33616=_['merge']({},_0xb33616,_0x5895a5[_0x9ca4('0x46')]);return _0x38eb02[_0x9ca4('0x11a')](_0xb33616);}})[_0x9ca4('0x17')](function(_0x2c550d){if(_0x2c550d){_0x4899e6=_0x2c550d[_0x9ca4('0x3b')];if(!_0x5895a5[_0x9ca4('0x37')]['hasOwnProperty']('nolimit')){_0xb33616[_0x9ca4('0x26')]=qs[_0x9ca4('0x26')](_0x5895a5['query'][_0x9ca4('0x26')]);_0xb33616['offset']=qs[_0x9ca4('0x24')](_0x5895a5[_0x9ca4('0x37')][_0x9ca4('0x24')]);}return _0x38eb02[_0x9ca4('0x11a')](_0xb33616);}})[_0x9ca4('0x17')](function(_0x44ae51){if(_0x44ae51){return _0x44ae51?{'count':_0x4899e6,'rows':_0x44ae51}:null;}})[_0x9ca4('0x17')](respondWithResult(_0x22dcfc,null))['catch'](handleError(_0x22dcfc,null));};exports[_0x9ca4('0x11b')]=function(_0x5aa846,_0x1e43a4){return db[_0x9ca4('0x11c')][_0x9ca4('0x4e')]({'where':{'id':_0x5aa846['params']['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x1e43a4,null))[_0x9ca4('0x17')](function(_0x6604bf){if(_0x6604bf){return _0x6604bf['addProactiveActions'](_0x5aa846[_0x9ca4('0x50')][_0x9ca4('0x60')],_[_0x9ca4('0x11d')](_0x5aa846[_0x9ca4('0x50')],[_0x9ca4('0x60'),'id'])||{});}})[_0x9ca4('0x17')](respondWithResult(_0x1e43a4,null))[_0x9ca4('0x57')](handleError(_0x1e43a4,null));};exports[_0x9ca4('0xfc')]=function(_0x4ed11d,_0x5b3e79){var _0x20390e={};var _0x58a93f={};var _0x328d4c;var _0xe14712;return db[_0x9ca4('0x31')]['findOne']({'where':{'id':_0x4ed11d[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x5b3e79,null))['then'](function(_0x173d40){if(_0x173d40){_0x328d4c=_0x173d40;_0x58a93f['model']=_['keys'](db[_0x9ca4('0x11e')][_0x9ca4('0x32')]);_0x58a93f[_0x9ca4('0x37')]=_['keys'](_0x4ed11d[_0x9ca4('0x37')]);_0x58a93f['filters']=_['intersection'](_0x58a93f['model'],_0x58a93f[_0x9ca4('0x37')]);_0x20390e[_0x9ca4('0x38')]=_[_0x9ca4('0x36')](_0x58a93f['model'],qs[_0x9ca4('0x3a')](_0x4ed11d[_0x9ca4('0x37')][_0x9ca4('0x3a')]));_0x20390e[_0x9ca4('0x38')]=_0x20390e[_0x9ca4('0x38')][_0x9ca4('0x3b')]?_0x20390e[_0x9ca4('0x38')]:_0x58a93f['model'];_0x20390e[_0x9ca4('0x3e')]=qs[_0x9ca4('0x3f')](_0x4ed11d[_0x9ca4('0x37')][_0x9ca4('0x3f')]);_0x20390e['where']=qs['filters'](_[_0x9ca4('0x5e')](_0x4ed11d[_0x9ca4('0x37')],_0x58a93f[_0x9ca4('0x41')]));if(_0x4ed11d['query'][_0x9ca4('0x45')]){_0x20390e['where']=_[_0x9ca4('0x42')](_0x20390e[_0x9ca4('0x40')],{'$or':_[_0x9ca4('0x35')](_0x20390e[_0x9ca4('0x38')],function(_0x370751){var _0x5872f8={};_0x5872f8[_0x370751]={'$like':'%'+_0x4ed11d[_0x9ca4('0x37')][_0x9ca4('0x45')]+'%'};return _0x5872f8;})});}_0x20390e=_[_0x9ca4('0x42')]({},_0x20390e,_0x4ed11d[_0x9ca4('0x46')]);return _0x328d4c[_0x9ca4('0xfc')](_0x20390e);}})[_0x9ca4('0x17')](function(_0x3d29a1){if(_0x3d29a1){_0xe14712=_0x3d29a1[_0x9ca4('0x3b')];if(!_0x4ed11d[_0x9ca4('0x37')][_0x9ca4('0x3c')](_0x9ca4('0x3d'))){_0x20390e[_0x9ca4('0x26')]=qs[_0x9ca4('0x26')](_0x4ed11d['query'][_0x9ca4('0x26')]);_0x20390e[_0x9ca4('0x24')]=qs['offset'](_0x4ed11d[_0x9ca4('0x37')][_0x9ca4('0x24')]);}return _0x328d4c['getProactiveActions'](_0x20390e);}})['then'](function(_0x15e360){if(_0x15e360){return _0x15e360?{'count':_0xe14712,'rows':_0x15e360}:null;}})[_0x9ca4('0x17')](respondWithResult(_0x5b3e79,null))[_0x9ca4('0x57')](handleError(_0x5b3e79,null));};exports[_0x9ca4('0x11f')]=function(_0x20ec15,_0x2889ac){var _0x5ac55a=_0x20ec15[_0x9ca4('0x37')]['online']===_0x9ca4('0x120')?'offlineForm':_0x9ca4('0x121');return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'attributes':['id',_0x5ac55a],'where':{'id':_0x20ec15['params']['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x2889ac,null))['then'](function(_0x4d8a8f){if(_0x4d8a8f){var _0x1b44bc=_0x4d8a8f[_0x5ac55a];var _0x4d77dc=_0x1b44bc&&_0x1b44bc[_0x9ca4('0x122')]?_0x1b44bc[_0x9ca4('0x122')]:[];_0x2889ac[_0x9ca4('0x2e')]({'fromKey':_[_0x9ca4('0x72')](_0x1b44bc[_0x9ca4('0x123')])?undefined:_0x1b44bc[_0x9ca4('0x123')],'count':_0x4d77dc[_0x9ca4('0x3b')],'rows':_0x4d77dc});}})[_0x9ca4('0x57')](handleError(_0x2889ac,null));};exports[_0x9ca4('0x124')]=function(_0x54d1cf,_0x59e0e8){var _0x3bf953={'raw':![],'where':{}};var _0x1bbe4b={};var _0x2d2245={'count':0x0,'rows':[]};return db[_0x9ca4('0x31')][_0x9ca4('0x63')]({'where':{'id':_0x54d1cf[_0x9ca4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x59e0e8,null))['then'](function(_0x33cf50){if(_0x33cf50){_0x1bbe4b[_0x9ca4('0x39')]=_[_0x9ca4('0x5d')](db['ChatOfflineMessage'][_0x9ca4('0x32')]);_0x1bbe4b[_0x9ca4('0x37')]=_[_0x9ca4('0x5d')](_0x54d1cf[_0x9ca4('0x37')]);_0x1bbe4b[_0x9ca4('0x41')]=_[_0x9ca4('0x36')](_0x1bbe4b['model'],_0x1bbe4b[_0x9ca4('0x37')]);_0x3bf953[_0x9ca4('0x38')]=_['intersection'](_0x1bbe4b[_0x9ca4('0x39')],qs[_0x9ca4('0x3a')](_0x54d1cf[_0x9ca4('0x37')][_0x9ca4('0x3a')]));_0x3bf953['attributes']=_0x3bf953[_0x9ca4('0x38')][_0x9ca4('0x3b')]?_0x3bf953[_0x9ca4('0x38')]:_0x1bbe4b[_0x9ca4('0x39')];if(!_0x54d1cf['query'][_0x9ca4('0x3c')](_0x9ca4('0x3d'))){_0x3bf953[_0x9ca4('0x26')]=qs['limit'](_0x54d1cf[_0x9ca4('0x37')][_0x9ca4('0x26')]);_0x3bf953[_0x9ca4('0x24')]=qs[_0x9ca4('0x24')](_0x54d1cf['query'][_0x9ca4('0x24')]);}_0x3bf953[_0x9ca4('0x3e')]=qs[_0x9ca4('0x3f')](_0x54d1cf['query'][_0x9ca4('0x3f')]);_0x3bf953[_0x9ca4('0x40')]=qs[_0x9ca4('0x41')](_[_0x9ca4('0x5e')](_0x54d1cf[_0x9ca4('0x37')],_0x1bbe4b[_0x9ca4('0x41')]));_0x3bf953[_0x9ca4('0x40')][_0x9ca4('0x5a')]=_0x33cf50['id'];if(_0x54d1cf[_0x9ca4('0x37')]['filter']){_0x3bf953[_0x9ca4('0x40')]=_[_0x9ca4('0x42')](_0x3bf953[_0x9ca4('0x40')],{'$or':_['map'](_0x3bf953[_0x9ca4('0x38')],function(_0x5ae058){var _0x427187={};_0x427187[_0x5ae058]={'$like':'%'+_0x54d1cf[_0x9ca4('0x37')][_0x9ca4('0x45')]+'%'};return _0x427187;})});}_0x3bf953=_[_0x9ca4('0x42')]({},_0x3bf953,_0x54d1cf[_0x9ca4('0x46')]);return db['ChatOfflineMessage']['count']({'where':_0x3bf953['where']})['then'](function(_0x5a77fd){_0x2d2245[_0x9ca4('0x27')]=_0x5a77fd;if(_0x54d1cf[_0x9ca4('0x37')][_0x9ca4('0x4d')]){_0x3bf953[_0x9ca4('0x47')]=[{'all':!![]}];}else{_0x3bf953[_0x9ca4('0x47')]=[{'model':db['CmContact'],'as':_0x9ca4('0xe7'),'required':![]},{'model':db['Attachment'],'as':_0x9ca4('0x125'),'required':![]}];}return db[_0x9ca4('0xc7')][_0x9ca4('0x48')](_0x3bf953);})['then'](function(_0x461fea){_0x2d2245[_0x9ca4('0x49')]=_0x461fea;return _0x2d2245;});}})[_0x9ca4('0x17')](respondWithFilteredResult(_0x59e0e8,_0x3bf953))[_0x9ca4('0x57')](handleError(_0x59e0e8,null));};exports['addAgents']=function(_0x4f7db6,_0x202235){return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x4f7db6['params']['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x202235,null))[_0x9ca4('0x17')](function(_0x34903b){if(_0x34903b){return _0x34903b[_0x9ca4('0x126')](_0x4f7db6[_0x9ca4('0x50')]['ids'],_[_0x9ca4('0x11d')](_0x4f7db6[_0x9ca4('0x50')],[_0x9ca4('0x60'),'id'])||{})[_0x9ca4('0xb3')](function(_0x13f607){for(var _0x58df6f=0x0;_0x58df6f<_0x4f7db6['body']['ids'][_0x9ca4('0x3b')];_0x58df6f+=0x1){socket[_0x9ca4('0x127')](_0x9ca4('0x128'),{'UserId':Number(_0x4f7db6['body'][_0x9ca4('0x60')][_0x58df6f]),'ChatWebsiteId':Number(_0x4f7db6[_0x9ca4('0x4b')]['id'])});}return _0x13f607;});}})[_0x9ca4('0x17')](respondWithResult(_0x202235,null))[_0x9ca4('0x57')](handleError(_0x202235,null));};exports[_0x9ca4('0x129')]=function(_0x48469d,_0x1d1f85){return db[_0x9ca4('0x31')][_0x9ca4('0x4e')]({'where':{'id':_0x48469d[_0x9ca4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d1f85,null))[_0x9ca4('0x17')](function(_0x1ce6c0){if(_0x1ce6c0){return _0x1ce6c0[_0x9ca4('0x129')](_0x48469d[_0x9ca4('0x37')]['ids'])['then'](function(){if(_[_0x9ca4('0x12a')](_0x48469d[_0x9ca4('0x37')][_0x9ca4('0x60')])){for(var _0x3f6f6e=0x0;_0x3f6f6e<_0x48469d['query'][_0x9ca4('0x60')][_0x9ca4('0x3b')];_0x3f6f6e+=0x1){socket[_0x9ca4('0x127')](_0x9ca4('0x12b'),{'UserId':Number(_0x48469d[_0x9ca4('0x37')]['ids'][_0x3f6f6e]),'ChatWebsiteId':Number(_0x48469d[_0x9ca4('0x4b')]['id'])});}}else{socket[_0x9ca4('0x127')](_0x9ca4('0x12b'),{'UserId':Number(_0x48469d[_0x9ca4('0x37')][_0x9ca4('0x60')]),'ChatWebsiteId':Number(_0x48469d[_0x9ca4('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d1f85,null))['catch'](handleError(_0x1d1f85,null));};exports[_0x9ca4('0x12c')]=function(_0xa8f2d1,_0x1b79be){var _0x3299e4={};var _0x4f3d7b={};var _0x259817;var _0x5a5177;return db[_0x9ca4('0x31')][_0x9ca4('0x63')]({'where':{'id':_0xa8f2d1[_0x9ca4('0x4b')]['id']}})[_0x9ca4('0x17')](handleEntityNotFound(_0x1b79be,null))[_0x9ca4('0x17')](function(_0x283dbb){if(_0x283dbb){_0x259817=_0x283dbb;_0x4f3d7b['model']=_[_0x9ca4('0x5d')](db[_0x9ca4('0x12d')][_0x9ca4('0x32')]);_0x4f3d7b['query']=_[_0x9ca4('0x5d')](_0xa8f2d1[_0x9ca4('0x37')]);_0x4f3d7b[_0x9ca4('0x41')]=_[_0x9ca4('0x36')](_0x4f3d7b[_0x9ca4('0x39')],_0x4f3d7b[_0x9ca4('0x37')]);_0x3299e4[_0x9ca4('0x38')]=_['intersection'](_0x4f3d7b[_0x9ca4('0x39')],qs[_0x9ca4('0x3a')](_0xa8f2d1[_0x9ca4('0x37')]['fields']));_0x3299e4[_0x9ca4('0x38')]=_0x3299e4['attributes'][_0x9ca4('0x3b')]?_0x3299e4[_0x9ca4('0x38')]:_0x4f3d7b['model'];_0x3299e4['order']=qs[_0x9ca4('0x3f')](_0xa8f2d1[_0x9ca4('0x37')][_0x9ca4('0x3f')]);_0x3299e4['where']=qs['filters'](_['pick'](_0xa8f2d1[_0x9ca4('0x37')],_0x4f3d7b[_0x9ca4('0x41')]));if(_0xa8f2d1[_0x9ca4('0x37')][_0x9ca4('0x45')]){_0x3299e4['where']=_[_0x9ca4('0x42')](_0x3299e4[_0x9ca4('0x40')],{'$or':_[_0x9ca4('0x35')](_0x3299e4[_0x9ca4('0x38')],function(_0x530b06){var _0xc188a1={};_0xc188a1[_0x530b06]={'$like':'%'+_0xa8f2d1[_0x9ca4('0x37')][_0x9ca4('0x45')]+'%'};return _0xc188a1;})});}_0x3299e4=_['merge']({},_0x3299e4,_0xa8f2d1[_0x9ca4('0x46')]);return _0x259817['getAgents'](_0x3299e4);}})[_0x9ca4('0x17')](function(_0x9e42ca){if(_0x9e42ca){_0x5a5177=_0x9e42ca[_0x9ca4('0x3b')];if(!_0xa8f2d1[_0x9ca4('0x37')]['hasOwnProperty'](_0x9ca4('0x3d'))){_0x3299e4[_0x9ca4('0x26')]=qs['limit'](_0xa8f2d1['query'][_0x9ca4('0x26')]);_0x3299e4[_0x9ca4('0x24')]=qs[_0x9ca4('0x24')](_0xa8f2d1['query']['offset']);}return _0x259817['getAgents'](_0x3299e4);}})[_0x9ca4('0x17')](function(_0x21f4e6){if(_0x21f4e6){return _0x21f4e6?{'count':_0x5a5177,'rows':_0x21f4e6}:null;}})[_0x9ca4('0x17')](respondWithResult(_0x1b79be,null))[_0x9ca4('0x57')](handleError(_0x1b79be,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index f2e6b04..f7d4df9 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 _0x7bae=['ChatWebsite','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x428b87,_0x27c47f){var _0x369c6d=function(_0xa14e90){while(--_0xa14e90){_0x428b87['push'](_0x428b87['shift']());}};_0x369c6d(++_0x27c47f);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7bae[_0x5bd426];return _0x23a7eb;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0xe7ba('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe7ba('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe7ba('0x2'),'afterDestroy':'remove'};function emitEvent(_0x120efa){return function(_0x10908b,_0x166acb,_0x2276df){ChatWebsiteEvents[_0xe7ba('0x3')](_0x120efa+':'+_0x10908b['id'],_0x10908b);ChatWebsiteEvents[_0xe7ba('0x3')](_0x120efa,_0x10908b);_0x2276df(null);};}for(var e in events){if(events[_0xe7ba('0x4')](e)){var event=events[e];ChatWebsite[_0xe7ba('0x5')](e,emitEvent(event));}}module[_0xe7ba('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe79f=['ChatWebsite','save','hasOwnProperty','hook','events'];(function(_0x4f76b5,_0x31bee0){var _0x31a48e=function(_0x32aa64){while(--_0x32aa64){_0x4f76b5['push'](_0x4f76b5['shift']());}};_0x31a48e(++_0x31bee0);}(_0xe79f,0x13a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xfe79('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xfe79('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe79('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5901ba){return function(_0x243f35,_0x3cfd2b,_0xa04861){ChatWebsiteEvents['emit'](_0x5901ba+':'+_0x243f35['id'],_0x243f35);ChatWebsiteEvents['emit'](_0x5901ba,_0x243f35);_0xa04861(null);};}for(var e in events){if(events[_0xfe79('0x3')](e)){var event=events[e];ChatWebsite[_0xfe79('0x4')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 0ec2124..5136fd7 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 _0x0875=['request-promise','path','rimraf','./chatWebsite.attributes','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird'];(function(_0xc6d5b8,_0xf67ef6){var _0x2e6d37=function(_0x158982){while(--_0x158982){_0xc6d5b8['push'](_0xc6d5b8['shift']());}};_0x2e6d37(++_0xf67ef6);}(_0x0875,0x145));var _0x5087=function(_0xa31cba,_0x5e810e){_0xa31cba=_0xa31cba-0x0;var _0x3cc7a3=_0x0875[_0xa31cba];return _0x3cc7a3;};'use strict';var _=require(_0x5087('0x0'));var util=require('util');var logger=require(_0x5087('0x1'))(_0x5087('0x2'));var moment=require(_0x5087('0x3'));var BPromise=require(_0x5087('0x4'));var rp=require(_0x5087('0x5'));var fs=require('fs');var path=require(_0x5087('0x6'));var rimraf=require(_0x5087('0x7'));var config=require('../../config/environment');var attributes=require(_0x5087('0x8'));module['exports']=function(_0x3f54c7,_0x2844c2){return _0x3f54c7['define'](_0x5087('0x9'),attributes,{'tableName':_0x5087('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x657f=['./chatWebsite.attributes','exports','ChatWebsite','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x314922,_0xd73514){var _0x465574=function(_0x4f38c6){while(--_0x4f38c6){_0x314922['push'](_0x314922['shift']());}};_0x465574(++_0xd73514);}(_0x657f,0x1bb));var _0xf657=function(_0x425d5e,_0x3b9040){_0x425d5e=_0x425d5e-0x0;var _0x3cc67b=_0x657f[_0x425d5e];return _0x3cc67b;};'use strict';var _=require(_0xf657('0x0'));var util=require(_0xf657('0x1'));var logger=require('../../config/logger')(_0xf657('0x2'));var moment=require(_0xf657('0x3'));var BPromise=require(_0xf657('0x4'));var rp=require(_0xf657('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf657('0x6'));var config=require(_0xf657('0x7'));var attributes=require(_0xf657('0x8'));module[_0xf657('0x9')]=function(_0x413333,_0x45688f){return _0x413333['define'](_0xf657('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 5f088e6..f7ee5ce 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 _0x2604=['then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0xd99c22,_0x579862){var _0xbbb9e5=function(_0x1e7394){while(--_0x1e7394){_0xd99c22['push'](_0xd99c22['shift']());}};_0xbbb9e5(++_0x579862);}(_0x2604,0x172));var _0x4260=function(_0x3a2033,_0x17a86f){_0x3a2033=_0x3a2033-0x0;var _0x28e661=_0x2604[_0x3a2033];return _0x28e661;};'use strict';var _=require('lodash');var util=require(_0x4260('0x0'));var moment=require(_0x4260('0x1'));var BPromise=require('bluebird');var rs=require(_0x4260('0x2'));var fs=require('fs');var Redis=require(_0x4260('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4260('0x4'));var logger=require(_0x4260('0x5'))('rpc');var config=require(_0x4260('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4260('0x7')][_0x4260('0x8')]({'port':0x232a});config['redis']=_[_0x4260('0x9')](config[_0x4260('0xa')],{'host':_0x4260('0xb'),'port':0x18eb});var socket=require(_0x4260('0xc'))(new Redis(config[_0x4260('0xa')]));require(_0x4260('0xd'))['register'](socket);function respondWithRpcPromise(_0x1894d2,_0x53275c,_0x3d6e17){return new BPromise(function(_0x243cb9,_0x37cb44){return client['request'](_0x1894d2,_0x3d6e17)[_0x4260('0xe')](function(_0x4bcb1c){logger['info'](_0x4260('0xf'),_0x53275c,_0x4260('0x10'));logger[_0x4260('0x11')](_0x4260('0x12'),_0x53275c,_0x4260('0x10'),JSON[_0x4260('0x13')](_0x4bcb1c));if(_0x4bcb1c[_0x4260('0x14')]){if(_0x4bcb1c[_0x4260('0x14')][_0x4260('0x15')]===0x1f4){logger[_0x4260('0x14')](_0x4260('0xf'),_0x53275c,_0x4bcb1c[_0x4260('0x14')][_0x4260('0x16')]);return _0x37cb44(_0x4bcb1c['error'][_0x4260('0x16')]);}logger[_0x4260('0x14')](_0x4260('0xf'),_0x53275c,_0x4bcb1c['error'][_0x4260('0x16')]);return _0x243cb9(_0x4bcb1c[_0x4260('0x14')][_0x4260('0x16')]);}else{logger['info'](_0x4260('0xf'),_0x53275c,_0x4260('0x10'));_0x243cb9(_0x4bcb1c[_0x4260('0x17')][_0x4260('0x16')]);}})['catch'](function(_0xba812c){logger[_0x4260('0x14')](_0x4260('0xf'),_0x53275c,_0xba812c);_0x37cb44(_0xba812c);});});} \ No newline at end of file +var _0xf2fc=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x261d27,_0xe7ecfa){var _0x2641e6=function(_0x381973){while(--_0x381973){_0x261d27['push'](_0x261d27['shift']());}};_0x2641e6(++_0xe7ecfa);}(_0xf2fc,0xcc));var _0xcf2f=function(_0x4c5f2e,_0x1fb14d){_0x4c5f2e=_0x4c5f2e-0x0;var _0x2de143=_0xf2fc[_0x4c5f2e];return _0x2de143;};'use strict';var _=require(_0xcf2f('0x0'));var util=require(_0xcf2f('0x1'));var moment=require(_0xcf2f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf2f('0x3'));var db=require(_0xcf2f('0x4'))['db'];var utils=require(_0xcf2f('0x5'));var logger=require(_0xcf2f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf2f('0x7'));var client=jayson[_0xcf2f('0x8')]['http']({'port':0x232a});config[_0xcf2f('0x9')]=_[_0xcf2f('0xa')](config[_0xcf2f('0x9')],{'host':_0xcf2f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf2f('0x9')]));require('./chatWebsite.socket')[_0xcf2f('0xc')](socket);function respondWithRpcPromise(_0x420330,_0x843dc2,_0x342a85){return new BPromise(function(_0x5959aa,_0x4f03f6){return client[_0xcf2f('0xd')](_0x420330,_0x342a85)['then'](function(_0xdc1d87){logger[_0xcf2f('0xe')](_0xcf2f('0xf'),_0x843dc2,_0xcf2f('0x10'));logger[_0xcf2f('0x11')](_0xcf2f('0x12'),_0x843dc2,_0xcf2f('0x10'),JSON[_0xcf2f('0x13')](_0xdc1d87));if(_0xdc1d87[_0xcf2f('0x14')]){if(_0xdc1d87[_0xcf2f('0x14')][_0xcf2f('0x15')]===0x1f4){logger[_0xcf2f('0x14')](_0xcf2f('0xf'),_0x843dc2,_0xdc1d87[_0xcf2f('0x14')][_0xcf2f('0x16')]);return _0x4f03f6(_0xdc1d87[_0xcf2f('0x14')]['message']);}logger[_0xcf2f('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x843dc2,_0xdc1d87['error']['message']);return _0x5959aa(_0xdc1d87['error']['message']);}else{logger['info'](_0xcf2f('0xf'),_0x843dc2,'request\x20sent');_0x5959aa(_0xdc1d87[_0xcf2f('0x17')][_0xcf2f('0x16')]);}})[_0xcf2f('0x18')](function(_0x497327){logger[_0xcf2f('0x14')](_0xcf2f('0xf'),_0x843dc2,_0x497327);_0x4f03f6(_0x497327);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 1b94817..55d5d12 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 _0x871b=['update','emit','removeListener','register','length','./chatWebsite.events','remove'];(function(_0x1d174c,_0xd71a94){var _0x193cbf=function(_0x140302){while(--_0x140302){_0x1d174c['push'](_0x1d174c['shift']());}};_0x193cbf(++_0xd71a94);}(_0x871b,0x163));var _0xb871=function(_0x4af4c5,_0x593fbc){_0x4af4c5=_0x4af4c5-0x0;var _0x7b2daa=_0x871b[_0x4af4c5];return _0x7b2daa;};'use strict';var ChatWebsiteEvents=require(_0xb871('0x0'));var events=['save',_0xb871('0x1'),_0xb871('0x2')];function createListener(_0x5510c1,_0x50ac11){return function(_0x259ca3){_0x50ac11[_0xb871('0x3')](_0x5510c1,_0x259ca3);};}function removeListener(_0x372605,_0x56f8d0){return function(){ChatWebsiteEvents[_0xb871('0x4')](_0x372605,_0x56f8d0);};}exports[_0xb871('0x5')]=function(_0x521cfb){for(var _0x1a814f=0x0,_0x517c5e=events[_0xb871('0x6')];_0x1a814f<_0x517c5e;_0x1a814f++){var _0x11267f=events[_0x1a814f];var _0x314c21=createListener('chatWebsite:'+_0x11267f,_0x521cfb);ChatWebsiteEvents['on'](_0x11267f,_0x314c21);}}; \ No newline at end of file +var _0xcbf3=['length','./chatWebsite.events','save','emit','removeListener','register'];(function(_0x2eb091,_0x3c0d96){var _0x3f1266=function(_0x379edf){while(--_0x379edf){_0x2eb091['push'](_0x2eb091['shift']());}};_0x3f1266(++_0x3c0d96);}(_0xcbf3,0xa9));var _0x3cbf=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xcbf3[_0x1cb18a];return _0x22442e;};'use strict';var ChatWebsiteEvents=require(_0x3cbf('0x0'));var events=[_0x3cbf('0x1'),'remove','update'];function createListener(_0x3d176f,_0x2d1b50){return function(_0x38f475){_0x2d1b50[_0x3cbf('0x2')](_0x3d176f,_0x38f475);};}function removeListener(_0x2a5b3d,_0x35e2b4){return function(){ChatWebsiteEvents[_0x3cbf('0x3')](_0x2a5b3d,_0x35e2b4);};}exports[_0x3cbf('0x4')]=function(_0x39dc66){for(var _0x21a752=0x0,_0x5efbe7=events[_0x3cbf('0x5')];_0x21a752<_0x5efbe7;_0x21a752++){var _0x1e0e8b=events[_0x21a752];var _0x795f6c=createListener('chatWebsite:'+_0x1e0e8b,_0x39dc66);ChatWebsiteEvents['on'](_0x1e0e8b,_0x795f6c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7618c29..8e8a546 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 _0x9ff6=['/:id/dispositions','/:id/canned_answers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','originalname','/:id/logo','single','addLogo','server/files/images/avatars/','/:id/avatar','file','addCustomerAvatar','addSystemAvatar','/:id/notify','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addApplications','/:id/proactive_actions','addProactiveActions','put','update','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x9ff6,0x195));var _0x69ff=function(_0x25bd0c,_0x10a934){_0x25bd0c=_0x25bd0c-0x0;var _0x1c8e6e=_0x9ff6[_0x25bd0c];return _0x1c8e6e;};'use strict';var multer=require(_0x69ff('0x0'));var util=require(_0x69ff('0x1'));var path=require(_0x69ff('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x69ff('0x3')]();var fs_extra=require(_0x69ff('0x4'));var auth=require(_0x69ff('0x5'));var interaction=require(_0x69ff('0x6'));var config=require(_0x69ff('0x7'));var controller=require(_0x69ff('0x8'));router[_0x69ff('0x9')]('/',auth[_0x69ff('0xa')](),controller[_0x69ff('0xb')]);router[_0x69ff('0x9')](_0x69ff('0xc'),auth[_0x69ff('0xa')](),controller[_0x69ff('0xd')]);router[_0x69ff('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x69ff('0xe')]);router['get'](_0x69ff('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x69ff('0x9')](_0x69ff('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x69ff('0x9')]('/:id/logo',controller[_0x69ff('0x11')]);router[_0x69ff('0x9')]('/:id/avatar',controller[_0x69ff('0x12')]);router['get'](_0x69ff('0x13'),controller[_0x69ff('0x14')]);router[_0x69ff('0x9')](_0x69ff('0x15'),controller[_0x69ff('0x16')]);router[_0x69ff('0x9')](_0x69ff('0x17'),auth[_0x69ff('0xa')](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0x69ff('0x18')]);router[_0x69ff('0x9')](_0x69ff('0x19'),auth[_0x69ff('0xa')](),controller['getApplications']);router['get']('/:id/proactive_actions',auth[_0x69ff('0xa')](),controller[_0x69ff('0x1a')]);router[_0x69ff('0x9')](_0x69ff('0x1b'),controller['getFields']);router[_0x69ff('0x9')]('/:id/offline_messages',auth[_0x69ff('0xa')](),controller[_0x69ff('0x1c')]);router[_0x69ff('0x9')](_0x69ff('0x1d'),auth[_0x69ff('0xa')](),controller[_0x69ff('0x1e')]);router['post']('/',auth['isAuthenticated'](),controller[_0x69ff('0x1f')]);router[_0x69ff('0x20')](_0x69ff('0xf'),auth[_0x69ff('0xa')](),controller[_0x69ff('0x21')]);router[_0x69ff('0x20')](_0x69ff('0x10'),auth[_0x69ff('0xa')](),controller[_0x69ff('0x22')]);var upload=multer({'storage':multer[_0x69ff('0x23')]({'destination':function(_0x20e6c6,_0x39c3da,_0x33faef){_0x33faef(null,path[_0x69ff('0x24')](config[_0x69ff('0x25')],'server/files/images/logos/'));},'filename':function(_0xd49829,_0x561e56,_0x494294){_0x494294(null,util[_0x69ff('0x26')](_0x69ff('0x27'),Date[_0x69ff('0x28')](),_0x561e56[_0x69ff('0x29')]));}})});router[_0x69ff('0x20')](_0x69ff('0x2a'),upload[_0x69ff('0x2b')]('file'),controller[_0x69ff('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3dff2e,_0x2d9298,_0x4bf84f){_0x4bf84f(null,path['join'](config[_0x69ff('0x25')],_0x69ff('0x2d')));},'filename':function(_0x34d795,_0x2ed22f,_0x30d761){_0x30d761(null,util[_0x69ff('0x26')](_0x69ff('0x27'),Date[_0x69ff('0x28')](),_0x2ed22f[_0x69ff('0x29')]));}})});router[_0x69ff('0x20')](_0x69ff('0x2e'),upload[_0x69ff('0x2b')](_0x69ff('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7ed305,_0x3729df,_0x26ae9a){_0x26ae9a(null,path[_0x69ff('0x24')](config[_0x69ff('0x25')],_0x69ff('0x2d')));},'filename':function(_0x38d166,_0x322799,_0x4f6cd4){_0x4f6cd4(null,util[_0x69ff('0x26')]('%s-%s',Date[_0x69ff('0x28')](),_0x322799[_0x69ff('0x29')]));}})});router[_0x69ff('0x20')]('/:id/customer_avatar',upload['single'](_0x69ff('0x2f')),controller[_0x69ff('0x30')]);var upload=multer({'storage':multer[_0x69ff('0x23')]({'destination':function(_0x4c2dd2,_0x246945,_0x122ffa){_0x122ffa(null,path['join'](config[_0x69ff('0x25')],_0x69ff('0x2d')));},'filename':function(_0x54d9a2,_0x118786,_0x5755a3){_0x5755a3(null,util[_0x69ff('0x26')](_0x69ff('0x27'),Date[_0x69ff('0x28')](),_0x118786[_0x69ff('0x29')]));}})});router[_0x69ff('0x20')](_0x69ff('0x15'),upload[_0x69ff('0x2b')](_0x69ff('0x2f')),controller[_0x69ff('0x31')]);router[_0x69ff('0x20')](_0x69ff('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x69ff('0x23')]({'destination':function(_0xdfe294,_0x5ebd8c,_0xa89e7a){const _0x524dc8=path[_0x69ff('0x24')](config[_0x69ff('0x25')],'server/files',_0x69ff('0x33'),_0x69ff('0x34'));fs_extra[_0x69ff('0x35')](_0x524dc8,function(){_0xa89e7a(null,_0x524dc8);});},'filename':function(_0x14abb7,_0x36db91,_0x418189){const _0x453389=_0x36db91['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x305b00=path[_0x69ff('0x36')](_0x453389);const _0x5508b4=Date[_0x69ff('0x28')]()+'-'+_0x453389[_0x69ff('0x37')](_0x305b00,'')+_0x305b00;_0x418189(null,_0x5508b4);}})});router[_0x69ff('0x20')](_0x69ff('0x38'),offlineUploadMulter[_0x69ff('0x39')](),controller[_0x69ff('0x3a')]);router['post'](_0x69ff('0x17'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x69ff('0x20')](_0x69ff('0x19'),auth[_0x69ff('0xa')](),controller[_0x69ff('0x3b')]);router[_0x69ff('0x20')](_0x69ff('0x3c'),auth[_0x69ff('0xa')](),controller[_0x69ff('0x3d')]);router['post'](_0x69ff('0x1d'),auth[_0x69ff('0xa')](),controller['addAgents']);router[_0x69ff('0x3e')]('/:id',auth[_0x69ff('0xa')](),controller[_0x69ff('0x3f')]);router['delete'](_0x69ff('0x40'),auth[_0x69ff('0xa')](),controller['destroy']);router[_0x69ff('0x41')](_0x69ff('0xf'),auth['isAuthenticated'](),controller[_0x69ff('0x42')]);router[_0x69ff('0x41')](_0x69ff('0x10'),auth[_0x69ff('0xa')](),controller[_0x69ff('0x43')]);router[_0x69ff('0x41')](_0x69ff('0x1d'),auth['isAuthenticated'](),controller[_0x69ff('0x44')]);module[_0x69ff('0x45')]=router; \ No newline at end of file +var _0xbc19=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getAgents','post','join','root','format','%s-%s','originalname','single','file','diskStorage','now','addAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','/:id/users','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller'];(function(_0x4fd311,_0x555903){var _0x55bc54=function(_0x30eed6){while(--_0x30eed6){_0x4fd311['push'](_0x4fd311['shift']());}};_0x55bc54(++_0x555903);}(_0xbc19,0x108));var _0x9bc1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbc19[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x9bc1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9bc1('0x1'));var router=express[_0x9bc1('0x2')]();var fs_extra=require(_0x9bc1('0x3'));var auth=require(_0x9bc1('0x4'));var interaction=require(_0x9bc1('0x5'));var config=require(_0x9bc1('0x6'));var controller=require(_0x9bc1('0x7'));router[_0x9bc1('0x8')]('/',auth[_0x9bc1('0x9')](),controller[_0x9bc1('0xa')]);router['get'](_0x9bc1('0xb'),auth[_0x9bc1('0x9')](),controller[_0x9bc1('0xc')]);router['get'](_0x9bc1('0xd'),auth[_0x9bc1('0x9')](),controller[_0x9bc1('0xe')]);router['get'](_0x9bc1('0xf'),auth[_0x9bc1('0x9')](),controller['getDispositions']);router['get'](_0x9bc1('0x10'),auth[_0x9bc1('0x9')](),controller[_0x9bc1('0x11')]);router['get'](_0x9bc1('0x12'),controller[_0x9bc1('0x13')]);router[_0x9bc1('0x8')](_0x9bc1('0x14'),controller[_0x9bc1('0x15')]);router['get'](_0x9bc1('0x16'),controller['getCustomerAvatar']);router[_0x9bc1('0x8')](_0x9bc1('0x17'),controller[_0x9bc1('0x18')]);router[_0x9bc1('0x8')](_0x9bc1('0x19'),auth[_0x9bc1('0x9')](),controller[_0x9bc1('0x1a')]);router[_0x9bc1('0x8')](_0x9bc1('0x1b'),controller[_0x9bc1('0x1c')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x9bc1('0x1d')]);router[_0x9bc1('0x8')]('/:id/proactive_actions',auth[_0x9bc1('0x9')](),controller[_0x9bc1('0x1e')]);router['get'](_0x9bc1('0x1f'),controller['getFields']);router['get'](_0x9bc1('0x20'),auth[_0x9bc1('0x9')](),controller['getOfflineMessages']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x9bc1('0x21')]);router[_0x9bc1('0x22')]('/',auth[_0x9bc1('0x9')](),controller['create']);router[_0x9bc1('0x22')](_0x9bc1('0xf'),auth[_0x9bc1('0x9')](),controller['addDisposition']);router[_0x9bc1('0x22')]('/:id/canned_answers',auth[_0x9bc1('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa59c82,_0x3b8dbb,_0x2f6370){_0x2f6370(null,path[_0x9bc1('0x23')](config[_0x9bc1('0x24')],'server/files/images/logos/'));},'filename':function(_0x506b37,_0x159ea0,_0x27d56d){_0x27d56d(null,util[_0x9bc1('0x25')](_0x9bc1('0x26'),Date['now'](),_0x159ea0[_0x9bc1('0x27')]));}})});router[_0x9bc1('0x22')]('/:id/logo',upload[_0x9bc1('0x28')](_0x9bc1('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0x9bc1('0x2a')]({'destination':function(_0x2c471b,_0x42568a,_0x3e2fbb){_0x3e2fbb(null,path['join'](config[_0x9bc1('0x24')],'server/files/images/avatars/'));},'filename':function(_0xb48815,_0x2adcca,_0x8820ab){_0x8820ab(null,util[_0x9bc1('0x25')](_0x9bc1('0x26'),Date[_0x9bc1('0x2b')](),_0x2adcca[_0x9bc1('0x27')]));}})});router['post'](_0x9bc1('0x14'),upload[_0x9bc1('0x28')](_0x9bc1('0x29')),controller[_0x9bc1('0x2c')]);var upload=multer({'storage':multer[_0x9bc1('0x2a')]({'destination':function(_0x1133b2,_0x4680e4,_0x1e982b){_0x1e982b(null,path[_0x9bc1('0x23')](config[_0x9bc1('0x24')],_0x9bc1('0x2d')));},'filename':function(_0xbc80f3,_0x65ded,_0xea523){_0xea523(null,util[_0x9bc1('0x25')]('%s-%s',Date[_0x9bc1('0x2b')](),_0x65ded[_0x9bc1('0x27')]));}})});router['post']('/:id/customer_avatar',upload[_0x9bc1('0x28')](_0x9bc1('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4031aa,_0x4b8de2,_0x35b6b7){_0x35b6b7(null,path[_0x9bc1('0x23')](config[_0x9bc1('0x24')],'server/files/images/avatars/'));},'filename':function(_0x389bee,_0x10d668,_0x47345c){_0x47345c(null,util[_0x9bc1('0x25')](_0x9bc1('0x26'),Date[_0x9bc1('0x2b')](),_0x10d668[_0x9bc1('0x27')]));}})});router[_0x9bc1('0x22')]('/:id/system_avatar',upload[_0x9bc1('0x28')](_0x9bc1('0x29')),controller[_0x9bc1('0x2e')]);router[_0x9bc1('0x22')](_0x9bc1('0x2f'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x9bc1('0x2a')]({'destination':function(_0x3535f,_0x1fbbba,_0x1fbdd3){const _0x259e81=path[_0x9bc1('0x23')](config[_0x9bc1('0x24')],_0x9bc1('0x30'),'attachments',_0x9bc1('0x31'));fs_extra[_0x9bc1('0x32')](_0x259e81,function(){_0x1fbdd3(null,_0x259e81);});},'filename':function(_0x194a07,_0x5b0655,_0x15f061){const _0x51d36b=_0x5b0655[_0x9bc1('0x27')][_0x9bc1('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x225417=path[_0x9bc1('0x34')](_0x51d36b);const _0x5e66bd=Date[_0x9bc1('0x2b')]()+'-'+_0x51d36b[_0x9bc1('0x33')](_0x225417,'')+_0x225417;_0x15f061(null,_0x5e66bd);}})});router[_0x9bc1('0x22')](_0x9bc1('0x35'),offlineUploadMulter[_0x9bc1('0x36')](),controller[_0x9bc1('0x37')]);router['post'](_0x9bc1('0x19'),auth[_0x9bc1('0x9')](),controller[_0x9bc1('0x38')]);router[_0x9bc1('0x22')](_0x9bc1('0x39'),auth[_0x9bc1('0x9')](),controller[_0x9bc1('0x3a')]);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x9bc1('0x3b')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x9bc1('0x3c')]);router[_0x9bc1('0x3d')](_0x9bc1('0xd'),auth['isAuthenticated'](),controller[_0x9bc1('0x3e')]);router[_0x9bc1('0x3f')]('/:id',auth['isAuthenticated'](),controller[_0x9bc1('0x40')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x9bc1('0x10'),auth[_0x9bc1('0x9')](),controller[_0x9bc1('0x41')]);router[_0x9bc1('0x3f')](_0x9bc1('0x42'),auth[_0x9bc1('0x9')](),controller['removeAgents']);module[_0x9bc1('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4600068..813be42 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 _0x9eaf=['client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','exports','../components/auth/service','../config/environment','env','production','app'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x9eaf,0x151));var _0xf9ea=function(_0x4478b1,_0x304872){_0x4478b1=_0x4478b1-0x0;var _0x50942e=_0x9eaf[_0x4478b1];return _0x50942e;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xf9ea('0x0'));var config=require(_0xf9ea('0x1'));var router=express['Router']();var isProduction=config[_0xf9ea('0x2')]===_0xf9ea('0x3')||![];function clientSideLogs(_0x501e89,_0x7dfc07,_0x4bf43d){var _0x5dd2d9=_0x501e89[_0xf9ea('0x4')]['get'](_0xf9ea('0x5'));if(!_0x5dd2d9){throw new Error(_0xf9ea('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0xf9ea('0x7'),'logger':_0x5dd2d9,'enableCors':!isProduction})(_0x501e89,_0x7dfc07,_0x4bf43d);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0xf9ea('0x8')]=router; \ No newline at end of file +var _0x684e=['express','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','beaver-logger/server'];(function(_0x8fb035,_0x217b6d){var _0x3a678d=function(_0x29d401){while(--_0x29d401){_0x8fb035['push'](_0x8fb035['shift']());}};_0x3a678d(++_0x217b6d);}(_0x684e,0x1df));var _0xe684=function(_0xf5ad72,_0x260d39){_0xf5ad72=_0xf5ad72-0x0;var _0x22e3c6=_0x684e[_0xf5ad72];return _0x22e3c6;};var beaverLogger=require(_0xe684('0x0'));var express=require(_0xe684('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0xe684('0x2')]();var isProduction=config[_0xe684('0x3')]===_0xe684('0x4')||![];function clientSideLogs(_0x97c4d,_0x7d772d,_0x394fbe){var _0x594a80=_0x97c4d[_0xe684('0x5')]['get'](_0xe684('0x6'));if(!_0x594a80){throw new Error(_0xe684('0x7'));}return beaverLogger[_0xe684('0x8')]({'uri':'/client-logs','logger':_0x594a80,'enableCors':!isProduction})(_0x97c4d,_0x7d772d,_0x394fbe);}router['use'](auth[_0xe684('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 92392ef..e0ab42d 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 _0x4c9c=['STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token'];(function(_0x4ef618,_0x1d2f85){var _0x5d2c88=function(_0x403a33){while(--_0x403a33){_0x4ef618['push'](_0x4ef618['shift']());}};_0x5d2c88(++_0x1d2f85);}(_0x4c9c,0x180));var _0xc4c9=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x4c9c[_0x90a39a];return _0x2b62f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc4c9('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc4c9('0x1')](_0xc4c9('0x2'),_0xc4c9('0x3'),_0xc4c9('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc4c9('0x1')]('Outlook365',_0xc4c9('0x5'))},'data1':{'type':Sequelize[_0xc4c9('0x0')],'comment':_0xc4c9('0x6')},'data2':{'type':Sequelize[_0xc4c9('0x0')],'comment':_0xc4c9('0x7')},'data3':{'type':Sequelize[_0xc4c9('0x0')],'comment':_0xc4c9('0x8')},'data4':{'type':Sequelize[_0xc4c9('0x0')],'comment':_0xc4c9('0x9')},'data5':{'type':Sequelize[_0xc4c9('0xa')],'comment':_0xc4c9('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xc4c9('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xe2e0=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','Outlook365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2e0,0x13c));var _0x0e2e=function(_0x5668db,_0x149b9a){_0x5668db=_0x5668db-0x0;var _0x9335dc=_0xe2e0[_0x5668db];return _0x9335dc;};'use strict';var Sequelize=require(_0x0e2e('0x0'));module[_0x0e2e('0x1')]={'name':{'type':Sequelize[_0x0e2e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0e2e('0x3')]('AmazonAWS',_0x0e2e('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0e2e('0x3')](_0x0e2e('0x5'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x0e2e('0x2')],'comment':_0x0e2e('0x6')},'data3':{'type':Sequelize['STRING'],'comment':_0x0e2e('0x7')},'data4':{'type':Sequelize[_0x0e2e('0x2')],'comment':_0x0e2e('0x8')},'data5':{'type':Sequelize[_0x0e2e('0x9')],'comment':_0x0e2e('0xa')},'data6':{'type':Sequelize[_0x0e2e('0x9')],'comment':_0x0e2e('0xb')},'data7':{'type':Sequelize[_0x0e2e('0x9')],'comment':_0x0e2e('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 959ce18..636d811 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 _0x8847=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','findAll','rows','service','decryptString','data3','catch','show','params','length','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','destroy','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','limit','count','set','Content-Range','then','end','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','model','query'];(function(_0x1914dd,_0x4da4f8){var _0x35b411=function(_0x3b239f){while(--_0x3b239f){_0x1914dd['push'](_0x1914dd['shift']());}};_0x35b411(++_0x4da4f8);}(_0x8847,0x9b));var _0x7884=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8847[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var Redis=require(_0x7884('0x0'));var qs=require(_0x7884('0x1'));var encryptor=require(_0x7884('0x2'));var config=require(_0x7884('0x3'));var logger=require(_0x7884('0x4'))('api');var db=require(_0x7884('0x5'))['db'];var oauth=require(_0x7884('0x6'));config[_0x7884('0x7')]=_[_0x7884('0x8')](config[_0x7884('0x7')],{'host':_0x7884('0x9'),'port':0x18eb});var socket=require(_0x7884('0xa'))(new Redis(config[_0x7884('0x7')]));var redis=new Redis(config[_0x7884('0x7')]);function respondWithStatusCode(_0x53f9c8,_0x5b1210){_0x5b1210=_0x5b1210||0xcc;return function(_0x5d52ff){if(_0x5d52ff){return _0x53f9c8[_0x7884('0xb')](_0x5b1210);}return _0x53f9c8[_0x7884('0xc')](_0x5b1210)['end']();};}function respondWithResult(_0x4da5a8,_0x3631f8){_0x3631f8=_0x3631f8||0xc8;return function(_0x128219){if(_0x128219){return _0x4da5a8[_0x7884('0xc')](_0x3631f8)['json'](_0x128219);}};}function respondWithFilteredResult(_0x32fdc3,_0xb30230){return function(_0x19932c){if(_0x19932c){var _0x1c890b=typeof _0xb30230[_0x7884('0xd')]===_0x7884('0xe')&&typeof _0xb30230[_0x7884('0xf')]===_0x7884('0xe');var _0x11477a=_0x19932c[_0x7884('0x10')];var _0x211f72=_0x1c890b?0x0:_0xb30230['offset'];var _0x4e55a5=_0x1c890b?_0x19932c[_0x7884('0x10')]:_0xb30230[_0x7884('0xd')]+_0xb30230[_0x7884('0xf')];var _0x47e4ae;if(_0x4e55a5>=_0x11477a){_0x4e55a5=_0x11477a;_0x47e4ae=0xc8;}else{_0x47e4ae=0xce;}_0x32fdc3['status'](_0x47e4ae);return _0x32fdc3[_0x7884('0x11')](_0x7884('0x12'),_0x211f72+'-'+_0x4e55a5+'/'+_0x11477a)['json'](_0x19932c);}return null;};}function saveUpdates(_0x409bb3){return function(_0x443a0a){if(_0x443a0a){return _0x443a0a['update'](_0x409bb3)[_0x7884('0x13')](function(_0x565019){return _0x565019;});}return null;};}function removeEntity(_0x99539b){return function(_0x58d2fb){if(_0x58d2fb){return _0x58d2fb['destroy']()[_0x7884('0x13')](function(){_0x99539b[_0x7884('0xc')](0xcc)[_0x7884('0x14')]();});}};}function handleEntityNotFound(_0x1db132){return function(_0x2517d7){if(!_0x2517d7){_0x1db132[_0x7884('0xb')](0x194);}return _0x2517d7;};}function handleError(_0x2991a3,_0x440ebb){_0x440ebb=_0x440ebb||0x1f4;return function(_0xf29569){logger[_0x7884('0x15')](_0xf29569[_0x7884('0x16')]);if(_0xf29569[_0x7884('0x17')]){delete _0xf29569[_0x7884('0x17')];}_0x2991a3[_0x7884('0xc')](_0x440ebb)[_0x7884('0x18')](_0xf29569);};}function maskClientSecret(_0x14a53e){return _[_0x7884('0x19')](_0x14a53e[_0x7884('0x1a')](0x0,0x3),0x14,'*');}exports[_0x7884('0x1b')]=function(_0x10190d,_0x5af397){var _0x5397be={},_0x185b4c={},_0x1b4523={'count':0x0,'rows':[]};var _0x2acd84=_[_0x7884('0x1c')](db[_0x7884('0x1d')][_0x7884('0x1e')],function(_0x280332){return{'name':_0x280332[_0x7884('0x1f')],'type':_0x280332[_0x7884('0x20')]['key']};});_0x185b4c[_0x7884('0x21')]=_[_0x7884('0x1c')](_0x2acd84,_0x7884('0x17'));_0x185b4c[_0x7884('0x22')]=_[_0x7884('0x23')](_0x10190d[_0x7884('0x22')]);_0x185b4c[_0x7884('0x24')]=_[_0x7884('0x25')](_0x185b4c[_0x7884('0x21')],_0x185b4c[_0x7884('0x22')]);_0x5397be[_0x7884('0x26')]=_[_0x7884('0x25')](_0x185b4c[_0x7884('0x21')],qs[_0x7884('0x27')](_0x10190d[_0x7884('0x22')][_0x7884('0x27')]));_0x5397be['attributes']=_0x5397be['attributes']['length']?_0x5397be[_0x7884('0x26')]:_0x185b4c['model'];if(!_0x10190d[_0x7884('0x22')][_0x7884('0x28')](_0x7884('0x29'))){_0x5397be[_0x7884('0xf')]=qs['limit'](_0x10190d[_0x7884('0x22')][_0x7884('0xf')]);_0x5397be[_0x7884('0xd')]=qs[_0x7884('0xd')](_0x10190d['query'][_0x7884('0xd')]);}_0x5397be['order']=qs[_0x7884('0x2a')](_0x10190d[_0x7884('0x22')]['sort']);_0x5397be[_0x7884('0x2b')]=qs[_0x7884('0x24')](_[_0x7884('0x2c')](_0x10190d['query'],_0x185b4c[_0x7884('0x24')]),_0x2acd84);if(_0x10190d[_0x7884('0x22')]['filter']){_0x5397be[_0x7884('0x2b')]=_[_0x7884('0x2d')](_0x5397be['where'],{'$or':_[_0x7884('0x1c')](_0x2acd84,function(_0x412208){if(_0x412208[_0x7884('0x20')]!=='VIRTUAL'){var _0x3f3eb3={};_0x3f3eb3[_0x412208[_0x7884('0x17')]]={'$like':'%'+_0x10190d[_0x7884('0x22')][_0x7884('0x2e')]+'%'};return _0x3f3eb3;}})});}_0x5397be=_[_0x7884('0x2d')]({},_0x5397be,_0x10190d[_0x7884('0x2f')]);var _0x44bdb5={'where':_0x5397be[_0x7884('0x2b')]};return db[_0x7884('0x1d')][_0x7884('0x10')](_0x44bdb5)[_0x7884('0x13')](function(_0x3d03be){_0x1b4523[_0x7884('0x10')]=_0x3d03be;if(_0x10190d[_0x7884('0x22')]['includeAll']){_0x5397be[_0x7884('0x30')]=[{'all':!![]}];}return db[_0x7884('0x1d')][_0x7884('0x31')](_0x5397be);})[_0x7884('0x13')](function(_0x3abce7){_0x1b4523[_0x7884('0x32')]=_[_0x7884('0x1c')](_0x3abce7,function(_0x55eb80){if(_0x55eb80[_0x7884('0x33')]==='MicrosoftAzure'){var _0x1a1815=encryptor[_0x7884('0x34')](_0x55eb80[_0x7884('0x35')]);_0x55eb80[_0x7884('0x35')]=maskClientSecret(_0x1a1815);}return _0x55eb80;});return _0x1b4523;})[_0x7884('0x13')](respondWithFilteredResult(_0x5af397,_0x5397be))[_0x7884('0x36')](handleError(_0x5af397,null));};exports[_0x7884('0x37')]=function(_0x30eef0,_0x58cdfa){var _0x44989={'raw':!![],'where':{'id':_0x30eef0[_0x7884('0x38')]['id']}},_0x2a5987={};_0x2a5987['model']=_['keys'](db[_0x7884('0x1d')][_0x7884('0x1e')]);_0x2a5987['query']=_['keys'](_0x30eef0[_0x7884('0x22')]);_0x2a5987[_0x7884('0x24')]=_[_0x7884('0x25')](_0x2a5987['model'],_0x2a5987[_0x7884('0x22')]);_0x44989[_0x7884('0x26')]=_['intersection'](_0x2a5987[_0x7884('0x21')],qs[_0x7884('0x27')](_0x30eef0[_0x7884('0x22')][_0x7884('0x27')]));_0x44989[_0x7884('0x26')]=_0x44989[_0x7884('0x26')][_0x7884('0x39')]?_0x44989[_0x7884('0x26')]:_0x2a5987[_0x7884('0x21')];if(_0x30eef0[_0x7884('0x22')]['includeAll']){_0x44989[_0x7884('0x30')]=[{'all':!![]}];}_0x44989=_[_0x7884('0x2d')]({},_0x44989,_0x30eef0[_0x7884('0x2f')]);return db[_0x7884('0x1d')][_0x7884('0x3a')](_0x44989)[_0x7884('0x13')](handleEntityNotFound(_0x58cdfa,null))[_0x7884('0x13')](function(_0x4fd741){if(_0x4fd741[_0x7884('0x33')]==='MicrosoftAzure'){var _0x26afd7=encryptor[_0x7884('0x34')](_0x4fd741['data3']);_0x4fd741['data3']=maskClientSecret(_0x26afd7);}return _0x4fd741;})[_0x7884('0x13')](respondWithResult(_0x58cdfa,null))[_0x7884('0x36')](handleError(_0x58cdfa,null));};exports[_0x7884('0x3b')]=function(_0x51e3ae,_0x5bd81f){if(!_0x51e3ae[_0x7884('0x3c')][_0x7884('0x17')])throw new Error(_0x7884('0x3d'));if(!_0x51e3ae[_0x7884('0x3c')][_0x7884('0x33')])throw new Error(_0x7884('0x3e'));var _0x5718a8=db[_0x7884('0x1d')][_0x7884('0x1e')][_0x7884('0x33')][_0x7884('0x3f')];if(!_0x5718a8[_0x7884('0x40')](_0x51e3ae[_0x7884('0x3c')]['service']))throw new Error(_0x7884('0x41')+_0x5718a8[_0x7884('0x42')](',\x20'));if(_0x51e3ae[_0x7884('0x3c')][_0x7884('0x33')]===_0x7884('0x43')&&_0x51e3ae[_0x7884('0x3c')]['data3']){_0x51e3ae[_0x7884('0x3c')][_0x7884('0x35')]=encryptor['encryptString'](_0x51e3ae[_0x7884('0x3c')][_0x7884('0x35')]);}return db[_0x7884('0x1d')][_0x7884('0x3b')](_0x51e3ae[_0x7884('0x3c')],{})[_0x7884('0x13')](respondWithResult(_0x5bd81f,0xc9))[_0x7884('0x36')](handleError(_0x5bd81f,null));};exports['update']=function(_0x17a57c,_0x1c46bc){if(_0x17a57c[_0x7884('0x3c')]['id']){delete _0x17a57c[_0x7884('0x3c')]['id'];}return db[_0x7884('0x1d')][_0x7884('0x3a')]({'where':{'id':_0x17a57c['params']['id']}})[_0x7884('0x13')](handleEntityNotFound(_0x1c46bc,null))['then'](function(_0x515f03){if(_0x515f03[_0x7884('0x33')]==='MicrosoftAzure'&&_0x17a57c[_0x7884('0x3c')][_0x7884('0x35')]){_0x17a57c['body'][_0x7884('0x35')]=encryptor[_0x7884('0x44')](_0x17a57c['body'][_0x7884('0x35')]);}return _0x515f03;})['then'](saveUpdates(_0x17a57c['body'],null))['then'](respondWithResult(_0x1c46bc,null))['catch'](handleError(_0x1c46bc,null));};exports[_0x7884('0x45')]=function(_0x1e9c61,_0x485ba4){return db[_0x7884('0x1d')][_0x7884('0x3a')]({'where':{'id':_0x1e9c61[_0x7884('0x38')]['id']}})['then'](handleEntityNotFound(_0x485ba4,null))['then'](removeEntity(_0x485ba4,null))['catch'](handleError(_0x485ba4,null));};exports[_0x7884('0x46')]=function(_0x38ad67,_0x227c93){return db['CloudProvider']['findOne']({'where':{'id':_0x38ad67['params']['id']},'raw':!![]})[_0x7884('0x13')](function(_0x4dde4b){if(!_0x4dde4b)return _0x227c93['sendStatus'](0x194);return{'url':oauth[_0x7884('0x47')](_0x4dde4b,_0x38ad67[_0x7884('0x48')]['id'])};})[_0x7884('0x13')](respondWithResult(_0x227c93,null))[_0x7884('0x36')](handleError(_0x227c93,null));};exports[_0x7884('0x49')]=function(_0x5c1ee5,_0x1d26f5){var _0x36c619=_0x5c1ee5[_0x7884('0x3c')];var _0x3232e;var _0x579583;if(_0x36c619[_0x7884('0x15')])throw _0x36c619;redis[_0x7884('0x4a')](_0x36c619[_0x7884('0x4b')])['then'](function(_0x3e3b78){if(!_0x3e3b78)throw new Error(_0x7884('0x4c'));_0x3232e=JSON[_0x7884('0x4d')](_0x3e3b78);var _0x5770c9=Buffer[_0x7884('0x4e')](_0x36c619[_0x7884('0x4b')],_0x7884('0x4f'))[_0x7884('0x50')](_0x7884('0x51'));_0x579583=JSON[_0x7884('0x4d')](_0x5770c9);if(!oauth[_0x7884('0x52')](_0x36c619['id_token'],_0x3232e['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x7884('0x53')](_0x36c619[_0x7884('0x4b')]);return oauth[_0x7884('0x54')](_0x36c619[_0x7884('0x55')],_0x3232e);})[_0x7884('0x13')](function(_0x367730){_0x3232e['data5']=_0x367730[_0x7884('0x56')];_0x3232e[_0x7884('0x57')]=_0x367730[_0x7884('0x58')];return db['CloudProvider']['update']({'data5':_0x3232e[_0x7884('0x59')],'data6':_0x3232e[_0x7884('0x57')]},{'where':{'id':_0x3232e['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x3232e);socket[_0x7884('0x5a')]('microsoftAuthorization:success',{'id':_0x579583['id']});return;})[_0x7884('0x13')](respondWithStatusCode(_0x1d26f5,null))[_0x7884('0x36')](function(_0x44bc26){if(_0x579583){socket[_0x7884('0x5a')](_0x7884('0x5b'),{'id':_0x579583['id']});}if(!_0x3232e){logger[_0x7884('0x15')](_0x7884('0x5c'),_0x44bc26);return _0x1d26f5[_0x7884('0xc')](0x1f4)[_0x7884('0x18')](_0x44bc26[_0x7884('0x5d')]);}logger[_0x7884('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x3232e['id'],JSON[_0x7884('0x5e')](_0x44bc26));});}; \ No newline at end of file +var _0xe203=['Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','socket.io-emitter','status','json','undefined','limit','count','offset','set','Content-Range','update','end','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','include','find','service','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','params','sendStatus','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','id_token','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','microsoftAuthorization:success','microsoftAuthorization:error'];(function(_0x43e097,_0x33e351){var _0x1bb782=function(_0xf9992){while(--_0xf9992){_0x43e097['push'](_0x43e097['shift']());}};_0x1bb782(++_0x33e351);}(_0xe203,0x177));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e20('0x0'));var Redis=require(_0x3e20('0x1'));var qs=require(_0x3e20('0x2'));var encryptor=require(_0x3e20('0x3'));var config=require(_0x3e20('0x4'));var logger=require(_0x3e20('0x5'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x3e20('0x6'));config[_0x3e20('0x7')]=_['defaults'](config[_0x3e20('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e20('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x3e20('0x7')]);function respondWithStatusCode(_0x34be99,_0x31f914){_0x31f914=_0x31f914||0xcc;return function(_0xb78b0f){if(_0xb78b0f){return _0x34be99['sendStatus'](_0x31f914);}return _0x34be99[_0x3e20('0x9')](_0x31f914)['end']();};}function respondWithResult(_0x1ea79b,_0x8ab60a){_0x8ab60a=_0x8ab60a||0xc8;return function(_0x19b075){if(_0x19b075){return _0x1ea79b[_0x3e20('0x9')](_0x8ab60a)[_0x3e20('0xa')](_0x19b075);}};}function respondWithFilteredResult(_0x12145f,_0x2fea2d){return function(_0x576436){if(_0x576436){var _0x471b92=typeof _0x2fea2d['offset']===_0x3e20('0xb')&&typeof _0x2fea2d[_0x3e20('0xc')]==='undefined';var _0x472bcc=_0x576436[_0x3e20('0xd')];var _0x834fac=_0x471b92?0x0:_0x2fea2d['offset'];var _0x2872cc=_0x471b92?_0x576436[_0x3e20('0xd')]:_0x2fea2d[_0x3e20('0xe')]+_0x2fea2d[_0x3e20('0xc')];var _0x18c2c6;if(_0x2872cc>=_0x472bcc){_0x2872cc=_0x472bcc;_0x18c2c6=0xc8;}else{_0x18c2c6=0xce;}_0x12145f['status'](_0x18c2c6);return _0x12145f[_0x3e20('0xf')](_0x3e20('0x10'),_0x834fac+'-'+_0x2872cc+'/'+_0x472bcc)[_0x3e20('0xa')](_0x576436);}return null;};}function saveUpdates(_0x257690){return function(_0x7e1ac9){if(_0x7e1ac9){return _0x7e1ac9[_0x3e20('0x11')](_0x257690)['then'](function(_0x1e6e18){return _0x1e6e18;});}return null;};}function removeEntity(_0x242a15){return function(_0x2108fa){if(_0x2108fa){return _0x2108fa['destroy']()['then'](function(){_0x242a15['status'](0xcc)[_0x3e20('0x12')]();});}};}function handleEntityNotFound(_0x4845d1){return function(_0x88d269){if(!_0x88d269){_0x4845d1['sendStatus'](0x194);}return _0x88d269;};}function handleError(_0x330b8a,_0x90f3b5){_0x90f3b5=_0x90f3b5||0x1f4;return function(_0x3634f0){logger[_0x3e20('0x13')](_0x3634f0[_0x3e20('0x14')]);if(_0x3634f0[_0x3e20('0x15')]){delete _0x3634f0['name'];}_0x330b8a[_0x3e20('0x9')](_0x90f3b5)[_0x3e20('0x16')](_0x3634f0);};}function maskClientSecret(_0x54430a){return _['padEnd'](_0x54430a[_0x3e20('0x17')](0x0,0x3),0x14,'*');}exports[_0x3e20('0x18')]=function(_0x2cbfab,_0x52183){var _0x569d2a={},_0x13ee06={},_0x399225={'count':0x0,'rows':[]};var _0x5af6f1=_[_0x3e20('0x19')](db[_0x3e20('0x1a')][_0x3e20('0x1b')],function(_0x2532d1){return{'name':_0x2532d1['fieldName'],'type':_0x2532d1[_0x3e20('0x1c')][_0x3e20('0x1d')]};});_0x13ee06[_0x3e20('0x1e')]=_[_0x3e20('0x19')](_0x5af6f1,'name');_0x13ee06[_0x3e20('0x1f')]=_[_0x3e20('0x20')](_0x2cbfab[_0x3e20('0x1f')]);_0x13ee06[_0x3e20('0x21')]=_['intersection'](_0x13ee06['model'],_0x13ee06['query']);_0x569d2a[_0x3e20('0x22')]=_[_0x3e20('0x23')](_0x13ee06[_0x3e20('0x1e')],qs[_0x3e20('0x24')](_0x2cbfab[_0x3e20('0x1f')][_0x3e20('0x24')]));_0x569d2a[_0x3e20('0x22')]=_0x569d2a['attributes'][_0x3e20('0x25')]?_0x569d2a[_0x3e20('0x22')]:_0x13ee06[_0x3e20('0x1e')];if(!_0x2cbfab['query'][_0x3e20('0x26')](_0x3e20('0x27'))){_0x569d2a[_0x3e20('0xc')]=qs['limit'](_0x2cbfab[_0x3e20('0x1f')][_0x3e20('0xc')]);_0x569d2a[_0x3e20('0xe')]=qs[_0x3e20('0xe')](_0x2cbfab[_0x3e20('0x1f')]['offset']);}_0x569d2a['order']=qs[_0x3e20('0x28')](_0x2cbfab[_0x3e20('0x1f')][_0x3e20('0x28')]);_0x569d2a[_0x3e20('0x29')]=qs[_0x3e20('0x21')](_[_0x3e20('0x2a')](_0x2cbfab['query'],_0x13ee06[_0x3e20('0x21')]),_0x5af6f1);if(_0x2cbfab['query'][_0x3e20('0x2b')]){_0x569d2a['where']=_[_0x3e20('0x2c')](_0x569d2a[_0x3e20('0x29')],{'$or':_[_0x3e20('0x19')](_0x5af6f1,function(_0x3ab621){if(_0x3ab621[_0x3e20('0x1c')]!=='VIRTUAL'){var _0x2d3fe1={};_0x2d3fe1[_0x3ab621[_0x3e20('0x15')]]={'$like':'%'+_0x2cbfab[_0x3e20('0x1f')]['filter']+'%'};return _0x2d3fe1;}})});}_0x569d2a=_['merge']({},_0x569d2a,_0x2cbfab[_0x3e20('0x2d')]);var _0x3e7af9={'where':_0x569d2a[_0x3e20('0x29')]};return db[_0x3e20('0x1a')][_0x3e20('0xd')](_0x3e7af9)[_0x3e20('0x2e')](function(_0x5d8c0d){_0x399225[_0x3e20('0xd')]=_0x5d8c0d;if(_0x2cbfab['query'][_0x3e20('0x2f')]){_0x569d2a['include']=[{'all':!![]}];}return db[_0x3e20('0x1a')][_0x3e20('0x30')](_0x569d2a);})[_0x3e20('0x2e')](function(_0x12b2e5){_0x399225[_0x3e20('0x31')]=_[_0x3e20('0x19')](_0x12b2e5,function(_0x32c6bb){if(_0x32c6bb['service']===_0x3e20('0x32')){var _0x84ffdf=encryptor[_0x3e20('0x33')](_0x32c6bb['data3']);_0x32c6bb[_0x3e20('0x34')]=maskClientSecret(_0x84ffdf);}return _0x32c6bb;});return _0x399225;})['then'](respondWithFilteredResult(_0x52183,_0x569d2a))[_0x3e20('0x35')](handleError(_0x52183,null));};exports[_0x3e20('0x36')]=function(_0x1a1b2e,_0x58557f){var _0x3636a1={'raw':!![],'where':{'id':_0x1a1b2e['params']['id']}},_0x295c63={};_0x295c63[_0x3e20('0x1e')]=_[_0x3e20('0x20')](db['CloudProvider']['rawAttributes']);_0x295c63['query']=_[_0x3e20('0x20')](_0x1a1b2e[_0x3e20('0x1f')]);_0x295c63[_0x3e20('0x21')]=_[_0x3e20('0x23')](_0x295c63['model'],_0x295c63[_0x3e20('0x1f')]);_0x3636a1['attributes']=_['intersection'](_0x295c63[_0x3e20('0x1e')],qs['fields'](_0x1a1b2e[_0x3e20('0x1f')]['fields']));_0x3636a1[_0x3e20('0x22')]=_0x3636a1[_0x3e20('0x22')][_0x3e20('0x25')]?_0x3636a1['attributes']:_0x295c63[_0x3e20('0x1e')];if(_0x1a1b2e[_0x3e20('0x1f')]['includeAll']){_0x3636a1[_0x3e20('0x37')]=[{'all':!![]}];}_0x3636a1=_[_0x3e20('0x2c')]({},_0x3636a1,_0x1a1b2e[_0x3e20('0x2d')]);return db['CloudProvider'][_0x3e20('0x38')](_0x3636a1)[_0x3e20('0x2e')](handleEntityNotFound(_0x58557f,null))[_0x3e20('0x2e')](function(_0x3e6bec){if(_0x3e6bec[_0x3e20('0x39')]===_0x3e20('0x32')){var _0x5bfb82=encryptor[_0x3e20('0x33')](_0x3e6bec[_0x3e20('0x34')]);_0x3e6bec[_0x3e20('0x34')]=maskClientSecret(_0x5bfb82);}return _0x3e6bec;})['then'](respondWithResult(_0x58557f,null))[_0x3e20('0x35')](handleError(_0x58557f,null));};exports[_0x3e20('0x3a')]=function(_0x32d7c8,_0x3e8d9c){if(!_0x32d7c8['body'][_0x3e20('0x15')])throw new Error(_0x3e20('0x3b'));if(!_0x32d7c8[_0x3e20('0x3c')][_0x3e20('0x39')])throw new Error(_0x3e20('0x3d'));var _0x2a5a8d=db['CloudProvider']['rawAttributes'][_0x3e20('0x39')][_0x3e20('0x3e')];if(!_0x2a5a8d[_0x3e20('0x3f')](_0x32d7c8['body'][_0x3e20('0x39')]))throw new Error(_0x3e20('0x40')+_0x2a5a8d[_0x3e20('0x41')](',\x20'));if(_0x32d7c8[_0x3e20('0x3c')][_0x3e20('0x39')]===_0x3e20('0x32')&&_0x32d7c8[_0x3e20('0x3c')][_0x3e20('0x34')]){_0x32d7c8[_0x3e20('0x3c')]['data3']=encryptor[_0x3e20('0x42')](_0x32d7c8[_0x3e20('0x3c')][_0x3e20('0x34')]);}return db['CloudProvider'][_0x3e20('0x3a')](_0x32d7c8[_0x3e20('0x3c')],{})[_0x3e20('0x2e')](respondWithResult(_0x3e8d9c,0xc9))[_0x3e20('0x35')](handleError(_0x3e8d9c,null));};exports[_0x3e20('0x11')]=function(_0x44a564,_0x362881){if(_0x44a564[_0x3e20('0x3c')]['id']){delete _0x44a564[_0x3e20('0x3c')]['id'];}return db[_0x3e20('0x1a')]['find']({'where':{'id':_0x44a564['params']['id']}})['then'](handleEntityNotFound(_0x362881,null))[_0x3e20('0x2e')](function(_0x96c7f8){if(_0x96c7f8['service']==='MicrosoftAzure'&&_0x44a564['body'][_0x3e20('0x34')]){_0x44a564[_0x3e20('0x3c')][_0x3e20('0x34')]=encryptor[_0x3e20('0x42')](_0x44a564['body'][_0x3e20('0x34')]);}return _0x96c7f8;})[_0x3e20('0x2e')](saveUpdates(_0x44a564[_0x3e20('0x3c')],null))[_0x3e20('0x2e')](respondWithResult(_0x362881,null))[_0x3e20('0x35')](handleError(_0x362881,null));};exports['destroy']=function(_0x5d6866,_0x121f7e){return db[_0x3e20('0x1a')][_0x3e20('0x38')]({'where':{'id':_0x5d6866['params']['id']}})['then'](handleEntityNotFound(_0x121f7e,null))['then'](removeEntity(_0x121f7e,null))[_0x3e20('0x35')](handleError(_0x121f7e,null));};exports[_0x3e20('0x43')]=function(_0x175599,_0x4197b1){return db[_0x3e20('0x1a')][_0x3e20('0x44')]({'where':{'id':_0x175599[_0x3e20('0x45')]['id']},'raw':!![]})[_0x3e20('0x2e')](function(_0x42286a){if(!_0x42286a)return _0x4197b1[_0x3e20('0x46')](0x194);return{'url':oauth[_0x3e20('0x47')](_0x42286a,_0x175599[_0x3e20('0x48')]['id'])};})[_0x3e20('0x2e')](respondWithResult(_0x4197b1,null))[_0x3e20('0x35')](handleError(_0x4197b1,null));};exports[_0x3e20('0x49')]=function(_0x23d598,_0x596d74){var _0x12b253=_0x23d598['body'];var _0x22cfdc;var _0x18d677;if(_0x12b253[_0x3e20('0x13')])throw _0x12b253;redis[_0x3e20('0x4a')](_0x12b253[_0x3e20('0x4b')])[_0x3e20('0x2e')](function(_0x25a87b){if(!_0x25a87b)throw new Error(_0x3e20('0x4c'));_0x22cfdc=JSON[_0x3e20('0x4d')](_0x25a87b);var _0x5c8a6f=Buffer[_0x3e20('0x4e')](_0x12b253[_0x3e20('0x4b')],_0x3e20('0x4f'))['toString']('ascii');_0x18d677=JSON['parse'](_0x5c8a6f);if(!oauth['isValidIdToken'](_0x12b253[_0x3e20('0x50')],_0x22cfdc['oauth2Claims']))throw new Error(_0x3e20('0x51'));redis['del'](_0x12b253[_0x3e20('0x4b')]);return oauth[_0x3e20('0x52')](_0x12b253[_0x3e20('0x53')],_0x22cfdc);})[_0x3e20('0x2e')](function(_0x1f8a76){_0x22cfdc[_0x3e20('0x54')]=_0x1f8a76[_0x3e20('0x55')];_0x22cfdc[_0x3e20('0x56')]=_0x1f8a76[_0x3e20('0x57')];return db[_0x3e20('0x1a')]['update']({'data5':_0x22cfdc[_0x3e20('0x54')],'data6':_0x22cfdc[_0x3e20('0x56')]},{'where':{'id':_0x22cfdc['id']}});})[_0x3e20('0x2e')](function(){oauth['startRefreshInterval'](_0x22cfdc);socket['emit'](_0x3e20('0x58'),{'id':_0x18d677['id']});return;})[_0x3e20('0x2e')](respondWithStatusCode(_0x596d74,null))[_0x3e20('0x35')](function(_0xee2a95){if(_0x18d677){socket['emit'](_0x3e20('0x59'),{'id':_0x18d677['id']});}if(!_0x22cfdc){logger[_0x3e20('0x13')](_0x3e20('0x5a'),_0xee2a95);return _0x596d74[_0x3e20('0x9')](0x1f4)[_0x3e20('0x16')](_0xee2a95['message']);}logger[_0x3e20('0x13')](_0x3e20('0x5b'),_0x22cfdc['id'],JSON[_0x3e20('0x5c')](_0xee2a95));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index cffaae9..a40109e 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 _0xbb7e=['define','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x4a42fe,_0x34d2db){var _0x5595c8=function(_0x4989fc){while(--_0x4989fc){_0x4a42fe['push'](_0x4a42fe['shift']());}};_0x5595c8(++_0x34d2db);}(_0xbb7e,0x1be));var _0xebb7=function(_0x5a489b,_0xdbb4c2){_0x5a489b=_0x5a489b-0x0;var _0x5bcc4e=_0xbb7e[_0x5a489b];return _0x5bcc4e;};'use strict';var _=require(_0xebb7('0x0'));var util=require(_0xebb7('0x1'));var logger=require(_0xebb7('0x2'))(_0xebb7('0x3'));var moment=require(_0xebb7('0x4'));var BPromise=require('bluebird');var rp=require(_0xebb7('0x5'));var fs=require('fs');var path=require(_0xebb7('0x6'));var rimraf=require('rimraf');var config=require(_0xebb7('0x7'));var attributes=require(_0xebb7('0x8'));module[_0xebb7('0x9')]=function(_0x5c673f,_0x54062e){return _0x5c673f[_0xebb7('0xa')]('CloudProvider',attributes,{'tableName':_0xebb7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c29=['path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','lodash','util','../../config/logger','api','request-promise'];(function(_0x4a05f5,_0x2ccb82){var _0xf605=function(_0x54a771){while(--_0x54a771){_0x4a05f5['push'](_0x4a05f5['shift']());}};_0xf605(++_0x2ccb82);}(_0x7c29,0x145));var _0x97c2=function(_0x347f27,_0x4016e8){_0x347f27=_0x347f27-0x0;var _0x305117=_0x7c29[_0x347f27];return _0x305117;};'use strict';var _=require(_0x97c2('0x0'));var util=require(_0x97c2('0x1'));var logger=require(_0x97c2('0x2'))(_0x97c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x97c2('0x4'));var fs=require('fs');var path=require(_0x97c2('0x5'));var rimraf=require(_0x97c2('0x6'));var config=require(_0x97c2('0x7'));var attributes=require(_0x97c2('0x8'));module['exports']=function(_0x108c97,_0x2fc19e){return _0x108c97[_0x97c2('0x9')](_0x97c2('0xa'),attributes,{'tableName':'cloud_providers','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 d2b741b..edfed25 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 _0x1bc1=['lodash','crypto','jsonwebtoken','moment','ioredis','util','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','data7','/.default','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','stringify','toString','base64','hex','client_id','response_type','join','data4','response_mode','form_post','scope','nonce','login','key','oauth2Claims','oauth2/','data1','set','decode','payload','iss','aud','audience','resolve','findOne','then','data3','data5','access_token','data6','refresh_token','CloudProvider','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports'];(function(_0x12ce7b,_0x2daaee){var _0x4ee1b1=function(_0x398ac9){while(--_0x398ac9){_0x12ce7b['push'](_0x12ce7b['shift']());}};_0x4ee1b1(++_0x2daaee);}(_0x1bc1,0x1c2));var _0x11bc=function(_0x5cf6eb,_0x5be218){_0x5cf6eb=_0x5cf6eb-0x0;var _0x5489c2=_0x1bc1[_0x5cf6eb];return _0x5489c2;};'use strict';var _=require(_0x11bc('0x0'));var crypto=require(_0x11bc('0x1'));var jwt=require(_0x11bc('0x2'));var moment=require(_0x11bc('0x3'));var Redis=require(_0x11bc('0x4'));var rp=require('request-promise');var util=require(_0x11bc('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0x11bc('0x6'));var logger=require(_0x11bc('0x7'))('api');var schedule=require(_0x11bc('0x8'));var db=require(_0x11bc('0x9'))['db'];config['redis']=_[_0x11bc('0xa')](config['redis'],{'host':_0x11bc('0xb'),'port':0x18eb});var redis=new Redis(config[_0x11bc('0xc')]);var MICROSOFT_AUTH_URL=_0x11bc('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x11bc('0xe'),_0x11bc('0xf'),_0x11bc('0x10'),_0x11bc('0x11'),_0x11bc('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x11bc('0x13')],'Dynamics365':[_0x11bc('0xe'),_0x11bc('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x11bc('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x39944b){var _0x4fe7ba=_[_0x11bc('0x15')](AZURE_AUTH_SCOPES[_0x39944b[_0x11bc('0x16')]]);if(_0x39944b[_0x11bc('0x16')]==='Dynamics365')_0x4fe7ba['push'](_0x39944b[_0x11bc('0x17')]+_0x11bc('0x18'));return _0x4fe7ba['join']('\x20');}function getAccessTokenScope(_0x65ed5d){if(_0x65ed5d[_0x11bc('0x16')]===_0x11bc('0x19'))return _0x11bc('0x12');if(_0x65ed5d[_0x11bc('0x16')]===_0x11bc('0x1a'))return _0x65ed5d[_0x11bc('0x17')]+_0x11bc('0x18');}function generateMicrosoftAuthorizationUrl(_0x24b64f,_0x5244de){var _0x5a1948=MICROSOFT_AUTH_URL[_0x11bc('0x1b')](_0x11bc('0x1c'),_0x24b64f[_0x11bc('0x1d')]);var _0x119937=[_0x11bc('0x1e'),'id_token'];var _0x5e10a5=Buffer['from'](JSON[_0x11bc('0x1f')]({'id':_0x5244de}))[_0x11bc('0x20')](_0x11bc('0x21'));var _0x2dd9bd=crypto['randomBytes'](0x10)['toString'](_0x11bc('0x22'));var _0x2d0f26=getAuthorizationScopes(_0x24b64f);var _0x3e6565=[{'key':_0x11bc('0x23'),'value':_0x24b64f['data1']},{'key':_0x11bc('0x24'),'value':encodeURIComponent(_0x119937[_0x11bc('0x25')]('\x20'))},{'key':'redirect_uri','value':_0x24b64f[_0x11bc('0x26')]},{'key':_0x11bc('0x27'),'value':_0x11bc('0x28')},{'key':_0x11bc('0x29'),'value':encodeURIComponent(_0x2d0f26)},{'key':'state','value':_0x5e10a5},{'key':_0x11bc('0x2a'),'value':_0x2dd9bd},{'key':'prompt','value':_0x11bc('0x2b')}];var _0x195a2d=_0x5a1948+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x11bc('0x15')](_0x3e6565,function(_0x36d775){return _0x36d775[_0x11bc('0x2c')]+'='+_0x36d775['value'];})[_0x11bc('0x25')]('&');_0x24b64f[_0x11bc('0x2d')]={'issuer':_0x5a1948['replace'](_0x11bc('0x2e'),''),'audience':_0x24b64f[_0x11bc('0x2f')],'state':_0x5e10a5,'nonce':_0x2dd9bd};redis[_0x11bc('0x30')](_0x5e10a5,JSON[_0x11bc('0x1f')](_0x24b64f));return _0x195a2d;}function isValidIdToken(_0x2d00af,_0x248948){try{var _0x47c43c=jwt[_0x11bc('0x31')](_0x2d00af,{'complete':!![]});var _0x33a88d=_0x47c43c[_0x11bc('0x32')];if(_0x33a88d[_0x11bc('0x33')]!==_0x248948['issuer'])return![];if(_0x33a88d[_0x11bc('0x34')]!==_0x248948[_0x11bc('0x35')])return![];if(_0x33a88d[_0x11bc('0x2a')]!==_0x248948[_0x11bc('0x2a')])return![];if(moment()['isAfter'](moment['unix'](_0x33a88d['exp'])))return![];return!![];}catch(_0x2e9b4a){throw _0x2e9b4a;}}function refreshOauth2MicrosoftAccessToken(_0x3dc1b8){return Promise[_0x11bc('0x36')]()['then'](function(){if(_0x3dc1b8['data3'])return _0x3dc1b8;return db['CloudProvider'][_0x11bc('0x37')]({'where':{'id':_0x3dc1b8['id']},'raw':!![]});})[_0x11bc('0x38')](function(_0x4c3706){var _0x12aa0a={'grant_type':'refresh_token','refresh_token':_0x4c3706['data6'],'scope':getAccessTokenScope(_0x4c3706),'redirect_uri':_0x4c3706[_0x11bc('0x26')],'client_id':_0x4c3706[_0x11bc('0x2f')],'client_secret':encryptor['decryptString'](_0x4c3706[_0x11bc('0x39')])};var _0x5cda59={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x11bc('0x1b')](_0x11bc('0x1c'),_0x4c3706[_0x11bc('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12aa0a,'json':!![]};return rp(_0x5cda59);})[_0x11bc('0x38')](function(_0x1fa7dc){_0x3dc1b8[_0x11bc('0x3a')]=_0x1fa7dc[_0x11bc('0x3b')];_0x3dc1b8[_0x11bc('0x3c')]=_0x1fa7dc[_0x11bc('0x3d')];return db[_0x11bc('0x3e')]['update']({'data5':_0x3dc1b8[_0x11bc('0x3a')],'data6':_0x3dc1b8[_0x11bc('0x3c')]},{'where':{'id':_0x3dc1b8['id']}});})[_0x11bc('0x38')](function(){return _0x3dc1b8;})[_0x11bc('0x3f')](function(_0x2d107e){logger[_0x11bc('0x40')](_0x11bc('0x41'),_0x3dc1b8['id'],_0x2d107e);});}function getOauth2MicrosoftAccessToken(_0x199ec9,_0x13476e){var _0x42f6c3={'grant_type':'authorization_code','code':_0x199ec9,'scope':getAccessTokenScope(_0x13476e),'redirect_uri':_0x13476e[_0x11bc('0x26')],'client_id':_0x13476e[_0x11bc('0x2f')],'client_secret':encryptor[_0x11bc('0x42')](_0x13476e[_0x11bc('0x39')])};var _0x52756b={'method':_0x11bc('0x43'),'uri':MICROSOFT_AUTH_URL[_0x11bc('0x1b')]('{TENANT_ID}',_0x13476e[_0x11bc('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x42f6c3,'json':!![]};return rp(_0x52756b);}function startRefreshInterval(_0x11c882){var _0x199fb4=schedule[_0x11bc('0x44')];if(_0x199fb4[_0x11c882['id']])clearInterval(_0x199fb4[_0x11c882['id']]);_0x199fb4[_0x11c882['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x11bc('0x45')](this,{'id':_0x11c882['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x11bc('0x44')]=_0x199fb4;}function startAllRefreshIntervals(){return db[_0x11bc('0x3e')][_0x11bc('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x11bc('0x38')](function(_0x483e88){var _0x4ed0b4=_0x483e88[_0x11bc('0x15')](function(_0xf3f50f){return refreshOauth2MicrosoftAccessToken(_0xf3f50f)[_0x11bc('0x38')](function(_0xa91a64){startRefreshInterval(_0xa91a64);});});return Promise[_0x11bc('0x47')](_0x4ed0b4);})['catch'](function(_0x3b8470){var _0x5f3376=_0x3b8470?util[_0x11bc('0x48')](_0x3b8470,{'showHidden':![],'depth':null}):'';logger['error'](_0x11bc('0x49'),_0x5f3376);});}module[_0x11bc('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb29c=['data2','id_token','from','stringify','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','prompt','login','key','value','oauth2Claims','set','decode','payload','iss','issuer','audience','nonce','isAfter','unix','exp','then','CloudProvider','data6','data3','replace','data5','refresh_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','join','Outlook365','Dynamics365','/.default','{TENANT_ID}'];(function(_0x439fea,_0x1dd8ad){var _0x3e8d9a=function(_0x21a46e){while(--_0x21a46e){_0x439fea['push'](_0x439fea['shift']());}};_0x3e8d9a(++_0x1dd8ad);}(_0xb29c,0x12b));var _0xcb29=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xb29c[_0x43f881];return _0x365c14;};'use strict';var _=require(_0xcb29('0x0'));var crypto=require(_0xcb29('0x1'));var jwt=require(_0xcb29('0x2'));var moment=require(_0xcb29('0x3'));var Redis=require('ioredis');var rp=require(_0xcb29('0x4'));var util=require(_0xcb29('0x5'));var encryptor=require(_0xcb29('0x6'));var config=require(_0xcb29('0x7'));var logger=require('../../config/logger')(_0xcb29('0x8'));var schedule=require(_0xcb29('0x9'));var db=require(_0xcb29('0xa'))['db'];config[_0xcb29('0xb')]=_[_0xcb29('0xc')](config[_0xcb29('0xb')],{'host':_0xcb29('0xd'),'port':0x18eb});var redis=new Redis(config[_0xcb29('0xb')]);var MICROSOFT_AUTH_URL=_0xcb29('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xcb29('0xf'),_0xcb29('0x10'),_0xcb29('0x11'),_0xcb29('0x12'),_0xcb29('0x13'),_0xcb29('0x14'),_0xcb29('0x15')],'Dynamics365':['openid',_0xcb29('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0xcb29('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0xcb29('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2dcc35){var _0x4a053f=_[_0xcb29('0x18')](AZURE_AUTH_SCOPES[_0x2dcc35['type']]);if(_0x2dcc35[_0xcb29('0x19')]==='Dynamics365')_0x4a053f[_0xcb29('0x1a')](_0x2dcc35[_0xcb29('0x1b')]+'/.default');return _0x4a053f[_0xcb29('0x1c')]('\x20');}function getAccessTokenScope(_0x57f1be){if(_0x57f1be['type']===_0xcb29('0x1d'))return _0xcb29('0x13');if(_0x57f1be['type']===_0xcb29('0x1e'))return _0x57f1be['data7']+_0xcb29('0x1f');}function generateMicrosoftAuthorizationUrl(_0x54eaad,_0x5e63c2){var _0x32cf14=MICROSOFT_AUTH_URL['replace'](_0xcb29('0x20'),_0x54eaad[_0xcb29('0x21')]);var _0x365d4a=['code',_0xcb29('0x22')];var _0x337ffc=Buffer[_0xcb29('0x23')](JSON[_0xcb29('0x24')]({'id':_0x5e63c2}))['toString']('base64');var _0x1c29db=crypto[_0xcb29('0x25')](0x10)[_0xcb29('0x26')](_0xcb29('0x27'));var _0x5136ee=getAuthorizationScopes(_0x54eaad);var _0x1838a1=[{'key':_0xcb29('0x28'),'value':_0x54eaad[_0xcb29('0x29')]},{'key':_0xcb29('0x2a'),'value':encodeURIComponent(_0x365d4a[_0xcb29('0x1c')]('\x20'))},{'key':_0xcb29('0x2b'),'value':_0x54eaad[_0xcb29('0x2c')]},{'key':_0xcb29('0x2d'),'value':_0xcb29('0x2e')},{'key':_0xcb29('0x2f'),'value':encodeURIComponent(_0x5136ee)},{'key':_0xcb29('0x30'),'value':_0x337ffc},{'key':'nonce','value':_0x1c29db},{'key':_0xcb29('0x31'),'value':_0xcb29('0x32')}];var _0x561fea=_0x32cf14+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x1838a1,function(_0x4f2fb0){return _0x4f2fb0[_0xcb29('0x33')]+'='+_0x4f2fb0[_0xcb29('0x34')];})[_0xcb29('0x1c')]('&');_0x54eaad[_0xcb29('0x35')]={'issuer':_0x32cf14['replace']('oauth2/',''),'audience':_0x54eaad[_0xcb29('0x29')],'state':_0x337ffc,'nonce':_0x1c29db};redis[_0xcb29('0x36')](_0x337ffc,JSON['stringify'](_0x54eaad));return _0x561fea;}function isValidIdToken(_0x1837b6,_0x449737){try{var _0x3296dc=jwt[_0xcb29('0x37')](_0x1837b6,{'complete':!![]});var _0x2df539=_0x3296dc[_0xcb29('0x38')];if(_0x2df539[_0xcb29('0x39')]!==_0x449737[_0xcb29('0x3a')])return![];if(_0x2df539['aud']!==_0x449737[_0xcb29('0x3b')])return![];if(_0x2df539[_0xcb29('0x3c')]!==_0x449737[_0xcb29('0x3c')])return![];if(moment()[_0xcb29('0x3d')](moment[_0xcb29('0x3e')](_0x2df539[_0xcb29('0x3f')])))return![];return!![];}catch(_0x26efae){throw _0x26efae;}}function refreshOauth2MicrosoftAccessToken(_0x2facd9){return Promise['resolve']()[_0xcb29('0x40')](function(){if(_0x2facd9['data3'])return _0x2facd9;return db[_0xcb29('0x41')]['findOne']({'where':{'id':_0x2facd9['id']},'raw':!![]});})[_0xcb29('0x40')](function(_0x3cda39){var _0xc7cbf1={'grant_type':'refresh_token','refresh_token':_0x3cda39[_0xcb29('0x42')],'scope':getAccessTokenScope(_0x3cda39),'redirect_uri':_0x3cda39[_0xcb29('0x2c')],'client_id':_0x3cda39['data1'],'client_secret':encryptor['decryptString'](_0x3cda39[_0xcb29('0x43')])};var _0x41da41={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xcb29('0x44')](_0xcb29('0x20'),_0x3cda39[_0xcb29('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xc7cbf1,'json':!![]};return rp(_0x41da41);})[_0xcb29('0x40')](function(_0x21f89e){_0x2facd9[_0xcb29('0x45')]=_0x21f89e['access_token'];_0x2facd9[_0xcb29('0x42')]=_0x21f89e[_0xcb29('0x46')];return db[_0xcb29('0x41')]['update']({'data5':_0x2facd9['data5'],'data6':_0x2facd9[_0xcb29('0x42')]},{'where':{'id':_0x2facd9['id']}});})[_0xcb29('0x40')](function(){return _0x2facd9;})[_0xcb29('0x47')](function(_0x1c319b){logger[_0xcb29('0x48')](_0xcb29('0x49'),_0x2facd9['id'],_0x1c319b);});}function getOauth2MicrosoftAccessToken(_0x47c6a3,_0x599f07){var _0x273523={'grant_type':_0xcb29('0x4a'),'code':_0x47c6a3,'scope':getAccessTokenScope(_0x599f07),'redirect_uri':_0x599f07['data4'],'client_id':_0x599f07[_0xcb29('0x29')],'client_secret':encryptor['decryptString'](_0x599f07['data3'])};var _0x293cf5={'method':_0xcb29('0x4b'),'uri':MICROSOFT_AUTH_URL[_0xcb29('0x44')](_0xcb29('0x20'),_0x599f07['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x273523,'json':!![]};return rp(_0x293cf5);}function startRefreshInterval(_0x4574ad){var _0x4b4eef=schedule[_0xcb29('0x4c')];if(_0x4b4eef[_0x4574ad['id']])clearInterval(_0x4b4eef[_0x4574ad['id']]);_0x4b4eef[_0x4574ad['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xcb29('0x4d')](this,{'id':_0x4574ad['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xcb29('0x4c')]=_0x4b4eef;}function startAllRefreshIntervals(){return db[_0xcb29('0x41')][_0xcb29('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xcb29('0x40')](function(_0x25218e){var _0x4e8904=_0x25218e[_0xcb29('0x18')](function(_0x53f355){return refreshOauth2MicrosoftAccessToken(_0x53f355)['then'](function(_0xc90978){startRefreshInterval(_0xc90978);});});return Promise[_0xcb29('0x4f')](_0x4e8904);})[_0xcb29('0x47')](function(_0x25840c){var _0x538f6c=_0x25840c?util[_0xcb29('0x50')](_0x25840c,{'showHidden':![],'depth':null}):'';logger['error'](_0xcb29('0x51'),_0x538f6c);});}module[_0xcb29('0x52')]={'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 95ec6a9..9866e85 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 _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x389cda,_0x31155c){var _0x5889bc=function(_0x32f473){while(--_0x32f473){_0x389cda['push'](_0x389cda['shift']());}};_0x5889bc(++_0x31155c);}(_0x4888,0x198));var _0x8488=function(_0x1cd726,_0x2bf581){_0x1cd726=_0x1cd726-0x0;var _0x179932=_0x4888[_0x1cd726];return _0x179932;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file +var _0xc6d7=['rpc','../../config/environment','jayson/promise','client','http','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4c8e40,_0x3f620c){var _0x489452=function(_0x2323c1){while(--_0x2323c1){_0x4c8e40['push'](_0x4c8e40['shift']());}};_0x489452(++_0x3f620c);}(_0xc6d7,0x71));var _0x7c6d=function(_0x45c806,_0x2be142){_0x45c806=_0x45c806-0x0;var _0x436481=_0xc6d7[_0x45c806];return _0x436481;};'use strict';var _=require(_0x7c6d('0x0'));var util=require(_0x7c6d('0x1'));var moment=require(_0x7c6d('0x2'));var BPromise=require(_0x7c6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c6d('0x4'))['db'];var utils=require(_0x7c6d('0x5'));var logger=require(_0x7c6d('0x6'))(_0x7c6d('0x7'));var config=require(_0x7c6d('0x8'));var jayson=require(_0x7c6d('0x9'));var client=jayson[_0x7c6d('0xa')][_0x7c6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x446b68,_0x45713e,_0x338f94){return new BPromise(function(_0x1ad7e2,_0x22755d){return client[_0x7c6d('0xc')](_0x446b68,_0x338f94)['then'](function(_0x477a41){logger['info'](_0x7c6d('0xd'),_0x45713e,_0x7c6d('0xe'));logger[_0x7c6d('0xf')](_0x7c6d('0x10'),_0x45713e,'request\x20sent',JSON[_0x7c6d('0x11')](_0x477a41));if(_0x477a41[_0x7c6d('0x12')]){if(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x13')]===0x1f4){logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x477a41[_0x7c6d('0x12')]['message']);return _0x22755d(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);}logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);return _0x1ad7e2(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);}else{logger[_0x7c6d('0x15')]('CloudProvider,\x20%s,\x20%s',_0x45713e,_0x7c6d('0xe'));_0x1ad7e2(_0x477a41[_0x7c6d('0x16')]['message']);}})[_0x7c6d('0x17')](function(_0x220bae){logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x220bae);_0x22755d(_0x220bae);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8f0053c..49dd994 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x2886e3,_0xa1f334){var _0x4c1e4a=function(_0x3baa63){while(--_0x3baa63){_0x2886e3['push'](_0x2886e3['shift']());}};_0x4c1e4a(++_0xa1f334);}(_0xdb28,0x106));var _0x8db2=function(_0x15b9ef,_0x97db4b){_0x15b9ef=_0x15b9ef-0x0;var _0x21ff18=_0xdb28[_0x15b9ef];return _0x21ff18;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ad507,_0xc8c277){_0x1ad507=_0x1ad507-0x0;var _0x2b2e0c=_0x5f2f[_0x1ad507];return _0x2b2e0c;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 406d9a3..f5064de 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 _0x30ea=['STRING','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x30ea,0x13a));var _0xa30e=function(_0x3be5a2,_0x5c0a0a){_0x3be5a2=_0x3be5a2-0x0;var _0x40d76f=_0x30ea[_0x3be5a2];return _0x40d76f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa30e('0x0')],'unique':_0xa30e('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xa30e('0x0')]},'website':{'type':Sequelize[_0xa30e('0x0')]},'phone':{'type':Sequelize[_0xa30e('0x0')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa30e('0x0')]},'street':{'type':Sequelize[_0xa30e('0x0')]},'postalCode':{'type':Sequelize[_0xa30e('0x0')]},'city':{'type':Sequelize[_0xa30e('0x0')]},'country':{'type':Sequelize[_0xa30e('0x0')]},'email':{'type':Sequelize[_0xa30e('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa30e('0x0')]},'sStreet':{'type':Sequelize[_0xa30e('0x0')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xa30e('0x0')]},'description':{'type':Sequelize[_0xa30e('0x0')]}}; \ No newline at end of file +var _0x594d=['exports','STRING','name'];(function(_0x4dcf47,_0x592db9){var _0x2a5fc0=function(_0x36fae7){while(--_0x36fae7){_0x4dcf47['push'](_0x4dcf47['shift']());}};_0x2a5fc0(++_0x592db9);}(_0x594d,0x1e6));var _0xd594=function(_0x4e567b,_0x109172){_0x4e567b=_0x4e567b-0x0;var _0x2fdaaf=_0x594d[_0x4e567b];return _0x2fdaaf;};'use strict';var Sequelize=require('sequelize');module[_0xd594('0x0')]={'name':{'type':Sequelize[_0xd594('0x1')],'unique':_0xd594('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd594('0x1')]},'companyId':{'type':Sequelize[_0xd594('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xd594('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd594('0x1')]},'postalCode':{'type':Sequelize[_0xd594('0x1')]},'city':{'type':Sequelize[_0xd594('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd594('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd594('0x1')]},'sStreet':{'type':Sequelize[_0xd594('0x1')]},'sPostalCode':{'type':Sequelize[_0xd594('0x1')]},'sCity':{'type':Sequelize[_0xd594('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd594('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5fb9bfb..cdddd71 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 _0xbe28=['CmCompany','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Companies','error','stack','name','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0xbe28,0x174));var _0x8be2=function(_0x1c70c6,_0x3b104f){_0x1c70c6=_0x1c70c6-0x0;var _0x1b886b=_0xbe28[_0x1c70c6];return _0x1b886b;};'use strict';var emlformat=require(_0x8be2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8be2('0x1'));var BPromise=require(_0x8be2('0x2'));var Mustache=require(_0x8be2('0x3'));var util=require(_0x8be2('0x4'));var path=require(_0x8be2('0x5'));var sox=require(_0x8be2('0x6'));var csv=require(_0x8be2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8be2('0x8'));var _=require(_0x8be2('0x9'));var squel=require('squel');var crypto=require(_0x8be2('0xa'));var jsforce=require(_0x8be2('0xb'));var deskjs=require(_0x8be2('0xc'));var toCsv=require(_0x8be2('0x7'));var querystring=require('querystring');var Papa=require(_0x8be2('0xd'));var Redis=require(_0x8be2('0xe'));var authService=require(_0x8be2('0xf'));var qs=require(_0x8be2('0x10'));var as=require(_0x8be2('0x11'));var hardwareService=require(_0x8be2('0x12'));var logger=require(_0x8be2('0x13'))(_0x8be2('0x14'));var utils=require(_0x8be2('0x15'));var config=require(_0x8be2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8be2('0x17'))['db'];function respondWithStatusCode(_0x50ed02,_0x52e520){_0x52e520=_0x52e520||0xcc;return function(_0xb96549){if(_0xb96549){return _0x50ed02[_0x8be2('0x18')](_0x52e520);}return _0x50ed02[_0x8be2('0x19')](_0x52e520)[_0x8be2('0x1a')]();};}function respondWithResult(_0xdaec7a,_0x470e34){_0x470e34=_0x470e34||0xc8;return function(_0x32150c){if(_0x32150c){return _0xdaec7a[_0x8be2('0x19')](_0x470e34)['json'](_0x32150c);}};}function respondWithFilteredResult(_0x4e12a7,_0x5354ca){return function(_0x39dd34){if(_0x39dd34){var _0x3ce9df=typeof _0x5354ca[_0x8be2('0x1b')]===_0x8be2('0x1c')&&typeof _0x5354ca[_0x8be2('0x1d')]===_0x8be2('0x1c');var _0xc7293f=_0x39dd34[_0x8be2('0x1e')];var _0x3aefda=_0x3ce9df?0x0:_0x5354ca[_0x8be2('0x1b')];var _0x1a26db=_0x3ce9df?_0x39dd34[_0x8be2('0x1e')]:_0x5354ca[_0x8be2('0x1b')]+_0x5354ca['limit'];var _0x27e94a;if(_0x1a26db>=_0xc7293f){_0x1a26db=_0xc7293f;_0x27e94a=0xc8;}else{_0x27e94a=0xce;}_0x4e12a7['status'](_0x27e94a);return _0x4e12a7[_0x8be2('0x1f')](_0x8be2('0x20'),_0x3aefda+'-'+_0x1a26db+'/'+_0xc7293f)[_0x8be2('0x21')](_0x39dd34);}return null;};}function patchUpdates(_0x223b6c){return function(_0x5eb759){try{jsonpatch[_0x8be2('0x22')](_0x5eb759,_0x223b6c,!![]);}catch(_0x5e8fa2){return BPromise['reject'](_0x5e8fa2);}return _0x5eb759[_0x8be2('0x23')]();};}function saveUpdates(_0x252e21,_0x10a154){return function(_0x386e52){if(_0x386e52){return _0x386e52[_0x8be2('0x24')](_0x252e21)[_0x8be2('0x25')](function(_0x39bdbe){return _0x39bdbe;});}return null;};}function removeEntity(_0x4aee2f,_0x3854b6){return function(_0x4b05b0){if(_0x4b05b0){return _0x4b05b0[_0x8be2('0x26')]()[_0x8be2('0x25')](function(){var _0x396589=_0x4b05b0[_0x8be2('0x27')]({'plain':!![]});var _0x3fb7cd=_0x8be2('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3fb7cd,'resourceId':_0x396589['id']}})['then'](function(){return _0x4b05b0;});})[_0x8be2('0x25')](function(){_0x4aee2f[_0x8be2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc78c5,_0x5d57ff){return function(_0x2197dd){if(!_0x2197dd){_0xcc78c5[_0x8be2('0x18')](0x194);}return _0x2197dd;};}function handleError(_0x94c6d0,_0xf5a94c){_0xf5a94c=_0xf5a94c||0x1f4;return function(_0x47f785){logger[_0x8be2('0x29')](_0x47f785[_0x8be2('0x2a')]);if(_0x47f785[_0x8be2('0x2b')]){delete _0x47f785[_0x8be2('0x2b')];}_0x94c6d0[_0x8be2('0x19')](_0xf5a94c)['send'](_0x47f785);};}exports['index']=function(_0x15ba1c,_0xcf73d3){var _0x4e969b={},_0x41918e={},_0x2d0419={'count':0x0,'rows':[]};return db['CmCompany'][_0x8be2('0x2c')]()[_0x8be2('0x25')](function(_0x2f3055){_0x41918e[_0x8be2('0x2d')]=_[_0x8be2('0x2e')](_0x2f3055);_0x41918e['query']=_['keys'](_0x15ba1c[_0x8be2('0x2f')]);_0x41918e['filters']=_[_0x8be2('0x30')](_0x41918e[_0x8be2('0x2d')],_0x41918e['query']);_0x4e969b[_0x8be2('0x31')]=_[_0x8be2('0x30')](_0x41918e[_0x8be2('0x2d')],qs['fields'](_0x15ba1c[_0x8be2('0x2f')][_0x8be2('0x32')]));_0x4e969b[_0x8be2('0x31')]=_0x4e969b[_0x8be2('0x31')][_0x8be2('0x33')]?_0x4e969b['attributes']:_0x41918e[_0x8be2('0x2d')];if(!_0x15ba1c['query'][_0x8be2('0x34')](_0x8be2('0x35'))){_0x4e969b[_0x8be2('0x1d')]=qs[_0x8be2('0x1d')](_0x15ba1c[_0x8be2('0x2f')][_0x8be2('0x1d')]);_0x4e969b[_0x8be2('0x1b')]=qs['offset'](_0x15ba1c[_0x8be2('0x2f')]['offset']);}_0x4e969b[_0x8be2('0x36')]=qs[_0x8be2('0x37')](_0x15ba1c[_0x8be2('0x2f')][_0x8be2('0x37')]);_0x4e969b[_0x8be2('0x38')]=qs[_0x8be2('0x39')](_[_0x8be2('0x3a')](_0x15ba1c[_0x8be2('0x2f')],_0x41918e['filters']),_0x2f3055);if(_0x15ba1c['query'][_0x8be2('0x3b')]){_0x4e969b[_0x8be2('0x38')]=_[_0x8be2('0x3c')](_0x4e969b[_0x8be2('0x38')],{'$or':_[_0x8be2('0x3d')](_0x4e969b[_0x8be2('0x31')],function(_0x4e1b4e){var _0x19c03a={};_0x19c03a[_0x4e1b4e]={'$like':'%'+_0x15ba1c[_0x8be2('0x2f')][_0x8be2('0x3b')]+'%'};return _0x19c03a;})});}_0x4e969b=_[_0x8be2('0x3c')]({},_0x4e969b,_0x15ba1c[_0x8be2('0x3e')]);var _0x505ad7={'where':_0x4e969b['where']};return db[_0x8be2('0x3f')][_0x8be2('0x1e')](_0x505ad7)[_0x8be2('0x25')](function(_0x2974fa){_0x2d0419['count']=_0x2974fa;if(_0x15ba1c[_0x8be2('0x2f')][_0x8be2('0x40')]){_0x4e969b['include']=[{'all':!![]}];}return db[_0x8be2('0x3f')][_0x8be2('0x41')](_0x4e969b);})[_0x8be2('0x25')](function(_0x45082a){_0x2d0419[_0x8be2('0x42')]=_0x45082a;return _0x2d0419;})['then'](respondWithFilteredResult(_0xcf73d3,_0x4e969b))['catch'](handleError(_0xcf73d3,null));})[_0x8be2('0x43')](handleError(_0xcf73d3,null));};exports[_0x8be2('0x44')]=function(_0x2db6b6,_0x4baf7e){var _0x1ed9ad={'raw':![],'where':{'id':_0x2db6b6[_0x8be2('0x45')]['id']}},_0x5d7768={};_0x5d7768[_0x8be2('0x2d')]=_['keys'](db['CmCompany'][_0x8be2('0x46')]);_0x5d7768[_0x8be2('0x2f')]=_[_0x8be2('0x2e')](_0x2db6b6['query']);_0x5d7768[_0x8be2('0x39')]=_[_0x8be2('0x30')](_0x5d7768[_0x8be2('0x2d')],_0x5d7768[_0x8be2('0x2f')]);_0x1ed9ad[_0x8be2('0x31')]=_[_0x8be2('0x30')](_0x5d7768['model'],qs[_0x8be2('0x32')](_0x2db6b6['query']['fields']));_0x1ed9ad['attributes']=_0x1ed9ad[_0x8be2('0x31')][_0x8be2('0x33')]?_0x1ed9ad[_0x8be2('0x31')]:_0x5d7768[_0x8be2('0x2d')];if(_0x2db6b6['query'][_0x8be2('0x40')]){_0x1ed9ad[_0x8be2('0x47')]=[{'all':!![]}];}_0x1ed9ad=_['merge']({},_0x1ed9ad,_0x2db6b6[_0x8be2('0x3e')]);return db[_0x8be2('0x3f')]['find'](_0x1ed9ad)[_0x8be2('0x25')](handleEntityNotFound(_0x4baf7e,null))[_0x8be2('0x25')](respondWithResult(_0x4baf7e,null))[_0x8be2('0x43')](handleError(_0x4baf7e,null));};exports[_0x8be2('0x48')]=function(_0x1e4a55,_0x250578){return db[_0x8be2('0x3f')][_0x8be2('0x48')](_0x1e4a55[_0x8be2('0x49')],{})[_0x8be2('0x25')](function(_0x190c3f){var _0x70bb17=_0x1e4a55[_0x8be2('0x4a')][_0x8be2('0x27')]({'plain':!![]});if(!_0x70bb17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x70bb17[_0x8be2('0x4b')]===_0x8be2('0x4a')){var _0x153f6b=_0x190c3f['get']({'plain':!![]});var _0xd3b9e9=_0x8be2('0x28');return db[_0x8be2('0x4c')][_0x8be2('0x4d')]({'where':{'name':_0xd3b9e9,'userProfileId':_0x70bb17[_0x8be2('0x4e')]},'raw':!![]})[_0x8be2('0x25')](function(_0x51f1a0){if(_0x51f1a0&&_0x51f1a0['autoAssociation']===0x0){return db[_0x8be2('0x4f')][_0x8be2('0x48')]({'name':_0x153f6b[_0x8be2('0x2b')],'resourceId':_0x153f6b['id'],'type':_0x51f1a0[_0x8be2('0x2b')],'sectionId':_0x51f1a0['id']},{})[_0x8be2('0x25')](function(){return _0x190c3f;});}else{return _0x190c3f;}})['catch'](function(_0x56d332){logger[_0x8be2('0x29')](_0x8be2('0x50'),_0x56d332);throw _0x56d332;});}return _0x190c3f;})[_0x8be2('0x25')](respondWithResult(_0x250578,0xc9))[_0x8be2('0x43')](handleError(_0x250578,null));};exports[_0x8be2('0x24')]=function(_0x3d40a8,_0x49c5f1){if(_0x3d40a8[_0x8be2('0x49')]['id']){delete _0x3d40a8[_0x8be2('0x49')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x3d40a8['params']['id']}})['then'](handleEntityNotFound(_0x49c5f1,null))['then'](saveUpdates(_0x3d40a8[_0x8be2('0x49')],null))[_0x8be2('0x25')](respondWithResult(_0x49c5f1,null))['catch'](handleError(_0x49c5f1,null));};exports[_0x8be2('0x26')]=function(_0x3364cb,_0x44d2ba){return db[_0x8be2('0x3f')]['find']({'where':{'id':_0x3364cb[_0x8be2('0x45')]['id']}})[_0x8be2('0x25')](handleEntityNotFound(_0x44d2ba,null))[_0x8be2('0x25')](removeEntity(_0x44d2ba,null))[_0x8be2('0x43')](handleError(_0x44d2ba,null));};exports[_0x8be2('0x2c')]=function(_0x5f8d14,_0x6fde1a){return db[_0x8be2('0x3f')][_0x8be2('0x2c')]()[_0x8be2('0x25')](respondWithResult(_0x6fde1a,null))[_0x8be2('0x43')](handleError(_0x6fde1a,null));};exports[_0x8be2('0x51')]=function(_0x1431ef,_0x274b5d,_0x446504){return db[_0x8be2('0x52')][_0x8be2('0x4d')]({'where':{'id':_0x1431ef['params']['id']}})[_0x8be2('0x25')](handleEntityNotFound(_0x274b5d,null))[_0x8be2('0x25')](function(_0x3168e9){if(_0x3168e9){return _0x3168e9['addContacts'](_0x1431ef[_0x8be2('0x49')][_0x8be2('0x53')],_[_0x8be2('0x54')](_0x1431ef[_0x8be2('0x49')],['ids','id'])||{});}})[_0x8be2('0x25')](respondWithResult(_0x274b5d,null))['catch'](handleError(_0x274b5d,null));};exports[_0x8be2('0x55')]=function(_0x10a529,_0x18b89b,_0xcf75c8){var _0x14f271={};var _0x3a5865={};var _0x16540b;var _0x359073;return db[_0x8be2('0x3f')][_0x8be2('0x56')]({'where':{'id':_0x10a529[_0x8be2('0x45')]['id']}})[_0x8be2('0x25')](handleEntityNotFound(_0x18b89b,null))[_0x8be2('0x25')](function(_0x4d6b8c){if(_0x4d6b8c){_0x16540b=_0x4d6b8c;_0x3a5865['model']=_[_0x8be2('0x2e')](db[_0x8be2('0x52')][_0x8be2('0x46')]);_0x3a5865['query']=_[_0x8be2('0x2e')](_0x10a529[_0x8be2('0x2f')]);_0x3a5865[_0x8be2('0x39')]=_[_0x8be2('0x30')](_0x3a5865['model'],_0x3a5865[_0x8be2('0x2f')]);_0x14f271['attributes']=_[_0x8be2('0x30')](_0x3a5865[_0x8be2('0x2d')],qs['fields'](_0x10a529['query'][_0x8be2('0x32')]));_0x14f271[_0x8be2('0x31')]=_0x14f271[_0x8be2('0x31')][_0x8be2('0x33')]?_0x14f271[_0x8be2('0x31')]:_0x3a5865['model'];_0x14f271[_0x8be2('0x36')]=qs[_0x8be2('0x37')](_0x10a529[_0x8be2('0x2f')][_0x8be2('0x37')]);_0x14f271['where']=qs[_0x8be2('0x39')](_[_0x8be2('0x3a')](_0x10a529[_0x8be2('0x2f')],_0x3a5865[_0x8be2('0x39')]));if(_0x10a529[_0x8be2('0x2f')][_0x8be2('0x3b')]){_0x14f271[_0x8be2('0x38')]=_[_0x8be2('0x3c')](_0x14f271['where'],{'$or':_[_0x8be2('0x3d')](_0x14f271[_0x8be2('0x31')],function(_0x27909d){var _0x5383d1={};_0x5383d1[_0x27909d]={'$like':'%'+_0x10a529['query'][_0x8be2('0x3b')]+'%'};return _0x5383d1;})});}_0x14f271=_[_0x8be2('0x3c')]({},_0x14f271,_0x10a529['options']);return _0x16540b[_0x8be2('0x55')](_0x14f271);}})[_0x8be2('0x25')](function(_0x4f6aca){if(_0x4f6aca){_0x359073=_0x4f6aca[_0x8be2('0x33')];if(!_0x10a529['query'][_0x8be2('0x34')](_0x8be2('0x35'))){_0x14f271[_0x8be2('0x1d')]=qs[_0x8be2('0x1d')](_0x10a529['query']['limit']);_0x14f271[_0x8be2('0x1b')]=qs[_0x8be2('0x1b')](_0x10a529['query'][_0x8be2('0x1b')]);}return _0x16540b[_0x8be2('0x55')](_0x14f271);}})[_0x8be2('0x25')](function(_0x2e21d7){if(_0x2e21d7){return _0x2e21d7?{'count':_0x359073,'rows':_0x2e21d7}:null;}})[_0x8be2('0x25')](respondWithResult(_0x18b89b,null))[_0x8be2('0x43')](handleError(_0x18b89b,null));}; \ No newline at end of file +var _0xf53e=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','include','findAll','catch','show','rawAttributes','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xab1ed3,_0x5a9e35){var _0x599362=function(_0x5d5a2f){while(--_0x5d5a2f){_0xab1ed3['push'](_0xab1ed3['shift']());}};_0x599362(++_0x5a9e35);}(_0xf53e,0x158));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xef53('0x0'));var rimraf=require(_0xef53('0x1'));var zipdir=require(_0xef53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef53('0x3'));var moment=require('moment');var BPromise=require(_0xef53('0x4'));var Mustache=require(_0xef53('0x5'));var util=require(_0xef53('0x6'));var path=require(_0xef53('0x7'));var sox=require('sox');var csv=require(_0xef53('0x8'));var ejs=require(_0xef53('0x9'));var fs=require('fs');var fs_extra=require(_0xef53('0xa'));var _=require('lodash');var squel=require(_0xef53('0xb'));var crypto=require(_0xef53('0xc'));var jsforce=require(_0xef53('0xd'));var deskjs=require(_0xef53('0xe'));var toCsv=require(_0xef53('0x8'));var querystring=require(_0xef53('0xf'));var Papa=require(_0xef53('0x10'));var Redis=require(_0xef53('0x11'));var authService=require(_0xef53('0x12'));var qs=require(_0xef53('0x13'));var as=require(_0xef53('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef53('0x15'))(_0xef53('0x16'));var utils=require(_0xef53('0x17'));var config=require(_0xef53('0x18'));var licenseUtil=require(_0xef53('0x19'));var db=require(_0xef53('0x1a'))['db'];function respondWithStatusCode(_0x5be054,_0x5afd7e){_0x5afd7e=_0x5afd7e||0xcc;return function(_0x31650c){if(_0x31650c){return _0x5be054[_0xef53('0x1b')](_0x5afd7e);}return _0x5be054[_0xef53('0x1c')](_0x5afd7e)[_0xef53('0x1d')]();};}function respondWithResult(_0x21b059,_0x5708d3){_0x5708d3=_0x5708d3||0xc8;return function(_0x55e5ad){if(_0x55e5ad){return _0x21b059[_0xef53('0x1c')](_0x5708d3)[_0xef53('0x1e')](_0x55e5ad);}};}function respondWithFilteredResult(_0x808854,_0x47f32d){return function(_0x37ee10){if(_0x37ee10){var _0xf1cbb5=typeof _0x47f32d[_0xef53('0x1f')]===_0xef53('0x20')&&typeof _0x47f32d[_0xef53('0x21')]==='undefined';var _0x28d278=_0x37ee10['count'];var _0x1da1c3=_0xf1cbb5?0x0:_0x47f32d[_0xef53('0x1f')];var _0x388a01=_0xf1cbb5?_0x37ee10[_0xef53('0x22')]:_0x47f32d[_0xef53('0x1f')]+_0x47f32d[_0xef53('0x21')];var _0x40ea2c;if(_0x388a01>=_0x28d278){_0x388a01=_0x28d278;_0x40ea2c=0xc8;}else{_0x40ea2c=0xce;}_0x808854[_0xef53('0x1c')](_0x40ea2c);return _0x808854['set'](_0xef53('0x23'),_0x1da1c3+'-'+_0x388a01+'/'+_0x28d278)[_0xef53('0x1e')](_0x37ee10);}return null;};}function patchUpdates(_0x98ce6c){return function(_0xb4afd2){try{jsonpatch[_0xef53('0x24')](_0xb4afd2,_0x98ce6c,!![]);}catch(_0x3baeb0){return BPromise['reject'](_0x3baeb0);}return _0xb4afd2[_0xef53('0x25')]();};}function saveUpdates(_0x591c41,_0x3bc1d2){return function(_0x5d2136){if(_0x5d2136){return _0x5d2136[_0xef53('0x26')](_0x591c41)[_0xef53('0x27')](function(_0x5c15be){return _0x5c15be;});}return null;};}function removeEntity(_0x1cf861,_0x5de80f){return function(_0x51b3bf){if(_0x51b3bf){return _0x51b3bf[_0xef53('0x28')]()[_0xef53('0x27')](function(){var _0x233628=_0x51b3bf[_0xef53('0x29')]({'plain':!![]});var _0x19db9e=_0xef53('0x2a');return db[_0xef53('0x2b')]['destroy']({'where':{'type':_0x19db9e,'resourceId':_0x233628['id']}})['then'](function(){return _0x51b3bf;});})[_0xef53('0x27')](function(){_0x1cf861['status'](0xcc)[_0xef53('0x1d')]();});}};}function handleEntityNotFound(_0x25a8ca,_0x392fe3){return function(_0x14f85b){if(!_0x14f85b){_0x25a8ca[_0xef53('0x1b')](0x194);}return _0x14f85b;};}function handleError(_0x3348e8,_0x10fd0e){_0x10fd0e=_0x10fd0e||0x1f4;return function(_0x2e5e00){logger[_0xef53('0x2c')](_0x2e5e00[_0xef53('0x2d')]);if(_0x2e5e00[_0xef53('0x2e')]){delete _0x2e5e00[_0xef53('0x2e')];}_0x3348e8[_0xef53('0x1c')](_0x10fd0e)['send'](_0x2e5e00);};}exports[_0xef53('0x2f')]=function(_0x2fb849,_0x4a6fb5){var _0x196126={},_0x59f298={},_0x15bfc4={'count':0x0,'rows':[]};return db[_0xef53('0x30')][_0xef53('0x31')]()[_0xef53('0x27')](function(_0x2f1f64){_0x59f298['model']=_[_0xef53('0x32')](_0x2f1f64);_0x59f298[_0xef53('0x33')]=_[_0xef53('0x32')](_0x2fb849[_0xef53('0x33')]);_0x59f298[_0xef53('0x34')]=_[_0xef53('0x35')](_0x59f298[_0xef53('0x36')],_0x59f298[_0xef53('0x33')]);_0x196126[_0xef53('0x37')]=_[_0xef53('0x35')](_0x59f298[_0xef53('0x36')],qs['fields'](_0x2fb849[_0xef53('0x33')][_0xef53('0x38')]));_0x196126[_0xef53('0x37')]=_0x196126[_0xef53('0x37')][_0xef53('0x39')]?_0x196126[_0xef53('0x37')]:_0x59f298[_0xef53('0x36')];if(!_0x2fb849[_0xef53('0x33')]['hasOwnProperty'](_0xef53('0x3a'))){_0x196126[_0xef53('0x21')]=qs[_0xef53('0x21')](_0x2fb849[_0xef53('0x33')]['limit']);_0x196126[_0xef53('0x1f')]=qs['offset'](_0x2fb849[_0xef53('0x33')][_0xef53('0x1f')]);}_0x196126[_0xef53('0x3b')]=qs[_0xef53('0x3c')](_0x2fb849[_0xef53('0x33')][_0xef53('0x3c')]);_0x196126[_0xef53('0x3d')]=qs[_0xef53('0x34')](_[_0xef53('0x3e')](_0x2fb849[_0xef53('0x33')],_0x59f298[_0xef53('0x34')]),_0x2f1f64);if(_0x2fb849['query'][_0xef53('0x3f')]){_0x196126[_0xef53('0x3d')]=_[_0xef53('0x40')](_0x196126[_0xef53('0x3d')],{'$or':_[_0xef53('0x41')](_0x196126[_0xef53('0x37')],function(_0x5f226b){var _0x50580e={};_0x50580e[_0x5f226b]={'$like':'%'+_0x2fb849['query'][_0xef53('0x3f')]+'%'};return _0x50580e;})});}_0x196126=_[_0xef53('0x40')]({},_0x196126,_0x2fb849['options']);var _0x5d5523={'where':_0x196126[_0xef53('0x3d')]};return db[_0xef53('0x30')][_0xef53('0x22')](_0x5d5523)[_0xef53('0x27')](function(_0x89f88c){_0x15bfc4[_0xef53('0x22')]=_0x89f88c;if(_0x2fb849[_0xef53('0x33')]['includeAll']){_0x196126[_0xef53('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0xef53('0x43')](_0x196126);})['then'](function(_0x3f8599){_0x15bfc4['rows']=_0x3f8599;return _0x15bfc4;})[_0xef53('0x27')](respondWithFilteredResult(_0x4a6fb5,_0x196126))[_0xef53('0x44')](handleError(_0x4a6fb5,null));})[_0xef53('0x44')](handleError(_0x4a6fb5,null));};exports[_0xef53('0x45')]=function(_0x2f3878,_0x623978){var _0x119ffd={'raw':![],'where':{'id':_0x2f3878['params']['id']}},_0x455fa1={};_0x455fa1[_0xef53('0x36')]=_[_0xef53('0x32')](db['CmCompany'][_0xef53('0x46')]);_0x455fa1['query']=_['keys'](_0x2f3878['query']);_0x455fa1[_0xef53('0x34')]=_[_0xef53('0x35')](_0x455fa1['model'],_0x455fa1['query']);_0x119ffd[_0xef53('0x37')]=_[_0xef53('0x35')](_0x455fa1[_0xef53('0x36')],qs[_0xef53('0x38')](_0x2f3878[_0xef53('0x33')][_0xef53('0x38')]));_0x119ffd[_0xef53('0x37')]=_0x119ffd[_0xef53('0x37')]['length']?_0x119ffd['attributes']:_0x455fa1[_0xef53('0x36')];if(_0x2f3878['query'][_0xef53('0x47')]){_0x119ffd[_0xef53('0x42')]=[{'all':!![]}];}_0x119ffd=_[_0xef53('0x40')]({},_0x119ffd,_0x2f3878[_0xef53('0x48')]);return db[_0xef53('0x30')][_0xef53('0x49')](_0x119ffd)['then'](handleEntityNotFound(_0x623978,null))['then'](respondWithResult(_0x623978,null))[_0xef53('0x44')](handleError(_0x623978,null));};exports['create']=function(_0x2f9dcf,_0x3c32c8){return db[_0xef53('0x30')]['create'](_0x2f9dcf[_0xef53('0x4a')],{})[_0xef53('0x27')](function(_0x424435){var _0x3b8f42=_0x2f9dcf[_0xef53('0x4b')][_0xef53('0x29')]({'plain':!![]});if(!_0x3b8f42)throw new Error(_0xef53('0x4c'));if(_0x3b8f42[_0xef53('0x4d')]===_0xef53('0x4b')){var _0x406350=_0x424435[_0xef53('0x29')]({'plain':!![]});var _0x5702cf=_0xef53('0x2a');return db[_0xef53('0x4e')]['find']({'where':{'name':_0x5702cf,'userProfileId':_0x3b8f42[_0xef53('0x4f')]},'raw':!![]})['then'](function(_0x5e97b1){if(_0x5e97b1&&_0x5e97b1[_0xef53('0x50')]===0x0){return db[_0xef53('0x2b')][_0xef53('0x51')]({'name':_0x406350[_0xef53('0x2e')],'resourceId':_0x406350['id'],'type':_0x5e97b1[_0xef53('0x2e')],'sectionId':_0x5e97b1['id']},{})[_0xef53('0x27')](function(){return _0x424435;});}else{return _0x424435;}})['catch'](function(_0x276ce1){logger[_0xef53('0x2c')](_0xef53('0x52'),_0x276ce1);throw _0x276ce1;});}return _0x424435;})['then'](respondWithResult(_0x3c32c8,0xc9))[_0xef53('0x44')](handleError(_0x3c32c8,null));};exports[_0xef53('0x26')]=function(_0x6472b7,_0x10fcd1){if(_0x6472b7[_0xef53('0x4a')]['id']){delete _0x6472b7['body']['id'];}return db[_0xef53('0x30')][_0xef53('0x49')]({'where':{'id':_0x6472b7['params']['id']}})[_0xef53('0x27')](handleEntityNotFound(_0x10fcd1,null))[_0xef53('0x27')](saveUpdates(_0x6472b7[_0xef53('0x4a')],null))[_0xef53('0x27')](respondWithResult(_0x10fcd1,null))[_0xef53('0x44')](handleError(_0x10fcd1,null));};exports[_0xef53('0x28')]=function(_0x22076c,_0x5d1321){return db[_0xef53('0x30')][_0xef53('0x49')]({'where':{'id':_0x22076c[_0xef53('0x53')]['id']}})[_0xef53('0x27')](handleEntityNotFound(_0x5d1321,null))[_0xef53('0x27')](removeEntity(_0x5d1321,null))[_0xef53('0x44')](handleError(_0x5d1321,null));};exports[_0xef53('0x31')]=function(_0x4b009a,_0xac85e5){return db[_0xef53('0x30')]['describe']()[_0xef53('0x27')](respondWithResult(_0xac85e5,null))['catch'](handleError(_0xac85e5,null));};exports[_0xef53('0x54')]=function(_0x4f739e,_0x596ba8,_0x180df7){return db[_0xef53('0x55')][_0xef53('0x49')]({'where':{'id':_0x4f739e[_0xef53('0x53')]['id']}})[_0xef53('0x27')](handleEntityNotFound(_0x596ba8,null))[_0xef53('0x27')](function(_0x1e2d14){if(_0x1e2d14){return _0x1e2d14[_0xef53('0x54')](_0x4f739e[_0xef53('0x4a')][_0xef53('0x56')],_[_0xef53('0x57')](_0x4f739e['body'],['ids','id'])||{});}})[_0xef53('0x27')](respondWithResult(_0x596ba8,null))['catch'](handleError(_0x596ba8,null));};exports[_0xef53('0x58')]=function(_0x11569c,_0xa79241,_0x40424f){var _0x422dd6={};var _0x33db3a={};var _0x5947af;var _0x10d61e;return db[_0xef53('0x30')][_0xef53('0x59')]({'where':{'id':_0x11569c[_0xef53('0x53')]['id']}})[_0xef53('0x27')](handleEntityNotFound(_0xa79241,null))[_0xef53('0x27')](function(_0xbbe6f2){if(_0xbbe6f2){_0x5947af=_0xbbe6f2;_0x33db3a[_0xef53('0x36')]=_[_0xef53('0x32')](db[_0xef53('0x55')]['rawAttributes']);_0x33db3a[_0xef53('0x33')]=_[_0xef53('0x32')](_0x11569c['query']);_0x33db3a['filters']=_['intersection'](_0x33db3a['model'],_0x33db3a[_0xef53('0x33')]);_0x422dd6[_0xef53('0x37')]=_[_0xef53('0x35')](_0x33db3a[_0xef53('0x36')],qs[_0xef53('0x38')](_0x11569c[_0xef53('0x33')][_0xef53('0x38')]));_0x422dd6['attributes']=_0x422dd6[_0xef53('0x37')][_0xef53('0x39')]?_0x422dd6[_0xef53('0x37')]:_0x33db3a['model'];_0x422dd6[_0xef53('0x3b')]=qs[_0xef53('0x3c')](_0x11569c[_0xef53('0x33')][_0xef53('0x3c')]);_0x422dd6[_0xef53('0x3d')]=qs[_0xef53('0x34')](_['pick'](_0x11569c[_0xef53('0x33')],_0x33db3a[_0xef53('0x34')]));if(_0x11569c['query']['filter']){_0x422dd6[_0xef53('0x3d')]=_['merge'](_0x422dd6[_0xef53('0x3d')],{'$or':_[_0xef53('0x41')](_0x422dd6['attributes'],function(_0x39f929){var _0x222762={};_0x222762[_0x39f929]={'$like':'%'+_0x11569c[_0xef53('0x33')]['filter']+'%'};return _0x222762;})});}_0x422dd6=_[_0xef53('0x40')]({},_0x422dd6,_0x11569c[_0xef53('0x48')]);return _0x5947af['getContacts'](_0x422dd6);}})[_0xef53('0x27')](function(_0x55ea01){if(_0x55ea01){_0x10d61e=_0x55ea01[_0xef53('0x39')];if(!_0x11569c[_0xef53('0x33')][_0xef53('0x5a')](_0xef53('0x3a'))){_0x422dd6[_0xef53('0x21')]=qs[_0xef53('0x21')](_0x11569c['query']['limit']);_0x422dd6[_0xef53('0x1f')]=qs[_0xef53('0x1f')](_0x11569c[_0xef53('0x33')][_0xef53('0x1f')]);}return _0x5947af[_0xef53('0x58')](_0x422dd6);}})[_0xef53('0x27')](function(_0x1cbfb7){if(_0x1cbfb7){return _0x1cbfb7?{'count':_0x10d61e,'rows':_0x1cbfb7}:null;}})[_0xef53('0x27')](respondWithResult(_0xa79241,null))[_0xef53('0x44')](handleError(_0xa79241,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 604adc8..286f2d2 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 _0xb6ae=['cm_companies','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb6ae,0x85));var _0xeb6a=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0xb6ae[_0x3d27ba];return _0xf01885;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb6a('0x0'))(_0xeb6a('0x1'));var moment=require(_0xeb6a('0x2'));var BPromise=require(_0xeb6a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb6a('0x4'));var config=require(_0xeb6a('0x5'));var attributes=require(_0xeb6a('0x6'));module[_0xeb6a('0x7')]=function(_0x31736b,_0x1701bc){return _0x31736b[_0xeb6a('0x8')](_0xeb6a('0x9'),attributes,{'tableName':_0xeb6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf971=['CmCompany','util','../../config/logger','api','moment','request-promise','path','../../config/environment','define'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf971,0xbe));var _0x1f97=function(_0x264b7c,_0x24f03e){_0x264b7c=_0x264b7c-0x0;var _0x56a041=_0xf971[_0x264b7c];return _0x56a041;};'use strict';var _=require('lodash');var util=require(_0x1f97('0x0'));var logger=require(_0x1f97('0x1'))(_0x1f97('0x2'));var moment=require(_0x1f97('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f97('0x4'));var fs=require('fs');var path=require(_0x1f97('0x5'));var rimraf=require('rimraf');var config=require(_0x1f97('0x6'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x184386,_0x49bfaf){return _0x184386[_0x1f97('0x7')](_0x1f97('0x8'),attributes,{'tableName':'cm_companies','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 5b801db..0d04cd3 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 _0x866d=['client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0x866d,0x1d5));var _0xd866=function(_0x192088,_0x6d0e08){_0x192088=_0x192088-0x0;var _0x5086eb=_0x866d[_0x192088];return _0x5086eb;};'use strict';var _=require(_0xd866('0x0'));var util=require(_0xd866('0x1'));var moment=require(_0xd866('0x2'));var BPromise=require(_0xd866('0x3'));var rs=require(_0xd866('0x4'));var fs=require('fs');var Redis=require(_0xd866('0x5'));var db=require(_0xd866('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd866('0x7'))(_0xd866('0x8'));var config=require(_0xd866('0x9'));var jayson=require(_0xd866('0xa'));var client=jayson[_0xd866('0xb')][_0xd866('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ab7d2,_0x160e35,_0x1f0d20){return new BPromise(function(_0x5cb991,_0x25517a){return client[_0xd866('0xd')](_0x4ab7d2,_0x1f0d20)[_0xd866('0xe')](function(_0x5450d0){logger[_0xd866('0xf')](_0xd866('0x10'),_0x160e35,_0xd866('0x11'));logger['debug'](_0xd866('0x12'),_0x160e35,_0xd866('0x11'),JSON[_0xd866('0x13')](_0x5450d0));if(_0x5450d0[_0xd866('0x14')]){if(_0x5450d0[_0xd866('0x14')]['code']===0x1f4){logger[_0xd866('0x14')](_0xd866('0x10'),_0x160e35,_0x5450d0[_0xd866('0x14')][_0xd866('0x15')]);return _0x25517a(_0x5450d0[_0xd866('0x14')][_0xd866('0x15')]);}logger['error'](_0xd866('0x10'),_0x160e35,_0x5450d0[_0xd866('0x14')][_0xd866('0x15')]);return _0x5cb991(_0x5450d0[_0xd866('0x14')][_0xd866('0x15')]);}else{logger['info'](_0xd866('0x10'),_0x160e35,_0xd866('0x11'));_0x5cb991(_0x5450d0[_0xd866('0x16')][_0xd866('0x15')]);}})[_0xd866('0x17')](function(_0x4f01eb){logger[_0xd866('0x14')](_0xd866('0x10'),_0x160e35,_0x4f01eb);_0x25517a(_0x4f01eb);});});} \ No newline at end of file +var _0xbe10=['debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0xbe10,0x133));var _0x0be1=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xbe10[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x0be1('0x0'));var moment=require('moment');var BPromise=require(_0x0be1('0x1'));var rs=require(_0x0be1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0be1('0x3'))['db'];var utils=require(_0x0be1('0x4'));var logger=require('../../config/logger')(_0x0be1('0x5'));var config=require(_0x0be1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0be1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21208b,_0x56594c,_0x522552){return new BPromise(function(_0x5293c4,_0x560779){return client[_0x0be1('0x8')](_0x21208b,_0x522552)[_0x0be1('0x9')](function(_0x43e271){logger[_0x0be1('0xa')](_0x0be1('0xb'),_0x56594c,_0x0be1('0xc'));logger[_0x0be1('0xd')](_0x0be1('0xe'),_0x56594c,_0x0be1('0xc'),JSON['stringify'](_0x43e271));if(_0x43e271[_0x0be1('0xf')]){if(_0x43e271[_0x0be1('0xf')][_0x0be1('0x10')]===0x1f4){logger['error'](_0x0be1('0xb'),_0x56594c,_0x43e271[_0x0be1('0xf')][_0x0be1('0x11')]);return _0x560779(_0x43e271['error'][_0x0be1('0x11')]);}logger[_0x0be1('0xf')](_0x0be1('0xb'),_0x56594c,_0x43e271['error'][_0x0be1('0x11')]);return _0x5293c4(_0x43e271['error']['message']);}else{logger[_0x0be1('0xa')](_0x0be1('0xb'),_0x56594c,_0x0be1('0xc'));_0x5293c4(_0x43e271[_0x0be1('0x12')][_0x0be1('0x11')]);}})[_0x0be1('0x13')](function(_0x45a7d1){logger[_0x0be1('0xf')](_0x0be1('0xb'),_0x56594c,_0x45a7d1);_0x560779(_0x45a7d1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 67234a8..fe050eb 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 _0x989a=['../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x989a,0x1ae));var _0xa989=function(_0x30cf99,_0x1620bd){_0x30cf99=_0x30cf99-0x0;var _0x317b88=_0x989a[_0x30cf99];return _0x317b88;};'use strict';var multer=require(_0xa989('0x0'));var util=require(_0xa989('0x1'));var path=require('path');var timeout=require(_0xa989('0x2'));var express=require(_0xa989('0x3'));var router=express[_0xa989('0x4')]();var fs_extra=require(_0xa989('0x5'));var auth=require(_0xa989('0x6'));var interaction=require(_0xa989('0x7'));var config=require(_0xa989('0x8'));var controller=require(_0xa989('0x9'));router[_0xa989('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa989('0xa')](_0xa989('0xb'),auth[_0xa989('0xc')](),controller[_0xa989('0xd')]);router['get'](_0xa989('0xe'),auth[_0xa989('0xc')](),controller['show']);router[_0xa989('0xa')](_0xa989('0xf'),auth[_0xa989('0xc')](),controller[_0xa989('0x10')]);router[_0xa989('0x11')]('/',auth[_0xa989('0xc')](),controller[_0xa989('0x12')]);router[_0xa989('0x11')](_0xa989('0xf'),auth[_0xa989('0xc')](),controller[_0xa989('0x13')]);router['put'](_0xa989('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xa989('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xa989('0x15')]);module[_0xa989('0x16')]=router; \ No newline at end of file +var _0x64eb=['addContacts','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts','getContacts','create','post'];(function(_0x1a0f48,_0x3d07be){var _0x1bba75=function(_0x59422f){while(--_0x59422f){_0x1a0f48['push'](_0x1a0f48['shift']());}};_0x1bba75(++_0x3d07be);}(_0x64eb,0x109));var _0xb64e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x64eb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb64e('0x0'));var util=require(_0xb64e('0x1'));var path=require(_0xb64e('0x2'));var timeout=require(_0xb64e('0x3'));var express=require(_0xb64e('0x4'));var router=express[_0xb64e('0x5')]();var fs_extra=require(_0xb64e('0x6'));var auth=require(_0xb64e('0x7'));var interaction=require(_0xb64e('0x8'));var config=require(_0xb64e('0x9'));var controller=require(_0xb64e('0xa'));router[_0xb64e('0xb')]('/',auth[_0xb64e('0xc')](),controller['index']);router[_0xb64e('0xb')](_0xb64e('0xd'),auth['isAuthenticated'](),controller[_0xb64e('0xe')]);router[_0xb64e('0xb')](_0xb64e('0xf'),auth[_0xb64e('0xc')](),controller[_0xb64e('0x10')]);router[_0xb64e('0xb')](_0xb64e('0x11'),auth['isAuthenticated'](),controller[_0xb64e('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb64e('0x13')]);router[_0xb64e('0x14')](_0xb64e('0x11'),auth[_0xb64e('0xc')](),controller[_0xb64e('0x15')]);router[_0xb64e('0x16')](_0xb64e('0xf'),auth['isAuthenticated'](),controller[_0xb64e('0x17')]);router[_0xb64e('0x18')](_0xb64e('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xb64e('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 27a2ea2..401eeab 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 _0x47bf=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x47bf,0xa1));var _0xf47b=function(_0x27cb23,_0xac2b06){_0x27cb23=_0x27cb23-0x0;var _0x2d17c3=_0x47bf[_0x27cb23];return _0x2d17c3;};'use strict';var _=require(_0xf47b('0x0'));var Sequelize=require(_0xf47b('0x1'));module[_0xf47b('0x2')]={'firstName':{'type':Sequelize[_0xf47b('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf47b('0x3')]},'street':{'type':Sequelize[_0xf47b('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf47b('0x3')]},'country':{'type':Sequelize[_0xf47b('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf47b('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xf47b('0x3')]},'fax':{'type':Sequelize[_0xf47b('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xf47b('0x3')]},'facebook':{'type':Sequelize[_0xf47b('0x3')]},'fb_data':{'type':Sequelize[_0xf47b('0x3')]},'twitter':{'type':Sequelize[_0xf47b('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xf47b('0x3')]},'viber':{'type':Sequelize[_0xf47b('0x3')]},'line':{'type':Sequelize[_0xf47b('0x3')]},'wechat':{'type':Sequelize[_0xf47b('0x3')]},'telegram':{'type':Sequelize[_0xf47b('0x3')]},'UserId':{'type':Sequelize[_0xf47b('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf47b('0x5')](0x2)[_0xf47b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf47b('0x7')],'defaultValue':Sequelize[_0xf47b('0x8')]},'dialTimezone':{'type':Sequelize[_0xf47b('0x3')]},'utcOffset':{'type':Sequelize[_0xf47b('0x5')]}}; \ No newline at end of file +var _0x1dcd=['NOW','INTEGER','lodash','sequelize','exports','STRING','TEXT','UNSIGNED','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1dcd,0x1b2));var _0xd1dc=function(_0x13310c,_0x1efe01){_0x13310c=_0x13310c-0x0;var _0x149348=_0x1dcd[_0x13310c];return _0x149348;};'use strict';var _=require(_0xd1dc('0x0'));var Sequelize=require(_0xd1dc('0x1'));module[_0xd1dc('0x2')]={'firstName':{'type':Sequelize[_0xd1dc('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd1dc('0x3')]},'postalCode':{'type':Sequelize[_0xd1dc('0x3')]},'city':{'type':Sequelize[_0xd1dc('0x3')]},'country':{'type':Sequelize[_0xd1dc('0x3')]},'dateOfBirth':{'type':Sequelize[_0xd1dc('0x3')]},'description':{'type':Sequelize[_0xd1dc('0x4')]},'phone':{'type':Sequelize[_0xd1dc('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xd1dc('0x3')]},'email':{'type':Sequelize[_0xd1dc('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xd1dc('0x3')]},'fb_data':{'type':Sequelize[_0xd1dc('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xd1dc('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xd1dc('0x3')]},'line':{'type':Sequelize[_0xd1dc('0x3')]},'wechat':{'type':Sequelize[_0xd1dc('0x3')]},'telegram':{'type':Sequelize[_0xd1dc('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xd1dc('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd1dc('0x6')],'defaultValue':Sequelize[_0xd1dc('0x7')]},'dialTimezone':{'type':Sequelize[_0xd1dc('0x3')]},'utcOffset':{'type':Sequelize[_0xd1dc('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5f31e91..9faf6ba 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index f98b2ed..763acee 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 _0xe22a=['remove','emit','hasOwnProperty','hook','exports','events','CmContact','setMaxListeners','save'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xe22a,0x191));var _0xae22=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe22a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xae22('0x0'));var CmContact=require('../../mysqldb')['db'][_0xae22('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xae22('0x2')](0x0);var events={'afterCreate':_0xae22('0x3'),'afterUpdate':'update','afterDestroy':_0xae22('0x4')};function emitEvent(_0x17ae88){return function(_0x36b3bf,_0x38820f,_0x36ab06){CmContactEvents[_0xae22('0x5')](_0x17ae88+':'+_0x36b3bf['id'],_0x36b3bf);CmContactEvents[_0xae22('0x5')](_0x17ae88,_0x36b3bf);_0x36ab06(null);};}for(var e in events){if(events[_0xae22('0x6')](e)){var event=events[e];CmContact[_0xae22('0x7')](e,emitEvent(event));}}module[_0xae22('0x8')]=CmContactEvents; \ No newline at end of file +var _0x415c=['events','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x13911f,_0x433bae){var _0x1846c3=function(_0x1ebf68){while(--_0x1ebf68){_0x13911f['push'](_0x13911f['shift']());}};_0x1846c3(++_0x433bae);}(_0x415c,0x122));var _0xc415=function(_0x59d866,_0x27f8c9){_0x59d866=_0x59d866-0x0;var _0x4f3ca3=_0x415c[_0x59d866];return _0x4f3ca3;};'use strict';var EventEmitter=require(_0xc415('0x0'));var CmContact=require('../../mysqldb')['db'][_0xc415('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc415('0x2')](0x0);var events={'afterCreate':_0xc415('0x3'),'afterUpdate':_0xc415('0x4'),'afterDestroy':_0xc415('0x5')};function emitEvent(_0x44cb26){return function(_0x208c48,_0x535a58,_0xece60e){CmContactEvents['emit'](_0x44cb26+':'+_0x208c48['id'],_0x208c48);CmContactEvents[_0xc415('0x6')](_0x44cb26,_0x208c48);_0xece60e(null);};}for(var e in events){if(events[_0xc415('0x7')](e)){var event=events[e];CmContact[_0xc415('0x8')](e,emitEvent(event));}}module[_0xc415('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index a829d13..1ec1798 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 _0x3302=['then','isNil','utcOffset','minutes','ret','CmHopper','create','ListId','priority','callbackUniqueid','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','inspect','timezones','add','cmContact,\x20afterCreate\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','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','length','get','always','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','afterCreate','Campaign','Lists','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','utf8mb4','utf8mb4_unicode_ci','models','error','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne'];(function(_0x3c758e,_0x29b3af){var _0x29ed90=function(_0x5d70b8){while(--_0x5d70b8){_0x3c758e['push'](_0x3c758e['shift']());}};_0x29ed90(++_0x29b3af);}(_0x3302,0x74));var _0x2330=function(_0x27adad,_0x23a754){_0x27adad=_0x27adad-0x0;var _0x259dc7=_0x3302[_0x27adad];return _0x259dc7;};'use strict';var _=require(_0x2330('0x0'));var util=require(_0x2330('0x1'));var logger=require(_0x2330('0x2'))(_0x2330('0x3'));var moment=require(_0x2330('0x4'));var BPromise=require(_0x2330('0x5'));var rp=require(_0x2330('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2330('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0x2330('0x8'));module[_0x2330('0x9')]=function(_0x331662,_0x398bfc){return _0x331662['define'](_0x2330('0xa'),attributes,{'tableName':_0x2330('0xb'),'paranoid':!![],'indexes':[{'name':_0x2330('0xc'),'fields':['phone']},{'name':_0x2330('0xd'),'fields':['firstName',_0x2330('0xe'),_0x2330('0xc'),_0x2330('0xf'),_0x2330('0x10'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x2330('0x11'),'collate':_0x2330('0x12'),'hooks':{'afterCreate':function(_0x47b554,_0x5c6fec,_0x49bb2b){var _0x5aea79=_0x331662[_0x2330('0x13')];var _0x256d8e=_0x47b554['get']({'plain':!![]});function _0x31c715(){return function(_0x4c1123){logger[_0x2330('0x14')]('cmContact','afterCreate',util['inspect'](_0x4c1123,{'showHidden':![],'depth':null}));};}function _0x44af9e(_0x3970a0,_0x3464b2){var _0x1fed85=_0x3464b2[_0x2330('0x15')]?_0x3464b2['scheduledat']:moment()[_0x2330('0x16')](_0x2330('0x17'));return new BPromise(function(_0x5b1d26,_0x378945){if(_['isNil'](_0x3464b2[_0x2330('0x18')])){_0x5b1d26({'ret':_0x1fed85});}else{_0x5aea79['VoiceQueue'][_0x2330('0x19')]({'where':{'id':_0x3970a0['id']}})[_0x2330('0x1a')](function(_0x3f650e){if(!_[_0x2330('0x1b')](_0x3f650e)){var _0x2330fc=_0x3f650e['dialTimezone'];if(!_[_0x2330('0x1b')](_0x2330fc)){var _0x37b5d1=shared['timezones'];var _0x2403ca=_0x37b5d1[_0x2330fc];var _0xddfd1d=_0x37b5d1[_0x3464b2[_0x2330('0x18')]];if(!_['isNil'](_0x2403ca)&&!_[_0x2330('0x1b')](_0xddfd1d)){var _0x9b028=_0x2403ca[_0x2330('0x1c')]-_0xddfd1d['utcOffset'];_0x1fed85=_0x3464b2[_0x2330('0x15')]?_0x3464b2[_0x2330('0x15')]:moment();var _0x1ce912=moment(_0x1fed85)['add'](_0x9b028,_0x2330('0x1d'));_0x5b1d26({'ret':_0x1ce912['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5b1d26({'ret':_0x1fed85});}else _0x5b1d26({'ret':_0x1fed85});}else{_0x5b1d26({'ret':_0x1fed85});}});}});return 0xa;}var _0x1df993=function(_0x1573bb){return new BPromise(function(_0x4d7731,_0x316d75){_0x44af9e(_0x1573bb,_0x256d8e)[_0x2330('0x1a')](function(_0x5a0d96){_0x256d8e['scheduledat']=_0x5a0d96[_0x2330('0x1e')];_0x5aea79[_0x2330('0x1f')][_0x2330('0x19')]({'where':{'phone':_0x256d8e[_0x2330('0xc')],'VoiceQueueId':_0x1573bb['id']}})[_0x2330('0x1a')](function(_0x1ff481){if(!_[_0x2330('0x1b')](_0x1ff481)){throw new Error('cmContact,\x20afterCreate\x20'+_0x256d8e['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1573bb['id']);}return _0x5aea79['CmHopper'][_0x2330('0x20')]({'phone':_0x256d8e[_0x2330('0xc')],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e[_0x2330('0x21')],'priority':_0x256d8e[_0x2330('0x22')]?_0x256d8e[_0x2330('0x22')]:0x2,'scheduledat':_0x256d8e['scheduledat']?_0x256d8e[_0x2330('0x15')]:moment()[_0x2330('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x256d8e[_0x2330('0x23')]?!![]:![],'callbackuniqueid':_0x256d8e[_0x2330('0x23')]?_0x256d8e[_0x2330('0x23')]:undefined,'callbackat':_0x256d8e[_0x2330('0x23')]?moment()[_0x2330('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1573bb['id']});})[_0x2330('0x24')](function(_0x4133a7){_0x316d75(_0x4133a7);});});});};var _0x42d164=function(_0x54b4ee){return new BPromise(function(_0x3b8de8,_0x211c55){_0x44af9e(_0x54b4ee,_0x256d8e)['then'](function(_0x5c29ca){_0x256d8e['scheduledat']=_0x5c29ca[_0x2330('0x1e')];_0x5aea79[_0x2330('0x1f')]['findOne']({'where':{'phone':_0x256d8e['phone'],'VoiceQueueId':_0x54b4ee['id']}})[_0x2330('0x1a')](function(_0x17f45b){if(!_['isNil'](_0x17f45b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x256d8e[_0x2330('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x54b4ee['id']);}return _0x5aea79[_0x2330('0x25')][_0x2330('0x19')]({'where':{'calleridnum':_0x256d8e[_0x2330('0xc')],'VoiceQueueId':_0x54b4ee['id']}});})[_0x2330('0x1a')](function(_0x5bd473){if(!_[_0x2330('0x1b')](_0x5bd473)){throw new Error(_0x2330('0x26')+_0x256d8e[_0x2330('0xc')]+_0x2330('0x27')+_0x54b4ee['id']);}return _0x5aea79[_0x2330('0x1f')]['create']({'phone':_0x256d8e[_0x2330('0xc')],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e['ListId'],'priority':_0x256d8e['priority']?_0x256d8e[_0x2330('0x22')]:0x2,'scheduledat':_0x256d8e[_0x2330('0x15')]?_0x256d8e[_0x2330('0x15')]:moment()[_0x2330('0x16')](_0x2330('0x17')),'callback':_0x256d8e[_0x2330('0x23')]?!![]:![],'callbackuniqueid':_0x256d8e['callbackUniqueid']?_0x256d8e['callbackUniqueid']:undefined,'callbackat':_0x256d8e[_0x2330('0x23')]?moment()[_0x2330('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x54b4ee['id']});})['catch'](function(_0xd4c7e0){_0x211c55(_0xd4c7e0);});});});};function _0x2b851c(){return function(_0x19ace7){logger['error'](_0x2330('0x28'),'afterCreate',util[_0x2330('0x29')](_0x19ace7,{'showHidden':![],'depth':null}));};}function _0x23a6fa(_0x4dc657,_0x2fd27f){var _0x826fee=_0x2fd27f['scheduledat']?_0x2fd27f['scheduledat']:moment()[_0x2330('0x16')](_0x2330('0x17'));return new BPromise(function(_0x105a3f,_0x5826bf){if(_[_0x2330('0x1b')](_0x2fd27f[_0x2330('0x18')])){_0x105a3f({'ret':_0x826fee});}else{_0x5aea79['Campaign'][_0x2330('0x19')]({'where':{'id':_0x4dc657['id']}})['then'](function(_0x91ae8c){if(!_[_0x2330('0x1b')](_0x91ae8c)){var _0x294a43=_0x91ae8c['dialTimezone'];if(!_[_0x2330('0x1b')](_0x294a43)){var _0x20af54=shared[_0x2330('0x2a')];var _0x1511ff=_0x20af54[_0x294a43];var _0x22d376=_0x20af54[_0x2fd27f[_0x2330('0x18')]];if(!_[_0x2330('0x1b')](_0x1511ff)&&!_[_0x2330('0x1b')](_0x22d376)){var _0x63ec26=_0x1511ff[_0x2330('0x1c')]-_0x22d376[_0x2330('0x1c')];_0x826fee=_0x2fd27f[_0x2330('0x15')]?_0x2fd27f['scheduledat']:moment();var _0x27570b=moment(_0x826fee)[_0x2330('0x2b')](_0x63ec26,_0x2330('0x1d'));_0x105a3f({'ret':_0x27570b[_0x2330('0x16')](_0x2330('0x17'))});}else _0x105a3f({'ret':_0x826fee});}else _0x105a3f({'ret':_0x826fee});}else{_0x105a3f({'ret':_0x826fee});}});}});return 0xa;}var _0x553c5d=function(_0x12b5c0){return new BPromise(function(_0x534a97,_0x47fdd5){_0x23a6fa(_0x12b5c0,_0x256d8e)['then'](function(_0x33e274){_0x256d8e['scheduledat']=_0x33e274[_0x2330('0x1e')];_0x5aea79['CmHopper'][_0x2330('0x19')]({'where':{'phone':_0x256d8e[_0x2330('0xc')],'CampaignId':_0x12b5c0['id']}})[_0x2330('0x1a')](function(_0x230470){if(!_[_0x2330('0x1b')](_0x230470)){throw new Error('cmContact,\x20afterCreate\x20'+_0x256d8e[_0x2330('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x12b5c0['id']);}return _0x5aea79[_0x2330('0x1f')][_0x2330('0x20')]({'phone':_0x256d8e['phone'],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e[_0x2330('0x21')],'priority':_0x256d8e['priority']?_0x256d8e['priority']:0x2,'scheduledat':_0x256d8e['scheduledat']?_0x256d8e['scheduledat']:moment()[_0x2330('0x16')](_0x2330('0x17')),'callback':_0x256d8e[_0x2330('0x23')]?!![]:![],'callbackuniqueid':_0x256d8e['callbackUniqueid']?_0x256d8e[_0x2330('0x23')]:undefined,'callbackat':_0x256d8e[_0x2330('0x23')]?moment()[_0x2330('0x16')](_0x2330('0x17')):undefined,'CampaignId':_0x12b5c0['id']});})[_0x2330('0x24')](function(_0x3249eb){_0x47fdd5(_0x3249eb);});});});};var _0x218ed2=function(_0x42f296){return new BPromise(function(_0x337cd5,_0x2b9020){_0x23a6fa(_0x42f296,_0x256d8e)[_0x2330('0x1a')](function(_0x50ffdb){_0x256d8e[_0x2330('0x15')]=_0x50ffdb[_0x2330('0x1e')];_0x5aea79[_0x2330('0x1f')]['findOne']({'where':{'phone':_0x256d8e[_0x2330('0xc')],'CampaignId':_0x42f296['id']}})[_0x2330('0x1a')](function(_0x2000ea){if(!_['isNil'](_0x2000ea)){throw new Error(_0x2330('0x2c')+_0x256d8e[_0x2330('0xc')]+_0x2330('0x2d')+_0x42f296['id']);}return _0x5aea79['CmHopperFinal'][_0x2330('0x19')]({'where':{'calleridnum':_0x256d8e['phone'],'CampaignId':_0x42f296['id']}});})[_0x2330('0x1a')](function(_0x1b476c){if(!_[_0x2330('0x1b')](_0x1b476c)){throw new Error(_0x2330('0x26')+_0x256d8e['phone']+_0x2330('0x2e')+_0x42f296['id']);}return _0x5aea79[_0x2330('0x1f')][_0x2330('0x20')]({'phone':_0x256d8e[_0x2330('0xc')],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e[_0x2330('0x21')],'priority':_0x256d8e['priority']?_0x256d8e[_0x2330('0x22')]:0x2,'scheduledat':_0x256d8e[_0x2330('0x15')]?_0x256d8e[_0x2330('0x15')]:moment()[_0x2330('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x256d8e[_0x2330('0x23')]?!![]:![],'callbackuniqueid':_0x256d8e['callbackUniqueid']?_0x256d8e[_0x2330('0x23')]:undefined,'callbackat':_0x256d8e[_0x2330('0x23')]?moment()[_0x2330('0x16')](_0x2330('0x17')):undefined,'CampaignId':_0x42f296['id']});})['catch'](function(_0x2ea0ea){_0x2b9020(_0x2ea0ea);});});});};if(_0x256d8e[_0x2330('0x21')]){_0x5aea79[_0x2330('0x2f')][_0x2330('0x30')]({'where':{'type':_0x2330('0x31')},'attributes':['id',_0x2330('0x32'),_0x2330('0x18')],'include':[{'model':_0x5aea79[_0x2330('0x33')],'as':'Lists','where':{'id':_0x256d8e[_0x2330('0x21')]}}]})[_0x2330('0x1a')](function(_0x53e768){if(_0x53e768){var _0x9c148e=[];for(var _0x3a3979=0x0,_0x488deb;_0x3a3979<_0x53e768[_0x2330('0x34')];_0x3a3979+=0x1){_0x488deb=_0x53e768[_0x3a3979][_0x2330('0x35')]({'plain':!![]});switch(_0x488deb[_0x2330('0x32')]){case _0x2330('0x36'):_0x42d164(_0x488deb)[_0x2330('0x24')](_0x31c715());break;case'onlyIfOpen':_0x1df993(_0x488deb)['catch'](_0x31c715());break;default:_0x23a6fa(_0x488deb,_0x256d8e)[_0x2330('0x1a')](function(_0x2529e3){_0x256d8e['scheduledat']=_0x2529e3['ret'];_0x5aea79[_0x2330('0x1f')][_0x2330('0x20')]({'phone':_0x256d8e['phone'],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e['ListId'],'scheduledat':_0x256d8e['scheduledat']?_0x256d8e[_0x2330('0x15')]:moment()[_0x2330('0x16')](_0x2330('0x17')),'priority':_0x256d8e[_0x2330('0x22')]?_0x256d8e['priority']:0x2,'callback':_0x256d8e[_0x2330('0x23')]?!![]:![],'callbackuniqueid':_0x256d8e[_0x2330('0x23')]?_0x256d8e[_0x2330('0x23')]:undefined,'callbackat':_0x256d8e[_0x2330('0x23')]?moment()[_0x2330('0x16')](_0x2330('0x17')):undefined,'VoiceQueueId':_0x488deb['id']})[_0x2330('0x24')](_0x31c715());});}}}})['then'](function(){return _0x5aea79[_0x2330('0x2f')][_0x2330('0x30')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x5aea79['CmList'],'as':_0x2330('0x37'),'where':{'id':_0x256d8e[_0x2330('0x21')]}}]})[_0x2330('0x1a')](function(_0xe53f64){if(_0xe53f64){var _0x22bc04=[];for(var _0x155c5c=0x0,_0x1bba29;_0x155c5c<_0xe53f64[_0x2330('0x34')];_0x155c5c+=0x1){_0x1bba29=_0xe53f64[_0x155c5c][_0x2330('0x35')]({'plain':!![]});_0x5aea79[_0x2330('0x38')][_0x2330('0x20')]({'phone':_0x256d8e[_0x2330('0xc')],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e[_0x2330('0x21')],'VoiceQueueId':_0x1bba29['id']})[_0x2330('0x24')](function(_0x36103c){logger['error'](_0x2330('0x39'),_0x2330('0x3a'),_0x36103c['message']);});}}});})[_0x2330('0x1a')](function(){return _0x5aea79[_0x2330('0x3b')][_0x2330('0x30')]({'attributes':['id',_0x2330('0x32'),_0x2330('0x18')],'include':[{'model':_0x5aea79[_0x2330('0x33')],'as':_0x2330('0x3c'),'where':{'id':_0x256d8e[_0x2330('0x21')]}}]})['then'](function(_0x3cbafb){if(_0x3cbafb){var _0x2d16bb=[];for(var _0x1b3efb=0x0,_0x4931f1;_0x1b3efb<_0x3cbafb['length'];_0x1b3efb+=0x1){_0x4931f1=_0x3cbafb[_0x1b3efb][_0x2330('0x35')]({'plain':!![]});switch(_0x4931f1[_0x2330('0x32')]){case'always':_0x218ed2(_0x4931f1)[_0x2330('0x24')](_0x2b851c());break;case'onlyIfOpen':_0x553c5d(_0x4931f1)[_0x2330('0x24')](_0x2b851c());break;default:_0x5aea79[_0x2330('0x1f')]['create']({'phone':_0x256d8e[_0x2330('0xc')],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e['ListId'],'scheduledat':_0x256d8e[_0x2330('0x15')]?_0x256d8e[_0x2330('0x15')]:moment()[_0x2330('0x16')](_0x2330('0x17')),'priority':_0x256d8e[_0x2330('0x22')]?_0x256d8e['priority']:0x2,'callback':_0x256d8e[_0x2330('0x23')]?!![]:![],'callbackuniqueid':_0x256d8e[_0x2330('0x23')]?_0x256d8e['callbackUniqueid']:undefined,'callbackat':_0x256d8e[_0x2330('0x23')]?moment()['format'](_0x2330('0x17')):undefined,'CampaignId':_0x4931f1['id']})['catch'](_0x2b851c());}}}});})['then'](function(){return _0x5aea79[_0x2330('0x3b')][_0x2330('0x30')]({'attributes':['id'],'include':[{'model':_0x5aea79[_0x2330('0x33')],'as':_0x2330('0x37'),'where':{'id':_0x256d8e[_0x2330('0x21')]}}]})['then'](function(_0x29acc1){if(_0x29acc1){var _0x1774e0=[];for(var _0x440573=0x0,_0x5dd4c8;_0x440573<_0x29acc1[_0x2330('0x34')];_0x440573+=0x1){_0x5dd4c8=_0x29acc1[_0x440573][_0x2330('0x35')]({'plain':!![]});_0x5aea79[_0x2330('0x38')][_0x2330('0x20')]({'phone':_0x256d8e[_0x2330('0xc')],'ContactId':_0x256d8e['id'],'ListId':_0x256d8e['ListId'],'CampaignId':_0x5dd4c8['id']})[_0x2330('0x24')](function(_0x308432){logger[_0x2330('0x14')](_0x2330('0x39'),'afterCreate',_0x308432['message']);});}}});})['then'](function(){_0x49bb2b();})[_0x2330('0x24')](function(_0xcce761){logger[_0x2330('0x14')](_0x2330('0x39'),_0x2330('0x3a'),_0xcce761[_0x2330('0x3d')]);_0x49bb2b(_0xcce761);});}else{_0x49bb2b(new Error(_0x2330('0x3e')));}},'afterDestroy':function(_0x9d9526,_0x2af18d,_0x3ba008){var _0x185835=_0x331662[_0x2330('0x13')];var _0x226cf2=_0x9d9526['get']({'plain':!![]});return _0x185835[_0x2330('0x1f')][_0x2330('0x30')]({'raw':!![],'where':{'ListId':_0x226cf2[_0x2330('0x21')],'ContactId':_0x226cf2['id']}})[_0x2330('0x1a')](function(_0x5bacf2){if(!_[_0x2330('0x3f')](_0x5bacf2)){var _0x58f122=[];for(var _0x1bfe0b=0x0;_0x1bfe0b<_0x5bacf2[_0x2330('0x34')];_0x1bfe0b+=0x1){var _0x3c9c67=_0x185835[_0x2330('0x1f')][_0x2330('0x40')]({'where':{'ListId':_0x5bacf2[_0x1bfe0b][_0x2330('0x21')],'ContactId':_0x5bacf2[_0x1bfe0b][_0x2330('0x41')],'VoiceQueueId':_0x5bacf2[_0x1bfe0b][_0x2330('0x42')],'CampaignId':_0x5bacf2[_0x1bfe0b][_0x2330('0x43')]}});_0x58f122['push'](_0x3c9c67);}return BPromise[_0x2330('0x44')](_0x58f122);}})[_0x2330('0x1a')](function(_0x971ceb){logger[_0x2330('0x45')](_0x2330('0x46'),util[_0x2330('0x29')](_0x971ceb,{'showHidden':![],'depth':null}));_0x3ba008();})[_0x2330('0x24')](function(_0x1a775e){logger['error']('[CmContact][afterDestroy][Error]',util[_0x2330('0x29')](_0x1a775e,{'showHidden':![],'depth':null}));_0x3ba008(_0x1a775e);});}}});}; \ No newline at end of file +var _0x13ca=['format','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','ret','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','afterCreate','Campaign','minutes','\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','CmList','Lists','dialCheckDuplicateType','onlyIfOpen','outbound','BlackLists','length','cmContact,\x20%s,\x20%s','message','always','CmHopperBlack','isEmpty','destroy','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Error]','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add'];(function(_0x1d369f,_0x57a8d5){var _0x11fc4d=function(_0x4677c2){while(--_0x4677c2){_0x1d369f['push'](_0x1d369f['shift']());}};_0x11fc4d(++_0x57a8d5);}(_0x13ca,0x1e3));var _0xa13c=function(_0x3a5907,_0x126e8f){_0x3a5907=_0x3a5907-0x0;var _0x1b1b4e=_0x13ca[_0x3a5907];return _0x1b1b4e;};'use strict';var _=require(_0xa13c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa13c('0x1'));var BPromise=require(_0xa13c('0x2'));var rp=require(_0xa13c('0x3'));var fs=require('fs');var path=require(_0xa13c('0x4'));var rimraf=require(_0xa13c('0x5'));var config=require(_0xa13c('0x6'));var shared=require(_0xa13c('0x7'));var attributes=require(_0xa13c('0x8'));module[_0xa13c('0x9')]=function(_0x94ba4d,_0xb455db){return _0x94ba4d[_0xa13c('0xa')](_0xa13c('0xb'),attributes,{'tableName':_0xa13c('0xc'),'paranoid':!![],'indexes':[{'name':_0xa13c('0xd'),'fields':[_0xa13c('0xd')]},{'name':_0xa13c('0xe'),'fields':['firstName','lastName',_0xa13c('0xd'),_0xa13c('0xf'),_0xa13c('0x10'),_0xa13c('0x11')],'type':_0xa13c('0x12')}],'timestamps':!![],'charset':_0xa13c('0x13'),'collate':_0xa13c('0x14'),'hooks':{'afterCreate':function(_0x18a1d2,_0x23c3d2,_0x19cfe2){var _0x210337=_0x94ba4d[_0xa13c('0x15')];var _0x33795d=_0x18a1d2[_0xa13c('0x16')]({'plain':!![]});function _0x193fec(){return function(_0x30fed8){logger[_0xa13c('0x17')](_0xa13c('0x18'),'afterCreate',util[_0xa13c('0x19')](_0x30fed8,{'showHidden':![],'depth':null}));};}function _0x5e11e9(_0x2ad4b0,_0x3703c7){var _0x66f736=_0x3703c7[_0xa13c('0x1a')]?_0x3703c7[_0xa13c('0x1a')]:moment()['format'](_0xa13c('0x1b'));return new BPromise(function(_0x4c0894,_0x1e1014){if(_[_0xa13c('0x1c')](_0x3703c7[_0xa13c('0x1d')])){_0x4c0894({'ret':_0x66f736});}else{_0x210337[_0xa13c('0x1e')]['findOne']({'where':{'id':_0x2ad4b0['id']}})[_0xa13c('0x1f')](function(_0x8b08a){if(!_['isNil'](_0x8b08a)){var _0x342c1e=_0x8b08a[_0xa13c('0x1d')];if(!_[_0xa13c('0x1c')](_0x342c1e)){var _0x12184d=shared[_0xa13c('0x20')];var _0x473ee7=_0x12184d[_0x342c1e];var _0x48e107=_0x12184d[_0x3703c7[_0xa13c('0x1d')]];if(!_[_0xa13c('0x1c')](_0x473ee7)&&!_[_0xa13c('0x1c')](_0x48e107)){var _0x4ef22e=_0x473ee7[_0xa13c('0x21')]-_0x48e107['utcOffset'];_0x66f736=_0x3703c7[_0xa13c('0x1a')]?_0x3703c7[_0xa13c('0x1a')]:moment();var _0x86bfe8=moment(_0x66f736)[_0xa13c('0x22')](_0x4ef22e,'minutes');_0x4c0894({'ret':_0x86bfe8[_0xa13c('0x23')](_0xa13c('0x1b'))});}else _0x4c0894({'ret':_0x66f736});}else _0x4c0894({'ret':_0x66f736});}else{_0x4c0894({'ret':_0x66f736});}});}});return 0xa;}var _0x57da25=function(_0x1ceb72){return new BPromise(function(_0xa088d,_0xb03f7a){_0x5e11e9(_0x1ceb72,_0x33795d)[_0xa13c('0x1f')](function(_0x304871){_0x33795d[_0xa13c('0x1a')]=_0x304871['ret'];_0x210337[_0xa13c('0x24')][_0xa13c('0x25')]({'where':{'phone':_0x33795d['phone'],'VoiceQueueId':_0x1ceb72['id']}})[_0xa13c('0x1f')](function(_0x33e5b6){if(!_[_0xa13c('0x1c')](_0x33e5b6)){throw new Error(_0xa13c('0x26')+_0x33795d[_0xa13c('0xd')]+_0xa13c('0x27')+_0x1ceb72['id']);}return _0x210337[_0xa13c('0x24')][_0xa13c('0x28')]({'phone':_0x33795d[_0xa13c('0xd')],'ContactId':_0x33795d['id'],'ListId':_0x33795d['ListId'],'priority':_0x33795d[_0xa13c('0x29')]?_0x33795d[_0xa13c('0x29')]:0x2,'scheduledat':_0x33795d[_0xa13c('0x1a')]?_0x33795d[_0xa13c('0x1a')]:moment()[_0xa13c('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x33795d[_0xa13c('0x2a')]?!![]:![],'callbackuniqueid':_0x33795d['callbackUniqueid']?_0x33795d[_0xa13c('0x2a')]:undefined,'callbackat':_0x33795d['callbackUniqueid']?moment()[_0xa13c('0x23')](_0xa13c('0x1b')):undefined,'VoiceQueueId':_0x1ceb72['id']});})[_0xa13c('0x2b')](function(_0x52a818){_0xb03f7a(_0x52a818);});});});};var _0x130fa4=function(_0x900246){return new BPromise(function(_0x2cbb73,_0x338722){_0x5e11e9(_0x900246,_0x33795d)[_0xa13c('0x1f')](function(_0x1ccec9){_0x33795d['scheduledat']=_0x1ccec9[_0xa13c('0x2c')];_0x210337[_0xa13c('0x24')][_0xa13c('0x25')]({'where':{'phone':_0x33795d['phone'],'VoiceQueueId':_0x900246['id']}})[_0xa13c('0x1f')](function(_0x244ac5){if(!_[_0xa13c('0x1c')](_0x244ac5)){throw new Error(_0xa13c('0x26')+_0x33795d[_0xa13c('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x900246['id']);}return _0x210337[_0xa13c('0x2d')][_0xa13c('0x25')]({'where':{'calleridnum':_0x33795d[_0xa13c('0xd')],'VoiceQueueId':_0x900246['id']}});})[_0xa13c('0x1f')](function(_0x2e6b23){if(!_[_0xa13c('0x1c')](_0x2e6b23)){throw new Error(_0xa13c('0x2e')+_0x33795d[_0xa13c('0xd')]+_0xa13c('0x2f')+_0x900246['id']);}return _0x210337[_0xa13c('0x24')][_0xa13c('0x28')]({'phone':_0x33795d[_0xa13c('0xd')],'ContactId':_0x33795d['id'],'ListId':_0x33795d[_0xa13c('0x30')],'priority':_0x33795d[_0xa13c('0x29')]?_0x33795d[_0xa13c('0x29')]:0x2,'scheduledat':_0x33795d[_0xa13c('0x1a')]?_0x33795d[_0xa13c('0x1a')]:moment()[_0xa13c('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x33795d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x33795d[_0xa13c('0x2a')]?_0x33795d[_0xa13c('0x2a')]:undefined,'callbackat':_0x33795d[_0xa13c('0x2a')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x900246['id']});})[_0xa13c('0x2b')](function(_0x1e6e4a){_0x338722(_0x1e6e4a);});});});};function _0x3c51f0(){return function(_0x1aad81){logger['error'](_0xa13c('0x18'),_0xa13c('0x31'),util[_0xa13c('0x19')](_0x1aad81,{'showHidden':![],'depth':null}));};}function _0x2f1f46(_0x27ead5,_0x5d34ad){var _0x549e45=_0x5d34ad[_0xa13c('0x1a')]?_0x5d34ad[_0xa13c('0x1a')]:moment()[_0xa13c('0x23')](_0xa13c('0x1b'));return new BPromise(function(_0x3bbd35,_0x11f07b){if(_['isNil'](_0x5d34ad[_0xa13c('0x1d')])){_0x3bbd35({'ret':_0x549e45});}else{_0x210337[_0xa13c('0x32')][_0xa13c('0x25')]({'where':{'id':_0x27ead5['id']}})[_0xa13c('0x1f')](function(_0x1bc13){if(!_[_0xa13c('0x1c')](_0x1bc13)){var _0x29454c=_0x1bc13[_0xa13c('0x1d')];if(!_[_0xa13c('0x1c')](_0x29454c)){var _0x460c10=shared[_0xa13c('0x20')];var _0x56c14d=_0x460c10[_0x29454c];var _0x3164c5=_0x460c10[_0x5d34ad[_0xa13c('0x1d')]];if(!_[_0xa13c('0x1c')](_0x56c14d)&&!_[_0xa13c('0x1c')](_0x3164c5)){var _0x10fac1=_0x56c14d[_0xa13c('0x21')]-_0x3164c5['utcOffset'];_0x549e45=_0x5d34ad[_0xa13c('0x1a')]?_0x5d34ad[_0xa13c('0x1a')]:moment();var _0x20bacb=moment(_0x549e45)['add'](_0x10fac1,_0xa13c('0x33'));_0x3bbd35({'ret':_0x20bacb['format'](_0xa13c('0x1b'))});}else _0x3bbd35({'ret':_0x549e45});}else _0x3bbd35({'ret':_0x549e45});}else{_0x3bbd35({'ret':_0x549e45});}});}});return 0xa;}var _0xd9e426=function(_0x3bd3e1){return new BPromise(function(_0x49dcd4,_0x5a0681){_0x2f1f46(_0x3bd3e1,_0x33795d)['then'](function(_0x29bafd){_0x33795d[_0xa13c('0x1a')]=_0x29bafd[_0xa13c('0x2c')];_0x210337[_0xa13c('0x24')]['findOne']({'where':{'phone':_0x33795d[_0xa13c('0xd')],'CampaignId':_0x3bd3e1['id']}})[_0xa13c('0x1f')](function(_0x327676){if(!_[_0xa13c('0x1c')](_0x327676)){throw new Error('cmContact,\x20afterCreate\x20'+_0x33795d[_0xa13c('0xd')]+_0xa13c('0x34')+_0x3bd3e1['id']);}return _0x210337[_0xa13c('0x24')][_0xa13c('0x28')]({'phone':_0x33795d[_0xa13c('0xd')],'ContactId':_0x33795d['id'],'ListId':_0x33795d[_0xa13c('0x30')],'priority':_0x33795d[_0xa13c('0x29')]?_0x33795d['priority']:0x2,'scheduledat':_0x33795d[_0xa13c('0x1a')]?_0x33795d['scheduledat']:moment()[_0xa13c('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x33795d[_0xa13c('0x2a')]?!![]:![],'callbackuniqueid':_0x33795d[_0xa13c('0x2a')]?_0x33795d[_0xa13c('0x2a')]:undefined,'callbackat':_0x33795d[_0xa13c('0x2a')]?moment()[_0xa13c('0x23')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3bd3e1['id']});})['catch'](function(_0xac6a0d){_0x5a0681(_0xac6a0d);});});});};var _0x7a10f6=function(_0x2b4ae1){return new BPromise(function(_0x3ecb7d,_0x105647){_0x2f1f46(_0x2b4ae1,_0x33795d)['then'](function(_0x2a94b8){_0x33795d[_0xa13c('0x1a')]=_0x2a94b8[_0xa13c('0x2c')];_0x210337[_0xa13c('0x24')][_0xa13c('0x25')]({'where':{'phone':_0x33795d[_0xa13c('0xd')],'CampaignId':_0x2b4ae1['id']}})[_0xa13c('0x1f')](function(_0x4b296b){if(!_['isNil'](_0x4b296b)){throw new Error(_0xa13c('0x26')+_0x33795d[_0xa13c('0xd')]+_0xa13c('0x35')+_0x2b4ae1['id']);}return _0x210337[_0xa13c('0x2d')][_0xa13c('0x25')]({'where':{'calleridnum':_0x33795d[_0xa13c('0xd')],'CampaignId':_0x2b4ae1['id']}});})[_0xa13c('0x1f')](function(_0x52a4e3){if(!_['isNil'](_0x52a4e3)){throw new Error(_0xa13c('0x2e')+_0x33795d[_0xa13c('0xd')]+_0xa13c('0x36')+_0x2b4ae1['id']);}return _0x210337[_0xa13c('0x24')][_0xa13c('0x28')]({'phone':_0x33795d['phone'],'ContactId':_0x33795d['id'],'ListId':_0x33795d[_0xa13c('0x30')],'priority':_0x33795d['priority']?_0x33795d[_0xa13c('0x29')]:0x2,'scheduledat':_0x33795d[_0xa13c('0x1a')]?_0x33795d[_0xa13c('0x1a')]:moment()[_0xa13c('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x33795d[_0xa13c('0x2a')]?!![]:![],'callbackuniqueid':_0x33795d[_0xa13c('0x2a')]?_0x33795d[_0xa13c('0x2a')]:undefined,'callbackat':_0x33795d[_0xa13c('0x2a')]?moment()['format'](_0xa13c('0x1b')):undefined,'CampaignId':_0x2b4ae1['id']});})['catch'](function(_0x47ff1b){_0x105647(_0x47ff1b);});});});};if(_0x33795d[_0xa13c('0x30')]){_0x210337[_0xa13c('0x1e')][_0xa13c('0x37')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0xa13c('0x1d')],'include':[{'model':_0x210337[_0xa13c('0x38')],'as':_0xa13c('0x39'),'where':{'id':_0x33795d['ListId']}}]})['then'](function(_0x352386){if(_0x352386){var _0x5622f9=[];for(var _0x49602f=0x0,_0x119bf0;_0x49602f<_0x352386['length'];_0x49602f+=0x1){_0x119bf0=_0x352386[_0x49602f][_0xa13c('0x16')]({'plain':!![]});switch(_0x119bf0[_0xa13c('0x3a')]){case'always':_0x130fa4(_0x119bf0)[_0xa13c('0x2b')](_0x193fec());break;case _0xa13c('0x3b'):_0x57da25(_0x119bf0)[_0xa13c('0x2b')](_0x193fec());break;default:_0x2f1f46(_0x119bf0,_0x33795d)[_0xa13c('0x1f')](function(_0x2cfdd2){_0x33795d['scheduledat']=_0x2cfdd2['ret'];_0x210337[_0xa13c('0x24')][_0xa13c('0x28')]({'phone':_0x33795d[_0xa13c('0xd')],'ContactId':_0x33795d['id'],'ListId':_0x33795d['ListId'],'scheduledat':_0x33795d[_0xa13c('0x1a')]?_0x33795d[_0xa13c('0x1a')]:moment()[_0xa13c('0x23')](_0xa13c('0x1b')),'priority':_0x33795d[_0xa13c('0x29')]?_0x33795d['priority']:0x2,'callback':_0x33795d[_0xa13c('0x2a')]?!![]:![],'callbackuniqueid':_0x33795d[_0xa13c('0x2a')]?_0x33795d[_0xa13c('0x2a')]:undefined,'callbackat':_0x33795d[_0xa13c('0x2a')]?moment()[_0xa13c('0x23')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x119bf0['id']})['catch'](_0x193fec());});}}}})['then'](function(){return _0x210337[_0xa13c('0x1e')][_0xa13c('0x37')]({'where':{'type':_0xa13c('0x3c')},'attributes':['id'],'include':[{'model':_0x210337['CmList'],'as':_0xa13c('0x3d'),'where':{'id':_0x33795d[_0xa13c('0x30')]}}]})[_0xa13c('0x1f')](function(_0xdb0080){if(_0xdb0080){var _0x13066e=[];for(var _0x1e6f26=0x0,_0x1b4dba;_0x1e6f26<_0xdb0080[_0xa13c('0x3e')];_0x1e6f26+=0x1){_0x1b4dba=_0xdb0080[_0x1e6f26][_0xa13c('0x16')]({'plain':!![]});_0x210337['CmHopperBlack'][_0xa13c('0x28')]({'phone':_0x33795d[_0xa13c('0xd')],'ContactId':_0x33795d['id'],'ListId':_0x33795d[_0xa13c('0x30')],'VoiceQueueId':_0x1b4dba['id']})[_0xa13c('0x2b')](function(_0x410c0c){logger['error'](_0xa13c('0x3f'),_0xa13c('0x31'),_0x410c0c[_0xa13c('0x40')]);});}}});})[_0xa13c('0x1f')](function(){return _0x210337['Campaign'][_0xa13c('0x37')]({'attributes':['id',_0xa13c('0x3a'),_0xa13c('0x1d')],'include':[{'model':_0x210337['CmList'],'as':_0xa13c('0x39'),'where':{'id':_0x33795d['ListId']}}]})['then'](function(_0x5e0087){if(_0x5e0087){var _0x132b69=[];for(var _0x414a1b=0x0,_0x48691b;_0x414a1b<_0x5e0087[_0xa13c('0x3e')];_0x414a1b+=0x1){_0x48691b=_0x5e0087[_0x414a1b][_0xa13c('0x16')]({'plain':!![]});switch(_0x48691b['dialCheckDuplicateType']){case _0xa13c('0x41'):_0x7a10f6(_0x48691b)[_0xa13c('0x2b')](_0x3c51f0());break;case _0xa13c('0x3b'):_0xd9e426(_0x48691b)[_0xa13c('0x2b')](_0x3c51f0());break;default:_0x210337[_0xa13c('0x24')][_0xa13c('0x28')]({'phone':_0x33795d[_0xa13c('0xd')],'ContactId':_0x33795d['id'],'ListId':_0x33795d[_0xa13c('0x30')],'scheduledat':_0x33795d['scheduledat']?_0x33795d[_0xa13c('0x1a')]:moment()[_0xa13c('0x23')](_0xa13c('0x1b')),'priority':_0x33795d['priority']?_0x33795d['priority']:0x2,'callback':_0x33795d[_0xa13c('0x2a')]?!![]:![],'callbackuniqueid':_0x33795d['callbackUniqueid']?_0x33795d['callbackUniqueid']:undefined,'callbackat':_0x33795d[_0xa13c('0x2a')]?moment()[_0xa13c('0x23')](_0xa13c('0x1b')):undefined,'CampaignId':_0x48691b['id']})[_0xa13c('0x2b')](_0x3c51f0());}}}});})['then'](function(){return _0x210337['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x210337[_0xa13c('0x38')],'as':'BlackLists','where':{'id':_0x33795d[_0xa13c('0x30')]}}]})[_0xa13c('0x1f')](function(_0x4d0aca){if(_0x4d0aca){var _0x29fb61=[];for(var _0x5cb2f2=0x0,_0x5e751d;_0x5cb2f2<_0x4d0aca[_0xa13c('0x3e')];_0x5cb2f2+=0x1){_0x5e751d=_0x4d0aca[_0x5cb2f2][_0xa13c('0x16')]({'plain':!![]});_0x210337[_0xa13c('0x42')]['create']({'phone':_0x33795d[_0xa13c('0xd')],'ContactId':_0x33795d['id'],'ListId':_0x33795d[_0xa13c('0x30')],'CampaignId':_0x5e751d['id']})['catch'](function(_0x16874a){logger['error'](_0xa13c('0x3f'),'afterCreate',_0x16874a['message']);});}}});})['then'](function(){_0x19cfe2();})[_0xa13c('0x2b')](function(_0x5bd30a){logger[_0xa13c('0x17')]('cmContact,\x20%s,\x20%s',_0xa13c('0x31'),_0x5bd30a[_0xa13c('0x40')]);_0x19cfe2(_0x5bd30a);});}else{_0x19cfe2(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x249623,_0x4648b3,_0x56acce){var _0x5325b9=_0x94ba4d[_0xa13c('0x15')];var _0x2bfa56=_0x249623[_0xa13c('0x16')]({'plain':!![]});return _0x5325b9['CmHopper'][_0xa13c('0x37')]({'raw':!![],'where':{'ListId':_0x2bfa56[_0xa13c('0x30')],'ContactId':_0x2bfa56['id']}})[_0xa13c('0x1f')](function(_0x19a3e4){if(!_[_0xa13c('0x43')](_0x19a3e4)){var _0x5970ad=[];for(var _0x47786b=0x0;_0x47786b<_0x19a3e4[_0xa13c('0x3e')];_0x47786b+=0x1){var _0x5337b5=_0x5325b9[_0xa13c('0x24')][_0xa13c('0x44')]({'where':{'ListId':_0x19a3e4[_0x47786b][_0xa13c('0x30')],'ContactId':_0x19a3e4[_0x47786b][_0xa13c('0x45')],'VoiceQueueId':_0x19a3e4[_0x47786b]['VoiceQueueId'],'CampaignId':_0x19a3e4[_0x47786b][_0xa13c('0x46')]}});_0x5970ad[_0xa13c('0x47')](_0x5337b5);}return BPromise['all'](_0x5970ad);}})[_0xa13c('0x1f')](function(_0x5ac8b4){logger[_0xa13c('0x48')]('[CmContact][afterDestroy][Succesfull]',util[_0xa13c('0x19')](_0x5ac8b4,{'showHidden':![],'depth':null}));_0x56acce();})[_0xa13c('0x2b')](function(_0x3479fc){logger[_0xa13c('0x17')](_0xa13c('0x49'),util[_0xa13c('0x19')](_0x3479fc,{'showHidden':![],'depth':null}));_0x56acce(_0x3479fc);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 84b99a3..3a3f823 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x59b3b,_0x4098f1){var _0xc01473=function(_0x5e732b){while(--_0x5e732b){_0x59b3b['push'](_0x59b3b['shift']());}};_0xc01473(++_0x4098f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 cacccbe..8947a87 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 _0x63eb=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x53d11d,_0xb3060a){var _0x97d2b8=function(_0x4ca737){while(--_0x4ca737){_0x53d11d['push'](_0x53d11d['shift']());}};_0x97d2b8(++_0xb3060a);}(_0x63eb,0x90));var _0xb63e=function(_0x47a768,_0x3357cc){_0x47a768=_0x47a768-0x0;var _0x5d756d=_0x63eb[_0x47a768];return _0x5d756d;};'use strict';var Sequelize=require(_0xb63e('0x0'));module[_0xb63e('0x1')]={'CmContactId':{'type':Sequelize[_0xb63e('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb63e('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb63e('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb63e('0x3')],'defaultValue':_0xb63e('0x4')},'OrderBy':{'type':Sequelize[_0xb63e('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xb63e('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xc090=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0xc090,0x112));var _0x0c09=function(_0x48d47f,_0x43c734){_0x48d47f=_0x48d47f-0x0;var _0x17ace1=_0xc090[_0x48d47f];return _0x17ace1;};'use strict';var Sequelize=require(_0x0c09('0x0'));module[_0x0c09('0x1')]={'CmContactId':{'type':Sequelize[_0x0c09('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0c09('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0c09('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0c09('0x3')],'defaultValue':_0x0c09('0x4')},'OrderBy':{'type':Sequelize[_0x0c09('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x0c09('0x3')],'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 e56b2f2..ba00477 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 _0x9b5b=['fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','include','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x14bb58,_0x3498f8){var _0x40c0f0=function(_0x2f54b2){while(--_0x2f54b2){_0x14bb58['push'](_0x14bb58['shift']());}};_0x40c0f0(++_0x3498f8);}(_0x9b5b,0x10c));var _0xb9b5=function(_0x3b9411,_0x1a7eb9){_0x3b9411=_0x3b9411-0x0;var _0x101069=_0x9b5b[_0x3b9411];return _0x101069;};'use strict';var emlformat=require(_0xb9b5('0x0'));var rimraf=require(_0xb9b5('0x1'));var zipdir=require(_0xb9b5('0x2'));var jsonpatch=require(_0xb9b5('0x3'));var rp=require(_0xb9b5('0x4'));var moment=require(_0xb9b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb9b5('0x6'));var util=require('util');var path=require(_0xb9b5('0x7'));var sox=require(_0xb9b5('0x8'));var csv=require(_0xb9b5('0x9'));var ejs=require(_0xb9b5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9b5('0xb'));var squel=require(_0xb9b5('0xc'));var crypto=require(_0xb9b5('0xd'));var jsforce=require(_0xb9b5('0xe'));var deskjs=require(_0xb9b5('0xf'));var toCsv=require(_0xb9b5('0x9'));var querystring=require('querystring');var Papa=require(_0xb9b5('0x10'));var Redis=require(_0xb9b5('0x11'));var authService=require(_0xb9b5('0x12'));var qs=require(_0xb9b5('0x13'));var as=require(_0xb9b5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9b5('0x15'))(_0xb9b5('0x16'));var utils=require(_0xb9b5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb9b5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11630e,_0x540a36){_0x540a36=_0x540a36||0xcc;return function(_0x3024ba){if(_0x3024ba){return _0x11630e[_0xb9b5('0x19')](_0x540a36);}return _0x11630e[_0xb9b5('0x1a')](_0x540a36)[_0xb9b5('0x1b')]();};}function respondWithResult(_0x5db7ca,_0x150ac5){_0x150ac5=_0x150ac5||0xc8;return function(_0xe36154){if(_0xe36154){return _0x5db7ca['status'](_0x150ac5)[_0xb9b5('0x1c')](_0xe36154);}};}function respondWithFilteredResult(_0x274607,_0x3e8477){return function(_0x7fcc49){if(_0x7fcc49){var _0x3e215b=typeof _0x3e8477[_0xb9b5('0x1d')]===_0xb9b5('0x1e')&&typeof _0x3e8477[_0xb9b5('0x1f')]===_0xb9b5('0x1e');var _0x156044=_0x7fcc49['count'];var _0x1437c4=_0x3e215b?0x0:_0x3e8477[_0xb9b5('0x1d')];var _0x26b948=_0x3e215b?_0x7fcc49[_0xb9b5('0x20')]:_0x3e8477[_0xb9b5('0x1d')]+_0x3e8477[_0xb9b5('0x1f')];var _0x4f0400;if(_0x26b948>=_0x156044){_0x26b948=_0x156044;_0x4f0400=0xc8;}else{_0x4f0400=0xce;}_0x274607[_0xb9b5('0x1a')](_0x4f0400);return _0x274607[_0xb9b5('0x21')](_0xb9b5('0x22'),_0x1437c4+'-'+_0x26b948+'/'+_0x156044)[_0xb9b5('0x1c')](_0x7fcc49);}return null;};}function patchUpdates(_0x57d439){return function(_0x4d7db4){try{jsonpatch['apply'](_0x4d7db4,_0x57d439,!![]);}catch(_0x31f4af){return BPromise['reject'](_0x31f4af);}return _0x4d7db4[_0xb9b5('0x23')]();};}function saveUpdates(_0x38fca6,_0x4fd74c){return function(_0x491a40){if(_0x491a40){return _0x491a40[_0xb9b5('0x24')](_0x38fca6)[_0xb9b5('0x25')](function(_0x15f507){return _0x15f507;});}return null;};}function removeEntity(_0x18845a,_0x1cb20f){return function(_0x3254b5){if(_0x3254b5){return _0x3254b5[_0xb9b5('0x26')]()['then'](function(){var _0x7b22ce=_0x3254b5[_0xb9b5('0x27')]({'plain':!![]});var _0x2076be=_0xb9b5('0x28');return db[_0xb9b5('0x29')][_0xb9b5('0x26')]({'where':{'type':_0x2076be,'resourceId':_0x7b22ce['id']}})[_0xb9b5('0x25')](function(){return _0x3254b5;});})['then'](function(){_0x18845a['status'](0xcc)[_0xb9b5('0x1b')]();});}};}function handleEntityNotFound(_0x228700,_0x549583){return function(_0x4178e7){if(!_0x4178e7){_0x228700[_0xb9b5('0x19')](0x194);}return _0x4178e7;};}function handleError(_0xb33670,_0x11ff20){_0x11ff20=_0x11ff20||0x1f4;return function(_0x22d915){logger[_0xb9b5('0x2a')](_0x22d915['stack']);if(_0x22d915[_0xb9b5('0x2b')]){delete _0x22d915[_0xb9b5('0x2b')];}_0xb33670[_0xb9b5('0x1a')](_0x11ff20)[_0xb9b5('0x2c')](_0x22d915);};}exports[_0xb9b5('0x2d')]=function(_0x402b67,_0x248a4b){var _0x1e2fe8={},_0x5baa12={},_0x3aa3c1={'count':0x0,'rows':[]};var _0x21a325=_['map'](db[_0xb9b5('0x2e')][_0xb9b5('0x2f')],function(_0x548ef7){return{'name':_0x548ef7[_0xb9b5('0x30')],'type':_0x548ef7[_0xb9b5('0x31')]['key']};});_0x5baa12[_0xb9b5('0x32')]=_['map'](_0x21a325,_0xb9b5('0x2b'));_0x5baa12[_0xb9b5('0x33')]=_[_0xb9b5('0x34')](_0x402b67[_0xb9b5('0x33')]);_0x5baa12[_0xb9b5('0x35')]=_[_0xb9b5('0x36')](_0x5baa12[_0xb9b5('0x32')],_0x5baa12['query']);_0x1e2fe8[_0xb9b5('0x37')]=_[_0xb9b5('0x36')](_0x5baa12[_0xb9b5('0x32')],qs[_0xb9b5('0x38')](_0x402b67['query'][_0xb9b5('0x38')]));_0x1e2fe8['attributes']=_0x1e2fe8['attributes'][_0xb9b5('0x39')]?_0x1e2fe8['attributes']:_0x5baa12[_0xb9b5('0x32')];if(!_0x402b67[_0xb9b5('0x33')][_0xb9b5('0x3a')]('nolimit')){_0x1e2fe8['limit']=qs[_0xb9b5('0x1f')](_0x402b67[_0xb9b5('0x33')][_0xb9b5('0x1f')]);_0x1e2fe8['offset']=qs[_0xb9b5('0x1d')](_0x402b67['query'][_0xb9b5('0x1d')]);}_0x1e2fe8[_0xb9b5('0x3b')]=qs[_0xb9b5('0x3c')](_0x402b67[_0xb9b5('0x33')][_0xb9b5('0x3c')]);_0x1e2fe8[_0xb9b5('0x3d')]=qs[_0xb9b5('0x35')](_[_0xb9b5('0x3e')](_0x402b67['query'],_0x5baa12[_0xb9b5('0x35')]),_0x21a325);if(_0x402b67['query']['filter']){_0x1e2fe8[_0xb9b5('0x3d')]=_[_0xb9b5('0x3f')](_0x1e2fe8['where'],{'$or':_[_0xb9b5('0x40')](_0x21a325,function(_0x4bf166){if(_0x4bf166['type']!==_0xb9b5('0x41')){var _0x111cff={};_0x111cff[_0x4bf166['name']]={'$like':'%'+_0x402b67['query']['filter']+'%'};return _0x111cff;}})});}_0x1e2fe8=_['merge']({},_0x1e2fe8,_0x402b67[_0xb9b5('0x42')]);var _0x2b61a3={'where':_0x1e2fe8[_0xb9b5('0x3d')]};return db[_0xb9b5('0x2e')]['count'](_0x2b61a3)['then'](function(_0x360c32){_0x3aa3c1[_0xb9b5('0x20')]=_0x360c32;if(_0x402b67[_0xb9b5('0x33')][_0xb9b5('0x43')]){_0x1e2fe8[_0xb9b5('0x44')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x1e2fe8);})[_0xb9b5('0x25')](function(_0x542675){_0x3aa3c1[_0xb9b5('0x45')]=_0x542675;return _0x3aa3c1;})[_0xb9b5('0x25')](respondWithFilteredResult(_0x248a4b,_0x1e2fe8))[_0xb9b5('0x46')](handleError(_0x248a4b,null));};exports['show']=function(_0x4666cc,_0x2f6cba){var _0x45f95f={'raw':!![],'where':{'id':_0x4666cc['params']['id']}},_0x39154f={};_0x39154f['model']=_[_0xb9b5('0x34')](db[_0xb9b5('0x2e')][_0xb9b5('0x2f')]);_0x39154f['query']=_['keys'](_0x4666cc['query']);_0x39154f[_0xb9b5('0x35')]=_[_0xb9b5('0x36')](_0x39154f['model'],_0x39154f[_0xb9b5('0x33')]);_0x45f95f[_0xb9b5('0x37')]=_[_0xb9b5('0x36')](_0x39154f[_0xb9b5('0x32')],qs[_0xb9b5('0x38')](_0x4666cc[_0xb9b5('0x33')][_0xb9b5('0x38')]));_0x45f95f['attributes']=_0x45f95f[_0xb9b5('0x37')][_0xb9b5('0x39')]?_0x45f95f[_0xb9b5('0x37')]:_0x39154f[_0xb9b5('0x32')];if(_0x4666cc['query'][_0xb9b5('0x43')]){_0x45f95f[_0xb9b5('0x44')]=[{'all':!![]}];}_0x45f95f=_[_0xb9b5('0x3f')]({},_0x45f95f,_0x4666cc[_0xb9b5('0x42')]);return db[_0xb9b5('0x2e')]['find'](_0x45f95f)['then'](handleEntityNotFound(_0x2f6cba,null))[_0xb9b5('0x25')](respondWithResult(_0x2f6cba,null))['catch'](handleError(_0x2f6cba,null));};exports[_0xb9b5('0x47')]=function(_0x339ffc,_0x6ec19){return db[_0xb9b5('0x2e')]['create'](_0x339ffc[_0xb9b5('0x48')],{})[_0xb9b5('0x25')](function(_0x29389e){var _0x23697d=_0x339ffc[_0xb9b5('0x49')][_0xb9b5('0x27')]({'plain':!![]});if(!_0x23697d)throw new Error(_0xb9b5('0x4a'));if(_0x23697d['role']==='user'){var _0x5322a7=_0x29389e['get']({'plain':!![]});var _0xfd863b='CmContactHasItems';return db[_0xb9b5('0x4b')][_0xb9b5('0x4c')]({'where':{'name':_0xfd863b,'userProfileId':_0x23697d[_0xb9b5('0x4d')]},'raw':!![]})[_0xb9b5('0x25')](function(_0x1e2f2e){if(_0x1e2f2e&&_0x1e2f2e[_0xb9b5('0x4e')]===0x0){return db[_0xb9b5('0x29')]['create']({'name':_0x5322a7[_0xb9b5('0x2b')],'resourceId':_0x5322a7['id'],'type':_0x1e2f2e[_0xb9b5('0x2b')],'sectionId':_0x1e2f2e['id']},{})[_0xb9b5('0x25')](function(){return _0x29389e;});}else{return _0x29389e;}})[_0xb9b5('0x46')](function(_0x3c4efb){logger[_0xb9b5('0x2a')](_0xb9b5('0x4f'),_0x3c4efb);throw _0x3c4efb;});}return _0x29389e;})['then'](respondWithResult(_0x6ec19,0xc9))['catch'](handleError(_0x6ec19,null));};exports['update']=function(_0x39fd6f,_0x3484f1){if(_0x39fd6f[_0xb9b5('0x48')]['id']){delete _0x39fd6f[_0xb9b5('0x48')]['id'];}return db[_0xb9b5('0x2e')]['find']({'where':{'id':_0x39fd6f[_0xb9b5('0x50')]['id']}})['then'](handleEntityNotFound(_0x3484f1,null))[_0xb9b5('0x25')](saveUpdates(_0x39fd6f[_0xb9b5('0x48')],null))[_0xb9b5('0x25')](respondWithResult(_0x3484f1,null))[_0xb9b5('0x46')](handleError(_0x3484f1,null));};exports[_0xb9b5('0x26')]=function(_0x2a4e17,_0x5e7ae1){return db['CmContactHasItem'][_0xb9b5('0x4c')]({'where':{'id':_0x2a4e17[_0xb9b5('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e7ae1,null))[_0xb9b5('0x25')](removeEntity(_0x5e7ae1,null))[_0xb9b5('0x46')](handleError(_0x5e7ae1,null));}; \ No newline at end of file +var _0x9533=['nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','CmContactHasItem','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x9533,0x6f));var _0x3953=function(_0x20c512,_0x36c198){_0x20c512=_0x20c512-0x0;var _0x25236e=_0x9533[_0x20c512];return _0x25236e;};'use strict';var emlformat=require(_0x3953('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3953('0x1'));var jsonpatch=require(_0x3953('0x2'));var rp=require(_0x3953('0x3'));var moment=require(_0x3953('0x4'));var BPromise=require(_0x3953('0x5'));var Mustache=require(_0x3953('0x6'));var util=require('util');var path=require(_0x3953('0x7'));var sox=require(_0x3953('0x8'));var csv=require(_0x3953('0x9'));var ejs=require(_0x3953('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3953('0xb'));var crypto=require(_0x3953('0xc'));var jsforce=require(_0x3953('0xd'));var deskjs=require(_0x3953('0xe'));var toCsv=require(_0x3953('0x9'));var querystring=require('querystring');var Papa=require(_0x3953('0xf'));var Redis=require('ioredis');var authService=require(_0x3953('0x10'));var qs=require(_0x3953('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3953('0x12'));var logger=require('../../config/logger')(_0x3953('0x13'));var utils=require(_0x3953('0x14'));var config=require(_0x3953('0x15'));var licenseUtil=require(_0x3953('0x16'));var db=require(_0x3953('0x17'))['db'];function respondWithStatusCode(_0x5a5567,_0x1968d6){_0x1968d6=_0x1968d6||0xcc;return function(_0x31651f){if(_0x31651f){return _0x5a5567['sendStatus'](_0x1968d6);}return _0x5a5567[_0x3953('0x18')](_0x1968d6)[_0x3953('0x19')]();};}function respondWithResult(_0x2a2618,_0x31bc6c){_0x31bc6c=_0x31bc6c||0xc8;return function(_0x1a5d15){if(_0x1a5d15){return _0x2a2618[_0x3953('0x18')](_0x31bc6c)[_0x3953('0x1a')](_0x1a5d15);}};}function respondWithFilteredResult(_0x11b803,_0x184b65){return function(_0x17983f){if(_0x17983f){var _0x28a28c=typeof _0x184b65[_0x3953('0x1b')]==='undefined'&&typeof _0x184b65['limit']===_0x3953('0x1c');var _0xa73064=_0x17983f[_0x3953('0x1d')];var _0x5b9fa1=_0x28a28c?0x0:_0x184b65[_0x3953('0x1b')];var _0xc66f7c=_0x28a28c?_0x17983f['count']:_0x184b65[_0x3953('0x1b')]+_0x184b65['limit'];var _0x38df25;if(_0xc66f7c>=_0xa73064){_0xc66f7c=_0xa73064;_0x38df25=0xc8;}else{_0x38df25=0xce;}_0x11b803[_0x3953('0x18')](_0x38df25);return _0x11b803[_0x3953('0x1e')](_0x3953('0x1f'),_0x5b9fa1+'-'+_0xc66f7c+'/'+_0xa73064)[_0x3953('0x1a')](_0x17983f);}return null;};}function patchUpdates(_0x1fa295){return function(_0x5d621e){try{jsonpatch[_0x3953('0x20')](_0x5d621e,_0x1fa295,!![]);}catch(_0x411bc1){return BPromise[_0x3953('0x21')](_0x411bc1);}return _0x5d621e[_0x3953('0x22')]();};}function saveUpdates(_0x53dac4,_0x191117){return function(_0x4213d4){if(_0x4213d4){return _0x4213d4[_0x3953('0x23')](_0x53dac4)[_0x3953('0x24')](function(_0x2c6cd5){return _0x2c6cd5;});}return null;};}function removeEntity(_0x126afb,_0x4774e4){return function(_0x61b7dc){if(_0x61b7dc){return _0x61b7dc[_0x3953('0x25')]()[_0x3953('0x24')](function(){var _0x3038b8=_0x61b7dc['get']({'plain':!![]});var _0x487223=_0x3953('0x26');return db[_0x3953('0x27')][_0x3953('0x25')]({'where':{'type':_0x487223,'resourceId':_0x3038b8['id']}})[_0x3953('0x24')](function(){return _0x61b7dc;});})[_0x3953('0x24')](function(){_0x126afb['status'](0xcc)[_0x3953('0x19')]();});}};}function handleEntityNotFound(_0x1a5edb,_0x38a2a0){return function(_0x23fab2){if(!_0x23fab2){_0x1a5edb[_0x3953('0x28')](0x194);}return _0x23fab2;};}function handleError(_0x3fe0e1,_0x4ced72){_0x4ced72=_0x4ced72||0x1f4;return function(_0x21399f){logger[_0x3953('0x29')](_0x21399f[_0x3953('0x2a')]);if(_0x21399f[_0x3953('0x2b')]){delete _0x21399f[_0x3953('0x2b')];}_0x3fe0e1['status'](_0x4ced72)[_0x3953('0x2c')](_0x21399f);};}exports[_0x3953('0x2d')]=function(_0x4bb12f,_0x12084f){var _0x5d921c={},_0x1ce0e={},_0x48f25e={'count':0x0,'rows':[]};var _0x48e3f0=_['map'](db[_0x3953('0x2e')]['rawAttributes'],function(_0x54c661){return{'name':_0x54c661[_0x3953('0x2f')],'type':_0x54c661[_0x3953('0x30')]['key']};});_0x1ce0e[_0x3953('0x31')]=_[_0x3953('0x32')](_0x48e3f0,_0x3953('0x2b'));_0x1ce0e[_0x3953('0x33')]=_[_0x3953('0x34')](_0x4bb12f[_0x3953('0x33')]);_0x1ce0e[_0x3953('0x35')]=_[_0x3953('0x36')](_0x1ce0e[_0x3953('0x31')],_0x1ce0e[_0x3953('0x33')]);_0x5d921c[_0x3953('0x37')]=_[_0x3953('0x36')](_0x1ce0e['model'],qs[_0x3953('0x38')](_0x4bb12f[_0x3953('0x33')][_0x3953('0x38')]));_0x5d921c[_0x3953('0x37')]=_0x5d921c['attributes'][_0x3953('0x39')]?_0x5d921c[_0x3953('0x37')]:_0x1ce0e[_0x3953('0x31')];if(!_0x4bb12f['query'][_0x3953('0x3a')](_0x3953('0x3b'))){_0x5d921c[_0x3953('0x3c')]=qs[_0x3953('0x3c')](_0x4bb12f[_0x3953('0x33')]['limit']);_0x5d921c['offset']=qs[_0x3953('0x1b')](_0x4bb12f[_0x3953('0x33')][_0x3953('0x1b')]);}_0x5d921c[_0x3953('0x3d')]=qs['sort'](_0x4bb12f[_0x3953('0x33')][_0x3953('0x3e')]);_0x5d921c[_0x3953('0x3f')]=qs[_0x3953('0x35')](_[_0x3953('0x40')](_0x4bb12f[_0x3953('0x33')],_0x1ce0e['filters']),_0x48e3f0);if(_0x4bb12f['query'][_0x3953('0x41')]){_0x5d921c[_0x3953('0x3f')]=_[_0x3953('0x42')](_0x5d921c['where'],{'$or':_[_0x3953('0x32')](_0x48e3f0,function(_0x20ba40){if(_0x20ba40['type']!==_0x3953('0x43')){var _0x114336={};_0x114336[_0x20ba40[_0x3953('0x2b')]]={'$like':'%'+_0x4bb12f[_0x3953('0x33')]['filter']+'%'};return _0x114336;}})});}_0x5d921c=_[_0x3953('0x42')]({},_0x5d921c,_0x4bb12f[_0x3953('0x44')]);var _0x20c3ee={'where':_0x5d921c[_0x3953('0x3f')]};return db[_0x3953('0x2e')][_0x3953('0x1d')](_0x20c3ee)[_0x3953('0x24')](function(_0x299111){_0x48f25e['count']=_0x299111;if(_0x4bb12f[_0x3953('0x33')][_0x3953('0x45')]){_0x5d921c[_0x3953('0x46')]=[{'all':!![]}];}return db[_0x3953('0x2e')][_0x3953('0x47')](_0x5d921c);})[_0x3953('0x24')](function(_0x1ceac1){_0x48f25e[_0x3953('0x48')]=_0x1ceac1;return _0x48f25e;})[_0x3953('0x24')](respondWithFilteredResult(_0x12084f,_0x5d921c))[_0x3953('0x49')](handleError(_0x12084f,null));};exports[_0x3953('0x4a')]=function(_0x4760dc,_0x35cd4c){var _0x1db1d0={'raw':!![],'where':{'id':_0x4760dc[_0x3953('0x4b')]['id']}},_0x5c75b6={};_0x5c75b6['model']=_[_0x3953('0x34')](db[_0x3953('0x2e')][_0x3953('0x4c')]);_0x5c75b6['query']=_['keys'](_0x4760dc['query']);_0x5c75b6[_0x3953('0x35')]=_[_0x3953('0x36')](_0x5c75b6[_0x3953('0x31')],_0x5c75b6[_0x3953('0x33')]);_0x1db1d0[_0x3953('0x37')]=_[_0x3953('0x36')](_0x5c75b6[_0x3953('0x31')],qs['fields'](_0x4760dc[_0x3953('0x33')][_0x3953('0x38')]));_0x1db1d0[_0x3953('0x37')]=_0x1db1d0['attributes'][_0x3953('0x39')]?_0x1db1d0['attributes']:_0x5c75b6['model'];if(_0x4760dc['query'][_0x3953('0x45')]){_0x1db1d0[_0x3953('0x46')]=[{'all':!![]}];}_0x1db1d0=_[_0x3953('0x42')]({},_0x1db1d0,_0x4760dc[_0x3953('0x44')]);return db[_0x3953('0x2e')]['find'](_0x1db1d0)[_0x3953('0x24')](handleEntityNotFound(_0x35cd4c,null))['then'](respondWithResult(_0x35cd4c,null))[_0x3953('0x49')](handleError(_0x35cd4c,null));};exports[_0x3953('0x4d')]=function(_0x5ebd7d,_0x54a59b){return db[_0x3953('0x2e')][_0x3953('0x4d')](_0x5ebd7d[_0x3953('0x4e')],{})[_0x3953('0x24')](function(_0x4fc665){var _0xe2a8ec=_0x5ebd7d[_0x3953('0x4f')]['get']({'plain':!![]});if(!_0xe2a8ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe2a8ec['role']===_0x3953('0x4f')){var _0x1403a2=_0x4fc665['get']({'plain':!![]});var _0x34054e='CmContactHasItems';return db[_0x3953('0x50')][_0x3953('0x51')]({'where':{'name':_0x34054e,'userProfileId':_0xe2a8ec[_0x3953('0x52')]},'raw':!![]})['then'](function(_0xb22b2){if(_0xb22b2&&_0xb22b2[_0x3953('0x53')]===0x0){return db[_0x3953('0x27')]['create']({'name':_0x1403a2['name'],'resourceId':_0x1403a2['id'],'type':_0xb22b2[_0x3953('0x2b')],'sectionId':_0xb22b2['id']},{})['then'](function(){return _0x4fc665;});}else{return _0x4fc665;}})[_0x3953('0x49')](function(_0x16fcf8){logger['error'](_0x3953('0x54'),_0x16fcf8);throw _0x16fcf8;});}return _0x4fc665;})[_0x3953('0x24')](respondWithResult(_0x54a59b,0xc9))[_0x3953('0x49')](handleError(_0x54a59b,null));};exports[_0x3953('0x23')]=function(_0x53451c,_0x4e6fb2){if(_0x53451c['body']['id']){delete _0x53451c[_0x3953('0x4e')]['id'];}return db[_0x3953('0x2e')][_0x3953('0x51')]({'where':{'id':_0x53451c[_0x3953('0x4b')]['id']}})[_0x3953('0x24')](handleEntityNotFound(_0x4e6fb2,null))['then'](saveUpdates(_0x53451c[_0x3953('0x4e')],null))[_0x3953('0x24')](respondWithResult(_0x4e6fb2,null))[_0x3953('0x49')](handleError(_0x4e6fb2,null));};exports['destroy']=function(_0x4ccb00,_0x313c96){return db[_0x3953('0x2e')]['find']({'where':{'id':_0x4ccb00[_0x3953('0x4b')]['id']}})[_0x3953('0x24')](handleEntityNotFound(_0x313c96,null))[_0x3953('0x24')](removeEntity(_0x313c96,null))[_0x3953('0x49')](handleError(_0x313c96,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2b0d14d..80acbdb 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 _0x373d=['define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports'];(function(_0x1c6f10,_0x5eed05){var _0x5a9683=function(_0x1ea102){while(--_0x1ea102){_0x1c6f10['push'](_0x1c6f10['shift']());}};_0x5a9683(++_0x5eed05);}(_0x373d,0xf5));var _0xd373=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x373d[_0x1a5946];return _0x25e9d5;};'use strict';var _=require(_0xd373('0x0'));var util=require(_0xd373('0x1'));var logger=require(_0xd373('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd373('0x3'));var rp=require(_0xd373('0x4'));var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xd373('0x7')]=function(_0x450e47,_0x21b7a6){return _0x450e47[_0xd373('0x8')](_0xd373('0x9'),attributes,{'tableName':_0xd373('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b2d=['bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','lodash','api','moment'];(function(_0x4f9e5d,_0x44ac1b){var _0x28d443=function(_0x5d1eef){while(--_0x5d1eef){_0x4f9e5d['push'](_0x4f9e5d['shift']());}};_0x28d443(++_0x44ac1b);}(_0x4b2d,0x194));var _0xd4b2=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x4b2d[_0x1196b0];return _0x111c52;};'use strict';var _=require(_0xd4b2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd4b2('0x1'));var moment=require(_0xd4b2('0x2'));var BPromise=require(_0xd4b2('0x3'));var rp=require(_0xd4b2('0x4'));var fs=require('fs');var path=require(_0xd4b2('0x5'));var rimraf=require(_0xd4b2('0x6'));var config=require(_0xd4b2('0x7'));var attributes=require(_0xd4b2('0x8'));module['exports']=function(_0x47b244,_0x1dae2c){return _0x47b244[_0xd4b2('0x9')](_0xd4b2('0xa'),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 7424ced..b11a4b1 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 _0x336f=['../../mysqldb','rpc','../../config/environment','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x336f,0x166));var _0xf336=function(_0x506344,_0x44f689){_0x506344=_0x506344-0x0;var _0x29ef17=_0x336f[_0x506344];return _0x29ef17;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf336('0x0'));var BPromise=require(_0xf336('0x1'));var rs=require(_0xf336('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf336('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf336('0x4'));var config=require(_0xf336('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf336('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3c3bbf,_0x4b5cc2,_0x272ae6){return new BPromise(function(_0x3b3b6a,_0x2d529a){return client[_0xf336('0x7')](_0x3c3bbf,_0x272ae6)[_0xf336('0x8')](function(_0x39fab1){logger[_0xf336('0x9')](_0xf336('0xa'),_0x4b5cc2,'request\x20sent');logger[_0xf336('0xb')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4b5cc2,_0xf336('0xc'),JSON[_0xf336('0xd')](_0x39fab1));if(_0x39fab1[_0xf336('0xe')]){if(_0x39fab1[_0xf336('0xe')][_0xf336('0xf')]===0x1f4){logger[_0xf336('0xe')](_0xf336('0xa'),_0x4b5cc2,_0x39fab1[_0xf336('0xe')][_0xf336('0x10')]);return _0x2d529a(_0x39fab1[_0xf336('0xe')][_0xf336('0x10')]);}logger[_0xf336('0xe')](_0xf336('0xa'),_0x4b5cc2,_0x39fab1['error']['message']);return _0x3b3b6a(_0x39fab1[_0xf336('0xe')]['message']);}else{logger[_0xf336('0x9')](_0xf336('0xa'),_0x4b5cc2,_0xf336('0xc'));_0x3b3b6a(_0x39fab1[_0xf336('0x11')][_0xf336('0x10')]);}})[_0xf336('0x12')](function(_0x2a322d){logger[_0xf336('0xe')](_0xf336('0xa'),_0x4b5cc2,_0x2a322d);_0x2d529a(_0x2a322d);});});} \ No newline at end of file +var _0x97f9=['jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x7b299a,_0x17d6aa){var _0x3a03ad=function(_0x3f5ebf){while(--_0x3f5ebf){_0x7b299a['push'](_0x7b299a['shift']());}};_0x3a03ad(++_0x17d6aa);}(_0x97f9,0x1e3));var _0x997f=function(_0x36e267,_0x3c9dc4){_0x36e267=_0x36e267-0x0;var _0x550045=_0x97f9[_0x36e267];return _0x550045;};'use strict';var _=require(_0x997f('0x0'));var util=require(_0x997f('0x1'));var moment=require(_0x997f('0x2'));var BPromise=require(_0x997f('0x3'));var rs=require(_0x997f('0x4'));var fs=require('fs');var Redis=require(_0x997f('0x5'));var db=require(_0x997f('0x6'))['db'];var utils=require(_0x997f('0x7'));var logger=require(_0x997f('0x8'))(_0x997f('0x9'));var config=require(_0x997f('0xa'));var jayson=require(_0x997f('0xb'));var client=jayson[_0x997f('0xc')][_0x997f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1f37d5,_0x2a753b,_0x379202){return new BPromise(function(_0x19866b,_0x2812a9){return client[_0x997f('0xe')](_0x1f37d5,_0x379202)['then'](function(_0x8a8945){logger[_0x997f('0xf')](_0x997f('0x10'),_0x2a753b,_0x997f('0x11'));logger[_0x997f('0x12')](_0x997f('0x13'),_0x2a753b,_0x997f('0x11'),JSON[_0x997f('0x14')](_0x8a8945));if(_0x8a8945['error']){if(_0x8a8945[_0x997f('0x15')][_0x997f('0x16')]===0x1f4){logger['error'](_0x997f('0x10'),_0x2a753b,_0x8a8945[_0x997f('0x15')]['message']);return _0x2812a9(_0x8a8945[_0x997f('0x15')][_0x997f('0x17')]);}logger['error'](_0x997f('0x10'),_0x2a753b,_0x8a8945['error'][_0x997f('0x17')]);return _0x19866b(_0x8a8945[_0x997f('0x15')][_0x997f('0x17')]);}else{logger[_0x997f('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x2a753b,'request\x20sent');_0x19866b(_0x8a8945[_0x997f('0x18')]['message']);}})[_0x997f('0x19')](function(_0x195889){logger['error'](_0x997f('0x10'),_0x2a753b,_0x195889);_0x2812a9(_0x195889);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4e77db6..dc4313e 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 _0xc78d=['create','put','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','post'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xc78d,0x8d));var _0xdc78=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc78d[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xdc78('0x0'));var util=require(_0xdc78('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc78('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdc78('0x3'));var interaction=require(_0xdc78('0x4'));var config=require(_0xdc78('0x5'));var controller=require(_0xdc78('0x6'));router['get']('/',auth[_0xdc78('0x7')](),controller[_0xdc78('0x8')]);router[_0xdc78('0x9')](_0xdc78('0xa'),auth[_0xdc78('0x7')](),controller['show']);router[_0xdc78('0xb')]('/',auth[_0xdc78('0x7')](),controller[_0xdc78('0xc')]);router[_0xdc78('0xd')](_0xdc78('0xa'),auth[_0xdc78('0x7')](),controller[_0xdc78('0xe')]);router[_0xdc78('0xf')](_0xdc78('0xa'),auth[_0xdc78('0x7')](),controller['destroy']);module[_0xdc78('0x10')]=router; \ No newline at end of file +var _0xd1b5=['fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','put','delete','exports','util','path','connect-timeout'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0xd1b5,0x10b));var _0x5d1b=function(_0x2829f8,_0x5360a2){_0x2829f8=_0x2829f8-0x0;var _0x585970=_0xd1b5[_0x2829f8];return _0x585970;};'use strict';var multer=require('multer');var util=require(_0x5d1b('0x0'));var path=require(_0x5d1b('0x1'));var timeout=require(_0x5d1b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d1b('0x3'));var auth=require(_0x5d1b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5d1b('0x5'));var controller=require(_0x5d1b('0x6'));router[_0x5d1b('0x7')]('/',auth[_0x5d1b('0x8')](),controller[_0x5d1b('0x9')]);router[_0x5d1b('0x7')](_0x5d1b('0xa'),auth[_0x5d1b('0x8')](),controller[_0x5d1b('0xb')]);router['post']('/',auth[_0x5d1b('0x8')](),controller['create']);router[_0x5d1b('0xc')](_0x5d1b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5d1b('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5d1b('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 5598ef5..c3adbf4 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 _0x09a4=['lodash','exports','VIRTUAL','getDataValue','STRING','alias','name','TEXT','long','type','select','parse','values','isArray','setDataValue','BOOLEAN','ENUM','voice','sequelize'];(function(_0x1078ba,_0x208129){var _0x5e3193=function(_0x18e559){while(--_0x18e559){_0x1078ba['push'](_0x1078ba['shift']());}};_0x5e3193(++_0x208129);}(_0x09a4,0x1c7));var _0x409a=function(_0x6b37cf,_0x34d877){_0x6b37cf=_0x6b37cf-0x0;var _0xea86d7=_0x09a4[_0x6b37cf];return _0xea86d7;};'use strict';var Sequelize=require(_0x409a('0x0'));var _=require(_0x409a('0x1'));module[_0x409a('0x2')]={'name':{'type':Sequelize[_0x409a('0x3')],'get':function(_0x4d1793){return this[_0x409a('0x4')]('alias');}},'alias':{'type':Sequelize[_0x409a('0x5')],'allowNull':![],'set':function(_0x38c57c){this['setDataValue'](_0x409a('0x6'),_0x38c57c?_0x38c57c:this['getDataValue'](_0x409a('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x409a('0x8')](_0x409a('0x9')),'get':function(){if(this[_0x409a('0x4')](_0x409a('0xa'))===_0x409a('0xb')){return JSON[_0x409a('0xc')](this[_0x409a('0x4')](_0x409a('0xd')));}else{return this[_0x409a('0x4')](_0x409a('0xd'));}},'set':function(_0x13aea5){if(Array[_0x409a('0xe')](_0x13aea5)){this[_0x409a('0xf')]('values',JSON['stringify'](_0x13aea5));}else{this[_0x409a('0xf')](_0x409a('0xd'),_0x13aea5);}}},'required':{'type':Sequelize[_0x409a('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x409a('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x409a('0x11')](_0x409a('0x12'))}}; \ No newline at end of file +var _0x7465=['stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','alias','getDataValue','name','long','select','parse','values','isArray','setDataValue'];(function(_0x182ca0,_0x12b708){var _0x3e2c19=function(_0x5b4b23){while(--_0x5b4b23){_0x182ca0['push'](_0x182ca0['shift']());}};_0x3e2c19(++_0x12b708);}(_0x7465,0x70));var _0x5746=function(_0xbf633,_0x348b55){_0xbf633=_0xbf633-0x0;var _0xe4d6dc=_0x7465[_0xbf633];return _0xe4d6dc;};'use strict';var Sequelize=require(_0x5746('0x0'));var _=require(_0x5746('0x1'));module[_0x5746('0x2')]={'name':{'type':Sequelize[_0x5746('0x3')],'get':function(_0x43f1ec){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x5746('0x4')],'allowNull':![],'set':function(_0x39ce1e){this['setDataValue'](_0x5746('0x5'),_0x39ce1e?_0x39ce1e:this[_0x5746('0x6')](_0x5746('0x7')));}},'type':{'type':Sequelize[_0x5746('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x5746('0x8')),'get':function(){if(this[_0x5746('0x6')]('type')===_0x5746('0x9')){return JSON[_0x5746('0xa')](this[_0x5746('0x6')]('values'));}else{return this[_0x5746('0x6')](_0x5746('0xb'));}},'set':function(_0x315957){if(Array[_0x5746('0xc')](_0x315957)){this[_0x5746('0xd')](_0x5746('0xb'),JSON[_0x5746('0xe')](_0x315957));}else{this['setDataValue'](_0x5746('0xb'),_0x315957);}}},'required':{'type':Sequelize[_0x5746('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5746('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5746('0x10')](_0x5746('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5289f3c..9adf457 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 _0xd15e=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','name','query','keys','filters','intersection','attributes'];(function(_0x2f1bf4,_0x4d9a38){var _0x14e9ea=function(_0x2daed5){while(--_0x2daed5){_0x2f1bf4['push'](_0x2f1bf4['shift']());}};_0x14e9ea(++_0x4d9a38);}(_0xd15e,0x1a0));var _0xed15=function(_0xc11792,_0x1fa0f8){_0xc11792=_0xc11792-0x0;var _0x1c705d=_0xd15e[_0xc11792];return _0x1c705d;};'use strict';var emlformat=require(_0xed15('0x0'));var rimraf=require(_0xed15('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed15('0x2'));var moment=require(_0xed15('0x3'));var BPromise=require(_0xed15('0x4'));var Mustache=require(_0xed15('0x5'));var util=require(_0xed15('0x6'));var path=require(_0xed15('0x7'));var sox=require(_0xed15('0x8'));var csv=require(_0xed15('0x9'));var ejs=require(_0xed15('0xa'));var fs=require('fs');var fs_extra=require(_0xed15('0xb'));var _=require(_0xed15('0xc'));var squel=require(_0xed15('0xd'));var crypto=require(_0xed15('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xed15('0xf'));var toCsv=require(_0xed15('0x9'));var querystring=require(_0xed15('0x10'));var Papa=require(_0xed15('0x11'));var Redis=require(_0xed15('0x12'));var authService=require(_0xed15('0x13'));var qs=require(_0xed15('0x14'));var as=require(_0xed15('0x15'));var hardwareService=require(_0xed15('0x16'));var logger=require(_0xed15('0x17'))(_0xed15('0x18'));var utils=require(_0xed15('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xed15('0x1a'));var db=require(_0xed15('0x1b'))['db'];function respondWithStatusCode(_0x1ba7e1,_0x4d887b){_0x4d887b=_0x4d887b||0xcc;return function(_0x1edf43){if(_0x1edf43){return _0x1ba7e1[_0xed15('0x1c')](_0x4d887b);}return _0x1ba7e1[_0xed15('0x1d')](_0x4d887b)[_0xed15('0x1e')]();};}function respondWithResult(_0x1cdfff,_0x35964f){_0x35964f=_0x35964f||0xc8;return function(_0x591921){if(_0x591921){return _0x1cdfff[_0xed15('0x1d')](_0x35964f)['json'](_0x591921);}};}function respondWithFilteredResult(_0x1c207c,_0x3f1102){return function(_0x9ca6ac){if(_0x9ca6ac){var _0x56e77f=typeof _0x3f1102[_0xed15('0x1f')]==='undefined'&&typeof _0x3f1102[_0xed15('0x20')]===_0xed15('0x21');var _0x322f67=_0x9ca6ac[_0xed15('0x22')];var _0x34c394=_0x56e77f?0x0:_0x3f1102[_0xed15('0x1f')];var _0x55bd17=_0x56e77f?_0x9ca6ac[_0xed15('0x22')]:_0x3f1102['offset']+_0x3f1102[_0xed15('0x20')];var _0x15d299;if(_0x55bd17>=_0x322f67){_0x55bd17=_0x322f67;_0x15d299=0xc8;}else{_0x15d299=0xce;}_0x1c207c[_0xed15('0x1d')](_0x15d299);return _0x1c207c[_0xed15('0x23')](_0xed15('0x24'),_0x34c394+'-'+_0x55bd17+'/'+_0x322f67)[_0xed15('0x25')](_0x9ca6ac);}return null;};}function patchUpdates(_0x218647){return function(_0x54e506){try{jsonpatch[_0xed15('0x26')](_0x54e506,_0x218647,!![]);}catch(_0x24c923){return BPromise[_0xed15('0x27')](_0x24c923);}return _0x54e506['save']();};}function saveUpdates(_0x27652e,_0x1e0421){return function(_0x27624d){if(_0x27624d){return _0x27624d[_0xed15('0x28')](_0x27652e)['then'](function(_0x53eb39){return _0x53eb39;});}return null;};}function removeEntity(_0x40263c,_0x40964d){return function(_0x3d9c8c){if(_0x3d9c8c){return _0x3d9c8c[_0xed15('0x29')]()[_0xed15('0x2a')](function(){_0x40263c[_0xed15('0x1d')](0xcc)[_0xed15('0x1e')]();});}};}function handleEntityNotFound(_0x31b9fa,_0x650335){return function(_0x137fd9){if(!_0x137fd9){_0x31b9fa[_0xed15('0x1c')](0x194);}return _0x137fd9;};}function handleError(_0x8f2890,_0x2d5051){_0x2d5051=_0x2d5051||0x1f4;return function(_0x85f893){logger['error'](_0x85f893[_0xed15('0x2b')]);if(_0x85f893['name']){delete _0x85f893['name'];}_0x8f2890[_0xed15('0x1d')](_0x2d5051)['send'](_0x85f893);};}exports[_0xed15('0x2c')]=function(_0x2cdce9,_0x5cd558){var _0x396af4={},_0x5dae2e={},_0x3c9bbb={'count':0x0,'rows':[]};var _0x3f5368=_['map'](db[_0xed15('0x2d')][_0xed15('0x2e')],function(_0x446ccc){return{'name':_0x446ccc[_0xed15('0x2f')],'type':_0x446ccc[_0xed15('0x30')][_0xed15('0x31')]};});_0x5dae2e[_0xed15('0x32')]=_[_0xed15('0x33')](_[_0xed15('0x34')](_0x3f5368,_0xed15('0x35')),[_0xed15('0x35')]);_0x5dae2e[_0xed15('0x36')]=_[_0xed15('0x37')](_0x2cdce9['query']);_0x5dae2e[_0xed15('0x38')]=_[_0xed15('0x39')](_0x5dae2e['model'],_0x5dae2e[_0xed15('0x36')]);_0x396af4[_0xed15('0x3a')]=_[_0xed15('0x39')](_0x5dae2e[_0xed15('0x32')],qs[_0xed15('0x3b')](_0x2cdce9['query']['fields']));_0x396af4[_0xed15('0x3a')]=_0x396af4['attributes'][_0xed15('0x3c')]?_0x396af4[_0xed15('0x3a')]:_0x5dae2e[_0xed15('0x32')];if(!_0x2cdce9['query'][_0xed15('0x3d')](_0xed15('0x3e'))){_0x396af4[_0xed15('0x20')]=qs['limit'](_0x2cdce9['query'][_0xed15('0x20')]);_0x396af4[_0xed15('0x1f')]=qs[_0xed15('0x1f')](_0x2cdce9['query'][_0xed15('0x1f')]);}_0x396af4[_0xed15('0x3f')]=qs[_0xed15('0x40')](_0x2cdce9['query']['sort']);_0x396af4[_0xed15('0x41')]=qs[_0xed15('0x38')](_[_0xed15('0x42')](_0x2cdce9['query'],_0x5dae2e[_0xed15('0x38')]),_0x3f5368);if(_0x2cdce9['query'][_0xed15('0x43')]){_0x396af4[_0xed15('0x41')]=_['merge'](_0x396af4[_0xed15('0x41')],{'$or':_['map'](_0x3f5368,function(_0x4d8e84){if(_0x4d8e84[_0xed15('0x30')]!==_0xed15('0x44')){var _0x4e4c8e={};_0x4e4c8e[_0x4d8e84[_0xed15('0x35')]]={'$like':'%'+_0x2cdce9['query'][_0xed15('0x43')]+'%'};return _0x4e4c8e;}})});}_0x396af4=_[_0xed15('0x45')]({},_0x396af4,_0x2cdce9[_0xed15('0x46')]);var _0x11c7c5={'where':_0x396af4['where']};return db[_0xed15('0x2d')]['count'](_0x11c7c5)['then'](function(_0x3e993e){_0x3c9bbb[_0xed15('0x22')]=_0x3e993e;if(_0x2cdce9[_0xed15('0x36')][_0xed15('0x47')]){_0x396af4[_0xed15('0x48')]=[{'all':!![]}];}return db['CmCustomField'][_0xed15('0x49')](_0x396af4);})[_0xed15('0x2a')](function(_0xa828f0){_0x3c9bbb[_0xed15('0x4a')]=_0xa828f0;return _0x3c9bbb;})[_0xed15('0x2a')](respondWithFilteredResult(_0x5cd558,_0x396af4))[_0xed15('0x4b')](handleError(_0x5cd558,null));};exports[_0xed15('0x4c')]=function(_0x57f285,_0x3b03fc){var _0x1a63ea={'raw':!![],'where':{'id':_0x57f285[_0xed15('0x4d')]['id']}},_0x52ba53={};_0x52ba53[_0xed15('0x32')]=_[_0xed15('0x37')](db[_0xed15('0x2d')][_0xed15('0x2e')]);_0x52ba53['query']=_[_0xed15('0x37')](_0x57f285[_0xed15('0x36')]);_0x52ba53[_0xed15('0x38')]=_[_0xed15('0x39')](_0x52ba53[_0xed15('0x32')],_0x52ba53['query']);_0x1a63ea[_0xed15('0x3a')]=_[_0xed15('0x39')](_0x52ba53[_0xed15('0x32')],qs[_0xed15('0x3b')](_0x57f285[_0xed15('0x36')][_0xed15('0x3b')]));_0x1a63ea[_0xed15('0x3a')]=_0x1a63ea[_0xed15('0x3a')][_0xed15('0x3c')]?_0x1a63ea[_0xed15('0x3a')]:_0x52ba53[_0xed15('0x32')];if(_0x57f285['query']['includeAll']){_0x1a63ea['include']=[{'all':!![]}];}_0x1a63ea=_['merge']({},_0x1a63ea,_0x57f285[_0xed15('0x46')]);return db[_0xed15('0x2d')]['find'](_0x1a63ea)[_0xed15('0x2a')](handleEntityNotFound(_0x3b03fc,null))[_0xed15('0x2a')](respondWithResult(_0x3b03fc,null))[_0xed15('0x4b')](handleError(_0x3b03fc,null));};exports['update']=function(_0x29e69d,_0x32ad88){if(_0x29e69d['body']['id']){delete _0x29e69d['body']['id'];}return db['CmCustomField'][_0xed15('0x4e')]({'where':{'id':_0x29e69d[_0xed15('0x4d')]['id']}})[_0xed15('0x2a')](handleEntityNotFound(_0x32ad88,null))[_0xed15('0x2a')](saveUpdates(_0x29e69d[_0xed15('0x4f')],null))[_0xed15('0x2a')](respondWithResult(_0x32ad88,null))[_0xed15('0x4b')](handleError(_0x32ad88,null));};exports[_0xed15('0x29')]=function(_0x9860b5,_0x1dd42b){return db[_0xed15('0x2d')][_0xed15('0x4e')]({'where':{'id':_0x9860b5[_0xed15('0x4d')]['id']}})[_0xed15('0x2a')](handleEntityNotFound(_0x1dd42b,null))[_0xed15('0x2a')](removeEntity(_0x1dd42b,null))[_0xed15('0x4b')](handleError(_0x1dd42b,null));};exports[_0xed15('0x50')]=function(_0xb316f2,_0x4ea645){var _0x4374d6;return db[_0xed15('0x51')][_0xed15('0x52')](function(_0x5e3633){return db[_0xed15('0x2d')][_0xed15('0x50')](_0xb316f2['body'],{'transaction':_0x5e3633})[_0xed15('0x2a')](function(_0x69adeb){_0x4374d6=_0x69adeb;var _0x4c1fbc={'type':db[_0xed15('0x53')][_0xed15('0x54')],'transaction':_0x5e3633};switch(_0xb316f2[_0xed15('0x4f')][_0xed15('0x30')]){case _0xed15('0x55'):_0x4c1fbc[_0xed15('0x30')]=db[_0xed15('0x53')][_0xed15('0x54')];break;case'number':_0x4c1fbc[_0xed15('0x30')]=db[_0xed15('0x53')][_0xed15('0x56')];break;case _0xed15('0x57'):_0x4c1fbc['type']=db['Sequelize'][_0xed15('0x58')];_0x4c1fbc[_0xed15('0x59')]=![];break;default:}return db[_0xed15('0x51')][_0xed15('0x5a')][_0xed15('0x5b')](_0xed15('0x5c'),util[_0xed15('0x5d')](_0xed15('0x5e'),_0x4374d6['id']),_0x4c1fbc);})[_0xed15('0x2a')](function(){return _0x4374d6;});})['then'](respondWithResult(_0x4ea645,0xc9))[_0xed15('0x4b')](handleError(_0x4ea645,null));}; \ No newline at end of file +var _0xc0d5=['findAll','rows','catch','params','keys','length','find','body','create','sequelize','Sequelize','TEXT','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','error','stack','name','index','map','CmCustomField','rawAttributes','key','differenceBy','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include'];(function(_0x5a8577,_0x25b734){var _0x10328e=function(_0xf651ef){while(--_0xf651ef){_0x5a8577['push'](_0x5a8577['shift']());}};_0x10328e(++_0x25b734);}(_0xc0d5,0x69));var _0x5c0d=function(_0xb6d683,_0x5b8373){_0xb6d683=_0xb6d683-0x0;var _0x3b70de=_0xc0d5[_0xb6d683];return _0x3b70de;};'use strict';var emlformat=require(_0x5c0d('0x0'));var rimraf=require(_0x5c0d('0x1'));var zipdir=require(_0x5c0d('0x2'));var jsonpatch=require(_0x5c0d('0x3'));var rp=require('request-promise');var moment=require(_0x5c0d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c0d('0x5'));var util=require('util');var path=require(_0x5c0d('0x6'));var sox=require(_0x5c0d('0x7'));var csv=require(_0x5c0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c0d('0x9'));var _=require('lodash');var squel=require(_0x5c0d('0xa'));var crypto=require('crypto');var jsforce=require(_0x5c0d('0xb'));var deskjs=require(_0x5c0d('0xc'));var toCsv=require(_0x5c0d('0x8'));var querystring=require(_0x5c0d('0xd'));var Papa=require(_0x5c0d('0xe'));var Redis=require(_0x5c0d('0xf'));var authService=require(_0x5c0d('0x10'));var qs=require(_0x5c0d('0x11'));var as=require(_0x5c0d('0x12'));var hardwareService=require(_0x5c0d('0x13'));var logger=require(_0x5c0d('0x14'))('api');var utils=require(_0x5c0d('0x15'));var config=require(_0x5c0d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c0d('0x17'))['db'];function respondWithStatusCode(_0x1c307e,_0xf8b5db){_0xf8b5db=_0xf8b5db||0xcc;return function(_0x54db88){if(_0x54db88){return _0x1c307e[_0x5c0d('0x18')](_0xf8b5db);}return _0x1c307e['status'](_0xf8b5db)[_0x5c0d('0x19')]();};}function respondWithResult(_0x248a3e,_0x168707){_0x168707=_0x168707||0xc8;return function(_0x3f7e14){if(_0x3f7e14){return _0x248a3e[_0x5c0d('0x1a')](_0x168707)['json'](_0x3f7e14);}};}function respondWithFilteredResult(_0x2f80c8,_0x247701){return function(_0x30e235){if(_0x30e235){var _0x434305=typeof _0x247701[_0x5c0d('0x1b')]==='undefined'&&typeof _0x247701['limit']===_0x5c0d('0x1c');var _0xdad8db=_0x30e235[_0x5c0d('0x1d')];var _0x2003dd=_0x434305?0x0:_0x247701[_0x5c0d('0x1b')];var _0x14025a=_0x434305?_0x30e235[_0x5c0d('0x1d')]:_0x247701['offset']+_0x247701[_0x5c0d('0x1e')];var _0x260f69;if(_0x14025a>=_0xdad8db){_0x14025a=_0xdad8db;_0x260f69=0xc8;}else{_0x260f69=0xce;}_0x2f80c8[_0x5c0d('0x1a')](_0x260f69);return _0x2f80c8[_0x5c0d('0x1f')](_0x5c0d('0x20'),_0x2003dd+'-'+_0x14025a+'/'+_0xdad8db)[_0x5c0d('0x21')](_0x30e235);}return null;};}function patchUpdates(_0x93fd88){return function(_0x4a077b){try{jsonpatch['apply'](_0x4a077b,_0x93fd88,!![]);}catch(_0x5f1b65){return BPromise[_0x5c0d('0x22')](_0x5f1b65);}return _0x4a077b[_0x5c0d('0x23')]();};}function saveUpdates(_0x18fe47,_0x31cd69){return function(_0x1efac7){if(_0x1efac7){return _0x1efac7[_0x5c0d('0x24')](_0x18fe47)['then'](function(_0x4f1f58){return _0x4f1f58;});}return null;};}function removeEntity(_0x2a6ae5,_0x38ee0d){return function(_0x43fe29){if(_0x43fe29){return _0x43fe29[_0x5c0d('0x25')]()['then'](function(){_0x2a6ae5['status'](0xcc)[_0x5c0d('0x19')]();});}};}function handleEntityNotFound(_0x2b8766,_0x16e1af){return function(_0x380fa1){if(!_0x380fa1){_0x2b8766[_0x5c0d('0x18')](0x194);}return _0x380fa1;};}function handleError(_0x51ab15,_0x3ad9b9){_0x3ad9b9=_0x3ad9b9||0x1f4;return function(_0x2b9829){logger[_0x5c0d('0x26')](_0x2b9829[_0x5c0d('0x27')]);if(_0x2b9829['name']){delete _0x2b9829[_0x5c0d('0x28')];}_0x51ab15['status'](_0x3ad9b9)['send'](_0x2b9829);};}exports[_0x5c0d('0x29')]=function(_0x2a923e,_0x2c29ed){var _0xda96b2={},_0x5a32e1={},_0x108799={'count':0x0,'rows':[]};var _0x5935f9=_[_0x5c0d('0x2a')](db[_0x5c0d('0x2b')][_0x5c0d('0x2c')],function(_0x32062a){return{'name':_0x32062a['fieldName'],'type':_0x32062a['type'][_0x5c0d('0x2d')]};});_0x5a32e1['model']=_[_0x5c0d('0x2e')](_[_0x5c0d('0x2a')](_0x5935f9,_0x5c0d('0x28')),[_0x5c0d('0x28')]);_0x5a32e1[_0x5c0d('0x2f')]=_['keys'](_0x2a923e[_0x5c0d('0x2f')]);_0x5a32e1[_0x5c0d('0x30')]=_[_0x5c0d('0x31')](_0x5a32e1['model'],_0x5a32e1['query']);_0xda96b2[_0x5c0d('0x32')]=_[_0x5c0d('0x31')](_0x5a32e1[_0x5c0d('0x33')],qs[_0x5c0d('0x34')](_0x2a923e[_0x5c0d('0x2f')]['fields']));_0xda96b2['attributes']=_0xda96b2[_0x5c0d('0x32')]['length']?_0xda96b2[_0x5c0d('0x32')]:_0x5a32e1['model'];if(!_0x2a923e[_0x5c0d('0x2f')][_0x5c0d('0x35')](_0x5c0d('0x36'))){_0xda96b2['limit']=qs[_0x5c0d('0x1e')](_0x2a923e['query'][_0x5c0d('0x1e')]);_0xda96b2[_0x5c0d('0x1b')]=qs[_0x5c0d('0x1b')](_0x2a923e['query'][_0x5c0d('0x1b')]);}_0xda96b2[_0x5c0d('0x37')]=qs[_0x5c0d('0x38')](_0x2a923e['query'][_0x5c0d('0x38')]);_0xda96b2[_0x5c0d('0x39')]=qs[_0x5c0d('0x30')](_[_0x5c0d('0x3a')](_0x2a923e[_0x5c0d('0x2f')],_0x5a32e1['filters']),_0x5935f9);if(_0x2a923e[_0x5c0d('0x2f')][_0x5c0d('0x3b')]){_0xda96b2['where']=_[_0x5c0d('0x3c')](_0xda96b2[_0x5c0d('0x39')],{'$or':_['map'](_0x5935f9,function(_0xf6165e){if(_0xf6165e[_0x5c0d('0x3d')]!==_0x5c0d('0x3e')){var _0x131ff4={};_0x131ff4[_0xf6165e[_0x5c0d('0x28')]]={'$like':'%'+_0x2a923e['query']['filter']+'%'};return _0x131ff4;}})});}_0xda96b2=_[_0x5c0d('0x3c')]({},_0xda96b2,_0x2a923e[_0x5c0d('0x3f')]);var _0x515ac9={'where':_0xda96b2[_0x5c0d('0x39')]};return db[_0x5c0d('0x2b')][_0x5c0d('0x1d')](_0x515ac9)[_0x5c0d('0x40')](function(_0x31762f){_0x108799[_0x5c0d('0x1d')]=_0x31762f;if(_0x2a923e[_0x5c0d('0x2f')][_0x5c0d('0x41')]){_0xda96b2[_0x5c0d('0x42')]=[{'all':!![]}];}return db[_0x5c0d('0x2b')][_0x5c0d('0x43')](_0xda96b2);})[_0x5c0d('0x40')](function(_0x353bb0){_0x108799[_0x5c0d('0x44')]=_0x353bb0;return _0x108799;})[_0x5c0d('0x40')](respondWithFilteredResult(_0x2c29ed,_0xda96b2))[_0x5c0d('0x45')](handleError(_0x2c29ed,null));};exports['show']=function(_0x29794b,_0x1379f4){var _0x540c28={'raw':!![],'where':{'id':_0x29794b[_0x5c0d('0x46')]['id']}},_0x1207d4={};_0x1207d4[_0x5c0d('0x33')]=_['keys'](db['CmCustomField'][_0x5c0d('0x2c')]);_0x1207d4['query']=_[_0x5c0d('0x47')](_0x29794b[_0x5c0d('0x2f')]);_0x1207d4[_0x5c0d('0x30')]=_['intersection'](_0x1207d4[_0x5c0d('0x33')],_0x1207d4[_0x5c0d('0x2f')]);_0x540c28[_0x5c0d('0x32')]=_[_0x5c0d('0x31')](_0x1207d4['model'],qs[_0x5c0d('0x34')](_0x29794b[_0x5c0d('0x2f')][_0x5c0d('0x34')]));_0x540c28[_0x5c0d('0x32')]=_0x540c28[_0x5c0d('0x32')][_0x5c0d('0x48')]?_0x540c28[_0x5c0d('0x32')]:_0x1207d4[_0x5c0d('0x33')];if(_0x29794b[_0x5c0d('0x2f')]['includeAll']){_0x540c28[_0x5c0d('0x42')]=[{'all':!![]}];}_0x540c28=_[_0x5c0d('0x3c')]({},_0x540c28,_0x29794b[_0x5c0d('0x3f')]);return db['CmCustomField'][_0x5c0d('0x49')](_0x540c28)[_0x5c0d('0x40')](handleEntityNotFound(_0x1379f4,null))[_0x5c0d('0x40')](respondWithResult(_0x1379f4,null))[_0x5c0d('0x45')](handleError(_0x1379f4,null));};exports[_0x5c0d('0x24')]=function(_0x18c91f,_0x38bb7f){if(_0x18c91f[_0x5c0d('0x4a')]['id']){delete _0x18c91f[_0x5c0d('0x4a')]['id'];}return db[_0x5c0d('0x2b')][_0x5c0d('0x49')]({'where':{'id':_0x18c91f[_0x5c0d('0x46')]['id']}})[_0x5c0d('0x40')](handleEntityNotFound(_0x38bb7f,null))[_0x5c0d('0x40')](saveUpdates(_0x18c91f[_0x5c0d('0x4a')],null))[_0x5c0d('0x40')](respondWithResult(_0x38bb7f,null))[_0x5c0d('0x45')](handleError(_0x38bb7f,null));};exports[_0x5c0d('0x25')]=function(_0x2d287a,_0x1b5ae9){return db[_0x5c0d('0x2b')][_0x5c0d('0x49')]({'where':{'id':_0x2d287a[_0x5c0d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b5ae9,null))[_0x5c0d('0x40')](removeEntity(_0x1b5ae9,null))[_0x5c0d('0x45')](handleError(_0x1b5ae9,null));};exports[_0x5c0d('0x4b')]=function(_0x517743,_0x4d047c){var _0x404b08;return db[_0x5c0d('0x4c')]['transaction'](function(_0x345572){return db['CmCustomField'][_0x5c0d('0x4b')](_0x517743[_0x5c0d('0x4a')],{'transaction':_0x345572})[_0x5c0d('0x40')](function(_0xd6fab9){_0x404b08=_0xd6fab9;var _0x438183={'type':db[_0x5c0d('0x4d')]['TEXT'],'transaction':_0x345572};switch(_0x517743[_0x5c0d('0x4a')][_0x5c0d('0x3d')]){case'text':_0x438183[_0x5c0d('0x3d')]=db[_0x5c0d('0x4d')][_0x5c0d('0x4e')];break;case'number':_0x438183['type']=db[_0x5c0d('0x4d')]['INTEGER'];break;case _0x5c0d('0x4f'):_0x438183[_0x5c0d('0x3d')]=db[_0x5c0d('0x4d')][_0x5c0d('0x50')];_0x438183[_0x5c0d('0x51')]=![];break;default:}return db[_0x5c0d('0x4c')][_0x5c0d('0x52')][_0x5c0d('0x53')]('cm_contacts',util[_0x5c0d('0x54')](_0x5c0d('0x55'),_0x404b08['id']),_0x438183);})[_0x5c0d('0x40')](function(){return _0x404b08;});})[_0x5c0d('0x40')](respondWithResult(_0x4d047c,0xc9))[_0x5c0d('0x45')](handleError(_0x4d047c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index cffe410..9d7bfb2 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 _0x6356=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','CmCustomField','lodash','util'];(function(_0x3403a2,_0x2aacaf){var _0x4c464f=function(_0x92f67f){while(--_0x92f67f){_0x3403a2['push'](_0x3403a2['shift']());}};_0x4c464f(++_0x2aacaf);}(_0x6356,0x132));var _0x6635=function(_0x5aed32,_0x2a5832){_0x5aed32=_0x5aed32-0x0;var _0x4d897f=_0x6356[_0x5aed32];return _0x4d897f;};'use strict';var _=require(_0x6635('0x0'));var util=require(_0x6635('0x1'));var logger=require(_0x6635('0x2'))(_0x6635('0x3'));var moment=require(_0x6635('0x4'));var BPromise=require(_0x6635('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6635('0x6'));var rimraf=require(_0x6635('0x7'));var config=require(_0x6635('0x8'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x27eebe,_0x46b4ba){return _0x27eebe[_0x6635('0x9')](_0x6635('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ed5=['path','exports','cm_custom_fields','../../config/logger','api','moment','request-promise'];(function(_0x1b91ba,_0x57f719){var _0x54426d=function(_0x561c25){while(--_0x561c25){_0x1b91ba['push'](_0x1b91ba['shift']());}};_0x54426d(++_0x57f719);}(_0x5ed5,0x1f4));var _0x55ed=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5ed5[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x55ed('0x0'))(_0x55ed('0x1'));var moment=require(_0x55ed('0x2'));var BPromise=require('bluebird');var rp=require(_0x55ed('0x3'));var fs=require('fs');var path=require(_0x55ed('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x55ed('0x5')]=function(_0x3b08c6,_0x1cbdfe){return _0x3b08c6['define']('CmCustomField',attributes,{'tableName':_0x55ed('0x6'),'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 3ede249..fbfe270 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 _0x410f=['rpc','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','bluebird','randomstring','ioredis'];(function(_0x288447,_0x42347b){var _0x2106e6=function(_0x3b1a4b){while(--_0x3b1a4b){_0x288447['push'](_0x288447['shift']());}};_0x2106e6(++_0x42347b);}(_0x410f,0x7b));var _0xf410=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x410f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf410('0x0'));var rs=require(_0xf410('0x1'));var fs=require('fs');var Redis=require(_0xf410('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf410('0x3'));var config=require('../../config/environment');var jayson=require(_0xf410('0x4'));var client=jayson['client'][_0xf410('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2b9614,_0x564773,_0x3c30b4){return new BPromise(function(_0x5b75da,_0x4cea93){return client[_0xf410('0x6')](_0x2b9614,_0x3c30b4)[_0xf410('0x7')](function(_0x4f6d6a){logger['info'](_0xf410('0x8'),_0x564773,'request\x20sent');logger[_0xf410('0x9')](_0xf410('0xa'),_0x564773,'request\x20sent',JSON[_0xf410('0xb')](_0x4f6d6a));if(_0x4f6d6a['error']){if(_0x4f6d6a[_0xf410('0xc')][_0xf410('0xd')]===0x1f4){logger[_0xf410('0xc')](_0xf410('0x8'),_0x564773,_0x4f6d6a[_0xf410('0xc')][_0xf410('0xe')]);return _0x4cea93(_0x4f6d6a[_0xf410('0xc')]['message']);}logger['error'](_0xf410('0x8'),_0x564773,_0x4f6d6a[_0xf410('0xc')][_0xf410('0xe')]);return _0x5b75da(_0x4f6d6a[_0xf410('0xc')][_0xf410('0xe')]);}else{logger[_0xf410('0xf')](_0xf410('0x8'),_0x564773,_0xf410('0x10'));_0x5b75da(_0x4f6d6a['result'][_0xf410('0xe')]);}})[_0xf410('0x11')](function(_0xcab528){logger['error'](_0xf410('0x8'),_0x564773,_0xcab528);_0x4cea93(_0xcab528);});});} \ No newline at end of file +var _0x2ee0=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x30e223,_0x424e54){var _0x46f56d=function(_0x466271){while(--_0x466271){_0x30e223['push'](_0x30e223['shift']());}};_0x46f56d(++_0x424e54);}(_0x2ee0,0x91));var _0x02ee=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0x2ee0[_0x4e9274];return _0x8b474c;};'use strict';var _=require(_0x02ee('0x0'));var util=require(_0x02ee('0x1'));var moment=require('moment');var BPromise=require(_0x02ee('0x2'));var rs=require(_0x02ee('0x3'));var fs=require('fs');var Redis=require(_0x02ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x02ee('0x5'));var logger=require('../../config/logger')(_0x02ee('0x6'));var config=require(_0x02ee('0x7'));var jayson=require(_0x02ee('0x8'));var client=jayson[_0x02ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fddf5,_0x5a894e,_0x2f8f51){return new BPromise(function(_0x30342c,_0x1328d0){return client[_0x02ee('0xa')](_0x1fddf5,_0x2f8f51)[_0x02ee('0xb')](function(_0x31b082){logger[_0x02ee('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5a894e,_0x02ee('0xd'));logger[_0x02ee('0xe')](_0x02ee('0xf'),_0x5a894e,_0x02ee('0xd'),JSON[_0x02ee('0x10')](_0x31b082));if(_0x31b082['error']){if(_0x31b082[_0x02ee('0x11')]['code']===0x1f4){logger[_0x02ee('0x11')]('CmCustomField,\x20%s,\x20%s',_0x5a894e,_0x31b082[_0x02ee('0x11')]['message']);return _0x1328d0(_0x31b082[_0x02ee('0x11')]['message']);}logger[_0x02ee('0x11')](_0x02ee('0x12'),_0x5a894e,_0x31b082['error']['message']);return _0x30342c(_0x31b082[_0x02ee('0x11')]['message']);}else{logger[_0x02ee('0xc')](_0x02ee('0x12'),_0x5a894e,_0x02ee('0xd'));_0x30342c(_0x31b082[_0x02ee('0x13')]['message']);}})['catch'](function(_0x5b3fb2){logger['error']('CmCustomField,\x20%s,\x20%s',_0x5a894e,_0x5b3fb2);_0x1328d0(_0x5b3fb2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6d15790..9794e0e 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 _0x3a0f=['destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x38d3bd,_0x49f837){var _0x19022c=function(_0x30341f){while(--_0x30341f){_0x38d3bd['push'](_0x38d3bd['shift']());}};_0x19022c(++_0x49f837);}(_0x3a0f,0x145));var _0xf3a0=function(_0x5d4b68,_0x1b7991){_0x5d4b68=_0x5d4b68-0x0;var _0x56e480=_0x3a0f[_0x5d4b68];return _0x56e480;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf3a0('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf3a0('0x1')]();var fs_extra=require(_0xf3a0('0x2'));var auth=require(_0xf3a0('0x3'));var interaction=require(_0xf3a0('0x4'));var config=require(_0xf3a0('0x5'));var controller=require(_0xf3a0('0x6'));router[_0xf3a0('0x7')]('/',auth[_0xf3a0('0x8')](),controller['index']);router[_0xf3a0('0x7')](_0xf3a0('0x9'),auth[_0xf3a0('0x8')](),controller[_0xf3a0('0xa')]);router['post']('/',auth[_0xf3a0('0x8')](),controller[_0xf3a0('0xb')]);router[_0xf3a0('0xc')](_0xf3a0('0x9'),auth[_0xf3a0('0x8')](),controller[_0xf3a0('0xd')]);router[_0xf3a0('0xe')](_0xf3a0('0x9'),auth['isAuthenticated'](),controller[_0xf3a0('0xf')]);module[_0xf3a0('0x10')]=router; \ No newline at end of file +var _0x4317=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x4317,0x7c));var _0x7431=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4317[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var fs_extra=require(_0x7431('0x4'));var auth=require(_0x7431('0x5'));var interaction=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var controller=require(_0x7431('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7431('0x9')]);router[_0x7431('0xa')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0xd')]);router[_0x7431('0xe')]('/',auth[_0x7431('0xc')](),controller[_0x7431('0xf')]);router[_0x7431('0x10')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x11')]);router[_0x7431('0x12')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x13')]);module[_0x7431('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 64951c0..c278625 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 _0x7b7a=['INTEGER','UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7b7a,0x174));var _0xa7b7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7b7a[_0x5ddb1c];return _0x354adc;};'use strict';var moment=require(_0xa7b7('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xa7b7('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xa7b7('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa7b7('0x3')],'defaultValue':moment()[_0xa7b7('0x4')](_0xa7b7('0x5'))},'countbusyretry':{'type':Sequelize[_0xa7b7('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa7b7('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa7b7('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa7b7('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa7b7('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa7b7('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa7b7('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa7b7('0x6')],'unique':_0xa7b7('0x8')},'UserId':{'type':Sequelize[_0xa7b7('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa7b7('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xa7b7('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa7b7('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa7b7('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa7b7('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa7b7('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9caa=['STRING','UNSIGNED','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9caa,0x139));var _0xa9ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9caa[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xa9ca('0x0'));var Sequelize=require(_0xa9ca('0x1'));module[_0xa9ca('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xa9ca('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa9ca('0x4')],'defaultValue':moment()['format'](_0xa9ca('0x5'))},'countbusyretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa9ca('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa9ca('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa9ca('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa9ca('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa9ca('0x6')],'unique':_0xa9ca('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xa9ca('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa9ca('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa9ca('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa9ca('0x7')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 b1423a0..ffdc789 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 _0x495e=['$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopper','includeAll','include','findAll','rows','catch','keys','merge','find','create','body','update','destroy','params','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','describe','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','LOCK','getOpenContacts','isNumber','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','moment','../../config/logger','api','../../config/environment','../../mysqldb','status','json','limit','count','offset','set','Content-Range','then','error','stack','send','index','map','fieldName','type','key','name','query','filters','intersection','model','concat','$and','$or'];(function(_0x3edc47,_0x155281){var _0x4bce7f=function(_0x386f97){while(--_0x386f97){_0x3edc47['push'](_0x3edc47['shift']());}};_0x4bce7f(++_0x155281);}(_0x495e,0xfb));var _0xe495=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x495e[_0xee2e7a];return _0x319dd3;};'use strict';var moment=require(_0xe495('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xe495('0x1'))(_0xe495('0x2'));var shared=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];function respondWithResult(_0x4e5ce9,_0x3f119c){_0x3f119c=_0x3f119c||0xc8;return function(_0x442101){if(_0x442101){return _0x4e5ce9[_0xe495('0x5')](_0x3f119c)[_0xe495('0x6')](_0x442101);}};}function respondWithFilteredResult(_0x130db3,_0x467a69){return function(_0x101a7e){if(_0x101a7e){var _0x5745e3=typeof _0x467a69['offset']==='undefined'&&typeof _0x467a69[_0xe495('0x7')]==='undefined';var _0x3dc66f=_0x101a7e[_0xe495('0x8')];var _0x15ff5c=_0x5745e3?0x0:_0x467a69[_0xe495('0x9')];var _0x2a38c7=_0x5745e3?_0x101a7e['count']:_0x467a69[_0xe495('0x9')]+_0x467a69[_0xe495('0x7')];var _0x2325ea;if(_0x2a38c7>=_0x3dc66f){_0x2a38c7=_0x3dc66f;_0x2325ea=0xc8;}else{_0x2325ea=0xce;}_0x130db3['status'](_0x2325ea);return _0x130db3[_0xe495('0xa')](_0xe495('0xb'),_0x15ff5c+'-'+_0x2a38c7+'/'+_0x3dc66f)['json'](_0x101a7e);}return null;};}function saveUpdates(_0x51c2d4,_0x1d73a5){return function(_0x13aedb){if(_0x13aedb){return _0x13aedb['update'](_0x51c2d4)[_0xe495('0xc')](function(_0x21654e){return _0x21654e;});}return null;};}function handleEntityNotFound(_0xab9c10,_0x14744d){return function(_0x2b5e19){if(!_0x2b5e19){_0xab9c10['sendStatus'](0x194);}return _0x2b5e19;};}function handleError(_0x3e2a09,_0x103c25){_0x103c25=_0x103c25||0x1f4;return function(_0x19d096){logger[_0xe495('0xd')](_0x19d096[_0xe495('0xe')]);if(_0x19d096['name']){delete _0x19d096['name'];}_0x3e2a09['status'](_0x103c25)[_0xe495('0xf')](_0x19d096);};}exports[_0xe495('0x10')]=function(_0x2aa692,_0x577fb7){var _0x1e602c={},_0x302ca0={},_0x3ba8cc={'count':0x0,'rows':[]};var _0x1ba7b2=_[_0xe495('0x11')](db['CmHopper']['rawAttributes'],function(_0x1ef900){return{'name':_0x1ef900[_0xe495('0x12')],'type':_0x1ef900[_0xe495('0x13')][_0xe495('0x14')]};});_0x302ca0['model']=_[_0xe495('0x11')](_0x1ba7b2,_0xe495('0x15'));_0x302ca0[_0xe495('0x16')]=_['keys'](_0x2aa692[_0xe495('0x16')]);_0x302ca0[_0xe495('0x17')]=_[_0xe495('0x18')](_0x302ca0[_0xe495('0x19')],_0x302ca0[_0xe495('0x16')]);_0x302ca0['filters']=_[_0xe495('0x1a')](_0x302ca0['filters'],[_0xe495('0x1b'),_0xe495('0x1c'),_0xe495('0x1d'),'$gte',_0xe495('0x1e'),_0xe495('0x1f'),_0xe495('0x20'),_0xe495('0x21'),_0xe495('0x22'),_0xe495('0x23'),_0xe495('0x24'),'$in','$notIn',_0xe495('0x25'),'$notLike',_0xe495('0x26'),_0xe495('0x27'),'$like','$overlap',_0xe495('0x28'),_0xe495('0x29'),_0xe495('0x2a')]);_0x1e602c[_0xe495('0x2b')]=_[_0xe495('0x18')](_0x302ca0[_0xe495('0x19')],qs[_0xe495('0x2c')](_0x2aa692[_0xe495('0x16')]['fields']));_0x1e602c['attributes']=_0x1e602c[_0xe495('0x2b')][_0xe495('0x2d')]?_0x1e602c[_0xe495('0x2b')]:_0x302ca0[_0xe495('0x19')];if(!_0x2aa692['query'][_0xe495('0x2e')](_0xe495('0x2f'))){_0x1e602c[_0xe495('0x7')]=qs[_0xe495('0x7')](_0x2aa692[_0xe495('0x16')][_0xe495('0x7')]);_0x1e602c[_0xe495('0x9')]=qs[_0xe495('0x9')](_0x2aa692[_0xe495('0x16')][_0xe495('0x9')]);}_0x1e602c[_0xe495('0x30')]=qs[_0xe495('0x31')](_0x2aa692[_0xe495('0x16')][_0xe495('0x31')]);_0x1e602c[_0xe495('0x32')]=qs['filters'](_[_0xe495('0x33')](_0x2aa692[_0xe495('0x16')],_0x302ca0['filters']),_0x1ba7b2);if(_0x2aa692[_0xe495('0x16')][_0xe495('0x34')]){_0x1e602c['where']=_['merge'](_0x1e602c[_0xe495('0x32')],{'$or':_[_0xe495('0x11')](_0x1ba7b2,function(_0x3b2b1e){if(_0x3b2b1e[_0xe495('0x13')]!=='VIRTUAL'){var _0x3c2003={};_0x3c2003[_0x3b2b1e[_0xe495('0x15')]]={'$like':'%'+_0x2aa692[_0xe495('0x16')]['filter']+'%'};return _0x3c2003;}})});}_0x1e602c=_['merge']({},_0x1e602c,_0x2aa692[_0xe495('0x35')]);var _0x5b6d05={'where':_0x1e602c[_0xe495('0x32')]};return db[_0xe495('0x36')]['count'](_0x5b6d05)['then'](function(_0x3fb1fe){_0x3ba8cc[_0xe495('0x8')]=_0x3fb1fe;if(_0x2aa692[_0xe495('0x16')][_0xe495('0x37')]){_0x1e602c[_0xe495('0x38')]=[{'all':!![]}];}return db[_0xe495('0x36')][_0xe495('0x39')](_0x1e602c);})[_0xe495('0xc')](function(_0x4384ee){_0x3ba8cc[_0xe495('0x3a')]=_0x4384ee;return _0x3ba8cc;})[_0xe495('0xc')](respondWithFilteredResult(_0x577fb7,_0x1e602c))[_0xe495('0x3b')](handleError(_0x577fb7,null));};exports['show']=function(_0x734667,_0x1f80af){var _0x232465={'raw':!![],'where':{'id':_0x734667['params']['id']}},_0x6cb073={};_0x6cb073[_0xe495('0x19')]=_[_0xe495('0x3c')](db['CmHopper']['rawAttributes']);_0x6cb073['query']=_[_0xe495('0x3c')](_0x734667[_0xe495('0x16')]);_0x6cb073[_0xe495('0x17')]=_[_0xe495('0x18')](_0x6cb073[_0xe495('0x19')],_0x6cb073[_0xe495('0x16')]);_0x232465['attributes']=_[_0xe495('0x18')](_0x6cb073[_0xe495('0x19')],qs[_0xe495('0x2c')](_0x734667[_0xe495('0x16')][_0xe495('0x2c')]));_0x232465[_0xe495('0x2b')]=_0x232465[_0xe495('0x2b')][_0xe495('0x2d')]?_0x232465[_0xe495('0x2b')]:_0x6cb073['model'];if(_0x734667['query'][_0xe495('0x37')]){_0x232465['include']=[{'all':!![]}];}_0x232465=_[_0xe495('0x3d')]({},_0x232465,_0x734667[_0xe495('0x35')]);return db['CmHopper'][_0xe495('0x3e')](_0x232465)['then'](handleEntityNotFound(_0x1f80af,null))['then'](respondWithResult(_0x1f80af,null))[_0xe495('0x3b')](handleError(_0x1f80af,null));};exports['create']=function(_0x41518b,_0x4d7f59){return db[_0xe495('0x36')][_0xe495('0x3f')](_0x41518b[_0xe495('0x40')],{})[_0xe495('0xc')](respondWithResult(_0x4d7f59,0xc9))[_0xe495('0x3b')](handleError(_0x4d7f59,null));};exports[_0xe495('0x41')]=function(_0x1f4999,_0x56b620){if(_0x1f4999[_0xe495('0x40')]['id']){delete _0x1f4999[_0xe495('0x40')]['id'];}return db['CmHopper'][_0xe495('0x3e')]({'where':{'id':_0x1f4999['params']['id']}})[_0xe495('0xc')](handleEntityNotFound(_0x56b620,null))[_0xe495('0xc')](saveUpdates(_0x1f4999[_0xe495('0x40')],null))[_0xe495('0xc')](respondWithResult(_0x56b620,null))['catch'](handleError(_0x56b620,null));};exports['describe']=function(_0x54a346,_0x3b3fb1){return db[_0xe495('0x36')]['describe']()[_0xe495('0xc')](respondWithResult(_0x3b3fb1,null))[_0xe495('0x3b')](handleError(_0x3b3fb1,null));};exports[_0xe495('0x42')]=function(_0x103953,_0x13fa96){var _0x11f801;var _0x215114=_0x103953['params']['id'];return db[_0xe495('0x36')][_0xe495('0x3e')]({'where':{'id':_0x103953[_0xe495('0x43')]['id']}})[_0xe495('0xc')](handleEntityNotFound(_0x13fa96,null))[_0xe495('0xc')](function(_0x4c366e){if(_0x4c366e){return _0x4c366e['destroy']()[_0xe495('0xc')](function(_0x19d7b7){return _0x19d7b7;});}})[_0xe495('0xc')](function(_0x53cd3f){_0x11f801=_0x53cd3f;if(_0x53cd3f){if(_0x53cd3f['VoiceQueueId']||_0x53cd3f[_0xe495('0x44')]){return db[_0x53cd3f['VoiceQueueId']?_0xe495('0x45'):_0xe495('0x46')]['find']({'where':{'id':_0x53cd3f[_0xe495('0x47')]?_0x53cd3f[_0xe495('0x47')]:_0x53cd3f[_0xe495('0x44')]},'attributes':['id',_0xe495('0x15')],'raw':!![]});}}})[_0xe495('0xc')](function(_0xb8959a){var _0x9b12f9={};if(_0xb8959a){_[_0xe495('0x3d')](_0x9b12f9,_[_0xe495('0x48')](_0x11f801[_0xe495('0x49')],[_0xe495('0x4a'),_0xe495('0x4b'),'id']));_0x9b12f9['state']=0x15;_0x9b12f9[_0xe495('0x4c')]=_0xe495('0x4d');_0x9b12f9[_0xe495('0x4e')]=_0xb8959a[_0xe495('0x15')];_0x9b12f9[_0xe495('0x4f')]=_0x103953[_0xe495('0x50')][_0xe495('0x15')];_0x9b12f9[_0xe495('0x51')]=_0x103953[_0xe495('0x50')]['id'];_0x9b12f9[_0xe495('0x4d')]=!![];_0x9b12f9['deletedat']=moment()['format'](_0xe495('0x52'));_0x9b12f9[_0xe495('0x53')]=_0x11f801['phone'];_0x9b12f9[_0xe495('0x54')]=_0x11f801[_0xe495('0x47')]?_0xe495('0x55'):_0xe495('0x56');return db['CmContact'][_0xe495('0x3e')]({'where':{'id':_0x9b12f9[_0xe495('0x57')]},'attributes':[_0xe495('0x58'),_0xe495('0x59')]})[_0xe495('0xc')](function(_0xfcfb7b){if(!_['isNil'](_0x13fa96)&&!_[_0xe495('0x5a')](_0xfcfb7b['firstName'])){_0x9b12f9[_0xe495('0x5b')]=_0xfcfb7b['firstName'];if(!_[_0xe495('0x5a')](_0xfcfb7b['lastName'])){_0x9b12f9[_0xe495('0x5b')]+='\x20'+_0xfcfb7b['lastName'];}}})[_0xe495('0x5c')](function(){return db[_0xe495('0x5d')]['create'](_0x9b12f9);});}})[_0xe495('0xc')](function(_0x1ccb69){return db[_0xe495('0x5e')][_0xe495('0x42')]({'where':{'CmHopperId':_0x215114}});})[_0xe495('0xc')](function(){return _0x13fa96[_0xe495('0x5')](0xcc)[_0xe495('0x5f')]();})[_0xe495('0x3b')](handleError(_0x13fa96,null));};exports[_0xe495('0x60')]=function(_0x11906c,_0x31493a){var _0x34bd9e=[];return db[_0xe495('0x61')][_0xe495('0x62')]()[_0xe495('0xc')](function(_0x45a768){_0x34bd9e=_[_0xe495('0x3c')](_0x45a768);return _0x11906c[_0xe495('0x50')][_0xe495('0x63')]({'where':{'type':_0xe495('0x64'),'dialActive':!![],'dialMethod':_0xe495('0x65')},'attributes':['id','dialOrderByScheduledAt',_0xe495('0x66')],'raw':!![]});})['then'](function(_0x3f0766){if(_0x3f0766&&_0x3f0766[_0xe495('0x2d')]){return db['sequelize'][_0xe495('0x67')](function(_0x5ea667){var _0x518419={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe495('0x68')](_0xe495('0x52'))},'VoiceQueueId':{'$in':_['map'](_0x3f0766,'id')},'$or':[{'UserId':null},{'UserId':_0x11906c[_0xe495('0x50')]['id']}]};var _0x298c52={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3f0766)[_0xe495('0x34')]([_0xe495('0x66'),0x0])['map']('id')[_0xe495('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x11906c[_0xe495('0x50')]['id']}]};var _0x384ef0={'$or':[_0x518419,_0x298c52]};var _0x25175d=[];if(_0x11906c[_0xe495('0x40')]['direction']&&_0x11906c[_0xe495('0x40')][_0xe495('0x6a')]===_0xe495('0x6b')){if(!_[_0xe495('0x6c')](_0x11906c[_0xe495('0x40')]['hopperIds'])){_0x384ef0['id']={'$in':_0x11906c['body'][_0xe495('0x6d')]};}_0x25175d=[[_0xe495('0x6e'),_0xe495('0x6f')],['scheduledAt',_0x3f0766[0x0][_0xe495('0x70')]===_0xe495('0x6f')?_0xe495('0x71'):_0xe495('0x6f')],db[_0xe495('0x72')][_0xe495('0x73')](_0xe495('0x74')),['id',_0xe495('0x71')]];}else{if(!_['isEmpty'](_0x11906c[_0xe495('0x40')][_0xe495('0x6d')])){_0x384ef0['id']={'$notIn':_0x11906c[_0xe495('0x40')][_0xe495('0x6d')]};}_0x25175d=[['priority',_0xe495('0x71')],[_0xe495('0x75'),_0x3f0766[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0xe495('0x73')](_0xe495('0x76')),['id',_0xe495('0x6f')]];}return db[_0xe495('0x36')][_0xe495('0x77')]({'attributes':['id',_0xe495('0x78'),'phone',_0xe495('0x79')],'where':_0x384ef0,'order':_0x25175d,'transaction':_0x5ea667,'lock':_0x5ea667['LOCK'][_0xe495('0x7a')],'include':[{'model':db[_0xe495('0x61')],'as':_0xe495('0x7b'),'attributes':_0x34bd9e,'include':[{'model':db[_0xe495('0x7c')],'as':_0xe495('0x7d'),'attributes':['id','name']}]},{'model':db[_0xe495('0x7e')],'as':_0xe495('0x7f'),'attributes':['id','name']},{'model':db[_0xe495('0x45')],'as':_0xe495('0x80'),'attributes':['id','name',_0xe495('0x81')]}]})[_0xe495('0xc')](function(_0x738b2d){if(_0x738b2d){return _0x738b2d[_0xe495('0x41')]({'UserId':_0x11906c[_0xe495('0x50')]['id']},{'transaction':_0x5ea667});}});});}})[_0xe495('0xc')](handleEntityNotFound(_0x31493a,null))[_0xe495('0xc')](respondWithResult(_0x31493a,null))['catch'](handleError(_0x31493a,null));};exports[_0xe495('0x82')]=function(_0x27525e,_0x4eb2fe,_0x33ea8b){var _0xd2806e=[];var _0x175682=_0x27525e[_0xe495('0x43')]['id'];var _0x5aa77c=_0x27525e['user']['id'];return db[_0xe495('0x61')][_0xe495('0x62')]()[_0xe495('0xc')](function(_0x5a913c){_0xd2806e=_[_0xe495('0x3c')](_0x5a913c);return db[_0xe495('0x72')][_0xe495('0x67')](function(_0x159d1f){const _0x18600f={'id':_0x175682};return db[_0xe495('0x36')][_0xe495('0x77')]({'attributes':['id',_0xe495('0x78'),_0xe495('0x79')],'where':_0x18600f,'transaction':_0x159d1f,'lock':_0x159d1f[_0xe495('0x83')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xe495('0x7b'),'attributes':_0xd2806e,'include':[{'model':db[_0xe495('0x7c')],'as':'Company','attributes':['id',_0xe495('0x15')]}]},{'model':db[_0xe495('0x7e')],'as':_0xe495('0x7f'),'attributes':['id',_0xe495('0x15')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0xe495('0x81')]}]})[_0xe495('0xc')](function(_0x18209d){if(_0x18209d){return _0x18209d[_0xe495('0x41')]({'UserId':_0x5aa77c},{'transaction':_0x159d1f});}});});})[_0xe495('0xc')](handleEntityNotFound(_0x4eb2fe,null))[_0xe495('0xc')](respondWithResult(_0x4eb2fe,null))[_0xe495('0x3b')](handleError(_0x4eb2fe,null));};exports[_0xe495('0x84')]=function(_0x52715e,_0x288462){return _0x52715e[_0xe495('0x50')][_0xe495('0x63')]({'where':{'type':_0xe495('0x64'),'dialActive':!![],'dialMethod':_0xe495('0x65')},'attributes':['id'],'raw':!![]})[_0xe495('0xc')](function(_0x4281aa){if(_0x4281aa&&_0x4281aa[_0xe495('0x2d')]){return db[_0xe495('0x36')][_0xe495('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe495('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe495('0x11')](_0x4281aa,'id')},'$or':[{'UserId':null},{'UserId':_0x52715e[_0xe495('0x50')]['id']}]}});}return 0x0;})[_0xe495('0xc')](function(_0x2002d7){if(!_[_0xe495('0x5a')](_0x2002d7)&&_[_0xe495('0x85')](_0x2002d7)){return _0x288462['status'](0xc8)[_0xe495('0x6')]({'contacts':_0x2002d7});}else{logger[_0xe495('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xe495('0x84'),0x194,_0xe495('0x86'));_0x288462[_0xe495('0x87')](0x194);}})[_0xe495('0x3b')](handleError(_0x288462,null));};exports[_0xe495('0x88')]=function(_0xe9cc59,_0x45e263){var _0x543b33=shared[_0xe495('0x89')];var _0x5a72cd=[];_[_0xe495('0x11')](_0x543b33,function(_0x7d2729){_0x5a72cd[_0xe495('0x8a')]({'id':_0x7d2729['name'],'name':_0x7d2729[_0xe495('0x15')],'utcOffset':_0x7d2729['utcOffset']});});return _0x45e263[_0xe495('0x5')](0xc8)[_0xe495('0x6')]({'tz':_0x5a72cd});};exports[_0xe495('0x8b')]=function(_0x1ef812,_0x801f5f){var _0xaf9358=shared[_0xe495('0x89')];var _0x4dc595={};if(!_[_0xe495('0x5a')](_0xaf9358[_0x1ef812[_0xe495('0x40')]['id']]))_0x4dc595=_0xaf9358[_0x1ef812[_0xe495('0x40')]['id']];return _0x801f5f[_0xe495('0x5')](0xc8)[_0xe495('0x6')](_0x4dc595);}; \ No newline at end of file +var _0xed95=['phone','queue','CmContact','firstName','lastName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','List','dialActive','update','getPreviewRecall','Queue','getOpenContacts','isNil','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','sendStatus','error','name','send','index','map','CmHopper','fieldName','keys','query','filters','intersection','concat','$and','$or','$lt','$lte','$ne','$between','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contains','$contained','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','then','includeAll','include','findAll','rows','params','model','rawAttributes','options','find','catch','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','merge','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x19653d,_0x42db3b){var _0x3eb912=function(_0x59c81b){while(--_0x59c81b){_0x19653d['push'](_0x19653d['shift']());}};_0x3eb912(++_0x42db3b);}(_0xed95,0xb9));var _0x5ed9=function(_0x567eb7,_0x59df0a){_0x567eb7=_0x567eb7-0x0;var _0x57a8f9=_0xed95[_0x567eb7];return _0x57a8f9;};'use strict';var moment=require(_0x5ed9('0x0'));var _=require(_0x5ed9('0x1'));var qs=require(_0x5ed9('0x2'));var logger=require(_0x5ed9('0x3'))(_0x5ed9('0x4'));var shared=require(_0x5ed9('0x5'));var db=require(_0x5ed9('0x6'))['db'];function respondWithResult(_0x3e2272,_0x2a28e9){_0x2a28e9=_0x2a28e9||0xc8;return function(_0x7b84d6){if(_0x7b84d6){return _0x3e2272[_0x5ed9('0x7')](_0x2a28e9)[_0x5ed9('0x8')](_0x7b84d6);}};}function respondWithFilteredResult(_0x52a57d,_0x48efa8){return function(_0x2612a8){if(_0x2612a8){var _0x217c71=typeof _0x48efa8[_0x5ed9('0x9')]===_0x5ed9('0xa')&&typeof _0x48efa8[_0x5ed9('0xb')]===_0x5ed9('0xa');var _0x5b48b1=_0x2612a8['count'];var _0x3cbaf0=_0x217c71?0x0:_0x48efa8[_0x5ed9('0x9')];var _0x46fc84=_0x217c71?_0x2612a8[_0x5ed9('0xc')]:_0x48efa8['offset']+_0x48efa8['limit'];var _0x28e087;if(_0x46fc84>=_0x5b48b1){_0x46fc84=_0x5b48b1;_0x28e087=0xc8;}else{_0x28e087=0xce;}_0x52a57d[_0x5ed9('0x7')](_0x28e087);return _0x52a57d[_0x5ed9('0xd')](_0x5ed9('0xe'),_0x3cbaf0+'-'+_0x46fc84+'/'+_0x5b48b1)['json'](_0x2612a8);}return null;};}function saveUpdates(_0x217a53,_0x110d83){return function(_0x246f80){if(_0x246f80){return _0x246f80['update'](_0x217a53)['then'](function(_0x3de296){return _0x3de296;});}return null;};}function handleEntityNotFound(_0x28587e,_0x5e952c){return function(_0x2cfd87){if(!_0x2cfd87){_0x28587e[_0x5ed9('0xf')](0x194);}return _0x2cfd87;};}function handleError(_0x59bace,_0x57692b){_0x57692b=_0x57692b||0x1f4;return function(_0x1d2d60){logger[_0x5ed9('0x10')](_0x1d2d60['stack']);if(_0x1d2d60[_0x5ed9('0x11')]){delete _0x1d2d60[_0x5ed9('0x11')];}_0x59bace['status'](_0x57692b)[_0x5ed9('0x12')](_0x1d2d60);};}exports[_0x5ed9('0x13')]=function(_0x54a570,_0x49fe37){var _0x5a3ac1={},_0x510ffe={},_0x3f65df={'count':0x0,'rows':[]};var _0x409a26=_[_0x5ed9('0x14')](db[_0x5ed9('0x15')]['rawAttributes'],function(_0x120a60){return{'name':_0x120a60[_0x5ed9('0x16')],'type':_0x120a60['type']['key']};});_0x510ffe['model']=_[_0x5ed9('0x14')](_0x409a26,_0x5ed9('0x11'));_0x510ffe['query']=_[_0x5ed9('0x17')](_0x54a570[_0x5ed9('0x18')]);_0x510ffe[_0x5ed9('0x19')]=_[_0x5ed9('0x1a')](_0x510ffe['model'],_0x510ffe[_0x5ed9('0x18')]);_0x510ffe[_0x5ed9('0x19')]=_[_0x5ed9('0x1b')](_0x510ffe[_0x5ed9('0x19')],[_0x5ed9('0x1c'),_0x5ed9('0x1d'),'$gt','$gte',_0x5ed9('0x1e'),_0x5ed9('0x1f'),_0x5ed9('0x20'),'$eq','$not',_0x5ed9('0x21'),_0x5ed9('0x22'),_0x5ed9('0x23'),'$notIn',_0x5ed9('0x24'),_0x5ed9('0x25'),_0x5ed9('0x26'),'$notILike',_0x5ed9('0x24'),_0x5ed9('0x27'),_0x5ed9('0x28'),_0x5ed9('0x29'),'$any']);_0x5a3ac1['attributes']=_[_0x5ed9('0x1a')](_0x510ffe['model'],qs[_0x5ed9('0x2a')](_0x54a570[_0x5ed9('0x18')][_0x5ed9('0x2a')]));_0x5a3ac1[_0x5ed9('0x2b')]=_0x5a3ac1[_0x5ed9('0x2b')][_0x5ed9('0x2c')]?_0x5a3ac1[_0x5ed9('0x2b')]:_0x510ffe['model'];if(!_0x54a570['query']['hasOwnProperty'](_0x5ed9('0x2d'))){_0x5a3ac1[_0x5ed9('0xb')]=qs[_0x5ed9('0xb')](_0x54a570['query'][_0x5ed9('0xb')]);_0x5a3ac1['offset']=qs[_0x5ed9('0x9')](_0x54a570[_0x5ed9('0x18')][_0x5ed9('0x9')]);}_0x5a3ac1[_0x5ed9('0x2e')]=qs[_0x5ed9('0x2f')](_0x54a570[_0x5ed9('0x18')]['sort']);_0x5a3ac1[_0x5ed9('0x30')]=qs[_0x5ed9('0x19')](_[_0x5ed9('0x31')](_0x54a570['query'],_0x510ffe['filters']),_0x409a26);if(_0x54a570[_0x5ed9('0x18')][_0x5ed9('0x32')]){_0x5a3ac1['where']=_['merge'](_0x5a3ac1[_0x5ed9('0x30')],{'$or':_[_0x5ed9('0x14')](_0x409a26,function(_0x13cac8){if(_0x13cac8[_0x5ed9('0x33')]!==_0x5ed9('0x34')){var _0x355899={};_0x355899[_0x13cac8[_0x5ed9('0x11')]]={'$like':'%'+_0x54a570[_0x5ed9('0x18')]['filter']+'%'};return _0x355899;}})});}_0x5a3ac1=_['merge']({},_0x5a3ac1,_0x54a570['options']);var _0x4699a0={'where':_0x5a3ac1[_0x5ed9('0x30')]};return db['CmHopper'][_0x5ed9('0xc')](_0x4699a0)[_0x5ed9('0x35')](function(_0x4407d2){_0x3f65df[_0x5ed9('0xc')]=_0x4407d2;if(_0x54a570['query'][_0x5ed9('0x36')]){_0x5a3ac1[_0x5ed9('0x37')]=[{'all':!![]}];}return db[_0x5ed9('0x15')][_0x5ed9('0x38')](_0x5a3ac1);})[_0x5ed9('0x35')](function(_0x5d01fe){_0x3f65df[_0x5ed9('0x39')]=_0x5d01fe;return _0x3f65df;})[_0x5ed9('0x35')](respondWithFilteredResult(_0x49fe37,_0x5a3ac1))['catch'](handleError(_0x49fe37,null));};exports['show']=function(_0x1ac6b7,_0x52c7ca){var _0x4fedbe={'raw':!![],'where':{'id':_0x1ac6b7[_0x5ed9('0x3a')]['id']}},_0x5a9287={};_0x5a9287[_0x5ed9('0x3b')]=_['keys'](db['CmHopper'][_0x5ed9('0x3c')]);_0x5a9287[_0x5ed9('0x18')]=_[_0x5ed9('0x17')](_0x1ac6b7[_0x5ed9('0x18')]);_0x5a9287[_0x5ed9('0x19')]=_[_0x5ed9('0x1a')](_0x5a9287[_0x5ed9('0x3b')],_0x5a9287[_0x5ed9('0x18')]);_0x4fedbe[_0x5ed9('0x2b')]=_[_0x5ed9('0x1a')](_0x5a9287[_0x5ed9('0x3b')],qs[_0x5ed9('0x2a')](_0x1ac6b7[_0x5ed9('0x18')][_0x5ed9('0x2a')]));_0x4fedbe['attributes']=_0x4fedbe[_0x5ed9('0x2b')][_0x5ed9('0x2c')]?_0x4fedbe[_0x5ed9('0x2b')]:_0x5a9287[_0x5ed9('0x3b')];if(_0x1ac6b7[_0x5ed9('0x18')]['includeAll']){_0x4fedbe[_0x5ed9('0x37')]=[{'all':!![]}];}_0x4fedbe=_['merge']({},_0x4fedbe,_0x1ac6b7[_0x5ed9('0x3d')]);return db[_0x5ed9('0x15')][_0x5ed9('0x3e')](_0x4fedbe)[_0x5ed9('0x35')](handleEntityNotFound(_0x52c7ca,null))[_0x5ed9('0x35')](respondWithResult(_0x52c7ca,null))[_0x5ed9('0x3f')](handleError(_0x52c7ca,null));};exports[_0x5ed9('0x40')]=function(_0x53c64f,_0x5e717b){return db[_0x5ed9('0x15')][_0x5ed9('0x40')](_0x53c64f['body'],{})[_0x5ed9('0x35')](respondWithResult(_0x5e717b,0xc9))[_0x5ed9('0x3f')](handleError(_0x5e717b,null));};exports['update']=function(_0x53a601,_0x23ea4b){if(_0x53a601[_0x5ed9('0x41')]['id']){delete _0x53a601['body']['id'];}return db[_0x5ed9('0x15')][_0x5ed9('0x3e')]({'where':{'id':_0x53a601[_0x5ed9('0x3a')]['id']}})[_0x5ed9('0x35')](handleEntityNotFound(_0x23ea4b,null))[_0x5ed9('0x35')](saveUpdates(_0x53a601[_0x5ed9('0x41')],null))[_0x5ed9('0x35')](respondWithResult(_0x23ea4b,null))[_0x5ed9('0x3f')](handleError(_0x23ea4b,null));};exports[_0x5ed9('0x42')]=function(_0x2620f0,_0x4422dd){return db[_0x5ed9('0x15')][_0x5ed9('0x42')]()['then'](respondWithResult(_0x4422dd,null))[_0x5ed9('0x3f')](handleError(_0x4422dd,null));};exports[_0x5ed9('0x43')]=function(_0x134b29,_0x5e6515){var _0xb50921;var _0x4e65ed=_0x134b29[_0x5ed9('0x3a')]['id'];return db[_0x5ed9('0x15')][_0x5ed9('0x3e')]({'where':{'id':_0x134b29[_0x5ed9('0x3a')]['id']}})[_0x5ed9('0x35')](handleEntityNotFound(_0x5e6515,null))[_0x5ed9('0x35')](function(_0x17c434){if(_0x17c434){return _0x17c434[_0x5ed9('0x43')]()[_0x5ed9('0x35')](function(_0x2ec8c2){return _0x2ec8c2;});}})[_0x5ed9('0x35')](function(_0x345bff){_0xb50921=_0x345bff;if(_0x345bff){if(_0x345bff['VoiceQueueId']||_0x345bff[_0x5ed9('0x44')]){return db[_0x345bff[_0x5ed9('0x45')]?_0x5ed9('0x46'):_0x5ed9('0x47')][_0x5ed9('0x3e')]({'where':{'id':_0x345bff['VoiceQueueId']?_0x345bff['VoiceQueueId']:_0x345bff['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x44a1ee){var _0x1bb8b8={};if(_0x44a1ee){_[_0x5ed9('0x48')](_0x1bb8b8,_[_0x5ed9('0x49')](_0xb50921[_0x5ed9('0x4a')],[_0x5ed9('0x4b'),_0x5ed9('0x4c'),'id']));_0x1bb8b8[_0x5ed9('0x4d')]=0x15;_0x1bb8b8[_0x5ed9('0x4e')]=_0x5ed9('0x4f');_0x1bb8b8[_0x5ed9('0x50')]=_0x44a1ee[_0x5ed9('0x11')];_0x1bb8b8[_0x5ed9('0x51')]=_0x134b29[_0x5ed9('0x52')]['name'];_0x1bb8b8[_0x5ed9('0x53')]=_0x134b29[_0x5ed9('0x52')]['id'];_0x1bb8b8[_0x5ed9('0x4f')]=!![];_0x1bb8b8[_0x5ed9('0x54')]=moment()[_0x5ed9('0x55')](_0x5ed9('0x56'));_0x1bb8b8['calleridnum']=_0xb50921[_0x5ed9('0x57')];_0x1bb8b8['campaigntype']=_0xb50921['VoiceQueueId']?_0x5ed9('0x58'):'ivr';return db[_0x5ed9('0x59')][_0x5ed9('0x3e')]({'where':{'id':_0x1bb8b8['ContactId']},'attributes':[_0x5ed9('0x5a'),_0x5ed9('0x5b')]})[_0x5ed9('0x35')](function(_0x1c0321){if(!_['isNil'](_0x5e6515)&&!_['isNil'](_0x1c0321['firstName'])){_0x1bb8b8[_0x5ed9('0x5c')]=_0x1c0321[_0x5ed9('0x5a')];if(!_['isNil'](_0x1c0321[_0x5ed9('0x5b')])){_0x1bb8b8[_0x5ed9('0x5c')]+='\x20'+_0x1c0321['lastName'];}}})[_0x5ed9('0x5d')](function(){return db[_0x5ed9('0x5e')]['create'](_0x1bb8b8);});}})[_0x5ed9('0x35')](function(_0x3ce6ab){return db[_0x5ed9('0x5f')]['destroy']({'where':{'CmHopperId':_0x4e65ed}});})[_0x5ed9('0x35')](function(){return _0x5e6515[_0x5ed9('0x7')](0xcc)[_0x5ed9('0x60')]();})[_0x5ed9('0x3f')](handleError(_0x5e6515,null));};exports[_0x5ed9('0x61')]=function(_0x10340f,_0x21be65){var _0xe72d99=[];return db['CmContact'][_0x5ed9('0x42')]()[_0x5ed9('0x35')](function(_0x2b36d){_0xe72d99=_[_0x5ed9('0x17')](_0x2b36d);return _0x10340f[_0x5ed9('0x52')][_0x5ed9('0x62')]({'where':{'type':_0x5ed9('0x63'),'dialActive':!![],'dialMethod':_0x5ed9('0x64')},'attributes':['id',_0x5ed9('0x65'),_0x5ed9('0x66')],'raw':!![]});})[_0x5ed9('0x35')](function(_0x3b6d17){if(_0x3b6d17&&_0x3b6d17[_0x5ed9('0x2c')]){return db[_0x5ed9('0x67')][_0x5ed9('0x68')](function(_0x3d51b6){var _0x4b08b1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5ed9('0x55')](_0x5ed9('0x56'))},'VoiceQueueId':{'$in':_['map'](_0x3b6d17,'id')},'$or':[{'UserId':null},{'UserId':_0x10340f[_0x5ed9('0x52')]['id']}]};var _0x97ab7e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3b6d17)[_0x5ed9('0x32')]([_0x5ed9('0x66'),0x0])[_0x5ed9('0x14')]('id')[_0x5ed9('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x10340f[_0x5ed9('0x52')]['id']}]};var _0xe56a17={'$or':[_0x4b08b1,_0x97ab7e]};var _0x54b343=[];if(_0x10340f[_0x5ed9('0x41')]['direction']&&_0x10340f['body'][_0x5ed9('0x6a')]===_0x5ed9('0x6b')){if(!_[_0x5ed9('0x6c')](_0x10340f['body'][_0x5ed9('0x6d')])){_0xe56a17['id']={'$in':_0x10340f[_0x5ed9('0x41')][_0x5ed9('0x6d')]};}_0x54b343=[[_0x5ed9('0x6e'),_0x5ed9('0x6f')],[_0x5ed9('0x70'),_0x3b6d17[0x0][_0x5ed9('0x65')]==='ASC'?'DESC':'ASC'],db[_0x5ed9('0x67')][_0x5ed9('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x5ed9('0x72')]];}else{if(!_[_0x5ed9('0x6c')](_0x10340f[_0x5ed9('0x41')][_0x5ed9('0x6d')])){_0xe56a17['id']={'$notIn':_0x10340f[_0x5ed9('0x41')][_0x5ed9('0x6d')]};}_0x54b343=[[_0x5ed9('0x6e'),_0x5ed9('0x72')],[_0x5ed9('0x70'),_0x3b6d17[0x0][_0x5ed9('0x65')]],db['sequelize'][_0x5ed9('0x71')](_0x5ed9('0x73')),['id',_0x5ed9('0x6f')]];}return db[_0x5ed9('0x15')][_0x5ed9('0x74')]({'attributes':['id',_0x5ed9('0x75'),_0x5ed9('0x57'),_0x5ed9('0x76')],'where':_0xe56a17,'order':_0x54b343,'transaction':_0x3d51b6,'lock':_0x3d51b6[_0x5ed9('0x77')][_0x5ed9('0x78')],'include':[{'model':db[_0x5ed9('0x59')],'as':_0x5ed9('0x79'),'attributes':_0xe72d99,'include':[{'model':db[_0x5ed9('0x7a')],'as':'Company','attributes':['id',_0x5ed9('0x11')]}]},{'model':db['CmList'],'as':_0x5ed9('0x7b'),'attributes':['id',_0x5ed9('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x5ed9('0x7c')]}]})[_0x5ed9('0x35')](function(_0x13560f){if(_0x13560f){return _0x13560f[_0x5ed9('0x7d')]({'UserId':_0x10340f[_0x5ed9('0x52')]['id']},{'transaction':_0x3d51b6});}});});}})['then'](handleEntityNotFound(_0x21be65,null))['then'](respondWithResult(_0x21be65,null))[_0x5ed9('0x3f')](handleError(_0x21be65,null));};exports[_0x5ed9('0x7e')]=function(_0x2aaa14,_0x64f4b7,_0x55821c){var _0x5bf1c0=[];var _0xbe0e06=_0x2aaa14['params']['id'];var _0x5f46f4=_0x2aaa14[_0x5ed9('0x52')]['id'];return db[_0x5ed9('0x59')][_0x5ed9('0x42')]()['then'](function(_0x24487f){_0x5bf1c0=_[_0x5ed9('0x17')](_0x24487f);return db['sequelize'][_0x5ed9('0x68')](function(_0x18e7a1){const _0x34362c={'id':_0xbe0e06};return db[_0x5ed9('0x15')]['findOne']({'attributes':['id',_0x5ed9('0x75'),'recallme'],'where':_0x34362c,'transaction':_0x18e7a1,'lock':_0x18e7a1[_0x5ed9('0x77')][_0x5ed9('0x78')],'include':[{'model':db[_0x5ed9('0x59')],'as':_0x5ed9('0x79'),'attributes':_0x5bf1c0,'include':[{'model':db[_0x5ed9('0x7a')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x5ed9('0x11')]},{'model':db[_0x5ed9('0x46')],'as':_0x5ed9('0x7f'),'attributes':['id',_0x5ed9('0x11'),'dialActive']}]})[_0x5ed9('0x35')](function(_0x45cf95){if(_0x45cf95){return _0x45cf95['update']({'UserId':_0x5f46f4},{'transaction':_0x18e7a1});}});});})[_0x5ed9('0x35')](handleEntityNotFound(_0x64f4b7,null))[_0x5ed9('0x35')](respondWithResult(_0x64f4b7,null))[_0x5ed9('0x3f')](handleError(_0x64f4b7,null));};exports[_0x5ed9('0x80')]=function(_0x20a579,_0x533866){return _0x20a579[_0x5ed9('0x52')][_0x5ed9('0x62')]({'where':{'type':_0x5ed9('0x63'),'dialActive':!![],'dialMethod':_0x5ed9('0x64')},'attributes':['id'],'raw':!![]})[_0x5ed9('0x35')](function(_0x24d9fe){if(_0x24d9fe&&_0x24d9fe[_0x5ed9('0x2c')]){return db['CmHopper'][_0x5ed9('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5ed9('0x55')](_0x5ed9('0x56'))},'VoiceQueueId':{'$in':_[_0x5ed9('0x14')](_0x24d9fe,'id')},'$or':[{'UserId':null},{'UserId':_0x20a579[_0x5ed9('0x52')]['id']}]}});}return 0x0;})[_0x5ed9('0x35')](function(_0x565405){if(!_[_0x5ed9('0x81')](_0x565405)&&_[_0x5ed9('0x82')](_0x565405)){return _0x533866[_0x5ed9('0x7')](0xc8)[_0x5ed9('0x8')]({'contacts':_0x565405});}else{logger['error'](_0x5ed9('0x83'),'getOpenContacts',0x194,_0x5ed9('0x84'));_0x533866[_0x5ed9('0xf')](0x194);}})[_0x5ed9('0x3f')](handleError(_0x533866,null));};exports[_0x5ed9('0x85')]=function(_0x3b474e,_0x5db252){var _0x37b98a=shared[_0x5ed9('0x86')];var _0x682d7c=[];_[_0x5ed9('0x14')](_0x37b98a,function(_0x50d590){_0x682d7c[_0x5ed9('0x87')]({'id':_0x50d590[_0x5ed9('0x11')],'name':_0x50d590[_0x5ed9('0x11')],'utcOffset':_0x50d590['utcOffset']});});return _0x5db252[_0x5ed9('0x7')](0xc8)[_0x5ed9('0x8')]({'tz':_0x682d7c});};exports['getTimezone']=function(_0x1ea31e,_0x2d8868){var _0x2164f1=shared['timezones'];var _0x1bbb1a={};if(!_[_0x5ed9('0x81')](_0x2164f1[_0x1ea31e[_0x5ed9('0x41')]['id']]))_0x1bbb1a=_0x2164f1[_0x1ea31e[_0x5ed9('0x41')]['id']];return _0x2d8868[_0x5ed9('0x7')](0xc8)[_0x5ed9('0x8')](_0x1bbb1a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8dc7916..8aa4fa8 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 _0x71ab=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71ab,0x64));var _0xb71a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x71ab[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xc')]},{'name':_0xb71a('0xd'),'fields':[_0xb71a('0xd')]},{'name':_0xb71a('0xe'),'fields':[_0xb71a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x208c6f,_0x3530d8){_0x208c6f=_0x208c6f-0x0;var _0x455074=_0xc6ac[_0x208c6f];return _0x455074;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 26e3f12..7be5948 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 _0xa239=['body','raw','UpdateCmHopper','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','keys','name','update','includes','push','GetContactDialer','length','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','UserId','all','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','\x20MINUTE','literal','NOW()','User','Agent','voicePause','List','CmHopperHandlePreviewRecallNotifications','lodash','util','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','then','info','debug','stringify','message','ShowCmHopper','find','catch','error','CreateCmHopper'];(function(_0x4e844d,_0xa8a218){var _0x1d5948=function(_0x32c0be){while(--_0x32c0be){_0x4e844d['push'](_0x4e844d['shift']());}};_0x1d5948(++_0xa8a218);}(_0xa239,0x7d));var _0x9a23=function(_0x15dc36,_0x1b3308){_0x15dc36=_0x15dc36-0x0;var _0xa0e85b=_0xa239[_0x15dc36];return _0xa0e85b;};'use strict';var _=require(_0x9a23('0x0'));var util=require(_0x9a23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x9a23('0x2'));exports[_0x9a23('0x3')]=function(_0x577b46){var _0x114b3c=this;return new Promise(function(_0x1e9b25,_0x43ac06){return db[_0x9a23('0x4')][_0x9a23('0x5')]({'raw':_0x577b46[_0x9a23('0x6')]?_0x577b46[_0x9a23('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x577b46[_0x9a23('0x6')]?_0x577b46['options'][_0x9a23('0x7')]||null:null,'attributes':_0x577b46[_0x9a23('0x6')]?_0x577b46['options'][_0x9a23('0x8')]||null:null,'limit':_0x577b46[_0x9a23('0x6')]?_0x577b46['options'][_0x9a23('0x9')]||null:null,'include':_0x577b46['options']?_0x577b46[_0x9a23('0x6')][_0x9a23('0xa')]?_[_0x9a23('0xb')](_0x577b46['options'][_0x9a23('0xa')],function(_0x11e93f){return{'model':db[_0x11e93f[_0x9a23('0xc')]],'as':_0x11e93f['as'],'attributes':_0x11e93f['attributes'],'include':_0x11e93f[_0x9a23('0xa')]?_[_0x9a23('0xb')](_0x11e93f['include'],function(_0x52aa28){return{'model':db[_0x52aa28[_0x9a23('0xc')]],'as':_0x52aa28['as'],'attributes':_0x52aa28[_0x9a23('0x8')],'include':_0x52aa28[_0x9a23('0xa')]?_[_0x9a23('0xb')](_0x52aa28[_0x9a23('0xa')],function(_0x2eb614){return{'model':db[_0x2eb614[_0x9a23('0xc')]],'as':_0x2eb614['as'],'attributes':_0x2eb614[_0x9a23('0x8')]};}):[]};}):[]};}):[]:[]})[_0x9a23('0xd')](function(_0x4bcb2a){logger[_0x9a23('0xe')]('GetCmHopper',_0x577b46);logger[_0x9a23('0xf')](_0x9a23('0x3'),_0x577b46,JSON[_0x9a23('0x10')](_0x4bcb2a));_0x1e9b25(_0x4bcb2a);})['catch'](function(_0x37d341){logger['error'](_0x9a23('0x3'),_0x37d341[_0x9a23('0x11')],_0x577b46);_0x43ac06(_0x114b3c['error'](0x1f4,_0x37d341['message']));});});};exports[_0x9a23('0x12')]=function(_0x41abcb){var _0x214266=this;return new Promise(function(_0x37d27d,_0xf8d4b4){return db[_0x9a23('0x4')][_0x9a23('0x13')]({'raw':_0x41abcb['options']?_0x41abcb[_0x9a23('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x41abcb[_0x9a23('0x6')]?_0x41abcb[_0x9a23('0x6')][_0x9a23('0x7')]||null:null,'attributes':_0x41abcb['options']?_0x41abcb['options'][_0x9a23('0x8')]||null:null,'include':_0x41abcb[_0x9a23('0x6')]?_0x41abcb[_0x9a23('0x6')]['include']?_[_0x9a23('0xb')](_0x41abcb[_0x9a23('0x6')]['include'],function(_0x31f7d6){return{'model':db[_0x31f7d6[_0x9a23('0xc')]],'as':_0x31f7d6['as'],'attributes':_0x31f7d6[_0x9a23('0x8')],'include':_0x31f7d6[_0x9a23('0xa')]?_['map'](_0x31f7d6[_0x9a23('0xa')],function(_0x197d45){return{'model':db[_0x197d45[_0x9a23('0xc')]],'as':_0x197d45['as'],'attributes':_0x197d45[_0x9a23('0x8')],'include':_0x197d45['include']?_[_0x9a23('0xb')](_0x197d45['include'],function(_0x5bcd32){return{'model':db[_0x5bcd32[_0x9a23('0xc')]],'as':_0x5bcd32['as'],'attributes':_0x5bcd32['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a23('0xd')](function(_0x293524){logger['info'](_0x9a23('0x12'),_0x41abcb);logger[_0x9a23('0xf')](_0x9a23('0x12'),_0x41abcb,JSON['stringify'](_0x293524));_0x37d27d(_0x293524);})[_0x9a23('0x14')](function(_0x5f5968){logger['error'](_0x9a23('0x12'),_0x5f5968[_0x9a23('0x11')],_0x41abcb);_0xf8d4b4(_0x214266[_0x9a23('0x15')](0x1f4,_0x5f5968[_0x9a23('0x11')]));});});};exports[_0x9a23('0x16')]=function(_0xde0c8d){var _0x27b9ac=this;return new Promise(function(_0x56e47b,_0x3c71a7){return db['CmHopper']['create'](_0xde0c8d[_0x9a23('0x17')],{'raw':_0xde0c8d['options']?_0xde0c8d['options'][_0x9a23('0x18')]===undefined?!![]:![]:!![]})[_0x9a23('0xd')](function(_0x4d53c3){logger[_0x9a23('0xe')](_0x9a23('0x16'),_0xde0c8d);logger['debug'](_0x9a23('0x16'),_0xde0c8d,JSON[_0x9a23('0x10')](_0x4d53c3));_0x56e47b(_0x4d53c3);})[_0x9a23('0x14')](function(_0x4582ae){logger[_0x9a23('0x15')](_0x9a23('0x16'),_0x4582ae[_0x9a23('0x11')],_0xde0c8d);_0x3c71a7(_0x27b9ac[_0x9a23('0x15')](0x1f4,_0x4582ae['message']));});});};exports['UpdateCmHopper']=function(_0x2ab6e7){var _0x11ac65=this;return new Promise(function(_0x72f2a9,_0x1d1016){return db[_0x9a23('0x4')]['update'](_0x2ab6e7[_0x9a23('0x17')],{'raw':_0x2ab6e7[_0x9a23('0x6')]?_0x2ab6e7['options'][_0x9a23('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab6e7[_0x9a23('0x6')]?_0x2ab6e7['options']['where']||null:null,'attributes':_0x2ab6e7[_0x9a23('0x6')]?_0x2ab6e7['options'][_0x9a23('0x8')]||null:null,'limit':_0x2ab6e7[_0x9a23('0x6')]?_0x2ab6e7[_0x9a23('0x6')][_0x9a23('0x9')]||null:null})[_0x9a23('0xd')](function(_0x3b6826){logger[_0x9a23('0xe')](_0x9a23('0x19'),_0x2ab6e7);logger[_0x9a23('0xe')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x2ab6e7[_0x9a23('0x6')][_0x9a23('0x7')]),_0x2ab6e7[_0x9a23('0x17')][_0x9a23('0x1a')]);logger['debug']('UpdateCmHopper',_0x2ab6e7,JSON[_0x9a23('0x10')](_0x3b6826));_0x72f2a9(_0x3b6826);})[_0x9a23('0x14')](function(_0x2d687d){logger[_0x9a23('0x15')](_0x9a23('0x19'),_0x2d687d[_0x9a23('0x11')],_0x2ab6e7);_0x1d1016(_0x11ac65['error'](0x1f4,_0x2d687d[_0x9a23('0x11')]));});});};exports[_0x9a23('0x1b')]=function(_0x32fa0d){var _0x52045d=this;return new Promise(function(_0x544c82,_0x18100a){return db[_0x9a23('0x4')][_0x9a23('0x1c')]({'where':_0x32fa0d[_0x9a23('0x6')]?_0x32fa0d[_0x9a23('0x6')]['where']||null:null})[_0x9a23('0xd')](function(_0x5345d8){logger[_0x9a23('0xe')](_0x9a23('0x1b'),_0x32fa0d);logger['debug']('DestroyCmHopper',_0x32fa0d,JSON[_0x9a23('0x10')](_0x5345d8));_0x544c82(_0x5345d8);})[_0x9a23('0x14')](function(_0x315b06){logger['error'](_0x9a23('0x1b'),_0x315b06[_0x9a23('0x11')],_0x32fa0d);_0x18100a(_0x52045d['error'](0x1f4,_0x315b06['message']));});});};exports['GetContactDialer']=function(_0x269a5d){var _0x13c02b=this;return new Promise(function(_0x3dbd41,_0x3b5a67){return db[_0x9a23('0x1d')][_0x9a23('0x1e')]()[_0x9a23('0xd')](function(_0xf7b17e){return db[_0x9a23('0x1f')][_0x9a23('0x20')](function(_0x300f2c){return db['CmHopper'][_0x9a23('0x5')]({'where':_0x269a5d[_0x9a23('0x6')]?_0x269a5d[_0x9a23('0x6')]['where']||null:null,'attributes':_0x269a5d[_0x9a23('0x6')]?_0x269a5d[_0x9a23('0x6')][_0x9a23('0x8')]||null:null,'limit':_0x269a5d[_0x9a23('0x6')]?_0x269a5d[_0x9a23('0x6')][_0x9a23('0x9')]||null:null,'order':_0x269a5d['options']?_0x269a5d[_0x9a23('0x6')][_0x9a23('0x21')]||null:null,'transaction':_0x300f2c,'lock':_0x300f2c[_0x9a23('0x22')][_0x9a23('0x23')],'include':[{'model':db[_0x9a23('0x1d')],'as':'Contact','attributes':_[_0x9a23('0x24')](_0xf7b17e)},{'model':db['User'],'as':'Agent','attributes':['id',_0x9a23('0x25'),'voicePause']}]})[_0x9a23('0xd')](function(_0xbad25){var _0x13e749=[];var _0x1707e8=[];for(var _0x333c5f=0x0;_0x333c5f<_0xbad25['length'];_0x333c5f+=0x1){var _0x3f64fb=_0xbad25[_0x333c5f]['UserId'];if(_0x3f64fb===null){_0x13e749['push'](_0xbad25[_0x333c5f][_0x9a23('0x26')](_0x269a5d[_0x9a23('0x17')],{'transaction':_0x300f2c}));}else if(!_0x1707e8[_0x9a23('0x27')](_0x3f64fb)){_0x1707e8[_0x9a23('0x28')](_0x3f64fb);_0x13e749[_0x9a23('0x28')](_0xbad25[_0x333c5f]['update'](_0x269a5d[_0x9a23('0x17')],{'transaction':_0x300f2c}));}}return BPromise['all'](_0x13e749);});})[_0x9a23('0xd')](function(_0x233a47){logger[_0x9a23('0xe')](_0x9a23('0x29'),_0x269a5d);if(_0x233a47[_0x9a23('0x2a')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x233a47[0x0][_0x9a23('0x2b')]['id'],_0x233a47[0x0]['dataValues'][_0x9a23('0x2c')],_0x233a47[0x0][_0x9a23('0x2b')][_0x9a23('0x1a')]);}logger['debug'](_0x9a23('0x29'),_0x269a5d,JSON['stringify'](_0x233a47));_0x3dbd41(_0x233a47);})['catch'](function(_0x58dbd2){logger[_0x9a23('0x15')](_0x9a23('0x29'),_0x58dbd2[_0x9a23('0x11')],_0x269a5d);_0x3b5a67(_0x13c02b[_0x9a23('0x15')](0x1f4,_0x58dbd2[_0x9a23('0x11')]));});});});};exports[_0x9a23('0x2d')]=function(_0x448178){var _0x3da300=this;return new Promise(function(_0x965098,_0x9078e1){return db[_0x9a23('0x1f')][_0x9a23('0x20')](function(_0xc106b3){return db[_0x9a23('0x2e')]['create'](_0x448178[_0x9a23('0x17')],{'raw':_0x448178[_0x9a23('0x6')]?_0x448178[_0x9a23('0x6')][_0x9a23('0x18')]===undefined?!![]:![]:!![],'transaction':_0xc106b3})[_0x9a23('0xd')](function(){logger['info'](_0x9a23('0x2f'),JSON[_0x9a23('0x10')](_0x448178[_0x9a23('0x6')][_0x9a23('0x7')]),_0x448178['options'][_0x9a23('0x7')][_0x9a23('0x1a')]);return db[_0x9a23('0x4')][_0x9a23('0x1c')]({'where':_0x448178[_0x9a23('0x6')]?_0x448178['options']['where']||null:null,'transaction':_0xc106b3});});})[_0x9a23('0xd')](function(_0x7f632f){logger[_0x9a23('0xe')](_0x9a23('0x2d'),_0x448178);logger[_0x9a23('0xf')](_0x9a23('0x2d'),_0x448178,JSON[_0x9a23('0x10')](_0x7f632f));_0x965098(_0x7f632f);})['catch'](function(_0xa0e4c1){logger[_0x9a23('0x15')]('MoveContactManagedDialer',_0xa0e4c1['message'],_0x448178);_0x9078e1(_0x3da300[_0x9a23('0x15')](0x1f4,_0xa0e4c1[_0x9a23('0x11')]));});});};exports['CountReScheduled']=function(_0x222931){var _0x1fec0c=this;return new Promise(function(_0x478e86,_0x307d95){return db['CmHopper']['findAll']({'raw':_0x222931[_0x9a23('0x6')]?_0x222931[_0x9a23('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x222931[_0x9a23('0x6')]?_0x222931[_0x9a23('0x6')]['where']||null:null,'attributes':[[db[_0x9a23('0x1f')]['fn'](_0x9a23('0x30'),db[_0x9a23('0x1f')]['fn']('IF',db[_0x9a23('0x1f')]['literal'](_0x9a23('0x31')+util[_0x9a23('0x32')](_0x9a23('0x33'),moment()[_0x9a23('0x32')](_0x9a23('0x34')))+_0x9a23('0x35')))),'contactsRescheduled']]})['then'](function(_0x5d47dc){logger[_0x9a23('0xe')](_0x9a23('0x36'),_0x222931);logger[_0x9a23('0xf')](_0x9a23('0x36'),_0x222931,JSON[_0x9a23('0x10')](_0x5d47dc));_0x478e86(_0x5d47dc);})[_0x9a23('0x14')](function(_0x631124){logger['error'](_0x9a23('0x36'),_0x631124[_0x9a23('0x11')],_0x222931);_0x307d95(_0x1fec0c[_0x9a23('0x15')](0x1f4,_0x631124['message']));});});};exports['GetContactRecallMe']=function(_0x161755){var _0x2751e2=this;return new Promise(function(_0x2138cc,_0x175851){return db[_0x9a23('0x1d')][_0x9a23('0x1e')]()[_0x9a23('0xd')](function(){return db[_0x9a23('0x1f')][_0x9a23('0x20')](function(_0xc3766b){return db['CmHopper'][_0x9a23('0x5')]({'where':_0x161755[_0x9a23('0x6')]?_0x161755[_0x9a23('0x6')][_0x9a23('0x7')]||null:null,'attributes':_0x161755[_0x9a23('0x6')]?_0x161755[_0x9a23('0x6')][_0x9a23('0x8')]||null:null,'limit':0x1,'order':_0x161755[_0x9a23('0x6')]?_0x161755[_0x9a23('0x6')][_0x9a23('0x21')]||null:null,'group':db[_0x9a23('0x4')][_0x9a23('0x37')],'transaction':_0xc3766b,'lock':_0xc3766b[_0x9a23('0x22')][_0x9a23('0x23')],'include':_0x161755['options']?_0x161755[_0x9a23('0x6')][_0x9a23('0xa')]?_[_0x9a23('0xb')](_0x161755['options'][_0x9a23('0xa')],function(_0x3a7494){return{'model':db[_0x3a7494[_0x9a23('0xc')]],'as':_0x3a7494['as'],'attributes':_0x3a7494[_0x9a23('0x8')],'include':_0x3a7494[_0x9a23('0xa')]?_['map'](_0x3a7494[_0x9a23('0xa')],function(_0x47b02e){return{'model':db[_0x47b02e[_0x9a23('0xc')]],'as':_0x47b02e['as'],'attributes':_0x47b02e[_0x9a23('0x8')],'include':_0x47b02e['include']?_[_0x9a23('0xb')](_0x47b02e[_0x9a23('0xa')],function(_0x2e6a4f){return{'model':db[_0x2e6a4f[_0x9a23('0xc')]],'as':_0x2e6a4f['as'],'attributes':_0x2e6a4f[_0x9a23('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6f9f24){var _0xaf3e63=[];for(var _0x2f152c=0x0;_0x2f152c<_0x6f9f24['length'];_0x2f152c+=0x1){_0xaf3e63[_0x9a23('0x28')](_0x6f9f24[_0x2f152c][_0x9a23('0x26')](_0x161755[_0x9a23('0x17')],{'transaction':_0xc3766b}));}return BPromise[_0x9a23('0x38')](_0xaf3e63);});})['then'](function(_0x49cb92){logger[_0x9a23('0xe')](_0x9a23('0x39'),_0x161755);logger[_0x9a23('0xf')](_0x9a23('0x39'),_0x161755,JSON[_0x9a23('0x10')](_0x49cb92));_0x2138cc(_0x49cb92);})[_0x9a23('0x14')](function(_0x2638b6){logger[_0x9a23('0x15')](_0x9a23('0x39'),_0x2638b6[_0x9a23('0x11')],_0x161755);_0x175851(_0x2751e2[_0x9a23('0x15')](0x1f4,_0x2638b6['message']));});});});};exports[_0x9a23('0x3a')]=function(_0x41acbf){var _0x3aee91=this;return new Promise(function(_0x156447,_0x28d391){db['CmContact'][_0x9a23('0x1e')]()[_0x9a23('0xd')](function(_0x4da363){return db[_0x9a23('0x4')][_0x9a23('0x5')]({'raw':_0x41acbf[_0x9a23('0x6')]?_0x41acbf['options'][_0x9a23('0x18')]===undefined?!![]:![]:!![],'where':_0x41acbf[_0x9a23('0x6')]?_0x41acbf[_0x9a23('0x6')]['where']||null:null,'attributes':_0x41acbf['options']?_0x41acbf[_0x9a23('0x6')][_0x9a23('0x8')]||null:null,'limit':_0x41acbf[_0x9a23('0x6')]?_0x41acbf['options'][_0x9a23('0x9')]||null:null,'include':_0x41acbf[_0x9a23('0x6')]?_0x41acbf['options'][_0x9a23('0xa')]?_[_0x9a23('0xb')](_0x41acbf[_0x9a23('0x6')][_0x9a23('0xa')],function(_0x5ace10){return{'model':db[_0x5ace10[_0x9a23('0xc')]],'as':_0x5ace10['as'],'attributes':_0x5ace10['as']==='Contact'?_['keys'](_0x4da363):_0x5ace10[_0x9a23('0x8')],'include':_0x5ace10['include']?_['map'](_0x5ace10[_0x9a23('0xa')],function(_0x37d4f4){return{'model':db[_0x37d4f4[_0x9a23('0xc')]],'as':_0x37d4f4['as'],'attributes':_0x37d4f4[_0x9a23('0x8')],'include':_0x37d4f4['include']?_[_0x9a23('0xb')](_0x37d4f4[_0x9a23('0xa')],function(_0x2c3894){return{'model':db[_0x2c3894[_0x9a23('0xc')]],'as':_0x2c3894['as'],'attributes':_0x2c3894[_0x9a23('0x8')]};}):[]};}):[]};}):[]:[]})[_0x9a23('0xd')](function(_0x7367d2){logger['info'](_0x9a23('0x3'),_0x41acbf);logger[_0x9a23('0xf')](_0x9a23('0x3'),_0x41acbf,JSON[_0x9a23('0x10')](_0x7367d2));_0x156447(_0x7367d2);})[_0x9a23('0x14')](function(_0x283db1){logger['error'](_0x9a23('0x3'),_0x283db1[_0x9a23('0x11')],_0x41acbf);_0x28d391(_0x3aee91[_0x9a23('0x15')](0x1f4,_0x283db1[_0x9a23('0x11')]));});});});};exports[_0x9a23('0x3b')]=function(_0xfdffd9){var _0x16caba=this;return new Promise(function(_0x1c1854,_0x3971ad){return db[_0x9a23('0x1d')][_0x9a23('0x3c')]({'raw':!![],'where':{'phone':_0xfdffd9[_0x9a23('0x6')][_0x9a23('0x7')][_0x9a23('0x3d')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x9a23('0xd')](function(_0x5f5dd9){logger[_0x9a23('0xe')](_0x9a23('0x3e'),_0xfdffd9);logger['debug'](_0x9a23('0x3e'),_0xfdffd9,JSON[_0x9a23('0x10')](_0x5f5dd9));_0x1c1854(_0x5f5dd9);})['catch'](function(_0x3663d4){logger[_0x9a23('0x15')](_0x9a23('0x3e'),_0x3663d4['message'],_0xfdffd9);_0x3971ad(_0x16caba[_0x9a23('0x15')](0x1f4,_0x3663d4[_0x9a23('0x11')]));});});};exports[_0x9a23('0x3f')]=function(_0x25c0c7){var _0x8e37e9=this;return new Promise(function(_0x39f166,_0x1022ac){return db[_0x9a23('0x1f')][_0x9a23('0x20')](function(_0xc77642){var _0x555f93=_0x25c0c7[_0x9a23('0x6')]&&_0x25c0c7[_0x9a23('0x6')][_0x9a23('0x7')]?_0x25c0c7['options'][_0x9a23('0x7')]:{};return db['CmHopper'][_0x9a23('0x26')](_0x25c0c7[_0x9a23('0x17')],{'where':_0x555f93,'transaction':_0xc77642})[_0x9a23('0xd')](function(_0x57b049){logger[_0x9a23('0xe')](_0x9a23('0x3f'),_0x25c0c7);logger[_0x9a23('0xf')](_0x9a23('0x3f'),_0x25c0c7,JSON[_0x9a23('0x10')](_0x57b049));_0x39f166(_0x57b049);})['catch'](function(_0x58bf93){logger[_0x9a23('0x15')]('ResetActiveCalls',_0x58bf93[_0x9a23('0x11')],_0x25c0c7);_0x1022ac(_0x8e37e9[_0x9a23('0x15')](0x1f4,_0x58bf93[_0x9a23('0x11')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x3f25da){var _0x5a27ee=this;var _0x4b196c=_0x3f25da[_0x9a23('0x17')][_0x9a23('0x7')][_0x9a23('0x40')];var _0x516eed=_0x3f25da['body']['where'][_0x9a23('0x41')];var _0x923276=_0x3f25da[_0x9a23('0x17')][_0x9a23('0x7')]['availableAgentsIds'];return new Promise(function(_0x50d5c3,_0x573749){return db['CmHopper'][_0x9a23('0x5')]({'where':{'voiceQueueId':{'$in':_0x4b196c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x516eed+_0x9a23('0x42')),'$gt':db[_0x9a23('0x1f')][_0x9a23('0x43')](_0x9a23('0x44'))}},'UserId':{'$in':_0x923276}},'include':[{'model':db[_0x9a23('0x1d')],'as':'Contact'},{'model':db[_0x9a23('0x45')],'as':_0x9a23('0x46'),'attributes':['id',_0x9a23('0x25'),_0x9a23('0x47')]},{'model':db['CmList'],'as':_0x9a23('0x48')}]})['then'](function(_0x289e8a){if(_0x289e8a[_0x9a23('0x2a')]>0x0){return db[_0x9a23('0x1f')][_0x9a23('0x20')](function(_0x5be4ea){return db[_0x9a23('0x4')][_0x9a23('0x26')]({'recallmeNotifiedDate':db[_0x9a23('0x1f')][_0x9a23('0x43')](_0x9a23('0x44'))},{'where':{'id':{'$in':_[_0x9a23('0xb')](_0x289e8a,'id')}},'transaction':_0x5be4ea})[_0x9a23('0xd')](function(){_0x50d5c3(_0x289e8a);})[_0x9a23('0x14')](function(_0x5d5784){logger[_0x9a23('0x15')](_0x9a23('0x49'),_0x5d5784[_0x9a23('0x11')],_0x3f25da);_0x573749(_0x5a27ee['error'](0x1f4,_0x5d5784[_0x9a23('0x11')]));});})[_0x9a23('0x14')](function(_0x53ae20){logger[_0x9a23('0x15')](_0x9a23('0x49'),_0x53ae20['message'],_0x3f25da);_0x573749(_0x5a27ee[_0x9a23('0x15')](0x1f4,_0x53ae20['message']));});}else{_0x50d5c3(_0x289e8a);}});});}; \ No newline at end of file +var _0x1ed7=['update','all','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UPDATE','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','map','model','info','debug','error','message','ShowCmHopper','find','then','catch','CreateCmHopper','create','body','stringify','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','push'];(function(_0x287285,_0xdf8eee){var _0x27b7e5=function(_0x262e4d){while(--_0x262e4d){_0x287285['push'](_0x287285['shift']());}};_0x27b7e5(++_0xdf8eee);}(_0x1ed7,0x6e));var _0x71ed=function(_0xe36a6,_0x46fa90){_0xe36a6=_0xe36a6-0x0;var _0x4b032c=_0x1ed7[_0xe36a6];return _0x4b032c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x71ed('0x0'));var db=require(_0x71ed('0x1'))['db'];var logger=require(_0x71ed('0x2'))(_0x71ed('0x3'));exports[_0x71ed('0x4')]=function(_0x59c737){var _0x1a2bc6=this;return new Promise(function(_0xb88a02,_0x3dd3de){return db[_0x71ed('0x5')]['findAll']({'raw':_0x59c737['options']?_0x59c737[_0x71ed('0x6')][_0x71ed('0x7')]===undefined?!![]:![]:!![],'where':_0x59c737[_0x71ed('0x6')]?_0x59c737[_0x71ed('0x6')][_0x71ed('0x8')]||null:null,'attributes':_0x59c737[_0x71ed('0x6')]?_0x59c737['options'][_0x71ed('0x9')]||null:null,'limit':_0x59c737['options']?_0x59c737[_0x71ed('0x6')][_0x71ed('0xa')]||null:null,'include':_0x59c737[_0x71ed('0x6')]?_0x59c737[_0x71ed('0x6')][_0x71ed('0xb')]?_[_0x71ed('0xc')](_0x59c737[_0x71ed('0x6')][_0x71ed('0xb')],function(_0x43d6dc){return{'model':db[_0x43d6dc['model']],'as':_0x43d6dc['as'],'attributes':_0x43d6dc[_0x71ed('0x9')],'include':_0x43d6dc[_0x71ed('0xb')]?_[_0x71ed('0xc')](_0x43d6dc[_0x71ed('0xb')],function(_0x4ffb57){return{'model':db[_0x4ffb57[_0x71ed('0xd')]],'as':_0x4ffb57['as'],'attributes':_0x4ffb57[_0x71ed('0x9')],'include':_0x4ffb57['include']?_['map'](_0x4ffb57[_0x71ed('0xb')],function(_0xe01160){return{'model':db[_0xe01160[_0x71ed('0xd')]],'as':_0xe01160['as'],'attributes':_0xe01160[_0x71ed('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2473a3){logger[_0x71ed('0xe')]('GetCmHopper',_0x59c737);logger[_0x71ed('0xf')](_0x71ed('0x4'),_0x59c737,JSON['stringify'](_0x2473a3));_0xb88a02(_0x2473a3);})['catch'](function(_0x5e1fd6){logger[_0x71ed('0x10')](_0x71ed('0x4'),_0x5e1fd6['message'],_0x59c737);_0x3dd3de(_0x1a2bc6[_0x71ed('0x10')](0x1f4,_0x5e1fd6[_0x71ed('0x11')]));});});};exports[_0x71ed('0x12')]=function(_0x1f04df){var _0x4e7348=this;return new Promise(function(_0x1992ed,_0x500c40){return db[_0x71ed('0x5')][_0x71ed('0x13')]({'raw':_0x1f04df['options']?_0x1f04df['options'][_0x71ed('0x7')]===undefined?!![]:![]:!![],'where':_0x1f04df[_0x71ed('0x6')]?_0x1f04df[_0x71ed('0x6')]['where']||null:null,'attributes':_0x1f04df[_0x71ed('0x6')]?_0x1f04df['options'][_0x71ed('0x9')]||null:null,'include':_0x1f04df[_0x71ed('0x6')]?_0x1f04df[_0x71ed('0x6')][_0x71ed('0xb')]?_[_0x71ed('0xc')](_0x1f04df[_0x71ed('0x6')]['include'],function(_0x5f53c8){return{'model':db[_0x5f53c8[_0x71ed('0xd')]],'as':_0x5f53c8['as'],'attributes':_0x5f53c8[_0x71ed('0x9')],'include':_0x5f53c8[_0x71ed('0xb')]?_[_0x71ed('0xc')](_0x5f53c8['include'],function(_0x2a72c6){return{'model':db[_0x2a72c6['model']],'as':_0x2a72c6['as'],'attributes':_0x2a72c6[_0x71ed('0x9')],'include':_0x2a72c6['include']?_[_0x71ed('0xc')](_0x2a72c6[_0x71ed('0xb')],function(_0x55476c){return{'model':db[_0x55476c['model']],'as':_0x55476c['as'],'attributes':_0x55476c[_0x71ed('0x9')]};}):[]};}):[]};}):[]:[]})[_0x71ed('0x14')](function(_0x3223d7){logger[_0x71ed('0xe')]('ShowCmHopper',_0x1f04df);logger['debug'](_0x71ed('0x12'),_0x1f04df,JSON['stringify'](_0x3223d7));_0x1992ed(_0x3223d7);})[_0x71ed('0x15')](function(_0x5de4e1){logger[_0x71ed('0x10')](_0x71ed('0x12'),_0x5de4e1[_0x71ed('0x11')],_0x1f04df);_0x500c40(_0x4e7348[_0x71ed('0x10')](0x1f4,_0x5de4e1['message']));});});};exports[_0x71ed('0x16')]=function(_0x4173f3){var _0x522e49=this;return new Promise(function(_0x2fa9f0,_0x1d7ee6){return db[_0x71ed('0x5')][_0x71ed('0x17')](_0x4173f3[_0x71ed('0x18')],{'raw':_0x4173f3[_0x71ed('0x6')]?_0x4173f3[_0x71ed('0x6')][_0x71ed('0x7')]===undefined?!![]:![]:!![]})['then'](function(_0x2453ed){logger[_0x71ed('0xe')](_0x71ed('0x16'),_0x4173f3);logger['debug'](_0x71ed('0x16'),_0x4173f3,JSON[_0x71ed('0x19')](_0x2453ed));_0x2fa9f0(_0x2453ed);})[_0x71ed('0x15')](function(_0x4ea489){logger[_0x71ed('0x10')]('CreateCmHopper',_0x4ea489['message'],_0x4173f3);_0x1d7ee6(_0x522e49[_0x71ed('0x10')](0x1f4,_0x4ea489[_0x71ed('0x11')]));});});};exports[_0x71ed('0x1a')]=function(_0x588953){var _0x3bb367=this;return new Promise(function(_0x369190,_0xc0f94d){return db[_0x71ed('0x5')]['update'](_0x588953[_0x71ed('0x18')],{'raw':_0x588953[_0x71ed('0x6')]?_0x588953[_0x71ed('0x6')][_0x71ed('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x588953['options']?_0x588953['options']['where']||null:null,'attributes':_0x588953[_0x71ed('0x6')]?_0x588953[_0x71ed('0x6')][_0x71ed('0x9')]||null:null,'limit':_0x588953[_0x71ed('0x6')]?_0x588953[_0x71ed('0x6')][_0x71ed('0xa')]||null:null})[_0x71ed('0x14')](function(_0x530d20){logger['info'](_0x71ed('0x1a'),_0x588953);logger[_0x71ed('0xe')](_0x71ed('0x1b'),JSON[_0x71ed('0x19')](_0x588953[_0x71ed('0x6')]['where']),_0x588953[_0x71ed('0x18')][_0x71ed('0x1c')]);logger['debug'](_0x71ed('0x1a'),_0x588953,JSON[_0x71ed('0x19')](_0x530d20));_0x369190(_0x530d20);})[_0x71ed('0x15')](function(_0x1387be){logger[_0x71ed('0x10')](_0x71ed('0x1a'),_0x1387be[_0x71ed('0x11')],_0x588953);_0xc0f94d(_0x3bb367[_0x71ed('0x10')](0x1f4,_0x1387be[_0x71ed('0x11')]));});});};exports[_0x71ed('0x1d')]=function(_0x53b99e){var _0x17d0dc=this;return new Promise(function(_0x5a2312,_0x268452){return db[_0x71ed('0x5')][_0x71ed('0x1e')]({'where':_0x53b99e['options']?_0x53b99e[_0x71ed('0x6')][_0x71ed('0x8')]||null:null})['then'](function(_0x32fa15){logger[_0x71ed('0xe')]('DestroyCmHopper',_0x53b99e);logger[_0x71ed('0xf')](_0x71ed('0x1d'),_0x53b99e,JSON['stringify'](_0x32fa15));_0x5a2312(_0x32fa15);})[_0x71ed('0x15')](function(_0xc0bcb9){logger['error'](_0x71ed('0x1d'),_0xc0bcb9['message'],_0x53b99e);_0x268452(_0x17d0dc['error'](0x1f4,_0xc0bcb9['message']));});});};exports[_0x71ed('0x1f')]=function(_0x34aef6){var _0x7ec73c=this;return new Promise(function(_0x5840f6,_0x39bc32){return db[_0x71ed('0x20')][_0x71ed('0x21')]()[_0x71ed('0x14')](function(_0x30fe5e){return db[_0x71ed('0x22')][_0x71ed('0x23')](function(_0x5e1f26){return db[_0x71ed('0x5')][_0x71ed('0x24')]({'where':_0x34aef6[_0x71ed('0x6')]?_0x34aef6['options'][_0x71ed('0x8')]||null:null,'attributes':_0x34aef6[_0x71ed('0x6')]?_0x34aef6['options'][_0x71ed('0x9')]||null:null,'limit':_0x34aef6['options']?_0x34aef6[_0x71ed('0x6')]['limit']||null:null,'order':_0x34aef6[_0x71ed('0x6')]?_0x34aef6['options'][_0x71ed('0x25')]||null:null,'transaction':_0x5e1f26,'lock':_0x5e1f26[_0x71ed('0x26')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x71ed('0x27'),'attributes':_[_0x71ed('0x28')](_0x30fe5e)},{'model':db[_0x71ed('0x29')],'as':_0x71ed('0x2a'),'attributes':['id',_0x71ed('0x2b'),_0x71ed('0x2c')]}]})[_0x71ed('0x14')](function(_0x136d62){var _0x466200=[];var _0x5235c8=[];for(var _0x1fea8e=0x0;_0x1fea8e<_0x136d62[_0x71ed('0x2d')];_0x1fea8e+=0x1){var _0x5749e2=_0x136d62[_0x1fea8e][_0x71ed('0x2e')];if(_0x5749e2===null){_0x466200[_0x71ed('0x2f')](_0x136d62[_0x1fea8e][_0x71ed('0x30')](_0x34aef6[_0x71ed('0x18')],{'transaction':_0x5e1f26}));}else if(!_0x5235c8['includes'](_0x5749e2)){_0x5235c8[_0x71ed('0x2f')](_0x5749e2);_0x466200['push'](_0x136d62[_0x1fea8e]['update'](_0x34aef6[_0x71ed('0x18')],{'transaction':_0x5e1f26}));}}return BPromise[_0x71ed('0x31')](_0x466200);});})[_0x71ed('0x14')](function(_0x2d9b76){logger[_0x71ed('0xe')](_0x71ed('0x1f'),_0x34aef6);if(_0x2d9b76[_0x71ed('0x2d')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x2d9b76[0x0]['dataValues']['id'],_0x2d9b76[0x0][_0x71ed('0x32')]['ContactId'],_0x2d9b76[0x0]['dataValues']['active']);}logger['debug'](_0x71ed('0x1f'),_0x34aef6,JSON[_0x71ed('0x19')](_0x2d9b76));_0x5840f6(_0x2d9b76);})['catch'](function(_0x357208){logger[_0x71ed('0x10')](_0x71ed('0x1f'),_0x357208['message'],_0x34aef6);_0x39bc32(_0x7ec73c['error'](0x1f4,_0x357208[_0x71ed('0x11')]));});});});};exports[_0x71ed('0x33')]=function(_0x1ddcb8){var _0x131991=this;return new Promise(function(_0x375b0c,_0x3576cd){return db[_0x71ed('0x22')][_0x71ed('0x23')](function(_0x893bd0){return db[_0x71ed('0x34')][_0x71ed('0x17')](_0x1ddcb8[_0x71ed('0x18')],{'raw':_0x1ddcb8[_0x71ed('0x6')]?_0x1ddcb8[_0x71ed('0x6')][_0x71ed('0x7')]===undefined?!![]:![]:!![],'transaction':_0x893bd0})[_0x71ed('0x14')](function(){logger[_0x71ed('0xe')](_0x71ed('0x35'),JSON[_0x71ed('0x19')](_0x1ddcb8[_0x71ed('0x6')][_0x71ed('0x8')]),_0x1ddcb8[_0x71ed('0x6')][_0x71ed('0x8')]['active']);return db['CmHopper'][_0x71ed('0x1e')]({'where':_0x1ddcb8[_0x71ed('0x6')]?_0x1ddcb8[_0x71ed('0x6')][_0x71ed('0x8')]||null:null,'transaction':_0x893bd0});});})['then'](function(_0x59cf5e){logger[_0x71ed('0xe')]('MoveContactManagedDialer',_0x1ddcb8);logger[_0x71ed('0xf')](_0x71ed('0x33'),_0x1ddcb8,JSON[_0x71ed('0x19')](_0x59cf5e));_0x375b0c(_0x59cf5e);})[_0x71ed('0x15')](function(_0x20778f){logger[_0x71ed('0x10')](_0x71ed('0x33'),_0x20778f[_0x71ed('0x11')],_0x1ddcb8);_0x3576cd(_0x131991[_0x71ed('0x10')](0x1f4,_0x20778f[_0x71ed('0x11')]));});});};exports[_0x71ed('0x36')]=function(_0x59abf6){var _0x37c7cf=this;return new Promise(function(_0x5404ea,_0x366d3f){return db[_0x71ed('0x5')][_0x71ed('0x24')]({'raw':_0x59abf6[_0x71ed('0x6')]?_0x59abf6[_0x71ed('0x6')][_0x71ed('0x7')]===undefined?!![]:![]:!![],'where':_0x59abf6[_0x71ed('0x6')]?_0x59abf6['options'][_0x71ed('0x8')]||null:null,'attributes':[[db[_0x71ed('0x22')]['fn']('COUNT',db[_0x71ed('0x22')]['fn']('IF',db[_0x71ed('0x22')][_0x71ed('0x37')](_0x71ed('0x38')+util[_0x71ed('0x39')](_0x71ed('0x3a'),moment()[_0x71ed('0x39')](_0x71ed('0x3b')))+'\x20,\x201,\x20null'))),_0x71ed('0x3c')]]})[_0x71ed('0x14')](function(_0x51d588){logger[_0x71ed('0xe')]('CountReScheduled',_0x59abf6);logger[_0x71ed('0xf')](_0x71ed('0x36'),_0x59abf6,JSON[_0x71ed('0x19')](_0x51d588));_0x5404ea(_0x51d588);})[_0x71ed('0x15')](function(_0xcb338e){logger[_0x71ed('0x10')](_0x71ed('0x36'),_0xcb338e[_0x71ed('0x11')],_0x59abf6);_0x366d3f(_0x37c7cf['error'](0x1f4,_0xcb338e[_0x71ed('0x11')]));});});};exports[_0x71ed('0x3d')]=function(_0x10891c){var _0xcca73b=this;return new Promise(function(_0x3fa9dd,_0x1c4dff){return db[_0x71ed('0x20')][_0x71ed('0x21')]()[_0x71ed('0x14')](function(){return db['sequelize'][_0x71ed('0x23')](function(_0x34332e){return db['CmHopper'][_0x71ed('0x24')]({'where':_0x10891c[_0x71ed('0x6')]?_0x10891c[_0x71ed('0x6')][_0x71ed('0x8')]||null:null,'attributes':_0x10891c[_0x71ed('0x6')]?_0x10891c[_0x71ed('0x6')][_0x71ed('0x9')]||null:null,'limit':0x1,'order':_0x10891c[_0x71ed('0x6')]?_0x10891c[_0x71ed('0x6')][_0x71ed('0x25')]||null:null,'group':db['CmHopper'][_0x71ed('0x2e')],'transaction':_0x34332e,'lock':_0x34332e['LOCK'][_0x71ed('0x3e')],'include':_0x10891c[_0x71ed('0x6')]?_0x10891c[_0x71ed('0x6')][_0x71ed('0xb')]?_[_0x71ed('0xc')](_0x10891c[_0x71ed('0x6')][_0x71ed('0xb')],function(_0x1b70bd){return{'model':db[_0x1b70bd['model']],'as':_0x1b70bd['as'],'attributes':_0x1b70bd['attributes'],'include':_0x1b70bd[_0x71ed('0xb')]?_[_0x71ed('0xc')](_0x1b70bd['include'],function(_0x33e6b1){return{'model':db[_0x33e6b1[_0x71ed('0xd')]],'as':_0x33e6b1['as'],'attributes':_0x33e6b1['attributes'],'include':_0x33e6b1['include']?_[_0x71ed('0xc')](_0x33e6b1[_0x71ed('0xb')],function(_0x12e4e5){return{'model':db[_0x12e4e5['model']],'as':_0x12e4e5['as'],'attributes':_0x12e4e5[_0x71ed('0x9')]};}):[]};}):[]};}):[]:[]})[_0x71ed('0x14')](function(_0x399274){var _0x475d83=[];for(var _0x3e2671=0x0;_0x3e2671<_0x399274[_0x71ed('0x2d')];_0x3e2671+=0x1){_0x475d83['push'](_0x399274[_0x3e2671][_0x71ed('0x30')](_0x10891c['body'],{'transaction':_0x34332e}));}return BPromise[_0x71ed('0x31')](_0x475d83);});})['then'](function(_0x8a9fd2){logger['info'](_0x71ed('0x3d'),_0x10891c);logger[_0x71ed('0xf')](_0x71ed('0x3d'),_0x10891c,JSON['stringify'](_0x8a9fd2));_0x3fa9dd(_0x8a9fd2);})[_0x71ed('0x15')](function(_0x4be7c3){logger['error'](_0x71ed('0x3d'),_0x4be7c3[_0x71ed('0x11')],_0x10891c);_0x1c4dff(_0xcca73b[_0x71ed('0x10')](0x1f4,_0x4be7c3['message']));});});});};exports['GetCmHopperPreview']=function(_0x7ebf06){var _0x4aafc4=this;return new Promise(function(_0x1ece57,_0x232373){db[_0x71ed('0x20')]['describe']()[_0x71ed('0x14')](function(_0x4842c3){return db['CmHopper']['findAll']({'raw':_0x7ebf06[_0x71ed('0x6')]?_0x7ebf06[_0x71ed('0x6')][_0x71ed('0x7')]===undefined?!![]:![]:!![],'where':_0x7ebf06[_0x71ed('0x6')]?_0x7ebf06['options'][_0x71ed('0x8')]||null:null,'attributes':_0x7ebf06[_0x71ed('0x6')]?_0x7ebf06['options'][_0x71ed('0x9')]||null:null,'limit':_0x7ebf06[_0x71ed('0x6')]?_0x7ebf06[_0x71ed('0x6')][_0x71ed('0xa')]||null:null,'include':_0x7ebf06[_0x71ed('0x6')]?_0x7ebf06[_0x71ed('0x6')][_0x71ed('0xb')]?_[_0x71ed('0xc')](_0x7ebf06[_0x71ed('0x6')][_0x71ed('0xb')],function(_0x310553){return{'model':db[_0x310553[_0x71ed('0xd')]],'as':_0x310553['as'],'attributes':_0x310553['as']===_0x71ed('0x27')?_[_0x71ed('0x28')](_0x4842c3):_0x310553[_0x71ed('0x9')],'include':_0x310553['include']?_['map'](_0x310553[_0x71ed('0xb')],function(_0x59be03){return{'model':db[_0x59be03[_0x71ed('0xd')]],'as':_0x59be03['as'],'attributes':_0x59be03[_0x71ed('0x9')],'include':_0x59be03[_0x71ed('0xb')]?_['map'](_0x59be03[_0x71ed('0xb')],function(_0x250543){return{'model':db[_0x250543[_0x71ed('0xd')]],'as':_0x250543['as'],'attributes':_0x250543[_0x71ed('0x9')]};}):[]};}):[]};}):[]:[]})[_0x71ed('0x14')](function(_0x6aebbe){logger[_0x71ed('0xe')](_0x71ed('0x4'),_0x7ebf06);logger[_0x71ed('0xf')](_0x71ed('0x4'),_0x7ebf06,JSON[_0x71ed('0x19')](_0x6aebbe));_0x1ece57(_0x6aebbe);})[_0x71ed('0x15')](function(_0x5f3154){logger['error'](_0x71ed('0x4'),_0x5f3154[_0x71ed('0x11')],_0x7ebf06);_0x232373(_0x4aafc4[_0x71ed('0x10')](0x1f4,_0x5f3154[_0x71ed('0x11')]));});});});};exports[_0x71ed('0x3f')]=function(_0xb00b92){var _0x192657=this;return new Promise(function(_0x356331,_0xbfccc3){return db[_0x71ed('0x20')][_0x71ed('0x40')]({'raw':!![],'where':{'phone':_0xb00b92['options']['where'][_0x71ed('0x41')]},'attributes':['id',_0x71ed('0x42')],'order':[['id',_0x71ed('0x43')]]})[_0x71ed('0x14')](function(_0x307911){logger[_0x71ed('0xe')](_0x71ed('0x44'),_0xb00b92);logger['debug'](_0x71ed('0x44'),_0xb00b92,JSON[_0x71ed('0x19')](_0x307911));_0x356331(_0x307911);})['catch'](function(_0x7183a6){logger[_0x71ed('0x10')](_0x71ed('0x44'),_0x7183a6[_0x71ed('0x11')],_0xb00b92);_0xbfccc3(_0x192657['error'](0x1f4,_0x7183a6['message']));});});};exports[_0x71ed('0x45')]=function(_0x2cec1c){var _0xa9532d=this;return new Promise(function(_0x477ded,_0x13abd0){return db[_0x71ed('0x22')]['transaction'](function(_0x8db262){var _0x1f0f0d=_0x2cec1c[_0x71ed('0x6')]&&_0x2cec1c[_0x71ed('0x6')]['where']?_0x2cec1c[_0x71ed('0x6')][_0x71ed('0x8')]:{};return db[_0x71ed('0x5')][_0x71ed('0x30')](_0x2cec1c[_0x71ed('0x18')],{'where':_0x1f0f0d,'transaction':_0x8db262})['then'](function(_0x5a7d66){logger['info'](_0x71ed('0x45'),_0x2cec1c);logger['debug'](_0x71ed('0x45'),_0x2cec1c,JSON['stringify'](_0x5a7d66));_0x477ded(_0x5a7d66);})[_0x71ed('0x15')](function(_0x591a18){logger[_0x71ed('0x10')]('ResetActiveCalls',_0x591a18['message'],_0x2cec1c);_0x13abd0(_0xa9532d['error'](0x1f4,_0x591a18[_0x71ed('0x11')]));});});});};exports[_0x71ed('0x46')]=function(_0x437fac){var _0x4b581a=this;var _0xc10eca=_0x437fac[_0x71ed('0x18')][_0x71ed('0x8')][_0x71ed('0x47')];var _0x167f20=_0x437fac['body'][_0x71ed('0x8')][_0x71ed('0x48')];var _0x49e4ee=_0x437fac[_0x71ed('0x18')]['where'][_0x71ed('0x49')];return new Promise(function(_0x291529,_0x56b3a2){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0xc10eca},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x71ed('0x22')][_0x71ed('0x37')](_0x71ed('0x4a')+_0x167f20+_0x71ed('0x4b')),'$gt':db[_0x71ed('0x22')][_0x71ed('0x37')](_0x71ed('0x4c'))}},'UserId':{'$in':_0x49e4ee}},'include':[{'model':db['CmContact'],'as':_0x71ed('0x27')},{'model':db['User'],'as':_0x71ed('0x2a'),'attributes':['id',_0x71ed('0x2b'),_0x71ed('0x2c')]},{'model':db[_0x71ed('0x4d')],'as':_0x71ed('0x4e')}]})[_0x71ed('0x14')](function(_0x26af62){if(_0x26af62[_0x71ed('0x2d')]>0x0){return db[_0x71ed('0x22')]['transaction'](function(_0x111be0){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x71ed('0x22')][_0x71ed('0x37')](_0x71ed('0x4c'))},{'where':{'id':{'$in':_[_0x71ed('0xc')](_0x26af62,'id')}},'transaction':_0x111be0})[_0x71ed('0x14')](function(){_0x291529(_0x26af62);})[_0x71ed('0x15')](function(_0x141c49){logger['error'](_0x71ed('0x46'),_0x141c49['message'],_0x437fac);_0x56b3a2(_0x4b581a[_0x71ed('0x10')](0x1f4,_0x141c49['message']));});})['catch'](function(_0x3a81e9){logger[_0x71ed('0x10')](_0x71ed('0x46'),_0x3a81e9[_0x71ed('0x11')],_0x437fac);_0x56b3a2(_0x4b581a[_0x71ed('0x10')](0x1f4,_0x3a81e9[_0x71ed('0x11')]));});}else{_0x291529(_0x26af62);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7cb130d..28b2b6f 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 _0xd59f=['describe','/opencontacts','getTimezones','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','/timezone','update','delete','destroy','exports','./cmHopper.controller','index','get','isAuthenticated'];(function(_0x1ba096,_0x1a55d9){var _0x1bbfe2=function(_0x437f04){while(--_0x437f04){_0x1ba096['push'](_0x1ba096['shift']());}};_0x1bbfe2(++_0x1a55d9);}(_0xd59f,0x1ea));var _0xfd59=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xd59f[_0x5c6244];return _0x5800ce;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xfd59('0x0'));router['get']('/',auth['isAuthenticated'](),controller[_0xfd59('0x1')]);router[_0xfd59('0x2')]('/describe',auth[_0xfd59('0x3')](),controller[_0xfd59('0x4')]);router[_0xfd59('0x2')](_0xfd59('0x5'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xfd59('0x2')]('/timezones',auth[_0xfd59('0x3')](),controller[_0xfd59('0x6')]);router[_0xfd59('0x2')](_0xfd59('0x7'),auth[_0xfd59('0x3')](),controller[_0xfd59('0x8')]);router[_0xfd59('0x2')](_0xfd59('0x9'),auth[_0xfd59('0x3')](),controller['getPreviewRecall']);router[_0xfd59('0xa')]('/',auth['isAuthenticated'](),controller[_0xfd59('0xb')]);router[_0xfd59('0xa')](_0xfd59('0xc'),auth[_0xfd59('0x3')](),controller[_0xfd59('0xd')]);router[_0xfd59('0xa')](_0xfd59('0xe'),auth['isAuthenticated'](),controller['getTimezone']);router['put'](_0xfd59('0x7'),auth[_0xfd59('0x3')](),controller[_0xfd59('0xf')]);router[_0xfd59('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfd59('0x11')]);module[_0xfd59('0x12')]=router; \ No newline at end of file +var _0x4726=['/:id','show','getPreviewRecall','create','getPreview','/timezone','put','update','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','/timezones'];(function(_0x226e1f,_0x379e26){var _0x548202=function(_0x5f10fe){while(--_0x5f10fe){_0x226e1f['push'](_0x226e1f['shift']());}};_0x548202(++_0x379e26);}(_0x4726,0xd0));var _0x6472=function(_0x2ece7b,_0x5528b5){_0x2ece7b=_0x2ece7b-0x0;var _0x44e811=_0x4726[_0x2ece7b];return _0x44e811;};'use strict';var express=require(_0x6472('0x0'));var router=express[_0x6472('0x1')]();var auth=require(_0x6472('0x2'));var controller=require(_0x6472('0x3'));router['get']('/',auth[_0x6472('0x4')](),controller[_0x6472('0x5')]);router[_0x6472('0x6')](_0x6472('0x7'),auth[_0x6472('0x4')](),controller[_0x6472('0x8')]);router[_0x6472('0x6')](_0x6472('0x9'),auth[_0x6472('0x4')](),controller[_0x6472('0xa')]);router[_0x6472('0x6')](_0x6472('0xb'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x6472('0x6')](_0x6472('0xc'),auth[_0x6472('0x4')](),controller[_0x6472('0xd')]);router[_0x6472('0x6')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x6472('0xe')]);router['post']('/',auth[_0x6472('0x4')](),controller[_0x6472('0xf')]);router['post']('/preview',auth['isAuthenticated'](),controller[_0x6472('0x10')]);router['post'](_0x6472('0x11'),auth[_0x6472('0x4')](),controller['getTimezone']);router[_0x6472('0x12')](_0x6472('0xc'),auth[_0x6472('0x4')](),controller[_0x6472('0x13')]);router['delete'](_0x6472('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 8986502..a4b3cb6 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 _0x8b1b=['exports','INTEGER','DATE','sequelize'];(function(_0x218833,_0x5ed271){var _0x359616=function(_0x11365b){while(--_0x11365b){_0x218833['push'](_0x218833['shift']());}};_0x359616(++_0x5ed271);}(_0x8b1b,0xe3));var _0xb8b1=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x8b1b[_0x1b4b23];return _0x2a325b;};'use strict';var moment=require('moment');var Sequelize=require(_0xb8b1('0x0'));module[_0xb8b1('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xb8b1('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb8b1('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb8b1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb8b1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb8b1('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb8b1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb8b1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb8b1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd19a=['INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xd19a,0xb3));var _0xad19=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd19a[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0xad19('0x0'));var Sequelize=require(_0xad19('0x1'));module[_0xad19('0x2')]={'CmHopperId':{'type':Sequelize[_0xad19('0x3')]},'phone':{'type':Sequelize[_0xad19('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xad19('0x5')],'defaultValue':moment()['format'](_0xad19('0x6'))},'countbusyretry':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xad19('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xad19('0x3')],'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 95e2dc3..e333187 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 _0x03aa=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','CmHopperAdditionalPhone','includeAll','findAll','rows','show','params','keys','rawAttributes','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x53be0d,_0xbb1a39){var _0x23fe66=function(_0x5643b5){while(--_0x5643b5){_0x53be0d['push'](_0x53be0d['shift']());}};_0x23fe66(++_0xbb1a39);}(_0x03aa,0x1b1));var _0xa03a=function(_0x3a07bf,_0xe7ebfd){_0x3a07bf=_0x3a07bf-0x0;var _0x4a4053=_0x03aa[_0x3a07bf];return _0x4a4053;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa03a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa03a('0x1'));var rp=require(_0xa03a('0x2'));var moment=require('moment');var BPromise=require(_0xa03a('0x3'));var Mustache=require(_0xa03a('0x4'));var util=require(_0xa03a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa03a('0x6'));var ejs=require(_0xa03a('0x7'));var fs=require('fs');var fs_extra=require(_0xa03a('0x8'));var _=require('lodash');var squel=require(_0xa03a('0x9'));var crypto=require(_0xa03a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa03a('0xb'));var toCsv=require(_0xa03a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa03a('0xc'));var authService=require(_0xa03a('0xd'));var qs=require(_0xa03a('0xe'));var as=require(_0xa03a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa03a('0x10'));var utils=require(_0xa03a('0x11'));var config=require(_0xa03a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa03a('0x13'))['db'];function respondWithStatusCode(_0x58e6b2,_0x225b84){_0x225b84=_0x225b84||0xcc;return function(_0x41dce1){if(_0x41dce1){return _0x58e6b2['sendStatus'](_0x225b84);}return _0x58e6b2[_0xa03a('0x14')](_0x225b84)[_0xa03a('0x15')]();};}function respondWithResult(_0x4a5398,_0x63b987){_0x63b987=_0x63b987||0xc8;return function(_0x4f5c2e){if(_0x4f5c2e){return _0x4a5398['status'](_0x63b987)[_0xa03a('0x16')](_0x4f5c2e);}};}function respondWithFilteredResult(_0x192dea,_0x95b076){return function(_0x588b5d){if(_0x588b5d){var _0x2ad5cf=typeof _0x95b076[_0xa03a('0x17')]==='undefined'&&typeof _0x95b076['limit']===_0xa03a('0x18');var _0x23cf77=_0x588b5d['count'];var _0x25420e=_0x2ad5cf?0x0:_0x95b076['offset'];var _0x4f1815=_0x2ad5cf?_0x588b5d[_0xa03a('0x19')]:_0x95b076[_0xa03a('0x17')]+_0x95b076[_0xa03a('0x1a')];var _0x742274;if(_0x4f1815>=_0x23cf77){_0x4f1815=_0x23cf77;_0x742274=0xc8;}else{_0x742274=0xce;}_0x192dea[_0xa03a('0x14')](_0x742274);return _0x192dea[_0xa03a('0x1b')](_0xa03a('0x1c'),_0x25420e+'-'+_0x4f1815+'/'+_0x23cf77)['json'](_0x588b5d);}return null;};}function patchUpdates(_0x1cb0a8){return function(_0x3e5b50){try{jsonpatch['apply'](_0x3e5b50,_0x1cb0a8,!![]);}catch(_0x3d74a9){return BPromise[_0xa03a('0x1d')](_0x3d74a9);}return _0x3e5b50[_0xa03a('0x1e')]();};}function saveUpdates(_0xc0949b,_0x3f1372){return function(_0x54e215){if(_0x54e215){return _0x54e215[_0xa03a('0x1f')](_0xc0949b)[_0xa03a('0x20')](function(_0x441eb5){return _0x441eb5;});}return null;};}function removeEntity(_0x11fa8b,_0x481e5a){return function(_0x39f8d0){if(_0x39f8d0){return _0x39f8d0[_0xa03a('0x21')]()[_0xa03a('0x20')](function(){var _0x1c3bc5=_0x39f8d0[_0xa03a('0x22')]({'plain':!![]});var _0x3445fd=_0xa03a('0x23');return db['UserProfileResource'][_0xa03a('0x21')]({'where':{'type':_0x3445fd,'resourceId':_0x1c3bc5['id']}})[_0xa03a('0x20')](function(){return _0x39f8d0;});})[_0xa03a('0x20')](function(){_0x11fa8b[_0xa03a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cae60,_0x2171f2){return function(_0x43a1e8){if(!_0x43a1e8){_0x2cae60[_0xa03a('0x24')](0x194);}return _0x43a1e8;};}function handleError(_0x4e6d82,_0x340a80){_0x340a80=_0x340a80||0x1f4;return function(_0x368b01){logger[_0xa03a('0x25')](_0x368b01[_0xa03a('0x26')]);if(_0x368b01['name']){delete _0x368b01[_0xa03a('0x27')];}_0x4e6d82[_0xa03a('0x14')](_0x340a80)[_0xa03a('0x28')](_0x368b01);};}exports[_0xa03a('0x29')]=function(_0x5b2704,_0x164e31){var _0x3da778={},_0x5b80e6={},_0x4eaa31={'count':0x0,'rows':[]};var _0x1ae3d5=_[_0xa03a('0x2a')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x1dbf7b){return{'name':_0x1dbf7b[_0xa03a('0x2b')],'type':_0x1dbf7b[_0xa03a('0x2c')][_0xa03a('0x2d')]};});_0x5b80e6[_0xa03a('0x2e')]=_[_0xa03a('0x2a')](_0x1ae3d5,_0xa03a('0x27'));_0x5b80e6[_0xa03a('0x2f')]=_['keys'](_0x5b2704[_0xa03a('0x2f')]);_0x5b80e6['filters']=_[_0xa03a('0x30')](_0x5b80e6[_0xa03a('0x2e')],_0x5b80e6[_0xa03a('0x2f')]);_0x3da778[_0xa03a('0x31')]=_[_0xa03a('0x30')](_0x5b80e6[_0xa03a('0x2e')],qs[_0xa03a('0x32')](_0x5b2704['query'][_0xa03a('0x32')]));_0x3da778[_0xa03a('0x31')]=_0x3da778[_0xa03a('0x31')][_0xa03a('0x33')]?_0x3da778['attributes']:_0x5b80e6[_0xa03a('0x2e')];if(!_0x5b2704[_0xa03a('0x2f')][_0xa03a('0x34')](_0xa03a('0x35'))){_0x3da778[_0xa03a('0x1a')]=qs[_0xa03a('0x1a')](_0x5b2704[_0xa03a('0x2f')][_0xa03a('0x1a')]);_0x3da778[_0xa03a('0x17')]=qs[_0xa03a('0x17')](_0x5b2704[_0xa03a('0x2f')][_0xa03a('0x17')]);}_0x3da778[_0xa03a('0x36')]=qs[_0xa03a('0x37')](_0x5b2704[_0xa03a('0x2f')][_0xa03a('0x37')]);_0x3da778[_0xa03a('0x38')]=qs[_0xa03a('0x39')](_[_0xa03a('0x3a')](_0x5b2704['query'],_0x5b80e6[_0xa03a('0x39')]),_0x1ae3d5);if(_0x5b2704[_0xa03a('0x2f')][_0xa03a('0x3b')]){_0x3da778['where']=_[_0xa03a('0x3c')](_0x3da778[_0xa03a('0x38')],{'$or':_[_0xa03a('0x2a')](_0x1ae3d5,function(_0x4ca27e){if(_0x4ca27e[_0xa03a('0x2c')]!==_0xa03a('0x3d')){var _0xd08fad={};_0xd08fad[_0x4ca27e[_0xa03a('0x27')]]={'$like':'%'+_0x5b2704[_0xa03a('0x2f')][_0xa03a('0x3b')]+'%'};return _0xd08fad;}})});}_0x3da778=_['merge']({},_0x3da778,_0x5b2704['options']);var _0x5dc016={'where':_0x3da778['where']};return db[_0xa03a('0x3e')][_0xa03a('0x19')](_0x5dc016)[_0xa03a('0x20')](function(_0x41cbb9){_0x4eaa31[_0xa03a('0x19')]=_0x41cbb9;if(_0x5b2704['query'][_0xa03a('0x3f')]){_0x3da778['include']=[{'all':!![]}];}return db[_0xa03a('0x3e')][_0xa03a('0x40')](_0x3da778);})[_0xa03a('0x20')](function(_0x2a9d68){_0x4eaa31[_0xa03a('0x41')]=_0x2a9d68;return _0x4eaa31;})[_0xa03a('0x20')](respondWithFilteredResult(_0x164e31,_0x3da778))['catch'](handleError(_0x164e31,null));};exports[_0xa03a('0x42')]=function(_0x36618a,_0x36910f){var _0x497e76={'raw':!![],'where':{'id':_0x36618a[_0xa03a('0x43')]['id']}},_0x1afc28={};_0x1afc28[_0xa03a('0x2e')]=_[_0xa03a('0x44')](db[_0xa03a('0x3e')][_0xa03a('0x45')]);_0x1afc28[_0xa03a('0x2f')]=_[_0xa03a('0x44')](_0x36618a['query']);_0x1afc28[_0xa03a('0x39')]=_[_0xa03a('0x30')](_0x1afc28[_0xa03a('0x2e')],_0x1afc28[_0xa03a('0x2f')]);_0x497e76[_0xa03a('0x31')]=_[_0xa03a('0x30')](_0x1afc28[_0xa03a('0x2e')],qs[_0xa03a('0x32')](_0x36618a['query'][_0xa03a('0x32')]));_0x497e76[_0xa03a('0x31')]=_0x497e76[_0xa03a('0x31')]['length']?_0x497e76[_0xa03a('0x31')]:_0x1afc28['model'];if(_0x36618a[_0xa03a('0x2f')][_0xa03a('0x3f')]){_0x497e76[_0xa03a('0x46')]=[{'all':!![]}];}_0x497e76=_[_0xa03a('0x3c')]({},_0x497e76,_0x36618a[_0xa03a('0x47')]);return db['CmHopperAdditionalPhone'][_0xa03a('0x48')](_0x497e76)[_0xa03a('0x20')](handleEntityNotFound(_0x36910f,null))[_0xa03a('0x20')](respondWithResult(_0x36910f,null))[_0xa03a('0x49')](handleError(_0x36910f,null));};exports[_0xa03a('0x4a')]=function(_0xb9b047,_0xf54077){return db['CmHopperAdditionalPhone'][_0xa03a('0x4a')](_0xb9b047[_0xa03a('0x4b')],{})['then'](function(_0x5b6240){var _0x52c35e=_0xb9b047[_0xa03a('0x4c')][_0xa03a('0x22')]({'plain':!![]});if(!_0x52c35e)throw new Error(_0xa03a('0x4d'));if(_0x52c35e[_0xa03a('0x4e')]===_0xa03a('0x4c')){var _0x2941ae=_0x5b6240['get']({'plain':!![]});var _0x468375=_0xa03a('0x23');return db[_0xa03a('0x4f')][_0xa03a('0x48')]({'where':{'name':_0x468375,'userProfileId':_0x52c35e['userProfileId']},'raw':!![]})[_0xa03a('0x20')](function(_0x2f5d85){if(_0x2f5d85&&_0x2f5d85['autoAssociation']===0x0){return db['UserProfileResource'][_0xa03a('0x4a')]({'name':_0x2941ae[_0xa03a('0x27')],'resourceId':_0x2941ae['id'],'type':_0x2f5d85[_0xa03a('0x27')],'sectionId':_0x2f5d85['id']},{})[_0xa03a('0x20')](function(){return _0x5b6240;});}else{return _0x5b6240;}})[_0xa03a('0x49')](function(_0x41352d){logger[_0xa03a('0x25')](_0xa03a('0x50'),_0x41352d);throw _0x41352d;});}return _0x5b6240;})[_0xa03a('0x20')](respondWithResult(_0xf54077,0xc9))[_0xa03a('0x49')](handleError(_0xf54077,null));};exports[_0xa03a('0x1f')]=function(_0x302611,_0x440358){if(_0x302611[_0xa03a('0x4b')]['id']){delete _0x302611[_0xa03a('0x4b')]['id'];}return db[_0xa03a('0x3e')][_0xa03a('0x48')]({'where':{'id':_0x302611[_0xa03a('0x43')]['id']}})['then'](handleEntityNotFound(_0x440358,null))[_0xa03a('0x20')](saveUpdates(_0x302611[_0xa03a('0x4b')],null))[_0xa03a('0x20')](respondWithResult(_0x440358,null))[_0xa03a('0x49')](handleError(_0x440358,null));};exports[_0xa03a('0x21')]=function(_0x8f038c,_0x38105a){return db[_0xa03a('0x3e')]['find']({'where':{'id':_0x8f038c[_0xa03a('0x43')]['id']}})[_0xa03a('0x20')](handleEntityNotFound(_0x38105a,null))[_0xa03a('0x20')](removeEntity(_0x38105a,null))[_0xa03a('0x49')](handleError(_0x38105a,null));}; \ No newline at end of file +var _0xf94e=['../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','CmHopperAdditionalPhones','then','end','sendStatus','error','stack','name','send','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','model','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x30583e,_0x521879){var _0x353b48=function(_0x4cc203){while(--_0x4cc203){_0x30583e['push'](_0x30583e['shift']());}};_0x353b48(++_0x521879);}(_0xf94e,0xd9));var _0xef94=function(_0x586e4b,_0x2dcc8b){_0x586e4b=_0x586e4b-0x0;var _0x3bccd1=_0xf94e[_0x586e4b];return _0x3bccd1;};'use strict';var emlformat=require(_0xef94('0x0'));var rimraf=require(_0xef94('0x1'));var zipdir=require(_0xef94('0x2'));var jsonpatch=require(_0xef94('0x3'));var rp=require(_0xef94('0x4'));var moment=require('moment');var BPromise=require(_0xef94('0x5'));var Mustache=require(_0xef94('0x6'));var util=require(_0xef94('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xef94('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef94('0x9'));var _=require(_0xef94('0xa'));var squel=require(_0xef94('0xb'));var crypto=require('crypto');var jsforce=require(_0xef94('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xef94('0x8'));var querystring=require('querystring');var Papa=require(_0xef94('0xd'));var Redis=require(_0xef94('0xe'));var authService=require(_0xef94('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xef94('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef94('0x11'))(_0xef94('0x12'));var utils=require(_0xef94('0x13'));var config=require(_0xef94('0x14'));var licenseUtil=require(_0xef94('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46fc57,_0x222e92){_0x222e92=_0x222e92||0xcc;return function(_0x5ba592){if(_0x5ba592){return _0x46fc57['sendStatus'](_0x222e92);}return _0x46fc57[_0xef94('0x16')](_0x222e92)['end']();};}function respondWithResult(_0x4e97f6,_0x5d39b5){_0x5d39b5=_0x5d39b5||0xc8;return function(_0x2a1ace){if(_0x2a1ace){return _0x4e97f6[_0xef94('0x16')](_0x5d39b5)[_0xef94('0x17')](_0x2a1ace);}};}function respondWithFilteredResult(_0x4531c2,_0x449739){return function(_0x232fab){if(_0x232fab){var _0x2e4047=typeof _0x449739[_0xef94('0x18')]===_0xef94('0x19')&&typeof _0x449739[_0xef94('0x1a')]===_0xef94('0x19');var _0x36000d=_0x232fab[_0xef94('0x1b')];var _0x2df987=_0x2e4047?0x0:_0x449739[_0xef94('0x18')];var _0x3cc2e1=_0x2e4047?_0x232fab[_0xef94('0x1b')]:_0x449739[_0xef94('0x18')]+_0x449739['limit'];var _0x187fb0;if(_0x3cc2e1>=_0x36000d){_0x3cc2e1=_0x36000d;_0x187fb0=0xc8;}else{_0x187fb0=0xce;}_0x4531c2[_0xef94('0x16')](_0x187fb0);return _0x4531c2[_0xef94('0x1c')](_0xef94('0x1d'),_0x2df987+'-'+_0x3cc2e1+'/'+_0x36000d)['json'](_0x232fab);}return null;};}function patchUpdates(_0x3f3785){return function(_0x31b51f){try{jsonpatch[_0xef94('0x1e')](_0x31b51f,_0x3f3785,!![]);}catch(_0xdbd28f){return BPromise['reject'](_0xdbd28f);}return _0x31b51f[_0xef94('0x1f')]();};}function saveUpdates(_0x297624,_0x42a20f){return function(_0x4454da){if(_0x4454da){return _0x4454da[_0xef94('0x20')](_0x297624)['then'](function(_0x2eefc4){return _0x2eefc4;});}return null;};}function removeEntity(_0x3e1926,_0x15f668){return function(_0x29bf31){if(_0x29bf31){return _0x29bf31[_0xef94('0x21')]()['then'](function(){var _0xebbc30=_0x29bf31['get']({'plain':!![]});var _0x2be6e4=_0xef94('0x22');return db['UserProfileResource'][_0xef94('0x21')]({'where':{'type':_0x2be6e4,'resourceId':_0xebbc30['id']}})[_0xef94('0x23')](function(){return _0x29bf31;});})[_0xef94('0x23')](function(){_0x3e1926[_0xef94('0x16')](0xcc)[_0xef94('0x24')]();});}};}function handleEntityNotFound(_0x33b3ad,_0xda9e00){return function(_0x51581f){if(!_0x51581f){_0x33b3ad[_0xef94('0x25')](0x194);}return _0x51581f;};}function handleError(_0x54d534,_0x13a0cd){_0x13a0cd=_0x13a0cd||0x1f4;return function(_0x30e863){logger[_0xef94('0x26')](_0x30e863[_0xef94('0x27')]);if(_0x30e863[_0xef94('0x28')]){delete _0x30e863[_0xef94('0x28')];}_0x54d534['status'](_0x13a0cd)[_0xef94('0x29')](_0x30e863);};}exports['index']=function(_0x470ba4,_0x24bbab){var _0x3b799a={},_0x3f5ec0={},_0x49905e={'count':0x0,'rows':[]};var _0x357183=_['map'](db[_0xef94('0x2a')][_0xef94('0x2b')],function(_0x23d54b){return{'name':_0x23d54b['fieldName'],'type':_0x23d54b[_0xef94('0x2c')][_0xef94('0x2d')]};});_0x3f5ec0['model']=_['map'](_0x357183,'name');_0x3f5ec0[_0xef94('0x2e')]=_[_0xef94('0x2f')](_0x470ba4[_0xef94('0x2e')]);_0x3f5ec0[_0xef94('0x30')]=_[_0xef94('0x31')](_0x3f5ec0['model'],_0x3f5ec0[_0xef94('0x2e')]);_0x3b799a[_0xef94('0x32')]=_[_0xef94('0x31')](_0x3f5ec0['model'],qs[_0xef94('0x33')](_0x470ba4[_0xef94('0x2e')][_0xef94('0x33')]));_0x3b799a['attributes']=_0x3b799a[_0xef94('0x32')][_0xef94('0x34')]?_0x3b799a[_0xef94('0x32')]:_0x3f5ec0['model'];if(!_0x470ba4[_0xef94('0x2e')][_0xef94('0x35')](_0xef94('0x36'))){_0x3b799a['limit']=qs[_0xef94('0x1a')](_0x470ba4[_0xef94('0x2e')]['limit']);_0x3b799a[_0xef94('0x18')]=qs[_0xef94('0x18')](_0x470ba4[_0xef94('0x2e')]['offset']);}_0x3b799a['order']=qs[_0xef94('0x37')](_0x470ba4[_0xef94('0x2e')]['sort']);_0x3b799a['where']=qs[_0xef94('0x30')](_['pick'](_0x470ba4[_0xef94('0x2e')],_0x3f5ec0[_0xef94('0x30')]),_0x357183);if(_0x470ba4[_0xef94('0x2e')]['filter']){_0x3b799a[_0xef94('0x38')]=_[_0xef94('0x39')](_0x3b799a[_0xef94('0x38')],{'$or':_['map'](_0x357183,function(_0xd2f106){if(_0xd2f106[_0xef94('0x2c')]!==_0xef94('0x3a')){var _0x15d9ea={};_0x15d9ea[_0xd2f106[_0xef94('0x28')]]={'$like':'%'+_0x470ba4[_0xef94('0x2e')][_0xef94('0x3b')]+'%'};return _0x15d9ea;}})});}_0x3b799a=_['merge']({},_0x3b799a,_0x470ba4[_0xef94('0x3c')]);var _0x2b09b9={'where':_0x3b799a[_0xef94('0x38')]};return db[_0xef94('0x2a')][_0xef94('0x1b')](_0x2b09b9)[_0xef94('0x23')](function(_0x37afd5){_0x49905e[_0xef94('0x1b')]=_0x37afd5;if(_0x470ba4[_0xef94('0x2e')][_0xef94('0x3d')]){_0x3b799a['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xef94('0x3e')](_0x3b799a);})[_0xef94('0x23')](function(_0x3d5a0c){_0x49905e[_0xef94('0x3f')]=_0x3d5a0c;return _0x49905e;})[_0xef94('0x23')](respondWithFilteredResult(_0x24bbab,_0x3b799a))[_0xef94('0x40')](handleError(_0x24bbab,null));};exports[_0xef94('0x41')]=function(_0x56bb52,_0x595a19){var _0x8b885f={'raw':!![],'where':{'id':_0x56bb52[_0xef94('0x42')]['id']}},_0x492263={};_0x492263[_0xef94('0x43')]=_[_0xef94('0x2f')](db[_0xef94('0x2a')][_0xef94('0x2b')]);_0x492263[_0xef94('0x2e')]=_[_0xef94('0x2f')](_0x56bb52[_0xef94('0x2e')]);_0x492263[_0xef94('0x30')]=_['intersection'](_0x492263['model'],_0x492263['query']);_0x8b885f[_0xef94('0x32')]=_['intersection'](_0x492263['model'],qs[_0xef94('0x33')](_0x56bb52['query'][_0xef94('0x33')]));_0x8b885f[_0xef94('0x32')]=_0x8b885f[_0xef94('0x32')][_0xef94('0x34')]?_0x8b885f[_0xef94('0x32')]:_0x492263[_0xef94('0x43')];if(_0x56bb52[_0xef94('0x2e')]['includeAll']){_0x8b885f[_0xef94('0x44')]=[{'all':!![]}];}_0x8b885f=_['merge']({},_0x8b885f,_0x56bb52[_0xef94('0x3c')]);return db[_0xef94('0x2a')][_0xef94('0x45')](_0x8b885f)[_0xef94('0x23')](handleEntityNotFound(_0x595a19,null))['then'](respondWithResult(_0x595a19,null))[_0xef94('0x40')](handleError(_0x595a19,null));};exports[_0xef94('0x46')]=function(_0x45b37e,_0x4aadb5){return db[_0xef94('0x2a')][_0xef94('0x46')](_0x45b37e['body'],{})['then'](function(_0x3a3587){var _0x354750=_0x45b37e['user'][_0xef94('0x47')]({'plain':!![]});if(!_0x354750)throw new Error(_0xef94('0x48'));if(_0x354750[_0xef94('0x49')]==='user'){var _0x56dfcc=_0x3a3587[_0xef94('0x47')]({'plain':!![]});var _0x5df696=_0xef94('0x22');return db[_0xef94('0x4a')][_0xef94('0x45')]({'where':{'name':_0x5df696,'userProfileId':_0x354750[_0xef94('0x4b')]},'raw':!![]})[_0xef94('0x23')](function(_0x36dc9d){if(_0x36dc9d&&_0x36dc9d[_0xef94('0x4c')]===0x0){return db['UserProfileResource'][_0xef94('0x46')]({'name':_0x56dfcc['name'],'resourceId':_0x56dfcc['id'],'type':_0x36dc9d[_0xef94('0x28')],'sectionId':_0x36dc9d['id']},{})[_0xef94('0x23')](function(){return _0x3a3587;});}else{return _0x3a3587;}})[_0xef94('0x40')](function(_0x34bdf1){logger[_0xef94('0x26')](_0xef94('0x4d'),_0x34bdf1);throw _0x34bdf1;});}return _0x3a3587;})[_0xef94('0x23')](respondWithResult(_0x4aadb5,0xc9))[_0xef94('0x40')](handleError(_0x4aadb5,null));};exports[_0xef94('0x20')]=function(_0x162e4a,_0x597b74){if(_0x162e4a[_0xef94('0x4e')]['id']){delete _0x162e4a[_0xef94('0x4e')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x162e4a[_0xef94('0x42')]['id']}})[_0xef94('0x23')](handleEntityNotFound(_0x597b74,null))[_0xef94('0x23')](saveUpdates(_0x162e4a[_0xef94('0x4e')],null))['then'](respondWithResult(_0x597b74,null))[_0xef94('0x40')](handleError(_0x597b74,null));};exports['destroy']=function(_0x2da915,_0x5bfd86){return db[_0xef94('0x2a')][_0xef94('0x45')]({'where':{'id':_0x2da915[_0xef94('0x42')]['id']}})[_0xef94('0x23')](handleEntityNotFound(_0x5bfd86,null))[_0xef94('0x23')](removeEntity(_0x5bfd86,null))[_0xef94('0x40')](handleError(_0x5bfd86,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 1bfc138..9eead89 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 _0x4c01=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CmHopperAdditionalPhone','lodash','../../config/logger','api'];(function(_0x117717,_0x24abef){var _0x4deee2=function(_0x4df534){while(--_0x4df534){_0x117717['push'](_0x117717['shift']());}};_0x4deee2(++_0x24abef);}(_0x4c01,0x13c));var _0x14c0=function(_0x1d340f,_0x14a40b){_0x1d340f=_0x1d340f-0x0;var _0xd80ddb=_0x4c01[_0x1d340f];return _0xd80ddb;};'use strict';var _=require(_0x14c0('0x0'));var util=require('util');var logger=require(_0x14c0('0x1'))(_0x14c0('0x2'));var moment=require(_0x14c0('0x3'));var BPromise=require(_0x14c0('0x4'));var rp=require(_0x14c0('0x5'));var fs=require('fs');var path=require(_0x14c0('0x6'));var rimraf=require(_0x14c0('0x7'));var config=require(_0x14c0('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x290e04,_0x46c42b){return _0x290e04[_0x14c0('0x9')](_0x14c0('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3750=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x56b13c,_0xa8e8a9){var _0x22cbd8=function(_0x5679f9){while(--_0x5679f9){_0x56b13c['push'](_0x56b13c['shift']());}};_0x22cbd8(++_0xa8e8a9);}(_0x3750,0x6c));var _0x0375=function(_0xf61586,_0x56b0c4){_0xf61586=_0xf61586-0x0;var _0x2b6eb3=_0x3750[_0xf61586];return _0x2b6eb3;};'use strict';var _=require('lodash');var util=require(_0x0375('0x0'));var logger=require(_0x0375('0x1'))(_0x0375('0x2'));var moment=require(_0x0375('0x3'));var BPromise=require(_0x0375('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0375('0x5'));var rimraf=require(_0x0375('0x6'));var config=require(_0x0375('0x7'));var attributes=require(_0x0375('0x8'));module['exports']=function(_0x538175,_0x1ef352){return _0x538175[_0x0375('0x9')](_0x0375('0xa'),attributes,{'tableName':_0x0375('0xb'),'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 541a244..7b5a8e5 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 _0x0be2=['ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countbusyretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','VerifyAdditionalPhones','CmHopper','findOne','body'];(function(_0x4a6210,_0x2a0c31){var _0x459435=function(_0x23e2b3){while(--_0x23e2b3){_0x4a6210['push'](_0x4a6210['shift']());}};_0x459435(++_0x2a0c31);}(_0x0be2,0x8f));var _0x20be=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x0be2[_0x3b7a0c];return _0x3bb70f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x20be('0x0'));var BPromise=require(_0x20be('0x1'));var rs=require(_0x20be('0x2'));var fs=require('fs');var Redis=require(_0x20be('0x3'));var db=require(_0x20be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x20be('0x5'))('rpc');var config=require(_0x20be('0x6'));var jayson=require(_0x20be('0x7'));var client=jayson[_0x20be('0x8')][_0x20be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x494951,_0x89e891,_0x3bd3f4){return new BPromise(function(_0x16e122,_0x174aa2){return client['request'](_0x494951,_0x3bd3f4)[_0x20be('0xa')](function(_0x3b8289){logger['info'](_0x20be('0xb'),_0x89e891,'request\x20sent');logger[_0x20be('0xc')](_0x20be('0xd'),_0x89e891,_0x20be('0xe'),JSON[_0x20be('0xf')](_0x3b8289));if(_0x3b8289['error']){if(_0x3b8289['error'][_0x20be('0x10')]===0x1f4){logger[_0x20be('0x11')](_0x20be('0xb'),_0x89e891,_0x3b8289['error'][_0x20be('0x12')]);return _0x174aa2(_0x3b8289[_0x20be('0x11')][_0x20be('0x12')]);}logger[_0x20be('0x11')](_0x20be('0xb'),_0x89e891,_0x3b8289['error'][_0x20be('0x12')]);return _0x16e122(_0x3b8289['error'][_0x20be('0x12')]);}else{logger[_0x20be('0x13')](_0x20be('0xb'),_0x89e891,_0x20be('0xe'));_0x16e122(_0x3b8289['result']['message']);}})[_0x20be('0x14')](function(_0x99241e){logger[_0x20be('0x11')](_0x20be('0xb'),_0x89e891,_0x99241e);_0x174aa2(_0x99241e);});});}exports[_0x20be('0x15')]=function(_0x41a3d2){var _0x3ec054=this;return new Promise(function(_0x1e951e,_0x5b9972){return db[_0x20be('0x16')][_0x20be('0x17')]({'raw':!![],'where':{'ContactId':_0x41a3d2[_0x20be('0x18')][_0x20be('0x19')],'ListId':_0x41a3d2[_0x20be('0x18')][_0x20be('0x1a')],'VoiceQueueId':_0x41a3d2[_0x20be('0x18')][_0x20be('0x1b')]===undefined?null:_0x41a3d2['body'][_0x20be('0x1b')],'CampaignId':_0x41a3d2[_0x20be('0x18')][_0x20be('0x1c')]===undefined?null:_0x41a3d2['body']['CampaignId']}})['then'](function(_0x4589d2){if(_0x4589d2!=null){return db['CmHopperAdditionalPhone'][_0x20be('0x17')]({'raw':!![],'where':{'CmHopperId':_0x4589d2['id'],'OrderBy':{'$gt':_0x4589d2[_0x20be('0x1d')]}},'order':[[_0x20be('0x1d'),_0x20be('0x1e')]]})[_0x20be('0xa')](function(_0x28ead9){var _0x9b275e=0x0;if(_0x28ead9){if(_0x28ead9['countbusyretry']+_0x28ead9[_0x20be('0x1f')]+_0x28ead9[_0x20be('0x20')]+_0x28ead9[_0x20be('0x21')]+_0x28ead9[_0x20be('0x22')]+_0x28ead9['countabandonedretry']+_0x28ead9['countmachineretry']+_0x28ead9[_0x20be('0x23')]<_0x41a3d2['entity']['dialGlobalMaxRetry'])_0x9b275e=0x1;_0x1e951e({'additional':_0x9b275e});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4589d2['id']},'order':[[_0x20be('0x1d'),_0x20be('0x1e')]]})[_0x20be('0xa')](function(_0x3fcf42){var _0x13ea15=0x0;if(_0x3fcf42){if(_0x3fcf42[_0x20be('0x24')]+_0x3fcf42[_0x20be('0x1f')]+_0x3fcf42['countnoanswerretry']+_0x3fcf42['countnosuchnumberretry']+_0x3fcf42[_0x20be('0x22')]+_0x3fcf42[_0x20be('0x25')]+_0x3fcf42[_0x20be('0x26')]+_0x3fcf42['countagentrejectretry']<_0x41a3d2[_0x20be('0x27')][_0x20be('0x28')])_0x13ea15=0x1;_0x1e951e({'additional':_0x13ea15});}else{_0x1e951e({'additional':0x0});}})['catch'](function(_0x209f02){logger[_0x20be('0x11')](_0x20be('0x15'),_0x209f02[_0x20be('0x12')]);_0x5b9972(_0x3ec054[_0x20be('0x11')](0x1f4,_0x209f02[_0x20be('0x12')]));});}})[_0x20be('0x14')](function(_0x184291){logger[_0x20be('0x11')](_0x20be('0x15'),_0x184291[_0x20be('0x12')]);_0x5b9972(_0x3ec054[_0x20be('0x11')](0x1f4,_0x184291['message']));});}else _0x1e951e({'additional':0x0});});});};exports[_0x20be('0x29')]=function(_0x418a48){var _0xd7ae44=this;return new Promise(function(_0x556e6f,_0x3c660e){return db[_0x20be('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x418a48[_0x20be('0x18')]['ContactId'],'ListId':_0x418a48[_0x20be('0x18')][_0x20be('0x1a')],'VoiceQueueId':_0x418a48['body'][_0x20be('0x1b')]===undefined?null:_0x418a48['body'][_0x20be('0x1b')],'CampaignId':_0x418a48['body']['CampaignId']===undefined?null:_0x418a48['body'][_0x20be('0x1c')]}})[_0x20be('0xa')](function(_0x30d86e){if(_0x30d86e!=null){return db[_0x20be('0x2a')][_0x20be('0x17')]({'raw':!![],'where':{'CmHopperId':_0x30d86e['id'],'OrderBy':{'$gte':_0x30d86e[_0x20be('0x1d')]}},'order':[['OrderBy',_0x20be('0x1e')]]})['then'](function(_0x5b1ad4){if(_0x5b1ad4)return activateAdditionalPhone(_0x30d86e,_0x418a48[_0x20be('0x18')],_0x5b1ad4,_0x418a48[_0x20be('0x2b')],_0x418a48['waitTime'])[_0x20be('0xa')](function(_0x478b21){_0x556e6f(_0x478b21);});else{return db[_0x20be('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x30d86e['id']},'order':[[_0x20be('0x1d'),_0x20be('0x1e')]]})[_0x20be('0xa')](function(_0x1a4a7c){if(_0x1a4a7c)return activateAdditionalPhone(_0x30d86e,_0x418a48['body'],_0x1a4a7c,_0x418a48['duration'],_0x418a48[_0x20be('0x2c')])['then'](function(_0x4fe9fa){_0x556e6f(_0x4fe9fa);});else{_0x556e6f({'id':_0x30d86e['id'],'phone':''});}})[_0x20be('0x14')](function(_0x4f77b1){logger['error'](_0x20be('0x15'),_0x4f77b1[_0x20be('0x12')]);_0x3c660e(_0xd7ae44[_0x20be('0x11')](0x1f4,_0x4f77b1['message']));});}})['catch'](function(_0x3f6c3b){logger[_0x20be('0x11')](_0x20be('0x15'),_0x3f6c3b[_0x20be('0x12')]);_0x3c660e(_0xd7ae44[_0x20be('0x11')](0x1f4,_0x3f6c3b[_0x20be('0x12')]));});}else _0x556e6f(0x1);});});};function activateAdditionalPhone(_0x17d429,_0x44b8e7,_0x143c10,_0x5555fc,_0x786d53){return new Promise(function(_0x487f01,_0x174ca4){var _0x2ef266;if(_[_0x20be('0x2d')](_0x143c10[_0x20be('0x2e')])){_0x143c10[_0x20be('0x2e')]=moment();}if(moment()>moment(_0x143c10[_0x20be('0x2e')])){_0x2ef266=moment()['add'](_0x786d53||0x3,'minutes');}else{if(_0x143c10['OrderBy']==0x0){_0x2ef266=moment(_0x143c10['scheduledat']);}else{_0x2ef266=moment()[_0x20be('0x2f')](_0x786d53||0x3,_0x20be('0x30'));}}if(_[_0x20be('0x2d')](_0x2ef266)){_0x2ef266=moment()[_0x20be('0x2f')](_0x786d53||0x3,_0x20be('0x30'));}var _0x47d02e={'phone':_0x17d429[_0x20be('0x31')],'active':0x0,'OrderBy':_[_0x20be('0x2d')](_0x17d429[_0x20be('0x1d')])?0x0:_0x17d429['OrderBy'],'scheduledat':moment()[_0x20be('0x2f')](_0x5555fc||0x1,_0x20be('0x30')),'countbusyretry':_0x44b8e7['countbusyretry'],'countcongestionretry':_0x44b8e7[_0x20be('0x1f')],'countnoanswerretry':_0x44b8e7['countnoanswerretry'],'countnosuchnumberretry':_0x44b8e7[_0x20be('0x21')],'countdropretry':_0x44b8e7['countdropretry'],'countabandonedretry':_0x44b8e7[_0x20be('0x25')],'countmachineretry':_0x44b8e7[_0x20be('0x26')],'countagentrejectretry':_0x44b8e7[_0x20be('0x23')],'createdAt':_0x44b8e7[_0x20be('0x32')],'updatedAt':_0x44b8e7[_0x20be('0x33')]};var _0x3a9456={'CmHopperId':_0x17d429['id'],'phone':_0x143c10['phone'],'active':0x0,'OrderBy':_['isNil'](_0x143c10['OrderBy'])?0x0:_0x143c10[_0x20be('0x1d')],'scheduledat':_0x2ef266,'countbusyretry':_0x143c10['countbusyretry'],'countcongestionretry':_0x143c10['countcongestionretry'],'countnoanswerretry':_0x143c10[_0x20be('0x20')],'countnosuchnumberretry':_0x143c10[_0x20be('0x21')],'countdropretry':_0x143c10['countdropretry'],'countabandonedretry':_0x143c10[_0x20be('0x25')],'countmachineretry':_0x143c10[_0x20be('0x26')],'countagentrejectretry':_0x143c10[_0x20be('0x23')],'createdAt':_0x143c10[_0x20be('0x32')],'updatedAt':_0x143c10[_0x20be('0x33')]};return db[_0x20be('0x34')][_0x20be('0x35')](function(_0x3caf29){return db[_0x20be('0x2a')][_0x20be('0x36')](_0x47d02e,{'where':{'id':_0x143c10['id']}},{'transaction':_0x3caf29})['then'](function(){return db[_0x20be('0x16')][_0x20be('0x36')](_0x3a9456,{'where':{'id':_0x17d429['id']}},{'transaction':_0x3caf29});});})['then'](function(_0x5b9cb7){_0x487f01({'id':_0x17d429['id'],'phone':_0x143c10[_0x20be('0x31')]});})[_0x20be('0x14')](function(_0x3f1a1b){logger[_0x20be('0x11')]('activateAdditionalPhone',_0x3f1a1b[_0x20be('0x12')]);_0x174ca4({'error':_0x3f1a1b[_0x20be('0x12')]});});});}exports[_0x20be('0x37')]=function(_0x5764fd){var _0x53eb9f=this;return new Promise(function(_0x2c71e5,_0x50eadb){return db['CmHopper']['update'](_0x5764fd[_0x20be('0x18')]['field'],{'where':{'id':_0x5764fd[_0x20be('0x18')]['id']}})[_0x20be('0xa')](function(_0x3fb9a5){_0x2c71e5(_0x3fb9a5);})[_0x20be('0x14')](function(_0x1693bd){logger[_0x20be('0x11')](_0x20be('0x37'),_0x1693bd['message']);_0x50eadb(_0x53eb9f[_0x20be('0x11')](0x1f4,_0x1693bd[_0x20be('0x12')]));});});}; \ No newline at end of file +var _0x41ea=['add','minutes','countbusyretry','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','then','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ASC','entity','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41ea,0x138));var _0xa41e=function(_0x4a291e,_0x3f129c){_0x4a291e=_0x4a291e-0x0;var _0x3818ff=_0x41ea[_0x4a291e];return _0x3818ff;};'use strict';var _=require(_0xa41e('0x0'));var util=require(_0xa41e('0x1'));var moment=require(_0xa41e('0x2'));var BPromise=require(_0xa41e('0x3'));var rs=require(_0xa41e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa41e('0x5'))['db'];var utils=require(_0xa41e('0x6'));var logger=require(_0xa41e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa41e('0x8')][_0xa41e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25070b,_0x3b8865,_0x312773){return new BPromise(function(_0x2e3eb8,_0x401a92){return client[_0xa41e('0xa')](_0x25070b,_0x312773)['then'](function(_0x4572b2){logger[_0xa41e('0xb')](_0xa41e('0xc'),_0x3b8865,_0xa41e('0xd'));logger[_0xa41e('0xe')](_0xa41e('0xf'),_0x3b8865,_0xa41e('0xd'),JSON[_0xa41e('0x10')](_0x4572b2));if(_0x4572b2[_0xa41e('0x11')]){if(_0x4572b2[_0xa41e('0x11')][_0xa41e('0x12')]===0x1f4){logger[_0xa41e('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3b8865,_0x4572b2[_0xa41e('0x11')][_0xa41e('0x13')]);return _0x401a92(_0x4572b2[_0xa41e('0x11')][_0xa41e('0x13')]);}logger['error'](_0xa41e('0xc'),_0x3b8865,_0x4572b2[_0xa41e('0x11')]['message']);return _0x2e3eb8(_0x4572b2['error'][_0xa41e('0x13')]);}else{logger[_0xa41e('0xb')](_0xa41e('0xc'),_0x3b8865,_0xa41e('0xd'));_0x2e3eb8(_0x4572b2[_0xa41e('0x14')][_0xa41e('0x13')]);}})[_0xa41e('0x15')](function(_0x49e14e){logger[_0xa41e('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3b8865,_0x49e14e);_0x401a92(_0x49e14e);});});}exports['VerifyAdditionalPhones']=function(_0x4abfa2){var _0x32c7cc=this;return new Promise(function(_0x30dae7,_0x1dbd27){return db['CmHopper'][_0xa41e('0x16')]({'raw':!![],'where':{'ContactId':_0x4abfa2['body'][_0xa41e('0x17')],'ListId':_0x4abfa2['body'][_0xa41e('0x18')],'VoiceQueueId':_0x4abfa2[_0xa41e('0x19')][_0xa41e('0x1a')]===undefined?null:_0x4abfa2[_0xa41e('0x19')][_0xa41e('0x1a')],'CampaignId':_0x4abfa2['body']['CampaignId']===undefined?null:_0x4abfa2['body'][_0xa41e('0x1b')]}})['then'](function(_0x50e666){if(_0x50e666!=null){return db[_0xa41e('0x1c')][_0xa41e('0x16')]({'raw':!![],'where':{'CmHopperId':_0x50e666['id'],'OrderBy':{'$gt':_0x50e666[_0xa41e('0x1d')]}},'order':[[_0xa41e('0x1d'),'ASC']]})[_0xa41e('0x1e')](function(_0x34ef7a){var _0x2f6ee4=0x0;if(_0x34ef7a){if(_0x34ef7a['countbusyretry']+_0x34ef7a[_0xa41e('0x1f')]+_0x34ef7a[_0xa41e('0x20')]+_0x34ef7a[_0xa41e('0x21')]+_0x34ef7a[_0xa41e('0x22')]+_0x34ef7a[_0xa41e('0x23')]+_0x34ef7a[_0xa41e('0x24')]+_0x34ef7a[_0xa41e('0x25')]<_0x4abfa2['entity']['dialGlobalMaxRetry'])_0x2f6ee4=0x1;_0x30dae7({'additional':_0x2f6ee4});}else{return db[_0xa41e('0x1c')][_0xa41e('0x16')]({'raw':!![],'where':{'CmHopperId':_0x50e666['id']},'order':[[_0xa41e('0x1d'),_0xa41e('0x26')]]})[_0xa41e('0x1e')](function(_0x14ab40){var _0x4057ac=0x0;if(_0x14ab40){if(_0x14ab40['countbusyretry']+_0x14ab40[_0xa41e('0x1f')]+_0x14ab40['countnoanswerretry']+_0x14ab40['countnosuchnumberretry']+_0x14ab40[_0xa41e('0x22')]+_0x14ab40[_0xa41e('0x23')]+_0x14ab40[_0xa41e('0x24')]+_0x14ab40[_0xa41e('0x25')]<_0x4abfa2[_0xa41e('0x27')][_0xa41e('0x28')])_0x4057ac=0x1;_0x30dae7({'additional':_0x4057ac});}else{_0x30dae7({'additional':0x0});}})['catch'](function(_0x14a83d){logger[_0xa41e('0x11')](_0xa41e('0x29'),_0x14a83d['message']);_0x1dbd27(_0x32c7cc[_0xa41e('0x11')](0x1f4,_0x14a83d[_0xa41e('0x13')]));});}})[_0xa41e('0x15')](function(_0x52f040){logger[_0xa41e('0x11')](_0xa41e('0x29'),_0x52f040[_0xa41e('0x13')]);_0x1dbd27(_0x32c7cc[_0xa41e('0x11')](0x1f4,_0x52f040['message']));});}else _0x30dae7({'additional':0x0});});});};exports[_0xa41e('0x2a')]=function(_0x32ddf5){var _0x59715f=this;return new Promise(function(_0x5e2208,_0xbd5855){return db[_0xa41e('0x2b')][_0xa41e('0x16')]({'raw':!![],'where':{'ContactId':_0x32ddf5['body'][_0xa41e('0x17')],'ListId':_0x32ddf5['body'][_0xa41e('0x18')],'VoiceQueueId':_0x32ddf5[_0xa41e('0x19')][_0xa41e('0x1a')]===undefined?null:_0x32ddf5['body'][_0xa41e('0x1a')],'CampaignId':_0x32ddf5[_0xa41e('0x19')]['CampaignId']===undefined?null:_0x32ddf5[_0xa41e('0x19')][_0xa41e('0x1b')]}})['then'](function(_0x4a1c63){if(_0x4a1c63!=null){return db[_0xa41e('0x1c')][_0xa41e('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4a1c63['id'],'OrderBy':{'$gte':_0x4a1c63[_0xa41e('0x1d')]}},'order':[[_0xa41e('0x1d'),_0xa41e('0x26')]]})[_0xa41e('0x1e')](function(_0x3a96dd){if(_0x3a96dd)return activateAdditionalPhone(_0x4a1c63,_0x32ddf5[_0xa41e('0x19')],_0x3a96dd,_0x32ddf5[_0xa41e('0x2c')],_0x32ddf5[_0xa41e('0x2d')])[_0xa41e('0x1e')](function(_0x23d0a6){_0x5e2208(_0x23d0a6);});else{return db['CmHopperAdditionalPhone'][_0xa41e('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4a1c63['id']},'order':[['OrderBy',_0xa41e('0x26')]]})[_0xa41e('0x1e')](function(_0x52cdde){if(_0x52cdde)return activateAdditionalPhone(_0x4a1c63,_0x32ddf5[_0xa41e('0x19')],_0x52cdde,_0x32ddf5[_0xa41e('0x2c')],_0x32ddf5[_0xa41e('0x2d')])[_0xa41e('0x1e')](function(_0x2c4901){_0x5e2208(_0x2c4901);});else{_0x5e2208({'id':_0x4a1c63['id'],'phone':''});}})[_0xa41e('0x15')](function(_0x4ef131){logger[_0xa41e('0x11')]('VerifyAdditionalPhones',_0x4ef131['message']);_0xbd5855(_0x59715f[_0xa41e('0x11')](0x1f4,_0x4ef131[_0xa41e('0x13')]));});}})[_0xa41e('0x15')](function(_0x308662){logger[_0xa41e('0x11')](_0xa41e('0x29'),_0x308662[_0xa41e('0x13')]);_0xbd5855(_0x59715f[_0xa41e('0x11')](0x1f4,_0x308662[_0xa41e('0x13')]));});}else _0x5e2208(0x1);});});};function activateAdditionalPhone(_0x5a66b5,_0x568599,_0x24c88d,_0x5c568a,_0xe32b8d){return new Promise(function(_0x47ebf8,_0xd1d9f7){var _0x171c73;if(_[_0xa41e('0x2e')](_0x24c88d[_0xa41e('0x2f')])){_0x24c88d[_0xa41e('0x2f')]=moment();}if(moment()>moment(_0x24c88d[_0xa41e('0x2f')])){_0x171c73=moment()[_0xa41e('0x30')](_0xe32b8d||0x3,_0xa41e('0x31'));}else{if(_0x24c88d[_0xa41e('0x1d')]==0x0){_0x171c73=moment(_0x24c88d[_0xa41e('0x2f')]);}else{_0x171c73=moment()[_0xa41e('0x30')](_0xe32b8d||0x3,_0xa41e('0x31'));}}if(_[_0xa41e('0x2e')](_0x171c73)){_0x171c73=moment()['add'](_0xe32b8d||0x3,'minutes');}var _0x2dc694={'phone':_0x5a66b5['phone'],'active':0x0,'OrderBy':_[_0xa41e('0x2e')](_0x5a66b5['OrderBy'])?0x0:_0x5a66b5['OrderBy'],'scheduledat':moment()['add'](_0x5c568a||0x1,_0xa41e('0x31')),'countbusyretry':_0x568599[_0xa41e('0x32')],'countcongestionretry':_0x568599['countcongestionretry'],'countnoanswerretry':_0x568599[_0xa41e('0x20')],'countnosuchnumberretry':_0x568599[_0xa41e('0x21')],'countdropretry':_0x568599[_0xa41e('0x22')],'countabandonedretry':_0x568599[_0xa41e('0x23')],'countmachineretry':_0x568599[_0xa41e('0x24')],'countagentrejectretry':_0x568599['countagentrejectretry'],'createdAt':_0x568599['createdAt'],'updatedAt':_0x568599['updatedAt']};var _0x4c7df4={'CmHopperId':_0x5a66b5['id'],'phone':_0x24c88d[_0xa41e('0x33')],'active':0x0,'OrderBy':_[_0xa41e('0x2e')](_0x24c88d[_0xa41e('0x1d')])?0x0:_0x24c88d['OrderBy'],'scheduledat':_0x171c73,'countbusyretry':_0x24c88d['countbusyretry'],'countcongestionretry':_0x24c88d[_0xa41e('0x1f')],'countnoanswerretry':_0x24c88d['countnoanswerretry'],'countnosuchnumberretry':_0x24c88d[_0xa41e('0x21')],'countdropretry':_0x24c88d[_0xa41e('0x22')],'countabandonedretry':_0x24c88d['countabandonedretry'],'countmachineretry':_0x24c88d[_0xa41e('0x24')],'countagentrejectretry':_0x24c88d['countagentrejectretry'],'createdAt':_0x24c88d[_0xa41e('0x34')],'updatedAt':_0x24c88d[_0xa41e('0x35')]};return db[_0xa41e('0x36')][_0xa41e('0x37')](function(_0x33d5bb){return db[_0xa41e('0x1c')]['update'](_0x2dc694,{'where':{'id':_0x24c88d['id']}},{'transaction':_0x33d5bb})[_0xa41e('0x1e')](function(){return db[_0xa41e('0x2b')][_0xa41e('0x38')](_0x4c7df4,{'where':{'id':_0x5a66b5['id']}},{'transaction':_0x33d5bb});});})[_0xa41e('0x1e')](function(_0x236932){_0x47ebf8({'id':_0x5a66b5['id'],'phone':_0x24c88d['phone']});})[_0xa41e('0x15')](function(_0x35ea8f){logger['error'](_0xa41e('0x39'),_0x35ea8f[_0xa41e('0x13')]);_0xd1d9f7({'error':_0x35ea8f['message']});});});}exports[_0xa41e('0x3a')]=function(_0x35b11a){var _0x17f700=this;return new Promise(function(_0x25e6ec,_0x37f6ea){return db[_0xa41e('0x2b')]['update'](_0x35b11a[_0xa41e('0x19')][_0xa41e('0x3b')],{'where':{'id':_0x35b11a['body']['id']}})['then'](function(_0x26c53d){_0x25e6ec(_0x26c53d);})[_0xa41e('0x15')](function(_0x1420e8){logger[_0xa41e('0x11')](_0xa41e('0x3a'),_0x1420e8['message']);_0x37f6ea(_0x17f700[_0xa41e('0x11')](0x1f4,_0x1420e8[_0xa41e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 59a75e5..f085bf2 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 _0xb9e7=['put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create'];(function(_0xf19427,_0x133c87){var _0x3dca2f=function(_0x23f35c){while(--_0x23f35c){_0xf19427['push'](_0xf19427['shift']());}};_0x3dca2f(++_0x133c87);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0xb9e7[_0x41582d];return _0x59c504;};'use strict';var multer=require('multer');var util=require(_0x7b9e('0x0'));var path=require(_0x7b9e('0x1'));var timeout=require(_0x7b9e('0x2'));var express=require(_0x7b9e('0x3'));var router=express[_0x7b9e('0x4')]();var fs_extra=require(_0x7b9e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7b9e('0x6'));var config=require(_0x7b9e('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x7b9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x7b9e('0x9')]);router[_0x7b9e('0x8')](_0x7b9e('0xa'),auth[_0x7b9e('0xb')](),controller[_0x7b9e('0xc')]);router['post']('/',auth[_0x7b9e('0xb')](),controller[_0x7b9e('0xd')]);router[_0x7b9e('0xe')]('/:id',auth[_0x7b9e('0xb')](),controller['update']);router[_0x7b9e('0xf')](_0x7b9e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b9e('0x10')]=router; \ No newline at end of file +var _0x2c15=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get'];(function(_0x2337b9,_0x8cf60a){var _0xab5f6f=function(_0x57a733){while(--_0x57a733){_0x2337b9['push'](_0x2337b9['shift']());}};_0xab5f6f(++_0x8cf60a);}(_0x2c15,0x6e));var _0x52c1=function(_0x3a7cb3,_0x3c2d39){_0x3a7cb3=_0x3a7cb3-0x0;var _0x4b19dd=_0x2c15[_0x3a7cb3];return _0x4b19dd;};'use strict';var multer=require('multer');var util=require(_0x52c1('0x0'));var path=require(_0x52c1('0x1'));var timeout=require(_0x52c1('0x2'));var express=require(_0x52c1('0x3'));var router=express[_0x52c1('0x4')]();var fs_extra=require(_0x52c1('0x5'));var auth=require(_0x52c1('0x6'));var interaction=require(_0x52c1('0x7'));var config=require('../../config/environment');var controller=require(_0x52c1('0x8'));router[_0x52c1('0x9')]('/',auth[_0x52c1('0xa')](),controller[_0x52c1('0xb')]);router[_0x52c1('0x9')](_0x52c1('0xc'),auth[_0x52c1('0xa')](),controller[_0x52c1('0xd')]);router[_0x52c1('0xe')]('/',auth[_0x52c1('0xa')](),controller[_0x52c1('0xf')]);router['put'](_0x52c1('0xc'),auth[_0x52c1('0xa')](),controller[_0x52c1('0x10')]);router[_0x52c1('0x11')]('/:id',auth[_0x52c1('0xa')](),controller[_0x52c1('0x12')]);module[_0x52c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f09a393..8816be2 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 _0x018c=['exports','contactListQueue','INTEGER','moment','sequelize'];(function(_0xdc3936,_0x2a5866){var _0x570b48=function(_0xaac250){while(--_0xaac250){_0xdc3936['push'](_0xdc3936['shift']());}};_0x570b48(++_0x2a5866);}(_0x018c,0xda));var _0xc018=function(_0x318ca1,_0x4f4133){_0x318ca1=_0x318ca1-0x0;var _0x3dff5c=_0x018c[_0x318ca1];return _0x3dff5c;};'use strict';var moment=require(_0xc018('0x0'));var Sequelize=require(_0xc018('0x1'));module[_0xc018('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc018('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc018('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc018('0x4')],'unique':_0xc018('0x3')}}; \ No newline at end of file +var _0xba34=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0xc871a8,_0x1963b4){var _0x4a3ba1=function(_0xf0cd0a){while(--_0xf0cd0a){_0xc871a8['push'](_0xc871a8['shift']());}};_0x4a3ba1(++_0x1963b4);}(_0xba34,0x119));var _0x4ba3=function(_0x38b30c,_0x3660c2){_0x38b30c=_0x38b30c-0x0;var _0x384eca=_0xba34[_0x38b30c];return _0x384eca;};'use strict';var moment=require(_0x4ba3('0x0'));var Sequelize=require(_0x4ba3('0x1'));module[_0x4ba3('0x2')]={'phone':{'type':Sequelize[_0x4ba3('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4ba3('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4ba3('0x4')],'unique':_0x4ba3('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b7a4713..776407c 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 _0xf56c=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','length','query','nolimit','order','sort','where','VIRTUAL','merge','then','catch','show','includeAll','include','options','find','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xf56c,0x1c0));var _0xcf56=function(_0x1fa48e,_0x9d8448){_0x1fa48e=_0x1fa48e-0x0;var _0x5cc93f=_0xf56c[_0x1fa48e];return _0x5cc93f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf56('0x0'));var zipdir=require(_0xcf56('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf56('0x2'));var moment=require('moment');var BPromise=require(_0xcf56('0x3'));var Mustache=require(_0xcf56('0x4'));var util=require(_0xcf56('0x5'));var path=require('path');var sox=require(_0xcf56('0x6'));var csv=require('to-csv');var ejs=require(_0xcf56('0x7'));var fs=require('fs');var fs_extra=require(_0xcf56('0x8'));var _=require('lodash');var squel=require(_0xcf56('0x9'));var crypto=require('crypto');var jsforce=require(_0xcf56('0xa'));var deskjs=require(_0xcf56('0xb'));var toCsv=require(_0xcf56('0xc'));var querystring=require(_0xcf56('0xd'));var Papa=require(_0xcf56('0xe'));var Redis=require(_0xcf56('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf56('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf56('0x11'))(_0xcf56('0x12'));var utils=require(_0xcf56('0x13'));var config=require(_0xcf56('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf56('0x15'))['db'];function respondWithStatusCode(_0x16567a,_0x4e3544){_0x4e3544=_0x4e3544||0xcc;return function(_0xb8472a){if(_0xb8472a){return _0x16567a[_0xcf56('0x16')](_0x4e3544);}return _0x16567a[_0xcf56('0x17')](_0x4e3544)['end']();};}function respondWithResult(_0xc9afd8,_0x16b787){_0x16b787=_0x16b787||0xc8;return function(_0x10807f){if(_0x10807f){return _0xc9afd8[_0xcf56('0x17')](_0x16b787)[_0xcf56('0x18')](_0x10807f);}};}function respondWithFilteredResult(_0x2a26cd,_0x1272c9){return function(_0x495c33){if(_0x495c33){var _0x593eaa=typeof _0x1272c9[_0xcf56('0x19')]===_0xcf56('0x1a')&&typeof _0x1272c9[_0xcf56('0x1b')]===_0xcf56('0x1a');var _0x726495=_0x495c33[_0xcf56('0x1c')];var _0x512aaa=_0x593eaa?0x0:_0x1272c9[_0xcf56('0x19')];var _0x4890a5=_0x593eaa?_0x495c33[_0xcf56('0x1c')]:_0x1272c9[_0xcf56('0x19')]+_0x1272c9[_0xcf56('0x1b')];var _0x31b89c;if(_0x4890a5>=_0x726495){_0x4890a5=_0x726495;_0x31b89c=0xc8;}else{_0x31b89c=0xce;}_0x2a26cd[_0xcf56('0x17')](_0x31b89c);return _0x2a26cd['set'](_0xcf56('0x1d'),_0x512aaa+'-'+_0x4890a5+'/'+_0x726495)[_0xcf56('0x18')](_0x495c33);}return null;};}function patchUpdates(_0xeb3d00){return function(_0x195728){try{jsonpatch[_0xcf56('0x1e')](_0x195728,_0xeb3d00,!![]);}catch(_0xaf2a21){return BPromise[_0xcf56('0x1f')](_0xaf2a21);}return _0x195728[_0xcf56('0x20')]();};}function saveUpdates(_0xda7ed3,_0x313b89){return function(_0x3b1259){if(_0x3b1259){return _0x3b1259[_0xcf56('0x21')](_0xda7ed3)['then'](function(_0x4778bf){return _0x4778bf;});}return null;};}function removeEntity(_0x4f0b86,_0x119f4e){return function(_0x551716){if(_0x551716){return _0x551716[_0xcf56('0x22')]()['then'](function(){_0x4f0b86[_0xcf56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c593b,_0x4cb374){return function(_0x3fe876){if(!_0x3fe876){_0x4c593b[_0xcf56('0x16')](0x194);}return _0x3fe876;};}function handleError(_0x24b4f0,_0x435615){_0x435615=_0x435615||0x1f4;return function(_0x3606e2){logger['error'](_0x3606e2[_0xcf56('0x23')]);if(_0x3606e2['name']){delete _0x3606e2[_0xcf56('0x24')];}_0x24b4f0[_0xcf56('0x17')](_0x435615)['send'](_0x3606e2);};}exports[_0xcf56('0x25')]=function(_0x1f4e1f,_0x2a4569){var _0x201c2b={},_0x517d41={},_0x2b1de6={'count':0x0,'rows':[]};var _0x10e8d9=_[_0xcf56('0x26')](db[_0xcf56('0x27')][_0xcf56('0x28')],function(_0x30f5ee){return{'name':_0x30f5ee[_0xcf56('0x29')],'type':_0x30f5ee[_0xcf56('0x2a')]['key']};});_0x517d41['model']=_[_0xcf56('0x26')](_0x10e8d9,'name');_0x517d41['query']=_[_0xcf56('0x2b')](_0x1f4e1f['query']);_0x517d41[_0xcf56('0x2c')]=_[_0xcf56('0x2d')](_0x517d41[_0xcf56('0x2e')],_0x517d41['query']);_0x201c2b[_0xcf56('0x2f')]=_[_0xcf56('0x2d')](_0x517d41[_0xcf56('0x2e')],qs[_0xcf56('0x30')](_0x1f4e1f['query'][_0xcf56('0x30')]));_0x201c2b[_0xcf56('0x2f')]=_0x201c2b[_0xcf56('0x2f')][_0xcf56('0x31')]?_0x201c2b[_0xcf56('0x2f')]:_0x517d41[_0xcf56('0x2e')];if(!_0x1f4e1f[_0xcf56('0x32')]['hasOwnProperty'](_0xcf56('0x33'))){_0x201c2b[_0xcf56('0x1b')]=qs[_0xcf56('0x1b')](_0x1f4e1f[_0xcf56('0x32')][_0xcf56('0x1b')]);_0x201c2b[_0xcf56('0x19')]=qs['offset'](_0x1f4e1f['query']['offset']);}_0x201c2b[_0xcf56('0x34')]=qs[_0xcf56('0x35')](_0x1f4e1f[_0xcf56('0x32')][_0xcf56('0x35')]);_0x201c2b[_0xcf56('0x36')]=qs[_0xcf56('0x2c')](_['pick'](_0x1f4e1f[_0xcf56('0x32')],_0x517d41['filters']),_0x10e8d9);if(_0x1f4e1f[_0xcf56('0x32')]['filter']){_0x201c2b[_0xcf56('0x36')]=_['merge'](_0x201c2b[_0xcf56('0x36')],{'$or':_[_0xcf56('0x26')](_0x10e8d9,function(_0x312cb2){if(_0x312cb2[_0xcf56('0x2a')]!==_0xcf56('0x37')){var _0x320bbb={};_0x320bbb[_0x312cb2[_0xcf56('0x24')]]={'$like':'%'+_0x1f4e1f[_0xcf56('0x32')]['filter']+'%'};return _0x320bbb;}})});}_0x201c2b=_[_0xcf56('0x38')]({},_0x201c2b,_0x1f4e1f['options']);var _0xb8d510={'where':_0x201c2b[_0xcf56('0x36')]};return db[_0xcf56('0x27')]['count'](_0xb8d510)['then'](function(_0x13251c){_0x2b1de6[_0xcf56('0x1c')]=_0x13251c;if(_0x1f4e1f[_0xcf56('0x32')]['includeAll']){_0x201c2b['include']=[{'all':!![]}];}return db[_0xcf56('0x27')]['findAll'](_0x201c2b);})[_0xcf56('0x39')](function(_0x88b6dd){_0x2b1de6['rows']=_0x88b6dd;return _0x2b1de6;})[_0xcf56('0x39')](respondWithFilteredResult(_0x2a4569,_0x201c2b))[_0xcf56('0x3a')](handleError(_0x2a4569,null));};exports[_0xcf56('0x3b')]=function(_0x281e75,_0x5b90ba){var _0x51d42c={'raw':!![],'where':{'id':_0x281e75['params']['id']}},_0x45bd6f={};_0x45bd6f[_0xcf56('0x2e')]=_[_0xcf56('0x2b')](db[_0xcf56('0x27')]['rawAttributes']);_0x45bd6f[_0xcf56('0x32')]=_[_0xcf56('0x2b')](_0x281e75['query']);_0x45bd6f['filters']=_[_0xcf56('0x2d')](_0x45bd6f[_0xcf56('0x2e')],_0x45bd6f[_0xcf56('0x32')]);_0x51d42c['attributes']=_[_0xcf56('0x2d')](_0x45bd6f['model'],qs[_0xcf56('0x30')](_0x281e75[_0xcf56('0x32')][_0xcf56('0x30')]));_0x51d42c[_0xcf56('0x2f')]=_0x51d42c[_0xcf56('0x2f')][_0xcf56('0x31')]?_0x51d42c[_0xcf56('0x2f')]:_0x45bd6f[_0xcf56('0x2e')];if(_0x281e75[_0xcf56('0x32')][_0xcf56('0x3c')]){_0x51d42c[_0xcf56('0x3d')]=[{'all':!![]}];}_0x51d42c=_[_0xcf56('0x38')]({},_0x51d42c,_0x281e75[_0xcf56('0x3e')]);return db[_0xcf56('0x27')][_0xcf56('0x3f')](_0x51d42c)['then'](handleEntityNotFound(_0x5b90ba,null))[_0xcf56('0x39')](respondWithResult(_0x5b90ba,null))[_0xcf56('0x3a')](handleError(_0x5b90ba,null));};exports[_0xcf56('0x21')]=function(_0x1ed2ac,_0x5822e4){if(_0x1ed2ac[_0xcf56('0x40')]['id']){delete _0x1ed2ac[_0xcf56('0x40')]['id'];}return db[_0xcf56('0x27')][_0xcf56('0x3f')]({'where':{'id':_0x1ed2ac['params']['id']}})[_0xcf56('0x39')](handleEntityNotFound(_0x5822e4,null))[_0xcf56('0x39')](saveUpdates(_0x1ed2ac[_0xcf56('0x40')],null))[_0xcf56('0x39')](respondWithResult(_0x5822e4,null))[_0xcf56('0x3a')](handleError(_0x5822e4,null));};exports[_0xcf56('0x22')]=function(_0x3330e6,_0x50e938){return db[_0xcf56('0x27')][_0xcf56('0x3f')]({'where':{'id':_0x3330e6['params']['id']}})['then'](handleEntityNotFound(_0x50e938,null))[_0xcf56('0x39')](removeEntity(_0x50e938,null))[_0xcf56('0x3a')](handleError(_0x50e938,null));};exports[_0xcf56('0x41')]=function(_0x5cffde,_0x1c62ac){return db[_0xcf56('0x27')][_0xcf56('0x41')]()['then'](respondWithResult(_0x1c62ac,null))[_0xcf56('0x3a')](handleError(_0x1c62ac,null));}; \ No newline at end of file +var _0x1b38=['moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x1b38,0x95));var _0x81b3=function(_0x3273c5,_0x547a99){_0x3273c5=_0x3273c5-0x0;var _0x1f7017=_0x1b38[_0x3273c5];return _0x1f7017;};'use strict';var emlformat=require(_0x81b3('0x0'));var rimraf=require(_0x81b3('0x1'));var zipdir=require(_0x81b3('0x2'));var jsonpatch=require(_0x81b3('0x3'));var rp=require(_0x81b3('0x4'));var moment=require(_0x81b3('0x5'));var BPromise=require(_0x81b3('0x6'));var Mustache=require(_0x81b3('0x7'));var util=require(_0x81b3('0x8'));var path=require(_0x81b3('0x9'));var sox=require('sox');var csv=require(_0x81b3('0xa'));var ejs=require(_0x81b3('0xb'));var fs=require('fs');var fs_extra=require(_0x81b3('0xc'));var _=require(_0x81b3('0xd'));var squel=require(_0x81b3('0xe'));var crypto=require(_0x81b3('0xf'));var jsforce=require(_0x81b3('0x10'));var deskjs=require(_0x81b3('0x11'));var toCsv=require(_0x81b3('0xa'));var querystring=require(_0x81b3('0x12'));var Papa=require(_0x81b3('0x13'));var Redis=require(_0x81b3('0x14'));var authService=require(_0x81b3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x81b3('0x16'));var hardwareService=require(_0x81b3('0x17'));var logger=require(_0x81b3('0x18'))(_0x81b3('0x19'));var utils=require(_0x81b3('0x1a'));var config=require(_0x81b3('0x1b'));var licenseUtil=require(_0x81b3('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19171c,_0x16b1d1){_0x16b1d1=_0x16b1d1||0xcc;return function(_0x1869e1){if(_0x1869e1){return _0x19171c[_0x81b3('0x1d')](_0x16b1d1);}return _0x19171c[_0x81b3('0x1e')](_0x16b1d1)[_0x81b3('0x1f')]();};}function respondWithResult(_0x4404c8,_0x50599d){_0x50599d=_0x50599d||0xc8;return function(_0x2a16df){if(_0x2a16df){return _0x4404c8[_0x81b3('0x1e')](_0x50599d)['json'](_0x2a16df);}};}function respondWithFilteredResult(_0x34a24d,_0xfb1b57){return function(_0xdb801e){if(_0xdb801e){var _0x212785=typeof _0xfb1b57[_0x81b3('0x20')]==='undefined'&&typeof _0xfb1b57[_0x81b3('0x21')]==='undefined';var _0x1d7da8=_0xdb801e[_0x81b3('0x22')];var _0x1be39a=_0x212785?0x0:_0xfb1b57['offset'];var _0x147d9c=_0x212785?_0xdb801e[_0x81b3('0x22')]:_0xfb1b57[_0x81b3('0x20')]+_0xfb1b57['limit'];var _0x50f267;if(_0x147d9c>=_0x1d7da8){_0x147d9c=_0x1d7da8;_0x50f267=0xc8;}else{_0x50f267=0xce;}_0x34a24d['status'](_0x50f267);return _0x34a24d['set'](_0x81b3('0x23'),_0x1be39a+'-'+_0x147d9c+'/'+_0x1d7da8)[_0x81b3('0x24')](_0xdb801e);}return null;};}function patchUpdates(_0x276594){return function(_0x245c54){try{jsonpatch[_0x81b3('0x25')](_0x245c54,_0x276594,!![]);}catch(_0x5b1f8e){return BPromise[_0x81b3('0x26')](_0x5b1f8e);}return _0x245c54['save']();};}function saveUpdates(_0x4371b9,_0x4dfc23){return function(_0x2ffc94){if(_0x2ffc94){return _0x2ffc94['update'](_0x4371b9)['then'](function(_0x4483b8){return _0x4483b8;});}return null;};}function removeEntity(_0x3e019f,_0x151743){return function(_0x179c40){if(_0x179c40){return _0x179c40[_0x81b3('0x27')]()[_0x81b3('0x28')](function(){_0x3e019f[_0x81b3('0x1e')](0xcc)[_0x81b3('0x1f')]();});}};}function handleEntityNotFound(_0x9da83f,_0x1e55d5){return function(_0x580a62){if(!_0x580a62){_0x9da83f[_0x81b3('0x1d')](0x194);}return _0x580a62;};}function handleError(_0x45fefb,_0xd2fd88){_0xd2fd88=_0xd2fd88||0x1f4;return function(_0x205df4){logger[_0x81b3('0x29')](_0x205df4[_0x81b3('0x2a')]);if(_0x205df4[_0x81b3('0x2b')]){delete _0x205df4['name'];}_0x45fefb[_0x81b3('0x1e')](_0xd2fd88)[_0x81b3('0x2c')](_0x205df4);};}exports[_0x81b3('0x2d')]=function(_0x591b76,_0x4e05f0){var _0x51c4c9={},_0x533519={},_0x3d9444={'count':0x0,'rows':[]};var _0x57cd87=_[_0x81b3('0x2e')](db[_0x81b3('0x2f')][_0x81b3('0x30')],function(_0x440dd6){return{'name':_0x440dd6[_0x81b3('0x31')],'type':_0x440dd6[_0x81b3('0x32')][_0x81b3('0x33')]};});_0x533519[_0x81b3('0x34')]=_['map'](_0x57cd87,_0x81b3('0x2b'));_0x533519[_0x81b3('0x35')]=_[_0x81b3('0x36')](_0x591b76[_0x81b3('0x35')]);_0x533519[_0x81b3('0x37')]=_[_0x81b3('0x38')](_0x533519[_0x81b3('0x34')],_0x533519['query']);_0x51c4c9['attributes']=_[_0x81b3('0x38')](_0x533519['model'],qs[_0x81b3('0x39')](_0x591b76[_0x81b3('0x35')]['fields']));_0x51c4c9[_0x81b3('0x3a')]=_0x51c4c9[_0x81b3('0x3a')]['length']?_0x51c4c9[_0x81b3('0x3a')]:_0x533519['model'];if(!_0x591b76[_0x81b3('0x35')]['hasOwnProperty'](_0x81b3('0x3b'))){_0x51c4c9[_0x81b3('0x21')]=qs['limit'](_0x591b76[_0x81b3('0x35')][_0x81b3('0x21')]);_0x51c4c9[_0x81b3('0x20')]=qs[_0x81b3('0x20')](_0x591b76['query']['offset']);}_0x51c4c9['order']=qs[_0x81b3('0x3c')](_0x591b76['query'][_0x81b3('0x3c')]);_0x51c4c9[_0x81b3('0x3d')]=qs[_0x81b3('0x37')](_['pick'](_0x591b76[_0x81b3('0x35')],_0x533519[_0x81b3('0x37')]),_0x57cd87);if(_0x591b76['query']['filter']){_0x51c4c9[_0x81b3('0x3d')]=_[_0x81b3('0x3e')](_0x51c4c9[_0x81b3('0x3d')],{'$or':_[_0x81b3('0x2e')](_0x57cd87,function(_0x22be45){if(_0x22be45[_0x81b3('0x32')]!==_0x81b3('0x3f')){var _0x42fc88={};_0x42fc88[_0x22be45['name']]={'$like':'%'+_0x591b76[_0x81b3('0x35')][_0x81b3('0x40')]+'%'};return _0x42fc88;}})});}_0x51c4c9=_[_0x81b3('0x3e')]({},_0x51c4c9,_0x591b76[_0x81b3('0x41')]);var _0x1e8446={'where':_0x51c4c9[_0x81b3('0x3d')]};return db[_0x81b3('0x2f')][_0x81b3('0x22')](_0x1e8446)[_0x81b3('0x28')](function(_0x3f6d31){_0x3d9444[_0x81b3('0x22')]=_0x3f6d31;if(_0x591b76[_0x81b3('0x35')][_0x81b3('0x42')]){_0x51c4c9[_0x81b3('0x43')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x81b3('0x44')](_0x51c4c9);})['then'](function(_0x3c4adb){_0x3d9444[_0x81b3('0x45')]=_0x3c4adb;return _0x3d9444;})[_0x81b3('0x28')](respondWithFilteredResult(_0x4e05f0,_0x51c4c9))[_0x81b3('0x46')](handleError(_0x4e05f0,null));};exports[_0x81b3('0x47')]=function(_0x39add2,_0x4661d3){var _0x5d1748={'raw':!![],'where':{'id':_0x39add2[_0x81b3('0x48')]['id']}},_0x5296ef={};_0x5296ef[_0x81b3('0x34')]=_['keys'](db[_0x81b3('0x2f')]['rawAttributes']);_0x5296ef[_0x81b3('0x35')]=_[_0x81b3('0x36')](_0x39add2['query']);_0x5296ef['filters']=_[_0x81b3('0x38')](_0x5296ef[_0x81b3('0x34')],_0x5296ef[_0x81b3('0x35')]);_0x5d1748[_0x81b3('0x3a')]=_[_0x81b3('0x38')](_0x5296ef[_0x81b3('0x34')],qs[_0x81b3('0x39')](_0x39add2[_0x81b3('0x35')]['fields']));_0x5d1748['attributes']=_0x5d1748[_0x81b3('0x3a')]['length']?_0x5d1748['attributes']:_0x5296ef[_0x81b3('0x34')];if(_0x39add2[_0x81b3('0x35')][_0x81b3('0x42')]){_0x5d1748[_0x81b3('0x43')]=[{'all':!![]}];}_0x5d1748=_[_0x81b3('0x3e')]({},_0x5d1748,_0x39add2[_0x81b3('0x41')]);return db[_0x81b3('0x2f')][_0x81b3('0x49')](_0x5d1748)['then'](handleEntityNotFound(_0x4661d3,null))[_0x81b3('0x28')](respondWithResult(_0x4661d3,null))[_0x81b3('0x46')](handleError(_0x4661d3,null));};exports[_0x81b3('0x4a')]=function(_0x222b96,_0x5c9427){if(_0x222b96[_0x81b3('0x4b')]['id']){delete _0x222b96[_0x81b3('0x4b')]['id'];}return db[_0x81b3('0x2f')][_0x81b3('0x49')]({'where':{'id':_0x222b96[_0x81b3('0x48')]['id']}})[_0x81b3('0x28')](handleEntityNotFound(_0x5c9427,null))['then'](saveUpdates(_0x222b96['body'],null))[_0x81b3('0x28')](respondWithResult(_0x5c9427,null))[_0x81b3('0x46')](handleError(_0x5c9427,null));};exports[_0x81b3('0x27')]=function(_0x261094,_0xfa3738){return db[_0x81b3('0x2f')][_0x81b3('0x49')]({'where':{'id':_0x261094['params']['id']}})[_0x81b3('0x28')](handleEntityNotFound(_0xfa3738,null))[_0x81b3('0x28')](removeEntity(_0xfa3738,null))[_0x81b3('0x46')](handleError(_0xfa3738,null));};exports[_0x81b3('0x4c')]=function(_0x183346,_0x8c8305){return db[_0x81b3('0x2f')][_0x81b3('0x4c')]()['then'](respondWithResult(_0x8c8305,null))[_0x81b3('0x46')](handleError(_0x8c8305,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ae51746..51fa278 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 _0x15ee=['api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','util'];(function(_0x25133,_0x3e120d){var _0x56063a=function(_0x3cffdd){while(--_0x3cffdd){_0x25133['push'](_0x25133['shift']());}};_0x56063a(++_0x3e120d);}(_0x15ee,0x11e));var _0xe15e=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0x15ee[_0x2242a1];return _0x2c298b;};'use strict';var _=require(_0xe15e('0x0'));var util=require(_0xe15e('0x1'));var logger=require('../../config/logger')(_0xe15e('0x2'));var moment=require(_0xe15e('0x3'));var BPromise=require(_0xe15e('0x4'));var rp=require(_0xe15e('0x5'));var fs=require('fs');var path=require(_0xe15e('0x6'));var rimraf=require(_0xe15e('0x7'));var config=require('../../config/environment');var attributes=require(_0xe15e('0x8'));module['exports']=function(_0x2b9687,_0x5eca65){return _0x2b9687[_0xe15e('0x9')](_0xe15e('0xa'),attributes,{'tableName':_0xe15e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3882=['../../config/environment','CmHopperBlack','lodash','api','moment','bluebird','path','rimraf'];(function(_0x22c015,_0x155560){var _0x779468=function(_0x2bd1da){while(--_0x2bd1da){_0x22c015['push'](_0x22c015['shift']());}};_0x779468(++_0x155560);}(_0x3882,0x142));var _0x2388=function(_0x197a21,_0x15173f){_0x197a21=_0x197a21-0x0;var _0x579012=_0x3882[_0x197a21];return _0x579012;};'use strict';var _=require(_0x2388('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2388('0x1'));var moment=require(_0x2388('0x2'));var BPromise=require(_0x2388('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2388('0x4'));var rimraf=require(_0x2388('0x5'));var config=require(_0x2388('0x6'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x1263e8,_0x486197){return _0x1263e8['define'](_0x2388('0x7'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 34acfdc..ca8b77d 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 _0x353f=['message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','body','catch','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s'];(function(_0x27219b,_0x1495d0){var _0x2d4c32=function(_0x1d5299){while(--_0x1d5299){_0x27219b['push'](_0x27219b['shift']());}};_0x2d4c32(++_0x1495d0);}(_0x353f,0x83));var _0xf353=function(_0x1ccc4e,_0x18918f){_0x1ccc4e=_0x1ccc4e-0x0;var _0x1965fe=_0x353f[_0x1ccc4e];return _0x1965fe;};'use strict';var _=require(_0xf353('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf353('0x1'));var rs=require(_0xf353('0x2'));var fs=require('fs');var Redis=require(_0xf353('0x3'));var db=require(_0xf353('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf353('0x5'))(_0xf353('0x6'));var config=require(_0xf353('0x7'));var jayson=require(_0xf353('0x8'));var client=jayson[_0xf353('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x586a6b,_0x27630c,_0x528325){return new BPromise(function(_0x49ce1d,_0x7e158d){return client['request'](_0x586a6b,_0x528325)['then'](function(_0x2b7d44){logger[_0xf353('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x27630c,_0xf353('0xb'));logger[_0xf353('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x27630c,_0xf353('0xb'),JSON[_0xf353('0xd')](_0x2b7d44));if(_0x2b7d44['error']){if(_0x2b7d44[_0xf353('0xe')][_0xf353('0xf')]===0x1f4){logger[_0xf353('0xe')](_0xf353('0x10'),_0x27630c,_0x2b7d44[_0xf353('0xe')][_0xf353('0x11')]);return _0x7e158d(_0x2b7d44[_0xf353('0xe')][_0xf353('0x11')]);}logger[_0xf353('0xe')](_0xf353('0x10'),_0x27630c,_0x2b7d44[_0xf353('0xe')][_0xf353('0x11')]);return _0x49ce1d(_0x2b7d44[_0xf353('0xe')]['message']);}else{logger[_0xf353('0xa')](_0xf353('0x10'),_0x27630c,_0xf353('0xb'));_0x49ce1d(_0x2b7d44[_0xf353('0x12')][_0xf353('0x11')]);}})['catch'](function(_0x50525c){logger['error'](_0xf353('0x10'),_0x27630c,_0x50525c);_0x7e158d(_0x50525c);});});}exports[_0xf353('0x13')]=function(_0x4c1e0a){var _0x34a5eb=this;return new Promise(function(_0x58a456,_0x31cbc4){return db[_0xf353('0x14')][_0xf353('0x15')]({'raw':_0x4c1e0a[_0xf353('0x16')]?_0x4c1e0a[_0xf353('0x16')][_0xf353('0x17')]===undefined?!![]:![]:!![],'where':_0x4c1e0a[_0xf353('0x16')]?_0x4c1e0a[_0xf353('0x16')][_0xf353('0x18')]||null:null,'attributes':_0x4c1e0a[_0xf353('0x16')]?_0x4c1e0a['options'][_0xf353('0x19')]||null:null,'limit':_0x4c1e0a[_0xf353('0x16')]?_0x4c1e0a['options'][_0xf353('0x1a')]||null:null,'include':_0x4c1e0a['options']?_0x4c1e0a['options'][_0xf353('0x1b')]?_['map'](_0x4c1e0a[_0xf353('0x16')][_0xf353('0x1b')],function(_0x8d98f4){return{'model':db[_0x8d98f4['model']],'as':_0x8d98f4['as'],'attributes':_0x8d98f4[_0xf353('0x19')],'include':_0x8d98f4[_0xf353('0x1b')]?_[_0xf353('0x1c')](_0x8d98f4[_0xf353('0x1b')],function(_0x4d907c){return{'model':db[_0x4d907c['model']],'as':_0x4d907c['as'],'attributes':_0x4d907c[_0xf353('0x19')],'include':_0x4d907c[_0xf353('0x1b')]?_[_0xf353('0x1c')](_0x4d907c[_0xf353('0x1b')],function(_0x4b9d36){return{'model':db[_0x4b9d36[_0xf353('0x1d')]],'as':_0x4b9d36['as'],'attributes':_0x4b9d36[_0xf353('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf353('0x1e')](function(_0x18f0d4){logger[_0xf353('0xa')]('GetCmHopperBlack',_0x4c1e0a);logger['debug']('GetCmHopperBlack',_0x4c1e0a,JSON[_0xf353('0xd')](_0x18f0d4));_0x58a456(_0x18f0d4);})['catch'](function(_0x4e1b9b){logger[_0xf353('0xe')](_0xf353('0x13'),_0x4e1b9b['message'],_0x4c1e0a);_0x31cbc4(_0x34a5eb[_0xf353('0xe')](0x1f4,_0x4e1b9b[_0xf353('0x11')]));});});};exports[_0xf353('0x1f')]=function(_0x486f74){var _0x309d54=this;return new Promise(function(_0x5b0e5c,_0x10669d){return db[_0xf353('0x14')][_0xf353('0x20')](_0x486f74[_0xf353('0x21')],{'raw':_0x486f74['options']?_0x486f74['options'][_0xf353('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x486f74[_0xf353('0x16')]?_0x486f74[_0xf353('0x16')][_0xf353('0x18')]||null:null,'attributes':_0x486f74[_0xf353('0x16')]?_0x486f74[_0xf353('0x16')]['attributes']||null:null,'limit':_0x486f74[_0xf353('0x16')]?_0x486f74[_0xf353('0x16')][_0xf353('0x1a')]||null:null})[_0xf353('0x1e')](function(_0x4bd783){logger[_0xf353('0xa')]('UpdateCmHopperBlack',_0x486f74);logger[_0xf353('0xc')](_0xf353('0x1f'),_0x486f74,JSON['stringify'](_0x4bd783));_0x5b0e5c(_0x4bd783);})[_0xf353('0x22')](function(_0xc525e8){logger['error'](_0xf353('0x1f'),_0xc525e8[_0xf353('0x11')],_0x486f74);_0x10669d(_0x309d54[_0xf353('0xe')](0x1f4,_0xc525e8[_0xf353('0x11')]));});});};exports[_0xf353('0x23')]=function(_0x22b24a){var _0x949af6=this;return new Promise(function(_0x3726ec,_0x49e735){return db[_0xf353('0x14')][_0xf353('0x24')]({'where':_0x22b24a[_0xf353('0x16')]?_0x22b24a['options'][_0xf353('0x18')]||null:null})[_0xf353('0x1e')](function(_0x1e2816){logger[_0xf353('0xa')]('DestroyCmHopperBlack',_0x22b24a);logger[_0xf353('0xc')](_0xf353('0x23'),_0x22b24a,JSON[_0xf353('0xd')](_0x1e2816));_0x3726ec(_0x1e2816);})[_0xf353('0x22')](function(_0x339861){logger[_0xf353('0xe')](_0xf353('0x23'),_0x339861[_0xf353('0x11')],_0x22b24a);_0x49e735(_0x949af6[_0xf353('0xe')](0x1f4,_0x339861[_0xf353('0x11')]));});});}; \ No newline at end of file +var _0xbea8=['../../mysqldb','../../config/logger','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','map','model','include','debug','stringify','update','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','moment','randomstring'];(function(_0x4766cf,_0x110454){var _0x1b0f93=function(_0x5ee458){while(--_0x5ee458){_0x4766cf['push'](_0x4766cf['shift']());}};_0x1b0f93(++_0x110454);}(_0xbea8,0x141));var _0x8bea=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xbea8[_0x329437];return _0x3789d9;};'use strict';var _=require(_0x8bea('0x0'));var util=require('util');var moment=require(_0x8bea('0x1'));var BPromise=require('bluebird');var rs=require(_0x8bea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bea('0x4'))(_0x8bea('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8bea('0x6')][_0x8bea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x457526,_0x2f3c2a,_0x368a8e){return new BPromise(function(_0x4ad847,_0x1d8e2b){return client[_0x8bea('0x8')](_0x457526,_0x368a8e)[_0x8bea('0x9')](function(_0x5df391){logger[_0x8bea('0xa')](_0x8bea('0xb'),_0x2f3c2a,_0x8bea('0xc'));logger['debug'](_0x8bea('0xd'),_0x2f3c2a,_0x8bea('0xc'),JSON['stringify'](_0x5df391));if(_0x5df391[_0x8bea('0xe')]){if(_0x5df391[_0x8bea('0xe')][_0x8bea('0xf')]===0x1f4){logger['error'](_0x8bea('0xb'),_0x2f3c2a,_0x5df391[_0x8bea('0xe')][_0x8bea('0x10')]);return _0x1d8e2b(_0x5df391[_0x8bea('0xe')]['message']);}logger[_0x8bea('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x2f3c2a,_0x5df391[_0x8bea('0xe')][_0x8bea('0x10')]);return _0x4ad847(_0x5df391[_0x8bea('0xe')][_0x8bea('0x10')]);}else{logger[_0x8bea('0xa')](_0x8bea('0xb'),_0x2f3c2a,_0x8bea('0xc'));_0x4ad847(_0x5df391[_0x8bea('0x11')][_0x8bea('0x10')]);}})[_0x8bea('0x12')](function(_0x1ca82d){logger[_0x8bea('0xe')](_0x8bea('0xb'),_0x2f3c2a,_0x1ca82d);_0x1d8e2b(_0x1ca82d);});});}exports[_0x8bea('0x13')]=function(_0x15fa5c){var _0x4198fa=this;return new Promise(function(_0x2622bc,_0x5f0ee5){return db[_0x8bea('0x14')][_0x8bea('0x15')]({'raw':_0x15fa5c[_0x8bea('0x16')]?_0x15fa5c[_0x8bea('0x16')][_0x8bea('0x17')]===undefined?!![]:![]:!![],'where':_0x15fa5c[_0x8bea('0x16')]?_0x15fa5c['options']['where']||null:null,'attributes':_0x15fa5c[_0x8bea('0x16')]?_0x15fa5c[_0x8bea('0x16')][_0x8bea('0x18')]||null:null,'limit':_0x15fa5c[_0x8bea('0x16')]?_0x15fa5c[_0x8bea('0x16')][_0x8bea('0x19')]||null:null,'include':_0x15fa5c['options']?_0x15fa5c['options']['include']?_[_0x8bea('0x1a')](_0x15fa5c['options']['include'],function(_0x5a838a){return{'model':db[_0x5a838a[_0x8bea('0x1b')]],'as':_0x5a838a['as'],'attributes':_0x5a838a[_0x8bea('0x18')],'include':_0x5a838a['include']?_[_0x8bea('0x1a')](_0x5a838a[_0x8bea('0x1c')],function(_0x20c6e0){return{'model':db[_0x20c6e0['model']],'as':_0x20c6e0['as'],'attributes':_0x20c6e0[_0x8bea('0x18')],'include':_0x20c6e0[_0x8bea('0x1c')]?_[_0x8bea('0x1a')](_0x20c6e0[_0x8bea('0x1c')],function(_0x30a91d){return{'model':db[_0x30a91d[_0x8bea('0x1b')]],'as':_0x30a91d['as'],'attributes':_0x30a91d[_0x8bea('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8bea('0x9')](function(_0xb8b62c){logger[_0x8bea('0xa')](_0x8bea('0x13'),_0x15fa5c);logger[_0x8bea('0x1d')](_0x8bea('0x13'),_0x15fa5c,JSON[_0x8bea('0x1e')](_0xb8b62c));_0x2622bc(_0xb8b62c);})['catch'](function(_0x325d32){logger[_0x8bea('0xe')](_0x8bea('0x13'),_0x325d32[_0x8bea('0x10')],_0x15fa5c);_0x5f0ee5(_0x4198fa[_0x8bea('0xe')](0x1f4,_0x325d32[_0x8bea('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x28c07b){var _0x469363=this;return new Promise(function(_0x37a842,_0x10b79a){return db[_0x8bea('0x14')][_0x8bea('0x1f')](_0x28c07b[_0x8bea('0x20')],{'raw':_0x28c07b[_0x8bea('0x16')]?_0x28c07b[_0x8bea('0x16')][_0x8bea('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28c07b[_0x8bea('0x16')]?_0x28c07b[_0x8bea('0x16')][_0x8bea('0x21')]||null:null,'attributes':_0x28c07b['options']?_0x28c07b[_0x8bea('0x16')][_0x8bea('0x18')]||null:null,'limit':_0x28c07b[_0x8bea('0x16')]?_0x28c07b[_0x8bea('0x16')]['limit']||null:null})['then'](function(_0x50f664){logger[_0x8bea('0xa')](_0x8bea('0x22'),_0x28c07b);logger[_0x8bea('0x1d')]('UpdateCmHopperBlack',_0x28c07b,JSON[_0x8bea('0x1e')](_0x50f664));_0x37a842(_0x50f664);})['catch'](function(_0xc447c){logger[_0x8bea('0xe')](_0x8bea('0x22'),_0xc447c[_0x8bea('0x10')],_0x28c07b);_0x10b79a(_0x469363[_0x8bea('0xe')](0x1f4,_0xc447c['message']));});});};exports[_0x8bea('0x23')]=function(_0x36ffa6){var _0x582167=this;return new Promise(function(_0x5010a3,_0x2c21f3){return db[_0x8bea('0x14')]['destroy']({'where':_0x36ffa6[_0x8bea('0x16')]?_0x36ffa6['options'][_0x8bea('0x21')]||null:null})[_0x8bea('0x9')](function(_0x4b269b){logger[_0x8bea('0xa')](_0x8bea('0x23'),_0x36ffa6);logger['debug'](_0x8bea('0x23'),_0x36ffa6,JSON[_0x8bea('0x1e')](_0x4b269b));_0x5010a3(_0x4b269b);})[_0x8bea('0x12')](function(_0x437869){logger[_0x8bea('0xe')]('DestroyCmHopperBlack',_0x437869[_0x8bea('0x10')],_0x36ffa6);_0x2c21f3(_0x582167[_0x8bea('0xe')](0x1f4,_0x437869['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5bd61d8..ee5710d 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 _0x7bd0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','delete','destroy','exports'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x7bd0,0x111));var _0x07bd=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7bd0[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['put'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')]('/:id',auth[_0x07bd('0xb')](),controller[_0x07bd('0x13')]);module[_0x07bd('0x14')]=router; \ No newline at end of file +var _0xfcf0=['index','/describe','describe','/:id','show','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x575da3,_0x1f0c9e){var _0x2b42ee=function(_0x36abce){while(--_0x36abce){_0x575da3['push'](_0x575da3['shift']());}};_0x2b42ee(++_0x1f0c9e);}(_0xfcf0,0x138));var _0x0fcf=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xfcf0[_0x19a49f];return _0x5351ae;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x10')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['delete'](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 83305ab..2243c81 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 _0x446c=['DATE','getDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x446c,0x171));var _0xc446=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x446c[_0x37e886];return _0x57c5cd;};'use strict';var Sequelize=require(_0xc446('0x0'));var moment=require(_0xc446('0x1'));module[_0xc446('0x2')]={'state':{'type':Sequelize[_0xc446('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xc446('0x4')]},'scheduledat':{'type':Sequelize[_0xc446('0x5')]},'countbusyretry':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xc446('0x4')]},'calleridnum':{'type':Sequelize[_0xc446('0x4')]},'calleridname':{'type':Sequelize[_0xc446('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc446('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xc446('0x5')]},'endtime':{'type':Sequelize[_0xc446('0x5')]},'ringtime':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xc446('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc446('0x4')]},'reason':{'type':Sequelize[_0xc446('0x4')]},'disposition':{'type':Sequelize[_0xc446('0x4')]},'secondDisposition':{'type':Sequelize[_0xc446('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc446('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x33e9f6){var _0xe461c1=this[_0xc446('0x6')]('endtime');if(_0xe461c1&&_0x33e9f6){this['setDataValue'](_0xc446('0x7'),moment(_0x33e9f6)[_0xc446('0x8')](moment(_0xe461c1),_0xc446('0x9')));}}},'amd':{'type':Sequelize[_0xc446('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc446('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc446('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xc446('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc446('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc446('0x5')]},'recallme':{'type':Sequelize[_0xc446('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xc446('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc446('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d32=['DATE','INTEGER','endtime','setDataValue','diff','seconds','BOOLEAN','moment','STRING'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x0d32,0x85));var _0x20d3=function(_0x1fe159,_0x5855c0){_0x1fe159=_0x1fe159-0x0;var _0x2cfe51=_0x0d32[_0x1fe159];return _0x2cfe51;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x20d3('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x20d3('0x1')]},'scheduledat':{'type':Sequelize[_0x20d3('0x2')]},'countbusyretry':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x20d3('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x20d3('0x1')]},'originatecalleridname':{'type':Sequelize[_0x20d3('0x1')]},'calleridnum':{'type':Sequelize[_0x20d3('0x1')]},'calleridname':{'type':Sequelize[_0x20d3('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x20d3('0x2')]},'answertime':{'type':Sequelize[_0x20d3('0x2')]},'droptime':{'type':Sequelize[_0x20d3('0x2')]},'endtime':{'type':Sequelize[_0x20d3('0x2')]},'ringtime':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x20d3('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x20d3('0x1')]},'membername':{'type':Sequelize[_0x20d3('0x1')]},'reason':{'type':Sequelize[_0x20d3('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x20d3('0x1')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x194321){var _0x45e9ab=this['getDataValue'](_0x20d3('0x4'));if(_0x45e9ab&&_0x194321){this[_0x20d3('0x5')]('followuptime',moment(_0x194321)[_0x20d3('0x6')](moment(_0x45e9ab),_0x20d3('0x7')));}}},'amd':{'type':Sequelize[_0x20d3('0x8')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x20d3('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x20d3('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x20d3('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x20d3('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x20d3('0x2')]},'deleted':{'type':Sequelize[_0x20d3('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x20d3('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x20d3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x20d3('0x3')],'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 b8873f5..8b34080 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 _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x5b3740,_0x110dd2){var _0x3a2f03=function(_0x590610){while(--_0x590610){_0x5b3740['push'](_0x5b3740['shift']());}};_0x3a2f03(++_0x110dd2);}(_0x7096,0x10c));var _0x6709=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7096[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file +var _0x4c60=['include','findAll','rows','catch','show','includeAll','find','describe','update','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','VoiceQueue','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x3cd919,_0x356b19){var _0x1aa67a=function(_0x56b8c2){while(--_0x56b8c2){_0x3cd919['push'](_0x3cd919['shift']());}};_0x1aa67a(++_0x356b19);}(_0x4c60,0xc1));var _0x04c6=function(_0x3c5f02,_0x25ec2f){_0x3c5f02=_0x3c5f02-0x0;var _0x41789=_0x4c60[_0x3c5f02];return _0x41789;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['CmHopperFinal'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':!![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['CmHopperFinal'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['CmHopperFinal'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')]()['then'](respondWithResult(_0x4ef366,null))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0x2472ed,_0xee2822){if(_0x2472ed['body'][_0x04c6('0x44')]){delete _0x2472ed[_0x04c6('0x45')][_0x04c6('0x44')];}return db[_0x04c6('0x27')]['find']({'where':{'uniqueid':_0x2472ed[_0x04c6('0x46')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0xee2822,null))[_0x04c6('0x1f')](saveUpdates(_0x2472ed[_0x04c6('0x45')],null))['then'](respondWithResult(_0xee2822,null))[_0x04c6('0x3e')](handleError(_0xee2822,null));};exports[_0x04c6('0x47')]=function(_0x15ec61,_0x489361,_0x3119f0){return db[_0x04c6('0x27')][_0x04c6('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x15ec61[_0x04c6('0x46')]['id']},'attributes':[[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4b')))),_0x04c6('0x4c')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),_0x04c6('0x55')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x56')))),'answeringMachine']]})[_0x04c6('0x1f')](handleEntityNotFound(_0x489361,null))[_0x04c6('0x1f')](respondWithResult(_0x489361,null))[_0x04c6('0x3e')](handleError(_0x489361,null));};exports[_0x04c6('0x57')]=function(_0x28299e,_0x5b536f,_0xf073a8){return db[_0x04c6('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0x28299e[_0x04c6('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize']['literal'](_0x04c6('0x4b')))),'noSuchContacts'],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x04c6('0x58')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x59')))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),'reCallContacts'],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x56')))),_0x04c6('0x5a')]]})[_0x04c6('0x1f')](handleEntityNotFound(_0x5b536f,null))[_0x04c6('0x1f')](respondWithResult(_0x5b536f,null))[_0x04c6('0x3e')](handleError(_0x5b536f,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x31cc93,_0x1b6242,_0x1f5b9a){return db[_0x04c6('0x5b')][_0x04c6('0x41')]({'where':{'id':_0x31cc93['params']['id']}})['then'](handleEntityNotFound(_0x1b6242,null))[_0x04c6('0x1f')](function(_0x598941){var _0x2df63b;if(_0x598941){_0x2df63b=squel['insert']()[_0x04c6('0x5c')](_0x04c6('0x5d'))['fromQuery']([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x62'),_0x04c6('0x63'),_0x04c6('0x64')],squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),'scheduledAt')[_0x04c6('0x66')](_0x04c6('0x69'),'ContactId')[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))[_0x04c6('0x66')](_0x04c6('0x6b'),'VoiceQueueId')[_0x04c6('0x66')]('NOW()',_0x04c6('0x63'))['field'](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())[_0x04c6('0x35')]('state\x20=\x20?',_0x31cc93[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x04c6('0x35')](_0x04c6('0x71'),squel['select']()[_0x04c6('0x66')](_0x04c6('0x5e'))['from'](_0x04c6('0x5d'))[_0x04c6('0x35')]('VoiceQueueId\x20=\x20?',_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()['field']('calleridnum')['from'](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where'](_0x04c6('0x72')))[_0x04c6('0x73')](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db[_0x04c6('0x48')][_0x04c6('0x2b')](_0x2df63b);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x1b6242,null))['catch'](handleError(_0x1b6242,null));};exports[_0x04c6('0x74')]=function(_0x4f258c,_0x202761,_0x480c74){return db['Campaign'][_0x04c6('0x41')]({'where':{'id':_0x4f258c['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x202761,null))[_0x04c6('0x1f')](function(_0x174de6){var _0x425d01;if(_0x174de6){_0x425d01=squel[_0x04c6('0x75')]()['into']('cm_hopper')[_0x04c6('0x76')]([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x77'),'createdAt',_0x04c6('0x64')],squel['select']()['field'](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x5f'))[_0x04c6('0x66')](_0x04c6('0x69'),_0x04c6('0x60'))[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))['field'](_0x04c6('0x78'),'CampaignId')['field'](_0x04c6('0x68'),_0x04c6('0x63'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x20?',_0x4f258c[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')](_0x04c6('0x7a'))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x5e'))[_0x04c6('0x6c')](_0x04c6('0x5d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c['params']['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x7b'))[_0x04c6('0x6c')](_0x04c6('0x6d'))['where'](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x204'))['group'](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db['sequelize'][_0x04c6('0x2b')](_0x425d01);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x202761,null))[_0x04c6('0x3e')](handleError(_0x202761,null));};exports['checkContactHopper']=function(_0x343c1f,_0x485457,_0x1c0c74){return db[_0x04c6('0x7c')][_0x04c6('0x7d')]({'where':{'VoiceQueueId':_0x343c1f['body']['VoiceQueueId'],'CampaignId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x77')],'ContactId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x60')]}})['then'](handleEntityNotFound(_0x485457,null))['then'](function(_0x3e12a4){if(_0x3e12a4){return _0x3e12a4;}return null;})[_0x04c6('0x1f')](respondWithResult(_0x485457,null))[_0x04c6('0x3e')](handleError(_0x485457,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2175840..5399942 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 _0xdfcf=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xdfcf,0xd4));var _0xfdfc=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xdfcf[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xfdfc('0x0'));var util=require(_0xfdfc('0x1'));var logger=require(_0xfdfc('0x2'))(_0xfdfc('0x3'));var moment=require('moment');var BPromise=require(_0xfdfc('0x4'));var rp=require(_0xfdfc('0x5'));var fs=require('fs');var path=require(_0xfdfc('0x6'));var rimraf=require(_0xfdfc('0x7'));var config=require(_0xfdfc('0x8'));var attributes=require(_0xfdfc('0x9'));module[_0xfdfc('0xa')]=function(_0x3091a1,_0x104ebc){return _0x3091a1[_0xfdfc('0xb')](_0xfdfc('0xc'),attributes,{'tableName':_0xfdfc('0xd'),'paranoid':![],'indexes':[{'name':_0xfdfc('0xe'),'fields':[_0xfdfc('0xe')]},{'name':_0xfdfc('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ec7=['moment','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x9ec7,0x164));var _0x79ec=function(_0x2a03eb,_0x2f9a81){_0x2a03eb=_0x2a03eb-0x0;var _0xdb8d21=_0x9ec7[_0x2a03eb];return _0xdb8d21;};'use strict';var _=require(_0x79ec('0x0'));var util=require(_0x79ec('0x1'));var logger=require(_0x79ec('0x2'))(_0x79ec('0x3'));var moment=require(_0x79ec('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x79ec('0x6'));module[_0x79ec('0x7')]=function(_0x379e06,_0x1e4ee8){return _0x379e06['define'](_0x79ec('0x8'),attributes,{'tableName':_0x79ec('0x9'),'paranoid':![],'indexes':[{'name':_0x79ec('0xa'),'fields':['calleridnum']},{'name':_0x79ec('0xb'),'fields':[_0x79ec('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 1b1401b..d835818 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x11ed1d,_0x30b0f3){var _0x3600b3=function(_0x4cb49b){while(--_0x4cb49b){_0x11ed1d['push'](_0x11ed1d['shift']());}};_0x3600b3(++_0x30b0f3);}(_0xb10b,0x12a));var _0xbb10=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0xb10b[_0xf33afd];return _0x5f432a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5a51a3,_0x5afde6){var _0x42d953=function(_0x472a7b){while(--_0x472a7b){_0x5a51a3['push'](_0x5a51a3['shift']());}};_0x42d953(++_0x5afde6);}(_0x7a54,0x106));var _0x47a5=function(_0x54da6b,_0x31af44){_0x54da6b=_0x54da6b-0x0;var _0xf164f=_0x7a54[_0x54da6b];return _0xf164f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2424450..bac0695 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 _0xc893=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','util'];(function(_0x3356c5,_0x20a150){var _0x556859=function(_0x19ac92){while(--_0x19ac92){_0x3356c5['push'](_0x3356c5['shift']());}};_0x556859(++_0x20a150);}(_0xc893,0x194));var _0x3c89=function(_0x3ca52b,_0x9c838e){_0x3ca52b=_0x3ca52b-0x0;var _0x2a3eb3=_0xc893[_0x3ca52b];return _0x2a3eb3;};'use strict';var multer=require('multer');var util=require(_0x3c89('0x0'));var path=require(_0x3c89('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3c89('0x2')]();var fs_extra=require(_0x3c89('0x3'));var auth=require(_0x3c89('0x4'));var interaction=require(_0x3c89('0x5'));var config=require(_0x3c89('0x6'));var controller=require(_0x3c89('0x7'));router[_0x3c89('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c89('0x9')]);router[_0x3c89('0x8')](_0x3c89('0xa'),auth[_0x3c89('0xb')](),controller['describe']);router[_0x3c89('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3c89('0xc')]);router['get'](_0x3c89('0xd'),auth[_0x3c89('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x3c89('0x8')](_0x3c89('0xe'),auth[_0x3c89('0xb')](),controller[_0x3c89('0xf')]);router[_0x3c89('0x10')](_0x3c89('0x11'),auth[_0x3c89('0xb')](),controller[_0x3c89('0x12')]);router[_0x3c89('0x10')](_0x3c89('0x13'),auth[_0x3c89('0xb')](),controller[_0x3c89('0x14')]);router[_0x3c89('0x10')](_0x3c89('0x15'),auth['isAuthenticated'](),controller[_0x3c89('0x16')]);router[_0x3c89('0x17')](_0x3c89('0x18'),auth[_0x3c89('0xb')](),controller[_0x3c89('0x19')]);module[_0x3c89('0x1a')]=router; \ No newline at end of file +var _0xa72d=['describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get'];(function(_0x49ff3f,_0x531e8f){var _0x4f9703=function(_0x108049){while(--_0x108049){_0x49ff3f['push'](_0x49ff3f['shift']());}};_0x4f9703(++_0x531e8f);}(_0xa72d,0x1bf));var _0xda72=function(_0x352cda,_0x4119b9){_0x352cda=_0x352cda-0x0;var _0x12a7b6=_0xa72d[_0x352cda];return _0x12a7b6;};'use strict';var multer=require(_0xda72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda72('0x1'));var express=require(_0xda72('0x2'));var router=express[_0xda72('0x3')]();var fs_extra=require(_0xda72('0x4'));var auth=require(_0xda72('0x5'));var interaction=require(_0xda72('0x6'));var config=require(_0xda72('0x7'));var controller=require(_0xda72('0x8'));router['get']('/',auth[_0xda72('0x9')](),controller[_0xda72('0xa')]);router[_0xda72('0xb')]('/describe',auth[_0xda72('0x9')](),controller[_0xda72('0xc')]);router[_0xda72('0xb')](_0xda72('0xd'),auth[_0xda72('0x9')](),controller[_0xda72('0xe')]);router[_0xda72('0xb')](_0xda72('0xf'),auth[_0xda72('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xda72('0x10'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xda72('0x11')](_0xda72('0x12'),auth['isAuthenticated'](),controller[_0xda72('0x13')]);router[_0xda72('0x11')](_0xda72('0x14'),auth[_0xda72('0x9')](),controller[_0xda72('0x15')]);router['post'](_0xda72('0x16'),auth[_0xda72('0x9')](),controller[_0xda72('0x17')]);router[_0xda72('0x18')](_0xda72('0xd'),auth[_0xda72('0x9')](),controller[_0xda72('0x19')]);module[_0xda72('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 90259b3..27894f7 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 _0x6fc2=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x6fc2,0x117));var _0x26fc=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6fc2[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0x26fc('0x0'));module[_0x26fc('0x1')]={'state':{'type':Sequelize[_0x26fc('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x26fc('0x3')]},'countbusyretry':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x26fc('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x26fc('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x26fc('0x4')]},'calleridname':{'type':Sequelize[_0x26fc('0x4')]},'starttime':{'type':Sequelize[_0x26fc('0x3')]},'responsetime':{'type':Sequelize[_0x26fc('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x26fc('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x26fc('0x4')]},'campaigntype':{'type':Sequelize[_0x26fc('0x4')]},'membername':{'type':Sequelize[_0x26fc('0x4')]},'reason':{'type':Sequelize[_0x26fc('0x4')]},'amd':{'type':Sequelize[_0x26fc('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x26fc('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x26fc('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x26fc('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x26fc('0x3')]},'recallme':{'type':Sequelize[_0x26fc('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x26fc('0x3')]},'edited':{'type':Sequelize[_0x26fc('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x26fc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x26fc('0x4')]}}; \ No newline at end of file +var _0x1674=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x5d1c4c,_0x4acb21){var _0x372875=function(_0x24d2b9){while(--_0x24d2b9){_0x5d1c4c['push'](_0x5d1c4c['shift']());}};_0x372875(++_0x4acb21);}(_0x1674,0x14d));var _0x4167=function(_0x11cbb5,_0x390441){_0x11cbb5=_0x11cbb5-0x0;var _0x54b8d3=_0x1674[_0x11cbb5];return _0x54b8d3;};'use strict';var Sequelize=require('sequelize');module[_0x4167('0x0')]={'state':{'type':Sequelize[_0x4167('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4167('0x2')]},'scheduledat':{'type':Sequelize[_0x4167('0x3')]},'countbusyretry':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4167('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4167('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4167('0x2')]},'calleridnum':{'type':Sequelize[_0x4167('0x2')]},'calleridname':{'type':Sequelize[_0x4167('0x2')]},'starttime':{'type':Sequelize[_0x4167('0x3')]},'responsetime':{'type':Sequelize[_0x4167('0x3')]},'answertime':{'type':Sequelize[_0x4167('0x3')]},'droptime':{'type':Sequelize[_0x4167('0x3')]},'endtime':{'type':Sequelize[_0x4167('0x3')]},'ringtime':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4167('0x2')]},'campaign':{'type':Sequelize[_0x4167('0x2')]},'campaigntype':{'type':Sequelize[_0x4167('0x2')]},'membername':{'type':Sequelize[_0x4167('0x2')]},'reason':{'type':Sequelize[_0x4167('0x2')]},'amd':{'type':Sequelize[_0x4167('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4167('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4167('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4167('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4167('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4167('0x3')]},'edited':{'type':Sequelize[_0x4167('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4167('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4167('0x1')],'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 ee8a147..d20ef29 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 _0xfdec=['../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','sendStatus','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','CmHopperHistory','count','includeAll','include','findAll','show','params','body','catch','describe','update','uniqueid','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x1af811,_0x56c74d){var _0x48470a=function(_0x38e61f){while(--_0x38e61f){_0x1af811['push'](_0x1af811['shift']());}};_0x48470a(++_0x56c74d);}(_0xfdec,0xca));var _0xcfde=function(_0x2cc2fe,_0x23451c){_0x2cc2fe=_0x2cc2fe-0x0;var _0x4337cd=_0xfdec[_0x2cc2fe];return _0x4337cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfde('0x0'));var zipdir=require(_0xcfde('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfde('0x2'));var moment=require(_0xcfde('0x3'));var BPromise=require(_0xcfde('0x4'));var Mustache=require(_0xcfde('0x5'));var util=require(_0xcfde('0x6'));var path=require(_0xcfde('0x7'));var sox=require(_0xcfde('0x8'));var csv=require(_0xcfde('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfde('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcfde('0xb'));var toCsv=require(_0xcfde('0x9'));var querystring=require(_0xcfde('0xc'));var Papa=require(_0xcfde('0xd'));var Redis=require(_0xcfde('0xe'));var authService=require(_0xcfde('0xf'));var qs=require(_0xcfde('0x10'));var as=require(_0xcfde('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfde('0x12'))(_0xcfde('0x13'));var utils=require(_0xcfde('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcfde('0x15'));var db=require(_0xcfde('0x16'))['db'];function respondWithStatusCode(_0x3cd061,_0xb6f7e7){_0xb6f7e7=_0xb6f7e7||0xcc;return function(_0x6983fe){if(_0x6983fe){return _0x3cd061['sendStatus'](_0xb6f7e7);}return _0x3cd061[_0xcfde('0x17')](_0xb6f7e7)[_0xcfde('0x18')]();};}function respondWithResult(_0x261abe,_0xef8990){_0xef8990=_0xef8990||0xc8;return function(_0x5ec6d9){if(_0x5ec6d9){return _0x261abe[_0xcfde('0x17')](_0xef8990)['json'](_0x5ec6d9);}};}function respondWithFilteredResult(_0x4cb9b1,_0x45dd68){return function(_0x4d4931){if(_0x4d4931){var _0x268728=typeof _0x45dd68[_0xcfde('0x19')]===_0xcfde('0x1a')&&typeof _0x45dd68[_0xcfde('0x1b')]===_0xcfde('0x1a');var _0x47e93b=_0x4d4931['count'];var _0x2e6e12=_0x268728?0x0:_0x45dd68['offset'];var _0x7d822b=_0x268728?_0x4d4931['count']:_0x45dd68[_0xcfde('0x19')]+_0x45dd68[_0xcfde('0x1b')];var _0x396524;if(_0x7d822b>=_0x47e93b){_0x7d822b=_0x47e93b;_0x396524=0xc8;}else{_0x396524=0xce;}_0x4cb9b1['status'](_0x396524);return _0x4cb9b1[_0xcfde('0x1c')](_0xcfde('0x1d'),_0x2e6e12+'-'+_0x7d822b+'/'+_0x47e93b)[_0xcfde('0x1e')](_0x4d4931);}return null;};}function patchUpdates(_0x25a610){return function(_0x346a6c){try{jsonpatch[_0xcfde('0x1f')](_0x346a6c,_0x25a610,!![]);}catch(_0xd88f2d){return BPromise[_0xcfde('0x20')](_0xd88f2d);}return _0x346a6c[_0xcfde('0x21')]();};}function saveUpdates(_0x25ba73,_0x3c4307){return function(_0x4c7bee){if(_0x4c7bee){return _0x4c7bee['update'](_0x25ba73)[_0xcfde('0x22')](function(_0x18f624){return _0x18f624;});}return null;};}function removeEntity(_0x2c4337,_0x6a72c3){return function(_0x5e175c){if(_0x5e175c){return _0x5e175c['destroy']()[_0xcfde('0x22')](function(){_0x2c4337[_0xcfde('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe895,_0x6946dc){return function(_0x33ff62){if(!_0x33ff62){_0x1fe895[_0xcfde('0x23')](0x194);}return _0x33ff62;};}function handleError(_0x4a7113,_0x46438c){_0x46438c=_0x46438c||0x1f4;return function(_0x2b2add){logger[_0xcfde('0x24')](_0x2b2add['stack']);if(_0x2b2add[_0xcfde('0x25')]){delete _0x2b2add[_0xcfde('0x25')];}_0x4a7113['status'](_0x46438c)[_0xcfde('0x26')](_0x2b2add);};}exports[_0xcfde('0x27')]=function(_0x272a69,_0x155f2b){var _0x280b2f={},_0x25b90f={},_0xe0976b={'count':0x0,'rows':[]};var _0x51a240=_[_0xcfde('0x28')](db['CmHopperHistory']['rawAttributes'],function(_0x474b4f){return{'name':_0x474b4f[_0xcfde('0x29')],'type':_0x474b4f[_0xcfde('0x2a')][_0xcfde('0x2b')]};});_0x25b90f[_0xcfde('0x2c')]=_[_0xcfde('0x28')](_0x51a240,_0xcfde('0x25'));_0x25b90f[_0xcfde('0x2d')]=_[_0xcfde('0x2e')](_0x272a69[_0xcfde('0x2d')]);_0x25b90f[_0xcfde('0x2f')]=_[_0xcfde('0x30')](_0x25b90f['model'],_0x25b90f[_0xcfde('0x2d')]);_0x280b2f[_0xcfde('0x31')]=_[_0xcfde('0x30')](_0x25b90f[_0xcfde('0x2c')],qs[_0xcfde('0x32')](_0x272a69['query'][_0xcfde('0x32')]));_0x280b2f['attributes']=_0x280b2f['attributes'][_0xcfde('0x33')]?_0x280b2f[_0xcfde('0x31')]:_0x25b90f[_0xcfde('0x2c')];if(!_0x272a69[_0xcfde('0x2d')][_0xcfde('0x34')](_0xcfde('0x35'))){_0x280b2f[_0xcfde('0x1b')]=qs[_0xcfde('0x1b')](_0x272a69[_0xcfde('0x2d')][_0xcfde('0x1b')]);_0x280b2f[_0xcfde('0x19')]=qs[_0xcfde('0x19')](_0x272a69[_0xcfde('0x2d')][_0xcfde('0x19')]);}_0x280b2f[_0xcfde('0x36')]=qs[_0xcfde('0x37')](_0x272a69[_0xcfde('0x2d')][_0xcfde('0x37')]);_0x280b2f[_0xcfde('0x38')]=qs['filters'](_[_0xcfde('0x39')](_0x272a69[_0xcfde('0x2d')],_0x25b90f[_0xcfde('0x2f')]),_0x51a240);if(_0x272a69[_0xcfde('0x2d')]['filter']){_0x280b2f[_0xcfde('0x38')]=_[_0xcfde('0x3a')](_0x280b2f[_0xcfde('0x38')],{'$or':_[_0xcfde('0x28')](_0x51a240,function(_0x503099){if(_0x503099['type']!=='VIRTUAL'){var _0x2c6cfe={};_0x2c6cfe[_0x503099[_0xcfde('0x25')]]={'$like':'%'+_0x272a69['query'][_0xcfde('0x3b')]+'%'};return _0x2c6cfe;}})});}_0x280b2f=_['merge']({},_0x280b2f,_0x272a69[_0xcfde('0x3c')]);var _0x517719={'where':_0x280b2f[_0xcfde('0x38')]};return db[_0xcfde('0x3d')][_0xcfde('0x3e')](_0x517719)[_0xcfde('0x22')](function(_0x388ba4){_0xe0976b[_0xcfde('0x3e')]=_0x388ba4;if(_0x272a69[_0xcfde('0x2d')][_0xcfde('0x3f')]){_0x280b2f[_0xcfde('0x40')]=[{'all':!![]}];}return db[_0xcfde('0x3d')][_0xcfde('0x41')](_0x280b2f);})[_0xcfde('0x22')](function(_0x4a7dd2){_0xe0976b['rows']=_0x4a7dd2;return _0xe0976b;})[_0xcfde('0x22')](respondWithFilteredResult(_0x155f2b,_0x280b2f))['catch'](handleError(_0x155f2b,null));};exports[_0xcfde('0x42')]=function(_0x3b2a65,_0x548f5b){var _0x12f256={'raw':!![],'where':{'id':_0x3b2a65[_0xcfde('0x43')]['id']}},_0x2438a9={};_0x2438a9['model']=_[_0xcfde('0x2e')](db['CmHopperHistory']['rawAttributes']);_0x2438a9[_0xcfde('0x2d')]=_['keys'](_0x3b2a65[_0xcfde('0x2d')]);_0x2438a9['filters']=_[_0xcfde('0x30')](_0x2438a9['model'],_0x2438a9[_0xcfde('0x2d')]);_0x12f256['attributes']=_[_0xcfde('0x30')](_0x2438a9[_0xcfde('0x2c')],qs[_0xcfde('0x32')](_0x3b2a65[_0xcfde('0x2d')][_0xcfde('0x32')]));_0x12f256[_0xcfde('0x31')]=_0x12f256[_0xcfde('0x31')][_0xcfde('0x33')]?_0x12f256[_0xcfde('0x31')]:_0x2438a9[_0xcfde('0x2c')];if(_0x3b2a65[_0xcfde('0x2d')][_0xcfde('0x3f')]){_0x12f256[_0xcfde('0x40')]=[{'all':!![]}];}_0x12f256=_[_0xcfde('0x3a')]({},_0x12f256,_0x3b2a65[_0xcfde('0x3c')]);return db[_0xcfde('0x3d')]['find'](_0x12f256)[_0xcfde('0x22')](handleEntityNotFound(_0x548f5b,null))[_0xcfde('0x22')](respondWithResult(_0x548f5b,null))['catch'](handleError(_0x548f5b,null));};exports['create']=function(_0x2b0ace,_0x320fa7){return db[_0xcfde('0x3d')]['create'](_0x2b0ace[_0xcfde('0x44')],{})[_0xcfde('0x22')](respondWithResult(_0x320fa7,0xc9))[_0xcfde('0x45')](handleError(_0x320fa7,null));};exports[_0xcfde('0x46')]=function(_0x15d75a,_0x14eff2){return db['CmHopperHistory']['describe']()[_0xcfde('0x22')](respondWithResult(_0x14eff2,null))[_0xcfde('0x45')](handleError(_0x14eff2,null));};exports[_0xcfde('0x47')]=function(_0x4aa521,_0x54147d){if(_0x4aa521[_0xcfde('0x44')][_0xcfde('0x48')]){delete _0x4aa521[_0xcfde('0x44')][_0xcfde('0x48')];}return db[_0xcfde('0x3d')][_0xcfde('0x49')]({'where':{'uniqueid':_0x4aa521['params']['id']}})[_0xcfde('0x22')](handleEntityNotFound(_0x54147d,null))['then'](saveUpdates(_0x4aa521[_0xcfde('0x44')],null))[_0xcfde('0x22')](respondWithResult(_0x54147d,null))[_0xcfde('0x45')](handleError(_0x54147d,null));}; \ No newline at end of file +var _0x4e51=['pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','keys','rawAttributes','options','find','create','describe','uniqueid','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','apply','reject','save','update','then','error','stack','name','send','CmHopperHistory','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where'];(function(_0x304803,_0x1ecf11){var _0x43fc0f=function(_0x544b46){while(--_0x544b46){_0x304803['push'](_0x304803['shift']());}};_0x43fc0f(++_0x1ecf11);}(_0x4e51,0x1cd));var _0x14e5=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x4e51[_0x4e5552];return _0x60a338;};'use strict';var emlformat=require(_0x14e5('0x0'));var rimraf=require(_0x14e5('0x1'));var zipdir=require(_0x14e5('0x2'));var jsonpatch=require(_0x14e5('0x3'));var rp=require(_0x14e5('0x4'));var moment=require('moment');var BPromise=require(_0x14e5('0x5'));var Mustache=require(_0x14e5('0x6'));var util=require(_0x14e5('0x7'));var path=require(_0x14e5('0x8'));var sox=require(_0x14e5('0x9'));var csv=require('to-csv');var ejs=require(_0x14e5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x14e5('0xb'));var crypto=require(_0x14e5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x14e5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x14e5('0xe'));var Papa=require(_0x14e5('0xf'));var Redis=require(_0x14e5('0x10'));var authService=require(_0x14e5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x14e5('0x12'));var hardwareService=require(_0x14e5('0x13'));var logger=require(_0x14e5('0x14'))(_0x14e5('0x15'));var utils=require('../../config/utils');var config=require(_0x14e5('0x16'));var licenseUtil=require(_0x14e5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x397851,_0x278a3d){_0x278a3d=_0x278a3d||0xcc;return function(_0x21d10a){if(_0x21d10a){return _0x397851[_0x14e5('0x18')](_0x278a3d);}return _0x397851[_0x14e5('0x19')](_0x278a3d)[_0x14e5('0x1a')]();};}function respondWithResult(_0x42733f,_0x517b2){_0x517b2=_0x517b2||0xc8;return function(_0x408ddb){if(_0x408ddb){return _0x42733f[_0x14e5('0x19')](_0x517b2)[_0x14e5('0x1b')](_0x408ddb);}};}function respondWithFilteredResult(_0x3eec31,_0x3202b6){return function(_0x525bda){if(_0x525bda){var _0x233ace=typeof _0x3202b6[_0x14e5('0x1c')]===_0x14e5('0x1d')&&typeof _0x3202b6['limit']==='undefined';var _0x1988cb=_0x525bda['count'];var _0x1f11b5=_0x233ace?0x0:_0x3202b6['offset'];var _0x18a5b9=_0x233ace?_0x525bda[_0x14e5('0x1e')]:_0x3202b6[_0x14e5('0x1c')]+_0x3202b6[_0x14e5('0x1f')];var _0x506b09;if(_0x18a5b9>=_0x1988cb){_0x18a5b9=_0x1988cb;_0x506b09=0xc8;}else{_0x506b09=0xce;}_0x3eec31['status'](_0x506b09);return _0x3eec31[_0x14e5('0x20')](_0x14e5('0x21'),_0x1f11b5+'-'+_0x18a5b9+'/'+_0x1988cb)['json'](_0x525bda);}return null;};}function patchUpdates(_0x4876bd){return function(_0x196df3){try{jsonpatch[_0x14e5('0x22')](_0x196df3,_0x4876bd,!![]);}catch(_0x43c2cc){return BPromise[_0x14e5('0x23')](_0x43c2cc);}return _0x196df3[_0x14e5('0x24')]();};}function saveUpdates(_0x22ffff,_0x216098){return function(_0x15c03a){if(_0x15c03a){return _0x15c03a[_0x14e5('0x25')](_0x22ffff)[_0x14e5('0x26')](function(_0x5b66cb){return _0x5b66cb;});}return null;};}function removeEntity(_0x59f8f0,_0x431140){return function(_0x51766d){if(_0x51766d){return _0x51766d['destroy']()[_0x14e5('0x26')](function(){_0x59f8f0[_0x14e5('0x19')](0xcc)[_0x14e5('0x1a')]();});}};}function handleEntityNotFound(_0x2541bd,_0x6d6166){return function(_0xc3b788){if(!_0xc3b788){_0x2541bd[_0x14e5('0x18')](0x194);}return _0xc3b788;};}function handleError(_0x1bbd06,_0x395fe1){_0x395fe1=_0x395fe1||0x1f4;return function(_0x5a573b){logger[_0x14e5('0x27')](_0x5a573b[_0x14e5('0x28')]);if(_0x5a573b['name']){delete _0x5a573b[_0x14e5('0x29')];}_0x1bbd06[_0x14e5('0x19')](_0x395fe1)[_0x14e5('0x2a')](_0x5a573b);};}exports['index']=function(_0x589af2,_0x17c9f2){var _0x419913={},_0x200e48={},_0xe3a2eb={'count':0x0,'rows':[]};var _0x154d8a=_['map'](db[_0x14e5('0x2b')]['rawAttributes'],function(_0xf6a0c4){return{'name':_0xf6a0c4['fieldName'],'type':_0xf6a0c4[_0x14e5('0x2c')][_0x14e5('0x2d')]};});_0x200e48[_0x14e5('0x2e')]=_[_0x14e5('0x2f')](_0x154d8a,_0x14e5('0x29'));_0x200e48[_0x14e5('0x30')]=_['keys'](_0x589af2['query']);_0x200e48[_0x14e5('0x31')]=_[_0x14e5('0x32')](_0x200e48[_0x14e5('0x2e')],_0x200e48[_0x14e5('0x30')]);_0x419913['attributes']=_[_0x14e5('0x32')](_0x200e48[_0x14e5('0x2e')],qs[_0x14e5('0x33')](_0x589af2[_0x14e5('0x30')][_0x14e5('0x33')]));_0x419913[_0x14e5('0x34')]=_0x419913['attributes'][_0x14e5('0x35')]?_0x419913[_0x14e5('0x34')]:_0x200e48['model'];if(!_0x589af2['query'][_0x14e5('0x36')](_0x14e5('0x37'))){_0x419913['limit']=qs[_0x14e5('0x1f')](_0x589af2[_0x14e5('0x30')][_0x14e5('0x1f')]);_0x419913[_0x14e5('0x1c')]=qs['offset'](_0x589af2[_0x14e5('0x30')]['offset']);}_0x419913['order']=qs['sort'](_0x589af2[_0x14e5('0x30')]['sort']);_0x419913[_0x14e5('0x38')]=qs[_0x14e5('0x31')](_[_0x14e5('0x39')](_0x589af2['query'],_0x200e48[_0x14e5('0x31')]),_0x154d8a);if(_0x589af2['query'][_0x14e5('0x3a')]){_0x419913['where']=_['merge'](_0x419913[_0x14e5('0x38')],{'$or':_['map'](_0x154d8a,function(_0x3b348d){if(_0x3b348d[_0x14e5('0x2c')]!==_0x14e5('0x3b')){var _0x1eab78={};_0x1eab78[_0x3b348d[_0x14e5('0x29')]]={'$like':'%'+_0x589af2[_0x14e5('0x30')][_0x14e5('0x3a')]+'%'};return _0x1eab78;}})});}_0x419913=_[_0x14e5('0x3c')]({},_0x419913,_0x589af2['options']);var _0x5c3580={'where':_0x419913[_0x14e5('0x38')]};return db['CmHopperHistory'][_0x14e5('0x1e')](_0x5c3580)['then'](function(_0x2769a6){_0xe3a2eb[_0x14e5('0x1e')]=_0x2769a6;if(_0x589af2[_0x14e5('0x30')][_0x14e5('0x3d')]){_0x419913[_0x14e5('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x419913);})[_0x14e5('0x26')](function(_0x5c2fa1){_0xe3a2eb[_0x14e5('0x3f')]=_0x5c2fa1;return _0xe3a2eb;})[_0x14e5('0x26')](respondWithFilteredResult(_0x17c9f2,_0x419913))[_0x14e5('0x40')](handleError(_0x17c9f2,null));};exports['show']=function(_0x29bf42,_0xd581ae){var _0x1f2add={'raw':!![],'where':{'id':_0x29bf42[_0x14e5('0x41')]['id']}},_0x3c2866={};_0x3c2866['model']=_[_0x14e5('0x42')](db['CmHopperHistory'][_0x14e5('0x43')]);_0x3c2866[_0x14e5('0x30')]=_['keys'](_0x29bf42[_0x14e5('0x30')]);_0x3c2866['filters']=_['intersection'](_0x3c2866[_0x14e5('0x2e')],_0x3c2866[_0x14e5('0x30')]);_0x1f2add[_0x14e5('0x34')]=_[_0x14e5('0x32')](_0x3c2866[_0x14e5('0x2e')],qs['fields'](_0x29bf42[_0x14e5('0x30')][_0x14e5('0x33')]));_0x1f2add[_0x14e5('0x34')]=_0x1f2add[_0x14e5('0x34')][_0x14e5('0x35')]?_0x1f2add[_0x14e5('0x34')]:_0x3c2866[_0x14e5('0x2e')];if(_0x29bf42[_0x14e5('0x30')]['includeAll']){_0x1f2add[_0x14e5('0x3e')]=[{'all':!![]}];}_0x1f2add=_[_0x14e5('0x3c')]({},_0x1f2add,_0x29bf42[_0x14e5('0x44')]);return db[_0x14e5('0x2b')][_0x14e5('0x45')](_0x1f2add)['then'](handleEntityNotFound(_0xd581ae,null))[_0x14e5('0x26')](respondWithResult(_0xd581ae,null))[_0x14e5('0x40')](handleError(_0xd581ae,null));};exports['create']=function(_0x2181d5,_0x3ab8c1){return db[_0x14e5('0x2b')][_0x14e5('0x46')](_0x2181d5['body'],{})[_0x14e5('0x26')](respondWithResult(_0x3ab8c1,0xc9))[_0x14e5('0x40')](handleError(_0x3ab8c1,null));};exports[_0x14e5('0x47')]=function(_0x4dc09d,_0x2926bb){return db[_0x14e5('0x2b')][_0x14e5('0x47')]()[_0x14e5('0x26')](respondWithResult(_0x2926bb,null))[_0x14e5('0x40')](handleError(_0x2926bb,null));};exports[_0x14e5('0x25')]=function(_0x4df6c6,_0x293d79){if(_0x4df6c6['body'][_0x14e5('0x48')]){delete _0x4df6c6['body'][_0x14e5('0x48')];}return db[_0x14e5('0x2b')]['find']({'where':{'uniqueid':_0x4df6c6[_0x14e5('0x41')]['id']}})[_0x14e5('0x26')](handleEntityNotFound(_0x293d79,null))[_0x14e5('0x26')](saveUpdates(_0x4df6c6[_0x14e5('0x49')],null))[_0x14e5('0x26')](respondWithResult(_0x293d79,null))['catch'](handleError(_0x293d79,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 83ac8fa..d426329 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 _0x0755=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','endtime','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0755,0x7c));var _0x5075=function(_0x161ca1,_0x5e231a){_0x161ca1=_0x161ca1-0x0;var _0x57d832=_0x0755[_0x161ca1];return _0x57d832;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var logger=require(_0x5075('0x2'))(_0x5075('0x3'));var moment=require(_0x5075('0x4'));var BPromise=require(_0x5075('0x5'));var rp=require(_0x5075('0x6'));var fs=require('fs');var path=require(_0x5075('0x7'));var rimraf=require(_0x5075('0x8'));var config=require(_0x5075('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x5075('0xa')]=function(_0x2a7be,_0x3f4fea){return _0x2a7be[_0x5075('0xb')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x5075('0xc')]},{'name':_0x5075('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xad5f=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x119c39,_0x4e7254){var _0x14ae40=function(_0xa64d13){while(--_0xa64d13){_0x119c39['push'](_0x119c39['shift']());}};_0x14ae40(++_0x4e7254);}(_0xad5f,0x1a8));var _0xfad5=function(_0x11807a,_0xb04cc2){_0x11807a=_0x11807a-0x0;var _0x347921=_0xad5f[_0x11807a];return _0x347921;};'use strict';var _=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var logger=require(_0xfad5('0x2'))(_0xfad5('0x3'));var moment=require(_0xfad5('0x4'));var BPromise=require(_0xfad5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfad5('0x6'));var rimraf=require(_0xfad5('0x7'));var config=require(_0xfad5('0x8'));var attributes=require(_0xfad5('0x9'));module[_0xfad5('0xa')]=function(_0x180450,_0x43cae5){return _0x180450['define'](_0xfad5('0xb'),attributes,{'tableName':_0xfad5('0xc'),'paranoid':![],'indexes':[{'name':_0xfad5('0xd'),'fields':[_0xfad5('0xd')]},{'name':'uniqueid','fields':[_0xfad5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 9fbb5a7..5caceac 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 _0x153f=['../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x153f,0x15b));var _0xf153=function(_0x48abb0,_0x34983a){_0x48abb0=_0x48abb0-0x0;var _0x5a3aec=_0x153f[_0x48abb0];return _0x5a3aec;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});}exports[_0xf153('0x17')]=function(_0x138dbe){var _0x44272e=this;return new Promise(function(_0x4e790d,_0x357d57){return db[_0xf153('0x18')][_0xf153('0x19')](_0x138dbe[_0xf153('0x1a')],{'raw':_0x138dbe[_0xf153('0x1b')]?_0x138dbe[_0xf153('0x1b')][_0xf153('0x1c')]===undefined?!![]:![]:!![]})[_0xf153('0xd')](function(_0x3735a7){logger[_0xf153('0xe')](_0xf153('0x17'),_0x138dbe);logger[_0xf153('0x11')]('CreateCmHopperHistory',_0x138dbe,JSON[_0xf153('0x12')](_0x3735a7));_0x4e790d(_0x3735a7);})[_0xf153('0x1d')](function(_0x3d3e41){logger[_0xf153('0x13')](_0xf153('0x17'),_0x3d3e41[_0xf153('0x15')],_0x138dbe);_0x357d57(_0x44272e[_0xf153('0x13')](0x1f4,_0x3d3e41[_0xf153('0x15')]));});});};exports[_0xf153('0x1e')]=function(_0x38190c){var _0x1570fc=this;return new Promise(function(_0x39f3ed,_0x35cfe3){return db[_0xf153('0x18')][_0xf153('0x1f')]({'raw':_0x38190c[_0xf153('0x1b')]?_0x38190c[_0xf153('0x1b')][_0xf153('0x1c')]===undefined?!![]:![]:!![],'where':_0x38190c[_0xf153('0x1b')]?_0x38190c[_0xf153('0x1b')]['where']||null:null,'attributes':[[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db['sequelize'][_0xf153('0x22')]('id')),_0xf153('0x23')],[db['sequelize']['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x25')))),_0xf153('0x26')],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xf153('0x28')],[db['sequelize']['fn']('AVG',db[_0xf153('0x20')]['fn']('IF',db['sequelize'][_0xf153('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xf153('0x29')],[db[_0xf153('0x20')]['fn']('AVG',db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x2a')))),_0xf153('0x2b')]]})[_0xf153('0xd')](function(_0x4ab69c){logger[_0xf153('0xe')]('AvgHandleTime',_0x38190c);logger[_0xf153('0x11')](_0xf153('0x1e'),_0x38190c,JSON[_0xf153('0x12')](_0x4ab69c));_0x39f3ed(_0x4ab69c);})[_0xf153('0x1d')](function(_0x274bcc){logger[_0xf153('0x13')]('AvgHandleTime',_0x274bcc[_0xf153('0x15')],_0x38190c);_0x35cfe3(_0x1570fc[_0xf153('0x13')](0x1f4,_0x274bcc[_0xf153('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x244172){var _0x17d60c=this;return new Promise(function(_0xd2a763,_0x254692){return db[_0xf153('0x18')][_0xf153('0x1f')]({'raw':_0x244172['options']?_0x244172[_0xf153('0x1b')][_0xf153('0x1c')]===undefined?!![]:![]:!![],'where':_0x244172['options']?_0x244172[_0xf153('0x1b')][_0xf153('0x2c')]||null:null,'attributes':[[_0xf153('0x2d'),_0xf153('0x2e')],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db['sequelize'][_0xf153('0x24')](_0xf153('0x2f')))),_0xf153('0x30')],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db['sequelize']['literal'](_0xf153('0x31')))),'outboundNoAnswerCallsDay'],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x25')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db['sequelize'][_0xf153('0x24')](_0xf153('0x32')))),_0xf153('0x33')],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x34')))),_0xf153('0x35')],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db['sequelize']['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db['sequelize']['fn']('IF',db[_0xf153('0x20')]['literal'](_0xf153('0x37')))),_0xf153('0x38')],[db[_0xf153('0x20')]['fn']('COUNT',db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x39')))),_0xf153('0x3a')],[db['sequelize']['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db['sequelize'][_0xf153('0x24')](_0xf153('0x3b')))),_0xf153('0x3c')],[db['sequelize']['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x3d')))),_0xf153('0x3e')],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db['sequelize'][_0xf153('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db['sequelize'][_0xf153('0x24')](_0xf153('0x3f')))),'outboundAnswerAgiCallsDay'],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x40')))),'outboundRejectCallsDay'],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xf153('0x24')](_0xf153('0x41')))),_0xf153('0x42')]],'group':[_0xf153('0x2d')]})[_0xf153('0xd')](function(_0x1e1c33){logger['info'](_0xf153('0x43'),_0x244172);logger['debug'](_0xf153('0x43'),_0x244172,JSON[_0xf153('0x12')](_0x1e1c33));_0xd2a763(_0x1e1c33);})[_0xf153('0x1d')](function(_0x5cc697){logger[_0xf153('0x13')](_0xf153('0x43'),_0x5cc697[_0xf153('0x15')],_0x244172);_0x254692(_0x17d60c[_0xf153('0x13')](0x1f4,_0x5cc697[_0xf153('0x15')]));});});};exports[_0xf153('0x44')]=function(_0x17f594){var _0x49b1f8=this;return new Promise(function(_0x84e55,_0x150892){return db[_0xf153('0x18')]['findAll']({'raw':_0x17f594[_0xf153('0x1b')]?_0x17f594[_0xf153('0x1b')][_0xf153('0x1c')]===undefined?!![]:![]:!![],'where':_0x17f594[_0xf153('0x1b')]?_0x17f594[_0xf153('0x1b')][_0xf153('0x2c')]||null:null,'attributes':[[_0xf153('0x2d'),_0xf153('0x2e')],[db['sequelize']['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['col']('id')),_0xf153('0x45')],[db[_0xf153('0x20')]['fn'](_0xf153('0x21'),db[_0xf153('0x20')]['fn']('IF',db[_0xf153('0x20')][_0xf153('0x24')](_0xf153('0x25')))),_0xf153('0x46')]],'group':[_0xf153('0x2d')]})[_0xf153('0xd')](function(_0xca7bec){logger['info'](_0xf153('0x44'),_0x17f594);logger[_0xf153('0x11')]('GetCampaignHopperHistory',_0x17f594,JSON[_0xf153('0x12')](_0xca7bec));_0x84e55(_0xca7bec);})[_0xf153('0x1d')](function(_0x249cd6){logger[_0xf153('0x13')](_0xf153('0x44'),_0x249cd6[_0xf153('0x15')],_0x17f594);_0x150892(_0x49b1f8[_0xf153('0x13')](0x1f4,_0x249cd6['message']));});});}; \ No newline at end of file +var _0xea67=['col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','then','debug','AvgHandleTime','findAll','COUNT','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xea67,0x172));var _0x7ea6=function(_0x827d61,_0x127d23){_0x827d61=_0x827d61-0x0;var _0x3d2398=_0xea67[_0x827d61];return _0x3d2398;};'use strict';var _=require(_0x7ea6('0x0'));var util=require(_0x7ea6('0x1'));var moment=require(_0x7ea6('0x2'));var BPromise=require(_0x7ea6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ea6('0x4'));var db=require(_0x7ea6('0x5'))['db'];var utils=require(_0x7ea6('0x6'));var logger=require('../../config/logger')(_0x7ea6('0x7'));var config=require(_0x7ea6('0x8'));var jayson=require(_0x7ea6('0x9'));var client=jayson[_0x7ea6('0xa')][_0x7ea6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b5ce8,_0x2cc5cb,_0x14904f){return new BPromise(function(_0x3dabab,_0x59f2c9){return client[_0x7ea6('0xc')](_0x1b5ce8,_0x14904f)['then'](function(_0x383f6e){logger[_0x7ea6('0xd')](_0x7ea6('0xe'),_0x2cc5cb,_0x7ea6('0xf'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2cc5cb,_0x7ea6('0xf'),JSON[_0x7ea6('0x10')](_0x383f6e));if(_0x383f6e[_0x7ea6('0x11')]){if(_0x383f6e['error'][_0x7ea6('0x12')]===0x1f4){logger[_0x7ea6('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x2cc5cb,_0x383f6e[_0x7ea6('0x11')][_0x7ea6('0x13')]);return _0x59f2c9(_0x383f6e[_0x7ea6('0x11')]['message']);}logger[_0x7ea6('0x11')](_0x7ea6('0xe'),_0x2cc5cb,_0x383f6e['error']['message']);return _0x3dabab(_0x383f6e[_0x7ea6('0x11')][_0x7ea6('0x13')]);}else{logger[_0x7ea6('0xd')](_0x7ea6('0xe'),_0x2cc5cb,_0x7ea6('0xf'));_0x3dabab(_0x383f6e[_0x7ea6('0x14')]['message']);}})[_0x7ea6('0x15')](function(_0x17f588){logger['error'](_0x7ea6('0xe'),_0x2cc5cb,_0x17f588);_0x59f2c9(_0x17f588);});});}exports[_0x7ea6('0x16')]=function(_0x55a5b1){var _0xe0d668=this;return new Promise(function(_0x66a641,_0x1ae0eb){return db[_0x7ea6('0x17')]['create'](_0x55a5b1['body'],{'raw':_0x55a5b1[_0x7ea6('0x18')]?_0x55a5b1[_0x7ea6('0x18')][_0x7ea6('0x19')]===undefined?!![]:![]:!![]})[_0x7ea6('0x1a')](function(_0x456640){logger[_0x7ea6('0xd')](_0x7ea6('0x16'),_0x55a5b1);logger[_0x7ea6('0x1b')](_0x7ea6('0x16'),_0x55a5b1,JSON[_0x7ea6('0x10')](_0x456640));_0x66a641(_0x456640);})['catch'](function(_0x196d41){logger[_0x7ea6('0x11')](_0x7ea6('0x16'),_0x196d41[_0x7ea6('0x13')],_0x55a5b1);_0x1ae0eb(_0xe0d668['error'](0x1f4,_0x196d41['message']));});});};exports[_0x7ea6('0x1c')]=function(_0x4b82df){var _0xc2bd1c=this;return new Promise(function(_0x4234d1,_0x3eff5b){return db['CmHopperHistory'][_0x7ea6('0x1d')]({'raw':_0x4b82df[_0x7ea6('0x18')]?_0x4b82df[_0x7ea6('0x18')][_0x7ea6('0x19')]===undefined?!![]:![]:!![],'where':_0x4b82df[_0x7ea6('0x18')]?_0x4b82df['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')][_0x7ea6('0x20')]('id')),_0x7ea6('0x21')],[db[_0x7ea6('0x1f')]['fn']('COUNT',db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x23')))),_0x7ea6('0x24')],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0x7ea6('0x25')],[db['sequelize']['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x27'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x7ea6('0x28')],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x27'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x29')))),_0x7ea6('0x2a')]]})[_0x7ea6('0x1a')](function(_0x3de3a0){logger['info']('AvgHandleTime',_0x4b82df);logger[_0x7ea6('0x1b')](_0x7ea6('0x1c'),_0x4b82df,JSON[_0x7ea6('0x10')](_0x3de3a0));_0x4234d1(_0x3de3a0);})[_0x7ea6('0x15')](function(_0x359b3e){logger[_0x7ea6('0x11')]('AvgHandleTime',_0x359b3e[_0x7ea6('0x13')],_0x4b82df);_0x3eff5b(_0xc2bd1c[_0x7ea6('0x11')](0x1f4,_0x359b3e[_0x7ea6('0x13')]));});});};exports[_0x7ea6('0x2b')]=function(_0x5111a7){var _0x5f0074=this;return new Promise(function(_0x31867f,_0x58e125){return db[_0x7ea6('0x17')][_0x7ea6('0x1d')]({'raw':_0x5111a7[_0x7ea6('0x18')]?_0x5111a7[_0x7ea6('0x18')][_0x7ea6('0x19')]===undefined?!![]:![]:!![],'where':_0x5111a7[_0x7ea6('0x18')]?_0x5111a7['options']['where']||null:null,'attributes':[['campaign',_0x7ea6('0x2c')],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x2d')))),_0x7ea6('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x23')))),_0x7ea6('0x2f')],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0x7ea6('0x30')],[db[_0x7ea6('0x1f')]['fn']('COUNT',db[_0x7ea6('0x1f')]['fn']('IF',db['sequelize'][_0x7ea6('0x22')](_0x7ea6('0x31')))),'outboundCongestionCallsDay'],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db['sequelize']['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x32')))),_0x7ea6('0x33')],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x7ea6('0x35')))),_0x7ea6('0x36')],[db[_0x7ea6('0x1f')]['fn']('COUNT',db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')]['literal'](_0x7ea6('0x37')))),'outboundBlacklistCallsDay'],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0x7ea6('0x38')],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x7ea6('0x39')))),_0x7ea6('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x3b')))),_0x7ea6('0x3c')],[db[_0x7ea6('0x1f')]['fn'](_0x7ea6('0x1e'),db['sequelize']['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x3d')))),'outboundRejectCallsDay'],[db[_0x7ea6('0x1f')]['fn']('COUNT',db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')][_0x7ea6('0x22')](_0x7ea6('0x3e')))),_0x7ea6('0x3f')]],'group':[_0x7ea6('0x40')]})[_0x7ea6('0x1a')](function(_0x58784d){logger[_0x7ea6('0xd')]('GetVoiceQueueHopperHistory',_0x5111a7);logger[_0x7ea6('0x1b')](_0x7ea6('0x2b'),_0x5111a7,JSON['stringify'](_0x58784d));_0x31867f(_0x58784d);})[_0x7ea6('0x15')](function(_0x452452){logger[_0x7ea6('0x11')]('GetVoiceQueueHopperHistory',_0x452452[_0x7ea6('0x13')],_0x5111a7);_0x58e125(_0x5f0074[_0x7ea6('0x11')](0x1f4,_0x452452[_0x7ea6('0x13')]));});});};exports[_0x7ea6('0x41')]=function(_0x1327b5){var _0x53f626=this;return new Promise(function(_0x1561a6,_0xbbdadd){return db['CmHopperHistory'][_0x7ea6('0x1d')]({'raw':_0x1327b5['options']?_0x1327b5['options'][_0x7ea6('0x19')]===undefined?!![]:![]:!![],'where':_0x1327b5[_0x7ea6('0x18')]?_0x1327b5['options']['where']||null:null,'attributes':[[_0x7ea6('0x40'),_0x7ea6('0x2c')],[db['sequelize']['fn'](_0x7ea6('0x1e'),db[_0x7ea6('0x1f')]['col']('id')),_0x7ea6('0x42')],[db[_0x7ea6('0x1f')]['fn']('COUNT',db[_0x7ea6('0x1f')]['fn']('IF',db[_0x7ea6('0x1f')]['literal'](_0x7ea6('0x23')))),'ivrAnswerCallsDay']],'group':[_0x7ea6('0x40')]})[_0x7ea6('0x1a')](function(_0x4f1d6d){logger[_0x7ea6('0xd')]('GetCampaignHopperHistory',_0x1327b5);logger['debug'](_0x7ea6('0x41'),_0x1327b5,JSON[_0x7ea6('0x10')](_0x4f1d6d));_0x1561a6(_0x4f1d6d);})[_0x7ea6('0x15')](function(_0x4eed83){logger[_0x7ea6('0x11')](_0x7ea6('0x41'),_0x4eed83[_0x7ea6('0x13')],_0x1327b5);_0xbbdadd(_0x53f626[_0x7ea6('0x11')](0x1f4,_0x4eed83['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0baebb2..bbdc8bd 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 _0x0ec1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','show','put','update','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x44f1f1,_0x4be4e4){var _0x1fae61=function(_0x3c2051){while(--_0x3c2051){_0x44f1f1['push'](_0x44f1f1['shift']());}};_0x1fae61(++_0x4be4e4);}(_0x0ec1,0x14a));var _0x10ec=function(_0x35d6c6,_0x50566b){_0x35d6c6=_0x35d6c6-0x0;var _0x3b3fb2=_0x0ec1[_0x35d6c6];return _0x3b3fb2;};'use strict';var multer=require(_0x10ec('0x0'));var util=require(_0x10ec('0x1'));var path=require(_0x10ec('0x2'));var timeout=require(_0x10ec('0x3'));var express=require(_0x10ec('0x4'));var router=express['Router']();var fs_extra=require(_0x10ec('0x5'));var auth=require(_0x10ec('0x6'));var interaction=require(_0x10ec('0x7'));var config=require(_0x10ec('0x8'));var controller=require(_0x10ec('0x9'));router['get']('/',auth[_0x10ec('0xa')](),controller[_0x10ec('0xb')]);router['get']('/describe',auth[_0x10ec('0xa')](),controller['describe']);router['get']('/:id',auth[_0x10ec('0xa')](),controller[_0x10ec('0xc')]);router['post']('/',auth[_0x10ec('0xa')](),controller['create']);router[_0x10ec('0xd')]('/:id',auth[_0x10ec('0xa')](),controller[_0x10ec('0xe')]);module[_0x10ec('0xf')]=router; \ No newline at end of file +var _0x44e7=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','multer'];(function(_0x14dd10,_0x4900d6){var _0x5cb641=function(_0x499124){while(--_0x499124){_0x14dd10['push'](_0x14dd10['shift']());}};_0x5cb641(++_0x4900d6);}(_0x44e7,0x11c));var _0x744e=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0x44e7[_0x2fbd0e];return _0x481c9f;};'use strict';var multer=require(_0x744e('0x0'));var util=require(_0x744e('0x1'));var path=require(_0x744e('0x2'));var timeout=require('connect-timeout');var express=require(_0x744e('0x3'));var router=express['Router']();var fs_extra=require(_0x744e('0x4'));var auth=require(_0x744e('0x5'));var interaction=require(_0x744e('0x6'));var config=require('../../config/environment');var controller=require(_0x744e('0x7'));router[_0x744e('0x8')]('/',auth[_0x744e('0x9')](),controller[_0x744e('0xa')]);router['get'](_0x744e('0xb'),auth[_0x744e('0x9')](),controller[_0x744e('0xc')]);router[_0x744e('0x8')](_0x744e('0xd'),auth[_0x744e('0x9')](),controller[_0x744e('0xe')]);router[_0x744e('0xf')]('/',auth[_0x744e('0x9')](),controller[_0x744e('0x10')]);router['put'](_0x744e('0xd'),auth[_0x744e('0x9')](),controller[_0x744e('0x11')]);module[_0x744e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index eb515e3..5fbf72d 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 _0x535f=['STRING','exports'];(function(_0x32376a,_0x5bf09a){var _0x16a7a7=function(_0x572581){while(--_0x572581){_0x32376a['push'](_0x32376a['shift']());}};_0x16a7a7(++_0x5bf09a);}(_0x535f,0x111));var _0xf535=function(_0x467cc8,_0x354e73){_0x467cc8=_0x467cc8-0x0;var _0xde0ee2=_0x535f[_0x467cc8];return _0xde0ee2;};'use strict';var Sequelize=require('sequelize');module[_0xf535('0x0')]={'name':{'type':Sequelize[_0xf535('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf535('0x1')]},'dialPrefix':{'type':Sequelize[_0xf535('0x1')]}}; \ No newline at end of file +var _0x67a2=['exports','name','STRING','sequelize'];(function(_0x5c3526,_0x2a1e90){var _0xec27a2=function(_0x5ac4e1){while(--_0x5ac4e1){_0x5c3526['push'](_0x5c3526['shift']());}};_0xec27a2(++_0x2a1e90);}(_0x67a2,0xd3));var _0x267a=function(_0x16205,_0xb4c786){_0x16205=_0x16205-0x0;var _0x1ab538=_0x67a2[_0x16205];return _0x1ab538;};'use strict';var Sequelize=require(_0x267a('0x0'));module[_0x267a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x267a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x267a('0x3')]},'dialPrefix':{'type':Sequelize[_0x267a('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2eea745..d94cdfd 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 _0xf009=['CustomFields','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','download','addCustomField','findOne','transaction','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','sequelize','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','User','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','ListId','Disposition','getDispositions','options','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','omit','success','push','errors','message','getContacts'];(function(_0x1e8ac9,_0x1bd0fe){var _0x4c895c=function(_0x3cc2f5){while(--_0x3cc2f5){_0x1e8ac9['push'](_0x1e8ac9['shift']());}};_0x4c895c(++_0x1bd0fe);}(_0xf009,0xd2));var _0x9f00=function(_0x1c0fc3,_0x3537bb){_0x1c0fc3=_0x1c0fc3-0x0;var _0x338237=_0xf009[_0x1c0fc3];return _0x338237;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f00('0x0'));var zipdir=require(_0x9f00('0x1'));var jsonpatch=require(_0x9f00('0x2'));var rp=require(_0x9f00('0x3'));var moment=require('moment');var BPromise=require(_0x9f00('0x4'));var Mustache=require(_0x9f00('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9f00('0x6'));var csv=require(_0x9f00('0x7'));var ejs=require(_0x9f00('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f00('0x9'));var squel=require('squel');var crypto=require(_0x9f00('0xa'));var jsforce=require(_0x9f00('0xb'));var deskjs=require(_0x9f00('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9f00('0xd'));var Papa=require(_0x9f00('0xe'));var Redis=require(_0x9f00('0xf'));var authService=require(_0x9f00('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f00('0x11'));var logger=require(_0x9f00('0x12'))('api');var utils=require(_0x9f00('0x13'));var config=require(_0x9f00('0x14'));var licenseUtil=require(_0x9f00('0x15'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x9f00('0x16')]=_[_0x9f00('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f00('0x18'))(new Redis(config[_0x9f00('0x16')]));require(_0x9f00('0x19'))[_0x9f00('0x1a')](socket);function respondWithStatusCode(_0x147078,_0x4a6dfc){_0x4a6dfc=_0x4a6dfc||0xcc;return function(_0x2c0ed5){if(_0x2c0ed5){return _0x147078[_0x9f00('0x1b')](_0x4a6dfc);}return _0x147078[_0x9f00('0x1c')](_0x4a6dfc)[_0x9f00('0x1d')]();};}function respondWithResult(_0x434a2a,_0x15306d){_0x15306d=_0x15306d||0xc8;return function(_0x5372db){if(_0x5372db){return _0x434a2a[_0x9f00('0x1c')](_0x15306d)[_0x9f00('0x1e')](_0x5372db);}};}function respondWithFilteredResult(_0x341956,_0x4148f3){return function(_0xc5e25d){if(_0xc5e25d){var _0x3710d3=typeof _0x4148f3[_0x9f00('0x1f')]===_0x9f00('0x20')&&typeof _0x4148f3[_0x9f00('0x21')]===_0x9f00('0x20');var _0x4f30eb=_0xc5e25d[_0x9f00('0x22')];var _0x18da95=_0x3710d3?0x0:_0x4148f3[_0x9f00('0x1f')];var _0x5a2357=_0x3710d3?_0xc5e25d[_0x9f00('0x22')]:_0x4148f3['offset']+_0x4148f3[_0x9f00('0x21')];var _0x32ff76;if(_0x5a2357>=_0x4f30eb){_0x5a2357=_0x4f30eb;_0x32ff76=0xc8;}else{_0x32ff76=0xce;}_0x341956[_0x9f00('0x1c')](_0x32ff76);return _0x341956[_0x9f00('0x23')](_0x9f00('0x24'),_0x18da95+'-'+_0x5a2357+'/'+_0x4f30eb)['json'](_0xc5e25d);}return null;};}function patchUpdates(_0x3a9c3c){return function(_0x106805){try{jsonpatch[_0x9f00('0x25')](_0x106805,_0x3a9c3c,!![]);}catch(_0x2b6a71){return BPromise['reject'](_0x2b6a71);}return _0x106805[_0x9f00('0x26')]();};}function saveUpdates(_0x2cbf3a,_0xb69520){return function(_0x5b93f9){if(_0x5b93f9){return _0x5b93f9['update'](_0x2cbf3a)[_0x9f00('0x27')](function(_0x27ee37){return _0x27ee37;});}return null;};}function removeEntity(_0x598c9e,_0x3f9f27){return function(_0x41f869){if(_0x41f869){return _0x41f869[_0x9f00('0x28')]()[_0x9f00('0x27')](function(){var _0x238e3b=_0x41f869[_0x9f00('0x29')]({'plain':!![]});var _0x143801=_0x9f00('0x2a');return db[_0x9f00('0x2b')]['destroy']({'where':{'type':_0x143801,'resourceId':_0x238e3b['id']}})[_0x9f00('0x27')](function(){return _0x41f869;});})[_0x9f00('0x27')](function(){_0x598c9e['status'](0xcc)[_0x9f00('0x1d')]();});}};}function handleEntityNotFound(_0x36575c,_0x4e01ad){return function(_0x545277){if(!_0x545277){_0x36575c[_0x9f00('0x1b')](0x194);}return _0x545277;};}function handleError(_0x17f5cc,_0x4c8d7f){_0x4c8d7f=_0x4c8d7f||0x1f4;return function(_0x5904b7){logger[_0x9f00('0x2c')](_0x5904b7[_0x9f00('0x2d')]);if(_0x5904b7[_0x9f00('0x2e')]){delete _0x5904b7[_0x9f00('0x2e')];}_0x17f5cc[_0x9f00('0x1c')](_0x4c8d7f)[_0x9f00('0x2f')](_0x5904b7);};}exports[_0x9f00('0x30')]=function(_0x18ef75,_0x357c53){var _0x3d75d6={},_0x4d0c66={},_0x34079c={'count':0x0,'rows':[]};var _0x387500=_[_0x9f00('0x31')](db[_0x9f00('0x32')][_0x9f00('0x33')],function(_0x36c4fa){return{'name':_0x36c4fa['fieldName'],'type':_0x36c4fa[_0x9f00('0x34')][_0x9f00('0x35')]};});_0x4d0c66[_0x9f00('0x36')]=_[_0x9f00('0x31')](_0x387500,_0x9f00('0x2e'));_0x4d0c66['query']=_['keys'](_0x18ef75[_0x9f00('0x37')]);_0x4d0c66[_0x9f00('0x38')]=_[_0x9f00('0x39')](_0x4d0c66[_0x9f00('0x36')],_0x4d0c66['query']);_0x3d75d6[_0x9f00('0x3a')]=_[_0x9f00('0x39')](_0x4d0c66[_0x9f00('0x36')],qs['fields'](_0x18ef75[_0x9f00('0x37')][_0x9f00('0x3b')]));_0x3d75d6[_0x9f00('0x3a')]=_0x3d75d6[_0x9f00('0x3a')][_0x9f00('0x3c')]?_0x3d75d6[_0x9f00('0x3a')]:_0x4d0c66[_0x9f00('0x36')];if(!_0x18ef75['query'][_0x9f00('0x3d')](_0x9f00('0x3e'))){_0x3d75d6['limit']=qs[_0x9f00('0x21')](_0x18ef75['query']['limit']);_0x3d75d6[_0x9f00('0x1f')]=qs[_0x9f00('0x1f')](_0x18ef75['query']['offset']);}_0x3d75d6[_0x9f00('0x3f')]=qs[_0x9f00('0x40')](_0x18ef75['query'][_0x9f00('0x40')]);_0x3d75d6[_0x9f00('0x41')]=qs[_0x9f00('0x38')](_[_0x9f00('0x42')](_0x18ef75[_0x9f00('0x37')],_0x4d0c66[_0x9f00('0x38')]),_0x387500);if(_0x18ef75[_0x9f00('0x37')][_0x9f00('0x43')]){_0x3d75d6[_0x9f00('0x41')]=_[_0x9f00('0x44')](_0x3d75d6[_0x9f00('0x41')],{'$or':_[_0x9f00('0x31')](_0x387500,function(_0x1ed424){if(_0x1ed424[_0x9f00('0x34')]!==_0x9f00('0x45')){var _0x309aaa={};_0x309aaa[_0x1ed424[_0x9f00('0x2e')]]={'$like':'%'+_0x18ef75['query'][_0x9f00('0x43')]+'%'};return _0x309aaa;}})});}_0x3d75d6=_[_0x9f00('0x44')]({},_0x3d75d6,_0x18ef75['options']);var _0x535bf3={'where':_0x3d75d6['where']};return db[_0x9f00('0x32')][_0x9f00('0x22')](_0x535bf3)[_0x9f00('0x27')](function(_0x464d74){_0x34079c[_0x9f00('0x22')]=_0x464d74;if(_0x18ef75['query'][_0x9f00('0x46')]){_0x3d75d6[_0x9f00('0x47')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x3d75d6);})[_0x9f00('0x27')](function(_0x59a9d1){_0x34079c[_0x9f00('0x48')]=_0x59a9d1;return _0x34079c;})['then'](respondWithFilteredResult(_0x357c53,_0x3d75d6))[_0x9f00('0x49')](handleError(_0x357c53,null));};exports[_0x9f00('0x4a')]=function(_0x5f328e,_0xa9d991){var _0x29bde2={'raw':![],'where':{'id':_0x5f328e[_0x9f00('0x4b')]['id']}},_0x198180={};_0x198180[_0x9f00('0x36')]=_[_0x9f00('0x4c')](db[_0x9f00('0x32')]['rawAttributes']);_0x198180['query']=_[_0x9f00('0x4c')](_0x5f328e['query']);_0x198180[_0x9f00('0x38')]=_[_0x9f00('0x39')](_0x198180[_0x9f00('0x36')],_0x198180[_0x9f00('0x37')]);_0x29bde2[_0x9f00('0x3a')]=_[_0x9f00('0x39')](_0x198180['model'],qs[_0x9f00('0x3b')](_0x5f328e[_0x9f00('0x37')][_0x9f00('0x3b')]));_0x29bde2[_0x9f00('0x3a')]=_0x29bde2[_0x9f00('0x3a')][_0x9f00('0x3c')]?_0x29bde2[_0x9f00('0x3a')]:_0x198180['model'];if(_0x5f328e[_0x9f00('0x37')]['includeAll']){_0x29bde2[_0x9f00('0x47')]=[{'all':!![]}];}_0x29bde2=_[_0x9f00('0x44')]({},_0x29bde2,_0x5f328e['options']);return db[_0x9f00('0x32')][_0x9f00('0x4d')](_0x29bde2)[_0x9f00('0x27')](handleEntityNotFound(_0xa9d991,null))[_0x9f00('0x27')](respondWithResult(_0xa9d991,null))[_0x9f00('0x49')](handleError(_0xa9d991,null));};exports[_0x9f00('0x4e')]=function(_0x5906bc,_0x3c2e96){return db['CmList'][_0x9f00('0x4e')](_0x5906bc['body'],{})['then'](function(_0x37b720){var _0xae3eca=_0x5906bc[_0x9f00('0x4f')]['get']({'plain':!![]});if(!_0xae3eca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xae3eca['role']===_0x9f00('0x4f')){var _0x364526=_0x37b720[_0x9f00('0x29')]({'plain':!![]});var _0x49e83f=_0x9f00('0x2a');return db[_0x9f00('0x50')]['find']({'where':{'name':_0x49e83f,'userProfileId':_0xae3eca[_0x9f00('0x51')]},'raw':!![]})['then'](function(_0x1be42d){if(_0x1be42d&&_0x1be42d[_0x9f00('0x52')]===0x0){return db[_0x9f00('0x2b')][_0x9f00('0x4e')]({'name':_0x364526['name'],'resourceId':_0x364526['id'],'type':_0x1be42d[_0x9f00('0x2e')],'sectionId':_0x1be42d['id']},{})[_0x9f00('0x27')](function(){return _0x37b720;});}else{return _0x37b720;}})[_0x9f00('0x49')](function(_0x163ba4){logger[_0x9f00('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x163ba4);throw _0x163ba4;});}return _0x37b720;})['then'](respondWithResult(_0x3c2e96,0xc9))[_0x9f00('0x49')](handleError(_0x3c2e96,null));};exports['update']=function(_0x45c46b,_0x53cedf){if(_0x45c46b[_0x9f00('0x53')]['id']){delete _0x45c46b[_0x9f00('0x53')]['id'];}return db[_0x9f00('0x32')]['find']({'where':{'id':_0x45c46b[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x53cedf,null))['then'](saveUpdates(_0x45c46b[_0x9f00('0x53')],null))[_0x9f00('0x27')](respondWithResult(_0x53cedf,null))[_0x9f00('0x49')](handleError(_0x53cedf,null));};exports[_0x9f00('0x28')]=function(_0x43b252,_0x52ac70){return db[_0x9f00('0x32')][_0x9f00('0x4d')]({'where':{'id':_0x43b252['params']['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x52ac70,null))['then'](removeEntity(_0x52ac70,null))[_0x9f00('0x49')](handleError(_0x52ac70,null));};exports['describe']=function(_0x12d403,_0x39346d){return db[_0x9f00('0x32')][_0x9f00('0x54')]()[_0x9f00('0x27')](respondWithResult(_0x39346d,null))[_0x9f00('0x49')](handleError(_0x39346d,null));};exports[_0x9f00('0x55')]=function(_0x4835be,_0x101760,_0xc30440){if(_0x4835be[_0x9f00('0x53')]['id']){delete _0x4835be[_0x9f00('0x53')]['id'];}return db['CmList'][_0x9f00('0x4d')]({'where':{'id':_0x4835be[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x101760,null))['then'](function(_0x5dc9bd){if(_0x5dc9bd){_0x4835be[_0x9f00('0x53')][_0x9f00('0x56')]=_0x5dc9bd['id'];return db[_0x9f00('0x57')][_0x9f00('0x4e')](_0x4835be['body']);}})[_0x9f00('0x27')](respondWithResult(_0x101760,null))[_0x9f00('0x49')](handleError(_0x101760,null));};exports[_0x9f00('0x58')]=function(_0x51ff75,_0x34407c,_0x521e72){var _0x22663f={'raw':![],'where':{}};var _0x433d66={};var _0x5c73ec={'count':0x0,'rows':[]};return db[_0x9f00('0x32')]['findOne']({'where':{'id':_0x51ff75[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x34407c,null))[_0x9f00('0x27')](function(_0x7cbf1){if(_0x7cbf1){_0x433d66[_0x9f00('0x36')]=_[_0x9f00('0x4c')](db[_0x9f00('0x57')][_0x9f00('0x33')]);_0x433d66['query']=_[_0x9f00('0x4c')](_0x51ff75[_0x9f00('0x37')]);_0x433d66[_0x9f00('0x38')]=_[_0x9f00('0x39')](_0x433d66[_0x9f00('0x36')],_0x433d66[_0x9f00('0x37')]);_0x22663f['attributes']=_[_0x9f00('0x39')](_0x433d66[_0x9f00('0x36')],qs[_0x9f00('0x3b')](_0x51ff75[_0x9f00('0x37')][_0x9f00('0x3b')]));_0x22663f[_0x9f00('0x3a')]=_0x22663f['attributes'][_0x9f00('0x3c')]?_0x22663f['attributes']:_0x433d66[_0x9f00('0x36')];if(!_0x51ff75[_0x9f00('0x37')]['hasOwnProperty'](_0x9f00('0x3e'))){_0x22663f['limit']=qs[_0x9f00('0x21')](_0x51ff75[_0x9f00('0x37')][_0x9f00('0x21')]);_0x22663f[_0x9f00('0x1f')]=qs[_0x9f00('0x1f')](_0x51ff75['query'][_0x9f00('0x1f')]);}_0x22663f[_0x9f00('0x3f')]=qs['sort'](_0x51ff75[_0x9f00('0x37')]['sort']);_0x22663f[_0x9f00('0x41')]=qs[_0x9f00('0x38')](_[_0x9f00('0x42')](_0x51ff75['query'],_0x433d66[_0x9f00('0x38')]));_0x22663f[_0x9f00('0x41')]['ListId']=_0x7cbf1['id'];if(_0x51ff75[_0x9f00('0x37')][_0x9f00('0x43')]){_0x22663f[_0x9f00('0x41')]=_[_0x9f00('0x44')](_0x22663f[_0x9f00('0x41')],{'$or':_[_0x9f00('0x31')](_0x22663f[_0x9f00('0x3a')],function(_0x35b2d4){var _0x3d6103={};_0x3d6103[_0x35b2d4]={'$like':'%'+_0x51ff75[_0x9f00('0x37')]['filter']+'%'};return _0x3d6103;})});}_0x22663f=_[_0x9f00('0x44')]({},_0x22663f,_0x51ff75[_0x9f00('0x59')]);return db[_0x9f00('0x57')]['count']({'where':_0x22663f[_0x9f00('0x41')]})[_0x9f00('0x27')](function(_0x5e3546){_0x5c73ec['count']=_0x5e3546;if(_0x51ff75[_0x9f00('0x37')]['includeAll']){_0x22663f['include']=[{'all':!![]}];}return db['Disposition'][_0x9f00('0x5a')](_0x22663f);})[_0x9f00('0x27')](function(_0x1906d9){_0x5c73ec[_0x9f00('0x48')]=_0x1906d9;return _0x5c73ec;});}})[_0x9f00('0x27')](respondWithFilteredResult(_0x34407c,_0x22663f))[_0x9f00('0x49')](handleError(_0x34407c,null));};exports[_0x9f00('0x5b')]=function(_0x395974,_0x2133e2,_0x14f918){return db[_0x9f00('0x32')]['find']({'where':{'id':_0x395974[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x2133e2,null))[_0x9f00('0x27')](function(_0x5d1cbb){if(_0x5d1cbb){return _0x5d1cbb[_0x9f00('0x5b')](_0x395974[_0x9f00('0x37')][_0x9f00('0x5c')]);}})['then'](respondWithStatusCode(_0x2133e2,null))['catch'](handleError(_0x2133e2,null));};exports[_0x9f00('0x5d')]=function(_0x292db7,_0x5b7429,_0x54460f){return db[_0x9f00('0x32')]['find']({'where':{'id':_0x292db7['params']['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x5b7429,null))['then'](function(_0x8a3ff4){if(_0x8a3ff4){var _0xf3d9d7=[];var _0x135c38={'success':[],'errors':[]};return db[_0x9f00('0x5e')][_0x9f00('0x54')]()[_0x9f00('0x27')](function(_0x879198){if(_0x292db7[_0x9f00('0x53')][_0x9f00('0x5f')]&&_[_0x9f00('0x60')](_0x292db7[_0x9f00('0x53')][_0x9f00('0x5f')])){if(_0x292db7[_0x9f00('0x53')][_0x9f00('0x5f')]['length']){_0x292db7[_0x9f00('0x53')][_0x9f00('0x5f')]=_0x292db7[_0x9f00('0x53')][_0x9f00('0x5f')]['join'](';')+';';}else{_0x292db7[_0x9f00('0x53')][_0x9f00('0x5f')]=null;}}else{_0x292db7[_0x9f00('0x53')][_0x9f00('0x5f')]=null;}if(_0x292db7[_0x9f00('0x53')]&&_[_0x9f00('0x60')](_0x292db7[_0x9f00('0x53')])){for(var _0x4e2681=0x0;_0x4e2681<_0x292db7[_0x9f00('0x53')][_0x9f00('0x3c')];_0x4e2681+=0x1){_0x292db7[_0x9f00('0x53')][_0x4e2681][_0x9f00('0x56')]=_0x292db7[_0x9f00('0x4b')]['id'];_0xf3d9d7['push'](_0x292db7[_0x9f00('0x53')][_0x4e2681]);}return BPromise[_0x9f00('0x61')](_0xf3d9d7,function(_0x151526){return db['CmContact']['create'](_[_0x9f00('0x62')](_0x151526,[_0x9f00('0x5c'),'id'])||{},{'fields':_[_0x9f00('0x4c')](_0x879198),'raw':!![]})[_0x9f00('0x27')](function(_0x355a15){_0x135c38[_0x9f00('0x63')][_0x9f00('0x64')](_0x355a15['dataValues']);})[_0x9f00('0x49')](function(_0x5448cd){_0x135c38[_0x9f00('0x65')][_0x9f00('0x64')]({'data':_0x151526,'error':_0x5448cd[_0x9f00('0x66')]});});})['then'](function(_0x1495a2){return _0x135c38;})[_0x9f00('0x49')](function(_0x2f0a20){return _0x2f0a20;});}else{_0x5b7429[_0x9f00('0x1c')](0x190)[_0x9f00('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x9f00('0x27')](respondWithResult(_0x5b7429,null))['catch'](handleError(_0x5b7429,null));};exports[_0x9f00('0x67')]=function(_0x2770ba,_0x50d71d,_0x6f779f){var _0x932d0b;return db[_0x9f00('0x32')][_0x9f00('0x4d')]({'where':{'id':_0x2770ba[_0x9f00('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x9f00('0x68')}]})['then'](handleEntityNotFound(_0x50d71d,null))[_0x9f00('0x27')](function(_0x577a0b){if(_0x577a0b){_0x932d0b=_0x577a0b;return db['CmContact']['rawAttributes'];}})['then'](function(_0x3cab4a){if(_0x3cab4a){var _0x173650={};var _0x2e32e5={};_0x2e32e5['model']=_[_0x9f00('0x69')](_[_0x9f00('0x4c')](_0x3cab4a),_[_0x9f00('0x31')](_0x932d0b[_0x9f00('0x68')],function(_0x28a94d){return util[_0x9f00('0x6a')](_0x9f00('0x6b'),_0x28a94d['id']);}));_0x2e32e5[_0x9f00('0x37')]=_[_0x9f00('0x4c')](_0x2770ba[_0x9f00('0x37')]);_0x2e32e5[_0x9f00('0x38')]=_[_0x9f00('0x39')](_0x2e32e5[_0x9f00('0x36')],_0x2e32e5[_0x9f00('0x37')]);_0x173650[_0x9f00('0x3a')]=_[_0x9f00('0x39')](_0x2e32e5[_0x9f00('0x36')],qs[_0x9f00('0x3b')](_0x2770ba[_0x9f00('0x37')]['fields']));_0x173650[_0x9f00('0x3a')]=_0x173650[_0x9f00('0x3a')][_0x9f00('0x3c')]?_0x173650[_0x9f00('0x3a')]:_0x2e32e5[_0x9f00('0x36')];if(!_0x2770ba['query'][_0x9f00('0x3d')]('nolimit')){_0x173650['limit']=qs['limit'](_0x2770ba[_0x9f00('0x37')][_0x9f00('0x21')]);_0x173650[_0x9f00('0x1f')]=qs[_0x9f00('0x1f')](_0x2770ba[_0x9f00('0x37')][_0x9f00('0x1f')]);}_0x173650[_0x9f00('0x3f')]=qs['sort'](_0x2770ba[_0x9f00('0x37')]['sort']);_0x173650[_0x9f00('0x41')]=qs[_0x9f00('0x38')](_['pick'](_0x2770ba[_0x9f00('0x37')],_0x2e32e5[_0x9f00('0x38')]));_0x173650['raw']=!![];if(_0x2770ba[_0x9f00('0x37')][_0x9f00('0x43')]){_0x173650[_0x9f00('0x41')]=_[_0x9f00('0x44')](_0x173650[_0x9f00('0x41')],{'$or':_[_0x9f00('0x31')](_0x173650[_0x9f00('0x3a')],function(_0x4e18a8){var _0x26e856={};_0x26e856[_0x4e18a8]={'$like':'%'+_0x2770ba[_0x9f00('0x37')][_0x9f00('0x43')]+'%'};return _0x26e856;})});}_0x173650=_[_0x9f00('0x44')]({},_0x173650,_0x2770ba[_0x9f00('0x59')]);return _0x932d0b[_0x9f00('0x67')](_0x173650);}})['then'](respondWithResult(_0x50d71d,null))[_0x9f00('0x49')](handleError(_0x50d71d,null));};exports[_0x9f00('0x6c')]=function(_0x14e295,_0x156ff2,_0x12dd1e){var _0x4c2f9f;var _0x51f88e;var _0xa70fe;var _0x1856c6=_0x14e295[_0x9f00('0x4b')]['id'];csv_results=[];return db[_0x9f00('0x6d')]['findAll']({'attributes':['id',_0x9f00('0x2e')],'raw':!![],'order':[_0x9f00('0x6e')]})[_0x9f00('0x27')](function(_0x2b9b67){_0x4c2f9f=_0x2b9b67;var _0x3cd317=_[_0x9f00('0x4c')](db['CmContact'][_0x9f00('0x33')]);return db[_0x9f00('0x6f')]['findAll']({'raw':!![],'attributes':['id',_0x9f00('0x70')]})['then'](function(_0x4f1a70){_0x51f88e=_0x4f1a70;var _0x5716b8=squel[_0x9f00('0x71')]()[_0x9f00('0x3b')](_0x3cd317)[_0x9f00('0x72')](_0x9f00('0x73'),'c')[_0x9f00('0x41')]('c.ListId\x20=\x20?',_0x1856c6)['where']('c.deletedAt\x20is\x20null')[_0x9f00('0x74')]();for(var _0x247997=0x0;_0x247997<_0x51f88e[_0x9f00('0x3c')];_0x247997++){_0x5716b8[_0x9f00('0x75')](_0x9f00('0x76')+_0x51f88e[_0x247997]['id'],_0x9f00('0x77')+_0x51f88e[_0x247997][_0x9f00('0x70')]);}for(var _0x247997=0x0;_0x247997<_0x4c2f9f[_0x9f00('0x3c')];_0x247997++){_0x5716b8['field'](squel['select']()[_0x9f00('0x75')](_0x9f00('0x78'))[_0x9f00('0x72')](_0x9f00('0x79'))['where'](_0x9f00('0x7a'),_0x4c2f9f[_0x247997]['id'])[_0x9f00('0x41')](_0x9f00('0x7b')),_0x9f00('0x7c')+_0x4c2f9f[_0x247997]['name']);_0x5716b8[_0x9f00('0x75')](squel[_0x9f00('0x71')]()[_0x9f00('0x75')](_0x9f00('0x7d'))[_0x9f00('0x72')](_0x9f00('0x79'))[_0x9f00('0x41')](_0x9f00('0x7a'),_0x4c2f9f[_0x247997]['id'])[_0x9f00('0x41')](_0x9f00('0x7b')),'description_additionalPhone_'+_0x4c2f9f[_0x247997]['name']);}var _0x45702e=[];_0x45702e['push'](_0x5716b8[_0x9f00('0x7e')]());BPromise['each'](_0x45702e,handleQuery)[_0x9f00('0x27')](function(_0x22031d){handleQuery(_0x5716b8[_0x9f00('0x7e')]());var _0x9de146=csv_results[0x0];if(!_[_0x9f00('0x7f')](_0x9de146)){var _0x58fa0a=toCsv(_0x9de146);var _0xf3ab2e=Date[_0x9f00('0x80')]();fs[_0x9f00('0x81')](util[_0x9f00('0x6a')](_0x9f00('0x82'),_0x1856c6,_0xf3ab2e),_0x58fa0a);_0x156ff2[_0x9f00('0x83')]('Content-disposition','attachment;\x20filename='+util[_0x9f00('0x6a')](_0x9f00('0x84'),_0x1856c6,_0xf3ab2e));_0x156ff2['setHeader']('Content-type','text/csv');return _0x156ff2[_0x9f00('0x85')](util[_0x9f00('0x6a')](_0x9f00('0x82'),_0x1856c6,_0xf3ab2e));}else{return _0x156ff2['sendStatus'](0xcc);}});});});};exports[_0x9f00('0x86')]=function(_0x25ad33,_0x2de4b1,_0x5b0022){var _0x289026;delete _0x25ad33[_0x9f00('0x53')]['id'];return db[_0x9f00('0x32')][_0x9f00('0x87')]({'where':{'id':_0x25ad33[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x2de4b1,null))[_0x9f00('0x27')](function(_0x3d5dbf){if(_0x3d5dbf){return db['sequelize'][_0x9f00('0x88')](function(_0x454ff8){return db['CmCustomField']['create'](_0x25ad33['body'],{'transaction':_0x454ff8})['then'](function(_0x2f82f0){_0x289026=_0x2f82f0;return _0x3d5dbf[_0x9f00('0x89')](_0x2f82f0,{'transaction':_0x454ff8});})[_0x9f00('0x27')](function(){var _0x541781={'type':db[_0x9f00('0x8a')][_0x9f00('0x8b')],'transaction':_0x454ff8};switch(_0x25ad33[_0x9f00('0x53')][_0x9f00('0x34')]){case _0x9f00('0x8c'):_0x541781[_0x9f00('0x34')]=db[_0x9f00('0x8a')][_0x9f00('0x8b')];break;case'number':_0x541781[_0x9f00('0x34')]=db[_0x9f00('0x8a')]['INTEGER'];break;case _0x9f00('0x8d'):_0x541781[_0x9f00('0x34')]=db[_0x9f00('0x8a')][_0x9f00('0x8e')];_0x541781[_0x9f00('0x8f')]=![];break;default:}return db[_0x9f00('0x90')]['queryInterface'][_0x9f00('0x91')](_0x9f00('0x73'),util[_0x9f00('0x6a')](_0x9f00('0x92'),_0x289026['id']),_0x541781);})[_0x9f00('0x27')](function(){return _0x289026;});});}})[_0x9f00('0x27')](respondWithResult(_0x2de4b1,null))[_0x9f00('0x49')](handleError(_0x2de4b1,null));};exports[_0x9f00('0x93')]=function(_0x207237,_0x49a984,_0x2d1167){var _0x56ecce={};var _0xb3ffbe={};var _0x295343;var _0x13736d;return db[_0x9f00('0x32')][_0x9f00('0x87')]({'where':{'id':_0x207237[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x49a984,null))[_0x9f00('0x27')](function(_0x4fba08){if(_0x4fba08){_0x295343=_0x4fba08;_0xb3ffbe[_0x9f00('0x36')]=_[_0x9f00('0x4c')](db[_0x9f00('0x6f')][_0x9f00('0x33')]);_0xb3ffbe[_0x9f00('0x37')]=_[_0x9f00('0x4c')](_0x207237[_0x9f00('0x37')]);_0xb3ffbe[_0x9f00('0x38')]=_[_0x9f00('0x39')](_0xb3ffbe[_0x9f00('0x36')],_0xb3ffbe[_0x9f00('0x37')]);_0x56ecce[_0x9f00('0x3a')]=_[_0x9f00('0x39')](_0xb3ffbe['model'],qs[_0x9f00('0x3b')](_0x207237['query']['fields']));_0x56ecce['attributes']=_0x56ecce['attributes'][_0x9f00('0x3c')]?_0x56ecce['attributes']:_0xb3ffbe['model'];_0x56ecce['order']=qs[_0x9f00('0x40')](_0x207237[_0x9f00('0x37')][_0x9f00('0x40')]);_0x56ecce[_0x9f00('0x41')]=qs[_0x9f00('0x38')](_[_0x9f00('0x42')](_0x207237[_0x9f00('0x37')],_0xb3ffbe[_0x9f00('0x38')]));_0x56ecce['where']=_[_0x9f00('0x44')](_0x56ecce[_0x9f00('0x41')],{'$or':[{'ListId':_0x4fba08['id']},{'ListId':null}]});if(_0x207237[_0x9f00('0x37')][_0x9f00('0x43')]){_0x56ecce['where']=_[_0x9f00('0x44')](_0x56ecce['where'],{'$or':_[_0x9f00('0x31')](_0x56ecce['attributes'],function(_0x3980bc){var _0x54a3b6={};_0x54a3b6[_0x3980bc]={'$like':'%'+_0x207237[_0x9f00('0x37')][_0x9f00('0x43')]+'%'};return _0x54a3b6;})});}_0x56ecce=_[_0x9f00('0x44')]({},_0x56ecce,_0x207237[_0x9f00('0x59')]);return db[_0x9f00('0x6f')][_0x9f00('0x94')](_0x56ecce);}})[_0x9f00('0x27')](respondWithResult(_0x49a984,null))['catch'](handleError(_0x49a984,null));};exports[_0x9f00('0x95')]=function(_0x254ed3,_0x14016e){return db[_0x9f00('0x6f')][_0x9f00('0x94')]({'where':{'ListId':null}})[_0x9f00('0x27')](handleEntityNotFound(_0x14016e,null))['then'](function(_0x2afa26){return _0x2afa26;})[_0x9f00('0x27')](respondWithResult(_0x14016e,null))[_0x9f00('0x49')](handleError(_0x14016e,null));};exports[_0x9f00('0x96')]=function(_0x31fded,_0xd0d672,_0x18137b){return db[_0x9f00('0x32')][_0x9f00('0x4d')]({'where':{'id':_0x31fded['params']['id']}})['then'](handleEntityNotFound(_0xd0d672,null))[_0x9f00('0x27')](function(_0x47c092){if(_0x47c092){return _0x47c092[_0x9f00('0x96')](_0x31fded[_0x9f00('0x53')][_0x9f00('0x5c')],_[_0x9f00('0x62')](_0x31fded[_0x9f00('0x53')],['ids','id'])||{})[_0x9f00('0x97')](function(_0x390df2){for(var _0xcc877=0x0;_0xcc877<_0x31fded[_0x9f00('0x53')][_0x9f00('0x5c')][_0x9f00('0x3c')];_0xcc877+=0x1){socket[_0x9f00('0x98')]('userCmList:save',{'UserId':Number(_0x31fded[_0x9f00('0x53')][_0x9f00('0x5c')][_0xcc877]),'CmListId':Number(_0x31fded[_0x9f00('0x4b')]['id'])});}return _0x390df2;});}})['then'](respondWithResult(_0xd0d672,null))[_0x9f00('0x49')](handleError(_0xd0d672,null));};exports[_0x9f00('0x99')]=function(_0x30d5e5,_0x3cca10,_0x590a35){return db[_0x9f00('0x32')][_0x9f00('0x4d')]({'where':{'id':_0x30d5e5[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x3cca10,null))[_0x9f00('0x27')](function(_0x12e0ae){if(_0x12e0ae){return _0x12e0ae[_0x9f00('0x99')](_0x30d5e5[_0x9f00('0x37')]['ids'])[_0x9f00('0x27')](function(){if(_[_0x9f00('0x60')](_0x30d5e5[_0x9f00('0x37')][_0x9f00('0x5c')])){for(var _0x5e9922=0x0;_0x5e9922<_0x30d5e5[_0x9f00('0x37')][_0x9f00('0x5c')][_0x9f00('0x3c')];_0x5e9922+=0x1){socket[_0x9f00('0x98')](_0x9f00('0x9a'),{'UserId':Number(_0x30d5e5[_0x9f00('0x37')]['ids'][_0x5e9922]),'CmListId':Number(_0x30d5e5[_0x9f00('0x4b')]['id'])});}}else{socket['emit'](_0x9f00('0x9a'),{'UserId':Number(_0x30d5e5[_0x9f00('0x37')][_0x9f00('0x5c')]),'CmListId':Number(_0x30d5e5['params']['id'])});}});}})[_0x9f00('0x27')](respondWithStatusCode(_0x3cca10,null))[_0x9f00('0x49')](handleError(_0x3cca10,null));};exports['getAgents']=function(_0x412303,_0x16114d,_0xd4e7f5){var _0x30c26b={};var _0x1d6aab={};var _0x14e5d3;var _0x2a08ec;return db[_0x9f00('0x32')][_0x9f00('0x87')]({'where':{'id':_0x412303[_0x9f00('0x4b')]['id']}})[_0x9f00('0x27')](handleEntityNotFound(_0x16114d,null))['then'](function(_0x111f7d){if(_0x111f7d){_0x14e5d3=_0x111f7d;_0x1d6aab[_0x9f00('0x36')]=_['keys'](db[_0x9f00('0x9b')]['rawAttributes']);_0x1d6aab[_0x9f00('0x37')]=_[_0x9f00('0x4c')](_0x412303[_0x9f00('0x37')]);_0x1d6aab[_0x9f00('0x38')]=_[_0x9f00('0x39')](_0x1d6aab[_0x9f00('0x36')],_0x1d6aab['query']);_0x30c26b[_0x9f00('0x3a')]=_['intersection'](_0x1d6aab['model'],qs[_0x9f00('0x3b')](_0x412303[_0x9f00('0x37')]['fields']));_0x30c26b[_0x9f00('0x3a')]=_0x30c26b[_0x9f00('0x3a')][_0x9f00('0x3c')]?_0x30c26b['attributes']:_0x1d6aab[_0x9f00('0x36')];_0x30c26b[_0x9f00('0x3f')]=qs[_0x9f00('0x40')](_0x412303[_0x9f00('0x37')][_0x9f00('0x40')]);_0x30c26b[_0x9f00('0x41')]=qs[_0x9f00('0x38')](_[_0x9f00('0x42')](_0x412303['query'],_0x1d6aab[_0x9f00('0x38')]));if(_0x412303[_0x9f00('0x37')][_0x9f00('0x43')]){_0x30c26b['where']=_[_0x9f00('0x44')](_0x30c26b[_0x9f00('0x41')],{'$or':_[_0x9f00('0x31')](_0x30c26b[_0x9f00('0x3a')],function(_0x23486c){var _0x4bb83d={};_0x4bb83d[_0x23486c]={'$like':'%'+_0x412303[_0x9f00('0x37')][_0x9f00('0x43')]+'%'};return _0x4bb83d;})});}_0x30c26b=_[_0x9f00('0x44')]({},_0x30c26b,_0x412303[_0x9f00('0x59')]);return _0x14e5d3[_0x9f00('0x9c')](_0x30c26b);}})[_0x9f00('0x27')](function(_0x337a41){if(_0x337a41){_0x2a08ec=_0x337a41[_0x9f00('0x3c')];if(!_0x412303[_0x9f00('0x37')]['hasOwnProperty'](_0x9f00('0x3e'))){_0x30c26b['limit']=qs[_0x9f00('0x21')](_0x412303[_0x9f00('0x37')][_0x9f00('0x21')]);_0x30c26b[_0x9f00('0x1f')]=qs[_0x9f00('0x1f')](_0x412303['query'][_0x9f00('0x1f')]);}return _0x14e5d3['getAgents'](_0x30c26b);}})[_0x9f00('0x27')](function(_0x1b4765){if(_0x1b4765){return _0x1b4765?{'count':_0x2a08ec,'rows':_0x1b4765}:null;}})['then'](respondWithResult(_0x16114d,null))[_0x9f00('0x49')](handleError(_0x16114d,null));};function handleQuery(_0x5ba91){logger['info'](_0x5ba91);return db[_0x9f00('0x90')][_0x9f00('0x37')](_0x5ba91)[_0x9f00('0x97')](function(_0x4ced7f){csv_results['push'](_0x4ced7f);})[_0x9f00('0x49')](function(_0x3a5438){logger['error'](_0x3a5438[_0x9f00('0x66')]);});} \ No newline at end of file +var _0xeedd=['status','json','offset','undefined','count','limit','apply','reject','save','then','destroy','get','Lists','UserProfileResource','error','name','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','map','VIRTUAL','options','CmList','findAll','rows','catch','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','ListId','Disposition','findOne','hasOwnProperty','order','pick','includeAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','errors','CustomFields','concat','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','CmCustomField','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','alias','field','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','isEmpty','now','format','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','queryInterface','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus'];(function(_0x2084e0,_0x4e90d7){var _0x252391=function(_0x5d6cff){while(--_0x5d6cff){_0x2084e0['push'](_0x2084e0['shift']());}};_0x252391(++_0x4e90d7);}(_0xeedd,0x7d));var _0xdeed=function(_0x59275b,_0xbfafac){_0x59275b=_0x59275b-0x0;var _0xd01950=_0xeedd[_0x59275b];return _0xd01950;};'use strict';var emlformat=require(_0xdeed('0x0'));var rimraf=require(_0xdeed('0x1'));var zipdir=require(_0xdeed('0x2'));var jsonpatch=require(_0xdeed('0x3'));var rp=require(_0xdeed('0x4'));var moment=require('moment');var BPromise=require(_0xdeed('0x5'));var Mustache=require(_0xdeed('0x6'));var util=require(_0xdeed('0x7'));var path=require(_0xdeed('0x8'));var sox=require(_0xdeed('0x9'));var csv=require(_0xdeed('0xa'));var ejs=require(_0xdeed('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdeed('0xc'));var squel=require('squel');var crypto=require(_0xdeed('0xd'));var jsforce=require(_0xdeed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdeed('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdeed('0xf'));var hardwareService=require(_0xdeed('0x10'));var logger=require(_0xdeed('0x11'))(_0xdeed('0x12'));var utils=require(_0xdeed('0x13'));var config=require(_0xdeed('0x14'));var licenseUtil=require(_0xdeed('0x15'));var db=require(_0xdeed('0x16'))['db'];var csv_results;config[_0xdeed('0x17')]=_[_0xdeed('0x18')](config['redis'],{'host':_0xdeed('0x19'),'port':0x18eb});var socket=require(_0xdeed('0x1a'))(new Redis(config[_0xdeed('0x17')]));require('./cmList.socket')[_0xdeed('0x1b')](socket);function respondWithStatusCode(_0x5164c5,_0x1fbfef){_0x1fbfef=_0x1fbfef||0xcc;return function(_0xd90f7){if(_0xd90f7){return _0x5164c5[_0xdeed('0x1c')](_0x1fbfef);}return _0x5164c5[_0xdeed('0x1d')](_0x1fbfef)['end']();};}function respondWithResult(_0x2ad1c9,_0x439fc6){_0x439fc6=_0x439fc6||0xc8;return function(_0x1d5671){if(_0x1d5671){return _0x2ad1c9['status'](_0x439fc6)[_0xdeed('0x1e')](_0x1d5671);}};}function respondWithFilteredResult(_0x2e03c2,_0x280a95){return function(_0x37553a){if(_0x37553a){var _0x2297cd=typeof _0x280a95[_0xdeed('0x1f')]===_0xdeed('0x20')&&typeof _0x280a95['limit']==='undefined';var _0x589d72=_0x37553a['count'];var _0x36040a=_0x2297cd?0x0:_0x280a95[_0xdeed('0x1f')];var _0x390498=_0x2297cd?_0x37553a[_0xdeed('0x21')]:_0x280a95['offset']+_0x280a95[_0xdeed('0x22')];var _0x4e71b6;if(_0x390498>=_0x589d72){_0x390498=_0x589d72;_0x4e71b6=0xc8;}else{_0x4e71b6=0xce;}_0x2e03c2[_0xdeed('0x1d')](_0x4e71b6);return _0x2e03c2['set']('Content-Range',_0x36040a+'-'+_0x390498+'/'+_0x589d72)[_0xdeed('0x1e')](_0x37553a);}return null;};}function patchUpdates(_0x29d419){return function(_0x94e3c5){try{jsonpatch[_0xdeed('0x23')](_0x94e3c5,_0x29d419,!![]);}catch(_0x16f443){return BPromise[_0xdeed('0x24')](_0x16f443);}return _0x94e3c5[_0xdeed('0x25')]();};}function saveUpdates(_0x53edef,_0x243518){return function(_0x2a38fb){if(_0x2a38fb){return _0x2a38fb['update'](_0x53edef)[_0xdeed('0x26')](function(_0x219111){return _0x219111;});}return null;};}function removeEntity(_0x3e0f09,_0xfde1d3){return function(_0x8c2589){if(_0x8c2589){return _0x8c2589[_0xdeed('0x27')]()[_0xdeed('0x26')](function(){var _0x82267e=_0x8c2589[_0xdeed('0x28')]({'plain':!![]});var _0x21a069=_0xdeed('0x29');return db[_0xdeed('0x2a')][_0xdeed('0x27')]({'where':{'type':_0x21a069,'resourceId':_0x82267e['id']}})['then'](function(){return _0x8c2589;});})[_0xdeed('0x26')](function(){_0x3e0f09[_0xdeed('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b1f0,_0x50ef58){return function(_0x351954){if(!_0x351954){_0x48b1f0[_0xdeed('0x1c')](0x194);}return _0x351954;};}function handleError(_0x511cbf,_0xe457ed){_0xe457ed=_0xe457ed||0x1f4;return function(_0x5dd5bc){logger[_0xdeed('0x2b')](_0x5dd5bc['stack']);if(_0x5dd5bc[_0xdeed('0x2c')]){delete _0x5dd5bc['name'];}_0x511cbf['status'](_0xe457ed)['send'](_0x5dd5bc);};}exports['index']=function(_0xe0145e,_0x5f245d){var _0x2d3696={},_0x29066d={},_0x5f04d6={'count':0x0,'rows':[]};var _0x3eb6e2=_['map'](db['CmList'][_0xdeed('0x2d')],function(_0x840501){return{'name':_0x840501[_0xdeed('0x2e')],'type':_0x840501[_0xdeed('0x2f')][_0xdeed('0x30')]};});_0x29066d[_0xdeed('0x31')]=_['map'](_0x3eb6e2,_0xdeed('0x2c'));_0x29066d[_0xdeed('0x32')]=_['keys'](_0xe0145e['query']);_0x29066d[_0xdeed('0x33')]=_['intersection'](_0x29066d[_0xdeed('0x31')],_0x29066d[_0xdeed('0x32')]);_0x2d3696['attributes']=_[_0xdeed('0x34')](_0x29066d[_0xdeed('0x31')],qs[_0xdeed('0x35')](_0xe0145e['query']['fields']));_0x2d3696[_0xdeed('0x36')]=_0x2d3696[_0xdeed('0x36')][_0xdeed('0x37')]?_0x2d3696[_0xdeed('0x36')]:_0x29066d['model'];if(!_0xe0145e[_0xdeed('0x32')]['hasOwnProperty'](_0xdeed('0x38'))){_0x2d3696[_0xdeed('0x22')]=qs[_0xdeed('0x22')](_0xe0145e[_0xdeed('0x32')][_0xdeed('0x22')]);_0x2d3696['offset']=qs['offset'](_0xe0145e[_0xdeed('0x32')][_0xdeed('0x1f')]);}_0x2d3696['order']=qs[_0xdeed('0x39')](_0xe0145e[_0xdeed('0x32')][_0xdeed('0x39')]);_0x2d3696[_0xdeed('0x3a')]=qs['filters'](_['pick'](_0xe0145e[_0xdeed('0x32')],_0x29066d[_0xdeed('0x33')]),_0x3eb6e2);if(_0xe0145e[_0xdeed('0x32')][_0xdeed('0x3b')]){_0x2d3696[_0xdeed('0x3a')]=_[_0xdeed('0x3c')](_0x2d3696[_0xdeed('0x3a')],{'$or':_[_0xdeed('0x3d')](_0x3eb6e2,function(_0x3a67e2){if(_0x3a67e2[_0xdeed('0x2f')]!==_0xdeed('0x3e')){var _0x21580b={};_0x21580b[_0x3a67e2[_0xdeed('0x2c')]]={'$like':'%'+_0xe0145e[_0xdeed('0x32')]['filter']+'%'};return _0x21580b;}})});}_0x2d3696=_[_0xdeed('0x3c')]({},_0x2d3696,_0xe0145e[_0xdeed('0x3f')]);var _0x2995a9={'where':_0x2d3696['where']};return db[_0xdeed('0x40')][_0xdeed('0x21')](_0x2995a9)[_0xdeed('0x26')](function(_0xb3f738){_0x5f04d6[_0xdeed('0x21')]=_0xb3f738;if(_0xe0145e[_0xdeed('0x32')]['includeAll']){_0x2d3696['include']=[{'all':!![]}];}return db['CmList'][_0xdeed('0x41')](_0x2d3696);})['then'](function(_0x29c370){_0x5f04d6[_0xdeed('0x42')]=_0x29c370;return _0x5f04d6;})[_0xdeed('0x26')](respondWithFilteredResult(_0x5f245d,_0x2d3696))[_0xdeed('0x43')](handleError(_0x5f245d,null));};exports['show']=function(_0x3e3e0d,_0x222696){var _0x69204c={'raw':![],'where':{'id':_0x3e3e0d[_0xdeed('0x44')]['id']}},_0x35968e={};_0x35968e['model']=_[_0xdeed('0x45')](db[_0xdeed('0x40')][_0xdeed('0x2d')]);_0x35968e[_0xdeed('0x32')]=_[_0xdeed('0x45')](_0x3e3e0d['query']);_0x35968e['filters']=_[_0xdeed('0x34')](_0x35968e[_0xdeed('0x31')],_0x35968e[_0xdeed('0x32')]);_0x69204c[_0xdeed('0x36')]=_[_0xdeed('0x34')](_0x35968e[_0xdeed('0x31')],qs[_0xdeed('0x35')](_0x3e3e0d[_0xdeed('0x32')]['fields']));_0x69204c['attributes']=_0x69204c[_0xdeed('0x36')][_0xdeed('0x37')]?_0x69204c[_0xdeed('0x36')]:_0x35968e[_0xdeed('0x31')];if(_0x3e3e0d[_0xdeed('0x32')]['includeAll']){_0x69204c[_0xdeed('0x46')]=[{'all':!![]}];}_0x69204c=_[_0xdeed('0x3c')]({},_0x69204c,_0x3e3e0d['options']);return db[_0xdeed('0x40')][_0xdeed('0x47')](_0x69204c)['then'](handleEntityNotFound(_0x222696,null))[_0xdeed('0x26')](respondWithResult(_0x222696,null))[_0xdeed('0x43')](handleError(_0x222696,null));};exports[_0xdeed('0x48')]=function(_0xb2131d,_0x339f96){return db[_0xdeed('0x40')][_0xdeed('0x48')](_0xb2131d[_0xdeed('0x49')],{})[_0xdeed('0x26')](function(_0x43b625){var _0x21c171=_0xb2131d[_0xdeed('0x4a')]['get']({'plain':!![]});if(!_0x21c171)throw new Error(_0xdeed('0x4b'));if(_0x21c171[_0xdeed('0x4c')]===_0xdeed('0x4a')){var _0x2044c2=_0x43b625['get']({'plain':!![]});var _0x4321ac=_0xdeed('0x29');return db[_0xdeed('0x4d')][_0xdeed('0x47')]({'where':{'name':_0x4321ac,'userProfileId':_0x21c171[_0xdeed('0x4e')]},'raw':!![]})[_0xdeed('0x26')](function(_0x32f62a){if(_0x32f62a&&_0x32f62a[_0xdeed('0x4f')]===0x0){return db[_0xdeed('0x2a')][_0xdeed('0x48')]({'name':_0x2044c2[_0xdeed('0x2c')],'resourceId':_0x2044c2['id'],'type':_0x32f62a['name'],'sectionId':_0x32f62a['id']},{})['then'](function(){return _0x43b625;});}else{return _0x43b625;}})[_0xdeed('0x43')](function(_0x5c7018){logger[_0xdeed('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c7018);throw _0x5c7018;});}return _0x43b625;})[_0xdeed('0x26')](respondWithResult(_0x339f96,0xc9))[_0xdeed('0x43')](handleError(_0x339f96,null));};exports['update']=function(_0x16b6bb,_0x2e92b5){if(_0x16b6bb['body']['id']){delete _0x16b6bb[_0xdeed('0x49')]['id'];}return db[_0xdeed('0x40')][_0xdeed('0x47')]({'where':{'id':_0x16b6bb[_0xdeed('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e92b5,null))[_0xdeed('0x26')](saveUpdates(_0x16b6bb[_0xdeed('0x49')],null))[_0xdeed('0x26')](respondWithResult(_0x2e92b5,null))[_0xdeed('0x43')](handleError(_0x2e92b5,null));};exports[_0xdeed('0x27')]=function(_0x4fbad1,_0x24a3fd){return db[_0xdeed('0x40')]['find']({'where':{'id':_0x4fbad1[_0xdeed('0x44')]['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x24a3fd,null))[_0xdeed('0x26')](removeEntity(_0x24a3fd,null))['catch'](handleError(_0x24a3fd,null));};exports['describe']=function(_0xd57ab1,_0x4cc5f9){return db[_0xdeed('0x40')][_0xdeed('0x50')]()[_0xdeed('0x26')](respondWithResult(_0x4cc5f9,null))['catch'](handleError(_0x4cc5f9,null));};exports[_0xdeed('0x51')]=function(_0x546781,_0x4ba391,_0x11d64a){if(_0x546781['body']['id']){delete _0x546781[_0xdeed('0x49')]['id'];}return db[_0xdeed('0x40')][_0xdeed('0x47')]({'where':{'id':_0x546781[_0xdeed('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ba391,null))['then'](function(_0xf6f5cb){if(_0xf6f5cb){_0x546781[_0xdeed('0x49')][_0xdeed('0x52')]=_0xf6f5cb['id'];return db[_0xdeed('0x53')][_0xdeed('0x48')](_0x546781[_0xdeed('0x49')]);}})[_0xdeed('0x26')](respondWithResult(_0x4ba391,null))['catch'](handleError(_0x4ba391,null));};exports['getDispositions']=function(_0x2017ba,_0x49f785,_0x55fa34){var _0x4fb1da={'raw':![],'where':{}};var _0x56684d={};var _0x2e339e={'count':0x0,'rows':[]};return db['CmList'][_0xdeed('0x54')]({'where':{'id':_0x2017ba['params']['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x49f785,null))[_0xdeed('0x26')](function(_0xb2b2){if(_0xb2b2){_0x56684d[_0xdeed('0x31')]=_[_0xdeed('0x45')](db[_0xdeed('0x53')][_0xdeed('0x2d')]);_0x56684d[_0xdeed('0x32')]=_[_0xdeed('0x45')](_0x2017ba[_0xdeed('0x32')]);_0x56684d[_0xdeed('0x33')]=_[_0xdeed('0x34')](_0x56684d[_0xdeed('0x31')],_0x56684d[_0xdeed('0x32')]);_0x4fb1da[_0xdeed('0x36')]=_['intersection'](_0x56684d[_0xdeed('0x31')],qs[_0xdeed('0x35')](_0x2017ba[_0xdeed('0x32')][_0xdeed('0x35')]));_0x4fb1da[_0xdeed('0x36')]=_0x4fb1da[_0xdeed('0x36')][_0xdeed('0x37')]?_0x4fb1da[_0xdeed('0x36')]:_0x56684d[_0xdeed('0x31')];if(!_0x2017ba[_0xdeed('0x32')][_0xdeed('0x55')](_0xdeed('0x38'))){_0x4fb1da['limit']=qs[_0xdeed('0x22')](_0x2017ba[_0xdeed('0x32')][_0xdeed('0x22')]);_0x4fb1da[_0xdeed('0x1f')]=qs['offset'](_0x2017ba[_0xdeed('0x32')][_0xdeed('0x1f')]);}_0x4fb1da[_0xdeed('0x56')]=qs[_0xdeed('0x39')](_0x2017ba[_0xdeed('0x32')][_0xdeed('0x39')]);_0x4fb1da[_0xdeed('0x3a')]=qs[_0xdeed('0x33')](_[_0xdeed('0x57')](_0x2017ba[_0xdeed('0x32')],_0x56684d[_0xdeed('0x33')]));_0x4fb1da[_0xdeed('0x3a')][_0xdeed('0x52')]=_0xb2b2['id'];if(_0x2017ba[_0xdeed('0x32')]['filter']){_0x4fb1da[_0xdeed('0x3a')]=_[_0xdeed('0x3c')](_0x4fb1da[_0xdeed('0x3a')],{'$or':_['map'](_0x4fb1da[_0xdeed('0x36')],function(_0x5d2f3b){var _0x3b4471={};_0x3b4471[_0x5d2f3b]={'$like':'%'+_0x2017ba[_0xdeed('0x32')][_0xdeed('0x3b')]+'%'};return _0x3b4471;})});}_0x4fb1da=_[_0xdeed('0x3c')]({},_0x4fb1da,_0x2017ba[_0xdeed('0x3f')]);return db[_0xdeed('0x53')][_0xdeed('0x21')]({'where':_0x4fb1da[_0xdeed('0x3a')]})[_0xdeed('0x26')](function(_0x4290b3){_0x2e339e['count']=_0x4290b3;if(_0x2017ba[_0xdeed('0x32')][_0xdeed('0x58')]){_0x4fb1da['include']=[{'all':!![]}];}return db[_0xdeed('0x53')][_0xdeed('0x41')](_0x4fb1da);})[_0xdeed('0x26')](function(_0x517170){_0x2e339e[_0xdeed('0x42')]=_0x517170;return _0x2e339e;});}})['then'](respondWithFilteredResult(_0x49f785,_0x4fb1da))[_0xdeed('0x43')](handleError(_0x49f785,null));};exports[_0xdeed('0x59')]=function(_0xf0f30e,_0x4eb69e,_0x4aa6af){return db[_0xdeed('0x40')]['find']({'where':{'id':_0xf0f30e[_0xdeed('0x44')]['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x4eb69e,null))[_0xdeed('0x26')](function(_0xb965d6){if(_0xb965d6){return _0xb965d6[_0xdeed('0x59')](_0xf0f30e[_0xdeed('0x32')][_0xdeed('0x5a')]);}})['then'](respondWithStatusCode(_0x4eb69e,null))[_0xdeed('0x43')](handleError(_0x4eb69e,null));};exports[_0xdeed('0x5b')]=function(_0x9fe92c,_0x311edc,_0x23ae64){return db[_0xdeed('0x40')][_0xdeed('0x47')]({'where':{'id':_0x9fe92c['params']['id']}})['then'](handleEntityNotFound(_0x311edc,null))[_0xdeed('0x26')](function(_0x55a0b7){if(_0x55a0b7){var _0x16185a=[];var _0x3f1990={'success':[],'errors':[]};return db[_0xdeed('0x5c')]['describe']()[_0xdeed('0x26')](function(_0x1fa9fb){if(_0x9fe92c['body'][_0xdeed('0x5d')]&&_[_0xdeed('0x5e')](_0x9fe92c[_0xdeed('0x49')]['tags'])){if(_0x9fe92c[_0xdeed('0x49')][_0xdeed('0x5d')][_0xdeed('0x37')]){_0x9fe92c[_0xdeed('0x49')][_0xdeed('0x5d')]=_0x9fe92c[_0xdeed('0x49')][_0xdeed('0x5d')]['join'](';')+';';}else{_0x9fe92c[_0xdeed('0x49')][_0xdeed('0x5d')]=null;}}else{_0x9fe92c[_0xdeed('0x49')][_0xdeed('0x5d')]=null;}if(_0x9fe92c[_0xdeed('0x49')]&&_[_0xdeed('0x5e')](_0x9fe92c[_0xdeed('0x49')])){for(var _0x179fff=0x0;_0x179fff<_0x9fe92c[_0xdeed('0x49')]['length'];_0x179fff+=0x1){_0x9fe92c['body'][_0x179fff][_0xdeed('0x52')]=_0x9fe92c[_0xdeed('0x44')]['id'];_0x16185a[_0xdeed('0x5f')](_0x9fe92c[_0xdeed('0x49')][_0x179fff]);}return BPromise[_0xdeed('0x60')](_0x16185a,function(_0x3b59d6){return db[_0xdeed('0x5c')][_0xdeed('0x48')](_[_0xdeed('0x61')](_0x3b59d6,[_0xdeed('0x5a'),'id'])||{},{'fields':_[_0xdeed('0x45')](_0x1fa9fb),'raw':!![]})[_0xdeed('0x26')](function(_0x500abf){_0x3f1990[_0xdeed('0x62')][_0xdeed('0x5f')](_0x500abf['dataValues']);})[_0xdeed('0x43')](function(_0x82260d){_0x3f1990[_0xdeed('0x63')]['push']({'data':_0x3b59d6,'error':_0x82260d['message']});});})[_0xdeed('0x26')](function(_0x9d88c5){return _0x3f1990;})['catch'](function(_0x4131bd){return _0x4131bd;});}else{_0x311edc[_0xdeed('0x1d')](0x190)[_0xdeed('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xdeed('0x26')](respondWithResult(_0x311edc,null))[_0xdeed('0x43')](handleError(_0x311edc,null));};exports['getContacts']=function(_0x41501c,_0xb56ddd,_0x8625ac){var _0x4f3343;return db['CmList']['find']({'where':{'id':_0x41501c[_0xdeed('0x44')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xdeed('0x64')}]})[_0xdeed('0x26')](handleEntityNotFound(_0xb56ddd,null))['then'](function(_0xe36012){if(_0xe36012){_0x4f3343=_0xe36012;return db[_0xdeed('0x5c')][_0xdeed('0x2d')];}})[_0xdeed('0x26')](function(_0x747297){if(_0x747297){var _0x2c3831={};var _0x1b884f={};_0x1b884f[_0xdeed('0x31')]=_[_0xdeed('0x65')](_[_0xdeed('0x45')](_0x747297),_['map'](_0x4f3343[_0xdeed('0x64')],function(_0x1f3086){return util['format']('cf_%d',_0x1f3086['id']);}));_0x1b884f['query']=_[_0xdeed('0x45')](_0x41501c[_0xdeed('0x32')]);_0x1b884f['filters']=_['intersection'](_0x1b884f[_0xdeed('0x31')],_0x1b884f[_0xdeed('0x32')]);_0x2c3831[_0xdeed('0x36')]=_[_0xdeed('0x34')](_0x1b884f[_0xdeed('0x31')],qs[_0xdeed('0x35')](_0x41501c['query'][_0xdeed('0x35')]));_0x2c3831['attributes']=_0x2c3831[_0xdeed('0x36')]['length']?_0x2c3831[_0xdeed('0x36')]:_0x1b884f[_0xdeed('0x31')];if(!_0x41501c[_0xdeed('0x32')][_0xdeed('0x55')]('nolimit')){_0x2c3831[_0xdeed('0x22')]=qs[_0xdeed('0x22')](_0x41501c[_0xdeed('0x32')]['limit']);_0x2c3831[_0xdeed('0x1f')]=qs['offset'](_0x41501c[_0xdeed('0x32')][_0xdeed('0x1f')]);}_0x2c3831[_0xdeed('0x56')]=qs[_0xdeed('0x39')](_0x41501c[_0xdeed('0x32')][_0xdeed('0x39')]);_0x2c3831[_0xdeed('0x3a')]=qs[_0xdeed('0x33')](_[_0xdeed('0x57')](_0x41501c[_0xdeed('0x32')],_0x1b884f['filters']));_0x2c3831[_0xdeed('0x66')]=!![];if(_0x41501c[_0xdeed('0x32')][_0xdeed('0x3b')]){_0x2c3831['where']=_[_0xdeed('0x3c')](_0x2c3831['where'],{'$or':_['map'](_0x2c3831[_0xdeed('0x36')],function(_0x31804e){var _0x38bdbc={};_0x38bdbc[_0x31804e]={'$like':'%'+_0x41501c[_0xdeed('0x32')]['filter']+'%'};return _0x38bdbc;})});}_0x2c3831=_[_0xdeed('0x3c')]({},_0x2c3831,_0x41501c[_0xdeed('0x3f')]);return _0x4f3343[_0xdeed('0x67')](_0x2c3831);}})[_0xdeed('0x26')](respondWithResult(_0xb56ddd,null))['catch'](handleError(_0xb56ddd,null));};exports[_0xdeed('0x68')]=function(_0x509740,_0x1542d7,_0x23f485){var _0x3de01c;var _0x328808;var _0x2bab51;var _0x1a42fa=_0x509740[_0xdeed('0x44')]['id'];csv_results=[];return db[_0xdeed('0x69')]['findAll']({'attributes':['id',_0xdeed('0x2c')],'raw':!![],'order':[_0xdeed('0x6a')]})[_0xdeed('0x26')](function(_0x1f679b){_0x3de01c=_0x1f679b;var _0x43cfa4=_[_0xdeed('0x45')](db[_0xdeed('0x5c')]['rawAttributes']);return db[_0xdeed('0x6b')][_0xdeed('0x41')]({'raw':!![],'attributes':['id','alias']})[_0xdeed('0x26')](function(_0x3effea){_0x328808=_0x3effea;var _0x3d0ca5=squel[_0xdeed('0x6c')]()['fields'](_0x43cfa4)[_0xdeed('0x6d')](_0xdeed('0x6e'),'c')[_0xdeed('0x3a')](_0xdeed('0x6f'),_0x1a42fa)[_0xdeed('0x3a')](_0xdeed('0x70'))[_0xdeed('0x71')]();for(var _0x1803bd=0x0;_0x1803bd<_0x328808[_0xdeed('0x37')];_0x1803bd++){_0x3d0ca5['field'](_0xdeed('0x72')+_0x328808[_0x1803bd]['id'],'customField_'+_0x328808[_0x1803bd][_0xdeed('0x73')]);}for(var _0x1803bd=0x0;_0x1803bd<_0x3de01c['length'];_0x1803bd++){_0x3d0ca5[_0xdeed('0x74')](squel[_0xdeed('0x6c')]()[_0xdeed('0x74')]('item')[_0xdeed('0x6d')](_0xdeed('0x75'))[_0xdeed('0x3a')](_0xdeed('0x76'),_0x3de01c[_0x1803bd]['id'])[_0xdeed('0x3a')](_0xdeed('0x77')),_0xdeed('0x78')+_0x3de01c[_0x1803bd][_0xdeed('0x2c')]);_0x3d0ca5[_0xdeed('0x74')](squel[_0xdeed('0x6c')]()['field'](_0xdeed('0x79'))[_0xdeed('0x6d')](_0xdeed('0x75'))['where'](_0xdeed('0x76'),_0x3de01c[_0x1803bd]['id'])[_0xdeed('0x3a')](_0xdeed('0x77')),'description_additionalPhone_'+_0x3de01c[_0x1803bd][_0xdeed('0x2c')]);}var _0x5c15af=[];_0x5c15af[_0xdeed('0x5f')](_0x3d0ca5['toString']());BPromise[_0xdeed('0x60')](_0x5c15af,handleQuery)[_0xdeed('0x26')](function(_0x388f4b){handleQuery(_0x3d0ca5['toString']());var _0x31f542=csv_results[0x0];if(!_[_0xdeed('0x7a')](_0x31f542)){var _0x1b79c1=toCsv(_0x31f542);var _0x1bbe68=Date[_0xdeed('0x7b')]();fs['writeFileSync'](util[_0xdeed('0x7c')]('/tmp/list_%d_%s.csv',_0x1a42fa,_0x1bbe68),_0x1b79c1);_0x1542d7['setHeader'](_0xdeed('0x7d'),_0xdeed('0x7e')+util[_0xdeed('0x7c')](_0xdeed('0x7f'),_0x1a42fa,_0x1bbe68));_0x1542d7[_0xdeed('0x80')](_0xdeed('0x81'),'text/csv');return _0x1542d7[_0xdeed('0x82')](util['format'](_0xdeed('0x83'),_0x1a42fa,_0x1bbe68));}else{return _0x1542d7[_0xdeed('0x1c')](0xcc);}});});});};exports['addCustomField']=function(_0x142125,_0x454ff2,_0x1122f6){var _0x505f11;delete _0x142125['body']['id'];return db[_0xdeed('0x40')]['findOne']({'where':{'id':_0x142125['params']['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x454ff2,null))[_0xdeed('0x26')](function(_0x20c111){if(_0x20c111){return db[_0xdeed('0x84')][_0xdeed('0x85')](function(_0x502390){return db[_0xdeed('0x6b')][_0xdeed('0x48')](_0x142125[_0xdeed('0x49')],{'transaction':_0x502390})[_0xdeed('0x26')](function(_0x5cb1c2){_0x505f11=_0x5cb1c2;return _0x20c111[_0xdeed('0x86')](_0x5cb1c2,{'transaction':_0x502390});})[_0xdeed('0x26')](function(){var _0x39151d={'type':db[_0xdeed('0x87')][_0xdeed('0x88')],'transaction':_0x502390};switch(_0x142125['body'][_0xdeed('0x2f')]){case _0xdeed('0x89'):_0x39151d[_0xdeed('0x2f')]=db[_0xdeed('0x87')][_0xdeed('0x88')];break;case _0xdeed('0x8a'):_0x39151d['type']=db[_0xdeed('0x87')]['INTEGER'];break;case _0xdeed('0x8b'):_0x39151d[_0xdeed('0x2f')]=db[_0xdeed('0x87')][_0xdeed('0x8c')];_0x39151d['defaultValue']=![];break;default:}return db[_0xdeed('0x84')][_0xdeed('0x8d')]['addColumn'](_0xdeed('0x6e'),util[_0xdeed('0x7c')]('cf_%s',_0x505f11['id']),_0x39151d);})['then'](function(){return _0x505f11;});});}})[_0xdeed('0x26')](respondWithResult(_0x454ff2,null))[_0xdeed('0x43')](handleError(_0x454ff2,null));};exports[_0xdeed('0x8e')]=function(_0x32e580,_0x24b53f,_0x154e25){var _0x4ecf86={};var _0x538b64={};var _0x3e2165;var _0x1bec39;return db[_0xdeed('0x40')][_0xdeed('0x54')]({'where':{'id':_0x32e580['params']['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x24b53f,null))[_0xdeed('0x26')](function(_0x4399c6){if(_0x4399c6){_0x3e2165=_0x4399c6;_0x538b64[_0xdeed('0x31')]=_[_0xdeed('0x45')](db[_0xdeed('0x6b')][_0xdeed('0x2d')]);_0x538b64['query']=_[_0xdeed('0x45')](_0x32e580[_0xdeed('0x32')]);_0x538b64['filters']=_['intersection'](_0x538b64[_0xdeed('0x31')],_0x538b64[_0xdeed('0x32')]);_0x4ecf86[_0xdeed('0x36')]=_[_0xdeed('0x34')](_0x538b64[_0xdeed('0x31')],qs[_0xdeed('0x35')](_0x32e580[_0xdeed('0x32')][_0xdeed('0x35')]));_0x4ecf86['attributes']=_0x4ecf86['attributes'][_0xdeed('0x37')]?_0x4ecf86[_0xdeed('0x36')]:_0x538b64['model'];_0x4ecf86[_0xdeed('0x56')]=qs['sort'](_0x32e580['query'][_0xdeed('0x39')]);_0x4ecf86['where']=qs[_0xdeed('0x33')](_[_0xdeed('0x57')](_0x32e580['query'],_0x538b64['filters']));_0x4ecf86['where']=_[_0xdeed('0x3c')](_0x4ecf86[_0xdeed('0x3a')],{'$or':[{'ListId':_0x4399c6['id']},{'ListId':null}]});if(_0x32e580[_0xdeed('0x32')][_0xdeed('0x3b')]){_0x4ecf86[_0xdeed('0x3a')]=_[_0xdeed('0x3c')](_0x4ecf86[_0xdeed('0x3a')],{'$or':_[_0xdeed('0x3d')](_0x4ecf86[_0xdeed('0x36')],function(_0x12b2f7){var _0x8b8586={};_0x8b8586[_0x12b2f7]={'$like':'%'+_0x32e580['query'][_0xdeed('0x3b')]+'%'};return _0x8b8586;})});}_0x4ecf86=_[_0xdeed('0x3c')]({},_0x4ecf86,_0x32e580[_0xdeed('0x3f')]);return db[_0xdeed('0x6b')][_0xdeed('0x8f')](_0x4ecf86);}})['then'](respondWithResult(_0x24b53f,null))['catch'](handleError(_0x24b53f,null));};exports[_0xdeed('0x90')]=function(_0x5f2739,_0x393f37){return db[_0xdeed('0x6b')]['findAndCountAll']({'where':{'ListId':null}})[_0xdeed('0x26')](handleEntityNotFound(_0x393f37,null))[_0xdeed('0x26')](function(_0x3d323c){return _0x3d323c;})[_0xdeed('0x26')](respondWithResult(_0x393f37,null))['catch'](handleError(_0x393f37,null));};exports[_0xdeed('0x91')]=function(_0x36b2f5,_0x1c7bcf,_0xdb5f46){return db[_0xdeed('0x40')][_0xdeed('0x47')]({'where':{'id':_0x36b2f5[_0xdeed('0x44')]['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x1c7bcf,null))[_0xdeed('0x26')](function(_0x3031c1){if(_0x3031c1){return _0x3031c1[_0xdeed('0x91')](_0x36b2f5['body'][_0xdeed('0x5a')],_[_0xdeed('0x61')](_0x36b2f5[_0xdeed('0x49')],[_0xdeed('0x5a'),'id'])||{})[_0xdeed('0x92')](function(_0xd71f6e){for(var _0x509707=0x0;_0x509707<_0x36b2f5[_0xdeed('0x49')][_0xdeed('0x5a')][_0xdeed('0x37')];_0x509707+=0x1){socket[_0xdeed('0x93')](_0xdeed('0x94'),{'UserId':Number(_0x36b2f5[_0xdeed('0x49')][_0xdeed('0x5a')][_0x509707]),'CmListId':Number(_0x36b2f5[_0xdeed('0x44')]['id'])});}return _0xd71f6e;});}})['then'](respondWithResult(_0x1c7bcf,null))[_0xdeed('0x43')](handleError(_0x1c7bcf,null));};exports[_0xdeed('0x95')]=function(_0x3b4239,_0x2e9dff,_0xc03336){return db[_0xdeed('0x40')]['find']({'where':{'id':_0x3b4239[_0xdeed('0x44')]['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x2e9dff,null))[_0xdeed('0x26')](function(_0x109151){if(_0x109151){return _0x109151[_0xdeed('0x95')](_0x3b4239['query'][_0xdeed('0x5a')])[_0xdeed('0x26')](function(){if(_[_0xdeed('0x5e')](_0x3b4239['query'][_0xdeed('0x5a')])){for(var _0x2c22e3=0x0;_0x2c22e3<_0x3b4239['query'][_0xdeed('0x5a')][_0xdeed('0x37')];_0x2c22e3+=0x1){socket[_0xdeed('0x93')](_0xdeed('0x96'),{'UserId':Number(_0x3b4239['query'][_0xdeed('0x5a')][_0x2c22e3]),'CmListId':Number(_0x3b4239[_0xdeed('0x44')]['id'])});}}else{socket[_0xdeed('0x93')]('userCmList:remove',{'UserId':Number(_0x3b4239[_0xdeed('0x32')][_0xdeed('0x5a')]),'CmListId':Number(_0x3b4239[_0xdeed('0x44')]['id'])});}});}})[_0xdeed('0x26')](respondWithStatusCode(_0x2e9dff,null))['catch'](handleError(_0x2e9dff,null));};exports[_0xdeed('0x97')]=function(_0x41ff1f,_0x17034e,_0x59c963){var _0x5b9830={};var _0x380b43={};var _0x408030;var _0xeff626;return db['CmList'][_0xdeed('0x54')]({'where':{'id':_0x41ff1f[_0xdeed('0x44')]['id']}})[_0xdeed('0x26')](handleEntityNotFound(_0x17034e,null))[_0xdeed('0x26')](function(_0x225545){if(_0x225545){_0x408030=_0x225545;_0x380b43[_0xdeed('0x31')]=_[_0xdeed('0x45')](db['User']['rawAttributes']);_0x380b43['query']=_[_0xdeed('0x45')](_0x41ff1f[_0xdeed('0x32')]);_0x380b43[_0xdeed('0x33')]=_[_0xdeed('0x34')](_0x380b43['model'],_0x380b43[_0xdeed('0x32')]);_0x5b9830['attributes']=_[_0xdeed('0x34')](_0x380b43[_0xdeed('0x31')],qs[_0xdeed('0x35')](_0x41ff1f[_0xdeed('0x32')]['fields']));_0x5b9830[_0xdeed('0x36')]=_0x5b9830[_0xdeed('0x36')][_0xdeed('0x37')]?_0x5b9830['attributes']:_0x380b43[_0xdeed('0x31')];_0x5b9830[_0xdeed('0x56')]=qs[_0xdeed('0x39')](_0x41ff1f['query'][_0xdeed('0x39')]);_0x5b9830[_0xdeed('0x3a')]=qs[_0xdeed('0x33')](_[_0xdeed('0x57')](_0x41ff1f[_0xdeed('0x32')],_0x380b43['filters']));if(_0x41ff1f[_0xdeed('0x32')][_0xdeed('0x3b')]){_0x5b9830[_0xdeed('0x3a')]=_[_0xdeed('0x3c')](_0x5b9830[_0xdeed('0x3a')],{'$or':_['map'](_0x5b9830[_0xdeed('0x36')],function(_0x3210a5){var _0x333c69={};_0x333c69[_0x3210a5]={'$like':'%'+_0x41ff1f[_0xdeed('0x32')][_0xdeed('0x3b')]+'%'};return _0x333c69;})});}_0x5b9830=_[_0xdeed('0x3c')]({},_0x5b9830,_0x41ff1f[_0xdeed('0x3f')]);return _0x408030['getAgents'](_0x5b9830);}})[_0xdeed('0x26')](function(_0x181c6e){if(_0x181c6e){_0xeff626=_0x181c6e[_0xdeed('0x37')];if(!_0x41ff1f[_0xdeed('0x32')][_0xdeed('0x55')]('nolimit')){_0x5b9830['limit']=qs[_0xdeed('0x22')](_0x41ff1f[_0xdeed('0x32')][_0xdeed('0x22')]);_0x5b9830[_0xdeed('0x1f')]=qs[_0xdeed('0x1f')](_0x41ff1f['query'][_0xdeed('0x1f')]);}return _0x408030[_0xdeed('0x97')](_0x5b9830);}})['then'](function(_0x486cf0){if(_0x486cf0){return _0x486cf0?{'count':_0xeff626,'rows':_0x486cf0}:null;}})[_0xdeed('0x26')](respondWithResult(_0x17034e,null))[_0xdeed('0x43')](handleError(_0x17034e,null));};function handleQuery(_0x46f66c){logger[_0xdeed('0x98')](_0x46f66c);return db['sequelize'][_0xdeed('0x32')](_0x46f66c)[_0xdeed('0x92')](function(_0x41e0a0){csv_results[_0xdeed('0x5f')](_0x41e0a0);})[_0xdeed('0x43')](function(_0x4e0af5){logger[_0xdeed('0x2b')](_0x4e0af5[_0xdeed('0x99')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c6fc14b..54866b0 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(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x55ca,0x126));var _0xa55c=function(_0x3a833e,_0x5a1878){_0x3a833e=_0x3a833e-0x0;var _0xdff445=_0x55ca[_0x3a833e];return _0xdff445;};'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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0xda9376,_0x4781f4){var _0x5edd99=function(_0x223055){while(--_0x223055){_0xda9376['push'](_0xda9376['shift']());}};_0x5edd99(++_0x4781f4);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 47a543c..e304789 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 _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x1fb7cc,_0x3bd1e0){var _0xeec51=function(_0x2ee6a6){while(--_0x2ee6a6){_0x1fb7cc['push'](_0x1fb7cc['shift']());}};_0xeec51(++_0x3bd1e0);}(_0x1339,0x1ed));var _0x9133=function(_0x27aabf,_0x44404d){_0x27aabf=_0x27aabf-0x0;var _0x438f5b=_0x1339[_0x27aabf];return _0x438f5b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b02=['define','CmList','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x3b5d33,_0x39d240){var _0xdcd861=function(_0x2fb05c){while(--_0x2fb05c){_0x3b5d33['push'](_0x3b5d33['shift']());}};_0xdcd861(++_0x39d240);}(_0x5b02,0xe9));var _0x25b0=function(_0x21a85a,_0x1a31e1){_0x21a85a=_0x21a85a-0x0;var _0x280655=_0x5b02[_0x21a85a];return _0x280655;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'cm_lists','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 93bd0d3..9bcd902 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 _0x18c3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./cmList.socket','request','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x555467,_0x25a301){var _0xe2bc3c=function(_0x1128ee){while(--_0x1128ee){_0x555467['push'](_0x555467['shift']());}};_0xe2bc3c(++_0x25a301);}(_0x18c3,0x83));var _0x318c=function(_0x48e56b,_0x9a9fb8){_0x48e56b=_0x48e56b-0x0;var _0x4f06b6=_0x18c3[_0x48e56b];return _0x4f06b6;};'use strict';var _=require(_0x318c('0x0'));var util=require(_0x318c('0x1'));var moment=require('moment');var BPromise=require(_0x318c('0x2'));var rs=require(_0x318c('0x3'));var fs=require('fs');var Redis=require(_0x318c('0x4'));var db=require(_0x318c('0x5'))['db'];var utils=require(_0x318c('0x6'));var logger=require(_0x318c('0x7'))(_0x318c('0x8'));var config=require(_0x318c('0x9'));var jayson=require(_0x318c('0xa'));var client=jayson[_0x318c('0xb')][_0x318c('0xc')]({'port':0x232a});config['redis']=_[_0x318c('0xd')](config[_0x318c('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x318c('0xe')]));require(_0x318c('0xf'))['register'](socket);function respondWithRpcPromise(_0x45fe80,_0x2ae4ec,_0x49fa92){return new BPromise(function(_0x13b4dc,_0x3817ca){return client[_0x318c('0x10')](_0x45fe80,_0x49fa92)['then'](function(_0x26cd3f){logger['info']('CmList,\x20%s,\x20%s',_0x2ae4ec,_0x318c('0x11'));logger[_0x318c('0x12')](_0x318c('0x13'),_0x2ae4ec,_0x318c('0x11'),JSON[_0x318c('0x14')](_0x26cd3f));if(_0x26cd3f[_0x318c('0x15')]){if(_0x26cd3f['error'][_0x318c('0x16')]===0x1f4){logger[_0x318c('0x15')](_0x318c('0x17'),_0x2ae4ec,_0x26cd3f[_0x318c('0x15')][_0x318c('0x18')]);return _0x3817ca(_0x26cd3f[_0x318c('0x15')][_0x318c('0x18')]);}logger[_0x318c('0x15')](_0x318c('0x17'),_0x2ae4ec,_0x26cd3f[_0x318c('0x15')][_0x318c('0x18')]);return _0x13b4dc(_0x26cd3f[_0x318c('0x15')]['message']);}else{logger['info'](_0x318c('0x17'),_0x2ae4ec,_0x318c('0x11'));_0x13b4dc(_0x26cd3f[_0x318c('0x19')]['message']);}})[_0x318c('0x1a')](function(_0x3f9f51){logger['error']('CmList,\x20%s,\x20%s',_0x2ae4ec,_0x3f9f51);_0x3817ca(_0x3f9f51);});});} \ No newline at end of file +var _0x895b=['request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./cmList.socket','request','info','CmList,\x20%s,\x20%s'];(function(_0x185ecc,_0x506fa0){var _0x59885d=function(_0x589261){while(--_0x589261){_0x185ecc['push'](_0x185ecc['shift']());}};_0x59885d(++_0x506fa0);}(_0x895b,0x12c));var _0xb895=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x895b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb895('0x0'));var moment=require(_0xb895('0x1'));var BPromise=require(_0xb895('0x2'));var rs=require(_0xb895('0x3'));var fs=require('fs');var Redis=require(_0xb895('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb895('0x5'))('rpc');var config=require(_0xb895('0x6'));var jayson=require(_0xb895('0x7'));var client=jayson['client'][_0xb895('0x8')]({'port':0x232a});config[_0xb895('0x9')]=_['defaults'](config[_0xb895('0x9')],{'host':_0xb895('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb895('0x9')]));require(_0xb895('0xb'))['register'](socket);function respondWithRpcPromise(_0x42d3,_0x41fad5,_0x24ebbf){return new BPromise(function(_0x24d815,_0x1bad0d){return client[_0xb895('0xc')](_0x42d3,_0x24ebbf)['then'](function(_0x4469a2){logger[_0xb895('0xd')](_0xb895('0xe'),_0x41fad5,_0xb895('0xf'));logger[_0xb895('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x41fad5,_0xb895('0xf'),JSON[_0xb895('0x11')](_0x4469a2));if(_0x4469a2[_0xb895('0x12')]){if(_0x4469a2[_0xb895('0x12')][_0xb895('0x13')]===0x1f4){logger['error'](_0xb895('0xe'),_0x41fad5,_0x4469a2[_0xb895('0x12')][_0xb895('0x14')]);return _0x1bad0d(_0x4469a2['error'][_0xb895('0x14')]);}logger[_0xb895('0x12')]('CmList,\x20%s,\x20%s',_0x41fad5,_0x4469a2[_0xb895('0x12')]['message']);return _0x24d815(_0x4469a2['error'][_0xb895('0x14')]);}else{logger[_0xb895('0xd')]('CmList,\x20%s,\x20%s',_0x41fad5,_0xb895('0xf'));_0x24d815(_0x4469a2['result'][_0xb895('0x14')]);}})['catch'](function(_0x5d24ff){logger[_0xb895('0x12')]('CmList,\x20%s,\x20%s',_0x41fad5,_0x5d24ff);_0x1bad0d(_0x5d24ff);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e52dcd8..1e04b83 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 _0xe460=['update','removeListener','cmList:','./cmList.events','save','remove'];(function(_0x416e0f,_0x292fc1){var _0x3ebfa8=function(_0x1a142b){while(--_0x1a142b){_0x416e0f['push'](_0x416e0f['shift']());}};_0x3ebfa8(++_0x292fc1);}(_0xe460,0xcf));var _0x0e46=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xe460[_0x1a9204];return _0x17ca68;};'use strict';var CmListEvents=require(_0x0e46('0x0'));var events=[_0x0e46('0x1'),_0x0e46('0x2'),_0x0e46('0x3')];function createListener(_0x2cb124,_0x30bdee){return function(_0x45d676){_0x30bdee['emit'](_0x2cb124,_0x45d676);};}function removeListener(_0x3402af,_0x57fb02){return function(){CmListEvents[_0x0e46('0x4')](_0x3402af,_0x57fb02);};}exports['register']=function(_0x2088ac){for(var _0x14f499=0x0,_0x5ec2c1=events['length'];_0x14f499<_0x5ec2c1;_0x14f499++){var _0x8c84c9=events[_0x14f499];var _0x3773bf=createListener(_0x0e46('0x5')+_0x8c84c9,_0x2088ac);CmListEvents['on'](_0x8c84c9,_0x3773bf);}}; \ No newline at end of file +var _0x2bce=['update','emit','register','length','./cmList.events','save'];(function(_0x25b6b3,_0x2d25d7){var _0x2f6101=function(_0x5410f1){while(--_0x5410f1){_0x25b6b3['push'](_0x25b6b3['shift']());}};_0x2f6101(++_0x2d25d7);}(_0x2bce,0xd6));var _0xe2bc=function(_0x434dec,_0x3ecb6d){_0x434dec=_0x434dec-0x0;var _0x451227=_0x2bce[_0x434dec];return _0x451227;};'use strict';var CmListEvents=require(_0xe2bc('0x0'));var events=[_0xe2bc('0x1'),'remove',_0xe2bc('0x2')];function createListener(_0x547754,_0x4dd71d){return function(_0x38db0c){_0x4dd71d[_0xe2bc('0x3')](_0x547754,_0x38db0c);};}function removeListener(_0x5251ca,_0x432a08){return function(){CmListEvents['removeListener'](_0x5251ca,_0x432a08);};}exports[_0xe2bc('0x4')]=function(_0x34ac7a){for(var _0x5436bc=0x0,_0x4d7b51=events[_0xe2bc('0x5')];_0x5436bc<_0x4d7b51;_0x5436bc++){var _0x209051=events[_0x5436bc];var _0x425ebf=createListener('cmList:'+_0x209051,_0x34ac7a);CmListEvents['on'](_0x209051,_0x425ebf);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f1c0ab0..8eb9660 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 _0x617a=['getGlobalCustomFields','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields'];(function(_0x1d1028,_0x506a08){var _0xc40d8a=function(_0x2e4c0c){while(--_0x2e4c0c){_0x1d1028['push'](_0x1d1028['shift']());}};_0xc40d8a(++_0x506a08);}(_0x617a,0x150));var _0xa617=function(_0x59b105,_0x370066){_0x59b105=_0x59b105-0x0;var _0x5b2ac5=_0x617a[_0x59b105];return _0x5b2ac5;};'use strict';var multer=require(_0xa617('0x0'));var util=require(_0xa617('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa617('0x2'));var router=express[_0xa617('0x3')]();var fs_extra=require(_0xa617('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa617('0x5'));var config=require(_0xa617('0x6'));var controller=require(_0xa617('0x7'));router[_0xa617('0x8')]('/',auth[_0xa617('0x9')](),controller[_0xa617('0xa')]);router[_0xa617('0x8')](_0xa617('0xb'),auth[_0xa617('0x9')](),controller[_0xa617('0xc')]);router[_0xa617('0x8')](_0xa617('0xd'),auth[_0xa617('0x9')](),controller[_0xa617('0xe')]);router[_0xa617('0x8')]('/:id',auth[_0xa617('0x9')](),controller['show']);router[_0xa617('0x8')](_0xa617('0xf'),auth[_0xa617('0x9')](),controller['getDispositions']);router[_0xa617('0x8')](_0xa617('0x10'),auth[_0xa617('0x9')](),controller[_0xa617('0x11')]);router[_0xa617('0x8')](_0xa617('0x12'),auth['isAuthenticated'](),controller[_0xa617('0x13')]);router[_0xa617('0x8')](_0xa617('0x14'),auth[_0xa617('0x9')](),controller['getCustomFields']);router['get'](_0xa617('0x15'),auth[_0xa617('0x9')](),controller[_0xa617('0x16')]);router['post']('/',auth[_0xa617('0x9')](),controller[_0xa617('0x17')]);router[_0xa617('0x18')](_0xa617('0xf'),auth[_0xa617('0x9')](),controller['addDisposition']);router['post'](_0xa617('0x10'),auth['isAuthenticated'](),controller['addContacts']);router['post'](_0xa617('0x14'),auth[_0xa617('0x9')](),controller[_0xa617('0x19')]);router[_0xa617('0x18')](_0xa617('0x15'),auth['isAuthenticated'](),controller[_0xa617('0x1a')]);router[_0xa617('0x1b')](_0xa617('0x1c'),auth['isAuthenticated'](),controller[_0xa617('0x1d')]);router[_0xa617('0x1e')](_0xa617('0x1c'),auth[_0xa617('0x9')](),controller[_0xa617('0x1f')]);router[_0xa617('0x1e')](_0xa617('0xf'),auth[_0xa617('0x9')](),controller[_0xa617('0x20')]);router[_0xa617('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0xa617('0x21')]);module[_0xa617('0x22')]=router; \ No newline at end of file +var _0xb95a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','describe','/global_fields','isAuthenticated','getGlobalCustomFields','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','/:id/users','exports','multer','util','path','connect-timeout','express'];(function(_0x55a399,_0x5bb333){var _0x45b3bb=function(_0x566c17){while(--_0x566c17){_0x55a399['push'](_0x55a399['shift']());}};_0x45b3bb(++_0x5bb333);}(_0xb95a,0x13b));var _0xab95=function(_0x2bc3f2,_0x46ddbc){_0x2bc3f2=_0x2bc3f2-0x0;var _0x3d32e4=_0xb95a[_0x2bc3f2];return _0x3d32e4;};'use strict';var multer=require(_0xab95('0x0'));var util=require(_0xab95('0x1'));var path=require(_0xab95('0x2'));var timeout=require(_0xab95('0x3'));var express=require(_0xab95('0x4'));var router=express[_0xab95('0x5')]();var fs_extra=require(_0xab95('0x6'));var auth=require(_0xab95('0x7'));var interaction=require(_0xab95('0x8'));var config=require(_0xab95('0x9'));var controller=require(_0xab95('0xa'));router[_0xab95('0xb')]('/',auth['isAuthenticated'](),controller[_0xab95('0xc')]);router[_0xab95('0xb')](_0xab95('0xd'),auth['isAuthenticated'](),controller[_0xab95('0xe')]);router[_0xab95('0xb')](_0xab95('0xf'),auth[_0xab95('0x10')](),controller[_0xab95('0x11')]);router['get']('/:id',auth[_0xab95('0x10')](),controller[_0xab95('0x12')]);router[_0xab95('0xb')]('/:id/dispositions',auth[_0xab95('0x10')](),controller[_0xab95('0x13')]);router[_0xab95('0xb')](_0xab95('0x14'),auth[_0xab95('0x10')](),controller[_0xab95('0x15')]);router[_0xab95('0xb')](_0xab95('0x16'),auth[_0xab95('0x10')](),controller['getContactsCsv']);router[_0xab95('0xb')](_0xab95('0x17'),auth[_0xab95('0x10')](),controller[_0xab95('0x18')]);router[_0xab95('0xb')]('/:id/users',auth[_0xab95('0x10')](),controller[_0xab95('0x19')]);router[_0xab95('0x1a')]('/',auth[_0xab95('0x10')](),controller['create']);router[_0xab95('0x1a')](_0xab95('0x1b'),auth[_0xab95('0x10')](),controller[_0xab95('0x1c')]);router['post'](_0xab95('0x14'),auth['isAuthenticated'](),controller[_0xab95('0x1d')]);router[_0xab95('0x1a')](_0xab95('0x17'),auth[_0xab95('0x10')](),controller[_0xab95('0x1e')]);router['post']('/:id/users',auth[_0xab95('0x10')](),controller[_0xab95('0x1f')]);router[_0xab95('0x20')](_0xab95('0x21'),auth[_0xab95('0x10')](),controller[_0xab95('0x22')]);router[_0xab95('0x23')]('/:id',auth[_0xab95('0x10')](),controller[_0xab95('0x24')]);router[_0xab95('0x23')]('/:id/dispositions',auth[_0xab95('0x10')](),controller[_0xab95('0x25')]);router[_0xab95('0x23')](_0xab95('0x26'),auth[_0xab95('0x10')](),controller['removeAgents']);module[_0xab95('0x27')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 9fc2f62..1e8628f 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 _0x0c50=['VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x0c50,0x1b7));var _0x00c5=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x0c50[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x00c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x00c5('0x1')],'get':function(_0x1836ba){return this[_0x00c5('0x2')](_0x00c5('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x00c5('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x00c5('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x94df=['field','STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x94df,0x147));var _0xf94d=function(_0x63c784,_0x10a5b5){_0x63c784=_0x63c784-0x0;var _0x228a71=_0x94df[_0x63c784];return _0x228a71;};'use strict';var Sequelize=require(_0xf94d('0x0'));module['exports']={'name':{'type':Sequelize[_0xf94d('0x1')],'get':function(_0x56eaf4){return this[_0xf94d('0x2')](_0xf94d('0x3'));}},'field':{'type':Sequelize[_0xf94d('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xf94d('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xf94d('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 6888544..8c0dcf6 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(_0x5444ca,_0x51f39e){var _0x22cd6f=function(_0x2954fc){while(--_0x2954fc){_0x5444ca['push'](_0x5444ca['shift']());}};_0x22cd6f(++_0x51f39e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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(_0xd88b5e,_0x2cbb2c){var _0x2ddb0a=function(_0x1e63f0){while(--_0x1e63f0){_0xd88b5e['push'](_0xd88b5e['shift']());}};_0x2ddb0a(++_0x2cbb2c);}(_0x7a54,0x106));var _0x47a5=function(_0x5be7fb,_0x26ebef){_0x5be7fb=_0x5be7fb-0x0;var _0x437cd5=_0x7a54[_0x5be7fb];return _0x437cd5;};'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 a5ec0ad..6497076 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 _0x370f=['../../config/logger','api','moment','request-promise','path','./condition.attributes','exports','define','Condition','lodash','util'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x370f,0x1cc));var _0xf370=function(_0x31e9b4,_0x4473f6){_0x31e9b4=_0x31e9b4-0x0;var _0x1ada54=_0x370f[_0x31e9b4];return _0x1ada54;};'use strict';var _=require(_0xf370('0x0'));var util=require(_0xf370('0x1'));var logger=require(_0xf370('0x2'))(_0xf370('0x3'));var moment=require(_0xf370('0x4'));var BPromise=require('bluebird');var rp=require(_0xf370('0x5'));var fs=require('fs');var path=require(_0xf370('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf370('0x7'));module[_0xf370('0x8')]=function(_0x262fc9,_0x2ef86a){return _0x262fc9[_0xf370('0x9')](_0xf370('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d04=['rimraf','../../config/environment','exports','define','Condition','lodash','util','../../config/logger','moment','request-promise'];(function(_0x1cc227,_0x5ef9da){var _0x466710=function(_0x23707a){while(--_0x23707a){_0x1cc227['push'](_0x1cc227['shift']());}};_0x466710(++_0x5ef9da);}(_0x3d04,0x163));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))('api');var moment=require(_0x43d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x43d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43d0('0x5'));var config=require(_0x43d0('0x6'));var attributes=require('./condition.attributes');module[_0x43d0('0x7')]=function(_0x2d68e7,_0x5efb59){return _0x2d68e7[_0x43d0('0x8')](_0x43d0('0x9'),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 66e479c..0eb13dd 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 _0x6515=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6515,0x1ef));var _0x5651=function(_0x54862c,_0x2e203d){_0x54862c=_0x54862c-0x0;var _0xa3c144=_0x6515[_0x54862c];return _0xa3c144;};'use strict';var _=require(_0x5651('0x0'));var util=require(_0x5651('0x1'));var moment=require(_0x5651('0x2'));var BPromise=require(_0x5651('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5651('0x4'));var db=require(_0x5651('0x5'))['db'];var utils=require(_0x5651('0x6'));var logger=require('../../config/logger')(_0x5651('0x7'));var config=require(_0x5651('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5651('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12faf6,_0x34ea1d,_0x4fc557){return new BPromise(function(_0x2068a6,_0x83e2c8){return client[_0x5651('0xa')](_0x12faf6,_0x4fc557)['then'](function(_0x18df45){logger['info'](_0x5651('0xb'),_0x34ea1d,_0x5651('0xc'));logger['debug'](_0x5651('0xd'),_0x34ea1d,_0x5651('0xc'),JSON['stringify'](_0x18df45));if(_0x18df45['error']){if(_0x18df45[_0x5651('0xe')][_0x5651('0xf')]===0x1f4){logger[_0x5651('0xe')]('Condition,\x20%s,\x20%s',_0x34ea1d,_0x18df45['error']['message']);return _0x83e2c8(_0x18df45[_0x5651('0xe')][_0x5651('0x10')]);}logger[_0x5651('0xe')](_0x5651('0xb'),_0x34ea1d,_0x18df45[_0x5651('0xe')][_0x5651('0x10')]);return _0x2068a6(_0x18df45[_0x5651('0xe')][_0x5651('0x10')]);}else{logger[_0x5651('0x11')](_0x5651('0xb'),_0x34ea1d,_0x5651('0xc'));_0x2068a6(_0x18df45['result'][_0x5651('0x10')]);}})[_0x5651('0x12')](function(_0x559e34){logger[_0x5651('0xe')](_0x5651('0xb'),_0x34ea1d,_0x559e34);_0x83e2c8(_0x559e34);});});} \ No newline at end of file +var _0xc75c=['result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0xc75c,0xc0));var _0xcc75=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0xc75c[_0x53f897];return _0x6879f8;};'use strict';var _=require(_0xcc75('0x0'));var util=require(_0xcc75('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc75('0x2'));var fs=require('fs');var Redis=require(_0xcc75('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcc75('0x4'))(_0xcc75('0x5'));var config=require(_0xcc75('0x6'));var jayson=require(_0xcc75('0x7'));var client=jayson[_0xcc75('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x98949d,_0x372689,_0x37d8d6){return new BPromise(function(_0x1c3331,_0x590f85){return client[_0xcc75('0x9')](_0x98949d,_0x37d8d6)['then'](function(_0x4ce6af){logger[_0xcc75('0xa')](_0xcc75('0xb'),_0x372689,_0xcc75('0xc'));logger[_0xcc75('0xd')](_0xcc75('0xe'),_0x372689,_0xcc75('0xc'),JSON['stringify'](_0x4ce6af));if(_0x4ce6af[_0xcc75('0xf')]){if(_0x4ce6af[_0xcc75('0xf')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x372689,_0x4ce6af[_0xcc75('0xf')][_0xcc75('0x10')]);return _0x590f85(_0x4ce6af[_0xcc75('0xf')][_0xcc75('0x10')]);}logger['error']('Condition,\x20%s,\x20%s',_0x372689,_0x4ce6af[_0xcc75('0xf')]['message']);return _0x1c3331(_0x4ce6af[_0xcc75('0xf')][_0xcc75('0x10')]);}else{logger[_0xcc75('0xa')]('Condition,\x20%s,\x20%s',_0x372689,_0xcc75('0xc'));_0x1c3331(_0x4ce6af[_0xcc75('0x11')][_0xcc75('0x10')]);}})[_0xcc75('0x12')](function(_0x3f641a){logger['error'](_0xcc75('0xb'),_0x372689,_0x3f641a);_0x590f85(_0x3f641a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 15b567d..c65a305 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 _0x1887=['../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','update','delete','destroy','multer','util','path','fs-extra'];(function(_0x57d8d7,_0x359516){var _0x177c07=function(_0x35bea2){while(--_0x35bea2){_0x57d8d7['push'](_0x57d8d7['shift']());}};_0x177c07(++_0x359516);}(_0x1887,0x1c4));var _0x7188=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1887[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7188('0x0'));var util=require(_0x7188('0x1'));var path=require(_0x7188('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7188('0x3'));var auth=require(_0x7188('0x4'));var interaction=require(_0x7188('0x5'));var config=require(_0x7188('0x6'));var controller=require('./condition.controller');router[_0x7188('0x7')](_0x7188('0x8'),auth['isAuthenticated'](),controller[_0x7188('0x9')]);router[_0x7188('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7188('0xb')]);module['exports']=router; \ No newline at end of file +var _0xff92=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3dac1f,_0x4f2025){var _0x39bb83=function(_0x2a79e4){while(--_0x2a79e4){_0x3dac1f['push'](_0x3dac1f['shift']());}};_0x39bb83(++_0x4f2025);}(_0xff92,0x148));var _0x2ff9=function(_0x15b0ba,_0x452854){_0x15b0ba=_0x15b0ba-0x0;var _0x34e197=_0xff92[_0x15b0ba];return _0x34e197;};'use strict';var multer=require(_0x2ff9('0x0'));var util=require(_0x2ff9('0x1'));var path=require(_0x2ff9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ff9('0x3')]();var fs_extra=require(_0x2ff9('0x4'));var auth=require(_0x2ff9('0x5'));var interaction=require(_0x2ff9('0x6'));var config=require(_0x2ff9('0x7'));var controller=require(_0x2ff9('0x8'));router[_0x2ff9('0x9')](_0x2ff9('0xa'),auth['isAuthenticated'](),controller[_0x2ff9('0xb')]);router[_0x2ff9('0xc')](_0x2ff9('0xa'),auth['isAuthenticated'](),controller[_0x2ff9('0xd')]);module[_0x2ff9('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 4650f2f..d5a41d8 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 _0xa679=['INTEGER','exports','STRING','name'];(function(_0x48cefe,_0x47d7d0){var _0x232315=function(_0x36ec97){while(--_0x36ec97){_0x48cefe['push'](_0x48cefe['shift']());}};_0x232315(++_0x47d7d0);}(_0xa679,0x7d));var _0x9a67=function(_0x548ed9,_0x38a2d0){_0x548ed9=_0x548ed9-0x0;var _0x16903=_0xa679[_0x548ed9];return _0x16903;};'use strict';var Sequelize=require('sequelize');module[_0x9a67('0x0')]={'name':{'type':Sequelize[_0x9a67('0x1')],'allowNull':![],'unique':_0x9a67('0x2')},'OrderBy':{'type':Sequelize[_0x9a67('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9a67('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xf77a=['name','INTEGER','sequelize','STRING'];(function(_0x9d6c15,_0x5b69c1){var _0x63c87b=function(_0x58e639){while(--_0x58e639){_0x9d6c15['push'](_0x9d6c15['shift']());}};_0x63c87b(++_0x5b69c1);}(_0xf77a,0x9e));var _0xaf77=function(_0x248944,_0x203a2f){_0x248944=_0x248944-0x0;var _0xba513b=_0xf77a[_0x248944];return _0xba513b;};'use strict';var Sequelize=require(_0xaf77('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf77('0x1')],'allowNull':![],'unique':_0xaf77('0x2')},'OrderBy':{'type':Sequelize[_0xaf77('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaf77('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index cfbb7a5..e94e11f 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 _0x5b12=['request-promise','bluebird','mustache','path','ejs','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','undefined','count','offset','Content-Range','apply','reject','update','destroy','get','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','map','query','keys','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','intersection','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x277eb7,_0x493481){var _0x551ae3=function(_0x4bf7bd){while(--_0x4bf7bd){_0x277eb7['push'](_0x277eb7['shift']());}};_0x551ae3(++_0x493481);}(_0x5b12,0xa3));var _0x25b1=function(_0x1258ea,_0xb51cff){_0x1258ea=_0x1258ea-0x0;var _0x20e439=_0x5b12[_0x1258ea];return _0x20e439;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){var _0x3fa043=_0x246acd[_0x25b1('0x24')]({'plain':!![]});var _0xd22469=_0x25b1('0x25');return db[_0x25b1('0x26')][_0x25b1('0x23')]({'where':{'type':_0xd22469,'resourceId':_0x3fa043['id']}})['then'](function(){return _0x246acd;});})[_0x25b1('0x27')](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0x5bc8fc,_0x20a218){return function(_0x9e175f){if(!_0x9e175f){_0x5bc8fc[_0x25b1('0x19')](0x194);}return _0x9e175f;};}function handleError(_0x584357,_0x33baed){_0x33baed=_0x33baed||0x1f4;return function(_0x54ce2d){logger[_0x25b1('0x28')](_0x54ce2d[_0x25b1('0x29')]);if(_0x54ce2d[_0x25b1('0x2a')]){delete _0x54ce2d[_0x25b1('0x2a')];}_0x584357[_0x25b1('0x1a')](_0x33baed)[_0x25b1('0x2b')](_0x54ce2d);};}exports[_0x25b1('0x2c')]=function(_0x4cd825,_0x30d455){var _0xca56f0={},_0x925e99={},_0x26f323={'count':0x0,'rows':[]};var _0x274205=_['map'](db[_0x25b1('0x2d')][_0x25b1('0x2e')],function(_0x42441d){return{'name':_0x42441d[_0x25b1('0x2f')],'type':_0x42441d[_0x25b1('0x30')]['key']};});_0x925e99['model']=_[_0x25b1('0x31')](_0x274205,'name');_0x925e99[_0x25b1('0x32')]=_[_0x25b1('0x33')](_0x4cd825[_0x25b1('0x32')]);_0x925e99['filters']=_['intersection'](_0x925e99[_0x25b1('0x34')],_0x925e99[_0x25b1('0x32')]);_0xca56f0[_0x25b1('0x35')]=_['intersection'](_0x925e99[_0x25b1('0x34')],qs[_0x25b1('0x36')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x36')]));_0xca56f0['attributes']=_0xca56f0[_0x25b1('0x35')][_0x25b1('0x37')]?_0xca56f0[_0x25b1('0x35')]:_0x925e99['model'];if(!_0x4cd825['query'][_0x25b1('0x38')]('nolimit')){_0xca56f0[_0x25b1('0x39')]=qs[_0x25b1('0x39')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x39')]);_0xca56f0[_0x25b1('0x1e')]=qs[_0x25b1('0x1e')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x1e')]);}_0xca56f0[_0x25b1('0x3a')]=qs[_0x25b1('0x3b')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x3b')]);_0xca56f0[_0x25b1('0x3c')]=qs[_0x25b1('0x3d')](_[_0x25b1('0x3e')](_0x4cd825['query'],_0x925e99[_0x25b1('0x3d')]),_0x274205);if(_0x4cd825[_0x25b1('0x32')]['filter']){_0xca56f0[_0x25b1('0x3c')]=_[_0x25b1('0x3f')](_0xca56f0[_0x25b1('0x3c')],{'$or':_[_0x25b1('0x31')](_0x274205,function(_0xb82930){if(_0xb82930['type']!==_0x25b1('0x40')){var _0x5c729d={};_0x5c729d[_0xb82930[_0x25b1('0x2a')]]={'$like':'%'+_0x4cd825['query'][_0x25b1('0x41')]+'%'};return _0x5c729d;}})});}_0xca56f0=_[_0x25b1('0x3f')]({},_0xca56f0,_0x4cd825[_0x25b1('0x42')]);var _0x454eac={'where':_0xca56f0[_0x25b1('0x3c')]};return db[_0x25b1('0x2d')][_0x25b1('0x1d')](_0x454eac)[_0x25b1('0x27')](function(_0x3f9754){_0x26f323['count']=_0x3f9754;if(_0x4cd825[_0x25b1('0x32')]['includeAll']){_0xca56f0[_0x25b1('0x43')]=[{'all':!![]}];}return db[_0x25b1('0x2d')]['findAll'](_0xca56f0);})[_0x25b1('0x27')](function(_0x39b4c7){_0x26f323[_0x25b1('0x44')]=_0x39b4c7;return _0x26f323;})[_0x25b1('0x27')](respondWithFilteredResult(_0x30d455,_0xca56f0))[_0x25b1('0x45')](handleError(_0x30d455,null));};exports[_0x25b1('0x46')]=function(_0x122ce4,_0x30ee65){var _0x33e39c={'raw':!![],'where':{'id':_0x122ce4[_0x25b1('0x47')]['id']}},_0x453352={};_0x453352[_0x25b1('0x34')]=_[_0x25b1('0x33')](db[_0x25b1('0x2d')][_0x25b1('0x2e')]);_0x453352[_0x25b1('0x32')]=_[_0x25b1('0x33')](_0x122ce4[_0x25b1('0x32')]);_0x453352['filters']=_['intersection'](_0x453352['model'],_0x453352[_0x25b1('0x32')]);_0x33e39c['attributes']=_[_0x25b1('0x48')](_0x453352['model'],qs[_0x25b1('0x36')](_0x122ce4[_0x25b1('0x32')][_0x25b1('0x36')]));_0x33e39c[_0x25b1('0x35')]=_0x33e39c[_0x25b1('0x35')][_0x25b1('0x37')]?_0x33e39c['attributes']:_0x453352[_0x25b1('0x34')];if(_0x122ce4[_0x25b1('0x32')][_0x25b1('0x49')]){_0x33e39c[_0x25b1('0x43')]=[{'all':!![]}];}_0x33e39c=_['merge']({},_0x33e39c,_0x122ce4[_0x25b1('0x42')]);return db[_0x25b1('0x2d')][_0x25b1('0x4a')](_0x33e39c)['then'](handleEntityNotFound(_0x30ee65,null))[_0x25b1('0x27')](respondWithResult(_0x30ee65,null))['catch'](handleError(_0x30ee65,null));};exports[_0x25b1('0x4b')]=function(_0x4b6181,_0x543f9b){return db[_0x25b1('0x2d')][_0x25b1('0x4b')](_0x4b6181[_0x25b1('0x4c')],{})[_0x25b1('0x27')](function(_0x5de62e){var _0x2b38ca=_0x4b6181['user'][_0x25b1('0x24')]({'plain':!![]});if(!_0x2b38ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b38ca[_0x25b1('0x4d')]===_0x25b1('0x4e')){var _0x1fcc79=_0x5de62e['get']({'plain':!![]});var _0x1f3b01=_0x25b1('0x25');return db[_0x25b1('0x4f')][_0x25b1('0x4a')]({'where':{'name':_0x1f3b01,'userProfileId':_0x2b38ca[_0x25b1('0x50')]},'raw':!![]})[_0x25b1('0x27')](function(_0x59859e){if(_0x59859e&&_0x59859e[_0x25b1('0x51')]===0x0){return db[_0x25b1('0x26')][_0x25b1('0x4b')]({'name':_0x1fcc79[_0x25b1('0x2a')],'resourceId':_0x1fcc79['id'],'type':_0x59859e[_0x25b1('0x2a')],'sectionId':_0x59859e['id']},{})[_0x25b1('0x27')](function(){return _0x5de62e;});}else{return _0x5de62e;}})[_0x25b1('0x45')](function(_0x40d574){logger[_0x25b1('0x28')](_0x25b1('0x52'),_0x40d574);throw _0x40d574;});}return _0x5de62e;})[_0x25b1('0x27')](respondWithResult(_0x543f9b,0xc9))[_0x25b1('0x45')](handleError(_0x543f9b,null));};exports[_0x25b1('0x22')]=function(_0x2f17b2,_0x3191d7){if(_0x2f17b2[_0x25b1('0x4c')]['id']){delete _0x2f17b2[_0x25b1('0x4c')]['id'];}return db[_0x25b1('0x2d')]['find']({'where':{'id':_0x2f17b2[_0x25b1('0x47')]['id']}})[_0x25b1('0x27')](handleEntityNotFound(_0x3191d7,null))[_0x25b1('0x27')](saveUpdates(_0x2f17b2[_0x25b1('0x4c')],null))[_0x25b1('0x27')](respondWithResult(_0x3191d7,null))[_0x25b1('0x45')](handleError(_0x3191d7,null));};exports['destroy']=function(_0x105587,_0x3af93d){return db[_0x25b1('0x2d')]['find']({'where':{'id':_0x105587[_0x25b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x3af93d,null))['then'](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x105587[_0x25b1('0x47')]['id']}}))['then'](removeEntity(_0x3af93d,null))[_0x25b1('0x45')](handleError(_0x3af93d,null));}; \ No newline at end of file +var _0x5464=['filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','ContactItemTypes','destroy','sendStatus','stack','name','map','ContactItemType','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0xbfb37b,_0x4ed2ee){var _0x49775f=function(_0x5db9a5){while(--_0x5db9a5){_0xbfb37b['push'](_0xbfb37b['shift']());}};_0x49775f(++_0x4ed2ee);}(_0x5464,0x15d));var _0x4546=function(_0x4aaedb,_0x42658e){_0x4aaedb=_0x4aaedb-0x0;var _0x50bffb=_0x5464[_0x4aaedb];return _0x50bffb;};'use strict';var emlformat=require(_0x4546('0x0'));var rimraf=require(_0x4546('0x1'));var zipdir=require(_0x4546('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4546('0x3'));var moment=require('moment');var BPromise=require(_0x4546('0x4'));var Mustache=require('mustache');var util=require(_0x4546('0x5'));var path=require(_0x4546('0x6'));var sox=require(_0x4546('0x7'));var csv=require(_0x4546('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0x8'));var querystring=require(_0x4546('0xd'));var Papa=require(_0x4546('0xe'));var Redis=require(_0x4546('0xf'));var authService=require(_0x4546('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x11'));var hardwareService=require(_0x4546('0x12'));var logger=require(_0x4546('0x13'))('api');var utils=require(_0x4546('0x14'));var config=require(_0x4546('0x15'));var licenseUtil=require(_0x4546('0x16'));var db=require(_0x4546('0x17'))['db'];function respondWithStatusCode(_0x4d31a7,_0x4f2641){_0x4f2641=_0x4f2641||0xcc;return function(_0x3e6622){if(_0x3e6622){return _0x4d31a7['sendStatus'](_0x4f2641);}return _0x4d31a7['status'](_0x4f2641)['end']();};}function respondWithResult(_0x5b64b7,_0x598516){_0x598516=_0x598516||0xc8;return function(_0x4f5571){if(_0x4f5571){return _0x5b64b7[_0x4546('0x18')](_0x598516)['json'](_0x4f5571);}};}function respondWithFilteredResult(_0x363a17,_0x54581c){return function(_0x26fc0e){if(_0x26fc0e){var _0x564f3e=typeof _0x54581c[_0x4546('0x19')]===_0x4546('0x1a')&&typeof _0x54581c[_0x4546('0x1b')]===_0x4546('0x1a');var _0x2a294b=_0x26fc0e[_0x4546('0x1c')];var _0x57d8de=_0x564f3e?0x0:_0x54581c['offset'];var _0x5780a7=_0x564f3e?_0x26fc0e[_0x4546('0x1c')]:_0x54581c[_0x4546('0x19')]+_0x54581c[_0x4546('0x1b')];var _0x3d95c2;if(_0x5780a7>=_0x2a294b){_0x5780a7=_0x2a294b;_0x3d95c2=0xc8;}else{_0x3d95c2=0xce;}_0x363a17[_0x4546('0x18')](_0x3d95c2);return _0x363a17[_0x4546('0x1d')](_0x4546('0x1e'),_0x57d8de+'-'+_0x5780a7+'/'+_0x2a294b)[_0x4546('0x1f')](_0x26fc0e);}return null;};}function patchUpdates(_0x4034a5){return function(_0xceb1d6){try{jsonpatch['apply'](_0xceb1d6,_0x4034a5,!![]);}catch(_0x2d689f){return BPromise[_0x4546('0x20')](_0x2d689f);}return _0xceb1d6['save']();};}function saveUpdates(_0x3067ab,_0x437f55){return function(_0x1a1984){if(_0x1a1984){return _0x1a1984[_0x4546('0x21')](_0x3067ab)[_0x4546('0x22')](function(_0x15b013){return _0x15b013;});}return null;};}function removeEntity(_0x53e402,_0x3dab5c){return function(_0x2cca8b){if(_0x2cca8b){return _0x2cca8b['destroy']()[_0x4546('0x22')](function(){var _0x4618a6=_0x2cca8b[_0x4546('0x23')]({'plain':!![]});var _0x4467ee=_0x4546('0x24');return db['UserProfileResource'][_0x4546('0x25')]({'where':{'type':_0x4467ee,'resourceId':_0x4618a6['id']}})[_0x4546('0x22')](function(){return _0x2cca8b;});})[_0x4546('0x22')](function(){_0x53e402['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43740e,_0x166d6f){return function(_0x15611c){if(!_0x15611c){_0x43740e[_0x4546('0x26')](0x194);}return _0x15611c;};}function handleError(_0x29a3f0,_0x225bc6){_0x225bc6=_0x225bc6||0x1f4;return function(_0xcea7da){logger['error'](_0xcea7da[_0x4546('0x27')]);if(_0xcea7da['name']){delete _0xcea7da[_0x4546('0x28')];}_0x29a3f0[_0x4546('0x18')](_0x225bc6)['send'](_0xcea7da);};}exports['index']=function(_0xf7a95b,_0x5af997){var _0x3c7c7d={},_0x58b69={},_0x480d8e={'count':0x0,'rows':[]};var _0x5f0226=_[_0x4546('0x29')](db[_0x4546('0x2a')][_0x4546('0x2b')],function(_0x5716dc){return{'name':_0x5716dc[_0x4546('0x2c')],'type':_0x5716dc[_0x4546('0x2d')]['key']};});_0x58b69[_0x4546('0x2e')]=_['map'](_0x5f0226,_0x4546('0x28'));_0x58b69[_0x4546('0x2f')]=_[_0x4546('0x30')](_0xf7a95b[_0x4546('0x2f')]);_0x58b69['filters']=_[_0x4546('0x31')](_0x58b69[_0x4546('0x2e')],_0x58b69[_0x4546('0x2f')]);_0x3c7c7d[_0x4546('0x32')]=_[_0x4546('0x31')](_0x58b69[_0x4546('0x2e')],qs['fields'](_0xf7a95b[_0x4546('0x2f')][_0x4546('0x33')]));_0x3c7c7d['attributes']=_0x3c7c7d['attributes'][_0x4546('0x34')]?_0x3c7c7d[_0x4546('0x32')]:_0x58b69['model'];if(!_0xf7a95b[_0x4546('0x2f')][_0x4546('0x35')]('nolimit')){_0x3c7c7d['limit']=qs[_0x4546('0x1b')](_0xf7a95b[_0x4546('0x2f')][_0x4546('0x1b')]);_0x3c7c7d[_0x4546('0x19')]=qs[_0x4546('0x19')](_0xf7a95b[_0x4546('0x2f')]['offset']);}_0x3c7c7d[_0x4546('0x36')]=qs[_0x4546('0x37')](_0xf7a95b['query'][_0x4546('0x37')]);_0x3c7c7d['where']=qs[_0x4546('0x38')](_[_0x4546('0x39')](_0xf7a95b['query'],_0x58b69['filters']),_0x5f0226);if(_0xf7a95b[_0x4546('0x2f')][_0x4546('0x3a')]){_0x3c7c7d[_0x4546('0x3b')]=_['merge'](_0x3c7c7d[_0x4546('0x3b')],{'$or':_[_0x4546('0x29')](_0x5f0226,function(_0x24eb6d){if(_0x24eb6d[_0x4546('0x2d')]!==_0x4546('0x3c')){var _0x320772={};_0x320772[_0x24eb6d[_0x4546('0x28')]]={'$like':'%'+_0xf7a95b[_0x4546('0x2f')]['filter']+'%'};return _0x320772;}})});}_0x3c7c7d=_[_0x4546('0x3d')]({},_0x3c7c7d,_0xf7a95b[_0x4546('0x3e')]);var _0x4a76a2={'where':_0x3c7c7d['where']};return db[_0x4546('0x2a')][_0x4546('0x1c')](_0x4a76a2)[_0x4546('0x22')](function(_0x1ea5c4){_0x480d8e[_0x4546('0x1c')]=_0x1ea5c4;if(_0xf7a95b['query'][_0x4546('0x3f')]){_0x3c7c7d[_0x4546('0x40')]=[{'all':!![]}];}return db[_0x4546('0x2a')][_0x4546('0x41')](_0x3c7c7d);})[_0x4546('0x22')](function(_0x3fabf0){_0x480d8e[_0x4546('0x42')]=_0x3fabf0;return _0x480d8e;})[_0x4546('0x22')](respondWithFilteredResult(_0x5af997,_0x3c7c7d))[_0x4546('0x43')](handleError(_0x5af997,null));};exports['show']=function(_0x270f59,_0x1dd5b0){var _0x3510e0={'raw':!![],'where':{'id':_0x270f59[_0x4546('0x44')]['id']}},_0x35b51e={};_0x35b51e[_0x4546('0x2e')]=_[_0x4546('0x30')](db[_0x4546('0x2a')][_0x4546('0x2b')]);_0x35b51e[_0x4546('0x2f')]=_[_0x4546('0x30')](_0x270f59['query']);_0x35b51e[_0x4546('0x38')]=_[_0x4546('0x31')](_0x35b51e['model'],_0x35b51e[_0x4546('0x2f')]);_0x3510e0[_0x4546('0x32')]=_[_0x4546('0x31')](_0x35b51e['model'],qs[_0x4546('0x33')](_0x270f59[_0x4546('0x2f')][_0x4546('0x33')]));_0x3510e0[_0x4546('0x32')]=_0x3510e0[_0x4546('0x32')][_0x4546('0x34')]?_0x3510e0[_0x4546('0x32')]:_0x35b51e[_0x4546('0x2e')];if(_0x270f59[_0x4546('0x2f')][_0x4546('0x3f')]){_0x3510e0['include']=[{'all':!![]}];}_0x3510e0=_[_0x4546('0x3d')]({},_0x3510e0,_0x270f59[_0x4546('0x3e')]);return db['ContactItemType'][_0x4546('0x45')](_0x3510e0)[_0x4546('0x22')](handleEntityNotFound(_0x1dd5b0,null))[_0x4546('0x22')](respondWithResult(_0x1dd5b0,null))[_0x4546('0x43')](handleError(_0x1dd5b0,null));};exports['create']=function(_0x329566,_0x57bb39){return db[_0x4546('0x2a')][_0x4546('0x46')](_0x329566[_0x4546('0x47')],{})['then'](function(_0x118a36){var _0x3dc9a9=_0x329566[_0x4546('0x48')][_0x4546('0x23')]({'plain':!![]});if(!_0x3dc9a9)throw new Error(_0x4546('0x49'));if(_0x3dc9a9[_0x4546('0x4a')]===_0x4546('0x48')){var _0x325181=_0x118a36[_0x4546('0x23')]({'plain':!![]});var _0x369dc3=_0x4546('0x24');return db['UserProfileSection'][_0x4546('0x45')]({'where':{'name':_0x369dc3,'userProfileId':_0x3dc9a9[_0x4546('0x4b')]},'raw':!![]})['then'](function(_0x50da6e){if(_0x50da6e&&_0x50da6e[_0x4546('0x4c')]===0x0){return db[_0x4546('0x4d')]['create']({'name':_0x325181[_0x4546('0x28')],'resourceId':_0x325181['id'],'type':_0x50da6e[_0x4546('0x28')],'sectionId':_0x50da6e['id']},{})[_0x4546('0x22')](function(){return _0x118a36;});}else{return _0x118a36;}})[_0x4546('0x43')](function(_0x10dfd6){logger[_0x4546('0x4e')](_0x4546('0x4f'),_0x10dfd6);throw _0x10dfd6;});}return _0x118a36;})[_0x4546('0x22')](respondWithResult(_0x57bb39,0xc9))[_0x4546('0x43')](handleError(_0x57bb39,null));};exports[_0x4546('0x21')]=function(_0x14f5a3,_0x198c5d){if(_0x14f5a3[_0x4546('0x47')]['id']){delete _0x14f5a3[_0x4546('0x47')]['id'];}return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x14f5a3['params']['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x198c5d,null))[_0x4546('0x22')](saveUpdates(_0x14f5a3['body'],null))[_0x4546('0x22')](respondWithResult(_0x198c5d,null))[_0x4546('0x43')](handleError(_0x198c5d,null));};exports[_0x4546('0x25')]=function(_0x30e748,_0x5e2094){return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x30e748[_0x4546('0x44')]['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x5e2094,null))[_0x4546('0x22')](db[_0x4546('0x50')][_0x4546('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x30e748[_0x4546('0x44')]['id']}}))[_0x4546('0x22')](removeEntity(_0x5e2094,null))[_0x4546('0x43')](handleError(_0x5e2094,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 55dffd6..7625c73 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 _0x5b9d=['ContactItemType','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define'];(function(_0x353715,_0x31d92a){var _0x3b7670=function(_0x36e10d){while(--_0x36e10d){_0x353715['push'](_0x353715['shift']());}};_0x3b7670(++_0x31d92a);}(_0x5b9d,0x90));var _0xd5b9=function(_0x3cdd7a,_0x266f22){_0x3cdd7a=_0x3cdd7a-0x0;var _0xca7994=_0x5b9d[_0x3cdd7a];return _0xca7994;};'use strict';var _=require(_0xd5b9('0x0'));var util=require(_0xd5b9('0x1'));var logger=require('../../config/logger')(_0xd5b9('0x2'));var moment=require(_0xd5b9('0x3'));var BPromise=require(_0xd5b9('0x4'));var rp=require(_0xd5b9('0x5'));var fs=require('fs');var path=require(_0xd5b9('0x6'));var rimraf=require(_0xd5b9('0x7'));var config=require(_0xd5b9('0x8'));var attributes=require(_0xd5b9('0x9'));module[_0xd5b9('0xa')]=function(_0x5d8874,_0x2b6553){return _0x5d8874[_0xd5b9('0xb')](_0xd5b9('0xc'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9312=['lodash','util','../../config/logger','api','bluebird','request-promise','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types'];(function(_0x351e28,_0x3a12ed){var _0x4a1e4a=function(_0x50c6bb){while(--_0x50c6bb){_0x351e28['push'](_0x351e28['shift']());}};_0x4a1e4a(++_0x3a12ed);}(_0x9312,0x134));var _0x2931=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x9312[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0x2931('0x0'));var util=require(_0x2931('0x1'));var logger=require(_0x2931('0x2'))(_0x2931('0x3'));var moment=require('moment');var BPromise=require(_0x2931('0x4'));var rp=require(_0x2931('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2931('0x6'));module[_0x2931('0x7')]=function(_0x4ec29e,_0x39e3a9){return _0x4ec29e[_0x2931('0x8')](_0x2931('0x9'),attributes,{'tableName':_0x2931('0xa'),'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 a1227b6..d527a30 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 _0x44f3=['stringify','error','message','ContactItemType,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x44f3,0x192));var _0x344f=function(_0x1e5c5d,_0x5d6141){_0x1e5c5d=_0x1e5c5d-0x0;var _0xa468da=_0x44f3[_0x1e5c5d];return _0xa468da;};'use strict';var _=require('lodash');var util=require(_0x344f('0x0'));var moment=require('moment');var BPromise=require(_0x344f('0x1'));var rs=require(_0x344f('0x2'));var fs=require('fs');var Redis=require(_0x344f('0x3'));var db=require(_0x344f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x344f('0x5'))(_0x344f('0x6'));var config=require(_0x344f('0x7'));var jayson=require(_0x344f('0x8'));var client=jayson[_0x344f('0x9')][_0x344f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x105a38,_0x21f164,_0xefb126){return new BPromise(function(_0x2114e6,_0x178c83){return client['request'](_0x105a38,_0xefb126)[_0x344f('0xb')](function(_0x290f90){logger[_0x344f('0xc')]('ContactItemType,\x20%s,\x20%s',_0x21f164,_0x344f('0xd'));logger[_0x344f('0xe')](_0x344f('0xf'),_0x21f164,'request\x20sent',JSON[_0x344f('0x10')](_0x290f90));if(_0x290f90[_0x344f('0x11')]){if(_0x290f90['error']['code']===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x21f164,_0x290f90[_0x344f('0x11')][_0x344f('0x12')]);return _0x178c83(_0x290f90['error'][_0x344f('0x12')]);}logger['error'](_0x344f('0x13'),_0x21f164,_0x290f90[_0x344f('0x11')]['message']);return _0x2114e6(_0x290f90[_0x344f('0x11')]['message']);}else{logger[_0x344f('0xc')](_0x344f('0x13'),_0x21f164,_0x344f('0xd'));_0x2114e6(_0x290f90[_0x344f('0x14')]['message']);}})[_0x344f('0x15')](function(_0x23d94e){logger[_0x344f('0x11')](_0x344f('0x13'),_0x21f164,_0x23d94e);_0x178c83(_0x23d94e);});});} \ No newline at end of file +var _0xff73=['error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xff73,0x1d4));var _0x3ff7=function(_0x3b5964,_0x2f21c4){_0x3b5964=_0x3b5964-0x0;var _0xbc8296=_0xff73[_0x3b5964];return _0xbc8296;};'use strict';var _=require(_0x3ff7('0x0'));var util=require(_0x3ff7('0x1'));var moment=require('moment');var BPromise=require(_0x3ff7('0x2'));var rs=require(_0x3ff7('0x3'));var fs=require('fs');var Redis=require(_0x3ff7('0x4'));var db=require(_0x3ff7('0x5'))['db'];var utils=require(_0x3ff7('0x6'));var logger=require(_0x3ff7('0x7'))('rpc');var config=require(_0x3ff7('0x8'));var jayson=require(_0x3ff7('0x9'));var client=jayson['client'][_0x3ff7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33e27c,_0x30f658,_0x43b040){return new BPromise(function(_0x348eb8,_0x4a0ad1){return client['request'](_0x33e27c,_0x43b040)[_0x3ff7('0xb')](function(_0x147b8c){logger[_0x3ff7('0xc')]('ContactItemType,\x20%s,\x20%s',_0x30f658,_0x3ff7('0xd'));logger[_0x3ff7('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x30f658,'request\x20sent',JSON[_0x3ff7('0xf')](_0x147b8c));if(_0x147b8c['error']){if(_0x147b8c[_0x3ff7('0x10')][_0x3ff7('0x11')]===0x1f4){logger[_0x3ff7('0x10')](_0x3ff7('0x12'),_0x30f658,_0x147b8c[_0x3ff7('0x10')]['message']);return _0x4a0ad1(_0x147b8c[_0x3ff7('0x10')]['message']);}logger['error'](_0x3ff7('0x12'),_0x30f658,_0x147b8c[_0x3ff7('0x10')][_0x3ff7('0x13')]);return _0x348eb8(_0x147b8c[_0x3ff7('0x10')][_0x3ff7('0x13')]);}else{logger[_0x3ff7('0xc')](_0x3ff7('0x12'),_0x30f658,_0x3ff7('0xd'));_0x348eb8(_0x147b8c[_0x3ff7('0x14')][_0x3ff7('0x13')]);}})[_0x3ff7('0x15')](function(_0x4f7f54){logger['error']('ContactItemType,\x20%s,\x20%s',_0x30f658,_0x4f7f54);_0x4a0ad1(_0x4f7f54);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index b23f4dd..9869fba 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 _0x3247=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2920ff,_0x3643f7){var _0x2da6c9=function(_0x2e159b){while(--_0x2e159b){_0x2920ff['push'](_0x2920ff['shift']());}};_0x2da6c9(++_0x3643f7);}(_0x3247,0x1dc));var _0x7324=function(_0x2b6827,_0x58c4e0){_0x2b6827=_0x2b6827-0x0;var _0x346254=_0x3247[_0x2b6827];return _0x346254;};'use strict';var multer=require('multer');var util=require(_0x7324('0x0'));var path=require('path');var timeout=require(_0x7324('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7324('0x2'));var auth=require(_0x7324('0x3'));var interaction=require(_0x7324('0x4'));var config=require(_0x7324('0x5'));var controller=require('./contactItemType.controller');router[_0x7324('0x6')]('/',auth[_0x7324('0x7')](),controller[_0x7324('0x8')]);router[_0x7324('0x6')](_0x7324('0x9'),auth[_0x7324('0x7')](),controller[_0x7324('0xa')]);router[_0x7324('0xb')]('/',auth['isAuthenticated'](),controller[_0x7324('0xc')]);router['put'](_0x7324('0x9'),auth[_0x7324('0x7')](),controller['update']);router[_0x7324('0xd')]('/:id',auth[_0x7324('0x7')](),controller['destroy']);module[_0x7324('0xe')]=router; \ No newline at end of file +var _0xce37=['get','index','/:id','isAuthenticated','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./contactItemType.controller'];(function(_0x22c5c6,_0x155237){var _0x4a0f15=function(_0x288987){while(--_0x288987){_0x22c5c6['push'](_0x22c5c6['shift']());}};_0x4a0f15(++_0x155237);}(_0xce37,0x12a));var _0x7ce3=function(_0x5b9efe,_0x2c3271){_0x5b9efe=_0x5b9efe-0x0;var _0x42e3ef=_0xce37[_0x5b9efe];return _0x42e3ef;};'use strict';var multer=require(_0x7ce3('0x0'));var util=require(_0x7ce3('0x1'));var path=require(_0x7ce3('0x2'));var timeout=require(_0x7ce3('0x3'));var express=require('express');var router=express[_0x7ce3('0x4')]();var fs_extra=require(_0x7ce3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ce3('0x6'));var controller=require(_0x7ce3('0x7'));router[_0x7ce3('0x8')]('/',auth['isAuthenticated'](),controller[_0x7ce3('0x9')]);router['get'](_0x7ce3('0xa'),auth[_0x7ce3('0xb')](),controller['show']);router[_0x7ce3('0xc')]('/',auth[_0x7ce3('0xb')](),controller[_0x7ce3('0xd')]);router['put'](_0x7ce3('0xa'),auth[_0x7ce3('0xb')](),controller['update']);router[_0x7ce3('0xe')](_0x7ce3('0xa'),auth[_0x7ce3('0xb')](),controller[_0x7ce3('0xf')]);module[_0x7ce3('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7600bae..8e2c5f5 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 _0x0713=['STRING','name'];(function(_0x2a4d07,_0x4144a4){var _0x204644=function(_0x28250e){while(--_0x28250e){_0x2a4d07['push'](_0x2a4d07['shift']());}};_0x204644(++_0x4144a4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4ad33f6..48ab09a 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 _0x5006=['Content-Range','apply','reject','save','update','then','destroy','CustomDashboards','sendStatus','error','name','send','Dashboard','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','rawAttributes','length','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','keys','includeAll','omit','createdAt','UserProfileSection','autoAssociation','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','limit','count','set'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x5006,0x153));var _0x6500=function(_0x794c88,_0x257978){_0x794c88=_0x794c88-0x0;var _0x57af33=_0x5006[_0x794c88];return _0x57af33;};'use strict';var emlformat=require(_0x6500('0x0'));var rimraf=require(_0x6500('0x1'));var zipdir=require(_0x6500('0x2'));var jsonpatch=require(_0x6500('0x3'));var rp=require(_0x6500('0x4'));var moment=require(_0x6500('0x5'));var BPromise=require(_0x6500('0x6'));var Mustache=require('mustache');var util=require(_0x6500('0x7'));var path=require(_0x6500('0x8'));var sox=require('sox');var csv=require(_0x6500('0x9'));var ejs=require(_0x6500('0xa'));var fs=require('fs');var fs_extra=require(_0x6500('0xb'));var _=require(_0x6500('0xc'));var squel=require(_0x6500('0xd'));var crypto=require('crypto');var jsforce=require(_0x6500('0xe'));var deskjs=require(_0x6500('0xf'));var toCsv=require(_0x6500('0x9'));var querystring=require(_0x6500('0x10'));var Papa=require(_0x6500('0x11'));var Redis=require(_0x6500('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6500('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6500('0x14'));var logger=require(_0x6500('0x15'))(_0x6500('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6500('0x17')]=_[_0x6500('0x18')](config[_0x6500('0x17')],{'host':_0x6500('0x19'),'port':0x18eb});var socket=require(_0x6500('0x1a'))(new Redis(config[_0x6500('0x17')]));require(_0x6500('0x1b'))[_0x6500('0x1c')](socket);function respondWithStatusCode(_0x596c17,_0x3691dc){_0x3691dc=_0x3691dc||0xcc;return function(_0x5baf1f){if(_0x5baf1f){return _0x596c17['sendStatus'](_0x3691dc);}return _0x596c17[_0x6500('0x1d')](_0x3691dc)[_0x6500('0x1e')]();};}function respondWithResult(_0x50e75e,_0x5c3347){_0x5c3347=_0x5c3347||0xc8;return function(_0x43e5e8){if(_0x43e5e8){return _0x50e75e[_0x6500('0x1d')](_0x5c3347)[_0x6500('0x1f')](_0x43e5e8);}};}function respondWithFilteredResult(_0x29ce73,_0x1ca237){return function(_0x21a794){if(_0x21a794){var _0x5bf8e9=typeof _0x1ca237[_0x6500('0x20')]==='undefined'&&typeof _0x1ca237[_0x6500('0x21')]==='undefined';var _0x170f9e=_0x21a794[_0x6500('0x22')];var _0x1a1aab=_0x5bf8e9?0x0:_0x1ca237[_0x6500('0x20')];var _0x232536=_0x5bf8e9?_0x21a794['count']:_0x1ca237['offset']+_0x1ca237[_0x6500('0x21')];var _0x2bbdde;if(_0x232536>=_0x170f9e){_0x232536=_0x170f9e;_0x2bbdde=0xc8;}else{_0x2bbdde=0xce;}_0x29ce73[_0x6500('0x1d')](_0x2bbdde);return _0x29ce73[_0x6500('0x23')](_0x6500('0x24'),_0x1a1aab+'-'+_0x232536+'/'+_0x170f9e)[_0x6500('0x1f')](_0x21a794);}return null;};}function patchUpdates(_0x316707){return function(_0x2e3d2b){try{jsonpatch[_0x6500('0x25')](_0x2e3d2b,_0x316707,!![]);}catch(_0x240969){return BPromise[_0x6500('0x26')](_0x240969);}return _0x2e3d2b[_0x6500('0x27')]();};}function saveUpdates(_0x25c7cd,_0x572544){return function(_0x4b141e){if(_0x4b141e){return _0x4b141e[_0x6500('0x28')](_0x25c7cd)[_0x6500('0x29')](function(_0x495653){return _0x495653;});}return null;};}function removeEntity(_0x272103,_0x206921){return function(_0xea1fc6){if(_0xea1fc6){return _0xea1fc6[_0x6500('0x2a')]()[_0x6500('0x29')](function(){var _0x22e14c=_0xea1fc6['get']({'plain':!![]});var _0x141e05=_0x6500('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x141e05,'resourceId':_0x22e14c['id']}})[_0x6500('0x29')](function(){return _0xea1fc6;});})[_0x6500('0x29')](function(){_0x272103[_0x6500('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bd45,_0x2f945a){return function(_0x2eee86){if(!_0x2eee86){_0x18bd45[_0x6500('0x2c')](0x194);}return _0x2eee86;};}function handleError(_0x223448,_0x5183df){_0x5183df=_0x5183df||0x1f4;return function(_0x41d330){logger[_0x6500('0x2d')](_0x41d330['stack']);if(_0x41d330[_0x6500('0x2e')]){delete _0x41d330[_0x6500('0x2e')];}_0x223448[_0x6500('0x1d')](_0x5183df)[_0x6500('0x2f')](_0x41d330);};}exports['index']=function(_0x5b1cb2,_0x22153b){var _0x793320={},_0x7e7b88={},_0x13d62f={'count':0x0,'rows':[]};var _0x254b6f=_['map'](db[_0x6500('0x30')]['rawAttributes'],function(_0x4d357e){return{'name':_0x4d357e[_0x6500('0x31')],'type':_0x4d357e[_0x6500('0x32')][_0x6500('0x33')]};});_0x7e7b88[_0x6500('0x34')]=_[_0x6500('0x35')](_0x254b6f,_0x6500('0x2e'));_0x7e7b88[_0x6500('0x36')]=_['keys'](_0x5b1cb2[_0x6500('0x36')]);_0x7e7b88[_0x6500('0x37')]=_['intersection'](_0x7e7b88[_0x6500('0x34')],_0x7e7b88[_0x6500('0x36')]);_0x793320[_0x6500('0x38')]=_[_0x6500('0x39')](_0x7e7b88[_0x6500('0x34')],qs[_0x6500('0x3a')](_0x5b1cb2[_0x6500('0x36')]['fields']));_0x793320[_0x6500('0x38')]=_0x793320[_0x6500('0x38')]['length']?_0x793320[_0x6500('0x38')]:_0x7e7b88[_0x6500('0x34')];if(!_0x5b1cb2['query'][_0x6500('0x3b')](_0x6500('0x3c'))){_0x793320[_0x6500('0x21')]=qs[_0x6500('0x21')](_0x5b1cb2[_0x6500('0x36')][_0x6500('0x21')]);_0x793320[_0x6500('0x20')]=qs[_0x6500('0x20')](_0x5b1cb2[_0x6500('0x36')][_0x6500('0x20')]);}_0x793320[_0x6500('0x3d')]=qs[_0x6500('0x3e')](_0x5b1cb2[_0x6500('0x36')]['sort']);_0x793320[_0x6500('0x3f')]=qs[_0x6500('0x37')](_[_0x6500('0x40')](_0x5b1cb2[_0x6500('0x36')],_0x7e7b88[_0x6500('0x37')]),_0x254b6f);if(_0x5b1cb2[_0x6500('0x36')][_0x6500('0x41')]){_0x793320['where']=_[_0x6500('0x42')](_0x793320['where'],{'$or':_['map'](_0x254b6f,function(_0x245c16){if(_0x245c16['type']!==_0x6500('0x43')){var _0xf0f866={};_0xf0f866[_0x245c16['name']]={'$like':'%'+_0x5b1cb2[_0x6500('0x36')][_0x6500('0x41')]+'%'};return _0xf0f866;}})});}_0x793320=_[_0x6500('0x42')]({},_0x793320,_0x5b1cb2['options']);var _0x18efef={'where':_0x793320[_0x6500('0x3f')]};return db[_0x6500('0x30')][_0x6500('0x22')](_0x18efef)[_0x6500('0x29')](function(_0x214749){_0x13d62f[_0x6500('0x22')]=_0x214749;if(_0x5b1cb2[_0x6500('0x36')]['includeAll']){_0x793320[_0x6500('0x44')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x793320);})[_0x6500('0x29')](function(_0xf548dd){_0x13d62f['rows']=_0xf548dd;return _0x13d62f;})[_0x6500('0x29')](respondWithFilteredResult(_0x22153b,_0x793320))['catch'](handleError(_0x22153b,null));};exports['show']=function(_0x2e5ec5,_0x4c6636){var _0x551cd0={'raw':![],'where':{'id':_0x2e5ec5[_0x6500('0x45')]['id']}},_0x50d5c0={};_0x50d5c0[_0x6500('0x34')]=_['keys'](db['Dashboard'][_0x6500('0x46')]);_0x50d5c0[_0x6500('0x36')]=_['keys'](_0x2e5ec5[_0x6500('0x36')]);_0x50d5c0[_0x6500('0x37')]=_[_0x6500('0x39')](_0x50d5c0['model'],_0x50d5c0[_0x6500('0x36')]);_0x551cd0[_0x6500('0x38')]=_[_0x6500('0x39')](_0x50d5c0['model'],qs[_0x6500('0x3a')](_0x2e5ec5[_0x6500('0x36')]['fields']));_0x551cd0[_0x6500('0x38')]=_0x551cd0['attributes'][_0x6500('0x47')]?_0x551cd0[_0x6500('0x38')]:_0x50d5c0[_0x6500('0x34')];if(_0x2e5ec5[_0x6500('0x36')]['includeAll']){_0x551cd0[_0x6500('0x44')]=[{'all':!![]}];}_0x551cd0=_[_0x6500('0x42')]({},_0x551cd0,_0x2e5ec5[_0x6500('0x48')]);return db[_0x6500('0x30')][_0x6500('0x49')](_0x551cd0)[_0x6500('0x29')](handleEntityNotFound(_0x4c6636,null))[_0x6500('0x29')](respondWithResult(_0x4c6636,null))[_0x6500('0x4a')](handleError(_0x4c6636,null));};exports['create']=function(_0x149717,_0x1791b1){return db[_0x6500('0x30')][_0x6500('0x4b')](_0x149717[_0x6500('0x4c')],{})[_0x6500('0x29')](function(_0x3f9ef2){var _0xb1077=_0x149717['user'][_0x6500('0x4d')]({'plain':!![]});if(!_0xb1077)throw new Error(_0x6500('0x4e'));if(_0xb1077[_0x6500('0x4f')]===_0x6500('0x50')){var _0x4270bf=_0x3f9ef2['get']({'plain':!![]});var _0x56765e=_0x6500('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x56765e,'userProfileId':_0xb1077[_0x6500('0x51')]},'raw':!![]})[_0x6500('0x29')](function(_0x1e99b3){if(_0x1e99b3&&_0x1e99b3['autoAssociation']===0x0){return db[_0x6500('0x52')][_0x6500('0x4b')]({'name':_0x4270bf[_0x6500('0x2e')],'resourceId':_0x4270bf['id'],'type':_0x1e99b3['name'],'sectionId':_0x1e99b3['id']},{})[_0x6500('0x29')](function(){return _0x3f9ef2;});}else{return _0x3f9ef2;}})[_0x6500('0x4a')](function(_0x55acab){logger[_0x6500('0x2d')](_0x6500('0x53'),_0x55acab);throw _0x55acab;});}return _0x3f9ef2;})[_0x6500('0x29')](respondWithResult(_0x1791b1,0xc9))[_0x6500('0x4a')](handleError(_0x1791b1,null));};exports['clone']=function(_0x177405,_0x4ec72a){var _0x253b71={'where':{'id':_0x177405[_0x6500('0x45')]['id']}},_0x351af8={};_0x351af8[_0x6500('0x34')]=_[_0x6500('0x54')](db[_0x6500('0x30')][_0x6500('0x46')]);_0x253b71[_0x6500('0x38')]=_['intersection'](_0x351af8[_0x6500('0x34')],qs[_0x6500('0x3a')](_0x177405[_0x6500('0x36')][_0x6500('0x3a')]));_0x253b71[_0x6500('0x38')]=_0x253b71['attributes'][_0x6500('0x47')]?_0x253b71['attributes']:_0x351af8['model'];if(_0x177405['query'][_0x6500('0x55')]){_0x253b71[_0x6500('0x44')]=[{'all':!![]}];}_0x253b71=_[_0x6500('0x42')]({},_0x253b71,_0x177405[_0x6500('0x48')]);return db[_0x6500('0x30')][_0x6500('0x49')](_0x253b71)[_0x6500('0x29')](handleEntityNotFound(_0x4ec72a,null))[_0x6500('0x29')](function(_0x179428){if(_0x179428){var _0x49d44d=_0x179428[_0x6500('0x4d')]({'plain':!![]});_0x49d44d=qs[_0x6500('0x56')](_0x49d44d,['id',_0x6500('0x57'),'updatedAt']);_0x177405[_0x6500('0x4c')]=_[_0x6500('0x56')](_0x177405[_0x6500('0x4c')],['id',_0x6500('0x57'),'updatedAt']);return db['Dashboard'][_0x6500('0x4b')](_['merge'](_0x49d44d,_0x177405[_0x6500('0x4c')]),{'include':_0x177405[_0x6500('0x36')][_0x6500('0x55')]?[{'all':!![]}]:undefined})[_0x6500('0x29')](function(_0x54bcfc){var _0x122a36=_0x177405[_0x6500('0x50')][_0x6500('0x4d')]({'plain':!![]});if(!_0x122a36)throw new Error(_0x6500('0x4e'));if(_0x122a36['role']===_0x6500('0x50')){var _0x3d7a68=_0x54bcfc['get']({'plain':!![]});var _0x15d958=_0x6500('0x2b');return db[_0x6500('0x58')][_0x6500('0x49')]({'where':{'name':_0x15d958,'userProfileId':_0x122a36[_0x6500('0x51')]},'raw':!![]})['then'](function(_0x511a18){if(_0x511a18&&_0x511a18[_0x6500('0x59')]===0x0){return db[_0x6500('0x52')]['create']({'name':_0x3d7a68[_0x6500('0x2e')],'resourceId':_0x3d7a68['id'],'type':_0x511a18[_0x6500('0x2e')],'sectionId':_0x511a18['id']},{})[_0x6500('0x29')](function(){return _0x54bcfc;});}else{return _0x54bcfc;}})[_0x6500('0x4a')](function(_0x17bd46){logger[_0x6500('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17bd46);throw _0x17bd46;});}return _0x54bcfc;});}})[_0x6500('0x29')](respondWithResult(_0x4ec72a,0xc9))[_0x6500('0x4a')](handleError(_0x4ec72a,null));};exports[_0x6500('0x28')]=function(_0x3cf0c1,_0x4bd785){if(_0x3cf0c1[_0x6500('0x4c')]['id']){delete _0x3cf0c1[_0x6500('0x4c')]['id'];}return db[_0x6500('0x30')]['find']({'where':{'id':_0x3cf0c1['params']['id']}})['then'](handleEntityNotFound(_0x4bd785,null))[_0x6500('0x29')](saveUpdates(_0x3cf0c1[_0x6500('0x4c')],null))[_0x6500('0x29')](respondWithResult(_0x4bd785,null))[_0x6500('0x4a')](handleError(_0x4bd785,null));};exports[_0x6500('0x2a')]=function(_0x1488cb,_0x54f8e9){return db[_0x6500('0x30')]['find']({'where':{'id':_0x1488cb['params']['id']}})[_0x6500('0x29')](handleEntityNotFound(_0x54f8e9,null))[_0x6500('0x29')](removeEntity(_0x54f8e9,null))[_0x6500('0x4a')](handleError(_0x54f8e9,null));};function widgetAttributes(_0x5bfab4){try{switch(_0x5bfab4[_0x6500('0x32')]){case'iframe':return[{'name':'attrUrl','value':_0x5bfab4['attrUrl']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x0]?_0x5bfab4[_0x6500('0x5a')][0x0][_0x6500('0x5b')]:undefined)||_0x6500('0x5c')}];case _0x6500('0x5d'):return[{'name':_0x6500('0x5e'),'value':_0x5bfab4['attrPath']||(_0x5bfab4['attrs']&&_0x5bfab4[_0x6500('0x5a')][0x0]?_0x5bfab4[_0x6500('0x5a')][0x0][_0x6500('0x5b')]:undefined)||''}];case'clock':return[{'name':_0x6500('0x5f'),'value':_0x5bfab4[_0x6500('0x5f')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x0]?_0x5bfab4['attrs'][0x0][_0x6500('0x5b')]:undefined)||_0x6500('0x60')},{'name':'attrTimezone','value':_0x5bfab4[_0x6500('0x61')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x1]?_0x5bfab4[_0x6500('0x5a')][0x1]['value']:undefined)||_0x6500('0x62')},{'name':_0x6500('0x63'),'value':_0x5bfab4[_0x6500('0x63')]||(_0x5bfab4['attrs']&&_0x5bfab4[_0x6500('0x5a')][0x2]?_0x5bfab4['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x6500('0x64'),'value':_0x5bfab4[_0x6500('0x64')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x0]?_0x5bfab4['attrs'][0x0][_0x6500('0x5b')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5bfab4[_0x6500('0x65')]||(_0x5bfab4['attrs']&&_0x5bfab4[_0x6500('0x5a')][0x1]?_0x5bfab4[_0x6500('0x5a')][0x1][_0x6500('0x5b')]:undefined)||[]},{'name':'attrFontSize','value':_0x5bfab4[_0x6500('0x63')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x2]?_0x5bfab4[_0x6500('0x5a')][0x2][_0x6500('0x5b')]:undefined)||0x14},{'name':_0x6500('0x66'),'value':_0x5bfab4['attrChannel']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4['attrs'][0x3]?_0x5bfab4[_0x6500('0x5a')][0x3][_0x6500('0x5b')]:undefined)||_0x6500('0x67')},{'name':_0x6500('0x68'),'value':_0x5bfab4['attrEmailAccounts']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4['attrs'][0x4]?_0x5bfab4[_0x6500('0x5a')][0x4][_0x6500('0x5b')]:undefined)||''},{'name':_0x6500('0x69'),'value':_0x5bfab4[_0x6500('0x69')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x5]?_0x5bfab4[_0x6500('0x5a')][0x5][_0x6500('0x5b')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5bfab4[_0x6500('0x6a')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x6]?_0x5bfab4[_0x6500('0x5a')][0x6][_0x6500('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5bfab4['attrOpenchannelAccounts']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4['attrs'][0x7]?_0x5bfab4[_0x6500('0x5a')][0x7][_0x6500('0x5b')]:undefined)||''},{'name':_0x6500('0x6b'),'value':_0x5bfab4['attrWhatsappAccounts']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x8]?_0x5bfab4[_0x6500('0x5a')][0x8]['value']:undefined)||''},{'name':_0x6500('0x6c'),'value':_0x5bfab4[_0x6500('0x6c')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x9]?_0x5bfab4['attrs'][0x9][_0x6500('0x5b')]:undefined)||''}];case _0x6500('0x6d'):case _0x6500('0x6e'):return[{'name':_0x6500('0x6f'),'value':_0x5bfab4[_0x6500('0x6f')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x0]?_0x5bfab4['attrs'][0x0][_0x6500('0x5b')]:undefined)||'total'},{'name':'attrSerie2','value':_0x5bfab4['attrSerie2']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x1]?_0x5bfab4[_0x6500('0x5a')][0x1][_0x6500('0x5b')]:undefined)||null},{'name':_0x6500('0x70'),'value':_0x5bfab4[_0x6500('0x70')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4['attrs'][0x2]?_0x5bfab4[_0x6500('0x5a')][0x2][_0x6500('0x5b')]:undefined)||null},{'name':_0x6500('0x65'),'value':_0x5bfab4[_0x6500('0x65')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x3]?_0x5bfab4[_0x6500('0x5a')][0x3][_0x6500('0x5b')]:undefined)||[]},{'name':'attrChannel','value':_0x5bfab4['attrChannel']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x4]?_0x5bfab4['attrs'][0x4][_0x6500('0x5b')]:undefined)||_0x6500('0x67')},{'name':_0x6500('0x68'),'value':_0x5bfab4['attrEmailAccounts']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x5]?_0x5bfab4[_0x6500('0x5a')][0x5][_0x6500('0x5b')]:undefined)||''},{'name':_0x6500('0x69'),'value':_0x5bfab4['attrFaxAccounts']||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x6]?_0x5bfab4[_0x6500('0x5a')][0x6][_0x6500('0x5b')]:undefined)||''},{'name':_0x6500('0x6a'),'value':_0x5bfab4[_0x6500('0x6a')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4['attrs'][0x7]?_0x5bfab4[_0x6500('0x5a')][0x7][_0x6500('0x5b')]:undefined)||''},{'name':_0x6500('0x71'),'value':_0x5bfab4[_0x6500('0x71')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x8]?_0x5bfab4[_0x6500('0x5a')][0x8][_0x6500('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5bfab4[_0x6500('0x6b')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x9]?_0x5bfab4[_0x6500('0x5a')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x5bfab4[_0x6500('0x6c')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0xa]?_0x5bfab4[_0x6500('0x5a')][0xa][_0x6500('0x5b')]:undefined)||''}];case _0x6500('0x72'):return[{'name':'attrReport','type':_0x5bfab4[_0x6500('0x73')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x0]?_0x5bfab4[_0x6500('0x5a')][0x0][_0x6500('0x32')]:undefined)||null,'value':_0x5bfab4[_0x6500('0x74')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x0]?_0x5bfab4[_0x6500('0x5a')][0x0][_0x6500('0x5b')]:undefined)||null},{'name':_0x6500('0x75'),'value':_0x5bfab4[_0x6500('0x75')]||(_0x5bfab4[_0x6500('0x5a')]&&_0x5bfab4[_0x6500('0x5a')][0x1]?_0x5bfab4[_0x6500('0x5a')][0x1][_0x6500('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x460f25){logger[_0x6500('0x2d')](_0x6500('0x76'),JSON[_0x6500('0x77')](_0x460f25));return[];}}exports[_0x6500('0x78')]=function(_0x49b91a,_0x57136e,_0xd4f18a){if(_0x49b91a[_0x6500('0x4c')]['id']){delete _0x49b91a['body']['id'];}return db[_0x6500('0x30')][_0x6500('0x49')]({'where':{'id':_0x49b91a['params']['id']}})[_0x6500('0x29')](handleEntityNotFound(_0x57136e,null))[_0x6500('0x29')](function(_0x2acd54){if(_0x2acd54){_0x49b91a[_0x6500('0x4c')][_0x6500('0x79')]=_0x2acd54['id'];_0x49b91a[_0x6500('0x4c')][_0x6500('0x5a')]=widgetAttributes(_0x49b91a[_0x6500('0x4c')]);return db[_0x6500('0x7a')]['create'](_0x49b91a[_0x6500('0x4c')]);}})[_0x6500('0x29')](respondWithResult(_0x57136e,null))['catch'](handleError(_0x57136e,null));};exports[_0x6500('0x7b')]=function(_0x5d2935,_0xad51cb,_0xa6ef3c){var _0x469c05={};var _0x536d97={};var _0x5c568d;var _0xd05111;return db[_0x6500('0x30')][_0x6500('0x7c')]({'where':{'id':_0x5d2935[_0x6500('0x45')]['id']}})[_0x6500('0x29')](handleEntityNotFound(_0xad51cb,null))[_0x6500('0x29')](function(_0x3fbbf2){if(_0x3fbbf2){_0x5c568d=_0x3fbbf2;_0x536d97[_0x6500('0x34')]=_[_0x6500('0x54')](db[_0x6500('0x7a')]['rawAttributes']);_0x536d97[_0x6500('0x36')]=_['keys'](_0x5d2935[_0x6500('0x36')]);_0x536d97[_0x6500('0x37')]=_[_0x6500('0x39')](_0x536d97['model'],_0x536d97[_0x6500('0x36')]);_0x469c05[_0x6500('0x38')]=_[_0x6500('0x39')](_0x536d97[_0x6500('0x34')],qs[_0x6500('0x3a')](_0x5d2935[_0x6500('0x36')][_0x6500('0x3a')]));_0x469c05[_0x6500('0x38')]=_0x469c05[_0x6500('0x38')][_0x6500('0x47')]?_0x469c05[_0x6500('0x38')]:_0x536d97['model'];_0x469c05['order']=qs[_0x6500('0x3e')](_0x5d2935[_0x6500('0x36')][_0x6500('0x3e')]);_0x469c05[_0x6500('0x3f')]=qs[_0x6500('0x37')](_['pick'](_0x5d2935['query'],_0x536d97['filters']));if(_0x5d2935[_0x6500('0x36')][_0x6500('0x41')]){_0x469c05[_0x6500('0x3f')]=_[_0x6500('0x42')](_0x469c05[_0x6500('0x3f')],{'$or':_[_0x6500('0x35')](_0x469c05[_0x6500('0x38')],function(_0x54f1eb){var _0x2df375={};_0x2df375[_0x54f1eb]={'$like':'%'+_0x5d2935[_0x6500('0x36')][_0x6500('0x41')]+'%'};return _0x2df375;})});}_0x469c05=_['merge']({},_0x469c05,_0x5d2935['options']);return _0x5c568d['getItems'](_0x469c05);}})[_0x6500('0x29')](function(_0x5b0066){if(_0x5b0066){_0xd05111=_0x5b0066[_0x6500('0x47')];if(!_0x5d2935[_0x6500('0x36')][_0x6500('0x3b')]('nolimit')){_0x469c05['limit']=qs[_0x6500('0x21')](_0x5d2935[_0x6500('0x36')]['limit']);_0x469c05['offset']=qs[_0x6500('0x20')](_0x5d2935['query'][_0x6500('0x20')]);}return _0x5c568d['getItems'](_0x469c05);}})[_0x6500('0x29')](function(_0x3e0056){if(_0x3e0056){return _0x3e0056?{'count':_0xd05111,'rows':_0x3e0056}:null;}})['then'](respondWithResult(_0xad51cb,null))[_0x6500('0x4a')](handleError(_0xad51cb,null));}; \ No newline at end of file +var _0xeb65=['send','index','map','Dashboard','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','createdAt','omit','updatedAt','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','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','defaults','redis','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name'];(function(_0x590717,_0x3561a2){var _0x3b4c89=function(_0x41ed13){while(--_0x41ed13){_0x590717['push'](_0x590717['shift']());}};_0x3b4c89(++_0x3561a2);}(_0xeb65,0x162));var _0x5eb6=function(_0x1ca3ad,_0x481509){_0x1ca3ad=_0x1ca3ad-0x0;var _0x9e76f4=_0xeb65[_0x1ca3ad];return _0x9e76f4;};'use strict';var emlformat=require(_0x5eb6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eb6('0x1'));var jsonpatch=require(_0x5eb6('0x2'));var rp=require(_0x5eb6('0x3'));var moment=require(_0x5eb6('0x4'));var BPromise=require(_0x5eb6('0x5'));var Mustache=require(_0x5eb6('0x6'));var util=require('util');var path=require(_0x5eb6('0x7'));var sox=require(_0x5eb6('0x8'));var csv=require(_0x5eb6('0x9'));var ejs=require(_0x5eb6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5eb6('0xb'));var squel=require('squel');var crypto=require(_0x5eb6('0xc'));var jsforce=require(_0x5eb6('0xd'));var deskjs=require(_0x5eb6('0xe'));var toCsv=require(_0x5eb6('0x9'));var querystring=require(_0x5eb6('0xf'));var Papa=require(_0x5eb6('0x10'));var Redis=require(_0x5eb6('0x11'));var authService=require(_0x5eb6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5eb6('0x13'));var hardwareService=require(_0x5eb6('0x14'));var logger=require(_0x5eb6('0x15'))(_0x5eb6('0x16'));var utils=require(_0x5eb6('0x17'));var config=require(_0x5eb6('0x18'));var licenseUtil=require(_0x5eb6('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5eb6('0x1a')](config[_0x5eb6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5eb6('0x1b')]));require(_0x5eb6('0x1c'))[_0x5eb6('0x1d')](socket);function respondWithStatusCode(_0xae497f,_0x535149){_0x535149=_0x535149||0xcc;return function(_0x19631e){if(_0x19631e){return _0xae497f[_0x5eb6('0x1e')](_0x535149);}return _0xae497f[_0x5eb6('0x1f')](_0x535149)[_0x5eb6('0x20')]();};}function respondWithResult(_0x213654,_0x32f6ae){_0x32f6ae=_0x32f6ae||0xc8;return function(_0x3c5580){if(_0x3c5580){return _0x213654[_0x5eb6('0x1f')](_0x32f6ae)['json'](_0x3c5580);}};}function respondWithFilteredResult(_0x569c9f,_0x36faa5){return function(_0x11ecac){if(_0x11ecac){var _0x2e21ad=typeof _0x36faa5[_0x5eb6('0x21')]===_0x5eb6('0x22')&&typeof _0x36faa5[_0x5eb6('0x23')]===_0x5eb6('0x22');var _0x348b45=_0x11ecac['count'];var _0x5b9cb3=_0x2e21ad?0x0:_0x36faa5[_0x5eb6('0x21')];var _0x4f42c7=_0x2e21ad?_0x11ecac[_0x5eb6('0x24')]:_0x36faa5[_0x5eb6('0x21')]+_0x36faa5[_0x5eb6('0x23')];var _0x5ef6e0;if(_0x4f42c7>=_0x348b45){_0x4f42c7=_0x348b45;_0x5ef6e0=0xc8;}else{_0x5ef6e0=0xce;}_0x569c9f[_0x5eb6('0x1f')](_0x5ef6e0);return _0x569c9f[_0x5eb6('0x25')](_0x5eb6('0x26'),_0x5b9cb3+'-'+_0x4f42c7+'/'+_0x348b45)['json'](_0x11ecac);}return null;};}function patchUpdates(_0x1096c3){return function(_0x298cdd){try{jsonpatch[_0x5eb6('0x27')](_0x298cdd,_0x1096c3,!![]);}catch(_0x2b920e){return BPromise[_0x5eb6('0x28')](_0x2b920e);}return _0x298cdd[_0x5eb6('0x29')]();};}function saveUpdates(_0x29dec3,_0x3fa4a9){return function(_0x2ea5cd){if(_0x2ea5cd){return _0x2ea5cd[_0x5eb6('0x2a')](_0x29dec3)['then'](function(_0xe95fab){return _0xe95fab;});}return null;};}function removeEntity(_0x4fe67c,_0x3154ff){return function(_0x55b007){if(_0x55b007){return _0x55b007['destroy']()[_0x5eb6('0x2b')](function(){var _0x46cc4a=_0x55b007[_0x5eb6('0x2c')]({'plain':!![]});var _0x1d8f15=_0x5eb6('0x2d');return db[_0x5eb6('0x2e')][_0x5eb6('0x2f')]({'where':{'type':_0x1d8f15,'resourceId':_0x46cc4a['id']}})[_0x5eb6('0x2b')](function(){return _0x55b007;});})[_0x5eb6('0x2b')](function(){_0x4fe67c[_0x5eb6('0x1f')](0xcc)[_0x5eb6('0x20')]();});}};}function handleEntityNotFound(_0x554cbc,_0x1a2b2e){return function(_0x21fd1c){if(!_0x21fd1c){_0x554cbc['sendStatus'](0x194);}return _0x21fd1c;};}function handleError(_0x35e326,_0xdb083b){_0xdb083b=_0xdb083b||0x1f4;return function(_0x230097){logger[_0x5eb6('0x30')](_0x230097[_0x5eb6('0x31')]);if(_0x230097[_0x5eb6('0x32')]){delete _0x230097['name'];}_0x35e326['status'](_0xdb083b)[_0x5eb6('0x33')](_0x230097);};}exports[_0x5eb6('0x34')]=function(_0x3c4272,_0x585dd8){var _0x5a3e0d={},_0x46e55c={},_0x584d42={'count':0x0,'rows':[]};var _0x7c6979=_[_0x5eb6('0x35')](db[_0x5eb6('0x36')][_0x5eb6('0x37')],function(_0xf5c77e){return{'name':_0xf5c77e['fieldName'],'type':_0xf5c77e['type'][_0x5eb6('0x38')]};});_0x46e55c[_0x5eb6('0x39')]=_[_0x5eb6('0x35')](_0x7c6979,_0x5eb6('0x32'));_0x46e55c[_0x5eb6('0x3a')]=_[_0x5eb6('0x3b')](_0x3c4272[_0x5eb6('0x3a')]);_0x46e55c[_0x5eb6('0x3c')]=_[_0x5eb6('0x3d')](_0x46e55c[_0x5eb6('0x39')],_0x46e55c[_0x5eb6('0x3a')]);_0x5a3e0d[_0x5eb6('0x3e')]=_[_0x5eb6('0x3d')](_0x46e55c[_0x5eb6('0x39')],qs['fields'](_0x3c4272[_0x5eb6('0x3a')][_0x5eb6('0x3f')]));_0x5a3e0d['attributes']=_0x5a3e0d[_0x5eb6('0x3e')][_0x5eb6('0x40')]?_0x5a3e0d[_0x5eb6('0x3e')]:_0x46e55c['model'];if(!_0x3c4272[_0x5eb6('0x3a')][_0x5eb6('0x41')](_0x5eb6('0x42'))){_0x5a3e0d[_0x5eb6('0x23')]=qs['limit'](_0x3c4272['query'][_0x5eb6('0x23')]);_0x5a3e0d['offset']=qs['offset'](_0x3c4272[_0x5eb6('0x3a')][_0x5eb6('0x21')]);}_0x5a3e0d[_0x5eb6('0x43')]=qs['sort'](_0x3c4272[_0x5eb6('0x3a')][_0x5eb6('0x44')]);_0x5a3e0d[_0x5eb6('0x45')]=qs['filters'](_[_0x5eb6('0x46')](_0x3c4272[_0x5eb6('0x3a')],_0x46e55c[_0x5eb6('0x3c')]),_0x7c6979);if(_0x3c4272[_0x5eb6('0x3a')][_0x5eb6('0x47')]){_0x5a3e0d['where']=_[_0x5eb6('0x48')](_0x5a3e0d[_0x5eb6('0x45')],{'$or':_['map'](_0x7c6979,function(_0x1ea440){if(_0x1ea440['type']!==_0x5eb6('0x49')){var _0x303ac3={};_0x303ac3[_0x1ea440[_0x5eb6('0x32')]]={'$like':'%'+_0x3c4272[_0x5eb6('0x3a')][_0x5eb6('0x47')]+'%'};return _0x303ac3;}})});}_0x5a3e0d=_['merge']({},_0x5a3e0d,_0x3c4272[_0x5eb6('0x4a')]);var _0x3cda01={'where':_0x5a3e0d[_0x5eb6('0x45')]};return db[_0x5eb6('0x36')]['count'](_0x3cda01)[_0x5eb6('0x2b')](function(_0x106fa8){_0x584d42[_0x5eb6('0x24')]=_0x106fa8;if(_0x3c4272[_0x5eb6('0x3a')][_0x5eb6('0x4b')]){_0x5a3e0d[_0x5eb6('0x4c')]=[{'all':!![]}];}return db[_0x5eb6('0x36')][_0x5eb6('0x4d')](_0x5a3e0d);})['then'](function(_0x32ede5){_0x584d42[_0x5eb6('0x4e')]=_0x32ede5;return _0x584d42;})['then'](respondWithFilteredResult(_0x585dd8,_0x5a3e0d))[_0x5eb6('0x4f')](handleError(_0x585dd8,null));};exports[_0x5eb6('0x50')]=function(_0x2497c8,_0x37e862){var _0x1fb5c3={'raw':![],'where':{'id':_0x2497c8[_0x5eb6('0x51')]['id']}},_0x6ff68e={};_0x6ff68e[_0x5eb6('0x39')]=_[_0x5eb6('0x3b')](db[_0x5eb6('0x36')]['rawAttributes']);_0x6ff68e[_0x5eb6('0x3a')]=_[_0x5eb6('0x3b')](_0x2497c8[_0x5eb6('0x3a')]);_0x6ff68e[_0x5eb6('0x3c')]=_[_0x5eb6('0x3d')](_0x6ff68e[_0x5eb6('0x39')],_0x6ff68e['query']);_0x1fb5c3[_0x5eb6('0x3e')]=_[_0x5eb6('0x3d')](_0x6ff68e['model'],qs[_0x5eb6('0x3f')](_0x2497c8[_0x5eb6('0x3a')][_0x5eb6('0x3f')]));_0x1fb5c3[_0x5eb6('0x3e')]=_0x1fb5c3[_0x5eb6('0x3e')]['length']?_0x1fb5c3[_0x5eb6('0x3e')]:_0x6ff68e[_0x5eb6('0x39')];if(_0x2497c8['query'][_0x5eb6('0x4b')]){_0x1fb5c3[_0x5eb6('0x4c')]=[{'all':!![]}];}_0x1fb5c3=_['merge']({},_0x1fb5c3,_0x2497c8[_0x5eb6('0x4a')]);return db[_0x5eb6('0x36')]['find'](_0x1fb5c3)[_0x5eb6('0x2b')](handleEntityNotFound(_0x37e862,null))[_0x5eb6('0x2b')](respondWithResult(_0x37e862,null))[_0x5eb6('0x4f')](handleError(_0x37e862,null));};exports[_0x5eb6('0x52')]=function(_0x3ab194,_0x6613f1){return db[_0x5eb6('0x36')][_0x5eb6('0x52')](_0x3ab194[_0x5eb6('0x53')],{})[_0x5eb6('0x2b')](function(_0x98aa64){var _0x3600b1=_0x3ab194[_0x5eb6('0x54')]['get']({'plain':!![]});if(!_0x3600b1)throw new Error(_0x5eb6('0x55'));if(_0x3600b1[_0x5eb6('0x56')]===_0x5eb6('0x54')){var _0x5214de=_0x98aa64[_0x5eb6('0x2c')]({'plain':!![]});var _0x1b35b3=_0x5eb6('0x2d');return db[_0x5eb6('0x57')]['find']({'where':{'name':_0x1b35b3,'userProfileId':_0x3600b1[_0x5eb6('0x58')]},'raw':!![]})[_0x5eb6('0x2b')](function(_0x1da092){if(_0x1da092&&_0x1da092[_0x5eb6('0x59')]===0x0){return db['UserProfileResource'][_0x5eb6('0x52')]({'name':_0x5214de[_0x5eb6('0x32')],'resourceId':_0x5214de['id'],'type':_0x1da092[_0x5eb6('0x32')],'sectionId':_0x1da092['id']},{})[_0x5eb6('0x2b')](function(){return _0x98aa64;});}else{return _0x98aa64;}})['catch'](function(_0x58b109){logger['error'](_0x5eb6('0x5a'),_0x58b109);throw _0x58b109;});}return _0x98aa64;})[_0x5eb6('0x2b')](respondWithResult(_0x6613f1,0xc9))[_0x5eb6('0x4f')](handleError(_0x6613f1,null));};exports[_0x5eb6('0x5b')]=function(_0x4e9989,_0x1ab052){var _0x194b9b={'where':{'id':_0x4e9989[_0x5eb6('0x51')]['id']}},_0x572a92={};_0x572a92[_0x5eb6('0x39')]=_['keys'](db[_0x5eb6('0x36')][_0x5eb6('0x37')]);_0x194b9b[_0x5eb6('0x3e')]=_[_0x5eb6('0x3d')](_0x572a92[_0x5eb6('0x39')],qs[_0x5eb6('0x3f')](_0x4e9989[_0x5eb6('0x3a')][_0x5eb6('0x3f')]));_0x194b9b['attributes']=_0x194b9b['attributes'][_0x5eb6('0x40')]?_0x194b9b['attributes']:_0x572a92['model'];if(_0x4e9989[_0x5eb6('0x3a')][_0x5eb6('0x4b')]){_0x194b9b[_0x5eb6('0x4c')]=[{'all':!![]}];}_0x194b9b=_['merge']({},_0x194b9b,_0x4e9989['options']);return db[_0x5eb6('0x36')][_0x5eb6('0x5c')](_0x194b9b)[_0x5eb6('0x2b')](handleEntityNotFound(_0x1ab052,null))[_0x5eb6('0x2b')](function(_0x36e924){if(_0x36e924){var _0x1b37e0=_0x36e924[_0x5eb6('0x2c')]({'plain':!![]});_0x1b37e0=qs['omit'](_0x1b37e0,['id',_0x5eb6('0x5d'),'updatedAt']);_0x4e9989[_0x5eb6('0x53')]=_[_0x5eb6('0x5e')](_0x4e9989[_0x5eb6('0x53')],['id',_0x5eb6('0x5d'),_0x5eb6('0x5f')]);return db[_0x5eb6('0x36')]['create'](_[_0x5eb6('0x48')](_0x1b37e0,_0x4e9989[_0x5eb6('0x53')]),{'include':_0x4e9989[_0x5eb6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x5eb6('0x2b')](function(_0x1f317d){var _0x256255=_0x4e9989['user'][_0x5eb6('0x2c')]({'plain':!![]});if(!_0x256255)throw new Error(_0x5eb6('0x55'));if(_0x256255['role']===_0x5eb6('0x54')){var _0x3b0539=_0x1f317d[_0x5eb6('0x2c')]({'plain':!![]});var _0x4adadf='CustomDashboards';return db[_0x5eb6('0x57')][_0x5eb6('0x5c')]({'where':{'name':_0x4adadf,'userProfileId':_0x256255[_0x5eb6('0x58')]},'raw':!![]})[_0x5eb6('0x2b')](function(_0x2437d3){if(_0x2437d3&&_0x2437d3[_0x5eb6('0x59')]===0x0){return db['UserProfileResource'][_0x5eb6('0x52')]({'name':_0x3b0539['name'],'resourceId':_0x3b0539['id'],'type':_0x2437d3[_0x5eb6('0x32')],'sectionId':_0x2437d3['id']},{})[_0x5eb6('0x2b')](function(){return _0x1f317d;});}else{return _0x1f317d;}})[_0x5eb6('0x4f')](function(_0x55416e){logger[_0x5eb6('0x30')](_0x5eb6('0x5a'),_0x55416e);throw _0x55416e;});}return _0x1f317d;});}})[_0x5eb6('0x2b')](respondWithResult(_0x1ab052,0xc9))[_0x5eb6('0x4f')](handleError(_0x1ab052,null));};exports[_0x5eb6('0x2a')]=function(_0x53f8a6,_0x1cd49f){if(_0x53f8a6['body']['id']){delete _0x53f8a6[_0x5eb6('0x53')]['id'];}return db['Dashboard'][_0x5eb6('0x5c')]({'where':{'id':_0x53f8a6[_0x5eb6('0x51')]['id']}})[_0x5eb6('0x2b')](handleEntityNotFound(_0x1cd49f,null))[_0x5eb6('0x2b')](saveUpdates(_0x53f8a6[_0x5eb6('0x53')],null))[_0x5eb6('0x2b')](respondWithResult(_0x1cd49f,null))[_0x5eb6('0x4f')](handleError(_0x1cd49f,null));};exports['destroy']=function(_0x3c1226,_0x36da99){return db[_0x5eb6('0x36')][_0x5eb6('0x5c')]({'where':{'id':_0x3c1226[_0x5eb6('0x51')]['id']}})[_0x5eb6('0x2b')](handleEntityNotFound(_0x36da99,null))[_0x5eb6('0x2b')](removeEntity(_0x36da99,null))[_0x5eb6('0x4f')](handleError(_0x36da99,null));};function widgetAttributes(_0x14e312){try{switch(_0x14e312[_0x5eb6('0x60')]){case _0x5eb6('0x61'):return[{'name':_0x5eb6('0x62'),'value':_0x14e312[_0x5eb6('0x62')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312['attrs'][0x0]?_0x14e312[_0x5eb6('0x63')][0x0][_0x5eb6('0x64')]:undefined)||_0x5eb6('0x65')}];case _0x5eb6('0x66'):return[{'name':_0x5eb6('0x67'),'value':_0x14e312[_0x5eb6('0x67')]||(_0x14e312['attrs']&&_0x14e312[_0x5eb6('0x63')][0x0]?_0x14e312[_0x5eb6('0x63')][0x0][_0x5eb6('0x64')]:undefined)||''}];case _0x5eb6('0x68'):return[{'name':_0x5eb6('0x69'),'value':_0x14e312[_0x5eb6('0x69')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x0]?_0x14e312[_0x5eb6('0x63')][0x0][_0x5eb6('0x64')]:undefined)||_0x5eb6('0x6a')},{'name':'attrTimezone','value':_0x14e312['attrTimezone']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312['attrs'][0x1]?_0x14e312[_0x5eb6('0x63')][0x1]['value']:undefined)||_0x5eb6('0x6b')},{'name':_0x5eb6('0x6c'),'value':_0x14e312[_0x5eb6('0x6c')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x2]?_0x14e312[_0x5eb6('0x63')][0x2][_0x5eb6('0x64')]:undefined)||0xc}];case _0x5eb6('0x6d'):return[{'name':_0x5eb6('0x6e'),'value':_0x14e312[_0x5eb6('0x6e')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x0]?_0x14e312[_0x5eb6('0x63')][0x0][_0x5eb6('0x64')]:undefined)||'total'},{'name':_0x5eb6('0x6f'),'value':_0x14e312[_0x5eb6('0x6f')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312['attrs'][0x1]?_0x14e312[_0x5eb6('0x63')][0x1][_0x5eb6('0x64')]:undefined)||[]},{'name':_0x5eb6('0x6c'),'value':_0x14e312[_0x5eb6('0x6c')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312['attrs'][0x2]?_0x14e312['attrs'][0x2][_0x5eb6('0x64')]:undefined)||0x14},{'name':_0x5eb6('0x70'),'value':_0x14e312[_0x5eb6('0x70')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x3]?_0x14e312[_0x5eb6('0x63')][0x3][_0x5eb6('0x64')]:undefined)||'voice'},{'name':_0x5eb6('0x71'),'value':_0x14e312[_0x5eb6('0x71')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x4]?_0x14e312['attrs'][0x4][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x72'),'value':_0x14e312[_0x5eb6('0x72')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x5]?_0x14e312[_0x5eb6('0x63')][0x5][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x73'),'value':_0x14e312['attrSmsAccounts']||(_0x14e312['attrs']&&_0x14e312[_0x5eb6('0x63')][0x6]?_0x14e312[_0x5eb6('0x63')][0x6]['value']:undefined)||''},{'name':_0x5eb6('0x74'),'value':_0x14e312[_0x5eb6('0x74')]||(_0x14e312['attrs']&&_0x14e312[_0x5eb6('0x63')][0x7]?_0x14e312[_0x5eb6('0x63')][0x7][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x75'),'value':_0x14e312['attrWhatsappAccounts']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x8]?_0x14e312['attrs'][0x8][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x76'),'value':_0x14e312[_0x5eb6('0x76')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x9]?_0x14e312[_0x5eb6('0x63')][0x9]['value']:undefined)||''}];case _0x5eb6('0x77'):case _0x5eb6('0x78'):return[{'name':_0x5eb6('0x79'),'value':_0x14e312['attrSerie1']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312['attrs'][0x0]?_0x14e312[_0x5eb6('0x63')][0x0][_0x5eb6('0x64')]:undefined)||_0x5eb6('0x7a')},{'name':_0x5eb6('0x7b'),'value':_0x14e312[_0x5eb6('0x7b')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x1]?_0x14e312['attrs'][0x1][_0x5eb6('0x64')]:undefined)||null},{'name':'attrSerie3','value':_0x14e312[_0x5eb6('0x7c')]||(_0x14e312['attrs']&&_0x14e312[_0x5eb6('0x63')][0x2]?_0x14e312[_0x5eb6('0x63')][0x2][_0x5eb6('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x14e312[_0x5eb6('0x6f')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x3]?_0x14e312[_0x5eb6('0x63')][0x3][_0x5eb6('0x64')]:undefined)||[]},{'name':'attrChannel','value':_0x14e312['attrChannel']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x4]?_0x14e312[_0x5eb6('0x63')][0x4][_0x5eb6('0x64')]:undefined)||_0x5eb6('0x7d')},{'name':_0x5eb6('0x71'),'value':_0x14e312[_0x5eb6('0x71')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x5]?_0x14e312[_0x5eb6('0x63')][0x5]['value']:undefined)||''},{'name':_0x5eb6('0x72'),'value':_0x14e312[_0x5eb6('0x72')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312['attrs'][0x6]?_0x14e312[_0x5eb6('0x63')][0x6][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x73'),'value':_0x14e312['attrSmsAccounts']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312['attrs'][0x7]?_0x14e312[_0x5eb6('0x63')][0x7][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x74'),'value':_0x14e312['attrOpenchannelAccounts']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x8]?_0x14e312[_0x5eb6('0x63')][0x8][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x75'),'value':_0x14e312['attrWhatsappAccounts']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x9]?_0x14e312[_0x5eb6('0x63')][0x9][_0x5eb6('0x64')]:undefined)||''},{'name':_0x5eb6('0x76'),'value':_0x14e312[_0x5eb6('0x76')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0xa]?_0x14e312[_0x5eb6('0x63')][0xa][_0x5eb6('0x64')]:undefined)||''}];case'web-report':return[{'name':_0x5eb6('0x7e'),'type':_0x14e312[_0x5eb6('0x7f')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x0]?_0x14e312[_0x5eb6('0x63')][0x0][_0x5eb6('0x60')]:undefined)||null,'value':_0x14e312['attrReport']||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x0]?_0x14e312['attrs'][0x0]['value']:undefined)||null},{'name':_0x5eb6('0x80'),'value':_0x14e312[_0x5eb6('0x80')]||(_0x14e312[_0x5eb6('0x63')]&&_0x14e312[_0x5eb6('0x63')][0x1]?_0x14e312[_0x5eb6('0x63')][0x1][_0x5eb6('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x239a1f){logger[_0x5eb6('0x30')](_0x5eb6('0x81'),JSON[_0x5eb6('0x82')](_0x239a1f));return[];}}exports[_0x5eb6('0x83')]=function(_0x1c59c8,_0x4eea3c,_0xe0b9a6){if(_0x1c59c8[_0x5eb6('0x53')]['id']){delete _0x1c59c8[_0x5eb6('0x53')]['id'];}return db[_0x5eb6('0x36')][_0x5eb6('0x5c')]({'where':{'id':_0x1c59c8['params']['id']}})[_0x5eb6('0x2b')](handleEntityNotFound(_0x4eea3c,null))['then'](function(_0x304894){if(_0x304894){_0x1c59c8[_0x5eb6('0x53')][_0x5eb6('0x84')]=_0x304894['id'];_0x1c59c8[_0x5eb6('0x53')][_0x5eb6('0x63')]=widgetAttributes(_0x1c59c8[_0x5eb6('0x53')]);return db[_0x5eb6('0x85')][_0x5eb6('0x52')](_0x1c59c8[_0x5eb6('0x53')]);}})[_0x5eb6('0x2b')](respondWithResult(_0x4eea3c,null))[_0x5eb6('0x4f')](handleError(_0x4eea3c,null));};exports[_0x5eb6('0x86')]=function(_0x569fb5,_0x2e068d,_0x184e47){var _0x5b399a={};var _0xb7d564={};var _0x4edc77;var _0x312862;return db[_0x5eb6('0x36')]['findOne']({'where':{'id':_0x569fb5['params']['id']}})[_0x5eb6('0x2b')](handleEntityNotFound(_0x2e068d,null))[_0x5eb6('0x2b')](function(_0x42fe89){if(_0x42fe89){_0x4edc77=_0x42fe89;_0xb7d564[_0x5eb6('0x39')]=_['keys'](db[_0x5eb6('0x85')][_0x5eb6('0x37')]);_0xb7d564[_0x5eb6('0x3a')]=_['keys'](_0x569fb5['query']);_0xb7d564[_0x5eb6('0x3c')]=_[_0x5eb6('0x3d')](_0xb7d564[_0x5eb6('0x39')],_0xb7d564[_0x5eb6('0x3a')]);_0x5b399a[_0x5eb6('0x3e')]=_[_0x5eb6('0x3d')](_0xb7d564[_0x5eb6('0x39')],qs['fields'](_0x569fb5[_0x5eb6('0x3a')][_0x5eb6('0x3f')]));_0x5b399a['attributes']=_0x5b399a['attributes']['length']?_0x5b399a[_0x5eb6('0x3e')]:_0xb7d564[_0x5eb6('0x39')];_0x5b399a[_0x5eb6('0x43')]=qs[_0x5eb6('0x44')](_0x569fb5['query']['sort']);_0x5b399a['where']=qs[_0x5eb6('0x3c')](_['pick'](_0x569fb5[_0x5eb6('0x3a')],_0xb7d564[_0x5eb6('0x3c')]));if(_0x569fb5[_0x5eb6('0x3a')]['filter']){_0x5b399a[_0x5eb6('0x45')]=_['merge'](_0x5b399a['where'],{'$or':_[_0x5eb6('0x35')](_0x5b399a[_0x5eb6('0x3e')],function(_0x2ebf91){var _0x372fdd={};_0x372fdd[_0x2ebf91]={'$like':'%'+_0x569fb5[_0x5eb6('0x3a')][_0x5eb6('0x47')]+'%'};return _0x372fdd;})});}_0x5b399a=_[_0x5eb6('0x48')]({},_0x5b399a,_0x569fb5[_0x5eb6('0x4a')]);return _0x4edc77[_0x5eb6('0x86')](_0x5b399a);}})[_0x5eb6('0x2b')](function(_0x1063bd){if(_0x1063bd){_0x312862=_0x1063bd[_0x5eb6('0x40')];if(!_0x569fb5[_0x5eb6('0x3a')][_0x5eb6('0x41')](_0x5eb6('0x42'))){_0x5b399a[_0x5eb6('0x23')]=qs[_0x5eb6('0x23')](_0x569fb5[_0x5eb6('0x3a')][_0x5eb6('0x23')]);_0x5b399a[_0x5eb6('0x21')]=qs['offset'](_0x569fb5[_0x5eb6('0x3a')][_0x5eb6('0x21')]);}return _0x4edc77[_0x5eb6('0x86')](_0x5b399a);}})[_0x5eb6('0x2b')](function(_0x1d8fc5){if(_0x1d8fc5){return _0x1d8fc5?{'count':_0x312862,'rows':_0x1d8fc5}:null;}})[_0x5eb6('0x2b')](respondWithResult(_0x2e068d,null))[_0x5eb6('0x4f')](handleError(_0x2e068d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a76b68e..b9f341d 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 _0x0eeb=['../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x523615,_0x522ee8){var _0x9863eb=function(_0x2008e2){while(--_0x2008e2){_0x523615['push'](_0x523615['shift']());}};_0x9863eb(++_0x522ee8);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0eeb[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xb0ee('0x0'));var Dashboard=require(_0xb0ee('0x1'))['db'][_0xb0ee('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb0ee('0x3')](0x0);var events={'afterCreate':_0xb0ee('0x4'),'afterUpdate':_0xb0ee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5add55){return function(_0x3b94a0,_0xfbf0cc,_0x13a7ce){DashboardEvents[_0xb0ee('0x6')](_0x5add55+':'+_0x3b94a0['id'],_0x3b94a0);DashboardEvents[_0xb0ee('0x6')](_0x5add55,_0x3b94a0);_0x13a7ce(null);};}for(var e in events){if(events[_0xb0ee('0x7')](e)){var event=events[e];Dashboard[_0xb0ee('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x55f9=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x32fd66,_0x719a02){var _0x100865=function(_0x11d232){while(--_0x11d232){_0x32fd66['push'](_0x32fd66['shift']());}};_0x100865(++_0x719a02);}(_0x55f9,0x1b8));var _0x955f=function(_0x3fce41,_0x57184d){_0x3fce41=_0x3fce41-0x0;var _0x9054c7=_0x55f9[_0x3fce41];return _0x9054c7;};'use strict';var EventEmitter=require(_0x955f('0x0'));var Dashboard=require(_0x955f('0x1'))['db'][_0x955f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x955f('0x3')](0x0);var events={'afterCreate':_0x955f('0x4'),'afterUpdate':_0x955f('0x5'),'afterDestroy':_0x955f('0x6')};function emitEvent(_0xd067ea){return function(_0x181c9a,_0x160d7a,_0x23fa4c){DashboardEvents['emit'](_0xd067ea+':'+_0x181c9a['id'],_0x181c9a);DashboardEvents[_0x955f('0x7')](_0xd067ea,_0x181c9a);_0x23fa4c(null);};}for(var e in events){if(events[_0x955f('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x955f('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 4b77a77..83c0d7a 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 _0xe148=['path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','util','../../config/logger','api','moment'];(function(_0x400064,_0x4e98d2){var _0x4c9ee8=function(_0x57ced0){while(--_0x57ced0){_0x400064['push'](_0x400064['shift']());}};_0x4c9ee8(++_0x4e98d2);}(_0xe148,0x6a));var _0x8e14=function(_0x5c08cb,_0x456960){_0x5c08cb=_0x5c08cb-0x0;var _0x147907=_0xe148[_0x5c08cb];return _0x147907;};'use strict';var _=require('lodash');var util=require(_0x8e14('0x0'));var logger=require(_0x8e14('0x1'))(_0x8e14('0x2'));var moment=require(_0x8e14('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e14('0x4'));var rimraf=require(_0x8e14('0x5'));var config=require(_0x8e14('0x6'));var attributes=require(_0x8e14('0x7'));module[_0x8e14('0x8')]=function(_0x48f03a,_0x202be7){return _0x48f03a['define'](_0x8e14('0x9'),attributes,{'tableName':_0x8e14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7898=['exports','define','Dashboard','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./dashboard.attributes'];(function(_0x2f173c,_0x4429b0){var _0x4ba5f3=function(_0x222fe0){while(--_0x222fe0){_0x2f173c['push'](_0x2f173c['shift']());}};_0x4ba5f3(++_0x4429b0);}(_0x7898,0x160));var _0x8789=function(_0x3afd09,_0x52634e){_0x3afd09=_0x3afd09-0x0;var _0x451138=_0x7898[_0x3afd09];return _0x451138;};'use strict';var _=require(_0x8789('0x0'));var util=require('util');var logger=require(_0x8789('0x1'))(_0x8789('0x2'));var moment=require(_0x8789('0x3'));var BPromise=require(_0x8789('0x4'));var rp=require(_0x8789('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8789('0x6'));var attributes=require(_0x8789('0x7'));module[_0x8789('0x8')]=function(_0x413ae5,_0x5379d7){return _0x413ae5[_0x8789('0x9')](_0x8789('0xa'),attributes,{'tableName':_0x8789('0xb'),'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 ae8b9d9..8e4affa 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 _0x7c0a=['Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9f958f,_0x420fbc){var _0xe5ea62=function(_0x4cb555){while(--_0x4cb555){_0x9f958f['push'](_0x9f958f['shift']());}};_0xe5ea62(++_0x420fbc);}(_0x7c0a,0x146));var _0xa7c0=function(_0x2d57b6,_0x4fc7e7){_0x2d57b6=_0x2d57b6-0x0;var _0x2dd0cb=_0x7c0a[_0x2d57b6];return _0x2dd0cb;};'use strict';var _=require(_0xa7c0('0x0'));var util=require(_0xa7c0('0x1'));var moment=require(_0xa7c0('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7c0('0x3'));var fs=require('fs');var Redis=require(_0xa7c0('0x4'));var db=require(_0xa7c0('0x5'))['db'];var utils=require(_0xa7c0('0x6'));var logger=require(_0xa7c0('0x7'))('rpc');var config=require(_0xa7c0('0x8'));var jayson=require(_0xa7c0('0x9'));var client=jayson[_0xa7c0('0xa')]['http']({'port':0x232a});config[_0xa7c0('0xb')]=_[_0xa7c0('0xc')](config[_0xa7c0('0xb')],{'host':_0xa7c0('0xd'),'port':0x18eb});var socket=require(_0xa7c0('0xe'))(new Redis(config['redis']));require('./dashboard.socket')[_0xa7c0('0xf')](socket);function respondWithRpcPromise(_0x5cd4eb,_0x575f81,_0x562407){return new BPromise(function(_0x81ca92,_0xf095b4){return client[_0xa7c0('0x10')](_0x5cd4eb,_0x562407)[_0xa7c0('0x11')](function(_0x34e995){logger[_0xa7c0('0x12')](_0xa7c0('0x13'),_0x575f81,_0xa7c0('0x14'));logger[_0xa7c0('0x15')](_0xa7c0('0x16'),_0x575f81,_0xa7c0('0x14'),JSON[_0xa7c0('0x17')](_0x34e995));if(_0x34e995[_0xa7c0('0x18')]){if(_0x34e995[_0xa7c0('0x18')][_0xa7c0('0x19')]===0x1f4){logger[_0xa7c0('0x18')]('Dashboard,\x20%s,\x20%s',_0x575f81,_0x34e995[_0xa7c0('0x18')][_0xa7c0('0x1a')]);return _0xf095b4(_0x34e995[_0xa7c0('0x18')][_0xa7c0('0x1a')]);}logger[_0xa7c0('0x18')]('Dashboard,\x20%s,\x20%s',_0x575f81,_0x34e995[_0xa7c0('0x18')]['message']);return _0x81ca92(_0x34e995[_0xa7c0('0x18')][_0xa7c0('0x1a')]);}else{logger[_0xa7c0('0x12')](_0xa7c0('0x13'),_0x575f81,_0xa7c0('0x14'));_0x81ca92(_0x34e995[_0xa7c0('0x1b')][_0xa7c0('0x1a')]);}})[_0xa7c0('0x1c')](function(_0x1ac620){logger['error'](_0xa7c0('0x13'),_0x575f81,_0x1ac620);_0xf095b4(_0x1ac620);});});} \ No newline at end of file +var _0x3296=['util','moment','../../mysqldb','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4c09fa,_0xcfcdaf){var _0x43487a=function(_0x3f5aa4){while(--_0x3f5aa4){_0x4c09fa['push'](_0x4c09fa['shift']());}};_0x43487a(++_0xcfcdaf);}(_0x3296,0xa7));var _0x6329=function(_0x41770c,_0x35621a){_0x41770c=_0x41770c-0x0;var _0x42f205=_0x3296[_0x41770c];return _0x42f205;};'use strict';var _=require(_0x6329('0x0'));var util=require(_0x6329('0x1'));var moment=require(_0x6329('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6329('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6329('0x4'));var client=jayson[_0x6329('0x5')]['http']({'port':0x232a});config[_0x6329('0x6')]=_[_0x6329('0x7')](config[_0x6329('0x6')],{'host':_0x6329('0x8'),'port':0x18eb});var socket=require(_0x6329('0x9'))(new Redis(config['redis']));require(_0x6329('0xa'))['register'](socket);function respondWithRpcPromise(_0x5a7d7c,_0x10ba3b,_0x48a632){return new BPromise(function(_0x951157,_0x350b7f){return client[_0x6329('0xb')](_0x5a7d7c,_0x48a632)[_0x6329('0xc')](function(_0x2174a8){logger[_0x6329('0xd')](_0x6329('0xe'),_0x10ba3b,_0x6329('0xf'));logger[_0x6329('0x10')](_0x6329('0x11'),_0x10ba3b,_0x6329('0xf'),JSON[_0x6329('0x12')](_0x2174a8));if(_0x2174a8[_0x6329('0x13')]){if(_0x2174a8[_0x6329('0x13')][_0x6329('0x14')]===0x1f4){logger[_0x6329('0x13')]('Dashboard,\x20%s,\x20%s',_0x10ba3b,_0x2174a8[_0x6329('0x13')][_0x6329('0x15')]);return _0x350b7f(_0x2174a8[_0x6329('0x13')]['message']);}logger[_0x6329('0x13')](_0x6329('0xe'),_0x10ba3b,_0x2174a8[_0x6329('0x13')][_0x6329('0x15')]);return _0x951157(_0x2174a8[_0x6329('0x13')][_0x6329('0x15')]);}else{logger[_0x6329('0xd')](_0x6329('0xe'),_0x10ba3b,_0x6329('0xf'));_0x951157(_0x2174a8[_0x6329('0x16')][_0x6329('0x15')]);}})[_0x6329('0x17')](function(_0x1a103b){logger['error'](_0x6329('0xe'),_0x10ba3b,_0x1a103b);_0x350b7f(_0x1a103b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b16349a..2ea844f 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 _0x00b4=['register','length','dashboard:','save','remove','update','removeListener'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x00b4,0x161));var _0x400b=function(_0x5030a4,_0x897564){_0x5030a4=_0x5030a4-0x0;var _0x34594e=_0x00b4[_0x5030a4];return _0x34594e;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x400b('0x0'),_0x400b('0x1'),_0x400b('0x2')];function createListener(_0x5aee81,_0x182f04){return function(_0x3e6aff){_0x182f04['emit'](_0x5aee81,_0x3e6aff);};}function removeListener(_0x142248,_0xce6e23){return function(){DashboardEvents[_0x400b('0x3')](_0x142248,_0xce6e23);};}exports[_0x400b('0x4')]=function(_0x480f12){for(var _0x5b2700=0x0,_0x2a5309=events[_0x400b('0x5')];_0x5b2700<_0x2a5309;_0x5b2700++){var _0x31d373=events[_0x5b2700];var _0x2ed2ea=createListener(_0x400b('0x6')+_0x31d373,_0x480f12);DashboardEvents['on'](_0x31d373,_0x2ed2ea);}}; \ No newline at end of file +var _0x37b5=['length','dashboard:','save','remove','update','emit','register'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x37b5,0x9c));var _0x537b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x37b5[_0x20a584];return _0x4b41a8;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x537b('0x0'),_0x537b('0x1'),_0x537b('0x2')];function createListener(_0x7774ee,_0x5343b5){return function(_0x1c85fa){_0x5343b5[_0x537b('0x3')](_0x7774ee,_0x1c85fa);};}function removeListener(_0x22597b,_0x232f77){return function(){DashboardEvents['removeListener'](_0x22597b,_0x232f77);};}exports[_0x537b('0x4')]=function(_0x37d88e){for(var _0x482e86=0x0,_0x41a0cd=events[_0x537b('0x5')];_0x482e86<_0x41a0cd;_0x482e86++){var _0x950477=events[_0x482e86];var _0x580668=createListener(_0x537b('0x6')+_0x950477,_0x37d88e);DashboardEvents['on'](_0x950477,_0x580668);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2b59c5c..9a37696 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 _0xdd4e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','show','/:id/items','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2b9306,_0x33107c){var _0x1ff79e=function(_0x4d4654){while(--_0x4d4654){_0x2b9306['push'](_0x2b9306['shift']());}};_0x1ff79e(++_0x33107c);}(_0xdd4e,0x85));var _0xedd4=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xdd4e[_0x2e3dfc];return _0x4b1245;};'use strict';var multer=require(_0xedd4('0x0'));var util=require('util');var path=require(_0xedd4('0x1'));var timeout=require(_0xedd4('0x2'));var express=require(_0xedd4('0x3'));var router=express[_0xedd4('0x4')]();var fs_extra=require(_0xedd4('0x5'));var auth=require(_0xedd4('0x6'));var interaction=require(_0xedd4('0x7'));var config=require(_0xedd4('0x8'));var controller=require(_0xedd4('0x9'));router[_0xedd4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xedd4('0xa')](_0xedd4('0xb'),auth[_0xedd4('0xc')](),controller[_0xedd4('0xd')]);router[_0xedd4('0xa')](_0xedd4('0xe'),auth[_0xedd4('0xc')](),controller['getItems']);router[_0xedd4('0xf')]('/',auth[_0xedd4('0xc')](),controller['create']);router['post'](_0xedd4('0x10'),auth[_0xedd4('0xc')](),controller[_0xedd4('0x11')]);router['post'](_0xedd4('0xe'),auth[_0xedd4('0xc')](),controller['addItem']);router[_0xedd4('0x12')](_0xedd4('0xb'),auth[_0xedd4('0xc')](),controller[_0xedd4('0x13')]);router[_0xedd4('0x14')](_0xedd4('0xb'),auth[_0xedd4('0xc')](),controller[_0xedd4('0x15')]);module[_0xedd4('0x16')]=router; \ No newline at end of file +var _0x8783=['Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','/:id/clone','addItem','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8783,0x96));var _0x3878=function(_0x23dc05,_0x47463e){_0x23dc05=_0x23dc05-0x0;var _0x1a7042=_0x8783[_0x23dc05];return _0x1a7042;};'use strict';var multer=require(_0x3878('0x0'));var util=require('util');var path=require(_0x3878('0x1'));var timeout=require(_0x3878('0x2'));var express=require(_0x3878('0x3'));var router=express[_0x3878('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3878('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3878('0x6'));var controller=require(_0x3878('0x7'));router[_0x3878('0x8')]('/',auth[_0x3878('0x9')](),controller[_0x3878('0xa')]);router[_0x3878('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3878('0xb')]);router['get'](_0x3878('0xc'),auth[_0x3878('0x9')](),controller[_0x3878('0xd')]);router[_0x3878('0xe')]('/',auth[_0x3878('0x9')](),controller['create']);router[_0x3878('0xe')](_0x3878('0xf'),auth[_0x3878('0x9')](),controller['clone']);router[_0x3878('0xe')](_0x3878('0xc'),auth['isAuthenticated'](),controller[_0x3878('0x10')]);router[_0x3878('0x11')](_0x3878('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x3878('0x13')](_0x3878('0x12'),auth['isAuthenticated'](),controller[_0x3878('0x14')]);module[_0x3878('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index adf181b..a6d971f 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 _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0x1261,0x144));var _0x1126=function(_0x3c7ae2,_0x5504e3){_0x3c7ae2=_0x3c7ae2-0x0;var _0x39f0d7=_0x1261[_0x3c7ae2];return _0x39f0d7;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x4b3f33,_0x423862){var _0x243773=function(_0xb1dc3e){while(--_0xb1dc3e){_0x4b3f33['push'](_0x4b3f33['shift']());}};_0x243773(++_0x423862);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3ba62b,_0x5423d3){_0x3ba62b=_0x3ba62b-0x0;var _0x5538e3=_0xbd51[_0x3ba62b];return _0x5538e3;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'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 eeb1e30..be69284 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 _0xcbd3=['attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x5cca1d,_0xac72c1){_0x5cca1d=_0x5cca1d-0x0;var _0x2d2ed9=_0xcbd3[_0x5cca1d];return _0x2d2ed9;};'use strict';var emlformat=require(_0x3cbd('0x0'));var rimraf=require(_0x3cbd('0x1'));var zipdir=require(_0x3cbd('0x2'));var jsonpatch=require(_0x3cbd('0x3'));var rp=require(_0x3cbd('0x4'));var moment=require(_0x3cbd('0x5'));var BPromise=require(_0x3cbd('0x6'));var Mustache=require(_0x3cbd('0x7'));var util=require(_0x3cbd('0x8'));var path=require(_0x3cbd('0x9'));var sox=require('sox');var csv=require(_0x3cbd('0xa'));var ejs=require(_0x3cbd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3cbd('0xc'));var squel=require('squel');var crypto=require(_0x3cbd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3cbd('0xe'));var toCsv=require(_0x3cbd('0xa'));var querystring=require(_0x3cbd('0xf'));var Papa=require(_0x3cbd('0x10'));var Redis=require(_0x3cbd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3cbd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cbd('0x13'));var logger=require(_0x3cbd('0x14'))(_0x3cbd('0x15'));var utils=require('../../config/utils');var config=require(_0x3cbd('0x16'));var licenseUtil=require(_0x3cbd('0x17'));var db=require(_0x3cbd('0x18'))['db'];config[_0x3cbd('0x19')]=_['defaults'](config['redis'],{'host':_0x3cbd('0x1a'),'port':0x18eb});var socket=require(_0x3cbd('0x1b'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x1fa41c,_0x50c8c1){_0x50c8c1=_0x50c8c1||0xcc;return function(_0x5bcc07){if(_0x5bcc07){return _0x1fa41c[_0x3cbd('0x1c')](_0x50c8c1);}return _0x1fa41c[_0x3cbd('0x1d')](_0x50c8c1)[_0x3cbd('0x1e')]();};}function respondWithResult(_0x396411,_0x26aa7c){_0x26aa7c=_0x26aa7c||0xc8;return function(_0x1114b9){if(_0x1114b9){return _0x396411['status'](_0x26aa7c)[_0x3cbd('0x1f')](_0x1114b9);}};}function respondWithFilteredResult(_0xc54a96,_0x167d0d){return function(_0x53774e){if(_0x53774e){var _0x5707d6=typeof _0x167d0d[_0x3cbd('0x20')]==='undefined'&&typeof _0x167d0d[_0x3cbd('0x21')]===_0x3cbd('0x22');var _0x4badba=_0x53774e['count'];var _0x4587fc=_0x5707d6?0x0:_0x167d0d[_0x3cbd('0x20')];var _0x3b41a2=_0x5707d6?_0x53774e[_0x3cbd('0x23')]:_0x167d0d[_0x3cbd('0x20')]+_0x167d0d[_0x3cbd('0x21')];var _0x2bfd5f;if(_0x3b41a2>=_0x4badba){_0x3b41a2=_0x4badba;_0x2bfd5f=0xc8;}else{_0x2bfd5f=0xce;}_0xc54a96[_0x3cbd('0x1d')](_0x2bfd5f);return _0xc54a96[_0x3cbd('0x24')]('Content-Range',_0x4587fc+'-'+_0x3b41a2+'/'+_0x4badba)['json'](_0x53774e);}return null;};}function patchUpdates(_0x375f0d){return function(_0x3023ad){try{jsonpatch[_0x3cbd('0x25')](_0x3023ad,_0x375f0d,!![]);}catch(_0x196afd){return BPromise[_0x3cbd('0x26')](_0x196afd);}return _0x3023ad['save']();};}function saveUpdates(_0x420c46,_0x37dcd4){return function(_0x2de952){if(_0x2de952){return _0x2de952[_0x3cbd('0x27')](_0x420c46)[_0x3cbd('0x28')](function(_0x3828aa){return _0x3828aa;});}return null;};}function removeEntity(_0x4696af,_0x1debc2){return function(_0x2d3c09){if(_0x2d3c09){return _0x2d3c09[_0x3cbd('0x29')]()[_0x3cbd('0x28')](function(){_0x4696af[_0x3cbd('0x1d')](0xcc)[_0x3cbd('0x1e')]();});}};}function handleEntityNotFound(_0x3df4f2,_0x494734){return function(_0x318ba5){if(!_0x318ba5){_0x3df4f2[_0x3cbd('0x1c')](0x194);}return _0x318ba5;};}function handleError(_0xc0c7a7,_0x3717aa){_0x3717aa=_0x3717aa||0x1f4;return function(_0x517338){logger[_0x3cbd('0x2a')](_0x517338[_0x3cbd('0x2b')]);if(_0x517338[_0x3cbd('0x2c')]){delete _0x517338['name'];}_0xc0c7a7[_0x3cbd('0x1d')](_0x3717aa)['send'](_0x517338);};}exports[_0x3cbd('0x2d')]=function(_0xc01447,_0x3d2aaa){var _0x4ed4bc={'raw':![],'where':{'id':_0xc01447[_0x3cbd('0x2e')]['id']}},_0x48029b={};_0x48029b[_0x3cbd('0x2f')]=_[_0x3cbd('0x30')](db[_0x3cbd('0x31')][_0x3cbd('0x32')]);_0x48029b['query']=_['keys'](_0xc01447[_0x3cbd('0x33')]);_0x48029b['filters']=_[_0x3cbd('0x34')](_0x48029b[_0x3cbd('0x2f')],_0x48029b['query']);_0x4ed4bc[_0x3cbd('0x35')]=_[_0x3cbd('0x34')](_0x48029b[_0x3cbd('0x2f')],qs[_0x3cbd('0x36')](_0xc01447[_0x3cbd('0x33')][_0x3cbd('0x36')]));_0x4ed4bc[_0x3cbd('0x35')]=_0x4ed4bc[_0x3cbd('0x35')][_0x3cbd('0x37')]?_0x4ed4bc[_0x3cbd('0x35')]:_0x48029b[_0x3cbd('0x2f')];if(_0xc01447[_0x3cbd('0x33')][_0x3cbd('0x38')]){_0x4ed4bc['include']=[{'all':!![]}];}_0x4ed4bc=_[_0x3cbd('0x39')]({},_0x4ed4bc,_0xc01447['options']);return db[_0x3cbd('0x31')][_0x3cbd('0x3a')](_0x4ed4bc)[_0x3cbd('0x28')](handleEntityNotFound(_0x3d2aaa,null))['then'](respondWithResult(_0x3d2aaa,null))[_0x3cbd('0x3b')](handleError(_0x3d2aaa,null));};exports['destroy']=function(_0x2a93f7,_0x4f896f){return db[_0x3cbd('0x31')][_0x3cbd('0x3a')]({'where':{'id':_0x2a93f7[_0x3cbd('0x2e')]['id']}})[_0x3cbd('0x28')](handleEntityNotFound(_0x4f896f,null))[_0x3cbd('0x28')](removeEntity(_0x4f896f,null))[_0x3cbd('0x3b')](handleError(_0x4f896f,null));};function widgetAttributes(_0x81e9c8){try{switch(_0x81e9c8[_0x3cbd('0x3c')]){case _0x3cbd('0x3d'):return[{'name':_0x3cbd('0x3e'),'value':_0x81e9c8['attrUrl']||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8['attrs'][0x0]?_0x81e9c8[_0x3cbd('0x3f')][0x0]['value']:undefined)||_0x3cbd('0x40')}];case _0x3cbd('0x41'):return[{'name':_0x3cbd('0x42'),'value':_0x81e9c8[_0x3cbd('0x42')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x0]?_0x81e9c8[_0x3cbd('0x3f')][0x0][_0x3cbd('0x43')]:undefined)||''}];case _0x3cbd('0x44'):return[{'name':'attrHourFormat','value':_0x81e9c8['attrHourFormat']||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8['attrs'][0x0]?_0x81e9c8[_0x3cbd('0x3f')][0x0][_0x3cbd('0x43')]:undefined)||_0x3cbd('0x45')},{'name':_0x3cbd('0x46'),'value':_0x81e9c8[_0x3cbd('0x46')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x1]?_0x81e9c8[_0x3cbd('0x3f')][0x1][_0x3cbd('0x43')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x81e9c8['attrFontSize']||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x2]?_0x81e9c8[_0x3cbd('0x3f')][0x2][_0x3cbd('0x43')]:undefined)||0xc}];case _0x3cbd('0x47'):return[{'name':_0x3cbd('0x48'),'value':_0x81e9c8[_0x3cbd('0x48')]||(_0x81e9c8['attrs']&&_0x81e9c8['attrs'][0x0]?_0x81e9c8[_0x3cbd('0x3f')][0x0]['value']:undefined)||_0x3cbd('0x49')},{'name':_0x3cbd('0x4a'),'value':_0x81e9c8[_0x3cbd('0x4a')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8['attrs'][0x1]?_0x81e9c8['attrs'][0x1][_0x3cbd('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x81e9c8[_0x3cbd('0x4b')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x2]?_0x81e9c8[_0x3cbd('0x3f')][0x2][_0x3cbd('0x43')]:undefined)||0x14},{'name':'attrChannel','value':_0x81e9c8[_0x3cbd('0x4c')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8['attrs'][0x3]?_0x81e9c8[_0x3cbd('0x3f')][0x3][_0x3cbd('0x43')]:undefined)||_0x3cbd('0x4d')},{'name':'attrEmailAccounts','value':_0x81e9c8['attrEmailAccounts']||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x4]?_0x81e9c8[_0x3cbd('0x3f')][0x4]['value']:undefined)||''},{'name':_0x3cbd('0x4e'),'value':_0x81e9c8[_0x3cbd('0x4e')]||(_0x81e9c8['attrs']&&_0x81e9c8['attrs'][0x5]?_0x81e9c8['attrs'][0x5][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x4f'),'value':_0x81e9c8[_0x3cbd('0x4f')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x6]?_0x81e9c8[_0x3cbd('0x3f')][0x6][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x50'),'value':_0x81e9c8['attrOpenchannelAccounts']||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x7]?_0x81e9c8[_0x3cbd('0x3f')][0x7][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x51'),'value':_0x81e9c8[_0x3cbd('0x51')]||(_0x81e9c8['attrs']&&_0x81e9c8['attrs'][0x8]?_0x81e9c8[_0x3cbd('0x3f')][0x8][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x52'),'value':_0x81e9c8[_0x3cbd('0x52')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x9]?_0x81e9c8[_0x3cbd('0x3f')][0x9]['value']:undefined)||''}];case _0x3cbd('0x53'):case _0x3cbd('0x54'):return[{'name':'attrSerie1','value':_0x81e9c8[_0x3cbd('0x55')]||(_0x81e9c8['attrs']&&_0x81e9c8['attrs'][0x0]?_0x81e9c8[_0x3cbd('0x3f')][0x0][_0x3cbd('0x43')]:undefined)||_0x3cbd('0x49')},{'name':_0x3cbd('0x56'),'value':_0x81e9c8[_0x3cbd('0x56')]||(_0x81e9c8['attrs']&&_0x81e9c8[_0x3cbd('0x3f')][0x1]?_0x81e9c8[_0x3cbd('0x3f')][0x1]['value']:undefined)||null},{'name':_0x3cbd('0x57'),'value':_0x81e9c8[_0x3cbd('0x57')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x2]?_0x81e9c8[_0x3cbd('0x3f')][0x2][_0x3cbd('0x43')]:undefined)||null},{'name':_0x3cbd('0x4a'),'value':_0x81e9c8[_0x3cbd('0x4a')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x3]?_0x81e9c8['attrs'][0x3][_0x3cbd('0x43')]:undefined)||[]},{'name':_0x3cbd('0x4c'),'value':_0x81e9c8[_0x3cbd('0x4c')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x4]?_0x81e9c8[_0x3cbd('0x3f')][0x4][_0x3cbd('0x43')]:undefined)||_0x3cbd('0x4d')},{'name':_0x3cbd('0x58'),'value':_0x81e9c8[_0x3cbd('0x58')]||(_0x81e9c8['attrs']&&_0x81e9c8[_0x3cbd('0x3f')][0x5]?_0x81e9c8['attrs'][0x5]['value']:undefined)||''},{'name':_0x3cbd('0x4e'),'value':_0x81e9c8[_0x3cbd('0x4e')]||(_0x81e9c8['attrs']&&_0x81e9c8[_0x3cbd('0x3f')][0x6]?_0x81e9c8['attrs'][0x6][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x4f'),'value':_0x81e9c8[_0x3cbd('0x4f')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x7]?_0x81e9c8[_0x3cbd('0x3f')][0x7][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x50'),'value':_0x81e9c8[_0x3cbd('0x50')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x8]?_0x81e9c8[_0x3cbd('0x3f')][0x8][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x51'),'value':_0x81e9c8[_0x3cbd('0x51')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x9]?_0x81e9c8[_0x3cbd('0x3f')][0x9][_0x3cbd('0x43')]:undefined)||''},{'name':_0x3cbd('0x52'),'value':_0x81e9c8[_0x3cbd('0x52')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0xa]?_0x81e9c8[_0x3cbd('0x3f')][0xa][_0x3cbd('0x43')]:undefined)||''}];case'web-report':return[{'name':_0x3cbd('0x59'),'type':_0x81e9c8[_0x3cbd('0x5a')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x0]?_0x81e9c8[_0x3cbd('0x3f')][0x0][_0x3cbd('0x3c')]:undefined)||null,'value':_0x81e9c8[_0x3cbd('0x59')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x0]?_0x81e9c8[_0x3cbd('0x3f')][0x0][_0x3cbd('0x43')]:undefined)||null},{'name':_0x3cbd('0x5b'),'value':_0x81e9c8[_0x3cbd('0x5b')]||(_0x81e9c8[_0x3cbd('0x3f')]&&_0x81e9c8[_0x3cbd('0x3f')][0x1]?_0x81e9c8[_0x3cbd('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xa459be){logger['error'](_0x3cbd('0x5c'),JSON[_0x3cbd('0x5d')](_0xa459be));return[];}}exports[_0x3cbd('0x5e')]=function(_0x464c98,_0x3f0c74){if(_0x464c98['body']){_0x464c98[_0x3cbd('0x5f')]['attrs']=widgetAttributes(_0x464c98[_0x3cbd('0x5f')]);}return db[_0x3cbd('0x31')]['create'](_0x464c98['body'],{})[_0x3cbd('0x28')](respondWithResult(_0x3f0c74,0xc9))[_0x3cbd('0x3b')](handleError(_0x3f0c74,null));};exports[_0x3cbd('0x27')]=function(_0x5d5a39,_0x393a99){if(_0x5d5a39[_0x3cbd('0x5f')]['id']){delete _0x5d5a39[_0x3cbd('0x5f')]['id'];}_0x5d5a39[_0x3cbd('0x5f')]['attrs']=widgetAttributes(_0x5d5a39['body']);return db[_0x3cbd('0x31')][_0x3cbd('0x3a')]({'where':{'id':_0x5d5a39[_0x3cbd('0x2e')]['id']}})['then'](handleEntityNotFound(_0x393a99,null))['then'](saveUpdates(_0x5d5a39['body'],null))[_0x3cbd('0x28')](respondWithResult(_0x393a99,null))[_0x3cbd('0x3b')](handleError(_0x393a99,null));}; \ No newline at end of file +var _0x4489=['then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy'];(function(_0x23847e,_0x366171){var _0x4319b4=function(_0x3677cf){while(--_0x3677cf){_0x23847e['push'](_0x23847e['shift']());}};_0x4319b4(++_0x366171);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9448('0x0'));var rimraf=require(_0x9448('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9448('0x2'));var rp=require(_0x9448('0x3'));var moment=require(_0x9448('0x4'));var BPromise=require(_0x9448('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9448('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9448('0x7'));var squel=require('squel');var crypto=require(_0x9448('0x8'));var jsforce=require(_0x9448('0x9'));var deskjs=require(_0x9448('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9448('0xb'));var authService=require(_0x9448('0xc'));var qs=require(_0x9448('0xd'));var as=require(_0x9448('0xe'));var hardwareService=require(_0x9448('0xf'));var logger=require('../../config/logger')(_0x9448('0x10'));var utils=require(_0x9448('0x11'));var config=require(_0x9448('0x12'));var licenseUtil=require(_0x9448('0x13'));var db=require(_0x9448('0x14'))['db'];config[_0x9448('0x15')]=_[_0x9448('0x16')](config[_0x9448('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9448('0x17'))(new Redis(config['redis']));require(_0x9448('0x18'))[_0x9448('0x19')](socket);function respondWithStatusCode(_0x50f986,_0x21a6ee){_0x21a6ee=_0x21a6ee||0xcc;return function(_0x23b1fa){if(_0x23b1fa){return _0x50f986[_0x9448('0x1a')](_0x21a6ee);}return _0x50f986[_0x9448('0x1b')](_0x21a6ee)[_0x9448('0x1c')]();};}function respondWithResult(_0x3564c0,_0xcaf7ac){_0xcaf7ac=_0xcaf7ac||0xc8;return function(_0x9b9fd3){if(_0x9b9fd3){return _0x3564c0['status'](_0xcaf7ac)[_0x9448('0x1d')](_0x9b9fd3);}};}function respondWithFilteredResult(_0x5da6d7,_0x2c8f0b){return function(_0xc448c6){if(_0xc448c6){var _0x1104f0=typeof _0x2c8f0b[_0x9448('0x1e')]===_0x9448('0x1f')&&typeof _0x2c8f0b[_0x9448('0x20')]===_0x9448('0x1f');var _0x2156ca=_0xc448c6[_0x9448('0x21')];var _0x18e92c=_0x1104f0?0x0:_0x2c8f0b['offset'];var _0x1cef11=_0x1104f0?_0xc448c6['count']:_0x2c8f0b['offset']+_0x2c8f0b[_0x9448('0x20')];var _0x5cc7da;if(_0x1cef11>=_0x2156ca){_0x1cef11=_0x2156ca;_0x5cc7da=0xc8;}else{_0x5cc7da=0xce;}_0x5da6d7['status'](_0x5cc7da);return _0x5da6d7['set'](_0x9448('0x22'),_0x18e92c+'-'+_0x1cef11+'/'+_0x2156ca)['json'](_0xc448c6);}return null;};}function patchUpdates(_0x39948a){return function(_0xc957ed){try{jsonpatch[_0x9448('0x23')](_0xc957ed,_0x39948a,!![]);}catch(_0x512536){return BPromise[_0x9448('0x24')](_0x512536);}return _0xc957ed[_0x9448('0x25')]();};}function saveUpdates(_0x2a0319,_0x4430ad){return function(_0x38b69e){if(_0x38b69e){return _0x38b69e[_0x9448('0x26')](_0x2a0319)['then'](function(_0x56676e){return _0x56676e;});}return null;};}function removeEntity(_0x7cfc8e,_0x124892){return function(_0x24240d){if(_0x24240d){return _0x24240d[_0x9448('0x27')]()[_0x9448('0x28')](function(){_0x7cfc8e['status'](0xcc)[_0x9448('0x1c')]();});}};}function handleEntityNotFound(_0x4e4134,_0x1e866a){return function(_0x99f7b9){if(!_0x99f7b9){_0x4e4134[_0x9448('0x1a')](0x194);}return _0x99f7b9;};}function handleError(_0x4e3250,_0x2dd998){_0x2dd998=_0x2dd998||0x1f4;return function(_0x3bf608){logger[_0x9448('0x29')](_0x3bf608[_0x9448('0x2a')]);if(_0x3bf608[_0x9448('0x2b')]){delete _0x3bf608[_0x9448('0x2b')];}_0x4e3250['status'](_0x2dd998)[_0x9448('0x2c')](_0x3bf608);};}exports[_0x9448('0x2d')]=function(_0x5b1570,_0x57ac6){var _0x329f36={'raw':![],'where':{'id':_0x5b1570[_0x9448('0x2e')]['id']}},_0x224b3c={};_0x224b3c[_0x9448('0x2f')]=_[_0x9448('0x30')](db['DashboardItem'][_0x9448('0x31')]);_0x224b3c['query']=_[_0x9448('0x30')](_0x5b1570[_0x9448('0x32')]);_0x224b3c[_0x9448('0x33')]=_[_0x9448('0x34')](_0x224b3c[_0x9448('0x2f')],_0x224b3c[_0x9448('0x32')]);_0x329f36[_0x9448('0x35')]=_[_0x9448('0x34')](_0x224b3c['model'],qs[_0x9448('0x36')](_0x5b1570[_0x9448('0x32')]['fields']));_0x329f36['attributes']=_0x329f36[_0x9448('0x35')][_0x9448('0x37')]?_0x329f36['attributes']:_0x224b3c[_0x9448('0x2f')];if(_0x5b1570[_0x9448('0x32')][_0x9448('0x38')]){_0x329f36[_0x9448('0x39')]=[{'all':!![]}];}_0x329f36=_[_0x9448('0x3a')]({},_0x329f36,_0x5b1570[_0x9448('0x3b')]);return db[_0x9448('0x3c')]['find'](_0x329f36)[_0x9448('0x28')](handleEntityNotFound(_0x57ac6,null))[_0x9448('0x28')](respondWithResult(_0x57ac6,null))[_0x9448('0x3d')](handleError(_0x57ac6,null));};exports[_0x9448('0x27')]=function(_0x45193a,_0xf1beb9){return db[_0x9448('0x3c')][_0x9448('0x3e')]({'where':{'id':_0x45193a[_0x9448('0x2e')]['id']}})[_0x9448('0x28')](handleEntityNotFound(_0xf1beb9,null))[_0x9448('0x28')](removeEntity(_0xf1beb9,null))['catch'](handleError(_0xf1beb9,null));};function widgetAttributes(_0x1b94dc){try{switch(_0x1b94dc[_0x9448('0x3f')]){case _0x9448('0x40'):return[{'name':_0x9448('0x41'),'value':_0x1b94dc['attrUrl']||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x0]?_0x1b94dc['attrs'][0x0][_0x9448('0x43')]:undefined)||_0x9448('0x44')}];case _0x9448('0x45'):return[{'name':_0x9448('0x46'),'value':_0x1b94dc['attrPath']||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x0]?_0x1b94dc[_0x9448('0x42')][0x0][_0x9448('0x43')]:undefined)||''}];case _0x9448('0x47'):return[{'name':'attrHourFormat','value':_0x1b94dc[_0x9448('0x48')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x0]?_0x1b94dc['attrs'][0x0][_0x9448('0x43')]:undefined)||_0x9448('0x49')},{'name':'attrTimezone','value':_0x1b94dc['attrTimezone']||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x1]?_0x1b94dc[_0x9448('0x42')][0x1][_0x9448('0x43')]:undefined)||'0.00'},{'name':_0x9448('0x4a'),'value':_0x1b94dc[_0x9448('0x4a')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x2]?_0x1b94dc[_0x9448('0x42')][0x2][_0x9448('0x43')]:undefined)||0xc}];case _0x9448('0x4b'):return[{'name':_0x9448('0x4c'),'value':_0x1b94dc[_0x9448('0x4c')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x0]?_0x1b94dc['attrs'][0x0][_0x9448('0x43')]:undefined)||_0x9448('0x4d')},{'name':_0x9448('0x4e'),'value':_0x1b94dc[_0x9448('0x4e')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x1]?_0x1b94dc[_0x9448('0x42')][0x1][_0x9448('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x1b94dc['attrFontSize']||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x2]?_0x1b94dc[_0x9448('0x42')][0x2][_0x9448('0x43')]:undefined)||0x14},{'name':_0x9448('0x4f'),'value':_0x1b94dc[_0x9448('0x4f')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x3]?_0x1b94dc['attrs'][0x3][_0x9448('0x43')]:undefined)||_0x9448('0x50')},{'name':_0x9448('0x51'),'value':_0x1b94dc[_0x9448('0x51')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x4]?_0x1b94dc[_0x9448('0x42')][0x4][_0x9448('0x43')]:undefined)||''},{'name':_0x9448('0x52'),'value':_0x1b94dc['attrFaxAccounts']||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x5]?_0x1b94dc[_0x9448('0x42')][0x5][_0x9448('0x43')]:undefined)||''},{'name':_0x9448('0x53'),'value':_0x1b94dc[_0x9448('0x53')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x6]?_0x1b94dc[_0x9448('0x42')][0x6][_0x9448('0x43')]:undefined)||''},{'name':_0x9448('0x54'),'value':_0x1b94dc[_0x9448('0x54')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x7]?_0x1b94dc['attrs'][0x7]['value']:undefined)||''},{'name':_0x9448('0x55'),'value':_0x1b94dc['attrWhatsappAccounts']||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x8]?_0x1b94dc[_0x9448('0x42')][0x8][_0x9448('0x43')]:undefined)||''},{'name':_0x9448('0x56'),'value':_0x1b94dc[_0x9448('0x56')]||(_0x1b94dc['attrs']&&_0x1b94dc[_0x9448('0x42')][0x9]?_0x1b94dc['attrs'][0x9][_0x9448('0x43')]:undefined)||''}];case _0x9448('0x57'):case'pie-chart':return[{'name':_0x9448('0x58'),'value':_0x1b94dc[_0x9448('0x58')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x0]?_0x1b94dc[_0x9448('0x42')][0x0][_0x9448('0x43')]:undefined)||_0x9448('0x4d')},{'name':_0x9448('0x59'),'value':_0x1b94dc[_0x9448('0x59')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x1]?_0x1b94dc[_0x9448('0x42')][0x1][_0x9448('0x43')]:undefined)||null},{'name':_0x9448('0x5a'),'value':_0x1b94dc[_0x9448('0x5a')]||(_0x1b94dc['attrs']&&_0x1b94dc[_0x9448('0x42')][0x2]?_0x1b94dc[_0x9448('0x42')][0x2][_0x9448('0x43')]:undefined)||null},{'name':_0x9448('0x4e'),'value':_0x1b94dc['attrVoiceQueues']||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x3]?_0x1b94dc[_0x9448('0x42')][0x3]['value']:undefined)||[]},{'name':_0x9448('0x4f'),'value':_0x1b94dc[_0x9448('0x4f')]||(_0x1b94dc['attrs']&&_0x1b94dc[_0x9448('0x42')][0x4]?_0x1b94dc[_0x9448('0x42')][0x4]['value']:undefined)||_0x9448('0x50')},{'name':_0x9448('0x51'),'value':_0x1b94dc[_0x9448('0x51')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x5]?_0x1b94dc[_0x9448('0x42')][0x5][_0x9448('0x43')]:undefined)||''},{'name':_0x9448('0x52'),'value':_0x1b94dc[_0x9448('0x52')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x6]?_0x1b94dc[_0x9448('0x42')][0x6][_0x9448('0x43')]:undefined)||''},{'name':_0x9448('0x53'),'value':_0x1b94dc[_0x9448('0x53')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x7]?_0x1b94dc[_0x9448('0x42')][0x7][_0x9448('0x43')]:undefined)||''},{'name':_0x9448('0x54'),'value':_0x1b94dc[_0x9448('0x54')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x8]?_0x1b94dc['attrs'][0x8][_0x9448('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1b94dc[_0x9448('0x55')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x9]?_0x1b94dc[_0x9448('0x42')][0x9]['value']:undefined)||''},{'name':_0x9448('0x56'),'value':_0x1b94dc[_0x9448('0x56')]||(_0x1b94dc['attrs']&&_0x1b94dc[_0x9448('0x42')][0xa]?_0x1b94dc['attrs'][0xa]['value']:undefined)||''}];case _0x9448('0x5b'):return[{'name':_0x9448('0x5c'),'type':_0x1b94dc[_0x9448('0x5d')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x0]?_0x1b94dc[_0x9448('0x42')][0x0][_0x9448('0x3f')]:undefined)||null,'value':_0x1b94dc[_0x9448('0x5c')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc[_0x9448('0x42')][0x0]?_0x1b94dc[_0x9448('0x42')][0x0][_0x9448('0x43')]:undefined)||null},{'name':'attrRefresh','value':_0x1b94dc[_0x9448('0x5e')]||(_0x1b94dc[_0x9448('0x42')]&&_0x1b94dc['attrs'][0x1]?_0x1b94dc[_0x9448('0x42')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4e98a3){logger['error'](_0x9448('0x5f'),JSON[_0x9448('0x60')](_0x4e98a3));return[];}}exports[_0x9448('0x61')]=function(_0x4b8996,_0x4eae99){if(_0x4b8996['body']){_0x4b8996[_0x9448('0x62')][_0x9448('0x42')]=widgetAttributes(_0x4b8996['body']);}return db['DashboardItem'][_0x9448('0x61')](_0x4b8996['body'],{})[_0x9448('0x28')](respondWithResult(_0x4eae99,0xc9))[_0x9448('0x3d')](handleError(_0x4eae99,null));};exports[_0x9448('0x26')]=function(_0x371203,_0x43d5bb){if(_0x371203['body']['id']){delete _0x371203['body']['id'];}_0x371203['body']['attrs']=widgetAttributes(_0x371203['body']);return db[_0x9448('0x3c')][_0x9448('0x3e')]({'where':{'id':_0x371203['params']['id']}})[_0x9448('0x28')](handleEntityNotFound(_0x43d5bb,null))[_0x9448('0x28')](saveUpdates(_0x371203['body'],null))[_0x9448('0x28')](respondWithResult(_0x43d5bb,null))[_0x9448('0x3d')](handleError(_0x43d5bb,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 48f9807..1a74288 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 _0x6b1e=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x47acac,_0x3b8af6){var _0xebed16=function(_0x4fd79c){while(--_0x4fd79c){_0x47acac['push'](_0x47acac['shift']());}};_0xebed16(++_0x3b8af6);}(_0x6b1e,0x9a));var _0xe6b1=function(_0x58f4be,_0x2bfa95){_0x58f4be=_0x58f4be-0x0;var _0x4d7d48=_0x6b1e[_0x58f4be];return _0x4d7d48;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe6b1('0x0')](0x0);var events={'afterCreate':_0xe6b1('0x1'),'afterUpdate':_0xe6b1('0x2'),'afterDestroy':'remove'};function emitEvent(_0x29f546){return function(_0x45dfab,_0x56ebe3,_0x2df682){DashboardItemEvents['emit'](_0x29f546+':'+_0x45dfab['id'],_0x45dfab);DashboardItemEvents[_0xe6b1('0x3')](_0x29f546,_0x45dfab);_0x2df682(null);};}for(var e in events){if(events[_0xe6b1('0x4')](e)){var event=events[e];DashboardItem[_0xe6b1('0x5')](e,emitEvent(event));}}module[_0xe6b1('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x1d82=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x136a60,_0x5bb51b){var _0xc72bc2=function(_0xdc9201){while(--_0xdc9201){_0x136a60['push'](_0x136a60['shift']());}};_0xc72bc2(++_0x5bb51b);}(_0x1d82,0xe1));var _0x21d8=function(_0x378d31,_0x36de75){_0x378d31=_0x378d31-0x0;var _0x406ac5=_0x1d82[_0x378d31];return _0x406ac5;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x21d8('0x0'))['db'][_0x21d8('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x21d8('0x2')](0x0);var events={'afterCreate':_0x21d8('0x3'),'afterUpdate':_0x21d8('0x4'),'afterDestroy':_0x21d8('0x5')};function emitEvent(_0x11953d){return function(_0x43a508,_0x50630a,_0x4d50e6){DashboardItemEvents[_0x21d8('0x6')](_0x11953d+':'+_0x43a508['id'],_0x43a508);DashboardItemEvents[_0x21d8('0x6')](_0x11953d,_0x43a508);_0x4d50e6(null);};}for(var e in events){if(events[_0x21d8('0x7')](e)){var event=events[e];DashboardItem[_0x21d8('0x8')](e,emitEvent(event));}}module[_0x21d8('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e064f6f..d94454e 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 _0xf4ac=['util','../../config/logger','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf4ac,0xd0));var _0xcf4a=function(_0x1ed00a,_0x6a7f8d){_0x1ed00a=_0x1ed00a-0x0;var _0x264266=_0xf4ac[_0x1ed00a];return _0x264266;};'use strict';var _=require(_0xcf4a('0x0'));var util=require(_0xcf4a('0x1'));var logger=require(_0xcf4a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf4a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf4a('0x4'));var config=require(_0xcf4a('0x5'));var attributes=require(_0xcf4a('0x6'));module[_0xcf4a('0x7')]=function(_0x104d9a,_0x2d28ed){return _0x104d9a[_0xcf4a('0x8')](_0xcf4a('0x9'),attributes,{'tableName':_0xcf4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x291c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','DashboardItem','dashboard_items','lodash'];(function(_0x15c8b6,_0x1f4190){var _0x4a1c91=function(_0x4f0b77){while(--_0x4f0b77){_0x15c8b6['push'](_0x15c8b6['shift']());}};_0x4a1c91(++_0x1f4190);}(_0x291c,0x137));var _0xc291=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x291c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var logger=require(_0xc291('0x2'))(_0xc291('0x3'));var moment=require(_0xc291('0x4'));var BPromise=require(_0xc291('0x5'));var rp=require(_0xc291('0x6'));var fs=require('fs');var path=require(_0xc291('0x7'));var rimraf=require(_0xc291('0x8'));var config=require(_0xc291('0x9'));var attributes=require(_0xc291('0xa'));module['exports']=function(_0x2c96a8,_0x5f2563){return _0x2c96a8['define'](_0xc291('0xb'),attributes,{'tableName':_0xc291('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 6bf2ad3..a05f26f 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 _0x3053=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','register','request','info','DashboardItem,\x20%s,\x20%s','debug'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x3053,0x128));var _0x3305=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3053[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3305('0x0'));var BPromise=require(_0x3305('0x1'));var rs=require(_0x3305('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3305('0x3'))['db'];var utils=require(_0x3305('0x4'));var logger=require('../../config/logger')(_0x3305('0x5'));var config=require('../../config/environment');var jayson=require(_0x3305('0x6'));var client=jayson['client'][_0x3305('0x7')]({'port':0x232a});config[_0x3305('0x8')]=_[_0x3305('0x9')](config[_0x3305('0x8')],{'host':_0x3305('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3305('0x8')]));require('./dashboardItem.socket')[_0x3305('0xb')](socket);function respondWithRpcPromise(_0x55a21f,_0x578af0,_0x2bc073){return new BPromise(function(_0x1d7ca9,_0x2099e5){return client[_0x3305('0xc')](_0x55a21f,_0x2bc073)['then'](function(_0x5d59cc){logger[_0x3305('0xd')](_0x3305('0xe'),_0x578af0,'request\x20sent');logger[_0x3305('0xf')](_0x3305('0x10'),_0x578af0,'request\x20sent',JSON[_0x3305('0x11')](_0x5d59cc));if(_0x5d59cc[_0x3305('0x12')]){if(_0x5d59cc[_0x3305('0x12')][_0x3305('0x13')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x578af0,_0x5d59cc[_0x3305('0x12')][_0x3305('0x14')]);return _0x2099e5(_0x5d59cc[_0x3305('0x12')][_0x3305('0x14')]);}logger[_0x3305('0x12')](_0x3305('0xe'),_0x578af0,_0x5d59cc[_0x3305('0x12')][_0x3305('0x14')]);return _0x1d7ca9(_0x5d59cc['error']['message']);}else{logger[_0x3305('0xd')](_0x3305('0xe'),_0x578af0,_0x3305('0x15'));_0x1d7ca9(_0x5d59cc[_0x3305('0x16')][_0x3305('0x14')]);}})[_0x3305('0x17')](function(_0x460fdf){logger[_0x3305('0x12')](_0x3305('0xe'),_0x578af0,_0x460fdf);_0x2099e5(_0x460fdf);});});} \ No newline at end of file +var _0x472c=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x49f0a3,_0xf2e5d8){var _0x59b39b=function(_0xaa266d){while(--_0xaa266d){_0x49f0a3['push'](_0x49f0a3['shift']());}};_0x59b39b(++_0xf2e5d8);}(_0x472c,0x181));var _0xc472=function(_0x596aa4,_0xdf2166){_0x596aa4=_0x596aa4-0x0;var _0x546d2d=_0x472c[_0x596aa4];return _0x546d2d;};'use strict';var _=require(_0xc472('0x0'));var util=require('util');var moment=require(_0xc472('0x1'));var BPromise=require('bluebird');var rs=require(_0xc472('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc472('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc472('0x4'))(_0xc472('0x5'));var config=require(_0xc472('0x6'));var jayson=require(_0xc472('0x7'));var client=jayson[_0xc472('0x8')]['http']({'port':0x232a});config[_0xc472('0x9')]=_[_0xc472('0xa')](config[_0xc472('0x9')],{'host':_0xc472('0xb'),'port':0x18eb});var socket=require(_0xc472('0xc'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xc472('0xd')](socket);function respondWithRpcPromise(_0x4fd8d5,_0x1c4b85,_0x119c1d){return new BPromise(function(_0x277ccc,_0x169f0d){return client[_0xc472('0xe')](_0x4fd8d5,_0x119c1d)[_0xc472('0xf')](function(_0x1b32d1){logger[_0xc472('0x10')](_0xc472('0x11'),_0x1c4b85,'request\x20sent');logger[_0xc472('0x12')](_0xc472('0x13'),_0x1c4b85,_0xc472('0x14'),JSON[_0xc472('0x15')](_0x1b32d1));if(_0x1b32d1['error']){if(_0x1b32d1[_0xc472('0x16')][_0xc472('0x17')]===0x1f4){logger[_0xc472('0x16')](_0xc472('0x11'),_0x1c4b85,_0x1b32d1[_0xc472('0x16')]['message']);return _0x169f0d(_0x1b32d1['error'][_0xc472('0x18')]);}logger['error'](_0xc472('0x11'),_0x1c4b85,_0x1b32d1[_0xc472('0x16')]['message']);return _0x277ccc(_0x1b32d1['error'][_0xc472('0x18')]);}else{logger[_0xc472('0x10')](_0xc472('0x11'),_0x1c4b85,_0xc472('0x14'));_0x277ccc(_0x1b32d1[_0xc472('0x19')][_0xc472('0x18')]);}})[_0xc472('0x1a')](function(_0x491e41){logger[_0xc472('0x16')](_0xc472('0x11'),_0x1c4b85,_0x491e41);_0x169f0d(_0x491e41);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ab98343..4ffd8d3 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 _0x4680=['./dashboardItem.events','remove','update','emit','removeListener','register','dashboardItem:'];(function(_0x4c1cb6,_0x3e1050){var _0x9233e4=function(_0x30c516){while(--_0x30c516){_0x4c1cb6['push'](_0x4c1cb6['shift']());}};_0x9233e4(++_0x3e1050);}(_0x4680,0x10a));var _0x0468=function(_0x450a84,_0x583ff1){_0x450a84=_0x450a84-0x0;var _0x15dccd=_0x4680[_0x450a84];return _0x15dccd;};'use strict';var DashboardItemEvents=require(_0x0468('0x0'));var events=['save',_0x0468('0x1'),_0x0468('0x2')];function createListener(_0x5efb40,_0x144b58){return function(_0x5cf82d){_0x144b58[_0x0468('0x3')](_0x5efb40,_0x5cf82d);};}function removeListener(_0x3efa2a,_0x3f7a24){return function(){DashboardItemEvents[_0x0468('0x4')](_0x3efa2a,_0x3f7a24);};}exports[_0x0468('0x5')]=function(_0x3d0632){for(var _0x1f5328=0x0,_0x4498ed=events['length'];_0x1f5328<_0x4498ed;_0x1f5328++){var _0x3e12ad=events[_0x1f5328];var _0x5932b8=createListener(_0x0468('0x6')+_0x3e12ad,_0x3d0632);DashboardItemEvents['on'](_0x3e12ad,_0x5932b8);}}; \ No newline at end of file +var _0x7ba3=['emit','removeListener','register','save','remove'];(function(_0x51e0d4,_0x828ada){var _0x48aec7=function(_0x577b76){while(--_0x577b76){_0x51e0d4['push'](_0x51e0d4['shift']());}};_0x48aec7(++_0x828ada);}(_0x7ba3,0x7b));var _0x37ba=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x7ba3[_0x324496];return _0x899545;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x37ba('0x0'),_0x37ba('0x1'),'update'];function createListener(_0x466fb5,_0x571ce3){return function(_0x3e7e14){_0x571ce3[_0x37ba('0x2')](_0x466fb5,_0x3e7e14);};}function removeListener(_0x1b3edc,_0x27d87e){return function(){DashboardItemEvents[_0x37ba('0x3')](_0x1b3edc,_0x27d87e);};}exports[_0x37ba('0x4')]=function(_0x559293){for(var _0x40113f=0x0,_0x123a96=events['length'];_0x40113f<_0x123a96;_0x40113f++){var _0x225099=events[_0x40113f];var _0x498944=createListener('dashboardItem:'+_0x225099,_0x559293);DashboardItemEvents['on'](_0x225099,_0x498944);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b884ae4..31443cd 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 _0x4ffe=['get','/:id','isAuthenticated','show','create','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x34205d,_0x26937c){var _0x141c79=function(_0x264db4){while(--_0x264db4){_0x34205d['push'](_0x34205d['shift']());}};_0x141c79(++_0x26937c);}(_0x4ffe,0x1b0));var _0xe4ff=function(_0xb65f0c,_0xe60c57){_0xb65f0c=_0xb65f0c-0x0;var _0x2ff246=_0x4ffe[_0xb65f0c];return _0x2ff246;};'use strict';var multer=require(_0xe4ff('0x0'));var util=require(_0xe4ff('0x1'));var path=require(_0xe4ff('0x2'));var timeout=require(_0xe4ff('0x3'));var express=require(_0xe4ff('0x4'));var router=express['Router']();var fs_extra=require(_0xe4ff('0x5'));var auth=require(_0xe4ff('0x6'));var interaction=require(_0xe4ff('0x7'));var config=require(_0xe4ff('0x8'));var controller=require(_0xe4ff('0x9'));router[_0xe4ff('0xa')](_0xe4ff('0xb'),auth[_0xe4ff('0xc')](),controller[_0xe4ff('0xd')]);router['post']('/',auth[_0xe4ff('0xc')](),controller[_0xe4ff('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe4ff('0xf')]);router[_0xe4ff('0x10')]('/:id',auth[_0xe4ff('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb3f9=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xb3f9,0x146));var _0x9b3f=function(_0x587850,_0x40f2ea){_0x587850=_0x587850-0x0;var _0x24b5e0=_0xb3f9[_0x587850];return _0x24b5e0;};'use strict';var multer=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var path=require(_0x9b3f('0x2'));var timeout=require(_0x9b3f('0x3'));var express=require('express');var router=express[_0x9b3f('0x4')]();var fs_extra=require(_0x9b3f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9b3f('0x6'));var config=require('../../config/environment');var controller=require(_0x9b3f('0x7'));router[_0x9b3f('0x8')](_0x9b3f('0x9'),auth[_0x9b3f('0xa')](),controller[_0x9b3f('0xb')]);router[_0x9b3f('0xc')]('/',auth[_0x9b3f('0xa')](),controller[_0x9b3f('0xd')]);router[_0x9b3f('0xe')](_0x9b3f('0x9'),auth[_0x9b3f('0xa')](),controller['update']);router[_0x9b3f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9b3f('0x10')]);module[_0x9b3f('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f158ac0..fe7fe65 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 _0xdcd9=['STRING','third','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdcd9,0x14f));var _0x9dcd=function(_0x4848f2,_0x31632a){_0x4848f2=_0x4848f2-0x0;var _0x46b2db=_0xdcd9[_0x4848f2];return _0x46b2db;};'use strict';var Sequelize=require(_0x9dcd('0x0'));module['exports']={'name':{'type':Sequelize[_0x9dcd('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first','second',_0x9dcd('0x2')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9dcd('0x1')]}}; \ No newline at end of file +var _0xdb61=['first','sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xdb61,0x135));var _0x1db6=function(_0x31e27a,_0x30e2f5){_0x31e27a=_0x31e27a-0x0;var _0x453afe=_0xdb61[_0x31e27a];return _0x453afe;};'use strict';var Sequelize=require(_0x1db6('0x0'));module[_0x1db6('0x1')]={'name':{'type':Sequelize[_0x1db6('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x1db6('0x3'),'second','third'),'allowNull':![],'defaultValue':_0x1db6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8f712a3..f063d1e 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 _0xf74d=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Disposition','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','Dispositions','UserProfileResource','end','stack','name','send','index','type','model','map','query','keys','filters','attributes','intersection','fields','length'];(function(_0x359e76,_0x5823e8){var _0x41753b=function(_0x5db1b1){while(--_0x5db1b1){_0x359e76['push'](_0x359e76['shift']());}};_0x41753b(++_0x5823e8);}(_0xf74d,0x168));var _0xdf74=function(_0x45bec1,_0x10e58d){_0x45bec1=_0x45bec1-0x0;var _0x52ac23=_0xf74d[_0x45bec1];return _0x52ac23;};'use strict';var emlformat=require(_0xdf74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdf74('0x1'));var rp=require(_0xdf74('0x2'));var moment=require(_0xdf74('0x3'));var BPromise=require(_0xdf74('0x4'));var Mustache=require(_0xdf74('0x5'));var util=require(_0xdf74('0x6'));var path=require('path');var sox=require(_0xdf74('0x7'));var csv=require(_0xdf74('0x8'));var ejs=require(_0xdf74('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf74('0xa'));var crypto=require(_0xdf74('0xb'));var jsforce=require(_0xdf74('0xc'));var deskjs=require(_0xdf74('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdf74('0xe'));var Papa=require(_0xdf74('0xf'));var Redis=require(_0xdf74('0x10'));var authService=require(_0xdf74('0x11'));var qs=require(_0xdf74('0x12'));var as=require(_0xdf74('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf74('0x14'))(_0xdf74('0x15'));var utils=require('../../config/utils');var config=require(_0xdf74('0x16'));var licenseUtil=require(_0xdf74('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x556cbc,_0x4880ff){_0x4880ff=_0x4880ff||0xcc;return function(_0x13a96c){if(_0x13a96c){return _0x556cbc[_0xdf74('0x18')](_0x4880ff);}return _0x556cbc[_0xdf74('0x19')](_0x4880ff)['end']();};}function respondWithResult(_0x184da5,_0x560fa7){_0x560fa7=_0x560fa7||0xc8;return function(_0x339cef){if(_0x339cef){return _0x184da5[_0xdf74('0x19')](_0x560fa7)[_0xdf74('0x1a')](_0x339cef);}};}function respondWithFilteredResult(_0x240fef,_0x33f826){return function(_0x5bddf2){if(_0x5bddf2){var _0x2a31cf=typeof _0x33f826['offset']===_0xdf74('0x1b')&&typeof _0x33f826['limit']===_0xdf74('0x1b');var _0x2f1ef3=_0x5bddf2['count'];var _0x1e9b46=_0x2a31cf?0x0:_0x33f826['offset'];var _0x35b54e=_0x2a31cf?_0x5bddf2[_0xdf74('0x1c')]:_0x33f826[_0xdf74('0x1d')]+_0x33f826[_0xdf74('0x1e')];var _0x4248e8;if(_0x35b54e>=_0x2f1ef3){_0x35b54e=_0x2f1ef3;_0x4248e8=0xc8;}else{_0x4248e8=0xce;}_0x240fef[_0xdf74('0x19')](_0x4248e8);return _0x240fef[_0xdf74('0x1f')](_0xdf74('0x20'),_0x1e9b46+'-'+_0x35b54e+'/'+_0x2f1ef3)['json'](_0x5bddf2);}return null;};}function patchUpdates(_0xe5783c){return function(_0x5a3d68){try{jsonpatch[_0xdf74('0x21')](_0x5a3d68,_0xe5783c,!![]);}catch(_0x27130b){return BPromise[_0xdf74('0x22')](_0x27130b);}return _0x5a3d68[_0xdf74('0x23')]();};}function saveUpdates(_0x5b10dd,_0x13db6c){return function(_0x5b5064){if(_0x5b5064){return _0x5b5064['update'](_0x5b10dd)['then'](function(_0x16fc80){return _0x16fc80;});}return null;};}function removeEntity(_0x4fe153,_0x26de5e){return function(_0x43e044){if(_0x43e044){return _0x43e044[_0xdf74('0x24')]()[_0xdf74('0x25')](function(){var _0x4ce2be=_0x43e044['get']({'plain':!![]});var _0x2edb4c=_0xdf74('0x26');return db[_0xdf74('0x27')][_0xdf74('0x24')]({'where':{'type':_0x2edb4c,'resourceId':_0x4ce2be['id']}})[_0xdf74('0x25')](function(){return _0x43e044;});})[_0xdf74('0x25')](function(){_0x4fe153['status'](0xcc)[_0xdf74('0x28')]();});}};}function handleEntityNotFound(_0x161cc9,_0x3c2a8a){return function(_0x455693){if(!_0x455693){_0x161cc9[_0xdf74('0x18')](0x194);}return _0x455693;};}function handleError(_0x8faf77,_0x19752b){_0x19752b=_0x19752b||0x1f4;return function(_0x3ae23d){logger['error'](_0x3ae23d[_0xdf74('0x29')]);if(_0x3ae23d[_0xdf74('0x2a')]){delete _0x3ae23d['name'];}_0x8faf77[_0xdf74('0x19')](_0x19752b)[_0xdf74('0x2b')](_0x3ae23d);};}exports[_0xdf74('0x2c')]=function(_0x51d3bd,_0x1067be){var _0x52f76e={},_0x5ad06e={},_0x23737e={'count':0x0,'rows':[]};var _0x1b19e9=_['map'](db['Disposition']['rawAttributes'],function(_0x3a4058){return{'name':_0x3a4058['fieldName'],'type':_0x3a4058[_0xdf74('0x2d')]['key']};});_0x5ad06e[_0xdf74('0x2e')]=_[_0xdf74('0x2f')](_0x1b19e9,'name');_0x5ad06e[_0xdf74('0x30')]=_[_0xdf74('0x31')](_0x51d3bd[_0xdf74('0x30')]);_0x5ad06e[_0xdf74('0x32')]=_['intersection'](_0x5ad06e['model'],_0x5ad06e[_0xdf74('0x30')]);_0x52f76e[_0xdf74('0x33')]=_[_0xdf74('0x34')](_0x5ad06e[_0xdf74('0x2e')],qs[_0xdf74('0x35')](_0x51d3bd[_0xdf74('0x30')][_0xdf74('0x35')]));_0x52f76e[_0xdf74('0x33')]=_0x52f76e[_0xdf74('0x33')][_0xdf74('0x36')]?_0x52f76e[_0xdf74('0x33')]:_0x5ad06e[_0xdf74('0x2e')];if(!_0x51d3bd[_0xdf74('0x30')]['hasOwnProperty'](_0xdf74('0x37'))){_0x52f76e[_0xdf74('0x1e')]=qs['limit'](_0x51d3bd['query']['limit']);_0x52f76e[_0xdf74('0x1d')]=qs[_0xdf74('0x1d')](_0x51d3bd['query'][_0xdf74('0x1d')]);}_0x52f76e[_0xdf74('0x38')]=qs[_0xdf74('0x39')](_0x51d3bd[_0xdf74('0x30')][_0xdf74('0x39')]);_0x52f76e['where']=qs['filters'](_[_0xdf74('0x3a')](_0x51d3bd[_0xdf74('0x30')],_0x5ad06e[_0xdf74('0x32')]),_0x1b19e9);if(_0x51d3bd[_0xdf74('0x30')][_0xdf74('0x3b')]){_0x52f76e[_0xdf74('0x3c')]=_[_0xdf74('0x3d')](_0x52f76e[_0xdf74('0x3c')],{'$or':_['map'](_0x1b19e9,function(_0x3e8cd9){if(_0x3e8cd9[_0xdf74('0x2d')]!==_0xdf74('0x3e')){var _0x5e60d1={};_0x5e60d1[_0x3e8cd9[_0xdf74('0x2a')]]={'$like':'%'+_0x51d3bd[_0xdf74('0x30')][_0xdf74('0x3b')]+'%'};return _0x5e60d1;}})});}_0x52f76e=_[_0xdf74('0x3d')]({},_0x52f76e,_0x51d3bd[_0xdf74('0x3f')]);var _0x55a990={'where':_0x52f76e[_0xdf74('0x3c')]};return db[_0xdf74('0x40')][_0xdf74('0x1c')](_0x55a990)['then'](function(_0x222d6e){_0x23737e[_0xdf74('0x1c')]=_0x222d6e;if(_0x51d3bd['query']['includeAll']){_0x52f76e[_0xdf74('0x41')]=[{'all':!![]}];}return db[_0xdf74('0x40')][_0xdf74('0x42')](_0x52f76e);})[_0xdf74('0x25')](function(_0x5ca897){_0x23737e['rows']=_0x5ca897;return _0x23737e;})[_0xdf74('0x25')](respondWithFilteredResult(_0x1067be,_0x52f76e))[_0xdf74('0x43')](handleError(_0x1067be,null));};exports[_0xdf74('0x44')]=function(_0x1fb104,_0x11d80c){var _0x5940d3={'raw':!![],'where':{'id':_0x1fb104[_0xdf74('0x45')]['id']}},_0x215bcb={};_0x215bcb['model']=_['keys'](db['Disposition'][_0xdf74('0x46')]);_0x215bcb[_0xdf74('0x30')]=_['keys'](_0x1fb104[_0xdf74('0x30')]);_0x215bcb[_0xdf74('0x32')]=_[_0xdf74('0x34')](_0x215bcb[_0xdf74('0x2e')],_0x215bcb['query']);_0x5940d3[_0xdf74('0x33')]=_[_0xdf74('0x34')](_0x215bcb['model'],qs[_0xdf74('0x35')](_0x1fb104[_0xdf74('0x30')][_0xdf74('0x35')]));_0x5940d3[_0xdf74('0x33')]=_0x5940d3[_0xdf74('0x33')][_0xdf74('0x36')]?_0x5940d3['attributes']:_0x215bcb[_0xdf74('0x2e')];if(_0x1fb104[_0xdf74('0x30')][_0xdf74('0x47')]){_0x5940d3[_0xdf74('0x41')]=[{'all':!![]}];}_0x5940d3=_['merge']({},_0x5940d3,_0x1fb104['options']);return db[_0xdf74('0x40')][_0xdf74('0x48')](_0x5940d3)[_0xdf74('0x25')](handleEntityNotFound(_0x11d80c,null))['then'](respondWithResult(_0x11d80c,null))[_0xdf74('0x43')](handleError(_0x11d80c,null));};exports[_0xdf74('0x49')]=function(_0x2888fd,_0x31f67d){return db[_0xdf74('0x40')][_0xdf74('0x49')](_0x2888fd[_0xdf74('0x4a')],{})[_0xdf74('0x25')](function(_0x536864){var _0x451423=_0x2888fd[_0xdf74('0x4b')][_0xdf74('0x4c')]({'plain':!![]});if(!_0x451423)throw new Error(_0xdf74('0x4d'));if(_0x451423['role']===_0xdf74('0x4b')){var _0x30dd2e=_0x536864[_0xdf74('0x4c')]({'plain':!![]});var _0x1f7253=_0xdf74('0x26');return db[_0xdf74('0x4e')][_0xdf74('0x48')]({'where':{'name':_0x1f7253,'userProfileId':_0x451423[_0xdf74('0x4f')]},'raw':!![]})['then'](function(_0x3edc68){if(_0x3edc68&&_0x3edc68['autoAssociation']===0x0){return db[_0xdf74('0x27')][_0xdf74('0x49')]({'name':_0x30dd2e[_0xdf74('0x2a')],'resourceId':_0x30dd2e['id'],'type':_0x3edc68[_0xdf74('0x2a')],'sectionId':_0x3edc68['id']},{})[_0xdf74('0x25')](function(){return _0x536864;});}else{return _0x536864;}})[_0xdf74('0x43')](function(_0x13aded){logger[_0xdf74('0x50')](_0xdf74('0x51'),_0x13aded);throw _0x13aded;});}return _0x536864;})['then'](respondWithResult(_0x31f67d,0xc9))[_0xdf74('0x43')](handleError(_0x31f67d,null));};exports[_0xdf74('0x52')]=function(_0x529ef3,_0x5a94a8){if(_0x529ef3[_0xdf74('0x4a')]['id']){delete _0x529ef3[_0xdf74('0x4a')]['id'];}return db[_0xdf74('0x40')][_0xdf74('0x48')]({'where':{'id':_0x529ef3[_0xdf74('0x45')]['id']}})[_0xdf74('0x25')](handleEntityNotFound(_0x5a94a8,null))['then'](saveUpdates(_0x529ef3[_0xdf74('0x4a')],null))[_0xdf74('0x25')](respondWithResult(_0x5a94a8,null))['catch'](handleError(_0x5a94a8,null));};exports['destroy']=function(_0x3707d8,_0x4f30c0){return db[_0xdf74('0x40')][_0xdf74('0x48')]({'where':{'id':_0x3707d8[_0xdf74('0x45')]['id']}})[_0xdf74('0x25')](handleEntityNotFound(_0x4f30c0,null))[_0xdf74('0x25')](removeEntity(_0x4f30c0,null))['catch'](handleError(_0x4f30c0,null));}; \ No newline at end of file +var _0xc677=['set','Content-Range','save','then','get','Dispositions','UserProfileResource','error','stack','name','send','Disposition','rawAttributes','fieldName','model','map','keys','query','intersection','fields','attributes','length','nolimit','sort','filters','pick','filter','merge','type','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count'];(function(_0x4faa83,_0x12ba35){var _0x572aa7=function(_0x2ee8b8){while(--_0x2ee8b8){_0x4faa83['push'](_0x4faa83['shift']());}};_0x572aa7(++_0x12ba35);}(_0xc677,0x16c));var _0x7c67=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc677[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c67('0x0'));var zipdir=require(_0x7c67('0x1'));var jsonpatch=require(_0x7c67('0x2'));var rp=require(_0x7c67('0x3'));var moment=require(_0x7c67('0x4'));var BPromise=require(_0x7c67('0x5'));var Mustache=require(_0x7c67('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7c67('0x7'));var fs=require('fs');var fs_extra=require(_0x7c67('0x8'));var _=require('lodash');var squel=require(_0x7c67('0x9'));var crypto=require('crypto');var jsforce=require(_0x7c67('0xa'));var deskjs=require('desk.js');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(_0x7c67('0x11'));var hardwareService=require(_0x7c67('0x12'));var logger=require(_0x7c67('0x13'))(_0x7c67('0x14'));var utils=require(_0x7c67('0x15'));var config=require(_0x7c67('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c67('0x17'))['db'];function respondWithStatusCode(_0x449661,_0x26fa55){_0x26fa55=_0x26fa55||0xcc;return function(_0x52f65b){if(_0x52f65b){return _0x449661[_0x7c67('0x18')](_0x26fa55);}return _0x449661['status'](_0x26fa55)['end']();};}function respondWithResult(_0x31355e,_0x2935eb){_0x2935eb=_0x2935eb||0xc8;return function(_0x3bf387){if(_0x3bf387){return _0x31355e[_0x7c67('0x19')](_0x2935eb)[_0x7c67('0x1a')](_0x3bf387);}};}function respondWithFilteredResult(_0x3c21c9,_0xd9743c){return function(_0x3a01ad){if(_0x3a01ad){var _0x336bb3=typeof _0xd9743c[_0x7c67('0x1b')]==='undefined'&&typeof _0xd9743c[_0x7c67('0x1c')]===_0x7c67('0x1d');var _0x2a4936=_0x3a01ad[_0x7c67('0x1e')];var _0x35d227=_0x336bb3?0x0:_0xd9743c[_0x7c67('0x1b')];var _0x197de0=_0x336bb3?_0x3a01ad[_0x7c67('0x1e')]:_0xd9743c[_0x7c67('0x1b')]+_0xd9743c[_0x7c67('0x1c')];var _0x30ed2c;if(_0x197de0>=_0x2a4936){_0x197de0=_0x2a4936;_0x30ed2c=0xc8;}else{_0x30ed2c=0xce;}_0x3c21c9[_0x7c67('0x19')](_0x30ed2c);return _0x3c21c9[_0x7c67('0x1f')](_0x7c67('0x20'),_0x35d227+'-'+_0x197de0+'/'+_0x2a4936)[_0x7c67('0x1a')](_0x3a01ad);}return null;};}function patchUpdates(_0x271f4e){return function(_0x307bd0){try{jsonpatch['apply'](_0x307bd0,_0x271f4e,!![]);}catch(_0x17d523){return BPromise['reject'](_0x17d523);}return _0x307bd0[_0x7c67('0x21')]();};}function saveUpdates(_0x1a05aa,_0x2af1fd){return function(_0x3f19ce){if(_0x3f19ce){return _0x3f19ce['update'](_0x1a05aa)['then'](function(_0x35b9c8){return _0x35b9c8;});}return null;};}function removeEntity(_0x11170e,_0x42a3d3){return function(_0x5ebfaf){if(_0x5ebfaf){return _0x5ebfaf['destroy']()[_0x7c67('0x22')](function(){var _0x32ffb8=_0x5ebfaf[_0x7c67('0x23')]({'plain':!![]});var _0x670d50=_0x7c67('0x24');return db[_0x7c67('0x25')]['destroy']({'where':{'type':_0x670d50,'resourceId':_0x32ffb8['id']}})[_0x7c67('0x22')](function(){return _0x5ebfaf;});})[_0x7c67('0x22')](function(){_0x11170e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4b51,_0x5b93d6){return function(_0x2b0c0f){if(!_0x2b0c0f){_0x4c4b51['sendStatus'](0x194);}return _0x2b0c0f;};}function handleError(_0x9c9a9a,_0x1aa109){_0x1aa109=_0x1aa109||0x1f4;return function(_0x2d67d5){logger[_0x7c67('0x26')](_0x2d67d5[_0x7c67('0x27')]);if(_0x2d67d5['name']){delete _0x2d67d5[_0x7c67('0x28')];}_0x9c9a9a[_0x7c67('0x19')](_0x1aa109)[_0x7c67('0x29')](_0x2d67d5);};}exports['index']=function(_0x370c7a,_0x207846){var _0x556535={},_0x322d21={},_0x22679b={'count':0x0,'rows':[]};var _0x5bbbc7=_['map'](db[_0x7c67('0x2a')][_0x7c67('0x2b')],function(_0x4b2b3e){return{'name':_0x4b2b3e[_0x7c67('0x2c')],'type':_0x4b2b3e['type']['key']};});_0x322d21[_0x7c67('0x2d')]=_[_0x7c67('0x2e')](_0x5bbbc7,_0x7c67('0x28'));_0x322d21['query']=_[_0x7c67('0x2f')](_0x370c7a[_0x7c67('0x30')]);_0x322d21['filters']=_[_0x7c67('0x31')](_0x322d21[_0x7c67('0x2d')],_0x322d21[_0x7c67('0x30')]);_0x556535['attributes']=_[_0x7c67('0x31')](_0x322d21[_0x7c67('0x2d')],qs[_0x7c67('0x32')](_0x370c7a[_0x7c67('0x30')][_0x7c67('0x32')]));_0x556535[_0x7c67('0x33')]=_0x556535[_0x7c67('0x33')][_0x7c67('0x34')]?_0x556535[_0x7c67('0x33')]:_0x322d21['model'];if(!_0x370c7a[_0x7c67('0x30')]['hasOwnProperty'](_0x7c67('0x35'))){_0x556535[_0x7c67('0x1c')]=qs['limit'](_0x370c7a[_0x7c67('0x30')][_0x7c67('0x1c')]);_0x556535[_0x7c67('0x1b')]=qs['offset'](_0x370c7a['query'][_0x7c67('0x1b')]);}_0x556535['order']=qs[_0x7c67('0x36')](_0x370c7a['query'][_0x7c67('0x36')]);_0x556535['where']=qs[_0x7c67('0x37')](_[_0x7c67('0x38')](_0x370c7a[_0x7c67('0x30')],_0x322d21['filters']),_0x5bbbc7);if(_0x370c7a[_0x7c67('0x30')][_0x7c67('0x39')]){_0x556535['where']=_[_0x7c67('0x3a')](_0x556535['where'],{'$or':_[_0x7c67('0x2e')](_0x5bbbc7,function(_0x2cc538){if(_0x2cc538[_0x7c67('0x3b')]!=='VIRTUAL'){var _0x449724={};_0x449724[_0x2cc538[_0x7c67('0x28')]]={'$like':'%'+_0x370c7a['query'][_0x7c67('0x39')]+'%'};return _0x449724;}})});}_0x556535=_['merge']({},_0x556535,_0x370c7a[_0x7c67('0x3c')]);var _0x2e1908={'where':_0x556535[_0x7c67('0x3d')]};return db[_0x7c67('0x2a')]['count'](_0x2e1908)[_0x7c67('0x22')](function(_0x36d344){_0x22679b['count']=_0x36d344;if(_0x370c7a[_0x7c67('0x30')][_0x7c67('0x3e')]){_0x556535[_0x7c67('0x3f')]=[{'all':!![]}];}return db[_0x7c67('0x2a')][_0x7c67('0x40')](_0x556535);})[_0x7c67('0x22')](function(_0x45da99){_0x22679b[_0x7c67('0x41')]=_0x45da99;return _0x22679b;})[_0x7c67('0x22')](respondWithFilteredResult(_0x207846,_0x556535))[_0x7c67('0x42')](handleError(_0x207846,null));};exports[_0x7c67('0x43')]=function(_0x3fb623,_0x1b809e){var _0x56bc95={'raw':!![],'where':{'id':_0x3fb623[_0x7c67('0x44')]['id']}},_0x5a52fa={};_0x5a52fa[_0x7c67('0x2d')]=_[_0x7c67('0x2f')](db['Disposition'][_0x7c67('0x2b')]);_0x5a52fa[_0x7c67('0x30')]=_['keys'](_0x3fb623[_0x7c67('0x30')]);_0x5a52fa[_0x7c67('0x37')]=_[_0x7c67('0x31')](_0x5a52fa[_0x7c67('0x2d')],_0x5a52fa[_0x7c67('0x30')]);_0x56bc95['attributes']=_['intersection'](_0x5a52fa['model'],qs[_0x7c67('0x32')](_0x3fb623[_0x7c67('0x30')][_0x7c67('0x32')]));_0x56bc95[_0x7c67('0x33')]=_0x56bc95['attributes'][_0x7c67('0x34')]?_0x56bc95[_0x7c67('0x33')]:_0x5a52fa[_0x7c67('0x2d')];if(_0x3fb623[_0x7c67('0x30')]['includeAll']){_0x56bc95[_0x7c67('0x3f')]=[{'all':!![]}];}_0x56bc95=_[_0x7c67('0x3a')]({},_0x56bc95,_0x3fb623[_0x7c67('0x3c')]);return db[_0x7c67('0x2a')][_0x7c67('0x45')](_0x56bc95)['then'](handleEntityNotFound(_0x1b809e,null))[_0x7c67('0x22')](respondWithResult(_0x1b809e,null))[_0x7c67('0x42')](handleError(_0x1b809e,null));};exports[_0x7c67('0x46')]=function(_0x1e07bf,_0x26e374){return db[_0x7c67('0x2a')][_0x7c67('0x46')](_0x1e07bf[_0x7c67('0x47')],{})['then'](function(_0x1236c2){var _0x168ab0=_0x1e07bf[_0x7c67('0x48')]['get']({'plain':!![]});if(!_0x168ab0)throw new Error(_0x7c67('0x49'));if(_0x168ab0[_0x7c67('0x4a')]===_0x7c67('0x48')){var _0x1b766d=_0x1236c2[_0x7c67('0x23')]({'plain':!![]});var _0xe78106='Dispositions';return db['UserProfileSection'][_0x7c67('0x45')]({'where':{'name':_0xe78106,'userProfileId':_0x168ab0['userProfileId']},'raw':!![]})[_0x7c67('0x22')](function(_0x52c85d){if(_0x52c85d&&_0x52c85d[_0x7c67('0x4b')]===0x0){return db[_0x7c67('0x25')][_0x7c67('0x46')]({'name':_0x1b766d[_0x7c67('0x28')],'resourceId':_0x1b766d['id'],'type':_0x52c85d['name'],'sectionId':_0x52c85d['id']},{})['then'](function(){return _0x1236c2;});}else{return _0x1236c2;}})[_0x7c67('0x42')](function(_0x337062){logger['error'](_0x7c67('0x4c'),_0x337062);throw _0x337062;});}return _0x1236c2;})[_0x7c67('0x22')](respondWithResult(_0x26e374,0xc9))['catch'](handleError(_0x26e374,null));};exports[_0x7c67('0x4d')]=function(_0x21bbac,_0x2226b7){if(_0x21bbac['body']['id']){delete _0x21bbac[_0x7c67('0x47')]['id'];}return db['Disposition']['find']({'where':{'id':_0x21bbac[_0x7c67('0x44')]['id']}})['then'](handleEntityNotFound(_0x2226b7,null))[_0x7c67('0x22')](saveUpdates(_0x21bbac[_0x7c67('0x47')],null))[_0x7c67('0x22')](respondWithResult(_0x2226b7,null))[_0x7c67('0x42')](handleError(_0x2226b7,null));};exports[_0x7c67('0x4e')]=function(_0x1f0d0b,_0xa05882){return db[_0x7c67('0x2a')]['find']({'where':{'id':_0x1f0d0b[_0x7c67('0x44')]['id']}})[_0x7c67('0x22')](handleEntityNotFound(_0xa05882,null))[_0x7c67('0x22')](removeEntity(_0xa05882,null))[_0x7c67('0x42')](handleError(_0xa05882,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ce33841..fac226d 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 _0x11b6=['name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./disposition.attributes','Disposition','tools_dispositions','name_voice','name','name_chat','MailAccountId','name_sms','name_fax','FaxAccountId'];(function(_0x1726e1,_0x1cc1f4){var _0x44eccc=function(_0x29d671){while(--_0x29d671){_0x1726e1['push'](_0x1726e1['shift']());}};_0x44eccc(++_0x1cc1f4);}(_0x11b6,0x107));var _0x611b=function(_0x3a0ed6,_0x776939){_0x3a0ed6=_0x3a0ed6-0x0;var _0x446ca=_0x11b6[_0x3a0ed6];return _0x446ca;};'use strict';var _=require(_0x611b('0x0'));var util=require('util');var logger=require(_0x611b('0x1'))(_0x611b('0x2'));var moment=require(_0x611b('0x3'));var BPromise=require('bluebird');var rp=require(_0x611b('0x4'));var fs=require('fs');var path=require(_0x611b('0x5'));var rimraf=require(_0x611b('0x6'));var config=require('../../config/environment');var attributes=require(_0x611b('0x7'));module['exports']=function(_0x2c5f07,_0x133224){return _0x2c5f07['define'](_0x611b('0x8'),attributes,{'tableName':_0x611b('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x611b('0xa'),'fields':[_0x611b('0xb'),'ListId']},{'unique':!![],'name':_0x611b('0xc'),'fields':[_0x611b('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x611b('0xb'),_0x611b('0xd')]},{'unique':!![],'name':_0x611b('0xe'),'fields':[_0x611b('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x611b('0xf'),'fields':[_0x611b('0xb'),_0x611b('0x10')]},{'unique':!![],'name':_0x611b('0x11'),'fields':[_0x611b('0xb'),_0x611b('0x12')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x611b('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01e2=['define','tools_dispositions','name_voice','ListId','name_chat','name','MailAccountId','name_sms','name_openchannel','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0x3eb44f,_0x404ba0){var _0x55d6b2=function(_0x42712d){while(--_0x42712d){_0x3eb44f['push'](_0x3eb44f['shift']());}};_0x55d6b2(++_0x404ba0);}(_0x01e2,0x173));var _0x201e=function(_0x11434c,_0x36f890){_0x11434c=_0x11434c-0x0;var _0x4e5f16=_0x01e2[_0x11434c];return _0x4e5f16;};'use strict';var _=require('lodash');var util=require(_0x201e('0x0'));var logger=require(_0x201e('0x1'))(_0x201e('0x2'));var moment=require(_0x201e('0x3'));var BPromise=require('bluebird');var rp=require(_0x201e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x201e('0x5'));var config=require(_0x201e('0x6'));var attributes=require(_0x201e('0x7'));module[_0x201e('0x8')]=function(_0xcedbb5,_0x440ef3){return _0xcedbb5[_0x201e('0x9')]('Disposition',attributes,{'tableName':_0x201e('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x201e('0xb'),'fields':['name',_0x201e('0xc')]},{'unique':!![],'name':_0x201e('0xd'),'fields':[_0x201e('0xe'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x201e('0xe'),_0x201e('0xf')]},{'unique':!![],'name':_0x201e('0x10'),'fields':['name','SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name','FaxAccountId']},{'unique':!![],'name':_0x201e('0x11'),'fields':[_0x201e('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0x201e('0x12'),'fields':[_0x201e('0xe'),_0x201e('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 6433b0d..1689d80 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(_0x1a295f,_0x46ec4f){var _0x546c52=function(_0x2c837f){while(--_0x2c837f){_0x1a295f['push'](_0x1a295f['shift']());}};_0x546c52(++_0x46ec4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x1e3072,_0x2a4b2d){var _0x17ceb5=function(_0x558e2d){while(--_0x558e2d){_0x1e3072['push'](_0x1e3072['shift']());}};_0x17ceb5(++_0x2a4b2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 8ba4751..0658353 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 _0xd884=['isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get'];(function(_0x2697e2,_0x25afe9){var _0x5355c4=function(_0x1bc9dc){while(--_0x1bc9dc){_0x2697e2['push'](_0x2697e2['shift']());}};_0x5355c4(++_0x25afe9);}(_0xd884,0x14b));var _0x4d88=function(_0x461e0f,_0x372b1a){_0x461e0f=_0x461e0f-0x0;var _0x290778=_0xd884[_0x461e0f];return _0x290778;};'use strict';var multer=require(_0x4d88('0x0'));var util=require(_0x4d88('0x1'));var path=require(_0x4d88('0x2'));var timeout=require(_0x4d88('0x3'));var express=require(_0x4d88('0x4'));var router=express[_0x4d88('0x5')]();var fs_extra=require(_0x4d88('0x6'));var auth=require(_0x4d88('0x7'));var interaction=require(_0x4d88('0x8'));var config=require('../../config/environment');var controller=require(_0x4d88('0x9'));router[_0x4d88('0xa')]('/',auth[_0x4d88('0xb')](),controller[_0x4d88('0xc')]);router['get'](_0x4d88('0xd'),auth[_0x4d88('0xb')](),controller['show']);router[_0x4d88('0xe')]('/',auth[_0x4d88('0xb')](),controller[_0x4d88('0xf')]);router[_0x4d88('0x10')](_0x4d88('0xd'),auth[_0x4d88('0xb')](),controller[_0x4d88('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4d88('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf697=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout'];(function(_0x1ac0f9,_0x3c885a){var _0x172349=function(_0x21b5f7){while(--_0x21b5f7){_0x1ac0f9['push'](_0x1ac0f9['shift']());}};_0x172349(++_0x3c885a);}(_0xf697,0xe2));var _0x7f69=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0xf697[_0xbb14db];return _0x36bed7;};'use strict';var multer=require(_0x7f69('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7f69('0x1'));var express=require(_0x7f69('0x2'));var router=express[_0x7f69('0x3')]();var fs_extra=require(_0x7f69('0x4'));var auth=require(_0x7f69('0x5'));var interaction=require(_0x7f69('0x6'));var config=require(_0x7f69('0x7'));var controller=require('./disposition.controller');router[_0x7f69('0x8')]('/',auth[_0x7f69('0x9')](),controller[_0x7f69('0xa')]);router[_0x7f69('0x8')](_0x7f69('0xb'),auth[_0x7f69('0x9')](),controller[_0x7f69('0xc')]);router[_0x7f69('0xd')]('/',auth[_0x7f69('0x9')](),controller[_0x7f69('0xe')]);router[_0x7f69('0xf')](_0x7f69('0xb'),auth[_0x7f69('0x9')](),controller[_0x7f69('0x10')]);router[_0x7f69('0x11')](_0x7f69('0xb'),auth[_0x7f69('0x9')](),controller['destroy']);module[_0x7f69('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 21a755f..45a1b1e 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 _0x4559=['SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','ENUM','yes','xCALLY\x20Motion\x20Fax','STRING','localstationid','2400','4800','9600','12000','14400','7200','INTEGER','IAX','DADHI','KHOMP'];(function(_0x4c0f80,_0x5e8b52){var _0x432c4a=function(_0xc63e62){while(--_0xc63e62){_0x4c0f80['push'](_0x4c0f80['shift']());}};_0x432c4a(++_0x5e8b52);}(_0x4559,0x13f));var _0x9455=function(_0x26d4ca,_0xa2b4a0){_0x26d4ca=_0x26d4ca-0x0;var _0x5583f9=_0x4559[_0x26d4ca];return _0x5583f9;};'use strict';var Sequelize=require(_0x9455('0x0'));module[_0x9455('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x9455('0x2')](_0x9455('0x3'),'no'),'defaultValue':_0x9455('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x9455('0x4')},'localstationid':{'type':Sequelize[_0x9455('0x5')],'unique':_0x9455('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x9455('0x7'),_0x9455('0x8'),'7200',_0x9455('0x9'),_0x9455('0xa'),_0x9455('0xb')),'defaultValue':_0x9455('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x9455('0x7'),_0x9455('0x8'),_0x9455('0xc'),'9600',_0x9455('0xa'),_0x9455('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x9455('0x5')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9455('0x5')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9455('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9455('0x2')]('SIP',_0x9455('0xe'),_0x9455('0xf'),_0x9455('0x10')),'defaultValue':_0x9455('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9455('0x12')],'defaultValue':function(){return _0x9455('0x13');}},'notificationSound':{'type':Sequelize[_0x9455('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9455('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9455('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9455('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9455('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9455('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x9455('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xf02a5d){if(!_0xf02a5d)this[_0x9455('0x16')]('mandatoryDispositionPauseId',null);this[_0x9455('0x16')](_0x9455('0x17'),_0xf02a5d);}}}; \ No newline at end of file +var _0xeea1=['ENUM','yes','2400','4800','9600','12000','14400','7200','INTEGER','SIP','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','sequelize','exports','STRING'];(function(_0x38b18f,_0x5f5a8b){var _0x13e572=function(_0x135002){while(--_0x135002){_0x38b18f['push'](_0x38b18f['shift']());}};_0x13e572(++_0x5f5a8b);}(_0xeea1,0xd9));var _0x1eea=function(_0x52d1ea,_0x26038c){_0x52d1ea=_0x52d1ea-0x0;var _0x23f1d8=_0xeea1[_0x52d1ea];return _0x23f1d8;};'use strict';var Sequelize=require(_0x1eea('0x0'));module[_0x1eea('0x1')]={'name':{'type':Sequelize[_0x1eea('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x1eea('0x3')]('yes','no'),'defaultValue':_0x1eea('0x4')},'headerinfo':{'type':Sequelize[_0x1eea('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x1eea('0x3')](_0x1eea('0x5'),_0x1eea('0x6'),'7200',_0x1eea('0x7'),_0x1eea('0x8'),_0x1eea('0x9')),'defaultValue':_0x1eea('0x6')},'maxrate':{'type':Sequelize[_0x1eea('0x3')](_0x1eea('0x5'),_0x1eea('0x6'),_0x1eea('0xa'),'9600',_0x1eea('0x8'),'14400'),'defaultValue':_0x1eea('0x9')},'modem':{'type':Sequelize[_0x1eea('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1eea('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1eea('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1eea('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1eea('0x3')](_0x1eea('0xc'),'IAX',_0x1eea('0xd'),_0x1eea('0xe')),'defaultValue':_0x1eea('0xc')},'key':{'type':Sequelize[_0x1eea('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1eea('0xf');}},'notificationSound':{'type':Sequelize[_0x1eea('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1eea('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1eea('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1eea('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1eea('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1eea('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1eea('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1eea('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x1eea('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x1eea('0x10')],'defaultValue':![],'comment':_0x1eea('0x12'),'set':function(_0x274b1b){if(!_0x274b1b)this[_0x1eea('0x13')](_0x1eea('0x14'),null);this[_0x1eea('0x13')](_0x1eea('0x15'),_0x274b1b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index be9c020..51da79c 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 _0x9c8a=['sendStatus','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','json','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','transaction','VoiceExtension','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./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','error','message','result','catch','status','end','offset','undefined','count','set','Content-Range','update','destroy','get','FaxAccounts','UserProfileResource'];(function(_0x39d5fb,_0x242be0){var _0x8d1c7c=function(_0x431b85){while(--_0x431b85){_0x39d5fb['push'](_0x39d5fb['shift']());}};_0x8d1c7c(++_0x242be0);}(_0x9c8a,0x91));var _0xa9c8=function(_0x20091f,_0x522518){_0x20091f=_0x20091f-0x0;var _0x28f946=_0x9c8a[_0x20091f];return _0x28f946;};'use strict';var emlformat=require(_0xa9c8('0x0'));var rimraf=require(_0xa9c8('0x1'));var zipdir=require(_0xa9c8('0x2'));var jsonpatch=require(_0xa9c8('0x3'));var rp=require(_0xa9c8('0x4'));var moment=require(_0xa9c8('0x5'));var BPromise=require(_0xa9c8('0x6'));var Mustache=require(_0xa9c8('0x7'));var util=require(_0xa9c8('0x8'));var path=require(_0xa9c8('0x9'));var sox=require(_0xa9c8('0xa'));var csv=require(_0xa9c8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c8('0xc'));var _=require('lodash');var squel=require(_0xa9c8('0xd'));var crypto=require(_0xa9c8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa9c8('0xf'));var toCsv=require(_0xa9c8('0xb'));var querystring=require('querystring');var Papa=require(_0xa9c8('0x10'));var Redis=require(_0xa9c8('0x11'));var authService=require(_0xa9c8('0x12'));var qs=require(_0xa9c8('0x13'));var as=require(_0xa9c8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9c8('0x15'));var utils=require(_0xa9c8('0x16'));var config=require(_0xa9c8('0x17'));var licenseUtil=require(_0xa9c8('0x18'));var db=require(_0xa9c8('0x19'))['db'];config['redis']=_[_0xa9c8('0x1a')](config['redis'],{'host':_0xa9c8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9c8('0x1c')]));require(_0xa9c8('0x1d'))['register'](socket);var jayson=require(_0xa9c8('0x1e'));var client=jayson[_0xa9c8('0x1f')][_0xa9c8('0x20')]({'port':0x232c});var client9002=jayson[_0xa9c8('0x1f')][_0xa9c8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5f142a,_0x2cb9aa,_0x58e7bd,_0x35bcfc){return new BPromise(function(_0x35e46a,_0x442d9b){var _0x3fb432=_0x35bcfc||client;return _0x3fb432[_0xa9c8('0x21')](_0x5f142a,_0x58e7bd)[_0xa9c8('0x22')](function(_0x43e2a0){logger[_0xa9c8('0x23')](_0xa9c8('0x24'),_0x2cb9aa,_0xa9c8('0x25'));logger[_0xa9c8('0x26')](_0xa9c8('0x27'),_0x2cb9aa,_0xa9c8('0x25'),JSON[_0xa9c8('0x28')](_0x43e2a0));if(_0x43e2a0[_0xa9c8('0x29')]){if(_0x43e2a0[_0xa9c8('0x29')]['code']===0x1f4){logger[_0xa9c8('0x29')](_0xa9c8('0x24'),_0x2cb9aa,_0x43e2a0[_0xa9c8('0x29')][_0xa9c8('0x2a')]);return _0x442d9b(_0x43e2a0[_0xa9c8('0x29')][_0xa9c8('0x2a')]);}logger[_0xa9c8('0x29')]('FaxAccount,\x20%s,\x20%s',_0x2cb9aa,_0x43e2a0['error'][_0xa9c8('0x2a')]);return _0x35e46a(_0x43e2a0['error'][_0xa9c8('0x2a')]);}else{logger[_0xa9c8('0x23')]('FaxAccount,\x20%s,\x20%s',_0x2cb9aa,_0xa9c8('0x25'));_0x35e46a(_0x43e2a0[_0xa9c8('0x2b')][_0xa9c8('0x2a')]);}})[_0xa9c8('0x2c')](function(_0x56d9e2){logger[_0xa9c8('0x29')](_0xa9c8('0x24'),_0x2cb9aa,_0x56d9e2);_0x442d9b(_0x56d9e2);});});}function respondWithStatusCode(_0x5ec973,_0x465df2){_0x465df2=_0x465df2||0xcc;return function(_0x2abb1c){if(_0x2abb1c){return _0x5ec973['sendStatus'](_0x465df2);}return _0x5ec973[_0xa9c8('0x2d')](_0x465df2)[_0xa9c8('0x2e')]();};}function respondWithResult(_0x11d451,_0x28049f){_0x28049f=_0x28049f||0xc8;return function(_0x1091c8){if(_0x1091c8){return _0x11d451[_0xa9c8('0x2d')](_0x28049f)['json'](_0x1091c8);}};}function respondWithFilteredResult(_0x490bda,_0x4ec5b3){return function(_0x33eeed){if(_0x33eeed){var _0x4a0eca=typeof _0x4ec5b3[_0xa9c8('0x2f')]==='undefined'&&typeof _0x4ec5b3['limit']===_0xa9c8('0x30');var _0x8ac3c8=_0x33eeed[_0xa9c8('0x31')];var _0x20e6d3=_0x4a0eca?0x0:_0x4ec5b3[_0xa9c8('0x2f')];var _0x22ae7b=_0x4a0eca?_0x33eeed[_0xa9c8('0x31')]:_0x4ec5b3[_0xa9c8('0x2f')]+_0x4ec5b3['limit'];var _0x2cf156;if(_0x22ae7b>=_0x8ac3c8){_0x22ae7b=_0x8ac3c8;_0x2cf156=0xc8;}else{_0x2cf156=0xce;}_0x490bda[_0xa9c8('0x2d')](_0x2cf156);return _0x490bda[_0xa9c8('0x32')](_0xa9c8('0x33'),_0x20e6d3+'-'+_0x22ae7b+'/'+_0x8ac3c8)['json'](_0x33eeed);}return null;};}function patchUpdates(_0x4a5cd3){return function(_0x1220ca){try{jsonpatch['apply'](_0x1220ca,_0x4a5cd3,!![]);}catch(_0x121222){return BPromise['reject'](_0x121222);}return _0x1220ca['save']();};}function saveUpdates(_0x324c38,_0x324371){return function(_0x5a51e7){if(_0x5a51e7){return _0x5a51e7[_0xa9c8('0x34')](_0x324c38)[_0xa9c8('0x22')](function(_0x258055){return _0x258055;});}return null;};}function removeEntity(_0x5088a8,_0x51e9ab){return function(_0x1092a0){if(_0x1092a0){return _0x1092a0[_0xa9c8('0x35')]()[_0xa9c8('0x22')](function(){var _0x2bfd4d=_0x1092a0[_0xa9c8('0x36')]({'plain':!![]});var _0x5327dc=_0xa9c8('0x37');return db[_0xa9c8('0x38')][_0xa9c8('0x35')]({'where':{'type':_0x5327dc,'resourceId':_0x2bfd4d['id']}})[_0xa9c8('0x22')](function(){return _0x1092a0;});})[_0xa9c8('0x22')](function(){_0x5088a8[_0xa9c8('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c36a4,_0x231e5d){return function(_0x44d674){if(!_0x44d674){_0x5c36a4[_0xa9c8('0x39')](0x194);}return _0x44d674;};}function handleError(_0xfc527,_0x223506){_0x223506=_0x223506||0x1f4;return function(_0x32d1f7){logger[_0xa9c8('0x29')](_0x32d1f7['stack']);if(_0x32d1f7[_0xa9c8('0x3a')]){delete _0x32d1f7[_0xa9c8('0x3a')];}_0xfc527['status'](_0x223506)['send'](_0x32d1f7);};}exports[_0xa9c8('0x3b')]=function(_0x98725d,_0x23e1ee){var _0x2159ca={'include':[{'model':db[_0xa9c8('0x3c')],'as':_0xa9c8('0x3d')}]},_0x1a7243={},_0x43a032={'count':0x0,'rows':[]};var _0x34dba5=_[_0xa9c8('0x3e')](db[_0xa9c8('0x3f')]['rawAttributes'],function(_0xe4820a){return{'name':_0xe4820a[_0xa9c8('0x40')],'type':_0xe4820a[_0xa9c8('0x41')][_0xa9c8('0x42')]};});_0x1a7243[_0xa9c8('0x43')]=_[_0xa9c8('0x3e')](_0x34dba5,'name');_0x1a7243[_0xa9c8('0x44')]=_['keys'](_0x98725d[_0xa9c8('0x44')]);_0x1a7243['filters']=_[_0xa9c8('0x45')](_0x1a7243['model'],_0x1a7243[_0xa9c8('0x44')]);_0x2159ca[_0xa9c8('0x46')]=_[_0xa9c8('0x45')](_0x1a7243[_0xa9c8('0x43')],qs[_0xa9c8('0x47')](_0x98725d['query'][_0xa9c8('0x47')]));_0x2159ca[_0xa9c8('0x46')]=_0x2159ca['attributes'][_0xa9c8('0x48')]?_0x2159ca[_0xa9c8('0x46')]:_0x1a7243[_0xa9c8('0x43')];if(!_0x98725d['query'][_0xa9c8('0x49')](_0xa9c8('0x4a'))){_0x2159ca[_0xa9c8('0x4b')]=qs['limit'](_0x98725d[_0xa9c8('0x44')][_0xa9c8('0x4b')]);_0x2159ca[_0xa9c8('0x2f')]=qs[_0xa9c8('0x2f')](_0x98725d[_0xa9c8('0x44')]['offset']);}_0x2159ca[_0xa9c8('0x4c')]=qs['sort'](_0x98725d[_0xa9c8('0x44')]['sort']);_0x2159ca[_0xa9c8('0x4d')]=qs[_0xa9c8('0x4e')](_[_0xa9c8('0x4f')](_0x98725d[_0xa9c8('0x44')],_0x1a7243['filters']),_0x34dba5);if(_0x98725d['query'][_0xa9c8('0x50')]){_0x2159ca[_0xa9c8('0x4d')]=_[_0xa9c8('0x51')](_0x2159ca[_0xa9c8('0x4d')],{'$or':_[_0xa9c8('0x3e')](_0x34dba5,function(_0x3dcf6d){if(_0x3dcf6d[_0xa9c8('0x41')]!=='VIRTUAL'){var _0x3a31d4={};_0x3a31d4[_0x3dcf6d[_0xa9c8('0x3a')]]={'$like':'%'+_0x98725d[_0xa9c8('0x44')][_0xa9c8('0x50')]+'%'};return _0x3a31d4;}})});}_0x2159ca=_[_0xa9c8('0x51')]({},_0x2159ca,_0x98725d[_0xa9c8('0x52')]);var _0x44c5ca={'where':_0x2159ca['where']};return db['FaxAccount'][_0xa9c8('0x31')](_0x44c5ca)[_0xa9c8('0x22')](function(_0x3ccfc1){_0x43a032[_0xa9c8('0x31')]=_0x3ccfc1;if(_0x98725d['query'][_0xa9c8('0x53')]){_0x2159ca[_0xa9c8('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0xa9c8('0x55')](_0x2159ca);})[_0xa9c8('0x22')](function(_0x9eee72){_0x43a032[_0xa9c8('0x56')]=_0x9eee72;return _0x43a032;})[_0xa9c8('0x22')](respondWithFilteredResult(_0x23e1ee,_0x2159ca))[_0xa9c8('0x2c')](handleError(_0x23e1ee,null));};exports[_0xa9c8('0x57')]=function(_0x4e5f9c,_0x4ab721){var _0x5b8f09={'raw':![],'where':{'id':_0x4e5f9c['params']['id']},'include':[{'model':db[_0xa9c8('0x3c')],'as':_0xa9c8('0x3d')}]},_0xda2a12={};_0xda2a12[_0xa9c8('0x43')]=_[_0xa9c8('0x58')](db[_0xa9c8('0x3f')][_0xa9c8('0x59')]);_0xda2a12[_0xa9c8('0x44')]=_[_0xa9c8('0x58')](_0x4e5f9c[_0xa9c8('0x44')]);_0xda2a12['filters']=_['intersection'](_0xda2a12[_0xa9c8('0x43')],_0xda2a12[_0xa9c8('0x44')]);_0x5b8f09['attributes']=_[_0xa9c8('0x45')](_0xda2a12[_0xa9c8('0x43')],qs['fields'](_0x4e5f9c['query'][_0xa9c8('0x47')]));_0x5b8f09[_0xa9c8('0x46')]=_0x5b8f09['attributes'][_0xa9c8('0x48')]?_0x5b8f09[_0xa9c8('0x46')]:_0xda2a12[_0xa9c8('0x43')];if(_0x4e5f9c[_0xa9c8('0x44')][_0xa9c8('0x53')]){_0x5b8f09[_0xa9c8('0x54')]=[{'all':!![]}];}_0x5b8f09=_[_0xa9c8('0x51')]({},_0x5b8f09,_0x4e5f9c['options']);return db[_0xa9c8('0x3f')]['find'](_0x5b8f09)[_0xa9c8('0x22')](handleEntityNotFound(_0x4ab721,null))[_0xa9c8('0x22')](respondWithResult(_0x4ab721,null))[_0xa9c8('0x2c')](handleError(_0x4ab721,null));};exports[_0xa9c8('0x5a')]=function(_0x382db1,_0x1bc832){return db[_0xa9c8('0x3f')]['create'](_0x382db1['body'],{})[_0xa9c8('0x22')](function(_0x20c1dc){var _0x470bcb=_0x382db1[_0xa9c8('0x5b')]['get']({'plain':!![]});if(!_0x470bcb)throw new Error(_0xa9c8('0x5c'));if(_0x470bcb[_0xa9c8('0x5d')]===_0xa9c8('0x5b')){var _0x2d901e=_0x20c1dc[_0xa9c8('0x36')]({'plain':!![]});var _0x4149eb=_0xa9c8('0x37');return db[_0xa9c8('0x5e')][_0xa9c8('0x5f')]({'where':{'name':_0x4149eb,'userProfileId':_0x470bcb[_0xa9c8('0x60')]},'raw':!![]})[_0xa9c8('0x22')](function(_0x5a9773){if(_0x5a9773&&_0x5a9773[_0xa9c8('0x61')]===0x0){return db[_0xa9c8('0x38')][_0xa9c8('0x5a')]({'name':_0x2d901e[_0xa9c8('0x3a')],'resourceId':_0x2d901e['id'],'type':_0x5a9773[_0xa9c8('0x3a')],'sectionId':_0x5a9773['id']},{})[_0xa9c8('0x22')](function(){return _0x20c1dc;});}else{return _0x20c1dc;}})[_0xa9c8('0x2c')](function(_0x32f737){logger[_0xa9c8('0x29')](_0xa9c8('0x62'),_0x32f737);throw _0x32f737;});}return _0x20c1dc;})[_0xa9c8('0x22')](respondWithResult(_0x1bc832,0xc9))[_0xa9c8('0x2c')](handleError(_0x1bc832,null));};exports[_0xa9c8('0x34')]=function(_0x29b0b3,_0x4c4164){if(_0x29b0b3['body']['id']){delete _0x29b0b3[_0xa9c8('0x63')]['id'];}return db[_0xa9c8('0x3f')][_0xa9c8('0x5f')]({'where':{'id':_0x29b0b3[_0xa9c8('0x64')]['id']},'include':[{'model':db[_0xa9c8('0x3c')],'as':_0xa9c8('0x3d')}]})[_0xa9c8('0x22')](handleEntityNotFound(_0x4c4164,null))[_0xa9c8('0x22')](saveUpdates(_0x29b0b3[_0xa9c8('0x63')],null))['then'](respondWithResult(_0x4c4164,null))['catch'](handleError(_0x4c4164,null));};exports[_0xa9c8('0x35')]=function(_0x5bfb78,_0x14fc39){return db[_0xa9c8('0x3f')][_0xa9c8('0x5f')]({'where':{'id':_0x5bfb78[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x14fc39,null))['then'](removeEntity(_0x14fc39,null))[_0xa9c8('0x2c')](handleError(_0x14fc39,null));};exports[_0xa9c8('0x65')]=function(_0x1fa78d,_0x2a23fc){return db[_0xa9c8('0x3f')][_0xa9c8('0x65')]()[_0xa9c8('0x22')](respondWithResult(_0x2a23fc,null))['catch'](handleError(_0x2a23fc,null));};exports[_0xa9c8('0x66')]=function(_0x244e64,_0x45901c,_0x541c3a){if(_0x244e64[_0xa9c8('0x63')]['id']){delete _0x244e64[_0xa9c8('0x63')]['id'];}return db[_0xa9c8('0x3f')]['find']({'where':{'id':_0x244e64[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x45901c,null))[_0xa9c8('0x22')](function(_0xec4d07){if(_0xec4d07){_0x244e64[_0xa9c8('0x63')][_0xa9c8('0x67')]=_0xec4d07['id'];return db[_0xa9c8('0x68')][_0xa9c8('0x5a')](_0x244e64[_0xa9c8('0x63')]);}})['then'](respondWithResult(_0x45901c,null))[_0xa9c8('0x2c')](handleError(_0x45901c,null));};exports[_0xa9c8('0x69')]=function(_0x16e891,_0x1d5f43,_0x309a2e){var _0x1fcfc1={'raw':![],'where':{}};var _0x4eabe7={};var _0x16c7f7={'count':0x0,'rows':[]};return db[_0xa9c8('0x3f')][_0xa9c8('0x6a')]({'where':{'id':_0x16e891[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x1d5f43,null))[_0xa9c8('0x22')](function(_0x1525b2){if(_0x1525b2){_0x4eabe7['model']=_[_0xa9c8('0x58')](db[_0xa9c8('0x68')][_0xa9c8('0x59')]);_0x4eabe7[_0xa9c8('0x44')]=_[_0xa9c8('0x58')](_0x16e891[_0xa9c8('0x44')]);_0x4eabe7['filters']=_['intersection'](_0x4eabe7[_0xa9c8('0x43')],_0x4eabe7[_0xa9c8('0x44')]);_0x1fcfc1[_0xa9c8('0x46')]=_[_0xa9c8('0x45')](_0x4eabe7[_0xa9c8('0x43')],qs[_0xa9c8('0x47')](_0x16e891['query'][_0xa9c8('0x47')]));_0x1fcfc1[_0xa9c8('0x46')]=_0x1fcfc1[_0xa9c8('0x46')][_0xa9c8('0x48')]?_0x1fcfc1[_0xa9c8('0x46')]:_0x4eabe7[_0xa9c8('0x43')];if(!_0x16e891[_0xa9c8('0x44')][_0xa9c8('0x49')]('nolimit')){_0x1fcfc1[_0xa9c8('0x4b')]=qs[_0xa9c8('0x4b')](_0x16e891[_0xa9c8('0x44')][_0xa9c8('0x4b')]);_0x1fcfc1['offset']=qs[_0xa9c8('0x2f')](_0x16e891['query'][_0xa9c8('0x2f')]);}_0x1fcfc1[_0xa9c8('0x4c')]=qs['sort'](_0x16e891[_0xa9c8('0x44')][_0xa9c8('0x6b')]);_0x1fcfc1[_0xa9c8('0x4d')]=qs[_0xa9c8('0x4e')](_[_0xa9c8('0x4f')](_0x16e891[_0xa9c8('0x44')],_0x4eabe7[_0xa9c8('0x4e')]));_0x1fcfc1[_0xa9c8('0x4d')]['FaxAccountId']=_0x1525b2['id'];if(_0x16e891[_0xa9c8('0x44')][_0xa9c8('0x50')]){_0x1fcfc1[_0xa9c8('0x4d')]=_['merge'](_0x1fcfc1[_0xa9c8('0x4d')],{'$or':_[_0xa9c8('0x3e')](_0x1fcfc1[_0xa9c8('0x46')],function(_0x25c1dd){var _0x33ee54={};_0x33ee54[_0x25c1dd]={'$like':'%'+_0x16e891[_0xa9c8('0x44')][_0xa9c8('0x50')]+'%'};return _0x33ee54;})});}_0x1fcfc1=_[_0xa9c8('0x51')]({},_0x1fcfc1,_0x16e891['options']);return db[_0xa9c8('0x68')]['count']({'where':_0x1fcfc1[_0xa9c8('0x4d')]})[_0xa9c8('0x22')](function(_0x4c4091){_0x16c7f7[_0xa9c8('0x31')]=_0x4c4091;if(_0x16e891['query'][_0xa9c8('0x53')]){_0x1fcfc1[_0xa9c8('0x54')]=[{'all':!![]}];}return db[_0xa9c8('0x68')][_0xa9c8('0x55')](_0x1fcfc1);})['then'](function(_0x2396ce){_0x16c7f7[_0xa9c8('0x56')]=_0x2396ce;return _0x16c7f7;});}})[_0xa9c8('0x22')](respondWithFilteredResult(_0x1d5f43,_0x1fcfc1))[_0xa9c8('0x2c')](handleError(_0x1d5f43,null));};exports['removeDispositions']=function(_0x42316e,_0x60dec3,_0x14728a){return db[_0xa9c8('0x3f')][_0xa9c8('0x5f')]({'where':{'id':_0x42316e[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x60dec3,null))[_0xa9c8('0x22')](function(_0x2c821d){if(_0x2c821d){return _0x2c821d[_0xa9c8('0x6c')](_0x42316e[_0xa9c8('0x44')][_0xa9c8('0x6d')]);}})[_0xa9c8('0x22')](respondWithStatusCode(_0x60dec3,null))[_0xa9c8('0x2c')](handleError(_0x60dec3,null));};exports['addAnswer']=function(_0x433bb0,_0x3606f8,_0x1fc27d){if(_0x433bb0[_0xa9c8('0x63')]['id']){delete _0x433bb0['body']['id'];}return db[_0xa9c8('0x3f')][_0xa9c8('0x5f')]({'where':{'id':_0x433bb0[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x3606f8,null))[_0xa9c8('0x22')](function(_0x23f067){if(_0x23f067){_0x433bb0[_0xa9c8('0x63')]['FaxAccountId']=_0x23f067['id'];return db[_0xa9c8('0x6e')][_0xa9c8('0x5a')](_0x433bb0[_0xa9c8('0x63')]);}})[_0xa9c8('0x22')](respondWithResult(_0x3606f8,null))[_0xa9c8('0x2c')](handleError(_0x3606f8,null));};exports[_0xa9c8('0x6f')]=function(_0x11be5d,_0x29d53b,_0x1e9ed3){var _0x46d8e2={'raw':![],'where':{}};var _0x5509d0={};var _0x4b983a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x11be5d[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x29d53b,null))[_0xa9c8('0x22')](function(_0x470088){if(_0x470088){_0x5509d0[_0xa9c8('0x43')]=_[_0xa9c8('0x58')](db[_0xa9c8('0x6e')]['rawAttributes']);_0x5509d0[_0xa9c8('0x44')]=_[_0xa9c8('0x58')](_0x11be5d[_0xa9c8('0x44')]);_0x5509d0[_0xa9c8('0x4e')]=_[_0xa9c8('0x45')](_0x5509d0[_0xa9c8('0x43')],_0x5509d0['query']);_0x46d8e2['attributes']=_['intersection'](_0x5509d0[_0xa9c8('0x43')],qs[_0xa9c8('0x47')](_0x11be5d[_0xa9c8('0x44')][_0xa9c8('0x47')]));_0x46d8e2[_0xa9c8('0x46')]=_0x46d8e2['attributes'][_0xa9c8('0x48')]?_0x46d8e2[_0xa9c8('0x46')]:_0x5509d0[_0xa9c8('0x43')];if(!_0x11be5d['query'][_0xa9c8('0x49')]('nolimit')){_0x46d8e2[_0xa9c8('0x4b')]=qs[_0xa9c8('0x4b')](_0x11be5d[_0xa9c8('0x44')][_0xa9c8('0x4b')]);_0x46d8e2[_0xa9c8('0x2f')]=qs[_0xa9c8('0x2f')](_0x11be5d[_0xa9c8('0x44')][_0xa9c8('0x2f')]);}_0x46d8e2[_0xa9c8('0x4c')]=qs[_0xa9c8('0x6b')](_0x11be5d[_0xa9c8('0x44')][_0xa9c8('0x6b')]);_0x46d8e2[_0xa9c8('0x4d')]=qs[_0xa9c8('0x4e')](_[_0xa9c8('0x4f')](_0x11be5d['query'],_0x5509d0['filters']));_0x46d8e2['where'][_0xa9c8('0x67')]=_0x470088['id'];if(_0x11be5d[_0xa9c8('0x44')][_0xa9c8('0x50')]){_0x46d8e2[_0xa9c8('0x4d')]=_[_0xa9c8('0x51')](_0x46d8e2[_0xa9c8('0x4d')],{'$or':_['map'](_0x46d8e2['attributes'],function(_0x509096){var _0x45d4ef={};_0x45d4ef[_0x509096]={'$like':'%'+_0x11be5d['query'][_0xa9c8('0x50')]+'%'};return _0x45d4ef;})});}_0x46d8e2=_[_0xa9c8('0x51')]({},_0x46d8e2,_0x11be5d['options']);return db['CannedAnswer']['count']({'where':_0x46d8e2['where']})[_0xa9c8('0x22')](function(_0x1d813f){_0x4b983a[_0xa9c8('0x31')]=_0x1d813f;if(_0x11be5d[_0xa9c8('0x44')][_0xa9c8('0x53')]){_0x46d8e2[_0xa9c8('0x54')]=[{'all':!![]}];}return db[_0xa9c8('0x6e')]['findAll'](_0x46d8e2);})[_0xa9c8('0x22')](function(_0x15598c){_0x4b983a['rows']=_0x15598c;return _0x4b983a;});}})[_0xa9c8('0x22')](respondWithFilteredResult(_0x29d53b,_0x46d8e2))[_0xa9c8('0x2c')](handleError(_0x29d53b,null));};exports['removeAnswers']=function(_0xc0e795,_0x52b753,_0xea266f){return db[_0xa9c8('0x3f')]['find']({'where':{'id':_0xc0e795[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x52b753,null))['then'](function(_0x1aec79){if(_0x1aec79){return _0x1aec79[_0xa9c8('0x70')](_0xc0e795['query']['ids']);}})[_0xa9c8('0x22')](respondWithStatusCode(_0x52b753,null))[_0xa9c8('0x2c')](handleError(_0x52b753,null));};exports[_0xa9c8('0x71')]=function(_0x2e9f6e,_0x21a691,_0x28e879){return db['FaxInteraction']['find']({'where':{'id':_0x2e9f6e[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x21a691,null))[_0xa9c8('0x22')](function(_0x5a933b){if(_0x5a933b){return _0x5a933b['addInteraction'](_0x2e9f6e[_0xa9c8('0x63')][_0xa9c8('0x6d')],_[_0xa9c8('0x72')](_0x2e9f6e[_0xa9c8('0x63')],['ids','id'])||{});}})[_0xa9c8('0x22')](respondWithResult(_0x21a691,null))[_0xa9c8('0x2c')](handleError(_0x21a691,null));};exports[_0xa9c8('0x73')]=function(_0x837131,_0x4291c7,_0x5d8834){var _0x86ff54={'raw':![],'where':{}};var _0x4a4ea8={};var _0x592869={'count':0x0,'rows':[]};return db[_0xa9c8('0x3f')][_0xa9c8('0x6a')]({'where':{'id':_0x837131[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x4291c7,null))[_0xa9c8('0x22')](function(_0x57e00b){if(_0x57e00b){_0x4a4ea8[_0xa9c8('0x43')]=_[_0xa9c8('0x58')](db[_0xa9c8('0x74')][_0xa9c8('0x59')]);_0x4a4ea8[_0xa9c8('0x44')]=_[_0xa9c8('0x58')](_0x837131[_0xa9c8('0x44')]);_0x4a4ea8[_0xa9c8('0x4e')]=_['intersection'](_0x4a4ea8[_0xa9c8('0x43')],_0x4a4ea8['query']);_0x86ff54[_0xa9c8('0x46')]=_[_0xa9c8('0x45')](_0x4a4ea8[_0xa9c8('0x43')],qs[_0xa9c8('0x47')](_0x837131['query'][_0xa9c8('0x47')]));_0x86ff54[_0xa9c8('0x46')]=_0x86ff54[_0xa9c8('0x46')][_0xa9c8('0x48')]?_0x86ff54[_0xa9c8('0x46')]:_0x4a4ea8[_0xa9c8('0x43')];if(!_0x837131[_0xa9c8('0x44')][_0xa9c8('0x49')](_0xa9c8('0x4a'))){_0x86ff54[_0xa9c8('0x4b')]=qs[_0xa9c8('0x4b')](_0x837131['query'][_0xa9c8('0x4b')]);_0x86ff54[_0xa9c8('0x2f')]=qs[_0xa9c8('0x2f')](_0x837131['query'][_0xa9c8('0x2f')]);}_0x86ff54[_0xa9c8('0x4c')]=qs[_0xa9c8('0x6b')](_0x837131['query'][_0xa9c8('0x6b')]);_0x86ff54['where']=qs[_0xa9c8('0x4e')](_['pick'](_0x837131[_0xa9c8('0x44')],_0x4a4ea8[_0xa9c8('0x4e')]));_0x86ff54[_0xa9c8('0x4d')]['FaxAccountId']=_0x57e00b['id'];if(_0x837131[_0xa9c8('0x44')][_0xa9c8('0x50')]){_0x86ff54[_0xa9c8('0x4d')]=_[_0xa9c8('0x51')](_0x86ff54['where'],{'$or':_['map'](_0x86ff54[_0xa9c8('0x46')],function(_0x5429b0){var _0xd9ea9e={};_0xd9ea9e[_0x5429b0]={'$like':'%'+_0x837131['query'][_0xa9c8('0x50')]+'%'};return _0xd9ea9e;})});}_0x86ff54=_[_0xa9c8('0x51')]({},_0x86ff54,_0x837131['options']);return db[_0xa9c8('0x74')][_0xa9c8('0x31')]({'where':_0x86ff54['where']})['then'](function(_0x108a0d){_0x592869['count']=_0x108a0d;if(_0x837131[_0xa9c8('0x44')][_0xa9c8('0x53')]){_0x86ff54[_0xa9c8('0x54')]=[{'model':db[_0xa9c8('0x75')],'as':'Contact','required':![]},{'model':db[_0xa9c8('0x76')],'as':'Owner','attributes':['name','fullname',_0xa9c8('0x77')],'required':![]},{'model':db[_0xa9c8('0x78')],'as':_0xa9c8('0x79'),'attributes':['id',_0xa9c8('0x3a'),_0xa9c8('0x7a')],'where':_0x837131[_0xa9c8('0x44')][_0xa9c8('0x7b')]?{'id':_0x837131[_0xa9c8('0x44')]['tag']}:undefined,'required':_0x837131['query'][_0xa9c8('0x7b')]?!![]:![]}];}return db[_0xa9c8('0x74')][_0xa9c8('0x55')](_0x86ff54);})['then'](function(_0x52ce15){_0x592869[_0xa9c8('0x56')]=_0x52ce15;return _0x592869;});}})['then'](respondWithFilteredResult(_0x4291c7,_0x86ff54))[_0xa9c8('0x2c')](handleError(_0x4291c7,null));};exports[_0xa9c8('0x7c')]=function(_0x45438e,_0x223581){var _0x5357da=_0x45438e[_0xa9c8('0x64')]['id'];var _0x154b06=_0x45438e['body'];var _0x1034e2=0xc8;var _0x3ed95e=null;return db[_0xa9c8('0x7d')]['transaction']({'isolationLevel':db['sequelize'][_0xa9c8('0x7e')]['ISOLATION_LEVELS'][_0xa9c8('0x7f')]},function(_0x23bc5a){return db[_0xa9c8('0x3f')][_0xa9c8('0x6a')]({'where':{'id':_0x5357da},'transaction':_0x23bc5a})[_0xa9c8('0x22')](function(_0x3b93fc){if(_0x3b93fc){return db[_0xa9c8('0x80')][_0xa9c8('0x35')]({'where':{'FaxAccountId':_0x5357da},'transaction':_0x23bc5a})[_0xa9c8('0x22')](function(){var _0x3796f5=_[_0xa9c8('0x3e')](_0x154b06,function(_0x12d6f0){_0x12d6f0[_0xa9c8('0x67')]=_0x5357da;return _0x12d6f0;});return db['FaxApplication'][_0xa9c8('0x81')](_0x3796f5,{'transaction':_0x23bc5a});});}else{_0x1034e2=0x194;_0x3ed95e=[];}});})[_0xa9c8('0x22')](function(){if(_0x1034e2!==0x194){return db[_0xa9c8('0x80')][_0xa9c8('0x82')]({'where':{'FaxAccountId':_0x5357da},'order':_0xa9c8('0x83')})[_0xa9c8('0x22')](function(_0x2977b3){_0x3ed95e=_0x2977b3;});}})[_0xa9c8('0x2c')](function(_0x3c693c){_0x1034e2=0x1f4;logger[_0xa9c8('0x29')](_0x3c693c[_0xa9c8('0x84')]);if(_0x3c693c['name']){delete _0x3c693c[_0xa9c8('0x3a')];}_0x3ed95e=_0x3c693c;})[_0xa9c8('0x85')](function(){if(_0x3ed95e===null){_0x223581[_0xa9c8('0x39')](_0x1034e2);}else{if(_0x1034e2===0x1f4){_0x223581[_0xa9c8('0x2d')](_0x1034e2)['send'](_0x3ed95e);}else{_0x223581['status'](_0x1034e2)[_0xa9c8('0x86')](_0x3ed95e);}}});};exports[_0xa9c8('0x87')]=function(_0x3fdbb5,_0x18291a,_0x2c6d5a){var _0x395576={};var _0x499798={};var _0x196534;var _0x12af35;return db[_0xa9c8('0x3f')][_0xa9c8('0x6a')]({'where':{'id':_0x3fdbb5[_0xa9c8('0x64')]['id']}})[_0xa9c8('0x22')](handleEntityNotFound(_0x18291a,null))[_0xa9c8('0x22')](function(_0x24591a){if(_0x24591a){_0x196534=_0x24591a;_0x499798[_0xa9c8('0x43')]=_[_0xa9c8('0x58')](db[_0xa9c8('0x80')][_0xa9c8('0x59')]);_0x499798[_0xa9c8('0x44')]=_[_0xa9c8('0x58')](_0x3fdbb5[_0xa9c8('0x44')]);_0x499798[_0xa9c8('0x4e')]=_[_0xa9c8('0x45')](_0x499798[_0xa9c8('0x43')],_0x499798[_0xa9c8('0x44')]);_0x395576[_0xa9c8('0x46')]=_[_0xa9c8('0x45')](_0x499798[_0xa9c8('0x43')],qs[_0xa9c8('0x47')](_0x3fdbb5[_0xa9c8('0x44')]['fields']));_0x395576['attributes']=_0x395576[_0xa9c8('0x46')]['length']?_0x395576['attributes']:_0x499798['model'];_0x395576[_0xa9c8('0x4c')]=qs[_0xa9c8('0x6b')](_0x3fdbb5['query'][_0xa9c8('0x6b')]);_0x395576[_0xa9c8('0x4d')]=qs[_0xa9c8('0x4e')](_[_0xa9c8('0x4f')](_0x3fdbb5[_0xa9c8('0x44')],_0x499798['filters']));if(_0x3fdbb5[_0xa9c8('0x44')][_0xa9c8('0x50')]){_0x395576[_0xa9c8('0x4d')]=_['merge'](_0x395576[_0xa9c8('0x4d')],{'$or':_[_0xa9c8('0x3e')](_0x395576[_0xa9c8('0x46')],function(_0x2bc738){var _0x232a13={};_0x232a13[_0x2bc738]={'$like':'%'+_0x3fdbb5['query'][_0xa9c8('0x50')]+'%'};return _0x232a13;})});}_0x395576=_[_0xa9c8('0x51')]({},_0x395576,_0x3fdbb5['options']);return _0x196534[_0xa9c8('0x87')](_0x395576);}})[_0xa9c8('0x22')](function(_0x27e162){if(_0x27e162){_0x12af35=_0x27e162[_0xa9c8('0x48')];if(!_0x3fdbb5[_0xa9c8('0x44')]['hasOwnProperty'](_0xa9c8('0x4a'))){_0x395576['limit']=qs[_0xa9c8('0x4b')](_0x3fdbb5[_0xa9c8('0x44')][_0xa9c8('0x4b')]);_0x395576['offset']=qs[_0xa9c8('0x2f')](_0x3fdbb5[_0xa9c8('0x44')][_0xa9c8('0x2f')]);}return _0x196534['getApplications'](_0x395576);}})[_0xa9c8('0x22')](function(_0x49e43d){if(_0x49e43d){return _0x49e43d?{'count':_0x12af35,'rows':_0x49e43d}:null;}})[_0xa9c8('0x22')](respondWithResult(_0x18291a,null))[_0xa9c8('0x2c')](handleError(_0x18291a,null));};function Extension(_0x23a894,_0x3998ea,_0x5a6360,_0x3111c8){this[_0xa9c8('0x88')]=_0xa9c8('0x89');this[_0xa9c8('0x8a')]=_0x23a894[_0xa9c8('0x8b')];this[_0xa9c8('0x8c')]=_0x3111c8;this[_0xa9c8('0x41')]='system';this['description']=_0xa9c8('0x8d');this[_0xa9c8('0x67')]=_0x23a894['id'];this[_0xa9c8('0x83')]=_0x3998ea;this[_0xa9c8('0x8e')]=_0x5a6360;}function createExtensionsReciveFax(_0x28e939){var _0x50fd14=0x1;var _0xeb92c9=[];_0xeb92c9[_0xa9c8('0x8f')](new Extension(_0x28e939,_0x50fd14,'',_0xa9c8('0x90')));_0x50fd14+=0x1;_0xeb92c9[_0xa9c8('0x8f')](new Extension(_0x28e939,_0x50fd14,_0xa9c8('0x91'),'Set'));_0x50fd14+=0x1;for(var _0x44a990 in _0x28e939){if(_0x28e939['hasOwnProperty'](_0x44a990)&&(_0x44a990===_0xa9c8('0x92')||_0x44a990===_0xa9c8('0x8b')||_0x44a990===_0xa9c8('0x93')||_0x44a990===_0xa9c8('0x94')||_0x44a990==='headerinfo'||_0x44a990===_0xa9c8('0x95')||_0x44a990===_0xa9c8('0x96')||_0x44a990===_0xa9c8('0x97')||_0x44a990===_0xa9c8('0x98'))){_0xeb92c9[_0xa9c8('0x8f')](new Extension(_0x28e939,_0x50fd14,_0xa9c8('0x99')+_0x44a990+')='+_0x28e939[_0x44a990],_0xa9c8('0x9a')));_0x50fd14+=0x1;}}_0xeb92c9[_0xa9c8('0x8f')](new Extension(_0x28e939,_0x50fd14,'6',_0xa9c8('0x9b')));_0x50fd14+=0x1;_0xeb92c9[_0xa9c8('0x8f')](new Extension(_0x28e939,_0x50fd14,_0xa9c8('0x9c'),_0xa9c8('0x9d')));_0x50fd14=0x0;return _0xeb92c9;}exports['addAccountApplications']=function(_0x15cbd3,_0x5a45b0,_0x483fde){var _0x4929ab;return db[_0xa9c8('0x7d')][_0xa9c8('0x9e')](function(_0x40e180){return db['FaxAccount']['create'](_0x15cbd3[_0xa9c8('0x63')],{'transaction':_0x40e180})[_0xa9c8('0x22')](function(_0x1cefa7){_0x4929ab=_0x1cefa7[_0xa9c8('0x36')]({'plain':!![]});return db[_0xa9c8('0x9f')][_0xa9c8('0x81')](createExtensionsReciveFax(_0x4929ab),{'transaction':_0x40e180});});})[_0xa9c8('0x22')](function(){return _0x4929ab;})[_0xa9c8('0x22')](respondWithResult(_0x5a45b0,null))[_0xa9c8('0x2c')](handleError(_0x5a45b0,null));};exports['updateAccountApplications']=function(_0x4bf37f,_0x3b0ac6,_0x548c19){var _0xd58ab2;return db['sequelize'][_0xa9c8('0x9e')](function(_0x4a09f3){return db['FaxAccount'][_0xa9c8('0x34')](_0x4bf37f['body'],{'where':{'id':_0x4bf37f[_0xa9c8('0x63')]['id']},'transaction':_0x4a09f3})[_0xa9c8('0x22')](function(_0x480301){return db[_0xa9c8('0x9f')][_0xa9c8('0x35')]({'where':{'FaxAccountId':_0x4bf37f[_0xa9c8('0x63')]['id']},'transaction':_0x4a09f3})[_0xa9c8('0x22')](function(_0x1bee18){return db[_0xa9c8('0x9f')][_0xa9c8('0x81')](createExtensionsReciveFax(_['omit'](_0x4bf37f['body'],['tech',_0xa9c8('0x42'),_0xa9c8('0xa0'),'updatedAt',_0xa9c8('0xa1'),_0xa9c8('0xa2')])),{'transaction':_0x4a09f3});});});})[_0xa9c8('0x22')](function(){return db[_0xa9c8('0x3f')][_0xa9c8('0xa3')](_0x4bf37f[_0xa9c8('0x63')]['id']);})[_0xa9c8('0x22')](respondWithResult(_0x3b0ac6,null))[_0xa9c8('0x2c')](handleError(_0x3b0ac6,null));};exports[_0xa9c8('0xa4')]=function(_0x329d45,_0x109ffd,_0x45d142){var _0x534209={'raw':!![],'where':{}};var _0x203c40={};var _0x2d3dda={'count':0x0,'rows':[]};return db[_0xa9c8('0x3f')][_0xa9c8('0x6a')]({'where':{'id':_0x329d45['params']['id']}})['then'](handleEntityNotFound(_0x109ffd,null))[_0xa9c8('0x22')](function(_0x4e4ea4){if(_0x4e4ea4){_0x203c40[_0xa9c8('0x43')]=_[_0xa9c8('0x58')](db[_0xa9c8('0xa5')][_0xa9c8('0x59')]);_0x203c40[_0xa9c8('0x44')]=_[_0xa9c8('0x58')](_0x329d45[_0xa9c8('0x44')]);_0x203c40[_0xa9c8('0x4e')]=_[_0xa9c8('0x45')](_0x203c40[_0xa9c8('0x43')],_0x203c40[_0xa9c8('0x44')]);_0x534209[_0xa9c8('0x46')]=_['intersection'](_0x203c40[_0xa9c8('0x43')],qs[_0xa9c8('0x47')](_0x329d45[_0xa9c8('0x44')][_0xa9c8('0x47')]));_0x534209[_0xa9c8('0x46')]=_0x534209['attributes'][_0xa9c8('0x48')]?_0x534209[_0xa9c8('0x46')]:_0x203c40[_0xa9c8('0x43')];if(!_0x329d45['query']['hasOwnProperty'](_0xa9c8('0x4a'))){_0x534209[_0xa9c8('0x4b')]=qs[_0xa9c8('0x4b')](_0x329d45[_0xa9c8('0x44')][_0xa9c8('0x4b')]);_0x534209[_0xa9c8('0x2f')]=qs['offset'](_0x329d45[_0xa9c8('0x44')][_0xa9c8('0x2f')]);}_0x534209['order']=qs[_0xa9c8('0x6b')](_0x329d45[_0xa9c8('0x44')][_0xa9c8('0x6b')]);_0x534209[_0xa9c8('0x4d')]=qs['filters'](_[_0xa9c8('0x4f')](_0x329d45[_0xa9c8('0x44')],_0x203c40['filters']));_0x534209[_0xa9c8('0x4d')][_0xa9c8('0x67')]=_0x4e4ea4['id'];if(_0x329d45[_0xa9c8('0x44')][_0xa9c8('0x50')]){_0x534209['where']=_[_0xa9c8('0x51')](_0x534209[_0xa9c8('0x4d')],{'$or':_[_0xa9c8('0x3e')](_0x534209[_0xa9c8('0x46')],function(_0x2a69cd){var _0xbbfd56={};_0xbbfd56[_0x2a69cd]={'$like':'%'+_0x329d45[_0xa9c8('0x44')][_0xa9c8('0x50')]+'%'};return _0xbbfd56;})});}if(_0x329d45['query'][_0xa9c8('0xa6')]){var _0x38c838=_0x329d45['query'][_0xa9c8('0xa6')][_0xa9c8('0xa7')](',');var _0xd9e366={};_0xd9e366[_0x38c838[0x0]]={'$gte':moment(_0x38c838[0x1])[_0xa9c8('0xa8')](_0xa9c8('0xa9'))};_0x534209[_0xa9c8('0x4d')]=_['merge'](_0x534209[_0xa9c8('0x4d')],_0xd9e366);}_0x534209=_[_0xa9c8('0x51')]({},_0x534209,_0x329d45[_0xa9c8('0x52')]);return db[_0xa9c8('0xa5')][_0xa9c8('0x31')]({'where':_0x534209['where']})[_0xa9c8('0x22')](function(_0x5b2fe0){_0x2d3dda[_0xa9c8('0x31')]=_0x5b2fe0;if(_0x329d45['query'][_0xa9c8('0x53')]){_0x534209[_0xa9c8('0x54')]=[{'all':!![]}];}return db[_0xa9c8('0xa5')][_0xa9c8('0x55')](_0x534209);})['then'](function(_0x4ca966){_0x2d3dda[_0xa9c8('0x56')]=_0x4ca966;return _0x2d3dda;});}})[_0xa9c8('0x22')](respondWithFilteredResult(_0x109ffd,_0x534209))['catch'](handleError(_0x109ffd,null));};exports[_0xa9c8('0xaa')]=function(_0x4ef95a,_0x11890b,_0x454233){var _0x25e314,_0xf18e27={},_0x372fe;if(_0x4ef95a[_0xa9c8('0x63')]['to']){_0x372fe=_0x4ef95a[_0xa9c8('0x63')]['to'][0x0];}return db[_0xa9c8('0x3f')][_0xa9c8('0x5f')]({'where':{'id':_0x4ef95a[_0xa9c8('0x64')]['id']},'include':[{'model':db[_0xa9c8('0xab')],'as':_0xa9c8('0xac'),'include':[{'model':db[_0xa9c8('0x75')],'as':'Contacts','where':{'fax':_0x372fe},'limit':0x1,'order':[[_0xa9c8('0xad'),_0xa9c8('0xae')]]}]}]})[_0xa9c8('0x22')](handleEntityNotFound(_0x11890b,null))[_0xa9c8('0x22')](function(_0x218254){_0x25e314=_0x218254;if(_0x4ef95a['body'][_0xa9c8('0xaf')]&&_0x4ef95a[_0xa9c8('0x63')]['attachments'][_0xa9c8('0x48')]){for(var _0x5745a8=0x0;_0x5745a8<_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][_0xa9c8('0x48')];_0x5745a8+=0x1){_0x4ef95a['body']['attachments'][_0x5745a8]={'filename':_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][_0x5745a8][_0xa9c8('0x3a')],'id':_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][_0x5745a8]['id'],'path':path[_0xa9c8('0xb0')](config[_0xa9c8('0xb1')],_0xa9c8('0xb2'),_0x4ef95a[_0xa9c8('0x63')]['attachments'][_0x5745a8][_0xa9c8('0xb3')])};}}return respondWithRpcPromise(_0xa9c8('0xb4'),'CheckAfterSend',{'FaxAccountId':_[_0xa9c8('0xb5')](_0x4ef95a['params']['id'])?undefined:_0x4ef95a[_0xa9c8('0x64')]['id'],'path':_[_0xa9c8('0xb5')](_0x4ef95a['body'][_0xa9c8('0xaf')][0x0][_0xa9c8('0x9')])?undefined:_0x4ef95a[_0xa9c8('0x63')]['attachments'][0x0][_0xa9c8('0x9')],'fax':_[_0xa9c8('0xb5')](_0x4ef95a['body']['to'][0x0])?undefined:_0x4ef95a[_0xa9c8('0x63')]['to'][0x0]},client9002);})[_0xa9c8('0x22')](function(){if(_0x25e314){if(_[_0xa9c8('0xb5')](_0x4ef95a['body'][_0xa9c8('0xb6')])){_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xb6')]=util['format'](_0xa9c8('0xb7'),_0x25e314[_0xa9c8('0x3a')],_0x25e314[_0xa9c8('0xb8')]);}if(_0x25e314[_0xa9c8('0xac')]){if(_0x25e314[_0xa9c8('0xac')][_0xa9c8('0xb9')][_0xa9c8('0x48')]){return _0x25e314[_0xa9c8('0xac')][_0xa9c8('0xb9')][0x0];}else{return db[_0xa9c8('0x75')][_0xa9c8('0x5a')](_['defaults'](_0x4ef95a[_0xa9c8('0x63')],{'firstName':_0x4ef95a['body']['to'][0x0],'phone':_0x4ef95a['body']['to'][0x0],'fax':_0x4ef95a[_0xa9c8('0x63')]['to'][0x0],'ListId':_0x25e314['ListId']}));}}else{throw new Error(_0xa9c8('0xba'));}}else{throw new Error(_0xa9c8('0xbb'));}})[_0xa9c8('0x22')](function(_0x11d73e){if(_0x11d73e){return db['FaxInteraction'][_0xa9c8('0x5f')]({'where':{'ContactId':_0x11d73e['id'],'closed':![],'FaxAccountId':_0x25e314['id']}})[_0xa9c8('0x22')](function(_0x9288fd){if(_0x9288fd){return[_0x9288fd,![]];}return db[_0xa9c8('0x74')][_0xa9c8('0x5a')]({'UserId':_0x4ef95a['user']['id'],'ContactId':_0x11d73e['id'],'FaxAccountId':_0x25e314['id'],'fax':_0x4ef95a[_0xa9c8('0x63')]['to'][0x0],'firstMsgDirection':_0xa9c8('0xbc'),'Messages':[_[_0xa9c8('0x51')](_0x4ef95a['body'],{'read':![],'body':_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][0x0][_0xa9c8('0xbd')],'FaxAccountId':_0x25e314['id'],'UserId':_0x4ef95a[_0xa9c8('0x5b')]['id'],'ContactId':_0x11d73e['id'],'AttachmentId':_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0xa9c8('0xa5')],'as':_0xa9c8('0xbe')}]})['then'](function(_0x2da3ed){return[_0x2da3ed,!![]];});});}else{throw new Error(_0xa9c8('0xbf'));}})[_0xa9c8('0xc0')](function(_0x1acf13,_0x5559cd){if(_0x5559cd){return _0x1acf13;}return db['FaxMessage'][_0xa9c8('0x5a')]({'direction':'out','read':![],'body':_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][0x0][_0xa9c8('0xbd')],'FaxAccountId':_0x25e314['id'],'FaxInteractionId':_0x1acf13['id'],'UserId':_0x4ef95a[_0xa9c8('0x5b')]['id'],'ContactId':_0x1acf13[_0xa9c8('0xc1')],'AttachmentId':_0x4ef95a['body'][_0xa9c8('0xaf')][0x0]['id']})[_0xa9c8('0x22')](function(_0x5b22c4){_0x1acf13['dataValues'][_0xa9c8('0xbe')]=[];_0x1acf13['dataValues'][_0xa9c8('0xbe')]['push'](_0x5b22c4[_0xa9c8('0xc2')]);return _0x1acf13;});})['then'](function(_0x47e9b7){respondWithRpcPromise('SendFax',_0xa9c8('0xc3'),{'FaxAccountId':_[_0xa9c8('0xb5')](_0x4ef95a[_0xa9c8('0x64')]['id'])?undefined:_0x4ef95a[_0xa9c8('0x64')]['id'],'path':_['isNil'](_0x4ef95a['body']['attachments'][0x0]['path'])?undefined:_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][0x0]['path'],'fax':_[_0xa9c8('0xb5')](_0x4ef95a[_0xa9c8('0x63')]['to'][0x0])?undefined:_0x4ef95a['body']['to'][0x0],'AttachmentId':_0x4ef95a[_0xa9c8('0x63')][_0xa9c8('0xaf')][0x0]['id']},client9002)[_0xa9c8('0x22')](function(_0xac3435){logger[_0xa9c8('0x23')]('SendFaxRpc,\x20%s',_0xac3435);})[_0xa9c8('0x2c')](function(_0x3d3672){logger['info'](_0xa9c8('0xc4'),_0x3d3672);});return _0x47e9b7;})[_0xa9c8('0x22')](respondWithResult(_0x11890b,null))[_0xa9c8('0x2c')](handleError(_0x11890b,null));};exports['addAgents']=function(_0x179d28,_0x4cc5c5,_0x4d464f){return db[_0xa9c8('0x3f')][_0xa9c8('0x5f')]({'where':{'id':_0x179d28['params']['id']}})['then'](handleEntityNotFound(_0x4cc5c5,null))[_0xa9c8('0x22')](function(_0x1dd974){if(_0x1dd974){return _0x1dd974[_0xa9c8('0xc5')](_0x179d28[_0xa9c8('0x63')][_0xa9c8('0x6d')],_[_0xa9c8('0x72')](_0x179d28[_0xa9c8('0x63')],[_0xa9c8('0x6d'),'id'])||{})[_0xa9c8('0xc0')](function(_0x43e3a8){for(var _0x342295=0x0;_0x342295<_0x179d28[_0xa9c8('0x63')][_0xa9c8('0x6d')]['length'];_0x342295+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x179d28[_0xa9c8('0x63')]['ids'][_0x342295]),'FaxAccountId':Number(_0x179d28['params']['id'])});}return _0x43e3a8;});}})[_0xa9c8('0x22')](respondWithResult(_0x4cc5c5,null))[_0xa9c8('0x2c')](handleError(_0x4cc5c5,null));};exports[_0xa9c8('0xc6')]=function(_0x5d2b61,_0xaea569,_0x4b20ab){return db[_0xa9c8('0x3f')][_0xa9c8('0x5f')]({'where':{'id':_0x5d2b61[_0xa9c8('0x64')]['id']}})['then'](handleEntityNotFound(_0xaea569,null))[_0xa9c8('0x22')](function(_0x2c0885){if(_0x2c0885){return _0x2c0885[_0xa9c8('0xc6')](_0x5d2b61[_0xa9c8('0x44')]['ids'])[_0xa9c8('0x22')](function(){if(_[_0xa9c8('0xc7')](_0x5d2b61['query']['ids'])){for(var _0x1935a0=0x0;_0x1935a0<_0x5d2b61[_0xa9c8('0x44')][_0xa9c8('0x6d')][_0xa9c8('0x48')];_0x1935a0+=0x1){socket[_0xa9c8('0xc8')]('userFaxAccount:remove',{'UserId':Number(_0x5d2b61[_0xa9c8('0x44')][_0xa9c8('0x6d')][_0x1935a0]),'FaxAccountId':Number(_0x5d2b61[_0xa9c8('0x64')]['id'])});}}else{socket[_0xa9c8('0xc8')]('userFaxAccount:remove',{'UserId':Number(_0x5d2b61[_0xa9c8('0x44')][_0xa9c8('0x6d')]),'FaxAccountId':Number(_0x5d2b61[_0xa9c8('0x64')]['id'])});}});}})[_0xa9c8('0x22')](respondWithStatusCode(_0xaea569,null))['catch'](handleError(_0xaea569,null));};exports[_0xa9c8('0xc9')]=function(_0x392504,_0x51f466,_0x293223){var _0x46e493={};var _0x23eaeb={};var _0x5de1a6;var _0x119358;return db[_0xa9c8('0x3f')][_0xa9c8('0x6a')]({'where':{'id':_0x392504['params']['id']}})['then'](handleEntityNotFound(_0x51f466,null))['then'](function(_0x215078){if(_0x215078){_0x5de1a6=_0x215078;_0x23eaeb[_0xa9c8('0x43')]=_['keys'](db[_0xa9c8('0x76')][_0xa9c8('0x59')]);_0x23eaeb['query']=_[_0xa9c8('0x58')](_0x392504[_0xa9c8('0x44')]);_0x23eaeb[_0xa9c8('0x4e')]=_[_0xa9c8('0x45')](_0x23eaeb[_0xa9c8('0x43')],_0x23eaeb[_0xa9c8('0x44')]);_0x46e493['attributes']=_[_0xa9c8('0x45')](_0x23eaeb[_0xa9c8('0x43')],qs[_0xa9c8('0x47')](_0x392504['query'][_0xa9c8('0x47')]));_0x46e493[_0xa9c8('0x46')]=_0x46e493[_0xa9c8('0x46')][_0xa9c8('0x48')]?_0x46e493[_0xa9c8('0x46')]:_0x23eaeb[_0xa9c8('0x43')];_0x46e493[_0xa9c8('0x4c')]=qs[_0xa9c8('0x6b')](_0x392504[_0xa9c8('0x44')][_0xa9c8('0x6b')]);_0x46e493[_0xa9c8('0x4d')]=qs[_0xa9c8('0x4e')](_[_0xa9c8('0x4f')](_0x392504['query'],_0x23eaeb[_0xa9c8('0x4e')]));if(_0x392504['query']['filter']){_0x46e493[_0xa9c8('0x4d')]=_['merge'](_0x46e493[_0xa9c8('0x4d')],{'$or':_[_0xa9c8('0x3e')](_0x46e493['attributes'],function(_0x1e56ba){var _0x3128dc={};_0x3128dc[_0x1e56ba]={'$like':'%'+_0x392504[_0xa9c8('0x44')][_0xa9c8('0x50')]+'%'};return _0x3128dc;})});}_0x46e493=_[_0xa9c8('0x51')]({},_0x46e493,_0x392504[_0xa9c8('0x52')]);return _0x5de1a6[_0xa9c8('0xc9')](_0x46e493);}})[_0xa9c8('0x22')](function(_0x37219b){if(_0x37219b){_0x119358=_0x37219b[_0xa9c8('0x48')];if(!_0x392504[_0xa9c8('0x44')][_0xa9c8('0x49')]('nolimit')){_0x46e493[_0xa9c8('0x4b')]=qs['limit'](_0x392504[_0xa9c8('0x44')][_0xa9c8('0x4b')]);_0x46e493['offset']=qs[_0xa9c8('0x2f')](_0x392504[_0xa9c8('0x44')][_0xa9c8('0x2f')]);}return _0x5de1a6[_0xa9c8('0xc9')](_0x46e493);}})['then'](function(_0x46768d){if(_0x46768d){return _0x46768d?{'count':_0x119358,'rows':_0x46768d}:null;}})[_0xa9c8('0x22')](respondWithResult(_0x51f466,null))['catch'](handleError(_0x51f466,null));}; \ No newline at end of file +var _0x7a06=['show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','FaxAccountId','findOne','Disposition','rawAttributes','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','send','CmList','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','info','addAgents','isArray','emit','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','count','Content-Range','json','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','options','include','findAll','rows'];(function(_0x3ca0ae,_0x10d2c8){var _0x3ae0f8=function(_0x5efe86){while(--_0x5efe86){_0x3ca0ae['push'](_0x3ca0ae['shift']());}};_0x3ae0f8(++_0x10d2c8);}(_0x7a06,0x12d));var _0x67a0=function(_0x4df3f4,_0x3a3bd8){_0x4df3f4=_0x4df3f4-0x0;var _0x45c6f4=_0x7a06[_0x4df3f4];return _0x45c6f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67a0('0x0'));var zipdir=require(_0x67a0('0x1'));var jsonpatch=require(_0x67a0('0x2'));var rp=require(_0x67a0('0x3'));var moment=require(_0x67a0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x67a0('0x5'));var path=require(_0x67a0('0x6'));var sox=require(_0x67a0('0x7'));var csv=require(_0x67a0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67a0('0x9'));var _=require('lodash');var squel=require(_0x67a0('0xa'));var crypto=require(_0x67a0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x67a0('0xc'));var toCsv=require(_0x67a0('0x8'));var querystring=require(_0x67a0('0xd'));var Papa=require('papaparse');var Redis=require(_0x67a0('0xe'));var authService=require(_0x67a0('0xf'));var qs=require(_0x67a0('0x10'));var as=require(_0x67a0('0x11'));var hardwareService=require(_0x67a0('0x12'));var logger=require(_0x67a0('0x13'))(_0x67a0('0x14'));var utils=require(_0x67a0('0x15'));var config=require(_0x67a0('0x16'));var licenseUtil=require(_0x67a0('0x17'));var db=require(_0x67a0('0x18'))['db'];config[_0x67a0('0x19')]=_[_0x67a0('0x1a')](config[_0x67a0('0x19')],{'host':_0x67a0('0x1b'),'port':0x18eb});var socket=require(_0x67a0('0x1c'))(new Redis(config[_0x67a0('0x19')]));require('./faxAccount.socket')[_0x67a0('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x67a0('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x67a0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x219143,_0x525520,_0x5a706c,_0x55a1ae){return new BPromise(function(_0x32422c,_0x1b4fb0){var _0x3ea00f=_0x55a1ae||client;return _0x3ea00f[_0x67a0('0x20')](_0x219143,_0x5a706c)['then'](function(_0x139443){logger['info'](_0x67a0('0x21'),_0x525520,_0x67a0('0x22'));logger[_0x67a0('0x23')](_0x67a0('0x24'),_0x525520,'request\x20sent',JSON[_0x67a0('0x25')](_0x139443));if(_0x139443[_0x67a0('0x26')]){if(_0x139443[_0x67a0('0x26')][_0x67a0('0x27')]===0x1f4){logger['error'](_0x67a0('0x21'),_0x525520,_0x139443[_0x67a0('0x26')]['message']);return _0x1b4fb0(_0x139443[_0x67a0('0x26')]['message']);}logger[_0x67a0('0x26')](_0x67a0('0x21'),_0x525520,_0x139443[_0x67a0('0x26')][_0x67a0('0x28')]);return _0x32422c(_0x139443[_0x67a0('0x26')][_0x67a0('0x28')]);}else{logger['info'](_0x67a0('0x21'),_0x525520,_0x67a0('0x22'));_0x32422c(_0x139443[_0x67a0('0x29')][_0x67a0('0x28')]);}})[_0x67a0('0x2a')](function(_0x4c01bc){logger[_0x67a0('0x26')]('FaxAccount,\x20%s,\x20%s',_0x525520,_0x4c01bc);_0x1b4fb0(_0x4c01bc);});});}function respondWithStatusCode(_0x3d7953,_0x28e88d){_0x28e88d=_0x28e88d||0xcc;return function(_0x21fdda){if(_0x21fdda){return _0x3d7953['sendStatus'](_0x28e88d);}return _0x3d7953['status'](_0x28e88d)['end']();};}function respondWithResult(_0x2c440a,_0x39fe4d){_0x39fe4d=_0x39fe4d||0xc8;return function(_0x46f984){if(_0x46f984){return _0x2c440a[_0x67a0('0x2b')](_0x39fe4d)['json'](_0x46f984);}};}function respondWithFilteredResult(_0x8a9da6,_0x3b86e2){return function(_0x366fba){if(_0x366fba){var _0x3479fa=typeof _0x3b86e2[_0x67a0('0x2c')]===_0x67a0('0x2d')&&typeof _0x3b86e2['limit']==='undefined';var _0x2cf433=_0x366fba[_0x67a0('0x2e')];var _0x2c9ae6=_0x3479fa?0x0:_0x3b86e2[_0x67a0('0x2c')];var _0x153322=_0x3479fa?_0x366fba[_0x67a0('0x2e')]:_0x3b86e2['offset']+_0x3b86e2['limit'];var _0x6127ae;if(_0x153322>=_0x2cf433){_0x153322=_0x2cf433;_0x6127ae=0xc8;}else{_0x6127ae=0xce;}_0x8a9da6[_0x67a0('0x2b')](_0x6127ae);return _0x8a9da6['set'](_0x67a0('0x2f'),_0x2c9ae6+'-'+_0x153322+'/'+_0x2cf433)[_0x67a0('0x30')](_0x366fba);}return null;};}function patchUpdates(_0xa0da1d){return function(_0x32cff1){try{jsonpatch['apply'](_0x32cff1,_0xa0da1d,!![]);}catch(_0x408d3a){return BPromise[_0x67a0('0x31')](_0x408d3a);}return _0x32cff1['save']();};}function saveUpdates(_0x2f7b32,_0x702303){return function(_0x5e2632){if(_0x5e2632){return _0x5e2632[_0x67a0('0x32')](_0x2f7b32)[_0x67a0('0x33')](function(_0x2cf1dc){return _0x2cf1dc;});}return null;};}function removeEntity(_0xfdb7ab,_0xd35859){return function(_0x4f6869){if(_0x4f6869){return _0x4f6869[_0x67a0('0x34')]()[_0x67a0('0x33')](function(){var _0x525af9=_0x4f6869[_0x67a0('0x35')]({'plain':!![]});var _0x2a84a3='FaxAccounts';return db[_0x67a0('0x36')][_0x67a0('0x34')]({'where':{'type':_0x2a84a3,'resourceId':_0x525af9['id']}})[_0x67a0('0x33')](function(){return _0x4f6869;});})[_0x67a0('0x33')](function(){_0xfdb7ab[_0x67a0('0x2b')](0xcc)[_0x67a0('0x37')]();});}};}function handleEntityNotFound(_0xffe7de,_0x56c864){return function(_0x43534c){if(!_0x43534c){_0xffe7de[_0x67a0('0x38')](0x194);}return _0x43534c;};}function handleError(_0x279ed9,_0x39bcf4){_0x39bcf4=_0x39bcf4||0x1f4;return function(_0x14a37c){logger[_0x67a0('0x26')](_0x14a37c[_0x67a0('0x39')]);if(_0x14a37c[_0x67a0('0x3a')]){delete _0x14a37c[_0x67a0('0x3a')];}_0x279ed9['status'](_0x39bcf4)['send'](_0x14a37c);};}exports['index']=function(_0x7e43c6,_0x44b6ad){var _0x287752={'include':[{'model':db[_0x67a0('0x3b')],'as':_0x67a0('0x3c')}]},_0x538f6d={},_0x27fe46={'count':0x0,'rows':[]};var _0x59fb41=_['map'](db[_0x67a0('0x3d')]['rawAttributes'],function(_0x25067a){return{'name':_0x25067a[_0x67a0('0x3e')],'type':_0x25067a[_0x67a0('0x3f')][_0x67a0('0x40')]};});_0x538f6d[_0x67a0('0x41')]=_['map'](_0x59fb41,_0x67a0('0x3a'));_0x538f6d['query']=_[_0x67a0('0x42')](_0x7e43c6['query']);_0x538f6d[_0x67a0('0x43')]=_[_0x67a0('0x44')](_0x538f6d[_0x67a0('0x41')],_0x538f6d[_0x67a0('0x45')]);_0x287752['attributes']=_[_0x67a0('0x44')](_0x538f6d[_0x67a0('0x41')],qs[_0x67a0('0x46')](_0x7e43c6[_0x67a0('0x45')]['fields']));_0x287752[_0x67a0('0x47')]=_0x287752[_0x67a0('0x47')][_0x67a0('0x48')]?_0x287752[_0x67a0('0x47')]:_0x538f6d[_0x67a0('0x41')];if(!_0x7e43c6['query'][_0x67a0('0x49')]('nolimit')){_0x287752[_0x67a0('0x4a')]=qs[_0x67a0('0x4a')](_0x7e43c6[_0x67a0('0x45')][_0x67a0('0x4a')]);_0x287752[_0x67a0('0x2c')]=qs['offset'](_0x7e43c6[_0x67a0('0x45')]['offset']);}_0x287752[_0x67a0('0x4b')]=qs['sort'](_0x7e43c6[_0x67a0('0x45')][_0x67a0('0x4c')]);_0x287752[_0x67a0('0x4d')]=qs[_0x67a0('0x43')](_['pick'](_0x7e43c6[_0x67a0('0x45')],_0x538f6d[_0x67a0('0x43')]),_0x59fb41);if(_0x7e43c6[_0x67a0('0x45')][_0x67a0('0x4e')]){_0x287752[_0x67a0('0x4d')]=_[_0x67a0('0x4f')](_0x287752['where'],{'$or':_[_0x67a0('0x50')](_0x59fb41,function(_0x30af72){if(_0x30af72[_0x67a0('0x3f')]!=='VIRTUAL'){var _0x4922d2={};_0x4922d2[_0x30af72[_0x67a0('0x3a')]]={'$like':'%'+_0x7e43c6[_0x67a0('0x45')][_0x67a0('0x4e')]+'%'};return _0x4922d2;}})});}_0x287752=_[_0x67a0('0x4f')]({},_0x287752,_0x7e43c6[_0x67a0('0x51')]);var _0x14f334={'where':_0x287752['where']};return db[_0x67a0('0x3d')][_0x67a0('0x2e')](_0x14f334)[_0x67a0('0x33')](function(_0x7fbd62){_0x27fe46['count']=_0x7fbd62;if(_0x7e43c6[_0x67a0('0x45')]['includeAll']){_0x287752[_0x67a0('0x52')]=[{'all':!![]}];}return db[_0x67a0('0x3d')][_0x67a0('0x53')](_0x287752);})['then'](function(_0x540b3c){_0x27fe46[_0x67a0('0x54')]=_0x540b3c;return _0x27fe46;})[_0x67a0('0x33')](respondWithFilteredResult(_0x44b6ad,_0x287752))['catch'](handleError(_0x44b6ad,null));};exports[_0x67a0('0x55')]=function(_0x5226a4,_0x5ec3a1){var _0x2b1ce8={'raw':![],'where':{'id':_0x5226a4['params']['id']},'include':[{'model':db['Pause'],'as':_0x67a0('0x3c')}]},_0xc117f2={};_0xc117f2[_0x67a0('0x41')]=_[_0x67a0('0x42')](db[_0x67a0('0x3d')]['rawAttributes']);_0xc117f2[_0x67a0('0x45')]=_[_0x67a0('0x42')](_0x5226a4[_0x67a0('0x45')]);_0xc117f2[_0x67a0('0x43')]=_[_0x67a0('0x44')](_0xc117f2[_0x67a0('0x41')],_0xc117f2[_0x67a0('0x45')]);_0x2b1ce8['attributes']=_[_0x67a0('0x44')](_0xc117f2[_0x67a0('0x41')],qs[_0x67a0('0x46')](_0x5226a4['query']['fields']));_0x2b1ce8[_0x67a0('0x47')]=_0x2b1ce8[_0x67a0('0x47')][_0x67a0('0x48')]?_0x2b1ce8[_0x67a0('0x47')]:_0xc117f2['model'];if(_0x5226a4['query'][_0x67a0('0x56')]){_0x2b1ce8[_0x67a0('0x52')]=[{'all':!![]}];}_0x2b1ce8=_[_0x67a0('0x4f')]({},_0x2b1ce8,_0x5226a4[_0x67a0('0x51')]);return db['FaxAccount']['find'](_0x2b1ce8)[_0x67a0('0x33')](handleEntityNotFound(_0x5ec3a1,null))[_0x67a0('0x33')](respondWithResult(_0x5ec3a1,null))[_0x67a0('0x2a')](handleError(_0x5ec3a1,null));};exports[_0x67a0('0x57')]=function(_0x5ad49e,_0x12ba7a){return db['FaxAccount']['create'](_0x5ad49e['body'],{})[_0x67a0('0x33')](function(_0x2d75ef){var _0x4c943e=_0x5ad49e[_0x67a0('0x58')]['get']({'plain':!![]});if(!_0x4c943e)throw new Error(_0x67a0('0x59'));if(_0x4c943e['role']===_0x67a0('0x58')){var _0x1b0504=_0x2d75ef[_0x67a0('0x35')]({'plain':!![]});var _0x37e8af=_0x67a0('0x5a');return db[_0x67a0('0x5b')][_0x67a0('0x5c')]({'where':{'name':_0x37e8af,'userProfileId':_0x4c943e[_0x67a0('0x5d')]},'raw':!![]})['then'](function(_0x9b2a0b){if(_0x9b2a0b&&_0x9b2a0b[_0x67a0('0x5e')]===0x0){return db[_0x67a0('0x36')][_0x67a0('0x57')]({'name':_0x1b0504[_0x67a0('0x3a')],'resourceId':_0x1b0504['id'],'type':_0x9b2a0b[_0x67a0('0x3a')],'sectionId':_0x9b2a0b['id']},{})[_0x67a0('0x33')](function(){return _0x2d75ef;});}else{return _0x2d75ef;}})[_0x67a0('0x2a')](function(_0x1d640d){logger[_0x67a0('0x26')](_0x67a0('0x5f'),_0x1d640d);throw _0x1d640d;});}return _0x2d75ef;})['then'](respondWithResult(_0x12ba7a,0xc9))['catch'](handleError(_0x12ba7a,null));};exports['update']=function(_0x4d7bc8,_0x469263){if(_0x4d7bc8[_0x67a0('0x60')]['id']){delete _0x4d7bc8[_0x67a0('0x60')]['id'];}return db['FaxAccount'][_0x67a0('0x5c')]({'where':{'id':_0x4d7bc8[_0x67a0('0x61')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x67a0('0x33')](handleEntityNotFound(_0x469263,null))[_0x67a0('0x33')](saveUpdates(_0x4d7bc8[_0x67a0('0x60')],null))[_0x67a0('0x33')](respondWithResult(_0x469263,null))[_0x67a0('0x2a')](handleError(_0x469263,null));};exports['destroy']=function(_0x5a5164,_0x2ba961){return db[_0x67a0('0x3d')]['find']({'where':{'id':_0x5a5164[_0x67a0('0x61')]['id']}})['then'](handleEntityNotFound(_0x2ba961,null))['then'](removeEntity(_0x2ba961,null))[_0x67a0('0x2a')](handleError(_0x2ba961,null));};exports[_0x67a0('0x62')]=function(_0x457402,_0x48d1a6){return db['FaxAccount'][_0x67a0('0x62')]()[_0x67a0('0x33')](respondWithResult(_0x48d1a6,null))['catch'](handleError(_0x48d1a6,null));};exports['addDisposition']=function(_0x5e4897,_0x9449e3,_0x38396b){if(_0x5e4897['body']['id']){delete _0x5e4897[_0x67a0('0x60')]['id'];}return db[_0x67a0('0x3d')][_0x67a0('0x5c')]({'where':{'id':_0x5e4897[_0x67a0('0x61')]['id']}})['then'](handleEntityNotFound(_0x9449e3,null))['then'](function(_0x481000){if(_0x481000){_0x5e4897[_0x67a0('0x60')][_0x67a0('0x63')]=_0x481000['id'];return db['Disposition'][_0x67a0('0x57')](_0x5e4897[_0x67a0('0x60')]);}})[_0x67a0('0x33')](respondWithResult(_0x9449e3,null))['catch'](handleError(_0x9449e3,null));};exports['getDispositions']=function(_0xda5c85,_0x1021ad,_0x17309c){var _0x335da6={'raw':![],'where':{}};var _0x441f84={};var _0xdd199c={'count':0x0,'rows':[]};return db[_0x67a0('0x3d')][_0x67a0('0x64')]({'where':{'id':_0xda5c85[_0x67a0('0x61')]['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x1021ad,null))[_0x67a0('0x33')](function(_0x1b24a1){if(_0x1b24a1){_0x441f84[_0x67a0('0x41')]=_['keys'](db[_0x67a0('0x65')][_0x67a0('0x66')]);_0x441f84[_0x67a0('0x45')]=_['keys'](_0xda5c85[_0x67a0('0x45')]);_0x441f84['filters']=_[_0x67a0('0x44')](_0x441f84[_0x67a0('0x41')],_0x441f84['query']);_0x335da6['attributes']=_['intersection'](_0x441f84['model'],qs[_0x67a0('0x46')](_0xda5c85[_0x67a0('0x45')][_0x67a0('0x46')]));_0x335da6[_0x67a0('0x47')]=_0x335da6[_0x67a0('0x47')][_0x67a0('0x48')]?_0x335da6[_0x67a0('0x47')]:_0x441f84[_0x67a0('0x41')];if(!_0xda5c85[_0x67a0('0x45')]['hasOwnProperty'](_0x67a0('0x67'))){_0x335da6[_0x67a0('0x4a')]=qs[_0x67a0('0x4a')](_0xda5c85[_0x67a0('0x45')]['limit']);_0x335da6[_0x67a0('0x2c')]=qs[_0x67a0('0x2c')](_0xda5c85['query'][_0x67a0('0x2c')]);}_0x335da6[_0x67a0('0x4b')]=qs['sort'](_0xda5c85[_0x67a0('0x45')][_0x67a0('0x4c')]);_0x335da6[_0x67a0('0x4d')]=qs[_0x67a0('0x43')](_['pick'](_0xda5c85[_0x67a0('0x45')],_0x441f84[_0x67a0('0x43')]));_0x335da6[_0x67a0('0x4d')][_0x67a0('0x63')]=_0x1b24a1['id'];if(_0xda5c85[_0x67a0('0x45')][_0x67a0('0x4e')]){_0x335da6[_0x67a0('0x4d')]=_[_0x67a0('0x4f')](_0x335da6[_0x67a0('0x4d')],{'$or':_[_0x67a0('0x50')](_0x335da6['attributes'],function(_0x144a08){var _0x34376d={};_0x34376d[_0x144a08]={'$like':'%'+_0xda5c85['query'][_0x67a0('0x4e')]+'%'};return _0x34376d;})});}_0x335da6=_[_0x67a0('0x4f')]({},_0x335da6,_0xda5c85[_0x67a0('0x51')]);return db[_0x67a0('0x65')][_0x67a0('0x2e')]({'where':_0x335da6['where']})[_0x67a0('0x33')](function(_0xf7813b){_0xdd199c[_0x67a0('0x2e')]=_0xf7813b;if(_0xda5c85[_0x67a0('0x45')][_0x67a0('0x56')]){_0x335da6[_0x67a0('0x52')]=[{'all':!![]}];}return db[_0x67a0('0x65')]['findAll'](_0x335da6);})['then'](function(_0x47f5cf){_0xdd199c['rows']=_0x47f5cf;return _0xdd199c;});}})[_0x67a0('0x33')](respondWithFilteredResult(_0x1021ad,_0x335da6))[_0x67a0('0x2a')](handleError(_0x1021ad,null));};exports[_0x67a0('0x68')]=function(_0x4c26bf,_0x3fa5db,_0x1838d2){return db[_0x67a0('0x3d')][_0x67a0('0x5c')]({'where':{'id':_0x4c26bf[_0x67a0('0x61')]['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x3fa5db,null))[_0x67a0('0x33')](function(_0x17a922){if(_0x17a922){return _0x17a922[_0x67a0('0x68')](_0x4c26bf['query'][_0x67a0('0x69')]);}})[_0x67a0('0x33')](respondWithStatusCode(_0x3fa5db,null))['catch'](handleError(_0x3fa5db,null));};exports[_0x67a0('0x6a')]=function(_0x9c82df,_0x1b3b60,_0x5b6e7a){if(_0x9c82df['body']['id']){delete _0x9c82df[_0x67a0('0x60')]['id'];}return db[_0x67a0('0x3d')][_0x67a0('0x5c')]({'where':{'id':_0x9c82df['params']['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x1b3b60,null))[_0x67a0('0x33')](function(_0x1d1655){if(_0x1d1655){_0x9c82df['body'][_0x67a0('0x63')]=_0x1d1655['id'];return db[_0x67a0('0x6b')][_0x67a0('0x57')](_0x9c82df[_0x67a0('0x60')]);}})[_0x67a0('0x33')](respondWithResult(_0x1b3b60,null))['catch'](handleError(_0x1b3b60,null));};exports[_0x67a0('0x6c')]=function(_0x8400b9,_0x2e7855,_0x14650e){var _0x2244f1={'raw':![],'where':{}};var _0x1259ff={};var _0x263ace={'count':0x0,'rows':[]};return db[_0x67a0('0x3d')][_0x67a0('0x64')]({'where':{'id':_0x8400b9['params']['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x2e7855,null))[_0x67a0('0x33')](function(_0x52343e){if(_0x52343e){_0x1259ff[_0x67a0('0x41')]=_[_0x67a0('0x42')](db[_0x67a0('0x6b')]['rawAttributes']);_0x1259ff['query']=_['keys'](_0x8400b9[_0x67a0('0x45')]);_0x1259ff[_0x67a0('0x43')]=_[_0x67a0('0x44')](_0x1259ff[_0x67a0('0x41')],_0x1259ff[_0x67a0('0x45')]);_0x2244f1[_0x67a0('0x47')]=_[_0x67a0('0x44')](_0x1259ff['model'],qs[_0x67a0('0x46')](_0x8400b9['query'][_0x67a0('0x46')]));_0x2244f1[_0x67a0('0x47')]=_0x2244f1[_0x67a0('0x47')][_0x67a0('0x48')]?_0x2244f1['attributes']:_0x1259ff['model'];if(!_0x8400b9['query']['hasOwnProperty'](_0x67a0('0x67'))){_0x2244f1[_0x67a0('0x4a')]=qs[_0x67a0('0x4a')](_0x8400b9[_0x67a0('0x45')][_0x67a0('0x4a')]);_0x2244f1[_0x67a0('0x2c')]=qs['offset'](_0x8400b9[_0x67a0('0x45')]['offset']);}_0x2244f1[_0x67a0('0x4b')]=qs[_0x67a0('0x4c')](_0x8400b9[_0x67a0('0x45')][_0x67a0('0x4c')]);_0x2244f1[_0x67a0('0x4d')]=qs[_0x67a0('0x43')](_[_0x67a0('0x6d')](_0x8400b9[_0x67a0('0x45')],_0x1259ff[_0x67a0('0x43')]));_0x2244f1[_0x67a0('0x4d')]['FaxAccountId']=_0x52343e['id'];if(_0x8400b9[_0x67a0('0x45')][_0x67a0('0x4e')]){_0x2244f1['where']=_[_0x67a0('0x4f')](_0x2244f1[_0x67a0('0x4d')],{'$or':_['map'](_0x2244f1[_0x67a0('0x47')],function(_0x205360){var _0x4db060={};_0x4db060[_0x205360]={'$like':'%'+_0x8400b9[_0x67a0('0x45')]['filter']+'%'};return _0x4db060;})});}_0x2244f1=_[_0x67a0('0x4f')]({},_0x2244f1,_0x8400b9['options']);return db['CannedAnswer'][_0x67a0('0x2e')]({'where':_0x2244f1[_0x67a0('0x4d')]})[_0x67a0('0x33')](function(_0x41f41d){_0x263ace[_0x67a0('0x2e')]=_0x41f41d;if(_0x8400b9[_0x67a0('0x45')]['includeAll']){_0x2244f1[_0x67a0('0x52')]=[{'all':!![]}];}return db[_0x67a0('0x6b')][_0x67a0('0x53')](_0x2244f1);})[_0x67a0('0x33')](function(_0x1eefaf){_0x263ace[_0x67a0('0x54')]=_0x1eefaf;return _0x263ace;});}})[_0x67a0('0x33')](respondWithFilteredResult(_0x2e7855,_0x2244f1))['catch'](handleError(_0x2e7855,null));};exports[_0x67a0('0x6e')]=function(_0x2da973,_0x51fca1,_0x79e49){return db['FaxAccount'][_0x67a0('0x5c')]({'where':{'id':_0x2da973[_0x67a0('0x61')]['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x51fca1,null))[_0x67a0('0x33')](function(_0x221796){if(_0x221796){return _0x221796['removeAnswers'](_0x2da973[_0x67a0('0x45')]['ids']);}})[_0x67a0('0x33')](respondWithStatusCode(_0x51fca1,null))[_0x67a0('0x2a')](handleError(_0x51fca1,null));};exports[_0x67a0('0x6f')]=function(_0x3f7140,_0x341f96,_0x53fbe0){return db[_0x67a0('0x70')][_0x67a0('0x5c')]({'where':{'id':_0x3f7140[_0x67a0('0x61')]['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x341f96,null))['then'](function(_0x30f746){if(_0x30f746){return _0x30f746[_0x67a0('0x6f')](_0x3f7140[_0x67a0('0x60')][_0x67a0('0x69')],_[_0x67a0('0x71')](_0x3f7140[_0x67a0('0x60')],['ids','id'])||{});}})[_0x67a0('0x33')](respondWithResult(_0x341f96,null))[_0x67a0('0x2a')](handleError(_0x341f96,null));};exports[_0x67a0('0x72')]=function(_0x201d02,_0x1c1afb,_0x43a2c7){var _0x17c8f6={'raw':![],'where':{}};var _0x2a316b={};var _0x20b4ca={'count':0x0,'rows':[]};return db[_0x67a0('0x3d')][_0x67a0('0x64')]({'where':{'id':_0x201d02[_0x67a0('0x61')]['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x1c1afb,null))[_0x67a0('0x33')](function(_0x44ced2){if(_0x44ced2){_0x2a316b[_0x67a0('0x41')]=_['keys'](db['FaxInteraction'][_0x67a0('0x66')]);_0x2a316b[_0x67a0('0x45')]=_[_0x67a0('0x42')](_0x201d02[_0x67a0('0x45')]);_0x2a316b[_0x67a0('0x43')]=_[_0x67a0('0x44')](_0x2a316b[_0x67a0('0x41')],_0x2a316b[_0x67a0('0x45')]);_0x17c8f6['attributes']=_[_0x67a0('0x44')](_0x2a316b[_0x67a0('0x41')],qs['fields'](_0x201d02[_0x67a0('0x45')]['fields']));_0x17c8f6[_0x67a0('0x47')]=_0x17c8f6[_0x67a0('0x47')]['length']?_0x17c8f6['attributes']:_0x2a316b[_0x67a0('0x41')];if(!_0x201d02[_0x67a0('0x45')][_0x67a0('0x49')](_0x67a0('0x67'))){_0x17c8f6[_0x67a0('0x4a')]=qs[_0x67a0('0x4a')](_0x201d02[_0x67a0('0x45')]['limit']);_0x17c8f6[_0x67a0('0x2c')]=qs[_0x67a0('0x2c')](_0x201d02[_0x67a0('0x45')][_0x67a0('0x2c')]);}_0x17c8f6['order']=qs['sort'](_0x201d02[_0x67a0('0x45')][_0x67a0('0x4c')]);_0x17c8f6['where']=qs[_0x67a0('0x43')](_['pick'](_0x201d02[_0x67a0('0x45')],_0x2a316b[_0x67a0('0x43')]));_0x17c8f6[_0x67a0('0x4d')][_0x67a0('0x63')]=_0x44ced2['id'];if(_0x201d02[_0x67a0('0x45')][_0x67a0('0x4e')]){_0x17c8f6[_0x67a0('0x4d')]=_[_0x67a0('0x4f')](_0x17c8f6['where'],{'$or':_[_0x67a0('0x50')](_0x17c8f6['attributes'],function(_0x169220){var _0x32f630={};_0x32f630[_0x169220]={'$like':'%'+_0x201d02['query'][_0x67a0('0x4e')]+'%'};return _0x32f630;})});}_0x17c8f6=_['merge']({},_0x17c8f6,_0x201d02[_0x67a0('0x51')]);return db[_0x67a0('0x70')]['count']({'where':_0x17c8f6[_0x67a0('0x4d')]})[_0x67a0('0x33')](function(_0x56f1c9){_0x20b4ca[_0x67a0('0x2e')]=_0x56f1c9;if(_0x201d02[_0x67a0('0x45')][_0x67a0('0x56')]){_0x17c8f6['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x67a0('0x73')],'as':_0x67a0('0x74'),'attributes':[_0x67a0('0x3a'),_0x67a0('0x75'),_0x67a0('0x76')],'required':![]},{'model':db[_0x67a0('0x77')],'as':_0x67a0('0x78'),'attributes':['id',_0x67a0('0x3a'),_0x67a0('0x79')],'where':_0x201d02['query'][_0x67a0('0x7a')]?{'id':_0x201d02[_0x67a0('0x45')][_0x67a0('0x7a')]}:undefined,'required':_0x201d02['query'][_0x67a0('0x7a')]?!![]:![]}];}return db['FaxInteraction'][_0x67a0('0x53')](_0x17c8f6);})['then'](function(_0x2cfb88){_0x20b4ca[_0x67a0('0x54')]=_0x2cfb88;return _0x20b4ca;});}})[_0x67a0('0x33')](respondWithFilteredResult(_0x1c1afb,_0x17c8f6))[_0x67a0('0x2a')](handleError(_0x1c1afb,null));};exports[_0x67a0('0x7b')]=function(_0x185b07,_0x5577c5){var _0x490965=_0x185b07[_0x67a0('0x61')]['id'];var _0x3193d4=_0x185b07['body'];var _0x55b9d3=0xc8;var _0x44c179=null;return db['sequelize'][_0x67a0('0x7c')]({'isolationLevel':db[_0x67a0('0x7d')][_0x67a0('0x7e')][_0x67a0('0x7f')]['READ_COMMITTED']},function(_0x5ebc60){return db['FaxAccount']['findOne']({'where':{'id':_0x490965},'transaction':_0x5ebc60})[_0x67a0('0x33')](function(_0x560461){if(_0x560461){return db[_0x67a0('0x80')][_0x67a0('0x34')]({'where':{'FaxAccountId':_0x490965},'transaction':_0x5ebc60})[_0x67a0('0x33')](function(){var _0x140e01=_[_0x67a0('0x50')](_0x3193d4,function(_0x399b59){_0x399b59[_0x67a0('0x63')]=_0x490965;return _0x399b59;});return db[_0x67a0('0x80')][_0x67a0('0x81')](_0x140e01,{'transaction':_0x5ebc60});});}else{_0x55b9d3=0x194;_0x44c179=[];}});})['then'](function(){if(_0x55b9d3!==0x194){return db[_0x67a0('0x80')][_0x67a0('0x82')]({'where':{'FaxAccountId':_0x490965},'order':_0x67a0('0x83')})[_0x67a0('0x33')](function(_0xf8e5c0){_0x44c179=_0xf8e5c0;});}})['catch'](function(_0x114728){_0x55b9d3=0x1f4;logger[_0x67a0('0x26')](_0x114728[_0x67a0('0x39')]);if(_0x114728['name']){delete _0x114728[_0x67a0('0x3a')];}_0x44c179=_0x114728;})[_0x67a0('0x84')](function(){if(_0x44c179===null){_0x5577c5[_0x67a0('0x38')](_0x55b9d3);}else{if(_0x55b9d3===0x1f4){_0x5577c5['status'](_0x55b9d3)['send'](_0x44c179);}else{_0x5577c5[_0x67a0('0x2b')](_0x55b9d3)[_0x67a0('0x30')](_0x44c179);}}});};exports[_0x67a0('0x85')]=function(_0x32c051,_0x3cf94a,_0x38099a){var _0x57b3ea={};var _0x53f899={};var _0x468ce5;var _0x45822b;return db['FaxAccount'][_0x67a0('0x64')]({'where':{'id':_0x32c051['params']['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x3cf94a,null))[_0x67a0('0x33')](function(_0x2c4fdc){if(_0x2c4fdc){_0x468ce5=_0x2c4fdc;_0x53f899['model']=_[_0x67a0('0x42')](db[_0x67a0('0x80')]['rawAttributes']);_0x53f899[_0x67a0('0x45')]=_[_0x67a0('0x42')](_0x32c051[_0x67a0('0x45')]);_0x53f899['filters']=_[_0x67a0('0x44')](_0x53f899['model'],_0x53f899[_0x67a0('0x45')]);_0x57b3ea[_0x67a0('0x47')]=_[_0x67a0('0x44')](_0x53f899[_0x67a0('0x41')],qs[_0x67a0('0x46')](_0x32c051['query'][_0x67a0('0x46')]));_0x57b3ea['attributes']=_0x57b3ea[_0x67a0('0x47')][_0x67a0('0x48')]?_0x57b3ea[_0x67a0('0x47')]:_0x53f899[_0x67a0('0x41')];_0x57b3ea[_0x67a0('0x4b')]=qs[_0x67a0('0x4c')](_0x32c051[_0x67a0('0x45')][_0x67a0('0x4c')]);_0x57b3ea[_0x67a0('0x4d')]=qs[_0x67a0('0x43')](_['pick'](_0x32c051[_0x67a0('0x45')],_0x53f899[_0x67a0('0x43')]));if(_0x32c051[_0x67a0('0x45')]['filter']){_0x57b3ea[_0x67a0('0x4d')]=_[_0x67a0('0x4f')](_0x57b3ea[_0x67a0('0x4d')],{'$or':_[_0x67a0('0x50')](_0x57b3ea['attributes'],function(_0xf58890){var _0x4beb21={};_0x4beb21[_0xf58890]={'$like':'%'+_0x32c051[_0x67a0('0x45')][_0x67a0('0x4e')]+'%'};return _0x4beb21;})});}_0x57b3ea=_[_0x67a0('0x4f')]({},_0x57b3ea,_0x32c051[_0x67a0('0x51')]);return _0x468ce5[_0x67a0('0x85')](_0x57b3ea);}})[_0x67a0('0x33')](function(_0x1134d8){if(_0x1134d8){_0x45822b=_0x1134d8[_0x67a0('0x48')];if(!_0x32c051[_0x67a0('0x45')]['hasOwnProperty'](_0x67a0('0x67'))){_0x57b3ea[_0x67a0('0x4a')]=qs[_0x67a0('0x4a')](_0x32c051[_0x67a0('0x45')][_0x67a0('0x4a')]);_0x57b3ea[_0x67a0('0x2c')]=qs[_0x67a0('0x2c')](_0x32c051[_0x67a0('0x45')][_0x67a0('0x2c')]);}return _0x468ce5[_0x67a0('0x85')](_0x57b3ea);}})['then'](function(_0x11fe35){if(_0x11fe35){return _0x11fe35?{'count':_0x45822b,'rows':_0x11fe35}:null;}})[_0x67a0('0x33')](respondWithResult(_0x3cf94a,null))['catch'](handleError(_0x3cf94a,null));};function Extension(_0x524e19,_0x23150d,_0x158413,_0x31beca){this['context']=_0x67a0('0x86');this[_0x67a0('0x87')]=_0x524e19[_0x67a0('0x88')];this['app']=_0x31beca;this[_0x67a0('0x3f')]='system';this[_0x67a0('0x89')]=_0x67a0('0x8a');this['FaxAccountId']=_0x524e19['id'];this['priority']=_0x23150d;this['appdata']=_0x158413;}function createExtensionsReciveFax(_0x32c379){var _0x3430cf=0x1;var _0x321b13=[];_0x321b13[_0x67a0('0x8b')](new Extension(_0x32c379,_0x3430cf,'','Answer'));_0x3430cf+=0x1;_0x321b13['push'](new Extension(_0x32c379,_0x3430cf,_0x67a0('0x8c'),_0x67a0('0x8d')));_0x3430cf+=0x1;for(var _0x5871f1 in _0x32c379){if(_0x32c379[_0x67a0('0x49')](_0x5871f1)&&(_0x5871f1===_0x67a0('0x8e')||_0x5871f1===_0x67a0('0x88')||_0x5871f1===_0x67a0('0x8f')||_0x5871f1===_0x67a0('0x90')||_0x5871f1===_0x67a0('0x91')||_0x5871f1==='maxrate'||_0x5871f1===_0x67a0('0x92')||_0x5871f1==='modem'||_0x5871f1==='t38timeout')){_0x321b13[_0x67a0('0x8b')](new Extension(_0x32c379,_0x3430cf,'FAXOPT('+_0x5871f1+')='+_0x32c379[_0x5871f1],_0x67a0('0x8d')));_0x3430cf+=0x1;}}_0x321b13[_0x67a0('0x8b')](new Extension(_0x32c379,_0x3430cf,'6',_0x67a0('0x93')));_0x3430cf+=0x1;_0x321b13[_0x67a0('0x8b')](new Extension(_0x32c379,_0x3430cf,_0x67a0('0x94'),_0x67a0('0x95')));_0x3430cf=0x0;return _0x321b13;}exports['addAccountApplications']=function(_0x1b1c90,_0x15f32b,_0x19343d){var _0x4a38c3;return db['sequelize'][_0x67a0('0x7c')](function(_0x5e1a0e){return db[_0x67a0('0x3d')][_0x67a0('0x57')](_0x1b1c90[_0x67a0('0x60')],{'transaction':_0x5e1a0e})[_0x67a0('0x33')](function(_0x5d201a){_0x4a38c3=_0x5d201a['get']({'plain':!![]});return db[_0x67a0('0x96')][_0x67a0('0x81')](createExtensionsReciveFax(_0x4a38c3),{'transaction':_0x5e1a0e});});})[_0x67a0('0x33')](function(){return _0x4a38c3;})[_0x67a0('0x33')](respondWithResult(_0x15f32b,null))['catch'](handleError(_0x15f32b,null));};exports[_0x67a0('0x97')]=function(_0x278118,_0x446087,_0x5dec4d){var _0x498cdd;return db[_0x67a0('0x7d')][_0x67a0('0x7c')](function(_0x3cc54d){return db[_0x67a0('0x3d')][_0x67a0('0x32')](_0x278118['body'],{'where':{'id':_0x278118[_0x67a0('0x60')]['id']},'transaction':_0x3cc54d})[_0x67a0('0x33')](function(_0x220b67){return db[_0x67a0('0x96')]['destroy']({'where':{'FaxAccountId':_0x278118[_0x67a0('0x60')]['id']},'transaction':_0x3cc54d})['then'](function(_0x33f63e){return db[_0x67a0('0x96')][_0x67a0('0x81')](createExtensionsReciveFax(_['omit'](_0x278118[_0x67a0('0x60')],[_0x67a0('0x98'),_0x67a0('0x40'),_0x67a0('0x99'),'updatedAt',_0x67a0('0x9a'),_0x67a0('0x9b')])),{'transaction':_0x3cc54d});});});})[_0x67a0('0x33')](function(){return db[_0x67a0('0x3d')][_0x67a0('0x9c')](_0x278118['body']['id']);})[_0x67a0('0x33')](respondWithResult(_0x446087,null))[_0x67a0('0x2a')](handleError(_0x446087,null));};exports['getMessages']=function(_0x30dcd9,_0xd74613,_0x159e7a){var _0x1771ea={'raw':!![],'where':{}};var _0x3fcab7={};var _0x536659={'count':0x0,'rows':[]};return db['FaxAccount'][_0x67a0('0x64')]({'where':{'id':_0x30dcd9[_0x67a0('0x61')]['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0xd74613,null))[_0x67a0('0x33')](function(_0x499aaa){if(_0x499aaa){_0x3fcab7['model']=_[_0x67a0('0x42')](db[_0x67a0('0x9d')][_0x67a0('0x66')]);_0x3fcab7[_0x67a0('0x45')]=_[_0x67a0('0x42')](_0x30dcd9[_0x67a0('0x45')]);_0x3fcab7['filters']=_[_0x67a0('0x44')](_0x3fcab7['model'],_0x3fcab7[_0x67a0('0x45')]);_0x1771ea[_0x67a0('0x47')]=_[_0x67a0('0x44')](_0x3fcab7[_0x67a0('0x41')],qs[_0x67a0('0x46')](_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x46')]));_0x1771ea[_0x67a0('0x47')]=_0x1771ea[_0x67a0('0x47')][_0x67a0('0x48')]?_0x1771ea[_0x67a0('0x47')]:_0x3fcab7['model'];if(!_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x49')](_0x67a0('0x67'))){_0x1771ea[_0x67a0('0x4a')]=qs[_0x67a0('0x4a')](_0x30dcd9['query'][_0x67a0('0x4a')]);_0x1771ea['offset']=qs[_0x67a0('0x2c')](_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x2c')]);}_0x1771ea[_0x67a0('0x4b')]=qs[_0x67a0('0x4c')](_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x4c')]);_0x1771ea[_0x67a0('0x4d')]=qs[_0x67a0('0x43')](_[_0x67a0('0x6d')](_0x30dcd9[_0x67a0('0x45')],_0x3fcab7[_0x67a0('0x43')]));_0x1771ea['where'][_0x67a0('0x63')]=_0x499aaa['id'];if(_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x4e')]){_0x1771ea[_0x67a0('0x4d')]=_[_0x67a0('0x4f')](_0x1771ea[_0x67a0('0x4d')],{'$or':_[_0x67a0('0x50')](_0x1771ea['attributes'],function(_0x48a9ec){var _0x4c733c={};_0x4c733c[_0x48a9ec]={'$like':'%'+_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x4e')]+'%'};return _0x4c733c;})});}if(_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x9e')]){var _0x337af7=_0x30dcd9[_0x67a0('0x45')]['$gte'][_0x67a0('0x9f')](',');var _0x2e6971={};_0x2e6971[_0x337af7[0x0]]={'$gte':moment(_0x337af7[0x1])[_0x67a0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1771ea['where']=_[_0x67a0('0x4f')](_0x1771ea['where'],_0x2e6971);}_0x1771ea=_[_0x67a0('0x4f')]({},_0x1771ea,_0x30dcd9[_0x67a0('0x51')]);return db['FaxMessage'][_0x67a0('0x2e')]({'where':_0x1771ea[_0x67a0('0x4d')]})[_0x67a0('0x33')](function(_0x2deabf){_0x536659[_0x67a0('0x2e')]=_0x2deabf;if(_0x30dcd9[_0x67a0('0x45')][_0x67a0('0x56')]){_0x1771ea[_0x67a0('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x67a0('0x53')](_0x1771ea);})[_0x67a0('0x33')](function(_0x52993c){_0x536659['rows']=_0x52993c;return _0x536659;});}})['then'](respondWithFilteredResult(_0xd74613,_0x1771ea))[_0x67a0('0x2a')](handleError(_0xd74613,null));};exports[_0x67a0('0xa1')]=function(_0x38045e,_0x543f62,_0x130f7b){var _0x19c8fd,_0x3f0059={},_0x5c29f3;if(_0x38045e[_0x67a0('0x60')]['to']){_0x5c29f3=_0x38045e[_0x67a0('0x60')]['to'][0x0];}return db[_0x67a0('0x3d')][_0x67a0('0x5c')]({'where':{'id':_0x38045e[_0x67a0('0x61')]['id']},'include':[{'model':db[_0x67a0('0xa2')],'as':'List','include':[{'model':db[_0x67a0('0xa3')],'as':_0x67a0('0xa4'),'where':{'fax':_0x5c29f3},'limit':0x1,'order':[['updatedAt',_0x67a0('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x543f62,null))[_0x67a0('0x33')](function(_0x4604fe){_0x19c8fd=_0x4604fe;if(_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')]&&_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][_0x67a0('0x48')]){for(var _0x16dbf4=0x0;_0x16dbf4<_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][_0x67a0('0x48')];_0x16dbf4+=0x1){_0x38045e['body']['attachments'][_0x16dbf4]={'filename':_0x38045e['body'][_0x67a0('0xa6')][_0x16dbf4]['name'],'id':_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][_0x16dbf4]['id'],'path':path[_0x67a0('0xa7')](config[_0x67a0('0xa8')],_0x67a0('0xa9'),_0x38045e['body'][_0x67a0('0xa6')][_0x16dbf4][_0x67a0('0xaa')])};}}return respondWithRpcPromise(_0x67a0('0xab'),_0x67a0('0xab'),{'FaxAccountId':_[_0x67a0('0xac')](_0x38045e[_0x67a0('0x61')]['id'])?undefined:_0x38045e['params']['id'],'path':_[_0x67a0('0xac')](_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][0x0][_0x67a0('0x6')])?undefined:_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][0x0][_0x67a0('0x6')],'fax':_[_0x67a0('0xac')](_0x38045e['body']['to'][0x0])?undefined:_0x38045e[_0x67a0('0x60')]['to'][0x0]},client9002);})[_0x67a0('0x33')](function(){if(_0x19c8fd){if(_[_0x67a0('0xac')](_0x38045e['body'][_0x67a0('0xad')])){_0x38045e[_0x67a0('0x60')][_0x67a0('0xad')]=util[_0x67a0('0xa0')](_0x67a0('0xae'),_0x19c8fd['name'],_0x19c8fd[_0x67a0('0xaf')]);}if(_0x19c8fd[_0x67a0('0xb0')]){if(_0x19c8fd[_0x67a0('0xb0')][_0x67a0('0xa4')][_0x67a0('0x48')]){return _0x19c8fd[_0x67a0('0xb0')][_0x67a0('0xa4')][0x0];}else{return db[_0x67a0('0xa3')]['create'](_['defaults'](_0x38045e[_0x67a0('0x60')],{'firstName':_0x38045e[_0x67a0('0x60')]['to'][0x0],'phone':_0x38045e[_0x67a0('0x60')]['to'][0x0],'fax':_0x38045e[_0x67a0('0x60')]['to'][0x0],'ListId':_0x19c8fd[_0x67a0('0x9b')]}));}}else{throw new Error(_0x67a0('0xb1'));}}else{throw new Error(_0x67a0('0xb2'));}})[_0x67a0('0x33')](function(_0x324c4d){if(_0x324c4d){return db[_0x67a0('0x70')][_0x67a0('0x5c')]({'where':{'ContactId':_0x324c4d['id'],'closed':![],'FaxAccountId':_0x19c8fd['id']}})[_0x67a0('0x33')](function(_0x2700cb){if(_0x2700cb){return[_0x2700cb,![]];}return db['FaxInteraction'][_0x67a0('0x57')]({'UserId':_0x38045e[_0x67a0('0x58')]['id'],'ContactId':_0x324c4d['id'],'FaxAccountId':_0x19c8fd['id'],'fax':_0x38045e[_0x67a0('0x60')]['to'][0x0],'firstMsgDirection':_0x67a0('0xb3'),'Messages':[_['merge'](_0x38045e[_0x67a0('0x60')],{'read':![],'body':_0x38045e[_0x67a0('0x60')]['attachments'][0x0][_0x67a0('0xb4')],'FaxAccountId':_0x19c8fd['id'],'UserId':_0x38045e['user']['id'],'ContactId':_0x324c4d['id'],'AttachmentId':_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x67a0('0x9d')],'as':_0x67a0('0xb5')}]})['then'](function(_0x372a2b){return[_0x372a2b,!![]];});});}else{throw new Error(_0x67a0('0xb6'));}})[_0x67a0('0xb7')](function(_0x472184,_0x4b4ebe){if(_0x4b4ebe){return _0x472184;}return db[_0x67a0('0x9d')][_0x67a0('0x57')]({'direction':_0x67a0('0xb3'),'read':![],'body':_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][0x0]['filename'],'FaxAccountId':_0x19c8fd['id'],'FaxInteractionId':_0x472184['id'],'UserId':_0x38045e['user']['id'],'ContactId':_0x472184['ContactId'],'AttachmentId':_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][0x0]['id']})[_0x67a0('0x33')](function(_0x298913){_0x472184['dataValues'][_0x67a0('0xb5')]=[];_0x472184[_0x67a0('0xb8')][_0x67a0('0xb5')]['push'](_0x298913['dataValues']);return _0x472184;});})[_0x67a0('0x33')](function(_0x4f407c){respondWithRpcPromise(_0x67a0('0xb9'),_0x67a0('0xb9'),{'FaxAccountId':_[_0x67a0('0xac')](_0x38045e[_0x67a0('0x61')]['id'])?undefined:_0x38045e['params']['id'],'path':_[_0x67a0('0xac')](_0x38045e[_0x67a0('0x60')]['attachments'][0x0]['path'])?undefined:_0x38045e[_0x67a0('0x60')][_0x67a0('0xa6')][0x0][_0x67a0('0x6')],'fax':_['isNil'](_0x38045e[_0x67a0('0x60')]['to'][0x0])?undefined:_0x38045e[_0x67a0('0x60')]['to'][0x0],'AttachmentId':_0x38045e['body'][_0x67a0('0xa6')][0x0]['id']},client9002)[_0x67a0('0x33')](function(_0x43e022){logger['info'](_0x67a0('0xba'),_0x43e022);})[_0x67a0('0x2a')](function(_0x165eb3){logger[_0x67a0('0xbb')](_0x67a0('0xba'),_0x165eb3);});return _0x4f407c;})[_0x67a0('0x33')](respondWithResult(_0x543f62,null))[_0x67a0('0x2a')](handleError(_0x543f62,null));};exports['addAgents']=function(_0x1fae32,_0x56874c,_0x2c6cbf){return db[_0x67a0('0x3d')][_0x67a0('0x5c')]({'where':{'id':_0x1fae32[_0x67a0('0x61')]['id']}})['then'](handleEntityNotFound(_0x56874c,null))[_0x67a0('0x33')](function(_0xd6f284){if(_0xd6f284){return _0xd6f284[_0x67a0('0xbc')](_0x1fae32[_0x67a0('0x60')]['ids'],_[_0x67a0('0x71')](_0x1fae32['body'],[_0x67a0('0x69'),'id'])||{})[_0x67a0('0xb7')](function(_0x5a098c){for(var _0x53bb2b=0x0;_0x53bb2b<_0x1fae32['body']['ids'][_0x67a0('0x48')];_0x53bb2b+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x1fae32[_0x67a0('0x60')][_0x67a0('0x69')][_0x53bb2b]),'FaxAccountId':Number(_0x1fae32[_0x67a0('0x61')]['id'])});}return _0x5a098c;});}})['then'](respondWithResult(_0x56874c,null))[_0x67a0('0x2a')](handleError(_0x56874c,null));};exports['removeAgents']=function(_0xf10ea8,_0x512573,_0x4fd01f){return db['FaxAccount'][_0x67a0('0x5c')]({'where':{'id':_0xf10ea8[_0x67a0('0x61')]['id']}})[_0x67a0('0x33')](handleEntityNotFound(_0x512573,null))[_0x67a0('0x33')](function(_0x427b2d){if(_0x427b2d){return _0x427b2d['removeAgents'](_0xf10ea8[_0x67a0('0x45')][_0x67a0('0x69')])['then'](function(){if(_[_0x67a0('0xbd')](_0xf10ea8['query'][_0x67a0('0x69')])){for(var _0x563799=0x0;_0x563799<_0xf10ea8[_0x67a0('0x45')]['ids'][_0x67a0('0x48')];_0x563799+=0x1){socket[_0x67a0('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0xf10ea8[_0x67a0('0x45')][_0x67a0('0x69')][_0x563799]),'FaxAccountId':Number(_0xf10ea8[_0x67a0('0x61')]['id'])});}}else{socket[_0x67a0('0xbe')](_0x67a0('0xbf'),{'UserId':Number(_0xf10ea8[_0x67a0('0x45')][_0x67a0('0x69')]),'FaxAccountId':Number(_0xf10ea8['params']['id'])});}});}})[_0x67a0('0x33')](respondWithStatusCode(_0x512573,null))[_0x67a0('0x2a')](handleError(_0x512573,null));};exports[_0x67a0('0xc0')]=function(_0x3aa0fb,_0x3a635f,_0xc29b1e){var _0x361f4c={};var _0x40c371={};var _0x584837;var _0xb4d225;return db['FaxAccount'][_0x67a0('0x64')]({'where':{'id':_0x3aa0fb[_0x67a0('0x61')]['id']}})['then'](handleEntityNotFound(_0x3a635f,null))[_0x67a0('0x33')](function(_0x3b3b3c){if(_0x3b3b3c){_0x584837=_0x3b3b3c;_0x40c371[_0x67a0('0x41')]=_[_0x67a0('0x42')](db[_0x67a0('0x73')][_0x67a0('0x66')]);_0x40c371[_0x67a0('0x45')]=_['keys'](_0x3aa0fb[_0x67a0('0x45')]);_0x40c371[_0x67a0('0x43')]=_['intersection'](_0x40c371['model'],_0x40c371[_0x67a0('0x45')]);_0x361f4c[_0x67a0('0x47')]=_['intersection'](_0x40c371[_0x67a0('0x41')],qs[_0x67a0('0x46')](_0x3aa0fb[_0x67a0('0x45')][_0x67a0('0x46')]));_0x361f4c[_0x67a0('0x47')]=_0x361f4c[_0x67a0('0x47')][_0x67a0('0x48')]?_0x361f4c[_0x67a0('0x47')]:_0x40c371[_0x67a0('0x41')];_0x361f4c['order']=qs[_0x67a0('0x4c')](_0x3aa0fb[_0x67a0('0x45')]['sort']);_0x361f4c[_0x67a0('0x4d')]=qs['filters'](_[_0x67a0('0x6d')](_0x3aa0fb[_0x67a0('0x45')],_0x40c371[_0x67a0('0x43')]));if(_0x3aa0fb[_0x67a0('0x45')][_0x67a0('0x4e')]){_0x361f4c[_0x67a0('0x4d')]=_[_0x67a0('0x4f')](_0x361f4c[_0x67a0('0x4d')],{'$or':_[_0x67a0('0x50')](_0x361f4c[_0x67a0('0x47')],function(_0x390fcf){var _0x4100e7={};_0x4100e7[_0x390fcf]={'$like':'%'+_0x3aa0fb[_0x67a0('0x45')][_0x67a0('0x4e')]+'%'};return _0x4100e7;})});}_0x361f4c=_[_0x67a0('0x4f')]({},_0x361f4c,_0x3aa0fb[_0x67a0('0x51')]);return _0x584837[_0x67a0('0xc0')](_0x361f4c);}})['then'](function(_0x5bfc09){if(_0x5bfc09){_0xb4d225=_0x5bfc09[_0x67a0('0x48')];if(!_0x3aa0fb[_0x67a0('0x45')]['hasOwnProperty']('nolimit')){_0x361f4c['limit']=qs[_0x67a0('0x4a')](_0x3aa0fb[_0x67a0('0x45')]['limit']);_0x361f4c['offset']=qs['offset'](_0x3aa0fb[_0x67a0('0x45')][_0x67a0('0x2c')]);}return _0x584837[_0x67a0('0xc0')](_0x361f4c);}})[_0x67a0('0x33')](function(_0xac09c8){if(_0xac09c8){return _0xac09c8?{'count':_0xb4d225,'rows':_0xac09c8}:null;}})[_0x67a0('0x33')](respondWithResult(_0x3a635f,null))[_0x67a0('0x2a')](handleError(_0x3a635f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4f6aa61..50d0223 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 _0x610a=['events','../../mysqldb','FaxAccount','save','remove','emit','hook','exports'];(function(_0x2e0720,_0x2c3ea2){var _0xf36159=function(_0x16d2d1){while(--_0x16d2d1){_0x2e0720['push'](_0x2e0720['shift']());}};_0xf36159(++_0x2c3ea2);}(_0x610a,0x98));var _0xa610=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x610a[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xa610('0x0'));var FaxAccount=require(_0xa610('0x1'))['db'][_0xa610('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa610('0x3'),'afterUpdate':'update','afterDestroy':_0xa610('0x4')};function emitEvent(_0x536655){return function(_0x365c4b,_0x25d4a7,_0x58666b){FaxAccountEvents[_0xa610('0x5')](_0x536655+':'+_0x365c4b['id'],_0x365c4b);FaxAccountEvents['emit'](_0x536655,_0x365c4b);_0x58666b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa610('0x6')](e,emitEvent(event));}}module[_0xa610('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xa8ff=['hook','exports','events','FaxAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x1d73ab,_0x4db32c){var _0x2ed1df=function(_0x245cc6){while(--_0x245cc6){_0x1d73ab['push'](_0x1d73ab['shift']());}};_0x2ed1df(++_0x4db32c);}(_0xa8ff,0x110));var _0xfa8f=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xa8ff[_0x819464];return _0x49dcc0;};'use strict';var EventEmitter=require(_0xfa8f('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xfa8f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa8f('0x2'),'afterUpdate':_0xfa8f('0x3'),'afterDestroy':_0xfa8f('0x4')};function emitEvent(_0x433db2){return function(_0x25c17e,_0x1ea8c4,_0x3e6605){FaxAccountEvents['emit'](_0x433db2+':'+_0x25c17e['id'],_0x25c17e);FaxAccountEvents[_0xfa8f('0x5')](_0x433db2,_0x25c17e);_0x3e6605(null);};}for(var e in events){if(events[_0xfa8f('0x6')](e)){var event=events[e];FaxAccount[_0xfa8f('0x7')](e,emitEvent(event));}}module[_0xfa8f('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c53ef77..71a9c31 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 _0x49aa=['rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','api','moment','bluebird','request-promise','path'];(function(_0x5ad67c,_0x144860){var _0xccce2e=function(_0x2dd95c){while(--_0x2dd95c){_0x5ad67c['push'](_0x5ad67c['shift']());}};_0xccce2e(++_0x144860);}(_0x49aa,0x1df));var _0xa49a=function(_0x418ddc,_0x4113e6){_0x418ddc=_0x418ddc-0x0;var _0xbc7579=_0x49aa[_0x418ddc];return _0xbc7579;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa49a('0x0'));var moment=require(_0xa49a('0x1'));var BPromise=require(_0xa49a('0x2'));var rp=require(_0xa49a('0x3'));var fs=require('fs');var path=require(_0xa49a('0x4'));var rimraf=require(_0xa49a('0x5'));var config=require('../../config/environment');var attributes=require(_0xa49a('0x6'));module[_0xa49a('0x7')]=function(_0x24f95e,_0x1208fb){return _0x24f95e[_0xa49a('0x8')](_0xa49a('0x9'),attributes,{'tableName':_0xa49a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d7b=['moment','bluebird','request-promise','path','rimraf','exports','define','FaxAccount','fax_accounts','util','api'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0x4d7b,0x13d));var _0xb4d7=function(_0x2666b3,_0x25fd1d){_0x2666b3=_0x2666b3-0x0;var _0x695665=_0x4d7b[_0x2666b3];return _0x695665;};'use strict';var _=require('lodash');var util=require(_0xb4d7('0x0'));var logger=require('../../config/logger')(_0xb4d7('0x1'));var moment=require(_0xb4d7('0x2'));var BPromise=require(_0xb4d7('0x3'));var rp=require(_0xb4d7('0x4'));var fs=require('fs');var path=require(_0xb4d7('0x5'));var rimraf=require(_0xb4d7('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xb4d7('0x7')]=function(_0x2a43d7,_0x726bd){return _0x2a43d7[_0xb4d7('0x8')](_0xb4d7('0x9'),attributes,{'tableName':_0xb4d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index a3a53d3..cdaafb2 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 _0xbc72=['from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','DESC','Applications','get','applications','orderBy','length','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','unshift','agent','name','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','limit','include','model','attributes','NotifyFaxAccount','fax','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil'];(function(_0x19a027,_0x1ed090){var _0x2125cc=function(_0x180dcc){while(--_0x180dcc){_0x19a027['push'](_0x19a027['shift']());}};_0x2125cc(++_0x1ed090);}(_0xbc72,0x1c9));var _0x2bc7=function(_0x1d3a64,_0x32a5a3){_0x1d3a64=_0x1d3a64-0x0;var _0x59307c=_0xbc72[_0x1d3a64];return _0x59307c;};'use strict';var _=require('lodash');var util=require(_0x2bc7('0x0'));var moment=require('moment');var BPromise=require(_0x2bc7('0x1'));var rs=require(_0x2bc7('0x2'));var fs=require('fs');var Redis=require(_0x2bc7('0x3'));var db=require(_0x2bc7('0x4'))['db'];var utils=require(_0x2bc7('0x5'));var logger=require(_0x2bc7('0x6'))(_0x2bc7('0x7'));var config=require(_0x2bc7('0x8'));var jayson=require(_0x2bc7('0x9'));var client=jayson[_0x2bc7('0xa')]['http']({'port':0x232c});config[_0x2bc7('0xb')]=_[_0x2bc7('0xc')](config[_0x2bc7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bc7('0xd'))(new Redis(config['redis']));require(_0x2bc7('0xe'))[_0x2bc7('0xf')](socket);function respondWithRpcPromise(_0x1e7da6,_0x42d645,_0x275075){return new BPromise(function(_0x21d1bb,_0x1f1e25){return client[_0x2bc7('0x10')](_0x1e7da6,_0x275075)[_0x2bc7('0x11')](function(_0x4f65a9){logger[_0x2bc7('0x12')](_0x2bc7('0x13'),_0x42d645,_0x2bc7('0x14'));logger[_0x2bc7('0x15')](_0x2bc7('0x16'),_0x42d645,'request\x20sent',JSON[_0x2bc7('0x17')](_0x4f65a9));if(_0x4f65a9[_0x2bc7('0x18')]){if(_0x4f65a9['error'][_0x2bc7('0x19')]===0x1f4){logger['error'](_0x2bc7('0x13'),_0x42d645,_0x4f65a9[_0x2bc7('0x18')]['message']);return _0x1f1e25(_0x4f65a9['error'][_0x2bc7('0x1a')]);}logger[_0x2bc7('0x18')](_0x2bc7('0x13'),_0x42d645,_0x4f65a9[_0x2bc7('0x18')][_0x2bc7('0x1a')]);return _0x21d1bb(_0x4f65a9[_0x2bc7('0x18')][_0x2bc7('0x1a')]);}else{logger['info'](_0x2bc7('0x13'),_0x42d645,_0x2bc7('0x14'));_0x21d1bb(_0x4f65a9[_0x2bc7('0x1b')]['message']);}})[_0x2bc7('0x1c')](function(_0x6075b6){logger[_0x2bc7('0x18')](_0x2bc7('0x13'),_0x42d645,_0x6075b6);_0x1f1e25(_0x6075b6);});});}exports[_0x2bc7('0x1d')]=function(_0x3c476d){var _0x3f2e60=this;return new Promise(function(_0x4025a0,_0x1fe8ff){return db[_0x2bc7('0x1e')]['findAll']({'raw':_0x3c476d['options']?_0x3c476d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c476d['options']?_0x3c476d[_0x2bc7('0x1f')]['where']||null:null,'attributes':_0x3c476d['options']?_0x3c476d[_0x2bc7('0x1f')]['attributes']||null:null,'limit':_0x3c476d[_0x2bc7('0x1f')]?_0x3c476d[_0x2bc7('0x1f')][_0x2bc7('0x20')]||null:null,'include':_0x3c476d['options']?_0x3c476d[_0x2bc7('0x1f')][_0x2bc7('0x21')]?_['map'](_0x3c476d['options'][_0x2bc7('0x21')],function(_0x1243cf){return{'model':db[_0x1243cf[_0x2bc7('0x22')]],'as':_0x1243cf['as'],'attributes':_0x1243cf[_0x2bc7('0x23')],'include':_0x1243cf['include']?_['map'](_0x1243cf[_0x2bc7('0x21')],function(_0xe191c8){return{'model':db[_0xe191c8[_0x2bc7('0x22')]],'as':_0xe191c8['as'],'attributes':_0xe191c8[_0x2bc7('0x23')],'include':_0xe191c8[_0x2bc7('0x21')]?_['map'](_0xe191c8[_0x2bc7('0x21')],function(_0x2de69b){return{'model':db[_0x2de69b['model']],'as':_0x2de69b['as'],'attributes':_0x2de69b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2bc7('0x11')](function(_0x3a4e35){logger[_0x2bc7('0x12')](_0x2bc7('0x1d'),_0x3c476d);logger[_0x2bc7('0x15')](_0x2bc7('0x1d'),_0x3c476d,JSON['stringify'](_0x3a4e35));_0x4025a0(_0x3a4e35);})[_0x2bc7('0x1c')](function(_0x18a4b2){logger[_0x2bc7('0x18')]('GetFaxAccount',_0x18a4b2[_0x2bc7('0x1a')],_0x3c476d);_0x1fe8ff(_0x3f2e60[_0x2bc7('0x18')](0x1f4,_0x18a4b2['message']));});});};exports[_0x2bc7('0x24')]=function(_0x46cab6,_0x42ab72,_0x55bd07){var _0x9436ae=this;return new Promise(function(_0x6d556e,_0x2c14c6){var _0x3154d5={'body':_0x46cab6['body'],'channel':_0x2bc7('0x25')};var _0x34ed9e=[];var _0x5bb897=[];var _0x55af34={};return db['CmContact']['describe']()[_0x2bc7('0x11')](function(_0x50eeb6){if(!_0x50eeb6){throw new db['Sequelize'][(_0x2bc7('0x26'))]('no\x20available\x20attributes');}_0x34ed9e=_[_0x2bc7('0x27')](_[_0x2bc7('0x28')](_0x50eeb6),[_0x2bc7('0x29'),'updatedAt']);_0x5bb897=_['difference'](_[_0x2bc7('0x28')](_0x50eeb6),[_0x2bc7('0x29'),_0x2bc7('0x2a'),_0x2bc7('0x2b'),_0x2bc7('0x2c')]);if(_0x46cab6[_0x2bc7('0x2d')]['id']){delete _0x46cab6[_0x2bc7('0x2d')]['id'];}if(_[_0x2bc7('0x2e')](_0x46cab6['body'][_0x2bc7('0x2f')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x2bc7('0x2e')](_0x46cab6[_0x2bc7('0x2d')]['body'])||_0x46cab6['body'][_0x2bc7('0x2d')]===''){throw new db['Sequelize'][(_0x2bc7('0x26'))](_0x2bc7('0x30'));}if(_[_0x2bc7('0x2e')](_0x46cab6[_0x2bc7('0x2d')][_0x2bc7('0x31')])){throw new db[(_0x2bc7('0x32'))][(_0x2bc7('0x26'))](_0x2bc7('0x33')+_0x5bb897);}if(!_[_0x2bc7('0x34')](_0x5bb897,_0x46cab6[_0x2bc7('0x2d')][_0x2bc7('0x31')])){throw new db[(_0x2bc7('0x32'))][(_0x2bc7('0x26'))](_0x2bc7('0x35')+_0x5bb897);}_0x55af34[_0x46cab6['body'][_0x2bc7('0x31')]]=_0x46cab6['body'][_0x2bc7('0x2f')];})['then'](function(){return db[_0x2bc7('0x1e')][_0x2bc7('0x36')]({'where':{'id':_0x46cab6[_0x2bc7('0x37')]['id']},'include':[{'model':db[_0x2bc7('0x38')],'as':_0x2bc7('0x39'),'include':[{'model':db[_0x2bc7('0x3a')],'as':'Contacts','where':_0x55af34,'limit':0x1,'order':[['updatedAt',_0x2bc7('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0x2bc7('0x3c')}]});})[_0x2bc7('0x11')](function(_0x368bce){if(_0x368bce&&_0x368bce[_0x2bc7('0x39')]){var _0x16a0b1=_0x368bce[_0x2bc7('0x3d')]({'plain':!![]});_0x3154d5[_0x2bc7('0x37')]=_0x16a0b1;_0x3154d5[_0x2bc7('0x3e')]=_0x16a0b1[_0x2bc7('0x3c')];_0x3154d5['list']=_0x16a0b1['List'];_0x3154d5[_0x2bc7('0x3e')]=_[_0x2bc7('0x3f')](_0x3154d5['applications'],['priority'],['asc']);if(_0x3154d5[_0x2bc7('0x37')][_0x2bc7('0x3c')]){delete _0x3154d5[_0x2bc7('0x37')][_0x2bc7('0x3c')];}if(_0x3154d5[_0x2bc7('0x37')][_0x2bc7('0x39')]&&_0x3154d5['account']['List']['Contacts'][_0x2bc7('0x40')]){return _0x3154d5[_0x2bc7('0x37')][_0x2bc7('0x39')][_0x2bc7('0x41')][0x0];}var _0x53e90f=_[_0x2bc7('0xc')](_0x46cab6[_0x2bc7('0x2d')],{'firstName':_0x46cab6['body'][_0x2bc7('0x2f')],'ListId':_0x16a0b1[_0x2bc7('0x2c')]});_0x53e90f[_0x46cab6['body']['mapKey']]=_0x46cab6[_0x2bc7('0x2d')][_0x2bc7('0x2f')];return db['CmContact'][_0x2bc7('0x42')](_0x53e90f,{'fields':_0x34ed9e,'raw':!![]});}})[_0x2bc7('0x11')](function(_0x4eec09){_0x3154d5[_0x2bc7('0x43')]=_0x4eec09;if(_0x4eec09){var _0x596a46={'ContactId':_0x4eec09['id'],'FaxAccountId':_0x46cab6['account']['id'],'fax':_0x4eec09[_0x2bc7('0x25')]};return db['FaxInteraction'][_0x2bc7('0x36')]({'where':{'ContactId':_0x4eec09['id'],'closed':![],'FaxAccountId':_0x46cab6[_0x2bc7('0x37')]['id']}})[_0x2bc7('0x11')](function(_0x33dc1b){if(_0x33dc1b){return[_0x33dc1b,![]];}return db[_0x2bc7('0x44')][_0x2bc7('0x42')](_0x596a46)[_0x2bc7('0x11')](function(_0x22b718){return[_0x22b718,!![]];});});}else{throw new Error(_0x2bc7('0x45'));}})[_0x2bc7('0x46')](function(_0x4a9458,_0x5de110){var _0x5db277=_0x4a9458[_0x2bc7('0x3d')]({'plain':!![]});if(_0x5de110){if(_0x3154d5[_0x2bc7('0x37')]['autoclose']){_0x3154d5[_0x2bc7('0x3e')][_0x2bc7('0x47')]({'id':0x0,'priority':_0x3154d5[_0x2bc7('0x3e')]['length']+0x1,'app':'close','appdata':_0x2bc7('0x48'),'interval':_0x2bc7('0x49')});}_0x5db277[_0x2bc7('0x4a')]=!![];}else{_0x5db277['created']=![];}_0x3154d5[_0x2bc7('0x4b')]=_0x5db277;return db['FaxMessage'][_0x2bc7('0x42')]({'body':_0x46cab6[_0x2bc7('0x2d')][_0x2bc7('0x2d')],'FaxAccountId':_0x46cab6[_0x2bc7('0x37')]['id'],'FaxInteractionId':_0x4a9458['id'],'direction':'in','ContactId':_0x4a9458[_0x2bc7('0x4c')],'AttachmentId':_0x46cab6[_0x2bc7('0x2d')]['AttachmentId']});})[_0x2bc7('0x11')](function(_0xb5de6e){_0x3154d5[_0x2bc7('0x1a')]=_0xb5de6e;if(_0x3154d5[_0x2bc7('0x4b')][_0x2bc7('0x4d')]){return db[_0x2bc7('0x4e')][_0x2bc7('0x36')]({'attributes':['id','name'],'where':{'id':_0x3154d5[_0x2bc7('0x4b')][_0x2bc7('0x4d')]}})[_0x2bc7('0x11')](function(_0x554576){if(_0x554576){_0x3154d5[_0x2bc7('0x3e')][_0x2bc7('0x4f')]({'id':0x0,'priority':0x0,'app':_0x2bc7('0x50'),'appdata':_0x554576[_0x2bc7('0x51')]+','+(_0x3154d5['account']['waitForTheAssignedAgent']||0xa),'interval':_0x2bc7('0x49')});}return respondWithRpcPromise(_0x2bc7('0x52'),_0x2bc7('0x53'),_0x3154d5);});}return respondWithRpcPromise('Start',_0x2bc7('0x53'),_0x3154d5);})[_0x2bc7('0x11')](function(_0x193a34){_0x6d556e(_0x193a34);})[_0x2bc7('0x1c')](function(_0x1caabf){_0x2c14c6(_0x9436ae['error'](0x1f4,_0x1caabf[_0x2bc7('0x1a')]));});});}; \ No newline at end of file +var _0x1867=['fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','CmContact','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','Start','startRouting','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','model','stringify','body'];(function(_0x2feee0,_0x20b8b6){var _0x2e252c=function(_0x1f70d8){while(--_0x1f70d8){_0x2feee0['push'](_0x2feee0['shift']());}};_0x2e252c(++_0x20b8b6);}(_0x1867,0x8c));var _0x7186=function(_0x5a7378,_0x391d8d){_0x5a7378=_0x5a7378-0x0;var _0x532a9c=_0x1867[_0x5a7378];return _0x532a9c;};'use strict';var _=require('lodash');var util=require(_0x7186('0x0'));var moment=require(_0x7186('0x1'));var BPromise=require('bluebird');var rs=require(_0x7186('0x2'));var fs=require('fs');var Redis=require(_0x7186('0x3'));var db=require(_0x7186('0x4'))['db'];var utils=require(_0x7186('0x5'));var logger=require(_0x7186('0x6'))(_0x7186('0x7'));var config=require(_0x7186('0x8'));var jayson=require(_0x7186('0x9'));var client=jayson[_0x7186('0xa')][_0x7186('0xb')]({'port':0x232c});config[_0x7186('0xc')]=_[_0x7186('0xd')](config[_0x7186('0xc')],{'host':_0x7186('0xe'),'port':0x18eb});var socket=require(_0x7186('0xf'))(new Redis(config[_0x7186('0xc')]));require('./faxAccount.socket')[_0x7186('0x10')](socket);function respondWithRpcPromise(_0xa095cc,_0x55d2ac,_0x11ff10){return new BPromise(function(_0x45b230,_0x218184){return client['request'](_0xa095cc,_0x11ff10)[_0x7186('0x11')](function(_0x4e8637){logger[_0x7186('0x12')]('FaxAccount,\x20%s,\x20%s',_0x55d2ac,_0x7186('0x13'));logger[_0x7186('0x14')](_0x7186('0x15'),_0x55d2ac,_0x7186('0x13'),JSON['stringify'](_0x4e8637));if(_0x4e8637[_0x7186('0x16')]){if(_0x4e8637[_0x7186('0x16')][_0x7186('0x17')]===0x1f4){logger['error'](_0x7186('0x18'),_0x55d2ac,_0x4e8637[_0x7186('0x16')][_0x7186('0x19')]);return _0x218184(_0x4e8637[_0x7186('0x16')][_0x7186('0x19')]);}logger['error'](_0x7186('0x18'),_0x55d2ac,_0x4e8637[_0x7186('0x16')][_0x7186('0x19')]);return _0x45b230(_0x4e8637['error'][_0x7186('0x19')]);}else{logger[_0x7186('0x12')](_0x7186('0x18'),_0x55d2ac,'request\x20sent');_0x45b230(_0x4e8637[_0x7186('0x1a')][_0x7186('0x19')]);}})['catch'](function(_0x2e264d){logger[_0x7186('0x16')]('FaxAccount,\x20%s,\x20%s',_0x55d2ac,_0x2e264d);_0x218184(_0x2e264d);});});}exports[_0x7186('0x1b')]=function(_0x3ef8a1){var _0x262ce2=this;return new Promise(function(_0x3b4923,_0x66953e){return db[_0x7186('0x1c')]['findAll']({'raw':_0x3ef8a1[_0x7186('0x1d')]?_0x3ef8a1[_0x7186('0x1d')][_0x7186('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ef8a1[_0x7186('0x1d')]?_0x3ef8a1[_0x7186('0x1d')][_0x7186('0x1f')]||null:null,'attributes':_0x3ef8a1[_0x7186('0x1d')]?_0x3ef8a1['options'][_0x7186('0x20')]||null:null,'limit':_0x3ef8a1[_0x7186('0x1d')]?_0x3ef8a1['options'][_0x7186('0x21')]||null:null,'include':_0x3ef8a1[_0x7186('0x1d')]?_0x3ef8a1[_0x7186('0x1d')][_0x7186('0x22')]?_['map'](_0x3ef8a1[_0x7186('0x1d')][_0x7186('0x22')],function(_0x2fa87a){return{'model':db[_0x2fa87a[_0x7186('0x23')]],'as':_0x2fa87a['as'],'attributes':_0x2fa87a[_0x7186('0x20')],'include':_0x2fa87a[_0x7186('0x22')]?_['map'](_0x2fa87a[_0x7186('0x22')],function(_0x2d2ea1){return{'model':db[_0x2d2ea1['model']],'as':_0x2d2ea1['as'],'attributes':_0x2d2ea1[_0x7186('0x20')],'include':_0x2d2ea1[_0x7186('0x22')]?_['map'](_0x2d2ea1[_0x7186('0x22')],function(_0x203e2b){return{'model':db[_0x203e2b['model']],'as':_0x203e2b['as'],'attributes':_0x203e2b[_0x7186('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7186('0x11')](function(_0xf1f9){logger[_0x7186('0x12')](_0x7186('0x1b'),_0x3ef8a1);logger[_0x7186('0x14')](_0x7186('0x1b'),_0x3ef8a1,JSON[_0x7186('0x24')](_0xf1f9));_0x3b4923(_0xf1f9);})['catch'](function(_0x42f988){logger['error'](_0x7186('0x1b'),_0x42f988[_0x7186('0x19')],_0x3ef8a1);_0x66953e(_0x262ce2[_0x7186('0x16')](0x1f4,_0x42f988['message']));});});};exports['NotifyFaxAccount']=function(_0x28ec50,_0x220b16,_0x378854){var _0x16a3ab=this;return new Promise(function(_0x1b9ed7,_0x4f5520){var _0x48e7e9={'body':_0x28ec50[_0x7186('0x25')],'channel':_0x7186('0x26')};var _0xc98397=[];var _0x4d724c=[];var _0x363799={};return db['CmContact'][_0x7186('0x27')]()[_0x7186('0x11')](function(_0x2a5358){if(!_0x2a5358){throw new db[(_0x7186('0x28'))]['ValidationError'](_0x7186('0x29'));}_0xc98397=_[_0x7186('0x2a')](_[_0x7186('0x2b')](_0x2a5358),[_0x7186('0x2c'),_0x7186('0x2d')]);_0x4d724c=_['difference'](_[_0x7186('0x2b')](_0x2a5358),[_0x7186('0x2c'),_0x7186('0x2d'),_0x7186('0x2e'),_0x7186('0x2f')]);if(_0x28ec50[_0x7186('0x25')]['id']){delete _0x28ec50['body']['id'];}if(_['isNil'](_0x28ec50[_0x7186('0x25')][_0x7186('0x30')])){throw new db[(_0x7186('0x28'))][(_0x7186('0x31'))]('from\x20is\x20mandatory');}if(_[_0x7186('0x32')](_0x28ec50[_0x7186('0x25')][_0x7186('0x25')])||_0x28ec50[_0x7186('0x25')][_0x7186('0x25')]===''){throw new db[(_0x7186('0x28'))][(_0x7186('0x31'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7186('0x32')](_0x28ec50[_0x7186('0x25')]['mapKey'])){throw new db[(_0x7186('0x28'))]['ValidationError'](_0x7186('0x33')+_0x4d724c);}if(!_[_0x7186('0x34')](_0x4d724c,_0x28ec50['body'][_0x7186('0x35')])){throw new db[(_0x7186('0x28'))][(_0x7186('0x31'))](_0x7186('0x36')+_0x4d724c);}_0x363799[_0x28ec50[_0x7186('0x25')][_0x7186('0x35')]]=_0x28ec50[_0x7186('0x25')][_0x7186('0x30')];})['then'](function(){return db[_0x7186('0x1c')][_0x7186('0x37')]({'where':{'id':_0x28ec50[_0x7186('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x7186('0x39'),'include':[{'model':db[_0x7186('0x3a')],'as':_0x7186('0x3b'),'where':_0x363799,'limit':0x1,'order':[[_0x7186('0x2d'),'DESC']]}]},{'model':db[_0x7186('0x3c')],'as':_0x7186('0x3d')}]});})[_0x7186('0x11')](function(_0x450620){if(_0x450620&&_0x450620[_0x7186('0x39')]){var _0x816a21=_0x450620[_0x7186('0x3e')]({'plain':!![]});_0x48e7e9[_0x7186('0x38')]=_0x816a21;_0x48e7e9[_0x7186('0x3f')]=_0x816a21[_0x7186('0x3d')];_0x48e7e9[_0x7186('0x40')]=_0x816a21['List'];_0x48e7e9[_0x7186('0x3f')]=_[_0x7186('0x41')](_0x48e7e9[_0x7186('0x3f')],[_0x7186('0x42')],[_0x7186('0x43')]);if(_0x48e7e9[_0x7186('0x38')][_0x7186('0x3d')]){delete _0x48e7e9['account'][_0x7186('0x3d')];}if(_0x48e7e9[_0x7186('0x38')][_0x7186('0x39')]&&_0x48e7e9[_0x7186('0x38')][_0x7186('0x39')]['Contacts']['length']){return _0x48e7e9[_0x7186('0x38')][_0x7186('0x39')]['Contacts'][0x0];}var _0x1ef410=_['defaults'](_0x28ec50[_0x7186('0x25')],{'firstName':_0x28ec50[_0x7186('0x25')]['from'],'ListId':_0x816a21[_0x7186('0x2f')]});_0x1ef410[_0x28ec50[_0x7186('0x25')]['mapKey']]=_0x28ec50['body'][_0x7186('0x30')];return db[_0x7186('0x3a')][_0x7186('0x44')](_0x1ef410,{'fields':_0xc98397,'raw':!![]});}})[_0x7186('0x11')](function(_0x4d6e12){_0x48e7e9['contact']=_0x4d6e12;if(_0x4d6e12){var _0x1ff7b1={'ContactId':_0x4d6e12['id'],'FaxAccountId':_0x28ec50['account']['id'],'fax':_0x4d6e12[_0x7186('0x26')]};return db[_0x7186('0x45')][_0x7186('0x37')]({'where':{'ContactId':_0x4d6e12['id'],'closed':![],'FaxAccountId':_0x28ec50['account']['id']}})[_0x7186('0x11')](function(_0x2cca5f){if(_0x2cca5f){return[_0x2cca5f,![]];}return db[_0x7186('0x45')][_0x7186('0x44')](_0x1ff7b1)[_0x7186('0x11')](function(_0x9ad9f2){return[_0x9ad9f2,!![]];});});}else{throw new Error(_0x7186('0x46'));}})[_0x7186('0x47')](function(_0x259c5d,_0x58914a){var _0x1dd384=_0x259c5d[_0x7186('0x3e')]({'plain':!![]});if(_0x58914a){if(_0x48e7e9[_0x7186('0x38')][_0x7186('0x48')]){_0x48e7e9[_0x7186('0x3f')]['push']({'id':0x0,'priority':_0x48e7e9[_0x7186('0x3f')][_0x7186('0x49')]+0x1,'app':_0x7186('0x4a'),'appdata':_0x7186('0x4b'),'interval':_0x7186('0x4c')});}_0x1dd384['created']=!![];}else{_0x1dd384[_0x7186('0x4d')]=![];}_0x48e7e9[_0x7186('0x4e')]=_0x1dd384;return db[_0x7186('0x4f')][_0x7186('0x44')]({'body':_0x28ec50[_0x7186('0x25')][_0x7186('0x25')],'FaxAccountId':_0x28ec50[_0x7186('0x38')]['id'],'FaxInteractionId':_0x259c5d['id'],'direction':'in','ContactId':_0x259c5d[_0x7186('0x50')],'AttachmentId':_0x28ec50['body']['AttachmentId']});})[_0x7186('0x11')](function(_0x4387e5){_0x48e7e9[_0x7186('0x19')]=_0x4387e5;if(_0x48e7e9[_0x7186('0x4e')][_0x7186('0x51')]){return db[_0x7186('0x52')][_0x7186('0x37')]({'attributes':['id',_0x7186('0x53')],'where':{'id':_0x48e7e9[_0x7186('0x4e')][_0x7186('0x51')]}})['then'](function(_0x467477){if(_0x467477){_0x48e7e9[_0x7186('0x3f')][_0x7186('0x54')]({'id':0x0,'priority':0x0,'app':_0x7186('0x55'),'appdata':_0x467477[_0x7186('0x53')]+','+(_0x48e7e9[_0x7186('0x38')]['waitForTheAssignedAgent']||0xa),'interval':_0x7186('0x4c')});}return respondWithRpcPromise(_0x7186('0x56'),'startRouting',_0x48e7e9);});}return respondWithRpcPromise('Start',_0x7186('0x57'),_0x48e7e9);})[_0x7186('0x11')](function(_0x1f1006){_0x1b9ed7(_0x1f1006);})[_0x7186('0x58')](function(_0x38b162){_0x4f5520(_0x16a3ab['error'](0x1f4,_0x38b162[_0x7186('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 04206a7..07ac7f5 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 _0xfc9a=['removeListener','length','faxAccount:','./faxAccount.events','remove','update','emit'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xfc9a,0x1bc));var _0xafc9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc9a[_0x14add3];return _0x4a174f;};'use strict';var FaxAccountEvents=require(_0xafc9('0x0'));var events=['save',_0xafc9('0x1'),_0xafc9('0x2')];function createListener(_0x316ad1,_0x594f22){return function(_0x48991e){_0x594f22[_0xafc9('0x3')](_0x316ad1,_0x48991e);};}function removeListener(_0x45df2b,_0x2116d3){return function(){FaxAccountEvents[_0xafc9('0x4')](_0x45df2b,_0x2116d3);};}exports['register']=function(_0x1a0273){for(var _0x3658bd=0x0,_0xeed6a3=events[_0xafc9('0x5')];_0x3658bd<_0xeed6a3;_0x3658bd++){var _0x114f1c=events[_0x3658bd];var _0x2bde4e=createListener(_0xafc9('0x6')+_0x114f1c,_0x1a0273);FaxAccountEvents['on'](_0x114f1c,_0x2bde4e);}}; \ No newline at end of file +var _0x85de=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x22ed4b,_0x20609c){var _0x4e9cf6=function(_0x3a2de1){while(--_0x3a2de1){_0x22ed4b['push'](_0x22ed4b['shift']());}};_0x4e9cf6(++_0x20609c);}(_0x85de,0x174));var _0xe85d=function(_0x3cc9e4,_0x28ca96){_0x3cc9e4=_0x3cc9e4-0x0;var _0x1e6b73=_0x85de[_0x3cc9e4];return _0x1e6b73;};'use strict';var FaxAccountEvents=require(_0xe85d('0x0'));var events=[_0xe85d('0x1'),_0xe85d('0x2'),_0xe85d('0x3')];function createListener(_0x5e17d2,_0x5acf29){return function(_0x512447){_0x5acf29['emit'](_0x5e17d2,_0x512447);};}function removeListener(_0x3bdb7c,_0x371475){return function(){FaxAccountEvents[_0xe85d('0x4')](_0x3bdb7c,_0x371475);};}exports[_0xe85d('0x5')]=function(_0xba7941){for(var _0x292605=0x0,_0xc0a192=events[_0xe85d('0x6')];_0x292605<_0xc0a192;_0x292605++){var _0x3fa154=events[_0x292605];var _0x28d876=createListener(_0xe85d('0x7')+_0x3fa154,_0xba7941);FaxAccountEvents['on'](_0x3fa154,_0x28d876);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c0a2b49..7755854 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(_0x456e1e,_0x201061){var _0xa098f9=function(_0xaadd7b){while(--_0xaadd7b){_0x456e1e['push'](_0x456e1e['shift']());}};_0xa098f9(++_0x201061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x36a603,_0x141e6c){var _0x35b7d9=function(_0x4ecb96){while(--_0x4ecb96){_0x36a603['push'](_0x36a603['shift']());}};_0x35b7d9(++_0x141e6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 b38a1c2..3084b26 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 _0xdba8=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xdba8,0xd7));var _0x8dba=function(_0x4df5a4,_0x20225c){_0x4df5a4=_0x4df5a4-0x0;var _0x35ac35=_0xdba8[_0x4df5a4];return _0x35ac35;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8dba('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x8dba('0x1')],'allowNull':![],'defaultValue':_0x8dba('0x2')},'appdata':{'type':Sequelize[_0x8dba('0x3')]()},'description':{'type':Sequelize[_0x8dba('0x1')]},'interval':{'type':Sequelize[_0x8dba('0x1')],'defaultValue':_0x8dba('0x4')}}; \ No newline at end of file +var _0x9c6d=['noop','TEXT','STRING','*,*,*,*','INTEGER'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9c6d,0xd1));var _0xd9c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9c6d[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xd9c6('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd9c6('0x1')},'appdata':{'type':Sequelize[_0xd9c6('0x2')]()},'description':{'type':Sequelize[_0xd9c6('0x3')]},'interval':{'type':Sequelize[_0xd9c6('0x3')],'defaultValue':_0xd9c6('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a09c57a..f7f8690 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 _0x7628=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','findAll','rows','catch','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x7628,0x159));var _0x8762=function(_0x6eebb2,_0x41bad1){_0x6eebb2=_0x6eebb2-0x0;var _0x3ab113=_0x7628[_0x6eebb2];return _0x3ab113;};'use strict';var emlformat=require(_0x8762('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8762('0x1'));var jsonpatch=require(_0x8762('0x2'));var rp=require(_0x8762('0x3'));var moment=require(_0x8762('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8762('0x5'));var util=require(_0x8762('0x6'));var path=require(_0x8762('0x7'));var sox=require(_0x8762('0x8'));var csv=require(_0x8762('0x9'));var ejs=require(_0x8762('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8762('0xb'));var squel=require('squel');var crypto=require(_0x8762('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8762('0xd'));var toCsv=require(_0x8762('0x9'));var querystring=require(_0x8762('0xe'));var Papa=require(_0x8762('0xf'));var Redis=require(_0x8762('0x10'));var authService=require(_0x8762('0x11'));var qs=require(_0x8762('0x12'));var as=require(_0x8762('0x13'));var hardwareService=require(_0x8762('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8762('0x15'));var config=require(_0x8762('0x16'));var licenseUtil=require(_0x8762('0x17'));var db=require(_0x8762('0x18'))['db'];function respondWithStatusCode(_0x2504e2,_0x29dfbd){_0x29dfbd=_0x29dfbd||0xcc;return function(_0x4a5410){if(_0x4a5410){return _0x2504e2[_0x8762('0x19')](_0x29dfbd);}return _0x2504e2[_0x8762('0x1a')](_0x29dfbd)[_0x8762('0x1b')]();};}function respondWithResult(_0x2c8318,_0x2e08fa){_0x2e08fa=_0x2e08fa||0xc8;return function(_0x46d67a){if(_0x46d67a){return _0x2c8318[_0x8762('0x1a')](_0x2e08fa)[_0x8762('0x1c')](_0x46d67a);}};}function respondWithFilteredResult(_0x3eb301,_0x18b393){return function(_0x2c2a1b){if(_0x2c2a1b){var _0x5a09b8=typeof _0x18b393['offset']===_0x8762('0x1d')&&typeof _0x18b393['limit']===_0x8762('0x1d');var _0x168fc5=_0x2c2a1b[_0x8762('0x1e')];var _0x5bb6b4=_0x5a09b8?0x0:_0x18b393[_0x8762('0x1f')];var _0x5401fa=_0x5a09b8?_0x2c2a1b[_0x8762('0x1e')]:_0x18b393[_0x8762('0x1f')]+_0x18b393[_0x8762('0x20')];var _0x2f8b0a;if(_0x5401fa>=_0x168fc5){_0x5401fa=_0x168fc5;_0x2f8b0a=0xc8;}else{_0x2f8b0a=0xce;}_0x3eb301[_0x8762('0x1a')](_0x2f8b0a);return _0x3eb301[_0x8762('0x21')](_0x8762('0x22'),_0x5bb6b4+'-'+_0x5401fa+'/'+_0x168fc5)[_0x8762('0x1c')](_0x2c2a1b);}return null;};}function patchUpdates(_0x3561cf){return function(_0x189048){try{jsonpatch['apply'](_0x189048,_0x3561cf,!![]);}catch(_0x2efa27){return BPromise[_0x8762('0x23')](_0x2efa27);}return _0x189048[_0x8762('0x24')]();};}function saveUpdates(_0x18ee3f,_0xadf0d9){return function(_0x28a323){if(_0x28a323){return _0x28a323[_0x8762('0x25')](_0x18ee3f)['then'](function(_0x208813){return _0x208813;});}return null;};}function removeEntity(_0x2a6df9,_0x58026c){return function(_0x5b3952){if(_0x5b3952){return _0x5b3952[_0x8762('0x26')]()[_0x8762('0x27')](function(){_0x2a6df9[_0x8762('0x1a')](0xcc)[_0x8762('0x1b')]();});}};}function handleEntityNotFound(_0x156300,_0x30d019){return function(_0x5b8bbc){if(!_0x5b8bbc){_0x156300[_0x8762('0x19')](0x194);}return _0x5b8bbc;};}function handleError(_0x4180f2,_0x5ae4cf){_0x5ae4cf=_0x5ae4cf||0x1f4;return function(_0x1337c4){logger['error'](_0x1337c4[_0x8762('0x28')]);if(_0x1337c4[_0x8762('0x29')]){delete _0x1337c4[_0x8762('0x29')];}_0x4180f2[_0x8762('0x1a')](_0x5ae4cf)['send'](_0x1337c4);};}exports[_0x8762('0x2a')]=function(_0x3dd1d9,_0xd2e5a0){var _0x537d5d={},_0x236998={},_0xb2ac92={'count':0x0,'rows':[]};var _0x1f2d32=_['map'](db[_0x8762('0x2b')][_0x8762('0x2c')],function(_0x366255){return{'name':_0x366255[_0x8762('0x2d')],'type':_0x366255[_0x8762('0x2e')][_0x8762('0x2f')]};});_0x236998[_0x8762('0x30')]=_['map'](_0x1f2d32,'name');_0x236998['query']=_['keys'](_0x3dd1d9['query']);_0x236998[_0x8762('0x31')]=_[_0x8762('0x32')](_0x236998[_0x8762('0x30')],_0x236998[_0x8762('0x33')]);_0x537d5d[_0x8762('0x34')]=_['intersection'](_0x236998[_0x8762('0x30')],qs[_0x8762('0x35')](_0x3dd1d9[_0x8762('0x33')][_0x8762('0x35')]));_0x537d5d[_0x8762('0x34')]=_0x537d5d[_0x8762('0x34')][_0x8762('0x36')]?_0x537d5d['attributes']:_0x236998[_0x8762('0x30')];if(!_0x3dd1d9['query'][_0x8762('0x37')](_0x8762('0x38'))){_0x537d5d[_0x8762('0x20')]=qs[_0x8762('0x20')](_0x3dd1d9[_0x8762('0x33')][_0x8762('0x20')]);_0x537d5d[_0x8762('0x1f')]=qs['offset'](_0x3dd1d9[_0x8762('0x33')][_0x8762('0x1f')]);}_0x537d5d[_0x8762('0x39')]=qs[_0x8762('0x3a')](_0x3dd1d9[_0x8762('0x33')]['sort']);_0x537d5d[_0x8762('0x3b')]=qs[_0x8762('0x31')](_['pick'](_0x3dd1d9[_0x8762('0x33')],_0x236998[_0x8762('0x31')]),_0x1f2d32);if(_0x3dd1d9[_0x8762('0x33')][_0x8762('0x3c')]){_0x537d5d['where']=_[_0x8762('0x3d')](_0x537d5d[_0x8762('0x3b')],{'$or':_[_0x8762('0x3e')](_0x1f2d32,function(_0x284f8b){if(_0x284f8b[_0x8762('0x2e')]!==_0x8762('0x3f')){var _0x337583={};_0x337583[_0x284f8b['name']]={'$like':'%'+_0x3dd1d9[_0x8762('0x33')][_0x8762('0x3c')]+'%'};return _0x337583;}})});}_0x537d5d=_[_0x8762('0x3d')]({},_0x537d5d,_0x3dd1d9[_0x8762('0x40')]);var _0x772be4={'where':_0x537d5d[_0x8762('0x3b')]};return db[_0x8762('0x2b')]['count'](_0x772be4)[_0x8762('0x27')](function(_0x3358f8){_0xb2ac92[_0x8762('0x1e')]=_0x3358f8;if(_0x3dd1d9[_0x8762('0x33')]['includeAll']){_0x537d5d['include']=[{'all':!![]}];}return db[_0x8762('0x2b')][_0x8762('0x41')](_0x537d5d);})['then'](function(_0x4f59ea){_0xb2ac92[_0x8762('0x42')]=_0x4f59ea;return _0xb2ac92;})[_0x8762('0x27')](respondWithFilteredResult(_0xd2e5a0,_0x537d5d))[_0x8762('0x43')](handleError(_0xd2e5a0,null));};exports['show']=function(_0x1e666e,_0x2de999){var _0x41f389={'raw':!![],'where':{'id':_0x1e666e[_0x8762('0x44')]['id']}},_0x2d5218={};_0x2d5218[_0x8762('0x30')]=_[_0x8762('0x45')](db[_0x8762('0x2b')][_0x8762('0x2c')]);_0x2d5218[_0x8762('0x33')]=_[_0x8762('0x45')](_0x1e666e[_0x8762('0x33')]);_0x2d5218[_0x8762('0x31')]=_[_0x8762('0x32')](_0x2d5218['model'],_0x2d5218[_0x8762('0x33')]);_0x41f389[_0x8762('0x34')]=_[_0x8762('0x32')](_0x2d5218['model'],qs['fields'](_0x1e666e[_0x8762('0x33')][_0x8762('0x35')]));_0x41f389[_0x8762('0x34')]=_0x41f389['attributes'][_0x8762('0x36')]?_0x41f389[_0x8762('0x34')]:_0x2d5218[_0x8762('0x30')];if(_0x1e666e[_0x8762('0x33')]['includeAll']){_0x41f389['include']=[{'all':!![]}];}_0x41f389=_[_0x8762('0x3d')]({},_0x41f389,_0x1e666e[_0x8762('0x40')]);return db[_0x8762('0x2b')][_0x8762('0x46')](_0x41f389)['then'](handleEntityNotFound(_0x2de999,null))[_0x8762('0x27')](respondWithResult(_0x2de999,null))[_0x8762('0x43')](handleError(_0x2de999,null));};exports[_0x8762('0x47')]=function(_0x133de8,_0x32f7dc){return db['FaxApplication'][_0x8762('0x47')](_0x133de8[_0x8762('0x48')],{})['then'](respondWithResult(_0x32f7dc,0xc9))[_0x8762('0x43')](handleError(_0x32f7dc,null));};exports[_0x8762('0x25')]=function(_0x431e86,_0x394665){if(_0x431e86['body']['id']){delete _0x431e86[_0x8762('0x48')]['id'];}return db['FaxApplication'][_0x8762('0x46')]({'where':{'id':_0x431e86[_0x8762('0x44')]['id']}})[_0x8762('0x27')](handleEntityNotFound(_0x394665,null))['then'](saveUpdates(_0x431e86['body'],null))[_0x8762('0x27')](respondWithResult(_0x394665,null))['catch'](handleError(_0x394665,null));};exports['destroy']=function(_0x4fe2e2,_0x1694a2){return db[_0x8762('0x2b')][_0x8762('0x46')]({'where':{'id':_0x4fe2e2[_0x8762('0x44')]['id']}})[_0x8762('0x27')](handleEntityNotFound(_0x1694a2,null))[_0x8762('0x27')](removeEntity(_0x1694a2,null))['catch'](handleError(_0x1694a2,null));}; \ No newline at end of file +var _0xc7b8=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','findAll','rows','params','include','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','hasOwnProperty'];(function(_0x27baff,_0x5d916b){var _0x494034=function(_0x34874d){while(--_0x34874d){_0x27baff['push'](_0x27baff['shift']());}};_0x494034(++_0x5d916b);}(_0xc7b8,0x134));var _0x8c7b=function(_0x59c459,_0x561f16){_0x59c459=_0x59c459-0x0;var _0x9af6db=_0xc7b8[_0x59c459];return _0x9af6db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c7b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c7b('0x1'));var rp=require(_0x8c7b('0x2'));var moment=require(_0x8c7b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8c7b('0x4'));var util=require(_0x8c7b('0x5'));var path=require('path');var sox=require(_0x8c7b('0x6'));var csv=require(_0x8c7b('0x7'));var ejs=require(_0x8c7b('0x8'));var fs=require('fs');var fs_extra=require(_0x8c7b('0x9'));var _=require(_0x8c7b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c7b('0xb'));var toCsv=require(_0x8c7b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c7b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8c7b('0xd'));var as=require(_0x8c7b('0xe'));var hardwareService=require(_0x8c7b('0xf'));var logger=require(_0x8c7b('0x10'))(_0x8c7b('0x11'));var utils=require(_0x8c7b('0x12'));var config=require(_0x8c7b('0x13'));var licenseUtil=require(_0x8c7b('0x14'));var db=require(_0x8c7b('0x15'))['db'];function respondWithStatusCode(_0x4c3779,_0x324ab7){_0x324ab7=_0x324ab7||0xcc;return function(_0x39e59a){if(_0x39e59a){return _0x4c3779[_0x8c7b('0x16')](_0x324ab7);}return _0x4c3779[_0x8c7b('0x17')](_0x324ab7)[_0x8c7b('0x18')]();};}function respondWithResult(_0x450b43,_0xc62ee4){_0xc62ee4=_0xc62ee4||0xc8;return function(_0x75986){if(_0x75986){return _0x450b43[_0x8c7b('0x17')](_0xc62ee4)['json'](_0x75986);}};}function respondWithFilteredResult(_0x139c2b,_0x25369c){return function(_0x45c031){if(_0x45c031){var _0x56118a=typeof _0x25369c[_0x8c7b('0x19')]===_0x8c7b('0x1a')&&typeof _0x25369c[_0x8c7b('0x1b')]==='undefined';var _0x34670c=_0x45c031[_0x8c7b('0x1c')];var _0xd71476=_0x56118a?0x0:_0x25369c[_0x8c7b('0x19')];var _0x2ce32d=_0x56118a?_0x45c031[_0x8c7b('0x1c')]:_0x25369c['offset']+_0x25369c['limit'];var _0x5a66ae;if(_0x2ce32d>=_0x34670c){_0x2ce32d=_0x34670c;_0x5a66ae=0xc8;}else{_0x5a66ae=0xce;}_0x139c2b['status'](_0x5a66ae);return _0x139c2b[_0x8c7b('0x1d')]('Content-Range',_0xd71476+'-'+_0x2ce32d+'/'+_0x34670c)[_0x8c7b('0x1e')](_0x45c031);}return null;};}function patchUpdates(_0x357ea2){return function(_0x25c338){try{jsonpatch[_0x8c7b('0x1f')](_0x25c338,_0x357ea2,!![]);}catch(_0x529324){return BPromise[_0x8c7b('0x20')](_0x529324);}return _0x25c338['save']();};}function saveUpdates(_0x4d3603,_0x52fae){return function(_0xe5d5ba){if(_0xe5d5ba){return _0xe5d5ba[_0x8c7b('0x21')](_0x4d3603)['then'](function(_0x1b6563){return _0x1b6563;});}return null;};}function removeEntity(_0x1d4cff,_0x3ef3fa){return function(_0x2a2fb2){if(_0x2a2fb2){return _0x2a2fb2[_0x8c7b('0x22')]()[_0x8c7b('0x23')](function(){_0x1d4cff['status'](0xcc)[_0x8c7b('0x18')]();});}};}function handleEntityNotFound(_0x5de5f2,_0x2366a5){return function(_0x516def){if(!_0x516def){_0x5de5f2['sendStatus'](0x194);}return _0x516def;};}function handleError(_0x13cc6a,_0x4e883f){_0x4e883f=_0x4e883f||0x1f4;return function(_0xe78767){logger[_0x8c7b('0x24')](_0xe78767[_0x8c7b('0x25')]);if(_0xe78767['name']){delete _0xe78767[_0x8c7b('0x26')];}_0x13cc6a[_0x8c7b('0x17')](_0x4e883f)[_0x8c7b('0x27')](_0xe78767);};}exports[_0x8c7b('0x28')]=function(_0x4300db,_0x116cf6){var _0x5c9d16={},_0x2e0f90={},_0x2d5bfe={'count':0x0,'rows':[]};var _0x34bbeb=_['map'](db['FaxApplication'][_0x8c7b('0x29')],function(_0x1e0405){return{'name':_0x1e0405[_0x8c7b('0x2a')],'type':_0x1e0405[_0x8c7b('0x2b')]['key']};});_0x2e0f90[_0x8c7b('0x2c')]=_[_0x8c7b('0x2d')](_0x34bbeb,_0x8c7b('0x26'));_0x2e0f90[_0x8c7b('0x2e')]=_[_0x8c7b('0x2f')](_0x4300db[_0x8c7b('0x2e')]);_0x2e0f90['filters']=_[_0x8c7b('0x30')](_0x2e0f90[_0x8c7b('0x2c')],_0x2e0f90[_0x8c7b('0x2e')]);_0x5c9d16['attributes']=_[_0x8c7b('0x30')](_0x2e0f90[_0x8c7b('0x2c')],qs[_0x8c7b('0x31')](_0x4300db[_0x8c7b('0x2e')][_0x8c7b('0x31')]));_0x5c9d16[_0x8c7b('0x32')]=_0x5c9d16[_0x8c7b('0x32')]['length']?_0x5c9d16[_0x8c7b('0x32')]:_0x2e0f90[_0x8c7b('0x2c')];if(!_0x4300db[_0x8c7b('0x2e')][_0x8c7b('0x33')](_0x8c7b('0x34'))){_0x5c9d16['limit']=qs[_0x8c7b('0x1b')](_0x4300db[_0x8c7b('0x2e')]['limit']);_0x5c9d16[_0x8c7b('0x19')]=qs[_0x8c7b('0x19')](_0x4300db[_0x8c7b('0x2e')]['offset']);}_0x5c9d16[_0x8c7b('0x35')]=qs['sort'](_0x4300db['query'][_0x8c7b('0x36')]);_0x5c9d16[_0x8c7b('0x37')]=qs[_0x8c7b('0x38')](_[_0x8c7b('0x39')](_0x4300db['query'],_0x2e0f90[_0x8c7b('0x38')]),_0x34bbeb);if(_0x4300db['query'][_0x8c7b('0x3a')]){_0x5c9d16[_0x8c7b('0x37')]=_[_0x8c7b('0x3b')](_0x5c9d16['where'],{'$or':_[_0x8c7b('0x2d')](_0x34bbeb,function(_0xf88df8){if(_0xf88df8[_0x8c7b('0x2b')]!==_0x8c7b('0x3c')){var _0x3fe116={};_0x3fe116[_0xf88df8[_0x8c7b('0x26')]]={'$like':'%'+_0x4300db[_0x8c7b('0x2e')][_0x8c7b('0x3a')]+'%'};return _0x3fe116;}})});}_0x5c9d16=_['merge']({},_0x5c9d16,_0x4300db[_0x8c7b('0x3d')]);var _0x8f9103={'where':_0x5c9d16[_0x8c7b('0x37')]};return db[_0x8c7b('0x3e')][_0x8c7b('0x1c')](_0x8f9103)['then'](function(_0x29b5ac){_0x2d5bfe[_0x8c7b('0x1c')]=_0x29b5ac;if(_0x4300db[_0x8c7b('0x2e')][_0x8c7b('0x3f')]){_0x5c9d16['include']=[{'all':!![]}];}return db[_0x8c7b('0x3e')][_0x8c7b('0x40')](_0x5c9d16);})[_0x8c7b('0x23')](function(_0x53cd9f){_0x2d5bfe[_0x8c7b('0x41')]=_0x53cd9f;return _0x2d5bfe;})['then'](respondWithFilteredResult(_0x116cf6,_0x5c9d16))['catch'](handleError(_0x116cf6,null));};exports['show']=function(_0x5ab05b,_0x22e89f){var _0x537308={'raw':!![],'where':{'id':_0x5ab05b[_0x8c7b('0x42')]['id']}},_0x656a9c={};_0x656a9c[_0x8c7b('0x2c')]=_[_0x8c7b('0x2f')](db['FaxApplication'][_0x8c7b('0x29')]);_0x656a9c[_0x8c7b('0x2e')]=_['keys'](_0x5ab05b[_0x8c7b('0x2e')]);_0x656a9c[_0x8c7b('0x38')]=_[_0x8c7b('0x30')](_0x656a9c['model'],_0x656a9c[_0x8c7b('0x2e')]);_0x537308[_0x8c7b('0x32')]=_[_0x8c7b('0x30')](_0x656a9c[_0x8c7b('0x2c')],qs[_0x8c7b('0x31')](_0x5ab05b[_0x8c7b('0x2e')]['fields']));_0x537308['attributes']=_0x537308['attributes']['length']?_0x537308[_0x8c7b('0x32')]:_0x656a9c[_0x8c7b('0x2c')];if(_0x5ab05b[_0x8c7b('0x2e')][_0x8c7b('0x3f')]){_0x537308[_0x8c7b('0x43')]=[{'all':!![]}];}_0x537308=_['merge']({},_0x537308,_0x5ab05b[_0x8c7b('0x3d')]);return db[_0x8c7b('0x3e')][_0x8c7b('0x44')](_0x537308)[_0x8c7b('0x23')](handleEntityNotFound(_0x22e89f,null))[_0x8c7b('0x23')](respondWithResult(_0x22e89f,null))[_0x8c7b('0x45')](handleError(_0x22e89f,null));};exports['create']=function(_0x5b50ef,_0x295725){return db[_0x8c7b('0x3e')][_0x8c7b('0x46')](_0x5b50ef[_0x8c7b('0x47')],{})['then'](respondWithResult(_0x295725,0xc9))['catch'](handleError(_0x295725,null));};exports['update']=function(_0x329c70,_0x4e2d59){if(_0x329c70[_0x8c7b('0x47')]['id']){delete _0x329c70[_0x8c7b('0x47')]['id'];}return db[_0x8c7b('0x3e')][_0x8c7b('0x44')]({'where':{'id':_0x329c70['params']['id']}})['then'](handleEntityNotFound(_0x4e2d59,null))['then'](saveUpdates(_0x329c70[_0x8c7b('0x47')],null))['then'](respondWithResult(_0x4e2d59,null))[_0x8c7b('0x45')](handleError(_0x4e2d59,null));};exports['destroy']=function(_0x43774e,_0x22e024){return db[_0x8c7b('0x3e')][_0x8c7b('0x44')]({'where':{'id':_0x43774e[_0x8c7b('0x42')]['id']}})[_0x8c7b('0x23')](handleEntityNotFound(_0x22e024,null))[_0x8c7b('0x23')](removeEntity(_0x22e024,null))[_0x8c7b('0x45')](handleError(_0x22e024,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index dc0b7aa..9376168 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 _0xd9f8=['exports','define','FaxApplication','fax_applications','utf8mb4','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x349a6a,_0x291b2a){var _0x3f6577=function(_0x384071){while(--_0x384071){_0x349a6a['push'](_0x349a6a['shift']());}};_0x3f6577(++_0x291b2a);}(_0xd9f8,0x1f3));var _0x8d9f=function(_0x519659,_0x6c79a9){_0x519659=_0x519659-0x0;var _0xea1d8c=_0xd9f8[_0x519659];return _0xea1d8c;};'use strict';var _=require(_0x8d9f('0x0'));var util=require('util');var logger=require(_0x8d9f('0x1'))('api');var moment=require(_0x8d9f('0x2'));var BPromise=require('bluebird');var rp=require(_0x8d9f('0x3'));var fs=require('fs');var path=require(_0x8d9f('0x4'));var rimraf=require(_0x8d9f('0x5'));var config=require(_0x8d9f('0x6'));var attributes=require(_0x8d9f('0x7'));module[_0x8d9f('0x8')]=function(_0x3e0bcf,_0x1ec44e){return _0x3e0bcf[_0x8d9f('0x9')](_0x8d9f('0xa'),attributes,{'tableName':_0x8d9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d9f('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9fbe=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x191d92,_0x1a4a5b){var _0xafc773=function(_0x3fc8ac){while(--_0x3fc8ac){_0x191d92['push'](_0x191d92['shift']());}};_0xafc773(++_0x1a4a5b);}(_0x9fbe,0x161));var _0xe9fb=function(_0x25996d,_0x5b282e){_0x25996d=_0x25996d-0x0;var _0x12d802=_0x9fbe[_0x25996d];return _0x12d802;};'use strict';var _=require(_0xe9fb('0x0'));var util=require(_0xe9fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe9fb('0x2'));var BPromise=require(_0xe9fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9fb('0x4'));var rimraf=require(_0xe9fb('0x5'));var config=require(_0xe9fb('0x6'));var attributes=require(_0xe9fb('0x7'));module[_0xe9fb('0x8')]=function(_0x2f1885,_0x7b6a29){return _0x2f1885[_0xe9fb('0x9')](_0xe9fb('0xa'),attributes,{'tableName':_0xe9fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe9fb('0xc'),'collate':_0xe9fb('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 26eb015..c352ab3 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 _0xf078=['update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication'];(function(_0x220be8,_0x18ed93){var _0x535782=function(_0x54fb18){while(--_0x54fb18){_0x220be8['push'](_0x220be8['shift']());}};_0x535782(++_0x18ed93);}(_0xf078,0xda));var _0x8f07=function(_0x18d512,_0x277a4b){_0x18d512=_0x18d512-0x0;var _0x486137=_0xf078[_0x18d512];return _0x486137;};'use strict';var _=require(_0x8f07('0x0'));var util=require('util');var moment=require(_0x8f07('0x1'));var BPromise=require(_0x8f07('0x2'));var rs=require(_0x8f07('0x3'));var fs=require('fs');var Redis=require(_0x8f07('0x4'));var db=require(_0x8f07('0x5'))['db'];var utils=require(_0x8f07('0x6'));var logger=require(_0x8f07('0x7'))(_0x8f07('0x8'));var config=require(_0x8f07('0x9'));var jayson=require(_0x8f07('0xa'));var client=jayson[_0x8f07('0xb')][_0x8f07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x322237,_0x484cc4,_0x2e367f){return new BPromise(function(_0x54d72f,_0x5835d3){return client[_0x8f07('0xd')](_0x322237,_0x2e367f)[_0x8f07('0xe')](function(_0x62c740){logger[_0x8f07('0xf')]('FaxApplication,\x20%s,\x20%s',_0x484cc4,_0x8f07('0x10'));logger[_0x8f07('0x11')](_0x8f07('0x12'),_0x484cc4,_0x8f07('0x10'),JSON[_0x8f07('0x13')](_0x62c740));if(_0x62c740[_0x8f07('0x14')]){if(_0x62c740[_0x8f07('0x14')][_0x8f07('0x15')]===0x1f4){logger[_0x8f07('0x14')](_0x8f07('0x16'),_0x484cc4,_0x62c740[_0x8f07('0x14')][_0x8f07('0x17')]);return _0x5835d3(_0x62c740['error']['message']);}logger['error'](_0x8f07('0x16'),_0x484cc4,_0x62c740[_0x8f07('0x14')][_0x8f07('0x17')]);return _0x54d72f(_0x62c740['error'][_0x8f07('0x17')]);}else{logger[_0x8f07('0xf')](_0x8f07('0x16'),_0x484cc4,'request\x20sent');_0x54d72f(_0x62c740[_0x8f07('0x18')][_0x8f07('0x17')]);}})[_0x8f07('0x19')](function(_0x145dc8){logger['error']('FaxApplication,\x20%s,\x20%s',_0x484cc4,_0x145dc8);_0x5835d3(_0x145dc8);});});}exports['UpdateFaxApplication']=function(_0x80d19){var _0x21f00b=this;return new Promise(function(_0x472e5c,_0x3c5782){return db[_0x8f07('0x1a')][_0x8f07('0x1b')](_0x80d19[_0x8f07('0x1c')],{'raw':_0x80d19[_0x8f07('0x1d')]?_0x80d19[_0x8f07('0x1d')][_0x8f07('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80d19[_0x8f07('0x1d')]?_0x80d19[_0x8f07('0x1d')][_0x8f07('0x1f')]||null:null,'attributes':_0x80d19['options']?_0x80d19[_0x8f07('0x1d')][_0x8f07('0x20')]||null:null,'limit':_0x80d19[_0x8f07('0x1d')]?_0x80d19[_0x8f07('0x1d')][_0x8f07('0x21')]||null:null})[_0x8f07('0xe')](function(_0xca812e){logger[_0x8f07('0xf')](_0x8f07('0x22'),_0x80d19);logger[_0x8f07('0x11')](_0x8f07('0x22'),_0x80d19,JSON[_0x8f07('0x13')](_0xca812e));_0x472e5c(_0xca812e);})[_0x8f07('0x19')](function(_0x26f114){logger[_0x8f07('0x14')](_0x8f07('0x22'),_0x26f114[_0x8f07('0x17')],_0x80d19);_0x3c5782(_0x21f00b[_0x8f07('0x14')](0x1f4,_0x26f114[_0x8f07('0x17')]));});});}; \ No newline at end of file +var _0x09e5=['jayson/promise','client','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','where','attributes','limit','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x211733,_0x1e766){var _0x479fc9=function(_0x287b63){while(--_0x287b63){_0x211733['push'](_0x211733['shift']());}};_0x479fc9(++_0x1e766);}(_0x09e5,0xb7));var _0x509e=function(_0xfc9c50,_0x5afbc3){_0xfc9c50=_0xfc9c50-0x0;var _0x560e73=_0x09e5[_0xfc9c50];return _0x560e73;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x509e('0x0'));var fs=require('fs');var Redis=require(_0x509e('0x1'));var db=require(_0x509e('0x2'))['db'];var utils=require(_0x509e('0x3'));var logger=require(_0x509e('0x4'))(_0x509e('0x5'));var config=require('../../config/environment');var jayson=require(_0x509e('0x6'));var client=jayson[_0x509e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x434b57,_0x483383,_0x42097f){return new BPromise(function(_0x448750,_0x434292){return client['request'](_0x434b57,_0x42097f)[_0x509e('0x8')](function(_0x2611bd){logger[_0x509e('0x9')](_0x509e('0xa'),_0x483383,'request\x20sent');logger[_0x509e('0xb')](_0x509e('0xc'),_0x483383,_0x509e('0xd'),JSON[_0x509e('0xe')](_0x2611bd));if(_0x2611bd['error']){if(_0x2611bd[_0x509e('0xf')][_0x509e('0x10')]===0x1f4){logger[_0x509e('0xf')](_0x509e('0xa'),_0x483383,_0x2611bd[_0x509e('0xf')][_0x509e('0x11')]);return _0x434292(_0x2611bd[_0x509e('0xf')]['message']);}logger[_0x509e('0xf')](_0x509e('0xa'),_0x483383,_0x2611bd[_0x509e('0xf')][_0x509e('0x11')]);return _0x448750(_0x2611bd[_0x509e('0xf')][_0x509e('0x11')]);}else{logger[_0x509e('0x9')](_0x509e('0xa'),_0x483383,_0x509e('0xd'));_0x448750(_0x2611bd[_0x509e('0x12')]['message']);}})[_0x509e('0x13')](function(_0x7da22c){logger[_0x509e('0xf')]('FaxApplication,\x20%s,\x20%s',_0x483383,_0x7da22c);_0x434292(_0x7da22c);});});}exports[_0x509e('0x14')]=function(_0x2ef862){var _0xc37e4c=this;return new Promise(function(_0x3672d0,_0x25e712){return db[_0x509e('0x15')][_0x509e('0x16')](_0x2ef862['body'],{'raw':_0x2ef862[_0x509e('0x17')]?_0x2ef862[_0x509e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef862[_0x509e('0x17')]?_0x2ef862[_0x509e('0x17')][_0x509e('0x18')]||null:null,'attributes':_0x2ef862[_0x509e('0x17')]?_0x2ef862['options'][_0x509e('0x19')]||null:null,'limit':_0x2ef862['options']?_0x2ef862[_0x509e('0x17')][_0x509e('0x1a')]||null:null})[_0x509e('0x8')](function(_0x1bbab5){logger[_0x509e('0x9')](_0x509e('0x14'),_0x2ef862);logger[_0x509e('0xb')](_0x509e('0x14'),_0x2ef862,JSON['stringify'](_0x1bbab5));_0x3672d0(_0x1bbab5);})[_0x509e('0x13')](function(_0x5db66f){logger[_0x509e('0xf')](_0x509e('0x14'),_0x5db66f[_0x509e('0x11')],_0x2ef862);_0x25e712(_0xc37e4c[_0x509e('0xf')](0x1f4,_0x5db66f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e19392f..6998d47 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x955f,0x1eb));var _0xf955=function(_0x1b69a3,_0x35fb5f){_0x1b69a3=_0x1b69a3-0x0;var _0xf23eb5=_0x955f[_0x1b69a3];return _0xf23eb5;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +var _0x2547=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0x86ba06,_0x2e50d9){var _0xafb44a=function(_0x1dd5cd){while(--_0x1dd5cd){_0x86ba06['push'](_0x86ba06['shift']());}};_0xafb44a(++_0x2e50d9);}(_0x2547,0x1cd));var _0x7254=function(_0x705a5f,_0x41fdf5){_0x705a5f=_0x705a5f-0x0;var _0x454075=_0x2547[_0x705a5f];return _0x454075;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['post']('/',auth[_0x7254('0xa')](),controller['create']);router['put']('/:id',auth[_0x7254('0xa')](),controller[_0x7254('0xe')]);router[_0x7254('0xf')](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 53de09b..89d67cd 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 _0x7bb1=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x19d4aa,_0x365ce1){var _0x55a311=function(_0x10ac62){while(--_0x10ac62){_0x19d4aa['push'](_0x19d4aa['shift']());}};_0x55a311(++_0x365ce1);}(_0x7bb1,0x1bd));var _0x17bb=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x7bb1[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0x17bb('0x0'));module[_0x17bb('0x1')]={'closed':{'type':Sequelize[_0x17bb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x17bb('0x3')]},'disposition':{'type':Sequelize[_0x17bb('0x4')]},'secondDisposition':{'type':Sequelize[_0x17bb('0x4')]},'thirdDisposition':{'type':Sequelize[_0x17bb('0x4')]},'note':{'type':Sequelize[_0x17bb('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x17bb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x17bb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x17bb('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x17bb('0x5')]('in',_0x17bb('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x135b=['STRING','ENUM','out','sequelize','exports','DATE'];(function(_0xa7d5e2,_0x30b70a){var _0x4eb16d=function(_0x1d4f8c){while(--_0x1d4f8c){_0xa7d5e2['push'](_0xa7d5e2['shift']());}};_0x4eb16d(++_0x30b70a);}(_0x135b,0x1dd));var _0xb135=function(_0x5a9655,_0x2b4bc2){_0x5a9655=_0x5a9655-0x0;var _0x1543c7=_0x135b[_0x5a9655];return _0x1543c7;};'use strict';var Sequelize=require(_0xb135('0x0'));module[_0xb135('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb135('0x2')]},'disposition':{'type':Sequelize[_0xb135('0x3')]},'secondDisposition':{'type':Sequelize[_0xb135('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb135('0x3')]},'note':{'type':Sequelize[_0xb135('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xb135('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb135('0x4')]('in',_0xb135('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb135('0x4')]('in',_0xb135('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 0549614..fc6c9e2 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 _0x2a3d=['setTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','getMessages','findOne','keys','FaxMessage','length','hasOwnProperty','nolimit','sort','where','pick','filter','format','YYYY-MM-DD\x20HH:mm:ss','rows'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x2a3d,0xeb));var _0xd2a3=function(_0x5c238a,_0xf728bc){_0x5c238a=_0x5c238a-0x0;var _0x11af5b=_0x2a3d[_0x5c238a];return _0x11af5b;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xd2a3('0x0'));var BPromise=require(_0xd2a3('0x1'));var util=require(_0xd2a3('0x2'));var path=require(_0xd2a3('0x3'));var fs=require('fs');var _=require(_0xd2a3('0x4'));var Redis=require(_0xd2a3('0x5'));var interaction=require(_0xd2a3('0x6'));var qs=require(_0xd2a3('0x7'));var logger=require(_0xd2a3('0x8'))(_0xd2a3('0x9'));var config=require(_0xd2a3('0xa'));var db=require(_0xd2a3('0xb'))['db'];config[_0xd2a3('0xc')]=_[_0xd2a3('0xd')](config[_0xd2a3('0xc')],{'host':_0xd2a3('0xe'),'port':0x18eb});var socket=require(_0xd2a3('0xf'))(new Redis(config[_0xd2a3('0xc')]));require(_0xd2a3('0x10'))[_0xd2a3('0x11')](socket);function respondWithStatusCode(_0x4b597c,_0x4dd025){_0x4dd025=_0x4dd025||0xcc;return function(_0x1fed25){if(_0x1fed25){return _0x4b597c[_0xd2a3('0x12')](_0x4dd025);}return _0x4b597c[_0xd2a3('0x13')](_0x4dd025)[_0xd2a3('0x14')]();};}function respondWithResult(_0x1285e5,_0x8446a2){_0x8446a2=_0x8446a2||0xc8;return function(_0x4f0946){if(_0x4f0946){return _0x1285e5[_0xd2a3('0x13')](_0x8446a2)['json'](_0x4f0946);}};}function respondWithFilteredResult(_0x2a3d14,_0x285427){return function(_0x36bf12){if(_0x36bf12){var _0x2a8bbe=typeof _0x285427[_0xd2a3('0x15')]==='undefined'&&typeof _0x285427[_0xd2a3('0x16')]===_0xd2a3('0x17');var _0x348b5c=_0x36bf12[_0xd2a3('0x18')];var _0x37e60f=_0x2a8bbe?0x0:_0x285427[_0xd2a3('0x15')];var _0x461173=_0x2a8bbe?_0x36bf12[_0xd2a3('0x18')]:_0x285427[_0xd2a3('0x15')]+_0x285427[_0xd2a3('0x16')];var _0x2586a8;if(_0x461173>=_0x348b5c){_0x461173=_0x348b5c;_0x2586a8=0xc8;}else{_0x2586a8=0xce;}_0x2a3d14[_0xd2a3('0x13')](_0x2586a8);return _0x2a3d14['set'](_0xd2a3('0x19'),_0x37e60f+'-'+_0x461173+'/'+_0x348b5c)['json'](_0x36bf12);}return null;};}function saveUpdates(_0x1896af){return function(_0xddb76f){if(_0xddb76f){return _0xddb76f[_0xd2a3('0x1a')](_0x1896af)[_0xd2a3('0x1b')](function(_0x474b9a){return _0x474b9a;});}return null;};}function removeEntity(_0x55eed8){return function(_0x14c16e){if(_0x14c16e){return _0x14c16e[_0xd2a3('0x1c')]()[_0xd2a3('0x1b')](function(){_0x55eed8[_0xd2a3('0x13')](0xcc)[_0xd2a3('0x14')]();});}};}function handleEntityNotFound(_0x3138a2){return function(_0x156c7f){if(!_0x156c7f){_0x3138a2[_0xd2a3('0x12')](0x194);}return _0x156c7f;};}function handleError(_0x4e6e10,_0x5c126a){_0x5c126a=_0x5c126a||0x1f4;return function(_0x2460b3){logger[_0xd2a3('0x1d')](_0x2460b3[_0xd2a3('0x1e')]);if(_0x2460b3[_0xd2a3('0x1f')]){delete _0x2460b3[_0xd2a3('0x1f')];}_0x4e6e10[_0xd2a3('0x13')](_0x5c126a)[_0xd2a3('0x20')](_0x2460b3);};}exports[_0xd2a3('0x21')]=function(_0x2c6481,_0x3498ab){var _0x12b6ec={};var _0xb03e91=_[_0xd2a3('0x22')](db[_0xd2a3('0x23')][_0xd2a3('0x24')],function(_0x43150f){return{'name':_0x43150f[_0xd2a3('0x25')],'type':_0x43150f[_0xd2a3('0x26')][_0xd2a3('0x27')]};});_0x12b6ec=qs[_0xd2a3('0x28')](_0xb03e91,_0x2c6481);return interaction[_0xd2a3('0x29')](_0xd2a3('0x2a'),_0x2c6481[_0xd2a3('0x2b')],_0x2c6481[_0xd2a3('0x2c')],_0x12b6ec,_0xb03e91)[_0xd2a3('0x1b')](respondWithFilteredResult(_0x3498ab,_0x12b6ec))[_0xd2a3('0x2d')](handleError(_0x3498ab,null));};exports[_0xd2a3('0x2e')]=function(_0x3178da,_0x29a280){var _0x4c3c33={'raw':![],'where':{'id':_0x3178da[_0xd2a3('0x2f')]['id']}},_0x417b86={};_0x417b86[_0xd2a3('0x30')]=_['keys'](db['FaxInteraction'][_0xd2a3('0x24')]);_0x417b86[_0xd2a3('0x2b')]=_['keys'](_0x3178da[_0xd2a3('0x2b')]);_0x417b86[_0xd2a3('0x31')]=_[_0xd2a3('0x32')](_0x417b86[_0xd2a3('0x30')],_0x417b86[_0xd2a3('0x2b')]);_0x4c3c33[_0xd2a3('0x33')]=_[_0xd2a3('0x32')](_0x417b86['model'],qs['fields'](_0x3178da[_0xd2a3('0x2b')][_0xd2a3('0x34')]));_0x4c3c33['attributes']=_0x4c3c33['attributes']['length']?_0x4c3c33[_0xd2a3('0x33')]:_0x417b86['model'];if(_0x3178da[_0xd2a3('0x2b')][_0xd2a3('0x35')]){_0x4c3c33[_0xd2a3('0x36')]=[{'all':!![]}];}_0x4c3c33=_[_0xd2a3('0x37')]({},_0x4c3c33,_0x3178da[_0xd2a3('0x38')]);return db[_0xd2a3('0x23')][_0xd2a3('0x39')](_0x4c3c33)[_0xd2a3('0x1b')](handleEntityNotFound(_0x29a280,null))[_0xd2a3('0x1b')](respondWithResult(_0x29a280,null))[_0xd2a3('0x2d')](handleError(_0x29a280,null));};exports[_0xd2a3('0x3a')]=function(_0x1bc5db,_0x1d326b){return db[_0xd2a3('0x23')][_0xd2a3('0x3a')](_0x1bc5db['body'],{})['then'](respondWithResult(_0x1d326b,0xc9))[_0xd2a3('0x2d')](handleError(_0x1d326b,null));};exports[_0xd2a3('0x1a')]=function(_0x2297d7,_0x5c1309){if(_0x2297d7[_0xd2a3('0x3b')]['id']){delete _0x2297d7[_0xd2a3('0x3b')]['id'];}return db['FaxInteraction'][_0xd2a3('0x39')]({'where':{'id':_0x2297d7[_0xd2a3('0x2f')]['id']}})[_0xd2a3('0x1b')](handleEntityNotFound(_0x5c1309,null))['then'](saveUpdates(_0x2297d7[_0xd2a3('0x3b')],null))[_0xd2a3('0x1b')](respondWithResult(_0x5c1309,null))['catch'](handleError(_0x5c1309,null));};exports[_0xd2a3('0x1c')]=function(_0xc1dd31,_0xf1a7d){return db[_0xd2a3('0x23')][_0xd2a3('0x39')]({'where':{'id':_0xc1dd31[_0xd2a3('0x2f')]['id']}})[_0xd2a3('0x1b')](handleEntityNotFound(_0xf1a7d,null))['then'](removeEntity(_0xf1a7d,null))[_0xd2a3('0x2d')](handleError(_0xf1a7d,null));};exports['describe']=function(_0x31a2b7,_0x12f344){return db['FaxInteraction'][_0xd2a3('0x3c')]()['then'](respondWithResult(_0x12f344,null))[_0xd2a3('0x2d')](handleError(_0x12f344,null));};exports[_0xd2a3('0x3d')]=function(_0x3b9d1e,_0x3e0d77){return db['FaxMessage'][_0xd2a3('0x39')]({'where':{'id':_0x3b9d1e[_0xd2a3('0x2f')]['id']}})[_0xd2a3('0x1b')](handleEntityNotFound(_0x3e0d77,null))[_0xd2a3('0x1b')](function(_0x57b8a9){if(_0x57b8a9){return _0x57b8a9['addMessage'](_0x3b9d1e[_0xd2a3('0x3b')][_0xd2a3('0x3e')],_['omit'](_0x3b9d1e[_0xd2a3('0x3b')],[_0xd2a3('0x3e'),'id'])||{});}})[_0xd2a3('0x1b')](respondWithResult(_0x3e0d77,null))[_0xd2a3('0x2d')](handleError(_0x3e0d77,null));};exports[_0xd2a3('0x3f')]=function(_0x31af64,_0x5aa026){var _0x54ced0={'raw':![],'where':{}};var _0x397491={};var _0x2a06f1={'count':0x0,'rows':[]};return db[_0xd2a3('0x23')][_0xd2a3('0x40')]({'where':{'id':_0x31af64[_0xd2a3('0x2f')]['id']}})[_0xd2a3('0x1b')](handleEntityNotFound(_0x5aa026,null))[_0xd2a3('0x1b')](function(_0x3b5194){if(_0x3b5194){_0x397491[_0xd2a3('0x30')]=_[_0xd2a3('0x41')](db[_0xd2a3('0x42')][_0xd2a3('0x24')]);_0x397491[_0xd2a3('0x2b')]=_[_0xd2a3('0x41')](_0x31af64[_0xd2a3('0x2b')]);_0x397491[_0xd2a3('0x31')]=_[_0xd2a3('0x32')](_0x397491[_0xd2a3('0x30')],_0x397491[_0xd2a3('0x2b')]);_0x54ced0[_0xd2a3('0x33')]=_[_0xd2a3('0x32')](_0x397491[_0xd2a3('0x30')],qs['fields'](_0x31af64[_0xd2a3('0x2b')]['fields']));_0x54ced0[_0xd2a3('0x33')]=_0x54ced0[_0xd2a3('0x33')][_0xd2a3('0x43')]?_0x54ced0[_0xd2a3('0x33')]:_0x397491[_0xd2a3('0x30')];if(!_0x31af64[_0xd2a3('0x2b')][_0xd2a3('0x44')](_0xd2a3('0x45'))){_0x54ced0[_0xd2a3('0x16')]=qs[_0xd2a3('0x16')](_0x31af64[_0xd2a3('0x2b')][_0xd2a3('0x16')]);_0x54ced0[_0xd2a3('0x15')]=qs[_0xd2a3('0x15')](_0x31af64[_0xd2a3('0x2b')][_0xd2a3('0x15')]);}_0x54ced0['order']=qs[_0xd2a3('0x46')](_0x31af64[_0xd2a3('0x2b')][_0xd2a3('0x46')]);_0x54ced0[_0xd2a3('0x47')]=qs['filters'](_[_0xd2a3('0x48')](_0x31af64['query'],_0x397491[_0xd2a3('0x31')]));_0x54ced0[_0xd2a3('0x47')]['FaxInteractionId']=_0x3b5194['id'];if(_0x31af64[_0xd2a3('0x2b')][_0xd2a3('0x49')]){_0x54ced0[_0xd2a3('0x47')]=_['merge'](_0x54ced0['where'],{'$or':_[_0xd2a3('0x22')](_0x54ced0[_0xd2a3('0x33')],function(_0x494ed7){var _0x136cdf={};_0x136cdf[_0x494ed7]={'$like':'%'+_0x31af64[_0xd2a3('0x2b')][_0xd2a3('0x49')]+'%'};return _0x136cdf;})});}if(_0x31af64[_0xd2a3('0x2b')]['$gte']){var _0xd504fc=_0x31af64['query']['$gte']['split'](',');var _0x3acd3e={};_0x3acd3e[_0xd504fc[0x0]]={'$gte':moment(_0xd504fc[0x1])[_0xd2a3('0x4a')](_0xd2a3('0x4b'))};_0x54ced0['where']=_[_0xd2a3('0x37')](_0x54ced0[_0xd2a3('0x47')],_0x3acd3e);}_0x54ced0=_[_0xd2a3('0x37')]({},_0x54ced0,_0x31af64[_0xd2a3('0x38')]);return db['FaxMessage']['count']({'where':_0x54ced0[_0xd2a3('0x47')]})['then'](function(_0x3d9876){_0x2a06f1[_0xd2a3('0x18')]=_0x3d9876;if(_0x31af64[_0xd2a3('0x2b')][_0xd2a3('0x35')]){_0x54ced0[_0xd2a3('0x36')]=[{'all':!![]}];}return db[_0xd2a3('0x42')][_0xd2a3('0x29')](_0x54ced0);})['then'](function(_0xbb65eb){_0x2a06f1[_0xd2a3('0x4c')]=_0xbb65eb;return _0x2a06f1;});}})[_0xd2a3('0x1b')](respondWithFilteredResult(_0x5aa026,_0x54ced0))[_0xd2a3('0x2d')](handleError(_0x5aa026,null));};exports['addTags']=function(_0x366bfb,_0x1d3ba8){return db[_0xd2a3('0x23')][_0xd2a3('0x39')]({'where':{'id':_0x366bfb['params']['id']}})[_0xd2a3('0x1b')](handleEntityNotFound(_0x1d3ba8,null))[_0xd2a3('0x1b')](function(_0x596346){if(_0x596346){return _0x596346[_0xd2a3('0x4d')](_0x366bfb['body'][_0xd2a3('0x3e')],_[_0xd2a3('0x4e')](_0x366bfb['body'],['ids','id'])||{})[_0xd2a3('0x4f')](function(){return db['Tag'][_0xd2a3('0x29')]({'attributes':['id','name',_0xd2a3('0x50')],'where':{'id':_0x366bfb['body'][_0xd2a3('0x3e')]}});})[_0xd2a3('0x1b')](function(_0x4db5ba){socket[_0xd2a3('0x51')](_0xd2a3('0x52'),{'id':Number(_0x366bfb['params']['id']),'tags':_0x4db5ba||[]});return{'id':Number(_0x366bfb[_0xd2a3('0x2f')]['id']),'tags':_0x4db5ba||[]};});}})[_0xd2a3('0x1b')](respondWithResult(_0x1d3ba8,null))[_0xd2a3('0x2d')](handleError(_0x1d3ba8,null));};exports[_0xd2a3('0x53')]=function(_0x1297b2,_0xdda742){return db[_0xd2a3('0x23')]['find']({'where':{'id':_0x1297b2[_0xd2a3('0x2f')]['id']}})[_0xd2a3('0x1b')](handleEntityNotFound(_0xdda742,null))['then'](function(_0x2bdb58){if(_0x2bdb58){return _0x2bdb58[_0xd2a3('0x53')](_0x1297b2['query']['ids']);}})[_0xd2a3('0x1b')](respondWithStatusCode(_0xdda742,null))[_0xd2a3('0x2d')](handleError(_0xdda742,null));};exports[_0xd2a3('0x54')]=function(_0x112410,_0x375a2e){var _0x30e79f=moment()[_0xd2a3('0x55')]()[_0xd2a3('0x56')]();var _0x470cb1=path[_0xd2a3('0x57')](config[_0xd2a3('0x58')],_0xd2a3('0x59'),_0xd2a3('0x5a'),'tmp');var _0x5b9aac=path[_0xd2a3('0x57')](config[_0xd2a3('0x58')],_0xd2a3('0x59'),_0xd2a3('0x5a'),_0xd2a3('0x5b'));var _0x38475a=path[_0xd2a3('0x57')](_0x470cb1,_0x30e79f);var _0x146179=util[_0xd2a3('0x4a')](_0xd2a3('0x5c'),_0x112410['params']['id'],_0x30e79f);var _0x572f4e=path['join'](_0x470cb1,_0x146179);var _0x482a43=[];_0x482a43['push']({'model':db[_0xd2a3('0x5d')],'as':'Attachment','raw':!![]});var _0x383805=[{'model':db[_0xd2a3('0x42')],'as':_0xd2a3('0x5e'),'attributes':['id','body',_0xd2a3('0x5f')],'include':_0x482a43}];return db[_0xd2a3('0x23')]['find']({'where':{'id':_0x112410[_0xd2a3('0x2f')]['id']},'include':_0x383805})[_0xd2a3('0x1b')](handleEntityNotFound(_0x375a2e,null))['then'](function(_0x784614){if(_0x784614&&_0x784614[_0xd2a3('0x5e')]){var _0x253c1f=_0x784614['get']({'plain':!![]});fs[_0xd2a3('0x60')](_0x38475a);for(var _0x4bf7fe=0x0;_0x4bf7fe<_0x253c1f[_0xd2a3('0x5e')][_0xd2a3('0x43')];_0x4bf7fe++){var _0x1963ea=_0x253c1f[_0xd2a3('0x5e')][_0x4bf7fe][_0xd2a3('0x5d')];if(_0x1963ea){var _0x39c2df=path[_0xd2a3('0x57')](_0x5b9aac,_0x1963ea[_0xd2a3('0x61')]);if(fs[_0xd2a3('0x62')](_0x39c2df)){fs[_0xd2a3('0x63')](_0x39c2df)[_0xd2a3('0x64')](fs[_0xd2a3('0x65')](path[_0xd2a3('0x57')](_0x38475a,_0x1963ea[_0xd2a3('0x61')])));}}}return BPromise['resolve']()[_0xd2a3('0x1b')](function(){return new BPromise(function(_0x1f976e,_0x270502){zipdir(_0x38475a,{'saveTo':_0x572f4e},function(_0x480bf4,_0x991d2b){if(_0x480bf4)return _0x270502(_0x480bf4);return _0x1f976e(_0x991d2b);});})['then'](function(){return new BPromise(function(_0x1abd6a,_0x5c7303){rimraf(_0x38475a,function(_0x19bb5f){if(_0x19bb5f)_0x5c7303(_0x19bb5f);return _0x1abd6a();});});})[_0xd2a3('0x1b')](function(){return _0x375a2e[_0xd2a3('0x54')](_0x572f4e,_0x146179,function(_0x4cb193){if(_0x4cb193){console[_0xd2a3('0x66')]('err',_0x4cb193);}else{fs[_0xd2a3('0x67')](_0x572f4e);}});});});}else{return _0x375a2e['sendStatus'](0xc8);}})[_0xd2a3('0x2d')](handleError(_0x375a2e,null));}; \ No newline at end of file +var _0xff9d=['include','merge','options','FaxInteraction','then','create','body','find','describe','addMessage','omit','getMessages','findOne','FaxMessage','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','rows','addTags','ids','spread','Tag','color','emit','faxInteractionTags:save','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','basename','existsSync','pipe','download','log','unlinkSync','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./faxInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','error','name','send','map','rawAttributes','fieldName','type','key','findAll','fax','query','catch','show','params','keys','filters','intersection','model','attributes','fields','includeAll'];(function(_0x3776d8,_0x1ed0d1){var _0x169295=function(_0x27d1e5){while(--_0x27d1e5){_0x3776d8['push'](_0x3776d8['shift']());}};_0x169295(++_0x1ed0d1);}(_0xff9d,0x16a));var _0xdff9=function(_0x312931,_0x22e92b){_0x312931=_0x312931-0x0;var _0xdf26e5=_0xff9d[_0x312931];return _0xdf26e5;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdff9('0x0'));var moment=require(_0xdff9('0x1'));var BPromise=require(_0xdff9('0x2'));var util=require(_0xdff9('0x3'));var path=require(_0xdff9('0x4'));var fs=require('fs');var _=require(_0xdff9('0x5'));var Redis=require(_0xdff9('0x6'));var interaction=require(_0xdff9('0x7'));var qs=require(_0xdff9('0x8'));var logger=require(_0xdff9('0x9'))(_0xdff9('0xa'));var config=require(_0xdff9('0xb'));var db=require(_0xdff9('0xc'))['db'];config[_0xdff9('0xd')]=_[_0xdff9('0xe')](config[_0xdff9('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdff9('0xd')]));require(_0xdff9('0xf'))[_0xdff9('0x10')](socket);function respondWithStatusCode(_0x5f135c,_0x274d2e){_0x274d2e=_0x274d2e||0xcc;return function(_0x479f0e){if(_0x479f0e){return _0x5f135c[_0xdff9('0x11')](_0x274d2e);}return _0x5f135c['status'](_0x274d2e)[_0xdff9('0x12')]();};}function respondWithResult(_0x5df67e,_0x2d91e5){_0x2d91e5=_0x2d91e5||0xc8;return function(_0x527c28){if(_0x527c28){return _0x5df67e[_0xdff9('0x13')](_0x2d91e5)[_0xdff9('0x14')](_0x527c28);}};}function respondWithFilteredResult(_0x555f16,_0x25e893){return function(_0x5bcaaa){if(_0x5bcaaa){var _0x34bcb7=typeof _0x25e893[_0xdff9('0x15')]==='undefined'&&typeof _0x25e893[_0xdff9('0x16')]===_0xdff9('0x17');var _0x4b822b=_0x5bcaaa[_0xdff9('0x18')];var _0x312225=_0x34bcb7?0x0:_0x25e893[_0xdff9('0x15')];var _0x164116=_0x34bcb7?_0x5bcaaa[_0xdff9('0x18')]:_0x25e893[_0xdff9('0x15')]+_0x25e893[_0xdff9('0x16')];var _0x55bdce;if(_0x164116>=_0x4b822b){_0x164116=_0x4b822b;_0x55bdce=0xc8;}else{_0x55bdce=0xce;}_0x555f16[_0xdff9('0x13')](_0x55bdce);return _0x555f16[_0xdff9('0x19')](_0xdff9('0x1a'),_0x312225+'-'+_0x164116+'/'+_0x4b822b)['json'](_0x5bcaaa);}return null;};}function saveUpdates(_0x2dab6a){return function(_0x194e0f){if(_0x194e0f){return _0x194e0f[_0xdff9('0x1b')](_0x2dab6a)['then'](function(_0x3c615f){return _0x3c615f;});}return null;};}function removeEntity(_0xa4d35d){return function(_0x736b66){if(_0x736b66){return _0x736b66[_0xdff9('0x1c')]()['then'](function(){_0xa4d35d[_0xdff9('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368ed2){return function(_0x48e401){if(!_0x48e401){_0x368ed2[_0xdff9('0x11')](0x194);}return _0x48e401;};}function handleError(_0x591ba1,_0x5cda94){_0x5cda94=_0x5cda94||0x1f4;return function(_0x28e616){logger[_0xdff9('0x1d')](_0x28e616['stack']);if(_0x28e616[_0xdff9('0x1e')]){delete _0x28e616['name'];}_0x591ba1[_0xdff9('0x13')](_0x5cda94)[_0xdff9('0x1f')](_0x28e616);};}exports['index']=function(_0x5df93b,_0x3173f2){var _0x2784b2={};var _0x1e375b=_[_0xdff9('0x20')](db['FaxInteraction'][_0xdff9('0x21')],function(_0x235851){return{'name':_0x235851[_0xdff9('0x22')],'type':_0x235851[_0xdff9('0x23')][_0xdff9('0x24')]};});_0x2784b2=qs['getOptions'](_0x1e375b,_0x5df93b);return interaction[_0xdff9('0x25')](_0xdff9('0x26'),_0x5df93b[_0xdff9('0x27')],_0x5df93b['user'],_0x2784b2,_0x1e375b)['then'](respondWithFilteredResult(_0x3173f2,_0x2784b2))[_0xdff9('0x28')](handleError(_0x3173f2,null));};exports[_0xdff9('0x29')]=function(_0x470679,_0x320aa9){var _0x5cc196={'raw':![],'where':{'id':_0x470679[_0xdff9('0x2a')]['id']}},_0x62110f={};_0x62110f['model']=_[_0xdff9('0x2b')](db['FaxInteraction'][_0xdff9('0x21')]);_0x62110f[_0xdff9('0x27')]=_[_0xdff9('0x2b')](_0x470679[_0xdff9('0x27')]);_0x62110f[_0xdff9('0x2c')]=_[_0xdff9('0x2d')](_0x62110f[_0xdff9('0x2e')],_0x62110f[_0xdff9('0x27')]);_0x5cc196[_0xdff9('0x2f')]=_[_0xdff9('0x2d')](_0x62110f[_0xdff9('0x2e')],qs[_0xdff9('0x30')](_0x470679['query']['fields']));_0x5cc196[_0xdff9('0x2f')]=_0x5cc196[_0xdff9('0x2f')]['length']?_0x5cc196['attributes']:_0x62110f[_0xdff9('0x2e')];if(_0x470679[_0xdff9('0x27')][_0xdff9('0x31')]){_0x5cc196[_0xdff9('0x32')]=[{'all':!![]}];}_0x5cc196=_[_0xdff9('0x33')]({},_0x5cc196,_0x470679[_0xdff9('0x34')]);return db[_0xdff9('0x35')]['find'](_0x5cc196)[_0xdff9('0x36')](handleEntityNotFound(_0x320aa9,null))['then'](respondWithResult(_0x320aa9,null))['catch'](handleError(_0x320aa9,null));};exports[_0xdff9('0x37')]=function(_0x5d6094,_0x33691f){return db[_0xdff9('0x35')]['create'](_0x5d6094[_0xdff9('0x38')],{})['then'](respondWithResult(_0x33691f,0xc9))[_0xdff9('0x28')](handleError(_0x33691f,null));};exports[_0xdff9('0x1b')]=function(_0x354ec3,_0x4fecbe){if(_0x354ec3[_0xdff9('0x38')]['id']){delete _0x354ec3[_0xdff9('0x38')]['id'];}return db[_0xdff9('0x35')][_0xdff9('0x39')]({'where':{'id':_0x354ec3[_0xdff9('0x2a')]['id']}})[_0xdff9('0x36')](handleEntityNotFound(_0x4fecbe,null))[_0xdff9('0x36')](saveUpdates(_0x354ec3[_0xdff9('0x38')],null))['then'](respondWithResult(_0x4fecbe,null))[_0xdff9('0x28')](handleError(_0x4fecbe,null));};exports[_0xdff9('0x1c')]=function(_0x603565,_0xb738a){return db[_0xdff9('0x35')]['find']({'where':{'id':_0x603565[_0xdff9('0x2a')]['id']}})[_0xdff9('0x36')](handleEntityNotFound(_0xb738a,null))[_0xdff9('0x36')](removeEntity(_0xb738a,null))[_0xdff9('0x28')](handleError(_0xb738a,null));};exports[_0xdff9('0x3a')]=function(_0x54db5c,_0x3ed7ac){return db[_0xdff9('0x35')]['describe']()[_0xdff9('0x36')](respondWithResult(_0x3ed7ac,null))[_0xdff9('0x28')](handleError(_0x3ed7ac,null));};exports[_0xdff9('0x3b')]=function(_0x37a89d,_0x4c5140){return db['FaxMessage'][_0xdff9('0x39')]({'where':{'id':_0x37a89d[_0xdff9('0x2a')]['id']}})[_0xdff9('0x36')](handleEntityNotFound(_0x4c5140,null))[_0xdff9('0x36')](function(_0x4b9541){if(_0x4b9541){return _0x4b9541['addMessage'](_0x37a89d[_0xdff9('0x38')]['ids'],_[_0xdff9('0x3c')](_0x37a89d['body'],['ids','id'])||{});}})[_0xdff9('0x36')](respondWithResult(_0x4c5140,null))[_0xdff9('0x28')](handleError(_0x4c5140,null));};exports[_0xdff9('0x3d')]=function(_0x5502e4,_0x5a7681){var _0xb5daf5={'raw':![],'where':{}};var _0x5ebae6={};var _0x2efc61={'count':0x0,'rows':[]};return db[_0xdff9('0x35')][_0xdff9('0x3e')]({'where':{'id':_0x5502e4['params']['id']}})[_0xdff9('0x36')](handleEntityNotFound(_0x5a7681,null))[_0xdff9('0x36')](function(_0x40c444){if(_0x40c444){_0x5ebae6[_0xdff9('0x2e')]=_[_0xdff9('0x2b')](db[_0xdff9('0x3f')][_0xdff9('0x21')]);_0x5ebae6['query']=_[_0xdff9('0x2b')](_0x5502e4[_0xdff9('0x27')]);_0x5ebae6[_0xdff9('0x2c')]=_[_0xdff9('0x2d')](_0x5ebae6['model'],_0x5ebae6['query']);_0xb5daf5['attributes']=_[_0xdff9('0x2d')](_0x5ebae6[_0xdff9('0x2e')],qs[_0xdff9('0x30')](_0x5502e4[_0xdff9('0x27')][_0xdff9('0x30')]));_0xb5daf5[_0xdff9('0x2f')]=_0xb5daf5[_0xdff9('0x2f')][_0xdff9('0x40')]?_0xb5daf5[_0xdff9('0x2f')]:_0x5ebae6[_0xdff9('0x2e')];if(!_0x5502e4[_0xdff9('0x27')][_0xdff9('0x41')](_0xdff9('0x42'))){_0xb5daf5[_0xdff9('0x16')]=qs[_0xdff9('0x16')](_0x5502e4[_0xdff9('0x27')][_0xdff9('0x16')]);_0xb5daf5[_0xdff9('0x15')]=qs[_0xdff9('0x15')](_0x5502e4['query'][_0xdff9('0x15')]);}_0xb5daf5[_0xdff9('0x43')]=qs['sort'](_0x5502e4[_0xdff9('0x27')][_0xdff9('0x44')]);_0xb5daf5[_0xdff9('0x45')]=qs[_0xdff9('0x2c')](_[_0xdff9('0x46')](_0x5502e4[_0xdff9('0x27')],_0x5ebae6['filters']));_0xb5daf5[_0xdff9('0x45')]['FaxInteractionId']=_0x40c444['id'];if(_0x5502e4[_0xdff9('0x27')][_0xdff9('0x47')]){_0xb5daf5[_0xdff9('0x45')]=_[_0xdff9('0x33')](_0xb5daf5['where'],{'$or':_['map'](_0xb5daf5[_0xdff9('0x2f')],function(_0x3f7bfd){var _0x1dce73={};_0x1dce73[_0x3f7bfd]={'$like':'%'+_0x5502e4[_0xdff9('0x27')][_0xdff9('0x47')]+'%'};return _0x1dce73;})});}if(_0x5502e4[_0xdff9('0x27')][_0xdff9('0x48')]){var _0x327a68=_0x5502e4['query'][_0xdff9('0x48')][_0xdff9('0x49')](',');var _0x5aff34={};_0x5aff34[_0x327a68[0x0]]={'$gte':moment(_0x327a68[0x1])[_0xdff9('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0xb5daf5[_0xdff9('0x45')]=_[_0xdff9('0x33')](_0xb5daf5['where'],_0x5aff34);}_0xb5daf5=_['merge']({},_0xb5daf5,_0x5502e4[_0xdff9('0x34')]);return db[_0xdff9('0x3f')][_0xdff9('0x18')]({'where':_0xb5daf5[_0xdff9('0x45')]})[_0xdff9('0x36')](function(_0x30ea1e){_0x2efc61['count']=_0x30ea1e;if(_0x5502e4['query'][_0xdff9('0x31')]){_0xb5daf5['include']=[{'all':!![]}];}return db[_0xdff9('0x3f')]['findAll'](_0xb5daf5);})[_0xdff9('0x36')](function(_0x43d41d){_0x2efc61[_0xdff9('0x4b')]=_0x43d41d;return _0x2efc61;});}})[_0xdff9('0x36')](respondWithFilteredResult(_0x5a7681,_0xb5daf5))[_0xdff9('0x28')](handleError(_0x5a7681,null));};exports[_0xdff9('0x4c')]=function(_0x1f7db2,_0x496154){return db[_0xdff9('0x35')][_0xdff9('0x39')]({'where':{'id':_0x1f7db2['params']['id']}})[_0xdff9('0x36')](handleEntityNotFound(_0x496154,null))[_0xdff9('0x36')](function(_0x5eda40){if(_0x5eda40){return _0x5eda40['setTags'](_0x1f7db2[_0xdff9('0x38')]['ids'],_[_0xdff9('0x3c')](_0x1f7db2[_0xdff9('0x38')],[_0xdff9('0x4d'),'id'])||{})[_0xdff9('0x4e')](function(){return db[_0xdff9('0x4f')][_0xdff9('0x25')]({'attributes':['id',_0xdff9('0x1e'),_0xdff9('0x50')],'where':{'id':_0x1f7db2['body'][_0xdff9('0x4d')]}});})[_0xdff9('0x36')](function(_0x52baaa){socket[_0xdff9('0x51')](_0xdff9('0x52'),{'id':Number(_0x1f7db2[_0xdff9('0x2a')]['id']),'tags':_0x52baaa||[]});return{'id':Number(_0x1f7db2[_0xdff9('0x2a')]['id']),'tags':_0x52baaa||[]};});}})[_0xdff9('0x36')](respondWithResult(_0x496154,null))[_0xdff9('0x28')](handleError(_0x496154,null));};exports['removeTags']=function(_0x38f50d,_0x3d03d0){return db[_0xdff9('0x35')][_0xdff9('0x39')]({'where':{'id':_0x38f50d[_0xdff9('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3d03d0,null))[_0xdff9('0x36')](function(_0x1e2352){if(_0x1e2352){return _0x1e2352['removeTags'](_0x38f50d[_0xdff9('0x27')][_0xdff9('0x4d')]);}})[_0xdff9('0x36')](respondWithStatusCode(_0x3d03d0,null))[_0xdff9('0x28')](handleError(_0x3d03d0,null));};exports['download']=function(_0x20f357,_0xdc39){var _0x5e8b36=moment()[_0xdff9('0x53')]()[_0xdff9('0x54')]();var _0x39aa36=path[_0xdff9('0x55')](config[_0xdff9('0x56')],_0xdff9('0x57'),_0xdff9('0x58'),'tmp');var _0x33916e=path['join'](config[_0xdff9('0x56')],_0xdff9('0x57'),_0xdff9('0x58'),_0xdff9('0x59'));var _0x42ce86=path[_0xdff9('0x55')](_0x39aa36,_0x5e8b36);var _0x278f55=util['format'](_0xdff9('0x5a'),_0x20f357['params']['id'],_0x5e8b36);var _0x1889bb=path[_0xdff9('0x55')](_0x39aa36,_0x278f55);var _0x3e9990=[];_0x3e9990[_0xdff9('0x5b')]({'model':db['Attachment'],'as':_0xdff9('0x5c'),'raw':!![]});var _0x3c7a72=[{'model':db[_0xdff9('0x3f')],'as':'Messages','attributes':['id',_0xdff9('0x38'),_0xdff9('0x5d')],'include':_0x3e9990}];return db[_0xdff9('0x35')][_0xdff9('0x39')]({'where':{'id':_0x20f357[_0xdff9('0x2a')]['id']},'include':_0x3c7a72})[_0xdff9('0x36')](handleEntityNotFound(_0xdc39,null))[_0xdff9('0x36')](function(_0xf9077b){if(_0xf9077b&&_0xf9077b[_0xdff9('0x5e')]){var _0x316ed9=_0xf9077b[_0xdff9('0x5f')]({'plain':!![]});fs[_0xdff9('0x60')](_0x42ce86);for(var _0x5a0ec2=0x0;_0x5a0ec2<_0x316ed9[_0xdff9('0x5e')][_0xdff9('0x40')];_0x5a0ec2++){var _0xc11e58=_0x316ed9[_0xdff9('0x5e')][_0x5a0ec2][_0xdff9('0x5c')];if(_0xc11e58){var _0x330156=path['join'](_0x33916e,_0xc11e58[_0xdff9('0x61')]);if(fs[_0xdff9('0x62')](_0x330156)){fs['createReadStream'](_0x330156)[_0xdff9('0x63')](fs['createWriteStream'](path[_0xdff9('0x55')](_0x42ce86,_0xc11e58['basename'])));}}}return BPromise['resolve']()[_0xdff9('0x36')](function(){return new BPromise(function(_0x310ab6,_0xe2db96){zipdir(_0x42ce86,{'saveTo':_0x1889bb},function(_0x267040,_0x2c2494){if(_0x267040)return _0xe2db96(_0x267040);return _0x310ab6(_0x2c2494);});})[_0xdff9('0x36')](function(){return new BPromise(function(_0x1dc0bb,_0x574eee){rimraf(_0x42ce86,function(_0x279ba6){if(_0x279ba6)_0x574eee(_0x279ba6);return _0x1dc0bb();});});})[_0xdff9('0x36')](function(){return _0xdc39[_0xdff9('0x64')](_0x1889bb,_0x278f55,function(_0x4e9953){if(_0x4e9953){console[_0xdff9('0x65')]('err',_0x4e9953);}else{fs[_0xdff9('0x66')](_0x1889bb);}});});});}else{return _0xdc39[_0xdff9('0x11')](0xc8);}})['catch'](handleError(_0xdc39,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 79fe419..5219f5c 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 _0x574b=['catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','update','getUsers','then','setDataValue','map','findAll','length','emit'];(function(_0x1676c3,_0xf3fe77){var _0x3b8b48=function(_0x1a01d5){while(--_0x1a01d5){_0x1676c3['push'](_0x1676c3['shift']());}};_0x3b8b48(++_0xf3fe77);}(_0x574b,0xa8));var _0xb574=function(_0x2ba3ab,_0x2b62bd){_0x2ba3ab=_0x2ba3ab-0x0;var _0x40c19a=_0x574b[_0x2ba3ab];return _0x40c19a;};'use strict';var EventEmitter=require(_0xb574('0x0'));var FaxInteraction=require(_0xb574('0x1'))['db'][_0xb574('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xb574('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb574('0x4'),'afterDestroy':'remove'};function emitEvent(_0x81c1a2){return function(_0x3a2507,_0x3e7e9e,_0x2f0885){_0x3a2507[_0xb574('0x5')]({'attributes':['id'],'raw':!![]})[_0xb574('0x6')](function(_0x3f6d54){_0x3a2507[_0xb574('0x7')]('Users',_0x3f6d54[_0xb574('0x8')](function(_0x2cd7da){return{'id':_0x2cd7da['id']};}));return FaxMessage[_0xb574('0x9')]({'where':{'FaxInteractionId':_0x3a2507['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb574('0x6')](function(_0x3dc381){_0x3a2507[_0xb574('0x7')]('unreadMessages',_0x3dc381[_0xb574('0xa')]);FaxInteractionEvents[_0xb574('0xb')](_0x81c1a2+':'+_0x3a2507['id'],_0x3a2507);FaxInteractionEvents[_0xb574('0xb')](_0x81c1a2,_0x3a2507);_0x2f0885(null);})[_0xb574('0xc')](_0x2f0885(null));};}for(var e in events){if(events[_0xb574('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb574('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0xc2fb=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','then','setDataValue','Users','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2fb,0x15f));var _0xbc2f=function(_0x3fb6c7,_0x1b9102){_0x3fb6c7=_0x3fb6c7-0x0;var _0x198107=_0xc2fb[_0x3fb6c7];return _0x198107;};'use strict';var EventEmitter=require(_0xbc2f('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xbc2f('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xbc2f('0x2')](0x0);var events={'afterCreate':_0xbc2f('0x3'),'afterUpdate':_0xbc2f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48ea23){return function(_0x7a62e2,_0x198489,_0x380c0a){_0x7a62e2['getUsers']({'attributes':['id'],'raw':!![]})[_0xbc2f('0x5')](function(_0x55c467){_0x7a62e2[_0xbc2f('0x6')](_0xbc2f('0x7'),_0x55c467[_0xbc2f('0x8')](function(_0x1e41d0){return{'id':_0x1e41d0['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x7a62e2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x8d868d){_0x7a62e2[_0xbc2f('0x6')](_0xbc2f('0x9'),_0x8d868d[_0xbc2f('0xa')]);FaxInteractionEvents[_0xbc2f('0xb')](_0x48ea23+':'+_0x7a62e2['id'],_0x7a62e2);FaxInteractionEvents['emit'](_0x48ea23,_0x7a62e2);_0x380c0a(null);})[_0xbc2f('0xc')](_0x380c0a(null));};}for(var e in events){if(events[_0xbc2f('0xd')](e)){var event=events[e];FaxInteraction[_0xbc2f('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 44c0fac..880c727 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 _0xabf4=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x41dc50,_0x13a0bf){var _0x19a994=function(_0x5de890){while(--_0x5de890){_0x41dc50['push'](_0x41dc50['shift']());}};_0x19a994(++_0x13a0bf);}(_0xabf4,0x196));var _0x4abf=function(_0xdf0b8,_0x15bda2){_0xdf0b8=_0xdf0b8-0x0;var _0x130c5a=_0xabf4[_0xdf0b8];return _0x130c5a;};'use strict';var _=require(_0x4abf('0x0'));var util=require(_0x4abf('0x1'));var logger=require(_0x4abf('0x2'))(_0x4abf('0x3'));var moment=require(_0x4abf('0x4'));var BPromise=require(_0x4abf('0x5'));var rp=require(_0x4abf('0x6'));var fs=require('fs');var path=require(_0x4abf('0x7'));var rimraf=require('rimraf');var config=require(_0x4abf('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x4abf('0x9')]=function(_0x2ce396,_0x2f4d30){return _0x2ce396['define'](_0x4abf('0xa'),attributes,{'tableName':_0x4abf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15b1c7,_0x563c9e,_0x563d7f){if(_0x15b1c7[_0x4abf('0xc')](_0x4abf('0xd'))){_0x15b1c7[_0x4abf('0xe')]=moment()[_0x4abf('0xf')](_0x4abf('0x10'));}_0x563d7f(null,_0x15b1c7);}}});}; \ No newline at end of file +var _0x1806=['./faxInteraction.attributes','exports','define','changed','closed','format','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x10b2f4,_0x2a7e9f){var _0x18fdde=function(_0x292883){while(--_0x292883){_0x10b2f4['push'](_0x10b2f4['shift']());}};_0x18fdde(++_0x2a7e9f);}(_0x1806,0x162));var _0x6180=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1806[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x6180('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6180('0x1'));var moment=require(_0x6180('0x2'));var BPromise=require(_0x6180('0x3'));var rp=require(_0x6180('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6180('0x5'));var config=require('../../config/environment');var attributes=require(_0x6180('0x6'));module[_0x6180('0x7')]=function(_0x3fde2a,_0x58f8b3){return _0x3fde2a[_0x6180('0x8')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x473be9,_0x3b75c1,_0x474cb7){if(_0x473be9[_0x6180('0x9')](_0x6180('0xa'))){_0x473be9['closedAt']=moment()[_0x6180('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x474cb7(null,_0x473be9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1135762..4459ab2 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 _0xbd7c=['message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','AddTagsToFaxInteraction','addTags','ids','AddTags','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x57ceaf,_0x4f10ca){var _0x42ee8f=function(_0x1ff7ab){while(--_0x1ff7ab){_0x57ceaf['push'](_0x57ceaf['shift']());}};_0x42ee8f(++_0x4f10ca);}(_0xbd7c,0x87));var _0xcbd7=function(_0x21df10,_0x55bcbe){_0x21df10=_0x21df10-0x0;var _0x181777=_0xbd7c[_0x21df10];return _0x181777;};'use strict';var _=require(_0xcbd7('0x0'));var util=require(_0xcbd7('0x1'));var moment=require(_0xcbd7('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbd7('0x3'));var fs=require('fs');var Redis=require(_0xcbd7('0x4'));var db=require(_0xcbd7('0x5'))['db'];var utils=require(_0xcbd7('0x6'));var logger=require('../../config/logger')(_0xcbd7('0x7'));var config=require(_0xcbd7('0x8'));var jayson=require(_0xcbd7('0x9'));var client=jayson[_0xcbd7('0xa')][_0xcbd7('0xb')]({'port':0x232a});config[_0xcbd7('0xc')]=_['defaults'](config[_0xcbd7('0xc')],{'host':_0xcbd7('0xd'),'port':0x18eb});var socket=require(_0xcbd7('0xe'))(new Redis(config[_0xcbd7('0xc')]));require(_0xcbd7('0xf'))[_0xcbd7('0x10')](socket);function respondWithRpcPromise(_0xd2ae8e,_0x939c28,_0x2ec658){return new BPromise(function(_0x54b2ec,_0x3ac292){return client[_0xcbd7('0x11')](_0xd2ae8e,_0x2ec658)[_0xcbd7('0x12')](function(_0x191347){logger[_0xcbd7('0x13')](_0xcbd7('0x14'),_0x939c28,_0xcbd7('0x15'));logger[_0xcbd7('0x16')](_0xcbd7('0x17'),_0x939c28,_0xcbd7('0x15'),JSON['stringify'](_0x191347));if(_0x191347[_0xcbd7('0x18')]){if(_0x191347[_0xcbd7('0x18')]['code']===0x1f4){logger[_0xcbd7('0x18')](_0xcbd7('0x14'),_0x939c28,_0x191347[_0xcbd7('0x18')][_0xcbd7('0x19')]);return _0x3ac292(_0x191347[_0xcbd7('0x18')][_0xcbd7('0x19')]);}logger[_0xcbd7('0x18')](_0xcbd7('0x14'),_0x939c28,_0x191347[_0xcbd7('0x18')]['message']);return _0x54b2ec(_0x191347[_0xcbd7('0x18')]['message']);}else{logger[_0xcbd7('0x13')](_0xcbd7('0x14'),_0x939c28,_0xcbd7('0x15'));_0x54b2ec(_0x191347['result'][_0xcbd7('0x19')]);}})[_0xcbd7('0x1a')](function(_0x4d1827){logger[_0xcbd7('0x18')](_0xcbd7('0x14'),_0x939c28,_0x4d1827);_0x3ac292(_0x4d1827);});});}exports[_0xcbd7('0x1b')]=function(_0x50465e){var _0x5d7ab2=this;return new Promise(function(_0x351c75,_0x3120aa){return db[_0xcbd7('0x1c')][_0xcbd7('0x1d')](_0x50465e[_0xcbd7('0x1e')],{'raw':_0x50465e[_0xcbd7('0x1f')]?_0x50465e[_0xcbd7('0x1f')][_0xcbd7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50465e[_0xcbd7('0x1f')]?_0x50465e['options'][_0xcbd7('0x21')]||null:null,'attributes':_0x50465e[_0xcbd7('0x1f')]?_0x50465e[_0xcbd7('0x1f')]['attributes']||null:null,'limit':_0x50465e['options']?_0x50465e['options'][_0xcbd7('0x22')]||null:null})['then'](function(_0x34ae41){logger[_0xcbd7('0x13')](_0xcbd7('0x1b'),_0x50465e);logger[_0xcbd7('0x16')](_0xcbd7('0x1b'),_0x50465e,JSON['stringify'](_0x34ae41));_0x351c75(_0x34ae41);})['catch'](function(_0x4041df){logger[_0xcbd7('0x18')](_0xcbd7('0x1b'),_0x4041df[_0xcbd7('0x19')],_0x50465e);_0x3120aa(_0x5d7ab2[_0xcbd7('0x18')](0x1f4,_0x4041df[_0xcbd7('0x19')]));});});};exports[_0xcbd7('0x23')]=function(_0x40acd9){return new Promise(function(_0x42b440,_0x528070){return db['FaxInteraction']['find']({'where':_0x40acd9[_0xcbd7('0x1f')]?_0x40acd9[_0xcbd7('0x1f')]['where']||null:null})[_0xcbd7('0x12')](function(_0x131258){if(_0x131258){return _0x131258[_0xcbd7('0x24')](_0x40acd9[_0xcbd7('0x1e')]['ids'],_['omit'](_0x40acd9[_0xcbd7('0x1e')],[_0xcbd7('0x25'),'id'])||{});}})['spread'](function(_0x390e15){logger['info']('AddTags',_0x40acd9);logger['debug'](_0xcbd7('0x26'),_0x40acd9,JSON[_0xcbd7('0x27')](_0x390e15));_0x42b440(_0x390e15);})[_0xcbd7('0x1a')](function(_0x18739c){logger[_0xcbd7('0x18')](_0xcbd7('0x26'),_0x18739c[_0xcbd7('0x19')],_0x40acd9);_0x528070(_this[_0xcbd7('0x18')](0x1f4,_0x18739c[_0xcbd7('0x19')]));});});}; \ No newline at end of file +var _0xc77d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc77d,0x108));var _0xdc77=function(_0x22b98c,_0x3cc5dc){_0x22b98c=_0x22b98c-0x0;var _0x5e846e=_0xc77d[_0x22b98c];return _0x5e846e;};'use strict';var _=require(_0xdc77('0x0'));var util=require(_0xdc77('0x1'));var moment=require(_0xdc77('0x2'));var BPromise=require(_0xdc77('0x3'));var rs=require(_0xdc77('0x4'));var fs=require('fs');var Redis=require(_0xdc77('0x5'));var db=require(_0xdc77('0x6'))['db'];var utils=require(_0xdc77('0x7'));var logger=require(_0xdc77('0x8'))(_0xdc77('0x9'));var config=require(_0xdc77('0xa'));var jayson=require(_0xdc77('0xb'));var client=jayson[_0xdc77('0xc')][_0xdc77('0xd')]({'port':0x232a});config[_0xdc77('0xe')]=_['defaults'](config[_0xdc77('0xe')],{'host':_0xdc77('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc77('0xe')]));require(_0xdc77('0x10'))[_0xdc77('0x11')](socket);function respondWithRpcPromise(_0x5086d3,_0x2a07dd,_0x951217){return new BPromise(function(_0x4c0b5d,_0x170130){return client[_0xdc77('0x12')](_0x5086d3,_0x951217)[_0xdc77('0x13')](function(_0x5d92d0){logger[_0xdc77('0x14')](_0xdc77('0x15'),_0x2a07dd,'request\x20sent');logger[_0xdc77('0x16')](_0xdc77('0x17'),_0x2a07dd,_0xdc77('0x18'),JSON[_0xdc77('0x19')](_0x5d92d0));if(_0x5d92d0['error']){if(_0x5d92d0[_0xdc77('0x1a')][_0xdc77('0x1b')]===0x1f4){logger[_0xdc77('0x1a')]('FaxInteraction,\x20%s,\x20%s',_0x2a07dd,_0x5d92d0[_0xdc77('0x1a')][_0xdc77('0x1c')]);return _0x170130(_0x5d92d0[_0xdc77('0x1a')][_0xdc77('0x1c')]);}logger['error'](_0xdc77('0x15'),_0x2a07dd,_0x5d92d0['error']['message']);return _0x4c0b5d(_0x5d92d0[_0xdc77('0x1a')]['message']);}else{logger[_0xdc77('0x14')](_0xdc77('0x15'),_0x2a07dd,'request\x20sent');_0x4c0b5d(_0x5d92d0[_0xdc77('0x1d')][_0xdc77('0x1c')]);}})[_0xdc77('0x1e')](function(_0x458721){logger[_0xdc77('0x1a')](_0xdc77('0x15'),_0x2a07dd,_0x458721);_0x170130(_0x458721);});});}exports[_0xdc77('0x1f')]=function(_0x528ffc){var _0x335c0e=this;return new Promise(function(_0x3cee01,_0x467901){return db['FaxInteraction'][_0xdc77('0x20')](_0x528ffc[_0xdc77('0x21')],{'raw':_0x528ffc[_0xdc77('0x22')]?_0x528ffc[_0xdc77('0x22')][_0xdc77('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x528ffc['options']?_0x528ffc[_0xdc77('0x22')][_0xdc77('0x24')]||null:null,'attributes':_0x528ffc[_0xdc77('0x22')]?_0x528ffc[_0xdc77('0x22')][_0xdc77('0x25')]||null:null,'limit':_0x528ffc[_0xdc77('0x22')]?_0x528ffc[_0xdc77('0x22')][_0xdc77('0x26')]||null:null})[_0xdc77('0x13')](function(_0x1a8c8b){logger[_0xdc77('0x14')](_0xdc77('0x1f'),_0x528ffc);logger['debug']('UpdateFaxInteraction',_0x528ffc,JSON[_0xdc77('0x19')](_0x1a8c8b));_0x3cee01(_0x1a8c8b);})[_0xdc77('0x1e')](function(_0x435721){logger[_0xdc77('0x1a')](_0xdc77('0x1f'),_0x435721['message'],_0x528ffc);_0x467901(_0x335c0e[_0xdc77('0x1a')](0x1f4,_0x435721[_0xdc77('0x1c')]));});});};exports[_0xdc77('0x27')]=function(_0x5a82c0){return new Promise(function(_0x238f5e,_0x280810){return db[_0xdc77('0x28')][_0xdc77('0x29')]({'where':_0x5a82c0[_0xdc77('0x22')]?_0x5a82c0[_0xdc77('0x22')][_0xdc77('0x24')]||null:null})['then'](function(_0x10c663){if(_0x10c663){return _0x10c663[_0xdc77('0x2a')](_0x5a82c0['body']['ids'],_[_0xdc77('0x2b')](_0x5a82c0[_0xdc77('0x21')],['ids','id'])||{});}})['spread'](function(_0x3549d7){logger['info'](_0xdc77('0x2c'),_0x5a82c0);logger[_0xdc77('0x16')](_0xdc77('0x2c'),_0x5a82c0,JSON[_0xdc77('0x19')](_0x3549d7));_0x238f5e(_0x3549d7);})[_0xdc77('0x1e')](function(_0x40c2bd){logger['error'](_0xdc77('0x2c'),_0x40c2bd[_0xdc77('0x1c')],_0x5a82c0);_0x280810(_this[_0xdc77('0x1a')](0x1f4,_0x40c2bd[_0xdc77('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index aa58021..3766a5c 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 _0x716f=['length','faxInteraction:','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x304976,_0x14432b){var _0xb73047=function(_0x5d4e01){while(--_0x5d4e01){_0x304976['push'](_0x304976['shift']());}};_0xb73047(++_0x14432b);}(_0x716f,0x175));var _0xf716=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x716f[_0x4b055c];return _0x4b62bb;};'use strict';var FaxInteractionEvents=require(_0xf716('0x0'));var events=[_0xf716('0x1'),_0xf716('0x2'),_0xf716('0x3')];function createListener(_0x627bc3,_0x1fa00d){return function(_0x12bd64){_0x1fa00d['emit'](_0x627bc3,_0x12bd64);};}function removeListener(_0x53b2ab,_0x5b1632){return function(){FaxInteractionEvents[_0xf716('0x4')](_0x53b2ab,_0x5b1632);};}exports['register']=function(_0x2b0218){for(var _0x37df92=0x0,_0x83dbdd=events[_0xf716('0x5')];_0x37df92<_0x83dbdd;_0x37df92++){var _0x1476d6=events[_0x37df92];var _0x56a06a=createListener(_0xf716('0x6')+_0x1476d6,_0x2b0218);FaxInteractionEvents['on'](_0x1476d6,_0x56a06a);}}; \ No newline at end of file +var _0xe869=['length','./faxInteraction.events','save','remove','emit','removeListener','register'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xe869,0x1a5));var _0x9e86=function(_0x22bf47,_0x5b3cfd){_0x22bf47=_0x22bf47-0x0;var _0x63e280=_0xe869[_0x22bf47];return _0x63e280;};'use strict';var FaxInteractionEvents=require(_0x9e86('0x0'));var events=[_0x9e86('0x1'),_0x9e86('0x2'),'update'];function createListener(_0x13d82b,_0x292340){return function(_0x3223ee){_0x292340[_0x9e86('0x3')](_0x13d82b,_0x3223ee);};}function removeListener(_0x2a1393,_0x4e4061){return function(){FaxInteractionEvents[_0x9e86('0x4')](_0x2a1393,_0x4e4061);};}exports[_0x9e86('0x5')]=function(_0x20da51){for(var _0x1bb4e2=0x0,_0x79f8df=events[_0x9e86('0x6')];_0x1bb4e2<_0x79f8df;_0x1bb4e2++){var _0x5d6dce=events[_0x1bb4e2];var _0x257e7d=createListener('faxInteraction:'+_0x5d6dce,_0x20da51);FaxInteractionEvents['on'](_0x5d6dce,_0x257e7d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ccf21a7..bd64ebd 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 _0xafa5=['tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags'];(function(_0x528651,_0x5b7765){var _0x57cede=function(_0xb884b4){while(--_0xb884b4){_0x528651['push'](_0x528651['shift']());}};_0x57cede(++_0x5b7765);}(_0xafa5,0x1af));var _0x5afa=function(_0x2e4ad5,_0x4b602e){_0x2e4ad5=_0x2e4ad5-0x0;var _0x3b236d=_0xafa5[_0x2e4ad5];return _0x3b236d;};'use strict';var multer=require('multer');var util=require(_0x5afa('0x0'));var path=require(_0x5afa('0x1'));var timeout=require(_0x5afa('0x2'));var express=require(_0x5afa('0x3'));var router=express[_0x5afa('0x4')]();var fs_extra=require(_0x5afa('0x5'));var auth=require(_0x5afa('0x6'));var interaction=require(_0x5afa('0x7'));var config=require(_0x5afa('0x8'));var controller=require(_0x5afa('0x9'));router[_0x5afa('0xa')]('/',auth['isAuthenticated'](),controller[_0x5afa('0xb')]);router[_0x5afa('0xa')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0xe')]);router[_0x5afa('0xa')](_0x5afa('0xf'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x10')]);router['get']('/:id/messages',auth[_0x5afa('0xd')](),controller[_0x5afa('0x11')]);router[_0x5afa('0xa')](_0x5afa('0x12'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x13')]);router[_0x5afa('0x14')]('/',auth[_0x5afa('0xd')](),controller['create']);router[_0x5afa('0x14')](_0x5afa('0x15'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x16')]);router[_0x5afa('0x14')](_0x5afa('0x17'),auth['isAuthenticated'](),interaction[_0x5afa('0x18')](_0x5afa('0x19'),_0x5afa('0x1a')),controller[_0x5afa('0x1b')]);router[_0x5afa('0x1c')](_0x5afa('0xf'),auth[_0x5afa('0xd')](),interaction['tracked'](_0x5afa('0x19'),_0x5afa('0x1d')),controller['update']);router[_0x5afa('0x1e')](_0x5afa('0xf'),auth[_0x5afa('0xd')](),interaction[_0x5afa('0x18')](_0x5afa('0x19'),_0x5afa('0x1f')),controller[_0x5afa('0x20')]);router['delete'](_0x5afa('0x17'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x21')]);module[_0x5afa('0x22')]=router; \ No newline at end of file +var _0xe1cd=['/:id/download','download','post','create','/:id/tags','fax','addTags','faxinteraction:update','update','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages'];(function(_0x62486b,_0x24308e){var _0x5c4153=function(_0x31d9ac){while(--_0x31d9ac){_0x62486b['push'](_0x62486b['shift']());}};_0x5c4153(++_0x24308e);}(_0xe1cd,0x175));var _0xde1c=function(_0x345cf5,_0x106286){_0x345cf5=_0x345cf5-0x0;var _0x4cbb13=_0xe1cd[_0x345cf5];return _0x4cbb13;};'use strict';var multer=require(_0xde1c('0x0'));var util=require(_0xde1c('0x1'));var path=require(_0xde1c('0x2'));var timeout=require(_0xde1c('0x3'));var express=require(_0xde1c('0x4'));var router=express['Router']();var fs_extra=require(_0xde1c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xde1c('0x6'));var controller=require(_0xde1c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xde1c('0x8')]);router[_0xde1c('0x9')](_0xde1c('0xa'),auth[_0xde1c('0xb')](),controller[_0xde1c('0xc')]);router['get'](_0xde1c('0xd'),auth[_0xde1c('0xb')](),controller[_0xde1c('0xe')]);router[_0xde1c('0x9')](_0xde1c('0xf'),auth[_0xde1c('0xb')](),controller[_0xde1c('0x10')]);router['get'](_0xde1c('0x11'),auth[_0xde1c('0xb')](),controller[_0xde1c('0x12')]);router[_0xde1c('0x13')]('/',auth[_0xde1c('0xb')](),controller[_0xde1c('0x14')]);router[_0xde1c('0x13')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xde1c('0x13')](_0xde1c('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xde1c('0x16'),'faxinteraction:addtags'),controller[_0xde1c('0x17')]);router['put']('/:id',auth[_0xde1c('0xb')](),interaction['tracked'](_0xde1c('0x16'),_0xde1c('0x18')),controller[_0xde1c('0x19')]);router[_0xde1c('0x1a')](_0xde1c('0xd'),auth[_0xde1c('0xb')](),interaction[_0xde1c('0x1b')](_0xde1c('0x16'),'faxinteraction:destroy'),controller['destroy']);router[_0xde1c('0x1a')](_0xde1c('0x15'),auth[_0xde1c('0xb')](),controller[_0xde1c('0x1c')]);module[_0xde1c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 4adf2d1..f5f7377 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 _0x222f=['sequelize','exports','TEXT','medium','out','DATE'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x222f,0x1a4));var _0xf222=function(_0x553145,_0x4f9ab8){_0x553145=_0x553145-0x0;var _0x11cfbd=_0x222f[_0x553145];return _0x11cfbd;};'use strict';var Sequelize=require(_0xf222('0x0'));module[_0xf222('0x1')]={'body':{'type':Sequelize[_0xf222('0x2')](_0xf222('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf222('0x4')),'defaultValue':_0xf222('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf222('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf222('0x5')]}}; \ No newline at end of file +var _0x3645=['BOOLEAN','ENUM','out','DATE','exports','TEXT','medium'];(function(_0x4627d0,_0x1ea20d){var _0x4a9744=function(_0x3cc436){while(--_0x3cc436){_0x4627d0['push'](_0x4627d0['shift']());}};_0x4a9744(++_0x1ea20d);}(_0x3645,0x154));var _0x5364=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x3645[_0x4503df];return _0x3f1b2b;};'use strict';var Sequelize=require('sequelize');module[_0x5364('0x0')]={'body':{'type':Sequelize[_0x5364('0x1')](_0x5364('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5364('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5364('0x4')]('in',_0x5364('0x5')),'defaultValue':_0x5364('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5364('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 395f920..815ea18 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 _0xa51f=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxMessage','include','findAll','rows','show','params','rawAttributes','includeAll','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','fullname','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','attachments','basename','eml-format'];(function(_0x48ccb1,_0x5b0f2e){var _0x21179a=function(_0x19522e){while(--_0x19522e){_0x48ccb1['push'](_0x48ccb1['shift']());}};_0x21179a(++_0x5b0f2e);}(_0xa51f,0x90));var _0xfa51=function(_0x33cab0,_0x4dc044){_0x33cab0=_0x33cab0-0x0;var _0x4fbfb7=_0xa51f[_0x33cab0];return _0x4fbfb7;};'use strict';var emlformat=require(_0xfa51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa51('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa51('0x2'));var moment=require(_0xfa51('0x3'));var BPromise=require(_0xfa51('0x4'));var Mustache=require(_0xfa51('0x5'));var util=require(_0xfa51('0x6'));var path=require(_0xfa51('0x7'));var sox=require(_0xfa51('0x8'));var csv=require(_0xfa51('0x9'));var ejs=require(_0xfa51('0xa'));var fs=require('fs');var fs_extra=require(_0xfa51('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfa51('0xc'));var toCsv=require(_0xfa51('0x9'));var querystring=require(_0xfa51('0xd'));var Papa=require(_0xfa51('0xe'));var Redis=require(_0xfa51('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfa51('0x10'));var as=require(_0xfa51('0x11'));var hardwareService=require(_0xfa51('0x12'));var logger=require(_0xfa51('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfa51('0x14'));var db=require(_0xfa51('0x15'))['db'];config[_0xfa51('0x16')]=_[_0xfa51('0x17')](config[_0xfa51('0x16')],{'host':_0xfa51('0x18'),'port':0x18eb});var socket=require(_0xfa51('0x19'))(new Redis(config['redis']));require(_0xfa51('0x1a'))[_0xfa51('0x1b')](socket);var jayson=require(_0xfa51('0x1c'));var client=jayson[_0xfa51('0x1d')][_0xfa51('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x369cd1,_0x3adaf6,_0x34048f,_0x370d92){return new BPromise(function(_0x16741e,_0x52bb2e){var _0x5bb277=_0x370d92||client;return _0x5bb277[_0xfa51('0x1f')](_0x369cd1,_0x34048f)[_0xfa51('0x20')](function(_0x4c30f7){logger[_0xfa51('0x21')](_0xfa51('0x22'),_0x3adaf6,'request\x20sent');logger[_0xfa51('0x23')](_0xfa51('0x24'),_0x3adaf6,'request\x20sent',JSON[_0xfa51('0x25')](_0x4c30f7));if(_0x4c30f7[_0xfa51('0x26')]){if(_0x4c30f7['error'][_0xfa51('0x27')]===0x1f4){logger[_0xfa51('0x26')](_0xfa51('0x22'),_0x3adaf6,_0x4c30f7['error'][_0xfa51('0x28')]);return _0x52bb2e(_0x4c30f7[_0xfa51('0x26')][_0xfa51('0x28')]);}logger[_0xfa51('0x26')](_0xfa51('0x22'),_0x3adaf6,_0x4c30f7[_0xfa51('0x26')]['message']);return _0x16741e(_0x4c30f7[_0xfa51('0x26')][_0xfa51('0x28')]);}else{logger[_0xfa51('0x21')]('FaxMessage,\x20%s,\x20%s',_0x3adaf6,_0xfa51('0x29'));_0x16741e(_0x4c30f7[_0xfa51('0x2a')][_0xfa51('0x28')]);}})[_0xfa51('0x2b')](function(_0x93bde8){logger[_0xfa51('0x26')]('FaxMessage,\x20%s,\x20%s',_0x3adaf6,_0x93bde8);_0x52bb2e(_0x93bde8);});});}function respondWithStatusCode(_0x9a9cbc,_0x7a0f9e){_0x7a0f9e=_0x7a0f9e||0xcc;return function(_0x2643ab){if(_0x2643ab){return _0x9a9cbc['sendStatus'](_0x7a0f9e);}return _0x9a9cbc[_0xfa51('0x2c')](_0x7a0f9e)['end']();};}function respondWithResult(_0x3067d,_0x276ddd){_0x276ddd=_0x276ddd||0xc8;return function(_0x4d967f){if(_0x4d967f){return _0x3067d['status'](_0x276ddd)[_0xfa51('0x2d')](_0x4d967f);}};}function respondWithFilteredResult(_0x58c462,_0x3842f9){return function(_0xfba35){if(_0xfba35){var _0x4e3a8f=typeof _0x3842f9[_0xfa51('0x2e')]===_0xfa51('0x2f')&&typeof _0x3842f9[_0xfa51('0x30')]===_0xfa51('0x2f');var _0x13d5d0=_0xfba35['count'];var _0x466cec=_0x4e3a8f?0x0:_0x3842f9[_0xfa51('0x2e')];var _0x1d60d8=_0x4e3a8f?_0xfba35[_0xfa51('0x31')]:_0x3842f9[_0xfa51('0x2e')]+_0x3842f9['limit'];var _0x19600a;if(_0x1d60d8>=_0x13d5d0){_0x1d60d8=_0x13d5d0;_0x19600a=0xc8;}else{_0x19600a=0xce;}_0x58c462[_0xfa51('0x2c')](_0x19600a);return _0x58c462[_0xfa51('0x32')](_0xfa51('0x33'),_0x466cec+'-'+_0x1d60d8+'/'+_0x13d5d0)[_0xfa51('0x2d')](_0xfba35);}return null;};}function patchUpdates(_0x21ccc7){return function(_0x50e395){try{jsonpatch[_0xfa51('0x34')](_0x50e395,_0x21ccc7,!![]);}catch(_0x1553e2){return BPromise[_0xfa51('0x35')](_0x1553e2);}return _0x50e395[_0xfa51('0x36')]();};}function saveUpdates(_0x4e4151,_0x21d79a){return function(_0x40f979){if(_0x40f979){return _0x40f979[_0xfa51('0x37')](_0x4e4151)[_0xfa51('0x20')](function(_0x4715be){return _0x4715be;});}return null;};}function removeEntity(_0xcfb1dd,_0x528135){return function(_0x500e75){if(_0x500e75){return _0x500e75['destroy']()[_0xfa51('0x20')](function(){_0xcfb1dd[_0xfa51('0x2c')](0xcc)[_0xfa51('0x38')]();});}};}function handleEntityNotFound(_0x4eb488,_0x35e243){return function(_0x279059){if(!_0x279059){_0x4eb488[_0xfa51('0x39')](0x194);}return _0x279059;};}function handleError(_0x4f0692,_0xaa8c1d){_0xaa8c1d=_0xaa8c1d||0x1f4;return function(_0x4a38e6){logger[_0xfa51('0x26')](_0x4a38e6[_0xfa51('0x3a')]);if(_0x4a38e6[_0xfa51('0x3b')]){delete _0x4a38e6[_0xfa51('0x3b')];}_0x4f0692[_0xfa51('0x2c')](_0xaa8c1d)[_0xfa51('0x3c')](_0x4a38e6);};}exports['index']=function(_0x19bad8,_0x1e8d01){var _0x31a40a={},_0x2c1716={},_0x143f28={'count':0x0,'rows':[]};var _0x25a301=_[_0xfa51('0x3d')](db['FaxMessage']['rawAttributes'],function(_0x19cb5f){return{'name':_0x19cb5f[_0xfa51('0x3e')],'type':_0x19cb5f[_0xfa51('0x3f')][_0xfa51('0x40')]};});_0x2c1716[_0xfa51('0x41')]=_['map'](_0x25a301,_0xfa51('0x3b'));_0x2c1716[_0xfa51('0x42')]=_[_0xfa51('0x43')](_0x19bad8[_0xfa51('0x42')]);_0x2c1716['filters']=_[_0xfa51('0x44')](_0x2c1716[_0xfa51('0x41')],_0x2c1716[_0xfa51('0x42')]);_0x31a40a[_0xfa51('0x45')]=_[_0xfa51('0x44')](_0x2c1716[_0xfa51('0x41')],qs[_0xfa51('0x46')](_0x19bad8[_0xfa51('0x42')][_0xfa51('0x46')]));_0x31a40a[_0xfa51('0x45')]=_0x31a40a['attributes'][_0xfa51('0x47')]?_0x31a40a[_0xfa51('0x45')]:_0x2c1716[_0xfa51('0x41')];if(!_0x19bad8[_0xfa51('0x42')]['hasOwnProperty'](_0xfa51('0x48'))){_0x31a40a[_0xfa51('0x30')]=qs[_0xfa51('0x30')](_0x19bad8[_0xfa51('0x42')][_0xfa51('0x30')]);_0x31a40a['offset']=qs[_0xfa51('0x2e')](_0x19bad8[_0xfa51('0x42')]['offset']);}_0x31a40a[_0xfa51('0x49')]=qs[_0xfa51('0x4a')](_0x19bad8['query'][_0xfa51('0x4a')]);_0x31a40a[_0xfa51('0x4b')]=qs[_0xfa51('0x4c')](_['pick'](_0x19bad8[_0xfa51('0x42')],_0x2c1716[_0xfa51('0x4c')]),_0x25a301);if(_0x19bad8[_0xfa51('0x42')][_0xfa51('0x4d')]){_0x31a40a[_0xfa51('0x4b')]=_[_0xfa51('0x4e')](_0x31a40a[_0xfa51('0x4b')],{'$or':_[_0xfa51('0x3d')](_0x25a301,function(_0x1c70e5){if(_0x1c70e5[_0xfa51('0x3f')]!==_0xfa51('0x4f')){var _0x5157fa={};_0x5157fa[_0x1c70e5['name']]={'$like':'%'+_0x19bad8[_0xfa51('0x42')][_0xfa51('0x4d')]+'%'};return _0x5157fa;}})});}_0x31a40a=_['merge']({},_0x31a40a,_0x19bad8[_0xfa51('0x50')]);var _0x367dc1={'where':_0x31a40a[_0xfa51('0x4b')]};return db[_0xfa51('0x51')][_0xfa51('0x31')](_0x367dc1)[_0xfa51('0x20')](function(_0x462e03){_0x143f28['count']=_0x462e03;if(_0x19bad8['query']['includeAll']){_0x31a40a[_0xfa51('0x52')]=[{'all':!![]}];}return db[_0xfa51('0x51')][_0xfa51('0x53')](_0x31a40a);})[_0xfa51('0x20')](function(_0x5ac406){_0x143f28[_0xfa51('0x54')]=_0x5ac406;return _0x143f28;})[_0xfa51('0x20')](respondWithFilteredResult(_0x1e8d01,_0x31a40a))[_0xfa51('0x2b')](handleError(_0x1e8d01,null));};exports[_0xfa51('0x55')]=function(_0x53456c,_0x4c8499){var _0x6cf5a8={'raw':!![],'where':{'id':_0x53456c[_0xfa51('0x56')]['id']}},_0x4d8c0d={};_0x4d8c0d[_0xfa51('0x41')]=_[_0xfa51('0x43')](db[_0xfa51('0x51')][_0xfa51('0x57')]);_0x4d8c0d[_0xfa51('0x42')]=_['keys'](_0x53456c['query']);_0x4d8c0d[_0xfa51('0x4c')]=_[_0xfa51('0x44')](_0x4d8c0d[_0xfa51('0x41')],_0x4d8c0d[_0xfa51('0x42')]);_0x6cf5a8[_0xfa51('0x45')]=_[_0xfa51('0x44')](_0x4d8c0d[_0xfa51('0x41')],qs[_0xfa51('0x46')](_0x53456c[_0xfa51('0x42')][_0xfa51('0x46')]));_0x6cf5a8[_0xfa51('0x45')]=_0x6cf5a8['attributes']['length']?_0x6cf5a8[_0xfa51('0x45')]:_0x4d8c0d[_0xfa51('0x41')];if(_0x53456c['query'][_0xfa51('0x58')]){_0x6cf5a8['include']=[{'all':!![]}];}_0x6cf5a8=_['merge']({},_0x6cf5a8,_0x53456c[_0xfa51('0x50')]);return db[_0xfa51('0x51')][_0xfa51('0x59')](_0x6cf5a8)[_0xfa51('0x20')](handleEntityNotFound(_0x4c8499,null))['then'](respondWithResult(_0x4c8499,null))[_0xfa51('0x2b')](handleError(_0x4c8499,null));};exports[_0xfa51('0x37')]=function(_0x2aab8f,_0x45f8d4){if(_0x2aab8f['body']['id']){delete _0x2aab8f[_0xfa51('0x5a')]['id'];}return db[_0xfa51('0x51')][_0xfa51('0x59')]({'where':{'id':_0x2aab8f[_0xfa51('0x56')]['id']}})[_0xfa51('0x20')](handleEntityNotFound(_0x45f8d4,null))[_0xfa51('0x20')](saveUpdates(_0x2aab8f[_0xfa51('0x5a')],null))['then'](respondWithResult(_0x45f8d4,null))[_0xfa51('0x2b')](handleError(_0x45f8d4,null));};exports['destroy']=function(_0x53857b,_0x62332c){return db[_0xfa51('0x51')][_0xfa51('0x59')]({'where':{'id':_0x53857b[_0xfa51('0x56')]['id']}})[_0xfa51('0x20')](handleEntityNotFound(_0x62332c,null))['then'](removeEntity(_0x62332c,null))[_0xfa51('0x2b')](handleError(_0x62332c,null));};exports[_0xfa51('0x5b')]=function(_0x55a423,_0x4d2cbd){return db[_0xfa51('0x51')]['describe']()['then'](respondWithResult(_0x4d2cbd,null))[_0xfa51('0x2b')](handleError(_0x4d2cbd,null));};var interaction_log=require('../../config/logger')(_0xfa51('0x5c'));exports[_0xfa51('0x5d')]=function(_0x312218,_0x1c8942,_0x432ff6){var _0x38a0b4={'agent':{},'channel':_0xfa51('0x5e')};if(_0x312218[_0xfa51('0x5a')]['id']){delete _0x312218[_0xfa51('0x5a')]['id'];}_0x312218[_0xfa51('0x5a')][_0xfa51('0x5f')]=!![];_0x312218[_0xfa51('0x5a')][_0xfa51('0x60')]=moment()[_0xfa51('0x61')](_0xfa51('0x62'));_0x312218['body'][_0xfa51('0x63')]=_0x312218[_0xfa51('0x5a')]['UserId']||_0x312218[_0xfa51('0x64')]['id'];_0x38a0b4[_0xfa51('0x65')]['id']=_0x312218[_0xfa51('0x5a')][_0xfa51('0x63')];return db['FaxMessage'][_0xfa51('0x59')]({'where':{'id':_0x312218['params']['id'],'UserId':null}})[_0xfa51('0x20')](handleEntityNotFound(_0x1c8942,null))[_0xfa51('0x20')](saveUpdates(_0x312218[_0xfa51('0x5a')],null))['then'](function(_0x3a7f4d){if(_0x3a7f4d){_0x38a0b4['message']=_0x3a7f4d[_0xfa51('0x66')]({'plain':!![]});return db['FaxInteraction'][_0xfa51('0x59')]({'where':{'id':_0x3a7f4d[_0xfa51('0x67')]}});}return null;})[_0xfa51('0x20')](handleEntityNotFound(_0x1c8942,null))[_0xfa51('0x20')](function(_0x4d77d0){if(_0x4d77d0){return _0x4d77d0[_0xfa51('0x37')]({'UserId':_0x312218[_0xfa51('0x5a')]['UserId'],'read1stAt':_[_0xfa51('0x68')](_0x4d77d0[_0xfa51('0x69')])?moment()[_0xfa51('0x61')](_0xfa51('0x62')):undefined});}return null;})['then'](function(_0x322875){if(_0x322875){_0x38a0b4[_0xfa51('0x6a')]=_0x322875[_0xfa51('0x66')]({'plain':!![]});interaction_log[_0xfa51('0x21')](_0xfa51('0x6b'),_0x312218['user']['id'],_0x312218[_0xfa51('0x64')][_0xfa51('0x3b')],_0x312218[_0xfa51('0x64')][_0xfa51('0x6c')],_0x38a0b4[_0xfa51('0x6a')]['id'],_0x312218[_0xfa51('0x5a')]?JSON[_0xfa51('0x25')](_0x312218[_0xfa51('0x5a')]):_0xfa51('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x38a0b4);}return null;})[_0xfa51('0x20')](function(_0x555467){var _0x5dbff1=_0xfa51('0x6e')+_0x555467[_0xfa51('0x28')]['ContactId'];return db[_0xfa51('0x6f')][_0xfa51('0x42')](_0x5dbff1,{'type':db[_0xfa51('0x70')][_0xfa51('0x71')][_0xfa51('0x72')],'raw':!![]})['then'](function(_0x1f78d4){return _0x1f78d4;});})[_0xfa51('0x20')](function(_0x3fe1e0){if(_0x3fe1e0){_0x38a0b4[_0xfa51('0x28')]['contact']=_0x3fe1e0[0x0];if(!_0x312218[_0xfa51('0x5a')]['UserId'])return;return db[_0xfa51('0x73')]['find']({'where':{'id':_0x312218[_0xfa51('0x5a')]['UserId'],'role':_0xfa51('0x65')},'attributes':['id',_0xfa51('0x3b'),'fullname',_0xfa51('0x74'),_0xfa51('0x75')],'raw':!![]});}return null;})[_0xfa51('0x20')](function(_0x509d20){if(!_0x509d20)return null;_0x38a0b4[_0xfa51('0x28')][_0xfa51('0x65')]=_0x509d20;return _0x38a0b4;})[_0xfa51('0x20')](function(_0x33500f){if(_0x33500f){if(_0x312218[_0xfa51('0x5a')]['manual']){_0x38a0b4[_0xfa51('0x28')][_0xfa51('0x76')]=util[_0xfa51('0x61')](_0xfa51('0x77'),_0x312218[_0xfa51('0x64')][_0xfa51('0x3b')]);_0x38a0b4[_0xfa51('0x28')]['channel']=_0x38a0b4[_0xfa51('0x78')];_0x38a0b4['message'][_0xfa51('0x79')]=_0x38a0b4[_0xfa51('0x78')];_0x38a0b4[_0xfa51('0x28')][_0xfa51('0x7a')]=_0xfa51('0x5d');return respondWithRpcPromise(_0xfa51('0x7b'),_0xfa51('0x7b'),{'event':'acceptmessage','message':_0x38a0b4['message']},client9002)[_0xfa51('0x20')](function(){return _0x38a0b4;});}return _0x38a0b4;}return null;})[_0xfa51('0x20')](respondWithResult(_0x1c8942,null))[_0xfa51('0x2b')](handleError(_0x1c8942,null));};var interaction_log=require(_0xfa51('0x13'))(_0xfa51('0x5c'));exports[_0xfa51('0x35')]=function(_0x25f548,_0x5beae1,_0x2d8432){var _0x141d3a={'agent':{},'channel':'fax'};if(_0x25f548[_0xfa51('0x5a')]['id']){delete _0x25f548[_0xfa51('0x5a')]['id'];}_0x25f548[_0xfa51('0x5a')]['UserId']=_0x25f548['body'][_0xfa51('0x63')]||_0x25f548[_0xfa51('0x64')]['id'];_0x141d3a[_0xfa51('0x65')]['id']=_0x25f548[_0xfa51('0x5a')][_0xfa51('0x63')];return db['FaxMessage'][_0xfa51('0x59')]({'where':{'id':_0x25f548['params']['id'],'UserId':null}})[_0xfa51('0x20')](handleEntityNotFound(_0x5beae1,null))[_0xfa51('0x20')](function(_0x712ed9){if(_0x712ed9){_0x141d3a[_0xfa51('0x28')]=_0x712ed9[_0xfa51('0x66')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x712ed9['FaxInteractionId']}});}return null;})[_0xfa51('0x20')](handleEntityNotFound(_0x5beae1,null))[_0xfa51('0x20')](function(_0x2bd43f){if(_0x2bd43f){_0x141d3a[_0xfa51('0x6a')]=_0x2bd43f[_0xfa51('0x66')]({'plain':!![]});interaction_log[_0xfa51('0x21')](_0xfa51('0x7c'),_0x25f548[_0xfa51('0x64')]['id'],_0x25f548[_0xfa51('0x64')][_0xfa51('0x3b')],_0x25f548[_0xfa51('0x64')][_0xfa51('0x6c')],_0x141d3a[_0xfa51('0x6a')]['id'],_0x25f548[_0xfa51('0x5a')]?JSON[_0xfa51('0x25')](_0x25f548[_0xfa51('0x5a')]):_0xfa51('0x6d'));return respondWithRpcPromise(_0xfa51('0x7d'),_0xfa51('0x7e'),_0x141d3a);}return null;})['then'](function(_0x4de9e0){var _0x5aed84=_0xfa51('0x6e')+_0x4de9e0[_0xfa51('0x28')][_0xfa51('0x7f')];return db[_0xfa51('0x6f')][_0xfa51('0x42')](_0x5aed84,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xfa51('0x20')](function(_0x23867a){return _0x23867a;});})['then'](function(_0x2e4e2b){if(_0x2e4e2b){_0x141d3a[_0xfa51('0x28')][_0xfa51('0x80')]=_0x2e4e2b[0x0];if(!_0x25f548[_0xfa51('0x5a')][_0xfa51('0x63')])return;return db['User']['find']({'where':{'id':_0x25f548['body'][_0xfa51('0x63')],'role':_0xfa51('0x65')},'attributes':['id',_0xfa51('0x3b'),_0xfa51('0x81'),_0xfa51('0x74'),_0xfa51('0x75')],'raw':!![]});}return null;})[_0xfa51('0x20')](function(_0x3f7308){if(!_0x3f7308)return null;_0x141d3a[_0xfa51('0x28')]['agent']=_0x3f7308;return _0x141d3a;})[_0xfa51('0x20')](function(_0x5816a6){if(_0x5816a6){_0x5816a6['message'][_0xfa51('0x76')]=util[_0xfa51('0x61')]('SIP/%s',_0x25f548[_0xfa51('0x64')][_0xfa51('0x3b')]);_0x5816a6[_0xfa51('0x28')][_0xfa51('0x78')]=_0x141d3a['channel'];_0x5816a6[_0xfa51('0x28')][_0xfa51('0x79')]=_0x141d3a[_0xfa51('0x78')];_0x5816a6[_0xfa51('0x28')][_0xfa51('0x7a')]='reject';respondWithRpcPromise('EventManager',_0xfa51('0x7b'),{'event':_0xfa51('0x82'),'message':_0x5816a6[_0xfa51('0x28')]},client9002);return _0x141d3a;}return null;})['then'](respondWithResult(_0x5beae1,null))[_0xfa51('0x2b')](handleError(_0x5beae1,null));};exports[_0xfa51('0x83')]=function(_0x9bb63c,_0x5b328a){var _0x3050b3;return db[_0xfa51('0x51')][_0xfa51('0x83')](_0x9bb63c[_0xfa51('0x5a')],{})[_0xfa51('0x20')](function(_0x1852ee){_0x3050b3=_0x1852ee;return db[_0xfa51('0x84')][_0xfa51('0x85')]({'where':{'id':_0x3050b3[_0xfa51('0x7f')]}});})[_0xfa51('0x20')](function(_0x4190f5){if(_[_0xfa51('0x68')](_0x4190f5)){return;}else{_0x3050b3[_0xfa51('0x5e')]=_0x4190f5[_0xfa51('0x5e')];return db[_0xfa51('0x86')]['findOne']({'where':{'id':_0x3050b3[_0xfa51('0x87')]}});}})[_0xfa51('0x20')](function(_0xdda9c4){return respondWithRpcPromise(_0xfa51('0x88'),_0xfa51('0x88'),{'FaxAccountId':_[_0xfa51('0x68')](_0x9bb63c[_0xfa51('0x5a')])?undefined:_0x9bb63c['body'][_0xfa51('0x89')],'path':_[_0xfa51('0x68')](_0xdda9c4)?undefined:util[_0xfa51('0x61')](_0xfa51('0x8a'),_0xdda9c4['basename']),'fax':_[_0xfa51('0x68')](_0x3050b3[_0xfa51('0x5e')])?undefined:_0x3050b3[_0xfa51('0x5e')],'AttachmentId':_0x3050b3['AttachmentId']},client9002);})['then'](respondWithResult(_0x5b328a,0xc9))[_0xfa51('0x2b')](handleError(_0x5b328a,null));};exports[_0xfa51('0x8b')]=function(_0x2f1e94,_0x2dcb0e){var _0x332392=path[_0xfa51('0x8c')](config[_0xfa51('0x8d')],_0xfa51('0x8e'),'files',_0xfa51('0x8f'));return db[_0xfa51('0x51')][_0xfa51('0x59')]({'where':{'id':_0x2f1e94[_0xfa51('0x56')]['id']},'include':[{'model':db[_0xfa51('0x86')],'as':_0xfa51('0x86')}]})['then'](handleEntityNotFound(_0x2dcb0e,null))[_0xfa51('0x20')](function(_0x30c9b6){if(_0x30c9b6){return _0x2dcb0e[_0xfa51('0x8b')](path[_0xfa51('0x8c')](_0x332392,_0x30c9b6[_0xfa51('0x86')][_0xfa51('0x90')]));}})[_0xfa51('0x2b')](handleError(_0x2dcb0e,null));}; \ No newline at end of file +var _0xe625=['path','sox','to-csv','ejs','lodash','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','rawAttributes','options','body','find','describe','fax-interactions','accept','fax','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','ContactId','sequelize','Sequelize','SELECT','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','rejectmessage','create','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','files','attachments','join','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe625,0x112));var _0x5e62=function(_0xc869f,_0x322cc8){_0xc869f=_0xc869f-0x0;var _0xe2996b=_0xe625[_0xc869f];return _0xe2996b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e62('0x0'));var zipdir=require(_0x5e62('0x1'));var jsonpatch=require(_0x5e62('0x2'));var rp=require(_0x5e62('0x3'));var moment=require(_0x5e62('0x4'));var BPromise=require(_0x5e62('0x5'));var Mustache=require(_0x5e62('0x6'));var util=require(_0x5e62('0x7'));var path=require(_0x5e62('0x8'));var sox=require(_0x5e62('0x9'));var csv=require(_0x5e62('0xa'));var ejs=require(_0x5e62('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e62('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e62('0xd'));var authService=require(_0x5e62('0xe'));var qs=require(_0x5e62('0xf'));var as=require(_0x5e62('0x10'));var hardwareService=require(_0x5e62('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5e62('0x12'));var config=require(_0x5e62('0x13'));var licenseUtil=require(_0x5e62('0x14'));var db=require(_0x5e62('0x15'))['db'];config[_0x5e62('0x16')]=_[_0x5e62('0x17')](config[_0x5e62('0x16')],{'host':_0x5e62('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5e62('0x19'))[_0x5e62('0x1a')](socket);var jayson=require(_0x5e62('0x1b'));var client=jayson[_0x5e62('0x1c')][_0x5e62('0x1d')]({'port':0x232c});var client9002=jayson[_0x5e62('0x1c')][_0x5e62('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xbaa863,_0x298786,_0x222b3e,_0x3c8363){return new BPromise(function(_0x55ebb1,_0x3498eb){var _0x28dda9=_0x3c8363||client;return _0x28dda9[_0x5e62('0x1e')](_0xbaa863,_0x222b3e)[_0x5e62('0x1f')](function(_0x10bd4a){logger[_0x5e62('0x20')](_0x5e62('0x21'),_0x298786,_0x5e62('0x22'));logger[_0x5e62('0x23')](_0x5e62('0x24'),_0x298786,_0x5e62('0x22'),JSON[_0x5e62('0x25')](_0x10bd4a));if(_0x10bd4a[_0x5e62('0x26')]){if(_0x10bd4a['error'][_0x5e62('0x27')]===0x1f4){logger['error'](_0x5e62('0x21'),_0x298786,_0x10bd4a[_0x5e62('0x26')][_0x5e62('0x28')]);return _0x3498eb(_0x10bd4a[_0x5e62('0x26')][_0x5e62('0x28')]);}logger[_0x5e62('0x26')]('FaxMessage,\x20%s,\x20%s',_0x298786,_0x10bd4a['error']['message']);return _0x55ebb1(_0x10bd4a[_0x5e62('0x26')][_0x5e62('0x28')]);}else{logger[_0x5e62('0x20')](_0x5e62('0x21'),_0x298786,_0x5e62('0x22'));_0x55ebb1(_0x10bd4a[_0x5e62('0x29')][_0x5e62('0x28')]);}})[_0x5e62('0x2a')](function(_0x895d2e){logger[_0x5e62('0x26')]('FaxMessage,\x20%s,\x20%s',_0x298786,_0x895d2e);_0x3498eb(_0x895d2e);});});}function respondWithStatusCode(_0x338d1a,_0x29b4c1){_0x29b4c1=_0x29b4c1||0xcc;return function(_0xa04ca6){if(_0xa04ca6){return _0x338d1a[_0x5e62('0x2b')](_0x29b4c1);}return _0x338d1a[_0x5e62('0x2c')](_0x29b4c1)[_0x5e62('0x2d')]();};}function respondWithResult(_0x42e1fe,_0x191237){_0x191237=_0x191237||0xc8;return function(_0x15e24a){if(_0x15e24a){return _0x42e1fe[_0x5e62('0x2c')](_0x191237)[_0x5e62('0x2e')](_0x15e24a);}};}function respondWithFilteredResult(_0x18f620,_0x476327){return function(_0x4c3990){if(_0x4c3990){var _0x591583=typeof _0x476327[_0x5e62('0x2f')]==='undefined'&&typeof _0x476327[_0x5e62('0x30')]==='undefined';var _0x57242d=_0x4c3990[_0x5e62('0x31')];var _0xde2f1d=_0x591583?0x0:_0x476327[_0x5e62('0x2f')];var _0x49984e=_0x591583?_0x4c3990[_0x5e62('0x31')]:_0x476327['offset']+_0x476327['limit'];var _0x474f2e;if(_0x49984e>=_0x57242d){_0x49984e=_0x57242d;_0x474f2e=0xc8;}else{_0x474f2e=0xce;}_0x18f620['status'](_0x474f2e);return _0x18f620[_0x5e62('0x32')]('Content-Range',_0xde2f1d+'-'+_0x49984e+'/'+_0x57242d)[_0x5e62('0x2e')](_0x4c3990);}return null;};}function patchUpdates(_0x47c8f2){return function(_0x504f68){try{jsonpatch[_0x5e62('0x33')](_0x504f68,_0x47c8f2,!![]);}catch(_0x3c6790){return BPromise[_0x5e62('0x34')](_0x3c6790);}return _0x504f68[_0x5e62('0x35')]();};}function saveUpdates(_0x332608,_0x1441bb){return function(_0x296071){if(_0x296071){return _0x296071[_0x5e62('0x36')](_0x332608)['then'](function(_0x6cfa8e){return _0x6cfa8e;});}return null;};}function removeEntity(_0x45eb7b,_0x9b8e2a){return function(_0x583551){if(_0x583551){return _0x583551['destroy']()[_0x5e62('0x1f')](function(){_0x45eb7b[_0x5e62('0x2c')](0xcc)[_0x5e62('0x2d')]();});}};}function handleEntityNotFound(_0xd32a50,_0x6ed88e){return function(_0x23af58){if(!_0x23af58){_0xd32a50[_0x5e62('0x2b')](0x194);}return _0x23af58;};}function handleError(_0x3ecbe5,_0x34e57a){_0x34e57a=_0x34e57a||0x1f4;return function(_0x36c34e){logger[_0x5e62('0x26')](_0x36c34e[_0x5e62('0x37')]);if(_0x36c34e[_0x5e62('0x38')]){delete _0x36c34e[_0x5e62('0x38')];}_0x3ecbe5[_0x5e62('0x2c')](_0x34e57a)[_0x5e62('0x39')](_0x36c34e);};}exports[_0x5e62('0x3a')]=function(_0x50aeec,_0x3dbb2c){var _0x302283={},_0x2501aa={},_0x26d16e={'count':0x0,'rows':[]};var _0x11cc14=_[_0x5e62('0x3b')](db[_0x5e62('0x3c')]['rawAttributes'],function(_0x96afb7){return{'name':_0x96afb7[_0x5e62('0x3d')],'type':_0x96afb7[_0x5e62('0x3e')][_0x5e62('0x3f')]};});_0x2501aa[_0x5e62('0x40')]=_[_0x5e62('0x3b')](_0x11cc14,_0x5e62('0x38'));_0x2501aa[_0x5e62('0x41')]=_[_0x5e62('0x42')](_0x50aeec[_0x5e62('0x41')]);_0x2501aa['filters']=_['intersection'](_0x2501aa[_0x5e62('0x40')],_0x2501aa['query']);_0x302283[_0x5e62('0x43')]=_[_0x5e62('0x44')](_0x2501aa['model'],qs[_0x5e62('0x45')](_0x50aeec[_0x5e62('0x41')][_0x5e62('0x45')]));_0x302283[_0x5e62('0x43')]=_0x302283[_0x5e62('0x43')][_0x5e62('0x46')]?_0x302283[_0x5e62('0x43')]:_0x2501aa[_0x5e62('0x40')];if(!_0x50aeec[_0x5e62('0x41')][_0x5e62('0x47')](_0x5e62('0x48'))){_0x302283[_0x5e62('0x30')]=qs['limit'](_0x50aeec['query'][_0x5e62('0x30')]);_0x302283['offset']=qs[_0x5e62('0x2f')](_0x50aeec['query'][_0x5e62('0x2f')]);}_0x302283[_0x5e62('0x49')]=qs[_0x5e62('0x4a')](_0x50aeec['query'][_0x5e62('0x4a')]);_0x302283[_0x5e62('0x4b')]=qs['filters'](_['pick'](_0x50aeec[_0x5e62('0x41')],_0x2501aa[_0x5e62('0x4c')]),_0x11cc14);if(_0x50aeec[_0x5e62('0x41')]['filter']){_0x302283['where']=_[_0x5e62('0x4d')](_0x302283[_0x5e62('0x4b')],{'$or':_[_0x5e62('0x3b')](_0x11cc14,function(_0x1fb010){if(_0x1fb010[_0x5e62('0x3e')]!==_0x5e62('0x4e')){var _0x1e1e62={};_0x1e1e62[_0x1fb010[_0x5e62('0x38')]]={'$like':'%'+_0x50aeec[_0x5e62('0x41')][_0x5e62('0x4f')]+'%'};return _0x1e1e62;}})});}_0x302283=_[_0x5e62('0x4d')]({},_0x302283,_0x50aeec['options']);var _0x256009={'where':_0x302283[_0x5e62('0x4b')]};return db['FaxMessage'][_0x5e62('0x31')](_0x256009)[_0x5e62('0x1f')](function(_0x5db82e){_0x26d16e[_0x5e62('0x31')]=_0x5db82e;if(_0x50aeec[_0x5e62('0x41')][_0x5e62('0x50')]){_0x302283[_0x5e62('0x51')]=[{'all':!![]}];}return db[_0x5e62('0x3c')][_0x5e62('0x52')](_0x302283);})[_0x5e62('0x1f')](function(_0x17856e){_0x26d16e[_0x5e62('0x53')]=_0x17856e;return _0x26d16e;})[_0x5e62('0x1f')](respondWithFilteredResult(_0x3dbb2c,_0x302283))[_0x5e62('0x2a')](handleError(_0x3dbb2c,null));};exports[_0x5e62('0x54')]=function(_0x5339af,_0x15e378){var _0x3b8910={'raw':!![],'where':{'id':_0x5339af[_0x5e62('0x55')]['id']}},_0x215e9e={};_0x215e9e[_0x5e62('0x40')]=_[_0x5e62('0x42')](db[_0x5e62('0x3c')][_0x5e62('0x56')]);_0x215e9e['query']=_[_0x5e62('0x42')](_0x5339af[_0x5e62('0x41')]);_0x215e9e['filters']=_[_0x5e62('0x44')](_0x215e9e[_0x5e62('0x40')],_0x215e9e['query']);_0x3b8910[_0x5e62('0x43')]=_[_0x5e62('0x44')](_0x215e9e['model'],qs['fields'](_0x5339af[_0x5e62('0x41')][_0x5e62('0x45')]));_0x3b8910[_0x5e62('0x43')]=_0x3b8910[_0x5e62('0x43')][_0x5e62('0x46')]?_0x3b8910[_0x5e62('0x43')]:_0x215e9e[_0x5e62('0x40')];if(_0x5339af[_0x5e62('0x41')][_0x5e62('0x50')]){_0x3b8910['include']=[{'all':!![]}];}_0x3b8910=_['merge']({},_0x3b8910,_0x5339af[_0x5e62('0x57')]);return db[_0x5e62('0x3c')]['find'](_0x3b8910)[_0x5e62('0x1f')](handleEntityNotFound(_0x15e378,null))[_0x5e62('0x1f')](respondWithResult(_0x15e378,null))['catch'](handleError(_0x15e378,null));};exports[_0x5e62('0x36')]=function(_0x50fbca,_0x27c349){if(_0x50fbca[_0x5e62('0x58')]['id']){delete _0x50fbca[_0x5e62('0x58')]['id'];}return db[_0x5e62('0x3c')]['find']({'where':{'id':_0x50fbca[_0x5e62('0x55')]['id']}})[_0x5e62('0x1f')](handleEntityNotFound(_0x27c349,null))[_0x5e62('0x1f')](saveUpdates(_0x50fbca['body'],null))[_0x5e62('0x1f')](respondWithResult(_0x27c349,null))['catch'](handleError(_0x27c349,null));};exports['destroy']=function(_0x1788ed,_0x5e8f18){return db[_0x5e62('0x3c')][_0x5e62('0x59')]({'where':{'id':_0x1788ed[_0x5e62('0x55')]['id']}})[_0x5e62('0x1f')](handleEntityNotFound(_0x5e8f18,null))[_0x5e62('0x1f')](removeEntity(_0x5e8f18,null))[_0x5e62('0x2a')](handleError(_0x5e8f18,null));};exports['describe']=function(_0x52aa1f,_0x401826){return db[_0x5e62('0x3c')][_0x5e62('0x5a')]()['then'](respondWithResult(_0x401826,null))['catch'](handleError(_0x401826,null));};var interaction_log=require('../../config/logger')(_0x5e62('0x5b'));exports[_0x5e62('0x5c')]=function(_0x49bd74,_0x50c038,_0x3acd53){var _0x15855b={'agent':{},'channel':_0x5e62('0x5d')};if(_0x49bd74['body']['id']){delete _0x49bd74[_0x5e62('0x58')]['id'];}_0x49bd74[_0x5e62('0x58')]['read']=!![];_0x49bd74[_0x5e62('0x58')][_0x5e62('0x5e')]=moment()[_0x5e62('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x49bd74[_0x5e62('0x58')][_0x5e62('0x60')]=_0x49bd74[_0x5e62('0x58')][_0x5e62('0x60')]||_0x49bd74[_0x5e62('0x61')]['id'];_0x15855b[_0x5e62('0x62')]['id']=_0x49bd74[_0x5e62('0x58')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x49bd74['params']['id'],'UserId':null}})[_0x5e62('0x1f')](handleEntityNotFound(_0x50c038,null))['then'](saveUpdates(_0x49bd74[_0x5e62('0x58')],null))['then'](function(_0x511cfd){if(_0x511cfd){_0x15855b[_0x5e62('0x28')]=_0x511cfd[_0x5e62('0x63')]({'plain':!![]});return db[_0x5e62('0x64')]['find']({'where':{'id':_0x511cfd[_0x5e62('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x50c038,null))[_0x5e62('0x1f')](function(_0x3ba73a){if(_0x3ba73a){return _0x3ba73a['update']({'UserId':_0x49bd74[_0x5e62('0x58')][_0x5e62('0x60')],'read1stAt':_['isNil'](_0x3ba73a[_0x5e62('0x66')])?moment()[_0x5e62('0x5f')](_0x5e62('0x67')):undefined});}return null;})[_0x5e62('0x1f')](function(_0x5889ab){if(_0x5889ab){_0x15855b['interaction']=_0x5889ab['get']({'plain':!![]});interaction_log[_0x5e62('0x20')](_0x5e62('0x68'),_0x49bd74[_0x5e62('0x61')]['id'],_0x49bd74[_0x5e62('0x61')][_0x5e62('0x38')],_0x49bd74[_0x5e62('0x61')]['role'],_0x15855b[_0x5e62('0x69')]['id'],_0x49bd74[_0x5e62('0x58')]?JSON[_0x5e62('0x25')](_0x49bd74[_0x5e62('0x58')]):_0x5e62('0x6a'));return respondWithRpcPromise(_0x5e62('0x6b'),'acceptMessage',_0x15855b);}return null;})[_0x5e62('0x1f')](function(_0x1c36a1){var _0x28eac8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c36a1['message'][_0x5e62('0x6c')];return db[_0x5e62('0x6d')][_0x5e62('0x41')](_0x28eac8,{'type':db[_0x5e62('0x6e')]['QueryTypes'][_0x5e62('0x6f')],'raw':!![]})[_0x5e62('0x1f')](function(_0x46edc3){return _0x46edc3;});})[_0x5e62('0x1f')](function(_0x9cb4d1){if(_0x9cb4d1){_0x15855b[_0x5e62('0x28')]['contact']=_0x9cb4d1[0x0];if(!_0x49bd74[_0x5e62('0x58')]['UserId'])return;return db['User']['find']({'where':{'id':_0x49bd74[_0x5e62('0x58')][_0x5e62('0x60')],'role':_0x5e62('0x62')},'attributes':['id',_0x5e62('0x38'),_0x5e62('0x70'),'email',_0x5e62('0x71')],'raw':!![]});}return null;})[_0x5e62('0x1f')](function(_0x4aa5c5){if(!_0x4aa5c5)return null;_0x15855b[_0x5e62('0x28')]['agent']=_0x4aa5c5;return _0x15855b;})[_0x5e62('0x1f')](function(_0x471f2b){if(_0x471f2b){if(_0x49bd74['body'][_0x5e62('0x72')]){_0x15855b[_0x5e62('0x28')][_0x5e62('0x73')]=util[_0x5e62('0x5f')](_0x5e62('0x74'),_0x49bd74['user'][_0x5e62('0x38')]);_0x15855b[_0x5e62('0x28')][_0x5e62('0x75')]=_0x15855b['channel'];_0x15855b[_0x5e62('0x28')][_0x5e62('0x76')]=_0x15855b[_0x5e62('0x75')];_0x15855b[_0x5e62('0x28')][_0x5e62('0x77')]=_0x5e62('0x5c');return respondWithRpcPromise(_0x5e62('0x78'),_0x5e62('0x78'),{'event':_0x5e62('0x79'),'message':_0x15855b['message']},client9002)[_0x5e62('0x1f')](function(){return _0x15855b;});}return _0x15855b;}return null;})['then'](respondWithResult(_0x50c038,null))['catch'](handleError(_0x50c038,null));};var interaction_log=require(_0x5e62('0x7a'))(_0x5e62('0x5b'));exports[_0x5e62('0x34')]=function(_0x3f6d9d,_0x20f727,_0x51771e){var _0x5269cd={'agent':{},'channel':_0x5e62('0x5d')};if(_0x3f6d9d[_0x5e62('0x58')]['id']){delete _0x3f6d9d[_0x5e62('0x58')]['id'];}_0x3f6d9d[_0x5e62('0x58')]['UserId']=_0x3f6d9d['body'][_0x5e62('0x60')]||_0x3f6d9d[_0x5e62('0x61')]['id'];_0x5269cd['agent']['id']=_0x3f6d9d[_0x5e62('0x58')][_0x5e62('0x60')];return db['FaxMessage'][_0x5e62('0x59')]({'where':{'id':_0x3f6d9d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x20f727,null))['then'](function(_0x469460){if(_0x469460){_0x5269cd['message']=_0x469460[_0x5e62('0x63')]({'plain':!![]});return db[_0x5e62('0x64')][_0x5e62('0x59')]({'where':{'id':_0x469460['FaxInteractionId']}});}return null;})[_0x5e62('0x1f')](handleEntityNotFound(_0x20f727,null))[_0x5e62('0x1f')](function(_0x219ed8){if(_0x219ed8){_0x5269cd[_0x5e62('0x69')]=_0x219ed8[_0x5e62('0x63')]({'plain':!![]});interaction_log[_0x5e62('0x20')](_0x5e62('0x7b'),_0x3f6d9d[_0x5e62('0x61')]['id'],_0x3f6d9d['user'][_0x5e62('0x38')],_0x3f6d9d[_0x5e62('0x61')]['role'],_0x5269cd[_0x5e62('0x69')]['id'],_0x3f6d9d[_0x5e62('0x58')]?JSON[_0x5e62('0x25')](_0x3f6d9d[_0x5e62('0x58')]):_0x5e62('0x6a'));return respondWithRpcPromise(_0x5e62('0x7c'),_0x5e62('0x7d'),_0x5269cd);}return null;})['then'](function(_0x51b7eb){var _0x57db80='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x51b7eb[_0x5e62('0x28')]['ContactId'];return db[_0x5e62('0x6d')]['query'](_0x57db80,{'type':db[_0x5e62('0x6e')][_0x5e62('0x7e')]['SELECT'],'raw':!![]})[_0x5e62('0x1f')](function(_0x5d0e1b){return _0x5d0e1b;});})[_0x5e62('0x1f')](function(_0x234045){if(_0x234045){_0x5269cd[_0x5e62('0x28')]['contact']=_0x234045[0x0];if(!_0x3f6d9d['body']['UserId'])return;return db[_0x5e62('0x7f')][_0x5e62('0x59')]({'where':{'id':_0x3f6d9d[_0x5e62('0x58')][_0x5e62('0x60')],'role':_0x5e62('0x62')},'attributes':['id','name','fullname','email',_0x5e62('0x71')],'raw':!![]});}return null;})[_0x5e62('0x1f')](function(_0x58237b){if(!_0x58237b)return null;_0x5269cd[_0x5e62('0x28')][_0x5e62('0x62')]=_0x58237b;return _0x5269cd;})[_0x5e62('0x1f')](function(_0x4c4750){if(_0x4c4750){_0x4c4750[_0x5e62('0x28')]['interface']=util[_0x5e62('0x5f')]('SIP/%s',_0x3f6d9d[_0x5e62('0x61')][_0x5e62('0x38')]);_0x4c4750[_0x5e62('0x28')][_0x5e62('0x75')]=_0x5269cd[_0x5e62('0x75')];_0x4c4750['message'][_0x5e62('0x76')]=_0x5269cd['channel'];_0x4c4750[_0x5e62('0x28')][_0x5e62('0x77')]=_0x5e62('0x34');respondWithRpcPromise(_0x5e62('0x78'),_0x5e62('0x78'),{'event':_0x5e62('0x80'),'message':_0x4c4750[_0x5e62('0x28')]},client9002);return _0x5269cd;}return null;})[_0x5e62('0x1f')](respondWithResult(_0x20f727,null))[_0x5e62('0x2a')](handleError(_0x20f727,null));};exports[_0x5e62('0x81')]=function(_0x218a06,_0x30fe43){var _0x44e744;return db[_0x5e62('0x3c')][_0x5e62('0x81')](_0x218a06['body'],{})[_0x5e62('0x1f')](function(_0x1d91a4){_0x44e744=_0x1d91a4;return db['CmContact'][_0x5e62('0x82')]({'where':{'id':_0x44e744['ContactId']}});})[_0x5e62('0x1f')](function(_0x50c080){if(_[_0x5e62('0x83')](_0x50c080)){return;}else{_0x44e744[_0x5e62('0x5d')]=_0x50c080['fax'];return db[_0x5e62('0x84')][_0x5e62('0x82')]({'where':{'id':_0x44e744['AttachmentId']}});}})[_0x5e62('0x1f')](function(_0x194e17){return respondWithRpcPromise(_0x5e62('0x85'),_0x5e62('0x85'),{'FaxAccountId':_[_0x5e62('0x83')](_0x218a06[_0x5e62('0x58')])?undefined:_0x218a06[_0x5e62('0x58')][_0x5e62('0x86')],'path':_[_0x5e62('0x83')](_0x194e17)?undefined:util[_0x5e62('0x5f')](_0x5e62('0x87'),_0x194e17[_0x5e62('0x88')]),'fax':_[_0x5e62('0x83')](_0x44e744[_0x5e62('0x5d')])?undefined:_0x44e744[_0x5e62('0x5d')],'AttachmentId':_0x44e744['AttachmentId']},client9002);})[_0x5e62('0x1f')](respondWithResult(_0x30fe43,0xc9))[_0x5e62('0x2a')](handleError(_0x30fe43,null));};exports['download']=function(_0x9a5d41,_0x1e6fef){var _0x3b80a7=path['join'](config[_0x5e62('0x89')],'server',_0x5e62('0x8a'),_0x5e62('0x8b'));return db['FaxMessage'][_0x5e62('0x59')]({'where':{'id':_0x9a5d41[_0x5e62('0x55')]['id']},'include':[{'model':db[_0x5e62('0x84')],'as':_0x5e62('0x84')}]})[_0x5e62('0x1f')](handleEntityNotFound(_0x1e6fef,null))[_0x5e62('0x1f')](function(_0x3c5abb){if(_0x3c5abb){return _0x1e6fef['download'](path[_0x5e62('0x8c')](_0x3b80a7,_0x3c5abb[_0x5e62('0x84')][_0x5e62('0x88')]));}})[_0x5e62('0x2a')](handleError(_0x1e6fef,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1be0646..642e44d 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 _0xb4b6=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x37e0e4,_0x3b3dee){_0x37e0e4=_0x37e0e4-0x0;var _0x5369f8=_0xb4b6[_0x37e0e4];return _0x5369f8;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x6b4b('0x0'))['db'][_0x6b4b('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6b4b('0x2')](0x0);var events={'afterCreate':_0x6b4b('0x3'),'afterUpdate':_0x6b4b('0x4'),'afterDestroy':_0x6b4b('0x5')};function emitEvent(_0x1a8934){return function(_0xff2737,_0x422b21,_0x562733){FaxMessageEvents[_0x6b4b('0x6')](_0x1a8934+':'+_0xff2737['id'],_0xff2737);FaxMessageEvents['emit'](_0x1a8934,_0xff2737);_0x562733(null);};}for(var e in events){if(events[_0x6b4b('0x7')](e)){var event=events[e];FaxMessage[_0x6b4b('0x8')](e,emitEvent(event));}}module[_0x6b4b('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x5fab=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x316fef,_0xbe8705){var _0x153dd9=function(_0x545b02){while(--_0x545b02){_0x316fef['push'](_0x316fef['shift']());}};_0x153dd9(++_0xbe8705);}(_0x5fab,0x177));var _0xb5fa=function(_0x3c51af,_0x1991ce){_0x3c51af=_0x3c51af-0x0;var _0xeb10d9=_0x5fab[_0x3c51af];return _0xeb10d9;};'use strict';var EventEmitter=require(_0xb5fa('0x0'));var FaxMessage=require(_0xb5fa('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb5fa('0x2')](0x0);var events={'afterCreate':_0xb5fa('0x3'),'afterUpdate':_0xb5fa('0x4'),'afterDestroy':_0xb5fa('0x5')};function emitEvent(_0x67e8e8){return function(_0x595d8b,_0x29390a,_0x4341d3){FaxMessageEvents[_0xb5fa('0x6')](_0x67e8e8+':'+_0x595d8b['id'],_0x595d8b);FaxMessageEvents[_0xb5fa('0x6')](_0x67e8e8,_0x595d8b);_0x4341d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xb5fa('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 efc8c30..55febab 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 _0x069b=['request-promise','path','rimraf','./faxMessage.attributes','define','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird'];(function(_0x2c1b01,_0x391fa3){var _0x27cd47=function(_0x58935e){while(--_0x58935e){_0x2c1b01['push'](_0x2c1b01['shift']());}};_0x27cd47(++_0x391fa3);}(_0x069b,0x15b));var _0xb069=function(_0x112ca9,_0x5d6496){_0x112ca9=_0x112ca9-0x0;var _0x2eb357=_0x069b[_0x112ca9];return _0x2eb357;};'use strict';var _=require(_0xb069('0x0'));var util=require('util');var logger=require(_0xb069('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb069('0x2'));var rp=require(_0xb069('0x3'));var fs=require('fs');var path=require(_0xb069('0x4'));var rimraf=require(_0xb069('0x5'));var config=require('../../config/environment');var attributes=require(_0xb069('0x6'));module['exports']=function(_0x2e9287,_0x4f1f90){return _0x2e9287[_0xb069('0x7')]('FaxMessage',attributes,{'tableName':_0xb069('0x8'),'paranoid':![],'indexes':[{'name':_0xb069('0x9'),'fields':['body'],'type':_0xb069('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x592409,_0x2cf225,_0x3f0b86){var _0x1b0ea9=_0x2e9287[_0xb069('0xb')];var _0x35d5a4=_0x592409[_0xb069('0xc')]({'plain':!![]});if(_0x35d5a4['direction']['toLowerCase']()==='in'||_0x35d5a4[_0xb069('0xd')][_0xb069('0xe')]()==='out'&&!_0x35d5a4['secret']&&!_[_0xb069('0xf')](_0x35d5a4[_0xb069('0x10')])){_0x1b0ea9[_0xb069('0x11')][_0xb069('0x12')]({'where':{'id':_0x35d5a4[_0xb069('0x13')]}})[_0xb069('0x14')](function(_0x998fe9){if(_0x998fe9){_0x998fe9[_0xb069('0x15')]({'lastMsgAt':_0x35d5a4['createdAt'],'lastMsgDirection':_0x35d5a4['direction'][_0xb069('0xe')]()});}})[_0xb069('0x16')](function(_0x3b2364){console[_0xb069('0x17')](_0x3b2364);});}_0x3f0b86();}},'charset':'utf8mb4','collate':_0xb069('0x18')});}; \ No newline at end of file +var _0xd0ab=['findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd0ab,0xc1));var _0xbd0a=function(_0x5ee7c4,_0x4a5d9f){_0x5ee7c4=_0x5ee7c4-0x0;var _0x28fc07=_0xd0ab[_0x5ee7c4];return _0x28fc07;};'use strict';var _=require(_0xbd0a('0x0'));var util=require(_0xbd0a('0x1'));var logger=require(_0xbd0a('0x2'))(_0xbd0a('0x3'));var moment=require(_0xbd0a('0x4'));var BPromise=require(_0xbd0a('0x5'));var rp=require(_0xbd0a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd0a('0x7'));var config=require(_0xbd0a('0x8'));var attributes=require('./faxMessage.attributes');module[_0xbd0a('0x9')]=function(_0x551db6,_0x3be38d){return _0x551db6[_0xbd0a('0xa')](_0xbd0a('0xb'),attributes,{'tableName':_0xbd0a('0xc'),'paranoid':![],'indexes':[{'name':_0xbd0a('0xd'),'fields':[_0xbd0a('0xe')],'type':_0xbd0a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14817f,_0x3d7324,_0x2a9d46){var _0x412441=_0x551db6[_0xbd0a('0x10')];var _0x5d21fa=_0x14817f[_0xbd0a('0x11')]({'plain':!![]});if(_0x5d21fa[_0xbd0a('0x12')][_0xbd0a('0x13')]()==='in'||_0x5d21fa[_0xbd0a('0x12')][_0xbd0a('0x13')]()===_0xbd0a('0x14')&&!_0x5d21fa[_0xbd0a('0x15')]&&!_[_0xbd0a('0x16')](_0x5d21fa[_0xbd0a('0x17')])){_0x412441['FaxInteraction'][_0xbd0a('0x18')]({'where':{'id':_0x5d21fa[_0xbd0a('0x19')]}})[_0xbd0a('0x1a')](function(_0x3d95c2){if(_0x3d95c2){_0x3d95c2[_0xbd0a('0x1b')]({'lastMsgAt':_0x5d21fa[_0xbd0a('0x1c')],'lastMsgDirection':_0x5d21fa[_0xbd0a('0x12')][_0xbd0a('0x13')]()});}})[_0xbd0a('0x1d')](function(_0x25a548){console['error'](_0x25a548);});}_0x2a9d46();}},'charset':_0xbd0a('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index fcde780..5b14540 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(_0x165e09,_0x554cfd){var _0x15aa0b=function(_0x1f34b9){while(--_0x1f34b9){_0x165e09['push'](_0x165e09['shift']());}};_0x15aa0b(++_0x554cfd);}(_0xda55,0x6d));var _0x5da5=function(_0x2513ad,_0x5c7ac8){_0x2513ad=_0x2513ad-0x0;var _0x14a6c3=_0xda55[_0x2513ad];return _0x14a6c3;};'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 _0x9bde=['body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','limit','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxMessage','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x34d7d6,_0x53949d){_0x34d7d6=_0x34d7d6-0x0;var _0x3fdf10=_0x9bde[_0x34d7d6];return _0x3fdf10;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});config[_0xe9bd('0xa')]=_[_0xe9bd('0xb')](config[_0xe9bd('0xa')],{'host':_0xe9bd('0xc'),'port':0x18eb});var socket=require(_0xe9bd('0xd'))(new Redis(config[_0xe9bd('0xa')]));require(_0xe9bd('0xe'))[_0xe9bd('0xf')](socket);function respondWithRpcPromise(_0x45c7ba,_0x581602,_0x5f36c8){return new BPromise(function(_0x3c8e95,_0x145521){return client[_0xe9bd('0x10')](_0x45c7ba,_0x5f36c8)['then'](function(_0x12c96e){logger[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));logger['debug'](_0xe9bd('0x14'),_0x581602,'request\x20sent',JSON[_0xe9bd('0x15')](_0x12c96e));if(_0x12c96e[_0xe9bd('0x16')]){if(_0x12c96e[_0xe9bd('0x16')]['code']===0x1f4){logger['error'](_0xe9bd('0x12'),_0x581602,_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);return _0x145521(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}logger[_0xe9bd('0x16')](_0xe9bd('0x12'),_0x581602,_0x12c96e['error'][_0xe9bd('0x17')]);return _0x3c8e95(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}else{logger['info'](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));_0x3c8e95(_0x12c96e[_0xe9bd('0x18')][_0xe9bd('0x17')]);}})['catch'](function(_0x20ec32){logger['error'](_0xe9bd('0x12'),_0x581602,_0x20ec32);_0x145521(_0x20ec32);});});}exports['CreateFaxMessage']=function(_0x26aa4a){var _0x417113=this;return new Promise(function(_0x134c4e,_0x3dda13){return db[_0xe9bd('0x19')][_0xe9bd('0x1a')](_0x26aa4a[_0xe9bd('0x1b')],{'raw':_0x26aa4a['options']?_0x26aa4a[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x37aec1){logger['info'](_0xe9bd('0x1e'),_0x26aa4a);logger[_0xe9bd('0x1f')](_0xe9bd('0x1e'),_0x26aa4a,JSON[_0xe9bd('0x15')](_0x37aec1));_0x134c4e(_0x37aec1);})['catch'](function(_0x24cf25){logger[_0xe9bd('0x16')](_0xe9bd('0x1e'),_0x24cf25[_0xe9bd('0x17')],_0x26aa4a);_0x3dda13(_0x417113[_0xe9bd('0x16')](0x1f4,_0x24cf25[_0xe9bd('0x17')]));});});};exports[_0xe9bd('0x20')]=function(_0x43ea90){var _0x1ae889=this;return new Promise(function(_0x5987af,_0x3c211a){return db[_0xe9bd('0x19')]['update'](_0x43ea90[_0xe9bd('0x1b')],{'raw':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')]['where']||null:null,'attributes':_0x43ea90['options']?_0x43ea90[_0xe9bd('0x1c')]['attributes']||null:null,'limit':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x21')]||null:null})[_0xe9bd('0x22')](function(_0x4057df){logger['info']('UpdateFaxMessage',_0x43ea90);logger[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x43ea90,JSON[_0xe9bd('0x15')](_0x4057df));_0x5987af(_0x4057df);})[_0xe9bd('0x23')](function(_0xe2436){logger[_0xe9bd('0x16')](_0xe9bd('0x20'),_0xe2436[_0xe9bd('0x17')],_0x43ea90);_0x3c211a(_0x1ae889[_0xe9bd('0x16')](0x1f4,_0xe2436['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 90a6e12..0633b3e 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 _0x5d53=['save','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0x3d6975,_0x13d173){var _0x41e90b=function(_0x49c249){while(--_0x49c249){_0x3d6975['push'](_0x3d6975['shift']());}};_0x41e90b(++_0x13d173);}(_0x5d53,0xe6));var _0x35d5=function(_0x1d2b66,_0x256c6e){_0x1d2b66=_0x1d2b66-0x0;var _0x445a66=_0x5d53[_0x1d2b66];return _0x445a66;};'use strict';var FaxMessageEvents=require(_0x35d5('0x0'));var events=[_0x35d5('0x1'),'remove',_0x35d5('0x2')];function createListener(_0x289f80,_0x145cf5){return function(_0x1204bf){_0x145cf5[_0x35d5('0x3')](_0x289f80,_0x1204bf);};}function removeListener(_0x3eb37c,_0xc77507){return function(){FaxMessageEvents[_0x35d5('0x4')](_0x3eb37c,_0xc77507);};}exports[_0x35d5('0x5')]=function(_0x5efb83){for(var _0x28716b=0x0,_0x2308e7=events[_0x35d5('0x6')];_0x28716b<_0x2308e7;_0x28716b++){var _0x3991f5=events[_0x28716b];var _0x5095ac=createListener('faxMessage:'+_0x3991f5,_0x5efb83);FaxMessageEvents['on'](_0x3991f5,_0x5095ac);}}; \ No newline at end of file +var _0x8ff0=['length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x32753a,_0x313eff){var _0x5cc638=function(_0x87e14c){while(--_0x87e14c){_0x32753a['push'](_0x32753a['shift']());}};_0x5cc638(++_0x313eff);}(_0x8ff0,0x121));var _0x08ff=function(_0x2b4ecf,_0x58a97){_0x2b4ecf=_0x2b4ecf-0x0;var _0x34faa4=_0x8ff0[_0x2b4ecf];return _0x34faa4;};'use strict';var FaxMessageEvents=require(_0x08ff('0x0'));var events=[_0x08ff('0x1'),_0x08ff('0x2'),'update'];function createListener(_0x48eeb0,_0x2ab791){return function(_0x204505){_0x2ab791[_0x08ff('0x3')](_0x48eeb0,_0x204505);};}function removeListener(_0x311fad,_0x569f8b){return function(){FaxMessageEvents[_0x08ff('0x4')](_0x311fad,_0x569f8b);};}exports['register']=function(_0x6ba9d5){for(var _0x3c816d=0x0,_0x494537=events[_0x08ff('0x5')];_0x3c816d<_0x494537;_0x3c816d++){var _0x5a1e00=events[_0x3c816d];var _0x41bb1b=createListener(_0x08ff('0x6')+_0x5a1e00,_0x6ba9d5);FaxMessageEvents['on'](_0x5a1e00,_0x41bb1b);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 1ea12c2..c8370f6 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 _0xb9a7=['faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','post','tracked'];(function(_0xe8200c,_0x2291c3){var _0x82df44=function(_0x25c2ec){while(--_0x25c2ec){_0xe8200c['push'](_0xe8200c['shift']());}};_0x82df44(++_0x2291c3);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb9a7[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['describe']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['download']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),interaction[_0x7b9a('0xd')]('fax',_0x7b9a('0xe')),controller[_0x7b9a('0xf')]);router[_0x7b9a('0x10')]('/:id',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x11')]);router['put'](_0x7b9a('0x12'),auth[_0x7b9a('0x7')](),controller['accept']);router[_0x7b9a('0x10')](_0x7b9a('0x13'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x14')]);router[_0x7b9a('0x15')](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x16')]);module[_0x7b9a('0x17')]=router; \ No newline at end of file +var _0x0565=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','tracked','create','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer'];(function(_0x9a2f5,_0x6095ba){var _0x1b9757=function(_0x39caa1){while(--_0x39caa1){_0x9a2f5['push'](_0x9a2f5['shift']());}};_0x1b9757(++_0x6095ba);}(_0x0565,0xf2));var _0x5056=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x0565[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var path=require(_0x5056('0x2'));var timeout=require(_0x5056('0x3'));var express=require(_0x5056('0x4'));var router=express[_0x5056('0x5')]();var fs_extra=require(_0x5056('0x6'));var auth=require(_0x5056('0x7'));var interaction=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var controller=require('./faxMessage.controller');router[_0x5056('0xa')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0xc')]);router[_0x5056('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5056('0xd')]);router[_0x5056('0xa')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller[_0x5056('0xf')]);router[_0x5056('0xa')](_0x5056('0x10'),auth[_0x5056('0xb')](),controller['download']);router[_0x5056('0x11')]('/',auth[_0x5056('0xb')](),interaction[_0x5056('0x12')]('fax','faxmessage:create'),controller[_0x5056('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5056('0x14')]);router['put'](_0x5056('0x15'),auth[_0x5056('0xb')](),controller[_0x5056('0x16')]);router['put'](_0x5056('0x17'),auth[_0x5056('0xb')](),controller[_0x5056('0x18')]);router[_0x5056('0x19')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller['destroy']);module[_0x5056('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6f02502..4bbf88b 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 _0xad75=['INTEGER','ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad75,0x145));var _0x5ad7=function(_0x47a951,_0x462b07){_0x47a951=_0x47a951-0x0;var _0x9274ae=_0xad75[_0x47a951];return _0x9274ae;};'use strict';var Sequelize=require(_0x5ad7('0x0'));module[_0x5ad7('0x1')]={'name':{'type':Sequelize[_0x5ad7('0x2')],'unique':_0x5ad7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5ad7('0x2')]},'timeout':{'type':Sequelize[_0x5ad7('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5ad7('0x5')]('rrmemory',_0x5ad7('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5ad7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0648=['INTEGER','STRING','name','ENUM','beepall','roundrobin'];(function(_0x27eeb5,_0x294150){var _0x2a3a7d=function(_0x3c7647){while(--_0x3c7647){_0x27eeb5['push'](_0x27eeb5['shift']());}};_0x2a3a7d(++_0x294150);}(_0x0648,0x1a5));var _0x8064=function(_0x33f557,_0x12b78d){_0x33f557=_0x33f557-0x0;var _0x3514a6=_0x0648[_0x33f557];return _0x3514a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8064('0x0')],'unique':_0x8064('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8064('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8064('0x2')]('rrmemory',_0x8064('0x3'),_0x8064('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8064('0x5')],'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 0723b4e..5ef090c 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 _0xfc6f=['rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getMembers','findOne','UserFaxQueue','sort','FaxQueueId','User','UserId','agent','createdAt','format','SIP','faxPause','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','union','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./faxQueue.socket','register','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x2cf0ab,_0x22a91a){var _0x233750=function(_0x14acc8){while(--_0x14acc8){_0x2cf0ab['push'](_0x2cf0ab['shift']());}};_0x233750(++_0x22a91a);}(_0xfc6f,0x164));var _0xffc6=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xfc6f[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0xffc6('0x0'));var rimraf=require(_0xffc6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffc6('0x2'));var rp=require(_0xffc6('0x3'));var moment=require(_0xffc6('0x4'));var BPromise=require(_0xffc6('0x5'));var Mustache=require('mustache');var util=require(_0xffc6('0x6'));var path=require('path');var sox=require(_0xffc6('0x7'));var csv=require(_0xffc6('0x8'));var ejs=require(_0xffc6('0x9'));var fs=require('fs');var fs_extra=require(_0xffc6('0xa'));var _=require(_0xffc6('0xb'));var squel=require('squel');var crypto=require(_0xffc6('0xc'));var jsforce=require(_0xffc6('0xd'));var deskjs=require(_0xffc6('0xe'));var toCsv=require(_0xffc6('0x8'));var querystring=require(_0xffc6('0xf'));var Papa=require(_0xffc6('0x10'));var Redis=require(_0xffc6('0x11'));var authService=require(_0xffc6('0x12'));var qs=require(_0xffc6('0x13'));var as=require(_0xffc6('0x14'));var hardwareService=require(_0xffc6('0x15'));var logger=require(_0xffc6('0x16'))(_0xffc6('0x17'));var utils=require(_0xffc6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xffc6('0x19'));var db=require(_0xffc6('0x1a'))['db'];config[_0xffc6('0x1b')]=_['defaults'](config[_0xffc6('0x1b')],{'host':_0xffc6('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xffc6('0x1b')]));require(_0xffc6('0x1d'))[_0xffc6('0x1e')](socket);function respondWithStatusCode(_0x38e363,_0x1c699b){_0x1c699b=_0x1c699b||0xcc;return function(_0x3067e0){if(_0x3067e0){return _0x38e363['sendStatus'](_0x1c699b);}return _0x38e363['status'](_0x1c699b)[_0xffc6('0x1f')]();};}function respondWithResult(_0x10da9b,_0xa86825){_0xa86825=_0xa86825||0xc8;return function(_0x2dfc0c){if(_0x2dfc0c){return _0x10da9b[_0xffc6('0x20')](_0xa86825)[_0xffc6('0x21')](_0x2dfc0c);}};}function respondWithFilteredResult(_0x393bb1,_0x430bcc){return function(_0x492fc5){if(_0x492fc5){var _0x4aef9b=typeof _0x430bcc['offset']==='undefined'&&typeof _0x430bcc[_0xffc6('0x22')]===_0xffc6('0x23');var _0x1dcea6=_0x492fc5[_0xffc6('0x24')];var _0x1aed76=_0x4aef9b?0x0:_0x430bcc['offset'];var _0x1bcf2a=_0x4aef9b?_0x492fc5[_0xffc6('0x24')]:_0x430bcc[_0xffc6('0x25')]+_0x430bcc['limit'];var _0x492cbf;if(_0x1bcf2a>=_0x1dcea6){_0x1bcf2a=_0x1dcea6;_0x492cbf=0xc8;}else{_0x492cbf=0xce;}_0x393bb1[_0xffc6('0x20')](_0x492cbf);return _0x393bb1[_0xffc6('0x26')](_0xffc6('0x27'),_0x1aed76+'-'+_0x1bcf2a+'/'+_0x1dcea6)[_0xffc6('0x21')](_0x492fc5);}return null;};}function patchUpdates(_0x2c8d8e){return function(_0x5643ae){try{jsonpatch['apply'](_0x5643ae,_0x2c8d8e,!![]);}catch(_0x5d4c10){return BPromise[_0xffc6('0x28')](_0x5d4c10);}return _0x5643ae[_0xffc6('0x29')]();};}function saveUpdates(_0x530a15,_0x3ba90f){return function(_0x51ad85){if(_0x51ad85){return _0x51ad85[_0xffc6('0x2a')](_0x530a15)[_0xffc6('0x2b')](function(_0x19e090){return _0x19e090;});}return null;};}function removeEntity(_0x133c5b,_0x832207){return function(_0x11cec1){if(_0x11cec1){return _0x11cec1['destroy']()[_0xffc6('0x2b')](function(){var _0x2dfe30=_0x11cec1[_0xffc6('0x2c')]({'plain':!![]});var _0x2a5568=_0xffc6('0x2d');return db[_0xffc6('0x2e')][_0xffc6('0x2f')]({'where':{'type':_0x2a5568,'resourceId':_0x2dfe30['id']}})[_0xffc6('0x2b')](function(){return _0x11cec1;});})[_0xffc6('0x2b')](function(){_0x133c5b[_0xffc6('0x20')](0xcc)[_0xffc6('0x1f')]();});}};}function handleEntityNotFound(_0x48a120,_0x531a5d){return function(_0x45dc7c){if(!_0x45dc7c){_0x48a120[_0xffc6('0x30')](0x194);}return _0x45dc7c;};}function handleError(_0x3f35f1,_0x5cba21){_0x5cba21=_0x5cba21||0x1f4;return function(_0x48e21b){logger[_0xffc6('0x31')](_0x48e21b[_0xffc6('0x32')]);if(_0x48e21b[_0xffc6('0x33')]){delete _0x48e21b[_0xffc6('0x33')];}_0x3f35f1[_0xffc6('0x20')](_0x5cba21)[_0xffc6('0x34')](_0x48e21b);};}exports[_0xffc6('0x35')]=function(_0x135396,_0x4334ba){var _0x47805b={},_0x1399fb={},_0x505965={'count':0x0,'rows':[]};var _0x517733=_[_0xffc6('0x36')](db[_0xffc6('0x37')][_0xffc6('0x38')],function(_0x40440f){return{'name':_0x40440f[_0xffc6('0x39')],'type':_0x40440f[_0xffc6('0x3a')][_0xffc6('0x3b')]};});_0x1399fb['model']=_[_0xffc6('0x36')](_0x517733,'name');_0x1399fb['query']=_['keys'](_0x135396[_0xffc6('0x3c')]);_0x1399fb[_0xffc6('0x3d')]=_[_0xffc6('0x3e')](_0x1399fb['model'],_0x1399fb['query']);_0x47805b[_0xffc6('0x3f')]=_['intersection'](_0x1399fb[_0xffc6('0x40')],qs[_0xffc6('0x41')](_0x135396[_0xffc6('0x3c')][_0xffc6('0x41')]));_0x47805b['attributes']=_0x47805b[_0xffc6('0x3f')][_0xffc6('0x42')]?_0x47805b[_0xffc6('0x3f')]:_0x1399fb['model'];if(!_0x135396[_0xffc6('0x3c')][_0xffc6('0x43')](_0xffc6('0x44'))){_0x47805b[_0xffc6('0x22')]=qs[_0xffc6('0x22')](_0x135396[_0xffc6('0x3c')]['limit']);_0x47805b[_0xffc6('0x25')]=qs[_0xffc6('0x25')](_0x135396[_0xffc6('0x3c')][_0xffc6('0x25')]);}_0x47805b[_0xffc6('0x45')]=qs['sort'](_0x135396[_0xffc6('0x3c')]['sort']);_0x47805b[_0xffc6('0x46')]=qs['filters'](_[_0xffc6('0x47')](_0x135396['query'],_0x1399fb[_0xffc6('0x3d')]),_0x517733);if(_0x135396['query'][_0xffc6('0x48')]){_0x47805b['where']=_[_0xffc6('0x49')](_0x47805b['where'],{'$or':_[_0xffc6('0x36')](_0x517733,function(_0x5eb29a){if(_0x5eb29a[_0xffc6('0x3a')]!==_0xffc6('0x4a')){var _0x2c5317={};_0x2c5317[_0x5eb29a[_0xffc6('0x33')]]={'$like':'%'+_0x135396[_0xffc6('0x3c')]['filter']+'%'};return _0x2c5317;}})});}_0x47805b=_[_0xffc6('0x49')]({},_0x47805b,_0x135396[_0xffc6('0x4b')]);var _0x117ec4={'where':_0x47805b[_0xffc6('0x46')]};return db[_0xffc6('0x37')]['count'](_0x117ec4)[_0xffc6('0x2b')](function(_0x3967a9){_0x505965['count']=_0x3967a9;if(_0x135396['query'][_0xffc6('0x4c')]){_0x47805b[_0xffc6('0x4d')]=[{'all':!![]}];}return db['FaxQueue'][_0xffc6('0x4e')](_0x47805b);})[_0xffc6('0x2b')](function(_0x16ba54){_0x505965[_0xffc6('0x4f')]=_0x16ba54;return _0x505965;})[_0xffc6('0x2b')](respondWithFilteredResult(_0x4334ba,_0x47805b))[_0xffc6('0x50')](handleError(_0x4334ba,null));};exports[_0xffc6('0x51')]=function(_0x4f4f43,_0x54db31){var _0x52fe45={'raw':!![],'where':{'id':_0x4f4f43[_0xffc6('0x52')]['id']}},_0x1aef16={};_0x1aef16[_0xffc6('0x40')]=_['keys'](db[_0xffc6('0x37')][_0xffc6('0x38')]);_0x1aef16['query']=_[_0xffc6('0x53')](_0x4f4f43[_0xffc6('0x3c')]);_0x1aef16[_0xffc6('0x3d')]=_[_0xffc6('0x3e')](_0x1aef16[_0xffc6('0x40')],_0x1aef16[_0xffc6('0x3c')]);_0x52fe45[_0xffc6('0x3f')]=_[_0xffc6('0x3e')](_0x1aef16['model'],qs[_0xffc6('0x41')](_0x4f4f43[_0xffc6('0x3c')][_0xffc6('0x41')]));_0x52fe45[_0xffc6('0x3f')]=_0x52fe45[_0xffc6('0x3f')][_0xffc6('0x42')]?_0x52fe45['attributes']:_0x1aef16[_0xffc6('0x40')];if(_0x4f4f43['query'][_0xffc6('0x4c')]){_0x52fe45[_0xffc6('0x4d')]=[{'all':!![]}];}_0x52fe45=_[_0xffc6('0x49')]({},_0x52fe45,_0x4f4f43['options']);return db[_0xffc6('0x37')][_0xffc6('0x54')](_0x52fe45)[_0xffc6('0x2b')](handleEntityNotFound(_0x54db31,null))[_0xffc6('0x2b')](respondWithResult(_0x54db31,null))[_0xffc6('0x50')](handleError(_0x54db31,null));};exports[_0xffc6('0x55')]=function(_0x13d140,_0x103bd4){return db[_0xffc6('0x37')]['create'](_0x13d140[_0xffc6('0x56')],{})[_0xffc6('0x2b')](function(_0x411d55){var _0x49253c=_0x13d140[_0xffc6('0x57')][_0xffc6('0x2c')]({'plain':!![]});if(!_0x49253c)throw new Error(_0xffc6('0x58'));if(_0x49253c[_0xffc6('0x59')]===_0xffc6('0x57')){var _0x5aa760=_0x411d55['get']({'plain':!![]});var _0x59528d=_0xffc6('0x2d');return db[_0xffc6('0x5a')][_0xffc6('0x54')]({'where':{'name':_0x59528d,'userProfileId':_0x49253c[_0xffc6('0x5b')]},'raw':!![]})['then'](function(_0x5ba8f8){if(_0x5ba8f8&&_0x5ba8f8[_0xffc6('0x5c')]===0x0){return db['UserProfileResource'][_0xffc6('0x55')]({'name':_0x5aa760['name'],'resourceId':_0x5aa760['id'],'type':_0x5ba8f8[_0xffc6('0x33')],'sectionId':_0x5ba8f8['id']},{})['then'](function(){return _0x411d55;});}else{return _0x411d55;}})['catch'](function(_0x5d05d4){logger[_0xffc6('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d05d4);throw _0x5d05d4;});}return _0x411d55;})[_0xffc6('0x2b')](respondWithResult(_0x103bd4,0xc9))[_0xffc6('0x50')](handleError(_0x103bd4,null));};exports[_0xffc6('0x2a')]=function(_0xad02b4,_0x29e7cb){if(_0xad02b4[_0xffc6('0x56')]['id']){delete _0xad02b4[_0xffc6('0x56')]['id'];}return db[_0xffc6('0x37')][_0xffc6('0x54')]({'where':{'id':_0xad02b4[_0xffc6('0x52')]['id']}})[_0xffc6('0x2b')](handleEntityNotFound(_0x29e7cb,null))['then'](saveUpdates(_0xad02b4['body'],null))[_0xffc6('0x2b')](respondWithResult(_0x29e7cb,null))['catch'](handleError(_0x29e7cb,null));};exports[_0xffc6('0x2f')]=function(_0x4a70fc,_0x450bb0){return db[_0xffc6('0x37')][_0xffc6('0x54')]({'where':{'id':_0x4a70fc[_0xffc6('0x52')]['id']}})[_0xffc6('0x2b')](handleEntityNotFound(_0x450bb0,null))[_0xffc6('0x2b')](removeEntity(_0x450bb0,null))[_0xffc6('0x50')](handleError(_0x450bb0,null));};exports['describe']=function(_0x1640fa,_0x211aed){return db[_0xffc6('0x37')]['describe']()[_0xffc6('0x2b')](respondWithResult(_0x211aed,null))[_0xffc6('0x50')](handleError(_0x211aed,null));};exports[_0xffc6('0x5d')]=function(_0x22a392,_0x4384fe,_0x4f7ea0){var _0x59f552={'raw':!![],'where':{}},_0x76a488={},_0x54c538;return db[_0xffc6('0x37')][_0xffc6('0x5e')]({'where':{'id':_0x22a392['params']['id']}})[_0xffc6('0x2b')](handleEntityNotFound(_0x4384fe,null))[_0xffc6('0x2b')](function(_0x4f93cb){if(_0x4f93cb){_0x54c538=_0x4f93cb[_0xffc6('0x2c')]({'plain':!![]});_0x76a488['model']=_[_0xffc6('0x53')](db[_0xffc6('0x5f')][_0xffc6('0x38')]);_0x76a488['query']=_[_0xffc6('0x53')](_0x22a392[_0xffc6('0x3c')]);_0x76a488[_0xffc6('0x3d')]=_[_0xffc6('0x3e')](_0x76a488['model'],_0x76a488[_0xffc6('0x3c')]);_0x59f552[_0xffc6('0x3f')]=_[_0xffc6('0x3e')](_0x76a488[_0xffc6('0x40')],qs[_0xffc6('0x41')](_0x22a392[_0xffc6('0x3c')][_0xffc6('0x41')]));_0x59f552['attributes']=_0x59f552[_0xffc6('0x3f')][_0xffc6('0x42')]?_0x59f552[_0xffc6('0x3f')]:_0x76a488['model'];if(!_0x22a392[_0xffc6('0x3c')][_0xffc6('0x43')](_0xffc6('0x44'))){_0x59f552['limit']=qs['limit'](_0x22a392[_0xffc6('0x3c')][_0xffc6('0x22')]);_0x59f552[_0xffc6('0x25')]=qs[_0xffc6('0x25')](_0x22a392[_0xffc6('0x3c')]['offset']);}_0x59f552['order']=qs[_0xffc6('0x60')](_0x22a392[_0xffc6('0x3c')][_0xffc6('0x60')]);_0x59f552[_0xffc6('0x46')]=qs[_0xffc6('0x3d')](_[_0xffc6('0x47')](_0x22a392[_0xffc6('0x3c')],_0x76a488[_0xffc6('0x3d')]));_0x59f552['where'][_0xffc6('0x61')]=_0x4f93cb['id'];if(_0x22a392[_0xffc6('0x3c')][_0xffc6('0x48')]){_0x59f552['where']=_[_0xffc6('0x49')](_0x59f552[_0xffc6('0x46')],{'$or':_['map'](_0x59f552['attributes'],function(_0x43b26e){var _0x2b5258={};_0x2b5258[_0x43b26e]={'$like':'%'+_0x22a392[_0xffc6('0x3c')][_0xffc6('0x48')]+'%'};return _0x2b5258;})});}_0x59f552=_[_0xffc6('0x49')]({},_0x59f552,_0x22a392[_0xffc6('0x4b')]);return db[_0xffc6('0x5f')][_0xffc6('0x4e')](_0x59f552);}})[_0xffc6('0x2b')](function(_0x4f78bf){if(_0x4f78bf){return db[_0xffc6('0x62')]['findAndCountAll']({'where':{'id':_[_0xffc6('0x36')](_0x4f78bf,_0xffc6('0x63')),'role':_0xffc6('0x64')},'attributes':['id','name','faxPause','updatedAt',_0xffc6('0x65')]});}})['then'](function(_0x2c28a4){if(_0x2c28a4){return{'count':_0x2c28a4['count'],'rows':_['map'](_0x2c28a4[_0xffc6('0x4f')],function(_0x365754){return{'membername':_0x365754[_0xffc6('0x33')],'UserId':_0x365754['id'],'queue_name':_0x54c538[_0xffc6('0x33')],'FaxQueueId':_0x54c538['id'],'interface':util[_0xffc6('0x66')]('%s/%s',_0xffc6('0x67'),_0x365754[_0xffc6('0x33')]),'penalty':0x0,'paused':_0x365754[_0xffc6('0x68')],'createdAt':_0x365754['createdAt'],'updatedAt':_0x365754['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xffc6('0x2b')](respondWithFilteredResult(_0x4384fe,_0x59f552))['catch'](handleError(_0x4384fe,null));};exports[_0xffc6('0x69')]=function(_0x4dc37c,_0x59abe4,_0x405392){var _0x1d56a8={};var _0x5acc28={};var _0x4066a5;var _0x463d6d;return db[_0xffc6('0x37')][_0xffc6('0x5e')]({'where':{'id':_0x4dc37c[_0xffc6('0x52')]['id']}})['then'](handleEntityNotFound(_0x59abe4,null))[_0xffc6('0x2b')](function(_0x5230c0){if(_0x5230c0){_0x4066a5=_0x5230c0;_0x5acc28[_0xffc6('0x40')]=_[_0xffc6('0x53')](db[_0xffc6('0x6a')][_0xffc6('0x38')]);_0x5acc28['query']=_[_0xffc6('0x53')](_0x4dc37c['query']);_0x5acc28[_0xffc6('0x3d')]=_[_0xffc6('0x3e')](_0x5acc28[_0xffc6('0x40')],_0x5acc28[_0xffc6('0x3c')]);_0x1d56a8[_0xffc6('0x3f')]=_[_0xffc6('0x3e')](_0x5acc28[_0xffc6('0x40')],qs[_0xffc6('0x41')](_0x4dc37c[_0xffc6('0x3c')][_0xffc6('0x41')]));_0x1d56a8[_0xffc6('0x3f')]=_0x1d56a8['attributes'][_0xffc6('0x42')]?_0x1d56a8[_0xffc6('0x3f')]:_0x5acc28[_0xffc6('0x40')];_0x1d56a8[_0xffc6('0x45')]=qs[_0xffc6('0x60')](_0x4dc37c[_0xffc6('0x3c')][_0xffc6('0x60')]);_0x1d56a8[_0xffc6('0x46')]=qs[_0xffc6('0x3d')](_[_0xffc6('0x47')](_0x4dc37c[_0xffc6('0x3c')],_0x5acc28[_0xffc6('0x3d')]));if(_0x4dc37c[_0xffc6('0x3c')]['filter']){_0x1d56a8[_0xffc6('0x46')]=_[_0xffc6('0x49')](_0x1d56a8[_0xffc6('0x46')],{'$or':_['map'](_0x1d56a8[_0xffc6('0x3f')],function(_0x4a055b){var _0x494254={};_0x494254[_0x4a055b]={'$like':'%'+_0x4dc37c['query'][_0xffc6('0x48')]+'%'};return _0x494254;})});}_0x1d56a8=_[_0xffc6('0x49')]({},_0x1d56a8,_0x4dc37c[_0xffc6('0x4b')]);return _0x4066a5[_0xffc6('0x69')](_0x1d56a8);}})[_0xffc6('0x2b')](function(_0xb752cb){if(_0xb752cb){_0x463d6d=_0xb752cb[_0xffc6('0x42')];if(!_0x4dc37c[_0xffc6('0x3c')]['hasOwnProperty'](_0xffc6('0x44'))){_0x1d56a8[_0xffc6('0x22')]=qs[_0xffc6('0x22')](_0x4dc37c[_0xffc6('0x3c')][_0xffc6('0x22')]);_0x1d56a8['offset']=qs[_0xffc6('0x25')](_0x4dc37c[_0xffc6('0x3c')][_0xffc6('0x25')]);}return _0x4066a5[_0xffc6('0x69')](_0x1d56a8);}})[_0xffc6('0x2b')](function(_0x24cbcb){if(_0x24cbcb){return _0x24cbcb?{'count':_0x463d6d,'rows':_0x24cbcb}:null;}})[_0xffc6('0x2b')](respondWithResult(_0x59abe4,null))[_0xffc6('0x50')](handleError(_0x59abe4,null));};exports['addTeams']=function(_0x44a532,_0x27268c,_0x408068){var _0x4a248b=_0x44a532[_0xffc6('0x56')][_0xffc6('0x6b')];return db['Team'][_0xffc6('0x4e')]({'where':{'id':_0x4a248b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xffc6('0x6c'),'attributes':['id','name','online',_0xffc6('0x6d'),_0xffc6('0x6e')],'raw':!![]}]})[_0xffc6('0x2b')](function(_0x23a42b){if(_0x23a42b){var _0x2091af=_[_0xffc6('0x6f')](_0x23a42b,function(_0x4864fe){var _0x2e3f32=_0x4864fe[_0xffc6('0x2c')]({'plain':!![]});return _0x2e3f32[_0xffc6('0x6c')];});return db[_0xffc6('0x37')][_0xffc6('0x54')]({'where':{'id':_0x44a532['params']['id']}})[_0xffc6('0x2b')](function(_0x5b0e71){return db[_0xffc6('0x70')][_0xffc6('0x71')](function(_0x1d7647){return _0x5b0e71[_0xffc6('0x72')](_0x4a248b,{'transaction':_0x1d7647})[_0xffc6('0x2b')](function(){return BPromise['each'](_0x2091af,function(_0x64374d){return db['UserFaxQueue'][_0xffc6('0x73')]({'where':{'UserId':_0x64374d['id'],'FaxQueueId':_0x44a532[_0xffc6('0x52')]['id']},'transaction':_0x1d7647});});})[_0xffc6('0x2b')](function(){_0x2091af[_0xffc6('0x74')](function(_0x3a9149){socket['emit'](_0xffc6('0x75'),{'UserId':_0x3a9149['id'],'FaxQueueId':_0x5b0e71['id']});});});});});}})[_0xffc6('0x2b')](respondWithStatusCode(_0x27268c,null))[_0xffc6('0x50')](handleError(_0x27268c,null));};exports[_0xffc6('0x76')]=function(_0x3ab2c4,_0x62620b,_0x178c4d){return db[_0xffc6('0x6a')][_0xffc6('0x4e')]({'where':{'id':_0x3ab2c4[_0xffc6('0x3c')][_0xffc6('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xffc6('0x62')],'as':_0xffc6('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xffc6('0x2b')](handleEntityNotFound(_0x62620b,null))['then'](function(_0x36d562){var _0xd5b431=_[_0xffc6('0x36')](_0x36d562,'id');var _0x345a03=[];var _0x518e22=[];var _0x8eb472=squel[_0xffc6('0x77')]();_0x8eb472[_0xffc6('0x78')](_0xffc6('0x79'))[_0xffc6('0x7a')](_0xffc6('0x7b'),'tq')[_0xffc6('0x7c')]('user_has_teams','ut',_0xffc6('0x7d'))[_0xffc6('0x46')](_0xffc6('0x7e'),_0x3ab2c4['params']['id']);for(var _0x1a2874=0x0;_0x1a2874<_0x36d562[_0xffc6('0x42')];_0x1a2874+=0x1){let _0xda3a2d=_0x36d562[_0x1a2874];for(var _0xff72e3=0x0;_0xff72e3<_0xda3a2d['Agents'][_0xffc6('0x42')];_0xff72e3+=0x1){let _0x1b9e70=_0xda3a2d[_0xffc6('0x6c')][_0xff72e3];var _0xe38b98=_0x8eb472[_0xffc6('0x7f')]();_0xe38b98[_0xffc6('0x46')](_0xffc6('0x80'),_0x1b9e70['id']);_0x518e22[_0xffc6('0x81')](db[_0xffc6('0x70')][_0xffc6('0x3c')](_0xe38b98[_0xffc6('0x82')](),{'type':db[_0xffc6('0x70')][_0xffc6('0x83')][_0xffc6('0x84')]})[_0xffc6('0x2b')](function(_0x2d8549){if(_0x2d8549[_0xffc6('0x42')]===0x1){return _0x1b9e70['id'];}else{var _0x4e4b9d=_[_0xffc6('0x85')](_[_0xffc6('0x36')](_0x2d8549,'TeamId'),function(_0x33abcc){return _['includes'](_0xd5b431,_0x33abcc);});if(_0x4e4b9d){return _0x1b9e70['id'];}}}));}}return BPromise['all'](_0x518e22)[_0xffc6('0x2b')](function(_0x3da147){_0x345a03=_(_0x345a03)[_0xffc6('0x86')](_0x3da147)[_0xffc6('0x87')]()[_0xffc6('0x88')]();return db[_0xffc6('0x37')]['find']({'where':{'id':_0x3ab2c4['params']['id']}})[_0xffc6('0x2b')](function(_0x5edb7e){return db[_0xffc6('0x70')][_0xffc6('0x71')](function(_0x1fc044){return _0x5edb7e[_0xffc6('0x76')](_0x3ab2c4['query'][_0xffc6('0x6b')],{'transaction':_0x1fc044})[_0xffc6('0x2b')](function(){if(!_[_0xffc6('0x89')](_0x345a03)){return _0x5edb7e[_0xffc6('0x8a')](_0x345a03,{'transaction':_0x1fc044});}})['then'](function(){_0x345a03[_0xffc6('0x74')](function(_0x4388a3){socket[_0xffc6('0x8b')](_0xffc6('0x8c'),{'UserId':_0x4388a3,'FaxQueueId':_0x5edb7e['id']});});});});});});})[_0xffc6('0x2b')](respondWithStatusCode(_0x62620b,null))[_0xffc6('0x50')](handleError(_0x62620b,null));};exports[_0xffc6('0x8d')]=function(_0x1624ad,_0x2393d4,_0x44768e){return db[_0xffc6('0x37')][_0xffc6('0x54')]({'where':{'id':_0x1624ad[_0xffc6('0x52')]['id']}})[_0xffc6('0x2b')](handleEntityNotFound(_0x2393d4,null))[_0xffc6('0x2b')](function(_0xc4d0f5){if(_0xc4d0f5){return _0xc4d0f5[_0xffc6('0x8d')](_0x1624ad['body'][_0xffc6('0x6b')],_['omit'](_0x1624ad['body'],[_0xffc6('0x6b'),'id'])||{})[_0xffc6('0x8e')](function(_0x4a11e4){for(var _0x25b8c0=0x0;_0x25b8c0<_0x1624ad['body'][_0xffc6('0x6b')]['length'];_0x25b8c0+=0x1){socket[_0xffc6('0x8b')]('userFaxQueue:save',{'UserId':Number(_0x1624ad[_0xffc6('0x56')][_0xffc6('0x6b')][_0x25b8c0]),'FaxQueueId':Number(_0x1624ad[_0xffc6('0x52')]['id'])});}return _0x4a11e4;});}})[_0xffc6('0x2b')](respondWithResult(_0x2393d4,null))[_0xffc6('0x50')](handleError(_0x2393d4,null));};exports[_0xffc6('0x8a')]=function(_0x364abf,_0x598bf6,_0x192413){return db[_0xffc6('0x37')][_0xffc6('0x54')]({'where':{'id':_0x364abf['params']['id']}})['then'](handleEntityNotFound(_0x598bf6,null))[_0xffc6('0x2b')](function(_0x3a7a50){if(_0x3a7a50){return _0x3a7a50[_0xffc6('0x8a')](_0x364abf[_0xffc6('0x3c')][_0xffc6('0x6b')])['then'](function(){if(_[_0xffc6('0x8f')](_0x364abf[_0xffc6('0x3c')]['ids'])){for(var _0x16c7cb=0x0;_0x16c7cb<_0x364abf[_0xffc6('0x3c')][_0xffc6('0x6b')]['length'];_0x16c7cb+=0x1){socket[_0xffc6('0x8b')](_0xffc6('0x8c'),{'UserId':Number(_0x364abf[_0xffc6('0x3c')]['ids'][_0x16c7cb]),'FaxQueueId':Number(_0x364abf[_0xffc6('0x52')]['id'])});}}else{socket[_0xffc6('0x8b')](_0xffc6('0x8c'),{'UserId':Number(_0x364abf[_0xffc6('0x3c')][_0xffc6('0x6b')]),'FaxQueueId':Number(_0x364abf['params']['id'])});}});}})[_0xffc6('0x2b')](respondWithStatusCode(_0x598bf6,null))[_0xffc6('0x50')](handleError(_0x598bf6,null));};exports[_0xffc6('0x90')]=function(_0x508724,_0x1d0572,_0x336ca6){var _0x54acf1={};var _0x2b5260={};var _0x5cd8a9;var _0x50cfec;return db[_0xffc6('0x37')][_0xffc6('0x5e')]({'where':{'id':_0x508724[_0xffc6('0x52')]['id']}})[_0xffc6('0x2b')](handleEntityNotFound(_0x1d0572,null))[_0xffc6('0x2b')](function(_0x225e79){if(_0x225e79){_0x5cd8a9=_0x225e79;_0x2b5260[_0xffc6('0x40')]=_[_0xffc6('0x53')](db['User']['rawAttributes']);_0x2b5260[_0xffc6('0x3c')]=_[_0xffc6('0x53')](_0x508724[_0xffc6('0x3c')]);_0x2b5260[_0xffc6('0x3d')]=_[_0xffc6('0x3e')](_0x2b5260[_0xffc6('0x40')],_0x2b5260[_0xffc6('0x3c')]);_0x54acf1[_0xffc6('0x3f')]=_[_0xffc6('0x3e')](_0x2b5260['model'],qs['fields'](_0x508724[_0xffc6('0x3c')]['fields']));_0x54acf1['attributes']=_0x54acf1[_0xffc6('0x3f')][_0xffc6('0x42')]?_0x54acf1[_0xffc6('0x3f')]:_0x2b5260[_0xffc6('0x40')];_0x54acf1[_0xffc6('0x45')]=qs['sort'](_0x508724['query'][_0xffc6('0x60')]);_0x54acf1[_0xffc6('0x46')]=qs['filters'](_[_0xffc6('0x47')](_0x508724['query'],_0x2b5260[_0xffc6('0x3d')]));if(_0x508724[_0xffc6('0x3c')][_0xffc6('0x48')]){_0x54acf1['where']=_[_0xffc6('0x49')](_0x54acf1[_0xffc6('0x46')],{'$or':_[_0xffc6('0x36')](_0x54acf1[_0xffc6('0x3f')],function(_0x41638b){var _0x4ac28c={};_0x4ac28c[_0x41638b]={'$like':'%'+_0x508724[_0xffc6('0x3c')][_0xffc6('0x48')]+'%'};return _0x4ac28c;})});}_0x54acf1=_[_0xffc6('0x49')]({},_0x54acf1,_0x508724[_0xffc6('0x4b')]);return _0x5cd8a9[_0xffc6('0x90')](_0x54acf1);}})[_0xffc6('0x2b')](function(_0x373353){if(_0x373353){_0x50cfec=_0x373353['length'];if(!_0x508724[_0xffc6('0x3c')][_0xffc6('0x43')](_0xffc6('0x44'))){_0x54acf1[_0xffc6('0x22')]=qs[_0xffc6('0x22')](_0x508724['query']['limit']);_0x54acf1[_0xffc6('0x25')]=qs['offset'](_0x508724['query']['offset']);}return _0x5cd8a9[_0xffc6('0x90')](_0x54acf1);}})[_0xffc6('0x2b')](function(_0x2928c4){if(_0x2928c4){return _0x2928c4?{'count':_0x50cfec,'rows':_0x2928c4}:null;}})[_0xffc6('0x2b')](respondWithResult(_0x1d0572,null))[_0xffc6('0x50')](handleError(_0x1d0572,null));}; \ No newline at end of file +var _0xcd37=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','addTeams','Team','voicePause','flatMap','Agents','transaction','each','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeAgents','emit','addAgents','ids','omit','spread','userFaxQueue:save','userFaxQueue:remove','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','destroy','FaxQueues','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','rows','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','UserProfileResource'];(function(_0xd2dd48,_0x1a985){var _0x3853db=function(_0x2cfb39){while(--_0x2cfb39){_0xd2dd48['push'](_0xd2dd48['shift']());}};_0x3853db(++_0x1a985);}(_0xcd37,0xbf));var _0x7cd3=function(_0x2ac357,_0x2fd595){_0x2ac357=_0x2ac357-0x0;var _0x359f74=_0xcd37[_0x2ac357];return _0x359f74;};'use strict';var emlformat=require(_0x7cd3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7cd3('0x1'));var jsonpatch=require(_0x7cd3('0x2'));var rp=require(_0x7cd3('0x3'));var moment=require(_0x7cd3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7cd3('0x5'));var util=require('util');var path=require(_0x7cd3('0x6'));var sox=require(_0x7cd3('0x7'));var csv=require(_0x7cd3('0x8'));var ejs=require(_0x7cd3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7cd3('0xa'));var squel=require('squel');var crypto=require(_0x7cd3('0xb'));var jsforce=require(_0x7cd3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7cd3('0xd'));var qs=require(_0x7cd3('0xe'));var as=require(_0x7cd3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cd3('0x10'))(_0x7cd3('0x11'));var utils=require(_0x7cd3('0x12'));var config=require(_0x7cd3('0x13'));var licenseUtil=require(_0x7cd3('0x14'));var db=require(_0x7cd3('0x15'))['db'];config[_0x7cd3('0x16')]=_[_0x7cd3('0x17')](config[_0x7cd3('0x16')],{'host':_0x7cd3('0x18'),'port':0x18eb});var socket=require(_0x7cd3('0x19'))(new Redis(config[_0x7cd3('0x16')]));require(_0x7cd3('0x1a'))['register'](socket);function respondWithStatusCode(_0x5128ac,_0x44c18b){_0x44c18b=_0x44c18b||0xcc;return function(_0x54a561){if(_0x54a561){return _0x5128ac[_0x7cd3('0x1b')](_0x44c18b);}return _0x5128ac[_0x7cd3('0x1c')](_0x44c18b)[_0x7cd3('0x1d')]();};}function respondWithResult(_0x5f5190,_0x2b0460){_0x2b0460=_0x2b0460||0xc8;return function(_0x40a3bf){if(_0x40a3bf){return _0x5f5190[_0x7cd3('0x1c')](_0x2b0460)[_0x7cd3('0x1e')](_0x40a3bf);}};}function respondWithFilteredResult(_0x5b7330,_0x579be7){return function(_0x3b0146){if(_0x3b0146){var _0x14297a=typeof _0x579be7[_0x7cd3('0x1f')]===_0x7cd3('0x20')&&typeof _0x579be7[_0x7cd3('0x21')]===_0x7cd3('0x20');var _0x191485=_0x3b0146[_0x7cd3('0x22')];var _0x14e8c4=_0x14297a?0x0:_0x579be7[_0x7cd3('0x1f')];var _0x23fba6=_0x14297a?_0x3b0146['count']:_0x579be7['offset']+_0x579be7['limit'];var _0x2be527;if(_0x23fba6>=_0x191485){_0x23fba6=_0x191485;_0x2be527=0xc8;}else{_0x2be527=0xce;}_0x5b7330[_0x7cd3('0x1c')](_0x2be527);return _0x5b7330['set']('Content-Range',_0x14e8c4+'-'+_0x23fba6+'/'+_0x191485)['json'](_0x3b0146);}return null;};}function patchUpdates(_0x54c164){return function(_0x1f82aa){try{jsonpatch['apply'](_0x1f82aa,_0x54c164,!![]);}catch(_0x30bc42){return BPromise[_0x7cd3('0x23')](_0x30bc42);}return _0x1f82aa[_0x7cd3('0x24')]();};}function saveUpdates(_0x176638,_0x2de3a4){return function(_0x1e6238){if(_0x1e6238){return _0x1e6238['update'](_0x176638)['then'](function(_0x1841df){return _0x1841df;});}return null;};}function removeEntity(_0x25c88e,_0xabc8ff){return function(_0x184135){if(_0x184135){return _0x184135[_0x7cd3('0x25')]()['then'](function(){var _0x543c54=_0x184135['get']({'plain':!![]});var _0x46895b=_0x7cd3('0x26');return db['UserProfileResource'][_0x7cd3('0x25')]({'where':{'type':_0x46895b,'resourceId':_0x543c54['id']}})[_0x7cd3('0x27')](function(){return _0x184135;});})[_0x7cd3('0x27')](function(){_0x25c88e[_0x7cd3('0x1c')](0xcc)[_0x7cd3('0x1d')]();});}};}function handleEntityNotFound(_0x541d73,_0x407ff8){return function(_0x55bee9){if(!_0x55bee9){_0x541d73['sendStatus'](0x194);}return _0x55bee9;};}function handleError(_0x5d9f7f,_0x5275fe){_0x5275fe=_0x5275fe||0x1f4;return function(_0x1e49f6){logger[_0x7cd3('0x28')](_0x1e49f6[_0x7cd3('0x29')]);if(_0x1e49f6['name']){delete _0x1e49f6[_0x7cd3('0x2a')];}_0x5d9f7f[_0x7cd3('0x1c')](_0x5275fe)[_0x7cd3('0x2b')](_0x1e49f6);};}exports['index']=function(_0x3d2201,_0x4d1e3f){var _0x4a8ce1={},_0x35131a={},_0x5b1c49={'count':0x0,'rows':[]};var _0x3c61fe=_[_0x7cd3('0x2c')](db['FaxQueue'][_0x7cd3('0x2d')],function(_0xdfa228){return{'name':_0xdfa228[_0x7cd3('0x2e')],'type':_0xdfa228[_0x7cd3('0x2f')][_0x7cd3('0x30')]};});_0x35131a[_0x7cd3('0x31')]=_['map'](_0x3c61fe,'name');_0x35131a[_0x7cd3('0x32')]=_[_0x7cd3('0x33')](_0x3d2201[_0x7cd3('0x32')]);_0x35131a[_0x7cd3('0x34')]=_[_0x7cd3('0x35')](_0x35131a['model'],_0x35131a[_0x7cd3('0x32')]);_0x4a8ce1['attributes']=_[_0x7cd3('0x35')](_0x35131a['model'],qs[_0x7cd3('0x36')](_0x3d2201[_0x7cd3('0x32')][_0x7cd3('0x36')]));_0x4a8ce1['attributes']=_0x4a8ce1[_0x7cd3('0x37')][_0x7cd3('0x38')]?_0x4a8ce1[_0x7cd3('0x37')]:_0x35131a[_0x7cd3('0x31')];if(!_0x3d2201[_0x7cd3('0x32')]['hasOwnProperty']('nolimit')){_0x4a8ce1['limit']=qs[_0x7cd3('0x21')](_0x3d2201['query']['limit']);_0x4a8ce1[_0x7cd3('0x1f')]=qs['offset'](_0x3d2201[_0x7cd3('0x32')]['offset']);}_0x4a8ce1[_0x7cd3('0x39')]=qs[_0x7cd3('0x3a')](_0x3d2201['query'][_0x7cd3('0x3a')]);_0x4a8ce1[_0x7cd3('0x3b')]=qs['filters'](_['pick'](_0x3d2201[_0x7cd3('0x32')],_0x35131a[_0x7cd3('0x34')]),_0x3c61fe);if(_0x3d2201[_0x7cd3('0x32')][_0x7cd3('0x3c')]){_0x4a8ce1[_0x7cd3('0x3b')]=_[_0x7cd3('0x3d')](_0x4a8ce1[_0x7cd3('0x3b')],{'$or':_[_0x7cd3('0x2c')](_0x3c61fe,function(_0x56a9ca){if(_0x56a9ca[_0x7cd3('0x2f')]!==_0x7cd3('0x3e')){var _0x1b34f={};_0x1b34f[_0x56a9ca['name']]={'$like':'%'+_0x3d2201[_0x7cd3('0x32')][_0x7cd3('0x3c')]+'%'};return _0x1b34f;}})});}_0x4a8ce1=_[_0x7cd3('0x3d')]({},_0x4a8ce1,_0x3d2201[_0x7cd3('0x3f')]);var _0x23722a={'where':_0x4a8ce1[_0x7cd3('0x3b')]};return db[_0x7cd3('0x40')][_0x7cd3('0x22')](_0x23722a)['then'](function(_0x560831){_0x5b1c49[_0x7cd3('0x22')]=_0x560831;if(_0x3d2201[_0x7cd3('0x32')]['includeAll']){_0x4a8ce1[_0x7cd3('0x41')]=[{'all':!![]}];}return db[_0x7cd3('0x40')][_0x7cd3('0x42')](_0x4a8ce1);})[_0x7cd3('0x27')](function(_0x3889eb){_0x5b1c49[_0x7cd3('0x43')]=_0x3889eb;return _0x5b1c49;})[_0x7cd3('0x27')](respondWithFilteredResult(_0x4d1e3f,_0x4a8ce1))['catch'](handleError(_0x4d1e3f,null));};exports['show']=function(_0x48c5f2,_0x31d562){var _0x1d802e={'raw':!![],'where':{'id':_0x48c5f2[_0x7cd3('0x44')]['id']}},_0x506712={};_0x506712['model']=_['keys'](db[_0x7cd3('0x40')]['rawAttributes']);_0x506712[_0x7cd3('0x32')]=_['keys'](_0x48c5f2[_0x7cd3('0x32')]);_0x506712['filters']=_[_0x7cd3('0x35')](_0x506712[_0x7cd3('0x31')],_0x506712[_0x7cd3('0x32')]);_0x1d802e[_0x7cd3('0x37')]=_['intersection'](_0x506712[_0x7cd3('0x31')],qs['fields'](_0x48c5f2[_0x7cd3('0x32')]['fields']));_0x1d802e[_0x7cd3('0x37')]=_0x1d802e[_0x7cd3('0x37')][_0x7cd3('0x38')]?_0x1d802e[_0x7cd3('0x37')]:_0x506712[_0x7cd3('0x31')];if(_0x48c5f2[_0x7cd3('0x32')][_0x7cd3('0x45')]){_0x1d802e[_0x7cd3('0x41')]=[{'all':!![]}];}_0x1d802e=_[_0x7cd3('0x3d')]({},_0x1d802e,_0x48c5f2[_0x7cd3('0x3f')]);return db[_0x7cd3('0x40')][_0x7cd3('0x46')](_0x1d802e)[_0x7cd3('0x27')](handleEntityNotFound(_0x31d562,null))[_0x7cd3('0x27')](respondWithResult(_0x31d562,null))[_0x7cd3('0x47')](handleError(_0x31d562,null));};exports[_0x7cd3('0x48')]=function(_0x587c90,_0x3878ca){return db[_0x7cd3('0x40')]['create'](_0x587c90[_0x7cd3('0x49')],{})[_0x7cd3('0x27')](function(_0x5bde92){var _0x4fd62d=_0x587c90['user']['get']({'plain':!![]});if(!_0x4fd62d)throw new Error(_0x7cd3('0x4a'));if(_0x4fd62d[_0x7cd3('0x4b')]===_0x7cd3('0x4c')){var _0x35caac=_0x5bde92[_0x7cd3('0x4d')]({'plain':!![]});var _0x26562f=_0x7cd3('0x26');return db[_0x7cd3('0x4e')][_0x7cd3('0x46')]({'where':{'name':_0x26562f,'userProfileId':_0x4fd62d['userProfileId']},'raw':!![]})[_0x7cd3('0x27')](function(_0x44a43b){if(_0x44a43b&&_0x44a43b[_0x7cd3('0x4f')]===0x0){return db[_0x7cd3('0x50')][_0x7cd3('0x48')]({'name':_0x35caac[_0x7cd3('0x2a')],'resourceId':_0x35caac['id'],'type':_0x44a43b['name'],'sectionId':_0x44a43b['id']},{})[_0x7cd3('0x27')](function(){return _0x5bde92;});}else{return _0x5bde92;}})['catch'](function(_0x3c320a){logger['error'](_0x7cd3('0x51'),_0x3c320a);throw _0x3c320a;});}return _0x5bde92;})[_0x7cd3('0x27')](respondWithResult(_0x3878ca,0xc9))[_0x7cd3('0x47')](handleError(_0x3878ca,null));};exports[_0x7cd3('0x52')]=function(_0x508d3a,_0xdfcd6){if(_0x508d3a['body']['id']){delete _0x508d3a['body']['id'];}return db[_0x7cd3('0x40')]['find']({'where':{'id':_0x508d3a[_0x7cd3('0x44')]['id']}})[_0x7cd3('0x27')](handleEntityNotFound(_0xdfcd6,null))['then'](saveUpdates(_0x508d3a[_0x7cd3('0x49')],null))['then'](respondWithResult(_0xdfcd6,null))[_0x7cd3('0x47')](handleError(_0xdfcd6,null));};exports[_0x7cd3('0x25')]=function(_0x20fb1d,_0x53e381){return db[_0x7cd3('0x40')][_0x7cd3('0x46')]({'where':{'id':_0x20fb1d[_0x7cd3('0x44')]['id']}})[_0x7cd3('0x27')](handleEntityNotFound(_0x53e381,null))[_0x7cd3('0x27')](removeEntity(_0x53e381,null))[_0x7cd3('0x47')](handleError(_0x53e381,null));};exports[_0x7cd3('0x53')]=function(_0x41b8d8,_0x53f35c){return db[_0x7cd3('0x40')][_0x7cd3('0x53')]()[_0x7cd3('0x27')](respondWithResult(_0x53f35c,null))[_0x7cd3('0x47')](handleError(_0x53f35c,null));};exports[_0x7cd3('0x54')]=function(_0x4e6161,_0x4b3c87,_0x482bac){var _0x25080a={'raw':!![],'where':{}},_0x436cbd={},_0x280aa3;return db[_0x7cd3('0x40')][_0x7cd3('0x55')]({'where':{'id':_0x4e6161[_0x7cd3('0x44')]['id']}})[_0x7cd3('0x27')](handleEntityNotFound(_0x4b3c87,null))['then'](function(_0x414297){if(_0x414297){_0x280aa3=_0x414297['get']({'plain':!![]});_0x436cbd['model']=_[_0x7cd3('0x33')](db[_0x7cd3('0x56')][_0x7cd3('0x2d')]);_0x436cbd['query']=_[_0x7cd3('0x33')](_0x4e6161[_0x7cd3('0x32')]);_0x436cbd[_0x7cd3('0x34')]=_['intersection'](_0x436cbd['model'],_0x436cbd[_0x7cd3('0x32')]);_0x25080a[_0x7cd3('0x37')]=_[_0x7cd3('0x35')](_0x436cbd['model'],qs[_0x7cd3('0x36')](_0x4e6161[_0x7cd3('0x32')][_0x7cd3('0x36')]));_0x25080a['attributes']=_0x25080a[_0x7cd3('0x37')]['length']?_0x25080a[_0x7cd3('0x37')]:_0x436cbd[_0x7cd3('0x31')];if(!_0x4e6161[_0x7cd3('0x32')]['hasOwnProperty'](_0x7cd3('0x57'))){_0x25080a[_0x7cd3('0x21')]=qs[_0x7cd3('0x21')](_0x4e6161[_0x7cd3('0x32')]['limit']);_0x25080a[_0x7cd3('0x1f')]=qs[_0x7cd3('0x1f')](_0x4e6161[_0x7cd3('0x32')][_0x7cd3('0x1f')]);}_0x25080a[_0x7cd3('0x39')]=qs[_0x7cd3('0x3a')](_0x4e6161[_0x7cd3('0x32')][_0x7cd3('0x3a')]);_0x25080a['where']=qs[_0x7cd3('0x34')](_['pick'](_0x4e6161[_0x7cd3('0x32')],_0x436cbd[_0x7cd3('0x34')]));_0x25080a[_0x7cd3('0x3b')][_0x7cd3('0x58')]=_0x414297['id'];if(_0x4e6161[_0x7cd3('0x32')]['filter']){_0x25080a['where']=_[_0x7cd3('0x3d')](_0x25080a[_0x7cd3('0x3b')],{'$or':_[_0x7cd3('0x2c')](_0x25080a['attributes'],function(_0x10f6ca){var _0x4e4f2c={};_0x4e4f2c[_0x10f6ca]={'$like':'%'+_0x4e6161[_0x7cd3('0x32')]['filter']+'%'};return _0x4e4f2c;})});}_0x25080a=_[_0x7cd3('0x3d')]({},_0x25080a,_0x4e6161['options']);return db[_0x7cd3('0x56')]['findAll'](_0x25080a);}})[_0x7cd3('0x27')](function(_0x3b3a64){if(_0x3b3a64){return db[_0x7cd3('0x59')][_0x7cd3('0x5a')]({'where':{'id':_[_0x7cd3('0x2c')](_0x3b3a64,_0x7cd3('0x5b')),'role':_0x7cd3('0x5c')},'attributes':['id',_0x7cd3('0x2a'),_0x7cd3('0x5d'),_0x7cd3('0x5e'),_0x7cd3('0x5f')]});}})[_0x7cd3('0x27')](function(_0xc7c0c8){if(_0xc7c0c8){return{'count':_0xc7c0c8[_0x7cd3('0x22')],'rows':_[_0x7cd3('0x2c')](_0xc7c0c8[_0x7cd3('0x43')],function(_0xe5f972){return{'membername':_0xe5f972[_0x7cd3('0x2a')],'UserId':_0xe5f972['id'],'queue_name':_0x280aa3['name'],'FaxQueueId':_0x280aa3['id'],'interface':util[_0x7cd3('0x60')](_0x7cd3('0x61'),_0x7cd3('0x62'),_0xe5f972[_0x7cd3('0x2a')]),'penalty':0x0,'paused':_0xe5f972['faxPause'],'createdAt':_0xe5f972['createdAt'],'updatedAt':_0xe5f972['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7cd3('0x27')](respondWithFilteredResult(_0x4b3c87,_0x25080a))[_0x7cd3('0x47')](handleError(_0x4b3c87,null));};exports[_0x7cd3('0x63')]=function(_0x56eb75,_0x144806,_0x3805ab){var _0x317f7b={};var _0x5a9437={};var _0x496c88;var _0x5606ab;return db[_0x7cd3('0x40')][_0x7cd3('0x55')]({'where':{'id':_0x56eb75[_0x7cd3('0x44')]['id']}})['then'](handleEntityNotFound(_0x144806,null))[_0x7cd3('0x27')](function(_0x5c7429){if(_0x5c7429){_0x496c88=_0x5c7429;_0x5a9437[_0x7cd3('0x31')]=_[_0x7cd3('0x33')](db['Team'][_0x7cd3('0x2d')]);_0x5a9437[_0x7cd3('0x32')]=_[_0x7cd3('0x33')](_0x56eb75[_0x7cd3('0x32')]);_0x5a9437['filters']=_['intersection'](_0x5a9437[_0x7cd3('0x31')],_0x5a9437[_0x7cd3('0x32')]);_0x317f7b[_0x7cd3('0x37')]=_[_0x7cd3('0x35')](_0x5a9437[_0x7cd3('0x31')],qs['fields'](_0x56eb75[_0x7cd3('0x32')][_0x7cd3('0x36')]));_0x317f7b['attributes']=_0x317f7b[_0x7cd3('0x37')][_0x7cd3('0x38')]?_0x317f7b[_0x7cd3('0x37')]:_0x5a9437[_0x7cd3('0x31')];_0x317f7b[_0x7cd3('0x39')]=qs[_0x7cd3('0x3a')](_0x56eb75[_0x7cd3('0x32')][_0x7cd3('0x3a')]);_0x317f7b[_0x7cd3('0x3b')]=qs[_0x7cd3('0x34')](_[_0x7cd3('0x64')](_0x56eb75['query'],_0x5a9437[_0x7cd3('0x34')]));if(_0x56eb75[_0x7cd3('0x32')][_0x7cd3('0x3c')]){_0x317f7b[_0x7cd3('0x3b')]=_['merge'](_0x317f7b[_0x7cd3('0x3b')],{'$or':_[_0x7cd3('0x2c')](_0x317f7b[_0x7cd3('0x37')],function(_0x4a6df7){var _0x392d84={};_0x392d84[_0x4a6df7]={'$like':'%'+_0x56eb75['query']['filter']+'%'};return _0x392d84;})});}_0x317f7b=_[_0x7cd3('0x3d')]({},_0x317f7b,_0x56eb75['options']);return _0x496c88[_0x7cd3('0x63')](_0x317f7b);}})[_0x7cd3('0x27')](function(_0x30935e){if(_0x30935e){_0x5606ab=_0x30935e[_0x7cd3('0x38')];if(!_0x56eb75[_0x7cd3('0x32')]['hasOwnProperty'](_0x7cd3('0x57'))){_0x317f7b[_0x7cd3('0x21')]=qs[_0x7cd3('0x21')](_0x56eb75['query'][_0x7cd3('0x21')]);_0x317f7b[_0x7cd3('0x1f')]=qs[_0x7cd3('0x1f')](_0x56eb75[_0x7cd3('0x32')]['offset']);}return _0x496c88[_0x7cd3('0x63')](_0x317f7b);}})['then'](function(_0x1d900c){if(_0x1d900c){return _0x1d900c?{'count':_0x5606ab,'rows':_0x1d900c}:null;}})[_0x7cd3('0x27')](respondWithResult(_0x144806,null))[_0x7cd3('0x47')](handleError(_0x144806,null));};exports[_0x7cd3('0x65')]=function(_0x7d60a7,_0x1553ff,_0x45426b){var _0x555e79=_0x7d60a7[_0x7cd3('0x49')]['ids'];return db[_0x7cd3('0x66')][_0x7cd3('0x42')]({'where':{'id':_0x555e79},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7cd3('0x2a'),'online',_0x7cd3('0x67'),'interface'],'raw':!![]}]})[_0x7cd3('0x27')](function(_0x407f87){if(_0x407f87){var _0x155bd5=_[_0x7cd3('0x68')](_0x407f87,function(_0x350cd6){var _0x33db43=_0x350cd6['get']({'plain':!![]});return _0x33db43[_0x7cd3('0x69')];});return db[_0x7cd3('0x40')][_0x7cd3('0x46')]({'where':{'id':_0x7d60a7['params']['id']}})[_0x7cd3('0x27')](function(_0x42c3e3){return db['sequelize'][_0x7cd3('0x6a')](function(_0x39141c){return _0x42c3e3['addTeams'](_0x555e79,{'transaction':_0x39141c})[_0x7cd3('0x27')](function(){return BPromise[_0x7cd3('0x6b')](_0x155bd5,function(_0x2f4487){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x2f4487['id'],'FaxQueueId':_0x7d60a7[_0x7cd3('0x44')]['id']},'transaction':_0x39141c});});})[_0x7cd3('0x27')](function(){_0x155bd5['forEach'](function(_0x402770){socket['emit']('userFaxQueue:save',{'UserId':_0x402770['id'],'FaxQueueId':_0x42c3e3['id']});});});});});}})[_0x7cd3('0x27')](respondWithStatusCode(_0x1553ff,null))[_0x7cd3('0x47')](handleError(_0x1553ff,null));};exports[_0x7cd3('0x6c')]=function(_0x1c370e,_0x5ea566,_0x37764d){return db[_0x7cd3('0x66')][_0x7cd3('0x42')]({'where':{'id':_0x1c370e[_0x7cd3('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7cd3('0x59')],'as':_0x7cd3('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7cd3('0x27')](handleEntityNotFound(_0x5ea566,null))['then'](function(_0x188ea9){var _0x7e551f=_[_0x7cd3('0x2c')](_0x188ea9,'id');var _0x589b47=[];var _0x5b4a17=[];var _0x5e9755=squel[_0x7cd3('0x6d')]();_0x5e9755[_0x7cd3('0x6e')](_0x7cd3('0x6f'))['from'](_0x7cd3('0x70'),'tq')['join'](_0x7cd3('0x71'),'ut',_0x7cd3('0x72'))[_0x7cd3('0x3b')]('FaxQueueId\x20=\x20?',_0x1c370e['params']['id']);for(var _0x3fd0e5=0x0;_0x3fd0e5<_0x188ea9[_0x7cd3('0x38')];_0x3fd0e5+=0x1){let _0x3355f0=_0x188ea9[_0x3fd0e5];for(var _0x1cc227=0x0;_0x1cc227<_0x3355f0[_0x7cd3('0x69')][_0x7cd3('0x38')];_0x1cc227+=0x1){let _0x44b509=_0x3355f0[_0x7cd3('0x69')][_0x1cc227];var _0x24d993=_0x5e9755[_0x7cd3('0x73')]();_0x24d993[_0x7cd3('0x3b')](_0x7cd3('0x74'),_0x44b509['id']);_0x5b4a17[_0x7cd3('0x75')](db[_0x7cd3('0x76')][_0x7cd3('0x32')](_0x24d993[_0x7cd3('0x77')](),{'type':db[_0x7cd3('0x76')][_0x7cd3('0x78')][_0x7cd3('0x79')]})[_0x7cd3('0x27')](function(_0x49b036){if(_0x49b036[_0x7cd3('0x38')]===0x1){return _0x44b509['id'];}else{var _0x4d0921=_[_0x7cd3('0x7a')](_[_0x7cd3('0x2c')](_0x49b036,'TeamId'),function(_0x4c9c05){return _[_0x7cd3('0x7b')](_0x7e551f,_0x4c9c05);});if(_0x4d0921){return _0x44b509['id'];}}}));}}return BPromise['all'](_0x5b4a17)[_0x7cd3('0x27')](function(_0x435e44){_0x589b47=_(_0x589b47)[_0x7cd3('0x7c')](_0x435e44)[_0x7cd3('0x7d')]()[_0x7cd3('0x7e')]();return db['FaxQueue'][_0x7cd3('0x46')]({'where':{'id':_0x1c370e[_0x7cd3('0x44')]['id']}})[_0x7cd3('0x27')](function(_0x4d6525){return db[_0x7cd3('0x76')][_0x7cd3('0x6a')](function(_0x274890){return _0x4d6525[_0x7cd3('0x6c')](_0x1c370e[_0x7cd3('0x32')]['ids'],{'transaction':_0x274890})[_0x7cd3('0x27')](function(){if(!_['isEmpty'](_0x589b47)){return _0x4d6525[_0x7cd3('0x7f')](_0x589b47,{'transaction':_0x274890});}})['then'](function(){_0x589b47['forEach'](function(_0x2d5a94){socket[_0x7cd3('0x80')]('userFaxQueue:remove',{'UserId':_0x2d5a94,'FaxQueueId':_0x4d6525['id']});});});});});});})['then'](respondWithStatusCode(_0x5ea566,null))[_0x7cd3('0x47')](handleError(_0x5ea566,null));};exports[_0x7cd3('0x81')]=function(_0xb4059c,_0x4a6f4b,_0x54351e){return db['FaxQueue']['find']({'where':{'id':_0xb4059c['params']['id']}})[_0x7cd3('0x27')](handleEntityNotFound(_0x4a6f4b,null))[_0x7cd3('0x27')](function(_0x40f0b2){if(_0x40f0b2){return _0x40f0b2[_0x7cd3('0x81')](_0xb4059c[_0x7cd3('0x49')][_0x7cd3('0x82')],_[_0x7cd3('0x83')](_0xb4059c[_0x7cd3('0x49')],[_0x7cd3('0x82'),'id'])||{})[_0x7cd3('0x84')](function(_0x389d75){for(var _0x5cc989=0x0;_0x5cc989<_0xb4059c[_0x7cd3('0x49')][_0x7cd3('0x82')][_0x7cd3('0x38')];_0x5cc989+=0x1){socket['emit'](_0x7cd3('0x85'),{'UserId':Number(_0xb4059c[_0x7cd3('0x49')][_0x7cd3('0x82')][_0x5cc989]),'FaxQueueId':Number(_0xb4059c[_0x7cd3('0x44')]['id'])});}return _0x389d75;});}})[_0x7cd3('0x27')](respondWithResult(_0x4a6f4b,null))[_0x7cd3('0x47')](handleError(_0x4a6f4b,null));};exports[_0x7cd3('0x7f')]=function(_0xcf2355,_0x36409,_0x1a1171){return db[_0x7cd3('0x40')][_0x7cd3('0x46')]({'where':{'id':_0xcf2355[_0x7cd3('0x44')]['id']}})[_0x7cd3('0x27')](handleEntityNotFound(_0x36409,null))[_0x7cd3('0x27')](function(_0xabb2be){if(_0xabb2be){return _0xabb2be[_0x7cd3('0x7f')](_0xcf2355[_0x7cd3('0x32')][_0x7cd3('0x82')])[_0x7cd3('0x27')](function(){if(_['isArray'](_0xcf2355[_0x7cd3('0x32')]['ids'])){for(var _0x514e71=0x0;_0x514e71<_0xcf2355['query'][_0x7cd3('0x82')][_0x7cd3('0x38')];_0x514e71+=0x1){socket['emit'](_0x7cd3('0x86'),{'UserId':Number(_0xcf2355['query']['ids'][_0x514e71]),'FaxQueueId':Number(_0xcf2355[_0x7cd3('0x44')]['id'])});}}else{socket[_0x7cd3('0x80')](_0x7cd3('0x86'),{'UserId':Number(_0xcf2355[_0x7cd3('0x32')]['ids']),'FaxQueueId':Number(_0xcf2355['params']['id'])});}});}})['then'](respondWithStatusCode(_0x36409,null))[_0x7cd3('0x47')](handleError(_0x36409,null));};exports['getAgents']=function(_0x1e53da,_0x189e6e,_0x343666){var _0x2c6487={};var _0x4bab1b={};var _0x2e9c3f;var _0x6b77e1;return db[_0x7cd3('0x40')][_0x7cd3('0x55')]({'where':{'id':_0x1e53da['params']['id']}})['then'](handleEntityNotFound(_0x189e6e,null))[_0x7cd3('0x27')](function(_0x579a1a){if(_0x579a1a){_0x2e9c3f=_0x579a1a;_0x4bab1b['model']=_[_0x7cd3('0x33')](db[_0x7cd3('0x59')]['rawAttributes']);_0x4bab1b[_0x7cd3('0x32')]=_['keys'](_0x1e53da['query']);_0x4bab1b['filters']=_[_0x7cd3('0x35')](_0x4bab1b[_0x7cd3('0x31')],_0x4bab1b[_0x7cd3('0x32')]);_0x2c6487[_0x7cd3('0x37')]=_[_0x7cd3('0x35')](_0x4bab1b[_0x7cd3('0x31')],qs[_0x7cd3('0x36')](_0x1e53da[_0x7cd3('0x32')]['fields']));_0x2c6487[_0x7cd3('0x37')]=_0x2c6487['attributes'][_0x7cd3('0x38')]?_0x2c6487[_0x7cd3('0x37')]:_0x4bab1b[_0x7cd3('0x31')];_0x2c6487[_0x7cd3('0x39')]=qs[_0x7cd3('0x3a')](_0x1e53da[_0x7cd3('0x32')][_0x7cd3('0x3a')]);_0x2c6487[_0x7cd3('0x3b')]=qs[_0x7cd3('0x34')](_[_0x7cd3('0x64')](_0x1e53da['query'],_0x4bab1b[_0x7cd3('0x34')]));if(_0x1e53da[_0x7cd3('0x32')][_0x7cd3('0x3c')]){_0x2c6487['where']=_['merge'](_0x2c6487[_0x7cd3('0x3b')],{'$or':_['map'](_0x2c6487[_0x7cd3('0x37')],function(_0x4372ab){var _0x5a0245={};_0x5a0245[_0x4372ab]={'$like':'%'+_0x1e53da[_0x7cd3('0x32')]['filter']+'%'};return _0x5a0245;})});}_0x2c6487=_[_0x7cd3('0x3d')]({},_0x2c6487,_0x1e53da[_0x7cd3('0x3f')]);return _0x2e9c3f['getAgents'](_0x2c6487);}})['then'](function(_0x163c7e){if(_0x163c7e){_0x6b77e1=_0x163c7e['length'];if(!_0x1e53da['query'][_0x7cd3('0x87')]('nolimit')){_0x2c6487[_0x7cd3('0x21')]=qs['limit'](_0x1e53da[_0x7cd3('0x32')][_0x7cd3('0x21')]);_0x2c6487[_0x7cd3('0x1f')]=qs[_0x7cd3('0x1f')](_0x1e53da[_0x7cd3('0x32')][_0x7cd3('0x1f')]);}return _0x2e9c3f['getAgents'](_0x2c6487);}})['then'](function(_0x50a875){if(_0x50a875){return _0x50a875?{'count':_0x6b77e1,'rows':_0x50a875}:null;}})['then'](respondWithResult(_0x189e6e,null))['catch'](handleError(_0x189e6e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 1a13910..32b43f4 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 _0xd0c8=['hook','exports','../../mysqldb','FaxQueue','save','remove','emit','hasOwnProperty'];(function(_0xc175d9,_0x1285f1){var _0x5f39f6=function(_0x55c1f3){while(--_0x55c1f3){_0xc175d9['push'](_0xc175d9['shift']());}};_0x5f39f6(++_0x1285f1);}(_0xd0c8,0x102));var _0x8d0c=function(_0x2c8f84,_0x10be01){_0x2c8f84=_0x2c8f84-0x0;var _0x5c5b80=_0xd0c8[_0x2c8f84];return _0x5c5b80;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x8d0c('0x0'))['db'][_0x8d0c('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d0c('0x2'),'afterUpdate':'update','afterDestroy':_0x8d0c('0x3')};function emitEvent(_0x167f6a){return function(_0x1b1504,_0x2c05e2,_0x116d57){FaxQueueEvents[_0x8d0c('0x4')](_0x167f6a+':'+_0x1b1504['id'],_0x1b1504);FaxQueueEvents['emit'](_0x167f6a,_0x1b1504);_0x116d57(null);};}for(var e in events){if(events[_0x8d0c('0x5')](e)){var event=events[e];FaxQueue[_0x8d0c('0x6')](e,emitEvent(event));}}module[_0x8d0c('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x7d08=['hook','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x7d08,0x1e7));var _0x87d0=function(_0x25c446,_0x4196cd){_0x25c446=_0x25c446-0x0;var _0x35f05d=_0x7d08[_0x25c446];return _0x35f05d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x87d0('0x0'))['db'][_0x87d0('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x87d0('0x2')](0x0);var events={'afterCreate':_0x87d0('0x3'),'afterUpdate':_0x87d0('0x4'),'afterDestroy':_0x87d0('0x5')};function emitEvent(_0x2a9990){return function(_0x5083fa,_0x58155a,_0x3b561b){FaxQueueEvents[_0x87d0('0x6')](_0x2a9990+':'+_0x5083fa['id'],_0x5083fa);FaxQueueEvents[_0x87d0('0x6')](_0x2a9990,_0x5083fa);_0x3b561b(null);};}for(var e in events){if(events[_0x87d0('0x7')](e)){var event=events[e];FaxQueue[_0x87d0('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7729ed6..b2a86f7 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 _0xc2d3=['request-promise','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x476883,_0x5b2a28){var _0x10b189=function(_0x1b3f0f){while(--_0x1b3f0f){_0x476883['push'](_0x476883['shift']());}};_0x10b189(++_0x5b2a28);}(_0xc2d3,0xed));var _0x3c2d=function(_0x175c8f,_0x285cc1){_0x175c8f=_0x175c8f-0x0;var _0x5b557b=_0xc2d3[_0x175c8f];return _0x5b557b;};'use strict';var _=require(_0x3c2d('0x0'));var util=require(_0x3c2d('0x1'));var logger=require(_0x3c2d('0x2'))(_0x3c2d('0x3'));var moment=require('moment');var BPromise=require(_0x3c2d('0x4'));var rp=require(_0x3c2d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c2d('0x6'));module[_0x3c2d('0x7')]=function(_0x407ab4,_0x161ea2){return _0x407ab4[_0x3c2d('0x8')](_0x3c2d('0x9'),attributes,{'tableName':_0x3c2d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e80=['path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','request-promise'];(function(_0x2cbbf1,_0x7c1604){var _0x2e812a=function(_0x4405ba){while(--_0x4405ba){_0x2cbbf1['push'](_0x2cbbf1['shift']());}};_0x2e812a(++_0x7c1604);}(_0x8e80,0x1a9));var _0x08e8=function(_0x43186d,_0x4b40ec){_0x43186d=_0x43186d-0x0;var _0x5f562c=_0x8e80[_0x43186d];return _0x5f562c;};'use strict';var _=require(_0x08e8('0x0'));var util=require(_0x08e8('0x1'));var logger=require(_0x08e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x08e8('0x3'));var fs=require('fs');var path=require(_0x08e8('0x4'));var rimraf=require('rimraf');var config=require(_0x08e8('0x5'));var attributes=require(_0x08e8('0x6'));module[_0x08e8('0x7')]=function(_0x497ee4,_0x3bb2db){return _0x497ee4[_0x08e8('0x8')](_0x08e8('0x9'),attributes,{'tableName':_0x08e8('0xa'),'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 3082f8e..b5a13de 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 _0x7d2b=['FaxQueue','options','where','attributes','limit','include','map','model','find','raw','ShowFaxQueue','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxQueue'];(function(_0x473b3a,_0x4889de){var _0x557b97=function(_0x2c454f){while(--_0x2c454f){_0x473b3a['push'](_0x473b3a['shift']());}};_0x557b97(++_0x4889de);}(_0x7d2b,0x16a));var _0xb7d2=function(_0x3a490e,_0x29b337){_0x3a490e=_0x3a490e-0x0;var _0x2927af=_0x7d2b[_0x3a490e];return _0x2927af;};'use strict';var _=require(_0xb7d2('0x0'));var util=require(_0xb7d2('0x1'));var moment=require(_0xb7d2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb7d2('0x4'));var logger=require(_0xb7d2('0x5'))(_0xb7d2('0x6'));var config=require('../../config/environment');var jayson=require(_0xb7d2('0x7'));var client=jayson[_0xb7d2('0x8')][_0xb7d2('0x9')]({'port':0x232a});config[_0xb7d2('0xa')]=_['defaults'](config[_0xb7d2('0xa')],{'host':_0xb7d2('0xb'),'port':0x18eb});var socket=require(_0xb7d2('0xc'))(new Redis(config[_0xb7d2('0xa')]));require('./faxQueue.socket')[_0xb7d2('0xd')](socket);function respondWithRpcPromise(_0x46ccd2,_0x43ab22,_0x4a0524){return new BPromise(function(_0x30256f,_0x13d69e){return client[_0xb7d2('0xe')](_0x46ccd2,_0x4a0524)[_0xb7d2('0xf')](function(_0x1308cd){logger['info'](_0xb7d2('0x10'),_0x43ab22,'request\x20sent');logger[_0xb7d2('0x11')](_0xb7d2('0x12'),_0x43ab22,_0xb7d2('0x13'),JSON[_0xb7d2('0x14')](_0x1308cd));if(_0x1308cd[_0xb7d2('0x15')]){if(_0x1308cd[_0xb7d2('0x15')][_0xb7d2('0x16')]===0x1f4){logger[_0xb7d2('0x15')](_0xb7d2('0x10'),_0x43ab22,_0x1308cd[_0xb7d2('0x15')][_0xb7d2('0x17')]);return _0x13d69e(_0x1308cd[_0xb7d2('0x15')]['message']);}logger[_0xb7d2('0x15')](_0xb7d2('0x10'),_0x43ab22,_0x1308cd[_0xb7d2('0x15')][_0xb7d2('0x17')]);return _0x30256f(_0x1308cd[_0xb7d2('0x15')][_0xb7d2('0x17')]);}else{logger[_0xb7d2('0x18')](_0xb7d2('0x10'),_0x43ab22,'request\x20sent');_0x30256f(_0x1308cd[_0xb7d2('0x19')][_0xb7d2('0x17')]);}})[_0xb7d2('0x1a')](function(_0x559ce9){logger[_0xb7d2('0x15')](_0xb7d2('0x10'),_0x43ab22,_0x559ce9);_0x13d69e(_0x559ce9);});});}exports[_0xb7d2('0x1b')]=function(_0x31224b){var _0x3e36f3=this;return new Promise(function(_0x589281,_0x47f033){return db[_0xb7d2('0x1c')]['findAll']({'raw':_0x31224b[_0xb7d2('0x1d')]?_0x31224b[_0xb7d2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x31224b[_0xb7d2('0x1d')]?_0x31224b[_0xb7d2('0x1d')][_0xb7d2('0x1e')]||null:null,'attributes':_0x31224b[_0xb7d2('0x1d')]?_0x31224b['options'][_0xb7d2('0x1f')]||null:null,'limit':_0x31224b[_0xb7d2('0x1d')]?_0x31224b[_0xb7d2('0x1d')][_0xb7d2('0x20')]||null:null,'include':_0x31224b[_0xb7d2('0x1d')]?_0x31224b['options'][_0xb7d2('0x21')]?_[_0xb7d2('0x22')](_0x31224b[_0xb7d2('0x1d')][_0xb7d2('0x21')],function(_0x49d532){return{'model':db[_0x49d532[_0xb7d2('0x23')]],'as':_0x49d532['as'],'attributes':_0x49d532[_0xb7d2('0x1f')],'include':_0x49d532[_0xb7d2('0x21')]?_['map'](_0x49d532['include'],function(_0x576614){return{'model':db[_0x576614[_0xb7d2('0x23')]],'as':_0x576614['as'],'attributes':_0x576614[_0xb7d2('0x1f')],'include':_0x576614[_0xb7d2('0x21')]?_['map'](_0x576614[_0xb7d2('0x21')],function(_0xc10956){return{'model':db[_0xc10956['model']],'as':_0xc10956['as'],'attributes':_0xc10956[_0xb7d2('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4192b3){logger[_0xb7d2('0x18')]('GetFaxQueue',_0x31224b);logger[_0xb7d2('0x11')](_0xb7d2('0x1b'),_0x31224b,JSON[_0xb7d2('0x14')](_0x4192b3));_0x589281(_0x4192b3);})[_0xb7d2('0x1a')](function(_0x43a2bb){logger['error'](_0xb7d2('0x1b'),_0x43a2bb[_0xb7d2('0x17')],_0x31224b);_0x47f033(_0x3e36f3[_0xb7d2('0x15')](0x1f4,_0x43a2bb[_0xb7d2('0x17')]));});});};exports['ShowFaxQueue']=function(_0x1d4c4c){var _0x19f3b8=this;return new Promise(function(_0x566aca,_0x16c429){return db['FaxQueue'][_0xb7d2('0x24')]({'raw':_0x1d4c4c[_0xb7d2('0x1d')]?_0x1d4c4c[_0xb7d2('0x1d')][_0xb7d2('0x25')]===undefined?!![]:![]:!![],'where':_0x1d4c4c['options']?_0x1d4c4c[_0xb7d2('0x1d')]['where']||null:null,'attributes':_0x1d4c4c['options']?_0x1d4c4c[_0xb7d2('0x1d')][_0xb7d2('0x1f')]||null:null,'include':_0x1d4c4c[_0xb7d2('0x1d')]?_0x1d4c4c[_0xb7d2('0x1d')]['include']?_[_0xb7d2('0x22')](_0x1d4c4c[_0xb7d2('0x1d')][_0xb7d2('0x21')],function(_0x3ccb4d){return{'model':db[_0x3ccb4d[_0xb7d2('0x23')]],'as':_0x3ccb4d['as'],'attributes':_0x3ccb4d[_0xb7d2('0x1f')],'include':_0x3ccb4d[_0xb7d2('0x21')]?_['map'](_0x3ccb4d[_0xb7d2('0x21')],function(_0x4a63c3){return{'model':db[_0x4a63c3[_0xb7d2('0x23')]],'as':_0x4a63c3['as'],'attributes':_0x4a63c3[_0xb7d2('0x1f')],'include':_0x4a63c3[_0xb7d2('0x21')]?_[_0xb7d2('0x22')](_0x4a63c3[_0xb7d2('0x21')],function(_0x1edf1c){return{'model':db[_0x1edf1c[_0xb7d2('0x23')]],'as':_0x1edf1c['as'],'attributes':_0x1edf1c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb7d2('0xf')](function(_0x145e52){logger[_0xb7d2('0x18')](_0xb7d2('0x26'),_0x1d4c4c);logger[_0xb7d2('0x11')](_0xb7d2('0x26'),_0x1d4c4c,JSON[_0xb7d2('0x14')](_0x145e52));_0x566aca(_0x145e52);})['catch'](function(_0xd7af29){logger[_0xb7d2('0x15')](_0xb7d2('0x26'),_0xd7af29[_0xb7d2('0x17')],_0x1d4c4c);_0x16c429(_0x19f3b8['error'](0x1f4,_0xd7af29['message']));});});}; \ No newline at end of file +var _0xe5a4=['defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map','model','attributes','find','raw','ShowFaxQueue','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x51f67c,_0x1977ec){var _0x3888c5=function(_0x5469be){while(--_0x5469be){_0x51f67c['push'](_0x51f67c['shift']());}};_0x3888c5(++_0x1977ec);}(_0xe5a4,0x16e));var _0x4e5a=function(_0x27eb98,_0x5c435f){_0x27eb98=_0x27eb98-0x0;var _0x215951=_0xe5a4[_0x27eb98];return _0x215951;};'use strict';var _=require('lodash');var util=require(_0x4e5a('0x0'));var moment=require('moment');var BPromise=require(_0x4e5a('0x1'));var rs=require(_0x4e5a('0x2'));var fs=require('fs');var Redis=require(_0x4e5a('0x3'));var db=require(_0x4e5a('0x4'))['db'];var utils=require(_0x4e5a('0x5'));var logger=require(_0x4e5a('0x6'))('rpc');var config=require(_0x4e5a('0x7'));var jayson=require(_0x4e5a('0x8'));var client=jayson[_0x4e5a('0x9')][_0x4e5a('0xa')]({'port':0x232a});config[_0x4e5a('0xb')]=_[_0x4e5a('0xc')](config[_0x4e5a('0xb')],{'host':_0x4e5a('0xd'),'port':0x18eb});var socket=require(_0x4e5a('0xe'))(new Redis(config['redis']));require(_0x4e5a('0xf'))[_0x4e5a('0x10')](socket);function respondWithRpcPromise(_0x5278a7,_0x34326d,_0x16961c){return new BPromise(function(_0x21e411,_0x4caaae){return client[_0x4e5a('0x11')](_0x5278a7,_0x16961c)[_0x4e5a('0x12')](function(_0x4044be){logger[_0x4e5a('0x13')]('FaxQueue,\x20%s,\x20%s',_0x34326d,_0x4e5a('0x14'));logger[_0x4e5a('0x15')](_0x4e5a('0x16'),_0x34326d,_0x4e5a('0x14'),JSON[_0x4e5a('0x17')](_0x4044be));if(_0x4044be[_0x4e5a('0x18')]){if(_0x4044be['error']['code']===0x1f4){logger['error'](_0x4e5a('0x19'),_0x34326d,_0x4044be[_0x4e5a('0x18')][_0x4e5a('0x1a')]);return _0x4caaae(_0x4044be['error'][_0x4e5a('0x1a')]);}logger['error'](_0x4e5a('0x19'),_0x34326d,_0x4044be['error'][_0x4e5a('0x1a')]);return _0x21e411(_0x4044be['error'][_0x4e5a('0x1a')]);}else{logger[_0x4e5a('0x13')](_0x4e5a('0x19'),_0x34326d,_0x4e5a('0x14'));_0x21e411(_0x4044be[_0x4e5a('0x1b')]['message']);}})['catch'](function(_0x56c830){logger[_0x4e5a('0x18')](_0x4e5a('0x19'),_0x34326d,_0x56c830);_0x4caaae(_0x56c830);});});}exports[_0x4e5a('0x1c')]=function(_0x43d8fe){var _0x305f56=this;return new Promise(function(_0x5eda2e,_0x408f99){return db[_0x4e5a('0x1d')][_0x4e5a('0x1e')]({'raw':_0x43d8fe[_0x4e5a('0x1f')]?_0x43d8fe[_0x4e5a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x43d8fe[_0x4e5a('0x1f')]?_0x43d8fe[_0x4e5a('0x1f')][_0x4e5a('0x20')]||null:null,'attributes':_0x43d8fe[_0x4e5a('0x1f')]?_0x43d8fe[_0x4e5a('0x1f')]['attributes']||null:null,'limit':_0x43d8fe[_0x4e5a('0x1f')]?_0x43d8fe[_0x4e5a('0x1f')][_0x4e5a('0x21')]||null:null,'include':_0x43d8fe[_0x4e5a('0x1f')]?_0x43d8fe[_0x4e5a('0x1f')][_0x4e5a('0x22')]?_[_0x4e5a('0x23')](_0x43d8fe[_0x4e5a('0x1f')][_0x4e5a('0x22')],function(_0x19de96){return{'model':db[_0x19de96[_0x4e5a('0x24')]],'as':_0x19de96['as'],'attributes':_0x19de96[_0x4e5a('0x25')],'include':_0x19de96['include']?_[_0x4e5a('0x23')](_0x19de96[_0x4e5a('0x22')],function(_0x1708f1){return{'model':db[_0x1708f1['model']],'as':_0x1708f1['as'],'attributes':_0x1708f1[_0x4e5a('0x25')],'include':_0x1708f1[_0x4e5a('0x22')]?_[_0x4e5a('0x23')](_0x1708f1['include'],function(_0x3a3458){return{'model':db[_0x3a3458[_0x4e5a('0x24')]],'as':_0x3a3458['as'],'attributes':_0x3a3458[_0x4e5a('0x25')]};}):[]};}):[]};}):[]:[]})[_0x4e5a('0x12')](function(_0x2707ae){logger[_0x4e5a('0x13')]('GetFaxQueue',_0x43d8fe);logger[_0x4e5a('0x15')](_0x4e5a('0x1c'),_0x43d8fe,JSON[_0x4e5a('0x17')](_0x2707ae));_0x5eda2e(_0x2707ae);})['catch'](function(_0x3fbd46){logger[_0x4e5a('0x18')](_0x4e5a('0x1c'),_0x3fbd46[_0x4e5a('0x1a')],_0x43d8fe);_0x408f99(_0x305f56[_0x4e5a('0x18')](0x1f4,_0x3fbd46['message']));});});};exports['ShowFaxQueue']=function(_0x59dccd){var _0x298f2d=this;return new Promise(function(_0x5e3985,_0x3e08b3){return db['FaxQueue'][_0x4e5a('0x26')]({'raw':_0x59dccd[_0x4e5a('0x1f')]?_0x59dccd[_0x4e5a('0x1f')][_0x4e5a('0x27')]===undefined?!![]:![]:!![],'where':_0x59dccd[_0x4e5a('0x1f')]?_0x59dccd[_0x4e5a('0x1f')][_0x4e5a('0x20')]||null:null,'attributes':_0x59dccd['options']?_0x59dccd[_0x4e5a('0x1f')][_0x4e5a('0x25')]||null:null,'include':_0x59dccd[_0x4e5a('0x1f')]?_0x59dccd[_0x4e5a('0x1f')][_0x4e5a('0x22')]?_[_0x4e5a('0x23')](_0x59dccd[_0x4e5a('0x1f')][_0x4e5a('0x22')],function(_0x3615a2){return{'model':db[_0x3615a2[_0x4e5a('0x24')]],'as':_0x3615a2['as'],'attributes':_0x3615a2[_0x4e5a('0x25')],'include':_0x3615a2[_0x4e5a('0x22')]?_[_0x4e5a('0x23')](_0x3615a2[_0x4e5a('0x22')],function(_0x1bc6b1){return{'model':db[_0x1bc6b1[_0x4e5a('0x24')]],'as':_0x1bc6b1['as'],'attributes':_0x1bc6b1[_0x4e5a('0x25')],'include':_0x1bc6b1[_0x4e5a('0x22')]?_['map'](_0x1bc6b1['include'],function(_0x420c79){return{'model':db[_0x420c79[_0x4e5a('0x24')]],'as':_0x420c79['as'],'attributes':_0x420c79['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e5a('0x12')](function(_0x2df66e){logger[_0x4e5a('0x13')](_0x4e5a('0x28'),_0x59dccd);logger['debug']('ShowFaxQueue',_0x59dccd,JSON[_0x4e5a('0x17')](_0x2df66e));_0x5e3985(_0x2df66e);})[_0x4e5a('0x29')](function(_0x520c05){logger['error'](_0x4e5a('0x28'),_0x520c05[_0x4e5a('0x1a')],_0x59dccd);_0x3e08b3(_0x298f2d[_0x4e5a('0x18')](0x1f4,_0x520c05[_0x4e5a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index cdccc89..3204a93 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 _0x2df6=['emit','removeListener','register','./faxQueue.events','save','remove','update'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x2df6,0x6c));var _0x62df=function(_0x397d31,_0x48c9e9){_0x397d31=_0x397d31-0x0;var _0x256bfc=_0x2df6[_0x397d31];return _0x256bfc;};'use strict';var FaxQueueEvents=require(_0x62df('0x0'));var events=[_0x62df('0x1'),_0x62df('0x2'),_0x62df('0x3')];function createListener(_0x45b9d5,_0x44a55b){return function(_0x1eb966){_0x44a55b[_0x62df('0x4')](_0x45b9d5,_0x1eb966);};}function removeListener(_0x6cc9fe,_0x4370e3){return function(){FaxQueueEvents[_0x62df('0x5')](_0x6cc9fe,_0x4370e3);};}exports[_0x62df('0x6')]=function(_0x3e35cd){for(var _0x56583c=0x0,_0xe0e1ff=events['length'];_0x56583c<_0xe0e1ff;_0x56583c++){var _0x109cd1=events[_0x56583c];var _0x25a18a=createListener('faxQueue:'+_0x109cd1,_0x3e35cd);FaxQueueEvents['on'](_0x109cd1,_0x25a18a);}}; \ No newline at end of file +var _0xb6a9=['./faxQueue.events','save','update','emit','register','length','faxQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6a9,0xc4));var _0x9b6a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb6a9[_0xa464c9];return _0x3d73c4;};'use strict';var FaxQueueEvents=require(_0x9b6a('0x0'));var events=[_0x9b6a('0x1'),'remove',_0x9b6a('0x2')];function createListener(_0x597f71,_0x3becd8){return function(_0x1aafcb){_0x3becd8[_0x9b6a('0x3')](_0x597f71,_0x1aafcb);};}function removeListener(_0xcb52e5,_0x2eb275){return function(){FaxQueueEvents['removeListener'](_0xcb52e5,_0x2eb275);};}exports[_0x9b6a('0x4')]=function(_0x1746df){for(var _0x14d630=0x0,_0x1bc114=events[_0x9b6a('0x5')];_0x14d630<_0x1bc114;_0x14d630++){var _0x19d421=events[_0x14d630];var _0x5a52e7=createListener(_0x9b6a('0x6')+_0x19d421,_0x1746df);FaxQueueEvents['on'](_0x19d421,_0x5a52e7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f2d720a..edb205d 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 _0x6455=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','destroy','removeTeams','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6455,0x97));var _0x5645=function(_0x509a66,_0x3290ca){_0x509a66=_0x509a66-0x0;var _0x5797ce=_0x6455[_0x509a66];return _0x5797ce;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0x9')](_0x5645('0xf'),auth[_0x5645('0xa')](),controller['getMembers']);router[_0x5645('0x9')](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);router['get'](_0x5645('0x12'),auth['isAuthenticated'](),controller[_0x5645('0x13')]);router[_0x5645('0x14')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0x15')]);router[_0x5645('0x14')](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x16')]);router['post'](_0x5645('0x12'),auth[_0x5645('0xa')](),controller[_0x5645('0x17')]);router['put']('/:id',auth[_0x5645('0xa')](),controller[_0x5645('0x18')]);router['delete'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x19')]);router['delete'](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x1a')]);router[_0x5645('0x1b')]('/:id/users',auth[_0x5645('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb091=['/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','describe'];(function(_0x404c8a,_0x396593){var _0xb96f49=function(_0x5aaae7){while(--_0x5aaae7){_0x404c8a['push'](_0x404c8a['shift']());}};_0xb96f49(++_0x396593);}(_0xb091,0x16e));var _0x1b09=function(_0x1b2302,_0x9bcd96){_0x1b2302=_0x1b2302-0x0;var _0x5c9416=_0xb091[_0x1b2302];return _0x5c9416;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/describe',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0x9')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0x9')]('/:id/teams',auth[_0x1b09('0x7')](),controller[_0x1b09('0xf')]);router['get']('/:id/users',auth[_0x1b09('0x7')](),controller[_0x1b09('0x10')]);router[_0x1b09('0x11')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x12')]);router[_0x1b09('0x11')](_0x1b09('0x13'),auth['isAuthenticated'](),controller[_0x1b09('0x14')]);router['post'](_0x1b09('0x15'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x16')]);router[_0x1b09('0x17')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x18')]);router[_0x1b09('0x19')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x1a')]);router[_0x1b09('0x19')](_0x1b09('0x13'),auth['isAuthenticated'](),controller[_0x1b09('0x1b')]);router[_0x1b09('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b09('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index b0082b6..32f03de 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 _0x0d9c=['sequelize','exports','STRING','DATE'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x0d9c,0x7c));var _0xc0d9=function(_0x12e3d2,_0x77a0e0){_0x12e3d2=_0x12e3d2-0x0;var _0x2e632c=_0x0d9c[_0x12e3d2];return _0x2e632c;};'use strict';var moment=require('moment');var Sequelize=require(_0xc0d9('0x0'));module[_0xc0d9('0x1')]={'uniqueid':{'type':Sequelize[_0xc0d9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc0d9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc0d9('0x3')]},'acceptAt':{'type':Sequelize[_0xc0d9('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc0d9('0x2')]}}; \ No newline at end of file +var _0x0c7b=['DATE','sequelize','exports','STRING'];(function(_0x2c2a81,_0x1d63e5){var _0x4e337c=function(_0x58495d){while(--_0x58495d){_0x2c2a81['push'](_0x2c2a81['shift']());}};_0x4e337c(++_0x1d63e5);}(_0x0c7b,0x189));var _0xb0c7=function(_0x1db091,_0x43937f){_0x1db091=_0x1db091-0x0;var _0x42179d=_0x0c7b[_0x1db091];return _0x42179d;};'use strict';var moment=require('moment');var Sequelize=require(_0xb0c7('0x0'));module[_0xb0c7('0x1')]={'uniqueid':{'type':Sequelize[_0xb0c7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb0c7('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb0c7('0x3')]},'acceptAt':{'type':Sequelize[_0xb0c7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb0c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e6fead3..95b9043 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 _0x94dc=['model','map','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','count','findAll','rows','params','includeAll','options','find','catch','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','FaxQueueReport','rawAttributes','type','key'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x94dc,0xb1));var _0xc94d=function(_0x329693,_0xe7beac){_0x329693=_0x329693-0x0;var _0x376209=_0x94dc[_0x329693];return _0x376209;};'use strict';var emlformat=require(_0xc94d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc94d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc94d('0x2'));var moment=require(_0xc94d('0x3'));var BPromise=require(_0xc94d('0x4'));var Mustache=require('mustache');var util=require(_0xc94d('0x5'));var path=require(_0xc94d('0x6'));var sox=require(_0xc94d('0x7'));var csv=require(_0xc94d('0x8'));var ejs=require(_0xc94d('0x9'));var fs=require('fs');var fs_extra=require(_0xc94d('0xa'));var _=require(_0xc94d('0xb'));var squel=require('squel');var crypto=require(_0xc94d('0xc'));var jsforce=require(_0xc94d('0xd'));var deskjs=require(_0xc94d('0xe'));var toCsv=require(_0xc94d('0x8'));var querystring=require(_0xc94d('0xf'));var Papa=require('papaparse');var Redis=require(_0xc94d('0x10'));var authService=require(_0xc94d('0x11'));var qs=require(_0xc94d('0x12'));var as=require(_0xc94d('0x13'));var hardwareService=require(_0xc94d('0x14'));var logger=require(_0xc94d('0x15'))('api');var utils=require(_0xc94d('0x16'));var config=require(_0xc94d('0x17'));var licenseUtil=require(_0xc94d('0x18'));var db=require(_0xc94d('0x19'))['db'];function respondWithStatusCode(_0x4a149e,_0x5aac90){_0x5aac90=_0x5aac90||0xcc;return function(_0x583735){if(_0x583735){return _0x4a149e[_0xc94d('0x1a')](_0x5aac90);}return _0x4a149e[_0xc94d('0x1b')](_0x5aac90)[_0xc94d('0x1c')]();};}function respondWithResult(_0x1ba9ad,_0x2e65ae){_0x2e65ae=_0x2e65ae||0xc8;return function(_0x9c1c83){if(_0x9c1c83){return _0x1ba9ad[_0xc94d('0x1b')](_0x2e65ae)[_0xc94d('0x1d')](_0x9c1c83);}};}function respondWithFilteredResult(_0x16d225,_0x2f38f3){return function(_0x18640c){if(_0x18640c){var _0x24a1af=typeof _0x2f38f3[_0xc94d('0x1e')]===_0xc94d('0x1f')&&typeof _0x2f38f3[_0xc94d('0x20')]==='undefined';var _0x480fd4=_0x18640c['count'];var _0x48b879=_0x24a1af?0x0:_0x2f38f3[_0xc94d('0x1e')];var _0x4784a2=_0x24a1af?_0x18640c['count']:_0x2f38f3['offset']+_0x2f38f3[_0xc94d('0x20')];var _0x57360a;if(_0x4784a2>=_0x480fd4){_0x4784a2=_0x480fd4;_0x57360a=0xc8;}else{_0x57360a=0xce;}_0x16d225['status'](_0x57360a);return _0x16d225[_0xc94d('0x21')](_0xc94d('0x22'),_0x48b879+'-'+_0x4784a2+'/'+_0x480fd4)[_0xc94d('0x1d')](_0x18640c);}return null;};}function patchUpdates(_0xb5c1fd){return function(_0x37c25f){try{jsonpatch[_0xc94d('0x23')](_0x37c25f,_0xb5c1fd,!![]);}catch(_0x3dec12){return BPromise[_0xc94d('0x24')](_0x3dec12);}return _0x37c25f[_0xc94d('0x25')]();};}function saveUpdates(_0x2fc480,_0x5f2820){return function(_0x2dab55){if(_0x2dab55){return _0x2dab55[_0xc94d('0x26')](_0x2fc480)[_0xc94d('0x27')](function(_0x464fff){return _0x464fff;});}return null;};}function removeEntity(_0x111823,_0x557bfb){return function(_0x4827fd){if(_0x4827fd){return _0x4827fd['destroy']()[_0xc94d('0x27')](function(){_0x111823[_0xc94d('0x1b')](0xcc)[_0xc94d('0x1c')]();});}};}function handleEntityNotFound(_0x1de964,_0x4ee377){return function(_0x5b9099){if(!_0x5b9099){_0x1de964[_0xc94d('0x1a')](0x194);}return _0x5b9099;};}function handleError(_0x4a10a3,_0x46cb74){_0x46cb74=_0x46cb74||0x1f4;return function(_0x362ff4){logger[_0xc94d('0x28')](_0x362ff4['stack']);if(_0x362ff4[_0xc94d('0x29')]){delete _0x362ff4[_0xc94d('0x29')];}_0x4a10a3[_0xc94d('0x1b')](_0x46cb74)[_0xc94d('0x2a')](_0x362ff4);};}exports[_0xc94d('0x2b')]=function(_0x57428c,_0x246e4b){var _0x440c9f={},_0x3a2342={},_0x204a48={'count':0x0,'rows':[]};var _0x4dd290=_['map'](db[_0xc94d('0x2c')][_0xc94d('0x2d')],function(_0x4b2fe1){return{'name':_0x4b2fe1['fieldName'],'type':_0x4b2fe1[_0xc94d('0x2e')][_0xc94d('0x2f')]};});_0x3a2342[_0xc94d('0x30')]=_[_0xc94d('0x31')](_0x4dd290,_0xc94d('0x29'));_0x3a2342[_0xc94d('0x32')]=_[_0xc94d('0x33')](_0x57428c[_0xc94d('0x32')]);_0x3a2342['filters']=_['intersection'](_0x3a2342['model'],_0x3a2342['query']);_0x440c9f[_0xc94d('0x34')]=_[_0xc94d('0x35')](_0x3a2342[_0xc94d('0x30')],qs[_0xc94d('0x36')](_0x57428c[_0xc94d('0x32')][_0xc94d('0x36')]));_0x440c9f[_0xc94d('0x34')]=_0x440c9f[_0xc94d('0x34')]['length']?_0x440c9f[_0xc94d('0x34')]:_0x3a2342[_0xc94d('0x30')];if(!_0x57428c[_0xc94d('0x32')]['hasOwnProperty'](_0xc94d('0x37'))){_0x440c9f[_0xc94d('0x20')]=qs['limit'](_0x57428c[_0xc94d('0x32')]['limit']);_0x440c9f[_0xc94d('0x1e')]=qs[_0xc94d('0x1e')](_0x57428c[_0xc94d('0x32')][_0xc94d('0x1e')]);}_0x440c9f[_0xc94d('0x38')]=qs['sort'](_0x57428c['query'][_0xc94d('0x39')]);_0x440c9f[_0xc94d('0x3a')]=qs[_0xc94d('0x3b')](_['pick'](_0x57428c['query'],_0x3a2342[_0xc94d('0x3b')]),_0x4dd290);if(_0x57428c[_0xc94d('0x32')][_0xc94d('0x3c')]){_0x440c9f[_0xc94d('0x3a')]=_['merge'](_0x440c9f[_0xc94d('0x3a')],{'$or':_[_0xc94d('0x31')](_0x4dd290,function(_0x5b4692){if(_0x5b4692[_0xc94d('0x2e')]!==_0xc94d('0x3d')){var _0xa4c7a6={};_0xa4c7a6[_0x5b4692[_0xc94d('0x29')]]={'$like':'%'+_0x57428c[_0xc94d('0x32')][_0xc94d('0x3c')]+'%'};return _0xa4c7a6;}})});}_0x440c9f=_[_0xc94d('0x3e')]({},_0x440c9f,_0x57428c['options']);var _0x43aeb6={'where':_0x440c9f['where']};return db[_0xc94d('0x2c')][_0xc94d('0x3f')](_0x43aeb6)[_0xc94d('0x27')](function(_0x35e095){_0x204a48[_0xc94d('0x3f')]=_0x35e095;if(_0x57428c[_0xc94d('0x32')]['includeAll']){_0x440c9f['include']=[{'all':!![]}];}return db[_0xc94d('0x2c')][_0xc94d('0x40')](_0x440c9f);})['then'](function(_0x5b6d85){_0x204a48[_0xc94d('0x41')]=_0x5b6d85;return _0x204a48;})[_0xc94d('0x27')](respondWithFilteredResult(_0x246e4b,_0x440c9f))['catch'](handleError(_0x246e4b,null));};exports['show']=function(_0x521b6f,_0x32fce4){var _0x3b927a={'raw':!![],'where':{'id':_0x521b6f[_0xc94d('0x42')]['id']}},_0x17de3a={};_0x17de3a[_0xc94d('0x30')]=_[_0xc94d('0x33')](db[_0xc94d('0x2c')][_0xc94d('0x2d')]);_0x17de3a['query']=_[_0xc94d('0x33')](_0x521b6f[_0xc94d('0x32')]);_0x17de3a['filters']=_[_0xc94d('0x35')](_0x17de3a[_0xc94d('0x30')],_0x17de3a[_0xc94d('0x32')]);_0x3b927a['attributes']=_['intersection'](_0x17de3a[_0xc94d('0x30')],qs['fields'](_0x521b6f[_0xc94d('0x32')][_0xc94d('0x36')]));_0x3b927a[_0xc94d('0x34')]=_0x3b927a[_0xc94d('0x34')]['length']?_0x3b927a[_0xc94d('0x34')]:_0x17de3a[_0xc94d('0x30')];if(_0x521b6f[_0xc94d('0x32')][_0xc94d('0x43')]){_0x3b927a['include']=[{'all':!![]}];}_0x3b927a=_[_0xc94d('0x3e')]({},_0x3b927a,_0x521b6f[_0xc94d('0x44')]);return db[_0xc94d('0x2c')][_0xc94d('0x45')](_0x3b927a)[_0xc94d('0x27')](handleEntityNotFound(_0x32fce4,null))[_0xc94d('0x27')](respondWithResult(_0x32fce4,null))[_0xc94d('0x46')](handleError(_0x32fce4,null));};exports['create']=function(_0x2b5e60,_0x4b2f97){return db[_0xc94d('0x2c')][_0xc94d('0x47')](_0x2b5e60[_0xc94d('0x48')],{})['then'](respondWithResult(_0x4b2f97,0xc9))[_0xc94d('0x46')](handleError(_0x4b2f97,null));};exports[_0xc94d('0x26')]=function(_0x34b075,_0x224315){if(_0x34b075['body']['id']){delete _0x34b075['body']['id'];}return db['FaxQueueReport'][_0xc94d('0x45')]({'where':{'id':_0x34b075['params']['id']}})['then'](handleEntityNotFound(_0x224315,null))[_0xc94d('0x27')](saveUpdates(_0x34b075['body'],null))[_0xc94d('0x27')](respondWithResult(_0x224315,null))['catch'](handleError(_0x224315,null));};exports[_0xc94d('0x49')]=function(_0x1d3e4b,_0x36e984){return db['FaxQueueReport'][_0xc94d('0x45')]({'where':{'id':_0x1d3e4b['params']['id']}})[_0xc94d('0x27')](handleEntityNotFound(_0x36e984,null))['then'](removeEntity(_0x36e984,null))[_0xc94d('0x46')](handleError(_0x36e984,null));};exports['describe']=function(_0x597768,_0x5a2bda){return db[_0xc94d('0x2c')][_0xc94d('0x4a')]()['then'](respondWithResult(_0x5a2bda,null))[_0xc94d('0x46')](handleError(_0x5a2bda,null));}; \ No newline at end of file +var _0x7d86=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','save','then','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','options','includeAll','include','FaxQueueReport','findAll','catch','show','params','create','body','update','destroy','describe','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'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x7d86,0x86));var _0x67d8=function(_0x33c5a9,_0x5d1a1d){_0x33c5a9=_0x33c5a9-0x0;var _0x5e9c86=_0x7d86[_0x33c5a9];return _0x5e9c86;};'use strict';var emlformat=require(_0x67d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67d8('0x1'));var jsonpatch=require(_0x67d8('0x2'));var rp=require(_0x67d8('0x3'));var moment=require(_0x67d8('0x4'));var BPromise=require(_0x67d8('0x5'));var Mustache=require(_0x67d8('0x6'));var util=require(_0x67d8('0x7'));var path=require('path');var sox=require(_0x67d8('0x8'));var csv=require(_0x67d8('0x9'));var ejs=require(_0x67d8('0xa'));var fs=require('fs');var fs_extra=require(_0x67d8('0xb'));var _=require(_0x67d8('0xc'));var squel=require(_0x67d8('0xd'));var crypto=require(_0x67d8('0xe'));var jsforce=require(_0x67d8('0xf'));var deskjs=require(_0x67d8('0x10'));var toCsv=require(_0x67d8('0x9'));var querystring=require(_0x67d8('0x11'));var Papa=require(_0x67d8('0x12'));var Redis=require(_0x67d8('0x13'));var authService=require(_0x67d8('0x14'));var qs=require(_0x67d8('0x15'));var as=require(_0x67d8('0x16'));var hardwareService=require(_0x67d8('0x17'));var logger=require(_0x67d8('0x18'))(_0x67d8('0x19'));var utils=require(_0x67d8('0x1a'));var config=require(_0x67d8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x67d8('0x1c'))['db'];function respondWithStatusCode(_0x3e90ac,_0x29218b){_0x29218b=_0x29218b||0xcc;return function(_0x4ea2e9){if(_0x4ea2e9){return _0x3e90ac[_0x67d8('0x1d')](_0x29218b);}return _0x3e90ac[_0x67d8('0x1e')](_0x29218b)[_0x67d8('0x1f')]();};}function respondWithResult(_0x13758c,_0x2d54e6){_0x2d54e6=_0x2d54e6||0xc8;return function(_0x2d7851){if(_0x2d7851){return _0x13758c[_0x67d8('0x1e')](_0x2d54e6)['json'](_0x2d7851);}};}function respondWithFilteredResult(_0x4757c4,_0x2f83e9){return function(_0x32784b){if(_0x32784b){var _0x509998=typeof _0x2f83e9[_0x67d8('0x20')]===_0x67d8('0x21')&&typeof _0x2f83e9['limit']===_0x67d8('0x21');var _0xaf5197=_0x32784b[_0x67d8('0x22')];var _0xefaaea=_0x509998?0x0:_0x2f83e9[_0x67d8('0x20')];var _0x2a9e66=_0x509998?_0x32784b['count']:_0x2f83e9[_0x67d8('0x20')]+_0x2f83e9[_0x67d8('0x23')];var _0x434810;if(_0x2a9e66>=_0xaf5197){_0x2a9e66=_0xaf5197;_0x434810=0xc8;}else{_0x434810=0xce;}_0x4757c4[_0x67d8('0x1e')](_0x434810);return _0x4757c4[_0x67d8('0x24')]('Content-Range',_0xefaaea+'-'+_0x2a9e66+'/'+_0xaf5197)[_0x67d8('0x25')](_0x32784b);}return null;};}function patchUpdates(_0x1f682e){return function(_0x47c40a){try{jsonpatch['apply'](_0x47c40a,_0x1f682e,!![]);}catch(_0x360b29){return BPromise['reject'](_0x360b29);}return _0x47c40a[_0x67d8('0x26')]();};}function saveUpdates(_0x322f4b,_0xdcba3e){return function(_0x490e0e){if(_0x490e0e){return _0x490e0e['update'](_0x322f4b)[_0x67d8('0x27')](function(_0x1eedd6){return _0x1eedd6;});}return null;};}function removeEntity(_0x43694a,_0x3949ce){return function(_0x2072d4){if(_0x2072d4){return _0x2072d4['destroy']()[_0x67d8('0x27')](function(){_0x43694a[_0x67d8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509ee9,_0x18e515){return function(_0x336d5f){if(!_0x336d5f){_0x509ee9['sendStatus'](0x194);}return _0x336d5f;};}function handleError(_0x3eb6e1,_0x36fec9){_0x36fec9=_0x36fec9||0x1f4;return function(_0x4de8ae){logger['error'](_0x4de8ae[_0x67d8('0x28')]);if(_0x4de8ae[_0x67d8('0x29')]){delete _0x4de8ae['name'];}_0x3eb6e1[_0x67d8('0x1e')](_0x36fec9)[_0x67d8('0x2a')](_0x4de8ae);};}exports['index']=function(_0x1e7e8f,_0x5c7f05){var _0x7232a4={},_0x8531f3={},_0x300bc7={'count':0x0,'rows':[]};var _0x48074a=_['map'](db['FaxQueueReport'][_0x67d8('0x2b')],function(_0x51bcfc){return{'name':_0x51bcfc[_0x67d8('0x2c')],'type':_0x51bcfc[_0x67d8('0x2d')][_0x67d8('0x2e')]};});_0x8531f3[_0x67d8('0x2f')]=_['map'](_0x48074a,_0x67d8('0x29'));_0x8531f3[_0x67d8('0x30')]=_[_0x67d8('0x31')](_0x1e7e8f[_0x67d8('0x30')]);_0x8531f3['filters']=_['intersection'](_0x8531f3[_0x67d8('0x2f')],_0x8531f3[_0x67d8('0x30')]);_0x7232a4['attributes']=_[_0x67d8('0x32')](_0x8531f3[_0x67d8('0x2f')],qs[_0x67d8('0x33')](_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x33')]));_0x7232a4[_0x67d8('0x34')]=_0x7232a4[_0x67d8('0x34')][_0x67d8('0x35')]?_0x7232a4['attributes']:_0x8531f3['model'];if(!_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x36')]('nolimit')){_0x7232a4[_0x67d8('0x23')]=qs[_0x67d8('0x23')](_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x23')]);_0x7232a4[_0x67d8('0x20')]=qs['offset'](_0x1e7e8f['query'][_0x67d8('0x20')]);}_0x7232a4[_0x67d8('0x37')]=qs[_0x67d8('0x38')](_0x1e7e8f[_0x67d8('0x30')]['sort']);_0x7232a4[_0x67d8('0x39')]=qs['filters'](_[_0x67d8('0x3a')](_0x1e7e8f[_0x67d8('0x30')],_0x8531f3[_0x67d8('0x3b')]),_0x48074a);if(_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x3c')]){_0x7232a4[_0x67d8('0x39')]=_[_0x67d8('0x3d')](_0x7232a4['where'],{'$or':_[_0x67d8('0x3e')](_0x48074a,function(_0x105989){if(_0x105989[_0x67d8('0x2d')]!=='VIRTUAL'){var _0x5632d5={};_0x5632d5[_0x105989[_0x67d8('0x29')]]={'$like':'%'+_0x1e7e8f['query'][_0x67d8('0x3c')]+'%'};return _0x5632d5;}})});}_0x7232a4=_[_0x67d8('0x3d')]({},_0x7232a4,_0x1e7e8f[_0x67d8('0x3f')]);var _0x3872ac={'where':_0x7232a4[_0x67d8('0x39')]};return db['FaxQueueReport'][_0x67d8('0x22')](_0x3872ac)[_0x67d8('0x27')](function(_0x4901b0){_0x300bc7[_0x67d8('0x22')]=_0x4901b0;if(_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x40')]){_0x7232a4[_0x67d8('0x41')]=[{'all':!![]}];}return db[_0x67d8('0x42')][_0x67d8('0x43')](_0x7232a4);})['then'](function(_0x1370b6){_0x300bc7['rows']=_0x1370b6;return _0x300bc7;})[_0x67d8('0x27')](respondWithFilteredResult(_0x5c7f05,_0x7232a4))[_0x67d8('0x44')](handleError(_0x5c7f05,null));};exports[_0x67d8('0x45')]=function(_0x1d90a7,_0x3735e2){var _0x2ec437={'raw':!![],'where':{'id':_0x1d90a7[_0x67d8('0x46')]['id']}},_0x280149={};_0x280149[_0x67d8('0x2f')]=_[_0x67d8('0x31')](db[_0x67d8('0x42')][_0x67d8('0x2b')]);_0x280149[_0x67d8('0x30')]=_[_0x67d8('0x31')](_0x1d90a7[_0x67d8('0x30')]);_0x280149[_0x67d8('0x3b')]=_[_0x67d8('0x32')](_0x280149[_0x67d8('0x2f')],_0x280149[_0x67d8('0x30')]);_0x2ec437[_0x67d8('0x34')]=_[_0x67d8('0x32')](_0x280149[_0x67d8('0x2f')],qs[_0x67d8('0x33')](_0x1d90a7[_0x67d8('0x30')][_0x67d8('0x33')]));_0x2ec437[_0x67d8('0x34')]=_0x2ec437[_0x67d8('0x34')][_0x67d8('0x35')]?_0x2ec437['attributes']:_0x280149[_0x67d8('0x2f')];if(_0x1d90a7[_0x67d8('0x30')][_0x67d8('0x40')]){_0x2ec437[_0x67d8('0x41')]=[{'all':!![]}];}_0x2ec437=_[_0x67d8('0x3d')]({},_0x2ec437,_0x1d90a7[_0x67d8('0x3f')]);return db['FaxQueueReport']['find'](_0x2ec437)[_0x67d8('0x27')](handleEntityNotFound(_0x3735e2,null))['then'](respondWithResult(_0x3735e2,null))[_0x67d8('0x44')](handleError(_0x3735e2,null));};exports[_0x67d8('0x47')]=function(_0x582a12,_0x145f32){return db[_0x67d8('0x42')][_0x67d8('0x47')](_0x582a12[_0x67d8('0x48')],{})['then'](respondWithResult(_0x145f32,0xc9))[_0x67d8('0x44')](handleError(_0x145f32,null));};exports[_0x67d8('0x49')]=function(_0x17be11,_0x3c4e7f){if(_0x17be11['body']['id']){delete _0x17be11[_0x67d8('0x48')]['id'];}return db[_0x67d8('0x42')]['find']({'where':{'id':_0x17be11[_0x67d8('0x46')]['id']}})[_0x67d8('0x27')](handleEntityNotFound(_0x3c4e7f,null))[_0x67d8('0x27')](saveUpdates(_0x17be11[_0x67d8('0x48')],null))['then'](respondWithResult(_0x3c4e7f,null))['catch'](handleError(_0x3c4e7f,null));};exports[_0x67d8('0x4a')]=function(_0x5a2132,_0x3850ce){return db[_0x67d8('0x42')]['find']({'where':{'id':_0x5a2132[_0x67d8('0x46')]['id']}})[_0x67d8('0x27')](handleEntityNotFound(_0x3850ce,null))['then'](removeEntity(_0x3850ce,null))['catch'](handleError(_0x3850ce,null));};exports[_0x67d8('0x4b')]=function(_0x1e0759,_0x519744){return db[_0x67d8('0x42')][_0x67d8('0x4b')]()[_0x67d8('0x27')](respondWithResult(_0x519744,null))['catch'](handleError(_0x519744,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 7ca8e0f..4f8c810 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x50b186,_0x36f289){var _0x8a647c=function(_0x3a6405){while(--_0x3a6405){_0x50b186['push'](_0x50b186['shift']());}};_0x8a647c(++_0x36f289);}(_0x7a54,0x106));var _0x47a5=function(_0x105f68,_0x118a6e){_0x105f68=_0x105f68-0x0;var _0x35ad7e=_0x7a54[_0x105f68];return _0x35ad7e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x7217,0x19e));var _0x7721=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x7217[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index df49e96..f055ddd 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 _0x48ea=['stringify','catch','UpdateFaxQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','request\x20sent','debug','error','FaxQueueReport,\x20%s,\x20%s','message','info','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw'];(function(_0x524507,_0x2eee9d){var _0x20a7d2=function(_0xf60a7b){while(--_0xf60a7b){_0x524507['push'](_0x524507['shift']());}};_0x20a7d2(++_0x2eee9d);}(_0x48ea,0x1b9));var _0xa48e=function(_0x552c5b,_0x3b1e70){_0x552c5b=_0x552c5b-0x0;var _0x3e5575=_0x48ea[_0x552c5b];return _0x3e5575;};'use strict';var _=require(_0xa48e('0x0'));var util=require('util');var moment=require(_0xa48e('0x1'));var BPromise=require(_0xa48e('0x2'));var rs=require(_0xa48e('0x3'));var fs=require('fs');var Redis=require(_0xa48e('0x4'));var db=require(_0xa48e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa48e('0x6'));var config=require('../../config/environment');var jayson=require(_0xa48e('0x7'));var client=jayson['client'][_0xa48e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d094b,_0x1f60c3,_0x21e718){return new BPromise(function(_0x155907,_0x2b734e){return client[_0xa48e('0x9')](_0x3d094b,_0x21e718)[_0xa48e('0xa')](function(_0x334574){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1f60c3,_0xa48e('0xb'));logger[_0xa48e('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1f60c3,_0xa48e('0xb'),JSON['stringify'](_0x334574));if(_0x334574['error']){if(_0x334574['error']['code']===0x1f4){logger[_0xa48e('0xd')](_0xa48e('0xe'),_0x1f60c3,_0x334574[_0xa48e('0xd')][_0xa48e('0xf')]);return _0x2b734e(_0x334574[_0xa48e('0xd')][_0xa48e('0xf')]);}logger['error'](_0xa48e('0xe'),_0x1f60c3,_0x334574[_0xa48e('0xd')][_0xa48e('0xf')]);return _0x155907(_0x334574[_0xa48e('0xd')][_0xa48e('0xf')]);}else{logger[_0xa48e('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x1f60c3,_0xa48e('0xb'));_0x155907(_0x334574['result'][_0xa48e('0xf')]);}})['catch'](function(_0x33095a){logger['error'](_0xa48e('0xe'),_0x1f60c3,_0x33095a);_0x2b734e(_0x33095a);});});}exports[_0xa48e('0x11')]=function(_0x4aefcf){var _0x5a186a=this;return new Promise(function(_0x15231d,_0x12dc00){return db[_0xa48e('0x12')][_0xa48e('0x13')](_0x4aefcf[_0xa48e('0x14')],{'raw':_0x4aefcf[_0xa48e('0x15')]?_0x4aefcf[_0xa48e('0x15')][_0xa48e('0x16')]===undefined?!![]:![]:!![]})[_0xa48e('0xa')](function(_0x231a52){logger[_0xa48e('0x10')]('CreateFaxQueueReport',_0x4aefcf);logger[_0xa48e('0xc')](_0xa48e('0x11'),_0x4aefcf,JSON[_0xa48e('0x17')](_0x231a52));_0x15231d(_0x231a52);})[_0xa48e('0x18')](function(_0x456f1e){logger[_0xa48e('0xd')](_0xa48e('0x11'),_0x456f1e[_0xa48e('0xf')],_0x4aefcf);_0x12dc00(_0x5a186a[_0xa48e('0xd')](0x1f4,_0x456f1e[_0xa48e('0xf')]));});});};exports[_0xa48e('0x19')]=function(_0x159d5c){var _0x435474=this;return new Promise(function(_0x36947f,_0xa7d661){return db[_0xa48e('0x12')]['update'](_0x159d5c[_0xa48e('0x14')],{'raw':_0x159d5c[_0xa48e('0x15')]?_0x159d5c[_0xa48e('0x15')][_0xa48e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x159d5c[_0xa48e('0x15')]?_0x159d5c[_0xa48e('0x15')][_0xa48e('0x1a')]||null:null,'attributes':_0x159d5c[_0xa48e('0x15')]?_0x159d5c[_0xa48e('0x15')][_0xa48e('0x1b')]||null:null,'limit':_0x159d5c[_0xa48e('0x15')]?_0x159d5c[_0xa48e('0x15')][_0xa48e('0x1c')]||null:null})['then'](function(_0x501c52){logger['info']('UpdateFaxQueueReport',_0x159d5c);logger[_0xa48e('0xc')](_0xa48e('0x19'),_0x159d5c,JSON[_0xa48e('0x17')](_0x501c52));_0x36947f(_0x501c52);})[_0xa48e('0x18')](function(_0x102ae2){logger[_0xa48e('0xd')](_0xa48e('0x19'),_0x102ae2[_0xa48e('0xf')],_0x159d5c);_0xa7d661(_0x435474[_0xa48e('0xd')](0x1f4,_0x102ae2[_0xa48e('0xf')]));});});}; \ No newline at end of file +var _0xf4f7=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','catch','CreateFaxQueueReport','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','body','where','limit','lodash'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0xf4f7,0x13f));var _0x7f4f=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xf4f7[_0x30faec];return _0x29484f;};'use strict';var _=require(_0x7f4f('0x0'));var util=require(_0x7f4f('0x1'));var moment=require(_0x7f4f('0x2'));var BPromise=require(_0x7f4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f4f('0x4'));var db=require(_0x7f4f('0x5'))['db'];var utils=require(_0x7f4f('0x6'));var logger=require('../../config/logger')(_0x7f4f('0x7'));var config=require(_0x7f4f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7f4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e002d,_0x1da69d,_0x465099){return new BPromise(function(_0x3b42ed,_0x43d4f7){return client[_0x7f4f('0xa')](_0x4e002d,_0x465099)[_0x7f4f('0xb')](function(_0x146ce5){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1da69d,_0x7f4f('0xc'));logger[_0x7f4f('0xd')](_0x7f4f('0xe'),_0x1da69d,'request\x20sent',JSON[_0x7f4f('0xf')](_0x146ce5));if(_0x146ce5[_0x7f4f('0x10')]){if(_0x146ce5['error'][_0x7f4f('0x11')]===0x1f4){logger[_0x7f4f('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x1da69d,_0x146ce5[_0x7f4f('0x10')][_0x7f4f('0x12')]);return _0x43d4f7(_0x146ce5[_0x7f4f('0x10')][_0x7f4f('0x12')]);}logger[_0x7f4f('0x10')](_0x7f4f('0x13'),_0x1da69d,_0x146ce5[_0x7f4f('0x10')][_0x7f4f('0x12')]);return _0x3b42ed(_0x146ce5['error'][_0x7f4f('0x12')]);}else{logger[_0x7f4f('0x14')](_0x7f4f('0x13'),_0x1da69d,_0x7f4f('0xc'));_0x3b42ed(_0x146ce5[_0x7f4f('0x15')][_0x7f4f('0x12')]);}})[_0x7f4f('0x16')](function(_0x43b17a){logger[_0x7f4f('0x10')](_0x7f4f('0x13'),_0x1da69d,_0x43b17a);_0x43d4f7(_0x43b17a);});});}exports[_0x7f4f('0x17')]=function(_0xfa15cf){var _0x424960=this;return new Promise(function(_0x3826c7,_0x23a0b2){return db['FaxQueueReport']['create'](_0xfa15cf['body'],{'raw':_0xfa15cf[_0x7f4f('0x18')]?_0xfa15cf['options'][_0x7f4f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x155043){logger[_0x7f4f('0x14')](_0x7f4f('0x17'),_0xfa15cf);logger['debug']('CreateFaxQueueReport',_0xfa15cf,JSON[_0x7f4f('0xf')](_0x155043));_0x3826c7(_0x155043);})[_0x7f4f('0x16')](function(_0x3d3b18){logger[_0x7f4f('0x10')](_0x7f4f('0x17'),_0x3d3b18['message'],_0xfa15cf);_0x23a0b2(_0x424960[_0x7f4f('0x10')](0x1f4,_0x3d3b18[_0x7f4f('0x12')]));});});};exports[_0x7f4f('0x1a')]=function(_0x1ec0cc){var _0x1ffd3d=this;return new Promise(function(_0x2495b6,_0x24b6d7){return db[_0x7f4f('0x1b')][_0x7f4f('0x1c')](_0x1ec0cc[_0x7f4f('0x1d')],{'raw':_0x1ec0cc[_0x7f4f('0x18')]?_0x1ec0cc[_0x7f4f('0x18')][_0x7f4f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec0cc['options']?_0x1ec0cc[_0x7f4f('0x18')][_0x7f4f('0x1e')]||null:null,'attributes':_0x1ec0cc['options']?_0x1ec0cc[_0x7f4f('0x18')]['attributes']||null:null,'limit':_0x1ec0cc[_0x7f4f('0x18')]?_0x1ec0cc[_0x7f4f('0x18')][_0x7f4f('0x1f')]||null:null})[_0x7f4f('0xb')](function(_0x521726){logger['info'](_0x7f4f('0x1a'),_0x1ec0cc);logger[_0x7f4f('0xd')](_0x7f4f('0x1a'),_0x1ec0cc,JSON[_0x7f4f('0xf')](_0x521726));_0x2495b6(_0x521726);})[_0x7f4f('0x16')](function(_0x1416e2){logger[_0x7f4f('0x10')]('UpdateFaxQueueReport',_0x1416e2[_0x7f4f('0x12')],_0x1ec0cc);_0x24b6d7(_0x1ffd3d[_0x7f4f('0x10')](0x1f4,_0x1416e2[_0x7f4f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 80b5d35..0b01df7 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 _0xf177=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x32101f,_0xf3c0e0){var _0x392d3d=function(_0x4ddb67){while(--_0x4ddb67){_0x32101f['push'](_0x32101f['shift']());}};_0x392d3d(++_0xf3c0e0);}(_0xf177,0x18c));var _0x7f17=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf177[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x7f17('0x0'));var util=require('util');var path=require(_0x7f17('0x1'));var timeout=require(_0x7f17('0x2'));var express=require(_0x7f17('0x3'));var router=express[_0x7f17('0x4')]();var fs_extra=require(_0x7f17('0x5'));var auth=require(_0x7f17('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7f17('0x7'));var controller=require(_0x7f17('0x8'));router[_0x7f17('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7f17('0x9')](_0x7f17('0xa'),auth[_0x7f17('0xb')](),controller['describe']);router[_0x7f17('0x9')](_0x7f17('0xc'),auth[_0x7f17('0xb')](),controller[_0x7f17('0xd')]);router[_0x7f17('0xe')]('/',auth[_0x7f17('0xb')](),controller['create']);router[_0x7f17('0xf')](_0x7f17('0xc'),auth[_0x7f17('0xb')](),controller[_0x7f17('0x10')]);router[_0x7f17('0x11')](_0x7f17('0xc'),auth[_0x7f17('0xb')](),controller[_0x7f17('0x12')]);module[_0x7f17('0x13')]=router; \ No newline at end of file +var _0xbdab=['create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','show'];(function(_0x548dc7,_0xcefd94){var _0x5072c9=function(_0xc5f0bf){while(--_0xc5f0bf){_0x548dc7['push'](_0x548dc7['shift']());}};_0x5072c9(++_0xcefd94);}(_0xbdab,0x101));var _0xbbda=function(_0x282763,_0x20585c){_0x282763=_0x282763-0x0;var _0x120a8d=_0xbdab[_0x282763];return _0x120a8d;};'use strict';var multer=require(_0xbbda('0x0'));var util=require(_0xbbda('0x1'));var path=require(_0xbbda('0x2'));var timeout=require(_0xbbda('0x3'));var express=require(_0xbbda('0x4'));var router=express[_0xbbda('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbda('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbda('0x7'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0xbbda('0x8')](),controller[_0xbbda('0x9')]);router[_0xbbda('0xa')](_0xbbda('0xb'),auth[_0xbbda('0x8')](),controller['describe']);router[_0xbbda('0xa')]('/:id',auth[_0xbbda('0x8')](),controller[_0xbbda('0xc')]);router['post']('/',auth[_0xbbda('0x8')](),controller[_0xbbda('0xd')]);router['put'](_0xbbda('0xe'),auth['isAuthenticated'](),controller[_0xbbda('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbbda('0x10')]);module[_0xbbda('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 233f2db..b91066c 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xb43b,0x1b2));var _0xbb43=function(_0x18505d,_0x5ad7f7){_0x18505d=_0x18505d-0x0;var _0xcdf590=_0xb43b[_0x18505d];return _0xcdf590;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x17a60a,_0x49cc08){var _0x33af48=function(_0x5a5f23){while(--_0x5a5f23){_0x17a60a['push'](_0x17a60a['shift']());}};_0x33af48(++_0x49cc08);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xcb91[_0x3511d3];return _0x5d6321;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 2cab6e7..fbb8166 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 _0x9fea=['fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x8b9240,_0x61ca0e){var _0x13f9c7=function(_0x1ad86e){while(--_0x1ad86e){_0x8b9240['push'](_0x8b9240['shift']());}};_0x13f9c7(++_0x61ca0e);}(_0x9fea,0xd5));var _0xa9fe=function(_0x2eb398,_0x10491a){_0x2eb398=_0x2eb398-0x0;var _0x5b14bb=_0x9fea[_0x2eb398];return _0x5b14bb;};'use strict';var emlformat=require(_0xa9fe('0x0'));var rimraf=require(_0xa9fe('0x1'));var zipdir=require(_0xa9fe('0x2'));var jsonpatch=require(_0xa9fe('0x3'));var rp=require(_0xa9fe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa9fe('0x5'));var util=require(_0xa9fe('0x6'));var path=require('path');var sox=require(_0xa9fe('0x7'));var csv=require(_0xa9fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9fe('0x9'));var _=require(_0xa9fe('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa9fe('0xb'));var toCsv=require(_0xa9fe('0x8'));var querystring=require(_0xa9fe('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa9fe('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9fe('0xe'));var logger=require(_0xa9fe('0xf'))(_0xa9fe('0x10'));var utils=require(_0xa9fe('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa9fe('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b6aa,_0x279b75){_0x279b75=_0x279b75||0xcc;return function(_0x308b7d){if(_0x308b7d){return _0x52b6aa[_0xa9fe('0x13')](_0x279b75);}return _0x52b6aa[_0xa9fe('0x14')](_0x279b75)[_0xa9fe('0x15')]();};}function respondWithResult(_0x2fba04,_0x3a2846){_0x3a2846=_0x3a2846||0xc8;return function(_0x206fd3){if(_0x206fd3){return _0x2fba04[_0xa9fe('0x14')](_0x3a2846)[_0xa9fe('0x16')](_0x206fd3);}};}function respondWithFilteredResult(_0x3158af,_0xcd432){return function(_0x2448ec){if(_0x2448ec){var _0x2f0c44=typeof _0xcd432['offset']===_0xa9fe('0x17')&&typeof _0xcd432[_0xa9fe('0x18')]===_0xa9fe('0x17');var _0x45845e=_0x2448ec[_0xa9fe('0x19')];var _0x6d8094=_0x2f0c44?0x0:_0xcd432[_0xa9fe('0x1a')];var _0x45ef46=_0x2f0c44?_0x2448ec[_0xa9fe('0x19')]:_0xcd432[_0xa9fe('0x1a')]+_0xcd432[_0xa9fe('0x18')];var _0x259dbc;if(_0x45ef46>=_0x45845e){_0x45ef46=_0x45845e;_0x259dbc=0xc8;}else{_0x259dbc=0xce;}_0x3158af[_0xa9fe('0x14')](_0x259dbc);return _0x3158af[_0xa9fe('0x1b')]('Content-Range',_0x6d8094+'-'+_0x45ef46+'/'+_0x45845e)[_0xa9fe('0x16')](_0x2448ec);}return null;};}function patchUpdates(_0xff48d0){return function(_0x3465e7){try{jsonpatch[_0xa9fe('0x1c')](_0x3465e7,_0xff48d0,!![]);}catch(_0x5f1a62){return BPromise[_0xa9fe('0x1d')](_0x5f1a62);}return _0x3465e7[_0xa9fe('0x1e')]();};}function saveUpdates(_0x28d334,_0x4b81c5){return function(_0x3b7f66){if(_0x3b7f66){return _0x3b7f66['update'](_0x28d334)[_0xa9fe('0x1f')](function(_0x288ef8){return _0x288ef8;});}return null;};}function removeEntity(_0x2c13cb,_0x95f407){return function(_0x42b061){if(_0x42b061){return _0x42b061['destroy']()[_0xa9fe('0x1f')](function(){_0x2c13cb['status'](0xcc)[_0xa9fe('0x15')]();});}};}function handleEntityNotFound(_0x2641ac,_0x424a20){return function(_0x23af93){if(!_0x23af93){_0x2641ac[_0xa9fe('0x13')](0x194);}return _0x23af93;};}function handleError(_0x1bbb1,_0x21ef8d){_0x21ef8d=_0x21ef8d||0x1f4;return function(_0x21724b){logger[_0xa9fe('0x20')](_0x21724b[_0xa9fe('0x21')]);if(_0x21724b[_0xa9fe('0x22')]){delete _0x21724b[_0xa9fe('0x22')];}_0x1bbb1[_0xa9fe('0x14')](_0x21ef8d)['send'](_0x21724b);};}exports[_0xa9fe('0x23')]=function(_0x21bb76,_0x3c22b0){var _0x360fe9={},_0x419ccb={},_0x3cf540={'count':0x0,'rows':[]};var _0x5ca1c4=_[_0xa9fe('0x24')](db[_0xa9fe('0x25')][_0xa9fe('0x26')],function(_0x158919){return{'name':_0x158919[_0xa9fe('0x27')],'type':_0x158919[_0xa9fe('0x28')][_0xa9fe('0x29')]};});_0x419ccb['model']=_[_0xa9fe('0x24')](_0x5ca1c4,_0xa9fe('0x22'));_0x419ccb[_0xa9fe('0x2a')]=_[_0xa9fe('0x2b')](_0x21bb76[_0xa9fe('0x2a')]);_0x419ccb['filters']=_[_0xa9fe('0x2c')](_0x419ccb[_0xa9fe('0x2d')],_0x419ccb[_0xa9fe('0x2a')]);_0x360fe9[_0xa9fe('0x2e')]=_[_0xa9fe('0x2c')](_0x419ccb['model'],qs[_0xa9fe('0x2f')](_0x21bb76[_0xa9fe('0x2a')][_0xa9fe('0x2f')]));_0x360fe9[_0xa9fe('0x2e')]=_0x360fe9[_0xa9fe('0x2e')][_0xa9fe('0x30')]?_0x360fe9[_0xa9fe('0x2e')]:_0x419ccb[_0xa9fe('0x2d')];if(!_0x21bb76[_0xa9fe('0x2a')][_0xa9fe('0x31')](_0xa9fe('0x32'))){_0x360fe9[_0xa9fe('0x18')]=qs[_0xa9fe('0x18')](_0x21bb76[_0xa9fe('0x2a')][_0xa9fe('0x18')]);_0x360fe9['offset']=qs[_0xa9fe('0x1a')](_0x21bb76['query'][_0xa9fe('0x1a')]);}_0x360fe9[_0xa9fe('0x33')]=qs[_0xa9fe('0x34')](_0x21bb76[_0xa9fe('0x2a')][_0xa9fe('0x34')]);_0x360fe9['where']=qs[_0xa9fe('0x35')](_[_0xa9fe('0x36')](_0x21bb76[_0xa9fe('0x2a')],_0x419ccb['filters']),_0x5ca1c4);if(_0x21bb76[_0xa9fe('0x2a')][_0xa9fe('0x37')]){_0x360fe9[_0xa9fe('0x38')]=_[_0xa9fe('0x39')](_0x360fe9['where'],{'$or':_[_0xa9fe('0x24')](_0x5ca1c4,function(_0x124635){if(_0x124635['type']!==_0xa9fe('0x3a')){var _0x283455={};_0x283455[_0x124635[_0xa9fe('0x22')]]={'$like':'%'+_0x21bb76[_0xa9fe('0x2a')]['filter']+'%'};return _0x283455;}})});}_0x360fe9=_[_0xa9fe('0x39')]({},_0x360fe9,_0x21bb76[_0xa9fe('0x3b')]);var _0x454734={'where':_0x360fe9[_0xa9fe('0x38')]};return db['FaxTransferReport'][_0xa9fe('0x19')](_0x454734)[_0xa9fe('0x1f')](function(_0x5b6874){_0x3cf540[_0xa9fe('0x19')]=_0x5b6874;if(_0x21bb76[_0xa9fe('0x2a')][_0xa9fe('0x3c')]){_0x360fe9[_0xa9fe('0x3d')]=[{'all':!![]}];}return db[_0xa9fe('0x25')]['findAll'](_0x360fe9);})[_0xa9fe('0x1f')](function(_0x1244af){_0x3cf540[_0xa9fe('0x3e')]=_0x1244af;return _0x3cf540;})[_0xa9fe('0x1f')](respondWithFilteredResult(_0x3c22b0,_0x360fe9))[_0xa9fe('0x3f')](handleError(_0x3c22b0,null));};exports[_0xa9fe('0x40')]=function(_0x4f5411,_0x463aec){var _0x28068b={'raw':!![],'where':{'id':_0x4f5411[_0xa9fe('0x41')]['id']}},_0xc1cc31={};_0xc1cc31[_0xa9fe('0x2d')]=_['keys'](db['FaxTransferReport'][_0xa9fe('0x26')]);_0xc1cc31[_0xa9fe('0x2a')]=_[_0xa9fe('0x2b')](_0x4f5411[_0xa9fe('0x2a')]);_0xc1cc31['filters']=_[_0xa9fe('0x2c')](_0xc1cc31[_0xa9fe('0x2d')],_0xc1cc31[_0xa9fe('0x2a')]);_0x28068b[_0xa9fe('0x2e')]=_['intersection'](_0xc1cc31[_0xa9fe('0x2d')],qs[_0xa9fe('0x2f')](_0x4f5411[_0xa9fe('0x2a')]['fields']));_0x28068b[_0xa9fe('0x2e')]=_0x28068b[_0xa9fe('0x2e')]['length']?_0x28068b[_0xa9fe('0x2e')]:_0xc1cc31[_0xa9fe('0x2d')];if(_0x4f5411[_0xa9fe('0x2a')][_0xa9fe('0x3c')]){_0x28068b[_0xa9fe('0x3d')]=[{'all':!![]}];}_0x28068b=_[_0xa9fe('0x39')]({},_0x28068b,_0x4f5411[_0xa9fe('0x3b')]);return db[_0xa9fe('0x25')][_0xa9fe('0x42')](_0x28068b)[_0xa9fe('0x1f')](handleEntityNotFound(_0x463aec,null))[_0xa9fe('0x1f')](respondWithResult(_0x463aec,null))['catch'](handleError(_0x463aec,null));};exports[_0xa9fe('0x43')]=function(_0x8ff22a,_0x4ad9fe){return db[_0xa9fe('0x25')][_0xa9fe('0x43')](_0x8ff22a[_0xa9fe('0x44')],{})[_0xa9fe('0x1f')](respondWithResult(_0x4ad9fe,0xc9))[_0xa9fe('0x3f')](handleError(_0x4ad9fe,null));};exports[_0xa9fe('0x45')]=function(_0xcba06e,_0x1a4990){if(_0xcba06e[_0xa9fe('0x44')]['id']){delete _0xcba06e['body']['id'];}return db[_0xa9fe('0x25')][_0xa9fe('0x42')]({'where':{'id':_0xcba06e['params']['id']}})['then'](handleEntityNotFound(_0x1a4990,null))[_0xa9fe('0x1f')](saveUpdates(_0xcba06e[_0xa9fe('0x44')],null))['then'](respondWithResult(_0x1a4990,null))[_0xa9fe('0x3f')](handleError(_0x1a4990,null));};exports[_0xa9fe('0x46')]=function(_0x4049de,_0x5dc501){return db['FaxTransferReport'][_0xa9fe('0x42')]({'where':{'id':_0x4049de[_0xa9fe('0x41')]['id']}})[_0xa9fe('0x1f')](handleEntityNotFound(_0x5dc501,null))['then'](removeEntity(_0x5dc501,null))['catch'](handleError(_0x5dc501,null));};exports[_0xa9fe('0x47')]=function(_0x4f0252,_0xdb0ef3){return db[_0xa9fe('0x25')][_0xa9fe('0x47')]()[_0xa9fe('0x1f')](respondWithResult(_0xdb0ef3,null))[_0xa9fe('0x3f')](handleError(_0xdb0ef3,null));}; \ No newline at end of file +var _0xc5bc=['apply','reject','save','update','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','include','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range'];(function(_0x311ad1,_0x514869){var _0x3976c4=function(_0x526c64){while(--_0x526c64){_0x311ad1['push'](_0x311ad1['shift']());}};_0x3976c4(++_0x514869);}(_0xc5bc,0x1d7));var _0xcc5b=function(_0x42774d,_0x6d44e2){_0x42774d=_0x42774d-0x0;var _0x317f90=_0xc5bc[_0x42774d];return _0x317f90;};'use strict';var emlformat=require(_0xcc5b('0x0'));var rimraf=require(_0xcc5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc5b('0x2'));var rp=require(_0xcc5b('0x3'));var moment=require('moment');var BPromise=require(_0xcc5b('0x4'));var Mustache=require(_0xcc5b('0x5'));var util=require(_0xcc5b('0x6'));var path=require(_0xcc5b('0x7'));var sox=require('sox');var csv=require(_0xcc5b('0x8'));var ejs=require(_0xcc5b('0x9'));var fs=require('fs');var fs_extra=require(_0xcc5b('0xa'));var _=require('lodash');var squel=require(_0xcc5b('0xb'));var crypto=require(_0xcc5b('0xc'));var jsforce=require(_0xcc5b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcc5b('0x8'));var querystring=require(_0xcc5b('0xe'));var Papa=require(_0xcc5b('0xf'));var Redis=require(_0xcc5b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc5b('0x11'));var logger=require('../../config/logger')(_0xcc5b('0x12'));var utils=require(_0xcc5b('0x13'));var config=require(_0xcc5b('0x14'));var licenseUtil=require(_0xcc5b('0x15'));var db=require(_0xcc5b('0x16'))['db'];function respondWithStatusCode(_0x14873c,_0x18baf5){_0x18baf5=_0x18baf5||0xcc;return function(_0x258431){if(_0x258431){return _0x14873c[_0xcc5b('0x17')](_0x18baf5);}return _0x14873c[_0xcc5b('0x18')](_0x18baf5)[_0xcc5b('0x19')]();};}function respondWithResult(_0x20a6bf,_0x7533f2){_0x7533f2=_0x7533f2||0xc8;return function(_0x57dff0){if(_0x57dff0){return _0x20a6bf[_0xcc5b('0x18')](_0x7533f2)[_0xcc5b('0x1a')](_0x57dff0);}};}function respondWithFilteredResult(_0x4c73e7,_0x1470ca){return function(_0x419e0e){if(_0x419e0e){var _0x21f52b=typeof _0x1470ca['offset']===_0xcc5b('0x1b')&&typeof _0x1470ca[_0xcc5b('0x1c')]===_0xcc5b('0x1b');var _0x39c60d=_0x419e0e['count'];var _0x1c8290=_0x21f52b?0x0:_0x1470ca[_0xcc5b('0x1d')];var _0x330122=_0x21f52b?_0x419e0e[_0xcc5b('0x1e')]:_0x1470ca[_0xcc5b('0x1d')]+_0x1470ca['limit'];var _0x3ac98c;if(_0x330122>=_0x39c60d){_0x330122=_0x39c60d;_0x3ac98c=0xc8;}else{_0x3ac98c=0xce;}_0x4c73e7[_0xcc5b('0x18')](_0x3ac98c);return _0x4c73e7[_0xcc5b('0x1f')](_0xcc5b('0x20'),_0x1c8290+'-'+_0x330122+'/'+_0x39c60d)[_0xcc5b('0x1a')](_0x419e0e);}return null;};}function patchUpdates(_0x1f775e){return function(_0xe74146){try{jsonpatch[_0xcc5b('0x21')](_0xe74146,_0x1f775e,!![]);}catch(_0x499833){return BPromise[_0xcc5b('0x22')](_0x499833);}return _0xe74146[_0xcc5b('0x23')]();};}function saveUpdates(_0x56287d,_0x4d412a){return function(_0x2d9036){if(_0x2d9036){return _0x2d9036[_0xcc5b('0x24')](_0x56287d)['then'](function(_0x229e21){return _0x229e21;});}return null;};}function removeEntity(_0x266c84,_0x120359){return function(_0xe484fb){if(_0xe484fb){return _0xe484fb['destroy']()[_0xcc5b('0x25')](function(){_0x266c84['status'](0xcc)[_0xcc5b('0x19')]();});}};}function handleEntityNotFound(_0x393e52,_0x50b756){return function(_0x20584b){if(!_0x20584b){_0x393e52[_0xcc5b('0x17')](0x194);}return _0x20584b;};}function handleError(_0x36100f,_0xb64565){_0xb64565=_0xb64565||0x1f4;return function(_0x4c74c1){logger[_0xcc5b('0x26')](_0x4c74c1[_0xcc5b('0x27')]);if(_0x4c74c1['name']){delete _0x4c74c1[_0xcc5b('0x28')];}_0x36100f['status'](_0xb64565)[_0xcc5b('0x29')](_0x4c74c1);};}exports[_0xcc5b('0x2a')]=function(_0x519a46,_0x45ac5a){var _0x225842={},_0xc4c65c={},_0x2430b4={'count':0x0,'rows':[]};var _0x3e66be=_[_0xcc5b('0x2b')](db[_0xcc5b('0x2c')][_0xcc5b('0x2d')],function(_0x381b30){return{'name':_0x381b30[_0xcc5b('0x2e')],'type':_0x381b30['type'][_0xcc5b('0x2f')]};});_0xc4c65c[_0xcc5b('0x30')]=_[_0xcc5b('0x2b')](_0x3e66be,_0xcc5b('0x28'));_0xc4c65c['query']=_[_0xcc5b('0x31')](_0x519a46[_0xcc5b('0x32')]);_0xc4c65c['filters']=_[_0xcc5b('0x33')](_0xc4c65c['model'],_0xc4c65c[_0xcc5b('0x32')]);_0x225842[_0xcc5b('0x34')]=_['intersection'](_0xc4c65c[_0xcc5b('0x30')],qs[_0xcc5b('0x35')](_0x519a46[_0xcc5b('0x32')][_0xcc5b('0x35')]));_0x225842[_0xcc5b('0x34')]=_0x225842[_0xcc5b('0x34')]['length']?_0x225842[_0xcc5b('0x34')]:_0xc4c65c[_0xcc5b('0x30')];if(!_0x519a46[_0xcc5b('0x32')][_0xcc5b('0x36')]('nolimit')){_0x225842[_0xcc5b('0x1c')]=qs[_0xcc5b('0x1c')](_0x519a46[_0xcc5b('0x32')][_0xcc5b('0x1c')]);_0x225842[_0xcc5b('0x1d')]=qs[_0xcc5b('0x1d')](_0x519a46[_0xcc5b('0x32')][_0xcc5b('0x1d')]);}_0x225842[_0xcc5b('0x37')]=qs[_0xcc5b('0x38')](_0x519a46[_0xcc5b('0x32')][_0xcc5b('0x38')]);_0x225842[_0xcc5b('0x39')]=qs['filters'](_['pick'](_0x519a46['query'],_0xc4c65c[_0xcc5b('0x3a')]),_0x3e66be);if(_0x519a46[_0xcc5b('0x32')][_0xcc5b('0x3b')]){_0x225842[_0xcc5b('0x39')]=_[_0xcc5b('0x3c')](_0x225842[_0xcc5b('0x39')],{'$or':_[_0xcc5b('0x2b')](_0x3e66be,function(_0x46e7ce){if(_0x46e7ce['type']!=='VIRTUAL'){var _0x3b2105={};_0x3b2105[_0x46e7ce[_0xcc5b('0x28')]]={'$like':'%'+_0x519a46['query']['filter']+'%'};return _0x3b2105;}})});}_0x225842=_[_0xcc5b('0x3c')]({},_0x225842,_0x519a46['options']);var _0x3b9e70={'where':_0x225842[_0xcc5b('0x39')]};return db['FaxTransferReport']['count'](_0x3b9e70)[_0xcc5b('0x25')](function(_0x21e669){_0x2430b4[_0xcc5b('0x1e')]=_0x21e669;if(_0x519a46[_0xcc5b('0x32')]['includeAll']){_0x225842[_0xcc5b('0x3d')]=[{'all':!![]}];}return db[_0xcc5b('0x2c')]['findAll'](_0x225842);})[_0xcc5b('0x25')](function(_0x8eedfb){_0x2430b4[_0xcc5b('0x3e')]=_0x8eedfb;return _0x2430b4;})[_0xcc5b('0x25')](respondWithFilteredResult(_0x45ac5a,_0x225842))[_0xcc5b('0x3f')](handleError(_0x45ac5a,null));};exports[_0xcc5b('0x40')]=function(_0x332d36,_0x2a1a4e){var _0x556308={'raw':!![],'where':{'id':_0x332d36[_0xcc5b('0x41')]['id']}},_0x479dca={};_0x479dca[_0xcc5b('0x30')]=_[_0xcc5b('0x31')](db[_0xcc5b('0x2c')][_0xcc5b('0x2d')]);_0x479dca[_0xcc5b('0x32')]=_['keys'](_0x332d36[_0xcc5b('0x32')]);_0x479dca['filters']=_[_0xcc5b('0x33')](_0x479dca['model'],_0x479dca['query']);_0x556308[_0xcc5b('0x34')]=_[_0xcc5b('0x33')](_0x479dca[_0xcc5b('0x30')],qs[_0xcc5b('0x35')](_0x332d36[_0xcc5b('0x32')][_0xcc5b('0x35')]));_0x556308[_0xcc5b('0x34')]=_0x556308[_0xcc5b('0x34')][_0xcc5b('0x42')]?_0x556308['attributes']:_0x479dca['model'];if(_0x332d36[_0xcc5b('0x32')][_0xcc5b('0x43')]){_0x556308[_0xcc5b('0x3d')]=[{'all':!![]}];}_0x556308=_[_0xcc5b('0x3c')]({},_0x556308,_0x332d36['options']);return db[_0xcc5b('0x2c')][_0xcc5b('0x44')](_0x556308)['then'](handleEntityNotFound(_0x2a1a4e,null))[_0xcc5b('0x25')](respondWithResult(_0x2a1a4e,null))[_0xcc5b('0x3f')](handleError(_0x2a1a4e,null));};exports[_0xcc5b('0x45')]=function(_0x2e75d3,_0x1c83f7){return db[_0xcc5b('0x2c')]['create'](_0x2e75d3[_0xcc5b('0x46')],{})[_0xcc5b('0x25')](respondWithResult(_0x1c83f7,0xc9))['catch'](handleError(_0x1c83f7,null));};exports[_0xcc5b('0x24')]=function(_0x41569e,_0x22d588){if(_0x41569e[_0xcc5b('0x46')]['id']){delete _0x41569e['body']['id'];}return db[_0xcc5b('0x2c')][_0xcc5b('0x44')]({'where':{'id':_0x41569e[_0xcc5b('0x41')]['id']}})[_0xcc5b('0x25')](handleEntityNotFound(_0x22d588,null))[_0xcc5b('0x25')](saveUpdates(_0x41569e[_0xcc5b('0x46')],null))[_0xcc5b('0x25')](respondWithResult(_0x22d588,null))[_0xcc5b('0x3f')](handleError(_0x22d588,null));};exports['destroy']=function(_0xa0f02b,_0x55ec27){return db['FaxTransferReport']['find']({'where':{'id':_0xa0f02b[_0xcc5b('0x41')]['id']}})['then'](handleEntityNotFound(_0x55ec27,null))[_0xcc5b('0x25')](removeEntity(_0x55ec27,null))[_0xcc5b('0x3f')](handleError(_0x55ec27,null));};exports['describe']=function(_0x205076,_0x1086ff){return db[_0xcc5b('0x2c')][_0xcc5b('0x47')]()[_0xcc5b('0x25')](respondWithResult(_0x1086ff,null))[_0xcc5b('0x3f')](handleError(_0x1086ff,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index db83933..ab4a6db 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 _0x0554=['lodash','util','api','bluebird','request-promise','path','rimraf','exports','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x1fcfc0,_0x552dbf){var _0x29b9e6=function(_0x41dbdc){while(--_0x41dbdc){_0x1fcfc0['push'](_0x1fcfc0['shift']());}};_0x29b9e6(++_0x552dbf);}(_0x0554,0x176));var _0x4055=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x0554[_0x454165];return _0x56db53;};'use strict';var _=require(_0x4055('0x0'));var util=require(_0x4055('0x1'));var logger=require('../../config/logger')(_0x4055('0x2'));var moment=require('moment');var BPromise=require(_0x4055('0x3'));var rp=require(_0x4055('0x4'));var fs=require('fs');var path=require(_0x4055('0x5'));var rimraf=require(_0x4055('0x6'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x4055('0x7')]=function(_0x1a3f72,_0x53db98){return _0x1a3f72['define'](_0x4055('0x8'),attributes,{'tableName':_0x4055('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4055('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd786=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid'];(function(_0x2c1ce7,_0x4bf01b){var _0x34cb34=function(_0x58eca1){while(--_0x58eca1){_0x2c1ce7['push'](_0x2c1ce7['shift']());}};_0x34cb34(++_0x4bf01b);}(_0xd786,0x1dc));var _0x6d78=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd786[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var logger=require(_0x6d78('0x2'))(_0x6d78('0x3'));var moment=require('moment');var BPromise=require(_0x6d78('0x4'));var rp=require(_0x6d78('0x5'));var fs=require('fs');var path=require(_0x6d78('0x6'));var rimraf=require(_0x6d78('0x7'));var config=require(_0x6d78('0x8'));var attributes=require(_0x6d78('0x9'));module[_0x6d78('0xa')]=function(_0x55ea32,_0x18c038){return _0x55ea32[_0x6d78('0xb')]('FaxTransferReport',attributes,{'tableName':_0x6d78('0xc'),'paranoid':![],'indexes':[{'name':_0x6d78('0xd'),'fields':[_0x6d78('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f50c89e..65755fe 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 _0x5a2e=['client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xa5757c,_0x4c374f){var _0x16471c=function(_0x1c368c){while(--_0x1c368c){_0xa5757c['push'](_0xa5757c['shift']());}};_0x16471c(++_0x4c374f);}(_0x5a2e,0x124));var _0xe5a2=function(_0x5c8427,_0x12d69e){_0x5c8427=_0x5c8427-0x0;var _0x4c4606=_0x5a2e[_0x5c8427];return _0x4c4606;};'use strict';var _=require('lodash');var util=require(_0xe5a2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe5a2('0x1'));var fs=require('fs');var Redis=require(_0xe5a2('0x2'));var db=require(_0xe5a2('0x3'))['db'];var utils=require(_0xe5a2('0x4'));var logger=require(_0xe5a2('0x5'))(_0xe5a2('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5a2('0x7'));var client=jayson[_0xe5a2('0x8')][_0xe5a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x338b80,_0x4a5ca9,_0x26ce07){return new BPromise(function(_0x30a8ea,_0x3cf93b){return client[_0xe5a2('0xa')](_0x338b80,_0x26ce07)['then'](function(_0x1f37c5){logger[_0xe5a2('0xb')](_0xe5a2('0xc'),_0x4a5ca9,_0xe5a2('0xd'));logger[_0xe5a2('0xe')](_0xe5a2('0xf'),_0x4a5ca9,_0xe5a2('0xd'),JSON['stringify'](_0x1f37c5));if(_0x1f37c5[_0xe5a2('0x10')]){if(_0x1f37c5[_0xe5a2('0x10')][_0xe5a2('0x11')]===0x1f4){logger[_0xe5a2('0x10')](_0xe5a2('0xc'),_0x4a5ca9,_0x1f37c5[_0xe5a2('0x10')][_0xe5a2('0x12')]);return _0x3cf93b(_0x1f37c5[_0xe5a2('0x10')][_0xe5a2('0x12')]);}logger[_0xe5a2('0x10')](_0xe5a2('0xc'),_0x4a5ca9,_0x1f37c5[_0xe5a2('0x10')][_0xe5a2('0x12')]);return _0x30a8ea(_0x1f37c5[_0xe5a2('0x10')][_0xe5a2('0x12')]);}else{logger[_0xe5a2('0xb')](_0xe5a2('0xc'),_0x4a5ca9,'request\x20sent');_0x30a8ea(_0x1f37c5['result'][_0xe5a2('0x12')]);}})[_0xe5a2('0x13')](function(_0x21717e){logger[_0xe5a2('0x10')](_0xe5a2('0xc'),_0x4a5ca9,_0x21717e);_0x3cf93b(_0x21717e);});});} \ No newline at end of file +var _0x78e9=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x5bb207,_0x157700){var _0x4b198e=function(_0x4d6c36){while(--_0x4d6c36){_0x5bb207['push'](_0x5bb207['shift']());}};_0x4b198e(++_0x157700);}(_0x78e9,0x1d5));var _0x978e=function(_0x2279b0,_0x4ad532){_0x2279b0=_0x2279b0-0x0;var _0x4cf977=_0x78e9[_0x2279b0];return _0x4cf977;};'use strict';var _=require(_0x978e('0x0'));var util=require(_0x978e('0x1'));var moment=require(_0x978e('0x2'));var BPromise=require(_0x978e('0x3'));var rs=require(_0x978e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x978e('0x5'))(_0x978e('0x6'));var config=require(_0x978e('0x7'));var jayson=require(_0x978e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c26dc,_0x2fe3c8,_0xfc819e){return new BPromise(function(_0x313529,_0x274cf){return client['request'](_0x4c26dc,_0xfc819e)[_0x978e('0x9')](function(_0x8e9cbe){logger[_0x978e('0xa')](_0x978e('0xb'),_0x2fe3c8,_0x978e('0xc'));logger['debug'](_0x978e('0xd'),_0x2fe3c8,_0x978e('0xc'),JSON[_0x978e('0xe')](_0x8e9cbe));if(_0x8e9cbe['error']){if(_0x8e9cbe[_0x978e('0xf')][_0x978e('0x10')]===0x1f4){logger[_0x978e('0xf')](_0x978e('0xb'),_0x2fe3c8,_0x8e9cbe['error'][_0x978e('0x11')]);return _0x274cf(_0x8e9cbe[_0x978e('0xf')]['message']);}logger[_0x978e('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x2fe3c8,_0x8e9cbe[_0x978e('0xf')][_0x978e('0x11')]);return _0x313529(_0x8e9cbe[_0x978e('0xf')][_0x978e('0x11')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2fe3c8,_0x978e('0xc'));_0x313529(_0x8e9cbe[_0x978e('0x12')]['message']);}})[_0x978e('0x13')](function(_0x4ea466){logger[_0x978e('0xf')](_0x978e('0xb'),_0x2fe3c8,_0x4ea466);_0x274cf(_0x4ea466);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a4b06f0..da7fe81 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 _0xe401=['describe','get','/:id','show','post','create','put','update','delete','destroy','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x1b88fd,_0x3fc359){var _0x287cd1=function(_0x5aa428){while(--_0x5aa428){_0x1b88fd['push'](_0x1b88fd['shift']());}};_0x287cd1(++_0x3fc359);}(_0xe401,0x64));var _0x1e40=function(_0x1a9d33,_0x4ef71a){_0x1a9d33=_0x1a9d33-0x0;var _0x56fe2e=_0xe401[_0x1a9d33];return _0x56fe2e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1e40('0x0'));var express=require('express');var router=express[_0x1e40('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1e40('0x2'));var config=require(_0x1e40('0x3'));var controller=require(_0x1e40('0x4'));router['get']('/',auth[_0x1e40('0x5')](),controller[_0x1e40('0x6')]);router['get'](_0x1e40('0x7'),auth['isAuthenticated'](),controller[_0x1e40('0x8')]);router[_0x1e40('0x9')](_0x1e40('0xa'),auth['isAuthenticated'](),controller[_0x1e40('0xb')]);router[_0x1e40('0xc')]('/',auth['isAuthenticated'](),controller[_0x1e40('0xd')]);router[_0x1e40('0xe')](_0x1e40('0xa'),auth[_0x1e40('0x5')](),controller[_0x1e40('0xf')]);router[_0x1e40('0x10')]('/:id',auth[_0x1e40('0x5')](),controller[_0x1e40('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe011=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x10bf5d,_0x10a3a9){var _0x27f511=function(_0x209cf3){while(--_0x209cf3){_0x10bf5d['push'](_0x10bf5d['shift']());}};_0x27f511(++_0x10a3a9);}(_0xe011,0x1a2));var _0x1e01=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xe011[_0x2e819c];return _0x24e271;};'use strict';var multer=require(_0x1e01('0x0'));var util=require(_0x1e01('0x1'));var path=require(_0x1e01('0x2'));var timeout=require(_0x1e01('0x3'));var express=require(_0x1e01('0x4'));var router=express['Router']();var fs_extra=require(_0x1e01('0x5'));var auth=require(_0x1e01('0x6'));var interaction=require(_0x1e01('0x7'));var config=require(_0x1e01('0x8'));var controller=require(_0x1e01('0x9'));router[_0x1e01('0xa')]('/',auth[_0x1e01('0xb')](),controller[_0x1e01('0xc')]);router[_0x1e01('0xa')]('/describe',auth[_0x1e01('0xb')](),controller[_0x1e01('0xd')]);router[_0x1e01('0xa')](_0x1e01('0xe'),auth[_0x1e01('0xb')](),controller[_0x1e01('0xf')]);router[_0x1e01('0x10')]('/',auth[_0x1e01('0xb')](),controller[_0x1e01('0x11')]);router[_0x1e01('0x12')]('/:id',auth[_0x1e01('0xb')](),controller[_0x1e01('0x13')]);router['delete'](_0x1e01('0xe'),auth[_0x1e01('0xb')](),controller[_0x1e01('0x14')]);module[_0x1e01('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 622459d..7ed5ec7 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 _0x6252=['fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x367163,_0x2927c5){var _0xebcb61=function(_0x13f4b1){while(--_0x13f4b1){_0x367163['push'](_0x367163['shift']());}};_0xebcb61(++_0x2927c5);}(_0x6252,0xd7));var _0x2625=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6252[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x2625('0x0'));var util=require(_0x2625('0x1'));var path=require(_0x2625('0x2'));var timeout=require('connect-timeout');var express=require(_0x2625('0x3'));var router=express[_0x2625('0x4')]();var fs_extra=require(_0x2625('0x5'));var auth=require(_0x2625('0x6'));var interaction=require(_0x2625('0x7'));var config=require('../../config/environment');var controller=require(_0x2625('0x8'));router[_0x2625('0x9')]('/',auth[_0x2625('0xa')](),controller[_0x2625('0xb')]);router[_0x2625('0x9')](_0x2625('0xc'),auth[_0x2625('0xa')](),controller['show']);router[_0x2625('0x9')](_0x2625('0xd'),auth[_0x2625('0xa')](),controller[_0x2625('0xe')]);router[_0x2625('0x9')](_0x2625('0xf'),auth['isAuthenticated'](),controller[_0x2625('0x10')]);router['post']('/',auth[_0x2625('0xa')](),controller['create']);router['post'](_0x2625('0xd'),auth[_0x2625('0xa')](),controller[_0x2625('0x11')]);router[_0x2625('0x12')](_0x2625('0xc'),auth[_0x2625('0xa')](),controller['update']);router[_0x2625('0x13')]('/:id',auth[_0x2625('0xa')](),controller[_0x2625('0x14')]);module[_0x2625('0x15')]=router; \ No newline at end of file +var _0xa210=['update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','put','/:id'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa210,0x9b));var _0x0a21=function(_0x3e9e60,_0x442ceb){_0x3e9e60=_0x3e9e60-0x0;var _0x2b4e8f=_0xa210[_0x3e9e60];return _0x2b4e8f;};'use strict';var multer=require(_0x0a21('0x0'));var util=require(_0x0a21('0x1'));var path=require(_0x0a21('0x2'));var timeout=require(_0x0a21('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a21('0x4'));var auth=require(_0x0a21('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a21('0x6'));var controller=require('./intDeskAccount.controller');router[_0x0a21('0x7')]('/',auth[_0x0a21('0x8')](),controller['index']);router[_0x0a21('0x7')]('/:id',auth[_0x0a21('0x8')](),controller['show']);router['get'](_0x0a21('0x9'),auth[_0x0a21('0x8')](),controller['getConfigurations']);router[_0x0a21('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0a21('0xa')]);router[_0x0a21('0xb')]('/',auth[_0x0a21('0x8')](),controller[_0x0a21('0xc')]);router[_0x0a21('0xb')](_0x0a21('0x9'),auth[_0x0a21('0x8')](),controller[_0x0a21('0xd')]);router[_0x0a21('0xe')](_0x0a21('0xf'),auth[_0x0a21('0x8')](),controller[_0x0a21('0x10')]);router[_0x0a21('0x11')](_0x0a21('0xf'),auth[_0x0a21('0x8')](),controller[_0x0a21('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 719c618..e792ade 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 _0xeb4b=['exports','STRING','ENUM','basic','sequelize'];(function(_0x4c4683,_0x241657){var _0x78ee7e=function(_0x4c9489){while(--_0x4c9489){_0x4c4683['push'](_0x4c4683['shift']());}};_0x78ee7e(++_0x241657);}(_0xeb4b,0xd1));var _0xbeb4=function(_0x5c886e,_0x2d05ba){_0x5c886e=_0x5c886e-0x0;var _0x1fd126=_0xeb4b[_0x5c886e];return _0x1fd126;};'use strict';var Sequelize=require(_0xbeb4('0x0'));module[_0xbeb4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbeb4('0x2')]},'username':{'type':Sequelize[_0xbeb4('0x2')]},'remoteUri':{'type':Sequelize[_0xbeb4('0x2')]},'authType':{'type':Sequelize[_0xbeb4('0x3')](_0xbeb4('0x4')),'defaultValue':_0xbeb4('0x4')},'password':{'type':Sequelize[_0xbeb4('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xbeb4('0x2')]},'token':{'type':Sequelize[_0xbeb4('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbeb4('0x3')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xdf5f=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x498468,_0x4c3715){var _0x61ba70=function(_0x511647){while(--_0x511647){_0x498468['push'](_0x498468['shift']());}};_0x61ba70(++_0x4c3715);}(_0xdf5f,0x103));var _0xfdf5=function(_0x56f299,_0x5eb069){_0x56f299=_0x56f299-0x0;var _0x399863=_0xdf5f[_0x56f299];return _0x399863;};'use strict';var Sequelize=require(_0xfdf5('0x0'));module[_0xfdf5('0x1')]={'name':{'type':Sequelize[_0xfdf5('0x2')]},'description':{'type':Sequelize[_0xfdf5('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xfdf5('0x3')]('basic'),'defaultValue':_0xfdf5('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xfdf5('0x2')]},'token':{'type':Sequelize[_0xfdf5('0x2')]},'tokenSecret':{'type':Sequelize[_0xfdf5('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfdf5('0x3')](_0xfdf5('0x5'),_0xfdf5('0x6')),'defaultValue':_0xfdf5('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 80fcaa3..2f27753 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 _0x041f=['tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','label','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','params','create','body','find','findOne','DeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x041f,0x1e0));var _0xf041=function(_0x58a3ed,_0x361861){_0x58a3ed=_0x58a3ed-0x0;var _0x4850d8=_0x041f[_0x58a3ed];return _0x4850d8;};'use strict';var emlformat=require(_0xf041('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf041('0x1'));var jsonpatch=require(_0xf041('0x2'));var rp=require(_0xf041('0x3'));var moment=require(_0xf041('0x4'));var BPromise=require(_0xf041('0x5'));var Mustache=require(_0xf041('0x6'));var util=require('util');var path=require(_0xf041('0x7'));var sox=require(_0xf041('0x8'));var csv=require('to-csv');var ejs=require(_0xf041('0x9'));var fs=require('fs');var fs_extra=require(_0xf041('0xa'));var _=require('lodash');var squel=require(_0xf041('0xb'));var crypto=require(_0xf041('0xc'));var jsforce=require(_0xf041('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf041('0xe'));var querystring=require('querystring');var Papa=require(_0xf041('0xf'));var Redis=require(_0xf041('0x10'));var authService=require(_0xf041('0x11'));var qs=require(_0xf041('0x12'));var as=require(_0xf041('0x13'));var hardwareService=require(_0xf041('0x14'));var logger=require(_0xf041('0x15'))('api');var utils=require(_0xf041('0x16'));var config=require(_0xf041('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf041('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3447f2,_0x575395){_0x575395=_0x575395||0xcc;return function(_0x5445c2){if(_0x5445c2){return _0x3447f2['sendStatus'](_0x575395);}return _0x3447f2[_0xf041('0x19')](_0x575395)[_0xf041('0x1a')]();};}function respondWithResult(_0x4091db,_0x4e93c5){_0x4e93c5=_0x4e93c5||0xc8;return function(_0x3343c6){if(_0x3343c6){return _0x4091db[_0xf041('0x19')](_0x4e93c5)['json'](_0x3343c6);}};}function respondWithFilteredResult(_0x49fab9,_0x1e8b51){return function(_0x3a0eb5){if(_0x3a0eb5){var _0x53dd9f=typeof _0x1e8b51[_0xf041('0x1b')]===_0xf041('0x1c')&&typeof _0x1e8b51[_0xf041('0x1d')]==='undefined';var _0x5f13e0=_0x3a0eb5['count'];var _0x6ae193=_0x53dd9f?0x0:_0x1e8b51[_0xf041('0x1b')];var _0x51940e=_0x53dd9f?_0x3a0eb5[_0xf041('0x1e')]:_0x1e8b51[_0xf041('0x1b')]+_0x1e8b51[_0xf041('0x1d')];var _0x3ede6b;if(_0x51940e>=_0x5f13e0){_0x51940e=_0x5f13e0;_0x3ede6b=0xc8;}else{_0x3ede6b=0xce;}_0x49fab9[_0xf041('0x19')](_0x3ede6b);return _0x49fab9[_0xf041('0x1f')](_0xf041('0x20'),_0x6ae193+'-'+_0x51940e+'/'+_0x5f13e0)[_0xf041('0x21')](_0x3a0eb5);}return null;};}function patchUpdates(_0x24b54f){return function(_0x5a8f7b){try{jsonpatch[_0xf041('0x22')](_0x5a8f7b,_0x24b54f,!![]);}catch(_0x27ffd8){return BPromise['reject'](_0x27ffd8);}return _0x5a8f7b['save']();};}function saveUpdates(_0x22971e,_0x465f44){return function(_0x120e46){if(_0x120e46){return _0x120e46[_0xf041('0x23')](_0x22971e)['then'](function(_0xeba554){return _0xeba554;});}return null;};}function removeEntity(_0x1bbb0c,_0x27469e){return function(_0x3dd4e5){if(_0x3dd4e5){return _0x3dd4e5[_0xf041('0x24')]()['then'](function(){_0x1bbb0c[_0xf041('0x19')](0xcc)[_0xf041('0x1a')]();});}};}function handleEntityNotFound(_0x39af51,_0x511929){return function(_0x284893){if(!_0x284893){_0x39af51[_0xf041('0x25')](0x194);}return _0x284893;};}function handleError(_0x3ae965,_0x244c2e){_0x244c2e=_0x244c2e||0x1f4;return function(_0x5ea761){logger[_0xf041('0x26')](_0x5ea761[_0xf041('0x27')]);if(_0x5ea761['name']){delete _0x5ea761[_0xf041('0x28')];}_0x3ae965[_0xf041('0x19')](_0x244c2e)[_0xf041('0x29')](_0x5ea761);};}exports[_0xf041('0x2a')]=function(_0x104197,_0x2314d9){var _0x41cb73={},_0x196b56={},_0x20214e={'count':0x0,'rows':[]};var _0x93ce86=_[_0xf041('0x2b')](db[_0xf041('0x2c')][_0xf041('0x2d')],function(_0x50ac8f){return{'name':_0x50ac8f['fieldName'],'type':_0x50ac8f[_0xf041('0x2e')][_0xf041('0x2f')]};});_0x196b56[_0xf041('0x30')]=_['map'](_0x93ce86,_0xf041('0x28'));_0x196b56[_0xf041('0x31')]=_[_0xf041('0x32')](_0x104197[_0xf041('0x31')]);_0x196b56['filters']=_[_0xf041('0x33')](_0x196b56[_0xf041('0x30')],_0x196b56['query']);_0x41cb73[_0xf041('0x34')]=_['intersection'](_0x196b56[_0xf041('0x30')],qs[_0xf041('0x35')](_0x104197['query'][_0xf041('0x35')]));_0x41cb73[_0xf041('0x34')]=_0x41cb73['attributes'][_0xf041('0x36')]?_0x41cb73[_0xf041('0x34')]:_0x196b56[_0xf041('0x30')];if(!_0x104197[_0xf041('0x31')][_0xf041('0x37')](_0xf041('0x38'))){_0x41cb73[_0xf041('0x1d')]=qs[_0xf041('0x1d')](_0x104197[_0xf041('0x31')][_0xf041('0x1d')]);_0x41cb73[_0xf041('0x1b')]=qs['offset'](_0x104197['query'][_0xf041('0x1b')]);}_0x41cb73[_0xf041('0x39')]=qs[_0xf041('0x3a')](_0x104197[_0xf041('0x31')]['sort']);_0x41cb73[_0xf041('0x3b')]=qs[_0xf041('0x3c')](_[_0xf041('0x3d')](_0x104197[_0xf041('0x31')],_0x196b56[_0xf041('0x3c')]),_0x93ce86);if(_0x104197[_0xf041('0x31')][_0xf041('0x3e')]){_0x41cb73[_0xf041('0x3b')]=_['merge'](_0x41cb73['where'],{'$or':_['map'](_0x93ce86,function(_0x3e7c70){if(_0x3e7c70[_0xf041('0x2e')]!==_0xf041('0x3f')){var _0x462776={};_0x462776[_0x3e7c70[_0xf041('0x28')]]={'$like':'%'+_0x104197[_0xf041('0x31')][_0xf041('0x3e')]+'%'};return _0x462776;}})});}_0x41cb73=_[_0xf041('0x40')]({},_0x41cb73,_0x104197[_0xf041('0x41')]);var _0x509712={'where':_0x41cb73[_0xf041('0x3b')]};return db[_0xf041('0x2c')]['count'](_0x509712)[_0xf041('0x42')](function(_0x791452){_0x20214e['count']=_0x791452;if(_0x104197[_0xf041('0x31')]['includeAll']){_0x41cb73[_0xf041('0x43')]=[{'all':!![]}];}return db[_0xf041('0x2c')][_0xf041('0x44')](_0x41cb73);})[_0xf041('0x42')](function(_0x7d6b03){_0x20214e[_0xf041('0x45')]=_0x7d6b03;return _0x20214e;})[_0xf041('0x42')](respondWithFilteredResult(_0x2314d9,_0x41cb73))[_0xf041('0x46')](handleError(_0x2314d9,null));};exports[_0xf041('0x47')]=function(_0x36fd8b,_0x3e9d59){var _0x4de2d1={'raw':![],'where':{'id':_0x36fd8b[_0xf041('0x48')]['id']}},_0x478e59={};_0x478e59[_0xf041('0x30')]=_['keys'](db[_0xf041('0x2c')][_0xf041('0x2d')]);_0x478e59[_0xf041('0x31')]=_[_0xf041('0x32')](_0x36fd8b[_0xf041('0x31')]);_0x478e59['filters']=_[_0xf041('0x33')](_0x478e59[_0xf041('0x30')],_0x478e59[_0xf041('0x31')]);_0x4de2d1[_0xf041('0x34')]=_['intersection'](_0x478e59[_0xf041('0x30')],qs[_0xf041('0x35')](_0x36fd8b[_0xf041('0x31')][_0xf041('0x35')]));_0x4de2d1[_0xf041('0x34')]=_0x4de2d1[_0xf041('0x34')][_0xf041('0x36')]?_0x4de2d1[_0xf041('0x34')]:_0x478e59[_0xf041('0x30')];if(_0x36fd8b[_0xf041('0x31')]['includeAll']){_0x4de2d1[_0xf041('0x43')]=[{'all':!![]}];}_0x4de2d1=_[_0xf041('0x40')]({},_0x4de2d1,_0x36fd8b[_0xf041('0x41')]);return db[_0xf041('0x2c')]['find'](_0x4de2d1)[_0xf041('0x42')](handleEntityNotFound(_0x3e9d59,null))['then'](respondWithResult(_0x3e9d59,null))[_0xf041('0x46')](handleError(_0x3e9d59,null));};exports[_0xf041('0x49')]=function(_0x59efb0,_0x30c7f2){return db[_0xf041('0x2c')][_0xf041('0x49')](_0x59efb0[_0xf041('0x4a')],{})[_0xf041('0x42')](respondWithResult(_0x30c7f2,0xc9))[_0xf041('0x46')](handleError(_0x30c7f2,null));};exports[_0xf041('0x23')]=function(_0x48b0a2,_0x19cfe1){if(_0x48b0a2['body']['id']){delete _0x48b0a2['body']['id'];}return db[_0xf041('0x2c')][_0xf041('0x4b')]({'where':{'id':_0x48b0a2['params']['id']}})['then'](handleEntityNotFound(_0x19cfe1,null))[_0xf041('0x42')](saveUpdates(_0x48b0a2[_0xf041('0x4a')],null))[_0xf041('0x42')](respondWithResult(_0x19cfe1,null))[_0xf041('0x46')](handleError(_0x19cfe1,null));};exports[_0xf041('0x24')]=function(_0x12e99b,_0x2f53de){return db[_0xf041('0x2c')][_0xf041('0x4b')]({'where':{'id':_0x12e99b[_0xf041('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f53de,null))[_0xf041('0x42')](removeEntity(_0x2f53de,null))[_0xf041('0x46')](handleError(_0x2f53de,null));};exports['getConfigurations']=function(_0x5b496f,_0xc9daef,_0x2745b0){var _0x1d4963={};var _0x56518d={};var _0x461449;var _0x4b94c8;return db['DeskAccount'][_0xf041('0x4c')]({'where':{'id':_0x5b496f[_0xf041('0x48')]['id']}})[_0xf041('0x42')](handleEntityNotFound(_0xc9daef,null))[_0xf041('0x42')](function(_0xa4ea6){if(_0xa4ea6){_0x461449=_0xa4ea6;_0x56518d['model']=_[_0xf041('0x32')](db[_0xf041('0x4d')][_0xf041('0x2d')]);_0x56518d[_0xf041('0x31')]=_['keys'](_0x5b496f['query']);_0x56518d['filters']=_[_0xf041('0x33')](_0x56518d['model'],_0x56518d[_0xf041('0x31')]);_0x1d4963[_0xf041('0x34')]=_[_0xf041('0x33')](_0x56518d[_0xf041('0x30')],qs[_0xf041('0x35')](_0x5b496f[_0xf041('0x31')][_0xf041('0x35')]));_0x1d4963[_0xf041('0x34')]=_0x1d4963[_0xf041('0x34')][_0xf041('0x36')]?_0x1d4963['attributes']:_0x56518d[_0xf041('0x30')];_0x1d4963[_0xf041('0x39')]=qs[_0xf041('0x3a')](_0x5b496f[_0xf041('0x31')][_0xf041('0x3a')]);_0x1d4963[_0xf041('0x3b')]=qs[_0xf041('0x3c')](_['pick'](_0x5b496f[_0xf041('0x31')],_0x56518d[_0xf041('0x3c')]));if(_0x5b496f['query']['filter']){_0x1d4963[_0xf041('0x3b')]=_[_0xf041('0x40')](_0x1d4963[_0xf041('0x3b')],{'$or':_[_0xf041('0x2b')](_0x1d4963['attributes'],function(_0x4dc273){var _0x43d96d={};_0x43d96d[_0x4dc273]={'$like':'%'+_0x5b496f[_0xf041('0x31')][_0xf041('0x3e')]+'%'};return _0x43d96d;})});}_0x1d4963=_['merge']({},_0x1d4963,_0x5b496f[_0xf041('0x41')]);return _0x461449['getConfigurations'](_0x1d4963);}})[_0xf041('0x42')](function(_0x278710){if(_0x278710){_0x4b94c8=_0x278710['length'];if(!_0x5b496f[_0xf041('0x31')][_0xf041('0x37')](_0xf041('0x38'))){_0x1d4963[_0xf041('0x1d')]=qs['limit'](_0x5b496f['query'][_0xf041('0x1d')]);_0x1d4963[_0xf041('0x1b')]=qs[_0xf041('0x1b')](_0x5b496f['query'][_0xf041('0x1b')]);}return _0x461449[_0xf041('0x4e')](_0x1d4963);}})[_0xf041('0x42')](function(_0x3fe6b5){if(_0x3fe6b5){return _0x3fe6b5?{'count':_0x4b94c8,'rows':_0x3fe6b5}:null;}})[_0xf041('0x42')](respondWithResult(_0xc9daef,null))['catch'](handleError(_0xc9daef,null));};exports[_0xf041('0x4f')]=function(_0x10ce04,_0x565391,_0x5e5435){if(_0x10ce04[_0xf041('0x4a')]['id']){delete _0x10ce04[_0xf041('0x4a')]['id'];}return db[_0xf041('0x2c')][_0xf041('0x4c')]({'where':{'id':_0x10ce04[_0xf041('0x48')]['id']}})[_0xf041('0x42')](handleEntityNotFound(_0x565391,null))[_0xf041('0x42')](function(_0x1e138b){if(_0x1e138b){_0x10ce04['body']['AccountId']=_0x1e138b['id'];_0x10ce04['body'][_0xf041('0x50')]=integrations[_0xf041('0x51')](_0x10ce04[_0xf041('0x4a')][_0xf041('0x52')],_0x10ce04[_0xf041('0x4a')][_0xf041('0x2e')]);_0x10ce04[_0xf041('0x4a')][_0xf041('0x53')]=integrations[_0xf041('0x54')](_0x10ce04['body'][_0xf041('0x52')],_0x10ce04['body'][_0xf041('0x2e')]);return db[_0xf041('0x4d')][_0xf041('0x49')](_0x10ce04[_0xf041('0x4a')],{'include':[{'model':db[_0xf041('0x55')],'as':_0xf041('0x50')},{'model':db[_0xf041('0x55')],'as':_0xf041('0x53')}]});}return null;})['then'](respondWithResult(_0x565391,null))['catch'](handleError(_0x565391,null));};exports[_0xf041('0x56')]=function(_0x4fcedf,_0x3551c1,_0x28efb8){var _0x3ae9ba=[{'name':_0xf041('0x57'),'label':_0xf041('0x57'),'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 _0x138fde='';return db[_0xf041('0x2c')][_0xf041('0x4c')]({'where':{'id':_0x4fcedf['params']['id']},'attributes':['id',_0xf041('0x58'),_0xf041('0x59'),_0xf041('0x5a'),_0xf041('0x5b'),_0xf041('0x5c'),_0xf041('0x5d'),_0xf041('0x5e'),_0xf041('0x5f')]})[_0xf041('0x42')](handleEntityNotFound(_0x3551c1,null))['then'](function(_0x3a1580){if(_0x3a1580){_0x138fde=_0x3a1580[_0xf041('0x58')];var _0x31d2f0=_0x138fde[_0xf041('0x60')](-0x1);if(_0x31d2f0==='/'){_0x138fde=_0x138fde[_0xf041('0x61')](0x0,_0x138fde[_0xf041('0x62')](_0x31d2f0));}var _0x121e70={'method':_0xf041('0x63'),'uri':util['format'](_0xf041('0x64'),_0x138fde),'headers':{'Content-Type':_0xf041('0x65'),'Accept':_0xf041('0x65')},'json':!![]};if(_0x3a1580[_0xf041('0x59')]===_0xf041('0x66')){_0x121e70[_0xf041('0x67')][_0xf041('0x68')]=util['format'](_0xf041('0x69'),new Buffer(util['format'](_0xf041('0x6a'),_0x3a1580[_0xf041('0x5a')],_0x3a1580[_0xf041('0x5b')]))[_0xf041('0x6b')]('base64'));}return rp(_0x121e70)[_0xf041('0x42')](function(_0x228a6a){return _0x3ae9ba[_0xf041('0x6c')](_['map'](_0x228a6a[_0xf041('0x6d')][_0xf041('0x6e')],function(_0x300bd){return{'id':_0x300bd[_0xf041('0x28')],'name':_0x300bd['name'],'type':_0x300bd[_0xf041('0x2e')],'active':_0x300bd['active'],'label':_0x300bd[_0xf041('0x6f')],'custom':!![]};}));});}})['then'](function(_0x1be84f){return{'count':_0x1be84f[_0xf041('0x36')],'rows':_0x1be84f};})[_0xf041('0x42')](respondWithResult(_0x3551c1,null))['catch'](function(_0x439463){var _0x38c9e0=_0x4fcedf['query'][_0xf041('0x70')]?0x1f4:_0x439463[_0xf041('0x71')]||0x1f4;logger[_0xf041('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xf041('0x56'),_0x38c9e0,JSON['stringify'](_0x439463));delete _0x439463[_0xf041('0x28')];if(_0x38c9e0===0x191){_0x38c9e0=0x190;}_0x3551c1[_0xf041('0x19')](_0x38c9e0)[_0xf041('0x29')](_0x4fcedf['query']['test']?{'message':_0xf041('0x72'),'statusCode':_0x439463['statusCode']}:_0x439463);});}; \ No newline at end of file +var _0x1f0e=['priority','authType','username','password','consumerKey','consumerSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','toString','base64','concat','_embedded','entries','active','label','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','stack','name','send','index','map','fieldName','key','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','merge','options','DeskAccount','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','update','params','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','type','getDescriptions','DeskField','getFields'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1f0e,0x17f));var _0xe1f0=function(_0x3326cd,_0x33697d){_0x3326cd=_0x3326cd-0x0;var _0x18d56c=_0x1f0e[_0x3326cd];return _0x18d56c;};'use strict';var emlformat=require(_0xe1f0('0x0'));var rimraf=require(_0xe1f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1f0('0x2'));var rp=require('request-promise');var moment=require(_0xe1f0('0x3'));var BPromise=require(_0xe1f0('0x4'));var Mustache=require(_0xe1f0('0x5'));var util=require(_0xe1f0('0x6'));var path=require(_0xe1f0('0x7'));var sox=require(_0xe1f0('0x8'));var csv=require(_0xe1f0('0x9'));var ejs=require(_0xe1f0('0xa'));var fs=require('fs');var fs_extra=require(_0xe1f0('0xb'));var _=require(_0xe1f0('0xc'));var squel=require(_0xe1f0('0xd'));var crypto=require(_0xe1f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe1f0('0xf'));var toCsv=require(_0xe1f0('0x9'));var querystring=require(_0xe1f0('0x10'));var Papa=require(_0xe1f0('0x11'));var Redis=require(_0xe1f0('0x12'));var authService=require(_0xe1f0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe1f0('0x14'));var hardwareService=require(_0xe1f0('0x15'));var logger=require(_0xe1f0('0x16'))('api');var utils=require(_0xe1f0('0x17'));var config=require(_0xe1f0('0x18'));var licenseUtil=require(_0xe1f0('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe1f0('0x1a'));function respondWithStatusCode(_0x556b6d,_0x42f4fa){_0x42f4fa=_0x42f4fa||0xcc;return function(_0xaa99d9){if(_0xaa99d9){return _0x556b6d[_0xe1f0('0x1b')](_0x42f4fa);}return _0x556b6d[_0xe1f0('0x1c')](_0x42f4fa)['end']();};}function respondWithResult(_0x1baaf1,_0x2ee160){_0x2ee160=_0x2ee160||0xc8;return function(_0x3ade27){if(_0x3ade27){return _0x1baaf1[_0xe1f0('0x1c')](_0x2ee160)[_0xe1f0('0x1d')](_0x3ade27);}};}function respondWithFilteredResult(_0x2133d8,_0x42f97c){return function(_0x23f505){if(_0x23f505){var _0xd5cde1=typeof _0x42f97c[_0xe1f0('0x1e')]===_0xe1f0('0x1f')&&typeof _0x42f97c[_0xe1f0('0x20')]===_0xe1f0('0x1f');var _0x5e8f24=_0x23f505[_0xe1f0('0x21')];var _0xbc856f=_0xd5cde1?0x0:_0x42f97c[_0xe1f0('0x1e')];var _0x14b9ad=_0xd5cde1?_0x23f505[_0xe1f0('0x21')]:_0x42f97c['offset']+_0x42f97c[_0xe1f0('0x20')];var _0x53edfb;if(_0x14b9ad>=_0x5e8f24){_0x14b9ad=_0x5e8f24;_0x53edfb=0xc8;}else{_0x53edfb=0xce;}_0x2133d8['status'](_0x53edfb);return _0x2133d8['set'](_0xe1f0('0x22'),_0xbc856f+'-'+_0x14b9ad+'/'+_0x5e8f24)[_0xe1f0('0x1d')](_0x23f505);}return null;};}function patchUpdates(_0xd44ef3){return function(_0x5070c3){try{jsonpatch['apply'](_0x5070c3,_0xd44ef3,!![]);}catch(_0xe73e0d){return BPromise[_0xe1f0('0x23')](_0xe73e0d);}return _0x5070c3[_0xe1f0('0x24')]();};}function saveUpdates(_0x2be91e,_0x5ba16a){return function(_0x1c714f){if(_0x1c714f){return _0x1c714f['update'](_0x2be91e)[_0xe1f0('0x25')](function(_0x40dad5){return _0x40dad5;});}return null;};}function removeEntity(_0x51942f,_0x374993){return function(_0x2d9553){if(_0x2d9553){return _0x2d9553[_0xe1f0('0x26')]()[_0xe1f0('0x25')](function(){_0x51942f['status'](0xcc)[_0xe1f0('0x27')]();});}};}function handleEntityNotFound(_0x31416b,_0x1292be){return function(_0x13985f){if(!_0x13985f){_0x31416b[_0xe1f0('0x1b')](0x194);}return _0x13985f;};}function handleError(_0x9a2ed6,_0x37a7a6){_0x37a7a6=_0x37a7a6||0x1f4;return function(_0x6b0a96){logger['error'](_0x6b0a96[_0xe1f0('0x28')]);if(_0x6b0a96[_0xe1f0('0x29')]){delete _0x6b0a96[_0xe1f0('0x29')];}_0x9a2ed6[_0xe1f0('0x1c')](_0x37a7a6)[_0xe1f0('0x2a')](_0x6b0a96);};}exports[_0xe1f0('0x2b')]=function(_0x216d4e,_0xaef19b){var _0x4ccd40={},_0x4e34c6={},_0x3d8220={'count':0x0,'rows':[]};var _0x3cc3db=_[_0xe1f0('0x2c')](db['DeskAccount']['rawAttributes'],function(_0x1002da){return{'name':_0x1002da[_0xe1f0('0x2d')],'type':_0x1002da['type'][_0xe1f0('0x2e')]};});_0x4e34c6['model']=_['map'](_0x3cc3db,_0xe1f0('0x29'));_0x4e34c6['query']=_[_0xe1f0('0x2f')](_0x216d4e[_0xe1f0('0x30')]);_0x4e34c6[_0xe1f0('0x31')]=_['intersection'](_0x4e34c6['model'],_0x4e34c6[_0xe1f0('0x30')]);_0x4ccd40['attributes']=_[_0xe1f0('0x32')](_0x4e34c6[_0xe1f0('0x33')],qs[_0xe1f0('0x34')](_0x216d4e[_0xe1f0('0x30')][_0xe1f0('0x34')]));_0x4ccd40[_0xe1f0('0x35')]=_0x4ccd40[_0xe1f0('0x35')]['length']?_0x4ccd40[_0xe1f0('0x35')]:_0x4e34c6[_0xe1f0('0x33')];if(!_0x216d4e['query']['hasOwnProperty'](_0xe1f0('0x36'))){_0x4ccd40[_0xe1f0('0x20')]=qs[_0xe1f0('0x20')](_0x216d4e[_0xe1f0('0x30')][_0xe1f0('0x20')]);_0x4ccd40[_0xe1f0('0x1e')]=qs['offset'](_0x216d4e[_0xe1f0('0x30')][_0xe1f0('0x1e')]);}_0x4ccd40[_0xe1f0('0x37')]=qs[_0xe1f0('0x38')](_0x216d4e['query'][_0xe1f0('0x38')]);_0x4ccd40[_0xe1f0('0x39')]=qs['filters'](_['pick'](_0x216d4e[_0xe1f0('0x30')],_0x4e34c6[_0xe1f0('0x31')]),_0x3cc3db);if(_0x216d4e[_0xe1f0('0x30')][_0xe1f0('0x3a')]){_0x4ccd40[_0xe1f0('0x39')]=_['merge'](_0x4ccd40[_0xe1f0('0x39')],{'$or':_[_0xe1f0('0x2c')](_0x3cc3db,function(_0x407731){if(_0x407731['type']!==_0xe1f0('0x3b')){var _0x44f5c7={};_0x44f5c7[_0x407731[_0xe1f0('0x29')]]={'$like':'%'+_0x216d4e[_0xe1f0('0x30')][_0xe1f0('0x3a')]+'%'};return _0x44f5c7;}})});}_0x4ccd40=_[_0xe1f0('0x3c')]({},_0x4ccd40,_0x216d4e[_0xe1f0('0x3d')]);var _0x16a57d={'where':_0x4ccd40[_0xe1f0('0x39')]};return db[_0xe1f0('0x3e')][_0xe1f0('0x21')](_0x16a57d)['then'](function(_0x39f81c){_0x3d8220['count']=_0x39f81c;if(_0x216d4e[_0xe1f0('0x30')]['includeAll']){_0x4ccd40[_0xe1f0('0x3f')]=[{'all':!![]}];}return db[_0xe1f0('0x3e')][_0xe1f0('0x40')](_0x4ccd40);})[_0xe1f0('0x25')](function(_0x422f0e){_0x3d8220[_0xe1f0('0x41')]=_0x422f0e;return _0x3d8220;})[_0xe1f0('0x25')](respondWithFilteredResult(_0xaef19b,_0x4ccd40))[_0xe1f0('0x42')](handleError(_0xaef19b,null));};exports[_0xe1f0('0x43')]=function(_0x1c0181,_0x2054f7){var _0x559580={'raw':![],'where':{'id':_0x1c0181['params']['id']}},_0xb4bd37={};_0xb4bd37[_0xe1f0('0x33')]=_[_0xe1f0('0x2f')](db[_0xe1f0('0x3e')][_0xe1f0('0x44')]);_0xb4bd37[_0xe1f0('0x30')]=_['keys'](_0x1c0181[_0xe1f0('0x30')]);_0xb4bd37['filters']=_['intersection'](_0xb4bd37[_0xe1f0('0x33')],_0xb4bd37[_0xe1f0('0x30')]);_0x559580[_0xe1f0('0x35')]=_[_0xe1f0('0x32')](_0xb4bd37[_0xe1f0('0x33')],qs[_0xe1f0('0x34')](_0x1c0181[_0xe1f0('0x30')][_0xe1f0('0x34')]));_0x559580[_0xe1f0('0x35')]=_0x559580[_0xe1f0('0x35')][_0xe1f0('0x45')]?_0x559580['attributes']:_0xb4bd37[_0xe1f0('0x33')];if(_0x1c0181[_0xe1f0('0x30')][_0xe1f0('0x46')]){_0x559580['include']=[{'all':!![]}];}_0x559580=_[_0xe1f0('0x3c')]({},_0x559580,_0x1c0181[_0xe1f0('0x3d')]);return db['DeskAccount'][_0xe1f0('0x47')](_0x559580)['then'](handleEntityNotFound(_0x2054f7,null))[_0xe1f0('0x25')](respondWithResult(_0x2054f7,null))['catch'](handleError(_0x2054f7,null));};exports['create']=function(_0x4334bd,_0x360005){return db['DeskAccount'][_0xe1f0('0x48')](_0x4334bd[_0xe1f0('0x49')],{})[_0xe1f0('0x25')](respondWithResult(_0x360005,0xc9))[_0xe1f0('0x42')](handleError(_0x360005,null));};exports[_0xe1f0('0x4a')]=function(_0xde7e4f,_0x4cf36c){if(_0xde7e4f[_0xe1f0('0x49')]['id']){delete _0xde7e4f[_0xe1f0('0x49')]['id'];}return db['DeskAccount'][_0xe1f0('0x47')]({'where':{'id':_0xde7e4f[_0xe1f0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4cf36c,null))[_0xe1f0('0x25')](saveUpdates(_0xde7e4f[_0xe1f0('0x49')],null))[_0xe1f0('0x25')](respondWithResult(_0x4cf36c,null))['catch'](handleError(_0x4cf36c,null));};exports['destroy']=function(_0x2162ac,_0x33a2fa){return db[_0xe1f0('0x3e')][_0xe1f0('0x47')]({'where':{'id':_0x2162ac[_0xe1f0('0x4b')]['id']}})[_0xe1f0('0x25')](handleEntityNotFound(_0x33a2fa,null))[_0xe1f0('0x25')](removeEntity(_0x33a2fa,null))[_0xe1f0('0x42')](handleError(_0x33a2fa,null));};exports[_0xe1f0('0x4c')]=function(_0x141e2a,_0x2e33cb,_0x3245da){var _0x24c788={};var _0x2a3795={};var _0x2149a9;var _0x1aa426;return db[_0xe1f0('0x3e')][_0xe1f0('0x4d')]({'where':{'id':_0x141e2a['params']['id']}})[_0xe1f0('0x25')](handleEntityNotFound(_0x2e33cb,null))[_0xe1f0('0x25')](function(_0x6d7b48){if(_0x6d7b48){_0x2149a9=_0x6d7b48;_0x2a3795['model']=_[_0xe1f0('0x2f')](db[_0xe1f0('0x4e')][_0xe1f0('0x44')]);_0x2a3795[_0xe1f0('0x30')]=_[_0xe1f0('0x2f')](_0x141e2a['query']);_0x2a3795[_0xe1f0('0x31')]=_['intersection'](_0x2a3795[_0xe1f0('0x33')],_0x2a3795['query']);_0x24c788['attributes']=_['intersection'](_0x2a3795[_0xe1f0('0x33')],qs['fields'](_0x141e2a['query'][_0xe1f0('0x34')]));_0x24c788[_0xe1f0('0x35')]=_0x24c788[_0xe1f0('0x35')][_0xe1f0('0x45')]?_0x24c788[_0xe1f0('0x35')]:_0x2a3795[_0xe1f0('0x33')];_0x24c788[_0xe1f0('0x37')]=qs[_0xe1f0('0x38')](_0x141e2a[_0xe1f0('0x30')]['sort']);_0x24c788[_0xe1f0('0x39')]=qs[_0xe1f0('0x31')](_[_0xe1f0('0x4f')](_0x141e2a[_0xe1f0('0x30')],_0x2a3795['filters']));if(_0x141e2a[_0xe1f0('0x30')][_0xe1f0('0x3a')]){_0x24c788[_0xe1f0('0x39')]=_[_0xe1f0('0x3c')](_0x24c788[_0xe1f0('0x39')],{'$or':_[_0xe1f0('0x2c')](_0x24c788['attributes'],function(_0x7d15f4){var _0x1e89a7={};_0x1e89a7[_0x7d15f4]={'$like':'%'+_0x141e2a[_0xe1f0('0x30')][_0xe1f0('0x3a')]+'%'};return _0x1e89a7;})});}_0x24c788=_['merge']({},_0x24c788,_0x141e2a['options']);return _0x2149a9[_0xe1f0('0x4c')](_0x24c788);}})[_0xe1f0('0x25')](function(_0x2dc789){if(_0x2dc789){_0x1aa426=_0x2dc789[_0xe1f0('0x45')];if(!_0x141e2a[_0xe1f0('0x30')]['hasOwnProperty'](_0xe1f0('0x36'))){_0x24c788[_0xe1f0('0x20')]=qs[_0xe1f0('0x20')](_0x141e2a[_0xe1f0('0x30')][_0xe1f0('0x20')]);_0x24c788[_0xe1f0('0x1e')]=qs[_0xe1f0('0x1e')](_0x141e2a['query'][_0xe1f0('0x1e')]);}return _0x2149a9['getConfigurations'](_0x24c788);}})[_0xe1f0('0x25')](function(_0x191f46){if(_0x191f46){return _0x191f46?{'count':_0x1aa426,'rows':_0x191f46}:null;}})[_0xe1f0('0x25')](respondWithResult(_0x2e33cb,null))['catch'](handleError(_0x2e33cb,null));};exports[_0xe1f0('0x50')]=function(_0x123516,_0x4b5c19,_0x4fa493){if(_0x123516[_0xe1f0('0x49')]['id']){delete _0x123516[_0xe1f0('0x49')]['id'];}return db[_0xe1f0('0x3e')]['findOne']({'where':{'id':_0x123516['params']['id']}})['then'](handleEntityNotFound(_0x4b5c19,null))[_0xe1f0('0x25')](function(_0x5837b0){if(_0x5837b0){_0x123516[_0xe1f0('0x49')][_0xe1f0('0x51')]=_0x5837b0['id'];_0x123516[_0xe1f0('0x49')][_0xe1f0('0x52')]=integrations[_0xe1f0('0x53')](_0x123516[_0xe1f0('0x49')][_0xe1f0('0x54')],_0x123516['body'][_0xe1f0('0x55')]);_0x123516[_0xe1f0('0x49')]['Descriptions']=integrations[_0xe1f0('0x56')](_0x123516[_0xe1f0('0x49')]['channel'],_0x123516['body'][_0xe1f0('0x55')]);return db[_0xe1f0('0x4e')]['create'](_0x123516[_0xe1f0('0x49')],{'include':[{'model':db[_0xe1f0('0x57')],'as':_0xe1f0('0x52')},{'model':db[_0xe1f0('0x57')],'as':'Descriptions'}]});}return null;})[_0xe1f0('0x25')](respondWithResult(_0x4b5c19,null))['catch'](handleError(_0x4b5c19,null));};exports[_0xe1f0('0x58')]=function(_0x1c73ba,_0x33cf71,_0x264483){var _0xadbcbd=[{'name':_0xe1f0('0x59'),'label':_0xe1f0('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 _0x3b2df1='';return db[_0xe1f0('0x3e')]['findOne']({'where':{'id':_0x1c73ba[_0xe1f0('0x4b')]['id']},'attributes':['id','remoteUri',_0xe1f0('0x5a'),_0xe1f0('0x5b'),_0xe1f0('0x5c'),_0xe1f0('0x5d'),_0xe1f0('0x5e'),'token','tokenSecret']})['then'](handleEntityNotFound(_0x33cf71,null))[_0xe1f0('0x25')](function(_0x342d9a){if(_0x342d9a){_0x3b2df1=_0x342d9a[_0xe1f0('0x5f')];var _0x42a664=_0x3b2df1[_0xe1f0('0x60')](-0x1);if(_0x42a664==='/'){_0x3b2df1=_0x3b2df1[_0xe1f0('0x61')](0x0,_0x3b2df1[_0xe1f0('0x62')](_0x42a664));}var _0x5cb2aa={'method':_0xe1f0('0x63'),'uri':util[_0xe1f0('0x64')](_0xe1f0('0x65'),_0x3b2df1),'headers':{'Content-Type':_0xe1f0('0x66'),'Accept':_0xe1f0('0x66')},'json':!![]};if(_0x342d9a[_0xe1f0('0x5a')]===_0xe1f0('0x67')){_0x5cb2aa[_0xe1f0('0x68')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x342d9a[_0xe1f0('0x5b')],_0x342d9a[_0xe1f0('0x5c')]))[_0xe1f0('0x69')](_0xe1f0('0x6a')));}return rp(_0x5cb2aa)[_0xe1f0('0x25')](function(_0x50fb5b){return _0xadbcbd[_0xe1f0('0x6b')](_[_0xe1f0('0x2c')](_0x50fb5b[_0xe1f0('0x6c')][_0xe1f0('0x6d')],function(_0x48aad5){return{'id':_0x48aad5[_0xe1f0('0x29')],'name':_0x48aad5[_0xe1f0('0x29')],'type':_0x48aad5['type'],'active':_0x48aad5[_0xe1f0('0x6e')],'label':_0x48aad5[_0xe1f0('0x6f')],'custom':!![]};}));});}})[_0xe1f0('0x25')](function(_0xe53aa1){return{'count':_0xe53aa1['length'],'rows':_0xe53aa1};})[_0xe1f0('0x25')](respondWithResult(_0x33cf71,null))[_0xe1f0('0x42')](function(_0x12b570){var _0x41bdac=_0x1c73ba[_0xe1f0('0x30')][_0xe1f0('0x70')]?0x1f4:_0x12b570['statusCode']||0x1f4;logger[_0xe1f0('0x71')](_0xe1f0('0x72'),_0xe1f0('0x58'),_0x41bdac,JSON[_0xe1f0('0x73')](_0x12b570));delete _0x12b570['name'];if(_0x41bdac===0x191){_0x41bdac=0x190;}_0x33cf71[_0xe1f0('0x1c')](_0x41bdac)['send'](_0x1c73ba['query']['test']?{'message':_0xe1f0('0x74'),'statusCode':_0x12b570[_0xe1f0('0x75')]}:_0x12b570);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d7a4e68..0ff2412 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 _0x8453=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','DeskAccount','int_desk_accounts'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x8453,0x1cb));var _0x3845=function(_0x59cc9e,_0x30afd9){_0x59cc9e=_0x59cc9e-0x0;var _0x41b262=_0x8453[_0x59cc9e];return _0x41b262;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3845('0x0'))(_0x3845('0x1'));var moment=require('moment');var BPromise=require(_0x3845('0x2'));var rp=require(_0x3845('0x3'));var fs=require('fs');var path=require(_0x3845('0x4'));var rimraf=require('rimraf');var config=require(_0x3845('0x5'));var attributes=require(_0x3845('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2fcf11,_0x1bcc41){return _0x2fcf11['define'](_0x3845('0x7'),attributes,{'tableName':_0x3845('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90d7=['api','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90d7,0x174));var _0x790d=function(_0x24e360,_0x8e38ab){_0x24e360=_0x24e360-0x0;var _0x1722a4=_0x90d7[_0x24e360];return _0x1722a4;};'use strict';var _=require('lodash');var util=require(_0x790d('0x0'));var logger=require(_0x790d('0x1'))(_0x790d('0x2'));var moment=require('moment');var BPromise=require(_0x790d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x790d('0x4'));var rimraf=require(_0x790d('0x5'));var config=require(_0x790d('0x6'));var attributes=require(_0x790d('0x7'));var integrations=require(_0x790d('0x8'));module['exports']=function(_0x350d5f,_0x3b1e05){return _0x350d5f[_0x790d('0x9')](_0x790d('0xa'),attributes,{'tableName':'int_desk_accounts','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 23ec3ac..4fd3540 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 _0x6fb1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetDeskAccount','options','raw','where','attributes','include','map','model','debug','stringify','ShowDeskAccount','DeskAccount','find','util'];(function(_0x4d893a,_0x1669e3){var _0x25a32b=function(_0x410dc3){while(--_0x410dc3){_0x4d893a['push'](_0x4d893a['shift']());}};_0x25a32b(++_0x1669e3);}(_0x6fb1,0xc5));var _0x16fb=function(_0x357dac,_0x55ffe3){_0x357dac=_0x357dac-0x0;var _0x3c640d=_0x6fb1[_0x357dac];return _0x3c640d;};'use strict';var _=require('lodash');var util=require(_0x16fb('0x0'));var moment=require(_0x16fb('0x1'));var BPromise=require(_0x16fb('0x2'));var rs=require(_0x16fb('0x3'));var fs=require('fs');var Redis=require(_0x16fb('0x4'));var db=require(_0x16fb('0x5'))['db'];var utils=require(_0x16fb('0x6'));var logger=require(_0x16fb('0x7'))('rpc');var config=require(_0x16fb('0x8'));var jayson=require(_0x16fb('0x9'));var client=jayson['client'][_0x16fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fad25,_0x597843,_0x253bbf){return new BPromise(function(_0x3d2eb3,_0x5b7b2b){return client['request'](_0x3fad25,_0x253bbf)[_0x16fb('0xb')](function(_0x96b30e){logger[_0x16fb('0xc')](_0x16fb('0xd'),_0x597843,'request\x20sent');logger['debug'](_0x16fb('0xe'),_0x597843,_0x16fb('0xf'),JSON['stringify'](_0x96b30e));if(_0x96b30e[_0x16fb('0x10')]){if(_0x96b30e[_0x16fb('0x10')][_0x16fb('0x11')]===0x1f4){logger[_0x16fb('0x10')](_0x16fb('0xd'),_0x597843,_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);return _0x5b7b2b(_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);}logger[_0x16fb('0x10')](_0x16fb('0xd'),_0x597843,_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);return _0x3d2eb3(_0x96b30e[_0x16fb('0x10')][_0x16fb('0x12')]);}else{logger[_0x16fb('0xc')](_0x16fb('0xd'),_0x597843,_0x16fb('0xf'));_0x3d2eb3(_0x96b30e['result']['message']);}})[_0x16fb('0x13')](function(_0x31c994){logger[_0x16fb('0x10')](_0x16fb('0xd'),_0x597843,_0x31c994);_0x5b7b2b(_0x31c994);});});}exports[_0x16fb('0x14')]=function(_0x3c4568){var _0x580988=this;return new Promise(function(_0x5d6d67,_0x53ab9a){return db['DeskAccount']['findAll']({'raw':_0x3c4568[_0x16fb('0x15')]?_0x3c4568[_0x16fb('0x15')][_0x16fb('0x16')]===undefined?!![]:![]:!![],'where':_0x3c4568[_0x16fb('0x15')]?_0x3c4568[_0x16fb('0x15')][_0x16fb('0x17')]||null:null,'attributes':_0x3c4568['options']?_0x3c4568[_0x16fb('0x15')][_0x16fb('0x18')]||null:null,'limit':_0x3c4568['options']?_0x3c4568['options']['limit']||null:null,'include':_0x3c4568[_0x16fb('0x15')]?_0x3c4568[_0x16fb('0x15')][_0x16fb('0x19')]?_[_0x16fb('0x1a')](_0x3c4568[_0x16fb('0x15')][_0x16fb('0x19')],function(_0x7cc0e3){return{'model':db[_0x7cc0e3['model']],'as':_0x7cc0e3['as'],'attributes':_0x7cc0e3['attributes'],'include':_0x7cc0e3[_0x16fb('0x19')]?_['map'](_0x7cc0e3[_0x16fb('0x19')],function(_0x499d0a){return{'model':db[_0x499d0a[_0x16fb('0x1b')]],'as':_0x499d0a['as'],'attributes':_0x499d0a[_0x16fb('0x18')],'include':_0x499d0a[_0x16fb('0x19')]?_[_0x16fb('0x1a')](_0x499d0a['include'],function(_0x51a58d){return{'model':db[_0x51a58d[_0x16fb('0x1b')]],'as':_0x51a58d['as'],'attributes':_0x51a58d[_0x16fb('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ab050){logger[_0x16fb('0xc')](_0x16fb('0x14'),_0x3c4568);logger[_0x16fb('0x1c')](_0x16fb('0x14'),_0x3c4568,JSON[_0x16fb('0x1d')](_0x1ab050));_0x5d6d67(_0x1ab050);})['catch'](function(_0xc5a51e){logger[_0x16fb('0x10')](_0x16fb('0x14'),_0xc5a51e[_0x16fb('0x12')],_0x3c4568);_0x53ab9a(_0x580988['error'](0x1f4,_0xc5a51e['message']));});});};exports[_0x16fb('0x1e')]=function(_0x2b07ca){var _0x102af1=this;return new Promise(function(_0x456978,_0x233f51){return db[_0x16fb('0x1f')][_0x16fb('0x20')]({'raw':_0x2b07ca[_0x16fb('0x15')]?_0x2b07ca[_0x16fb('0x15')][_0x16fb('0x16')]===undefined?!![]:![]:!![],'where':_0x2b07ca['options']?_0x2b07ca['options']['where']||null:null,'attributes':_0x2b07ca['options']?_0x2b07ca[_0x16fb('0x15')][_0x16fb('0x18')]||null:null,'include':_0x2b07ca[_0x16fb('0x15')]?_0x2b07ca[_0x16fb('0x15')][_0x16fb('0x19')]?_['map'](_0x2b07ca[_0x16fb('0x15')][_0x16fb('0x19')],function(_0x3c5322){return{'model':db[_0x3c5322[_0x16fb('0x1b')]],'as':_0x3c5322['as'],'attributes':_0x3c5322[_0x16fb('0x18')],'include':_0x3c5322['include']?_[_0x16fb('0x1a')](_0x3c5322['include'],function(_0xb832bf){return{'model':db[_0xb832bf[_0x16fb('0x1b')]],'as':_0xb832bf['as'],'attributes':_0xb832bf['attributes'],'include':_0xb832bf[_0x16fb('0x19')]?_[_0x16fb('0x1a')](_0xb832bf['include'],function(_0x1ee329){return{'model':db[_0x1ee329['model']],'as':_0x1ee329['as'],'attributes':_0x1ee329['attributes']};}):[]};}):[]};}):[]:[]})[_0x16fb('0xb')](function(_0x1f4c80){logger[_0x16fb('0xc')]('ShowDeskAccount',_0x2b07ca);logger['debug'](_0x16fb('0x1e'),_0x2b07ca,JSON[_0x16fb('0x1d')](_0x1f4c80));_0x456978(_0x1f4c80);})[_0x16fb('0x13')](function(_0x2a5b3e){logger['error'](_0x16fb('0x1e'),_0x2a5b3e[_0x16fb('0x12')],_0x2b07ca);_0x233f51(_0x102af1[_0x16fb('0x10')](0x1f4,_0x2a5b3e[_0x16fb('0x12')]));});});}; \ No newline at end of file +var _0xd818=['catch','GetDeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowDeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x15d03e,_0x1b0c4f){var _0x4bf2ed=function(_0xdd249c){while(--_0xdd249c){_0x15d03e['push'](_0x15d03e['shift']());}};_0x4bf2ed(++_0x1b0c4f);}(_0xd818,0x9c));var _0x8d81=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0xd818[_0xc40b9f];return _0x535b9c;};'use strict';var _=require(_0x8d81('0x0'));var util=require(_0x8d81('0x1'));var moment=require(_0x8d81('0x2'));var BPromise=require(_0x8d81('0x3'));var rs=require(_0x8d81('0x4'));var fs=require('fs');var Redis=require(_0x8d81('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d81('0x6'));var logger=require(_0x8d81('0x7'))('rpc');var config=require(_0x8d81('0x8'));var jayson=require(_0x8d81('0x9'));var client=jayson[_0x8d81('0xa')][_0x8d81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x650f4f,_0x3bc38a,_0x4961eb){return new BPromise(function(_0x87b40e,_0x3158cf){return client[_0x8d81('0xc')](_0x650f4f,_0x4961eb)[_0x8d81('0xd')](function(_0x12b477){logger['info'](_0x8d81('0xe'),_0x3bc38a,'request\x20sent');logger[_0x8d81('0xf')](_0x8d81('0x10'),_0x3bc38a,'request\x20sent',JSON[_0x8d81('0x11')](_0x12b477));if(_0x12b477['error']){if(_0x12b477[_0x8d81('0x12')][_0x8d81('0x13')]===0x1f4){logger['error'](_0x8d81('0xe'),_0x3bc38a,_0x12b477[_0x8d81('0x12')]['message']);return _0x3158cf(_0x12b477['error'][_0x8d81('0x14')]);}logger['error'](_0x8d81('0xe'),_0x3bc38a,_0x12b477[_0x8d81('0x12')][_0x8d81('0x14')]);return _0x87b40e(_0x12b477[_0x8d81('0x12')][_0x8d81('0x14')]);}else{logger[_0x8d81('0x15')]('DeskAccount,\x20%s,\x20%s',_0x3bc38a,_0x8d81('0x16'));_0x87b40e(_0x12b477[_0x8d81('0x17')][_0x8d81('0x14')]);}})[_0x8d81('0x18')](function(_0xc0b326){logger['error'](_0x8d81('0xe'),_0x3bc38a,_0xc0b326);_0x3158cf(_0xc0b326);});});}exports[_0x8d81('0x19')]=function(_0x55b9fa){var _0x5b4271=this;return new Promise(function(_0x503337,_0x5640c8){return db['DeskAccount'][_0x8d81('0x1a')]({'raw':_0x55b9fa[_0x8d81('0x1b')]?_0x55b9fa[_0x8d81('0x1b')][_0x8d81('0x1c')]===undefined?!![]:![]:!![],'where':_0x55b9fa[_0x8d81('0x1b')]?_0x55b9fa[_0x8d81('0x1b')]['where']||null:null,'attributes':_0x55b9fa[_0x8d81('0x1b')]?_0x55b9fa[_0x8d81('0x1b')][_0x8d81('0x1d')]||null:null,'limit':_0x55b9fa[_0x8d81('0x1b')]?_0x55b9fa['options'][_0x8d81('0x1e')]||null:null,'include':_0x55b9fa[_0x8d81('0x1b')]?_0x55b9fa[_0x8d81('0x1b')][_0x8d81('0x1f')]?_[_0x8d81('0x20')](_0x55b9fa[_0x8d81('0x1b')][_0x8d81('0x1f')],function(_0xcbdcd8){return{'model':db[_0xcbdcd8['model']],'as':_0xcbdcd8['as'],'attributes':_0xcbdcd8[_0x8d81('0x1d')],'include':_0xcbdcd8[_0x8d81('0x1f')]?_[_0x8d81('0x20')](_0xcbdcd8[_0x8d81('0x1f')],function(_0x545969){return{'model':db[_0x545969[_0x8d81('0x21')]],'as':_0x545969['as'],'attributes':_0x545969[_0x8d81('0x1d')],'include':_0x545969[_0x8d81('0x1f')]?_[_0x8d81('0x20')](_0x545969['include'],function(_0x5567c3){return{'model':db[_0x5567c3[_0x8d81('0x21')]],'as':_0x5567c3['as'],'attributes':_0x5567c3[_0x8d81('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8d81('0xd')](function(_0x5efd5d){logger[_0x8d81('0x15')]('GetDeskAccount',_0x55b9fa);logger[_0x8d81('0xf')](_0x8d81('0x19'),_0x55b9fa,JSON[_0x8d81('0x11')](_0x5efd5d));_0x503337(_0x5efd5d);})[_0x8d81('0x18')](function(_0x381e95){logger['error'](_0x8d81('0x19'),_0x381e95[_0x8d81('0x14')],_0x55b9fa);_0x5640c8(_0x5b4271[_0x8d81('0x12')](0x1f4,_0x381e95[_0x8d81('0x14')]));});});};exports[_0x8d81('0x22')]=function(_0x337fe8){var _0x195544=this;return new Promise(function(_0x26c47d,_0x49decc){return db['DeskAccount']['find']({'raw':_0x337fe8['options']?_0x337fe8['options'][_0x8d81('0x1c')]===undefined?!![]:![]:!![],'where':_0x337fe8['options']?_0x337fe8['options'][_0x8d81('0x23')]||null:null,'attributes':_0x337fe8[_0x8d81('0x1b')]?_0x337fe8[_0x8d81('0x1b')][_0x8d81('0x1d')]||null:null,'include':_0x337fe8[_0x8d81('0x1b')]?_0x337fe8[_0x8d81('0x1b')][_0x8d81('0x1f')]?_[_0x8d81('0x20')](_0x337fe8[_0x8d81('0x1b')][_0x8d81('0x1f')],function(_0x8bc9ec){return{'model':db[_0x8bc9ec[_0x8d81('0x21')]],'as':_0x8bc9ec['as'],'attributes':_0x8bc9ec[_0x8d81('0x1d')],'include':_0x8bc9ec[_0x8d81('0x1f')]?_[_0x8d81('0x20')](_0x8bc9ec['include'],function(_0x535fc7){return{'model':db[_0x535fc7['model']],'as':_0x535fc7['as'],'attributes':_0x535fc7[_0x8d81('0x1d')],'include':_0x535fc7['include']?_[_0x8d81('0x20')](_0x535fc7[_0x8d81('0x1f')],function(_0x3e3490){return{'model':db[_0x3e3490[_0x8d81('0x21')]],'as':_0x3e3490['as'],'attributes':_0x3e3490['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d81('0xd')](function(_0x4b9e31){logger[_0x8d81('0x15')](_0x8d81('0x22'),_0x337fe8);logger[_0x8d81('0xf')](_0x8d81('0x22'),_0x337fe8,JSON[_0x8d81('0x11')](_0x4b9e31));_0x26c47d(_0x4b9e31);})[_0x8d81('0x18')](function(_0x5a604c){logger[_0x8d81('0x12')](_0x8d81('0x22'),_0x5a604c[_0x8d81('0x14')],_0x337fe8);_0x49decc(_0x195544[_0x8d81('0x12')](0x1f4,_0x5a604c[_0x8d81('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d2e5772..d8b76e3 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x2d351f,_0x5b861d){var _0x109b6b=function(_0x2a6115){while(--_0x2a6115){_0x2d351f['push'](_0x2d351f['shift']());}};_0x109b6b(++_0x5b861d);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x525228,_0x14735e){var _0x1de6d8=function(_0x9cbfd9){while(--_0x9cbfd9){_0x525228['push'](_0x525228['shift']());}};_0x1de6d8(++_0x14735e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',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/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('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 ca031f5..56ef6fc 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 _0xa817=['STRING'];(function(_0x524d74,_0x76baaa){var _0x3aad11=function(_0x4e3f6e){while(--_0x4e3f6e){_0x524d74['push'](_0x524d74['shift']());}};_0x3aad11(++_0x76baaa);}(_0xa817,0x13a));var _0x7a81=function(_0x289582,_0x273fef){_0x289582=_0x289582-0x0;var _0xfecea3=_0xa817[_0x289582];return _0xfecea3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7a81('0x0')]},'description':{'type':Sequelize[_0x7a81('0x0')]}}; \ No newline at end of file +var _0xa152=['exports','STRING'];(function(_0x4cb095,_0x58da07){var _0x2b565d=function(_0x4d41b3){while(--_0x4d41b3){_0x4cb095['push'](_0x4cb095['shift']());}};_0x2b565d(++_0x58da07);}(_0xa152,0x94));var _0x2a15=function(_0x3f4795,_0x40b438){_0x3f4795=_0x3f4795-0x0;var _0xa74977=_0xa152[_0x3f4795];return _0xa74977;};'use strict';var Sequelize=require('sequelize');module[_0x2a15('0x0')]={'name':{'type':Sequelize[_0x2a15('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 5408f33..974a159 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 _0xf737=['order','sort','where','pick','merge','filter','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','update','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','sendStatus','error','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2a0f48,_0x1aa675){var _0x191a80=function(_0x4c5a0d){while(--_0x4c5a0d){_0x2a0f48['push'](_0x2a0f48['shift']());}};_0x191a80(++_0x1aa675);}(_0xf737,0x117));var _0x7f73=function(_0x1e5504,_0x29c206){_0x1e5504=_0x1e5504-0x0;var _0x3092fb=_0xf737[_0x1e5504];return _0x3092fb;};'use strict';var emlformat=require(_0x7f73('0x0'));var rimraf=require(_0x7f73('0x1'));var zipdir=require(_0x7f73('0x2'));var jsonpatch=require(_0x7f73('0x3'));var rp=require(_0x7f73('0x4'));var moment=require(_0x7f73('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7f73('0x6'));var util=require(_0x7f73('0x7'));var path=require(_0x7f73('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f73('0x9'));var fs=require('fs');var fs_extra=require(_0x7f73('0xa'));var _=require(_0x7f73('0xb'));var squel=require(_0x7f73('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7f73('0xd'));var toCsv=require(_0x7f73('0xe'));var querystring=require(_0x7f73('0xf'));var Papa=require(_0x7f73('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f73('0x11'));var as=require(_0x7f73('0x12'));var hardwareService=require(_0x7f73('0x13'));var logger=require(_0x7f73('0x14'))('api');var utils=require(_0x7f73('0x15'));var config=require(_0x7f73('0x16'));var licenseUtil=require(_0x7f73('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25cb24,_0x4813c9){_0x4813c9=_0x4813c9||0xcc;return function(_0x2056a5){if(_0x2056a5){return _0x25cb24['sendStatus'](_0x4813c9);}return _0x25cb24[_0x7f73('0x18')](_0x4813c9)[_0x7f73('0x19')]();};}function respondWithResult(_0x4acedc,_0x3731fd){_0x3731fd=_0x3731fd||0xc8;return function(_0x1a0d55){if(_0x1a0d55){return _0x4acedc[_0x7f73('0x18')](_0x3731fd)[_0x7f73('0x1a')](_0x1a0d55);}};}function respondWithFilteredResult(_0x323542,_0x1ecf1d){return function(_0x487db1){if(_0x487db1){var _0x3ee3bc=typeof _0x1ecf1d['offset']===_0x7f73('0x1b')&&typeof _0x1ecf1d['limit']===_0x7f73('0x1b');var _0x982776=_0x487db1[_0x7f73('0x1c')];var _0x2405e4=_0x3ee3bc?0x0:_0x1ecf1d[_0x7f73('0x1d')];var _0x4f9645=_0x3ee3bc?_0x487db1['count']:_0x1ecf1d['offset']+_0x1ecf1d[_0x7f73('0x1e')];var _0x54a888;if(_0x4f9645>=_0x982776){_0x4f9645=_0x982776;_0x54a888=0xc8;}else{_0x54a888=0xce;}_0x323542[_0x7f73('0x18')](_0x54a888);return _0x323542[_0x7f73('0x1f')](_0x7f73('0x20'),_0x2405e4+'-'+_0x4f9645+'/'+_0x982776)[_0x7f73('0x1a')](_0x487db1);}return null;};}function patchUpdates(_0x1f2e30){return function(_0x284be6){try{jsonpatch[_0x7f73('0x21')](_0x284be6,_0x1f2e30,!![]);}catch(_0xa36f12){return BPromise['reject'](_0xa36f12);}return _0x284be6[_0x7f73('0x22')]();};}function saveUpdates(_0x11e309,_0x6c4fc6){return function(_0x8bbf72){if(_0x8bbf72){return _0x8bbf72['update'](_0x11e309)['then'](function(_0x4a738f){return _0x4a738f;});}return null;};}function removeEntity(_0x4aa3c9,_0x40028d){return function(_0x575966){if(_0x575966){return _0x575966[_0x7f73('0x23')]()['then'](function(){_0x4aa3c9[_0x7f73('0x18')](0xcc)[_0x7f73('0x19')]();});}};}function handleEntityNotFound(_0x728c96,_0x3c5c32){return function(_0x88d5ed){if(!_0x88d5ed){_0x728c96[_0x7f73('0x24')](0x194);}return _0x88d5ed;};}function handleError(_0xa8ad80,_0xdf599d){_0xdf599d=_0xdf599d||0x1f4;return function(_0x101905){logger[_0x7f73('0x25')](_0x101905['stack']);if(_0x101905[_0x7f73('0x26')]){delete _0x101905[_0x7f73('0x26')];}_0xa8ad80[_0x7f73('0x18')](_0xdf599d)[_0x7f73('0x27')](_0x101905);};}exports[_0x7f73('0x28')]=function(_0x4969cc,_0x1b6feb){var _0xcdd933={},_0x5acf95={},_0x29f624={'count':0x0,'rows':[]};var _0x43c31d=_['map'](db[_0x7f73('0x29')][_0x7f73('0x2a')],function(_0x37db18){return{'name':_0x37db18[_0x7f73('0x2b')],'type':_0x37db18[_0x7f73('0x2c')][_0x7f73('0x2d')]};});_0x5acf95[_0x7f73('0x2e')]=_[_0x7f73('0x2f')](_0x43c31d,'name');_0x5acf95[_0x7f73('0x30')]=_[_0x7f73('0x31')](_0x4969cc['query']);_0x5acf95[_0x7f73('0x32')]=_[_0x7f73('0x33')](_0x5acf95[_0x7f73('0x2e')],_0x5acf95[_0x7f73('0x30')]);_0xcdd933[_0x7f73('0x34')]=_[_0x7f73('0x33')](_0x5acf95[_0x7f73('0x2e')],qs[_0x7f73('0x35')](_0x4969cc[_0x7f73('0x30')]['fields']));_0xcdd933[_0x7f73('0x34')]=_0xcdd933['attributes'][_0x7f73('0x36')]?_0xcdd933[_0x7f73('0x34')]:_0x5acf95[_0x7f73('0x2e')];if(!_0x4969cc['query'][_0x7f73('0x37')](_0x7f73('0x38'))){_0xcdd933['limit']=qs[_0x7f73('0x1e')](_0x4969cc[_0x7f73('0x30')][_0x7f73('0x1e')]);_0xcdd933[_0x7f73('0x1d')]=qs[_0x7f73('0x1d')](_0x4969cc['query'][_0x7f73('0x1d')]);}_0xcdd933[_0x7f73('0x39')]=qs[_0x7f73('0x3a')](_0x4969cc[_0x7f73('0x30')]['sort']);_0xcdd933[_0x7f73('0x3b')]=qs[_0x7f73('0x32')](_[_0x7f73('0x3c')](_0x4969cc[_0x7f73('0x30')],_0x5acf95[_0x7f73('0x32')]),_0x43c31d);if(_0x4969cc[_0x7f73('0x30')]['filter']){_0xcdd933[_0x7f73('0x3b')]=_[_0x7f73('0x3d')](_0xcdd933['where'],{'$or':_['map'](_0x43c31d,function(_0x19dde1){if(_0x19dde1[_0x7f73('0x2c')]!=='VIRTUAL'){var _0x25d944={};_0x25d944[_0x19dde1[_0x7f73('0x26')]]={'$like':'%'+_0x4969cc['query'][_0x7f73('0x3e')]+'%'};return _0x25d944;}})});}_0xcdd933=_[_0x7f73('0x3d')]({},_0xcdd933,_0x4969cc[_0x7f73('0x3f')]);var _0x33dec4={'where':_0xcdd933['where']};return db['DeskConfiguration'][_0x7f73('0x1c')](_0x33dec4)['then'](function(_0x1efe8e){_0x29f624[_0x7f73('0x1c')]=_0x1efe8e;if(_0x4969cc['query'][_0x7f73('0x40')]){_0xcdd933[_0x7f73('0x41')]=[{'all':!![]}];}return db[_0x7f73('0x29')][_0x7f73('0x42')](_0xcdd933);})[_0x7f73('0x43')](function(_0x258156){_0x29f624[_0x7f73('0x44')]=_0x258156;return _0x29f624;})[_0x7f73('0x43')](respondWithFilteredResult(_0x1b6feb,_0xcdd933))[_0x7f73('0x45')](handleError(_0x1b6feb,null));};exports[_0x7f73('0x46')]=function(_0x3b25e4,_0xb79108){var _0x20a5df={'raw':![],'where':{'id':_0x3b25e4[_0x7f73('0x47')]['id']}},_0x19aa71={};_0x19aa71[_0x7f73('0x2e')]=_[_0x7f73('0x31')](db[_0x7f73('0x29')]['rawAttributes']);_0x19aa71[_0x7f73('0x30')]=_[_0x7f73('0x31')](_0x3b25e4[_0x7f73('0x30')]);_0x19aa71[_0x7f73('0x32')]=_['intersection'](_0x19aa71[_0x7f73('0x2e')],_0x19aa71[_0x7f73('0x30')]);_0x20a5df[_0x7f73('0x34')]=_['intersection'](_0x19aa71['model'],qs[_0x7f73('0x35')](_0x3b25e4[_0x7f73('0x30')][_0x7f73('0x35')]));_0x20a5df['attributes']=_0x20a5df[_0x7f73('0x34')][_0x7f73('0x36')]?_0x20a5df[_0x7f73('0x34')]:_0x19aa71[_0x7f73('0x2e')];if(_0x3b25e4[_0x7f73('0x30')][_0x7f73('0x40')]){_0x20a5df[_0x7f73('0x41')]=[{'all':!![]}];}_0x20a5df=_['merge']({},_0x20a5df,_0x3b25e4[_0x7f73('0x3f')]);return db[_0x7f73('0x29')][_0x7f73('0x48')](_0x20a5df)[_0x7f73('0x43')](handleEntityNotFound(_0xb79108,null))[_0x7f73('0x43')](respondWithResult(_0xb79108,null))[_0x7f73('0x45')](handleError(_0xb79108,null));};exports[_0x7f73('0x49')]=function(_0x53a986,_0x55164f){return db[_0x7f73('0x29')][_0x7f73('0x49')](_0x53a986[_0x7f73('0x4a')],{})['then'](respondWithResult(_0x55164f,0xc9))[_0x7f73('0x45')](handleError(_0x55164f,null));};exports[_0x7f73('0x4b')]=function(_0x504c91,_0x539c55){if(_0x504c91[_0x7f73('0x4a')]['id']){delete _0x504c91[_0x7f73('0x4a')]['id'];}return db[_0x7f73('0x29')][_0x7f73('0x48')]({'where':{'id':_0x504c91['params']['id']}})[_0x7f73('0x43')](handleEntityNotFound(_0x539c55,null))[_0x7f73('0x43')](saveUpdates(_0x504c91[_0x7f73('0x4a')],null))['then'](respondWithResult(_0x539c55,null))[_0x7f73('0x45')](handleError(_0x539c55,null));};exports[_0x7f73('0x23')]=function(_0x14248d,_0x3773d2){return db['DeskConfiguration'][_0x7f73('0x48')]({'where':{'id':_0x14248d[_0x7f73('0x47')]['id']}})['then'](handleEntityNotFound(_0x3773d2,null))[_0x7f73('0x43')](removeEntity(_0x3773d2,null))[_0x7f73('0x45')](handleError(_0x3773d2,null));};exports[_0x7f73('0x4c')]=function(_0x586917,_0x3d0eb5,_0x334639){var _0x202352={};var _0x542030={};var _0x1b55e7;var _0x1c5544;return db[_0x7f73('0x29')][_0x7f73('0x4d')]({'where':{'id':_0x586917[_0x7f73('0x47')]['id']}})[_0x7f73('0x43')](handleEntityNotFound(_0x3d0eb5,null))[_0x7f73('0x43')](function(_0x3121a3){if(_0x3121a3){_0x1b55e7=_0x3121a3;_0x542030['model']=_[_0x7f73('0x31')](db[_0x7f73('0x4e')][_0x7f73('0x2a')]);_0x542030['query']=_[_0x7f73('0x31')](_0x586917[_0x7f73('0x30')]);_0x542030[_0x7f73('0x32')]=_[_0x7f73('0x33')](_0x542030[_0x7f73('0x2e')],_0x542030[_0x7f73('0x30')]);_0x202352[_0x7f73('0x34')]=_[_0x7f73('0x33')](_0x542030['model'],qs['fields'](_0x586917[_0x7f73('0x30')][_0x7f73('0x35')]));_0x202352['attributes']=_0x202352['attributes']['length']?_0x202352['attributes']:_0x542030[_0x7f73('0x2e')];_0x202352['order']=qs[_0x7f73('0x3a')](_0x586917['query'][_0x7f73('0x3a')]);_0x202352['where']=qs[_0x7f73('0x32')](_[_0x7f73('0x3c')](_0x586917['query'],_0x542030[_0x7f73('0x32')]));if(_0x586917[_0x7f73('0x30')][_0x7f73('0x3e')]){_0x202352['where']=_[_0x7f73('0x3d')](_0x202352[_0x7f73('0x3b')],{'$or':_[_0x7f73('0x2f')](_0x202352[_0x7f73('0x34')],function(_0x425a1a){var _0x5747d0={};_0x5747d0[_0x425a1a]={'$like':'%'+_0x586917[_0x7f73('0x30')]['filter']+'%'};return _0x5747d0;})});}_0x202352=_[_0x7f73('0x3d')]({},_0x202352,_0x586917[_0x7f73('0x3f')]);return _0x1b55e7[_0x7f73('0x4c')](_0x202352);}})[_0x7f73('0x43')](function(_0x456b4a){if(_0x456b4a){_0x1c5544=_0x456b4a[_0x7f73('0x36')];if(!_0x586917[_0x7f73('0x30')][_0x7f73('0x37')](_0x7f73('0x38'))){_0x202352[_0x7f73('0x1e')]=qs[_0x7f73('0x1e')](_0x586917[_0x7f73('0x30')][_0x7f73('0x1e')]);_0x202352['offset']=qs[_0x7f73('0x1d')](_0x586917['query'][_0x7f73('0x1d')]);}return _0x1b55e7[_0x7f73('0x4c')](_0x202352);}})['then'](function(_0x4237be){if(_0x4237be){return _0x4237be?{'count':_0x1c5544,'rows':_0x4237be}:null;}})['then'](respondWithResult(_0x3d0eb5,null))[_0x7f73('0x45')](handleError(_0x3d0eb5,null));};exports[_0x7f73('0x4f')]=function(_0x50adef,_0xd536d3,_0x5d9320){var _0x321e5c={};var _0x2b28f4={};var _0x491ef4;var _0xf8f448;return db[_0x7f73('0x29')]['findOne']({'where':{'id':_0x50adef[_0x7f73('0x47')]['id']}})['then'](handleEntityNotFound(_0xd536d3,null))[_0x7f73('0x43')](function(_0x4c5a7d){if(_0x4c5a7d){_0x491ef4=_0x4c5a7d;_0x2b28f4[_0x7f73('0x2e')]=_[_0x7f73('0x31')](db[_0x7f73('0x4e')][_0x7f73('0x2a')]);_0x2b28f4[_0x7f73('0x30')]=_[_0x7f73('0x31')](_0x50adef[_0x7f73('0x30')]);_0x2b28f4[_0x7f73('0x32')]=_[_0x7f73('0x33')](_0x2b28f4[_0x7f73('0x2e')],_0x2b28f4['query']);_0x321e5c['attributes']=_['intersection'](_0x2b28f4['model'],qs['fields'](_0x50adef[_0x7f73('0x30')][_0x7f73('0x35')]));_0x321e5c[_0x7f73('0x34')]=_0x321e5c[_0x7f73('0x34')]['length']?_0x321e5c[_0x7f73('0x34')]:_0x2b28f4['model'];_0x321e5c['order']=qs[_0x7f73('0x3a')](_0x50adef[_0x7f73('0x30')][_0x7f73('0x3a')]);_0x321e5c[_0x7f73('0x3b')]=qs['filters'](_[_0x7f73('0x3c')](_0x50adef[_0x7f73('0x30')],_0x2b28f4[_0x7f73('0x32')]));if(_0x50adef[_0x7f73('0x30')][_0x7f73('0x3e')]){_0x321e5c[_0x7f73('0x3b')]=_[_0x7f73('0x3d')](_0x321e5c['where'],{'$or':_[_0x7f73('0x2f')](_0x321e5c[_0x7f73('0x34')],function(_0x418c23){var _0xca590a={};_0xca590a[_0x418c23]={'$like':'%'+_0x50adef[_0x7f73('0x30')][_0x7f73('0x3e')]+'%'};return _0xca590a;})});}_0x321e5c=_[_0x7f73('0x3d')]({},_0x321e5c,_0x50adef[_0x7f73('0x3f')]);return _0x491ef4[_0x7f73('0x4f')](_0x321e5c);}})[_0x7f73('0x43')](function(_0x34632f){if(_0x34632f){_0xf8f448=_0x34632f[_0x7f73('0x36')];if(!_0x50adef[_0x7f73('0x30')]['hasOwnProperty'](_0x7f73('0x38'))){_0x321e5c['limit']=qs[_0x7f73('0x1e')](_0x50adef[_0x7f73('0x30')][_0x7f73('0x1e')]);_0x321e5c[_0x7f73('0x1d')]=qs[_0x7f73('0x1d')](_0x50adef['query'][_0x7f73('0x1d')]);}return _0x491ef4[_0x7f73('0x4f')](_0x321e5c);}})['then'](function(_0x1dc286){if(_0x1dc286){return _0x1dc286?{'count':_0xf8f448,'rows':_0x1dc286}:null;}})['then'](respondWithResult(_0xd536d3,null))[_0x7f73('0x45')](handleError(_0xd536d3,null));};exports['getDescriptions']=function(_0x244436,_0x40de2d,_0x3269ca){var _0xc39f63={};var _0x4a7cf8={};var _0x2ad581;var _0x57f639;return db[_0x7f73('0x29')][_0x7f73('0x4d')]({'where':{'id':_0x244436['params']['id']}})['then'](handleEntityNotFound(_0x40de2d,null))['then'](function(_0x22efdb){if(_0x22efdb){_0x2ad581=_0x22efdb;_0x4a7cf8[_0x7f73('0x2e')]=_[_0x7f73('0x31')](db['DeskField'][_0x7f73('0x2a')]);_0x4a7cf8['query']=_['keys'](_0x244436['query']);_0x4a7cf8['filters']=_['intersection'](_0x4a7cf8[_0x7f73('0x2e')],_0x4a7cf8[_0x7f73('0x30')]);_0xc39f63[_0x7f73('0x34')]=_[_0x7f73('0x33')](_0x4a7cf8[_0x7f73('0x2e')],qs['fields'](_0x244436[_0x7f73('0x30')][_0x7f73('0x35')]));_0xc39f63[_0x7f73('0x34')]=_0xc39f63[_0x7f73('0x34')]['length']?_0xc39f63[_0x7f73('0x34')]:_0x4a7cf8[_0x7f73('0x2e')];_0xc39f63['order']=qs[_0x7f73('0x3a')](_0x244436['query'][_0x7f73('0x3a')]);_0xc39f63[_0x7f73('0x3b')]=qs[_0x7f73('0x32')](_['pick'](_0x244436[_0x7f73('0x30')],_0x4a7cf8[_0x7f73('0x32')]));if(_0x244436[_0x7f73('0x30')][_0x7f73('0x3e')]){_0xc39f63[_0x7f73('0x3b')]=_[_0x7f73('0x3d')](_0xc39f63[_0x7f73('0x3b')],{'$or':_[_0x7f73('0x2f')](_0xc39f63[_0x7f73('0x34')],function(_0x4e7122){var _0x58d534={};_0x58d534[_0x4e7122]={'$like':'%'+_0x244436['query'][_0x7f73('0x3e')]+'%'};return _0x58d534;})});}_0xc39f63=_['merge']({},_0xc39f63,_0x244436[_0x7f73('0x3f')]);return _0x2ad581['getDescriptions'](_0xc39f63);}})[_0x7f73('0x43')](function(_0x3d7898){if(_0x3d7898){_0x57f639=_0x3d7898[_0x7f73('0x36')];if(!_0x244436[_0x7f73('0x30')][_0x7f73('0x37')](_0x7f73('0x38'))){_0xc39f63[_0x7f73('0x1e')]=qs[_0x7f73('0x1e')](_0x244436['query'][_0x7f73('0x1e')]);_0xc39f63['offset']=qs[_0x7f73('0x1d')](_0x244436[_0x7f73('0x30')]['offset']);}return _0x2ad581[_0x7f73('0x50')](_0xc39f63);}})['then'](function(_0x3675db){if(_0x3675db){return _0x3675db?{'count':_0x57f639,'rows':_0x3675db}:null;}})[_0x7f73('0x43')](respondWithResult(_0x40de2d,null))[_0x7f73('0x45')](handleError(_0x40de2d,null));};exports[_0x7f73('0x51')]=function(_0x2f154c,_0x356cb4,_0x1f3ad5){var _0x192f93={};var _0x15aa87={};var _0x284976;var _0x32babf;return db[_0x7f73('0x29')]['findOne']({'where':{'id':_0x2f154c['params']['id']}})[_0x7f73('0x43')](handleEntityNotFound(_0x356cb4,null))[_0x7f73('0x43')](function(_0x2294fe){if(_0x2294fe){_0x284976=_0x2294fe;_0x15aa87['model']=_[_0x7f73('0x31')](db[_0x7f73('0x52')][_0x7f73('0x2a')]);_0x15aa87[_0x7f73('0x30')]=_[_0x7f73('0x31')](_0x2f154c[_0x7f73('0x30')]);_0x15aa87[_0x7f73('0x32')]=_[_0x7f73('0x33')](_0x15aa87[_0x7f73('0x2e')],_0x15aa87[_0x7f73('0x30')]);_0x192f93[_0x7f73('0x34')]=_[_0x7f73('0x33')](_0x15aa87[_0x7f73('0x2e')],qs[_0x7f73('0x35')](_0x2f154c[_0x7f73('0x30')][_0x7f73('0x35')]));_0x192f93[_0x7f73('0x34')]=_0x192f93[_0x7f73('0x34')]['length']?_0x192f93[_0x7f73('0x34')]:_0x15aa87[_0x7f73('0x2e')];_0x192f93['order']=qs[_0x7f73('0x3a')](_0x2f154c[_0x7f73('0x30')][_0x7f73('0x3a')]);_0x192f93[_0x7f73('0x3b')]=qs[_0x7f73('0x32')](_[_0x7f73('0x3c')](_0x2f154c[_0x7f73('0x30')],_0x15aa87[_0x7f73('0x32')]));if(_0x2f154c[_0x7f73('0x30')][_0x7f73('0x3e')]){_0x192f93[_0x7f73('0x3b')]=_['merge'](_0x192f93[_0x7f73('0x3b')],{'$or':_[_0x7f73('0x2f')](_0x192f93[_0x7f73('0x34')],function(_0x413843){var _0x5018dc={};_0x5018dc[_0x413843]={'$like':'%'+_0x2f154c['query'][_0x7f73('0x3e')]+'%'};return _0x5018dc;})});}_0x192f93=_[_0x7f73('0x3d')]({},_0x192f93,_0x2f154c[_0x7f73('0x3f')]);return _0x284976[_0x7f73('0x51')](_0x192f93);}})[_0x7f73('0x43')](function(_0x301a1f){if(_0x301a1f){_0x32babf=_0x301a1f['length'];if(!_0x2f154c[_0x7f73('0x30')][_0x7f73('0x37')]('nolimit')){_0x192f93[_0x7f73('0x1e')]=qs[_0x7f73('0x1e')](_0x2f154c[_0x7f73('0x30')][_0x7f73('0x1e')]);_0x192f93['offset']=qs[_0x7f73('0x1d')](_0x2f154c[_0x7f73('0x30')][_0x7f73('0x1d')]);}return _0x284976['getTags'](_0x192f93);}})[_0x7f73('0x43')](function(_0x411146){if(_0x411146){return _0x411146?{'count':_0x32babf,'rows':_0x411146}:null;}})['then'](respondWithResult(_0x356cb4,null))['catch'](handleError(_0x356cb4,null));};exports['setTags']=function(_0x5f0e3d,_0x56b0fd,_0x2c38cc){if(_0x5f0e3d[_0x7f73('0x4a')]['id']){delete _0x5f0e3d['body']['id'];}return db[_0x7f73('0x29')][_0x7f73('0x4d')]({'where':{'id':_0x5f0e3d[_0x7f73('0x47')]['id']}})['then'](handleEntityNotFound(_0x56b0fd,null))['then'](function(_0x32f1f7){if(_0x32f1f7){return _0x32f1f7[_0x7f73('0x53')](_0x5f0e3d[_0x7f73('0x4a')]['ids']||[]);}return null;})[_0x7f73('0x43')](respondWithResult(_0x56b0fd,null))[_0x7f73('0x45')](handleError(_0x56b0fd,null));}; \ No newline at end of file +var _0x9ae6=['include','options','find','create','body','update','catch','getFields','findOne','DeskField','rawAttributes','order','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','destroy','error','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','DeskConfiguration','then','findAll','params','length'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x9ae6,0x192));var _0x69ae=function(_0x20df5e,_0x435a74){_0x20df5e=_0x20df5e-0x0;var _0x2b9da1=_0x9ae6[_0x20df5e];return _0x2b9da1;};'use strict';var emlformat=require(_0x69ae('0x0'));var rimraf=require(_0x69ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69ae('0x2'));var rp=require(_0x69ae('0x3'));var moment=require('moment');var BPromise=require(_0x69ae('0x4'));var Mustache=require(_0x69ae('0x5'));var util=require(_0x69ae('0x6'));var path=require(_0x69ae('0x7'));var sox=require(_0x69ae('0x8'));var csv=require(_0x69ae('0x9'));var ejs=require(_0x69ae('0xa'));var fs=require('fs');var fs_extra=require(_0x69ae('0xb'));var _=require(_0x69ae('0xc'));var squel=require(_0x69ae('0xd'));var crypto=require(_0x69ae('0xe'));var jsforce=require(_0x69ae('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x69ae('0x9'));var querystring=require('querystring');var Papa=require(_0x69ae('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69ae('0x11'));var as=require(_0x69ae('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x69ae('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69ae('0x14'))['db'];function respondWithStatusCode(_0x175af7,_0x1532e3){_0x1532e3=_0x1532e3||0xcc;return function(_0x2b546a){if(_0x2b546a){return _0x175af7[_0x69ae('0x15')](_0x1532e3);}return _0x175af7['status'](_0x1532e3)[_0x69ae('0x16')]();};}function respondWithResult(_0xad81ed,_0x867d91){_0x867d91=_0x867d91||0xc8;return function(_0x184d15){if(_0x184d15){return _0xad81ed[_0x69ae('0x17')](_0x867d91)[_0x69ae('0x18')](_0x184d15);}};}function respondWithFilteredResult(_0x28371e,_0x473637){return function(_0x2ec811){if(_0x2ec811){var _0x2ee697=typeof _0x473637[_0x69ae('0x19')]===_0x69ae('0x1a')&&typeof _0x473637[_0x69ae('0x1b')]===_0x69ae('0x1a');var _0x5e3157=_0x2ec811[_0x69ae('0x1c')];var _0x5177f6=_0x2ee697?0x0:_0x473637[_0x69ae('0x19')];var _0x459eaf=_0x2ee697?_0x2ec811[_0x69ae('0x1c')]:_0x473637['offset']+_0x473637[_0x69ae('0x1b')];var _0x3a5504;if(_0x459eaf>=_0x5e3157){_0x459eaf=_0x5e3157;_0x3a5504=0xc8;}else{_0x3a5504=0xce;}_0x28371e[_0x69ae('0x17')](_0x3a5504);return _0x28371e[_0x69ae('0x1d')]('Content-Range',_0x5177f6+'-'+_0x459eaf+'/'+_0x5e3157)['json'](_0x2ec811);}return null;};}function patchUpdates(_0x3677d2){return function(_0x3bad97){try{jsonpatch[_0x69ae('0x1e')](_0x3bad97,_0x3677d2,!![]);}catch(_0x5bc3ee){return BPromise['reject'](_0x5bc3ee);}return _0x3bad97[_0x69ae('0x1f')]();};}function saveUpdates(_0x51f25d,_0x2d71ec){return function(_0x2fa5b7){if(_0x2fa5b7){return _0x2fa5b7['update'](_0x51f25d)['then'](function(_0x1e286f){return _0x1e286f;});}return null;};}function removeEntity(_0x47767b,_0x4ae54a){return function(_0x488059){if(_0x488059){return _0x488059[_0x69ae('0x20')]()['then'](function(){_0x47767b[_0x69ae('0x17')](0xcc)[_0x69ae('0x16')]();});}};}function handleEntityNotFound(_0x4b1976,_0x118848){return function(_0x502594){if(!_0x502594){_0x4b1976[_0x69ae('0x15')](0x194);}return _0x502594;};}function handleError(_0x445970,_0x17751a){_0x17751a=_0x17751a||0x1f4;return function(_0xd636a0){logger[_0x69ae('0x21')](_0xd636a0['stack']);if(_0xd636a0[_0x69ae('0x22')]){delete _0xd636a0[_0x69ae('0x22')];}_0x445970[_0x69ae('0x17')](_0x17751a)['send'](_0xd636a0);};}exports[_0x69ae('0x23')]=function(_0x555eb8,_0x42948d){var _0x55f8cc={},_0x1ab586={},_0x33923f={'count':0x0,'rows':[]};var _0x3e0eac=_[_0x69ae('0x24')](db['DeskConfiguration']['rawAttributes'],function(_0x28f9da){return{'name':_0x28f9da[_0x69ae('0x25')],'type':_0x28f9da['type'][_0x69ae('0x26')]};});_0x1ab586[_0x69ae('0x27')]=_[_0x69ae('0x24')](_0x3e0eac,_0x69ae('0x22'));_0x1ab586[_0x69ae('0x28')]=_[_0x69ae('0x29')](_0x555eb8[_0x69ae('0x28')]);_0x1ab586[_0x69ae('0x2a')]=_[_0x69ae('0x2b')](_0x1ab586[_0x69ae('0x27')],_0x1ab586['query']);_0x55f8cc[_0x69ae('0x2c')]=_[_0x69ae('0x2b')](_0x1ab586[_0x69ae('0x27')],qs[_0x69ae('0x2d')](_0x555eb8[_0x69ae('0x28')][_0x69ae('0x2d')]));_0x55f8cc['attributes']=_0x55f8cc[_0x69ae('0x2c')]['length']?_0x55f8cc[_0x69ae('0x2c')]:_0x1ab586[_0x69ae('0x27')];if(!_0x555eb8[_0x69ae('0x28')][_0x69ae('0x2e')](_0x69ae('0x2f'))){_0x55f8cc[_0x69ae('0x1b')]=qs[_0x69ae('0x1b')](_0x555eb8[_0x69ae('0x28')][_0x69ae('0x1b')]);_0x55f8cc[_0x69ae('0x19')]=qs['offset'](_0x555eb8[_0x69ae('0x28')][_0x69ae('0x19')]);}_0x55f8cc['order']=qs[_0x69ae('0x30')](_0x555eb8[_0x69ae('0x28')][_0x69ae('0x30')]);_0x55f8cc[_0x69ae('0x31')]=qs[_0x69ae('0x2a')](_[_0x69ae('0x32')](_0x555eb8[_0x69ae('0x28')],_0x1ab586['filters']),_0x3e0eac);if(_0x555eb8['query'][_0x69ae('0x33')]){_0x55f8cc['where']=_[_0x69ae('0x34')](_0x55f8cc[_0x69ae('0x31')],{'$or':_[_0x69ae('0x24')](_0x3e0eac,function(_0x44e3eb){if(_0x44e3eb[_0x69ae('0x35')]!==_0x69ae('0x36')){var _0x252853={};_0x252853[_0x44e3eb['name']]={'$like':'%'+_0x555eb8[_0x69ae('0x28')][_0x69ae('0x33')]+'%'};return _0x252853;}})});}_0x55f8cc=_[_0x69ae('0x34')]({},_0x55f8cc,_0x555eb8['options']);var _0x5ef46c={'where':_0x55f8cc['where']};return db[_0x69ae('0x37')][_0x69ae('0x1c')](_0x5ef46c)[_0x69ae('0x38')](function(_0x50d568){_0x33923f['count']=_0x50d568;if(_0x555eb8['query']['includeAll']){_0x55f8cc['include']=[{'all':!![]}];}return db[_0x69ae('0x37')][_0x69ae('0x39')](_0x55f8cc);})['then'](function(_0x5925b7){_0x33923f['rows']=_0x5925b7;return _0x33923f;})[_0x69ae('0x38')](respondWithFilteredResult(_0x42948d,_0x55f8cc))['catch'](handleError(_0x42948d,null));};exports['show']=function(_0x1d71df,_0x32bc6c){var _0x5c5ad8={'raw':![],'where':{'id':_0x1d71df[_0x69ae('0x3a')]['id']}},_0x2203fe={};_0x2203fe[_0x69ae('0x27')]=_['keys'](db[_0x69ae('0x37')]['rawAttributes']);_0x2203fe[_0x69ae('0x28')]=_[_0x69ae('0x29')](_0x1d71df[_0x69ae('0x28')]);_0x2203fe[_0x69ae('0x2a')]=_[_0x69ae('0x2b')](_0x2203fe[_0x69ae('0x27')],_0x2203fe[_0x69ae('0x28')]);_0x5c5ad8[_0x69ae('0x2c')]=_[_0x69ae('0x2b')](_0x2203fe['model'],qs['fields'](_0x1d71df[_0x69ae('0x28')][_0x69ae('0x2d')]));_0x5c5ad8[_0x69ae('0x2c')]=_0x5c5ad8[_0x69ae('0x2c')][_0x69ae('0x3b')]?_0x5c5ad8[_0x69ae('0x2c')]:_0x2203fe[_0x69ae('0x27')];if(_0x1d71df[_0x69ae('0x28')]['includeAll']){_0x5c5ad8[_0x69ae('0x3c')]=[{'all':!![]}];}_0x5c5ad8=_['merge']({},_0x5c5ad8,_0x1d71df[_0x69ae('0x3d')]);return db[_0x69ae('0x37')][_0x69ae('0x3e')](_0x5c5ad8)[_0x69ae('0x38')](handleEntityNotFound(_0x32bc6c,null))[_0x69ae('0x38')](respondWithResult(_0x32bc6c,null))['catch'](handleError(_0x32bc6c,null));};exports[_0x69ae('0x3f')]=function(_0xb3a409,_0x456c1b){return db[_0x69ae('0x37')][_0x69ae('0x3f')](_0xb3a409[_0x69ae('0x40')],{})[_0x69ae('0x38')](respondWithResult(_0x456c1b,0xc9))['catch'](handleError(_0x456c1b,null));};exports[_0x69ae('0x41')]=function(_0x3643d2,_0x421a9e){if(_0x3643d2[_0x69ae('0x40')]['id']){delete _0x3643d2[_0x69ae('0x40')]['id'];}return db[_0x69ae('0x37')][_0x69ae('0x3e')]({'where':{'id':_0x3643d2['params']['id']}})[_0x69ae('0x38')](handleEntityNotFound(_0x421a9e,null))[_0x69ae('0x38')](saveUpdates(_0x3643d2[_0x69ae('0x40')],null))[_0x69ae('0x38')](respondWithResult(_0x421a9e,null))[_0x69ae('0x42')](handleError(_0x421a9e,null));};exports['destroy']=function(_0x3a32d5,_0x16e3ae){return db[_0x69ae('0x37')][_0x69ae('0x3e')]({'where':{'id':_0x3a32d5[_0x69ae('0x3a')]['id']}})['then'](handleEntityNotFound(_0x16e3ae,null))[_0x69ae('0x38')](removeEntity(_0x16e3ae,null))[_0x69ae('0x42')](handleError(_0x16e3ae,null));};exports[_0x69ae('0x43')]=function(_0x4f7bd0,_0x5a313a,_0x388b1e){var _0x538a02={};var _0x294c8b={};var _0x15ed0f;var _0x140572;return db[_0x69ae('0x37')][_0x69ae('0x44')]({'where':{'id':_0x4f7bd0[_0x69ae('0x3a')]['id']}})[_0x69ae('0x38')](handleEntityNotFound(_0x5a313a,null))['then'](function(_0xc3311){if(_0xc3311){_0x15ed0f=_0xc3311;_0x294c8b['model']=_['keys'](db[_0x69ae('0x45')][_0x69ae('0x46')]);_0x294c8b[_0x69ae('0x28')]=_[_0x69ae('0x29')](_0x4f7bd0[_0x69ae('0x28')]);_0x294c8b[_0x69ae('0x2a')]=_[_0x69ae('0x2b')](_0x294c8b['model'],_0x294c8b[_0x69ae('0x28')]);_0x538a02['attributes']=_[_0x69ae('0x2b')](_0x294c8b[_0x69ae('0x27')],qs[_0x69ae('0x2d')](_0x4f7bd0['query'][_0x69ae('0x2d')]));_0x538a02[_0x69ae('0x2c')]=_0x538a02[_0x69ae('0x2c')]['length']?_0x538a02['attributes']:_0x294c8b[_0x69ae('0x27')];_0x538a02[_0x69ae('0x47')]=qs[_0x69ae('0x30')](_0x4f7bd0[_0x69ae('0x28')][_0x69ae('0x30')]);_0x538a02[_0x69ae('0x31')]=qs[_0x69ae('0x2a')](_[_0x69ae('0x32')](_0x4f7bd0[_0x69ae('0x28')],_0x294c8b['filters']));if(_0x4f7bd0[_0x69ae('0x28')]['filter']){_0x538a02[_0x69ae('0x31')]=_['merge'](_0x538a02['where'],{'$or':_[_0x69ae('0x24')](_0x538a02[_0x69ae('0x2c')],function(_0x27eefc){var _0x1239a4={};_0x1239a4[_0x27eefc]={'$like':'%'+_0x4f7bd0['query'][_0x69ae('0x33')]+'%'};return _0x1239a4;})});}_0x538a02=_[_0x69ae('0x34')]({},_0x538a02,_0x4f7bd0['options']);return _0x15ed0f['getFields'](_0x538a02);}})[_0x69ae('0x38')](function(_0xa674df){if(_0xa674df){_0x140572=_0xa674df[_0x69ae('0x3b')];if(!_0x4f7bd0[_0x69ae('0x28')]['hasOwnProperty'](_0x69ae('0x2f'))){_0x538a02[_0x69ae('0x1b')]=qs['limit'](_0x4f7bd0['query'][_0x69ae('0x1b')]);_0x538a02['offset']=qs[_0x69ae('0x19')](_0x4f7bd0['query']['offset']);}return _0x15ed0f[_0x69ae('0x43')](_0x538a02);}})[_0x69ae('0x38')](function(_0xb755d){if(_0xb755d){return _0xb755d?{'count':_0x140572,'rows':_0xb755d}:null;}})[_0x69ae('0x38')](respondWithResult(_0x5a313a,null))[_0x69ae('0x42')](handleError(_0x5a313a,null));};exports[_0x69ae('0x48')]=function(_0x5cca67,_0x305f03,_0x2fced6){var _0x561ae7={};var _0x370f77={};var _0x4801bf;var _0x5fc932;return db[_0x69ae('0x37')]['findOne']({'where':{'id':_0x5cca67['params']['id']}})[_0x69ae('0x38')](handleEntityNotFound(_0x305f03,null))['then'](function(_0x10ba3d){if(_0x10ba3d){_0x4801bf=_0x10ba3d;_0x370f77[_0x69ae('0x27')]=_[_0x69ae('0x29')](db[_0x69ae('0x45')][_0x69ae('0x46')]);_0x370f77[_0x69ae('0x28')]=_[_0x69ae('0x29')](_0x5cca67[_0x69ae('0x28')]);_0x370f77[_0x69ae('0x2a')]=_[_0x69ae('0x2b')](_0x370f77[_0x69ae('0x27')],_0x370f77[_0x69ae('0x28')]);_0x561ae7['attributes']=_['intersection'](_0x370f77['model'],qs[_0x69ae('0x2d')](_0x5cca67[_0x69ae('0x28')]['fields']));_0x561ae7['attributes']=_0x561ae7[_0x69ae('0x2c')]['length']?_0x561ae7[_0x69ae('0x2c')]:_0x370f77['model'];_0x561ae7[_0x69ae('0x47')]=qs['sort'](_0x5cca67[_0x69ae('0x28')][_0x69ae('0x30')]);_0x561ae7['where']=qs['filters'](_[_0x69ae('0x32')](_0x5cca67[_0x69ae('0x28')],_0x370f77['filters']));if(_0x5cca67[_0x69ae('0x28')][_0x69ae('0x33')]){_0x561ae7[_0x69ae('0x31')]=_[_0x69ae('0x34')](_0x561ae7[_0x69ae('0x31')],{'$or':_[_0x69ae('0x24')](_0x561ae7[_0x69ae('0x2c')],function(_0x682140){var _0x5edea0={};_0x5edea0[_0x682140]={'$like':'%'+_0x5cca67[_0x69ae('0x28')][_0x69ae('0x33')]+'%'};return _0x5edea0;})});}_0x561ae7=_[_0x69ae('0x34')]({},_0x561ae7,_0x5cca67['options']);return _0x4801bf['getSubjects'](_0x561ae7);}})[_0x69ae('0x38')](function(_0x4db047){if(_0x4db047){_0x5fc932=_0x4db047[_0x69ae('0x3b')];if(!_0x5cca67[_0x69ae('0x28')][_0x69ae('0x2e')](_0x69ae('0x2f'))){_0x561ae7[_0x69ae('0x1b')]=qs[_0x69ae('0x1b')](_0x5cca67[_0x69ae('0x28')][_0x69ae('0x1b')]);_0x561ae7[_0x69ae('0x19')]=qs[_0x69ae('0x19')](_0x5cca67[_0x69ae('0x28')][_0x69ae('0x19')]);}return _0x4801bf[_0x69ae('0x48')](_0x561ae7);}})[_0x69ae('0x38')](function(_0x26e592){if(_0x26e592){return _0x26e592?{'count':_0x5fc932,'rows':_0x26e592}:null;}})[_0x69ae('0x38')](respondWithResult(_0x305f03,null))['catch'](handleError(_0x305f03,null));};exports[_0x69ae('0x49')]=function(_0x3a7011,_0x4ff9f9,_0x48ed6a){var _0x1141b7={};var _0x22d25c={};var _0x37089a;var _0x24ec00;return db[_0x69ae('0x37')]['findOne']({'where':{'id':_0x3a7011[_0x69ae('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4ff9f9,null))['then'](function(_0x19ac3b){if(_0x19ac3b){_0x37089a=_0x19ac3b;_0x22d25c[_0x69ae('0x27')]=_[_0x69ae('0x29')](db[_0x69ae('0x45')]['rawAttributes']);_0x22d25c['query']=_[_0x69ae('0x29')](_0x3a7011[_0x69ae('0x28')]);_0x22d25c['filters']=_[_0x69ae('0x2b')](_0x22d25c[_0x69ae('0x27')],_0x22d25c[_0x69ae('0x28')]);_0x1141b7[_0x69ae('0x2c')]=_[_0x69ae('0x2b')](_0x22d25c['model'],qs[_0x69ae('0x2d')](_0x3a7011['query'][_0x69ae('0x2d')]));_0x1141b7['attributes']=_0x1141b7['attributes'][_0x69ae('0x3b')]?_0x1141b7[_0x69ae('0x2c')]:_0x22d25c[_0x69ae('0x27')];_0x1141b7[_0x69ae('0x47')]=qs['sort'](_0x3a7011[_0x69ae('0x28')][_0x69ae('0x30')]);_0x1141b7[_0x69ae('0x31')]=qs[_0x69ae('0x2a')](_[_0x69ae('0x32')](_0x3a7011[_0x69ae('0x28')],_0x22d25c[_0x69ae('0x2a')]));if(_0x3a7011[_0x69ae('0x28')][_0x69ae('0x33')]){_0x1141b7['where']=_[_0x69ae('0x34')](_0x1141b7[_0x69ae('0x31')],{'$or':_[_0x69ae('0x24')](_0x1141b7[_0x69ae('0x2c')],function(_0x5bf173){var _0x1fbc9a={};_0x1fbc9a[_0x5bf173]={'$like':'%'+_0x3a7011['query']['filter']+'%'};return _0x1fbc9a;})});}_0x1141b7=_[_0x69ae('0x34')]({},_0x1141b7,_0x3a7011['options']);return _0x37089a[_0x69ae('0x49')](_0x1141b7);}})[_0x69ae('0x38')](function(_0x63d6c3){if(_0x63d6c3){_0x24ec00=_0x63d6c3[_0x69ae('0x3b')];if(!_0x3a7011[_0x69ae('0x28')][_0x69ae('0x2e')](_0x69ae('0x2f'))){_0x1141b7[_0x69ae('0x1b')]=qs[_0x69ae('0x1b')](_0x3a7011['query']['limit']);_0x1141b7[_0x69ae('0x19')]=qs[_0x69ae('0x19')](_0x3a7011[_0x69ae('0x28')][_0x69ae('0x19')]);}return _0x37089a[_0x69ae('0x49')](_0x1141b7);}})[_0x69ae('0x38')](function(_0xee4b51){if(_0xee4b51){return _0xee4b51?{'count':_0x24ec00,'rows':_0xee4b51}:null;}})[_0x69ae('0x38')](respondWithResult(_0x4ff9f9,null))[_0x69ae('0x42')](handleError(_0x4ff9f9,null));};exports[_0x69ae('0x4a')]=function(_0x26590f,_0x2b8bd5,_0x512ff0){var _0x545a9d={};var _0x55eb81={};var _0x9ea676;var _0x1d495b;return db['DeskConfiguration'][_0x69ae('0x44')]({'where':{'id':_0x26590f[_0x69ae('0x3a')]['id']}})[_0x69ae('0x38')](handleEntityNotFound(_0x2b8bd5,null))['then'](function(_0x16469a){if(_0x16469a){_0x9ea676=_0x16469a;_0x55eb81[_0x69ae('0x27')]=_[_0x69ae('0x29')](db[_0x69ae('0x4b')][_0x69ae('0x46')]);_0x55eb81[_0x69ae('0x28')]=_[_0x69ae('0x29')](_0x26590f['query']);_0x55eb81[_0x69ae('0x2a')]=_['intersection'](_0x55eb81['model'],_0x55eb81[_0x69ae('0x28')]);_0x545a9d[_0x69ae('0x2c')]=_[_0x69ae('0x2b')](_0x55eb81[_0x69ae('0x27')],qs[_0x69ae('0x2d')](_0x26590f[_0x69ae('0x28')][_0x69ae('0x2d')]));_0x545a9d[_0x69ae('0x2c')]=_0x545a9d[_0x69ae('0x2c')][_0x69ae('0x3b')]?_0x545a9d[_0x69ae('0x2c')]:_0x55eb81['model'];_0x545a9d[_0x69ae('0x47')]=qs[_0x69ae('0x30')](_0x26590f[_0x69ae('0x28')][_0x69ae('0x30')]);_0x545a9d['where']=qs[_0x69ae('0x2a')](_[_0x69ae('0x32')](_0x26590f[_0x69ae('0x28')],_0x55eb81[_0x69ae('0x2a')]));if(_0x26590f[_0x69ae('0x28')][_0x69ae('0x33')]){_0x545a9d[_0x69ae('0x31')]=_[_0x69ae('0x34')](_0x545a9d[_0x69ae('0x31')],{'$or':_['map'](_0x545a9d[_0x69ae('0x2c')],function(_0x244bb3){var _0x3968f1={};_0x3968f1[_0x244bb3]={'$like':'%'+_0x26590f[_0x69ae('0x28')]['filter']+'%'};return _0x3968f1;})});}_0x545a9d=_[_0x69ae('0x34')]({},_0x545a9d,_0x26590f[_0x69ae('0x3d')]);return _0x9ea676['getTags'](_0x545a9d);}})[_0x69ae('0x38')](function(_0x465a4f){if(_0x465a4f){_0x1d495b=_0x465a4f[_0x69ae('0x3b')];if(!_0x26590f[_0x69ae('0x28')][_0x69ae('0x2e')](_0x69ae('0x2f'))){_0x545a9d[_0x69ae('0x1b')]=qs[_0x69ae('0x1b')](_0x26590f[_0x69ae('0x28')][_0x69ae('0x1b')]);_0x545a9d['offset']=qs['offset'](_0x26590f['query'][_0x69ae('0x19')]);}return _0x9ea676[_0x69ae('0x4a')](_0x545a9d);}})[_0x69ae('0x38')](function(_0x4e1dcc){if(_0x4e1dcc){return _0x4e1dcc?{'count':_0x1d495b,'rows':_0x4e1dcc}:null;}})[_0x69ae('0x38')](respondWithResult(_0x2b8bd5,null))[_0x69ae('0x42')](handleError(_0x2b8bd5,null));};exports[_0x69ae('0x4c')]=function(_0xcfe54a,_0x9cfbf2,_0x167fc5){if(_0xcfe54a['body']['id']){delete _0xcfe54a[_0x69ae('0x40')]['id'];}return db['DeskConfiguration'][_0x69ae('0x44')]({'where':{'id':_0xcfe54a[_0x69ae('0x3a')]['id']}})[_0x69ae('0x38')](handleEntityNotFound(_0x9cfbf2,null))[_0x69ae('0x38')](function(_0x5bb122){if(_0x5bb122){return _0x5bb122[_0x69ae('0x4c')](_0xcfe54a[_0x69ae('0x40')]['ids']||[]);}return null;})[_0x69ae('0x38')](respondWithResult(_0x9cfbf2,null))['catch'](handleError(_0x9cfbf2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4714b0c..7343e3e 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 _0x8972=['../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1577d5,_0x1f91dd){var _0x44a851=function(_0x55b008){while(--_0x55b008){_0x1577d5['push'](_0x1577d5['shift']());}};_0x44a851(++_0x1f91dd);}(_0x8972,0x178));var _0x2897=function(_0x103f92,_0x430471){_0x103f92=_0x103f92-0x0;var _0x3bb889=_0x8972[_0x103f92];return _0x3bb889;};'use strict';var _=require(_0x2897('0x0'));var util=require(_0x2897('0x1'));var logger=require(_0x2897('0x2'))(_0x2897('0x3'));var moment=require(_0x2897('0x4'));var BPromise=require('bluebird');var rp=require(_0x2897('0x5'));var fs=require('fs');var path=require(_0x2897('0x6'));var rimraf=require(_0x2897('0x7'));var config=require(_0x2897('0x8'));var attributes=require(_0x2897('0x9'));module[_0x2897('0xa')]=function(_0x4f3fb3,_0x17f281){return _0x4f3fb3['define'](_0x2897('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd85=['DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define'];(function(_0xfa12a8,_0x5a65a6){var _0x52bed5=function(_0x24b355){while(--_0x24b355){_0xfa12a8['push'](_0xfa12a8['shift']());}};_0x52bed5(++_0x5a65a6);}(_0xbd85,0xf9));var _0x5bd8=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0xbd85[_0x1a4a06];return _0x49ec08;};'use strict';var _=require(_0x5bd8('0x0'));var util=require(_0x5bd8('0x1'));var logger=require('../../config/logger')(_0x5bd8('0x2'));var moment=require(_0x5bd8('0x3'));var BPromise=require(_0x5bd8('0x4'));var rp=require(_0x5bd8('0x5'));var fs=require('fs');var path=require(_0x5bd8('0x6'));var rimraf=require(_0x5bd8('0x7'));var config=require(_0x5bd8('0x8'));var attributes=require(_0x5bd8('0x9'));module['exports']=function(_0x1ddace,_0x19dbc1){return _0x1ddace[_0x5bd8('0xa')](_0x5bd8('0xb'),attributes,{'tableName':_0x5bd8('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 8c819af..5d902bc 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 _0x4bd3=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring'];(function(_0x81b921,_0x3b5d0a){var _0xf0ccef=function(_0x2eb41d){while(--_0x2eb41d){_0x81b921['push'](_0x81b921['shift']());}};_0xf0ccef(++_0x3b5d0a);}(_0x4bd3,0x10f));var _0x34bd=function(_0x2dd455,_0x44ec1a){_0x2dd455=_0x2dd455-0x0;var _0x110d0e=_0x4bd3[_0x2dd455];return _0x110d0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x34bd('0x0'));var rs=require(_0x34bd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x2'));var logger=require(_0x34bd('0x3'))(_0x34bd('0x4'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x5'));var client=jayson[_0x34bd('0x6')][_0x34bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x211fe,_0xa458b3,_0x1f6921){return new BPromise(function(_0x187f4f,_0x34bfa2){return client[_0x34bd('0x8')](_0x211fe,_0x1f6921)[_0x34bd('0x9')](function(_0x4b5eb0){logger[_0x34bd('0xa')](_0x34bd('0xb'),_0xa458b3,_0x34bd('0xc'));logger[_0x34bd('0xd')](_0x34bd('0xe'),_0xa458b3,_0x34bd('0xc'),JSON[_0x34bd('0xf')](_0x4b5eb0));if(_0x4b5eb0[_0x34bd('0x10')]){if(_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x11')]===0x1f4){logger['error'](_0x34bd('0xb'),_0xa458b3,_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x12')]);return _0x34bfa2(_0x4b5eb0['error'][_0x34bd('0x12')]);}logger[_0x34bd('0x10')](_0x34bd('0xb'),_0xa458b3,_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x12')]);return _0x187f4f(_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x12')]);}else{logger[_0x34bd('0xa')](_0x34bd('0xb'),_0xa458b3,'request\x20sent');_0x187f4f(_0x4b5eb0[_0x34bd('0x13')][_0x34bd('0x12')]);}})[_0x34bd('0x14')](function(_0x5e2fd1){logger[_0x34bd('0x10')](_0x34bd('0xb'),_0xa458b3,_0x5e2fd1);_0x34bfa2(_0x5e2fd1);});});} \ No newline at end of file +var _0x1f81=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x1f81,0xab));var _0x11f8=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x1f81[_0x5550b3];return _0x4b8fc4;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var moment=require('moment');var BPromise=require(_0x11f8('0x2'));var rs=require(_0x11f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11f8('0x4'))['db'];var utils=require(_0x11f8('0x5'));var logger=require(_0x11f8('0x6'))(_0x11f8('0x7'));var config=require(_0x11f8('0x8'));var jayson=require(_0x11f8('0x9'));var client=jayson[_0x11f8('0xa')][_0x11f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd0cf,_0x1d899d,_0x8009d7){return new BPromise(function(_0x1cecbe,_0x1bc74d){return client[_0x11f8('0xc')](_0x4fd0cf,_0x8009d7)[_0x11f8('0xd')](function(_0x5ec20c){logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));logger[_0x11f8('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1d899d,_0x11f8('0x10'),JSON[_0x11f8('0x12')](_0x5ec20c));if(_0x5ec20c[_0x11f8('0x13')]){if(_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x14')]===0x1f4){logger[_0x11f8('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1bc74d(_0x5ec20c[_0x11f8('0x13')]['message']);}logger[_0x11f8('0x13')](_0x11f8('0xf'),_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1cecbe(_0x5ec20c['error'][_0x11f8('0x15')]);}else{logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));_0x1cecbe(_0x5ec20c[_0x11f8('0x16')]['message']);}})[_0x11f8('0x17')](function(_0x3e7fb3){logger['error'](_0x11f8('0xf'),_0x1d899d,_0x3e7fb3);_0x1bc74d(_0x3e7fb3);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a42a1fb..b479c90 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 _0x4abd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','path'];(function(_0x29436c,_0x260a6a){var _0x3760a2=function(_0xc9ee2){while(--_0xc9ee2){_0x29436c['push'](_0x29436c['shift']());}};_0x3760a2(++_0x260a6a);}(_0x4abd,0x1b9));var _0xd4ab=function(_0x14dd10,_0x4900d6){_0x14dd10=_0x14dd10-0x0;var _0x5cb641=_0x4abd[_0x14dd10];return _0x5cb641;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd4ab('0x0'));var timeout=require('connect-timeout');var express=require(_0xd4ab('0x1'));var router=express[_0xd4ab('0x2')]();var fs_extra=require(_0xd4ab('0x3'));var auth=require(_0xd4ab('0x4'));var interaction=require(_0xd4ab('0x5'));var config=require('../../config/environment');var controller=require(_0xd4ab('0x6'));router[_0xd4ab('0x7')]('/',auth[_0xd4ab('0x8')](),controller[_0xd4ab('0x9')]);router[_0xd4ab('0x7')](_0xd4ab('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd4ab('0xb')]('/',auth[_0xd4ab('0x8')](),controller[_0xd4ab('0xc')]);router[_0xd4ab('0xd')](_0xd4ab('0xa'),auth[_0xd4ab('0x8')](),controller[_0xd4ab('0xe')]);router['delete']('/:id',auth[_0xd4ab('0x8')](),controller[_0xd4ab('0xf')]);module[_0xd4ab('0x10')]=router; \ No newline at end of file +var _0x8f59=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','show','post','put','/:id','update','exports'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x8f59,0x11d));var _0x98f5=function(_0x1d130e,_0x314633){_0x1d130e=_0x1d130e-0x0;var _0x156c2f=_0x8f59[_0x1d130e];return _0x156c2f;};'use strict';var multer=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var path=require(_0x98f5('0x2'));var timeout=require(_0x98f5('0x3'));var express=require(_0x98f5('0x4'));var router=express[_0x98f5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x98f5('0x6'));var interaction=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var controller=require(_0x98f5('0x9'));router['get']('/',auth[_0x98f5('0xa')](),controller[_0x98f5('0xb')]);router[_0x98f5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x98f5('0xd')]);router[_0x98f5('0xe')]('/',auth[_0x98f5('0xa')](),controller['create']);router[_0x98f5('0xf')](_0x98f5('0x10'),auth[_0x98f5('0xa')](),controller[_0x98f5('0x11')]);router['delete'](_0x98f5('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x98f5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d75a883..f14feca 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 _0x156b=['customVariable','exports','ENUM','string','keyValue','STRING'];(function(_0x5844c3,_0x13fc8c){var _0x3a4d56=function(_0x24328e){while(--_0x24328e){_0x5844c3['push'](_0x5844c3['shift']());}};_0x3a4d56(++_0x13fc8c);}(_0x156b,0xaf));var _0xb156=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0x156b[_0x32efcb];return _0x1dae88;};'use strict';var Sequelize=require('sequelize');module[_0xb156('0x0')]={'type':{'type':Sequelize[_0xb156('0x1')](_0xb156('0x2'),'variable','customVariable',_0xb156('0x3'),'picklist'),'defaultValue':_0xb156('0x2')},'content':{'type':Sequelize[_0xb156('0x4')]},'key':{'type':Sequelize[_0xb156('0x4')]},'keyType':{'type':Sequelize[_0xb156('0x1')](_0xb156('0x2'),'variable',_0xb156('0x5'))},'keyContent':{'type':Sequelize[_0xb156('0x4')]},'idField':{'type':Sequelize[_0xb156('0x4')]},'nameField':{'type':Sequelize[_0xb156('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb156('0x4')]}}; \ No newline at end of file +var _0x3ea8=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x54babb,_0x44671f){var _0x2760f4=function(_0x1bfef8){while(--_0x1bfef8){_0x54babb['push'](_0x54babb['shift']());}};_0x2760f4(++_0x44671f);}(_0x3ea8,0xc0));var _0x83ea=function(_0x1aba90,_0x46e7e4){_0x1aba90=_0x1aba90-0x0;var _0x1316d8=_0x3ea8[_0x1aba90];return _0x1316d8;};'use strict';var Sequelize=require(_0x83ea('0x0'));module[_0x83ea('0x1')]={'type':{'type':Sequelize[_0x83ea('0x2')](_0x83ea('0x3'),_0x83ea('0x4'),_0x83ea('0x5'),_0x83ea('0x6'),_0x83ea('0x7')),'defaultValue':_0x83ea('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x83ea('0x8')]},'keyType':{'type':Sequelize[_0x83ea('0x2')](_0x83ea('0x3'),_0x83ea('0x4'),_0x83ea('0x5'))},'keyContent':{'type':Sequelize[_0x83ea('0x8')]},'idField':{'type':Sequelize[_0x83ea('0x8')]},'nameField':{'type':Sequelize[_0x83ea('0x8')]},'customField':{'type':Sequelize[_0x83ea('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x83ea('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 736e551..ecc4901 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 _0x287e=['undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','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','status','end','json','offset'];(function(_0x451e9d,_0x5f3d0e){var _0x2bf841=function(_0x5e0c94){while(--_0x5e0c94){_0x451e9d['push'](_0x451e9d['shift']());}};_0x2bf841(++_0x5f3d0e);}(_0x287e,0x1e3));var _0xe287=function(_0x34c131,_0xcc65e9){_0x34c131=_0x34c131-0x0;var _0x41ae6d=_0x287e[_0x34c131];return _0x41ae6d;};'use strict';var emlformat=require(_0xe287('0x0'));var rimraf=require(_0xe287('0x1'));var zipdir=require(_0xe287('0x2'));var jsonpatch=require(_0xe287('0x3'));var rp=require(_0xe287('0x4'));var moment=require(_0xe287('0x5'));var BPromise=require(_0xe287('0x6'));var Mustache=require(_0xe287('0x7'));var util=require(_0xe287('0x8'));var path=require('path');var sox=require(_0xe287('0x9'));var csv=require(_0xe287('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe287('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe287('0xc'));var toCsv=require(_0xe287('0xa'));var querystring=require(_0xe287('0xd'));var Papa=require(_0xe287('0xe'));var Redis=require(_0xe287('0xf'));var authService=require(_0xe287('0x10'));var qs=require(_0xe287('0x11'));var as=require(_0xe287('0x12'));var hardwareService=require(_0xe287('0x13'));var logger=require(_0xe287('0x14'))(_0xe287('0x15'));var utils=require(_0xe287('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe287('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3555,_0x5073da){_0x5073da=_0x5073da||0xcc;return function(_0x436bac){if(_0x436bac){return _0x2b3555['sendStatus'](_0x5073da);}return _0x2b3555[_0xe287('0x18')](_0x5073da)[_0xe287('0x19')]();};}function respondWithResult(_0x2d2b48,_0x22704c){_0x22704c=_0x22704c||0xc8;return function(_0x279281){if(_0x279281){return _0x2d2b48['status'](_0x22704c)[_0xe287('0x1a')](_0x279281);}};}function respondWithFilteredResult(_0x5447b5,_0x352922){return function(_0x376a59){if(_0x376a59){var _0x5c1dea=typeof _0x352922[_0xe287('0x1b')]==='undefined'&&typeof _0x352922['limit']===_0xe287('0x1c');var _0x31370b=_0x376a59[_0xe287('0x1d')];var _0x5ece64=_0x5c1dea?0x0:_0x352922[_0xe287('0x1b')];var _0x54c679=_0x5c1dea?_0x376a59['count']:_0x352922[_0xe287('0x1b')]+_0x352922[_0xe287('0x1e')];var _0x58ca20;if(_0x54c679>=_0x31370b){_0x54c679=_0x31370b;_0x58ca20=0xc8;}else{_0x58ca20=0xce;}_0x5447b5[_0xe287('0x18')](_0x58ca20);return _0x5447b5['set'](_0xe287('0x1f'),_0x5ece64+'-'+_0x54c679+'/'+_0x31370b)[_0xe287('0x1a')](_0x376a59);}return null;};}function patchUpdates(_0x411e16){return function(_0x4e264f){try{jsonpatch[_0xe287('0x20')](_0x4e264f,_0x411e16,!![]);}catch(_0x477a45){return BPromise[_0xe287('0x21')](_0x477a45);}return _0x4e264f[_0xe287('0x22')]();};}function saveUpdates(_0x3c47eb,_0x24b94f){return function(_0x3e971a){if(_0x3e971a){return _0x3e971a[_0xe287('0x23')](_0x3c47eb)['then'](function(_0x41288c){return _0x41288c;});}return null;};}function removeEntity(_0x1e68af,_0x5b6585){return function(_0x76665f){if(_0x76665f){return _0x76665f['destroy']()[_0xe287('0x24')](function(){_0x1e68af[_0xe287('0x18')](0xcc)[_0xe287('0x19')]();});}};}function handleEntityNotFound(_0x4ff2ee,_0x58f4f1){return function(_0x21b1aa){if(!_0x21b1aa){_0x4ff2ee[_0xe287('0x25')](0x194);}return _0x21b1aa;};}function handleError(_0x43408a,_0x42f764){_0x42f764=_0x42f764||0x1f4;return function(_0x13905f){logger[_0xe287('0x26')](_0x13905f[_0xe287('0x27')]);if(_0x13905f[_0xe287('0x28')]){delete _0x13905f['name'];}_0x43408a[_0xe287('0x18')](_0x42f764)['send'](_0x13905f);};}exports[_0xe287('0x29')]=function(_0x220175,_0x565ca3){var _0x1ba8c3={},_0x2e5a9a={},_0x1059e6={'count':0x0,'rows':[]};var _0x1b95c5=_['map'](db[_0xe287('0x2a')][_0xe287('0x2b')],function(_0x46e4e4){return{'name':_0x46e4e4['fieldName'],'type':_0x46e4e4[_0xe287('0x2c')][_0xe287('0x2d')]};});_0x2e5a9a[_0xe287('0x2e')]=_['map'](_0x1b95c5,_0xe287('0x28'));_0x2e5a9a[_0xe287('0x2f')]=_[_0xe287('0x30')](_0x220175[_0xe287('0x2f')]);_0x2e5a9a[_0xe287('0x31')]=_[_0xe287('0x32')](_0x2e5a9a['model'],_0x2e5a9a[_0xe287('0x2f')]);_0x1ba8c3['attributes']=_[_0xe287('0x32')](_0x2e5a9a['model'],qs[_0xe287('0x33')](_0x220175[_0xe287('0x2f')][_0xe287('0x33')]));_0x1ba8c3[_0xe287('0x34')]=_0x1ba8c3['attributes']['length']?_0x1ba8c3[_0xe287('0x34')]:_0x2e5a9a[_0xe287('0x2e')];if(!_0x220175['query']['hasOwnProperty']('nolimit')){_0x1ba8c3['limit']=qs['limit'](_0x220175[_0xe287('0x2f')][_0xe287('0x1e')]);_0x1ba8c3[_0xe287('0x1b')]=qs[_0xe287('0x1b')](_0x220175[_0xe287('0x2f')][_0xe287('0x1b')]);}_0x1ba8c3['order']=qs[_0xe287('0x35')](_0x220175[_0xe287('0x2f')][_0xe287('0x35')]);_0x1ba8c3['where']=qs[_0xe287('0x31')](_[_0xe287('0x36')](_0x220175[_0xe287('0x2f')],_0x2e5a9a[_0xe287('0x31')]),_0x1b95c5);if(_0x220175['query'][_0xe287('0x37')]){_0x1ba8c3[_0xe287('0x38')]=_[_0xe287('0x39')](_0x1ba8c3[_0xe287('0x38')],{'$or':_[_0xe287('0x3a')](_0x1b95c5,function(_0xb96691){if(_0xb96691[_0xe287('0x2c')]!==_0xe287('0x3b')){var _0xd7cd64={};_0xd7cd64[_0xb96691[_0xe287('0x28')]]={'$like':'%'+_0x220175[_0xe287('0x2f')][_0xe287('0x37')]+'%'};return _0xd7cd64;}})});}_0x1ba8c3=_[_0xe287('0x39')]({},_0x1ba8c3,_0x220175[_0xe287('0x3c')]);var _0xe3df54={'where':_0x1ba8c3['where']};return db[_0xe287('0x2a')]['count'](_0xe3df54)[_0xe287('0x24')](function(_0x297d2d){_0x1059e6[_0xe287('0x1d')]=_0x297d2d;if(_0x220175[_0xe287('0x2f')][_0xe287('0x3d')]){_0x1ba8c3[_0xe287('0x3e')]=[{'all':!![]}];}return db[_0xe287('0x2a')][_0xe287('0x3f')](_0x1ba8c3);})[_0xe287('0x24')](function(_0x583c42){_0x1059e6[_0xe287('0x40')]=_0x583c42;return _0x1059e6;})[_0xe287('0x24')](respondWithFilteredResult(_0x565ca3,_0x1ba8c3))[_0xe287('0x41')](handleError(_0x565ca3,null));};exports[_0xe287('0x42')]=function(_0x5d4766,_0x445239){var _0x53ee5c={'raw':!![],'where':{'id':_0x5d4766[_0xe287('0x43')]['id']}},_0x29d27a={};_0x29d27a['model']=_[_0xe287('0x30')](db[_0xe287('0x2a')]['rawAttributes']);_0x29d27a[_0xe287('0x2f')]=_[_0xe287('0x30')](_0x5d4766[_0xe287('0x2f')]);_0x29d27a[_0xe287('0x31')]=_[_0xe287('0x32')](_0x29d27a[_0xe287('0x2e')],_0x29d27a[_0xe287('0x2f')]);_0x53ee5c[_0xe287('0x34')]=_[_0xe287('0x32')](_0x29d27a[_0xe287('0x2e')],qs[_0xe287('0x33')](_0x5d4766[_0xe287('0x2f')][_0xe287('0x33')]));_0x53ee5c['attributes']=_0x53ee5c[_0xe287('0x34')][_0xe287('0x44')]?_0x53ee5c[_0xe287('0x34')]:_0x29d27a[_0xe287('0x2e')];if(_0x5d4766['query']['includeAll']){_0x53ee5c[_0xe287('0x3e')]=[{'all':!![]}];}_0x53ee5c=_[_0xe287('0x39')]({},_0x53ee5c,_0x5d4766[_0xe287('0x3c')]);return db['DeskField']['find'](_0x53ee5c)['then'](handleEntityNotFound(_0x445239,null))['then'](respondWithResult(_0x445239,null))[_0xe287('0x41')](handleError(_0x445239,null));};exports[_0xe287('0x45')]=function(_0x205af8,_0x2cee72){return db[_0xe287('0x2a')]['create'](_0x205af8[_0xe287('0x46')],{})[_0xe287('0x24')](respondWithResult(_0x2cee72,0xc9))[_0xe287('0x41')](handleError(_0x2cee72,null));};exports[_0xe287('0x23')]=function(_0xa8f82f,_0x257f39){if(_0xa8f82f['body']['id']){delete _0xa8f82f['body']['id'];}return db['DeskField'][_0xe287('0x47')]({'where':{'id':_0xa8f82f[_0xe287('0x43')]['id']}})[_0xe287('0x24')](handleEntityNotFound(_0x257f39,null))['then'](saveUpdates(_0xa8f82f[_0xe287('0x46')],null))[_0xe287('0x24')](respondWithResult(_0x257f39,null))[_0xe287('0x41')](handleError(_0x257f39,null));};exports[_0xe287('0x48')]=function(_0x460ea1,_0x2b62d8){return db[_0xe287('0x2a')][_0xe287('0x47')]({'where':{'id':_0x460ea1['params']['id']}})[_0xe287('0x24')](handleEntityNotFound(_0x2b62d8,null))['then'](removeEntity(_0x2b62d8,null))[_0xe287('0x41')](handleError(_0x2b62d8,null));}; \ No newline at end of file +var _0x7923=['moment','bluebird','util','to-csv','fs-extra','lodash','squel','desk.js','papaparse','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','apply','reject','save','update','then','error','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x53b62c,_0x5f4dcd){var _0x4dfc81=function(_0x1eaf79){while(--_0x1eaf79){_0x53b62c['push'](_0x53b62c['shift']());}};_0x4dfc81(++_0x5f4dcd);}(_0x7923,0x8f));var _0x3792=function(_0x265e83,_0x9a65ad){_0x265e83=_0x265e83-0x0;var _0xa4e7d2=_0x7923[_0x265e83];return _0xa4e7d2;};'use strict';var emlformat=require(_0x3792('0x0'));var rimraf=require(_0x3792('0x1'));var zipdir=require(_0x3792('0x2'));var jsonpatch=require(_0x3792('0x3'));var rp=require(_0x3792('0x4'));var moment=require(_0x3792('0x5'));var BPromise=require(_0x3792('0x6'));var Mustache=require('mustache');var util=require(_0x3792('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3792('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3792('0x9'));var _=require(_0x3792('0xa'));var squel=require(_0x3792('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3792('0xc'));var toCsv=require(_0x3792('0x8'));var querystring=require('querystring');var Papa=require(_0x3792('0xd'));var Redis=require(_0x3792('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3792('0xf'));var as=require(_0x3792('0x10'));var hardwareService=require(_0x3792('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3792('0x12'));var config=require(_0x3792('0x13'));var licenseUtil=require(_0x3792('0x14'));var db=require(_0x3792('0x15'))['db'];function respondWithStatusCode(_0x5a6d8e,_0x506ec4){_0x506ec4=_0x506ec4||0xcc;return function(_0x3fed73){if(_0x3fed73){return _0x5a6d8e[_0x3792('0x16')](_0x506ec4);}return _0x5a6d8e[_0x3792('0x17')](_0x506ec4)[_0x3792('0x18')]();};}function respondWithResult(_0x10913e,_0x2b86ce){_0x2b86ce=_0x2b86ce||0xc8;return function(_0x41139d){if(_0x41139d){return _0x10913e[_0x3792('0x17')](_0x2b86ce)[_0x3792('0x19')](_0x41139d);}};}function respondWithFilteredResult(_0x11910c,_0x427b53){return function(_0x183c42){if(_0x183c42){var _0x4247cd=typeof _0x427b53[_0x3792('0x1a')]===_0x3792('0x1b')&&typeof _0x427b53[_0x3792('0x1c')]===_0x3792('0x1b');var _0x4a8e1c=_0x183c42[_0x3792('0x1d')];var _0x2547d8=_0x4247cd?0x0:_0x427b53[_0x3792('0x1a')];var _0x3893ed=_0x4247cd?_0x183c42[_0x3792('0x1d')]:_0x427b53['offset']+_0x427b53[_0x3792('0x1c')];var _0xc75467;if(_0x3893ed>=_0x4a8e1c){_0x3893ed=_0x4a8e1c;_0xc75467=0xc8;}else{_0xc75467=0xce;}_0x11910c[_0x3792('0x17')](_0xc75467);return _0x11910c[_0x3792('0x1e')](_0x3792('0x1f'),_0x2547d8+'-'+_0x3893ed+'/'+_0x4a8e1c)['json'](_0x183c42);}return null;};}function patchUpdates(_0x4cd50b){return function(_0x2c1f8a){try{jsonpatch[_0x3792('0x20')](_0x2c1f8a,_0x4cd50b,!![]);}catch(_0x4e0ba4){return BPromise[_0x3792('0x21')](_0x4e0ba4);}return _0x2c1f8a[_0x3792('0x22')]();};}function saveUpdates(_0x386b88,_0x5c2c70){return function(_0x4ca818){if(_0x4ca818){return _0x4ca818[_0x3792('0x23')](_0x386b88)[_0x3792('0x24')](function(_0x3fa77a){return _0x3fa77a;});}return null;};}function removeEntity(_0x7a0f3f,_0x54d99b){return function(_0x515dc0){if(_0x515dc0){return _0x515dc0['destroy']()[_0x3792('0x24')](function(){_0x7a0f3f[_0x3792('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530c04,_0x3bf510){return function(_0x2328fe){if(!_0x2328fe){_0x530c04[_0x3792('0x16')](0x194);}return _0x2328fe;};}function handleError(_0x516929,_0x54f42a){_0x54f42a=_0x54f42a||0x1f4;return function(_0x44499b){logger[_0x3792('0x25')](_0x44499b['stack']);if(_0x44499b['name']){delete _0x44499b[_0x3792('0x26')];}_0x516929[_0x3792('0x17')](_0x54f42a)[_0x3792('0x27')](_0x44499b);};}exports[_0x3792('0x28')]=function(_0x4ca06c,_0x4a2ab2){var _0x3d2091={},_0xcc56d5={},_0x3b9b67={'count':0x0,'rows':[]};var _0x2d3131=_[_0x3792('0x29')](db[_0x3792('0x2a')][_0x3792('0x2b')],function(_0x44cc37){return{'name':_0x44cc37[_0x3792('0x2c')],'type':_0x44cc37['type'][_0x3792('0x2d')]};});_0xcc56d5[_0x3792('0x2e')]=_[_0x3792('0x29')](_0x2d3131,_0x3792('0x26'));_0xcc56d5[_0x3792('0x2f')]=_['keys'](_0x4ca06c['query']);_0xcc56d5['filters']=_[_0x3792('0x30')](_0xcc56d5['model'],_0xcc56d5[_0x3792('0x2f')]);_0x3d2091['attributes']=_[_0x3792('0x30')](_0xcc56d5[_0x3792('0x2e')],qs[_0x3792('0x31')](_0x4ca06c[_0x3792('0x2f')]['fields']));_0x3d2091[_0x3792('0x32')]=_0x3d2091['attributes']['length']?_0x3d2091[_0x3792('0x32')]:_0xcc56d5[_0x3792('0x2e')];if(!_0x4ca06c[_0x3792('0x2f')][_0x3792('0x33')]('nolimit')){_0x3d2091['limit']=qs[_0x3792('0x1c')](_0x4ca06c[_0x3792('0x2f')][_0x3792('0x1c')]);_0x3d2091[_0x3792('0x1a')]=qs[_0x3792('0x1a')](_0x4ca06c[_0x3792('0x2f')]['offset']);}_0x3d2091[_0x3792('0x34')]=qs[_0x3792('0x35')](_0x4ca06c[_0x3792('0x2f')][_0x3792('0x35')]);_0x3d2091[_0x3792('0x36')]=qs[_0x3792('0x37')](_[_0x3792('0x38')](_0x4ca06c[_0x3792('0x2f')],_0xcc56d5['filters']),_0x2d3131);if(_0x4ca06c['query']['filter']){_0x3d2091[_0x3792('0x36')]=_[_0x3792('0x39')](_0x3d2091[_0x3792('0x36')],{'$or':_['map'](_0x2d3131,function(_0x4e8f4d){if(_0x4e8f4d[_0x3792('0x3a')]!==_0x3792('0x3b')){var _0x5d3f53={};_0x5d3f53[_0x4e8f4d[_0x3792('0x26')]]={'$like':'%'+_0x4ca06c[_0x3792('0x2f')][_0x3792('0x3c')]+'%'};return _0x5d3f53;}})});}_0x3d2091=_['merge']({},_0x3d2091,_0x4ca06c[_0x3792('0x3d')]);var _0x51d656={'where':_0x3d2091[_0x3792('0x36')]};return db[_0x3792('0x2a')][_0x3792('0x1d')](_0x51d656)['then'](function(_0x5fa8a7){_0x3b9b67[_0x3792('0x1d')]=_0x5fa8a7;if(_0x4ca06c[_0x3792('0x2f')][_0x3792('0x3e')]){_0x3d2091[_0x3792('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x3792('0x40')](_0x3d2091);})[_0x3792('0x24')](function(_0x1d72ca){_0x3b9b67[_0x3792('0x41')]=_0x1d72ca;return _0x3b9b67;})['then'](respondWithFilteredResult(_0x4a2ab2,_0x3d2091))[_0x3792('0x42')](handleError(_0x4a2ab2,null));};exports[_0x3792('0x43')]=function(_0xef303,_0x4b8b54){var _0xaf6c79={'raw':!![],'where':{'id':_0xef303[_0x3792('0x44')]['id']}},_0x32f9a7={};_0x32f9a7[_0x3792('0x2e')]=_[_0x3792('0x45')](db[_0x3792('0x2a')][_0x3792('0x2b')]);_0x32f9a7[_0x3792('0x2f')]=_[_0x3792('0x45')](_0xef303[_0x3792('0x2f')]);_0x32f9a7[_0x3792('0x37')]=_[_0x3792('0x30')](_0x32f9a7[_0x3792('0x2e')],_0x32f9a7[_0x3792('0x2f')]);_0xaf6c79[_0x3792('0x32')]=_[_0x3792('0x30')](_0x32f9a7[_0x3792('0x2e')],qs[_0x3792('0x31')](_0xef303[_0x3792('0x2f')][_0x3792('0x31')]));_0xaf6c79[_0x3792('0x32')]=_0xaf6c79[_0x3792('0x32')]['length']?_0xaf6c79[_0x3792('0x32')]:_0x32f9a7['model'];if(_0xef303[_0x3792('0x2f')][_0x3792('0x3e')]){_0xaf6c79[_0x3792('0x3f')]=[{'all':!![]}];}_0xaf6c79=_['merge']({},_0xaf6c79,_0xef303[_0x3792('0x3d')]);return db[_0x3792('0x2a')]['find'](_0xaf6c79)[_0x3792('0x24')](handleEntityNotFound(_0x4b8b54,null))[_0x3792('0x24')](respondWithResult(_0x4b8b54,null))[_0x3792('0x42')](handleError(_0x4b8b54,null));};exports[_0x3792('0x46')]=function(_0x19d0b7,_0x172f47){return db[_0x3792('0x2a')][_0x3792('0x46')](_0x19d0b7[_0x3792('0x47')],{})[_0x3792('0x24')](respondWithResult(_0x172f47,0xc9))[_0x3792('0x42')](handleError(_0x172f47,null));};exports[_0x3792('0x23')]=function(_0x37e5fc,_0x246143){if(_0x37e5fc[_0x3792('0x47')]['id']){delete _0x37e5fc[_0x3792('0x47')]['id'];}return db[_0x3792('0x2a')][_0x3792('0x48')]({'where':{'id':_0x37e5fc[_0x3792('0x44')]['id']}})[_0x3792('0x24')](handleEntityNotFound(_0x246143,null))[_0x3792('0x24')](saveUpdates(_0x37e5fc[_0x3792('0x47')],null))[_0x3792('0x24')](respondWithResult(_0x246143,null))[_0x3792('0x42')](handleError(_0x246143,null));};exports[_0x3792('0x49')]=function(_0x536d53,_0x4c2b46){return db['DeskField'][_0x3792('0x48')]({'where':{'id':_0x536d53[_0x3792('0x44')]['id']}})[_0x3792('0x24')](handleEntityNotFound(_0x4c2b46,null))['then'](removeEntity(_0x4c2b46,null))[_0x3792('0x42')](handleError(_0x4c2b46,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f9d6967..665b840 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 _0x614c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','DeskField','int_desk_fields','desk_unique_index','FieldId'];(function(_0xcd2975,_0x27d718){var _0x284074=function(_0x47a69d){while(--_0x47a69d){_0xcd2975['push'](_0xcd2975['shift']());}};_0x284074(++_0x27d718);}(_0x614c,0x16c));var _0xc614=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x614c[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xc614('0x0'));var util=require(_0xc614('0x1'));var logger=require(_0xc614('0x2'))(_0xc614('0x3'));var moment=require(_0xc614('0x4'));var BPromise=require(_0xc614('0x5'));var rp=require(_0xc614('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc614('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0xa3f151,_0x51006a){return _0xa3f151[_0xc614('0x8')](_0xc614('0x9'),attributes,{'tableName':_0xc614('0xa'),'paranoid':![],'indexes':[{'name':_0xc614('0xb'),'fields':['idField',_0xc614('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x624e=['path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','api','moment'];(function(_0x208b7a,_0x2e3baa){var _0x37b7ec=function(_0x3a163d){while(--_0x3a163d){_0x208b7a['push'](_0x208b7a['shift']());}};_0x37b7ec(++_0x2e3baa);}(_0x624e,0x1af));var _0xe624=function(_0x31dd7d,_0x41e269){_0x31dd7d=_0x31dd7d-0x0;var _0x3f8100=_0x624e[_0x31dd7d];return _0x3f8100;};'use strict';var _=require(_0xe624('0x0'));var util=require(_0xe624('0x1'));var logger=require('../../config/logger')(_0xe624('0x2'));var moment=require(_0xe624('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe624('0x4'));var rimraf=require(_0xe624('0x5'));var config=require(_0xe624('0x6'));var attributes=require(_0xe624('0x7'));module[_0xe624('0x8')]=function(_0x31280e,_0x3cd1f3){return _0x31280e[_0xe624('0x9')](_0xe624('0xa'),attributes,{'tableName':_0xe624('0xb'),'paranoid':![],'indexes':[{'name':_0xe624('0xc'),'fields':[_0xe624('0xd'),_0xe624('0xe')],'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 1611c40..39d480b 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 _0x61cb=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x61cb,0xca));var _0xb61c=function(_0x1d006a,_0x2812b5){_0x1d006a=_0x1d006a-0x0;var _0x20a76b=_0x61cb[_0x1d006a];return _0x20a76b;};'use strict';var _=require('lodash');var util=require(_0xb61c('0x0'));var moment=require(_0xb61c('0x1'));var BPromise=require(_0xb61c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb61c('0x3'));var logger=require(_0xb61c('0x4'))(_0xb61c('0x5'));var config=require(_0xb61c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb61c('0x7')][_0xb61c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x503d24,_0x26236a,_0x566b8b){return new BPromise(function(_0x15d653,_0x56ab5a){return client[_0xb61c('0x9')](_0x503d24,_0x566b8b)[_0xb61c('0xa')](function(_0x5d0afd){logger[_0xb61c('0xb')](_0xb61c('0xc'),_0x26236a,_0xb61c('0xd'));logger[_0xb61c('0xe')](_0xb61c('0xf'),_0x26236a,_0xb61c('0xd'),JSON[_0xb61c('0x10')](_0x5d0afd));if(_0x5d0afd['error']){if(_0x5d0afd[_0xb61c('0x11')][_0xb61c('0x12')]===0x1f4){logger[_0xb61c('0x11')](_0xb61c('0xc'),_0x26236a,_0x5d0afd[_0xb61c('0x11')]['message']);return _0x56ab5a(_0x5d0afd[_0xb61c('0x11')][_0xb61c('0x13')]);}logger['error'](_0xb61c('0xc'),_0x26236a,_0x5d0afd[_0xb61c('0x11')][_0xb61c('0x13')]);return _0x15d653(_0x5d0afd['error'][_0xb61c('0x13')]);}else{logger['info'](_0xb61c('0xc'),_0x26236a,_0xb61c('0xd'));_0x15d653(_0x5d0afd[_0xb61c('0x14')]['message']);}})['catch'](function(_0x16cedc){logger['error'](_0xb61c('0xc'),_0x26236a,_0x16cedc);_0x56ab5a(_0x16cedc);});});} \ No newline at end of file +var _0xbb91=['jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x295f7f,_0x561913){var _0x5cd7ab=function(_0x5e44cd){while(--_0x5e44cd){_0x295f7f['push'](_0x295f7f['shift']());}};_0x5cd7ab(++_0x561913);}(_0xbb91,0x85));var _0x1bb9=function(_0x28d6b9,_0xbe9964){_0x28d6b9=_0x28d6b9-0x0;var _0x1e2bee=_0xbb91[_0x28d6b9];return _0x1e2bee;};'use strict';var _=require(_0x1bb9('0x0'));var util=require('util');var moment=require(_0x1bb9('0x1'));var BPromise=require('bluebird');var rs=require(_0x1bb9('0x2'));var fs=require('fs');var Redis=require(_0x1bb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bb9('0x4'));var logger=require(_0x1bb9('0x5'))('rpc');var config=require(_0x1bb9('0x6'));var jayson=require(_0x1bb9('0x7'));var client=jayson[_0x1bb9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c73bf,_0x2fdca8,_0x1fd5ce){return new BPromise(function(_0x2a3291,_0x3ca347){return client[_0x1bb9('0x9')](_0x3c73bf,_0x1fd5ce)[_0x1bb9('0xa')](function(_0x340f34){logger[_0x1bb9('0xb')](_0x1bb9('0xc'),_0x2fdca8,'request\x20sent');logger[_0x1bb9('0xd')](_0x1bb9('0xe'),_0x2fdca8,_0x1bb9('0xf'),JSON['stringify'](_0x340f34));if(_0x340f34[_0x1bb9('0x10')]){if(_0x340f34['error'][_0x1bb9('0x11')]===0x1f4){logger[_0x1bb9('0x10')]('DeskField,\x20%s,\x20%s',_0x2fdca8,_0x340f34[_0x1bb9('0x10')][_0x1bb9('0x12')]);return _0x3ca347(_0x340f34[_0x1bb9('0x10')][_0x1bb9('0x12')]);}logger[_0x1bb9('0x10')](_0x1bb9('0xc'),_0x2fdca8,_0x340f34[_0x1bb9('0x10')][_0x1bb9('0x12')]);return _0x2a3291(_0x340f34[_0x1bb9('0x10')][_0x1bb9('0x12')]);}else{logger[_0x1bb9('0xb')]('DeskField,\x20%s,\x20%s',_0x2fdca8,_0x1bb9('0xf'));_0x2a3291(_0x340f34[_0x1bb9('0x13')][_0x1bb9('0x12')]);}})['catch'](function(_0x5f3bde){logger['error']('DeskField,\x20%s,\x20%s',_0x2fdca8,_0x5f3bde);_0x3ca347(_0x5f3bde);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 400f136..62760c7 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 _0xb32e=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x440887,_0x5515a5){var _0x5668cd=function(_0x29c806){while(--_0x29c806){_0x440887['push'](_0x440887['shift']());}};_0x5668cd(++_0x5515a5);}(_0xb32e,0xe5));var _0xeb32=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb32e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xeb32('0x0'));var util=require(_0xeb32('0x1'));var path=require(_0xeb32('0x2'));var timeout=require(_0xeb32('0x3'));var express=require(_0xeb32('0x4'));var router=express[_0xeb32('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeb32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb32('0x7'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xeb32('0x8')](),controller[_0xeb32('0x9')]);router[_0xeb32('0xa')]('/:id',auth[_0xeb32('0x8')](),controller[_0xeb32('0xb')]);router[_0xeb32('0xa')](_0xeb32('0xc'),auth[_0xeb32('0x8')](),controller[_0xeb32('0xd')]);router['get'](_0xeb32('0xe'),auth[_0xeb32('0x8')](),controller[_0xeb32('0xf')]);router[_0xeb32('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xeb32('0x10')](_0xeb32('0xc'),auth['isAuthenticated'](),controller[_0xeb32('0x11')]);router[_0xeb32('0x12')]('/:id',auth[_0xeb32('0x8')](),controller[_0xeb32('0x13')]);router[_0xeb32('0x14')](_0xeb32('0x15'),auth[_0xeb32('0x8')](),controller[_0xeb32('0x16')]);module[_0xeb32('0x17')]=router; \ No newline at end of file +var _0x7d5e=['addConfiguration','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7d5e,0x164));var _0xe7d5=function(_0x55a57a,_0x20f97e){_0x55a57a=_0x55a57a-0x0;var _0x13e585=_0x7d5e[_0x55a57a];return _0x13e585;};'use strict';var multer=require(_0xe7d5('0x0'));var util=require('util');var path=require(_0xe7d5('0x1'));var timeout=require(_0xe7d5('0x2'));var express=require(_0xe7d5('0x3'));var router=express[_0xe7d5('0x4')]();var fs_extra=require(_0xe7d5('0x5'));var auth=require(_0xe7d5('0x6'));var interaction=require(_0xe7d5('0x7'));var config=require('../../config/environment');var controller=require(_0xe7d5('0x8'));router[_0xe7d5('0x9')]('/',auth[_0xe7d5('0xa')](),controller[_0xe7d5('0xb')]);router[_0xe7d5('0x9')](_0xe7d5('0xc'),auth[_0xe7d5('0xa')](),controller[_0xe7d5('0xd')]);router[_0xe7d5('0x9')]('/:id/configurations',auth[_0xe7d5('0xa')](),controller[_0xe7d5('0xe')]);router[_0xe7d5('0x9')](_0xe7d5('0xf'),auth[_0xe7d5('0xa')](),controller['getFields']);router[_0xe7d5('0x10')]('/',auth[_0xe7d5('0xa')](),controller['create']);router[_0xe7d5('0x10')](_0xe7d5('0x11'),auth[_0xe7d5('0xa')](),controller[_0xe7d5('0x12')]);router['put'](_0xe7d5('0xc'),auth[_0xe7d5('0xa')](),controller['update']);router[_0xe7d5('0x13')](_0xe7d5('0xc'),auth[_0xe7d5('0xa')](),controller[_0xe7d5('0x14')]);module[_0xe7d5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3cb7b39..4fafa71 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 _0xba18=['STRING','BOOLEAN','sequelize','exports'];(function(_0xa23505,_0x2bc163){var _0x2b2fae=function(_0x2895f5){while(--_0x2895f5){_0xa23505['push'](_0xa23505['shift']());}};_0x2b2fae(++_0x2bc163);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8ba1('0x0'));module[_0x8ba1('0x1')]={'name':{'type':Sequelize[_0x8ba1('0x2')]},'username':{'type':Sequelize[_0x8ba1('0x2')]},'password':{'type':Sequelize[_0x8ba1('0x2')]},'remoteUri':{'type':Sequelize[_0x8ba1('0x2')]},'tenantId':{'type':Sequelize[_0x8ba1('0x2')]},'clientId':{'type':Sequelize[_0x8ba1('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8ba1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ba1('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc03e=['BOOLEAN','sequelize','STRING'];(function(_0x4c186f,_0x38d20b){var _0x3395b3=function(_0x58d13b){while(--_0x58d13b){_0x4c186f['push'](_0x4c186f['shift']());}};_0x3395b3(++_0x38d20b);}(_0xc03e,0x15a));var _0xec03=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc03e[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xec03('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xec03('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xec03('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xec03('0x1')]},'clientSecret':{'type':Sequelize[_0xec03('0x1')]},'serverUrl':{'type':Sequelize[_0xec03('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xec03('0x1')]},'modernAuthentication':{'type':Sequelize[_0xec03('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f4c1890..7c7d461 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 _0xe4de=['Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','count','limit','status','update','then','destroy','end','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','getConfigurations','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','entitlementidname','entityimage_url','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','findOne','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','remoteUri','/oauth2/token','GET','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet'];(function(_0x2a7bf1,_0x2c1220){var _0x4d5458=function(_0x25ba90){while(--_0x25ba90){_0x2a7bf1['push'](_0x2a7bf1['shift']());}};_0x4d5458(++_0x2c1220);}(_0xe4de,0x16e));var _0xee4d=function(_0x35d649,_0x37210f){_0x35d649=_0x35d649-0x0;var _0x541bc4=_0xe4de[_0x35d649];return _0x541bc4;};'use strict';var rp=require(_0xee4d('0x0'));var util=require(_0xee4d('0x1'));var _=require(_0xee4d('0x2'));var qs=require(_0xee4d('0x3'));var logger=require('../../config/logger')(_0xee4d('0x4'));var db=require(_0xee4d('0x5'))['db'];var integrations=require(_0xee4d('0x6'));function respondWithResult(_0x1e86f7,_0x124b6c){_0x124b6c=_0x124b6c||0xc8;return function(_0x8f4b89){if(_0x8f4b89){return _0x1e86f7['status'](_0x124b6c)[_0xee4d('0x7')](_0x8f4b89);}};}function respondWithFilteredResult(_0x4c5261,_0x57bdf){return function(_0x92b37f){if(_0x92b37f){var _0x36c368=typeof _0x57bdf[_0xee4d('0x8')]===_0xee4d('0x9')&&typeof _0x57bdf['limit']==='undefined';var _0x2bd93c=_0x92b37f[_0xee4d('0xa')];var _0x175e36=_0x36c368?0x0:_0x57bdf[_0xee4d('0x8')];var _0x10dbab=_0x36c368?_0x92b37f[_0xee4d('0xa')]:_0x57bdf['offset']+_0x57bdf[_0xee4d('0xb')];var _0x5d11ec;if(_0x10dbab>=_0x2bd93c){_0x10dbab=_0x2bd93c;_0x5d11ec=0xc8;}else{_0x5d11ec=0xce;}_0x4c5261[_0xee4d('0xc')](_0x5d11ec);return _0x4c5261['set']('Content-Range',_0x175e36+'-'+_0x10dbab+'/'+_0x2bd93c)[_0xee4d('0x7')](_0x92b37f);}return null;};}function saveUpdates(_0x22c899){return function(_0x2ea665){if(_0x2ea665){return _0x2ea665[_0xee4d('0xd')](_0x22c899)[_0xee4d('0xe')](function(_0x2cde79){return _0x2cde79;});}return null;};}function removeEntity(_0x9eef25){return function(_0xf89dd3){if(_0xf89dd3){return _0xf89dd3[_0xee4d('0xf')]()[_0xee4d('0xe')](function(){_0x9eef25[_0xee4d('0xc')](0xcc)[_0xee4d('0x10')]();});}};}function handleEntityNotFound(_0x1b272b){return function(_0x31179c){if(!_0x31179c){_0x1b272b['sendStatus'](0x194);}return _0x31179c;};}function handleError(_0x50ca80,_0x543d93){_0x543d93=_0x543d93||0x1f4;return function(_0x441640){logger[_0xee4d('0x11')](_0x441640['stack']);if(_0x441640[_0xee4d('0x12')]){delete _0x441640[_0xee4d('0x12')];}_0x50ca80[_0xee4d('0xc')](_0x543d93)[_0xee4d('0x13')](_0x441640);};}exports[_0xee4d('0x14')]=function(_0xf5d288,_0x4a659b){var _0x76cad1={},_0x5f2172={},_0x55bbb9={'count':0x0,'rows':[]};var _0xf4481e=_[_0xee4d('0x15')](db[_0xee4d('0x16')][_0xee4d('0x17')],function(_0x19b35f){return{'name':_0x19b35f[_0xee4d('0x18')],'type':_0x19b35f[_0xee4d('0x19')][_0xee4d('0x1a')]};});_0x5f2172[_0xee4d('0x1b')]=_[_0xee4d('0x15')](_0xf4481e,_0xee4d('0x12'));_0x5f2172[_0xee4d('0x1c')]=_[_0xee4d('0x1d')](_0xf5d288[_0xee4d('0x1c')]);_0x5f2172[_0xee4d('0x1e')]=_[_0xee4d('0x1f')](_0x5f2172[_0xee4d('0x1b')],_0x5f2172[_0xee4d('0x1c')]);_0x76cad1[_0xee4d('0x20')]=_[_0xee4d('0x1f')](_0x5f2172[_0xee4d('0x1b')],qs[_0xee4d('0x21')](_0xf5d288[_0xee4d('0x1c')][_0xee4d('0x21')]));_0x76cad1[_0xee4d('0x20')]=_0x76cad1[_0xee4d('0x20')][_0xee4d('0x22')]?_0x76cad1[_0xee4d('0x20')]:_0x5f2172[_0xee4d('0x1b')];if(!_0xf5d288[_0xee4d('0x1c')][_0xee4d('0x23')](_0xee4d('0x24'))){_0x76cad1['limit']=qs[_0xee4d('0xb')](_0xf5d288[_0xee4d('0x1c')]['limit']);_0x76cad1[_0xee4d('0x8')]=qs['offset'](_0xf5d288[_0xee4d('0x1c')][_0xee4d('0x8')]);}_0x76cad1[_0xee4d('0x25')]=qs[_0xee4d('0x26')](_0xf5d288[_0xee4d('0x1c')]['sort']);_0x76cad1[_0xee4d('0x27')]=qs[_0xee4d('0x1e')](_[_0xee4d('0x28')](_0xf5d288[_0xee4d('0x1c')],_0x5f2172['filters']),_0xf4481e);if(_0xf5d288['query'][_0xee4d('0x29')]){_0x76cad1['where']=_[_0xee4d('0x2a')](_0x76cad1[_0xee4d('0x27')],{'$or':_[_0xee4d('0x15')](_0xf4481e,function(_0x60c4ef){if(_0x60c4ef[_0xee4d('0x19')]!==_0xee4d('0x2b')){var _0x4813d0={};_0x4813d0[_0x60c4ef[_0xee4d('0x12')]]={'$like':'%'+_0xf5d288[_0xee4d('0x1c')]['filter']+'%'};return _0x4813d0;}})});}_0x76cad1=_[_0xee4d('0x2a')]({},_0x76cad1,_0xf5d288[_0xee4d('0x2c')]);var _0x18f22c={'where':_0x76cad1[_0xee4d('0x27')]};return db[_0xee4d('0x16')][_0xee4d('0xa')](_0x18f22c)['then'](function(_0x5ebbe8){_0x55bbb9[_0xee4d('0xa')]=_0x5ebbe8;if(_0xf5d288[_0xee4d('0x1c')][_0xee4d('0x2d')]){_0x76cad1[_0xee4d('0x2e')]=[{'all':!![]}];}return db[_0xee4d('0x16')]['findAll'](_0x76cad1);})['then'](function(_0x2f7997){_0x55bbb9['rows']=_0x2f7997;return _0x55bbb9;})[_0xee4d('0xe')](respondWithFilteredResult(_0x4a659b,_0x76cad1))[_0xee4d('0x2f')](handleError(_0x4a659b,null));};exports[_0xee4d('0x30')]=function(_0x1e3ce3,_0x5b136a){var _0x4d7a88={'raw':![],'where':{'id':_0x1e3ce3[_0xee4d('0x31')]['id']}},_0x35ba51={};_0x35ba51['model']=_[_0xee4d('0x1d')](db[_0xee4d('0x16')][_0xee4d('0x17')]);_0x35ba51[_0xee4d('0x1c')]=_['keys'](_0x1e3ce3[_0xee4d('0x1c')]);_0x35ba51[_0xee4d('0x1e')]=_['intersection'](_0x35ba51['model'],_0x35ba51[_0xee4d('0x1c')]);_0x4d7a88['attributes']=_[_0xee4d('0x1f')](_0x35ba51['model'],qs[_0xee4d('0x21')](_0x1e3ce3[_0xee4d('0x1c')][_0xee4d('0x21')]));_0x4d7a88[_0xee4d('0x20')]=_0x4d7a88[_0xee4d('0x20')][_0xee4d('0x22')]?_0x4d7a88[_0xee4d('0x20')]:_0x35ba51[_0xee4d('0x1b')];if(_0x1e3ce3['query']['includeAll']){_0x4d7a88['include']=[{'all':!![]}];}_0x4d7a88=_[_0xee4d('0x2a')]({},_0x4d7a88,_0x1e3ce3[_0xee4d('0x2c')]);return db[_0xee4d('0x16')][_0xee4d('0x32')](_0x4d7a88)[_0xee4d('0xe')](handleEntityNotFound(_0x5b136a,null))[_0xee4d('0xe')](respondWithResult(_0x5b136a,null))['catch'](handleError(_0x5b136a,null));};exports[_0xee4d('0x33')]=function(_0x4d9859,_0x37d86d){return db[_0xee4d('0x16')][_0xee4d('0x33')](_0x4d9859[_0xee4d('0x34')],{})['then'](respondWithResult(_0x37d86d,0xc9))[_0xee4d('0x2f')](handleError(_0x37d86d,null));};exports[_0xee4d('0xd')]=function(_0x2f0601,_0x483725){if(_0x2f0601[_0xee4d('0x34')]['id']){delete _0x2f0601[_0xee4d('0x34')]['id'];}return db[_0xee4d('0x16')][_0xee4d('0x32')]({'where':{'id':_0x2f0601[_0xee4d('0x31')]['id']}})[_0xee4d('0xe')](handleEntityNotFound(_0x483725,null))[_0xee4d('0xe')](saveUpdates(_0x2f0601[_0xee4d('0x34')],null))['then'](respondWithResult(_0x483725,null))[_0xee4d('0x2f')](handleError(_0x483725,null));};exports[_0xee4d('0xf')]=function(_0x73cf9,_0x5b4431){return db['Dynamics365Account']['find']({'where':{'id':_0x73cf9[_0xee4d('0x31')]['id']}})[_0xee4d('0xe')](handleEntityNotFound(_0x5b4431,null))[_0xee4d('0xe')](removeEntity(_0x5b4431,null))[_0xee4d('0x2f')](handleError(_0x5b4431,null));};exports[_0xee4d('0x35')]=function(_0xf16585,_0x43dbc7){var _0x35e665={};var _0x1a3f2d={};var _0x33bd5b;var _0x34cc11;return db[_0xee4d('0x16')]['findOne']({'where':{'id':_0xf16585['params']['id']}})['then'](handleEntityNotFound(_0x43dbc7,null))[_0xee4d('0xe')](function(_0x3f4e91){if(_0x3f4e91){_0x33bd5b=_0x3f4e91;_0x1a3f2d[_0xee4d('0x1b')]=_['keys'](db[_0xee4d('0x36')]['rawAttributes']);_0x1a3f2d[_0xee4d('0x1c')]=_[_0xee4d('0x1d')](_0xf16585[_0xee4d('0x1c')]);_0x1a3f2d['filters']=_[_0xee4d('0x1f')](_0x1a3f2d['model'],_0x1a3f2d[_0xee4d('0x1c')]);_0x35e665[_0xee4d('0x20')]=_['intersection'](_0x1a3f2d[_0xee4d('0x1b')],qs[_0xee4d('0x21')](_0xf16585['query']['fields']));_0x35e665[_0xee4d('0x20')]=_0x35e665['attributes'][_0xee4d('0x22')]?_0x35e665[_0xee4d('0x20')]:_0x1a3f2d[_0xee4d('0x1b')];_0x35e665[_0xee4d('0x25')]=qs[_0xee4d('0x26')](_0xf16585[_0xee4d('0x1c')][_0xee4d('0x26')]);_0x35e665[_0xee4d('0x27')]=qs[_0xee4d('0x1e')](_[_0xee4d('0x28')](_0xf16585[_0xee4d('0x1c')],_0x1a3f2d[_0xee4d('0x1e')]));if(_0xf16585[_0xee4d('0x1c')]['filter']){_0x35e665['where']=_[_0xee4d('0x2a')](_0x35e665[_0xee4d('0x27')],{'$or':_[_0xee4d('0x15')](_0x35e665['attributes'],function(_0x34ce93){var _0x4bd596={};_0x4bd596[_0x34ce93]={'$like':'%'+_0xf16585[_0xee4d('0x1c')][_0xee4d('0x29')]+'%'};return _0x4bd596;})});}_0x35e665=_[_0xee4d('0x2a')]({},_0x35e665,_0xf16585[_0xee4d('0x2c')]);return _0x33bd5b['getConfigurations'](_0x35e665);}})[_0xee4d('0xe')](function(_0x3aa5b7){if(_0x3aa5b7){_0x34cc11=_0x3aa5b7[_0xee4d('0x22')];if(!_0xf16585[_0xee4d('0x1c')]['hasOwnProperty'](_0xee4d('0x24'))){_0x35e665['limit']=qs['limit'](_0xf16585[_0xee4d('0x1c')]['limit']);_0x35e665['offset']=qs[_0xee4d('0x8')](_0xf16585[_0xee4d('0x1c')]['offset']);}return _0x33bd5b[_0xee4d('0x35')](_0x35e665);}})['then'](function(_0x426365){if(_0x426365){return _0x426365?{'count':_0x34cc11,'rows':_0x426365}:null;}})['then'](respondWithResult(_0x43dbc7,null))[_0xee4d('0x2f')](handleError(_0x43dbc7,null));};exports[_0xee4d('0x37')]=function(_0x18bd86,_0xf6081c){if(_0x18bd86[_0xee4d('0x34')]['id']){delete _0x18bd86['body']['id'];}return db[_0xee4d('0x16')]['findOne']({'where':{'id':_0x18bd86[_0xee4d('0x31')]['id']}})['then'](handleEntityNotFound(_0xf6081c,null))['then'](function(_0x47b197){if(_0x47b197){_0x18bd86[_0xee4d('0x34')][_0xee4d('0x38')]=_0x47b197['id'];_0x18bd86[_0xee4d('0x34')][_0xee4d('0x39')]=integrations[_0xee4d('0x3a')](_0x18bd86[_0xee4d('0x34')][_0xee4d('0x3b')],_0x18bd86[_0xee4d('0x34')][_0xee4d('0x19')]);_0x18bd86[_0xee4d('0x34')][_0xee4d('0x3c')]=integrations['getDescriptions'](_0x18bd86['body']['channel'],_0x18bd86[_0xee4d('0x34')][_0xee4d('0x19')]);return db[_0xee4d('0x36')][_0xee4d('0x33')](_0x18bd86[_0xee4d('0x34')],{'include':[{'model':db['Dynamics365Field'],'as':_0xee4d('0x39')},{'model':db[_0xee4d('0x3d')],'as':_0xee4d('0x3c')}]});}return null;})[_0xee4d('0xe')](respondWithResult(_0xf6081c,null))[_0xee4d('0x2f')](handleError(_0xf6081c,null));};function sanitizeRemoteUri(_0x1f49fe){var _0x470ef5=_0x1f49fe[_0xee4d('0x3e')](-0x1);if(_0x470ef5==='/')return _0x1f49fe[_0xee4d('0x3f')](0x0,_0x1f49fe[_0xee4d('0x40')](_0x470ef5));return _0x1f49fe;}function getWebApiUrl(_0x501898){return util[_0xee4d('0x41')](_0xee4d('0x42'),_0x501898);}exports['getFields']=function(_0x357584,_0x1e20be){var _0x158b53=_0x357584[_0xee4d('0x1c')][_0xee4d('0x43')];var _0x361b80=_0x158b53===_0xee4d('0x44')?_0xee4d('0x45'):'PhoneCall';var _0x136d94='';var _0x3510f5='';var _0x3fa827='';var _0x3a2c34='';var _0x2c1ce3='';var _0x219fdc='';var _0x130f68='';var _0x5e840f='';var _0x5a306e=[_0xee4d('0x46'),_0xee4d('0x47'),'customerid',_0xee4d('0x48'),_0xee4d('0x49'),_0xee4d('0x4a'),_0xee4d('0x4b'),_0xee4d('0x4c'),_0xee4d('0x4d'),'phonecall_activity_parties'];var _0x2a9369=[_0xee4d('0x4e'),'accountidyominame','actualserviceunits',_0xee4d('0x4f'),_0xee4d('0x50'),_0xee4d('0x51'),'contractdetailidname',_0xee4d('0x52'),_0xee4d('0x53'),_0xee4d('0x54'),_0xee4d('0x55'),_0xee4d('0x56'),_0xee4d('0x57'),_0xee4d('0x58'),_0xee4d('0x59'),_0xee4d('0x5a'),'customeridtype','customeridyominame','emailaddress',_0xee4d('0x5b'),'entityimage_timestamp',_0xee4d('0x5c'),'escalatedon','exchangerate',_0xee4d('0x5d'),_0xee4d('0x5e'),'importsequencenumber',_0xee4d('0x5f'),'kbarticleidname',_0xee4d('0x60'),_0xee4d('0x61'),_0xee4d('0x62'),'modifiedbyexternalpartyyominame',_0xee4d('0x63'),'modifiedbyyominame',_0xee4d('0x64'),'modifiedonbehalfbyname',_0xee4d('0x65'),_0xee4d('0x66'),'msdyn_iotalertname','numberofchildincidents','onholdtime',_0xee4d('0x67'),_0xee4d('0x68'),'owneridtype',_0xee4d('0x69'),_0xee4d('0x6a'),'primarycontactidname','primarycontactidyominame',_0xee4d('0x6b'),_0xee4d('0x6c'),_0xee4d('0x6d'),_0xee4d('0x6e'),_0xee4d('0x6f'),_0xee4d('0x70'),_0xee4d('0x71'),_0xee4d('0x72'),_0xee4d('0x73'),_0xee4d('0x74'),_0xee4d('0x75'),'socialprofileidname','statecode',_0xee4d('0x76'),'subjectidname',_0xee4d('0x77'),_0xee4d('0x78'),_0xee4d('0x79'),_0xee4d('0x7a'),'utcconversiontimezonecode',_0xee4d('0x7b')];var _0xd5c3ce=_0x5a306e[_0xee4d('0x7c')](_0x2a9369);return db[_0xee4d('0x16')][_0xee4d('0x7d')]({'where':{'id':_0x357584[_0xee4d('0x31')]['id']},'attributes':['id',_0xee4d('0x7e'),_0xee4d('0x7f'),'remoteUri',_0xee4d('0x80'),_0xee4d('0x81'),_0xee4d('0x82'),_0xee4d('0x83')],'include':[{'model':db[_0xee4d('0x84')],'as':_0xee4d('0x84'),'attributes':['id',_0xee4d('0x85'),'data7']}]})['then'](handleEntityNotFound(_0x1e20be,null))[_0xee4d('0xe')](function(_0x529b5e){if(_0x529b5e){if(_0x529b5e[_0xee4d('0x83')]){_0x529b5e[_0xee4d('0x86')]=_0x529b5e[_0xee4d('0x84')][_0xee4d('0x85')];_0x5e840f=sanitizeRemoteUri(_0x529b5e[_0xee4d('0x84')][_0xee4d('0x87')]);_0x130f68=getWebApiUrl(_0x5e840f);return _0x529b5e;}_0x5e840f=sanitizeRemoteUri(_0x529b5e[_0xee4d('0x88')]);_0x130f68=getWebApiUrl(_0x5e840f);var _0x349fba={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x529b5e[_0xee4d('0x80')]+_0xee4d('0x89'),'form':{'client_id':_0x529b5e[_0xee4d('0x81')],'resource':_0x5e840f,'username':_0x529b5e[_0xee4d('0x7e')],'password':_0x529b5e[_0xee4d('0x7f')],'grant_type':'password','client_secret':_0x529b5e[_0xee4d('0x82')]},'json':!![]};return rp(_0x349fba);}})[_0xee4d('0xe')](function(_0x11959c){_0x219fdc=_0x11959c[_0xee4d('0x86')];var _0x3d64fc={'method':_0xee4d('0x8a'),'uri':encodeURI(_0x130f68+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x361b80+'\x27'),'headers':{'Authorization':_0xee4d('0x8b')+_0x219fdc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d64fc);})[_0xee4d('0xe')](function(_0x4e49de){var _0x322f81=_0x4e49de[_0xee4d('0x8c')][0x0];var _0x139318=_0x322f81['MetadataId'];var _0xcd5564={'method':_0xee4d('0x8a'),'uri':_0x130f68+_0xee4d('0x8d')+_0x139318+_0xee4d('0x8e'),'headers':{'Authorization':_0xee4d('0x8b')+_0x219fdc,'If-None-Match':null,'OData-Version':_0xee4d('0x8f')},'json':!![]};return rp(_0xcd5564);})[_0xee4d('0xe')](function(_0x32883a){_0x136d94=_0x32883a;_0x3510f5=_0x136d94[_0xee4d('0x90')];_0x3510f5=_[_0xee4d('0x91')](_0x3510f5,function(_0x57912e){return!_0xd5c3ce[_0xee4d('0x92')](_0x57912e[_0xee4d('0x93')]);});var _0x454187=[];var _0x19895a=[];_0x3510f5[_0xee4d('0x94')](function(_0x336b97){if(_0x336b97[_0xee4d('0x95')]){var _0x3d0339=_0x336b97[_0xee4d('0x95')][_0xee4d('0x3f')](_0x336b97['@odata.type'][_0xee4d('0x40')]('.')+0x1);if(_0x3d0339==='PicklistAttributeMetadata'){_0x454187[_0xee4d('0x96')](getSelectList(_0x130f68,_0x158b53,_0x19895a,_0x136d94[_0xee4d('0x97')],_0x336b97[_0xee4d('0x97')],_0x219fdc));}}});return Promise[_0xee4d('0x98')](_0x454187);})[_0xee4d('0xe')](function(_0x43b054){_0x3fa827=_0x43b054[0x0];var _0x27db88=[];var _0x26bd92=[];_0x3510f5['forEach'](function(_0x1d08af){if(!_[_0xee4d('0x99')](_0x1d08af[_0xee4d('0x95')])){var _0x457b5a=_0x1d08af[_0xee4d('0x95')][_0xee4d('0x3f')](_0x1d08af[_0xee4d('0x95')][_0xee4d('0x40')]('.')+0x1);if(_0x457b5a===_0xee4d('0x9a')){_0x27db88[_0xee4d('0x96')](getBooleanList(_0x130f68,_0x158b53,_0x26bd92,_0x136d94['MetadataId'],_0x1d08af[_0xee4d('0x97')],_0x219fdc));}}});return Promise[_0xee4d('0x98')](_0x27db88);})[_0xee4d('0xe')](function(_0x3fae39){_0x3a2c34=_0x3fae39[0x0];var _0x3d68eb=[];var _0x503add=[];_0x3510f5[_0xee4d('0x94')](function(_0x885666){if(_0x885666[_0xee4d('0x95')]){var _0x1afeff=_0x885666[_0xee4d('0x95')][_0xee4d('0x3f')](_0x885666['@odata.type'][_0xee4d('0x40')]('.')+0x1);if(_0x1afeff===_0xee4d('0x9b')||_0x1afeff==='DoubleAttributeMetadata'||_0x1afeff===_0xee4d('0x9c')||_0x1afeff==='IntegerAttributeMetadata'||_0x1afeff==='MemoAttributeMetadata'||_0x1afeff===_0xee4d('0x9d')||_0x1afeff===_0xee4d('0x9e')||_0x1afeff===_0xee4d('0x9f')||_0x1afeff===_0xee4d('0xa0')||_0x1afeff==='DecimalAttributeMetadata'){_0x3d68eb[_0xee4d('0x96')](getInputList(_0x130f68,_0x158b53,_0x1afeff,_0x503add,_0x136d94[_0xee4d('0x97')],_0x885666[_0xee4d('0x97')],_0x219fdc));}}});return Promise[_0xee4d('0x98')](_0x3d68eb);})['then'](function(_0x36e88d){_0x2c1ce3=_0x36e88d[0x0];var _0x413f01=_0x3fa827[_0xee4d('0x7c')](_0x3a2c34)[_0xee4d('0x7c')](_0x2c1ce3);var _0x3a8f72={'count':_0x413f01[_0xee4d('0x22')],'rows':_0x413f01};return _0x3a8f72;})[_0xee4d('0xe')](respondWithResult(_0x1e20be,null))[_0xee4d('0x2f')](function(_0x10bb76){var _0x189f6d=_0x357584[_0xee4d('0x1c')][_0xee4d('0xa1')]?0x1f4:_0x10bb76[_0xee4d('0xa2')]||0x1f4;logger[_0xee4d('0x11')](_0x10bb76['stack']);delete _0x10bb76[_0xee4d('0x12')];if(_0x189f6d===0x191){_0x189f6d=0x190;}_0x1e20be[_0xee4d('0xc')](_0x189f6d)[_0xee4d('0x13')](_0x357584[_0xee4d('0x1c')]['test']?{'message':_0xee4d('0xa3'),'statusCode':_0x10bb76[_0xee4d('0xa2')]}:_0x10bb76);});};function getSelectList(_0x1e51d3,_0x2f171b,_0x45d944,_0x126428,_0x401594,_0x151dc8){var _0x509a03={'method':_0xee4d('0x8a'),'uri':_0x1e51d3+'EntityDefinitions('+_0x126428+_0xee4d('0xa4')+_0x401594+_0xee4d('0xa5')+_0xee4d('0xa6'),'headers':{'Authorization':_0xee4d('0x8b')+_0x151dc8,'If-None-Match':null,'OData-Version':_0xee4d('0x8f')},'json':!![]};return rp(_0x509a03)['then'](function(_0x1a439f){var _0xc33ca3=[];var _0x558619=_0x1a439f[_0xee4d('0xa7')][_0xee4d('0xa8')];_0x558619['forEach'](function(_0x2a3861){_0xc33ca3[_0xee4d('0x96')]({'name':_0x2a3861[_0xee4d('0xa9')][_0xee4d('0xaa')][_0xee4d('0xa9')],'value':String(_0x2a3861[_0xee4d('0xab')])});});var _0x4f2380={'id':_0x2f171b+'_'+_0x1a439f[_0xee4d('0x93')],'name':_0x1a439f[_0xee4d('0xac')][_0xee4d('0xaa')][_0xee4d('0xa9')],'custom':![],'options':_0xc33ca3};_0x45d944[_0xee4d('0x96')](_0x4f2380);return _0x45d944;});}function getBooleanList(_0x215724,_0x41de0d,_0x5f0efd,_0x3a1e2d,_0xc142df,_0x6cc30c){var _0x132753={'method':_0xee4d('0x8a'),'uri':_0x215724+_0xee4d('0x8d')+_0x3a1e2d+_0xee4d('0xa4')+_0xc142df+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x6cc30c,'If-None-Match':null,'OData-Version':_0xee4d('0x8f')},'json':!![]};return rp(_0x132753)[_0xee4d('0xe')](function(_0x3764b8){var _0x2ea2f6=[];_0x2ea2f6[_0xee4d('0x96')]({'name':_0x3764b8[_0xee4d('0xa7')][_0xee4d('0xad')][_0xee4d('0xa9')]['UserLocalizedLabel'][_0xee4d('0xa9')],'value':_0xee4d('0xae')},{'name':_0x3764b8[_0xee4d('0xa7')][_0xee4d('0xaf')][_0xee4d('0xa9')]['UserLocalizedLabel'][_0xee4d('0xa9')],'value':_0xee4d('0xb0')});var _0xf29b4a={'id':_0x41de0d+'_'+_0x3764b8[_0xee4d('0x93')],'name':_0x3764b8['DisplayName'][_0xee4d('0xaa')]['Label'],'custom':![],'options':_0x2ea2f6};_0x5f0efd[_0xee4d('0x96')](_0xf29b4a);return _0x5f0efd;});}function getInputList(_0x1b6d71,_0x1e3d2b,_0x3010ab,_0x52fad0,_0x5be9f2,_0x11d979,_0x4964e4){var _0x3553d9={'method':_0xee4d('0x8a'),'uri':_0x1b6d71+_0xee4d('0x8d')+_0x5be9f2+_0xee4d('0xa4')+_0x11d979+_0xee4d('0xb1')+_0x3010ab+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x4964e4,'If-None-Match':null,'OData-Version':_0xee4d('0x8f')},'json':!![]};return rp(_0x3553d9)[_0xee4d('0xe')](function(_0x25b4c3){var _0xb38373={'id':_0x1e3d2b+'_'+_0x25b4c3[_0xee4d('0x93')],'name':_0x25b4c3['DisplayName'][_0xee4d('0xaa')]?_0x25b4c3[_0xee4d('0xac')][_0xee4d('0xaa')][_0xee4d('0xa9')]:_0x25b4c3[_0xee4d('0x93')],'custom':![],'options':[]};_0x52fad0['push'](_0xb38373);return _0x52fad0;});} \ No newline at end of file +var _0x4058=['caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','escalatedon','exchangerate','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','push','MetadataId','all','isNil','BooleanAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','undefined','limit','count','offset','then','status','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','params','intersection','find','catch','create','body','destroy','getConfigurations','findOne','options','addConfiguration','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x4058,0x129));var _0x8405=function(_0x5b65ba,_0xa4b01c){_0x5b65ba=_0x5b65ba-0x0;var _0x292360=_0x4058[_0x5b65ba];return _0x292360;};'use strict';var rp=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var _=require(_0x8405('0x2'));var qs=require(_0x8405('0x3'));var logger=require(_0x8405('0x4'))(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var integrations=require(_0x8405('0x7'));function respondWithResult(_0xf8c24c,_0x4948b2){_0x4948b2=_0x4948b2||0xc8;return function(_0x5ebf0e){if(_0x5ebf0e){return _0xf8c24c['status'](_0x4948b2)[_0x8405('0x8')](_0x5ebf0e);}};}function respondWithFilteredResult(_0x257d43,_0x3d9bf6){return function(_0x1322e5){if(_0x1322e5){var _0x1cb061=typeof _0x3d9bf6['offset']===_0x8405('0x9')&&typeof _0x3d9bf6[_0x8405('0xa')]===_0x8405('0x9');var _0x53bd7c=_0x1322e5[_0x8405('0xb')];var _0x5e132b=_0x1cb061?0x0:_0x3d9bf6[_0x8405('0xc')];var _0xb442=_0x1cb061?_0x1322e5['count']:_0x3d9bf6[_0x8405('0xc')]+_0x3d9bf6[_0x8405('0xa')];var _0x5b94d5;if(_0xb442>=_0x53bd7c){_0xb442=_0x53bd7c;_0x5b94d5=0xc8;}else{_0x5b94d5=0xce;}_0x257d43['status'](_0x5b94d5);return _0x257d43['set']('Content-Range',_0x5e132b+'-'+_0xb442+'/'+_0x53bd7c)[_0x8405('0x8')](_0x1322e5);}return null;};}function saveUpdates(_0x575fcb){return function(_0x495190){if(_0x495190){return _0x495190['update'](_0x575fcb)['then'](function(_0x548c94){return _0x548c94;});}return null;};}function removeEntity(_0x1321d3){return function(_0x238633){if(_0x238633){return _0x238633['destroy']()[_0x8405('0xd')](function(){_0x1321d3[_0x8405('0xe')](0xcc)[_0x8405('0xf')]();});}};}function handleEntityNotFound(_0x422822){return function(_0x58eb66){if(!_0x58eb66){_0x422822[_0x8405('0x10')](0x194);}return _0x58eb66;};}function handleError(_0x2d7601,_0x8ef1fb){_0x8ef1fb=_0x8ef1fb||0x1f4;return function(_0x30cef7){logger[_0x8405('0x11')](_0x30cef7[_0x8405('0x12')]);if(_0x30cef7[_0x8405('0x13')]){delete _0x30cef7[_0x8405('0x13')];}_0x2d7601[_0x8405('0xe')](_0x8ef1fb)[_0x8405('0x14')](_0x30cef7);};}exports[_0x8405('0x15')]=function(_0x21376d,_0x131857){var _0x241000={},_0x3c0352={},_0x42c191={'count':0x0,'rows':[]};var _0x2902d9=_[_0x8405('0x16')](db[_0x8405('0x17')][_0x8405('0x18')],function(_0x46305f){return{'name':_0x46305f[_0x8405('0x19')],'type':_0x46305f[_0x8405('0x1a')][_0x8405('0x1b')]};});_0x3c0352[_0x8405('0x1c')]=_[_0x8405('0x16')](_0x2902d9,'name');_0x3c0352['query']=_[_0x8405('0x1d')](_0x21376d[_0x8405('0x1e')]);_0x3c0352[_0x8405('0x1f')]=_['intersection'](_0x3c0352[_0x8405('0x1c')],_0x3c0352['query']);_0x241000[_0x8405('0x20')]=_['intersection'](_0x3c0352[_0x8405('0x1c')],qs[_0x8405('0x21')](_0x21376d[_0x8405('0x1e')][_0x8405('0x21')]));_0x241000[_0x8405('0x20')]=_0x241000[_0x8405('0x20')][_0x8405('0x22')]?_0x241000[_0x8405('0x20')]:_0x3c0352[_0x8405('0x1c')];if(!_0x21376d[_0x8405('0x1e')][_0x8405('0x23')](_0x8405('0x24'))){_0x241000['limit']=qs[_0x8405('0xa')](_0x21376d['query']['limit']);_0x241000[_0x8405('0xc')]=qs[_0x8405('0xc')](_0x21376d[_0x8405('0x1e')][_0x8405('0xc')]);}_0x241000[_0x8405('0x25')]=qs[_0x8405('0x26')](_0x21376d[_0x8405('0x1e')][_0x8405('0x26')]);_0x241000[_0x8405('0x27')]=qs[_0x8405('0x1f')](_[_0x8405('0x28')](_0x21376d[_0x8405('0x1e')],_0x3c0352[_0x8405('0x1f')]),_0x2902d9);if(_0x21376d['query'][_0x8405('0x29')]){_0x241000[_0x8405('0x27')]=_['merge'](_0x241000[_0x8405('0x27')],{'$or':_[_0x8405('0x16')](_0x2902d9,function(_0x1bcfa5){if(_0x1bcfa5['type']!==_0x8405('0x2a')){var _0x42c28f={};_0x42c28f[_0x1bcfa5[_0x8405('0x13')]]={'$like':'%'+_0x21376d['query'][_0x8405('0x29')]+'%'};return _0x42c28f;}})});}_0x241000=_[_0x8405('0x2b')]({},_0x241000,_0x21376d['options']);var _0x1ebf6f={'where':_0x241000['where']};return db[_0x8405('0x17')][_0x8405('0xb')](_0x1ebf6f)[_0x8405('0xd')](function(_0xe8de32){_0x42c191[_0x8405('0xb')]=_0xe8de32;if(_0x21376d[_0x8405('0x1e')][_0x8405('0x2c')]){_0x241000[_0x8405('0x2d')]=[{'all':!![]}];}return db[_0x8405('0x17')][_0x8405('0x2e')](_0x241000);})[_0x8405('0xd')](function(_0x3b774d){_0x42c191['rows']=_0x3b774d;return _0x42c191;})[_0x8405('0xd')](respondWithFilteredResult(_0x131857,_0x241000))['catch'](handleError(_0x131857,null));};exports['show']=function(_0x39f2a8,_0x42587c){var _0x5406e3={'raw':![],'where':{'id':_0x39f2a8[_0x8405('0x2f')]['id']}},_0x17ed2c={};_0x17ed2c[_0x8405('0x1c')]=_[_0x8405('0x1d')](db[_0x8405('0x17')]['rawAttributes']);_0x17ed2c[_0x8405('0x1e')]=_[_0x8405('0x1d')](_0x39f2a8[_0x8405('0x1e')]);_0x17ed2c[_0x8405('0x1f')]=_[_0x8405('0x30')](_0x17ed2c['model'],_0x17ed2c[_0x8405('0x1e')]);_0x5406e3[_0x8405('0x20')]=_[_0x8405('0x30')](_0x17ed2c[_0x8405('0x1c')],qs[_0x8405('0x21')](_0x39f2a8[_0x8405('0x1e')]['fields']));_0x5406e3[_0x8405('0x20')]=_0x5406e3[_0x8405('0x20')][_0x8405('0x22')]?_0x5406e3[_0x8405('0x20')]:_0x17ed2c[_0x8405('0x1c')];if(_0x39f2a8[_0x8405('0x1e')][_0x8405('0x2c')]){_0x5406e3['include']=[{'all':!![]}];}_0x5406e3=_[_0x8405('0x2b')]({},_0x5406e3,_0x39f2a8['options']);return db[_0x8405('0x17')][_0x8405('0x31')](_0x5406e3)['then'](handleEntityNotFound(_0x42587c,null))[_0x8405('0xd')](respondWithResult(_0x42587c,null))[_0x8405('0x32')](handleError(_0x42587c,null));};exports[_0x8405('0x33')]=function(_0xaf6465,_0x3192ca){return db[_0x8405('0x17')][_0x8405('0x33')](_0xaf6465[_0x8405('0x34')],{})[_0x8405('0xd')](respondWithResult(_0x3192ca,0xc9))[_0x8405('0x32')](handleError(_0x3192ca,null));};exports['update']=function(_0x5c1ac2,_0x18103f){if(_0x5c1ac2['body']['id']){delete _0x5c1ac2[_0x8405('0x34')]['id'];}return db[_0x8405('0x17')][_0x8405('0x31')]({'where':{'id':_0x5c1ac2['params']['id']}})[_0x8405('0xd')](handleEntityNotFound(_0x18103f,null))[_0x8405('0xd')](saveUpdates(_0x5c1ac2['body'],null))[_0x8405('0xd')](respondWithResult(_0x18103f,null))[_0x8405('0x32')](handleError(_0x18103f,null));};exports[_0x8405('0x35')]=function(_0x413487,_0x55d189){return db[_0x8405('0x17')][_0x8405('0x31')]({'where':{'id':_0x413487['params']['id']}})['then'](handleEntityNotFound(_0x55d189,null))['then'](removeEntity(_0x55d189,null))[_0x8405('0x32')](handleError(_0x55d189,null));};exports[_0x8405('0x36')]=function(_0x1c0350,_0x3788a4){var _0x5201ed={};var _0x51ffcc={};var _0x3c4ab2;var _0x2a3345;return db[_0x8405('0x17')][_0x8405('0x37')]({'where':{'id':_0x1c0350[_0x8405('0x2f')]['id']}})[_0x8405('0xd')](handleEntityNotFound(_0x3788a4,null))[_0x8405('0xd')](function(_0x600035){if(_0x600035){_0x3c4ab2=_0x600035;_0x51ffcc['model']=_[_0x8405('0x1d')](db['Dynamics365Configuration'][_0x8405('0x18')]);_0x51ffcc[_0x8405('0x1e')]=_[_0x8405('0x1d')](_0x1c0350[_0x8405('0x1e')]);_0x51ffcc[_0x8405('0x1f')]=_[_0x8405('0x30')](_0x51ffcc[_0x8405('0x1c')],_0x51ffcc[_0x8405('0x1e')]);_0x5201ed['attributes']=_[_0x8405('0x30')](_0x51ffcc[_0x8405('0x1c')],qs[_0x8405('0x21')](_0x1c0350[_0x8405('0x1e')]['fields']));_0x5201ed['attributes']=_0x5201ed[_0x8405('0x20')][_0x8405('0x22')]?_0x5201ed[_0x8405('0x20')]:_0x51ffcc[_0x8405('0x1c')];_0x5201ed[_0x8405('0x25')]=qs[_0x8405('0x26')](_0x1c0350[_0x8405('0x1e')]['sort']);_0x5201ed['where']=qs[_0x8405('0x1f')](_['pick'](_0x1c0350[_0x8405('0x1e')],_0x51ffcc[_0x8405('0x1f')]));if(_0x1c0350[_0x8405('0x1e')]['filter']){_0x5201ed['where']=_[_0x8405('0x2b')](_0x5201ed['where'],{'$or':_[_0x8405('0x16')](_0x5201ed[_0x8405('0x20')],function(_0x2a323e){var _0x42eea9={};_0x42eea9[_0x2a323e]={'$like':'%'+_0x1c0350[_0x8405('0x1e')][_0x8405('0x29')]+'%'};return _0x42eea9;})});}_0x5201ed=_[_0x8405('0x2b')]({},_0x5201ed,_0x1c0350[_0x8405('0x38')]);return _0x3c4ab2[_0x8405('0x36')](_0x5201ed);}})['then'](function(_0x1773fe){if(_0x1773fe){_0x2a3345=_0x1773fe[_0x8405('0x22')];if(!_0x1c0350[_0x8405('0x1e')][_0x8405('0x23')]('nolimit')){_0x5201ed[_0x8405('0xa')]=qs[_0x8405('0xa')](_0x1c0350[_0x8405('0x1e')][_0x8405('0xa')]);_0x5201ed[_0x8405('0xc')]=qs[_0x8405('0xc')](_0x1c0350['query'][_0x8405('0xc')]);}return _0x3c4ab2[_0x8405('0x36')](_0x5201ed);}})[_0x8405('0xd')](function(_0x550f08){if(_0x550f08){return _0x550f08?{'count':_0x2a3345,'rows':_0x550f08}:null;}})[_0x8405('0xd')](respondWithResult(_0x3788a4,null))[_0x8405('0x32')](handleError(_0x3788a4,null));};exports[_0x8405('0x39')]=function(_0x2b8334,_0x9b3747){if(_0x2b8334[_0x8405('0x34')]['id']){delete _0x2b8334[_0x8405('0x34')]['id'];}return db[_0x8405('0x17')][_0x8405('0x37')]({'where':{'id':_0x2b8334[_0x8405('0x2f')]['id']}})['then'](handleEntityNotFound(_0x9b3747,null))[_0x8405('0xd')](function(_0x5a2a1a){if(_0x5a2a1a){_0x2b8334[_0x8405('0x34')]['AccountId']=_0x5a2a1a['id'];_0x2b8334[_0x8405('0x34')][_0x8405('0x3a')]=integrations[_0x8405('0x3b')](_0x2b8334[_0x8405('0x34')][_0x8405('0x3c')],_0x2b8334['body'][_0x8405('0x1a')]);_0x2b8334['body']['Descriptions']=integrations[_0x8405('0x3d')](_0x2b8334['body'][_0x8405('0x3c')],_0x2b8334[_0x8405('0x34')][_0x8405('0x1a')]);return db['Dynamics365Configuration'][_0x8405('0x33')](_0x2b8334[_0x8405('0x34')],{'include':[{'model':db[_0x8405('0x3e')],'as':_0x8405('0x3a')},{'model':db[_0x8405('0x3e')],'as':_0x8405('0x3f')}]});}return null;})['then'](respondWithResult(_0x9b3747,null))[_0x8405('0x32')](handleError(_0x9b3747,null));};function sanitizeRemoteUri(_0x269d80){var _0x18efbe=_0x269d80['slice'](-0x1);if(_0x18efbe==='/')return _0x269d80['substring'](0x0,_0x269d80[_0x8405('0x40')](_0x18efbe));return _0x269d80;}function getWebApiUrl(_0x408e39){return util[_0x8405('0x41')](_0x8405('0x42'),_0x408e39);}exports[_0x8405('0x43')]=function(_0x5319b6,_0x5a4b36){var _0x5cd043=_0x5319b6[_0x8405('0x1e')][_0x8405('0x44')];var _0x2ef75f=_0x5cd043===_0x8405('0x45')?_0x8405('0x46'):_0x8405('0x47');var _0x1a4861='';var _0x22ce58='';var _0x3685a5='';var _0x23d94e='';var _0xee56d='';var _0x2a4d26='';var _0x531061='';var _0x106169='';var _0x21e60a=['title',_0x8405('0x48'),_0x8405('0x49'),_0x8405('0x4a'),_0x8405('0x4b'),_0x8405('0x4c'),_0x8405('0x4d'),_0x8405('0x4e'),_0x8405('0x4f'),_0x8405('0x50')];var _0x576b9b=[_0x8405('0x51'),_0x8405('0x52'),_0x8405('0x53'),'billedserviceunits',_0x8405('0x54'),_0x8405('0x55'),_0x8405('0x56'),_0x8405('0x57'),_0x8405('0x58'),'createdbyexternalpartyyominame',_0x8405('0x59'),_0x8405('0x5a'),_0x8405('0x5b'),_0x8405('0x5c'),_0x8405('0x5d'),_0x8405('0x5e'),_0x8405('0x5f'),_0x8405('0x60'),_0x8405('0x61'),'entitlementidname',_0x8405('0x62'),'entityimage_url',_0x8405('0x63'),_0x8405('0x64'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore',_0x8405('0x65'),'lastonholdtime',_0x8405('0x66'),_0x8405('0x67'),_0x8405('0x68'),_0x8405('0x69'),_0x8405('0x6a'),_0x8405('0x6b'),_0x8405('0x6c'),'modifiedonbehalfbyyominame',_0x8405('0x6d'),_0x8405('0x6e'),'numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame',_0x8405('0x6f'),_0x8405('0x70'),_0x8405('0x71'),_0x8405('0x72'),_0x8405('0x73'),'productserialnumber',_0x8405('0x74'),_0x8405('0x75'),_0x8405('0x76'),_0x8405('0x77'),_0x8405('0x78'),'sentimentvalue',_0x8405('0x79'),_0x8405('0x7a'),_0x8405('0x7b'),_0x8405('0x7c'),_0x8405('0x7d'),_0x8405('0x7e'),_0x8405('0x7f'),_0x8405('0x80'),'transactioncurrencyidname',_0x8405('0x81'),_0x8405('0x82'),_0x8405('0x83')];var _0x356995=_0x21e60a[_0x8405('0x84')](_0x576b9b);return db[_0x8405('0x17')][_0x8405('0x37')]({'where':{'id':_0x5319b6[_0x8405('0x2f')]['id']},'attributes':['id',_0x8405('0x85'),_0x8405('0x86'),_0x8405('0x87'),_0x8405('0x88'),_0x8405('0x89'),_0x8405('0x8a'),_0x8405('0x8b')],'include':[{'model':db[_0x8405('0x8c')],'as':'CloudProvider','attributes':['id',_0x8405('0x8d'),_0x8405('0x8e')]}]})[_0x8405('0xd')](handleEntityNotFound(_0x5a4b36,null))['then'](function(_0x1733f8){if(_0x1733f8){if(_0x1733f8[_0x8405('0x8b')]){_0x1733f8[_0x8405('0x8f')]=_0x1733f8[_0x8405('0x8c')][_0x8405('0x8d')];_0x106169=sanitizeRemoteUri(_0x1733f8[_0x8405('0x8c')][_0x8405('0x8e')]);_0x531061=getWebApiUrl(_0x106169);return _0x1733f8;}_0x106169=sanitizeRemoteUri(_0x1733f8[_0x8405('0x87')]);_0x531061=getWebApiUrl(_0x106169);var _0x352112={'method':_0x8405('0x90'),'uri':'https://login.microsoftonline.com/'+_0x1733f8['tenantId']+_0x8405('0x91'),'form':{'client_id':_0x1733f8[_0x8405('0x89')],'resource':_0x106169,'username':_0x1733f8['username'],'password':_0x1733f8[_0x8405('0x86')],'grant_type':_0x8405('0x86'),'client_secret':_0x1733f8[_0x8405('0x8a')]},'json':!![]};return rp(_0x352112);}})['then'](function(_0x537624){_0x2a4d26=_0x537624['access_token'];var _0x4ed271={'method':_0x8405('0x92'),'uri':encodeURI(_0x531061+_0x8405('0x93')+_0x2ef75f+'\x27'),'headers':{'Authorization':_0x8405('0x94')+_0x2a4d26,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4ed271);})[_0x8405('0xd')](function(_0x35607a){var _0x44be49=_0x35607a[_0x8405('0x95')][0x0];var _0x496893=_0x44be49['MetadataId'];var _0x31b673={'method':_0x8405('0x92'),'uri':_0x531061+'EntityDefinitions('+_0x496893+_0x8405('0x96'),'headers':{'Authorization':_0x8405('0x94')+_0x2a4d26,'If-None-Match':null,'OData-Version':_0x8405('0x97')},'json':!![]};return rp(_0x31b673);})['then'](function(_0x197225){_0x1a4861=_0x197225;_0x22ce58=_0x1a4861[_0x8405('0x98')];_0x22ce58=_[_0x8405('0x99')](_0x22ce58,function(_0x360e0a){return!_0x356995[_0x8405('0x9a')](_0x360e0a[_0x8405('0x9b')]);});var _0x233dad=[];var _0x2ca863=[];_0x22ce58[_0x8405('0x9c')](function(_0x9aa5a6){if(_0x9aa5a6['@odata.type']){var _0x8024ec=_0x9aa5a6[_0x8405('0x9d')][_0x8405('0x9e')](_0x9aa5a6['@odata.type']['lastIndexOf']('.')+0x1);if(_0x8024ec==='PicklistAttributeMetadata'){_0x233dad[_0x8405('0x9f')](getSelectList(_0x531061,_0x5cd043,_0x2ca863,_0x1a4861[_0x8405('0xa0')],_0x9aa5a6[_0x8405('0xa0')],_0x2a4d26));}}});return Promise[_0x8405('0xa1')](_0x233dad);})['then'](function(_0x1472d8){_0x3685a5=_0x1472d8[0x0];var _0x1a3cc6=[];var _0x8b4fc7=[];_0x22ce58[_0x8405('0x9c')](function(_0x9d6230){if(!_[_0x8405('0xa2')](_0x9d6230[_0x8405('0x9d')])){var _0x40da84=_0x9d6230[_0x8405('0x9d')][_0x8405('0x9e')](_0x9d6230['@odata.type']['lastIndexOf']('.')+0x1);if(_0x40da84===_0x8405('0xa3')){_0x1a3cc6[_0x8405('0x9f')](getBooleanList(_0x531061,_0x5cd043,_0x8b4fc7,_0x1a4861[_0x8405('0xa0')],_0x9d6230[_0x8405('0xa0')],_0x2a4d26));}}});return Promise[_0x8405('0xa1')](_0x1a3cc6);})[_0x8405('0xd')](function(_0x281cf2){_0x23d94e=_0x281cf2[0x0];var _0x311089=[];var _0x2300d3=[];_0x22ce58['forEach'](function(_0x264c5d){if(_0x264c5d[_0x8405('0x9d')]){var _0x45ab2c=_0x264c5d['@odata.type'][_0x8405('0x9e')](_0x264c5d[_0x8405('0x9d')][_0x8405('0x40')]('.')+0x1);if(_0x45ab2c==='StringAttributeMetadata'||_0x45ab2c==='DoubleAttributeMetadata'||_0x45ab2c==='BigIntAttributeMetadata'||_0x45ab2c===_0x8405('0xa4')||_0x45ab2c==='MemoAttributeMetadata'||_0x45ab2c==='DateTimeAttributeMetadata'||_0x45ab2c===_0x8405('0xa5')||_0x45ab2c===_0x8405('0xa6')||_0x45ab2c==='StateAttributeMetadata'||_0x45ab2c===_0x8405('0xa7')){_0x311089[_0x8405('0x9f')](getInputList(_0x531061,_0x5cd043,_0x45ab2c,_0x2300d3,_0x1a4861[_0x8405('0xa0')],_0x264c5d[_0x8405('0xa0')],_0x2a4d26));}}});return Promise[_0x8405('0xa1')](_0x311089);})['then'](function(_0x49ecf0){_0xee56d=_0x49ecf0[0x0];var _0x2db594=_0x3685a5['concat'](_0x23d94e)[_0x8405('0x84')](_0xee56d);var _0x19dca3={'count':_0x2db594[_0x8405('0x22')],'rows':_0x2db594};return _0x19dca3;})[_0x8405('0xd')](respondWithResult(_0x5a4b36,null))['catch'](function(_0x39f036){var _0x25cf48=_0x5319b6[_0x8405('0x1e')][_0x8405('0xa8')]?0x1f4:_0x39f036[_0x8405('0xa9')]||0x1f4;logger['error'](_0x39f036[_0x8405('0x12')]);delete _0x39f036['name'];if(_0x25cf48===0x191){_0x25cf48=0x190;}_0x5a4b36[_0x8405('0xe')](_0x25cf48)['send'](_0x5319b6[_0x8405('0x1e')][_0x8405('0xa8')]?{'message':_0x8405('0xaa'),'statusCode':_0x39f036['statusCode']}:_0x39f036);});};function getSelectList(_0x489405,_0x3f0564,_0x4682b9,_0x4aaaa8,_0x349e9f,_0x304f11){var _0x422722={'method':_0x8405('0x92'),'uri':_0x489405+_0x8405('0xab')+_0x4aaaa8+_0x8405('0xac')+_0x349e9f+_0x8405('0xad')+_0x8405('0xae'),'headers':{'Authorization':_0x8405('0x94')+_0x304f11,'If-None-Match':null,'OData-Version':_0x8405('0x97')},'json':!![]};return rp(_0x422722)[_0x8405('0xd')](function(_0x206e71){var _0x1350bb=[];var _0xefa7be=_0x206e71['OptionSet'][_0x8405('0xaf')];_0xefa7be['forEach'](function(_0x1266ff){_0x1350bb['push']({'name':_0x1266ff[_0x8405('0xb0')][_0x8405('0xb1')]['Label'],'value':String(_0x1266ff[_0x8405('0xb2')])});});var _0x2f0ef0={'id':_0x3f0564+'_'+_0x206e71[_0x8405('0x9b')],'name':_0x206e71[_0x8405('0xb3')][_0x8405('0xb1')]['Label'],'custom':![],'options':_0x1350bb};_0x4682b9[_0x8405('0x9f')](_0x2f0ef0);return _0x4682b9;});}function getBooleanList(_0x571dcd,_0x587ed0,_0x5285e9,_0x12d3f5,_0x3c476d,_0x2bd8a4){var _0x1a9007={'method':_0x8405('0x92'),'uri':_0x571dcd+_0x8405('0xab')+_0x12d3f5+_0x8405('0xac')+_0x3c476d+_0x8405('0xb4'),'headers':{'Authorization':_0x8405('0x94')+_0x2bd8a4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1a9007)['then'](function(_0x539104){var _0xc4bf7d=[];_0xc4bf7d[_0x8405('0x9f')]({'name':_0x539104[_0x8405('0xb5')]['TrueOption'][_0x8405('0xb0')][_0x8405('0xb1')][_0x8405('0xb0')],'value':_0x8405('0xb6')},{'name':_0x539104[_0x8405('0xb5')][_0x8405('0xb7')]['Label'][_0x8405('0xb1')][_0x8405('0xb0')],'value':_0x8405('0xb8')});var _0x37fa30={'id':_0x587ed0+'_'+_0x539104[_0x8405('0x9b')],'name':_0x539104[_0x8405('0xb3')][_0x8405('0xb1')][_0x8405('0xb0')],'custom':![],'options':_0xc4bf7d};_0x5285e9['push'](_0x37fa30);return _0x5285e9;});}function getInputList(_0x350a21,_0x25e45b,_0x205362,_0x3f6b61,_0x2ad3e1,_0x20d1db,_0x1b1150){var _0x30449c={'method':_0x8405('0x92'),'uri':_0x350a21+_0x8405('0xab')+_0x2ad3e1+_0x8405('0xac')+_0x20d1db+_0x8405('0xb9')+_0x205362+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x8405('0x94')+_0x1b1150,'If-None-Match':null,'OData-Version':_0x8405('0x97')},'json':!![]};return rp(_0x30449c)[_0x8405('0xd')](function(_0x4609f9){var _0x2fde4e={'id':_0x25e45b+'_'+_0x4609f9['LogicalName'],'name':_0x4609f9[_0x8405('0xb3')][_0x8405('0xb1')]?_0x4609f9[_0x8405('0xb3')][_0x8405('0xb1')][_0x8405('0xb0')]:_0x4609f9[_0x8405('0x9b')],'custom':![],'options':[]};_0x3f6b61[_0x8405('0x9f')](_0x2fde4e);return _0x3f6b61;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 32e055f..3ee4fdd 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1b9fce,_0x29729b){var _0x13c67c=function(_0x4f8fc4){while(--_0x4f8fc4){_0x1b9fce['push'](_0x1b9fce['shift']());}};_0x13c67c(++_0x29729b);}(_0xe706,0xa3));var _0x6e70=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xe706[_0x45cd35];return _0x16db84;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x15815b,_0x55cd1e){var _0x46dd33=function(_0x444e2e){while(--_0x444e2e){_0x15815b['push'](_0x15815b['shift']());}};_0x46dd33(++_0x55cd1e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xcb91[_0x5b7788];return _0x573871;};'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 2b7c093..f4bafee 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 _0x3c05=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x3c05,0xaa));var _0x53c0=function(_0xd0c3bd,_0x2088c8){_0xd0c3bd=_0xd0c3bd-0x0;var _0x400a5e=_0x3c05[_0xd0c3bd];return _0x400a5e;};'use strict';var _=require(_0x53c0('0x0'));var util=require(_0x53c0('0x1'));var moment=require(_0x53c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x53c0('0x3'));var fs=require('fs');var Redis=require(_0x53c0('0x4'));var db=require(_0x53c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53c0('0x6'));var config=require(_0x53c0('0x7'));var jayson=require(_0x53c0('0x8'));var client=jayson[_0x53c0('0x9')][_0x53c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e8a26,_0x1cfcc9,_0x1fd232){return new BPromise(function(_0x5944f1,_0x20859c){return client[_0x53c0('0xb')](_0x5e8a26,_0x1fd232)[_0x53c0('0xc')](function(_0x5453fb){logger['info'](_0x53c0('0xd'),_0x1cfcc9,_0x53c0('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1cfcc9,'request\x20sent',JSON[_0x53c0('0xf')](_0x5453fb));if(_0x5453fb[_0x53c0('0x10')]){if(_0x5453fb[_0x53c0('0x10')][_0x53c0('0x11')]===0x1f4){logger[_0x53c0('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x1cfcc9,_0x5453fb[_0x53c0('0x10')][_0x53c0('0x12')]);return _0x20859c(_0x5453fb[_0x53c0('0x10')][_0x53c0('0x12')]);}logger[_0x53c0('0x10')](_0x53c0('0xd'),_0x1cfcc9,_0x5453fb[_0x53c0('0x10')]['message']);return _0x5944f1(_0x5453fb[_0x53c0('0x10')][_0x53c0('0x12')]);}else{logger[_0x53c0('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x1cfcc9,_0x53c0('0xe'));_0x5944f1(_0x5453fb['result'][_0x53c0('0x12')]);}})[_0x53c0('0x14')](function(_0xdeee27){logger['error'](_0x53c0('0xd'),_0x1cfcc9,_0xdeee27);_0x20859c(_0xdeee27);});});}exports[_0x53c0('0x15')]=function(_0x4239c6){var _0x29ecea=this;return new Promise(function(_0x49feb8,_0x5bf388){return db[_0x53c0('0x16')][_0x53c0('0x17')]({'raw':_0x4239c6[_0x53c0('0x18')]?_0x4239c6['options'][_0x53c0('0x19')]===undefined?!![]:![]:!![],'where':_0x4239c6[_0x53c0('0x18')]?_0x4239c6[_0x53c0('0x18')][_0x53c0('0x1a')]||null:null,'attributes':_0x4239c6[_0x53c0('0x18')]?_0x4239c6['options'][_0x53c0('0x1b')]||null:null,'limit':_0x4239c6['options']?_0x4239c6[_0x53c0('0x18')][_0x53c0('0x1c')]||null:null,'include':_0x4239c6[_0x53c0('0x18')]?_0x4239c6[_0x53c0('0x18')][_0x53c0('0x1d')]?_['map'](_0x4239c6['options'][_0x53c0('0x1d')],function(_0x1af201){return{'model':db[_0x1af201[_0x53c0('0x1e')]],'as':_0x1af201['as'],'attributes':_0x1af201[_0x53c0('0x1b')],'include':_0x1af201[_0x53c0('0x1d')]?_[_0x53c0('0x1f')](_0x1af201[_0x53c0('0x1d')],function(_0x4db2ba){return{'model':db[_0x4db2ba[_0x53c0('0x1e')]],'as':_0x4db2ba['as'],'attributes':_0x4db2ba[_0x53c0('0x1b')],'include':_0x4db2ba[_0x53c0('0x1d')]?_[_0x53c0('0x1f')](_0x4db2ba['include'],function(_0x573f9e){return{'model':db[_0x573f9e[_0x53c0('0x1e')]],'as':_0x573f9e['as'],'attributes':_0x573f9e['attributes']};}):[]};}):[]};}):[]:[]})[_0x53c0('0xc')](function(_0x39dc4a){logger['info']('GetDynamics365Account',_0x4239c6);logger[_0x53c0('0x20')]('GetDynamics365Account',_0x4239c6,JSON['stringify'](_0x39dc4a));_0x49feb8(_0x39dc4a);})[_0x53c0('0x14')](function(_0x4151dc){logger[_0x53c0('0x10')](_0x53c0('0x15'),_0x4151dc[_0x53c0('0x12')],_0x4239c6);_0x5bf388(_0x29ecea[_0x53c0('0x10')](0x1f4,_0x4151dc[_0x53c0('0x12')]));});});};exports[_0x53c0('0x21')]=function(_0xf563d6){var _0x35049b=this;return new Promise(function(_0x2d6694,_0x3f0fa7){return db[_0x53c0('0x16')][_0x53c0('0x22')]({'raw':_0xf563d6[_0x53c0('0x18')]?_0xf563d6[_0x53c0('0x18')][_0x53c0('0x19')]===undefined?!![]:![]:!![],'where':_0xf563d6[_0x53c0('0x18')]?_0xf563d6[_0x53c0('0x18')][_0x53c0('0x1a')]||null:null,'attributes':_0xf563d6[_0x53c0('0x18')]?_0xf563d6[_0x53c0('0x18')]['attributes']||null:null,'include':_0xf563d6[_0x53c0('0x18')]?_0xf563d6[_0x53c0('0x18')][_0x53c0('0x1d')]?_[_0x53c0('0x1f')](_0xf563d6[_0x53c0('0x18')]['include'],function(_0x2776af){return{'model':db[_0x2776af['model']],'as':_0x2776af['as'],'attributes':_0x2776af[_0x53c0('0x1b')],'include':_0x2776af[_0x53c0('0x1d')]?_[_0x53c0('0x1f')](_0x2776af[_0x53c0('0x1d')],function(_0x300446){return{'model':db[_0x300446[_0x53c0('0x1e')]],'as':_0x300446['as'],'attributes':_0x300446[_0x53c0('0x1b')],'include':_0x300446[_0x53c0('0x1d')]?_[_0x53c0('0x1f')](_0x300446['include'],function(_0xc9d5c3){return{'model':db[_0xc9d5c3[_0x53c0('0x1e')]],'as':_0xc9d5c3['as'],'attributes':_0xc9d5c3[_0x53c0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x517c02){logger[_0x53c0('0x13')](_0x53c0('0x21'),_0xf563d6);logger[_0x53c0('0x20')](_0x53c0('0x21'),_0xf563d6,JSON[_0x53c0('0xf')](_0x517c02));_0x2d6694(_0x517c02);})['catch'](function(_0x20e8e2){logger[_0x53c0('0x10')](_0x53c0('0x21'),_0x20e8e2[_0x53c0('0x12')],_0xf563d6);_0x3f0fa7(_0x35049b[_0x53c0('0x10')](0x1f4,_0x20e8e2[_0x53c0('0x12')]));});});}; \ No newline at end of file +var _0x04bc=['message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','attributes','map','model','then','stringify','find','ShowDynamics365Account','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x52ac35,_0x1e7a36){var _0x42018f=function(_0x47fd5c){while(--_0x47fd5c){_0x52ac35['push'](_0x52ac35['shift']());}};_0x42018f(++_0x1e7a36);}(_0x04bc,0x144));var _0xc04b=function(_0x2b04c3,_0x14eac4){_0x2b04c3=_0x2b04c3-0x0;var _0x1f2657=_0x04bc[_0x2b04c3];return _0x1f2657;};'use strict';var _=require(_0xc04b('0x0'));var util=require('util');var moment=require(_0xc04b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc04b('0x2'));var fs=require('fs');var Redis=require(_0xc04b('0x3'));var db=require(_0xc04b('0x4'))['db'];var utils=require(_0xc04b('0x5'));var logger=require(_0xc04b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc04b('0x7'));var client=jayson[_0xc04b('0x8')][_0xc04b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x199f31,_0x51ffe6,_0x5603db){return new BPromise(function(_0x188776,_0x1e82b6){return client['request'](_0x199f31,_0x5603db)['then'](function(_0x1455cd){logger[_0xc04b('0xa')](_0xc04b('0xb'),_0x51ffe6,_0xc04b('0xc'));logger[_0xc04b('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x51ffe6,_0xc04b('0xc'),JSON['stringify'](_0x1455cd));if(_0x1455cd[_0xc04b('0xe')]){if(_0x1455cd[_0xc04b('0xe')][_0xc04b('0xf')]===0x1f4){logger[_0xc04b('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x51ffe6,_0x1455cd['error'][_0xc04b('0x10')]);return _0x1e82b6(_0x1455cd[_0xc04b('0xe')][_0xc04b('0x10')]);}logger[_0xc04b('0xe')](_0xc04b('0xb'),_0x51ffe6,_0x1455cd[_0xc04b('0xe')]['message']);return _0x188776(_0x1455cd[_0xc04b('0xe')][_0xc04b('0x10')]);}else{logger[_0xc04b('0xa')](_0xc04b('0xb'),_0x51ffe6,_0xc04b('0xc'));_0x188776(_0x1455cd[_0xc04b('0x11')][_0xc04b('0x10')]);}})[_0xc04b('0x12')](function(_0x5c055b){logger['error'](_0xc04b('0xb'),_0x51ffe6,_0x5c055b);_0x1e82b6(_0x5c055b);});});}exports[_0xc04b('0x13')]=function(_0x58ab20){var _0x1dad31=this;return new Promise(function(_0x34ddb9,_0x178316){return db[_0xc04b('0x14')][_0xc04b('0x15')]({'raw':_0x58ab20[_0xc04b('0x16')]?_0x58ab20[_0xc04b('0x16')][_0xc04b('0x17')]===undefined?!![]:![]:!![],'where':_0x58ab20[_0xc04b('0x16')]?_0x58ab20[_0xc04b('0x16')][_0xc04b('0x18')]||null:null,'attributes':_0x58ab20[_0xc04b('0x16')]?_0x58ab20[_0xc04b('0x16')]['attributes']||null:null,'limit':_0x58ab20[_0xc04b('0x16')]?_0x58ab20[_0xc04b('0x16')][_0xc04b('0x19')]||null:null,'include':_0x58ab20[_0xc04b('0x16')]?_0x58ab20['options']['include']?_['map'](_0x58ab20[_0xc04b('0x16')][_0xc04b('0x1a')],function(_0x42ee81){return{'model':db[_0x42ee81['model']],'as':_0x42ee81['as'],'attributes':_0x42ee81[_0xc04b('0x1b')],'include':_0x42ee81[_0xc04b('0x1a')]?_[_0xc04b('0x1c')](_0x42ee81[_0xc04b('0x1a')],function(_0x47a753){return{'model':db[_0x47a753[_0xc04b('0x1d')]],'as':_0x47a753['as'],'attributes':_0x47a753[_0xc04b('0x1b')],'include':_0x47a753[_0xc04b('0x1a')]?_[_0xc04b('0x1c')](_0x47a753[_0xc04b('0x1a')],function(_0x2bb942){return{'model':db[_0x2bb942[_0xc04b('0x1d')]],'as':_0x2bb942['as'],'attributes':_0x2bb942[_0xc04b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc04b('0x1e')](function(_0x42ca11){logger['info']('GetDynamics365Account',_0x58ab20);logger[_0xc04b('0xd')]('GetDynamics365Account',_0x58ab20,JSON[_0xc04b('0x1f')](_0x42ca11));_0x34ddb9(_0x42ca11);})[_0xc04b('0x12')](function(_0x736522){logger[_0xc04b('0xe')](_0xc04b('0x13'),_0x736522[_0xc04b('0x10')],_0x58ab20);_0x178316(_0x1dad31[_0xc04b('0xe')](0x1f4,_0x736522[_0xc04b('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x417c6c){var _0x408271=this;return new Promise(function(_0x57c9f8,_0x5b5f99){return db[_0xc04b('0x14')][_0xc04b('0x20')]({'raw':_0x417c6c['options']?_0x417c6c[_0xc04b('0x16')][_0xc04b('0x17')]===undefined?!![]:![]:!![],'where':_0x417c6c[_0xc04b('0x16')]?_0x417c6c[_0xc04b('0x16')]['where']||null:null,'attributes':_0x417c6c[_0xc04b('0x16')]?_0x417c6c[_0xc04b('0x16')]['attributes']||null:null,'include':_0x417c6c['options']?_0x417c6c[_0xc04b('0x16')][_0xc04b('0x1a')]?_[_0xc04b('0x1c')](_0x417c6c['options'][_0xc04b('0x1a')],function(_0x41149b){return{'model':db[_0x41149b['model']],'as':_0x41149b['as'],'attributes':_0x41149b['attributes'],'include':_0x41149b[_0xc04b('0x1a')]?_['map'](_0x41149b[_0xc04b('0x1a')],function(_0x1b4fd9){return{'model':db[_0x1b4fd9[_0xc04b('0x1d')]],'as':_0x1b4fd9['as'],'attributes':_0x1b4fd9[_0xc04b('0x1b')],'include':_0x1b4fd9[_0xc04b('0x1a')]?_[_0xc04b('0x1c')](_0x1b4fd9['include'],function(_0x31a6c3){return{'model':db[_0x31a6c3[_0xc04b('0x1d')]],'as':_0x31a6c3['as'],'attributes':_0x31a6c3[_0xc04b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc04b('0x1e')](function(_0xbb4886){logger[_0xc04b('0xa')](_0xc04b('0x21'),_0x417c6c);logger['debug'](_0xc04b('0x21'),_0x417c6c,JSON[_0xc04b('0x1f')](_0xbb4886));_0x57c9f8(_0xbb4886);})['catch'](function(_0x3eb50b){logger[_0xc04b('0xe')]('ShowDynamics365Account',_0x3eb50b['message'],_0x417c6c);_0x5b5f99(_0x408271[_0xc04b('0xe')](0x1f4,_0x3eb50b['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 58f8817..ed5438f 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 _0x7cc7=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getDescriptions','post','create','update','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x33eb31,_0x5e3e73){var _0x13a592=function(_0x47ebb5){while(--_0x47ebb5){_0x33eb31['push'](_0x33eb31['shift']());}};_0x13a592(++_0x5e3e73);}(_0x7cc7,0x161));var _0x77cc=function(_0x6ec3df,_0x57159d){_0x6ec3df=_0x6ec3df-0x0;var _0x4aca8f=_0x7cc7[_0x6ec3df];return _0x4aca8f;};'use strict';var multer=require(_0x77cc('0x0'));var util=require(_0x77cc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77cc('0x2'));var router=express['Router']();var fs_extra=require(_0x77cc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x77cc('0x4'));var config=require(_0x77cc('0x5'));var controller=require(_0x77cc('0x6'));router[_0x77cc('0x7')]('/',auth[_0x77cc('0x8')](),controller[_0x77cc('0x9')]);router[_0x77cc('0x7')](_0x77cc('0xa'),auth['isAuthenticated'](),controller[_0x77cc('0xb')]);router[_0x77cc('0x7')](_0x77cc('0xc'),auth[_0x77cc('0x8')](),controller[_0x77cc('0xd')]);router[_0x77cc('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x77cc('0x7')]('/:id/descriptions',auth[_0x77cc('0x8')](),controller[_0x77cc('0xe')]);router[_0x77cc('0xf')]('/',auth['isAuthenticated'](),controller[_0x77cc('0x10')]);router['put']('/:id',auth[_0x77cc('0x8')](),controller[_0x77cc('0x11')]);router[_0x77cc('0x12')](_0x77cc('0xa'),auth[_0x77cc('0x8')](),controller[_0x77cc('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8c2d=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x5cc71f,_0x4f6f52){var _0x4e1b52=function(_0x1bea3b){while(--_0x1bea3b){_0x5cc71f['push'](_0x5cc71f['shift']());}};_0x4e1b52(++_0x4f6f52);}(_0x8c2d,0x1cb));var _0xd8c2=function(_0x52bb1e,_0x47c818){_0x52bb1e=_0x52bb1e-0x0;var _0x15d57d=_0x8c2d[_0x52bb1e];return _0x15d57d;};'use strict';var multer=require(_0xd8c2('0x0'));var util=require(_0xd8c2('0x1'));var path=require(_0xd8c2('0x2'));var timeout=require(_0xd8c2('0x3'));var express=require(_0xd8c2('0x4'));var router=express[_0xd8c2('0x5')]();var fs_extra=require(_0xd8c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8c2('0x7'));var config=require('../../config/environment');var controller=require(_0xd8c2('0x8'));router['get']('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xa')]);router['get'](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0xc')]);router[_0xd8c2('0xd')]('/:id/fields',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd8c2('0xf')]);router[_0xd8c2('0xd')](_0xd8c2('0x10'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x11')]);router[_0xd8c2('0x12')]('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x13')]);router[_0xd8c2('0x14')](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0x15')]);router[_0xd8c2('0x16')](_0xd8c2('0xb'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0a55a85..eecbef7 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 _0xdf8d=['phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0x4e27e0,_0x14cfee){var _0x23d360=function(_0x26e7b0){while(--_0x26e7b0){_0x4e27e0['push'](_0x4e27e0['shift']());}};_0x23d360(++_0x14cfee);}(_0xdf8d,0x15a));var _0xddf8=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xdf8d[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0xddf8('0x0'));module[_0xddf8('0x1')]={'name':{'type':Sequelize[_0xddf8('0x2')]},'description':{'type':Sequelize[_0xddf8('0x2')]},'ticketType':{'type':Sequelize[_0xddf8('0x3')](_0xddf8('0x4'),_0xddf8('0x5')),'defaultValue':_0xddf8('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xddf8('0x6'),_0xddf8('0x7')),'defaultValue':_0xddf8('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xddf8('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xddf8('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe477=['BOOLEAN','sequelize','exports','STRING','ENUM','incident','contact'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe477,0x17b));var _0x7e47=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xe477[_0x22b8a3];return _0x199a0c;};'use strict';var Sequelize=require(_0x7e47('0x0'));module[_0x7e47('0x1')]={'name':{'type':Sequelize[_0x7e47('0x2')]},'description':{'type':Sequelize[_0x7e47('0x2')]},'ticketType':{'type':Sequelize[_0x7e47('0x3')](_0x7e47('0x4'),'phonecall'),'defaultValue':_0x7e47('0x4')},'moduleCreate':{'type':Sequelize[_0x7e47('0x3')](_0x7e47('0x5'),'nothing'),'defaultValue':_0x7e47('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7e47('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7e47('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a5f9c30..a18cc61 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 _0x911e=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','options','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','Dynamics365Field','getDescriptions','rimraf','fast-json-patch','request-promise','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x911e,0x10b));var _0xe911=function(_0x195123,_0x52a9e0){_0x195123=_0x195123-0x0;var _0x399653=_0x911e[_0x195123];return _0x399653;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe911('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe911('0x1'));var rp=require(_0xe911('0x2'));var moment=require('moment');var BPromise=require(_0xe911('0x3'));var Mustache=require(_0xe911('0x4'));var util=require(_0xe911('0x5'));var path=require(_0xe911('0x6'));var sox=require(_0xe911('0x7'));var csv=require(_0xe911('0x8'));var ejs=require(_0xe911('0x9'));var fs=require('fs');var fs_extra=require(_0xe911('0xa'));var _=require(_0xe911('0xb'));var squel=require(_0xe911('0xc'));var crypto=require(_0xe911('0xd'));var jsforce=require(_0xe911('0xe'));var deskjs=require(_0xe911('0xf'));var toCsv=require(_0xe911('0x8'));var querystring=require(_0xe911('0x10'));var Papa=require(_0xe911('0x11'));var Redis=require(_0xe911('0x12'));var authService=require(_0xe911('0x13'));var qs=require(_0xe911('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe911('0x15'));var logger=require(_0xe911('0x16'))(_0xe911('0x17'));var utils=require(_0xe911('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe911('0x19'));var db=require(_0xe911('0x1a'))['db'];function respondWithStatusCode(_0x23d6d5,_0x7de405){_0x7de405=_0x7de405||0xcc;return function(_0x12196f){if(_0x12196f){return _0x23d6d5[_0xe911('0x1b')](_0x7de405);}return _0x23d6d5[_0xe911('0x1c')](_0x7de405)['end']();};}function respondWithResult(_0x50e7f5,_0x406e1a){_0x406e1a=_0x406e1a||0xc8;return function(_0x4ef93b){if(_0x4ef93b){return _0x50e7f5['status'](_0x406e1a)[_0xe911('0x1d')](_0x4ef93b);}};}function respondWithFilteredResult(_0x4e97e2,_0x20c252){return function(_0x35066a){if(_0x35066a){var _0x49528b=typeof _0x20c252[_0xe911('0x1e')]==='undefined'&&typeof _0x20c252[_0xe911('0x1f')]==='undefined';var _0x14f132=_0x35066a[_0xe911('0x20')];var _0x392dc5=_0x49528b?0x0:_0x20c252[_0xe911('0x1e')];var _0xa2f86a=_0x49528b?_0x35066a[_0xe911('0x20')]:_0x20c252['offset']+_0x20c252[_0xe911('0x1f')];var _0x5af5a8;if(_0xa2f86a>=_0x14f132){_0xa2f86a=_0x14f132;_0x5af5a8=0xc8;}else{_0x5af5a8=0xce;}_0x4e97e2[_0xe911('0x1c')](_0x5af5a8);return _0x4e97e2['set']('Content-Range',_0x392dc5+'-'+_0xa2f86a+'/'+_0x14f132)[_0xe911('0x1d')](_0x35066a);}return null;};}function patchUpdates(_0x49e2c6){return function(_0x4d8bed){try{jsonpatch[_0xe911('0x21')](_0x4d8bed,_0x49e2c6,!![]);}catch(_0x38ea0e){return BPromise[_0xe911('0x22')](_0x38ea0e);}return _0x4d8bed['save']();};}function saveUpdates(_0x3ebe63,_0x303970){return function(_0x144184){if(_0x144184){return _0x144184[_0xe911('0x23')](_0x3ebe63)[_0xe911('0x24')](function(_0x341e35){return _0x341e35;});}return null;};}function removeEntity(_0x23721a,_0x92350){return function(_0x3ae70c){if(_0x3ae70c){return _0x3ae70c[_0xe911('0x25')]()[_0xe911('0x24')](function(){_0x23721a['status'](0xcc)[_0xe911('0x26')]();});}};}function handleEntityNotFound(_0x4de8e0,_0x170de5){return function(_0x551b4e){if(!_0x551b4e){_0x4de8e0[_0xe911('0x1b')](0x194);}return _0x551b4e;};}function handleError(_0x22a560,_0x5de78d){_0x5de78d=_0x5de78d||0x1f4;return function(_0xd553c7){logger[_0xe911('0x27')](_0xd553c7[_0xe911('0x28')]);if(_0xd553c7[_0xe911('0x29')]){delete _0xd553c7[_0xe911('0x29')];}_0x22a560[_0xe911('0x1c')](_0x5de78d)[_0xe911('0x2a')](_0xd553c7);};}exports[_0xe911('0x2b')]=function(_0x31e158,_0x3ae67a){var _0x55ff6d={},_0x3fbb33={},_0x446762={'count':0x0,'rows':[]};var _0x4ac6e5=_[_0xe911('0x2c')](db[_0xe911('0x2d')][_0xe911('0x2e')],function(_0x33faa2){return{'name':_0x33faa2[_0xe911('0x2f')],'type':_0x33faa2[_0xe911('0x30')][_0xe911('0x31')]};});_0x3fbb33[_0xe911('0x32')]=_['map'](_0x4ac6e5,_0xe911('0x29'));_0x3fbb33['query']=_[_0xe911('0x33')](_0x31e158['query']);_0x3fbb33[_0xe911('0x34')]=_[_0xe911('0x35')](_0x3fbb33['model'],_0x3fbb33[_0xe911('0x36')]);_0x55ff6d['attributes']=_['intersection'](_0x3fbb33[_0xe911('0x32')],qs['fields'](_0x31e158[_0xe911('0x36')][_0xe911('0x37')]));_0x55ff6d[_0xe911('0x38')]=_0x55ff6d[_0xe911('0x38')][_0xe911('0x39')]?_0x55ff6d[_0xe911('0x38')]:_0x3fbb33['model'];if(!_0x31e158[_0xe911('0x36')]['hasOwnProperty'](_0xe911('0x3a'))){_0x55ff6d[_0xe911('0x1f')]=qs[_0xe911('0x1f')](_0x31e158[_0xe911('0x36')][_0xe911('0x1f')]);_0x55ff6d[_0xe911('0x1e')]=qs[_0xe911('0x1e')](_0x31e158[_0xe911('0x36')][_0xe911('0x1e')]);}_0x55ff6d[_0xe911('0x3b')]=qs[_0xe911('0x3c')](_0x31e158['query'][_0xe911('0x3c')]);_0x55ff6d[_0xe911('0x3d')]=qs[_0xe911('0x34')](_[_0xe911('0x3e')](_0x31e158[_0xe911('0x36')],_0x3fbb33['filters']),_0x4ac6e5);if(_0x31e158[_0xe911('0x36')][_0xe911('0x3f')]){_0x55ff6d[_0xe911('0x3d')]=_[_0xe911('0x40')](_0x55ff6d['where'],{'$or':_[_0xe911('0x2c')](_0x4ac6e5,function(_0x35a12c){if(_0x35a12c[_0xe911('0x30')]!==_0xe911('0x41')){var _0x4d88f4={};_0x4d88f4[_0x35a12c[_0xe911('0x29')]]={'$like':'%'+_0x31e158[_0xe911('0x36')][_0xe911('0x3f')]+'%'};return _0x4d88f4;}})});}_0x55ff6d=_['merge']({},_0x55ff6d,_0x31e158['options']);var _0x2cd1c5={'where':_0x55ff6d['where']};return db['Dynamics365Configuration'][_0xe911('0x20')](_0x2cd1c5)[_0xe911('0x24')](function(_0x4866e9){_0x446762[_0xe911('0x20')]=_0x4866e9;if(_0x31e158[_0xe911('0x36')]['includeAll']){_0x55ff6d[_0xe911('0x42')]=[{'all':!![]}];}return db[_0xe911('0x2d')]['findAll'](_0x55ff6d);})[_0xe911('0x24')](function(_0x3efedf){_0x446762[_0xe911('0x43')]=_0x3efedf;return _0x446762;})[_0xe911('0x24')](respondWithFilteredResult(_0x3ae67a,_0x55ff6d))[_0xe911('0x44')](handleError(_0x3ae67a,null));};exports[_0xe911('0x45')]=function(_0x31f8f3,_0x1594c0){var _0x43b2af={'raw':![],'where':{'id':_0x31f8f3[_0xe911('0x46')]['id']}},_0x301872={};_0x301872[_0xe911('0x32')]=_[_0xe911('0x33')](db[_0xe911('0x2d')]['rawAttributes']);_0x301872[_0xe911('0x36')]=_['keys'](_0x31f8f3[_0xe911('0x36')]);_0x301872[_0xe911('0x34')]=_[_0xe911('0x35')](_0x301872[_0xe911('0x32')],_0x301872[_0xe911('0x36')]);_0x43b2af[_0xe911('0x38')]=_[_0xe911('0x35')](_0x301872[_0xe911('0x32')],qs[_0xe911('0x37')](_0x31f8f3[_0xe911('0x36')][_0xe911('0x37')]));_0x43b2af[_0xe911('0x38')]=_0x43b2af['attributes'][_0xe911('0x39')]?_0x43b2af[_0xe911('0x38')]:_0x301872[_0xe911('0x32')];if(_0x31f8f3[_0xe911('0x36')]['includeAll']){_0x43b2af['include']=[{'all':!![]}];}_0x43b2af=_['merge']({},_0x43b2af,_0x31f8f3[_0xe911('0x47')]);return db['Dynamics365Configuration']['find'](_0x43b2af)[_0xe911('0x24')](handleEntityNotFound(_0x1594c0,null))[_0xe911('0x24')](respondWithResult(_0x1594c0,null))[_0xe911('0x44')](handleError(_0x1594c0,null));};exports['create']=function(_0xe7cbcc,_0x1af139){return db[_0xe911('0x2d')][_0xe911('0x48')](_0xe7cbcc[_0xe911('0x49')],{})['then'](respondWithResult(_0x1af139,0xc9))['catch'](handleError(_0x1af139,null));};exports[_0xe911('0x23')]=function(_0x598def,_0xe092ec){if(_0x598def[_0xe911('0x49')]['id']){delete _0x598def[_0xe911('0x49')]['id'];}return db[_0xe911('0x2d')][_0xe911('0x4a')]({'where':{'id':_0x598def[_0xe911('0x46')]['id']}})['then'](handleEntityNotFound(_0xe092ec,null))[_0xe911('0x24')](saveUpdates(_0x598def[_0xe911('0x49')],null))['then'](respondWithResult(_0xe092ec,null))[_0xe911('0x44')](handleError(_0xe092ec,null));};exports[_0xe911('0x25')]=function(_0x2dbb29,_0xaf970c){return db[_0xe911('0x2d')]['find']({'where':{'id':_0x2dbb29['params']['id']}})[_0xe911('0x24')](handleEntityNotFound(_0xaf970c,null))[_0xe911('0x24')](removeEntity(_0xaf970c,null))[_0xe911('0x44')](handleError(_0xaf970c,null));};exports[_0xe911('0x4b')]=function(_0x313ace,_0x4c9393,_0x29c80b){var _0x3d52ea={};var _0xc71130={};var _0x26c97e;var _0x1a18e7;return db[_0xe911('0x2d')][_0xe911('0x4c')]({'where':{'id':_0x313ace[_0xe911('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c9393,null))['then'](function(_0x127c51){if(_0x127c51){_0x26c97e=_0x127c51;_0xc71130['model']=_[_0xe911('0x33')](db['Dynamics365Field'][_0xe911('0x2e')]);_0xc71130[_0xe911('0x36')]=_['keys'](_0x313ace[_0xe911('0x36')]);_0xc71130[_0xe911('0x34')]=_[_0xe911('0x35')](_0xc71130['model'],_0xc71130[_0xe911('0x36')]);_0x3d52ea['attributes']=_['intersection'](_0xc71130['model'],qs[_0xe911('0x37')](_0x313ace['query'][_0xe911('0x37')]));_0x3d52ea['attributes']=_0x3d52ea[_0xe911('0x38')][_0xe911('0x39')]?_0x3d52ea[_0xe911('0x38')]:_0xc71130[_0xe911('0x32')];_0x3d52ea['order']=qs[_0xe911('0x3c')](_0x313ace[_0xe911('0x36')]['sort']);_0x3d52ea[_0xe911('0x3d')]=qs[_0xe911('0x34')](_[_0xe911('0x3e')](_0x313ace['query'],_0xc71130[_0xe911('0x34')]));if(_0x313ace['query'][_0xe911('0x3f')]){_0x3d52ea['where']=_[_0xe911('0x40')](_0x3d52ea[_0xe911('0x3d')],{'$or':_[_0xe911('0x2c')](_0x3d52ea[_0xe911('0x38')],function(_0x5613a6){var _0x55cb2e={};_0x55cb2e[_0x5613a6]={'$like':'%'+_0x313ace[_0xe911('0x36')][_0xe911('0x3f')]+'%'};return _0x55cb2e;})});}_0x3d52ea=_[_0xe911('0x40')]({},_0x3d52ea,_0x313ace[_0xe911('0x47')]);return _0x26c97e[_0xe911('0x4b')](_0x3d52ea);}})[_0xe911('0x24')](function(_0x5ed223){if(_0x5ed223){_0x1a18e7=_0x5ed223['length'];if(!_0x313ace['query'][_0xe911('0x4d')]('nolimit')){_0x3d52ea['limit']=qs[_0xe911('0x1f')](_0x313ace[_0xe911('0x36')][_0xe911('0x1f')]);_0x3d52ea[_0xe911('0x1e')]=qs[_0xe911('0x1e')](_0x313ace[_0xe911('0x36')][_0xe911('0x1e')]);}return _0x26c97e[_0xe911('0x4b')](_0x3d52ea);}})[_0xe911('0x24')](function(_0x50cd8f){if(_0x50cd8f){return _0x50cd8f?{'count':_0x1a18e7,'rows':_0x50cd8f}:null;}})[_0xe911('0x24')](respondWithResult(_0x4c9393,null))[_0xe911('0x44')](handleError(_0x4c9393,null));};exports[_0xe911('0x4e')]=function(_0x49e400,_0x31dbed,_0x37be74){var _0x3749cc={};var _0xa2f616={};var _0xb43413;var _0x55b49b;return db[_0xe911('0x2d')][_0xe911('0x4c')]({'where':{'id':_0x49e400[_0xe911('0x46')]['id']}})[_0xe911('0x24')](handleEntityNotFound(_0x31dbed,null))[_0xe911('0x24')](function(_0x2a50f9){if(_0x2a50f9){_0xb43413=_0x2a50f9;_0xa2f616[_0xe911('0x32')]=_['keys'](db[_0xe911('0x4f')]['rawAttributes']);_0xa2f616['query']=_['keys'](_0x49e400[_0xe911('0x36')]);_0xa2f616[_0xe911('0x34')]=_['intersection'](_0xa2f616['model'],_0xa2f616[_0xe911('0x36')]);_0x3749cc[_0xe911('0x38')]=_[_0xe911('0x35')](_0xa2f616['model'],qs['fields'](_0x49e400[_0xe911('0x36')]['fields']));_0x3749cc[_0xe911('0x38')]=_0x3749cc[_0xe911('0x38')][_0xe911('0x39')]?_0x3749cc['attributes']:_0xa2f616['model'];_0x3749cc[_0xe911('0x3b')]=qs[_0xe911('0x3c')](_0x49e400[_0xe911('0x36')][_0xe911('0x3c')]);_0x3749cc[_0xe911('0x3d')]=qs['filters'](_[_0xe911('0x3e')](_0x49e400['query'],_0xa2f616[_0xe911('0x34')]));if(_0x49e400[_0xe911('0x36')][_0xe911('0x3f')]){_0x3749cc[_0xe911('0x3d')]=_[_0xe911('0x40')](_0x3749cc[_0xe911('0x3d')],{'$or':_[_0xe911('0x2c')](_0x3749cc[_0xe911('0x38')],function(_0x5a56cb){var _0x2886c9={};_0x2886c9[_0x5a56cb]={'$like':'%'+_0x49e400[_0xe911('0x36')][_0xe911('0x3f')]+'%'};return _0x2886c9;})});}_0x3749cc=_[_0xe911('0x40')]({},_0x3749cc,_0x49e400[_0xe911('0x47')]);return _0xb43413[_0xe911('0x4e')](_0x3749cc);}})[_0xe911('0x24')](function(_0x1f14ad){if(_0x1f14ad){_0x55b49b=_0x1f14ad['length'];if(!_0x49e400[_0xe911('0x36')]['hasOwnProperty'](_0xe911('0x3a'))){_0x3749cc[_0xe911('0x1f')]=qs[_0xe911('0x1f')](_0x49e400[_0xe911('0x36')][_0xe911('0x1f')]);_0x3749cc['offset']=qs['offset'](_0x49e400['query'][_0xe911('0x1e')]);}return _0xb43413['getSubjects'](_0x3749cc);}})[_0xe911('0x24')](function(_0x112bfc){if(_0x112bfc){return _0x112bfc?{'count':_0x55b49b,'rows':_0x112bfc}:null;}})[_0xe911('0x24')](respondWithResult(_0x31dbed,null))[_0xe911('0x44')](handleError(_0x31dbed,null));};exports[_0xe911('0x50')]=function(_0x2369d1,_0x5460cd,_0x893a8){var _0x43e3cf={};var _0x1fa380={};var _0x16ff10;var _0xf5b3b8;return db[_0xe911('0x2d')][_0xe911('0x4c')]({'where':{'id':_0x2369d1['params']['id']}})[_0xe911('0x24')](handleEntityNotFound(_0x5460cd,null))[_0xe911('0x24')](function(_0x36acb9){if(_0x36acb9){_0x16ff10=_0x36acb9;_0x1fa380['model']=_[_0xe911('0x33')](db[_0xe911('0x4f')][_0xe911('0x2e')]);_0x1fa380['query']=_[_0xe911('0x33')](_0x2369d1[_0xe911('0x36')]);_0x1fa380['filters']=_[_0xe911('0x35')](_0x1fa380['model'],_0x1fa380[_0xe911('0x36')]);_0x43e3cf[_0xe911('0x38')]=_[_0xe911('0x35')](_0x1fa380[_0xe911('0x32')],qs[_0xe911('0x37')](_0x2369d1[_0xe911('0x36')][_0xe911('0x37')]));_0x43e3cf[_0xe911('0x38')]=_0x43e3cf['attributes'][_0xe911('0x39')]?_0x43e3cf[_0xe911('0x38')]:_0x1fa380[_0xe911('0x32')];_0x43e3cf[_0xe911('0x3b')]=qs['sort'](_0x2369d1[_0xe911('0x36')][_0xe911('0x3c')]);_0x43e3cf[_0xe911('0x3d')]=qs[_0xe911('0x34')](_[_0xe911('0x3e')](_0x2369d1[_0xe911('0x36')],_0x1fa380[_0xe911('0x34')]));if(_0x2369d1[_0xe911('0x36')][_0xe911('0x3f')]){_0x43e3cf[_0xe911('0x3d')]=_[_0xe911('0x40')](_0x43e3cf[_0xe911('0x3d')],{'$or':_[_0xe911('0x2c')](_0x43e3cf[_0xe911('0x38')],function(_0x407072){var _0x2384bc={};_0x2384bc[_0x407072]={'$like':'%'+_0x2369d1['query'][_0xe911('0x3f')]+'%'};return _0x2384bc;})});}_0x43e3cf=_['merge']({},_0x43e3cf,_0x2369d1[_0xe911('0x47')]);return _0x16ff10[_0xe911('0x50')](_0x43e3cf);}})[_0xe911('0x24')](function(_0x5a6c0f){if(_0x5a6c0f){_0xf5b3b8=_0x5a6c0f[_0xe911('0x39')];if(!_0x2369d1[_0xe911('0x36')][_0xe911('0x4d')](_0xe911('0x3a'))){_0x43e3cf[_0xe911('0x1f')]=qs['limit'](_0x2369d1[_0xe911('0x36')][_0xe911('0x1f')]);_0x43e3cf[_0xe911('0x1e')]=qs[_0xe911('0x1e')](_0x2369d1[_0xe911('0x36')][_0xe911('0x1e')]);}return _0x16ff10['getDescriptions'](_0x43e3cf);}})[_0xe911('0x24')](function(_0x205743){if(_0x205743){return _0x205743?{'count':_0xf5b3b8,'rows':_0x205743}:null;}})[_0xe911('0x24')](respondWithResult(_0x5460cd,null))[_0xe911('0x44')](handleError(_0x5460cd,null));}; \ No newline at end of file +var _0xba30=['findAll','rows','show','params','rawAttributes','intersection','length','includeAll','find','create','body','update','catch','getFields','findOne','Dynamics365Field','where','hasOwnProperty','getSubjects','getDescriptions','request-promise','moment','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','query','keys','filters','model','attributes','fields','nolimit','order','sort','pick','type','filter','merge','options','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba30,0x1e8));var _0x0ba3=function(_0x1259c4,_0x14cb41){_0x1259c4=_0x1259c4-0x0;var _0x27eba2=_0xba30[_0x1259c4];return _0x27eba2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ba3('0x0'));var moment=require(_0x0ba3('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0ba3('0x2'));var sox=require(_0x0ba3('0x3'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ba3('0x4'));var _=require(_0x0ba3('0x5'));var squel=require(_0x0ba3('0x6'));var crypto=require(_0x0ba3('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x0ba3('0x8'));var toCsv=require(_0x0ba3('0x9'));var querystring=require(_0x0ba3('0xa'));var Papa=require(_0x0ba3('0xb'));var Redis=require(_0x0ba3('0xc'));var authService=require(_0x0ba3('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0ba3('0xe'));var hardwareService=require(_0x0ba3('0xf'));var logger=require(_0x0ba3('0x10'))(_0x0ba3('0x11'));var utils=require(_0x0ba3('0x12'));var config=require(_0x0ba3('0x13'));var licenseUtil=require(_0x0ba3('0x14'));var db=require(_0x0ba3('0x15'))['db'];function respondWithStatusCode(_0x3fad44,_0x23917f){_0x23917f=_0x23917f||0xcc;return function(_0x1a2e9f){if(_0x1a2e9f){return _0x3fad44['sendStatus'](_0x23917f);}return _0x3fad44['status'](_0x23917f)[_0x0ba3('0x16')]();};}function respondWithResult(_0x2715fb,_0x20a2c2){_0x20a2c2=_0x20a2c2||0xc8;return function(_0x597b65){if(_0x597b65){return _0x2715fb[_0x0ba3('0x17')](_0x20a2c2)[_0x0ba3('0x18')](_0x597b65);}};}function respondWithFilteredResult(_0x4607d0,_0x1f7cea){return function(_0x4bde05){if(_0x4bde05){var _0x38e884=typeof _0x1f7cea['offset']===_0x0ba3('0x19')&&typeof _0x1f7cea['limit']==='undefined';var _0x357e2f=_0x4bde05['count'];var _0x26848b=_0x38e884?0x0:_0x1f7cea[_0x0ba3('0x1a')];var _0x3875f0=_0x38e884?_0x4bde05['count']:_0x1f7cea[_0x0ba3('0x1a')]+_0x1f7cea[_0x0ba3('0x1b')];var _0x37c661;if(_0x3875f0>=_0x357e2f){_0x3875f0=_0x357e2f;_0x37c661=0xc8;}else{_0x37c661=0xce;}_0x4607d0['status'](_0x37c661);return _0x4607d0['set']('Content-Range',_0x26848b+'-'+_0x3875f0+'/'+_0x357e2f)[_0x0ba3('0x18')](_0x4bde05);}return null;};}function patchUpdates(_0x4d8676){return function(_0x3c33f5){try{jsonpatch[_0x0ba3('0x1c')](_0x3c33f5,_0x4d8676,!![]);}catch(_0x393ec7){return BPromise[_0x0ba3('0x1d')](_0x393ec7);}return _0x3c33f5[_0x0ba3('0x1e')]();};}function saveUpdates(_0x11c4a3,_0x5987a1){return function(_0x14f12b){if(_0x14f12b){return _0x14f12b['update'](_0x11c4a3)[_0x0ba3('0x1f')](function(_0x1c4173){return _0x1c4173;});}return null;};}function removeEntity(_0x2bc19e,_0x12775a){return function(_0x574003){if(_0x574003){return _0x574003[_0x0ba3('0x20')]()['then'](function(){_0x2bc19e[_0x0ba3('0x17')](0xcc)[_0x0ba3('0x16')]();});}};}function handleEntityNotFound(_0xcfdd54,_0x2477b6){return function(_0x48ddc0){if(!_0x48ddc0){_0xcfdd54[_0x0ba3('0x21')](0x194);}return _0x48ddc0;};}function handleError(_0x5c6afa,_0x12676e){_0x12676e=_0x12676e||0x1f4;return function(_0x49e6b2){logger[_0x0ba3('0x22')](_0x49e6b2[_0x0ba3('0x23')]);if(_0x49e6b2[_0x0ba3('0x24')]){delete _0x49e6b2[_0x0ba3('0x24')];}_0x5c6afa[_0x0ba3('0x17')](_0x12676e)[_0x0ba3('0x25')](_0x49e6b2);};}exports[_0x0ba3('0x26')]=function(_0x40462b,_0x5941d1){var _0x24718b={},_0x1bd26a={},_0x49caea={'count':0x0,'rows':[]};var _0x5bf8dc=_[_0x0ba3('0x27')](db[_0x0ba3('0x28')]['rawAttributes'],function(_0x2294a7){return{'name':_0x2294a7[_0x0ba3('0x29')],'type':_0x2294a7['type'][_0x0ba3('0x2a')]};});_0x1bd26a['model']=_[_0x0ba3('0x27')](_0x5bf8dc,'name');_0x1bd26a[_0x0ba3('0x2b')]=_[_0x0ba3('0x2c')](_0x40462b['query']);_0x1bd26a[_0x0ba3('0x2d')]=_['intersection'](_0x1bd26a[_0x0ba3('0x2e')],_0x1bd26a[_0x0ba3('0x2b')]);_0x24718b[_0x0ba3('0x2f')]=_['intersection'](_0x1bd26a[_0x0ba3('0x2e')],qs['fields'](_0x40462b[_0x0ba3('0x2b')][_0x0ba3('0x30')]));_0x24718b[_0x0ba3('0x2f')]=_0x24718b[_0x0ba3('0x2f')]['length']?_0x24718b[_0x0ba3('0x2f')]:_0x1bd26a[_0x0ba3('0x2e')];if(!_0x40462b[_0x0ba3('0x2b')]['hasOwnProperty'](_0x0ba3('0x31'))){_0x24718b[_0x0ba3('0x1b')]=qs[_0x0ba3('0x1b')](_0x40462b[_0x0ba3('0x2b')][_0x0ba3('0x1b')]);_0x24718b['offset']=qs[_0x0ba3('0x1a')](_0x40462b[_0x0ba3('0x2b')]['offset']);}_0x24718b[_0x0ba3('0x32')]=qs[_0x0ba3('0x33')](_0x40462b['query'][_0x0ba3('0x33')]);_0x24718b['where']=qs[_0x0ba3('0x2d')](_[_0x0ba3('0x34')](_0x40462b[_0x0ba3('0x2b')],_0x1bd26a['filters']),_0x5bf8dc);if(_0x40462b[_0x0ba3('0x2b')]['filter']){_0x24718b['where']=_['merge'](_0x24718b['where'],{'$or':_[_0x0ba3('0x27')](_0x5bf8dc,function(_0x174abe){if(_0x174abe[_0x0ba3('0x35')]!=='VIRTUAL'){var _0x333aa3={};_0x333aa3[_0x174abe[_0x0ba3('0x24')]]={'$like':'%'+_0x40462b[_0x0ba3('0x2b')][_0x0ba3('0x36')]+'%'};return _0x333aa3;}})});}_0x24718b=_[_0x0ba3('0x37')]({},_0x24718b,_0x40462b[_0x0ba3('0x38')]);var _0x35f9da={'where':_0x24718b['where']};return db['Dynamics365Configuration']['count'](_0x35f9da)[_0x0ba3('0x1f')](function(_0x195be1){_0x49caea['count']=_0x195be1;if(_0x40462b['query']['includeAll']){_0x24718b[_0x0ba3('0x39')]=[{'all':!![]}];}return db[_0x0ba3('0x28')][_0x0ba3('0x3a')](_0x24718b);})['then'](function(_0x29368c){_0x49caea[_0x0ba3('0x3b')]=_0x29368c;return _0x49caea;})[_0x0ba3('0x1f')](respondWithFilteredResult(_0x5941d1,_0x24718b))['catch'](handleError(_0x5941d1,null));};exports[_0x0ba3('0x3c')]=function(_0x4107a5,_0x13c11f){var _0x22c32b={'raw':![],'where':{'id':_0x4107a5[_0x0ba3('0x3d')]['id']}},_0x33251d={};_0x33251d[_0x0ba3('0x2e')]=_[_0x0ba3('0x2c')](db[_0x0ba3('0x28')][_0x0ba3('0x3e')]);_0x33251d['query']=_[_0x0ba3('0x2c')](_0x4107a5[_0x0ba3('0x2b')]);_0x33251d[_0x0ba3('0x2d')]=_[_0x0ba3('0x3f')](_0x33251d[_0x0ba3('0x2e')],_0x33251d['query']);_0x22c32b[_0x0ba3('0x2f')]=_[_0x0ba3('0x3f')](_0x33251d[_0x0ba3('0x2e')],qs[_0x0ba3('0x30')](_0x4107a5[_0x0ba3('0x2b')][_0x0ba3('0x30')]));_0x22c32b[_0x0ba3('0x2f')]=_0x22c32b[_0x0ba3('0x2f')][_0x0ba3('0x40')]?_0x22c32b[_0x0ba3('0x2f')]:_0x33251d['model'];if(_0x4107a5[_0x0ba3('0x2b')][_0x0ba3('0x41')]){_0x22c32b[_0x0ba3('0x39')]=[{'all':!![]}];}_0x22c32b=_[_0x0ba3('0x37')]({},_0x22c32b,_0x4107a5['options']);return db[_0x0ba3('0x28')][_0x0ba3('0x42')](_0x22c32b)[_0x0ba3('0x1f')](handleEntityNotFound(_0x13c11f,null))[_0x0ba3('0x1f')](respondWithResult(_0x13c11f,null))['catch'](handleError(_0x13c11f,null));};exports[_0x0ba3('0x43')]=function(_0x5a5f68,_0x5cefd4){return db['Dynamics365Configuration'][_0x0ba3('0x43')](_0x5a5f68[_0x0ba3('0x44')],{})[_0x0ba3('0x1f')](respondWithResult(_0x5cefd4,0xc9))['catch'](handleError(_0x5cefd4,null));};exports[_0x0ba3('0x45')]=function(_0x5e37ed,_0x6de259){if(_0x5e37ed[_0x0ba3('0x44')]['id']){delete _0x5e37ed[_0x0ba3('0x44')]['id'];}return db[_0x0ba3('0x28')][_0x0ba3('0x42')]({'where':{'id':_0x5e37ed[_0x0ba3('0x3d')]['id']}})[_0x0ba3('0x1f')](handleEntityNotFound(_0x6de259,null))[_0x0ba3('0x1f')](saveUpdates(_0x5e37ed['body'],null))['then'](respondWithResult(_0x6de259,null))['catch'](handleError(_0x6de259,null));};exports['destroy']=function(_0x1db676,_0x415cbc){return db[_0x0ba3('0x28')]['find']({'where':{'id':_0x1db676[_0x0ba3('0x3d')]['id']}})[_0x0ba3('0x1f')](handleEntityNotFound(_0x415cbc,null))[_0x0ba3('0x1f')](removeEntity(_0x415cbc,null))[_0x0ba3('0x46')](handleError(_0x415cbc,null));};exports[_0x0ba3('0x47')]=function(_0x224603,_0x434086,_0x19395b){var _0x58ea77={};var _0x40a098={};var _0x34cc13;var _0x8be1b3;return db['Dynamics365Configuration'][_0x0ba3('0x48')]({'where':{'id':_0x224603[_0x0ba3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x434086,null))[_0x0ba3('0x1f')](function(_0x2d7520){if(_0x2d7520){_0x34cc13=_0x2d7520;_0x40a098[_0x0ba3('0x2e')]=_['keys'](db[_0x0ba3('0x49')][_0x0ba3('0x3e')]);_0x40a098[_0x0ba3('0x2b')]=_['keys'](_0x224603[_0x0ba3('0x2b')]);_0x40a098[_0x0ba3('0x2d')]=_['intersection'](_0x40a098[_0x0ba3('0x2e')],_0x40a098[_0x0ba3('0x2b')]);_0x58ea77[_0x0ba3('0x2f')]=_['intersection'](_0x40a098['model'],qs[_0x0ba3('0x30')](_0x224603[_0x0ba3('0x2b')]['fields']));_0x58ea77[_0x0ba3('0x2f')]=_0x58ea77[_0x0ba3('0x2f')][_0x0ba3('0x40')]?_0x58ea77[_0x0ba3('0x2f')]:_0x40a098[_0x0ba3('0x2e')];_0x58ea77['order']=qs['sort'](_0x224603[_0x0ba3('0x2b')][_0x0ba3('0x33')]);_0x58ea77[_0x0ba3('0x4a')]=qs['filters'](_[_0x0ba3('0x34')](_0x224603['query'],_0x40a098[_0x0ba3('0x2d')]));if(_0x224603[_0x0ba3('0x2b')][_0x0ba3('0x36')]){_0x58ea77[_0x0ba3('0x4a')]=_['merge'](_0x58ea77[_0x0ba3('0x4a')],{'$or':_[_0x0ba3('0x27')](_0x58ea77[_0x0ba3('0x2f')],function(_0x384f32){var _0x1587d7={};_0x1587d7[_0x384f32]={'$like':'%'+_0x224603[_0x0ba3('0x2b')][_0x0ba3('0x36')]+'%'};return _0x1587d7;})});}_0x58ea77=_[_0x0ba3('0x37')]({},_0x58ea77,_0x224603[_0x0ba3('0x38')]);return _0x34cc13[_0x0ba3('0x47')](_0x58ea77);}})['then'](function(_0x25a7b3){if(_0x25a7b3){_0x8be1b3=_0x25a7b3[_0x0ba3('0x40')];if(!_0x224603['query'][_0x0ba3('0x4b')](_0x0ba3('0x31'))){_0x58ea77[_0x0ba3('0x1b')]=qs[_0x0ba3('0x1b')](_0x224603[_0x0ba3('0x2b')][_0x0ba3('0x1b')]);_0x58ea77[_0x0ba3('0x1a')]=qs[_0x0ba3('0x1a')](_0x224603[_0x0ba3('0x2b')]['offset']);}return _0x34cc13[_0x0ba3('0x47')](_0x58ea77);}})['then'](function(_0x1dbf30){if(_0x1dbf30){return _0x1dbf30?{'count':_0x8be1b3,'rows':_0x1dbf30}:null;}})[_0x0ba3('0x1f')](respondWithResult(_0x434086,null))[_0x0ba3('0x46')](handleError(_0x434086,null));};exports[_0x0ba3('0x4c')]=function(_0x4d0cd5,_0x2bd5d1,_0x65b7ed){var _0x1d3419={};var _0x4c87e2={};var _0x24a854;var _0x2c94d8;return db[_0x0ba3('0x28')][_0x0ba3('0x48')]({'where':{'id':_0x4d0cd5[_0x0ba3('0x3d')]['id']}})[_0x0ba3('0x1f')](handleEntityNotFound(_0x2bd5d1,null))['then'](function(_0x252cb2){if(_0x252cb2){_0x24a854=_0x252cb2;_0x4c87e2[_0x0ba3('0x2e')]=_[_0x0ba3('0x2c')](db[_0x0ba3('0x49')][_0x0ba3('0x3e')]);_0x4c87e2[_0x0ba3('0x2b')]=_[_0x0ba3('0x2c')](_0x4d0cd5[_0x0ba3('0x2b')]);_0x4c87e2['filters']=_['intersection'](_0x4c87e2[_0x0ba3('0x2e')],_0x4c87e2[_0x0ba3('0x2b')]);_0x1d3419[_0x0ba3('0x2f')]=_[_0x0ba3('0x3f')](_0x4c87e2[_0x0ba3('0x2e')],qs[_0x0ba3('0x30')](_0x4d0cd5[_0x0ba3('0x2b')][_0x0ba3('0x30')]));_0x1d3419[_0x0ba3('0x2f')]=_0x1d3419[_0x0ba3('0x2f')]['length']?_0x1d3419[_0x0ba3('0x2f')]:_0x4c87e2['model'];_0x1d3419[_0x0ba3('0x32')]=qs[_0x0ba3('0x33')](_0x4d0cd5['query'][_0x0ba3('0x33')]);_0x1d3419[_0x0ba3('0x4a')]=qs['filters'](_['pick'](_0x4d0cd5[_0x0ba3('0x2b')],_0x4c87e2[_0x0ba3('0x2d')]));if(_0x4d0cd5[_0x0ba3('0x2b')][_0x0ba3('0x36')]){_0x1d3419['where']=_[_0x0ba3('0x37')](_0x1d3419[_0x0ba3('0x4a')],{'$or':_[_0x0ba3('0x27')](_0x1d3419[_0x0ba3('0x2f')],function(_0x4953c2){var _0x2434ce={};_0x2434ce[_0x4953c2]={'$like':'%'+_0x4d0cd5[_0x0ba3('0x2b')][_0x0ba3('0x36')]+'%'};return _0x2434ce;})});}_0x1d3419=_['merge']({},_0x1d3419,_0x4d0cd5['options']);return _0x24a854['getSubjects'](_0x1d3419);}})[_0x0ba3('0x1f')](function(_0x3792d3){if(_0x3792d3){_0x2c94d8=_0x3792d3[_0x0ba3('0x40')];if(!_0x4d0cd5[_0x0ba3('0x2b')][_0x0ba3('0x4b')](_0x0ba3('0x31'))){_0x1d3419[_0x0ba3('0x1b')]=qs['limit'](_0x4d0cd5[_0x0ba3('0x2b')][_0x0ba3('0x1b')]);_0x1d3419[_0x0ba3('0x1a')]=qs[_0x0ba3('0x1a')](_0x4d0cd5[_0x0ba3('0x2b')][_0x0ba3('0x1a')]);}return _0x24a854['getSubjects'](_0x1d3419);}})[_0x0ba3('0x1f')](function(_0x30d656){if(_0x30d656){return _0x30d656?{'count':_0x2c94d8,'rows':_0x30d656}:null;}})[_0x0ba3('0x1f')](respondWithResult(_0x2bd5d1,null))[_0x0ba3('0x46')](handleError(_0x2bd5d1,null));};exports[_0x0ba3('0x4d')]=function(_0x36c416,_0x406098,_0x10e260){var _0x238505={};var _0x57f82f={};var _0x4d639e;var _0x5b6857;return db[_0x0ba3('0x28')][_0x0ba3('0x48')]({'where':{'id':_0x36c416[_0x0ba3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x406098,null))[_0x0ba3('0x1f')](function(_0x38b025){if(_0x38b025){_0x4d639e=_0x38b025;_0x57f82f['model']=_['keys'](db[_0x0ba3('0x49')]['rawAttributes']);_0x57f82f['query']=_[_0x0ba3('0x2c')](_0x36c416[_0x0ba3('0x2b')]);_0x57f82f[_0x0ba3('0x2d')]=_[_0x0ba3('0x3f')](_0x57f82f[_0x0ba3('0x2e')],_0x57f82f[_0x0ba3('0x2b')]);_0x238505[_0x0ba3('0x2f')]=_[_0x0ba3('0x3f')](_0x57f82f[_0x0ba3('0x2e')],qs[_0x0ba3('0x30')](_0x36c416[_0x0ba3('0x2b')][_0x0ba3('0x30')]));_0x238505[_0x0ba3('0x2f')]=_0x238505['attributes'][_0x0ba3('0x40')]?_0x238505['attributes']:_0x57f82f[_0x0ba3('0x2e')];_0x238505[_0x0ba3('0x32')]=qs[_0x0ba3('0x33')](_0x36c416[_0x0ba3('0x2b')][_0x0ba3('0x33')]);_0x238505[_0x0ba3('0x4a')]=qs['filters'](_[_0x0ba3('0x34')](_0x36c416[_0x0ba3('0x2b')],_0x57f82f[_0x0ba3('0x2d')]));if(_0x36c416[_0x0ba3('0x2b')][_0x0ba3('0x36')]){_0x238505[_0x0ba3('0x4a')]=_[_0x0ba3('0x37')](_0x238505[_0x0ba3('0x4a')],{'$or':_[_0x0ba3('0x27')](_0x238505['attributes'],function(_0x45aa1a){var _0x5a6408={};_0x5a6408[_0x45aa1a]={'$like':'%'+_0x36c416[_0x0ba3('0x2b')]['filter']+'%'};return _0x5a6408;})});}_0x238505=_[_0x0ba3('0x37')]({},_0x238505,_0x36c416[_0x0ba3('0x38')]);return _0x4d639e[_0x0ba3('0x4d')](_0x238505);}})['then'](function(_0x561f5d){if(_0x561f5d){_0x5b6857=_0x561f5d[_0x0ba3('0x40')];if(!_0x36c416['query']['hasOwnProperty']('nolimit')){_0x238505[_0x0ba3('0x1b')]=qs[_0x0ba3('0x1b')](_0x36c416[_0x0ba3('0x2b')][_0x0ba3('0x1b')]);_0x238505['offset']=qs['offset'](_0x36c416[_0x0ba3('0x2b')][_0x0ba3('0x1a')]);}return _0x4d639e[_0x0ba3('0x4d')](_0x238505);}})[_0x0ba3('0x1f')](function(_0x2b69b0){if(_0x2b69b0){return _0x2b69b0?{'count':_0x5b6857,'rows':_0x2b69b0}:null;}})[_0x0ba3('0x1f')](respondWithResult(_0x406098,null))[_0x0ba3('0x46')](handleError(_0x406098,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fb808fd..b21b9e5 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f75ce,_0x531ae1){var _0x1c757a=function(_0x4ebc9c){while(--_0x4ebc9c){_0x2f75ce['push'](_0x2f75ce['shift']());}};_0x1c757a(++_0x531ae1);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0xb4e6[_0x3227c1];return _0x31fd48;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x9a19,0x114));var _0x99a1=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x9a19[_0x354164];return _0x5db9a8;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','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 d358af2..2b7397f 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 _0x3fa0=['stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x3fa0,0x9c));var _0x03fa=function(_0x442609,_0xb87d90){_0x442609=_0x442609-0x0;var _0xa41d13=_0x3fa0[_0x442609];return _0xa41d13;};'use strict';var _=require('lodash');var util=require(_0x03fa('0x0'));var moment=require(_0x03fa('0x1'));var BPromise=require(_0x03fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03fa('0x3'));var db=require(_0x03fa('0x4'))['db'];var utils=require(_0x03fa('0x5'));var logger=require(_0x03fa('0x6'))('rpc');var config=require(_0x03fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x03fa('0x8')][_0x03fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f5865,_0x48b643,_0x36b522){return new BPromise(function(_0xe6270c,_0x470d67){return client[_0x03fa('0xa')](_0x5f5865,_0x36b522)['then'](function(_0x2fd509){logger[_0x03fa('0xb')](_0x03fa('0xc'),_0x48b643,'request\x20sent');logger[_0x03fa('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x48b643,_0x03fa('0xe'),JSON[_0x03fa('0xf')](_0x2fd509));if(_0x2fd509[_0x03fa('0x10')]){if(_0x2fd509[_0x03fa('0x10')][_0x03fa('0x11')]===0x1f4){logger['error'](_0x03fa('0xc'),_0x48b643,_0x2fd509[_0x03fa('0x10')][_0x03fa('0x12')]);return _0x470d67(_0x2fd509[_0x03fa('0x10')][_0x03fa('0x12')]);}logger[_0x03fa('0x10')](_0x03fa('0xc'),_0x48b643,_0x2fd509[_0x03fa('0x10')][_0x03fa('0x12')]);return _0xe6270c(_0x2fd509[_0x03fa('0x10')][_0x03fa('0x12')]);}else{logger['info'](_0x03fa('0xc'),_0x48b643,_0x03fa('0xe'));_0xe6270c(_0x2fd509['result'][_0x03fa('0x12')]);}})['catch'](function(_0x2b75f4){logger[_0x03fa('0x10')](_0x03fa('0xc'),_0x48b643,_0x2b75f4);_0x470d67(_0x2b75f4);});});} \ No newline at end of file +var _0x8913=['info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x51a182,_0x5639a7){var _0x46aa3e=function(_0x287abb){while(--_0x287abb){_0x51a182['push'](_0x51a182['shift']());}};_0x46aa3e(++_0x5639a7);}(_0x8913,0x15c));var _0x3891=function(_0x1ce532,_0x1ec45c){_0x1ce532=_0x1ce532-0x0;var _0x13ba61=_0x8913[_0x1ce532];return _0x13ba61;};'use strict';var _=require(_0x3891('0x0'));var util=require(_0x3891('0x1'));var moment=require(_0x3891('0x2'));var BPromise=require('bluebird');var rs=require(_0x3891('0x3'));var fs=require('fs');var Redis=require(_0x3891('0x4'));var db=require(_0x3891('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3891('0x6'));var config=require(_0x3891('0x7'));var jayson=require(_0x3891('0x8'));var client=jayson[_0x3891('0x9')][_0x3891('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x124aaf,_0x1d129c,_0x266168){return new BPromise(function(_0xf905c4,_0x5f07c7){return client[_0x3891('0xb')](_0x124aaf,_0x266168)['then'](function(_0xb2992d){logger[_0x3891('0xc')](_0x3891('0xd'),_0x1d129c,_0x3891('0xe'));logger['debug'](_0x3891('0xf'),_0x1d129c,'request\x20sent',JSON[_0x3891('0x10')](_0xb2992d));if(_0xb2992d[_0x3891('0x11')]){if(_0xb2992d[_0x3891('0x11')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1d129c,_0xb2992d['error'][_0x3891('0x12')]);return _0x5f07c7(_0xb2992d[_0x3891('0x11')][_0x3891('0x12')]);}logger['error'](_0x3891('0xd'),_0x1d129c,_0xb2992d['error'][_0x3891('0x12')]);return _0xf905c4(_0xb2992d[_0x3891('0x11')]['message']);}else{logger[_0x3891('0xc')](_0x3891('0xd'),_0x1d129c,_0x3891('0xe'));_0xf905c4(_0xb2992d['result'][_0x3891('0x12')]);}})[_0x3891('0x13')](function(_0x55058a){logger[_0x3891('0x11')](_0x3891('0xd'),_0x1d129c,_0x55058a);_0x5f07c7(_0x55058a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 5893ecc..ab445a9 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 _0x582e=['destroy','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x1e3016,_0x13c98a){var _0x5e8869=function(_0x169cd7){while(--_0x169cd7){_0x1e3016['push'](_0x1e3016['shift']());}};_0x5e8869(++_0x13c98a);}(_0x582e,0xd4));var _0xe582=function(_0x4aadbc,_0x4afc4d){_0x4aadbc=_0x4aadbc-0x0;var _0x372f33=_0x582e[_0x4aadbc];return _0x372f33;};'use strict';var multer=require('multer');var util=require(_0xe582('0x0'));var path=require('path');var timeout=require(_0xe582('0x1'));var express=require(_0xe582('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe582('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe582('0x4'));var controller=require(_0xe582('0x5'));router[_0xe582('0x6')]('/',auth[_0xe582('0x7')](),controller[_0xe582('0x8')]);router[_0xe582('0x6')](_0xe582('0x9'),auth[_0xe582('0x7')](),controller['show']);router[_0xe582('0xa')]('/',auth[_0xe582('0x7')](),controller[_0xe582('0xb')]);router[_0xe582('0xc')](_0xe582('0x9'),auth[_0xe582('0x7')](),controller['update']);router['delete'](_0xe582('0x9'),auth[_0xe582('0x7')](),controller[_0xe582('0xd')]);module[_0xe582('0xe')]=router; \ No newline at end of file +var _0xf811=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x2fe5d7,_0x152ed7){var _0x30e502=function(_0x1e87da){while(--_0x1e87da){_0x2fe5d7['push'](_0x2fe5d7['shift']());}};_0x30e502(++_0x152ed7);}(_0xf811,0x1a6));var _0x1f81=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xf811[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var path=require(_0x1f81('0x2'));var timeout=require(_0x1f81('0x3'));var express=require('express');var router=express[_0x1f81('0x4')]();var fs_extra=require(_0x1f81('0x5'));var auth=require(_0x1f81('0x6'));var interaction=require(_0x1f81('0x7'));var config=require(_0x1f81('0x8'));var controller=require(_0x1f81('0x9'));router[_0x1f81('0xa')]('/',auth[_0x1f81('0xb')](),controller[_0x1f81('0xc')]);router[_0x1f81('0xa')](_0x1f81('0xd'),auth[_0x1f81('0xb')](),controller[_0x1f81('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1f81('0xf')]);router[_0x1f81('0x10')]('/:id',auth[_0x1f81('0xb')](),controller[_0x1f81('0x11')]);router[_0x1f81('0x12')](_0x1f81('0xd'),auth[_0x1f81('0xb')](),controller[_0x1f81('0x13')]);module[_0x1f81('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a79c2c9..83f4881 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 _0x23cf=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x23cf,0x1d8));var _0xf23c=function(_0x35e02d,_0x26c5e3){_0x35e02d=_0x35e02d-0x0;var _0x445283=_0x23cf[_0x35e02d];return _0x445283;};'use strict';var Sequelize=require('sequelize');module[_0xf23c('0x0')]={'type':{'type':Sequelize[_0xf23c('0x1')](_0xf23c('0x2'),_0xf23c('0x3'),_0xf23c('0x4'),'keyValue',_0xf23c('0x5')),'defaultValue':_0xf23c('0x2')},'content':{'type':Sequelize[_0xf23c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf23c('0x2'),_0xf23c('0x3'),_0xf23c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf23c('0x6')]},'customField':{'type':Sequelize[_0xf23c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf23c('0x6')]}}; \ No newline at end of file +var _0xefcf=['ENUM','variable','STRING','BOOLEAN','sequelize','exports','customVariable','picklist','string'];(function(_0x39eb95,_0x36e8cc){var _0x5e365c=function(_0x424a70){while(--_0x424a70){_0x39eb95['push'](_0x39eb95['shift']());}};_0x5e365c(++_0x36e8cc);}(_0xefcf,0x82));var _0xfefc=function(_0x1e2939,_0x1f1ddc){_0x1e2939=_0x1e2939-0x0;var _0x1a1028=_0xefcf[_0x1e2939];return _0x1a1028;};'use strict';var Sequelize=require(_0xfefc('0x0'));module[_0xfefc('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xfefc('0x2'),'keyValue',_0xfefc('0x3')),'defaultValue':_0xfefc('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfefc('0x5')](_0xfefc('0x4'),_0xfefc('0x6'),_0xfefc('0x2'))},'keyContent':{'type':Sequelize[_0xfefc('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfefc('0x7')]},'customField':{'type':Sequelize[_0xfefc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5b7723f..9a5175d 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 _0x16b1=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save','update','destroy','then','end','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','options','find','catch','body','params','eml-format','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4c3ee2,_0x2221fa){var _0x5a5184=function(_0x17c594){while(--_0x17c594){_0x4c3ee2['push'](_0x4c3ee2['shift']());}};_0x5a5184(++_0x2221fa);}(_0x16b1,0x110));var _0x116b=function(_0x104b06,_0x1e77fd){_0x104b06=_0x104b06-0x0;var _0x4b9f43=_0x16b1[_0x104b06];return _0x4b9f43;};'use strict';var emlformat=require(_0x116b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x116b('0x1'));var jsonpatch=require(_0x116b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x116b('0x3'));var Mustache=require('mustache');var util=require(_0x116b('0x4'));var path=require(_0x116b('0x5'));var sox=require('sox');var csv=require(_0x116b('0x6'));var ejs=require(_0x116b('0x7'));var fs=require('fs');var fs_extra=require(_0x116b('0x8'));var _=require(_0x116b('0x9'));var squel=require(_0x116b('0xa'));var crypto=require(_0x116b('0xb'));var jsforce=require(_0x116b('0xc'));var deskjs=require(_0x116b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x116b('0xe'));var Papa=require(_0x116b('0xf'));var Redis=require('ioredis');var authService=require(_0x116b('0x10'));var qs=require(_0x116b('0x11'));var as=require(_0x116b('0x12'));var hardwareService=require(_0x116b('0x13'));var logger=require(_0x116b('0x14'))(_0x116b('0x15'));var utils=require(_0x116b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x116b('0x17'));var db=require(_0x116b('0x18'))['db'];function respondWithStatusCode(_0x1f166e,_0x497cf5){_0x497cf5=_0x497cf5||0xcc;return function(_0x5772a8){if(_0x5772a8){return _0x1f166e[_0x116b('0x19')](_0x497cf5);}return _0x1f166e[_0x116b('0x1a')](_0x497cf5)['end']();};}function respondWithResult(_0x4aa774,_0x42d250){_0x42d250=_0x42d250||0xc8;return function(_0x2b11ae){if(_0x2b11ae){return _0x4aa774[_0x116b('0x1a')](_0x42d250)[_0x116b('0x1b')](_0x2b11ae);}};}function respondWithFilteredResult(_0x295343,_0x4b232e){return function(_0x154c92){if(_0x154c92){var _0x18a263=typeof _0x4b232e['offset']===_0x116b('0x1c')&&typeof _0x4b232e['limit']===_0x116b('0x1c');var _0x179a1c=_0x154c92[_0x116b('0x1d')];var _0x3b2a69=_0x18a263?0x0:_0x4b232e['offset'];var _0x40ff02=_0x18a263?_0x154c92[_0x116b('0x1d')]:_0x4b232e[_0x116b('0x1e')]+_0x4b232e[_0x116b('0x1f')];var _0x5a0bad;if(_0x40ff02>=_0x179a1c){_0x40ff02=_0x179a1c;_0x5a0bad=0xc8;}else{_0x5a0bad=0xce;}_0x295343[_0x116b('0x1a')](_0x5a0bad);return _0x295343['set'](_0x116b('0x20'),_0x3b2a69+'-'+_0x40ff02+'/'+_0x179a1c)[_0x116b('0x1b')](_0x154c92);}return null;};}function patchUpdates(_0x594a3b){return function(_0x3be75c){try{jsonpatch['apply'](_0x3be75c,_0x594a3b,!![]);}catch(_0x457247){return BPromise[_0x116b('0x21')](_0x457247);}return _0x3be75c[_0x116b('0x22')]();};}function saveUpdates(_0x90efd3,_0x27ad70){return function(_0x19701d){if(_0x19701d){return _0x19701d[_0x116b('0x23')](_0x90efd3)['then'](function(_0x336416){return _0x336416;});}return null;};}function removeEntity(_0x33149c,_0x14acc2){return function(_0xdf13ce){if(_0xdf13ce){return _0xdf13ce[_0x116b('0x24')]()[_0x116b('0x25')](function(){_0x33149c[_0x116b('0x1a')](0xcc)[_0x116b('0x26')]();});}};}function handleEntityNotFound(_0x20d7a1,_0x390236){return function(_0x5d9e6c){if(!_0x5d9e6c){_0x20d7a1[_0x116b('0x19')](0x194);}return _0x5d9e6c;};}function handleError(_0x24b9ed,_0x2f805d){_0x2f805d=_0x2f805d||0x1f4;return function(_0x1b0822){logger['error'](_0x1b0822['stack']);if(_0x1b0822[_0x116b('0x27')]){delete _0x1b0822[_0x116b('0x27')];}_0x24b9ed[_0x116b('0x1a')](_0x2f805d)[_0x116b('0x28')](_0x1b0822);};}exports[_0x116b('0x29')]=function(_0x183564,_0x4f819c){var _0x52748b={},_0x282696={},_0x10943d={'count':0x0,'rows':[]};var _0x126749=_[_0x116b('0x2a')](db[_0x116b('0x2b')][_0x116b('0x2c')],function(_0x52e4e7){return{'name':_0x52e4e7[_0x116b('0x2d')],'type':_0x52e4e7[_0x116b('0x2e')][_0x116b('0x2f')]};});_0x282696[_0x116b('0x30')]=_['map'](_0x126749,'name');_0x282696[_0x116b('0x31')]=_[_0x116b('0x32')](_0x183564['query']);_0x282696[_0x116b('0x33')]=_[_0x116b('0x34')](_0x282696[_0x116b('0x30')],_0x282696['query']);_0x52748b[_0x116b('0x35')]=_[_0x116b('0x34')](_0x282696[_0x116b('0x30')],qs['fields'](_0x183564[_0x116b('0x31')][_0x116b('0x36')]));_0x52748b[_0x116b('0x35')]=_0x52748b[_0x116b('0x35')][_0x116b('0x37')]?_0x52748b[_0x116b('0x35')]:_0x282696[_0x116b('0x30')];if(!_0x183564['query'][_0x116b('0x38')](_0x116b('0x39'))){_0x52748b['limit']=qs[_0x116b('0x1f')](_0x183564['query']['limit']);_0x52748b[_0x116b('0x1e')]=qs['offset'](_0x183564[_0x116b('0x31')][_0x116b('0x1e')]);}_0x52748b[_0x116b('0x3a')]=qs[_0x116b('0x3b')](_0x183564[_0x116b('0x31')]['sort']);_0x52748b[_0x116b('0x3c')]=qs['filters'](_[_0x116b('0x3d')](_0x183564[_0x116b('0x31')],_0x282696[_0x116b('0x33')]),_0x126749);if(_0x183564['query'][_0x116b('0x3e')]){_0x52748b['where']=_[_0x116b('0x3f')](_0x52748b[_0x116b('0x3c')],{'$or':_[_0x116b('0x2a')](_0x126749,function(_0x43f4bf){if(_0x43f4bf['type']!=='VIRTUAL'){var _0x1938f4={};_0x1938f4[_0x43f4bf[_0x116b('0x27')]]={'$like':'%'+_0x183564['query']['filter']+'%'};return _0x1938f4;}})});}_0x52748b=_['merge']({},_0x52748b,_0x183564['options']);var _0x21b7a4={'where':_0x52748b['where']};return db['Dynamics365Field'][_0x116b('0x1d')](_0x21b7a4)['then'](function(_0x39e065){_0x10943d[_0x116b('0x1d')]=_0x39e065;if(_0x183564['query'][_0x116b('0x40')]){_0x52748b[_0x116b('0x41')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x52748b);})['then'](function(_0x1b3a72){_0x10943d[_0x116b('0x42')]=_0x1b3a72;return _0x10943d;})[_0x116b('0x25')](respondWithFilteredResult(_0x4f819c,_0x52748b))['catch'](handleError(_0x4f819c,null));};exports['show']=function(_0x376081,_0x1c4472){var _0x65dd5a={'raw':!![],'where':{'id':_0x376081['params']['id']}},_0x35661e={};_0x35661e[_0x116b('0x30')]=_[_0x116b('0x32')](db[_0x116b('0x2b')]['rawAttributes']);_0x35661e[_0x116b('0x31')]=_[_0x116b('0x32')](_0x376081['query']);_0x35661e[_0x116b('0x33')]=_[_0x116b('0x34')](_0x35661e[_0x116b('0x30')],_0x35661e[_0x116b('0x31')]);_0x65dd5a['attributes']=_[_0x116b('0x34')](_0x35661e[_0x116b('0x30')],qs[_0x116b('0x36')](_0x376081[_0x116b('0x31')]['fields']));_0x65dd5a[_0x116b('0x35')]=_0x65dd5a[_0x116b('0x35')][_0x116b('0x37')]?_0x65dd5a[_0x116b('0x35')]:_0x35661e['model'];if(_0x376081['query'][_0x116b('0x40')]){_0x65dd5a[_0x116b('0x41')]=[{'all':!![]}];}_0x65dd5a=_[_0x116b('0x3f')]({},_0x65dd5a,_0x376081[_0x116b('0x43')]);return db['Dynamics365Field'][_0x116b('0x44')](_0x65dd5a)[_0x116b('0x25')](handleEntityNotFound(_0x1c4472,null))[_0x116b('0x25')](respondWithResult(_0x1c4472,null))[_0x116b('0x45')](handleError(_0x1c4472,null));};exports['create']=function(_0x52aced,_0x20af42){return db[_0x116b('0x2b')]['create'](_0x52aced['body'],{})[_0x116b('0x25')](respondWithResult(_0x20af42,0xc9))[_0x116b('0x45')](handleError(_0x20af42,null));};exports['update']=function(_0x24ce41,_0xe30bad){if(_0x24ce41[_0x116b('0x46')]['id']){delete _0x24ce41['body']['id'];}return db[_0x116b('0x2b')][_0x116b('0x44')]({'where':{'id':_0x24ce41[_0x116b('0x47')]['id']}})[_0x116b('0x25')](handleEntityNotFound(_0xe30bad,null))[_0x116b('0x25')](saveUpdates(_0x24ce41[_0x116b('0x46')],null))[_0x116b('0x25')](respondWithResult(_0xe30bad,null))[_0x116b('0x45')](handleError(_0xe30bad,null));};exports['destroy']=function(_0x553c94,_0x7acd5d){return db[_0x116b('0x2b')][_0x116b('0x44')]({'where':{'id':_0x553c94[_0x116b('0x47')]['id']}})[_0x116b('0x25')](handleEntityNotFound(_0x7acd5d,null))[_0x116b('0x25')](removeEntity(_0x7acd5d,null))[_0x116b('0x45')](handleError(_0x7acd5d,null));}; \ No newline at end of file +var _0x1242=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x1242,0x13c));var _0x2124=function(_0x56806d,_0x51afa2){_0x56806d=_0x56806d-0x0;var _0x3e629a=_0x1242[_0x56806d];return _0x3e629a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2124('0x0'));var zipdir=require(_0x2124('0x1'));var jsonpatch=require(_0x2124('0x2'));var rp=require(_0x2124('0x3'));var moment=require(_0x2124('0x4'));var BPromise=require(_0x2124('0x5'));var Mustache=require(_0x2124('0x6'));var util=require(_0x2124('0x7'));var path=require(_0x2124('0x8'));var sox=require(_0x2124('0x9'));var csv=require(_0x2124('0xa'));var ejs=require(_0x2124('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2124('0xc'));var squel=require(_0x2124('0xd'));var crypto=require(_0x2124('0xe'));var jsforce=require(_0x2124('0xf'));var deskjs=require(_0x2124('0x10'));var toCsv=require(_0x2124('0xa'));var querystring=require(_0x2124('0x11'));var Papa=require(_0x2124('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2124('0x13'));var as=require(_0x2124('0x14'));var hardwareService=require(_0x2124('0x15'));var logger=require('../../config/logger')(_0x2124('0x16'));var utils=require(_0x2124('0x17'));var config=require(_0x2124('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2124('0x19'))['db'];function respondWithStatusCode(_0x3d3386,_0x305ed9){_0x305ed9=_0x305ed9||0xcc;return function(_0x2543ad){if(_0x2543ad){return _0x3d3386[_0x2124('0x1a')](_0x305ed9);}return _0x3d3386[_0x2124('0x1b')](_0x305ed9)[_0x2124('0x1c')]();};}function respondWithResult(_0x1e6b56,_0x3eda92){_0x3eda92=_0x3eda92||0xc8;return function(_0xb00a49){if(_0xb00a49){return _0x1e6b56['status'](_0x3eda92)[_0x2124('0x1d')](_0xb00a49);}};}function respondWithFilteredResult(_0x2818de,_0x25f631){return function(_0x3eeff6){if(_0x3eeff6){var _0x49cd76=typeof _0x25f631[_0x2124('0x1e')]===_0x2124('0x1f')&&typeof _0x25f631[_0x2124('0x20')]===_0x2124('0x1f');var _0x2d29c1=_0x3eeff6[_0x2124('0x21')];var _0x1c8adb=_0x49cd76?0x0:_0x25f631['offset'];var _0x81842e=_0x49cd76?_0x3eeff6[_0x2124('0x21')]:_0x25f631[_0x2124('0x1e')]+_0x25f631[_0x2124('0x20')];var _0xe3bb49;if(_0x81842e>=_0x2d29c1){_0x81842e=_0x2d29c1;_0xe3bb49=0xc8;}else{_0xe3bb49=0xce;}_0x2818de[_0x2124('0x1b')](_0xe3bb49);return _0x2818de[_0x2124('0x22')](_0x2124('0x23'),_0x1c8adb+'-'+_0x81842e+'/'+_0x2d29c1)['json'](_0x3eeff6);}return null;};}function patchUpdates(_0x355c96){return function(_0x1dde2d){try{jsonpatch['apply'](_0x1dde2d,_0x355c96,!![]);}catch(_0xad19d1){return BPromise[_0x2124('0x24')](_0xad19d1);}return _0x1dde2d['save']();};}function saveUpdates(_0xa372f8,_0x177ea6){return function(_0x11ecf7){if(_0x11ecf7){return _0x11ecf7[_0x2124('0x25')](_0xa372f8)[_0x2124('0x26')](function(_0x4b0d1c){return _0x4b0d1c;});}return null;};}function removeEntity(_0x35d8b9,_0x50c5dc){return function(_0x2547f6){if(_0x2547f6){return _0x2547f6['destroy']()[_0x2124('0x26')](function(){_0x35d8b9[_0x2124('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6c3f,_0x416a8b){return function(_0x45881d){if(!_0x45881d){_0x5e6c3f[_0x2124('0x1a')](0x194);}return _0x45881d;};}function handleError(_0x41eca3,_0x54102f){_0x54102f=_0x54102f||0x1f4;return function(_0x5f304d){logger[_0x2124('0x27')](_0x5f304d[_0x2124('0x28')]);if(_0x5f304d[_0x2124('0x29')]){delete _0x5f304d[_0x2124('0x29')];}_0x41eca3[_0x2124('0x1b')](_0x54102f)['send'](_0x5f304d);};}exports[_0x2124('0x2a')]=function(_0x50f3dc,_0x534590){var _0x1a572a={},_0x38b595={},_0x4128d9={'count':0x0,'rows':[]};var _0x2fa3e9=_[_0x2124('0x2b')](db[_0x2124('0x2c')][_0x2124('0x2d')],function(_0x39dbc1){return{'name':_0x39dbc1[_0x2124('0x2e')],'type':_0x39dbc1['type'][_0x2124('0x2f')]};});_0x38b595[_0x2124('0x30')]=_[_0x2124('0x2b')](_0x2fa3e9,'name');_0x38b595['query']=_[_0x2124('0x31')](_0x50f3dc[_0x2124('0x32')]);_0x38b595[_0x2124('0x33')]=_[_0x2124('0x34')](_0x38b595[_0x2124('0x30')],_0x38b595[_0x2124('0x32')]);_0x1a572a[_0x2124('0x35')]=_[_0x2124('0x34')](_0x38b595['model'],qs[_0x2124('0x36')](_0x50f3dc[_0x2124('0x32')][_0x2124('0x36')]));_0x1a572a[_0x2124('0x35')]=_0x1a572a['attributes'][_0x2124('0x37')]?_0x1a572a[_0x2124('0x35')]:_0x38b595[_0x2124('0x30')];if(!_0x50f3dc['query'][_0x2124('0x38')](_0x2124('0x39'))){_0x1a572a[_0x2124('0x20')]=qs[_0x2124('0x20')](_0x50f3dc[_0x2124('0x32')]['limit']);_0x1a572a['offset']=qs[_0x2124('0x1e')](_0x50f3dc[_0x2124('0x32')]['offset']);}_0x1a572a[_0x2124('0x3a')]=qs[_0x2124('0x3b')](_0x50f3dc[_0x2124('0x32')][_0x2124('0x3b')]);_0x1a572a['where']=qs[_0x2124('0x33')](_[_0x2124('0x3c')](_0x50f3dc[_0x2124('0x32')],_0x38b595[_0x2124('0x33')]),_0x2fa3e9);if(_0x50f3dc[_0x2124('0x32')]['filter']){_0x1a572a[_0x2124('0x3d')]=_[_0x2124('0x3e')](_0x1a572a['where'],{'$or':_[_0x2124('0x2b')](_0x2fa3e9,function(_0x334d9e){if(_0x334d9e['type']!=='VIRTUAL'){var _0x533035={};_0x533035[_0x334d9e[_0x2124('0x29')]]={'$like':'%'+_0x50f3dc[_0x2124('0x32')][_0x2124('0x3f')]+'%'};return _0x533035;}})});}_0x1a572a=_[_0x2124('0x3e')]({},_0x1a572a,_0x50f3dc[_0x2124('0x40')]);var _0x18ce81={'where':_0x1a572a[_0x2124('0x3d')]};return db[_0x2124('0x2c')]['count'](_0x18ce81)[_0x2124('0x26')](function(_0x541f94){_0x4128d9[_0x2124('0x21')]=_0x541f94;if(_0x50f3dc[_0x2124('0x32')][_0x2124('0x41')]){_0x1a572a[_0x2124('0x42')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x2124('0x43')](_0x1a572a);})[_0x2124('0x26')](function(_0x344c6d){_0x4128d9[_0x2124('0x44')]=_0x344c6d;return _0x4128d9;})[_0x2124('0x26')](respondWithFilteredResult(_0x534590,_0x1a572a))[_0x2124('0x45')](handleError(_0x534590,null));};exports[_0x2124('0x46')]=function(_0x4cbf61,_0x58facf){var _0x1fe340={'raw':!![],'where':{'id':_0x4cbf61[_0x2124('0x47')]['id']}},_0x474eeb={};_0x474eeb[_0x2124('0x30')]=_[_0x2124('0x31')](db[_0x2124('0x2c')][_0x2124('0x2d')]);_0x474eeb[_0x2124('0x32')]=_[_0x2124('0x31')](_0x4cbf61['query']);_0x474eeb['filters']=_['intersection'](_0x474eeb['model'],_0x474eeb['query']);_0x1fe340[_0x2124('0x35')]=_[_0x2124('0x34')](_0x474eeb['model'],qs['fields'](_0x4cbf61[_0x2124('0x32')][_0x2124('0x36')]));_0x1fe340['attributes']=_0x1fe340[_0x2124('0x35')][_0x2124('0x37')]?_0x1fe340[_0x2124('0x35')]:_0x474eeb[_0x2124('0x30')];if(_0x4cbf61[_0x2124('0x32')][_0x2124('0x41')]){_0x1fe340[_0x2124('0x42')]=[{'all':!![]}];}_0x1fe340=_['merge']({},_0x1fe340,_0x4cbf61[_0x2124('0x40')]);return db[_0x2124('0x2c')][_0x2124('0x48')](_0x1fe340)[_0x2124('0x26')](handleEntityNotFound(_0x58facf,null))['then'](respondWithResult(_0x58facf,null))[_0x2124('0x45')](handleError(_0x58facf,null));};exports[_0x2124('0x49')]=function(_0x7a1e6d,_0x8e726d){return db[_0x2124('0x2c')][_0x2124('0x49')](_0x7a1e6d[_0x2124('0x4a')],{})[_0x2124('0x26')](respondWithResult(_0x8e726d,0xc9))['catch'](handleError(_0x8e726d,null));};exports[_0x2124('0x25')]=function(_0x928a08,_0x37e132){if(_0x928a08[_0x2124('0x4a')]['id']){delete _0x928a08['body']['id'];}return db['Dynamics365Field'][_0x2124('0x48')]({'where':{'id':_0x928a08[_0x2124('0x47')]['id']}})[_0x2124('0x26')](handleEntityNotFound(_0x37e132,null))[_0x2124('0x26')](saveUpdates(_0x928a08['body'],null))[_0x2124('0x26')](respondWithResult(_0x37e132,null))[_0x2124('0x45')](handleError(_0x37e132,null));};exports[_0x2124('0x4b')]=function(_0x50db0c,_0x3fafa9){return db['Dynamics365Field']['find']({'where':{'id':_0x50db0c[_0x2124('0x47')]['id']}})[_0x2124('0x26')](handleEntityNotFound(_0x3fafa9,null))[_0x2124('0x26')](removeEntity(_0x3fafa9,null))[_0x2124('0x45')](handleError(_0x3fafa9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2cf6658..f286f0d 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 _0xe470=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe470,0x195));var _0x0e47=function(_0xdd2378,_0x459fd6){_0xdd2378=_0xdd2378-0x0;var _0x3abed8=_0xe470[_0xdd2378];return _0x3abed8;};'use strict';var _=require(_0x0e47('0x0'));var util=require(_0x0e47('0x1'));var logger=require(_0x0e47('0x2'))('api');var moment=require(_0x0e47('0x3'));var BPromise=require(_0x0e47('0x4'));var rp=require(_0x0e47('0x5'));var fs=require('fs');var path=require(_0x0e47('0x6'));var rimraf=require(_0x0e47('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e47('0x8'));module['exports']=function(_0x2156bd,_0xd43640){return _0x2156bd[_0x0e47('0x9')](_0x0e47('0xa'),attributes,{'tableName':_0x0e47('0xb'),'paranoid':![],'indexes':[{'name':_0x0e47('0xc'),'fields':[_0x0e47('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1bd=['Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','./intDynamics365Field.attributes'];(function(_0x265e0e,_0x38b2bb){var _0x518157=function(_0x1e3eab){while(--_0x1e3eab){_0x265e0e['push'](_0x265e0e['shift']());}};_0x518157(++_0x38b2bb);}(_0xc1bd,0x88));var _0xdc1b=function(_0xc6cd9,_0x24938f){_0xc6cd9=_0xc6cd9-0x0;var _0x39ca4b=_0xc1bd[_0xc6cd9];return _0x39ca4b;};'use strict';var _=require(_0xdc1b('0x0'));var util=require(_0xdc1b('0x1'));var logger=require('../../config/logger')(_0xdc1b('0x2'));var moment=require(_0xdc1b('0x3'));var BPromise=require(_0xdc1b('0x4'));var rp=require(_0xdc1b('0x5'));var fs=require('fs');var path=require(_0xdc1b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc1b('0x7'));module['exports']=function(_0x3f789d,_0x4f599d){return _0x3f789d['define'](_0xdc1b('0x8'),attributes,{'tableName':_0xdc1b('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xdc1b('0xa'),_0xdc1b('0xb')],'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 7b00492..7ce4d3f 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 _0x5c46=['stringify','code','Dynamics365Field,\x20%s,\x20%s','message','error','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c46,0x11e));var _0x65c4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5c46[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x65c4('0x0'));var moment=require('moment');var BPromise=require(_0x65c4('0x1'));var rs=require(_0x65c4('0x2'));var fs=require('fs');var Redis=require(_0x65c4('0x3'));var db=require(_0x65c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x65c4('0x5'));var config=require('../../config/environment');var jayson=require(_0x65c4('0x6'));var client=jayson[_0x65c4('0x7')][_0x65c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33a809,_0x250062,_0x1a0ffa){return new BPromise(function(_0x1e0fc0,_0x41074b){return client['request'](_0x33a809,_0x1a0ffa)[_0x65c4('0x9')](function(_0x408f6f){logger[_0x65c4('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x250062,'request\x20sent');logger[_0x65c4('0xb')](_0x65c4('0xc'),_0x250062,_0x65c4('0xd'),JSON[_0x65c4('0xe')](_0x408f6f));if(_0x408f6f['error']){if(_0x408f6f['error'][_0x65c4('0xf')]===0x1f4){logger['error'](_0x65c4('0x10'),_0x250062,_0x408f6f['error'][_0x65c4('0x11')]);return _0x41074b(_0x408f6f['error']['message']);}logger[_0x65c4('0x12')](_0x65c4('0x10'),_0x250062,_0x408f6f[_0x65c4('0x12')][_0x65c4('0x11')]);return _0x1e0fc0(_0x408f6f['error'][_0x65c4('0x11')]);}else{logger['info'](_0x65c4('0x10'),_0x250062,_0x65c4('0xd'));_0x1e0fc0(_0x408f6f['result'][_0x65c4('0x11')]);}})[_0x65c4('0x13')](function(_0x2e79b3){logger[_0x65c4('0x12')](_0x65c4('0x10'),_0x250062,_0x2e79b3);_0x41074b(_0x2e79b3);});});} \ No newline at end of file +var _0xdaa8=['request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x44635e,_0x157716){var _0x378ac2=function(_0x35048c){while(--_0x35048c){_0x44635e['push'](_0x44635e['shift']());}};_0x378ac2(++_0x157716);}(_0xdaa8,0xa8));var _0x8daa=function(_0x3f1f44,_0x3176b3){_0x3f1f44=_0x3f1f44-0x0;var _0x4f00c5=_0xdaa8[_0x3f1f44];return _0x4f00c5;};'use strict';var _=require('lodash');var util=require(_0x8daa('0x0'));var moment=require(_0x8daa('0x1'));var BPromise=require(_0x8daa('0x2'));var rs=require(_0x8daa('0x3'));var fs=require('fs');var Redis=require(_0x8daa('0x4'));var db=require(_0x8daa('0x5'))['db'];var utils=require(_0x8daa('0x6'));var logger=require(_0x8daa('0x7'))(_0x8daa('0x8'));var config=require(_0x8daa('0x9'));var jayson=require(_0x8daa('0xa'));var client=jayson[_0x8daa('0xb')][_0x8daa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42bdfc,_0x14609b,_0x3f62a3){return new BPromise(function(_0x40f7ee,_0x5dc8ed){return client['request'](_0x42bdfc,_0x3f62a3)[_0x8daa('0xd')](function(_0x97a658){logger['info'](_0x8daa('0xe'),_0x14609b,'request\x20sent');logger['debug'](_0x8daa('0xf'),_0x14609b,_0x8daa('0x10'),JSON[_0x8daa('0x11')](_0x97a658));if(_0x97a658[_0x8daa('0x12')]){if(_0x97a658[_0x8daa('0x12')][_0x8daa('0x13')]===0x1f4){logger[_0x8daa('0x12')](_0x8daa('0xe'),_0x14609b,_0x97a658['error']['message']);return _0x5dc8ed(_0x97a658[_0x8daa('0x12')][_0x8daa('0x14')]);}logger['error'](_0x8daa('0xe'),_0x14609b,_0x97a658[_0x8daa('0x12')][_0x8daa('0x14')]);return _0x40f7ee(_0x97a658[_0x8daa('0x12')][_0x8daa('0x14')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x14609b,_0x8daa('0x10'));_0x40f7ee(_0x97a658[_0x8daa('0x15')]['message']);}})[_0x8daa('0x16')](function(_0x43e200){logger[_0x8daa('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x14609b,_0x43e200);_0x5dc8ed(_0x43e200);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 31eaa3f..125af3a 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 _0x9be3=['get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a4d83,_0x2f548c){var _0x1f223d=function(_0x513327){while(--_0x513327){_0x2a4d83['push'](_0x2a4d83['shift']());}};_0x1f223d(++_0x2f548c);}(_0x9be3,0xfb));var _0x39be=function(_0x4e9ed0,_0x4f9dd4){_0x4e9ed0=_0x4e9ed0-0x0;var _0x493de9=_0x9be3[_0x4e9ed0];return _0x493de9;};'use strict';var multer=require(_0x39be('0x0'));var util=require(_0x39be('0x1'));var path=require(_0x39be('0x2'));var timeout=require('connect-timeout');var express=require(_0x39be('0x3'));var router=express[_0x39be('0x4')]();var fs_extra=require(_0x39be('0x5'));var auth=require(_0x39be('0x6'));var interaction=require(_0x39be('0x7'));var config=require(_0x39be('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x39be('0x9')]('/',auth['isAuthenticated'](),controller[_0x39be('0xa')]);router[_0x39be('0x9')](_0x39be('0xb'),auth[_0x39be('0xc')](),controller[_0x39be('0xd')]);router[_0x39be('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x39be('0xe')]);router[_0x39be('0x9')](_0x39be('0xf'),auth[_0x39be('0xc')](),controller[_0x39be('0x10')]);router['post']('/',auth[_0x39be('0xc')](),controller[_0x39be('0x11')]);router[_0x39be('0x12')](_0x39be('0x13'),auth[_0x39be('0xc')](),controller[_0x39be('0x14')]);router[_0x39be('0x15')](_0x39be('0xb'),auth[_0x39be('0xc')](),controller[_0x39be('0x16')]);router[_0x39be('0x17')](_0x39be('0xb'),auth[_0x39be('0xc')](),controller[_0x39be('0x18')]);module[_0x39be('0x19')]=router; \ No newline at end of file +var _0x74c5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x8eac1c,_0x4369d6){var _0x77e112=function(_0x3123ad){while(--_0x3123ad){_0x8eac1c['push'](_0x8eac1c['shift']());}};_0x77e112(++_0x4369d6);}(_0x74c5,0x1ee));var _0x574c=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0x74c5[_0x503564];return _0x4be9fd;};'use strict';var multer=require(_0x574c('0x0'));var util=require(_0x574c('0x1'));var path=require(_0x574c('0x2'));var timeout=require('connect-timeout');var express=require(_0x574c('0x3'));var router=express[_0x574c('0x4')]();var fs_extra=require(_0x574c('0x5'));var auth=require(_0x574c('0x6'));var interaction=require(_0x574c('0x7'));var config=require(_0x574c('0x8'));var controller=require(_0x574c('0x9'));router[_0x574c('0xa')]('/',auth[_0x574c('0xb')](),controller[_0x574c('0xc')]);router[_0x574c('0xa')]('/:id',auth[_0x574c('0xb')](),controller[_0x574c('0xd')]);router[_0x574c('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x574c('0xe')]);router['get'](_0x574c('0xf'),auth[_0x574c('0xb')](),controller[_0x574c('0x10')]);router[_0x574c('0x11')]('/',auth[_0x574c('0xb')](),controller[_0x574c('0x12')]);router[_0x574c('0x11')](_0x574c('0x13'),auth[_0x574c('0xb')](),controller[_0x574c('0x14')]);router['put'](_0x574c('0x15'),auth['isAuthenticated'](),controller[_0x574c('0x16')]);router[_0x574c('0x17')](_0x574c('0x15'),auth[_0x574c('0xb')](),controller['destroy']);module[_0x574c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 9e8f07e..dd4c8f0 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 _0x5204=['exports','STRING','username','sequelize'];(function(_0x145930,_0x52d6f3){var _0x1bf664=function(_0x47c858){while(--_0x47c858){_0x145930['push'](_0x145930['shift']());}};_0x1bf664(++_0x52d6f3);}(_0x5204,0xdf));var _0x4520=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x5204[_0x55821d];return _0x58ea8a;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb78e=['username','remoteUri','sequelize','exports','STRING'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0xb78e,0x1c9));var _0xeb78=function(_0x9fa69a,_0x1fde02){_0x9fa69a=_0x9fa69a-0x0;var _0x54621a=_0xb78e[_0x9fa69a];return _0x54621a;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'apiKey':{'type':Sequelize[_0xeb78('0x2')]},'remoteUri':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x4')},'serverUrl':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 22d17f3..7b1f0e1 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 _0xa9e0=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','priority','source','ticket_type','group','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','query'];(function(_0x2f43e3,_0x329db1){var _0x42ca6e=function(_0x4fd79e){while(--_0x4fd79e){_0x2f43e3['push'](_0x2f43e3['shift']());}};_0x42ca6e(++_0x329db1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var integrations=require(_0x0a9e('0x15'));function respondWithStatusCode(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xcc;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['sendStatus'](_0x32d742);}return _0x26d672[_0x0a9e('0x16')](_0x32d742)[_0x0a9e('0x17')]();};}function respondWithResult(_0x2b4227,_0x281129){_0x281129=_0x281129||0xc8;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x16')](_0x281129)['json'](_0x44dcfd);}};}function respondWithFilteredResult(_0x22dccb,_0x5d0880){return function(_0x1985b6){if(_0x1985b6){var _0x519dfd=typeof _0x5d0880[_0x0a9e('0x18')]===_0x0a9e('0x19')&&typeof _0x5d0880['limit']===_0x0a9e('0x19');var _0x5a0a06=_0x1985b6[_0x0a9e('0x1a')];var _0x478723=_0x519dfd?0x0:_0x5d0880[_0x0a9e('0x18')];var _0x205fd6=_0x519dfd?_0x1985b6[_0x0a9e('0x1a')]:_0x5d0880[_0x0a9e('0x18')]+_0x5d0880[_0x0a9e('0x1b')];var _0x20559e;if(_0x205fd6>=_0x5a0a06){_0x205fd6=_0x5a0a06;_0x20559e=0xc8;}else{_0x20559e=0xce;}_0x22dccb[_0x0a9e('0x16')](_0x20559e);return _0x22dccb[_0x0a9e('0x1c')](_0x0a9e('0x1d'),_0x478723+'-'+_0x205fd6+'/'+_0x5a0a06)[_0x0a9e('0x1e')](_0x1985b6);}return null;};}function patchUpdates(_0x4bb1e3){return function(_0x2c3407){try{jsonpatch[_0x0a9e('0x1f')](_0x2c3407,_0x4bb1e3,!![]);}catch(_0x53682f){return BPromise[_0x0a9e('0x20')](_0x53682f);}return _0x2c3407['save']();};}function saveUpdates(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x21')](_0x588269)[_0x0a9e('0x22')](function(_0x4abc77){return _0x4abc77;});}return null;};}function removeEntity(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(_0x3b45bc){return _0x3b45bc[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0xfb6e48[_0x0a9e('0x16')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x5ea472,_0x59181e){return function(_0x197ec0){if(!_0x197ec0){_0x5ea472[_0x0a9e('0x24')](0x194);}return _0x197ec0;};}function handleError(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0x1f4;return function(_0x526cf3){logger[_0x0a9e('0x25')](_0x526cf3['stack']);if(_0x526cf3[_0x0a9e('0x26')]){delete _0x526cf3['name'];}_0x40c424[_0x0a9e('0x16')](_0x33161b)[_0x0a9e('0x27')](_0x526cf3);};}exports[_0x0a9e('0x28')]=function(_0x14433c,_0x140511){var _0x1538a4={},_0x11c3b6={},_0x14de77={'count':0x0,'rows':[]};var _0x5a101a=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x2ec755){return{'name':_0x2ec755['fieldName'],'type':_0x2ec755[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x11c3b6[_0x0a9e('0x2e')]=_[_0x0a9e('0x29')](_0x5a101a,_0x0a9e('0x26'));_0x11c3b6[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x14433c[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x31')]=_['intersection'](_0x11c3b6[_0x0a9e('0x2e')],_0x11c3b6['query']);_0x1538a4[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x11c3b6[_0x0a9e('0x2e')],qs[_0x0a9e('0x34')](_0x14433c[_0x0a9e('0x2f')]['fields']));_0x1538a4[_0x0a9e('0x32')]=_0x1538a4[_0x0a9e('0x32')][_0x0a9e('0x35')]?_0x1538a4[_0x0a9e('0x32')]:_0x11c3b6[_0x0a9e('0x2e')];if(!_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x36')](_0x0a9e('0x37'))){_0x1538a4['limit']=qs[_0x0a9e('0x1b')](_0x14433c['query'][_0x0a9e('0x1b')]);_0x1538a4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x2f')]['offset']);}_0x1538a4[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x39')]);_0x1538a4['where']=qs['filters'](_[_0x0a9e('0x3a')](_0x14433c['query'],_0x11c3b6[_0x0a9e('0x31')]),_0x5a101a);if(_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x3b')]){_0x1538a4[_0x0a9e('0x3c')]=_['merge'](_0x1538a4[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x5a101a,function(_0x3cae){if(_0x3cae['type']!==_0x0a9e('0x3d')){var _0x1a180b={};_0x1a180b[_0x3cae[_0x0a9e('0x26')]]={'$like':'%'+_0x14433c['query']['filter']+'%'};return _0x1a180b;}})});}_0x1538a4=_[_0x0a9e('0x3e')]({},_0x1538a4,_0x14433c[_0x0a9e('0x3f')]);var _0x5adda1={'where':_0x1538a4[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x1a')](_0x5adda1)[_0x0a9e('0x22')](function(_0x4b38d9){_0x14de77['count']=_0x4b38d9;if(_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x40')]){_0x1538a4['include']=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x41')](_0x1538a4);})[_0x0a9e('0x22')](function(_0x5b4f5e){_0x14de77[_0x0a9e('0x42')]=_0x5b4f5e;return _0x14de77;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x140511,_0x1538a4))[_0x0a9e('0x43')](handleError(_0x140511,null));};exports[_0x0a9e('0x44')]=function(_0x13cb1f,_0xeaa5e5){var _0x2881b3={'raw':![],'where':{'id':_0x13cb1f[_0x0a9e('0x45')]['id']}},_0x45a9b8={};_0x45a9b8[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x45a9b8[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x13cb1f['query']);_0x45a9b8['filters']=_[_0x0a9e('0x33')](_0x45a9b8[_0x0a9e('0x2e')],_0x45a9b8[_0x0a9e('0x2f')]);_0x2881b3[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x45a9b8[_0x0a9e('0x2e')],qs[_0x0a9e('0x34')](_0x13cb1f[_0x0a9e('0x2f')][_0x0a9e('0x34')]));_0x2881b3[_0x0a9e('0x32')]=_0x2881b3[_0x0a9e('0x32')][_0x0a9e('0x35')]?_0x2881b3['attributes']:_0x45a9b8[_0x0a9e('0x2e')];if(_0x13cb1f[_0x0a9e('0x2f')][_0x0a9e('0x40')]){_0x2881b3[_0x0a9e('0x46')]=[{'all':!![]}];}_0x2881b3=_[_0x0a9e('0x3e')]({},_0x2881b3,_0x13cb1f[_0x0a9e('0x3f')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x2881b3)['then'](handleEntityNotFound(_0xeaa5e5,null))[_0x0a9e('0x22')](respondWithResult(_0xeaa5e5,null))['catch'](handleError(_0xeaa5e5,null));};exports[_0x0a9e('0x48')]=function(_0x476688,_0x8d6dd1){return db['FreshdeskAccount'][_0x0a9e('0x48')](_0x476688[_0x0a9e('0x49')],{})[_0x0a9e('0x22')](respondWithResult(_0x8d6dd1,0xc9))[_0x0a9e('0x43')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x21')]=function(_0x37be73,_0x45bf7f){if(_0x37be73['body']['id']){delete _0x37be73[_0x0a9e('0x49')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x47')]({'where':{'id':_0x37be73[_0x0a9e('0x45')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45bf7f,null))[_0x0a9e('0x22')](saveUpdates(_0x37be73[_0x0a9e('0x49')],null))[_0x0a9e('0x22')](respondWithResult(_0x45bf7f,null))[_0x0a9e('0x43')](handleError(_0x45bf7f,null));};exports['destroy']=function(_0xe401a,_0x3fe430){return db['FreshdeskAccount']['find']({'where':{'id':_0xe401a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3fe430,null))[_0x0a9e('0x22')](removeEntity(_0x3fe430,null))[_0x0a9e('0x43')](handleError(_0x3fe430,null));};exports[_0x0a9e('0x4a')]=function(_0x61bb17,_0x30decb,_0x2e5165){var _0x375c18={};var _0x5d38ae={};var _0x4b1b9f;var _0x53975a;return db[_0x0a9e('0x2a')][_0x0a9e('0x4b')]({'where':{'id':_0x61bb17[_0x0a9e('0x45')]['id']}})['then'](handleEntityNotFound(_0x30decb,null))[_0x0a9e('0x22')](function(_0x161aa7){if(_0x161aa7){_0x4b1b9f=_0x161aa7;_0x5d38ae['model']=_['keys'](db[_0x0a9e('0x4c')]['rawAttributes']);_0x5d38ae[_0x0a9e('0x2f')]=_['keys'](_0x61bb17[_0x0a9e('0x2f')]);_0x5d38ae[_0x0a9e('0x31')]=_[_0x0a9e('0x33')](_0x5d38ae['model'],_0x5d38ae[_0x0a9e('0x2f')]);_0x375c18[_0x0a9e('0x32')]=_['intersection'](_0x5d38ae['model'],qs[_0x0a9e('0x34')](_0x61bb17[_0x0a9e('0x2f')]['fields']));_0x375c18[_0x0a9e('0x32')]=_0x375c18['attributes'][_0x0a9e('0x35')]?_0x375c18['attributes']:_0x5d38ae[_0x0a9e('0x2e')];_0x375c18['order']=qs['sort'](_0x61bb17['query'][_0x0a9e('0x39')]);_0x375c18['where']=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3a')](_0x61bb17[_0x0a9e('0x2f')],_0x5d38ae[_0x0a9e('0x31')]));if(_0x61bb17[_0x0a9e('0x2f')][_0x0a9e('0x3b')]){_0x375c18[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](_0x375c18['where'],{'$or':_[_0x0a9e('0x29')](_0x375c18[_0x0a9e('0x32')],function(_0x2642bb){var _0x30c491={};_0x30c491[_0x2642bb]={'$like':'%'+_0x61bb17[_0x0a9e('0x2f')][_0x0a9e('0x3b')]+'%'};return _0x30c491;})});}_0x375c18=_['merge']({},_0x375c18,_0x61bb17[_0x0a9e('0x3f')]);return _0x4b1b9f[_0x0a9e('0x4a')](_0x375c18);}})['then'](function(_0x3649cc){if(_0x3649cc){_0x53975a=_0x3649cc['length'];if(!_0x61bb17[_0x0a9e('0x2f')]['hasOwnProperty']('nolimit')){_0x375c18['limit']=qs[_0x0a9e('0x1b')](_0x61bb17['query'][_0x0a9e('0x1b')]);_0x375c18[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x61bb17[_0x0a9e('0x2f')][_0x0a9e('0x18')]);}return _0x4b1b9f[_0x0a9e('0x4a')](_0x375c18);}})['then'](function(_0x1627a7){if(_0x1627a7){return _0x1627a7?{'count':_0x53975a,'rows':_0x1627a7}:null;}})['then'](respondWithResult(_0x30decb,null))[_0x0a9e('0x43')](handleError(_0x30decb,null));};exports[_0x0a9e('0x4d')]=function(_0x51aaf7,_0x5adf8f,_0x453360){if(_0x51aaf7[_0x0a9e('0x49')]['id']){delete _0x51aaf7[_0x0a9e('0x49')]['id'];}return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x51aaf7[_0x0a9e('0x45')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5adf8f,null))['then'](function(_0x797b45){if(_0x797b45){_0x51aaf7[_0x0a9e('0x49')][_0x0a9e('0x4e')]=_0x797b45['id'];_0x51aaf7[_0x0a9e('0x49')][_0x0a9e('0x4f')]=integrations['getSubjects'](_0x51aaf7[_0x0a9e('0x49')][_0x0a9e('0x50')],_0x51aaf7[_0x0a9e('0x49')]['type']);_0x51aaf7[_0x0a9e('0x49')]['Descriptions']=integrations['getDescriptions'](_0x51aaf7[_0x0a9e('0x49')][_0x0a9e('0x50')],_0x51aaf7[_0x0a9e('0x49')][_0x0a9e('0x2c')]);return db[_0x0a9e('0x4c')][_0x0a9e('0x48')](_0x51aaf7[_0x0a9e('0x49')],{'include':[{'model':db[_0x0a9e('0x51')],'as':_0x0a9e('0x4f')},{'model':db[_0x0a9e('0x51')],'as':_0x0a9e('0x52')}]});}return null;})[_0x0a9e('0x22')](respondWithResult(_0x5adf8f,null))[_0x0a9e('0x43')](handleError(_0x5adf8f,null));};exports[_0x0a9e('0x53')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9='';return db['FreshdeskAccount'][_0x0a9e('0x4b')]({'where':{'id':_0x320898[_0x0a9e('0x45')]['id']},'attributes':['id',_0x0a9e('0x54'),'apiKey']})[_0x0a9e('0x22')](handleEntityNotFound(_0x412a72,null))[_0x0a9e('0x22')](function(_0x4b341d){if(_0x4b341d){_0x4257c9=_0x4b341d[_0x0a9e('0x54')];var _0x56e31e=_0x4257c9[_0x0a9e('0x55')](-0x1);if(_0x56e31e==='/'){_0x4257c9=_0x4257c9[_0x0a9e('0x56')](0x0,_0x4257c9[_0x0a9e('0x57')](_0x56e31e));}return rp({'method':'GET','uri':util['format']('%s/%s',_0x4257c9,_0x0a9e('0x58')),'headers':{'Authorization':util[_0x0a9e('0x59')](_0x0a9e('0x5a'),new Buffer(util[_0x0a9e('0x59')](_0x0a9e('0x5b'),_0x4b341d[_0x0a9e('0x5c')]))[_0x0a9e('0x5d')](_0x0a9e('0x5e')))},'json':!![]});}})['then'](function(_0x235f8f){if(_0x235f8f){var _0xcbc8b2=[_0x0a9e('0x5f'),'subject',_0x0a9e('0x60'),'description',_0x0a9e('0x16'),_0x0a9e('0x61'),'group',_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),_0x0a9e('0x65')];_['remove'](_0x235f8f,function(_0x1d442c){return _0xcbc8b2[_0x0a9e('0x66')](_0x1d442c[_0x0a9e('0x26')])||!_0x1d442c[_0x0a9e('0x67')]&&_0x1d442c['type']!==_0x0a9e('0x68')&&_0x1d442c[_0x0a9e('0x2c')]!==_0x0a9e('0x69');});return{'count':_0x235f8f[_0x0a9e('0x35')],'rows':_['map'](_0x235f8f,function(_0x290d43){return{'id':_0x290d43[_0x0a9e('0x26')],'name':_0x290d43[_0x0a9e('0x6a')],'custom':!_0x290d43[_0x0a9e('0x67')],'options':_0x290d43[_0x0a9e('0x6b')]?_[_0x0a9e('0x29')](_0x290d43[_0x0a9e('0x6b')],function(_0x3df0e3){return{'name':_[_0x0a9e('0x6c')](_0x3df0e3),'value':_0x3df0e3};}):[]};})};}})[_0x0a9e('0x22')](respondWithResult(_0x412a72,null))[_0x0a9e('0x43')](function(_0x1f10ef){var _0x25744a=_0x320898[_0x0a9e('0x2f')]['test']?0x1f4:_0x1f10ef[_0x0a9e('0x6d')]||0x1f4;logger[_0x0a9e('0x25')](_0x0a9e('0x6e'),'getFields',_0x25744a,JSON[_0x0a9e('0x6f')](_0x1f10ef));delete _0x1f10ef[_0x0a9e('0x26')];if(_0x25744a===0x191){_0x25744a=0x190;}_0x412a72[_0x0a9e('0x16')](_0x25744a)[_0x0a9e('0x27')](_0x320898['query']['test']?{'message':_0x0a9e('0x70'),'statusCode':_0x1f10ef[_0x0a9e('0x6d')]}:_0x1f10ef);});}; \ No newline at end of file +var _0x1339=['subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','update','then','name','send','map','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','FreshdeskAccount','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','destroy','params','findOne','pick','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','toString','base64','requester'];(function(_0x1546b4,_0x52e5a4){var _0x1c40ca=function(_0xc3282b){while(--_0xc3282b){_0x1546b4['push'](_0x1546b4['shift']());}};_0x1c40ca(++_0x52e5a4);}(_0x1339,0x1ed));var _0x9133=function(_0xa58c09,_0x321866){_0xa58c09=_0xa58c09-0x0;var _0x1d763f=_0x1339[_0xa58c09];return _0x1d763f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9133('0x1a'));function respondWithStatusCode(_0x7cc59e,_0x4bbfdc){_0x4bbfdc=_0x4bbfdc||0xcc;return function(_0x5283a3){if(_0x5283a3){return _0x7cc59e[_0x9133('0x1b')](_0x4bbfdc);}return _0x7cc59e['status'](_0x4bbfdc)[_0x9133('0x1c')]();};}function respondWithResult(_0x439e1a,_0x17dfd1){_0x17dfd1=_0x17dfd1||0xc8;return function(_0x464ec5){if(_0x464ec5){return _0x439e1a[_0x9133('0x1d')](_0x17dfd1)[_0x9133('0x1e')](_0x464ec5);}};}function respondWithFilteredResult(_0x49cc5d,_0x13f8fc){return function(_0x1e23ce){if(_0x1e23ce){var _0x4f4f14=typeof _0x13f8fc[_0x9133('0x1f')]===_0x9133('0x20')&&typeof _0x13f8fc[_0x9133('0x21')]===_0x9133('0x20');var _0x4a2c4f=_0x1e23ce[_0x9133('0x22')];var _0x573998=_0x4f4f14?0x0:_0x13f8fc[_0x9133('0x1f')];var _0x5d4a77=_0x4f4f14?_0x1e23ce[_0x9133('0x22')]:_0x13f8fc[_0x9133('0x1f')]+_0x13f8fc['limit'];var _0x38dd60;if(_0x5d4a77>=_0x4a2c4f){_0x5d4a77=_0x4a2c4f;_0x38dd60=0xc8;}else{_0x38dd60=0xce;}_0x49cc5d['status'](_0x38dd60);return _0x49cc5d[_0x9133('0x23')]('Content-Range',_0x573998+'-'+_0x5d4a77+'/'+_0x4a2c4f)['json'](_0x1e23ce);}return null;};}function patchUpdates(_0x2f7354){return function(_0x577de4){try{jsonpatch[_0x9133('0x24')](_0x577de4,_0x2f7354,!![]);}catch(_0x4c1088){return BPromise['reject'](_0x4c1088);}return _0x577de4['save']();};}function saveUpdates(_0x2e99a1,_0x2dcfb8){return function(_0x4da09c){if(_0x4da09c){return _0x4da09c[_0x9133('0x25')](_0x2e99a1)[_0x9133('0x26')](function(_0xff08d5){return _0xff08d5;});}return null;};}function removeEntity(_0x26190c,_0x4f26e8){return function(_0xdb7a98){if(_0xdb7a98){return _0xdb7a98['destroy']()[_0x9133('0x26')](function(){_0x26190c[_0x9133('0x1d')](0xcc)[_0x9133('0x1c')]();});}};}function handleEntityNotFound(_0x14c1cb,_0x4483ef){return function(_0xe829b){if(!_0xe829b){_0x14c1cb[_0x9133('0x1b')](0x194);}return _0xe829b;};}function handleError(_0x313d43,_0x1b6b3e){_0x1b6b3e=_0x1b6b3e||0x1f4;return function(_0x46050b){logger['error'](_0x46050b['stack']);if(_0x46050b[_0x9133('0x27')]){delete _0x46050b[_0x9133('0x27')];}_0x313d43[_0x9133('0x1d')](_0x1b6b3e)[_0x9133('0x28')](_0x46050b);};}exports['index']=function(_0x4ecd9e,_0x3e2404){var _0x45966d={},_0x188c49={},_0x26d351={'count':0x0,'rows':[]};var _0x390f50=_[_0x9133('0x29')](db['FreshdeskAccount']['rawAttributes'],function(_0x5a27c1){return{'name':_0x5a27c1[_0x9133('0x2a')],'type':_0x5a27c1['type'][_0x9133('0x2b')]};});_0x188c49[_0x9133('0x2c')]=_['map'](_0x390f50,_0x9133('0x27'));_0x188c49['query']=_[_0x9133('0x2d')](_0x4ecd9e[_0x9133('0x2e')]);_0x188c49[_0x9133('0x2f')]=_['intersection'](_0x188c49[_0x9133('0x2c')],_0x188c49[_0x9133('0x2e')]);_0x45966d[_0x9133('0x30')]=_['intersection'](_0x188c49[_0x9133('0x2c')],qs[_0x9133('0x31')](_0x4ecd9e[_0x9133('0x2e')]['fields']));_0x45966d[_0x9133('0x30')]=_0x45966d[_0x9133('0x30')][_0x9133('0x32')]?_0x45966d[_0x9133('0x30')]:_0x188c49['model'];if(!_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x33')]('nolimit')){_0x45966d[_0x9133('0x21')]=qs[_0x9133('0x21')](_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x21')]);_0x45966d[_0x9133('0x1f')]=qs[_0x9133('0x1f')](_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x1f')]);}_0x45966d[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4ecd9e[_0x9133('0x2e')]['sort']);_0x45966d[_0x9133('0x36')]=qs[_0x9133('0x2f')](_['pick'](_0x4ecd9e[_0x9133('0x2e')],_0x188c49[_0x9133('0x2f')]),_0x390f50);if(_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x37')]){_0x45966d[_0x9133('0x36')]=_[_0x9133('0x38')](_0x45966d['where'],{'$or':_['map'](_0x390f50,function(_0x33c05b){if(_0x33c05b[_0x9133('0x39')]!==_0x9133('0x3a')){var _0x112514={};_0x112514[_0x33c05b[_0x9133('0x27')]]={'$like':'%'+_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x37')]+'%'};return _0x112514;}})});}_0x45966d=_[_0x9133('0x38')]({},_0x45966d,_0x4ecd9e[_0x9133('0x3b')]);var _0x5a3f73={'where':_0x45966d[_0x9133('0x36')]};return db[_0x9133('0x3c')][_0x9133('0x22')](_0x5a3f73)[_0x9133('0x26')](function(_0x3df6ca){_0x26d351['count']=_0x3df6ca;if(_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x3d')]){_0x45966d[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x3c')]['findAll'](_0x45966d);})[_0x9133('0x26')](function(_0x1293f1){_0x26d351[_0x9133('0x3f')]=_0x1293f1;return _0x26d351;})[_0x9133('0x26')](respondWithFilteredResult(_0x3e2404,_0x45966d))[_0x9133('0x40')](handleError(_0x3e2404,null));};exports[_0x9133('0x41')]=function(_0x3b2287,_0x4ca1a3){var _0x7f6cd9={'raw':![],'where':{'id':_0x3b2287['params']['id']}},_0x5e0fde={};_0x5e0fde[_0x9133('0x2c')]=_[_0x9133('0x2d')](db[_0x9133('0x3c')][_0x9133('0x42')]);_0x5e0fde[_0x9133('0x2e')]=_[_0x9133('0x2d')](_0x3b2287[_0x9133('0x2e')]);_0x5e0fde[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x5e0fde['model'],_0x5e0fde[_0x9133('0x2e')]);_0x7f6cd9[_0x9133('0x30')]=_[_0x9133('0x43')](_0x5e0fde['model'],qs['fields'](_0x3b2287[_0x9133('0x2e')][_0x9133('0x31')]));_0x7f6cd9['attributes']=_0x7f6cd9[_0x9133('0x30')][_0x9133('0x32')]?_0x7f6cd9[_0x9133('0x30')]:_0x5e0fde[_0x9133('0x2c')];if(_0x3b2287[_0x9133('0x2e')]['includeAll']){_0x7f6cd9[_0x9133('0x3e')]=[{'all':!![]}];}_0x7f6cd9=_[_0x9133('0x38')]({},_0x7f6cd9,_0x3b2287[_0x9133('0x3b')]);return db['FreshdeskAccount'][_0x9133('0x44')](_0x7f6cd9)[_0x9133('0x26')](handleEntityNotFound(_0x4ca1a3,null))['then'](respondWithResult(_0x4ca1a3,null))['catch'](handleError(_0x4ca1a3,null));};exports[_0x9133('0x45')]=function(_0x2cd935,_0x4446fe){return db[_0x9133('0x3c')][_0x9133('0x45')](_0x2cd935[_0x9133('0x46')],{})[_0x9133('0x26')](respondWithResult(_0x4446fe,0xc9))[_0x9133('0x40')](handleError(_0x4446fe,null));};exports[_0x9133('0x25')]=function(_0xf07fbb,_0x3d6a49){if(_0xf07fbb[_0x9133('0x46')]['id']){delete _0xf07fbb['body']['id'];}return db['FreshdeskAccount'][_0x9133('0x44')]({'where':{'id':_0xf07fbb['params']['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x3d6a49,null))[_0x9133('0x26')](saveUpdates(_0xf07fbb[_0x9133('0x46')],null))[_0x9133('0x26')](respondWithResult(_0x3d6a49,null))['catch'](handleError(_0x3d6a49,null));};exports[_0x9133('0x47')]=function(_0x25750f,_0x799772){return db['FreshdeskAccount'][_0x9133('0x44')]({'where':{'id':_0x25750f[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x799772,null))['then'](removeEntity(_0x799772,null))[_0x9133('0x40')](handleError(_0x799772,null));};exports['getConfigurations']=function(_0x2342f4,_0x3c4b67,_0x304673){var _0x9fa963={};var _0x4f58fe={};var _0x4a346c;var _0x2f09f6;return db[_0x9133('0x3c')][_0x9133('0x49')]({'where':{'id':_0x2342f4[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x3c4b67,null))['then'](function(_0x554bb9){if(_0x554bb9){_0x4a346c=_0x554bb9;_0x4f58fe[_0x9133('0x2c')]=_[_0x9133('0x2d')](db['FreshdeskConfiguration'][_0x9133('0x42')]);_0x4f58fe[_0x9133('0x2e')]=_['keys'](_0x2342f4['query']);_0x4f58fe['filters']=_[_0x9133('0x43')](_0x4f58fe['model'],_0x4f58fe[_0x9133('0x2e')]);_0x9fa963[_0x9133('0x30')]=_[_0x9133('0x43')](_0x4f58fe[_0x9133('0x2c')],qs['fields'](_0x2342f4[_0x9133('0x2e')]['fields']));_0x9fa963[_0x9133('0x30')]=_0x9fa963[_0x9133('0x30')][_0x9133('0x32')]?_0x9fa963[_0x9133('0x30')]:_0x4f58fe[_0x9133('0x2c')];_0x9fa963[_0x9133('0x34')]=qs['sort'](_0x2342f4['query']['sort']);_0x9fa963[_0x9133('0x36')]=qs[_0x9133('0x2f')](_[_0x9133('0x4a')](_0x2342f4['query'],_0x4f58fe[_0x9133('0x2f')]));if(_0x2342f4[_0x9133('0x2e')][_0x9133('0x37')]){_0x9fa963[_0x9133('0x36')]=_[_0x9133('0x38')](_0x9fa963[_0x9133('0x36')],{'$or':_[_0x9133('0x29')](_0x9fa963[_0x9133('0x30')],function(_0x59bb26){var _0x464954={};_0x464954[_0x59bb26]={'$like':'%'+_0x2342f4['query'][_0x9133('0x37')]+'%'};return _0x464954;})});}_0x9fa963=_['merge']({},_0x9fa963,_0x2342f4[_0x9133('0x3b')]);return _0x4a346c[_0x9133('0x4b')](_0x9fa963);}})['then'](function(_0x540b02){if(_0x540b02){_0x2f09f6=_0x540b02[_0x9133('0x32')];if(!_0x2342f4[_0x9133('0x2e')][_0x9133('0x33')](_0x9133('0x4c'))){_0x9fa963[_0x9133('0x21')]=qs[_0x9133('0x21')](_0x2342f4[_0x9133('0x2e')][_0x9133('0x21')]);_0x9fa963[_0x9133('0x1f')]=qs[_0x9133('0x1f')](_0x2342f4[_0x9133('0x2e')]['offset']);}return _0x4a346c[_0x9133('0x4b')](_0x9fa963);}})['then'](function(_0x23d61f){if(_0x23d61f){return _0x23d61f?{'count':_0x2f09f6,'rows':_0x23d61f}:null;}})[_0x9133('0x26')](respondWithResult(_0x3c4b67,null))[_0x9133('0x40')](handleError(_0x3c4b67,null));};exports[_0x9133('0x4d')]=function(_0xd37001,_0x52d4c8,_0x35bc72){if(_0xd37001[_0x9133('0x46')]['id']){delete _0xd37001[_0x9133('0x46')]['id'];}return db[_0x9133('0x3c')]['findOne']({'where':{'id':_0xd37001[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x52d4c8,null))[_0x9133('0x26')](function(_0x31e978){if(_0x31e978){_0xd37001['body']['AccountId']=_0x31e978['id'];_0xd37001[_0x9133('0x46')][_0x9133('0x4e')]=integrations[_0x9133('0x4f')](_0xd37001[_0x9133('0x46')][_0x9133('0x50')],_0xd37001[_0x9133('0x46')]['type']);_0xd37001[_0x9133('0x46')][_0x9133('0x51')]=integrations[_0x9133('0x52')](_0xd37001[_0x9133('0x46')]['channel'],_0xd37001[_0x9133('0x46')]['type']);return db[_0x9133('0x53')][_0x9133('0x45')](_0xd37001[_0x9133('0x46')],{'include':[{'model':db[_0x9133('0x54')],'as':_0x9133('0x4e')},{'model':db[_0x9133('0x54')],'as':_0x9133('0x51')}]});}return null;})[_0x9133('0x26')](respondWithResult(_0x52d4c8,null))['catch'](handleError(_0x52d4c8,null));};exports[_0x9133('0x55')]=function(_0x1fcd01,_0x10afd7,_0x152283){var _0x406861='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x1fcd01['params']['id']},'attributes':['id',_0x9133('0x56'),_0x9133('0x57')]})[_0x9133('0x26')](handleEntityNotFound(_0x10afd7,null))['then'](function(_0xcbc942){if(_0xcbc942){_0x406861=_0xcbc942[_0x9133('0x56')];var _0x36aa57=_0x406861[_0x9133('0x58')](-0x1);if(_0x36aa57==='/'){_0x406861=_0x406861[_0x9133('0x59')](0x0,_0x406861[_0x9133('0x5a')](_0x36aa57));}return rp({'method':_0x9133('0x5b'),'uri':util[_0x9133('0x5c')]('%s/%s',_0x406861,_0x9133('0x5d')),'headers':{'Authorization':util[_0x9133('0x5c')]('Basic\x20%s',new Buffer(util[_0x9133('0x5c')]('%s:X',_0xcbc942[_0x9133('0x57')]))[_0x9133('0x5e')](_0x9133('0x5f')))},'json':!![]});}})[_0x9133('0x26')](function(_0x353a37){if(_0x353a37){var _0x51c66b=[_0x9133('0x60'),_0x9133('0x61'),_0x9133('0x62'),_0x9133('0x63'),'status',_0x9133('0x64'),_0x9133('0x65'),_0x9133('0x66'),_0x9133('0x67'),_0x9133('0x65'),_0x9133('0x68')];_[_0x9133('0x69')](_0x353a37,function(_0x156d20){return _0x51c66b[_0x9133('0x6a')](_0x156d20[_0x9133('0x27')])||!_0x156d20[_0x9133('0x6b')]&&_0x156d20['type']!==_0x9133('0x6c')&&_0x156d20[_0x9133('0x39')]!==_0x9133('0x6d');});return{'count':_0x353a37[_0x9133('0x32')],'rows':_['map'](_0x353a37,function(_0x2fe8e9){return{'id':_0x2fe8e9['name'],'name':_0x2fe8e9[_0x9133('0x6e')],'custom':!_0x2fe8e9[_0x9133('0x6b')],'options':_0x2fe8e9[_0x9133('0x6f')]?_['map'](_0x2fe8e9[_0x9133('0x6f')],function(_0x163487){return{'name':_[_0x9133('0x70')](_0x163487),'value':_0x163487};}):[]};})};}})['then'](respondWithResult(_0x10afd7,null))[_0x9133('0x40')](function(_0x3275b3){var _0x5013f8=_0x1fcd01[_0x9133('0x2e')][_0x9133('0x71')]?0x1f4:_0x3275b3[_0x9133('0x72')]||0x1f4;logger['error'](_0x9133('0x73'),'getFields',_0x5013f8,JSON[_0x9133('0x74')](_0x3275b3));delete _0x3275b3[_0x9133('0x27')];if(_0x5013f8===0x191){_0x5013f8=0x190;}_0x10afd7[_0x9133('0x1d')](_0x5013f8)['send'](_0x1fcd01[_0x9133('0x2e')]['test']?{'message':_0x9133('0x75'),'statusCode':_0x3275b3[_0x9133('0x72')]}:_0x3275b3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e833c3b..d63a741 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 _0x4129=['api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','lodash','util','../../config/logger'];(function(_0x4d3e2f,_0xd1d6ab){var _0x3f305f=function(_0x45e41f){while(--_0x45e41f){_0x4d3e2f['push'](_0x4d3e2f['shift']());}};_0x3f305f(++_0xd1d6ab);}(_0x4129,0x171));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9412('0x0'));var util=require(_0x9412('0x1'));var logger=require(_0x9412('0x2'))(_0x9412('0x3'));var moment=require(_0x9412('0x4'));var BPromise=require('bluebird');var rp=require(_0x9412('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9412('0x6'));var config=require(_0x9412('0x7'));var attributes=require(_0x9412('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x9412('0x9')]=function(_0x1896b0,_0x33120f){return _0x1896b0[_0x9412('0xa')](_0x9412('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61f7=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x39f59b,_0x5e5d5f){var _0x9ab427=function(_0x3238b3){while(--_0x3238b3){_0x39f59b['push'](_0x39f59b['shift']());}};_0x9ab427(++_0x5e5d5f);}(_0x61f7,0xb9));var _0x761f=function(_0xff87a5,_0x77e161){_0xff87a5=_0xff87a5-0x0;var _0x27b451=_0x61f7[_0xff87a5];return _0x27b451;};'use strict';var _=require(_0x761f('0x0'));var util=require(_0x761f('0x1'));var logger=require(_0x761f('0x2'))(_0x761f('0x3'));var moment=require(_0x761f('0x4'));var BPromise=require(_0x761f('0x5'));var rp=require(_0x761f('0x6'));var fs=require('fs');var path=require(_0x761f('0x7'));var rimraf=require('rimraf');var config=require(_0x761f('0x8'));var attributes=require(_0x761f('0x9'));var integrations=require(_0x761f('0xa'));module[_0x761f('0xb')]=function(_0x43f5b2,_0x5d9fa4){return _0x43f5b2[_0x761f('0xc')](_0x761f('0xd'),attributes,{'tableName':_0x761f('0xe'),'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 fa8bbef..d3a43c5 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 _0xee40=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','findAll','raw','attributes','options','limit','include','model','map','ShowFreshdeskAccount','where'];(function(_0x38e3d4,_0x4deb73){var _0x5f012c=function(_0xffb891){while(--_0xffb891){_0x38e3d4['push'](_0x38e3d4['shift']());}};_0x5f012c(++_0x4deb73);}(_0xee40,0x136));var _0x0ee4=function(_0x4b9565,_0x2d23d0){_0x4b9565=_0x4b9565-0x0;var _0x1322f3=_0xee40[_0x4b9565];return _0x1322f3;};'use strict';var _=require('lodash');var util=require(_0x0ee4('0x0'));var moment=require('moment');var BPromise=require(_0x0ee4('0x1'));var rs=require(_0x0ee4('0x2'));var fs=require('fs');var Redis=require(_0x0ee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ee4('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ee4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0ee4('0x6')][_0x0ee4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe08c4,_0x4af7f5,_0x45f219){return new BPromise(function(_0x5268f3,_0x4e1f51){return client[_0x0ee4('0x8')](_0xe08c4,_0x45f219)[_0x0ee4('0x9')](function(_0x33ba38){logger[_0x0ee4('0xa')](_0x0ee4('0xb'),_0x4af7f5,_0x0ee4('0xc'));logger[_0x0ee4('0xd')](_0x0ee4('0xe'),_0x4af7f5,'request\x20sent',JSON[_0x0ee4('0xf')](_0x33ba38));if(_0x33ba38['error']){if(_0x33ba38[_0x0ee4('0x10')][_0x0ee4('0x11')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4af7f5,_0x33ba38[_0x0ee4('0x10')]['message']);return _0x4e1f51(_0x33ba38[_0x0ee4('0x10')][_0x0ee4('0x12')]);}logger[_0x0ee4('0x10')](_0x0ee4('0xb'),_0x4af7f5,_0x33ba38[_0x0ee4('0x10')][_0x0ee4('0x12')]);return _0x5268f3(_0x33ba38[_0x0ee4('0x10')][_0x0ee4('0x12')]);}else{logger[_0x0ee4('0xa')](_0x0ee4('0xb'),_0x4af7f5,_0x0ee4('0xc'));_0x5268f3(_0x33ba38['result'][_0x0ee4('0x12')]);}})[_0x0ee4('0x13')](function(_0x3e395c){logger['error'](_0x0ee4('0xb'),_0x4af7f5,_0x3e395c);_0x4e1f51(_0x3e395c);});});}exports[_0x0ee4('0x14')]=function(_0x27aaf1){var _0x411ef6=this;return new Promise(function(_0x10034c,_0x2a2f91){return db['FreshdeskAccount'][_0x0ee4('0x15')]({'raw':_0x27aaf1['options']?_0x27aaf1['options'][_0x0ee4('0x16')]===undefined?!![]:![]:!![],'where':_0x27aaf1['options']?_0x27aaf1['options']['where']||null:null,'attributes':_0x27aaf1['options']?_0x27aaf1['options'][_0x0ee4('0x17')]||null:null,'limit':_0x27aaf1[_0x0ee4('0x18')]?_0x27aaf1[_0x0ee4('0x18')][_0x0ee4('0x19')]||null:null,'include':_0x27aaf1[_0x0ee4('0x18')]?_0x27aaf1[_0x0ee4('0x18')][_0x0ee4('0x1a')]?_['map'](_0x27aaf1[_0x0ee4('0x18')][_0x0ee4('0x1a')],function(_0xcd8d1f){return{'model':db[_0xcd8d1f[_0x0ee4('0x1b')]],'as':_0xcd8d1f['as'],'attributes':_0xcd8d1f['attributes'],'include':_0xcd8d1f['include']?_[_0x0ee4('0x1c')](_0xcd8d1f['include'],function(_0x472848){return{'model':db[_0x472848['model']],'as':_0x472848['as'],'attributes':_0x472848['attributes'],'include':_0x472848[_0x0ee4('0x1a')]?_[_0x0ee4('0x1c')](_0x472848[_0x0ee4('0x1a')],function(_0x3dfb2b){return{'model':db[_0x3dfb2b[_0x0ee4('0x1b')]],'as':_0x3dfb2b['as'],'attributes':_0x3dfb2b[_0x0ee4('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0ee4('0x9')](function(_0x5170dd){logger[_0x0ee4('0xa')](_0x0ee4('0x14'),_0x27aaf1);logger[_0x0ee4('0xd')](_0x0ee4('0x14'),_0x27aaf1,JSON[_0x0ee4('0xf')](_0x5170dd));_0x10034c(_0x5170dd);})['catch'](function(_0x594a2c){logger[_0x0ee4('0x10')](_0x0ee4('0x14'),_0x594a2c[_0x0ee4('0x12')],_0x27aaf1);_0x2a2f91(_0x411ef6[_0x0ee4('0x10')](0x1f4,_0x594a2c[_0x0ee4('0x12')]));});});};exports[_0x0ee4('0x1d')]=function(_0x58ead3){var _0x419b47=this;return new Promise(function(_0x42d560,_0x538a47){return db['FreshdeskAccount']['find']({'raw':_0x58ead3[_0x0ee4('0x18')]?_0x58ead3[_0x0ee4('0x18')][_0x0ee4('0x16')]===undefined?!![]:![]:!![],'where':_0x58ead3[_0x0ee4('0x18')]?_0x58ead3[_0x0ee4('0x18')][_0x0ee4('0x1e')]||null:null,'attributes':_0x58ead3[_0x0ee4('0x18')]?_0x58ead3['options'][_0x0ee4('0x17')]||null:null,'include':_0x58ead3['options']?_0x58ead3[_0x0ee4('0x18')]['include']?_[_0x0ee4('0x1c')](_0x58ead3[_0x0ee4('0x18')]['include'],function(_0x22dc91){return{'model':db[_0x22dc91['model']],'as':_0x22dc91['as'],'attributes':_0x22dc91['attributes'],'include':_0x22dc91[_0x0ee4('0x1a')]?_[_0x0ee4('0x1c')](_0x22dc91[_0x0ee4('0x1a')],function(_0x55e4a5){return{'model':db[_0x55e4a5[_0x0ee4('0x1b')]],'as':_0x55e4a5['as'],'attributes':_0x55e4a5['attributes'],'include':_0x55e4a5[_0x0ee4('0x1a')]?_[_0x0ee4('0x1c')](_0x55e4a5[_0x0ee4('0x1a')],function(_0x51e811){return{'model':db[_0x51e811[_0x0ee4('0x1b')]],'as':_0x51e811['as'],'attributes':_0x51e811[_0x0ee4('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0ee4('0x9')](function(_0x57c572){logger[_0x0ee4('0xa')](_0x0ee4('0x1d'),_0x58ead3);logger[_0x0ee4('0xd')](_0x0ee4('0x1d'),_0x58ead3,JSON[_0x0ee4('0xf')](_0x57c572));_0x42d560(_0x57c572);})[_0x0ee4('0x13')](function(_0x315cb0){logger[_0x0ee4('0x10')](_0x0ee4('0x1d'),_0x315cb0[_0x0ee4('0x12')],_0x58ead3);_0x538a47(_0x419b47[_0x0ee4('0x10')](0x1f4,_0x315cb0['message']));});});}; \ No newline at end of file +var _0xc999=['FreshdeskAccount','find','util','moment','bluebird','../../config/logger','../../config/environment','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetFreshdeskAccount','raw','options','where','limit','include','map','model','attributes','catch','ShowFreshdeskAccount'];(function(_0x1d92f8,_0xe82340){var _0x56dba3=function(_0x5ecd51){while(--_0x5ecd51){_0x1d92f8['push'](_0x1d92f8['shift']());}};_0x56dba3(++_0xe82340);}(_0xc999,0x176));var _0x9c99=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xc999[_0x65c50e];return _0x4573e7;};'use strict';var _=require('lodash');var util=require(_0x9c99('0x0'));var moment=require(_0x9c99('0x1'));var BPromise=require(_0x9c99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c99('0x3'))('rpc');var config=require(_0x9c99('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9c99('0x5')][_0x9c99('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xe80252,_0x47bfaa,_0xfa25e1){return new BPromise(function(_0x323317,_0x326099){return client[_0x9c99('0x7')](_0xe80252,_0xfa25e1)[_0x9c99('0x8')](function(_0xfe5788){logger['info'](_0x9c99('0x9'),_0x47bfaa,_0x9c99('0xa'));logger[_0x9c99('0xb')](_0x9c99('0xc'),_0x47bfaa,'request\x20sent',JSON[_0x9c99('0xd')](_0xfe5788));if(_0xfe5788[_0x9c99('0xe')]){if(_0xfe5788[_0x9c99('0xe')]['code']===0x1f4){logger[_0x9c99('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x47bfaa,_0xfe5788['error'][_0x9c99('0xf')]);return _0x326099(_0xfe5788[_0x9c99('0xe')][_0x9c99('0xf')]);}logger[_0x9c99('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x47bfaa,_0xfe5788[_0x9c99('0xe')]['message']);return _0x323317(_0xfe5788['error']['message']);}else{logger[_0x9c99('0x10')](_0x9c99('0x9'),_0x47bfaa,'request\x20sent');_0x323317(_0xfe5788[_0x9c99('0x11')]['message']);}})['catch'](function(_0x413965){logger[_0x9c99('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x47bfaa,_0x413965);_0x326099(_0x413965);});});}exports[_0x9c99('0x12')]=function(_0x436e43){var _0x5eaa11=this;return new Promise(function(_0x1a6f0e,_0x1cc5ea){return db['FreshdeskAccount']['findAll']({'raw':_0x436e43['options']?_0x436e43['options'][_0x9c99('0x13')]===undefined?!![]:![]:!![],'where':_0x436e43[_0x9c99('0x14')]?_0x436e43[_0x9c99('0x14')][_0x9c99('0x15')]||null:null,'attributes':_0x436e43[_0x9c99('0x14')]?_0x436e43[_0x9c99('0x14')]['attributes']||null:null,'limit':_0x436e43[_0x9c99('0x14')]?_0x436e43[_0x9c99('0x14')][_0x9c99('0x16')]||null:null,'include':_0x436e43[_0x9c99('0x14')]?_0x436e43[_0x9c99('0x14')][_0x9c99('0x17')]?_[_0x9c99('0x18')](_0x436e43[_0x9c99('0x14')][_0x9c99('0x17')],function(_0x38106a){return{'model':db[_0x38106a[_0x9c99('0x19')]],'as':_0x38106a['as'],'attributes':_0x38106a[_0x9c99('0x1a')],'include':_0x38106a[_0x9c99('0x17')]?_[_0x9c99('0x18')](_0x38106a['include'],function(_0x525479){return{'model':db[_0x525479[_0x9c99('0x19')]],'as':_0x525479['as'],'attributes':_0x525479['attributes'],'include':_0x525479[_0x9c99('0x17')]?_['map'](_0x525479[_0x9c99('0x17')],function(_0x392f6d){return{'model':db[_0x392f6d[_0x9c99('0x19')]],'as':_0x392f6d['as'],'attributes':_0x392f6d[_0x9c99('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9c99('0x8')](function(_0x4d448c){logger[_0x9c99('0x10')]('GetFreshdeskAccount',_0x436e43);logger['debug'](_0x9c99('0x12'),_0x436e43,JSON[_0x9c99('0xd')](_0x4d448c));_0x1a6f0e(_0x4d448c);})[_0x9c99('0x1b')](function(_0x14e0d4){logger[_0x9c99('0xe')](_0x9c99('0x12'),_0x14e0d4['message'],_0x436e43);_0x1cc5ea(_0x5eaa11[_0x9c99('0xe')](0x1f4,_0x14e0d4['message']));});});};exports[_0x9c99('0x1c')]=function(_0x5ee60c){var _0x36abe3=this;return new Promise(function(_0x1e892d,_0x35907f){return db[_0x9c99('0x1d')][_0x9c99('0x1e')]({'raw':_0x5ee60c[_0x9c99('0x14')]?_0x5ee60c[_0x9c99('0x14')][_0x9c99('0x13')]===undefined?!![]:![]:!![],'where':_0x5ee60c[_0x9c99('0x14')]?_0x5ee60c[_0x9c99('0x14')][_0x9c99('0x15')]||null:null,'attributes':_0x5ee60c[_0x9c99('0x14')]?_0x5ee60c[_0x9c99('0x14')][_0x9c99('0x1a')]||null:null,'include':_0x5ee60c[_0x9c99('0x14')]?_0x5ee60c['options'][_0x9c99('0x17')]?_['map'](_0x5ee60c[_0x9c99('0x14')][_0x9c99('0x17')],function(_0x5e4df4){return{'model':db[_0x5e4df4[_0x9c99('0x19')]],'as':_0x5e4df4['as'],'attributes':_0x5e4df4['attributes'],'include':_0x5e4df4[_0x9c99('0x17')]?_[_0x9c99('0x18')](_0x5e4df4[_0x9c99('0x17')],function(_0x1a14d7){return{'model':db[_0x1a14d7[_0x9c99('0x19')]],'as':_0x1a14d7['as'],'attributes':_0x1a14d7[_0x9c99('0x1a')],'include':_0x1a14d7[_0x9c99('0x17')]?_[_0x9c99('0x18')](_0x1a14d7['include'],function(_0x49917d){return{'model':db[_0x49917d[_0x9c99('0x19')]],'as':_0x49917d['as'],'attributes':_0x49917d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x586878){logger[_0x9c99('0x10')](_0x9c99('0x1c'),_0x5ee60c);logger['debug'](_0x9c99('0x1c'),_0x5ee60c,JSON[_0x9c99('0xd')](_0x586878));_0x1e892d(_0x586878);})[_0x9c99('0x1b')](function(_0x514ca5){logger[_0x9c99('0xe')](_0x9c99('0x1c'),_0x514ca5[_0x9c99('0xf')],_0x5ee60c);_0x35907f(_0x36abe3['error'](0x1f4,_0x514ca5[_0x9c99('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 44bbbda..65d277c 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 _0xfbb9=['/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show'];(function(_0x19028e,_0x3cd2df){var _0x44df83=function(_0x299743){while(--_0x299743){_0x19028e['push'](_0x19028e['shift']());}};_0x44df83(++_0x3cd2df);}(_0xfbb9,0x145));var _0x9fbb=function(_0x27d7dd,_0x963ce8){_0x27d7dd=_0x27d7dd-0x0;var _0x14e95c=_0xfbb9[_0x27d7dd];return _0x14e95c;};'use strict';var multer=require(_0x9fbb('0x0'));var util=require(_0x9fbb('0x1'));var path=require('path');var timeout=require(_0x9fbb('0x2'));var express=require(_0x9fbb('0x3'));var router=express[_0x9fbb('0x4')]();var fs_extra=require(_0x9fbb('0x5'));var auth=require(_0x9fbb('0x6'));var interaction=require(_0x9fbb('0x7'));var config=require(_0x9fbb('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x9fbb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9fbb('0xa')]);router[_0x9fbb('0x9')]('/:id',auth[_0x9fbb('0xb')](),controller[_0x9fbb('0xc')]);router[_0x9fbb('0x9')](_0x9fbb('0xd'),auth[_0x9fbb('0xb')](),controller[_0x9fbb('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x9fbb('0xf')]);router[_0x9fbb('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9fbb('0x10')]);router['get'](_0x9fbb('0x11'),auth['isAuthenticated'](),controller[_0x9fbb('0x12')]);router[_0x9fbb('0x13')]('/',auth[_0x9fbb('0xb')](),controller[_0x9fbb('0x14')]);router['post'](_0x9fbb('0x11'),auth[_0x9fbb('0xb')](),controller['setTags']);router[_0x9fbb('0x15')](_0x9fbb('0x16'),auth['isAuthenticated'](),controller[_0x9fbb('0x17')]);router['delete'](_0x9fbb('0x16'),auth[_0x9fbb('0xb')](),controller[_0x9fbb('0x18')]);module[_0x9fbb('0x19')]=router; \ No newline at end of file +var _0x36d4=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','index','/:id','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy'];(function(_0xa73937,_0xa136a2){var _0x374e15=function(_0x1d810f){while(--_0x1d810f){_0xa73937['push'](_0xa73937['shift']());}};_0x374e15(++_0xa136a2);}(_0x36d4,0xd1));var _0x436d=function(_0x3db91a,_0x425740){_0x3db91a=_0x3db91a-0x0;var _0x54c81c=_0x36d4[_0x3db91a];return _0x54c81c;};'use strict';var multer=require(_0x436d('0x0'));var util=require(_0x436d('0x1'));var path=require(_0x436d('0x2'));var timeout=require('connect-timeout');var express=require(_0x436d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x436d('0x4'));var interaction=require(_0x436d('0x5'));var config=require(_0x436d('0x6'));var controller=require(_0x436d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x436d('0x8')]);router['get'](_0x436d('0x9'),auth[_0x436d('0xa')](),controller[_0x436d('0xb')]);router[_0x436d('0xc')](_0x436d('0xd'),auth[_0x436d('0xa')](),controller[_0x436d('0xe')]);router[_0x436d('0xc')](_0x436d('0xf'),auth[_0x436d('0xa')](),controller['getSubjects']);router[_0x436d('0xc')](_0x436d('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x436d('0x11'),auth[_0x436d('0xa')](),controller[_0x436d('0x12')]);router[_0x436d('0x13')]('/',auth[_0x436d('0xa')](),controller[_0x436d('0x14')]);router[_0x436d('0x13')](_0x436d('0x11'),auth[_0x436d('0xa')](),controller[_0x436d('0x15')]);router[_0x436d('0x16')](_0x436d('0x9'),auth[_0x436d('0xa')](),controller['update']);router[_0x436d('0x17')](_0x436d('0x9'),auth[_0x436d('0xa')](),controller[_0x436d('0x18')]);module[_0x436d('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7f64e7c..9ef2fd4 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 _0x4517=['STRING','sequelize','exports'];(function(_0x3f4aee,_0x4d5720){var _0x110539=function(_0x1a73c4){while(--_0x1a73c4){_0x3f4aee['push'](_0x3f4aee['shift']());}};_0x110539(++_0x4d5720);}(_0x4517,0xa3));var _0x7451=function(_0x35f930,_0x1a7406){_0x35f930=_0x35f930-0x0;var _0x3bcead=_0x4517[_0x35f930];return _0x3bcead;};'use strict';var Sequelize=require(_0x7451('0x0'));module[_0x7451('0x1')]={'name':{'type':Sequelize[_0x7451('0x2')]},'description':{'type':Sequelize[_0x7451('0x2')]}}; \ No newline at end of file +var _0xb547=['STRING'];(function(_0x4f5ef9,_0x2eaea0){var _0x4e43c1=function(_0x5845ca){while(--_0x5845ca){_0x4f5ef9['push'](_0x4f5ef9['shift']());}};_0x4e43c1(++_0x2eaea0);}(_0xb547,0xba));var _0x7b54=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0xb547[_0x152fe3];return _0xc5bb39;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b54('0x0')]},'description':{'type':Sequelize[_0x7b54('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e22f40c..fcd35d0 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 _0xdf80=['../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','save','update','then','destroy','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','merge','options','find','body','order','getFields','getSubjects','findOne','FreshdeskField','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x242225,_0x23e175){var _0x272125=function(_0x494143){while(--_0x494143){_0x242225['push'](_0x242225['shift']());}};_0x272125(++_0x23e175);}(_0xdf80,0x179));var _0x0df8=function(_0x346a46,_0x3ce5e1){_0x346a46=_0x346a46-0x0;var _0x46dcd2=_0xdf80[_0x346a46];return _0x46dcd2;};'use strict';var emlformat=require(_0x0df8('0x0'));var rimraf=require(_0x0df8('0x1'));var zipdir=require(_0x0df8('0x2'));var jsonpatch=require(_0x0df8('0x3'));var rp=require(_0x0df8('0x4'));var moment=require(_0x0df8('0x5'));var BPromise=require(_0x0df8('0x6'));var Mustache=require(_0x0df8('0x7'));var util=require(_0x0df8('0x8'));var path=require(_0x0df8('0x9'));var sox=require('sox');var csv=require(_0x0df8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0df8('0xb'));var _=require(_0x0df8('0xc'));var squel=require('squel');var crypto=require(_0x0df8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0df8('0xe'));var toCsv=require(_0x0df8('0xa'));var querystring=require('querystring');var Papa=require(_0x0df8('0xf'));var Redis=require(_0x0df8('0x10'));var authService=require(_0x0df8('0x11'));var qs=require(_0x0df8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0df8('0x13'));var utils=require(_0x0df8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0df8('0x15'));var db=require(_0x0df8('0x16'))['db'];function respondWithStatusCode(_0x58fd58,_0x4368ea){_0x4368ea=_0x4368ea||0xcc;return function(_0x13910e){if(_0x13910e){return _0x58fd58[_0x0df8('0x17')](_0x4368ea);}return _0x58fd58[_0x0df8('0x18')](_0x4368ea)[_0x0df8('0x19')]();};}function respondWithResult(_0x3cb32f,_0x1c8cb2){_0x1c8cb2=_0x1c8cb2||0xc8;return function(_0x241764){if(_0x241764){return _0x3cb32f[_0x0df8('0x18')](_0x1c8cb2)['json'](_0x241764);}};}function respondWithFilteredResult(_0x1cb5e8,_0x325a0c){return function(_0x15a609){if(_0x15a609){var _0x506dd8=typeof _0x325a0c[_0x0df8('0x1a')]==='undefined'&&typeof _0x325a0c[_0x0df8('0x1b')]===_0x0df8('0x1c');var _0x189573=_0x15a609[_0x0df8('0x1d')];var _0x452b0c=_0x506dd8?0x0:_0x325a0c[_0x0df8('0x1a')];var _0x4e91c3=_0x506dd8?_0x15a609[_0x0df8('0x1d')]:_0x325a0c['offset']+_0x325a0c[_0x0df8('0x1b')];var _0x441988;if(_0x4e91c3>=_0x189573){_0x4e91c3=_0x189573;_0x441988=0xc8;}else{_0x441988=0xce;}_0x1cb5e8[_0x0df8('0x18')](_0x441988);return _0x1cb5e8['set'](_0x0df8('0x1e'),_0x452b0c+'-'+_0x4e91c3+'/'+_0x189573)['json'](_0x15a609);}return null;};}function patchUpdates(_0x75b373){return function(_0x23711c){try{jsonpatch['apply'](_0x23711c,_0x75b373,!![]);}catch(_0x31c3e8){return BPromise['reject'](_0x31c3e8);}return _0x23711c[_0x0df8('0x1f')]();};}function saveUpdates(_0x1826b1,_0x5a1bd7){return function(_0x3a26df){if(_0x3a26df){return _0x3a26df[_0x0df8('0x20')](_0x1826b1)[_0x0df8('0x21')](function(_0x3d3aa0){return _0x3d3aa0;});}return null;};}function removeEntity(_0x364d6e,_0x51b226){return function(_0x56a25d){if(_0x56a25d){return _0x56a25d[_0x0df8('0x22')]()[_0x0df8('0x21')](function(){_0x364d6e[_0x0df8('0x18')](0xcc)[_0x0df8('0x19')]();});}};}function handleEntityNotFound(_0x4d93a3,_0x1c5864){return function(_0x248145){if(!_0x248145){_0x4d93a3[_0x0df8('0x17')](0x194);}return _0x248145;};}function handleError(_0xef5340,_0x9c2aaa){_0x9c2aaa=_0x9c2aaa||0x1f4;return function(_0x565d4c){logger[_0x0df8('0x23')](_0x565d4c['stack']);if(_0x565d4c[_0x0df8('0x24')]){delete _0x565d4c['name'];}_0xef5340[_0x0df8('0x18')](_0x9c2aaa)[_0x0df8('0x25')](_0x565d4c);};}exports['index']=function(_0x418bd5,_0x124ea5){var _0x1cfd9e={},_0x5a6475={},_0x5af80b={'count':0x0,'rows':[]};var _0x52c9b3=_[_0x0df8('0x26')](db[_0x0df8('0x27')][_0x0df8('0x28')],function(_0x176ce7){return{'name':_0x176ce7[_0x0df8('0x29')],'type':_0x176ce7[_0x0df8('0x2a')][_0x0df8('0x2b')]};});_0x5a6475[_0x0df8('0x2c')]=_[_0x0df8('0x26')](_0x52c9b3,_0x0df8('0x24'));_0x5a6475['query']=_[_0x0df8('0x2d')](_0x418bd5[_0x0df8('0x2e')]);_0x5a6475[_0x0df8('0x2f')]=_['intersection'](_0x5a6475['model'],_0x5a6475[_0x0df8('0x2e')]);_0x1cfd9e[_0x0df8('0x30')]=_[_0x0df8('0x31')](_0x5a6475[_0x0df8('0x2c')],qs[_0x0df8('0x32')](_0x418bd5['query'][_0x0df8('0x32')]));_0x1cfd9e[_0x0df8('0x30')]=_0x1cfd9e['attributes'][_0x0df8('0x33')]?_0x1cfd9e[_0x0df8('0x30')]:_0x5a6475['model'];if(!_0x418bd5[_0x0df8('0x2e')][_0x0df8('0x34')]('nolimit')){_0x1cfd9e['limit']=qs[_0x0df8('0x1b')](_0x418bd5[_0x0df8('0x2e')][_0x0df8('0x1b')]);_0x1cfd9e[_0x0df8('0x1a')]=qs[_0x0df8('0x1a')](_0x418bd5[_0x0df8('0x2e')][_0x0df8('0x1a')]);}_0x1cfd9e['order']=qs['sort'](_0x418bd5['query'][_0x0df8('0x35')]);_0x1cfd9e[_0x0df8('0x36')]=qs[_0x0df8('0x2f')](_[_0x0df8('0x37')](_0x418bd5['query'],_0x5a6475[_0x0df8('0x2f')]),_0x52c9b3);if(_0x418bd5['query'][_0x0df8('0x38')]){_0x1cfd9e['where']=_['merge'](_0x1cfd9e[_0x0df8('0x36')],{'$or':_[_0x0df8('0x26')](_0x52c9b3,function(_0x3a8acf){if(_0x3a8acf[_0x0df8('0x2a')]!==_0x0df8('0x39')){var _0x1babb0={};_0x1babb0[_0x3a8acf[_0x0df8('0x24')]]={'$like':'%'+_0x418bd5[_0x0df8('0x2e')][_0x0df8('0x38')]+'%'};return _0x1babb0;}})});}_0x1cfd9e=_['merge']({},_0x1cfd9e,_0x418bd5['options']);var _0x1b2cfb={'where':_0x1cfd9e[_0x0df8('0x36')]};return db[_0x0df8('0x27')][_0x0df8('0x1d')](_0x1b2cfb)[_0x0df8('0x21')](function(_0x17130b){_0x5af80b[_0x0df8('0x1d')]=_0x17130b;if(_0x418bd5[_0x0df8('0x2e')][_0x0df8('0x3a')]){_0x1cfd9e['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x0df8('0x3b')](_0x1cfd9e);})[_0x0df8('0x21')](function(_0x4a9b52){_0x5af80b[_0x0df8('0x3c')]=_0x4a9b52;return _0x5af80b;})['then'](respondWithFilteredResult(_0x124ea5,_0x1cfd9e))[_0x0df8('0x3d')](handleError(_0x124ea5,null));};exports[_0x0df8('0x3e')]=function(_0x437318,_0x2a198d){var _0x5d22fd={'raw':![],'where':{'id':_0x437318[_0x0df8('0x3f')]['id']}},_0x5b0a8f={};_0x5b0a8f[_0x0df8('0x2c')]=_[_0x0df8('0x2d')](db[_0x0df8('0x27')][_0x0df8('0x28')]);_0x5b0a8f[_0x0df8('0x2e')]=_[_0x0df8('0x2d')](_0x437318[_0x0df8('0x2e')]);_0x5b0a8f[_0x0df8('0x2f')]=_[_0x0df8('0x31')](_0x5b0a8f[_0x0df8('0x2c')],_0x5b0a8f[_0x0df8('0x2e')]);_0x5d22fd['attributes']=_[_0x0df8('0x31')](_0x5b0a8f[_0x0df8('0x2c')],qs[_0x0df8('0x32')](_0x437318[_0x0df8('0x2e')]['fields']));_0x5d22fd[_0x0df8('0x30')]=_0x5d22fd[_0x0df8('0x30')][_0x0df8('0x33')]?_0x5d22fd['attributes']:_0x5b0a8f[_0x0df8('0x2c')];if(_0x437318[_0x0df8('0x2e')]['includeAll']){_0x5d22fd[_0x0df8('0x40')]=[{'all':!![]}];}_0x5d22fd=_[_0x0df8('0x41')]({},_0x5d22fd,_0x437318[_0x0df8('0x42')]);return db[_0x0df8('0x27')][_0x0df8('0x43')](_0x5d22fd)['then'](handleEntityNotFound(_0x2a198d,null))[_0x0df8('0x21')](respondWithResult(_0x2a198d,null))[_0x0df8('0x3d')](handleError(_0x2a198d,null));};exports['create']=function(_0xc0ae4,_0xf08199){return db['FreshdeskConfiguration']['create'](_0xc0ae4[_0x0df8('0x44')],{})['then'](respondWithResult(_0xf08199,0xc9))[_0x0df8('0x3d')](handleError(_0xf08199,null));};exports[_0x0df8('0x20')]=function(_0x3ea7d7,_0x3b73aa){if(_0x3ea7d7[_0x0df8('0x44')]['id']){delete _0x3ea7d7[_0x0df8('0x44')]['id'];}return db[_0x0df8('0x27')][_0x0df8('0x43')]({'where':{'id':_0x3ea7d7[_0x0df8('0x3f')]['id']}})[_0x0df8('0x21')](handleEntityNotFound(_0x3b73aa,null))[_0x0df8('0x21')](saveUpdates(_0x3ea7d7[_0x0df8('0x44')],null))[_0x0df8('0x21')](respondWithResult(_0x3b73aa,null))[_0x0df8('0x3d')](handleError(_0x3b73aa,null));};exports['destroy']=function(_0x13cef3,_0x28a962){return db[_0x0df8('0x27')]['find']({'where':{'id':_0x13cef3[_0x0df8('0x3f')]['id']}})[_0x0df8('0x21')](handleEntityNotFound(_0x28a962,null))[_0x0df8('0x21')](removeEntity(_0x28a962,null))['catch'](handleError(_0x28a962,null));};exports['getFields']=function(_0x452b35,_0x171923,_0x1ba245){var _0xabefd4={};var _0x595db4={};var _0x3e7292;var _0xed4a6c;return db[_0x0df8('0x27')]['findOne']({'where':{'id':_0x452b35[_0x0df8('0x3f')]['id']}})[_0x0df8('0x21')](handleEntityNotFound(_0x171923,null))[_0x0df8('0x21')](function(_0x5edee9){if(_0x5edee9){_0x3e7292=_0x5edee9;_0x595db4[_0x0df8('0x2c')]=_[_0x0df8('0x2d')](db['FreshdeskField'][_0x0df8('0x28')]);_0x595db4['query']=_[_0x0df8('0x2d')](_0x452b35['query']);_0x595db4[_0x0df8('0x2f')]=_[_0x0df8('0x31')](_0x595db4['model'],_0x595db4[_0x0df8('0x2e')]);_0xabefd4[_0x0df8('0x30')]=_[_0x0df8('0x31')](_0x595db4['model'],qs['fields'](_0x452b35['query'][_0x0df8('0x32')]));_0xabefd4[_0x0df8('0x30')]=_0xabefd4[_0x0df8('0x30')][_0x0df8('0x33')]?_0xabefd4[_0x0df8('0x30')]:_0x595db4[_0x0df8('0x2c')];_0xabefd4[_0x0df8('0x45')]=qs[_0x0df8('0x35')](_0x452b35['query'][_0x0df8('0x35')]);_0xabefd4[_0x0df8('0x36')]=qs['filters'](_[_0x0df8('0x37')](_0x452b35[_0x0df8('0x2e')],_0x595db4[_0x0df8('0x2f')]));if(_0x452b35[_0x0df8('0x2e')][_0x0df8('0x38')]){_0xabefd4['where']=_[_0x0df8('0x41')](_0xabefd4[_0x0df8('0x36')],{'$or':_[_0x0df8('0x26')](_0xabefd4[_0x0df8('0x30')],function(_0x47b5d4){var _0x23e2fd={};_0x23e2fd[_0x47b5d4]={'$like':'%'+_0x452b35[_0x0df8('0x2e')][_0x0df8('0x38')]+'%'};return _0x23e2fd;})});}_0xabefd4=_['merge']({},_0xabefd4,_0x452b35['options']);return _0x3e7292[_0x0df8('0x46')](_0xabefd4);}})[_0x0df8('0x21')](function(_0x514175){if(_0x514175){_0xed4a6c=_0x514175['length'];if(!_0x452b35['query'][_0x0df8('0x34')]('nolimit')){_0xabefd4[_0x0df8('0x1b')]=qs['limit'](_0x452b35[_0x0df8('0x2e')][_0x0df8('0x1b')]);_0xabefd4['offset']=qs[_0x0df8('0x1a')](_0x452b35[_0x0df8('0x2e')][_0x0df8('0x1a')]);}return _0x3e7292[_0x0df8('0x46')](_0xabefd4);}})[_0x0df8('0x21')](function(_0x28d061){if(_0x28d061){return _0x28d061?{'count':_0xed4a6c,'rows':_0x28d061}:null;}})[_0x0df8('0x21')](respondWithResult(_0x171923,null))[_0x0df8('0x3d')](handleError(_0x171923,null));};exports[_0x0df8('0x47')]=function(_0x4eb59d,_0x11437e,_0x3b1c1e){var _0x3db765={};var _0x5c842d={};var _0x364dba;var _0x2290c9;return db[_0x0df8('0x27')][_0x0df8('0x48')]({'where':{'id':_0x4eb59d[_0x0df8('0x3f')]['id']}})[_0x0df8('0x21')](handleEntityNotFound(_0x11437e,null))[_0x0df8('0x21')](function(_0x58f0ff){if(_0x58f0ff){_0x364dba=_0x58f0ff;_0x5c842d[_0x0df8('0x2c')]=_[_0x0df8('0x2d')](db[_0x0df8('0x49')][_0x0df8('0x28')]);_0x5c842d[_0x0df8('0x2e')]=_[_0x0df8('0x2d')](_0x4eb59d[_0x0df8('0x2e')]);_0x5c842d[_0x0df8('0x2f')]=_[_0x0df8('0x31')](_0x5c842d['model'],_0x5c842d['query']);_0x3db765[_0x0df8('0x30')]=_[_0x0df8('0x31')](_0x5c842d[_0x0df8('0x2c')],qs[_0x0df8('0x32')](_0x4eb59d['query']['fields']));_0x3db765['attributes']=_0x3db765[_0x0df8('0x30')][_0x0df8('0x33')]?_0x3db765[_0x0df8('0x30')]:_0x5c842d[_0x0df8('0x2c')];_0x3db765['order']=qs[_0x0df8('0x35')](_0x4eb59d[_0x0df8('0x2e')][_0x0df8('0x35')]);_0x3db765[_0x0df8('0x36')]=qs['filters'](_[_0x0df8('0x37')](_0x4eb59d[_0x0df8('0x2e')],_0x5c842d[_0x0df8('0x2f')]));if(_0x4eb59d[_0x0df8('0x2e')][_0x0df8('0x38')]){_0x3db765[_0x0df8('0x36')]=_[_0x0df8('0x41')](_0x3db765[_0x0df8('0x36')],{'$or':_[_0x0df8('0x26')](_0x3db765[_0x0df8('0x30')],function(_0x1646fb){var _0x142890={};_0x142890[_0x1646fb]={'$like':'%'+_0x4eb59d[_0x0df8('0x2e')][_0x0df8('0x38')]+'%'};return _0x142890;})});}_0x3db765=_[_0x0df8('0x41')]({},_0x3db765,_0x4eb59d[_0x0df8('0x42')]);return _0x364dba[_0x0df8('0x47')](_0x3db765);}})[_0x0df8('0x21')](function(_0x10a5f6){if(_0x10a5f6){_0x2290c9=_0x10a5f6['length'];if(!_0x4eb59d[_0x0df8('0x2e')]['hasOwnProperty'](_0x0df8('0x4a'))){_0x3db765[_0x0df8('0x1b')]=qs[_0x0df8('0x1b')](_0x4eb59d[_0x0df8('0x2e')][_0x0df8('0x1b')]);_0x3db765[_0x0df8('0x1a')]=qs['offset'](_0x4eb59d['query'][_0x0df8('0x1a')]);}return _0x364dba[_0x0df8('0x47')](_0x3db765);}})['then'](function(_0x154a18){if(_0x154a18){return _0x154a18?{'count':_0x2290c9,'rows':_0x154a18}:null;}})[_0x0df8('0x21')](respondWithResult(_0x11437e,null))[_0x0df8('0x3d')](handleError(_0x11437e,null));};exports['getDescriptions']=function(_0x25a261,_0x15d1d7,_0x371740){var _0x424b55={};var _0x3216c9={};var _0x10def6;var _0x17f473;return db[_0x0df8('0x27')]['findOne']({'where':{'id':_0x25a261[_0x0df8('0x3f')]['id']}})[_0x0df8('0x21')](handleEntityNotFound(_0x15d1d7,null))['then'](function(_0x70065b){if(_0x70065b){_0x10def6=_0x70065b;_0x3216c9['model']=_['keys'](db[_0x0df8('0x49')]['rawAttributes']);_0x3216c9['query']=_[_0x0df8('0x2d')](_0x25a261[_0x0df8('0x2e')]);_0x3216c9[_0x0df8('0x2f')]=_['intersection'](_0x3216c9[_0x0df8('0x2c')],_0x3216c9[_0x0df8('0x2e')]);_0x424b55[_0x0df8('0x30')]=_['intersection'](_0x3216c9['model'],qs[_0x0df8('0x32')](_0x25a261[_0x0df8('0x2e')][_0x0df8('0x32')]));_0x424b55[_0x0df8('0x30')]=_0x424b55['attributes'][_0x0df8('0x33')]?_0x424b55[_0x0df8('0x30')]:_0x3216c9['model'];_0x424b55[_0x0df8('0x45')]=qs[_0x0df8('0x35')](_0x25a261[_0x0df8('0x2e')][_0x0df8('0x35')]);_0x424b55[_0x0df8('0x36')]=qs[_0x0df8('0x2f')](_[_0x0df8('0x37')](_0x25a261[_0x0df8('0x2e')],_0x3216c9[_0x0df8('0x2f')]));if(_0x25a261['query'][_0x0df8('0x38')]){_0x424b55[_0x0df8('0x36')]=_[_0x0df8('0x41')](_0x424b55[_0x0df8('0x36')],{'$or':_[_0x0df8('0x26')](_0x424b55['attributes'],function(_0x3e5c13){var _0x104233={};_0x104233[_0x3e5c13]={'$like':'%'+_0x25a261[_0x0df8('0x2e')][_0x0df8('0x38')]+'%'};return _0x104233;})});}_0x424b55=_[_0x0df8('0x41')]({},_0x424b55,_0x25a261['options']);return _0x10def6[_0x0df8('0x4b')](_0x424b55);}})[_0x0df8('0x21')](function(_0x121759){if(_0x121759){_0x17f473=_0x121759[_0x0df8('0x33')];if(!_0x25a261['query'][_0x0df8('0x34')]('nolimit')){_0x424b55[_0x0df8('0x1b')]=qs[_0x0df8('0x1b')](_0x25a261[_0x0df8('0x2e')][_0x0df8('0x1b')]);_0x424b55[_0x0df8('0x1a')]=qs[_0x0df8('0x1a')](_0x25a261['query'][_0x0df8('0x1a')]);}return _0x10def6[_0x0df8('0x4b')](_0x424b55);}})['then'](function(_0x3f1a52){if(_0x3f1a52){return _0x3f1a52?{'count':_0x17f473,'rows':_0x3f1a52}:null;}})[_0x0df8('0x21')](respondWithResult(_0x15d1d7,null))[_0x0df8('0x3d')](handleError(_0x15d1d7,null));};exports[_0x0df8('0x4c')]=function(_0x19aec4,_0x2d5aad,_0x3d95b5){var _0x4e340a={};var _0x19bc7d={};var _0x36fe59;var _0x19898d;return db[_0x0df8('0x27')][_0x0df8('0x48')]({'where':{'id':_0x19aec4[_0x0df8('0x3f')]['id']}})[_0x0df8('0x21')](handleEntityNotFound(_0x2d5aad,null))[_0x0df8('0x21')](function(_0x2bcd98){if(_0x2bcd98){_0x36fe59=_0x2bcd98;_0x19bc7d[_0x0df8('0x2c')]=_[_0x0df8('0x2d')](db['Tag']['rawAttributes']);_0x19bc7d[_0x0df8('0x2e')]=_[_0x0df8('0x2d')](_0x19aec4[_0x0df8('0x2e')]);_0x19bc7d['filters']=_[_0x0df8('0x31')](_0x19bc7d[_0x0df8('0x2c')],_0x19bc7d[_0x0df8('0x2e')]);_0x4e340a[_0x0df8('0x30')]=_[_0x0df8('0x31')](_0x19bc7d[_0x0df8('0x2c')],qs[_0x0df8('0x32')](_0x19aec4[_0x0df8('0x2e')][_0x0df8('0x32')]));_0x4e340a[_0x0df8('0x30')]=_0x4e340a['attributes'][_0x0df8('0x33')]?_0x4e340a[_0x0df8('0x30')]:_0x19bc7d[_0x0df8('0x2c')];_0x4e340a[_0x0df8('0x45')]=qs[_0x0df8('0x35')](_0x19aec4[_0x0df8('0x2e')][_0x0df8('0x35')]);_0x4e340a['where']=qs[_0x0df8('0x2f')](_[_0x0df8('0x37')](_0x19aec4[_0x0df8('0x2e')],_0x19bc7d[_0x0df8('0x2f')]));if(_0x19aec4['query'][_0x0df8('0x38')]){_0x4e340a[_0x0df8('0x36')]=_[_0x0df8('0x41')](_0x4e340a[_0x0df8('0x36')],{'$or':_[_0x0df8('0x26')](_0x4e340a[_0x0df8('0x30')],function(_0x510eea){var _0x3d7591={};_0x3d7591[_0x510eea]={'$like':'%'+_0x19aec4[_0x0df8('0x2e')]['filter']+'%'};return _0x3d7591;})});}_0x4e340a=_['merge']({},_0x4e340a,_0x19aec4['options']);return _0x36fe59[_0x0df8('0x4c')](_0x4e340a);}})[_0x0df8('0x21')](function(_0x21b9c3){if(_0x21b9c3){_0x19898d=_0x21b9c3['length'];if(!_0x19aec4[_0x0df8('0x2e')][_0x0df8('0x34')](_0x0df8('0x4a'))){_0x4e340a[_0x0df8('0x1b')]=qs['limit'](_0x19aec4[_0x0df8('0x2e')][_0x0df8('0x1b')]);_0x4e340a['offset']=qs[_0x0df8('0x1a')](_0x19aec4[_0x0df8('0x2e')]['offset']);}return _0x36fe59[_0x0df8('0x4c')](_0x4e340a);}})[_0x0df8('0x21')](function(_0x2854c5){if(_0x2854c5){return _0x2854c5?{'count':_0x19898d,'rows':_0x2854c5}:null;}})[_0x0df8('0x21')](respondWithResult(_0x2d5aad,null))['catch'](handleError(_0x2d5aad,null));};exports[_0x0df8('0x4d')]=function(_0x4a7959,_0x286cda,_0x489695){if(_0x4a7959[_0x0df8('0x44')]['id']){delete _0x4a7959[_0x0df8('0x44')]['id'];}return db[_0x0df8('0x27')]['findOne']({'where':{'id':_0x4a7959[_0x0df8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x286cda,null))[_0x0df8('0x21')](function(_0x2cf9a0){if(_0x2cf9a0){return _0x2cf9a0['setTags'](_0x4a7959[_0x0df8('0x44')][_0x0df8('0x4e')]||[]);}return null;})[_0x0df8('0x21')](respondWithResult(_0x286cda,null))[_0x0df8('0x3d')](handleError(_0x286cda,null));}; \ No newline at end of file +var _0x0b91=['json','apply','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','findAll','rows','catch','params','include','options','find','create','body','update','getFields','findOne','FreshdeskField','length','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','Content-Range'];(function(_0x1a61ab,_0x5b850e){var _0x4f4550=function(_0x94acd2){while(--_0x94acd2){_0x1a61ab['push'](_0x1a61ab['shift']());}};_0x4f4550(++_0x5b850e);}(_0x0b91,0xd3));var _0x10b9=function(_0x40da10,_0x4cdf28){_0x40da10=_0x40da10-0x0;var _0x296727=_0x0b91[_0x40da10];return _0x296727;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10b9('0x0'));var zipdir=require(_0x10b9('0x1'));var jsonpatch=require(_0x10b9('0x2'));var rp=require('request-promise');var moment=require(_0x10b9('0x3'));var BPromise=require(_0x10b9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x10b9('0x5'));var sox=require(_0x10b9('0x6'));var csv=require('to-csv');var ejs=require(_0x10b9('0x7'));var fs=require('fs');var fs_extra=require(_0x10b9('0x8'));var _=require('lodash');var squel=require(_0x10b9('0x9'));var crypto=require(_0x10b9('0xa'));var jsforce=require(_0x10b9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x10b9('0xc'));var querystring=require(_0x10b9('0xd'));var Papa=require(_0x10b9('0xe'));var Redis=require(_0x10b9('0xf'));var authService=require(_0x10b9('0x10'));var qs=require(_0x10b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10b9('0x12'));var logger=require('../../config/logger')(_0x10b9('0x13'));var utils=require(_0x10b9('0x14'));var config=require(_0x10b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x10b9('0x16'))['db'];function respondWithStatusCode(_0x43792d,_0x4084c7){_0x4084c7=_0x4084c7||0xcc;return function(_0x2dad1e){if(_0x2dad1e){return _0x43792d['sendStatus'](_0x4084c7);}return _0x43792d['status'](_0x4084c7)[_0x10b9('0x17')]();};}function respondWithResult(_0x5668e0,_0x37d5cc){_0x37d5cc=_0x37d5cc||0xc8;return function(_0x1c2c66){if(_0x1c2c66){return _0x5668e0[_0x10b9('0x18')](_0x37d5cc)['json'](_0x1c2c66);}};}function respondWithFilteredResult(_0x1ce81e,_0x45be94){return function(_0x163b94){if(_0x163b94){var _0x688b10=typeof _0x45be94[_0x10b9('0x19')]===_0x10b9('0x1a')&&typeof _0x45be94['limit']===_0x10b9('0x1a');var _0x422ed3=_0x163b94['count'];var _0x56941e=_0x688b10?0x0:_0x45be94[_0x10b9('0x19')];var _0x414939=_0x688b10?_0x163b94['count']:_0x45be94[_0x10b9('0x19')]+_0x45be94[_0x10b9('0x1b')];var _0x448968;if(_0x414939>=_0x422ed3){_0x414939=_0x422ed3;_0x448968=0xc8;}else{_0x448968=0xce;}_0x1ce81e[_0x10b9('0x18')](_0x448968);return _0x1ce81e['set'](_0x10b9('0x1c'),_0x56941e+'-'+_0x414939+'/'+_0x422ed3)[_0x10b9('0x1d')](_0x163b94);}return null;};}function patchUpdates(_0xdb4d15){return function(_0x2aa82){try{jsonpatch[_0x10b9('0x1e')](_0x2aa82,_0xdb4d15,!![]);}catch(_0x3dc355){return BPromise['reject'](_0x3dc355);}return _0x2aa82['save']();};}function saveUpdates(_0x45b05b,_0x25ac76){return function(_0x2eb5ff){if(_0x2eb5ff){return _0x2eb5ff['update'](_0x45b05b)[_0x10b9('0x1f')](function(_0x2bb895){return _0x2bb895;});}return null;};}function removeEntity(_0x4156e1,_0x62f0c3){return function(_0x39b4d3){if(_0x39b4d3){return _0x39b4d3[_0x10b9('0x20')]()['then'](function(){_0x4156e1[_0x10b9('0x18')](0xcc)[_0x10b9('0x17')]();});}};}function handleEntityNotFound(_0x2cd808,_0x5e15e3){return function(_0x1f8210){if(!_0x1f8210){_0x2cd808['sendStatus'](0x194);}return _0x1f8210;};}function handleError(_0x50ce07,_0x4b51f7){_0x4b51f7=_0x4b51f7||0x1f4;return function(_0x586759){logger[_0x10b9('0x21')](_0x586759[_0x10b9('0x22')]);if(_0x586759['name']){delete _0x586759[_0x10b9('0x23')];}_0x50ce07[_0x10b9('0x18')](_0x4b51f7)[_0x10b9('0x24')](_0x586759);};}exports[_0x10b9('0x25')]=function(_0x224535,_0x599028){var _0x2221e3={},_0xb83ccd={},_0x3dcbed={'count':0x0,'rows':[]};var _0xfb7d24=_[_0x10b9('0x26')](db[_0x10b9('0x27')][_0x10b9('0x28')],function(_0x3f9d30){return{'name':_0x3f9d30[_0x10b9('0x29')],'type':_0x3f9d30[_0x10b9('0x2a')]['key']};});_0xb83ccd[_0x10b9('0x2b')]=_[_0x10b9('0x26')](_0xfb7d24,'name');_0xb83ccd[_0x10b9('0x2c')]=_[_0x10b9('0x2d')](_0x224535[_0x10b9('0x2c')]);_0xb83ccd[_0x10b9('0x2e')]=_[_0x10b9('0x2f')](_0xb83ccd[_0x10b9('0x2b')],_0xb83ccd[_0x10b9('0x2c')]);_0x2221e3[_0x10b9('0x30')]=_[_0x10b9('0x2f')](_0xb83ccd[_0x10b9('0x2b')],qs[_0x10b9('0x31')](_0x224535[_0x10b9('0x2c')]['fields']));_0x2221e3[_0x10b9('0x30')]=_0x2221e3[_0x10b9('0x30')]['length']?_0x2221e3[_0x10b9('0x30')]:_0xb83ccd[_0x10b9('0x2b')];if(!_0x224535[_0x10b9('0x2c')][_0x10b9('0x32')](_0x10b9('0x33'))){_0x2221e3[_0x10b9('0x1b')]=qs['limit'](_0x224535[_0x10b9('0x2c')]['limit']);_0x2221e3[_0x10b9('0x19')]=qs[_0x10b9('0x19')](_0x224535[_0x10b9('0x2c')][_0x10b9('0x19')]);}_0x2221e3[_0x10b9('0x34')]=qs[_0x10b9('0x35')](_0x224535[_0x10b9('0x2c')][_0x10b9('0x35')]);_0x2221e3[_0x10b9('0x36')]=qs[_0x10b9('0x2e')](_[_0x10b9('0x37')](_0x224535['query'],_0xb83ccd[_0x10b9('0x2e')]),_0xfb7d24);if(_0x224535[_0x10b9('0x2c')][_0x10b9('0x38')]){_0x2221e3['where']=_[_0x10b9('0x39')](_0x2221e3[_0x10b9('0x36')],{'$or':_['map'](_0xfb7d24,function(_0x420a1e){if(_0x420a1e[_0x10b9('0x2a')]!=='VIRTUAL'){var _0x25780b={};_0x25780b[_0x420a1e[_0x10b9('0x23')]]={'$like':'%'+_0x224535[_0x10b9('0x2c')]['filter']+'%'};return _0x25780b;}})});}_0x2221e3=_[_0x10b9('0x39')]({},_0x2221e3,_0x224535['options']);var _0x44b1ec={'where':_0x2221e3['where']};return db[_0x10b9('0x27')][_0x10b9('0x3a')](_0x44b1ec)[_0x10b9('0x1f')](function(_0x3e0c8){_0x3dcbed['count']=_0x3e0c8;if(_0x224535[_0x10b9('0x2c')][_0x10b9('0x3b')]){_0x2221e3['include']=[{'all':!![]}];}return db[_0x10b9('0x27')][_0x10b9('0x3c')](_0x2221e3);})['then'](function(_0x1682fd){_0x3dcbed[_0x10b9('0x3d')]=_0x1682fd;return _0x3dcbed;})['then'](respondWithFilteredResult(_0x599028,_0x2221e3))[_0x10b9('0x3e')](handleError(_0x599028,null));};exports['show']=function(_0x32afff,_0x3213ef){var _0xb6dda3={'raw':![],'where':{'id':_0x32afff[_0x10b9('0x3f')]['id']}},_0x2bfda4={};_0x2bfda4[_0x10b9('0x2b')]=_[_0x10b9('0x2d')](db[_0x10b9('0x27')]['rawAttributes']);_0x2bfda4[_0x10b9('0x2c')]=_[_0x10b9('0x2d')](_0x32afff[_0x10b9('0x2c')]);_0x2bfda4[_0x10b9('0x2e')]=_[_0x10b9('0x2f')](_0x2bfda4[_0x10b9('0x2b')],_0x2bfda4['query']);_0xb6dda3[_0x10b9('0x30')]=_[_0x10b9('0x2f')](_0x2bfda4[_0x10b9('0x2b')],qs['fields'](_0x32afff[_0x10b9('0x2c')]['fields']));_0xb6dda3[_0x10b9('0x30')]=_0xb6dda3['attributes']['length']?_0xb6dda3[_0x10b9('0x30')]:_0x2bfda4[_0x10b9('0x2b')];if(_0x32afff[_0x10b9('0x2c')][_0x10b9('0x3b')]){_0xb6dda3[_0x10b9('0x40')]=[{'all':!![]}];}_0xb6dda3=_[_0x10b9('0x39')]({},_0xb6dda3,_0x32afff[_0x10b9('0x41')]);return db[_0x10b9('0x27')][_0x10b9('0x42')](_0xb6dda3)[_0x10b9('0x1f')](handleEntityNotFound(_0x3213ef,null))[_0x10b9('0x1f')](respondWithResult(_0x3213ef,null))[_0x10b9('0x3e')](handleError(_0x3213ef,null));};exports[_0x10b9('0x43')]=function(_0x45b94c,_0x5e739f){return db[_0x10b9('0x27')][_0x10b9('0x43')](_0x45b94c[_0x10b9('0x44')],{})[_0x10b9('0x1f')](respondWithResult(_0x5e739f,0xc9))[_0x10b9('0x3e')](handleError(_0x5e739f,null));};exports[_0x10b9('0x45')]=function(_0x533c68,_0x440bd6){if(_0x533c68[_0x10b9('0x44')]['id']){delete _0x533c68[_0x10b9('0x44')]['id'];}return db[_0x10b9('0x27')][_0x10b9('0x42')]({'where':{'id':_0x533c68[_0x10b9('0x3f')]['id']}})[_0x10b9('0x1f')](handleEntityNotFound(_0x440bd6,null))['then'](saveUpdates(_0x533c68['body'],null))[_0x10b9('0x1f')](respondWithResult(_0x440bd6,null))[_0x10b9('0x3e')](handleError(_0x440bd6,null));};exports['destroy']=function(_0x176aea,_0x388d0d){return db[_0x10b9('0x27')][_0x10b9('0x42')]({'where':{'id':_0x176aea[_0x10b9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x388d0d,null))[_0x10b9('0x1f')](removeEntity(_0x388d0d,null))[_0x10b9('0x3e')](handleError(_0x388d0d,null));};exports[_0x10b9('0x46')]=function(_0x243869,_0x4f3468,_0x3e4023){var _0x1bcb01={};var _0xda5855={};var _0x3957bf;var _0x48c701;return db['FreshdeskConfiguration'][_0x10b9('0x47')]({'where':{'id':_0x243869['params']['id']}})['then'](handleEntityNotFound(_0x4f3468,null))['then'](function(_0x13a066){if(_0x13a066){_0x3957bf=_0x13a066;_0xda5855[_0x10b9('0x2b')]=_[_0x10b9('0x2d')](db[_0x10b9('0x48')]['rawAttributes']);_0xda5855[_0x10b9('0x2c')]=_[_0x10b9('0x2d')](_0x243869[_0x10b9('0x2c')]);_0xda5855[_0x10b9('0x2e')]=_['intersection'](_0xda5855[_0x10b9('0x2b')],_0xda5855[_0x10b9('0x2c')]);_0x1bcb01[_0x10b9('0x30')]=_[_0x10b9('0x2f')](_0xda5855[_0x10b9('0x2b')],qs[_0x10b9('0x31')](_0x243869[_0x10b9('0x2c')][_0x10b9('0x31')]));_0x1bcb01[_0x10b9('0x30')]=_0x1bcb01[_0x10b9('0x30')][_0x10b9('0x49')]?_0x1bcb01[_0x10b9('0x30')]:_0xda5855['model'];_0x1bcb01[_0x10b9('0x34')]=qs['sort'](_0x243869['query']['sort']);_0x1bcb01[_0x10b9('0x36')]=qs[_0x10b9('0x2e')](_[_0x10b9('0x37')](_0x243869[_0x10b9('0x2c')],_0xda5855[_0x10b9('0x2e')]));if(_0x243869['query'][_0x10b9('0x38')]){_0x1bcb01[_0x10b9('0x36')]=_[_0x10b9('0x39')](_0x1bcb01[_0x10b9('0x36')],{'$or':_[_0x10b9('0x26')](_0x1bcb01['attributes'],function(_0x9d3059){var _0x59ebdd={};_0x59ebdd[_0x9d3059]={'$like':'%'+_0x243869[_0x10b9('0x2c')][_0x10b9('0x38')]+'%'};return _0x59ebdd;})});}_0x1bcb01=_[_0x10b9('0x39')]({},_0x1bcb01,_0x243869[_0x10b9('0x41')]);return _0x3957bf[_0x10b9('0x46')](_0x1bcb01);}})[_0x10b9('0x1f')](function(_0x120039){if(_0x120039){_0x48c701=_0x120039[_0x10b9('0x49')];if(!_0x243869[_0x10b9('0x2c')][_0x10b9('0x32')](_0x10b9('0x33'))){_0x1bcb01[_0x10b9('0x1b')]=qs[_0x10b9('0x1b')](_0x243869[_0x10b9('0x2c')][_0x10b9('0x1b')]);_0x1bcb01[_0x10b9('0x19')]=qs[_0x10b9('0x19')](_0x243869[_0x10b9('0x2c')][_0x10b9('0x19')]);}return _0x3957bf[_0x10b9('0x46')](_0x1bcb01);}})[_0x10b9('0x1f')](function(_0xf3c5ed){if(_0xf3c5ed){return _0xf3c5ed?{'count':_0x48c701,'rows':_0xf3c5ed}:null;}})[_0x10b9('0x1f')](respondWithResult(_0x4f3468,null))['catch'](handleError(_0x4f3468,null));};exports[_0x10b9('0x4a')]=function(_0xffc020,_0x5e41eb,_0x1e27ac){var _0x1476c2={};var _0x4c7eae={};var _0x23dfb0;var _0x26dc01;return db[_0x10b9('0x27')]['findOne']({'where':{'id':_0xffc020[_0x10b9('0x3f')]['id']}})[_0x10b9('0x1f')](handleEntityNotFound(_0x5e41eb,null))[_0x10b9('0x1f')](function(_0x1a5935){if(_0x1a5935){_0x23dfb0=_0x1a5935;_0x4c7eae['model']=_[_0x10b9('0x2d')](db[_0x10b9('0x48')]['rawAttributes']);_0x4c7eae['query']=_[_0x10b9('0x2d')](_0xffc020[_0x10b9('0x2c')]);_0x4c7eae[_0x10b9('0x2e')]=_['intersection'](_0x4c7eae[_0x10b9('0x2b')],_0x4c7eae[_0x10b9('0x2c')]);_0x1476c2[_0x10b9('0x30')]=_[_0x10b9('0x2f')](_0x4c7eae[_0x10b9('0x2b')],qs[_0x10b9('0x31')](_0xffc020[_0x10b9('0x2c')][_0x10b9('0x31')]));_0x1476c2[_0x10b9('0x30')]=_0x1476c2[_0x10b9('0x30')]['length']?_0x1476c2[_0x10b9('0x30')]:_0x4c7eae[_0x10b9('0x2b')];_0x1476c2[_0x10b9('0x34')]=qs[_0x10b9('0x35')](_0xffc020[_0x10b9('0x2c')]['sort']);_0x1476c2[_0x10b9('0x36')]=qs[_0x10b9('0x2e')](_[_0x10b9('0x37')](_0xffc020[_0x10b9('0x2c')],_0x4c7eae[_0x10b9('0x2e')]));if(_0xffc020[_0x10b9('0x2c')]['filter']){_0x1476c2[_0x10b9('0x36')]=_[_0x10b9('0x39')](_0x1476c2[_0x10b9('0x36')],{'$or':_['map'](_0x1476c2[_0x10b9('0x30')],function(_0x183a32){var _0x298498={};_0x298498[_0x183a32]={'$like':'%'+_0xffc020[_0x10b9('0x2c')]['filter']+'%'};return _0x298498;})});}_0x1476c2=_[_0x10b9('0x39')]({},_0x1476c2,_0xffc020[_0x10b9('0x41')]);return _0x23dfb0['getSubjects'](_0x1476c2);}})['then'](function(_0x598346){if(_0x598346){_0x26dc01=_0x598346[_0x10b9('0x49')];if(!_0xffc020[_0x10b9('0x2c')][_0x10b9('0x32')]('nolimit')){_0x1476c2[_0x10b9('0x1b')]=qs[_0x10b9('0x1b')](_0xffc020[_0x10b9('0x2c')][_0x10b9('0x1b')]);_0x1476c2[_0x10b9('0x19')]=qs['offset'](_0xffc020['query'][_0x10b9('0x19')]);}return _0x23dfb0[_0x10b9('0x4a')](_0x1476c2);}})['then'](function(_0x4964b0){if(_0x4964b0){return _0x4964b0?{'count':_0x26dc01,'rows':_0x4964b0}:null;}})[_0x10b9('0x1f')](respondWithResult(_0x5e41eb,null))[_0x10b9('0x3e')](handleError(_0x5e41eb,null));};exports[_0x10b9('0x4b')]=function(_0x49e14e,_0x3892b1,_0x527208){var _0x52d452={};var _0x34a830={};var _0x5bb28e;var _0x428ecb;return db[_0x10b9('0x27')][_0x10b9('0x47')]({'where':{'id':_0x49e14e[_0x10b9('0x3f')]['id']}})[_0x10b9('0x1f')](handleEntityNotFound(_0x3892b1,null))['then'](function(_0xd6574a){if(_0xd6574a){_0x5bb28e=_0xd6574a;_0x34a830[_0x10b9('0x2b')]=_['keys'](db[_0x10b9('0x48')]['rawAttributes']);_0x34a830['query']=_[_0x10b9('0x2d')](_0x49e14e[_0x10b9('0x2c')]);_0x34a830['filters']=_[_0x10b9('0x2f')](_0x34a830[_0x10b9('0x2b')],_0x34a830['query']);_0x52d452[_0x10b9('0x30')]=_[_0x10b9('0x2f')](_0x34a830[_0x10b9('0x2b')],qs[_0x10b9('0x31')](_0x49e14e[_0x10b9('0x2c')][_0x10b9('0x31')]));_0x52d452['attributes']=_0x52d452[_0x10b9('0x30')][_0x10b9('0x49')]?_0x52d452[_0x10b9('0x30')]:_0x34a830[_0x10b9('0x2b')];_0x52d452[_0x10b9('0x34')]=qs['sort'](_0x49e14e[_0x10b9('0x2c')][_0x10b9('0x35')]);_0x52d452['where']=qs[_0x10b9('0x2e')](_['pick'](_0x49e14e[_0x10b9('0x2c')],_0x34a830['filters']));if(_0x49e14e['query']['filter']){_0x52d452['where']=_[_0x10b9('0x39')](_0x52d452[_0x10b9('0x36')],{'$or':_[_0x10b9('0x26')](_0x52d452['attributes'],function(_0x32c7d4){var _0x10d608={};_0x10d608[_0x32c7d4]={'$like':'%'+_0x49e14e[_0x10b9('0x2c')][_0x10b9('0x38')]+'%'};return _0x10d608;})});}_0x52d452=_[_0x10b9('0x39')]({},_0x52d452,_0x49e14e[_0x10b9('0x41')]);return _0x5bb28e[_0x10b9('0x4b')](_0x52d452);}})[_0x10b9('0x1f')](function(_0x4d42b0){if(_0x4d42b0){_0x428ecb=_0x4d42b0['length'];if(!_0x49e14e['query']['hasOwnProperty'](_0x10b9('0x33'))){_0x52d452[_0x10b9('0x1b')]=qs[_0x10b9('0x1b')](_0x49e14e['query'][_0x10b9('0x1b')]);_0x52d452[_0x10b9('0x19')]=qs[_0x10b9('0x19')](_0x49e14e['query'][_0x10b9('0x19')]);}return _0x5bb28e['getDescriptions'](_0x52d452);}})[_0x10b9('0x1f')](function(_0x424d84){if(_0x424d84){return _0x424d84?{'count':_0x428ecb,'rows':_0x424d84}:null;}})['then'](respondWithResult(_0x3892b1,null))['catch'](handleError(_0x3892b1,null));};exports[_0x10b9('0x4c')]=function(_0x16c05c,_0x141c1a,_0x1c3b5a){var _0x220a5b={};var _0x26fb24={};var _0x4115d3;var _0x15b2ae;return db[_0x10b9('0x27')][_0x10b9('0x47')]({'where':{'id':_0x16c05c[_0x10b9('0x3f')]['id']}})[_0x10b9('0x1f')](handleEntityNotFound(_0x141c1a,null))[_0x10b9('0x1f')](function(_0x14dac5){if(_0x14dac5){_0x4115d3=_0x14dac5;_0x26fb24[_0x10b9('0x2b')]=_[_0x10b9('0x2d')](db[_0x10b9('0x4d')]['rawAttributes']);_0x26fb24['query']=_[_0x10b9('0x2d')](_0x16c05c['query']);_0x26fb24[_0x10b9('0x2e')]=_['intersection'](_0x26fb24[_0x10b9('0x2b')],_0x26fb24[_0x10b9('0x2c')]);_0x220a5b['attributes']=_[_0x10b9('0x2f')](_0x26fb24[_0x10b9('0x2b')],qs[_0x10b9('0x31')](_0x16c05c[_0x10b9('0x2c')][_0x10b9('0x31')]));_0x220a5b[_0x10b9('0x30')]=_0x220a5b['attributes'][_0x10b9('0x49')]?_0x220a5b[_0x10b9('0x30')]:_0x26fb24[_0x10b9('0x2b')];_0x220a5b[_0x10b9('0x34')]=qs['sort'](_0x16c05c[_0x10b9('0x2c')]['sort']);_0x220a5b[_0x10b9('0x36')]=qs['filters'](_[_0x10b9('0x37')](_0x16c05c[_0x10b9('0x2c')],_0x26fb24[_0x10b9('0x2e')]));if(_0x16c05c[_0x10b9('0x2c')][_0x10b9('0x38')]){_0x220a5b[_0x10b9('0x36')]=_['merge'](_0x220a5b[_0x10b9('0x36')],{'$or':_[_0x10b9('0x26')](_0x220a5b[_0x10b9('0x30')],function(_0x5d51ab){var _0x55a614={};_0x55a614[_0x5d51ab]={'$like':'%'+_0x16c05c[_0x10b9('0x2c')][_0x10b9('0x38')]+'%'};return _0x55a614;})});}_0x220a5b=_['merge']({},_0x220a5b,_0x16c05c[_0x10b9('0x41')]);return _0x4115d3['getTags'](_0x220a5b);}})[_0x10b9('0x1f')](function(_0xcf0711){if(_0xcf0711){_0x15b2ae=_0xcf0711['length'];if(!_0x16c05c[_0x10b9('0x2c')][_0x10b9('0x32')](_0x10b9('0x33'))){_0x220a5b['limit']=qs[_0x10b9('0x1b')](_0x16c05c[_0x10b9('0x2c')][_0x10b9('0x1b')]);_0x220a5b[_0x10b9('0x19')]=qs[_0x10b9('0x19')](_0x16c05c[_0x10b9('0x2c')][_0x10b9('0x19')]);}return _0x4115d3[_0x10b9('0x4c')](_0x220a5b);}})['then'](function(_0x47c6eb){if(_0x47c6eb){return _0x47c6eb?{'count':_0x15b2ae,'rows':_0x47c6eb}:null;}})['then'](respondWithResult(_0x141c1a,null))[_0x10b9('0x3e')](handleError(_0x141c1a,null));};exports['setTags']=function(_0x165c12,_0x51739f,_0x30416d){if(_0x165c12[_0x10b9('0x44')]['id']){delete _0x165c12[_0x10b9('0x44')]['id'];}return db[_0x10b9('0x27')][_0x10b9('0x47')]({'where':{'id':_0x165c12[_0x10b9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x51739f,null))[_0x10b9('0x1f')](function(_0x4d41d0){if(_0x4d41d0){return _0x4d41d0[_0x10b9('0x4e')](_0x165c12['body'][_0x10b9('0x4f')]||[]);}return null;})[_0x10b9('0x1f')](respondWithResult(_0x51739f,null))['catch'](handleError(_0x51739f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bcddab2..d04780f 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 _0x35e7=['rimraf','exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x35e7,0x9e));var _0x735e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x35e7[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x735e('0x0'));var util=require('util');var logger=require(_0x735e('0x1'))(_0x735e('0x2'));var moment=require(_0x735e('0x3'));var BPromise=require(_0x735e('0x4'));var rp=require(_0x735e('0x5'));var fs=require('fs');var path=require(_0x735e('0x6'));var rimraf=require(_0x735e('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x735e('0x8')]=function(_0x40ac3a,_0xbfc37f){return _0x40ac3a[_0x735e('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x735e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd08f=['int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration'];(function(_0x1d5430,_0x3d0c7b){var _0x5ed7d6=function(_0x34d03b){while(--_0x34d03b){_0x1d5430['push'](_0x1d5430['shift']());}};_0x5ed7d6(++_0x3d0c7b);}(_0xd08f,0x7a));var _0xfd08=function(_0x44ba19,_0x4f829d){_0x44ba19=_0x44ba19-0x0;var _0x56f6ee=_0xd08f[_0x44ba19];return _0x56f6ee;};'use strict';var _=require(_0xfd08('0x0'));var util=require(_0xfd08('0x1'));var logger=require('../../config/logger')(_0xfd08('0x2'));var moment=require(_0xfd08('0x3'));var BPromise=require(_0xfd08('0x4'));var rp=require(_0xfd08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd08('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd08('0x7'));module[_0xfd08('0x8')]=function(_0x37bd4d,_0x1a3d19){return _0x37bd4d['define'](_0xfd08('0x9'),attributes,{'tableName':_0xfd08('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 4c8af8a..b791990 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 _0x3dcd=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x18601e,_0x3b2526){var _0x31748d=function(_0x351dfd){while(--_0x351dfd){_0x18601e['push'](_0x18601e['shift']());}};_0x31748d(++_0x3b2526);}(_0x3dcd,0xdf));var _0xd3dc=function(_0x2bc4df,_0x397a6f){_0x2bc4df=_0x2bc4df-0x0;var _0x4bcc54=_0x3dcd[_0x2bc4df];return _0x4bcc54;};'use strict';var _=require(_0xd3dc('0x0'));var util=require(_0xd3dc('0x1'));var moment=require(_0xd3dc('0x2'));var BPromise=require(_0xd3dc('0x3'));var rs=require(_0xd3dc('0x4'));var fs=require('fs');var Redis=require(_0xd3dc('0x5'));var db=require(_0xd3dc('0x6'))['db'];var utils=require(_0xd3dc('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3dc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27bdb1,_0xd8fd8a,_0x43502f){return new BPromise(function(_0x310ed,_0x4835c4){return client[_0xd3dc('0x9')](_0x27bdb1,_0x43502f)[_0xd3dc('0xa')](function(_0x1f5e82){logger['info'](_0xd3dc('0xb'),_0xd8fd8a,_0xd3dc('0xc'));logger[_0xd3dc('0xd')](_0xd3dc('0xe'),_0xd8fd8a,_0xd3dc('0xc'),JSON[_0xd3dc('0xf')](_0x1f5e82));if(_0x1f5e82[_0xd3dc('0x10')]){if(_0x1f5e82['error'][_0xd3dc('0x11')]===0x1f4){logger['error'](_0xd3dc('0xb'),_0xd8fd8a,_0x1f5e82[_0xd3dc('0x10')][_0xd3dc('0x12')]);return _0x4835c4(_0x1f5e82[_0xd3dc('0x10')][_0xd3dc('0x12')]);}logger[_0xd3dc('0x10')](_0xd3dc('0xb'),_0xd8fd8a,_0x1f5e82['error'][_0xd3dc('0x12')]);return _0x310ed(_0x1f5e82[_0xd3dc('0x10')]['message']);}else{logger['info'](_0xd3dc('0xb'),_0xd8fd8a,'request\x20sent');_0x310ed(_0x1f5e82[_0xd3dc('0x13')][_0xd3dc('0x12')]);}})['catch'](function(_0x2bd2a7){logger[_0xd3dc('0x10')](_0xd3dc('0xb'),_0xd8fd8a,_0x2bd2a7);_0x4835c4(_0x2bd2a7);});});} \ No newline at end of file +var _0x4f22=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x115deb,_0x5ad494){var _0x554e8c=function(_0x53086d){while(--_0x53086d){_0x115deb['push'](_0x115deb['shift']());}};_0x554e8c(++_0x5ad494);}(_0x4f22,0xc5));var _0x24f2=function(_0x2ce46c,_0x56224c){_0x2ce46c=_0x2ce46c-0x0;var _0x191791=_0x4f22[_0x2ce46c];return _0x191791;};'use strict';var _=require(_0x24f2('0x0'));var util=require(_0x24f2('0x1'));var moment=require(_0x24f2('0x2'));var BPromise=require(_0x24f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24f2('0x4'));var db=require(_0x24f2('0x5'))['db'];var utils=require(_0x24f2('0x6'));var logger=require(_0x24f2('0x7'))(_0x24f2('0x8'));var config=require(_0x24f2('0x9'));var jayson=require(_0x24f2('0xa'));var client=jayson['client'][_0x24f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x231d65,_0x5bb7c8,_0x4d5102){return new BPromise(function(_0x2a751b,_0x2a27ec){return client['request'](_0x231d65,_0x4d5102)[_0x24f2('0xc')](function(_0x3418d8){logger[_0x24f2('0xd')](_0x24f2('0xe'),_0x5bb7c8,'request\x20sent');logger[_0x24f2('0xf')](_0x24f2('0x10'),_0x5bb7c8,_0x24f2('0x11'),JSON[_0x24f2('0x12')](_0x3418d8));if(_0x3418d8[_0x24f2('0x13')]){if(_0x3418d8['error'][_0x24f2('0x14')]===0x1f4){logger[_0x24f2('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5bb7c8,_0x3418d8[_0x24f2('0x13')]['message']);return _0x2a27ec(_0x3418d8[_0x24f2('0x13')][_0x24f2('0x15')]);}logger[_0x24f2('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5bb7c8,_0x3418d8['error']['message']);return _0x2a751b(_0x3418d8[_0x24f2('0x13')][_0x24f2('0x15')]);}else{logger['info'](_0x24f2('0xe'),_0x5bb7c8,'request\x20sent');_0x2a751b(_0x3418d8[_0x24f2('0x16')][_0x24f2('0x15')]);}})[_0x24f2('0x17')](function(_0x54f1ea){logger['error'](_0x24f2('0xe'),_0x5bb7c8,_0x54f1ea);_0x2a27ec(_0x54f1ea);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 3ab5e44..7cc77bd 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 _0xf6df=['index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x376aa0,_0x291751){var _0x55e594=function(_0x3adb31){while(--_0x3adb31){_0x376aa0['push'](_0x376aa0['shift']());}};_0x55e594(++_0x291751);}(_0xf6df,0xd2));var _0xff6d=function(_0x294187,_0x5102ff){_0x294187=_0x294187-0x0;var _0x321cfe=_0xf6df[_0x294187];return _0x321cfe;};'use strict';var multer=require('multer');var util=require(_0xff6d('0x0'));var path=require(_0xff6d('0x1'));var timeout=require(_0xff6d('0x2'));var express=require(_0xff6d('0x3'));var router=express[_0xff6d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff6d('0x5'));var interaction=require(_0xff6d('0x6'));var config=require(_0xff6d('0x7'));var controller=require(_0xff6d('0x8'));router[_0xff6d('0x9')]('/',auth['isAuthenticated'](),controller[_0xff6d('0xa')]);router[_0xff6d('0x9')](_0xff6d('0xb'),auth[_0xff6d('0xc')](),controller[_0xff6d('0xd')]);router[_0xff6d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff6d('0xf')](_0xff6d('0xb'),auth[_0xff6d('0xc')](),controller[_0xff6d('0x10')]);router[_0xff6d('0x11')](_0xff6d('0xb'),auth[_0xff6d('0xc')](),controller[_0xff6d('0x12')]);module[_0xff6d('0x13')]=router; \ No newline at end of file +var _0xab26=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x17ccbd,_0x43219e){var _0x11ff68=function(_0x11255f){while(--_0x11255f){_0x17ccbd['push'](_0x17ccbd['shift']());}};_0x11ff68(++_0x43219e);}(_0xab26,0x91));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var path=require('path');var timeout=require(_0x6ab2('0x2'));var express=require(_0x6ab2('0x3'));var router=express[_0x6ab2('0x4')]();var fs_extra=require(_0x6ab2('0x5'));var auth=require(_0x6ab2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab2('0x7'));var controller=require(_0x6ab2('0x8'));router[_0x6ab2('0x9')]('/',auth[_0x6ab2('0xa')](),controller[_0x6ab2('0xb')]);router[_0x6ab2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6ab2('0xc')]);router[_0x6ab2('0xd')]('/',auth[_0x6ab2('0xa')](),controller[_0x6ab2('0xe')]);router[_0x6ab2('0xf')]('/:id',auth[_0x6ab2('0xa')](),controller[_0x6ab2('0x10')]);router[_0x6ab2('0x11')](_0x6ab2('0x12'),auth[_0x6ab2('0xa')](),controller[_0x6ab2('0x13')]);module[_0x6ab2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1584798..9634962 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 _0x680e=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x22cdda,_0x35cf94){var _0x307321=function(_0x20796a){while(--_0x20796a){_0x22cdda['push'](_0x22cdda['shift']());}};_0x307321(++_0x35cf94);}(_0x680e,0x17a));var _0xe680=function(_0x1ce78b,_0x5290a9){_0x1ce78b=_0x1ce78b-0x0;var _0x2db86c=_0x680e[_0x1ce78b];return _0x2db86c;};'use strict';var Sequelize=require(_0xe680('0x0'));module['exports']={'type':{'type':Sequelize[_0xe680('0x1')](_0xe680('0x2'),_0xe680('0x3'),_0xe680('0x4'),_0xe680('0x5'),_0xe680('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe680('0x7')]},'key':{'type':Sequelize[_0xe680('0x7')]},'keyType':{'type':Sequelize[_0xe680('0x1')](_0xe680('0x2'),'variable',_0xe680('0x4'))},'keyContent':{'type':Sequelize[_0xe680('0x7')]},'idField':{'type':Sequelize[_0xe680('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe680('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe680('0x7')]}}; \ No newline at end of file +var _0x0d70=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x132660,_0x36ee2d){var _0x315143=function(_0x3ca20a){while(--_0x3ca20a){_0x132660['push'](_0x132660['shift']());}};_0x315143(++_0x36ee2d);}(_0x0d70,0x134));var _0x00d7=function(_0x53bf82,_0x8d3c0f){_0x53bf82=_0x53bf82-0x0;var _0x30eca2=_0x0d70[_0x53bf82];return _0x30eca2;};'use strict';var Sequelize=require(_0x00d7('0x0'));module[_0x00d7('0x1')]={'type':{'type':Sequelize[_0x00d7('0x2')]('string',_0x00d7('0x3'),_0x00d7('0x4'),_0x00d7('0x5'),'picklist'),'defaultValue':_0x00d7('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x00d7('0x7')]},'keyType':{'type':Sequelize[_0x00d7('0x2')](_0x00d7('0x6'),_0x00d7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x00d7('0x7')]},'idField':{'type':Sequelize[_0x00d7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'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 fc94ff2..1cfd878 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 _0x85b5=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','FreshdeskField','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x436e07,_0x49d794){var _0x35c4ad=function(_0x52fd8f){while(--_0x52fd8f){_0x436e07['push'](_0x436e07['shift']());}};_0x35c4ad(++_0x49d794);}(_0x85b5,0x7f));var _0x585b=function(_0x25fa2a,_0x3253e8){_0x25fa2a=_0x25fa2a-0x0;var _0x1bf7d5=_0x85b5[_0x25fa2a];return _0x1bf7d5;};'use strict';var emlformat=require(_0x585b('0x0'));var rimraf=require(_0x585b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x585b('0x2'));var rp=require('request-promise');var moment=require(_0x585b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x585b('0x4'));var path=require('path');var sox=require(_0x585b('0x5'));var csv=require(_0x585b('0x6'));var ejs=require(_0x585b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x585b('0x8'));var squel=require('squel');var crypto=require(_0x585b('0x9'));var jsforce=require(_0x585b('0xa'));var deskjs=require(_0x585b('0xb'));var toCsv=require(_0x585b('0x6'));var querystring=require('querystring');var Papa=require(_0x585b('0xc'));var Redis=require(_0x585b('0xd'));var authService=require(_0x585b('0xe'));var qs=require(_0x585b('0xf'));var as=require(_0x585b('0x10'));var hardwareService=require(_0x585b('0x11'));var logger=require(_0x585b('0x12'))('api');var utils=require(_0x585b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x585b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16d608,_0x35bda0){_0x35bda0=_0x35bda0||0xcc;return function(_0x19336c){if(_0x19336c){return _0x16d608['sendStatus'](_0x35bda0);}return _0x16d608[_0x585b('0x15')](_0x35bda0)[_0x585b('0x16')]();};}function respondWithResult(_0x3d15ed,_0x299ee4){_0x299ee4=_0x299ee4||0xc8;return function(_0x3dcc28){if(_0x3dcc28){return _0x3d15ed[_0x585b('0x15')](_0x299ee4)[_0x585b('0x17')](_0x3dcc28);}};}function respondWithFilteredResult(_0x5ebc1a,_0x2f827f){return function(_0x41f50d){if(_0x41f50d){var _0x4c094e=typeof _0x2f827f['offset']===_0x585b('0x18')&&typeof _0x2f827f['limit']==='undefined';var _0x2f840e=_0x41f50d[_0x585b('0x19')];var _0x20c4ba=_0x4c094e?0x0:_0x2f827f['offset'];var _0x72fdc4=_0x4c094e?_0x41f50d[_0x585b('0x19')]:_0x2f827f[_0x585b('0x1a')]+_0x2f827f[_0x585b('0x1b')];var _0x562886;if(_0x72fdc4>=_0x2f840e){_0x72fdc4=_0x2f840e;_0x562886=0xc8;}else{_0x562886=0xce;}_0x5ebc1a[_0x585b('0x15')](_0x562886);return _0x5ebc1a[_0x585b('0x1c')](_0x585b('0x1d'),_0x20c4ba+'-'+_0x72fdc4+'/'+_0x2f840e)['json'](_0x41f50d);}return null;};}function patchUpdates(_0x5200ec){return function(_0x6bea29){try{jsonpatch['apply'](_0x6bea29,_0x5200ec,!![]);}catch(_0x484157){return BPromise[_0x585b('0x1e')](_0x484157);}return _0x6bea29[_0x585b('0x1f')]();};}function saveUpdates(_0x48d9f8,_0x183308){return function(_0x272a8d){if(_0x272a8d){return _0x272a8d['update'](_0x48d9f8)[_0x585b('0x20')](function(_0xe50751){return _0xe50751;});}return null;};}function removeEntity(_0x2122e0,_0x5bf9e4){return function(_0x1c8a7b){if(_0x1c8a7b){return _0x1c8a7b['destroy']()[_0x585b('0x20')](function(){_0x2122e0[_0x585b('0x15')](0xcc)[_0x585b('0x16')]();});}};}function handleEntityNotFound(_0x428a9a,_0x1b06a2){return function(_0x1b1241){if(!_0x1b1241){_0x428a9a[_0x585b('0x21')](0x194);}return _0x1b1241;};}function handleError(_0x799947,_0x100189){_0x100189=_0x100189||0x1f4;return function(_0x47099f){logger[_0x585b('0x22')](_0x47099f[_0x585b('0x23')]);if(_0x47099f[_0x585b('0x24')]){delete _0x47099f[_0x585b('0x24')];}_0x799947[_0x585b('0x15')](_0x100189)['send'](_0x47099f);};}exports[_0x585b('0x25')]=function(_0x205ffe,_0x19786){var _0x2cf48a={},_0x5dad9a={},_0x4e9fc8={'count':0x0,'rows':[]};var _0xedf913=_[_0x585b('0x26')](db['FreshdeskField'][_0x585b('0x27')],function(_0x112fb5){return{'name':_0x112fb5['fieldName'],'type':_0x112fb5[_0x585b('0x28')][_0x585b('0x29')]};});_0x5dad9a[_0x585b('0x2a')]=_[_0x585b('0x26')](_0xedf913,_0x585b('0x24'));_0x5dad9a[_0x585b('0x2b')]=_[_0x585b('0x2c')](_0x205ffe[_0x585b('0x2b')]);_0x5dad9a[_0x585b('0x2d')]=_[_0x585b('0x2e')](_0x5dad9a['model'],_0x5dad9a[_0x585b('0x2b')]);_0x2cf48a[_0x585b('0x2f')]=_[_0x585b('0x2e')](_0x5dad9a['model'],qs[_0x585b('0x30')](_0x205ffe[_0x585b('0x2b')][_0x585b('0x30')]));_0x2cf48a['attributes']=_0x2cf48a[_0x585b('0x2f')][_0x585b('0x31')]?_0x2cf48a[_0x585b('0x2f')]:_0x5dad9a[_0x585b('0x2a')];if(!_0x205ffe['query']['hasOwnProperty'](_0x585b('0x32'))){_0x2cf48a[_0x585b('0x1b')]=qs[_0x585b('0x1b')](_0x205ffe[_0x585b('0x2b')][_0x585b('0x1b')]);_0x2cf48a['offset']=qs[_0x585b('0x1a')](_0x205ffe[_0x585b('0x2b')][_0x585b('0x1a')]);}_0x2cf48a[_0x585b('0x33')]=qs[_0x585b('0x34')](_0x205ffe['query']['sort']);_0x2cf48a['where']=qs[_0x585b('0x2d')](_[_0x585b('0x35')](_0x205ffe[_0x585b('0x2b')],_0x5dad9a[_0x585b('0x2d')]),_0xedf913);if(_0x205ffe[_0x585b('0x2b')][_0x585b('0x36')]){_0x2cf48a[_0x585b('0x37')]=_[_0x585b('0x38')](_0x2cf48a[_0x585b('0x37')],{'$or':_['map'](_0xedf913,function(_0x434768){if(_0x434768[_0x585b('0x28')]!=='VIRTUAL'){var _0x368fb0={};_0x368fb0[_0x434768[_0x585b('0x24')]]={'$like':'%'+_0x205ffe[_0x585b('0x2b')][_0x585b('0x36')]+'%'};return _0x368fb0;}})});}_0x2cf48a=_[_0x585b('0x38')]({},_0x2cf48a,_0x205ffe[_0x585b('0x39')]);var _0x58bf4c={'where':_0x2cf48a[_0x585b('0x37')]};return db[_0x585b('0x3a')][_0x585b('0x19')](_0x58bf4c)[_0x585b('0x20')](function(_0xfa9f00){_0x4e9fc8[_0x585b('0x19')]=_0xfa9f00;if(_0x205ffe[_0x585b('0x2b')][_0x585b('0x3b')]){_0x2cf48a['include']=[{'all':!![]}];}return db[_0x585b('0x3a')][_0x585b('0x3c')](_0x2cf48a);})[_0x585b('0x20')](function(_0x4c5a14){_0x4e9fc8[_0x585b('0x3d')]=_0x4c5a14;return _0x4e9fc8;})[_0x585b('0x20')](respondWithFilteredResult(_0x19786,_0x2cf48a))[_0x585b('0x3e')](handleError(_0x19786,null));};exports['show']=function(_0x1240e2,_0x2310e3){var _0x5112f5={'raw':!![],'where':{'id':_0x1240e2[_0x585b('0x3f')]['id']}},_0x4edd57={};_0x4edd57['model']=_[_0x585b('0x2c')](db['FreshdeskField'][_0x585b('0x27')]);_0x4edd57[_0x585b('0x2b')]=_['keys'](_0x1240e2[_0x585b('0x2b')]);_0x4edd57['filters']=_['intersection'](_0x4edd57['model'],_0x4edd57[_0x585b('0x2b')]);_0x5112f5['attributes']=_[_0x585b('0x2e')](_0x4edd57[_0x585b('0x2a')],qs['fields'](_0x1240e2[_0x585b('0x2b')][_0x585b('0x30')]));_0x5112f5[_0x585b('0x2f')]=_0x5112f5['attributes']['length']?_0x5112f5['attributes']:_0x4edd57[_0x585b('0x2a')];if(_0x1240e2[_0x585b('0x2b')][_0x585b('0x3b')]){_0x5112f5[_0x585b('0x40')]=[{'all':!![]}];}_0x5112f5=_['merge']({},_0x5112f5,_0x1240e2[_0x585b('0x39')]);return db[_0x585b('0x3a')][_0x585b('0x41')](_0x5112f5)[_0x585b('0x20')](handleEntityNotFound(_0x2310e3,null))['then'](respondWithResult(_0x2310e3,null))[_0x585b('0x3e')](handleError(_0x2310e3,null));};exports[_0x585b('0x42')]=function(_0x36eb61,_0x5bf8b4){return db[_0x585b('0x3a')]['create'](_0x36eb61['body'],{})['then'](respondWithResult(_0x5bf8b4,0xc9))[_0x585b('0x3e')](handleError(_0x5bf8b4,null));};exports['update']=function(_0x1f8ae0,_0x54ab6f){if(_0x1f8ae0['body']['id']){delete _0x1f8ae0['body']['id'];}return db[_0x585b('0x3a')][_0x585b('0x41')]({'where':{'id':_0x1f8ae0['params']['id']}})['then'](handleEntityNotFound(_0x54ab6f,null))[_0x585b('0x20')](saveUpdates(_0x1f8ae0[_0x585b('0x43')],null))[_0x585b('0x20')](respondWithResult(_0x54ab6f,null))['catch'](handleError(_0x54ab6f,null));};exports[_0x585b('0x44')]=function(_0x4ca120,_0x44234e){return db['FreshdeskField'][_0x585b('0x41')]({'where':{'id':_0x4ca120['params']['id']}})[_0x585b('0x20')](handleEntityNotFound(_0x44234e,null))['then'](removeEntity(_0x44234e,null))[_0x585b('0x3e')](handleError(_0x44234e,null));}; \ No newline at end of file +var _0x6a24=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x6a24,0xd1));var _0x46a2=function(_0x275457,_0x2764dc){_0x275457=_0x275457-0x0;var _0x105427=_0x6a24[_0x275457];return _0x105427;};'use strict';var emlformat=require(_0x46a2('0x0'));var rimraf=require(_0x46a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require(_0x46a2('0x5'));var Mustache=require(_0x46a2('0x6'));var util=require('util');var path=require(_0x46a2('0x7'));var sox=require(_0x46a2('0x8'));var csv=require('to-csv');var ejs=require(_0x46a2('0x9'));var fs=require('fs');var fs_extra=require(_0x46a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46a2('0xb'));var jsforce=require(_0x46a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46a2('0xd'));var querystring=require('querystring');var Papa=require(_0x46a2('0xe'));var Redis=require('ioredis');var authService=require(_0x46a2('0xf'));var qs=require(_0x46a2('0x10'));var as=require(_0x46a2('0x11'));var hardwareService=require(_0x46a2('0x12'));var logger=require(_0x46a2('0x13'))(_0x46a2('0x14'));var utils=require(_0x46a2('0x15'));var config=require(_0x46a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403282,_0x18e584){_0x18e584=_0x18e584||0xcc;return function(_0x5c5d10){if(_0x5c5d10){return _0x403282[_0x46a2('0x17')](_0x18e584);}return _0x403282[_0x46a2('0x18')](_0x18e584)[_0x46a2('0x19')]();};}function respondWithResult(_0x18a038,_0xddc328){_0xddc328=_0xddc328||0xc8;return function(_0x2fd383){if(_0x2fd383){return _0x18a038[_0x46a2('0x18')](_0xddc328)[_0x46a2('0x1a')](_0x2fd383);}};}function respondWithFilteredResult(_0x577591,_0x4a7e7a){return function(_0x3c81e8){if(_0x3c81e8){var _0x2deb20=typeof _0x4a7e7a['offset']===_0x46a2('0x1b')&&typeof _0x4a7e7a[_0x46a2('0x1c')]==='undefined';var _0xa2eb96=_0x3c81e8[_0x46a2('0x1d')];var _0x577f18=_0x2deb20?0x0:_0x4a7e7a[_0x46a2('0x1e')];var _0x24f75f=_0x2deb20?_0x3c81e8['count']:_0x4a7e7a[_0x46a2('0x1e')]+_0x4a7e7a[_0x46a2('0x1c')];var _0x5144c7;if(_0x24f75f>=_0xa2eb96){_0x24f75f=_0xa2eb96;_0x5144c7=0xc8;}else{_0x5144c7=0xce;}_0x577591[_0x46a2('0x18')](_0x5144c7);return _0x577591[_0x46a2('0x1f')](_0x46a2('0x20'),_0x577f18+'-'+_0x24f75f+'/'+_0xa2eb96)[_0x46a2('0x1a')](_0x3c81e8);}return null;};}function patchUpdates(_0x202294){return function(_0x2d65c2){try{jsonpatch[_0x46a2('0x21')](_0x2d65c2,_0x202294,!![]);}catch(_0x473cfb){return BPromise[_0x46a2('0x22')](_0x473cfb);}return _0x2d65c2[_0x46a2('0x23')]();};}function saveUpdates(_0x5c7586,_0xa37d90){return function(_0x504b9e){if(_0x504b9e){return _0x504b9e[_0x46a2('0x24')](_0x5c7586)[_0x46a2('0x25')](function(_0x511ff6){return _0x511ff6;});}return null;};}function removeEntity(_0x43dc69,_0x15e5bb){return function(_0x233c4e){if(_0x233c4e){return _0x233c4e[_0x46a2('0x26')]()['then'](function(){_0x43dc69[_0x46a2('0x18')](0xcc)[_0x46a2('0x19')]();});}};}function handleEntityNotFound(_0x1e48f5,_0x297158){return function(_0x74bb6a){if(!_0x74bb6a){_0x1e48f5[_0x46a2('0x17')](0x194);}return _0x74bb6a;};}function handleError(_0x3e9554,_0xfa9e13){_0xfa9e13=_0xfa9e13||0x1f4;return function(_0x218f1c){logger[_0x46a2('0x27')](_0x218f1c[_0x46a2('0x28')]);if(_0x218f1c['name']){delete _0x218f1c[_0x46a2('0x29')];}_0x3e9554[_0x46a2('0x18')](_0xfa9e13)[_0x46a2('0x2a')](_0x218f1c);};}exports[_0x46a2('0x2b')]=function(_0x435155,_0x33f42a){var _0x577fd2={},_0x185647={},_0x26856f={'count':0x0,'rows':[]};var _0x2166eb=_[_0x46a2('0x2c')](db[_0x46a2('0x2d')][_0x46a2('0x2e')],function(_0x4024be){return{'name':_0x4024be['fieldName'],'type':_0x4024be[_0x46a2('0x2f')][_0x46a2('0x30')]};});_0x185647[_0x46a2('0x31')]=_[_0x46a2('0x2c')](_0x2166eb,_0x46a2('0x29'));_0x185647[_0x46a2('0x32')]=_[_0x46a2('0x33')](_0x435155[_0x46a2('0x32')]);_0x185647[_0x46a2('0x34')]=_['intersection'](_0x185647[_0x46a2('0x31')],_0x185647[_0x46a2('0x32')]);_0x577fd2[_0x46a2('0x35')]=_[_0x46a2('0x36')](_0x185647[_0x46a2('0x31')],qs['fields'](_0x435155['query'][_0x46a2('0x37')]));_0x577fd2[_0x46a2('0x35')]=_0x577fd2[_0x46a2('0x35')][_0x46a2('0x38')]?_0x577fd2[_0x46a2('0x35')]:_0x185647[_0x46a2('0x31')];if(!_0x435155['query']['hasOwnProperty'](_0x46a2('0x39'))){_0x577fd2['limit']=qs[_0x46a2('0x1c')](_0x435155[_0x46a2('0x32')][_0x46a2('0x1c')]);_0x577fd2[_0x46a2('0x1e')]=qs['offset'](_0x435155[_0x46a2('0x32')][_0x46a2('0x1e')]);}_0x577fd2[_0x46a2('0x3a')]=qs[_0x46a2('0x3b')](_0x435155['query'][_0x46a2('0x3b')]);_0x577fd2[_0x46a2('0x3c')]=qs[_0x46a2('0x34')](_[_0x46a2('0x3d')](_0x435155['query'],_0x185647[_0x46a2('0x34')]),_0x2166eb);if(_0x435155['query'][_0x46a2('0x3e')]){_0x577fd2['where']=_[_0x46a2('0x3f')](_0x577fd2[_0x46a2('0x3c')],{'$or':_['map'](_0x2166eb,function(_0x316b3d){if(_0x316b3d['type']!=='VIRTUAL'){var _0x25aa1d={};_0x25aa1d[_0x316b3d[_0x46a2('0x29')]]={'$like':'%'+_0x435155[_0x46a2('0x32')][_0x46a2('0x3e')]+'%'};return _0x25aa1d;}})});}_0x577fd2=_[_0x46a2('0x3f')]({},_0x577fd2,_0x435155[_0x46a2('0x40')]);var _0x482ed8={'where':_0x577fd2[_0x46a2('0x3c')]};return db[_0x46a2('0x2d')][_0x46a2('0x1d')](_0x482ed8)[_0x46a2('0x25')](function(_0x23cfc9){_0x26856f[_0x46a2('0x1d')]=_0x23cfc9;if(_0x435155[_0x46a2('0x32')][_0x46a2('0x41')]){_0x577fd2[_0x46a2('0x42')]=[{'all':!![]}];}return db[_0x46a2('0x2d')]['findAll'](_0x577fd2);})[_0x46a2('0x25')](function(_0x15ec39){_0x26856f[_0x46a2('0x43')]=_0x15ec39;return _0x26856f;})[_0x46a2('0x25')](respondWithFilteredResult(_0x33f42a,_0x577fd2))['catch'](handleError(_0x33f42a,null));};exports[_0x46a2('0x44')]=function(_0x18845e,_0x153305){var _0x3869d4={'raw':!![],'where':{'id':_0x18845e['params']['id']}},_0x1fcc03={};_0x1fcc03[_0x46a2('0x31')]=_['keys'](db[_0x46a2('0x2d')][_0x46a2('0x2e')]);_0x1fcc03['query']=_[_0x46a2('0x33')](_0x18845e[_0x46a2('0x32')]);_0x1fcc03[_0x46a2('0x34')]=_[_0x46a2('0x36')](_0x1fcc03[_0x46a2('0x31')],_0x1fcc03[_0x46a2('0x32')]);_0x3869d4[_0x46a2('0x35')]=_[_0x46a2('0x36')](_0x1fcc03[_0x46a2('0x31')],qs[_0x46a2('0x37')](_0x18845e['query'][_0x46a2('0x37')]));_0x3869d4[_0x46a2('0x35')]=_0x3869d4[_0x46a2('0x35')][_0x46a2('0x38')]?_0x3869d4[_0x46a2('0x35')]:_0x1fcc03['model'];if(_0x18845e[_0x46a2('0x32')][_0x46a2('0x41')]){_0x3869d4[_0x46a2('0x42')]=[{'all':!![]}];}_0x3869d4=_[_0x46a2('0x3f')]({},_0x3869d4,_0x18845e[_0x46a2('0x40')]);return db['FreshdeskField'][_0x46a2('0x45')](_0x3869d4)['then'](handleEntityNotFound(_0x153305,null))[_0x46a2('0x25')](respondWithResult(_0x153305,null))[_0x46a2('0x46')](handleError(_0x153305,null));};exports['create']=function(_0x41b4cd,_0x3f8673){return db[_0x46a2('0x2d')][_0x46a2('0x47')](_0x41b4cd[_0x46a2('0x48')],{})[_0x46a2('0x25')](respondWithResult(_0x3f8673,0xc9))[_0x46a2('0x46')](handleError(_0x3f8673,null));};exports['update']=function(_0x369015,_0x1f8640){if(_0x369015[_0x46a2('0x48')]['id']){delete _0x369015[_0x46a2('0x48')]['id'];}return db['FreshdeskField'][_0x46a2('0x45')]({'where':{'id':_0x369015['params']['id']}})[_0x46a2('0x25')](handleEntityNotFound(_0x1f8640,null))[_0x46a2('0x25')](saveUpdates(_0x369015['body'],null))[_0x46a2('0x25')](respondWithResult(_0x1f8640,null))['catch'](handleError(_0x1f8640,null));};exports[_0x46a2('0x26')]=function(_0x76ccd3,_0x3be2a7){return db[_0x46a2('0x2d')][_0x46a2('0x45')]({'where':{'id':_0x76ccd3[_0x46a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x3be2a7,null))['then'](removeEntity(_0x3be2a7,null))[_0x46a2('0x46')](handleError(_0x3be2a7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9d92250..2d799ae 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 _0xc910=['define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x13ecdc,_0x4982d0){var _0x590fdb=function(_0x580259){while(--_0x580259){_0x13ecdc['push'](_0x13ecdc['shift']());}};_0x590fdb(++_0x4982d0);}(_0xc910,0x1e1));var _0x0c91=function(_0xaddefe,_0x322e26){_0xaddefe=_0xaddefe-0x0;var _0x42bfe1=_0xc910[_0xaddefe];return _0x42bfe1;};'use strict';var _=require('lodash');var util=require(_0x0c91('0x0'));var logger=require(_0x0c91('0x1'))('api');var moment=require(_0x0c91('0x2'));var BPromise=require(_0x0c91('0x3'));var rp=require(_0x0c91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c91('0x5'));var config=require(_0x0c91('0x6'));var attributes=require(_0x0c91('0x7'));module[_0x0c91('0x8')]=function(_0x4c4eb4,_0x3d2049){return _0x4c4eb4[_0x0c91('0x9')]('FreshdeskField',attributes,{'tableName':_0x0c91('0xa'),'paranoid':![],'indexes':[{'name':_0x0c91('0xb'),'fields':[_0x0c91('0xc'),_0x0c91('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeef2=['freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeef2,0x162));var _0x2eef=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xeef2[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2eef('0x0'));var util=require(_0x2eef('0x1'));var logger=require(_0x2eef('0x2'))(_0x2eef('0x3'));var moment=require(_0x2eef('0x4'));var BPromise=require(_0x2eef('0x5'));var rp=require(_0x2eef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2eef('0x7'));var config=require(_0x2eef('0x8'));var attributes=require(_0x2eef('0x9'));module[_0x2eef('0xa')]=function(_0x114a66,_0x38bb33){return _0x114a66[_0x2eef('0xb')](_0x2eef('0xc'),attributes,{'tableName':_0x2eef('0xd'),'paranoid':![],'indexes':[{'name':_0x2eef('0xe'),'fields':[_0x2eef('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 0f89783..92da31f 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 _0x8be4=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8be4,0x1a8));var _0x48be=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8be4[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x48be('0x0'));var util=require(_0x48be('0x1'));var moment=require(_0x48be('0x2'));var BPromise=require(_0x48be('0x3'));var rs=require(_0x48be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x48be('0x5'));var logger=require(_0x48be('0x6'))(_0x48be('0x7'));var config=require(_0x48be('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x48be('0x9')][_0x48be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3fb0,_0xed58bb,_0x3d9aae){return new BPromise(function(_0x2cdaf5,_0x5d50f9){return client[_0x48be('0xb')](_0x3a3fb0,_0x3d9aae)[_0x48be('0xc')](function(_0x20329e){logger[_0x48be('0xd')](_0x48be('0xe'),_0xed58bb,_0x48be('0xf'));logger[_0x48be('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0xed58bb,_0x48be('0xf'),JSON[_0x48be('0x11')](_0x20329e));if(_0x20329e[_0x48be('0x12')]){if(_0x20329e[_0x48be('0x12')][_0x48be('0x13')]===0x1f4){logger[_0x48be('0x12')]('FreshdeskField,\x20%s,\x20%s',_0xed58bb,_0x20329e['error'][_0x48be('0x14')]);return _0x5d50f9(_0x20329e['error'][_0x48be('0x14')]);}logger['error'](_0x48be('0xe'),_0xed58bb,_0x20329e[_0x48be('0x12')]['message']);return _0x2cdaf5(_0x20329e[_0x48be('0x12')][_0x48be('0x14')]);}else{logger[_0x48be('0xd')](_0x48be('0xe'),_0xed58bb,'request\x20sent');_0x2cdaf5(_0x20329e[_0x48be('0x15')][_0x48be('0x14')]);}})[_0x48be('0x16')](function(_0x48bc79){logger['error'](_0x48be('0xe'),_0xed58bb,_0x48bc79);_0x5d50f9(_0x48bc79);});});} \ No newline at end of file +var _0x0475=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x38c331,_0x3674c3){var _0x4e5233=function(_0x24608b){while(--_0x24608b){_0x38c331['push'](_0x38c331['shift']());}};_0x4e5233(++_0x3674c3);}(_0x0475,0xf3));var _0x5047=function(_0x381ec0,_0x374714){_0x381ec0=_0x381ec0-0x0;var _0x25604c=_0x0475[_0x381ec0];return _0x25604c;};'use strict';var _=require(_0x5047('0x0'));var util=require(_0x5047('0x1'));var moment=require(_0x5047('0x2'));var BPromise=require(_0x5047('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5047('0x4'));var db=require(_0x5047('0x5'))['db'];var utils=require(_0x5047('0x6'));var logger=require(_0x5047('0x7'))(_0x5047('0x8'));var config=require(_0x5047('0x9'));var jayson=require(_0x5047('0xa'));var client=jayson[_0x5047('0xb')][_0x5047('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1086d2,_0x5df500,_0x10364f){return new BPromise(function(_0x558364,_0x3ee013){return client[_0x5047('0xd')](_0x1086d2,_0x10364f)[_0x5047('0xe')](function(_0x228a3a){logger[_0x5047('0xf')](_0x5047('0x10'),_0x5df500,_0x5047('0x11'));logger[_0x5047('0x12')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x5df500,_0x5047('0x11'),JSON['stringify'](_0x228a3a));if(_0x228a3a['error']){if(_0x228a3a[_0x5047('0x13')][_0x5047('0x14')]===0x1f4){logger['error'](_0x5047('0x10'),_0x5df500,_0x228a3a[_0x5047('0x13')][_0x5047('0x15')]);return _0x3ee013(_0x228a3a['error'][_0x5047('0x15')]);}logger[_0x5047('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x5df500,_0x228a3a[_0x5047('0x13')][_0x5047('0x15')]);return _0x558364(_0x228a3a[_0x5047('0x13')][_0x5047('0x15')]);}else{logger['info'](_0x5047('0x10'),_0x5df500,_0x5047('0x11'));_0x558364(_0x228a3a[_0x5047('0x16')][_0x5047('0x15')]);}})[_0x5047('0x17')](function(_0x433378){logger['error'](_0x5047('0x10'),_0x5df500,_0x433378);_0x3ee013(_0x433378);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 8293345..fd614e7 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 _0x13f6=['./intFreshsalesAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','/:id','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x445346,_0x4a082b){var _0x84d2e8=function(_0x4082c8){while(--_0x4082c8){_0x445346['push'](_0x445346['shift']());}};_0x84d2e8(++_0x4a082b);}(_0x13f6,0x124));var _0x613f=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0x13f6[_0x1a7edf];return _0x56c1d9;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);router[_0x613f('0x10')]('/:id/configurations',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller[_0x613f('0x15')]);module[_0x613f('0x16')]=router; \ No newline at end of file +var _0xf290=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x69af64,_0x5ab780){var _0x2df4f0=function(_0x51c21a){while(--_0x51c21a){_0x69af64['push'](_0x69af64['shift']());}};_0x2df4f0(++_0x5ab780);}(_0xf290,0xde));var _0x0f29=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xf290[_0x487ab4];return _0x3bef77;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var fs_extra=require(_0x0f29('0x3'));var auth=require(_0x0f29('0x4'));var interaction=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x0f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x7')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0x7')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);router[_0x0f29('0x7')](_0x0f29('0xe'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xf')]);router[_0x0f29('0x10')]('/',auth[_0x0f29('0xa')](),controller['create']);router[_0x0f29('0x10')]('/:id/configurations',auth[_0x0f29('0xa')](),controller[_0x0f29('0x11')]);router[_0x0f29('0x12')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x13')]);router['delete'](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x14')]);module[_0x0f29('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a50651a..b39910b 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 _0x7096=['exports','STRING','username','remoteUri'];(function(_0x520d19,_0x1d0d21){var _0xb2dddd=function(_0x390f38){while(--_0x390f38){_0x520d19['push'](_0x520d19['shift']());}};_0xb2dddd(++_0x1d0d21);}(_0x7096,0x10c));var _0x6709=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7096[_0x5b561d];return _0x431060;};'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 +var _0x5464=['remoteUri','sequelize','exports','STRING'];(function(_0x49dba5,_0x1086fd){var _0x495fc6=function(_0x26b659){while(--_0x26b659){_0x49dba5['push'](_0x49dba5['shift']());}};_0x495fc6(++_0x1086fd);}(_0x5464,0x15d));var _0x4546=function(_0x2499c1,_0x3c672a){_0x2499c1=_0x2499c1-0x0;var _0x49e2b7=_0x5464[_0x2499c1];return _0x49e2b7;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'name':{'type':Sequelize[_0x4546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4546('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x4546('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4546('0x3')},'serverUrl':{'type':Sequelize[_0x4546('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 8ffef0b..2f298e6 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 _0x81ed=['GET','%s%s','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','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','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','length','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','username','remoteUri','apiKey','slice','substring'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0x81ed,0xca));var _0xd81e=function(_0xc7b8,_0x4853a1){_0xc7b8=_0xc7b8-0x0;var _0x5b12b4=_0x81ed[_0xc7b8];return _0x5b12b4;};'use strict';var emlformat=require(_0xd81e('0x0'));var rimraf=require(_0xd81e('0x1'));var zipdir=require(_0xd81e('0x2'));var jsonpatch=require(_0xd81e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd81e('0x4'));var Mustache=require(_0xd81e('0x5'));var util=require('util');var path=require(_0xd81e('0x6'));var sox=require(_0xd81e('0x7'));var csv=require(_0xd81e('0x8'));var ejs=require(_0xd81e('0x9'));var fs=require('fs');var fs_extra=require(_0xd81e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81e('0xb'));var deskjs=require(_0xd81e('0xc'));var toCsv=require(_0xd81e('0x8'));var querystring=require(_0xd81e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd81e('0xe'));var qs=require(_0xd81e('0xf'));var as=require(_0xd81e('0x10'));var hardwareService=require(_0xd81e('0x11'));var logger=require(_0xd81e('0x12'))(_0xd81e('0x13'));var utils=require(_0xd81e('0x14'));var config=require(_0xd81e('0x15'));var licenseUtil=require(_0xd81e('0x16'));var db=require(_0xd81e('0x17'))['db'];var integrations=require(_0xd81e('0x18'));function respondWithStatusCode(_0x2be244,_0x59b418){_0x59b418=_0x59b418||0xcc;return function(_0x5e80b2){if(_0x5e80b2){return _0x2be244[_0xd81e('0x19')](_0x59b418);}return _0x2be244[_0xd81e('0x1a')](_0x59b418)[_0xd81e('0x1b')]();};}function respondWithResult(_0x1816d7,_0x4be7d0){_0x4be7d0=_0x4be7d0||0xc8;return function(_0x35c721){if(_0x35c721){return _0x1816d7['status'](_0x4be7d0)['json'](_0x35c721);}};}function respondWithFilteredResult(_0x30a53b,_0x2b511c){return function(_0x35b74b){if(_0x35b74b){var _0x2179f4=typeof _0x2b511c['offset']===_0xd81e('0x1c')&&typeof _0x2b511c[_0xd81e('0x1d')]==='undefined';var _0x4c387e=_0x35b74b[_0xd81e('0x1e')];var _0x29c146=_0x2179f4?0x0:_0x2b511c[_0xd81e('0x1f')];var _0x419511=_0x2179f4?_0x35b74b[_0xd81e('0x1e')]:_0x2b511c[_0xd81e('0x1f')]+_0x2b511c[_0xd81e('0x1d')];var _0x4f51cc;if(_0x419511>=_0x4c387e){_0x419511=_0x4c387e;_0x4f51cc=0xc8;}else{_0x4f51cc=0xce;}_0x30a53b[_0xd81e('0x1a')](_0x4f51cc);return _0x30a53b[_0xd81e('0x20')](_0xd81e('0x21'),_0x29c146+'-'+_0x419511+'/'+_0x4c387e)[_0xd81e('0x22')](_0x35b74b);}return null;};}function patchUpdates(_0x42d80d){return function(_0x11b067){try{jsonpatch[_0xd81e('0x23')](_0x11b067,_0x42d80d,!![]);}catch(_0x4c40a7){return BPromise['reject'](_0x4c40a7);}return _0x11b067[_0xd81e('0x24')]();};}function saveUpdates(_0x204280,_0x4177bc){return function(_0x391a2a){if(_0x391a2a){return _0x391a2a[_0xd81e('0x25')](_0x204280)[_0xd81e('0x26')](function(_0x438d6a){return _0x438d6a;});}return null;};}function removeEntity(_0x5c14d8,_0x9b3ddb){return function(_0x241916){if(_0x241916){return _0x241916[_0xd81e('0x27')]()[_0xd81e('0x26')](function(){_0x5c14d8['status'](0xcc)[_0xd81e('0x1b')]();});}};}function handleEntityNotFound(_0x4b9587,_0x248ffc){return function(_0x12f6a1){if(!_0x12f6a1){_0x4b9587['sendStatus'](0x194);}return _0x12f6a1;};}function handleError(_0x4d8a80,_0x5556b3){_0x5556b3=_0x5556b3||0x1f4;return function(_0x2b5943){logger['error'](_0x2b5943['stack']);if(_0x2b5943[_0xd81e('0x28')]){delete _0x2b5943['name'];}_0x4d8a80[_0xd81e('0x1a')](_0x5556b3)[_0xd81e('0x29')](_0x2b5943);};}exports[_0xd81e('0x2a')]=function(_0x528837,_0x5a527d){var _0x2c560e={},_0x3ded28={},_0x5a7952={'count':0x0,'rows':[]};var _0x29356c=_[_0xd81e('0x2b')](db[_0xd81e('0x2c')][_0xd81e('0x2d')],function(_0x4508e3){return{'name':_0x4508e3['fieldName'],'type':_0x4508e3[_0xd81e('0x2e')][_0xd81e('0x2f')]};});_0x3ded28[_0xd81e('0x30')]=_[_0xd81e('0x2b')](_0x29356c,_0xd81e('0x28'));_0x3ded28[_0xd81e('0x31')]=_[_0xd81e('0x32')](_0x528837['query']);_0x3ded28[_0xd81e('0x33')]=_['intersection'](_0x3ded28[_0xd81e('0x30')],_0x3ded28[_0xd81e('0x31')]);_0x2c560e[_0xd81e('0x34')]=_[_0xd81e('0x35')](_0x3ded28['model'],qs[_0xd81e('0x36')](_0x528837['query'][_0xd81e('0x36')]));_0x2c560e[_0xd81e('0x34')]=_0x2c560e[_0xd81e('0x34')]['length']?_0x2c560e[_0xd81e('0x34')]:_0x3ded28['model'];if(!_0x528837[_0xd81e('0x31')][_0xd81e('0x37')]('nolimit')){_0x2c560e[_0xd81e('0x1d')]=qs[_0xd81e('0x1d')](_0x528837['query'][_0xd81e('0x1d')]);_0x2c560e['offset']=qs[_0xd81e('0x1f')](_0x528837[_0xd81e('0x31')][_0xd81e('0x1f')]);}_0x2c560e[_0xd81e('0x38')]=qs[_0xd81e('0x39')](_0x528837[_0xd81e('0x31')][_0xd81e('0x39')]);_0x2c560e[_0xd81e('0x3a')]=qs['filters'](_[_0xd81e('0x3b')](_0x528837[_0xd81e('0x31')],_0x3ded28[_0xd81e('0x33')]),_0x29356c);if(_0x528837[_0xd81e('0x31')]['filter']){_0x2c560e[_0xd81e('0x3a')]=_['merge'](_0x2c560e[_0xd81e('0x3a')],{'$or':_[_0xd81e('0x2b')](_0x29356c,function(_0x48e5c3){if(_0x48e5c3[_0xd81e('0x2e')]!==_0xd81e('0x3c')){var _0x506283={};_0x506283[_0x48e5c3[_0xd81e('0x28')]]={'$like':'%'+_0x528837[_0xd81e('0x31')][_0xd81e('0x3d')]+'%'};return _0x506283;}})});}_0x2c560e=_[_0xd81e('0x3e')]({},_0x2c560e,_0x528837['options']);var _0x184870={'where':_0x2c560e[_0xd81e('0x3a')]};return db[_0xd81e('0x2c')][_0xd81e('0x1e')](_0x184870)[_0xd81e('0x26')](function(_0x18c87f){_0x5a7952[_0xd81e('0x1e')]=_0x18c87f;if(_0x528837[_0xd81e('0x31')][_0xd81e('0x3f')]){_0x2c560e[_0xd81e('0x40')]=[{'all':!![]}];}return db[_0xd81e('0x2c')][_0xd81e('0x41')](_0x2c560e);})[_0xd81e('0x26')](function(_0x4ed4ea){_0x5a7952[_0xd81e('0x42')]=_0x4ed4ea;return _0x5a7952;})[_0xd81e('0x26')](respondWithFilteredResult(_0x5a527d,_0x2c560e))['catch'](handleError(_0x5a527d,null));};exports[_0xd81e('0x43')]=function(_0x19a1c7,_0x3a0204){var _0x17b0ec={'raw':![],'where':{'id':_0x19a1c7[_0xd81e('0x44')]['id']}},_0x45d63b={};_0x45d63b['model']=_[_0xd81e('0x32')](db[_0xd81e('0x2c')][_0xd81e('0x2d')]);_0x45d63b[_0xd81e('0x31')]=_['keys'](_0x19a1c7['query']);_0x45d63b[_0xd81e('0x33')]=_[_0xd81e('0x35')](_0x45d63b[_0xd81e('0x30')],_0x45d63b[_0xd81e('0x31')]);_0x17b0ec[_0xd81e('0x34')]=_[_0xd81e('0x35')](_0x45d63b['model'],qs[_0xd81e('0x36')](_0x19a1c7[_0xd81e('0x31')][_0xd81e('0x36')]));_0x17b0ec[_0xd81e('0x34')]=_0x17b0ec['attributes']['length']?_0x17b0ec[_0xd81e('0x34')]:_0x45d63b['model'];if(_0x19a1c7[_0xd81e('0x31')][_0xd81e('0x3f')]){_0x17b0ec['include']=[{'all':!![]}];}_0x17b0ec=_['merge']({},_0x17b0ec,_0x19a1c7['options']);return db[_0xd81e('0x2c')][_0xd81e('0x45')](_0x17b0ec)[_0xd81e('0x26')](handleEntityNotFound(_0x3a0204,null))[_0xd81e('0x26')](respondWithResult(_0x3a0204,null))[_0xd81e('0x46')](handleError(_0x3a0204,null));};exports[_0xd81e('0x47')]=function(_0x17147c,_0x4e61cf){return db[_0xd81e('0x2c')][_0xd81e('0x47')](_0x17147c[_0xd81e('0x48')],{})[_0xd81e('0x26')](respondWithResult(_0x4e61cf,0xc9))[_0xd81e('0x46')](handleError(_0x4e61cf,null));};exports[_0xd81e('0x25')]=function(_0x20b4e4,_0x500a9b){if(_0x20b4e4[_0xd81e('0x48')]['id']){delete _0x20b4e4[_0xd81e('0x48')]['id'];}return db['FreshsalesAccount'][_0xd81e('0x45')]({'where':{'id':_0x20b4e4[_0xd81e('0x44')]['id']}})[_0xd81e('0x26')](handleEntityNotFound(_0x500a9b,null))[_0xd81e('0x26')](saveUpdates(_0x20b4e4[_0xd81e('0x48')],null))['then'](respondWithResult(_0x500a9b,null))[_0xd81e('0x46')](handleError(_0x500a9b,null));};exports['destroy']=function(_0x199573,_0x29e5f1){return db[_0xd81e('0x2c')][_0xd81e('0x45')]({'where':{'id':_0x199573['params']['id']}})[_0xd81e('0x26')](handleEntityNotFound(_0x29e5f1,null))['then'](removeEntity(_0x29e5f1,null))[_0xd81e('0x46')](handleError(_0x29e5f1,null));};exports[_0xd81e('0x49')]=function(_0x2e03a3,_0x29ec58,_0x441cab){var _0x4a4f40={};var _0x1f2c32={};var _0x36beb5;var _0xdf0d65;return db['FreshsalesAccount'][_0xd81e('0x4a')]({'where':{'id':_0x2e03a3[_0xd81e('0x44')]['id']}})[_0xd81e('0x26')](handleEntityNotFound(_0x29ec58,null))[_0xd81e('0x26')](function(_0x571e37){if(_0x571e37){_0x36beb5=_0x571e37;_0x1f2c32[_0xd81e('0x30')]=_[_0xd81e('0x32')](db[_0xd81e('0x4b')][_0xd81e('0x2d')]);_0x1f2c32['query']=_[_0xd81e('0x32')](_0x2e03a3[_0xd81e('0x31')]);_0x1f2c32[_0xd81e('0x33')]=_[_0xd81e('0x35')](_0x1f2c32['model'],_0x1f2c32[_0xd81e('0x31')]);_0x4a4f40['attributes']=_[_0xd81e('0x35')](_0x1f2c32[_0xd81e('0x30')],qs[_0xd81e('0x36')](_0x2e03a3[_0xd81e('0x31')][_0xd81e('0x36')]));_0x4a4f40[_0xd81e('0x34')]=_0x4a4f40[_0xd81e('0x34')][_0xd81e('0x4c')]?_0x4a4f40[_0xd81e('0x34')]:_0x1f2c32[_0xd81e('0x30')];_0x4a4f40[_0xd81e('0x38')]=qs[_0xd81e('0x39')](_0x2e03a3[_0xd81e('0x31')][_0xd81e('0x39')]);_0x4a4f40[_0xd81e('0x3a')]=qs[_0xd81e('0x33')](_['pick'](_0x2e03a3[_0xd81e('0x31')],_0x1f2c32['filters']));if(_0x2e03a3['query'][_0xd81e('0x3d')]){_0x4a4f40[_0xd81e('0x3a')]=_[_0xd81e('0x3e')](_0x4a4f40[_0xd81e('0x3a')],{'$or':_['map'](_0x4a4f40[_0xd81e('0x34')],function(_0x38e5a1){var _0x421349={};_0x421349[_0x38e5a1]={'$like':'%'+_0x2e03a3[_0xd81e('0x31')]['filter']+'%'};return _0x421349;})});}_0x4a4f40=_[_0xd81e('0x3e')]({},_0x4a4f40,_0x2e03a3['options']);return _0x36beb5['getConfigurations'](_0x4a4f40);}})[_0xd81e('0x26')](function(_0x5c3e93){if(_0x5c3e93){_0xdf0d65=_0x5c3e93[_0xd81e('0x4c')];if(!_0x2e03a3[_0xd81e('0x31')][_0xd81e('0x37')]('nolimit')){_0x4a4f40[_0xd81e('0x1d')]=qs['limit'](_0x2e03a3[_0xd81e('0x31')][_0xd81e('0x1d')]);_0x4a4f40['offset']=qs[_0xd81e('0x1f')](_0x2e03a3[_0xd81e('0x31')]['offset']);}return _0x36beb5['getConfigurations'](_0x4a4f40);}})[_0xd81e('0x26')](function(_0x3c2c8d){if(_0x3c2c8d){return _0x3c2c8d?{'count':_0xdf0d65,'rows':_0x3c2c8d}:null;}})[_0xd81e('0x26')](respondWithResult(_0x29ec58,null))['catch'](handleError(_0x29ec58,null));};exports[_0xd81e('0x4d')]=function(_0x55db13,_0xbed3d2,_0x1f6117){if(_0x55db13[_0xd81e('0x48')]['id']){delete _0x55db13[_0xd81e('0x48')]['id'];}return db['FreshsalesAccount'][_0xd81e('0x4a')]({'where':{'id':_0x55db13[_0xd81e('0x44')]['id']}})['then'](handleEntityNotFound(_0xbed3d2,null))[_0xd81e('0x26')](function(_0x2e634d){if(_0x2e634d){_0x55db13[_0xd81e('0x48')]['AccountId']=_0x2e634d['id'];_0x55db13['body']['Subjects']=integrations[_0xd81e('0x4e')](_0x55db13['body'][_0xd81e('0x4f')],_0x55db13[_0xd81e('0x48')][_0xd81e('0x2e')]);_0x55db13[_0xd81e('0x48')][_0xd81e('0x50')]=integrations[_0xd81e('0x51')](_0x55db13[_0xd81e('0x48')][_0xd81e('0x4f')],_0x55db13[_0xd81e('0x48')][_0xd81e('0x2e')]);return db[_0xd81e('0x4b')]['create'](_0x55db13[_0xd81e('0x48')],{'include':[{'model':db['FreshsalesField'],'as':_0xd81e('0x52')},{'model':db[_0xd81e('0x53')],'as':'Descriptions'}]});}return null;})[_0xd81e('0x26')](respondWithResult(_0xbed3d2,null))[_0xd81e('0x46')](handleError(_0xbed3d2,null));};exports['getFields']=function(_0x36dd50,_0x1c106,_0x3466a0){var _0x160800='';var _0x2a4d1c='';return db[_0xd81e('0x2c')][_0xd81e('0x4a')]({'where':{'id':_0x36dd50['params']['id']},'attributes':['id',_0xd81e('0x54'),_0xd81e('0x55'),_0xd81e('0x56')]})[_0xd81e('0x26')](handleEntityNotFound(_0x1c106,null))[_0xd81e('0x26')](function(_0x52a5aa){if(_0x52a5aa){_0x2a4d1c=_0x52a5aa[_0xd81e('0x54')];_0x160800=_0x52a5aa[_0xd81e('0x55')];var _0x2c2aec=_0x52a5aa[_0xd81e('0x55')][_0xd81e('0x57')](-0x1);if(_0x2c2aec==='/'){_0x160800=_0x160800[_0xd81e('0x58')](0x0,_0x160800['lastIndexOf'](_0x2c2aec));}return rp({'method':_0xd81e('0x59'),'uri':util['format'](_0xd81e('0x5a'),_0x160800,'/api/selector/owners'),'headers':{'Authorization':_0xd81e('0x5b')+_0x52a5aa[_0xd81e('0x56')]},'json':!![]});}})[_0xd81e('0x26')](function(_0x3e2c46){if(_0x3e2c46){var _0x53a508=_0x3e2c46['users'];var _0x22fe6f=![];var _0x5d1020=null;for(_0x5d1020=0x0;_0x5d1020<_0x53a508['length'];_0x5d1020++){if(_0x53a508[_0x5d1020]['email']===_0x2a4d1c){_0x22fe6f=!![];}}if(_0x22fe6f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd81e('0x5c')});}}})[_0xd81e('0x26')](respondWithResult(_0x1c106,null))[_0xd81e('0x46')](function(_0xd362aa){var _0x2b9b12=_0x36dd50['query'][_0xd81e('0x5d')]?0x1f4:_0xd362aa[_0xd81e('0x5e')]||0x1f4;logger['error'](_0xd81e('0x5f'),'getFields',_0x2b9b12,JSON['stringify'](_0xd362aa));delete _0xd362aa[_0xd81e('0x28')];if(_0x2b9b12===0x191){_0x2b9b12=0x190;}_0x1c106[_0xd81e('0x1a')](_0x2b9b12)['send'](_0x36dd50[_0xd81e('0x31')]['test']?{'message':_0xd81e('0x60'),'statusCode':_0xd362aa[_0xd81e('0x5e')]}:_0xd362aa);});}; \ No newline at end of file +var _0x1a9d=['../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','Content-Range','reject','update','then','destroy','end','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','rows','catch','show','includeAll','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2c44aa,_0x2fd67f){var _0xa104f8=function(_0x49a05c){while(--_0x49a05c){_0x2c44aa['push'](_0x2c44aa['shift']());}};_0xa104f8(++_0x2fd67f);}(_0x1a9d,0x125));var _0xd1a9=function(_0x2ed4a1,_0x5c4525){_0x2ed4a1=_0x2ed4a1-0x0;var _0x5bfce2=_0x1a9d[_0x2ed4a1];return _0x5bfce2;};'use strict';var emlformat=require(_0xd1a9('0x0'));var rimraf=require(_0xd1a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1a9('0x2'));var rp=require(_0xd1a9('0x3'));var moment=require(_0xd1a9('0x4'));var BPromise=require(_0xd1a9('0x5'));var Mustache=require(_0xd1a9('0x6'));var util=require(_0xd1a9('0x7'));var path=require(_0xd1a9('0x8'));var sox=require(_0xd1a9('0x9'));var csv=require(_0xd1a9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1a9('0xb'));var _=require(_0xd1a9('0xc'));var squel=require(_0xd1a9('0xd'));var crypto=require(_0xd1a9('0xe'));var jsforce=require(_0xd1a9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd1a9('0x10'));var Papa=require(_0xd1a9('0x11'));var Redis=require(_0xd1a9('0x12'));var authService=require(_0xd1a9('0x13'));var qs=require(_0xd1a9('0x14'));var as=require(_0xd1a9('0x15'));var hardwareService=require(_0xd1a9('0x16'));var logger=require(_0xd1a9('0x17'))(_0xd1a9('0x18'));var utils=require(_0xd1a9('0x19'));var config=require(_0xd1a9('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd1a9('0x1b'));function respondWithStatusCode(_0x2401de,_0x4eccb3){_0x4eccb3=_0x4eccb3||0xcc;return function(_0x5e8f29){if(_0x5e8f29){return _0x2401de[_0xd1a9('0x1c')](_0x4eccb3);}return _0x2401de[_0xd1a9('0x1d')](_0x4eccb3)['end']();};}function respondWithResult(_0x5b97df,_0x63e3df){_0x63e3df=_0x63e3df||0xc8;return function(_0x10f0c7){if(_0x10f0c7){return _0x5b97df[_0xd1a9('0x1d')](_0x63e3df)[_0xd1a9('0x1e')](_0x10f0c7);}};}function respondWithFilteredResult(_0x197383,_0x17a136){return function(_0x194c82){if(_0x194c82){var _0xa0ae64=typeof _0x17a136[_0xd1a9('0x1f')]===_0xd1a9('0x20')&&typeof _0x17a136['limit']===_0xd1a9('0x20');var _0x4734d4=_0x194c82[_0xd1a9('0x21')];var _0x398e7f=_0xa0ae64?0x0:_0x17a136[_0xd1a9('0x1f')];var _0x3c42c7=_0xa0ae64?_0x194c82[_0xd1a9('0x21')]:_0x17a136[_0xd1a9('0x1f')]+_0x17a136['limit'];var _0x1edcff;if(_0x3c42c7>=_0x4734d4){_0x3c42c7=_0x4734d4;_0x1edcff=0xc8;}else{_0x1edcff=0xce;}_0x197383[_0xd1a9('0x1d')](_0x1edcff);return _0x197383['set'](_0xd1a9('0x22'),_0x398e7f+'-'+_0x3c42c7+'/'+_0x4734d4)[_0xd1a9('0x1e')](_0x194c82);}return null;};}function patchUpdates(_0x3569d2){return function(_0x31a00c){try{jsonpatch['apply'](_0x31a00c,_0x3569d2,!![]);}catch(_0x153923){return BPromise[_0xd1a9('0x23')](_0x153923);}return _0x31a00c['save']();};}function saveUpdates(_0x1ebf7a,_0x45161d){return function(_0x442877){if(_0x442877){return _0x442877[_0xd1a9('0x24')](_0x1ebf7a)[_0xd1a9('0x25')](function(_0x1acdd3){return _0x1acdd3;});}return null;};}function removeEntity(_0x4d088c,_0x4abf31){return function(_0x498434){if(_0x498434){return _0x498434[_0xd1a9('0x26')]()[_0xd1a9('0x25')](function(){_0x4d088c[_0xd1a9('0x1d')](0xcc)[_0xd1a9('0x27')]();});}};}function handleEntityNotFound(_0x52263a,_0x1458ca){return function(_0x4f159f){if(!_0x4f159f){_0x52263a['sendStatus'](0x194);}return _0x4f159f;};}function handleError(_0x4a6a59,_0x87f473){_0x87f473=_0x87f473||0x1f4;return function(_0x15ef4b){logger[_0xd1a9('0x28')](_0x15ef4b['stack']);if(_0x15ef4b[_0xd1a9('0x29')]){delete _0x15ef4b[_0xd1a9('0x29')];}_0x4a6a59[_0xd1a9('0x1d')](_0x87f473)[_0xd1a9('0x2a')](_0x15ef4b);};}exports[_0xd1a9('0x2b')]=function(_0x1aff02,_0x22699b){var _0x51c08f={},_0x36e00e={},_0x2e6025={'count':0x0,'rows':[]};var _0x3a644c=_[_0xd1a9('0x2c')](db[_0xd1a9('0x2d')][_0xd1a9('0x2e')],function(_0x4f04c6){return{'name':_0x4f04c6[_0xd1a9('0x2f')],'type':_0x4f04c6['type'][_0xd1a9('0x30')]};});_0x36e00e['model']=_[_0xd1a9('0x2c')](_0x3a644c,_0xd1a9('0x29'));_0x36e00e['query']=_[_0xd1a9('0x31')](_0x1aff02[_0xd1a9('0x32')]);_0x36e00e[_0xd1a9('0x33')]=_['intersection'](_0x36e00e['model'],_0x36e00e[_0xd1a9('0x32')]);_0x51c08f['attributes']=_[_0xd1a9('0x34')](_0x36e00e[_0xd1a9('0x35')],qs[_0xd1a9('0x36')](_0x1aff02[_0xd1a9('0x32')][_0xd1a9('0x36')]));_0x51c08f[_0xd1a9('0x37')]=_0x51c08f[_0xd1a9('0x37')][_0xd1a9('0x38')]?_0x51c08f[_0xd1a9('0x37')]:_0x36e00e[_0xd1a9('0x35')];if(!_0x1aff02[_0xd1a9('0x32')][_0xd1a9('0x39')](_0xd1a9('0x3a'))){_0x51c08f[_0xd1a9('0x3b')]=qs['limit'](_0x1aff02[_0xd1a9('0x32')][_0xd1a9('0x3b')]);_0x51c08f[_0xd1a9('0x1f')]=qs[_0xd1a9('0x1f')](_0x1aff02[_0xd1a9('0x32')]['offset']);}_0x51c08f[_0xd1a9('0x3c')]=qs[_0xd1a9('0x3d')](_0x1aff02[_0xd1a9('0x32')][_0xd1a9('0x3d')]);_0x51c08f[_0xd1a9('0x3e')]=qs[_0xd1a9('0x33')](_[_0xd1a9('0x3f')](_0x1aff02['query'],_0x36e00e[_0xd1a9('0x33')]),_0x3a644c);if(_0x1aff02['query'][_0xd1a9('0x40')]){_0x51c08f[_0xd1a9('0x3e')]=_[_0xd1a9('0x41')](_0x51c08f['where'],{'$or':_[_0xd1a9('0x2c')](_0x3a644c,function(_0x198ed8){if(_0x198ed8['type']!=='VIRTUAL'){var _0x47214e={};_0x47214e[_0x198ed8[_0xd1a9('0x29')]]={'$like':'%'+_0x1aff02['query'][_0xd1a9('0x40')]+'%'};return _0x47214e;}})});}_0x51c08f=_[_0xd1a9('0x41')]({},_0x51c08f,_0x1aff02[_0xd1a9('0x42')]);var _0x57fadd={'where':_0x51c08f[_0xd1a9('0x3e')]};return db[_0xd1a9('0x2d')]['count'](_0x57fadd)[_0xd1a9('0x25')](function(_0x490e22){_0x2e6025['count']=_0x490e22;if(_0x1aff02['query']['includeAll']){_0x51c08f['include']=[{'all':!![]}];}return db[_0xd1a9('0x2d')]['findAll'](_0x51c08f);})[_0xd1a9('0x25')](function(_0x2e2a40){_0x2e6025[_0xd1a9('0x43')]=_0x2e2a40;return _0x2e6025;})[_0xd1a9('0x25')](respondWithFilteredResult(_0x22699b,_0x51c08f))[_0xd1a9('0x44')](handleError(_0x22699b,null));};exports[_0xd1a9('0x45')]=function(_0x2603e4,_0x39df97){var _0x333dba={'raw':![],'where':{'id':_0x2603e4['params']['id']}},_0x2aa324={};_0x2aa324[_0xd1a9('0x35')]=_['keys'](db[_0xd1a9('0x2d')]['rawAttributes']);_0x2aa324[_0xd1a9('0x32')]=_['keys'](_0x2603e4[_0xd1a9('0x32')]);_0x2aa324['filters']=_['intersection'](_0x2aa324[_0xd1a9('0x35')],_0x2aa324[_0xd1a9('0x32')]);_0x333dba[_0xd1a9('0x37')]=_[_0xd1a9('0x34')](_0x2aa324[_0xd1a9('0x35')],qs['fields'](_0x2603e4[_0xd1a9('0x32')][_0xd1a9('0x36')]));_0x333dba[_0xd1a9('0x37')]=_0x333dba['attributes'][_0xd1a9('0x38')]?_0x333dba[_0xd1a9('0x37')]:_0x2aa324[_0xd1a9('0x35')];if(_0x2603e4[_0xd1a9('0x32')][_0xd1a9('0x46')]){_0x333dba['include']=[{'all':!![]}];}_0x333dba=_[_0xd1a9('0x41')]({},_0x333dba,_0x2603e4[_0xd1a9('0x42')]);return db[_0xd1a9('0x2d')][_0xd1a9('0x47')](_0x333dba)['then'](handleEntityNotFound(_0x39df97,null))[_0xd1a9('0x25')](respondWithResult(_0x39df97,null))['catch'](handleError(_0x39df97,null));};exports[_0xd1a9('0x48')]=function(_0x17c253,_0xa6ee5a){return db[_0xd1a9('0x2d')][_0xd1a9('0x48')](_0x17c253[_0xd1a9('0x49')],{})['then'](respondWithResult(_0xa6ee5a,0xc9))[_0xd1a9('0x44')](handleError(_0xa6ee5a,null));};exports[_0xd1a9('0x24')]=function(_0x3ef551,_0x44484f){if(_0x3ef551['body']['id']){delete _0x3ef551['body']['id'];}return db[_0xd1a9('0x2d')][_0xd1a9('0x47')]({'where':{'id':_0x3ef551[_0xd1a9('0x4a')]['id']}})[_0xd1a9('0x25')](handleEntityNotFound(_0x44484f,null))[_0xd1a9('0x25')](saveUpdates(_0x3ef551[_0xd1a9('0x49')],null))[_0xd1a9('0x25')](respondWithResult(_0x44484f,null))[_0xd1a9('0x44')](handleError(_0x44484f,null));};exports[_0xd1a9('0x26')]=function(_0x526cbd,_0x324758){return db[_0xd1a9('0x2d')][_0xd1a9('0x47')]({'where':{'id':_0x526cbd['params']['id']}})[_0xd1a9('0x25')](handleEntityNotFound(_0x324758,null))[_0xd1a9('0x25')](removeEntity(_0x324758,null))[_0xd1a9('0x44')](handleError(_0x324758,null));};exports[_0xd1a9('0x4b')]=function(_0x326511,_0x5321a,_0x1e7312){var _0x3f458f={};var _0x144378={};var _0x143389;var _0x20c483;return db[_0xd1a9('0x2d')][_0xd1a9('0x4c')]({'where':{'id':_0x326511[_0xd1a9('0x4a')]['id']}})[_0xd1a9('0x25')](handleEntityNotFound(_0x5321a,null))[_0xd1a9('0x25')](function(_0x425395){if(_0x425395){_0x143389=_0x425395;_0x144378[_0xd1a9('0x35')]=_[_0xd1a9('0x31')](db[_0xd1a9('0x4d')][_0xd1a9('0x2e')]);_0x144378[_0xd1a9('0x32')]=_[_0xd1a9('0x31')](_0x326511['query']);_0x144378[_0xd1a9('0x33')]=_['intersection'](_0x144378[_0xd1a9('0x35')],_0x144378[_0xd1a9('0x32')]);_0x3f458f['attributes']=_[_0xd1a9('0x34')](_0x144378[_0xd1a9('0x35')],qs['fields'](_0x326511[_0xd1a9('0x32')][_0xd1a9('0x36')]));_0x3f458f[_0xd1a9('0x37')]=_0x3f458f['attributes'][_0xd1a9('0x38')]?_0x3f458f[_0xd1a9('0x37')]:_0x144378[_0xd1a9('0x35')];_0x3f458f['order']=qs['sort'](_0x326511['query'][_0xd1a9('0x3d')]);_0x3f458f[_0xd1a9('0x3e')]=qs['filters'](_[_0xd1a9('0x3f')](_0x326511[_0xd1a9('0x32')],_0x144378['filters']));if(_0x326511['query'][_0xd1a9('0x40')]){_0x3f458f[_0xd1a9('0x3e')]=_[_0xd1a9('0x41')](_0x3f458f['where'],{'$or':_[_0xd1a9('0x2c')](_0x3f458f['attributes'],function(_0x1fb21d){var _0x4adead={};_0x4adead[_0x1fb21d]={'$like':'%'+_0x326511[_0xd1a9('0x32')][_0xd1a9('0x40')]+'%'};return _0x4adead;})});}_0x3f458f=_['merge']({},_0x3f458f,_0x326511['options']);return _0x143389[_0xd1a9('0x4b')](_0x3f458f);}})[_0xd1a9('0x25')](function(_0x1e3315){if(_0x1e3315){_0x20c483=_0x1e3315[_0xd1a9('0x38')];if(!_0x326511[_0xd1a9('0x32')][_0xd1a9('0x39')](_0xd1a9('0x3a'))){_0x3f458f['limit']=qs['limit'](_0x326511[_0xd1a9('0x32')]['limit']);_0x3f458f[_0xd1a9('0x1f')]=qs[_0xd1a9('0x1f')](_0x326511[_0xd1a9('0x32')][_0xd1a9('0x1f')]);}return _0x143389[_0xd1a9('0x4b')](_0x3f458f);}})[_0xd1a9('0x25')](function(_0x105bcf){if(_0x105bcf){return _0x105bcf?{'count':_0x20c483,'rows':_0x105bcf}:null;}})[_0xd1a9('0x25')](respondWithResult(_0x5321a,null))[_0xd1a9('0x44')](handleError(_0x5321a,null));};exports[_0xd1a9('0x4e')]=function(_0x46044a,_0x5b648a,_0x3ccd53){if(_0x46044a[_0xd1a9('0x49')]['id']){delete _0x46044a[_0xd1a9('0x49')]['id'];}return db[_0xd1a9('0x2d')][_0xd1a9('0x4c')]({'where':{'id':_0x46044a['params']['id']}})[_0xd1a9('0x25')](handleEntityNotFound(_0x5b648a,null))['then'](function(_0x233255){if(_0x233255){_0x46044a['body'][_0xd1a9('0x4f')]=_0x233255['id'];_0x46044a[_0xd1a9('0x49')][_0xd1a9('0x50')]=integrations[_0xd1a9('0x51')](_0x46044a[_0xd1a9('0x49')][_0xd1a9('0x52')],_0x46044a[_0xd1a9('0x49')][_0xd1a9('0x53')]);_0x46044a['body'][_0xd1a9('0x54')]=integrations[_0xd1a9('0x55')](_0x46044a[_0xd1a9('0x49')][_0xd1a9('0x52')],_0x46044a[_0xd1a9('0x49')][_0xd1a9('0x53')]);return db[_0xd1a9('0x4d')][_0xd1a9('0x48')](_0x46044a[_0xd1a9('0x49')],{'include':[{'model':db[_0xd1a9('0x56')],'as':_0xd1a9('0x50')},{'model':db[_0xd1a9('0x56')],'as':_0xd1a9('0x54')}]});}return null;})[_0xd1a9('0x25')](respondWithResult(_0x5b648a,null))['catch'](handleError(_0x5b648a,null));};exports['getFields']=function(_0x37ab3d,_0xaea8ed,_0x1b306e){var _0x4b95da='';var _0x82eca9='';return db[_0xd1a9('0x2d')][_0xd1a9('0x4c')]({'where':{'id':_0x37ab3d['params']['id']},'attributes':['id',_0xd1a9('0x57'),_0xd1a9('0x58'),_0xd1a9('0x59')]})[_0xd1a9('0x25')](handleEntityNotFound(_0xaea8ed,null))[_0xd1a9('0x25')](function(_0x67f943){if(_0x67f943){_0x82eca9=_0x67f943[_0xd1a9('0x57')];_0x4b95da=_0x67f943[_0xd1a9('0x58')];var _0x554029=_0x67f943[_0xd1a9('0x58')][_0xd1a9('0x5a')](-0x1);if(_0x554029==='/'){_0x4b95da=_0x4b95da[_0xd1a9('0x5b')](0x0,_0x4b95da[_0xd1a9('0x5c')](_0x554029));}return rp({'method':_0xd1a9('0x5d'),'uri':util[_0xd1a9('0x5e')](_0xd1a9('0x5f'),_0x4b95da,_0xd1a9('0x60')),'headers':{'Authorization':_0xd1a9('0x61')+_0x67f943[_0xd1a9('0x59')]},'json':!![]});}})[_0xd1a9('0x25')](function(_0x3151c2){if(_0x3151c2){var _0x221c96=_0x3151c2[_0xd1a9('0x62')];var _0x3c6d8d=![];var _0x447793=null;for(_0x447793=0x0;_0x447793<_0x221c96[_0xd1a9('0x38')];_0x447793++){if(_0x221c96[_0x447793][_0xd1a9('0x63')]===_0x82eca9){_0x3c6d8d=!![];}}if(_0x3c6d8d){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xd1a9('0x25')](respondWithResult(_0xaea8ed,null))['catch'](function(_0x3d00c9){var _0x486cbf=_0x37ab3d['query']['test']?0x1f4:_0x3d00c9[_0xd1a9('0x64')]||0x1f4;logger[_0xd1a9('0x28')](_0xd1a9('0x65'),_0xd1a9('0x66'),_0x486cbf,JSON[_0xd1a9('0x67')](_0x3d00c9));delete _0x3d00c9['name'];if(_0x486cbf===0x191){_0x486cbf=0x190;}_0xaea8ed[_0xd1a9('0x1d')](_0x486cbf)['send'](_0x37ab3d[_0xd1a9('0x32')][_0xd1a9('0x68')]?{'message':_0xd1a9('0x69'),'statusCode':_0x3d00c9['statusCode']}:_0x3d00c9);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ae43e23..8731470 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 _0x1623=['path','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x52b906,_0x4a7b0e){var _0x28fd35=function(_0x2c82bc){while(--_0x2c82bc){_0x52b906['push'](_0x52b906['shift']());}};_0x28fd35(++_0x4a7b0e);}(_0x1623,0xab));var _0x3162=function(_0x56d9ed,_0x137d67){_0x56d9ed=_0x56d9ed-0x0;var _0x46a3ac=_0x1623[_0x56d9ed];return _0x46a3ac;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3162('0x7')]=function(_0x428de6,_0x53260d){return _0x428de6[_0x3162('0x8')](_0x3162('0x9'),attributes,{'tableName':_0x3162('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x391577,_0x5ebbac){var _0x73cb93=function(_0x1601bb){while(--_0x1601bb){_0x391577['push'](_0x391577['shift']());}};_0x73cb93(++_0x5ebbac);}(_0x323f,0x1ee));var _0xf323=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x323f[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));var integrations=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x5d7d60,_0xb9a667){return _0x5d7d60[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'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 e708b5e..509efc1 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 _0x187d=['error','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','include','model','find','where','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x488c2f,_0x141ae6){var _0x535b0c=function(_0x5c175e){while(--_0x5c175e){_0x488c2f['push'](_0x488c2f['shift']());}};_0x535b0c(++_0x141ae6);}(_0x187d,0x93));var _0xd187=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x187d[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}exports[_0xd187('0x15')]=function(_0x374fe0){var _0x10d9fd=this;return new Promise(function(_0x21df74,_0x253a7e){return db[_0xd187('0x16')][_0xd187('0x17')]({'raw':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![],'where':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')]['where']||null:null,'attributes':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'limit':_0x374fe0['options']?_0x374fe0['options']['limit']||null:null,'include':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1b')]?_['map'](_0x374fe0[_0xd187('0x18')]['include'],function(_0x145771){return{'model':db[_0x145771['model']],'as':_0x145771['as'],'attributes':_0x145771[_0xd187('0x1a')],'include':_0x145771['include']?_['map'](_0x145771[_0xd187('0x1b')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x1c')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1a')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x1b')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x1c')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a20ed){logger[_0xd187('0xc')]('GetFreshsalesAccount',_0x374fe0);logger[_0xd187('0xf')](_0xd187('0x15'),_0x374fe0,JSON[_0xd187('0x11')](_0x2a20ed));_0x21df74(_0x2a20ed);})['catch'](function(_0x15e2e8){logger['error'](_0xd187('0x15'),_0x15e2e8[_0xd187('0x13')],_0x374fe0);_0x253a7e(_0x10d9fd[_0xd187('0x12')](0x1f4,_0x15e2e8[_0xd187('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x140e54){var _0xb38778=this;return new Promise(function(_0x5bba10,_0x4cc587){return db[_0xd187('0x16')][_0xd187('0x1d')]({'raw':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![],'where':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x1e')]||null:null,'attributes':_0x140e54['options']?_0x140e54[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'include':_0x140e54[_0xd187('0x18')]?_0x140e54['options'][_0xd187('0x1b')]?_['map'](_0x140e54[_0xd187('0x18')][_0xd187('0x1b')],function(_0xf5b94e){return{'model':db[_0xf5b94e['model']],'as':_0xf5b94e['as'],'attributes':_0xf5b94e['attributes'],'include':_0xf5b94e[_0xd187('0x1b')]?_[_0xd187('0x1f')](_0xf5b94e['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x1c')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1a')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x1b')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d7f4){logger['info'](_0xd187('0x20'),_0x140e54);logger[_0xd187('0xf')]('ShowFreshsalesAccount',_0x140e54,JSON[_0xd187('0x11')](_0x31d7f4));_0x5bba10(_0x31d7f4);})['catch'](function(_0x293ce9){logger[_0xd187('0x12')]('ShowFreshsalesAccount',_0x293ce9[_0xd187('0x13')],_0x140e54);_0x4cc587(_0xb38778[_0xd187('0x12')](0x1f4,_0x293ce9['message']));});});}; \ No newline at end of file +var _0x524e=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshsalesAccount','catch','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45587e,_0x2e0c81){var _0x1855aa=function(_0x24bd9a){while(--_0x24bd9a){_0x45587e['push'](_0x45587e['shift']());}};_0x1855aa(++_0x2e0c81);}(_0x524e,0x15e));var _0xe524=function(_0x178a56,_0x58ca71){_0x178a56=_0x178a56-0x0;var _0x346677=_0x524e[_0x178a56];return _0x346677;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['GetFreshsalesAccount']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')]({'raw':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]===undefined?!![]:![]:!![],'where':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1c')]||null:null,'include':_0x3a4027[_0xe524('0x18')]?_0x3a4027['options'][_0xe524('0x1d')]?_['map'](_0x3a4027['options'][_0xe524('0x1d')],function(_0x23df5e){return{'model':db[_0x23df5e[_0xe524('0x1e')]],'as':_0x23df5e['as'],'attributes':_0x23df5e[_0xe524('0x1b')],'include':_0x23df5e['include']?_[_0xe524('0x1f')](_0x23df5e['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x1e')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1b')],'include':_0x17e245[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x17e245[_0xe524('0x1d')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x45abad){logger[_0xe524('0xd')](_0xe524('0x20'),_0x3a4027);logger[_0xe524('0x10')]('GetFreshsalesAccount',_0x3a4027,JSON['stringify'](_0x45abad));_0x11b2a1(_0x45abad);})[_0xe524('0x21')](function(_0x25e7a7){logger[_0xe524('0x13')](_0xe524('0x20'),_0x25e7a7[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb['error'](0x1f4,_0x25e7a7[_0xe524('0x15')]));});});};exports[_0xe524('0x22')]=function(_0x4a4e15){var _0x5b7ded=this;return new Promise(function(_0x20688e,_0x376324){return db['FreshsalesAccount'][_0xe524('0x23')]({'raw':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['attributes']||null:null,'include':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')]?_['map'](_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')],function(_0x49c43e){return{'model':db[_0x49c43e[_0xe524('0x1e')]],'as':_0x49c43e['as'],'attributes':_0x49c43e[_0xe524('0x1b')],'include':_0x49c43e[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x49c43e['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x1e')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1b')],'include':_0x415450[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x415450[_0xe524('0x1d')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x1e')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x56f371){logger[_0xe524('0xd')](_0xe524('0x22'),_0x4a4e15);logger['debug'](_0xe524('0x22'),_0x4a4e15,JSON['stringify'](_0x56f371));_0x20688e(_0x56f371);})[_0xe524('0x21')](function(_0x41af26){logger[_0xe524('0x13')](_0xe524('0x22'),_0x41af26[_0xe524('0x15')],_0x4a4e15);_0x376324(_0x5b7ded[_0xe524('0x13')](0x1f4,_0x41af26[_0xe524('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2a1efb7..7006674 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 _0xf5ca=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','destroy','exports','multer'];(function(_0x5dda9c,_0x296b90){var _0x4afe1d=function(_0x344248){while(--_0x344248){_0x5dda9c['push'](_0x5dda9c['shift']());}};_0x4afe1d(++_0x296b90);}(_0xf5ca,0x137));var _0xaf5c=function(_0x252834,_0x55f763){_0x252834=_0x252834-0x0;var _0x58c864=_0xf5ca[_0x252834];return _0x58c864;};'use strict';var multer=require(_0xaf5c('0x0'));var util=require(_0xaf5c('0x1'));var path=require(_0xaf5c('0x2'));var timeout=require(_0xaf5c('0x3'));var express=require(_0xaf5c('0x4'));var router=express[_0xaf5c('0x5')]();var fs_extra=require(_0xaf5c('0x6'));var auth=require(_0xaf5c('0x7'));var interaction=require(_0xaf5c('0x8'));var config=require(_0xaf5c('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xaf5c('0xa')]('/',auth[_0xaf5c('0xb')](),controller[_0xaf5c('0xc')]);router[_0xaf5c('0xa')](_0xaf5c('0xd'),auth[_0xaf5c('0xb')](),controller[_0xaf5c('0xe')]);router[_0xaf5c('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaf5c('0xf')]);router['get'](_0xaf5c('0x10'),auth['isAuthenticated'](),controller[_0xaf5c('0x11')]);router[_0xaf5c('0xa')](_0xaf5c('0x12'),auth[_0xaf5c('0xb')](),controller[_0xaf5c('0x13')]);router[_0xaf5c('0x14')]('/',auth[_0xaf5c('0xb')](),controller['create']);router['put'](_0xaf5c('0xd'),auth['isAuthenticated'](),controller[_0xaf5c('0x15')]);router['delete'](_0xaf5c('0xd'),auth['isAuthenticated'](),controller[_0xaf5c('0x16')]);module[_0xaf5c('0x17')]=router; \ No newline at end of file +var _0x8506=['isAuthenticated','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x5e491d,_0x5286d0){var _0x2f1946=function(_0x5acf08){while(--_0x5acf08){_0x5e491d['push'](_0x5e491d['shift']());}};_0x2f1946(++_0x5286d0);}(_0x8506,0xff));var _0x6850=function(_0xcefe6a,_0x24c89d){_0xcefe6a=_0xcefe6a-0x0;var _0x4f8724=_0x8506[_0xcefe6a];return _0x4f8724;};'use strict';var multer=require('multer');var util=require(_0x6850('0x0'));var path=require(_0x6850('0x1'));var timeout=require(_0x6850('0x2'));var express=require(_0x6850('0x3'));var router=express[_0x6850('0x4')]();var fs_extra=require(_0x6850('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6850('0x6'));var config=require(_0x6850('0x7'));var controller=require(_0x6850('0x8'));router['get']('/',auth[_0x6850('0x9')](),controller['index']);router[_0x6850('0xa')](_0x6850('0xb'),auth[_0x6850('0x9')](),controller[_0x6850('0xc')]);router[_0x6850('0xa')](_0x6850('0xd'),auth['isAuthenticated'](),controller[_0x6850('0xe')]);router[_0x6850('0xa')](_0x6850('0xf'),auth[_0x6850('0x9')](),controller['getDescriptions']);router[_0x6850('0xa')]('/:id/fields',auth[_0x6850('0x9')](),controller[_0x6850('0x10')]);router[_0x6850('0x11')]('/',auth[_0x6850('0x9')](),controller['create']);router[_0x6850('0x12')]('/:id',auth[_0x6850('0x9')](),controller[_0x6850('0x13')]);router[_0x6850('0x14')](_0x6850('0xb'),auth[_0x6850('0x9')](),controller[_0x6850('0x15')]);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 9cabbaa..58af7dc 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 _0x15fe=['exports','STRING','sequelize'];(function(_0x543e36,_0x3d007a){var _0x3b3f69=function(_0x1139a3){while(--_0x1139a3){_0x543e36['push'](_0x543e36['shift']());}};_0x3b3f69(++_0x3d007a);}(_0x15fe,0xfe));var _0xe15f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe15f('0x0'));module[_0xe15f('0x1')]={'name':{'type':Sequelize[_0xe15f('0x2')]},'description':{'type':Sequelize[_0xe15f('0x2')]}}; \ No newline at end of file +var _0xba5f=['exports','STRING'];(function(_0x1ed0fa,_0x724abd){var _0x3371fa=function(_0x3e40e8){while(--_0x3e40e8){_0x1ed0fa['push'](_0x1ed0fa['shift']());}};_0x3371fa(++_0x724abd);}(_0xba5f,0x1ee));var _0xfba5=function(_0xe5f300,_0x14feeb){_0xe5f300=_0xe5f300-0x0;var _0x1f9545=_0xba5f[_0xe5f300];return _0x1f9545;};'use strict';var Sequelize=require('sequelize');module[_0xfba5('0x0')]={'name':{'type':Sequelize[_0xfba5('0x1')]},'description':{'type':Sequelize[_0xfba5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index dfa4270..0f69075 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 _0x87a3=['sort','where','pick','filters','filter','VIRTUAL','merge','FreshsalesConfiguration','includeAll','include','rows','catch','show','params','options','find','create','body','update','getSubjects','findOne','FreshsalesField','order','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xe2b14f,_0x3fc668){var _0x548ce1=function(_0x41b7bc){while(--_0x41b7bc){_0xe2b14f['push'](_0xe2b14f['shift']());}};_0x548ce1(++_0x3fc668);}(_0x87a3,0x1f2));var _0x387a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x87a3[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0x387a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x387a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x387a('0x2'));var moment=require(_0x387a('0x3'));var BPromise=require(_0x387a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x387a('0x5'));var sox=require(_0x387a('0x6'));var csv=require(_0x387a('0x7'));var ejs=require(_0x387a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x387a('0x9'));var crypto=require(_0x387a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x387a('0xb'));var toCsv=require(_0x387a('0x7'));var querystring=require(_0x387a('0xc'));var Papa=require('papaparse');var Redis=require(_0x387a('0xd'));var authService=require(_0x387a('0xe'));var qs=require(_0x387a('0xf'));var as=require(_0x387a('0x10'));var hardwareService=require(_0x387a('0x11'));var logger=require(_0x387a('0x12'))(_0x387a('0x13'));var utils=require(_0x387a('0x14'));var config=require(_0x387a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x387a('0x16'))['db'];function respondWithStatusCode(_0x58421a,_0x268df9){_0x268df9=_0x268df9||0xcc;return function(_0x242116){if(_0x242116){return _0x58421a[_0x387a('0x17')](_0x268df9);}return _0x58421a['status'](_0x268df9)['end']();};}function respondWithResult(_0x363c56,_0x470631){_0x470631=_0x470631||0xc8;return function(_0x5bb097){if(_0x5bb097){return _0x363c56[_0x387a('0x18')](_0x470631)[_0x387a('0x19')](_0x5bb097);}};}function respondWithFilteredResult(_0x184f5b,_0x6ec2d2){return function(_0x3c92c2){if(_0x3c92c2){var _0x4bb3c6=typeof _0x6ec2d2[_0x387a('0x1a')]===_0x387a('0x1b')&&typeof _0x6ec2d2[_0x387a('0x1c')]==='undefined';var _0x50d5ab=_0x3c92c2[_0x387a('0x1d')];var _0x5061f0=_0x4bb3c6?0x0:_0x6ec2d2[_0x387a('0x1a')];var _0x52fa23=_0x4bb3c6?_0x3c92c2[_0x387a('0x1d')]:_0x6ec2d2['offset']+_0x6ec2d2['limit'];var _0x4bdf9d;if(_0x52fa23>=_0x50d5ab){_0x52fa23=_0x50d5ab;_0x4bdf9d=0xc8;}else{_0x4bdf9d=0xce;}_0x184f5b[_0x387a('0x18')](_0x4bdf9d);return _0x184f5b[_0x387a('0x1e')](_0x387a('0x1f'),_0x5061f0+'-'+_0x52fa23+'/'+_0x50d5ab)['json'](_0x3c92c2);}return null;};}function patchUpdates(_0x2324a6){return function(_0x59991a){try{jsonpatch[_0x387a('0x20')](_0x59991a,_0x2324a6,!![]);}catch(_0x2f2e09){return BPromise[_0x387a('0x21')](_0x2f2e09);}return _0x59991a[_0x387a('0x22')]();};}function saveUpdates(_0xd88f3d,_0x1322ce){return function(_0x259b44){if(_0x259b44){return _0x259b44['update'](_0xd88f3d)[_0x387a('0x23')](function(_0x262cca){return _0x262cca;});}return null;};}function removeEntity(_0x192182,_0xbb2c49){return function(_0x2104e6){if(_0x2104e6){return _0x2104e6[_0x387a('0x24')]()[_0x387a('0x23')](function(){_0x192182[_0x387a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3156c1,_0x42b435){return function(_0x3f3870){if(!_0x3f3870){_0x3156c1[_0x387a('0x17')](0x194);}return _0x3f3870;};}function handleError(_0x429796,_0x47697e){_0x47697e=_0x47697e||0x1f4;return function(_0x525b52){logger[_0x387a('0x25')](_0x525b52[_0x387a('0x26')]);if(_0x525b52[_0x387a('0x27')]){delete _0x525b52['name'];}_0x429796['status'](_0x47697e)[_0x387a('0x28')](_0x525b52);};}exports['index']=function(_0x2dcbcf,_0x38f4f2){var _0x4b4de6={},_0x22618d={},_0xc440f5={'count':0x0,'rows':[]};var _0x167af5=_[_0x387a('0x29')](db['FreshsalesConfiguration'][_0x387a('0x2a')],function(_0x29c31e){return{'name':_0x29c31e[_0x387a('0x2b')],'type':_0x29c31e[_0x387a('0x2c')][_0x387a('0x2d')]};});_0x22618d[_0x387a('0x2e')]=_[_0x387a('0x29')](_0x167af5,_0x387a('0x27'));_0x22618d[_0x387a('0x2f')]=_[_0x387a('0x30')](_0x2dcbcf['query']);_0x22618d['filters']=_[_0x387a('0x31')](_0x22618d[_0x387a('0x2e')],_0x22618d[_0x387a('0x2f')]);_0x4b4de6[_0x387a('0x32')]=_['intersection'](_0x22618d[_0x387a('0x2e')],qs['fields'](_0x2dcbcf[_0x387a('0x2f')][_0x387a('0x33')]));_0x4b4de6[_0x387a('0x32')]=_0x4b4de6[_0x387a('0x32')][_0x387a('0x34')]?_0x4b4de6['attributes']:_0x22618d[_0x387a('0x2e')];if(!_0x2dcbcf[_0x387a('0x2f')][_0x387a('0x35')](_0x387a('0x36'))){_0x4b4de6[_0x387a('0x1c')]=qs[_0x387a('0x1c')](_0x2dcbcf[_0x387a('0x2f')][_0x387a('0x1c')]);_0x4b4de6[_0x387a('0x1a')]=qs[_0x387a('0x1a')](_0x2dcbcf[_0x387a('0x2f')][_0x387a('0x1a')]);}_0x4b4de6['order']=qs['sort'](_0x2dcbcf[_0x387a('0x2f')][_0x387a('0x37')]);_0x4b4de6[_0x387a('0x38')]=qs['filters'](_[_0x387a('0x39')](_0x2dcbcf[_0x387a('0x2f')],_0x22618d[_0x387a('0x3a')]),_0x167af5);if(_0x2dcbcf['query'][_0x387a('0x3b')]){_0x4b4de6['where']=_['merge'](_0x4b4de6['where'],{'$or':_[_0x387a('0x29')](_0x167af5,function(_0x5778de){if(_0x5778de[_0x387a('0x2c')]!==_0x387a('0x3c')){var _0x55bdeb={};_0x55bdeb[_0x5778de[_0x387a('0x27')]]={'$like':'%'+_0x2dcbcf[_0x387a('0x2f')][_0x387a('0x3b')]+'%'};return _0x55bdeb;}})});}_0x4b4de6=_[_0x387a('0x3d')]({},_0x4b4de6,_0x2dcbcf['options']);var _0x1279f6={'where':_0x4b4de6['where']};return db[_0x387a('0x3e')][_0x387a('0x1d')](_0x1279f6)[_0x387a('0x23')](function(_0x4e17e4){_0xc440f5[_0x387a('0x1d')]=_0x4e17e4;if(_0x2dcbcf[_0x387a('0x2f')][_0x387a('0x3f')]){_0x4b4de6[_0x387a('0x40')]=[{'all':!![]}];}return db[_0x387a('0x3e')]['findAll'](_0x4b4de6);})[_0x387a('0x23')](function(_0x4ecb99){_0xc440f5[_0x387a('0x41')]=_0x4ecb99;return _0xc440f5;})[_0x387a('0x23')](respondWithFilteredResult(_0x38f4f2,_0x4b4de6))[_0x387a('0x42')](handleError(_0x38f4f2,null));};exports[_0x387a('0x43')]=function(_0x54e7a4,_0x795435){var _0x282885={'raw':![],'where':{'id':_0x54e7a4[_0x387a('0x44')]['id']}},_0x4b5d44={};_0x4b5d44[_0x387a('0x2e')]=_[_0x387a('0x30')](db[_0x387a('0x3e')][_0x387a('0x2a')]);_0x4b5d44[_0x387a('0x2f')]=_[_0x387a('0x30')](_0x54e7a4['query']);_0x4b5d44[_0x387a('0x3a')]=_[_0x387a('0x31')](_0x4b5d44['model'],_0x4b5d44['query']);_0x282885[_0x387a('0x32')]=_['intersection'](_0x4b5d44[_0x387a('0x2e')],qs[_0x387a('0x33')](_0x54e7a4['query'][_0x387a('0x33')]));_0x282885[_0x387a('0x32')]=_0x282885[_0x387a('0x32')]['length']?_0x282885[_0x387a('0x32')]:_0x4b5d44[_0x387a('0x2e')];if(_0x54e7a4[_0x387a('0x2f')]['includeAll']){_0x282885[_0x387a('0x40')]=[{'all':!![]}];}_0x282885=_['merge']({},_0x282885,_0x54e7a4[_0x387a('0x45')]);return db[_0x387a('0x3e')][_0x387a('0x46')](_0x282885)[_0x387a('0x23')](handleEntityNotFound(_0x795435,null))['then'](respondWithResult(_0x795435,null))[_0x387a('0x42')](handleError(_0x795435,null));};exports[_0x387a('0x47')]=function(_0x51eb95,_0x2950fc){return db['FreshsalesConfiguration'][_0x387a('0x47')](_0x51eb95[_0x387a('0x48')],{})[_0x387a('0x23')](respondWithResult(_0x2950fc,0xc9))['catch'](handleError(_0x2950fc,null));};exports[_0x387a('0x49')]=function(_0x4131aa,_0x3579e5){if(_0x4131aa[_0x387a('0x48')]['id']){delete _0x4131aa[_0x387a('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x387a('0x46')]({'where':{'id':_0x4131aa['params']['id']}})['then'](handleEntityNotFound(_0x3579e5,null))['then'](saveUpdates(_0x4131aa[_0x387a('0x48')],null))[_0x387a('0x23')](respondWithResult(_0x3579e5,null))[_0x387a('0x42')](handleError(_0x3579e5,null));};exports[_0x387a('0x24')]=function(_0x37acf5,_0x50a0ac){return db[_0x387a('0x3e')][_0x387a('0x46')]({'where':{'id':_0x37acf5['params']['id']}})[_0x387a('0x23')](handleEntityNotFound(_0x50a0ac,null))[_0x387a('0x23')](removeEntity(_0x50a0ac,null))[_0x387a('0x42')](handleError(_0x50a0ac,null));};exports[_0x387a('0x4a')]=function(_0x1146ba,_0x25beb2,_0x43feb5){var _0xca8a9f={};var _0x184ec3={};var _0x39b106;var _0x507968;return db[_0x387a('0x3e')][_0x387a('0x4b')]({'where':{'id':_0x1146ba[_0x387a('0x44')]['id']}})['then'](handleEntityNotFound(_0x25beb2,null))[_0x387a('0x23')](function(_0x20af2e){if(_0x20af2e){_0x39b106=_0x20af2e;_0x184ec3['model']=_[_0x387a('0x30')](db[_0x387a('0x4c')]['rawAttributes']);_0x184ec3[_0x387a('0x2f')]=_[_0x387a('0x30')](_0x1146ba[_0x387a('0x2f')]);_0x184ec3['filters']=_[_0x387a('0x31')](_0x184ec3[_0x387a('0x2e')],_0x184ec3['query']);_0xca8a9f[_0x387a('0x32')]=_['intersection'](_0x184ec3['model'],qs['fields'](_0x1146ba[_0x387a('0x2f')]['fields']));_0xca8a9f['attributes']=_0xca8a9f[_0x387a('0x32')][_0x387a('0x34')]?_0xca8a9f[_0x387a('0x32')]:_0x184ec3[_0x387a('0x2e')];_0xca8a9f[_0x387a('0x4d')]=qs[_0x387a('0x37')](_0x1146ba[_0x387a('0x2f')][_0x387a('0x37')]);_0xca8a9f[_0x387a('0x38')]=qs[_0x387a('0x3a')](_[_0x387a('0x39')](_0x1146ba[_0x387a('0x2f')],_0x184ec3[_0x387a('0x3a')]));if(_0x1146ba[_0x387a('0x2f')][_0x387a('0x3b')]){_0xca8a9f[_0x387a('0x38')]=_[_0x387a('0x3d')](_0xca8a9f[_0x387a('0x38')],{'$or':_['map'](_0xca8a9f[_0x387a('0x32')],function(_0x394a62){var _0x5d844f={};_0x5d844f[_0x394a62]={'$like':'%'+_0x1146ba[_0x387a('0x2f')][_0x387a('0x3b')]+'%'};return _0x5d844f;})});}_0xca8a9f=_['merge']({},_0xca8a9f,_0x1146ba[_0x387a('0x45')]);return _0x39b106[_0x387a('0x4a')](_0xca8a9f);}})[_0x387a('0x23')](function(_0x18bfaf){if(_0x18bfaf){_0x507968=_0x18bfaf[_0x387a('0x34')];if(!_0x1146ba[_0x387a('0x2f')]['hasOwnProperty'](_0x387a('0x36'))){_0xca8a9f[_0x387a('0x1c')]=qs[_0x387a('0x1c')](_0x1146ba[_0x387a('0x2f')]['limit']);_0xca8a9f[_0x387a('0x1a')]=qs[_0x387a('0x1a')](_0x1146ba[_0x387a('0x2f')][_0x387a('0x1a')]);}return _0x39b106[_0x387a('0x4a')](_0xca8a9f);}})[_0x387a('0x23')](function(_0x439bdf){if(_0x439bdf){return _0x439bdf?{'count':_0x507968,'rows':_0x439bdf}:null;}})['then'](respondWithResult(_0x25beb2,null))[_0x387a('0x42')](handleError(_0x25beb2,null));};exports[_0x387a('0x4e')]=function(_0x5cb4aa,_0x41d4d8,_0x369be7){var _0x5bb6e={};var _0x497485={};var _0x41903e;var _0xb4269c;return db['FreshsalesConfiguration'][_0x387a('0x4b')]({'where':{'id':_0x5cb4aa['params']['id']}})[_0x387a('0x23')](handleEntityNotFound(_0x41d4d8,null))['then'](function(_0x174726){if(_0x174726){_0x41903e=_0x174726;_0x497485[_0x387a('0x2e')]=_[_0x387a('0x30')](db[_0x387a('0x4c')][_0x387a('0x2a')]);_0x497485['query']=_['keys'](_0x5cb4aa[_0x387a('0x2f')]);_0x497485[_0x387a('0x3a')]=_[_0x387a('0x31')](_0x497485[_0x387a('0x2e')],_0x497485['query']);_0x5bb6e[_0x387a('0x32')]=_['intersection'](_0x497485[_0x387a('0x2e')],qs['fields'](_0x5cb4aa[_0x387a('0x2f')][_0x387a('0x33')]));_0x5bb6e['attributes']=_0x5bb6e['attributes'][_0x387a('0x34')]?_0x5bb6e[_0x387a('0x32')]:_0x497485[_0x387a('0x2e')];_0x5bb6e[_0x387a('0x4d')]=qs['sort'](_0x5cb4aa['query'][_0x387a('0x37')]);_0x5bb6e[_0x387a('0x38')]=qs[_0x387a('0x3a')](_[_0x387a('0x39')](_0x5cb4aa[_0x387a('0x2f')],_0x497485[_0x387a('0x3a')]));if(_0x5cb4aa[_0x387a('0x2f')][_0x387a('0x3b')]){_0x5bb6e[_0x387a('0x38')]=_[_0x387a('0x3d')](_0x5bb6e[_0x387a('0x38')],{'$or':_[_0x387a('0x29')](_0x5bb6e[_0x387a('0x32')],function(_0x1ae763){var _0x46a51a={};_0x46a51a[_0x1ae763]={'$like':'%'+_0x5cb4aa['query']['filter']+'%'};return _0x46a51a;})});}_0x5bb6e=_['merge']({},_0x5bb6e,_0x5cb4aa[_0x387a('0x45')]);return _0x41903e[_0x387a('0x4e')](_0x5bb6e);}})[_0x387a('0x23')](function(_0xf6d7b3){if(_0xf6d7b3){_0xb4269c=_0xf6d7b3[_0x387a('0x34')];if(!_0x5cb4aa[_0x387a('0x2f')]['hasOwnProperty'](_0x387a('0x36'))){_0x5bb6e[_0x387a('0x1c')]=qs[_0x387a('0x1c')](_0x5cb4aa[_0x387a('0x2f')][_0x387a('0x1c')]);_0x5bb6e[_0x387a('0x1a')]=qs['offset'](_0x5cb4aa['query'][_0x387a('0x1a')]);}return _0x41903e[_0x387a('0x4e')](_0x5bb6e);}})[_0x387a('0x23')](function(_0x452571){if(_0x452571){return _0x452571?{'count':_0xb4269c,'rows':_0x452571}:null;}})['then'](respondWithResult(_0x41d4d8,null))[_0x387a('0x42')](handleError(_0x41d4d8,null));};exports['getFields']=function(_0x3c5d61,_0x512668,_0x55fa26){var _0x461aab={};var _0x48e896={};var _0x253832;var _0x1479e7;return db['FreshsalesConfiguration'][_0x387a('0x4b')]({'where':{'id':_0x3c5d61[_0x387a('0x44')]['id']}})['then'](handleEntityNotFound(_0x512668,null))[_0x387a('0x23')](function(_0x3b4e74){if(_0x3b4e74){_0x253832=_0x3b4e74;_0x48e896[_0x387a('0x2e')]=_['keys'](db['FreshsalesField'][_0x387a('0x2a')]);_0x48e896[_0x387a('0x2f')]=_[_0x387a('0x30')](_0x3c5d61[_0x387a('0x2f')]);_0x48e896[_0x387a('0x3a')]=_[_0x387a('0x31')](_0x48e896[_0x387a('0x2e')],_0x48e896['query']);_0x461aab['attributes']=_['intersection'](_0x48e896['model'],qs[_0x387a('0x33')](_0x3c5d61[_0x387a('0x2f')][_0x387a('0x33')]));_0x461aab['attributes']=_0x461aab[_0x387a('0x32')][_0x387a('0x34')]?_0x461aab[_0x387a('0x32')]:_0x48e896[_0x387a('0x2e')];_0x461aab[_0x387a('0x4d')]=qs['sort'](_0x3c5d61['query'][_0x387a('0x37')]);_0x461aab[_0x387a('0x38')]=qs['filters'](_[_0x387a('0x39')](_0x3c5d61[_0x387a('0x2f')],_0x48e896['filters']));if(_0x3c5d61[_0x387a('0x2f')][_0x387a('0x3b')]){_0x461aab[_0x387a('0x38')]=_[_0x387a('0x3d')](_0x461aab[_0x387a('0x38')],{'$or':_[_0x387a('0x29')](_0x461aab[_0x387a('0x32')],function(_0x2f0577){var _0x269c14={};_0x269c14[_0x2f0577]={'$like':'%'+_0x3c5d61[_0x387a('0x2f')][_0x387a('0x3b')]+'%'};return _0x269c14;})});}_0x461aab=_[_0x387a('0x3d')]({},_0x461aab,_0x3c5d61[_0x387a('0x45')]);return _0x253832['getFields'](_0x461aab);}})['then'](function(_0x3784b2){if(_0x3784b2){_0x1479e7=_0x3784b2[_0x387a('0x34')];if(!_0x3c5d61[_0x387a('0x2f')][_0x387a('0x35')](_0x387a('0x36'))){_0x461aab[_0x387a('0x1c')]=qs[_0x387a('0x1c')](_0x3c5d61[_0x387a('0x2f')][_0x387a('0x1c')]);_0x461aab[_0x387a('0x1a')]=qs['offset'](_0x3c5d61['query'][_0x387a('0x1a')]);}return _0x253832['getFields'](_0x461aab);}})[_0x387a('0x23')](function(_0x2603e7){if(_0x2603e7){return _0x2603e7?{'count':_0x1479e7,'rows':_0x2603e7}:null;}})[_0x387a('0x23')](respondWithResult(_0x512668,null))[_0x387a('0x42')](handleError(_0x512668,null));}; \ No newline at end of file +var _0x692e=['count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','name','send','FreshsalesConfiguration','rawAttributes','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','include','findAll','catch','show','params','keys','length','includeAll','options','find','create','body','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x692e,0x1c0));var _0xe692=function(_0x48f1ff,_0x2cf5ae){_0x48f1ff=_0x48f1ff-0x0;var _0x125048=_0x692e[_0x48f1ff];return _0x125048;};'use strict';var emlformat=require(_0xe692('0x0'));var rimraf=require(_0xe692('0x1'));var zipdir=require(_0xe692('0x2'));var jsonpatch=require(_0xe692('0x3'));var rp=require(_0xe692('0x4'));var moment=require(_0xe692('0x5'));var BPromise=require(_0xe692('0x6'));var Mustache=require(_0xe692('0x7'));var util=require(_0xe692('0x8'));var path=require(_0xe692('0x9'));var sox=require(_0xe692('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe692('0xb'));var squel=require(_0xe692('0xc'));var crypto=require(_0xe692('0xd'));var jsforce=require(_0xe692('0xe'));var deskjs=require(_0xe692('0xf'));var toCsv=require(_0xe692('0x10'));var querystring=require(_0xe692('0x11'));var Papa=require('papaparse');var Redis=require(_0xe692('0x12'));var authService=require(_0xe692('0x13'));var qs=require(_0xe692('0x14'));var as=require(_0xe692('0x15'));var hardwareService=require(_0xe692('0x16'));var logger=require(_0xe692('0x17'))(_0xe692('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe692('0x19'));var db=require(_0xe692('0x1a'))['db'];function respondWithStatusCode(_0x442122,_0x5a453e){_0x5a453e=_0x5a453e||0xcc;return function(_0x12e8b){if(_0x12e8b){return _0x442122['sendStatus'](_0x5a453e);}return _0x442122[_0xe692('0x1b')](_0x5a453e)['end']();};}function respondWithResult(_0x326424,_0x2588fd){_0x2588fd=_0x2588fd||0xc8;return function(_0x331fcf){if(_0x331fcf){return _0x326424['status'](_0x2588fd)[_0xe692('0x1c')](_0x331fcf);}};}function respondWithFilteredResult(_0x55e482,_0x4ed424){return function(_0x250cbf){if(_0x250cbf){var _0x42a60f=typeof _0x4ed424[_0xe692('0x1d')]==='undefined'&&typeof _0x4ed424[_0xe692('0x1e')]===_0xe692('0x1f');var _0xfaef30=_0x250cbf[_0xe692('0x20')];var _0x3a5887=_0x42a60f?0x0:_0x4ed424['offset'];var _0x4cb5e4=_0x42a60f?_0x250cbf[_0xe692('0x20')]:_0x4ed424[_0xe692('0x1d')]+_0x4ed424[_0xe692('0x1e')];var _0x172988;if(_0x4cb5e4>=_0xfaef30){_0x4cb5e4=_0xfaef30;_0x172988=0xc8;}else{_0x172988=0xce;}_0x55e482[_0xe692('0x1b')](_0x172988);return _0x55e482[_0xe692('0x21')](_0xe692('0x22'),_0x3a5887+'-'+_0x4cb5e4+'/'+_0xfaef30)[_0xe692('0x1c')](_0x250cbf);}return null;};}function patchUpdates(_0x355e6a){return function(_0x560a26){try{jsonpatch[_0xe692('0x23')](_0x560a26,_0x355e6a,!![]);}catch(_0x37cb83){return BPromise['reject'](_0x37cb83);}return _0x560a26[_0xe692('0x24')]();};}function saveUpdates(_0x5b6acb,_0x5a6cf0){return function(_0xa4821){if(_0xa4821){return _0xa4821[_0xe692('0x25')](_0x5b6acb)[_0xe692('0x26')](function(_0x2bfd50){return _0x2bfd50;});}return null;};}function removeEntity(_0x4488e3,_0x3aad39){return function(_0x45d2f4){if(_0x45d2f4){return _0x45d2f4[_0xe692('0x27')]()[_0xe692('0x26')](function(){_0x4488e3[_0xe692('0x1b')](0xcc)[_0xe692('0x28')]();});}};}function handleEntityNotFound(_0x5ec006,_0x5cedbe){return function(_0x30c7a4){if(!_0x30c7a4){_0x5ec006[_0xe692('0x29')](0x194);}return _0x30c7a4;};}function handleError(_0x465c34,_0x449a0f){_0x449a0f=_0x449a0f||0x1f4;return function(_0x234509){logger[_0xe692('0x2a')](_0x234509['stack']);if(_0x234509[_0xe692('0x2b')]){delete _0x234509[_0xe692('0x2b')];}_0x465c34[_0xe692('0x1b')](_0x449a0f)[_0xe692('0x2c')](_0x234509);};}exports['index']=function(_0x331f82,_0x4ccb8f){var _0x162a54={},_0x441b98={},_0x2f21c1={'count':0x0,'rows':[]};var _0x5b2762=_['map'](db[_0xe692('0x2d')][_0xe692('0x2e')],function(_0x20664f){return{'name':_0x20664f['fieldName'],'type':_0x20664f['type']['key']};});_0x441b98[_0xe692('0x2f')]=_['map'](_0x5b2762,_0xe692('0x2b'));_0x441b98[_0xe692('0x30')]=_['keys'](_0x331f82[_0xe692('0x30')]);_0x441b98['filters']=_[_0xe692('0x31')](_0x441b98[_0xe692('0x2f')],_0x441b98[_0xe692('0x30')]);_0x162a54[_0xe692('0x32')]=_[_0xe692('0x31')](_0x441b98['model'],qs[_0xe692('0x33')](_0x331f82[_0xe692('0x30')]['fields']));_0x162a54[_0xe692('0x32')]=_0x162a54[_0xe692('0x32')]['length']?_0x162a54[_0xe692('0x32')]:_0x441b98['model'];if(!_0x331f82['query'][_0xe692('0x34')](_0xe692('0x35'))){_0x162a54[_0xe692('0x1e')]=qs[_0xe692('0x1e')](_0x331f82[_0xe692('0x30')][_0xe692('0x1e')]);_0x162a54[_0xe692('0x1d')]=qs[_0xe692('0x1d')](_0x331f82[_0xe692('0x30')][_0xe692('0x1d')]);}_0x162a54[_0xe692('0x36')]=qs[_0xe692('0x37')](_0x331f82[_0xe692('0x30')][_0xe692('0x37')]);_0x162a54['where']=qs[_0xe692('0x38')](_[_0xe692('0x39')](_0x331f82[_0xe692('0x30')],_0x441b98['filters']),_0x5b2762);if(_0x331f82['query'][_0xe692('0x3a')]){_0x162a54[_0xe692('0x3b')]=_[_0xe692('0x3c')](_0x162a54['where'],{'$or':_[_0xe692('0x3d')](_0x5b2762,function(_0x390535){if(_0x390535[_0xe692('0x3e')]!==_0xe692('0x3f')){var _0xe79003={};_0xe79003[_0x390535[_0xe692('0x2b')]]={'$like':'%'+_0x331f82[_0xe692('0x30')][_0xe692('0x3a')]+'%'};return _0xe79003;}})});}_0x162a54=_[_0xe692('0x3c')]({},_0x162a54,_0x331f82['options']);var _0x3e49bb={'where':_0x162a54[_0xe692('0x3b')]};return db[_0xe692('0x2d')][_0xe692('0x20')](_0x3e49bb)[_0xe692('0x26')](function(_0x429b6d){_0x2f21c1[_0xe692('0x20')]=_0x429b6d;if(_0x331f82['query']['includeAll']){_0x162a54[_0xe692('0x40')]=[{'all':!![]}];}return db[_0xe692('0x2d')][_0xe692('0x41')](_0x162a54);})['then'](function(_0x47d7d1){_0x2f21c1['rows']=_0x47d7d1;return _0x2f21c1;})[_0xe692('0x26')](respondWithFilteredResult(_0x4ccb8f,_0x162a54))[_0xe692('0x42')](handleError(_0x4ccb8f,null));};exports[_0xe692('0x43')]=function(_0x1091d4,_0x1d3824){var _0x5cd8cd={'raw':![],'where':{'id':_0x1091d4[_0xe692('0x44')]['id']}},_0x353c3d={};_0x353c3d[_0xe692('0x2f')]=_['keys'](db[_0xe692('0x2d')][_0xe692('0x2e')]);_0x353c3d[_0xe692('0x30')]=_[_0xe692('0x45')](_0x1091d4['query']);_0x353c3d[_0xe692('0x38')]=_[_0xe692('0x31')](_0x353c3d[_0xe692('0x2f')],_0x353c3d[_0xe692('0x30')]);_0x5cd8cd[_0xe692('0x32')]=_[_0xe692('0x31')](_0x353c3d[_0xe692('0x2f')],qs[_0xe692('0x33')](_0x1091d4[_0xe692('0x30')]['fields']));_0x5cd8cd[_0xe692('0x32')]=_0x5cd8cd['attributes'][_0xe692('0x46')]?_0x5cd8cd[_0xe692('0x32')]:_0x353c3d['model'];if(_0x1091d4[_0xe692('0x30')][_0xe692('0x47')]){_0x5cd8cd[_0xe692('0x40')]=[{'all':!![]}];}_0x5cd8cd=_[_0xe692('0x3c')]({},_0x5cd8cd,_0x1091d4[_0xe692('0x48')]);return db['FreshsalesConfiguration'][_0xe692('0x49')](_0x5cd8cd)[_0xe692('0x26')](handleEntityNotFound(_0x1d3824,null))[_0xe692('0x26')](respondWithResult(_0x1d3824,null))[_0xe692('0x42')](handleError(_0x1d3824,null));};exports[_0xe692('0x4a')]=function(_0x163c18,_0x3ac111){return db[_0xe692('0x2d')][_0xe692('0x4a')](_0x163c18[_0xe692('0x4b')],{})[_0xe692('0x26')](respondWithResult(_0x3ac111,0xc9))[_0xe692('0x42')](handleError(_0x3ac111,null));};exports[_0xe692('0x25')]=function(_0x10dd3b,_0x18744f){if(_0x10dd3b[_0xe692('0x4b')]['id']){delete _0x10dd3b[_0xe692('0x4b')]['id'];}return db[_0xe692('0x2d')][_0xe692('0x49')]({'where':{'id':_0x10dd3b['params']['id']}})[_0xe692('0x26')](handleEntityNotFound(_0x18744f,null))[_0xe692('0x26')](saveUpdates(_0x10dd3b[_0xe692('0x4b')],null))[_0xe692('0x26')](respondWithResult(_0x18744f,null))[_0xe692('0x42')](handleError(_0x18744f,null));};exports[_0xe692('0x27')]=function(_0x808d52,_0x1c7b36){return db[_0xe692('0x2d')][_0xe692('0x49')]({'where':{'id':_0x808d52[_0xe692('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c7b36,null))[_0xe692('0x26')](removeEntity(_0x1c7b36,null))[_0xe692('0x42')](handleError(_0x1c7b36,null));};exports['getSubjects']=function(_0x4cb845,_0x10c548,_0x1f948c){var _0x5ba5c1={};var _0x3cdea5={};var _0x552f5e;var _0x24ee72;return db[_0xe692('0x2d')][_0xe692('0x4c')]({'where':{'id':_0x4cb845[_0xe692('0x44')]['id']}})[_0xe692('0x26')](handleEntityNotFound(_0x10c548,null))[_0xe692('0x26')](function(_0x56530d){if(_0x56530d){_0x552f5e=_0x56530d;_0x3cdea5['model']=_['keys'](db[_0xe692('0x4d')][_0xe692('0x2e')]);_0x3cdea5[_0xe692('0x30')]=_[_0xe692('0x45')](_0x4cb845[_0xe692('0x30')]);_0x3cdea5[_0xe692('0x38')]=_[_0xe692('0x31')](_0x3cdea5[_0xe692('0x2f')],_0x3cdea5[_0xe692('0x30')]);_0x5ba5c1['attributes']=_[_0xe692('0x31')](_0x3cdea5[_0xe692('0x2f')],qs[_0xe692('0x33')](_0x4cb845[_0xe692('0x30')][_0xe692('0x33')]));_0x5ba5c1[_0xe692('0x32')]=_0x5ba5c1[_0xe692('0x32')][_0xe692('0x46')]?_0x5ba5c1[_0xe692('0x32')]:_0x3cdea5[_0xe692('0x2f')];_0x5ba5c1[_0xe692('0x36')]=qs['sort'](_0x4cb845[_0xe692('0x30')][_0xe692('0x37')]);_0x5ba5c1[_0xe692('0x3b')]=qs['filters'](_['pick'](_0x4cb845[_0xe692('0x30')],_0x3cdea5[_0xe692('0x38')]));if(_0x4cb845['query'][_0xe692('0x3a')]){_0x5ba5c1[_0xe692('0x3b')]=_[_0xe692('0x3c')](_0x5ba5c1[_0xe692('0x3b')],{'$or':_[_0xe692('0x3d')](_0x5ba5c1['attributes'],function(_0xae14fa){var _0x5a5d14={};_0x5a5d14[_0xae14fa]={'$like':'%'+_0x4cb845[_0xe692('0x30')]['filter']+'%'};return _0x5a5d14;})});}_0x5ba5c1=_[_0xe692('0x3c')]({},_0x5ba5c1,_0x4cb845[_0xe692('0x48')]);return _0x552f5e['getSubjects'](_0x5ba5c1);}})[_0xe692('0x26')](function(_0x372349){if(_0x372349){_0x24ee72=_0x372349[_0xe692('0x46')];if(!_0x4cb845[_0xe692('0x30')][_0xe692('0x34')](_0xe692('0x35'))){_0x5ba5c1[_0xe692('0x1e')]=qs[_0xe692('0x1e')](_0x4cb845[_0xe692('0x30')][_0xe692('0x1e')]);_0x5ba5c1['offset']=qs[_0xe692('0x1d')](_0x4cb845[_0xe692('0x30')]['offset']);}return _0x552f5e['getSubjects'](_0x5ba5c1);}})[_0xe692('0x26')](function(_0x4dbce5){if(_0x4dbce5){return _0x4dbce5?{'count':_0x24ee72,'rows':_0x4dbce5}:null;}})['then'](respondWithResult(_0x10c548,null))[_0xe692('0x42')](handleError(_0x10c548,null));};exports[_0xe692('0x4e')]=function(_0x291eb5,_0x2939a5,_0xab249d){var _0x59b047={};var _0x11d8dc={};var _0x4292f2;var _0x2009a1;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x291eb5['params']['id']}})['then'](handleEntityNotFound(_0x2939a5,null))[_0xe692('0x26')](function(_0x119a1a){if(_0x119a1a){_0x4292f2=_0x119a1a;_0x11d8dc[_0xe692('0x2f')]=_[_0xe692('0x45')](db[_0xe692('0x4d')][_0xe692('0x2e')]);_0x11d8dc[_0xe692('0x30')]=_[_0xe692('0x45')](_0x291eb5[_0xe692('0x30')]);_0x11d8dc[_0xe692('0x38')]=_['intersection'](_0x11d8dc['model'],_0x11d8dc[_0xe692('0x30')]);_0x59b047['attributes']=_[_0xe692('0x31')](_0x11d8dc[_0xe692('0x2f')],qs[_0xe692('0x33')](_0x291eb5[_0xe692('0x30')][_0xe692('0x33')]));_0x59b047[_0xe692('0x32')]=_0x59b047[_0xe692('0x32')]['length']?_0x59b047[_0xe692('0x32')]:_0x11d8dc[_0xe692('0x2f')];_0x59b047[_0xe692('0x36')]=qs[_0xe692('0x37')](_0x291eb5[_0xe692('0x30')][_0xe692('0x37')]);_0x59b047['where']=qs[_0xe692('0x38')](_['pick'](_0x291eb5[_0xe692('0x30')],_0x11d8dc[_0xe692('0x38')]));if(_0x291eb5['query'][_0xe692('0x3a')]){_0x59b047[_0xe692('0x3b')]=_[_0xe692('0x3c')](_0x59b047['where'],{'$or':_['map'](_0x59b047[_0xe692('0x32')],function(_0x16adf6){var _0x27ac8c={};_0x27ac8c[_0x16adf6]={'$like':'%'+_0x291eb5[_0xe692('0x30')][_0xe692('0x3a')]+'%'};return _0x27ac8c;})});}_0x59b047=_[_0xe692('0x3c')]({},_0x59b047,_0x291eb5[_0xe692('0x48')]);return _0x4292f2[_0xe692('0x4e')](_0x59b047);}})[_0xe692('0x26')](function(_0x56f59e){if(_0x56f59e){_0x2009a1=_0x56f59e['length'];if(!_0x291eb5[_0xe692('0x30')][_0xe692('0x34')](_0xe692('0x35'))){_0x59b047[_0xe692('0x1e')]=qs['limit'](_0x291eb5['query'][_0xe692('0x1e')]);_0x59b047[_0xe692('0x1d')]=qs[_0xe692('0x1d')](_0x291eb5[_0xe692('0x30')]['offset']);}return _0x4292f2['getDescriptions'](_0x59b047);}})[_0xe692('0x26')](function(_0x1d5a6b){if(_0x1d5a6b){return _0x1d5a6b?{'count':_0x2009a1,'rows':_0x1d5a6b}:null;}})[_0xe692('0x26')](respondWithResult(_0x2939a5,null))[_0xe692('0x42')](handleError(_0x2939a5,null));};exports['getFields']=function(_0x1170d3,_0x8f5525,_0x5d2b8c){var _0x5ef346={};var _0x256d08={};var _0x5b625e;var _0x34f74d;return db[_0xe692('0x2d')][_0xe692('0x4c')]({'where':{'id':_0x1170d3[_0xe692('0x44')]['id']}})[_0xe692('0x26')](handleEntityNotFound(_0x8f5525,null))[_0xe692('0x26')](function(_0x2d5d75){if(_0x2d5d75){_0x5b625e=_0x2d5d75;_0x256d08[_0xe692('0x2f')]=_[_0xe692('0x45')](db[_0xe692('0x4d')][_0xe692('0x2e')]);_0x256d08['query']=_[_0xe692('0x45')](_0x1170d3[_0xe692('0x30')]);_0x256d08[_0xe692('0x38')]=_[_0xe692('0x31')](_0x256d08[_0xe692('0x2f')],_0x256d08[_0xe692('0x30')]);_0x5ef346[_0xe692('0x32')]=_['intersection'](_0x256d08['model'],qs[_0xe692('0x33')](_0x1170d3[_0xe692('0x30')]['fields']));_0x5ef346[_0xe692('0x32')]=_0x5ef346['attributes'][_0xe692('0x46')]?_0x5ef346[_0xe692('0x32')]:_0x256d08[_0xe692('0x2f')];_0x5ef346[_0xe692('0x36')]=qs[_0xe692('0x37')](_0x1170d3[_0xe692('0x30')][_0xe692('0x37')]);_0x5ef346['where']=qs[_0xe692('0x38')](_[_0xe692('0x39')](_0x1170d3[_0xe692('0x30')],_0x256d08[_0xe692('0x38')]));if(_0x1170d3[_0xe692('0x30')]['filter']){_0x5ef346[_0xe692('0x3b')]=_[_0xe692('0x3c')](_0x5ef346[_0xe692('0x3b')],{'$or':_['map'](_0x5ef346[_0xe692('0x32')],function(_0x16aafa){var _0x573a46={};_0x573a46[_0x16aafa]={'$like':'%'+_0x1170d3[_0xe692('0x30')][_0xe692('0x3a')]+'%'};return _0x573a46;})});}_0x5ef346=_[_0xe692('0x3c')]({},_0x5ef346,_0x1170d3[_0xe692('0x48')]);return _0x5b625e[_0xe692('0x4f')](_0x5ef346);}})[_0xe692('0x26')](function(_0x6a57cd){if(_0x6a57cd){_0x34f74d=_0x6a57cd[_0xe692('0x46')];if(!_0x1170d3[_0xe692('0x30')][_0xe692('0x34')](_0xe692('0x35'))){_0x5ef346[_0xe692('0x1e')]=qs[_0xe692('0x1e')](_0x1170d3[_0xe692('0x30')][_0xe692('0x1e')]);_0x5ef346[_0xe692('0x1d')]=qs['offset'](_0x1170d3['query']['offset']);}return _0x5b625e['getFields'](_0x5ef346);}})[_0xe692('0x26')](function(_0x202c7d){if(_0x202c7d){return _0x202c7d?{'count':_0x34f74d,'rows':_0x202c7d}:null;}})[_0xe692('0x26')](respondWithResult(_0x8f5525,null))[_0xe692('0x42')](handleError(_0x8f5525,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8eb7287..5692e9f 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 _0x80c0=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','util'];(function(_0x487f66,_0x23f1a0){var _0x3eecd1=function(_0x43ce41){while(--_0x43ce41){_0x487f66['push'](_0x487f66['shift']());}};_0x3eecd1(++_0x23f1a0);}(_0x80c0,0x137));var _0x080c=function(_0x3fddeb,_0x189353){_0x3fddeb=_0x3fddeb-0x0;var _0x4701cc=_0x80c0[_0x3fddeb];return _0x4701cc;};'use strict';var _=require('lodash');var util=require(_0x080c('0x0'));var logger=require(_0x080c('0x1'))(_0x080c('0x2'));var moment=require(_0x080c('0x3'));var BPromise=require(_0x080c('0x4'));var rp=require(_0x080c('0x5'));var fs=require('fs');var path=require(_0x080c('0x6'));var rimraf=require('rimraf');var config=require(_0x080c('0x7'));var attributes=require(_0x080c('0x8'));module[_0x080c('0x9')]=function(_0x19acd9,_0x2720ab){return _0x19acd9[_0x080c('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x080c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8faf=['moment','request-promise','path','rimraf','../../config/environment','define','FreshsalesConfiguration','util','api'];(function(_0x4135f4,_0x5ece14){var _0x2a7815=function(_0x56208c){while(--_0x56208c){_0x4135f4['push'](_0x4135f4['shift']());}};_0x2a7815(++_0x5ece14);}(_0x8faf,0x154));var _0xf8fa=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x8faf[_0x432fca];return _0x3adba4;};'use strict';var _=require('lodash');var util=require(_0xf8fa('0x0'));var logger=require('../../config/logger')(_0xf8fa('0x1'));var moment=require(_0xf8fa('0x2'));var BPromise=require('bluebird');var rp=require(_0xf8fa('0x3'));var fs=require('fs');var path=require(_0xf8fa('0x4'));var rimraf=require(_0xf8fa('0x5'));var config=require(_0xf8fa('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x2d6785,_0x278ef9){return _0x2d6785[_0xf8fa('0x7')](_0xf8fa('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 3cc8d76..dddafbb 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 _0x8eee=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8eee,0x6f));var _0xe8ee=function(_0x3a4464,_0x37afa0){_0x3a4464=_0x3a4464-0x0;var _0x42503f=_0x8eee[_0x3a4464];return _0x42503f;};'use strict';var _=require(_0xe8ee('0x0'));var util=require(_0xe8ee('0x1'));var moment=require(_0xe8ee('0x2'));var BPromise=require(_0xe8ee('0x3'));var rs=require(_0xe8ee('0x4'));var fs=require('fs');var Redis=require(_0xe8ee('0x5'));var db=require(_0xe8ee('0x6'))['db'];var utils=require(_0xe8ee('0x7'));var logger=require(_0xe8ee('0x8'))('rpc');var config=require(_0xe8ee('0x9'));var jayson=require(_0xe8ee('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x128b31,_0x4bf087,_0x5601f4){return new BPromise(function(_0x9cda0a,_0x41eed0){return client['request'](_0x128b31,_0x5601f4)[_0xe8ee('0xb')](function(_0x2d31a2){logger[_0xe8ee('0xc')](_0xe8ee('0xd'),_0x4bf087,_0xe8ee('0xe'));logger['debug'](_0xe8ee('0xf'),_0x4bf087,_0xe8ee('0xe'),JSON['stringify'](_0x2d31a2));if(_0x2d31a2[_0xe8ee('0x10')]){if(_0x2d31a2[_0xe8ee('0x10')][_0xe8ee('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4bf087,_0x2d31a2[_0xe8ee('0x10')]['message']);return _0x41eed0(_0x2d31a2['error'][_0xe8ee('0x12')]);}logger[_0xe8ee('0x10')](_0xe8ee('0xd'),_0x4bf087,_0x2d31a2[_0xe8ee('0x10')]['message']);return _0x9cda0a(_0x2d31a2['error'][_0xe8ee('0x12')]);}else{logger['info'](_0xe8ee('0xd'),_0x4bf087,_0xe8ee('0xe'));_0x9cda0a(_0x2d31a2[_0xe8ee('0x13')][_0xe8ee('0x12')]);}})[_0xe8ee('0x14')](function(_0x1ca034){logger[_0xe8ee('0x10')](_0xe8ee('0xd'),_0x4bf087,_0x1ca034);_0x41eed0(_0x1ca034);});});} \ No newline at end of file +var _0x12aa=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x3e67f5,_0x294a50){var _0x12736b=function(_0x3d8cb5){while(--_0x3d8cb5){_0x3e67f5['push'](_0x3e67f5['shift']());}};_0x12736b(++_0x294a50);}(_0x12aa,0x78));var _0xa12a=function(_0x8b8bcb,_0x1b0c40){_0x8b8bcb=_0x8b8bcb-0x0;var _0x1334bf=_0x12aa[_0x8b8bcb];return _0x1334bf;};'use strict';var _=require(_0xa12a('0x0'));var util=require(_0xa12a('0x1'));var moment=require(_0xa12a('0x2'));var BPromise=require(_0xa12a('0x3'));var rs=require(_0xa12a('0x4'));var fs=require('fs');var Redis=require(_0xa12a('0x5'));var db=require(_0xa12a('0x6'))['db'];var utils=require(_0xa12a('0x7'));var logger=require(_0xa12a('0x8'))(_0xa12a('0x9'));var config=require(_0xa12a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa12a('0xb')][_0xa12a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x285c84,_0x1b7d3d,_0x50489a){return new BPromise(function(_0x9e4d04,_0x194adf){return client['request'](_0x285c84,_0x50489a)[_0xa12a('0xd')](function(_0x477538){logger['info'](_0xa12a('0xe'),_0x1b7d3d,_0xa12a('0xf'));logger['debug'](_0xa12a('0x10'),_0x1b7d3d,_0xa12a('0xf'),JSON[_0xa12a('0x11')](_0x477538));if(_0x477538[_0xa12a('0x12')]){if(_0x477538[_0xa12a('0x12')][_0xa12a('0x13')]===0x1f4){logger[_0xa12a('0x12')](_0xa12a('0xe'),_0x1b7d3d,_0x477538['error']['message']);return _0x194adf(_0x477538[_0xa12a('0x12')][_0xa12a('0x14')]);}logger[_0xa12a('0x12')](_0xa12a('0xe'),_0x1b7d3d,_0x477538[_0xa12a('0x12')][_0xa12a('0x14')]);return _0x9e4d04(_0x477538[_0xa12a('0x12')][_0xa12a('0x14')]);}else{logger[_0xa12a('0x15')](_0xa12a('0xe'),_0x1b7d3d,_0xa12a('0xf'));_0x9e4d04(_0x477538[_0xa12a('0x16')][_0xa12a('0x14')]);}})[_0xa12a('0x17')](function(_0x2b076b){logger[_0xa12a('0x12')](_0xa12a('0xe'),_0x1b7d3d,_0x2b076b);_0x194adf(_0x2b076b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e92592d..3055f72 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 _0xc73e=['isAuthenticated','index','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xc73e,0x1e9));var _0xec73=function(_0x295ac9,_0x2c72a7){_0x295ac9=_0x295ac9-0x0;var _0x4612ca=_0xc73e[_0x295ac9];return _0x4612ca;};'use strict';var multer=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var path=require('path');var timeout=require(_0xec73('0x2'));var express=require(_0xec73('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var controller=require('./intFreshsalesField.controller');router[_0xec73('0x6')]('/',auth[_0xec73('0x7')](),controller[_0xec73('0x8')]);router[_0xec73('0x6')]('/:id',auth[_0xec73('0x7')](),controller['show']);router[_0xec73('0x9')]('/',auth[_0xec73('0x7')](),controller[_0xec73('0xa')]);router[_0xec73('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xec73('0xc')]);router[_0xec73('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xec73('0xe')]);module[_0xec73('0xf')]=router; \ No newline at end of file +var _0x22a4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x381cd7,_0x5cd931){var _0x42fb4d=function(_0x2ee505){while(--_0x2ee505){_0x381cd7['push'](_0x381cd7['shift']());}};_0x42fb4d(++_0x5cd931);}(_0x22a4,0x1cb));var _0x422a=function(_0x4d4696,_0x1ab3a2){_0x4d4696=_0x4d4696-0x0;var _0x455048=_0x22a4[_0x4d4696];return _0x455048;};'use strict';var multer=require(_0x422a('0x0'));var util=require(_0x422a('0x1'));var path=require(_0x422a('0x2'));var timeout=require(_0x422a('0x3'));var express=require(_0x422a('0x4'));var router=express[_0x422a('0x5')]();var fs_extra=require(_0x422a('0x6'));var auth=require(_0x422a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x422a('0x8'));var controller=require(_0x422a('0x9'));router[_0x422a('0xa')]('/',auth[_0x422a('0xb')](),controller[_0x422a('0xc')]);router['get'](_0x422a('0xd'),auth[_0x422a('0xb')](),controller[_0x422a('0xe')]);router[_0x422a('0xf')]('/',auth[_0x422a('0xb')](),controller[_0x422a('0x10')]);router[_0x422a('0x11')](_0x422a('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x422a('0x12')](_0x422a('0xd'),auth[_0x422a('0xb')](),controller[_0x422a('0x13')]);module[_0x422a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 28d5600..259b42a 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 _0x80da=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x80da,0x10d));var _0xa80d=function(_0x299b27,_0x31db3d){_0x299b27=_0x299b27-0x0;var _0x4b4dbc=_0x80da[_0x299b27];return _0x4b4dbc;};'use strict';var Sequelize=require(_0xa80d('0x0'));module[_0xa80d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa80d('0x2'),_0xa80d('0x3'),_0xa80d('0x4'),_0xa80d('0x5'),'picklist'),'defaultValue':_0xa80d('0x2')},'content':{'type':Sequelize[_0xa80d('0x6')]},'key':{'type':Sequelize[_0xa80d('0x6')]},'keyType':{'type':Sequelize[_0xa80d('0x7')](_0xa80d('0x2'),_0xa80d('0x3'),_0xa80d('0x4'))},'keyContent':{'type':Sequelize[_0xa80d('0x6')]},'idField':{'type':Sequelize[_0xa80d('0x6')]},'nameField':{'type':Sequelize[_0xa80d('0x6')]},'customField':{'type':Sequelize[_0xa80d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa80d('0x6')]}}; \ No newline at end of file +var _0xf12d=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x16e5d2,_0x177de9){var _0x442a3b=function(_0x51ff6a){while(--_0x51ff6a){_0x16e5d2['push'](_0x16e5d2['shift']());}};_0x442a3b(++_0x177de9);}(_0xf12d,0x184));var _0xdf12=function(_0x338e55,_0x5f26eb){_0x338e55=_0x338e55-0x0;var _0x836fec=_0xf12d[_0x338e55];return _0x836fec;};'use strict';var Sequelize=require(_0xdf12('0x0'));module[_0xdf12('0x1')]={'type':{'type':Sequelize[_0xdf12('0x2')](_0xdf12('0x3'),_0xdf12('0x4'),_0xdf12('0x5'),_0xdf12('0x6'),_0xdf12('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdf12('0x8')]},'key':{'type':Sequelize[_0xdf12('0x8')]},'keyType':{'type':Sequelize[_0xdf12('0x2')]('string',_0xdf12('0x4'),_0xdf12('0x5'))},'keyContent':{'type':Sequelize[_0xdf12('0x8')]},'idField':{'type':Sequelize[_0xdf12('0x8')]},'nameField':{'type':Sequelize[_0xdf12('0x8')]},'customField':{'type':Sequelize[_0xdf12('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf12('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 29950e4..4659990 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 _0xef8e=['squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','fieldName','key','model','query','keys','attributes','fields','length','order','sort','filters','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xef8e,0x8a));var _0xeef8=function(_0x227fb6,_0x24ca6f){_0x227fb6=_0x227fb6-0x0;var _0x337f6c=_0xef8e[_0x227fb6];return _0x337f6c;};'use strict';var emlformat=require(_0xeef8('0x0'));var rimraf=require(_0xeef8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeef8('0x2'));var rp=require(_0xeef8('0x3'));var moment=require('moment');var BPromise=require(_0xeef8('0x4'));var Mustache=require(_0xeef8('0x5'));var util=require(_0xeef8('0x6'));var path=require(_0xeef8('0x7'));var sox=require(_0xeef8('0x8'));var csv=require('to-csv');var ejs=require(_0xeef8('0x9'));var fs=require('fs');var fs_extra=require(_0xeef8('0xa'));var _=require(_0xeef8('0xb'));var squel=require(_0xeef8('0xc'));var crypto=require('crypto');var jsforce=require(_0xeef8('0xd'));var deskjs=require(_0xeef8('0xe'));var toCsv=require(_0xeef8('0xf'));var querystring=require(_0xeef8('0x10'));var Papa=require(_0xeef8('0x11'));var Redis=require(_0xeef8('0x12'));var authService=require(_0xeef8('0x13'));var qs=require(_0xeef8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeef8('0x15'));var logger=require(_0xeef8('0x16'))(_0xeef8('0x17'));var utils=require(_0xeef8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeef8('0x19'))['db'];function respondWithStatusCode(_0x471dd8,_0x422411){_0x422411=_0x422411||0xcc;return function(_0x3f4049){if(_0x3f4049){return _0x471dd8[_0xeef8('0x1a')](_0x422411);}return _0x471dd8[_0xeef8('0x1b')](_0x422411)[_0xeef8('0x1c')]();};}function respondWithResult(_0x42fc03,_0x236e46){_0x236e46=_0x236e46||0xc8;return function(_0x33ffab){if(_0x33ffab){return _0x42fc03['status'](_0x236e46)['json'](_0x33ffab);}};}function respondWithFilteredResult(_0x2b05fa,_0x2bf5b8){return function(_0x362deb){if(_0x362deb){var _0x3f4a75=typeof _0x2bf5b8[_0xeef8('0x1d')]===_0xeef8('0x1e')&&typeof _0x2bf5b8['limit']===_0xeef8('0x1e');var _0x4d6fa9=_0x362deb['count'];var _0x115f9f=_0x3f4a75?0x0:_0x2bf5b8[_0xeef8('0x1d')];var _0xbff314=_0x3f4a75?_0x362deb[_0xeef8('0x1f')]:_0x2bf5b8[_0xeef8('0x1d')]+_0x2bf5b8[_0xeef8('0x20')];var _0x4964a0;if(_0xbff314>=_0x4d6fa9){_0xbff314=_0x4d6fa9;_0x4964a0=0xc8;}else{_0x4964a0=0xce;}_0x2b05fa[_0xeef8('0x1b')](_0x4964a0);return _0x2b05fa[_0xeef8('0x21')](_0xeef8('0x22'),_0x115f9f+'-'+_0xbff314+'/'+_0x4d6fa9)['json'](_0x362deb);}return null;};}function patchUpdates(_0x9f9297){return function(_0x56a6ce){try{jsonpatch[_0xeef8('0x23')](_0x56a6ce,_0x9f9297,!![]);}catch(_0x45760a){return BPromise[_0xeef8('0x24')](_0x45760a);}return _0x56a6ce[_0xeef8('0x25')]();};}function saveUpdates(_0x245156,_0x13108f){return function(_0x305d91){if(_0x305d91){return _0x305d91[_0xeef8('0x26')](_0x245156)[_0xeef8('0x27')](function(_0x1d8a09){return _0x1d8a09;});}return null;};}function removeEntity(_0x561888,_0xf6d443){return function(_0x306fa8){if(_0x306fa8){return _0x306fa8[_0xeef8('0x28')]()[_0xeef8('0x27')](function(){_0x561888['status'](0xcc)[_0xeef8('0x1c')]();});}};}function handleEntityNotFound(_0x3c8e12,_0x86c621){return function(_0xd70c82){if(!_0xd70c82){_0x3c8e12[_0xeef8('0x1a')](0x194);}return _0xd70c82;};}function handleError(_0x5ca201,_0x34269d){_0x34269d=_0x34269d||0x1f4;return function(_0x243903){logger[_0xeef8('0x29')](_0x243903[_0xeef8('0x2a')]);if(_0x243903[_0xeef8('0x2b')]){delete _0x243903[_0xeef8('0x2b')];}_0x5ca201['status'](_0x34269d)[_0xeef8('0x2c')](_0x243903);};}exports['index']=function(_0x518fe1,_0x5541dc){var _0x7b1652={},_0x4f4717={},_0x481df9={'count':0x0,'rows':[]};var _0x1fda9e=_[_0xeef8('0x2d')](db[_0xeef8('0x2e')]['rawAttributes'],function(_0x3d8927){return{'name':_0x3d8927[_0xeef8('0x2f')],'type':_0x3d8927['type'][_0xeef8('0x30')]};});_0x4f4717[_0xeef8('0x31')]=_[_0xeef8('0x2d')](_0x1fda9e,_0xeef8('0x2b'));_0x4f4717[_0xeef8('0x32')]=_[_0xeef8('0x33')](_0x518fe1[_0xeef8('0x32')]);_0x4f4717['filters']=_['intersection'](_0x4f4717['model'],_0x4f4717[_0xeef8('0x32')]);_0x7b1652[_0xeef8('0x34')]=_['intersection'](_0x4f4717[_0xeef8('0x31')],qs[_0xeef8('0x35')](_0x518fe1['query'][_0xeef8('0x35')]));_0x7b1652[_0xeef8('0x34')]=_0x7b1652[_0xeef8('0x34')][_0xeef8('0x36')]?_0x7b1652[_0xeef8('0x34')]:_0x4f4717[_0xeef8('0x31')];if(!_0x518fe1[_0xeef8('0x32')]['hasOwnProperty']('nolimit')){_0x7b1652[_0xeef8('0x20')]=qs[_0xeef8('0x20')](_0x518fe1[_0xeef8('0x32')][_0xeef8('0x20')]);_0x7b1652[_0xeef8('0x1d')]=qs[_0xeef8('0x1d')](_0x518fe1[_0xeef8('0x32')][_0xeef8('0x1d')]);}_0x7b1652[_0xeef8('0x37')]=qs[_0xeef8('0x38')](_0x518fe1[_0xeef8('0x32')][_0xeef8('0x38')]);_0x7b1652['where']=qs[_0xeef8('0x39')](_['pick'](_0x518fe1[_0xeef8('0x32')],_0x4f4717[_0xeef8('0x39')]),_0x1fda9e);if(_0x518fe1[_0xeef8('0x32')][_0xeef8('0x3a')]){_0x7b1652[_0xeef8('0x3b')]=_[_0xeef8('0x3c')](_0x7b1652[_0xeef8('0x3b')],{'$or':_[_0xeef8('0x2d')](_0x1fda9e,function(_0x3f751b){if(_0x3f751b[_0xeef8('0x3d')]!==_0xeef8('0x3e')){var _0x579f87={};_0x579f87[_0x3f751b['name']]={'$like':'%'+_0x518fe1[_0xeef8('0x32')][_0xeef8('0x3a')]+'%'};return _0x579f87;}})});}_0x7b1652=_[_0xeef8('0x3c')]({},_0x7b1652,_0x518fe1['options']);var _0x25686a={'where':_0x7b1652['where']};return db[_0xeef8('0x2e')]['count'](_0x25686a)['then'](function(_0x192315){_0x481df9['count']=_0x192315;if(_0x518fe1[_0xeef8('0x32')][_0xeef8('0x3f')]){_0x7b1652[_0xeef8('0x40')]=[{'all':!![]}];}return db[_0xeef8('0x2e')][_0xeef8('0x41')](_0x7b1652);})[_0xeef8('0x27')](function(_0x50c127){_0x481df9[_0xeef8('0x42')]=_0x50c127;return _0x481df9;})[_0xeef8('0x27')](respondWithFilteredResult(_0x5541dc,_0x7b1652))[_0xeef8('0x43')](handleError(_0x5541dc,null));};exports['show']=function(_0x406288,_0x205ae0){var _0x1b41c6={'raw':!![],'where':{'id':_0x406288[_0xeef8('0x44')]['id']}},_0xc6acc={};_0xc6acc[_0xeef8('0x31')]=_[_0xeef8('0x33')](db[_0xeef8('0x2e')][_0xeef8('0x45')]);_0xc6acc[_0xeef8('0x32')]=_['keys'](_0x406288[_0xeef8('0x32')]);_0xc6acc[_0xeef8('0x39')]=_[_0xeef8('0x46')](_0xc6acc['model'],_0xc6acc[_0xeef8('0x32')]);_0x1b41c6[_0xeef8('0x34')]=_[_0xeef8('0x46')](_0xc6acc[_0xeef8('0x31')],qs['fields'](_0x406288[_0xeef8('0x32')]['fields']));_0x1b41c6[_0xeef8('0x34')]=_0x1b41c6[_0xeef8('0x34')][_0xeef8('0x36')]?_0x1b41c6[_0xeef8('0x34')]:_0xc6acc['model'];if(_0x406288[_0xeef8('0x32')][_0xeef8('0x3f')]){_0x1b41c6[_0xeef8('0x40')]=[{'all':!![]}];}_0x1b41c6=_['merge']({},_0x1b41c6,_0x406288[_0xeef8('0x47')]);return db[_0xeef8('0x2e')]['find'](_0x1b41c6)[_0xeef8('0x27')](handleEntityNotFound(_0x205ae0,null))['then'](respondWithResult(_0x205ae0,null))['catch'](handleError(_0x205ae0,null));};exports[_0xeef8('0x48')]=function(_0x51447b,_0x191cbc){return db[_0xeef8('0x2e')][_0xeef8('0x48')](_0x51447b[_0xeef8('0x49')],{})['then'](respondWithResult(_0x191cbc,0xc9))['catch'](handleError(_0x191cbc,null));};exports['update']=function(_0x2c8ab6,_0x3ec039){if(_0x2c8ab6['body']['id']){delete _0x2c8ab6[_0xeef8('0x49')]['id'];}return db[_0xeef8('0x2e')][_0xeef8('0x4a')]({'where':{'id':_0x2c8ab6['params']['id']}})['then'](handleEntityNotFound(_0x3ec039,null))['then'](saveUpdates(_0x2c8ab6['body'],null))[_0xeef8('0x27')](respondWithResult(_0x3ec039,null))[_0xeef8('0x43')](handleError(_0x3ec039,null));};exports[_0xeef8('0x28')]=function(_0x142e02,_0x31eb4e){return db[_0xeef8('0x2e')]['find']({'where':{'id':_0x142e02[_0xeef8('0x44')]['id']}})['then'](handleEntityNotFound(_0x31eb4e,null))[_0xeef8('0x27')](removeEntity(_0x31eb4e,null))[_0xeef8('0x43')](handleError(_0x31eb4e,null));}; \ No newline at end of file +var _0x5668=['offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','FreshsalesField','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x5668,0x1e5));var _0x8566=function(_0x527d45,_0x2274e3){_0x527d45=_0x527d45-0x0;var _0x3a2544=_0x5668[_0x527d45];return _0x3a2544;};'use strict';var emlformat=require(_0x8566('0x0'));var rimraf=require(_0x8566('0x1'));var zipdir=require(_0x8566('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8566('0x3'));var moment=require(_0x8566('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8566('0x5'));var util=require(_0x8566('0x6'));var path=require(_0x8566('0x7'));var sox=require(_0x8566('0x8'));var csv=require(_0x8566('0x9'));var ejs=require(_0x8566('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8566('0xb'));var squel=require(_0x8566('0xc'));var crypto=require('crypto');var jsforce=require(_0x8566('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8566('0x9'));var querystring=require(_0x8566('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8566('0xf'));var qs=require(_0x8566('0x10'));var as=require(_0x8566('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8566('0x12'))(_0x8566('0x13'));var utils=require('../../config/utils');var config=require(_0x8566('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8566('0x15'))['db'];function respondWithStatusCode(_0x237578,_0x8ff169){_0x8ff169=_0x8ff169||0xcc;return function(_0x570dab){if(_0x570dab){return _0x237578[_0x8566('0x16')](_0x8ff169);}return _0x237578[_0x8566('0x17')](_0x8ff169)[_0x8566('0x18')]();};}function respondWithResult(_0x3db530,_0x17f964){_0x17f964=_0x17f964||0xc8;return function(_0x22c458){if(_0x22c458){return _0x3db530[_0x8566('0x17')](_0x17f964)[_0x8566('0x19')](_0x22c458);}};}function respondWithFilteredResult(_0x4e833a,_0x4039fe){return function(_0x41d823){if(_0x41d823){var _0x3a44fa=typeof _0x4039fe[_0x8566('0x1a')]==='undefined'&&typeof _0x4039fe[_0x8566('0x1b')]===_0x8566('0x1c');var _0x37f1ff=_0x41d823[_0x8566('0x1d')];var _0x59f790=_0x3a44fa?0x0:_0x4039fe['offset'];var _0x25a61a=_0x3a44fa?_0x41d823[_0x8566('0x1d')]:_0x4039fe[_0x8566('0x1a')]+_0x4039fe[_0x8566('0x1b')];var _0x138247;if(_0x25a61a>=_0x37f1ff){_0x25a61a=_0x37f1ff;_0x138247=0xc8;}else{_0x138247=0xce;}_0x4e833a[_0x8566('0x17')](_0x138247);return _0x4e833a['set'](_0x8566('0x1e'),_0x59f790+'-'+_0x25a61a+'/'+_0x37f1ff)[_0x8566('0x19')](_0x41d823);}return null;};}function patchUpdates(_0x3de24f){return function(_0x108dbd){try{jsonpatch[_0x8566('0x1f')](_0x108dbd,_0x3de24f,!![]);}catch(_0x209dca){return BPromise[_0x8566('0x20')](_0x209dca);}return _0x108dbd[_0x8566('0x21')]();};}function saveUpdates(_0x860873,_0x23af26){return function(_0x40525d){if(_0x40525d){return _0x40525d[_0x8566('0x22')](_0x860873)[_0x8566('0x23')](function(_0x260fa5){return _0x260fa5;});}return null;};}function removeEntity(_0x3078c0,_0x471bfd){return function(_0xb67eed){if(_0xb67eed){return _0xb67eed[_0x8566('0x24')]()['then'](function(){_0x3078c0[_0x8566('0x17')](0xcc)[_0x8566('0x18')]();});}};}function handleEntityNotFound(_0x1f5f10,_0x47bf54){return function(_0x3a2fff){if(!_0x3a2fff){_0x1f5f10['sendStatus'](0x194);}return _0x3a2fff;};}function handleError(_0x3a7d84,_0x4063eb){_0x4063eb=_0x4063eb||0x1f4;return function(_0x330957){logger[_0x8566('0x25')](_0x330957[_0x8566('0x26')]);if(_0x330957[_0x8566('0x27')]){delete _0x330957[_0x8566('0x27')];}_0x3a7d84['status'](_0x4063eb)['send'](_0x330957);};}exports[_0x8566('0x28')]=function(_0x5604e7,_0x1703c2){var _0x34a411={},_0x5531c3={},_0x5c63f9={'count':0x0,'rows':[]};var _0x435989=_[_0x8566('0x29')](db['FreshsalesField'][_0x8566('0x2a')],function(_0x116b87){return{'name':_0x116b87[_0x8566('0x2b')],'type':_0x116b87[_0x8566('0x2c')][_0x8566('0x2d')]};});_0x5531c3[_0x8566('0x2e')]=_[_0x8566('0x29')](_0x435989,_0x8566('0x27'));_0x5531c3['query']=_[_0x8566('0x2f')](_0x5604e7[_0x8566('0x30')]);_0x5531c3[_0x8566('0x31')]=_[_0x8566('0x32')](_0x5531c3['model'],_0x5531c3[_0x8566('0x30')]);_0x34a411[_0x8566('0x33')]=_[_0x8566('0x32')](_0x5531c3['model'],qs[_0x8566('0x34')](_0x5604e7[_0x8566('0x30')][_0x8566('0x34')]));_0x34a411[_0x8566('0x33')]=_0x34a411[_0x8566('0x33')][_0x8566('0x35')]?_0x34a411[_0x8566('0x33')]:_0x5531c3[_0x8566('0x2e')];if(!_0x5604e7[_0x8566('0x30')][_0x8566('0x36')](_0x8566('0x37'))){_0x34a411[_0x8566('0x1b')]=qs['limit'](_0x5604e7['query']['limit']);_0x34a411[_0x8566('0x1a')]=qs['offset'](_0x5604e7[_0x8566('0x30')]['offset']);}_0x34a411[_0x8566('0x38')]=qs[_0x8566('0x39')](_0x5604e7['query'][_0x8566('0x39')]);_0x34a411[_0x8566('0x3a')]=qs['filters'](_['pick'](_0x5604e7[_0x8566('0x30')],_0x5531c3['filters']),_0x435989);if(_0x5604e7['query'][_0x8566('0x3b')]){_0x34a411[_0x8566('0x3a')]=_['merge'](_0x34a411[_0x8566('0x3a')],{'$or':_['map'](_0x435989,function(_0x59de04){if(_0x59de04[_0x8566('0x2c')]!==_0x8566('0x3c')){var _0x4787bb={};_0x4787bb[_0x59de04[_0x8566('0x27')]]={'$like':'%'+_0x5604e7[_0x8566('0x30')][_0x8566('0x3b')]+'%'};return _0x4787bb;}})});}_0x34a411=_[_0x8566('0x3d')]({},_0x34a411,_0x5604e7[_0x8566('0x3e')]);var _0x49825a={'where':_0x34a411['where']};return db['FreshsalesField']['count'](_0x49825a)[_0x8566('0x23')](function(_0x34deb7){_0x5c63f9[_0x8566('0x1d')]=_0x34deb7;if(_0x5604e7['query'][_0x8566('0x3f')]){_0x34a411[_0x8566('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x8566('0x41')](_0x34a411);})[_0x8566('0x23')](function(_0x4bcf8e){_0x5c63f9[_0x8566('0x42')]=_0x4bcf8e;return _0x5c63f9;})[_0x8566('0x23')](respondWithFilteredResult(_0x1703c2,_0x34a411))[_0x8566('0x43')](handleError(_0x1703c2,null));};exports['show']=function(_0x36e5d4,_0xa4dd43){var _0x14244f={'raw':!![],'where':{'id':_0x36e5d4[_0x8566('0x44')]['id']}},_0x5321ac={};_0x5321ac[_0x8566('0x2e')]=_['keys'](db[_0x8566('0x45')][_0x8566('0x2a')]);_0x5321ac[_0x8566('0x30')]=_[_0x8566('0x2f')](_0x36e5d4[_0x8566('0x30')]);_0x5321ac[_0x8566('0x31')]=_['intersection'](_0x5321ac[_0x8566('0x2e')],_0x5321ac[_0x8566('0x30')]);_0x14244f['attributes']=_[_0x8566('0x32')](_0x5321ac[_0x8566('0x2e')],qs[_0x8566('0x34')](_0x36e5d4[_0x8566('0x30')][_0x8566('0x34')]));_0x14244f[_0x8566('0x33')]=_0x14244f['attributes'][_0x8566('0x35')]?_0x14244f['attributes']:_0x5321ac[_0x8566('0x2e')];if(_0x36e5d4[_0x8566('0x30')][_0x8566('0x3f')]){_0x14244f[_0x8566('0x40')]=[{'all':!![]}];}_0x14244f=_[_0x8566('0x3d')]({},_0x14244f,_0x36e5d4[_0x8566('0x3e')]);return db[_0x8566('0x45')]['find'](_0x14244f)['then'](handleEntityNotFound(_0xa4dd43,null))[_0x8566('0x23')](respondWithResult(_0xa4dd43,null))[_0x8566('0x43')](handleError(_0xa4dd43,null));};exports['create']=function(_0x1c85cb,_0xcee6ee){return db[_0x8566('0x45')][_0x8566('0x46')](_0x1c85cb[_0x8566('0x47')],{})[_0x8566('0x23')](respondWithResult(_0xcee6ee,0xc9))[_0x8566('0x43')](handleError(_0xcee6ee,null));};exports['update']=function(_0x34af04,_0x39f275){if(_0x34af04[_0x8566('0x47')]['id']){delete _0x34af04[_0x8566('0x47')]['id'];}return db[_0x8566('0x45')]['find']({'where':{'id':_0x34af04[_0x8566('0x44')]['id']}})[_0x8566('0x23')](handleEntityNotFound(_0x39f275,null))['then'](saveUpdates(_0x34af04[_0x8566('0x47')],null))['then'](respondWithResult(_0x39f275,null))[_0x8566('0x43')](handleError(_0x39f275,null));};exports['destroy']=function(_0x10f77b,_0x5dad37){return db['FreshsalesField'][_0x8566('0x48')]({'where':{'id':_0x10f77b[_0x8566('0x44')]['id']}})[_0x8566('0x23')](handleEntityNotFound(_0x5dad37,null))['then'](removeEntity(_0x5dad37,null))[_0x8566('0x43')](handleError(_0x5dad37,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 2f5289f..30a71ab 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 _0xde9f=['FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','api','moment','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xde9f,0x118));var _0xfde9=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xde9f[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfde9('0x1'));var moment=require(_0xfde9('0x2'));var BPromise=require('bluebird');var rp=require(_0xfde9('0x3'));var fs=require('fs');var path=require(_0xfde9('0x4'));var rimraf=require('rimraf');var config=require(_0xfde9('0x5'));var attributes=require(_0xfde9('0x6'));module[_0xfde9('0x7')]=function(_0xe30eaf,_0x5e69c0){return _0xe30eaf['define'](_0xfde9('0x8'),attributes,{'tableName':_0xfde9('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xfde9('0xa'),_0xfde9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f7a=['request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','int_freshsales_fields','freshsales_unique_index','idField','FieldId','../../config/logger','api','moment'];(function(_0x2ccd96,_0x5e1606){var _0x5f2289=function(_0xf8b1fb){while(--_0xf8b1fb){_0x2ccd96['push'](_0x2ccd96['shift']());}};_0x5f2289(++_0x5e1606);}(_0x4f7a,0x105));var _0xa4f7=function(_0xf1a202,_0x188714){_0xf1a202=_0xf1a202-0x0;var _0x50b6ce=_0x4f7a[_0xf1a202];return _0x50b6ce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4f7('0x0'))(_0xa4f7('0x1'));var moment=require(_0xa4f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xa4f7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4f7('0x4'));var config=require(_0xa4f7('0x5'));var attributes=require(_0xa4f7('0x6'));module['exports']=function(_0x31c8ab,_0x1d7c51){return _0x31c8ab['define']('FreshsalesField',attributes,{'tableName':_0xa4f7('0x7'),'paranoid':![],'indexes':[{'name':_0xa4f7('0x8'),'fields':[_0xa4f7('0x9'),_0xa4f7('0xa')],'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 2fe2bc3..a42c5d0 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x4b6cc8,_0x355e5b){var _0x5c4743=function(_0x68d0f6){while(--_0x68d0f6){_0x4b6cc8['push'](_0x4b6cc8['shift']());}};_0x5c4743(++_0x355e5b);}(_0x524e,0x15e));var _0xe524=function(_0x4d0e62,_0x2b4a08){_0x4d0e62=_0x4d0e62-0x0;var _0x3a4446=_0x524e[_0x4d0e62];return _0x3a4446;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xacf4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xacf4,0xe7));var _0x4acf=function(_0x27fd9e,_0x4cb1ed){_0x27fd9e=_0x27fd9e-0x0;var _0xc2fe24=_0xacf4[_0x27fd9e];return _0xc2fe24;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a4d780f..7b2823f 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(_0x7ee61c,_0x12bf46){var _0x4f2e57=function(_0x1bcf05){while(--_0x1bcf05){_0x7ee61c['push'](_0x7ee61c['shift']());}};_0x4f2e57(++_0x12bf46);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x4a39d7,_0x5ad3e3){var _0x3172ed=function(_0x2b7e1f){while(--_0x2b7e1f){_0x4a39d7['push'](_0x4a39d7['shift']());}};_0x3172ed(++_0x5ad3e3);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index cc5c776..4a8212f 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 _0x28a6=['integrationTab','newTab','exports','STRING'];(function(_0x95393e,_0x29e874){var _0x4a501c=function(_0x453a8a){while(--_0x453a8a){_0x95393e['push'](_0x95393e['shift']());}};_0x4a501c(++_0x29e874);}(_0x28a6,0x166));var _0x628a=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0x28a6[_0x51639a];return _0x3abae4;};'use strict';var Sequelize=require('sequelize');module[_0x628a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x628a('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x628a('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x628a('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x628a('0x2'),_0x628a('0x3')),'defaultValue':_0x628a('0x2')}}; \ No newline at end of file +var _0xc17d=['sequelize','exports','STRING','username','integrationTab'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0xc17d,0x96));var _0xdc17=function(_0x22a597,_0x1e583f){_0x22a597=_0x22a597-0x0;var _0x48d241=_0xc17d[_0x22a597];return _0x48d241;};'use strict';var Sequelize=require(_0xdc17('0x0'));module[_0xdc17('0x1')]={'name':{'type':Sequelize[_0xdc17('0x2')]},'description':{'type':Sequelize[_0xdc17('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xdc17('0x3')},'remoteUri':{'type':Sequelize[_0xdc17('0x2')]},'password':{'type':Sequelize[_0xdc17('0x2')]},'clientId':{'type':Sequelize[_0xdc17('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xdc17('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdc17('0x4'),'newTab'),'defaultValue':_0xdc17('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 8c92325..a7077ac 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 _0xec68=['channel','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','slice','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filters','merge','type','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','getConfigurations','findOne','params','SalesforceConfiguration','sort','nolimit','AccountId','Subjects','getDescriptions'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xec68,0x11e));var _0x8ec6=function(_0x48dfde,_0x1e455f){_0x48dfde=_0x48dfde-0x0;var _0x2dda4d=_0xec68[_0x48dfde];return _0x2dda4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ec6('0x0'));var zipdir=require(_0x8ec6('0x1'));var jsonpatch=require(_0x8ec6('0x2'));var rp=require(_0x8ec6('0x3'));var moment=require(_0x8ec6('0x4'));var BPromise=require(_0x8ec6('0x5'));var Mustache=require(_0x8ec6('0x6'));var util=require(_0x8ec6('0x7'));var path=require(_0x8ec6('0x8'));var sox=require(_0x8ec6('0x9'));var csv=require('to-csv');var ejs=require(_0x8ec6('0xa'));var fs=require('fs');var fs_extra=require(_0x8ec6('0xb'));var _=require(_0x8ec6('0xc'));var squel=require(_0x8ec6('0xd'));var crypto=require(_0x8ec6('0xe'));var jsforce=require(_0x8ec6('0xf'));var deskjs=require(_0x8ec6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8ec6('0x11'));var Papa=require('papaparse');var Redis=require(_0x8ec6('0x12'));var authService=require(_0x8ec6('0x13'));var qs=require(_0x8ec6('0x14'));var as=require(_0x8ec6('0x15'));var hardwareService=require(_0x8ec6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x8ec6('0x17'));var config=require(_0x8ec6('0x18'));var licenseUtil=require(_0x8ec6('0x19'));var db=require(_0x8ec6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5ee2ac,_0x2384fa){_0x2384fa=_0x2384fa||0xcc;return function(_0x19d83c){if(_0x19d83c){return _0x5ee2ac[_0x8ec6('0x1b')](_0x2384fa);}return _0x5ee2ac[_0x8ec6('0x1c')](_0x2384fa)[_0x8ec6('0x1d')]();};}function respondWithResult(_0x69fb3,_0x2ae2de){_0x2ae2de=_0x2ae2de||0xc8;return function(_0x351350){if(_0x351350){return _0x69fb3['status'](_0x2ae2de)['json'](_0x351350);}};}function respondWithFilteredResult(_0x673c00,_0x280842){return function(_0xa5c9f2){if(_0xa5c9f2){var _0x4bae92=typeof _0x280842['offset']===_0x8ec6('0x1e')&&typeof _0x280842[_0x8ec6('0x1f')]===_0x8ec6('0x1e');var _0x2a5065=_0xa5c9f2['count'];var _0x45f3c8=_0x4bae92?0x0:_0x280842[_0x8ec6('0x20')];var _0x5040fc=_0x4bae92?_0xa5c9f2[_0x8ec6('0x21')]:_0x280842[_0x8ec6('0x20')]+_0x280842[_0x8ec6('0x1f')];var _0x43975e;if(_0x5040fc>=_0x2a5065){_0x5040fc=_0x2a5065;_0x43975e=0xc8;}else{_0x43975e=0xce;}_0x673c00[_0x8ec6('0x1c')](_0x43975e);return _0x673c00[_0x8ec6('0x22')]('Content-Range',_0x45f3c8+'-'+_0x5040fc+'/'+_0x2a5065)['json'](_0xa5c9f2);}return null;};}function patchUpdates(_0x476002){return function(_0x520d4f){try{jsonpatch['apply'](_0x520d4f,_0x476002,!![]);}catch(_0x3bcc08){return BPromise[_0x8ec6('0x23')](_0x3bcc08);}return _0x520d4f[_0x8ec6('0x24')]();};}function saveUpdates(_0x47316e,_0x40348f){return function(_0xa858b1){if(_0xa858b1){return _0xa858b1['update'](_0x47316e)[_0x8ec6('0x25')](function(_0x449c3e){return _0x449c3e;});}return null;};}function removeEntity(_0x21be87,_0x36779d){return function(_0x8189f8){if(_0x8189f8){return _0x8189f8[_0x8ec6('0x26')]()[_0x8ec6('0x25')](function(){_0x21be87['status'](0xcc)[_0x8ec6('0x1d')]();});}};}function handleEntityNotFound(_0x371274,_0xb6a20a){return function(_0x13f33c){if(!_0x13f33c){_0x371274[_0x8ec6('0x1b')](0x194);}return _0x13f33c;};}function handleError(_0x44728b,_0x74ee2b){_0x74ee2b=_0x74ee2b||0x1f4;return function(_0x3a8a80){logger[_0x8ec6('0x27')](_0x3a8a80[_0x8ec6('0x28')]);if(_0x3a8a80[_0x8ec6('0x29')]){delete _0x3a8a80[_0x8ec6('0x29')];}_0x44728b[_0x8ec6('0x1c')](_0x74ee2b)[_0x8ec6('0x2a')](_0x3a8a80);};}exports[_0x8ec6('0x2b')]=function(_0x10e849,_0x26828d){var _0x41902c={},_0x3d0500={},_0x5cc46a={'count':0x0,'rows':[]};var _0x2fbd62=_[_0x8ec6('0x2c')](db[_0x8ec6('0x2d')]['rawAttributes'],function(_0x19bbfe){return{'name':_0x19bbfe[_0x8ec6('0x2e')],'type':_0x19bbfe['type'][_0x8ec6('0x2f')]};});_0x3d0500[_0x8ec6('0x30')]=_[_0x8ec6('0x2c')](_0x2fbd62,_0x8ec6('0x29'));_0x3d0500['query']=_[_0x8ec6('0x31')](_0x10e849[_0x8ec6('0x32')]);_0x3d0500['filters']=_[_0x8ec6('0x33')](_0x3d0500['model'],_0x3d0500[_0x8ec6('0x32')]);_0x41902c['attributes']=_[_0x8ec6('0x33')](_0x3d0500['model'],qs[_0x8ec6('0x34')](_0x10e849['query'][_0x8ec6('0x34')]));_0x41902c['attributes']=_0x41902c[_0x8ec6('0x35')][_0x8ec6('0x36')]?_0x41902c[_0x8ec6('0x35')]:_0x3d0500['model'];if(!_0x10e849[_0x8ec6('0x32')][_0x8ec6('0x37')]('nolimit')){_0x41902c[_0x8ec6('0x1f')]=qs[_0x8ec6('0x1f')](_0x10e849['query'][_0x8ec6('0x1f')]);_0x41902c[_0x8ec6('0x20')]=qs[_0x8ec6('0x20')](_0x10e849[_0x8ec6('0x32')]['offset']);}_0x41902c[_0x8ec6('0x38')]=qs['sort'](_0x10e849[_0x8ec6('0x32')]['sort']);_0x41902c[_0x8ec6('0x39')]=qs['filters'](_[_0x8ec6('0x3a')](_0x10e849[_0x8ec6('0x32')],_0x3d0500[_0x8ec6('0x3b')]),_0x2fbd62);if(_0x10e849['query']['filter']){_0x41902c[_0x8ec6('0x39')]=_[_0x8ec6('0x3c')](_0x41902c[_0x8ec6('0x39')],{'$or':_['map'](_0x2fbd62,function(_0x4cda0e){if(_0x4cda0e[_0x8ec6('0x3d')]!=='VIRTUAL'){var _0x232183={};_0x232183[_0x4cda0e[_0x8ec6('0x29')]]={'$like':'%'+_0x10e849['query'][_0x8ec6('0x3e')]+'%'};return _0x232183;}})});}_0x41902c=_['merge']({},_0x41902c,_0x10e849['options']);var _0x2eb2b1={'where':_0x41902c[_0x8ec6('0x39')]};return db['SalesforceAccount']['count'](_0x2eb2b1)[_0x8ec6('0x25')](function(_0x5c333b){_0x5cc46a[_0x8ec6('0x21')]=_0x5c333b;if(_0x10e849[_0x8ec6('0x32')][_0x8ec6('0x3f')]){_0x41902c[_0x8ec6('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x8ec6('0x41')](_0x41902c);})[_0x8ec6('0x25')](function(_0x3f2bcc){_0x5cc46a[_0x8ec6('0x42')]=_0x3f2bcc;return _0x5cc46a;})[_0x8ec6('0x25')](respondWithFilteredResult(_0x26828d,_0x41902c))[_0x8ec6('0x43')](handleError(_0x26828d,null));};exports[_0x8ec6('0x44')]=function(_0x169383,_0x2a6702){var _0x28f19a={'raw':![],'where':{'id':_0x169383['params']['id']}},_0x5c4e45={};_0x5c4e45['model']=_[_0x8ec6('0x31')](db[_0x8ec6('0x2d')][_0x8ec6('0x45')]);_0x5c4e45[_0x8ec6('0x32')]=_[_0x8ec6('0x31')](_0x169383[_0x8ec6('0x32')]);_0x5c4e45[_0x8ec6('0x3b')]=_['intersection'](_0x5c4e45[_0x8ec6('0x30')],_0x5c4e45[_0x8ec6('0x32')]);_0x28f19a[_0x8ec6('0x35')]=_[_0x8ec6('0x33')](_0x5c4e45[_0x8ec6('0x30')],qs['fields'](_0x169383[_0x8ec6('0x32')]['fields']));_0x28f19a[_0x8ec6('0x35')]=_0x28f19a[_0x8ec6('0x35')][_0x8ec6('0x36')]?_0x28f19a[_0x8ec6('0x35')]:_0x5c4e45[_0x8ec6('0x30')];if(_0x169383[_0x8ec6('0x32')][_0x8ec6('0x3f')]){_0x28f19a['include']=[{'all':!![]}];}_0x28f19a=_[_0x8ec6('0x3c')]({},_0x28f19a,_0x169383[_0x8ec6('0x46')]);return db[_0x8ec6('0x2d')][_0x8ec6('0x47')](_0x28f19a)['then'](handleEntityNotFound(_0x2a6702,null))['then'](respondWithResult(_0x2a6702,null))[_0x8ec6('0x43')](handleError(_0x2a6702,null));};exports[_0x8ec6('0x48')]=function(_0x35b0fb,_0x4abbad){return db[_0x8ec6('0x2d')][_0x8ec6('0x48')](_0x35b0fb[_0x8ec6('0x49')],{})[_0x8ec6('0x25')](respondWithResult(_0x4abbad,0xc9))[_0x8ec6('0x43')](handleError(_0x4abbad,null));};exports['update']=function(_0x141bd5,_0x185fbf){if(_0x141bd5[_0x8ec6('0x49')]['id']){delete _0x141bd5[_0x8ec6('0x49')]['id'];}return db['SalesforceAccount'][_0x8ec6('0x47')]({'where':{'id':_0x141bd5['params']['id']}})[_0x8ec6('0x25')](handleEntityNotFound(_0x185fbf,null))['then'](saveUpdates(_0x141bd5[_0x8ec6('0x49')],null))[_0x8ec6('0x25')](respondWithResult(_0x185fbf,null))[_0x8ec6('0x43')](handleError(_0x185fbf,null));};exports['destroy']=function(_0x59e7b7,_0x429bca){return db[_0x8ec6('0x2d')][_0x8ec6('0x47')]({'where':{'id':_0x59e7b7['params']['id']}})['then'](handleEntityNotFound(_0x429bca,null))['then'](removeEntity(_0x429bca,null))[_0x8ec6('0x43')](handleError(_0x429bca,null));};exports[_0x8ec6('0x4a')]=function(_0x39d802,_0x509cd8,_0x3b4ba0){var _0x3bc56e={};var _0x496903={};var _0x1408ec;var _0x45a107;return db[_0x8ec6('0x2d')][_0x8ec6('0x4b')]({'where':{'id':_0x39d802[_0x8ec6('0x4c')]['id']}})[_0x8ec6('0x25')](handleEntityNotFound(_0x509cd8,null))[_0x8ec6('0x25')](function(_0x55eda7){if(_0x55eda7){_0x1408ec=_0x55eda7;_0x496903[_0x8ec6('0x30')]=_[_0x8ec6('0x31')](db[_0x8ec6('0x4d')]['rawAttributes']);_0x496903['query']=_['keys'](_0x39d802[_0x8ec6('0x32')]);_0x496903[_0x8ec6('0x3b')]=_[_0x8ec6('0x33')](_0x496903[_0x8ec6('0x30')],_0x496903['query']);_0x3bc56e['attributes']=_[_0x8ec6('0x33')](_0x496903[_0x8ec6('0x30')],qs[_0x8ec6('0x34')](_0x39d802[_0x8ec6('0x32')][_0x8ec6('0x34')]));_0x3bc56e['attributes']=_0x3bc56e[_0x8ec6('0x35')]['length']?_0x3bc56e['attributes']:_0x496903[_0x8ec6('0x30')];_0x3bc56e['order']=qs[_0x8ec6('0x4e')](_0x39d802['query'][_0x8ec6('0x4e')]);_0x3bc56e[_0x8ec6('0x39')]=qs[_0x8ec6('0x3b')](_[_0x8ec6('0x3a')](_0x39d802[_0x8ec6('0x32')],_0x496903[_0x8ec6('0x3b')]));if(_0x39d802[_0x8ec6('0x32')][_0x8ec6('0x3e')]){_0x3bc56e['where']=_['merge'](_0x3bc56e[_0x8ec6('0x39')],{'$or':_['map'](_0x3bc56e[_0x8ec6('0x35')],function(_0x5b5690){var _0x58ec71={};_0x58ec71[_0x5b5690]={'$like':'%'+_0x39d802[_0x8ec6('0x32')]['filter']+'%'};return _0x58ec71;})});}_0x3bc56e=_[_0x8ec6('0x3c')]({},_0x3bc56e,_0x39d802['options']);return _0x1408ec[_0x8ec6('0x4a')](_0x3bc56e);}})['then'](function(_0x1c563d){if(_0x1c563d){_0x45a107=_0x1c563d[_0x8ec6('0x36')];if(!_0x39d802[_0x8ec6('0x32')][_0x8ec6('0x37')](_0x8ec6('0x4f'))){_0x3bc56e[_0x8ec6('0x1f')]=qs[_0x8ec6('0x1f')](_0x39d802[_0x8ec6('0x32')][_0x8ec6('0x1f')]);_0x3bc56e[_0x8ec6('0x20')]=qs[_0x8ec6('0x20')](_0x39d802[_0x8ec6('0x32')][_0x8ec6('0x20')]);}return _0x1408ec[_0x8ec6('0x4a')](_0x3bc56e);}})[_0x8ec6('0x25')](function(_0xf1ce4d){if(_0xf1ce4d){return _0xf1ce4d?{'count':_0x45a107,'rows':_0xf1ce4d}:null;}})[_0x8ec6('0x25')](respondWithResult(_0x509cd8,null))[_0x8ec6('0x43')](handleError(_0x509cd8,null));};exports['addConfiguration']=function(_0x4be61b,_0x66a9cc,_0x31a8e0){if(_0x4be61b[_0x8ec6('0x49')]['id']){delete _0x4be61b[_0x8ec6('0x49')]['id'];}return db[_0x8ec6('0x2d')][_0x8ec6('0x4b')]({'where':{'id':_0x4be61b[_0x8ec6('0x4c')]['id']}})[_0x8ec6('0x25')](handleEntityNotFound(_0x66a9cc,null))[_0x8ec6('0x25')](function(_0x26fff3){if(_0x26fff3){_0x4be61b[_0x8ec6('0x49')][_0x8ec6('0x50')]=_0x26fff3['id'];_0x4be61b[_0x8ec6('0x49')][_0x8ec6('0x51')]=integrations['getSubjects'](_0x4be61b['body']['channel'],_0x4be61b[_0x8ec6('0x49')][_0x8ec6('0x3d')]);_0x4be61b[_0x8ec6('0x49')]['Descriptions']=integrations[_0x8ec6('0x52')](_0x4be61b[_0x8ec6('0x49')][_0x8ec6('0x53')],_0x4be61b['body'][_0x8ec6('0x3d')]);return db[_0x8ec6('0x4d')][_0x8ec6('0x48')](_0x4be61b['body'],{'include':[{'model':db[_0x8ec6('0x54')],'as':_0x8ec6('0x51')},{'model':db[_0x8ec6('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x66a9cc,null))[_0x8ec6('0x43')](handleError(_0x66a9cc,null));};exports['getFields']=function(_0x2344cd,_0x49f746,_0x421fe4){var _0x290317;var _0x5f0023='';var _0x5aef2b=_0x8ec6('0x55');return db['SalesforceAccount'][_0x8ec6('0x4b')]({'where':{'id':_0x2344cd[_0x8ec6('0x4c')]['id']},'attributes':['id',_0x8ec6('0x56'),_0x8ec6('0x57'),_0x8ec6('0x58'),_0x8ec6('0x59'),_0x8ec6('0x5a'),'securityToken']})['then'](handleEntityNotFound(_0x49f746,null))['then'](function(_0x30871b){if(_0x30871b){_0x5f0023=_0x30871b['remoteUri'];var _0x585bd7=_0x5f0023[_0x8ec6('0x5b')](-0x1);if(_0x585bd7==='/'){_0x5f0023=_0x5f0023['substring'](0x0,_0x5f0023[_0x8ec6('0x5c')](_0x585bd7));}_0x290317=new jsforce[(_0x8ec6('0x5d'))]({'oauth2':{'loginUrl':_0x5f0023,'clientId':_0x30871b[_0x8ec6('0x57')],'clientSecret':_0x30871b[_0x8ec6('0x58')]}});return _0x290317[_0x8ec6('0x5e')](_0x30871b[_0x8ec6('0x59')],_0x30871b[_0x8ec6('0x5a')][_0x8ec6('0x5f')](_0x30871b[_0x8ec6('0x60')]));}})['then'](function(_0x3af254){if(_0x3af254){if(!_['isNil'](_0x2344cd[_0x8ec6('0x32')]['ticketType'])){_0x5aef2b=_0x2344cd[_0x8ec6('0x32')][_0x8ec6('0x61')];}return _0x290317[_0x8ec6('0x62')](_0x5aef2b)[_0x8ec6('0x63')]();}})[_0x8ec6('0x25')](function(_0x1b17fe){var _0x9ab18a=[_0x8ec6('0x64'),_0x8ec6('0x65'),_0x8ec6('0x66'),'IsRecurrence',_0x8ec6('0x67'),_0x8ec6('0x68')];var _0xc8cb11=[_0x8ec6('0x69'),'int',_0x8ec6('0x6a'),_0x8ec6('0x6b'),_0x8ec6('0x6c'),_0x8ec6('0x6d'),_0x8ec6('0x6e')];if(_0x1b17fe){_[_0x8ec6('0x6f')](_0x1b17fe[_0x8ec6('0x34')],function(_0x4b9166){return _0x9ab18a[_0x8ec6('0x70')](_0x4b9166[_0x8ec6('0x29')])||!_0xc8cb11['includes'](_0x4b9166['type']);});return{'count':_0x1b17fe['fields'][_0x8ec6('0x36')],'rows':_[_0x8ec6('0x2c')](_0x1b17fe[_0x8ec6('0x34')],function(_0x252184){return{'id':_0x252184[_0x8ec6('0x29')],'name':_0x252184[_0x8ec6('0x71')],'custom':_0x252184['custom'],'options':_0x252184[_0x8ec6('0x72')][_0x8ec6('0x36')]>0x0?_[_0x8ec6('0x2c')](_0x252184[_0x8ec6('0x72')],function(_0x3bc241){return{'name':_0x3bc241['label'],'value':_0x3bc241[_0x8ec6('0x73')]};}):_0x252184[_0x8ec6('0x3d')]==_0x8ec6('0x6b')?[{'name':'True','value':_0x8ec6('0x74')},{'name':'False','value':_0x8ec6('0x75')}]:[]};})};}})[_0x8ec6('0x25')](respondWithResult(_0x49f746,null))[_0x8ec6('0x43')](function(_0x478eaf){var _0x27dff5=_0x2344cd[_0x8ec6('0x32')][_0x8ec6('0x76')]?0x1f4:_0x478eaf[_0x8ec6('0x77')]||0x1f4;logger[_0x8ec6('0x27')](_0x8ec6('0x78'),_0x8ec6('0x79'),_0x27dff5,JSON[_0x8ec6('0x7a')](_0x478eaf));delete _0x478eaf['name'];if(_0x27dff5===0x191){_0x27dff5=0x190;}_0x49f746['status'](_0x27dff5)['send'](_0x2344cd[_0x8ec6('0x32')][_0x8ec6('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x478eaf[_0x8ec6('0x77')]}:_0x478eaf);});}; \ No newline at end of file +var _0xb13d=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','rows','catch','show','params','rawAttributes','includeAll','include','create','body','find','getConfigurations','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','Subjects','getFields','Task','findOne','remoteUri','clientId','username','password','securityToken','substring','Connection','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xb13d,0x1c9));var _0xdb13=function(_0x469e07,_0x399266){_0x469e07=_0x469e07-0x0;var _0x44a8c8=_0xb13d[_0x469e07];return _0x44a8c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb13('0x0'));var zipdir=require(_0xdb13('0x1'));var jsonpatch=require(_0xdb13('0x2'));var rp=require(_0xdb13('0x3'));var moment=require(_0xdb13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb13('0x5'));var util=require(_0xdb13('0x6'));var path=require(_0xdb13('0x7'));var sox=require(_0xdb13('0x8'));var csv=require(_0xdb13('0x9'));var ejs=require(_0xdb13('0xa'));var fs=require('fs');var fs_extra=require(_0xdb13('0xb'));var _=require(_0xdb13('0xc'));var squel=require(_0xdb13('0xd'));var crypto=require(_0xdb13('0xe'));var jsforce=require(_0xdb13('0xf'));var deskjs=require(_0xdb13('0x10'));var toCsv=require(_0xdb13('0x9'));var querystring=require(_0xdb13('0x11'));var Papa=require(_0xdb13('0x12'));var Redis=require('ioredis');var authService=require(_0xdb13('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdb13('0x14'));var hardwareService=require(_0xdb13('0x15'));var logger=require(_0xdb13('0x16'))(_0xdb13('0x17'));var utils=require(_0xdb13('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdb13('0x19'));var db=require(_0xdb13('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x455eeb,_0x59e905){_0x59e905=_0x59e905||0xcc;return function(_0x2bf410){if(_0x2bf410){return _0x455eeb[_0xdb13('0x1b')](_0x59e905);}return _0x455eeb[_0xdb13('0x1c')](_0x59e905)[_0xdb13('0x1d')]();};}function respondWithResult(_0x39710e,_0x199d60){_0x199d60=_0x199d60||0xc8;return function(_0x1eb3f5){if(_0x1eb3f5){return _0x39710e[_0xdb13('0x1c')](_0x199d60)['json'](_0x1eb3f5);}};}function respondWithFilteredResult(_0x65926f,_0x1e5c94){return function(_0x156470){if(_0x156470){var _0x18e87d=typeof _0x1e5c94[_0xdb13('0x1e')]===_0xdb13('0x1f')&&typeof _0x1e5c94[_0xdb13('0x20')]===_0xdb13('0x1f');var _0x34a80d=_0x156470[_0xdb13('0x21')];var _0xc921ac=_0x18e87d?0x0:_0x1e5c94[_0xdb13('0x1e')];var _0x3a0056=_0x18e87d?_0x156470[_0xdb13('0x21')]:_0x1e5c94[_0xdb13('0x1e')]+_0x1e5c94['limit'];var _0x250818;if(_0x3a0056>=_0x34a80d){_0x3a0056=_0x34a80d;_0x250818=0xc8;}else{_0x250818=0xce;}_0x65926f[_0xdb13('0x1c')](_0x250818);return _0x65926f[_0xdb13('0x22')](_0xdb13('0x23'),_0xc921ac+'-'+_0x3a0056+'/'+_0x34a80d)[_0xdb13('0x24')](_0x156470);}return null;};}function patchUpdates(_0x33f179){return function(_0x4c9632){try{jsonpatch['apply'](_0x4c9632,_0x33f179,!![]);}catch(_0x932eac){return BPromise[_0xdb13('0x25')](_0x932eac);}return _0x4c9632['save']();};}function saveUpdates(_0x3641a4,_0x263873){return function(_0x5cd793){if(_0x5cd793){return _0x5cd793[_0xdb13('0x26')](_0x3641a4)[_0xdb13('0x27')](function(_0x5939fc){return _0x5939fc;});}return null;};}function removeEntity(_0x123f64,_0x26f9fc){return function(_0x2acd39){if(_0x2acd39){return _0x2acd39[_0xdb13('0x28')]()[_0xdb13('0x27')](function(){_0x123f64[_0xdb13('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3765ab,_0x224760){return function(_0x33f0f6){if(!_0x33f0f6){_0x3765ab[_0xdb13('0x1b')](0x194);}return _0x33f0f6;};}function handleError(_0x2dc3db,_0xedbb6a){_0xedbb6a=_0xedbb6a||0x1f4;return function(_0x4ebc5d){logger[_0xdb13('0x29')](_0x4ebc5d[_0xdb13('0x2a')]);if(_0x4ebc5d[_0xdb13('0x2b')]){delete _0x4ebc5d[_0xdb13('0x2b')];}_0x2dc3db[_0xdb13('0x1c')](_0xedbb6a)[_0xdb13('0x2c')](_0x4ebc5d);};}exports['index']=function(_0x543c63,_0x550cd9){var _0x47ff86={},_0x2e444d={},_0x9e1d7c={'count':0x0,'rows':[]};var _0x457c2e=_[_0xdb13('0x2d')](db[_0xdb13('0x2e')]['rawAttributes'],function(_0x7b2fb6){return{'name':_0x7b2fb6[_0xdb13('0x2f')],'type':_0x7b2fb6[_0xdb13('0x30')][_0xdb13('0x31')]};});_0x2e444d[_0xdb13('0x32')]=_['map'](_0x457c2e,'name');_0x2e444d[_0xdb13('0x33')]=_[_0xdb13('0x34')](_0x543c63[_0xdb13('0x33')]);_0x2e444d[_0xdb13('0x35')]=_[_0xdb13('0x36')](_0x2e444d['model'],_0x2e444d[_0xdb13('0x33')]);_0x47ff86[_0xdb13('0x37')]=_['intersection'](_0x2e444d['model'],qs[_0xdb13('0x38')](_0x543c63[_0xdb13('0x33')][_0xdb13('0x38')]));_0x47ff86[_0xdb13('0x37')]=_0x47ff86[_0xdb13('0x37')][_0xdb13('0x39')]?_0x47ff86['attributes']:_0x2e444d[_0xdb13('0x32')];if(!_0x543c63['query'][_0xdb13('0x3a')](_0xdb13('0x3b'))){_0x47ff86[_0xdb13('0x20')]=qs['limit'](_0x543c63[_0xdb13('0x33')]['limit']);_0x47ff86['offset']=qs[_0xdb13('0x1e')](_0x543c63[_0xdb13('0x33')][_0xdb13('0x1e')]);}_0x47ff86['order']=qs[_0xdb13('0x3c')](_0x543c63[_0xdb13('0x33')]['sort']);_0x47ff86['where']=qs['filters'](_[_0xdb13('0x3d')](_0x543c63[_0xdb13('0x33')],_0x2e444d[_0xdb13('0x35')]),_0x457c2e);if(_0x543c63[_0xdb13('0x33')][_0xdb13('0x3e')]){_0x47ff86[_0xdb13('0x3f')]=_[_0xdb13('0x40')](_0x47ff86['where'],{'$or':_[_0xdb13('0x2d')](_0x457c2e,function(_0x2613d4){if(_0x2613d4['type']!=='VIRTUAL'){var _0x3cf70c={};_0x3cf70c[_0x2613d4[_0xdb13('0x2b')]]={'$like':'%'+_0x543c63['query']['filter']+'%'};return _0x3cf70c;}})});}_0x47ff86=_[_0xdb13('0x40')]({},_0x47ff86,_0x543c63[_0xdb13('0x41')]);var _0x184192={'where':_0x47ff86[_0xdb13('0x3f')]};return db[_0xdb13('0x2e')][_0xdb13('0x21')](_0x184192)[_0xdb13('0x27')](function(_0x27f322){_0x9e1d7c[_0xdb13('0x21')]=_0x27f322;if(_0x543c63[_0xdb13('0x33')]['includeAll']){_0x47ff86['include']=[{'all':!![]}];}return db[_0xdb13('0x2e')]['findAll'](_0x47ff86);})['then'](function(_0x5063d6){_0x9e1d7c[_0xdb13('0x42')]=_0x5063d6;return _0x9e1d7c;})[_0xdb13('0x27')](respondWithFilteredResult(_0x550cd9,_0x47ff86))[_0xdb13('0x43')](handleError(_0x550cd9,null));};exports[_0xdb13('0x44')]=function(_0x308e92,_0x12551a){var _0x30cfb7={'raw':![],'where':{'id':_0x308e92[_0xdb13('0x45')]['id']}},_0x422f83={};_0x422f83['model']=_['keys'](db[_0xdb13('0x2e')][_0xdb13('0x46')]);_0x422f83[_0xdb13('0x33')]=_[_0xdb13('0x34')](_0x308e92['query']);_0x422f83[_0xdb13('0x35')]=_['intersection'](_0x422f83[_0xdb13('0x32')],_0x422f83[_0xdb13('0x33')]);_0x30cfb7['attributes']=_['intersection'](_0x422f83[_0xdb13('0x32')],qs['fields'](_0x308e92[_0xdb13('0x33')][_0xdb13('0x38')]));_0x30cfb7['attributes']=_0x30cfb7[_0xdb13('0x37')]['length']?_0x30cfb7[_0xdb13('0x37')]:_0x422f83[_0xdb13('0x32')];if(_0x308e92['query'][_0xdb13('0x47')]){_0x30cfb7[_0xdb13('0x48')]=[{'all':!![]}];}_0x30cfb7=_[_0xdb13('0x40')]({},_0x30cfb7,_0x308e92[_0xdb13('0x41')]);return db[_0xdb13('0x2e')]['find'](_0x30cfb7)['then'](handleEntityNotFound(_0x12551a,null))[_0xdb13('0x27')](respondWithResult(_0x12551a,null))[_0xdb13('0x43')](handleError(_0x12551a,null));};exports[_0xdb13('0x49')]=function(_0x55e664,_0x4c8ac8){return db[_0xdb13('0x2e')][_0xdb13('0x49')](_0x55e664['body'],{})[_0xdb13('0x27')](respondWithResult(_0x4c8ac8,0xc9))['catch'](handleError(_0x4c8ac8,null));};exports[_0xdb13('0x26')]=function(_0x518218,_0x489247){if(_0x518218[_0xdb13('0x4a')]['id']){delete _0x518218['body']['id'];}return db[_0xdb13('0x2e')][_0xdb13('0x4b')]({'where':{'id':_0x518218[_0xdb13('0x45')]['id']}})['then'](handleEntityNotFound(_0x489247,null))[_0xdb13('0x27')](saveUpdates(_0x518218[_0xdb13('0x4a')],null))['then'](respondWithResult(_0x489247,null))[_0xdb13('0x43')](handleError(_0x489247,null));};exports['destroy']=function(_0x317de8,_0x4e1837){return db['SalesforceAccount']['find']({'where':{'id':_0x317de8[_0xdb13('0x45')]['id']}})[_0xdb13('0x27')](handleEntityNotFound(_0x4e1837,null))[_0xdb13('0x27')](removeEntity(_0x4e1837,null))[_0xdb13('0x43')](handleError(_0x4e1837,null));};exports[_0xdb13('0x4c')]=function(_0x43b0d8,_0x821b65,_0x251c8d){var _0x3efca6={};var _0x2cfc79={};var _0x2c2e78;var _0x47d3c9;return db[_0xdb13('0x2e')]['findOne']({'where':{'id':_0x43b0d8[_0xdb13('0x45')]['id']}})['then'](handleEntityNotFound(_0x821b65,null))['then'](function(_0x50aaee){if(_0x50aaee){_0x2c2e78=_0x50aaee;_0x2cfc79[_0xdb13('0x32')]=_[_0xdb13('0x34')](db[_0xdb13('0x4d')][_0xdb13('0x46')]);_0x2cfc79[_0xdb13('0x33')]=_[_0xdb13('0x34')](_0x43b0d8[_0xdb13('0x33')]);_0x2cfc79['filters']=_[_0xdb13('0x36')](_0x2cfc79['model'],_0x2cfc79[_0xdb13('0x33')]);_0x3efca6['attributes']=_[_0xdb13('0x36')](_0x2cfc79[_0xdb13('0x32')],qs[_0xdb13('0x38')](_0x43b0d8[_0xdb13('0x33')][_0xdb13('0x38')]));_0x3efca6[_0xdb13('0x37')]=_0x3efca6['attributes'][_0xdb13('0x39')]?_0x3efca6['attributes']:_0x2cfc79[_0xdb13('0x32')];_0x3efca6['order']=qs[_0xdb13('0x3c')](_0x43b0d8[_0xdb13('0x33')][_0xdb13('0x3c')]);_0x3efca6['where']=qs[_0xdb13('0x35')](_['pick'](_0x43b0d8[_0xdb13('0x33')],_0x2cfc79[_0xdb13('0x35')]));if(_0x43b0d8[_0xdb13('0x33')][_0xdb13('0x3e')]){_0x3efca6[_0xdb13('0x3f')]=_[_0xdb13('0x40')](_0x3efca6[_0xdb13('0x3f')],{'$or':_[_0xdb13('0x2d')](_0x3efca6[_0xdb13('0x37')],function(_0x17fef7){var _0x3daa1a={};_0x3daa1a[_0x17fef7]={'$like':'%'+_0x43b0d8[_0xdb13('0x33')][_0xdb13('0x3e')]+'%'};return _0x3daa1a;})});}_0x3efca6=_[_0xdb13('0x40')]({},_0x3efca6,_0x43b0d8[_0xdb13('0x41')]);return _0x2c2e78[_0xdb13('0x4c')](_0x3efca6);}})[_0xdb13('0x27')](function(_0x4c7250){if(_0x4c7250){_0x47d3c9=_0x4c7250[_0xdb13('0x39')];if(!_0x43b0d8[_0xdb13('0x33')][_0xdb13('0x3a')]('nolimit')){_0x3efca6['limit']=qs[_0xdb13('0x20')](_0x43b0d8[_0xdb13('0x33')][_0xdb13('0x20')]);_0x3efca6['offset']=qs['offset'](_0x43b0d8[_0xdb13('0x33')][_0xdb13('0x1e')]);}return _0x2c2e78[_0xdb13('0x4c')](_0x3efca6);}})[_0xdb13('0x27')](function(_0x1ad7ca){if(_0x1ad7ca){return _0x1ad7ca?{'count':_0x47d3c9,'rows':_0x1ad7ca}:null;}})[_0xdb13('0x27')](respondWithResult(_0x821b65,null))['catch'](handleError(_0x821b65,null));};exports[_0xdb13('0x4e')]=function(_0xc8157d,_0x214d48,_0x56701d){if(_0xc8157d[_0xdb13('0x4a')]['id']){delete _0xc8157d['body']['id'];}return db[_0xdb13('0x2e')]['findOne']({'where':{'id':_0xc8157d[_0xdb13('0x45')]['id']}})[_0xdb13('0x27')](handleEntityNotFound(_0x214d48,null))[_0xdb13('0x27')](function(_0x94f610){if(_0x94f610){_0xc8157d[_0xdb13('0x4a')][_0xdb13('0x4f')]=_0x94f610['id'];_0xc8157d[_0xdb13('0x4a')]['Subjects']=integrations[_0xdb13('0x50')](_0xc8157d[_0xdb13('0x4a')][_0xdb13('0x51')],_0xc8157d[_0xdb13('0x4a')]['type']);_0xc8157d[_0xdb13('0x4a')][_0xdb13('0x52')]=integrations['getDescriptions'](_0xc8157d[_0xdb13('0x4a')][_0xdb13('0x51')],_0xc8157d[_0xdb13('0x4a')][_0xdb13('0x30')]);return db[_0xdb13('0x4d')][_0xdb13('0x49')](_0xc8157d[_0xdb13('0x4a')],{'include':[{'model':db[_0xdb13('0x53')],'as':_0xdb13('0x54')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xdb13('0x27')](respondWithResult(_0x214d48,null))[_0xdb13('0x43')](handleError(_0x214d48,null));};exports[_0xdb13('0x55')]=function(_0x32d36e,_0xf68ff4,_0xc5a17a){var _0x25c666;var _0x55f442='';var _0x480f6a=_0xdb13('0x56');return db['SalesforceAccount'][_0xdb13('0x57')]({'where':{'id':_0x32d36e['params']['id']},'attributes':['id',_0xdb13('0x58'),_0xdb13('0x59'),'clientSecret',_0xdb13('0x5a'),_0xdb13('0x5b'),_0xdb13('0x5c')]})[_0xdb13('0x27')](handleEntityNotFound(_0xf68ff4,null))[_0xdb13('0x27')](function(_0x1c3fc7){if(_0x1c3fc7){_0x55f442=_0x1c3fc7[_0xdb13('0x58')];var _0x4a797b=_0x55f442['slice'](-0x1);if(_0x4a797b==='/'){_0x55f442=_0x55f442[_0xdb13('0x5d')](0x0,_0x55f442['lastIndexOf'](_0x4a797b));}_0x25c666=new jsforce[(_0xdb13('0x5e'))]({'oauth2':{'loginUrl':_0x55f442,'clientId':_0x1c3fc7[_0xdb13('0x59')],'clientSecret':_0x1c3fc7['clientSecret']}});return _0x25c666['login'](_0x1c3fc7[_0xdb13('0x5a')],_0x1c3fc7[_0xdb13('0x5b')]['concat'](_0x1c3fc7['securityToken']));}})[_0xdb13('0x27')](function(_0x3b5621){if(_0x3b5621){if(!_['isNil'](_0x32d36e['query'][_0xdb13('0x5f')])){_0x480f6a=_0x32d36e[_0xdb13('0x33')][_0xdb13('0x5f')];}return _0x25c666['sobject'](_0x480f6a)[_0xdb13('0x60')]();}})[_0xdb13('0x27')](function(_0x5eb7bc){var _0x250c05=[_0xdb13('0x61'),_0xdb13('0x62'),_0xdb13('0x63'),_0xdb13('0x64'),_0xdb13('0x65'),_0xdb13('0x66')];var _0x21ea69=[_0xdb13('0x67'),'int',_0xdb13('0x68'),_0xdb13('0x69'),_0xdb13('0x6a'),_0xdb13('0x6b'),_0xdb13('0x6c')];if(_0x5eb7bc){_['remove'](_0x5eb7bc[_0xdb13('0x38')],function(_0x3ec62a){return _0x250c05['includes'](_0x3ec62a['name'])||!_0x21ea69[_0xdb13('0x6d')](_0x3ec62a['type']);});return{'count':_0x5eb7bc['fields'][_0xdb13('0x39')],'rows':_[_0xdb13('0x2d')](_0x5eb7bc['fields'],function(_0x13895c){return{'id':_0x13895c['name'],'name':_0x13895c[_0xdb13('0x6e')],'custom':_0x13895c[_0xdb13('0x6f')],'options':_0x13895c[_0xdb13('0x70')][_0xdb13('0x39')]>0x0?_[_0xdb13('0x2d')](_0x13895c[_0xdb13('0x70')],function(_0xb88782){return{'name':_0xb88782[_0xdb13('0x6e')],'value':_0xb88782[_0xdb13('0x71')]};}):_0x13895c['type']==_0xdb13('0x69')?[{'name':_0xdb13('0x72'),'value':'true'},{'name':'False','value':'false'}]:[]};})};}})[_0xdb13('0x27')](respondWithResult(_0xf68ff4,null))['catch'](function(_0x2568c2){var _0x5bcf29=_0x32d36e['query'][_0xdb13('0x73')]?0x1f4:_0x2568c2[_0xdb13('0x74')]||0x1f4;logger[_0xdb13('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xdb13('0x55'),_0x5bcf29,JSON[_0xdb13('0x75')](_0x2568c2));delete _0x2568c2[_0xdb13('0x2b')];if(_0x5bcf29===0x191){_0x5bcf29=0x190;}_0xf68ff4['status'](_0x5bcf29)[_0xdb13('0x2c')](_0x32d36e[_0xdb13('0x33')][_0xdb13('0x73')]?{'message':_0xdb13('0x76'),'statusCode':_0x2568c2['statusCode']}:_0x2568c2);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 253cdfe..49e59b7 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 _0x8583=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x12b863,_0x21ccaf){var _0x4ca90c=function(_0x2731c0){while(--_0x2731c0){_0x12b863['push'](_0x12b863['shift']());}};_0x4ca90c(++_0x21ccaf);}(_0x8583,0x183));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3858('0x0'));var util=require(_0x3858('0x1'));var logger=require(_0x3858('0x2'))('api');var moment=require(_0x3858('0x3'));var BPromise=require(_0x3858('0x4'));var rp=require(_0x3858('0x5'));var fs=require('fs');var path=require(_0x3858('0x6'));var rimraf=require(_0x3858('0x7'));var config=require(_0x3858('0x8'));var attributes=require(_0x3858('0x9'));var integrations=require(_0x3858('0xa'));module[_0x3858('0xb')]=function(_0x1796ef,_0x1b29a8){return _0x1796ef[_0x3858('0xc')](_0x3858('0xd'),attributes,{'tableName':_0x3858('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd5=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','api'];(function(_0x22df9f,_0x9ec477){var _0x4ed906=function(_0x3bdb69){while(--_0x3bdb69){_0x22df9f['push'](_0x22df9f['shift']());}};_0x4ed906(++_0x9ec477);}(_0x4cd5,0x72));var _0x54cd=function(_0x26dd79,_0x37603d){_0x26dd79=_0x26dd79-0x0;var _0x3c3798=_0x4cd5[_0x26dd79];return _0x3c3798;};'use strict';var _=require(_0x54cd('0x0'));var util=require(_0x54cd('0x1'));var logger=require('../../config/logger')(_0x54cd('0x2'));var moment=require('moment');var BPromise=require(_0x54cd('0x3'));var rp=require(_0x54cd('0x4'));var fs=require('fs');var path=require(_0x54cd('0x5'));var rimraf=require(_0x54cd('0x6'));var config=require(_0x54cd('0x7'));var attributes=require(_0x54cd('0x8'));var integrations=require(_0x54cd('0x9'));module[_0x54cd('0xa')]=function(_0x2382d2,_0x191c97){return _0x2382d2[_0x54cd('0xb')](_0x54cd('0xc'),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 a55aa6c..823e057 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 _0x08e2=['raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetSalesforceAccount','SalesforceAccount','findAll','options'];(function(_0x35160c,_0x161d0a){var _0x3d3ae5=function(_0x5a0bb6){while(--_0x5a0bb6){_0x35160c['push'](_0x35160c['shift']());}};_0x3d3ae5(++_0x161d0a);}(_0x08e2,0xe0));var _0x208e=function(_0x33b588,_0x447703){_0x33b588=_0x33b588-0x0;var _0x3267e9=_0x08e2[_0x33b588];return _0x3267e9;};'use strict';var _=require(_0x208e('0x0'));var util=require(_0x208e('0x1'));var moment=require(_0x208e('0x2'));var BPromise=require(_0x208e('0x3'));var rs=require(_0x208e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x208e('0x5'));var logger=require(_0x208e('0x6'))(_0x208e('0x7'));var config=require(_0x208e('0x8'));var jayson=require(_0x208e('0x9'));var client=jayson[_0x208e('0xa')][_0x208e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17e1fe,_0x4eb19c,_0x584658){return new BPromise(function(_0x3b5841,_0x19b511){return client[_0x208e('0xc')](_0x17e1fe,_0x584658)[_0x208e('0xd')](function(_0x3babaf){logger['info'](_0x208e('0xe'),_0x4eb19c,_0x208e('0xf'));logger[_0x208e('0x10')](_0x208e('0x11'),_0x4eb19c,_0x208e('0xf'),JSON[_0x208e('0x12')](_0x3babaf));if(_0x3babaf[_0x208e('0x13')]){if(_0x3babaf[_0x208e('0x13')][_0x208e('0x14')]===0x1f4){logger[_0x208e('0x13')](_0x208e('0xe'),_0x4eb19c,_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);return _0x19b511(_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);}logger[_0x208e('0x13')](_0x208e('0xe'),_0x4eb19c,_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);return _0x3b5841(_0x3babaf[_0x208e('0x13')][_0x208e('0x15')]);}else{logger[_0x208e('0x16')](_0x208e('0xe'),_0x4eb19c,'request\x20sent');_0x3b5841(_0x3babaf['result'][_0x208e('0x15')]);}})[_0x208e('0x17')](function(_0x1223d2){logger[_0x208e('0x13')](_0x208e('0xe'),_0x4eb19c,_0x1223d2);_0x19b511(_0x1223d2);});});}exports[_0x208e('0x18')]=function(_0x5641cc){var _0x2237fc=this;return new Promise(function(_0x1b247d,_0x500e4f){return db[_0x208e('0x19')][_0x208e('0x1a')]({'raw':_0x5641cc['options']?_0x5641cc[_0x208e('0x1b')][_0x208e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5641cc[_0x208e('0x1b')]?_0x5641cc['options'][_0x208e('0x1d')]||null:null,'attributes':_0x5641cc[_0x208e('0x1b')]?_0x5641cc[_0x208e('0x1b')][_0x208e('0x1e')]||null:null,'limit':_0x5641cc[_0x208e('0x1b')]?_0x5641cc[_0x208e('0x1b')][_0x208e('0x1f')]||null:null,'include':_0x5641cc[_0x208e('0x1b')]?_0x5641cc['options'][_0x208e('0x20')]?_[_0x208e('0x21')](_0x5641cc[_0x208e('0x1b')][_0x208e('0x20')],function(_0x1777de){return{'model':db[_0x1777de[_0x208e('0x22')]],'as':_0x1777de['as'],'attributes':_0x1777de['attributes'],'include':_0x1777de[_0x208e('0x20')]?_[_0x208e('0x21')](_0x1777de[_0x208e('0x20')],function(_0x2cc8b9){return{'model':db[_0x2cc8b9['model']],'as':_0x2cc8b9['as'],'attributes':_0x2cc8b9[_0x208e('0x1e')],'include':_0x2cc8b9[_0x208e('0x20')]?_[_0x208e('0x21')](_0x2cc8b9[_0x208e('0x20')],function(_0x569179){return{'model':db[_0x569179[_0x208e('0x22')]],'as':_0x569179['as'],'attributes':_0x569179[_0x208e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x208e('0xd')](function(_0x2ec344){logger[_0x208e('0x16')](_0x208e('0x18'),_0x5641cc);logger['debug'](_0x208e('0x18'),_0x5641cc,JSON[_0x208e('0x12')](_0x2ec344));_0x1b247d(_0x2ec344);})[_0x208e('0x17')](function(_0x34e91c){logger[_0x208e('0x13')](_0x208e('0x18'),_0x34e91c['message'],_0x5641cc);_0x500e4f(_0x2237fc[_0x208e('0x13')](0x1f4,_0x34e91c[_0x208e('0x15')]));});});};exports[_0x208e('0x23')]=function(_0x11abd9){var _0x5f1cf4=this;return new Promise(function(_0x106c06,_0xc8a3ab){return db[_0x208e('0x19')]['find']({'raw':_0x11abd9['options']?_0x11abd9['options'][_0x208e('0x1c')]===undefined?!![]:![]:!![],'where':_0x11abd9[_0x208e('0x1b')]?_0x11abd9[_0x208e('0x1b')][_0x208e('0x1d')]||null:null,'attributes':_0x11abd9['options']?_0x11abd9[_0x208e('0x1b')][_0x208e('0x1e')]||null:null,'include':_0x11abd9[_0x208e('0x1b')]?_0x11abd9['options']['include']?_[_0x208e('0x21')](_0x11abd9[_0x208e('0x1b')][_0x208e('0x20')],function(_0x451704){return{'model':db[_0x451704[_0x208e('0x22')]],'as':_0x451704['as'],'attributes':_0x451704[_0x208e('0x1e')],'include':_0x451704[_0x208e('0x20')]?_[_0x208e('0x21')](_0x451704['include'],function(_0x2e99d3){return{'model':db[_0x2e99d3['model']],'as':_0x2e99d3['as'],'attributes':_0x2e99d3[_0x208e('0x1e')],'include':_0x2e99d3[_0x208e('0x20')]?_[_0x208e('0x21')](_0x2e99d3[_0x208e('0x20')],function(_0x3d9961){return{'model':db[_0x3d9961[_0x208e('0x22')]],'as':_0x3d9961['as'],'attributes':_0x3d9961['attributes']};}):[]};}):[]};}):[]:[]})[_0x208e('0xd')](function(_0x594932){logger[_0x208e('0x16')]('ShowSalesforceAccount',_0x11abd9);logger[_0x208e('0x10')](_0x208e('0x23'),_0x11abd9,JSON['stringify'](_0x594932));_0x106c06(_0x594932);})['catch'](function(_0x3e5868){logger[_0x208e('0x13')](_0x208e('0x23'),_0x3e5868[_0x208e('0x15')],_0x11abd9);_0xc8a3ab(_0x5f1cf4[_0x208e('0x13')](0x1f4,_0x3e5868['message']));});});}; \ No newline at end of file +var _0x74cc=['attributes','limit','include','map','model','ShowSalesforceAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x74cc,0x1aa));var _0xc74c=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x74cc[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0xc74c('0x0'));var moment=require(_0xc74c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc74c('0x2'));var fs=require('fs');var Redis=require(_0xc74c('0x3'));var db=require(_0xc74c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc74c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x362893,_0x2c37e2,_0x11afb4){return new BPromise(function(_0x56d55b,_0x505b47){return client[_0xc74c('0x6')](_0x362893,_0x11afb4)[_0xc74c('0x7')](function(_0x112ac1){logger[_0xc74c('0x8')](_0xc74c('0x9'),_0x2c37e2,_0xc74c('0xa'));logger[_0xc74c('0xb')](_0xc74c('0xc'),_0x2c37e2,'request\x20sent',JSON[_0xc74c('0xd')](_0x112ac1));if(_0x112ac1[_0xc74c('0xe')]){if(_0x112ac1[_0xc74c('0xe')][_0xc74c('0xf')]===0x1f4){logger[_0xc74c('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x2c37e2,_0x112ac1[_0xc74c('0xe')][_0xc74c('0x10')]);return _0x505b47(_0x112ac1[_0xc74c('0xe')][_0xc74c('0x10')]);}logger[_0xc74c('0xe')](_0xc74c('0x9'),_0x2c37e2,_0x112ac1[_0xc74c('0xe')]['message']);return _0x56d55b(_0x112ac1[_0xc74c('0xe')]['message']);}else{logger[_0xc74c('0x8')](_0xc74c('0x9'),_0x2c37e2,_0xc74c('0xa'));_0x56d55b(_0x112ac1['result'][_0xc74c('0x10')]);}})[_0xc74c('0x11')](function(_0x36255c){logger['error'](_0xc74c('0x9'),_0x2c37e2,_0x36255c);_0x505b47(_0x36255c);});});}exports[_0xc74c('0x12')]=function(_0x26541b){var _0x5836db=this;return new Promise(function(_0x27eba3,_0xb04d70){return db[_0xc74c('0x13')][_0xc74c('0x14')]({'raw':_0x26541b[_0xc74c('0x15')]?_0x26541b[_0xc74c('0x15')][_0xc74c('0x16')]===undefined?!![]:![]:!![],'where':_0x26541b[_0xc74c('0x15')]?_0x26541b['options'][_0xc74c('0x17')]||null:null,'attributes':_0x26541b[_0xc74c('0x15')]?_0x26541b['options'][_0xc74c('0x18')]||null:null,'limit':_0x26541b[_0xc74c('0x15')]?_0x26541b[_0xc74c('0x15')][_0xc74c('0x19')]||null:null,'include':_0x26541b[_0xc74c('0x15')]?_0x26541b[_0xc74c('0x15')][_0xc74c('0x1a')]?_[_0xc74c('0x1b')](_0x26541b[_0xc74c('0x15')][_0xc74c('0x1a')],function(_0x3f9d60){return{'model':db[_0x3f9d60[_0xc74c('0x1c')]],'as':_0x3f9d60['as'],'attributes':_0x3f9d60[_0xc74c('0x18')],'include':_0x3f9d60['include']?_[_0xc74c('0x1b')](_0x3f9d60[_0xc74c('0x1a')],function(_0x48dbc4){return{'model':db[_0x48dbc4[_0xc74c('0x1c')]],'as':_0x48dbc4['as'],'attributes':_0x48dbc4[_0xc74c('0x18')],'include':_0x48dbc4[_0xc74c('0x1a')]?_['map'](_0x48dbc4['include'],function(_0x180eaf){return{'model':db[_0x180eaf['model']],'as':_0x180eaf['as'],'attributes':_0x180eaf[_0xc74c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc74c('0x7')](function(_0x1b07bc){logger['info'](_0xc74c('0x12'),_0x26541b);logger[_0xc74c('0xb')](_0xc74c('0x12'),_0x26541b,JSON[_0xc74c('0xd')](_0x1b07bc));_0x27eba3(_0x1b07bc);})[_0xc74c('0x11')](function(_0x10b1fd){logger[_0xc74c('0xe')](_0xc74c('0x12'),_0x10b1fd[_0xc74c('0x10')],_0x26541b);_0xb04d70(_0x5836db[_0xc74c('0xe')](0x1f4,_0x10b1fd[_0xc74c('0x10')]));});});};exports[_0xc74c('0x1d')]=function(_0x4e8f9b){var _0x6d2c1b=this;return new Promise(function(_0x639f42,_0xfbb60e){return db['SalesforceAccount']['find']({'raw':_0x4e8f9b[_0xc74c('0x15')]?_0x4e8f9b['options'][_0xc74c('0x16')]===undefined?!![]:![]:!![],'where':_0x4e8f9b[_0xc74c('0x15')]?_0x4e8f9b['options'][_0xc74c('0x17')]||null:null,'attributes':_0x4e8f9b[_0xc74c('0x15')]?_0x4e8f9b[_0xc74c('0x15')]['attributes']||null:null,'include':_0x4e8f9b[_0xc74c('0x15')]?_0x4e8f9b[_0xc74c('0x15')][_0xc74c('0x1a')]?_[_0xc74c('0x1b')](_0x4e8f9b['options'][_0xc74c('0x1a')],function(_0x3ee5e2){return{'model':db[_0x3ee5e2[_0xc74c('0x1c')]],'as':_0x3ee5e2['as'],'attributes':_0x3ee5e2['attributes'],'include':_0x3ee5e2[_0xc74c('0x1a')]?_[_0xc74c('0x1b')](_0x3ee5e2[_0xc74c('0x1a')],function(_0x4ea3a8){return{'model':db[_0x4ea3a8['model']],'as':_0x4ea3a8['as'],'attributes':_0x4ea3a8[_0xc74c('0x18')],'include':_0x4ea3a8[_0xc74c('0x1a')]?_['map'](_0x4ea3a8[_0xc74c('0x1a')],function(_0x19373a){return{'model':db[_0x19373a['model']],'as':_0x19373a['as'],'attributes':_0x19373a[_0xc74c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf3244d){logger[_0xc74c('0x8')](_0xc74c('0x1d'),_0x4e8f9b);logger[_0xc74c('0xb')](_0xc74c('0x1d'),_0x4e8f9b,JSON['stringify'](_0xf3244d));_0x639f42(_0xf3244d);})[_0xc74c('0x11')](function(_0x3226de){logger[_0xc74c('0xe')](_0xc74c('0x1d'),_0x3226de[_0xc74c('0x10')],_0x4e8f9b);_0xfbb60e(_0x6d2c1b[_0xc74c('0xe')](0x1f4,_0x3226de['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9fd76fc..03dc75f 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xdb28,0x106));var _0x8db2=function(_0x2d9e87,_0x2bbc1e){_0x2d9e87=_0x2d9e87-0x0;var _0x1fd5bf=_0xdb28[_0x2d9e87];return _0x1fd5bf;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x7fa143,_0x28a5b0){var _0x37bb6f=function(_0x4b9076){while(--_0x4b9076){_0x7fa143['push'](_0x7fa143['shift']());}};_0x37bb6f(++_0x28a5b0);}(_0x2ef3,0xba));var _0x32ef=function(_0x2db043,_0x4733b6){_0x2db043=_0x2db043-0x0;var _0x451bfa=_0x2ef3[_0x2db043];return _0x451bfa;};'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('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 72d4577..eba2ab6 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 _0x7a2e=['contact_lead','contact','lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Task','Case'];(function(_0x2b65f6,_0x26b76d){var _0x508131=function(_0x49a374){while(--_0x49a374){_0x2b65f6['push'](_0x2b65f6['shift']());}};_0x508131(++_0x26b76d);}(_0x7a2e,0x69));var _0xe7a2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7a2e[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0xe7a2('0x0')]={'name':{'type':Sequelize[_0xe7a2('0x1')]},'description':{'type':Sequelize[_0xe7a2('0x1')]},'ticketType':{'type':Sequelize[_0xe7a2('0x2')](_0xe7a2('0x3'),_0xe7a2('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xe7a2('0x2')](_0xe7a2('0x5'),_0xe7a2('0x6'),_0xe7a2('0x7'),_0xe7a2('0x8'),_0xe7a2('0x9')),'defaultValue':_0xe7a2('0x5')},'moduleCreate':{'type':Sequelize[_0xe7a2('0x2')](_0xe7a2('0xa'),_0xe7a2('0x6'),_0xe7a2('0x7'),_0xe7a2('0x9')),'defaultValue':_0xe7a2('0x7')},'leadId':{'type':Sequelize[_0xe7a2('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7703=['ENUM','nothing','sequelize','exports','STRING','Task','Case','contact_lead','contact','lead','account'];(function(_0x4f992c,_0x1acbc2){var _0x757396=function(_0x18effe){while(--_0x18effe){_0x4f992c['push'](_0x4f992c['shift']());}};_0x757396(++_0x1acbc2);}(_0x7703,0x1ba));var _0x3770=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x7703[_0x2261ce];return _0x524640;};'use strict';var Sequelize=require(_0x3770('0x0'));module[_0x3770('0x1')]={'name':{'type':Sequelize[_0x3770('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x3770('0x3'),_0x3770('0x4')),'defaultValue':_0x3770('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x3770('0x5'),_0x3770('0x6'),_0x3770('0x7'),'account_contact_lead',_0x3770('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x3770('0x9')](_0x3770('0xa'),_0x3770('0x6'),_0x3770('0x7'),_0x3770('0x8')),'defaultValue':_0x3770('0x7')},'leadId':{'type':Sequelize[_0x3770('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x3770('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x3770('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x3770('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4039004..cea7e98 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 _0x2066=['name','send','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','destroy','findOne','SalesforceField','getFields','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack'];(function(_0x252eaf,_0x181480){var _0x173101=function(_0x25782a){while(--_0x25782a){_0x252eaf['push'](_0x252eaf['shift']());}};_0x173101(++_0x181480);}(_0x2066,0x7b));var _0x6206=function(_0x51882e,_0x4f966){_0x51882e=_0x51882e-0x0;var _0xca3e9f=_0x2066[_0x51882e];return _0xca3e9f;};'use strict';var emlformat=require(_0x6206('0x0'));var rimraf=require(_0x6206('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6206('0x2'));var moment=require(_0x6206('0x3'));var BPromise=require(_0x6206('0x4'));var Mustache=require(_0x6206('0x5'));var util=require(_0x6206('0x6'));var path=require(_0x6206('0x7'));var sox=require(_0x6206('0x8'));var csv=require(_0x6206('0x9'));var ejs=require(_0x6206('0xa'));var fs=require('fs');var fs_extra=require(_0x6206('0xb'));var _=require(_0x6206('0xc'));var squel=require(_0x6206('0xd'));var crypto=require(_0x6206('0xe'));var jsforce=require(_0x6206('0xf'));var deskjs=require(_0x6206('0x10'));var toCsv=require(_0x6206('0x9'));var querystring=require(_0x6206('0x11'));var Papa=require(_0x6206('0x12'));var Redis=require(_0x6206('0x13'));var authService=require(_0x6206('0x14'));var qs=require(_0x6206('0x15'));var as=require(_0x6206('0x16'));var hardwareService=require(_0x6206('0x17'));var logger=require(_0x6206('0x18'))(_0x6206('0x19'));var utils=require('../../config/utils');var config=require(_0x6206('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba5fc,_0x250ec9){_0x250ec9=_0x250ec9||0xcc;return function(_0x49ce14){if(_0x49ce14){return _0x5ba5fc[_0x6206('0x1b')](_0x250ec9);}return _0x5ba5fc[_0x6206('0x1c')](_0x250ec9)['end']();};}function respondWithResult(_0x1980a5,_0x1c3800){_0x1c3800=_0x1c3800||0xc8;return function(_0x127c65){if(_0x127c65){return _0x1980a5[_0x6206('0x1c')](_0x1c3800)[_0x6206('0x1d')](_0x127c65);}};}function respondWithFilteredResult(_0x2aad1b,_0x16552c){return function(_0x293d46){if(_0x293d46){var _0x19a694=typeof _0x16552c[_0x6206('0x1e')]===_0x6206('0x1f')&&typeof _0x16552c[_0x6206('0x20')]==='undefined';var _0x50ee57=_0x293d46[_0x6206('0x21')];var _0x3570b8=_0x19a694?0x0:_0x16552c[_0x6206('0x1e')];var _0x404ada=_0x19a694?_0x293d46['count']:_0x16552c['offset']+_0x16552c[_0x6206('0x20')];var _0x2612c8;if(_0x404ada>=_0x50ee57){_0x404ada=_0x50ee57;_0x2612c8=0xc8;}else{_0x2612c8=0xce;}_0x2aad1b[_0x6206('0x1c')](_0x2612c8);return _0x2aad1b[_0x6206('0x22')](_0x6206('0x23'),_0x3570b8+'-'+_0x404ada+'/'+_0x50ee57)[_0x6206('0x1d')](_0x293d46);}return null;};}function patchUpdates(_0x28078b){return function(_0x52adcc){try{jsonpatch[_0x6206('0x24')](_0x52adcc,_0x28078b,!![]);}catch(_0x23b64d){return BPromise['reject'](_0x23b64d);}return _0x52adcc['save']();};}function saveUpdates(_0xc28ec3,_0x431c2c){return function(_0x25f6ca){if(_0x25f6ca){return _0x25f6ca[_0x6206('0x25')](_0xc28ec3)[_0x6206('0x26')](function(_0x13144a){return _0x13144a;});}return null;};}function removeEntity(_0x4fb269,_0x46d95a){return function(_0x1a582d){if(_0x1a582d){return _0x1a582d['destroy']()[_0x6206('0x26')](function(){_0x4fb269[_0x6206('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e397b,_0x24b1b3){return function(_0x4f5b9e){if(!_0x4f5b9e){_0x1e397b[_0x6206('0x1b')](0x194);}return _0x4f5b9e;};}function handleError(_0x48c990,_0x2aa3e1){_0x2aa3e1=_0x2aa3e1||0x1f4;return function(_0x1a8fb2){logger[_0x6206('0x27')](_0x1a8fb2[_0x6206('0x28')]);if(_0x1a8fb2[_0x6206('0x29')]){delete _0x1a8fb2['name'];}_0x48c990[_0x6206('0x1c')](_0x2aa3e1)[_0x6206('0x2a')](_0x1a8fb2);};}exports['index']=function(_0x248e2e,_0xa7237f){var _0x3a26e9={},_0xcf6e46={},_0x3baa1b={'count':0x0,'rows':[]};var _0x55447c=_['map'](db[_0x6206('0x2b')][_0x6206('0x2c')],function(_0x5b43bb){return{'name':_0x5b43bb[_0x6206('0x2d')],'type':_0x5b43bb[_0x6206('0x2e')][_0x6206('0x2f')]};});_0xcf6e46[_0x6206('0x30')]=_['map'](_0x55447c,_0x6206('0x29'));_0xcf6e46[_0x6206('0x31')]=_[_0x6206('0x32')](_0x248e2e[_0x6206('0x31')]);_0xcf6e46[_0x6206('0x33')]=_[_0x6206('0x34')](_0xcf6e46[_0x6206('0x30')],_0xcf6e46[_0x6206('0x31')]);_0x3a26e9[_0x6206('0x35')]=_['intersection'](_0xcf6e46[_0x6206('0x30')],qs[_0x6206('0x36')](_0x248e2e['query']['fields']));_0x3a26e9[_0x6206('0x35')]=_0x3a26e9['attributes'][_0x6206('0x37')]?_0x3a26e9[_0x6206('0x35')]:_0xcf6e46[_0x6206('0x30')];if(!_0x248e2e[_0x6206('0x31')]['hasOwnProperty']('nolimit')){_0x3a26e9['limit']=qs[_0x6206('0x20')](_0x248e2e[_0x6206('0x31')][_0x6206('0x20')]);_0x3a26e9[_0x6206('0x1e')]=qs[_0x6206('0x1e')](_0x248e2e[_0x6206('0x31')][_0x6206('0x1e')]);}_0x3a26e9[_0x6206('0x38')]=qs[_0x6206('0x39')](_0x248e2e[_0x6206('0x31')]['sort']);_0x3a26e9[_0x6206('0x3a')]=qs['filters'](_[_0x6206('0x3b')](_0x248e2e[_0x6206('0x31')],_0xcf6e46[_0x6206('0x33')]),_0x55447c);if(_0x248e2e[_0x6206('0x31')][_0x6206('0x3c')]){_0x3a26e9[_0x6206('0x3a')]=_[_0x6206('0x3d')](_0x3a26e9[_0x6206('0x3a')],{'$or':_[_0x6206('0x3e')](_0x55447c,function(_0x3f38f2){if(_0x3f38f2['type']!==_0x6206('0x3f')){var _0x28095a={};_0x28095a[_0x3f38f2[_0x6206('0x29')]]={'$like':'%'+_0x248e2e[_0x6206('0x31')][_0x6206('0x3c')]+'%'};return _0x28095a;}})});}_0x3a26e9=_['merge']({},_0x3a26e9,_0x248e2e['options']);var _0x347398={'where':_0x3a26e9['where']};return db[_0x6206('0x2b')][_0x6206('0x21')](_0x347398)[_0x6206('0x26')](function(_0x421685){_0x3baa1b[_0x6206('0x21')]=_0x421685;if(_0x248e2e[_0x6206('0x31')][_0x6206('0x40')]){_0x3a26e9['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x6206('0x41')](_0x3a26e9);})[_0x6206('0x26')](function(_0x21ace4){_0x3baa1b['rows']=_0x21ace4;return _0x3baa1b;})['then'](respondWithFilteredResult(_0xa7237f,_0x3a26e9))[_0x6206('0x42')](handleError(_0xa7237f,null));};exports[_0x6206('0x43')]=function(_0x461b48,_0x189ffc){var _0x289284={'raw':![],'where':{'id':_0x461b48[_0x6206('0x44')]['id']}},_0x4c9595={};_0x4c9595[_0x6206('0x30')]=_[_0x6206('0x32')](db[_0x6206('0x2b')][_0x6206('0x2c')]);_0x4c9595[_0x6206('0x31')]=_[_0x6206('0x32')](_0x461b48['query']);_0x4c9595[_0x6206('0x33')]=_[_0x6206('0x34')](_0x4c9595[_0x6206('0x30')],_0x4c9595[_0x6206('0x31')]);_0x289284[_0x6206('0x35')]=_[_0x6206('0x34')](_0x4c9595[_0x6206('0x30')],qs[_0x6206('0x36')](_0x461b48['query'][_0x6206('0x36')]));_0x289284[_0x6206('0x35')]=_0x289284[_0x6206('0x35')]['length']?_0x289284['attributes']:_0x4c9595[_0x6206('0x30')];if(_0x461b48[_0x6206('0x31')][_0x6206('0x40')]){_0x289284[_0x6206('0x45')]=[{'all':!![]}];}_0x289284=_[_0x6206('0x3d')]({},_0x289284,_0x461b48[_0x6206('0x46')]);return db[_0x6206('0x2b')][_0x6206('0x47')](_0x289284)[_0x6206('0x26')](handleEntityNotFound(_0x189ffc,null))[_0x6206('0x26')](respondWithResult(_0x189ffc,null))['catch'](handleError(_0x189ffc,null));};exports[_0x6206('0x48')]=function(_0x37866e,_0x3cbd18){return db[_0x6206('0x2b')][_0x6206('0x48')](_0x37866e[_0x6206('0x49')],{})[_0x6206('0x26')](respondWithResult(_0x3cbd18,0xc9))[_0x6206('0x42')](handleError(_0x3cbd18,null));};exports[_0x6206('0x25')]=function(_0x2cb8eb,_0x99ba5e){if(_0x2cb8eb[_0x6206('0x49')]['id']){delete _0x2cb8eb[_0x6206('0x49')]['id'];}return db[_0x6206('0x2b')][_0x6206('0x47')]({'where':{'id':_0x2cb8eb[_0x6206('0x44')]['id']}})[_0x6206('0x26')](handleEntityNotFound(_0x99ba5e,null))['then'](saveUpdates(_0x2cb8eb[_0x6206('0x49')],null))[_0x6206('0x26')](respondWithResult(_0x99ba5e,null))[_0x6206('0x42')](handleError(_0x99ba5e,null));};exports[_0x6206('0x4a')]=function(_0xed3c9f,_0x5a91fe){return db[_0x6206('0x2b')][_0x6206('0x47')]({'where':{'id':_0xed3c9f['params']['id']}})[_0x6206('0x26')](handleEntityNotFound(_0x5a91fe,null))[_0x6206('0x26')](removeEntity(_0x5a91fe,null))['catch'](handleError(_0x5a91fe,null));};exports['getFields']=function(_0x448ec8,_0x58cef2,_0x5000a2){var _0x52c38c={};var _0x4d3df2={};var _0x37b2de;var _0x4a347e;return db[_0x6206('0x2b')][_0x6206('0x4b')]({'where':{'id':_0x448ec8[_0x6206('0x44')]['id']}})['then'](handleEntityNotFound(_0x58cef2,null))[_0x6206('0x26')](function(_0x26dc79){if(_0x26dc79){_0x37b2de=_0x26dc79;_0x4d3df2[_0x6206('0x30')]=_[_0x6206('0x32')](db[_0x6206('0x4c')]['rawAttributes']);_0x4d3df2['query']=_[_0x6206('0x32')](_0x448ec8[_0x6206('0x31')]);_0x4d3df2['filters']=_[_0x6206('0x34')](_0x4d3df2[_0x6206('0x30')],_0x4d3df2[_0x6206('0x31')]);_0x52c38c[_0x6206('0x35')]=_[_0x6206('0x34')](_0x4d3df2[_0x6206('0x30')],qs[_0x6206('0x36')](_0x448ec8[_0x6206('0x31')][_0x6206('0x36')]));_0x52c38c['attributes']=_0x52c38c['attributes'][_0x6206('0x37')]?_0x52c38c[_0x6206('0x35')]:_0x4d3df2[_0x6206('0x30')];_0x52c38c[_0x6206('0x38')]=qs[_0x6206('0x39')](_0x448ec8['query']['sort']);_0x52c38c['where']=qs[_0x6206('0x33')](_[_0x6206('0x3b')](_0x448ec8[_0x6206('0x31')],_0x4d3df2[_0x6206('0x33')]));if(_0x448ec8[_0x6206('0x31')][_0x6206('0x3c')]){_0x52c38c['where']=_[_0x6206('0x3d')](_0x52c38c[_0x6206('0x3a')],{'$or':_[_0x6206('0x3e')](_0x52c38c[_0x6206('0x35')],function(_0x3be558){var _0x3681c6={};_0x3681c6[_0x3be558]={'$like':'%'+_0x448ec8[_0x6206('0x31')]['filter']+'%'};return _0x3681c6;})});}_0x52c38c=_[_0x6206('0x3d')]({},_0x52c38c,_0x448ec8[_0x6206('0x46')]);return _0x37b2de[_0x6206('0x4d')](_0x52c38c);}})['then'](function(_0xc6b78f){if(_0xc6b78f){_0x4a347e=_0xc6b78f[_0x6206('0x37')];if(!_0x448ec8[_0x6206('0x31')][_0x6206('0x4e')]('nolimit')){_0x52c38c[_0x6206('0x20')]=qs[_0x6206('0x20')](_0x448ec8[_0x6206('0x31')][_0x6206('0x20')]);_0x52c38c['offset']=qs[_0x6206('0x1e')](_0x448ec8[_0x6206('0x31')][_0x6206('0x1e')]);}return _0x37b2de['getFields'](_0x52c38c);}})[_0x6206('0x26')](function(_0x58671a){if(_0x58671a){return _0x58671a?{'count':_0x4a347e,'rows':_0x58671a}:null;}})['then'](respondWithResult(_0x58cef2,null))[_0x6206('0x42')](handleError(_0x58cef2,null));};exports[_0x6206('0x4f')]=function(_0x107127,_0x43f1c2,_0x312796){var _0x3388f9={};var _0x3de64f={};var _0x56e675;var _0x31c3d4;return db['SalesforceConfiguration'][_0x6206('0x4b')]({'where':{'id':_0x107127[_0x6206('0x44')]['id']}})[_0x6206('0x26')](handleEntityNotFound(_0x43f1c2,null))['then'](function(_0x3e8fd4){if(_0x3e8fd4){_0x56e675=_0x3e8fd4;_0x3de64f[_0x6206('0x30')]=_['keys'](db[_0x6206('0x4c')][_0x6206('0x2c')]);_0x3de64f[_0x6206('0x31')]=_[_0x6206('0x32')](_0x107127['query']);_0x3de64f[_0x6206('0x33')]=_[_0x6206('0x34')](_0x3de64f[_0x6206('0x30')],_0x3de64f['query']);_0x3388f9[_0x6206('0x35')]=_['intersection'](_0x3de64f['model'],qs[_0x6206('0x36')](_0x107127['query'][_0x6206('0x36')]));_0x3388f9[_0x6206('0x35')]=_0x3388f9[_0x6206('0x35')]['length']?_0x3388f9['attributes']:_0x3de64f[_0x6206('0x30')];_0x3388f9[_0x6206('0x38')]=qs[_0x6206('0x39')](_0x107127[_0x6206('0x31')][_0x6206('0x39')]);_0x3388f9['where']=qs['filters'](_[_0x6206('0x3b')](_0x107127[_0x6206('0x31')],_0x3de64f[_0x6206('0x33')]));if(_0x107127[_0x6206('0x31')][_0x6206('0x3c')]){_0x3388f9[_0x6206('0x3a')]=_['merge'](_0x3388f9[_0x6206('0x3a')],{'$or':_['map'](_0x3388f9[_0x6206('0x35')],function(_0x2dde35){var _0x50bbd4={};_0x50bbd4[_0x2dde35]={'$like':'%'+_0x107127[_0x6206('0x31')][_0x6206('0x3c')]+'%'};return _0x50bbd4;})});}_0x3388f9=_[_0x6206('0x3d')]({},_0x3388f9,_0x107127[_0x6206('0x46')]);return _0x56e675[_0x6206('0x4f')](_0x3388f9);}})['then'](function(_0x4f62cd){if(_0x4f62cd){_0x31c3d4=_0x4f62cd[_0x6206('0x37')];if(!_0x107127[_0x6206('0x31')][_0x6206('0x4e')](_0x6206('0x50'))){_0x3388f9['limit']=qs[_0x6206('0x20')](_0x107127[_0x6206('0x31')][_0x6206('0x20')]);_0x3388f9[_0x6206('0x1e')]=qs['offset'](_0x107127['query'][_0x6206('0x1e')]);}return _0x56e675[_0x6206('0x4f')](_0x3388f9);}})[_0x6206('0x26')](function(_0x3ef999){if(_0x3ef999){return _0x3ef999?{'count':_0x31c3d4,'rows':_0x3ef999}:null;}})['then'](respondWithResult(_0x43f1c2,null))[_0x6206('0x42')](handleError(_0x43f1c2,null));};exports[_0x6206('0x51')]=function(_0x25249c,_0x21567b,_0x33dcc8){var _0x5a830f={};var _0x19d22d={};var _0x5dd383;var _0x2a5ca4;return db[_0x6206('0x2b')][_0x6206('0x4b')]({'where':{'id':_0x25249c[_0x6206('0x44')]['id']}})[_0x6206('0x26')](handleEntityNotFound(_0x21567b,null))[_0x6206('0x26')](function(_0x203a06){if(_0x203a06){_0x5dd383=_0x203a06;_0x19d22d[_0x6206('0x30')]=_['keys'](db[_0x6206('0x4c')]['rawAttributes']);_0x19d22d[_0x6206('0x31')]=_['keys'](_0x25249c[_0x6206('0x31')]);_0x19d22d[_0x6206('0x33')]=_[_0x6206('0x34')](_0x19d22d['model'],_0x19d22d[_0x6206('0x31')]);_0x5a830f['attributes']=_['intersection'](_0x19d22d['model'],qs[_0x6206('0x36')](_0x25249c[_0x6206('0x31')][_0x6206('0x36')]));_0x5a830f[_0x6206('0x35')]=_0x5a830f[_0x6206('0x35')][_0x6206('0x37')]?_0x5a830f['attributes']:_0x19d22d[_0x6206('0x30')];_0x5a830f['order']=qs[_0x6206('0x39')](_0x25249c[_0x6206('0x31')]['sort']);_0x5a830f[_0x6206('0x3a')]=qs[_0x6206('0x33')](_[_0x6206('0x3b')](_0x25249c[_0x6206('0x31')],_0x19d22d[_0x6206('0x33')]));if(_0x25249c[_0x6206('0x31')]['filter']){_0x5a830f[_0x6206('0x3a')]=_['merge'](_0x5a830f[_0x6206('0x3a')],{'$or':_[_0x6206('0x3e')](_0x5a830f[_0x6206('0x35')],function(_0x5bfe4b){var _0x13929b={};_0x13929b[_0x5bfe4b]={'$like':'%'+_0x25249c[_0x6206('0x31')]['filter']+'%'};return _0x13929b;})});}_0x5a830f=_['merge']({},_0x5a830f,_0x25249c[_0x6206('0x46')]);return _0x5dd383[_0x6206('0x51')](_0x5a830f);}})['then'](function(_0x1362f6){if(_0x1362f6){_0x2a5ca4=_0x1362f6['length'];if(!_0x25249c[_0x6206('0x31')][_0x6206('0x4e')](_0x6206('0x50'))){_0x5a830f[_0x6206('0x20')]=qs[_0x6206('0x20')](_0x25249c[_0x6206('0x31')][_0x6206('0x20')]);_0x5a830f['offset']=qs['offset'](_0x25249c[_0x6206('0x31')][_0x6206('0x1e')]);}return _0x5dd383['getDescriptions'](_0x5a830f);}})[_0x6206('0x26')](function(_0x2d1601){if(_0x2d1601){return _0x2d1601?{'count':_0x2a5ca4,'rows':_0x2d1601}:null;}})[_0x6206('0x26')](respondWithResult(_0x21567b,null))['catch'](handleError(_0x21567b,null));}; \ No newline at end of file +var _0x4f17=['nolimit','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','findOne','SalesforceField'];(function(_0x39c275,_0x30ef2d){var _0xe038eb=function(_0x687f6c){while(--_0x687f6c){_0x39c275['push'](_0x39c275['shift']());}};_0xe038eb(++_0x30ef2d);}(_0x4f17,0x9e));var _0x74f1=function(_0x20eacd,_0x2394e2){_0x20eacd=_0x20eacd-0x0;var _0x57942a=_0x4f17[_0x20eacd];return _0x57942a;};'use strict';var emlformat=require(_0x74f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74f1('0x1'));var jsonpatch=require(_0x74f1('0x2'));var rp=require('request-promise');var moment=require(_0x74f1('0x3'));var BPromise=require(_0x74f1('0x4'));var Mustache=require(_0x74f1('0x5'));var util=require(_0x74f1('0x6'));var path=require(_0x74f1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x74f1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74f1('0x9'));var squel=require('squel');var crypto=require(_0x74f1('0xa'));var jsforce=require(_0x74f1('0xb'));var deskjs=require(_0x74f1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x74f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x74f1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x74f1('0xf'));var as=require(_0x74f1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x74f1('0x11'));var utils=require(_0x74f1('0x12'));var config=require(_0x74f1('0x13'));var licenseUtil=require(_0x74f1('0x14'));var db=require(_0x74f1('0x15'))['db'];function respondWithStatusCode(_0x2b91bc,_0x467e15){_0x467e15=_0x467e15||0xcc;return function(_0x3a2ce6){if(_0x3a2ce6){return _0x2b91bc[_0x74f1('0x16')](_0x467e15);}return _0x2b91bc[_0x74f1('0x17')](_0x467e15)['end']();};}function respondWithResult(_0xf135d0,_0x4e156f){_0x4e156f=_0x4e156f||0xc8;return function(_0x41488b){if(_0x41488b){return _0xf135d0['status'](_0x4e156f)[_0x74f1('0x18')](_0x41488b);}};}function respondWithFilteredResult(_0x17762d,_0x373b73){return function(_0x1016a7){if(_0x1016a7){var _0x33b851=typeof _0x373b73['offset']===_0x74f1('0x19')&&typeof _0x373b73[_0x74f1('0x1a')]==='undefined';var _0x387937=_0x1016a7[_0x74f1('0x1b')];var _0x520aae=_0x33b851?0x0:_0x373b73[_0x74f1('0x1c')];var _0x29de10=_0x33b851?_0x1016a7[_0x74f1('0x1b')]:_0x373b73[_0x74f1('0x1c')]+_0x373b73[_0x74f1('0x1a')];var _0x4a10ab;if(_0x29de10>=_0x387937){_0x29de10=_0x387937;_0x4a10ab=0xc8;}else{_0x4a10ab=0xce;}_0x17762d[_0x74f1('0x17')](_0x4a10ab);return _0x17762d[_0x74f1('0x1d')](_0x74f1('0x1e'),_0x520aae+'-'+_0x29de10+'/'+_0x387937)[_0x74f1('0x18')](_0x1016a7);}return null;};}function patchUpdates(_0x227fa9){return function(_0x27ae4b){try{jsonpatch['apply'](_0x27ae4b,_0x227fa9,!![]);}catch(_0x551f9a){return BPromise['reject'](_0x551f9a);}return _0x27ae4b[_0x74f1('0x1f')]();};}function saveUpdates(_0x132a81,_0x3d4c18){return function(_0x749f27){if(_0x749f27){return _0x749f27[_0x74f1('0x20')](_0x132a81)[_0x74f1('0x21')](function(_0x34701f){return _0x34701f;});}return null;};}function removeEntity(_0x26cba4,_0x2c336b){return function(_0x15a96a){if(_0x15a96a){return _0x15a96a[_0x74f1('0x22')]()['then'](function(){_0x26cba4['status'](0xcc)[_0x74f1('0x23')]();});}};}function handleEntityNotFound(_0x24e730,_0xad169c){return function(_0x1b9554){if(!_0x1b9554){_0x24e730[_0x74f1('0x16')](0x194);}return _0x1b9554;};}function handleError(_0xddbb89,_0xd079b5){_0xd079b5=_0xd079b5||0x1f4;return function(_0x5c1fa0){logger[_0x74f1('0x24')](_0x5c1fa0[_0x74f1('0x25')]);if(_0x5c1fa0['name']){delete _0x5c1fa0[_0x74f1('0x26')];}_0xddbb89['status'](_0xd079b5)['send'](_0x5c1fa0);};}exports[_0x74f1('0x27')]=function(_0x37894a,_0x365a2f){var _0x27c47e={},_0x115abf={},_0x176340={'count':0x0,'rows':[]};var _0x19390c=_[_0x74f1('0x28')](db[_0x74f1('0x29')][_0x74f1('0x2a')],function(_0xd226be){return{'name':_0xd226be[_0x74f1('0x2b')],'type':_0xd226be[_0x74f1('0x2c')]['key']};});_0x115abf[_0x74f1('0x2d')]=_[_0x74f1('0x28')](_0x19390c,_0x74f1('0x26'));_0x115abf[_0x74f1('0x2e')]=_['keys'](_0x37894a[_0x74f1('0x2e')]);_0x115abf['filters']=_[_0x74f1('0x2f')](_0x115abf[_0x74f1('0x2d')],_0x115abf[_0x74f1('0x2e')]);_0x27c47e[_0x74f1('0x30')]=_['intersection'](_0x115abf[_0x74f1('0x2d')],qs['fields'](_0x37894a[_0x74f1('0x2e')][_0x74f1('0x31')]));_0x27c47e[_0x74f1('0x30')]=_0x27c47e[_0x74f1('0x30')][_0x74f1('0x32')]?_0x27c47e[_0x74f1('0x30')]:_0x115abf[_0x74f1('0x2d')];if(!_0x37894a[_0x74f1('0x2e')][_0x74f1('0x33')]('nolimit')){_0x27c47e[_0x74f1('0x1a')]=qs[_0x74f1('0x1a')](_0x37894a['query'][_0x74f1('0x1a')]);_0x27c47e[_0x74f1('0x1c')]=qs[_0x74f1('0x1c')](_0x37894a[_0x74f1('0x2e')][_0x74f1('0x1c')]);}_0x27c47e[_0x74f1('0x34')]=qs['sort'](_0x37894a[_0x74f1('0x2e')][_0x74f1('0x35')]);_0x27c47e[_0x74f1('0x36')]=qs[_0x74f1('0x37')](_[_0x74f1('0x38')](_0x37894a[_0x74f1('0x2e')],_0x115abf[_0x74f1('0x37')]),_0x19390c);if(_0x37894a[_0x74f1('0x2e')][_0x74f1('0x39')]){_0x27c47e[_0x74f1('0x36')]=_['merge'](_0x27c47e[_0x74f1('0x36')],{'$or':_['map'](_0x19390c,function(_0x353266){if(_0x353266[_0x74f1('0x2c')]!=='VIRTUAL'){var _0xa9b443={};_0xa9b443[_0x353266[_0x74f1('0x26')]]={'$like':'%'+_0x37894a['query'][_0x74f1('0x39')]+'%'};return _0xa9b443;}})});}_0x27c47e=_[_0x74f1('0x3a')]({},_0x27c47e,_0x37894a['options']);var _0x3693cc={'where':_0x27c47e[_0x74f1('0x36')]};return db[_0x74f1('0x29')][_0x74f1('0x1b')](_0x3693cc)[_0x74f1('0x21')](function(_0x42c0b2){_0x176340['count']=_0x42c0b2;if(_0x37894a['query'][_0x74f1('0x3b')]){_0x27c47e[_0x74f1('0x3c')]=[{'all':!![]}];}return db[_0x74f1('0x29')][_0x74f1('0x3d')](_0x27c47e);})[_0x74f1('0x21')](function(_0x465bad){_0x176340[_0x74f1('0x3e')]=_0x465bad;return _0x176340;})[_0x74f1('0x21')](respondWithFilteredResult(_0x365a2f,_0x27c47e))[_0x74f1('0x3f')](handleError(_0x365a2f,null));};exports[_0x74f1('0x40')]=function(_0x4c8bea,_0x55e7ca){var _0x44edeb={'raw':![],'where':{'id':_0x4c8bea[_0x74f1('0x41')]['id']}},_0x4ae128={};_0x4ae128[_0x74f1('0x2d')]=_[_0x74f1('0x42')](db['SalesforceConfiguration'][_0x74f1('0x2a')]);_0x4ae128[_0x74f1('0x2e')]=_[_0x74f1('0x42')](_0x4c8bea[_0x74f1('0x2e')]);_0x4ae128[_0x74f1('0x37')]=_[_0x74f1('0x2f')](_0x4ae128[_0x74f1('0x2d')],_0x4ae128[_0x74f1('0x2e')]);_0x44edeb['attributes']=_['intersection'](_0x4ae128[_0x74f1('0x2d')],qs['fields'](_0x4c8bea[_0x74f1('0x2e')][_0x74f1('0x31')]));_0x44edeb[_0x74f1('0x30')]=_0x44edeb[_0x74f1('0x30')][_0x74f1('0x32')]?_0x44edeb[_0x74f1('0x30')]:_0x4ae128[_0x74f1('0x2d')];if(_0x4c8bea['query'][_0x74f1('0x3b')]){_0x44edeb[_0x74f1('0x3c')]=[{'all':!![]}];}_0x44edeb=_[_0x74f1('0x3a')]({},_0x44edeb,_0x4c8bea[_0x74f1('0x43')]);return db[_0x74f1('0x29')]['find'](_0x44edeb)[_0x74f1('0x21')](handleEntityNotFound(_0x55e7ca,null))[_0x74f1('0x21')](respondWithResult(_0x55e7ca,null))[_0x74f1('0x3f')](handleError(_0x55e7ca,null));};exports[_0x74f1('0x44')]=function(_0x133dd9,_0x2f362c){return db[_0x74f1('0x29')][_0x74f1('0x44')](_0x133dd9[_0x74f1('0x45')],{})['then'](respondWithResult(_0x2f362c,0xc9))[_0x74f1('0x3f')](handleError(_0x2f362c,null));};exports[_0x74f1('0x20')]=function(_0x26199c,_0x4b0a12){if(_0x26199c['body']['id']){delete _0x26199c[_0x74f1('0x45')]['id'];}return db[_0x74f1('0x29')][_0x74f1('0x46')]({'where':{'id':_0x26199c[_0x74f1('0x41')]['id']}})[_0x74f1('0x21')](handleEntityNotFound(_0x4b0a12,null))[_0x74f1('0x21')](saveUpdates(_0x26199c[_0x74f1('0x45')],null))[_0x74f1('0x21')](respondWithResult(_0x4b0a12,null))['catch'](handleError(_0x4b0a12,null));};exports[_0x74f1('0x22')]=function(_0x2c8906,_0xe025a4){return db[_0x74f1('0x29')][_0x74f1('0x46')]({'where':{'id':_0x2c8906[_0x74f1('0x41')]['id']}})['then'](handleEntityNotFound(_0xe025a4,null))[_0x74f1('0x21')](removeEntity(_0xe025a4,null))[_0x74f1('0x3f')](handleError(_0xe025a4,null));};exports['getFields']=function(_0x469cab,_0x258d93,_0x1f9e5f){var _0x1fbdfc={};var _0x1da6fb={};var _0x400e81;var _0x137ff9;return db[_0x74f1('0x29')][_0x74f1('0x47')]({'where':{'id':_0x469cab[_0x74f1('0x41')]['id']}})[_0x74f1('0x21')](handleEntityNotFound(_0x258d93,null))[_0x74f1('0x21')](function(_0x38864f){if(_0x38864f){_0x400e81=_0x38864f;_0x1da6fb[_0x74f1('0x2d')]=_[_0x74f1('0x42')](db[_0x74f1('0x48')][_0x74f1('0x2a')]);_0x1da6fb[_0x74f1('0x2e')]=_[_0x74f1('0x42')](_0x469cab[_0x74f1('0x2e')]);_0x1da6fb[_0x74f1('0x37')]=_[_0x74f1('0x2f')](_0x1da6fb[_0x74f1('0x2d')],_0x1da6fb[_0x74f1('0x2e')]);_0x1fbdfc[_0x74f1('0x30')]=_[_0x74f1('0x2f')](_0x1da6fb[_0x74f1('0x2d')],qs[_0x74f1('0x31')](_0x469cab['query'][_0x74f1('0x31')]));_0x1fbdfc[_0x74f1('0x30')]=_0x1fbdfc[_0x74f1('0x30')][_0x74f1('0x32')]?_0x1fbdfc[_0x74f1('0x30')]:_0x1da6fb[_0x74f1('0x2d')];_0x1fbdfc['order']=qs[_0x74f1('0x35')](_0x469cab[_0x74f1('0x2e')][_0x74f1('0x35')]);_0x1fbdfc[_0x74f1('0x36')]=qs[_0x74f1('0x37')](_[_0x74f1('0x38')](_0x469cab[_0x74f1('0x2e')],_0x1da6fb['filters']));if(_0x469cab[_0x74f1('0x2e')][_0x74f1('0x39')]){_0x1fbdfc['where']=_[_0x74f1('0x3a')](_0x1fbdfc[_0x74f1('0x36')],{'$or':_['map'](_0x1fbdfc[_0x74f1('0x30')],function(_0x3e7a74){var _0x4f2f8d={};_0x4f2f8d[_0x3e7a74]={'$like':'%'+_0x469cab[_0x74f1('0x2e')][_0x74f1('0x39')]+'%'};return _0x4f2f8d;})});}_0x1fbdfc=_['merge']({},_0x1fbdfc,_0x469cab[_0x74f1('0x43')]);return _0x400e81['getFields'](_0x1fbdfc);}})[_0x74f1('0x21')](function(_0x181381){if(_0x181381){_0x137ff9=_0x181381[_0x74f1('0x32')];if(!_0x469cab[_0x74f1('0x2e')][_0x74f1('0x33')](_0x74f1('0x49'))){_0x1fbdfc[_0x74f1('0x1a')]=qs[_0x74f1('0x1a')](_0x469cab[_0x74f1('0x2e')][_0x74f1('0x1a')]);_0x1fbdfc[_0x74f1('0x1c')]=qs['offset'](_0x469cab['query'][_0x74f1('0x1c')]);}return _0x400e81[_0x74f1('0x4a')](_0x1fbdfc);}})[_0x74f1('0x21')](function(_0x1b652b){if(_0x1b652b){return _0x1b652b?{'count':_0x137ff9,'rows':_0x1b652b}:null;}})[_0x74f1('0x21')](respondWithResult(_0x258d93,null))['catch'](handleError(_0x258d93,null));};exports[_0x74f1('0x4b')]=function(_0x3afa2d,_0x4f32e2,_0x2044a7){var _0x1c717e={};var _0x3bcf8f={};var _0x384770;var _0x3a58a2;return db[_0x74f1('0x29')][_0x74f1('0x47')]({'where':{'id':_0x3afa2d['params']['id']}})['then'](handleEntityNotFound(_0x4f32e2,null))[_0x74f1('0x21')](function(_0x4e69f5){if(_0x4e69f5){_0x384770=_0x4e69f5;_0x3bcf8f[_0x74f1('0x2d')]=_[_0x74f1('0x42')](db[_0x74f1('0x48')]['rawAttributes']);_0x3bcf8f[_0x74f1('0x2e')]=_['keys'](_0x3afa2d['query']);_0x3bcf8f[_0x74f1('0x37')]=_['intersection'](_0x3bcf8f[_0x74f1('0x2d')],_0x3bcf8f[_0x74f1('0x2e')]);_0x1c717e[_0x74f1('0x30')]=_[_0x74f1('0x2f')](_0x3bcf8f[_0x74f1('0x2d')],qs[_0x74f1('0x31')](_0x3afa2d[_0x74f1('0x2e')][_0x74f1('0x31')]));_0x1c717e[_0x74f1('0x30')]=_0x1c717e[_0x74f1('0x30')][_0x74f1('0x32')]?_0x1c717e[_0x74f1('0x30')]:_0x3bcf8f[_0x74f1('0x2d')];_0x1c717e[_0x74f1('0x34')]=qs[_0x74f1('0x35')](_0x3afa2d['query'][_0x74f1('0x35')]);_0x1c717e[_0x74f1('0x36')]=qs[_0x74f1('0x37')](_['pick'](_0x3afa2d[_0x74f1('0x2e')],_0x3bcf8f['filters']));if(_0x3afa2d[_0x74f1('0x2e')][_0x74f1('0x39')]){_0x1c717e['where']=_['merge'](_0x1c717e[_0x74f1('0x36')],{'$or':_['map'](_0x1c717e[_0x74f1('0x30')],function(_0x42d82d){var _0x827783={};_0x827783[_0x42d82d]={'$like':'%'+_0x3afa2d['query'][_0x74f1('0x39')]+'%'};return _0x827783;})});}_0x1c717e=_[_0x74f1('0x3a')]({},_0x1c717e,_0x3afa2d['options']);return _0x384770[_0x74f1('0x4b')](_0x1c717e);}})[_0x74f1('0x21')](function(_0x127f9c){if(_0x127f9c){_0x3a58a2=_0x127f9c[_0x74f1('0x32')];if(!_0x3afa2d['query'][_0x74f1('0x33')](_0x74f1('0x49'))){_0x1c717e[_0x74f1('0x1a')]=qs[_0x74f1('0x1a')](_0x3afa2d[_0x74f1('0x2e')][_0x74f1('0x1a')]);_0x1c717e['offset']=qs[_0x74f1('0x1c')](_0x3afa2d[_0x74f1('0x2e')][_0x74f1('0x1c')]);}return _0x384770['getSubjects'](_0x1c717e);}})[_0x74f1('0x21')](function(_0x28c557){if(_0x28c557){return _0x28c557?{'count':_0x3a58a2,'rows':_0x28c557}:null;}})[_0x74f1('0x21')](respondWithResult(_0x4f32e2,null))[_0x74f1('0x3f')](handleError(_0x4f32e2,null));};exports[_0x74f1('0x4c')]=function(_0x15f1bd,_0x507c75,_0x789773){var _0x4cf33d={};var _0x3f565f={};var _0x4acfd7;var _0x5dd90a;return db[_0x74f1('0x29')][_0x74f1('0x47')]({'where':{'id':_0x15f1bd[_0x74f1('0x41')]['id']}})[_0x74f1('0x21')](handleEntityNotFound(_0x507c75,null))[_0x74f1('0x21')](function(_0x18c837){if(_0x18c837){_0x4acfd7=_0x18c837;_0x3f565f[_0x74f1('0x2d')]=_[_0x74f1('0x42')](db[_0x74f1('0x48')][_0x74f1('0x2a')]);_0x3f565f[_0x74f1('0x2e')]=_['keys'](_0x15f1bd[_0x74f1('0x2e')]);_0x3f565f[_0x74f1('0x37')]=_[_0x74f1('0x2f')](_0x3f565f[_0x74f1('0x2d')],_0x3f565f[_0x74f1('0x2e')]);_0x4cf33d[_0x74f1('0x30')]=_[_0x74f1('0x2f')](_0x3f565f['model'],qs['fields'](_0x15f1bd[_0x74f1('0x2e')][_0x74f1('0x31')]));_0x4cf33d['attributes']=_0x4cf33d['attributes'][_0x74f1('0x32')]?_0x4cf33d['attributes']:_0x3f565f[_0x74f1('0x2d')];_0x4cf33d[_0x74f1('0x34')]=qs[_0x74f1('0x35')](_0x15f1bd[_0x74f1('0x2e')][_0x74f1('0x35')]);_0x4cf33d['where']=qs['filters'](_['pick'](_0x15f1bd[_0x74f1('0x2e')],_0x3f565f[_0x74f1('0x37')]));if(_0x15f1bd['query'][_0x74f1('0x39')]){_0x4cf33d[_0x74f1('0x36')]=_[_0x74f1('0x3a')](_0x4cf33d['where'],{'$or':_[_0x74f1('0x28')](_0x4cf33d[_0x74f1('0x30')],function(_0x1de8f9){var _0x46a84b={};_0x46a84b[_0x1de8f9]={'$like':'%'+_0x15f1bd[_0x74f1('0x2e')][_0x74f1('0x39')]+'%'};return _0x46a84b;})});}_0x4cf33d=_[_0x74f1('0x3a')]({},_0x4cf33d,_0x15f1bd[_0x74f1('0x43')]);return _0x4acfd7['getDescriptions'](_0x4cf33d);}})[_0x74f1('0x21')](function(_0x27a8d4){if(_0x27a8d4){_0x5dd90a=_0x27a8d4[_0x74f1('0x32')];if(!_0x15f1bd[_0x74f1('0x2e')][_0x74f1('0x33')](_0x74f1('0x49'))){_0x4cf33d[_0x74f1('0x1a')]=qs[_0x74f1('0x1a')](_0x15f1bd[_0x74f1('0x2e')][_0x74f1('0x1a')]);_0x4cf33d[_0x74f1('0x1c')]=qs['offset'](_0x15f1bd[_0x74f1('0x2e')][_0x74f1('0x1c')]);}return _0x4acfd7[_0x74f1('0x4c')](_0x4cf33d);}})[_0x74f1('0x21')](function(_0x5be66c){if(_0x5be66c){return _0x5be66c?{'count':_0x5dd90a,'rows':_0x5be66c}:null;}})['then'](respondWithResult(_0x507c75,null))['catch'](handleError(_0x507c75,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4ecdd1a..6138bc2 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 _0xe9a4=['exports','int_salesforce_configurations','lodash','util','../../config/logger','moment','./intSalesforceConfiguration.attributes'];(function(_0x13304d,_0x3e84bc){var _0x2dc955=function(_0x1ac22f){while(--_0x1ac22f){_0x13304d['push'](_0x13304d['shift']());}};_0x2dc955(++_0x3e84bc);}(_0xe9a4,0x1c2));var _0x4e9a=function(_0x2634a7,_0x118508){_0x2634a7=_0x2634a7-0x0;var _0xa52e2c=_0xe9a4[_0x2634a7];return _0xa52e2c;};'use strict';var _=require(_0x4e9a('0x0'));var util=require(_0x4e9a('0x1'));var logger=require(_0x4e9a('0x2'))('api');var moment=require(_0x4e9a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e9a('0x4'));module[_0x4e9a('0x5')]=function(_0x456cfb,_0x32e713){return _0x456cfb['define']('SalesforceConfiguration',attributes,{'tableName':_0x4e9a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb80=['api','moment','request-promise','rimraf','../../config/environment','exports','define','int_salesforce_configurations','util','../../config/logger'];(function(_0x2c5ce4,_0x1b4766){var _0x4060a3=function(_0x3d4b86){while(--_0x3d4b86){_0x2c5ce4['push'](_0x2c5ce4['shift']());}};_0x4060a3(++_0x1b4766);}(_0xcb80,0x8a));var _0x0cb8=function(_0x232344,_0x26b3c1){_0x232344=_0x232344-0x0;var _0x27d25a=_0xcb80[_0x232344];return _0x27d25a;};'use strict';var _=require('lodash');var util=require(_0x0cb8('0x0'));var logger=require(_0x0cb8('0x1'))(_0x0cb8('0x2'));var moment=require(_0x0cb8('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cb8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cb8('0x5'));var config=require(_0x0cb8('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x0cb8('0x7')]=function(_0xc64d5a,_0x4cbc3d){return _0xc64d5a[_0x0cb8('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x0cb8('0x9'),'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 77eb36b..15b13ad 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 _0x6de1=['client','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2e524c,_0x44345d){var _0x3bc165=function(_0x1fbca8){while(--_0x1fbca8){_0x2e524c['push'](_0x2e524c['shift']());}};_0x3bc165(++_0x44345d);}(_0x6de1,0xa6));var _0x16de=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x6de1[_0x1f0724];return _0x253ffb;};'use strict';var _=require(_0x16de('0x0'));var util=require(_0x16de('0x1'));var moment=require(_0x16de('0x2'));var BPromise=require(_0x16de('0x3'));var rs=require(_0x16de('0x4'));var fs=require('fs');var Redis=require(_0x16de('0x5'));var db=require(_0x16de('0x6'))['db'];var utils=require(_0x16de('0x7'));var logger=require('../../config/logger')(_0x16de('0x8'));var config=require(_0x16de('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x16de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d952a,_0x4889e6,_0x435295){return new BPromise(function(_0xd182da,_0x3e5aa1){return client['request'](_0x2d952a,_0x435295)['then'](function(_0x39658f){logger[_0x16de('0xb')](_0x16de('0xc'),_0x4889e6,_0x16de('0xd'));logger[_0x16de('0xe')](_0x16de('0xf'),_0x4889e6,_0x16de('0xd'),JSON[_0x16de('0x10')](_0x39658f));if(_0x39658f[_0x16de('0x11')]){if(_0x39658f[_0x16de('0x11')][_0x16de('0x12')]===0x1f4){logger[_0x16de('0x11')](_0x16de('0xc'),_0x4889e6,_0x39658f['error'][_0x16de('0x13')]);return _0x3e5aa1(_0x39658f[_0x16de('0x11')][_0x16de('0x13')]);}logger[_0x16de('0x11')](_0x16de('0xc'),_0x4889e6,_0x39658f[_0x16de('0x11')][_0x16de('0x13')]);return _0xd182da(_0x39658f['error'][_0x16de('0x13')]);}else{logger['info'](_0x16de('0xc'),_0x4889e6,_0x16de('0xd'));_0xd182da(_0x39658f[_0x16de('0x14')][_0x16de('0x13')]);}})[_0x16de('0x15')](function(_0x2374f8){logger[_0x16de('0x11')](_0x16de('0xc'),_0x4889e6,_0x2374f8);_0x3e5aa1(_0x2374f8);});});} \ No newline at end of file +var _0x853c=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x1d085d,_0x1d0f02){var _0x2c2f35=function(_0x3810){while(--_0x3810){_0x1d085d['push'](_0x1d085d['shift']());}};_0x2c2f35(++_0x1d0f02);}(_0x853c,0x13d));var _0xc853=function(_0x48ebde,_0x325ff9){_0x48ebde=_0x48ebde-0x0;var _0xd4221a=_0x853c[_0x48ebde];return _0xd4221a;};'use strict';var _=require(_0xc853('0x0'));var util=require(_0xc853('0x1'));var moment=require(_0xc853('0x2'));var BPromise=require(_0xc853('0x3'));var rs=require(_0xc853('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc853('0x5'));var logger=require(_0xc853('0x6'))(_0xc853('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc853('0x8')][_0xc853('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x444362,_0x576f1e,_0x46c4f6){return new BPromise(function(_0x3dd678,_0x323baf){return client['request'](_0x444362,_0x46c4f6)['then'](function(_0x5bda3b){logger['info'](_0xc853('0xa'),_0x576f1e,_0xc853('0xb'));logger[_0xc853('0xc')](_0xc853('0xd'),_0x576f1e,_0xc853('0xb'),JSON[_0xc853('0xe')](_0x5bda3b));if(_0x5bda3b[_0xc853('0xf')]){if(_0x5bda3b[_0xc853('0xf')][_0xc853('0x10')]===0x1f4){logger[_0xc853('0xf')](_0xc853('0xa'),_0x576f1e,_0x5bda3b[_0xc853('0xf')][_0xc853('0x11')]);return _0x323baf(_0x5bda3b[_0xc853('0xf')][_0xc853('0x11')]);}logger[_0xc853('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x576f1e,_0x5bda3b[_0xc853('0xf')][_0xc853('0x11')]);return _0x3dd678(_0x5bda3b[_0xc853('0xf')][_0xc853('0x11')]);}else{logger[_0xc853('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x576f1e,_0xc853('0xb'));_0x3dd678(_0x5bda3b['result'][_0xc853('0x11')]);}})[_0xc853('0x13')](function(_0x5e1e7b){logger[_0xc853('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x576f1e,_0x5e1e7b);_0x323baf(_0x5e1e7b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 37eb2c1..7780d45 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 _0xa529=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x11ddae,_0x4b8ae4){var _0x437c1a=function(_0x5ad06f){while(--_0x5ad06f){_0x11ddae['push'](_0x11ddae['shift']());}};_0x437c1a(++_0x4b8ae4);}(_0xa529,0x166));var _0x9a52=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa529[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x9a52('0x0'));var util=require('util');var path=require(_0x9a52('0x1'));var timeout=require(_0x9a52('0x2'));var express=require(_0x9a52('0x3'));var router=express['Router']();var fs_extra=require(_0x9a52('0x4'));var auth=require(_0x9a52('0x5'));var interaction=require(_0x9a52('0x6'));var config=require(_0x9a52('0x7'));var controller=require('./intSalesforceField.controller');router[_0x9a52('0x8')]('/',auth[_0x9a52('0x9')](),controller['index']);router[_0x9a52('0x8')](_0x9a52('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9a52('0xb')]('/',auth['isAuthenticated'](),controller[_0x9a52('0xc')]);router[_0x9a52('0xd')](_0x9a52('0xa'),auth[_0x9a52('0x9')](),controller[_0x9a52('0xe')]);router[_0x9a52('0xf')](_0x9a52('0xa'),auth[_0x9a52('0x9')](),controller[_0x9a52('0x10')]);module[_0x9a52('0x11')]=router; \ No newline at end of file +var _0xdb1e=['get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller'];(function(_0x3331cc,_0x189e77){var _0x5bb809=function(_0x11e08c){while(--_0x11e08c){_0x3331cc['push'](_0x3331cc['shift']());}};_0x5bb809(++_0x189e77);}(_0xdb1e,0x70));var _0xedb1=function(_0x3906f3,_0x22a38a){_0x3906f3=_0x3906f3-0x0;var _0x4665c3=_0xdb1e[_0x3906f3];return _0x4665c3;};'use strict';var multer=require(_0xedb1('0x0'));var util=require(_0xedb1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xedb1('0x2')]();var fs_extra=require(_0xedb1('0x3'));var auth=require(_0xedb1('0x4'));var interaction=require(_0xedb1('0x5'));var config=require('../../config/environment');var controller=require(_0xedb1('0x6'));router[_0xedb1('0x7')]('/',auth[_0xedb1('0x8')](),controller[_0xedb1('0x9')]);router['get'](_0xedb1('0xa'),auth['isAuthenticated'](),controller[_0xedb1('0xb')]);router['post']('/',auth[_0xedb1('0x8')](),controller[_0xedb1('0xc')]);router[_0xedb1('0xd')]('/:id',auth[_0xedb1('0x8')](),controller[_0xedb1('0xe')]);router[_0xedb1('0xf')](_0xedb1('0xa'),auth[_0xedb1('0x8')](),controller['destroy']);module[_0xedb1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f62ee55..d21a444 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 _0x248a=['sequelize','exports','ENUM','customVariable','picklist','STRING'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x248a,0x1f2));var _0xa248=function(_0x48ac17,_0x1147b5){_0x48ac17=_0x48ac17-0x0;var _0x12c118=_0x248a[_0x48ac17];return _0x12c118;};'use strict';var Sequelize=require(_0xa248('0x0'));module[_0xa248('0x1')]={'type':{'type':Sequelize[_0xa248('0x2')]('string','variable',_0xa248('0x3'),'keyValue',_0xa248('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa248('0x5')]},'key':{'type':Sequelize[_0xa248('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xa248('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xa248('0x5')]}}; \ No newline at end of file +var _0x6d6e=['exports','ENUM','string','variable','keyValue','STRING','sequelize'];(function(_0x1ca8dd,_0x2b2f46){var _0x26e5bf=function(_0x94e68c){while(--_0x94e68c){_0x1ca8dd['push'](_0x1ca8dd['shift']());}};_0x26e5bf(++_0x2b2f46);}(_0x6d6e,0xbc));var _0xe6d6=function(_0x2a9aa4,_0x5381f3){_0x2a9aa4=_0x2a9aa4-0x0;var _0x5f2160=_0x6d6e[_0x2a9aa4];return _0x5f2160;};'use strict';var Sequelize=require(_0xe6d6('0x0'));module[_0xe6d6('0x1')]={'type':{'type':Sequelize[_0xe6d6('0x2')](_0xe6d6('0x3'),_0xe6d6('0x4'),'customVariable',_0xe6d6('0x5'),'picklist'),'defaultValue':_0xe6d6('0x3')},'content':{'type':Sequelize[_0xe6d6('0x6')]},'key':{'type':Sequelize[_0xe6d6('0x6')]},'keyType':{'type':Sequelize[_0xe6d6('0x2')](_0xe6d6('0x3'),_0xe6d6('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xe6d6('0x6')]},'idField':{'type':Sequelize[_0xe6d6('0x6')]},'variableName':{'type':Sequelize[_0xe6d6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 234173c..acaa660 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 _0x0292=['index','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','create','body','update','find','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send'];(function(_0x487087,_0x448216){var _0xd584b4=function(_0x146b9d){while(--_0x146b9d){_0x487087['push'](_0x487087['shift']());}};_0xd584b4(++_0x448216);}(_0x0292,0x14a));var _0x2029=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x0292[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x2029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2029('0x1'));var rp=require(_0x2029('0x2'));var moment=require('moment');var BPromise=require(_0x2029('0x3'));var Mustache=require('mustache');var util=require(_0x2029('0x4'));var path=require(_0x2029('0x5'));var sox=require(_0x2029('0x6'));var csv=require(_0x2029('0x7'));var ejs=require(_0x2029('0x8'));var fs=require('fs');var fs_extra=require(_0x2029('0x9'));var _=require(_0x2029('0xa'));var squel=require(_0x2029('0xb'));var crypto=require(_0x2029('0xc'));var jsforce=require(_0x2029('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2029('0x7'));var querystring=require('querystring');var Papa=require(_0x2029('0xe'));var Redis=require(_0x2029('0xf'));var authService=require(_0x2029('0x10'));var qs=require(_0x2029('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2029('0x12'));var logger=require(_0x2029('0x13'))('api');var utils=require(_0x2029('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2029('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c9c3,_0x2a65a0){_0x2a65a0=_0x2a65a0||0xcc;return function(_0x1f405b){if(_0x1f405b){return _0x45c9c3[_0x2029('0x16')](_0x2a65a0);}return _0x45c9c3['status'](_0x2a65a0)[_0x2029('0x17')]();};}function respondWithResult(_0x45c298,_0x41d196){_0x41d196=_0x41d196||0xc8;return function(_0x58d6d1){if(_0x58d6d1){return _0x45c298[_0x2029('0x18')](_0x41d196)[_0x2029('0x19')](_0x58d6d1);}};}function respondWithFilteredResult(_0x5e138f,_0x47baf3){return function(_0x4116a9){if(_0x4116a9){var _0x185a02=typeof _0x47baf3[_0x2029('0x1a')]===_0x2029('0x1b')&&typeof _0x47baf3[_0x2029('0x1c')]==='undefined';var _0x102b14=_0x4116a9[_0x2029('0x1d')];var _0x4ae755=_0x185a02?0x0:_0x47baf3['offset'];var _0x42c238=_0x185a02?_0x4116a9['count']:_0x47baf3['offset']+_0x47baf3['limit'];var _0xec4c40;if(_0x42c238>=_0x102b14){_0x42c238=_0x102b14;_0xec4c40=0xc8;}else{_0xec4c40=0xce;}_0x5e138f['status'](_0xec4c40);return _0x5e138f[_0x2029('0x1e')](_0x2029('0x1f'),_0x4ae755+'-'+_0x42c238+'/'+_0x102b14)['json'](_0x4116a9);}return null;};}function patchUpdates(_0x53b4ad){return function(_0x4c97f1){try{jsonpatch[_0x2029('0x20')](_0x4c97f1,_0x53b4ad,!![]);}catch(_0x45c2d8){return BPromise[_0x2029('0x21')](_0x45c2d8);}return _0x4c97f1[_0x2029('0x22')]();};}function saveUpdates(_0x513c00,_0x5b2f30){return function(_0x47563b){if(_0x47563b){return _0x47563b['update'](_0x513c00)[_0x2029('0x23')](function(_0x65a33e){return _0x65a33e;});}return null;};}function removeEntity(_0x16d55d,_0x2a13e8){return function(_0x1e23b4){if(_0x1e23b4){return _0x1e23b4[_0x2029('0x24')]()[_0x2029('0x23')](function(){_0x16d55d[_0x2029('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0b1d,_0x12e541){return function(_0xb217ec){if(!_0xb217ec){_0x5a0b1d[_0x2029('0x16')](0x194);}return _0xb217ec;};}function handleError(_0x167a0c,_0x1cb878){_0x1cb878=_0x1cb878||0x1f4;return function(_0x94538a){logger['error'](_0x94538a[_0x2029('0x25')]);if(_0x94538a[_0x2029('0x26')]){delete _0x94538a[_0x2029('0x26')];}_0x167a0c['status'](_0x1cb878)[_0x2029('0x27')](_0x94538a);};}exports[_0x2029('0x28')]=function(_0x14e882,_0x467cbf){var _0xc288c5={},_0x55f0ab={},_0x5e35c0={'count':0x0,'rows':[]};var _0x3d4072=_[_0x2029('0x29')](db[_0x2029('0x2a')][_0x2029('0x2b')],function(_0x55b2a1){return{'name':_0x55b2a1[_0x2029('0x2c')],'type':_0x55b2a1[_0x2029('0x2d')]['key']};});_0x55f0ab[_0x2029('0x2e')]=_[_0x2029('0x29')](_0x3d4072,_0x2029('0x26'));_0x55f0ab[_0x2029('0x2f')]=_[_0x2029('0x30')](_0x14e882[_0x2029('0x2f')]);_0x55f0ab[_0x2029('0x31')]=_[_0x2029('0x32')](_0x55f0ab['model'],_0x55f0ab[_0x2029('0x2f')]);_0xc288c5['attributes']=_[_0x2029('0x32')](_0x55f0ab[_0x2029('0x2e')],qs[_0x2029('0x33')](_0x14e882[_0x2029('0x2f')][_0x2029('0x33')]));_0xc288c5['attributes']=_0xc288c5[_0x2029('0x34')][_0x2029('0x35')]?_0xc288c5[_0x2029('0x34')]:_0x55f0ab[_0x2029('0x2e')];if(!_0x14e882[_0x2029('0x2f')][_0x2029('0x36')]('nolimit')){_0xc288c5['limit']=qs['limit'](_0x14e882[_0x2029('0x2f')][_0x2029('0x1c')]);_0xc288c5['offset']=qs[_0x2029('0x1a')](_0x14e882[_0x2029('0x2f')][_0x2029('0x1a')]);}_0xc288c5[_0x2029('0x37')]=qs['sort'](_0x14e882[_0x2029('0x2f')][_0x2029('0x38')]);_0xc288c5[_0x2029('0x39')]=qs[_0x2029('0x31')](_[_0x2029('0x3a')](_0x14e882['query'],_0x55f0ab['filters']),_0x3d4072);if(_0x14e882[_0x2029('0x2f')]['filter']){_0xc288c5[_0x2029('0x39')]=_[_0x2029('0x3b')](_0xc288c5[_0x2029('0x39')],{'$or':_[_0x2029('0x29')](_0x3d4072,function(_0x3662b0){if(_0x3662b0[_0x2029('0x2d')]!==_0x2029('0x3c')){var _0x48725d={};_0x48725d[_0x3662b0[_0x2029('0x26')]]={'$like':'%'+_0x14e882[_0x2029('0x2f')][_0x2029('0x3d')]+'%'};return _0x48725d;}})});}_0xc288c5=_[_0x2029('0x3b')]({},_0xc288c5,_0x14e882[_0x2029('0x3e')]);var _0x79c439={'where':_0xc288c5[_0x2029('0x39')]};return db[_0x2029('0x2a')][_0x2029('0x1d')](_0x79c439)[_0x2029('0x23')](function(_0x7610e3){_0x5e35c0['count']=_0x7610e3;if(_0x14e882[_0x2029('0x2f')][_0x2029('0x3f')]){_0xc288c5[_0x2029('0x40')]=[{'all':!![]}];}return db[_0x2029('0x2a')][_0x2029('0x41')](_0xc288c5);})[_0x2029('0x23')](function(_0x4e2f5c){_0x5e35c0[_0x2029('0x42')]=_0x4e2f5c;return _0x5e35c0;})[_0x2029('0x23')](respondWithFilteredResult(_0x467cbf,_0xc288c5))['catch'](handleError(_0x467cbf,null));};exports[_0x2029('0x43')]=function(_0x212de8,_0x4317da){var _0x39ae4f={'raw':!![],'where':{'id':_0x212de8[_0x2029('0x44')]['id']}},_0x58a453={};_0x58a453[_0x2029('0x2e')]=_['keys'](db[_0x2029('0x2a')][_0x2029('0x2b')]);_0x58a453[_0x2029('0x2f')]=_[_0x2029('0x30')](_0x212de8['query']);_0x58a453[_0x2029('0x31')]=_[_0x2029('0x32')](_0x58a453[_0x2029('0x2e')],_0x58a453[_0x2029('0x2f')]);_0x39ae4f[_0x2029('0x34')]=_['intersection'](_0x58a453['model'],qs[_0x2029('0x33')](_0x212de8[_0x2029('0x2f')]['fields']));_0x39ae4f[_0x2029('0x34')]=_0x39ae4f[_0x2029('0x34')][_0x2029('0x35')]?_0x39ae4f['attributes']:_0x58a453['model'];if(_0x212de8['query'][_0x2029('0x3f')]){_0x39ae4f['include']=[{'all':!![]}];}_0x39ae4f=_[_0x2029('0x3b')]({},_0x39ae4f,_0x212de8[_0x2029('0x3e')]);return db['SalesforceField']['find'](_0x39ae4f)['then'](handleEntityNotFound(_0x4317da,null))[_0x2029('0x23')](respondWithResult(_0x4317da,null))[_0x2029('0x45')](handleError(_0x4317da,null));};exports[_0x2029('0x46')]=function(_0x2e5058,_0x4b9802){return db[_0x2029('0x2a')]['create'](_0x2e5058[_0x2029('0x47')],{})[_0x2029('0x23')](respondWithResult(_0x4b9802,0xc9))[_0x2029('0x45')](handleError(_0x4b9802,null));};exports[_0x2029('0x48')]=function(_0x24249e,_0xfeda5a){if(_0x24249e[_0x2029('0x47')]['id']){delete _0x24249e[_0x2029('0x47')]['id'];}return db[_0x2029('0x2a')][_0x2029('0x49')]({'where':{'id':_0x24249e[_0x2029('0x44')]['id']}})[_0x2029('0x23')](handleEntityNotFound(_0xfeda5a,null))[_0x2029('0x23')](saveUpdates(_0x24249e[_0x2029('0x47')],null))[_0x2029('0x23')](respondWithResult(_0xfeda5a,null))[_0x2029('0x45')](handleError(_0xfeda5a,null));};exports[_0x2029('0x24')]=function(_0x2327d7,_0x191538){return db[_0x2029('0x2a')][_0x2029('0x49')]({'where':{'id':_0x2327d7['params']['id']}})[_0x2029('0x23')](handleEntityNotFound(_0x191538,null))[_0x2029('0x23')](removeEntity(_0x191538,null))[_0x2029('0x45')](handleError(_0x191538,null));}; \ No newline at end of file +var _0x3b8a=['limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','SalesforceField','findAll','rows','catch','show','params','keys','includeAll','create','body','find','eml-format','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x3b8a,0x78));var _0xa3b8=function(_0x9faabd,_0x9ed66f){_0x9faabd=_0x9faabd-0x0;var _0x32aa1f=_0x3b8a[_0x9faabd];return _0x32aa1f;};'use strict';var emlformat=require(_0xa3b8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3b8('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa3b8('0x2'));var util=require(_0xa3b8('0x3'));var path=require(_0xa3b8('0x4'));var sox=require(_0xa3b8('0x5'));var csv=require('to-csv');var ejs=require(_0xa3b8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3b8('0x7'));var squel=require(_0xa3b8('0x8'));var crypto=require('crypto');var jsforce=require(_0xa3b8('0x9'));var deskjs=require(_0xa3b8('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa3b8('0xb'));var Papa=require('papaparse');var Redis=require(_0xa3b8('0xc'));var authService=require(_0xa3b8('0xd'));var qs=require(_0xa3b8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3b8('0xf'))(_0xa3b8('0x10'));var utils=require(_0xa3b8('0x11'));var config=require(_0xa3b8('0x12'));var licenseUtil=require(_0xa3b8('0x13'));var db=require(_0xa3b8('0x14'))['db'];function respondWithStatusCode(_0x22a512,_0x3df404){_0x3df404=_0x3df404||0xcc;return function(_0x35c9ce){if(_0x35c9ce){return _0x22a512['sendStatus'](_0x3df404);}return _0x22a512[_0xa3b8('0x15')](_0x3df404)[_0xa3b8('0x16')]();};}function respondWithResult(_0x41120b,_0x14bd3f){_0x14bd3f=_0x14bd3f||0xc8;return function(_0x588442){if(_0x588442){return _0x41120b[_0xa3b8('0x15')](_0x14bd3f)[_0xa3b8('0x17')](_0x588442);}};}function respondWithFilteredResult(_0x203147,_0x589727){return function(_0x118306){if(_0x118306){var _0x4a8d38=typeof _0x589727[_0xa3b8('0x18')]===_0xa3b8('0x19')&&typeof _0x589727[_0xa3b8('0x1a')]===_0xa3b8('0x19');var _0x48465f=_0x118306[_0xa3b8('0x1b')];var _0x486de0=_0x4a8d38?0x0:_0x589727[_0xa3b8('0x18')];var _0x850c4b=_0x4a8d38?_0x118306[_0xa3b8('0x1b')]:_0x589727['offset']+_0x589727['limit'];var _0x3ca538;if(_0x850c4b>=_0x48465f){_0x850c4b=_0x48465f;_0x3ca538=0xc8;}else{_0x3ca538=0xce;}_0x203147[_0xa3b8('0x15')](_0x3ca538);return _0x203147[_0xa3b8('0x1c')](_0xa3b8('0x1d'),_0x486de0+'-'+_0x850c4b+'/'+_0x48465f)['json'](_0x118306);}return null;};}function patchUpdates(_0x3712e1){return function(_0x494c93){try{jsonpatch[_0xa3b8('0x1e')](_0x494c93,_0x3712e1,!![]);}catch(_0x4d7346){return BPromise[_0xa3b8('0x1f')](_0x4d7346);}return _0x494c93['save']();};}function saveUpdates(_0x4ffff4,_0x181314){return function(_0x5176fb){if(_0x5176fb){return _0x5176fb[_0xa3b8('0x20')](_0x4ffff4)[_0xa3b8('0x21')](function(_0x485a84){return _0x485a84;});}return null;};}function removeEntity(_0x24b89f,_0x57c237){return function(_0x3d6a89){if(_0x3d6a89){return _0x3d6a89[_0xa3b8('0x22')]()[_0xa3b8('0x21')](function(){_0x24b89f[_0xa3b8('0x15')](0xcc)[_0xa3b8('0x16')]();});}};}function handleEntityNotFound(_0x52f0ce,_0x28259d){return function(_0x4cb9a1){if(!_0x4cb9a1){_0x52f0ce[_0xa3b8('0x23')](0x194);}return _0x4cb9a1;};}function handleError(_0x370e01,_0x11633a){_0x11633a=_0x11633a||0x1f4;return function(_0x564831){logger[_0xa3b8('0x24')](_0x564831[_0xa3b8('0x25')]);if(_0x564831[_0xa3b8('0x26')]){delete _0x564831['name'];}_0x370e01['status'](_0x11633a)[_0xa3b8('0x27')](_0x564831);};}exports[_0xa3b8('0x28')]=function(_0x3e452c,_0x2bd026){var _0x1036cd={},_0x49a8df={},_0x2b3fdd={'count':0x0,'rows':[]};var _0x2f1097=_[_0xa3b8('0x29')](db['SalesforceField'][_0xa3b8('0x2a')],function(_0x15f065){return{'name':_0x15f065[_0xa3b8('0x2b')],'type':_0x15f065[_0xa3b8('0x2c')][_0xa3b8('0x2d')]};});_0x49a8df['model']=_[_0xa3b8('0x29')](_0x2f1097,_0xa3b8('0x26'));_0x49a8df[_0xa3b8('0x2e')]=_['keys'](_0x3e452c[_0xa3b8('0x2e')]);_0x49a8df[_0xa3b8('0x2f')]=_[_0xa3b8('0x30')](_0x49a8df[_0xa3b8('0x31')],_0x49a8df[_0xa3b8('0x2e')]);_0x1036cd[_0xa3b8('0x32')]=_[_0xa3b8('0x30')](_0x49a8df[_0xa3b8('0x31')],qs[_0xa3b8('0x33')](_0x3e452c[_0xa3b8('0x2e')][_0xa3b8('0x33')]));_0x1036cd[_0xa3b8('0x32')]=_0x1036cd[_0xa3b8('0x32')][_0xa3b8('0x34')]?_0x1036cd['attributes']:_0x49a8df[_0xa3b8('0x31')];if(!_0x3e452c[_0xa3b8('0x2e')]['hasOwnProperty']('nolimit')){_0x1036cd[_0xa3b8('0x1a')]=qs['limit'](_0x3e452c['query'][_0xa3b8('0x1a')]);_0x1036cd[_0xa3b8('0x18')]=qs[_0xa3b8('0x18')](_0x3e452c[_0xa3b8('0x2e')]['offset']);}_0x1036cd[_0xa3b8('0x35')]=qs[_0xa3b8('0x36')](_0x3e452c[_0xa3b8('0x2e')][_0xa3b8('0x36')]);_0x1036cd[_0xa3b8('0x37')]=qs[_0xa3b8('0x2f')](_[_0xa3b8('0x38')](_0x3e452c['query'],_0x49a8df['filters']),_0x2f1097);if(_0x3e452c['query'][_0xa3b8('0x39')]){_0x1036cd[_0xa3b8('0x37')]=_[_0xa3b8('0x3a')](_0x1036cd[_0xa3b8('0x37')],{'$or':_['map'](_0x2f1097,function(_0x12226a){if(_0x12226a['type']!==_0xa3b8('0x3b')){var _0x4e06ce={};_0x4e06ce[_0x12226a[_0xa3b8('0x26')]]={'$like':'%'+_0x3e452c[_0xa3b8('0x2e')]['filter']+'%'};return _0x4e06ce;}})});}_0x1036cd=_[_0xa3b8('0x3a')]({},_0x1036cd,_0x3e452c[_0xa3b8('0x3c')]);var _0x32db1e={'where':_0x1036cd['where']};return db['SalesforceField'][_0xa3b8('0x1b')](_0x32db1e)[_0xa3b8('0x21')](function(_0x209b16){_0x2b3fdd[_0xa3b8('0x1b')]=_0x209b16;if(_0x3e452c[_0xa3b8('0x2e')]['includeAll']){_0x1036cd[_0xa3b8('0x3d')]=[{'all':!![]}];}return db[_0xa3b8('0x3e')][_0xa3b8('0x3f')](_0x1036cd);})[_0xa3b8('0x21')](function(_0x52b7df){_0x2b3fdd[_0xa3b8('0x40')]=_0x52b7df;return _0x2b3fdd;})[_0xa3b8('0x21')](respondWithFilteredResult(_0x2bd026,_0x1036cd))[_0xa3b8('0x41')](handleError(_0x2bd026,null));};exports[_0xa3b8('0x42')]=function(_0x39cbe4,_0x561721){var _0xd6a19={'raw':!![],'where':{'id':_0x39cbe4[_0xa3b8('0x43')]['id']}},_0x1080dc={};_0x1080dc[_0xa3b8('0x31')]=_['keys'](db[_0xa3b8('0x3e')][_0xa3b8('0x2a')]);_0x1080dc[_0xa3b8('0x2e')]=_[_0xa3b8('0x44')](_0x39cbe4['query']);_0x1080dc[_0xa3b8('0x2f')]=_[_0xa3b8('0x30')](_0x1080dc[_0xa3b8('0x31')],_0x1080dc['query']);_0xd6a19[_0xa3b8('0x32')]=_[_0xa3b8('0x30')](_0x1080dc['model'],qs[_0xa3b8('0x33')](_0x39cbe4['query'][_0xa3b8('0x33')]));_0xd6a19[_0xa3b8('0x32')]=_0xd6a19[_0xa3b8('0x32')]['length']?_0xd6a19['attributes']:_0x1080dc[_0xa3b8('0x31')];if(_0x39cbe4[_0xa3b8('0x2e')][_0xa3b8('0x45')]){_0xd6a19[_0xa3b8('0x3d')]=[{'all':!![]}];}_0xd6a19=_[_0xa3b8('0x3a')]({},_0xd6a19,_0x39cbe4['options']);return db[_0xa3b8('0x3e')]['find'](_0xd6a19)['then'](handleEntityNotFound(_0x561721,null))[_0xa3b8('0x21')](respondWithResult(_0x561721,null))['catch'](handleError(_0x561721,null));};exports[_0xa3b8('0x46')]=function(_0x94c6c6,_0x3d5ccb){return db[_0xa3b8('0x3e')][_0xa3b8('0x46')](_0x94c6c6[_0xa3b8('0x47')],{})[_0xa3b8('0x21')](respondWithResult(_0x3d5ccb,0xc9))[_0xa3b8('0x41')](handleError(_0x3d5ccb,null));};exports['update']=function(_0x527a1a,_0x133cad){if(_0x527a1a[_0xa3b8('0x47')]['id']){delete _0x527a1a[_0xa3b8('0x47')]['id'];}return db[_0xa3b8('0x3e')][_0xa3b8('0x48')]({'where':{'id':_0x527a1a[_0xa3b8('0x43')]['id']}})[_0xa3b8('0x21')](handleEntityNotFound(_0x133cad,null))[_0xa3b8('0x21')](saveUpdates(_0x527a1a[_0xa3b8('0x47')],null))['then'](respondWithResult(_0x133cad,null))[_0xa3b8('0x41')](handleError(_0x133cad,null));};exports[_0xa3b8('0x22')]=function(_0x31a9db,_0x34c5cc){return db[_0xa3b8('0x3e')]['find']({'where':{'id':_0x31a9db[_0xa3b8('0x43')]['id']}})['then'](handleEntityNotFound(_0x34c5cc,null))[_0xa3b8('0x21')](removeEntity(_0x34c5cc,null))[_0xa3b8('0x41')](handleError(_0x34c5cc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d9c5e2d..770e7bf 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 _0xeb6a=['bluebird','request-promise','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x4fa33b,_0x4eb49a){var _0x10003e=function(_0x5f38e3){while(--_0x5f38e3){_0x4fa33b['push'](_0x4fa33b['shift']());}};_0x10003e(++_0x4eb49a);}(_0xeb6a,0x184));var _0xaeb6=function(_0x26b6f8,_0x277839){_0x26b6f8=_0x26b6f8-0x0;var _0x4b86ec=_0xeb6a[_0x26b6f8];return _0x4b86ec;};'use strict';var _=require(_0xaeb6('0x0'));var util=require('util');var logger=require(_0xaeb6('0x1'))(_0xaeb6('0x2'));var moment=require(_0xaeb6('0x3'));var BPromise=require(_0xaeb6('0x4'));var rp=require(_0xaeb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaeb6('0x6'));var attributes=require(_0xaeb6('0x7'));module[_0xaeb6('0x8')]=function(_0x36eb69,_0x4a2c1e){return _0x36eb69[_0xaeb6('0x9')](_0xaeb6('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xaeb6('0xb'),'fields':[_0xaeb6('0xc'),_0xaeb6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa855=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x200992,_0x38da85){var _0x40fc51=function(_0x2f0021){while(--_0x2f0021){_0x200992['push'](_0x200992['shift']());}};_0x40fc51(++_0x38da85);}(_0xa855,0x164));var _0x5a85=function(_0x1d53a8,_0x533494){_0x1d53a8=_0x1d53a8-0x0;var _0x2a3bbc=_0xa855[_0x1d53a8];return _0x2a3bbc;};'use strict';var _=require('lodash');var util=require(_0x5a85('0x0'));var logger=require('../../config/logger')(_0x5a85('0x1'));var moment=require(_0x5a85('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a85('0x3'));var rimraf=require(_0x5a85('0x4'));var config=require(_0x5a85('0x5'));var attributes=require(_0x5a85('0x6'));module[_0x5a85('0x7')]=function(_0x2180b2,_0x2cdef7){return _0x2180b2[_0x5a85('0x8')](_0x5a85('0x9'),attributes,{'tableName':_0x5a85('0xa'),'paranoid':![],'indexes':[{'name':_0x5a85('0xb'),'fields':[_0x5a85('0xc'),_0x5a85('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index eadbc03..fa94fe1 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 _0x2666=['error','code','message','request\x20sent','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5d2663,_0x4f3684){var _0x2ff24b=function(_0x20b7ea){while(--_0x20b7ea){_0x5d2663['push'](_0x5d2663['shift']());}};_0x2ff24b(++_0x4f3684);}(_0x2666,0x14f));var _0x6266=function(_0x4f9c26,_0x98ab50){_0x4f9c26=_0x4f9c26-0x0;var _0x265624=_0x2666[_0x4f9c26];return _0x265624;};'use strict';var _=require(_0x6266('0x0'));var util=require('util');var moment=require(_0x6266('0x1'));var BPromise=require(_0x6266('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6266('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6266('0x4'));var logger=require(_0x6266('0x5'))(_0x6266('0x6'));var config=require(_0x6266('0x7'));var jayson=require(_0x6266('0x8'));var client=jayson[_0x6266('0x9')][_0x6266('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4490,_0x4ee39e,_0x328ab9){return new BPromise(function(_0x415138,_0x29bef8){return client[_0x6266('0xb')](_0x1d4490,_0x328ab9)[_0x6266('0xc')](function(_0x5e36b7){logger[_0x6266('0xd')](_0x6266('0xe'),_0x4ee39e,'request\x20sent');logger[_0x6266('0xf')](_0x6266('0x10'),_0x4ee39e,'request\x20sent',JSON['stringify'](_0x5e36b7));if(_0x5e36b7[_0x6266('0x11')]){if(_0x5e36b7['error'][_0x6266('0x12')]===0x1f4){logger[_0x6266('0x11')](_0x6266('0xe'),_0x4ee39e,_0x5e36b7[_0x6266('0x11')][_0x6266('0x13')]);return _0x29bef8(_0x5e36b7[_0x6266('0x11')][_0x6266('0x13')]);}logger[_0x6266('0x11')](_0x6266('0xe'),_0x4ee39e,_0x5e36b7['error'][_0x6266('0x13')]);return _0x415138(_0x5e36b7[_0x6266('0x11')][_0x6266('0x13')]);}else{logger[_0x6266('0xd')](_0x6266('0xe'),_0x4ee39e,_0x6266('0x14'));_0x415138(_0x5e36b7[_0x6266('0x15')][_0x6266('0x13')]);}})['catch'](function(_0x44cd72){logger[_0x6266('0x11')](_0x6266('0xe'),_0x4ee39e,_0x44cd72);_0x29bef8(_0x44cd72);});});} \ No newline at end of file +var _0x8c10=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x536b66,_0x3acd4a){var _0x1ca102=function(_0x281815){while(--_0x281815){_0x536b66['push'](_0x536b66['shift']());}};_0x1ca102(++_0x3acd4a);}(_0x8c10,0x92));var _0x08c1=function(_0x5d69fb,_0x4dbe41){_0x5d69fb=_0x5d69fb-0x0;var _0x5d0d93=_0x8c10[_0x5d69fb];return _0x5d0d93;};'use strict';var _=require(_0x08c1('0x0'));var util=require(_0x08c1('0x1'));var moment=require(_0x08c1('0x2'));var BPromise=require(_0x08c1('0x3'));var rs=require(_0x08c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08c1('0x5'))['db'];var utils=require(_0x08c1('0x6'));var logger=require(_0x08c1('0x7'))(_0x08c1('0x8'));var config=require(_0x08c1('0x9'));var jayson=require(_0x08c1('0xa'));var client=jayson[_0x08c1('0xb')][_0x08c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x548d14,_0x41d0a5,_0xa66c8e){return new BPromise(function(_0x5647af,_0x4d3ab7){return client[_0x08c1('0xd')](_0x548d14,_0xa66c8e)['then'](function(_0x5d42b8){logger[_0x08c1('0xe')](_0x08c1('0xf'),_0x41d0a5,_0x08c1('0x10'));logger[_0x08c1('0x11')](_0x08c1('0x12'),_0x41d0a5,_0x08c1('0x10'),JSON[_0x08c1('0x13')](_0x5d42b8));if(_0x5d42b8[_0x08c1('0x14')]){if(_0x5d42b8[_0x08c1('0x14')][_0x08c1('0x15')]===0x1f4){logger['error'](_0x08c1('0xf'),_0x41d0a5,_0x5d42b8[_0x08c1('0x14')]['message']);return _0x4d3ab7(_0x5d42b8[_0x08c1('0x14')][_0x08c1('0x16')]);}logger['error'](_0x08c1('0xf'),_0x41d0a5,_0x5d42b8[_0x08c1('0x14')][_0x08c1('0x16')]);return _0x5647af(_0x5d42b8[_0x08c1('0x14')][_0x08c1('0x16')]);}else{logger[_0x08c1('0xe')](_0x08c1('0xf'),_0x41d0a5,_0x08c1('0x10'));_0x5647af(_0x5d42b8[_0x08c1('0x17')][_0x08c1('0x16')]);}})[_0x08c1('0x18')](function(_0x5ab64a){logger['error'](_0x08c1('0xf'),_0x41d0a5,_0x5ab64a);_0x4d3ab7(_0x5ab64a);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3bf77dc..c10993b 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 _0x8150=['addConfiguration','put','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x8150,0x1a7));var _0x0815=function(_0x2708f3,_0x10466a){_0x2708f3=_0x2708f3-0x0;var _0x3ab1a1=_0x8150[_0x2708f3];return _0x3ab1a1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0815('0x0'));var express=require(_0x0815('0x1'));var router=express[_0x0815('0x2')]();var fs_extra=require(_0x0815('0x3'));var auth=require(_0x0815('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0815('0x5'));var controller=require('./intServicenowAccount.controller');router[_0x0815('0x6')]('/',auth[_0x0815('0x7')](),controller[_0x0815('0x8')]);router['get'](_0x0815('0x9'),auth[_0x0815('0x7')](),controller[_0x0815('0xa')]);router[_0x0815('0x6')](_0x0815('0xb'),auth[_0x0815('0x7')](),controller[_0x0815('0xc')]);router[_0x0815('0x6')](_0x0815('0xd'),auth[_0x0815('0x7')](),controller[_0x0815('0xe')]);router[_0x0815('0xf')]('/',auth['isAuthenticated'](),controller[_0x0815('0x10')]);router[_0x0815('0xf')]('/:id/configurations',auth[_0x0815('0x7')](),controller[_0x0815('0x11')]);router[_0x0815('0x12')]('/:id',auth[_0x0815('0x7')](),controller[_0x0815('0x13')]);router[_0x0815('0x14')](_0x0815('0x9'),auth[_0x0815('0x7')](),controller['destroy']);module[_0x0815('0x15')]=router; \ No newline at end of file +var _0x151b=['connect-timeout','Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','multer'];(function(_0x321d0f,_0x1119cd){var _0x190e2c=function(_0x5e2803){while(--_0x5e2803){_0x321d0f['push'](_0x321d0f['shift']());}};_0x190e2c(++_0x1119cd);}(_0x151b,0x153));var _0xb151=function(_0x4a6e32,_0x4438bc){_0x4a6e32=_0x4a6e32-0x0;var _0x4032f5=_0x151b[_0x4a6e32];return _0x4032f5;};'use strict';var multer=require(_0xb151('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb151('0x1'));var express=require('express');var router=express[_0xb151('0x2')]();var fs_extra=require(_0xb151('0x3'));var auth=require(_0xb151('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb151('0x5'));router[_0xb151('0x6')]('/',auth['isAuthenticated'](),controller[_0xb151('0x7')]);router['get'](_0xb151('0x8'),auth[_0xb151('0x9')](),controller[_0xb151('0xa')]);router['get']('/:id/configurations',auth[_0xb151('0x9')](),controller[_0xb151('0xb')]);router['get']('/:id/fields',auth[_0xb151('0x9')](),controller[_0xb151('0xc')]);router[_0xb151('0xd')]('/',auth[_0xb151('0x9')](),controller[_0xb151('0xe')]);router[_0xb151('0xd')](_0xb151('0xf'),auth[_0xb151('0x9')](),controller[_0xb151('0x10')]);router[_0xb151('0x11')]('/:id',auth[_0xb151('0x9')](),controller['update']);router[_0xb151('0x12')](_0xb151('0x8'),auth[_0xb151('0x9')](),controller[_0xb151('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ac3ec1e..5d97324 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 _0x29b9=['remoteUri','sequelize','STRING','username'];(function(_0x359fb8,_0x5b363d){var _0x3237a8=function(_0x1889bb){while(--_0x1889bb){_0x359fb8['push'](_0x359fb8['shift']());}};_0x3237a8(++_0x5b363d);}(_0x29b9,0x1e1));var _0x929b=function(_0x31abf4,_0x2040d8){_0x31abf4=_0x31abf4-0x0;var _0x3cf935=_0x29b9[_0x31abf4];return _0x3cf935;};'use strict';var Sequelize=require(_0x929b('0x0'));module['exports']={'name':{'type':Sequelize[_0x929b('0x1')]},'description':{'type':Sequelize[_0x929b('0x1')]},'username':{'type':Sequelize[_0x929b('0x1')],'unique':_0x929b('0x2')},'password':{'type':Sequelize[_0x929b('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x929b('0x1')],'unique':_0x929b('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6206=['STRING','username','remoteUri','sequelize'];(function(_0x404f55,_0x2814e3){var _0x395a9e=function(_0x5846e9){while(--_0x5846e9){_0x404f55['push'](_0x404f55['shift']());}};_0x395a9e(++_0x2814e3);}(_0x6206,0x93));var _0x6620=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x6206[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x6620('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6620('0x1')],'unique':_0x6620('0x2')},'password':{'type':Sequelize[_0x6620('0x1')]},'email':{'type':Sequelize[_0x6620('0x1')]},'remoteUri':{'type':Sequelize[_0x6620('0x1')],'unique':_0x6620('0x3')},'serverUrl':{'type':Sequelize[_0x6620('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d93a1d5..3102c75 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 _0x9794=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','options','ServicenowAccount','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','ServicenowConfiguration','filter','AccountId','getSubjects','Descriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','close_code','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','incident_state','problem_id','reassignment_count','activity_due','approval','comments_and_work_notes','due_date','sys_mod_count','upon_approval','correlation_id','findOne','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','error','Wrong\x20credentials','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xc2a4ef,_0x2f9e51){var _0x4b041d=function(_0x188a30){while(--_0x188a30){_0xc2a4ef['push'](_0xc2a4ef['shift']());}};_0x4b041d(++_0x2f9e51);}(_0x9794,0xa4));var _0x4979=function(_0x5ce9de,_0x5b62eb){_0x5ce9de=_0x5ce9de-0x0;var _0xeffd40=_0x9794[_0x5ce9de];return _0xeffd40;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4979('0x0'));var rp=require(_0x4979('0x1'));var moment=require(_0x4979('0x2'));var BPromise=require(_0x4979('0x3'));var Mustache=require(_0x4979('0x4'));var util=require(_0x4979('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4979('0x6'));var ejs=require(_0x4979('0x7'));var fs=require('fs');var fs_extra=require(_0x4979('0x8'));var _=require(_0x4979('0x9'));var squel=require(_0x4979('0xa'));var crypto=require(_0x4979('0xb'));var jsforce=require(_0x4979('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4979('0x6'));var querystring=require('querystring');var Papa=require(_0x4979('0xd'));var Redis=require(_0x4979('0xe'));var authService=require(_0x4979('0xf'));var qs=require(_0x4979('0x10'));var as=require(_0x4979('0x11'));var hardwareService=require(_0x4979('0x12'));var logger=require(_0x4979('0x13'))(_0x4979('0x14'));var utils=require(_0x4979('0x15'));var config=require(_0x4979('0x16'));var licenseUtil=require(_0x4979('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4979('0x18'));function respondWithStatusCode(_0x27faad,_0x277dc3){_0x277dc3=_0x277dc3||0xcc;return function(_0x3942a3){if(_0x3942a3){return _0x27faad[_0x4979('0x19')](_0x277dc3);}return _0x27faad[_0x4979('0x1a')](_0x277dc3)[_0x4979('0x1b')]();};}function respondWithResult(_0x2d78dc,_0x47b5e1){_0x47b5e1=_0x47b5e1||0xc8;return function(_0x39fffd){if(_0x39fffd){return _0x2d78dc['status'](_0x47b5e1)[_0x4979('0x1c')](_0x39fffd);}};}function respondWithFilteredResult(_0x580a6c,_0x12832b){return function(_0x3f3759){if(_0x3f3759){var _0xa2cd0a=typeof _0x12832b['offset']===_0x4979('0x1d')&&typeof _0x12832b[_0x4979('0x1e')]===_0x4979('0x1d');var _0x2afcc5=_0x3f3759[_0x4979('0x1f')];var _0x4adce8=_0xa2cd0a?0x0:_0x12832b[_0x4979('0x20')];var _0x5f1fa4=_0xa2cd0a?_0x3f3759[_0x4979('0x1f')]:_0x12832b['offset']+_0x12832b['limit'];var _0x10331d;if(_0x5f1fa4>=_0x2afcc5){_0x5f1fa4=_0x2afcc5;_0x10331d=0xc8;}else{_0x10331d=0xce;}_0x580a6c['status'](_0x10331d);return _0x580a6c[_0x4979('0x21')](_0x4979('0x22'),_0x4adce8+'-'+_0x5f1fa4+'/'+_0x2afcc5)[_0x4979('0x1c')](_0x3f3759);}return null;};}function patchUpdates(_0x31473b){return function(_0x3a6e36){try{jsonpatch[_0x4979('0x23')](_0x3a6e36,_0x31473b,!![]);}catch(_0x22d758){return BPromise[_0x4979('0x24')](_0x22d758);}return _0x3a6e36[_0x4979('0x25')]();};}function saveUpdates(_0x5c5fa5,_0x12da76){return function(_0x90cfe){if(_0x90cfe){return _0x90cfe[_0x4979('0x26')](_0x5c5fa5)[_0x4979('0x27')](function(_0x5f2274){return _0x5f2274;});}return null;};}function removeEntity(_0x290179,_0x2dc42a){return function(_0xf66556){if(_0xf66556){return _0xf66556[_0x4979('0x28')]()['then'](function(){_0x290179[_0x4979('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x333a24,_0x1060a6){return function(_0x47131d){if(!_0x47131d){_0x333a24[_0x4979('0x19')](0x194);}return _0x47131d;};}function handleError(_0x5c3103,_0x122690){_0x122690=_0x122690||0x1f4;return function(_0x43a018){logger['error'](_0x43a018[_0x4979('0x29')]);if(_0x43a018[_0x4979('0x2a')]){delete _0x43a018['name'];}_0x5c3103['status'](_0x122690)[_0x4979('0x2b')](_0x43a018);};}exports[_0x4979('0x2c')]=function(_0xb314b7,_0x3e5e08){var _0x3a79cf={},_0x14faec={},_0x20b02a={'count':0x0,'rows':[]};var _0x467787=_['map'](db['ServicenowAccount'][_0x4979('0x2d')],function(_0x4be74f){return{'name':_0x4be74f[_0x4979('0x2e')],'type':_0x4be74f['type']['key']};});_0x14faec[_0x4979('0x2f')]=_['map'](_0x467787,_0x4979('0x2a'));_0x14faec[_0x4979('0x30')]=_[_0x4979('0x31')](_0xb314b7['query']);_0x14faec[_0x4979('0x32')]=_[_0x4979('0x33')](_0x14faec[_0x4979('0x2f')],_0x14faec[_0x4979('0x30')]);_0x3a79cf['attributes']=_['intersection'](_0x14faec[_0x4979('0x2f')],qs[_0x4979('0x34')](_0xb314b7[_0x4979('0x30')][_0x4979('0x34')]));_0x3a79cf[_0x4979('0x35')]=_0x3a79cf[_0x4979('0x35')]['length']?_0x3a79cf[_0x4979('0x35')]:_0x14faec[_0x4979('0x2f')];if(!_0xb314b7[_0x4979('0x30')][_0x4979('0x36')](_0x4979('0x37'))){_0x3a79cf[_0x4979('0x1e')]=qs[_0x4979('0x1e')](_0xb314b7[_0x4979('0x30')][_0x4979('0x1e')]);_0x3a79cf[_0x4979('0x20')]=qs[_0x4979('0x20')](_0xb314b7['query']['offset']);}_0x3a79cf[_0x4979('0x38')]=qs[_0x4979('0x39')](_0xb314b7[_0x4979('0x30')][_0x4979('0x39')]);_0x3a79cf[_0x4979('0x3a')]=qs[_0x4979('0x32')](_[_0x4979('0x3b')](_0xb314b7[_0x4979('0x30')],_0x14faec[_0x4979('0x32')]),_0x467787);if(_0xb314b7[_0x4979('0x30')]['filter']){_0x3a79cf['where']=_[_0x4979('0x3c')](_0x3a79cf[_0x4979('0x3a')],{'$or':_[_0x4979('0x3d')](_0x467787,function(_0x53eb75){if(_0x53eb75[_0x4979('0x3e')]!=='VIRTUAL'){var _0x438924={};_0x438924[_0x53eb75[_0x4979('0x2a')]]={'$like':'%'+_0xb314b7[_0x4979('0x30')]['filter']+'%'};return _0x438924;}})});}_0x3a79cf=_[_0x4979('0x3c')]({},_0x3a79cf,_0xb314b7[_0x4979('0x3f')]);var _0x575b7a={'where':_0x3a79cf[_0x4979('0x3a')]};return db[_0x4979('0x40')][_0x4979('0x1f')](_0x575b7a)['then'](function(_0x554f6a){_0x20b02a[_0x4979('0x1f')]=_0x554f6a;if(_0xb314b7[_0x4979('0x30')][_0x4979('0x41')]){_0x3a79cf[_0x4979('0x42')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x4979('0x43')](_0x3a79cf);})[_0x4979('0x27')](function(_0x89017d){_0x20b02a[_0x4979('0x44')]=_0x89017d;return _0x20b02a;})['then'](respondWithFilteredResult(_0x3e5e08,_0x3a79cf))[_0x4979('0x45')](handleError(_0x3e5e08,null));};exports[_0x4979('0x46')]=function(_0x4cdae0,_0x3c287b){var _0x1cee22={'raw':![],'where':{'id':_0x4cdae0[_0x4979('0x47')]['id']}},_0x1ce001={};_0x1ce001[_0x4979('0x2f')]=_[_0x4979('0x31')](db[_0x4979('0x40')]['rawAttributes']);_0x1ce001['query']=_[_0x4979('0x31')](_0x4cdae0[_0x4979('0x30')]);_0x1ce001[_0x4979('0x32')]=_[_0x4979('0x33')](_0x1ce001[_0x4979('0x2f')],_0x1ce001['query']);_0x1cee22[_0x4979('0x35')]=_[_0x4979('0x33')](_0x1ce001[_0x4979('0x2f')],qs[_0x4979('0x34')](_0x4cdae0[_0x4979('0x30')]['fields']));_0x1cee22[_0x4979('0x35')]=_0x1cee22[_0x4979('0x35')][_0x4979('0x48')]?_0x1cee22['attributes']:_0x1ce001[_0x4979('0x2f')];if(_0x4cdae0['query']['includeAll']){_0x1cee22[_0x4979('0x42')]=[{'all':!![]}];}_0x1cee22=_[_0x4979('0x3c')]({},_0x1cee22,_0x4cdae0[_0x4979('0x3f')]);return db['ServicenowAccount']['find'](_0x1cee22)['then'](handleEntityNotFound(_0x3c287b,null))['then'](respondWithResult(_0x3c287b,null))['catch'](handleError(_0x3c287b,null));};exports[_0x4979('0x49')]=function(_0xb6ddb6,_0x2af2bb){return db['ServicenowAccount'][_0x4979('0x49')](_0xb6ddb6[_0x4979('0x4a')],{})[_0x4979('0x27')](respondWithResult(_0x2af2bb,0xc9))['catch'](handleError(_0x2af2bb,null));};exports[_0x4979('0x26')]=function(_0xe49b0c,_0x5df98d){if(_0xe49b0c[_0x4979('0x4a')]['id']){delete _0xe49b0c[_0x4979('0x4a')]['id'];}return db[_0x4979('0x40')][_0x4979('0x4b')]({'where':{'id':_0xe49b0c[_0x4979('0x47')]['id']}})['then'](handleEntityNotFound(_0x5df98d,null))[_0x4979('0x27')](saveUpdates(_0xe49b0c[_0x4979('0x4a')],null))[_0x4979('0x27')](respondWithResult(_0x5df98d,null))[_0x4979('0x45')](handleError(_0x5df98d,null));};exports[_0x4979('0x28')]=function(_0x4893dc,_0x37c4e3){return db['ServicenowAccount'][_0x4979('0x4b')]({'where':{'id':_0x4893dc[_0x4979('0x47')]['id']}})[_0x4979('0x27')](handleEntityNotFound(_0x37c4e3,null))[_0x4979('0x27')](removeEntity(_0x37c4e3,null))[_0x4979('0x45')](handleError(_0x37c4e3,null));};exports[_0x4979('0x4c')]=function(_0x3e585e,_0x25d8c6,_0x52614b){var _0x5f318e={};var _0x4d9ee3={};var _0x47fcb5;var _0xfbfc7b;return db[_0x4979('0x40')]['findOne']({'where':{'id':_0x3e585e[_0x4979('0x47')]['id']}})[_0x4979('0x27')](handleEntityNotFound(_0x25d8c6,null))['then'](function(_0x7764f1){if(_0x7764f1){_0x47fcb5=_0x7764f1;_0x4d9ee3[_0x4979('0x2f')]=_[_0x4979('0x31')](db[_0x4979('0x4d')][_0x4979('0x2d')]);_0x4d9ee3[_0x4979('0x30')]=_[_0x4979('0x31')](_0x3e585e[_0x4979('0x30')]);_0x4d9ee3[_0x4979('0x32')]=_[_0x4979('0x33')](_0x4d9ee3['model'],_0x4d9ee3[_0x4979('0x30')]);_0x5f318e[_0x4979('0x35')]=_[_0x4979('0x33')](_0x4d9ee3[_0x4979('0x2f')],qs[_0x4979('0x34')](_0x3e585e[_0x4979('0x30')][_0x4979('0x34')]));_0x5f318e[_0x4979('0x35')]=_0x5f318e[_0x4979('0x35')][_0x4979('0x48')]?_0x5f318e[_0x4979('0x35')]:_0x4d9ee3[_0x4979('0x2f')];_0x5f318e[_0x4979('0x38')]=qs[_0x4979('0x39')](_0x3e585e['query'][_0x4979('0x39')]);_0x5f318e[_0x4979('0x3a')]=qs['filters'](_[_0x4979('0x3b')](_0x3e585e[_0x4979('0x30')],_0x4d9ee3[_0x4979('0x32')]));if(_0x3e585e[_0x4979('0x30')][_0x4979('0x4e')]){_0x5f318e[_0x4979('0x3a')]=_['merge'](_0x5f318e[_0x4979('0x3a')],{'$or':_[_0x4979('0x3d')](_0x5f318e[_0x4979('0x35')],function(_0x1c7474){var _0x221ae5={};_0x221ae5[_0x1c7474]={'$like':'%'+_0x3e585e[_0x4979('0x30')]['filter']+'%'};return _0x221ae5;})});}_0x5f318e=_['merge']({},_0x5f318e,_0x3e585e[_0x4979('0x3f')]);return _0x47fcb5[_0x4979('0x4c')](_0x5f318e);}})[_0x4979('0x27')](function(_0x20c837){if(_0x20c837){_0xfbfc7b=_0x20c837[_0x4979('0x48')];if(!_0x3e585e[_0x4979('0x30')][_0x4979('0x36')](_0x4979('0x37'))){_0x5f318e[_0x4979('0x1e')]=qs[_0x4979('0x1e')](_0x3e585e['query'][_0x4979('0x1e')]);_0x5f318e[_0x4979('0x20')]=qs['offset'](_0x3e585e[_0x4979('0x30')][_0x4979('0x20')]);}return _0x47fcb5['getConfigurations'](_0x5f318e);}})[_0x4979('0x27')](function(_0x2a6e0f){if(_0x2a6e0f){return _0x2a6e0f?{'count':_0xfbfc7b,'rows':_0x2a6e0f}:null;}})['then'](respondWithResult(_0x25d8c6,null))[_0x4979('0x45')](handleError(_0x25d8c6,null));};exports['addConfiguration']=function(_0x271c87,_0x5452a6,_0x3ba122){if(_0x271c87[_0x4979('0x4a')]['id']){delete _0x271c87['body']['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x271c87[_0x4979('0x47')]['id']}})[_0x4979('0x27')](handleEntityNotFound(_0x5452a6,null))['then'](function(_0x5ab244){if(_0x5ab244){_0x271c87[_0x4979('0x4a')][_0x4979('0x4f')]=_0x5ab244['id'];_0x271c87[_0x4979('0x4a')]['Subjects']=integrations[_0x4979('0x50')](_0x271c87['body']['channel'],_0x271c87[_0x4979('0x4a')]['type']);_0x271c87[_0x4979('0x4a')][_0x4979('0x51')]=integrations['getDescriptions'](_0x271c87['body'][_0x4979('0x52')],_0x271c87[_0x4979('0x4a')][_0x4979('0x3e')]);return db[_0x4979('0x4d')][_0x4979('0x49')](_0x271c87[_0x4979('0x4a')],{'include':[{'model':db[_0x4979('0x53')],'as':'Subjects'},{'model':db[_0x4979('0x53')],'as':_0x4979('0x51')}]});}return null;})['then'](respondWithResult(_0x5452a6,null))[_0x4979('0x45')](handleError(_0x5452a6,null));};exports[_0x4979('0x54')]=function(_0x19dcc4,_0x97701c,_0x6f62b6){var _0x59395e=[_0x4979('0x55'),_0x4979('0x56'),_0x4979('0x57'),_0x4979('0x58'),'close_code',_0x4979('0x59'),'incident_state',_0x4979('0x5a'),_0x4979('0x5b')];var _0x46e974=[_0x4979('0x5c'),_0x4979('0x55'),_0x4979('0x5d'),_0x4979('0x5e'),_0x4979('0x5f'),_0x4979('0x60'),_0x4979('0x61'),_0x4979('0x56'),'approval_history',_0x4979('0x62'),_0x4979('0x63'),_0x4979('0x64'),_0x4979('0x65'),_0x4979('0x66'),_0x4979('0x67'),_0x4979('0x68'),'state','sys_created_by','knowledge',_0x4979('0x38'),_0x4979('0x69'),_0x4979('0x6a'),_0x4979('0x6b'),'delivery_plan',_0x4979('0x6c'),'active',_0x4979('0x6d'),'business_service',_0x4979('0x6e'),_0x4979('0x6f'),'rfc',_0x4979('0x70'),_0x4979('0x71'),_0x4979('0x72'),_0x4979('0x73'),_0x4979('0x74'),_0x4979('0x75'),_0x4979('0x76'),_0x4979('0x77'),_0x4979('0x78'),'approval_set','subcategory',_0x4979('0x79'),_0x4979('0x7a'),_0x4979('0x7b'),_0x4979('0x7c'),'delivery_task','work_start',_0x4979('0x7d'),_0x4979('0x7e'),_0x4979('0x7f'),_0x4979('0x80'),_0x4979('0x81'),_0x4979('0x59'),_0x4979('0x82'),_0x4979('0x83'),_0x4979('0x84'),'follow_up',_0x4979('0x85'),_0x4979('0x86'),_0x4979('0x87'),'reopened_by',_0x4979('0x88'),'urgency',_0x4979('0x89'),'company',_0x4979('0x8a'),_0x4979('0x8b'),'assigned_to',_0x4979('0x5a'),'comments','sla_due',_0x4979('0x8c'),_0x4979('0x8d'),_0x4979('0x8e'),_0x4979('0x8f'),'reopen_count','sys_tags','escalation',_0x4979('0x90'),_0x4979('0x91'),'location',_0x4979('0x5b')];var _0x23aa27='';var _0x464dea='';var _0x39686f=[];var _0x790bf5='';var _0x5010fa='';var _0x2e5443=[];var _0x20bf35='';var _0x414ffd='';var _0x2baa8c={};var _0x19dcd8='';return db[_0x4979('0x40')][_0x4979('0x92')]({'where':{'id':_0x19dcc4[_0x4979('0x47')]['id']},'attributes':['id',_0x4979('0x93'),_0x4979('0x94'),_0x4979('0x95'),_0x4979('0x96'),_0x4979('0x97')]})[_0x4979('0x27')](handleEntityNotFound(_0x97701c,null))['then'](function(_0x9c6cda){if(_0x9c6cda){_0x19dcd8=_0x9c6cda[_0x4979('0x96')];var _0x45b510=_0x19dcd8[_0x4979('0x98')](-0x1);if(_0x45b510==='/'){_0x19dcd8=_0x19dcd8['substring'](0x0,_0x19dcd8[_0x4979('0x99')](_0x45b510));}_0x414ffd=util[_0x4979('0x9a')]('%s/api/now/doc/table/schema/',_0x19dcd8);_0x20bf35=util[_0x4979('0x9a')](_0x4979('0x9b'),_0x19dcd8);_0x2baa8c={'user':_0x9c6cda[_0x4979('0x93')],'pass':_0x9c6cda['password']};var _0x119966={'method':_0x4979('0x9c'),'uri':_0x414ffd+_0x4979('0x9d'),'auth':_0x2baa8c,'json':!![]};return rp(_0x119966);}})[_0x4979('0x27')](function(_0x73239e){if(_0x73239e[_0x4979('0x9e')][_0x4979('0x48')]>0x0){_0x23aa27=_0x73239e[_0x4979('0x9e')];}console[_0x4979('0x9f')](_0x4979('0xa0'),_0x23aa27);_0x2e5443=[];_0x464dea=Object[_0x4979('0xa1')]([],_0x23aa27);_[_0x4979('0xa2')](_0x464dea,function(_0x37a0ca){return!_0x59395e[_0x4979('0xa3')](_0x37a0ca[_0x4979('0x2a')]);});_0x464dea[_0x4979('0xa4')](function(_0x1ad2cc){var _0x2e65b9=createFieldObject(_0x20bf35,_0x2baa8c,_0x1ad2cc[_0x4979('0xa5')],_0x1ad2cc[_0x4979('0x2a')],_0x1ad2cc[_0x4979('0xa6')],![]);_0x2e5443[_0x4979('0xa7')](_0x2e65b9);});return Promise[_0x4979('0xa8')](_0x2e5443);})[_0x4979('0x27')](function(_0x3c5629){_0x39686f=_0x3c5629;_0x790bf5=Object[_0x4979('0xa1')]([],_0x23aa27);console[_0x4979('0x9f')](_0x4979('0xa9'),_0x23aa27);_[_0x4979('0xa2')](_0x790bf5,function(_0x40f76a){return _0x46e974['includes'](_0x40f76a['name']);});console[_0x4979('0x9f')](_0x4979('0xaa'),_0x790bf5);_0x2e5443=[];_0x790bf5['forEach'](function(_0x38302f){var _0xd6df93=createFieldObject(_0x20bf35,_0x2baa8c,_0x38302f['internalType'],_0x38302f[_0x4979('0x2a')],_0x38302f[_0x4979('0xa6')],!![]);_0x2e5443['push'](_0xd6df93);});return Promise[_0x4979('0xa8')](_0x2e5443);})[_0x4979('0x27')](function(_0x38ba37){_0x5010fa=_0x38ba37;var _0x30c6ba=_0x39686f['concat'](_0x5010fa);return{'count':_0x30c6ba['length'],'rows':_0x30c6ba};})[_0x4979('0x27')](respondWithResult(_0x97701c,null))[_0x4979('0x45')](function(_0x25bdd8){console['log']('ServiceNow\x20error:\x20'+_0x25bdd8);var _0x1b0026=_0x19dcc4['query'][_0x4979('0xab')]?0x1f4:_0x25bdd8['statusCode']||0x1f4;logger[_0x4979('0xac')](_0x25bdd8['stack']);delete _0x25bdd8['name'];if(_0x1b0026===0x191){_0x1b0026=0x190;}_0x97701c['status'](_0x1b0026)['send'](_0x19dcc4[_0x4979('0x30')][_0x4979('0xab')]?{'message':_0x4979('0xad'),'statusCode':_0x25bdd8[_0x4979('0xae')]}:_0x25bdd8);});};function createFieldObject(_0x4e4a33,_0x46e5a8,_0x53759e,_0x3310ec,_0xb108ce,_0x4efec9){return new Promise(function(_0xe12c72,_0x58aced){var _0xb71a16={'id':_0x3310ec,'name':_0xb108ce,'custom':_0x4efec9};if(_0x53759e===_0x4979('0xaf')){_0xb71a16['options']=[{'name':_0x4979('0xb0'),'value':_0x4979('0xb1')},{'name':_0x4979('0xb2'),'value':_0x4979('0xb3')}];_0xe12c72(_0xb71a16);}else{var _0x577102={'method':'GET','uri':_0x4e4a33+_0x4979('0xb4')+_0x3310ec,'auth':_0x46e5a8,'json':!![]};return rp(_0x577102)['then'](function(_0x180ba0){var _0x14537c=[];if(_0x180ba0[_0x4979('0x9e')][_0x4979('0x48')]>0x0){_0x180ba0[_0x4979('0x9e')]['forEach'](function(_0x42d498){if(_0x42d498['inactive']===_0x4979('0xb3')){var _0x102f8f={'name':_0x42d498[_0x4979('0xa6')],'value':_0x42d498[_0x4979('0xb5')]};_0x14537c['push'](_0x102f8f);}});}_0xb71a16[_0x4979('0x3f')]=_0x14537c;if(_0xb71a16[_0x4979('0x3f')]['length']>0x0){_0xe12c72(_0xb71a16);}else{if(_0x4efec9==![]){_0xe12c72();}else{_0xe12c72(_0xb71a16);}}});}});} \ No newline at end of file +var _0x16de=['closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','getConfigurations','ServicenowConfiguration','rawAttributes','sort','where','pick','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','state','order','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes'];(function(_0xe40658,_0x377e6e){var _0x408655=function(_0x2950d6){while(--_0x2950d6){_0xe40658['push'](_0xe40658['shift']());}};_0x408655(++_0x377e6e);}(_0x16de,0x1aa));var _0xe16d=function(_0x1547be,_0x22f6ab){_0x1547be=_0x1547be-0x0;var _0x3593a7=_0x16de[_0x1547be];return _0x3593a7;};'use strict';var emlformat=require(_0xe16d('0x0'));var rimraf=require(_0xe16d('0x1'));var zipdir=require(_0xe16d('0x2'));var jsonpatch=require(_0xe16d('0x3'));var rp=require(_0xe16d('0x4'));var moment=require(_0xe16d('0x5'));var BPromise=require(_0xe16d('0x6'));var Mustache=require('mustache');var util=require(_0xe16d('0x7'));var path=require(_0xe16d('0x8'));var sox=require(_0xe16d('0x9'));var csv=require(_0xe16d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe16d('0xb'));var _=require('lodash');var squel=require(_0xe16d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe16d('0xd'));var toCsv=require(_0xe16d('0xa'));var querystring=require(_0xe16d('0xe'));var Papa=require(_0xe16d('0xf'));var Redis=require(_0xe16d('0x10'));var authService=require(_0xe16d('0x11'));var qs=require(_0xe16d('0x12'));var as=require(_0xe16d('0x13'));var hardwareService=require(_0xe16d('0x14'));var logger=require('../../config/logger')(_0xe16d('0x15'));var utils=require('../../config/utils');var config=require(_0xe16d('0x16'));var licenseUtil=require(_0xe16d('0x17'));var db=require(_0xe16d('0x18'))['db'];var integrations=require(_0xe16d('0x19'));function respondWithStatusCode(_0x2ebf6f,_0x50d438){_0x50d438=_0x50d438||0xcc;return function(_0x555998){if(_0x555998){return _0x2ebf6f[_0xe16d('0x1a')](_0x50d438);}return _0x2ebf6f[_0xe16d('0x1b')](_0x50d438)[_0xe16d('0x1c')]();};}function respondWithResult(_0x7eda3,_0x7f9786){_0x7f9786=_0x7f9786||0xc8;return function(_0x25c301){if(_0x25c301){return _0x7eda3[_0xe16d('0x1b')](_0x7f9786)[_0xe16d('0x1d')](_0x25c301);}};}function respondWithFilteredResult(_0x514abe,_0x5d5b1d){return function(_0x2e81e4){if(_0x2e81e4){var _0x88dfc4=typeof _0x5d5b1d[_0xe16d('0x1e')]===_0xe16d('0x1f')&&typeof _0x5d5b1d['limit']===_0xe16d('0x1f');var _0xfb0c39=_0x2e81e4[_0xe16d('0x20')];var _0x4ff75=_0x88dfc4?0x0:_0x5d5b1d[_0xe16d('0x1e')];var _0x353b6d=_0x88dfc4?_0x2e81e4[_0xe16d('0x20')]:_0x5d5b1d['offset']+_0x5d5b1d[_0xe16d('0x21')];var _0x2f5436;if(_0x353b6d>=_0xfb0c39){_0x353b6d=_0xfb0c39;_0x2f5436=0xc8;}else{_0x2f5436=0xce;}_0x514abe[_0xe16d('0x1b')](_0x2f5436);return _0x514abe['set'](_0xe16d('0x22'),_0x4ff75+'-'+_0x353b6d+'/'+_0xfb0c39)['json'](_0x2e81e4);}return null;};}function patchUpdates(_0x5b4664){return function(_0x23c2de){try{jsonpatch[_0xe16d('0x23')](_0x23c2de,_0x5b4664,!![]);}catch(_0x51166b){return BPromise[_0xe16d('0x24')](_0x51166b);}return _0x23c2de[_0xe16d('0x25')]();};}function saveUpdates(_0x2204f6,_0x4f66ca){return function(_0x48752d){if(_0x48752d){return _0x48752d[_0xe16d('0x26')](_0x2204f6)[_0xe16d('0x27')](function(_0x181382){return _0x181382;});}return null;};}function removeEntity(_0x36a2b2,_0x2664de){return function(_0x4467a7){if(_0x4467a7){return _0x4467a7['destroy']()[_0xe16d('0x27')](function(){_0x36a2b2[_0xe16d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446a6d,_0x4e4236){return function(_0x3710cd){if(!_0x3710cd){_0x446a6d[_0xe16d('0x1a')](0x194);}return _0x3710cd;};}function handleError(_0x1a26de,_0x1b72e5){_0x1b72e5=_0x1b72e5||0x1f4;return function(_0x27f000){logger[_0xe16d('0x28')](_0x27f000[_0xe16d('0x29')]);if(_0x27f000[_0xe16d('0x2a')]){delete _0x27f000['name'];}_0x1a26de[_0xe16d('0x1b')](_0x1b72e5)[_0xe16d('0x2b')](_0x27f000);};}exports[_0xe16d('0x2c')]=function(_0x9036cd,_0x3d5c42){var _0x185b58={},_0x4c8c32={},_0x3c6904={'count':0x0,'rows':[]};var _0x534bdc=_[_0xe16d('0x2d')](db[_0xe16d('0x2e')]['rawAttributes'],function(_0xd8d85a){return{'name':_0xd8d85a[_0xe16d('0x2f')],'type':_0xd8d85a[_0xe16d('0x30')][_0xe16d('0x31')]};});_0x4c8c32[_0xe16d('0x32')]=_['map'](_0x534bdc,_0xe16d('0x2a'));_0x4c8c32['query']=_['keys'](_0x9036cd['query']);_0x4c8c32[_0xe16d('0x33')]=_[_0xe16d('0x34')](_0x4c8c32[_0xe16d('0x32')],_0x4c8c32[_0xe16d('0x35')]);_0x185b58[_0xe16d('0x36')]=_['intersection'](_0x4c8c32['model'],qs[_0xe16d('0x37')](_0x9036cd[_0xe16d('0x35')][_0xe16d('0x37')]));_0x185b58[_0xe16d('0x36')]=_0x185b58[_0xe16d('0x36')][_0xe16d('0x38')]?_0x185b58[_0xe16d('0x36')]:_0x4c8c32[_0xe16d('0x32')];if(!_0x9036cd[_0xe16d('0x35')][_0xe16d('0x39')](_0xe16d('0x3a'))){_0x185b58['limit']=qs[_0xe16d('0x21')](_0x9036cd[_0xe16d('0x35')][_0xe16d('0x21')]);_0x185b58[_0xe16d('0x1e')]=qs['offset'](_0x9036cd[_0xe16d('0x35')][_0xe16d('0x1e')]);}_0x185b58['order']=qs['sort'](_0x9036cd[_0xe16d('0x35')]['sort']);_0x185b58['where']=qs[_0xe16d('0x33')](_['pick'](_0x9036cd['query'],_0x4c8c32[_0xe16d('0x33')]),_0x534bdc);if(_0x9036cd[_0xe16d('0x35')][_0xe16d('0x3b')]){_0x185b58['where']=_[_0xe16d('0x3c')](_0x185b58['where'],{'$or':_[_0xe16d('0x2d')](_0x534bdc,function(_0x1cb44e){if(_0x1cb44e['type']!==_0xe16d('0x3d')){var _0x40daad={};_0x40daad[_0x1cb44e[_0xe16d('0x2a')]]={'$like':'%'+_0x9036cd[_0xe16d('0x35')][_0xe16d('0x3b')]+'%'};return _0x40daad;}})});}_0x185b58=_['merge']({},_0x185b58,_0x9036cd[_0xe16d('0x3e')]);var _0x28fe83={'where':_0x185b58['where']};return db[_0xe16d('0x2e')][_0xe16d('0x20')](_0x28fe83)['then'](function(_0x317bfd){_0x3c6904[_0xe16d('0x20')]=_0x317bfd;if(_0x9036cd[_0xe16d('0x35')]['includeAll']){_0x185b58['include']=[{'all':!![]}];}return db[_0xe16d('0x2e')][_0xe16d('0x3f')](_0x185b58);})[_0xe16d('0x27')](function(_0x393874){_0x3c6904[_0xe16d('0x40')]=_0x393874;return _0x3c6904;})[_0xe16d('0x27')](respondWithFilteredResult(_0x3d5c42,_0x185b58))[_0xe16d('0x41')](handleError(_0x3d5c42,null));};exports[_0xe16d('0x42')]=function(_0x2dd96f,_0xfa1954){var _0x295891={'raw':![],'where':{'id':_0x2dd96f[_0xe16d('0x43')]['id']}},_0x137f63={};_0x137f63['model']=_['keys'](db[_0xe16d('0x2e')]['rawAttributes']);_0x137f63[_0xe16d('0x35')]=_[_0xe16d('0x44')](_0x2dd96f['query']);_0x137f63[_0xe16d('0x33')]=_[_0xe16d('0x34')](_0x137f63[_0xe16d('0x32')],_0x137f63[_0xe16d('0x35')]);_0x295891[_0xe16d('0x36')]=_[_0xe16d('0x34')](_0x137f63[_0xe16d('0x32')],qs['fields'](_0x2dd96f['query'][_0xe16d('0x37')]));_0x295891['attributes']=_0x295891[_0xe16d('0x36')][_0xe16d('0x38')]?_0x295891['attributes']:_0x137f63['model'];if(_0x2dd96f[_0xe16d('0x35')]['includeAll']){_0x295891[_0xe16d('0x45')]=[{'all':!![]}];}_0x295891=_[_0xe16d('0x3c')]({},_0x295891,_0x2dd96f['options']);return db['ServicenowAccount'][_0xe16d('0x46')](_0x295891)['then'](handleEntityNotFound(_0xfa1954,null))['then'](respondWithResult(_0xfa1954,null))[_0xe16d('0x41')](handleError(_0xfa1954,null));};exports[_0xe16d('0x47')]=function(_0x551ade,_0x81b1db){return db['ServicenowAccount'][_0xe16d('0x47')](_0x551ade[_0xe16d('0x48')],{})[_0xe16d('0x27')](respondWithResult(_0x81b1db,0xc9))['catch'](handleError(_0x81b1db,null));};exports[_0xe16d('0x26')]=function(_0x37fbdb,_0x530b1f){if(_0x37fbdb[_0xe16d('0x48')]['id']){delete _0x37fbdb[_0xe16d('0x48')]['id'];}return db['ServicenowAccount'][_0xe16d('0x46')]({'where':{'id':_0x37fbdb['params']['id']}})[_0xe16d('0x27')](handleEntityNotFound(_0x530b1f,null))[_0xe16d('0x27')](saveUpdates(_0x37fbdb[_0xe16d('0x48')],null))[_0xe16d('0x27')](respondWithResult(_0x530b1f,null))[_0xe16d('0x41')](handleError(_0x530b1f,null));};exports[_0xe16d('0x49')]=function(_0x4ea306,_0x91eb60){return db[_0xe16d('0x2e')]['find']({'where':{'id':_0x4ea306[_0xe16d('0x43')]['id']}})[_0xe16d('0x27')](handleEntityNotFound(_0x91eb60,null))[_0xe16d('0x27')](removeEntity(_0x91eb60,null))[_0xe16d('0x41')](handleError(_0x91eb60,null));};exports[_0xe16d('0x4a')]=function(_0x518f4e,_0x12bf52,_0x4f9b76){var _0x13ce35={};var _0x38f27c={};var _0x559f59;var _0x308439;return db[_0xe16d('0x2e')]['findOne']({'where':{'id':_0x518f4e[_0xe16d('0x43')]['id']}})[_0xe16d('0x27')](handleEntityNotFound(_0x12bf52,null))[_0xe16d('0x27')](function(_0x37648c){if(_0x37648c){_0x559f59=_0x37648c;_0x38f27c[_0xe16d('0x32')]=_[_0xe16d('0x44')](db[_0xe16d('0x4b')][_0xe16d('0x4c')]);_0x38f27c['query']=_[_0xe16d('0x44')](_0x518f4e['query']);_0x38f27c[_0xe16d('0x33')]=_['intersection'](_0x38f27c[_0xe16d('0x32')],_0x38f27c['query']);_0x13ce35[_0xe16d('0x36')]=_['intersection'](_0x38f27c[_0xe16d('0x32')],qs['fields'](_0x518f4e[_0xe16d('0x35')][_0xe16d('0x37')]));_0x13ce35[_0xe16d('0x36')]=_0x13ce35[_0xe16d('0x36')][_0xe16d('0x38')]?_0x13ce35['attributes']:_0x38f27c['model'];_0x13ce35['order']=qs[_0xe16d('0x4d')](_0x518f4e[_0xe16d('0x35')]['sort']);_0x13ce35[_0xe16d('0x4e')]=qs[_0xe16d('0x33')](_[_0xe16d('0x4f')](_0x518f4e['query'],_0x38f27c['filters']));if(_0x518f4e[_0xe16d('0x35')]['filter']){_0x13ce35[_0xe16d('0x4e')]=_[_0xe16d('0x3c')](_0x13ce35[_0xe16d('0x4e')],{'$or':_['map'](_0x13ce35[_0xe16d('0x36')],function(_0x4d9728){var _0x3fe916={};_0x3fe916[_0x4d9728]={'$like':'%'+_0x518f4e['query']['filter']+'%'};return _0x3fe916;})});}_0x13ce35=_[_0xe16d('0x3c')]({},_0x13ce35,_0x518f4e[_0xe16d('0x3e')]);return _0x559f59['getConfigurations'](_0x13ce35);}})['then'](function(_0x25cd47){if(_0x25cd47){_0x308439=_0x25cd47[_0xe16d('0x38')];if(!_0x518f4e[_0xe16d('0x35')][_0xe16d('0x39')]('nolimit')){_0x13ce35[_0xe16d('0x21')]=qs['limit'](_0x518f4e[_0xe16d('0x35')][_0xe16d('0x21')]);_0x13ce35[_0xe16d('0x1e')]=qs['offset'](_0x518f4e['query'][_0xe16d('0x1e')]);}return _0x559f59[_0xe16d('0x4a')](_0x13ce35);}})['then'](function(_0x527757){if(_0x527757){return _0x527757?{'count':_0x308439,'rows':_0x527757}:null;}})[_0xe16d('0x27')](respondWithResult(_0x12bf52,null))[_0xe16d('0x41')](handleError(_0x12bf52,null));};exports[_0xe16d('0x50')]=function(_0x31b780,_0x2c4d3b,_0x4735cd){if(_0x31b780['body']['id']){delete _0x31b780['body']['id'];}return db[_0xe16d('0x2e')][_0xe16d('0x51')]({'where':{'id':_0x31b780[_0xe16d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c4d3b,null))['then'](function(_0x58ece5){if(_0x58ece5){_0x31b780['body'][_0xe16d('0x52')]=_0x58ece5['id'];_0x31b780['body'][_0xe16d('0x53')]=integrations['getSubjects'](_0x31b780[_0xe16d('0x48')][_0xe16d('0x54')],_0x31b780[_0xe16d('0x48')][_0xe16d('0x30')]);_0x31b780[_0xe16d('0x48')][_0xe16d('0x55')]=integrations['getDescriptions'](_0x31b780[_0xe16d('0x48')]['channel'],_0x31b780['body'][_0xe16d('0x30')]);return db[_0xe16d('0x4b')]['create'](_0x31b780[_0xe16d('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0xe16d('0x53')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0xe16d('0x27')](respondWithResult(_0x2c4d3b,null))[_0xe16d('0x41')](handleError(_0x2c4d3b,null));};exports[_0xe16d('0x56')]=function(_0x4a2744,_0x31f01d,_0x4c8561){var _0x1c829e=[_0xe16d('0x57'),'hold_reason',_0xe16d('0x58'),_0xe16d('0x59'),_0xe16d('0x5a'),_0xe16d('0x5b'),_0xe16d('0x5c'),_0xe16d('0x5d'),_0xe16d('0x5e')];var _0x5516db=[_0xe16d('0x5f'),_0xe16d('0x57'),_0xe16d('0x60'),'watch_list',_0xe16d('0x61'),_0xe16d('0x62'),_0xe16d('0x63'),'hold_reason',_0xe16d('0x64'),_0xe16d('0x65'),_0xe16d('0x66'),_0xe16d('0x67'),'opened_by','user_input',_0xe16d('0x68'),_0xe16d('0x69'),_0xe16d('0x6a'),'sys_created_by',_0xe16d('0x58'),_0xe16d('0x6b'),'calendar_stc',_0xe16d('0x6c'),_0xe16d('0x6d'),_0xe16d('0x6e'),_0xe16d('0x6f'),'active',_0xe16d('0x70'),_0xe16d('0x71'),_0xe16d('0x72'),_0xe16d('0x73'),_0xe16d('0x74'),_0xe16d('0x75'),_0xe16d('0x76'),_0xe16d('0x77'),_0xe16d('0x78'),_0xe16d('0x79'),_0xe16d('0x7a'),_0xe16d('0x7b'),_0xe16d('0x7c'),_0xe16d('0x7d'),_0xe16d('0x7e'),'subcategory',_0xe16d('0x7f'),_0xe16d('0x80'),_0xe16d('0x5a'),'correlation_display','delivery_task',_0xe16d('0x81'),_0xe16d('0x82'),_0xe16d('0x83'),'additional_assignee_list','description',_0xe16d('0x84'),'notify',_0xe16d('0x85'),_0xe16d('0x86'),_0xe16d('0x87'),_0xe16d('0x88'),_0xe16d('0x89'),_0xe16d('0x8a'),'contact_type',_0xe16d('0x8b'),_0xe16d('0x5c'),_0xe16d('0x8c'),_0xe16d('0x8d'),_0xe16d('0x8e'),_0xe16d('0x8f'),'activity_due',_0xe16d('0x90'),_0xe16d('0x5d'),_0xe16d('0x91'),_0xe16d('0x92'),'approval',_0xe16d('0x93'),_0xe16d('0x94'),_0xe16d('0x95'),_0xe16d('0x96'),_0xe16d('0x97'),_0xe16d('0x98'),_0xe16d('0x99'),'correlation_id',_0xe16d('0x9a'),_0xe16d('0x5e')];var _0x3b47aa='';var _0xe9d648='';var _0x5c7f7b=[];var _0x274c04='';var _0x450915='';var _0x56371f=[];var _0x214d8a='';var _0xa612b2='';var _0x4e5ae7={};var _0x195d38='';return db[_0xe16d('0x2e')][_0xe16d('0x51')]({'where':{'id':_0x4a2744['params']['id']},'attributes':['id',_0xe16d('0x9b'),_0xe16d('0x9c'),'email',_0xe16d('0x9d'),_0xe16d('0x9e')]})[_0xe16d('0x27')](handleEntityNotFound(_0x31f01d,null))[_0xe16d('0x27')](function(_0x5ac95f){if(_0x5ac95f){_0x195d38=_0x5ac95f[_0xe16d('0x9d')];var _0x235979=_0x195d38['slice'](-0x1);if(_0x235979==='/'){_0x195d38=_0x195d38[_0xe16d('0x9f')](0x0,_0x195d38[_0xe16d('0xa0')](_0x235979));}_0xa612b2=util[_0xe16d('0xa1')](_0xe16d('0xa2'),_0x195d38);_0x214d8a=util[_0xe16d('0xa1')](_0xe16d('0xa3'),_0x195d38);_0x4e5ae7={'user':_0x5ac95f[_0xe16d('0x9b')],'pass':_0x5ac95f[_0xe16d('0x9c')]};var _0x7a7c3c={'method':_0xe16d('0xa4'),'uri':_0xa612b2+'incident?sysparm_display_value=all','auth':_0x4e5ae7,'json':!![]};return rp(_0x7a7c3c);}})['then'](function(_0x23ed72){if(_0x23ed72['result'][_0xe16d('0x38')]>0x0){_0x3b47aa=_0x23ed72[_0xe16d('0xa5')];}console[_0xe16d('0xa6')](_0xe16d('0xa7'),_0x3b47aa);_0x56371f=[];_0xe9d648=Object[_0xe16d('0xa8')]([],_0x3b47aa);_[_0xe16d('0xa9')](_0xe9d648,function(_0x2c09cc){return!_0x1c829e[_0xe16d('0xaa')](_0x2c09cc[_0xe16d('0x2a')]);});_0xe9d648[_0xe16d('0xab')](function(_0x24b4de){var _0x32f8fa=createFieldObject(_0x214d8a,_0x4e5ae7,_0x24b4de[_0xe16d('0xac')],_0x24b4de[_0xe16d('0x2a')],_0x24b4de[_0xe16d('0xad')],![]);_0x56371f[_0xe16d('0xae')](_0x32f8fa);});return Promise['all'](_0x56371f);})[_0xe16d('0x27')](function(_0x24c345){_0x5c7f7b=_0x24c345;_0x274c04=Object[_0xe16d('0xa8')]([],_0x3b47aa);console[_0xe16d('0xa6')](_0xe16d('0xaf'),_0x3b47aa);_[_0xe16d('0xa9')](_0x274c04,function(_0x526cf1){return _0x5516db['includes'](_0x526cf1['name']);});console[_0xe16d('0xa6')](_0xe16d('0xb0'),_0x274c04);_0x56371f=[];_0x274c04['forEach'](function(_0x528d13){var _0x27a67d=createFieldObject(_0x214d8a,_0x4e5ae7,_0x528d13[_0xe16d('0xac')],_0x528d13[_0xe16d('0x2a')],_0x528d13['label'],!![]);_0x56371f[_0xe16d('0xae')](_0x27a67d);});return Promise['all'](_0x56371f);})['then'](function(_0x64222e){_0x450915=_0x64222e;var _0x30eb16=_0x5c7f7b['concat'](_0x450915);return{'count':_0x30eb16[_0xe16d('0x38')],'rows':_0x30eb16};})[_0xe16d('0x27')](respondWithResult(_0x31f01d,null))[_0xe16d('0x41')](function(_0x2b2a1b){console['log'](_0xe16d('0xb1')+_0x2b2a1b);var _0x1be3bc=_0x4a2744['query'][_0xe16d('0xb2')]?0x1f4:_0x2b2a1b['statusCode']||0x1f4;logger['error'](_0x2b2a1b[_0xe16d('0x29')]);delete _0x2b2a1b[_0xe16d('0x2a')];if(_0x1be3bc===0x191){_0x1be3bc=0x190;}_0x31f01d[_0xe16d('0x1b')](_0x1be3bc)['send'](_0x4a2744[_0xe16d('0x35')][_0xe16d('0xb2')]?{'message':_0xe16d('0xb3'),'statusCode':_0x2b2a1b[_0xe16d('0xb4')]}:_0x2b2a1b);});};function createFieldObject(_0x57af1f,_0x140ea9,_0x42c49d,_0x56f875,_0x44beb3,_0x194a8f){return new Promise(function(_0x3910fa,_0x790bf7){var _0xb02671={'id':_0x56f875,'name':_0x44beb3,'custom':_0x194a8f};if(_0x42c49d==='boolean'){_0xb02671[_0xe16d('0x3e')]=[{'name':_0xe16d('0xb5'),'value':_0xe16d('0xb6')},{'name':_0xe16d('0xb7'),'value':_0xe16d('0xb8')}];_0x3910fa(_0xb02671);}else{var _0x4c5276={'method':_0xe16d('0xa4'),'uri':_0x57af1f+_0xe16d('0xb9')+_0x56f875,'auth':_0x140ea9,'json':!![]};return rp(_0x4c5276)[_0xe16d('0x27')](function(_0x513d52){var _0x17c19b=[];if(_0x513d52[_0xe16d('0xa5')]['length']>0x0){_0x513d52['result'][_0xe16d('0xab')](function(_0x565939){if(_0x565939['inactive']===_0xe16d('0xb8')){var _0x44bd5e={'name':_0x565939['label'],'value':_0x565939[_0xe16d('0xba')]};_0x17c19b['push'](_0x44bd5e);}});}_0xb02671[_0xe16d('0x3e')]=_0x17c19b;if(_0xb02671[_0xe16d('0x3e')][_0xe16d('0x38')]>0x0){_0x3910fa(_0xb02671);}else{if(_0x194a8f==![]){_0x3910fa();}else{_0x3910fa(_0xb02671);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 616e689..eaf5914 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x4c5c71,_0x4360a0){var _0xfc2081=function(_0x35f383){while(--_0x35f383){_0x4c5c71['push'](_0x4c5c71['shift']());}};_0xfc2081(++_0x4360a0);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x5d7747,_0x55c074){var _0x291142=function(_0x221f7d){while(--_0x221f7d){_0x5d7747['push'](_0x5d7747['shift']());}};_0x291142(++_0x55c074);}(_0xeff8,0x186));var _0x8eff=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeff8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'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 d1a1b51..c8e9981 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 _0x1a07=['client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','map','include','model','GetServicenowAccount','ShowServicenowAccount','ServicenowAccount','find','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x272331,_0x312bc5){var _0x4e0108=function(_0xbe43d0){while(--_0xbe43d0){_0x272331['push'](_0x272331['shift']());}};_0x4e0108(++_0x312bc5);}(_0x1a07,0x1d8));var _0x71a0=function(_0x5a4138,_0x23a6f3){_0x5a4138=_0x5a4138-0x0;var _0x56a811=_0x1a07[_0x5a4138];return _0x56a811;};'use strict';var _=require(_0x71a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71a0('0x1'));var fs=require('fs');var Redis=require(_0x71a0('0x2'));var db=require(_0x71a0('0x3'))['db'];var utils=require(_0x71a0('0x4'));var logger=require(_0x71a0('0x5'))(_0x71a0('0x6'));var config=require(_0x71a0('0x7'));var jayson=require(_0x71a0('0x8'));var client=jayson[_0x71a0('0x9')][_0x71a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x443e1f,_0x787449,_0x3d0c49){return new BPromise(function(_0x13d75d,_0x1df056){return client[_0x71a0('0xb')](_0x443e1f,_0x3d0c49)[_0x71a0('0xc')](function(_0x542985){logger[_0x71a0('0xd')](_0x71a0('0xe'),_0x787449,_0x71a0('0xf'));logger[_0x71a0('0x10')](_0x71a0('0x11'),_0x787449,_0x71a0('0xf'),JSON[_0x71a0('0x12')](_0x542985));if(_0x542985[_0x71a0('0x13')]){if(_0x542985[_0x71a0('0x13')][_0x71a0('0x14')]===0x1f4){logger[_0x71a0('0x13')](_0x71a0('0xe'),_0x787449,_0x542985[_0x71a0('0x13')][_0x71a0('0x15')]);return _0x1df056(_0x542985[_0x71a0('0x13')]['message']);}logger[_0x71a0('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x787449,_0x542985[_0x71a0('0x13')][_0x71a0('0x15')]);return _0x13d75d(_0x542985['error'][_0x71a0('0x15')]);}else{logger[_0x71a0('0xd')](_0x71a0('0xe'),_0x787449,'request\x20sent');_0x13d75d(_0x542985[_0x71a0('0x16')][_0x71a0('0x15')]);}})['catch'](function(_0x90dd62){logger[_0x71a0('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x787449,_0x90dd62);_0x1df056(_0x90dd62);});});}exports['GetServicenowAccount']=function(_0x4877ac){var _0x5227fa=this;return new Promise(function(_0x592363,_0x4f416e){return db['ServicenowAccount'][_0x71a0('0x17')]({'raw':_0x4877ac[_0x71a0('0x18')]?_0x4877ac[_0x71a0('0x18')][_0x71a0('0x19')]===undefined?!![]:![]:!![],'where':_0x4877ac[_0x71a0('0x18')]?_0x4877ac['options'][_0x71a0('0x1a')]||null:null,'attributes':_0x4877ac[_0x71a0('0x18')]?_0x4877ac[_0x71a0('0x18')][_0x71a0('0x1b')]||null:null,'limit':_0x4877ac[_0x71a0('0x18')]?_0x4877ac['options'][_0x71a0('0x1c')]||null:null,'include':_0x4877ac[_0x71a0('0x18')]?_0x4877ac[_0x71a0('0x18')]['include']?_[_0x71a0('0x1d')](_0x4877ac[_0x71a0('0x18')][_0x71a0('0x1e')],function(_0x4e0807){return{'model':db[_0x4e0807[_0x71a0('0x1f')]],'as':_0x4e0807['as'],'attributes':_0x4e0807[_0x71a0('0x1b')],'include':_0x4e0807[_0x71a0('0x1e')]?_[_0x71a0('0x1d')](_0x4e0807[_0x71a0('0x1e')],function(_0x298da3){return{'model':db[_0x298da3[_0x71a0('0x1f')]],'as':_0x298da3['as'],'attributes':_0x298da3[_0x71a0('0x1b')],'include':_0x298da3[_0x71a0('0x1e')]?_[_0x71a0('0x1d')](_0x298da3[_0x71a0('0x1e')],function(_0x224aad){return{'model':db[_0x224aad['model']],'as':_0x224aad['as'],'attributes':_0x224aad[_0x71a0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19f93c){logger[_0x71a0('0xd')](_0x71a0('0x20'),_0x4877ac);logger['debug'](_0x71a0('0x20'),_0x4877ac,JSON[_0x71a0('0x12')](_0x19f93c));_0x592363(_0x19f93c);})['catch'](function(_0x3d2516){logger['error'](_0x71a0('0x20'),_0x3d2516[_0x71a0('0x15')],_0x4877ac);_0x4f416e(_0x5227fa[_0x71a0('0x13')](0x1f4,_0x3d2516[_0x71a0('0x15')]));});});};exports[_0x71a0('0x21')]=function(_0xdaaa59){var _0x37a9ed=this;return new Promise(function(_0x477124,_0x5cbd15){return db[_0x71a0('0x22')][_0x71a0('0x23')]({'raw':_0xdaaa59[_0x71a0('0x18')]?_0xdaaa59[_0x71a0('0x18')][_0x71a0('0x19')]===undefined?!![]:![]:!![],'where':_0xdaaa59[_0x71a0('0x18')]?_0xdaaa59[_0x71a0('0x18')][_0x71a0('0x1a')]||null:null,'attributes':_0xdaaa59[_0x71a0('0x18')]?_0xdaaa59[_0x71a0('0x18')][_0x71a0('0x1b')]||null:null,'include':_0xdaaa59['options']?_0xdaaa59[_0x71a0('0x18')][_0x71a0('0x1e')]?_[_0x71a0('0x1d')](_0xdaaa59['options']['include'],function(_0x340acd){return{'model':db[_0x340acd[_0x71a0('0x1f')]],'as':_0x340acd['as'],'attributes':_0x340acd['attributes'],'include':_0x340acd['include']?_[_0x71a0('0x1d')](_0x340acd[_0x71a0('0x1e')],function(_0x46197f){return{'model':db[_0x46197f[_0x71a0('0x1f')]],'as':_0x46197f['as'],'attributes':_0x46197f[_0x71a0('0x1b')],'include':_0x46197f[_0x71a0('0x1e')]?_[_0x71a0('0x1d')](_0x46197f['include'],function(_0x2d3398){return{'model':db[_0x2d3398[_0x71a0('0x1f')]],'as':_0x2d3398['as'],'attributes':_0x2d3398[_0x71a0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x71a0('0xc')](function(_0x46c451){logger[_0x71a0('0xd')](_0x71a0('0x21'),_0xdaaa59);logger[_0x71a0('0x10')](_0x71a0('0x21'),_0xdaaa59,JSON['stringify'](_0x46c451));_0x477124(_0x46c451);})[_0x71a0('0x24')](function(_0x39b4f0){logger[_0x71a0('0x13')]('ShowServicenowAccount',_0x39b4f0[_0x71a0('0x15')],_0xdaaa59);_0x5cbd15(_0x37a9ed[_0x71a0('0x13')](0x1f4,_0x39b4f0[_0x71a0('0x15')]));});});}; \ No newline at end of file +var _0x8e76=['stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','include','map','model','then','debug','catch','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0x8e76,0x1ab));var _0x68e7=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8e76[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var moment=require(_0x68e7('0x2'));var BPromise=require(_0x68e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68e7('0x4'));var db=require(_0x68e7('0x5'))['db'];var utils=require(_0x68e7('0x6'));var logger=require(_0x68e7('0x7'))('rpc');var config=require(_0x68e7('0x8'));var jayson=require(_0x68e7('0x9'));var client=jayson[_0x68e7('0xa')][_0x68e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e79f7,_0x652f60,_0x472ead){return new BPromise(function(_0x2dba10,_0x1a36b9){return client['request'](_0x5e79f7,_0x472ead)['then'](function(_0x55b181){logger[_0x68e7('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x652f60,_0x68e7('0xd'));logger['debug'](_0x68e7('0xe'),_0x652f60,_0x68e7('0xd'),JSON[_0x68e7('0xf')](_0x55b181));if(_0x55b181[_0x68e7('0x10')]){if(_0x55b181[_0x68e7('0x10')][_0x68e7('0x11')]===0x1f4){logger[_0x68e7('0x10')](_0x68e7('0x12'),_0x652f60,_0x55b181[_0x68e7('0x10')][_0x68e7('0x13')]);return _0x1a36b9(_0x55b181['error'][_0x68e7('0x13')]);}logger['error'](_0x68e7('0x12'),_0x652f60,_0x55b181[_0x68e7('0x10')]['message']);return _0x2dba10(_0x55b181[_0x68e7('0x10')][_0x68e7('0x13')]);}else{logger['info'](_0x68e7('0x12'),_0x652f60,_0x68e7('0xd'));_0x2dba10(_0x55b181[_0x68e7('0x14')][_0x68e7('0x13')]);}})['catch'](function(_0x5114a9){logger['error'](_0x68e7('0x12'),_0x652f60,_0x5114a9);_0x1a36b9(_0x5114a9);});});}exports[_0x68e7('0x15')]=function(_0x559490){var _0x5c024d=this;return new Promise(function(_0x4e7c63,_0x41e769){return db[_0x68e7('0x16')]['findAll']({'raw':_0x559490[_0x68e7('0x17')]?_0x559490[_0x68e7('0x17')][_0x68e7('0x18')]===undefined?!![]:![]:!![],'where':_0x559490[_0x68e7('0x17')]?_0x559490[_0x68e7('0x17')]['where']||null:null,'attributes':_0x559490['options']?_0x559490[_0x68e7('0x17')][_0x68e7('0x19')]||null:null,'limit':_0x559490[_0x68e7('0x17')]?_0x559490[_0x68e7('0x17')][_0x68e7('0x1a')]||null:null,'include':_0x559490[_0x68e7('0x17')]?_0x559490[_0x68e7('0x17')][_0x68e7('0x1b')]?_[_0x68e7('0x1c')](_0x559490[_0x68e7('0x17')][_0x68e7('0x1b')],function(_0x1c35a7){return{'model':db[_0x1c35a7['model']],'as':_0x1c35a7['as'],'attributes':_0x1c35a7['attributes'],'include':_0x1c35a7[_0x68e7('0x1b')]?_[_0x68e7('0x1c')](_0x1c35a7[_0x68e7('0x1b')],function(_0x23ea3d){return{'model':db[_0x23ea3d[_0x68e7('0x1d')]],'as':_0x23ea3d['as'],'attributes':_0x23ea3d[_0x68e7('0x19')],'include':_0x23ea3d[_0x68e7('0x1b')]?_[_0x68e7('0x1c')](_0x23ea3d['include'],function(_0x5ca43c){return{'model':db[_0x5ca43c[_0x68e7('0x1d')]],'as':_0x5ca43c['as'],'attributes':_0x5ca43c[_0x68e7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x68e7('0x1e')](function(_0x474939){logger[_0x68e7('0xc')](_0x68e7('0x15'),_0x559490);logger[_0x68e7('0x1f')]('GetServicenowAccount',_0x559490,JSON[_0x68e7('0xf')](_0x474939));_0x4e7c63(_0x474939);})[_0x68e7('0x20')](function(_0x7412d3){logger[_0x68e7('0x10')]('GetServicenowAccount',_0x7412d3[_0x68e7('0x13')],_0x559490);_0x41e769(_0x5c024d[_0x68e7('0x10')](0x1f4,_0x7412d3[_0x68e7('0x13')]));});});};exports[_0x68e7('0x21')]=function(_0x2a51cb){var _0x1ee230=this;return new Promise(function(_0x266985,_0x1bb6ae){return db[_0x68e7('0x16')]['find']({'raw':_0x2a51cb[_0x68e7('0x17')]?_0x2a51cb[_0x68e7('0x17')][_0x68e7('0x18')]===undefined?!![]:![]:!![],'where':_0x2a51cb[_0x68e7('0x17')]?_0x2a51cb[_0x68e7('0x17')]['where']||null:null,'attributes':_0x2a51cb[_0x68e7('0x17')]?_0x2a51cb['options']['attributes']||null:null,'include':_0x2a51cb[_0x68e7('0x17')]?_0x2a51cb[_0x68e7('0x17')][_0x68e7('0x1b')]?_[_0x68e7('0x1c')](_0x2a51cb['options'][_0x68e7('0x1b')],function(_0x418cc7){return{'model':db[_0x418cc7[_0x68e7('0x1d')]],'as':_0x418cc7['as'],'attributes':_0x418cc7['attributes'],'include':_0x418cc7[_0x68e7('0x1b')]?_[_0x68e7('0x1c')](_0x418cc7[_0x68e7('0x1b')],function(_0x1492c9){return{'model':db[_0x1492c9[_0x68e7('0x1d')]],'as':_0x1492c9['as'],'attributes':_0x1492c9[_0x68e7('0x19')],'include':_0x1492c9['include']?_[_0x68e7('0x1c')](_0x1492c9[_0x68e7('0x1b')],function(_0x3917c0){return{'model':db[_0x3917c0['model']],'as':_0x3917c0['as'],'attributes':_0x3917c0['attributes']};}):[]};}):[]};}):[]:[]})[_0x68e7('0x1e')](function(_0x56528d){logger[_0x68e7('0xc')]('ShowServicenowAccount',_0x2a51cb);logger[_0x68e7('0x1f')](_0x68e7('0x21'),_0x2a51cb,JSON['stringify'](_0x56528d));_0x266985(_0x56528d);})[_0x68e7('0x20')](function(_0x5b2b5f){logger[_0x68e7('0x10')](_0x68e7('0x21'),_0x5b2b5f[_0x68e7('0x13')],_0x2a51cb);_0x1bb6ae(_0x1ee230[_0x68e7('0x10')](0x1f4,_0x5b2b5f[_0x68e7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8ea935c..c251ab6 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 _0x8e02=['post','create','put','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5c93fd,_0x410eb3){var _0x4d80ad=function(_0x41cd4c){while(--_0x41cd4c){_0x5c93fd['push'](_0x5c93fd['shift']());}};_0x4d80ad(++_0x410eb3);}(_0x8e02,0xc3));var _0x28e0=function(_0x24acd8,_0x42806e){_0x24acd8=_0x24acd8-0x0;var _0x4fa1d1=_0x8e02[_0x24acd8];return _0x4fa1d1;};'use strict';var multer=require(_0x28e0('0x0'));var util=require(_0x28e0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x28e0('0x2'));var router=express[_0x28e0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x28e0('0x4'));var config=require(_0x28e0('0x5'));var controller=require('./intServicenowConfiguration.controller');router[_0x28e0('0x6')]('/',auth[_0x28e0('0x7')](),controller['index']);router[_0x28e0('0x6')](_0x28e0('0x8'),auth[_0x28e0('0x7')](),controller[_0x28e0('0x9')]);router[_0x28e0('0x6')](_0x28e0('0xa'),auth[_0x28e0('0x7')](),controller[_0x28e0('0xb')]);router[_0x28e0('0x6')]('/:id/subjects',auth[_0x28e0('0x7')](),controller[_0x28e0('0xc')]);router['get'](_0x28e0('0xd'),auth['isAuthenticated'](),controller[_0x28e0('0xe')]);router[_0x28e0('0xf')]('/',auth['isAuthenticated'](),controller[_0x28e0('0x10')]);router[_0x28e0('0x11')]('/:id',auth[_0x28e0('0x7')](),controller[_0x28e0('0x12')]);router['delete'](_0x28e0('0x8'),auth[_0x28e0('0x7')](),controller[_0x28e0('0x13')]);module[_0x28e0('0x14')]=router; \ No newline at end of file +var _0x4c88=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','path','connect-timeout'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4c88,0x1e1));var _0x84c8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4c88[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x84c8('0x0'));var timeout=require(_0x84c8('0x1'));var express=require('express');var router=express[_0x84c8('0x2')]();var fs_extra=require(_0x84c8('0x3'));var auth=require(_0x84c8('0x4'));var interaction=require(_0x84c8('0x5'));var config=require('../../config/environment');var controller=require(_0x84c8('0x6'));router[_0x84c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x84c8('0x8')]);router['get'](_0x84c8('0x9'),auth[_0x84c8('0xa')](),controller['show']);router[_0x84c8('0x7')](_0x84c8('0xb'),auth[_0x84c8('0xa')](),controller[_0x84c8('0xc')]);router['get'](_0x84c8('0xd'),auth[_0x84c8('0xa')](),controller[_0x84c8('0xe')]);router[_0x84c8('0x7')](_0x84c8('0xf'),auth[_0x84c8('0xa')](),controller['getDescriptions']);router[_0x84c8('0x10')]('/',auth[_0x84c8('0xa')](),controller[_0x84c8('0x11')]);router[_0x84c8('0x12')](_0x84c8('0x9'),auth['isAuthenticated'](),controller[_0x84c8('0x13')]);router['delete'](_0x84c8('0x9'),auth[_0x84c8('0xa')](),controller[_0x84c8('0x14')]);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 6c123d3..2dadf5f 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 _0xcd39=['STRING'];(function(_0x5b41ca,_0xfb10a3){var _0x52f985=function(_0x7306de){while(--_0x7306de){_0x5b41ca['push'](_0x5b41ca['shift']());}};_0x52f985(++_0xfb10a3);}(_0xcd39,0x152));var _0x9cd3=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0xcd39[_0x11ec6c];return _0xb59506;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9cd3('0x0')]},'description':{'type':Sequelize[_0x9cd3('0x0')]}}; \ No newline at end of file +var _0xca12=['exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xca12,0xe4));var _0x2ca1=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xca12[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require('sequelize');module[_0x2ca1('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2ca1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 998a2f8..532d455 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 _0x3ace=['json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','update','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x49d852,_0x4f58d6){var _0x568c9d=function(_0x373f47){while(--_0x373f47){_0x49d852['push'](_0x49d852['shift']());}};_0x568c9d(++_0x4f58d6);}(_0x3ace,0xd5));var _0xe3ac=function(_0x3f0b5f,_0x4a5982){_0x3f0b5f=_0x3f0b5f-0x0;var _0x410ea4=_0x3ace[_0x3f0b5f];return _0x410ea4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3ac('0x0'));var zipdir=require(_0xe3ac('0x1'));var jsonpatch=require(_0xe3ac('0x2'));var rp=require(_0xe3ac('0x3'));var moment=require(_0xe3ac('0x4'));var BPromise=require(_0xe3ac('0x5'));var Mustache=require(_0xe3ac('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe3ac('0x7'));var csv=require(_0xe3ac('0x8'));var ejs=require(_0xe3ac('0x9'));var fs=require('fs');var fs_extra=require(_0xe3ac('0xa'));var _=require(_0xe3ac('0xb'));var squel=require(_0xe3ac('0xc'));var crypto=require(_0xe3ac('0xd'));var jsforce=require(_0xe3ac('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3ac('0xf'));var Papa=require(_0xe3ac('0x10'));var Redis=require('ioredis');var authService=require(_0xe3ac('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3ac('0x12'));var logger=require(_0xe3ac('0x13'))(_0xe3ac('0x14'));var utils=require('../../config/utils');var config=require(_0xe3ac('0x15'));var licenseUtil=require(_0xe3ac('0x16'));var db=require(_0xe3ac('0x17'))['db'];function respondWithStatusCode(_0xc7a0f3,_0x513770){_0x513770=_0x513770||0xcc;return function(_0x37459c){if(_0x37459c){return _0xc7a0f3[_0xe3ac('0x18')](_0x513770);}return _0xc7a0f3[_0xe3ac('0x19')](_0x513770)[_0xe3ac('0x1a')]();};}function respondWithResult(_0x514f00,_0x6f7b47){_0x6f7b47=_0x6f7b47||0xc8;return function(_0x503943){if(_0x503943){return _0x514f00['status'](_0x6f7b47)[_0xe3ac('0x1b')](_0x503943);}};}function respondWithFilteredResult(_0x5cfc9f,_0x1e2de2){return function(_0x109944){if(_0x109944){var _0x2842b0=typeof _0x1e2de2[_0xe3ac('0x1c')]===_0xe3ac('0x1d')&&typeof _0x1e2de2[_0xe3ac('0x1e')]===_0xe3ac('0x1d');var _0xbdf5fa=_0x109944[_0xe3ac('0x1f')];var _0xaea2de=_0x2842b0?0x0:_0x1e2de2['offset'];var _0x41cfc2=_0x2842b0?_0x109944[_0xe3ac('0x1f')]:_0x1e2de2[_0xe3ac('0x1c')]+_0x1e2de2[_0xe3ac('0x1e')];var _0x36522f;if(_0x41cfc2>=_0xbdf5fa){_0x41cfc2=_0xbdf5fa;_0x36522f=0xc8;}else{_0x36522f=0xce;}_0x5cfc9f[_0xe3ac('0x19')](_0x36522f);return _0x5cfc9f[_0xe3ac('0x20')](_0xe3ac('0x21'),_0xaea2de+'-'+_0x41cfc2+'/'+_0xbdf5fa)[_0xe3ac('0x1b')](_0x109944);}return null;};}function patchUpdates(_0x4c04f1){return function(_0x4c46f9){try{jsonpatch[_0xe3ac('0x22')](_0x4c46f9,_0x4c04f1,!![]);}catch(_0x1f318a){return BPromise['reject'](_0x1f318a);}return _0x4c46f9['save']();};}function saveUpdates(_0x55ef8a,_0x5ce555){return function(_0x14ae33){if(_0x14ae33){return _0x14ae33['update'](_0x55ef8a)[_0xe3ac('0x23')](function(_0x18dff5){return _0x18dff5;});}return null;};}function removeEntity(_0x462ced,_0x100b7f){return function(_0x2ab88f){if(_0x2ab88f){return _0x2ab88f[_0xe3ac('0x24')]()[_0xe3ac('0x23')](function(){_0x462ced[_0xe3ac('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f3661,_0x3356c4){return function(_0x4ee7aa){if(!_0x4ee7aa){_0x2f3661[_0xe3ac('0x18')](0x194);}return _0x4ee7aa;};}function handleError(_0x3d1f20,_0x4febc0){_0x4febc0=_0x4febc0||0x1f4;return function(_0x3a9fcd){logger[_0xe3ac('0x25')](_0x3a9fcd[_0xe3ac('0x26')]);if(_0x3a9fcd[_0xe3ac('0x27')]){delete _0x3a9fcd[_0xe3ac('0x27')];}_0x3d1f20[_0xe3ac('0x19')](_0x4febc0)[_0xe3ac('0x28')](_0x3a9fcd);};}exports['index']=function(_0x1c1432,_0x7b0468){var _0x35cc38={},_0x34b7c6={},_0x19892b={'count':0x0,'rows':[]};var _0x4d3ea7=_[_0xe3ac('0x29')](db[_0xe3ac('0x2a')][_0xe3ac('0x2b')],function(_0x585825){return{'name':_0x585825['fieldName'],'type':_0x585825[_0xe3ac('0x2c')][_0xe3ac('0x2d')]};});_0x34b7c6[_0xe3ac('0x2e')]=_[_0xe3ac('0x29')](_0x4d3ea7,_0xe3ac('0x27'));_0x34b7c6[_0xe3ac('0x2f')]=_[_0xe3ac('0x30')](_0x1c1432[_0xe3ac('0x2f')]);_0x34b7c6[_0xe3ac('0x31')]=_['intersection'](_0x34b7c6['model'],_0x34b7c6[_0xe3ac('0x2f')]);_0x35cc38['attributes']=_['intersection'](_0x34b7c6[_0xe3ac('0x2e')],qs[_0xe3ac('0x32')](_0x1c1432[_0xe3ac('0x2f')][_0xe3ac('0x32')]));_0x35cc38[_0xe3ac('0x33')]=_0x35cc38[_0xe3ac('0x33')][_0xe3ac('0x34')]?_0x35cc38[_0xe3ac('0x33')]:_0x34b7c6[_0xe3ac('0x2e')];if(!_0x1c1432[_0xe3ac('0x2f')][_0xe3ac('0x35')](_0xe3ac('0x36'))){_0x35cc38[_0xe3ac('0x1e')]=qs[_0xe3ac('0x1e')](_0x1c1432[_0xe3ac('0x2f')][_0xe3ac('0x1e')]);_0x35cc38[_0xe3ac('0x1c')]=qs[_0xe3ac('0x1c')](_0x1c1432[_0xe3ac('0x2f')][_0xe3ac('0x1c')]);}_0x35cc38[_0xe3ac('0x37')]=qs[_0xe3ac('0x38')](_0x1c1432[_0xe3ac('0x2f')]['sort']);_0x35cc38[_0xe3ac('0x39')]=qs[_0xe3ac('0x31')](_[_0xe3ac('0x3a')](_0x1c1432[_0xe3ac('0x2f')],_0x34b7c6[_0xe3ac('0x31')]),_0x4d3ea7);if(_0x1c1432[_0xe3ac('0x2f')]['filter']){_0x35cc38[_0xe3ac('0x39')]=_[_0xe3ac('0x3b')](_0x35cc38[_0xe3ac('0x39')],{'$or':_['map'](_0x4d3ea7,function(_0x570c35){if(_0x570c35[_0xe3ac('0x2c')]!==_0xe3ac('0x3c')){var _0x3ff0e5={};_0x3ff0e5[_0x570c35[_0xe3ac('0x27')]]={'$like':'%'+_0x1c1432['query'][_0xe3ac('0x3d')]+'%'};return _0x3ff0e5;}})});}_0x35cc38=_[_0xe3ac('0x3b')]({},_0x35cc38,_0x1c1432[_0xe3ac('0x3e')]);var _0x2f19ac={'where':_0x35cc38[_0xe3ac('0x39')]};return db[_0xe3ac('0x2a')][_0xe3ac('0x1f')](_0x2f19ac)['then'](function(_0xbe6210){_0x19892b[_0xe3ac('0x1f')]=_0xbe6210;if(_0x1c1432[_0xe3ac('0x2f')][_0xe3ac('0x3f')]){_0x35cc38[_0xe3ac('0x40')]=[{'all':!![]}];}return db[_0xe3ac('0x2a')][_0xe3ac('0x41')](_0x35cc38);})[_0xe3ac('0x23')](function(_0x5bda10){_0x19892b[_0xe3ac('0x42')]=_0x5bda10;return _0x19892b;})[_0xe3ac('0x23')](respondWithFilteredResult(_0x7b0468,_0x35cc38))['catch'](handleError(_0x7b0468,null));};exports[_0xe3ac('0x43')]=function(_0x2ee2d4,_0x21b581){var _0x591737={'raw':![],'where':{'id':_0x2ee2d4[_0xe3ac('0x44')]['id']}},_0x23189b={};_0x23189b[_0xe3ac('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0xe3ac('0x2b')]);_0x23189b[_0xe3ac('0x2f')]=_[_0xe3ac('0x30')](_0x2ee2d4['query']);_0x23189b[_0xe3ac('0x31')]=_[_0xe3ac('0x45')](_0x23189b[_0xe3ac('0x2e')],_0x23189b[_0xe3ac('0x2f')]);_0x591737['attributes']=_['intersection'](_0x23189b['model'],qs[_0xe3ac('0x32')](_0x2ee2d4[_0xe3ac('0x2f')][_0xe3ac('0x32')]));_0x591737[_0xe3ac('0x33')]=_0x591737[_0xe3ac('0x33')][_0xe3ac('0x34')]?_0x591737[_0xe3ac('0x33')]:_0x23189b[_0xe3ac('0x2e')];if(_0x2ee2d4[_0xe3ac('0x2f')][_0xe3ac('0x3f')]){_0x591737[_0xe3ac('0x40')]=[{'all':!![]}];}_0x591737=_[_0xe3ac('0x3b')]({},_0x591737,_0x2ee2d4[_0xe3ac('0x3e')]);return db[_0xe3ac('0x2a')][_0xe3ac('0x46')](_0x591737)[_0xe3ac('0x23')](handleEntityNotFound(_0x21b581,null))[_0xe3ac('0x23')](respondWithResult(_0x21b581,null))[_0xe3ac('0x47')](handleError(_0x21b581,null));};exports[_0xe3ac('0x48')]=function(_0x11fe6a,_0x4cf0b9){return db[_0xe3ac('0x2a')][_0xe3ac('0x48')](_0x11fe6a['body'],{})['then'](respondWithResult(_0x4cf0b9,0xc9))['catch'](handleError(_0x4cf0b9,null));};exports[_0xe3ac('0x49')]=function(_0x3821c4,_0x3e3de7){if(_0x3821c4[_0xe3ac('0x4a')]['id']){delete _0x3821c4[_0xe3ac('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xe3ac('0x46')]({'where':{'id':_0x3821c4[_0xe3ac('0x44')]['id']}})[_0xe3ac('0x23')](handleEntityNotFound(_0x3e3de7,null))[_0xe3ac('0x23')](saveUpdates(_0x3821c4[_0xe3ac('0x4a')],null))[_0xe3ac('0x23')](respondWithResult(_0x3e3de7,null))[_0xe3ac('0x47')](handleError(_0x3e3de7,null));};exports[_0xe3ac('0x24')]=function(_0x44d5dd,_0x3cc7e6){return db[_0xe3ac('0x2a')][_0xe3ac('0x46')]({'where':{'id':_0x44d5dd[_0xe3ac('0x44')]['id']}})[_0xe3ac('0x23')](handleEntityNotFound(_0x3cc7e6,null))['then'](removeEntity(_0x3cc7e6,null))[_0xe3ac('0x47')](handleError(_0x3cc7e6,null));};exports[_0xe3ac('0x4b')]=function(_0x55404b,_0x166a74,_0x522eae){var _0x133353={};var _0x2801fb={};var _0x590a47;var _0x5fdc72;return db[_0xe3ac('0x2a')][_0xe3ac('0x4c')]({'where':{'id':_0x55404b['params']['id']}})[_0xe3ac('0x23')](handleEntityNotFound(_0x166a74,null))['then'](function(_0x280d07){if(_0x280d07){_0x590a47=_0x280d07;_0x2801fb[_0xe3ac('0x2e')]=_['keys'](db[_0xe3ac('0x4d')]['rawAttributes']);_0x2801fb['query']=_[_0xe3ac('0x30')](_0x55404b[_0xe3ac('0x2f')]);_0x2801fb[_0xe3ac('0x31')]=_['intersection'](_0x2801fb[_0xe3ac('0x2e')],_0x2801fb[_0xe3ac('0x2f')]);_0x133353[_0xe3ac('0x33')]=_[_0xe3ac('0x45')](_0x2801fb[_0xe3ac('0x2e')],qs['fields'](_0x55404b[_0xe3ac('0x2f')][_0xe3ac('0x32')]));_0x133353['attributes']=_0x133353[_0xe3ac('0x33')][_0xe3ac('0x34')]?_0x133353['attributes']:_0x2801fb[_0xe3ac('0x2e')];_0x133353['order']=qs[_0xe3ac('0x38')](_0x55404b[_0xe3ac('0x2f')][_0xe3ac('0x38')]);_0x133353['where']=qs['filters'](_[_0xe3ac('0x3a')](_0x55404b[_0xe3ac('0x2f')],_0x2801fb['filters']));if(_0x55404b['query'][_0xe3ac('0x3d')]){_0x133353['where']=_[_0xe3ac('0x3b')](_0x133353[_0xe3ac('0x39')],{'$or':_['map'](_0x133353['attributes'],function(_0x29fad4){var _0x46ddd8={};_0x46ddd8[_0x29fad4]={'$like':'%'+_0x55404b[_0xe3ac('0x2f')][_0xe3ac('0x3d')]+'%'};return _0x46ddd8;})});}_0x133353=_['merge']({},_0x133353,_0x55404b[_0xe3ac('0x3e')]);return _0x590a47['getFields'](_0x133353);}})[_0xe3ac('0x23')](function(_0x143ffb){if(_0x143ffb){_0x5fdc72=_0x143ffb[_0xe3ac('0x34')];if(!_0x55404b[_0xe3ac('0x2f')][_0xe3ac('0x35')](_0xe3ac('0x36'))){_0x133353[_0xe3ac('0x1e')]=qs[_0xe3ac('0x1e')](_0x55404b[_0xe3ac('0x2f')][_0xe3ac('0x1e')]);_0x133353[_0xe3ac('0x1c')]=qs[_0xe3ac('0x1c')](_0x55404b[_0xe3ac('0x2f')][_0xe3ac('0x1c')]);}return _0x590a47[_0xe3ac('0x4b')](_0x133353);}})['then'](function(_0xe808fb){if(_0xe808fb){return _0xe808fb?{'count':_0x5fdc72,'rows':_0xe808fb}:null;}})[_0xe3ac('0x23')](respondWithResult(_0x166a74,null))['catch'](handleError(_0x166a74,null));};exports['getSubjects']=function(_0x3d2f9e,_0x52ada5,_0xcec699){var _0x2f5cd5={};var _0x2ca1be={};var _0x24f658;var _0x3db098;return db[_0xe3ac('0x2a')]['findOne']({'where':{'id':_0x3d2f9e[_0xe3ac('0x44')]['id']}})[_0xe3ac('0x23')](handleEntityNotFound(_0x52ada5,null))[_0xe3ac('0x23')](function(_0x115c55){if(_0x115c55){_0x24f658=_0x115c55;_0x2ca1be[_0xe3ac('0x2e')]=_[_0xe3ac('0x30')](db[_0xe3ac('0x4d')][_0xe3ac('0x2b')]);_0x2ca1be['query']=_[_0xe3ac('0x30')](_0x3d2f9e['query']);_0x2ca1be[_0xe3ac('0x31')]=_[_0xe3ac('0x45')](_0x2ca1be['model'],_0x2ca1be['query']);_0x2f5cd5['attributes']=_['intersection'](_0x2ca1be[_0xe3ac('0x2e')],qs[_0xe3ac('0x32')](_0x3d2f9e['query'][_0xe3ac('0x32')]));_0x2f5cd5[_0xe3ac('0x33')]=_0x2f5cd5[_0xe3ac('0x33')][_0xe3ac('0x34')]?_0x2f5cd5['attributes']:_0x2ca1be['model'];_0x2f5cd5[_0xe3ac('0x37')]=qs[_0xe3ac('0x38')](_0x3d2f9e[_0xe3ac('0x2f')][_0xe3ac('0x38')]);_0x2f5cd5[_0xe3ac('0x39')]=qs['filters'](_[_0xe3ac('0x3a')](_0x3d2f9e['query'],_0x2ca1be[_0xe3ac('0x31')]));if(_0x3d2f9e[_0xe3ac('0x2f')][_0xe3ac('0x3d')]){_0x2f5cd5['where']=_['merge'](_0x2f5cd5[_0xe3ac('0x39')],{'$or':_[_0xe3ac('0x29')](_0x2f5cd5[_0xe3ac('0x33')],function(_0x472201){var _0x30bcdc={};_0x30bcdc[_0x472201]={'$like':'%'+_0x3d2f9e['query'][_0xe3ac('0x3d')]+'%'};return _0x30bcdc;})});}_0x2f5cd5=_[_0xe3ac('0x3b')]({},_0x2f5cd5,_0x3d2f9e['options']);return _0x24f658[_0xe3ac('0x4e')](_0x2f5cd5);}})[_0xe3ac('0x23')](function(_0x8c5ce7){if(_0x8c5ce7){_0x3db098=_0x8c5ce7[_0xe3ac('0x34')];if(!_0x3d2f9e['query'][_0xe3ac('0x35')](_0xe3ac('0x36'))){_0x2f5cd5['limit']=qs[_0xe3ac('0x1e')](_0x3d2f9e[_0xe3ac('0x2f')]['limit']);_0x2f5cd5[_0xe3ac('0x1c')]=qs['offset'](_0x3d2f9e[_0xe3ac('0x2f')][_0xe3ac('0x1c')]);}return _0x24f658[_0xe3ac('0x4e')](_0x2f5cd5);}})['then'](function(_0x21f774){if(_0x21f774){return _0x21f774?{'count':_0x3db098,'rows':_0x21f774}:null;}})[_0xe3ac('0x23')](respondWithResult(_0x52ada5,null))[_0xe3ac('0x47')](handleError(_0x52ada5,null));};exports[_0xe3ac('0x4f')]=function(_0x33d680,_0x55d2c1,_0x2a5eb0){var _0x4eeadb={};var _0x5c50f2={};var _0x3bf8da;var _0x22405e;return db[_0xe3ac('0x2a')][_0xe3ac('0x4c')]({'where':{'id':_0x33d680[_0xe3ac('0x44')]['id']}})[_0xe3ac('0x23')](handleEntityNotFound(_0x55d2c1,null))[_0xe3ac('0x23')](function(_0x4bc4b9){if(_0x4bc4b9){_0x3bf8da=_0x4bc4b9;_0x5c50f2[_0xe3ac('0x2e')]=_['keys'](db[_0xe3ac('0x4d')][_0xe3ac('0x2b')]);_0x5c50f2[_0xe3ac('0x2f')]=_['keys'](_0x33d680[_0xe3ac('0x2f')]);_0x5c50f2[_0xe3ac('0x31')]=_[_0xe3ac('0x45')](_0x5c50f2[_0xe3ac('0x2e')],_0x5c50f2[_0xe3ac('0x2f')]);_0x4eeadb[_0xe3ac('0x33')]=_['intersection'](_0x5c50f2['model'],qs['fields'](_0x33d680[_0xe3ac('0x2f')][_0xe3ac('0x32')]));_0x4eeadb[_0xe3ac('0x33')]=_0x4eeadb['attributes'][_0xe3ac('0x34')]?_0x4eeadb[_0xe3ac('0x33')]:_0x5c50f2[_0xe3ac('0x2e')];_0x4eeadb[_0xe3ac('0x37')]=qs[_0xe3ac('0x38')](_0x33d680[_0xe3ac('0x2f')][_0xe3ac('0x38')]);_0x4eeadb[_0xe3ac('0x39')]=qs[_0xe3ac('0x31')](_[_0xe3ac('0x3a')](_0x33d680['query'],_0x5c50f2[_0xe3ac('0x31')]));if(_0x33d680[_0xe3ac('0x2f')][_0xe3ac('0x3d')]){_0x4eeadb[_0xe3ac('0x39')]=_[_0xe3ac('0x3b')](_0x4eeadb[_0xe3ac('0x39')],{'$or':_[_0xe3ac('0x29')](_0x4eeadb[_0xe3ac('0x33')],function(_0x214b90){var _0x401bc9={};_0x401bc9[_0x214b90]={'$like':'%'+_0x33d680[_0xe3ac('0x2f')]['filter']+'%'};return _0x401bc9;})});}_0x4eeadb=_[_0xe3ac('0x3b')]({},_0x4eeadb,_0x33d680[_0xe3ac('0x3e')]);return _0x3bf8da['getDescriptions'](_0x4eeadb);}})[_0xe3ac('0x23')](function(_0x44343b){if(_0x44343b){_0x22405e=_0x44343b['length'];if(!_0x33d680[_0xe3ac('0x2f')]['hasOwnProperty'](_0xe3ac('0x36'))){_0x4eeadb['limit']=qs[_0xe3ac('0x1e')](_0x33d680['query'][_0xe3ac('0x1e')]);_0x4eeadb[_0xe3ac('0x1c')]=qs[_0xe3ac('0x1c')](_0x33d680['query'][_0xe3ac('0x1c')]);}return _0x3bf8da[_0xe3ac('0x4f')](_0x4eeadb);}})[_0xe3ac('0x23')](function(_0x31ffcd){if(_0x31ffcd){return _0x31ffcd?{'count':_0x22405e,'rows':_0x31ffcd}:null;}})[_0xe3ac('0x23')](respondWithResult(_0x55d2c1,null))[_0xe3ac('0x47')](handleError(_0x55d2c1,null));}; \ No newline at end of file +var _0xe1c8=['zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','error','stack','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','nolimit','findOne','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf'];(function(_0x5a7bf0,_0x5e9779){var _0x43a141=function(_0xf086b5){while(--_0xf086b5){_0x5a7bf0['push'](_0x5a7bf0['shift']());}};_0x43a141(++_0x5e9779);}(_0xe1c8,0x14a));var _0x8e1c=function(_0x19f7e6,_0x3bcc5f){_0x19f7e6=_0x19f7e6-0x0;var _0x1cc463=_0xe1c8[_0x19f7e6];return _0x1cc463;};'use strict';var emlformat=require(_0x8e1c('0x0'));var rimraf=require(_0x8e1c('0x1'));var zipdir=require(_0x8e1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e1c('0x3'));var moment=require(_0x8e1c('0x4'));var BPromise=require(_0x8e1c('0x5'));var Mustache=require('mustache');var util=require(_0x8e1c('0x6'));var path=require(_0x8e1c('0x7'));var sox=require(_0x8e1c('0x8'));var csv=require(_0x8e1c('0x9'));var ejs=require(_0x8e1c('0xa'));var fs=require('fs');var fs_extra=require(_0x8e1c('0xb'));var _=require(_0x8e1c('0xc'));var squel=require(_0x8e1c('0xd'));var crypto=require(_0x8e1c('0xe'));var jsforce=require(_0x8e1c('0xf'));var deskjs=require(_0x8e1c('0x10'));var toCsv=require(_0x8e1c('0x9'));var querystring=require(_0x8e1c('0x11'));var Papa=require('papaparse');var Redis=require(_0x8e1c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8e1c('0x13'));var as=require(_0x8e1c('0x14'));var hardwareService=require(_0x8e1c('0x15'));var logger=require('../../config/logger')(_0x8e1c('0x16'));var utils=require(_0x8e1c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8e1c('0x18'));var db=require(_0x8e1c('0x19'))['db'];function respondWithStatusCode(_0x32e192,_0x2ed68c){_0x2ed68c=_0x2ed68c||0xcc;return function(_0x3b12f9){if(_0x3b12f9){return _0x32e192[_0x8e1c('0x1a')](_0x2ed68c);}return _0x32e192[_0x8e1c('0x1b')](_0x2ed68c)[_0x8e1c('0x1c')]();};}function respondWithResult(_0x1fd2ae,_0x1a8d7d){_0x1a8d7d=_0x1a8d7d||0xc8;return function(_0x5bfb93){if(_0x5bfb93){return _0x1fd2ae[_0x8e1c('0x1b')](_0x1a8d7d)[_0x8e1c('0x1d')](_0x5bfb93);}};}function respondWithFilteredResult(_0x4daba8,_0x591f30){return function(_0x5f3dfd){if(_0x5f3dfd){var _0x17b56d=typeof _0x591f30[_0x8e1c('0x1e')]==='undefined'&&typeof _0x591f30[_0x8e1c('0x1f')]===_0x8e1c('0x20');var _0x1699af=_0x5f3dfd['count'];var _0xf15cf9=_0x17b56d?0x0:_0x591f30[_0x8e1c('0x1e')];var _0x2d7841=_0x17b56d?_0x5f3dfd[_0x8e1c('0x21')]:_0x591f30['offset']+_0x591f30[_0x8e1c('0x1f')];var _0x4823b5;if(_0x2d7841>=_0x1699af){_0x2d7841=_0x1699af;_0x4823b5=0xc8;}else{_0x4823b5=0xce;}_0x4daba8['status'](_0x4823b5);return _0x4daba8['set'](_0x8e1c('0x22'),_0xf15cf9+'-'+_0x2d7841+'/'+_0x1699af)[_0x8e1c('0x1d')](_0x5f3dfd);}return null;};}function patchUpdates(_0x3e97bb){return function(_0x60b64b){try{jsonpatch['apply'](_0x60b64b,_0x3e97bb,!![]);}catch(_0x7b2f3e){return BPromise[_0x8e1c('0x23')](_0x7b2f3e);}return _0x60b64b['save']();};}function saveUpdates(_0x1f6314,_0x1fc2e6){return function(_0x546230){if(_0x546230){return _0x546230[_0x8e1c('0x24')](_0x1f6314)[_0x8e1c('0x25')](function(_0x53e8ff){return _0x53e8ff;});}return null;};}function removeEntity(_0x4e5fb5,_0xec53dd){return function(_0x500b6f){if(_0x500b6f){return _0x500b6f[_0x8e1c('0x26')]()['then'](function(){_0x4e5fb5[_0x8e1c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aed48,_0xac892d){return function(_0x388e8b){if(!_0x388e8b){_0x4aed48['sendStatus'](0x194);}return _0x388e8b;};}function handleError(_0x411219,_0x4fd6c7){_0x4fd6c7=_0x4fd6c7||0x1f4;return function(_0x167205){logger[_0x8e1c('0x27')](_0x167205[_0x8e1c('0x28')]);if(_0x167205['name']){delete _0x167205['name'];}_0x411219[_0x8e1c('0x1b')](_0x4fd6c7)[_0x8e1c('0x29')](_0x167205);};}exports[_0x8e1c('0x2a')]=function(_0x476d75,_0xb83e1c){var _0x27715d={},_0x3e645d={},_0xc87e06={'count':0x0,'rows':[]};var _0x36352a=_[_0x8e1c('0x2b')](db[_0x8e1c('0x2c')][_0x8e1c('0x2d')],function(_0x19b763){return{'name':_0x19b763[_0x8e1c('0x2e')],'type':_0x19b763[_0x8e1c('0x2f')][_0x8e1c('0x30')]};});_0x3e645d['model']=_['map'](_0x36352a,'name');_0x3e645d[_0x8e1c('0x31')]=_[_0x8e1c('0x32')](_0x476d75[_0x8e1c('0x31')]);_0x3e645d[_0x8e1c('0x33')]=_['intersection'](_0x3e645d['model'],_0x3e645d[_0x8e1c('0x31')]);_0x27715d[_0x8e1c('0x34')]=_[_0x8e1c('0x35')](_0x3e645d[_0x8e1c('0x36')],qs[_0x8e1c('0x37')](_0x476d75[_0x8e1c('0x31')][_0x8e1c('0x37')]));_0x27715d[_0x8e1c('0x34')]=_0x27715d[_0x8e1c('0x34')][_0x8e1c('0x38')]?_0x27715d[_0x8e1c('0x34')]:_0x3e645d[_0x8e1c('0x36')];if(!_0x476d75[_0x8e1c('0x31')][_0x8e1c('0x39')]('nolimit')){_0x27715d['limit']=qs[_0x8e1c('0x1f')](_0x476d75['query'][_0x8e1c('0x1f')]);_0x27715d['offset']=qs[_0x8e1c('0x1e')](_0x476d75[_0x8e1c('0x31')][_0x8e1c('0x1e')]);}_0x27715d[_0x8e1c('0x3a')]=qs[_0x8e1c('0x3b')](_0x476d75[_0x8e1c('0x31')][_0x8e1c('0x3b')]);_0x27715d[_0x8e1c('0x3c')]=qs['filters'](_[_0x8e1c('0x3d')](_0x476d75['query'],_0x3e645d['filters']),_0x36352a);if(_0x476d75[_0x8e1c('0x31')][_0x8e1c('0x3e')]){_0x27715d[_0x8e1c('0x3c')]=_[_0x8e1c('0x3f')](_0x27715d['where'],{'$or':_[_0x8e1c('0x2b')](_0x36352a,function(_0x397115){if(_0x397115[_0x8e1c('0x2f')]!==_0x8e1c('0x40')){var _0x3947c4={};_0x3947c4[_0x397115[_0x8e1c('0x41')]]={'$like':'%'+_0x476d75[_0x8e1c('0x31')][_0x8e1c('0x3e')]+'%'};return _0x3947c4;}})});}_0x27715d=_[_0x8e1c('0x3f')]({},_0x27715d,_0x476d75[_0x8e1c('0x42')]);var _0x35049a={'where':_0x27715d[_0x8e1c('0x3c')]};return db[_0x8e1c('0x2c')]['count'](_0x35049a)[_0x8e1c('0x25')](function(_0x24b321){_0xc87e06['count']=_0x24b321;if(_0x476d75['query']['includeAll']){_0x27715d['include']=[{'all':!![]}];}return db[_0x8e1c('0x2c')][_0x8e1c('0x43')](_0x27715d);})[_0x8e1c('0x25')](function(_0x3369bc){_0xc87e06[_0x8e1c('0x44')]=_0x3369bc;return _0xc87e06;})[_0x8e1c('0x25')](respondWithFilteredResult(_0xb83e1c,_0x27715d))[_0x8e1c('0x45')](handleError(_0xb83e1c,null));};exports[_0x8e1c('0x46')]=function(_0x2e07fb,_0x53e3a4){var _0x893b27={'raw':![],'where':{'id':_0x2e07fb[_0x8e1c('0x47')]['id']}},_0x5f0c5e={};_0x5f0c5e[_0x8e1c('0x36')]=_[_0x8e1c('0x32')](db[_0x8e1c('0x2c')]['rawAttributes']);_0x5f0c5e['query']=_[_0x8e1c('0x32')](_0x2e07fb[_0x8e1c('0x31')]);_0x5f0c5e['filters']=_[_0x8e1c('0x35')](_0x5f0c5e['model'],_0x5f0c5e[_0x8e1c('0x31')]);_0x893b27[_0x8e1c('0x34')]=_['intersection'](_0x5f0c5e['model'],qs[_0x8e1c('0x37')](_0x2e07fb[_0x8e1c('0x31')][_0x8e1c('0x37')]));_0x893b27[_0x8e1c('0x34')]=_0x893b27[_0x8e1c('0x34')][_0x8e1c('0x38')]?_0x893b27[_0x8e1c('0x34')]:_0x5f0c5e[_0x8e1c('0x36')];if(_0x2e07fb['query'][_0x8e1c('0x48')]){_0x893b27[_0x8e1c('0x49')]=[{'all':!![]}];}_0x893b27=_['merge']({},_0x893b27,_0x2e07fb[_0x8e1c('0x42')]);return db['ServicenowConfiguration'][_0x8e1c('0x4a')](_0x893b27)[_0x8e1c('0x25')](handleEntityNotFound(_0x53e3a4,null))[_0x8e1c('0x25')](respondWithResult(_0x53e3a4,null))['catch'](handleError(_0x53e3a4,null));};exports['create']=function(_0xf824db,_0x5e6efe){return db['ServicenowConfiguration'][_0x8e1c('0x4b')](_0xf824db[_0x8e1c('0x4c')],{})['then'](respondWithResult(_0x5e6efe,0xc9))[_0x8e1c('0x45')](handleError(_0x5e6efe,null));};exports[_0x8e1c('0x24')]=function(_0x15d509,_0x158ba4){if(_0x15d509[_0x8e1c('0x4c')]['id']){delete _0x15d509[_0x8e1c('0x4c')]['id'];}return db[_0x8e1c('0x2c')]['find']({'where':{'id':_0x15d509[_0x8e1c('0x47')]['id']}})[_0x8e1c('0x25')](handleEntityNotFound(_0x158ba4,null))['then'](saveUpdates(_0x15d509[_0x8e1c('0x4c')],null))[_0x8e1c('0x25')](respondWithResult(_0x158ba4,null))[_0x8e1c('0x45')](handleError(_0x158ba4,null));};exports[_0x8e1c('0x26')]=function(_0x14f0d2,_0x4b7cb2){return db[_0x8e1c('0x2c')]['find']({'where':{'id':_0x14f0d2[_0x8e1c('0x47')]['id']}})[_0x8e1c('0x25')](handleEntityNotFound(_0x4b7cb2,null))[_0x8e1c('0x25')](removeEntity(_0x4b7cb2,null))['catch'](handleError(_0x4b7cb2,null));};exports[_0x8e1c('0x4d')]=function(_0x2815fe,_0x53e3cc,_0x13bc1e){var _0x1268bc={};var _0x4f3325={};var _0x17d742;var _0x193006;return db[_0x8e1c('0x2c')]['findOne']({'where':{'id':_0x2815fe[_0x8e1c('0x47')]['id']}})[_0x8e1c('0x25')](handleEntityNotFound(_0x53e3cc,null))['then'](function(_0xa9a69b){if(_0xa9a69b){_0x17d742=_0xa9a69b;_0x4f3325[_0x8e1c('0x36')]=_[_0x8e1c('0x32')](db['ServicenowField'][_0x8e1c('0x2d')]);_0x4f3325[_0x8e1c('0x31')]=_[_0x8e1c('0x32')](_0x2815fe[_0x8e1c('0x31')]);_0x4f3325['filters']=_[_0x8e1c('0x35')](_0x4f3325[_0x8e1c('0x36')],_0x4f3325['query']);_0x1268bc['attributes']=_[_0x8e1c('0x35')](_0x4f3325['model'],qs['fields'](_0x2815fe['query']['fields']));_0x1268bc[_0x8e1c('0x34')]=_0x1268bc['attributes']['length']?_0x1268bc[_0x8e1c('0x34')]:_0x4f3325[_0x8e1c('0x36')];_0x1268bc[_0x8e1c('0x3a')]=qs[_0x8e1c('0x3b')](_0x2815fe['query'][_0x8e1c('0x3b')]);_0x1268bc['where']=qs[_0x8e1c('0x33')](_[_0x8e1c('0x3d')](_0x2815fe[_0x8e1c('0x31')],_0x4f3325[_0x8e1c('0x33')]));if(_0x2815fe[_0x8e1c('0x31')]['filter']){_0x1268bc[_0x8e1c('0x3c')]=_[_0x8e1c('0x3f')](_0x1268bc[_0x8e1c('0x3c')],{'$or':_[_0x8e1c('0x2b')](_0x1268bc[_0x8e1c('0x34')],function(_0x86b282){var _0x404f4e={};_0x404f4e[_0x86b282]={'$like':'%'+_0x2815fe[_0x8e1c('0x31')][_0x8e1c('0x3e')]+'%'};return _0x404f4e;})});}_0x1268bc=_[_0x8e1c('0x3f')]({},_0x1268bc,_0x2815fe[_0x8e1c('0x42')]);return _0x17d742[_0x8e1c('0x4d')](_0x1268bc);}})['then'](function(_0xf99900){if(_0xf99900){_0x193006=_0xf99900[_0x8e1c('0x38')];if(!_0x2815fe['query'][_0x8e1c('0x39')](_0x8e1c('0x4e'))){_0x1268bc[_0x8e1c('0x1f')]=qs[_0x8e1c('0x1f')](_0x2815fe[_0x8e1c('0x31')]['limit']);_0x1268bc['offset']=qs[_0x8e1c('0x1e')](_0x2815fe['query']['offset']);}return _0x17d742[_0x8e1c('0x4d')](_0x1268bc);}})[_0x8e1c('0x25')](function(_0x3449fa){if(_0x3449fa){return _0x3449fa?{'count':_0x193006,'rows':_0x3449fa}:null;}})['then'](respondWithResult(_0x53e3cc,null))[_0x8e1c('0x45')](handleError(_0x53e3cc,null));};exports['getSubjects']=function(_0x5a94c8,_0x55935c,_0x36dfb6){var _0x10059a={};var _0x43ab4b={};var _0x18eb14;var _0x13474e;return db['ServicenowConfiguration'][_0x8e1c('0x4f')]({'where':{'id':_0x5a94c8[_0x8e1c('0x47')]['id']}})['then'](handleEntityNotFound(_0x55935c,null))[_0x8e1c('0x25')](function(_0x33c74c){if(_0x33c74c){_0x18eb14=_0x33c74c;_0x43ab4b[_0x8e1c('0x36')]=_[_0x8e1c('0x32')](db['ServicenowField']['rawAttributes']);_0x43ab4b[_0x8e1c('0x31')]=_['keys'](_0x5a94c8[_0x8e1c('0x31')]);_0x43ab4b[_0x8e1c('0x33')]=_[_0x8e1c('0x35')](_0x43ab4b[_0x8e1c('0x36')],_0x43ab4b[_0x8e1c('0x31')]);_0x10059a[_0x8e1c('0x34')]=_[_0x8e1c('0x35')](_0x43ab4b[_0x8e1c('0x36')],qs[_0x8e1c('0x37')](_0x5a94c8[_0x8e1c('0x31')][_0x8e1c('0x37')]));_0x10059a[_0x8e1c('0x34')]=_0x10059a['attributes'][_0x8e1c('0x38')]?_0x10059a[_0x8e1c('0x34')]:_0x43ab4b[_0x8e1c('0x36')];_0x10059a['order']=qs['sort'](_0x5a94c8[_0x8e1c('0x31')][_0x8e1c('0x3b')]);_0x10059a[_0x8e1c('0x3c')]=qs['filters'](_[_0x8e1c('0x3d')](_0x5a94c8[_0x8e1c('0x31')],_0x43ab4b[_0x8e1c('0x33')]));if(_0x5a94c8[_0x8e1c('0x31')]['filter']){_0x10059a[_0x8e1c('0x3c')]=_[_0x8e1c('0x3f')](_0x10059a[_0x8e1c('0x3c')],{'$or':_[_0x8e1c('0x2b')](_0x10059a['attributes'],function(_0x572814){var _0x12d3d3={};_0x12d3d3[_0x572814]={'$like':'%'+_0x5a94c8[_0x8e1c('0x31')][_0x8e1c('0x3e')]+'%'};return _0x12d3d3;})});}_0x10059a=_['merge']({},_0x10059a,_0x5a94c8[_0x8e1c('0x42')]);return _0x18eb14[_0x8e1c('0x50')](_0x10059a);}})[_0x8e1c('0x25')](function(_0x5b037e){if(_0x5b037e){_0x13474e=_0x5b037e[_0x8e1c('0x38')];if(!_0x5a94c8['query'][_0x8e1c('0x39')](_0x8e1c('0x4e'))){_0x10059a['limit']=qs['limit'](_0x5a94c8['query'][_0x8e1c('0x1f')]);_0x10059a[_0x8e1c('0x1e')]=qs[_0x8e1c('0x1e')](_0x5a94c8[_0x8e1c('0x31')][_0x8e1c('0x1e')]);}return _0x18eb14[_0x8e1c('0x50')](_0x10059a);}})[_0x8e1c('0x25')](function(_0x14db61){if(_0x14db61){return _0x14db61?{'count':_0x13474e,'rows':_0x14db61}:null;}})[_0x8e1c('0x25')](respondWithResult(_0x55935c,null))[_0x8e1c('0x45')](handleError(_0x55935c,null));};exports[_0x8e1c('0x51')]=function(_0x7d2aa,_0x16be9c,_0x187307){var _0x827eeb={};var _0xc0f520={};var _0x2cf379;var _0x29d804;return db[_0x8e1c('0x2c')][_0x8e1c('0x4f')]({'where':{'id':_0x7d2aa[_0x8e1c('0x47')]['id']}})[_0x8e1c('0x25')](handleEntityNotFound(_0x16be9c,null))['then'](function(_0x39c145){if(_0x39c145){_0x2cf379=_0x39c145;_0xc0f520[_0x8e1c('0x36')]=_['keys'](db[_0x8e1c('0x52')][_0x8e1c('0x2d')]);_0xc0f520[_0x8e1c('0x31')]=_[_0x8e1c('0x32')](_0x7d2aa[_0x8e1c('0x31')]);_0xc0f520['filters']=_['intersection'](_0xc0f520['model'],_0xc0f520['query']);_0x827eeb[_0x8e1c('0x34')]=_['intersection'](_0xc0f520['model'],qs['fields'](_0x7d2aa[_0x8e1c('0x31')][_0x8e1c('0x37')]));_0x827eeb[_0x8e1c('0x34')]=_0x827eeb[_0x8e1c('0x34')]['length']?_0x827eeb[_0x8e1c('0x34')]:_0xc0f520['model'];_0x827eeb[_0x8e1c('0x3a')]=qs[_0x8e1c('0x3b')](_0x7d2aa[_0x8e1c('0x31')][_0x8e1c('0x3b')]);_0x827eeb[_0x8e1c('0x3c')]=qs['filters'](_[_0x8e1c('0x3d')](_0x7d2aa['query'],_0xc0f520[_0x8e1c('0x33')]));if(_0x7d2aa[_0x8e1c('0x31')]['filter']){_0x827eeb['where']=_[_0x8e1c('0x3f')](_0x827eeb[_0x8e1c('0x3c')],{'$or':_[_0x8e1c('0x2b')](_0x827eeb[_0x8e1c('0x34')],function(_0x180482){var _0x5b10ea={};_0x5b10ea[_0x180482]={'$like':'%'+_0x7d2aa[_0x8e1c('0x31')][_0x8e1c('0x3e')]+'%'};return _0x5b10ea;})});}_0x827eeb=_[_0x8e1c('0x3f')]({},_0x827eeb,_0x7d2aa['options']);return _0x2cf379[_0x8e1c('0x51')](_0x827eeb);}})[_0x8e1c('0x25')](function(_0x5d16ee){if(_0x5d16ee){_0x29d804=_0x5d16ee[_0x8e1c('0x38')];if(!_0x7d2aa[_0x8e1c('0x31')][_0x8e1c('0x39')](_0x8e1c('0x4e'))){_0x827eeb['limit']=qs[_0x8e1c('0x1f')](_0x7d2aa[_0x8e1c('0x31')][_0x8e1c('0x1f')]);_0x827eeb[_0x8e1c('0x1e')]=qs['offset'](_0x7d2aa[_0x8e1c('0x31')][_0x8e1c('0x1e')]);}return _0x2cf379[_0x8e1c('0x51')](_0x827eeb);}})[_0x8e1c('0x25')](function(_0x5c60dd){if(_0x5c60dd){return _0x5c60dd?{'count':_0x29d804,'rows':_0x5c60dd}:null;}})[_0x8e1c('0x25')](respondWithResult(_0x16be9c,null))['catch'](handleError(_0x16be9c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index fab9a90..aa9201c 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 _0x6888=['ServicenowConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intServicenowConfiguration.attributes','exports','define'];(function(_0x34e6c1,_0x1394e6){var _0x329f2a=function(_0x49d92b){while(--_0x49d92b){_0x34e6c1['push'](_0x34e6c1['shift']());}};_0x329f2a(++_0x1394e6);}(_0x6888,0xd2));var _0x8688=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x6888[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x8688('0x0'));var util=require('util');var logger=require(_0x8688('0x1'))(_0x8688('0x2'));var moment=require(_0x8688('0x3'));var BPromise=require(_0x8688('0x4'));var rp=require(_0x8688('0x5'));var fs=require('fs');var path=require(_0x8688('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8688('0x7'));module[_0x8688('0x8')]=function(_0x37c051,_0x33a806){return _0x37c051[_0x8688('0x9')](_0x8688('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c4d=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','bluebird'];(function(_0x4e82bb,_0x4c39d5){var _0x1b5ac5=function(_0x578c77){while(--_0x578c77){_0x4e82bb['push'](_0x4e82bb['shift']());}};_0x1b5ac5(++_0x4c39d5);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x3d1f32,_0x36a3dc){_0x3d1f32=_0x3d1f32-0x0;var _0x5a7969=_0x4c4d[_0x3d1f32];return _0x5a7969;};'use strict';var _=require(_0xd4c4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd4c4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4c4('0x2'));var rimraf=require(_0xd4c4('0x3'));var config=require(_0xd4c4('0x4'));var attributes=require(_0xd4c4('0x5'));module[_0xd4c4('0x6')]=function(_0x207277,_0x4bc0c9){return _0x207277[_0xd4c4('0x7')](_0xd4c4('0x8'),attributes,{'tableName':_0xd4c4('0x9'),'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 58dc5e9..63c6099 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 _0xfe20=['moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x38b3fc,_0x40cd74){var _0x3916fa=function(_0x2af5f8){while(--_0x2af5f8){_0x38b3fc['push'](_0x38b3fc['shift']());}};_0x3916fa(++_0x40cd74);}(_0xfe20,0x11f));var _0x0fe2=function(_0x4ed15c,_0x4031be){_0x4ed15c=_0x4ed15c-0x0;var _0x96a695=_0xfe20[_0x4ed15c];return _0x96a695;};'use strict';var _=require(_0x0fe2('0x0'));var util=require('util');var moment=require(_0x0fe2('0x1'));var BPromise=require('bluebird');var rs=require(_0x0fe2('0x2'));var fs=require('fs');var Redis=require(_0x0fe2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0fe2('0x4'));var config=require(_0x0fe2('0x5'));var jayson=require(_0x0fe2('0x6'));var client=jayson[_0x0fe2('0x7')][_0x0fe2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5868,_0x49ed4a,_0x1a50d2){return new BPromise(function(_0x52e72e,_0x171dba){return client['request'](_0x5f5868,_0x1a50d2)['then'](function(_0x4a90be){logger[_0x0fe2('0x9')](_0x0fe2('0xa'),_0x49ed4a,_0x0fe2('0xb'));logger[_0x0fe2('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x49ed4a,_0x0fe2('0xb'),JSON[_0x0fe2('0xd')](_0x4a90be));if(_0x4a90be['error']){if(_0x4a90be[_0x0fe2('0xe')][_0x0fe2('0xf')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x49ed4a,_0x4a90be[_0x0fe2('0xe')][_0x0fe2('0x10')]);return _0x171dba(_0x4a90be[_0x0fe2('0xe')][_0x0fe2('0x10')]);}logger[_0x0fe2('0xe')](_0x0fe2('0xa'),_0x49ed4a,_0x4a90be[_0x0fe2('0xe')][_0x0fe2('0x10')]);return _0x52e72e(_0x4a90be['error'][_0x0fe2('0x10')]);}else{logger[_0x0fe2('0x9')](_0x0fe2('0xa'),_0x49ed4a,'request\x20sent');_0x52e72e(_0x4a90be['result'][_0x0fe2('0x10')]);}})[_0x0fe2('0x11')](function(_0x5d284a){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x49ed4a,_0x5d284a);_0x171dba(_0x5d284a);});});} \ No newline at end of file +var _0xf2f2=['request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0xf2f2,0x70));var _0x2f2f=function(_0x2c944e,_0x26f659){_0x2c944e=_0x2c944e-0x0;var _0x2cc529=_0xf2f2[_0x2c944e];return _0x2cc529;};'use strict';var _=require(_0x2f2f('0x0'));var util=require(_0x2f2f('0x1'));var moment=require('moment');var BPromise=require(_0x2f2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f2f('0x3'));var db=require(_0x2f2f('0x4'))['db'];var utils=require(_0x2f2f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f2f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f2f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x13dbae,_0x54f597,_0x3e19fe){return new BPromise(function(_0x6f4b73,_0x501cf9){return client[_0x2f2f('0x8')](_0x13dbae,_0x3e19fe)[_0x2f2f('0x9')](function(_0x26eeb5){logger[_0x2f2f('0xa')](_0x2f2f('0xb'),_0x54f597,_0x2f2f('0xc'));logger[_0x2f2f('0xd')](_0x2f2f('0xe'),_0x54f597,'request\x20sent',JSON[_0x2f2f('0xf')](_0x26eeb5));if(_0x26eeb5[_0x2f2f('0x10')]){if(_0x26eeb5['error']['code']===0x1f4){logger[_0x2f2f('0x10')](_0x2f2f('0xb'),_0x54f597,_0x26eeb5[_0x2f2f('0x10')]['message']);return _0x501cf9(_0x26eeb5[_0x2f2f('0x10')][_0x2f2f('0x11')]);}logger[_0x2f2f('0x10')](_0x2f2f('0xb'),_0x54f597,_0x26eeb5['error']['message']);return _0x6f4b73(_0x26eeb5[_0x2f2f('0x10')][_0x2f2f('0x11')]);}else{logger['info'](_0x2f2f('0xb'),_0x54f597,_0x2f2f('0xc'));_0x6f4b73(_0x26eeb5[_0x2f2f('0x12')][_0x2f2f('0x11')]);}})[_0x2f2f('0x13')](function(_0x35e708){logger[_0x2f2f('0x10')](_0x2f2f('0xb'),_0x54f597,_0x35e708);_0x501cf9(_0x35e708);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index ed12395..6743dfb 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 _0x34d7=['index','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34d7,0x1c1));var _0x734d=function(_0x5ded62,_0x559fa1){_0x5ded62=_0x5ded62-0x0;var _0x30c6a8=_0x34d7[_0x5ded62];return _0x30c6a8;};'use strict';var multer=require(_0x734d('0x0'));var util=require(_0x734d('0x1'));var path=require(_0x734d('0x2'));var timeout=require(_0x734d('0x3'));var express=require(_0x734d('0x4'));var router=express[_0x734d('0x5')]();var fs_extra=require(_0x734d('0x6'));var auth=require(_0x734d('0x7'));var interaction=require(_0x734d('0x8'));var config=require(_0x734d('0x9'));var controller=require(_0x734d('0xa'));router[_0x734d('0xb')]('/',auth[_0x734d('0xc')](),controller[_0x734d('0xd')]);router[_0x734d('0xb')](_0x734d('0xe'),auth[_0x734d('0xc')](),controller[_0x734d('0xf')]);router[_0x734d('0x10')]('/',auth[_0x734d('0xc')](),controller['create']);router[_0x734d('0x11')]('/:id',auth[_0x734d('0xc')](),controller[_0x734d('0x12')]);router[_0x734d('0x13')](_0x734d('0xe'),auth[_0x734d('0xc')](),controller['destroy']);module[_0x734d('0x14')]=router; \ No newline at end of file +var _0x95f5=['Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x56a7bc,_0x41d6f6){var _0x4f5883=function(_0x23e4a4){while(--_0x23e4a4){_0x56a7bc['push'](_0x56a7bc['shift']());}};_0x4f5883(++_0x41d6f6);}(_0x95f5,0xab));var _0x595f=function(_0x340781,_0x32b659){_0x340781=_0x340781-0x0;var _0x1a6ab9=_0x95f5[_0x340781];return _0x1a6ab9;};'use strict';var multer=require(_0x595f('0x0'));var util=require(_0x595f('0x1'));var path=require(_0x595f('0x2'));var timeout=require(_0x595f('0x3'));var express=require(_0x595f('0x4'));var router=express[_0x595f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x595f('0x6'));var interaction=require(_0x595f('0x7'));var config=require('../../config/environment');var controller=require(_0x595f('0x8'));router[_0x595f('0x9')]('/',auth[_0x595f('0xa')](),controller[_0x595f('0xb')]);router['get'](_0x595f('0xc'),auth[_0x595f('0xa')](),controller[_0x595f('0xd')]);router['post']('/',auth[_0x595f('0xa')](),controller['create']);router['put'](_0x595f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x595f('0xe')](_0x595f('0xc'),auth['isAuthenticated'](),controller[_0x595f('0xf')]);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 0643d46..d1ddf4f 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 _0xe81f=['customVariable','sequelize','exports','ENUM','variable','keyValue','picklist','string','STRING'];(function(_0x224a72,_0x72683){var _0x51848a=function(_0x4bd7da){while(--_0x4bd7da){_0x224a72['push'](_0x224a72['shift']());}};_0x51848a(++_0x72683);}(_0xe81f,0xac));var _0xfe81=function(_0x3fde5f,_0xd4a28d){_0x3fde5f=_0x3fde5f-0x0;var _0x10adc2=_0xe81f[_0x3fde5f];return _0x10adc2;};'use strict';var Sequelize=require(_0xfe81('0x0'));module[_0xfe81('0x1')]={'type':{'type':Sequelize[_0xfe81('0x2')]('string',_0xfe81('0x3'),'customVariable',_0xfe81('0x4'),_0xfe81('0x5')),'defaultValue':_0xfe81('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfe81('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xfe81('0x8'))},'keyContent':{'type':Sequelize[_0xfe81('0x7')]},'idField':{'type':Sequelize[_0xfe81('0x7')]},'nameField':{'type':Sequelize[_0xfe81('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe81('0x7')]}}; \ No newline at end of file +var _0xf046=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x29ad0d,_0x569ecd){var _0x385273=function(_0x408dd5){while(--_0x408dd5){_0x29ad0d['push'](_0x29ad0d['shift']());}};_0x385273(++_0x569ecd);}(_0xf046,0x1af));var _0x6f04=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xf046[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x6f04('0x0'));module[_0x6f04('0x1')]={'type':{'type':Sequelize[_0x6f04('0x2')](_0x6f04('0x3'),'variable',_0x6f04('0x4'),_0x6f04('0x5'),_0x6f04('0x6')),'defaultValue':_0x6f04('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6f04('0x7')]},'keyType':{'type':Sequelize[_0x6f04('0x2')](_0x6f04('0x3'),'variable',_0x6f04('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6f04('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f04('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index fad441d..4a8c743 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 _0x3e54=['../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','save','destroy','then','error','stack','name','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','findAll','rows','show','params','include','options','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x3e54,0x155));var _0x43e5=function(_0x1b31a4,_0x55b4bb){_0x1b31a4=_0x1b31a4-0x0;var _0x316681=_0x3e54[_0x1b31a4];return _0x316681;};'use strict';var emlformat=require(_0x43e5('0x0'));var rimraf=require(_0x43e5('0x1'));var zipdir=require(_0x43e5('0x2'));var jsonpatch=require(_0x43e5('0x3'));var rp=require(_0x43e5('0x4'));var moment=require(_0x43e5('0x5'));var BPromise=require(_0x43e5('0x6'));var Mustache=require(_0x43e5('0x7'));var util=require(_0x43e5('0x8'));var path=require(_0x43e5('0x9'));var sox=require(_0x43e5('0xa'));var csv=require(_0x43e5('0xb'));var ejs=require(_0x43e5('0xc'));var fs=require('fs');var fs_extra=require(_0x43e5('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x43e5('0xe'));var jsforce=require(_0x43e5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x43e5('0xb'));var querystring=require(_0x43e5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e5('0x11'));var as=require(_0x43e5('0x12'));var hardwareService=require(_0x43e5('0x13'));var logger=require(_0x43e5('0x14'))('api');var utils=require(_0x43e5('0x15'));var config=require(_0x43e5('0x16'));var licenseUtil=require(_0x43e5('0x17'));var db=require(_0x43e5('0x18'))['db'];function respondWithStatusCode(_0xf5cf16,_0x35fd69){_0x35fd69=_0x35fd69||0xcc;return function(_0x59dffd){if(_0x59dffd){return _0xf5cf16[_0x43e5('0x19')](_0x35fd69);}return _0xf5cf16['status'](_0x35fd69)[_0x43e5('0x1a')]();};}function respondWithResult(_0x48a131,_0x2c56ea){_0x2c56ea=_0x2c56ea||0xc8;return function(_0x45be01){if(_0x45be01){return _0x48a131[_0x43e5('0x1b')](_0x2c56ea)[_0x43e5('0x1c')](_0x45be01);}};}function respondWithFilteredResult(_0x4b5190,_0x301561){return function(_0xe209d8){if(_0xe209d8){var _0x9fcc7e=typeof _0x301561['offset']===_0x43e5('0x1d')&&typeof _0x301561['limit']===_0x43e5('0x1d');var _0x53f16d=_0xe209d8[_0x43e5('0x1e')];var _0x33d0bf=_0x9fcc7e?0x0:_0x301561[_0x43e5('0x1f')];var _0x422535=_0x9fcc7e?_0xe209d8[_0x43e5('0x1e')]:_0x301561[_0x43e5('0x1f')]+_0x301561[_0x43e5('0x20')];var _0x20b26d;if(_0x422535>=_0x53f16d){_0x422535=_0x53f16d;_0x20b26d=0xc8;}else{_0x20b26d=0xce;}_0x4b5190[_0x43e5('0x1b')](_0x20b26d);return _0x4b5190[_0x43e5('0x21')]('Content-Range',_0x33d0bf+'-'+_0x422535+'/'+_0x53f16d)[_0x43e5('0x1c')](_0xe209d8);}return null;};}function patchUpdates(_0x4a6126){return function(_0x463b65){try{jsonpatch['apply'](_0x463b65,_0x4a6126,!![]);}catch(_0x47e1da){return BPromise['reject'](_0x47e1da);}return _0x463b65[_0x43e5('0x22')]();};}function saveUpdates(_0x163141,_0x4bea3e){return function(_0x5333ea){if(_0x5333ea){return _0x5333ea['update'](_0x163141)['then'](function(_0x1b5dcc){return _0x1b5dcc;});}return null;};}function removeEntity(_0x554e0a,_0x2696a4){return function(_0x5c4d20){if(_0x5c4d20){return _0x5c4d20[_0x43e5('0x23')]()[_0x43e5('0x24')](function(){_0x554e0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24a576,_0x53a60c){return function(_0x10753d){if(!_0x10753d){_0x24a576['sendStatus'](0x194);}return _0x10753d;};}function handleError(_0x9d39b,_0x2e2652){_0x2e2652=_0x2e2652||0x1f4;return function(_0x1d7730){logger[_0x43e5('0x25')](_0x1d7730[_0x43e5('0x26')]);if(_0x1d7730['name']){delete _0x1d7730[_0x43e5('0x27')];}_0x9d39b[_0x43e5('0x1b')](_0x2e2652)['send'](_0x1d7730);};}exports['index']=function(_0x43181f,_0x356024){var _0x5d5ec3={},_0x2a92de={},_0x28683e={'count':0x0,'rows':[]};var _0x598535=_[_0x43e5('0x28')](db[_0x43e5('0x29')][_0x43e5('0x2a')],function(_0x31f46e){return{'name':_0x31f46e[_0x43e5('0x2b')],'type':_0x31f46e[_0x43e5('0x2c')][_0x43e5('0x2d')]};});_0x2a92de[_0x43e5('0x2e')]=_['map'](_0x598535,_0x43e5('0x27'));_0x2a92de[_0x43e5('0x2f')]=_[_0x43e5('0x30')](_0x43181f[_0x43e5('0x2f')]);_0x2a92de['filters']=_[_0x43e5('0x31')](_0x2a92de[_0x43e5('0x2e')],_0x2a92de[_0x43e5('0x2f')]);_0x5d5ec3[_0x43e5('0x32')]=_[_0x43e5('0x31')](_0x2a92de[_0x43e5('0x2e')],qs[_0x43e5('0x33')](_0x43181f[_0x43e5('0x2f')][_0x43e5('0x33')]));_0x5d5ec3['attributes']=_0x5d5ec3[_0x43e5('0x32')][_0x43e5('0x34')]?_0x5d5ec3[_0x43e5('0x32')]:_0x2a92de[_0x43e5('0x2e')];if(!_0x43181f[_0x43e5('0x2f')][_0x43e5('0x35')](_0x43e5('0x36'))){_0x5d5ec3[_0x43e5('0x20')]=qs[_0x43e5('0x20')](_0x43181f['query'][_0x43e5('0x20')]);_0x5d5ec3[_0x43e5('0x1f')]=qs['offset'](_0x43181f[_0x43e5('0x2f')][_0x43e5('0x1f')]);}_0x5d5ec3[_0x43e5('0x37')]=qs['sort'](_0x43181f[_0x43e5('0x2f')][_0x43e5('0x38')]);_0x5d5ec3[_0x43e5('0x39')]=qs[_0x43e5('0x3a')](_[_0x43e5('0x3b')](_0x43181f[_0x43e5('0x2f')],_0x2a92de['filters']),_0x598535);if(_0x43181f[_0x43e5('0x2f')]['filter']){_0x5d5ec3['where']=_['merge'](_0x5d5ec3[_0x43e5('0x39')],{'$or':_[_0x43e5('0x28')](_0x598535,function(_0x22953f){if(_0x22953f[_0x43e5('0x2c')]!=='VIRTUAL'){var _0x593e9f={};_0x593e9f[_0x22953f[_0x43e5('0x27')]]={'$like':'%'+_0x43181f[_0x43e5('0x2f')][_0x43e5('0x3c')]+'%'};return _0x593e9f;}})});}_0x5d5ec3=_['merge']({},_0x5d5ec3,_0x43181f['options']);var _0x329bb7={'where':_0x5d5ec3[_0x43e5('0x39')]};return db[_0x43e5('0x29')]['count'](_0x329bb7)[_0x43e5('0x24')](function(_0xc21596){_0x28683e['count']=_0xc21596;if(_0x43181f['query'][_0x43e5('0x3d')]){_0x5d5ec3['include']=[{'all':!![]}];}return db['ServicenowField'][_0x43e5('0x3e')](_0x5d5ec3);})[_0x43e5('0x24')](function(_0x2e100e){_0x28683e[_0x43e5('0x3f')]=_0x2e100e;return _0x28683e;})[_0x43e5('0x24')](respondWithFilteredResult(_0x356024,_0x5d5ec3))['catch'](handleError(_0x356024,null));};exports[_0x43e5('0x40')]=function(_0x1a303e,_0x33b7d7){var _0x4e9d6b={'raw':!![],'where':{'id':_0x1a303e[_0x43e5('0x41')]['id']}},_0x3266a2={};_0x3266a2['model']=_[_0x43e5('0x30')](db[_0x43e5('0x29')][_0x43e5('0x2a')]);_0x3266a2[_0x43e5('0x2f')]=_[_0x43e5('0x30')](_0x1a303e[_0x43e5('0x2f')]);_0x3266a2[_0x43e5('0x3a')]=_[_0x43e5('0x31')](_0x3266a2['model'],_0x3266a2[_0x43e5('0x2f')]);_0x4e9d6b[_0x43e5('0x32')]=_[_0x43e5('0x31')](_0x3266a2[_0x43e5('0x2e')],qs[_0x43e5('0x33')](_0x1a303e['query'][_0x43e5('0x33')]));_0x4e9d6b[_0x43e5('0x32')]=_0x4e9d6b[_0x43e5('0x32')][_0x43e5('0x34')]?_0x4e9d6b[_0x43e5('0x32')]:_0x3266a2[_0x43e5('0x2e')];if(_0x1a303e['query'][_0x43e5('0x3d')]){_0x4e9d6b[_0x43e5('0x42')]=[{'all':!![]}];}_0x4e9d6b=_['merge']({},_0x4e9d6b,_0x1a303e[_0x43e5('0x43')]);return db['ServicenowField'][_0x43e5('0x44')](_0x4e9d6b)[_0x43e5('0x24')](handleEntityNotFound(_0x33b7d7,null))[_0x43e5('0x24')](respondWithResult(_0x33b7d7,null))[_0x43e5('0x45')](handleError(_0x33b7d7,null));};exports['create']=function(_0x9a59b0,_0x416885){return db[_0x43e5('0x29')][_0x43e5('0x46')](_0x9a59b0['body'],{})['then'](respondWithResult(_0x416885,0xc9))[_0x43e5('0x45')](handleError(_0x416885,null));};exports[_0x43e5('0x47')]=function(_0xadccce,_0x44713c){if(_0xadccce[_0x43e5('0x48')]['id']){delete _0xadccce['body']['id'];}return db[_0x43e5('0x29')][_0x43e5('0x44')]({'where':{'id':_0xadccce[_0x43e5('0x41')]['id']}})[_0x43e5('0x24')](handleEntityNotFound(_0x44713c,null))[_0x43e5('0x24')](saveUpdates(_0xadccce['body'],null))[_0x43e5('0x24')](respondWithResult(_0x44713c,null))[_0x43e5('0x45')](handleError(_0x44713c,null));};exports[_0x43e5('0x23')]=function(_0x33a763,_0x432c59){return db[_0x43e5('0x29')]['find']({'where':{'id':_0x33a763[_0x43e5('0x41')]['id']}})[_0x43e5('0x24')](handleEntityNotFound(_0x432c59,null))[_0x43e5('0x24')](removeEntity(_0x432c59,null))[_0x43e5('0x45')](handleError(_0x432c59,null));}; \ No newline at end of file +var _0xf883=['../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','ServicenowField','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','update','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment'];(function(_0x3b9e7c,_0x3a80d){var _0x169664=function(_0x12fd5a){while(--_0x12fd5a){_0x3b9e7c['push'](_0x3b9e7c['shift']());}};_0x169664(++_0x3a80d);}(_0xf883,0x1f2));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f88('0x0'));var zipdir=require(_0x3f88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f88('0x2'));var moment=require(_0x3f88('0x3'));var BPromise=require(_0x3f88('0x4'));var Mustache=require(_0x3f88('0x5'));var util=require('util');var path=require(_0x3f88('0x6'));var sox=require(_0x3f88('0x7'));var csv=require(_0x3f88('0x8'));var ejs=require(_0x3f88('0x9'));var fs=require('fs');var fs_extra=require(_0x3f88('0xa'));var _=require(_0x3f88('0xb'));var squel=require(_0x3f88('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f88('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3f88('0xe'));var Redis=require(_0x3f88('0xf'));var authService=require(_0x3f88('0x10'));var qs=require(_0x3f88('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3f88('0x12'));var config=require(_0x3f88('0x13'));var licenseUtil=require(_0x3f88('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2de9fd,_0x505ddc){_0x505ddc=_0x505ddc||0xcc;return function(_0x5bb9c2){if(_0x5bb9c2){return _0x2de9fd[_0x3f88('0x15')](_0x505ddc);}return _0x2de9fd['status'](_0x505ddc)[_0x3f88('0x16')]();};}function respondWithResult(_0x5c6903,_0x35df67){_0x35df67=_0x35df67||0xc8;return function(_0x182266){if(_0x182266){return _0x5c6903[_0x3f88('0x17')](_0x35df67)[_0x3f88('0x18')](_0x182266);}};}function respondWithFilteredResult(_0x238750,_0x568f31){return function(_0x325989){if(_0x325989){var _0x3c983f=typeof _0x568f31[_0x3f88('0x19')]==='undefined'&&typeof _0x568f31[_0x3f88('0x1a')]===_0x3f88('0x1b');var _0x170085=_0x325989[_0x3f88('0x1c')];var _0x5685fa=_0x3c983f?0x0:_0x568f31[_0x3f88('0x19')];var _0x25bd68=_0x3c983f?_0x325989['count']:_0x568f31[_0x3f88('0x19')]+_0x568f31[_0x3f88('0x1a')];var _0x5e5216;if(_0x25bd68>=_0x170085){_0x25bd68=_0x170085;_0x5e5216=0xc8;}else{_0x5e5216=0xce;}_0x238750[_0x3f88('0x17')](_0x5e5216);return _0x238750[_0x3f88('0x1d')](_0x3f88('0x1e'),_0x5685fa+'-'+_0x25bd68+'/'+_0x170085)['json'](_0x325989);}return null;};}function patchUpdates(_0x414762){return function(_0x420388){try{jsonpatch[_0x3f88('0x1f')](_0x420388,_0x414762,!![]);}catch(_0x41bc69){return BPromise[_0x3f88('0x20')](_0x41bc69);}return _0x420388[_0x3f88('0x21')]();};}function saveUpdates(_0x421627,_0x920969){return function(_0x6ea423){if(_0x6ea423){return _0x6ea423['update'](_0x421627)[_0x3f88('0x22')](function(_0x5123b8){return _0x5123b8;});}return null;};}function removeEntity(_0x198a36,_0x544659){return function(_0x34e707){if(_0x34e707){return _0x34e707['destroy']()[_0x3f88('0x22')](function(){_0x198a36[_0x3f88('0x17')](0xcc)[_0x3f88('0x16')]();});}};}function handleEntityNotFound(_0x4cefcc,_0x1cdb7e){return function(_0x16e8d2){if(!_0x16e8d2){_0x4cefcc[_0x3f88('0x15')](0x194);}return _0x16e8d2;};}function handleError(_0x1b556d,_0x18c589){_0x18c589=_0x18c589||0x1f4;return function(_0x2415c5){logger[_0x3f88('0x23')](_0x2415c5[_0x3f88('0x24')]);if(_0x2415c5[_0x3f88('0x25')]){delete _0x2415c5[_0x3f88('0x25')];}_0x1b556d['status'](_0x18c589)[_0x3f88('0x26')](_0x2415c5);};}exports[_0x3f88('0x27')]=function(_0x45a8d0,_0x5d28ed){var _0x47fd4d={},_0x3d1c9d={},_0x28749a={'count':0x0,'rows':[]};var _0x230ae9=_[_0x3f88('0x28')](db['ServicenowField']['rawAttributes'],function(_0x5c7827){return{'name':_0x5c7827[_0x3f88('0x29')],'type':_0x5c7827[_0x3f88('0x2a')][_0x3f88('0x2b')]};});_0x3d1c9d[_0x3f88('0x2c')]=_[_0x3f88('0x28')](_0x230ae9,'name');_0x3d1c9d[_0x3f88('0x2d')]=_[_0x3f88('0x2e')](_0x45a8d0['query']);_0x3d1c9d[_0x3f88('0x2f')]=_[_0x3f88('0x30')](_0x3d1c9d[_0x3f88('0x2c')],_0x3d1c9d[_0x3f88('0x2d')]);_0x47fd4d['attributes']=_['intersection'](_0x3d1c9d['model'],qs[_0x3f88('0x31')](_0x45a8d0[_0x3f88('0x2d')][_0x3f88('0x31')]));_0x47fd4d['attributes']=_0x47fd4d[_0x3f88('0x32')]['length']?_0x47fd4d[_0x3f88('0x32')]:_0x3d1c9d[_0x3f88('0x2c')];if(!_0x45a8d0['query'][_0x3f88('0x33')](_0x3f88('0x34'))){_0x47fd4d[_0x3f88('0x1a')]=qs['limit'](_0x45a8d0[_0x3f88('0x2d')][_0x3f88('0x1a')]);_0x47fd4d['offset']=qs['offset'](_0x45a8d0[_0x3f88('0x2d')][_0x3f88('0x19')]);}_0x47fd4d[_0x3f88('0x35')]=qs[_0x3f88('0x36')](_0x45a8d0['query']['sort']);_0x47fd4d[_0x3f88('0x37')]=qs[_0x3f88('0x2f')](_['pick'](_0x45a8d0[_0x3f88('0x2d')],_0x3d1c9d[_0x3f88('0x2f')]),_0x230ae9);if(_0x45a8d0[_0x3f88('0x2d')][_0x3f88('0x38')]){_0x47fd4d[_0x3f88('0x37')]=_[_0x3f88('0x39')](_0x47fd4d['where'],{'$or':_['map'](_0x230ae9,function(_0x62ceec){if(_0x62ceec[_0x3f88('0x2a')]!==_0x3f88('0x3a')){var _0x57b0d5={};_0x57b0d5[_0x62ceec['name']]={'$like':'%'+_0x45a8d0[_0x3f88('0x2d')][_0x3f88('0x38')]+'%'};return _0x57b0d5;}})});}_0x47fd4d=_[_0x3f88('0x39')]({},_0x47fd4d,_0x45a8d0['options']);var _0x48c02b={'where':_0x47fd4d[_0x3f88('0x37')]};return db[_0x3f88('0x3b')][_0x3f88('0x1c')](_0x48c02b)[_0x3f88('0x22')](function(_0x262f99){_0x28749a['count']=_0x262f99;if(_0x45a8d0[_0x3f88('0x2d')][_0x3f88('0x3c')]){_0x47fd4d[_0x3f88('0x3d')]=[{'all':!![]}];}return db[_0x3f88('0x3b')][_0x3f88('0x3e')](_0x47fd4d);})[_0x3f88('0x22')](function(_0x40cc37){_0x28749a[_0x3f88('0x3f')]=_0x40cc37;return _0x28749a;})[_0x3f88('0x22')](respondWithFilteredResult(_0x5d28ed,_0x47fd4d))['catch'](handleError(_0x5d28ed,null));};exports[_0x3f88('0x40')]=function(_0x2589a3,_0x1a4a92){var _0x1273cb={'raw':!![],'where':{'id':_0x2589a3[_0x3f88('0x41')]['id']}},_0x2df8e1={};_0x2df8e1['model']=_[_0x3f88('0x2e')](db['ServicenowField'][_0x3f88('0x42')]);_0x2df8e1[_0x3f88('0x2d')]=_['keys'](_0x2589a3[_0x3f88('0x2d')]);_0x2df8e1[_0x3f88('0x2f')]=_[_0x3f88('0x30')](_0x2df8e1[_0x3f88('0x2c')],_0x2df8e1[_0x3f88('0x2d')]);_0x1273cb[_0x3f88('0x32')]=_[_0x3f88('0x30')](_0x2df8e1[_0x3f88('0x2c')],qs['fields'](_0x2589a3[_0x3f88('0x2d')]['fields']));_0x1273cb[_0x3f88('0x32')]=_0x1273cb['attributes']['length']?_0x1273cb[_0x3f88('0x32')]:_0x2df8e1[_0x3f88('0x2c')];if(_0x2589a3[_0x3f88('0x2d')][_0x3f88('0x3c')]){_0x1273cb[_0x3f88('0x3d')]=[{'all':!![]}];}_0x1273cb=_[_0x3f88('0x39')]({},_0x1273cb,_0x2589a3[_0x3f88('0x43')]);return db[_0x3f88('0x3b')][_0x3f88('0x44')](_0x1273cb)[_0x3f88('0x22')](handleEntityNotFound(_0x1a4a92,null))[_0x3f88('0x22')](respondWithResult(_0x1a4a92,null))[_0x3f88('0x45')](handleError(_0x1a4a92,null));};exports[_0x3f88('0x46')]=function(_0x59d5b6,_0x33d9d8){return db[_0x3f88('0x3b')][_0x3f88('0x46')](_0x59d5b6[_0x3f88('0x47')],{})[_0x3f88('0x22')](respondWithResult(_0x33d9d8,0xc9))[_0x3f88('0x45')](handleError(_0x33d9d8,null));};exports[_0x3f88('0x48')]=function(_0x34d83f,_0xd700e4){if(_0x34d83f[_0x3f88('0x47')]['id']){delete _0x34d83f[_0x3f88('0x47')]['id'];}return db['ServicenowField'][_0x3f88('0x44')]({'where':{'id':_0x34d83f[_0x3f88('0x41')]['id']}})[_0x3f88('0x22')](handleEntityNotFound(_0xd700e4,null))[_0x3f88('0x22')](saveUpdates(_0x34d83f[_0x3f88('0x47')],null))[_0x3f88('0x22')](respondWithResult(_0xd700e4,null))['catch'](handleError(_0xd700e4,null));};exports[_0x3f88('0x49')]=function(_0x36ddd9,_0x14247e){return db['ServicenowField'][_0x3f88('0x44')]({'where':{'id':_0x36ddd9['params']['id']}})[_0x3f88('0x22')](handleEntityNotFound(_0x14247e,null))[_0x3f88('0x22')](removeEntity(_0x14247e,null))[_0x3f88('0x45')](handleError(_0x14247e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4158263..4b7e62c 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 _0xfddf=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index','lodash','util','api','moment'];(function(_0x24d8a5,_0xbff0e8){var _0x1c325e=function(_0x4386b4){while(--_0x4386b4){_0x24d8a5['push'](_0x24d8a5['shift']());}};_0x1c325e(++_0xbff0e8);}(_0xfddf,0x140));var _0xffdd=function(_0x377c54,_0x195ccf){_0x377c54=_0x377c54-0x0;var _0x1db41e=_0xfddf[_0x377c54];return _0x1db41e;};'use strict';var _=require(_0xffdd('0x0'));var util=require(_0xffdd('0x1'));var logger=require('../../config/logger')(_0xffdd('0x2'));var moment=require(_0xffdd('0x3'));var BPromise=require(_0xffdd('0x4'));var rp=require(_0xffdd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffdd('0x6'));var config=require(_0xffdd('0x7'));var attributes=require(_0xffdd('0x8'));module[_0xffdd('0x9')]=function(_0xd5ff0e,_0x3a296d){return _0xd5ff0e['define']('ServicenowField',attributes,{'tableName':_0xffdd('0xa'),'paranoid':![],'indexes':[{'name':_0xffdd('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bdd=['rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','api','request-promise','path'];(function(_0x5f1733,_0x5775d2){var _0x84575=function(_0x5d7633){while(--_0x5d7633){_0x5f1733['push'](_0x5f1733['shift']());}};_0x84575(++_0x5775d2);}(_0x4bdd,0x15b));var _0xd4bd=function(_0x5a7da6,_0xb2b5aa){_0x5a7da6=_0x5a7da6-0x0;var _0x1f65ac=_0x4bdd[_0x5a7da6];return _0x1f65ac;};'use strict';var _=require('lodash');var util=require(_0xd4bd('0x0'));var logger=require('../../config/logger')(_0xd4bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd4bd('0x2'));var fs=require('fs');var path=require(_0xd4bd('0x3'));var rimraf=require(_0xd4bd('0x4'));var config=require('../../config/environment');var attributes=require(_0xd4bd('0x5'));module[_0xd4bd('0x6')]=function(_0x49a943,_0x19147d){return _0x49a943[_0xd4bd('0x7')](_0xd4bd('0x8'),attributes,{'tableName':_0xd4bd('0x9'),'paranoid':![],'indexes':[{'name':_0xd4bd('0xa'),'fields':[_0xd4bd('0xb'),_0xd4bd('0xc')],'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 be7de52..c1fb2f6 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x55678c,_0x1308ad){var _0x243a22=function(_0x19dca8){while(--_0x19dca8){_0x55678c['push'](_0x55678c['shift']());}};_0x243a22(++_0x1308ad);}(_0xaa88,0x137));var _0x8aa8=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0xaa88[_0x5db313];return _0x36d503;};'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')]('ServicenowField,\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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x346df7,_0x3404ad){var _0x504fd8=function(_0x5874e6){while(--_0x5874e6){_0x346df7['push'](_0x346df7['shift']());}};_0x504fd8(++_0x3404ad);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index f788a7c..4e31c3a 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x403f97,_0xc15995){var _0x149a3f=function(_0x4c1463){while(--_0x4c1463){_0x403f97['push'](_0x403f97['shift']());}};_0x149a3f(++_0xc15995);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x1d3225,_0x184013){var _0x242ebf=function(_0x551e94){while(--_0x551e94){_0x1d3225['push'](_0x1d3225['shift']());}};_0x242ebf(++_0x184013);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 93b2293..0e9c739 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(_0x398740,_0x13cd90){var _0x52ac66=function(_0x310a50){while(--_0x310a50){_0x398740['push'](_0x398740['shift']());}};_0x52ac66(++_0x13cd90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x3fb096,_0x4d111a){var _0x3d547a=function(_0x1ebe90){while(--_0x1ebe90){_0x3fb096['push'](_0x3fb096['shift']());}};_0x3d547a(++_0x4d111a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 d03012e..699c981 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 _0x6068=['save','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','Password\x20Expired','Calls','module_fields','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x9d8f68,_0x4bd30e){var _0x412522=function(_0x157ffd){while(--_0x157ffd){_0x9d8f68['push'](_0x9d8f68['shift']());}};_0x412522(++_0x4bd30e);}(_0x6068,0x1c0));var _0x8606=function(_0x31119b,_0x46ecae){_0x31119b=_0x31119b-0x0;var _0xe74c2e=_0x6068[_0x31119b];return _0xe74c2e;};'use strict';var emlformat=require(_0x8606('0x0'));var rimraf=require(_0x8606('0x1'));var zipdir=require(_0x8606('0x2'));var jsonpatch=require(_0x8606('0x3'));var rp=require('request-promise');var moment=require(_0x8606('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8606('0x5'));var util=require('util');var path=require(_0x8606('0x6'));var sox=require(_0x8606('0x7'));var csv=require(_0x8606('0x8'));var ejs=require(_0x8606('0x9'));var fs=require('fs');var fs_extra=require(_0x8606('0xa'));var _=require(_0x8606('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8606('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8606('0xd'));var Papa=require('papaparse');var Redis=require(_0x8606('0xe'));var authService=require(_0x8606('0xf'));var qs=require(_0x8606('0x10'));var as=require(_0x8606('0x11'));var hardwareService=require(_0x8606('0x12'));var logger=require(_0x8606('0x13'))(_0x8606('0x14'));var utils=require('../../config/utils');var config=require(_0x8606('0x15'));var licenseUtil=require(_0x8606('0x16'));var db=require(_0x8606('0x17'))['db'];var integrations=require(_0x8606('0x18'));function respondWithStatusCode(_0x389383,_0x425d48){_0x425d48=_0x425d48||0xcc;return function(_0x3c7c81){if(_0x3c7c81){return _0x389383[_0x8606('0x19')](_0x425d48);}return _0x389383[_0x8606('0x1a')](_0x425d48)[_0x8606('0x1b')]();};}function respondWithResult(_0x364ea3,_0x17091f){_0x17091f=_0x17091f||0xc8;return function(_0x2b6fde){if(_0x2b6fde){return _0x364ea3['status'](_0x17091f)[_0x8606('0x1c')](_0x2b6fde);}};}function respondWithFilteredResult(_0x30b8ec,_0x36ec9c){return function(_0x29c5a0){if(_0x29c5a0){var _0x5e0e61=typeof _0x36ec9c[_0x8606('0x1d')]===_0x8606('0x1e')&&typeof _0x36ec9c[_0x8606('0x1f')]===_0x8606('0x1e');var _0x202d81=_0x29c5a0['count'];var _0x591289=_0x5e0e61?0x0:_0x36ec9c[_0x8606('0x1d')];var _0x342769=_0x5e0e61?_0x29c5a0[_0x8606('0x20')]:_0x36ec9c[_0x8606('0x1d')]+_0x36ec9c[_0x8606('0x1f')];var _0x185aa8;if(_0x342769>=_0x202d81){_0x342769=_0x202d81;_0x185aa8=0xc8;}else{_0x185aa8=0xce;}_0x30b8ec[_0x8606('0x1a')](_0x185aa8);return _0x30b8ec[_0x8606('0x21')](_0x8606('0x22'),_0x591289+'-'+_0x342769+'/'+_0x202d81)[_0x8606('0x1c')](_0x29c5a0);}return null;};}function patchUpdates(_0x201967){return function(_0x2fc3a7){try{jsonpatch[_0x8606('0x23')](_0x2fc3a7,_0x201967,!![]);}catch(_0x525df3){return BPromise['reject'](_0x525df3);}return _0x2fc3a7[_0x8606('0x24')]();};}function saveUpdates(_0x2de457,_0x43140d){return function(_0x1b58f7){if(_0x1b58f7){return _0x1b58f7['update'](_0x2de457)[_0x8606('0x25')](function(_0x23a99e){return _0x23a99e;});}return null;};}function removeEntity(_0x3b67a5,_0x11ccce){return function(_0x3b6f0f){if(_0x3b6f0f){return _0x3b6f0f[_0x8606('0x26')]()['then'](function(){_0x3b67a5[_0x8606('0x1a')](0xcc)[_0x8606('0x1b')]();});}};}function handleEntityNotFound(_0x4ed637,_0xbe9bd0){return function(_0x1afe35){if(!_0x1afe35){_0x4ed637[_0x8606('0x19')](0x194);}return _0x1afe35;};}function handleError(_0x41c74f,_0x23c3ea){_0x23c3ea=_0x23c3ea||0x1f4;return function(_0xf1a955){logger[_0x8606('0x27')](_0xf1a955[_0x8606('0x28')]);if(_0xf1a955[_0x8606('0x29')]){delete _0xf1a955[_0x8606('0x29')];}_0x41c74f[_0x8606('0x1a')](_0x23c3ea)['send'](_0xf1a955);};}exports[_0x8606('0x2a')]=function(_0x1e917b,_0x33deb2){var _0x15f3e1={},_0x38298a={},_0x52f799={'count':0x0,'rows':[]};var _0x22079b=_[_0x8606('0x2b')](db[_0x8606('0x2c')][_0x8606('0x2d')],function(_0x4e1966){return{'name':_0x4e1966[_0x8606('0x2e')],'type':_0x4e1966['type'][_0x8606('0x2f')]};});_0x38298a['model']=_[_0x8606('0x2b')](_0x22079b,_0x8606('0x29'));_0x38298a[_0x8606('0x30')]=_[_0x8606('0x31')](_0x1e917b[_0x8606('0x30')]);_0x38298a[_0x8606('0x32')]=_[_0x8606('0x33')](_0x38298a[_0x8606('0x34')],_0x38298a[_0x8606('0x30')]);_0x15f3e1[_0x8606('0x35')]=_[_0x8606('0x33')](_0x38298a[_0x8606('0x34')],qs['fields'](_0x1e917b[_0x8606('0x30')][_0x8606('0x36')]));_0x15f3e1[_0x8606('0x35')]=_0x15f3e1[_0x8606('0x35')][_0x8606('0x37')]?_0x15f3e1[_0x8606('0x35')]:_0x38298a[_0x8606('0x34')];if(!_0x1e917b['query'][_0x8606('0x38')](_0x8606('0x39'))){_0x15f3e1[_0x8606('0x1f')]=qs[_0x8606('0x1f')](_0x1e917b[_0x8606('0x30')][_0x8606('0x1f')]);_0x15f3e1['offset']=qs[_0x8606('0x1d')](_0x1e917b[_0x8606('0x30')][_0x8606('0x1d')]);}_0x15f3e1[_0x8606('0x3a')]=qs[_0x8606('0x3b')](_0x1e917b[_0x8606('0x30')]['sort']);_0x15f3e1[_0x8606('0x3c')]=qs[_0x8606('0x32')](_[_0x8606('0x3d')](_0x1e917b[_0x8606('0x30')],_0x38298a[_0x8606('0x32')]),_0x22079b);if(_0x1e917b[_0x8606('0x30')]['filter']){_0x15f3e1[_0x8606('0x3c')]=_['merge'](_0x15f3e1[_0x8606('0x3c')],{'$or':_['map'](_0x22079b,function(_0x16972a){if(_0x16972a[_0x8606('0x3e')]!=='VIRTUAL'){var _0x5dc395={};_0x5dc395[_0x16972a[_0x8606('0x29')]]={'$like':'%'+_0x1e917b[_0x8606('0x30')][_0x8606('0x3f')]+'%'};return _0x5dc395;}})});}_0x15f3e1=_[_0x8606('0x40')]({},_0x15f3e1,_0x1e917b[_0x8606('0x41')]);var _0x2cb0f3={'where':_0x15f3e1[_0x8606('0x3c')]};return db[_0x8606('0x2c')][_0x8606('0x20')](_0x2cb0f3)[_0x8606('0x25')](function(_0x3563bd){_0x52f799[_0x8606('0x20')]=_0x3563bd;if(_0x1e917b['query'][_0x8606('0x42')]){_0x15f3e1[_0x8606('0x43')]=[{'all':!![]}];}return db[_0x8606('0x2c')][_0x8606('0x44')](_0x15f3e1);})[_0x8606('0x25')](function(_0x4f32ea){_0x52f799[_0x8606('0x45')]=_0x4f32ea;return _0x52f799;})[_0x8606('0x25')](respondWithFilteredResult(_0x33deb2,_0x15f3e1))[_0x8606('0x46')](handleError(_0x33deb2,null));};exports[_0x8606('0x47')]=function(_0x357236,_0x42f5f3){var _0x1fcfcc={'raw':![],'where':{'id':_0x357236[_0x8606('0x48')]['id']}},_0x5e64d2={};_0x5e64d2[_0x8606('0x34')]=_[_0x8606('0x31')](db[_0x8606('0x2c')][_0x8606('0x2d')]);_0x5e64d2[_0x8606('0x30')]=_[_0x8606('0x31')](_0x357236[_0x8606('0x30')]);_0x5e64d2[_0x8606('0x32')]=_['intersection'](_0x5e64d2[_0x8606('0x34')],_0x5e64d2[_0x8606('0x30')]);_0x1fcfcc[_0x8606('0x35')]=_['intersection'](_0x5e64d2[_0x8606('0x34')],qs[_0x8606('0x36')](_0x357236[_0x8606('0x30')][_0x8606('0x36')]));_0x1fcfcc['attributes']=_0x1fcfcc[_0x8606('0x35')][_0x8606('0x37')]?_0x1fcfcc[_0x8606('0x35')]:_0x5e64d2[_0x8606('0x34')];if(_0x357236[_0x8606('0x30')][_0x8606('0x42')]){_0x1fcfcc['include']=[{'all':!![]}];}_0x1fcfcc=_['merge']({},_0x1fcfcc,_0x357236[_0x8606('0x41')]);return db[_0x8606('0x2c')]['find'](_0x1fcfcc)['then'](handleEntityNotFound(_0x42f5f3,null))['then'](respondWithResult(_0x42f5f3,null))[_0x8606('0x46')](handleError(_0x42f5f3,null));};exports[_0x8606('0x49')]=function(_0x4986c1,_0x52e226){return db[_0x8606('0x2c')]['create'](_0x4986c1[_0x8606('0x4a')],{})[_0x8606('0x25')](respondWithResult(_0x52e226,0xc9))[_0x8606('0x46')](handleError(_0x52e226,null));};exports['update']=function(_0x7e0ec0,_0x7b06d3){if(_0x7e0ec0['body']['id']){delete _0x7e0ec0['body']['id'];}return db[_0x8606('0x2c')][_0x8606('0x4b')]({'where':{'id':_0x7e0ec0['params']['id']}})[_0x8606('0x25')](handleEntityNotFound(_0x7b06d3,null))['then'](saveUpdates(_0x7e0ec0[_0x8606('0x4a')],null))[_0x8606('0x25')](respondWithResult(_0x7b06d3,null))['catch'](handleError(_0x7b06d3,null));};exports[_0x8606('0x26')]=function(_0x58747f,_0x548689){return db[_0x8606('0x2c')][_0x8606('0x4b')]({'where':{'id':_0x58747f['params']['id']}})[_0x8606('0x25')](handleEntityNotFound(_0x548689,null))['then'](removeEntity(_0x548689,null))['catch'](handleError(_0x548689,null));};exports[_0x8606('0x4c')]=function(_0x58f6a8,_0x4928df,_0x52d9a9){var _0x5e239b={};var _0x21d473={};var _0x3df9cb;var _0x39b76e;return db['SugarcrmAccount'][_0x8606('0x4d')]({'where':{'id':_0x58f6a8[_0x8606('0x48')]['id']}})['then'](handleEntityNotFound(_0x4928df,null))[_0x8606('0x25')](function(_0x2dc936){if(_0x2dc936){_0x3df9cb=_0x2dc936;_0x21d473['model']=_[_0x8606('0x31')](db[_0x8606('0x4e')][_0x8606('0x2d')]);_0x21d473[_0x8606('0x30')]=_[_0x8606('0x31')](_0x58f6a8[_0x8606('0x30')]);_0x21d473[_0x8606('0x32')]=_[_0x8606('0x33')](_0x21d473[_0x8606('0x34')],_0x21d473[_0x8606('0x30')]);_0x5e239b[_0x8606('0x35')]=_[_0x8606('0x33')](_0x21d473[_0x8606('0x34')],qs[_0x8606('0x36')](_0x58f6a8[_0x8606('0x30')][_0x8606('0x36')]));_0x5e239b['attributes']=_0x5e239b['attributes'][_0x8606('0x37')]?_0x5e239b['attributes']:_0x21d473[_0x8606('0x34')];_0x5e239b[_0x8606('0x3a')]=qs[_0x8606('0x3b')](_0x58f6a8['query'][_0x8606('0x3b')]);_0x5e239b['where']=qs['filters'](_['pick'](_0x58f6a8['query'],_0x21d473[_0x8606('0x32')]));if(_0x58f6a8[_0x8606('0x30')]['filter']){_0x5e239b[_0x8606('0x3c')]=_['merge'](_0x5e239b[_0x8606('0x3c')],{'$or':_[_0x8606('0x2b')](_0x5e239b['attributes'],function(_0x190fe4){var _0x400ea6={};_0x400ea6[_0x190fe4]={'$like':'%'+_0x58f6a8['query']['filter']+'%'};return _0x400ea6;})});}_0x5e239b=_[_0x8606('0x40')]({},_0x5e239b,_0x58f6a8[_0x8606('0x41')]);return _0x3df9cb[_0x8606('0x4c')](_0x5e239b);}})[_0x8606('0x25')](function(_0x211706){if(_0x211706){_0x39b76e=_0x211706[_0x8606('0x37')];if(!_0x58f6a8[_0x8606('0x30')][_0x8606('0x38')](_0x8606('0x39'))){_0x5e239b['limit']=qs[_0x8606('0x1f')](_0x58f6a8[_0x8606('0x30')][_0x8606('0x1f')]);_0x5e239b[_0x8606('0x1d')]=qs[_0x8606('0x1d')](_0x58f6a8[_0x8606('0x30')][_0x8606('0x1d')]);}return _0x3df9cb[_0x8606('0x4c')](_0x5e239b);}})[_0x8606('0x25')](function(_0x1b8a4a){if(_0x1b8a4a){return _0x1b8a4a?{'count':_0x39b76e,'rows':_0x1b8a4a}:null;}})[_0x8606('0x25')](respondWithResult(_0x4928df,null))[_0x8606('0x46')](handleError(_0x4928df,null));};exports[_0x8606('0x4f')]=function(_0xdca2d3,_0x45340f,_0x41386b){if(_0xdca2d3['body']['id']){delete _0xdca2d3[_0x8606('0x4a')]['id'];}return db[_0x8606('0x2c')]['findOne']({'where':{'id':_0xdca2d3['params']['id']}})[_0x8606('0x25')](handleEntityNotFound(_0x45340f,null))[_0x8606('0x25')](function(_0x3fa164){if(_0x3fa164){_0xdca2d3['body'][_0x8606('0x50')]=_0x3fa164['id'];_0xdca2d3['body'][_0x8606('0x51')]=integrations[_0x8606('0x52')](_0xdca2d3[_0x8606('0x4a')]['channel'],_0xdca2d3[_0x8606('0x4a')][_0x8606('0x3e')]);_0xdca2d3['body'][_0x8606('0x53')]=integrations[_0x8606('0x54')](_0xdca2d3[_0x8606('0x4a')][_0x8606('0x55')],_0xdca2d3[_0x8606('0x4a')]['type']);return db[_0x8606('0x4e')][_0x8606('0x49')](_0xdca2d3[_0x8606('0x4a')],{'include':[{'model':db[_0x8606('0x56')],'as':_0x8606('0x51')},{'model':db['SugarcrmField'],'as':_0x8606('0x53')}]});}return null;})[_0x8606('0x25')](respondWithResult(_0x45340f,null))[_0x8606('0x46')](handleError(_0x45340f,null));};exports['getFields']=function(_0x4f9784,_0x4c7b06,_0x1c4c3f){var _0x40eef5='';var _0x4d55d0=['id',_0x8606('0x29'),_0x8606('0x57'),_0x8606('0x58'),_0x8606('0x59'),_0x8606('0x5a'),_0x8606('0x5b'),_0x8606('0x5c'),_0x8606('0x5d'),_0x8606('0x5e'),'parent_name',_0x8606('0x5f')];return db[_0x8606('0x2c')]['findOne']({'where':{'id':_0x4f9784[_0x8606('0x48')]['id']},'attributes':['id',_0x8606('0x60'),_0x8606('0x61'),'remoteUri']})[_0x8606('0x25')](handleEntityNotFound(_0x4c7b06,null))[_0x8606('0x25')](function(_0x511832){if(_0x511832){_0x40eef5=_0x511832[_0x8606('0x62')];var _0x1f3687=_0x40eef5['slice'](-0x1);if(_0x1f3687==='/'){_0x40eef5=_0x40eef5[_0x8606('0x63')](0x0,_0x40eef5[_0x8606('0x64')](_0x1f3687));}return rp({'method':_0x8606('0x65'),'uri':util[_0x8606('0x66')](_0x8606('0x67'),_0x40eef5,_0x8606('0x68')),'json':!![],'form':{'method':_0x8606('0x69'),'input_type':_0x8606('0x6a'),'response_type':'JSON','rest_data':JSON[_0x8606('0x6b')]({'user_auth':{'user_name':_0x511832['username'],'password':_0x511832[_0x8606('0x61')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x8606('0x25')](function(_0x52b46e){if(_0x52b46e&&_0x52b46e[_0x8606('0x29')]!=='Invalid\x20Login'&&_0x52b46e['name']!==_0x8606('0x6c')){return rp({'method':'POST','uri':util['format'](_0x8606('0x67'),_0x40eef5,_0x8606('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x8606('0x6a'),'response_type':'JSON','rest_data':JSON[_0x8606('0x6b')]({'session':_0x52b46e['id'],'module_name':_0x8606('0x6d')})}})[_0x8606('0x25')](function(_0x1d1eaa){if(_0x1d1eaa){var _0x1db59a=_['values'](_0x1d1eaa[_0x8606('0x6e')]);_[_0x8606('0x6f')](_0x1db59a,function(_0x5e4049){return _0x4d55d0[_0x8606('0x70')](_0x5e4049['name']);});return{'count':_0x1db59a['length'],'rows':_[_0x8606('0x2b')](_0x1db59a,function(_0x321cfa){return{'id':_0x321cfa['name'],'name':_0x321cfa['label'],'custom':_[_0x8606('0x71')](_0x321cfa['name'],'_c')?!![]:![],'options':_0x321cfa['options']?_[_0x8606('0x2b')](_['values'](_0x321cfa[_0x8606('0x41')]),function(_0xa3ec9b){return{'name':_0xa3ec9b[_0x8606('0x72')],'value':_0xa3ec9b[_0x8606('0x29')]};}):[]};})};}})[_0x8606('0x25')](respondWithResult(_0x4c7b06,null))[_0x8606('0x46')](function(_0x18059c){var _0x84fccf=_0x4f9784[_0x8606('0x30')][_0x8606('0x73')]?0x1f4:_0x18059c[_0x8606('0x74')]||0x1f4;logger['error'](_0x8606('0x75'),_0x8606('0x76'),_0x84fccf,JSON[_0x8606('0x6b')](_0x18059c));delete _0x18059c[_0x8606('0x29')];if(_0x84fccf===0x191){_0x84fccf=0x190;}_0x4c7b06['status'](_0x84fccf)['send'](_0x4f9784[_0x8606('0x30')]['test']?{'message':_0x8606('0x77'),'statusCode':_0x18059c[_0x8606('0x74')]}:_0x18059c);});}else{var _0x522681=0x1f4;_0x4c7b06['status'](_0x522681)[_0x8606('0x78')]({'message':_0x8606('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb9cd=['crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','getConfigurations','SugarcrmConfiguration','rawAttributes','length','order','nolimit','addConfiguration','findOne','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','stringify','values','module_fields','remove','label','endsWith','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x5558fb,_0xe6bb5e){var _0x11368d=function(_0x4f0cd6){while(--_0x4f0cd6){_0x5558fb['push'](_0x5558fb['shift']());}};_0x11368d(++_0xe6bb5e);}(_0xb9cd,0x158));var _0xdb9c=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb9cd[_0x1b5aea];return _0x15cfc6;};'use strict';var emlformat=require(_0xdb9c('0x0'));var rimraf=require(_0xdb9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb9c('0x2'));var rp=require(_0xdb9c('0x3'));var moment=require(_0xdb9c('0x4'));var BPromise=require(_0xdb9c('0x5'));var Mustache=require(_0xdb9c('0x6'));var util=require(_0xdb9c('0x7'));var path=require('path');var sox=require(_0xdb9c('0x8'));var csv=require(_0xdb9c('0x9'));var ejs=require(_0xdb9c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb9c('0xb'));var squel=require(_0xdb9c('0xc'));var crypto=require(_0xdb9c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdb9c('0x9'));var querystring=require('querystring');var Papa=require(_0xdb9c('0xe'));var Redis=require(_0xdb9c('0xf'));var authService=require(_0xdb9c('0x10'));var qs=require(_0xdb9c('0x11'));var as=require(_0xdb9c('0x12'));var hardwareService=require(_0xdb9c('0x13'));var logger=require(_0xdb9c('0x14'))(_0xdb9c('0x15'));var utils=require(_0xdb9c('0x16'));var config=require(_0xdb9c('0x17'));var licenseUtil=require(_0xdb9c('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x382f6b,_0x3fc11e){_0x3fc11e=_0x3fc11e||0xcc;return function(_0x3dc78f){if(_0x3dc78f){return _0x382f6b[_0xdb9c('0x19')](_0x3fc11e);}return _0x382f6b['status'](_0x3fc11e)[_0xdb9c('0x1a')]();};}function respondWithResult(_0x120a45,_0x10ed90){_0x10ed90=_0x10ed90||0xc8;return function(_0x9d8a20){if(_0x9d8a20){return _0x120a45[_0xdb9c('0x1b')](_0x10ed90)[_0xdb9c('0x1c')](_0x9d8a20);}};}function respondWithFilteredResult(_0x113c16,_0x16546f){return function(_0x3e952d){if(_0x3e952d){var _0x1c45d2=typeof _0x16546f[_0xdb9c('0x1d')]===_0xdb9c('0x1e')&&typeof _0x16546f[_0xdb9c('0x1f')]===_0xdb9c('0x1e');var _0x4d5562=_0x3e952d[_0xdb9c('0x20')];var _0x20b5d9=_0x1c45d2?0x0:_0x16546f[_0xdb9c('0x1d')];var _0x3a2369=_0x1c45d2?_0x3e952d['count']:_0x16546f['offset']+_0x16546f[_0xdb9c('0x1f')];var _0x5a0165;if(_0x3a2369>=_0x4d5562){_0x3a2369=_0x4d5562;_0x5a0165=0xc8;}else{_0x5a0165=0xce;}_0x113c16[_0xdb9c('0x1b')](_0x5a0165);return _0x113c16[_0xdb9c('0x21')](_0xdb9c('0x22'),_0x20b5d9+'-'+_0x3a2369+'/'+_0x4d5562)[_0xdb9c('0x1c')](_0x3e952d);}return null;};}function patchUpdates(_0x2d2223){return function(_0x25b0e2){try{jsonpatch[_0xdb9c('0x23')](_0x25b0e2,_0x2d2223,!![]);}catch(_0x746ee6){return BPromise['reject'](_0x746ee6);}return _0x25b0e2[_0xdb9c('0x24')]();};}function saveUpdates(_0x278f32,_0x4e7065){return function(_0x313666){if(_0x313666){return _0x313666['update'](_0x278f32)[_0xdb9c('0x25')](function(_0x4577cb){return _0x4577cb;});}return null;};}function removeEntity(_0x136ad9,_0x54197d){return function(_0x33ce8c){if(_0x33ce8c){return _0x33ce8c[_0xdb9c('0x26')]()['then'](function(){_0x136ad9[_0xdb9c('0x1b')](0xcc)[_0xdb9c('0x1a')]();});}};}function handleEntityNotFound(_0x4d71e2,_0x570d25){return function(_0x48e526){if(!_0x48e526){_0x4d71e2[_0xdb9c('0x19')](0x194);}return _0x48e526;};}function handleError(_0x3c2d2d,_0x36d089){_0x36d089=_0x36d089||0x1f4;return function(_0x287cfe){logger[_0xdb9c('0x27')](_0x287cfe[_0xdb9c('0x28')]);if(_0x287cfe[_0xdb9c('0x29')]){delete _0x287cfe['name'];}_0x3c2d2d[_0xdb9c('0x1b')](_0x36d089)[_0xdb9c('0x2a')](_0x287cfe);};}exports[_0xdb9c('0x2b')]=function(_0x6a7df9,_0x1d420c){var _0x13ac10={},_0x48fc2f={},_0x126fd6={'count':0x0,'rows':[]};var _0x13482c=_[_0xdb9c('0x2c')](db[_0xdb9c('0x2d')]['rawAttributes'],function(_0x42b153){return{'name':_0x42b153[_0xdb9c('0x2e')],'type':_0x42b153['type'][_0xdb9c('0x2f')]};});_0x48fc2f[_0xdb9c('0x30')]=_[_0xdb9c('0x2c')](_0x13482c,_0xdb9c('0x29'));_0x48fc2f[_0xdb9c('0x31')]=_[_0xdb9c('0x32')](_0x6a7df9[_0xdb9c('0x31')]);_0x48fc2f[_0xdb9c('0x33')]=_[_0xdb9c('0x34')](_0x48fc2f['model'],_0x48fc2f[_0xdb9c('0x31')]);_0x13ac10[_0xdb9c('0x35')]=_[_0xdb9c('0x34')](_0x48fc2f['model'],qs[_0xdb9c('0x36')](_0x6a7df9[_0xdb9c('0x31')][_0xdb9c('0x36')]));_0x13ac10[_0xdb9c('0x35')]=_0x13ac10[_0xdb9c('0x35')]['length']?_0x13ac10[_0xdb9c('0x35')]:_0x48fc2f['model'];if(!_0x6a7df9[_0xdb9c('0x31')][_0xdb9c('0x37')]('nolimit')){_0x13ac10[_0xdb9c('0x1f')]=qs[_0xdb9c('0x1f')](_0x6a7df9[_0xdb9c('0x31')][_0xdb9c('0x1f')]);_0x13ac10['offset']=qs[_0xdb9c('0x1d')](_0x6a7df9[_0xdb9c('0x31')]['offset']);}_0x13ac10['order']=qs['sort'](_0x6a7df9[_0xdb9c('0x31')][_0xdb9c('0x38')]);_0x13ac10[_0xdb9c('0x39')]=qs[_0xdb9c('0x33')](_[_0xdb9c('0x3a')](_0x6a7df9[_0xdb9c('0x31')],_0x48fc2f[_0xdb9c('0x33')]),_0x13482c);if(_0x6a7df9[_0xdb9c('0x31')][_0xdb9c('0x3b')]){_0x13ac10[_0xdb9c('0x39')]=_[_0xdb9c('0x3c')](_0x13ac10[_0xdb9c('0x39')],{'$or':_[_0xdb9c('0x2c')](_0x13482c,function(_0xe25b47){if(_0xe25b47['type']!=='VIRTUAL'){var _0x583682={};_0x583682[_0xe25b47['name']]={'$like':'%'+_0x6a7df9[_0xdb9c('0x31')][_0xdb9c('0x3b')]+'%'};return _0x583682;}})});}_0x13ac10=_['merge']({},_0x13ac10,_0x6a7df9['options']);var _0x1ed994={'where':_0x13ac10[_0xdb9c('0x39')]};return db[_0xdb9c('0x2d')][_0xdb9c('0x20')](_0x1ed994)['then'](function(_0x50e167){_0x126fd6['count']=_0x50e167;if(_0x6a7df9['query'][_0xdb9c('0x3d')]){_0x13ac10[_0xdb9c('0x3e')]=[{'all':!![]}];}return db[_0xdb9c('0x2d')][_0xdb9c('0x3f')](_0x13ac10);})[_0xdb9c('0x25')](function(_0x8a7191){_0x126fd6[_0xdb9c('0x40')]=_0x8a7191;return _0x126fd6;})[_0xdb9c('0x25')](respondWithFilteredResult(_0x1d420c,_0x13ac10))[_0xdb9c('0x41')](handleError(_0x1d420c,null));};exports['show']=function(_0x2164dc,_0x5e93d2){var _0x5aad20={'raw':![],'where':{'id':_0x2164dc[_0xdb9c('0x42')]['id']}},_0x38beb2={};_0x38beb2['model']=_['keys'](db[_0xdb9c('0x2d')]['rawAttributes']);_0x38beb2[_0xdb9c('0x31')]=_['keys'](_0x2164dc[_0xdb9c('0x31')]);_0x38beb2[_0xdb9c('0x33')]=_[_0xdb9c('0x34')](_0x38beb2['model'],_0x38beb2[_0xdb9c('0x31')]);_0x5aad20[_0xdb9c('0x35')]=_[_0xdb9c('0x34')](_0x38beb2[_0xdb9c('0x30')],qs[_0xdb9c('0x36')](_0x2164dc['query'][_0xdb9c('0x36')]));_0x5aad20[_0xdb9c('0x35')]=_0x5aad20['attributes']['length']?_0x5aad20[_0xdb9c('0x35')]:_0x38beb2[_0xdb9c('0x30')];if(_0x2164dc[_0xdb9c('0x31')][_0xdb9c('0x3d')]){_0x5aad20[_0xdb9c('0x3e')]=[{'all':!![]}];}_0x5aad20=_[_0xdb9c('0x3c')]({},_0x5aad20,_0x2164dc[_0xdb9c('0x43')]);return db['SugarcrmAccount'][_0xdb9c('0x44')](_0x5aad20)['then'](handleEntityNotFound(_0x5e93d2,null))['then'](respondWithResult(_0x5e93d2,null))[_0xdb9c('0x41')](handleError(_0x5e93d2,null));};exports[_0xdb9c('0x45')]=function(_0x20bdf6,_0x7a034a){return db[_0xdb9c('0x2d')][_0xdb9c('0x45')](_0x20bdf6[_0xdb9c('0x46')],{})[_0xdb9c('0x25')](respondWithResult(_0x7a034a,0xc9))['catch'](handleError(_0x7a034a,null));};exports[_0xdb9c('0x47')]=function(_0x3be84c,_0x241456){if(_0x3be84c[_0xdb9c('0x46')]['id']){delete _0x3be84c['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x3be84c['params']['id']}})[_0xdb9c('0x25')](handleEntityNotFound(_0x241456,null))[_0xdb9c('0x25')](saveUpdates(_0x3be84c[_0xdb9c('0x46')],null))[_0xdb9c('0x25')](respondWithResult(_0x241456,null))[_0xdb9c('0x41')](handleError(_0x241456,null));};exports[_0xdb9c('0x26')]=function(_0x5c41d3,_0x50da4f){return db[_0xdb9c('0x2d')][_0xdb9c('0x44')]({'where':{'id':_0x5c41d3[_0xdb9c('0x42')]['id']}})[_0xdb9c('0x25')](handleEntityNotFound(_0x50da4f,null))[_0xdb9c('0x25')](removeEntity(_0x50da4f,null))['catch'](handleError(_0x50da4f,null));};exports[_0xdb9c('0x48')]=function(_0x16d8b8,_0x5b2514,_0x72fb4e){var _0x2c4e1a={};var _0x42fa8b={};var _0x111789;var _0x294d0d;return db[_0xdb9c('0x2d')]['findOne']({'where':{'id':_0x16d8b8[_0xdb9c('0x42')]['id']}})[_0xdb9c('0x25')](handleEntityNotFound(_0x5b2514,null))[_0xdb9c('0x25')](function(_0x4e553f){if(_0x4e553f){_0x111789=_0x4e553f;_0x42fa8b['model']=_[_0xdb9c('0x32')](db[_0xdb9c('0x49')][_0xdb9c('0x4a')]);_0x42fa8b['query']=_[_0xdb9c('0x32')](_0x16d8b8[_0xdb9c('0x31')]);_0x42fa8b[_0xdb9c('0x33')]=_['intersection'](_0x42fa8b[_0xdb9c('0x30')],_0x42fa8b[_0xdb9c('0x31')]);_0x2c4e1a[_0xdb9c('0x35')]=_[_0xdb9c('0x34')](_0x42fa8b[_0xdb9c('0x30')],qs['fields'](_0x16d8b8[_0xdb9c('0x31')][_0xdb9c('0x36')]));_0x2c4e1a[_0xdb9c('0x35')]=_0x2c4e1a[_0xdb9c('0x35')][_0xdb9c('0x4b')]?_0x2c4e1a['attributes']:_0x42fa8b[_0xdb9c('0x30')];_0x2c4e1a[_0xdb9c('0x4c')]=qs[_0xdb9c('0x38')](_0x16d8b8['query'][_0xdb9c('0x38')]);_0x2c4e1a['where']=qs[_0xdb9c('0x33')](_[_0xdb9c('0x3a')](_0x16d8b8[_0xdb9c('0x31')],_0x42fa8b[_0xdb9c('0x33')]));if(_0x16d8b8[_0xdb9c('0x31')][_0xdb9c('0x3b')]){_0x2c4e1a['where']=_[_0xdb9c('0x3c')](_0x2c4e1a[_0xdb9c('0x39')],{'$or':_[_0xdb9c('0x2c')](_0x2c4e1a[_0xdb9c('0x35')],function(_0x5ae637){var _0x1ffcac={};_0x1ffcac[_0x5ae637]={'$like':'%'+_0x16d8b8[_0xdb9c('0x31')][_0xdb9c('0x3b')]+'%'};return _0x1ffcac;})});}_0x2c4e1a=_[_0xdb9c('0x3c')]({},_0x2c4e1a,_0x16d8b8['options']);return _0x111789[_0xdb9c('0x48')](_0x2c4e1a);}})[_0xdb9c('0x25')](function(_0x190dbd){if(_0x190dbd){_0x294d0d=_0x190dbd[_0xdb9c('0x4b')];if(!_0x16d8b8[_0xdb9c('0x31')]['hasOwnProperty'](_0xdb9c('0x4d'))){_0x2c4e1a['limit']=qs[_0xdb9c('0x1f')](_0x16d8b8[_0xdb9c('0x31')][_0xdb9c('0x1f')]);_0x2c4e1a[_0xdb9c('0x1d')]=qs[_0xdb9c('0x1d')](_0x16d8b8[_0xdb9c('0x31')]['offset']);}return _0x111789[_0xdb9c('0x48')](_0x2c4e1a);}})['then'](function(_0x6c9eac){if(_0x6c9eac){return _0x6c9eac?{'count':_0x294d0d,'rows':_0x6c9eac}:null;}})[_0xdb9c('0x25')](respondWithResult(_0x5b2514,null))['catch'](handleError(_0x5b2514,null));};exports[_0xdb9c('0x4e')]=function(_0x5938db,_0x479620,_0x23c038){if(_0x5938db[_0xdb9c('0x46')]['id']){delete _0x5938db[_0xdb9c('0x46')]['id'];}return db[_0xdb9c('0x2d')][_0xdb9c('0x4f')]({'where':{'id':_0x5938db[_0xdb9c('0x42')]['id']}})[_0xdb9c('0x25')](handleEntityNotFound(_0x479620,null))[_0xdb9c('0x25')](function(_0x2d1339){if(_0x2d1339){_0x5938db[_0xdb9c('0x46')]['AccountId']=_0x2d1339['id'];_0x5938db[_0xdb9c('0x46')][_0xdb9c('0x50')]=integrations[_0xdb9c('0x51')](_0x5938db[_0xdb9c('0x46')][_0xdb9c('0x52')],_0x5938db[_0xdb9c('0x46')][_0xdb9c('0x53')]);_0x5938db['body'][_0xdb9c('0x54')]=integrations[_0xdb9c('0x55')](_0x5938db[_0xdb9c('0x46')][_0xdb9c('0x52')],_0x5938db[_0xdb9c('0x46')][_0xdb9c('0x53')]);return db[_0xdb9c('0x49')][_0xdb9c('0x45')](_0x5938db[_0xdb9c('0x46')],{'include':[{'model':db[_0xdb9c('0x56')],'as':_0xdb9c('0x50')},{'model':db[_0xdb9c('0x56')],'as':_0xdb9c('0x54')}]});}return null;})['then'](respondWithResult(_0x479620,null))[_0xdb9c('0x41')](handleError(_0x479620,null));};exports[_0xdb9c('0x57')]=function(_0xcc7947,_0x33d672,_0x3da92e){var _0x52a363='';var _0x4db20f=['id',_0xdb9c('0x29'),_0xdb9c('0x58'),_0xdb9c('0x59'),_0xdb9c('0x5a'),_0xdb9c('0x5b'),'duration_hours','duration_minutes',_0xdb9c('0x5c'),_0xdb9c('0x5d'),_0xdb9c('0x5e'),_0xdb9c('0x5f')];return db[_0xdb9c('0x2d')][_0xdb9c('0x4f')]({'where':{'id':_0xcc7947[_0xdb9c('0x42')]['id']},'attributes':['id',_0xdb9c('0x60'),_0xdb9c('0x61'),_0xdb9c('0x62')]})[_0xdb9c('0x25')](handleEntityNotFound(_0x33d672,null))['then'](function(_0x191952){if(_0x191952){_0x52a363=_0x191952['remoteUri'];var _0x2f0e49=_0x52a363['slice'](-0x1);if(_0x2f0e49==='/'){_0x52a363=_0x52a363['substring'](0x0,_0x52a363[_0xdb9c('0x63')](_0x2f0e49));}return rp({'method':_0xdb9c('0x64'),'uri':util[_0xdb9c('0x65')]('%s%s',_0x52a363,_0xdb9c('0x66')),'json':!![],'form':{'method':'login','input_type':_0xdb9c('0x67'),'response_type':_0xdb9c('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x191952[_0xdb9c('0x60')],'password':_0x191952[_0xdb9c('0x61')],'encryption':_0xdb9c('0x68')},'application':_0xdb9c('0x69')})}});}})[_0xdb9c('0x25')](function(_0x233e85){if(_0x233e85&&_0x233e85[_0xdb9c('0x29')]!==_0xdb9c('0x6a')&&_0x233e85[_0xdb9c('0x29')]!==_0xdb9c('0x6b')){return rp({'method':'POST','uri':util[_0xdb9c('0x65')](_0xdb9c('0x6c'),_0x52a363,_0xdb9c('0x66')),'json':!![],'form':{'method':_0xdb9c('0x6d'),'input_type':'JSON','response_type':_0xdb9c('0x67'),'rest_data':JSON[_0xdb9c('0x6e')]({'session':_0x233e85['id'],'module_name':'Calls'})}})[_0xdb9c('0x25')](function(_0x385d29){if(_0x385d29){var _0x201437=_[_0xdb9c('0x6f')](_0x385d29[_0xdb9c('0x70')]);_[_0xdb9c('0x71')](_0x201437,function(_0x5b86ca){return _0x4db20f['includes'](_0x5b86ca[_0xdb9c('0x29')]);});return{'count':_0x201437[_0xdb9c('0x4b')],'rows':_[_0xdb9c('0x2c')](_0x201437,function(_0x50c805){return{'id':_0x50c805[_0xdb9c('0x29')],'name':_0x50c805[_0xdb9c('0x72')],'custom':_[_0xdb9c('0x73')](_0x50c805[_0xdb9c('0x29')],'_c')?!![]:![],'options':_0x50c805[_0xdb9c('0x43')]?_[_0xdb9c('0x2c')](_['values'](_0x50c805[_0xdb9c('0x43')]),function(_0x43256b){return{'name':_0x43256b['value'],'value':_0x43256b[_0xdb9c('0x29')]};}):[]};})};}})[_0xdb9c('0x25')](respondWithResult(_0x33d672,null))[_0xdb9c('0x41')](function(_0x2a98fa){var _0x2141cb=_0xcc7947[_0xdb9c('0x31')]['test']?0x1f4:_0x2a98fa['statusCode']||0x1f4;logger[_0xdb9c('0x27')](_0xdb9c('0x74'),'getFields',_0x2141cb,JSON[_0xdb9c('0x6e')](_0x2a98fa));delete _0x2a98fa['name'];if(_0x2141cb===0x191){_0x2141cb=0x190;}_0x33d672[_0xdb9c('0x1b')](_0x2141cb)[_0xdb9c('0x2a')](_0xcc7947['query']['test']?{'message':_0xdb9c('0x75'),'statusCode':_0x2a98fa[_0xdb9c('0x76')]}:_0x2a98fa);});}else{var _0x56a653=0x1f4;_0x33d672[_0xdb9c('0x1b')](_0x56a653)[_0xdb9c('0x2a')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 0bad799..5909822 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 _0xf215=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','lodash','util','api','moment','bluebird','path'];(function(_0x284edd,_0x44cdb0){var _0x508ed8=function(_0x128b2c){while(--_0x128b2c){_0x284edd['push'](_0x284edd['shift']());}};_0x508ed8(++_0x44cdb0);}(_0xf215,0xec));var _0x5f21=function(_0x297238,_0x329f87){_0x297238=_0x297238-0x0;var _0xb3d177=_0xf215[_0x297238];return _0xb3d177;};'use strict';var _=require(_0x5f21('0x0'));var util=require(_0x5f21('0x1'));var logger=require('../../config/logger')(_0x5f21('0x2'));var moment=require(_0x5f21('0x3'));var BPromise=require(_0x5f21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f21('0x5'));var rimraf=require(_0x5f21('0x6'));var config=require(_0x5f21('0x7'));var attributes=require(_0x5f21('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x68b2bd,_0x76a890){return _0x68b2bd[_0x5f21('0x9')](_0x5f21('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5a2=['int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x4ee335,_0x7d8bc7){var _0x1fa8d1=function(_0x52e831){while(--_0x52e831){_0x4ee335['push'](_0x4ee335['shift']());}};_0x1fa8d1(++_0x7d8bc7);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x26f444,_0x30fcfa){_0x26f444=_0x26f444-0x0;var _0x3d2734=_0xd5a2[_0x26f444];return _0x3d2734;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var logger=require(_0x2d5a('0x1'))(_0x2d5a('0x2'));var moment=require(_0x2d5a('0x3'));var BPromise=require(_0x2d5a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d5a('0x5'));var rimraf=require(_0x2d5a('0x6'));var config=require(_0x2d5a('0x7'));var attributes=require(_0x2d5a('0x8'));var integrations=require(_0x2d5a('0x9'));module[_0x2d5a('0xa')]=function(_0x923c29,_0x1ae103){return _0x923c29[_0x2d5a('0xb')](_0x2d5a('0xc'),attributes,{'tableName':_0x2d5a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 8deaa1f..c5f7fcc 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 _0x9957=['map','model','ShowSugarcrmAccount','where','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','include'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9957,0xa9));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7995('0x2'));var fs=require('fs');var Redis=require(_0x7995('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var config=require(_0x7995('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7995('0x7')][_0x7995('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454766,_0x48671c,_0x467e37){return new BPromise(function(_0x4b6943,_0x1a530e){return client[_0x7995('0x9')](_0x454766,_0x467e37)[_0x7995('0xa')](function(_0x21008c){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x48671c,_0x7995('0xb'));logger[_0x7995('0xc')](_0x7995('0xd'),_0x48671c,_0x7995('0xb'),JSON[_0x7995('0xe')](_0x21008c));if(_0x21008c[_0x7995('0xf')]){if(_0x21008c['error'][_0x7995('0x10')]===0x1f4){logger[_0x7995('0xf')](_0x7995('0x11'),_0x48671c,_0x21008c[_0x7995('0xf')][_0x7995('0x12')]);return _0x1a530e(_0x21008c[_0x7995('0xf')]['message']);}logger[_0x7995('0xf')](_0x7995('0x11'),_0x48671c,_0x21008c[_0x7995('0xf')][_0x7995('0x12')]);return _0x4b6943(_0x21008c['error'][_0x7995('0x12')]);}else{logger[_0x7995('0x13')](_0x7995('0x11'),_0x48671c,_0x7995('0xb'));_0x4b6943(_0x21008c[_0x7995('0x14')]['message']);}})[_0x7995('0x15')](function(_0x40b45e){logger[_0x7995('0xf')](_0x7995('0x11'),_0x48671c,_0x40b45e);_0x1a530e(_0x40b45e);});});}exports[_0x7995('0x16')]=function(_0x53024b){var _0x16d8d1=this;return new Promise(function(_0x5a9930,_0x4e9103){return db[_0x7995('0x17')][_0x7995('0x18')]({'raw':_0x53024b[_0x7995('0x19')]?_0x53024b[_0x7995('0x19')][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x53024b[_0x7995('0x19')]?_0x53024b['options']['where']||null:null,'attributes':_0x53024b[_0x7995('0x19')]?_0x53024b[_0x7995('0x19')][_0x7995('0x1b')]||null:null,'limit':_0x53024b[_0x7995('0x19')]?_0x53024b[_0x7995('0x19')]['limit']||null:null,'include':_0x53024b['options']?_0x53024b[_0x7995('0x19')][_0x7995('0x1c')]?_[_0x7995('0x1d')](_0x53024b[_0x7995('0x19')][_0x7995('0x1c')],function(_0x3a1d00){return{'model':db[_0x3a1d00[_0x7995('0x1e')]],'as':_0x3a1d00['as'],'attributes':_0x3a1d00['attributes'],'include':_0x3a1d00[_0x7995('0x1c')]?_['map'](_0x3a1d00[_0x7995('0x1c')],function(_0x27edd7){return{'model':db[_0x27edd7[_0x7995('0x1e')]],'as':_0x27edd7['as'],'attributes':_0x27edd7[_0x7995('0x1b')],'include':_0x27edd7['include']?_[_0x7995('0x1d')](_0x27edd7[_0x7995('0x1c')],function(_0x6f8f63){return{'model':db[_0x6f8f63[_0x7995('0x1e')]],'as':_0x6f8f63['as'],'attributes':_0x6f8f63['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xa')](function(_0x4d8019){logger[_0x7995('0x13')](_0x7995('0x16'),_0x53024b);logger[_0x7995('0xc')](_0x7995('0x16'),_0x53024b,JSON['stringify'](_0x4d8019));_0x5a9930(_0x4d8019);})['catch'](function(_0x23d46c){logger[_0x7995('0xf')](_0x7995('0x16'),_0x23d46c['message'],_0x53024b);_0x4e9103(_0x16d8d1[_0x7995('0xf')](0x1f4,_0x23d46c[_0x7995('0x12')]));});});};exports[_0x7995('0x1f')]=function(_0x589f73){var _0x10b3f1=this;return new Promise(function(_0x15c2e5,_0x1f7323){return db['SugarcrmAccount']['find']({'raw':_0x589f73['options']?_0x589f73[_0x7995('0x19')][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x589f73[_0x7995('0x19')]?_0x589f73[_0x7995('0x19')][_0x7995('0x20')]||null:null,'attributes':_0x589f73[_0x7995('0x19')]?_0x589f73['options'][_0x7995('0x1b')]||null:null,'include':_0x589f73[_0x7995('0x19')]?_0x589f73[_0x7995('0x19')][_0x7995('0x1c')]?_[_0x7995('0x1d')](_0x589f73[_0x7995('0x19')]['include'],function(_0x95e738){return{'model':db[_0x95e738[_0x7995('0x1e')]],'as':_0x95e738['as'],'attributes':_0x95e738['attributes'],'include':_0x95e738[_0x7995('0x1c')]?_[_0x7995('0x1d')](_0x95e738[_0x7995('0x1c')],function(_0x532fca){return{'model':db[_0x532fca[_0x7995('0x1e')]],'as':_0x532fca['as'],'attributes':_0x532fca[_0x7995('0x1b')],'include':_0x532fca[_0x7995('0x1c')]?_[_0x7995('0x1d')](_0x532fca[_0x7995('0x1c')],function(_0x4f2203){return{'model':db[_0x4f2203['model']],'as':_0x4f2203['as'],'attributes':_0x4f2203['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xa')](function(_0x2b7092){logger[_0x7995('0x13')](_0x7995('0x1f'),_0x589f73);logger['debug']('ShowSugarcrmAccount',_0x589f73,JSON[_0x7995('0xe')](_0x2b7092));_0x15c2e5(_0x2b7092);})[_0x7995('0x15')](function(_0x2294f4){logger[_0x7995('0xf')]('ShowSugarcrmAccount',_0x2294f4['message'],_0x589f73);_0x1f7323(_0x10b3f1[_0x7995('0xf')](0x1f4,_0x2294f4['message']));});});}; \ No newline at end of file +var _0xaebf=['options','raw','attributes','limit','include','model','map','find','where','ShowSugarcrmAccount','lodash','moment','randomstring','ioredis','../../config/utils','rpc','http','request','then','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x3ae805,_0x31d23e){var _0x4c54b9=function(_0x2771e1){while(--_0x2771e1){_0x3ae805['push'](_0x3ae805['shift']());}};_0x4c54b9(++_0x31d23e);}(_0xaebf,0xa5));var _0xfaeb=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xaebf[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfaeb('0x0'));var util=require('util');var moment=require(_0xfaeb('0x1'));var BPromise=require('bluebird');var rs=require(_0xfaeb('0x2'));var fs=require('fs');var Redis=require(_0xfaeb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfaeb('0x4'));var logger=require('../../config/logger')(_0xfaeb('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfaeb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x59c0df,_0x4fe2db,_0x4338ea){return new BPromise(function(_0x5a4d91,_0x54e022){return client[_0xfaeb('0x7')](_0x59c0df,_0x4338ea)[_0xfaeb('0x8')](function(_0x248cad){logger[_0xfaeb('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x4fe2db,'request\x20sent');logger[_0xfaeb('0xa')](_0xfaeb('0xb'),_0x4fe2db,_0xfaeb('0xc'),JSON[_0xfaeb('0xd')](_0x248cad));if(_0x248cad['error']){if(_0x248cad[_0xfaeb('0xe')][_0xfaeb('0xf')]===0x1f4){logger[_0xfaeb('0xe')](_0xfaeb('0x10'),_0x4fe2db,_0x248cad[_0xfaeb('0xe')][_0xfaeb('0x11')]);return _0x54e022(_0x248cad[_0xfaeb('0xe')][_0xfaeb('0x11')]);}logger[_0xfaeb('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x4fe2db,_0x248cad[_0xfaeb('0xe')][_0xfaeb('0x11')]);return _0x5a4d91(_0x248cad['error'][_0xfaeb('0x11')]);}else{logger[_0xfaeb('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x4fe2db,'request\x20sent');_0x5a4d91(_0x248cad['result']['message']);}})[_0xfaeb('0x12')](function(_0x477f54){logger[_0xfaeb('0xe')](_0xfaeb('0x10'),_0x4fe2db,_0x477f54);_0x54e022(_0x477f54);});});}exports[_0xfaeb('0x13')]=function(_0xac0453){var _0x3d4a65=this;return new Promise(function(_0x23eefa,_0x350b64){return db[_0xfaeb('0x14')]['findAll']({'raw':_0xac0453[_0xfaeb('0x15')]?_0xac0453[_0xfaeb('0x15')][_0xfaeb('0x16')]===undefined?!![]:![]:!![],'where':_0xac0453[_0xfaeb('0x15')]?_0xac0453[_0xfaeb('0x15')]['where']||null:null,'attributes':_0xac0453[_0xfaeb('0x15')]?_0xac0453[_0xfaeb('0x15')][_0xfaeb('0x17')]||null:null,'limit':_0xac0453[_0xfaeb('0x15')]?_0xac0453['options'][_0xfaeb('0x18')]||null:null,'include':_0xac0453[_0xfaeb('0x15')]?_0xac0453[_0xfaeb('0x15')][_0xfaeb('0x19')]?_['map'](_0xac0453['options']['include'],function(_0x2374a9){return{'model':db[_0x2374a9[_0xfaeb('0x1a')]],'as':_0x2374a9['as'],'attributes':_0x2374a9[_0xfaeb('0x17')],'include':_0x2374a9['include']?_[_0xfaeb('0x1b')](_0x2374a9[_0xfaeb('0x19')],function(_0x450f99){return{'model':db[_0x450f99[_0xfaeb('0x1a')]],'as':_0x450f99['as'],'attributes':_0x450f99[_0xfaeb('0x17')],'include':_0x450f99['include']?_[_0xfaeb('0x1b')](_0x450f99[_0xfaeb('0x19')],function(_0x308e07){return{'model':db[_0x308e07['model']],'as':_0x308e07['as'],'attributes':_0x308e07[_0xfaeb('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfaeb('0x8')](function(_0x291960){logger[_0xfaeb('0x9')](_0xfaeb('0x13'),_0xac0453);logger[_0xfaeb('0xa')]('GetSugarcrmAccount',_0xac0453,JSON['stringify'](_0x291960));_0x23eefa(_0x291960);})[_0xfaeb('0x12')](function(_0x310b23){logger[_0xfaeb('0xe')](_0xfaeb('0x13'),_0x310b23['message'],_0xac0453);_0x350b64(_0x3d4a65['error'](0x1f4,_0x310b23['message']));});});};exports['ShowSugarcrmAccount']=function(_0x10680c){var _0x48721d=this;return new Promise(function(_0x296b87,_0x5ade50){return db[_0xfaeb('0x14')][_0xfaeb('0x1c')]({'raw':_0x10680c[_0xfaeb('0x15')]?_0x10680c[_0xfaeb('0x15')][_0xfaeb('0x16')]===undefined?!![]:![]:!![],'where':_0x10680c[_0xfaeb('0x15')]?_0x10680c['options'][_0xfaeb('0x1d')]||null:null,'attributes':_0x10680c[_0xfaeb('0x15')]?_0x10680c['options'][_0xfaeb('0x17')]||null:null,'include':_0x10680c[_0xfaeb('0x15')]?_0x10680c[_0xfaeb('0x15')]['include']?_['map'](_0x10680c['options'][_0xfaeb('0x19')],function(_0x3bd679){return{'model':db[_0x3bd679['model']],'as':_0x3bd679['as'],'attributes':_0x3bd679[_0xfaeb('0x17')],'include':_0x3bd679['include']?_[_0xfaeb('0x1b')](_0x3bd679[_0xfaeb('0x19')],function(_0x3e4d15){return{'model':db[_0x3e4d15[_0xfaeb('0x1a')]],'as':_0x3e4d15['as'],'attributes':_0x3e4d15[_0xfaeb('0x17')],'include':_0x3e4d15[_0xfaeb('0x19')]?_[_0xfaeb('0x1b')](_0x3e4d15[_0xfaeb('0x19')],function(_0x32c3a9){return{'model':db[_0x32c3a9[_0xfaeb('0x1a')]],'as':_0x32c3a9['as'],'attributes':_0x32c3a9[_0xfaeb('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfaeb('0x8')](function(_0x13af8e){logger[_0xfaeb('0x9')](_0xfaeb('0x1e'),_0x10680c);logger[_0xfaeb('0xa')](_0xfaeb('0x1e'),_0x10680c,JSON[_0xfaeb('0xd')](_0x13af8e));_0x296b87(_0x13af8e);})[_0xfaeb('0x12')](function(_0x297c15){logger[_0xfaeb('0xe')]('ShowSugarcrmAccount',_0x297c15[_0xfaeb('0x11')],_0x10680c);_0x5ade50(_0x48721d[_0xfaeb('0xe')](0x1f4,_0x297c15[_0xfaeb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c7527a5..d463234 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 _0x277b=['isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./intSugarcrmConfiguration.controller','get'];(function(_0x381d73,_0x4befa3){var _0x55b6a0=function(_0x3558e7){while(--_0x3558e7){_0x381d73['push'](_0x381d73['shift']());}};_0x55b6a0(++_0x4befa3);}(_0x277b,0x82));var _0xb277=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x277b[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xb277('0x0'));var util=require(_0xb277('0x1'));var path=require(_0xb277('0x2'));var timeout=require(_0xb277('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb277('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb277('0x5'));var config=require('../../config/environment');var controller=require(_0xb277('0x6'));router[_0xb277('0x7')]('/',auth[_0xb277('0x8')](),controller[_0xb277('0x9')]);router[_0xb277('0x7')](_0xb277('0xa'),auth[_0xb277('0x8')](),controller['show']);router['get'](_0xb277('0xb'),auth['isAuthenticated'](),controller[_0xb277('0xc')]);router[_0xb277('0x7')](_0xb277('0xd'),auth[_0xb277('0x8')](),controller['getSubjects']);router[_0xb277('0x7')](_0xb277('0xe'),auth[_0xb277('0x8')](),controller[_0xb277('0xf')]);router[_0xb277('0x10')]('/',auth[_0xb277('0x8')](),controller[_0xb277('0x11')]);router[_0xb277('0x12')](_0xb277('0xa'),auth[_0xb277('0x8')](),controller[_0xb277('0x13')]);router[_0xb277('0x14')]('/:id',auth[_0xb277('0x8')](),controller[_0xb277('0x15')]);module[_0xb277('0x16')]=router; \ No newline at end of file +var _0xd08c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','getFields','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0xd08c,0x114));var _0xcd08=function(_0x403f89,_0x172b0e){_0x403f89=_0x403f89-0x0;var _0x1a8ca7=_0xd08c[_0x403f89];return _0x1a8ca7;};'use strict';var multer=require(_0xcd08('0x0'));var util=require(_0xcd08('0x1'));var path=require(_0xcd08('0x2'));var timeout=require(_0xcd08('0x3'));var express=require(_0xcd08('0x4'));var router=express[_0xcd08('0x5')]();var fs_extra=require(_0xcd08('0x6'));var auth=require(_0xcd08('0x7'));var interaction=require(_0xcd08('0x8'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xcd08('0x9')](),controller[_0xcd08('0xa')]);router['get'](_0xcd08('0xb'),auth['isAuthenticated'](),controller[_0xcd08('0xc')]);router[_0xcd08('0xd')]('/:id/fields',auth[_0xcd08('0x9')](),controller[_0xcd08('0xe')]);router[_0xcd08('0xd')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xcd08('0xd')]('/:id/descriptions',auth[_0xcd08('0x9')](),controller[_0xcd08('0xf')]);router[_0xcd08('0x10')]('/',auth[_0xcd08('0x9')](),controller[_0xcd08('0x11')]);router[_0xcd08('0x12')]('/:id',auth[_0xcd08('0x9')](),controller[_0xcd08('0x13')]);router[_0xcd08('0x14')](_0xcd08('0xb'),auth['isAuthenticated'](),controller[_0xcd08('0x15')]);module[_0xcd08('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 517b154..b069973 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 _0x6b3d=['sequelize','exports','STRING'];(function(_0x310f8a,_0x115101){var _0x3e01ac=function(_0x2f7021){while(--_0x2f7021){_0x310f8a['push'](_0x310f8a['shift']());}};_0x3e01ac(++_0x115101);}(_0x6b3d,0x1bc));var _0xd6b3=function(_0xc0f35d,_0x1f4589){_0xc0f35d=_0xc0f35d-0x0;var _0x5ddbdc=_0x6b3d[_0xc0f35d];return _0x5ddbdc;};'use strict';var Sequelize=require(_0xd6b3('0x0'));module[_0xd6b3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd6b3('0x2')]}}; \ No newline at end of file +var _0xbe5d=['sequelize','exports','STRING'];(function(_0x4ddb31,_0x41bbeb){var _0x3d1cec=function(_0x5c594b){while(--_0x5c594b){_0x4ddb31['push'](_0x4ddb31['shift']());}};_0x3d1cec(++_0x41bbeb);}(_0xbe5d,0x114));var _0xdbe5=function(_0x5dbe0d,_0x35a200){_0x5dbe0d=_0x5dbe0d-0x0;var _0x1a068f=_0xbe5d[_0x5dbe0d];return _0x1a068f;};'use strict';var Sequelize=require(_0xdbe5('0x0'));module[_0xdbe5('0x1')]={'name':{'type':Sequelize[_0xdbe5('0x2')]},'description':{'type':Sequelize[_0xdbe5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5c331c8..acf33dc 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 _0xb7b9=['limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','intersection','options','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','count','offset'];(function(_0x46af0c,_0xd23ca8){var _0x599047=function(_0x4dcb62){while(--_0x4dcb62){_0x46af0c['push'](_0x46af0c['shift']());}};_0x599047(++_0xd23ca8);}(_0xb7b9,0xd8));var _0x9b7b=function(_0x3d526b,_0x51573a){_0x3d526b=_0x3d526b-0x0;var _0x4a7659=_0xb7b9[_0x3d526b];return _0x4a7659;};'use strict';var emlformat=require(_0x9b7b('0x0'));var rimraf=require(_0x9b7b('0x1'));var zipdir=require(_0x9b7b('0x2'));var jsonpatch=require(_0x9b7b('0x3'));var rp=require(_0x9b7b('0x4'));var moment=require(_0x9b7b('0x5'));var BPromise=require(_0x9b7b('0x6'));var Mustache=require(_0x9b7b('0x7'));var util=require(_0x9b7b('0x8'));var path=require(_0x9b7b('0x9'));var sox=require('sox');var csv=require(_0x9b7b('0xa'));var ejs=require(_0x9b7b('0xb'));var fs=require('fs');var fs_extra=require(_0x9b7b('0xc'));var _=require(_0x9b7b('0xd'));var squel=require(_0x9b7b('0xe'));var crypto=require(_0x9b7b('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b7b('0xa'));var querystring=require(_0x9b7b('0x10'));var Papa=require(_0x9b7b('0x11'));var Redis=require(_0x9b7b('0x12'));var authService=require(_0x9b7b('0x13'));var qs=require(_0x9b7b('0x14'));var as=require(_0x9b7b('0x15'));var hardwareService=require(_0x9b7b('0x16'));var logger=require(_0x9b7b('0x17'))('api');var utils=require(_0x9b7b('0x18'));var config=require(_0x9b7b('0x19'));var licenseUtil=require(_0x9b7b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bb8dc,_0xa85fd){_0xa85fd=_0xa85fd||0xcc;return function(_0x28d817){if(_0x28d817){return _0x2bb8dc['sendStatus'](_0xa85fd);}return _0x2bb8dc['status'](_0xa85fd)[_0x9b7b('0x1b')]();};}function respondWithResult(_0xc0301e,_0x14c082){_0x14c082=_0x14c082||0xc8;return function(_0x5a26cb){if(_0x5a26cb){return _0xc0301e[_0x9b7b('0x1c')](_0x14c082)[_0x9b7b('0x1d')](_0x5a26cb);}};}function respondWithFilteredResult(_0x58a4da,_0x418588){return function(_0x23187a){if(_0x23187a){var _0x49cf2d=typeof _0x418588['offset']==='undefined'&&typeof _0x418588['limit']===_0x9b7b('0x1e');var _0x34c4b7=_0x23187a[_0x9b7b('0x1f')];var _0x33dc89=_0x49cf2d?0x0:_0x418588[_0x9b7b('0x20')];var _0xcfed9f=_0x49cf2d?_0x23187a[_0x9b7b('0x1f')]:_0x418588['offset']+_0x418588[_0x9b7b('0x21')];var _0xdc5e6a;if(_0xcfed9f>=_0x34c4b7){_0xcfed9f=_0x34c4b7;_0xdc5e6a=0xc8;}else{_0xdc5e6a=0xce;}_0x58a4da['status'](_0xdc5e6a);return _0x58a4da['set'](_0x9b7b('0x22'),_0x33dc89+'-'+_0xcfed9f+'/'+_0x34c4b7)[_0x9b7b('0x1d')](_0x23187a);}return null;};}function patchUpdates(_0x46b89b){return function(_0x5c1750){try{jsonpatch[_0x9b7b('0x23')](_0x5c1750,_0x46b89b,!![]);}catch(_0x1ef905){return BPromise[_0x9b7b('0x24')](_0x1ef905);}return _0x5c1750[_0x9b7b('0x25')]();};}function saveUpdates(_0x128328,_0x20149e){return function(_0x557414){if(_0x557414){return _0x557414[_0x9b7b('0x26')](_0x128328)[_0x9b7b('0x27')](function(_0x39ad49){return _0x39ad49;});}return null;};}function removeEntity(_0x3cd2d6,_0x33bb84){return function(_0x3d48ae){if(_0x3d48ae){return _0x3d48ae[_0x9b7b('0x28')]()[_0x9b7b('0x27')](function(){_0x3cd2d6[_0x9b7b('0x1c')](0xcc)[_0x9b7b('0x1b')]();});}};}function handleEntityNotFound(_0x45ed04,_0x25ed4d){return function(_0x34b336){if(!_0x34b336){_0x45ed04[_0x9b7b('0x29')](0x194);}return _0x34b336;};}function handleError(_0x2fde33,_0x4b95d1){_0x4b95d1=_0x4b95d1||0x1f4;return function(_0x1714fe){logger['error'](_0x1714fe[_0x9b7b('0x2a')]);if(_0x1714fe[_0x9b7b('0x2b')]){delete _0x1714fe[_0x9b7b('0x2b')];}_0x2fde33[_0x9b7b('0x1c')](_0x4b95d1)[_0x9b7b('0x2c')](_0x1714fe);};}exports[_0x9b7b('0x2d')]=function(_0x78f416,_0x3fa9aa){var _0x5f1668={},_0x56dbc1={},_0x3f6372={'count':0x0,'rows':[]};var _0x26005e=_[_0x9b7b('0x2e')](db[_0x9b7b('0x2f')][_0x9b7b('0x30')],function(_0x4fcb4c){return{'name':_0x4fcb4c[_0x9b7b('0x31')],'type':_0x4fcb4c[_0x9b7b('0x32')][_0x9b7b('0x33')]};});_0x56dbc1['model']=_[_0x9b7b('0x2e')](_0x26005e,_0x9b7b('0x2b'));_0x56dbc1[_0x9b7b('0x34')]=_[_0x9b7b('0x35')](_0x78f416['query']);_0x56dbc1[_0x9b7b('0x36')]=_['intersection'](_0x56dbc1[_0x9b7b('0x37')],_0x56dbc1[_0x9b7b('0x34')]);_0x5f1668[_0x9b7b('0x38')]=_['intersection'](_0x56dbc1[_0x9b7b('0x37')],qs['fields'](_0x78f416[_0x9b7b('0x34')][_0x9b7b('0x39')]));_0x5f1668[_0x9b7b('0x38')]=_0x5f1668['attributes'][_0x9b7b('0x3a')]?_0x5f1668[_0x9b7b('0x38')]:_0x56dbc1[_0x9b7b('0x37')];if(!_0x78f416[_0x9b7b('0x34')][_0x9b7b('0x3b')](_0x9b7b('0x3c'))){_0x5f1668[_0x9b7b('0x21')]=qs['limit'](_0x78f416[_0x9b7b('0x34')]['limit']);_0x5f1668['offset']=qs[_0x9b7b('0x20')](_0x78f416[_0x9b7b('0x34')]['offset']);}_0x5f1668[_0x9b7b('0x3d')]=qs[_0x9b7b('0x3e')](_0x78f416[_0x9b7b('0x34')][_0x9b7b('0x3e')]);_0x5f1668[_0x9b7b('0x3f')]=qs[_0x9b7b('0x36')](_[_0x9b7b('0x40')](_0x78f416[_0x9b7b('0x34')],_0x56dbc1[_0x9b7b('0x36')]),_0x26005e);if(_0x78f416['query'][_0x9b7b('0x41')]){_0x5f1668[_0x9b7b('0x3f')]=_[_0x9b7b('0x42')](_0x5f1668[_0x9b7b('0x3f')],{'$or':_[_0x9b7b('0x2e')](_0x26005e,function(_0x3616eb){if(_0x3616eb[_0x9b7b('0x32')]!==_0x9b7b('0x43')){var _0x2e5537={};_0x2e5537[_0x3616eb[_0x9b7b('0x2b')]]={'$like':'%'+_0x78f416[_0x9b7b('0x34')][_0x9b7b('0x41')]+'%'};return _0x2e5537;}})});}_0x5f1668=_['merge']({},_0x5f1668,_0x78f416['options']);var _0x35c115={'where':_0x5f1668[_0x9b7b('0x3f')]};return db[_0x9b7b('0x2f')][_0x9b7b('0x1f')](_0x35c115)[_0x9b7b('0x27')](function(_0x1e2608){_0x3f6372[_0x9b7b('0x1f')]=_0x1e2608;if(_0x78f416['query'][_0x9b7b('0x44')]){_0x5f1668[_0x9b7b('0x45')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x5f1668);})['then'](function(_0x265012){_0x3f6372['rows']=_0x265012;return _0x3f6372;})[_0x9b7b('0x27')](respondWithFilteredResult(_0x3fa9aa,_0x5f1668))[_0x9b7b('0x46')](handleError(_0x3fa9aa,null));};exports[_0x9b7b('0x47')]=function(_0x40eff7,_0x5f52d2){var _0x200412={'raw':![],'where':{'id':_0x40eff7[_0x9b7b('0x48')]['id']}},_0x5e7300={};_0x5e7300[_0x9b7b('0x37')]=_[_0x9b7b('0x35')](db[_0x9b7b('0x2f')][_0x9b7b('0x30')]);_0x5e7300[_0x9b7b('0x34')]=_['keys'](_0x40eff7['query']);_0x5e7300[_0x9b7b('0x36')]=_[_0x9b7b('0x49')](_0x5e7300['model'],_0x5e7300[_0x9b7b('0x34')]);_0x200412['attributes']=_[_0x9b7b('0x49')](_0x5e7300[_0x9b7b('0x37')],qs[_0x9b7b('0x39')](_0x40eff7[_0x9b7b('0x34')]['fields']));_0x200412['attributes']=_0x200412[_0x9b7b('0x38')]['length']?_0x200412[_0x9b7b('0x38')]:_0x5e7300[_0x9b7b('0x37')];if(_0x40eff7[_0x9b7b('0x34')][_0x9b7b('0x44')]){_0x200412[_0x9b7b('0x45')]=[{'all':!![]}];}_0x200412=_['merge']({},_0x200412,_0x40eff7[_0x9b7b('0x4a')]);return db['SugarcrmConfiguration'][_0x9b7b('0x4b')](_0x200412)[_0x9b7b('0x27')](handleEntityNotFound(_0x5f52d2,null))['then'](respondWithResult(_0x5f52d2,null))[_0x9b7b('0x46')](handleError(_0x5f52d2,null));};exports[_0x9b7b('0x4c')]=function(_0x3c188d,_0x3d88ee){return db[_0x9b7b('0x2f')][_0x9b7b('0x4c')](_0x3c188d[_0x9b7b('0x4d')],{})['then'](respondWithResult(_0x3d88ee,0xc9))[_0x9b7b('0x46')](handleError(_0x3d88ee,null));};exports[_0x9b7b('0x26')]=function(_0x33d06b,_0x592922){if(_0x33d06b[_0x9b7b('0x4d')]['id']){delete _0x33d06b['body']['id'];}return db['SugarcrmConfiguration'][_0x9b7b('0x4b')]({'where':{'id':_0x33d06b['params']['id']}})[_0x9b7b('0x27')](handleEntityNotFound(_0x592922,null))[_0x9b7b('0x27')](saveUpdates(_0x33d06b['body'],null))[_0x9b7b('0x27')](respondWithResult(_0x592922,null))[_0x9b7b('0x46')](handleError(_0x592922,null));};exports[_0x9b7b('0x28')]=function(_0xd21269,_0x1fc384){return db[_0x9b7b('0x2f')][_0x9b7b('0x4b')]({'where':{'id':_0xd21269[_0x9b7b('0x48')]['id']}})[_0x9b7b('0x27')](handleEntityNotFound(_0x1fc384,null))['then'](removeEntity(_0x1fc384,null))[_0x9b7b('0x46')](handleError(_0x1fc384,null));};exports[_0x9b7b('0x4e')]=function(_0xc59d0f,_0x32eb79,_0x1b0e59){var _0x338acb={};var _0x5bb71c={};var _0x5be3fa;var _0x1d4005;return db[_0x9b7b('0x2f')][_0x9b7b('0x4f')]({'where':{'id':_0xc59d0f[_0x9b7b('0x48')]['id']}})[_0x9b7b('0x27')](handleEntityNotFound(_0x32eb79,null))['then'](function(_0x3c3abe){if(_0x3c3abe){_0x5be3fa=_0x3c3abe;_0x5bb71c[_0x9b7b('0x37')]=_[_0x9b7b('0x35')](db[_0x9b7b('0x50')][_0x9b7b('0x30')]);_0x5bb71c[_0x9b7b('0x34')]=_[_0x9b7b('0x35')](_0xc59d0f[_0x9b7b('0x34')]);_0x5bb71c['filters']=_['intersection'](_0x5bb71c[_0x9b7b('0x37')],_0x5bb71c[_0x9b7b('0x34')]);_0x338acb['attributes']=_['intersection'](_0x5bb71c[_0x9b7b('0x37')],qs[_0x9b7b('0x39')](_0xc59d0f[_0x9b7b('0x34')][_0x9b7b('0x39')]));_0x338acb['attributes']=_0x338acb[_0x9b7b('0x38')][_0x9b7b('0x3a')]?_0x338acb[_0x9b7b('0x38')]:_0x5bb71c[_0x9b7b('0x37')];_0x338acb['order']=qs[_0x9b7b('0x3e')](_0xc59d0f[_0x9b7b('0x34')][_0x9b7b('0x3e')]);_0x338acb['where']=qs[_0x9b7b('0x36')](_[_0x9b7b('0x40')](_0xc59d0f['query'],_0x5bb71c[_0x9b7b('0x36')]));if(_0xc59d0f[_0x9b7b('0x34')][_0x9b7b('0x41')]){_0x338acb[_0x9b7b('0x3f')]=_[_0x9b7b('0x42')](_0x338acb[_0x9b7b('0x3f')],{'$or':_[_0x9b7b('0x2e')](_0x338acb[_0x9b7b('0x38')],function(_0x258f79){var _0x14222d={};_0x14222d[_0x258f79]={'$like':'%'+_0xc59d0f[_0x9b7b('0x34')][_0x9b7b('0x41')]+'%'};return _0x14222d;})});}_0x338acb=_[_0x9b7b('0x42')]({},_0x338acb,_0xc59d0f[_0x9b7b('0x4a')]);return _0x5be3fa['getFields'](_0x338acb);}})[_0x9b7b('0x27')](function(_0x51b17b){if(_0x51b17b){_0x1d4005=_0x51b17b[_0x9b7b('0x3a')];if(!_0xc59d0f[_0x9b7b('0x34')][_0x9b7b('0x3b')](_0x9b7b('0x3c'))){_0x338acb[_0x9b7b('0x21')]=qs['limit'](_0xc59d0f[_0x9b7b('0x34')][_0x9b7b('0x21')]);_0x338acb[_0x9b7b('0x20')]=qs['offset'](_0xc59d0f[_0x9b7b('0x34')][_0x9b7b('0x20')]);}return _0x5be3fa[_0x9b7b('0x4e')](_0x338acb);}})['then'](function(_0x5d65aa){if(_0x5d65aa){return _0x5d65aa?{'count':_0x1d4005,'rows':_0x5d65aa}:null;}})[_0x9b7b('0x27')](respondWithResult(_0x32eb79,null))['catch'](handleError(_0x32eb79,null));};exports[_0x9b7b('0x51')]=function(_0x2e7901,_0x3e019c,_0xd74a24){var _0x5cff7b={};var _0x1f3557={};var _0xbe1bbd;var _0x3039f8;return db[_0x9b7b('0x2f')][_0x9b7b('0x4f')]({'where':{'id':_0x2e7901[_0x9b7b('0x48')]['id']}})[_0x9b7b('0x27')](handleEntityNotFound(_0x3e019c,null))['then'](function(_0x5624a5){if(_0x5624a5){_0xbe1bbd=_0x5624a5;_0x1f3557[_0x9b7b('0x37')]=_[_0x9b7b('0x35')](db[_0x9b7b('0x50')][_0x9b7b('0x30')]);_0x1f3557[_0x9b7b('0x34')]=_[_0x9b7b('0x35')](_0x2e7901['query']);_0x1f3557['filters']=_[_0x9b7b('0x49')](_0x1f3557[_0x9b7b('0x37')],_0x1f3557['query']);_0x5cff7b[_0x9b7b('0x38')]=_[_0x9b7b('0x49')](_0x1f3557['model'],qs[_0x9b7b('0x39')](_0x2e7901[_0x9b7b('0x34')][_0x9b7b('0x39')]));_0x5cff7b[_0x9b7b('0x38')]=_0x5cff7b[_0x9b7b('0x38')][_0x9b7b('0x3a')]?_0x5cff7b[_0x9b7b('0x38')]:_0x1f3557['model'];_0x5cff7b[_0x9b7b('0x3d')]=qs['sort'](_0x2e7901[_0x9b7b('0x34')][_0x9b7b('0x3e')]);_0x5cff7b[_0x9b7b('0x3f')]=qs['filters'](_[_0x9b7b('0x40')](_0x2e7901[_0x9b7b('0x34')],_0x1f3557[_0x9b7b('0x36')]));if(_0x2e7901[_0x9b7b('0x34')][_0x9b7b('0x41')]){_0x5cff7b['where']=_[_0x9b7b('0x42')](_0x5cff7b[_0x9b7b('0x3f')],{'$or':_[_0x9b7b('0x2e')](_0x5cff7b[_0x9b7b('0x38')],function(_0x2cd33e){var _0x123c9f={};_0x123c9f[_0x2cd33e]={'$like':'%'+_0x2e7901[_0x9b7b('0x34')][_0x9b7b('0x41')]+'%'};return _0x123c9f;})});}_0x5cff7b=_[_0x9b7b('0x42')]({},_0x5cff7b,_0x2e7901['options']);return _0xbe1bbd['getSubjects'](_0x5cff7b);}})[_0x9b7b('0x27')](function(_0x4bed99){if(_0x4bed99){_0x3039f8=_0x4bed99['length'];if(!_0x2e7901[_0x9b7b('0x34')]['hasOwnProperty'](_0x9b7b('0x3c'))){_0x5cff7b['limit']=qs[_0x9b7b('0x21')](_0x2e7901[_0x9b7b('0x34')][_0x9b7b('0x21')]);_0x5cff7b[_0x9b7b('0x20')]=qs[_0x9b7b('0x20')](_0x2e7901['query'][_0x9b7b('0x20')]);}return _0xbe1bbd[_0x9b7b('0x51')](_0x5cff7b);}})[_0x9b7b('0x27')](function(_0x2c547c){if(_0x2c547c){return _0x2c547c?{'count':_0x3039f8,'rows':_0x2c547c}:null;}})['then'](respondWithResult(_0x3e019c,null))[_0x9b7b('0x46')](handleError(_0x3e019c,null));};exports[_0x9b7b('0x52')]=function(_0x5a2601,_0xa78dc4,_0xc09a20){var _0x29f1d1={};var _0x2df58a={};var _0x223d7b;var _0x441245;return db[_0x9b7b('0x2f')][_0x9b7b('0x4f')]({'where':{'id':_0x5a2601[_0x9b7b('0x48')]['id']}})[_0x9b7b('0x27')](handleEntityNotFound(_0xa78dc4,null))['then'](function(_0x5d4713){if(_0x5d4713){_0x223d7b=_0x5d4713;_0x2df58a['model']=_[_0x9b7b('0x35')](db[_0x9b7b('0x50')]['rawAttributes']);_0x2df58a['query']=_[_0x9b7b('0x35')](_0x5a2601['query']);_0x2df58a[_0x9b7b('0x36')]=_[_0x9b7b('0x49')](_0x2df58a['model'],_0x2df58a['query']);_0x29f1d1['attributes']=_[_0x9b7b('0x49')](_0x2df58a['model'],qs[_0x9b7b('0x39')](_0x5a2601[_0x9b7b('0x34')][_0x9b7b('0x39')]));_0x29f1d1[_0x9b7b('0x38')]=_0x29f1d1[_0x9b7b('0x38')]['length']?_0x29f1d1[_0x9b7b('0x38')]:_0x2df58a['model'];_0x29f1d1[_0x9b7b('0x3d')]=qs['sort'](_0x5a2601[_0x9b7b('0x34')]['sort']);_0x29f1d1['where']=qs[_0x9b7b('0x36')](_['pick'](_0x5a2601[_0x9b7b('0x34')],_0x2df58a[_0x9b7b('0x36')]));if(_0x5a2601[_0x9b7b('0x34')][_0x9b7b('0x41')]){_0x29f1d1[_0x9b7b('0x3f')]=_['merge'](_0x29f1d1['where'],{'$or':_[_0x9b7b('0x2e')](_0x29f1d1[_0x9b7b('0x38')],function(_0x1b7910){var _0x307d4e={};_0x307d4e[_0x1b7910]={'$like':'%'+_0x5a2601['query']['filter']+'%'};return _0x307d4e;})});}_0x29f1d1=_[_0x9b7b('0x42')]({},_0x29f1d1,_0x5a2601[_0x9b7b('0x4a')]);return _0x223d7b[_0x9b7b('0x52')](_0x29f1d1);}})['then'](function(_0x25d93b){if(_0x25d93b){_0x441245=_0x25d93b[_0x9b7b('0x3a')];if(!_0x5a2601[_0x9b7b('0x34')][_0x9b7b('0x3b')]('nolimit')){_0x29f1d1['limit']=qs[_0x9b7b('0x21')](_0x5a2601[_0x9b7b('0x34')][_0x9b7b('0x21')]);_0x29f1d1['offset']=qs[_0x9b7b('0x20')](_0x5a2601[_0x9b7b('0x34')][_0x9b7b('0x20')]);}return _0x223d7b[_0x9b7b('0x52')](_0x29f1d1);}})['then'](function(_0x5c858f){if(_0x5c858f){return _0x5c858f?{'count':_0x441245,'rows':_0x5c858f}:null;}})[_0x9b7b('0x27')](respondWithResult(_0xa78dc4,null))[_0x9b7b('0x46')](handleError(_0xa78dc4,null));}; \ No newline at end of file +var _0x1ea9=['order','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','limit','undefined','count','offset','status','set','reject','save','update','end','sendStatus','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','then','include','SugarcrmConfiguration','findAll','catch','show','includeAll','find','create','body','destroy','params','getFields','findOne','SugarcrmField'];(function(_0xb2656b,_0xd4c8bd){var _0x1c8e96=function(_0x451df1){while(--_0x451df1){_0xb2656b['push'](_0xb2656b['shift']());}};_0x1c8e96(++_0xd4c8bd);}(_0x1ea9,0xf7));var _0x91ea=function(_0x510f82,_0x9de6d3){_0x510f82=_0x510f82-0x0;var _0xabd776=_0x1ea9[_0x510f82];return _0xabd776;};'use strict';var emlformat=require(_0x91ea('0x0'));var rimraf=require(_0x91ea('0x1'));var zipdir=require(_0x91ea('0x2'));var jsonpatch=require(_0x91ea('0x3'));var rp=require('request-promise');var moment=require(_0x91ea('0x4'));var BPromise=require(_0x91ea('0x5'));var Mustache=require('mustache');var util=require(_0x91ea('0x6'));var path=require(_0x91ea('0x7'));var sox=require('sox');var csv=require(_0x91ea('0x8'));var ejs=require(_0x91ea('0x9'));var fs=require('fs');var fs_extra=require(_0x91ea('0xa'));var _=require(_0x91ea('0xb'));var squel=require('squel');var crypto=require(_0x91ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x91ea('0xd'));var toCsv=require(_0x91ea('0x8'));var querystring=require(_0x91ea('0xe'));var Papa=require(_0x91ea('0xf'));var Redis=require(_0x91ea('0x10'));var authService=require(_0x91ea('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x91ea('0x12'));var hardwareService=require(_0x91ea('0x13'));var logger=require('../../config/logger')(_0x91ea('0x14'));var utils=require(_0x91ea('0x15'));var config=require(_0x91ea('0x16'));var licenseUtil=require(_0x91ea('0x17'));var db=require(_0x91ea('0x18'))['db'];function respondWithStatusCode(_0x2d6eeb,_0x17e725){_0x17e725=_0x17e725||0xcc;return function(_0x5c8b92){if(_0x5c8b92){return _0x2d6eeb['sendStatus'](_0x17e725);}return _0x2d6eeb['status'](_0x17e725)['end']();};}function respondWithResult(_0x33eda6,_0x480d70){_0x480d70=_0x480d70||0xc8;return function(_0x4edbed){if(_0x4edbed){return _0x33eda6['status'](_0x480d70)[_0x91ea('0x19')](_0x4edbed);}};}function respondWithFilteredResult(_0x23adc0,_0xfe0c06){return function(_0xdb6ce8){if(_0xdb6ce8){var _0x3f5633=typeof _0xfe0c06['offset']==='undefined'&&typeof _0xfe0c06[_0x91ea('0x1a')]===_0x91ea('0x1b');var _0x385303=_0xdb6ce8[_0x91ea('0x1c')];var _0x1a9528=_0x3f5633?0x0:_0xfe0c06[_0x91ea('0x1d')];var _0x5d8b30=_0x3f5633?_0xdb6ce8[_0x91ea('0x1c')]:_0xfe0c06['offset']+_0xfe0c06[_0x91ea('0x1a')];var _0x2f4e62;if(_0x5d8b30>=_0x385303){_0x5d8b30=_0x385303;_0x2f4e62=0xc8;}else{_0x2f4e62=0xce;}_0x23adc0[_0x91ea('0x1e')](_0x2f4e62);return _0x23adc0[_0x91ea('0x1f')]('Content-Range',_0x1a9528+'-'+_0x5d8b30+'/'+_0x385303)['json'](_0xdb6ce8);}return null;};}function patchUpdates(_0x15b9f1){return function(_0x4e8a53){try{jsonpatch['apply'](_0x4e8a53,_0x15b9f1,!![]);}catch(_0x32d93e){return BPromise[_0x91ea('0x20')](_0x32d93e);}return _0x4e8a53[_0x91ea('0x21')]();};}function saveUpdates(_0x15a912,_0x20fd01){return function(_0x13d13c){if(_0x13d13c){return _0x13d13c[_0x91ea('0x22')](_0x15a912)['then'](function(_0x32d670){return _0x32d670;});}return null;};}function removeEntity(_0x1fc7da,_0x1a6323){return function(_0x16507e){if(_0x16507e){return _0x16507e['destroy']()['then'](function(){_0x1fc7da[_0x91ea('0x1e')](0xcc)[_0x91ea('0x23')]();});}};}function handleEntityNotFound(_0x196e5e,_0x8c6a9a){return function(_0x58c9f9){if(!_0x58c9f9){_0x196e5e[_0x91ea('0x24')](0x194);}return _0x58c9f9;};}function handleError(_0xe53c2e,_0x48330e){_0x48330e=_0x48330e||0x1f4;return function(_0x55301f){logger[_0x91ea('0x25')](_0x55301f[_0x91ea('0x26')]);if(_0x55301f['name']){delete _0x55301f['name'];}_0xe53c2e[_0x91ea('0x1e')](_0x48330e)[_0x91ea('0x27')](_0x55301f);};}exports['index']=function(_0x41d3c9,_0x224480){var _0x10f829={},_0x1e40a8={},_0x3089a9={'count':0x0,'rows':[]};var _0x276b23=_[_0x91ea('0x28')](db['SugarcrmConfiguration'][_0x91ea('0x29')],function(_0x179f8b){return{'name':_0x179f8b[_0x91ea('0x2a')],'type':_0x179f8b[_0x91ea('0x2b')][_0x91ea('0x2c')]};});_0x1e40a8[_0x91ea('0x2d')]=_[_0x91ea('0x28')](_0x276b23,_0x91ea('0x2e'));_0x1e40a8[_0x91ea('0x2f')]=_[_0x91ea('0x30')](_0x41d3c9[_0x91ea('0x2f')]);_0x1e40a8[_0x91ea('0x31')]=_[_0x91ea('0x32')](_0x1e40a8[_0x91ea('0x2d')],_0x1e40a8[_0x91ea('0x2f')]);_0x10f829[_0x91ea('0x33')]=_['intersection'](_0x1e40a8[_0x91ea('0x2d')],qs[_0x91ea('0x34')](_0x41d3c9[_0x91ea('0x2f')][_0x91ea('0x34')]));_0x10f829[_0x91ea('0x33')]=_0x10f829[_0x91ea('0x33')][_0x91ea('0x35')]?_0x10f829[_0x91ea('0x33')]:_0x1e40a8[_0x91ea('0x2d')];if(!_0x41d3c9[_0x91ea('0x2f')][_0x91ea('0x36')](_0x91ea('0x37'))){_0x10f829['limit']=qs['limit'](_0x41d3c9['query']['limit']);_0x10f829[_0x91ea('0x1d')]=qs[_0x91ea('0x1d')](_0x41d3c9['query']['offset']);}_0x10f829['order']=qs[_0x91ea('0x38')](_0x41d3c9[_0x91ea('0x2f')][_0x91ea('0x38')]);_0x10f829[_0x91ea('0x39')]=qs[_0x91ea('0x31')](_['pick'](_0x41d3c9[_0x91ea('0x2f')],_0x1e40a8[_0x91ea('0x31')]),_0x276b23);if(_0x41d3c9[_0x91ea('0x2f')][_0x91ea('0x3a')]){_0x10f829[_0x91ea('0x39')]=_[_0x91ea('0x3b')](_0x10f829[_0x91ea('0x39')],{'$or':_[_0x91ea('0x28')](_0x276b23,function(_0x4dc99e){if(_0x4dc99e['type']!==_0x91ea('0x3c')){var _0x29ed8f={};_0x29ed8f[_0x4dc99e[_0x91ea('0x2e')]]={'$like':'%'+_0x41d3c9[_0x91ea('0x2f')][_0x91ea('0x3a')]+'%'};return _0x29ed8f;}})});}_0x10f829=_[_0x91ea('0x3b')]({},_0x10f829,_0x41d3c9[_0x91ea('0x3d')]);var _0x5d18a7={'where':_0x10f829['where']};return db['SugarcrmConfiguration'][_0x91ea('0x1c')](_0x5d18a7)[_0x91ea('0x3e')](function(_0x1a04c0){_0x3089a9[_0x91ea('0x1c')]=_0x1a04c0;if(_0x41d3c9[_0x91ea('0x2f')]['includeAll']){_0x10f829[_0x91ea('0x3f')]=[{'all':!![]}];}return db[_0x91ea('0x40')][_0x91ea('0x41')](_0x10f829);})[_0x91ea('0x3e')](function(_0x150649){_0x3089a9['rows']=_0x150649;return _0x3089a9;})[_0x91ea('0x3e')](respondWithFilteredResult(_0x224480,_0x10f829))[_0x91ea('0x42')](handleError(_0x224480,null));};exports[_0x91ea('0x43')]=function(_0x20c451,_0x526f43){var _0x357d8f={'raw':![],'where':{'id':_0x20c451['params']['id']}},_0x152474={};_0x152474['model']=_[_0x91ea('0x30')](db['SugarcrmConfiguration'][_0x91ea('0x29')]);_0x152474['query']=_[_0x91ea('0x30')](_0x20c451[_0x91ea('0x2f')]);_0x152474[_0x91ea('0x31')]=_[_0x91ea('0x32')](_0x152474[_0x91ea('0x2d')],_0x152474[_0x91ea('0x2f')]);_0x357d8f[_0x91ea('0x33')]=_[_0x91ea('0x32')](_0x152474[_0x91ea('0x2d')],qs[_0x91ea('0x34')](_0x20c451['query'][_0x91ea('0x34')]));_0x357d8f[_0x91ea('0x33')]=_0x357d8f[_0x91ea('0x33')][_0x91ea('0x35')]?_0x357d8f[_0x91ea('0x33')]:_0x152474['model'];if(_0x20c451[_0x91ea('0x2f')][_0x91ea('0x44')]){_0x357d8f[_0x91ea('0x3f')]=[{'all':!![]}];}_0x357d8f=_['merge']({},_0x357d8f,_0x20c451['options']);return db[_0x91ea('0x40')][_0x91ea('0x45')](_0x357d8f)[_0x91ea('0x3e')](handleEntityNotFound(_0x526f43,null))[_0x91ea('0x3e')](respondWithResult(_0x526f43,null))[_0x91ea('0x42')](handleError(_0x526f43,null));};exports[_0x91ea('0x46')]=function(_0x49e0f1,_0x2cc7cd){return db['SugarcrmConfiguration'][_0x91ea('0x46')](_0x49e0f1['body'],{})[_0x91ea('0x3e')](respondWithResult(_0x2cc7cd,0xc9))[_0x91ea('0x42')](handleError(_0x2cc7cd,null));};exports[_0x91ea('0x22')]=function(_0x245cf7,_0x4aa610){if(_0x245cf7['body']['id']){delete _0x245cf7[_0x91ea('0x47')]['id'];}return db[_0x91ea('0x40')][_0x91ea('0x45')]({'where':{'id':_0x245cf7['params']['id']}})[_0x91ea('0x3e')](handleEntityNotFound(_0x4aa610,null))[_0x91ea('0x3e')](saveUpdates(_0x245cf7['body'],null))[_0x91ea('0x3e')](respondWithResult(_0x4aa610,null))[_0x91ea('0x42')](handleError(_0x4aa610,null));};exports[_0x91ea('0x48')]=function(_0x974930,_0x5bffad){return db[_0x91ea('0x40')][_0x91ea('0x45')]({'where':{'id':_0x974930[_0x91ea('0x49')]['id']}})[_0x91ea('0x3e')](handleEntityNotFound(_0x5bffad,null))[_0x91ea('0x3e')](removeEntity(_0x5bffad,null))['catch'](handleError(_0x5bffad,null));};exports[_0x91ea('0x4a')]=function(_0x390d79,_0x22bd7f,_0x4ce4dc){var _0x444555={};var _0x3eff1a={};var _0x47b746;var _0x343fc2;return db[_0x91ea('0x40')][_0x91ea('0x4b')]({'where':{'id':_0x390d79[_0x91ea('0x49')]['id']}})['then'](handleEntityNotFound(_0x22bd7f,null))[_0x91ea('0x3e')](function(_0x582797){if(_0x582797){_0x47b746=_0x582797;_0x3eff1a[_0x91ea('0x2d')]=_[_0x91ea('0x30')](db[_0x91ea('0x4c')][_0x91ea('0x29')]);_0x3eff1a['query']=_[_0x91ea('0x30')](_0x390d79[_0x91ea('0x2f')]);_0x3eff1a[_0x91ea('0x31')]=_[_0x91ea('0x32')](_0x3eff1a[_0x91ea('0x2d')],_0x3eff1a[_0x91ea('0x2f')]);_0x444555[_0x91ea('0x33')]=_[_0x91ea('0x32')](_0x3eff1a[_0x91ea('0x2d')],qs[_0x91ea('0x34')](_0x390d79[_0x91ea('0x2f')][_0x91ea('0x34')]));_0x444555[_0x91ea('0x33')]=_0x444555['attributes'][_0x91ea('0x35')]?_0x444555['attributes']:_0x3eff1a[_0x91ea('0x2d')];_0x444555[_0x91ea('0x4d')]=qs[_0x91ea('0x38')](_0x390d79[_0x91ea('0x2f')]['sort']);_0x444555[_0x91ea('0x39')]=qs['filters'](_['pick'](_0x390d79[_0x91ea('0x2f')],_0x3eff1a[_0x91ea('0x31')]));if(_0x390d79[_0x91ea('0x2f')][_0x91ea('0x3a')]){_0x444555[_0x91ea('0x39')]=_[_0x91ea('0x3b')](_0x444555['where'],{'$or':_[_0x91ea('0x28')](_0x444555[_0x91ea('0x33')],function(_0x49ad97){var _0x6f410b={};_0x6f410b[_0x49ad97]={'$like':'%'+_0x390d79['query'][_0x91ea('0x3a')]+'%'};return _0x6f410b;})});}_0x444555=_[_0x91ea('0x3b')]({},_0x444555,_0x390d79[_0x91ea('0x3d')]);return _0x47b746[_0x91ea('0x4a')](_0x444555);}})['then'](function(_0x1db5db){if(_0x1db5db){_0x343fc2=_0x1db5db['length'];if(!_0x390d79['query'][_0x91ea('0x36')](_0x91ea('0x37'))){_0x444555['limit']=qs[_0x91ea('0x1a')](_0x390d79[_0x91ea('0x2f')][_0x91ea('0x1a')]);_0x444555[_0x91ea('0x1d')]=qs['offset'](_0x390d79['query'][_0x91ea('0x1d')]);}return _0x47b746[_0x91ea('0x4a')](_0x444555);}})[_0x91ea('0x3e')](function(_0x503f25){if(_0x503f25){return _0x503f25?{'count':_0x343fc2,'rows':_0x503f25}:null;}})[_0x91ea('0x3e')](respondWithResult(_0x22bd7f,null))[_0x91ea('0x42')](handleError(_0x22bd7f,null));};exports[_0x91ea('0x4e')]=function(_0x142072,_0x1fcf73,_0x359246){var _0x5e2368={};var _0x4401e6={};var _0x501c47;var _0x22d38d;return db['SugarcrmConfiguration'][_0x91ea('0x4b')]({'where':{'id':_0x142072[_0x91ea('0x49')]['id']}})[_0x91ea('0x3e')](handleEntityNotFound(_0x1fcf73,null))['then'](function(_0x45e250){if(_0x45e250){_0x501c47=_0x45e250;_0x4401e6[_0x91ea('0x2d')]=_[_0x91ea('0x30')](db[_0x91ea('0x4c')][_0x91ea('0x29')]);_0x4401e6[_0x91ea('0x2f')]=_[_0x91ea('0x30')](_0x142072['query']);_0x4401e6['filters']=_[_0x91ea('0x32')](_0x4401e6[_0x91ea('0x2d')],_0x4401e6[_0x91ea('0x2f')]);_0x5e2368[_0x91ea('0x33')]=_['intersection'](_0x4401e6[_0x91ea('0x2d')],qs[_0x91ea('0x34')](_0x142072[_0x91ea('0x2f')][_0x91ea('0x34')]));_0x5e2368[_0x91ea('0x33')]=_0x5e2368[_0x91ea('0x33')][_0x91ea('0x35')]?_0x5e2368[_0x91ea('0x33')]:_0x4401e6['model'];_0x5e2368[_0x91ea('0x4d')]=qs[_0x91ea('0x38')](_0x142072[_0x91ea('0x2f')][_0x91ea('0x38')]);_0x5e2368['where']=qs['filters'](_[_0x91ea('0x4f')](_0x142072[_0x91ea('0x2f')],_0x4401e6[_0x91ea('0x31')]));if(_0x142072['query'][_0x91ea('0x3a')]){_0x5e2368[_0x91ea('0x39')]=_[_0x91ea('0x3b')](_0x5e2368[_0x91ea('0x39')],{'$or':_['map'](_0x5e2368['attributes'],function(_0x1948ad){var _0x2f8f87={};_0x2f8f87[_0x1948ad]={'$like':'%'+_0x142072['query']['filter']+'%'};return _0x2f8f87;})});}_0x5e2368=_[_0x91ea('0x3b')]({},_0x5e2368,_0x142072[_0x91ea('0x3d')]);return _0x501c47['getSubjects'](_0x5e2368);}})[_0x91ea('0x3e')](function(_0x1efd2a){if(_0x1efd2a){_0x22d38d=_0x1efd2a[_0x91ea('0x35')];if(!_0x142072[_0x91ea('0x2f')][_0x91ea('0x36')](_0x91ea('0x37'))){_0x5e2368[_0x91ea('0x1a')]=qs[_0x91ea('0x1a')](_0x142072[_0x91ea('0x2f')]['limit']);_0x5e2368[_0x91ea('0x1d')]=qs[_0x91ea('0x1d')](_0x142072['query'][_0x91ea('0x1d')]);}return _0x501c47[_0x91ea('0x4e')](_0x5e2368);}})[_0x91ea('0x3e')](function(_0x5803c9){if(_0x5803c9){return _0x5803c9?{'count':_0x22d38d,'rows':_0x5803c9}:null;}})[_0x91ea('0x3e')](respondWithResult(_0x1fcf73,null))[_0x91ea('0x42')](handleError(_0x1fcf73,null));};exports[_0x91ea('0x50')]=function(_0x5bb1c8,_0x32c451,_0x3b0063){var _0x4694b3={};var _0x3c5dc6={};var _0x2c1125;var _0x356855;return db[_0x91ea('0x40')][_0x91ea('0x4b')]({'where':{'id':_0x5bb1c8[_0x91ea('0x49')]['id']}})['then'](handleEntityNotFound(_0x32c451,null))[_0x91ea('0x3e')](function(_0x2b7013){if(_0x2b7013){_0x2c1125=_0x2b7013;_0x3c5dc6[_0x91ea('0x2d')]=_[_0x91ea('0x30')](db[_0x91ea('0x4c')]['rawAttributes']);_0x3c5dc6[_0x91ea('0x2f')]=_[_0x91ea('0x30')](_0x5bb1c8[_0x91ea('0x2f')]);_0x3c5dc6[_0x91ea('0x31')]=_[_0x91ea('0x32')](_0x3c5dc6['model'],_0x3c5dc6[_0x91ea('0x2f')]);_0x4694b3[_0x91ea('0x33')]=_[_0x91ea('0x32')](_0x3c5dc6[_0x91ea('0x2d')],qs[_0x91ea('0x34')](_0x5bb1c8['query'][_0x91ea('0x34')]));_0x4694b3[_0x91ea('0x33')]=_0x4694b3[_0x91ea('0x33')][_0x91ea('0x35')]?_0x4694b3[_0x91ea('0x33')]:_0x3c5dc6[_0x91ea('0x2d')];_0x4694b3['order']=qs['sort'](_0x5bb1c8[_0x91ea('0x2f')]['sort']);_0x4694b3[_0x91ea('0x39')]=qs[_0x91ea('0x31')](_[_0x91ea('0x4f')](_0x5bb1c8[_0x91ea('0x2f')],_0x3c5dc6['filters']));if(_0x5bb1c8[_0x91ea('0x2f')][_0x91ea('0x3a')]){_0x4694b3[_0x91ea('0x39')]=_[_0x91ea('0x3b')](_0x4694b3[_0x91ea('0x39')],{'$or':_['map'](_0x4694b3[_0x91ea('0x33')],function(_0x3da4c7){var _0x1df0fc={};_0x1df0fc[_0x3da4c7]={'$like':'%'+_0x5bb1c8['query'][_0x91ea('0x3a')]+'%'};return _0x1df0fc;})});}_0x4694b3=_[_0x91ea('0x3b')]({},_0x4694b3,_0x5bb1c8[_0x91ea('0x3d')]);return _0x2c1125['getDescriptions'](_0x4694b3);}})[_0x91ea('0x3e')](function(_0xd407a7){if(_0xd407a7){_0x356855=_0xd407a7[_0x91ea('0x35')];if(!_0x5bb1c8[_0x91ea('0x2f')][_0x91ea('0x36')](_0x91ea('0x37'))){_0x4694b3[_0x91ea('0x1a')]=qs[_0x91ea('0x1a')](_0x5bb1c8[_0x91ea('0x2f')][_0x91ea('0x1a')]);_0x4694b3[_0x91ea('0x1d')]=qs[_0x91ea('0x1d')](_0x5bb1c8[_0x91ea('0x2f')]['offset']);}return _0x2c1125[_0x91ea('0x50')](_0x4694b3);}})['then'](function(_0x2e9b40){if(_0x2e9b40){return _0x2e9b40?{'count':_0x356855,'rows':_0x2e9b40}:null;}})[_0x91ea('0x3e')](respondWithResult(_0x32c451,null))[_0x91ea('0x42')](handleError(_0x32c451,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 176708d..e60b036 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 _0xfb5b=['exports','define','int_sugarcrm_configurations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x4ab7a6,_0x32b113){var _0x38d525=function(_0x56886c){while(--_0x56886c){_0x4ab7a6['push'](_0x4ab7a6['shift']());}};_0x38d525(++_0x32b113);}(_0xfb5b,0x183));var _0xbfb5=function(_0x37239d,_0x5a63a9){_0x37239d=_0x37239d-0x0;var _0x3a3ce3=_0xfb5b[_0x37239d];return _0x3a3ce3;};'use strict';var _=require('lodash');var util=require(_0xbfb5('0x0'));var logger=require(_0xbfb5('0x1'))('api');var moment=require(_0xbfb5('0x2'));var BPromise=require(_0xbfb5('0x3'));var rp=require(_0xbfb5('0x4'));var fs=require('fs');var path=require(_0xbfb5('0x5'));var rimraf=require(_0xbfb5('0x6'));var config=require(_0xbfb5('0x7'));var attributes=require(_0xbfb5('0x8'));module[_0xbfb5('0x9')]=function(_0x2c62cd,_0x130ece){return _0x2c62cd[_0xbfb5('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0xbfb5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9420=['./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4409f3,_0x519e47){var _0x574c9e=function(_0x532160){while(--_0x532160){_0x4409f3['push'](_0x4409f3['shift']());}};_0x574c9e(++_0x519e47);}(_0x9420,0x186));var _0x0942=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x9420[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x0942('0x0'));var util=require(_0x0942('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0942('0x2'));var rp=require(_0x0942('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0942('0x4'));var config=require(_0x0942('0x5'));var attributes=require(_0x0942('0x6'));module['exports']=function(_0x1c3900,_0x4b0e31){return _0x1c3900[_0x0942('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x0942('0x8'),'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 bf281c6..4f98221 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 _0xa392=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x3280a2,_0x4a8c8e){var _0x22e7d5=function(_0x38eb06){while(--_0x38eb06){_0x3280a2['push'](_0x3280a2['shift']());}};_0x22e7d5(++_0x4a8c8e);}(_0xa392,0xf1));var _0x2a39=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xa392[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x2a39('0x0'));var util=require('util');var moment=require(_0x2a39('0x1'));var BPromise=require(_0x2a39('0x2'));var rs=require(_0x2a39('0x3'));var fs=require('fs');var Redis=require(_0x2a39('0x4'));var db=require(_0x2a39('0x5'))['db'];var utils=require(_0x2a39('0x6'));var logger=require('../../config/logger')(_0x2a39('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a39('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb1e9fe,_0x2bdd90,_0xacad43){return new BPromise(function(_0xeee8f5,_0x2e600a){return client[_0x2a39('0x9')](_0xb1e9fe,_0xacad43)['then'](function(_0x44c0d8){logger['info'](_0x2a39('0xa'),_0x2bdd90,'request\x20sent');logger[_0x2a39('0xb')](_0x2a39('0xc'),_0x2bdd90,_0x2a39('0xd'),JSON['stringify'](_0x44c0d8));if(_0x44c0d8['error']){if(_0x44c0d8[_0x2a39('0xe')][_0x2a39('0xf')]===0x1f4){logger[_0x2a39('0xe')](_0x2a39('0xa'),_0x2bdd90,_0x44c0d8[_0x2a39('0xe')][_0x2a39('0x10')]);return _0x2e600a(_0x44c0d8[_0x2a39('0xe')][_0x2a39('0x10')]);}logger[_0x2a39('0xe')](_0x2a39('0xa'),_0x2bdd90,_0x44c0d8['error']['message']);return _0xeee8f5(_0x44c0d8[_0x2a39('0xe')][_0x2a39('0x10')]);}else{logger[_0x2a39('0x11')](_0x2a39('0xa'),_0x2bdd90,_0x2a39('0xd'));_0xeee8f5(_0x44c0d8['result'][_0x2a39('0x10')]);}})['catch'](function(_0x530b7d){logger[_0x2a39('0xe')](_0x2a39('0xa'),_0x2bdd90,_0x530b7d);_0x2e600a(_0x530b7d);});});} \ No newline at end of file +var _0xb6cd=['client','http','request','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x326aa1,_0x15c123){var _0x33df24=function(_0xf97931){while(--_0xf97931){_0x326aa1['push'](_0x326aa1['shift']());}};_0x33df24(++_0x15c123);}(_0xb6cd,0x7c));var _0xdb6c=function(_0x4d1958,_0xd24516){_0x4d1958=_0x4d1958-0x0;var _0x2e3631=_0xb6cd[_0x4d1958];return _0x2e3631;};'use strict';var _=require(_0xdb6c('0x0'));var util=require('util');var moment=require(_0xdb6c('0x1'));var BPromise=require(_0xdb6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb6c('0x3'));var db=require(_0xdb6c('0x4'))['db'];var utils=require(_0xdb6c('0x5'));var logger=require('../../config/logger')(_0xdb6c('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb6c('0x7'));var client=jayson[_0xdb6c('0x8')][_0xdb6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x124936,_0xed0650,_0x3c99ed){return new BPromise(function(_0x191ed7,_0x581b1a){return client[_0xdb6c('0xa')](_0x124936,_0x3c99ed)['then'](function(_0x25e2e9){logger[_0xdb6c('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xed0650,'request\x20sent');logger[_0xdb6c('0xc')](_0xdb6c('0xd'),_0xed0650,_0xdb6c('0xe'),JSON[_0xdb6c('0xf')](_0x25e2e9));if(_0x25e2e9[_0xdb6c('0x10')]){if(_0x25e2e9[_0xdb6c('0x10')][_0xdb6c('0x11')]===0x1f4){logger[_0xdb6c('0x10')](_0xdb6c('0x12'),_0xed0650,_0x25e2e9[_0xdb6c('0x10')][_0xdb6c('0x13')]);return _0x581b1a(_0x25e2e9[_0xdb6c('0x10')][_0xdb6c('0x13')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xed0650,_0x25e2e9[_0xdb6c('0x10')][_0xdb6c('0x13')]);return _0x191ed7(_0x25e2e9[_0xdb6c('0x10')][_0xdb6c('0x13')]);}else{logger[_0xdb6c('0xb')](_0xdb6c('0x12'),_0xed0650,_0xdb6c('0xe'));_0x191ed7(_0x25e2e9[_0xdb6c('0x14')][_0xdb6c('0x13')]);}})[_0xdb6c('0x15')](function(_0x2f0197){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xed0650,_0x2f0197);_0x581b1a(_0x2f0197);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b45e9e2..dff732b 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 _0xaec0=['create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xaec0,0x159));var _0x0aec=function(_0x3517c5,_0x4dffd3){_0x3517c5=_0x3517c5-0x0;var _0xc24c28=_0xaec0[_0x3517c5];return _0xc24c28;};'use strict';var multer=require('multer');var util=require(_0x0aec('0x0'));var path=require(_0x0aec('0x1'));var timeout=require(_0x0aec('0x2'));var express=require(_0x0aec('0x3'));var router=express[_0x0aec('0x4')]();var fs_extra=require(_0x0aec('0x5'));var auth=require(_0x0aec('0x6'));var interaction=require(_0x0aec('0x7'));var config=require(_0x0aec('0x8'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0aec('0x9')]);router[_0x0aec('0xa')](_0x0aec('0xb'),auth['isAuthenticated'](),controller[_0x0aec('0xc')]);router[_0x0aec('0xd')]('/',auth[_0x0aec('0xe')](),controller[_0x0aec('0xf')]);router[_0x0aec('0x10')](_0x0aec('0xb'),auth[_0x0aec('0xe')](),controller[_0x0aec('0x11')]);router['delete']('/:id',auth[_0x0aec('0xe')](),controller[_0x0aec('0x12')]);module[_0x0aec('0x13')]=router; \ No newline at end of file +var _0x6390=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x34545f,_0x57509a){var _0x10773a=function(_0xc7a8f0){while(--_0xc7a8f0){_0x34545f['push'](_0x34545f['shift']());}};_0x10773a(++_0x57509a);}(_0x6390,0x1cc));var _0x0639=function(_0x2a7af8,_0x1b69ed){_0x2a7af8=_0x2a7af8-0x0;var _0x24e0f1=_0x6390[_0x2a7af8];return _0x24e0f1;};'use strict';var multer=require(_0x0639('0x0'));var util=require(_0x0639('0x1'));var path=require('path');var timeout=require(_0x0639('0x2'));var express=require(_0x0639('0x3'));var router=express[_0x0639('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0639('0x5'));var interaction=require(_0x0639('0x6'));var config=require(_0x0639('0x7'));var controller=require(_0x0639('0x8'));router['get']('/',auth[_0x0639('0x9')](),controller[_0x0639('0xa')]);router[_0x0639('0xb')](_0x0639('0xc'),auth[_0x0639('0x9')](),controller[_0x0639('0xd')]);router[_0x0639('0xe')]('/',auth[_0x0639('0x9')](),controller['create']);router[_0x0639('0xf')](_0x0639('0xc'),auth[_0x0639('0x9')](),controller[_0x0639('0x10')]);router[_0x0639('0x11')](_0x0639('0xc'),auth[_0x0639('0x9')](),controller[_0x0639('0x12')]);module[_0x0639('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index bb1dca1..adc616a 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 _0x41ec=['string','variable','customVariable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x41f1d2,_0x9c2e6a){var _0x2ad7e0=function(_0x47756a){while(--_0x47756a){_0x41f1d2['push'](_0x41f1d2['shift']());}};_0x2ad7e0(++_0x9c2e6a);}(_0x41ec,0xd1));var _0xc41e=function(_0x4dbbb9,_0x5608cf){_0x4dbbb9=_0x4dbbb9-0x0;var _0x12ced1=_0x41ec[_0x4dbbb9];return _0x12ced1;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc41e('0x0')](_0xc41e('0x1'),_0xc41e('0x2'),_0xc41e('0x3'),_0xc41e('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc41e('0x0')](_0xc41e('0x1'),_0xc41e('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc41e('0x5')]},'customField':{'type':Sequelize[_0xc41e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc41e('0x5')]}}; \ No newline at end of file +var _0xec5f=['string','customVariable','STRING','BOOLEAN','ENUM','variable','keyValue','picklist'];(function(_0x4fc89d,_0x311247){var _0x2c0985=function(_0x3ec5a8){while(--_0x3ec5a8){_0x4fc89d['push'](_0x4fc89d['shift']());}};_0x2c0985(++_0x311247);}(_0xec5f,0x144));var _0xfec5=function(_0x22a877,_0x1e017c){_0x22a877=_0x22a877-0x0;var _0x66edd7=_0xec5f[_0x22a877];return _0x66edd7;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfec5('0x0')]('string',_0xfec5('0x1'),'customVariable',_0xfec5('0x2'),_0xfec5('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfec5('0x0')](_0xfec5('0x4'),_0xfec5('0x1'),_0xfec5('0x5'))},'keyContent':{'type':Sequelize[_0xfec5('0x6')]},'idField':{'type':Sequelize[_0xfec5('0x6')]},'nameField':{'type':Sequelize[_0xfec5('0x6')]},'customField':{'type':Sequelize[_0xfec5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfec5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 91c4afc..016e2e3 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 _0x6a2e=['query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','index','map','SugarcrmField','rawAttributes','fieldName','key','keys','filters','intersection','model'];(function(_0x993277,_0x19f5fc){var _0x43d00e=function(_0x19f4ca){while(--_0x19f4ca){_0x993277['push'](_0x993277['shift']());}};_0x43d00e(++_0x19f5fc);}(_0x6a2e,0x14e));var _0xe6a2=function(_0x3daab8,_0x4fe417){_0x3daab8=_0x3daab8-0x0;var _0x200f4a=_0x6a2e[_0x3daab8];return _0x200f4a;};'use strict';var emlformat=require(_0xe6a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe6a2('0x1'));var jsonpatch=require(_0xe6a2('0x2'));var rp=require(_0xe6a2('0x3'));var moment=require(_0xe6a2('0x4'));var BPromise=require(_0xe6a2('0x5'));var Mustache=require(_0xe6a2('0x6'));var util=require(_0xe6a2('0x7'));var path=require(_0xe6a2('0x8'));var sox=require(_0xe6a2('0x9'));var csv=require(_0xe6a2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6a2('0xb'));var _=require('lodash');var squel=require(_0xe6a2('0xc'));var crypto=require(_0xe6a2('0xd'));var jsforce=require(_0xe6a2('0xe'));var deskjs=require(_0xe6a2('0xf'));var toCsv=require(_0xe6a2('0xa'));var querystring=require(_0xe6a2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe6a2('0x11'));var qs=require(_0xe6a2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6a2('0x13'));var logger=require('../../config/logger')(_0xe6a2('0x14'));var utils=require(_0xe6a2('0x15'));var config=require(_0xe6a2('0x16'));var licenseUtil=require(_0xe6a2('0x17'));var db=require(_0xe6a2('0x18'))['db'];function respondWithStatusCode(_0x3b75c7,_0x667832){_0x667832=_0x667832||0xcc;return function(_0xd48ee8){if(_0xd48ee8){return _0x3b75c7[_0xe6a2('0x19')](_0x667832);}return _0x3b75c7[_0xe6a2('0x1a')](_0x667832)['end']();};}function respondWithResult(_0x4617b0,_0x1c1001){_0x1c1001=_0x1c1001||0xc8;return function(_0x5052e8){if(_0x5052e8){return _0x4617b0[_0xe6a2('0x1a')](_0x1c1001)[_0xe6a2('0x1b')](_0x5052e8);}};}function respondWithFilteredResult(_0x384b66,_0x47943b){return function(_0x4107b7){if(_0x4107b7){var _0x1c0346=typeof _0x47943b[_0xe6a2('0x1c')]===_0xe6a2('0x1d')&&typeof _0x47943b[_0xe6a2('0x1e')]===_0xe6a2('0x1d');var _0x2d86b1=_0x4107b7[_0xe6a2('0x1f')];var _0x294566=_0x1c0346?0x0:_0x47943b[_0xe6a2('0x1c')];var _0x49a28f=_0x1c0346?_0x4107b7[_0xe6a2('0x1f')]:_0x47943b['offset']+_0x47943b[_0xe6a2('0x1e')];var _0x5c734e;if(_0x49a28f>=_0x2d86b1){_0x49a28f=_0x2d86b1;_0x5c734e=0xc8;}else{_0x5c734e=0xce;}_0x384b66[_0xe6a2('0x1a')](_0x5c734e);return _0x384b66[_0xe6a2('0x20')](_0xe6a2('0x21'),_0x294566+'-'+_0x49a28f+'/'+_0x2d86b1)['json'](_0x4107b7);}return null;};}function patchUpdates(_0xb930dc){return function(_0x40ed36){try{jsonpatch[_0xe6a2('0x22')](_0x40ed36,_0xb930dc,!![]);}catch(_0x51be68){return BPromise[_0xe6a2('0x23')](_0x51be68);}return _0x40ed36[_0xe6a2('0x24')]();};}function saveUpdates(_0x12fd9c,_0x4be831){return function(_0x6b4866){if(_0x6b4866){return _0x6b4866['update'](_0x12fd9c)[_0xe6a2('0x25')](function(_0x4df45b){return _0x4df45b;});}return null;};}function removeEntity(_0x4fb1ba,_0x3477e6){return function(_0x385f2e){if(_0x385f2e){return _0x385f2e[_0xe6a2('0x26')]()[_0xe6a2('0x25')](function(){_0x4fb1ba[_0xe6a2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22ffdb,_0x17ade2){return function(_0x5c81df){if(!_0x5c81df){_0x22ffdb[_0xe6a2('0x19')](0x194);}return _0x5c81df;};}function handleError(_0x303978,_0x313cb9){_0x313cb9=_0x313cb9||0x1f4;return function(_0x508f87){logger[_0xe6a2('0x27')](_0x508f87[_0xe6a2('0x28')]);if(_0x508f87['name']){delete _0x508f87['name'];}_0x303978['status'](_0x313cb9)['send'](_0x508f87);};}exports[_0xe6a2('0x29')]=function(_0x27bb68,_0xda9d14){var _0x3a19b4={},_0x2e4d18={},_0xc4786c={'count':0x0,'rows':[]};var _0x1e5a00=_[_0xe6a2('0x2a')](db[_0xe6a2('0x2b')][_0xe6a2('0x2c')],function(_0x585061){return{'name':_0x585061[_0xe6a2('0x2d')],'type':_0x585061['type'][_0xe6a2('0x2e')]};});_0x2e4d18['model']=_['map'](_0x1e5a00,'name');_0x2e4d18['query']=_[_0xe6a2('0x2f')](_0x27bb68['query']);_0x2e4d18[_0xe6a2('0x30')]=_[_0xe6a2('0x31')](_0x2e4d18[_0xe6a2('0x32')],_0x2e4d18[_0xe6a2('0x33')]);_0x3a19b4[_0xe6a2('0x34')]=_[_0xe6a2('0x31')](_0x2e4d18[_0xe6a2('0x32')],qs[_0xe6a2('0x35')](_0x27bb68[_0xe6a2('0x33')][_0xe6a2('0x35')]));_0x3a19b4['attributes']=_0x3a19b4[_0xe6a2('0x34')][_0xe6a2('0x36')]?_0x3a19b4[_0xe6a2('0x34')]:_0x2e4d18[_0xe6a2('0x32')];if(!_0x27bb68[_0xe6a2('0x33')][_0xe6a2('0x37')](_0xe6a2('0x38'))){_0x3a19b4['limit']=qs[_0xe6a2('0x1e')](_0x27bb68[_0xe6a2('0x33')]['limit']);_0x3a19b4[_0xe6a2('0x1c')]=qs[_0xe6a2('0x1c')](_0x27bb68[_0xe6a2('0x33')]['offset']);}_0x3a19b4[_0xe6a2('0x39')]=qs[_0xe6a2('0x3a')](_0x27bb68['query'][_0xe6a2('0x3a')]);_0x3a19b4[_0xe6a2('0x3b')]=qs[_0xe6a2('0x30')](_[_0xe6a2('0x3c')](_0x27bb68['query'],_0x2e4d18[_0xe6a2('0x30')]),_0x1e5a00);if(_0x27bb68[_0xe6a2('0x33')][_0xe6a2('0x3d')]){_0x3a19b4[_0xe6a2('0x3b')]=_['merge'](_0x3a19b4[_0xe6a2('0x3b')],{'$or':_[_0xe6a2('0x2a')](_0x1e5a00,function(_0x5ec52f){if(_0x5ec52f[_0xe6a2('0x3e')]!==_0xe6a2('0x3f')){var _0x5ab9a8={};_0x5ab9a8[_0x5ec52f['name']]={'$like':'%'+_0x27bb68[_0xe6a2('0x33')][_0xe6a2('0x3d')]+'%'};return _0x5ab9a8;}})});}_0x3a19b4=_[_0xe6a2('0x40')]({},_0x3a19b4,_0x27bb68[_0xe6a2('0x41')]);var _0x2b2e49={'where':_0x3a19b4[_0xe6a2('0x3b')]};return db[_0xe6a2('0x2b')][_0xe6a2('0x1f')](_0x2b2e49)[_0xe6a2('0x25')](function(_0x590c93){_0xc4786c[_0xe6a2('0x1f')]=_0x590c93;if(_0x27bb68[_0xe6a2('0x33')][_0xe6a2('0x42')]){_0x3a19b4[_0xe6a2('0x43')]=[{'all':!![]}];}return db[_0xe6a2('0x2b')][_0xe6a2('0x44')](_0x3a19b4);})[_0xe6a2('0x25')](function(_0x28d19c){_0xc4786c[_0xe6a2('0x45')]=_0x28d19c;return _0xc4786c;})[_0xe6a2('0x25')](respondWithFilteredResult(_0xda9d14,_0x3a19b4))[_0xe6a2('0x46')](handleError(_0xda9d14,null));};exports[_0xe6a2('0x47')]=function(_0x5d69ea,_0x370385){var _0x104d2e={'raw':!![],'where':{'id':_0x5d69ea[_0xe6a2('0x48')]['id']}},_0x3f9a27={};_0x3f9a27[_0xe6a2('0x32')]=_[_0xe6a2('0x2f')](db['SugarcrmField'][_0xe6a2('0x2c')]);_0x3f9a27['query']=_[_0xe6a2('0x2f')](_0x5d69ea[_0xe6a2('0x33')]);_0x3f9a27[_0xe6a2('0x30')]=_[_0xe6a2('0x31')](_0x3f9a27[_0xe6a2('0x32')],_0x3f9a27[_0xe6a2('0x33')]);_0x104d2e[_0xe6a2('0x34')]=_[_0xe6a2('0x31')](_0x3f9a27['model'],qs[_0xe6a2('0x35')](_0x5d69ea[_0xe6a2('0x33')][_0xe6a2('0x35')]));_0x104d2e['attributes']=_0x104d2e[_0xe6a2('0x34')][_0xe6a2('0x36')]?_0x104d2e[_0xe6a2('0x34')]:_0x3f9a27[_0xe6a2('0x32')];if(_0x5d69ea[_0xe6a2('0x33')]['includeAll']){_0x104d2e[_0xe6a2('0x43')]=[{'all':!![]}];}_0x104d2e=_['merge']({},_0x104d2e,_0x5d69ea[_0xe6a2('0x41')]);return db[_0xe6a2('0x2b')]['find'](_0x104d2e)[_0xe6a2('0x25')](handleEntityNotFound(_0x370385,null))[_0xe6a2('0x25')](respondWithResult(_0x370385,null))[_0xe6a2('0x46')](handleError(_0x370385,null));};exports[_0xe6a2('0x49')]=function(_0x117e07,_0x3f68e6){return db[_0xe6a2('0x2b')]['create'](_0x117e07[_0xe6a2('0x4a')],{})['then'](respondWithResult(_0x3f68e6,0xc9))[_0xe6a2('0x46')](handleError(_0x3f68e6,null));};exports[_0xe6a2('0x4b')]=function(_0x25202e,_0x30dbb1){if(_0x25202e[_0xe6a2('0x4a')]['id']){delete _0x25202e[_0xe6a2('0x4a')]['id'];}return db[_0xe6a2('0x2b')][_0xe6a2('0x4c')]({'where':{'id':_0x25202e[_0xe6a2('0x48')]['id']}})[_0xe6a2('0x25')](handleEntityNotFound(_0x30dbb1,null))[_0xe6a2('0x25')](saveUpdates(_0x25202e[_0xe6a2('0x4a')],null))[_0xe6a2('0x25')](respondWithResult(_0x30dbb1,null))[_0xe6a2('0x46')](handleError(_0x30dbb1,null));};exports[_0xe6a2('0x26')]=function(_0x4a0d0f,_0x6b631c){return db[_0xe6a2('0x2b')][_0xe6a2('0x4c')]({'where':{'id':_0x4a0d0f[_0xe6a2('0x48')]['id']}})[_0xe6a2('0x25')](handleEntityNotFound(_0x6b631c,null))[_0xe6a2('0x25')](removeEntity(_0x6b631c,null))[_0xe6a2('0x46')](handleError(_0x6b631c,null));}; \ No newline at end of file +var _0xa994=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','SugarcrmField','rows','catch','show','params','keys','rawAttributes','filters','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x34bfde,_0x26c5d6){var _0xdf7c64=function(_0x371d48){while(--_0x371d48){_0x34bfde['push'](_0x34bfde['shift']());}};_0xdf7c64(++_0x26c5d6);}(_0xa994,0x1a0));var _0x4a99=function(_0x16d666,_0x289c38){_0x16d666=_0x16d666-0x0;var _0x570238=_0xa994[_0x16d666];return _0x570238;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a99('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a99('0x1'));var rp=require(_0x4a99('0x2'));var moment=require(_0x4a99('0x3'));var BPromise=require(_0x4a99('0x4'));var Mustache=require(_0x4a99('0x5'));var util=require('util');var path=require(_0x4a99('0x6'));var sox=require(_0x4a99('0x7'));var csv=require(_0x4a99('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a99('0x9'));var squel=require(_0x4a99('0xa'));var crypto=require(_0x4a99('0xb'));var jsforce=require(_0x4a99('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4a99('0xd'));var Papa=require(_0x4a99('0xe'));var Redis=require(_0x4a99('0xf'));var authService=require(_0x4a99('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4a99('0x11'));var hardwareService=require(_0x4a99('0x12'));var logger=require(_0x4a99('0x13'))(_0x4a99('0x14'));var utils=require(_0x4a99('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4a99('0x16'))['db'];function respondWithStatusCode(_0x429d46,_0x25b462){_0x25b462=_0x25b462||0xcc;return function(_0x56b6c0){if(_0x56b6c0){return _0x429d46[_0x4a99('0x17')](_0x25b462);}return _0x429d46[_0x4a99('0x18')](_0x25b462)['end']();};}function respondWithResult(_0xbef60c,_0x1e154a){_0x1e154a=_0x1e154a||0xc8;return function(_0x41f6f){if(_0x41f6f){return _0xbef60c[_0x4a99('0x18')](_0x1e154a)[_0x4a99('0x19')](_0x41f6f);}};}function respondWithFilteredResult(_0x3f07c6,_0x272ccf){return function(_0x537e18){if(_0x537e18){var _0x33738c=typeof _0x272ccf[_0x4a99('0x1a')]===_0x4a99('0x1b')&&typeof _0x272ccf[_0x4a99('0x1c')]==='undefined';var _0x481ab2=_0x537e18[_0x4a99('0x1d')];var _0x503743=_0x33738c?0x0:_0x272ccf[_0x4a99('0x1a')];var _0x33d7b3=_0x33738c?_0x537e18[_0x4a99('0x1d')]:_0x272ccf[_0x4a99('0x1a')]+_0x272ccf[_0x4a99('0x1c')];var _0x340a9b;if(_0x33d7b3>=_0x481ab2){_0x33d7b3=_0x481ab2;_0x340a9b=0xc8;}else{_0x340a9b=0xce;}_0x3f07c6[_0x4a99('0x18')](_0x340a9b);return _0x3f07c6[_0x4a99('0x1e')]('Content-Range',_0x503743+'-'+_0x33d7b3+'/'+_0x481ab2)[_0x4a99('0x19')](_0x537e18);}return null;};}function patchUpdates(_0x172790){return function(_0x16b3d4){try{jsonpatch[_0x4a99('0x1f')](_0x16b3d4,_0x172790,!![]);}catch(_0x46f38c){return BPromise[_0x4a99('0x20')](_0x46f38c);}return _0x16b3d4[_0x4a99('0x21')]();};}function saveUpdates(_0x293b31,_0x542b82){return function(_0x366a3e){if(_0x366a3e){return _0x366a3e[_0x4a99('0x22')](_0x293b31)['then'](function(_0x1f7660){return _0x1f7660;});}return null;};}function removeEntity(_0x249caa,_0x2f5923){return function(_0x2d498b){if(_0x2d498b){return _0x2d498b['destroy']()[_0x4a99('0x23')](function(){_0x249caa['status'](0xcc)[_0x4a99('0x24')]();});}};}function handleEntityNotFound(_0x57f720,_0x575e3f){return function(_0x5271ae){if(!_0x5271ae){_0x57f720[_0x4a99('0x17')](0x194);}return _0x5271ae;};}function handleError(_0x450686,_0x311c8c){_0x311c8c=_0x311c8c||0x1f4;return function(_0x3933ae){logger[_0x4a99('0x25')](_0x3933ae['stack']);if(_0x3933ae[_0x4a99('0x26')]){delete _0x3933ae[_0x4a99('0x26')];}_0x450686[_0x4a99('0x18')](_0x311c8c)[_0x4a99('0x27')](_0x3933ae);};}exports[_0x4a99('0x28')]=function(_0x4a9fff,_0x3fc132){var _0x3181f9={},_0x394473={},_0xcf2393={'count':0x0,'rows':[]};var _0x23fe8d=_[_0x4a99('0x29')](db['SugarcrmField']['rawAttributes'],function(_0x5d295d){return{'name':_0x5d295d[_0x4a99('0x2a')],'type':_0x5d295d[_0x4a99('0x2b')][_0x4a99('0x2c')]};});_0x394473[_0x4a99('0x2d')]=_[_0x4a99('0x29')](_0x23fe8d,_0x4a99('0x26'));_0x394473[_0x4a99('0x2e')]=_['keys'](_0x4a9fff['query']);_0x394473['filters']=_[_0x4a99('0x2f')](_0x394473[_0x4a99('0x2d')],_0x394473[_0x4a99('0x2e')]);_0x3181f9[_0x4a99('0x30')]=_[_0x4a99('0x2f')](_0x394473[_0x4a99('0x2d')],qs[_0x4a99('0x31')](_0x4a9fff['query'][_0x4a99('0x31')]));_0x3181f9[_0x4a99('0x30')]=_0x3181f9['attributes'][_0x4a99('0x32')]?_0x3181f9[_0x4a99('0x30')]:_0x394473['model'];if(!_0x4a9fff[_0x4a99('0x2e')][_0x4a99('0x33')]('nolimit')){_0x3181f9['limit']=qs[_0x4a99('0x1c')](_0x4a9fff['query'][_0x4a99('0x1c')]);_0x3181f9[_0x4a99('0x1a')]=qs[_0x4a99('0x1a')](_0x4a9fff[_0x4a99('0x2e')][_0x4a99('0x1a')]);}_0x3181f9[_0x4a99('0x34')]=qs[_0x4a99('0x35')](_0x4a9fff[_0x4a99('0x2e')][_0x4a99('0x35')]);_0x3181f9[_0x4a99('0x36')]=qs['filters'](_[_0x4a99('0x37')](_0x4a9fff[_0x4a99('0x2e')],_0x394473['filters']),_0x23fe8d);if(_0x4a9fff[_0x4a99('0x2e')]['filter']){_0x3181f9[_0x4a99('0x36')]=_[_0x4a99('0x38')](_0x3181f9[_0x4a99('0x36')],{'$or':_['map'](_0x23fe8d,function(_0x8a3f62){if(_0x8a3f62[_0x4a99('0x2b')]!=='VIRTUAL'){var _0x431c88={};_0x431c88[_0x8a3f62['name']]={'$like':'%'+_0x4a9fff[_0x4a99('0x2e')][_0x4a99('0x39')]+'%'};return _0x431c88;}})});}_0x3181f9=_[_0x4a99('0x38')]({},_0x3181f9,_0x4a9fff['options']);var _0x5ca050={'where':_0x3181f9[_0x4a99('0x36')]};return db['SugarcrmField'][_0x4a99('0x1d')](_0x5ca050)['then'](function(_0x57d9a1){_0xcf2393[_0x4a99('0x1d')]=_0x57d9a1;if(_0x4a9fff['query'][_0x4a99('0x3a')]){_0x3181f9[_0x4a99('0x3b')]=[{'all':!![]}];}return db[_0x4a99('0x3c')]['findAll'](_0x3181f9);})['then'](function(_0x2d4803){_0xcf2393[_0x4a99('0x3d')]=_0x2d4803;return _0xcf2393;})[_0x4a99('0x23')](respondWithFilteredResult(_0x3fc132,_0x3181f9))[_0x4a99('0x3e')](handleError(_0x3fc132,null));};exports[_0x4a99('0x3f')]=function(_0x4cb2a9,_0xe91982){var _0x40a77c={'raw':!![],'where':{'id':_0x4cb2a9[_0x4a99('0x40')]['id']}},_0x12f232={};_0x12f232[_0x4a99('0x2d')]=_[_0x4a99('0x41')](db[_0x4a99('0x3c')][_0x4a99('0x42')]);_0x12f232[_0x4a99('0x2e')]=_[_0x4a99('0x41')](_0x4cb2a9[_0x4a99('0x2e')]);_0x12f232[_0x4a99('0x43')]=_[_0x4a99('0x2f')](_0x12f232[_0x4a99('0x2d')],_0x12f232[_0x4a99('0x2e')]);_0x40a77c['attributes']=_[_0x4a99('0x2f')](_0x12f232[_0x4a99('0x2d')],qs[_0x4a99('0x31')](_0x4cb2a9['query']['fields']));_0x40a77c[_0x4a99('0x30')]=_0x40a77c[_0x4a99('0x30')]['length']?_0x40a77c[_0x4a99('0x30')]:_0x12f232[_0x4a99('0x2d')];if(_0x4cb2a9[_0x4a99('0x2e')][_0x4a99('0x3a')]){_0x40a77c[_0x4a99('0x3b')]=[{'all':!![]}];}_0x40a77c=_[_0x4a99('0x38')]({},_0x40a77c,_0x4cb2a9[_0x4a99('0x44')]);return db[_0x4a99('0x3c')][_0x4a99('0x45')](_0x40a77c)[_0x4a99('0x23')](handleEntityNotFound(_0xe91982,null))['then'](respondWithResult(_0xe91982,null))[_0x4a99('0x3e')](handleError(_0xe91982,null));};exports[_0x4a99('0x46')]=function(_0x2ed0da,_0x496a53){return db[_0x4a99('0x3c')][_0x4a99('0x46')](_0x2ed0da[_0x4a99('0x47')],{})['then'](respondWithResult(_0x496a53,0xc9))[_0x4a99('0x3e')](handleError(_0x496a53,null));};exports['update']=function(_0x4a3b1a,_0x504566){if(_0x4a3b1a[_0x4a99('0x47')]['id']){delete _0x4a3b1a[_0x4a99('0x47')]['id'];}return db['SugarcrmField'][_0x4a99('0x45')]({'where':{'id':_0x4a3b1a[_0x4a99('0x40')]['id']}})[_0x4a99('0x23')](handleEntityNotFound(_0x504566,null))['then'](saveUpdates(_0x4a3b1a[_0x4a99('0x47')],null))[_0x4a99('0x23')](respondWithResult(_0x504566,null))[_0x4a99('0x3e')](handleError(_0x504566,null));};exports['destroy']=function(_0xc99a52,_0x13b85a){return db[_0x4a99('0x3c')]['find']({'where':{'id':_0xc99a52[_0x4a99('0x40')]['id']}})['then'](handleEntityNotFound(_0x13b85a,null))[_0x4a99('0x23')](removeEntity(_0x13b85a,null))[_0x4a99('0x3e')](handleError(_0x13b85a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 79cd1ae..da8b973 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 _0xd899=['../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1c852c,_0x113e2d){var _0x5037f4=function(_0x1b93d1){while(--_0x1b93d1){_0x1c852c['push'](_0x1c852c['shift']());}};_0x5037f4(++_0x113e2d);}(_0xd899,0x1a9));var _0x9d89=function(_0x5130f8,_0x43eb19){_0x5130f8=_0x5130f8-0x0;var _0x38e6f7=_0xd899[_0x5130f8];return _0x38e6f7;};'use strict';var _=require('lodash');var util=require(_0x9d89('0x0'));var logger=require(_0x9d89('0x1'))(_0x9d89('0x2'));var moment=require('moment');var BPromise=require(_0x9d89('0x3'));var rp=require(_0x9d89('0x4'));var fs=require('fs');var path=require(_0x9d89('0x5'));var rimraf=require(_0x9d89('0x6'));var config=require(_0x9d89('0x7'));var attributes=require(_0x9d89('0x8'));module[_0x9d89('0x9')]=function(_0x18aebc,_0x16a7a7){return _0x18aebc[_0x9d89('0xa')](_0x9d89('0xb'),attributes,{'tableName':_0x9d89('0xc'),'paranoid':![],'indexes':[{'name':_0x9d89('0xd'),'fields':[_0x9d89('0xe'),_0x9d89('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6628=['FieldId','lodash','util','api','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','idField'];(function(_0x8c7f5d,_0x526d24){var _0x4614bb=function(_0x599225){while(--_0x599225){_0x8c7f5d['push'](_0x8c7f5d['shift']());}};_0x4614bb(++_0x526d24);}(_0x6628,0xaa));var _0x8662=function(_0x583133,_0x237d8e){_0x583133=_0x583133-0x0;var _0xc91a6d=_0x6628[_0x583133];return _0xc91a6d;};'use strict';var _=require(_0x8662('0x0'));var util=require(_0x8662('0x1'));var logger=require('../../config/logger')(_0x8662('0x2'));var moment=require(_0x8662('0x3'));var BPromise=require(_0x8662('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8662('0x5'));var rimraf=require(_0x8662('0x6'));var config=require('../../config/environment');var attributes=require(_0x8662('0x7'));module[_0x8662('0x8')]=function(_0x744a80,_0x69d200){return _0x744a80[_0x8662('0x9')](_0x8662('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x8662('0xb'),_0x8662('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index def71fa..a4fa43c 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 _0x70d9=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x12d44c,_0xf11296){var _0x4fde20=function(_0x3c1ad6){while(--_0x3c1ad6){_0x12d44c['push'](_0x12d44c['shift']());}};_0x4fde20(++_0xf11296);}(_0x70d9,0x1a2));var _0x970d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x70d9[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x970d('0x0'));var util=require(_0x970d('0x1'));var moment=require(_0x970d('0x2'));var BPromise=require(_0x970d('0x3'));var rs=require(_0x970d('0x4'));var fs=require('fs');var Redis=require(_0x970d('0x5'));var db=require(_0x970d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x970d('0x7'));var config=require('../../config/environment');var jayson=require(_0x970d('0x8'));var client=jayson[_0x970d('0x9')][_0x970d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aaa57,_0x283947,_0x638e57){return new BPromise(function(_0x2d8084,_0x3c3fe6){return client[_0x970d('0xb')](_0x4aaa57,_0x638e57)[_0x970d('0xc')](function(_0x4ae670){logger[_0x970d('0xd')](_0x970d('0xe'),_0x283947,_0x970d('0xf'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x283947,'request\x20sent',JSON[_0x970d('0x10')](_0x4ae670));if(_0x4ae670[_0x970d('0x11')]){if(_0x4ae670[_0x970d('0x11')]['code']===0x1f4){logger['error'](_0x970d('0xe'),_0x283947,_0x4ae670[_0x970d('0x11')][_0x970d('0x12')]);return _0x3c3fe6(_0x4ae670['error'][_0x970d('0x12')]);}logger[_0x970d('0x11')](_0x970d('0xe'),_0x283947,_0x4ae670[_0x970d('0x11')][_0x970d('0x12')]);return _0x2d8084(_0x4ae670[_0x970d('0x11')][_0x970d('0x12')]);}else{logger[_0x970d('0xd')](_0x970d('0xe'),_0x283947,_0x970d('0xf'));_0x2d8084(_0x4ae670[_0x970d('0x13')][_0x970d('0x12')]);}})[_0x970d('0x14')](function(_0x1e86f3){logger[_0x970d('0x11')](_0x970d('0xe'),_0x283947,_0x1e86f3);_0x3c3fe6(_0x1e86f3);});});} \ No newline at end of file +var _0x43b6=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','result'];(function(_0x10191d,_0x438b48){var _0x3c201e=function(_0x5a257d){while(--_0x5a257d){_0x10191d['push'](_0x10191d['shift']());}};_0x3c201e(++_0x438b48);}(_0x43b6,0x1cf));var _0x643b=function(_0x1df3e5,_0x2d37f1){_0x1df3e5=_0x1df3e5-0x0;var _0x422d0c=_0x43b6[_0x1df3e5];return _0x422d0c;};'use strict';var _=require(_0x643b('0x0'));var util=require('util');var moment=require(_0x643b('0x1'));var BPromise=require(_0x643b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x643b('0x3'));var db=require(_0x643b('0x4'))['db'];var utils=require(_0x643b('0x5'));var logger=require(_0x643b('0x6'))(_0x643b('0x7'));var config=require('../../config/environment');var jayson=require(_0x643b('0x8'));var client=jayson['client'][_0x643b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b26a2,_0x405766,_0x2bd212){return new BPromise(function(_0x41a018,_0x986e35){return client[_0x643b('0xa')](_0x4b26a2,_0x2bd212)[_0x643b('0xb')](function(_0x162e59){logger[_0x643b('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x405766,_0x643b('0xd'));logger[_0x643b('0xe')](_0x643b('0xf'),_0x405766,_0x643b('0xd'),JSON['stringify'](_0x162e59));if(_0x162e59['error']){if(_0x162e59[_0x643b('0x10')][_0x643b('0x11')]===0x1f4){logger['error'](_0x643b('0x12'),_0x405766,_0x162e59['error'][_0x643b('0x13')]);return _0x986e35(_0x162e59['error'][_0x643b('0x13')]);}logger[_0x643b('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x405766,_0x162e59[_0x643b('0x10')][_0x643b('0x13')]);return _0x41a018(_0x162e59[_0x643b('0x10')][_0x643b('0x13')]);}else{logger[_0x643b('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x405766,_0x643b('0xd'));_0x41a018(_0x162e59[_0x643b('0x14')][_0x643b('0x13')]);}})[_0x643b('0x15')](function(_0x46af0a){logger[_0x643b('0x10')](_0x643b('0x12'),_0x405766,_0x46af0a);_0x986e35(_0x46af0a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6729808..5df74e2 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 _0xc23a=['exports','util','path','connect-timeout','Router','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','destroy'];(function(_0x3d3586,_0x2b693d){var _0x201c74=function(_0x2ffef7){while(--_0x2ffef7){_0x3d3586['push'](_0x3d3586['shift']());}};_0x201c74(++_0x2b693d);}(_0xc23a,0xd2));var _0xac23=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xc23a[_0xfc0976];return _0x23579f;};'use strict';var multer=require('multer');var util=require(_0xac23('0x0'));var path=require(_0xac23('0x1'));var timeout=require(_0xac23('0x2'));var express=require('express');var router=express[_0xac23('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac23('0x4'));var config=require('../../config/environment');var controller=require(_0xac23('0x5'));router[_0xac23('0x6')]('/',auth[_0xac23('0x7')](),controller['index']);router['get'](_0xac23('0x8'),auth[_0xac23('0x7')](),controller[_0xac23('0x9')]);router['get'](_0xac23('0xa'),auth[_0xac23('0x7')](),controller[_0xac23('0xb')]);router[_0xac23('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xac23('0xc')]('/',auth[_0xac23('0x7')](),controller['create']);router[_0xac23('0xc')](_0xac23('0xa'),auth[_0xac23('0x7')](),controller[_0xac23('0xd')]);router[_0xac23('0xe')](_0xac23('0x8'),auth[_0xac23('0x7')](),controller[_0xac23('0xf')]);router[_0xac23('0x10')](_0xac23('0x8'),auth['isAuthenticated'](),controller[_0xac23('0x11')]);module[_0xac23('0x12')]=router; \ No newline at end of file +var _0x899a=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x899a,0x1b6));var _0xa899=function(_0x6e642b,_0x2dcb2d){_0x6e642b=_0x6e642b-0x0;var _0xd2ece0=_0x899a[_0x6e642b];return _0xd2ece0;};'use strict';var multer=require(_0xa899('0x0'));var util=require(_0xa899('0x1'));var path=require('path');var timeout=require(_0xa899('0x2'));var express=require(_0xa899('0x3'));var router=express['Router']();var fs_extra=require(_0xa899('0x4'));var auth=require(_0xa899('0x5'));var interaction=require(_0xa899('0x6'));var config=require(_0xa899('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xa899('0x8')]('/',auth[_0xa899('0x9')](),controller[_0xa899('0xa')]);router[_0xa899('0x8')]('/:id',auth[_0xa899('0x9')](),controller[_0xa899('0xb')]);router[_0xa899('0x8')](_0xa899('0xc'),auth[_0xa899('0x9')](),controller[_0xa899('0xd')]);router[_0xa899('0x8')](_0xa899('0xe'),auth[_0xa899('0x9')](),controller[_0xa899('0xf')]);router['post']('/',auth[_0xa899('0x9')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xa899('0x10')]);router[_0xa899('0x11')](_0xa899('0x12'),auth['isAuthenticated'](),controller[_0xa899('0x13')]);router[_0xa899('0x14')]('/:id',auth[_0xa899('0x9')](),controller[_0xa899('0x15')]);module[_0xa899('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2559c47..0217fad 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 _0x38c6=['HelpDesk','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x38c6,0x125));var _0x638c=function(_0x402e79,_0x54c19a){_0x402e79=_0x402e79-0x0;var _0x62a5d8=_0x38c6[_0x402e79];return _0x62a5d8;};'use strict';var Sequelize=require(_0x638c('0x0'));module[_0x638c('0x1')]={'name':{'type':Sequelize[_0x638c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x638c('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x638c('0x2')],'allowNull':![],'defaultValue':_0x638c('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x638c('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x638c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe954=['STRING','HelpDesk','sequelize','exports'];(function(_0x294377,_0xf59d76){var _0x88f321=function(_0x1d90ec){while(--_0x1d90ec){_0x294377['push'](_0x294377['shift']());}};_0x88f321(++_0xf59d76);}(_0xe954,0x13a));var _0x4e95=function(_0x31a44d,_0x4173d4){_0x31a44d=_0x31a44d-0x0;var _0x2091f1=_0xe954[_0x31a44d];return _0x2091f1;};'use strict';var Sequelize=require(_0x4e95('0x0'));module[_0x4e95('0x1')]={'name':{'type':Sequelize[_0x4e95('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4e95('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4e95('0x2')],'allowNull':![],'defaultValue':_0x4e95('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4e95('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4e95('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index d5becb7..d69b29a 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 _0xb57b=['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','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','VIRTUAL','VtigerAccount','findAll','rows','catch','show','params','include','options','find','create','body','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','findOne','username','description','moduleName','remoteUri','accessKey','slice','substring','format','%s/webservice.php','getchallenge','success','login','result','token','GET','describe','sessionName','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x1964b0,_0x5dca2f){var _0x246b4a=function(_0x353689){while(--_0x353689){_0x1964b0['push'](_0x1964b0['shift']());}};_0x246b4a(++_0x5dca2f);}(_0xb57b,0x1eb));var _0xbb57=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb57b[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb57('0x0'));var zipdir=require(_0xbb57('0x1'));var jsonpatch=require(_0xbb57('0x2'));var rp=require(_0xbb57('0x3'));var moment=require(_0xbb57('0x4'));var BPromise=require(_0xbb57('0x5'));var Mustache=require('mustache');var util=require(_0xbb57('0x6'));var path=require(_0xbb57('0x7'));var sox=require(_0xbb57('0x8'));var csv=require(_0xbb57('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb57('0xa'));var _=require(_0xbb57('0xb'));var squel=require('squel');var crypto=require(_0xbb57('0xc'));var jsforce=require(_0xbb57('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbb57('0x9'));var querystring=require('querystring');var Papa=require(_0xbb57('0xe'));var Redis=require(_0xbb57('0xf'));var authService=require(_0xbb57('0x10'));var qs=require(_0xbb57('0x11'));var as=require(_0xbb57('0x12'));var hardwareService=require(_0xbb57('0x13'));var logger=require(_0xbb57('0x14'))(_0xbb57('0x15'));var utils=require(_0xbb57('0x16'));var config=require(_0xbb57('0x17'));var licenseUtil=require(_0xbb57('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbb57('0x19'));function respondWithStatusCode(_0x34b8cc,_0x1894ca){_0x1894ca=_0x1894ca||0xcc;return function(_0x242363){if(_0x242363){return _0x34b8cc[_0xbb57('0x1a')](_0x1894ca);}return _0x34b8cc[_0xbb57('0x1b')](_0x1894ca)['end']();};}function respondWithResult(_0x50c309,_0x3d633e){_0x3d633e=_0x3d633e||0xc8;return function(_0x3142c3){if(_0x3142c3){return _0x50c309[_0xbb57('0x1b')](_0x3d633e)[_0xbb57('0x1c')](_0x3142c3);}};}function respondWithFilteredResult(_0x436a62,_0x26aaa8){return function(_0x55b31a){if(_0x55b31a){var _0x35afb0=typeof _0x26aaa8[_0xbb57('0x1d')]===_0xbb57('0x1e')&&typeof _0x26aaa8[_0xbb57('0x1f')]===_0xbb57('0x1e');var _0x247f48=_0x55b31a[_0xbb57('0x20')];var _0x5bfbb8=_0x35afb0?0x0:_0x26aaa8[_0xbb57('0x1d')];var _0x1c3edb=_0x35afb0?_0x55b31a[_0xbb57('0x20')]:_0x26aaa8['offset']+_0x26aaa8[_0xbb57('0x1f')];var _0xc77c54;if(_0x1c3edb>=_0x247f48){_0x1c3edb=_0x247f48;_0xc77c54=0xc8;}else{_0xc77c54=0xce;}_0x436a62[_0xbb57('0x1b')](_0xc77c54);return _0x436a62[_0xbb57('0x21')](_0xbb57('0x22'),_0x5bfbb8+'-'+_0x1c3edb+'/'+_0x247f48)[_0xbb57('0x1c')](_0x55b31a);}return null;};}function patchUpdates(_0x573eca){return function(_0x765d4b){try{jsonpatch[_0xbb57('0x23')](_0x765d4b,_0x573eca,!![]);}catch(_0x29a8ee){return BPromise[_0xbb57('0x24')](_0x29a8ee);}return _0x765d4b[_0xbb57('0x25')]();};}function saveUpdates(_0x4913fc,_0x48a17e){return function(_0x424992){if(_0x424992){return _0x424992[_0xbb57('0x26')](_0x4913fc)['then'](function(_0x123d1a){return _0x123d1a;});}return null;};}function removeEntity(_0x580436,_0x891c34){return function(_0x2c2e82){if(_0x2c2e82){return _0x2c2e82[_0xbb57('0x27')]()[_0xbb57('0x28')](function(){_0x580436[_0xbb57('0x1b')](0xcc)[_0xbb57('0x29')]();});}};}function handleEntityNotFound(_0x2d37be,_0x522901){return function(_0x101eea){if(!_0x101eea){_0x2d37be[_0xbb57('0x1a')](0x194);}return _0x101eea;};}function handleError(_0x258ce4,_0x334885){_0x334885=_0x334885||0x1f4;return function(_0x330541){logger[_0xbb57('0x2a')](_0x330541[_0xbb57('0x2b')]);if(_0x330541[_0xbb57('0x2c')]){delete _0x330541[_0xbb57('0x2c')];}_0x258ce4[_0xbb57('0x1b')](_0x334885)[_0xbb57('0x2d')](_0x330541);};}exports['index']=function(_0x9e375c,_0x46cab9){var _0x4d3e49={},_0x14f382={},_0x1da940={'count':0x0,'rows':[]};var _0x273d13=_['map'](db['VtigerAccount'][_0xbb57('0x2e')],function(_0x19268b){return{'name':_0x19268b[_0xbb57('0x2f')],'type':_0x19268b['type'][_0xbb57('0x30')]};});_0x14f382['model']=_['map'](_0x273d13,_0xbb57('0x2c'));_0x14f382['query']=_[_0xbb57('0x31')](_0x9e375c['query']);_0x14f382['filters']=_[_0xbb57('0x32')](_0x14f382[_0xbb57('0x33')],_0x14f382[_0xbb57('0x34')]);_0x4d3e49[_0xbb57('0x35')]=_[_0xbb57('0x32')](_0x14f382['model'],qs['fields'](_0x9e375c[_0xbb57('0x34')][_0xbb57('0x36')]));_0x4d3e49['attributes']=_0x4d3e49['attributes'][_0xbb57('0x37')]?_0x4d3e49[_0xbb57('0x35')]:_0x14f382['model'];if(!_0x9e375c[_0xbb57('0x34')][_0xbb57('0x38')](_0xbb57('0x39'))){_0x4d3e49[_0xbb57('0x1f')]=qs['limit'](_0x9e375c[_0xbb57('0x34')][_0xbb57('0x1f')]);_0x4d3e49[_0xbb57('0x1d')]=qs['offset'](_0x9e375c[_0xbb57('0x34')][_0xbb57('0x1d')]);}_0x4d3e49[_0xbb57('0x3a')]=qs[_0xbb57('0x3b')](_0x9e375c[_0xbb57('0x34')]['sort']);_0x4d3e49[_0xbb57('0x3c')]=qs[_0xbb57('0x3d')](_['pick'](_0x9e375c['query'],_0x14f382['filters']),_0x273d13);if(_0x9e375c[_0xbb57('0x34')][_0xbb57('0x3e')]){_0x4d3e49['where']=_[_0xbb57('0x3f')](_0x4d3e49[_0xbb57('0x3c')],{'$or':_[_0xbb57('0x40')](_0x273d13,function(_0xab466a){if(_0xab466a[_0xbb57('0x41')]!==_0xbb57('0x42')){var _0x19d5c4={};_0x19d5c4[_0xab466a[_0xbb57('0x2c')]]={'$like':'%'+_0x9e375c['query'][_0xbb57('0x3e')]+'%'};return _0x19d5c4;}})});}_0x4d3e49=_[_0xbb57('0x3f')]({},_0x4d3e49,_0x9e375c['options']);var _0x54c3f2={'where':_0x4d3e49[_0xbb57('0x3c')]};return db[_0xbb57('0x43')]['count'](_0x54c3f2)[_0xbb57('0x28')](function(_0x2d8137){_0x1da940[_0xbb57('0x20')]=_0x2d8137;if(_0x9e375c[_0xbb57('0x34')]['includeAll']){_0x4d3e49['include']=[{'all':!![]}];}return db[_0xbb57('0x43')][_0xbb57('0x44')](_0x4d3e49);})[_0xbb57('0x28')](function(_0x288740){_0x1da940[_0xbb57('0x45')]=_0x288740;return _0x1da940;})[_0xbb57('0x28')](respondWithFilteredResult(_0x46cab9,_0x4d3e49))[_0xbb57('0x46')](handleError(_0x46cab9,null));};exports[_0xbb57('0x47')]=function(_0x2ede70,_0x3c0474){var _0x131065={'raw':![],'where':{'id':_0x2ede70[_0xbb57('0x48')]['id']}},_0x49af8c={};_0x49af8c[_0xbb57('0x33')]=_[_0xbb57('0x31')](db['VtigerAccount'][_0xbb57('0x2e')]);_0x49af8c[_0xbb57('0x34')]=_['keys'](_0x2ede70[_0xbb57('0x34')]);_0x49af8c[_0xbb57('0x3d')]=_['intersection'](_0x49af8c['model'],_0x49af8c['query']);_0x131065['attributes']=_[_0xbb57('0x32')](_0x49af8c[_0xbb57('0x33')],qs['fields'](_0x2ede70['query'][_0xbb57('0x36')]));_0x131065[_0xbb57('0x35')]=_0x131065[_0xbb57('0x35')]['length']?_0x131065[_0xbb57('0x35')]:_0x49af8c[_0xbb57('0x33')];if(_0x2ede70['query']['includeAll']){_0x131065[_0xbb57('0x49')]=[{'all':!![]}];}_0x131065=_['merge']({},_0x131065,_0x2ede70[_0xbb57('0x4a')]);return db[_0xbb57('0x43')][_0xbb57('0x4b')](_0x131065)[_0xbb57('0x28')](handleEntityNotFound(_0x3c0474,null))['then'](respondWithResult(_0x3c0474,null))[_0xbb57('0x46')](handleError(_0x3c0474,null));};exports[_0xbb57('0x4c')]=function(_0x44eef8,_0x195d45){return db[_0xbb57('0x43')][_0xbb57('0x4c')](_0x44eef8[_0xbb57('0x4d')],{})[_0xbb57('0x28')](respondWithResult(_0x195d45,0xc9))[_0xbb57('0x46')](handleError(_0x195d45,null));};exports['update']=function(_0x5047fd,_0x55ee4b){if(_0x5047fd['body']['id']){delete _0x5047fd['body']['id'];}return db[_0xbb57('0x43')][_0xbb57('0x4b')]({'where':{'id':_0x5047fd[_0xbb57('0x48')]['id']}})[_0xbb57('0x28')](handleEntityNotFound(_0x55ee4b,null))[_0xbb57('0x28')](saveUpdates(_0x5047fd['body'],null))[_0xbb57('0x28')](respondWithResult(_0x55ee4b,null))[_0xbb57('0x46')](handleError(_0x55ee4b,null));};exports[_0xbb57('0x27')]=function(_0x262d74,_0x43c280){return db[_0xbb57('0x43')]['find']({'where':{'id':_0x262d74[_0xbb57('0x48')]['id']}})['then'](handleEntityNotFound(_0x43c280,null))[_0xbb57('0x28')](removeEntity(_0x43c280,null))[_0xbb57('0x46')](handleError(_0x43c280,null));};exports['getConfigurations']=function(_0x1f5d80,_0x10c5e0,_0x4f0d51){var _0x1023cc={};var _0x3fa8fc={};var _0x3659a7;var _0x1a6161;return db[_0xbb57('0x43')]['findOne']({'where':{'id':_0x1f5d80[_0xbb57('0x48')]['id']}})[_0xbb57('0x28')](handleEntityNotFound(_0x10c5e0,null))[_0xbb57('0x28')](function(_0x19c170){if(_0x19c170){_0x3659a7=_0x19c170;_0x3fa8fc[_0xbb57('0x33')]=_[_0xbb57('0x31')](db['VtigerConfiguration'][_0xbb57('0x2e')]);_0x3fa8fc[_0xbb57('0x34')]=_[_0xbb57('0x31')](_0x1f5d80[_0xbb57('0x34')]);_0x3fa8fc['filters']=_[_0xbb57('0x32')](_0x3fa8fc[_0xbb57('0x33')],_0x3fa8fc['query']);_0x1023cc[_0xbb57('0x35')]=_[_0xbb57('0x32')](_0x3fa8fc[_0xbb57('0x33')],qs[_0xbb57('0x36')](_0x1f5d80['query']['fields']));_0x1023cc[_0xbb57('0x35')]=_0x1023cc[_0xbb57('0x35')]['length']?_0x1023cc[_0xbb57('0x35')]:_0x3fa8fc['model'];_0x1023cc['order']=qs['sort'](_0x1f5d80['query'][_0xbb57('0x3b')]);_0x1023cc['where']=qs[_0xbb57('0x3d')](_[_0xbb57('0x4e')](_0x1f5d80[_0xbb57('0x34')],_0x3fa8fc['filters']));if(_0x1f5d80[_0xbb57('0x34')][_0xbb57('0x3e')]){_0x1023cc[_0xbb57('0x3c')]=_['merge'](_0x1023cc[_0xbb57('0x3c')],{'$or':_['map'](_0x1023cc[_0xbb57('0x35')],function(_0x56c7ec){var _0x23fefe={};_0x23fefe[_0x56c7ec]={'$like':'%'+_0x1f5d80['query'][_0xbb57('0x3e')]+'%'};return _0x23fefe;})});}_0x1023cc=_['merge']({},_0x1023cc,_0x1f5d80[_0xbb57('0x4a')]);return _0x3659a7['getConfigurations'](_0x1023cc);}})[_0xbb57('0x28')](function(_0x1bfbfc){if(_0x1bfbfc){_0x1a6161=_0x1bfbfc[_0xbb57('0x37')];if(!_0x1f5d80[_0xbb57('0x34')]['hasOwnProperty'](_0xbb57('0x39'))){_0x1023cc[_0xbb57('0x1f')]=qs[_0xbb57('0x1f')](_0x1f5d80['query'][_0xbb57('0x1f')]);_0x1023cc[_0xbb57('0x1d')]=qs[_0xbb57('0x1d')](_0x1f5d80[_0xbb57('0x34')][_0xbb57('0x1d')]);}return _0x3659a7[_0xbb57('0x4f')](_0x1023cc);}})[_0xbb57('0x28')](function(_0x3bd65e){if(_0x3bd65e){return _0x3bd65e?{'count':_0x1a6161,'rows':_0x3bd65e}:null;}})[_0xbb57('0x28')](respondWithResult(_0x10c5e0,null))[_0xbb57('0x46')](handleError(_0x10c5e0,null));};exports[_0xbb57('0x50')]=function(_0x22b5fa,_0x3b8837,_0x27ceda){if(_0x22b5fa[_0xbb57('0x4d')]['id']){delete _0x22b5fa[_0xbb57('0x4d')]['id'];}return db[_0xbb57('0x43')]['findOne']({'where':{'id':_0x22b5fa[_0xbb57('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b8837,null))['then'](function(_0x51ea23){if(_0x51ea23){_0x22b5fa[_0xbb57('0x4d')][_0xbb57('0x51')]=_0x51ea23['id'];_0x22b5fa[_0xbb57('0x4d')][_0xbb57('0x52')]=integrations[_0xbb57('0x53')](_0x22b5fa[_0xbb57('0x4d')][_0xbb57('0x54')],_0x22b5fa[_0xbb57('0x4d')][_0xbb57('0x41')]);_0x22b5fa[_0xbb57('0x4d')][_0xbb57('0x55')]=integrations[_0xbb57('0x56')](_0x22b5fa['body']['channel'],_0x22b5fa['body'][_0xbb57('0x41')]);return db[_0xbb57('0x57')][_0xbb57('0x4c')](_0x22b5fa[_0xbb57('0x4d')],{'include':[{'model':db[_0xbb57('0x58')],'as':_0xbb57('0x52')},{'model':db[_0xbb57('0x58')],'as':_0xbb57('0x55')}]});}return null;})[_0xbb57('0x28')](respondWithResult(_0x3b8837,null))[_0xbb57('0x46')](handleError(_0x3b8837,null));};var md5=require(_0xbb57('0x59'));exports[_0xbb57('0x5a')]=function(_0x1213b8,_0x1fd041,_0x3729d5){var _0x5ac023=null;var _0x5a40a2=null;var _0x264814=null;var _0xc70530=null;var _0x4c7a19='';return db[_0xbb57('0x43')][_0xbb57('0x5b')]({'where':{'id':_0x1213b8['params']['id']},'attributes':['id',_0xbb57('0x2c'),_0xbb57('0x5c'),_0xbb57('0x5d'),_0xbb57('0x5e'),_0xbb57('0x5f'),'serverUrl','accessKey']})['then'](handleEntityNotFound(_0x1fd041,null))[_0xbb57('0x28')](function(_0x13c27b){if(_0x13c27b){_0x5ac023=_0x13c27b[_0xbb57('0x5c')];_0x5a40a2=_0x13c27b[_0xbb57('0x60')];_0x264814=_0x13c27b[_0xbb57('0x5e')];_0x4c7a19=_0x13c27b['remoteUri'];var _0x589505=_0x4c7a19[_0xbb57('0x61')](-0x1);if(_0x589505==='/'){_0x4c7a19=_0x4c7a19[_0xbb57('0x62')](0x0,_0x4c7a19['lastIndexOf'](_0x589505));}_0xc70530=util[_0xbb57('0x63')](_0xbb57('0x64'),_0x4c7a19);var _0x4875d3={'method':'GET','uri':_0xc70530,'qs':{'operation':_0xbb57('0x65'),'username':_0x13c27b[_0xbb57('0x5c')]},'json':!![]};return rp(_0x4875d3);}})[_0xbb57('0x28')](function(_0x512be1){if(_0x512be1[_0xbb57('0x66')]){var _0x5de6f4={'method':'POST','uri':_0xc70530,'form':{'operation':_0xbb57('0x67'),'username':_0x5ac023,'accessKey':md5(_0x512be1[_0xbb57('0x68')][_0xbb57('0x69')]+_0x5a40a2)},'json':!![]};return rp(_0x5de6f4);}})[_0xbb57('0x28')](function(_0x5f326d){if(_0x5f326d[_0xbb57('0x66')]){var _0x221343={'method':_0xbb57('0x6a'),'uri':_0xc70530,'qs':{'operation':_0xbb57('0x6b'),'username':_0x5ac023,'sessionName':_0x5f326d['result'][_0xbb57('0x6c')],'elementType':_0x264814},'json':!![]};return rp(_0x221343);}})[_0xbb57('0x28')](function(_0x1e2f3f){if(_0x1e2f3f['success']){var _0x1629f4=['autogenerated',_0xbb57('0x6d'),_0xbb57('0x6e')];_['remove'](_0x1e2f3f[_0xbb57('0x68')]['fields'],function(_0x33f6df){return _0x1629f4[_0xbb57('0x6f')](_0x33f6df[_0xbb57('0x41')][_0xbb57('0x2c')]);});_[_0xbb57('0x70')](_0x1e2f3f[_0xbb57('0x68')][_0xbb57('0x36')],function(_0x4bad31){return _0x4bad31[_0xbb57('0x71')]===_0xbb57('0x72');});return{'count':_0x1e2f3f['result'][_0xbb57('0x36')][_0xbb57('0x37')],'rows':_['map'](_0x1e2f3f[_0xbb57('0x68')]['fields'],function(_0x49cbc3){return{'id':_0x49cbc3['name'],'name':_0x49cbc3[_0xbb57('0x73')],'custom':_[_0xbb57('0x74')](_0x49cbc3[_0xbb57('0x2c')],_0xbb57('0x75'))?!![]:![],'options':_0x49cbc3['type'][_0xbb57('0x2c')]===_0xbb57('0x76')&&_0x49cbc3['type'][_0xbb57('0x77')][_0xbb57('0x37')]>0x0?_[_0xbb57('0x40')](_0x49cbc3['type'][_0xbb57('0x77')],function(_0x2be56d){return{'name':_0x2be56d['label'],'value':_0x2be56d[_0xbb57('0x78')]};}):[]};})};}})[_0xbb57('0x28')](respondWithResult(_0x1fd041,null))[_0xbb57('0x46')](function(_0x4e21f8){console[_0xbb57('0x79')]('vTiger\x20error:\x20'+_0x4e21f8);var _0x12ba8a=_0x1213b8[_0xbb57('0x34')][_0xbb57('0x7a')]?0x1f4:_0x4e21f8[_0xbb57('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xbb57('0x5a'),_0x12ba8a,JSON[_0xbb57('0x7c')](_0x4e21f8));delete _0x4e21f8['name'];if(_0x12ba8a===0x191){_0x12ba8a=0x190;}_0x1fd041[_0xbb57('0x1b')](_0x12ba8a)[_0xbb57('0x2d')](_0x1213b8['query'][_0xbb57('0x7a')]?{'message':_0xbb57('0x7d'),'statusCode':_0x4e21f8[_0xbb57('0x7b')]}:_0x4e21f8);});}; \ No newline at end of file +var _0x51fb=['status','json','undefined','count','offset','limit','apply','save','update','then','destroy','name','send','index','VtigerAccount','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','body','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','getDescriptions','VtigerConfiguration','create','VtigerField','Subjects','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','reference','remove','includes','editable','false','label','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end'];(function(_0x13be60,_0x1b454d){var _0x18bb23=function(_0xa816b5){while(--_0xa816b5){_0x13be60['push'](_0x13be60['shift']());}};_0x18bb23(++_0x1b454d);}(_0x51fb,0x144));var _0xb51f=function(_0x100540,_0x2780d8){_0x100540=_0x100540-0x0;var _0x155c1c=_0x51fb[_0x100540];return _0x155c1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb51f('0x0'));var zipdir=require(_0xb51f('0x1'));var jsonpatch=require(_0xb51f('0x2'));var rp=require('request-promise');var moment=require(_0xb51f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb51f('0x4'));var util=require(_0xb51f('0x5'));var path=require(_0xb51f('0x6'));var sox=require(_0xb51f('0x7'));var csv=require('to-csv');var ejs=require(_0xb51f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb51f('0x9'));var squel=require(_0xb51f('0xa'));var crypto=require(_0xb51f('0xb'));var jsforce=require(_0xb51f('0xc'));var deskjs=require(_0xb51f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb51f('0xe'));var Papa=require(_0xb51f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb51f('0x10'));var as=require(_0xb51f('0x11'));var hardwareService=require(_0xb51f('0x12'));var logger=require(_0xb51f('0x13'))('api');var utils=require(_0xb51f('0x14'));var config=require(_0xb51f('0x15'));var licenseUtil=require(_0xb51f('0x16'));var db=require(_0xb51f('0x17'))['db'];var integrations=require(_0xb51f('0x18'));function respondWithStatusCode(_0x4996bc,_0x3ab7a4){_0x3ab7a4=_0x3ab7a4||0xcc;return function(_0x56acac){if(_0x56acac){return _0x4996bc[_0xb51f('0x19')](_0x3ab7a4);}return _0x4996bc['status'](_0x3ab7a4)[_0xb51f('0x1a')]();};}function respondWithResult(_0x57bd94,_0x428908){_0x428908=_0x428908||0xc8;return function(_0x46576e){if(_0x46576e){return _0x57bd94[_0xb51f('0x1b')](_0x428908)[_0xb51f('0x1c')](_0x46576e);}};}function respondWithFilteredResult(_0x1c5308,_0x389263){return function(_0x55e45b){if(_0x55e45b){var _0x1cf1be=typeof _0x389263['offset']===_0xb51f('0x1d')&&typeof _0x389263['limit']===_0xb51f('0x1d');var _0x4244e0=_0x55e45b[_0xb51f('0x1e')];var _0x53f3c8=_0x1cf1be?0x0:_0x389263[_0xb51f('0x1f')];var _0x24da77=_0x1cf1be?_0x55e45b['count']:_0x389263[_0xb51f('0x1f')]+_0x389263[_0xb51f('0x20')];var _0xbcc3e2;if(_0x24da77>=_0x4244e0){_0x24da77=_0x4244e0;_0xbcc3e2=0xc8;}else{_0xbcc3e2=0xce;}_0x1c5308[_0xb51f('0x1b')](_0xbcc3e2);return _0x1c5308['set']('Content-Range',_0x53f3c8+'-'+_0x24da77+'/'+_0x4244e0)[_0xb51f('0x1c')](_0x55e45b);}return null;};}function patchUpdates(_0x486fad){return function(_0x30bcbf){try{jsonpatch[_0xb51f('0x21')](_0x30bcbf,_0x486fad,!![]);}catch(_0x2d82a6){return BPromise['reject'](_0x2d82a6);}return _0x30bcbf[_0xb51f('0x22')]();};}function saveUpdates(_0x37f0bd,_0x42edf4){return function(_0x3d088a){if(_0x3d088a){return _0x3d088a[_0xb51f('0x23')](_0x37f0bd)[_0xb51f('0x24')](function(_0x3db75f){return _0x3db75f;});}return null;};}function removeEntity(_0x22fa1d,_0x1328ca){return function(_0x3fd20e){if(_0x3fd20e){return _0x3fd20e[_0xb51f('0x25')]()[_0xb51f('0x24')](function(){_0x22fa1d['status'](0xcc)[_0xb51f('0x1a')]();});}};}function handleEntityNotFound(_0x436ae1,_0xa3054){return function(_0x65da6d){if(!_0x65da6d){_0x436ae1[_0xb51f('0x19')](0x194);}return _0x65da6d;};}function handleError(_0xad5052,_0x337d6e){_0x337d6e=_0x337d6e||0x1f4;return function(_0x5d6014){logger['error'](_0x5d6014['stack']);if(_0x5d6014[_0xb51f('0x26')]){delete _0x5d6014[_0xb51f('0x26')];}_0xad5052['status'](_0x337d6e)[_0xb51f('0x27')](_0x5d6014);};}exports[_0xb51f('0x28')]=function(_0x2aa064,_0x46bca9){var _0x50e1ea={},_0x32bd02={},_0x5eee16={'count':0x0,'rows':[]};var _0x3d978c=_['map'](db[_0xb51f('0x29')]['rawAttributes'],function(_0x3831c2){return{'name':_0x3831c2['fieldName'],'type':_0x3831c2['type'][_0xb51f('0x2a')]};});_0x32bd02[_0xb51f('0x2b')]=_[_0xb51f('0x2c')](_0x3d978c,_0xb51f('0x26'));_0x32bd02['query']=_[_0xb51f('0x2d')](_0x2aa064[_0xb51f('0x2e')]);_0x32bd02['filters']=_[_0xb51f('0x2f')](_0x32bd02[_0xb51f('0x2b')],_0x32bd02['query']);_0x50e1ea[_0xb51f('0x30')]=_['intersection'](_0x32bd02[_0xb51f('0x2b')],qs[_0xb51f('0x31')](_0x2aa064[_0xb51f('0x2e')][_0xb51f('0x31')]));_0x50e1ea[_0xb51f('0x30')]=_0x50e1ea[_0xb51f('0x30')][_0xb51f('0x32')]?_0x50e1ea[_0xb51f('0x30')]:_0x32bd02[_0xb51f('0x2b')];if(!_0x2aa064[_0xb51f('0x2e')][_0xb51f('0x33')](_0xb51f('0x34'))){_0x50e1ea[_0xb51f('0x20')]=qs[_0xb51f('0x20')](_0x2aa064[_0xb51f('0x2e')][_0xb51f('0x20')]);_0x50e1ea['offset']=qs[_0xb51f('0x1f')](_0x2aa064[_0xb51f('0x2e')]['offset']);}_0x50e1ea['order']=qs[_0xb51f('0x35')](_0x2aa064[_0xb51f('0x2e')][_0xb51f('0x35')]);_0x50e1ea[_0xb51f('0x36')]=qs[_0xb51f('0x37')](_['pick'](_0x2aa064['query'],_0x32bd02[_0xb51f('0x37')]),_0x3d978c);if(_0x2aa064[_0xb51f('0x2e')][_0xb51f('0x38')]){_0x50e1ea[_0xb51f('0x36')]=_[_0xb51f('0x39')](_0x50e1ea[_0xb51f('0x36')],{'$or':_[_0xb51f('0x2c')](_0x3d978c,function(_0x1c2560){if(_0x1c2560[_0xb51f('0x3a')]!==_0xb51f('0x3b')){var _0x3a483b={};_0x3a483b[_0x1c2560['name']]={'$like':'%'+_0x2aa064['query'][_0xb51f('0x38')]+'%'};return _0x3a483b;}})});}_0x50e1ea=_['merge']({},_0x50e1ea,_0x2aa064[_0xb51f('0x3c')]);var _0x42fccb={'where':_0x50e1ea[_0xb51f('0x36')]};return db['VtigerAccount'][_0xb51f('0x1e')](_0x42fccb)['then'](function(_0x1241c9){_0x5eee16[_0xb51f('0x1e')]=_0x1241c9;if(_0x2aa064['query'][_0xb51f('0x3d')]){_0x50e1ea['include']=[{'all':!![]}];}return db[_0xb51f('0x29')][_0xb51f('0x3e')](_0x50e1ea);})['then'](function(_0x20bc5d){_0x5eee16['rows']=_0x20bc5d;return _0x5eee16;})['then'](respondWithFilteredResult(_0x46bca9,_0x50e1ea))[_0xb51f('0x3f')](handleError(_0x46bca9,null));};exports[_0xb51f('0x40')]=function(_0x7a1bee,_0x1ed728){var _0x50b9dd={'raw':![],'where':{'id':_0x7a1bee[_0xb51f('0x41')]['id']}},_0x2f1392={};_0x2f1392[_0xb51f('0x2b')]=_[_0xb51f('0x2d')](db[_0xb51f('0x29')][_0xb51f('0x42')]);_0x2f1392[_0xb51f('0x2e')]=_[_0xb51f('0x2d')](_0x7a1bee[_0xb51f('0x2e')]);_0x2f1392[_0xb51f('0x37')]=_[_0xb51f('0x2f')](_0x2f1392[_0xb51f('0x2b')],_0x2f1392['query']);_0x50b9dd[_0xb51f('0x30')]=_[_0xb51f('0x2f')](_0x2f1392['model'],qs[_0xb51f('0x31')](_0x7a1bee['query'][_0xb51f('0x31')]));_0x50b9dd['attributes']=_0x50b9dd[_0xb51f('0x30')][_0xb51f('0x32')]?_0x50b9dd[_0xb51f('0x30')]:_0x2f1392['model'];if(_0x7a1bee['query']['includeAll']){_0x50b9dd[_0xb51f('0x43')]=[{'all':!![]}];}_0x50b9dd=_[_0xb51f('0x39')]({},_0x50b9dd,_0x7a1bee[_0xb51f('0x3c')]);return db[_0xb51f('0x29')][_0xb51f('0x44')](_0x50b9dd)[_0xb51f('0x24')](handleEntityNotFound(_0x1ed728,null))[_0xb51f('0x24')](respondWithResult(_0x1ed728,null))[_0xb51f('0x3f')](handleError(_0x1ed728,null));};exports['create']=function(_0x1e2864,_0x437f2d){return db[_0xb51f('0x29')]['create'](_0x1e2864[_0xb51f('0x45')],{})[_0xb51f('0x24')](respondWithResult(_0x437f2d,0xc9))[_0xb51f('0x3f')](handleError(_0x437f2d,null));};exports[_0xb51f('0x23')]=function(_0x49eeec,_0x4472f8){if(_0x49eeec['body']['id']){delete _0x49eeec[_0xb51f('0x45')]['id'];}return db[_0xb51f('0x29')][_0xb51f('0x44')]({'where':{'id':_0x49eeec[_0xb51f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4472f8,null))[_0xb51f('0x24')](saveUpdates(_0x49eeec[_0xb51f('0x45')],null))[_0xb51f('0x24')](respondWithResult(_0x4472f8,null))[_0xb51f('0x3f')](handleError(_0x4472f8,null));};exports[_0xb51f('0x25')]=function(_0x240f1f,_0x51680c){return db['VtigerAccount'][_0xb51f('0x44')]({'where':{'id':_0x240f1f[_0xb51f('0x41')]['id']}})[_0xb51f('0x24')](handleEntityNotFound(_0x51680c,null))[_0xb51f('0x24')](removeEntity(_0x51680c,null))['catch'](handleError(_0x51680c,null));};exports[_0xb51f('0x46')]=function(_0x49e1d7,_0x142eaf,_0x27a9bf){var _0x221c7b={};var _0x568e2d={};var _0x1b93d5;var _0x14bf61;return db[_0xb51f('0x29')][_0xb51f('0x47')]({'where':{'id':_0x49e1d7[_0xb51f('0x41')]['id']}})['then'](handleEntityNotFound(_0x142eaf,null))[_0xb51f('0x24')](function(_0x1a0459){if(_0x1a0459){_0x1b93d5=_0x1a0459;_0x568e2d['model']=_['keys'](db['VtigerConfiguration'][_0xb51f('0x42')]);_0x568e2d[_0xb51f('0x2e')]=_[_0xb51f('0x2d')](_0x49e1d7[_0xb51f('0x2e')]);_0x568e2d[_0xb51f('0x37')]=_[_0xb51f('0x2f')](_0x568e2d['model'],_0x568e2d[_0xb51f('0x2e')]);_0x221c7b[_0xb51f('0x30')]=_['intersection'](_0x568e2d[_0xb51f('0x2b')],qs['fields'](_0x49e1d7[_0xb51f('0x2e')][_0xb51f('0x31')]));_0x221c7b[_0xb51f('0x30')]=_0x221c7b[_0xb51f('0x30')]['length']?_0x221c7b[_0xb51f('0x30')]:_0x568e2d[_0xb51f('0x2b')];_0x221c7b['order']=qs[_0xb51f('0x35')](_0x49e1d7[_0xb51f('0x2e')][_0xb51f('0x35')]);_0x221c7b[_0xb51f('0x36')]=qs['filters'](_['pick'](_0x49e1d7[_0xb51f('0x2e')],_0x568e2d['filters']));if(_0x49e1d7['query'][_0xb51f('0x38')]){_0x221c7b['where']=_['merge'](_0x221c7b[_0xb51f('0x36')],{'$or':_[_0xb51f('0x2c')](_0x221c7b[_0xb51f('0x30')],function(_0x538716){var _0x191dce={};_0x191dce[_0x538716]={'$like':'%'+_0x49e1d7['query'][_0xb51f('0x38')]+'%'};return _0x191dce;})});}_0x221c7b=_[_0xb51f('0x39')]({},_0x221c7b,_0x49e1d7[_0xb51f('0x3c')]);return _0x1b93d5[_0xb51f('0x46')](_0x221c7b);}})[_0xb51f('0x24')](function(_0x1b65ac){if(_0x1b65ac){_0x14bf61=_0x1b65ac[_0xb51f('0x32')];if(!_0x49e1d7[_0xb51f('0x2e')][_0xb51f('0x33')](_0xb51f('0x34'))){_0x221c7b[_0xb51f('0x20')]=qs[_0xb51f('0x20')](_0x49e1d7[_0xb51f('0x2e')]['limit']);_0x221c7b['offset']=qs['offset'](_0x49e1d7[_0xb51f('0x2e')]['offset']);}return _0x1b93d5['getConfigurations'](_0x221c7b);}})[_0xb51f('0x24')](function(_0x1e7bde){if(_0x1e7bde){return _0x1e7bde?{'count':_0x14bf61,'rows':_0x1e7bde}:null;}})[_0xb51f('0x24')](respondWithResult(_0x142eaf,null))[_0xb51f('0x3f')](handleError(_0x142eaf,null));};exports[_0xb51f('0x48')]=function(_0x49fdf9,_0x1fafe2,_0x5a2e41){if(_0x49fdf9[_0xb51f('0x45')]['id']){delete _0x49fdf9['body']['id'];}return db[_0xb51f('0x29')][_0xb51f('0x47')]({'where':{'id':_0x49fdf9[_0xb51f('0x41')]['id']}})[_0xb51f('0x24')](handleEntityNotFound(_0x1fafe2,null))[_0xb51f('0x24')](function(_0x57b9cc){if(_0x57b9cc){_0x49fdf9[_0xb51f('0x45')][_0xb51f('0x49')]=_0x57b9cc['id'];_0x49fdf9['body']['Subjects']=integrations[_0xb51f('0x4a')](_0x49fdf9[_0xb51f('0x45')][_0xb51f('0x4b')],_0x49fdf9['body']['type']);_0x49fdf9['body']['Descriptions']=integrations[_0xb51f('0x4c')](_0x49fdf9[_0xb51f('0x45')][_0xb51f('0x4b')],_0x49fdf9[_0xb51f('0x45')][_0xb51f('0x3a')]);return db[_0xb51f('0x4d')][_0xb51f('0x4e')](_0x49fdf9[_0xb51f('0x45')],{'include':[{'model':db[_0xb51f('0x4f')],'as':_0xb51f('0x50')},{'model':db['VtigerField'],'as':_0xb51f('0x51')}]});}return null;})[_0xb51f('0x24')](respondWithResult(_0x1fafe2,null))['catch'](handleError(_0x1fafe2,null));};var md5=require(_0xb51f('0x52'));exports[_0xb51f('0x53')]=function(_0x43fa17,_0x15a536,_0x5c07db){var _0x45ee5f=null;var _0xe1984e=null;var _0x3a68d8=null;var _0x5140df=null;var _0x250d47='';return db[_0xb51f('0x29')][_0xb51f('0x47')]({'where':{'id':_0x43fa17[_0xb51f('0x41')]['id']},'attributes':['id','name',_0xb51f('0x54'),_0xb51f('0x55'),_0xb51f('0x56'),_0xb51f('0x57'),_0xb51f('0x58'),'accessKey']})[_0xb51f('0x24')](handleEntityNotFound(_0x15a536,null))[_0xb51f('0x24')](function(_0x322589){if(_0x322589){_0x45ee5f=_0x322589[_0xb51f('0x54')];_0xe1984e=_0x322589[_0xb51f('0x59')];_0x3a68d8=_0x322589[_0xb51f('0x56')];_0x250d47=_0x322589[_0xb51f('0x57')];var _0x466e92=_0x250d47[_0xb51f('0x5a')](-0x1);if(_0x466e92==='/'){_0x250d47=_0x250d47[_0xb51f('0x5b')](0x0,_0x250d47['lastIndexOf'](_0x466e92));}_0x5140df=util[_0xb51f('0x5c')](_0xb51f('0x5d'),_0x250d47);var _0x42613f={'method':_0xb51f('0x5e'),'uri':_0x5140df,'qs':{'operation':_0xb51f('0x5f'),'username':_0x322589[_0xb51f('0x54')]},'json':!![]};return rp(_0x42613f);}})['then'](function(_0x584245){if(_0x584245[_0xb51f('0x60')]){var _0x3f2f99={'method':'POST','uri':_0x5140df,'form':{'operation':_0xb51f('0x61'),'username':_0x45ee5f,'accessKey':md5(_0x584245[_0xb51f('0x62')][_0xb51f('0x63')]+_0xe1984e)},'json':!![]};return rp(_0x3f2f99);}})['then'](function(_0x12dc3f){if(_0x12dc3f[_0xb51f('0x60')]){var _0x53cf28={'method':'GET','uri':_0x5140df,'qs':{'operation':_0xb51f('0x64'),'username':_0x45ee5f,'sessionName':_0x12dc3f[_0xb51f('0x62')][_0xb51f('0x65')],'elementType':_0x3a68d8},'json':!![]};return rp(_0x53cf28);}})['then'](function(_0x45d7e0){if(_0x45d7e0[_0xb51f('0x60')]){var _0x3e7892=['autogenerated',_0xb51f('0x66'),'owner'];_[_0xb51f('0x67')](_0x45d7e0[_0xb51f('0x62')][_0xb51f('0x31')],function(_0x3e39f8){return _0x3e7892[_0xb51f('0x68')](_0x3e39f8[_0xb51f('0x3a')]['name']);});_[_0xb51f('0x67')](_0x45d7e0[_0xb51f('0x62')][_0xb51f('0x31')],function(_0x365eac){return _0x365eac[_0xb51f('0x69')]===_0xb51f('0x6a');});return{'count':_0x45d7e0[_0xb51f('0x62')]['fields'][_0xb51f('0x32')],'rows':_['map'](_0x45d7e0[_0xb51f('0x62')][_0xb51f('0x31')],function(_0x4a0ee8){return{'id':_0x4a0ee8['name'],'name':_0x4a0ee8[_0xb51f('0x6b')],'custom':_['startsWith'](_0x4a0ee8[_0xb51f('0x26')],'cf_')?!![]:![],'options':_0x4a0ee8[_0xb51f('0x3a')][_0xb51f('0x26')]===_0xb51f('0x6c')&&_0x4a0ee8['type'][_0xb51f('0x6d')]['length']>0x0?_[_0xb51f('0x2c')](_0x4a0ee8[_0xb51f('0x3a')][_0xb51f('0x6d')],function(_0x4d8bcb){return{'name':_0x4d8bcb[_0xb51f('0x6b')],'value':_0x4d8bcb[_0xb51f('0x6e')]};}):[]};})};}})[_0xb51f('0x24')](respondWithResult(_0x15a536,null))[_0xb51f('0x3f')](function(_0x6ab663){console['log'](_0xb51f('0x6f')+_0x6ab663);var _0x461378=_0x43fa17['query'][_0xb51f('0x70')]?0x1f4:_0x6ab663[_0xb51f('0x71')]||0x1f4;logger[_0xb51f('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0xb51f('0x53'),_0x461378,JSON[_0xb51f('0x73')](_0x6ab663));delete _0x6ab663[_0xb51f('0x26')];if(_0x461378===0x191){_0x461378=0x190;}_0x15a536[_0xb51f('0x1b')](_0x461378)[_0xb51f('0x27')](_0x43fa17[_0xb51f('0x2e')][_0xb51f('0x70')]?{'message':_0xb51f('0x74'),'statusCode':_0x6ab663[_0xb51f('0x71')]}:_0x6ab663);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index fe4871e..0ae14d6 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 _0x9ab5=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x43f634,_0xd20978){var _0x169bcb=function(_0x43faca){while(--_0x43faca){_0x43f634['push'](_0x43f634['shift']());}};_0x169bcb(++_0xd20978);}(_0x9ab5,0x143));var _0x59ab=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9ab5[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x59ab('0x0'));var util=require(_0x59ab('0x1'));var logger=require('../../config/logger')(_0x59ab('0x2'));var moment=require(_0x59ab('0x3'));var BPromise=require(_0x59ab('0x4'));var rp=require(_0x59ab('0x5'));var fs=require('fs');var path=require(_0x59ab('0x6'));var rimraf=require(_0x59ab('0x7'));var config=require(_0x59ab('0x8'));var attributes=require(_0x59ab('0x9'));var integrations=require(_0x59ab('0xa'));module[_0x59ab('0xb')]=function(_0x57c928,_0x1dff26){return _0x57c928[_0x59ab('0xc')](_0x59ab('0xd'),attributes,{'tableName':_0x59ab('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5612=['../../config/environment','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x41ebb9,_0x613fb2){var _0x5bad4e=function(_0x5a0153){while(--_0x5a0153){_0x41ebb9['push'](_0x41ebb9['shift']());}};_0x5bad4e(++_0x613fb2);}(_0x5612,0x149));var _0x2561=function(_0x26d158,_0x537afd){_0x26d158=_0x26d158-0x0;var _0x4d6b6f=_0x5612[_0x26d158];return _0x4d6b6f;};'use strict';var _=require(_0x2561('0x0'));var util=require('util');var logger=require(_0x2561('0x1'))(_0x2561('0x2'));var moment=require(_0x2561('0x3'));var BPromise=require('bluebird');var rp=require(_0x2561('0x4'));var fs=require('fs');var path=require(_0x2561('0x5'));var rimraf=require(_0x2561('0x6'));var config=require(_0x2561('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x2561('0x8'));module[_0x2561('0x9')]=function(_0x3854b3,_0x2b2a07){return _0x3854b3['define'](_0x2561('0xa'),attributes,{'tableName':_0x2561('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 70066a4..1021d9f 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 _0x0565=['request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','GetVtigerAccount','options','raw','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x32e277,_0x491f2f){var _0x20b05f=function(_0x42ef06){while(--_0x42ef06){_0x32e277['push'](_0x32e277['shift']());}};_0x20b05f(++_0x491f2f);}(_0x0565,0xf2));var _0x5056=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x0565[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var moment=require(_0x5056('0x2'));var BPromise=require(_0x5056('0x3'));var rs=require(_0x5056('0x4'));var fs=require('fs');var Redis=require(_0x5056('0x5'));var db=require(_0x5056('0x6'))['db'];var utils=require(_0x5056('0x7'));var logger=require(_0x5056('0x8'))(_0x5056('0x9'));var config=require('../../config/environment');var jayson=require(_0x5056('0xa'));var client=jayson[_0x5056('0xb')][_0x5056('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22afb7,_0x4b8280,_0x52b01f){return new BPromise(function(_0x38f74,_0x223c92){return client[_0x5056('0xd')](_0x22afb7,_0x52b01f)[_0x5056('0xe')](function(_0x2144a9){logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));logger['debug'](_0x5056('0x12'),_0x4b8280,_0x5056('0x11'),JSON[_0x5056('0x13')](_0x2144a9));if(_0x2144a9['error']){if(_0x2144a9['error'][_0x5056('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x223c92(_0x2144a9['error'][_0x5056('0x15')]);}logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x38f74(_0x2144a9[_0x5056('0x16')][_0x5056('0x15')]);}else{logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));_0x38f74(_0x2144a9['result'][_0x5056('0x15')]);}})['catch'](function(_0x43db77){logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x43db77);_0x223c92(_0x43db77);});});}exports[_0x5056('0x17')]=function(_0x4056ce){var _0x51b21e=this;return new Promise(function(_0x9ea88,_0x56537e){return db['VtigerAccount']['findAll']({'raw':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1b')]||null:null,'limit':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1c')]||null:null,'include':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')]['include']?_[_0x5056('0x1d')](_0x4056ce[_0x5056('0x18')]['include'],function(_0x4a64be){return{'model':db[_0x4a64be[_0x5056('0x1e')]],'as':_0x4a64be['as'],'attributes':_0x4a64be[_0x5056('0x1b')],'include':_0x4a64be[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x4a64be['include'],function(_0x267048){return{'model':db[_0x267048[_0x5056('0x1e')]],'as':_0x267048['as'],'attributes':_0x267048['attributes'],'include':_0x267048[_0x5056('0x1f')]?_['map'](_0x267048[_0x5056('0x1f')],function(_0x39d539){return{'model':db[_0x39d539[_0x5056('0x1e')]],'as':_0x39d539['as'],'attributes':_0x39d539[_0x5056('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x50f2a8){logger[_0x5056('0xf')](_0x5056('0x17'),_0x4056ce);logger[_0x5056('0x20')](_0x5056('0x17'),_0x4056ce,JSON['stringify'](_0x50f2a8));_0x9ea88(_0x50f2a8);})[_0x5056('0x21')](function(_0x5b0270){logger[_0x5056('0x16')]('GetVtigerAccount',_0x5b0270['message'],_0x4056ce);_0x56537e(_0x51b21e['error'](0x1f4,_0x5b0270[_0x5056('0x15')]));});});};exports[_0x5056('0x22')]=function(_0x482939){var _0x27f4be=this;return new Promise(function(_0x2c5728,_0x9e2986){return db[_0x5056('0x23')][_0x5056('0x24')]({'raw':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x482939['options']?_0x482939['options'][_0x5056('0x1b')]||null:null,'include':_0x482939[_0x5056('0x18')]?_0x482939['options'][_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x482939['options'][_0x5056('0x1f')],function(_0x378b33){return{'model':db[_0x378b33[_0x5056('0x1e')]],'as':_0x378b33['as'],'attributes':_0x378b33[_0x5056('0x1b')],'include':_0x378b33[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x378b33[_0x5056('0x1f')],function(_0x2f1d27){return{'model':db[_0x2f1d27[_0x5056('0x1e')]],'as':_0x2f1d27['as'],'attributes':_0x2f1d27[_0x5056('0x1b')],'include':_0x2f1d27[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x2f1d27[_0x5056('0x1f')],function(_0x3d7d78){return{'model':db[_0x3d7d78[_0x5056('0x1e')]],'as':_0x3d7d78['as'],'attributes':_0x3d7d78['attributes']};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x483d1e){logger[_0x5056('0xf')](_0x5056('0x22'),_0x482939);logger[_0x5056('0x20')](_0x5056('0x22'),_0x482939,JSON['stringify'](_0x483d1e));_0x2c5728(_0x483d1e);})[_0x5056('0x21')](function(_0x32fecc){logger['error'](_0x5056('0x22'),_0x32fecc['message'],_0x482939);_0x9e2986(_0x27f4be[_0x5056('0x16')](0x1f4,_0x32fecc[_0x5056('0x15')]));});});}; \ No newline at end of file +var _0x63a5=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','raw','options','where','attributes','limit','include','map','model','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x57a619,_0x3ba30a){var _0x446225=function(_0x2f42c9){while(--_0x2f42c9){_0x57a619['push'](_0x57a619['shift']());}};_0x446225(++_0x3ba30a);}(_0x63a5,0x18e));var _0x563a=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x63a5[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2662f7,_0x4f89b4,_0x4d71a0){return new BPromise(function(_0x543920,_0xff1f59){return client[_0x563a('0x9')](_0x2662f7,_0x4d71a0)[_0x563a('0xa')](function(_0x606235){logger[_0x563a('0xb')](_0x563a('0xc'),_0x4f89b4,_0x563a('0xd'));logger[_0x563a('0xe')](_0x563a('0xf'),_0x4f89b4,_0x563a('0xd'),JSON[_0x563a('0x10')](_0x606235));if(_0x606235[_0x563a('0x11')]){if(_0x606235[_0x563a('0x11')][_0x563a('0x12')]===0x1f4){logger['error'](_0x563a('0xc'),_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0xff1f59(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}logger[_0x563a('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0x543920(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f89b4,_0x563a('0xd'));_0x543920(_0x606235[_0x563a('0x14')]['message']);}})[_0x563a('0x15')](function(_0x43fb16){logger[_0x563a('0x11')](_0x563a('0xc'),_0x4f89b4,_0x43fb16);_0xff1f59(_0x43fb16);});});}exports['GetVtigerAccount']=function(_0x598693){var _0xe3d2bd=this;return new Promise(function(_0x422aaf,_0x54a3b4){return db['VtigerAccount']['findAll']({'raw':_0x598693['options']?_0x598693['options'][_0x563a('0x16')]===undefined?!![]:![]:!![],'where':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x18')]||null:null,'attributes':_0x598693['options']?_0x598693['options'][_0x563a('0x19')]||null:null,'limit':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x1a')]||null:null,'include':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x598693['options'][_0x563a('0x1b')],function(_0x5422f6){return{'model':db[_0x5422f6[_0x563a('0x1d')]],'as':_0x5422f6['as'],'attributes':_0x5422f6[_0x563a('0x19')],'include':_0x5422f6[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x5422f6[_0x563a('0x1b')],function(_0x1682ee){return{'model':db[_0x1682ee[_0x563a('0x1d')]],'as':_0x1682ee['as'],'attributes':_0x1682ee[_0x563a('0x19')],'include':_0x1682ee['include']?_[_0x563a('0x1c')](_0x1682ee[_0x563a('0x1b')],function(_0x2311f2){return{'model':db[_0x2311f2[_0x563a('0x1d')]],'as':_0x2311f2['as'],'attributes':_0x2311f2[_0x563a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x563a('0xa')](function(_0x1afdff){logger[_0x563a('0xb')](_0x563a('0x1e'),_0x598693);logger[_0x563a('0xe')](_0x563a('0x1e'),_0x598693,JSON[_0x563a('0x10')](_0x1afdff));_0x422aaf(_0x1afdff);})[_0x563a('0x15')](function(_0x7696c2){logger['error'](_0x563a('0x1e'),_0x7696c2[_0x563a('0x13')],_0x598693);_0x54a3b4(_0xe3d2bd[_0x563a('0x11')](0x1f4,_0x7696c2['message']));});});};exports[_0x563a('0x1f')]=function(_0x2e5c4b){var _0x3a59cb=this;return new Promise(function(_0x28a8f6,_0x166f89){return db[_0x563a('0x20')][_0x563a('0x21')]({'raw':_0x2e5c4b['options']?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x16')]===undefined?!![]:![]:!![],'where':_0x2e5c4b[_0x563a('0x17')]?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x18')]||null:null,'attributes':_0x2e5c4b['options']?_0x2e5c4b['options']['attributes']||null:null,'include':_0x2e5c4b['options']?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x2e5c4b[_0x563a('0x17')][_0x563a('0x1b')],function(_0x3dc83a){return{'model':db[_0x3dc83a['model']],'as':_0x3dc83a['as'],'attributes':_0x3dc83a['attributes'],'include':_0x3dc83a[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x3dc83a[_0x563a('0x1b')],function(_0x3a3423){return{'model':db[_0x3a3423[_0x563a('0x1d')]],'as':_0x3a3423['as'],'attributes':_0x3a3423[_0x563a('0x19')],'include':_0x3a3423[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x3a3423[_0x563a('0x1b')],function(_0x4d98be){return{'model':db[_0x4d98be[_0x563a('0x1d')]],'as':_0x4d98be['as'],'attributes':_0x4d98be[_0x563a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x563a('0xa')](function(_0xa334b7){logger[_0x563a('0xb')](_0x563a('0x1f'),_0x2e5c4b);logger['debug'](_0x563a('0x1f'),_0x2e5c4b,JSON[_0x563a('0x10')](_0xa334b7));_0x28a8f6(_0xa334b7);})[_0x563a('0x15')](function(_0x5abfe4){logger[_0x563a('0x11')]('ShowVtigerAccount',_0x5abfe4[_0x563a('0x13')],_0x2e5c4b);_0x166f89(_0x3a59cb[_0x563a('0x11')](0x1f4,_0x5abfe4['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 8aa63a6..fb494aa 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 _0xb7a7=['/:id/subjects','/:id/descriptions','post','create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xb7a7,0x105));var _0x7b7a=function(_0x2850c1,_0x39266e){_0x2850c1=_0x2850c1-0x0;var _0x5848ab=_0xb7a7[_0x2850c1];return _0x5848ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b7a('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b7a('0x1'));var router=express[_0x7b7a('0x2')]();var fs_extra=require(_0x7b7a('0x3'));var auth=require(_0x7b7a('0x4'));var interaction=require(_0x7b7a('0x5'));var config=require(_0x7b7a('0x6'));var controller=require(_0x7b7a('0x7'));router['get']('/',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x9')]);router[_0x7b7a('0xa')](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xc')]);router[_0x7b7a('0xa')](_0x7b7a('0xd'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xe')]);router[_0x7b7a('0xa')](_0x7b7a('0xf'),auth[_0x7b7a('0x8')](),controller['getSubjects']);router[_0x7b7a('0xa')](_0x7b7a('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x7b7a('0x11')]('/',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x12')]);router[_0x7b7a('0x13')](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x14')]);router['delete']('/:id',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x15')]);module[_0x7b7a('0x16')]=router; \ No newline at end of file +var _0xcfc9=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','delete','/:id'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xcfc9,0x75));var _0x9cfc=function(_0x2532ba,_0x45ece7){_0x2532ba=_0x2532ba-0x0;var _0x158605=_0xcfc9[_0x2532ba];return _0x158605;};'use strict';var multer=require(_0x9cfc('0x0'));var util=require(_0x9cfc('0x1'));var path=require(_0x9cfc('0x2'));var timeout=require(_0x9cfc('0x3'));var express=require(_0x9cfc('0x4'));var router=express['Router']();var fs_extra=require(_0x9cfc('0x5'));var auth=require(_0x9cfc('0x6'));var interaction=require(_0x9cfc('0x7'));var config=require(_0x9cfc('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x9cfc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9cfc('0x9')]('/:id',auth[_0x9cfc('0xa')](),controller[_0x9cfc('0xb')]);router[_0x9cfc('0x9')](_0x9cfc('0xc'),auth[_0x9cfc('0xa')](),controller[_0x9cfc('0xd')]);router[_0x9cfc('0x9')](_0x9cfc('0xe'),auth[_0x9cfc('0xa')](),controller[_0x9cfc('0xf')]);router[_0x9cfc('0x9')](_0x9cfc('0x10'),auth['isAuthenticated'](),controller[_0x9cfc('0x11')]);router[_0x9cfc('0x12')]('/',auth[_0x9cfc('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9cfc('0x13')](_0x9cfc('0x14'),auth[_0x9cfc('0xa')](),controller[_0x9cfc('0x15')]);module[_0x9cfc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 13fdf6b..13a4510 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 _0xf0eb=['exports','STRING','sequelize'];(function(_0x1095c6,_0x91bb00){var _0x565540=function(_0x26a352){while(--_0x26a352){_0x1095c6['push'](_0x1095c6['shift']());}};_0x565540(++_0x91bb00);}(_0xf0eb,0x146));var _0xbf0e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xf0eb[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0xbf0e('0x0'));module[_0xbf0e('0x1')]={'name':{'type':Sequelize[_0xbf0e('0x2')]},'description':{'type':Sequelize[_0xbf0e('0x2')]}}; \ No newline at end of file +var _0x1f4f=['STRING'];(function(_0x476300,_0xb9bd2){var _0x3d9b6f=function(_0x25a386){while(--_0x25a386){_0x476300['push'](_0x476300['shift']());}};_0x3d9b6f(++_0xb9bd2);}(_0x1f4f,0xa6));var _0xf1f4=function(_0x3cb499,_0x3d19b9){_0x3cb499=_0x3cb499-0x0;var _0x2e083f=_0x1f4f[_0x3cb499];return _0x2e083f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf1f4('0x0')]},'description':{'type':Sequelize[_0xf1f4('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4c13842..d6bbd66 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 _0x69d5=['sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','params','length','includeAll','find','create','update','body','findOne','getFields','hasOwnProperty','getSubjects','getDescriptions','VtigerField','order','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x3ebddd,_0x2d5641){var _0x72a382=function(_0x399960){while(--_0x399960){_0x3ebddd['push'](_0x3ebddd['shift']());}};_0x72a382(++_0x2d5641);}(_0x69d5,0x18e));var _0x569d=function(_0x16c49e,_0x2afc3b){_0x16c49e=_0x16c49e-0x0;var _0x387a5c=_0x69d5[_0x16c49e];return _0x387a5c;};'use strict';var emlformat=require(_0x569d('0x0'));var rimraf=require(_0x569d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x569d('0x2'));var rp=require(_0x569d('0x3'));var moment=require('moment');var BPromise=require(_0x569d('0x4'));var Mustache=require('mustache');var util=require(_0x569d('0x5'));var path=require(_0x569d('0x6'));var sox=require(_0x569d('0x7'));var csv=require(_0x569d('0x8'));var ejs=require(_0x569d('0x9'));var fs=require('fs');var fs_extra=require(_0x569d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x569d('0xb'));var jsforce=require(_0x569d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x569d('0xd'));var Papa=require(_0x569d('0xe'));var Redis=require(_0x569d('0xf'));var authService=require(_0x569d('0x10'));var qs=require(_0x569d('0x11'));var as=require(_0x569d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x569d('0x13'))(_0x569d('0x14'));var utils=require(_0x569d('0x15'));var config=require(_0x569d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cbc8a,_0x2f6c3e){_0x2f6c3e=_0x2f6c3e||0xcc;return function(_0x268b8a){if(_0x268b8a){return _0x3cbc8a[_0x569d('0x17')](_0x2f6c3e);}return _0x3cbc8a[_0x569d('0x18')](_0x2f6c3e)[_0x569d('0x19')]();};}function respondWithResult(_0x11fa12,_0x2573be){_0x2573be=_0x2573be||0xc8;return function(_0x4a8738){if(_0x4a8738){return _0x11fa12[_0x569d('0x18')](_0x2573be)[_0x569d('0x1a')](_0x4a8738);}};}function respondWithFilteredResult(_0x407113,_0x43e60e){return function(_0x11ffd2){if(_0x11ffd2){var _0x5e30b3=typeof _0x43e60e['offset']===_0x569d('0x1b')&&typeof _0x43e60e[_0x569d('0x1c')]===_0x569d('0x1b');var _0x5d1102=_0x11ffd2[_0x569d('0x1d')];var _0x4775cd=_0x5e30b3?0x0:_0x43e60e['offset'];var _0xef3b29=_0x5e30b3?_0x11ffd2[_0x569d('0x1d')]:_0x43e60e['offset']+_0x43e60e[_0x569d('0x1c')];var _0x5d04a0;if(_0xef3b29>=_0x5d1102){_0xef3b29=_0x5d1102;_0x5d04a0=0xc8;}else{_0x5d04a0=0xce;}_0x407113[_0x569d('0x18')](_0x5d04a0);return _0x407113[_0x569d('0x1e')](_0x569d('0x1f'),_0x4775cd+'-'+_0xef3b29+'/'+_0x5d1102)[_0x569d('0x1a')](_0x11ffd2);}return null;};}function patchUpdates(_0x5f18a2){return function(_0xbd161){try{jsonpatch[_0x569d('0x20')](_0xbd161,_0x5f18a2,!![]);}catch(_0x15727f){return BPromise[_0x569d('0x21')](_0x15727f);}return _0xbd161[_0x569d('0x22')]();};}function saveUpdates(_0x3ecf0b,_0x5794f5){return function(_0x433f69){if(_0x433f69){return _0x433f69['update'](_0x3ecf0b)[_0x569d('0x23')](function(_0x4f4868){return _0x4f4868;});}return null;};}function removeEntity(_0x59863b,_0xc01c8b){return function(_0x236019){if(_0x236019){return _0x236019[_0x569d('0x24')]()['then'](function(){_0x59863b[_0x569d('0x18')](0xcc)[_0x569d('0x19')]();});}};}function handleEntityNotFound(_0x224039,_0x3472d4){return function(_0x69249a){if(!_0x69249a){_0x224039[_0x569d('0x17')](0x194);}return _0x69249a;};}function handleError(_0x4df09c,_0x5ed184){_0x5ed184=_0x5ed184||0x1f4;return function(_0x24b70f){logger['error'](_0x24b70f[_0x569d('0x25')]);if(_0x24b70f['name']){delete _0x24b70f[_0x569d('0x26')];}_0x4df09c[_0x569d('0x18')](_0x5ed184)[_0x569d('0x27')](_0x24b70f);};}exports[_0x569d('0x28')]=function(_0x3d23bb,_0x2c4273){var _0x551bcc={},_0x4bfd55={},_0x30d202={'count':0x0,'rows':[]};var _0x3f88be=_[_0x569d('0x29')](db[_0x569d('0x2a')][_0x569d('0x2b')],function(_0x27e113){return{'name':_0x27e113[_0x569d('0x2c')],'type':_0x27e113['type'][_0x569d('0x2d')]};});_0x4bfd55[_0x569d('0x2e')]=_[_0x569d('0x29')](_0x3f88be,'name');_0x4bfd55[_0x569d('0x2f')]=_[_0x569d('0x30')](_0x3d23bb['query']);_0x4bfd55[_0x569d('0x31')]=_[_0x569d('0x32')](_0x4bfd55[_0x569d('0x2e')],_0x4bfd55['query']);_0x551bcc[_0x569d('0x33')]=_['intersection'](_0x4bfd55[_0x569d('0x2e')],qs[_0x569d('0x34')](_0x3d23bb[_0x569d('0x2f')]['fields']));_0x551bcc['attributes']=_0x551bcc[_0x569d('0x33')]['length']?_0x551bcc[_0x569d('0x33')]:_0x4bfd55[_0x569d('0x2e')];if(!_0x3d23bb[_0x569d('0x2f')]['hasOwnProperty'](_0x569d('0x35'))){_0x551bcc[_0x569d('0x1c')]=qs[_0x569d('0x1c')](_0x3d23bb[_0x569d('0x2f')][_0x569d('0x1c')]);_0x551bcc[_0x569d('0x36')]=qs['offset'](_0x3d23bb['query'][_0x569d('0x36')]);}_0x551bcc['order']=qs[_0x569d('0x37')](_0x3d23bb[_0x569d('0x2f')][_0x569d('0x37')]);_0x551bcc[_0x569d('0x38')]=qs[_0x569d('0x31')](_[_0x569d('0x39')](_0x3d23bb[_0x569d('0x2f')],_0x4bfd55[_0x569d('0x31')]),_0x3f88be);if(_0x3d23bb[_0x569d('0x2f')][_0x569d('0x3a')]){_0x551bcc[_0x569d('0x38')]=_['merge'](_0x551bcc[_0x569d('0x38')],{'$or':_[_0x569d('0x29')](_0x3f88be,function(_0x4f064b){if(_0x4f064b[_0x569d('0x3b')]!==_0x569d('0x3c')){var _0x252d90={};_0x252d90[_0x4f064b['name']]={'$like':'%'+_0x3d23bb[_0x569d('0x2f')][_0x569d('0x3a')]+'%'};return _0x252d90;}})});}_0x551bcc=_[_0x569d('0x3d')]({},_0x551bcc,_0x3d23bb[_0x569d('0x3e')]);var _0x324532={'where':_0x551bcc[_0x569d('0x38')]};return db['VtigerConfiguration'][_0x569d('0x1d')](_0x324532)['then'](function(_0x17756c){_0x30d202['count']=_0x17756c;if(_0x3d23bb[_0x569d('0x2f')]['includeAll']){_0x551bcc[_0x569d('0x3f')]=[{'all':!![]}];}return db[_0x569d('0x2a')][_0x569d('0x40')](_0x551bcc);})[_0x569d('0x23')](function(_0x1b3ed9){_0x30d202[_0x569d('0x41')]=_0x1b3ed9;return _0x30d202;})[_0x569d('0x23')](respondWithFilteredResult(_0x2c4273,_0x551bcc))[_0x569d('0x42')](handleError(_0x2c4273,null));};exports['show']=function(_0x245743,_0x4c404a){var _0x4cad5a={'raw':![],'where':{'id':_0x245743[_0x569d('0x43')]['id']}},_0x277054={};_0x277054[_0x569d('0x2e')]=_[_0x569d('0x30')](db[_0x569d('0x2a')][_0x569d('0x2b')]);_0x277054['query']=_[_0x569d('0x30')](_0x245743[_0x569d('0x2f')]);_0x277054[_0x569d('0x31')]=_['intersection'](_0x277054['model'],_0x277054[_0x569d('0x2f')]);_0x4cad5a['attributes']=_[_0x569d('0x32')](_0x277054[_0x569d('0x2e')],qs[_0x569d('0x34')](_0x245743[_0x569d('0x2f')][_0x569d('0x34')]));_0x4cad5a[_0x569d('0x33')]=_0x4cad5a[_0x569d('0x33')][_0x569d('0x44')]?_0x4cad5a['attributes']:_0x277054[_0x569d('0x2e')];if(_0x245743['query'][_0x569d('0x45')]){_0x4cad5a[_0x569d('0x3f')]=[{'all':!![]}];}_0x4cad5a=_[_0x569d('0x3d')]({},_0x4cad5a,_0x245743[_0x569d('0x3e')]);return db[_0x569d('0x2a')][_0x569d('0x46')](_0x4cad5a)[_0x569d('0x23')](handleEntityNotFound(_0x4c404a,null))[_0x569d('0x23')](respondWithResult(_0x4c404a,null))[_0x569d('0x42')](handleError(_0x4c404a,null));};exports[_0x569d('0x47')]=function(_0x3402fa,_0x3cf14d){return db[_0x569d('0x2a')][_0x569d('0x47')](_0x3402fa['body'],{})[_0x569d('0x23')](respondWithResult(_0x3cf14d,0xc9))['catch'](handleError(_0x3cf14d,null));};exports[_0x569d('0x48')]=function(_0x19570d,_0x52faf4){if(_0x19570d[_0x569d('0x49')]['id']){delete _0x19570d[_0x569d('0x49')]['id'];}return db[_0x569d('0x2a')]['find']({'where':{'id':_0x19570d[_0x569d('0x43')]['id']}})['then'](handleEntityNotFound(_0x52faf4,null))[_0x569d('0x23')](saveUpdates(_0x19570d[_0x569d('0x49')],null))[_0x569d('0x23')](respondWithResult(_0x52faf4,null))[_0x569d('0x42')](handleError(_0x52faf4,null));};exports[_0x569d('0x24')]=function(_0x3d58c0,_0x3f1319){return db[_0x569d('0x2a')]['find']({'where':{'id':_0x3d58c0[_0x569d('0x43')]['id']}})[_0x569d('0x23')](handleEntityNotFound(_0x3f1319,null))['then'](removeEntity(_0x3f1319,null))[_0x569d('0x42')](handleError(_0x3f1319,null));};exports['getFields']=function(_0x37bf25,_0x49d38c,_0x154845){var _0x591f42={};var _0x148255={};var _0x186149;var _0xf255c0;return db['VtigerConfiguration'][_0x569d('0x4a')]({'where':{'id':_0x37bf25[_0x569d('0x43')]['id']}})[_0x569d('0x23')](handleEntityNotFound(_0x49d38c,null))['then'](function(_0x416fa5){if(_0x416fa5){_0x186149=_0x416fa5;_0x148255['model']=_[_0x569d('0x30')](db['VtigerField'][_0x569d('0x2b')]);_0x148255['query']=_[_0x569d('0x30')](_0x37bf25['query']);_0x148255[_0x569d('0x31')]=_[_0x569d('0x32')](_0x148255[_0x569d('0x2e')],_0x148255[_0x569d('0x2f')]);_0x591f42['attributes']=_[_0x569d('0x32')](_0x148255[_0x569d('0x2e')],qs[_0x569d('0x34')](_0x37bf25[_0x569d('0x2f')]['fields']));_0x591f42['attributes']=_0x591f42[_0x569d('0x33')][_0x569d('0x44')]?_0x591f42[_0x569d('0x33')]:_0x148255['model'];_0x591f42['order']=qs[_0x569d('0x37')](_0x37bf25[_0x569d('0x2f')][_0x569d('0x37')]);_0x591f42[_0x569d('0x38')]=qs[_0x569d('0x31')](_[_0x569d('0x39')](_0x37bf25[_0x569d('0x2f')],_0x148255[_0x569d('0x31')]));if(_0x37bf25[_0x569d('0x2f')][_0x569d('0x3a')]){_0x591f42['where']=_['merge'](_0x591f42[_0x569d('0x38')],{'$or':_['map'](_0x591f42[_0x569d('0x33')],function(_0x4dcd84){var _0x5c0664={};_0x5c0664[_0x4dcd84]={'$like':'%'+_0x37bf25[_0x569d('0x2f')]['filter']+'%'};return _0x5c0664;})});}_0x591f42=_[_0x569d('0x3d')]({},_0x591f42,_0x37bf25['options']);return _0x186149[_0x569d('0x4b')](_0x591f42);}})['then'](function(_0xb75d5d){if(_0xb75d5d){_0xf255c0=_0xb75d5d['length'];if(!_0x37bf25[_0x569d('0x2f')][_0x569d('0x4c')](_0x569d('0x35'))){_0x591f42[_0x569d('0x1c')]=qs['limit'](_0x37bf25['query'][_0x569d('0x1c')]);_0x591f42['offset']=qs[_0x569d('0x36')](_0x37bf25[_0x569d('0x2f')][_0x569d('0x36')]);}return _0x186149[_0x569d('0x4b')](_0x591f42);}})[_0x569d('0x23')](function(_0x3eab2f){if(_0x3eab2f){return _0x3eab2f?{'count':_0xf255c0,'rows':_0x3eab2f}:null;}})[_0x569d('0x23')](respondWithResult(_0x49d38c,null))[_0x569d('0x42')](handleError(_0x49d38c,null));};exports['getSubjects']=function(_0x385e10,_0x35fafb,_0x2d4f08){var _0x129ca4={};var _0x237ee5={};var _0x3516b6;var _0x2eb5b6;return db[_0x569d('0x2a')]['findOne']({'where':{'id':_0x385e10['params']['id']}})[_0x569d('0x23')](handleEntityNotFound(_0x35fafb,null))['then'](function(_0x16a6b9){if(_0x16a6b9){_0x3516b6=_0x16a6b9;_0x237ee5[_0x569d('0x2e')]=_[_0x569d('0x30')](db['VtigerField'][_0x569d('0x2b')]);_0x237ee5[_0x569d('0x2f')]=_[_0x569d('0x30')](_0x385e10['query']);_0x237ee5['filters']=_[_0x569d('0x32')](_0x237ee5[_0x569d('0x2e')],_0x237ee5['query']);_0x129ca4['attributes']=_[_0x569d('0x32')](_0x237ee5[_0x569d('0x2e')],qs[_0x569d('0x34')](_0x385e10['query'][_0x569d('0x34')]));_0x129ca4['attributes']=_0x129ca4[_0x569d('0x33')][_0x569d('0x44')]?_0x129ca4[_0x569d('0x33')]:_0x237ee5[_0x569d('0x2e')];_0x129ca4['order']=qs['sort'](_0x385e10[_0x569d('0x2f')][_0x569d('0x37')]);_0x129ca4[_0x569d('0x38')]=qs[_0x569d('0x31')](_[_0x569d('0x39')](_0x385e10[_0x569d('0x2f')],_0x237ee5[_0x569d('0x31')]));if(_0x385e10[_0x569d('0x2f')][_0x569d('0x3a')]){_0x129ca4[_0x569d('0x38')]=_[_0x569d('0x3d')](_0x129ca4['where'],{'$or':_['map'](_0x129ca4[_0x569d('0x33')],function(_0x1318fc){var _0x6f4cbd={};_0x6f4cbd[_0x1318fc]={'$like':'%'+_0x385e10[_0x569d('0x2f')][_0x569d('0x3a')]+'%'};return _0x6f4cbd;})});}_0x129ca4=_[_0x569d('0x3d')]({},_0x129ca4,_0x385e10[_0x569d('0x3e')]);return _0x3516b6[_0x569d('0x4d')](_0x129ca4);}})['then'](function(_0x138269){if(_0x138269){_0x2eb5b6=_0x138269['length'];if(!_0x385e10['query'][_0x569d('0x4c')](_0x569d('0x35'))){_0x129ca4['limit']=qs[_0x569d('0x1c')](_0x385e10[_0x569d('0x2f')]['limit']);_0x129ca4[_0x569d('0x36')]=qs[_0x569d('0x36')](_0x385e10[_0x569d('0x2f')][_0x569d('0x36')]);}return _0x3516b6[_0x569d('0x4d')](_0x129ca4);}})[_0x569d('0x23')](function(_0x21bf35){if(_0x21bf35){return _0x21bf35?{'count':_0x2eb5b6,'rows':_0x21bf35}:null;}})[_0x569d('0x23')](respondWithResult(_0x35fafb,null))[_0x569d('0x42')](handleError(_0x35fafb,null));};exports[_0x569d('0x4e')]=function(_0x5b5aa1,_0x178379,_0x543e37){var _0x1cb52a={};var _0x335d5d={};var _0x502a1a;var _0x7b95b9;return db[_0x569d('0x2a')]['findOne']({'where':{'id':_0x5b5aa1[_0x569d('0x43')]['id']}})[_0x569d('0x23')](handleEntityNotFound(_0x178379,null))['then'](function(_0x52a755){if(_0x52a755){_0x502a1a=_0x52a755;_0x335d5d[_0x569d('0x2e')]=_[_0x569d('0x30')](db[_0x569d('0x4f')]['rawAttributes']);_0x335d5d[_0x569d('0x2f')]=_['keys'](_0x5b5aa1[_0x569d('0x2f')]);_0x335d5d[_0x569d('0x31')]=_[_0x569d('0x32')](_0x335d5d[_0x569d('0x2e')],_0x335d5d[_0x569d('0x2f')]);_0x1cb52a[_0x569d('0x33')]=_[_0x569d('0x32')](_0x335d5d[_0x569d('0x2e')],qs[_0x569d('0x34')](_0x5b5aa1[_0x569d('0x2f')][_0x569d('0x34')]));_0x1cb52a[_0x569d('0x33')]=_0x1cb52a['attributes'][_0x569d('0x44')]?_0x1cb52a[_0x569d('0x33')]:_0x335d5d['model'];_0x1cb52a[_0x569d('0x50')]=qs['sort'](_0x5b5aa1[_0x569d('0x2f')][_0x569d('0x37')]);_0x1cb52a[_0x569d('0x38')]=qs[_0x569d('0x31')](_[_0x569d('0x39')](_0x5b5aa1[_0x569d('0x2f')],_0x335d5d[_0x569d('0x31')]));if(_0x5b5aa1[_0x569d('0x2f')][_0x569d('0x3a')]){_0x1cb52a[_0x569d('0x38')]=_[_0x569d('0x3d')](_0x1cb52a[_0x569d('0x38')],{'$or':_[_0x569d('0x29')](_0x1cb52a['attributes'],function(_0x350905){var _0x21f8d8={};_0x21f8d8[_0x350905]={'$like':'%'+_0x5b5aa1['query']['filter']+'%'};return _0x21f8d8;})});}_0x1cb52a=_[_0x569d('0x3d')]({},_0x1cb52a,_0x5b5aa1[_0x569d('0x3e')]);return _0x502a1a[_0x569d('0x4e')](_0x1cb52a);}})[_0x569d('0x23')](function(_0xb42be5){if(_0xb42be5){_0x7b95b9=_0xb42be5[_0x569d('0x44')];if(!_0x5b5aa1['query'][_0x569d('0x4c')](_0x569d('0x35'))){_0x1cb52a[_0x569d('0x1c')]=qs[_0x569d('0x1c')](_0x5b5aa1[_0x569d('0x2f')]['limit']);_0x1cb52a[_0x569d('0x36')]=qs[_0x569d('0x36')](_0x5b5aa1[_0x569d('0x2f')][_0x569d('0x36')]);}return _0x502a1a['getDescriptions'](_0x1cb52a);}})[_0x569d('0x23')](function(_0x48cda5){if(_0x48cda5){return _0x48cda5?{'count':_0x7b95b9,'rows':_0x48cda5}:null;}})[_0x569d('0x23')](respondWithResult(_0x178379,null))[_0x569d('0x42')](handleError(_0x178379,null));}; \ No newline at end of file +var _0x4ac7=['map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','destroy','findOne','VtigerField','getFields','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','error','stack','name','send','index'];(function(_0x4e804c,_0x56495f){var _0xf4d53f=function(_0xc6e939){while(--_0xc6e939){_0x4e804c['push'](_0x4e804c['shift']());}};_0xf4d53f(++_0x56495f);}(_0x4ac7,0x170));var _0x74ac=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x4ac7[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0x74ac('0x0'));var rimraf=require(_0x74ac('0x1'));var zipdir=require(_0x74ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74ac('0x3'));var moment=require(_0x74ac('0x4'));var BPromise=require(_0x74ac('0x5'));var Mustache=require(_0x74ac('0x6'));var util=require(_0x74ac('0x7'));var path=require(_0x74ac('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x74ac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74ac('0xa'));var squel=require(_0x74ac('0xb'));var crypto=require(_0x74ac('0xc'));var jsforce=require(_0x74ac('0xd'));var deskjs=require(_0x74ac('0xe'));var toCsv=require(_0x74ac('0xf'));var querystring=require(_0x74ac('0x10'));var Papa=require('papaparse');var Redis=require(_0x74ac('0x11'));var authService=require(_0x74ac('0x12'));var qs=require(_0x74ac('0x13'));var as=require(_0x74ac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74ac('0x15'))(_0x74ac('0x16'));var utils=require(_0x74ac('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10ab9d,_0x38ba01){_0x38ba01=_0x38ba01||0xcc;return function(_0x1e82e1){if(_0x1e82e1){return _0x10ab9d[_0x74ac('0x18')](_0x38ba01);}return _0x10ab9d[_0x74ac('0x19')](_0x38ba01)[_0x74ac('0x1a')]();};}function respondWithResult(_0x4390bf,_0x9ba05b){_0x9ba05b=_0x9ba05b||0xc8;return function(_0x2759e6){if(_0x2759e6){return _0x4390bf[_0x74ac('0x19')](_0x9ba05b)['json'](_0x2759e6);}};}function respondWithFilteredResult(_0x18d7eb,_0x2908d7){return function(_0x3ec707){if(_0x3ec707){var _0x1e7fa5=typeof _0x2908d7[_0x74ac('0x1b')]===_0x74ac('0x1c')&&typeof _0x2908d7['limit']===_0x74ac('0x1c');var _0x5cdf82=_0x3ec707[_0x74ac('0x1d')];var _0x17490f=_0x1e7fa5?0x0:_0x2908d7[_0x74ac('0x1b')];var _0x3ad751=_0x1e7fa5?_0x3ec707[_0x74ac('0x1d')]:_0x2908d7['offset']+_0x2908d7[_0x74ac('0x1e')];var _0x4dfb0e;if(_0x3ad751>=_0x5cdf82){_0x3ad751=_0x5cdf82;_0x4dfb0e=0xc8;}else{_0x4dfb0e=0xce;}_0x18d7eb['status'](_0x4dfb0e);return _0x18d7eb[_0x74ac('0x1f')](_0x74ac('0x20'),_0x17490f+'-'+_0x3ad751+'/'+_0x5cdf82)[_0x74ac('0x21')](_0x3ec707);}return null;};}function patchUpdates(_0x15987f){return function(_0x4a2c43){try{jsonpatch[_0x74ac('0x22')](_0x4a2c43,_0x15987f,!![]);}catch(_0x503ce7){return BPromise['reject'](_0x503ce7);}return _0x4a2c43['save']();};}function saveUpdates(_0x27408d,_0x1e962c){return function(_0x469313){if(_0x469313){return _0x469313[_0x74ac('0x23')](_0x27408d)[_0x74ac('0x24')](function(_0x2a8a18){return _0x2a8a18;});}return null;};}function removeEntity(_0x2f9dc8,_0xe4282){return function(_0x2414fa){if(_0x2414fa){return _0x2414fa['destroy']()[_0x74ac('0x24')](function(){_0x2f9dc8[_0x74ac('0x19')](0xcc)[_0x74ac('0x1a')]();});}};}function handleEntityNotFound(_0x1f99b4,_0x14fa7b){return function(_0x4a6687){if(!_0x4a6687){_0x1f99b4[_0x74ac('0x18')](0x194);}return _0x4a6687;};}function handleError(_0x803afc,_0x1c3d22){_0x1c3d22=_0x1c3d22||0x1f4;return function(_0x15f991){logger[_0x74ac('0x25')](_0x15f991[_0x74ac('0x26')]);if(_0x15f991['name']){delete _0x15f991[_0x74ac('0x27')];}_0x803afc[_0x74ac('0x19')](_0x1c3d22)[_0x74ac('0x28')](_0x15f991);};}exports[_0x74ac('0x29')]=function(_0x6fecbf,_0x42242e){var _0x35b316={},_0x22dcb3={},_0x3d1e00={'count':0x0,'rows':[]};var _0x1d55dc=_[_0x74ac('0x2a')](db[_0x74ac('0x2b')][_0x74ac('0x2c')],function(_0xd14c8a){return{'name':_0xd14c8a[_0x74ac('0x2d')],'type':_0xd14c8a[_0x74ac('0x2e')][_0x74ac('0x2f')]};});_0x22dcb3[_0x74ac('0x30')]=_[_0x74ac('0x2a')](_0x1d55dc,_0x74ac('0x27'));_0x22dcb3[_0x74ac('0x31')]=_[_0x74ac('0x32')](_0x6fecbf[_0x74ac('0x31')]);_0x22dcb3['filters']=_[_0x74ac('0x33')](_0x22dcb3[_0x74ac('0x30')],_0x22dcb3['query']);_0x35b316[_0x74ac('0x34')]=_['intersection'](_0x22dcb3[_0x74ac('0x30')],qs[_0x74ac('0x35')](_0x6fecbf[_0x74ac('0x31')]['fields']));_0x35b316[_0x74ac('0x34')]=_0x35b316[_0x74ac('0x34')][_0x74ac('0x36')]?_0x35b316[_0x74ac('0x34')]:_0x22dcb3[_0x74ac('0x30')];if(!_0x6fecbf[_0x74ac('0x31')]['hasOwnProperty']('nolimit')){_0x35b316[_0x74ac('0x1e')]=qs[_0x74ac('0x1e')](_0x6fecbf['query']['limit']);_0x35b316[_0x74ac('0x1b')]=qs['offset'](_0x6fecbf[_0x74ac('0x31')][_0x74ac('0x1b')]);}_0x35b316[_0x74ac('0x37')]=qs['sort'](_0x6fecbf[_0x74ac('0x31')][_0x74ac('0x38')]);_0x35b316['where']=qs[_0x74ac('0x39')](_[_0x74ac('0x3a')](_0x6fecbf[_0x74ac('0x31')],_0x22dcb3[_0x74ac('0x39')]),_0x1d55dc);if(_0x6fecbf['query'][_0x74ac('0x3b')]){_0x35b316[_0x74ac('0x3c')]=_[_0x74ac('0x3d')](_0x35b316[_0x74ac('0x3c')],{'$or':_[_0x74ac('0x2a')](_0x1d55dc,function(_0x4d893f){if(_0x4d893f[_0x74ac('0x2e')]!==_0x74ac('0x3e')){var _0x53dabe={};_0x53dabe[_0x4d893f['name']]={'$like':'%'+_0x6fecbf[_0x74ac('0x31')][_0x74ac('0x3b')]+'%'};return _0x53dabe;}})});}_0x35b316=_[_0x74ac('0x3d')]({},_0x35b316,_0x6fecbf['options']);var _0x23d5ac={'where':_0x35b316[_0x74ac('0x3c')]};return db[_0x74ac('0x2b')][_0x74ac('0x1d')](_0x23d5ac)[_0x74ac('0x24')](function(_0x16f75f){_0x3d1e00['count']=_0x16f75f;if(_0x6fecbf[_0x74ac('0x31')][_0x74ac('0x3f')]){_0x35b316[_0x74ac('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x74ac('0x41')](_0x35b316);})[_0x74ac('0x24')](function(_0x44b503){_0x3d1e00[_0x74ac('0x42')]=_0x44b503;return _0x3d1e00;})['then'](respondWithFilteredResult(_0x42242e,_0x35b316))[_0x74ac('0x43')](handleError(_0x42242e,null));};exports[_0x74ac('0x44')]=function(_0x10284b,_0x4daedc){var _0x22c655={'raw':![],'where':{'id':_0x10284b['params']['id']}},_0x725d59={};_0x725d59['model']=_['keys'](db[_0x74ac('0x2b')][_0x74ac('0x2c')]);_0x725d59[_0x74ac('0x31')]=_[_0x74ac('0x32')](_0x10284b[_0x74ac('0x31')]);_0x725d59['filters']=_[_0x74ac('0x33')](_0x725d59[_0x74ac('0x30')],_0x725d59[_0x74ac('0x31')]);_0x22c655[_0x74ac('0x34')]=_[_0x74ac('0x33')](_0x725d59[_0x74ac('0x30')],qs[_0x74ac('0x35')](_0x10284b['query'][_0x74ac('0x35')]));_0x22c655[_0x74ac('0x34')]=_0x22c655['attributes']['length']?_0x22c655[_0x74ac('0x34')]:_0x725d59[_0x74ac('0x30')];if(_0x10284b['query'][_0x74ac('0x3f')]){_0x22c655[_0x74ac('0x40')]=[{'all':!![]}];}_0x22c655=_[_0x74ac('0x3d')]({},_0x22c655,_0x10284b[_0x74ac('0x45')]);return db[_0x74ac('0x2b')][_0x74ac('0x46')](_0x22c655)[_0x74ac('0x24')](handleEntityNotFound(_0x4daedc,null))[_0x74ac('0x24')](respondWithResult(_0x4daedc,null))[_0x74ac('0x43')](handleError(_0x4daedc,null));};exports['create']=function(_0x390934,_0x292f15){return db['VtigerConfiguration'][_0x74ac('0x47')](_0x390934[_0x74ac('0x48')],{})['then'](respondWithResult(_0x292f15,0xc9))['catch'](handleError(_0x292f15,null));};exports[_0x74ac('0x23')]=function(_0x11adb7,_0x3ee9d4){if(_0x11adb7[_0x74ac('0x48')]['id']){delete _0x11adb7[_0x74ac('0x48')]['id'];}return db[_0x74ac('0x2b')][_0x74ac('0x46')]({'where':{'id':_0x11adb7[_0x74ac('0x49')]['id']}})[_0x74ac('0x24')](handleEntityNotFound(_0x3ee9d4,null))[_0x74ac('0x24')](saveUpdates(_0x11adb7[_0x74ac('0x48')],null))[_0x74ac('0x24')](respondWithResult(_0x3ee9d4,null))[_0x74ac('0x43')](handleError(_0x3ee9d4,null));};exports[_0x74ac('0x4a')]=function(_0x442b8a,_0x587862){return db[_0x74ac('0x2b')][_0x74ac('0x46')]({'where':{'id':_0x442b8a[_0x74ac('0x49')]['id']}})[_0x74ac('0x24')](handleEntityNotFound(_0x587862,null))[_0x74ac('0x24')](removeEntity(_0x587862,null))[_0x74ac('0x43')](handleError(_0x587862,null));};exports['getFields']=function(_0x14613c,_0x2b2890,_0x5d837f){var _0x5da9ad={};var _0x46a028={};var _0x5a3978;var _0x1661b2;return db[_0x74ac('0x2b')][_0x74ac('0x4b')]({'where':{'id':_0x14613c[_0x74ac('0x49')]['id']}})[_0x74ac('0x24')](handleEntityNotFound(_0x2b2890,null))[_0x74ac('0x24')](function(_0x230094){if(_0x230094){_0x5a3978=_0x230094;_0x46a028[_0x74ac('0x30')]=_['keys'](db[_0x74ac('0x4c')][_0x74ac('0x2c')]);_0x46a028[_0x74ac('0x31')]=_[_0x74ac('0x32')](_0x14613c[_0x74ac('0x31')]);_0x46a028['filters']=_['intersection'](_0x46a028[_0x74ac('0x30')],_0x46a028[_0x74ac('0x31')]);_0x5da9ad[_0x74ac('0x34')]=_[_0x74ac('0x33')](_0x46a028[_0x74ac('0x30')],qs[_0x74ac('0x35')](_0x14613c[_0x74ac('0x31')][_0x74ac('0x35')]));_0x5da9ad['attributes']=_0x5da9ad[_0x74ac('0x34')][_0x74ac('0x36')]?_0x5da9ad[_0x74ac('0x34')]:_0x46a028[_0x74ac('0x30')];_0x5da9ad[_0x74ac('0x37')]=qs['sort'](_0x14613c['query']['sort']);_0x5da9ad['where']=qs[_0x74ac('0x39')](_[_0x74ac('0x3a')](_0x14613c['query'],_0x46a028[_0x74ac('0x39')]));if(_0x14613c['query'][_0x74ac('0x3b')]){_0x5da9ad[_0x74ac('0x3c')]=_['merge'](_0x5da9ad['where'],{'$or':_['map'](_0x5da9ad[_0x74ac('0x34')],function(_0x5f1995){var _0x14c1fc={};_0x14c1fc[_0x5f1995]={'$like':'%'+_0x14613c['query'][_0x74ac('0x3b')]+'%'};return _0x14c1fc;})});}_0x5da9ad=_['merge']({},_0x5da9ad,_0x14613c['options']);return _0x5a3978[_0x74ac('0x4d')](_0x5da9ad);}})['then'](function(_0x4c233d){if(_0x4c233d){_0x1661b2=_0x4c233d[_0x74ac('0x36')];if(!_0x14613c['query'][_0x74ac('0x4e')](_0x74ac('0x4f'))){_0x5da9ad[_0x74ac('0x1e')]=qs[_0x74ac('0x1e')](_0x14613c[_0x74ac('0x31')][_0x74ac('0x1e')]);_0x5da9ad[_0x74ac('0x1b')]=qs[_0x74ac('0x1b')](_0x14613c[_0x74ac('0x31')][_0x74ac('0x1b')]);}return _0x5a3978[_0x74ac('0x4d')](_0x5da9ad);}})[_0x74ac('0x24')](function(_0x3040a2){if(_0x3040a2){return _0x3040a2?{'count':_0x1661b2,'rows':_0x3040a2}:null;}})[_0x74ac('0x24')](respondWithResult(_0x2b2890,null))['catch'](handleError(_0x2b2890,null));};exports['getSubjects']=function(_0x1ca385,_0x37261c,_0x140f76){var _0x47fc67={};var _0xd88112={};var _0x311c48;var _0x15be89;return db['VtigerConfiguration'][_0x74ac('0x4b')]({'where':{'id':_0x1ca385['params']['id']}})[_0x74ac('0x24')](handleEntityNotFound(_0x37261c,null))[_0x74ac('0x24')](function(_0x789b95){if(_0x789b95){_0x311c48=_0x789b95;_0xd88112[_0x74ac('0x30')]=_[_0x74ac('0x32')](db[_0x74ac('0x4c')][_0x74ac('0x2c')]);_0xd88112['query']=_['keys'](_0x1ca385['query']);_0xd88112[_0x74ac('0x39')]=_[_0x74ac('0x33')](_0xd88112[_0x74ac('0x30')],_0xd88112['query']);_0x47fc67['attributes']=_[_0x74ac('0x33')](_0xd88112['model'],qs[_0x74ac('0x35')](_0x1ca385[_0x74ac('0x31')][_0x74ac('0x35')]));_0x47fc67['attributes']=_0x47fc67['attributes'][_0x74ac('0x36')]?_0x47fc67['attributes']:_0xd88112[_0x74ac('0x30')];_0x47fc67['order']=qs['sort'](_0x1ca385[_0x74ac('0x31')][_0x74ac('0x38')]);_0x47fc67[_0x74ac('0x3c')]=qs[_0x74ac('0x39')](_[_0x74ac('0x3a')](_0x1ca385[_0x74ac('0x31')],_0xd88112[_0x74ac('0x39')]));if(_0x1ca385[_0x74ac('0x31')]['filter']){_0x47fc67[_0x74ac('0x3c')]=_[_0x74ac('0x3d')](_0x47fc67[_0x74ac('0x3c')],{'$or':_[_0x74ac('0x2a')](_0x47fc67['attributes'],function(_0x553ac4){var _0x4cb404={};_0x4cb404[_0x553ac4]={'$like':'%'+_0x1ca385['query'][_0x74ac('0x3b')]+'%'};return _0x4cb404;})});}_0x47fc67=_['merge']({},_0x47fc67,_0x1ca385[_0x74ac('0x45')]);return _0x311c48[_0x74ac('0x50')](_0x47fc67);}})[_0x74ac('0x24')](function(_0x6d01fc){if(_0x6d01fc){_0x15be89=_0x6d01fc[_0x74ac('0x36')];if(!_0x1ca385[_0x74ac('0x31')][_0x74ac('0x4e')](_0x74ac('0x4f'))){_0x47fc67[_0x74ac('0x1e')]=qs['limit'](_0x1ca385[_0x74ac('0x31')][_0x74ac('0x1e')]);_0x47fc67[_0x74ac('0x1b')]=qs['offset'](_0x1ca385['query']['offset']);}return _0x311c48[_0x74ac('0x50')](_0x47fc67);}})[_0x74ac('0x24')](function(_0x2d6e27){if(_0x2d6e27){return _0x2d6e27?{'count':_0x15be89,'rows':_0x2d6e27}:null;}})[_0x74ac('0x24')](respondWithResult(_0x37261c,null))[_0x74ac('0x43')](handleError(_0x37261c,null));};exports['getDescriptions']=function(_0x1c5b2b,_0x2b42e7,_0x3a538){var _0x33e0c7={};var _0x369dbb={};var _0x336eca;var _0x5bd925;return db[_0x74ac('0x2b')][_0x74ac('0x4b')]({'where':{'id':_0x1c5b2b[_0x74ac('0x49')]['id']}})[_0x74ac('0x24')](handleEntityNotFound(_0x2b42e7,null))[_0x74ac('0x24')](function(_0xe34f0a){if(_0xe34f0a){_0x336eca=_0xe34f0a;_0x369dbb[_0x74ac('0x30')]=_[_0x74ac('0x32')](db[_0x74ac('0x4c')][_0x74ac('0x2c')]);_0x369dbb[_0x74ac('0x31')]=_[_0x74ac('0x32')](_0x1c5b2b[_0x74ac('0x31')]);_0x369dbb[_0x74ac('0x39')]=_[_0x74ac('0x33')](_0x369dbb[_0x74ac('0x30')],_0x369dbb[_0x74ac('0x31')]);_0x33e0c7['attributes']=_['intersection'](_0x369dbb[_0x74ac('0x30')],qs[_0x74ac('0x35')](_0x1c5b2b['query'][_0x74ac('0x35')]));_0x33e0c7[_0x74ac('0x34')]=_0x33e0c7[_0x74ac('0x34')][_0x74ac('0x36')]?_0x33e0c7[_0x74ac('0x34')]:_0x369dbb[_0x74ac('0x30')];_0x33e0c7['order']=qs[_0x74ac('0x38')](_0x1c5b2b['query'][_0x74ac('0x38')]);_0x33e0c7[_0x74ac('0x3c')]=qs[_0x74ac('0x39')](_[_0x74ac('0x3a')](_0x1c5b2b[_0x74ac('0x31')],_0x369dbb[_0x74ac('0x39')]));if(_0x1c5b2b[_0x74ac('0x31')][_0x74ac('0x3b')]){_0x33e0c7['where']=_[_0x74ac('0x3d')](_0x33e0c7[_0x74ac('0x3c')],{'$or':_[_0x74ac('0x2a')](_0x33e0c7['attributes'],function(_0x4a7503){var _0x35e11d={};_0x35e11d[_0x4a7503]={'$like':'%'+_0x1c5b2b[_0x74ac('0x31')]['filter']+'%'};return _0x35e11d;})});}_0x33e0c7=_[_0x74ac('0x3d')]({},_0x33e0c7,_0x1c5b2b[_0x74ac('0x45')]);return _0x336eca[_0x74ac('0x51')](_0x33e0c7);}})[_0x74ac('0x24')](function(_0x441c6b){if(_0x441c6b){_0x5bd925=_0x441c6b[_0x74ac('0x36')];if(!_0x1c5b2b[_0x74ac('0x31')]['hasOwnProperty'](_0x74ac('0x4f'))){_0x33e0c7[_0x74ac('0x1e')]=qs[_0x74ac('0x1e')](_0x1c5b2b[_0x74ac('0x31')][_0x74ac('0x1e')]);_0x33e0c7[_0x74ac('0x1b')]=qs[_0x74ac('0x1b')](_0x1c5b2b[_0x74ac('0x31')][_0x74ac('0x1b')]);}return _0x336eca[_0x74ac('0x51')](_0x33e0c7);}})[_0x74ac('0x24')](function(_0x2e5095){if(_0x2e5095){return _0x2e5095?{'count':_0x5bd925,'rows':_0x2e5095}:null;}})[_0x74ac('0x24')](respondWithResult(_0x2b42e7,null))[_0x74ac('0x43')](handleError(_0x2b42e7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4ae7458..a16f617 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 _0x4fc2=['api','moment','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x4e118d,_0x246589){var _0x3a8299=function(_0x167154){while(--_0x167154){_0x4e118d['push'](_0x4e118d['shift']());}};_0x3a8299(++_0x246589);}(_0x4fc2,0x81));var _0x24fc=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x4fc2[_0x12a554];return _0x244ba0;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var rp=require(_0x24fc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x24fc('0x7'));var config=require('../../config/environment');var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x2aae63,_0x1a7ed1){return _0x2aae63[_0x24fc('0x9')](_0x24fc('0xa'),attributes,{'tableName':_0x24fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1472=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0x1472,0x176));var _0x2147=function(_0x4c7149,_0x335342){_0x4c7149=_0x4c7149-0x0;var _0x200122=_0x1472[_0x4c7149];return _0x200122;};'use strict';var _=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var logger=require(_0x2147('0x2'))(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var rp=require(_0x2147('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2147('0x7'));var config=require(_0x2147('0x8'));var attributes=require(_0x2147('0x9'));module[_0x2147('0xa')]=function(_0x4f1bf9,_0x4d2b20){return _0x4f1bf9[_0x2147('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x2147('0xc'),'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 0eff722..b72993e 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 _0x7b27=['stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x30c07a,_0x3b986d){var _0x2111c7=function(_0x42733a){while(--_0x42733a){_0x30c07a['push'](_0x30c07a['shift']());}};_0x2111c7(++_0x3b986d);}(_0x7b27,0xbe));var _0x77b2=function(_0x48f3ba,_0x3c9efa){_0x48f3ba=_0x48f3ba-0x0;var _0x27d00f=_0x7b27[_0x48f3ba];return _0x27d00f;};'use strict';var _=require(_0x77b2('0x0'));var util=require(_0x77b2('0x1'));var moment=require('moment');var BPromise=require(_0x77b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77b2('0x3'))['db'];var utils=require(_0x77b2('0x4'));var logger=require(_0x77b2('0x5'))(_0x77b2('0x6'));var config=require(_0x77b2('0x7'));var jayson=require(_0x77b2('0x8'));var client=jayson[_0x77b2('0x9')][_0x77b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f1746,_0x3e0727,_0x42d031){return new BPromise(function(_0x27ec8b,_0x1aab4a){return client[_0x77b2('0xb')](_0x4f1746,_0x42d031)[_0x77b2('0xc')](function(_0x3ee5c2){logger[_0x77b2('0xd')](_0x77b2('0xe'),_0x3e0727,_0x77b2('0xf'));logger['debug'](_0x77b2('0x10'),_0x3e0727,_0x77b2('0xf'),JSON[_0x77b2('0x11')](_0x3ee5c2));if(_0x3ee5c2[_0x77b2('0x12')]){if(_0x3ee5c2[_0x77b2('0x12')][_0x77b2('0x13')]===0x1f4){logger[_0x77b2('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e0727,_0x3ee5c2[_0x77b2('0x12')]['message']);return _0x1aab4a(_0x3ee5c2['error']['message']);}logger[_0x77b2('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e0727,_0x3ee5c2[_0x77b2('0x12')]['message']);return _0x27ec8b(_0x3ee5c2[_0x77b2('0x12')][_0x77b2('0x14')]);}else{logger['info'](_0x77b2('0xe'),_0x3e0727,_0x77b2('0xf'));_0x27ec8b(_0x3ee5c2[_0x77b2('0x15')]['message']);}})[_0x77b2('0x16')](function(_0x3773eb){logger[_0x77b2('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e0727,_0x3773eb);_0x1aab4a(_0x3773eb);});});} \ No newline at end of file +var _0x66d6=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','ioredis'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x66d6,0x1de));var _0x666d=function(_0xcb6d2b,_0x1a56ac){_0xcb6d2b=_0xcb6d2b-0x0;var _0x2c3687=_0x66d6[_0xcb6d2b];return _0x2c3687;};'use strict';var _=require(_0x666d('0x0'));var util=require(_0x666d('0x1'));var moment=require(_0x666d('0x2'));var BPromise=require(_0x666d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x666d('0x4'));var db=require(_0x666d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x666d('0x6'));var config=require(_0x666d('0x7'));var jayson=require(_0x666d('0x8'));var client=jayson[_0x666d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf1a4bc,_0x1ad2d3,_0x754ac8){return new BPromise(function(_0x3f920b,_0x17ff89){return client[_0x666d('0xa')](_0xf1a4bc,_0x754ac8)[_0x666d('0xb')](function(_0x1a733c){logger['info'](_0x666d('0xc'),_0x1ad2d3,_0x666d('0xd'));logger[_0x666d('0xe')](_0x666d('0xf'),_0x1ad2d3,_0x666d('0xd'),JSON['stringify'](_0x1a733c));if(_0x1a733c[_0x666d('0x10')]){if(_0x1a733c[_0x666d('0x10')][_0x666d('0x11')]===0x1f4){logger[_0x666d('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ad2d3,_0x1a733c[_0x666d('0x10')][_0x666d('0x12')]);return _0x17ff89(_0x1a733c['error'][_0x666d('0x12')]);}logger[_0x666d('0x10')](_0x666d('0xc'),_0x1ad2d3,_0x1a733c[_0x666d('0x10')][_0x666d('0x12')]);return _0x3f920b(_0x1a733c[_0x666d('0x10')][_0x666d('0x12')]);}else{logger[_0x666d('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ad2d3,_0x666d('0xd'));_0x3f920b(_0x1a733c[_0x666d('0x14')]['message']);}})['catch'](function(_0x3dc1d3){logger[_0x666d('0x10')](_0x666d('0xc'),_0x1ad2d3,_0x3dc1d3);_0x17ff89(_0x3dc1d3);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c07579c..40302a9 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 _0xc8ba=['fs-extra','../../components/auth/service','./intVtigerField.controller','isAuthenticated','get','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xc8ba,0x14f));var _0xac8b=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0xc8ba[_0x49fcfb];return _0x964926;};'use strict';var multer=require(_0xac8b('0x0'));var util=require(_0xac8b('0x1'));var path=require(_0xac8b('0x2'));var timeout=require(_0xac8b('0x3'));var express=require(_0xac8b('0x4'));var router=express['Router']();var fs_extra=require(_0xac8b('0x5'));var auth=require(_0xac8b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac8b('0x7'));router['get']('/',auth[_0xac8b('0x8')](),controller['index']);router[_0xac8b('0x9')](_0xac8b('0xa'),auth[_0xac8b('0x8')](),controller[_0xac8b('0xb')]);router['post']('/',auth[_0xac8b('0x8')](),controller[_0xac8b('0xc')]);router[_0xac8b('0xd')](_0xac8b('0xa'),auth[_0xac8b('0x8')](),controller['update']);router[_0xac8b('0xe')](_0xac8b('0xa'),auth[_0xac8b('0x8')](),controller[_0xac8b('0xf')]);module[_0xac8b('0x10')]=router; \ No newline at end of file +var _0x4c2b=['./intVtigerField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50dfec,_0x42906b){var _0x37c82f=function(_0x18f7f3){while(--_0x18f7f3){_0x50dfec['push'](_0x50dfec['shift']());}};_0x37c82f(++_0x42906b);}(_0x4c2b,0x186));var _0xb4c2=function(_0x4ef8ff,_0x472156){_0x4ef8ff=_0x4ef8ff-0x0;var _0x279adb=_0x4c2b[_0x4ef8ff];return _0x279adb;};'use strict';var multer=require(_0xb4c2('0x0'));var util=require(_0xb4c2('0x1'));var path=require(_0xb4c2('0x2'));var timeout=require(_0xb4c2('0x3'));var express=require('express');var router=express[_0xb4c2('0x4')]();var fs_extra=require(_0xb4c2('0x5'));var auth=require(_0xb4c2('0x6'));var interaction=require(_0xb4c2('0x7'));var config=require(_0xb4c2('0x8'));var controller=require(_0xb4c2('0x9'));router[_0xb4c2('0xa')]('/',auth[_0xb4c2('0xb')](),controller[_0xb4c2('0xc')]);router[_0xb4c2('0xa')]('/:id',auth[_0xb4c2('0xb')](),controller['show']);router[_0xb4c2('0xd')]('/',auth[_0xb4c2('0xb')](),controller[_0xb4c2('0xe')]);router[_0xb4c2('0xf')](_0xb4c2('0x10'),auth[_0xb4c2('0xb')](),controller[_0xb4c2('0x11')]);router[_0xb4c2('0x12')](_0xb4c2('0x10'),auth[_0xb4c2('0xb')](),controller[_0xb4c2('0x13')]);module[_0xb4c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c100829..b976fae 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 _0x1552=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x2130a6,_0x535a5d){var _0x46d4df=function(_0x407e24){while(--_0x407e24){_0x2130a6['push'](_0x2130a6['shift']());}};_0x46d4df(++_0x535a5d);}(_0x1552,0xcd));var _0x2155=function(_0x37e8e8,_0x1be63e){_0x37e8e8=_0x37e8e8-0x0;var _0x2c3c9e=_0x1552[_0x37e8e8];return _0x2c3c9e;};'use strict';var Sequelize=require('sequelize');module[_0x2155('0x0')]={'type':{'type':Sequelize[_0x2155('0x1')](_0x2155('0x2'),_0x2155('0x3'),_0x2155('0x4'),_0x2155('0x5'),_0x2155('0x6')),'defaultValue':_0x2155('0x2')},'content':{'type':Sequelize[_0x2155('0x7')]},'key':{'type':Sequelize[_0x2155('0x7')]},'keyType':{'type':Sequelize[_0x2155('0x1')](_0x2155('0x2'),'variable',_0x2155('0x4'))},'keyContent':{'type':Sequelize[_0x2155('0x7')]},'idField':{'type':Sequelize[_0x2155('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2155('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2155('0x7')]}}; \ No newline at end of file +var _0x646a=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x4c69fa,_0x206727){var _0x27b698=function(_0x2ad1d0){while(--_0x2ad1d0){_0x4c69fa['push'](_0x4c69fa['shift']());}};_0x27b698(++_0x206727);}(_0x646a,0x154));var _0xa646=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x646a[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xa646('0x0'));module[_0xa646('0x1')]={'type':{'type':Sequelize[_0xa646('0x2')]('string',_0xa646('0x3'),_0xa646('0x4'),_0xa646('0x5'),_0xa646('0x6')),'defaultValue':_0xa646('0x7')},'content':{'type':Sequelize[_0xa646('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa646('0x2')]('string',_0xa646('0x3'),_0xa646('0x4'))},'keyContent':{'type':Sequelize[_0xa646('0x8')]},'idField':{'type':Sequelize[_0xa646('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa646('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa646('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index aea17e0..39142be 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 _0x31b3=['status','undefined','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','intersection','fields','query','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','options','VtigerField','includeAll','include','findAll','keys','length','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3da34f,_0x4a18c0){var _0x4af5c1=function(_0x24a976){while(--_0x24a976){_0x3da34f['push'](_0x3da34f['shift']());}};_0x4af5c1(++_0x4a18c0);}(_0x31b3,0x13a));var _0x331b=function(_0x3f7e42,_0x47fafe){_0x3f7e42=_0x3f7e42-0x0;var _0x3bfbe8=_0x31b3[_0x3f7e42];return _0x3bfbe8;};'use strict';var emlformat=require(_0x331b('0x0'));var rimraf=require(_0x331b('0x1'));var zipdir=require(_0x331b('0x2'));var jsonpatch=require(_0x331b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x331b('0x4'));var util=require('util');var path=require('path');var sox=require(_0x331b('0x5'));var csv=require('to-csv');var ejs=require(_0x331b('0x6'));var fs=require('fs');var fs_extra=require(_0x331b('0x7'));var _=require(_0x331b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x331b('0x9'));var deskjs=require(_0x331b('0xa'));var toCsv=require('to-csv');var querystring=require(_0x331b('0xb'));var Papa=require(_0x331b('0xc'));var Redis=require(_0x331b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x331b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x331b('0xf'));var logger=require(_0x331b('0x10'))(_0x331b('0x11'));var utils=require(_0x331b('0x12'));var config=require(_0x331b('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x342f3a,_0x55e358){_0x55e358=_0x55e358||0xcc;return function(_0x8feaad){if(_0x8feaad){return _0x342f3a[_0x331b('0x14')](_0x55e358);}return _0x342f3a[_0x331b('0x15')](_0x55e358)['end']();};}function respondWithResult(_0x29383e,_0xf903c8){_0xf903c8=_0xf903c8||0xc8;return function(_0x30c619){if(_0x30c619){return _0x29383e[_0x331b('0x15')](_0xf903c8)['json'](_0x30c619);}};}function respondWithFilteredResult(_0x48b13a,_0x8baf0){return function(_0x42d439){if(_0x42d439){var _0x8b077b=typeof _0x8baf0['offset']===_0x331b('0x16')&&typeof _0x8baf0['limit']==='undefined';var _0x2aacc6=_0x42d439[_0x331b('0x17')];var _0x1277d4=_0x8b077b?0x0:_0x8baf0[_0x331b('0x18')];var _0x2aed2f=_0x8b077b?_0x42d439[_0x331b('0x17')]:_0x8baf0['offset']+_0x8baf0[_0x331b('0x19')];var _0xcdaf48;if(_0x2aed2f>=_0x2aacc6){_0x2aed2f=_0x2aacc6;_0xcdaf48=0xc8;}else{_0xcdaf48=0xce;}_0x48b13a[_0x331b('0x15')](_0xcdaf48);return _0x48b13a[_0x331b('0x1a')](_0x331b('0x1b'),_0x1277d4+'-'+_0x2aed2f+'/'+_0x2aacc6)[_0x331b('0x1c')](_0x42d439);}return null;};}function patchUpdates(_0x1d730d){return function(_0xe2f4bf){try{jsonpatch[_0x331b('0x1d')](_0xe2f4bf,_0x1d730d,!![]);}catch(_0x26546){return BPromise['reject'](_0x26546);}return _0xe2f4bf['save']();};}function saveUpdates(_0xfa93e3,_0xe5d298){return function(_0x2ffc7d){if(_0x2ffc7d){return _0x2ffc7d[_0x331b('0x1e')](_0xfa93e3)[_0x331b('0x1f')](function(_0xfb3a17){return _0xfb3a17;});}return null;};}function removeEntity(_0x300ff8,_0x7828f1){return function(_0x50f754){if(_0x50f754){return _0x50f754[_0x331b('0x20')]()['then'](function(){_0x300ff8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb3a9,_0x8aab10){return function(_0x2be068){if(!_0x2be068){_0x4fb3a9[_0x331b('0x14')](0x194);}return _0x2be068;};}function handleError(_0x148c43,_0x3d3d0f){_0x3d3d0f=_0x3d3d0f||0x1f4;return function(_0x2f1c7c){logger['error'](_0x2f1c7c[_0x331b('0x21')]);if(_0x2f1c7c[_0x331b('0x22')]){delete _0x2f1c7c[_0x331b('0x22')];}_0x148c43[_0x331b('0x15')](_0x3d3d0f)[_0x331b('0x23')](_0x2f1c7c);};}exports[_0x331b('0x24')]=function(_0x46a444,_0x10be63){var _0x2ef750={},_0x150468={},_0xa3858b={'count':0x0,'rows':[]};var _0x3d07e1=_[_0x331b('0x25')](db['VtigerField'][_0x331b('0x26')],function(_0x28f0fd){return{'name':_0x28f0fd[_0x331b('0x27')],'type':_0x28f0fd['type'][_0x331b('0x28')]};});_0x150468[_0x331b('0x29')]=_['map'](_0x3d07e1,'name');_0x150468['query']=_['keys'](_0x46a444['query']);_0x150468['filters']=_[_0x331b('0x2a')](_0x150468[_0x331b('0x29')],_0x150468['query']);_0x2ef750['attributes']=_[_0x331b('0x2a')](_0x150468[_0x331b('0x29')],qs[_0x331b('0x2b')](_0x46a444[_0x331b('0x2c')][_0x331b('0x2b')]));_0x2ef750[_0x331b('0x2d')]=_0x2ef750['attributes']['length']?_0x2ef750['attributes']:_0x150468[_0x331b('0x29')];if(!_0x46a444[_0x331b('0x2c')]['hasOwnProperty'](_0x331b('0x2e'))){_0x2ef750[_0x331b('0x19')]=qs['limit'](_0x46a444['query'][_0x331b('0x19')]);_0x2ef750[_0x331b('0x18')]=qs['offset'](_0x46a444['query'][_0x331b('0x18')]);}_0x2ef750[_0x331b('0x2f')]=qs[_0x331b('0x30')](_0x46a444[_0x331b('0x2c')][_0x331b('0x30')]);_0x2ef750[_0x331b('0x31')]=qs[_0x331b('0x32')](_[_0x331b('0x33')](_0x46a444[_0x331b('0x2c')],_0x150468[_0x331b('0x32')]),_0x3d07e1);if(_0x46a444[_0x331b('0x2c')][_0x331b('0x34')]){_0x2ef750[_0x331b('0x31')]=_[_0x331b('0x35')](_0x2ef750['where'],{'$or':_[_0x331b('0x25')](_0x3d07e1,function(_0x4a054b){if(_0x4a054b[_0x331b('0x36')]!=='VIRTUAL'){var _0x43e22d={};_0x43e22d[_0x4a054b[_0x331b('0x22')]]={'$like':'%'+_0x46a444[_0x331b('0x2c')][_0x331b('0x34')]+'%'};return _0x43e22d;}})});}_0x2ef750=_[_0x331b('0x35')]({},_0x2ef750,_0x46a444[_0x331b('0x37')]);var _0x3360dd={'where':_0x2ef750['where']};return db[_0x331b('0x38')][_0x331b('0x17')](_0x3360dd)[_0x331b('0x1f')](function(_0x316c94){_0xa3858b['count']=_0x316c94;if(_0x46a444[_0x331b('0x2c')][_0x331b('0x39')]){_0x2ef750[_0x331b('0x3a')]=[{'all':!![]}];}return db['VtigerField'][_0x331b('0x3b')](_0x2ef750);})[_0x331b('0x1f')](function(_0x267fe6){_0xa3858b['rows']=_0x267fe6;return _0xa3858b;})['then'](respondWithFilteredResult(_0x10be63,_0x2ef750))['catch'](handleError(_0x10be63,null));};exports['show']=function(_0x443ef1,_0x12b023){var _0x3ec8e7={'raw':!![],'where':{'id':_0x443ef1['params']['id']}},_0x3c8703={};_0x3c8703[_0x331b('0x29')]=_[_0x331b('0x3c')](db['VtigerField'][_0x331b('0x26')]);_0x3c8703[_0x331b('0x2c')]=_[_0x331b('0x3c')](_0x443ef1[_0x331b('0x2c')]);_0x3c8703[_0x331b('0x32')]=_['intersection'](_0x3c8703[_0x331b('0x29')],_0x3c8703[_0x331b('0x2c')]);_0x3ec8e7[_0x331b('0x2d')]=_[_0x331b('0x2a')](_0x3c8703['model'],qs[_0x331b('0x2b')](_0x443ef1[_0x331b('0x2c')][_0x331b('0x2b')]));_0x3ec8e7[_0x331b('0x2d')]=_0x3ec8e7[_0x331b('0x2d')][_0x331b('0x3d')]?_0x3ec8e7[_0x331b('0x2d')]:_0x3c8703[_0x331b('0x29')];if(_0x443ef1[_0x331b('0x2c')][_0x331b('0x39')]){_0x3ec8e7[_0x331b('0x3a')]=[{'all':!![]}];}_0x3ec8e7=_['merge']({},_0x3ec8e7,_0x443ef1[_0x331b('0x37')]);return db[_0x331b('0x38')][_0x331b('0x3e')](_0x3ec8e7)['then'](handleEntityNotFound(_0x12b023,null))[_0x331b('0x1f')](respondWithResult(_0x12b023,null))['catch'](handleError(_0x12b023,null));};exports[_0x331b('0x3f')]=function(_0x5d4a5b,_0x1ba7d7){return db[_0x331b('0x38')][_0x331b('0x3f')](_0x5d4a5b[_0x331b('0x40')],{})[_0x331b('0x1f')](respondWithResult(_0x1ba7d7,0xc9))[_0x331b('0x41')](handleError(_0x1ba7d7,null));};exports[_0x331b('0x1e')]=function(_0x1d407d,_0xc8b339){if(_0x1d407d['body']['id']){delete _0x1d407d['body']['id'];}return db['VtigerField'][_0x331b('0x3e')]({'where':{'id':_0x1d407d['params']['id']}})[_0x331b('0x1f')](handleEntityNotFound(_0xc8b339,null))[_0x331b('0x1f')](saveUpdates(_0x1d407d['body'],null))[_0x331b('0x1f')](respondWithResult(_0xc8b339,null))[_0x331b('0x41')](handleError(_0xc8b339,null));};exports[_0x331b('0x20')]=function(_0x5cb905,_0x3f597a){return db[_0x331b('0x38')][_0x331b('0x3e')]({'where':{'id':_0x5cb905[_0x331b('0x42')]['id']}})[_0x331b('0x1f')](handleEntityNotFound(_0x3f597a,null))[_0x331b('0x1f')](removeEntity(_0x3f597a,null))[_0x331b('0x41')](handleError(_0x3f597a,null));}; \ No newline at end of file +var _0x5516=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VtigerField','include','findAll','catch','params','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x5516,0xed));var _0x6551=function(_0x58389d,_0x3137df){_0x58389d=_0x58389d-0x0;var _0x2be20a=_0x5516[_0x58389d];return _0x2be20a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6551('0x0'));var zipdir=require(_0x6551('0x1'));var jsonpatch=require(_0x6551('0x2'));var rp=require('request-promise');var moment=require(_0x6551('0x3'));var BPromise=require(_0x6551('0x4'));var Mustache=require(_0x6551('0x5'));var util=require(_0x6551('0x6'));var path=require(_0x6551('0x7'));var sox=require('sox');var csv=require(_0x6551('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6551('0x9'));var _=require(_0x6551('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6551('0xb'));var deskjs=require(_0x6551('0xc'));var toCsv=require(_0x6551('0x8'));var querystring=require('querystring');var Papa=require(_0x6551('0xd'));var Redis=require(_0x6551('0xe'));var authService=require(_0x6551('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6551('0x10'));var hardwareService=require(_0x6551('0x11'));var logger=require(_0x6551('0x12'))('api');var utils=require(_0x6551('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6551('0x14'))['db'];function respondWithStatusCode(_0x3a2baa,_0x283007){_0x283007=_0x283007||0xcc;return function(_0x2cecd8){if(_0x2cecd8){return _0x3a2baa[_0x6551('0x15')](_0x283007);}return _0x3a2baa[_0x6551('0x16')](_0x283007)[_0x6551('0x17')]();};}function respondWithResult(_0x366ed1,_0x5c49f0){_0x5c49f0=_0x5c49f0||0xc8;return function(_0x1d47ab){if(_0x1d47ab){return _0x366ed1[_0x6551('0x16')](_0x5c49f0)[_0x6551('0x18')](_0x1d47ab);}};}function respondWithFilteredResult(_0x12501c,_0x1ebc04){return function(_0x5061be){if(_0x5061be){var _0x3b1612=typeof _0x1ebc04['offset']===_0x6551('0x19')&&typeof _0x1ebc04[_0x6551('0x1a')]===_0x6551('0x19');var _0x522bbd=_0x5061be[_0x6551('0x1b')];var _0x2add5c=_0x3b1612?0x0:_0x1ebc04[_0x6551('0x1c')];var _0x494a44=_0x3b1612?_0x5061be[_0x6551('0x1b')]:_0x1ebc04['offset']+_0x1ebc04[_0x6551('0x1a')];var _0x2419fd;if(_0x494a44>=_0x522bbd){_0x494a44=_0x522bbd;_0x2419fd=0xc8;}else{_0x2419fd=0xce;}_0x12501c[_0x6551('0x16')](_0x2419fd);return _0x12501c[_0x6551('0x1d')](_0x6551('0x1e'),_0x2add5c+'-'+_0x494a44+'/'+_0x522bbd)['json'](_0x5061be);}return null;};}function patchUpdates(_0x2e263d){return function(_0x498ab6){try{jsonpatch[_0x6551('0x1f')](_0x498ab6,_0x2e263d,!![]);}catch(_0x343baa){return BPromise[_0x6551('0x20')](_0x343baa);}return _0x498ab6[_0x6551('0x21')]();};}function saveUpdates(_0x41d807,_0xe86c7d){return function(_0xd4520b){if(_0xd4520b){return _0xd4520b[_0x6551('0x22')](_0x41d807)['then'](function(_0x69b43b){return _0x69b43b;});}return null;};}function removeEntity(_0x13af85,_0x5097e){return function(_0x197532){if(_0x197532){return _0x197532['destroy']()[_0x6551('0x23')](function(){_0x13af85[_0x6551('0x16')](0xcc)[_0x6551('0x17')]();});}};}function handleEntityNotFound(_0x3d72c6,_0x1a199a){return function(_0x4f7dcb){if(!_0x4f7dcb){_0x3d72c6[_0x6551('0x15')](0x194);}return _0x4f7dcb;};}function handleError(_0x1d28a5,_0xe6f82c){_0xe6f82c=_0xe6f82c||0x1f4;return function(_0x3e0324){logger[_0x6551('0x24')](_0x3e0324[_0x6551('0x25')]);if(_0x3e0324[_0x6551('0x26')]){delete _0x3e0324[_0x6551('0x26')];}_0x1d28a5[_0x6551('0x16')](_0xe6f82c)[_0x6551('0x27')](_0x3e0324);};}exports[_0x6551('0x28')]=function(_0x222022,_0x161557){var _0x582cff={},_0x4ba888={},_0x5f391a={'count':0x0,'rows':[]};var _0x4b134e=_[_0x6551('0x29')](db['VtigerField'][_0x6551('0x2a')],function(_0x42f1e8){return{'name':_0x42f1e8[_0x6551('0x2b')],'type':_0x42f1e8['type']['key']};});_0x4ba888[_0x6551('0x2c')]=_[_0x6551('0x29')](_0x4b134e,_0x6551('0x26'));_0x4ba888[_0x6551('0x2d')]=_[_0x6551('0x2e')](_0x222022[_0x6551('0x2d')]);_0x4ba888[_0x6551('0x2f')]=_[_0x6551('0x30')](_0x4ba888['model'],_0x4ba888[_0x6551('0x2d')]);_0x582cff[_0x6551('0x31')]=_[_0x6551('0x30')](_0x4ba888[_0x6551('0x2c')],qs[_0x6551('0x32')](_0x222022[_0x6551('0x2d')]['fields']));_0x582cff[_0x6551('0x31')]=_0x582cff[_0x6551('0x31')][_0x6551('0x33')]?_0x582cff[_0x6551('0x31')]:_0x4ba888['model'];if(!_0x222022['query'][_0x6551('0x34')](_0x6551('0x35'))){_0x582cff[_0x6551('0x1a')]=qs[_0x6551('0x1a')](_0x222022[_0x6551('0x2d')][_0x6551('0x1a')]);_0x582cff['offset']=qs[_0x6551('0x1c')](_0x222022[_0x6551('0x2d')]['offset']);}_0x582cff[_0x6551('0x36')]=qs[_0x6551('0x37')](_0x222022[_0x6551('0x2d')][_0x6551('0x37')]);_0x582cff[_0x6551('0x38')]=qs['filters'](_[_0x6551('0x39')](_0x222022[_0x6551('0x2d')],_0x4ba888[_0x6551('0x2f')]),_0x4b134e);if(_0x222022[_0x6551('0x2d')][_0x6551('0x3a')]){_0x582cff[_0x6551('0x38')]=_[_0x6551('0x3b')](_0x582cff[_0x6551('0x38')],{'$or':_[_0x6551('0x29')](_0x4b134e,function(_0x16ddd6){if(_0x16ddd6[_0x6551('0x3c')]!==_0x6551('0x3d')){var _0x85f779={};_0x85f779[_0x16ddd6[_0x6551('0x26')]]={'$like':'%'+_0x222022[_0x6551('0x2d')]['filter']+'%'};return _0x85f779;}})});}_0x582cff=_['merge']({},_0x582cff,_0x222022['options']);var _0x13877a={'where':_0x582cff[_0x6551('0x38')]};return db[_0x6551('0x3e')][_0x6551('0x1b')](_0x13877a)[_0x6551('0x23')](function(_0x5db274){_0x5f391a[_0x6551('0x1b')]=_0x5db274;if(_0x222022[_0x6551('0x2d')]['includeAll']){_0x582cff[_0x6551('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0x6551('0x40')](_0x582cff);})[_0x6551('0x23')](function(_0x484a93){_0x5f391a['rows']=_0x484a93;return _0x5f391a;})[_0x6551('0x23')](respondWithFilteredResult(_0x161557,_0x582cff))[_0x6551('0x41')](handleError(_0x161557,null));};exports['show']=function(_0x24628c,_0x135195){var _0x2fe4fb={'raw':!![],'where':{'id':_0x24628c[_0x6551('0x42')]['id']}},_0x4d544f={};_0x4d544f[_0x6551('0x2c')]=_['keys'](db[_0x6551('0x3e')][_0x6551('0x2a')]);_0x4d544f[_0x6551('0x2d')]=_[_0x6551('0x2e')](_0x24628c[_0x6551('0x2d')]);_0x4d544f[_0x6551('0x2f')]=_['intersection'](_0x4d544f['model'],_0x4d544f[_0x6551('0x2d')]);_0x2fe4fb[_0x6551('0x31')]=_[_0x6551('0x30')](_0x4d544f[_0x6551('0x2c')],qs[_0x6551('0x32')](_0x24628c['query'][_0x6551('0x32')]));_0x2fe4fb[_0x6551('0x31')]=_0x2fe4fb[_0x6551('0x31')][_0x6551('0x33')]?_0x2fe4fb[_0x6551('0x31')]:_0x4d544f['model'];if(_0x24628c[_0x6551('0x2d')][_0x6551('0x43')]){_0x2fe4fb[_0x6551('0x3f')]=[{'all':!![]}];}_0x2fe4fb=_['merge']({},_0x2fe4fb,_0x24628c['options']);return db['VtigerField'][_0x6551('0x44')](_0x2fe4fb)[_0x6551('0x23')](handleEntityNotFound(_0x135195,null))[_0x6551('0x23')](respondWithResult(_0x135195,null))['catch'](handleError(_0x135195,null));};exports['create']=function(_0x3d9de0,_0x37f002){return db['VtigerField'][_0x6551('0x45')](_0x3d9de0['body'],{})['then'](respondWithResult(_0x37f002,0xc9))[_0x6551('0x41')](handleError(_0x37f002,null));};exports[_0x6551('0x22')]=function(_0x2f3c60,_0x55229f){if(_0x2f3c60[_0x6551('0x46')]['id']){delete _0x2f3c60[_0x6551('0x46')]['id'];}return db[_0x6551('0x3e')][_0x6551('0x44')]({'where':{'id':_0x2f3c60[_0x6551('0x42')]['id']}})[_0x6551('0x23')](handleEntityNotFound(_0x55229f,null))['then'](saveUpdates(_0x2f3c60[_0x6551('0x46')],null))[_0x6551('0x23')](respondWithResult(_0x55229f,null))[_0x6551('0x41')](handleError(_0x55229f,null));};exports[_0x6551('0x47')]=function(_0x2db7af,_0x1b3711){return db['VtigerField'][_0x6551('0x44')]({'where':{'id':_0x2db7af[_0x6551('0x42')]['id']}})[_0x6551('0x23')](handleEntityNotFound(_0x1b3711,null))[_0x6551('0x23')](removeEntity(_0x1b3711,null))['catch'](handleError(_0x1b3711,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 034570a..839224d 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 _0x9200=['util','api','request-promise','path','./intVtigerField.attributes','define','VtigerField','vtiger_unique_index','FieldId','lodash'];(function(_0x514db6,_0x5bcd0e){var _0x3fca33=function(_0xd7a993){while(--_0xd7a993){_0x514db6['push'](_0x514db6['shift']());}};_0x3fca33(++_0x5bcd0e);}(_0x9200,0x135));var _0x0920=function(_0x1ede8f,_0x26ab94){_0x1ede8f=_0x1ede8f-0x0;var _0x77a5a6=_0x9200[_0x1ede8f];return _0x77a5a6;};'use strict';var _=require(_0x0920('0x0'));var util=require(_0x0920('0x1'));var logger=require('../../config/logger')(_0x0920('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0920('0x3'));var fs=require('fs');var path=require(_0x0920('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0920('0x5'));module['exports']=function(_0x8097e0,_0x1f06fb){return _0x8097e0[_0x0920('0x6')](_0x0920('0x7'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x0920('0x8'),'fields':['idField',_0x0920('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e52=['path','rimraf','./intVtigerField.attributes','exports','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x50914a,_0x12bc8b){var _0x388be7=function(_0x38c159){while(--_0x38c159){_0x50914a['push'](_0x50914a['shift']());}};_0x388be7(++_0x12bc8b);}(_0x6e52,0xcb));var _0x26e5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26e5('0x0'));var util=require(_0x26e5('0x1'));var logger=require(_0x26e5('0x2'))('api');var moment=require(_0x26e5('0x3'));var BPromise=require(_0x26e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26e5('0x5'));var rimraf=require(_0x26e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x26e5('0x7'));module[_0x26e5('0x8')]=function(_0x15ff72,_0x507c4f){return _0x15ff72['define']('VtigerField',attributes,{'tableName':_0x26e5('0x9'),'paranoid':![],'indexes':[{'name':_0x26e5('0xa'),'fields':[_0x26e5('0xb'),_0x26e5('0xc')],'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 c03a63f..86eaa57 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 _0xd311=['stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x41f1d6,_0x1fca82){var _0x482e62=function(_0x584ab6){while(--_0x584ab6){_0x41f1d6['push'](_0x41f1d6['shift']());}};_0x482e62(++_0x1fca82);}(_0xd311,0xf8));var _0x1d31=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd311[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1d31('0x0'));var util=require('util');var moment=require(_0x1d31('0x1'));var BPromise=require(_0x1d31('0x2'));var rs=require(_0x1d31('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d31('0x4'))['db'];var utils=require(_0x1d31('0x5'));var logger=require(_0x1d31('0x6'))(_0x1d31('0x7'));var config=require(_0x1d31('0x8'));var jayson=require(_0x1d31('0x9'));var client=jayson[_0x1d31('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3a84,_0x4ed912,_0x66226f){return new BPromise(function(_0x30b7a8,_0x3b9236){return client[_0x1d31('0xb')](_0x1d3a84,_0x66226f)[_0x1d31('0xc')](function(_0x99d2b1){logger['info'](_0x1d31('0xd'),_0x4ed912,_0x1d31('0xe'));logger['debug'](_0x1d31('0xf'),_0x4ed912,'request\x20sent',JSON[_0x1d31('0x10')](_0x99d2b1));if(_0x99d2b1[_0x1d31('0x11')]){if(_0x99d2b1[_0x1d31('0x11')][_0x1d31('0x12')]===0x1f4){logger[_0x1d31('0x11')](_0x1d31('0xd'),_0x4ed912,_0x99d2b1[_0x1d31('0x11')][_0x1d31('0x13')]);return _0x3b9236(_0x99d2b1[_0x1d31('0x11')][_0x1d31('0x13')]);}logger[_0x1d31('0x11')]('VtigerField,\x20%s,\x20%s',_0x4ed912,_0x99d2b1[_0x1d31('0x11')][_0x1d31('0x13')]);return _0x30b7a8(_0x99d2b1['error']['message']);}else{logger[_0x1d31('0x14')](_0x1d31('0xd'),_0x4ed912,_0x1d31('0xe'));_0x30b7a8(_0x99d2b1['result']['message']);}})[_0x1d31('0x15')](function(_0x18b3c9){logger[_0x1d31('0x11')](_0x1d31('0xd'),_0x4ed912,_0x18b3c9);_0x3b9236(_0x18b3c9);});});} \ No newline at end of file +var _0x48eb=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0xef56f8,_0x4503c9){var _0x4a302a=function(_0x3fd19c){while(--_0x3fd19c){_0xef56f8['push'](_0xef56f8['shift']());}};_0x4a302a(++_0x4503c9);}(_0x48eb,0xce));var _0xb48e=function(_0x302485,_0x3d7744){_0x302485=_0x302485-0x0;var _0x372e41=_0x48eb[_0x302485];return _0x372e41;};'use strict';var _=require('lodash');var util=require(_0xb48e('0x0'));var moment=require('moment');var BPromise=require(_0xb48e('0x1'));var rs=require(_0xb48e('0x2'));var fs=require('fs');var Redis=require(_0xb48e('0x3'));var db=require(_0xb48e('0x4'))['db'];var utils=require(_0xb48e('0x5'));var logger=require(_0xb48e('0x6'))('rpc');var config=require(_0xb48e('0x7'));var jayson=require(_0xb48e('0x8'));var client=jayson['client'][_0xb48e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22e016,_0x15e37d,_0x25b653){return new BPromise(function(_0xc42eff,_0x53b421){return client['request'](_0x22e016,_0x25b653)[_0xb48e('0xa')](function(_0x3bcb8e){logger[_0xb48e('0xb')]('VtigerField,\x20%s,\x20%s',_0x15e37d,_0xb48e('0xc'));logger[_0xb48e('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x15e37d,'request\x20sent',JSON[_0xb48e('0xe')](_0x3bcb8e));if(_0x3bcb8e['error']){if(_0x3bcb8e[_0xb48e('0xf')][_0xb48e('0x10')]===0x1f4){logger[_0xb48e('0xf')](_0xb48e('0x11'),_0x15e37d,_0x3bcb8e[_0xb48e('0xf')][_0xb48e('0x12')]);return _0x53b421(_0x3bcb8e[_0xb48e('0xf')][_0xb48e('0x12')]);}logger[_0xb48e('0xf')](_0xb48e('0x11'),_0x15e37d,_0x3bcb8e[_0xb48e('0xf')][_0xb48e('0x12')]);return _0xc42eff(_0x3bcb8e['error'][_0xb48e('0x12')]);}else{logger[_0xb48e('0xb')](_0xb48e('0x11'),_0x15e37d,_0xb48e('0xc'));_0xc42eff(_0x3bcb8e[_0xb48e('0x13')][_0xb48e('0x12')]);}})[_0xb48e('0x14')](function(_0x1b4db6){logger[_0xb48e('0xf')](_0xb48e('0x11'),_0x15e37d,_0x1b4db6);_0x53b421(_0x1b4db6);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ea7829c..bf4b7ac 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 _0x1c3b=['post','delete','/:id','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getFields'];(function(_0x3ac769,_0x2825df){var _0x2185eb=function(_0x43cc1d){while(--_0x43cc1d){_0x3ac769['push'](_0x3ac769['shift']());}};_0x2185eb(++_0x2825df);}(_0x1c3b,0xa5));var _0xb1c3=function(_0x523c2f,_0x25f5e9){_0x523c2f=_0x523c2f-0x0;var _0x595622=_0x1c3b[_0x523c2f];return _0x595622;};'use strict';var multer=require(_0xb1c3('0x0'));var util=require('util');var path=require(_0xb1c3('0x1'));var timeout=require('connect-timeout');var express=require(_0xb1c3('0x2'));var router=express[_0xb1c3('0x3')]();var fs_extra=require(_0xb1c3('0x4'));var auth=require(_0xb1c3('0x5'));var interaction=require(_0xb1c3('0x6'));var config=require(_0xb1c3('0x7'));var controller=require(_0xb1c3('0x8'));router['get']('/',auth[_0xb1c3('0x9')](),controller[_0xb1c3('0xa')]);router[_0xb1c3('0xb')]('/:id',auth[_0xb1c3('0x9')](),controller[_0xb1c3('0xc')]);router[_0xb1c3('0xb')](_0xb1c3('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb1c3('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb1c3('0xe')]);router[_0xb1c3('0xf')]('/',auth[_0xb1c3('0x9')](),controller['create']);router[_0xb1c3('0xf')](_0xb1c3('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0xb1c3('0x9')](),controller['update']);router[_0xb1c3('0x10')](_0xb1c3('0x11'),auth[_0xb1c3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7fe0=['/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','get','/:id','show'];(function(_0x2a9e36,_0x271122){var _0x24185b=function(_0x291182){while(--_0x291182){_0x2a9e36['push'](_0x2a9e36['shift']());}};_0x24185b(++_0x271122);}(_0x7fe0,0x198));var _0x07fe=function(_0xf9918d,_0x53f2aa){_0xf9918d=_0xf9918d-0x0;var _0xf6bfe0=_0x7fe0[_0xf9918d];return _0xf6bfe0;};'use strict';var multer=require(_0x07fe('0x0'));var util=require(_0x07fe('0x1'));var path=require(_0x07fe('0x2'));var timeout=require(_0x07fe('0x3'));var express=require(_0x07fe('0x4'));var router=express[_0x07fe('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x07fe('0x6'));var config=require('../../config/environment');var controller=require(_0x07fe('0x7'));router['get']('/',auth[_0x07fe('0x8')](),controller['index']);router[_0x07fe('0x9')](_0x07fe('0xa'),auth[_0x07fe('0x8')](),controller[_0x07fe('0xb')]);router[_0x07fe('0x9')](_0x07fe('0xc'),auth[_0x07fe('0x8')](),controller[_0x07fe('0xd')]);router[_0x07fe('0x9')]('/:id/fields',auth[_0x07fe('0x8')](),controller[_0x07fe('0xe')]);router[_0x07fe('0xf')]('/',auth[_0x07fe('0x8')](),controller[_0x07fe('0x10')]);router['post'](_0x07fe('0xc'),auth[_0x07fe('0x8')](),controller[_0x07fe('0x11')]);router['put'](_0x07fe('0xa'),auth[_0x07fe('0x8')](),controller[_0x07fe('0x12')]);router[_0x07fe('0x13')](_0x07fe('0xa'),auth[_0x07fe('0x8')](),controller['destroy']);module[_0x07fe('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 2193b50..86b70e7 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 _0x1b65=['remoteUri','ENUM','password','integrationTab','sequelize','exports','STRING','username'];(function(_0x383484,_0x554dbb){var _0x4e5a6f=function(_0x1167cf){while(--_0x1167cf){_0x383484['push'](_0x383484['shift']());}};_0x4e5a6f(++_0x554dbb);}(_0x1b65,0x1b4));var _0x51b6=function(_0x138387,_0x2a16ac){_0x138387=_0x138387-0x0;var _0x45b15a=_0x1b65[_0x138387];return _0x45b15a;};'use strict';var Sequelize=require(_0x51b6('0x0'));module[_0x51b6('0x1')]={'name':{'type':Sequelize[_0x51b6('0x2')]},'description':{'type':Sequelize[_0x51b6('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x51b6('0x3')},'password':{'type':Sequelize[_0x51b6('0x2')]},'token':{'type':Sequelize[_0x51b6('0x2')]},'remoteUri':{'type':Sequelize[_0x51b6('0x2')],'unique':_0x51b6('0x4')},'authType':{'type':Sequelize[_0x51b6('0x5')](_0x51b6('0x6'),'token'),'defaultValue':_0x51b6('0x6')},'serverUrl':{'type':Sequelize[_0x51b6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x51b6('0x5')](_0x51b6('0x7'),'newTab'),'defaultValue':_0x51b6('0x7')}}; \ No newline at end of file +var _0xa46e=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','password'];(function(_0x26592b,_0x1ee506){var _0x4ee592=function(_0xa6a9af){while(--_0xa6a9af){_0x26592b['push'](_0x26592b['shift']());}};_0x4ee592(++_0x1ee506);}(_0xa46e,0x8a));var _0xea46=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xa46e[_0x44a64f];return _0x52024b;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea46('0x2')]},'username':{'type':Sequelize[_0xea46('0x2')],'unique':_0xea46('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xea46('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xea46('0x4')},'authType':{'type':Sequelize['ENUM'](_0xea46('0x5'),'token'),'defaultValue':_0xea46('0x5')},'serverUrl':{'type':Sequelize[_0xea46('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xea46('0x6'),_0xea46('0x7')),'defaultValue':_0xea46('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1d33e44..c4a615b 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 _0xe706=['getConfigurations','findOne','ZendeskConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','format','password','headers','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','show','includeAll','include','find','create','body','catch','params'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0xe706,0xa3));var _0x6e70=function(_0x51e1d5,_0x399588){_0x51e1d5=_0x51e1d5-0x0;var _0x105666=_0xe706[_0x51e1d5];return _0x105666;};'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'];var integrations=require(_0x6e70('0x1d'));function respondWithStatusCode(_0x3b38f3,_0x310eb7){_0x310eb7=_0x310eb7||0xcc;return function(_0xa1eb74){if(_0xa1eb74){return _0x3b38f3[_0x6e70('0x1e')](_0x310eb7);}return _0x3b38f3['status'](_0x310eb7)['end']();};}function respondWithResult(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xc8;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['status'](_0x257e81)[_0x6e70('0x1f')](_0x5a37a6);}};}function respondWithFilteredResult(_0x22c50c,_0x5d9263){return function(_0x24f3ac){if(_0x24f3ac){var _0x5c3fe7=typeof _0x5d9263[_0x6e70('0x20')]===_0x6e70('0x21')&&typeof _0x5d9263['limit']==='undefined';var _0x3bd572=_0x24f3ac['count'];var _0x28a21f=_0x5c3fe7?0x0:_0x5d9263[_0x6e70('0x20')];var _0x53acdc=_0x5c3fe7?_0x24f3ac['count']:_0x5d9263[_0x6e70('0x20')]+_0x5d9263[_0x6e70('0x22')];var _0x2368eb;if(_0x53acdc>=_0x3bd572){_0x53acdc=_0x3bd572;_0x2368eb=0xc8;}else{_0x2368eb=0xce;}_0x22c50c[_0x6e70('0x23')](_0x2368eb);return _0x22c50c[_0x6e70('0x24')](_0x6e70('0x25'),_0x28a21f+'-'+_0x53acdc+'/'+_0x3bd572)[_0x6e70('0x1f')](_0x24f3ac);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x26')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x27')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x28')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x29')](_0x27b294)[_0x6e70('0x2a')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2a')](function(){_0x10fc91[_0x6e70('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecdf1,_0x1196ed){return function(_0x5f268f){if(!_0x5f268f){_0x3ecdf1[_0x6e70('0x1e')](0x194);}return _0x5f268f;};}function handleError(_0x67fb43,_0x2bb231){_0x2bb231=_0x2bb231||0x1f4;return function(_0x4a67ac){logger['error'](_0x4a67ac[_0x6e70('0x2b')]);if(_0x4a67ac[_0x6e70('0x2c')]){delete _0x4a67ac[_0x6e70('0x2c')];}_0x67fb43[_0x6e70('0x23')](_0x2bb231)[_0x6e70('0x2d')](_0x4a67ac);};}exports['index']=function(_0x1952ea,_0x406f29){var _0xecf336={},_0x2864a0={},_0x396a67={'count':0x0,'rows':[]};var _0x20a225=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a5d30){return{'name':_0x3a5d30['fieldName'],'type':_0x3a5d30[_0x6e70('0x31')]['key']};});_0x2864a0[_0x6e70('0x32')]=_['map'](_0x20a225,_0x6e70('0x2c'));_0x2864a0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1952ea['query']);_0x2864a0[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x2864a0['model'],_0x2864a0[_0x6e70('0x33')]);_0xecf336[_0x6e70('0x37')]=_['intersection'](_0x2864a0[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x38')]));_0xecf336[_0x6e70('0x37')]=_0xecf336[_0x6e70('0x37')][_0x6e70('0x39')]?_0xecf336[_0x6e70('0x37')]:_0x2864a0[_0x6e70('0x32')];if(!_0x1952ea[_0x6e70('0x33')]['hasOwnProperty'](_0x6e70('0x3a'))){_0xecf336['limit']=qs[_0x6e70('0x22')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x22')]);_0xecf336[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x20')]);}_0xecf336[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3c')]);_0xecf336[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_['pick'](_0x1952ea['query'],_0x2864a0['filters']),_0x20a225);if(_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]){_0xecf336[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0xecf336[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x20a225,function(_0x572a71){if(_0x572a71[_0x6e70('0x31')]!==_0x6e70('0x40')){var _0x1c5cde={};_0x1c5cde[_0x572a71[_0x6e70('0x2c')]]={'$like':'%'+_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]+'%'};return _0x1c5cde;}})});}_0xecf336=_[_0x6e70('0x3f')]({},_0xecf336,_0x1952ea[_0x6e70('0x41')]);var _0x5be100={'where':_0xecf336[_0x6e70('0x3d')]};return db[_0x6e70('0x2f')][_0x6e70('0x42')](_0x5be100)[_0x6e70('0x2a')](function(_0x201da9){_0x396a67[_0x6e70('0x42')]=_0x201da9;if(_0x1952ea[_0x6e70('0x33')]['includeAll']){_0xecf336['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x6e70('0x43')](_0xecf336);})[_0x6e70('0x2a')](function(_0x83847b){_0x396a67[_0x6e70('0x44')]=_0x83847b;return _0x396a67;})[_0x6e70('0x2a')](respondWithFilteredResult(_0x406f29,_0xecf336))['catch'](handleError(_0x406f29,null));};exports[_0x6e70('0x45')]=function(_0x2a58d7,_0x2a2aca){var _0x52b197={'raw':![],'where':{'id':_0x2a58d7['params']['id']}},_0x544ad0={};_0x544ad0[_0x6e70('0x32')]=_['keys'](db[_0x6e70('0x2f')][_0x6e70('0x30')]);_0x544ad0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x2a58d7['query']);_0x544ad0[_0x6e70('0x35')]=_['intersection'](_0x544ad0[_0x6e70('0x32')],_0x544ad0[_0x6e70('0x33')]);_0x52b197[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x544ad0['model'],qs[_0x6e70('0x38')](_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x38')]));_0x52b197[_0x6e70('0x37')]=_0x52b197[_0x6e70('0x37')][_0x6e70('0x39')]?_0x52b197[_0x6e70('0x37')]:_0x544ad0['model'];if(_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x46')]){_0x52b197[_0x6e70('0x47')]=[{'all':!![]}];}_0x52b197=_[_0x6e70('0x3f')]({},_0x52b197,_0x2a58d7[_0x6e70('0x41')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x52b197)['then'](handleEntityNotFound(_0x2a2aca,null))[_0x6e70('0x2a')](respondWithResult(_0x2a2aca,null))['catch'](handleError(_0x2a2aca,null));};exports[_0x6e70('0x49')]=function(_0x3836e4,_0x4b351e){return db['ZendeskAccount'][_0x6e70('0x49')](_0x3836e4[_0x6e70('0x4a')],{})[_0x6e70('0x2a')](respondWithResult(_0x4b351e,0xc9))['catch'](handleError(_0x4b351e,null));};exports['update']=function(_0x238ebb,_0x11ac3d){if(_0x238ebb[_0x6e70('0x4a')]['id']){delete _0x238ebb[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x238ebb['params']['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x11ac3d,null))[_0x6e70('0x2a')](saveUpdates(_0x238ebb[_0x6e70('0x4a')],null))[_0x6e70('0x2a')](respondWithResult(_0x11ac3d,null))[_0x6e70('0x4b')](handleError(_0x11ac3d,null));};exports['destroy']=function(_0x4ae901,_0x2c5538){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4ae901[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x2c5538,null))['then'](removeEntity(_0x2c5538,null))[_0x6e70('0x4b')](handleError(_0x2c5538,null));};exports[_0x6e70('0x4d')]=function(_0x1fa320,_0x23ebfb,_0x3aba34){var _0x4a111a={};var _0x1142cd={};var _0x1dd242;var _0x2c20d3;return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x1fa320[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ebfb,null))[_0x6e70('0x2a')](function(_0x8d425d){if(_0x8d425d){_0x1dd242=_0x8d425d;_0x1142cd['model']=_[_0x6e70('0x34')](db[_0x6e70('0x4f')]['rawAttributes']);_0x1142cd[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1fa320[_0x6e70('0x33')]);_0x1142cd[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x1142cd['model'],_0x1142cd[_0x6e70('0x33')]);_0x4a111a[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x1142cd[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x38')]));_0x4a111a[_0x6e70('0x37')]=_0x4a111a[_0x6e70('0x37')][_0x6e70('0x39')]?_0x4a111a[_0x6e70('0x37')]:_0x1142cd[_0x6e70('0x32')];_0x4a111a[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x4a111a[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_[_0x6e70('0x50')](_0x1fa320[_0x6e70('0x33')],_0x1142cd['filters']));if(_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3e')]){_0x4a111a[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0x4a111a[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x4a111a['attributes'],function(_0x42bd85){var _0x6cabf0={};_0x6cabf0[_0x42bd85]={'$like':'%'+_0x1fa320['query'][_0x6e70('0x3e')]+'%'};return _0x6cabf0;})});}_0x4a111a=_[_0x6e70('0x3f')]({},_0x4a111a,_0x1fa320[_0x6e70('0x41')]);return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2f9be4){if(_0x2f9be4){_0x2c20d3=_0x2f9be4[_0x6e70('0x39')];if(!_0x1fa320[_0x6e70('0x33')][_0x6e70('0x51')](_0x6e70('0x3a'))){_0x4a111a[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x1fa320['query']['limit']);_0x4a111a[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x20')]);}return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2e972b){if(_0x2e972b){return _0x2e972b?{'count':_0x2c20d3,'rows':_0x2e972b}:null;}})[_0x6e70('0x2a')](respondWithResult(_0x23ebfb,null))['catch'](handleError(_0x23ebfb,null));};exports['addConfiguration']=function(_0x355708,_0x47fbed,_0x2a8fb7){if(_0x355708[_0x6e70('0x4a')]['id']){delete _0x355708[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x355708[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x47fbed,null))[_0x6e70('0x2a')](function(_0x570115){if(_0x570115){_0x355708[_0x6e70('0x4a')][_0x6e70('0x52')]=_0x570115['id'];_0x355708[_0x6e70('0x4a')][_0x6e70('0x53')]=integrations[_0x6e70('0x54')](_0x355708['body']['channel'],_0x355708['body'][_0x6e70('0x31')]);_0x355708[_0x6e70('0x4a')][_0x6e70('0x55')]=integrations['getDescriptions'](_0x355708['body'][_0x6e70('0x56')],_0x355708[_0x6e70('0x4a')][_0x6e70('0x31')]);return db[_0x6e70('0x4f')][_0x6e70('0x49')](_0x355708[_0x6e70('0x4a')],{'include':[{'model':db['ZendeskField'],'as':_0x6e70('0x53')},{'model':db[_0x6e70('0x57')],'as':_0x6e70('0x55')}]});}return null;})[_0x6e70('0x2a')](respondWithResult(_0x47fbed,null))['catch'](handleError(_0x47fbed,null));};exports[_0x6e70('0x58')]=function(_0x531097,_0x5b4046,_0x30487b){var _0x3249a5='';return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x531097[_0x6e70('0x4c')]['id']},'attributes':['id',_0x6e70('0x59'),'password',_0x6e70('0x5a'),_0x6e70('0x5b'),_0x6e70('0x5c')]})[_0x6e70('0x2a')](handleEntityNotFound(_0x5b4046,null))[_0x6e70('0x2a')](function(_0x13c092){if(_0x13c092){_0x3249a5=_0x13c092[_0x6e70('0x5c')];var _0xd9b4a9=_0x3249a5[_0x6e70('0x5d')](-0x1);if(_0xd9b4a9==='/'){_0x3249a5=_0x3249a5[_0x6e70('0x5e')](0x0,_0x3249a5['lastIndexOf'](_0xd9b4a9));}var _0x44c877={'method':_0x6e70('0x5f'),'uri':util[_0x6e70('0x60')]('%s/%s',_0x3249a5,'ticket_fields'),'json':!![]};switch(_0x13c092[_0x6e70('0x5b')]){case _0x6e70('0x61'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util['format']('%s:%s',_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x61')]))['toString'](_0x6e70('0x64')))};break;case _0x6e70('0x5a'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util[_0x6e70('0x60')](_0x6e70('0x65'),_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x5a')]))[_0x6e70('0x66')](_0x6e70('0x64')))};break;default:throw new db[(_0x6e70('0x67'))][(_0x6e70('0x68'))](_0x6e70('0x69'));}return rp(_0x44c877);}})['then'](function(_0x5b3cb0){if(_0x5b3cb0){var _0x39ed95=['subject',_0x6e70('0x6a'),'group','assignee'];_[_0x6e70('0x6b')](_0x5b3cb0['ticket_fields'],function(_0x576069){return _0x39ed95[_0x6e70('0x6c')](_0x576069[_0x6e70('0x31')]);});return{'count':_0x5b3cb0[_0x6e70('0x6d')]['length'],'rows':_['map'](_0x5b3cb0['ticket_fields'],function(_0x3e7be7){return{'id':_0x3e7be7['id'],'name':_0x3e7be7['position']>0x7?_0x3e7be7[_0x6e70('0x6e')]:_0x3e7be7[_0x6e70('0x31')],'custom':_0x3e7be7[_0x6e70('0x6f')]>0x7?!![]:![],'options':_0x3e7be7[_0x6e70('0x70')]?_0x3e7be7[_0x6e70('0x70')]:_0x3e7be7[_0x6e70('0x71')]?_0x3e7be7[_0x6e70('0x71')]:[]};})};}})['then'](respondWithResult(_0x5b4046,null))[_0x6e70('0x4b')](function(_0x2493b0){var _0xb649a6=_0x531097['query'][_0x6e70('0x72')]?0x1f4:_0x2493b0[_0x6e70('0x73')]||0x1f4;logger[_0x6e70('0x74')](_0x6e70('0x75'),_0x6e70('0x58'),_0xb649a6,JSON[_0x6e70('0x76')](_0x2493b0));delete _0x2493b0[_0x6e70('0x2c')];if(_0xb649a6===0x191){_0xb649a6=0x190;}_0x5b4046[_0x6e70('0x23')](_0xb649a6)[_0x6e70('0x2d')](_0x531097['query'][_0x6e70('0x72')]?{'message':_0x6e70('0x77'),'statusCode':_0x2493b0['statusCode']}:_0x2493b0);});}; \ No newline at end of file +var _0x3f8c=['%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','substring','lastIndexOf','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f8c,0x104));var _0xc3f8=function(_0x5e84e3,_0xdf7810){_0x5e84e3=_0x5e84e3-0x0;var _0x3e82a0=_0x3f8c[_0x5e84e3];return _0x3e82a0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];var integrations=require(_0xc3f8('0x16'));function respondWithStatusCode(_0x155c80,_0x511763){_0x511763=_0x511763||0xcc;return function(_0x84f489){if(_0x84f489){return _0x155c80[_0xc3f8('0x17')](_0x511763);}return _0x155c80[_0xc3f8('0x18')](_0x511763)[_0xc3f8('0x19')]();};}function respondWithResult(_0x6155e9,_0x47754c){_0x47754c=_0x47754c||0xc8;return function(_0x29e2b6){if(_0x29e2b6){return _0x6155e9[_0xc3f8('0x18')](_0x47754c)[_0xc3f8('0x1a')](_0x29e2b6);}};}function respondWithFilteredResult(_0x2fd8e8,_0x3cb28a){return function(_0x2a9f64){if(_0x2a9f64){var _0x29d031=typeof _0x3cb28a['offset']===_0xc3f8('0x1b')&&typeof _0x3cb28a['limit']==='undefined';var _0x3df137=_0x2a9f64[_0xc3f8('0x1c')];var _0x35500f=_0x29d031?0x0:_0x3cb28a[_0xc3f8('0x1d')];var _0x47a185=_0x29d031?_0x2a9f64[_0xc3f8('0x1c')]:_0x3cb28a[_0xc3f8('0x1d')]+_0x3cb28a['limit'];var _0xe14074;if(_0x47a185>=_0x3df137){_0x47a185=_0x3df137;_0xe14074=0xc8;}else{_0xe14074=0xce;}_0x2fd8e8['status'](_0xe14074);return _0x2fd8e8[_0xc3f8('0x1e')](_0xc3f8('0x1f'),_0x35500f+'-'+_0x47a185+'/'+_0x3df137)[_0xc3f8('0x1a')](_0x2a9f64);}return null;};}function patchUpdates(_0x53ada5){return function(_0x543dca){try{jsonpatch[_0xc3f8('0x20')](_0x543dca,_0x53ada5,!![]);}catch(_0x2a7096){return BPromise[_0xc3f8('0x21')](_0x2a7096);}return _0x543dca[_0xc3f8('0x22')]();};}function saveUpdates(_0x6522e9,_0x251bf7){return function(_0x43b2b4){if(_0x43b2b4){return _0x43b2b4[_0xc3f8('0x23')](_0x6522e9)['then'](function(_0x571f92){return _0x571f92;});}return null;};}function removeEntity(_0x4b83f0,_0x2559a4){return function(_0x5e1d14){if(_0x5e1d14){return _0x5e1d14[_0xc3f8('0x24')]()[_0xc3f8('0x25')](function(){_0x4b83f0['status'](0xcc)[_0xc3f8('0x19')]();});}};}function handleEntityNotFound(_0x327b2d,_0x2d237e){return function(_0xb883b5){if(!_0xb883b5){_0x327b2d[_0xc3f8('0x17')](0x194);}return _0xb883b5;};}function handleError(_0x9d43b4,_0xf1d460){_0xf1d460=_0xf1d460||0x1f4;return function(_0x7f14ad){logger[_0xc3f8('0x26')](_0x7f14ad[_0xc3f8('0x27')]);if(_0x7f14ad[_0xc3f8('0x28')]){delete _0x7f14ad[_0xc3f8('0x28')];}_0x9d43b4[_0xc3f8('0x18')](_0xf1d460)[_0xc3f8('0x29')](_0x7f14ad);};}exports['index']=function(_0x58b303,_0x2909f8){var _0x218029={},_0x5bf6e2={},_0x151bba={'count':0x0,'rows':[]};var _0x4d39a0=_[_0xc3f8('0x2a')](db[_0xc3f8('0x2b')]['rawAttributes'],function(_0x48b32e){return{'name':_0x48b32e[_0xc3f8('0x2c')],'type':_0x48b32e[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x5bf6e2[_0xc3f8('0x2f')]=_[_0xc3f8('0x2a')](_0x4d39a0,_0xc3f8('0x28'));_0x5bf6e2[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x58b303[_0xc3f8('0x30')]);_0x5bf6e2[_0xc3f8('0x32')]=_['intersection'](_0x5bf6e2[_0xc3f8('0x2f')],_0x5bf6e2[_0xc3f8('0x30')]);_0x218029[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x5bf6e2[_0xc3f8('0x2f')],qs['fields'](_0x58b303['query'][_0xc3f8('0x35')]));_0x218029[_0xc3f8('0x33')]=_0x218029[_0xc3f8('0x33')][_0xc3f8('0x36')]?_0x218029[_0xc3f8('0x33')]:_0x5bf6e2['model'];if(!_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x218029['limit']=qs[_0xc3f8('0x39')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x218029['offset']=qs[_0xc3f8('0x1d')](_0x58b303[_0xc3f8('0x30')]['offset']);}_0x218029[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3b')]);_0x218029[_0xc3f8('0x3c')]=qs[_0xc3f8('0x32')](_['pick'](_0x58b303[_0xc3f8('0x30')],_0x5bf6e2[_0xc3f8('0x32')]),_0x4d39a0);if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3d')]){_0x218029[_0xc3f8('0x3c')]=_['merge'](_0x218029[_0xc3f8('0x3c')],{'$or':_[_0xc3f8('0x2a')](_0x4d39a0,function(_0xaa4c98){if(_0xaa4c98['type']!==_0xc3f8('0x3e')){var _0x83b7ab={};_0x83b7ab[_0xaa4c98[_0xc3f8('0x28')]]={'$like':'%'+_0x58b303[_0xc3f8('0x30')]['filter']+'%'};return _0x83b7ab;}})});}_0x218029=_[_0xc3f8('0x3f')]({},_0x218029,_0x58b303[_0xc3f8('0x40')]);var _0x2df096={'where':_0x218029[_0xc3f8('0x3c')]};return db['ZendeskAccount'][_0xc3f8('0x1c')](_0x2df096)['then'](function(_0x5d144b){_0x151bba[_0xc3f8('0x1c')]=_0x5d144b;if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x218029[_0xc3f8('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x218029);})[_0xc3f8('0x25')](function(_0x16805c){_0x151bba[_0xc3f8('0x43')]=_0x16805c;return _0x151bba;})[_0xc3f8('0x25')](respondWithFilteredResult(_0x2909f8,_0x218029))[_0xc3f8('0x44')](handleError(_0x2909f8,null));};exports[_0xc3f8('0x45')]=function(_0x3113b4,_0x45e6ea){var _0x13d8dc={'raw':![],'where':{'id':_0x3113b4[_0xc3f8('0x46')]['id']}},_0x34bccd={};_0x34bccd['model']=_[_0xc3f8('0x31')](db[_0xc3f8('0x2b')]['rawAttributes']);_0x34bccd[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x3113b4['query']);_0x34bccd[_0xc3f8('0x32')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],_0x34bccd[_0xc3f8('0x30')]);_0x13d8dc[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x13d8dc[_0xc3f8('0x33')]=_0x13d8dc['attributes'][_0xc3f8('0x36')]?_0x13d8dc[_0xc3f8('0x33')]:_0x34bccd['model'];if(_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x13d8dc[_0xc3f8('0x42')]=[{'all':!![]}];}_0x13d8dc=_[_0xc3f8('0x3f')]({},_0x13d8dc,_0x3113b4['options']);return db['ZendeskAccount'][_0xc3f8('0x47')](_0x13d8dc)[_0xc3f8('0x25')](handleEntityNotFound(_0x45e6ea,null))[_0xc3f8('0x25')](respondWithResult(_0x45e6ea,null))['catch'](handleError(_0x45e6ea,null));};exports[_0xc3f8('0x48')]=function(_0x3a665e,_0x418961){return db[_0xc3f8('0x2b')][_0xc3f8('0x48')](_0x3a665e['body'],{})[_0xc3f8('0x25')](respondWithResult(_0x418961,0xc9))[_0xc3f8('0x44')](handleError(_0x418961,null));};exports['update']=function(_0x1becae,_0x3fcb6a){if(_0x1becae[_0xc3f8('0x49')]['id']){delete _0x1becae[_0xc3f8('0x49')]['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x1becae[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fcb6a,null))[_0xc3f8('0x25')](saveUpdates(_0x1becae[_0xc3f8('0x49')],null))['then'](respondWithResult(_0x3fcb6a,null))[_0xc3f8('0x44')](handleError(_0x3fcb6a,null));};exports[_0xc3f8('0x24')]=function(_0x2448bf,_0x33e5c5){return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x2448bf[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x33e5c5,null))[_0xc3f8('0x25')](removeEntity(_0x33e5c5,null))[_0xc3f8('0x44')](handleError(_0x33e5c5,null));};exports[_0xc3f8('0x4a')]=function(_0x267c95,_0x3e6c1d,_0x3d752a){var _0x97a88e={};var _0x920f4b={};var _0x4fc02c;var _0x51249a;return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x267c95['params']['id']}})['then'](handleEntityNotFound(_0x3e6c1d,null))[_0xc3f8('0x25')](function(_0x4b4adb){if(_0x4b4adb){_0x4fc02c=_0x4b4adb;_0x920f4b[_0xc3f8('0x2f')]=_[_0xc3f8('0x31')](db[_0xc3f8('0x4c')]['rawAttributes']);_0x920f4b[_0xc3f8('0x30')]=_['keys'](_0x267c95['query']);_0x920f4b[_0xc3f8('0x32')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],_0x920f4b[_0xc3f8('0x30')]);_0x97a88e[_0xc3f8('0x33')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x97a88e[_0xc3f8('0x33')]=_0x97a88e['attributes']['length']?_0x97a88e[_0xc3f8('0x33')]:_0x920f4b[_0xc3f8('0x2f')];_0x97a88e[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x267c95[_0xc3f8('0x30')]['sort']);_0x97a88e[_0xc3f8('0x3c')]=qs['filters'](_[_0xc3f8('0x4d')](_0x267c95[_0xc3f8('0x30')],_0x920f4b[_0xc3f8('0x32')]));if(_0x267c95[_0xc3f8('0x30')]['filter']){_0x97a88e[_0xc3f8('0x3c')]=_['merge'](_0x97a88e['where'],{'$or':_['map'](_0x97a88e['attributes'],function(_0x12df02){var _0x143d50={};_0x143d50[_0x12df02]={'$like':'%'+_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x3d')]+'%'};return _0x143d50;})});}_0x97a88e=_[_0xc3f8('0x3f')]({},_0x97a88e,_0x267c95[_0xc3f8('0x40')]);return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x5250df){if(_0x5250df){_0x51249a=_0x5250df[_0xc3f8('0x36')];if(!_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x97a88e[_0xc3f8('0x39')]=qs['limit'](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x97a88e[_0xc3f8('0x1d')]=qs[_0xc3f8('0x1d')](_0x267c95[_0xc3f8('0x30')]['offset']);}return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x42b255){if(_0x42b255){return _0x42b255?{'count':_0x51249a,'rows':_0x42b255}:null;}})[_0xc3f8('0x25')](respondWithResult(_0x3e6c1d,null))[_0xc3f8('0x44')](handleError(_0x3e6c1d,null));};exports[_0xc3f8('0x4e')]=function(_0x56fd61,_0x2f199d,_0x4ca426){if(_0x56fd61[_0xc3f8('0x49')]['id']){delete _0x56fd61['body']['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x56fd61['params']['id']}})['then'](handleEntityNotFound(_0x2f199d,null))[_0xc3f8('0x25')](function(_0x2c7ab9){if(_0x2c7ab9){_0x56fd61['body'][_0xc3f8('0x4f')]=_0x2c7ab9['id'];_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x50')]=integrations[_0xc3f8('0x51')](_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x52')],_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x2d')]);_0x56fd61['body']['Descriptions']=integrations[_0xc3f8('0x53')](_0x56fd61['body']['channel'],_0x56fd61['body']['type']);return db['ZendeskConfiguration'][_0xc3f8('0x48')](_0x56fd61[_0xc3f8('0x49')],{'include':[{'model':db[_0xc3f8('0x54')],'as':_0xc3f8('0x50')},{'model':db['ZendeskField'],'as':_0xc3f8('0x55')}]});}return null;})[_0xc3f8('0x25')](respondWithResult(_0x2f199d,null))['catch'](handleError(_0x2f199d,null));};exports[_0xc3f8('0x56')]=function(_0x273faf,_0x104eec,_0x531de8){var _0xaedf89='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x273faf['params']['id']},'attributes':['id',_0xc3f8('0x57'),_0xc3f8('0x58'),'token',_0xc3f8('0x59'),_0xc3f8('0x5a')]})['then'](handleEntityNotFound(_0x104eec,null))[_0xc3f8('0x25')](function(_0x2f957a){if(_0x2f957a){_0xaedf89=_0x2f957a['remoteUri'];var _0x34edb9=_0xaedf89['slice'](-0x1);if(_0x34edb9==='/'){_0xaedf89=_0xaedf89[_0xc3f8('0x5b')](0x0,_0xaedf89[_0xc3f8('0x5c')](_0x34edb9));}var _0x4cc654={'method':'GET','uri':util[_0xc3f8('0x5d')](_0xc3f8('0x5e'),_0xaedf89,'ticket_fields'),'json':!![]};switch(_0x2f957a[_0xc3f8('0x59')]){case'password':_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x61'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x58')]))[_0xc3f8('0x62')](_0xc3f8('0x63')))};break;case _0xc3f8('0x64'):_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x65'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x64')]))['toString'](_0xc3f8('0x63')))};break;default:throw new db[(_0xc3f8('0x66'))][(_0xc3f8('0x67'))](_0xc3f8('0x68'));}return rp(_0x4cc654);}})[_0xc3f8('0x25')](function(_0x53c815){if(_0x53c815){var _0x2f69f7=[_0xc3f8('0x69'),_0xc3f8('0x6a'),'group','assignee'];_[_0xc3f8('0x6b')](_0x53c815[_0xc3f8('0x6c')],function(_0x1a9c33){return _0x2f69f7[_0xc3f8('0x6d')](_0x1a9c33['type']);});return{'count':_0x53c815[_0xc3f8('0x6c')][_0xc3f8('0x36')],'rows':_[_0xc3f8('0x2a')](_0x53c815['ticket_fields'],function(_0x2a29fa){return{'id':_0x2a29fa['id'],'name':_0x2a29fa[_0xc3f8('0x6e')]>0x7?_0x2a29fa['title']:_0x2a29fa['type'],'custom':_0x2a29fa[_0xc3f8('0x6e')]>0x7?!![]:![],'options':_0x2a29fa[_0xc3f8('0x6f')]?_0x2a29fa['system_field_options']:_0x2a29fa[_0xc3f8('0x70')]?_0x2a29fa[_0xc3f8('0x70')]:[]};})};}})['then'](respondWithResult(_0x104eec,null))[_0xc3f8('0x44')](function(_0x5f2d86){var _0x3d080a=_0x273faf['query'][_0xc3f8('0x71')]?0x1f4:_0x5f2d86[_0xc3f8('0x72')]||0x1f4;logger[_0xc3f8('0x26')](_0xc3f8('0x73'),_0xc3f8('0x56'),_0x3d080a,JSON[_0xc3f8('0x74')](_0x5f2d86));delete _0x5f2d86[_0xc3f8('0x28')];if(_0x3d080a===0x191){_0x3d080a=0x190;}_0x104eec[_0xc3f8('0x18')](_0x3d080a)[_0xc3f8('0x29')](_0x273faf['query']['test']?{'message':_0xc3f8('0x75'),'statusCode':_0x5f2d86['statusCode']}:_0x5f2d86);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a2fbdf1..d55b907 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 _0x3138=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x337124,_0x5c6e00){var _0x5d5801=function(_0x43244d){while(--_0x43244d){_0x337124['push'](_0x337124['shift']());}};_0x5d5801(++_0x5c6e00);}(_0x3138,0x1c3));var _0x8313=function(_0x1bedf9,_0x404c91){_0x1bedf9=_0x1bedf9-0x0;var _0x1bdd71=_0x3138[_0x1bedf9];return _0x1bdd71;};'use strict';var _=require(_0x8313('0x0'));var util=require(_0x8313('0x1'));var logger=require('../../config/logger')(_0x8313('0x2'));var moment=require('moment');var BPromise=require(_0x8313('0x3'));var rp=require(_0x8313('0x4'));var fs=require('fs');var path=require(_0x8313('0x5'));var rimraf=require(_0x8313('0x6'));var config=require(_0x8313('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5b7643,_0x19804f){return _0x5b7643[_0x8313('0x8')](_0x8313('0x9'),attributes,{'tableName':_0x8313('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f99=['../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskAccount.attributes'];(function(_0xd3d77,_0x1d627c){var _0x4f13b0=function(_0x549c82){while(--_0x549c82){_0xd3d77['push'](_0xd3d77['shift']());}};_0x4f13b0(++_0x1d627c);}(_0x2f99,0x184));var _0x92f9=function(_0x21a2b2,_0x22ba1e){_0x21a2b2=_0x21a2b2-0x0;var _0x2060b4=_0x2f99[_0x21a2b2];return _0x2060b4;};'use strict';var _=require(_0x92f9('0x0'));var util=require(_0x92f9('0x1'));var logger=require(_0x92f9('0x2'))(_0x92f9('0x3'));var moment=require(_0x92f9('0x4'));var BPromise=require('bluebird');var rp=require(_0x92f9('0x5'));var fs=require('fs');var path=require(_0x92f9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x92f9('0x7'));var integrations=require(_0x92f9('0x8'));module[_0x92f9('0x9')]=function(_0x4d4bf6,_0x5b9ded){return _0x4d4bf6[_0x92f9('0xa')](_0x92f9('0xb'),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 de28887..23a6dd5 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 _0xc094=['util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','debug','ShowZendeskAccount','find','lodash'];(function(_0x5b378d,_0x4948f1){var _0x249efe=function(_0x24979b){while(--_0x24979b){_0x5b378d['push'](_0x5b378d['shift']());}};_0x249efe(++_0x4948f1);}(_0xc094,0x197));var _0x4c09=function(_0x40e6b8,_0x2d33f9){_0x40e6b8=_0x40e6b8-0x0;var _0x575e92=_0xc094[_0x40e6b8];return _0x575e92;};'use strict';var _=require(_0x4c09('0x0'));var util=require(_0x4c09('0x1'));var moment=require(_0x4c09('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c09('0x3'));var fs=require('fs');var Redis=require(_0x4c09('0x4'));var db=require(_0x4c09('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4c09('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c09('0x7'));var client=jayson[_0x4c09('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x168d51,_0x1a48dd,_0x2b793e){return new BPromise(function(_0x1323a0,_0x2cc00c){return client[_0x4c09('0x9')](_0x168d51,_0x2b793e)[_0x4c09('0xa')](function(_0xf86c43){logger[_0x4c09('0xb')](_0x4c09('0xc'),_0x1a48dd,'request\x20sent');logger['debug'](_0x4c09('0xd'),_0x1a48dd,_0x4c09('0xe'),JSON[_0x4c09('0xf')](_0xf86c43));if(_0xf86c43[_0x4c09('0x10')]){if(_0xf86c43[_0x4c09('0x10')][_0x4c09('0x11')]===0x1f4){logger[_0x4c09('0x10')](_0x4c09('0xc'),_0x1a48dd,_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);return _0x2cc00c(_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);}logger[_0x4c09('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x1a48dd,_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);return _0x1323a0(_0xf86c43[_0x4c09('0x10')][_0x4c09('0x12')]);}else{logger[_0x4c09('0xb')](_0x4c09('0xc'),_0x1a48dd,'request\x20sent');_0x1323a0(_0xf86c43['result'][_0x4c09('0x12')]);}})[_0x4c09('0x13')](function(_0x38e647){logger[_0x4c09('0x10')](_0x4c09('0xc'),_0x1a48dd,_0x38e647);_0x2cc00c(_0x38e647);});});}exports['GetZendeskAccount']=function(_0x51103e){var _0x5d23e2=this;return new Promise(function(_0x4f1988,_0x935c52){return db[_0x4c09('0x14')][_0x4c09('0x15')]({'raw':_0x51103e[_0x4c09('0x16')]?_0x51103e['options'][_0x4c09('0x17')]===undefined?!![]:![]:!![],'where':_0x51103e[_0x4c09('0x16')]?_0x51103e['options'][_0x4c09('0x18')]||null:null,'attributes':_0x51103e['options']?_0x51103e[_0x4c09('0x16')][_0x4c09('0x19')]||null:null,'limit':_0x51103e[_0x4c09('0x16')]?_0x51103e['options'][_0x4c09('0x1a')]||null:null,'include':_0x51103e[_0x4c09('0x16')]?_0x51103e[_0x4c09('0x16')][_0x4c09('0x1b')]?_['map'](_0x51103e[_0x4c09('0x16')]['include'],function(_0x198dac){return{'model':db[_0x198dac['model']],'as':_0x198dac['as'],'attributes':_0x198dac[_0x4c09('0x19')],'include':_0x198dac['include']?_[_0x4c09('0x1c')](_0x198dac['include'],function(_0x54cb3a){return{'model':db[_0x54cb3a[_0x4c09('0x1d')]],'as':_0x54cb3a['as'],'attributes':_0x54cb3a[_0x4c09('0x19')],'include':_0x54cb3a['include']?_[_0x4c09('0x1c')](_0x54cb3a['include'],function(_0x501baf){return{'model':db[_0x501baf[_0x4c09('0x1d')]],'as':_0x501baf['as'],'attributes':_0x501baf[_0x4c09('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4c09('0xa')](function(_0x34f522){logger['info'](_0x4c09('0x1e'),_0x51103e);logger[_0x4c09('0x1f')](_0x4c09('0x1e'),_0x51103e,JSON[_0x4c09('0xf')](_0x34f522));_0x4f1988(_0x34f522);})['catch'](function(_0x4de2e6){logger[_0x4c09('0x10')](_0x4c09('0x1e'),_0x4de2e6['message'],_0x51103e);_0x935c52(_0x5d23e2[_0x4c09('0x10')](0x1f4,_0x4de2e6[_0x4c09('0x12')]));});});};exports[_0x4c09('0x20')]=function(_0x5d37b4){var _0x57c8b0=this;return new Promise(function(_0xffbd51,_0x3b4398){return db[_0x4c09('0x14')][_0x4c09('0x21')]({'raw':_0x5d37b4[_0x4c09('0x16')]?_0x5d37b4[_0x4c09('0x16')][_0x4c09('0x17')]===undefined?!![]:![]:!![],'where':_0x5d37b4['options']?_0x5d37b4[_0x4c09('0x16')]['where']||null:null,'attributes':_0x5d37b4[_0x4c09('0x16')]?_0x5d37b4[_0x4c09('0x16')][_0x4c09('0x19')]||null:null,'include':_0x5d37b4[_0x4c09('0x16')]?_0x5d37b4[_0x4c09('0x16')]['include']?_[_0x4c09('0x1c')](_0x5d37b4['options']['include'],function(_0x14c541){return{'model':db[_0x14c541[_0x4c09('0x1d')]],'as':_0x14c541['as'],'attributes':_0x14c541['attributes'],'include':_0x14c541[_0x4c09('0x1b')]?_[_0x4c09('0x1c')](_0x14c541['include'],function(_0x12b047){return{'model':db[_0x12b047[_0x4c09('0x1d')]],'as':_0x12b047['as'],'attributes':_0x12b047[_0x4c09('0x19')],'include':_0x12b047['include']?_[_0x4c09('0x1c')](_0x12b047['include'],function(_0x1f44d6){return{'model':db[_0x1f44d6[_0x4c09('0x1d')]],'as':_0x1f44d6['as'],'attributes':_0x1f44d6[_0x4c09('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x387902){logger[_0x4c09('0xb')]('ShowZendeskAccount',_0x5d37b4);logger[_0x4c09('0x1f')]('ShowZendeskAccount',_0x5d37b4,JSON[_0x4c09('0xf')](_0x387902));_0xffbd51(_0x387902);})[_0x4c09('0x13')](function(_0x3658db){logger[_0x4c09('0x10')](_0x4c09('0x20'),_0x3658db[_0x4c09('0x12')],_0x5d37b4);_0x3b4398(_0x57c8b0[_0x4c09('0x10')](0x1f4,_0x3658db[_0x4c09('0x12')]));});});}; \ No newline at end of file +var _0xb6d7=['rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetZendeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','ZendeskAccount','raw','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d8117,_0x42a6d2){var _0x400458=function(_0xe5aada){while(--_0xe5aada){_0x1d8117['push'](_0x1d8117['shift']());}};_0x400458(++_0x42a6d2);}(_0xb6d7,0x101));var _0x7b6d=function(_0x5c65cf,_0x236f92){_0x5c65cf=_0x5c65cf-0x0;var _0x37f30c=_0xb6d7[_0x5c65cf];return _0x37f30c;};'use strict';var _=require(_0x7b6d('0x0'));var util=require(_0x7b6d('0x1'));var moment=require(_0x7b6d('0x2'));var BPromise=require(_0x7b6d('0x3'));var rs=require(_0x7b6d('0x4'));var fs=require('fs');var Redis=require(_0x7b6d('0x5'));var db=require(_0x7b6d('0x6'))['db'];var utils=require(_0x7b6d('0x7'));var logger=require(_0x7b6d('0x8'))(_0x7b6d('0x9'));var config=require(_0x7b6d('0xa'));var jayson=require(_0x7b6d('0xb'));var client=jayson[_0x7b6d('0xc')][_0x7b6d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xa80fec,_0x1646e8,_0x544929){return new BPromise(function(_0x1810d5,_0x145336){return client[_0x7b6d('0xe')](_0xa80fec,_0x544929)[_0x7b6d('0xf')](function(_0x2b48be){logger['info'](_0x7b6d('0x10'),_0x1646e8,_0x7b6d('0x11'));logger['debug'](_0x7b6d('0x12'),_0x1646e8,_0x7b6d('0x11'),JSON[_0x7b6d('0x13')](_0x2b48be));if(_0x2b48be[_0x7b6d('0x14')]){if(_0x2b48be[_0x7b6d('0x14')][_0x7b6d('0x15')]===0x1f4){logger[_0x7b6d('0x14')](_0x7b6d('0x10'),_0x1646e8,_0x2b48be['error'][_0x7b6d('0x16')]);return _0x145336(_0x2b48be[_0x7b6d('0x14')][_0x7b6d('0x16')]);}logger[_0x7b6d('0x14')](_0x7b6d('0x10'),_0x1646e8,_0x2b48be[_0x7b6d('0x14')][_0x7b6d('0x16')]);return _0x1810d5(_0x2b48be[_0x7b6d('0x14')][_0x7b6d('0x16')]);}else{logger[_0x7b6d('0x17')](_0x7b6d('0x10'),_0x1646e8,_0x7b6d('0x11'));_0x1810d5(_0x2b48be['result']['message']);}})['catch'](function(_0x305496){logger[_0x7b6d('0x14')](_0x7b6d('0x10'),_0x1646e8,_0x305496);_0x145336(_0x305496);});});}exports[_0x7b6d('0x18')]=function(_0x110fe9){var _0x139701=this;return new Promise(function(_0x26a36e,_0x23528c){return db['ZendeskAccount'][_0x7b6d('0x19')]({'raw':_0x110fe9[_0x7b6d('0x1a')]?_0x110fe9[_0x7b6d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x110fe9[_0x7b6d('0x1a')]?_0x110fe9['options'][_0x7b6d('0x1b')]||null:null,'attributes':_0x110fe9['options']?_0x110fe9['options'][_0x7b6d('0x1c')]||null:null,'limit':_0x110fe9[_0x7b6d('0x1a')]?_0x110fe9[_0x7b6d('0x1a')][_0x7b6d('0x1d')]||null:null,'include':_0x110fe9[_0x7b6d('0x1a')]?_0x110fe9[_0x7b6d('0x1a')][_0x7b6d('0x1e')]?_[_0x7b6d('0x1f')](_0x110fe9[_0x7b6d('0x1a')][_0x7b6d('0x1e')],function(_0x4b363e){return{'model':db[_0x4b363e[_0x7b6d('0x20')]],'as':_0x4b363e['as'],'attributes':_0x4b363e[_0x7b6d('0x1c')],'include':_0x4b363e[_0x7b6d('0x1e')]?_[_0x7b6d('0x1f')](_0x4b363e[_0x7b6d('0x1e')],function(_0x2af4ea){return{'model':db[_0x2af4ea[_0x7b6d('0x20')]],'as':_0x2af4ea['as'],'attributes':_0x2af4ea[_0x7b6d('0x1c')],'include':_0x2af4ea['include']?_[_0x7b6d('0x1f')](_0x2af4ea['include'],function(_0x1fade0){return{'model':db[_0x1fade0[_0x7b6d('0x20')]],'as':_0x1fade0['as'],'attributes':_0x1fade0[_0x7b6d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7b6d('0xf')](function(_0x22e642){logger[_0x7b6d('0x17')](_0x7b6d('0x18'),_0x110fe9);logger[_0x7b6d('0x21')]('GetZendeskAccount',_0x110fe9,JSON['stringify'](_0x22e642));_0x26a36e(_0x22e642);})[_0x7b6d('0x22')](function(_0x452699){logger[_0x7b6d('0x14')](_0x7b6d('0x18'),_0x452699[_0x7b6d('0x16')],_0x110fe9);_0x23528c(_0x139701[_0x7b6d('0x14')](0x1f4,_0x452699[_0x7b6d('0x16')]));});});};exports['ShowZendeskAccount']=function(_0x3126e6){var _0x37327a=this;return new Promise(function(_0xd428bb,_0x5801af){return db[_0x7b6d('0x23')]['find']({'raw':_0x3126e6[_0x7b6d('0x1a')]?_0x3126e6['options'][_0x7b6d('0x24')]===undefined?!![]:![]:!![],'where':_0x3126e6[_0x7b6d('0x1a')]?_0x3126e6[_0x7b6d('0x1a')]['where']||null:null,'attributes':_0x3126e6[_0x7b6d('0x1a')]?_0x3126e6['options'][_0x7b6d('0x1c')]||null:null,'include':_0x3126e6[_0x7b6d('0x1a')]?_0x3126e6[_0x7b6d('0x1a')][_0x7b6d('0x1e')]?_[_0x7b6d('0x1f')](_0x3126e6['options']['include'],function(_0x138286){return{'model':db[_0x138286[_0x7b6d('0x20')]],'as':_0x138286['as'],'attributes':_0x138286[_0x7b6d('0x1c')],'include':_0x138286[_0x7b6d('0x1e')]?_[_0x7b6d('0x1f')](_0x138286['include'],function(_0x35aec4){return{'model':db[_0x35aec4[_0x7b6d('0x20')]],'as':_0x35aec4['as'],'attributes':_0x35aec4[_0x7b6d('0x1c')],'include':_0x35aec4['include']?_[_0x7b6d('0x1f')](_0x35aec4[_0x7b6d('0x1e')],function(_0x15a794){return{'model':db[_0x15a794[_0x7b6d('0x20')]],'as':_0x15a794['as'],'attributes':_0x15a794['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b6d('0xf')](function(_0x1951bd){logger[_0x7b6d('0x17')](_0x7b6d('0x25'),_0x3126e6);logger[_0x7b6d('0x21')](_0x7b6d('0x25'),_0x3126e6,JSON[_0x7b6d('0x13')](_0x1951bd));_0xd428bb(_0x1951bd);})[_0x7b6d('0x22')](function(_0x45ff96){logger['error'](_0x7b6d('0x25'),_0x45ff96['message'],_0x3126e6);_0x5801af(_0x37327a['error'](0x1f4,_0x45ff96[_0x7b6d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index bc84d62..a1e43bc 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x2315d9,_0x590dd7){var _0x5c818f=function(_0x17a5aa){while(--_0x17a5aa){_0x2315d9['push'](_0x2315d9['shift']());}};_0x5c818f(++_0x590dd7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0x4483,0x1a3));var _0x3448=function(_0x5733e8,_0x25a96a){_0x5733e8=_0x5733e8-0x0;var _0x3a820c=_0x4483[_0x5733e8];return _0x3a820c;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 16dec42..e33ca77 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 _0x2284=['STRING','sequelize','exports'];(function(_0x40d31d,_0x3f999a){var _0x51459c=function(_0xa98ecc){while(--_0xa98ecc){_0x40d31d['push'](_0x40d31d['shift']());}};_0x51459c(++_0x3f999a);}(_0x2284,0xe5));var _0x4228=function(_0x1e5e53,_0x33a50d){_0x1e5e53=_0x1e5e53-0x0;var _0x51945b=_0x2284[_0x1e5e53];return _0x51945b;};'use strict';var Sequelize=require(_0x4228('0x0'));module[_0x4228('0x1')]={'name':{'type':Sequelize[_0x4228('0x2')]},'description':{'type':Sequelize[_0x4228('0x2')]}}; \ No newline at end of file +var _0xd795=['exports','STRING','sequelize'];(function(_0x2ddaf8,_0x42c037){var _0x41aa53=function(_0x2528c4){while(--_0x2528c4){_0x2ddaf8['push'](_0x2ddaf8['shift']());}};_0x41aa53(++_0x42c037);}(_0xd795,0x10a));var _0x5d79=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd795[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x5d79('0x0'));module[_0x5d79('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d79('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4cea455..b2fa72a 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 _0x5f38=['reject','update','then','destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','Content-Range','apply'];(function(_0x34ca5a,_0x2f14b1){var _0x38c2be=function(_0x239f61){while(--_0x239f61){_0x34ca5a['push'](_0x34ca5a['shift']());}};_0x38c2be(++_0x2f14b1);}(_0x5f38,0x11c));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x85f3('0x0'));var rimraf=require(_0x85f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85f3('0x2'));var rp=require(_0x85f3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85f3('0x4'));var util=require(_0x85f3('0x5'));var path=require('path');var sox=require(_0x85f3('0x6'));var csv=require(_0x85f3('0x7'));var ejs=require(_0x85f3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85f3('0x9'));var crypto=require('crypto');var jsforce=require(_0x85f3('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x85f3('0xb'));var Papa=require(_0x85f3('0xc'));var Redis=require(_0x85f3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x85f3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85f3('0xf'));var logger=require(_0x85f3('0x10'))(_0x85f3('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x85f3('0x12'));var db=require(_0x85f3('0x13'))['db'];function respondWithStatusCode(_0x39bf74,_0x4e7e1d){_0x4e7e1d=_0x4e7e1d||0xcc;return function(_0x3704c2){if(_0x3704c2){return _0x39bf74['sendStatus'](_0x4e7e1d);}return _0x39bf74[_0x85f3('0x14')](_0x4e7e1d)['end']();};}function respondWithResult(_0x5ad460,_0x59ac48){_0x59ac48=_0x59ac48||0xc8;return function(_0x4d0658){if(_0x4d0658){return _0x5ad460[_0x85f3('0x14')](_0x59ac48)[_0x85f3('0x15')](_0x4d0658);}};}function respondWithFilteredResult(_0xf7b8c6,_0x4c89da){return function(_0x50604e){if(_0x50604e){var _0x1c84eb=typeof _0x4c89da['offset']==='undefined'&&typeof _0x4c89da[_0x85f3('0x16')]===_0x85f3('0x17');var _0x24fc69=_0x50604e[_0x85f3('0x18')];var _0x4fa8c3=_0x1c84eb?0x0:_0x4c89da[_0x85f3('0x19')];var _0x207730=_0x1c84eb?_0x50604e['count']:_0x4c89da['offset']+_0x4c89da['limit'];var _0x43325f;if(_0x207730>=_0x24fc69){_0x207730=_0x24fc69;_0x43325f=0xc8;}else{_0x43325f=0xce;}_0xf7b8c6[_0x85f3('0x14')](_0x43325f);return _0xf7b8c6['set'](_0x85f3('0x1a'),_0x4fa8c3+'-'+_0x207730+'/'+_0x24fc69)[_0x85f3('0x15')](_0x50604e);}return null;};}function patchUpdates(_0x35d9ef){return function(_0x3b10dd){try{jsonpatch[_0x85f3('0x1b')](_0x3b10dd,_0x35d9ef,!![]);}catch(_0x352dd1){return BPromise[_0x85f3('0x1c')](_0x352dd1);}return _0x3b10dd['save']();};}function saveUpdates(_0x2b55b9,_0x183201){return function(_0x2cd0b6){if(_0x2cd0b6){return _0x2cd0b6[_0x85f3('0x1d')](_0x2b55b9)[_0x85f3('0x1e')](function(_0x73f529){return _0x73f529;});}return null;};}function removeEntity(_0x3df3af,_0x4aef21){return function(_0x5401f1){if(_0x5401f1){return _0x5401f1[_0x85f3('0x1f')]()[_0x85f3('0x1e')](function(){_0x3df3af[_0x85f3('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x565af6,_0x2ceae1){return function(_0x3a53c0){if(!_0x3a53c0){_0x565af6['sendStatus'](0x194);}return _0x3a53c0;};}function handleError(_0x3e3e96,_0x4a23e2){_0x4a23e2=_0x4a23e2||0x1f4;return function(_0x2f275f){logger[_0x85f3('0x20')](_0x2f275f['stack']);if(_0x2f275f['name']){delete _0x2f275f[_0x85f3('0x21')];}_0x3e3e96['status'](_0x4a23e2)[_0x85f3('0x22')](_0x2f275f);};}exports[_0x85f3('0x23')]=function(_0x2d61b9,_0x32ecea){var _0x30f761={},_0x24e9e3={},_0xc183c={'count':0x0,'rows':[]};var _0x4387cd=_[_0x85f3('0x24')](db[_0x85f3('0x25')][_0x85f3('0x26')],function(_0x174a10){return{'name':_0x174a10[_0x85f3('0x27')],'type':_0x174a10[_0x85f3('0x28')]['key']};});_0x24e9e3['model']=_[_0x85f3('0x24')](_0x4387cd,_0x85f3('0x21'));_0x24e9e3[_0x85f3('0x29')]=_[_0x85f3('0x2a')](_0x2d61b9['query']);_0x24e9e3[_0x85f3('0x2b')]=_[_0x85f3('0x2c')](_0x24e9e3['model'],_0x24e9e3['query']);_0x30f761[_0x85f3('0x2d')]=_['intersection'](_0x24e9e3['model'],qs['fields'](_0x2d61b9[_0x85f3('0x29')][_0x85f3('0x2e')]));_0x30f761[_0x85f3('0x2d')]=_0x30f761[_0x85f3('0x2d')][_0x85f3('0x2f')]?_0x30f761[_0x85f3('0x2d')]:_0x24e9e3[_0x85f3('0x30')];if(!_0x2d61b9['query'][_0x85f3('0x31')](_0x85f3('0x32'))){_0x30f761[_0x85f3('0x16')]=qs[_0x85f3('0x16')](_0x2d61b9[_0x85f3('0x29')][_0x85f3('0x16')]);_0x30f761[_0x85f3('0x19')]=qs[_0x85f3('0x19')](_0x2d61b9[_0x85f3('0x29')][_0x85f3('0x19')]);}_0x30f761[_0x85f3('0x33')]=qs['sort'](_0x2d61b9[_0x85f3('0x29')][_0x85f3('0x34')]);_0x30f761[_0x85f3('0x35')]=qs[_0x85f3('0x2b')](_[_0x85f3('0x36')](_0x2d61b9['query'],_0x24e9e3[_0x85f3('0x2b')]),_0x4387cd);if(_0x2d61b9[_0x85f3('0x29')]['filter']){_0x30f761[_0x85f3('0x35')]=_[_0x85f3('0x37')](_0x30f761[_0x85f3('0x35')],{'$or':_[_0x85f3('0x24')](_0x4387cd,function(_0x5db85f){if(_0x5db85f[_0x85f3('0x28')]!==_0x85f3('0x38')){var _0x8dbe24={};_0x8dbe24[_0x5db85f[_0x85f3('0x21')]]={'$like':'%'+_0x2d61b9[_0x85f3('0x29')][_0x85f3('0x39')]+'%'};return _0x8dbe24;}})});}_0x30f761=_[_0x85f3('0x37')]({},_0x30f761,_0x2d61b9[_0x85f3('0x3a')]);var _0x47fd4f={'where':_0x30f761[_0x85f3('0x35')]};return db[_0x85f3('0x25')][_0x85f3('0x18')](_0x47fd4f)[_0x85f3('0x1e')](function(_0x6f7e8){_0xc183c['count']=_0x6f7e8;if(_0x2d61b9[_0x85f3('0x29')][_0x85f3('0x3b')]){_0x30f761[_0x85f3('0x3c')]=[{'all':!![]}];}return db[_0x85f3('0x25')][_0x85f3('0x3d')](_0x30f761);})[_0x85f3('0x1e')](function(_0xd9785){_0xc183c[_0x85f3('0x3e')]=_0xd9785;return _0xc183c;})[_0x85f3('0x1e')](respondWithFilteredResult(_0x32ecea,_0x30f761))['catch'](handleError(_0x32ecea,null));};exports[_0x85f3('0x3f')]=function(_0x1e6928,_0x4df217){var _0x213d85={'raw':![],'where':{'id':_0x1e6928[_0x85f3('0x40')]['id']}},_0x12f867={};_0x12f867['model']=_[_0x85f3('0x2a')](db['ZendeskConfiguration'][_0x85f3('0x26')]);_0x12f867[_0x85f3('0x29')]=_[_0x85f3('0x2a')](_0x1e6928[_0x85f3('0x29')]);_0x12f867[_0x85f3('0x2b')]=_[_0x85f3('0x2c')](_0x12f867[_0x85f3('0x30')],_0x12f867['query']);_0x213d85[_0x85f3('0x2d')]=_[_0x85f3('0x2c')](_0x12f867[_0x85f3('0x30')],qs[_0x85f3('0x2e')](_0x1e6928[_0x85f3('0x29')]['fields']));_0x213d85[_0x85f3('0x2d')]=_0x213d85[_0x85f3('0x2d')][_0x85f3('0x2f')]?_0x213d85['attributes']:_0x12f867[_0x85f3('0x30')];if(_0x1e6928[_0x85f3('0x29')][_0x85f3('0x3b')]){_0x213d85['include']=[{'all':!![]}];}_0x213d85=_[_0x85f3('0x37')]({},_0x213d85,_0x1e6928[_0x85f3('0x3a')]);return db[_0x85f3('0x25')][_0x85f3('0x41')](_0x213d85)[_0x85f3('0x1e')](handleEntityNotFound(_0x4df217,null))[_0x85f3('0x1e')](respondWithResult(_0x4df217,null))[_0x85f3('0x42')](handleError(_0x4df217,null));};exports[_0x85f3('0x43')]=function(_0x5cadbf,_0xca3837){return db['ZendeskConfiguration']['create'](_0x5cadbf['body'],{})['then'](respondWithResult(_0xca3837,0xc9))[_0x85f3('0x42')](handleError(_0xca3837,null));};exports['update']=function(_0x570ec1,_0x2ea0a6){if(_0x570ec1[_0x85f3('0x44')]['id']){delete _0x570ec1[_0x85f3('0x44')]['id'];}return db[_0x85f3('0x25')][_0x85f3('0x41')]({'where':{'id':_0x570ec1[_0x85f3('0x40')]['id']}})[_0x85f3('0x1e')](handleEntityNotFound(_0x2ea0a6,null))['then'](saveUpdates(_0x570ec1[_0x85f3('0x44')],null))[_0x85f3('0x1e')](respondWithResult(_0x2ea0a6,null))['catch'](handleError(_0x2ea0a6,null));};exports['destroy']=function(_0x379f9b,_0x450208){return db['ZendeskConfiguration']['find']({'where':{'id':_0x379f9b['params']['id']}})['then'](handleEntityNotFound(_0x450208,null))[_0x85f3('0x1e')](removeEntity(_0x450208,null))['catch'](handleError(_0x450208,null));};exports[_0x85f3('0x45')]=function(_0x3dc49e,_0x1c7cce,_0x2ea814){var _0x3ddedf={};var _0x4e8cdc={};var _0x4ec5a1;var _0xdfe3;return db[_0x85f3('0x25')]['findOne']({'where':{'id':_0x3dc49e[_0x85f3('0x40')]['id']}})['then'](handleEntityNotFound(_0x1c7cce,null))[_0x85f3('0x1e')](function(_0xc9fb81){if(_0xc9fb81){_0x4ec5a1=_0xc9fb81;_0x4e8cdc[_0x85f3('0x30')]=_[_0x85f3('0x2a')](db[_0x85f3('0x46')][_0x85f3('0x26')]);_0x4e8cdc['query']=_[_0x85f3('0x2a')](_0x3dc49e['query']);_0x4e8cdc[_0x85f3('0x2b')]=_['intersection'](_0x4e8cdc['model'],_0x4e8cdc['query']);_0x3ddedf[_0x85f3('0x2d')]=_[_0x85f3('0x2c')](_0x4e8cdc[_0x85f3('0x30')],qs[_0x85f3('0x2e')](_0x3dc49e[_0x85f3('0x29')][_0x85f3('0x2e')]));_0x3ddedf[_0x85f3('0x2d')]=_0x3ddedf[_0x85f3('0x2d')]['length']?_0x3ddedf[_0x85f3('0x2d')]:_0x4e8cdc[_0x85f3('0x30')];_0x3ddedf[_0x85f3('0x33')]=qs[_0x85f3('0x34')](_0x3dc49e['query'][_0x85f3('0x34')]);_0x3ddedf[_0x85f3('0x35')]=qs[_0x85f3('0x2b')](_[_0x85f3('0x36')](_0x3dc49e['query'],_0x4e8cdc[_0x85f3('0x2b')]));if(_0x3dc49e['query'][_0x85f3('0x39')]){_0x3ddedf[_0x85f3('0x35')]=_[_0x85f3('0x37')](_0x3ddedf[_0x85f3('0x35')],{'$or':_['map'](_0x3ddedf[_0x85f3('0x2d')],function(_0x483968){var _0x32347f={};_0x32347f[_0x483968]={'$like':'%'+_0x3dc49e[_0x85f3('0x29')]['filter']+'%'};return _0x32347f;})});}_0x3ddedf=_[_0x85f3('0x37')]({},_0x3ddedf,_0x3dc49e[_0x85f3('0x3a')]);return _0x4ec5a1[_0x85f3('0x45')](_0x3ddedf);}})['then'](function(_0x43e0da){if(_0x43e0da){_0xdfe3=_0x43e0da[_0x85f3('0x2f')];if(!_0x3dc49e[_0x85f3('0x29')][_0x85f3('0x31')](_0x85f3('0x32'))){_0x3ddedf[_0x85f3('0x16')]=qs[_0x85f3('0x16')](_0x3dc49e['query'][_0x85f3('0x16')]);_0x3ddedf['offset']=qs[_0x85f3('0x19')](_0x3dc49e[_0x85f3('0x29')]['offset']);}return _0x4ec5a1[_0x85f3('0x45')](_0x3ddedf);}})[_0x85f3('0x1e')](function(_0x7184f6){if(_0x7184f6){return _0x7184f6?{'count':_0xdfe3,'rows':_0x7184f6}:null;}})[_0x85f3('0x1e')](respondWithResult(_0x1c7cce,null))['catch'](handleError(_0x1c7cce,null));};exports[_0x85f3('0x47')]=function(_0x4f5bd8,_0x304614,_0x2100d7){var _0x1c5176={};var _0x33142f={};var _0x4ea25f;var _0x4208c0;return db['ZendeskConfiguration'][_0x85f3('0x48')]({'where':{'id':_0x4f5bd8[_0x85f3('0x40')]['id']}})[_0x85f3('0x1e')](handleEntityNotFound(_0x304614,null))[_0x85f3('0x1e')](function(_0x3d0e65){if(_0x3d0e65){_0x4ea25f=_0x3d0e65;_0x33142f['model']=_[_0x85f3('0x2a')](db[_0x85f3('0x46')][_0x85f3('0x26')]);_0x33142f[_0x85f3('0x29')]=_[_0x85f3('0x2a')](_0x4f5bd8[_0x85f3('0x29')]);_0x33142f[_0x85f3('0x2b')]=_[_0x85f3('0x2c')](_0x33142f['model'],_0x33142f['query']);_0x1c5176[_0x85f3('0x2d')]=_[_0x85f3('0x2c')](_0x33142f[_0x85f3('0x30')],qs[_0x85f3('0x2e')](_0x4f5bd8['query'][_0x85f3('0x2e')]));_0x1c5176[_0x85f3('0x2d')]=_0x1c5176[_0x85f3('0x2d')]['length']?_0x1c5176['attributes']:_0x33142f[_0x85f3('0x30')];_0x1c5176[_0x85f3('0x33')]=qs[_0x85f3('0x34')](_0x4f5bd8[_0x85f3('0x29')][_0x85f3('0x34')]);_0x1c5176[_0x85f3('0x35')]=qs[_0x85f3('0x2b')](_[_0x85f3('0x36')](_0x4f5bd8['query'],_0x33142f[_0x85f3('0x2b')]));if(_0x4f5bd8[_0x85f3('0x29')][_0x85f3('0x39')]){_0x1c5176['where']=_[_0x85f3('0x37')](_0x1c5176['where'],{'$or':_[_0x85f3('0x24')](_0x1c5176[_0x85f3('0x2d')],function(_0x237bfb){var _0x4d4641={};_0x4d4641[_0x237bfb]={'$like':'%'+_0x4f5bd8[_0x85f3('0x29')]['filter']+'%'};return _0x4d4641;})});}_0x1c5176=_[_0x85f3('0x37')]({},_0x1c5176,_0x4f5bd8[_0x85f3('0x3a')]);return _0x4ea25f[_0x85f3('0x47')](_0x1c5176);}})[_0x85f3('0x1e')](function(_0x1ba94b){if(_0x1ba94b){_0x4208c0=_0x1ba94b[_0x85f3('0x2f')];if(!_0x4f5bd8['query']['hasOwnProperty'](_0x85f3('0x32'))){_0x1c5176[_0x85f3('0x16')]=qs[_0x85f3('0x16')](_0x4f5bd8[_0x85f3('0x29')][_0x85f3('0x16')]);_0x1c5176['offset']=qs[_0x85f3('0x19')](_0x4f5bd8[_0x85f3('0x29')][_0x85f3('0x19')]);}return _0x4ea25f['getSubjects'](_0x1c5176);}})[_0x85f3('0x1e')](function(_0x30cbc9){if(_0x30cbc9){return _0x30cbc9?{'count':_0x4208c0,'rows':_0x30cbc9}:null;}})['then'](respondWithResult(_0x304614,null))[_0x85f3('0x42')](handleError(_0x304614,null));};exports['getDescriptions']=function(_0x798fdc,_0x32db98,_0x5aa9b0){var _0xf3751b={};var _0xb677ee={};var _0x55349b;var _0x342e07;return db[_0x85f3('0x25')][_0x85f3('0x48')]({'where':{'id':_0x798fdc['params']['id']}})[_0x85f3('0x1e')](handleEntityNotFound(_0x32db98,null))[_0x85f3('0x1e')](function(_0x5e5606){if(_0x5e5606){_0x55349b=_0x5e5606;_0xb677ee[_0x85f3('0x30')]=_[_0x85f3('0x2a')](db[_0x85f3('0x46')][_0x85f3('0x26')]);_0xb677ee[_0x85f3('0x29')]=_[_0x85f3('0x2a')](_0x798fdc[_0x85f3('0x29')]);_0xb677ee[_0x85f3('0x2b')]=_[_0x85f3('0x2c')](_0xb677ee['model'],_0xb677ee[_0x85f3('0x29')]);_0xf3751b['attributes']=_[_0x85f3('0x2c')](_0xb677ee[_0x85f3('0x30')],qs[_0x85f3('0x2e')](_0x798fdc[_0x85f3('0x29')][_0x85f3('0x2e')]));_0xf3751b['attributes']=_0xf3751b['attributes'][_0x85f3('0x2f')]?_0xf3751b[_0x85f3('0x2d')]:_0xb677ee[_0x85f3('0x30')];_0xf3751b[_0x85f3('0x33')]=qs[_0x85f3('0x34')](_0x798fdc['query'][_0x85f3('0x34')]);_0xf3751b[_0x85f3('0x35')]=qs[_0x85f3('0x2b')](_[_0x85f3('0x36')](_0x798fdc[_0x85f3('0x29')],_0xb677ee[_0x85f3('0x2b')]));if(_0x798fdc['query']['filter']){_0xf3751b[_0x85f3('0x35')]=_[_0x85f3('0x37')](_0xf3751b[_0x85f3('0x35')],{'$or':_['map'](_0xf3751b['attributes'],function(_0x48df07){var _0x260002={};_0x260002[_0x48df07]={'$like':'%'+_0x798fdc[_0x85f3('0x29')][_0x85f3('0x39')]+'%'};return _0x260002;})});}_0xf3751b=_[_0x85f3('0x37')]({},_0xf3751b,_0x798fdc[_0x85f3('0x3a')]);return _0x55349b[_0x85f3('0x49')](_0xf3751b);}})['then'](function(_0x154921){if(_0x154921){_0x342e07=_0x154921[_0x85f3('0x2f')];if(!_0x798fdc[_0x85f3('0x29')][_0x85f3('0x31')](_0x85f3('0x32'))){_0xf3751b[_0x85f3('0x16')]=qs[_0x85f3('0x16')](_0x798fdc[_0x85f3('0x29')][_0x85f3('0x16')]);_0xf3751b[_0x85f3('0x19')]=qs['offset'](_0x798fdc['query']['offset']);}return _0x55349b[_0x85f3('0x49')](_0xf3751b);}})[_0x85f3('0x1e')](function(_0x57ad3){if(_0x57ad3){return _0x57ad3?{'count':_0x342e07,'rows':_0x57ad3}:null;}})[_0x85f3('0x1e')](respondWithResult(_0x32db98,null))[_0x85f3('0x42')](handleError(_0x32db98,null));};exports[_0x85f3('0x4a')]=function(_0x5ec1db,_0x5c4f7d,_0x57b85b){var _0x30f0de={};var _0x2c58c9={};var _0x1fbfde;var _0x1640b8;return db['ZendeskConfiguration'][_0x85f3('0x48')]({'where':{'id':_0x5ec1db[_0x85f3('0x40')]['id']}})[_0x85f3('0x1e')](handleEntityNotFound(_0x5c4f7d,null))[_0x85f3('0x1e')](function(_0x561ed2){if(_0x561ed2){_0x1fbfde=_0x561ed2;_0x2c58c9[_0x85f3('0x30')]=_[_0x85f3('0x2a')](db[_0x85f3('0x4b')][_0x85f3('0x26')]);_0x2c58c9['query']=_[_0x85f3('0x2a')](_0x5ec1db[_0x85f3('0x29')]);_0x2c58c9[_0x85f3('0x2b')]=_[_0x85f3('0x2c')](_0x2c58c9[_0x85f3('0x30')],_0x2c58c9[_0x85f3('0x29')]);_0x30f0de[_0x85f3('0x2d')]=_[_0x85f3('0x2c')](_0x2c58c9[_0x85f3('0x30')],qs['fields'](_0x5ec1db['query'][_0x85f3('0x2e')]));_0x30f0de[_0x85f3('0x2d')]=_0x30f0de[_0x85f3('0x2d')][_0x85f3('0x2f')]?_0x30f0de[_0x85f3('0x2d')]:_0x2c58c9['model'];_0x30f0de[_0x85f3('0x33')]=qs['sort'](_0x5ec1db[_0x85f3('0x29')]['sort']);_0x30f0de['where']=qs['filters'](_[_0x85f3('0x36')](_0x5ec1db[_0x85f3('0x29')],_0x2c58c9[_0x85f3('0x2b')]));if(_0x5ec1db[_0x85f3('0x29')][_0x85f3('0x39')]){_0x30f0de[_0x85f3('0x35')]=_[_0x85f3('0x37')](_0x30f0de['where'],{'$or':_['map'](_0x30f0de[_0x85f3('0x2d')],function(_0x1b96d2){var _0xef36d3={};_0xef36d3[_0x1b96d2]={'$like':'%'+_0x5ec1db[_0x85f3('0x29')][_0x85f3('0x39')]+'%'};return _0xef36d3;})});}_0x30f0de=_[_0x85f3('0x37')]({},_0x30f0de,_0x5ec1db[_0x85f3('0x3a')]);return _0x1fbfde[_0x85f3('0x4a')](_0x30f0de);}})[_0x85f3('0x1e')](function(_0x21fc11){if(_0x21fc11){_0x1640b8=_0x21fc11[_0x85f3('0x2f')];if(!_0x5ec1db[_0x85f3('0x29')]['hasOwnProperty']('nolimit')){_0x30f0de[_0x85f3('0x16')]=qs[_0x85f3('0x16')](_0x5ec1db[_0x85f3('0x29')]['limit']);_0x30f0de[_0x85f3('0x19')]=qs[_0x85f3('0x19')](_0x5ec1db['query'][_0x85f3('0x19')]);}return _0x1fbfde[_0x85f3('0x4a')](_0x30f0de);}})[_0x85f3('0x1e')](function(_0x412684){if(_0x412684){return _0x412684?{'count':_0x1640b8,'rows':_0x412684}:null;}})[_0x85f3('0x1e')](respondWithResult(_0x5c4f7d,null))[_0x85f3('0x42')](handleError(_0x5c4f7d,null));};exports[_0x85f3('0x4c')]=function(_0x4b5958,_0x3ed595,_0x5a9bb6){if(_0x4b5958[_0x85f3('0x44')]['id']){delete _0x4b5958[_0x85f3('0x44')]['id'];}return db[_0x85f3('0x25')][_0x85f3('0x48')]({'where':{'id':_0x4b5958['params']['id']}})['then'](handleEntityNotFound(_0x3ed595,null))[_0x85f3('0x1e')](function(_0x4f93e5){if(_0x4f93e5){return _0x4f93e5[_0x85f3('0x4c')](_0x4b5958[_0x85f3('0x44')][_0x85f3('0x4d')]||[]);}return null;})[_0x85f3('0x1e')](respondWithResult(_0x3ed595,null))[_0x85f3('0x42')](handleError(_0x3ed595,null));}; \ No newline at end of file +var _0x7575=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','ZendeskConfiguration','rawAttributes','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','findAll','rows','show','params','keys','include','find','catch','create','body','getFields','findOne','pick','getSubjects','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3c7658,_0x500b70){var _0x3c813e=function(_0x5dca0f){while(--_0x5dca0f){_0x3c7658['push'](_0x3c7658['shift']());}};_0x3c813e(++_0x500b70);}(_0x7575,0x19a));var _0x5757=function(_0x102041,_0x2001b1){_0x102041=_0x102041-0x0;var _0x204735=_0x7575[_0x102041];return _0x204735;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5757('0x0'));var zipdir=require(_0x5757('0x1'));var jsonpatch=require(_0x5757('0x2'));var rp=require(_0x5757('0x3'));var moment=require(_0x5757('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5757('0x5'));var util=require(_0x5757('0x6'));var path=require(_0x5757('0x7'));var sox=require(_0x5757('0x8'));var csv=require('to-csv');var ejs=require(_0x5757('0x9'));var fs=require('fs');var fs_extra=require(_0x5757('0xa'));var _=require(_0x5757('0xb'));var squel=require(_0x5757('0xc'));var crypto=require(_0x5757('0xd'));var jsforce=require(_0x5757('0xe'));var deskjs=require(_0x5757('0xf'));var toCsv=require(_0x5757('0x10'));var querystring=require(_0x5757('0x11'));var Papa=require(_0x5757('0x12'));var Redis=require(_0x5757('0x13'));var authService=require(_0x5757('0x14'));var qs=require(_0x5757('0x15'));var as=require(_0x5757('0x16'));var hardwareService=require(_0x5757('0x17'));var logger=require(_0x5757('0x18'))(_0x5757('0x19'));var utils=require(_0x5757('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x5757('0x1b'));var db=require(_0x5757('0x1c'))['db'];function respondWithStatusCode(_0xaa6f9a,_0x4d6956){_0x4d6956=_0x4d6956||0xcc;return function(_0x356b5c){if(_0x356b5c){return _0xaa6f9a['sendStatus'](_0x4d6956);}return _0xaa6f9a[_0x5757('0x1d')](_0x4d6956)[_0x5757('0x1e')]();};}function respondWithResult(_0x3daf67,_0x34c660){_0x34c660=_0x34c660||0xc8;return function(_0x1b2a87){if(_0x1b2a87){return _0x3daf67[_0x5757('0x1d')](_0x34c660)[_0x5757('0x1f')](_0x1b2a87);}};}function respondWithFilteredResult(_0xcef43c,_0x3ca063){return function(_0x4c9e0b){if(_0x4c9e0b){var _0x6e06c0=typeof _0x3ca063[_0x5757('0x20')]===_0x5757('0x21')&&typeof _0x3ca063[_0x5757('0x22')]===_0x5757('0x21');var _0x7704d=_0x4c9e0b[_0x5757('0x23')];var _0x26315c=_0x6e06c0?0x0:_0x3ca063[_0x5757('0x20')];var _0x18a5cd=_0x6e06c0?_0x4c9e0b['count']:_0x3ca063[_0x5757('0x20')]+_0x3ca063[_0x5757('0x22')];var _0x4df86f;if(_0x18a5cd>=_0x7704d){_0x18a5cd=_0x7704d;_0x4df86f=0xc8;}else{_0x4df86f=0xce;}_0xcef43c[_0x5757('0x1d')](_0x4df86f);return _0xcef43c[_0x5757('0x24')]('Content-Range',_0x26315c+'-'+_0x18a5cd+'/'+_0x7704d)[_0x5757('0x1f')](_0x4c9e0b);}return null;};}function patchUpdates(_0x1a475e){return function(_0xbdff38){try{jsonpatch[_0x5757('0x25')](_0xbdff38,_0x1a475e,!![]);}catch(_0xa68c08){return BPromise['reject'](_0xa68c08);}return _0xbdff38[_0x5757('0x26')]();};}function saveUpdates(_0x4e7309,_0x2819b2){return function(_0x53f7c5){if(_0x53f7c5){return _0x53f7c5[_0x5757('0x27')](_0x4e7309)[_0x5757('0x28')](function(_0x5868cc){return _0x5868cc;});}return null;};}function removeEntity(_0x5c5702,_0x1db015){return function(_0x3e5240){if(_0x3e5240){return _0x3e5240[_0x5757('0x29')]()[_0x5757('0x28')](function(){_0x5c5702[_0x5757('0x1d')](0xcc)[_0x5757('0x1e')]();});}};}function handleEntityNotFound(_0x147c43,_0x340135){return function(_0x2bda11){if(!_0x2bda11){_0x147c43[_0x5757('0x2a')](0x194);}return _0x2bda11;};}function handleError(_0x521e9f,_0x2b0f77){_0x2b0f77=_0x2b0f77||0x1f4;return function(_0x45216e){logger[_0x5757('0x2b')](_0x45216e['stack']);if(_0x45216e['name']){delete _0x45216e[_0x5757('0x2c')];}_0x521e9f[_0x5757('0x1d')](_0x2b0f77)[_0x5757('0x2d')](_0x45216e);};}exports[_0x5757('0x2e')]=function(_0x184bd9,_0x2e49a3){var _0x1d3b3f={},_0x3fea6e={},_0x1c03d7={'count':0x0,'rows':[]};var _0x3e4635=_['map'](db[_0x5757('0x2f')][_0x5757('0x30')],function(_0x26a5cb){return{'name':_0x26a5cb['fieldName'],'type':_0x26a5cb[_0x5757('0x31')]['key']};});_0x3fea6e[_0x5757('0x32')]=_[_0x5757('0x33')](_0x3e4635,_0x5757('0x2c'));_0x3fea6e[_0x5757('0x34')]=_['keys'](_0x184bd9[_0x5757('0x34')]);_0x3fea6e[_0x5757('0x35')]=_[_0x5757('0x36')](_0x3fea6e[_0x5757('0x32')],_0x3fea6e[_0x5757('0x34')]);_0x1d3b3f['attributes']=_[_0x5757('0x36')](_0x3fea6e['model'],qs[_0x5757('0x37')](_0x184bd9[_0x5757('0x34')]['fields']));_0x1d3b3f[_0x5757('0x38')]=_0x1d3b3f[_0x5757('0x38')][_0x5757('0x39')]?_0x1d3b3f['attributes']:_0x3fea6e['model'];if(!_0x184bd9[_0x5757('0x34')][_0x5757('0x3a')](_0x5757('0x3b'))){_0x1d3b3f[_0x5757('0x22')]=qs[_0x5757('0x22')](_0x184bd9[_0x5757('0x34')]['limit']);_0x1d3b3f[_0x5757('0x20')]=qs[_0x5757('0x20')](_0x184bd9[_0x5757('0x34')]['offset']);}_0x1d3b3f[_0x5757('0x3c')]=qs['sort'](_0x184bd9[_0x5757('0x34')][_0x5757('0x3d')]);_0x1d3b3f['where']=qs[_0x5757('0x35')](_['pick'](_0x184bd9[_0x5757('0x34')],_0x3fea6e[_0x5757('0x35')]),_0x3e4635);if(_0x184bd9[_0x5757('0x34')][_0x5757('0x3e')]){_0x1d3b3f[_0x5757('0x3f')]=_[_0x5757('0x40')](_0x1d3b3f[_0x5757('0x3f')],{'$or':_['map'](_0x3e4635,function(_0x183b24){if(_0x183b24[_0x5757('0x31')]!=='VIRTUAL'){var _0xed71fa={};_0xed71fa[_0x183b24[_0x5757('0x2c')]]={'$like':'%'+_0x184bd9[_0x5757('0x34')][_0x5757('0x3e')]+'%'};return _0xed71fa;}})});}_0x1d3b3f=_[_0x5757('0x40')]({},_0x1d3b3f,_0x184bd9[_0x5757('0x41')]);var _0x14bd19={'where':_0x1d3b3f[_0x5757('0x3f')]};return db[_0x5757('0x2f')][_0x5757('0x23')](_0x14bd19)[_0x5757('0x28')](function(_0x16c8d2){_0x1c03d7['count']=_0x16c8d2;if(_0x184bd9[_0x5757('0x34')]['includeAll']){_0x1d3b3f['include']=[{'all':!![]}];}return db[_0x5757('0x2f')][_0x5757('0x42')](_0x1d3b3f);})[_0x5757('0x28')](function(_0x331094){_0x1c03d7[_0x5757('0x43')]=_0x331094;return _0x1c03d7;})[_0x5757('0x28')](respondWithFilteredResult(_0x2e49a3,_0x1d3b3f))['catch'](handleError(_0x2e49a3,null));};exports[_0x5757('0x44')]=function(_0x2be701,_0x28fded){var _0x55a2c1={'raw':![],'where':{'id':_0x2be701[_0x5757('0x45')]['id']}},_0x212309={};_0x212309['model']=_['keys'](db[_0x5757('0x2f')][_0x5757('0x30')]);_0x212309[_0x5757('0x34')]=_[_0x5757('0x46')](_0x2be701[_0x5757('0x34')]);_0x212309[_0x5757('0x35')]=_['intersection'](_0x212309['model'],_0x212309['query']);_0x55a2c1[_0x5757('0x38')]=_[_0x5757('0x36')](_0x212309[_0x5757('0x32')],qs[_0x5757('0x37')](_0x2be701[_0x5757('0x34')][_0x5757('0x37')]));_0x55a2c1[_0x5757('0x38')]=_0x55a2c1[_0x5757('0x38')][_0x5757('0x39')]?_0x55a2c1[_0x5757('0x38')]:_0x212309[_0x5757('0x32')];if(_0x2be701[_0x5757('0x34')]['includeAll']){_0x55a2c1[_0x5757('0x47')]=[{'all':!![]}];}_0x55a2c1=_[_0x5757('0x40')]({},_0x55a2c1,_0x2be701['options']);return db['ZendeskConfiguration'][_0x5757('0x48')](_0x55a2c1)[_0x5757('0x28')](handleEntityNotFound(_0x28fded,null))[_0x5757('0x28')](respondWithResult(_0x28fded,null))[_0x5757('0x49')](handleError(_0x28fded,null));};exports[_0x5757('0x4a')]=function(_0x53353e,_0x53a7e8){return db[_0x5757('0x2f')]['create'](_0x53353e[_0x5757('0x4b')],{})['then'](respondWithResult(_0x53a7e8,0xc9))[_0x5757('0x49')](handleError(_0x53a7e8,null));};exports[_0x5757('0x27')]=function(_0x41a9d3,_0x26bbae){if(_0x41a9d3[_0x5757('0x4b')]['id']){delete _0x41a9d3[_0x5757('0x4b')]['id'];}return db['ZendeskConfiguration'][_0x5757('0x48')]({'where':{'id':_0x41a9d3['params']['id']}})[_0x5757('0x28')](handleEntityNotFound(_0x26bbae,null))['then'](saveUpdates(_0x41a9d3['body'],null))[_0x5757('0x28')](respondWithResult(_0x26bbae,null))[_0x5757('0x49')](handleError(_0x26bbae,null));};exports[_0x5757('0x29')]=function(_0x5968fe,_0x2519d4){return db['ZendeskConfiguration'][_0x5757('0x48')]({'where':{'id':_0x5968fe[_0x5757('0x45')]['id']}})['then'](handleEntityNotFound(_0x2519d4,null))['then'](removeEntity(_0x2519d4,null))[_0x5757('0x49')](handleError(_0x2519d4,null));};exports[_0x5757('0x4c')]=function(_0x3c3bb7,_0x1926ec,_0x5a5044){var _0x41c057={};var _0x3b8d4c={};var _0x42cc4d;var _0x3f3ae1;return db['ZendeskConfiguration'][_0x5757('0x4d')]({'where':{'id':_0x3c3bb7[_0x5757('0x45')]['id']}})['then'](handleEntityNotFound(_0x1926ec,null))[_0x5757('0x28')](function(_0x2d64b8){if(_0x2d64b8){_0x42cc4d=_0x2d64b8;_0x3b8d4c[_0x5757('0x32')]=_[_0x5757('0x46')](db['ZendeskField'][_0x5757('0x30')]);_0x3b8d4c[_0x5757('0x34')]=_[_0x5757('0x46')](_0x3c3bb7[_0x5757('0x34')]);_0x3b8d4c[_0x5757('0x35')]=_[_0x5757('0x36')](_0x3b8d4c['model'],_0x3b8d4c['query']);_0x41c057['attributes']=_[_0x5757('0x36')](_0x3b8d4c[_0x5757('0x32')],qs[_0x5757('0x37')](_0x3c3bb7['query'][_0x5757('0x37')]));_0x41c057[_0x5757('0x38')]=_0x41c057[_0x5757('0x38')][_0x5757('0x39')]?_0x41c057[_0x5757('0x38')]:_0x3b8d4c[_0x5757('0x32')];_0x41c057[_0x5757('0x3c')]=qs['sort'](_0x3c3bb7[_0x5757('0x34')][_0x5757('0x3d')]);_0x41c057[_0x5757('0x3f')]=qs[_0x5757('0x35')](_[_0x5757('0x4e')](_0x3c3bb7[_0x5757('0x34')],_0x3b8d4c[_0x5757('0x35')]));if(_0x3c3bb7[_0x5757('0x34')][_0x5757('0x3e')]){_0x41c057[_0x5757('0x3f')]=_['merge'](_0x41c057[_0x5757('0x3f')],{'$or':_[_0x5757('0x33')](_0x41c057[_0x5757('0x38')],function(_0x392156){var _0xcc7a10={};_0xcc7a10[_0x392156]={'$like':'%'+_0x3c3bb7['query'][_0x5757('0x3e')]+'%'};return _0xcc7a10;})});}_0x41c057=_[_0x5757('0x40')]({},_0x41c057,_0x3c3bb7[_0x5757('0x41')]);return _0x42cc4d[_0x5757('0x4c')](_0x41c057);}})[_0x5757('0x28')](function(_0x461204){if(_0x461204){_0x3f3ae1=_0x461204[_0x5757('0x39')];if(!_0x3c3bb7[_0x5757('0x34')][_0x5757('0x3a')](_0x5757('0x3b'))){_0x41c057[_0x5757('0x22')]=qs[_0x5757('0x22')](_0x3c3bb7[_0x5757('0x34')][_0x5757('0x22')]);_0x41c057[_0x5757('0x20')]=qs[_0x5757('0x20')](_0x3c3bb7[_0x5757('0x34')][_0x5757('0x20')]);}return _0x42cc4d[_0x5757('0x4c')](_0x41c057);}})[_0x5757('0x28')](function(_0x384c1b){if(_0x384c1b){return _0x384c1b?{'count':_0x3f3ae1,'rows':_0x384c1b}:null;}})[_0x5757('0x28')](respondWithResult(_0x1926ec,null))['catch'](handleError(_0x1926ec,null));};exports[_0x5757('0x4f')]=function(_0x42317a,_0x42df4f,_0x3f945c){var _0x8b2ddb={};var _0x4e5047={};var _0x522ed4;var _0x3a372b;return db[_0x5757('0x2f')]['findOne']({'where':{'id':_0x42317a[_0x5757('0x45')]['id']}})[_0x5757('0x28')](handleEntityNotFound(_0x42df4f,null))[_0x5757('0x28')](function(_0x30ff69){if(_0x30ff69){_0x522ed4=_0x30ff69;_0x4e5047[_0x5757('0x32')]=_[_0x5757('0x46')](db['ZendeskField'][_0x5757('0x30')]);_0x4e5047[_0x5757('0x34')]=_['keys'](_0x42317a[_0x5757('0x34')]);_0x4e5047['filters']=_[_0x5757('0x36')](_0x4e5047[_0x5757('0x32')],_0x4e5047[_0x5757('0x34')]);_0x8b2ddb[_0x5757('0x38')]=_['intersection'](_0x4e5047[_0x5757('0x32')],qs[_0x5757('0x37')](_0x42317a[_0x5757('0x34')][_0x5757('0x37')]));_0x8b2ddb['attributes']=_0x8b2ddb[_0x5757('0x38')][_0x5757('0x39')]?_0x8b2ddb[_0x5757('0x38')]:_0x4e5047[_0x5757('0x32')];_0x8b2ddb[_0x5757('0x3c')]=qs['sort'](_0x42317a[_0x5757('0x34')][_0x5757('0x3d')]);_0x8b2ddb[_0x5757('0x3f')]=qs[_0x5757('0x35')](_[_0x5757('0x4e')](_0x42317a[_0x5757('0x34')],_0x4e5047[_0x5757('0x35')]));if(_0x42317a[_0x5757('0x34')]['filter']){_0x8b2ddb[_0x5757('0x3f')]=_[_0x5757('0x40')](_0x8b2ddb[_0x5757('0x3f')],{'$or':_['map'](_0x8b2ddb[_0x5757('0x38')],function(_0x269ca3){var _0x44bf62={};_0x44bf62[_0x269ca3]={'$like':'%'+_0x42317a['query'][_0x5757('0x3e')]+'%'};return _0x44bf62;})});}_0x8b2ddb=_[_0x5757('0x40')]({},_0x8b2ddb,_0x42317a['options']);return _0x522ed4[_0x5757('0x4f')](_0x8b2ddb);}})[_0x5757('0x28')](function(_0x408488){if(_0x408488){_0x3a372b=_0x408488['length'];if(!_0x42317a[_0x5757('0x34')][_0x5757('0x3a')]('nolimit')){_0x8b2ddb[_0x5757('0x22')]=qs[_0x5757('0x22')](_0x42317a[_0x5757('0x34')]['limit']);_0x8b2ddb[_0x5757('0x20')]=qs[_0x5757('0x20')](_0x42317a[_0x5757('0x34')]['offset']);}return _0x522ed4[_0x5757('0x4f')](_0x8b2ddb);}})[_0x5757('0x28')](function(_0x2ba38c){if(_0x2ba38c){return _0x2ba38c?{'count':_0x3a372b,'rows':_0x2ba38c}:null;}})[_0x5757('0x28')](respondWithResult(_0x42df4f,null))['catch'](handleError(_0x42df4f,null));};exports[_0x5757('0x50')]=function(_0x573705,_0x374739,_0x5a5676){var _0x5c6000={};var _0x4dfea7={};var _0x3e929f;var _0x2ff61b;return db[_0x5757('0x2f')][_0x5757('0x4d')]({'where':{'id':_0x573705[_0x5757('0x45')]['id']}})[_0x5757('0x28')](handleEntityNotFound(_0x374739,null))[_0x5757('0x28')](function(_0x44b3c4){if(_0x44b3c4){_0x3e929f=_0x44b3c4;_0x4dfea7[_0x5757('0x32')]=_[_0x5757('0x46')](db[_0x5757('0x51')][_0x5757('0x30')]);_0x4dfea7[_0x5757('0x34')]=_['keys'](_0x573705['query']);_0x4dfea7[_0x5757('0x35')]=_[_0x5757('0x36')](_0x4dfea7['model'],_0x4dfea7[_0x5757('0x34')]);_0x5c6000[_0x5757('0x38')]=_[_0x5757('0x36')](_0x4dfea7[_0x5757('0x32')],qs[_0x5757('0x37')](_0x573705[_0x5757('0x34')][_0x5757('0x37')]));_0x5c6000['attributes']=_0x5c6000[_0x5757('0x38')][_0x5757('0x39')]?_0x5c6000[_0x5757('0x38')]:_0x4dfea7[_0x5757('0x32')];_0x5c6000[_0x5757('0x3c')]=qs[_0x5757('0x3d')](_0x573705[_0x5757('0x34')][_0x5757('0x3d')]);_0x5c6000['where']=qs[_0x5757('0x35')](_[_0x5757('0x4e')](_0x573705['query'],_0x4dfea7[_0x5757('0x35')]));if(_0x573705['query'][_0x5757('0x3e')]){_0x5c6000[_0x5757('0x3f')]=_[_0x5757('0x40')](_0x5c6000[_0x5757('0x3f')],{'$or':_[_0x5757('0x33')](_0x5c6000[_0x5757('0x38')],function(_0x3256c3){var _0xbf0893={};_0xbf0893[_0x3256c3]={'$like':'%'+_0x573705[_0x5757('0x34')][_0x5757('0x3e')]+'%'};return _0xbf0893;})});}_0x5c6000=_[_0x5757('0x40')]({},_0x5c6000,_0x573705[_0x5757('0x41')]);return _0x3e929f['getDescriptions'](_0x5c6000);}})[_0x5757('0x28')](function(_0x1e44e0){if(_0x1e44e0){_0x2ff61b=_0x1e44e0[_0x5757('0x39')];if(!_0x573705[_0x5757('0x34')][_0x5757('0x3a')](_0x5757('0x3b'))){_0x5c6000[_0x5757('0x22')]=qs[_0x5757('0x22')](_0x573705[_0x5757('0x34')][_0x5757('0x22')]);_0x5c6000[_0x5757('0x20')]=qs[_0x5757('0x20')](_0x573705[_0x5757('0x34')][_0x5757('0x20')]);}return _0x3e929f[_0x5757('0x50')](_0x5c6000);}})[_0x5757('0x28')](function(_0x5b9157){if(_0x5b9157){return _0x5b9157?{'count':_0x2ff61b,'rows':_0x5b9157}:null;}})[_0x5757('0x28')](respondWithResult(_0x374739,null))['catch'](handleError(_0x374739,null));};exports[_0x5757('0x52')]=function(_0x841f69,_0xce07ec,_0x28fda1){var _0x9f1cd7={};var _0x2aacfe={};var _0x14484d;var _0x521cfe;return db[_0x5757('0x2f')][_0x5757('0x4d')]({'where':{'id':_0x841f69[_0x5757('0x45')]['id']}})[_0x5757('0x28')](handleEntityNotFound(_0xce07ec,null))[_0x5757('0x28')](function(_0x1215fc){if(_0x1215fc){_0x14484d=_0x1215fc;_0x2aacfe[_0x5757('0x32')]=_[_0x5757('0x46')](db[_0x5757('0x53')]['rawAttributes']);_0x2aacfe['query']=_[_0x5757('0x46')](_0x841f69[_0x5757('0x34')]);_0x2aacfe[_0x5757('0x35')]=_[_0x5757('0x36')](_0x2aacfe[_0x5757('0x32')],_0x2aacfe['query']);_0x9f1cd7[_0x5757('0x38')]=_['intersection'](_0x2aacfe[_0x5757('0x32')],qs[_0x5757('0x37')](_0x841f69['query'][_0x5757('0x37')]));_0x9f1cd7[_0x5757('0x38')]=_0x9f1cd7[_0x5757('0x38')][_0x5757('0x39')]?_0x9f1cd7[_0x5757('0x38')]:_0x2aacfe[_0x5757('0x32')];_0x9f1cd7['order']=qs[_0x5757('0x3d')](_0x841f69[_0x5757('0x34')][_0x5757('0x3d')]);_0x9f1cd7[_0x5757('0x3f')]=qs[_0x5757('0x35')](_[_0x5757('0x4e')](_0x841f69[_0x5757('0x34')],_0x2aacfe['filters']));if(_0x841f69[_0x5757('0x34')][_0x5757('0x3e')]){_0x9f1cd7[_0x5757('0x3f')]=_['merge'](_0x9f1cd7[_0x5757('0x3f')],{'$or':_[_0x5757('0x33')](_0x9f1cd7['attributes'],function(_0x56ef16){var _0x48aba4={};_0x48aba4[_0x56ef16]={'$like':'%'+_0x841f69[_0x5757('0x34')][_0x5757('0x3e')]+'%'};return _0x48aba4;})});}_0x9f1cd7=_['merge']({},_0x9f1cd7,_0x841f69[_0x5757('0x41')]);return _0x14484d[_0x5757('0x52')](_0x9f1cd7);}})['then'](function(_0x451493){if(_0x451493){_0x521cfe=_0x451493['length'];if(!_0x841f69[_0x5757('0x34')][_0x5757('0x3a')](_0x5757('0x3b'))){_0x9f1cd7[_0x5757('0x22')]=qs['limit'](_0x841f69[_0x5757('0x34')][_0x5757('0x22')]);_0x9f1cd7[_0x5757('0x20')]=qs['offset'](_0x841f69['query']['offset']);}return _0x14484d[_0x5757('0x52')](_0x9f1cd7);}})[_0x5757('0x28')](function(_0x3c7a2a){if(_0x3c7a2a){return _0x3c7a2a?{'count':_0x521cfe,'rows':_0x3c7a2a}:null;}})[_0x5757('0x28')](respondWithResult(_0xce07ec,null))[_0x5757('0x49')](handleError(_0xce07ec,null));};exports[_0x5757('0x54')]=function(_0xa21ebd,_0x4c6896,_0x5ba2e9){if(_0xa21ebd[_0x5757('0x4b')]['id']){delete _0xa21ebd['body']['id'];}return db[_0x5757('0x2f')][_0x5757('0x4d')]({'where':{'id':_0xa21ebd[_0x5757('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c6896,null))[_0x5757('0x28')](function(_0x1f30e1){if(_0x1f30e1){return _0x1f30e1['setTags'](_0xa21ebd[_0x5757('0x4b')][_0x5757('0x55')]||[]);}return null;})[_0x5757('0x28')](respondWithResult(_0x4c6896,null))['catch'](handleError(_0x4c6896,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5884431..eb373d9 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 _0x5204=['request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird'];(function(_0x13c304,_0x4791de){var _0x12696e=function(_0x2070d4){while(--_0x2070d4){_0x13c304['push'](_0x13c304['shift']());}};_0x12696e(++_0x4791de);}(_0x5204,0xdf));var _0x4520=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0x5204[_0x4b9dc9];return _0x57b302;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b12=['int_zendesk_configurations','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','ZendeskConfiguration'];(function(_0x1c68ae,_0x3756a8){var _0x39e8d6=function(_0x168f11){while(--_0x168f11){_0x1c68ae['push'](_0x1c68ae['shift']());}};_0x39e8d6(++_0x3756a8);}(_0x5b12,0xa3));var _0x25b1=function(_0x17825c,_0x1e4079){_0x17825c=_0x17825c-0x0;var _0x456597=_0x5b12[_0x17825c];return _0x456597;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var logger=require(_0x25b1('0x2'))('api');var moment=require(_0x25b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x25b1('0x4'));var fs=require('fs');var path=require(_0x25b1('0x5'));var rimraf=require('rimraf');var config=require(_0x25b1('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x35d90b,_0x5523c9){return _0x35d90b['define'](_0x25b1('0x7'),attributes,{'tableName':_0x25b1('0x8'),'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 85d7ffd..b7e85f6 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 _0xf013=['http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0xf013,0x1d5));var _0x3f01=function(_0x335a26,_0x4ddd09){_0x335a26=_0x335a26-0x0;var _0x3076fb=_0xf013[_0x335a26];return _0x3076fb;};'use strict';var _=require(_0x3f01('0x0'));var util=require(_0x3f01('0x1'));var moment=require(_0x3f01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f01('0x3'));var db=require(_0x3f01('0x4'))['db'];var utils=require(_0x3f01('0x5'));var logger=require(_0x3f01('0x6'))(_0x3f01('0x7'));var config=require(_0x3f01('0x8'));var jayson=require(_0x3f01('0x9'));var client=jayson[_0x3f01('0xa')][_0x3f01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x299779,_0x18483a,_0xcb43d5){return new BPromise(function(_0x295f1c,_0x55a9be){return client[_0x3f01('0xc')](_0x299779,_0xcb43d5)['then'](function(_0x37bad2){logger[_0x3f01('0xd')](_0x3f01('0xe'),_0x18483a,_0x3f01('0xf'));logger[_0x3f01('0x10')](_0x3f01('0x11'),_0x18483a,_0x3f01('0xf'),JSON[_0x3f01('0x12')](_0x37bad2));if(_0x37bad2[_0x3f01('0x13')]){if(_0x37bad2['error'][_0x3f01('0x14')]===0x1f4){logger['error'](_0x3f01('0xe'),_0x18483a,_0x37bad2['error'][_0x3f01('0x15')]);return _0x55a9be(_0x37bad2[_0x3f01('0x13')][_0x3f01('0x15')]);}logger[_0x3f01('0x13')](_0x3f01('0xe'),_0x18483a,_0x37bad2[_0x3f01('0x13')][_0x3f01('0x15')]);return _0x295f1c(_0x37bad2[_0x3f01('0x13')][_0x3f01('0x15')]);}else{logger[_0x3f01('0xd')](_0x3f01('0xe'),_0x18483a,_0x3f01('0xf'));_0x295f1c(_0x37bad2[_0x3f01('0x16')]['message']);}})[_0x3f01('0x17')](function(_0x3bc47b){logger['error'](_0x3f01('0xe'),_0x18483a,_0x3bc47b);_0x55a9be(_0x3bc47b);});});} \ No newline at end of file +var _0x4c2d=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2e2013,_0x4460f8){var _0x111ea9=function(_0x4d04c4){while(--_0x4d04c4){_0x2e2013['push'](_0x2e2013['shift']());}};_0x111ea9(++_0x4460f8);}(_0x4c2d,0x19a));var _0xd4c2=function(_0x379703,_0x1fc1dd){_0x379703=_0x379703-0x0;var _0x1d39e3=_0x4c2d[_0x379703];return _0x1d39e3;};'use strict';var _=require(_0xd4c2('0x0'));var util=require('util');var moment=require(_0xd4c2('0x1'));var BPromise=require(_0xd4c2('0x2'));var rs=require(_0xd4c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c2('0x4'))['db'];var utils=require(_0xd4c2('0x5'));var logger=require(_0xd4c2('0x6'))(_0xd4c2('0x7'));var config=require(_0xd4c2('0x8'));var jayson=require(_0xd4c2('0x9'));var client=jayson[_0xd4c2('0xa')][_0xd4c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x560b90,_0x39b734,_0x4c4f60){return new BPromise(function(_0x47c88c,_0x41bce5){return client[_0xd4c2('0xc')](_0x560b90,_0x4c4f60)[_0xd4c2('0xd')](function(_0x49fa05){logger[_0xd4c2('0xe')](_0xd4c2('0xf'),_0x39b734,_0xd4c2('0x10'));logger[_0xd4c2('0x11')](_0xd4c2('0x12'),_0x39b734,_0xd4c2('0x10'),JSON[_0xd4c2('0x13')](_0x49fa05));if(_0x49fa05[_0xd4c2('0x14')]){if(_0x49fa05[_0xd4c2('0x14')][_0xd4c2('0x15')]===0x1f4){logger[_0xd4c2('0x14')](_0xd4c2('0xf'),_0x39b734,_0x49fa05['error'][_0xd4c2('0x16')]);return _0x41bce5(_0x49fa05['error'][_0xd4c2('0x16')]);}logger[_0xd4c2('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x39b734,_0x49fa05[_0xd4c2('0x14')][_0xd4c2('0x16')]);return _0x47c88c(_0x49fa05[_0xd4c2('0x14')]['message']);}else{logger[_0xd4c2('0xe')](_0xd4c2('0xf'),_0x39b734,_0xd4c2('0x10'));_0x47c88c(_0x49fa05[_0xd4c2('0x17')]['message']);}})[_0xd4c2('0x18')](function(_0x2752f1){logger[_0xd4c2('0x14')](_0xd4c2('0xf'),_0x39b734,_0x2752f1);_0x41bce5(_0x2752f1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 111d8d5..be7e461 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 _0x81ac=['delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x40a505,_0x3cfa25){var _0x5d2a74=function(_0x49e8a9){while(--_0x49e8a9){_0x40a505['push'](_0x40a505['shift']());}};_0x5d2a74(++_0x3cfa25);}(_0x81ac,0x158));var _0xc81a=function(_0xefebd2,_0x49d4b3){_0xefebd2=_0xefebd2-0x0;var _0xf0cd88=_0x81ac[_0xefebd2];return _0xf0cd88;};'use strict';var multer=require(_0xc81a('0x0'));var util=require('util');var path=require(_0xc81a('0x1'));var timeout=require(_0xc81a('0x2'));var express=require('express');var router=express[_0xc81a('0x3')]();var fs_extra=require(_0xc81a('0x4'));var auth=require(_0xc81a('0x5'));var interaction=require(_0xc81a('0x6'));var config=require(_0xc81a('0x7'));var controller=require(_0xc81a('0x8'));router[_0xc81a('0x9')]('/',auth[_0xc81a('0xa')](),controller['index']);router[_0xc81a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc81a('0xb')]);router[_0xc81a('0xc')]('/',auth[_0xc81a('0xa')](),controller[_0xc81a('0xd')]);router['put'](_0xc81a('0xe'),auth[_0xc81a('0xa')](),controller[_0xc81a('0xf')]);router[_0xc81a('0x10')]('/:id',auth[_0xc81a('0xa')](),controller['destroy']);module[_0xc81a('0x11')]=router; \ No newline at end of file +var _0x5898=['fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36af91,_0x55b1a7){var _0x599117=function(_0x3d8b7c){while(--_0x3d8b7c){_0x36af91['push'](_0x36af91['shift']());}};_0x599117(++_0x55b1a7);}(_0x5898,0x104));var _0x8589=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x5898[_0x1e500e];return _0x10dc5e;};'use strict';var multer=require(_0x8589('0x0'));var util=require(_0x8589('0x1'));var path=require(_0x8589('0x2'));var timeout=require(_0x8589('0x3'));var express=require(_0x8589('0x4'));var router=express[_0x8589('0x5')]();var fs_extra=require(_0x8589('0x6'));var auth=require(_0x8589('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8589('0x8'));var controller=require(_0x8589('0x9'));router['get']('/',auth[_0x8589('0xa')](),controller['index']);router['get'](_0x8589('0xb'),auth['isAuthenticated'](),controller[_0x8589('0xc')]);router[_0x8589('0xd')]('/',auth[_0x8589('0xa')](),controller[_0x8589('0xe')]);router[_0x8589('0xf')](_0x8589('0xb'),auth[_0x8589('0xa')](),controller[_0x8589('0x10')]);router[_0x8589('0x11')](_0x8589('0xb'),auth[_0x8589('0xa')](),controller['destroy']);module[_0x8589('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9e888ad..48c1458 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 _0xa938=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3fbf47,_0x458c91){var _0x1d2ab0=function(_0x17ab2c){while(--_0x17ab2c){_0x3fbf47['push'](_0x3fbf47['shift']());}};_0x1d2ab0(++_0x458c91);}(_0xa938,0x1aa));var _0x8a93=function(_0x3f7f7c,_0x17a477){_0x3f7f7c=_0x3f7f7c-0x0;var _0x245763=_0xa938[_0x3f7f7c];return _0x245763;};'use strict';var Sequelize=require(_0x8a93('0x0'));module[_0x8a93('0x1')]={'type':{'type':Sequelize[_0x8a93('0x2')](_0x8a93('0x3'),_0x8a93('0x4'),_0x8a93('0x5'),_0x8a93('0x6'),_0x8a93('0x7')),'defaultValue':_0x8a93('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8a93('0x2')]('string',_0x8a93('0x4'),_0x8a93('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8a93('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8a93('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a93('0x8')]}}; \ No newline at end of file +var _0x26cc=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x26cc,0x6f));var _0xc26c=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x26cc[_0x39106e];return _0x892aec;};'use strict';var Sequelize=require(_0xc26c('0x0'));module[_0xc26c('0x1')]={'type':{'type':Sequelize[_0xc26c('0x2')](_0xc26c('0x3'),'variable','customVariable',_0xc26c('0x4'),_0xc26c('0x5')),'defaultValue':_0xc26c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc26c('0x6')]},'keyType':{'type':Sequelize[_0xc26c('0x2')](_0xc26c('0x3'),_0xc26c('0x7'),_0xc26c('0x8'))},'keyContent':{'type':Sequelize[_0xc26c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc26c('0x6')]},'customField':{'type':Sequelize[_0xc26c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc26c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 15cbf27..713d291 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 _0xa1f1=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x448737,_0x578ec0){var _0x25d182=function(_0x15ca4d){while(--_0x15ca4d){_0x448737['push'](_0x448737['shift']());}};_0x25d182(++_0x578ec0);}(_0xa1f1,0x7b));var _0x1a1f=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0xa1f1[_0x270a54];return _0x4d07d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a1f('0x0'));var zipdir=require(_0x1a1f('0x1'));var jsonpatch=require(_0x1a1f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1a1f('0x3'));var Mustache=require(_0x1a1f('0x4'));var util=require(_0x1a1f('0x5'));var path=require(_0x1a1f('0x6'));var sox=require(_0x1a1f('0x7'));var csv=require(_0x1a1f('0x8'));var ejs=require(_0x1a1f('0x9'));var fs=require('fs');var fs_extra=require(_0x1a1f('0xa'));var _=require(_0x1a1f('0xb'));var squel=require(_0x1a1f('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a1f('0xd'));var deskjs=require(_0x1a1f('0xe'));var toCsv=require(_0x1a1f('0x8'));var querystring=require('querystring');var Papa=require(_0x1a1f('0xf'));var Redis=require(_0x1a1f('0x10'));var authService=require(_0x1a1f('0x11'));var qs=require(_0x1a1f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a1f('0x13'));var logger=require(_0x1a1f('0x14'))(_0x1a1f('0x15'));var utils=require(_0x1a1f('0x16'));var config=require(_0x1a1f('0x17'));var licenseUtil=require(_0x1a1f('0x18'));var db=require(_0x1a1f('0x19'))['db'];function respondWithStatusCode(_0x51f73b,_0x14d022){_0x14d022=_0x14d022||0xcc;return function(_0x237e82){if(_0x237e82){return _0x51f73b[_0x1a1f('0x1a')](_0x14d022);}return _0x51f73b[_0x1a1f('0x1b')](_0x14d022)[_0x1a1f('0x1c')]();};}function respondWithResult(_0x33f254,_0xb47239){_0xb47239=_0xb47239||0xc8;return function(_0x22c119){if(_0x22c119){return _0x33f254[_0x1a1f('0x1b')](_0xb47239)[_0x1a1f('0x1d')](_0x22c119);}};}function respondWithFilteredResult(_0x5e1eec,_0x3eb7bd){return function(_0x32801a){if(_0x32801a){var _0x4edb94=typeof _0x3eb7bd[_0x1a1f('0x1e')]===_0x1a1f('0x1f')&&typeof _0x3eb7bd[_0x1a1f('0x20')]==='undefined';var _0x5a77c7=_0x32801a[_0x1a1f('0x21')];var _0x44d4b8=_0x4edb94?0x0:_0x3eb7bd['offset'];var _0x65398b=_0x4edb94?_0x32801a[_0x1a1f('0x21')]:_0x3eb7bd['offset']+_0x3eb7bd['limit'];var _0x32f86a;if(_0x65398b>=_0x5a77c7){_0x65398b=_0x5a77c7;_0x32f86a=0xc8;}else{_0x32f86a=0xce;}_0x5e1eec[_0x1a1f('0x1b')](_0x32f86a);return _0x5e1eec[_0x1a1f('0x22')](_0x1a1f('0x23'),_0x44d4b8+'-'+_0x65398b+'/'+_0x5a77c7)['json'](_0x32801a);}return null;};}function patchUpdates(_0x1c7805){return function(_0x3eb20e){try{jsonpatch[_0x1a1f('0x24')](_0x3eb20e,_0x1c7805,!![]);}catch(_0x24f2d0){return BPromise['reject'](_0x24f2d0);}return _0x3eb20e[_0x1a1f('0x25')]();};}function saveUpdates(_0x24e4eb,_0x52e524){return function(_0xe77dcf){if(_0xe77dcf){return _0xe77dcf[_0x1a1f('0x26')](_0x24e4eb)[_0x1a1f('0x27')](function(_0x1dedb2){return _0x1dedb2;});}return null;};}function removeEntity(_0x5dcd68,_0x2fca48){return function(_0x56c4ae){if(_0x56c4ae){return _0x56c4ae[_0x1a1f('0x28')]()[_0x1a1f('0x27')](function(){_0x5dcd68[_0x1a1f('0x1b')](0xcc)[_0x1a1f('0x1c')]();});}};}function handleEntityNotFound(_0x3d0440,_0x11e222){return function(_0x4870e2){if(!_0x4870e2){_0x3d0440[_0x1a1f('0x1a')](0x194);}return _0x4870e2;};}function handleError(_0x16e148,_0xdf2eab){_0xdf2eab=_0xdf2eab||0x1f4;return function(_0x113b77){logger[_0x1a1f('0x29')](_0x113b77[_0x1a1f('0x2a')]);if(_0x113b77['name']){delete _0x113b77['name'];}_0x16e148[_0x1a1f('0x1b')](_0xdf2eab)[_0x1a1f('0x2b')](_0x113b77);};}exports[_0x1a1f('0x2c')]=function(_0x4e1012,_0x27f6cd){var _0x1121dc={},_0x4b46ff={},_0x5a0d96={'count':0x0,'rows':[]};var _0x49ac8=_[_0x1a1f('0x2d')](db[_0x1a1f('0x2e')][_0x1a1f('0x2f')],function(_0x46f627){return{'name':_0x46f627[_0x1a1f('0x30')],'type':_0x46f627['type'][_0x1a1f('0x31')]};});_0x4b46ff[_0x1a1f('0x32')]=_[_0x1a1f('0x2d')](_0x49ac8,_0x1a1f('0x33'));_0x4b46ff['query']=_['keys'](_0x4e1012['query']);_0x4b46ff[_0x1a1f('0x34')]=_[_0x1a1f('0x35')](_0x4b46ff[_0x1a1f('0x32')],_0x4b46ff[_0x1a1f('0x36')]);_0x1121dc[_0x1a1f('0x37')]=_[_0x1a1f('0x35')](_0x4b46ff['model'],qs['fields'](_0x4e1012[_0x1a1f('0x36')][_0x1a1f('0x38')]));_0x1121dc[_0x1a1f('0x37')]=_0x1121dc['attributes'][_0x1a1f('0x39')]?_0x1121dc[_0x1a1f('0x37')]:_0x4b46ff['model'];if(!_0x4e1012['query'][_0x1a1f('0x3a')](_0x1a1f('0x3b'))){_0x1121dc[_0x1a1f('0x20')]=qs[_0x1a1f('0x20')](_0x4e1012[_0x1a1f('0x36')]['limit']);_0x1121dc[_0x1a1f('0x1e')]=qs[_0x1a1f('0x1e')](_0x4e1012[_0x1a1f('0x36')][_0x1a1f('0x1e')]);}_0x1121dc['order']=qs['sort'](_0x4e1012[_0x1a1f('0x36')][_0x1a1f('0x3c')]);_0x1121dc['where']=qs[_0x1a1f('0x34')](_['pick'](_0x4e1012['query'],_0x4b46ff[_0x1a1f('0x34')]),_0x49ac8);if(_0x4e1012[_0x1a1f('0x36')][_0x1a1f('0x3d')]){_0x1121dc[_0x1a1f('0x3e')]=_[_0x1a1f('0x3f')](_0x1121dc['where'],{'$or':_[_0x1a1f('0x2d')](_0x49ac8,function(_0x30190e){if(_0x30190e[_0x1a1f('0x40')]!=='VIRTUAL'){var _0x2cd6e5={};_0x2cd6e5[_0x30190e[_0x1a1f('0x33')]]={'$like':'%'+_0x4e1012[_0x1a1f('0x36')][_0x1a1f('0x3d')]+'%'};return _0x2cd6e5;}})});}_0x1121dc=_[_0x1a1f('0x3f')]({},_0x1121dc,_0x4e1012[_0x1a1f('0x41')]);var _0x4b0cb0={'where':_0x1121dc[_0x1a1f('0x3e')]};return db[_0x1a1f('0x2e')][_0x1a1f('0x21')](_0x4b0cb0)[_0x1a1f('0x27')](function(_0x19936e){_0x5a0d96[_0x1a1f('0x21')]=_0x19936e;if(_0x4e1012['query'][_0x1a1f('0x42')]){_0x1121dc[_0x1a1f('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x1a1f('0x44')](_0x1121dc);})[_0x1a1f('0x27')](function(_0xb2f15){_0x5a0d96[_0x1a1f('0x45')]=_0xb2f15;return _0x5a0d96;})[_0x1a1f('0x27')](respondWithFilteredResult(_0x27f6cd,_0x1121dc))[_0x1a1f('0x46')](handleError(_0x27f6cd,null));};exports['show']=function(_0x5a2f29,_0xa88cc3){var _0x4eaa29={'raw':!![],'where':{'id':_0x5a2f29[_0x1a1f('0x47')]['id']}},_0x5eac3a={};_0x5eac3a[_0x1a1f('0x32')]=_[_0x1a1f('0x48')](db[_0x1a1f('0x2e')][_0x1a1f('0x2f')]);_0x5eac3a[_0x1a1f('0x36')]=_['keys'](_0x5a2f29[_0x1a1f('0x36')]);_0x5eac3a[_0x1a1f('0x34')]=_['intersection'](_0x5eac3a['model'],_0x5eac3a[_0x1a1f('0x36')]);_0x4eaa29[_0x1a1f('0x37')]=_[_0x1a1f('0x35')](_0x5eac3a[_0x1a1f('0x32')],qs[_0x1a1f('0x38')](_0x5a2f29[_0x1a1f('0x36')][_0x1a1f('0x38')]));_0x4eaa29['attributes']=_0x4eaa29['attributes'][_0x1a1f('0x39')]?_0x4eaa29['attributes']:_0x5eac3a[_0x1a1f('0x32')];if(_0x5a2f29[_0x1a1f('0x36')][_0x1a1f('0x42')]){_0x4eaa29['include']=[{'all':!![]}];}_0x4eaa29=_[_0x1a1f('0x3f')]({},_0x4eaa29,_0x5a2f29[_0x1a1f('0x41')]);return db[_0x1a1f('0x2e')][_0x1a1f('0x49')](_0x4eaa29)['then'](handleEntityNotFound(_0xa88cc3,null))[_0x1a1f('0x27')](respondWithResult(_0xa88cc3,null))[_0x1a1f('0x46')](handleError(_0xa88cc3,null));};exports[_0x1a1f('0x4a')]=function(_0xf1d606,_0x506405){return db[_0x1a1f('0x2e')]['create'](_0xf1d606[_0x1a1f('0x4b')],{})[_0x1a1f('0x27')](respondWithResult(_0x506405,0xc9))[_0x1a1f('0x46')](handleError(_0x506405,null));};exports[_0x1a1f('0x26')]=function(_0x450c2f,_0x55e2c3){if(_0x450c2f[_0x1a1f('0x4b')]['id']){delete _0x450c2f[_0x1a1f('0x4b')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x450c2f[_0x1a1f('0x47')]['id']}})['then'](handleEntityNotFound(_0x55e2c3,null))[_0x1a1f('0x27')](saveUpdates(_0x450c2f[_0x1a1f('0x4b')],null))['then'](respondWithResult(_0x55e2c3,null))[_0x1a1f('0x46')](handleError(_0x55e2c3,null));};exports[_0x1a1f('0x28')]=function(_0x1b3fb1,_0xf221ad){return db['ZendeskField'][_0x1a1f('0x49')]({'where':{'id':_0x1b3fb1[_0x1a1f('0x47')]['id']}})[_0x1a1f('0x27')](handleEntityNotFound(_0xf221ad,null))[_0x1a1f('0x27')](removeEntity(_0xf221ad,null))[_0x1a1f('0x46')](handleError(_0xf221ad,null));}; \ No newline at end of file +var _0x780d=['name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','intersection','fields','includeAll','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack'];(function(_0x438f77,_0x8fcc8e){var _0x4692ab=function(_0x37c569){while(--_0x37c569){_0x438f77['push'](_0x438f77['shift']());}};_0x4692ab(++_0x8fcc8e);}(_0x780d,0x10a));var _0xd780=function(_0x8a0ded,_0x2d8141){_0x8a0ded=_0x8a0ded-0x0;var _0x5d56bd=_0x780d[_0x8a0ded];return _0x5d56bd;};'use strict';var emlformat=require(_0xd780('0x0'));var rimraf=require(_0xd780('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd780('0x2'));var rp=require(_0xd780('0x3'));var moment=require(_0xd780('0x4'));var BPromise=require(_0xd780('0x5'));var Mustache=require(_0xd780('0x6'));var util=require(_0xd780('0x7'));var path=require(_0xd780('0x8'));var sox=require(_0xd780('0x9'));var csv=require(_0xd780('0xa'));var ejs=require(_0xd780('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd780('0xc'));var squel=require(_0xd780('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd780('0xe'));var toCsv=require(_0xd780('0xa'));var querystring=require(_0xd780('0xf'));var Papa=require('papaparse');var Redis=require(_0xd780('0x10'));var authService=require(_0xd780('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd780('0x12'));var logger=require(_0xd780('0x13'))('api');var utils=require(_0xd780('0x14'));var config=require(_0xd780('0x15'));var licenseUtil=require(_0xd780('0x16'));var db=require(_0xd780('0x17'))['db'];function respondWithStatusCode(_0xde9558,_0x3b981a){_0x3b981a=_0x3b981a||0xcc;return function(_0x1a15b6){if(_0x1a15b6){return _0xde9558[_0xd780('0x18')](_0x3b981a);}return _0xde9558[_0xd780('0x19')](_0x3b981a)['end']();};}function respondWithResult(_0x5c427e,_0x4ee591){_0x4ee591=_0x4ee591||0xc8;return function(_0x2bfeab){if(_0x2bfeab){return _0x5c427e[_0xd780('0x19')](_0x4ee591)['json'](_0x2bfeab);}};}function respondWithFilteredResult(_0x36ccc3,_0x3e5d64){return function(_0x3e1155){if(_0x3e1155){var _0xed93cd=typeof _0x3e5d64[_0xd780('0x1a')]===_0xd780('0x1b')&&typeof _0x3e5d64[_0xd780('0x1c')]===_0xd780('0x1b');var _0x474dfd=_0x3e1155[_0xd780('0x1d')];var _0x557902=_0xed93cd?0x0:_0x3e5d64[_0xd780('0x1a')];var _0x493c44=_0xed93cd?_0x3e1155[_0xd780('0x1d')]:_0x3e5d64[_0xd780('0x1a')]+_0x3e5d64[_0xd780('0x1c')];var _0x50400a;if(_0x493c44>=_0x474dfd){_0x493c44=_0x474dfd;_0x50400a=0xc8;}else{_0x50400a=0xce;}_0x36ccc3[_0xd780('0x19')](_0x50400a);return _0x36ccc3[_0xd780('0x1e')](_0xd780('0x1f'),_0x557902+'-'+_0x493c44+'/'+_0x474dfd)[_0xd780('0x20')](_0x3e1155);}return null;};}function patchUpdates(_0x21c440){return function(_0x41eaf2){try{jsonpatch[_0xd780('0x21')](_0x41eaf2,_0x21c440,!![]);}catch(_0x29303b){return BPromise[_0xd780('0x22')](_0x29303b);}return _0x41eaf2[_0xd780('0x23')]();};}function saveUpdates(_0x323594,_0x3ba116){return function(_0xc46975){if(_0xc46975){return _0xc46975[_0xd780('0x24')](_0x323594)[_0xd780('0x25')](function(_0x46fc4d){return _0x46fc4d;});}return null;};}function removeEntity(_0x5e717f,_0x30d083){return function(_0x1295a5){if(_0x1295a5){return _0x1295a5[_0xd780('0x26')]()[_0xd780('0x25')](function(){_0x5e717f[_0xd780('0x19')](0xcc)[_0xd780('0x27')]();});}};}function handleEntityNotFound(_0x44f5b9,_0x526796){return function(_0x5d4c1e){if(!_0x5d4c1e){_0x44f5b9[_0xd780('0x18')](0x194);}return _0x5d4c1e;};}function handleError(_0xd4f866,_0x23caa4){_0x23caa4=_0x23caa4||0x1f4;return function(_0x5db004){logger[_0xd780('0x28')](_0x5db004[_0xd780('0x29')]);if(_0x5db004['name']){delete _0x5db004[_0xd780('0x2a')];}_0xd4f866[_0xd780('0x19')](_0x23caa4)[_0xd780('0x2b')](_0x5db004);};}exports[_0xd780('0x2c')]=function(_0x45225e,_0xccd122){var _0xb03d8d={},_0x4fd64a={},_0x26a3b6={'count':0x0,'rows':[]};var _0x19f042=_['map'](db[_0xd780('0x2d')][_0xd780('0x2e')],function(_0x26d6c3){return{'name':_0x26d6c3[_0xd780('0x2f')],'type':_0x26d6c3[_0xd780('0x30')][_0xd780('0x31')]};});_0x4fd64a[_0xd780('0x32')]=_[_0xd780('0x33')](_0x19f042,_0xd780('0x2a'));_0x4fd64a[_0xd780('0x34')]=_[_0xd780('0x35')](_0x45225e[_0xd780('0x34')]);_0x4fd64a[_0xd780('0x36')]=_['intersection'](_0x4fd64a[_0xd780('0x32')],_0x4fd64a[_0xd780('0x34')]);_0xb03d8d[_0xd780('0x37')]=_['intersection'](_0x4fd64a[_0xd780('0x32')],qs['fields'](_0x45225e[_0xd780('0x34')]['fields']));_0xb03d8d[_0xd780('0x37')]=_0xb03d8d[_0xd780('0x37')][_0xd780('0x38')]?_0xb03d8d[_0xd780('0x37')]:_0x4fd64a['model'];if(!_0x45225e[_0xd780('0x34')][_0xd780('0x39')]('nolimit')){_0xb03d8d[_0xd780('0x1c')]=qs[_0xd780('0x1c')](_0x45225e[_0xd780('0x34')][_0xd780('0x1c')]);_0xb03d8d[_0xd780('0x1a')]=qs['offset'](_0x45225e[_0xd780('0x34')][_0xd780('0x1a')]);}_0xb03d8d[_0xd780('0x3a')]=qs[_0xd780('0x3b')](_0x45225e[_0xd780('0x34')]['sort']);_0xb03d8d[_0xd780('0x3c')]=qs[_0xd780('0x36')](_[_0xd780('0x3d')](_0x45225e[_0xd780('0x34')],_0x4fd64a[_0xd780('0x36')]),_0x19f042);if(_0x45225e[_0xd780('0x34')][_0xd780('0x3e')]){_0xb03d8d[_0xd780('0x3c')]=_[_0xd780('0x3f')](_0xb03d8d[_0xd780('0x3c')],{'$or':_[_0xd780('0x33')](_0x19f042,function(_0x424777){if(_0x424777[_0xd780('0x30')]!=='VIRTUAL'){var _0x5d4e4a={};_0x5d4e4a[_0x424777[_0xd780('0x2a')]]={'$like':'%'+_0x45225e['query'][_0xd780('0x3e')]+'%'};return _0x5d4e4a;}})});}_0xb03d8d=_[_0xd780('0x3f')]({},_0xb03d8d,_0x45225e['options']);var _0x21f716={'where':_0xb03d8d[_0xd780('0x3c')]};return db[_0xd780('0x2d')]['count'](_0x21f716)[_0xd780('0x25')](function(_0xaefe81){_0x26a3b6[_0xd780('0x1d')]=_0xaefe81;if(_0x45225e[_0xd780('0x34')]['includeAll']){_0xb03d8d[_0xd780('0x40')]=[{'all':!![]}];}return db[_0xd780('0x2d')][_0xd780('0x41')](_0xb03d8d);})['then'](function(_0x322c79){_0x26a3b6[_0xd780('0x42')]=_0x322c79;return _0x26a3b6;})[_0xd780('0x25')](respondWithFilteredResult(_0xccd122,_0xb03d8d))['catch'](handleError(_0xccd122,null));};exports[_0xd780('0x43')]=function(_0x2ed574,_0x14e6eb){var _0x21906f={'raw':!![],'where':{'id':_0x2ed574[_0xd780('0x44')]['id']}},_0x1953dc={};_0x1953dc['model']=_['keys'](db[_0xd780('0x2d')]['rawAttributes']);_0x1953dc[_0xd780('0x34')]=_[_0xd780('0x35')](_0x2ed574[_0xd780('0x34')]);_0x1953dc[_0xd780('0x36')]=_['intersection'](_0x1953dc[_0xd780('0x32')],_0x1953dc[_0xd780('0x34')]);_0x21906f[_0xd780('0x37')]=_[_0xd780('0x45')](_0x1953dc[_0xd780('0x32')],qs[_0xd780('0x46')](_0x2ed574[_0xd780('0x34')][_0xd780('0x46')]));_0x21906f[_0xd780('0x37')]=_0x21906f[_0xd780('0x37')][_0xd780('0x38')]?_0x21906f[_0xd780('0x37')]:_0x1953dc['model'];if(_0x2ed574['query'][_0xd780('0x47')]){_0x21906f['include']=[{'all':!![]}];}_0x21906f=_[_0xd780('0x3f')]({},_0x21906f,_0x2ed574[_0xd780('0x48')]);return db[_0xd780('0x2d')][_0xd780('0x49')](_0x21906f)['then'](handleEntityNotFound(_0x14e6eb,null))[_0xd780('0x25')](respondWithResult(_0x14e6eb,null))[_0xd780('0x4a')](handleError(_0x14e6eb,null));};exports[_0xd780('0x4b')]=function(_0x53381c,_0x112b23){return db[_0xd780('0x2d')][_0xd780('0x4b')](_0x53381c[_0xd780('0x4c')],{})['then'](respondWithResult(_0x112b23,0xc9))[_0xd780('0x4a')](handleError(_0x112b23,null));};exports[_0xd780('0x24')]=function(_0x23799e,_0x121cb2){if(_0x23799e[_0xd780('0x4c')]['id']){delete _0x23799e[_0xd780('0x4c')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x23799e[_0xd780('0x44')]['id']}})[_0xd780('0x25')](handleEntityNotFound(_0x121cb2,null))[_0xd780('0x25')](saveUpdates(_0x23799e[_0xd780('0x4c')],null))['then'](respondWithResult(_0x121cb2,null))['catch'](handleError(_0x121cb2,null));};exports['destroy']=function(_0xc9a622,_0x3c7d01){return db['ZendeskField']['find']({'where':{'id':_0xc9a622[_0xd780('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c7d01,null))[_0xd780('0x25')](removeEntity(_0x3c7d01,null))['catch'](handleError(_0x3c7d01,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2f4f8d0..ec1aed0 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 _0x49e8=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x49e8,0x163));var _0x849e=function(_0x50ad95,_0x530cfe){_0x50ad95=_0x50ad95-0x0;var _0xfc94ee=_0x49e8[_0x50ad95];return _0xfc94ee;};'use strict';var _=require(_0x849e('0x0'));var util=require(_0x849e('0x1'));var logger=require('../../config/logger')(_0x849e('0x2'));var moment=require(_0x849e('0x3'));var BPromise=require('bluebird');var rp=require(_0x849e('0x4'));var fs=require('fs');var path=require(_0x849e('0x5'));var rimraf=require(_0x849e('0x6'));var config=require(_0x849e('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x17d21d,_0x4bb589){return _0x17d21d[_0x849e('0x8')](_0x849e('0x9'),attributes,{'tableName':_0x849e('0xa'),'paranoid':![],'indexes':[{'name':_0x849e('0xb'),'fields':[_0x849e('0xc'),_0x849e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff58=['rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','api','moment','request-promise','path'];(function(_0x2b857a,_0x181b69){var _0x28bf03=function(_0x24611c){while(--_0x24611c){_0x2b857a['push'](_0x2b857a['shift']());}};_0x28bf03(++_0x181b69);}(_0xff58,0x162));var _0x8ff5=function(_0x4f1a18,_0x5e26cd){_0x4f1a18=_0x4f1a18-0x0;var _0x158bd7=_0xff58[_0x4f1a18];return _0x158bd7;};'use strict';var _=require(_0x8ff5('0x0'));var util=require(_0x8ff5('0x1'));var logger=require('../../config/logger')(_0x8ff5('0x2'));var moment=require(_0x8ff5('0x3'));var BPromise=require('bluebird');var rp=require(_0x8ff5('0x4'));var fs=require('fs');var path=require(_0x8ff5('0x5'));var rimraf=require(_0x8ff5('0x6'));var config=require(_0x8ff5('0x7'));var attributes=require(_0x8ff5('0x8'));module[_0x8ff5('0x9')]=function(_0x14dd5f,_0x754dd0){return _0x14dd5f[_0x8ff5('0xa')](_0x8ff5('0xb'),attributes,{'tableName':_0x8ff5('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x8ff5('0xd'),_0x8ff5('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 54ed6e9..5ea4fb7 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 _0x65ea=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x65ea,0xe6));var _0xa65e=function(_0x32e5e0,_0x1d94cc){_0x32e5e0=_0x32e5e0-0x0;var _0x5e5f6f=_0x65ea[_0x32e5e0];return _0x5e5f6f;};'use strict';var _=require(_0xa65e('0x0'));var util=require(_0xa65e('0x1'));var moment=require(_0xa65e('0x2'));var BPromise=require(_0xa65e('0x3'));var rs=require(_0xa65e('0x4'));var fs=require('fs');var Redis=require(_0xa65e('0x5'));var db=require(_0xa65e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa65e('0x7'))(_0xa65e('0x8'));var config=require(_0xa65e('0x9'));var jayson=require(_0xa65e('0xa'));var client=jayson['client'][_0xa65e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409ac9,_0x4409c2,_0x305b60){return new BPromise(function(_0x111770,_0x1ae995){return client['request'](_0x409ac9,_0x305b60)[_0xa65e('0xc')](function(_0x498162){logger[_0xa65e('0xd')](_0xa65e('0xe'),_0x4409c2,_0xa65e('0xf'));logger['debug'](_0xa65e('0x10'),_0x4409c2,_0xa65e('0xf'),JSON[_0xa65e('0x11')](_0x498162));if(_0x498162['error']){if(_0x498162[_0xa65e('0x12')]['code']===0x1f4){logger[_0xa65e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4409c2,_0x498162['error'][_0xa65e('0x13')]);return _0x1ae995(_0x498162[_0xa65e('0x12')][_0xa65e('0x13')]);}logger[_0xa65e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4409c2,_0x498162[_0xa65e('0x12')]['message']);return _0x111770(_0x498162[_0xa65e('0x12')]['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x4409c2,'request\x20sent');_0x111770(_0x498162['result']['message']);}})[_0xa65e('0x14')](function(_0x40a244){logger['error'](_0xa65e('0xe'),_0x4409c2,_0x40a244);_0x1ae995(_0x40a244);});});} \ No newline at end of file +var _0xf6be=['ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b9712,_0x2bdb48){var _0x5cd718=function(_0x32b2bc){while(--_0x32b2bc){_0x2b9712['push'](_0x2b9712['shift']());}};_0x5cd718(++_0x2bdb48);}(_0xf6be,0xcd));var _0xef6b=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xf6be[_0x507403];return _0x1327c;};'use strict';var _=require(_0xef6b('0x0'));var util=require(_0xef6b('0x1'));var moment=require(_0xef6b('0x2'));var BPromise=require(_0xef6b('0x3'));var rs=require(_0xef6b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef6b('0x5'));var logger=require(_0xef6b('0x6'))('rpc');var config=require(_0xef6b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xef6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180e20,_0x592970,_0x1cf3d5){return new BPromise(function(_0x16f5be,_0x30b1d6){return client[_0xef6b('0x9')](_0x180e20,_0x1cf3d5)[_0xef6b('0xa')](function(_0x42c572){logger[_0xef6b('0xb')](_0xef6b('0xc'),_0x592970,_0xef6b('0xd'));logger[_0xef6b('0xe')](_0xef6b('0xf'),_0x592970,'request\x20sent',JSON['stringify'](_0x42c572));if(_0x42c572[_0xef6b('0x10')]){if(_0x42c572[_0xef6b('0x10')][_0xef6b('0x11')]===0x1f4){logger[_0xef6b('0x10')]('ZendeskField,\x20%s,\x20%s',_0x592970,_0x42c572[_0xef6b('0x10')][_0xef6b('0x12')]);return _0x30b1d6(_0x42c572[_0xef6b('0x10')][_0xef6b('0x12')]);}logger[_0xef6b('0x10')](_0xef6b('0xc'),_0x592970,_0x42c572['error'][_0xef6b('0x12')]);return _0x16f5be(_0x42c572[_0xef6b('0x10')][_0xef6b('0x12')]);}else{logger[_0xef6b('0xb')](_0xef6b('0xc'),_0x592970,_0xef6b('0xd'));_0x16f5be(_0x42c572['result']['message']);}})[_0xef6b('0x13')](function(_0x12a804){logger[_0xef6b('0x10')](_0xef6b('0xc'),_0x592970,_0x12a804);_0x30b1d6(_0x12a804);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 7a5534c..00c0502 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 _0x3fb9=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x18092a,_0x345d83){var _0x40e368=function(_0xedcadb){while(--_0xedcadb){_0x18092a['push'](_0x18092a['shift']());}};_0x40e368(++_0x345d83);}(_0x3fb9,0xae));var _0x93fb=function(_0x17772e,_0x28c42a){_0x17772e=_0x17772e-0x0;var _0x238bb8=_0x3fb9[_0x17772e];return _0x238bb8;};'use strict';var multer=require(_0x93fb('0x0'));var util=require(_0x93fb('0x1'));var path=require(_0x93fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x93fb('0x3'));var router=express[_0x93fb('0x4')]();var fs_extra=require(_0x93fb('0x5'));var auth=require(_0x93fb('0x6'));var interaction=require(_0x93fb('0x7'));var config=require(_0x93fb('0x8'));var controller=require(_0x93fb('0x9'));router[_0x93fb('0xa')]('/',auth[_0x93fb('0xb')](),controller[_0x93fb('0xc')]);router[_0x93fb('0xa')](_0x93fb('0xd'),auth['isAuthenticated'](),controller[_0x93fb('0xe')]);router[_0x93fb('0xa')](_0x93fb('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x93fb('0xa')](_0x93fb('0x10'),auth[_0x93fb('0xb')](),controller[_0x93fb('0x11')]);router[_0x93fb('0x12')]('/',auth['isAuthenticated'](),controller[_0x93fb('0x13')]);router[_0x93fb('0x12')](_0x93fb('0xf'),auth[_0x93fb('0xb')](),controller['addConfiguration']);router[_0x93fb('0x14')](_0x93fb('0xd'),auth[_0x93fb('0xb')](),controller[_0x93fb('0x15')]);router['delete']('/:id',auth[_0x93fb('0xb')](),controller['destroy']);module[_0x93fb('0x16')]=router; \ No newline at end of file +var _0x591d=['create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','show','get','getFields','post'];(function(_0x5aff92,_0x30d48f){var _0x341b1f=function(_0x12bd0c){while(--_0x12bd0c){_0x5aff92['push'](_0x5aff92['shift']());}};_0x341b1f(++_0x30d48f);}(_0x591d,0x1eb));var _0xd591=function(_0x2a910b,_0x55652f){_0x2a910b=_0x2a910b-0x0;var _0x50c4ff=_0x591d[_0x2a910b];return _0x50c4ff;};'use strict';var multer=require(_0xd591('0x0'));var util=require('util');var path=require(_0xd591('0x1'));var timeout=require(_0xd591('0x2'));var express=require('express');var router=express[_0xd591('0x3')]();var fs_extra=require(_0xd591('0x4'));var auth=require(_0xd591('0x5'));var interaction=require(_0xd591('0x6'));var config=require(_0xd591('0x7'));var controller=require(_0xd591('0x8'));router['get']('/',auth[_0xd591('0x9')](),controller[_0xd591('0xa')]);router['get']('/:id',auth[_0xd591('0x9')](),controller[_0xd591('0xb')]);router[_0xd591('0xc')]('/:id/configurations',auth[_0xd591('0x9')](),controller['getConfigurations']);router[_0xd591('0xc')]('/:id/fields',auth[_0xd591('0x9')](),controller[_0xd591('0xd')]);router[_0xd591('0xe')]('/',auth[_0xd591('0x9')](),controller[_0xd591('0xf')]);router[_0xd591('0xe')](_0xd591('0x10'),auth['isAuthenticated'](),controller[_0xd591('0x11')]);router[_0xd591('0x12')](_0xd591('0x13'),auth[_0xd591('0x9')](),controller[_0xd591('0x14')]);router[_0xd591('0x15')](_0xd591('0x13'),auth[_0xd591('0x9')](),controller[_0xd591('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5b293d2..8b7d956 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 _0xa9e0=['sequelize','exports','STRING'];(function(_0x30099e,_0x1ee4b2){var _0x474f63=function(_0x26f35a){while(--_0x26f35a){_0x30099e['push'](_0x30099e['shift']());}};_0x474f63(++_0x1ee4b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0x41bb=['exports','STRING','sequelize'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x41bb,0xc5));var _0xb41b=function(_0x4826d5,_0x4e8f97){_0x4826d5=_0x4826d5-0x0;var _0x5abdb8=_0x41bb[_0x4826d5];return _0x5abdb8;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb41b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb41b('0x2')]},'clientId':{'type':Sequelize[_0xb41b('0x2')]},'clientSecret':{'type':Sequelize[_0xb41b('0x2')]},'serverUrl':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f52cd2c..80eaf51 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 _0xfa80=['Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','serverUrl','code','host','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','error','message','Subject','Description','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','ZohoAccount','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','Subjects','channel'];(function(_0x4e7dfb,_0x41b8f4){var _0x5053e7=function(_0x165ba0){while(--_0x165ba0){_0x4e7dfb['push'](_0x4e7dfb['shift']());}};_0x5053e7(++_0x41b8f4);}(_0xfa80,0xa4));var _0x0fa8=function(_0x43b9e6,_0x22e77d){_0x43b9e6=_0x43b9e6-0x0;var _0x10614d=_0xfa80[_0x43b9e6];return _0x10614d;};'use strict';var emlformat=require(_0x0fa8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0fa8('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x0fa8('0x2'));var util=require(_0x0fa8('0x3'));var path=require(_0x0fa8('0x4'));var sox=require(_0x0fa8('0x5'));var csv=require(_0x0fa8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fa8('0x7'));var squel=require(_0x0fa8('0x8'));var crypto=require(_0x0fa8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0fa8('0xa'));var toCsv=require(_0x0fa8('0x6'));var querystring=require(_0x0fa8('0xb'));var Papa=require(_0x0fa8('0xc'));var Redis=require(_0x0fa8('0xd'));var authService=require(_0x0fa8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0fa8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fa8('0x10'))(_0x0fa8('0x11'));var utils=require(_0x0fa8('0x12'));var config=require(_0x0fa8('0x13'));var licenseUtil=require(_0x0fa8('0x14'));var db=require(_0x0fa8('0x15'))['db'];var integrations=require(_0x0fa8('0x16'));function respondWithStatusCode(_0x2a7c76,_0x520932){_0x520932=_0x520932||0xcc;return function(_0x3fa159){if(_0x3fa159){return _0x2a7c76[_0x0fa8('0x17')](_0x520932);}return _0x2a7c76[_0x0fa8('0x18')](_0x520932)[_0x0fa8('0x19')]();};}function respondWithResult(_0x2fde6f,_0x774d17){_0x774d17=_0x774d17||0xc8;return function(_0x13c2ac){if(_0x13c2ac){return _0x2fde6f[_0x0fa8('0x18')](_0x774d17)[_0x0fa8('0x1a')](_0x13c2ac);}};}function respondWithFilteredResult(_0x1892e5,_0x38edb9){return function(_0x4cff8d){if(_0x4cff8d){var _0x383837=typeof _0x38edb9[_0x0fa8('0x1b')]==='undefined'&&typeof _0x38edb9['limit']==='undefined';var _0x46878c=_0x4cff8d[_0x0fa8('0x1c')];var _0x284944=_0x383837?0x0:_0x38edb9[_0x0fa8('0x1b')];var _0x5a758f=_0x383837?_0x4cff8d[_0x0fa8('0x1c')]:_0x38edb9[_0x0fa8('0x1b')]+_0x38edb9[_0x0fa8('0x1d')];var _0x3ab1c7;if(_0x5a758f>=_0x46878c){_0x5a758f=_0x46878c;_0x3ab1c7=0xc8;}else{_0x3ab1c7=0xce;}_0x1892e5[_0x0fa8('0x18')](_0x3ab1c7);return _0x1892e5[_0x0fa8('0x1e')](_0x0fa8('0x1f'),_0x284944+'-'+_0x5a758f+'/'+_0x46878c)['json'](_0x4cff8d);}return null;};}function patchUpdates(_0x204aeb){return function(_0x1ab510){try{jsonpatch[_0x0fa8('0x20')](_0x1ab510,_0x204aeb,!![]);}catch(_0x1de0d1){return BPromise[_0x0fa8('0x21')](_0x1de0d1);}return _0x1ab510[_0x0fa8('0x22')]();};}function saveUpdates(_0x1e03ef,_0xa52854){return function(_0xd83a96){if(_0xd83a96){return _0xd83a96['update'](_0x1e03ef)[_0x0fa8('0x23')](function(_0x38ebd5){return _0x38ebd5;});}return null;};}function removeEntity(_0x1b1ff9,_0x27f369){return function(_0x2954f0){if(_0x2954f0){return _0x2954f0[_0x0fa8('0x24')]()[_0x0fa8('0x23')](function(){_0x1b1ff9[_0x0fa8('0x18')](0xcc)[_0x0fa8('0x19')]();});}};}function handleEntityNotFound(_0x3d7880,_0x539cc4){return function(_0x74029a){if(!_0x74029a){_0x3d7880[_0x0fa8('0x17')](0x194);}return _0x74029a;};}function handleError(_0x17bc58,_0x57660f){_0x57660f=_0x57660f||0x1f4;return function(_0xd90e2a){logger['error'](_0xd90e2a['stack']);if(_0xd90e2a[_0x0fa8('0x25')]){delete _0xd90e2a[_0x0fa8('0x25')];}_0x17bc58[_0x0fa8('0x18')](_0x57660f)[_0x0fa8('0x26')](_0xd90e2a);};}exports[_0x0fa8('0x27')]=function(_0x37b241,_0x1f4d6d){var _0x192db9={},_0x2b7b9c={},_0x16ffb3={'count':0x0,'rows':[]};var _0x34aa11=_[_0x0fa8('0x28')](db['ZohoAccount'][_0x0fa8('0x29')],function(_0xfdcdba){return{'name':_0xfdcdba[_0x0fa8('0x2a')],'type':_0xfdcdba['type'][_0x0fa8('0x2b')]};});_0x2b7b9c[_0x0fa8('0x2c')]=_[_0x0fa8('0x28')](_0x34aa11,_0x0fa8('0x25'));_0x2b7b9c['query']=_[_0x0fa8('0x2d')](_0x37b241['query']);_0x2b7b9c[_0x0fa8('0x2e')]=_[_0x0fa8('0x2f')](_0x2b7b9c[_0x0fa8('0x2c')],_0x2b7b9c[_0x0fa8('0x30')]);_0x192db9['attributes']=_[_0x0fa8('0x2f')](_0x2b7b9c[_0x0fa8('0x2c')],qs['fields'](_0x37b241[_0x0fa8('0x30')][_0x0fa8('0x31')]));_0x192db9[_0x0fa8('0x32')]=_0x192db9[_0x0fa8('0x32')][_0x0fa8('0x33')]?_0x192db9['attributes']:_0x2b7b9c[_0x0fa8('0x2c')];if(!_0x37b241[_0x0fa8('0x30')][_0x0fa8('0x34')]('nolimit')){_0x192db9[_0x0fa8('0x1d')]=qs[_0x0fa8('0x1d')](_0x37b241[_0x0fa8('0x30')][_0x0fa8('0x1d')]);_0x192db9['offset']=qs[_0x0fa8('0x1b')](_0x37b241['query']['offset']);}_0x192db9[_0x0fa8('0x35')]=qs[_0x0fa8('0x36')](_0x37b241[_0x0fa8('0x30')][_0x0fa8('0x36')]);_0x192db9[_0x0fa8('0x37')]=qs['filters'](_[_0x0fa8('0x38')](_0x37b241['query'],_0x2b7b9c[_0x0fa8('0x2e')]),_0x34aa11);if(_0x37b241['query'][_0x0fa8('0x39')]){_0x192db9['where']=_[_0x0fa8('0x3a')](_0x192db9[_0x0fa8('0x37')],{'$or':_[_0x0fa8('0x28')](_0x34aa11,function(_0x5c08da){if(_0x5c08da[_0x0fa8('0x3b')]!=='VIRTUAL'){var _0x4e0d1a={};_0x4e0d1a[_0x5c08da[_0x0fa8('0x25')]]={'$like':'%'+_0x37b241[_0x0fa8('0x30')][_0x0fa8('0x39')]+'%'};return _0x4e0d1a;}})});}_0x192db9=_[_0x0fa8('0x3a')]({},_0x192db9,_0x37b241[_0x0fa8('0x3c')]);var _0x8acb3e={'where':_0x192db9['where']};return db[_0x0fa8('0x3d')][_0x0fa8('0x1c')](_0x8acb3e)[_0x0fa8('0x23')](function(_0x2c4823){_0x16ffb3[_0x0fa8('0x1c')]=_0x2c4823;if(_0x37b241[_0x0fa8('0x30')][_0x0fa8('0x3e')]){_0x192db9['include']=[{'all':!![]}];}return db[_0x0fa8('0x3d')][_0x0fa8('0x3f')](_0x192db9);})[_0x0fa8('0x23')](function(_0x603c87){_0x16ffb3[_0x0fa8('0x40')]=_0x603c87;return _0x16ffb3;})[_0x0fa8('0x23')](respondWithFilteredResult(_0x1f4d6d,_0x192db9))[_0x0fa8('0x41')](handleError(_0x1f4d6d,null));};exports[_0x0fa8('0x42')]=function(_0x1eef4e,_0x36805f){var _0x123b6f={'raw':![],'where':{'id':_0x1eef4e[_0x0fa8('0x43')]['id']}},_0x2e4428={};_0x2e4428['model']=_[_0x0fa8('0x2d')](db[_0x0fa8('0x3d')][_0x0fa8('0x29')]);_0x2e4428[_0x0fa8('0x30')]=_[_0x0fa8('0x2d')](_0x1eef4e[_0x0fa8('0x30')]);_0x2e4428[_0x0fa8('0x2e')]=_[_0x0fa8('0x2f')](_0x2e4428[_0x0fa8('0x2c')],_0x2e4428[_0x0fa8('0x30')]);_0x123b6f[_0x0fa8('0x32')]=_['intersection'](_0x2e4428[_0x0fa8('0x2c')],qs['fields'](_0x1eef4e['query'][_0x0fa8('0x31')]));_0x123b6f[_0x0fa8('0x32')]=_0x123b6f[_0x0fa8('0x32')]['length']?_0x123b6f[_0x0fa8('0x32')]:_0x2e4428['model'];if(_0x1eef4e[_0x0fa8('0x30')]['includeAll']){_0x123b6f[_0x0fa8('0x44')]=[{'all':!![]}];}_0x123b6f=_[_0x0fa8('0x3a')]({},_0x123b6f,_0x1eef4e[_0x0fa8('0x3c')]);return db[_0x0fa8('0x3d')][_0x0fa8('0x45')](_0x123b6f)['then'](handleEntityNotFound(_0x36805f,null))[_0x0fa8('0x23')](respondWithResult(_0x36805f,null))[_0x0fa8('0x41')](handleError(_0x36805f,null));};exports['create']=function(_0x5ee0bd,_0x474833){return db['ZohoAccount'][_0x0fa8('0x46')](_0x5ee0bd[_0x0fa8('0x47')],{})['then'](respondWithResult(_0x474833,0xc9))[_0x0fa8('0x41')](handleError(_0x474833,null));};exports[_0x0fa8('0x48')]=function(_0x4a6bb2,_0x29a219){if(_0x4a6bb2[_0x0fa8('0x47')]['id']){delete _0x4a6bb2['body']['id'];}return db[_0x0fa8('0x3d')][_0x0fa8('0x45')]({'where':{'id':_0x4a6bb2[_0x0fa8('0x43')]['id']}})['then'](handleEntityNotFound(_0x29a219,null))[_0x0fa8('0x23')](saveUpdates(_0x4a6bb2[_0x0fa8('0x47')],null))[_0x0fa8('0x23')](respondWithResult(_0x29a219,null))[_0x0fa8('0x41')](handleError(_0x29a219,null));};exports[_0x0fa8('0x24')]=function(_0x2846bc,_0x74f72f){return db[_0x0fa8('0x3d')][_0x0fa8('0x45')]({'where':{'id':_0x2846bc[_0x0fa8('0x43')]['id']}})['then'](handleEntityNotFound(_0x74f72f,null))[_0x0fa8('0x23')](removeEntity(_0x74f72f,null))[_0x0fa8('0x41')](handleError(_0x74f72f,null));};exports[_0x0fa8('0x49')]=function(_0x14e6c4,_0x3d0448,_0x4f4dab){var _0x5ea244={};var _0x56c710={};var _0x32a8ee;var _0x23032e;return db['ZohoAccount'][_0x0fa8('0x4a')]({'where':{'id':_0x14e6c4['params']['id']}})[_0x0fa8('0x23')](handleEntityNotFound(_0x3d0448,null))[_0x0fa8('0x23')](function(_0x5383c6){if(_0x5383c6){_0x32a8ee=_0x5383c6;_0x56c710[_0x0fa8('0x2c')]=_['keys'](db[_0x0fa8('0x4b')][_0x0fa8('0x29')]);_0x56c710[_0x0fa8('0x30')]=_[_0x0fa8('0x2d')](_0x14e6c4[_0x0fa8('0x30')]);_0x56c710[_0x0fa8('0x2e')]=_[_0x0fa8('0x2f')](_0x56c710[_0x0fa8('0x2c')],_0x56c710[_0x0fa8('0x30')]);_0x5ea244['attributes']=_[_0x0fa8('0x2f')](_0x56c710[_0x0fa8('0x2c')],qs[_0x0fa8('0x31')](_0x14e6c4[_0x0fa8('0x30')][_0x0fa8('0x31')]));_0x5ea244[_0x0fa8('0x32')]=_0x5ea244[_0x0fa8('0x32')][_0x0fa8('0x33')]?_0x5ea244['attributes']:_0x56c710[_0x0fa8('0x2c')];_0x5ea244['order']=qs[_0x0fa8('0x36')](_0x14e6c4[_0x0fa8('0x30')][_0x0fa8('0x36')]);_0x5ea244[_0x0fa8('0x37')]=qs[_0x0fa8('0x2e')](_[_0x0fa8('0x38')](_0x14e6c4[_0x0fa8('0x30')],_0x56c710[_0x0fa8('0x2e')]));if(_0x14e6c4[_0x0fa8('0x30')][_0x0fa8('0x39')]){_0x5ea244['where']=_[_0x0fa8('0x3a')](_0x5ea244[_0x0fa8('0x37')],{'$or':_[_0x0fa8('0x28')](_0x5ea244['attributes'],function(_0x20a78a){var _0x2cac9a={};_0x2cac9a[_0x20a78a]={'$like':'%'+_0x14e6c4['query'][_0x0fa8('0x39')]+'%'};return _0x2cac9a;})});}_0x5ea244=_[_0x0fa8('0x3a')]({},_0x5ea244,_0x14e6c4[_0x0fa8('0x3c')]);return _0x32a8ee[_0x0fa8('0x49')](_0x5ea244);}})[_0x0fa8('0x23')](function(_0x3cb132){if(_0x3cb132){_0x23032e=_0x3cb132['length'];if(!_0x14e6c4['query']['hasOwnProperty'](_0x0fa8('0x4c'))){_0x5ea244['limit']=qs[_0x0fa8('0x1d')](_0x14e6c4[_0x0fa8('0x30')][_0x0fa8('0x1d')]);_0x5ea244[_0x0fa8('0x1b')]=qs['offset'](_0x14e6c4[_0x0fa8('0x30')][_0x0fa8('0x1b')]);}return _0x32a8ee['getConfigurations'](_0x5ea244);}})[_0x0fa8('0x23')](function(_0xfa3f2b){if(_0xfa3f2b){return _0xfa3f2b?{'count':_0x23032e,'rows':_0xfa3f2b}:null;}})[_0x0fa8('0x23')](respondWithResult(_0x3d0448,null))[_0x0fa8('0x41')](handleError(_0x3d0448,null));};exports[_0x0fa8('0x4d')]=function(_0x4ae12b,_0x5ca63b,_0x22d5ce){if(_0x4ae12b[_0x0fa8('0x47')]['id']){delete _0x4ae12b[_0x0fa8('0x47')]['id'];}return db[_0x0fa8('0x3d')][_0x0fa8('0x4a')]({'where':{'id':_0x4ae12b[_0x0fa8('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ca63b,null))[_0x0fa8('0x23')](function(_0x2dd50b){if(_0x2dd50b){_0x4ae12b[_0x0fa8('0x47')]['AccountId']=_0x2dd50b['id'];_0x4ae12b['body'][_0x0fa8('0x4e')]=integrations['getSubjects'](_0x4ae12b['body'][_0x0fa8('0x4f')],_0x4ae12b['body']['type']);_0x4ae12b[_0x0fa8('0x47')][_0x0fa8('0x50')]=integrations['getDescriptions'](_0x4ae12b[_0x0fa8('0x47')][_0x0fa8('0x4f')],_0x4ae12b[_0x0fa8('0x47')][_0x0fa8('0x3b')]);return db[_0x0fa8('0x4b')][_0x0fa8('0x46')](_0x4ae12b[_0x0fa8('0x47')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x0fa8('0x51')],'as':'Descriptions'}]});}return null;})[_0x0fa8('0x23')](respondWithResult(_0x5ca63b,null))[_0x0fa8('0x41')](handleError(_0x5ca63b,null));};function getAccessToken(_0x1d222d){return new Promise(function(_0x1af620,_0xddb6d3){var _0x221e14;switch(_0x1d222d[_0x0fa8('0x52')]){case'US':_0x221e14=_0x0fa8('0x53');break;case'AU':_0x221e14=_0x0fa8('0x54');break;case'EU':_0x221e14=_0x0fa8('0x55');break;case'IN':_0x221e14=_0x0fa8('0x56');break;case'CN':_0x221e14=_0x0fa8('0x57');break;default:_0x221e14=_0x0fa8('0x55');break;}var _0x55a73f={'method':_0x0fa8('0x58'),'uri':_0x221e14+_0x0fa8('0x59'),'qs':{'refresh_token':_0x1d222d[_0x0fa8('0x5a')],'client_id':_0x1d222d[_0x0fa8('0x5b')],'client_secret':_0x1d222d['clientSecret'],'grant_type':_0x0fa8('0x5c')},'json':!![]};return rp(_0x55a73f)['then'](function(_0x3d1e74){if(_0x3d1e74[_0x0fa8('0x5d')]){_0x1af620(_0x3d1e74[_0x0fa8('0x5d')]);}else{_0xddb6d3('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x0fa8('0x41')](function(_0x53a912){_0xddb6d3(_0x53a912);});});}exports[_0x0fa8('0x5e')]=function(_0x5af946,_0x363cb2,_0x52d0f7){var _0x1e9cae,_0xb56c16,_0x1652a4,_0x511f16,_0x7058a4;return db['ZohoAccount'][_0x0fa8('0x4a')]({'where':{'id':_0x5af946['params']['id']},'attributes':['id','host','zone',_0x0fa8('0x5b'),'clientSecret',_0x0fa8('0x5f'),_0x0fa8('0x60'),_0x0fa8('0x5a')]})['then'](handleEntityNotFound(_0x363cb2,null))[_0x0fa8('0x23')](function(_0x4ab2bc){_0x7058a4=_0x4ab2bc;_0x1e9cae=_0x7058a4[_0x0fa8('0x61')];_0xb56c16=_0x1e9cae===_0x0fa8('0x62')?'eu':'com';_0x1652a4=_0x7058a4[_0x0fa8('0x5f')];var _0x7e5671=_0x1652a4[_0x0fa8('0x63')](-0x1);if(_0x7e5671==='/'||_0x7e5671==='\x5c'||_0x7e5671===':'){_0x1652a4=_0x1652a4['substring'](0x0,_0x1652a4[_0x0fa8('0x64')](_0x7e5671));}if(!_0x7058a4[_0x0fa8('0x5a')]){throw new Error(_0x0fa8('0x65'));}return getAccessToken(_0x7058a4);})[_0x0fa8('0x23')](function(_0x24daa4){if(_0x24daa4){return rp({'method':'GET','uri':util['format'](_0x0fa8('0x66'),_0xb56c16),'qs':{'module':_0x0fa8('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x24daa4},'json':!![]});}})[_0x0fa8('0x23')](function(_0x4cc013){if(_0x4cc013){if(_0x4cc013[_0x0fa8('0x68')]&&_0x4cc013['response'][_0x0fa8('0x69')]){throw new Error(_0x4cc013['response']['error'][_0x0fa8('0x6a')]);}var _0x2decfd=[];var _0x4f46af=[];var _0x28cc73=['Owner',_0x0fa8('0x6b'),_0x0fa8('0x6c'),'WhoId',_0x0fa8('0x6d'),_0x0fa8('0x6e'),'Call_Start_Time',_0x0fa8('0x6f')];_0x4f46af=_[_0x0fa8('0x70')](_0x4cc013['fields'],function(_0x29e2fe){return _0x28cc73['includes'](_0x29e2fe[_0x0fa8('0x71')]);});for(var _0x448279=0x0;_0x448279<_0x4f46af[_0x0fa8('0x33')];_0x448279++){if(_0x4f46af[_0x448279][_0x0fa8('0x72')]===![]){_0x2decfd[_0x0fa8('0x73')]({'id':_0x4f46af[_0x448279]['id'],'name':_0x4f46af[_0x448279]['display_label'],'custom':_0x4f46af[_0x448279]['custom_field'],'options':_0x4f46af[_0x448279][_0x0fa8('0x74')]==='picklist'&&_0x4f46af[_0x448279][_0x0fa8('0x75')][_0x0fa8('0x33')]>-0x1?_[_0x0fa8('0x28')](_0x4f46af[_0x448279][_0x0fa8('0x75')],function(_0xb73304){return{'name':_0xb73304,'value':_0xb73304};}):[]});}}return{'count':_0x2decfd[_0x0fa8('0x33')],'rows':_0x2decfd};}else{return{'count':0x0,'rows':[]};}})[_0x0fa8('0x23')](respondWithResult(_0x363cb2,null))[_0x0fa8('0x41')](function(_0xccd039){var _0x359d6c=_0x5af946[_0x0fa8('0x30')][_0x0fa8('0x76')]?0x1f4:_0xccd039['statusCode']||0x1f4;logger[_0x0fa8('0x69')](_0x0fa8('0x77'),_0x0fa8('0x5e'),_0x359d6c,JSON['stringify'](_0xccd039));delete _0xccd039[_0x0fa8('0x25')];if(_0x359d6c===0x191){_0x359d6c=0x190;}_0x363cb2[_0x0fa8('0x18')](_0x359d6c)[_0x0fa8('0x26')](_0x5af946[_0x0fa8('0x30')][_0x0fa8('0x76')]?{'message':_0x0fa8('0x78'),'statusCode':_0xccd039[_0x0fa8('0x79')]}:_0xccd039);});}; \ No newline at end of file +var _0x7023=['index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','code','com','serverUrl','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send'];(function(_0x2f1548,_0x1330b6){var _0x1296a7=function(_0x1ab760){while(--_0x1ab760){_0x2f1548['push'](_0x2f1548['shift']());}};_0x1296a7(++_0x1330b6);}(_0x7023,0x167));var _0x3702=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7023[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x3702('0x0'));var rimraf=require(_0x3702('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3702('0x2'));var moment=require(_0x3702('0x3'));var BPromise=require(_0x3702('0x4'));var Mustache=require(_0x3702('0x5'));var util=require(_0x3702('0x6'));var path=require(_0x3702('0x7'));var sox=require(_0x3702('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3702('0x9'));var squel=require('squel');var crypto=require(_0x3702('0xa'));var jsforce=require(_0x3702('0xb'));var deskjs=require(_0x3702('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3702('0xd'));var Papa=require(_0x3702('0xe'));var Redis=require(_0x3702('0xf'));var authService=require(_0x3702('0x10'));var qs=require(_0x3702('0x11'));var as=require(_0x3702('0x12'));var hardwareService=require(_0x3702('0x13'));var logger=require(_0x3702('0x14'))(_0x3702('0x15'));var utils=require('../../config/utils');var config=require(_0x3702('0x16'));var licenseUtil=require(_0x3702('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3702('0x18'));function respondWithStatusCode(_0x58abb3,_0x3345c9){_0x3345c9=_0x3345c9||0xcc;return function(_0x2efce8){if(_0x2efce8){return _0x58abb3[_0x3702('0x19')](_0x3345c9);}return _0x58abb3['status'](_0x3345c9)['end']();};}function respondWithResult(_0x4922e2,_0x506d5f){_0x506d5f=_0x506d5f||0xc8;return function(_0x5ce8ca){if(_0x5ce8ca){return _0x4922e2[_0x3702('0x1a')](_0x506d5f)[_0x3702('0x1b')](_0x5ce8ca);}};}function respondWithFilteredResult(_0x224730,_0x68dfe7){return function(_0x343d8f){if(_0x343d8f){var _0x3d3806=typeof _0x68dfe7[_0x3702('0x1c')]==='undefined'&&typeof _0x68dfe7[_0x3702('0x1d')]==='undefined';var _0x1f266f=_0x343d8f['count'];var _0x271a40=_0x3d3806?0x0:_0x68dfe7['offset'];var _0xe6253e=_0x3d3806?_0x343d8f[_0x3702('0x1e')]:_0x68dfe7['offset']+_0x68dfe7['limit'];var _0x519c49;if(_0xe6253e>=_0x1f266f){_0xe6253e=_0x1f266f;_0x519c49=0xc8;}else{_0x519c49=0xce;}_0x224730[_0x3702('0x1a')](_0x519c49);return _0x224730[_0x3702('0x1f')](_0x3702('0x20'),_0x271a40+'-'+_0xe6253e+'/'+_0x1f266f)['json'](_0x343d8f);}return null;};}function patchUpdates(_0x53823b){return function(_0x5c42b7){try{jsonpatch[_0x3702('0x21')](_0x5c42b7,_0x53823b,!![]);}catch(_0x7da465){return BPromise[_0x3702('0x22')](_0x7da465);}return _0x5c42b7[_0x3702('0x23')]();};}function saveUpdates(_0xbde3cb,_0x46ac22){return function(_0x1161c4){if(_0x1161c4){return _0x1161c4['update'](_0xbde3cb)[_0x3702('0x24')](function(_0x213461){return _0x213461;});}return null;};}function removeEntity(_0xc8f945,_0x57ade8){return function(_0x2f0a61){if(_0x2f0a61){return _0x2f0a61[_0x3702('0x25')]()[_0x3702('0x24')](function(){_0xc8f945[_0x3702('0x1a')](0xcc)[_0x3702('0x26')]();});}};}function handleEntityNotFound(_0x78950b,_0x26952f){return function(_0x344d30){if(!_0x344d30){_0x78950b[_0x3702('0x19')](0x194);}return _0x344d30;};}function handleError(_0x3a6400,_0x1fce85){_0x1fce85=_0x1fce85||0x1f4;return function(_0xc355bd){logger[_0x3702('0x27')](_0xc355bd[_0x3702('0x28')]);if(_0xc355bd[_0x3702('0x29')]){delete _0xc355bd['name'];}_0x3a6400[_0x3702('0x1a')](_0x1fce85)[_0x3702('0x2a')](_0xc355bd);};}exports[_0x3702('0x2b')]=function(_0x5adb81,_0x3271a7){var _0x5e8007={},_0x3b75d6={},_0x34e459={'count':0x0,'rows':[]};var _0x14a241=_['map'](db[_0x3702('0x2c')][_0x3702('0x2d')],function(_0x475178){return{'name':_0x475178[_0x3702('0x2e')],'type':_0x475178[_0x3702('0x2f')][_0x3702('0x30')]};});_0x3b75d6[_0x3702('0x31')]=_[_0x3702('0x32')](_0x14a241,'name');_0x3b75d6[_0x3702('0x33')]=_[_0x3702('0x34')](_0x5adb81[_0x3702('0x33')]);_0x3b75d6[_0x3702('0x35')]=_[_0x3702('0x36')](_0x3b75d6[_0x3702('0x31')],_0x3b75d6[_0x3702('0x33')]);_0x5e8007[_0x3702('0x37')]=_[_0x3702('0x36')](_0x3b75d6[_0x3702('0x31')],qs['fields'](_0x5adb81[_0x3702('0x33')]['fields']));_0x5e8007[_0x3702('0x37')]=_0x5e8007[_0x3702('0x37')][_0x3702('0x38')]?_0x5e8007[_0x3702('0x37')]:_0x3b75d6[_0x3702('0x31')];if(!_0x5adb81['query']['hasOwnProperty']('nolimit')){_0x5e8007[_0x3702('0x1d')]=qs['limit'](_0x5adb81[_0x3702('0x33')][_0x3702('0x1d')]);_0x5e8007['offset']=qs['offset'](_0x5adb81[_0x3702('0x33')][_0x3702('0x1c')]);}_0x5e8007[_0x3702('0x39')]=qs[_0x3702('0x3a')](_0x5adb81[_0x3702('0x33')]['sort']);_0x5e8007[_0x3702('0x3b')]=qs[_0x3702('0x35')](_['pick'](_0x5adb81['query'],_0x3b75d6[_0x3702('0x35')]),_0x14a241);if(_0x5adb81[_0x3702('0x33')][_0x3702('0x3c')]){_0x5e8007[_0x3702('0x3b')]=_[_0x3702('0x3d')](_0x5e8007[_0x3702('0x3b')],{'$or':_['map'](_0x14a241,function(_0x338072){if(_0x338072[_0x3702('0x2f')]!==_0x3702('0x3e')){var _0x4bf6c6={};_0x4bf6c6[_0x338072[_0x3702('0x29')]]={'$like':'%'+_0x5adb81['query'][_0x3702('0x3c')]+'%'};return _0x4bf6c6;}})});}_0x5e8007=_['merge']({},_0x5e8007,_0x5adb81[_0x3702('0x3f')]);var _0x1a3ff6={'where':_0x5e8007[_0x3702('0x3b')]};return db['ZohoAccount'][_0x3702('0x1e')](_0x1a3ff6)[_0x3702('0x24')](function(_0x540f21){_0x34e459[_0x3702('0x1e')]=_0x540f21;if(_0x5adb81['query'][_0x3702('0x40')]){_0x5e8007[_0x3702('0x41')]=[{'all':!![]}];}return db[_0x3702('0x2c')][_0x3702('0x42')](_0x5e8007);})[_0x3702('0x24')](function(_0x239311){_0x34e459['rows']=_0x239311;return _0x34e459;})[_0x3702('0x24')](respondWithFilteredResult(_0x3271a7,_0x5e8007))[_0x3702('0x43')](handleError(_0x3271a7,null));};exports[_0x3702('0x44')]=function(_0x2a5dae,_0x2fd8e9){var _0x1c7b94={'raw':![],'where':{'id':_0x2a5dae[_0x3702('0x45')]['id']}},_0x421c6f={};_0x421c6f[_0x3702('0x31')]=_[_0x3702('0x34')](db[_0x3702('0x2c')]['rawAttributes']);_0x421c6f[_0x3702('0x33')]=_[_0x3702('0x34')](_0x2a5dae['query']);_0x421c6f[_0x3702('0x35')]=_[_0x3702('0x36')](_0x421c6f['model'],_0x421c6f[_0x3702('0x33')]);_0x1c7b94['attributes']=_[_0x3702('0x36')](_0x421c6f[_0x3702('0x31')],qs['fields'](_0x2a5dae['query'][_0x3702('0x46')]));_0x1c7b94['attributes']=_0x1c7b94['attributes'][_0x3702('0x38')]?_0x1c7b94['attributes']:_0x421c6f[_0x3702('0x31')];if(_0x2a5dae[_0x3702('0x33')]['includeAll']){_0x1c7b94['include']=[{'all':!![]}];}_0x1c7b94=_[_0x3702('0x3d')]({},_0x1c7b94,_0x2a5dae['options']);return db['ZohoAccount'][_0x3702('0x47')](_0x1c7b94)[_0x3702('0x24')](handleEntityNotFound(_0x2fd8e9,null))['then'](respondWithResult(_0x2fd8e9,null))[_0x3702('0x43')](handleError(_0x2fd8e9,null));};exports[_0x3702('0x48')]=function(_0x51ee17,_0x3653db){return db['ZohoAccount'][_0x3702('0x48')](_0x51ee17[_0x3702('0x49')],{})['then'](respondWithResult(_0x3653db,0xc9))['catch'](handleError(_0x3653db,null));};exports[_0x3702('0x4a')]=function(_0x5b9187,_0x19870a){if(_0x5b9187[_0x3702('0x49')]['id']){delete _0x5b9187[_0x3702('0x49')]['id'];}return db[_0x3702('0x2c')][_0x3702('0x47')]({'where':{'id':_0x5b9187[_0x3702('0x45')]['id']}})[_0x3702('0x24')](handleEntityNotFound(_0x19870a,null))[_0x3702('0x24')](saveUpdates(_0x5b9187[_0x3702('0x49')],null))[_0x3702('0x24')](respondWithResult(_0x19870a,null))[_0x3702('0x43')](handleError(_0x19870a,null));};exports['destroy']=function(_0x3889b4,_0xa0f73d){return db[_0x3702('0x2c')]['find']({'where':{'id':_0x3889b4[_0x3702('0x45')]['id']}})[_0x3702('0x24')](handleEntityNotFound(_0xa0f73d,null))[_0x3702('0x24')](removeEntity(_0xa0f73d,null))[_0x3702('0x43')](handleError(_0xa0f73d,null));};exports[_0x3702('0x4b')]=function(_0x4cd05c,_0x50fb88,_0x3ccea9){var _0x3ed3e5={};var _0x598a3f={};var _0x316a55;var _0x58fd1c;return db['ZohoAccount'][_0x3702('0x4c')]({'where':{'id':_0x4cd05c['params']['id']}})[_0x3702('0x24')](handleEntityNotFound(_0x50fb88,null))[_0x3702('0x24')](function(_0x2c6a26){if(_0x2c6a26){_0x316a55=_0x2c6a26;_0x598a3f[_0x3702('0x31')]=_[_0x3702('0x34')](db[_0x3702('0x4d')][_0x3702('0x2d')]);_0x598a3f[_0x3702('0x33')]=_['keys'](_0x4cd05c[_0x3702('0x33')]);_0x598a3f[_0x3702('0x35')]=_[_0x3702('0x36')](_0x598a3f[_0x3702('0x31')],_0x598a3f['query']);_0x3ed3e5[_0x3702('0x37')]=_[_0x3702('0x36')](_0x598a3f[_0x3702('0x31')],qs[_0x3702('0x46')](_0x4cd05c[_0x3702('0x33')]['fields']));_0x3ed3e5[_0x3702('0x37')]=_0x3ed3e5['attributes']['length']?_0x3ed3e5[_0x3702('0x37')]:_0x598a3f[_0x3702('0x31')];_0x3ed3e5[_0x3702('0x39')]=qs[_0x3702('0x3a')](_0x4cd05c[_0x3702('0x33')][_0x3702('0x3a')]);_0x3ed3e5[_0x3702('0x3b')]=qs[_0x3702('0x35')](_[_0x3702('0x4e')](_0x4cd05c[_0x3702('0x33')],_0x598a3f[_0x3702('0x35')]));if(_0x4cd05c['query'][_0x3702('0x3c')]){_0x3ed3e5[_0x3702('0x3b')]=_[_0x3702('0x3d')](_0x3ed3e5[_0x3702('0x3b')],{'$or':_[_0x3702('0x32')](_0x3ed3e5[_0x3702('0x37')],function(_0x3bf19d){var _0x40c398={};_0x40c398[_0x3bf19d]={'$like':'%'+_0x4cd05c[_0x3702('0x33')][_0x3702('0x3c')]+'%'};return _0x40c398;})});}_0x3ed3e5=_[_0x3702('0x3d')]({},_0x3ed3e5,_0x4cd05c[_0x3702('0x3f')]);return _0x316a55['getConfigurations'](_0x3ed3e5);}})[_0x3702('0x24')](function(_0x4db775){if(_0x4db775){_0x58fd1c=_0x4db775[_0x3702('0x38')];if(!_0x4cd05c['query'][_0x3702('0x4f')](_0x3702('0x50'))){_0x3ed3e5['limit']=qs[_0x3702('0x1d')](_0x4cd05c[_0x3702('0x33')][_0x3702('0x1d')]);_0x3ed3e5['offset']=qs['offset'](_0x4cd05c['query']['offset']);}return _0x316a55[_0x3702('0x4b')](_0x3ed3e5);}})[_0x3702('0x24')](function(_0x117e4c){if(_0x117e4c){return _0x117e4c?{'count':_0x58fd1c,'rows':_0x117e4c}:null;}})[_0x3702('0x24')](respondWithResult(_0x50fb88,null))['catch'](handleError(_0x50fb88,null));};exports[_0x3702('0x51')]=function(_0x17ecd0,_0x1f29ff,_0x8e9928){if(_0x17ecd0[_0x3702('0x49')]['id']){delete _0x17ecd0[_0x3702('0x49')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x17ecd0['params']['id']}})[_0x3702('0x24')](handleEntityNotFound(_0x1f29ff,null))['then'](function(_0x395e95){if(_0x395e95){_0x17ecd0[_0x3702('0x49')]['AccountId']=_0x395e95['id'];_0x17ecd0['body'][_0x3702('0x52')]=integrations[_0x3702('0x53')](_0x17ecd0[_0x3702('0x49')][_0x3702('0x54')],_0x17ecd0[_0x3702('0x49')][_0x3702('0x2f')]);_0x17ecd0[_0x3702('0x49')]['Descriptions']=integrations[_0x3702('0x55')](_0x17ecd0['body'][_0x3702('0x54')],_0x17ecd0[_0x3702('0x49')][_0x3702('0x2f')]);return db[_0x3702('0x4d')]['create'](_0x17ecd0[_0x3702('0x49')],{'include':[{'model':db[_0x3702('0x56')],'as':_0x3702('0x52')},{'model':db[_0x3702('0x56')],'as':_0x3702('0x57')}]});}return null;})[_0x3702('0x24')](respondWithResult(_0x1f29ff,null))[_0x3702('0x43')](handleError(_0x1f29ff,null));};function getAccessToken(_0x3c95a4){return new Promise(function(_0x3dd127,_0x276614){var _0x36d885;switch(_0x3c95a4[_0x3702('0x58')]){case'US':_0x36d885=_0x3702('0x59');break;case'AU':_0x36d885=_0x3702('0x5a');break;case'EU':_0x36d885=_0x3702('0x5b');break;case'IN':_0x36d885=_0x3702('0x5c');break;case'CN':_0x36d885=_0x3702('0x5d');break;default:_0x36d885=_0x3702('0x5b');break;}var _0x32055c={'method':_0x3702('0x5e'),'uri':_0x36d885+_0x3702('0x5f'),'qs':{'refresh_token':_0x3c95a4[_0x3702('0x60')],'client_id':_0x3c95a4[_0x3702('0x61')],'client_secret':_0x3c95a4[_0x3702('0x62')],'grant_type':_0x3702('0x63')},'json':!![]};return rp(_0x32055c)['then'](function(_0x12dc07){if(_0x12dc07[_0x3702('0x64')]){_0x3dd127(_0x12dc07[_0x3702('0x64')]);}else{_0x276614('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x3702('0x43')](function(_0x2eab89){_0x276614(_0x2eab89);});});}exports[_0x3702('0x65')]=function(_0x180dec,_0x1e7db7,_0x38c872){var _0x53ce5c,_0x4015f1,_0x35c597,_0x5c2455,_0x197aca;return db['ZohoAccount']['findOne']({'where':{'id':_0x180dec[_0x3702('0x45')]['id']},'attributes':['id',_0x3702('0x66'),'zone',_0x3702('0x61'),_0x3702('0x62'),'serverUrl',_0x3702('0x67'),_0x3702('0x60')]})['then'](handleEntityNotFound(_0x1e7db7,null))[_0x3702('0x24')](function(_0x1f5927){_0x197aca=_0x1f5927;_0x53ce5c=_0x197aca[_0x3702('0x66')];_0x4015f1=_0x53ce5c==='zoho.eu'?'eu':_0x3702('0x68');_0x35c597=_0x197aca[_0x3702('0x69')];var _0x142b4c=_0x35c597['slice'](-0x1);if(_0x142b4c==='/'||_0x142b4c==='\x5c'||_0x142b4c===':'){_0x35c597=_0x35c597[_0x3702('0x6a')](0x0,_0x35c597[_0x3702('0x6b')](_0x142b4c));}if(!_0x197aca[_0x3702('0x60')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x197aca);})[_0x3702('0x24')](function(_0x27f8ed){if(_0x27f8ed){return rp({'method':_0x3702('0x6c'),'uri':util[_0x3702('0x6d')](_0x3702('0x6e'),_0x4015f1),'qs':{'module':_0x3702('0x6f')},'headers':{'Authorization':_0x3702('0x70')+_0x27f8ed},'json':!![]});}})[_0x3702('0x24')](function(_0x252ad7){if(_0x252ad7){if(_0x252ad7[_0x3702('0x71')]&&_0x252ad7[_0x3702('0x71')][_0x3702('0x27')]){throw new Error(_0x252ad7[_0x3702('0x71')][_0x3702('0x27')]['message']);}var _0x2d22a9=[];var _0x4731c8=[];var _0x3d3eb2=[_0x3702('0x72'),_0x3702('0x73'),_0x3702('0x74'),_0x3702('0x75'),'Call_Duration',_0x3702('0x76'),_0x3702('0x77'),_0x3702('0x78')];_0x4731c8=_['remove'](_0x252ad7[_0x3702('0x46')],function(_0x5df6da){return _0x3d3eb2[_0x3702('0x79')](_0x5df6da[_0x3702('0x7a')]);});for(var _0x5ac52c=0x0;_0x5ac52c<_0x4731c8[_0x3702('0x38')];_0x5ac52c++){if(_0x4731c8[_0x5ac52c][_0x3702('0x7b')]===![]){_0x2d22a9[_0x3702('0x7c')]({'id':_0x4731c8[_0x5ac52c]['id'],'name':_0x4731c8[_0x5ac52c][_0x3702('0x7d')],'custom':_0x4731c8[_0x5ac52c][_0x3702('0x7e')],'options':_0x4731c8[_0x5ac52c]['data_type']===_0x3702('0x7f')&&_0x4731c8[_0x5ac52c]['pick_list_values']['length']>-0x1?_[_0x3702('0x32')](_0x4731c8[_0x5ac52c][_0x3702('0x80')],function(_0x83253a){return{'name':_0x83253a,'value':_0x83253a};}):[]});}}return{'count':_0x2d22a9[_0x3702('0x38')],'rows':_0x2d22a9};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1e7db7,null))['catch'](function(_0xe0fcf3){var _0x4b120c=_0x180dec[_0x3702('0x33')][_0x3702('0x81')]?0x1f4:_0xe0fcf3[_0x3702('0x82')]||0x1f4;logger[_0x3702('0x27')](_0x3702('0x83'),_0x3702('0x65'),_0x4b120c,JSON[_0x3702('0x84')](_0xe0fcf3));delete _0xe0fcf3[_0x3702('0x29')];if(_0x4b120c===0x191){_0x4b120c=0x190;}_0x1e7db7[_0x3702('0x1a')](_0x4b120c)[_0x3702('0x2a')](_0x180dec[_0x3702('0x33')][_0x3702('0x81')]?{'message':_0x3702('0x85'),'statusCode':_0xe0fcf3['statusCode']}:_0xe0fcf3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6d7cccf..13afd4d 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 _0x6e94=['host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientId','clientSecret','application/x-www-form-urlencoded','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','code','https://accounts.zoho.com','then','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x6e94,0x11c));var _0x46e9=function(_0x17fd72,_0x2b8254){_0x17fd72=_0x17fd72-0x0;var _0xa8d8c6=_0x6e94[_0x17fd72];return _0xa8d8c6;};'use strict';var _=require(_0x46e9('0x0'));var util=require(_0x46e9('0x1'));var logger=require(_0x46e9('0x2'))(_0x46e9('0x3'));var moment=require('moment');var BPromise=require(_0x46e9('0x4'));var rp=require(_0x46e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46e9('0x6'));var config=require(_0x46e9('0x7'));var attributes=require(_0x46e9('0x8'));var integrations=require(_0x46e9('0x9'));module[_0x46e9('0xa')]=function(_0x4768f5,_0x4fc268){return _0x4768f5[_0x46e9('0xb')](_0x46e9('0xc'),attributes,{'tableName':_0x46e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x350b91,_0x461e92,_0x1f266e){if(_0x350b91['changed'](_0x46e9('0xe'))||_0x350b91['changed'](_0x46e9('0xf'))||_0x350b91[_0x46e9('0x10')]('clientId')||_0x350b91['changed']('clientSecret')||_0x350b91[_0x46e9('0x10')]('code')||_0x350b91[_0x46e9('0x10')](_0x46e9('0x11'))){var _0x4d9474,_0x1126d9;_0x4d9474=_0x350b91[_0x46e9('0xf')];var _0x41b14d=_0x4d9474[_0x46e9('0x12')](-0x1);if(_0x41b14d==='/'||_0x41b14d==='\x5c'||_0x41b14d===':'){_0x4d9474=_0x4d9474[_0x46e9('0x13')](0x0,_0x4d9474[_0x46e9('0x14')](_0x41b14d));}switch(_0x350b91['zone']){case'US':_0x1126d9='https://accounts.zoho.com';break;case'AU':_0x1126d9=_0x46e9('0x15');break;case'IN':_0x1126d9=_0x46e9('0x16');break;case'CN':_0x1126d9=_0x46e9('0x17');break;default:_0x1126d9=_0x46e9('0x18');break;}var _0x5400f3={'method':_0x46e9('0x19'),'uri':_0x1126d9+'/oauth/v2/token','form':{'grant_type':_0x46e9('0x1a'),'client_id':_0x350b91[_0x46e9('0x1b')],'client_secret':_0x350b91[_0x46e9('0x1c')],'redirect_uri':_0x350b91[_0x46e9('0xf')],'code':_0x350b91['code']},'headers':{'Content-Type':_0x46e9('0x1d')}};return rp(_0x5400f3)['then'](function(_0x3400ca){var _0x227d79=JSON['parse'](_0x3400ca);if(_0x227d79[_0x46e9('0x1e')]){_0x350b91[_0x46e9('0x1f')]=_0x227d79[_0x46e9('0x1e')];logger[_0x46e9('0x20')](util['format'](_0x46e9('0x21'),_0x350b91[_0x46e9('0x22')],_0x350b91['id']));}else{logger[_0x46e9('0x23')](util[_0x46e9('0x24')](_0x46e9('0x25'),_0x350b91['name'],_0x350b91['id']),util['inspect'](_0x227d79,{'showHidden':![],'depth':null}));}return _0x1f266e(null,_0x461e92);})[_0x46e9('0x26')](function(_0x1766e1){logger['error'](util[_0x46e9('0x24')](_0x46e9('0x25'),_0x350b91[_0x46e9('0x22')],_0x350b91['id']),util[_0x46e9('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x1f266e(_0x1766e1);});}else{return _0x1f266e(null,_0x461e92);}},'beforeUpdate':function(_0xea4407,_0x33d90b,_0x38b405){if(_0xea4407[_0x46e9('0x10')]('zone')||_0xea4407[_0x46e9('0x10')](_0x46e9('0xf'))||_0xea4407[_0x46e9('0x10')](_0x46e9('0x1b'))||_0xea4407['changed']('clientSecret')||_0xea4407[_0x46e9('0x10')](_0x46e9('0x28'))||_0xea4407[_0x46e9('0x10')](_0x46e9('0x11'))){var _0x56d2d4,_0x4a8d49;_0x56d2d4=_0xea4407['serverUrl'];var _0x90325f=_0x56d2d4[_0x46e9('0x12')](-0x1);if(_0x90325f==='/'||_0x90325f==='\x5c'||_0x90325f===':'){_0x56d2d4=_0x56d2d4[_0x46e9('0x13')](0x0,_0x56d2d4['lastIndexOf'](_0x90325f));}switch(_0xea4407[_0x46e9('0xe')]){case'US':_0x4a8d49=_0x46e9('0x29');break;case'AU':_0x4a8d49=_0x46e9('0x15');break;case'IN':_0x4a8d49=_0x46e9('0x16');break;case'CN':_0x4a8d49=_0x46e9('0x17');break;default:_0x4a8d49='https://accounts.zoho.eu';break;}var _0x412f7a={'method':_0x46e9('0x19'),'uri':_0x4a8d49+'/oauth/v2/token','form':{'grant_type':_0x46e9('0x1a'),'client_id':_0xea4407[_0x46e9('0x1b')],'client_secret':_0xea4407[_0x46e9('0x1c')],'redirect_uri':_0xea4407[_0x46e9('0xf')],'code':_0xea4407[_0x46e9('0x28')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x412f7a)[_0x46e9('0x2a')](function(_0x50bf7f){var _0x2e6db4=JSON['parse'](_0x50bf7f);if(_0x2e6db4[_0x46e9('0x1e')]){_0xea4407['refreshToken']=_0x2e6db4['refresh_token'];logger[_0x46e9('0x20')](util[_0x46e9('0x24')](_0x46e9('0x21'),_0xea4407[_0x46e9('0x22')],_0xea4407['id']));}else{logger[_0x46e9('0x23')](util[_0x46e9('0x24')](_0x46e9('0x25'),_0xea4407['name'],_0xea4407['id']),util[_0x46e9('0x27')](_0x2e6db4,{'showHidden':![],'depth':null}));}return _0x38b405(null,_0x33d90b);})[_0x46e9('0x26')](function(_0x18eb99){logger[_0x46e9('0x23')](util[_0x46e9('0x24')](_0x46e9('0x25'),_0xea4407[_0x46e9('0x22')],_0xea4407['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x38b405(_0x18eb99);});}else{return _0x38b405(null,_0x33d90b);}}}});}; \ No newline at end of file +var _0x8962=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','clientId','changed','clientSecret','serverUrl','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','lastIndexOf','POST','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','lodash','../../config/logger'];(function(_0x47c9b1,_0x119667){var _0x314445=function(_0x547906){while(--_0x547906){_0x47c9b1['push'](_0x47c9b1['shift']());}};_0x314445(++_0x119667);}(_0x8962,0x100));var _0x2896=function(_0x1d0466,_0xa35a40){_0x1d0466=_0x1d0466-0x0;var _0x3a64d2=_0x8962[_0x1d0466];return _0x3a64d2;};'use strict';var _=require(_0x2896('0x0'));var util=require('util');var logger=require(_0x2896('0x1'))(_0x2896('0x2'));var moment=require(_0x2896('0x3'));var BPromise=require(_0x2896('0x4'));var rp=require(_0x2896('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2896('0x6'));var config=require(_0x2896('0x7'));var attributes=require(_0x2896('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2896('0x9')]=function(_0x54bec4,_0x42f78a){return _0x54bec4[_0x2896('0xa')](_0x2896('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a7239,_0x1c0e6d,_0x2bde0c){if(_0x4a7239['changed']('zone')||_0x4a7239['changed']('serverUrl')||_0x4a7239['changed'](_0x2896('0xc'))||_0x4a7239[_0x2896('0xd')](_0x2896('0xe'))||_0x4a7239[_0x2896('0xd')]('code')||_0x4a7239['changed']('host')){var _0x4887b2,_0x1fcc79;_0x4887b2=_0x4a7239[_0x2896('0xf')];var _0x3d5ab6=_0x4887b2[_0x2896('0x10')](-0x1);if(_0x3d5ab6==='/'||_0x3d5ab6==='\x5c'||_0x3d5ab6===':'){_0x4887b2=_0x4887b2[_0x2896('0x11')](0x0,_0x4887b2['lastIndexOf'](_0x3d5ab6));}switch(_0x4a7239[_0x2896('0x12')]){case'US':_0x1fcc79=_0x2896('0x13');break;case'AU':_0x1fcc79=_0x2896('0x14');break;case'IN':_0x1fcc79=_0x2896('0x15');break;case'CN':_0x1fcc79=_0x2896('0x16');break;default:_0x1fcc79=_0x2896('0x17');break;}var _0x22820d={'method':'POST','uri':_0x1fcc79+_0x2896('0x18'),'form':{'grant_type':_0x2896('0x19'),'client_id':_0x4a7239[_0x2896('0xc')],'client_secret':_0x4a7239[_0x2896('0xe')],'redirect_uri':_0x4a7239[_0x2896('0xf')],'code':_0x4a7239[_0x2896('0x1a')]},'headers':{'Content-Type':_0x2896('0x1b')}};return rp(_0x22820d)[_0x2896('0x1c')](function(_0x4ab0b7){var _0x2bb4e1=JSON[_0x2896('0x1d')](_0x4ab0b7);if(_0x2bb4e1[_0x2896('0x1e')]){_0x4a7239[_0x2896('0x1f')]=_0x2bb4e1['refresh_token'];logger[_0x2896('0x20')](util[_0x2896('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a7239[_0x2896('0x22')],_0x4a7239['id']));}else{logger[_0x2896('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a7239[_0x2896('0x22')],_0x4a7239['id']),util['inspect'](_0x2bb4e1,{'showHidden':![],'depth':null}));}return _0x2bde0c(null,_0x1c0e6d);})['catch'](function(_0x4fc2e3){logger['error'](util[_0x2896('0x21')](_0x2896('0x24'),_0x4a7239[_0x2896('0x22')],_0x4a7239['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2bde0c(_0x4fc2e3);});}else{return _0x2bde0c(null,_0x1c0e6d);}},'beforeUpdate':function(_0x1d6787,_0x2df8b5,_0x2d6bcb){if(_0x1d6787[_0x2896('0xd')](_0x2896('0x12'))||_0x1d6787[_0x2896('0xd')](_0x2896('0xf'))||_0x1d6787['changed'](_0x2896('0xc'))||_0x1d6787[_0x2896('0xd')]('clientSecret')||_0x1d6787[_0x2896('0xd')]('code')||_0x1d6787[_0x2896('0xd')](_0x2896('0x25'))){var _0x28d05f,_0x46282f;_0x28d05f=_0x1d6787[_0x2896('0xf')];var _0x37c3b1=_0x28d05f[_0x2896('0x10')](-0x1);if(_0x37c3b1==='/'||_0x37c3b1==='\x5c'||_0x37c3b1===':'){_0x28d05f=_0x28d05f['substring'](0x0,_0x28d05f[_0x2896('0x26')](_0x37c3b1));}switch(_0x1d6787['zone']){case'US':_0x46282f=_0x2896('0x13');break;case'AU':_0x46282f=_0x2896('0x14');break;case'IN':_0x46282f=_0x2896('0x15');break;case'CN':_0x46282f='https://accounts.zoho.com.cn';break;default:_0x46282f=_0x2896('0x17');break;}var _0x163841={'method':_0x2896('0x27'),'uri':_0x46282f+_0x2896('0x18'),'form':{'grant_type':_0x2896('0x19'),'client_id':_0x1d6787[_0x2896('0xc')],'client_secret':_0x1d6787[_0x2896('0xe')],'redirect_uri':_0x1d6787[_0x2896('0xf')],'code':_0x1d6787[_0x2896('0x1a')]},'headers':{'Content-Type':_0x2896('0x1b')}};return rp(_0x163841)[_0x2896('0x1c')](function(_0x25854b){var _0x45fef1=JSON['parse'](_0x25854b);if(_0x45fef1[_0x2896('0x1e')]){_0x1d6787[_0x2896('0x1f')]=_0x45fef1[_0x2896('0x1e')];logger[_0x2896('0x20')](util[_0x2896('0x21')](_0x2896('0x28'),_0x1d6787[_0x2896('0x22')],_0x1d6787['id']));}else{logger[_0x2896('0x23')](util[_0x2896('0x21')](_0x2896('0x24'),_0x1d6787[_0x2896('0x22')],_0x1d6787['id']),util['inspect'](_0x45fef1,{'showHidden':![],'depth':null}));}return _0x2d6bcb(null,_0x2df8b5);})[_0x2896('0x29')](function(_0x131aa1){logger[_0x2896('0x23')](util['format'](_0x2896('0x24'),_0x1d6787[_0x2896('0x22')],_0x1d6787['id']),util[_0x2896('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d6bcb(_0x131aa1);});}else{return _0x2d6bcb(null,_0x2df8b5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b4b047a..dc356e9 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 _0xf34f=['message','result','catch','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','code','ZohoAccount,\x20%s,\x20%s'];(function(_0x24323b,_0x460d9b){var _0x38ea30=function(_0xa1c8db){while(--_0xa1c8db){_0x24323b['push'](_0x24323b['shift']());}};_0x38ea30(++_0x460d9b);}(_0xf34f,0x64));var _0xff34=function(_0x2a17d0,_0x16f5cf){_0x2a17d0=_0x2a17d0-0x0;var _0x452b8c=_0xf34f[_0x2a17d0];return _0x452b8c;};'use strict';var _=require(_0xff34('0x0'));var util=require('util');var moment=require(_0xff34('0x1'));var BPromise=require('bluebird');var rs=require(_0xff34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff34('0x3'))['db'];var utils=require(_0xff34('0x4'));var logger=require(_0xff34('0x5'))('rpc');var config=require(_0xff34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xff34('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444e6a,_0x5e6f92,_0x45036f){return new BPromise(function(_0x46d761,_0x5c1668){return client['request'](_0x444e6a,_0x45036f)[_0xff34('0x8')](function(_0xe76c05){logger[_0xff34('0x9')]('ZohoAccount,\x20%s,\x20%s',_0x5e6f92,_0xff34('0xa'));logger[_0xff34('0xb')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5e6f92,_0xff34('0xa'),JSON[_0xff34('0xc')](_0xe76c05));if(_0xe76c05[_0xff34('0xd')]){if(_0xe76c05['error'][_0xff34('0xe')]===0x1f4){logger[_0xff34('0xd')](_0xff34('0xf'),_0x5e6f92,_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);return _0x5c1668(_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);}logger[_0xff34('0xd')](_0xff34('0xf'),_0x5e6f92,_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);return _0x46d761(_0xe76c05[_0xff34('0xd')][_0xff34('0x10')]);}else{logger[_0xff34('0x9')](_0xff34('0xf'),_0x5e6f92,_0xff34('0xa'));_0x46d761(_0xe76c05[_0xff34('0x11')][_0xff34('0x10')]);}})[_0xff34('0x12')](function(_0xf5e0ec){logger['error'](_0xff34('0xf'),_0x5e6f92,_0xf5e0ec);_0x5c1668(_0xf5e0ec);});});}exports['GetZohoAccount']=function(_0x2fe34c){var _0x50bfa5=this;return new Promise(function(_0x44260f,_0x736675){return db['ZohoAccount']['findAll']({'raw':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x14')]===undefined?!![]:![]:!![],'where':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x15')]||null:null,'attributes':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x16')]||null:null,'limit':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x17')]||null:null,'include':_0x2fe34c[_0xff34('0x13')]?_0x2fe34c[_0xff34('0x13')][_0xff34('0x18')]?_[_0xff34('0x19')](_0x2fe34c[_0xff34('0x13')][_0xff34('0x18')],function(_0x40f14e){return{'model':db[_0x40f14e[_0xff34('0x1a')]],'as':_0x40f14e['as'],'attributes':_0x40f14e[_0xff34('0x16')],'include':_0x40f14e['include']?_[_0xff34('0x19')](_0x40f14e[_0xff34('0x18')],function(_0x66df01){return{'model':db[_0x66df01[_0xff34('0x1a')]],'as':_0x66df01['as'],'attributes':_0x66df01[_0xff34('0x16')],'include':_0x66df01['include']?_['map'](_0x66df01[_0xff34('0x18')],function(_0x24a72f){return{'model':db[_0x24a72f['model']],'as':_0x24a72f['as'],'attributes':_0x24a72f[_0xff34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xff34('0x8')](function(_0x206dc3){logger['info'](_0xff34('0x1b'),_0x2fe34c);logger[_0xff34('0xb')](_0xff34('0x1b'),_0x2fe34c,JSON[_0xff34('0xc')](_0x206dc3));_0x44260f(_0x206dc3);})[_0xff34('0x12')](function(_0x5c1e72){logger[_0xff34('0xd')](_0xff34('0x1b'),_0x5c1e72[_0xff34('0x10')],_0x2fe34c);_0x736675(_0x50bfa5['error'](0x1f4,_0x5c1e72[_0xff34('0x10')]));});});};exports[_0xff34('0x1c')]=function(_0x2294f1){var _0x22613a=this;return new Promise(function(_0x1050de,_0x212097){return db['ZohoAccount']['find']({'raw':_0x2294f1[_0xff34('0x13')]?_0x2294f1['options'][_0xff34('0x14')]===undefined?!![]:![]:!![],'where':_0x2294f1[_0xff34('0x13')]?_0x2294f1['options'][_0xff34('0x15')]||null:null,'attributes':_0x2294f1[_0xff34('0x13')]?_0x2294f1[_0xff34('0x13')][_0xff34('0x16')]||null:null,'include':_0x2294f1[_0xff34('0x13')]?_0x2294f1[_0xff34('0x13')][_0xff34('0x18')]?_[_0xff34('0x19')](_0x2294f1[_0xff34('0x13')]['include'],function(_0x21fa9a){return{'model':db[_0x21fa9a['model']],'as':_0x21fa9a['as'],'attributes':_0x21fa9a[_0xff34('0x16')],'include':_0x21fa9a[_0xff34('0x18')]?_['map'](_0x21fa9a['include'],function(_0x3c97f4){return{'model':db[_0x3c97f4[_0xff34('0x1a')]],'as':_0x3c97f4['as'],'attributes':_0x3c97f4[_0xff34('0x16')],'include':_0x3c97f4[_0xff34('0x18')]?_[_0xff34('0x19')](_0x3c97f4['include'],function(_0xe12a5f){return{'model':db[_0xe12a5f[_0xff34('0x1a')]],'as':_0xe12a5f['as'],'attributes':_0xe12a5f['attributes']};}):[]};}):[]};}):[]:[]})[_0xff34('0x8')](function(_0xf4df3f){logger['info'](_0xff34('0x1c'),_0x2294f1);logger['debug'](_0xff34('0x1c'),_0x2294f1,JSON[_0xff34('0xc')](_0xf4df3f));_0x1050de(_0xf4df3f);})['catch'](function(_0x1021ac){logger[_0xff34('0xd')](_0xff34('0x1c'),_0x1021ac[_0xff34('0x10')],_0x2294f1);_0x212097(_0x22613a[_0xff34('0xd')](0x1f4,_0x1021ac[_0xff34('0x10')]));});});}; \ No newline at end of file +var _0x55c3=['then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','options','raw','where','attributes','limit','map','include','model','ShowZohoAccount','ZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x260d52,_0x20280e){var _0xbdf5f6=function(_0x2778e8){while(--_0x2778e8){_0x260d52['push'](_0x260d52['shift']());}};_0xbdf5f6(++_0x20280e);}(_0x55c3,0x189));var _0x355c=function(_0x2af461,_0x5b31dd){_0x2af461=_0x2af461-0x0;var _0x5a6495=_0x55c3[_0x2af461];return _0x5a6495;};'use strict';var _=require('lodash');var util=require(_0x355c('0x0'));var moment=require(_0x355c('0x1'));var BPromise=require(_0x355c('0x2'));var rs=require(_0x355c('0x3'));var fs=require('fs');var Redis=require(_0x355c('0x4'));var db=require(_0x355c('0x5'))['db'];var utils=require(_0x355c('0x6'));var logger=require(_0x355c('0x7'))(_0x355c('0x8'));var config=require(_0x355c('0x9'));var jayson=require(_0x355c('0xa'));var client=jayson[_0x355c('0xb')][_0x355c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167fb1,_0x4cd7f0,_0x567edb){return new BPromise(function(_0x3fe34b,_0x248f02){return client[_0x355c('0xd')](_0x167fb1,_0x567edb)[_0x355c('0xe')](function(_0x40ead2){logger[_0x355c('0xf')](_0x355c('0x10'),_0x4cd7f0,_0x355c('0x11'));logger[_0x355c('0x12')](_0x355c('0x13'),_0x4cd7f0,_0x355c('0x11'),JSON[_0x355c('0x14')](_0x40ead2));if(_0x40ead2[_0x355c('0x15')]){if(_0x40ead2[_0x355c('0x15')]['code']===0x1f4){logger[_0x355c('0x15')](_0x355c('0x10'),_0x4cd7f0,_0x40ead2['error'][_0x355c('0x16')]);return _0x248f02(_0x40ead2['error'][_0x355c('0x16')]);}logger[_0x355c('0x15')](_0x355c('0x10'),_0x4cd7f0,_0x40ead2[_0x355c('0x15')]['message']);return _0x3fe34b(_0x40ead2[_0x355c('0x15')]['message']);}else{logger['info'](_0x355c('0x10'),_0x4cd7f0,_0x355c('0x11'));_0x3fe34b(_0x40ead2[_0x355c('0x17')][_0x355c('0x16')]);}})[_0x355c('0x18')](function(_0x25369a){logger[_0x355c('0x15')](_0x355c('0x10'),_0x4cd7f0,_0x25369a);_0x248f02(_0x25369a);});});}exports[_0x355c('0x19')]=function(_0x559577){var _0xc051c7=this;return new Promise(function(_0x2610c5,_0x537586){return db['ZohoAccount']['findAll']({'raw':_0x559577['options']?_0x559577[_0x355c('0x1a')][_0x355c('0x1b')]===undefined?!![]:![]:!![],'where':_0x559577[_0x355c('0x1a')]?_0x559577['options'][_0x355c('0x1c')]||null:null,'attributes':_0x559577[_0x355c('0x1a')]?_0x559577[_0x355c('0x1a')][_0x355c('0x1d')]||null:null,'limit':_0x559577[_0x355c('0x1a')]?_0x559577[_0x355c('0x1a')][_0x355c('0x1e')]||null:null,'include':_0x559577[_0x355c('0x1a')]?_0x559577['options']['include']?_[_0x355c('0x1f')](_0x559577[_0x355c('0x1a')][_0x355c('0x20')],function(_0x5a378e){return{'model':db[_0x5a378e[_0x355c('0x21')]],'as':_0x5a378e['as'],'attributes':_0x5a378e['attributes'],'include':_0x5a378e[_0x355c('0x20')]?_[_0x355c('0x1f')](_0x5a378e[_0x355c('0x20')],function(_0x22e629){return{'model':db[_0x22e629[_0x355c('0x21')]],'as':_0x22e629['as'],'attributes':_0x22e629['attributes'],'include':_0x22e629[_0x355c('0x20')]?_[_0x355c('0x1f')](_0x22e629[_0x355c('0x20')],function(_0x3fa509){return{'model':db[_0x3fa509[_0x355c('0x21')]],'as':_0x3fa509['as'],'attributes':_0x3fa509['attributes']};}):[]};}):[]};}):[]:[]})[_0x355c('0xe')](function(_0x5e6345){logger[_0x355c('0xf')](_0x355c('0x19'),_0x559577);logger[_0x355c('0x12')](_0x355c('0x19'),_0x559577,JSON[_0x355c('0x14')](_0x5e6345));_0x2610c5(_0x5e6345);})[_0x355c('0x18')](function(_0x302391){logger['error'](_0x355c('0x19'),_0x302391[_0x355c('0x16')],_0x559577);_0x537586(_0xc051c7[_0x355c('0x15')](0x1f4,_0x302391[_0x355c('0x16')]));});});};exports[_0x355c('0x22')]=function(_0x4533cb){var _0x105b74=this;return new Promise(function(_0x3a1570,_0x4ce9b7){return db[_0x355c('0x23')][_0x355c('0x24')]({'raw':_0x4533cb[_0x355c('0x1a')]?_0x4533cb['options'][_0x355c('0x1b')]===undefined?!![]:![]:!![],'where':_0x4533cb['options']?_0x4533cb[_0x355c('0x1a')][_0x355c('0x1c')]||null:null,'attributes':_0x4533cb[_0x355c('0x1a')]?_0x4533cb['options'][_0x355c('0x1d')]||null:null,'include':_0x4533cb[_0x355c('0x1a')]?_0x4533cb['options'][_0x355c('0x20')]?_[_0x355c('0x1f')](_0x4533cb[_0x355c('0x1a')]['include'],function(_0x1ef90b){return{'model':db[_0x1ef90b['model']],'as':_0x1ef90b['as'],'attributes':_0x1ef90b[_0x355c('0x1d')],'include':_0x1ef90b[_0x355c('0x20')]?_[_0x355c('0x1f')](_0x1ef90b['include'],function(_0x956d3){return{'model':db[_0x956d3[_0x355c('0x21')]],'as':_0x956d3['as'],'attributes':_0x956d3[_0x355c('0x1d')],'include':_0x956d3['include']?_[_0x355c('0x1f')](_0x956d3['include'],function(_0x4615db){return{'model':db[_0x4615db[_0x355c('0x21')]],'as':_0x4615db['as'],'attributes':_0x4615db[_0x355c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x355c('0xe')](function(_0x31111d){logger['info']('ShowZohoAccount',_0x4533cb);logger[_0x355c('0x12')]('ShowZohoAccount',_0x4533cb,JSON['stringify'](_0x31111d));_0x3a1570(_0x31111d);})[_0x355c('0x18')](function(_0x1abaad){logger[_0x355c('0x15')]('ShowZohoAccount',_0x1abaad[_0x355c('0x16')],_0x4533cb);_0x4ce9b7(_0x105b74[_0x355c('0x15')](0x1f4,_0x1abaad[_0x355c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 98949f1..eaabb5f 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 _0x1688=['getDescriptions','post','create','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x5c6787,_0xded659){var _0x203447=function(_0x51e5d1){while(--_0x51e5d1){_0x5c6787['push'](_0x5c6787['shift']());}};_0x203447(++_0xded659);}(_0x1688,0x140));var _0x8168=function(_0x321528,_0x212631){_0x321528=_0x321528-0x0;var _0x4a014b=_0x1688[_0x321528];return _0x4a014b;};'use strict';var multer=require(_0x8168('0x0'));var util=require('util');var path=require(_0x8168('0x1'));var timeout=require(_0x8168('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8168('0x3'));var auth=require(_0x8168('0x4'));var interaction=require(_0x8168('0x5'));var config=require(_0x8168('0x6'));var controller=require(_0x8168('0x7'));router[_0x8168('0x8')]('/',auth['isAuthenticated'](),controller[_0x8168('0x9')]);router[_0x8168('0x8')](_0x8168('0xa'),auth[_0x8168('0xb')](),controller['show']);router[_0x8168('0x8')](_0x8168('0xc'),auth['isAuthenticated'](),controller[_0x8168('0xd')]);router['get'](_0x8168('0xe'),auth['isAuthenticated'](),controller[_0x8168('0xf')]);router['get']('/:id/descriptions',auth[_0x8168('0xb')](),controller[_0x8168('0x10')]);router[_0x8168('0x11')]('/',auth['isAuthenticated'](),controller[_0x8168('0x12')]);router['put'](_0x8168('0xa'),auth[_0x8168('0xb')](),controller['update']);router[_0x8168('0x13')](_0x8168('0xa'),auth[_0x8168('0xb')](),controller['destroy']);module[_0x8168('0x14')]=router; \ No newline at end of file +var _0x627a=['get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','index'];(function(_0x2c4318,_0x217e55){var _0x43196f=function(_0x23fd59){while(--_0x23fd59){_0x2c4318['push'](_0x2c4318['shift']());}};_0x43196f(++_0x217e55);}(_0x627a,0x91));var _0xa627=function(_0x49b7ac,_0x3ea4fa){_0x49b7ac=_0x49b7ac-0x0;var _0x2f2e9d=_0x627a[_0x49b7ac];return _0x2f2e9d;};'use strict';var multer=require(_0xa627('0x0'));var util=require(_0xa627('0x1'));var path=require(_0xa627('0x2'));var timeout=require('connect-timeout');var express=require(_0xa627('0x3'));var router=express[_0xa627('0x4')]();var fs_extra=require(_0xa627('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa627('0x6'));var config=require('../../config/environment');var controller=require(_0xa627('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa627('0x8')]);router[_0xa627('0x9')](_0xa627('0xa'),auth[_0xa627('0xb')](),controller[_0xa627('0xc')]);router['get'](_0xa627('0xd'),auth[_0xa627('0xb')](),controller[_0xa627('0xe')]);router[_0xa627('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xa627('0xf')]);router[_0xa627('0x9')](_0xa627('0x10'),auth['isAuthenticated'](),controller[_0xa627('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa627('0x12')](_0xa627('0xa'),auth[_0xa627('0xb')](),controller[_0xa627('0x13')]);router['delete'](_0xa627('0xa'),auth['isAuthenticated'](),controller[_0xa627('0x14')]);module[_0xa627('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 0803ad6..d2532a0 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 _0xabee=['exports','STRING','lead','nothing','ENUM','contact','contact_lead','sequelize'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0xabee,0x1df));var _0xeabe=function(_0x2f4f8f,_0x4394ce){_0x2f4f8f=_0x2f4f8f-0x0;var _0x2b01a1=_0xabee[_0x2f4f8f];return _0x2b01a1;};'use strict';var Sequelize=require(_0xeabe('0x0'));module[_0xeabe('0x1')]={'name':{'type':Sequelize[_0xeabe('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xeabe('0x3'),'contact',_0xeabe('0x4')),'defaultValue':_0xeabe('0x3')},'moduleSearch':{'type':Sequelize[_0xeabe('0x5')]('contact_lead',_0xeabe('0x6'),_0xeabe('0x3')),'defaultValue':_0xeabe('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1a6=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xc1a6,0xc6));var _0x6c1a=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc1a6[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x6c1a('0x0'));module[_0x6c1a('0x1')]={'name':{'type':Sequelize[_0x6c1a('0x2')]},'moduleCreate':{'type':Sequelize[_0x6c1a('0x3')](_0x6c1a('0x4'),'contact',_0x6c1a('0x5')),'defaultValue':_0x6c1a('0x4')},'moduleSearch':{'type':Sequelize[_0x6c1a('0x3')](_0x6c1a('0x6'),'contact',_0x6c1a('0x4')),'defaultValue':_0x6c1a('0x6')},'description':{'type':Sequelize[_0x6c1a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b65d4b0..3f3c340 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 _0x04b1=['sort','where','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','update','destroy','findOne','ZohoField','pick','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2edc16,_0x2b08d1){var _0x5a02f5=function(_0x45ae8c){while(--_0x45ae8c){_0x2edc16['push'](_0x2edc16['shift']());}};_0x5a02f5(++_0x2b08d1);}(_0x04b1,0x154));var _0x104b=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x04b1[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require(_0x104b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x104b('0x1'));var jsonpatch=require(_0x104b('0x2'));var rp=require(_0x104b('0x3'));var moment=require('moment');var BPromise=require(_0x104b('0x4'));var Mustache=require(_0x104b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x104b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x104b('0x7'));var _=require(_0x104b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x104b('0x9'));var deskjs=require(_0x104b('0xa'));var toCsv=require(_0x104b('0x6'));var querystring=require(_0x104b('0xb'));var Papa=require(_0x104b('0xc'));var Redis=require(_0x104b('0xd'));var authService=require(_0x104b('0xe'));var qs=require(_0x104b('0xf'));var as=require(_0x104b('0x10'));var hardwareService=require(_0x104b('0x11'));var logger=require(_0x104b('0x12'))(_0x104b('0x13'));var utils=require('../../config/utils');var config=require(_0x104b('0x14'));var licenseUtil=require(_0x104b('0x15'));var db=require(_0x104b('0x16'))['db'];function respondWithStatusCode(_0x17cc77,_0x4d782a){_0x4d782a=_0x4d782a||0xcc;return function(_0xca3969){if(_0xca3969){return _0x17cc77[_0x104b('0x17')](_0x4d782a);}return _0x17cc77[_0x104b('0x18')](_0x4d782a)[_0x104b('0x19')]();};}function respondWithResult(_0x3141c6,_0x21d05f){_0x21d05f=_0x21d05f||0xc8;return function(_0x58402d){if(_0x58402d){return _0x3141c6[_0x104b('0x18')](_0x21d05f)[_0x104b('0x1a')](_0x58402d);}};}function respondWithFilteredResult(_0x412fc9,_0x54a13a){return function(_0x1917b6){if(_0x1917b6){var _0x4a7951=typeof _0x54a13a[_0x104b('0x1b')]==='undefined'&&typeof _0x54a13a['limit']===_0x104b('0x1c');var _0x1ce337=_0x1917b6['count'];var _0x15407e=_0x4a7951?0x0:_0x54a13a[_0x104b('0x1b')];var _0x4a258a=_0x4a7951?_0x1917b6['count']:_0x54a13a[_0x104b('0x1b')]+_0x54a13a[_0x104b('0x1d')];var _0x5d7ef7;if(_0x4a258a>=_0x1ce337){_0x4a258a=_0x1ce337;_0x5d7ef7=0xc8;}else{_0x5d7ef7=0xce;}_0x412fc9['status'](_0x5d7ef7);return _0x412fc9[_0x104b('0x1e')]('Content-Range',_0x15407e+'-'+_0x4a258a+'/'+_0x1ce337)['json'](_0x1917b6);}return null;};}function patchUpdates(_0xf00bdf){return function(_0x431e7a){try{jsonpatch[_0x104b('0x1f')](_0x431e7a,_0xf00bdf,!![]);}catch(_0x4337c2){return BPromise[_0x104b('0x20')](_0x4337c2);}return _0x431e7a['save']();};}function saveUpdates(_0x328d55,_0x7b1d99){return function(_0x25e5ec){if(_0x25e5ec){return _0x25e5ec['update'](_0x328d55)[_0x104b('0x21')](function(_0x25537a){return _0x25537a;});}return null;};}function removeEntity(_0x363011,_0x20538e){return function(_0x53378b){if(_0x53378b){return _0x53378b['destroy']()[_0x104b('0x21')](function(){_0x363011[_0x104b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55d373,_0x1f48c1){return function(_0x44b255){if(!_0x44b255){_0x55d373[_0x104b('0x17')](0x194);}return _0x44b255;};}function handleError(_0x1f1d95,_0x17eea7){_0x17eea7=_0x17eea7||0x1f4;return function(_0x4e5de1){logger[_0x104b('0x22')](_0x4e5de1[_0x104b('0x23')]);if(_0x4e5de1['name']){delete _0x4e5de1[_0x104b('0x24')];}_0x1f1d95[_0x104b('0x18')](_0x17eea7)[_0x104b('0x25')](_0x4e5de1);};}exports[_0x104b('0x26')]=function(_0xc39158,_0x1f9dd6){var _0x192e85={},_0x19249f={},_0x107a36={'count':0x0,'rows':[]};var _0x411f0=_[_0x104b('0x27')](db[_0x104b('0x28')][_0x104b('0x29')],function(_0x25ea67){return{'name':_0x25ea67[_0x104b('0x2a')],'type':_0x25ea67[_0x104b('0x2b')][_0x104b('0x2c')]};});_0x19249f[_0x104b('0x2d')]=_[_0x104b('0x27')](_0x411f0,_0x104b('0x24'));_0x19249f['query']=_[_0x104b('0x2e')](_0xc39158['query']);_0x19249f[_0x104b('0x2f')]=_['intersection'](_0x19249f[_0x104b('0x2d')],_0x19249f[_0x104b('0x30')]);_0x192e85[_0x104b('0x31')]=_['intersection'](_0x19249f['model'],qs['fields'](_0xc39158['query'][_0x104b('0x32')]));_0x192e85[_0x104b('0x31')]=_0x192e85[_0x104b('0x31')][_0x104b('0x33')]?_0x192e85[_0x104b('0x31')]:_0x19249f['model'];if(!_0xc39158[_0x104b('0x30')][_0x104b('0x34')](_0x104b('0x35'))){_0x192e85[_0x104b('0x1d')]=qs['limit'](_0xc39158[_0x104b('0x30')][_0x104b('0x1d')]);_0x192e85[_0x104b('0x1b')]=qs[_0x104b('0x1b')](_0xc39158[_0x104b('0x30')][_0x104b('0x1b')]);}_0x192e85[_0x104b('0x36')]=qs[_0x104b('0x37')](_0xc39158[_0x104b('0x30')][_0x104b('0x37')]);_0x192e85[_0x104b('0x38')]=qs[_0x104b('0x2f')](_['pick'](_0xc39158[_0x104b('0x30')],_0x19249f['filters']),_0x411f0);if(_0xc39158[_0x104b('0x30')][_0x104b('0x39')]){_0x192e85[_0x104b('0x38')]=_['merge'](_0x192e85[_0x104b('0x38')],{'$or':_['map'](_0x411f0,function(_0x115cab){if(_0x115cab[_0x104b('0x2b')]!=='VIRTUAL'){var _0x2b79d2={};_0x2b79d2[_0x115cab[_0x104b('0x24')]]={'$like':'%'+_0xc39158[_0x104b('0x30')][_0x104b('0x39')]+'%'};return _0x2b79d2;}})});}_0x192e85=_[_0x104b('0x3a')]({},_0x192e85,_0xc39158[_0x104b('0x3b')]);var _0x46bf63={'where':_0x192e85['where']};return db[_0x104b('0x28')]['count'](_0x46bf63)[_0x104b('0x21')](function(_0x4bc231){_0x107a36[_0x104b('0x3c')]=_0x4bc231;if(_0xc39158['query'][_0x104b('0x3d')]){_0x192e85['include']=[{'all':!![]}];}return db[_0x104b('0x28')][_0x104b('0x3e')](_0x192e85);})[_0x104b('0x21')](function(_0x25aae3){_0x107a36[_0x104b('0x3f')]=_0x25aae3;return _0x107a36;})['then'](respondWithFilteredResult(_0x1f9dd6,_0x192e85))[_0x104b('0x40')](handleError(_0x1f9dd6,null));};exports[_0x104b('0x41')]=function(_0x4e72e8,_0x3c6f9d){var _0x1a51c4={'raw':![],'where':{'id':_0x4e72e8[_0x104b('0x42')]['id']}},_0x3b57c7={};_0x3b57c7[_0x104b('0x2d')]=_['keys'](db[_0x104b('0x28')]['rawAttributes']);_0x3b57c7[_0x104b('0x30')]=_[_0x104b('0x2e')](_0x4e72e8['query']);_0x3b57c7[_0x104b('0x2f')]=_[_0x104b('0x43')](_0x3b57c7[_0x104b('0x2d')],_0x3b57c7[_0x104b('0x30')]);_0x1a51c4[_0x104b('0x31')]=_[_0x104b('0x43')](_0x3b57c7[_0x104b('0x2d')],qs[_0x104b('0x32')](_0x4e72e8[_0x104b('0x30')][_0x104b('0x32')]));_0x1a51c4[_0x104b('0x31')]=_0x1a51c4['attributes'][_0x104b('0x33')]?_0x1a51c4[_0x104b('0x31')]:_0x3b57c7[_0x104b('0x2d')];if(_0x4e72e8[_0x104b('0x30')]['includeAll']){_0x1a51c4['include']=[{'all':!![]}];}_0x1a51c4=_[_0x104b('0x3a')]({},_0x1a51c4,_0x4e72e8['options']);return db[_0x104b('0x28')][_0x104b('0x44')](_0x1a51c4)[_0x104b('0x21')](handleEntityNotFound(_0x3c6f9d,null))[_0x104b('0x21')](respondWithResult(_0x3c6f9d,null))[_0x104b('0x40')](handleError(_0x3c6f9d,null));};exports['create']=function(_0x2b8acf,_0x47bc63){return db[_0x104b('0x28')][_0x104b('0x45')](_0x2b8acf[_0x104b('0x46')],{})['then'](respondWithResult(_0x47bc63,0xc9))['catch'](handleError(_0x47bc63,null));};exports[_0x104b('0x47')]=function(_0x3df4fe,_0x21bf9d){if(_0x3df4fe['body']['id']){delete _0x3df4fe[_0x104b('0x46')]['id'];}return db['ZohoConfiguration'][_0x104b('0x44')]({'where':{'id':_0x3df4fe[_0x104b('0x42')]['id']}})[_0x104b('0x21')](handleEntityNotFound(_0x21bf9d,null))[_0x104b('0x21')](saveUpdates(_0x3df4fe[_0x104b('0x46')],null))[_0x104b('0x21')](respondWithResult(_0x21bf9d,null))[_0x104b('0x40')](handleError(_0x21bf9d,null));};exports[_0x104b('0x48')]=function(_0x1839dd,_0x31b0b2){return db['ZohoConfiguration'][_0x104b('0x44')]({'where':{'id':_0x1839dd[_0x104b('0x42')]['id']}})['then'](handleEntityNotFound(_0x31b0b2,null))[_0x104b('0x21')](removeEntity(_0x31b0b2,null))[_0x104b('0x40')](handleError(_0x31b0b2,null));};exports['getFields']=function(_0x1ca5b8,_0x3970ea,_0x280af9){var _0xc30dd3={};var _0x2cbee5={};var _0x1dc320;var _0x5ef132;return db[_0x104b('0x28')][_0x104b('0x49')]({'where':{'id':_0x1ca5b8[_0x104b('0x42')]['id']}})[_0x104b('0x21')](handleEntityNotFound(_0x3970ea,null))[_0x104b('0x21')](function(_0x2733fe){if(_0x2733fe){_0x1dc320=_0x2733fe;_0x2cbee5[_0x104b('0x2d')]=_[_0x104b('0x2e')](db[_0x104b('0x4a')][_0x104b('0x29')]);_0x2cbee5[_0x104b('0x30')]=_[_0x104b('0x2e')](_0x1ca5b8['query']);_0x2cbee5[_0x104b('0x2f')]=_[_0x104b('0x43')](_0x2cbee5[_0x104b('0x2d')],_0x2cbee5[_0x104b('0x30')]);_0xc30dd3[_0x104b('0x31')]=_['intersection'](_0x2cbee5['model'],qs['fields'](_0x1ca5b8['query'][_0x104b('0x32')]));_0xc30dd3[_0x104b('0x31')]=_0xc30dd3['attributes'][_0x104b('0x33')]?_0xc30dd3[_0x104b('0x31')]:_0x2cbee5[_0x104b('0x2d')];_0xc30dd3[_0x104b('0x36')]=qs['sort'](_0x1ca5b8[_0x104b('0x30')]['sort']);_0xc30dd3[_0x104b('0x38')]=qs[_0x104b('0x2f')](_[_0x104b('0x4b')](_0x1ca5b8[_0x104b('0x30')],_0x2cbee5[_0x104b('0x2f')]));if(_0x1ca5b8['query'][_0x104b('0x39')]){_0xc30dd3[_0x104b('0x38')]=_[_0x104b('0x3a')](_0xc30dd3['where'],{'$or':_[_0x104b('0x27')](_0xc30dd3[_0x104b('0x31')],function(_0x1eae01){var _0x1f52b2={};_0x1f52b2[_0x1eae01]={'$like':'%'+_0x1ca5b8['query']['filter']+'%'};return _0x1f52b2;})});}_0xc30dd3=_[_0x104b('0x3a')]({},_0xc30dd3,_0x1ca5b8['options']);return _0x1dc320[_0x104b('0x4c')](_0xc30dd3);}})[_0x104b('0x21')](function(_0x2c11ef){if(_0x2c11ef){_0x5ef132=_0x2c11ef[_0x104b('0x33')];if(!_0x1ca5b8[_0x104b('0x30')]['hasOwnProperty'](_0x104b('0x35'))){_0xc30dd3[_0x104b('0x1d')]=qs[_0x104b('0x1d')](_0x1ca5b8['query'][_0x104b('0x1d')]);_0xc30dd3[_0x104b('0x1b')]=qs[_0x104b('0x1b')](_0x1ca5b8['query']['offset']);}return _0x1dc320[_0x104b('0x4c')](_0xc30dd3);}})['then'](function(_0x27d054){if(_0x27d054){return _0x27d054?{'count':_0x5ef132,'rows':_0x27d054}:null;}})[_0x104b('0x21')](respondWithResult(_0x3970ea,null))[_0x104b('0x40')](handleError(_0x3970ea,null));};exports[_0x104b('0x4d')]=function(_0x10eba0,_0x79d0a3,_0x2fbe71){var _0x1e84f1={};var _0x573e39={};var _0x4d86ac;var _0x4a4add;return db['ZohoConfiguration'][_0x104b('0x49')]({'where':{'id':_0x10eba0[_0x104b('0x42')]['id']}})[_0x104b('0x21')](handleEntityNotFound(_0x79d0a3,null))['then'](function(_0x29584e){if(_0x29584e){_0x4d86ac=_0x29584e;_0x573e39[_0x104b('0x2d')]=_['keys'](db['ZohoField'][_0x104b('0x29')]);_0x573e39[_0x104b('0x30')]=_[_0x104b('0x2e')](_0x10eba0[_0x104b('0x30')]);_0x573e39[_0x104b('0x2f')]=_[_0x104b('0x43')](_0x573e39['model'],_0x573e39[_0x104b('0x30')]);_0x1e84f1[_0x104b('0x31')]=_[_0x104b('0x43')](_0x573e39[_0x104b('0x2d')],qs['fields'](_0x10eba0[_0x104b('0x30')][_0x104b('0x32')]));_0x1e84f1[_0x104b('0x31')]=_0x1e84f1[_0x104b('0x31')][_0x104b('0x33')]?_0x1e84f1['attributes']:_0x573e39[_0x104b('0x2d')];_0x1e84f1[_0x104b('0x36')]=qs['sort'](_0x10eba0['query'][_0x104b('0x37')]);_0x1e84f1[_0x104b('0x38')]=qs[_0x104b('0x2f')](_[_0x104b('0x4b')](_0x10eba0[_0x104b('0x30')],_0x573e39[_0x104b('0x2f')]));if(_0x10eba0[_0x104b('0x30')][_0x104b('0x39')]){_0x1e84f1['where']=_[_0x104b('0x3a')](_0x1e84f1[_0x104b('0x38')],{'$or':_['map'](_0x1e84f1[_0x104b('0x31')],function(_0x32b62e){var _0x1a66ed={};_0x1a66ed[_0x32b62e]={'$like':'%'+_0x10eba0[_0x104b('0x30')]['filter']+'%'};return _0x1a66ed;})});}_0x1e84f1=_[_0x104b('0x3a')]({},_0x1e84f1,_0x10eba0['options']);return _0x4d86ac[_0x104b('0x4d')](_0x1e84f1);}})[_0x104b('0x21')](function(_0x4aacfa){if(_0x4aacfa){_0x4a4add=_0x4aacfa[_0x104b('0x33')];if(!_0x10eba0[_0x104b('0x30')]['hasOwnProperty']('nolimit')){_0x1e84f1[_0x104b('0x1d')]=qs[_0x104b('0x1d')](_0x10eba0[_0x104b('0x30')][_0x104b('0x1d')]);_0x1e84f1['offset']=qs[_0x104b('0x1b')](_0x10eba0['query'][_0x104b('0x1b')]);}return _0x4d86ac[_0x104b('0x4d')](_0x1e84f1);}})[_0x104b('0x21')](function(_0x11854b){if(_0x11854b){return _0x11854b?{'count':_0x4a4add,'rows':_0x11854b}:null;}})[_0x104b('0x21')](respondWithResult(_0x79d0a3,null))[_0x104b('0x40')](handleError(_0x79d0a3,null));};exports[_0x104b('0x4e')]=function(_0x404cf7,_0x31d4ff,_0x1aa6b6){var _0x47e5ee={};var _0x41b62f={};var _0x37b057;var _0x18c412;return db[_0x104b('0x28')]['findOne']({'where':{'id':_0x404cf7['params']['id']}})[_0x104b('0x21')](handleEntityNotFound(_0x31d4ff,null))[_0x104b('0x21')](function(_0x1e41b5){if(_0x1e41b5){_0x37b057=_0x1e41b5;_0x41b62f['model']=_[_0x104b('0x2e')](db[_0x104b('0x4a')][_0x104b('0x29')]);_0x41b62f['query']=_[_0x104b('0x2e')](_0x404cf7['query']);_0x41b62f['filters']=_[_0x104b('0x43')](_0x41b62f[_0x104b('0x2d')],_0x41b62f[_0x104b('0x30')]);_0x47e5ee[_0x104b('0x31')]=_[_0x104b('0x43')](_0x41b62f['model'],qs[_0x104b('0x32')](_0x404cf7[_0x104b('0x30')][_0x104b('0x32')]));_0x47e5ee['attributes']=_0x47e5ee[_0x104b('0x31')][_0x104b('0x33')]?_0x47e5ee['attributes']:_0x41b62f[_0x104b('0x2d')];_0x47e5ee[_0x104b('0x36')]=qs[_0x104b('0x37')](_0x404cf7[_0x104b('0x30')][_0x104b('0x37')]);_0x47e5ee[_0x104b('0x38')]=qs[_0x104b('0x2f')](_[_0x104b('0x4b')](_0x404cf7[_0x104b('0x30')],_0x41b62f[_0x104b('0x2f')]));if(_0x404cf7[_0x104b('0x30')]['filter']){_0x47e5ee[_0x104b('0x38')]=_[_0x104b('0x3a')](_0x47e5ee[_0x104b('0x38')],{'$or':_[_0x104b('0x27')](_0x47e5ee[_0x104b('0x31')],function(_0x4b5ed2){var _0xc3b3fd={};_0xc3b3fd[_0x4b5ed2]={'$like':'%'+_0x404cf7['query'][_0x104b('0x39')]+'%'};return _0xc3b3fd;})});}_0x47e5ee=_['merge']({},_0x47e5ee,_0x404cf7['options']);return _0x37b057[_0x104b('0x4e')](_0x47e5ee);}})[_0x104b('0x21')](function(_0x11ce87){if(_0x11ce87){_0x18c412=_0x11ce87[_0x104b('0x33')];if(!_0x404cf7[_0x104b('0x30')][_0x104b('0x34')](_0x104b('0x35'))){_0x47e5ee[_0x104b('0x1d')]=qs['limit'](_0x404cf7[_0x104b('0x30')][_0x104b('0x1d')]);_0x47e5ee[_0x104b('0x1b')]=qs[_0x104b('0x1b')](_0x404cf7[_0x104b('0x30')][_0x104b('0x1b')]);}return _0x37b057[_0x104b('0x4e')](_0x47e5ee);}})[_0x104b('0x21')](function(_0x67f359){if(_0x67f359){return _0x67f359?{'count':_0x18c412,'rows':_0x67f359}:null;}})[_0x104b('0x21')](respondWithResult(_0x31d4ff,null))[_0x104b('0x40')](handleError(_0x31d4ff,null));}; \ No newline at end of file +var _0xf07b=['includeAll','find','create','update','body','destroy','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','then','sendStatus','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','fields'];(function(_0x13449c,_0x8be6b3){var _0xcf3a68=function(_0x1495cb){while(--_0x1495cb){_0x13449c['push'](_0x13449c['shift']());}};_0xcf3a68(++_0x8be6b3);}(_0xf07b,0x150));var _0xbf07=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf07b[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xbf07('0x0'));var rimraf=require(_0xbf07('0x1'));var zipdir=require(_0xbf07('0x2'));var jsonpatch=require(_0xbf07('0x3'));var rp=require(_0xbf07('0x4'));var moment=require(_0xbf07('0x5'));var BPromise=require(_0xbf07('0x6'));var Mustache=require('mustache');var util=require(_0xbf07('0x7'));var path=require(_0xbf07('0x8'));var sox=require(_0xbf07('0x9'));var csv=require(_0xbf07('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf07('0xb'));var _=require(_0xbf07('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbf07('0xd'));var deskjs=require(_0xbf07('0xe'));var toCsv=require(_0xbf07('0xa'));var querystring=require(_0xbf07('0xf'));var Papa=require('papaparse');var Redis=require(_0xbf07('0x10'));var authService=require(_0xbf07('0x11'));var qs=require(_0xbf07('0x12'));var as=require(_0xbf07('0x13'));var hardwareService=require(_0xbf07('0x14'));var logger=require(_0xbf07('0x15'))('api');var utils=require(_0xbf07('0x16'));var config=require(_0xbf07('0x17'));var licenseUtil=require(_0xbf07('0x18'));var db=require(_0xbf07('0x19'))['db'];function respondWithStatusCode(_0x5a08e6,_0x5be3b6){_0x5be3b6=_0x5be3b6||0xcc;return function(_0x47b825){if(_0x47b825){return _0x5a08e6['sendStatus'](_0x5be3b6);}return _0x5a08e6[_0xbf07('0x1a')](_0x5be3b6)[_0xbf07('0x1b')]();};}function respondWithResult(_0x19fa64,_0x23af17){_0x23af17=_0x23af17||0xc8;return function(_0x2bbbb0){if(_0x2bbbb0){return _0x19fa64[_0xbf07('0x1a')](_0x23af17)[_0xbf07('0x1c')](_0x2bbbb0);}};}function respondWithFilteredResult(_0x4e4b7d,_0x1c2d31){return function(_0x563174){if(_0x563174){var _0x560365=typeof _0x1c2d31[_0xbf07('0x1d')]===_0xbf07('0x1e')&&typeof _0x1c2d31[_0xbf07('0x1f')]==='undefined';var _0x10c46a=_0x563174[_0xbf07('0x20')];var _0x4fa747=_0x560365?0x0:_0x1c2d31[_0xbf07('0x1d')];var _0x696d6b=_0x560365?_0x563174['count']:_0x1c2d31['offset']+_0x1c2d31['limit'];var _0x5e5d41;if(_0x696d6b>=_0x10c46a){_0x696d6b=_0x10c46a;_0x5e5d41=0xc8;}else{_0x5e5d41=0xce;}_0x4e4b7d[_0xbf07('0x1a')](_0x5e5d41);return _0x4e4b7d[_0xbf07('0x21')]('Content-Range',_0x4fa747+'-'+_0x696d6b+'/'+_0x10c46a)[_0xbf07('0x1c')](_0x563174);}return null;};}function patchUpdates(_0x21dd8f){return function(_0x406fa2){try{jsonpatch['apply'](_0x406fa2,_0x21dd8f,!![]);}catch(_0x42dda6){return BPromise[_0xbf07('0x22')](_0x42dda6);}return _0x406fa2[_0xbf07('0x23')]();};}function saveUpdates(_0x5c95ac,_0x3827b1){return function(_0x4f505d){if(_0x4f505d){return _0x4f505d['update'](_0x5c95ac)[_0xbf07('0x24')](function(_0x1ddce1){return _0x1ddce1;});}return null;};}function removeEntity(_0x1178dc,_0x191b60){return function(_0x4f2bb0){if(_0x4f2bb0){return _0x4f2bb0['destroy']()[_0xbf07('0x24')](function(){_0x1178dc['status'](0xcc)[_0xbf07('0x1b')]();});}};}function handleEntityNotFound(_0x1f9798,_0x42bb4b){return function(_0x19d0e3){if(!_0x19d0e3){_0x1f9798[_0xbf07('0x25')](0x194);}return _0x19d0e3;};}function handleError(_0x2327fe,_0x20fb3d){_0x20fb3d=_0x20fb3d||0x1f4;return function(_0x4b4c51){logger['error'](_0x4b4c51['stack']);if(_0x4b4c51['name']){delete _0x4b4c51[_0xbf07('0x26')];}_0x2327fe[_0xbf07('0x1a')](_0x20fb3d)[_0xbf07('0x27')](_0x4b4c51);};}exports[_0xbf07('0x28')]=function(_0x29017f,_0x23cd3b){var _0x56e78e={},_0x2a67ae={},_0x634cb8={'count':0x0,'rows':[]};var _0x5048fd=_[_0xbf07('0x29')](db[_0xbf07('0x2a')][_0xbf07('0x2b')],function(_0x1dc421){return{'name':_0x1dc421[_0xbf07('0x2c')],'type':_0x1dc421[_0xbf07('0x2d')][_0xbf07('0x2e')]};});_0x2a67ae[_0xbf07('0x2f')]=_[_0xbf07('0x29')](_0x5048fd,_0xbf07('0x26'));_0x2a67ae['query']=_[_0xbf07('0x30')](_0x29017f[_0xbf07('0x31')]);_0x2a67ae[_0xbf07('0x32')]=_[_0xbf07('0x33')](_0x2a67ae['model'],_0x2a67ae['query']);_0x56e78e[_0xbf07('0x34')]=_[_0xbf07('0x33')](_0x2a67ae['model'],qs['fields'](_0x29017f[_0xbf07('0x31')]['fields']));_0x56e78e['attributes']=_0x56e78e[_0xbf07('0x34')][_0xbf07('0x35')]?_0x56e78e[_0xbf07('0x34')]:_0x2a67ae[_0xbf07('0x2f')];if(!_0x29017f[_0xbf07('0x31')][_0xbf07('0x36')]('nolimit')){_0x56e78e[_0xbf07('0x1f')]=qs[_0xbf07('0x1f')](_0x29017f[_0xbf07('0x31')][_0xbf07('0x1f')]);_0x56e78e['offset']=qs[_0xbf07('0x1d')](_0x29017f[_0xbf07('0x31')][_0xbf07('0x1d')]);}_0x56e78e[_0xbf07('0x37')]=qs[_0xbf07('0x38')](_0x29017f[_0xbf07('0x31')]['sort']);_0x56e78e['where']=qs['filters'](_[_0xbf07('0x39')](_0x29017f[_0xbf07('0x31')],_0x2a67ae[_0xbf07('0x32')]),_0x5048fd);if(_0x29017f['query'][_0xbf07('0x3a')]){_0x56e78e[_0xbf07('0x3b')]=_[_0xbf07('0x3c')](_0x56e78e[_0xbf07('0x3b')],{'$or':_['map'](_0x5048fd,function(_0x5d9a58){if(_0x5d9a58[_0xbf07('0x2d')]!==_0xbf07('0x3d')){var _0x4eeb23={};_0x4eeb23[_0x5d9a58[_0xbf07('0x26')]]={'$like':'%'+_0x29017f[_0xbf07('0x31')][_0xbf07('0x3a')]+'%'};return _0x4eeb23;}})});}_0x56e78e=_['merge']({},_0x56e78e,_0x29017f[_0xbf07('0x3e')]);var _0x3a48ca={'where':_0x56e78e['where']};return db['ZohoConfiguration'][_0xbf07('0x20')](_0x3a48ca)[_0xbf07('0x24')](function(_0x398126){_0x634cb8['count']=_0x398126;if(_0x29017f['query']['includeAll']){_0x56e78e[_0xbf07('0x3f')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xbf07('0x40')](_0x56e78e);})['then'](function(_0x38e9ea){_0x634cb8['rows']=_0x38e9ea;return _0x634cb8;})[_0xbf07('0x24')](respondWithFilteredResult(_0x23cd3b,_0x56e78e))[_0xbf07('0x41')](handleError(_0x23cd3b,null));};exports[_0xbf07('0x42')]=function(_0x37e41f,_0x24d7f1){var _0x5936dd={'raw':![],'where':{'id':_0x37e41f[_0xbf07('0x43')]['id']}},_0x2a2cdc={};_0x2a2cdc[_0xbf07('0x2f')]=_[_0xbf07('0x30')](db[_0xbf07('0x2a')][_0xbf07('0x2b')]);_0x2a2cdc[_0xbf07('0x31')]=_[_0xbf07('0x30')](_0x37e41f[_0xbf07('0x31')]);_0x2a2cdc[_0xbf07('0x32')]=_[_0xbf07('0x33')](_0x2a2cdc[_0xbf07('0x2f')],_0x2a2cdc[_0xbf07('0x31')]);_0x5936dd[_0xbf07('0x34')]=_['intersection'](_0x2a2cdc[_0xbf07('0x2f')],qs[_0xbf07('0x44')](_0x37e41f[_0xbf07('0x31')]['fields']));_0x5936dd[_0xbf07('0x34')]=_0x5936dd[_0xbf07('0x34')][_0xbf07('0x35')]?_0x5936dd['attributes']:_0x2a2cdc['model'];if(_0x37e41f['query'][_0xbf07('0x45')]){_0x5936dd[_0xbf07('0x3f')]=[{'all':!![]}];}_0x5936dd=_['merge']({},_0x5936dd,_0x37e41f[_0xbf07('0x3e')]);return db[_0xbf07('0x2a')][_0xbf07('0x46')](_0x5936dd)[_0xbf07('0x24')](handleEntityNotFound(_0x24d7f1,null))[_0xbf07('0x24')](respondWithResult(_0x24d7f1,null))[_0xbf07('0x41')](handleError(_0x24d7f1,null));};exports['create']=function(_0x4b3a5c,_0x4c4a55){return db[_0xbf07('0x2a')][_0xbf07('0x47')](_0x4b3a5c['body'],{})[_0xbf07('0x24')](respondWithResult(_0x4c4a55,0xc9))[_0xbf07('0x41')](handleError(_0x4c4a55,null));};exports[_0xbf07('0x48')]=function(_0x1536ed,_0x58347f){if(_0x1536ed[_0xbf07('0x49')]['id']){delete _0x1536ed[_0xbf07('0x49')]['id'];}return db['ZohoConfiguration'][_0xbf07('0x46')]({'where':{'id':_0x1536ed[_0xbf07('0x43')]['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x58347f,null))[_0xbf07('0x24')](saveUpdates(_0x1536ed['body'],null))[_0xbf07('0x24')](respondWithResult(_0x58347f,null))['catch'](handleError(_0x58347f,null));};exports[_0xbf07('0x4a')]=function(_0x32f793,_0x11e33e){return db['ZohoConfiguration'][_0xbf07('0x46')]({'where':{'id':_0x32f793['params']['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x11e33e,null))[_0xbf07('0x24')](removeEntity(_0x11e33e,null))[_0xbf07('0x41')](handleError(_0x11e33e,null));};exports[_0xbf07('0x4b')]=function(_0x2cdd83,_0x5abfb2,_0x14766a){var _0xd725c5={};var _0xb9c481={};var _0x3ee010;var _0x1714cc;return db[_0xbf07('0x2a')][_0xbf07('0x4c')]({'where':{'id':_0x2cdd83[_0xbf07('0x43')]['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x5abfb2,null))['then'](function(_0x2a9653){if(_0x2a9653){_0x3ee010=_0x2a9653;_0xb9c481[_0xbf07('0x2f')]=_[_0xbf07('0x30')](db[_0xbf07('0x4d')][_0xbf07('0x2b')]);_0xb9c481[_0xbf07('0x31')]=_[_0xbf07('0x30')](_0x2cdd83['query']);_0xb9c481[_0xbf07('0x32')]=_[_0xbf07('0x33')](_0xb9c481[_0xbf07('0x2f')],_0xb9c481[_0xbf07('0x31')]);_0xd725c5[_0xbf07('0x34')]=_[_0xbf07('0x33')](_0xb9c481[_0xbf07('0x2f')],qs[_0xbf07('0x44')](_0x2cdd83['query'][_0xbf07('0x44')]));_0xd725c5[_0xbf07('0x34')]=_0xd725c5[_0xbf07('0x34')][_0xbf07('0x35')]?_0xd725c5[_0xbf07('0x34')]:_0xb9c481[_0xbf07('0x2f')];_0xd725c5[_0xbf07('0x37')]=qs['sort'](_0x2cdd83[_0xbf07('0x31')]['sort']);_0xd725c5[_0xbf07('0x3b')]=qs[_0xbf07('0x32')](_[_0xbf07('0x39')](_0x2cdd83['query'],_0xb9c481['filters']));if(_0x2cdd83[_0xbf07('0x31')][_0xbf07('0x3a')]){_0xd725c5[_0xbf07('0x3b')]=_['merge'](_0xd725c5[_0xbf07('0x3b')],{'$or':_[_0xbf07('0x29')](_0xd725c5['attributes'],function(_0x2fc925){var _0x31f082={};_0x31f082[_0x2fc925]={'$like':'%'+_0x2cdd83[_0xbf07('0x31')][_0xbf07('0x3a')]+'%'};return _0x31f082;})});}_0xd725c5=_[_0xbf07('0x3c')]({},_0xd725c5,_0x2cdd83['options']);return _0x3ee010[_0xbf07('0x4b')](_0xd725c5);}})[_0xbf07('0x24')](function(_0x2c0ebd){if(_0x2c0ebd){_0x1714cc=_0x2c0ebd['length'];if(!_0x2cdd83[_0xbf07('0x31')][_0xbf07('0x36')](_0xbf07('0x4e'))){_0xd725c5['limit']=qs['limit'](_0x2cdd83[_0xbf07('0x31')][_0xbf07('0x1f')]);_0xd725c5[_0xbf07('0x1d')]=qs[_0xbf07('0x1d')](_0x2cdd83[_0xbf07('0x31')][_0xbf07('0x1d')]);}return _0x3ee010['getFields'](_0xd725c5);}})[_0xbf07('0x24')](function(_0x2af12e){if(_0x2af12e){return _0x2af12e?{'count':_0x1714cc,'rows':_0x2af12e}:null;}})[_0xbf07('0x24')](respondWithResult(_0x5abfb2,null))[_0xbf07('0x41')](handleError(_0x5abfb2,null));};exports[_0xbf07('0x4f')]=function(_0x547ccc,_0x19b12e,_0x5678ba){var _0x53d2d1={};var _0x430db0={};var _0x2d82bc;var _0x53b0c5;return db[_0xbf07('0x2a')][_0xbf07('0x4c')]({'where':{'id':_0x547ccc['params']['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x19b12e,null))[_0xbf07('0x24')](function(_0x35fc33){if(_0x35fc33){_0x2d82bc=_0x35fc33;_0x430db0[_0xbf07('0x2f')]=_[_0xbf07('0x30')](db[_0xbf07('0x4d')][_0xbf07('0x2b')]);_0x430db0[_0xbf07('0x31')]=_['keys'](_0x547ccc['query']);_0x430db0[_0xbf07('0x32')]=_['intersection'](_0x430db0[_0xbf07('0x2f')],_0x430db0['query']);_0x53d2d1[_0xbf07('0x34')]=_['intersection'](_0x430db0[_0xbf07('0x2f')],qs['fields'](_0x547ccc['query'][_0xbf07('0x44')]));_0x53d2d1[_0xbf07('0x34')]=_0x53d2d1['attributes'][_0xbf07('0x35')]?_0x53d2d1[_0xbf07('0x34')]:_0x430db0[_0xbf07('0x2f')];_0x53d2d1[_0xbf07('0x37')]=qs[_0xbf07('0x38')](_0x547ccc[_0xbf07('0x31')][_0xbf07('0x38')]);_0x53d2d1[_0xbf07('0x3b')]=qs['filters'](_[_0xbf07('0x39')](_0x547ccc[_0xbf07('0x31')],_0x430db0['filters']));if(_0x547ccc['query'][_0xbf07('0x3a')]){_0x53d2d1[_0xbf07('0x3b')]=_[_0xbf07('0x3c')](_0x53d2d1['where'],{'$or':_['map'](_0x53d2d1[_0xbf07('0x34')],function(_0x527939){var _0x3608a2={};_0x3608a2[_0x527939]={'$like':'%'+_0x547ccc[_0xbf07('0x31')]['filter']+'%'};return _0x3608a2;})});}_0x53d2d1=_['merge']({},_0x53d2d1,_0x547ccc['options']);return _0x2d82bc[_0xbf07('0x4f')](_0x53d2d1);}})['then'](function(_0x279871){if(_0x279871){_0x53b0c5=_0x279871['length'];if(!_0x547ccc[_0xbf07('0x31')][_0xbf07('0x36')](_0xbf07('0x4e'))){_0x53d2d1[_0xbf07('0x1f')]=qs[_0xbf07('0x1f')](_0x547ccc[_0xbf07('0x31')][_0xbf07('0x1f')]);_0x53d2d1[_0xbf07('0x1d')]=qs['offset'](_0x547ccc[_0xbf07('0x31')][_0xbf07('0x1d')]);}return _0x2d82bc[_0xbf07('0x4f')](_0x53d2d1);}})[_0xbf07('0x24')](function(_0xa6c9df){if(_0xa6c9df){return _0xa6c9df?{'count':_0x53b0c5,'rows':_0xa6c9df}:null;}})['then'](respondWithResult(_0x19b12e,null))[_0xbf07('0x41')](handleError(_0x19b12e,null));};exports['getDescriptions']=function(_0x539392,_0x230915,_0x3674a4){var _0x15bc45={};var _0x1302e2={};var _0x255646;var _0x1c4f36;return db[_0xbf07('0x2a')][_0xbf07('0x4c')]({'where':{'id':_0x539392[_0xbf07('0x43')]['id']}})[_0xbf07('0x24')](handleEntityNotFound(_0x230915,null))[_0xbf07('0x24')](function(_0x288be9){if(_0x288be9){_0x255646=_0x288be9;_0x1302e2[_0xbf07('0x2f')]=_[_0xbf07('0x30')](db['ZohoField'][_0xbf07('0x2b')]);_0x1302e2['query']=_[_0xbf07('0x30')](_0x539392[_0xbf07('0x31')]);_0x1302e2[_0xbf07('0x32')]=_[_0xbf07('0x33')](_0x1302e2[_0xbf07('0x2f')],_0x1302e2[_0xbf07('0x31')]);_0x15bc45[_0xbf07('0x34')]=_[_0xbf07('0x33')](_0x1302e2[_0xbf07('0x2f')],qs[_0xbf07('0x44')](_0x539392[_0xbf07('0x31')]['fields']));_0x15bc45['attributes']=_0x15bc45['attributes'][_0xbf07('0x35')]?_0x15bc45['attributes']:_0x1302e2[_0xbf07('0x2f')];_0x15bc45[_0xbf07('0x37')]=qs['sort'](_0x539392[_0xbf07('0x31')][_0xbf07('0x38')]);_0x15bc45[_0xbf07('0x3b')]=qs[_0xbf07('0x32')](_[_0xbf07('0x39')](_0x539392[_0xbf07('0x31')],_0x1302e2['filters']));if(_0x539392[_0xbf07('0x31')][_0xbf07('0x3a')]){_0x15bc45['where']=_[_0xbf07('0x3c')](_0x15bc45[_0xbf07('0x3b')],{'$or':_[_0xbf07('0x29')](_0x15bc45[_0xbf07('0x34')],function(_0xc3dcf0){var _0x20599a={};_0x20599a[_0xc3dcf0]={'$like':'%'+_0x539392['query'][_0xbf07('0x3a')]+'%'};return _0x20599a;})});}_0x15bc45=_[_0xbf07('0x3c')]({},_0x15bc45,_0x539392[_0xbf07('0x3e')]);return _0x255646['getDescriptions'](_0x15bc45);}})[_0xbf07('0x24')](function(_0xa130d0){if(_0xa130d0){_0x1c4f36=_0xa130d0[_0xbf07('0x35')];if(!_0x539392[_0xbf07('0x31')][_0xbf07('0x36')](_0xbf07('0x4e'))){_0x15bc45['limit']=qs[_0xbf07('0x1f')](_0x539392[_0xbf07('0x31')]['limit']);_0x15bc45['offset']=qs[_0xbf07('0x1d')](_0x539392[_0xbf07('0x31')][_0xbf07('0x1d')]);}return _0x255646[_0xbf07('0x50')](_0x15bc45);}})['then'](function(_0x2e81cc){if(_0x2e81cc){return _0x2e81cc?{'count':_0x1c4f36,'rows':_0x2e81cc}:null;}})[_0xbf07('0x24')](respondWithResult(_0x230915,null))[_0xbf07('0x41')](handleError(_0x230915,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ee719c8..cb3af68 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 _0xb0c8=['ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x1806d4,_0x47cc68){var _0x392c2c=function(_0x33aaf2){while(--_0x33aaf2){_0x1806d4['push'](_0x1806d4['shift']());}};_0x392c2c(++_0x47cc68);}(_0xb0c8,0x154));var _0x8b0c=function(_0x2e3e32,_0x210115){_0x2e3e32=_0x2e3e32-0x0;var _0x36798c=_0xb0c8[_0x2e3e32];return _0x36798c;};'use strict';var _=require('lodash');var util=require(_0x8b0c('0x0'));var logger=require(_0x8b0c('0x1'))(_0x8b0c('0x2'));var moment=require(_0x8b0c('0x3'));var BPromise=require(_0x8b0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b0c('0x5'));var rimraf=require(_0x8b0c('0x6'));var config=require(_0x8b0c('0x7'));var attributes=require(_0x8b0c('0x8'));module[_0x8b0c('0x9')]=function(_0x4b726c,_0x410662){return _0x4b726c[_0x8b0c('0xa')](_0x8b0c('0xb'),attributes,{'tableName':_0x8b0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x474b=['bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api'];(function(_0x3a1a4f,_0x5bc66d){var _0x1447c8=function(_0x226aeb){while(--_0x226aeb){_0x3a1a4f['push'](_0x3a1a4f['shift']());}};_0x1447c8(++_0x5bc66d);}(_0x474b,0x1dd));var _0xb474=function(_0x553beb,_0x316695){_0x553beb=_0x553beb-0x0;var _0x29b98b=_0x474b[_0x553beb];return _0x29b98b;};'use strict';var _=require(_0xb474('0x0'));var util=require(_0xb474('0x1'));var logger=require('../../config/logger')(_0xb474('0x2'));var moment=require('moment');var BPromise=require(_0xb474('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb474('0x4'));var rimraf=require(_0xb474('0x5'));var config=require(_0xb474('0x6'));var attributes=require(_0xb474('0x7'));module[_0xb474('0x8')]=function(_0x21e374,_0x2ab227){return _0x21e374[_0xb474('0x9')](_0xb474('0xa'),attributes,{'tableName':_0xb474('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index aa98f8d..cb4529c 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 _0xbfa2=['client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbfa2,0x7c));var _0x2bfa=function(_0xe3419e,_0x473824){_0xe3419e=_0xe3419e-0x0;var _0x45d940=_0xbfa2[_0xe3419e];return _0x45d940;};'use strict';var _=require(_0x2bfa('0x0'));var util=require(_0x2bfa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bfa('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bfa('0x3'));var logger=require(_0x2bfa('0x4'))(_0x2bfa('0x5'));var config=require(_0x2bfa('0x6'));var jayson=require(_0x2bfa('0x7'));var client=jayson[_0x2bfa('0x8')][_0x2bfa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xde80ed,_0x238948,_0x301ee0){return new BPromise(function(_0x311d96,_0x415506){return client[_0x2bfa('0xa')](_0xde80ed,_0x301ee0)[_0x2bfa('0xb')](function(_0x1ef844){logger[_0x2bfa('0xc')](_0x2bfa('0xd'),_0x238948,_0x2bfa('0xe'));logger[_0x2bfa('0xf')](_0x2bfa('0x10'),_0x238948,'request\x20sent',JSON[_0x2bfa('0x11')](_0x1ef844));if(_0x1ef844[_0x2bfa('0x12')]){if(_0x1ef844['error'][_0x2bfa('0x13')]===0x1f4){logger[_0x2bfa('0x12')](_0x2bfa('0xd'),_0x238948,_0x1ef844[_0x2bfa('0x12')][_0x2bfa('0x14')]);return _0x415506(_0x1ef844['error']['message']);}logger[_0x2bfa('0x12')](_0x2bfa('0xd'),_0x238948,_0x1ef844[_0x2bfa('0x12')][_0x2bfa('0x14')]);return _0x311d96(_0x1ef844[_0x2bfa('0x12')][_0x2bfa('0x14')]);}else{logger[_0x2bfa('0xc')](_0x2bfa('0xd'),_0x238948,_0x2bfa('0xe'));_0x311d96(_0x1ef844['result']['message']);}})[_0x2bfa('0x15')](function(_0x45d4e2){logger[_0x2bfa('0x12')](_0x2bfa('0xd'),_0x238948,_0x45d4e2);_0x415506(_0x45d4e2);});});} \ No newline at end of file +var _0x9e06=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x1b56a3,_0x417f54){var _0x1e8951=function(_0x4638ca){while(--_0x4638ca){_0x1b56a3['push'](_0x1b56a3['shift']());}};_0x1e8951(++_0x417f54);}(_0x9e06,0x111));var _0x69e0=function(_0x4d565c,_0x40820e){_0x4d565c=_0x4d565c-0x0;var _0x4cf708=_0x9e06[_0x4d565c];return _0x4cf708;};'use strict';var _=require(_0x69e0('0x0'));var util=require(_0x69e0('0x1'));var moment=require(_0x69e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x69e0('0x3'));var fs=require('fs');var Redis=require(_0x69e0('0x4'));var db=require(_0x69e0('0x5'))['db'];var utils=require(_0x69e0('0x6'));var logger=require(_0x69e0('0x7'))(_0x69e0('0x8'));var config=require(_0x69e0('0x9'));var jayson=require(_0x69e0('0xa'));var client=jayson['client'][_0x69e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20483a,_0x238198,_0x440746){return new BPromise(function(_0x197941,_0x3f3e2a){return client[_0x69e0('0xc')](_0x20483a,_0x440746)[_0x69e0('0xd')](function(_0x564b08){logger[_0x69e0('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x238198,'request\x20sent');logger[_0x69e0('0xf')](_0x69e0('0x10'),_0x238198,_0x69e0('0x11'),JSON['stringify'](_0x564b08));if(_0x564b08[_0x69e0('0x12')]){if(_0x564b08[_0x69e0('0x12')][_0x69e0('0x13')]===0x1f4){logger[_0x69e0('0x12')](_0x69e0('0x14'),_0x238198,_0x564b08[_0x69e0('0x12')]['message']);return _0x3f3e2a(_0x564b08[_0x69e0('0x12')]['message']);}logger[_0x69e0('0x12')](_0x69e0('0x14'),_0x238198,_0x564b08[_0x69e0('0x12')]['message']);return _0x197941(_0x564b08[_0x69e0('0x12')][_0x69e0('0x15')]);}else{logger[_0x69e0('0xe')](_0x69e0('0x14'),_0x238198,_0x69e0('0x11'));_0x197941(_0x564b08[_0x69e0('0x16')][_0x69e0('0x15')]);}})['catch'](function(_0x37f4a2){logger[_0x69e0('0x12')](_0x69e0('0x14'),_0x238198,_0x37f4a2);_0x3f3e2a(_0x37f4a2);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e3c4721..38448ff 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 _0x981b=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id','show','post','isAuthenticated','put','update','destroy','exports','multer','util','path'];(function(_0x25c1bd,_0x2b9085){var _0x1eea5f=function(_0x3b720c){while(--_0x3b720c){_0x25c1bd['push'](_0x25c1bd['shift']());}};_0x1eea5f(++_0x2b9085);}(_0x981b,0xd5));var _0xb981=function(_0x2c5e1f,_0x3d30bc){_0x2c5e1f=_0x2c5e1f-0x0;var _0x109461=_0x981b[_0x2c5e1f];return _0x109461;};'use strict';var multer=require(_0xb981('0x0'));var util=require(_0xb981('0x1'));var path=require(_0xb981('0x2'));var timeout=require(_0xb981('0x3'));var express=require('express');var router=express[_0xb981('0x4')]();var fs_extra=require(_0xb981('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb981('0x6'));var config=require(_0xb981('0x7'));var controller=require(_0xb981('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb981('0x9')](_0xb981('0xa'),auth['isAuthenticated'](),controller[_0xb981('0xb')]);router[_0xb981('0xc')]('/',auth[_0xb981('0xd')](),controller['create']);router[_0xb981('0xe')](_0xb981('0xa'),auth['isAuthenticated'](),controller[_0xb981('0xf')]);router['delete'](_0xb981('0xa'),auth['isAuthenticated'](),controller[_0xb981('0x10')]);module[_0xb981('0x11')]=router; \ No newline at end of file +var _0x54cf=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x38acea,_0x2dda64){var _0x2ffc03=function(_0x3c7d80){while(--_0x3c7d80){_0x38acea['push'](_0x38acea['shift']());}};_0x2ffc03(++_0x2dda64);}(_0x54cf,0x1c5));var _0xf54c=function(_0x4ab2b4,_0x15de5f){_0x4ab2b4=_0x4ab2b4-0x0;var _0x1f8db8=_0x54cf[_0x4ab2b4];return _0x1f8db8;};'use strict';var multer=require(_0xf54c('0x0'));var util=require('util');var path=require(_0xf54c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf54c('0x2'));var router=express[_0xf54c('0x3')]();var fs_extra=require(_0xf54c('0x4'));var auth=require(_0xf54c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf54c('0x6'));var controller=require(_0xf54c('0x7'));router[_0xf54c('0x8')]('/',auth[_0xf54c('0x9')](),controller[_0xf54c('0xa')]);router[_0xf54c('0x8')](_0xf54c('0xb'),auth['isAuthenticated'](),controller[_0xf54c('0xc')]);router[_0xf54c('0xd')]('/',auth[_0xf54c('0x9')](),controller['create']);router['put']('/:id',auth[_0xf54c('0x9')](),controller['update']);router[_0xf54c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf54c('0xf')]);module[_0xf54c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 559b938..d632113 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 _0x7777=['string','STRING','ENUM','BOOLEAN','sequelize','exports','customVariable','keyValue','picklist'];(function(_0x55e24e,_0x4d5801){var _0x38898d=function(_0x1725e1){while(--_0x1725e1){_0x55e24e['push'](_0x55e24e['shift']());}};_0x38898d(++_0x4d5801);}(_0x7777,0x1d8));var _0x7777=function(_0x16e248,_0x3acc80){_0x16e248=_0x16e248-0x0;var _0x107821=_0x7777[_0x16e248];return _0x107821;};'use strict';var Sequelize=require(_0x7777('0x0'));module[_0x7777('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x7777('0x2'),_0x7777('0x3'),_0x7777('0x4')),'defaultValue':_0x7777('0x5')},'content':{'type':Sequelize[_0x7777('0x6')]},'key':{'type':Sequelize[_0x7777('0x6')]},'keyType':{'type':Sequelize[_0x7777('0x7')]('string','variable',_0x7777('0x2'))},'keyContent':{'type':Sequelize[_0x7777('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7777('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7777('0x6')]}}; \ No newline at end of file +var _0xc72d=['string','variable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x457050,_0x710c01){var _0x45fd10=function(_0x3f4bee){while(--_0x3f4bee){_0x457050['push'](_0x457050['shift']());}};_0x45fd10(++_0x710c01);}(_0xc72d,0xc7));var _0xdc72=function(_0x30351f,_0x4fbad9){_0x30351f=_0x30351f-0x0;var _0x570350=_0xc72d[_0x30351f];return _0x570350;};'use strict';var Sequelize=require(_0xdc72('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xdc72('0x1'),_0xdc72('0x2'),'customVariable',_0xdc72('0x3'),_0xdc72('0x4')),'defaultValue':_0xdc72('0x1')},'content':{'type':Sequelize[_0xdc72('0x5')]},'key':{'type':Sequelize[_0xdc72('0x5')]},'keyType':{'type':Sequelize[_0xdc72('0x6')]('string',_0xdc72('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xdc72('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdc72('0x5')]},'customField':{'type':Sequelize[_0xdc72('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdc72('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index bba8d92..69f4ff4 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 _0x802a=['includeAll','include','rows','catch','show','length','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0x802a,0xe5));var _0xa802=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x802a[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require(_0xa802('0x0'));var rimraf=require(_0xa802('0x1'));var zipdir=require(_0xa802('0x2'));var jsonpatch=require(_0xa802('0x3'));var rp=require('request-promise');var moment=require(_0xa802('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa802('0x5'));var path=require(_0xa802('0x6'));var sox=require(_0xa802('0x7'));var csv=require(_0xa802('0x8'));var ejs=require(_0xa802('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa802('0xa'));var squel=require('squel');var crypto=require(_0xa802('0xb'));var jsforce=require(_0xa802('0xc'));var deskjs=require(_0xa802('0xd'));var toCsv=require(_0xa802('0x8'));var querystring=require(_0xa802('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa802('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa802('0x10'));var hardwareService=require(_0xa802('0x11'));var logger=require(_0xa802('0x12'))(_0xa802('0x13'));var utils=require(_0xa802('0x14'));var config=require(_0xa802('0x15'));var licenseUtil=require(_0xa802('0x16'));var db=require(_0xa802('0x17'))['db'];function respondWithStatusCode(_0x527853,_0x34bbee){_0x34bbee=_0x34bbee||0xcc;return function(_0x56e947){if(_0x56e947){return _0x527853[_0xa802('0x18')](_0x34bbee);}return _0x527853[_0xa802('0x19')](_0x34bbee)['end']();};}function respondWithResult(_0x1d145d,_0x3b5bba){_0x3b5bba=_0x3b5bba||0xc8;return function(_0x8ef489){if(_0x8ef489){return _0x1d145d[_0xa802('0x19')](_0x3b5bba)[_0xa802('0x1a')](_0x8ef489);}};}function respondWithFilteredResult(_0x3f23f5,_0x490b7c){return function(_0x53e939){if(_0x53e939){var _0x5dbaff=typeof _0x490b7c[_0xa802('0x1b')]===_0xa802('0x1c')&&typeof _0x490b7c[_0xa802('0x1d')]===_0xa802('0x1c');var _0x4e3dd3=_0x53e939[_0xa802('0x1e')];var _0x245cb9=_0x5dbaff?0x0:_0x490b7c[_0xa802('0x1b')];var _0x35fbf2=_0x5dbaff?_0x53e939[_0xa802('0x1e')]:_0x490b7c['offset']+_0x490b7c[_0xa802('0x1d')];var _0x52ecac;if(_0x35fbf2>=_0x4e3dd3){_0x35fbf2=_0x4e3dd3;_0x52ecac=0xc8;}else{_0x52ecac=0xce;}_0x3f23f5[_0xa802('0x19')](_0x52ecac);return _0x3f23f5[_0xa802('0x1f')](_0xa802('0x20'),_0x245cb9+'-'+_0x35fbf2+'/'+_0x4e3dd3)[_0xa802('0x1a')](_0x53e939);}return null;};}function patchUpdates(_0x213c0c){return function(_0x21d633){try{jsonpatch[_0xa802('0x21')](_0x21d633,_0x213c0c,!![]);}catch(_0x4391cc){return BPromise['reject'](_0x4391cc);}return _0x21d633[_0xa802('0x22')]();};}function saveUpdates(_0x235fea,_0x469993){return function(_0x4daadc){if(_0x4daadc){return _0x4daadc[_0xa802('0x23')](_0x235fea)['then'](function(_0x7c8a3d){return _0x7c8a3d;});}return null;};}function removeEntity(_0x51ef76,_0xad1791){return function(_0x1b4d99){if(_0x1b4d99){return _0x1b4d99[_0xa802('0x24')]()[_0xa802('0x25')](function(){_0x51ef76[_0xa802('0x19')](0xcc)[_0xa802('0x26')]();});}};}function handleEntityNotFound(_0x37a5e8,_0x578974){return function(_0x55e06a){if(!_0x55e06a){_0x37a5e8['sendStatus'](0x194);}return _0x55e06a;};}function handleError(_0x3f5f77,_0x3edd86){_0x3edd86=_0x3edd86||0x1f4;return function(_0x1a19fb){logger[_0xa802('0x27')](_0x1a19fb['stack']);if(_0x1a19fb[_0xa802('0x28')]){delete _0x1a19fb[_0xa802('0x28')];}_0x3f5f77[_0xa802('0x19')](_0x3edd86)[_0xa802('0x29')](_0x1a19fb);};}exports[_0xa802('0x2a')]=function(_0xb79b07,_0x36db64){var _0x475ca4={},_0x2d4f23={},_0x4b82a3={'count':0x0,'rows':[]};var _0x86a18d=_[_0xa802('0x2b')](db[_0xa802('0x2c')][_0xa802('0x2d')],function(_0x34afc5){return{'name':_0x34afc5[_0xa802('0x2e')],'type':_0x34afc5[_0xa802('0x2f')]['key']};});_0x2d4f23[_0xa802('0x30')]=_[_0xa802('0x2b')](_0x86a18d,_0xa802('0x28'));_0x2d4f23[_0xa802('0x31')]=_[_0xa802('0x32')](_0xb79b07['query']);_0x2d4f23[_0xa802('0x33')]=_[_0xa802('0x34')](_0x2d4f23[_0xa802('0x30')],_0x2d4f23[_0xa802('0x31')]);_0x475ca4[_0xa802('0x35')]=_[_0xa802('0x34')](_0x2d4f23[_0xa802('0x30')],qs['fields'](_0xb79b07[_0xa802('0x31')][_0xa802('0x36')]));_0x475ca4['attributes']=_0x475ca4[_0xa802('0x35')]['length']?_0x475ca4[_0xa802('0x35')]:_0x2d4f23['model'];if(!_0xb79b07[_0xa802('0x31')][_0xa802('0x37')]('nolimit')){_0x475ca4[_0xa802('0x1d')]=qs[_0xa802('0x1d')](_0xb79b07['query'][_0xa802('0x1d')]);_0x475ca4[_0xa802('0x1b')]=qs['offset'](_0xb79b07['query'][_0xa802('0x1b')]);}_0x475ca4[_0xa802('0x38')]=qs[_0xa802('0x39')](_0xb79b07[_0xa802('0x31')][_0xa802('0x39')]);_0x475ca4[_0xa802('0x3a')]=qs['filters'](_['pick'](_0xb79b07[_0xa802('0x31')],_0x2d4f23[_0xa802('0x33')]),_0x86a18d);if(_0xb79b07['query']['filter']){_0x475ca4['where']=_[_0xa802('0x3b')](_0x475ca4['where'],{'$or':_[_0xa802('0x2b')](_0x86a18d,function(_0x5b4fe3){if(_0x5b4fe3[_0xa802('0x2f')]!==_0xa802('0x3c')){var _0x18758d={};_0x18758d[_0x5b4fe3[_0xa802('0x28')]]={'$like':'%'+_0xb79b07[_0xa802('0x31')][_0xa802('0x3d')]+'%'};return _0x18758d;}})});}_0x475ca4=_['merge']({},_0x475ca4,_0xb79b07[_0xa802('0x3e')]);var _0x1cce9e={'where':_0x475ca4[_0xa802('0x3a')]};return db['ZohoField'][_0xa802('0x1e')](_0x1cce9e)[_0xa802('0x25')](function(_0x5f29bd){_0x4b82a3[_0xa802('0x1e')]=_0x5f29bd;if(_0xb79b07['query'][_0xa802('0x3f')]){_0x475ca4[_0xa802('0x40')]=[{'all':!![]}];}return db[_0xa802('0x2c')]['findAll'](_0x475ca4);})[_0xa802('0x25')](function(_0x323823){_0x4b82a3[_0xa802('0x41')]=_0x323823;return _0x4b82a3;})[_0xa802('0x25')](respondWithFilteredResult(_0x36db64,_0x475ca4))[_0xa802('0x42')](handleError(_0x36db64,null));};exports[_0xa802('0x43')]=function(_0x585eac,_0x48024c){var _0x14eff3={'raw':!![],'where':{'id':_0x585eac['params']['id']}},_0x30d193={};_0x30d193[_0xa802('0x30')]=_['keys'](db['ZohoField'][_0xa802('0x2d')]);_0x30d193[_0xa802('0x31')]=_[_0xa802('0x32')](_0x585eac[_0xa802('0x31')]);_0x30d193[_0xa802('0x33')]=_[_0xa802('0x34')](_0x30d193[_0xa802('0x30')],_0x30d193[_0xa802('0x31')]);_0x14eff3['attributes']=_[_0xa802('0x34')](_0x30d193['model'],qs[_0xa802('0x36')](_0x585eac[_0xa802('0x31')]['fields']));_0x14eff3['attributes']=_0x14eff3[_0xa802('0x35')][_0xa802('0x44')]?_0x14eff3[_0xa802('0x35')]:_0x30d193[_0xa802('0x30')];if(_0x585eac[_0xa802('0x31')]['includeAll']){_0x14eff3['include']=[{'all':!![]}];}_0x14eff3=_[_0xa802('0x3b')]({},_0x14eff3,_0x585eac[_0xa802('0x3e')]);return db[_0xa802('0x2c')]['find'](_0x14eff3)[_0xa802('0x25')](handleEntityNotFound(_0x48024c,null))['then'](respondWithResult(_0x48024c,null))[_0xa802('0x42')](handleError(_0x48024c,null));};exports[_0xa802('0x45')]=function(_0x5ab6a4,_0x1f17ab){return db['ZohoField'][_0xa802('0x45')](_0x5ab6a4[_0xa802('0x46')],{})[_0xa802('0x25')](respondWithResult(_0x1f17ab,0xc9))[_0xa802('0x42')](handleError(_0x1f17ab,null));};exports[_0xa802('0x23')]=function(_0x56edde,_0x4e71c0){if(_0x56edde[_0xa802('0x46')]['id']){delete _0x56edde[_0xa802('0x46')]['id'];}return db[_0xa802('0x2c')][_0xa802('0x47')]({'where':{'id':_0x56edde[_0xa802('0x48')]['id']}})[_0xa802('0x25')](handleEntityNotFound(_0x4e71c0,null))[_0xa802('0x25')](saveUpdates(_0x56edde[_0xa802('0x46')],null))[_0xa802('0x25')](respondWithResult(_0x4e71c0,null))[_0xa802('0x42')](handleError(_0x4e71c0,null));};exports['destroy']=function(_0xc150c9,_0x17e1cf){return db[_0xa802('0x2c')][_0xa802('0x47')]({'where':{'id':_0xc150c9[_0xa802('0x48')]['id']}})[_0xa802('0x25')](handleEntityNotFound(_0x17e1cf,null))[_0xa802('0x25')](removeEntity(_0x17e1cf,null))['catch'](handleError(_0x17e1cf,null));}; \ No newline at end of file +var _0xdc20=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','order','where','filters','pick','filter','VIRTUAL','merge','ZohoField','includeAll','include','rows','catch','show','params','length','create','body','find','rimraf','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3048d2,_0x32fa2d){var _0x34af65=function(_0x4fd64b){while(--_0x4fd64b){_0x3048d2['push'](_0x3048d2['shift']());}};_0x34af65(++_0x32fa2d);}(_0xdc20,0x185));var _0x0dc2=function(_0x208212,_0x2a8a65){_0x208212=_0x208212-0x0;var _0x1c08c9=_0xdc20[_0x208212];return _0x1c08c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0dc2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0dc2('0x1'));var sox=require(_0x0dc2('0x2'));var csv=require(_0x0dc2('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0dc2('0x4'));var _=require('lodash');var squel=require(_0x0dc2('0x5'));var crypto=require(_0x0dc2('0x6'));var jsforce=require(_0x0dc2('0x7'));var deskjs=require(_0x0dc2('0x8'));var toCsv=require('to-csv');var querystring=require(_0x0dc2('0x9'));var Papa=require(_0x0dc2('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0dc2('0xb'));var as=require(_0x0dc2('0xc'));var hardwareService=require(_0x0dc2('0xd'));var logger=require('../../config/logger')(_0x0dc2('0xe'));var utils=require(_0x0dc2('0xf'));var config=require(_0x0dc2('0x10'));var licenseUtil=require(_0x0dc2('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb31ede,_0x2fd8e8){_0x2fd8e8=_0x2fd8e8||0xcc;return function(_0xa5df04){if(_0xa5df04){return _0xb31ede[_0x0dc2('0x12')](_0x2fd8e8);}return _0xb31ede[_0x0dc2('0x13')](_0x2fd8e8)['end']();};}function respondWithResult(_0x38a5ab,_0x4e02be){_0x4e02be=_0x4e02be||0xc8;return function(_0x17ee7a){if(_0x17ee7a){return _0x38a5ab[_0x0dc2('0x13')](_0x4e02be)[_0x0dc2('0x14')](_0x17ee7a);}};}function respondWithFilteredResult(_0x2f3c18,_0x3c8657){return function(_0x277c1c){if(_0x277c1c){var _0x27504b=typeof _0x3c8657[_0x0dc2('0x15')]===_0x0dc2('0x16')&&typeof _0x3c8657[_0x0dc2('0x17')]==='undefined';var _0x5aaa00=_0x277c1c[_0x0dc2('0x18')];var _0x54ab25=_0x27504b?0x0:_0x3c8657[_0x0dc2('0x15')];var _0x1c8dcb=_0x27504b?_0x277c1c[_0x0dc2('0x18')]:_0x3c8657[_0x0dc2('0x15')]+_0x3c8657[_0x0dc2('0x17')];var _0x278a97;if(_0x1c8dcb>=_0x5aaa00){_0x1c8dcb=_0x5aaa00;_0x278a97=0xc8;}else{_0x278a97=0xce;}_0x2f3c18[_0x0dc2('0x13')](_0x278a97);return _0x2f3c18[_0x0dc2('0x19')](_0x0dc2('0x1a'),_0x54ab25+'-'+_0x1c8dcb+'/'+_0x5aaa00)[_0x0dc2('0x14')](_0x277c1c);}return null;};}function patchUpdates(_0x4a7b2c){return function(_0x4982a5){try{jsonpatch['apply'](_0x4982a5,_0x4a7b2c,!![]);}catch(_0x1ace64){return BPromise[_0x0dc2('0x1b')](_0x1ace64);}return _0x4982a5[_0x0dc2('0x1c')]();};}function saveUpdates(_0x253c79,_0x417d5f){return function(_0x3859da){if(_0x3859da){return _0x3859da[_0x0dc2('0x1d')](_0x253c79)['then'](function(_0x1ab1c5){return _0x1ab1c5;});}return null;};}function removeEntity(_0x437469,_0x5dc3bc){return function(_0x1494d0){if(_0x1494d0){return _0x1494d0[_0x0dc2('0x1e')]()[_0x0dc2('0x1f')](function(){_0x437469[_0x0dc2('0x13')](0xcc)[_0x0dc2('0x20')]();});}};}function handleEntityNotFound(_0x5be9a2,_0x3517ff){return function(_0x2e9366){if(!_0x2e9366){_0x5be9a2[_0x0dc2('0x12')](0x194);}return _0x2e9366;};}function handleError(_0x3bd02d,_0xa8b62e){_0xa8b62e=_0xa8b62e||0x1f4;return function(_0x3e17df){logger['error'](_0x3e17df[_0x0dc2('0x21')]);if(_0x3e17df[_0x0dc2('0x22')]){delete _0x3e17df['name'];}_0x3bd02d[_0x0dc2('0x13')](_0xa8b62e)[_0x0dc2('0x23')](_0x3e17df);};}exports[_0x0dc2('0x24')]=function(_0x5ac453,_0x93c3ad){var _0x37cc42={},_0x67f585={},_0x5ddf2b={'count':0x0,'rows':[]};var _0x1dcff3=_[_0x0dc2('0x25')](db['ZohoField'][_0x0dc2('0x26')],function(_0x2efd96){return{'name':_0x2efd96[_0x0dc2('0x27')],'type':_0x2efd96[_0x0dc2('0x28')][_0x0dc2('0x29')]};});_0x67f585['model']=_[_0x0dc2('0x25')](_0x1dcff3,_0x0dc2('0x22'));_0x67f585[_0x0dc2('0x2a')]=_[_0x0dc2('0x2b')](_0x5ac453[_0x0dc2('0x2a')]);_0x67f585['filters']=_[_0x0dc2('0x2c')](_0x67f585['model'],_0x67f585[_0x0dc2('0x2a')]);_0x37cc42[_0x0dc2('0x2d')]=_[_0x0dc2('0x2c')](_0x67f585[_0x0dc2('0x2e')],qs[_0x0dc2('0x2f')](_0x5ac453[_0x0dc2('0x2a')][_0x0dc2('0x2f')]));_0x37cc42['attributes']=_0x37cc42[_0x0dc2('0x2d')]['length']?_0x37cc42[_0x0dc2('0x2d')]:_0x67f585[_0x0dc2('0x2e')];if(!_0x5ac453[_0x0dc2('0x2a')][_0x0dc2('0x30')]('nolimit')){_0x37cc42[_0x0dc2('0x17')]=qs[_0x0dc2('0x17')](_0x5ac453[_0x0dc2('0x2a')][_0x0dc2('0x17')]);_0x37cc42[_0x0dc2('0x15')]=qs[_0x0dc2('0x15')](_0x5ac453[_0x0dc2('0x2a')][_0x0dc2('0x15')]);}_0x37cc42[_0x0dc2('0x31')]=qs['sort'](_0x5ac453[_0x0dc2('0x2a')]['sort']);_0x37cc42[_0x0dc2('0x32')]=qs[_0x0dc2('0x33')](_[_0x0dc2('0x34')](_0x5ac453[_0x0dc2('0x2a')],_0x67f585[_0x0dc2('0x33')]),_0x1dcff3);if(_0x5ac453[_0x0dc2('0x2a')][_0x0dc2('0x35')]){_0x37cc42[_0x0dc2('0x32')]=_['merge'](_0x37cc42['where'],{'$or':_[_0x0dc2('0x25')](_0x1dcff3,function(_0x24c0d1){if(_0x24c0d1[_0x0dc2('0x28')]!==_0x0dc2('0x36')){var _0x51606e={};_0x51606e[_0x24c0d1[_0x0dc2('0x22')]]={'$like':'%'+_0x5ac453[_0x0dc2('0x2a')]['filter']+'%'};return _0x51606e;}})});}_0x37cc42=_[_0x0dc2('0x37')]({},_0x37cc42,_0x5ac453['options']);var _0x376bdc={'where':_0x37cc42['where']};return db[_0x0dc2('0x38')]['count'](_0x376bdc)[_0x0dc2('0x1f')](function(_0x53497b){_0x5ddf2b[_0x0dc2('0x18')]=_0x53497b;if(_0x5ac453['query'][_0x0dc2('0x39')]){_0x37cc42[_0x0dc2('0x3a')]=[{'all':!![]}];}return db[_0x0dc2('0x38')]['findAll'](_0x37cc42);})['then'](function(_0x31e714){_0x5ddf2b[_0x0dc2('0x3b')]=_0x31e714;return _0x5ddf2b;})[_0x0dc2('0x1f')](respondWithFilteredResult(_0x93c3ad,_0x37cc42))[_0x0dc2('0x3c')](handleError(_0x93c3ad,null));};exports[_0x0dc2('0x3d')]=function(_0x259fd8,_0x7005c7){var _0x1d19c8={'raw':!![],'where':{'id':_0x259fd8[_0x0dc2('0x3e')]['id']}},_0x576ab9={};_0x576ab9[_0x0dc2('0x2e')]=_[_0x0dc2('0x2b')](db[_0x0dc2('0x38')][_0x0dc2('0x26')]);_0x576ab9['query']=_[_0x0dc2('0x2b')](_0x259fd8['query']);_0x576ab9[_0x0dc2('0x33')]=_[_0x0dc2('0x2c')](_0x576ab9[_0x0dc2('0x2e')],_0x576ab9[_0x0dc2('0x2a')]);_0x1d19c8[_0x0dc2('0x2d')]=_['intersection'](_0x576ab9['model'],qs[_0x0dc2('0x2f')](_0x259fd8['query'][_0x0dc2('0x2f')]));_0x1d19c8[_0x0dc2('0x2d')]=_0x1d19c8[_0x0dc2('0x2d')][_0x0dc2('0x3f')]?_0x1d19c8[_0x0dc2('0x2d')]:_0x576ab9['model'];if(_0x259fd8[_0x0dc2('0x2a')][_0x0dc2('0x39')]){_0x1d19c8[_0x0dc2('0x3a')]=[{'all':!![]}];}_0x1d19c8=_[_0x0dc2('0x37')]({},_0x1d19c8,_0x259fd8['options']);return db[_0x0dc2('0x38')]['find'](_0x1d19c8)[_0x0dc2('0x1f')](handleEntityNotFound(_0x7005c7,null))['then'](respondWithResult(_0x7005c7,null))[_0x0dc2('0x3c')](handleError(_0x7005c7,null));};exports['create']=function(_0x39a5f2,_0x26bee8){return db[_0x0dc2('0x38')][_0x0dc2('0x40')](_0x39a5f2[_0x0dc2('0x41')],{})['then'](respondWithResult(_0x26bee8,0xc9))[_0x0dc2('0x3c')](handleError(_0x26bee8,null));};exports[_0x0dc2('0x1d')]=function(_0x45b994,_0x44903a){if(_0x45b994[_0x0dc2('0x41')]['id']){delete _0x45b994[_0x0dc2('0x41')]['id'];}return db[_0x0dc2('0x38')]['find']({'where':{'id':_0x45b994['params']['id']}})['then'](handleEntityNotFound(_0x44903a,null))[_0x0dc2('0x1f')](saveUpdates(_0x45b994['body'],null))['then'](respondWithResult(_0x44903a,null))['catch'](handleError(_0x44903a,null));};exports[_0x0dc2('0x1e')]=function(_0x3684a8,_0xad432b){return db[_0x0dc2('0x38')][_0x0dc2('0x42')]({'where':{'id':_0x3684a8[_0x0dc2('0x3e')]['id']}})[_0x0dc2('0x1f')](handleEntityNotFound(_0xad432b,null))['then'](removeEntity(_0xad432b,null))[_0x0dc2('0x3c')](handleError(_0xad432b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7b465ca..b90d23e 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 _0x4bd3=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4bd3,0x174));var _0x34bd=function(_0x35bd23,_0x5ef792){_0x35bd23=_0x35bd23-0x0;var _0x5ac16d=_0x4bd3[_0x35bd23];return _0x5ac16d;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intZohoField.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0xa'),_0x34bd('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','../../config/logger','moment','path','../../config/environment','./intZohoField.attributes','exports'];(function(_0xe30b67,_0x4965b1){var _0xafe76f=function(_0x1e14c8){while(--_0x1e14c8){_0xe30b67['push'](_0xe30b67['shift']());}};_0xafe76f(++_0x4965b1);}(_0xb44a,0x1c2));var _0xab44=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0xb44a[_0x329905];return _0x3aa42;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'paranoid':![],'indexes':[{'name':_0xab44('0x9'),'fields':[_0xab44('0xa'),_0xab44('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index e58e2c7..959b386 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 _0xc3de=['jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x297d24,_0x110aec){var _0x37b651=function(_0x44cb5a){while(--_0x44cb5a){_0x297d24['push'](_0x297d24['shift']());}};_0x37b651(++_0x110aec);}(_0xc3de,0xb8));var _0xec3d=function(_0x245c19,_0x579d1e){_0x245c19=_0x245c19-0x0;var _0x56cfe1=_0xc3de[_0x245c19];return _0x56cfe1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec3d('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec3d('0x1'))['db'];var utils=require(_0xec3d('0x2'));var logger=require(_0xec3d('0x3'))(_0xec3d('0x4'));var config=require(_0xec3d('0x5'));var jayson=require(_0xec3d('0x6'));var client=jayson[_0xec3d('0x7')][_0xec3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x208619,_0x2a7222,_0xc7fcac){return new BPromise(function(_0x3c70d1,_0x1993ff){return client['request'](_0x208619,_0xc7fcac)[_0xec3d('0x9')](function(_0x59a9a7){logger[_0xec3d('0xa')](_0xec3d('0xb'),_0x2a7222,_0xec3d('0xc'));logger['debug'](_0xec3d('0xd'),_0x2a7222,_0xec3d('0xc'),JSON['stringify'](_0x59a9a7));if(_0x59a9a7[_0xec3d('0xe')]){if(_0x59a9a7[_0xec3d('0xe')][_0xec3d('0xf')]===0x1f4){logger[_0xec3d('0xe')](_0xec3d('0xb'),_0x2a7222,_0x59a9a7[_0xec3d('0xe')][_0xec3d('0x10')]);return _0x1993ff(_0x59a9a7[_0xec3d('0xe')][_0xec3d('0x10')]);}logger[_0xec3d('0xe')](_0xec3d('0xb'),_0x2a7222,_0x59a9a7['error'][_0xec3d('0x10')]);return _0x3c70d1(_0x59a9a7['error'][_0xec3d('0x10')]);}else{logger[_0xec3d('0xa')]('ZohoField,\x20%s,\x20%s',_0x2a7222,_0xec3d('0xc'));_0x3c70d1(_0x59a9a7[_0xec3d('0x11')][_0xec3d('0x10')]);}})[_0xec3d('0x12')](function(_0x43e5a8){logger['error'](_0xec3d('0xb'),_0x2a7222,_0x43e5a8);_0x1993ff(_0x43e5a8);});});} \ No newline at end of file +var _0xf71c=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x35adc2,_0x1b6d71){var _0x4606fd=function(_0x5a7a72){while(--_0x5a7a72){_0x35adc2['push'](_0x35adc2['shift']());}};_0x4606fd(++_0x1b6d71);}(_0xf71c,0x100));var _0xcf71=function(_0x579890,_0x400108){_0x579890=_0x579890-0x0;var _0x4ea092=_0xf71c[_0x579890];return _0x4ea092;};'use strict';var _=require('lodash');var util=require(_0xcf71('0x0'));var moment=require(_0xcf71('0x1'));var BPromise=require(_0xcf71('0x2'));var rs=require(_0xcf71('0x3'));var fs=require('fs');var Redis=require(_0xcf71('0x4'));var db=require(_0xcf71('0x5'))['db'];var utils=require(_0xcf71('0x6'));var logger=require(_0xcf71('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf71('0x8'));var client=jayson[_0xcf71('0x9')][_0xcf71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfd6e7d,_0x286226,_0x595c6b){return new BPromise(function(_0x4561ad,_0x4702db){return client[_0xcf71('0xb')](_0xfd6e7d,_0x595c6b)[_0xcf71('0xc')](function(_0x512896){logger[_0xcf71('0xd')](_0xcf71('0xe'),_0x286226,_0xcf71('0xf'));logger[_0xcf71('0x10')](_0xcf71('0x11'),_0x286226,_0xcf71('0xf'),JSON['stringify'](_0x512896));if(_0x512896['error']){if(_0x512896[_0xcf71('0x12')][_0xcf71('0x13')]===0x1f4){logger[_0xcf71('0x12')](_0xcf71('0xe'),_0x286226,_0x512896['error'][_0xcf71('0x14')]);return _0x4702db(_0x512896[_0xcf71('0x12')][_0xcf71('0x14')]);}logger['error'](_0xcf71('0xe'),_0x286226,_0x512896['error'][_0xcf71('0x14')]);return _0x4561ad(_0x512896['error'][_0xcf71('0x14')]);}else{logger[_0xcf71('0xd')]('ZohoField,\x20%s,\x20%s',_0x286226,'request\x20sent');_0x4561ad(_0x512896[_0xcf71('0x15')]['message']);}})[_0xcf71('0x16')](function(_0x557e3f){logger[_0xcf71('0x12')](_0xcf71('0xe'),_0x286226,_0x557e3f);_0x4702db(_0x557e3f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 5a751a0..39d8257 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(_0x2ca970,_0x32fe25){var _0x45f6e8=function(_0x424111){while(--_0x424111){_0x2ca970['push'](_0x2ca970['shift']());}};_0x45f6e8(++_0x32fe25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3e52b9,_0x23ce39){var _0x45985b=function(_0x4008e9){while(--_0x4008e9){_0x3e52b9['push'](_0x3e52b9['shift']());}};_0x45985b(++_0x23ce39);}(_0x70e0,0x17b));var _0x070e=function(_0x3efee7,_0xe78b00){_0x3efee7=_0x3efee7-0x0;var _0x1d27fe=_0x70e0[_0x3efee7];return _0x1d27fe;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index dbc119a..7973bda 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 _0xcb3e=['BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xcb3e,0x79));var _0xecb3=function(_0x1eda88,_0x555454){_0x1eda88=_0x1eda88-0x0;var _0x2eb594=_0xcb3e[_0x1eda88];return _0x2eb594;};'use strict';var Sequelize=require(_0xecb3('0x0'));module['exports']={'name':{'type':Sequelize[_0xecb3('0x1')],'allowNull':![],'unique':_0xecb3('0x2')},'version':{'type':Sequelize[_0xecb3('0x1')],'allowNull':![],'unique':_0xecb3('0x2')},'main':{'type':Sequelize[_0xecb3('0x1')],'defaultValue':_0xecb3('0x3')},'filename':{'type':Sequelize[_0xecb3('0x1')]},'path':{'type':Sequelize[_0xecb3('0x1')]},'type':{'type':Sequelize[_0xecb3('0x1')]},'size':{'type':Sequelize[_0xecb3('0x4')]},'active':{'type':Sequelize[_0xecb3('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xecb3('0x1')]},'logo':{'type':Sequelize[_0xecb3('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xecb3('0x6')},'description':{'type':Sequelize[_0xecb3('0x1')]},'title':{'type':Sequelize[_0xecb3('0x1')]},'remoteUri':{'type':Sequelize[_0xecb3('0x1')]},'link':{'type':Sequelize[_0xecb3('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x94cc=['BOOLEAN','sequelize','exports','STRING','unique_name_and_version','INTEGER'];(function(_0x6b6bf8,_0x45fb67){var _0x49d7eb=function(_0x450381){while(--_0x450381){_0x6b6bf8['push'](_0x6b6bf8['shift']());}};_0x49d7eb(++_0x45fb67);}(_0x94cc,0x133));var _0xc94c=function(_0x531628,_0x130077){_0x531628=_0x531628-0x0;var _0x2769de=_0x94cc[_0x531628];return _0x2769de;};'use strict';var Sequelize=require(_0xc94c('0x0'));module[_0xc94c('0x1')]={'name':{'type':Sequelize[_0xc94c('0x2')],'allowNull':![],'unique':_0xc94c('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc94c('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xc94c('0x2')]},'path':{'type':Sequelize[_0xc94c('0x2')]},'type':{'type':Sequelize[_0xc94c('0x2')]},'size':{'type':Sequelize[_0xc94c('0x4')]},'active':{'type':Sequelize[_0xc94c('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0xc94c('0x2')]},'title':{'type':Sequelize[_0xc94c('0x2')]},'remoteUri':{'type':Sequelize[_0xc94c('0x2')]},'link':{'type':Sequelize[_0xc94c('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 9080153..9576c7b 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 _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x9582,0x95));var _0x2958=function(_0x359420,_0x2fb481){_0x359420=_0x359420-0x0;var _0x561ab2=_0x9582[_0x359420];return _0x561ab2;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x5b04a3,_0xfda4fd){var _0x1adf11=function(_0x9e242a){while(--_0x9e242a){_0x5b04a3['push'](_0x5b04a3['shift']());}};_0x1adf11(++_0xfda4fd);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a284e,_0x5c70c9){_0x4a284e=_0x4a284e-0x0;var _0x4fa611=_0x2ef3[_0x4a284e];return _0x4fa611;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 61c1acd..806c25e 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 _0x6c80=['Integration','integrations','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x218755,_0x242fe6){var _0x3f8cc1=function(_0x4a83bb){while(--_0x4a83bb){_0x218755['push'](_0x218755['shift']());}};_0x3f8cc1(++_0x242fe6);}(_0x6c80,0x110));var _0x06c8=function(_0x59bb9f,_0x29c2b0){_0x59bb9f=_0x59bb9f-0x0;var _0x1f1dbf=_0x6c80[_0x59bb9f];return _0x1f1dbf;};'use strict';var _=require('lodash');var util=require(_0x06c8('0x0'));var logger=require(_0x06c8('0x1'))(_0x06c8('0x2'));var moment=require(_0x06c8('0x3'));var BPromise=require(_0x06c8('0x4'));var rp=require(_0x06c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x06c8('0x6')]=function(_0x35efe6,_0x3237ff){return _0x35efe6[_0x06c8('0x7')](_0x06c8('0x8'),attributes,{'tableName':_0x06c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1330=['request-promise','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','bluebird'];(function(_0x1e3c2f,_0x53b8d1){var _0x40ac24=function(_0x418cbc){while(--_0x418cbc){_0x1e3c2f['push'](_0x1e3c2f['shift']());}};_0x40ac24(++_0x53b8d1);}(_0x1330,0x1e2));var _0x0133=function(_0x588c33,_0xe686f7){_0x588c33=_0x588c33-0x0;var _0x5c639c=_0x1330[_0x588c33];return _0x5c639c;};'use strict';var _=require(_0x0133('0x0'));var util=require(_0x0133('0x1'));var logger=require(_0x0133('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0133('0x3'));var rp=require(_0x0133('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0133('0x5'));module[_0x0133('0x6')]=function(_0xf362ce,_0x28be7b){return _0xf362ce[_0x0133('0x7')](_0x0133('0x8'),attributes,{'tableName':'integrations','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 077b8b4..86a8e96 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x285932,_0xfaae0c){var _0x5331bf=function(_0x91dbf0){while(--_0x91dbf0){_0x285932['push'](_0x285932['shift']());}};_0x5331bf(++_0xfaae0c);}(_0xdb28,0x106));var _0x8db2=function(_0x5038d1,_0xd78478){_0x5038d1=_0x5038d1-0x0;var _0x191973=_0xdb28[_0x5038d1];return _0x191973;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x437d82,_0x57a5bc){var _0x4c455f=function(_0x260c4e){while(--_0x260c4e){_0x437d82['push'](_0x437d82['shift']());}};_0x4c455f(++_0x57a5bc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3aaf7b,_0x239c11){_0x3aaf7b=_0x3aaf7b-0x0;var _0x365b2e=_0x5f2f[_0x3aaf7b];return _0x365b2e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index dc9dfcf..8a1158e 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 _0x896e=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x896e,0x1e9));var _0xe896=function(_0x4974a9,_0x492de7){_0x4974a9=_0x4974a9-0x0;var _0xc9ca46=_0x896e[_0x4974a9];return _0xc9ca46;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['post']('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);router[_0xe896('0x14')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);module[_0xe896('0x16')]=router; \ No newline at end of file +var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x4d6e73,_0xbd9686){var _0x2c30fb=function(_0x4ec461){while(--_0x4ec461){_0x4d6e73['push'](_0x4d6e73['shift']());}};_0x2c30fb(++_0xbd9686);}(_0x2542,0x169));var _0x2254=function(_0x13ca17,_0x542d82){_0x13ca17=_0x13ca17-0x0;var _0x46ab54=_0x2542[_0x13ca17];return _0x46ab54;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index e61d31c..af1f974 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 _0xcfd7=['RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcfd7,0x199));var _0x7cfd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7cfd('0x0'));module['exports']={'integration':{'type':Sequelize[_0x7cfd('0x1')]},'eventChannel':{'type':Sequelize[_0x7cfd('0x1')]},'exitStatus':{'type':Sequelize[_0x7cfd('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x7cfd('0x2')]},'contacts':{'type':Sequelize[_0x7cfd('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7cfd('0x1')]},'calleridname':{'type':Sequelize[_0x7cfd('0x1')]},'queue':{'type':Sequelize[_0x7cfd('0x1')]},'interface':{'type':Sequelize[_0x7cfd('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7cfd('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7cfd('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7cfd('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7cfd('0x2')]},'reason':{'type':Sequelize[_0x7cfd('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x7cfd('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7cfd('0x3')]},'agentdump':{'type':Sequelize[_0x7cfd('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7cfd('0x3')]},'lastevent':{'type':Sequelize[_0x7cfd('0x1')]},'channel':{'type':Sequelize[_0x7cfd('0x1')]},'channelstate':{'type':Sequelize[_0x7cfd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x7cfd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7cfd('0x1')]},'connectedlinename':{'type':Sequelize[_0x7cfd('0x1')]},'language':{'type':Sequelize[_0x7cfd('0x1')]},'accountcode':{'type':Sequelize[_0x7cfd('0x1')]},'context':{'type':Sequelize[_0x7cfd('0x1')]},'exten':{'type':Sequelize[_0x7cfd('0x1')]},'priority':{'type':Sequelize[_0x7cfd('0x1')]},'destchannel':{'type':Sequelize[_0x7cfd('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7cfd('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7cfd('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7cfd('0x1')]},'destlanguage':{'type':Sequelize[_0x7cfd('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7cfd('0x1')]},'destuniqueid':{'type':Sequelize[_0x7cfd('0x1')]},'messageId':{'type':Sequelize[_0x7cfd('0x1')]},'inReplyTo':{'type':Sequelize[_0x7cfd('0x1')]},'subject':{'type':Sequelize[_0x7cfd('0x1')]},'from':{'type':Sequelize[_0x7cfd('0x1')]},'to':{'type':Sequelize[_0x7cfd('0x1')]},'cc':{'type':Sequelize[_0x7cfd('0x1')]},'attachment':{'type':Sequelize[_0x7cfd('0x5')]},'html':{'type':Sequelize[_0x7cfd('0x5')]},'text':{'type':Sequelize[_0x7cfd('0x5')]},'status':{'type':Sequelize[_0x7cfd('0x6')](_0x7cfd('0x7'),_0x7cfd('0x8'),_0x7cfd('0x9'),_0x7cfd('0xa'))},'url':{'type':Sequelize[_0x7cfd('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x7cfd('0x1')]},'projectId':{'type':Sequelize[_0x7cfd('0x2')]}}; \ No newline at end of file +var _0x7417=['FAILED','exports','STRING','INTEGER','BOOLEAN','DATE','TEXT','ENUM','RECEIVED'];(function(_0x1c231b,_0x9203d7){var _0x338079=function(_0x1e292b){while(--_0x1e292b){_0x1c231b['push'](_0x1c231b['shift']());}};_0x338079(++_0x9203d7);}(_0x7417,0x12a));var _0x7741=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7417[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x7741('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x7741('0x1')]},'exitStatus':{'type':Sequelize[_0x7741('0x1')]},'ticketId':{'type':Sequelize[_0x7741('0x1')]},'integrationId':{'type':Sequelize[_0x7741('0x2')]},'contacts':{'type':Sequelize[_0x7741('0x1')]},'uniqueid':{'type':Sequelize[_0x7741('0x1')]},'calleridnum':{'type':Sequelize[_0x7741('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7741('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x7741('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7741('0x2')]},'reason':{'type':Sequelize[_0x7741('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7741('0x4')]},'lastevent':{'type':Sequelize[_0x7741('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x7741('0x2')]},'channelstatedesc':{'type':Sequelize[_0x7741('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7741('0x1')]},'connectedlinename':{'type':Sequelize[_0x7741('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7741('0x1')]},'context':{'type':Sequelize[_0x7741('0x1')]},'exten':{'type':Sequelize[_0x7741('0x1')]},'priority':{'type':Sequelize[_0x7741('0x1')]},'destchannel':{'type':Sequelize[_0x7741('0x1')]},'destchannelstate':{'type':Sequelize[_0x7741('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x7741('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7741('0x1')]},'destcalleridname':{'type':Sequelize[_0x7741('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7741('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7741('0x1')]},'destlanguage':{'type':Sequelize[_0x7741('0x1')]},'destaccountcode':{'type':Sequelize[_0x7741('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x7741('0x1')]},'messageId':{'type':Sequelize[_0x7741('0x1')]},'inReplyTo':{'type':Sequelize[_0x7741('0x1')]},'subject':{'type':Sequelize[_0x7741('0x1')]},'from':{'type':Sequelize[_0x7741('0x1')]},'to':{'type':Sequelize[_0x7741('0x1')]},'cc':{'type':Sequelize[_0x7741('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x7741('0x5')]},'text':{'type':Sequelize[_0x7741('0x5')]},'status':{'type':Sequelize[_0x7741('0x6')]('SENT','SENDING',_0x7741('0x7'),_0x7741('0x8'))},'url':{'type':Sequelize[_0x7741('0x1')]},'app':{'type':Sequelize[_0x7741('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7741('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 76aee52..139701f 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 _0x4c41=['index','map','IntegrationReport','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send'];(function(_0x2f7be9,_0x173b28){var _0x22b2ad=function(_0x2f50e4){while(--_0x2f50e4){_0x2f7be9['push'](_0x2f7be9['shift']());}};_0x22b2ad(++_0x173b28);}(_0x4c41,0x18e));var _0x14c4=function(_0x226f81,_0x394a9a){_0x226f81=_0x226f81-0x0;var _0x143273=_0x4c41[_0x226f81];return _0x143273;};'use strict';var emlformat=require(_0x14c4('0x0'));var rimraf=require(_0x14c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14c4('0x2'));var rp=require('request-promise');var moment=require(_0x14c4('0x3'));var BPromise=require(_0x14c4('0x4'));var Mustache=require(_0x14c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x14c4('0x6'));var csv=require(_0x14c4('0x7'));var ejs=require(_0x14c4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14c4('0x9'));var squel=require(_0x14c4('0xa'));var crypto=require(_0x14c4('0xb'));var jsforce=require(_0x14c4('0xc'));var deskjs=require(_0x14c4('0xd'));var toCsv=require(_0x14c4('0x7'));var querystring=require('querystring');var Papa=require(_0x14c4('0xe'));var Redis=require(_0x14c4('0xf'));var authService=require(_0x14c4('0x10'));var qs=require(_0x14c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14c4('0x12'));var logger=require('../../config/logger')(_0x14c4('0x13'));var utils=require('../../config/utils');var config=require(_0x14c4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x14c4('0x15'))['db'];function respondWithStatusCode(_0x3d5811,_0xfde1f){_0xfde1f=_0xfde1f||0xcc;return function(_0x330b97){if(_0x330b97){return _0x3d5811[_0x14c4('0x16')](_0xfde1f);}return _0x3d5811[_0x14c4('0x17')](_0xfde1f)[_0x14c4('0x18')]();};}function respondWithResult(_0x306811,_0x49718c){_0x49718c=_0x49718c||0xc8;return function(_0x5e2075){if(_0x5e2075){return _0x306811[_0x14c4('0x17')](_0x49718c)['json'](_0x5e2075);}};}function respondWithFilteredResult(_0x23b489,_0x4a2d7c){return function(_0x2add46){if(_0x2add46){var _0x445e3c=typeof _0x4a2d7c['offset']===_0x14c4('0x19')&&typeof _0x4a2d7c[_0x14c4('0x1a')]===_0x14c4('0x19');var _0x164092=_0x2add46['count'];var _0x1819ea=_0x445e3c?0x0:_0x4a2d7c[_0x14c4('0x1b')];var _0x3655c9=_0x445e3c?_0x2add46[_0x14c4('0x1c')]:_0x4a2d7c[_0x14c4('0x1b')]+_0x4a2d7c[_0x14c4('0x1a')];var _0x535f99;if(_0x3655c9>=_0x164092){_0x3655c9=_0x164092;_0x535f99=0xc8;}else{_0x535f99=0xce;}_0x23b489[_0x14c4('0x17')](_0x535f99);return _0x23b489['set'](_0x14c4('0x1d'),_0x1819ea+'-'+_0x3655c9+'/'+_0x164092)[_0x14c4('0x1e')](_0x2add46);}return null;};}function patchUpdates(_0x15aeda){return function(_0x5f7e78){try{jsonpatch[_0x14c4('0x1f')](_0x5f7e78,_0x15aeda,!![]);}catch(_0x3ce7c0){return BPromise[_0x14c4('0x20')](_0x3ce7c0);}return _0x5f7e78[_0x14c4('0x21')]();};}function saveUpdates(_0x3b9f5f,_0x305c22){return function(_0x31569a){if(_0x31569a){return _0x31569a[_0x14c4('0x22')](_0x3b9f5f)[_0x14c4('0x23')](function(_0x12fd4b){return _0x12fd4b;});}return null;};}function removeEntity(_0x11a259,_0x18547d){return function(_0x4f870a){if(_0x4f870a){return _0x4f870a[_0x14c4('0x24')]()[_0x14c4('0x23')](function(){_0x11a259[_0x14c4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x93dc0b,_0x2b2c7b){return function(_0x2f1ebf){if(!_0x2f1ebf){_0x93dc0b['sendStatus'](0x194);}return _0x2f1ebf;};}function handleError(_0x211d00,_0x4d1f42){_0x4d1f42=_0x4d1f42||0x1f4;return function(_0x2f7308){logger['error'](_0x2f7308[_0x14c4('0x25')]);if(_0x2f7308[_0x14c4('0x26')]){delete _0x2f7308[_0x14c4('0x26')];}_0x211d00[_0x14c4('0x17')](_0x4d1f42)[_0x14c4('0x27')](_0x2f7308);};}exports[_0x14c4('0x28')]=function(_0x3f37ae,_0x4a65da){var _0xa9dd0c={},_0x2fc630={},_0x5c3faf={'count':0x0,'rows':[]};var _0x2a78cc=_[_0x14c4('0x29')](db[_0x14c4('0x2a')]['rawAttributes'],function(_0x4d25fd){return{'name':_0x4d25fd[_0x14c4('0x2b')],'type':_0x4d25fd[_0x14c4('0x2c')][_0x14c4('0x2d')]};});_0x2fc630[_0x14c4('0x2e')]=_[_0x14c4('0x29')](_0x2a78cc,_0x14c4('0x26'));_0x2fc630['query']=_[_0x14c4('0x2f')](_0x3f37ae['query']);_0x2fc630[_0x14c4('0x30')]=_[_0x14c4('0x31')](_0x2fc630[_0x14c4('0x2e')],_0x2fc630[_0x14c4('0x32')]);_0xa9dd0c['attributes']=_[_0x14c4('0x31')](_0x2fc630[_0x14c4('0x2e')],qs[_0x14c4('0x33')](_0x3f37ae[_0x14c4('0x32')][_0x14c4('0x33')]));_0xa9dd0c[_0x14c4('0x34')]=_0xa9dd0c[_0x14c4('0x34')]['length']?_0xa9dd0c[_0x14c4('0x34')]:_0x2fc630[_0x14c4('0x2e')];if(!_0x3f37ae[_0x14c4('0x32')]['hasOwnProperty'](_0x14c4('0x35'))){_0xa9dd0c['limit']=qs[_0x14c4('0x1a')](_0x3f37ae[_0x14c4('0x32')][_0x14c4('0x1a')]);_0xa9dd0c[_0x14c4('0x1b')]=qs[_0x14c4('0x1b')](_0x3f37ae[_0x14c4('0x32')]['offset']);}_0xa9dd0c[_0x14c4('0x36')]=qs['sort'](_0x3f37ae[_0x14c4('0x32')][_0x14c4('0x37')]);_0xa9dd0c['where']=qs['filters'](_['pick'](_0x3f37ae[_0x14c4('0x32')],_0x2fc630['filters']),_0x2a78cc);if(_0x3f37ae['query'][_0x14c4('0x38')]){_0xa9dd0c[_0x14c4('0x39')]=_[_0x14c4('0x3a')](_0xa9dd0c[_0x14c4('0x39')],{'$or':_[_0x14c4('0x29')](_0x2a78cc,function(_0x2e4cda){if(_0x2e4cda[_0x14c4('0x2c')]!==_0x14c4('0x3b')){var _0x4cff24={};_0x4cff24[_0x2e4cda[_0x14c4('0x26')]]={'$like':'%'+_0x3f37ae['query'][_0x14c4('0x38')]+'%'};return _0x4cff24;}})});}_0xa9dd0c=_[_0x14c4('0x3a')]({},_0xa9dd0c,_0x3f37ae['options']);var _0x34ca8d={'where':_0xa9dd0c['where']};return db[_0x14c4('0x2a')][_0x14c4('0x1c')](_0x34ca8d)['then'](function(_0x79d861){_0x5c3faf[_0x14c4('0x1c')]=_0x79d861;if(_0x3f37ae[_0x14c4('0x32')][_0x14c4('0x3c')]){_0xa9dd0c['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x14c4('0x3d')](_0xa9dd0c);})[_0x14c4('0x23')](function(_0x458db0){_0x5c3faf[_0x14c4('0x3e')]=_0x458db0;return _0x5c3faf;})[_0x14c4('0x23')](respondWithFilteredResult(_0x4a65da,_0xa9dd0c))[_0x14c4('0x3f')](handleError(_0x4a65da,null));};exports[_0x14c4('0x40')]=function(_0x20ab2e,_0x512499){var _0x2c2d32={'raw':![],'where':{'id':_0x20ab2e[_0x14c4('0x41')]['id']}},_0x5d942e={};_0x5d942e[_0x14c4('0x2e')]=_['keys'](db[_0x14c4('0x2a')][_0x14c4('0x42')]);_0x5d942e[_0x14c4('0x32')]=_['keys'](_0x20ab2e[_0x14c4('0x32')]);_0x5d942e[_0x14c4('0x30')]=_['intersection'](_0x5d942e[_0x14c4('0x2e')],_0x5d942e[_0x14c4('0x32')]);_0x2c2d32[_0x14c4('0x34')]=_['intersection'](_0x5d942e[_0x14c4('0x2e')],qs[_0x14c4('0x33')](_0x20ab2e[_0x14c4('0x32')][_0x14c4('0x33')]));_0x2c2d32[_0x14c4('0x34')]=_0x2c2d32[_0x14c4('0x34')]['length']?_0x2c2d32['attributes']:_0x5d942e[_0x14c4('0x2e')];if(_0x20ab2e[_0x14c4('0x32')][_0x14c4('0x3c')]){_0x2c2d32[_0x14c4('0x43')]=[{'all':!![]}];}_0x2c2d32=_[_0x14c4('0x3a')]({},_0x2c2d32,_0x20ab2e[_0x14c4('0x44')]);return db[_0x14c4('0x2a')][_0x14c4('0x45')](_0x2c2d32)[_0x14c4('0x23')](handleEntityNotFound(_0x512499,null))['then'](respondWithResult(_0x512499,null))[_0x14c4('0x3f')](handleError(_0x512499,null));};exports[_0x14c4('0x46')]=function(_0x557513,_0x2c1d21){return db['IntegrationReport'][_0x14c4('0x46')](_0x557513[_0x14c4('0x47')],{})[_0x14c4('0x23')](respondWithResult(_0x2c1d21,0xc9))[_0x14c4('0x3f')](handleError(_0x2c1d21,null));};exports['update']=function(_0x332958,_0x299c65){if(_0x332958[_0x14c4('0x47')]['id']){delete _0x332958[_0x14c4('0x47')]['id'];}return db[_0x14c4('0x2a')][_0x14c4('0x45')]({'where':{'id':_0x332958[_0x14c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x299c65,null))[_0x14c4('0x23')](saveUpdates(_0x332958[_0x14c4('0x47')],null))[_0x14c4('0x23')](respondWithResult(_0x299c65,null))['catch'](handleError(_0x299c65,null));};exports[_0x14c4('0x24')]=function(_0x45fb32,_0x57a3f5){return db[_0x14c4('0x2a')][_0x14c4('0x45')]({'where':{'id':_0x45fb32[_0x14c4('0x41')]['id']}})[_0x14c4('0x23')](handleEntityNotFound(_0x57a3f5,null))[_0x14c4('0x23')](removeEntity(_0x57a3f5,null))[_0x14c4('0x3f')](handleError(_0x57a3f5,null));};exports[_0x14c4('0x48')]=function(_0xc94b12,_0x342eba){return db[_0x14c4('0x2a')][_0x14c4('0x48')]()[_0x14c4('0x23')](respondWithResult(_0x342eba,null))['catch'](handleError(_0x342eba,null));}; \ No newline at end of file +var _0x74b3=['length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x74b3,0xf5));var _0x374b=function(_0x49a7f4,_0x44ebd2){_0x49a7f4=_0x49a7f4-0x0;var _0x6cf0ad=_0x74b3[_0x49a7f4];return _0x6cf0ad;};'use strict';var emlformat=require(_0x374b('0x0'));var rimraf=require(_0x374b('0x1'));var zipdir=require(_0x374b('0x2'));var jsonpatch=require(_0x374b('0x3'));var rp=require(_0x374b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x374b('0x5'));var path=require(_0x374b('0x6'));var sox=require('sox');var csv=require(_0x374b('0x7'));var ejs=require(_0x374b('0x8'));var fs=require('fs');var fs_extra=require(_0x374b('0x9'));var _=require('lodash');var squel=require(_0x374b('0xa'));var crypto=require(_0x374b('0xb'));var jsforce=require(_0x374b('0xc'));var deskjs=require(_0x374b('0xd'));var toCsv=require(_0x374b('0x7'));var querystring=require(_0x374b('0xe'));var Papa=require('papaparse');var Redis=require(_0x374b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x374b('0x10'));var as=require(_0x374b('0x11'));var hardwareService=require(_0x374b('0x12'));var logger=require(_0x374b('0x13'))(_0x374b('0x14'));var utils=require('../../config/utils');var config=require(_0x374b('0x15'));var licenseUtil=require(_0x374b('0x16'));var db=require(_0x374b('0x17'))['db'];function respondWithStatusCode(_0x29e81b,_0x1bcb8b){_0x1bcb8b=_0x1bcb8b||0xcc;return function(_0x55efc7){if(_0x55efc7){return _0x29e81b['sendStatus'](_0x1bcb8b);}return _0x29e81b[_0x374b('0x18')](_0x1bcb8b)[_0x374b('0x19')]();};}function respondWithResult(_0x3fda68,_0x383171){_0x383171=_0x383171||0xc8;return function(_0x3bdc08){if(_0x3bdc08){return _0x3fda68[_0x374b('0x18')](_0x383171)[_0x374b('0x1a')](_0x3bdc08);}};}function respondWithFilteredResult(_0x4a4a95,_0x115917){return function(_0xb1e965){if(_0xb1e965){var _0x1c60e8=typeof _0x115917[_0x374b('0x1b')]===_0x374b('0x1c')&&typeof _0x115917['limit']===_0x374b('0x1c');var _0x5e119d=_0xb1e965['count'];var _0x20360e=_0x1c60e8?0x0:_0x115917[_0x374b('0x1b')];var _0x105a0c=_0x1c60e8?_0xb1e965['count']:_0x115917[_0x374b('0x1b')]+_0x115917[_0x374b('0x1d')];var _0x192078;if(_0x105a0c>=_0x5e119d){_0x105a0c=_0x5e119d;_0x192078=0xc8;}else{_0x192078=0xce;}_0x4a4a95[_0x374b('0x18')](_0x192078);return _0x4a4a95[_0x374b('0x1e')]('Content-Range',_0x20360e+'-'+_0x105a0c+'/'+_0x5e119d)[_0x374b('0x1a')](_0xb1e965);}return null;};}function patchUpdates(_0x1ef7d1){return function(_0x1731f8){try{jsonpatch[_0x374b('0x1f')](_0x1731f8,_0x1ef7d1,!![]);}catch(_0x50496a){return BPromise[_0x374b('0x20')](_0x50496a);}return _0x1731f8[_0x374b('0x21')]();};}function saveUpdates(_0x2e0c0f,_0x49d16f){return function(_0x3aeddf){if(_0x3aeddf){return _0x3aeddf[_0x374b('0x22')](_0x2e0c0f)['then'](function(_0x5628eb){return _0x5628eb;});}return null;};}function removeEntity(_0x559b73,_0x4142f9){return function(_0x3228fc){if(_0x3228fc){return _0x3228fc[_0x374b('0x23')]()[_0x374b('0x24')](function(){_0x559b73[_0x374b('0x18')](0xcc)[_0x374b('0x19')]();});}};}function handleEntityNotFound(_0x3df0cc,_0x595505){return function(_0x5f14bf){if(!_0x5f14bf){_0x3df0cc['sendStatus'](0x194);}return _0x5f14bf;};}function handleError(_0x23c025,_0x2659db){_0x2659db=_0x2659db||0x1f4;return function(_0x1b2a92){logger[_0x374b('0x25')](_0x1b2a92[_0x374b('0x26')]);if(_0x1b2a92[_0x374b('0x27')]){delete _0x1b2a92[_0x374b('0x27')];}_0x23c025[_0x374b('0x18')](_0x2659db)['send'](_0x1b2a92);};}exports[_0x374b('0x28')]=function(_0x57c610,_0x1e87b6){var _0x1eece7={},_0xac06e8={},_0x5965a8={'count':0x0,'rows':[]};var _0x238774=_[_0x374b('0x29')](db[_0x374b('0x2a')][_0x374b('0x2b')],function(_0x57ba00){return{'name':_0x57ba00[_0x374b('0x2c')],'type':_0x57ba00[_0x374b('0x2d')]['key']};});_0xac06e8[_0x374b('0x2e')]=_[_0x374b('0x29')](_0x238774,_0x374b('0x27'));_0xac06e8[_0x374b('0x2f')]=_[_0x374b('0x30')](_0x57c610[_0x374b('0x2f')]);_0xac06e8['filters']=_[_0x374b('0x31')](_0xac06e8['model'],_0xac06e8[_0x374b('0x2f')]);_0x1eece7[_0x374b('0x32')]=_[_0x374b('0x31')](_0xac06e8[_0x374b('0x2e')],qs['fields'](_0x57c610[_0x374b('0x2f')]['fields']));_0x1eece7['attributes']=_0x1eece7[_0x374b('0x32')][_0x374b('0x33')]?_0x1eece7[_0x374b('0x32')]:_0xac06e8[_0x374b('0x2e')];if(!_0x57c610[_0x374b('0x2f')][_0x374b('0x34')](_0x374b('0x35'))){_0x1eece7[_0x374b('0x1d')]=qs[_0x374b('0x1d')](_0x57c610[_0x374b('0x2f')][_0x374b('0x1d')]);_0x1eece7[_0x374b('0x1b')]=qs[_0x374b('0x1b')](_0x57c610[_0x374b('0x2f')][_0x374b('0x1b')]);}_0x1eece7['order']=qs[_0x374b('0x36')](_0x57c610[_0x374b('0x2f')][_0x374b('0x36')]);_0x1eece7[_0x374b('0x37')]=qs[_0x374b('0x38')](_[_0x374b('0x39')](_0x57c610[_0x374b('0x2f')],_0xac06e8[_0x374b('0x38')]),_0x238774);if(_0x57c610[_0x374b('0x2f')][_0x374b('0x3a')]){_0x1eece7[_0x374b('0x37')]=_[_0x374b('0x3b')](_0x1eece7[_0x374b('0x37')],{'$or':_[_0x374b('0x29')](_0x238774,function(_0x5dd1d2){if(_0x5dd1d2[_0x374b('0x2d')]!==_0x374b('0x3c')){var _0x1cf150={};_0x1cf150[_0x5dd1d2['name']]={'$like':'%'+_0x57c610[_0x374b('0x2f')][_0x374b('0x3a')]+'%'};return _0x1cf150;}})});}_0x1eece7=_['merge']({},_0x1eece7,_0x57c610[_0x374b('0x3d')]);var _0x4662bd={'where':_0x1eece7[_0x374b('0x37')]};return db[_0x374b('0x2a')]['count'](_0x4662bd)[_0x374b('0x24')](function(_0x4b8ae0){_0x5965a8[_0x374b('0x3e')]=_0x4b8ae0;if(_0x57c610[_0x374b('0x2f')][_0x374b('0x3f')]){_0x1eece7[_0x374b('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0x374b('0x41')](_0x1eece7);})[_0x374b('0x24')](function(_0x13efac){_0x5965a8['rows']=_0x13efac;return _0x5965a8;})[_0x374b('0x24')](respondWithFilteredResult(_0x1e87b6,_0x1eece7))[_0x374b('0x42')](handleError(_0x1e87b6,null));};exports[_0x374b('0x43')]=function(_0x199ed4,_0x40943e){var _0xa52ac9={'raw':![],'where':{'id':_0x199ed4['params']['id']}},_0x3ee9c7={};_0x3ee9c7[_0x374b('0x2e')]=_[_0x374b('0x30')](db[_0x374b('0x2a')]['rawAttributes']);_0x3ee9c7[_0x374b('0x2f')]=_[_0x374b('0x30')](_0x199ed4[_0x374b('0x2f')]);_0x3ee9c7[_0x374b('0x38')]=_[_0x374b('0x31')](_0x3ee9c7['model'],_0x3ee9c7[_0x374b('0x2f')]);_0xa52ac9['attributes']=_[_0x374b('0x31')](_0x3ee9c7[_0x374b('0x2e')],qs[_0x374b('0x44')](_0x199ed4[_0x374b('0x2f')][_0x374b('0x44')]));_0xa52ac9[_0x374b('0x32')]=_0xa52ac9['attributes'][_0x374b('0x33')]?_0xa52ac9[_0x374b('0x32')]:_0x3ee9c7['model'];if(_0x199ed4[_0x374b('0x2f')][_0x374b('0x3f')]){_0xa52ac9[_0x374b('0x40')]=[{'all':!![]}];}_0xa52ac9=_[_0x374b('0x3b')]({},_0xa52ac9,_0x199ed4[_0x374b('0x3d')]);return db[_0x374b('0x2a')][_0x374b('0x45')](_0xa52ac9)[_0x374b('0x24')](handleEntityNotFound(_0x40943e,null))[_0x374b('0x24')](respondWithResult(_0x40943e,null))[_0x374b('0x42')](handleError(_0x40943e,null));};exports[_0x374b('0x46')]=function(_0x1b809c,_0x1bbbc0){return db[_0x374b('0x2a')]['create'](_0x1b809c['body'],{})['then'](respondWithResult(_0x1bbbc0,0xc9))['catch'](handleError(_0x1bbbc0,null));};exports[_0x374b('0x22')]=function(_0x516b56,_0x404016){if(_0x516b56[_0x374b('0x47')]['id']){delete _0x516b56[_0x374b('0x47')]['id'];}return db[_0x374b('0x2a')][_0x374b('0x45')]({'where':{'id':_0x516b56[_0x374b('0x48')]['id']}})[_0x374b('0x24')](handleEntityNotFound(_0x404016,null))[_0x374b('0x24')](saveUpdates(_0x516b56['body'],null))['then'](respondWithResult(_0x404016,null))[_0x374b('0x42')](handleError(_0x404016,null));};exports['destroy']=function(_0x5a722a,_0x47ce78){return db[_0x374b('0x2a')][_0x374b('0x45')]({'where':{'id':_0x5a722a[_0x374b('0x48')]['id']}})['then'](handleEntityNotFound(_0x47ce78,null))[_0x374b('0x24')](removeEntity(_0x47ce78,null))[_0x374b('0x42')](handleError(_0x47ce78,null));};exports[_0x374b('0x49')]=function(_0x27dcee,_0x5824ea){return db[_0x374b('0x2a')][_0x374b('0x49')]()[_0x374b('0x24')](respondWithResult(_0x5824ea,null))[_0x374b('0x42')](handleError(_0x5824ea,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 991ce6b..922be0f 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 _0x9a83=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash'];(function(_0x565c4e,_0x1e77f9){var _0x4a167f=function(_0x537269){while(--_0x537269){_0x565c4e['push'](_0x565c4e['shift']());}};_0x4a167f(++_0x1e77f9);}(_0x9a83,0xfb));var _0x39a8=function(_0x1eb82d,_0x1e23cb){_0x1eb82d=_0x1eb82d-0x0;var _0x2c9502=_0x9a83[_0x1eb82d];return _0x2c9502;};'use strict';var _=require(_0x39a8('0x0'));var util=require(_0x39a8('0x1'));var logger=require(_0x39a8('0x2'))(_0x39a8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x39a8('0x4'));var fs=require('fs');var path=require(_0x39a8('0x5'));var rimraf=require(_0x39a8('0x6'));var config=require(_0x39a8('0x7'));var attributes=require(_0x39a8('0x8'));module['exports']=function(_0x31a277,_0x4ce527){return _0x31a277[_0x39a8('0x9')](_0x39a8('0xa'),attributes,{'tableName':_0x39a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x484d=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x5dbf43,_0x488d1b){var _0x54d47e=function(_0x39e823){while(--_0x39e823){_0x5dbf43['push'](_0x5dbf43['shift']());}};_0x54d47e(++_0x488d1b);}(_0x484d,0xa8));var _0xd484=function(_0x15edf1,_0x4b41b2){_0x15edf1=_0x15edf1-0x0;var _0xe7d731=_0x484d[_0x15edf1];return _0xe7d731;};'use strict';var _=require(_0xd484('0x0'));var util=require(_0xd484('0x1'));var logger=require('../../config/logger')(_0xd484('0x2'));var moment=require(_0xd484('0x3'));var BPromise=require(_0xd484('0x4'));var rp=require(_0xd484('0x5'));var fs=require('fs');var path=require(_0xd484('0x6'));var rimraf=require(_0xd484('0x7'));var config=require(_0xd484('0x8'));var attributes=require(_0xd484('0x9'));module[_0xd484('0xa')]=function(_0x29db93,_0x26ba1a){return _0x29db93[_0xd484('0xb')](_0xd484('0xc'),attributes,{'tableName':_0xd484('0xd'),'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 b472d76..493d4b7 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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3a8193,_0x4179fe){var _0x4fb8c7=function(_0x246bee){while(--_0x246bee){_0x3a8193['push'](_0x3a8193['shift']());}};_0x4fb8c7(++_0x4179fe);}(_0x2542,0x169));var _0x2254=function(_0x45e230,_0x3a8cc1){_0x45e230=_0x45e230-0x0;var _0x2dcfc1=_0x2542[_0x45e230];return _0x2dcfc1;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x687b,0x14a));var _0xb687=function(_0xc2c13a,_0x1070d3){_0xc2c13a=_0xc2c13a-0x0;var _0x2b8e2f=_0x687b[_0xc2c13a];return _0x2b8e2f;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 523b90d..3dcd3a7 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 _0xf3ff=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','isAuthenticated','show','getIntervals','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','multer','path'];(function(_0x4a8b9b,_0x21e4e1){var _0x1e50ca=function(_0x276a50){while(--_0x276a50){_0x4a8b9b['push'](_0x4a8b9b['shift']());}};_0x1e50ca(++_0x21e4e1);}(_0xf3ff,0xae));var _0xff3f=function(_0x130467,_0x2702bd){_0x130467=_0x130467-0x0;var _0x5531d6=_0xf3ff[_0x130467];return _0x5531d6;};'use strict';var multer=require(_0xff3f('0x0'));var util=require('util');var path=require(_0xff3f('0x1'));var timeout=require(_0xff3f('0x2'));var express=require(_0xff3f('0x3'));var router=express[_0xff3f('0x4')]();var fs_extra=require(_0xff3f('0x5'));var auth=require(_0xff3f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xff3f('0x7'));var controller=require(_0xff3f('0x8'));router[_0xff3f('0x9')]('/',auth['isAuthenticated'](),controller[_0xff3f('0xa')]);router[_0xff3f('0x9')]('/:id',auth[_0xff3f('0xb')](),controller[_0xff3f('0xc')]);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xff3f('0xd')]);router['post']('/',auth[_0xff3f('0xb')](),controller['create']);router[_0xff3f('0xe')](_0xff3f('0xf'),auth[_0xff3f('0xb')](),controller[_0xff3f('0x10')]);router[_0xff3f('0xe')](_0xff3f('0x11'),auth[_0xff3f('0xb')](),controller[_0xff3f('0x12')]);router[_0xff3f('0x13')](_0xff3f('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xff3f('0x15')](_0xff3f('0x14'),auth[_0xff3f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2e79=['/:id/sub_intervals/create_many','addIntervals','put','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','create','addInterval','post'];(function(_0x372a17,_0x2d0576){var _0x2e0ae8=function(_0x3b451e){while(--_0x3b451e){_0x372a17['push'](_0x372a17['shift']());}};_0x2e0ae8(++_0x2d0576);}(_0x2e79,0xeb));var _0x92e7=function(_0xf95441,_0x3d3cbe){_0xf95441=_0xf95441-0x0;var _0x51bb3b=_0x2e79[_0xf95441];return _0x51bb3b;};'use strict';var multer=require(_0x92e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x92e7('0x1'));var express=require(_0x92e7('0x2'));var router=express[_0x92e7('0x3')]();var fs_extra=require(_0x92e7('0x4'));var auth=require(_0x92e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x92e7('0x6'));var controller=require(_0x92e7('0x7'));router[_0x92e7('0x8')]('/',auth[_0x92e7('0x9')](),controller[_0x92e7('0xa')]);router[_0x92e7('0x8')](_0x92e7('0xb'),auth[_0x92e7('0x9')](),controller['show']);router[_0x92e7('0x8')](_0x92e7('0xc'),auth[_0x92e7('0x9')](),controller[_0x92e7('0xd')]);router['post']('/',auth[_0x92e7('0x9')](),controller[_0x92e7('0xe')]);router['post'](_0x92e7('0xc'),auth[_0x92e7('0x9')](),controller[_0x92e7('0xf')]);router[_0x92e7('0x10')](_0x92e7('0x11'),auth[_0x92e7('0x9')](),controller[_0x92e7('0x12')]);router[_0x92e7('0x13')](_0x92e7('0xb'),auth[_0x92e7('0x9')](),controller['update']);router['delete'](_0x92e7('0xb'),auth[_0x92e7('0x9')](),controller['destroy']);module[_0x92e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3d2b127..1f376cf 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 _0xc16d=['sequelize','exports','STRING'];(function(_0x404b25,_0x22307b){var _0x2f1f47=function(_0x3d03b9){while(--_0x3d03b9){_0x404b25['push'](_0x404b25['shift']());}};_0x2f1f47(++_0x22307b);}(_0xc16d,0x6f));var _0xdc16=function(_0x13b40e,_0x1be7e0){_0x13b40e=_0x13b40e-0x0;var _0xc5daa=_0xc16d[_0x13b40e];return _0xc5daa;};'use strict';var Sequelize=require(_0xdc16('0x0'));module[_0xdc16('0x1')]={'name':{'type':Sequelize[_0xdc16('0x2')]},'description':{'type':Sequelize[_0xdc16('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xb439=['STRING','sequelize'];(function(_0x288597,_0x26053e){var _0x339d77=function(_0x22b4ea){while(--_0x22b4ea){_0x288597['push'](_0x288597['shift']());}};_0x339d77(++_0x26053e);}(_0xb439,0x16d));var _0x9b43=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb439[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x9b43('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b43('0x1')]},'description':{'type':Sequelize[_0x9b43('0x1')]},'interval':{'type':Sequelize[_0x9b43('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index e9a1e95..24b4a9f 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 _0xd912=['../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','error','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Interval','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','getIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x32b105,_0x5ea219){var _0x1264ec=function(_0x56d64a){while(--_0x56d64a){_0x32b105['push'](_0x32b105['shift']());}};_0x1264ec(++_0x5ea219);}(_0xd912,0x9b));var _0x2d91=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd912[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x2d91('0x0'));var rimraf=require(_0x2d91('0x1'));var zipdir=require(_0x2d91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d91('0x3'));var moment=require(_0x2d91('0x4'));var BPromise=require(_0x2d91('0x5'));var Mustache=require(_0x2d91('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2d91('0x7'));var csv=require('to-csv');var ejs=require(_0x2d91('0x8'));var fs=require('fs');var fs_extra=require(_0x2d91('0x9'));var _=require(_0x2d91('0xa'));var squel=require('squel');var crypto=require(_0x2d91('0xb'));var jsforce=require(_0x2d91('0xc'));var deskjs=require(_0x2d91('0xd'));var toCsv=require(_0x2d91('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2d91('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2d91('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d91('0x11'))('api');var utils=require(_0x2d91('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2d91('0x13'));var db=require(_0x2d91('0x14'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x5cc78c,_0x813ae4){_0x813ae4=_0x813ae4||0xcc;return function(_0x1664de){if(_0x1664de){return _0x5cc78c['sendStatus'](_0x813ae4);}return _0x5cc78c[_0x2d91('0x15')](_0x813ae4)[_0x2d91('0x16')]();};}function respondWithResult(_0x236484,_0x10fd08){_0x10fd08=_0x10fd08||0xc8;return function(_0x52355d){if(_0x52355d){return _0x236484[_0x2d91('0x15')](_0x10fd08)['json'](_0x52355d);}};}function respondWithFilteredResult(_0x52208d,_0x234213){return function(_0xe901b3){if(_0xe901b3){var _0x1e8bfc=typeof _0x234213['offset']===_0x2d91('0x17')&&typeof _0x234213[_0x2d91('0x18')]===_0x2d91('0x17');var _0x289cb3=_0xe901b3['count'];var _0x576ebb=_0x1e8bfc?0x0:_0x234213[_0x2d91('0x19')];var _0x56ec69=_0x1e8bfc?_0xe901b3[_0x2d91('0x1a')]:_0x234213[_0x2d91('0x19')]+_0x234213[_0x2d91('0x18')];var _0x4711dd;if(_0x56ec69>=_0x289cb3){_0x56ec69=_0x289cb3;_0x4711dd=0xc8;}else{_0x4711dd=0xce;}_0x52208d[_0x2d91('0x15')](_0x4711dd);return _0x52208d[_0x2d91('0x1b')](_0x2d91('0x1c'),_0x576ebb+'-'+_0x56ec69+'/'+_0x289cb3)[_0x2d91('0x1d')](_0xe901b3);}return null;};}function patchUpdates(_0x21cfda){return function(_0x3c8ff6){try{jsonpatch[_0x2d91('0x1e')](_0x3c8ff6,_0x21cfda,!![]);}catch(_0x22789f){return BPromise[_0x2d91('0x1f')](_0x22789f);}return _0x3c8ff6[_0x2d91('0x20')]();};}function saveUpdates(_0x48873a,_0x1cf339){return function(_0xe14817){if(_0xe14817){return _0xe14817['update'](_0x48873a)[_0x2d91('0x21')](function(_0x2c42c8){return _0x2c42c8;});}return null;};}function removeEntity(_0x51f735,_0x2bdb0f){return function(_0x2872c5){if(_0x2872c5){return _0x2872c5[_0x2d91('0x22')]()['then'](function(){var _0x4becd3=_0x2872c5['get']({'plain':!![]});var _0x5dc791='Intervals';return db[_0x2d91('0x23')][_0x2d91('0x22')]({'where':{'type':_0x5dc791,'resourceId':_0x4becd3['id']}})[_0x2d91('0x21')](function(){return _0x2872c5;});})['then'](function(){_0x51f735['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x590fd4,_0x5b3950){return function(_0xf6e6af){if(!_0xf6e6af){_0x590fd4['sendStatus'](0x194);}return _0xf6e6af;};}function handleError(_0x2fe9a5,_0x37a740){_0x37a740=_0x37a740||0x1f4;return function(_0x376f4a){logger[_0x2d91('0x24')](_0x376f4a['stack']);if(_0x376f4a['name']){delete _0x376f4a[_0x2d91('0x25')];}_0x2fe9a5[_0x2d91('0x15')](_0x37a740)[_0x2d91('0x26')](_0x376f4a);};}exports['index']=function(_0x583e73,_0x2fac2e){var _0x4c8c40={},_0x1405b9={},_0x595d2d={'count':0x0,'rows':[]};var _0x716726=_[_0x2d91('0x27')](db['Interval']['rawAttributes'],function(_0x175631){return{'name':_0x175631[_0x2d91('0x28')],'type':_0x175631[_0x2d91('0x29')][_0x2d91('0x2a')]};});_0x1405b9[_0x2d91('0x2b')]=_['map'](_0x716726,_0x2d91('0x25'));_0x1405b9[_0x2d91('0x2c')]=_[_0x2d91('0x2d')](_0x583e73[_0x2d91('0x2c')]);_0x1405b9[_0x2d91('0x2e')]=_['intersection'](_0x1405b9['model'],_0x1405b9[_0x2d91('0x2c')]);_0x4c8c40[_0x2d91('0x2f')]=_[_0x2d91('0x30')](_0x1405b9[_0x2d91('0x2b')],qs[_0x2d91('0x31')](_0x583e73[_0x2d91('0x2c')][_0x2d91('0x31')]));_0x4c8c40[_0x2d91('0x2f')]=_0x4c8c40[_0x2d91('0x2f')][_0x2d91('0x32')]?_0x4c8c40['attributes']:_0x1405b9[_0x2d91('0x2b')];if(!_0x583e73[_0x2d91('0x2c')][_0x2d91('0x33')](_0x2d91('0x34'))){_0x4c8c40[_0x2d91('0x18')]=qs[_0x2d91('0x18')](_0x583e73[_0x2d91('0x2c')][_0x2d91('0x18')]);_0x4c8c40[_0x2d91('0x19')]=qs[_0x2d91('0x19')](_0x583e73['query'][_0x2d91('0x19')]);}_0x4c8c40['order']=qs[_0x2d91('0x35')](_0x583e73[_0x2d91('0x2c')][_0x2d91('0x35')]);_0x4c8c40[_0x2d91('0x36')]=qs[_0x2d91('0x2e')](_[_0x2d91('0x37')](_0x583e73[_0x2d91('0x2c')],_0x1405b9[_0x2d91('0x2e')]),_0x716726);if(_0x583e73[_0x2d91('0x2c')][_0x2d91('0x38')]){_0x4c8c40['where']=_[_0x2d91('0x39')](_0x4c8c40[_0x2d91('0x36')],{'$or':_[_0x2d91('0x27')](_0x716726,function(_0x57bc9e){if(_0x57bc9e[_0x2d91('0x29')]!=='VIRTUAL'){var _0x4434fb={};_0x4434fb[_0x57bc9e[_0x2d91('0x25')]]={'$like':'%'+_0x583e73[_0x2d91('0x2c')][_0x2d91('0x38')]+'%'};return _0x4434fb;}})});}_0x4c8c40=_['merge']({},_0x4c8c40,_0x583e73[_0x2d91('0x3a')]);var _0x1684c4={'where':_0x4c8c40[_0x2d91('0x36')]};return db[_0x2d91('0x3b')][_0x2d91('0x1a')](_0x1684c4)[_0x2d91('0x21')](function(_0x40e71a){_0x595d2d[_0x2d91('0x1a')]=_0x40e71a;if(_0x583e73[_0x2d91('0x2c')][_0x2d91('0x3c')]){_0x4c8c40[_0x2d91('0x3d')]=[{'all':!![]}];}return db[_0x2d91('0x3b')][_0x2d91('0x3e')](_0x4c8c40);})[_0x2d91('0x21')](function(_0x40bc8d){_0x595d2d[_0x2d91('0x3f')]=_0x40bc8d;return _0x595d2d;})[_0x2d91('0x21')](respondWithFilteredResult(_0x2fac2e,_0x4c8c40))[_0x2d91('0x40')](handleError(_0x2fac2e,null));};exports[_0x2d91('0x41')]=function(_0x445f5f,_0x2c09f6){var _0x54ffca={'raw':!![],'where':{'id':_0x445f5f[_0x2d91('0x42')]['id']}},_0x3bd536={};_0x3bd536[_0x2d91('0x2b')]=_['keys'](db[_0x2d91('0x3b')][_0x2d91('0x43')]);_0x3bd536[_0x2d91('0x2c')]=_['keys'](_0x445f5f[_0x2d91('0x2c')]);_0x3bd536[_0x2d91('0x2e')]=_['intersection'](_0x3bd536[_0x2d91('0x2b')],_0x3bd536[_0x2d91('0x2c')]);_0x54ffca[_0x2d91('0x2f')]=_[_0x2d91('0x30')](_0x3bd536[_0x2d91('0x2b')],qs[_0x2d91('0x31')](_0x445f5f[_0x2d91('0x2c')][_0x2d91('0x31')]));_0x54ffca[_0x2d91('0x2f')]=_0x54ffca['attributes'][_0x2d91('0x32')]?_0x54ffca[_0x2d91('0x2f')]:_0x3bd536[_0x2d91('0x2b')];if(_0x445f5f['query'][_0x2d91('0x3c')]){_0x54ffca[_0x2d91('0x3d')]=[{'all':!![]}];}_0x54ffca=_[_0x2d91('0x39')]({},_0x54ffca,_0x445f5f[_0x2d91('0x3a')]);return db[_0x2d91('0x3b')][_0x2d91('0x44')](_0x54ffca)[_0x2d91('0x21')](handleEntityNotFound(_0x2c09f6,null))[_0x2d91('0x21')](respondWithResult(_0x2c09f6,null))[_0x2d91('0x40')](handleError(_0x2c09f6,null));};exports[_0x2d91('0x45')]=function(_0x1aadc6,_0x4e60b0){return db[_0x2d91('0x3b')][_0x2d91('0x45')](_0x1aadc6[_0x2d91('0x46')],{})[_0x2d91('0x21')](function(_0x3471b6){var _0x25568f=_0x1aadc6[_0x2d91('0x47')]['get']({'plain':!![]});if(!_0x25568f)throw new Error(_0x2d91('0x48'));if(_0x25568f[_0x2d91('0x49')]===_0x2d91('0x47')){var _0x311e8f=_0x3471b6[_0x2d91('0x4a')]({'plain':!![]});var _0x1b163b=_0x2d91('0x4b');return db[_0x2d91('0x4c')][_0x2d91('0x44')]({'where':{'name':_0x1b163b,'userProfileId':_0x25568f[_0x2d91('0x4d')]},'raw':!![]})['then'](function(_0x310a4a){if(_0x310a4a&&_0x310a4a[_0x2d91('0x4e')]===0x0){return db[_0x2d91('0x23')][_0x2d91('0x45')]({'name':_0x311e8f['name'],'resourceId':_0x311e8f['id'],'type':_0x310a4a[_0x2d91('0x25')],'sectionId':_0x310a4a['id']},{})[_0x2d91('0x21')](function(){return _0x3471b6;});}else{return _0x3471b6;}})[_0x2d91('0x40')](function(_0x4e7c3c){logger[_0x2d91('0x24')](_0x2d91('0x4f'),_0x4e7c3c);throw _0x4e7c3c;});}return _0x3471b6;})['then'](respondWithResult(_0x4e60b0,0xc9))[_0x2d91('0x40')](handleError(_0x4e60b0,null));};exports['update']=function(_0x190362,_0x28138e){if(_0x190362[_0x2d91('0x46')]['id']){delete _0x190362['body']['id'];}return db[_0x2d91('0x3b')][_0x2d91('0x44')]({'where':{'id':_0x190362[_0x2d91('0x42')]['id']}})[_0x2d91('0x21')](handleEntityNotFound(_0x28138e,null))[_0x2d91('0x21')](saveUpdates(_0x190362['body'],null))['then'](respondWithResult(_0x28138e,null))[_0x2d91('0x40')](handleError(_0x28138e,null));};exports[_0x2d91('0x22')]=function(_0x45b4ab,_0xcc7900){return db[_0x2d91('0x3b')]['find']({'where':{'id':_0x45b4ab[_0x2d91('0x42')]['id']}})[_0x2d91('0x21')](handleEntityNotFound(_0xcc7900,null))['then'](removeEntity(_0xcc7900,null))['catch'](handleError(_0xcc7900,null));};exports[_0x2d91('0x50')]=function(_0x48327e,_0x2ea2b9,_0x14b47a){if(_0x48327e[_0x2d91('0x46')]['id']){delete _0x48327e[_0x2d91('0x46')]['id'];}return db[_0x2d91('0x3b')][_0x2d91('0x44')]({'where':{'id':_0x48327e['params']['id']}})[_0x2d91('0x21')](handleEntityNotFound(_0x2ea2b9,null))[_0x2d91('0x21')](function(_0x2c27b5){if(_0x2c27b5){_0x48327e['body'][_0x2d91('0x51')]=_0x2c27b5['id'];return db[_0x2d91('0x3b')][_0x2d91('0x45')](_0x48327e['body']);}})[_0x2d91('0x21')](respondWithResult(_0x2ea2b9,null))['catch'](handleError(_0x2ea2b9,null));};exports['getIntervals']=function(_0x38f39a,_0x3986d4,_0x28362d){var _0x50625f={};var _0x3e2bd3={};var _0x428e4f;var _0x496e75;return db[_0x2d91('0x3b')][_0x2d91('0x52')]({'where':{'id':_0x38f39a[_0x2d91('0x42')]['id']}})[_0x2d91('0x21')](handleEntityNotFound(_0x3986d4,null))[_0x2d91('0x21')](function(_0x59bd02){if(_0x59bd02){_0x428e4f=_0x59bd02;_0x3e2bd3[_0x2d91('0x2b')]=_['keys'](db[_0x2d91('0x3b')][_0x2d91('0x43')]);_0x3e2bd3[_0x2d91('0x2c')]=_[_0x2d91('0x2d')](_0x38f39a[_0x2d91('0x2c')]);_0x3e2bd3[_0x2d91('0x2e')]=_[_0x2d91('0x30')](_0x3e2bd3[_0x2d91('0x2b')],_0x3e2bd3[_0x2d91('0x2c')]);_0x50625f[_0x2d91('0x2f')]=_[_0x2d91('0x30')](_0x3e2bd3['model'],qs[_0x2d91('0x31')](_0x38f39a[_0x2d91('0x2c')][_0x2d91('0x31')]));_0x50625f[_0x2d91('0x2f')]=_0x50625f[_0x2d91('0x2f')][_0x2d91('0x32')]?_0x50625f[_0x2d91('0x2f')]:_0x3e2bd3[_0x2d91('0x2b')];_0x50625f['order']=qs[_0x2d91('0x35')](_0x38f39a[_0x2d91('0x2c')][_0x2d91('0x35')]);_0x50625f[_0x2d91('0x36')]=qs[_0x2d91('0x2e')](_[_0x2d91('0x37')](_0x38f39a['query'],_0x3e2bd3[_0x2d91('0x2e')]));if(_0x38f39a[_0x2d91('0x2c')]['filter']){_0x50625f[_0x2d91('0x36')]=_['merge'](_0x50625f[_0x2d91('0x36')],{'$or':_[_0x2d91('0x27')](_0x50625f[_0x2d91('0x2f')],function(_0x58ce93){var _0x43dccc={};_0x43dccc[_0x58ce93]={'$like':'%'+_0x38f39a[_0x2d91('0x2c')][_0x2d91('0x38')]+'%'};return _0x43dccc;})});}_0x50625f=_[_0x2d91('0x39')]({},_0x50625f,_0x38f39a[_0x2d91('0x3a')]);return _0x428e4f['getIntervals'](_0x50625f);}})[_0x2d91('0x21')](function(_0x3b745b){if(_0x3b745b){_0x496e75=_0x3b745b[_0x2d91('0x32')];if(!_0x38f39a[_0x2d91('0x2c')][_0x2d91('0x33')](_0x2d91('0x34'))){_0x50625f[_0x2d91('0x18')]=qs[_0x2d91('0x18')](_0x38f39a[_0x2d91('0x2c')][_0x2d91('0x18')]);_0x50625f[_0x2d91('0x19')]=qs[_0x2d91('0x19')](_0x38f39a[_0x2d91('0x2c')][_0x2d91('0x19')]);}return _0x428e4f[_0x2d91('0x53')](_0x50625f);}})[_0x2d91('0x21')](function(_0x5f0a60){if(_0x5f0a60){return _0x5f0a60?{'count':_0x496e75,'rows':_0x5f0a60}:null;}})[_0x2d91('0x21')](respondWithResult(_0x3986d4,null))[_0x2d91('0x40')](handleError(_0x3986d4,null));};exports['addIntervals']=function(_0x4e9ed6,_0x37de95,_0x31071d){return db[_0x2d91('0x3b')]['findOne']({'where':{'id':_0x4e9ed6[_0x2d91('0x42')]['id']}})['then'](handleEntityNotFound(_0x37de95,null))[_0x2d91('0x21')](function(_0x28a6ad){if(_0x28a6ad){return db[_0x2d91('0x54')][_0x2d91('0x55')](function(_0x33e946){return db['Interval'][_0x2d91('0x22')]({'where':{'IntervalId':_0x4e9ed6[_0x2d91('0x42')]['id']},'transaction':_0x33e946})['then'](function(_0x23a958){var _0x4beee1=_['map'](_0x4e9ed6['body'],function(_0xfd4be8){delete _0xfd4be8['id'];_0xfd4be8['IntervalId']=_0x4e9ed6[_0x2d91('0x42')]['id'];return _0xfd4be8;});return db['Interval'][_0x2d91('0x56')](_0x4beee1,{'transaction':_0x33e946});});})[_0x2d91('0x21')](function(){return db[_0x2d91('0x3b')][_0x2d91('0x3e')]({'where':{'IntervalId':_0x4e9ed6['params']['id']}});});}})[_0x2d91('0x21')](respondWithResult(_0x37de95,null))['catch'](handleError(_0x37de95,null));}; \ No newline at end of file +var _0xf998=['VIRTUAL','filter','includeAll','include','rows','show','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','map','Interval','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge'];(function(_0x33578f,_0x452cb7){var _0x276e91=function(_0x345b12){while(--_0x345b12){_0x33578f['push'](_0x33578f['shift']());}};_0x276e91(++_0x452cb7);}(_0xf998,0x74));var _0x8f99=function(_0x56e0e5,_0x2e3937){_0x56e0e5=_0x56e0e5-0x0;var _0x27bb15=_0xf998[_0x56e0e5];return _0x27bb15;};'use strict';var emlformat=require(_0x8f99('0x0'));var rimraf=require(_0x8f99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f99('0x2'));var rp=require('request-promise');var moment=require(_0x8f99('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8f99('0x4'));var util=require('util');var path=require(_0x8f99('0x5'));var sox=require(_0x8f99('0x6'));var csv=require('to-csv');var ejs=require(_0x8f99('0x7'));var fs=require('fs');var fs_extra=require(_0x8f99('0x8'));var _=require(_0x8f99('0x9'));var squel=require(_0x8f99('0xa'));var crypto=require(_0x8f99('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8f99('0xc'));var toCsv=require(_0x8f99('0xd'));var querystring=require(_0x8f99('0xe'));var Papa=require(_0x8f99('0xf'));var Redis=require(_0x8f99('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8f99('0x11'));var as=require(_0x8f99('0x12'));var hardwareService=require(_0x8f99('0x13'));var logger=require(_0x8f99('0x14'))(_0x8f99('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8f99('0x16'));var db=require(_0x8f99('0x17'))['db'];var extensions=require(_0x8f99('0x18'));function respondWithStatusCode(_0x51e530,_0x1ea550){_0x1ea550=_0x1ea550||0xcc;return function(_0x6806cb){if(_0x6806cb){return _0x51e530[_0x8f99('0x19')](_0x1ea550);}return _0x51e530[_0x8f99('0x1a')](_0x1ea550)[_0x8f99('0x1b')]();};}function respondWithResult(_0x2fb0d8,_0x1f43a1){_0x1f43a1=_0x1f43a1||0xc8;return function(_0x44e5fb){if(_0x44e5fb){return _0x2fb0d8[_0x8f99('0x1a')](_0x1f43a1)[_0x8f99('0x1c')](_0x44e5fb);}};}function respondWithFilteredResult(_0x13db03,_0x38ec5d){return function(_0x49b579){if(_0x49b579){var _0x34fbff=typeof _0x38ec5d[_0x8f99('0x1d')]===_0x8f99('0x1e')&&typeof _0x38ec5d['limit']===_0x8f99('0x1e');var _0x543dec=_0x49b579[_0x8f99('0x1f')];var _0xcf632a=_0x34fbff?0x0:_0x38ec5d[_0x8f99('0x1d')];var _0x3fcb9c=_0x34fbff?_0x49b579[_0x8f99('0x1f')]:_0x38ec5d[_0x8f99('0x1d')]+_0x38ec5d['limit'];var _0x27d648;if(_0x3fcb9c>=_0x543dec){_0x3fcb9c=_0x543dec;_0x27d648=0xc8;}else{_0x27d648=0xce;}_0x13db03[_0x8f99('0x1a')](_0x27d648);return _0x13db03['set'](_0x8f99('0x20'),_0xcf632a+'-'+_0x3fcb9c+'/'+_0x543dec)[_0x8f99('0x1c')](_0x49b579);}return null;};}function patchUpdates(_0x1f9043){return function(_0x183ad6){try{jsonpatch[_0x8f99('0x21')](_0x183ad6,_0x1f9043,!![]);}catch(_0x2c4e45){return BPromise[_0x8f99('0x22')](_0x2c4e45);}return _0x183ad6[_0x8f99('0x23')]();};}function saveUpdates(_0x585670,_0x24dfa6){return function(_0x28b0aa){if(_0x28b0aa){return _0x28b0aa[_0x8f99('0x24')](_0x585670)[_0x8f99('0x25')](function(_0xd6e0a9){return _0xd6e0a9;});}return null;};}function removeEntity(_0x4ac11f,_0x53aa62){return function(_0x2cf2d9){if(_0x2cf2d9){return _0x2cf2d9['destroy']()['then'](function(){var _0x57b470=_0x2cf2d9[_0x8f99('0x26')]({'plain':!![]});var _0x47fe48=_0x8f99('0x27');return db[_0x8f99('0x28')][_0x8f99('0x29')]({'where':{'type':_0x47fe48,'resourceId':_0x57b470['id']}})['then'](function(){return _0x2cf2d9;});})['then'](function(){_0x4ac11f[_0x8f99('0x1a')](0xcc)[_0x8f99('0x1b')]();});}};}function handleEntityNotFound(_0x350057,_0x440c77){return function(_0x157d96){if(!_0x157d96){_0x350057[_0x8f99('0x19')](0x194);}return _0x157d96;};}function handleError(_0x187eea,_0xf7f6e1){_0xf7f6e1=_0xf7f6e1||0x1f4;return function(_0x418d9f){logger[_0x8f99('0x2a')](_0x418d9f[_0x8f99('0x2b')]);if(_0x418d9f[_0x8f99('0x2c')]){delete _0x418d9f['name'];}_0x187eea[_0x8f99('0x1a')](_0xf7f6e1)[_0x8f99('0x2d')](_0x418d9f);};}exports['index']=function(_0x4246e3,_0x1dc466){var _0x3f4fbf={},_0xab749e={},_0x2ea1ff={'count':0x0,'rows':[]};var _0xf9e1ea=_[_0x8f99('0x2e')](db[_0x8f99('0x2f')][_0x8f99('0x30')],function(_0x1cf115){return{'name':_0x1cf115[_0x8f99('0x31')],'type':_0x1cf115['type']['key']};});_0xab749e[_0x8f99('0x32')]=_[_0x8f99('0x2e')](_0xf9e1ea,_0x8f99('0x2c'));_0xab749e[_0x8f99('0x33')]=_['keys'](_0x4246e3[_0x8f99('0x33')]);_0xab749e[_0x8f99('0x34')]=_[_0x8f99('0x35')](_0xab749e['model'],_0xab749e[_0x8f99('0x33')]);_0x3f4fbf[_0x8f99('0x36')]=_['intersection'](_0xab749e[_0x8f99('0x32')],qs[_0x8f99('0x37')](_0x4246e3['query']['fields']));_0x3f4fbf[_0x8f99('0x36')]=_0x3f4fbf[_0x8f99('0x36')][_0x8f99('0x38')]?_0x3f4fbf[_0x8f99('0x36')]:_0xab749e[_0x8f99('0x32')];if(!_0x4246e3['query'][_0x8f99('0x39')](_0x8f99('0x3a'))){_0x3f4fbf[_0x8f99('0x3b')]=qs[_0x8f99('0x3b')](_0x4246e3[_0x8f99('0x33')][_0x8f99('0x3b')]);_0x3f4fbf[_0x8f99('0x1d')]=qs['offset'](_0x4246e3[_0x8f99('0x33')][_0x8f99('0x1d')]);}_0x3f4fbf[_0x8f99('0x3c')]=qs[_0x8f99('0x3d')](_0x4246e3[_0x8f99('0x33')][_0x8f99('0x3d')]);_0x3f4fbf[_0x8f99('0x3e')]=qs['filters'](_['pick'](_0x4246e3['query'],_0xab749e[_0x8f99('0x34')]),_0xf9e1ea);if(_0x4246e3[_0x8f99('0x33')]['filter']){_0x3f4fbf['where']=_[_0x8f99('0x3f')](_0x3f4fbf[_0x8f99('0x3e')],{'$or':_[_0x8f99('0x2e')](_0xf9e1ea,function(_0x137a07){if(_0x137a07['type']!==_0x8f99('0x40')){var _0x35ef9e={};_0x35ef9e[_0x137a07[_0x8f99('0x2c')]]={'$like':'%'+_0x4246e3[_0x8f99('0x33')][_0x8f99('0x41')]+'%'};return _0x35ef9e;}})});}_0x3f4fbf=_[_0x8f99('0x3f')]({},_0x3f4fbf,_0x4246e3['options']);var _0x49329d={'where':_0x3f4fbf[_0x8f99('0x3e')]};return db['Interval']['count'](_0x49329d)[_0x8f99('0x25')](function(_0x48619b){_0x2ea1ff['count']=_0x48619b;if(_0x4246e3[_0x8f99('0x33')][_0x8f99('0x42')]){_0x3f4fbf[_0x8f99('0x43')]=[{'all':!![]}];}return db[_0x8f99('0x2f')]['findAll'](_0x3f4fbf);})[_0x8f99('0x25')](function(_0x560910){_0x2ea1ff[_0x8f99('0x44')]=_0x560910;return _0x2ea1ff;})[_0x8f99('0x25')](respondWithFilteredResult(_0x1dc466,_0x3f4fbf))['catch'](handleError(_0x1dc466,null));};exports[_0x8f99('0x45')]=function(_0x5849b5,_0x2b8a5c){var _0x10be6a={'raw':!![],'where':{'id':_0x5849b5['params']['id']}},_0x37aabb={};_0x37aabb[_0x8f99('0x32')]=_[_0x8f99('0x46')](db[_0x8f99('0x2f')][_0x8f99('0x30')]);_0x37aabb[_0x8f99('0x33')]=_[_0x8f99('0x46')](_0x5849b5[_0x8f99('0x33')]);_0x37aabb[_0x8f99('0x34')]=_['intersection'](_0x37aabb[_0x8f99('0x32')],_0x37aabb[_0x8f99('0x33')]);_0x10be6a[_0x8f99('0x36')]=_[_0x8f99('0x35')](_0x37aabb['model'],qs[_0x8f99('0x37')](_0x5849b5[_0x8f99('0x33')]['fields']));_0x10be6a[_0x8f99('0x36')]=_0x10be6a[_0x8f99('0x36')][_0x8f99('0x38')]?_0x10be6a[_0x8f99('0x36')]:_0x37aabb[_0x8f99('0x32')];if(_0x5849b5['query'][_0x8f99('0x42')]){_0x10be6a[_0x8f99('0x43')]=[{'all':!![]}];}_0x10be6a=_[_0x8f99('0x3f')]({},_0x10be6a,_0x5849b5[_0x8f99('0x47')]);return db[_0x8f99('0x2f')][_0x8f99('0x48')](_0x10be6a)['then'](handleEntityNotFound(_0x2b8a5c,null))['then'](respondWithResult(_0x2b8a5c,null))[_0x8f99('0x49')](handleError(_0x2b8a5c,null));};exports[_0x8f99('0x4a')]=function(_0x284f89,_0x57d6e1){return db[_0x8f99('0x2f')]['create'](_0x284f89[_0x8f99('0x4b')],{})[_0x8f99('0x25')](function(_0x352ac2){var _0x1011d3=_0x284f89[_0x8f99('0x4c')][_0x8f99('0x26')]({'plain':!![]});if(!_0x1011d3)throw new Error(_0x8f99('0x4d'));if(_0x1011d3[_0x8f99('0x4e')]==='user'){var _0x5cd47a=_0x352ac2[_0x8f99('0x26')]({'plain':!![]});var _0x19ba5b='Intervals';return db[_0x8f99('0x4f')][_0x8f99('0x48')]({'where':{'name':_0x19ba5b,'userProfileId':_0x1011d3['userProfileId']},'raw':!![]})[_0x8f99('0x25')](function(_0x42f04e){if(_0x42f04e&&_0x42f04e[_0x8f99('0x50')]===0x0){return db[_0x8f99('0x28')][_0x8f99('0x4a')]({'name':_0x5cd47a[_0x8f99('0x2c')],'resourceId':_0x5cd47a['id'],'type':_0x42f04e[_0x8f99('0x2c')],'sectionId':_0x42f04e['id']},{})['then'](function(){return _0x352ac2;});}else{return _0x352ac2;}})[_0x8f99('0x49')](function(_0xccfba8){logger[_0x8f99('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xccfba8);throw _0xccfba8;});}return _0x352ac2;})[_0x8f99('0x25')](respondWithResult(_0x57d6e1,0xc9))[_0x8f99('0x49')](handleError(_0x57d6e1,null));};exports[_0x8f99('0x24')]=function(_0x1079d7,_0x5508c1){if(_0x1079d7[_0x8f99('0x4b')]['id']){delete _0x1079d7[_0x8f99('0x4b')]['id'];}return db['Interval']['find']({'where':{'id':_0x1079d7['params']['id']}})[_0x8f99('0x25')](handleEntityNotFound(_0x5508c1,null))[_0x8f99('0x25')](saveUpdates(_0x1079d7[_0x8f99('0x4b')],null))['then'](respondWithResult(_0x5508c1,null))['catch'](handleError(_0x5508c1,null));};exports[_0x8f99('0x29')]=function(_0x1e0ff6,_0x1f7b10){return db['Interval'][_0x8f99('0x48')]({'where':{'id':_0x1e0ff6[_0x8f99('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f7b10,null))[_0x8f99('0x25')](removeEntity(_0x1f7b10,null))['catch'](handleError(_0x1f7b10,null));};exports[_0x8f99('0x52')]=function(_0x1c3f85,_0x300279,_0x43c2b7){if(_0x1c3f85['body']['id']){delete _0x1c3f85['body']['id'];}return db['Interval'][_0x8f99('0x48')]({'where':{'id':_0x1c3f85[_0x8f99('0x51')]['id']}})[_0x8f99('0x25')](handleEntityNotFound(_0x300279,null))[_0x8f99('0x25')](function(_0x2e6673){if(_0x2e6673){_0x1c3f85[_0x8f99('0x4b')][_0x8f99('0x53')]=_0x2e6673['id'];return db[_0x8f99('0x2f')][_0x8f99('0x4a')](_0x1c3f85[_0x8f99('0x4b')]);}})['then'](respondWithResult(_0x300279,null))[_0x8f99('0x49')](handleError(_0x300279,null));};exports[_0x8f99('0x54')]=function(_0x3bc730,_0x1df945,_0x4194ee){var _0x7eef6a={};var _0x8aac2d={};var _0x37d329;var _0x10ca4a;return db[_0x8f99('0x2f')][_0x8f99('0x55')]({'where':{'id':_0x3bc730[_0x8f99('0x51')]['id']}})['then'](handleEntityNotFound(_0x1df945,null))[_0x8f99('0x25')](function(_0x2664f6){if(_0x2664f6){_0x37d329=_0x2664f6;_0x8aac2d[_0x8f99('0x32')]=_[_0x8f99('0x46')](db[_0x8f99('0x2f')]['rawAttributes']);_0x8aac2d[_0x8f99('0x33')]=_[_0x8f99('0x46')](_0x3bc730['query']);_0x8aac2d[_0x8f99('0x34')]=_[_0x8f99('0x35')](_0x8aac2d[_0x8f99('0x32')],_0x8aac2d[_0x8f99('0x33')]);_0x7eef6a[_0x8f99('0x36')]=_[_0x8f99('0x35')](_0x8aac2d[_0x8f99('0x32')],qs[_0x8f99('0x37')](_0x3bc730[_0x8f99('0x33')]['fields']));_0x7eef6a['attributes']=_0x7eef6a[_0x8f99('0x36')][_0x8f99('0x38')]?_0x7eef6a['attributes']:_0x8aac2d[_0x8f99('0x32')];_0x7eef6a[_0x8f99('0x3c')]=qs[_0x8f99('0x3d')](_0x3bc730[_0x8f99('0x33')][_0x8f99('0x3d')]);_0x7eef6a['where']=qs[_0x8f99('0x34')](_[_0x8f99('0x56')](_0x3bc730[_0x8f99('0x33')],_0x8aac2d[_0x8f99('0x34')]));if(_0x3bc730[_0x8f99('0x33')][_0x8f99('0x41')]){_0x7eef6a[_0x8f99('0x3e')]=_['merge'](_0x7eef6a[_0x8f99('0x3e')],{'$or':_[_0x8f99('0x2e')](_0x7eef6a[_0x8f99('0x36')],function(_0x4b34b6){var _0x3ff0eb={};_0x3ff0eb[_0x4b34b6]={'$like':'%'+_0x3bc730[_0x8f99('0x33')][_0x8f99('0x41')]+'%'};return _0x3ff0eb;})});}_0x7eef6a=_['merge']({},_0x7eef6a,_0x3bc730[_0x8f99('0x47')]);return _0x37d329[_0x8f99('0x54')](_0x7eef6a);}})[_0x8f99('0x25')](function(_0x4d433e){if(_0x4d433e){_0x10ca4a=_0x4d433e[_0x8f99('0x38')];if(!_0x3bc730[_0x8f99('0x33')][_0x8f99('0x39')]('nolimit')){_0x7eef6a[_0x8f99('0x3b')]=qs[_0x8f99('0x3b')](_0x3bc730[_0x8f99('0x33')][_0x8f99('0x3b')]);_0x7eef6a[_0x8f99('0x1d')]=qs['offset'](_0x3bc730[_0x8f99('0x33')][_0x8f99('0x1d')]);}return _0x37d329[_0x8f99('0x54')](_0x7eef6a);}})[_0x8f99('0x25')](function(_0x4722ec){if(_0x4722ec){return _0x4722ec?{'count':_0x10ca4a,'rows':_0x4722ec}:null;}})[_0x8f99('0x25')](respondWithResult(_0x1df945,null))['catch'](handleError(_0x1df945,null));};exports[_0x8f99('0x57')]=function(_0x50f9df,_0x5d0412,_0x3cd9b8){return db[_0x8f99('0x2f')][_0x8f99('0x55')]({'where':{'id':_0x50f9df[_0x8f99('0x51')]['id']}})[_0x8f99('0x25')](handleEntityNotFound(_0x5d0412,null))[_0x8f99('0x25')](function(_0x27c248){if(_0x27c248){return db['sequelize'][_0x8f99('0x58')](function(_0x11ea9a){return db[_0x8f99('0x2f')]['destroy']({'where':{'IntervalId':_0x50f9df[_0x8f99('0x51')]['id']},'transaction':_0x11ea9a})[_0x8f99('0x25')](function(_0x20db02){var _0x3d0dc3=_[_0x8f99('0x2e')](_0x50f9df['body'],function(_0xff06d1){delete _0xff06d1['id'];_0xff06d1[_0x8f99('0x53')]=_0x50f9df['params']['id'];return _0xff06d1;});return db[_0x8f99('0x2f')][_0x8f99('0x59')](_0x3d0dc3,{'transaction':_0x11ea9a});});})['then'](function(){return db[_0x8f99('0x2f')]['findAll']({'where':{'IntervalId':_0x50f9df[_0x8f99('0x51')]['id']}});});}})['then'](respondWithResult(_0x5d0412,null))[_0x8f99('0x49')](handleError(_0x5d0412,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 99a61da..acedf55 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 _0xa13a=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','rewrite','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x3af304,_0x2f00e1){var _0x14b840=function(_0x44516f){while(--_0x44516f){_0x3af304['push'](_0x3af304['shift']());}};_0x14b840(++_0x2f00e1);}(_0xa13a,0xae));var _0xaa13=function(_0x4c30d8,_0x49a093){_0x4c30d8=_0x4c30d8-0x0;var _0x40e713=_0xa13a[_0x4c30d8];return _0x40e713;};'use strict';var _=require(_0xaa13('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa13('0x1'));var moment=require(_0xaa13('0x2'));var BPromise=require(_0xaa13('0x3'));var rp=require(_0xaa13('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa13('0x5'));var config=require(_0xaa13('0x6'));var attributes=require(_0xaa13('0x7'));var extensions=require(_0xaa13('0x8'));module[_0xaa13('0x9')]=function(_0x3a7fd3,_0x3207e5){return _0x3a7fd3['define'](_0xaa13('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45098c,_0x15f9f7){extensions['rewrite'](_0x3a7fd3,_0x45098c);},'afterBulkCreate':function(_0x6ac525,_0x3a4e27,_0xc450ed){_0xc450ed();extensions['rewrite'](_0x3a7fd3,_0x6ac525[0x0]);},'afterUpdate':function(_0x551ee8,_0x255114){extensions[_0xaa13('0xb')](_0x3a7fd3,_0x551ee8);},'afterDestroy':function(_0x57b40c,_0x4a8b42){extensions[_0xaa13('0xb')](_0x3a7fd3,_0x57b40c);}}});}; \ No newline at end of file +var _0xb470=['../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./interval.attributes'];(function(_0x21bf84,_0x4b217c){var _0x18c85b=function(_0xf80810){while(--_0xf80810){_0x21bf84['push'](_0x21bf84['shift']());}};_0x18c85b(++_0x4b217c);}(_0xb470,0x75));var _0x0b47=function(_0x470ce3,_0x183b3c){_0x470ce3=_0x470ce3-0x0;var _0x3e32d2=_0xb470[_0x470ce3];return _0x3e32d2;};'use strict';var _=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var logger=require(_0x0b47('0x2'))(_0x0b47('0x3'));var moment=require('moment');var BPromise=require(_0x0b47('0x4'));var rp=require(_0x0b47('0x5'));var fs=require('fs');var path=require(_0x0b47('0x6'));var rimraf=require('rimraf');var config=require(_0x0b47('0x7'));var attributes=require(_0x0b47('0x8'));var extensions=require(_0x0b47('0x9'));module[_0x0b47('0xa')]=function(_0xc1211c,_0x23d960){return _0xc1211c[_0x0b47('0xb')](_0x0b47('0xc'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x56543c,_0x5f02db){extensions['rewrite'](_0xc1211c,_0x56543c);},'afterBulkCreate':function(_0x38523d,_0x2b9cd0,_0x4e5ac5){_0x4e5ac5();extensions[_0x0b47('0xd')](_0xc1211c,_0x38523d[0x0]);},'afterUpdate':function(_0x19b87e,_0x243f01){extensions[_0x0b47('0xd')](_0xc1211c,_0x19b87e);},'afterDestroy':function(_0x3a7c83,_0x26036){extensions[_0x0b47('0xd')](_0xc1211c,_0x3a7c83);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c7e51bf..b9f64ca 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(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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 bb593b4..2af8204 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x47ef4f,_0x5dd4c2){var _0x1764c2=function(_0x2ad9f8){while(--_0x2ad9f8){_0x47ef4f['push'](_0x47ef4f['shift']());}};_0x1764c2(++_0x5dd4c2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c5bad,_0x487b57){_0x3c5bad=_0x3c5bad-0x0;var _0xf02cb4=_0x5f2f[_0x3c5bad];return _0xf02cb4;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x160dce,_0x54cbd1){_0x160dce=_0x160dce-0x0;var _0x2faf7d=_0xb10b[_0x160dce];return _0x2faf7d;};'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 ca389ef..6358d97 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 _0x4d8e=['/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','statusCode','error','status','json','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','3eAmWpBVP0','MOTGUI','summary','Report','stringify','issuetype','Bug','email','fields','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','customfield_10102','track.xcallymotion.com'];(function(_0x532687,_0xc7347a){var _0x5997e1=function(_0x1e40d4){while(--_0x1e40d4){_0x532687['push'](_0x532687['shift']());}};_0x5997e1(++_0xc7347a);}(_0x4d8e,0x65));var _0xe4d8=function(_0x274df6,_0x17b142){_0x274df6=_0x274df6-0x0;var _0x52fc8e=_0x4d8e[_0x274df6];return _0x52fc8e;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0xe4d8('0x0');function openIssue(_0x8dd5da,_0x40bf7d){var _0x49f134={'fields':{'project':{'key':_0x8dd5da['key']||_0xe4d8('0x1')},'summary':(_0x8dd5da[_0xe4d8('0x2')]||_0xe4d8('0x3'))+'\x20from\x20'+_0x8dd5da['ip'],'description':_0x8dd5da['description']||JSON[_0xe4d8('0x4')](_0x8dd5da),'issuetype':{'name':_0x8dd5da[_0xe4d8('0x5')]||_0xe4d8('0x6')}}};_0x49f134['fields']['customfield_11500']=_0x8dd5da[_0xe4d8('0x7')];_0x49f134[_0xe4d8('0x8')]['customfield_11501']=_0x8dd5da[_0xe4d8('0x9')];_0x49f134[_0xe4d8('0x8')][_0xe4d8('0xa')]=_0x8dd5da[_0xe4d8('0xb')];_0x49f134[_0xe4d8('0x8')][_0xe4d8('0xc')]=_0x8dd5da['name'];_0x49f134[_0xe4d8('0x8')][_0xe4d8('0xd')]=_0x8dd5da['reason'];_0x49f134[_0xe4d8('0x8')][_0xe4d8('0xe')]=_0x8dd5da['ip'];var _0x50840d={'host':_0xe4d8('0xf'),'port':0x1bb,'path':_0xe4d8('0x10'),'method':_0xe4d8('0x11'),'timeout':0x4e20,'headers':{'Content-Type':_0xe4d8('0x12'),'Authorization':_0xe4d8('0x13')+new Buffer(USERNAME+':'+PASSWORD)[_0xe4d8('0x14')]('base64')}};var _0x42e67b=JSON[_0xe4d8('0x4')](_0x49f134);var _0x5b43ed=https[_0xe4d8('0x15')](_0x50840d,function(_0x99e6f6){_0x99e6f6[_0xe4d8('0x16')](_0xe4d8('0x17'));var _0x5341de='';_0x99e6f6['on'](_0xe4d8('0x18'),function(_0x3a25e4){_0x5341de+=_0x3a25e4;});_0x99e6f6['on'](_0xe4d8('0x19'),function(){if(_0x40bf7d){return _0x40bf7d['status'](_0x99e6f6[_0xe4d8('0x1a')])['json'](JSON['parse'](_0x5341de));}});});_0x5b43ed['on'](_0xe4d8('0x1b'),function(_0x30a3ab){if(_0x40bf7d){return _0x40bf7d[_0xe4d8('0x1c')](0x1f4)[_0xe4d8('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xe4d8('0x1e')}]});}});_0x5b43ed[_0xe4d8('0x1f')](_0x42e67b);_0x5b43ed[_0xe4d8('0x19')]();}exports[_0xe4d8('0x20')]=openIssue;exports[_0xe4d8('0x21')]=function(_0x326b60,_0x35477a){_0x326b60[_0xe4d8('0x22')]['ip']=_0x326b60['headers'][_0xe4d8('0x23')]||_0x326b60[_0xe4d8('0x24')][_0xe4d8('0x25')]||_0x326b60[_0xe4d8('0x26')][_0xe4d8('0x25')]||_0x326b60[_0xe4d8('0x24')][_0xe4d8('0x26')][_0xe4d8('0x25')];return openIssue(_0x326b60[_0xe4d8('0x22')],_0x35477a);}; \ No newline at end of file +var _0xf992=['MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_10102','track.xcallymotion.com','POST','application/json','toString','request','setEncoding','data','end','status','statusCode','json','error','api.jira','write','send','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key'];(function(_0x1de94d,_0x30499c){var _0x507fed=function(_0x1c4e48){while(--_0x1c4e48){_0x1de94d['push'](_0x1de94d['shift']());}};_0x507fed(++_0x30499c);}(_0xf992,0x1a7));var _0x2f99=function(_0x293728,_0x2e2410){_0x293728=_0x293728-0x0;var _0x1cc0da=_0xf992[_0x293728];return _0x1cc0da;};'use strict';var BPromise=require(_0x2f99('0x0'));var https=require(_0x2f99('0x1'));var logger=require(_0x2f99('0x2'))(_0x2f99('0x3'));var USERNAME=_0x2f99('0x4');var PASSWORD=_0x2f99('0x5');function openIssue(_0x46d8b8,_0x530b99){var _0x328312={'fields':{'project':{'key':_0x46d8b8[_0x2f99('0x6')]||_0x2f99('0x7')},'summary':(_0x46d8b8[_0x2f99('0x8')]||_0x2f99('0x9'))+'\x20from\x20'+_0x46d8b8['ip'],'description':_0x46d8b8[_0x2f99('0xa')]||JSON[_0x2f99('0xb')](_0x46d8b8),'issuetype':{'name':_0x46d8b8[_0x2f99('0xc')]||_0x2f99('0xd')}}};_0x328312[_0x2f99('0xe')][_0x2f99('0xf')]=_0x46d8b8[_0x2f99('0x10')];_0x328312[_0x2f99('0xe')][_0x2f99('0x11')]=_0x46d8b8[_0x2f99('0x12')];_0x328312[_0x2f99('0xe')][_0x2f99('0x13')]=_0x46d8b8[_0x2f99('0x14')];_0x328312[_0x2f99('0xe')][_0x2f99('0x15')]=_0x46d8b8['name'];_0x328312[_0x2f99('0xe')]['customfield_11504']=_0x46d8b8['reason'];_0x328312[_0x2f99('0xe')][_0x2f99('0x16')]=_0x46d8b8['ip'];var _0x26c695={'host':_0x2f99('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x2f99('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x2f99('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x2f99('0x1a')]('base64')}};var _0x5a0f65=JSON[_0x2f99('0xb')](_0x328312);var _0x51d922=https[_0x2f99('0x1b')](_0x26c695,function(_0x215bfb){_0x215bfb[_0x2f99('0x1c')]('utf8');var _0x9d4f1='';_0x215bfb['on'](_0x2f99('0x1d'),function(_0x3e704b){_0x9d4f1+=_0x3e704b;});_0x215bfb['on'](_0x2f99('0x1e'),function(){if(_0x530b99){return _0x530b99[_0x2f99('0x1f')](_0x215bfb[_0x2f99('0x20')])[_0x2f99('0x21')](JSON['parse'](_0x9d4f1));}});});_0x51d922['on'](_0x2f99('0x22'),function(_0x5cf345){if(_0x530b99){return _0x530b99['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x2f99('0x23')}]});}});_0x51d922[_0x2f99('0x24')](_0x5a0f65);_0x51d922['end']();}exports['openIssue']=openIssue;exports[_0x2f99('0x25')]=function(_0x57088a,_0x3285b1){_0x57088a['body']['ip']=_0x57088a['headers'][_0x2f99('0x26')]||_0x57088a[_0x2f99('0x27')][_0x2f99('0x28')]||_0x57088a['socket']['remoteAddress']||_0x57088a[_0x2f99('0x27')][_0x2f99('0x29')][_0x2f99('0x28')];return openIssue(_0x57088a[_0x2f99('0x2a')],_0x3285b1);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f403411..b377972 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 _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2dae,0xc3));var _0xe2da=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0x2dae[_0xf31767];return _0x24bd0c;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file +var _0x54ef=['/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index','get'];(function(_0x84ab8,_0x1c9d49){var _0x19b863=function(_0x2fd99f){while(--_0x2fd99f){_0x84ab8['push'](_0x84ab8['shift']());}};_0x19b863(++_0x1c9d49);}(_0x54ef,0x112));var _0xf54e=function(_0x52bb29,_0x54806c){_0x52bb29=_0x52bb29-0x0;var _0x2ecd52=_0x54ef[_0x52bb29];return _0x2ecd52;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['get'](_0xf54e('0xe'),auth[_0xf54e('0xf')](),controller['show']);router[_0xf54e('0x10')]('/',auth[_0xf54e('0xf')](),controller[_0xf54e('0x11')]);router[_0xf54e('0x12')]('/:id',auth[_0xf54e('0xf')](),controller[_0xf54e('0x13')]);router[_0xf54e('0x14')](_0xf54e('0xe'),auth['isAuthenticated'](),controller[_0xf54e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index d34da69..1d1167e 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x473c22,_0x5ae607){_0x473c22=_0x473c22-0x0;var _0x5e6500=_0x7a54[_0x473c22];return _0x5e6500;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x1d9ab6,_0x3aa30d){_0x1d9ab6=_0x1d9ab6-0x0;var _0x5508b8=_0x7a54[_0x1d9ab6];return _0x5508b8;};'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 de92d15..7aed0dc 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 _0x4074=['params','rawAttributes','intersection','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','JscriptyAnswerReport','then','includeAll','findAll','rows','show'];(function(_0x28a4a5,_0x12a958){var _0x347af3=function(_0x2c6cba){while(--_0x2c6cba){_0x28a4a5['push'](_0x28a4a5['shift']());}};_0x347af3(++_0x12a958);}(_0x4074,0xf0));var _0x4407=function(_0x5e9b31,_0x151c96){_0x5e9b31=_0x5e9b31-0x0;var _0x151a33=_0x4074[_0x5e9b31];return _0x151a33;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){_0x16272f[_0x4407('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309274,_0x5386f4){return function(_0x40fb1e){if(!_0x40fb1e){_0x309274['sendStatus'](0x194);}return _0x40fb1e;};}function handleError(_0x374754,_0x4bf227){_0x4bf227=_0x4bf227||0x1f4;return function(_0x57ba27){logger[_0x4407('0x27')](_0x57ba27[_0x4407('0x28')]);if(_0x57ba27[_0x4407('0x29')]){delete _0x57ba27['name'];}_0x374754['status'](_0x4bf227)['send'](_0x57ba27);};}exports[_0x4407('0x2a')]=function(_0x2feb6b,_0x1f9828){var _0x84a8a={},_0x1d6b3d={},_0x37fba1={'count':0x0,'rows':[]};var _0x182bd9=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0x28e99e){return{'name':_0x28e99e[_0x4407('0x2b')],'type':_0x28e99e[_0x4407('0x2c')][_0x4407('0x2d')]};});_0x1d6b3d[_0x4407('0x2e')]=_[_0x4407('0x2f')](_0x182bd9,_0x4407('0x29'));_0x1d6b3d[_0x4407('0x30')]=_[_0x4407('0x31')](_0x2feb6b[_0x4407('0x30')]);_0x1d6b3d['filters']=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],_0x1d6b3d[_0x4407('0x30')]);_0x84a8a[_0x4407('0x32')]=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],qs[_0x4407('0x33')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x33')]));_0x84a8a[_0x4407('0x32')]=_0x84a8a['attributes'][_0x4407('0x34')]?_0x84a8a['attributes']:_0x1d6b3d[_0x4407('0x2e')];if(!_0x2feb6b['query']['hasOwnProperty'](_0x4407('0x35'))){_0x84a8a[_0x4407('0x1f')]=qs[_0x4407('0x1f')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x1f')]);_0x84a8a[_0x4407('0x21')]=qs[_0x4407('0x21')](_0x2feb6b['query'][_0x4407('0x21')]);}_0x84a8a[_0x4407('0x36')]=qs[_0x4407('0x37')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x37')]);_0x84a8a['where']=qs[_0x4407('0x38')](_['pick'](_0x2feb6b[_0x4407('0x30')],_0x1d6b3d[_0x4407('0x38')]),_0x182bd9);if(_0x2feb6b[_0x4407('0x30')][_0x4407('0x39')]){_0x84a8a['where']=_[_0x4407('0x3a')](_0x84a8a[_0x4407('0x3b')],{'$or':_[_0x4407('0x2f')](_0x182bd9,function(_0x1bf4e2){if(_0x1bf4e2[_0x4407('0x2c')]!==_0x4407('0x3c')){var _0x30de66={};_0x30de66[_0x1bf4e2[_0x4407('0x29')]]={'$like':'%'+_0x2feb6b[_0x4407('0x30')]['filter']+'%'};return _0x30de66;}})});}_0x84a8a=_['merge']({},_0x84a8a,_0x2feb6b[_0x4407('0x3d')]);var _0xc47d0e={'where':_0x84a8a[_0x4407('0x3b')]};return db[_0x4407('0x3e')]['count'](_0xc47d0e)[_0x4407('0x3f')](function(_0x2cb65e){_0x37fba1[_0x4407('0x20')]=_0x2cb65e;if(_0x2feb6b['query'][_0x4407('0x40')]){_0x84a8a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4407('0x41')](_0x84a8a);})[_0x4407('0x3f')](function(_0x234fa5){_0x37fba1[_0x4407('0x42')]=_0x234fa5;return _0x37fba1;})[_0x4407('0x3f')](respondWithFilteredResult(_0x1f9828,_0x84a8a))['catch'](handleError(_0x1f9828,null));};exports[_0x4407('0x43')]=function(_0xf79768,_0x819b8b){var _0x15ba7b={'raw':!![],'where':{'id':_0xf79768[_0x4407('0x44')]['id']}},_0x5b41cf={};_0x5b41cf[_0x4407('0x2e')]=_[_0x4407('0x31')](db[_0x4407('0x3e')][_0x4407('0x45')]);_0x5b41cf['query']=_[_0x4407('0x31')](_0xf79768['query']);_0x5b41cf['filters']=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],_0x5b41cf['query']);_0x15ba7b[_0x4407('0x32')]=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],qs[_0x4407('0x33')](_0xf79768['query'][_0x4407('0x33')]));_0x15ba7b[_0x4407('0x32')]=_0x15ba7b[_0x4407('0x32')][_0x4407('0x34')]?_0x15ba7b[_0x4407('0x32')]:_0x5b41cf['model'];if(_0xf79768[_0x4407('0x30')][_0x4407('0x40')]){_0x15ba7b[_0x4407('0x47')]=[{'all':!![]}];}_0x15ba7b=_[_0x4407('0x3a')]({},_0x15ba7b,_0xf79768[_0x4407('0x3d')]);return db['JscriptyAnswerReport'][_0x4407('0x48')](_0x15ba7b)[_0x4407('0x3f')](handleEntityNotFound(_0x819b8b,null))[_0x4407('0x3f')](respondWithResult(_0x819b8b,null))[_0x4407('0x49')](handleError(_0x819b8b,null));};exports['create']=function(_0x18ff16,_0x2b18b8){return db['JscriptyAnswerReport'][_0x4407('0x4a')](_0x18ff16[_0x4407('0x4b')],{})['then'](respondWithResult(_0x2b18b8,0xc9))[_0x4407('0x49')](handleError(_0x2b18b8,null));};exports[_0x4407('0x25')]=function(_0x5ea36,_0x4fbc1f){if(_0x5ea36[_0x4407('0x4b')]['id']){delete _0x5ea36['body']['id'];}return db['JscriptyAnswerReport'][_0x4407('0x48')]({'where':{'id':_0x5ea36[_0x4407('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fbc1f,null))[_0x4407('0x3f')](saveUpdates(_0x5ea36[_0x4407('0x4b')],null))[_0x4407('0x3f')](respondWithResult(_0x4fbc1f,null))[_0x4407('0x49')](handleError(_0x4fbc1f,null));};exports[_0x4407('0x26')]=function(_0x5a2c2b,_0x39865e){return db[_0x4407('0x3e')][_0x4407('0x48')]({'where':{'id':_0x5a2c2b[_0x4407('0x44')]['id']}})[_0x4407('0x3f')](handleEntityNotFound(_0x39865e,null))[_0x4407('0x3f')](removeEntity(_0x39865e,null))[_0x4407('0x49')](handleError(_0x39865e,null));};exports[_0x4407('0x4c')]=function(_0xd1dd66,_0x55f0ef){return db[_0x4407('0x3e')]['describe']()[_0x4407('0x3f')](respondWithResult(_0x55f0ef,null))[_0x4407('0x49')](handleError(_0x55f0ef,null));}; \ No newline at end of file +var _0x4317=['../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','reject','save','update','then','destroy','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4317,0x7c));var _0x7431=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4317[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7431('0x0'));var zipdir=require(_0x7431('0x1'));var jsonpatch=require(_0x7431('0x2'));var rp=require('request-promise');var moment=require(_0x7431('0x3'));var BPromise=require(_0x7431('0x4'));var Mustache=require(_0x7431('0x5'));var util=require(_0x7431('0x6'));var path=require(_0x7431('0x7'));var sox=require(_0x7431('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7431('0x9'));var _=require(_0x7431('0xa'));var squel=require(_0x7431('0xb'));var crypto=require(_0x7431('0xc'));var jsforce=require(_0x7431('0xd'));var deskjs=require(_0x7431('0xe'));var toCsv=require(_0x7431('0xf'));var querystring=require(_0x7431('0x10'));var Papa=require(_0x7431('0x11'));var Redis=require(_0x7431('0x12'));var authService=require(_0x7431('0x13'));var qs=require(_0x7431('0x14'));var as=require(_0x7431('0x15'));var hardwareService=require(_0x7431('0x16'));var logger=require(_0x7431('0x17'))(_0x7431('0x18'));var utils=require(_0x7431('0x19'));var config=require(_0x7431('0x1a'));var licenseUtil=require(_0x7431('0x1b'));var db=require(_0x7431('0x1c'))['db'];function respondWithStatusCode(_0x3d3367,_0x367915){_0x367915=_0x367915||0xcc;return function(_0x4421d6){if(_0x4421d6){return _0x3d3367[_0x7431('0x1d')](_0x367915);}return _0x3d3367['status'](_0x367915)[_0x7431('0x1e')]();};}function respondWithResult(_0x1b13cc,_0x90e5eb){_0x90e5eb=_0x90e5eb||0xc8;return function(_0x4adbe4){if(_0x4adbe4){return _0x1b13cc[_0x7431('0x1f')](_0x90e5eb)[_0x7431('0x20')](_0x4adbe4);}};}function respondWithFilteredResult(_0x14bf18,_0x541904){return function(_0xc08396){if(_0xc08396){var _0x4bf072=typeof _0x541904['offset']==='undefined'&&typeof _0x541904[_0x7431('0x21')]===_0x7431('0x22');var _0x2fe0df=_0xc08396[_0x7431('0x23')];var _0x4a7048=_0x4bf072?0x0:_0x541904['offset'];var _0x167238=_0x4bf072?_0xc08396[_0x7431('0x23')]:_0x541904[_0x7431('0x24')]+_0x541904[_0x7431('0x21')];var _0x1e7fdf;if(_0x167238>=_0x2fe0df){_0x167238=_0x2fe0df;_0x1e7fdf=0xc8;}else{_0x1e7fdf=0xce;}_0x14bf18[_0x7431('0x1f')](_0x1e7fdf);return _0x14bf18['set']('Content-Range',_0x4a7048+'-'+_0x167238+'/'+_0x2fe0df)['json'](_0xc08396);}return null;};}function patchUpdates(_0x354e0c){return function(_0x901aa2){try{jsonpatch['apply'](_0x901aa2,_0x354e0c,!![]);}catch(_0x3cb70e){return BPromise[_0x7431('0x25')](_0x3cb70e);}return _0x901aa2[_0x7431('0x26')]();};}function saveUpdates(_0x51c7a7,_0x12c4cf){return function(_0xcbc861){if(_0xcbc861){return _0xcbc861[_0x7431('0x27')](_0x51c7a7)[_0x7431('0x28')](function(_0x49a64b){return _0x49a64b;});}return null;};}function removeEntity(_0x2e9fe7,_0x1688f6){return function(_0x4570b8){if(_0x4570b8){return _0x4570b8[_0x7431('0x29')]()[_0x7431('0x28')](function(){_0x2e9fe7[_0x7431('0x1f')](0xcc)[_0x7431('0x1e')]();});}};}function handleEntityNotFound(_0x183e53,_0x18e40c){return function(_0x9afb30){if(!_0x9afb30){_0x183e53[_0x7431('0x1d')](0x194);}return _0x9afb30;};}function handleError(_0x46e460,_0x551f92){_0x551f92=_0x551f92||0x1f4;return function(_0x43116e){logger['error'](_0x43116e['stack']);if(_0x43116e[_0x7431('0x2a')]){delete _0x43116e[_0x7431('0x2a')];}_0x46e460['status'](_0x551f92)[_0x7431('0x2b')](_0x43116e);};}exports[_0x7431('0x2c')]=function(_0xb1ac3,_0x2701e2){var _0x30e63f={},_0x24f91c={},_0xb184c={'count':0x0,'rows':[]};var _0x26a1be=_[_0x7431('0x2d')](db[_0x7431('0x2e')][_0x7431('0x2f')],function(_0xa63228){return{'name':_0xa63228['fieldName'],'type':_0xa63228[_0x7431('0x30')][_0x7431('0x31')]};});_0x24f91c[_0x7431('0x32')]=_[_0x7431('0x2d')](_0x26a1be,'name');_0x24f91c[_0x7431('0x33')]=_[_0x7431('0x34')](_0xb1ac3[_0x7431('0x33')]);_0x24f91c['filters']=_['intersection'](_0x24f91c[_0x7431('0x32')],_0x24f91c['query']);_0x30e63f['attributes']=_[_0x7431('0x35')](_0x24f91c['model'],qs[_0x7431('0x36')](_0xb1ac3[_0x7431('0x33')]['fields']));_0x30e63f[_0x7431('0x37')]=_0x30e63f[_0x7431('0x37')]['length']?_0x30e63f[_0x7431('0x37')]:_0x24f91c[_0x7431('0x32')];if(!_0xb1ac3[_0x7431('0x33')][_0x7431('0x38')](_0x7431('0x39'))){_0x30e63f['limit']=qs[_0x7431('0x21')](_0xb1ac3['query'][_0x7431('0x21')]);_0x30e63f[_0x7431('0x24')]=qs[_0x7431('0x24')](_0xb1ac3[_0x7431('0x33')][_0x7431('0x24')]);}_0x30e63f[_0x7431('0x3a')]=qs[_0x7431('0x3b')](_0xb1ac3[_0x7431('0x33')][_0x7431('0x3b')]);_0x30e63f[_0x7431('0x3c')]=qs[_0x7431('0x3d')](_[_0x7431('0x3e')](_0xb1ac3[_0x7431('0x33')],_0x24f91c[_0x7431('0x3d')]),_0x26a1be);if(_0xb1ac3[_0x7431('0x33')][_0x7431('0x3f')]){_0x30e63f[_0x7431('0x3c')]=_['merge'](_0x30e63f['where'],{'$or':_[_0x7431('0x2d')](_0x26a1be,function(_0x1c557c){if(_0x1c557c['type']!=='VIRTUAL'){var _0x1cb05a={};_0x1cb05a[_0x1c557c[_0x7431('0x2a')]]={'$like':'%'+_0xb1ac3[_0x7431('0x33')][_0x7431('0x3f')]+'%'};return _0x1cb05a;}})});}_0x30e63f=_[_0x7431('0x40')]({},_0x30e63f,_0xb1ac3[_0x7431('0x41')]);var _0x4e8db2={'where':_0x30e63f['where']};return db[_0x7431('0x2e')][_0x7431('0x23')](_0x4e8db2)[_0x7431('0x28')](function(_0x53dba5){_0xb184c['count']=_0x53dba5;if(_0xb1ac3[_0x7431('0x33')][_0x7431('0x42')]){_0x30e63f[_0x7431('0x43')]=[{'all':!![]}];}return db[_0x7431('0x2e')]['findAll'](_0x30e63f);})[_0x7431('0x28')](function(_0x540a5d){_0xb184c[_0x7431('0x44')]=_0x540a5d;return _0xb184c;})[_0x7431('0x28')](respondWithFilteredResult(_0x2701e2,_0x30e63f))['catch'](handleError(_0x2701e2,null));};exports[_0x7431('0x45')]=function(_0x150431,_0x32589c){var _0x50e648={'raw':!![],'where':{'id':_0x150431[_0x7431('0x46')]['id']}},_0x100c83={};_0x100c83['model']=_[_0x7431('0x34')](db[_0x7431('0x2e')][_0x7431('0x2f')]);_0x100c83[_0x7431('0x33')]=_['keys'](_0x150431[_0x7431('0x33')]);_0x100c83['filters']=_['intersection'](_0x100c83[_0x7431('0x32')],_0x100c83[_0x7431('0x33')]);_0x50e648[_0x7431('0x37')]=_['intersection'](_0x100c83['model'],qs[_0x7431('0x36')](_0x150431[_0x7431('0x33')]['fields']));_0x50e648[_0x7431('0x37')]=_0x50e648[_0x7431('0x37')]['length']?_0x50e648['attributes']:_0x100c83[_0x7431('0x32')];if(_0x150431['query'][_0x7431('0x42')]){_0x50e648[_0x7431('0x43')]=[{'all':!![]}];}_0x50e648=_[_0x7431('0x40')]({},_0x50e648,_0x150431['options']);return db[_0x7431('0x2e')]['find'](_0x50e648)[_0x7431('0x28')](handleEntityNotFound(_0x32589c,null))[_0x7431('0x28')](respondWithResult(_0x32589c,null))[_0x7431('0x47')](handleError(_0x32589c,null));};exports[_0x7431('0x48')]=function(_0x4006a6,_0x4f1092){return db['JscriptyAnswerReport'][_0x7431('0x48')](_0x4006a6[_0x7431('0x49')],{})[_0x7431('0x28')](respondWithResult(_0x4f1092,0xc9))[_0x7431('0x47')](handleError(_0x4f1092,null));};exports[_0x7431('0x27')]=function(_0xd66659,_0x6f7b4){if(_0xd66659['body']['id']){delete _0xd66659[_0x7431('0x49')]['id'];}return db[_0x7431('0x2e')][_0x7431('0x4a')]({'where':{'id':_0xd66659[_0x7431('0x46')]['id']}})[_0x7431('0x28')](handleEntityNotFound(_0x6f7b4,null))['then'](saveUpdates(_0xd66659[_0x7431('0x49')],null))['then'](respondWithResult(_0x6f7b4,null))['catch'](handleError(_0x6f7b4,null));};exports[_0x7431('0x29')]=function(_0x11dfb7,_0x2e6d44){return db[_0x7431('0x2e')][_0x7431('0x4a')]({'where':{'id':_0x11dfb7[_0x7431('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e6d44,null))[_0x7431('0x28')](removeEntity(_0x2e6d44,null))[_0x7431('0x47')](handleError(_0x2e6d44,null));};exports['describe']=function(_0x30ddfe,_0x12cae0){return db[_0x7431('0x2e')][_0x7431('0x4b')]()['then'](respondWithResult(_0x12cae0,null))[_0x7431('0x47')](handleError(_0x12cae0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 661af8e..4f019d0 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 _0x2f9a=['exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x2f9a,0xd0));var _0xa2f9=function(_0x299d27,_0x4cbc19){_0x299d27=_0x299d27-0x0;var _0x5692a1=_0x2f9a[_0x299d27];return _0x5692a1;};'use strict';var _=require('lodash');var util=require(_0xa2f9('0x0'));var logger=require(_0xa2f9('0x1'))(_0xa2f9('0x2'));var moment=require('moment');var BPromise=require(_0xa2f9('0x3'));var rp=require(_0xa2f9('0x4'));var fs=require('fs');var path=require(_0xa2f9('0x5'));var rimraf=require(_0xa2f9('0x6'));var config=require(_0xa2f9('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xa2f9('0x8')]=function(_0x27bfc7,_0x2bb6b2){return _0x27bfc7[_0xa2f9('0x9')](_0xa2f9('0xa'),attributes,{'tableName':_0xa2f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66fc=['report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x253b73,_0x55c2be){var _0x2483d5=function(_0x1f5813){while(--_0x1f5813){_0x253b73['push'](_0x253b73['shift']());}};_0x2483d5(++_0x55c2be);}(_0x66fc,0x1b1));var _0xc66f=function(_0x35a8c1,_0x5375bc){_0x35a8c1=_0x35a8c1-0x0;var _0x429e9=_0x66fc[_0x35a8c1];return _0x429e9;};'use strict';var _=require(_0xc66f('0x0'));var util=require(_0xc66f('0x1'));var logger=require(_0xc66f('0x2'))('api');var moment=require(_0xc66f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc66f('0x4'));var fs=require('fs');var path=require(_0xc66f('0x5'));var rimraf=require(_0xc66f('0x6'));var config=require(_0xc66f('0x7'));var attributes=require(_0xc66f('0x8'));module[_0xc66f('0x9')]=function(_0x153659,_0xd737d0){return _0x153659[_0xc66f('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xc66f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index d615de1..3758dda 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 _0x1e55=['stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','request\x20sent'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x1e55,0x105));var _0x51e5=function(_0xf909e6,_0x507fda){_0xf909e6=_0xf909e6-0x0;var _0x4e75fe=_0x1e55[_0xf909e6];return _0x4e75fe;};'use strict';var _=require(_0x51e5('0x0'));var util=require(_0x51e5('0x1'));var moment=require(_0x51e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x51e5('0x3'));var fs=require('fs');var Redis=require(_0x51e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51e5('0x5'));var logger=require(_0x51e5('0x6'))(_0x51e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x51e5('0x8'));var client=jayson[_0x51e5('0x9')][_0x51e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15e90d,_0x149497,_0x5a2f87){return new BPromise(function(_0x37c5e5,_0x4a3a42){return client[_0x51e5('0xb')](_0x15e90d,_0x5a2f87)[_0x51e5('0xc')](function(_0x751a05){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x149497,'request\x20sent');logger[_0x51e5('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x149497,_0x51e5('0xe'),JSON[_0x51e5('0xf')](_0x751a05));if(_0x751a05['error']){if(_0x751a05[_0x51e5('0x10')][_0x51e5('0x11')]===0x1f4){logger[_0x51e5('0x10')](_0x51e5('0x12'),_0x149497,_0x751a05[_0x51e5('0x10')][_0x51e5('0x13')]);return _0x4a3a42(_0x751a05[_0x51e5('0x10')][_0x51e5('0x13')]);}logger['error'](_0x51e5('0x12'),_0x149497,_0x751a05[_0x51e5('0x10')][_0x51e5('0x13')]);return _0x37c5e5(_0x751a05[_0x51e5('0x10')][_0x51e5('0x13')]);}else{logger[_0x51e5('0x14')](_0x51e5('0x12'),_0x149497,_0x51e5('0xe'));_0x37c5e5(_0x751a05[_0x51e5('0x15')][_0x51e5('0x13')]);}})[_0x51e5('0x16')](function(_0x27050f){logger[_0x51e5('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x149497,_0x27050f);_0x4a3a42(_0x27050f);});});} \ No newline at end of file +var _0x6149=['JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0xcd7670,_0x46d65a){var _0x5c3b31=function(_0x12a5ee){while(--_0x12a5ee){_0xcd7670['push'](_0xcd7670['shift']());}};_0x5c3b31(++_0x46d65a);}(_0x6149,0x112));var _0x9614=function(_0x50d7f8,_0x10b533){_0x50d7f8=_0x50d7f8-0x0;var _0xee409a=_0x6149[_0x50d7f8];return _0xee409a;};'use strict';var _=require(_0x9614('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9614('0x1'));var rs=require(_0x9614('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9614('0x3'))['db'];var utils=require(_0x9614('0x4'));var logger=require(_0x9614('0x5'))(_0x9614('0x6'));var config=require('../../config/environment');var jayson=require(_0x9614('0x7'));var client=jayson[_0x9614('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50c1ce,_0x3e8c30,_0x4f29b3){return new BPromise(function(_0xdbf145,_0x334a2b){return client[_0x9614('0x9')](_0x50c1ce,_0x4f29b3)[_0x9614('0xa')](function(_0x2f227f){logger['info'](_0x9614('0xb'),_0x3e8c30,'request\x20sent');logger['debug'](_0x9614('0xc'),_0x3e8c30,_0x9614('0xd'),JSON[_0x9614('0xe')](_0x2f227f));if(_0x2f227f[_0x9614('0xf')]){if(_0x2f227f['error']['code']===0x1f4){logger[_0x9614('0xf')](_0x9614('0xb'),_0x3e8c30,_0x2f227f[_0x9614('0xf')][_0x9614('0x10')]);return _0x334a2b(_0x2f227f[_0x9614('0xf')][_0x9614('0x10')]);}logger[_0x9614('0xf')](_0x9614('0xb'),_0x3e8c30,_0x2f227f[_0x9614('0xf')][_0x9614('0x10')]);return _0xdbf145(_0x2f227f[_0x9614('0xf')][_0x9614('0x10')]);}else{logger['info'](_0x9614('0xb'),_0x3e8c30,'request\x20sent');_0xdbf145(_0x2f227f[_0x9614('0x11')][_0x9614('0x10')]);}})[_0x9614('0x12')](function(_0x494e15){logger[_0x9614('0xf')](_0x9614('0xb'),_0x3e8c30,_0x494e15);_0x334a2b(_0x494e15);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index aa1a45f..492e650 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 _0x97b0=['getSessions','getAnswers','30s','getSummary','post','/:id/clone','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','isAuthenticated'];(function(_0x1dd7a1,_0x361479){var _0x35899d=function(_0x1d2b67){while(--_0x1d2b67){_0x1dd7a1['push'](_0x1dd7a1['shift']());}};_0x35899d(++_0x361479);}(_0x97b0,0x12f));var _0x097b=function(_0x498100,_0x56e537){_0x498100=_0x498100-0x0;var _0xb890bb=_0x97b0[_0x498100];return _0xb890bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x097b('0x0'));var timeout=require(_0x097b('0x1'));var express=require(_0x097b('0x2'));var router=express[_0x097b('0x3')]();var fs_extra=require(_0x097b('0x4'));var auth=require(_0x097b('0x5'));var interaction=require(_0x097b('0x6'));var config=require('../../config/environment');var controller=require(_0x097b('0x7'));router[_0x097b('0x8')]('/',auth['isAuthenticated'](),controller[_0x097b('0x9')]);router[_0x097b('0x8')](_0x097b('0xa'),auth[_0x097b('0xb')](),controller['show']);router[_0x097b('0x8')]('/:id/sessions',auth[_0x097b('0xb')](),controller[_0x097b('0xc')]);router['get']('/:id/answers',auth[_0x097b('0xb')](),controller[_0x097b('0xd')]);router[_0x097b('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x097b('0xe')),controller[_0x097b('0xf')]);router[_0x097b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x097b('0x10')](_0x097b('0x11'),auth[_0x097b('0xb')](),controller['clone']);router[_0x097b('0x12')](_0x097b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x097b('0xb')](),controller[_0x097b('0x13')]);module[_0x097b('0x14')]=router; \ No newline at end of file +var _0x0aae=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sessions','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','update'];(function(_0xb111c8,_0x5efb3f){var _0x53932f=function(_0x4e156d){while(--_0x4e156d){_0xb111c8['push'](_0xb111c8['shift']());}};_0x53932f(++_0x5efb3f);}(_0x0aae,0xa1));var _0xe0aa=function(_0x54b072,_0x4fec67){_0x54b072=_0x54b072-0x0;var _0x101c6e=_0x0aae[_0x54b072];return _0x101c6e;};'use strict';var multer=require('multer');var util=require(_0xe0aa('0x0'));var path=require(_0xe0aa('0x1'));var timeout=require(_0xe0aa('0x2'));var express=require(_0xe0aa('0x3'));var router=express['Router']();var fs_extra=require(_0xe0aa('0x4'));var auth=require(_0xe0aa('0x5'));var interaction=require(_0xe0aa('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xe0aa('0x7')]('/',auth[_0xe0aa('0x8')](),controller[_0xe0aa('0x9')]);router[_0xe0aa('0x7')](_0xe0aa('0xa'),auth[_0xe0aa('0x8')](),controller[_0xe0aa('0xb')]);router[_0xe0aa('0x7')](_0xe0aa('0xc'),auth[_0xe0aa('0x8')](),controller['getSessions']);router[_0xe0aa('0x7')]('/:id/answers',auth['isAuthenticated'](),controller[_0xe0aa('0xd')]);router[_0xe0aa('0x7')](_0xe0aa('0xe'),auth[_0xe0aa('0x8')](),timeout(_0xe0aa('0xf')),controller[_0xe0aa('0x10')]);router['post']('/',auth[_0xe0aa('0x8')](),controller[_0xe0aa('0x11')]);router[_0xe0aa('0x12')](_0xe0aa('0x13'),auth[_0xe0aa('0x8')](),controller[_0xe0aa('0x14')]);router[_0xe0aa('0x15')](_0xe0aa('0xa'),auth[_0xe0aa('0x8')](),controller[_0xe0aa('0x16')]);router['delete'](_0xe0aa('0xa'),auth[_0xe0aa('0x8')](),controller['destroy']);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 1c59b0f..cd1250f 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 _0x893b=['long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','name','TEXT'];(function(_0x1ff105,_0xd9de6b){var _0x3a2c57=function(_0x1f5ac1){while(--_0x1f5ac1){_0x1ff105['push'](_0x1ff105['shift']());}};_0x3a2c57(++_0xd9de6b);}(_0x893b,0xaf));var _0xb893=function(_0x6297cf,_0x68866){_0x6297cf=_0x6297cf-0x0;var _0x43f442=_0x893b[_0x6297cf];return _0x43f442;};'use strict';var Sequelize=require(_0xb893('0x0'));var _=require('lodash');var util=require(_0xb893('0x1'));module[_0xb893('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xb893('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb893('0x4')](_0xb893('0x5')),'set':function(_0x3e03d6){if(_[_0xb893('0x6')](_0x3e03d6)){this[_0xb893('0x7')](_0xb893('0x8'),JSON['stringify'](_0x3e03d6));}else if(_[_0xb893('0x9')](_0x3e03d6)){this[_0xb893('0x7')]('formData',_0x3e03d6);}else{this[_0xb893('0x7')](_0xb893('0x8'),util[_0xb893('0xa')](_0xb893('0xb'),this[_0xb893('0xc')]('name')||'',this['getDataValue'](_0xb893('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb893('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x323c=['sequelize','lodash','name','STRING','TEXT','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN'];(function(_0x2b2195,_0x5efc30){var _0x435786=function(_0x491ea7){while(--_0x491ea7){_0x2b2195['push'](_0x2b2195['shift']());}};_0x435786(++_0x5efc30);}(_0x323c,0xc4));var _0xc323=function(_0xa84991,_0x3fb37b){_0xa84991=_0xa84991-0x0;var _0x37226a=_0x323c[_0xa84991];return _0x37226a;};'use strict';var Sequelize=require(_0xc323('0x0'));var _=require(_0xc323('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc323('0x2')},'description':{'type':Sequelize[_0xc323('0x3')]},'formData':{'type':Sequelize[_0xc323('0x4')](_0xc323('0x5')),'set':function(_0x2b29fc){if(_[_0xc323('0x6')](_0x2b29fc)){this[_0xc323('0x7')]('formData',JSON['stringify'](_0x2b29fc));}else if(_[_0xc323('0x8')](_0x2b29fc)){this[_0xc323('0x7')](_0xc323('0x9'),_0x2b29fc);}else{this['setDataValue']('formData',util[_0xc323('0xa')](_0xc323('0xb'),this[_0xc323('0xc')]('name')||'',this[_0xc323('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc323('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc323('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7d08941..68d0076 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 _0x3fce=['pick','where','map','VIRTUAL','filter','merge','includeAll','rows','catch','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Projects','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','updatedAt','body','omit','createdAt','role','userProfileId','update','getSessions','hasOwnProperty','nolimit','ProjectId','options','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','reject','destroy','then','error','stack','name','send','index','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort'];(function(_0x4895e5,_0x59e9d7){var _0x1718c1=function(_0x41870a){while(--_0x41870a){_0x4895e5['push'](_0x4895e5['shift']());}};_0x1718c1(++_0x59e9d7);}(_0x3fce,0x121));var _0xe3fc=function(_0xc14e9b,_0x5c3047){_0xc14e9b=_0xc14e9b-0x0;var _0x48f298=_0x3fce[_0xc14e9b];return _0x48f298;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3fc('0x0'));var zipdir=require(_0xe3fc('0x1'));var jsonpatch=require(_0xe3fc('0x2'));var rp=require(_0xe3fc('0x3'));var moment=require(_0xe3fc('0x4'));var BPromise=require(_0xe3fc('0x5'));var Mustache=require(_0xe3fc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3fc('0x7'));var fs=require('fs');var fs_extra=require(_0xe3fc('0x8'));var _=require('lodash');var squel=require(_0xe3fc('0x9'));var crypto=require('crypto');var jsforce=require(_0xe3fc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe3fc('0xb'));var querystring=require(_0xe3fc('0xc'));var Papa=require(_0xe3fc('0xd'));var Redis=require(_0xe3fc('0xe'));var authService=require(_0xe3fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3fc('0x10'));var logger=require(_0xe3fc('0x11'))(_0xe3fc('0x12'));var utils=require('../../config/utils');var config=require(_0xe3fc('0x13'));var licenseUtil=require(_0xe3fc('0x14'));var db=require(_0xe3fc('0x15'))['db'];function respondWithStatusCode(_0x317490,_0x40fc7e){_0x40fc7e=_0x40fc7e||0xcc;return function(_0x1e3443){if(_0x1e3443){return _0x317490[_0xe3fc('0x16')](_0x40fc7e);}return _0x317490['status'](_0x40fc7e)[_0xe3fc('0x17')]();};}function respondWithResult(_0x37c993,_0x4b2ed4){_0x4b2ed4=_0x4b2ed4||0xc8;return function(_0x3f7ae2){if(_0x3f7ae2){return _0x37c993[_0xe3fc('0x18')](_0x4b2ed4)['json'](_0x3f7ae2);}};}function respondWithFilteredResult(_0x28403f,_0x25852e){return function(_0x4b6256){if(_0x4b6256){var _0x4fa4d4=typeof _0x25852e['offset']===_0xe3fc('0x19')&&typeof _0x25852e[_0xe3fc('0x1a')]===_0xe3fc('0x19');var _0x59a6db=_0x4b6256['count'];var _0x354695=_0x4fa4d4?0x0:_0x25852e['offset'];var _0x404e04=_0x4fa4d4?_0x4b6256[_0xe3fc('0x1b')]:_0x25852e[_0xe3fc('0x1c')]+_0x25852e['limit'];var _0x57a0f4;if(_0x404e04>=_0x59a6db){_0x404e04=_0x59a6db;_0x57a0f4=0xc8;}else{_0x57a0f4=0xce;}_0x28403f[_0xe3fc('0x18')](_0x57a0f4);return _0x28403f[_0xe3fc('0x1d')](_0xe3fc('0x1e'),_0x354695+'-'+_0x404e04+'/'+_0x59a6db)['json'](_0x4b6256);}return null;};}function patchUpdates(_0x4472f7){return function(_0xfac19f){try{jsonpatch['apply'](_0xfac19f,_0x4472f7,!![]);}catch(_0x457bb1){return BPromise[_0xe3fc('0x1f')](_0x457bb1);}return _0xfac19f['save']();};}function saveUpdates(_0x543535,_0x457cef){return function(_0x1e307a){if(_0x1e307a){return _0x1e307a['update'](_0x543535)['then'](function(_0x2194f8){return _0x2194f8;});}return null;};}function removeEntity(_0x4f4134,_0x55ea5e){return function(_0x383f19){if(_0x383f19){return _0x383f19[_0xe3fc('0x20')]()[_0xe3fc('0x21')](function(){var _0x177a14=_0x383f19['get']({'plain':!![]});var _0x24043a='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x24043a,'resourceId':_0x177a14['id']}})['then'](function(){return _0x383f19;});})['then'](function(){_0x4f4134[_0xe3fc('0x18')](0xcc)[_0xe3fc('0x17')]();});}};}function handleEntityNotFound(_0x5d1cc3,_0x60e9b8){return function(_0x188ca2){if(!_0x188ca2){_0x5d1cc3['sendStatus'](0x194);}return _0x188ca2;};}function handleError(_0x46f549,_0xc40376){_0xc40376=_0xc40376||0x1f4;return function(_0x1ecb86){logger[_0xe3fc('0x22')](_0x1ecb86[_0xe3fc('0x23')]);if(_0x1ecb86[_0xe3fc('0x24')]){delete _0x1ecb86[_0xe3fc('0x24')];}_0x46f549[_0xe3fc('0x18')](_0xc40376)[_0xe3fc('0x25')](_0x1ecb86);};}exports[_0xe3fc('0x26')]=function(_0x30a897,_0x39f375){var _0x25a0af={},_0x43714d={},_0x38ab54={'count':0x0,'rows':[]};var _0x1f9ba9=_['map'](db[_0xe3fc('0x27')][_0xe3fc('0x28')],function(_0x1ce4af){return{'name':_0x1ce4af['fieldName'],'type':_0x1ce4af[_0xe3fc('0x29')][_0xe3fc('0x2a')]};});_0x43714d[_0xe3fc('0x2b')]=_['map'](_0x1f9ba9,_0xe3fc('0x24'));_0x43714d[_0xe3fc('0x2c')]=_[_0xe3fc('0x2d')](_0x30a897[_0xe3fc('0x2c')]);_0x43714d[_0xe3fc('0x2e')]=_[_0xe3fc('0x2f')](_0x43714d['model'],_0x43714d[_0xe3fc('0x2c')]);_0x25a0af[_0xe3fc('0x30')]=_[_0xe3fc('0x2f')](_0x43714d[_0xe3fc('0x2b')],qs[_0xe3fc('0x31')](_0x30a897[_0xe3fc('0x2c')][_0xe3fc('0x31')]));_0x25a0af[_0xe3fc('0x30')]=_0x25a0af[_0xe3fc('0x30')][_0xe3fc('0x32')]?_0x25a0af[_0xe3fc('0x30')]:_0x43714d[_0xe3fc('0x2b')];if(!_0x30a897[_0xe3fc('0x2c')]['hasOwnProperty']('nolimit')){_0x25a0af['limit']=qs[_0xe3fc('0x1a')](_0x30a897[_0xe3fc('0x2c')][_0xe3fc('0x1a')]);_0x25a0af[_0xe3fc('0x1c')]=qs[_0xe3fc('0x1c')](_0x30a897[_0xe3fc('0x2c')][_0xe3fc('0x1c')]);}_0x25a0af[_0xe3fc('0x33')]=qs['sort'](_0x30a897[_0xe3fc('0x2c')][_0xe3fc('0x34')]);_0x25a0af['where']=qs[_0xe3fc('0x2e')](_[_0xe3fc('0x35')](_0x30a897[_0xe3fc('0x2c')],_0x43714d[_0xe3fc('0x2e')]),_0x1f9ba9);if(_0x30a897[_0xe3fc('0x2c')]['filter']){_0x25a0af[_0xe3fc('0x36')]=_['merge'](_0x25a0af['where'],{'$or':_[_0xe3fc('0x37')](_0x1f9ba9,function(_0x3aceb6){if(_0x3aceb6['type']!==_0xe3fc('0x38')){var _0x575910={};_0x575910[_0x3aceb6[_0xe3fc('0x24')]]={'$like':'%'+_0x30a897[_0xe3fc('0x2c')][_0xe3fc('0x39')]+'%'};return _0x575910;}})});}_0x25a0af=_[_0xe3fc('0x3a')]({},_0x25a0af,_0x30a897['options']);var _0x1cd5e2={'where':_0x25a0af[_0xe3fc('0x36')]};return db[_0xe3fc('0x27')][_0xe3fc('0x1b')](_0x1cd5e2)[_0xe3fc('0x21')](function(_0x4ed642){_0x38ab54[_0xe3fc('0x1b')]=_0x4ed642;if(_0x30a897[_0xe3fc('0x2c')][_0xe3fc('0x3b')]){_0x25a0af['include']=[{'all':!![]}];}return db[_0xe3fc('0x27')]['findAll'](_0x25a0af);})[_0xe3fc('0x21')](function(_0x3bf7da){_0x38ab54[_0xe3fc('0x3c')]=_0x3bf7da;return _0x38ab54;})[_0xe3fc('0x21')](respondWithFilteredResult(_0x39f375,_0x25a0af))[_0xe3fc('0x3d')](handleError(_0x39f375,null));};exports['show']=function(_0x2cb89f,_0x2a8e12){var _0x2f199d={'raw':![],'where':{'id':_0x2cb89f[_0xe3fc('0x3e')]['id']}},_0x1568bf={};_0x1568bf['model']=_[_0xe3fc('0x2d')](db['JscriptyProject']['rawAttributes']);_0x1568bf['query']=_[_0xe3fc('0x2d')](_0x2cb89f[_0xe3fc('0x2c')]);_0x1568bf[_0xe3fc('0x2e')]=_[_0xe3fc('0x2f')](_0x1568bf[_0xe3fc('0x2b')],_0x1568bf[_0xe3fc('0x2c')]);_0x2f199d['attributes']=_[_0xe3fc('0x2f')](_0x1568bf['model'],qs[_0xe3fc('0x31')](_0x2cb89f[_0xe3fc('0x2c')][_0xe3fc('0x31')]));_0x2f199d[_0xe3fc('0x30')]=_0x2f199d['attributes'][_0xe3fc('0x32')]?_0x2f199d[_0xe3fc('0x30')]:_0x1568bf[_0xe3fc('0x2b')];if(_0x2cb89f[_0xe3fc('0x2c')][_0xe3fc('0x3b')]){_0x2f199d[_0xe3fc('0x3f')]=[{'all':!![]}];}_0x2f199d=_['merge']({},_0x2f199d,_0x2cb89f['options']);return db[_0xe3fc('0x27')][_0xe3fc('0x40')](_0x2f199d)[_0xe3fc('0x21')](handleEntityNotFound(_0x2a8e12,null))[_0xe3fc('0x21')](respondWithResult(_0x2a8e12,null))[_0xe3fc('0x3d')](handleError(_0x2a8e12,null));};exports[_0xe3fc('0x41')]=function(_0x4f98ee,_0x155c80){return db['JscriptyProject'][_0xe3fc('0x41')](_0x4f98ee['body'],{})['then'](function(_0x49306f){var _0x3b5d97=_0x4f98ee[_0xe3fc('0x42')]['get']({'plain':!![]});if(!_0x3b5d97)throw new Error(_0xe3fc('0x43'));if(_0x3b5d97['role']===_0xe3fc('0x42')){var _0x44dcb9=_0x49306f[_0xe3fc('0x44')]({'plain':!![]});var _0x23f9b7=_0xe3fc('0x45');return db[_0xe3fc('0x46')]['find']({'where':{'name':_0x23f9b7,'userProfileId':_0x3b5d97['userProfileId']},'raw':!![]})[_0xe3fc('0x21')](function(_0x1ca515){if(_0x1ca515&&_0x1ca515[_0xe3fc('0x47')]===0x0){return db[_0xe3fc('0x48')][_0xe3fc('0x41')]({'name':_0x44dcb9[_0xe3fc('0x24')],'resourceId':_0x44dcb9['id'],'type':_0x1ca515[_0xe3fc('0x24')],'sectionId':_0x1ca515['id']},{})['then'](function(){return _0x49306f;});}else{return _0x49306f;}})[_0xe3fc('0x3d')](function(_0x7f7d82){logger[_0xe3fc('0x22')](_0xe3fc('0x49'),_0x7f7d82);throw _0x7f7d82;});}return _0x49306f;})['then'](respondWithResult(_0x155c80,0xc9))['catch'](handleError(_0x155c80,null));};exports['clone']=function(_0x25173e,_0x3a4702){var _0x2321fd={'where':{'id':_0x25173e[_0xe3fc('0x3e')]['id']}},_0x402edf={};_0x402edf[_0xe3fc('0x2b')]=_[_0xe3fc('0x2d')](db[_0xe3fc('0x27')][_0xe3fc('0x28')]);_0x2321fd[_0xe3fc('0x30')]=_[_0xe3fc('0x2f')](_0x402edf[_0xe3fc('0x2b')],qs[_0xe3fc('0x31')](_0x25173e['query']['fields']));_0x2321fd['attributes']=_0x2321fd[_0xe3fc('0x30')][_0xe3fc('0x32')]?_0x2321fd[_0xe3fc('0x30')]:_0x402edf['model'];if(_0x25173e['query'][_0xe3fc('0x3b')]){_0x2321fd[_0xe3fc('0x3f')]=[{'all':!![]}];}_0x2321fd=_[_0xe3fc('0x3a')]({},_0x2321fd,_0x25173e['options']);return db['JscriptyProject']['find'](_0x2321fd)[_0xe3fc('0x21')](handleEntityNotFound(_0x3a4702,null))['then'](function(_0x4c41dd){if(_0x4c41dd){var _0x3020fb=_0x4c41dd['get']({'plain':!![]});_0x3020fb=qs['omit'](_0x3020fb,['id','createdAt',_0xe3fc('0x4a')]);_0x25173e[_0xe3fc('0x4b')]=_[_0xe3fc('0x4c')](_0x25173e[_0xe3fc('0x4b')],['id',_0xe3fc('0x4d'),'updatedAt']);return db[_0xe3fc('0x27')][_0xe3fc('0x41')](_['merge'](_0x3020fb,_0x25173e[_0xe3fc('0x4b')]),{'include':_0x25173e[_0xe3fc('0x2c')][_0xe3fc('0x3b')]?[{'all':!![]}]:undefined})[_0xe3fc('0x21')](function(_0x140acb){var _0x8661ce=_0x25173e[_0xe3fc('0x42')][_0xe3fc('0x44')]({'plain':!![]});if(!_0x8661ce)throw new Error(_0xe3fc('0x43'));if(_0x8661ce[_0xe3fc('0x4e')]===_0xe3fc('0x42')){var _0xd08412=_0x140acb[_0xe3fc('0x44')]({'plain':!![]});var _0x25f7bb=_0xe3fc('0x45');return db[_0xe3fc('0x46')][_0xe3fc('0x40')]({'where':{'name':_0x25f7bb,'userProfileId':_0x8661ce[_0xe3fc('0x4f')]},'raw':!![]})[_0xe3fc('0x21')](function(_0x5ce9be){if(_0x5ce9be&&_0x5ce9be[_0xe3fc('0x47')]===0x0){return db[_0xe3fc('0x48')][_0xe3fc('0x41')]({'name':_0xd08412['name'],'resourceId':_0xd08412['id'],'type':_0x5ce9be[_0xe3fc('0x24')],'sectionId':_0x5ce9be['id']},{})['then'](function(){return _0x140acb;});}else{return _0x140acb;}})[_0xe3fc('0x3d')](function(_0x4caddb){logger['error'](_0xe3fc('0x49'),_0x4caddb);throw _0x4caddb;});}return _0x140acb;});}})[_0xe3fc('0x21')](respondWithResult(_0x3a4702,0xc9))[_0xe3fc('0x3d')](handleError(_0x3a4702,null));};exports[_0xe3fc('0x50')]=function(_0x514238,_0x15e2b8){if(_0x514238[_0xe3fc('0x4b')]['id']){delete _0x514238[_0xe3fc('0x4b')]['id'];}return db[_0xe3fc('0x27')][_0xe3fc('0x40')]({'where':{'id':_0x514238[_0xe3fc('0x3e')]['id']}})[_0xe3fc('0x21')](handleEntityNotFound(_0x15e2b8,null))['then'](saveUpdates(_0x514238[_0xe3fc('0x4b')],null))['then'](respondWithResult(_0x15e2b8,null))[_0xe3fc('0x3d')](handleError(_0x15e2b8,null));};exports[_0xe3fc('0x20')]=function(_0x13606f,_0x3851a2){return db[_0xe3fc('0x27')]['find']({'where':{'id':_0x13606f[_0xe3fc('0x3e')]['id']}})[_0xe3fc('0x21')](handleEntityNotFound(_0x3851a2,null))[_0xe3fc('0x21')](removeEntity(_0x3851a2,null))[_0xe3fc('0x3d')](handleError(_0x3851a2,null));};exports[_0xe3fc('0x51')]=function(_0x34764e,_0x50cabf,_0x3c33de){var _0x3f4a05={'raw':!![],'where':{}};var _0x39a97c={};var _0x37d4b0={'count':0x0,'rows':[]};return db[_0xe3fc('0x27')]['findOne']({'where':{'id':_0x34764e[_0xe3fc('0x3e')]['id']}})[_0xe3fc('0x21')](handleEntityNotFound(_0x50cabf,null))[_0xe3fc('0x21')](function(_0x59c5f9){if(_0x59c5f9){_0x39a97c[_0xe3fc('0x2b')]=_[_0xe3fc('0x2d')](db['JscriptySessionReport'][_0xe3fc('0x28')]);_0x39a97c[_0xe3fc('0x2c')]=_[_0xe3fc('0x2d')](_0x34764e['query']);_0x39a97c[_0xe3fc('0x2e')]=_[_0xe3fc('0x2f')](_0x39a97c['model'],_0x39a97c[_0xe3fc('0x2c')]);_0x3f4a05[_0xe3fc('0x30')]=_[_0xe3fc('0x2f')](_0x39a97c[_0xe3fc('0x2b')],qs[_0xe3fc('0x31')](_0x34764e['query']['fields']));_0x3f4a05[_0xe3fc('0x30')]=_0x3f4a05[_0xe3fc('0x30')][_0xe3fc('0x32')]?_0x3f4a05['attributes']:_0x39a97c['model'];if(!_0x34764e[_0xe3fc('0x2c')][_0xe3fc('0x52')](_0xe3fc('0x53'))){_0x3f4a05[_0xe3fc('0x1a')]=qs[_0xe3fc('0x1a')](_0x34764e[_0xe3fc('0x2c')][_0xe3fc('0x1a')]);_0x3f4a05[_0xe3fc('0x1c')]=qs[_0xe3fc('0x1c')](_0x34764e[_0xe3fc('0x2c')][_0xe3fc('0x1c')]);}_0x3f4a05['order']=qs[_0xe3fc('0x34')](_0x34764e[_0xe3fc('0x2c')][_0xe3fc('0x34')]);_0x3f4a05[_0xe3fc('0x36')]=qs[_0xe3fc('0x2e')](_[_0xe3fc('0x35')](_0x34764e[_0xe3fc('0x2c')],_0x39a97c['filters']));_0x3f4a05['where'][_0xe3fc('0x54')]=_0x59c5f9['id'];if(_0x34764e[_0xe3fc('0x2c')][_0xe3fc('0x39')]){_0x3f4a05['where']=_[_0xe3fc('0x3a')](_0x3f4a05[_0xe3fc('0x36')],{'$or':_[_0xe3fc('0x37')](_0x3f4a05[_0xe3fc('0x30')],function(_0x4b1a49){var _0x4cac7a={};_0x4cac7a[_0x4b1a49]={'$like':'%'+_0x34764e[_0xe3fc('0x2c')][_0xe3fc('0x39')]+'%'};return _0x4cac7a;})});}_0x3f4a05=_[_0xe3fc('0x3a')]({},_0x3f4a05,_0x34764e[_0xe3fc('0x55')]);return db[_0xe3fc('0x56')]['count']({'where':_0x3f4a05[_0xe3fc('0x36')]})[_0xe3fc('0x21')](function(_0x58675e){_0x37d4b0[_0xe3fc('0x1b')]=_0x58675e;if(_0x34764e[_0xe3fc('0x2c')][_0xe3fc('0x3b')]){_0x3f4a05[_0xe3fc('0x3f')]=[{'all':!![]}];}return db[_0xe3fc('0x56')][_0xe3fc('0x57')](_0x3f4a05);})[_0xe3fc('0x21')](function(_0xb29841){_0x37d4b0['rows']=_0xb29841;return _0x37d4b0;});}})[_0xe3fc('0x21')](respondWithFilteredResult(_0x50cabf,_0x3f4a05))[_0xe3fc('0x3d')](handleError(_0x50cabf,null));};exports[_0xe3fc('0x58')]=function(_0x127d54,_0x40b353,_0x392d40){var _0x146951={'raw':!![],'where':{}};var _0x4c366a={};var _0xab7cc4={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x127d54[_0xe3fc('0x3e')]['id']}})[_0xe3fc('0x21')](handleEntityNotFound(_0x40b353,null))['then'](function(_0x2f2a7c){if(_0x2f2a7c){_0x4c366a['model']=_[_0xe3fc('0x2d')](db[_0xe3fc('0x59')][_0xe3fc('0x28')]);_0x4c366a[_0xe3fc('0x2c')]=_[_0xe3fc('0x2d')](_0x127d54[_0xe3fc('0x2c')]);_0x4c366a['filters']=_['intersection'](_0x4c366a['model'],_0x4c366a[_0xe3fc('0x2c')]);_0x146951['attributes']=_[_0xe3fc('0x2f')](_0x4c366a['model'],qs[_0xe3fc('0x31')](_0x127d54[_0xe3fc('0x2c')][_0xe3fc('0x31')]));_0x146951[_0xe3fc('0x30')]=_0x146951['attributes']['length']?_0x146951['attributes']:_0x4c366a[_0xe3fc('0x2b')];if(!_0x127d54[_0xe3fc('0x2c')][_0xe3fc('0x52')](_0xe3fc('0x53'))){_0x146951[_0xe3fc('0x1a')]=qs[_0xe3fc('0x1a')](_0x127d54[_0xe3fc('0x2c')]['limit']);_0x146951[_0xe3fc('0x1c')]=qs[_0xe3fc('0x1c')](_0x127d54[_0xe3fc('0x2c')][_0xe3fc('0x1c')]);}_0x146951[_0xe3fc('0x33')]=qs[_0xe3fc('0x34')](_0x127d54['query'][_0xe3fc('0x34')]);_0x146951['where']=qs['filters'](_[_0xe3fc('0x35')](_0x127d54[_0xe3fc('0x2c')],_0x4c366a[_0xe3fc('0x2e')]));_0x146951[_0xe3fc('0x36')][_0xe3fc('0x54')]=_0x2f2a7c['id'];if(_0x127d54[_0xe3fc('0x2c')]['filter']){_0x146951[_0xe3fc('0x36')]=_[_0xe3fc('0x3a')](_0x146951[_0xe3fc('0x36')],{'$or':_[_0xe3fc('0x37')](_0x146951[_0xe3fc('0x30')],function(_0x173841){var _0x12992d={};_0x12992d[_0x173841]={'$like':'%'+_0x127d54[_0xe3fc('0x2c')][_0xe3fc('0x39')]+'%'};return _0x12992d;})});}_0x146951=_[_0xe3fc('0x3a')]({},_0x146951,_0x127d54[_0xe3fc('0x55')]);return db[_0xe3fc('0x59')][_0xe3fc('0x1b')]({'where':_0x146951[_0xe3fc('0x36')]})[_0xe3fc('0x21')](function(_0x443c8b){_0xab7cc4['count']=_0x443c8b;if(_0x127d54[_0xe3fc('0x2c')][_0xe3fc('0x3b')]){_0x146951['include']=[{'all':!![]}];}return db[_0xe3fc('0x59')][_0xe3fc('0x57')](_0x146951);})['then'](function(_0x1268f3){_0xab7cc4[_0xe3fc('0x3c')]=_0x1268f3;return _0xab7cc4;});}})[_0xe3fc('0x21')](respondWithFilteredResult(_0x40b353,_0x146951))[_0xe3fc('0x3d')](handleError(_0x40b353,null));};function char(_0x343c05){return _0xe3fc('0x5a')===typeof _0x343c05?String[_0xe3fc('0x5b')][_0xe3fc('0x5c')](null,arguments):_0x343c05;}function needsEncapsulation(_0x139b99){return!!_0x139b99&&(_0x139b99[_0xe3fc('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x139b99[_0xe3fc('0x5d')]()[_0xe3fc('0x5e')](char(0xa))>=0x0||_0x139b99['toString']()[_0xe3fc('0x5e')](char(0x2c))>=0x0||_0x139b99[_0xe3fc('0x5d')]()[_0xe3fc('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x578646){var _0x31b16c=char(0x22),_0x3afded='\x5c'+char(0x22),_0x315bce=_0x578646[_0xe3fc('0x5d')]()[_0xe3fc('0x5f')](new RegExp(_0x31b16c,'g'),_0x3afded);return _0x31b16c+_0x315bce+_0x31b16c;}exports[_0xe3fc('0x60')]=function(_0x3fc0f3,_0x243d81,_0x52c222){var _0x3d8e8c,_0x3c8734;var _0x6ec088={'where':{'ProjectId':_0x3fc0f3[_0xe3fc('0x3e')]['id']}};if(_0x3fc0f3[_0xe3fc('0x2c')][_0xe3fc('0x61')]){_0x6ec088[_0xe3fc('0x36')]['starttime']=JSON['parse'](_0x3fc0f3[_0xe3fc('0x2c')][_0xe3fc('0x61')]);}return db[_0xe3fc('0x56')]['findAll'](_0x6ec088)['then'](handleEntityNotFound(_0x243d81,null))[_0xe3fc('0x21')](function(_0x15025e){if(_0x15025e){_0x3d8e8c=_0x15025e;return db[_0xe3fc('0x62')][_0xe3fc('0x57')]({'where':{'SessionId':{'$in':_[_0xe3fc('0x37')](_0x3d8e8c,'id')},'ProjectId':_0x3fc0f3['params']['id']},'order':_0xe3fc('0x63')});}})[_0xe3fc('0x21')](handleEntityNotFound(_0x243d81,null))[_0xe3fc('0x21')](function(_0x3694c3){if(_0x3694c3){_0x3c8734=_0x3694c3;var _0x273128={};for(var _0x21e81a=0x0,_0xcde302=_0x3c8734[_0xe3fc('0x32')];_0x21e81a<_0xcde302;_0x21e81a++){if(!_0x273128['hasOwnProperty'](_0x3c8734[_0x21e81a]['questionId'])){_0x273128[_0x3c8734[_0x21e81a][_0xe3fc('0x64')]]=needsEncapsulation(_0x3c8734[_0x21e81a][_0xe3fc('0x65')])?encapsulate(_0x3c8734[_0x21e81a][_0xe3fc('0x65')]):_0x3c8734[_0x21e81a][_0xe3fc('0x65')];}}var _0x20cf62=[],_0x5ee879={};for(var _0x17305b=0x0,_0x2ecd8e=_0x3d8e8c[_0xe3fc('0x32')];_0x17305b<_0x2ecd8e;_0x17305b++){_0x5ee879={'ProjectId':_0x3fc0f3[_0xe3fc('0x3e')]['id'],'SessionId':_0x3d8e8c[_0x17305b]['id'],'StartTime':moment(_0x3d8e8c[_0x17305b][_0xe3fc('0x66')])[_0xe3fc('0x67')](_0xe3fc('0x68'))};for(var _0x13412c=0x0,_0x21d258=_0x3c8734[_0xe3fc('0x32')];_0x13412c<_0x21d258;_0x13412c++){if(_0x3c8734[_0x13412c][_0xe3fc('0x69')]==_0x3d8e8c[_0x17305b]['id']&&_0x273128['hasOwnProperty'](_0x3c8734[_0x13412c][_0xe3fc('0x64')])){_0x5ee879[_0x273128[_0x3c8734[_0x13412c][_0xe3fc('0x64')]]]=_0x3c8734[_0x13412c][_0xe3fc('0x6a')];}}for(var _0x40fcfb in _0x273128){if(!_0x5ee879[_0xe3fc('0x52')](_0x273128[_0x40fcfb])){_0x5ee879[_0x273128[_0x40fcfb]]=null;}}_0x20cf62['push'](_0x5ee879);}return _0x20cf62;}})[_0xe3fc('0x21')](function(_0x96aafc){if(!_[_0xe3fc('0x6b')](_0x96aafc)){var _0x75173d=toCsv(_0x96aafc);var _0xae19bc=Date['now']();fs[_0xe3fc('0x6c')](util[_0xe3fc('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3fc0f3[_0xe3fc('0x3e')]['id'],_0xae19bc),_0x75173d);_0x243d81['setHeader'](_0xe3fc('0x6d'),_0xe3fc('0x6e')+util[_0xe3fc('0x67')](_0xe3fc('0x6f'),_0x3fc0f3[_0xe3fc('0x3e')]['id'],_0xae19bc));_0x243d81['setHeader'](_0xe3fc('0x70'),_0xe3fc('0x71'));return _0x243d81['download'](util[_0xe3fc('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3fc0f3[_0xe3fc('0x3e')]['id'],_0xae19bc));}else{return _0x243d81['sendStatus'](0xcc);}})[_0xe3fc('0x3d')](handleError(_0x243d81,null));}; \ No newline at end of file +var _0x1beb=['isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','findOne','JscriptySessionReport','order','ProjectId','findAll','JscriptyAnswerReport','pick','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0x1beb,0x165));var _0xb1be=function(_0x4849ff,_0x3ab5f0){_0x4849ff=_0x4849ff-0x0;var _0x391129=_0x1beb[_0x4849ff];return _0x391129;};'use strict';var emlformat=require(_0xb1be('0x0'));var rimraf=require(_0xb1be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1be('0x2'));var rp=require(_0xb1be('0x3'));var moment=require(_0xb1be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1be('0x5'));var util=require(_0xb1be('0x6'));var path=require('path');var sox=require(_0xb1be('0x7'));var csv=require(_0xb1be('0x8'));var ejs=require(_0xb1be('0x9'));var fs=require('fs');var fs_extra=require(_0xb1be('0xa'));var _=require(_0xb1be('0xb'));var squel=require(_0xb1be('0xc'));var crypto=require(_0xb1be('0xd'));var jsforce=require(_0xb1be('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb1be('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb1be('0xf'));var authService=require(_0xb1be('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1be('0x11'));var logger=require(_0xb1be('0x12'))('api');var utils=require(_0xb1be('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb1be('0x14'));var db=require(_0xb1be('0x15'))['db'];function respondWithStatusCode(_0x5eb9a7,_0x276ef4){_0x276ef4=_0x276ef4||0xcc;return function(_0x33fd7e){if(_0x33fd7e){return _0x5eb9a7[_0xb1be('0x16')](_0x276ef4);}return _0x5eb9a7[_0xb1be('0x17')](_0x276ef4)[_0xb1be('0x18')]();};}function respondWithResult(_0x1b28d6,_0xe9afab){_0xe9afab=_0xe9afab||0xc8;return function(_0x3772d3){if(_0x3772d3){return _0x1b28d6['status'](_0xe9afab)[_0xb1be('0x19')](_0x3772d3);}};}function respondWithFilteredResult(_0x5399b0,_0x361954){return function(_0x386c28){if(_0x386c28){var _0x172e74=typeof _0x361954[_0xb1be('0x1a')]===_0xb1be('0x1b')&&typeof _0x361954['limit']==='undefined';var _0x213c9d=_0x386c28[_0xb1be('0x1c')];var _0x2bad8f=_0x172e74?0x0:_0x361954['offset'];var _0x157b8a=_0x172e74?_0x386c28['count']:_0x361954[_0xb1be('0x1a')]+_0x361954[_0xb1be('0x1d')];var _0x58ceff;if(_0x157b8a>=_0x213c9d){_0x157b8a=_0x213c9d;_0x58ceff=0xc8;}else{_0x58ceff=0xce;}_0x5399b0[_0xb1be('0x17')](_0x58ceff);return _0x5399b0[_0xb1be('0x1e')]('Content-Range',_0x2bad8f+'-'+_0x157b8a+'/'+_0x213c9d)[_0xb1be('0x19')](_0x386c28);}return null;};}function patchUpdates(_0x453530){return function(_0x9fa059){try{jsonpatch['apply'](_0x9fa059,_0x453530,!![]);}catch(_0x36d7bf){return BPromise[_0xb1be('0x1f')](_0x36d7bf);}return _0x9fa059['save']();};}function saveUpdates(_0x362768,_0x35c456){return function(_0x57cf28){if(_0x57cf28){return _0x57cf28[_0xb1be('0x20')](_0x362768)[_0xb1be('0x21')](function(_0x36f72d){return _0x36f72d;});}return null;};}function removeEntity(_0x55bd24,_0x372a6c){return function(_0x5de89c){if(_0x5de89c){return _0x5de89c['destroy']()[_0xb1be('0x21')](function(){var _0x5194d2=_0x5de89c[_0xb1be('0x22')]({'plain':!![]});var _0x281c25=_0xb1be('0x23');return db[_0xb1be('0x24')][_0xb1be('0x25')]({'where':{'type':_0x281c25,'resourceId':_0x5194d2['id']}})['then'](function(){return _0x5de89c;});})[_0xb1be('0x21')](function(){_0x55bd24[_0xb1be('0x17')](0xcc)[_0xb1be('0x18')]();});}};}function handleEntityNotFound(_0x53da29,_0x3ef2b2){return function(_0x339adc){if(!_0x339adc){_0x53da29[_0xb1be('0x16')](0x194);}return _0x339adc;};}function handleError(_0x5000eb,_0x585e89){_0x585e89=_0x585e89||0x1f4;return function(_0x1129d5){logger[_0xb1be('0x26')](_0x1129d5[_0xb1be('0x27')]);if(_0x1129d5[_0xb1be('0x28')]){delete _0x1129d5['name'];}_0x5000eb[_0xb1be('0x17')](_0x585e89)[_0xb1be('0x29')](_0x1129d5);};}exports[_0xb1be('0x2a')]=function(_0x59b7ae,_0x188fe1){var _0x49b160={},_0x12d4f2={},_0x2c4c1d={'count':0x0,'rows':[]};var _0x1cbe07=_[_0xb1be('0x2b')](db['JscriptyProject'][_0xb1be('0x2c')],function(_0x5494b8){return{'name':_0x5494b8[_0xb1be('0x2d')],'type':_0x5494b8[_0xb1be('0x2e')][_0xb1be('0x2f')]};});_0x12d4f2['model']=_[_0xb1be('0x2b')](_0x1cbe07,_0xb1be('0x28'));_0x12d4f2['query']=_[_0xb1be('0x30')](_0x59b7ae[_0xb1be('0x31')]);_0x12d4f2['filters']=_[_0xb1be('0x32')](_0x12d4f2[_0xb1be('0x33')],_0x12d4f2['query']);_0x49b160['attributes']=_['intersection'](_0x12d4f2[_0xb1be('0x33')],qs[_0xb1be('0x34')](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x34')]));_0x49b160[_0xb1be('0x35')]=_0x49b160[_0xb1be('0x35')][_0xb1be('0x36')]?_0x49b160[_0xb1be('0x35')]:_0x12d4f2[_0xb1be('0x33')];if(!_0x59b7ae['query'][_0xb1be('0x37')](_0xb1be('0x38'))){_0x49b160[_0xb1be('0x1d')]=qs[_0xb1be('0x1d')](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x1d')]);_0x49b160[_0xb1be('0x1a')]=qs['offset'](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x1a')]);}_0x49b160['order']=qs[_0xb1be('0x39')](_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x39')]);_0x49b160[_0xb1be('0x3a')]=qs[_0xb1be('0x3b')](_['pick'](_0x59b7ae['query'],_0x12d4f2['filters']),_0x1cbe07);if(_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x3c')]){_0x49b160[_0xb1be('0x3a')]=_['merge'](_0x49b160[_0xb1be('0x3a')],{'$or':_[_0xb1be('0x2b')](_0x1cbe07,function(_0x3b884e){if(_0x3b884e['type']!==_0xb1be('0x3d')){var _0x3fe2cf={};_0x3fe2cf[_0x3b884e[_0xb1be('0x28')]]={'$like':'%'+_0x59b7ae['query']['filter']+'%'};return _0x3fe2cf;}})});}_0x49b160=_['merge']({},_0x49b160,_0x59b7ae[_0xb1be('0x3e')]);var _0x50b0bc={'where':_0x49b160[_0xb1be('0x3a')]};return db[_0xb1be('0x3f')]['count'](_0x50b0bc)[_0xb1be('0x21')](function(_0x193c73){_0x2c4c1d[_0xb1be('0x1c')]=_0x193c73;if(_0x59b7ae[_0xb1be('0x31')][_0xb1be('0x40')]){_0x49b160[_0xb1be('0x41')]=[{'all':!![]}];}return db[_0xb1be('0x3f')]['findAll'](_0x49b160);})[_0xb1be('0x21')](function(_0x125ee7){_0x2c4c1d[_0xb1be('0x42')]=_0x125ee7;return _0x2c4c1d;})[_0xb1be('0x21')](respondWithFilteredResult(_0x188fe1,_0x49b160))[_0xb1be('0x43')](handleError(_0x188fe1,null));};exports['show']=function(_0x2b3836,_0x17ff51){var _0x116509={'raw':![],'where':{'id':_0x2b3836['params']['id']}},_0x38794e={};_0x38794e[_0xb1be('0x33')]=_['keys'](db[_0xb1be('0x3f')][_0xb1be('0x2c')]);_0x38794e[_0xb1be('0x31')]=_[_0xb1be('0x30')](_0x2b3836[_0xb1be('0x31')]);_0x38794e['filters']=_[_0xb1be('0x32')](_0x38794e['model'],_0x38794e[_0xb1be('0x31')]);_0x116509[_0xb1be('0x35')]=_[_0xb1be('0x32')](_0x38794e[_0xb1be('0x33')],qs['fields'](_0x2b3836[_0xb1be('0x31')][_0xb1be('0x34')]));_0x116509[_0xb1be('0x35')]=_0x116509[_0xb1be('0x35')]['length']?_0x116509['attributes']:_0x38794e[_0xb1be('0x33')];if(_0x2b3836['query']['includeAll']){_0x116509[_0xb1be('0x41')]=[{'all':!![]}];}_0x116509=_[_0xb1be('0x44')]({},_0x116509,_0x2b3836[_0xb1be('0x3e')]);return db[_0xb1be('0x3f')][_0xb1be('0x45')](_0x116509)[_0xb1be('0x21')](handleEntityNotFound(_0x17ff51,null))['then'](respondWithResult(_0x17ff51,null))[_0xb1be('0x43')](handleError(_0x17ff51,null));};exports[_0xb1be('0x46')]=function(_0x23f03f,_0x425257){return db['JscriptyProject']['create'](_0x23f03f[_0xb1be('0x47')],{})[_0xb1be('0x21')](function(_0x4abd1b){var _0x1db7ed=_0x23f03f[_0xb1be('0x48')]['get']({'plain':!![]});if(!_0x1db7ed)throw new Error(_0xb1be('0x49'));if(_0x1db7ed[_0xb1be('0x4a')]===_0xb1be('0x48')){var _0x2fcf8a=_0x4abd1b['get']({'plain':!![]});var _0x298cf3=_0xb1be('0x23');return db[_0xb1be('0x4b')][_0xb1be('0x45')]({'where':{'name':_0x298cf3,'userProfileId':_0x1db7ed[_0xb1be('0x4c')]},'raw':!![]})['then'](function(_0x584f54){if(_0x584f54&&_0x584f54[_0xb1be('0x4d')]===0x0){return db['UserProfileResource'][_0xb1be('0x46')]({'name':_0x2fcf8a[_0xb1be('0x28')],'resourceId':_0x2fcf8a['id'],'type':_0x584f54[_0xb1be('0x28')],'sectionId':_0x584f54['id']},{})[_0xb1be('0x21')](function(){return _0x4abd1b;});}else{return _0x4abd1b;}})[_0xb1be('0x43')](function(_0x44a47a){logger[_0xb1be('0x26')](_0xb1be('0x4e'),_0x44a47a);throw _0x44a47a;});}return _0x4abd1b;})[_0xb1be('0x21')](respondWithResult(_0x425257,0xc9))[_0xb1be('0x43')](handleError(_0x425257,null));};exports['clone']=function(_0x196eb0,_0x1f3531){var _0x540014={'where':{'id':_0x196eb0[_0xb1be('0x4f')]['id']}},_0x1ace00={};_0x1ace00[_0xb1be('0x33')]=_[_0xb1be('0x30')](db[_0xb1be('0x3f')][_0xb1be('0x2c')]);_0x540014[_0xb1be('0x35')]=_[_0xb1be('0x32')](_0x1ace00[_0xb1be('0x33')],qs[_0xb1be('0x34')](_0x196eb0[_0xb1be('0x31')]['fields']));_0x540014[_0xb1be('0x35')]=_0x540014['attributes'][_0xb1be('0x36')]?_0x540014[_0xb1be('0x35')]:_0x1ace00[_0xb1be('0x33')];if(_0x196eb0[_0xb1be('0x31')][_0xb1be('0x40')]){_0x540014[_0xb1be('0x41')]=[{'all':!![]}];}_0x540014=_[_0xb1be('0x44')]({},_0x540014,_0x196eb0[_0xb1be('0x3e')]);return db[_0xb1be('0x3f')][_0xb1be('0x45')](_0x540014)[_0xb1be('0x21')](handleEntityNotFound(_0x1f3531,null))['then'](function(_0x5bf6fe){if(_0x5bf6fe){var _0xce9df7=_0x5bf6fe[_0xb1be('0x22')]({'plain':!![]});_0xce9df7=qs[_0xb1be('0x50')](_0xce9df7,['id',_0xb1be('0x51'),'updatedAt']);_0x196eb0['body']=_['omit'](_0x196eb0[_0xb1be('0x47')],['id',_0xb1be('0x51'),'updatedAt']);return db[_0xb1be('0x3f')][_0xb1be('0x46')](_[_0xb1be('0x44')](_0xce9df7,_0x196eb0[_0xb1be('0x47')]),{'include':_0x196eb0[_0xb1be('0x31')][_0xb1be('0x40')]?[{'all':!![]}]:undefined})[_0xb1be('0x21')](function(_0x43ddc5){var _0x21edbe=_0x196eb0[_0xb1be('0x48')][_0xb1be('0x22')]({'plain':!![]});if(!_0x21edbe)throw new Error(_0xb1be('0x49'));if(_0x21edbe[_0xb1be('0x4a')]==='user'){var _0x393977=_0x43ddc5['get']({'plain':!![]});var _0x3fce0f=_0xb1be('0x23');return db[_0xb1be('0x4b')][_0xb1be('0x45')]({'where':{'name':_0x3fce0f,'userProfileId':_0x21edbe['userProfileId']},'raw':!![]})['then'](function(_0x48d91d){if(_0x48d91d&&_0x48d91d[_0xb1be('0x4d')]===0x0){return db[_0xb1be('0x24')][_0xb1be('0x46')]({'name':_0x393977[_0xb1be('0x28')],'resourceId':_0x393977['id'],'type':_0x48d91d[_0xb1be('0x28')],'sectionId':_0x48d91d['id']},{})[_0xb1be('0x21')](function(){return _0x43ddc5;});}else{return _0x43ddc5;}})[_0xb1be('0x43')](function(_0x44341e){logger['error'](_0xb1be('0x4e'),_0x44341e);throw _0x44341e;});}return _0x43ddc5;});}})['then'](respondWithResult(_0x1f3531,0xc9))[_0xb1be('0x43')](handleError(_0x1f3531,null));};exports[_0xb1be('0x20')]=function(_0x189286,_0xc3316c){if(_0x189286[_0xb1be('0x47')]['id']){delete _0x189286[_0xb1be('0x47')]['id'];}return db[_0xb1be('0x3f')][_0xb1be('0x45')]({'where':{'id':_0x189286[_0xb1be('0x4f')]['id']}})[_0xb1be('0x21')](handleEntityNotFound(_0xc3316c,null))[_0xb1be('0x21')](saveUpdates(_0x189286[_0xb1be('0x47')],null))[_0xb1be('0x21')](respondWithResult(_0xc3316c,null))['catch'](handleError(_0xc3316c,null));};exports[_0xb1be('0x25')]=function(_0x3d4a1b,_0x18e7c5){return db['JscriptyProject'][_0xb1be('0x45')]({'where':{'id':_0x3d4a1b[_0xb1be('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18e7c5,null))['then'](removeEntity(_0x18e7c5,null))[_0xb1be('0x43')](handleError(_0x18e7c5,null));};exports['getSessions']=function(_0xbea274,_0x169fa7,_0x5e750a){var _0xc4202b={'raw':!![],'where':{}};var _0x585bff={};var _0x47e061={'count':0x0,'rows':[]};return db[_0xb1be('0x3f')][_0xb1be('0x52')]({'where':{'id':_0xbea274[_0xb1be('0x4f')]['id']}})[_0xb1be('0x21')](handleEntityNotFound(_0x169fa7,null))[_0xb1be('0x21')](function(_0x21e088){if(_0x21e088){_0x585bff['model']=_[_0xb1be('0x30')](db[_0xb1be('0x53')][_0xb1be('0x2c')]);_0x585bff[_0xb1be('0x31')]=_[_0xb1be('0x30')](_0xbea274[_0xb1be('0x31')]);_0x585bff[_0xb1be('0x3b')]=_[_0xb1be('0x32')](_0x585bff[_0xb1be('0x33')],_0x585bff[_0xb1be('0x31')]);_0xc4202b[_0xb1be('0x35')]=_['intersection'](_0x585bff['model'],qs[_0xb1be('0x34')](_0xbea274[_0xb1be('0x31')]['fields']));_0xc4202b[_0xb1be('0x35')]=_0xc4202b[_0xb1be('0x35')][_0xb1be('0x36')]?_0xc4202b[_0xb1be('0x35')]:_0x585bff[_0xb1be('0x33')];if(!_0xbea274[_0xb1be('0x31')][_0xb1be('0x37')](_0xb1be('0x38'))){_0xc4202b[_0xb1be('0x1d')]=qs[_0xb1be('0x1d')](_0xbea274[_0xb1be('0x31')][_0xb1be('0x1d')]);_0xc4202b['offset']=qs['offset'](_0xbea274[_0xb1be('0x31')][_0xb1be('0x1a')]);}_0xc4202b[_0xb1be('0x54')]=qs[_0xb1be('0x39')](_0xbea274[_0xb1be('0x31')][_0xb1be('0x39')]);_0xc4202b['where']=qs['filters'](_['pick'](_0xbea274['query'],_0x585bff[_0xb1be('0x3b')]));_0xc4202b[_0xb1be('0x3a')][_0xb1be('0x55')]=_0x21e088['id'];if(_0xbea274['query'][_0xb1be('0x3c')]){_0xc4202b['where']=_[_0xb1be('0x44')](_0xc4202b[_0xb1be('0x3a')],{'$or':_[_0xb1be('0x2b')](_0xc4202b[_0xb1be('0x35')],function(_0x1b3023){var _0x3315da={};_0x3315da[_0x1b3023]={'$like':'%'+_0xbea274[_0xb1be('0x31')][_0xb1be('0x3c')]+'%'};return _0x3315da;})});}_0xc4202b=_[_0xb1be('0x44')]({},_0xc4202b,_0xbea274[_0xb1be('0x3e')]);return db['JscriptySessionReport'][_0xb1be('0x1c')]({'where':_0xc4202b[_0xb1be('0x3a')]})['then'](function(_0x12d3b8){_0x47e061['count']=_0x12d3b8;if(_0xbea274[_0xb1be('0x31')][_0xb1be('0x40')]){_0xc4202b[_0xb1be('0x41')]=[{'all':!![]}];}return db[_0xb1be('0x53')][_0xb1be('0x56')](_0xc4202b);})[_0xb1be('0x21')](function(_0x59afc2){_0x47e061[_0xb1be('0x42')]=_0x59afc2;return _0x47e061;});}})[_0xb1be('0x21')](respondWithFilteredResult(_0x169fa7,_0xc4202b))[_0xb1be('0x43')](handleError(_0x169fa7,null));};exports['getAnswers']=function(_0xd9ff0a,_0x5a91bb,_0x5e1a89){var _0x137c24={'raw':!![],'where':{}};var _0x527237={};var _0x1657a6={'count':0x0,'rows':[]};return db[_0xb1be('0x3f')][_0xb1be('0x52')]({'where':{'id':_0xd9ff0a[_0xb1be('0x4f')]['id']}})[_0xb1be('0x21')](handleEntityNotFound(_0x5a91bb,null))[_0xb1be('0x21')](function(_0x1f0d48){if(_0x1f0d48){_0x527237['model']=_[_0xb1be('0x30')](db[_0xb1be('0x57')]['rawAttributes']);_0x527237[_0xb1be('0x31')]=_[_0xb1be('0x30')](_0xd9ff0a[_0xb1be('0x31')]);_0x527237[_0xb1be('0x3b')]=_[_0xb1be('0x32')](_0x527237[_0xb1be('0x33')],_0x527237[_0xb1be('0x31')]);_0x137c24['attributes']=_['intersection'](_0x527237['model'],qs[_0xb1be('0x34')](_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x34')]));_0x137c24['attributes']=_0x137c24[_0xb1be('0x35')][_0xb1be('0x36')]?_0x137c24[_0xb1be('0x35')]:_0x527237[_0xb1be('0x33')];if(!_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x37')](_0xb1be('0x38'))){_0x137c24[_0xb1be('0x1d')]=qs['limit'](_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x1d')]);_0x137c24[_0xb1be('0x1a')]=qs[_0xb1be('0x1a')](_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x1a')]);}_0x137c24[_0xb1be('0x54')]=qs[_0xb1be('0x39')](_0xd9ff0a[_0xb1be('0x31')]['sort']);_0x137c24[_0xb1be('0x3a')]=qs[_0xb1be('0x3b')](_[_0xb1be('0x58')](_0xd9ff0a[_0xb1be('0x31')],_0x527237[_0xb1be('0x3b')]));_0x137c24[_0xb1be('0x3a')]['ProjectId']=_0x1f0d48['id'];if(_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x3c')]){_0x137c24[_0xb1be('0x3a')]=_[_0xb1be('0x44')](_0x137c24[_0xb1be('0x3a')],{'$or':_[_0xb1be('0x2b')](_0x137c24[_0xb1be('0x35')],function(_0x4351eb){var _0x10d65b={};_0x10d65b[_0x4351eb]={'$like':'%'+_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x3c')]+'%'};return _0x10d65b;})});}_0x137c24=_['merge']({},_0x137c24,_0xd9ff0a[_0xb1be('0x3e')]);return db[_0xb1be('0x57')]['count']({'where':_0x137c24[_0xb1be('0x3a')]})[_0xb1be('0x21')](function(_0x3d6816){_0x1657a6[_0xb1be('0x1c')]=_0x3d6816;if(_0xd9ff0a[_0xb1be('0x31')][_0xb1be('0x40')]){_0x137c24['include']=[{'all':!![]}];}return db[_0xb1be('0x57')][_0xb1be('0x56')](_0x137c24);})[_0xb1be('0x21')](function(_0x5dd376){_0x1657a6[_0xb1be('0x42')]=_0x5dd376;return _0x1657a6;});}})[_0xb1be('0x21')](respondWithFilteredResult(_0x5a91bb,_0x137c24))[_0xb1be('0x43')](handleError(_0x5a91bb,null));};function char(_0x25e703){return _0xb1be('0x59')===typeof _0x25e703?String[_0xb1be('0x5a')][_0xb1be('0x5b')](null,arguments):_0x25e703;}function needsEncapsulation(_0x44d184){return!!_0x44d184&&(_0x44d184[_0xb1be('0x5c')]()[_0xb1be('0x5d')](char(0xd))>=0x0||_0x44d184[_0xb1be('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x44d184[_0xb1be('0x5c')]()[_0xb1be('0x5d')](char(0x2c))>=0x0||_0x44d184['toString']()[_0xb1be('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x4a7ad9){var _0x2fb7d6=char(0x22),_0x578ae8='\x5c'+char(0x22),_0x32ac9e=_0x4a7ad9[_0xb1be('0x5c')]()[_0xb1be('0x5e')](new RegExp(_0x2fb7d6,'g'),_0x578ae8);return _0x2fb7d6+_0x32ac9e+_0x2fb7d6;}exports[_0xb1be('0x5f')]=function(_0x4231cb,_0x44edae,_0x1ac1e6){var _0xe75b2c,_0x1184bc;var _0x45a26f={'where':{'ProjectId':_0x4231cb['params']['id']}};if(_0x4231cb[_0xb1be('0x31')][_0xb1be('0x60')]){_0x45a26f[_0xb1be('0x3a')][_0xb1be('0x61')]=JSON[_0xb1be('0x62')](_0x4231cb[_0xb1be('0x31')][_0xb1be('0x60')]);}return db['JscriptySessionReport'][_0xb1be('0x56')](_0x45a26f)[_0xb1be('0x21')](handleEntityNotFound(_0x44edae,null))[_0xb1be('0x21')](function(_0x257324){if(_0x257324){_0xe75b2c=_0x257324;return db[_0xb1be('0x63')][_0xb1be('0x56')]({'where':{'SessionId':{'$in':_[_0xb1be('0x2b')](_0xe75b2c,'id')},'ProjectId':_0x4231cb['params']['id']},'order':_0xb1be('0x64')});}})[_0xb1be('0x21')](handleEntityNotFound(_0x44edae,null))[_0xb1be('0x21')](function(_0x51c4c3){if(_0x51c4c3){_0x1184bc=_0x51c4c3;var _0x1ecdbc={};for(var _0x4939c4=0x0,_0x3ae879=_0x1184bc['length'];_0x4939c4<_0x3ae879;_0x4939c4++){if(!_0x1ecdbc[_0xb1be('0x37')](_0x1184bc[_0x4939c4][_0xb1be('0x65')])){_0x1ecdbc[_0x1184bc[_0x4939c4][_0xb1be('0x65')]]=needsEncapsulation(_0x1184bc[_0x4939c4]['question'])?encapsulate(_0x1184bc[_0x4939c4][_0xb1be('0x66')]):_0x1184bc[_0x4939c4][_0xb1be('0x66')];}}var _0x4684fe=[],_0x1ae3c0={};for(var _0x483102=0x0,_0x5b1f65=_0xe75b2c['length'];_0x483102<_0x5b1f65;_0x483102++){_0x1ae3c0={'ProjectId':_0x4231cb[_0xb1be('0x4f')]['id'],'SessionId':_0xe75b2c[_0x483102]['id'],'StartTime':moment(_0xe75b2c[_0x483102][_0xb1be('0x61')])[_0xb1be('0x67')](_0xb1be('0x68'))};for(var _0xec5743=0x0,_0x17c726=_0x1184bc[_0xb1be('0x36')];_0xec5743<_0x17c726;_0xec5743++){if(_0x1184bc[_0xec5743][_0xb1be('0x69')]==_0xe75b2c[_0x483102]['id']&&_0x1ecdbc[_0xb1be('0x37')](_0x1184bc[_0xec5743]['questionId'])){_0x1ae3c0[_0x1ecdbc[_0x1184bc[_0xec5743][_0xb1be('0x65')]]]=_0x1184bc[_0xec5743]['answer'];}}for(var _0x2d1b38 in _0x1ecdbc){if(!_0x1ae3c0[_0xb1be('0x37')](_0x1ecdbc[_0x2d1b38])){_0x1ae3c0[_0x1ecdbc[_0x2d1b38]]=null;}}_0x4684fe[_0xb1be('0x6a')](_0x1ae3c0);}return _0x4684fe;}})[_0xb1be('0x21')](function(_0x49b35f){if(!_[_0xb1be('0x6b')](_0x49b35f)){var _0x50ded8=toCsv(_0x49b35f);var _0x4eedde=Date[_0xb1be('0x6c')]();fs[_0xb1be('0x6d')](util['format'](_0xb1be('0x6e'),_0x4231cb[_0xb1be('0x4f')]['id'],_0x4eedde),_0x50ded8);_0x44edae[_0xb1be('0x6f')](_0xb1be('0x70'),_0xb1be('0x71')+util[_0xb1be('0x67')](_0xb1be('0x72'),_0x4231cb[_0xb1be('0x4f')]['id'],_0x4eedde));_0x44edae[_0xb1be('0x6f')](_0xb1be('0x73'),'text/csv');return _0x44edae['download'](util[_0xb1be('0x67')](_0xb1be('0x6e'),_0x4231cb[_0xb1be('0x4f')]['id'],_0x4eedde));}else{return _0x44edae['sendStatus'](0xcc);}})[_0xb1be('0x43')](handleError(_0x44edae,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 82ab69f..6d422ef 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 _0xd67b=['bluebird','path','../../config/environment','exports','define','JscriptyProject','jscripty_projects','util','api','moment'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd67b,0x133));var _0xbd67=function(_0x29392e,_0x53102f){_0x29392e=_0x29392e-0x0;var _0x22cdaa=_0xd67b[_0x29392e];return _0x22cdaa;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0xbd67('0x6')]=function(_0xa5c384,_0x2ad142){return _0xa5c384[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':_0xbd67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2caf=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','api','bluebird','request-promise','path'];(function(_0x4a5eae,_0x4e1fe1){var _0x1c68b0=function(_0x268023){while(--_0x268023){_0x4a5eae['push'](_0x4a5eae['shift']());}};_0x1c68b0(++_0x4e1fe1);}(_0x2caf,0x6a));var _0xf2ca=function(_0x14c931,_0x44a936){_0x14c931=_0x14c931-0x0;var _0x1297cd=_0x2caf[_0x14c931];return _0x1297cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf2ca('0x0'));var moment=require('moment');var BPromise=require(_0xf2ca('0x1'));var rp=require(_0xf2ca('0x2'));var fs=require('fs');var path=require(_0xf2ca('0x3'));var rimraf=require(_0xf2ca('0x4'));var config=require(_0xf2ca('0x5'));var attributes=require(_0xf2ca('0x6'));module[_0xf2ca('0x7')]=function(_0x51372a,_0x8ce770){return _0x51372a[_0xf2ca('0x8')](_0xf2ca('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index cb82bdd..db5f37a 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x20bbe5,_0x189723){var _0x1d94c7=function(_0x29c6b0){while(--_0x29c6b0){_0x20bbe5['push'](_0x20bbe5['shift']());}};_0x1d94c7(++_0x189723);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0xcbe2c0,_0x2f641e){var _0x1285a0=function(_0x341a0d){while(--_0x341a0d){_0xcbe2c0['push'](_0xcbe2c0['shift']());}};_0x1285a0(++_0x2f641e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a1bd848..26688da 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 _0x6b6e=['create','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5d13e4,_0x5595f6){var _0x358470=function(_0x4a1bad){while(--_0x4a1bad){_0x5d13e4['push'](_0x5d13e4['shift']());}};_0x358470(++_0x5595f6);}(_0x6b6e,0x180));var _0xe6b6=function(_0x34f893,_0x4c32d2){_0x34f893=_0x34f893-0x0;var _0x4b339f=_0x6b6e[_0x34f893];return _0x4b339f;};'use strict';var multer=require(_0xe6b6('0x0'));var util=require('util');var path=require(_0xe6b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xe6b6('0x2'));var router=express[_0xe6b6('0x3')]();var fs_extra=require(_0xe6b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe6b6('0x5'));var config=require(_0xe6b6('0x6'));var controller=require(_0xe6b6('0x7'));router[_0xe6b6('0x8')]('/',auth[_0xe6b6('0x9')](),controller[_0xe6b6('0xa')]);router['get'](_0xe6b6('0xb'),auth[_0xe6b6('0x9')](),controller[_0xe6b6('0xc')]);router[_0xe6b6('0x8')](_0xe6b6('0xd'),auth[_0xe6b6('0x9')](),controller[_0xe6b6('0xe')]);router[_0xe6b6('0xf')]('/',auth[_0xe6b6('0x9')](),controller[_0xe6b6('0x10')]);router['put']('/:id',auth[_0xe6b6('0x9')](),controller[_0xe6b6('0x11')]);router['delete'](_0xe6b6('0xd'),auth[_0xe6b6('0x9')](),controller[_0xe6b6('0x12')]);module[_0xe6b6('0x13')]=router; \ No newline at end of file +var _0x0065=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/describe','/:id','isAuthenticated'];(function(_0x295e13,_0x467a6e){var _0x32e391=function(_0x3438a5){while(--_0x3438a5){_0x295e13['push'](_0x295e13['shift']());}};_0x32e391(++_0x467a6e);}(_0x0065,0xba));var _0x5006=function(_0x42467f,_0x180ee9){_0x42467f=_0x42467f-0x0;var _0x11e21c=_0x0065[_0x42467f];return _0x11e21c;};'use strict';var multer=require(_0x5006('0x0'));var util=require(_0x5006('0x1'));var path=require(_0x5006('0x2'));var timeout=require(_0x5006('0x3'));var express=require(_0x5006('0x4'));var router=express[_0x5006('0x5')]();var fs_extra=require(_0x5006('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5006('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x5006('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5006('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x5006('0x8')](_0x5006('0xa'),auth[_0x5006('0xb')](),controller['show']);router[_0x5006('0xc')]('/',auth[_0x5006('0xb')](),controller[_0x5006('0xd')]);router[_0x5006('0xe')](_0x5006('0xa'),auth['isAuthenticated'](),controller[_0x5006('0xf')]);router['delete']('/:id',auth[_0x5006('0xb')](),controller[_0x5006('0x10')]);module[_0x5006('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 793e1a3..ca42195 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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x447b8e,_0x25215c){_0x447b8e=_0x447b8e-0x0;var _0x5d715a=_0x7a54[_0x447b8e];return _0x5d715a;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x75ac19,_0x23efa7){_0x75ac19=_0x75ac19-0x0;var _0x9aecb2=_0x7a54[_0x75ac19];return _0x9aecb2;};'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 0751b00..0b0ad86 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 _0x9a59=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','save','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','create','body','params','find','describe','eml-format','request-promise','moment','bluebird'];(function(_0x3555b7,_0xeded00){var _0x49b7d0=function(_0x179e87){while(--_0x179e87){_0x3555b7['push'](_0x3555b7['shift']());}};_0x49b7d0(++_0xeded00);}(_0x9a59,0x120));var _0x99a5=function(_0x37d912,_0xd0d46d){_0x37d912=_0x37d912-0x0;var _0x424602=_0x9a59[_0x37d912];return _0x424602;};'use strict';var emlformat=require(_0x99a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x99a5('0x1'));var moment=require(_0x99a5('0x2'));var BPromise=require(_0x99a5('0x3'));var Mustache=require(_0x99a5('0x4'));var util=require(_0x99a5('0x5'));var path=require(_0x99a5('0x6'));var sox=require(_0x99a5('0x7'));var csv=require(_0x99a5('0x8'));var ejs=require(_0x99a5('0x9'));var fs=require('fs');var fs_extra=require(_0x99a5('0xa'));var _=require('lodash');var squel=require(_0x99a5('0xb'));var crypto=require(_0x99a5('0xc'));var jsforce=require(_0x99a5('0xd'));var deskjs=require(_0x99a5('0xe'));var toCsv=require(_0x99a5('0x8'));var querystring=require(_0x99a5('0xf'));var Papa=require(_0x99a5('0x10'));var Redis=require(_0x99a5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x99a5('0x12'));var hardwareService=require(_0x99a5('0x13'));var logger=require(_0x99a5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x99a5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x99a5('0x16'))['db'];function respondWithStatusCode(_0x400e9b,_0x437c38){_0x437c38=_0x437c38||0xcc;return function(_0x4eb5dd){if(_0x4eb5dd){return _0x400e9b[_0x99a5('0x17')](_0x437c38);}return _0x400e9b[_0x99a5('0x18')](_0x437c38)[_0x99a5('0x19')]();};}function respondWithResult(_0x1d0044,_0x51c2a5){_0x51c2a5=_0x51c2a5||0xc8;return function(_0x7e5c4c){if(_0x7e5c4c){return _0x1d0044[_0x99a5('0x18')](_0x51c2a5)[_0x99a5('0x1a')](_0x7e5c4c);}};}function respondWithFilteredResult(_0x474252,_0x58de3b){return function(_0x5b484b){if(_0x5b484b){var _0x2b9c24=typeof _0x58de3b['offset']===_0x99a5('0x1b')&&typeof _0x58de3b['limit']===_0x99a5('0x1b');var _0x3b1bc3=_0x5b484b[_0x99a5('0x1c')];var _0x30a381=_0x2b9c24?0x0:_0x58de3b[_0x99a5('0x1d')];var _0x2d41b0=_0x2b9c24?_0x5b484b['count']:_0x58de3b['offset']+_0x58de3b['limit'];var _0x2c6f9f;if(_0x2d41b0>=_0x3b1bc3){_0x2d41b0=_0x3b1bc3;_0x2c6f9f=0xc8;}else{_0x2c6f9f=0xce;}_0x474252['status'](_0x2c6f9f);return _0x474252[_0x99a5('0x1e')]('Content-Range',_0x30a381+'-'+_0x2d41b0+'/'+_0x3b1bc3)[_0x99a5('0x1a')](_0x5b484b);}return null;};}function patchUpdates(_0x39040b){return function(_0x56b105){try{jsonpatch[_0x99a5('0x1f')](_0x56b105,_0x39040b,!![]);}catch(_0xe40b45){return BPromise['reject'](_0xe40b45);}return _0x56b105[_0x99a5('0x20')]();};}function saveUpdates(_0x4e03c4,_0x3331c2){return function(_0x234ffd){if(_0x234ffd){return _0x234ffd[_0x99a5('0x21')](_0x4e03c4)[_0x99a5('0x22')](function(_0x407bf2){return _0x407bf2;});}return null;};}function removeEntity(_0x15580d,_0x14264f){return function(_0x4f9ef8){if(_0x4f9ef8){return _0x4f9ef8[_0x99a5('0x23')]()['then'](function(){_0x15580d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50412c,_0x405016){return function(_0x5f0c25){if(!_0x5f0c25){_0x50412c[_0x99a5('0x17')](0x194);}return _0x5f0c25;};}function handleError(_0x9aeeeb,_0x528ae5){_0x528ae5=_0x528ae5||0x1f4;return function(_0x313c94){logger['error'](_0x313c94[_0x99a5('0x24')]);if(_0x313c94['name']){delete _0x313c94[_0x99a5('0x25')];}_0x9aeeeb[_0x99a5('0x18')](_0x528ae5)[_0x99a5('0x26')](_0x313c94);};}exports[_0x99a5('0x27')]=function(_0x14109a,_0xc59c82){var _0x1c131e={},_0x1e8a66={},_0x22a49a={'count':0x0,'rows':[]};var _0x3ba8a2=_[_0x99a5('0x28')](db[_0x99a5('0x29')][_0x99a5('0x2a')],function(_0x4857c6){return{'name':_0x4857c6['fieldName'],'type':_0x4857c6[_0x99a5('0x2b')][_0x99a5('0x2c')]};});_0x1e8a66[_0x99a5('0x2d')]=_['map'](_0x3ba8a2,'name');_0x1e8a66[_0x99a5('0x2e')]=_['keys'](_0x14109a[_0x99a5('0x2e')]);_0x1e8a66[_0x99a5('0x2f')]=_[_0x99a5('0x30')](_0x1e8a66[_0x99a5('0x2d')],_0x1e8a66[_0x99a5('0x2e')]);_0x1c131e['attributes']=_[_0x99a5('0x30')](_0x1e8a66[_0x99a5('0x2d')],qs[_0x99a5('0x31')](_0x14109a[_0x99a5('0x2e')]['fields']));_0x1c131e['attributes']=_0x1c131e[_0x99a5('0x32')][_0x99a5('0x33')]?_0x1c131e[_0x99a5('0x32')]:_0x1e8a66[_0x99a5('0x2d')];if(!_0x14109a[_0x99a5('0x2e')]['hasOwnProperty']('nolimit')){_0x1c131e[_0x99a5('0x34')]=qs[_0x99a5('0x34')](_0x14109a['query'][_0x99a5('0x34')]);_0x1c131e['offset']=qs['offset'](_0x14109a[_0x99a5('0x2e')]['offset']);}_0x1c131e[_0x99a5('0x35')]=qs[_0x99a5('0x36')](_0x14109a[_0x99a5('0x2e')][_0x99a5('0x36')]);_0x1c131e[_0x99a5('0x37')]=qs['filters'](_[_0x99a5('0x38')](_0x14109a[_0x99a5('0x2e')],_0x1e8a66['filters']),_0x3ba8a2);if(_0x14109a[_0x99a5('0x2e')][_0x99a5('0x39')]){_0x1c131e[_0x99a5('0x37')]=_[_0x99a5('0x3a')](_0x1c131e[_0x99a5('0x37')],{'$or':_['map'](_0x3ba8a2,function(_0x5e57a6){if(_0x5e57a6['type']!==_0x99a5('0x3b')){var _0x45e05d={};_0x45e05d[_0x5e57a6['name']]={'$like':'%'+_0x14109a[_0x99a5('0x2e')]['filter']+'%'};return _0x45e05d;}})});}_0x1c131e=_['merge']({},_0x1c131e,_0x14109a[_0x99a5('0x3c')]);var _0x332a8d={'where':_0x1c131e['where']};return db[_0x99a5('0x29')][_0x99a5('0x1c')](_0x332a8d)[_0x99a5('0x22')](function(_0x5f2857){_0x22a49a[_0x99a5('0x1c')]=_0x5f2857;if(_0x14109a[_0x99a5('0x2e')][_0x99a5('0x3d')]){_0x1c131e[_0x99a5('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x99a5('0x3f')](_0x1c131e);})[_0x99a5('0x22')](function(_0x355870){_0x22a49a[_0x99a5('0x40')]=_0x355870;return _0x22a49a;})[_0x99a5('0x22')](respondWithFilteredResult(_0xc59c82,_0x1c131e))[_0x99a5('0x41')](handleError(_0xc59c82,null));};exports[_0x99a5('0x42')]=function(_0x25f7d1,_0x52844b){var _0x273930={'raw':!![],'where':{'id':_0x25f7d1['params']['id']}},_0x29b7e9={};_0x29b7e9['model']=_[_0x99a5('0x43')](db[_0x99a5('0x29')][_0x99a5('0x2a')]);_0x29b7e9['query']=_[_0x99a5('0x43')](_0x25f7d1[_0x99a5('0x2e')]);_0x29b7e9[_0x99a5('0x2f')]=_[_0x99a5('0x30')](_0x29b7e9['model'],_0x29b7e9[_0x99a5('0x2e')]);_0x273930[_0x99a5('0x32')]=_[_0x99a5('0x30')](_0x29b7e9[_0x99a5('0x2d')],qs[_0x99a5('0x31')](_0x25f7d1[_0x99a5('0x2e')][_0x99a5('0x31')]));_0x273930[_0x99a5('0x32')]=_0x273930[_0x99a5('0x32')][_0x99a5('0x33')]?_0x273930[_0x99a5('0x32')]:_0x29b7e9[_0x99a5('0x2d')];if(_0x25f7d1[_0x99a5('0x2e')][_0x99a5('0x3d')]){_0x273930[_0x99a5('0x3e')]=[{'all':!![]}];}_0x273930=_[_0x99a5('0x3a')]({},_0x273930,_0x25f7d1[_0x99a5('0x3c')]);return db['JscriptyQuestionReport']['find'](_0x273930)[_0x99a5('0x22')](handleEntityNotFound(_0x52844b,null))['then'](respondWithResult(_0x52844b,null))[_0x99a5('0x41')](handleError(_0x52844b,null));};exports[_0x99a5('0x44')]=function(_0x56fb10,_0x3a9ee2){return db[_0x99a5('0x29')][_0x99a5('0x44')](_0x56fb10[_0x99a5('0x45')],{})['then'](respondWithResult(_0x3a9ee2,0xc9))[_0x99a5('0x41')](handleError(_0x3a9ee2,null));};exports[_0x99a5('0x21')]=function(_0x543f6b,_0x2c1ba0){if(_0x543f6b['body']['id']){delete _0x543f6b[_0x99a5('0x45')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x543f6b[_0x99a5('0x46')]['id']}})[_0x99a5('0x22')](handleEntityNotFound(_0x2c1ba0,null))['then'](saveUpdates(_0x543f6b[_0x99a5('0x45')],null))[_0x99a5('0x22')](respondWithResult(_0x2c1ba0,null))['catch'](handleError(_0x2c1ba0,null));};exports[_0x99a5('0x23')]=function(_0xcb6b1f,_0xfbf4e6){return db[_0x99a5('0x29')][_0x99a5('0x47')]({'where':{'id':_0xcb6b1f[_0x99a5('0x46')]['id']}})[_0x99a5('0x22')](handleEntityNotFound(_0xfbf4e6,null))['then'](removeEntity(_0xfbf4e6,null))[_0x99a5('0x41')](handleError(_0xfbf4e6,null));};exports[_0x99a5('0x48')]=function(_0x20aa61,_0x38bf31){return db['JscriptyQuestionReport']['describe']()[_0x99a5('0x22')](respondWithResult(_0x38bf31,null))[_0x99a5('0x41')](handleError(_0x38bf31,null));}; \ No newline at end of file +var _0x7437=['limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','where','JscriptyQuestionReport','includeAll','include','rows','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined'];(function(_0xdbbdc2,_0x16a3be){var _0x20f387=function(_0x215f7d){while(--_0x215f7d){_0xdbbdc2['push'](_0xdbbdc2['shift']());}};_0x20f387(++_0x16a3be);}(_0x7437,0x143));var _0x7743=function(_0x5834c7,_0x596152){_0x5834c7=_0x5834c7-0x0;var _0x151d83=_0x7437[_0x5834c7];return _0x151d83;};'use strict';var emlformat=require(_0x7743('0x0'));var rimraf=require(_0x7743('0x1'));var zipdir=require(_0x7743('0x2'));var jsonpatch=require(_0x7743('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7743('0x4'));var Mustache=require(_0x7743('0x5'));var util=require(_0x7743('0x6'));var path=require(_0x7743('0x7'));var sox=require(_0x7743('0x8'));var csv=require(_0x7743('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7743('0xa'));var squel=require(_0x7743('0xb'));var crypto=require('crypto');var jsforce=require(_0x7743('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7743('0x9'));var querystring=require('querystring');var Papa=require(_0x7743('0xd'));var Redis=require(_0x7743('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7743('0xf'));var as=require(_0x7743('0x10'));var hardwareService=require(_0x7743('0x11'));var logger=require('../../config/logger')(_0x7743('0x12'));var utils=require(_0x7743('0x13'));var config=require(_0x7743('0x14'));var licenseUtil=require(_0x7743('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31eb4b,_0x1f974a){_0x1f974a=_0x1f974a||0xcc;return function(_0x20be54){if(_0x20be54){return _0x31eb4b[_0x7743('0x16')](_0x1f974a);}return _0x31eb4b[_0x7743('0x17')](_0x1f974a)[_0x7743('0x18')]();};}function respondWithResult(_0x9ecbe2,_0x529727){_0x529727=_0x529727||0xc8;return function(_0x5a040b){if(_0x5a040b){return _0x9ecbe2[_0x7743('0x17')](_0x529727)[_0x7743('0x19')](_0x5a040b);}};}function respondWithFilteredResult(_0x46f355,_0x3e82ee){return function(_0x2d76bf){if(_0x2d76bf){var _0x460cf9=typeof _0x3e82ee['offset']===_0x7743('0x1a')&&typeof _0x3e82ee[_0x7743('0x1b')]===_0x7743('0x1a');var _0x4083aa=_0x2d76bf[_0x7743('0x1c')];var _0xa177e8=_0x460cf9?0x0:_0x3e82ee[_0x7743('0x1d')];var _0x1f506c=_0x460cf9?_0x2d76bf[_0x7743('0x1c')]:_0x3e82ee[_0x7743('0x1d')]+_0x3e82ee[_0x7743('0x1b')];var _0x2fd633;if(_0x1f506c>=_0x4083aa){_0x1f506c=_0x4083aa;_0x2fd633=0xc8;}else{_0x2fd633=0xce;}_0x46f355['status'](_0x2fd633);return _0x46f355[_0x7743('0x1e')](_0x7743('0x1f'),_0xa177e8+'-'+_0x1f506c+'/'+_0x4083aa)[_0x7743('0x19')](_0x2d76bf);}return null;};}function patchUpdates(_0x4f583a){return function(_0x364a9d){try{jsonpatch[_0x7743('0x20')](_0x364a9d,_0x4f583a,!![]);}catch(_0x2e82c8){return BPromise[_0x7743('0x21')](_0x2e82c8);}return _0x364a9d[_0x7743('0x22')]();};}function saveUpdates(_0x1e7ff8,_0x52924e){return function(_0x243aaf){if(_0x243aaf){return _0x243aaf[_0x7743('0x23')](_0x1e7ff8)[_0x7743('0x24')](function(_0x2cead8){return _0x2cead8;});}return null;};}function removeEntity(_0x2823d4,_0x3b8d33){return function(_0x43e90c){if(_0x43e90c){return _0x43e90c[_0x7743('0x25')]()['then'](function(){_0x2823d4[_0x7743('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x357330,_0x1c6e33){return function(_0xe79361){if(!_0xe79361){_0x357330[_0x7743('0x16')](0x194);}return _0xe79361;};}function handleError(_0x35ee1c,_0x5b0d34){_0x5b0d34=_0x5b0d34||0x1f4;return function(_0x1d11b2){logger['error'](_0x1d11b2[_0x7743('0x26')]);if(_0x1d11b2['name']){delete _0x1d11b2[_0x7743('0x27')];}_0x35ee1c['status'](_0x5b0d34)['send'](_0x1d11b2);};}exports['index']=function(_0x4ac76e,_0xf05545){var _0x3d91ab={},_0x177b05={},_0x4e39f4={'count':0x0,'rows':[]};var _0x22d163=_[_0x7743('0x28')](db['JscriptyQuestionReport'][_0x7743('0x29')],function(_0x3e2f36){return{'name':_0x3e2f36['fieldName'],'type':_0x3e2f36[_0x7743('0x2a')][_0x7743('0x2b')]};});_0x177b05['model']=_[_0x7743('0x28')](_0x22d163,_0x7743('0x27'));_0x177b05['query']=_['keys'](_0x4ac76e['query']);_0x177b05[_0x7743('0x2c')]=_[_0x7743('0x2d')](_0x177b05[_0x7743('0x2e')],_0x177b05[_0x7743('0x2f')]);_0x3d91ab[_0x7743('0x30')]=_[_0x7743('0x2d')](_0x177b05[_0x7743('0x2e')],qs[_0x7743('0x31')](_0x4ac76e['query'][_0x7743('0x31')]));_0x3d91ab['attributes']=_0x3d91ab[_0x7743('0x30')][_0x7743('0x32')]?_0x3d91ab[_0x7743('0x30')]:_0x177b05[_0x7743('0x2e')];if(!_0x4ac76e[_0x7743('0x2f')][_0x7743('0x33')]('nolimit')){_0x3d91ab[_0x7743('0x1b')]=qs['limit'](_0x4ac76e['query'][_0x7743('0x1b')]);_0x3d91ab[_0x7743('0x1d')]=qs['offset'](_0x4ac76e[_0x7743('0x2f')][_0x7743('0x1d')]);}_0x3d91ab[_0x7743('0x34')]=qs[_0x7743('0x35')](_0x4ac76e['query'][_0x7743('0x35')]);_0x3d91ab['where']=qs[_0x7743('0x2c')](_[_0x7743('0x36')](_0x4ac76e[_0x7743('0x2f')],_0x177b05[_0x7743('0x2c')]),_0x22d163);if(_0x4ac76e['query']['filter']){_0x3d91ab['where']=_[_0x7743('0x37')](_0x3d91ab['where'],{'$or':_[_0x7743('0x28')](_0x22d163,function(_0x13e3f2){if(_0x13e3f2[_0x7743('0x2a')]!==_0x7743('0x38')){var _0x25d717={};_0x25d717[_0x13e3f2['name']]={'$like':'%'+_0x4ac76e['query']['filter']+'%'};return _0x25d717;}})});}_0x3d91ab=_[_0x7743('0x37')]({},_0x3d91ab,_0x4ac76e['options']);var _0x1ef0f2={'where':_0x3d91ab[_0x7743('0x39')]};return db[_0x7743('0x3a')][_0x7743('0x1c')](_0x1ef0f2)[_0x7743('0x24')](function(_0xa9fe0a){_0x4e39f4[_0x7743('0x1c')]=_0xa9fe0a;if(_0x4ac76e[_0x7743('0x2f')][_0x7743('0x3b')]){_0x3d91ab[_0x7743('0x3c')]=[{'all':!![]}];}return db[_0x7743('0x3a')]['findAll'](_0x3d91ab);})['then'](function(_0x320df7){_0x4e39f4[_0x7743('0x3d')]=_0x320df7;return _0x4e39f4;})[_0x7743('0x24')](respondWithFilteredResult(_0xf05545,_0x3d91ab))[_0x7743('0x3e')](handleError(_0xf05545,null));};exports['show']=function(_0x2d3ae3,_0x239a32){var _0x3716ed={'raw':!![],'where':{'id':_0x2d3ae3[_0x7743('0x3f')]['id']}},_0x176397={};_0x176397[_0x7743('0x2e')]=_['keys'](db[_0x7743('0x3a')][_0x7743('0x29')]);_0x176397[_0x7743('0x2f')]=_[_0x7743('0x40')](_0x2d3ae3[_0x7743('0x2f')]);_0x176397[_0x7743('0x2c')]=_[_0x7743('0x2d')](_0x176397[_0x7743('0x2e')],_0x176397[_0x7743('0x2f')]);_0x3716ed['attributes']=_[_0x7743('0x2d')](_0x176397[_0x7743('0x2e')],qs[_0x7743('0x31')](_0x2d3ae3['query'][_0x7743('0x31')]));_0x3716ed[_0x7743('0x30')]=_0x3716ed['attributes']['length']?_0x3716ed[_0x7743('0x30')]:_0x176397[_0x7743('0x2e')];if(_0x2d3ae3[_0x7743('0x2f')][_0x7743('0x3b')]){_0x3716ed[_0x7743('0x3c')]=[{'all':!![]}];}_0x3716ed=_['merge']({},_0x3716ed,_0x2d3ae3[_0x7743('0x41')]);return db['JscriptyQuestionReport'][_0x7743('0x42')](_0x3716ed)[_0x7743('0x24')](handleEntityNotFound(_0x239a32,null))[_0x7743('0x24')](respondWithResult(_0x239a32,null))[_0x7743('0x3e')](handleError(_0x239a32,null));};exports[_0x7743('0x43')]=function(_0x58988a,_0x3fb617){return db[_0x7743('0x3a')][_0x7743('0x43')](_0x58988a[_0x7743('0x44')],{})[_0x7743('0x24')](respondWithResult(_0x3fb617,0xc9))[_0x7743('0x3e')](handleError(_0x3fb617,null));};exports['update']=function(_0x1b2dd1,_0x3982a7){if(_0x1b2dd1[_0x7743('0x44')]['id']){delete _0x1b2dd1[_0x7743('0x44')]['id'];}return db[_0x7743('0x3a')]['find']({'where':{'id':_0x1b2dd1[_0x7743('0x3f')]['id']}})[_0x7743('0x24')](handleEntityNotFound(_0x3982a7,null))[_0x7743('0x24')](saveUpdates(_0x1b2dd1['body'],null))[_0x7743('0x24')](respondWithResult(_0x3982a7,null))['catch'](handleError(_0x3982a7,null));};exports[_0x7743('0x25')]=function(_0x53346f,_0x2fba8f){return db[_0x7743('0x3a')][_0x7743('0x42')]({'where':{'id':_0x53346f[_0x7743('0x3f')]['id']}})[_0x7743('0x24')](handleEntityNotFound(_0x2fba8f,null))['then'](removeEntity(_0x2fba8f,null))[_0x7743('0x3e')](handleError(_0x2fba8f,null));};exports[_0x7743('0x45')]=function(_0x3a30a1,_0x56f9fa){return db[_0x7743('0x3a')][_0x7743('0x45')]()[_0x7743('0x24')](respondWithResult(_0x56f9fa,null))[_0x7743('0x3e')](handleError(_0x56f9fa,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 186c6ef..7877b31 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 _0x0dda=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0x0dda,0x9a));var _0xa0dd=function(_0x5d8cb7,_0x2851f7){_0x5d8cb7=_0x5d8cb7-0x0;var _0xece05d=_0x0dda[_0x5d8cb7];return _0xece05d;};'use strict';var _=require(_0xa0dd('0x0'));var util=require(_0xa0dd('0x1'));var logger=require(_0xa0dd('0x2'))(_0xa0dd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa0dd('0x4'));var fs=require('fs');var path=require(_0xa0dd('0x5'));var rimraf=require('rimraf');var config=require(_0xa0dd('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xa0dd('0x7')]=function(_0x51bd44,_0x16f95c){return _0x51bd44[_0xa0dd('0x8')](_0xa0dd('0x9'),attributes,{'tableName':_0xa0dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa46c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa46c,0x1bf));var _0xca46=function(_0x5f08ce,_0x4d0552){_0x5f08ce=_0x5f08ce-0x0;var _0x4d780a=_0xa46c[_0x5f08ce];return _0x4d780a;};'use strict';var _=require(_0xca46('0x0'));var util=require(_0xca46('0x1'));var logger=require(_0xca46('0x2'))(_0xca46('0x3'));var moment=require(_0xca46('0x4'));var BPromise=require(_0xca46('0x5'));var rp=require(_0xca46('0x6'));var fs=require('fs');var path=require(_0xca46('0x7'));var rimraf=require(_0xca46('0x8'));var config=require(_0xca46('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xca46('0xa')]=function(_0x368211,_0x2737a3){return _0x368211[_0xca46('0xb')](_0xca46('0xc'),attributes,{'tableName':_0xca46('0xd'),'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 a910bf9..4bdc2ef 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 _0x171b=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x171b,0x1ea));var _0xb171=function(_0x2d91c4,_0x17020a){_0x2d91c4=_0x2d91c4-0x0;var _0x2b60f2=_0x171b[_0x2d91c4];return _0x2b60f2;};'use strict';var _=require(_0xb171('0x0'));var util=require(_0xb171('0x1'));var moment=require(_0xb171('0x2'));var BPromise=require(_0xb171('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb171('0x4'));var logger=require(_0xb171('0x5'))(_0xb171('0x6'));var config=require(_0xb171('0x7'));var jayson=require(_0xb171('0x8'));var client=jayson['client'][_0xb171('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x134834,_0x4fa1f1,_0x1958f8){return new BPromise(function(_0x1b8919,_0x8a262e){return client[_0xb171('0xa')](_0x134834,_0x1958f8)[_0xb171('0xb')](function(_0x2509b0){logger['info'](_0xb171('0xc'),_0x4fa1f1,'request\x20sent');logger[_0xb171('0xd')](_0xb171('0xe'),_0x4fa1f1,_0xb171('0xf'),JSON[_0xb171('0x10')](_0x2509b0));if(_0x2509b0[_0xb171('0x11')]){if(_0x2509b0['error'][_0xb171('0x12')]===0x1f4){logger[_0xb171('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fa1f1,_0x2509b0[_0xb171('0x11')][_0xb171('0x13')]);return _0x8a262e(_0x2509b0[_0xb171('0x11')][_0xb171('0x13')]);}logger['error'](_0xb171('0xc'),_0x4fa1f1,_0x2509b0[_0xb171('0x11')]['message']);return _0x1b8919(_0x2509b0['error'][_0xb171('0x13')]);}else{logger[_0xb171('0x14')](_0xb171('0xc'),_0x4fa1f1,'request\x20sent');_0x1b8919(_0x2509b0[_0xb171('0x15')]['message']);}})[_0xb171('0x16')](function(_0x4edfeb){logger[_0xb171('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fa1f1,_0x4edfeb);_0x8a262e(_0x4edfeb);});});} \ No newline at end of file +var _0xda25=['request\x20sent','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0xda25,0xf2));var _0x5da2=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xda25[_0x616290];return _0x453879;};'use strict';var _=require('lodash');var util=require(_0x5da2('0x0'));var moment=require(_0x5da2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5da2('0x2'));var db=require(_0x5da2('0x3'))['db'];var utils=require(_0x5da2('0x4'));var logger=require(_0x5da2('0x5'))(_0x5da2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5da2('0x7'));var client=jayson[_0x5da2('0x8')][_0x5da2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd4c66a,_0x5dd325,_0x2cfb8d){return new BPromise(function(_0x2dfcb5,_0xc6c31f){return client[_0x5da2('0xa')](_0xd4c66a,_0x2cfb8d)['then'](function(_0x23cc7d){logger['info'](_0x5da2('0xb'),_0x5dd325,'request\x20sent');logger['debug'](_0x5da2('0xc'),_0x5dd325,'request\x20sent',JSON[_0x5da2('0xd')](_0x23cc7d));if(_0x23cc7d[_0x5da2('0xe')]){if(_0x23cc7d[_0x5da2('0xe')][_0x5da2('0xf')]===0x1f4){logger[_0x5da2('0xe')](_0x5da2('0xb'),_0x5dd325,_0x23cc7d[_0x5da2('0xe')][_0x5da2('0x10')]);return _0xc6c31f(_0x23cc7d['error'][_0x5da2('0x10')]);}logger[_0x5da2('0xe')](_0x5da2('0xb'),_0x5dd325,_0x23cc7d[_0x5da2('0xe')][_0x5da2('0x10')]);return _0x2dfcb5(_0x23cc7d[_0x5da2('0xe')][_0x5da2('0x10')]);}else{logger[_0x5da2('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5dd325,_0x5da2('0x12'));_0x2dfcb5(_0x23cc7d['result']['message']);}})[_0x5da2('0x13')](function(_0x315b60){logger[_0x5da2('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5dd325,_0x315b60);_0xc6c31f(_0x315b60);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4e83cb5..ac376ac 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 _0x0b6b=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0xc29d81,_0x17e51e){var _0x4b1727=function(_0x1b5e87){while(--_0x1b5e87){_0xc29d81['push'](_0xc29d81['shift']());}};_0x4b1727(++_0x17e51e);}(_0x0b6b,0xe1));var _0xb0b6=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x0b6b[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0xb0b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb0b6('0x1'));var express=require(_0xb0b6('0x2'));var router=express[_0xb0b6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb0b6('0x4'));var interaction=require(_0xb0b6('0x5'));var config=require(_0xb0b6('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0xb0b6('0x7')]('/',auth['isAuthenticated'](),controller[_0xb0b6('0x8')]);router['get'](_0xb0b6('0x9'),auth[_0xb0b6('0xa')](),controller[_0xb0b6('0xb')]);router[_0xb0b6('0x7')](_0xb0b6('0xc'),auth[_0xb0b6('0xa')](),controller[_0xb0b6('0xd')]);router[_0xb0b6('0x7')](_0xb0b6('0xe'),auth['isAuthenticated'](),controller[_0xb0b6('0xf')]);router[_0xb0b6('0x10')]('/',auth[_0xb0b6('0xa')](),controller[_0xb0b6('0x11')]);router[_0xb0b6('0x12')](_0xb0b6('0xc'),auth['isAuthenticated'](),controller[_0xb0b6('0x13')]);router[_0xb0b6('0x14')](_0xb0b6('0xc'),auth[_0xb0b6('0xa')](),controller[_0xb0b6('0x15')]);module[_0xb0b6('0x16')]=router; \ No newline at end of file +var _0x76ad=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/questions','post','create'];(function(_0x3785ad,_0x6071ef){var _0x14d378=function(_0x9bd7a5){while(--_0x9bd7a5){_0x3785ad['push'](_0x3785ad['shift']());}};_0x14d378(++_0x6071ef);}(_0x76ad,0x101));var _0xd76a=function(_0xbee9b3,_0x344eab){_0xbee9b3=_0xbee9b3-0x0;var _0x26960e=_0x76ad[_0xbee9b3];return _0x26960e;};'use strict';var multer=require(_0xd76a('0x0'));var util=require(_0xd76a('0x1'));var path=require(_0xd76a('0x2'));var timeout=require(_0xd76a('0x3'));var express=require(_0xd76a('0x4'));var router=express[_0xd76a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd76a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd76a('0x7'));var controller=require(_0xd76a('0x8'));router[_0xd76a('0x9')]('/',auth['isAuthenticated'](),controller[_0xd76a('0xa')]);router['get'](_0xd76a('0xb'),auth['isAuthenticated'](),controller[_0xd76a('0xc')]);router['get'](_0xd76a('0xd'),auth[_0xd76a('0xe')](),controller[_0xd76a('0xf')]);router[_0xd76a('0x9')](_0xd76a('0x10'),auth[_0xd76a('0xe')](),controller['getQuestions']);router[_0xd76a('0x11')]('/',auth[_0xd76a('0xe')](),controller[_0xd76a('0x12')]);router[_0xd76a('0x13')](_0xd76a('0xd'),auth[_0xd76a('0xe')](),controller[_0xd76a('0x14')]);router[_0xd76a('0x15')]('/:id',auth[_0xd76a('0xe')](),controller[_0xd76a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a73c683..5c6558a 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 _0x13d4=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','sequelize','exports'];(function(_0x3affcd,_0x23b5ee){var _0x4da34f=function(_0x3e47fa){while(--_0x3e47fa){_0x3affcd['push'](_0x3affcd['shift']());}};_0x4da34f(++_0x23b5ee);}(_0x13d4,0x1ca));var _0x413d=function(_0x5ec67c,_0x599de8){_0x5ec67c=_0x5ec67c-0x0;var _0x344512=_0x13d4[_0x5ec67c];return _0x344512;};'use strict';var moment=require('moment');var Sequelize=require(_0x413d('0x0'));module[_0x413d('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x399f47){this[_0x413d('0x2')](_0x413d('0x3'),_0x399f47);this['setDataValue'](_0x413d('0x4'),moment()[_0x413d('0x5')](_0x413d('0x6')));}},'endtime':{'type':Sequelize[_0x413d('0x7')]},'membername':{'type':Sequelize[_0x413d('0x8')]},'projectname':{'type':Sequelize[_0x413d('0x8')]},'queue':{'type':Sequelize[_0x413d('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x413d('0x8')]},'calleridnum':{'type':Sequelize[_0x413d('0x8')]},'completed':{'type':Sequelize[_0x413d('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x24d6=['DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports'];(function(_0x1204de,_0x531224){var _0x1e19ea=function(_0x45bc8b){while(--_0x45bc8b){_0x1204de['push'](_0x1204de['shift']());}};_0x1e19ea(++_0x531224);}(_0x24d6,0xee));var _0x624d=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0x24d6[_0x434783];return _0x13efcf;};'use strict';var moment=require('moment');var Sequelize=require(_0x624d('0x0'));module[_0x624d('0x1')]={'starttime':{'type':Sequelize[_0x624d('0x2')],'set':function(_0x539293){this[_0x624d('0x3')](_0x624d('0x4'),_0x539293);this['setDataValue'](_0x624d('0x5'),moment()['format'](_0x624d('0x6')));}},'endtime':{'type':Sequelize[_0x624d('0x2')]},'membername':{'type':Sequelize[_0x624d('0x7')]},'projectname':{'type':Sequelize[_0x624d('0x7')]},'queue':{'type':Sequelize[_0x624d('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x624d('0x7')]},'calleridnum':{'type':Sequelize[_0x624d('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2746162..479ca1b 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 _0xcf15=['save','update','then','error','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','JscriptySessionReport','includeAll','include','rows','params','length','options','find','catch','create','body','destroy','describe','findOne','SessionId','JscriptyQuestionReport','findAll','zip-dir','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcf15,0x115));var _0x5cf1=function(_0x38bd6e,_0x9d3bd8){_0x38bd6e=_0x38bd6e-0x0;var _0x3378ef=_0xcf15[_0x38bd6e];return _0x3378ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5cf1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cf1('0x1'));var moment=require(_0x5cf1('0x2'));var BPromise=require(_0x5cf1('0x3'));var Mustache=require('mustache');var util=require(_0x5cf1('0x4'));var path=require(_0x5cf1('0x5'));var sox=require(_0x5cf1('0x6'));var csv=require(_0x5cf1('0x7'));var ejs=require(_0x5cf1('0x8'));var fs=require('fs');var fs_extra=require(_0x5cf1('0x9'));var _=require(_0x5cf1('0xa'));var squel=require(_0x5cf1('0xb'));var crypto=require(_0x5cf1('0xc'));var jsforce=require(_0x5cf1('0xd'));var deskjs=require(_0x5cf1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5cf1('0xf'));var Papa=require(_0x5cf1('0x10'));var Redis=require(_0x5cf1('0x11'));var authService=require(_0x5cf1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5cf1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cf1('0x14'))('api');var utils=require(_0x5cf1('0x15'));var config=require(_0x5cf1('0x16'));var licenseUtil=require(_0x5cf1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56af2d,_0xcc6abb){_0xcc6abb=_0xcc6abb||0xcc;return function(_0x32f46b){if(_0x32f46b){return _0x56af2d[_0x5cf1('0x18')](_0xcc6abb);}return _0x56af2d[_0x5cf1('0x19')](_0xcc6abb)[_0x5cf1('0x1a')]();};}function respondWithResult(_0x5f0f18,_0x14c0ad){_0x14c0ad=_0x14c0ad||0xc8;return function(_0x51be56){if(_0x51be56){return _0x5f0f18[_0x5cf1('0x19')](_0x14c0ad)[_0x5cf1('0x1b')](_0x51be56);}};}function respondWithFilteredResult(_0x58cea7,_0x5a311d){return function(_0x17f340){if(_0x17f340){var _0x4ceb4c=typeof _0x5a311d['offset']===_0x5cf1('0x1c')&&typeof _0x5a311d[_0x5cf1('0x1d')]===_0x5cf1('0x1c');var _0xe4332=_0x17f340['count'];var _0x4db7c3=_0x4ceb4c?0x0:_0x5a311d[_0x5cf1('0x1e')];var _0x5e9775=_0x4ceb4c?_0x17f340[_0x5cf1('0x1f')]:_0x5a311d[_0x5cf1('0x1e')]+_0x5a311d[_0x5cf1('0x1d')];var _0x41e89b;if(_0x5e9775>=_0xe4332){_0x5e9775=_0xe4332;_0x41e89b=0xc8;}else{_0x41e89b=0xce;}_0x58cea7[_0x5cf1('0x19')](_0x41e89b);return _0x58cea7[_0x5cf1('0x20')](_0x5cf1('0x21'),_0x4db7c3+'-'+_0x5e9775+'/'+_0xe4332)['json'](_0x17f340);}return null;};}function patchUpdates(_0x242e25){return function(_0x548d9b){try{jsonpatch['apply'](_0x548d9b,_0x242e25,!![]);}catch(_0x2665ee){return BPromise[_0x5cf1('0x22')](_0x2665ee);}return _0x548d9b[_0x5cf1('0x23')]();};}function saveUpdates(_0x1e9ab8,_0x3b2244){return function(_0x59a260){if(_0x59a260){return _0x59a260[_0x5cf1('0x24')](_0x1e9ab8)[_0x5cf1('0x25')](function(_0x4106d0){return _0x4106d0;});}return null;};}function removeEntity(_0xab9428,_0x2e4323){return function(_0x19698d){if(_0x19698d){return _0x19698d['destroy']()[_0x5cf1('0x25')](function(){_0xab9428[_0x5cf1('0x19')](0xcc)[_0x5cf1('0x1a')]();});}};}function handleEntityNotFound(_0x597f37,_0xa1d544){return function(_0x4b6641){if(!_0x4b6641){_0x597f37[_0x5cf1('0x18')](0x194);}return _0x4b6641;};}function handleError(_0x403647,_0x21ad24){_0x21ad24=_0x21ad24||0x1f4;return function(_0xb65b40){logger[_0x5cf1('0x26')](_0xb65b40[_0x5cf1('0x27')]);if(_0xb65b40[_0x5cf1('0x28')]){delete _0xb65b40[_0x5cf1('0x28')];}_0x403647[_0x5cf1('0x19')](_0x21ad24)[_0x5cf1('0x29')](_0xb65b40);};}exports['index']=function(_0x19121e,_0x56f855){var _0x4ffc94={},_0x396346={},_0xf42a5c={'count':0x0,'rows':[]};var _0x125bad=_[_0x5cf1('0x2a')](db['JscriptySessionReport'][_0x5cf1('0x2b')],function(_0x37058f){return{'name':_0x37058f['fieldName'],'type':_0x37058f['type'][_0x5cf1('0x2c')]};});_0x396346[_0x5cf1('0x2d')]=_[_0x5cf1('0x2a')](_0x125bad,'name');_0x396346[_0x5cf1('0x2e')]=_[_0x5cf1('0x2f')](_0x19121e[_0x5cf1('0x2e')]);_0x396346[_0x5cf1('0x30')]=_[_0x5cf1('0x31')](_0x396346['model'],_0x396346[_0x5cf1('0x2e')]);_0x4ffc94[_0x5cf1('0x32')]=_['intersection'](_0x396346[_0x5cf1('0x2d')],qs[_0x5cf1('0x33')](_0x19121e['query']['fields']));_0x4ffc94[_0x5cf1('0x32')]=_0x4ffc94['attributes']['length']?_0x4ffc94['attributes']:_0x396346[_0x5cf1('0x2d')];if(!_0x19121e[_0x5cf1('0x2e')][_0x5cf1('0x34')]('nolimit')){_0x4ffc94['limit']=qs[_0x5cf1('0x1d')](_0x19121e['query'][_0x5cf1('0x1d')]);_0x4ffc94[_0x5cf1('0x1e')]=qs[_0x5cf1('0x1e')](_0x19121e[_0x5cf1('0x2e')][_0x5cf1('0x1e')]);}_0x4ffc94[_0x5cf1('0x35')]=qs[_0x5cf1('0x36')](_0x19121e[_0x5cf1('0x2e')][_0x5cf1('0x36')]);_0x4ffc94[_0x5cf1('0x37')]=qs[_0x5cf1('0x30')](_[_0x5cf1('0x38')](_0x19121e['query'],_0x396346[_0x5cf1('0x30')]),_0x125bad);if(_0x19121e[_0x5cf1('0x2e')][_0x5cf1('0x39')]){_0x4ffc94[_0x5cf1('0x37')]=_[_0x5cf1('0x3a')](_0x4ffc94['where'],{'$or':_[_0x5cf1('0x2a')](_0x125bad,function(_0x5ce0af){if(_0x5ce0af[_0x5cf1('0x3b')]!==_0x5cf1('0x3c')){var _0x340862={};_0x340862[_0x5ce0af['name']]={'$like':'%'+_0x19121e[_0x5cf1('0x2e')][_0x5cf1('0x39')]+'%'};return _0x340862;}})});}_0x4ffc94=_[_0x5cf1('0x3a')]({},_0x4ffc94,_0x19121e['options']);var _0x249740={'where':_0x4ffc94[_0x5cf1('0x37')]};return db[_0x5cf1('0x3d')]['count'](_0x249740)[_0x5cf1('0x25')](function(_0x1cd4ba){_0xf42a5c[_0x5cf1('0x1f')]=_0x1cd4ba;if(_0x19121e[_0x5cf1('0x2e')][_0x5cf1('0x3e')]){_0x4ffc94[_0x5cf1('0x3f')]=[{'all':!![]}];}return db[_0x5cf1('0x3d')]['findAll'](_0x4ffc94);})['then'](function(_0x29d649){_0xf42a5c[_0x5cf1('0x40')]=_0x29d649;return _0xf42a5c;})[_0x5cf1('0x25')](respondWithFilteredResult(_0x56f855,_0x4ffc94))['catch'](handleError(_0x56f855,null));};exports['show']=function(_0x1ce4c1,_0x5cb81a){var _0x145632={'raw':!![],'where':{'id':_0x1ce4c1[_0x5cf1('0x41')]['id']}},_0x12a720={};_0x12a720[_0x5cf1('0x2d')]=_[_0x5cf1('0x2f')](db[_0x5cf1('0x3d')]['rawAttributes']);_0x12a720[_0x5cf1('0x2e')]=_[_0x5cf1('0x2f')](_0x1ce4c1['query']);_0x12a720[_0x5cf1('0x30')]=_[_0x5cf1('0x31')](_0x12a720['model'],_0x12a720[_0x5cf1('0x2e')]);_0x145632[_0x5cf1('0x32')]=_['intersection'](_0x12a720['model'],qs[_0x5cf1('0x33')](_0x1ce4c1[_0x5cf1('0x2e')][_0x5cf1('0x33')]));_0x145632[_0x5cf1('0x32')]=_0x145632[_0x5cf1('0x32')][_0x5cf1('0x42')]?_0x145632['attributes']:_0x12a720[_0x5cf1('0x2d')];if(_0x1ce4c1['query'][_0x5cf1('0x3e')]){_0x145632[_0x5cf1('0x3f')]=[{'all':!![]}];}_0x145632=_[_0x5cf1('0x3a')]({},_0x145632,_0x1ce4c1[_0x5cf1('0x43')]);return db[_0x5cf1('0x3d')][_0x5cf1('0x44')](_0x145632)[_0x5cf1('0x25')](handleEntityNotFound(_0x5cb81a,null))[_0x5cf1('0x25')](respondWithResult(_0x5cb81a,null))[_0x5cf1('0x45')](handleError(_0x5cb81a,null));};exports[_0x5cf1('0x46')]=function(_0x38fd8a,_0x297106){return db[_0x5cf1('0x3d')]['create'](_0x38fd8a[_0x5cf1('0x47')],{})[_0x5cf1('0x25')](respondWithResult(_0x297106,0xc9))[_0x5cf1('0x45')](handleError(_0x297106,null));};exports[_0x5cf1('0x24')]=function(_0x46361f,_0x2e0dbd){if(_0x46361f[_0x5cf1('0x47')]['id']){delete _0x46361f['body']['id'];}return db['JscriptySessionReport'][_0x5cf1('0x44')]({'where':{'id':_0x46361f[_0x5cf1('0x41')]['id']}})[_0x5cf1('0x25')](handleEntityNotFound(_0x2e0dbd,null))[_0x5cf1('0x25')](saveUpdates(_0x46361f[_0x5cf1('0x47')],null))[_0x5cf1('0x25')](respondWithResult(_0x2e0dbd,null))[_0x5cf1('0x45')](handleError(_0x2e0dbd,null));};exports[_0x5cf1('0x48')]=function(_0x301c68,_0x4b7495){return db[_0x5cf1('0x3d')]['find']({'where':{'id':_0x301c68[_0x5cf1('0x41')]['id']}})[_0x5cf1('0x25')](handleEntityNotFound(_0x4b7495,null))[_0x5cf1('0x25')](removeEntity(_0x4b7495,null))['catch'](handleError(_0x4b7495,null));};exports[_0x5cf1('0x49')]=function(_0x2cf307,_0x1a8c9f){return db[_0x5cf1('0x3d')]['describe']()[_0x5cf1('0x25')](respondWithResult(_0x1a8c9f,null))[_0x5cf1('0x45')](handleError(_0x1a8c9f,null));};exports['getQuestions']=function(_0x1fbeb8,_0x1ae91c,_0x3fa36f){var _0x1346b6={'raw':!![],'where':{}};var _0x2bb67f={};var _0x558c3e={'count':0x0,'rows':[]};return db[_0x5cf1('0x3d')][_0x5cf1('0x4a')]({'where':{'id':_0x1fbeb8['params']['id']}})[_0x5cf1('0x25')](handleEntityNotFound(_0x1ae91c,null))['then'](function(_0x4f1fa1){if(_0x4f1fa1){_0x2bb67f[_0x5cf1('0x2d')]=_[_0x5cf1('0x2f')](db['JscriptyQuestionReport'][_0x5cf1('0x2b')]);_0x2bb67f[_0x5cf1('0x2e')]=_[_0x5cf1('0x2f')](_0x1fbeb8[_0x5cf1('0x2e')]);_0x2bb67f[_0x5cf1('0x30')]=_[_0x5cf1('0x31')](_0x2bb67f[_0x5cf1('0x2d')],_0x2bb67f[_0x5cf1('0x2e')]);_0x1346b6['attributes']=_[_0x5cf1('0x31')](_0x2bb67f[_0x5cf1('0x2d')],qs[_0x5cf1('0x33')](_0x1fbeb8[_0x5cf1('0x2e')][_0x5cf1('0x33')]));_0x1346b6[_0x5cf1('0x32')]=_0x1346b6[_0x5cf1('0x32')][_0x5cf1('0x42')]?_0x1346b6['attributes']:_0x2bb67f['model'];if(!_0x1fbeb8[_0x5cf1('0x2e')]['hasOwnProperty']('nolimit')){_0x1346b6[_0x5cf1('0x1d')]=qs[_0x5cf1('0x1d')](_0x1fbeb8['query'][_0x5cf1('0x1d')]);_0x1346b6[_0x5cf1('0x1e')]=qs[_0x5cf1('0x1e')](_0x1fbeb8[_0x5cf1('0x2e')][_0x5cf1('0x1e')]);}_0x1346b6[_0x5cf1('0x35')]=qs[_0x5cf1('0x36')](_0x1fbeb8[_0x5cf1('0x2e')][_0x5cf1('0x36')]);_0x1346b6[_0x5cf1('0x37')]=qs[_0x5cf1('0x30')](_[_0x5cf1('0x38')](_0x1fbeb8[_0x5cf1('0x2e')],_0x2bb67f[_0x5cf1('0x30')]));_0x1346b6[_0x5cf1('0x37')][_0x5cf1('0x4b')]=_0x4f1fa1['id'];if(_0x1fbeb8[_0x5cf1('0x2e')][_0x5cf1('0x39')]){_0x1346b6[_0x5cf1('0x37')]=_[_0x5cf1('0x3a')](_0x1346b6[_0x5cf1('0x37')],{'$or':_[_0x5cf1('0x2a')](_0x1346b6[_0x5cf1('0x32')],function(_0x1af375){var _0x971759={};_0x971759[_0x1af375]={'$like':'%'+_0x1fbeb8[_0x5cf1('0x2e')]['filter']+'%'};return _0x971759;})});}_0x1346b6=_[_0x5cf1('0x3a')]({},_0x1346b6,_0x1fbeb8[_0x5cf1('0x43')]);return db[_0x5cf1('0x4c')][_0x5cf1('0x1f')]({'where':_0x1346b6[_0x5cf1('0x37')]})[_0x5cf1('0x25')](function(_0x2b0abb){_0x558c3e[_0x5cf1('0x1f')]=_0x2b0abb;if(_0x1fbeb8['query']['includeAll']){_0x1346b6[_0x5cf1('0x3f')]=[{'all':!![]}];}return db[_0x5cf1('0x4c')][_0x5cf1('0x4d')](_0x1346b6);})[_0x5cf1('0x25')](function(_0x2dbce7){_0x558c3e['rows']=_0x2dbce7;return _0x558c3e;});}})[_0x5cf1('0x25')](respondWithFilteredResult(_0x1ae91c,_0x1346b6))[_0x5cf1('0x45')](handleError(_0x1ae91c,null));}; \ No newline at end of file +var _0x5def=['hasOwnProperty','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptySessionReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','destroy','findOne','JscriptyQuestionReport'];(function(_0xce2d7e,_0x56dac4){var _0x3143d9=function(_0x52633b){while(--_0x52633b){_0xce2d7e['push'](_0xce2d7e['shift']());}};_0x3143d9(++_0x56dac4);}(_0x5def,0x1c9));var _0xf5de=function(_0x5f4902,_0x1198fb){_0x5f4902=_0x5f4902-0x0;var _0x743933=_0x5def[_0x5f4902];return _0x743933;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf5de('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5de('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf5de('0x2'));var util=require(_0xf5de('0x3'));var path=require(_0xf5de('0x4'));var sox=require(_0xf5de('0x5'));var csv=require(_0xf5de('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5de('0x7'));var _=require('lodash');var squel=require(_0xf5de('0x8'));var crypto=require(_0xf5de('0x9'));var jsforce=require(_0xf5de('0xa'));var deskjs=require(_0xf5de('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf5de('0xc'));var Papa=require(_0xf5de('0xd'));var Redis=require(_0xf5de('0xe'));var authService=require(_0xf5de('0xf'));var qs=require(_0xf5de('0x10'));var as=require(_0xf5de('0x11'));var hardwareService=require(_0xf5de('0x12'));var logger=require(_0xf5de('0x13'))('api');var utils=require(_0xf5de('0x14'));var config=require(_0xf5de('0x15'));var licenseUtil=require(_0xf5de('0x16'));var db=require(_0xf5de('0x17'))['db'];function respondWithStatusCode(_0x1c874f,_0x563a08){_0x563a08=_0x563a08||0xcc;return function(_0x3aa8d7){if(_0x3aa8d7){return _0x1c874f[_0xf5de('0x18')](_0x563a08);}return _0x1c874f['status'](_0x563a08)[_0xf5de('0x19')]();};}function respondWithResult(_0x56eb80,_0x346ba8){_0x346ba8=_0x346ba8||0xc8;return function(_0x1fe26a){if(_0x1fe26a){return _0x56eb80[_0xf5de('0x1a')](_0x346ba8)[_0xf5de('0x1b')](_0x1fe26a);}};}function respondWithFilteredResult(_0x45791b,_0x5ae82a){return function(_0x1e07f5){if(_0x1e07f5){var _0x2fd152=typeof _0x5ae82a['offset']===_0xf5de('0x1c')&&typeof _0x5ae82a[_0xf5de('0x1d')]===_0xf5de('0x1c');var _0x3050e9=_0x1e07f5['count'];var _0x1861ae=_0x2fd152?0x0:_0x5ae82a['offset'];var _0x26a7e5=_0x2fd152?_0x1e07f5[_0xf5de('0x1e')]:_0x5ae82a[_0xf5de('0x1f')]+_0x5ae82a['limit'];var _0x191b23;if(_0x26a7e5>=_0x3050e9){_0x26a7e5=_0x3050e9;_0x191b23=0xc8;}else{_0x191b23=0xce;}_0x45791b[_0xf5de('0x1a')](_0x191b23);return _0x45791b[_0xf5de('0x20')]('Content-Range',_0x1861ae+'-'+_0x26a7e5+'/'+_0x3050e9)[_0xf5de('0x1b')](_0x1e07f5);}return null;};}function patchUpdates(_0x3c9a35){return function(_0x515998){try{jsonpatch[_0xf5de('0x21')](_0x515998,_0x3c9a35,!![]);}catch(_0x17cfc0){return BPromise[_0xf5de('0x22')](_0x17cfc0);}return _0x515998[_0xf5de('0x23')]();};}function saveUpdates(_0xb9e072,_0x28fc8a){return function(_0x21071a){if(_0x21071a){return _0x21071a[_0xf5de('0x24')](_0xb9e072)['then'](function(_0x218778){return _0x218778;});}return null;};}function removeEntity(_0x1f3de5,_0x5c53f8){return function(_0x2e977a){if(_0x2e977a){return _0x2e977a['destroy']()[_0xf5de('0x25')](function(){_0x1f3de5[_0xf5de('0x1a')](0xcc)[_0xf5de('0x19')]();});}};}function handleEntityNotFound(_0x4a2dc0,_0x67ea94){return function(_0x5d4b7e){if(!_0x5d4b7e){_0x4a2dc0[_0xf5de('0x18')](0x194);}return _0x5d4b7e;};}function handleError(_0x48dc83,_0x56da10){_0x56da10=_0x56da10||0x1f4;return function(_0x3b1511){logger[_0xf5de('0x26')](_0x3b1511[_0xf5de('0x27')]);if(_0x3b1511[_0xf5de('0x28')]){delete _0x3b1511[_0xf5de('0x28')];}_0x48dc83[_0xf5de('0x1a')](_0x56da10)[_0xf5de('0x29')](_0x3b1511);};}exports[_0xf5de('0x2a')]=function(_0x75b6d7,_0xd34f14){var _0x4a45aa={},_0x99c3af={},_0x160fa3={'count':0x0,'rows':[]};var _0x473d1b=_[_0xf5de('0x2b')](db[_0xf5de('0x2c')]['rawAttributes'],function(_0x33f74f){return{'name':_0x33f74f['fieldName'],'type':_0x33f74f[_0xf5de('0x2d')][_0xf5de('0x2e')]};});_0x99c3af[_0xf5de('0x2f')]=_['map'](_0x473d1b,'name');_0x99c3af[_0xf5de('0x30')]=_[_0xf5de('0x31')](_0x75b6d7[_0xf5de('0x30')]);_0x99c3af[_0xf5de('0x32')]=_[_0xf5de('0x33')](_0x99c3af[_0xf5de('0x2f')],_0x99c3af[_0xf5de('0x30')]);_0x4a45aa[_0xf5de('0x34')]=_[_0xf5de('0x33')](_0x99c3af[_0xf5de('0x2f')],qs[_0xf5de('0x35')](_0x75b6d7['query'][_0xf5de('0x35')]));_0x4a45aa['attributes']=_0x4a45aa[_0xf5de('0x34')][_0xf5de('0x36')]?_0x4a45aa[_0xf5de('0x34')]:_0x99c3af['model'];if(!_0x75b6d7[_0xf5de('0x30')]['hasOwnProperty']('nolimit')){_0x4a45aa[_0xf5de('0x1d')]=qs[_0xf5de('0x1d')](_0x75b6d7[_0xf5de('0x30')][_0xf5de('0x1d')]);_0x4a45aa[_0xf5de('0x1f')]=qs[_0xf5de('0x1f')](_0x75b6d7[_0xf5de('0x30')][_0xf5de('0x1f')]);}_0x4a45aa[_0xf5de('0x37')]=qs[_0xf5de('0x38')](_0x75b6d7[_0xf5de('0x30')][_0xf5de('0x38')]);_0x4a45aa[_0xf5de('0x39')]=qs['filters'](_[_0xf5de('0x3a')](_0x75b6d7[_0xf5de('0x30')],_0x99c3af[_0xf5de('0x32')]),_0x473d1b);if(_0x75b6d7[_0xf5de('0x30')][_0xf5de('0x3b')]){_0x4a45aa['where']=_[_0xf5de('0x3c')](_0x4a45aa[_0xf5de('0x39')],{'$or':_['map'](_0x473d1b,function(_0x516a02){if(_0x516a02[_0xf5de('0x2d')]!==_0xf5de('0x3d')){var _0x4c6a09={};_0x4c6a09[_0x516a02['name']]={'$like':'%'+_0x75b6d7[_0xf5de('0x30')][_0xf5de('0x3b')]+'%'};return _0x4c6a09;}})});}_0x4a45aa=_[_0xf5de('0x3c')]({},_0x4a45aa,_0x75b6d7[_0xf5de('0x3e')]);var _0x194be7={'where':_0x4a45aa['where']};return db[_0xf5de('0x2c')][_0xf5de('0x1e')](_0x194be7)[_0xf5de('0x25')](function(_0x4c52dd){_0x160fa3['count']=_0x4c52dd;if(_0x75b6d7[_0xf5de('0x30')][_0xf5de('0x3f')]){_0x4a45aa[_0xf5de('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xf5de('0x41')](_0x4a45aa);})[_0xf5de('0x25')](function(_0x249878){_0x160fa3['rows']=_0x249878;return _0x160fa3;})[_0xf5de('0x25')](respondWithFilteredResult(_0xd34f14,_0x4a45aa))[_0xf5de('0x42')](handleError(_0xd34f14,null));};exports[_0xf5de('0x43')]=function(_0x3cfd59,_0x41be0){var _0x15fb59={'raw':!![],'where':{'id':_0x3cfd59[_0xf5de('0x44')]['id']}},_0x5d3d36={};_0x5d3d36[_0xf5de('0x2f')]=_[_0xf5de('0x31')](db[_0xf5de('0x2c')][_0xf5de('0x45')]);_0x5d3d36['query']=_[_0xf5de('0x31')](_0x3cfd59[_0xf5de('0x30')]);_0x5d3d36[_0xf5de('0x32')]=_[_0xf5de('0x33')](_0x5d3d36[_0xf5de('0x2f')],_0x5d3d36['query']);_0x15fb59[_0xf5de('0x34')]=_['intersection'](_0x5d3d36[_0xf5de('0x2f')],qs[_0xf5de('0x35')](_0x3cfd59[_0xf5de('0x30')][_0xf5de('0x35')]));_0x15fb59['attributes']=_0x15fb59[_0xf5de('0x34')][_0xf5de('0x36')]?_0x15fb59['attributes']:_0x5d3d36[_0xf5de('0x2f')];if(_0x3cfd59[_0xf5de('0x30')][_0xf5de('0x3f')]){_0x15fb59['include']=[{'all':!![]}];}_0x15fb59=_[_0xf5de('0x3c')]({},_0x15fb59,_0x3cfd59[_0xf5de('0x3e')]);return db['JscriptySessionReport'][_0xf5de('0x46')](_0x15fb59)['then'](handleEntityNotFound(_0x41be0,null))[_0xf5de('0x25')](respondWithResult(_0x41be0,null))[_0xf5de('0x42')](handleError(_0x41be0,null));};exports['create']=function(_0x50b8bc,_0x111bf9){return db['JscriptySessionReport']['create'](_0x50b8bc[_0xf5de('0x47')],{})[_0xf5de('0x25')](respondWithResult(_0x111bf9,0xc9))['catch'](handleError(_0x111bf9,null));};exports[_0xf5de('0x24')]=function(_0x4a3ede,_0x4e90f9){if(_0x4a3ede[_0xf5de('0x47')]['id']){delete _0x4a3ede[_0xf5de('0x47')]['id'];}return db[_0xf5de('0x2c')][_0xf5de('0x46')]({'where':{'id':_0x4a3ede[_0xf5de('0x44')]['id']}})[_0xf5de('0x25')](handleEntityNotFound(_0x4e90f9,null))[_0xf5de('0x25')](saveUpdates(_0x4a3ede[_0xf5de('0x47')],null))[_0xf5de('0x25')](respondWithResult(_0x4e90f9,null))[_0xf5de('0x42')](handleError(_0x4e90f9,null));};exports[_0xf5de('0x48')]=function(_0x4645c4,_0x671d23){return db[_0xf5de('0x2c')][_0xf5de('0x46')]({'where':{'id':_0x4645c4[_0xf5de('0x44')]['id']}})[_0xf5de('0x25')](handleEntityNotFound(_0x671d23,null))[_0xf5de('0x25')](removeEntity(_0x671d23,null))[_0xf5de('0x42')](handleError(_0x671d23,null));};exports['describe']=function(_0x2d8bd1,_0x25cd11){return db[_0xf5de('0x2c')]['describe']()[_0xf5de('0x25')](respondWithResult(_0x25cd11,null))[_0xf5de('0x42')](handleError(_0x25cd11,null));};exports['getQuestions']=function(_0x1495d9,_0x3c6a7d,_0x31e771){var _0x13af68={'raw':!![],'where':{}};var _0x431cb1={};var _0x5e1137={'count':0x0,'rows':[]};return db[_0xf5de('0x2c')][_0xf5de('0x49')]({'where':{'id':_0x1495d9[_0xf5de('0x44')]['id']}})[_0xf5de('0x25')](handleEntityNotFound(_0x3c6a7d,null))[_0xf5de('0x25')](function(_0x12bcb9){if(_0x12bcb9){_0x431cb1[_0xf5de('0x2f')]=_['keys'](db[_0xf5de('0x4a')][_0xf5de('0x45')]);_0x431cb1[_0xf5de('0x30')]=_[_0xf5de('0x31')](_0x1495d9['query']);_0x431cb1[_0xf5de('0x32')]=_['intersection'](_0x431cb1[_0xf5de('0x2f')],_0x431cb1[_0xf5de('0x30')]);_0x13af68['attributes']=_[_0xf5de('0x33')](_0x431cb1['model'],qs[_0xf5de('0x35')](_0x1495d9[_0xf5de('0x30')][_0xf5de('0x35')]));_0x13af68[_0xf5de('0x34')]=_0x13af68['attributes'][_0xf5de('0x36')]?_0x13af68['attributes']:_0x431cb1[_0xf5de('0x2f')];if(!_0x1495d9[_0xf5de('0x30')][_0xf5de('0x4b')]('nolimit')){_0x13af68[_0xf5de('0x1d')]=qs[_0xf5de('0x1d')](_0x1495d9['query'][_0xf5de('0x1d')]);_0x13af68['offset']=qs['offset'](_0x1495d9[_0xf5de('0x30')][_0xf5de('0x1f')]);}_0x13af68['order']=qs[_0xf5de('0x38')](_0x1495d9[_0xf5de('0x30')][_0xf5de('0x38')]);_0x13af68[_0xf5de('0x39')]=qs[_0xf5de('0x32')](_[_0xf5de('0x3a')](_0x1495d9[_0xf5de('0x30')],_0x431cb1['filters']));_0x13af68[_0xf5de('0x39')]['SessionId']=_0x12bcb9['id'];if(_0x1495d9[_0xf5de('0x30')][_0xf5de('0x3b')]){_0x13af68['where']=_[_0xf5de('0x3c')](_0x13af68['where'],{'$or':_[_0xf5de('0x2b')](_0x13af68[_0xf5de('0x34')],function(_0x21924c){var _0x541295={};_0x541295[_0x21924c]={'$like':'%'+_0x1495d9[_0xf5de('0x30')][_0xf5de('0x3b')]+'%'};return _0x541295;})});}_0x13af68=_['merge']({},_0x13af68,_0x1495d9[_0xf5de('0x3e')]);return db['JscriptyQuestionReport'][_0xf5de('0x1e')]({'where':_0x13af68[_0xf5de('0x39')]})[_0xf5de('0x25')](function(_0xce9015){_0x5e1137['count']=_0xce9015;if(_0x1495d9[_0xf5de('0x30')][_0xf5de('0x3f')]){_0x13af68['include']=[{'all':!![]}];}return db[_0xf5de('0x4a')][_0xf5de('0x41')](_0x13af68);})['then'](function(_0x8fae15){_0x5e1137['rows']=_0x8fae15;return _0x5e1137;});}})[_0xf5de('0x25')](respondWithFilteredResult(_0x3c6a7d,_0x13af68))[_0xf5de('0x42')](handleError(_0x3c6a7d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 86b3db2..8714066 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 _0x4975=['./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bcd71,_0x36fb5d){var _0x4fad9c=function(_0x51c044){while(--_0x51c044){_0x3bcd71['push'](_0x3bcd71['shift']());}};_0x4fad9c(++_0x36fb5d);}(_0x4975,0x86));var _0x5497=function(_0x80fb38,_0x28f118){_0x80fb38=_0x80fb38-0x0;var _0x5171b1=_0x4975[_0x80fb38];return _0x5171b1;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x207178,_0x104f12){_0x207178=_0x207178-0x0;var _0x15904=_0xb4c7[_0x207178];return _0x15904;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x7b4c('0xb'),'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 4aab538..0a9bac9 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5bf180,_0x4e2320){var _0x85d290=function(_0x21c699){while(--_0x21c699){_0x5bf180['push'](_0x5bf180['shift']());}};_0x85d290(++_0x4e2320);}(_0x33af,0xec));var _0xf33a=function(_0x396b44,_0x53777a){_0x396b44=_0x396b44-0x0;var _0x170b96=_0x33af[_0x396b44];return _0x170b96;};'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')]('JscriptySessionReport,\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')]('JscriptySessionReport,\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 +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x274365,_0x5a8a5c){var _0x3f190f=function(_0x43c1ed){while(--_0x43c1ed){_0x274365['push'](_0x274365['shift']());}};_0x3f190f(++_0x5a8a5c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x25fb85,_0x15814e){_0x25fb85=_0x25fb85-0x0;var _0x141a4d=_0x9f0e[_0x25fb85];return _0x141a4d;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 11ecc63..282fd13 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 _0x0578=['/download_log_file','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','/:id','update'];(function(_0x2751e1,_0x17b8fd){var _0x55a38e=function(_0x1c436c){while(--_0x1c436c){_0x2751e1['push'](_0x2751e1['shift']());}};_0x55a38e(++_0x17b8fd);}(_0x0578,0x112));var _0x8057=function(_0x216503,_0x2bd227){_0x216503=_0x216503-0x0;var _0x1c2728=_0x0578[_0x216503];return _0x1c2728;};'use strict';var multer=require(_0x8057('0x0'));var util=require(_0x8057('0x1'));var path=require(_0x8057('0x2'));var timeout=require(_0x8057('0x3'));var express=require(_0x8057('0x4'));var router=express[_0x8057('0x5')]();var fs_extra=require(_0x8057('0x6'));var auth=require(_0x8057('0x7'));var interaction=require(_0x8057('0x8'));var config=require('../../config/environment');var controller=require(_0x8057('0x9'));router[_0x8057('0xa')]('/',controller[_0x8057('0xb')]);router['put'](_0x8057('0xc'),auth['isAuthenticated'](),controller[_0x8057('0xd')]);router['get'](_0x8057('0xe'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x8057('0xf')]=router; \ No newline at end of file +var _0x6c99=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','downloadLogFile','exports','multer','util','path'];(function(_0x466b81,_0x5653e9){var _0x3d6db0=function(_0x4f8369){while(--_0x4f8369){_0x466b81['push'](_0x466b81['shift']());}};_0x3d6db0(++_0x5653e9);}(_0x6c99,0x96));var _0x96c9=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x6c99[_0xb65e77];return _0x38134b;};'use strict';var multer=require(_0x96c9('0x0'));var util=require(_0x96c9('0x1'));var path=require(_0x96c9('0x2'));var timeout=require(_0x96c9('0x3'));var express=require(_0x96c9('0x4'));var router=express[_0x96c9('0x5')]();var fs_extra=require(_0x96c9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x96c9('0x7'));var config=require(_0x96c9('0x8'));var controller=require(_0x96c9('0x9'));router[_0x96c9('0xa')]('/',controller[_0x96c9('0xb')]);router[_0x96c9('0xc')](_0x96c9('0xd'),auth[_0x96c9('0xe')](),controller['update']);router[_0x96c9('0xa')]('/download_log_file',auth[_0x96c9('0xe')](),controller[_0x96c9('0xf')]);module[_0x96c9('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 70f08ef..4eb16d3 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 _0xe71f=['sequelize','exports','STRING'];(function(_0x4d135b,_0x33fdd3){var _0xc537a7=function(_0x3ad014){while(--_0x3ad014){_0x4d135b['push'](_0x4d135b['shift']());}};_0xc537a7(++_0x33fdd3);}(_0xe71f,0x171));var _0xfe71=function(_0x9a2cb2,_0x3a2b69){_0x9a2cb2=_0x9a2cb2-0x0;var _0x236022=_0xe71f[_0x9a2cb2];return _0x236022;};'use strict';var Sequelize=require(_0xfe71('0x0'));module[_0xfe71('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xfe71('0x2')]},'data2':{'type':Sequelize[_0xfe71('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x207d=['STRING','INTEGER','exports','TEXT'];(function(_0x4c84f7,_0x1cd828){var _0x1a1aad=function(_0x159e80){while(--_0x159e80){_0x4c84f7['push'](_0x4c84f7['shift']());}};_0x1a1aad(++_0x1cd828);}(_0x207d,0x112));var _0xd207=function(_0xaad217,_0x5ab5e3){_0xaad217=_0xaad217-0x0;var _0x3c1044=_0x207d[_0xaad217];return _0x3c1044;};'use strict';var Sequelize=require('sequelize');module[_0xd207('0x0')]={'license':{'type':Sequelize[_0xd207('0x1')]},'data1':{'type':Sequelize[_0xd207('0x2')]},'data2':{'type':Sequelize[_0xd207('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd207('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 2e36bf0..52e1015 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 _0x623e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','error','stack','name','index','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','getLicense','catch','body','params','get','demo','downloadLogFile','license-info.log','/var','log','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x5e2762,_0x3bfcb4){var _0x3e711c=function(_0x3a5403){while(--_0x3a5403){_0x5e2762['push'](_0x5e2762['shift']());}};_0x3e711c(++_0x3bfcb4);}(_0x623e,0xb5));var _0xe623=function(_0x2887b2,_0x588e01){_0x2887b2=_0x2887b2-0x0;var _0x18340e=_0x623e[_0x2887b2];return _0x18340e;};'use strict';var emlformat=require(_0xe623('0x0'));var rimraf=require(_0xe623('0x1'));var zipdir=require(_0xe623('0x2'));var jsonpatch=require(_0xe623('0x3'));var rp=require(_0xe623('0x4'));var moment=require(_0xe623('0x5'));var BPromise=require(_0xe623('0x6'));var Mustache=require(_0xe623('0x7'));var util=require(_0xe623('0x8'));var path=require(_0xe623('0x9'));var sox=require(_0xe623('0xa'));var csv=require('to-csv');var ejs=require(_0xe623('0xb'));var fs=require('fs');var fs_extra=require(_0xe623('0xc'));var _=require(_0xe623('0xd'));var squel=require('squel');var crypto=require(_0xe623('0xe'));var jsforce=require(_0xe623('0xf'));var deskjs=require(_0xe623('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe623('0x11'));var Papa=require(_0xe623('0x12'));var Redis=require(_0xe623('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe623('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe623('0x15'))('api');var utils=require(_0xe623('0x16'));var config=require(_0xe623('0x17'));var licenseUtil=require(_0xe623('0x18'));var db=require(_0xe623('0x19'))['db'];function respondWithStatusCode(_0x507c72,_0x1a2f40){_0x1a2f40=_0x1a2f40||0xcc;return function(_0x577895){if(_0x577895){return _0x507c72[_0xe623('0x1a')](_0x1a2f40);}return _0x507c72['status'](_0x1a2f40)[_0xe623('0x1b')]();};}function respondWithResult(_0x13ef19,_0x59a060){_0x59a060=_0x59a060||0xc8;return function(_0x1d8833){if(_0x1d8833){return _0x13ef19[_0xe623('0x1c')](_0x59a060)[_0xe623('0x1d')](_0x1d8833);}};}function respondWithFilteredResult(_0x52d63e,_0x3c4161){return function(_0x430b4c){if(_0x430b4c){var _0x1ea904=typeof _0x3c4161[_0xe623('0x1e')]===_0xe623('0x1f')&&typeof _0x3c4161['limit']===_0xe623('0x1f');var _0x26eb5d=_0x430b4c['count'];var _0x56cde9=_0x1ea904?0x0:_0x3c4161[_0xe623('0x1e')];var _0x4b4a70=_0x1ea904?_0x430b4c['count']:_0x3c4161[_0xe623('0x1e')]+_0x3c4161[_0xe623('0x20')];var _0x570949;if(_0x4b4a70>=_0x26eb5d){_0x4b4a70=_0x26eb5d;_0x570949=0xc8;}else{_0x570949=0xce;}_0x52d63e['status'](_0x570949);return _0x52d63e[_0xe623('0x21')](_0xe623('0x22'),_0x56cde9+'-'+_0x4b4a70+'/'+_0x26eb5d)[_0xe623('0x1d')](_0x430b4c);}return null;};}function patchUpdates(_0x122037){return function(_0x12c8ce){try{jsonpatch[_0xe623('0x23')](_0x12c8ce,_0x122037,!![]);}catch(_0x1c521b){return BPromise['reject'](_0x1c521b);}return _0x12c8ce[_0xe623('0x24')]();};}function saveUpdates(_0x404b95,_0x34092c){return function(_0x33e45e){if(_0x33e45e){return _0x33e45e[_0xe623('0x25')](_0x404b95)['then'](function(_0xd9024){return _0xd9024;});}return null;};}function removeEntity(_0x4868ec,_0x5c57a1){return function(_0x547a1f){if(_0x547a1f){return _0x547a1f['destroy']()[_0xe623('0x26')](function(){_0x4868ec['status'](0xcc)[_0xe623('0x1b')]();});}};}function handleEntityNotFound(_0x3d8c38,_0x37c253){return function(_0x1594ad){if(!_0x1594ad){_0x3d8c38[_0xe623('0x1a')](0x194);}return _0x1594ad;};}function handleError(_0x1f71b2,_0x406a0a){_0x406a0a=_0x406a0a||0x1f4;return function(_0x145534){logger[_0xe623('0x27')](_0x145534[_0xe623('0x28')]);if(_0x145534[_0xe623('0x29')]){delete _0x145534[_0xe623('0x29')];}_0x1f71b2[_0xe623('0x1c')](_0x406a0a)['send'](_0x145534);};}var utilLicense=require(_0xe623('0x18'));exports[_0xe623('0x2a')]=function(_0x54e77c,_0x357538){var _0x291965={'raw':!![],'where':{'id':0x1}},_0x177162={};_0x177162[_0xe623('0x2b')]=_['keys'](db[_0xe623('0x2c')][_0xe623('0x2d')]);_0x177162[_0xe623('0x2e')]=_[_0xe623('0x2f')](_0x54e77c[_0xe623('0x2e')]);_0x177162[_0xe623('0x30')]=_[_0xe623('0x31')](_0x177162[_0xe623('0x2b')],_0x177162[_0xe623('0x2e')]);_0x291965[_0xe623('0x32')]=_['intersection'](_0x177162['model'],qs[_0xe623('0x33')](_0x54e77c[_0xe623('0x2e')][_0xe623('0x33')]));_0x291965['attributes']=_0x291965[_0xe623('0x32')][_0xe623('0x34')]?_0x291965[_0xe623('0x32')]:_0x177162['model'];_0x291965=_['merge']({},_0x291965,_0x54e77c['options']);return utilLicense[_0xe623('0x35')](_0x291965)[_0xe623('0x26')](respondWithResult(_0x357538,null))[_0xe623('0x36')](handleError(_0x357538,null));};exports['update']=function(_0x585607,_0x162885){if(_0x585607[_0xe623('0x37')]['id']){delete _0x585607[_0xe623('0x37')]['id'];}return db[_0xe623('0x2c')]['find']({'where':{'id':_0x585607[_0xe623('0x38')]['id']}})[_0xe623('0x26')](handleEntityNotFound(_0x162885,null))[_0xe623('0x26')](function(_0x2386cc){var _0x56dcb3=_0x2386cc[_0xe623('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x56dcb3,_0x585607[_0xe623('0x37')]['key']);})['then'](function(_0x318a5b){if(!_0x318a5b[_0xe623('0x3a')]){return saveUpdates(_0x585607[_0xe623('0x37')],null);}return _0x318a5b;})['then'](respondWithResult(_0x162885,null))[_0xe623('0x36')](handleError(_0x162885,null));};exports[_0xe623('0x3b')]=function(_0x545be9,_0x73d657){var _0x608e15=_0xe623('0x3c');var _0x16b8c4=path['join'](_0xe623('0x3d'),_0xe623('0x3e'),'xcally',_0x608e15);_0x73d657['setHeader'](_0xe623('0x3f'),_0xe623('0x40')+_0x608e15);_0x73d657['set'](_0xe623('0x41'),_0xe623('0x42'));_0x73d657[_0xe623('0x43')](_0x16b8c4);}; \ No newline at end of file +var _0xa4b0=['license-info.log','join','/var','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','options','getLicense','body','find','get','key','demo','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4b0,0x15d));var _0x0a4b=function(_0x17cf57,_0x3a80b4){_0x17cf57=_0x17cf57-0x0;var _0x2508aa=_0xa4b0[_0x17cf57];return _0x2508aa;};'use strict';var emlformat=require(_0x0a4b('0x0'));var rimraf=require(_0x0a4b('0x1'));var zipdir=require(_0x0a4b('0x2'));var jsonpatch=require(_0x0a4b('0x3'));var rp=require('request-promise');var moment=require(_0x0a4b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a4b('0x5'));var path=require('path');var sox=require(_0x0a4b('0x6'));var csv=require(_0x0a4b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a4b('0x8'));var _=require(_0x0a4b('0x9'));var squel=require(_0x0a4b('0xa'));var crypto=require(_0x0a4b('0xb'));var jsforce=require(_0x0a4b('0xc'));var deskjs=require(_0x0a4b('0xd'));var toCsv=require(_0x0a4b('0x7'));var querystring=require(_0x0a4b('0xe'));var Papa=require(_0x0a4b('0xf'));var Redis=require(_0x0a4b('0x10'));var authService=require(_0x0a4b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a4b('0x12'));var logger=require(_0x0a4b('0x13'))(_0x0a4b('0x14'));var utils=require(_0x0a4b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0a4b('0x16'));var db=require(_0x0a4b('0x17'))['db'];function respondWithStatusCode(_0x511cab,_0x208875){_0x208875=_0x208875||0xcc;return function(_0x401fae){if(_0x401fae){return _0x511cab[_0x0a4b('0x18')](_0x208875);}return _0x511cab['status'](_0x208875)['end']();};}function respondWithResult(_0xbf2869,_0xcd50fe){_0xcd50fe=_0xcd50fe||0xc8;return function(_0x2af6ee){if(_0x2af6ee){return _0xbf2869[_0x0a4b('0x19')](_0xcd50fe)[_0x0a4b('0x1a')](_0x2af6ee);}};}function respondWithFilteredResult(_0x49f0ad,_0x175c4a){return function(_0x5a8bd7){if(_0x5a8bd7){var _0x21c5a3=typeof _0x175c4a[_0x0a4b('0x1b')]===_0x0a4b('0x1c')&&typeof _0x175c4a[_0x0a4b('0x1d')]===_0x0a4b('0x1c');var _0x20be30=_0x5a8bd7['count'];var _0x353394=_0x21c5a3?0x0:_0x175c4a[_0x0a4b('0x1b')];var _0x297e8b=_0x21c5a3?_0x5a8bd7[_0x0a4b('0x1e')]:_0x175c4a[_0x0a4b('0x1b')]+_0x175c4a[_0x0a4b('0x1d')];var _0x25d039;if(_0x297e8b>=_0x20be30){_0x297e8b=_0x20be30;_0x25d039=0xc8;}else{_0x25d039=0xce;}_0x49f0ad[_0x0a4b('0x19')](_0x25d039);return _0x49f0ad[_0x0a4b('0x1f')](_0x0a4b('0x20'),_0x353394+'-'+_0x297e8b+'/'+_0x20be30)[_0x0a4b('0x1a')](_0x5a8bd7);}return null;};}function patchUpdates(_0x4659fe){return function(_0x58a25f){try{jsonpatch[_0x0a4b('0x21')](_0x58a25f,_0x4659fe,!![]);}catch(_0x4197a4){return BPromise[_0x0a4b('0x22')](_0x4197a4);}return _0x58a25f[_0x0a4b('0x23')]();};}function saveUpdates(_0x148535,_0xfae7df){return function(_0x462a2c){if(_0x462a2c){return _0x462a2c[_0x0a4b('0x24')](_0x148535)[_0x0a4b('0x25')](function(_0x2afd4e){return _0x2afd4e;});}return null;};}function removeEntity(_0x3e3839,_0x474ef9){return function(_0x15891a){if(_0x15891a){return _0x15891a[_0x0a4b('0x26')]()[_0x0a4b('0x25')](function(){_0x3e3839['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc9658,_0x29b42f){return function(_0x5997c3){if(!_0x5997c3){_0xdc9658[_0x0a4b('0x18')](0x194);}return _0x5997c3;};}function handleError(_0x40142e,_0x29bddc){_0x29bddc=_0x29bddc||0x1f4;return function(_0x33e6a9){logger[_0x0a4b('0x27')](_0x33e6a9[_0x0a4b('0x28')]);if(_0x33e6a9[_0x0a4b('0x29')]){delete _0x33e6a9[_0x0a4b('0x29')];}_0x40142e[_0x0a4b('0x19')](_0x29bddc)['send'](_0x33e6a9);};}var utilLicense=require(_0x0a4b('0x16'));exports['index']=function(_0x57d7cb,_0x267bc2){var _0x1ef62d={'raw':!![],'where':{'id':0x1}},_0x53997f={};_0x53997f[_0x0a4b('0x2a')]=_[_0x0a4b('0x2b')](db[_0x0a4b('0x2c')][_0x0a4b('0x2d')]);_0x53997f[_0x0a4b('0x2e')]=_[_0x0a4b('0x2b')](_0x57d7cb[_0x0a4b('0x2e')]);_0x53997f['filters']=_[_0x0a4b('0x2f')](_0x53997f[_0x0a4b('0x2a')],_0x53997f[_0x0a4b('0x2e')]);_0x1ef62d[_0x0a4b('0x30')]=_[_0x0a4b('0x2f')](_0x53997f[_0x0a4b('0x2a')],qs['fields'](_0x57d7cb[_0x0a4b('0x2e')][_0x0a4b('0x31')]));_0x1ef62d[_0x0a4b('0x30')]=_0x1ef62d['attributes'][_0x0a4b('0x32')]?_0x1ef62d[_0x0a4b('0x30')]:_0x53997f[_0x0a4b('0x2a')];_0x1ef62d=_['merge']({},_0x1ef62d,_0x57d7cb[_0x0a4b('0x33')]);return utilLicense[_0x0a4b('0x34')](_0x1ef62d)['then'](respondWithResult(_0x267bc2,null))['catch'](handleError(_0x267bc2,null));};exports[_0x0a4b('0x24')]=function(_0x42c8bb,_0x208c16){if(_0x42c8bb[_0x0a4b('0x35')]['id']){delete _0x42c8bb[_0x0a4b('0x35')]['id'];}return db[_0x0a4b('0x2c')][_0x0a4b('0x36')]({'where':{'id':_0x42c8bb['params']['id']}})[_0x0a4b('0x25')](handleEntityNotFound(_0x208c16,null))['then'](function(_0x1331de){var _0x55bd64=_0x1331de[_0x0a4b('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x55bd64,_0x42c8bb[_0x0a4b('0x35')][_0x0a4b('0x38')]);})[_0x0a4b('0x25')](function(_0x38a4b0){if(!_0x38a4b0[_0x0a4b('0x39')]){return saveUpdates(_0x42c8bb[_0x0a4b('0x35')],null);}return _0x38a4b0;})[_0x0a4b('0x25')](respondWithResult(_0x208c16,null))[_0x0a4b('0x3a')](handleError(_0x208c16,null));};exports['downloadLogFile']=function(_0x63f6e2,_0x572978){var _0x484088=_0x0a4b('0x3b');var _0x56b504=path[_0x0a4b('0x3c')](_0x0a4b('0x3d'),'log',_0x0a4b('0x3e'),_0x484088);_0x572978['setHeader'](_0x0a4b('0x3f'),_0x0a4b('0x40')+_0x484088);_0x572978[_0x0a4b('0x1f')](_0x0a4b('0x41'),_0x0a4b('0x42'));_0x572978[_0x0a4b('0x43')](_0x56b504);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 28399d7..56edfbf 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 _0x3458=['api','path','./license.attributes','exports','License','lodash','util','../../config/logger'];(function(_0x56278e,_0x5083c5){var _0x46d37e=function(_0x274725){while(--_0x274725){_0x56278e['push'](_0x56278e['shift']());}};_0x46d37e(++_0x5083c5);}(_0x3458,0xed));var _0x8345=function(_0x33e062,_0x18285){_0x33e062=_0x33e062-0x0;var _0x1b93d7=_0x3458[_0x33e062];return _0x1b93d7;};'use strict';var _=require(_0x8345('0x0'));var util=require(_0x8345('0x1'));var logger=require(_0x8345('0x2'))(_0x8345('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8345('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8345('0x5'));module[_0x8345('0x6')]=function(_0xd31b49,_0x8a7ba2){return _0xd31b49['define'](_0x8345('0x7'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe9e=['moment','bluebird','rimraf','./license.attributes','exports','define','License','license','lodash','util','api'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xbe9e,0x173));var _0xebe9=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xbe9e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xebe9('0x0'));var util=require(_0xebe9('0x1'));var logger=require('../../config/logger')(_0xebe9('0x2'));var moment=require(_0xebe9('0x3'));var BPromise=require(_0xebe9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xebe9('0x5'));var config=require('../../config/environment');var attributes=require(_0xebe9('0x6'));module[_0xebe9('0x7')]=function(_0xbc8db9,_0x538620){return _0xbc8db9[_0xebe9('0x8')](_0xebe9('0x9'),attributes,{'tableName':_0xebe9('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 0341304..e241e4e 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 _0xba70=['info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xba70,0x1d6));var _0x0ba7=function(_0x186f36,_0x24e2e8){_0x186f36=_0x186f36-0x0;var _0x4f6c44=_0xba70[_0x186f36];return _0x4f6c44;};'use strict';var _=require(_0x0ba7('0x0'));var util=require(_0x0ba7('0x1'));var moment=require(_0x0ba7('0x2'));var BPromise=require(_0x0ba7('0x3'));var rs=require(_0x0ba7('0x4'));var fs=require('fs');var Redis=require(_0x0ba7('0x5'));var db=require(_0x0ba7('0x6'))['db'];var utils=require(_0x0ba7('0x7'));var logger=require('../../config/logger')(_0x0ba7('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ba7('0x9'));var client=jayson[_0x0ba7('0xa')][_0x0ba7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50b8bb,_0x3ad47b,_0x2e9b82){return new BPromise(function(_0x59015e,_0x510971){return client[_0x0ba7('0xc')](_0x50b8bb,_0x2e9b82)[_0x0ba7('0xd')](function(_0x219821){logger[_0x0ba7('0xe')](_0x0ba7('0xf'),_0x3ad47b,_0x0ba7('0x10'));logger['debug'](_0x0ba7('0x11'),_0x3ad47b,_0x0ba7('0x10'),JSON[_0x0ba7('0x12')](_0x219821));if(_0x219821[_0x0ba7('0x13')]){if(_0x219821['error']['code']===0x1f4){logger[_0x0ba7('0x13')](_0x0ba7('0xf'),_0x3ad47b,_0x219821['error'][_0x0ba7('0x14')]);return _0x510971(_0x219821['error'][_0x0ba7('0x14')]);}logger[_0x0ba7('0x13')]('License,\x20%s,\x20%s',_0x3ad47b,_0x219821[_0x0ba7('0x13')][_0x0ba7('0x14')]);return _0x59015e(_0x219821[_0x0ba7('0x13')][_0x0ba7('0x14')]);}else{logger[_0x0ba7('0xe')]('License,\x20%s,\x20%s',_0x3ad47b,_0x0ba7('0x10'));_0x59015e(_0x219821[_0x0ba7('0x15')][_0x0ba7('0x14')]);}})['catch'](function(_0x252e20){logger['error'](_0x0ba7('0xf'),_0x3ad47b,_0x252e20);_0x510971(_0x252e20);});});} \ No newline at end of file +var _0x45c0=['then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x40e28e,_0x49f458){var _0x40fcda=function(_0x288d8d){while(--_0x288d8d){_0x40e28e['push'](_0x40e28e['shift']());}};_0x40fcda(++_0x49f458);}(_0x45c0,0x9d));var _0x045c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x45c0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x045c('0x0'));var util=require(_0x045c('0x1'));var moment=require(_0x045c('0x2'));var BPromise=require(_0x045c('0x3'));var rs=require(_0x045c('0x4'));var fs=require('fs');var Redis=require(_0x045c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x045c('0x6'));var logger=require(_0x045c('0x7'))('rpc');var config=require(_0x045c('0x8'));var jayson=require(_0x045c('0x9'));var client=jayson['client'][_0x045c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ecf92,_0x2f2390,_0x43553f){return new BPromise(function(_0x1b0913,_0x333549){return client['request'](_0x1ecf92,_0x43553f)[_0x045c('0xb')](function(_0x157f7e){logger[_0x045c('0xc')](_0x045c('0xd'),_0x2f2390,_0x045c('0xe'));logger[_0x045c('0xf')](_0x045c('0x10'),_0x2f2390,'request\x20sent',JSON[_0x045c('0x11')](_0x157f7e));if(_0x157f7e[_0x045c('0x12')]){if(_0x157f7e['error']['code']===0x1f4){logger[_0x045c('0x12')]('License,\x20%s,\x20%s',_0x2f2390,_0x157f7e[_0x045c('0x12')][_0x045c('0x13')]);return _0x333549(_0x157f7e[_0x045c('0x12')]['message']);}logger[_0x045c('0x12')](_0x045c('0xd'),_0x2f2390,_0x157f7e[_0x045c('0x12')][_0x045c('0x13')]);return _0x1b0913(_0x157f7e['error'][_0x045c('0x13')]);}else{logger[_0x045c('0xc')]('License,\x20%s,\x20%s',_0x2f2390,_0x045c('0xe'));_0x1b0913(_0x157f7e['result'][_0x045c('0x13')]);}})[_0x045c('0x14')](function(_0x433659){logger[_0x045c('0x12')](_0x045c('0xd'),_0x2f2390,_0x433659);_0x333549(_0x433659);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5c04d94..3aef9c8 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 _0x885a=['addAnswer','addImap','/:id/send','send','/:id/users','update','delete','removeDispositions','removeImap','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','addDisposition','post'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0x885a,0xaf));var _0xa885=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x885a[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xa885('0x0'));var util=require(_0xa885('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa885('0x2')]();var fs_extra=require(_0xa885('0x3'));var auth=require(_0xa885('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa885('0x5'));var controller=require(_0xa885('0x6'));router[_0xa885('0x7')]('/',auth['isAuthenticated'](),controller[_0xa885('0x8')]);router[_0xa885('0x7')](_0xa885('0x9'),auth[_0xa885('0xa')](),controller[_0xa885('0xb')]);router['get'](_0xa885('0xc'),auth[_0xa885('0xa')](),controller[_0xa885('0xd')]);router[_0xa885('0x7')](_0xa885('0xe'),auth[_0xa885('0xa')](),controller['getDispositions']);router['get'](_0xa885('0xf'),auth[_0xa885('0xa')](),controller[_0xa885('0x10')]);router[_0xa885('0x7')](_0xa885('0x11'),auth[_0xa885('0xa')](),controller['getImap']);router[_0xa885('0x7')](_0xa885('0x12'),auth['isAuthenticated'](),controller[_0xa885('0x13')]);router[_0xa885('0x7')](_0xa885('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xa885('0x15'),auth['isAuthenticated'](),controller[_0xa885('0x16')]);router[_0xa885('0x7')](_0xa885('0x17'),auth['isAuthenticated'](),controller[_0xa885('0x18')]);router[_0xa885('0x7')](_0xa885('0x19'),auth[_0xa885('0xa')](),controller[_0xa885('0x1a')]);router[_0xa885('0x7')]('/:id/users',auth[_0xa885('0xa')](),controller[_0xa885('0x1b')]);router['post'](_0xa885('0xe'),auth[_0xa885('0xa')](),controller[_0xa885('0x1c')]);router[_0xa885('0x1d')](_0xa885('0xf'),auth[_0xa885('0xa')](),controller[_0xa885('0x1e')]);router[_0xa885('0x1d')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa885('0x1d')](_0xa885('0x11'),auth['isAuthenticated'](),controller[_0xa885('0x1f')]);router['post'](_0xa885('0x12'),auth[_0xa885('0xa')](),controller['addSmtp']);router[_0xa885('0x1d')](_0xa885('0x14'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0xa885('0x15'),auth[_0xa885('0xa')](),controller['addApplications']);router[_0xa885('0x1d')](_0xa885('0x20'),auth[_0xa885('0xa')](),controller[_0xa885('0x21')]);router[_0xa885('0x1d')](_0xa885('0x22'),auth[_0xa885('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0xa885('0xa')](),controller[_0xa885('0x23')]);router[_0xa885('0x24')]('/:id/dispositions',auth[_0xa885('0xa')](),controller[_0xa885('0x25')]);router['delete']('/:id/canned_answers',auth[_0xa885('0xa')](),controller['removeAnswers']);router[_0xa885('0x24')](_0xa885('0x11'),auth[_0xa885('0xa')](),controller[_0xa885('0x26')]);router[_0xa885('0x24')](_0xa885('0x12'),auth[_0xa885('0xa')](),controller['removeSmtp']);router[_0xa885('0x24')](_0xa885('0xc'),auth[_0xa885('0xa')](),controller[_0xa885('0x27')]);router[_0xa885('0x24')]('/:id/users',auth[_0xa885('0xa')](),controller['removeAgents']);module[_0xa885('0x28')]=router; \ No newline at end of file +var _0x3ca0=['update','delete','removeDispositions','/:id/canned_answers','removeImap','removeSmtp','destroy','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','addDisposition','addAnswer','addImap','addSmtp','addApplications','send','/:id/users','/:id'];(function(_0x40c916,_0x59aa12){var _0x5b9f16=function(_0x2d3914){while(--_0x2d3914){_0x40c916['push'](_0x40c916['shift']());}};_0x5b9f16(++_0x59aa12);}(_0x3ca0,0x8f));var _0x03ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x03ca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x03ca('0x1'));var express=require(_0x03ca('0x2'));var router=express[_0x03ca('0x3')]();var fs_extra=require(_0x03ca('0x4'));var auth=require(_0x03ca('0x5'));var interaction=require(_0x03ca('0x6'));var config=require(_0x03ca('0x7'));var controller=require(_0x03ca('0x8'));router[_0x03ca('0x9')]('/',auth[_0x03ca('0xa')](),controller[_0x03ca('0xb')]);router[_0x03ca('0x9')](_0x03ca('0xc'),auth[_0x03ca('0xa')](),controller[_0x03ca('0xd')]);router[_0x03ca('0x9')]('/:id',auth[_0x03ca('0xa')](),controller[_0x03ca('0xe')]);router[_0x03ca('0x9')](_0x03ca('0xf'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x10')]);router[_0x03ca('0x9')]('/:id/canned_answers',auth[_0x03ca('0xa')](),controller[_0x03ca('0x11')]);router[_0x03ca('0x9')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x03ca('0x12')]);router[_0x03ca('0x9')](_0x03ca('0x13'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x14')]);router[_0x03ca('0x9')](_0x03ca('0x15'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x16')]);router[_0x03ca('0x9')](_0x03ca('0x17'),auth[_0x03ca('0xa')](),controller['getApplications']);router[_0x03ca('0x9')](_0x03ca('0x18'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x19')]);router[_0x03ca('0x9')](_0x03ca('0x1a'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x1b')]);router[_0x03ca('0x9')]('/:id/users',auth[_0x03ca('0xa')](),controller['getAgents']);router[_0x03ca('0x1c')](_0x03ca('0xf'),auth['isAuthenticated'](),controller[_0x03ca('0x1d')]);router[_0x03ca('0x1c')]('/:id/canned_answers',auth[_0x03ca('0xa')](),controller[_0x03ca('0x1e')]);router[_0x03ca('0x1c')]('/',auth[_0x03ca('0xa')](),controller['create']);router[_0x03ca('0x1c')]('/:id/in_servers',auth[_0x03ca('0xa')](),controller[_0x03ca('0x1f')]);router['post'](_0x03ca('0x13'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x20')]);router['post'](_0x03ca('0x15'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x03ca('0x1c')](_0x03ca('0x17'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x21')]);router[_0x03ca('0x1c')]('/:id/send',auth[_0x03ca('0xa')](),controller[_0x03ca('0x22')]);router[_0x03ca('0x1c')](_0x03ca('0x23'),auth[_0x03ca('0xa')](),controller['addAgents']);router['put'](_0x03ca('0x24'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x25')]);router[_0x03ca('0x26')](_0x03ca('0xf'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x27')]);router['delete'](_0x03ca('0x28'),auth[_0x03ca('0xa')](),controller['removeAnswers']);router[_0x03ca('0x26')]('/:id/in_servers',auth[_0x03ca('0xa')](),controller[_0x03ca('0x29')]);router[_0x03ca('0x26')]('/:id/out_servers',auth[_0x03ca('0xa')](),controller[_0x03ca('0x2a')]);router['delete'](_0x03ca('0x24'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x2b')]);router['delete'](_0x03ca('0x23'),auth[_0x03ca('0xa')](),controller[_0x03ca('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 68a425c..5a500fc 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 _0xcc2b=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','hotmail','yahoo','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x202ca3,_0x20cd06){var _0x3dd57b=function(_0x4b5411){while(--_0x4b5411){_0x202ca3['push'](_0x202ca3['shift']());}};_0x3dd57b(++_0x20cd06);}(_0xcc2b,0x1e0));var _0xbcc2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xcc2b[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0xbcc2('0x0'));module[_0xbcc2('0x1')]={'description':{'type':Sequelize[_0xbcc2('0x2')]},'name':{'type':Sequelize[_0xbcc2('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xbcc2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xbcc2('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xbcc2('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xbcc2('0x4')]},'markAsUnread':{'type':Sequelize[_0xbcc2('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbcc2('0x5')},'fontSize':{'type':Sequelize[_0xbcc2('0x6')](0x2)[_0xbcc2('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbcc2('0x4')],'defaultValue':function(){return _0xbcc2('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbcc2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbcc2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbcc2('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbcc2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbcc2('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xbcc2('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xbcc2('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3cf028){if(!_0x3cf028)this[_0xbcc2('0xa')](_0xbcc2('0xb'),null);this[_0xbcc2('0xa')](_0xbcc2('0xc'),_0x3cf028);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xbcc2('0xd'),_0xbcc2('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xbcc2('0xf')]('provider'))return _0xbcc2('0x10');return this[_0xbcc2('0xf')]('provider');},'set':function(_0x28305c){if(_0x28305c==='custom')_0x28305c=null;return this[_0xbcc2('0xa')](_0xbcc2('0x11'),_0x28305c);}}}; \ No newline at end of file +var _0x4c80=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider','setDataValue','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x807812,_0x33cddb){var _0x5c6946=function(_0x4a57c1){while(--_0x4a57c1){_0x807812['push'](_0x807812['shift']());}};_0x5c6946(++_0x33cddb);}(_0x4c80,0xea));var _0x04c8=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x4c80[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0x04c8('0x0'));module[_0x04c8('0x1')]={'description':{'type':Sequelize[_0x04c8('0x2')]},'name':{'type':Sequelize[_0x04c8('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x04c8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x04c8('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x04c8('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x04c8('0x2')],'allowNull':![],'defaultValue':_0x04c8('0x4')},'fontSize':{'type':Sequelize[_0x04c8('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x04c8('0x6')],'defaultValue':function(){return _0x04c8('0x7');}},'notificationSound':{'type':Sequelize[_0x04c8('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04c8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04c8('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x04c8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x04c8('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04c8('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x04c8('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x04c8('0x3')],'defaultValue':![],'comment':_0x04c8('0x9'),'set':function(_0x2974cf){if(!_0x2974cf)this['setDataValue'](_0x04c8('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x2974cf);}},'provider':{'type':Sequelize[_0x04c8('0xb')](_0x04c8('0xc'),_0x04c8('0xd'),_0x04c8('0xe'),_0x04c8('0xf')),'defaultValue':null,'get':function(){if(!this[_0x04c8('0x10')]('provider'))return _0x04c8('0x11');return this[_0x04c8('0x10')](_0x04c8('0x12'));},'set':function(_0x4d7964){if(_0x4d7964===_0x04c8('0x11'))_0x4d7964=null;return this[_0x04c8('0x13')](_0x04c8('0x12'),_0x4d7964);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8cc5a0d..6073307 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 _0x2e8b=['status','end','json','offset','undefined','limit','count','set','update','then','get','MailAccounts','UserProfileResource','destroy','stack','name','gmail','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','findAll','show','params','keys','include','body','provider','custom','secure','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','nolimit','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','User','fullname','internal','Tag','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','send','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','Interaction','getSmtpOptions','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2e8b,0xa4));var _0xb2e8=function(_0x37f8eb,_0x1e3a41){_0x37f8eb=_0x37f8eb-0x0;var _0x1473af=_0x2e8b[_0x37f8eb];return _0x1473af;};'use strict';var moment=require(_0xb2e8('0x0'));var BPromise=require(_0xb2e8('0x1'));var util=require(_0xb2e8('0x2'));var path=require('path');var _=require('lodash');var juice=require(_0xb2e8('0x3'));var Redis=require('ioredis');var qs=require(_0xb2e8('0x4'));var logger=require(_0xb2e8('0x5'))(_0xb2e8('0x6'));var config=require(_0xb2e8('0x7'));var db=require(_0xb2e8('0x8'))['db'];config[_0xb2e8('0x9')]=_[_0xb2e8('0xa')](config['redis'],{'host':_0xb2e8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2e8('0x9')]));require('./mailAccount.socket')[_0xb2e8('0xc')](socket);var jayson=require(_0xb2e8('0xd'));var client=jayson[_0xb2e8('0xe')][_0xb2e8('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x28e17c,_0x26e87f,_0x3bde44,_0x10c85f){return new BPromise(function(_0x240ddd,_0x1acae9){var _0x39a472=_0x10c85f||client;return _0x39a472[_0xb2e8('0x10')](_0x28e17c,_0x3bde44)['then'](function(_0x2f315f){logger[_0xb2e8('0x11')](_0xb2e8('0x12'),_0x26e87f,_0xb2e8('0x13'));logger[_0xb2e8('0x14')](_0xb2e8('0x15'),_0x26e87f,_0xb2e8('0x13'),JSON[_0xb2e8('0x16')](_0x2f315f));if(_0x2f315f[_0xb2e8('0x17')]){if(_0x2f315f[_0xb2e8('0x17')][_0xb2e8('0x18')]===0x1f4){logger[_0xb2e8('0x17')](_0xb2e8('0x12'),_0x26e87f,_0x2f315f[_0xb2e8('0x17')][_0xb2e8('0x19')]);return _0x1acae9(_0x2f315f[_0xb2e8('0x17')][_0xb2e8('0x19')]);}logger['error'](_0xb2e8('0x12'),_0x26e87f,_0x2f315f['error'][_0xb2e8('0x19')]);return _0x240ddd(_0x2f315f['error'][_0xb2e8('0x19')]);}else{logger[_0xb2e8('0x11')]('MailAccount,\x20%s,\x20%s',_0x26e87f,_0xb2e8('0x13'));_0x240ddd(_0x2f315f[_0xb2e8('0x1a')][_0xb2e8('0x19')]);}})[_0xb2e8('0x1b')](function(_0x1f8605){logger['error'](_0xb2e8('0x12'),_0x26e87f,_0x1f8605);_0x1acae9(_0x1f8605);});});}function respondWithStatusCode(_0x108958,_0x346be4){_0x346be4=_0x346be4||0xcc;return function(_0x45b590){if(_0x45b590){return _0x108958[_0xb2e8('0x1c')](_0x346be4);}return _0x108958[_0xb2e8('0x1d')](_0x346be4)[_0xb2e8('0x1e')]();};}function respondWithResult(_0x24b34c,_0x4d08e0){_0x4d08e0=_0x4d08e0||0xc8;return function(_0x1923d7){if(_0x1923d7){return _0x24b34c[_0xb2e8('0x1d')](_0x4d08e0)[_0xb2e8('0x1f')](_0x1923d7);}};}function respondWithFilteredResult(_0x3dd643,_0x246abe){return function(_0x5c99a7){if(_0x5c99a7){var _0x25c4f8=typeof _0x246abe[_0xb2e8('0x20')]===_0xb2e8('0x21')&&typeof _0x246abe[_0xb2e8('0x22')]==='undefined';var _0x400aa8=_0x5c99a7[_0xb2e8('0x23')];var _0x22c630=_0x25c4f8?0x0:_0x246abe[_0xb2e8('0x20')];var _0x47a16a=_0x25c4f8?_0x5c99a7[_0xb2e8('0x23')]:_0x246abe[_0xb2e8('0x20')]+_0x246abe[_0xb2e8('0x22')];var _0xac4acb;if(_0x47a16a>=_0x400aa8){_0x47a16a=_0x400aa8;_0xac4acb=0xc8;}else{_0xac4acb=0xce;}_0x3dd643[_0xb2e8('0x1d')](_0xac4acb);return _0x3dd643[_0xb2e8('0x24')]('Content-Range',_0x22c630+'-'+_0x47a16a+'/'+_0x400aa8)['json'](_0x5c99a7);}return null;};}function saveUpdates(_0x4a5bfd){return function(_0x10694e){if(_0x10694e){return _0x10694e[_0xb2e8('0x25')](_0x4a5bfd)['then'](function(_0x5721f4){return _0x5721f4;});}return null;};}function removeEntity(_0x439ca9){return function(_0x408b3f){if(_0x408b3f){return _0x408b3f['destroy']()[_0xb2e8('0x26')](function(){var _0x18afad=_0x408b3f[_0xb2e8('0x27')]({'plain':!![]});var _0x87bb08=_0xb2e8('0x28');return db[_0xb2e8('0x29')][_0xb2e8('0x2a')]({'where':{'type':_0x87bb08,'resourceId':_0x18afad['id']}})[_0xb2e8('0x26')](function(){return _0x408b3f;});})[_0xb2e8('0x26')](function(){_0x439ca9[_0xb2e8('0x1d')](0xcc)[_0xb2e8('0x1e')]();});}};}function handleEntityNotFound(_0x17745e){return function(_0xde2b64){if(!_0xde2b64){_0x17745e[_0xb2e8('0x1c')](0x194);}return _0xde2b64;};}function handleError(_0x50a6f7,_0x1ce883){_0x1ce883=_0x1ce883||0x1f4;return function(_0x41b9ba){logger[_0xb2e8('0x17')](_0x41b9ba[_0xb2e8('0x2b')]);if(_0x41b9ba[_0xb2e8('0x2c')]){delete _0x41b9ba[_0xb2e8('0x2c')];}_0x50a6f7[_0xb2e8('0x1d')](_0x1ce883)['send'](_0x41b9ba);};}function getImapHost(_0x2dafd5){switch(_0x2dafd5){case _0xb2e8('0x2d'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0xb2e8('0x2e'):return _0xb2e8('0x2f');case _0xb2e8('0x30'):return _0xb2e8('0x31');}throw new Error(_0xb2e8('0x32'),_0x2dafd5);}function getSmtpHost(_0xf2216f){switch(_0xf2216f){case _0xb2e8('0x2d'):return _0xb2e8('0x33');case _0xb2e8('0x34'):return _0xb2e8('0x35');case _0xb2e8('0x2e'):return'smtp-mail.outlook.com';case'outlook365':return _0xb2e8('0x36');}throw new Error(_0xb2e8('0x32'),_0xf2216f);}function getAuthenticationOptions(_0x33ceb3,_0xa413aa){var _0x2e50db={};var _0x3fa47d={};if(_0x33ceb3){_0x2e50db[_0xb2e8('0x37')]=_0x3fa47d[_0xb2e8('0x37')]=_0xa413aa['username'];_0x2e50db[_0xb2e8('0x38')]=_0x3fa47d[_0xb2e8('0x39')]=_0xa413aa['password'];if(_0xa413aa['modernAuthentication']){_0x2e50db['modernAuthentication']=_0x3fa47d[_0xb2e8('0x3a')]=!![];_0x2e50db[_0xb2e8('0x3b')]=_0x3fa47d[_0xb2e8('0x3b')]=_0xa413aa['CloudProviderId'];_0x2e50db[_0xb2e8('0x38')]=_0x3fa47d[_0xb2e8('0x39')]=null;}else{_0x2e50db['CloudProviderId']=_0x3fa47d[_0xb2e8('0x3b')]=null;}_0x2e50db[_0xb2e8('0x3c')]=getImapHost(_0x33ceb3);_0x2e50db[_0xb2e8('0x3d')]=0x3e1;_0x3fa47d[_0xb2e8('0x3c')]=getSmtpHost(_0x33ceb3);_0x3fa47d[_0xb2e8('0x3d')]=0x24b;_0x3fa47d['secure']=![];_0x2e50db['service']=_0x3fa47d[_0xb2e8('0x3e')]=null;}else{if(_0xa413aa[_0xb2e8('0x3f')]){_0x2e50db['user']=_0x3fa47d['user']=_0xa413aa['username'];_0x2e50db['password']=_0x3fa47d[_0xb2e8('0x39')]=_0xa413aa['password'];}else{_0x2e50db['authentication']=_0x3fa47d[_0xb2e8('0x3f')]=![];_0x2e50db[_0xb2e8('0x37')]=_0x3fa47d['user']=null;_0x2e50db[_0xb2e8('0x38')]=_0x3fa47d[_0xb2e8('0x39')]=null;}_0x2e50db[_0xb2e8('0x3c')]=_0xa413aa[_0xb2e8('0x40')][_0xb2e8('0x3c')];_0x2e50db[_0xb2e8('0x3d')]=_0xa413aa[_0xb2e8('0x40')]['port'];_0x3fa47d[_0xb2e8('0x3c')]=_0xa413aa[_0xb2e8('0x41')][_0xb2e8('0x3c')];_0x3fa47d['port']=_0xa413aa['Smtp'][_0xb2e8('0x3d')];}return{'Imap':_0x2e50db,'Smtp':_0x3fa47d};}exports[_0xb2e8('0x42')]=function(_0xdf7ee8,_0x5b3aec){var _0x366e84={'include':[{'model':db[_0xb2e8('0x43')],'as':_0xb2e8('0x40')},{'model':db[_0xb2e8('0x44')],'as':_0xb2e8('0x41')},{'model':db[_0xb2e8('0x45')],'as':_0xb2e8('0x46')}]},_0xe2cc8f={},_0x4716a1={'count':0x0,'rows':[]};var _0x1fa69f=_[_0xb2e8('0x47')](db[_0xb2e8('0x48')][_0xb2e8('0x49')],function(_0x48798d){return{'name':_0x48798d[_0xb2e8('0x4a')],'type':_0x48798d[_0xb2e8('0x4b')]['key']};});_0xe2cc8f['model']=_[_0xb2e8('0x47')](_0x1fa69f,_0xb2e8('0x2c'));_0xe2cc8f[_0xb2e8('0x4c')]=_['keys'](_0xdf7ee8[_0xb2e8('0x4c')]);_0xe2cc8f[_0xb2e8('0x4d')]=_[_0xb2e8('0x4e')](_0xe2cc8f[_0xb2e8('0x4f')],_0xe2cc8f[_0xb2e8('0x4c')]);_0x366e84[_0xb2e8('0x50')]=_[_0xb2e8('0x4e')](_0xe2cc8f[_0xb2e8('0x4f')],qs[_0xb2e8('0x51')](_0xdf7ee8[_0xb2e8('0x4c')][_0xb2e8('0x51')]));_0x366e84['attributes']=_0x366e84[_0xb2e8('0x50')][_0xb2e8('0x52')]?_0x366e84[_0xb2e8('0x50')]:_0xe2cc8f[_0xb2e8('0x4f')];if(!_0xdf7ee8['query'][_0xb2e8('0x53')]('nolimit')){_0x366e84[_0xb2e8('0x22')]=qs[_0xb2e8('0x22')](_0xdf7ee8[_0xb2e8('0x4c')][_0xb2e8('0x22')]);_0x366e84[_0xb2e8('0x20')]=qs['offset'](_0xdf7ee8[_0xb2e8('0x4c')]['offset']);}_0x366e84[_0xb2e8('0x54')]=qs[_0xb2e8('0x55')](_0xdf7ee8[_0xb2e8('0x4c')][_0xb2e8('0x55')]);_0x366e84['where']=qs[_0xb2e8('0x4d')](_['pick'](_0xdf7ee8[_0xb2e8('0x4c')],_0xe2cc8f[_0xb2e8('0x4d')]),_0x1fa69f);if(_0xdf7ee8[_0xb2e8('0x4c')][_0xb2e8('0x56')]){_0x366e84[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0x366e84[_0xb2e8('0x57')],{'$or':_[_0xb2e8('0x47')](_0x1fa69f,function(_0x4a94fa){if(_0x4a94fa[_0xb2e8('0x4b')]!=='VIRTUAL'){var _0x2c58e5={};_0x2c58e5[_0x4a94fa[_0xb2e8('0x2c')]]={'$like':'%'+_0xdf7ee8[_0xb2e8('0x4c')]['filter']+'%'};return _0x2c58e5;}})});}_0x366e84=_['merge']({},_0x366e84,_0xdf7ee8[_0xb2e8('0x59')]);var _0x281c76={'where':_0x366e84[_0xb2e8('0x57')]};return db[_0xb2e8('0x48')][_0xb2e8('0x23')](_0x281c76)[_0xb2e8('0x26')](function(_0xfcacc3){_0x4716a1[_0xb2e8('0x23')]=_0xfcacc3;if(_0xdf7ee8['query'][_0xb2e8('0x5a')]){_0x366e84['include']=[{'all':!![]}];}return db[_0xb2e8('0x48')][_0xb2e8('0x5b')](_0x366e84);})[_0xb2e8('0x26')](function(_0x402730){_0x4716a1['rows']=_0x402730;return _0x4716a1;})['then'](respondWithFilteredResult(_0x5b3aec,_0x366e84))[_0xb2e8('0x1b')](handleError(_0x5b3aec,null));};exports[_0xb2e8('0x5c')]=function(_0x4a401f,_0x4fd62d){var _0x11a60e={'raw':![],'where':{'id':_0x4a401f[_0xb2e8('0x5d')]['id']},'include':[{'model':db[_0xb2e8('0x43')],'as':_0xb2e8('0x40')},{'model':db[_0xb2e8('0x44')],'as':_0xb2e8('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x492bb6={};_0x492bb6[_0xb2e8('0x4f')]=_['keys'](db[_0xb2e8('0x48')]['rawAttributes']);_0x492bb6[_0xb2e8('0x4c')]=_[_0xb2e8('0x5e')](_0x4a401f[_0xb2e8('0x4c')]);_0x492bb6[_0xb2e8('0x4d')]=_['intersection'](_0x492bb6[_0xb2e8('0x4f')],_0x492bb6[_0xb2e8('0x4c')]);_0x11a60e[_0xb2e8('0x50')]=_['intersection'](_0x492bb6[_0xb2e8('0x4f')],qs[_0xb2e8('0x51')](_0x4a401f[_0xb2e8('0x4c')][_0xb2e8('0x51')]));_0x11a60e[_0xb2e8('0x50')]=_0x11a60e[_0xb2e8('0x50')][_0xb2e8('0x52')]?_0x11a60e['attributes']:_0x492bb6[_0xb2e8('0x4f')];if(_0x4a401f[_0xb2e8('0x4c')][_0xb2e8('0x5a')]){_0x11a60e[_0xb2e8('0x5f')]=[{'all':!![]}];}_0x11a60e=_[_0xb2e8('0x58')]({},_0x11a60e,_0x4a401f['options']);return db['MailAccount']['find'](_0x11a60e)[_0xb2e8('0x26')](handleEntityNotFound(_0x4fd62d,null))['then'](respondWithResult(_0x4fd62d,null))[_0xb2e8('0x1b')](handleError(_0x4fd62d,null));};exports[_0xb2e8('0x25')]=function(_0x1b7304,_0x8089b7){if(_0x1b7304['body']['id']){delete _0x1b7304[_0xb2e8('0x60')]['id'];}var _0x59438c=_0x1b7304[_0xb2e8('0x60')][_0xb2e8('0x61')]===_0xb2e8('0x62')?null:_0x1b7304['body'][_0xb2e8('0x61')];var _0x2481e9=_0x1b7304[_0xb2e8('0x60')][_0xb2e8('0x40')]||{};var _0x54122a=_0x1b7304[_0xb2e8('0x60')][_0xb2e8('0x41')]||{};if(_0x59438c){_0x2481e9[_0xb2e8('0x3c')]=getImapHost(_0x59438c);_0x2481e9[_0xb2e8('0x3d')]=0x3e1;_0x54122a[_0xb2e8('0x3c')]=getSmtpHost(_0x59438c);_0x54122a[_0xb2e8('0x3d')]=0x24b;_0x54122a[_0xb2e8('0x63')]=![];}if(_0x54122a['modernAuthentication']){_0x54122a[_0xb2e8('0x63')]=![];}else{_0x54122a[_0xb2e8('0x3b')]=null;}if(!_0x2481e9[_0xb2e8('0x3a')])_0x2481e9['CloudProviderId']=null;_0x1b7304[_0xb2e8('0x60')][_0xb2e8('0x40')]=_0x2481e9;_0x1b7304[_0xb2e8('0x60')][_0xb2e8('0x41')]=_0x54122a;return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0x1b7304[_0xb2e8('0x5d')]['id']},'include':[{'model':db[_0xb2e8('0x43')],'as':_0xb2e8('0x40')},{'model':db[_0xb2e8('0x44')],'as':_0xb2e8('0x41')},{'model':db['Pause'],'as':_0xb2e8('0x46')}]})[_0xb2e8('0x26')](handleEntityNotFound(_0x8089b7,null))['then'](function(_0x3d75b4){if(!_0x3d75b4)throw new Error(_0xb2e8('0x65'));if(_0x3d75b4[_0xb2e8('0x3e')])delete _0x1b7304[_0xb2e8('0x60')]['Imap'];return _0x3d75b4;})[_0xb2e8('0x26')](saveUpdates(_0x1b7304[_0xb2e8('0x60')],null))[_0xb2e8('0x26')](function(_0x129789){if(!_0x1b7304['body']['Imap'])return _0x129789;return db[_0xb2e8('0x43')][_0xb2e8('0x25')](_0x1b7304[_0xb2e8('0x60')]['Imap'],{'where':{'MailAccountId':_0x129789['id']}})[_0xb2e8('0x26')](function(){return _0x129789;});})[_0xb2e8('0x26')](function(_0x29733c){if(!_0x1b7304[_0xb2e8('0x60')][_0xb2e8('0x41')])return _0x29733c;return db[_0xb2e8('0x44')][_0xb2e8('0x25')](_0x1b7304['body'][_0xb2e8('0x41')],{'where':{'MailAccountId':_0x29733c['id']}})[_0xb2e8('0x26')](function(){return _0x29733c;});})[_0xb2e8('0x26')](respondWithResult(_0x8089b7,null))['catch'](handleError(_0x8089b7,null));};exports[_0xb2e8('0x66')]=function(_0x4c4628,_0xe3ed1){return db[_0xb2e8('0x48')][_0xb2e8('0x66')]()[_0xb2e8('0x26')](respondWithResult(_0xe3ed1,null))['catch'](handleError(_0xe3ed1,null));};exports[_0xb2e8('0x67')]=function(_0x4c984b,_0x188ca4){if(_0x4c984b[_0xb2e8('0x60')]['id']){delete _0x4c984b['body']['id'];}return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0x4c984b['params']['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x188ca4,null))[_0xb2e8('0x26')](function(_0x24c07f){if(_0x24c07f){_0x4c984b[_0xb2e8('0x60')][_0xb2e8('0x68')]=_0x24c07f['id'];return db['Disposition'][_0xb2e8('0x69')](_0x4c984b[_0xb2e8('0x60')]);}})['then'](respondWithResult(_0x188ca4,null))['catch'](handleError(_0x188ca4,null));};exports[_0xb2e8('0x6a')]=function(_0x522209,_0x3c4e68){var _0xb2dfc7={'raw':![],'where':{}};var _0x9e388={};var _0x562ab3={'count':0x0,'rows':[]};return db['MailAccount'][_0xb2e8('0x6b')]({'where':{'id':_0x522209[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x3c4e68,null))[_0xb2e8('0x26')](function(_0x39606d){if(_0x39606d){_0x9e388[_0xb2e8('0x4f')]=_[_0xb2e8('0x5e')](db[_0xb2e8('0x6c')][_0xb2e8('0x49')]);_0x9e388[_0xb2e8('0x4c')]=_[_0xb2e8('0x5e')](_0x522209[_0xb2e8('0x4c')]);_0x9e388['filters']=_[_0xb2e8('0x4e')](_0x9e388[_0xb2e8('0x4f')],_0x9e388[_0xb2e8('0x4c')]);_0xb2dfc7[_0xb2e8('0x50')]=_[_0xb2e8('0x4e')](_0x9e388[_0xb2e8('0x4f')],qs['fields'](_0x522209[_0xb2e8('0x4c')]['fields']));_0xb2dfc7[_0xb2e8('0x50')]=_0xb2dfc7[_0xb2e8('0x50')]['length']?_0xb2dfc7['attributes']:_0x9e388[_0xb2e8('0x4f')];if(!_0x522209['query'][_0xb2e8('0x53')](_0xb2e8('0x6d'))){_0xb2dfc7[_0xb2e8('0x22')]=qs['limit'](_0x522209['query'][_0xb2e8('0x22')]);_0xb2dfc7[_0xb2e8('0x20')]=qs[_0xb2e8('0x20')](_0x522209['query'][_0xb2e8('0x20')]);}_0xb2dfc7[_0xb2e8('0x54')]=qs[_0xb2e8('0x55')](_0x522209[_0xb2e8('0x4c')][_0xb2e8('0x55')]);_0xb2dfc7[_0xb2e8('0x57')]=qs['filters'](_[_0xb2e8('0x6e')](_0x522209[_0xb2e8('0x4c')],_0x9e388['filters']));_0xb2dfc7[_0xb2e8('0x57')][_0xb2e8('0x68')]=_0x39606d['id'];if(_0x522209['query'][_0xb2e8('0x56')]){_0xb2dfc7[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0xb2dfc7['where'],{'$or':_[_0xb2e8('0x47')](_0xb2dfc7[_0xb2e8('0x50')],function(_0x494d6c){var _0x85bdb1={};_0x85bdb1[_0x494d6c]={'$like':'%'+_0x522209[_0xb2e8('0x4c')][_0xb2e8('0x56')]+'%'};return _0x85bdb1;})});}_0xb2dfc7=_[_0xb2e8('0x58')]({},_0xb2dfc7,_0x522209['options']);return db[_0xb2e8('0x6c')][_0xb2e8('0x23')]({'where':_0xb2dfc7[_0xb2e8('0x57')]})[_0xb2e8('0x26')](function(_0x48717a){_0x562ab3[_0xb2e8('0x23')]=_0x48717a;if(_0x522209[_0xb2e8('0x4c')]['includeAll']){_0xb2dfc7[_0xb2e8('0x5f')]=[{'all':!![]}];}return db[_0xb2e8('0x6c')][_0xb2e8('0x5b')](_0xb2dfc7);})[_0xb2e8('0x26')](function(_0x3befe8){_0x562ab3[_0xb2e8('0x6f')]=_0x3befe8;return _0x562ab3;});}})[_0xb2e8('0x26')](respondWithFilteredResult(_0x3c4e68,_0xb2dfc7))['catch'](handleError(_0x3c4e68,null));};exports[_0xb2e8('0x70')]=function(_0x1b2b56,_0x3f0d37){return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0x1b2b56[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x3f0d37,null))[_0xb2e8('0x26')](function(_0x564110){if(_0x564110){return _0x564110['removeDispositions'](_0x1b2b56[_0xb2e8('0x4c')][_0xb2e8('0x71')]);}})[_0xb2e8('0x26')](respondWithStatusCode(_0x3f0d37,null))[_0xb2e8('0x1b')](handleError(_0x3f0d37,null));};exports[_0xb2e8('0x72')]=function(_0x541773,_0x2a9fbc){if(_0x541773['body']['id']){delete _0x541773[_0xb2e8('0x60')]['id'];}return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0x541773[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x2a9fbc,null))['then'](function(_0x2377a1){if(_0x2377a1){_0x541773[_0xb2e8('0x60')][_0xb2e8('0x68')]=_0x2377a1['id'];return db[_0xb2e8('0x73')][_0xb2e8('0x69')](_0x541773[_0xb2e8('0x60')]);}})[_0xb2e8('0x26')](respondWithResult(_0x2a9fbc,null))[_0xb2e8('0x1b')](handleError(_0x2a9fbc,null));};exports[_0xb2e8('0x74')]=function(_0x2d893f,_0x23735d){var _0x44e3e5={'raw':![],'where':{}};var _0x334fc0={};var _0x500395={'count':0x0,'rows':[]};return db['MailAccount'][_0xb2e8('0x6b')]({'where':{'id':_0x2d893f[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x23735d,null))[_0xb2e8('0x26')](function(_0x54d12e){if(_0x54d12e){_0x334fc0[_0xb2e8('0x4f')]=_[_0xb2e8('0x5e')](db[_0xb2e8('0x73')][_0xb2e8('0x49')]);_0x334fc0['query']=_[_0xb2e8('0x5e')](_0x2d893f['query']);_0x334fc0[_0xb2e8('0x4d')]=_[_0xb2e8('0x4e')](_0x334fc0[_0xb2e8('0x4f')],_0x334fc0[_0xb2e8('0x4c')]);_0x44e3e5[_0xb2e8('0x50')]=_[_0xb2e8('0x4e')](_0x334fc0[_0xb2e8('0x4f')],qs[_0xb2e8('0x51')](_0x2d893f['query'][_0xb2e8('0x51')]));_0x44e3e5['attributes']=_0x44e3e5['attributes'][_0xb2e8('0x52')]?_0x44e3e5[_0xb2e8('0x50')]:_0x334fc0[_0xb2e8('0x4f')];if(!_0x2d893f['query']['hasOwnProperty'](_0xb2e8('0x6d'))){_0x44e3e5[_0xb2e8('0x22')]=qs[_0xb2e8('0x22')](_0x2d893f['query'][_0xb2e8('0x22')]);_0x44e3e5['offset']=qs[_0xb2e8('0x20')](_0x2d893f[_0xb2e8('0x4c')][_0xb2e8('0x20')]);}_0x44e3e5[_0xb2e8('0x54')]=qs[_0xb2e8('0x55')](_0x2d893f['query']['sort']);_0x44e3e5[_0xb2e8('0x57')]=qs[_0xb2e8('0x4d')](_['pick'](_0x2d893f['query'],_0x334fc0[_0xb2e8('0x4d')]));_0x44e3e5[_0xb2e8('0x57')][_0xb2e8('0x68')]=_0x54d12e['id'];if(_0x2d893f['query']['filter']){_0x44e3e5[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0x44e3e5[_0xb2e8('0x57')],{'$or':_[_0xb2e8('0x47')](_0x44e3e5[_0xb2e8('0x50')],function(_0x1be49f){var _0x14354c={};_0x14354c[_0x1be49f]={'$like':'%'+_0x2d893f[_0xb2e8('0x4c')][_0xb2e8('0x56')]+'%'};return _0x14354c;})});}_0x44e3e5=_['merge']({},_0x44e3e5,_0x2d893f[_0xb2e8('0x59')]);return db['CannedAnswer'][_0xb2e8('0x23')]({'where':_0x44e3e5[_0xb2e8('0x57')]})[_0xb2e8('0x26')](function(_0x2f0945){_0x500395['count']=_0x2f0945;if(_0x2d893f[_0xb2e8('0x4c')][_0xb2e8('0x5a')]){_0x44e3e5[_0xb2e8('0x5f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb2e8('0x5b')](_0x44e3e5);})[_0xb2e8('0x26')](function(_0x621472){_0x500395[_0xb2e8('0x6f')]=_0x621472;return _0x500395;});}})[_0xb2e8('0x26')](respondWithFilteredResult(_0x23735d,_0x44e3e5))[_0xb2e8('0x1b')](handleError(_0x23735d,null));};exports['removeAnswers']=function(_0x26c04a,_0x473163){return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0x26c04a[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x473163,null))['then'](function(_0x5e2930){if(_0x5e2930){return _0x5e2930[_0xb2e8('0x75')](_0x26c04a[_0xb2e8('0x4c')][_0xb2e8('0x71')]);}})[_0xb2e8('0x26')](respondWithStatusCode(_0x473163,null))[_0xb2e8('0x1b')](handleError(_0x473163,null));};exports['create']=function(_0x12e4d0,_0x28e712){var _0x5b1fac={'name':_0x12e4d0[_0xb2e8('0x60')][_0xb2e8('0x2c')],'key':_0x12e4d0[_0xb2e8('0x60')]['key'],'provider':_0x12e4d0[_0xb2e8('0x60')]['provider']===_0xb2e8('0x62')?null:_0x12e4d0['body']['provider'],'email':_0x12e4d0['body'][_0xb2e8('0x76')],'ListId':_0x12e4d0[_0xb2e8('0x60')][_0xb2e8('0x77')],'active':!_[_0xb2e8('0x78')](_0x12e4d0['body'][_0xb2e8('0x79')])?_0x12e4d0[_0xb2e8('0x60')][_0xb2e8('0x79')]:!![],'description':_0x12e4d0[_0xb2e8('0x60')][_0xb2e8('0x7a')]||null};var _0x57b938=getAuthenticationOptions(_0x5b1fac[_0xb2e8('0x61')],_0x12e4d0[_0xb2e8('0x60')]);_0x5b1fac[_0xb2e8('0x40')]=_0x57b938[_0xb2e8('0x40')];_0x5b1fac[_0xb2e8('0x41')]=_0x57b938[_0xb2e8('0x41')];return db[_0xb2e8('0x48')]['create'](_0x5b1fac,{'include':[{'model':db[_0xb2e8('0x44')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xb2e8('0x40')}]})[_0xb2e8('0x26')](function(_0x3dea0b){var _0x3865f5=_0x12e4d0[_0xb2e8('0x37')][_0xb2e8('0x27')]({'plain':!![]});if(!_0x3865f5)throw new Error(_0xb2e8('0x7b'));if(_0x3865f5['role']===_0xb2e8('0x37')){var _0x39cb2c=_0x3dea0b['get']({'plain':!![]});return db[_0xb2e8('0x7c')][_0xb2e8('0x64')]({'where':{'name':'MailAccounts','userProfileId':_0x3865f5['userProfileId']},'raw':!![]})[_0xb2e8('0x26')](function(_0x5550fa){if(_0x5550fa&&_0x5550fa[_0xb2e8('0x7d')]===0x0){return db[_0xb2e8('0x29')][_0xb2e8('0x69')]({'name':_0x39cb2c[_0xb2e8('0x2c')],'resourceId':_0x39cb2c['id'],'type':_0x5550fa[_0xb2e8('0x2c')],'sectionId':_0x5550fa['id']},{})[_0xb2e8('0x26')](function(){return _0x3dea0b;});}else{return _0x3dea0b;}})[_0xb2e8('0x1b')](function(_0x4788b8){logger[_0xb2e8('0x17')](_0xb2e8('0x7e'),_0x4788b8);throw _0x4788b8;});}return _0x3dea0b;})['then'](respondWithResult(_0x28e712,0xc9))[_0xb2e8('0x1b')](handleError(_0x28e712,null));};exports['getImap']=function(_0xfb984a,_0x1e068f){return db[_0xb2e8('0x48')][_0xb2e8('0x6b')]({'where':{'id':_0xfb984a[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x1e068f,null))[_0xb2e8('0x26')](function(_0x51932e){if(_0x51932e){return _0x51932e[_0xb2e8('0x7f')]();}return null;})['then'](respondWithResult(_0x1e068f,null))[_0xb2e8('0x1b')](handleError(_0x1e068f,null));};exports['addImap']=function(_0x466dbd,_0x5b6dbf){if(_0x466dbd[_0xb2e8('0x60')]['id']){delete _0x466dbd[_0xb2e8('0x60')]['id'];}return db['MailAccount'][_0xb2e8('0x64')]({'where':{'id':_0x466dbd[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x5b6dbf,null))['then'](function(_0x146f22){if(_0x146f22){_0x466dbd['body'][_0xb2e8('0x68')]=_0x146f22['id'];return db['MailServerIn']['create'](_0x466dbd[_0xb2e8('0x60')]);}})[_0xb2e8('0x26')](respondWithResult(_0x5b6dbf,null))[_0xb2e8('0x1b')](handleError(_0x5b6dbf,null));};exports['removeImap']=function(_0xa9adfc,_0x175a86){return db['MailAccount'][_0xb2e8('0x6b')]({'where':{'id':_0xa9adfc[_0xb2e8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x175a86,null))['then'](function(_0x4a5e87){if(_0x4a5e87){return _0x4a5e87[_0xb2e8('0x80')](null);}return null;})[_0xb2e8('0x26')](respondWithStatusCode(_0x175a86,null))[_0xb2e8('0x1b')](handleError(_0x175a86,null));};exports[_0xb2e8('0x81')]=function(_0x38aed8,_0x51b203){return db['MailAccount'][_0xb2e8('0x6b')]({'where':{'id':_0x38aed8['params']['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x51b203,null))[_0xb2e8('0x26')](function(_0x77e911){if(_0x77e911){return _0x77e911[_0xb2e8('0x81')]();}return null;})['then'](respondWithResult(_0x51b203,null))[_0xb2e8('0x1b')](handleError(_0x51b203,null));};exports[_0xb2e8('0x82')]=function(_0xf7d1a7,_0x3e56c6){if(_0xf7d1a7[_0xb2e8('0x60')]['id']){delete _0xf7d1a7[_0xb2e8('0x60')]['id'];}return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0xf7d1a7[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x3e56c6,null))[_0xb2e8('0x26')](function(_0x16dd94){if(_0x16dd94){_0xf7d1a7[_0xb2e8('0x60')][_0xb2e8('0x68')]=_0x16dd94['id'];return db['MailServerOut'][_0xb2e8('0x69')](_0xf7d1a7['body']);}})[_0xb2e8('0x26')](respondWithResult(_0x3e56c6,null))['catch'](handleError(_0x3e56c6,null));};exports[_0xb2e8('0x83')]=function(_0xd3918,_0x1b8bd0){return db[_0xb2e8('0x48')]['findOne']({'where':{'id':_0xd3918[_0xb2e8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1b8bd0,null))[_0xb2e8('0x26')](function(_0x286d05){if(_0x286d05){return _0x286d05[_0xb2e8('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x1b8bd0,null))[_0xb2e8('0x1b')](handleError(_0x1b8bd0,null));};exports[_0xb2e8('0x85')]=function(_0x357534,_0x4b2e11){return db['MailInteraction']['find']({'where':{'id':_0x357534[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x4b2e11,null))['then'](function(_0x3e946c){if(_0x3e946c){return _0x3e946c['addInteraction'](_0x357534[_0xb2e8('0x60')][_0xb2e8('0x71')],_[_0xb2e8('0x86')](_0x357534[_0xb2e8('0x60')],[_0xb2e8('0x71'),'id'])||{});}})[_0xb2e8('0x26')](respondWithResult(_0x4b2e11,null))[_0xb2e8('0x1b')](handleError(_0x4b2e11,null));};exports[_0xb2e8('0x87')]=function(_0x585541,_0x3c44b9){var _0x4af9c0={'raw':![],'where':{}};var _0x5686ec={};var _0x5c4231={'count':0x0,'rows':[]};return db[_0xb2e8('0x48')]['findOne']({'where':{'id':_0x585541[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x3c44b9,null))[_0xb2e8('0x26')](function(_0x2764ec){if(_0x2764ec){_0x5686ec[_0xb2e8('0x4f')]=_[_0xb2e8('0x5e')](db[_0xb2e8('0x88')][_0xb2e8('0x49')]);_0x5686ec[_0xb2e8('0x4c')]=_[_0xb2e8('0x5e')](_0x585541['query']);_0x5686ec['filters']=_[_0xb2e8('0x4e')](_0x5686ec[_0xb2e8('0x4f')],_0x5686ec[_0xb2e8('0x4c')]);_0x4af9c0[_0xb2e8('0x50')]=_[_0xb2e8('0x4e')](_0x5686ec['model'],qs['fields'](_0x585541['query']['fields']));_0x4af9c0['attributes']=_0x4af9c0[_0xb2e8('0x50')][_0xb2e8('0x52')]?_0x4af9c0['attributes']:_0x5686ec[_0xb2e8('0x4f')];if(!_0x585541[_0xb2e8('0x4c')][_0xb2e8('0x53')](_0xb2e8('0x6d'))){_0x4af9c0[_0xb2e8('0x22')]=qs[_0xb2e8('0x22')](_0x585541[_0xb2e8('0x4c')][_0xb2e8('0x22')]);_0x4af9c0[_0xb2e8('0x20')]=qs[_0xb2e8('0x20')](_0x585541['query']['offset']);}_0x4af9c0[_0xb2e8('0x54')]=qs['sort'](_0x585541['query'][_0xb2e8('0x55')]);_0x4af9c0[_0xb2e8('0x57')]=qs[_0xb2e8('0x4d')](_[_0xb2e8('0x6e')](_0x585541[_0xb2e8('0x4c')],_0x5686ec[_0xb2e8('0x4d')]));_0x4af9c0['where'][_0xb2e8('0x68')]=_0x2764ec['id'];if(_0x585541[_0xb2e8('0x4c')]['filter']){_0x4af9c0[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0x4af9c0[_0xb2e8('0x57')],{'$or':_[_0xb2e8('0x47')](_0x4af9c0['attributes'],function(_0x5ccdd6){var _0x291d06={};_0x291d06[_0x5ccdd6]={'$like':'%'+_0x585541[_0xb2e8('0x4c')][_0xb2e8('0x56')]+'%'};return _0x291d06;})});}_0x4af9c0=_[_0xb2e8('0x58')]({},_0x4af9c0,_0x585541['options']);return db[_0xb2e8('0x88')][_0xb2e8('0x23')]({'where':_0x4af9c0[_0xb2e8('0x57')]})[_0xb2e8('0x26')](function(_0x292a9d){_0x5c4231[_0xb2e8('0x23')]=_0x292a9d;if(_0x585541[_0xb2e8('0x4c')][_0xb2e8('0x5a')]){_0x4af9c0[_0xb2e8('0x5f')]=[{'model':db[_0xb2e8('0x89')],'as':'Contact','required':![]},{'model':db[_0xb2e8('0x8a')],'as':'Owner','attributes':[_0xb2e8('0x2c'),_0xb2e8('0x8b'),_0xb2e8('0x8c')],'required':![]},{'model':db[_0xb2e8('0x8d')],'as':'Tags','attributes':['id',_0xb2e8('0x2c'),_0xb2e8('0x8e')],'where':_0x585541[_0xb2e8('0x4c')]['tag']?{'id':_0x585541[_0xb2e8('0x4c')]['tag']}:undefined,'required':_0x585541['query'][_0xb2e8('0x8f')]?!![]:![]}];}return db['MailInteraction'][_0xb2e8('0x5b')](_0x4af9c0);})['then'](function(_0x1902ee){_0x5c4231[_0xb2e8('0x6f')]=_0x1902ee;return _0x5c4231;});}})[_0xb2e8('0x26')](respondWithFilteredResult(_0x3c44b9,_0x4af9c0))[_0xb2e8('0x1b')](handleError(_0x3c44b9,null));};exports['addApplications']=function addApplications(_0x21acec,_0x5705b5){var _0x4721bb=_0x21acec['params']['id'];var _0x3e413c=_0x21acec[_0xb2e8('0x60')];var _0x1011a2=0xc8;var _0xa306ee=null;return db[_0xb2e8('0x90')][_0xb2e8('0x91')]({'isolationLevel':db[_0xb2e8('0x90')][_0xb2e8('0x92')][_0xb2e8('0x93')][_0xb2e8('0x94')]},function(_0x1ac01a){return db[_0xb2e8('0x48')][_0xb2e8('0x6b')]({'where':{'id':_0x4721bb},'transaction':_0x1ac01a})[_0xb2e8('0x26')](function(_0x3f4323){if(_0x3f4323){return db[_0xb2e8('0x95')][_0xb2e8('0x2a')]({'where':{'MailAccountId':_0x4721bb},'transaction':_0x1ac01a})[_0xb2e8('0x26')](function(){var _0x3590c3=_[_0xb2e8('0x47')](_0x3e413c,function(_0x4f2409){_0x4f2409[_0xb2e8('0x68')]=_0x4721bb;return _0x4f2409;});return db['MailApplication']['bulkCreate'](_0x3590c3,{'transaction':_0x1ac01a});});}else{_0x1011a2=0x194;_0xa306ee=[];}});})[_0xb2e8('0x26')](function(){if(_0x1011a2!==0x194){return db[_0xb2e8('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x4721bb},'order':'priority'})[_0xb2e8('0x26')](function(_0x1438b9){_0xa306ee=_0x1438b9;});}})[_0xb2e8('0x1b')](function(_0x465c97){_0x1011a2=0x1f4;logger[_0xb2e8('0x17')](_0x465c97['stack']);if(_0x465c97['name']){delete _0x465c97[_0xb2e8('0x2c')];}_0xa306ee=_0x465c97;})[_0xb2e8('0x96')](function(){if(_0xa306ee===null){_0x5705b5[_0xb2e8('0x1c')](_0x1011a2);}else{if(_0x1011a2===0x1f4){_0x5705b5['status'](_0x1011a2)['send'](_0xa306ee);}else{_0x5705b5[_0xb2e8('0x1d')](_0x1011a2)[_0xb2e8('0x1f')](_0xa306ee);}}});};exports[_0xb2e8('0x97')]=function(_0x5e3287,_0x5adcb6){var _0x1e56c3={};var _0x52887e={};var _0x5e73e8;var _0x517167;return db[_0xb2e8('0x48')]['findOne']({'where':{'id':_0x5e3287[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x5adcb6,null))['then'](function(_0x209d75){if(_0x209d75){_0x5e73e8=_0x209d75;_0x52887e[_0xb2e8('0x4f')]=_[_0xb2e8('0x5e')](db[_0xb2e8('0x95')][_0xb2e8('0x49')]);_0x52887e[_0xb2e8('0x4c')]=_[_0xb2e8('0x5e')](_0x5e3287['query']);_0x52887e['filters']=_[_0xb2e8('0x4e')](_0x52887e[_0xb2e8('0x4f')],_0x52887e[_0xb2e8('0x4c')]);_0x1e56c3[_0xb2e8('0x50')]=_['intersection'](_0x52887e[_0xb2e8('0x4f')],qs[_0xb2e8('0x51')](_0x5e3287[_0xb2e8('0x4c')][_0xb2e8('0x51')]));_0x1e56c3['attributes']=_0x1e56c3[_0xb2e8('0x50')][_0xb2e8('0x52')]?_0x1e56c3['attributes']:_0x52887e[_0xb2e8('0x4f')];_0x1e56c3[_0xb2e8('0x54')]=qs['sort'](_0x5e3287[_0xb2e8('0x4c')][_0xb2e8('0x55')]);_0x1e56c3['where']=qs['filters'](_[_0xb2e8('0x6e')](_0x5e3287[_0xb2e8('0x4c')],_0x52887e[_0xb2e8('0x4d')]));if(_0x5e3287['query'][_0xb2e8('0x56')]){_0x1e56c3[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0x1e56c3['where'],{'$or':_['map'](_0x1e56c3[_0xb2e8('0x50')],function(_0x48caea){var _0x30cc18={};_0x30cc18[_0x48caea]={'$like':'%'+_0x5e3287[_0xb2e8('0x4c')][_0xb2e8('0x56')]+'%'};return _0x30cc18;})});}_0x1e56c3=_['merge']({},_0x1e56c3,_0x5e3287[_0xb2e8('0x59')]);return _0x5e73e8[_0xb2e8('0x97')](_0x1e56c3);}})[_0xb2e8('0x26')](function(_0x1c818f){if(_0x1c818f){_0x517167=_0x1c818f[_0xb2e8('0x52')];if(!_0x5e3287['query'][_0xb2e8('0x53')](_0xb2e8('0x6d'))){_0x1e56c3[_0xb2e8('0x22')]=qs[_0xb2e8('0x22')](_0x5e3287[_0xb2e8('0x4c')][_0xb2e8('0x22')]);_0x1e56c3[_0xb2e8('0x20')]=qs[_0xb2e8('0x20')](_0x5e3287[_0xb2e8('0x4c')][_0xb2e8('0x20')]);}return _0x5e73e8[_0xb2e8('0x97')](_0x1e56c3);}})['then'](function(_0x4a4478){if(_0x4a4478){return _0x4a4478?{'count':_0x517167,'rows':_0x4a4478}:null;}})['then'](respondWithResult(_0x5adcb6,null))[_0xb2e8('0x1b')](handleError(_0x5adcb6,null));};exports[_0xb2e8('0x98')]=function(_0x2dc4bf,_0x129110){var _0x16667c={'raw':!![],'where':{}};var _0x281345={};var _0xaadbe={'count':0x0,'rows':[]};return db[_0xb2e8('0x48')][_0xb2e8('0x6b')]({'where':{'id':_0x2dc4bf['params']['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x129110,null))[_0xb2e8('0x26')](function(_0x853f7d){if(_0x853f7d){_0x281345[_0xb2e8('0x4f')]=_[_0xb2e8('0x5e')](db[_0xb2e8('0x99')]['rawAttributes']);_0x281345[_0xb2e8('0x4c')]=_[_0xb2e8('0x5e')](_0x2dc4bf[_0xb2e8('0x4c')]);_0x281345[_0xb2e8('0x4d')]=_[_0xb2e8('0x4e')](_0x281345[_0xb2e8('0x4f')],_0x281345[_0xb2e8('0x4c')]);_0x16667c[_0xb2e8('0x50')]=_['intersection'](_0x281345[_0xb2e8('0x4f')],qs[_0xb2e8('0x51')](_0x2dc4bf['query'][_0xb2e8('0x51')]));_0x16667c[_0xb2e8('0x50')]=_0x16667c['attributes'][_0xb2e8('0x52')]?_0x16667c[_0xb2e8('0x50')]:_0x281345[_0xb2e8('0x4f')];if(!_0x2dc4bf[_0xb2e8('0x4c')][_0xb2e8('0x53')](_0xb2e8('0x6d'))){_0x16667c[_0xb2e8('0x22')]=qs[_0xb2e8('0x22')](_0x2dc4bf['query'][_0xb2e8('0x22')]);_0x16667c[_0xb2e8('0x20')]=qs[_0xb2e8('0x20')](_0x2dc4bf[_0xb2e8('0x4c')][_0xb2e8('0x20')]);}_0x16667c[_0xb2e8('0x54')]=qs[_0xb2e8('0x55')](_0x2dc4bf[_0xb2e8('0x4c')][_0xb2e8('0x55')]);_0x16667c[_0xb2e8('0x57')]=qs['filters'](_[_0xb2e8('0x6e')](_0x2dc4bf['query'],_0x281345[_0xb2e8('0x4d')]));_0x16667c[_0xb2e8('0x57')][_0xb2e8('0x68')]=_0x853f7d['id'];if(_0x2dc4bf[_0xb2e8('0x4c')][_0xb2e8('0x56')]){_0x16667c[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0x16667c[_0xb2e8('0x57')],{'$or':_[_0xb2e8('0x47')](_0x16667c[_0xb2e8('0x50')],function(_0x1260a1){var _0x4fadd5={};_0x4fadd5[_0x1260a1]={'$like':'%'+_0x2dc4bf['query'][_0xb2e8('0x56')]+'%'};return _0x4fadd5;})});}if(_0x2dc4bf[_0xb2e8('0x4c')]['$gte']){var _0x2754fe=_0x2dc4bf[_0xb2e8('0x4c')][_0xb2e8('0x9a')][_0xb2e8('0x9b')](',');var _0x3a53b7={};_0x3a53b7[_0x2754fe[0x0]]={'$gte':moment(_0x2754fe[0x1])[_0xb2e8('0x9c')](_0xb2e8('0x9d'))};_0x16667c[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0x16667c['where'],_0x3a53b7);}_0x16667c=_['merge']({},_0x16667c,_0x2dc4bf[_0xb2e8('0x59')]);return db[_0xb2e8('0x99')]['count']({'where':_0x16667c[_0xb2e8('0x57')]})[_0xb2e8('0x26')](function(_0x4e9ad9){_0xaadbe[_0xb2e8('0x23')]=_0x4e9ad9;if(_0x2dc4bf[_0xb2e8('0x4c')][_0xb2e8('0x5a')]){_0x16667c[_0xb2e8('0x5f')]=[{'all':!![]}];}return db[_0xb2e8('0x99')]['findAll'](_0x16667c);})['then'](function(_0x19ca6e){if(_0x2dc4bf['query'][_0xb2e8('0x9e')]===_0xb2e8('0x9f')){for(var _0x439adc=0x0;_0x439adc<_0x19ca6e['length'];_0x439adc++){_0x19ca6e[_0x439adc]['body']=juice(_0x19ca6e[_0x439adc]['body']);}}_0xaadbe[_0xb2e8('0x6f')]=_0x19ca6e;return _0xaadbe;});}})[_0xb2e8('0x26')](respondWithFilteredResult(_0x129110,_0x16667c))['catch'](handleError(_0x129110,null));};exports[_0xb2e8('0xa0')]=function(_0xe2aa73,_0x2cf898){var _0x1efd71,_0x552e8e={},_0x199424;if(_0xe2aa73[_0xb2e8('0x60')]['to']){_0x199424=_0xe2aa73['body']['to'][_0xb2e8('0x9b')](',')[0x0];}return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0xe2aa73[_0xb2e8('0x5d')]['id']},'include':[{'model':db[_0xb2e8('0xa1')],'as':'List','include':[{'model':db[_0xb2e8('0x89')],'as':_0xb2e8('0xa2'),'where':{'email':_0x199424},'limit':0x1,'order':[[_0xb2e8('0xa3'),_0xb2e8('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0xb2e8('0x41'),'raw':!![],'include':[{'model':db[_0xb2e8('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0xb2e8('0x26')](handleEntityNotFound(_0x2cf898,null))['then'](function(_0x20a190){if(!_0x20a190)return;_0x1efd71=_0x20a190;if(!_0x20a190[_0xb2e8('0x41')])throw new Error(_0xb2e8('0xa6'));if(_['isNil'](_0xe2aa73[_0xb2e8('0x60')][_0xb2e8('0xa7')])){_0xe2aa73[_0xb2e8('0x60')][_0xb2e8('0xa7')]=util[_0xb2e8('0x9c')](_0xb2e8('0xa8'),_0x20a190[_0xb2e8('0x2c')],_0x20a190[_0xb2e8('0x76')]||_0x20a190[_0xb2e8('0x41')][_0xb2e8('0x37')]);}if(_0xe2aa73['body'][_0xb2e8('0xa9')]&&_0xe2aa73['body'][_0xb2e8('0xa9')][_0xb2e8('0x52')]){for(var _0x494dfa=0x0;_0x494dfa<_0xe2aa73[_0xb2e8('0x60')][_0xb2e8('0xa9')][_0xb2e8('0x52')];_0x494dfa+=0x1){_0xe2aa73['body'][_0xb2e8('0xa9')][_0x494dfa]={'filename':_0xe2aa73[_0xb2e8('0x60')][_0xb2e8('0xa9')][_0x494dfa]['name'],'path':path['join'](config[_0xb2e8('0xaa')],_0xb2e8('0xab'),_0xe2aa73[_0xb2e8('0x60')]['attachments'][_0x494dfa][_0xb2e8('0xac')])};}}var _0x1d7649=_0x20a190['getSmtpOptions']();return respondWithRpcPromise(_0xb2e8('0xad'),_0xb2e8('0xae'),{'account':_0x1d7649,'message':_0xe2aa73[_0xb2e8('0x60')]});})[_0xb2e8('0x26')](function(_0x7290c){if(!_0x7290c)return;_0x552e8e=_0x7290c;if(!_0x1efd71[_0xb2e8('0xaf')])throw new Error(_0xb2e8('0xb0'));if(_0x1efd71[_0xb2e8('0xaf')]['Contacts'][_0xb2e8('0x52')])return _0x1efd71[_0xb2e8('0xaf')]['Contacts'][0x0];return db['CmContact'][_0xb2e8('0x69')](_[_0xb2e8('0xa')](_0xe2aa73[_0xb2e8('0x60')],{'firstName':_0xe2aa73[_0xb2e8('0x60')]['to'],'email':_0xe2aa73['body']['to'],'phone':_0xe2aa73[_0xb2e8('0x60')]['to'],'ListId':_0x1efd71[_0xb2e8('0x77')]}));})[_0xb2e8('0x26')](function(_0x2ba264){if(!_0x2ba264)return;var _0x27d3bf={'UserId':_0xe2aa73[_0xb2e8('0x37')]['id'],'ContactId':_0x2ba264['id'],'MailAccountId':_0x1efd71['id'],'inReplyTo':_0x552e8e[_0xb2e8('0xb1')],'to':_0xe2aa73['body']['from'],'cc':_0xe2aa73[_0xb2e8('0x60')]['cc'],'subject':_0xe2aa73[_0xb2e8('0x60')][_0xb2e8('0xb2')],'attach':_0xe2aa73[_0xb2e8('0x60')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb2e8('0x9c')](_0xb2e8('0x9d')),'lastMsgDirection':'out','Messages':[_[_0xb2e8('0x58')](_0xe2aa73[_0xb2e8('0x60')],{'messageId':_0x552e8e[_0xb2e8('0xb1')],'sentAt':moment()[_0xb2e8('0x9c')](_0xb2e8('0x9d')),'read':!![],'MailAccountId':_0x1efd71['id'],'UserId':_0xe2aa73['user']['id'],'ContactId':_0x2ba264['id']})]};if(_0xe2aa73[_0xb2e8('0x60')][_0xb2e8('0xb3')]){_0x27d3bf=_[_0xb2e8('0x58')](_0x27d3bf,_0xe2aa73[_0xb2e8('0x60')]['Interaction']);}return db[_0xb2e8('0x88')][_0xb2e8('0x69')](_0x27d3bf,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})['then'](respondWithResult(_0x2cf898,null))[_0xb2e8('0x1b')](handleError(_0x2cf898,null));};exports['verifySmtp']=function(_0x4e52b1,_0x36b678){return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0x4e52b1[_0xb2e8('0x5d')]['id']},'include':[{'model':db[_0xb2e8('0x44')],'as':_0xb2e8('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xb2e8('0x26')](handleEntityNotFound(_0x36b678,null))[_0xb2e8('0x26')](function(_0x31d637){if(!_0x31d637['Smtp'])return;var _0x2ad8e2=_0x31d637[_0xb2e8('0xb4')]();return respondWithRpcPromise(_0xb2e8('0xb5'),_0xb2e8('0xb6'),{'account':_0x2ad8e2});})[_0xb2e8('0x26')](respondWithResult(_0x36b678,null))['catch'](handleError(_0x36b678,null));};exports[_0xb2e8('0x2a')]=function(_0xe54a5e,_0xee7ffa){return db[_0xb2e8('0x48')]['find']({'where':{'id':_0xe54a5e[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0xee7ffa,null))[_0xb2e8('0x26')](function(_0x3e3791){if(_0x3e3791&&_0x3e3791[_0xb2e8('0x3e')]){throw new db[(_0xb2e8('0xb7'))][(_0xb2e8('0xb8'))](_0xb2e8('0xb9'));}return _0x3e3791;})[_0xb2e8('0x26')](removeEntity(_0xee7ffa,null))[_0xb2e8('0x1b')](handleError(_0xee7ffa,null));};exports[_0xb2e8('0xba')]=function(_0x93b364,_0x56af96){return db['MailAccount']['find']({'where':{'id':_0x93b364[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x56af96,null))[_0xb2e8('0x26')](function(_0x31e2d0){if(_0x31e2d0){return _0x31e2d0[_0xb2e8('0xba')](_0x93b364[_0xb2e8('0x60')][_0xb2e8('0x71')],_[_0xb2e8('0x86')](_0x93b364[_0xb2e8('0x60')],['ids','id'])||{})['spread'](function(_0xbfe8f9){for(var _0x3b59da=0x0;_0x3b59da<_0x93b364['body'][_0xb2e8('0x71')]['length'];_0x3b59da+=0x1){socket[_0xb2e8('0xbb')](_0xb2e8('0xbc'),{'UserId':Number(_0x93b364['body'][_0xb2e8('0x71')][_0x3b59da]),'MailAccountId':Number(_0x93b364['params']['id'])});}return _0xbfe8f9;});}})[_0xb2e8('0x26')](respondWithResult(_0x56af96,null))[_0xb2e8('0x1b')](handleError(_0x56af96,null));};exports[_0xb2e8('0xbd')]=function(_0x13d94b,_0x3fa032){return db[_0xb2e8('0x48')][_0xb2e8('0x64')]({'where':{'id':_0x13d94b[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x3fa032,null))[_0xb2e8('0x26')](function(_0x5a6c61){if(_0x5a6c61){return _0x5a6c61['removeAgents'](_0x13d94b[_0xb2e8('0x4c')]['ids'])[_0xb2e8('0x26')](function(){if(_[_0xb2e8('0xbe')](_0x13d94b[_0xb2e8('0x4c')][_0xb2e8('0x71')])){for(var _0x1873c3=0x0;_0x1873c3<_0x13d94b['query'][_0xb2e8('0x71')]['length'];_0x1873c3+=0x1){socket[_0xb2e8('0xbb')](_0xb2e8('0xbf'),{'UserId':Number(_0x13d94b['query'][_0xb2e8('0x71')][_0x1873c3]),'MailAccountId':Number(_0x13d94b[_0xb2e8('0x5d')]['id'])});}}else{socket[_0xb2e8('0xbb')](_0xb2e8('0xbf'),{'UserId':Number(_0x13d94b[_0xb2e8('0x4c')][_0xb2e8('0x71')]),'MailAccountId':Number(_0x13d94b[_0xb2e8('0x5d')]['id'])});}});}})[_0xb2e8('0x26')](respondWithStatusCode(_0x3fa032,null))[_0xb2e8('0x1b')](handleError(_0x3fa032,null));};exports['getAgents']=function(_0x4aa5ec,_0x58dc8a){var _0x207983={};var _0x4be69d={};var _0x5c5294;var _0x3854d6;return db[_0xb2e8('0x48')][_0xb2e8('0x6b')]({'where':{'id':_0x4aa5ec[_0xb2e8('0x5d')]['id']}})[_0xb2e8('0x26')](handleEntityNotFound(_0x58dc8a,null))[_0xb2e8('0x26')](function(_0x165af7){if(_0x165af7){_0x5c5294=_0x165af7;_0x4be69d[_0xb2e8('0x4f')]=_[_0xb2e8('0x5e')](db[_0xb2e8('0x8a')]['rawAttributes']);_0x4be69d[_0xb2e8('0x4c')]=_['keys'](_0x4aa5ec[_0xb2e8('0x4c')]);_0x4be69d['filters']=_[_0xb2e8('0x4e')](_0x4be69d[_0xb2e8('0x4f')],_0x4be69d[_0xb2e8('0x4c')]);_0x207983[_0xb2e8('0x50')]=_[_0xb2e8('0x4e')](_0x4be69d['model'],qs['fields'](_0x4aa5ec[_0xb2e8('0x4c')][_0xb2e8('0x51')]));_0x207983[_0xb2e8('0x50')]=_0x207983[_0xb2e8('0x50')][_0xb2e8('0x52')]?_0x207983[_0xb2e8('0x50')]:_0x4be69d[_0xb2e8('0x4f')];_0x207983[_0xb2e8('0x54')]=qs[_0xb2e8('0x55')](_0x4aa5ec[_0xb2e8('0x4c')][_0xb2e8('0x55')]);_0x207983[_0xb2e8('0x57')]=qs['filters'](_['pick'](_0x4aa5ec[_0xb2e8('0x4c')],_0x4be69d[_0xb2e8('0x4d')]));if(_0x4aa5ec['query'][_0xb2e8('0x56')]){_0x207983[_0xb2e8('0x57')]=_[_0xb2e8('0x58')](_0x207983[_0xb2e8('0x57')],{'$or':_['map'](_0x207983['attributes'],function(_0x47ff3e){var _0x1f205a={};_0x1f205a[_0x47ff3e]={'$like':'%'+_0x4aa5ec[_0xb2e8('0x4c')]['filter']+'%'};return _0x1f205a;})});}_0x207983=_['merge']({},_0x207983,_0x4aa5ec['options']);return _0x5c5294[_0xb2e8('0xc0')](_0x207983);}})['then'](function(_0x12c20f){if(_0x12c20f){_0x3854d6=_0x12c20f['length'];if(!_0x4aa5ec['query'][_0xb2e8('0x53')](_0xb2e8('0x6d'))){_0x207983[_0xb2e8('0x22')]=qs['limit'](_0x4aa5ec[_0xb2e8('0x4c')][_0xb2e8('0x22')]);_0x207983[_0xb2e8('0x20')]=qs[_0xb2e8('0x20')](_0x4aa5ec[_0xb2e8('0x4c')][_0xb2e8('0x20')]);}return _0x5c5294['getAgents'](_0x207983);}})[_0xb2e8('0x26')](function(_0x14cdd5){if(_0x14cdd5){return _0x14cdd5?{'count':_0x3854d6,'rows':_0x14cdd5}:null;}})[_0xb2e8('0x26')](respondWithResult(_0x58dc8a,null))['catch'](handleError(_0x58dc8a,null));}; \ No newline at end of file +var _0x77c5=['code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','UserProfileResource','end','stack','name','send','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','secure','service','authentication','Imap','port','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','filters','body','custom','provider','find','params','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','findOne','rows','removeDispositions','CannedAnswer','ids','create','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','email','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x37db6b,_0x1de9eb){var _0x3f81d5=function(_0x5ef8ed){while(--_0x5ef8ed){_0x37db6b['push'](_0x37db6b['shift']());}};_0x3f81d5(++_0x1de9eb);}(_0x77c5,0x16b));var _0x577c=function(_0x5cc2a0,_0x596eef){_0x5cc2a0=_0x5cc2a0-0x0;var _0x3e2bfb=_0x77c5[_0x5cc2a0];return _0x3e2bfb;};'use strict';var moment=require('moment');var BPromise=require(_0x577c('0x0'));var util=require(_0x577c('0x1'));var path=require(_0x577c('0x2'));var _=require(_0x577c('0x3'));var juice=require(_0x577c('0x4'));var Redis=require(_0x577c('0x5'));var qs=require(_0x577c('0x6'));var logger=require(_0x577c('0x7'))('api');var config=require('../../config/environment');var db=require(_0x577c('0x8'))['db'];config[_0x577c('0x9')]=_[_0x577c('0xa')](config[_0x577c('0x9')],{'host':_0x577c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x577c('0x9')]));require(_0x577c('0xc'))[_0x577c('0xd')](socket);var jayson=require(_0x577c('0xe'));var client=jayson[_0x577c('0xf')][_0x577c('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x31ed77,_0x4aa2e1,_0x1078f6,_0x2a82c9){return new BPromise(function(_0x2b8dd7,_0x35257e){var _0x14f6f9=_0x2a82c9||client;return _0x14f6f9[_0x577c('0x11')](_0x31ed77,_0x1078f6)[_0x577c('0x12')](function(_0x53b5a4){logger[_0x577c('0x13')]('MailAccount,\x20%s,\x20%s',_0x4aa2e1,_0x577c('0x14'));logger[_0x577c('0x15')](_0x577c('0x16'),_0x4aa2e1,_0x577c('0x14'),JSON[_0x577c('0x17')](_0x53b5a4));if(_0x53b5a4[_0x577c('0x18')]){if(_0x53b5a4[_0x577c('0x18')][_0x577c('0x19')]===0x1f4){logger[_0x577c('0x18')](_0x577c('0x1a'),_0x4aa2e1,_0x53b5a4[_0x577c('0x18')][_0x577c('0x1b')]);return _0x35257e(_0x53b5a4[_0x577c('0x18')][_0x577c('0x1b')]);}logger[_0x577c('0x18')]('MailAccount,\x20%s,\x20%s',_0x4aa2e1,_0x53b5a4[_0x577c('0x18')][_0x577c('0x1b')]);return _0x2b8dd7(_0x53b5a4[_0x577c('0x18')][_0x577c('0x1b')]);}else{logger[_0x577c('0x13')]('MailAccount,\x20%s,\x20%s',_0x4aa2e1,'request\x20sent');_0x2b8dd7(_0x53b5a4['result'][_0x577c('0x1b')]);}})[_0x577c('0x1c')](function(_0x599579){logger[_0x577c('0x18')](_0x577c('0x1a'),_0x4aa2e1,_0x599579);_0x35257e(_0x599579);});});}function respondWithStatusCode(_0x1fc004,_0x3d6eba){_0x3d6eba=_0x3d6eba||0xcc;return function(_0x14a9ec){if(_0x14a9ec){return _0x1fc004[_0x577c('0x1d')](_0x3d6eba);}return _0x1fc004[_0x577c('0x1e')](_0x3d6eba)['end']();};}function respondWithResult(_0x170f77,_0x49a63a){_0x49a63a=_0x49a63a||0xc8;return function(_0x19d0d4){if(_0x19d0d4){return _0x170f77['status'](_0x49a63a)[_0x577c('0x1f')](_0x19d0d4);}};}function respondWithFilteredResult(_0x253b1a,_0xa78f){return function(_0x1b8f00){if(_0x1b8f00){var _0x4d1660=typeof _0xa78f[_0x577c('0x20')]==='undefined'&&typeof _0xa78f['limit']===_0x577c('0x21');var _0x65c520=_0x1b8f00['count'];var _0x28ac24=_0x4d1660?0x0:_0xa78f[_0x577c('0x20')];var _0x120a12=_0x4d1660?_0x1b8f00[_0x577c('0x22')]:_0xa78f[_0x577c('0x20')]+_0xa78f[_0x577c('0x23')];var _0x12077e;if(_0x120a12>=_0x65c520){_0x120a12=_0x65c520;_0x12077e=0xc8;}else{_0x12077e=0xce;}_0x253b1a[_0x577c('0x1e')](_0x12077e);return _0x253b1a[_0x577c('0x24')](_0x577c('0x25'),_0x28ac24+'-'+_0x120a12+'/'+_0x65c520)[_0x577c('0x1f')](_0x1b8f00);}return null;};}function saveUpdates(_0x1b29d4){return function(_0x49949d){if(_0x49949d){return _0x49949d[_0x577c('0x26')](_0x1b29d4)[_0x577c('0x12')](function(_0x3e7e30){return _0x3e7e30;});}return null;};}function removeEntity(_0x25e8ae){return function(_0x2d9bbf){if(_0x2d9bbf){return _0x2d9bbf[_0x577c('0x27')]()[_0x577c('0x12')](function(){var _0x54ce04=_0x2d9bbf[_0x577c('0x28')]({'plain':!![]});var _0x10117a='MailAccounts';return db[_0x577c('0x29')][_0x577c('0x27')]({'where':{'type':_0x10117a,'resourceId':_0x54ce04['id']}})[_0x577c('0x12')](function(){return _0x2d9bbf;});})[_0x577c('0x12')](function(){_0x25e8ae[_0x577c('0x1e')](0xcc)[_0x577c('0x2a')]();});}};}function handleEntityNotFound(_0x441c4d){return function(_0x50d1b3){if(!_0x50d1b3){_0x441c4d['sendStatus'](0x194);}return _0x50d1b3;};}function handleError(_0x168cd5,_0x23647b){_0x23647b=_0x23647b||0x1f4;return function(_0x3475ce){logger['error'](_0x3475ce[_0x577c('0x2b')]);if(_0x3475ce['name']){delete _0x3475ce[_0x577c('0x2c')];}_0x168cd5[_0x577c('0x1e')](_0x23647b)[_0x577c('0x2d')](_0x3475ce);};}function getImapHost(_0x23826c){switch(_0x23826c){case _0x577c('0x2e'):return'imap.gmail.com';case _0x577c('0x2f'):return'imap.mail.yahoo.com';case _0x577c('0x30'):return _0x577c('0x31');case'outlook365':return _0x577c('0x32');}throw new Error(_0x577c('0x33'),_0x23826c);}function getSmtpHost(_0x5475c4){switch(_0x5475c4){case'gmail':return _0x577c('0x34');case _0x577c('0x2f'):return _0x577c('0x35');case _0x577c('0x30'):return'smtp-mail.outlook.com';case _0x577c('0x36'):return _0x577c('0x37');}throw new Error(_0x577c('0x33'),_0x5475c4);}function getAuthenticationOptions(_0x4fbc5b,_0x390929){var _0x137f44={};var _0x2bdef4={};if(_0x4fbc5b){_0x137f44[_0x577c('0x38')]=_0x2bdef4[_0x577c('0x38')]=_0x390929[_0x577c('0x39')];_0x137f44['password']=_0x2bdef4[_0x577c('0x3a')]=_0x390929[_0x577c('0x3b')];if(_0x390929[_0x577c('0x3c')]){_0x137f44[_0x577c('0x3c')]=_0x2bdef4['modernAuthentication']=!![];_0x137f44[_0x577c('0x3d')]=_0x2bdef4[_0x577c('0x3d')]=_0x390929[_0x577c('0x3d')];_0x137f44[_0x577c('0x3b')]=_0x2bdef4[_0x577c('0x3a')]=null;}else{_0x137f44['CloudProviderId']=_0x2bdef4[_0x577c('0x3d')]=null;}_0x137f44[_0x577c('0x3e')]=getImapHost(_0x4fbc5b);_0x137f44['port']=0x3e1;_0x2bdef4['host']=getSmtpHost(_0x4fbc5b);_0x2bdef4['port']=0x24b;_0x2bdef4[_0x577c('0x3f')]=![];_0x137f44['service']=_0x2bdef4[_0x577c('0x40')]=null;}else{if(_0x390929[_0x577c('0x41')]){_0x137f44[_0x577c('0x38')]=_0x2bdef4['user']=_0x390929[_0x577c('0x39')];_0x137f44['password']=_0x2bdef4[_0x577c('0x3a')]=_0x390929[_0x577c('0x3b')];}else{_0x137f44['authentication']=_0x2bdef4[_0x577c('0x41')]=![];_0x137f44[_0x577c('0x38')]=_0x2bdef4['user']=null;_0x137f44[_0x577c('0x3b')]=_0x2bdef4[_0x577c('0x3a')]=null;}_0x137f44['host']=_0x390929[_0x577c('0x42')][_0x577c('0x3e')];_0x137f44[_0x577c('0x43')]=_0x390929[_0x577c('0x42')]['port'];_0x2bdef4['host']=_0x390929['Smtp'][_0x577c('0x3e')];_0x2bdef4[_0x577c('0x43')]=_0x390929[_0x577c('0x44')][_0x577c('0x43')];}return{'Imap':_0x137f44,'Smtp':_0x2bdef4};}exports[_0x577c('0x45')]=function(_0x37cc2f,_0x23b7fb){var _0x8c9df1={'include':[{'model':db[_0x577c('0x46')],'as':_0x577c('0x42')},{'model':db[_0x577c('0x47')],'as':_0x577c('0x44')},{'model':db[_0x577c('0x48')],'as':_0x577c('0x49')}]},_0x8eb96c={},_0x3e2fe3={'count':0x0,'rows':[]};var _0x2e1766=_['map'](db[_0x577c('0x4a')][_0x577c('0x4b')],function(_0x373ddd){return{'name':_0x373ddd[_0x577c('0x4c')],'type':_0x373ddd[_0x577c('0x4d')][_0x577c('0x4e')]};});_0x8eb96c['model']=_[_0x577c('0x4f')](_0x2e1766,'name');_0x8eb96c[_0x577c('0x50')]=_[_0x577c('0x51')](_0x37cc2f[_0x577c('0x50')]);_0x8eb96c['filters']=_['intersection'](_0x8eb96c[_0x577c('0x52')],_0x8eb96c[_0x577c('0x50')]);_0x8c9df1[_0x577c('0x53')]=_[_0x577c('0x54')](_0x8eb96c[_0x577c('0x52')],qs[_0x577c('0x55')](_0x37cc2f[_0x577c('0x50')][_0x577c('0x55')]));_0x8c9df1[_0x577c('0x53')]=_0x8c9df1[_0x577c('0x53')][_0x577c('0x56')]?_0x8c9df1[_0x577c('0x53')]:_0x8eb96c[_0x577c('0x52')];if(!_0x37cc2f['query'][_0x577c('0x57')](_0x577c('0x58'))){_0x8c9df1[_0x577c('0x23')]=qs[_0x577c('0x23')](_0x37cc2f[_0x577c('0x50')][_0x577c('0x23')]);_0x8c9df1[_0x577c('0x20')]=qs[_0x577c('0x20')](_0x37cc2f[_0x577c('0x50')][_0x577c('0x20')]);}_0x8c9df1[_0x577c('0x59')]=qs['sort'](_0x37cc2f[_0x577c('0x50')][_0x577c('0x5a')]);_0x8c9df1[_0x577c('0x5b')]=qs['filters'](_[_0x577c('0x5c')](_0x37cc2f[_0x577c('0x50')],_0x8eb96c['filters']),_0x2e1766);if(_0x37cc2f['query'][_0x577c('0x5d')]){_0x8c9df1[_0x577c('0x5b')]=_[_0x577c('0x5e')](_0x8c9df1[_0x577c('0x5b')],{'$or':_[_0x577c('0x4f')](_0x2e1766,function(_0x201881){if(_0x201881[_0x577c('0x4d')]!==_0x577c('0x5f')){var _0x14beff={};_0x14beff[_0x201881['name']]={'$like':'%'+_0x37cc2f[_0x577c('0x50')][_0x577c('0x5d')]+'%'};return _0x14beff;}})});}_0x8c9df1=_[_0x577c('0x5e')]({},_0x8c9df1,_0x37cc2f[_0x577c('0x60')]);var _0x1574bb={'where':_0x8c9df1[_0x577c('0x5b')]};return db[_0x577c('0x4a')][_0x577c('0x22')](_0x1574bb)['then'](function(_0x48c882){_0x3e2fe3[_0x577c('0x22')]=_0x48c882;if(_0x37cc2f[_0x577c('0x50')][_0x577c('0x61')]){_0x8c9df1[_0x577c('0x62')]=[{'all':!![]}];}return db[_0x577c('0x4a')][_0x577c('0x63')](_0x8c9df1);})['then'](function(_0x40e8be){_0x3e2fe3['rows']=_0x40e8be;return _0x3e2fe3;})[_0x577c('0x12')](respondWithFilteredResult(_0x23b7fb,_0x8c9df1))[_0x577c('0x1c')](handleError(_0x23b7fb,null));};exports['show']=function(_0x11f69d,_0x4e36fa){var _0xea5970={'raw':![],'where':{'id':_0x11f69d['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x577c('0x42')},{'model':db[_0x577c('0x47')],'as':_0x577c('0x44')},{'model':db[_0x577c('0x48')],'as':_0x577c('0x49')}]},_0x598232={};_0x598232[_0x577c('0x52')]=_['keys'](db['MailAccount'][_0x577c('0x4b')]);_0x598232['query']=_[_0x577c('0x51')](_0x11f69d['query']);_0x598232[_0x577c('0x64')]=_[_0x577c('0x54')](_0x598232['model'],_0x598232[_0x577c('0x50')]);_0xea5970[_0x577c('0x53')]=_[_0x577c('0x54')](_0x598232[_0x577c('0x52')],qs['fields'](_0x11f69d[_0x577c('0x50')][_0x577c('0x55')]));_0xea5970['attributes']=_0xea5970[_0x577c('0x53')][_0x577c('0x56')]?_0xea5970[_0x577c('0x53')]:_0x598232[_0x577c('0x52')];if(_0x11f69d[_0x577c('0x50')][_0x577c('0x61')]){_0xea5970[_0x577c('0x62')]=[{'all':!![]}];}_0xea5970=_[_0x577c('0x5e')]({},_0xea5970,_0x11f69d['options']);return db[_0x577c('0x4a')]['find'](_0xea5970)[_0x577c('0x12')](handleEntityNotFound(_0x4e36fa,null))[_0x577c('0x12')](respondWithResult(_0x4e36fa,null))[_0x577c('0x1c')](handleError(_0x4e36fa,null));};exports[_0x577c('0x26')]=function(_0x2848f6,_0x1621d0){if(_0x2848f6[_0x577c('0x65')]['id']){delete _0x2848f6[_0x577c('0x65')]['id'];}var _0x1cc57e=_0x2848f6[_0x577c('0x65')]['provider']===_0x577c('0x66')?null:_0x2848f6[_0x577c('0x65')][_0x577c('0x67')];var _0x10750d=_0x2848f6['body'][_0x577c('0x42')]||{};var _0x41c4e2=_0x2848f6[_0x577c('0x65')]['Smtp']||{};if(_0x1cc57e){_0x10750d[_0x577c('0x3e')]=getImapHost(_0x1cc57e);_0x10750d[_0x577c('0x43')]=0x3e1;_0x41c4e2['host']=getSmtpHost(_0x1cc57e);_0x41c4e2[_0x577c('0x43')]=0x24b;_0x41c4e2[_0x577c('0x3f')]=![];}if(_0x41c4e2[_0x577c('0x3c')]){_0x41c4e2[_0x577c('0x3f')]=![];}else{_0x41c4e2[_0x577c('0x3d')]=null;}if(!_0x10750d['modernAuthentication'])_0x10750d[_0x577c('0x3d')]=null;_0x2848f6['body'][_0x577c('0x42')]=_0x10750d;_0x2848f6[_0x577c('0x65')][_0x577c('0x44')]=_0x41c4e2;return db['MailAccount'][_0x577c('0x68')]({'where':{'id':_0x2848f6[_0x577c('0x69')]['id']},'include':[{'model':db[_0x577c('0x46')],'as':_0x577c('0x42')},{'model':db[_0x577c('0x47')],'as':_0x577c('0x44')},{'model':db[_0x577c('0x48')],'as':_0x577c('0x49')}]})[_0x577c('0x12')](handleEntityNotFound(_0x1621d0,null))[_0x577c('0x12')](function(_0xa52ac5){if(!_0xa52ac5)throw new Error(_0x577c('0x6a'));if(_0xa52ac5['service'])delete _0x2848f6[_0x577c('0x65')][_0x577c('0x42')];return _0xa52ac5;})[_0x577c('0x12')](saveUpdates(_0x2848f6[_0x577c('0x65')],null))[_0x577c('0x12')](function(_0x1de76e){if(!_0x2848f6[_0x577c('0x65')][_0x577c('0x42')])return _0x1de76e;return db[_0x577c('0x46')]['update'](_0x2848f6[_0x577c('0x65')][_0x577c('0x42')],{'where':{'MailAccountId':_0x1de76e['id']}})[_0x577c('0x12')](function(){return _0x1de76e;});})[_0x577c('0x12')](function(_0x48e137){if(!_0x2848f6[_0x577c('0x65')][_0x577c('0x44')])return _0x48e137;return db[_0x577c('0x47')]['update'](_0x2848f6['body'][_0x577c('0x44')],{'where':{'MailAccountId':_0x48e137['id']}})[_0x577c('0x12')](function(){return _0x48e137;});})[_0x577c('0x12')](respondWithResult(_0x1621d0,null))[_0x577c('0x1c')](handleError(_0x1621d0,null));};exports[_0x577c('0x6b')]=function(_0x5a4965,_0x4b0c41){return db[_0x577c('0x4a')][_0x577c('0x6b')]()['then'](respondWithResult(_0x4b0c41,null))[_0x577c('0x1c')](handleError(_0x4b0c41,null));};exports['addDisposition']=function(_0x44bb4a,_0x176ef3){if(_0x44bb4a[_0x577c('0x65')]['id']){delete _0x44bb4a[_0x577c('0x65')]['id'];}return db['MailAccount'][_0x577c('0x68')]({'where':{'id':_0x44bb4a[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x176ef3,null))[_0x577c('0x12')](function(_0x100f86){if(_0x100f86){_0x44bb4a[_0x577c('0x65')][_0x577c('0x6c')]=_0x100f86['id'];return db[_0x577c('0x6d')]['create'](_0x44bb4a['body']);}})[_0x577c('0x12')](respondWithResult(_0x176ef3,null))[_0x577c('0x1c')](handleError(_0x176ef3,null));};exports['getDispositions']=function(_0x3977f0,_0x5dd059){var _0x201140={'raw':![],'where':{}};var _0xbb4e1a={};var _0x19cb64={'count':0x0,'rows':[]};return db['MailAccount'][_0x577c('0x6e')]({'where':{'id':_0x3977f0['params']['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x5dd059,null))[_0x577c('0x12')](function(_0x6c416e){if(_0x6c416e){_0xbb4e1a['model']=_[_0x577c('0x51')](db[_0x577c('0x6d')][_0x577c('0x4b')]);_0xbb4e1a[_0x577c('0x50')]=_[_0x577c('0x51')](_0x3977f0['query']);_0xbb4e1a[_0x577c('0x64')]=_[_0x577c('0x54')](_0xbb4e1a[_0x577c('0x52')],_0xbb4e1a[_0x577c('0x50')]);_0x201140['attributes']=_[_0x577c('0x54')](_0xbb4e1a['model'],qs[_0x577c('0x55')](_0x3977f0[_0x577c('0x50')][_0x577c('0x55')]));_0x201140[_0x577c('0x53')]=_0x201140[_0x577c('0x53')][_0x577c('0x56')]?_0x201140[_0x577c('0x53')]:_0xbb4e1a['model'];if(!_0x3977f0[_0x577c('0x50')][_0x577c('0x57')]('nolimit')){_0x201140['limit']=qs[_0x577c('0x23')](_0x3977f0[_0x577c('0x50')]['limit']);_0x201140[_0x577c('0x20')]=qs[_0x577c('0x20')](_0x3977f0[_0x577c('0x50')]['offset']);}_0x201140[_0x577c('0x59')]=qs[_0x577c('0x5a')](_0x3977f0[_0x577c('0x50')][_0x577c('0x5a')]);_0x201140[_0x577c('0x5b')]=qs[_0x577c('0x64')](_[_0x577c('0x5c')](_0x3977f0[_0x577c('0x50')],_0xbb4e1a[_0x577c('0x64')]));_0x201140[_0x577c('0x5b')][_0x577c('0x6c')]=_0x6c416e['id'];if(_0x3977f0['query'][_0x577c('0x5d')]){_0x201140[_0x577c('0x5b')]=_['merge'](_0x201140[_0x577c('0x5b')],{'$or':_[_0x577c('0x4f')](_0x201140[_0x577c('0x53')],function(_0x32a4a9){var _0x4aaffe={};_0x4aaffe[_0x32a4a9]={'$like':'%'+_0x3977f0['query'][_0x577c('0x5d')]+'%'};return _0x4aaffe;})});}_0x201140=_['merge']({},_0x201140,_0x3977f0[_0x577c('0x60')]);return db[_0x577c('0x6d')][_0x577c('0x22')]({'where':_0x201140['where']})[_0x577c('0x12')](function(_0x523218){_0x19cb64[_0x577c('0x22')]=_0x523218;if(_0x3977f0[_0x577c('0x50')][_0x577c('0x61')]){_0x201140[_0x577c('0x62')]=[{'all':!![]}];}return db[_0x577c('0x6d')][_0x577c('0x63')](_0x201140);})[_0x577c('0x12')](function(_0x5afbdd){_0x19cb64[_0x577c('0x6f')]=_0x5afbdd;return _0x19cb64;});}})[_0x577c('0x12')](respondWithFilteredResult(_0x5dd059,_0x201140))[_0x577c('0x1c')](handleError(_0x5dd059,null));};exports[_0x577c('0x70')]=function(_0x25d94e,_0x52f2e0){return db[_0x577c('0x4a')][_0x577c('0x68')]({'where':{'id':_0x25d94e[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x52f2e0,null))['then'](function(_0x5b1d91){if(_0x5b1d91){return _0x5b1d91[_0x577c('0x70')](_0x25d94e['query']['ids']);}})['then'](respondWithStatusCode(_0x52f2e0,null))['catch'](handleError(_0x52f2e0,null));};exports['addAnswer']=function(_0x27fa48,_0x625da7){if(_0x27fa48[_0x577c('0x65')]['id']){delete _0x27fa48[_0x577c('0x65')]['id'];}return db[_0x577c('0x4a')][_0x577c('0x68')]({'where':{'id':_0x27fa48[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x625da7,null))['then'](function(_0x678e4e){if(_0x678e4e){_0x27fa48[_0x577c('0x65')][_0x577c('0x6c')]=_0x678e4e['id'];return db['CannedAnswer']['create'](_0x27fa48[_0x577c('0x65')]);}})[_0x577c('0x12')](respondWithResult(_0x625da7,null))[_0x577c('0x1c')](handleError(_0x625da7,null));};exports['getAnswers']=function(_0x536c77,_0x910967){var _0x231d60={'raw':![],'where':{}};var _0x31b2a3={};var _0x259275={'count':0x0,'rows':[]};return db[_0x577c('0x4a')][_0x577c('0x6e')]({'where':{'id':_0x536c77[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x910967,null))[_0x577c('0x12')](function(_0x2c2dd2){if(_0x2c2dd2){_0x31b2a3[_0x577c('0x52')]=_[_0x577c('0x51')](db[_0x577c('0x71')][_0x577c('0x4b')]);_0x31b2a3['query']=_[_0x577c('0x51')](_0x536c77[_0x577c('0x50')]);_0x31b2a3[_0x577c('0x64')]=_[_0x577c('0x54')](_0x31b2a3[_0x577c('0x52')],_0x31b2a3[_0x577c('0x50')]);_0x231d60[_0x577c('0x53')]=_[_0x577c('0x54')](_0x31b2a3[_0x577c('0x52')],qs['fields'](_0x536c77[_0x577c('0x50')][_0x577c('0x55')]));_0x231d60[_0x577c('0x53')]=_0x231d60[_0x577c('0x53')][_0x577c('0x56')]?_0x231d60[_0x577c('0x53')]:_0x31b2a3[_0x577c('0x52')];if(!_0x536c77[_0x577c('0x50')]['hasOwnProperty'](_0x577c('0x58'))){_0x231d60[_0x577c('0x23')]=qs['limit'](_0x536c77[_0x577c('0x50')]['limit']);_0x231d60[_0x577c('0x20')]=qs[_0x577c('0x20')](_0x536c77[_0x577c('0x50')][_0x577c('0x20')]);}_0x231d60[_0x577c('0x59')]=qs[_0x577c('0x5a')](_0x536c77['query']['sort']);_0x231d60[_0x577c('0x5b')]=qs['filters'](_[_0x577c('0x5c')](_0x536c77[_0x577c('0x50')],_0x31b2a3[_0x577c('0x64')]));_0x231d60['where'][_0x577c('0x6c')]=_0x2c2dd2['id'];if(_0x536c77[_0x577c('0x50')][_0x577c('0x5d')]){_0x231d60[_0x577c('0x5b')]=_[_0x577c('0x5e')](_0x231d60[_0x577c('0x5b')],{'$or':_[_0x577c('0x4f')](_0x231d60[_0x577c('0x53')],function(_0x118038){var _0x4477f8={};_0x4477f8[_0x118038]={'$like':'%'+_0x536c77['query'][_0x577c('0x5d')]+'%'};return _0x4477f8;})});}_0x231d60=_['merge']({},_0x231d60,_0x536c77[_0x577c('0x60')]);return db[_0x577c('0x71')][_0x577c('0x22')]({'where':_0x231d60[_0x577c('0x5b')]})['then'](function(_0x266548){_0x259275['count']=_0x266548;if(_0x536c77[_0x577c('0x50')][_0x577c('0x61')]){_0x231d60[_0x577c('0x62')]=[{'all':!![]}];}return db[_0x577c('0x71')][_0x577c('0x63')](_0x231d60);})[_0x577c('0x12')](function(_0x497043){_0x259275['rows']=_0x497043;return _0x259275;});}})['then'](respondWithFilteredResult(_0x910967,_0x231d60))[_0x577c('0x1c')](handleError(_0x910967,null));};exports['removeAnswers']=function(_0x951bd6,_0xa69a6c){return db[_0x577c('0x4a')][_0x577c('0x68')]({'where':{'id':_0x951bd6['params']['id']}})['then'](handleEntityNotFound(_0xa69a6c,null))[_0x577c('0x12')](function(_0x39ceed){if(_0x39ceed){return _0x39ceed['removeAnswers'](_0x951bd6[_0x577c('0x50')][_0x577c('0x72')]);}})[_0x577c('0x12')](respondWithStatusCode(_0xa69a6c,null))['catch'](handleError(_0xa69a6c,null));};exports[_0x577c('0x73')]=function(_0x47441a,_0x2c1999){var _0x4018c4={'name':_0x47441a[_0x577c('0x65')]['name'],'key':_0x47441a[_0x577c('0x65')][_0x577c('0x4e')],'provider':_0x47441a[_0x577c('0x65')][_0x577c('0x67')]===_0x577c('0x66')?null:_0x47441a[_0x577c('0x65')][_0x577c('0x67')],'email':_0x47441a[_0x577c('0x65')]['email'],'ListId':_0x47441a['body'][_0x577c('0x74')],'active':!_[_0x577c('0x75')](_0x47441a[_0x577c('0x65')]['active'])?_0x47441a[_0x577c('0x65')][_0x577c('0x76')]:!![],'description':_0x47441a['body'][_0x577c('0x77')]||null};var _0x2de819=getAuthenticationOptions(_0x4018c4[_0x577c('0x67')],_0x47441a[_0x577c('0x65')]);_0x4018c4[_0x577c('0x42')]=_0x2de819['Imap'];_0x4018c4[_0x577c('0x44')]=_0x2de819[_0x577c('0x44')];return db['MailAccount']['create'](_0x4018c4,{'include':[{'model':db[_0x577c('0x47')],'as':_0x577c('0x44')},{'model':db['MailServerIn'],'as':_0x577c('0x42')}]})[_0x577c('0x12')](function(_0x2ac8a1){var _0x5e07cf=_0x47441a[_0x577c('0x38')][_0x577c('0x28')]({'plain':!![]});if(!_0x5e07cf)throw new Error(_0x577c('0x78'));if(_0x5e07cf[_0x577c('0x79')]===_0x577c('0x38')){var _0x39524f=_0x2ac8a1[_0x577c('0x28')]({'plain':!![]});return db[_0x577c('0x7a')][_0x577c('0x68')]({'where':{'name':_0x577c('0x7b'),'userProfileId':_0x5e07cf['userProfileId']},'raw':!![]})[_0x577c('0x12')](function(_0x5b27c6){if(_0x5b27c6&&_0x5b27c6[_0x577c('0x7c')]===0x0){return db[_0x577c('0x29')][_0x577c('0x73')]({'name':_0x39524f['name'],'resourceId':_0x39524f['id'],'type':_0x5b27c6[_0x577c('0x2c')],'sectionId':_0x5b27c6['id']},{})['then'](function(){return _0x2ac8a1;});}else{return _0x2ac8a1;}})['catch'](function(_0x55c90e){logger[_0x577c('0x18')](_0x577c('0x7d'),_0x55c90e);throw _0x55c90e;});}return _0x2ac8a1;})[_0x577c('0x12')](respondWithResult(_0x2c1999,0xc9))['catch'](handleError(_0x2c1999,null));};exports[_0x577c('0x7e')]=function(_0x199a94,_0x3718b3){return db[_0x577c('0x4a')][_0x577c('0x6e')]({'where':{'id':_0x199a94[_0x577c('0x69')]['id']}})['then'](handleEntityNotFound(_0x3718b3,null))[_0x577c('0x12')](function(_0x128fea){if(_0x128fea){return _0x128fea[_0x577c('0x7e')]();}return null;})['then'](respondWithResult(_0x3718b3,null))[_0x577c('0x1c')](handleError(_0x3718b3,null));};exports['addImap']=function(_0x33b2d9,_0x2657eb){if(_0x33b2d9[_0x577c('0x65')]['id']){delete _0x33b2d9[_0x577c('0x65')]['id'];}return db[_0x577c('0x4a')][_0x577c('0x68')]({'where':{'id':_0x33b2d9[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x2657eb,null))[_0x577c('0x12')](function(_0x2d1fe4){if(_0x2d1fe4){_0x33b2d9['body']['MailAccountId']=_0x2d1fe4['id'];return db[_0x577c('0x46')][_0x577c('0x73')](_0x33b2d9[_0x577c('0x65')]);}})[_0x577c('0x12')](respondWithResult(_0x2657eb,null))['catch'](handleError(_0x2657eb,null));};exports[_0x577c('0x7f')]=function(_0x1d710e,_0x71033a){return db[_0x577c('0x4a')][_0x577c('0x6e')]({'where':{'id':_0x1d710e[_0x577c('0x69')]['id']}})['then'](handleEntityNotFound(_0x71033a,null))[_0x577c('0x12')](function(_0x4de1aa){if(_0x4de1aa){return _0x4de1aa['setImap'](null);}return null;})[_0x577c('0x12')](respondWithStatusCode(_0x71033a,null))['catch'](handleError(_0x71033a,null));};exports[_0x577c('0x80')]=function(_0x3148c9,_0x54128a){return db[_0x577c('0x4a')][_0x577c('0x6e')]({'where':{'id':_0x3148c9[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x54128a,null))['then'](function(_0x38852d){if(_0x38852d){return _0x38852d[_0x577c('0x80')]();}return null;})[_0x577c('0x12')](respondWithResult(_0x54128a,null))[_0x577c('0x1c')](handleError(_0x54128a,null));};exports[_0x577c('0x81')]=function(_0xf2eb8f,_0x5f4252){if(_0xf2eb8f[_0x577c('0x65')]['id']){delete _0xf2eb8f[_0x577c('0x65')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xf2eb8f[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x5f4252,null))[_0x577c('0x12')](function(_0x45fa48){if(_0x45fa48){_0xf2eb8f[_0x577c('0x65')][_0x577c('0x6c')]=_0x45fa48['id'];return db[_0x577c('0x47')][_0x577c('0x73')](_0xf2eb8f[_0x577c('0x65')]);}})[_0x577c('0x12')](respondWithResult(_0x5f4252,null))[_0x577c('0x1c')](handleError(_0x5f4252,null));};exports[_0x577c('0x82')]=function(_0x4979e8,_0x5043c8){return db[_0x577c('0x4a')][_0x577c('0x6e')]({'where':{'id':_0x4979e8[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x5043c8,null))['then'](function(_0x565d2c){if(_0x565d2c){return _0x565d2c[_0x577c('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x5043c8,null))[_0x577c('0x1c')](handleError(_0x5043c8,null));};exports['addInteraction']=function(_0xadba9c,_0x291b8d){return db[_0x577c('0x84')]['find']({'where':{'id':_0xadba9c['params']['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x291b8d,null))['then'](function(_0x94f8cd){if(_0x94f8cd){return _0x94f8cd['addInteraction'](_0xadba9c[_0x577c('0x65')][_0x577c('0x72')],_[_0x577c('0x85')](_0xadba9c[_0x577c('0x65')],['ids','id'])||{});}})[_0x577c('0x12')](respondWithResult(_0x291b8d,null))[_0x577c('0x1c')](handleError(_0x291b8d,null));};exports[_0x577c('0x86')]=function(_0x162740,_0x265d40){var _0x246fa8={'raw':![],'where':{}};var _0x13cf30={};var _0x29dab1={'count':0x0,'rows':[]};return db[_0x577c('0x4a')]['findOne']({'where':{'id':_0x162740[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x265d40,null))[_0x577c('0x12')](function(_0xe89df0){if(_0xe89df0){_0x13cf30[_0x577c('0x52')]=_[_0x577c('0x51')](db[_0x577c('0x84')]['rawAttributes']);_0x13cf30[_0x577c('0x50')]=_['keys'](_0x162740[_0x577c('0x50')]);_0x13cf30[_0x577c('0x64')]=_[_0x577c('0x54')](_0x13cf30[_0x577c('0x52')],_0x13cf30['query']);_0x246fa8['attributes']=_[_0x577c('0x54')](_0x13cf30[_0x577c('0x52')],qs['fields'](_0x162740['query'][_0x577c('0x55')]));_0x246fa8['attributes']=_0x246fa8[_0x577c('0x53')][_0x577c('0x56')]?_0x246fa8['attributes']:_0x13cf30['model'];if(!_0x162740[_0x577c('0x50')]['hasOwnProperty'](_0x577c('0x58'))){_0x246fa8[_0x577c('0x23')]=qs[_0x577c('0x23')](_0x162740['query'][_0x577c('0x23')]);_0x246fa8[_0x577c('0x20')]=qs['offset'](_0x162740[_0x577c('0x50')]['offset']);}_0x246fa8[_0x577c('0x59')]=qs['sort'](_0x162740['query'][_0x577c('0x5a')]);_0x246fa8[_0x577c('0x5b')]=qs[_0x577c('0x64')](_['pick'](_0x162740[_0x577c('0x50')],_0x13cf30['filters']));_0x246fa8[_0x577c('0x5b')]['MailAccountId']=_0xe89df0['id'];if(_0x162740[_0x577c('0x50')][_0x577c('0x5d')]){_0x246fa8[_0x577c('0x5b')]=_['merge'](_0x246fa8[_0x577c('0x5b')],{'$or':_[_0x577c('0x4f')](_0x246fa8['attributes'],function(_0x3a9982){var _0x245997={};_0x245997[_0x3a9982]={'$like':'%'+_0x162740['query']['filter']+'%'};return _0x245997;})});}_0x246fa8=_['merge']({},_0x246fa8,_0x162740[_0x577c('0x60')]);return db[_0x577c('0x84')][_0x577c('0x22')]({'where':_0x246fa8[_0x577c('0x5b')]})[_0x577c('0x12')](function(_0x558745){_0x29dab1[_0x577c('0x22')]=_0x558745;if(_0x162740[_0x577c('0x50')][_0x577c('0x61')]){_0x246fa8['include']=[{'model':db['CmContact'],'as':_0x577c('0x87'),'required':![]},{'model':db[_0x577c('0x88')],'as':'Owner','attributes':[_0x577c('0x2c'),_0x577c('0x89'),_0x577c('0x8a')],'required':![]},{'model':db[_0x577c('0x8b')],'as':_0x577c('0x8c'),'attributes':['id',_0x577c('0x2c'),'color'],'where':_0x162740[_0x577c('0x50')]['tag']?{'id':_0x162740[_0x577c('0x50')]['tag']}:undefined,'required':_0x162740[_0x577c('0x50')][_0x577c('0x8d')]?!![]:![]}];}return db[_0x577c('0x84')]['findAll'](_0x246fa8);})[_0x577c('0x12')](function(_0x585e47){_0x29dab1[_0x577c('0x6f')]=_0x585e47;return _0x29dab1;});}})[_0x577c('0x12')](respondWithFilteredResult(_0x265d40,_0x246fa8))[_0x577c('0x1c')](handleError(_0x265d40,null));};exports[_0x577c('0x8e')]=function addApplications(_0x3159d8,_0x2e0934){var _0x1fdde2=_0x3159d8[_0x577c('0x69')]['id'];var _0x9da33e=_0x3159d8[_0x577c('0x65')];var _0x349bee=0xc8;var _0x95c91a=null;return db[_0x577c('0x8f')][_0x577c('0x90')]({'isolationLevel':db[_0x577c('0x8f')][_0x577c('0x91')]['ISOLATION_LEVELS'][_0x577c('0x92')]},function(_0x46f0cd){return db[_0x577c('0x4a')]['findOne']({'where':{'id':_0x1fdde2},'transaction':_0x46f0cd})[_0x577c('0x12')](function(_0x2045e2){if(_0x2045e2){return db[_0x577c('0x93')][_0x577c('0x27')]({'where':{'MailAccountId':_0x1fdde2},'transaction':_0x46f0cd})[_0x577c('0x12')](function(){var _0x5640cf=_[_0x577c('0x4f')](_0x9da33e,function(_0x58bb1f){_0x58bb1f['MailAccountId']=_0x1fdde2;return _0x58bb1f;});return db[_0x577c('0x93')][_0x577c('0x94')](_0x5640cf,{'transaction':_0x46f0cd});});}else{_0x349bee=0x194;_0x95c91a=[];}});})[_0x577c('0x12')](function(){if(_0x349bee!==0x194){return db[_0x577c('0x93')][_0x577c('0x95')]({'where':{'MailAccountId':_0x1fdde2},'order':'priority'})[_0x577c('0x12')](function(_0x457b1a){_0x95c91a=_0x457b1a;});}})['catch'](function(_0x18825a){_0x349bee=0x1f4;logger['error'](_0x18825a[_0x577c('0x2b')]);if(_0x18825a[_0x577c('0x2c')]){delete _0x18825a[_0x577c('0x2c')];}_0x95c91a=_0x18825a;})[_0x577c('0x96')](function(){if(_0x95c91a===null){_0x2e0934[_0x577c('0x1d')](_0x349bee);}else{if(_0x349bee===0x1f4){_0x2e0934['status'](_0x349bee)[_0x577c('0x2d')](_0x95c91a);}else{_0x2e0934['status'](_0x349bee)[_0x577c('0x1f')](_0x95c91a);}}});};exports[_0x577c('0x97')]=function(_0x3b3700,_0x71d5c4){var _0x60282={};var _0x13aed1={};var _0x45ded3;var _0x50b03d;return db[_0x577c('0x4a')]['findOne']({'where':{'id':_0x3b3700[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x71d5c4,null))[_0x577c('0x12')](function(_0x218f20){if(_0x218f20){_0x45ded3=_0x218f20;_0x13aed1['model']=_[_0x577c('0x51')](db[_0x577c('0x93')][_0x577c('0x4b')]);_0x13aed1[_0x577c('0x50')]=_['keys'](_0x3b3700['query']);_0x13aed1[_0x577c('0x64')]=_[_0x577c('0x54')](_0x13aed1[_0x577c('0x52')],_0x13aed1['query']);_0x60282['attributes']=_[_0x577c('0x54')](_0x13aed1['model'],qs[_0x577c('0x55')](_0x3b3700[_0x577c('0x50')][_0x577c('0x55')]));_0x60282[_0x577c('0x53')]=_0x60282[_0x577c('0x53')][_0x577c('0x56')]?_0x60282[_0x577c('0x53')]:_0x13aed1['model'];_0x60282[_0x577c('0x59')]=qs[_0x577c('0x5a')](_0x3b3700['query'][_0x577c('0x5a')]);_0x60282[_0x577c('0x5b')]=qs[_0x577c('0x64')](_[_0x577c('0x5c')](_0x3b3700['query'],_0x13aed1[_0x577c('0x64')]));if(_0x3b3700[_0x577c('0x50')][_0x577c('0x5d')]){_0x60282['where']=_[_0x577c('0x5e')](_0x60282[_0x577c('0x5b')],{'$or':_[_0x577c('0x4f')](_0x60282[_0x577c('0x53')],function(_0x6e85db){var _0x54f248={};_0x54f248[_0x6e85db]={'$like':'%'+_0x3b3700[_0x577c('0x50')][_0x577c('0x5d')]+'%'};return _0x54f248;})});}_0x60282=_['merge']({},_0x60282,_0x3b3700['options']);return _0x45ded3['getApplications'](_0x60282);}})[_0x577c('0x12')](function(_0x1c32dd){if(_0x1c32dd){_0x50b03d=_0x1c32dd[_0x577c('0x56')];if(!_0x3b3700[_0x577c('0x50')][_0x577c('0x57')]('nolimit')){_0x60282[_0x577c('0x23')]=qs[_0x577c('0x23')](_0x3b3700[_0x577c('0x50')]['limit']);_0x60282['offset']=qs[_0x577c('0x20')](_0x3b3700[_0x577c('0x50')][_0x577c('0x20')]);}return _0x45ded3[_0x577c('0x97')](_0x60282);}})[_0x577c('0x12')](function(_0x23e47e){if(_0x23e47e){return _0x23e47e?{'count':_0x50b03d,'rows':_0x23e47e}:null;}})[_0x577c('0x12')](respondWithResult(_0x71d5c4,null))[_0x577c('0x1c')](handleError(_0x71d5c4,null));};exports[_0x577c('0x98')]=function(_0x44bc10,_0x245003){var _0x3977a0={'raw':!![],'where':{}};var _0x553798={};var _0x429b47={'count':0x0,'rows':[]};return db['MailAccount'][_0x577c('0x6e')]({'where':{'id':_0x44bc10[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x245003,null))[_0x577c('0x12')](function(_0x4747b5){if(_0x4747b5){_0x553798[_0x577c('0x52')]=_[_0x577c('0x51')](db[_0x577c('0x99')][_0x577c('0x4b')]);_0x553798['query']=_[_0x577c('0x51')](_0x44bc10[_0x577c('0x50')]);_0x553798[_0x577c('0x64')]=_['intersection'](_0x553798[_0x577c('0x52')],_0x553798[_0x577c('0x50')]);_0x3977a0[_0x577c('0x53')]=_[_0x577c('0x54')](_0x553798[_0x577c('0x52')],qs[_0x577c('0x55')](_0x44bc10['query']['fields']));_0x3977a0['attributes']=_0x3977a0[_0x577c('0x53')]['length']?_0x3977a0[_0x577c('0x53')]:_0x553798[_0x577c('0x52')];if(!_0x44bc10['query'][_0x577c('0x57')](_0x577c('0x58'))){_0x3977a0[_0x577c('0x23')]=qs[_0x577c('0x23')](_0x44bc10[_0x577c('0x50')]['limit']);_0x3977a0[_0x577c('0x20')]=qs[_0x577c('0x20')](_0x44bc10[_0x577c('0x50')][_0x577c('0x20')]);}_0x3977a0[_0x577c('0x59')]=qs[_0x577c('0x5a')](_0x44bc10[_0x577c('0x50')][_0x577c('0x5a')]);_0x3977a0[_0x577c('0x5b')]=qs[_0x577c('0x64')](_[_0x577c('0x5c')](_0x44bc10['query'],_0x553798['filters']));_0x3977a0[_0x577c('0x5b')][_0x577c('0x6c')]=_0x4747b5['id'];if(_0x44bc10[_0x577c('0x50')][_0x577c('0x5d')]){_0x3977a0[_0x577c('0x5b')]=_[_0x577c('0x5e')](_0x3977a0[_0x577c('0x5b')],{'$or':_[_0x577c('0x4f')](_0x3977a0['attributes'],function(_0x1d3b89){var _0xbc5f2={};_0xbc5f2[_0x1d3b89]={'$like':'%'+_0x44bc10[_0x577c('0x50')][_0x577c('0x5d')]+'%'};return _0xbc5f2;})});}if(_0x44bc10[_0x577c('0x50')]['$gte']){var _0x1f668=_0x44bc10[_0x577c('0x50')][_0x577c('0x9a')][_0x577c('0x9b')](',');var _0x371f0b={};_0x371f0b[_0x1f668[0x0]]={'$gte':moment(_0x1f668[0x1])[_0x577c('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3977a0[_0x577c('0x5b')]=_[_0x577c('0x5e')](_0x3977a0['where'],_0x371f0b);}_0x3977a0=_[_0x577c('0x5e')]({},_0x3977a0,_0x44bc10['options']);return db[_0x577c('0x99')][_0x577c('0x22')]({'where':_0x3977a0[_0x577c('0x5b')]})[_0x577c('0x12')](function(_0xe65d5d){_0x429b47[_0x577c('0x22')]=_0xe65d5d;if(_0x44bc10[_0x577c('0x50')][_0x577c('0x61')]){_0x3977a0[_0x577c('0x62')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x3977a0);})[_0x577c('0x12')](function(_0x538164){if(_0x44bc10['query'][_0x577c('0x9d')]===_0x577c('0x9e')){for(var _0x307af7=0x0;_0x307af7<_0x538164[_0x577c('0x56')];_0x307af7++){_0x538164[_0x307af7][_0x577c('0x65')]=juice(_0x538164[_0x307af7][_0x577c('0x65')]);}}_0x429b47[_0x577c('0x6f')]=_0x538164;return _0x429b47;});}})[_0x577c('0x12')](respondWithFilteredResult(_0x245003,_0x3977a0))[_0x577c('0x1c')](handleError(_0x245003,null));};exports[_0x577c('0x2d')]=function(_0x55495d,_0x1db648){var _0x6bd089,_0x52983a={},_0x943109;if(_0x55495d[_0x577c('0x65')]['to']){_0x943109=_0x55495d[_0x577c('0x65')]['to']['split'](',')[0x0];}return db[_0x577c('0x4a')]['find']({'where':{'id':_0x55495d['params']['id']},'include':[{'model':db[_0x577c('0x9f')],'as':'List','include':[{'model':db[_0x577c('0xa0')],'as':_0x577c('0xa1'),'where':{'email':_0x943109},'limit':0x1,'order':[[_0x577c('0xa2'),_0x577c('0xa3')]]}]},{'model':db[_0x577c('0x47')],'as':_0x577c('0x44'),'raw':!![],'include':[{'model':db[_0x577c('0xa4')],'as':_0x577c('0xa4'),'raw':!![]}]}]})[_0x577c('0x12')](handleEntityNotFound(_0x1db648,null))['then'](function(_0x418e58){if(!_0x418e58)return;_0x6bd089=_0x418e58;if(!_0x418e58['Smtp'])throw new Error(_0x577c('0xa5'));if(_[_0x577c('0x75')](_0x55495d['body'][_0x577c('0xa6')])){_0x55495d[_0x577c('0x65')][_0x577c('0xa6')]=util[_0x577c('0x9c')]('%s\x20<%s>',_0x418e58['name'],_0x418e58[_0x577c('0xa7')]||_0x418e58['Smtp'][_0x577c('0x38')]);}if(_0x55495d[_0x577c('0x65')][_0x577c('0xa8')]&&_0x55495d['body']['attachments'][_0x577c('0x56')]){for(var _0x1baa7f=0x0;_0x1baa7f<_0x55495d[_0x577c('0x65')][_0x577c('0xa8')]['length'];_0x1baa7f+=0x1){_0x55495d[_0x577c('0x65')][_0x577c('0xa8')][_0x1baa7f]={'filename':_0x55495d['body']['attachments'][_0x1baa7f][_0x577c('0x2c')],'path':path['join'](config[_0x577c('0xa9')],_0x577c('0xaa'),_0x55495d['body']['attachments'][_0x1baa7f][_0x577c('0xab')])};}}var _0x500723=_0x418e58[_0x577c('0xac')]();return respondWithRpcPromise(_0x577c('0xad'),_0x577c('0xae'),{'account':_0x500723,'message':_0x55495d[_0x577c('0x65')]});})[_0x577c('0x12')](function(_0x13cde2){if(!_0x13cde2)return;_0x52983a=_0x13cde2;if(!_0x6bd089[_0x577c('0xaf')])throw new Error(_0x577c('0xb0'));if(_0x6bd089[_0x577c('0xaf')][_0x577c('0xa1')]['length'])return _0x6bd089[_0x577c('0xaf')][_0x577c('0xa1')][0x0];return db[_0x577c('0xa0')][_0x577c('0x73')](_[_0x577c('0xa')](_0x55495d[_0x577c('0x65')],{'firstName':_0x55495d['body']['to'],'email':_0x55495d['body']['to'],'phone':_0x55495d['body']['to'],'ListId':_0x6bd089[_0x577c('0x74')]}));})['then'](function(_0x11b7db){if(!_0x11b7db)return;var _0x263d6a={'UserId':_0x55495d[_0x577c('0x38')]['id'],'ContactId':_0x11b7db['id'],'MailAccountId':_0x6bd089['id'],'inReplyTo':_0x52983a[_0x577c('0xb1')],'to':_0x55495d[_0x577c('0x65')]['from'],'cc':_0x55495d[_0x577c('0x65')]['cc'],'subject':_0x55495d[_0x577c('0x65')]['subject'],'attach':_0x55495d[_0x577c('0x65')][_0x577c('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x577c('0x9c')](_0x577c('0xb3')),'lastMsgDirection':_0x577c('0xb4'),'Messages':[_[_0x577c('0x5e')](_0x55495d[_0x577c('0x65')],{'messageId':_0x52983a[_0x577c('0xb1')],'sentAt':moment()[_0x577c('0x9c')](_0x577c('0xb3')),'read':!![],'MailAccountId':_0x6bd089['id'],'UserId':_0x55495d['user']['id'],'ContactId':_0x11b7db['id']})]};if(_0x55495d[_0x577c('0x65')][_0x577c('0xb5')]){_0x263d6a=_[_0x577c('0x5e')](_0x263d6a,_0x55495d[_0x577c('0x65')][_0x577c('0xb5')]);}return db['MailInteraction'][_0x577c('0x73')](_0x263d6a,{'include':[{'model':db[_0x577c('0x99')],'as':_0x577c('0xb6')}]});})['then'](respondWithResult(_0x1db648,null))['catch'](handleError(_0x1db648,null));};exports['verifySmtp']=function(_0x2209c1,_0x17ce6e){return db['MailAccount'][_0x577c('0x68')]({'where':{'id':_0x2209c1['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x577c('0x44'),'raw':!![],'include':[{'model':db[_0x577c('0xa4')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x17ce6e,null))[_0x577c('0x12')](function(_0x237072){if(!_0x237072['Smtp'])return;var _0x316081=_0x237072[_0x577c('0xac')]();return respondWithRpcPromise(_0x577c('0xb7'),'verifySmtp',{'account':_0x316081});})[_0x577c('0x12')](respondWithResult(_0x17ce6e,null))[_0x577c('0x1c')](handleError(_0x17ce6e,null));};exports[_0x577c('0x27')]=function(_0x40b418,_0x4ce332){return db[_0x577c('0x4a')][_0x577c('0x68')]({'where':{'id':_0x40b418[_0x577c('0x69')]['id']}})['then'](handleEntityNotFound(_0x4ce332,null))[_0x577c('0x12')](function(_0xb618ef){if(_0xb618ef&&_0xb618ef[_0x577c('0x40')]){throw new db[(_0x577c('0xb8'))]['ValidationError'](_0x577c('0xb9'));}return _0xb618ef;})['then'](removeEntity(_0x4ce332,null))['catch'](handleError(_0x4ce332,null));};exports[_0x577c('0xba')]=function(_0x245373,_0x335c0d){return db['MailAccount'][_0x577c('0x68')]({'where':{'id':_0x245373[_0x577c('0x69')]['id']}})['then'](handleEntityNotFound(_0x335c0d,null))[_0x577c('0x12')](function(_0x14c05c){if(_0x14c05c){return _0x14c05c[_0x577c('0xba')](_0x245373[_0x577c('0x65')][_0x577c('0x72')],_[_0x577c('0x85')](_0x245373[_0x577c('0x65')],[_0x577c('0x72'),'id'])||{})[_0x577c('0xbb')](function(_0xa52015){for(var _0xf0117a=0x0;_0xf0117a<_0x245373['body'][_0x577c('0x72')][_0x577c('0x56')];_0xf0117a+=0x1){socket[_0x577c('0xbc')](_0x577c('0xbd'),{'UserId':Number(_0x245373['body'][_0x577c('0x72')][_0xf0117a]),'MailAccountId':Number(_0x245373[_0x577c('0x69')]['id'])});}return _0xa52015;});}})[_0x577c('0x12')](respondWithResult(_0x335c0d,null))[_0x577c('0x1c')](handleError(_0x335c0d,null));};exports[_0x577c('0xbe')]=function(_0x5e246a,_0x1c9195){return db[_0x577c('0x4a')][_0x577c('0x68')]({'where':{'id':_0x5e246a[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x1c9195,null))[_0x577c('0x12')](function(_0x29bb11){if(_0x29bb11){return _0x29bb11[_0x577c('0xbe')](_0x5e246a[_0x577c('0x50')][_0x577c('0x72')])[_0x577c('0x12')](function(){if(_[_0x577c('0xbf')](_0x5e246a[_0x577c('0x50')][_0x577c('0x72')])){for(var _0x2a2027=0x0;_0x2a2027<_0x5e246a[_0x577c('0x50')][_0x577c('0x72')][_0x577c('0x56')];_0x2a2027+=0x1){socket[_0x577c('0xbc')](_0x577c('0xc0'),{'UserId':Number(_0x5e246a[_0x577c('0x50')]['ids'][_0x2a2027]),'MailAccountId':Number(_0x5e246a['params']['id'])});}}else{socket['emit'](_0x577c('0xc0'),{'UserId':Number(_0x5e246a[_0x577c('0x50')][_0x577c('0x72')]),'MailAccountId':Number(_0x5e246a[_0x577c('0x69')]['id'])});}});}})[_0x577c('0x12')](respondWithStatusCode(_0x1c9195,null))[_0x577c('0x1c')](handleError(_0x1c9195,null));};exports[_0x577c('0xc1')]=function(_0x378d1d,_0x5337a1){var _0x4109bc={};var _0x5e925a={};var _0x55ca6f;var _0x27d7fb;return db[_0x577c('0x4a')]['findOne']({'where':{'id':_0x378d1d[_0x577c('0x69')]['id']}})[_0x577c('0x12')](handleEntityNotFound(_0x5337a1,null))[_0x577c('0x12')](function(_0x524077){if(_0x524077){_0x55ca6f=_0x524077;_0x5e925a['model']=_[_0x577c('0x51')](db[_0x577c('0x88')][_0x577c('0x4b')]);_0x5e925a[_0x577c('0x50')]=_['keys'](_0x378d1d[_0x577c('0x50')]);_0x5e925a[_0x577c('0x64')]=_[_0x577c('0x54')](_0x5e925a['model'],_0x5e925a[_0x577c('0x50')]);_0x4109bc[_0x577c('0x53')]=_[_0x577c('0x54')](_0x5e925a[_0x577c('0x52')],qs[_0x577c('0x55')](_0x378d1d['query'][_0x577c('0x55')]));_0x4109bc[_0x577c('0x53')]=_0x4109bc['attributes']['length']?_0x4109bc[_0x577c('0x53')]:_0x5e925a[_0x577c('0x52')];_0x4109bc[_0x577c('0x59')]=qs[_0x577c('0x5a')](_0x378d1d[_0x577c('0x50')][_0x577c('0x5a')]);_0x4109bc[_0x577c('0x5b')]=qs[_0x577c('0x64')](_[_0x577c('0x5c')](_0x378d1d['query'],_0x5e925a[_0x577c('0x64')]));if(_0x378d1d[_0x577c('0x50')][_0x577c('0x5d')]){_0x4109bc['where']=_[_0x577c('0x5e')](_0x4109bc[_0x577c('0x5b')],{'$or':_[_0x577c('0x4f')](_0x4109bc[_0x577c('0x53')],function(_0xd7ecaa){var _0x162b3b={};_0x162b3b[_0xd7ecaa]={'$like':'%'+_0x378d1d[_0x577c('0x50')][_0x577c('0x5d')]+'%'};return _0x162b3b;})});}_0x4109bc=_['merge']({},_0x4109bc,_0x378d1d['options']);return _0x55ca6f[_0x577c('0xc1')](_0x4109bc);}})[_0x577c('0x12')](function(_0x469611){if(_0x469611){_0x27d7fb=_0x469611[_0x577c('0x56')];if(!_0x378d1d[_0x577c('0x50')]['hasOwnProperty'](_0x577c('0x58'))){_0x4109bc[_0x577c('0x23')]=qs[_0x577c('0x23')](_0x378d1d['query'][_0x577c('0x23')]);_0x4109bc[_0x577c('0x20')]=qs[_0x577c('0x20')](_0x378d1d['query'][_0x577c('0x20')]);}return _0x55ca6f['getAgents'](_0x4109bc);}})[_0x577c('0x12')](function(_0x596262){if(_0x596262){return _0x596262?{'count':_0x27d7fb,'rows':_0x596262}:null;}})[_0x577c('0x12')](respondWithResult(_0x5337a1,null))[_0x577c('0x1c')](handleError(_0x5337a1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 189bd9b..5799f90 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 _0xdfae=['save','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x4eb0b1,_0x1621ac){var _0x1b58bd=function(_0x30c4e5){while(--_0x30c4e5){_0x4eb0b1['push'](_0x4eb0b1['shift']());}};_0x1b58bd(++_0x1621ac);}(_0xdfae,0x18d));var _0xedfa=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xdfae[_0x173d7e];return _0x2220d6;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xedfa('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xedfa('0x1')](0x0);var events={'afterCreate':_0xedfa('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e681d){return function(_0x1e2767,_0x3db3ed,_0x449807){MailAccountEvents[_0xedfa('0x3')](_0x4e681d+':'+_0x1e2767['id'],_0x1e2767);MailAccountEvents[_0xedfa('0x3')](_0x4e681d,_0x1e2767);_0x449807(null);};}for(var e in events){if(events[_0xedfa('0x4')](e)){var event=events[e];MailAccount[_0xedfa('0x5')](e,emitEvent(event));}}module[_0xedfa('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xdd68=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','MailAccount'];(function(_0x387f20,_0x310d5e){var _0x5db212=function(_0x3c62ea){while(--_0x3c62ea){_0x387f20['push'](_0x387f20['shift']());}};_0x5db212(++_0x310d5e);}(_0xdd68,0x196));var _0x8dd6=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xdd68[_0x1bd323];return _0x13097b;};'use strict';var EventEmitter=require(_0x8dd6('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8dd6('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8dd6('0x2')](0x0);var events={'afterCreate':_0x8dd6('0x3'),'afterUpdate':_0x8dd6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37b71c){return function(_0x469e0c,_0x5c7c72,_0x310895){MailAccountEvents[_0x8dd6('0x5')](_0x37b71c+':'+_0x469e0c['id'],_0x469e0c);MailAccountEvents['emit'](_0x37b71c,_0x469e0c);_0x310895(null);};}for(var e in events){if(events[_0x8dd6('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x8dd6('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c3661b8..b4c6205 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 _0x10fe=['CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','authentication','modernAuthentication'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x10fe,0xfd));var _0xe10f=function(_0x91b8fb,_0x4ad0fd){_0x91b8fb=_0x91b8fb-0x0;var _0x3cabd6=_0x10fe[_0x91b8fb];return _0x3cabd6;};'use strict';var attributes=require(_0xe10f('0x0'));module[_0xe10f('0x1')]=function(_0x1f9fd1){return _0x1f9fd1[_0xe10f('0x2')](_0xe10f('0x3'),attributes,{'tableName':_0xe10f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1c61ad=this;var _0x17773c={'id':_0x1c61ad['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1c61ad[_0xe10f('0x5')]!=='custom'){_0x17773c[_0xe10f('0x6')]=_0x1c61ad[_0xe10f('0x5')];}else{_0x17773c[_0xe10f('0x7')]=_0x1c61ad[_0xe10f('0x8')][_0xe10f('0x7')];_0x17773c[_0xe10f('0x9')]=_0x1c61ad[_0xe10f('0x8')][_0xe10f('0x9')];_0x17773c[_0xe10f('0xa')]=_0x1c61ad['Smtp'][_0xe10f('0xa')];}if(_0x1c61ad[_0xe10f('0x8')][_0xe10f('0xb')]){if(_0x1c61ad[_0xe10f('0x8')][_0xe10f('0xc')]){if(!_0x1c61ad[_0xe10f('0x8')][_0xe10f('0xd')])throw new Error(_0xe10f('0xe'));_0x17773c[_0xe10f('0xf')]={'type':_0xe10f('0x10'),'user':_0x1c61ad[_0xe10f('0x8')][_0xe10f('0x11')],'accessToken':_0x1c61ad['Smtp'][_0xe10f('0xd')]['data5']};}else{_0x17773c[_0xe10f('0xf')]={'user':_0x1c61ad['Smtp']['user'],'pass':_0x1c61ad[_0xe10f('0x8')][_0xe10f('0x12')]};}}return _0x17773c;}}});}; \ No newline at end of file +var _0x0ebf=['MailAccount','mail_accounts','provider','custom','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','user','pass','./mailAccount.attributes','exports','define'];(function(_0x2246de,_0x9fa6f2){var _0x318c65=function(_0xab5ade){while(--_0xab5ade){_0x2246de['push'](_0x2246de['shift']());}};_0x318c65(++_0x9fa6f2);}(_0x0ebf,0x165));var _0xf0eb=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x0ebf[_0x40aaa4];return _0x4e21e5;};'use strict';var attributes=require(_0xf0eb('0x0'));module[_0xf0eb('0x1')]=function(_0xbfc0e3){return _0xbfc0e3[_0xf0eb('0x2')](_0xf0eb('0x3'),attributes,{'tableName':_0xf0eb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x38fc30=this;var _0x1e7263={'id':_0x38fc30['id'],'tls':{'rejectUnauthorized':![]}};if(_0x38fc30[_0xf0eb('0x5')]!==_0xf0eb('0x6')){_0x1e7263['service']=_0x38fc30[_0xf0eb('0x5')];}else{_0x1e7263[_0xf0eb('0x7')]=_0x38fc30[_0xf0eb('0x8')][_0xf0eb('0x7')];_0x1e7263['port']=_0x38fc30[_0xf0eb('0x8')][_0xf0eb('0x9')];_0x1e7263[_0xf0eb('0xa')]=_0x38fc30['Smtp'][_0xf0eb('0xa')];}if(_0x38fc30['Smtp'][_0xf0eb('0xb')]){if(_0x38fc30[_0xf0eb('0x8')][_0xf0eb('0xc')]){if(!_0x38fc30[_0xf0eb('0x8')][_0xf0eb('0xd')])throw new Error(_0xf0eb('0xe'));_0x1e7263[_0xf0eb('0xf')]={'type':_0xf0eb('0x10'),'user':_0x38fc30[_0xf0eb('0x8')]['user'],'accessToken':_0x38fc30[_0xf0eb('0x8')]['CloudProvider'][_0xf0eb('0x11')]};}else{_0x1e7263[_0xf0eb('0xf')]={'user':_0x38fc30[_0xf0eb('0x8')][_0xf0eb('0x12')],'pass':_0x38fc30['Smtp'][_0xf0eb('0x13')]};}}return _0x1e7263;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 8ec219f..76dcdc2 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 _0x187d=['account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','list','applications','orderBy','priority','autoclose','length','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','update','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','model','map','debug','ShowMailAccount','find','where','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x64f59a,_0x549247){var _0x54ff1d=function(_0x20217d){while(--_0x20217d){_0x64f59a['push'](_0x64f59a['shift']());}};_0x54ff1d(++_0x549247);}(_0x187d,0x93));var _0xd187=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x187d[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xd187('0x0'));var moment=require('moment');var BPromise=require(_0xd187('0x1'));var rs=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var db=require(_0xd187('0x4'))['db'];var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var jayson=require(_0xd187('0x7'));var client=jayson[_0xd187('0x8')]['http']({'port':0x232c});config[_0xd187('0x9')]=_[_0xd187('0xa')](config[_0xd187('0x9')],{'host':_0xd187('0xb'),'port':0x18eb});var socket=require(_0xd187('0xc'))(new Redis(config[_0xd187('0x9')]));require(_0xd187('0xd'))[_0xd187('0xe')](socket);function respondWithRpcPromise(_0x5b480f,_0x342539,_0x42848b){return new BPromise(function(_0x4039f6,_0x473866){return client[_0xd187('0xf')](_0x5b480f,_0x42848b)[_0xd187('0x10')](function(_0x59c194){logger[_0xd187('0x11')](_0xd187('0x12'),_0x342539,_0xd187('0x13'));logger['debug'](_0xd187('0x14'),_0x342539,_0xd187('0x13'),JSON[_0xd187('0x15')](_0x59c194));if(_0x59c194['error']){if(_0x59c194[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x59c194['error'][_0xd187('0x18')]);return _0x473866(_0x59c194[_0xd187('0x16')][_0xd187('0x18')]);}logger[_0xd187('0x16')]('MailAccount,\x20%s,\x20%s',_0x342539,_0x59c194[_0xd187('0x16')]['message']);return _0x4039f6(_0x59c194['error'][_0xd187('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x342539,_0xd187('0x13'));_0x4039f6(_0x59c194[_0xd187('0x19')][_0xd187('0x18')]);}})[_0xd187('0x1a')](function(_0x21df74){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x21df74);_0x473866(_0x21df74);});});}exports[_0xd187('0x1b')]=function(_0x4f2f88){var _0x46fca3=this;return new Promise(function(_0x170d5c,_0x11b2a1){return db[_0xd187('0x1c')]['findAll']({'raw':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f2f88['options']?_0x4f2f88['options']['where']||null:null,'attributes':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'limit':_0x4f2f88['options']?_0x4f2f88[_0xd187('0x1d')]['limit']||null:null,'include':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88['options'][_0xd187('0x20')]?_['map'](_0x4f2f88['options'][_0xd187('0x20')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x21')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1f')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x20')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x21')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1f')],'include':_0xeff822['include']?_[_0xd187('0x22')](_0xeff822[_0xd187('0x20')],function(_0x5c8e52){return{'model':db[_0x5c8e52[_0xd187('0x21')]],'as':_0x5c8e52['as'],'attributes':_0x5c8e52[_0xd187('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x4c50a5){logger[_0xd187('0x11')]('GetMailAccount',_0x4f2f88);logger[_0xd187('0x23')](_0xd187('0x1b'),_0x4f2f88,JSON[_0xd187('0x15')](_0x4c50a5));_0x170d5c(_0x4c50a5);})[_0xd187('0x1a')](function(_0x489f2e){logger[_0xd187('0x16')](_0xd187('0x1b'),_0x489f2e['message'],_0x4f2f88);_0x11b2a1(_0x46fca3['error'](0x1f4,_0x489f2e[_0xd187('0x18')]));});});};exports[_0xd187('0x24')]=function(_0x13f285){var _0x481346=this;return new Promise(function(_0x2874b2,_0x2d8843){return db[_0xd187('0x1c')][_0xd187('0x25')]({'raw':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x13f285[_0xd187('0x1d')]?_0x13f285['options'][_0xd187('0x26')]||null:null,'attributes':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'include':_0x13f285[_0xd187('0x1d')]?_0x13f285['options']['include']?_[_0xd187('0x22')](_0x13f285[_0xd187('0x1d')]['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x21')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1f')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x20')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes'],'include':_0xf32da2['include']?_[_0xd187('0x22')](_0xf32da2['include'],function(_0x28c252){return{'model':db[_0x28c252[_0xd187('0x21')]],'as':_0x28c252['as'],'attributes':_0x28c252['attributes']};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x5674ca){if(_0x13f285[_0xd187('0x1d')][_0xd187('0x27')]===!![])_0x5674ca['setDataValue'](_0xd187('0x28'),_0x5674ca[_0xd187('0x29')]());logger['info'](_0xd187('0x24'),_0x13f285);logger['debug']('ShowMailAccount',_0x13f285,JSON[_0xd187('0x15')](_0x5674ca));_0x2874b2(_0x5674ca);})[_0xd187('0x1a')](function(_0xdecb24){logger[_0xd187('0x16')](_0xd187('0x24'),_0xdecb24['message'],_0x13f285);_0x2d8843(_0x481346[_0xd187('0x16')](0x1f4,_0xdecb24[_0xd187('0x18')]));});});};exports[_0xd187('0x2a')]=function(_0x4f3139){var _0x4b121c=this;return new Promise(function(_0x538c05,_0x595195){var _0x21bb3c={'body':_0x4f3139[_0xd187('0x2b')],'channel':_0xd187('0x2c')};var _0x367303=_[_0xd187('0x2d')](_[_0xd187('0x2e')](db[_0xd187('0x2f')][_0xd187('0x30')]),['createdAt',_0xd187('0x31'),_0xd187('0x32'),_0xd187('0x33')]);var _0x51c7fc=![];if(_0x4f3139[_0xd187('0x2b')]['id']){delete _0x4f3139['body']['id'];}if(_[_0xd187('0x34')](_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0xd187('0x36')));}if(_['isNil'](_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')])||_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')]===''){return _0x595195(_0x4b121c['error'](0x1f4,_0xd187('0x37')));}if(_[_0xd187('0x34')](_0x4f3139['body'][_0xd187('0x38')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}if(!_['includes'](_0x367303,_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')])){return _0x595195(_0x4b121c['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}var _0x4f616d={};_0x4f616d[_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')];return db[_0xd187('0x1c')][_0xd187('0x25')]({'where':{'id':_0x4f3139[_0xd187('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xd187('0x3a'),'include':[{'model':db[_0xd187('0x2f')],'as':_0xd187('0x3b'),'where':_0x4f616d,'limit':0x1,'order':[[_0xd187('0x31'),_0xd187('0x3c')]]}]},{'model':db[_0xd187('0x3d')],'as':_0xd187('0x3e')},{'model':db[_0xd187('0x3f')],'as':'Smtp','include':[{'model':db[_0xd187('0x40')],'as':_0xd187('0x40')}]}]})[_0xd187('0x10')](function(_0x1449d7){if(_0x1449d7&&_0x1449d7[_0xd187('0x3a')]){var _0x5ad646=_0x1449d7[_0xd187('0x41')]({'plain':!![]});_0x21bb3c[_0xd187('0x39')]=_['omit'](_0x5ad646,[_0xd187('0x3e'),_0xd187('0x3a')]);_0x21bb3c['account']['smtpOptions']=_0x1449d7['getSmtpOptions']();_0x21bb3c['applications']=_0x5ad646[_0xd187('0x3e')];_0x21bb3c[_0xd187('0x42')]=_0x5ad646[_0xd187('0x3a')];_0x21bb3c[_0xd187('0x43')]=_[_0xd187('0x44')](_0x21bb3c[_0xd187('0x43')],[_0xd187('0x45')],['asc']);if(_0x21bb3c[_0xd187('0x39')]&&_0x21bb3c[_0xd187('0x39')][_0xd187('0x46')]){_0x21bb3c[_0xd187('0x43')]['push']({'id':0x0,'priority':_0x21bb3c[_0xd187('0x43')]['length']+0x1,'app':'close','appdata':_0xd187('0x46'),'interval':'*,*,*,*'});}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')];}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')];}if(_0x5ad646[_0xd187('0x3a')]['Contacts'][_0xd187('0x47')]){return _0x5ad646[_0xd187('0x3a')]['Contacts'][0x0];}var _0x471f11=_[_0xd187('0xa')](_0x4f3139[_0xd187('0x2b')],{'firstName':_0x4f3139['body'][_0xd187('0x35')],'ListId':_0x5ad646[_0xd187('0x33')]});_0x471f11[_0x4f3139['body'][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')]['from'];return db[_0xd187('0x2f')]['create'](_0x471f11);}else{throw new Error(_0xd187('0x48'));}})[_0xd187('0x10')](function(_0x3a2a00){_0x21bb3c[_0xd187('0x49')]=_0x3a2a00;if(_0x3a2a00){if(!_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')]){_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x4a')]=rs[_0xd187('0x4b')]()+'\x20'+_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')];}var _0x945810={'ContactId':_0x3a2a00['id'],'MailAccountId':_0x4f3139[_0xd187('0x39')]['id'],'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4c')],'attach':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd187('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f3139['account']['id']},'include':[{'model':db[_0xd187('0x50')],'as':_0xd187('0x51'),'attributes':[_0xd187('0x4a')],'where':{'messageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x52')]}}]})[_0xd187('0x10')](function(_0x4f89a6){if(_0x4f89a6){return[_0x4f89a6,![]];}return db['MailInteraction'][_0xd187('0x53')](_0x945810)[_0xd187('0x10')](function(_0x2870ad){return[_0x2870ad,!![]];});});}else{throw new Error(_0xd187('0x54'));}})['spread'](function(_0x2c1df4,_0x49543f){if(_0x2c1df4){_0x51c7fc=_0x49543f;if(!_0x49543f){return _0x2c1df4[_0xd187('0x55')]({'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')]['message']['subject'],'attach':_0x2c1df4[_0xd187('0x4d')]?_0x2c1df4[_0xd187('0x4d')]:_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'substatus':null,'substatusAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'});}else{return _0x2c1df4;}}})[_0xd187('0x10')](function(_0x379e89){_0x21bb3c[_0xd187('0x56')]=_0x379e89['get']({'plain':!![]});_0x21bb3c[_0xd187('0x56')][_0xd187('0x57')]=_0x51c7fc;return db['MailMessage'][_0xd187('0x53')]({'body':_0x4f3139[_0xd187('0x2b')]['body'],'MailAccountId':_0x4f3139['account']['id'],'MailInteractionId':_0x379e89['id'],'direction':'in','ContactId':_0x21bb3c[_0xd187('0x49')]['id'],'messageId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'from':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'to':_0x4f3139['body']['message']['to'],'cc':_0x4f3139[_0xd187('0x2b')]['message']['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['subject'],'attach':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x4d')],'Attachments':_0x4f3139['body']['message']['attachments'],'originTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x58')],'originCc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x59')],'bcc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['bcc'],'ChatWebsiteId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x5a')]||null,'originChannel':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x5b')]||_0xd187('0x5c'),'ChatOfflineMessageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x5d')]||null},{'include':[{'model':db[_0xd187('0x5e')],'as':'Attachments'}]});})[_0xd187('0x10')](function(_0x3afdd9){_0x21bb3c[_0xd187('0x18')]=_0x3afdd9;if(_0x21bb3c[_0xd187('0x56')]['UserId']){return db[_0xd187('0x5f')][_0xd187('0x25')]({'attributes':['id','name'],'where':{'id':_0x21bb3c[_0xd187('0x56')]['UserId']}})['then'](function(_0x506c53){if(_0x506c53){_0x21bb3c[_0xd187('0x43')][_0xd187('0x60')]({'id':0x0,'priority':0x0,'app':_0xd187('0x61'),'appdata':_0x506c53[_0xd187('0x62')]+','+(_0x21bb3c[_0xd187('0x39')][_0xd187('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd187('0x64'),_0xd187('0x65'),_0x21bb3c);});}return respondWithRpcPromise('Start','startRouting',_0x21bb3c);})[_0xd187('0x10')](function(_0x3e1c19){_0x538c05(_0x3e1c19);})[_0xd187('0x1a')](function(_0x1f163a){_0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0x1f163a[_0xd187('0x18')]));});});}; \ No newline at end of file +var _0x9f0e=['updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','Applications','MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','orderBy','asc','autoclose','push','close','*,*,*,*','length','defaults','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','create','Contact\x20not\x20found','update','interaction','created','MailMessage','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact'];(function(_0x4709f3,_0x1b7a22){var _0x2e76ba=function(_0x9f8572){while(--_0x9f8572){_0x4709f3['push'](_0x4709f3['shift']());}};_0x2e76ba(++_0x1b7a22);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3205c0,_0x36e6a0){_0x3205c0=_0x3205c0-0x0;var _0x38995f=_0x9f0e[_0x3205c0];return _0x38995f;};'use strict';var _=require(_0xe9f0('0x0'));var moment=require(_0xe9f0('0x1'));var BPromise=require(_0xe9f0('0x2'));var rs=require(_0xe9f0('0x3'));var Redis=require(_0xe9f0('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var jayson=require(_0xe9f0('0x7'));var client=jayson[_0xe9f0('0x8')][_0xe9f0('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0xe9f0('0xa')],{'host':_0xe9f0('0xb'),'port':0x18eb});var socket=require(_0xe9f0('0xc'))(new Redis(config['redis']));require(_0xe9f0('0xd'))[_0xe9f0('0xe')](socket);function respondWithRpcPromise(_0x20d602,_0x3386a8,_0xa523c0){return new BPromise(function(_0x240932,_0x807322){return client[_0xe9f0('0xf')](_0x20d602,_0xa523c0)[_0xe9f0('0x10')](function(_0x5352e0){logger[_0xe9f0('0x11')](_0xe9f0('0x12'),_0x3386a8,_0xe9f0('0x13'));logger['debug'](_0xe9f0('0x14'),_0x3386a8,'request\x20sent',JSON[_0xe9f0('0x15')](_0x5352e0));if(_0x5352e0[_0xe9f0('0x16')]){if(_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x17')]===0x1f4){logger['error'](_0xe9f0('0x12'),_0x3386a8,_0x5352e0['error'][_0xe9f0('0x18')]);return _0x807322(_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x18')]);}logger['error'](_0xe9f0('0x12'),_0x3386a8,_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x18')]);return _0x240932(_0x5352e0['error'][_0xe9f0('0x18')]);}else{logger[_0xe9f0('0x11')](_0xe9f0('0x12'),_0x3386a8,_0xe9f0('0x13'));_0x240932(_0x5352e0[_0xe9f0('0x19')][_0xe9f0('0x18')]);}})[_0xe9f0('0x1a')](function(_0x59bf5a){logger[_0xe9f0('0x16')](_0xe9f0('0x12'),_0x3386a8,_0x59bf5a);_0x807322(_0x59bf5a);});});}exports[_0xe9f0('0x1b')]=function(_0x5c4182){var _0x35e841=this;return new Promise(function(_0x30b8c7,_0x1698cf){return db[_0xe9f0('0x1c')]['findAll']({'raw':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c4182['options']?_0x5c4182['options'][_0xe9f0('0x1e')]||null:null,'attributes':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x1f')]||null:null,'limit':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182['options'][_0xe9f0('0x20')]||null:null,'include':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x21')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x23')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x22')](_0x1321bb[_0xe9f0('0x21')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x23')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes'],'include':_0x2ddfba[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x2ddfba[_0xe9f0('0x21')],function(_0x1f98a7){return{'model':db[_0x1f98a7[_0xe9f0('0x23')]],'as':_0x1f98a7['as'],'attributes':_0x1f98a7['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0x10')](function(_0xdc16bc){logger[_0xe9f0('0x11')](_0xe9f0('0x1b'),_0x5c4182);logger[_0xe9f0('0x24')](_0xe9f0('0x1b'),_0x5c4182,JSON[_0xe9f0('0x15')](_0xdc16bc));_0x30b8c7(_0xdc16bc);})[_0xe9f0('0x1a')](function(_0x2b6503){logger[_0xe9f0('0x16')](_0xe9f0('0x1b'),_0x2b6503[_0xe9f0('0x18')],_0x5c4182);_0x1698cf(_0x35e841[_0xe9f0('0x16')](0x1f4,_0x2b6503[_0xe9f0('0x18')]));});});};exports[_0xe9f0('0x25')]=function(_0x2097c4){var _0x80e3ac=this;return new Promise(function(_0x3e1846,_0x2e7535){return db[_0xe9f0('0x1c')][_0xe9f0('0x26')]({'raw':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4[_0xe9f0('0x1d')][_0xe9f0('0x27')]===undefined?!![]:![]:!![],'where':_0x2097c4['options']?_0x2097c4['options']['where']||null:null,'attributes':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4['options'][_0xe9f0('0x1f')]||null:null,'include':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4['options'][_0xe9f0('0x21')]?_['map'](_0x2097c4['options']['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x23')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x165440[_0xe9f0('0x21')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')],'include':_0x4d4186[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x4d4186['include'],function(_0x3ca032){return{'model':db[_0x3ca032[_0xe9f0('0x23')]],'as':_0x3ca032['as'],'attributes':_0x3ca032[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0x10')](function(_0x2b38de){if(_0x2097c4['options'][_0xe9f0('0x28')]===!![])_0x2b38de[_0xe9f0('0x29')](_0xe9f0('0x2a'),_0x2b38de['getSmtpOptions']());logger[_0xe9f0('0x11')](_0xe9f0('0x25'),_0x2097c4);logger['debug'](_0xe9f0('0x25'),_0x2097c4,JSON['stringify'](_0x2b38de));_0x3e1846(_0x2b38de);})[_0xe9f0('0x1a')](function(_0x55c0bd){logger['error']('ShowMailAccount',_0x55c0bd['message'],_0x2097c4);_0x2e7535(_0x80e3ac['error'](0x1f4,_0x55c0bd[_0xe9f0('0x18')]));});});};exports[_0xe9f0('0x2b')]=function(_0x2d8f93){var _0x40c2c6=this;return new Promise(function(_0x2560c6,_0xd9b61b){var _0x3d4eb7={'body':_0x2d8f93[_0xe9f0('0x2c')],'channel':_0xe9f0('0x2d')};var _0x4e1c68=_[_0xe9f0('0x2e')](_[_0xe9f0('0x2f')](db[_0xe9f0('0x30')]['rawAttributes']),['createdAt',_0xe9f0('0x31'),'CompanyId',_0xe9f0('0x32')]);var _0x52613a=![];if(_0x2d8f93[_0xe9f0('0x2c')]['id']){delete _0x2d8f93[_0xe9f0('0x2c')]['id'];}if(_['isNil'](_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')])){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x34')));}if(_[_0xe9f0('0x35')](_0x2d8f93['body'][_0xe9f0('0x2c')])||_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x2c')]===''){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x36')));}if(_['isNil'](_0x2d8f93[_0xe9f0('0x2c')]['mapKey'])){return _0xd9b61b(_0x40c2c6['error'](0x1f4,_0xe9f0('0x37')+_0x4e1c68));}if(!_[_0xe9f0('0x38')](_0x4e1c68,_0x2d8f93['body'][_0xe9f0('0x39')])){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x3a')+_0x4e1c68));}var _0x7b167b={};_0x7b167b[_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x39')]]=_0x2d8f93[_0xe9f0('0x2c')]['from'];return db[_0xe9f0('0x1c')]['find']({'where':{'id':_0x2d8f93[_0xe9f0('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0xe9f0('0x3c'),'include':[{'model':db['CmContact'],'as':_0xe9f0('0x3d'),'where':_0x7b167b,'limit':0x1,'order':[[_0xe9f0('0x31'),_0xe9f0('0x3e')]]}]},{'model':db['MailApplication'],'as':_0xe9f0('0x3f')},{'model':db[_0xe9f0('0x40')],'as':_0xe9f0('0x41'),'include':[{'model':db[_0xe9f0('0x42')],'as':_0xe9f0('0x42')}]}]})[_0xe9f0('0x10')](function(_0x6ece3f){if(_0x6ece3f&&_0x6ece3f[_0xe9f0('0x3c')]){var _0x18fc2b=_0x6ece3f[_0xe9f0('0x43')]({'plain':!![]});_0x3d4eb7[_0xe9f0('0x3b')]=_[_0xe9f0('0x44')](_0x18fc2b,['Applications','List']);_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x2a')]=_0x6ece3f[_0xe9f0('0x45')]();_0x3d4eb7['applications']=_0x18fc2b[_0xe9f0('0x3f')];_0x3d4eb7['list']=_0x18fc2b[_0xe9f0('0x3c')];_0x3d4eb7[_0xe9f0('0x46')]=_[_0xe9f0('0x47')](_0x3d4eb7[_0xe9f0('0x46')],['priority'],[_0xe9f0('0x48')]);if(_0x3d4eb7[_0xe9f0('0x3b')]&&_0x3d4eb7['account'][_0xe9f0('0x49')]){_0x3d4eb7[_0xe9f0('0x46')][_0xe9f0('0x4a')]({'id':0x0,'priority':_0x3d4eb7[_0xe9f0('0x46')]['length']+0x1,'app':_0xe9f0('0x4b'),'appdata':_0xe9f0('0x49'),'interval':_0xe9f0('0x4c')});}if(_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3f')]){delete _0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3f')];}if(_0x3d4eb7[_0xe9f0('0x3b')]['List']){delete _0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3c')];}if(_0x18fc2b[_0xe9f0('0x3c')][_0xe9f0('0x3d')][_0xe9f0('0x4d')]){return _0x18fc2b[_0xe9f0('0x3c')][_0xe9f0('0x3d')][0x0];}var _0xec9b3c=_[_0xe9f0('0x4e')](_0x2d8f93[_0xe9f0('0x2c')],{'firstName':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')],'ListId':_0x18fc2b[_0xe9f0('0x32')]});_0xec9b3c[_0x2d8f93[_0xe9f0('0x2c')]['mapKey']]=_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')];return db[_0xe9f0('0x30')]['create'](_0xec9b3c);}else{throw new Error('List\x20not\x20found');}})[_0xe9f0('0x10')](function(_0x57b904){_0x3d4eb7[_0xe9f0('0x4f')]=_0x57b904;if(_0x57b904){if(!_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['messageId']){_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x50')]=rs[_0xe9f0('0x51')]()+'\x20'+_0x2d8f93['body'][_0xe9f0('0x18')][_0xe9f0('0x33')];}var _0x28a66e={'ContactId':_0x57b904['id'],'MailAccountId':_0x2d8f93[_0xe9f0('0x3b')]['id'],'inReplyTo':_0x2d8f93['body']['message'][_0xe9f0('0x50')],'to':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x33')],'cc':_0x2d8f93[_0xe9f0('0x2c')]['message']['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x2d8f93['body'][_0xe9f0('0x18')][_0xe9f0('0x53')],'lastMsgAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgDirection':'in'};return db[_0xe9f0('0x56')]['find']({'where':{'closed':![],'MailAccountId':_0x2d8f93['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xe9f0('0x57'),'attributes':[_0xe9f0('0x50')],'where':{'messageId':_0x2d8f93['body'][_0xe9f0('0x18')]['inReplyTo']}}]})['then'](function(_0x156c65){if(_0x156c65){return[_0x156c65,![]];}return db[_0xe9f0('0x56')][_0xe9f0('0x58')](_0x28a66e)[_0xe9f0('0x10')](function(_0x1d2fb2){return[_0x1d2fb2,!![]];});});}else{throw new Error(_0xe9f0('0x59'));}})['spread'](function(_0x5e4ad4,_0x1255e6){if(_0x5e4ad4){_0x52613a=_0x1255e6;if(!_0x1255e6){return _0x5e4ad4[_0xe9f0('0x5a')]({'inReplyTo':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['messageId'],'to':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x33')],'cc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x5e4ad4[_0xe9f0('0x53')]?_0x5e4ad4[_0xe9f0('0x53')]:_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgDirection':'in'});}else{return _0x5e4ad4;}}})[_0xe9f0('0x10')](function(_0x42aab8){_0x3d4eb7[_0xe9f0('0x5b')]=_0x42aab8[_0xe9f0('0x43')]({'plain':!![]});_0x3d4eb7[_0xe9f0('0x5b')][_0xe9f0('0x5c')]=_0x52613a;return db[_0xe9f0('0x5d')][_0xe9f0('0x58')]({'body':_0x2d8f93['body'][_0xe9f0('0x2c')],'MailAccountId':_0x2d8f93[_0xe9f0('0x3b')]['id'],'MailInteractionId':_0x42aab8['id'],'direction':'in','ContactId':_0x3d4eb7[_0xe9f0('0x4f')]['id'],'messageId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x50')],'from':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x33')],'to':_0x2d8f93[_0xe9f0('0x2c')]['message']['to'],'cc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x53')],'Attachments':_0x2d8f93[_0xe9f0('0x2c')]['message']['attachments'],'originTo':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x5e')],'originCc':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x5f')],'bcc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x60')],'ChatWebsiteId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x61')]||null,'originChannel':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['originChannel']||_0xe9f0('0x62'),'ChatOfflineMessageId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x63')]||null},{'include':[{'model':db[_0xe9f0('0x64')],'as':_0xe9f0('0x65')}]});})[_0xe9f0('0x10')](function(_0x114033){_0x3d4eb7['message']=_0x114033;if(_0x3d4eb7[_0xe9f0('0x5b')][_0xe9f0('0x66')]){return db[_0xe9f0('0x67')][_0xe9f0('0x26')]({'attributes':['id',_0xe9f0('0x68')],'where':{'id':_0x3d4eb7[_0xe9f0('0x5b')]['UserId']}})[_0xe9f0('0x10')](function(_0x568a13){if(_0x568a13){_0x3d4eb7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xe9f0('0x69'),'appdata':_0x568a13[_0xe9f0('0x68')]+','+(_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x6a')]||0xa),'interval':_0xe9f0('0x4c')});}return respondWithRpcPromise(_0xe9f0('0x6b'),_0xe9f0('0x6c'),_0x3d4eb7);});}return respondWithRpcPromise(_0xe9f0('0x6b'),_0xe9f0('0x6c'),_0x3d4eb7);})['then'](function(_0x3b5047){_0x2560c6(_0x3b5047);})[_0xe9f0('0x1a')](function(_0xef6284){_0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xef6284[_0xe9f0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index d3a6ac0..098eaad 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 _0x89d9=['./mailAccount.events','save','update','emit','removeListener','register','length','mailAccount:'];(function(_0xc212ad,_0x3413d1){var _0x4df2b2=function(_0x16637d){while(--_0x16637d){_0xc212ad['push'](_0xc212ad['shift']());}};_0x4df2b2(++_0x3413d1);}(_0x89d9,0x1c0));var _0x989d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89d9[_0x122ef9];return _0x42fba0;};'use strict';var MailAccountEvents=require(_0x989d('0x0'));var events=[_0x989d('0x1'),'remove',_0x989d('0x2')];function createListener(_0x205d44,_0x5f55b4){return function(_0x57c9e8){_0x5f55b4[_0x989d('0x3')](_0x205d44,_0x57c9e8);};}function removeListener(_0x1defe5,_0x267226){return function(){MailAccountEvents[_0x989d('0x4')](_0x1defe5,_0x267226);};}exports[_0x989d('0x5')]=function(_0x3938d3){for(var _0x214e4f=0x0,_0x70ccd4=events[_0x989d('0x6')];_0x214e4f<_0x70ccd4;_0x214e4f++){var _0x21e60f=events[_0x214e4f];var _0x2e1327=createListener(_0x989d('0x7')+_0x21e60f,_0x3938d3);MailAccountEvents['on'](_0x21e60f,_0x2e1327);}}; \ No newline at end of file +var _0x43fa=['./mailAccount.events','update','emit','removeListener','length','mailAccount:'];(function(_0x487d56,_0x1d4a80){var _0x3f409f=function(_0x212b88){while(--_0x212b88){_0x487d56['push'](_0x487d56['shift']());}};_0x3f409f(++_0x1d4a80);}(_0x43fa,0x15c));var _0xa43f=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x43fa[_0x35da42];return _0x370035;};'use strict';var MailAccountEvents=require(_0xa43f('0x0'));var events=['save','remove',_0xa43f('0x1')];function createListener(_0x2f1c77,_0x535eb9){return function(_0x22276a){_0x535eb9[_0xa43f('0x2')](_0x2f1c77,_0x22276a);};}function removeListener(_0x5d61a4,_0x391031){return function(){MailAccountEvents[_0xa43f('0x3')](_0x5d61a4,_0x391031);};}exports['register']=function(_0x2867d0){for(var _0x597a3d=0x0,_0x1f2bd1=events[_0xa43f('0x4')];_0x597a3d<_0x1f2bd1;_0x597a3d++){var _0x251a46=events[_0x597a3d];var _0x2e56e3=createListener(_0xa43f('0x5')+_0x251a46,_0x2867d0);MailAccountEvents['on'](_0x251a46,_0x2e56e3);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 55d3cb4..d3d4265 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 _0x34e9=['show','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x34e9,0x105));var _0x934e=function(_0x5e7fd9,_0x46c9e4){_0x5e7fd9=_0x5e7fd9-0x0;var _0x53b047=_0x34e9[_0x5e7fd9];return _0x53b047;};'use strict';var multer=require(_0x934e('0x0'));var util=require('util');var path=require(_0x934e('0x1'));var timeout=require('connect-timeout');var express=require(_0x934e('0x2'));var router=express['Router']();var fs_extra=require(_0x934e('0x3'));var auth=require(_0x934e('0x4'));var interaction=require(_0x934e('0x5'));var config=require(_0x934e('0x6'));var controller=require(_0x934e('0x7'));router[_0x934e('0x8')](_0x934e('0x9'),auth[_0x934e('0xa')](),controller[_0x934e('0xb')]);router[_0x934e('0xc')]('/:id',auth[_0x934e('0xa')](),controller[_0x934e('0xd')]);router[_0x934e('0xe')](_0x934e('0x9'),auth[_0x934e('0xa')](),controller[_0x934e('0xf')]);module[_0x934e('0x10')]=router; \ No newline at end of file +var _0x679c=['express','Router','fs-extra','../../components/auth/service','./mailApplication.controller','/:id','isAuthenticated','show','update','delete','exports','multer','util','connect-timeout'];(function(_0x3acda3,_0x4c5190){var _0x24d20e=function(_0x21ba9d){while(--_0x21ba9d){_0x3acda3['push'](_0x3acda3['shift']());}};_0x24d20e(++_0x4c5190);}(_0x679c,0xeb));var _0xc679=function(_0x414c46,_0x54e5f2){_0x414c46=_0x414c46-0x0;var _0x2cbb80=_0x679c[_0x414c46];return _0x2cbb80;};'use strict';var multer=require(_0xc679('0x0'));var util=require(_0xc679('0x1'));var path=require('path');var timeout=require(_0xc679('0x2'));var express=require(_0xc679('0x3'));var router=express[_0xc679('0x4')]();var fs_extra=require(_0xc679('0x5'));var auth=require(_0xc679('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc679('0x7'));router['get'](_0xc679('0x8'),auth[_0xc679('0x9')](),controller[_0xc679('0xa')]);router['put'](_0xc679('0x8'),auth['isAuthenticated'](),controller[_0xc679('0xb')]);router[_0xc679('0xc')](_0xc679('0x8'),auth[_0xc679('0x9')](),controller['destroy']);module[_0xc679('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index dd9ab4d..c2ea1ca 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 _0xa341=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xa341,0xd3));var _0x1a34=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa341[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1a34('0x0'));module[_0x1a34('0x1')]={'priority':{'type':Sequelize[_0x1a34('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1a34('0x3')],'allowNull':![],'defaultValue':_0x1a34('0x4')},'appdata':{'type':Sequelize[_0x1a34('0x5')]()},'description':{'type':Sequelize[_0x1a34('0x3')]},'interval':{'type':Sequelize[_0x1a34('0x3')],'defaultValue':_0x1a34('0x6')}}; \ No newline at end of file +var _0x9559=['sequelize','INTEGER','STRING','noop'];(function(_0xf3fb4e,_0x1f8665){var _0x561bdb=function(_0x2a538c){while(--_0x2a538c){_0xf3fb4e['push'](_0xf3fb4e['shift']());}};_0x561bdb(++_0x1f8665);}(_0x9559,0x1ec));var _0x9955=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0x9559[_0x1d5ba8];return _0x1022a2;};'use strict';var Sequelize=require(_0x9955('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9955('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9955('0x2')],'allowNull':![],'defaultValue':_0x9955('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9955('0x2')]},'interval':{'type':Sequelize[_0x9955('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4089348..174b020 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x2a3f3a,_0x547776){var _0x316da0=function(_0x1f3c22){while(--_0x1f3c22){_0x2a3f3a['push'](_0x2a3f3a['shift']());}};_0x316da0(++_0x547776);}(_0xac4a,0x13f));var _0xaac4=function(_0x181a32,_0x5ad481){_0x181a32=_0x181a32-0x0;var _0x4cb7c0=_0xac4a[_0x181a32];return _0x4cb7c0;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','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','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x4b8481,_0x4041f6){var _0x37458e=function(_0x5b19e8){while(--_0x5b19e8){_0x4b8481['push'](_0x4b8481['shift']());}};_0x37458e(++_0x4041f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xcb91[_0x2d994d];return _0xd54be4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index eef3cfc..54cd680 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 _0x010c=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','MailApplication','mail_applications'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0x010c,0x1be));var _0xc010=function(_0x267acc,_0x273cc8){_0x267acc=_0x267acc-0x0;var _0xc745d1=_0x010c[_0x267acc];return _0xc745d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc010('0x0'))(_0xc010('0x1'));var moment=require(_0xc010('0x2'));var BPromise=require(_0xc010('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc010('0x4'));var rimraf=require(_0xc010('0x5'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0xc010('0x6')]=function(_0x4fffe6,_0x415da5){return _0x4fffe6[_0xc010('0x7')](_0xc010('0x8'),attributes,{'tableName':_0xc010('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc010('0xa'),'collate':_0xc010('0xb')});}; \ No newline at end of file +var _0x0c26=['exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes'];(function(_0x49de0e,_0x36b5e0){var _0x1eee45=function(_0x326fc0){while(--_0x326fc0){_0x49de0e['push'](_0x49de0e['shift']());}};_0x1eee45(++_0x36b5e0);}(_0x0c26,0x140));var _0x60c2=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x0c26[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x60c2('0x0'));var util=require(_0x60c2('0x1'));var logger=require(_0x60c2('0x2'))(_0x60c2('0x3'));var moment=require(_0x60c2('0x4'));var BPromise=require(_0x60c2('0x5'));var rp=require(_0x60c2('0x6'));var fs=require('fs');var path=require(_0x60c2('0x7'));var rimraf=require(_0x60c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x60c2('0x9'));module[_0x60c2('0xa')]=function(_0x1d7838,_0x2c697c){return _0x1d7838['define'](_0x60c2('0xb'),attributes,{'tableName':_0x60c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60c2('0xd'),'collate':_0x60c2('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d8060ef..d8af290 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 _0x2580=['error','message','result','catch','UpdateMailApplication','MailApplication','body','options','where','attributes','limit','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4862a0,_0x50b02a){var _0x529dfb=function(_0x3cee58){while(--_0x3cee58){_0x4862a0['push'](_0x4862a0['shift']());}};_0x529dfb(++_0x50b02a);}(_0x2580,0x156));var _0x0258=function(_0x45d845,_0x4e6e15){_0x45d845=_0x45d845-0x0;var _0x429193=_0x2580[_0x45d845];return _0x429193;};'use strict';var _=require(_0x0258('0x0'));var util=require(_0x0258('0x1'));var moment=require(_0x0258('0x2'));var BPromise=require('bluebird');var rs=require(_0x0258('0x3'));var fs=require('fs');var Redis=require(_0x0258('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0258('0x5'));var logger=require(_0x0258('0x6'))(_0x0258('0x7'));var config=require(_0x0258('0x8'));var jayson=require(_0x0258('0x9'));var client=jayson[_0x0258('0xa')][_0x0258('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bcf82,_0x230034,_0xdf9108){return new BPromise(function(_0x4e5e8a,_0x1f1431){return client['request'](_0x3bcf82,_0xdf9108)[_0x0258('0xc')](function(_0x4302ec){logger[_0x0258('0xd')](_0x0258('0xe'),_0x230034,_0x0258('0xf'));logger['debug'](_0x0258('0x10'),_0x230034,_0x0258('0xf'),JSON[_0x0258('0x11')](_0x4302ec));if(_0x4302ec[_0x0258('0x12')]){if(_0x4302ec[_0x0258('0x12')]['code']===0x1f4){logger['error'](_0x0258('0xe'),_0x230034,_0x4302ec[_0x0258('0x12')]['message']);return _0x1f1431(_0x4302ec['error']['message']);}logger[_0x0258('0x12')](_0x0258('0xe'),_0x230034,_0x4302ec[_0x0258('0x12')][_0x0258('0x13')]);return _0x4e5e8a(_0x4302ec[_0x0258('0x12')][_0x0258('0x13')]);}else{logger['info'](_0x0258('0xe'),_0x230034,_0x0258('0xf'));_0x4e5e8a(_0x4302ec[_0x0258('0x14')][_0x0258('0x13')]);}})[_0x0258('0x15')](function(_0x47130e){logger['error'](_0x0258('0xe'),_0x230034,_0x47130e);_0x1f1431(_0x47130e);});});}exports[_0x0258('0x16')]=function(_0x534564){var _0x239e6f=this;return new Promise(function(_0x41bd5c,_0x42740f){return db[_0x0258('0x17')]['update'](_0x534564[_0x0258('0x18')],{'raw':_0x534564[_0x0258('0x19')]?_0x534564[_0x0258('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x534564[_0x0258('0x19')]?_0x534564['options'][_0x0258('0x1a')]||null:null,'attributes':_0x534564['options']?_0x534564[_0x0258('0x19')][_0x0258('0x1b')]||null:null,'limit':_0x534564[_0x0258('0x19')]?_0x534564[_0x0258('0x19')][_0x0258('0x1c')]||null:null})['then'](function(_0x53144f){logger['info']('UpdateMailApplication',_0x534564);logger[_0x0258('0x1d')](_0x0258('0x16'),_0x534564,JSON[_0x0258('0x11')](_0x53144f));_0x41bd5c(_0x53144f);})['catch'](function(_0x3ac8bc){logger[_0x0258('0x12')]('UpdateMailApplication',_0x3ac8bc['message'],_0x534564);_0x42740f(_0x239e6f[_0x0258('0x12')](0x1f4,_0x3ac8bc[_0x0258('0x13')]));});});}; \ No newline at end of file +var _0x8135=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','stringify','lodash','util','bluebird'];(function(_0x31ad86,_0x2fce0e){var _0x5e3989=function(_0x5bc82c){while(--_0x5bc82c){_0x31ad86['push'](_0x31ad86['shift']());}};_0x5e3989(++_0x2fce0e);}(_0x8135,0x171));var _0x5813=function(_0x1ad40f,_0x2014a7){_0x1ad40f=_0x1ad40f-0x0;var _0x2b7ca9=_0x8135[_0x1ad40f];return _0x2b7ca9;};'use strict';var _=require(_0x5813('0x0'));var util=require(_0x5813('0x1'));var moment=require('moment');var BPromise=require(_0x5813('0x2'));var rs=require(_0x5813('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5813('0x4'));var logger=require(_0x5813('0x5'))(_0x5813('0x6'));var config=require(_0x5813('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5813('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x517898,_0x4fd2c8,_0x5c6798){return new BPromise(function(_0x32f39e,_0x209cb3){return client[_0x5813('0x9')](_0x517898,_0x5c6798)[_0x5813('0xa')](function(_0x5a4be3){logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));logger['debug'](_0x5813('0xe'),_0x4fd2c8,_0x5813('0xd'),JSON['stringify'](_0x5a4be3));if(_0x5a4be3[_0x5813('0xf')]){if(_0x5a4be3[_0x5813('0xf')][_0x5813('0x10')]===0x1f4){logger['error'](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x209cb3(_0x5a4be3[_0x5813('0xf')]['message']);}logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x32f39e(_0x5a4be3[_0x5813('0xf')][_0x5813('0x11')]);}else{logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));_0x32f39e(_0x5a4be3[_0x5813('0x12')]['message']);}})[_0x5813('0x13')](function(_0x16cbe5){logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x16cbe5);_0x209cb3(_0x16cbe5);});});}exports['UpdateMailApplication']=function(_0x268a0b){var _0x125304=this;return new Promise(function(_0x30f9ff,_0x3efa13){return db[_0x5813('0x14')][_0x5813('0x15')](_0x268a0b[_0x5813('0x16')],{'raw':_0x268a0b['options']?_0x268a0b[_0x5813('0x17')][_0x5813('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268a0b[_0x5813('0x17')]?_0x268a0b[_0x5813('0x17')][_0x5813('0x19')]||null:null,'attributes':_0x268a0b[_0x5813('0x17')]?_0x268a0b[_0x5813('0x17')][_0x5813('0x1a')]||null:null,'limit':_0x268a0b[_0x5813('0x17')]?_0x268a0b[_0x5813('0x17')][_0x5813('0x1b')]||null:null})['then'](function(_0xc30b6b){logger['info'](_0x5813('0x1c'),_0x268a0b);logger[_0x5813('0x1d')](_0x5813('0x1c'),_0x268a0b,JSON[_0x5813('0x1e')](_0xc30b6b));_0x30f9ff(_0xc30b6b);})[_0x5813('0x13')](function(_0x32adfc){logger['error'](_0x5813('0x1c'),_0x32adfc['message'],_0x268a0b);_0x3efa13(_0x125304[_0x5813('0xf')](0x1f4,_0x32adfc[_0x5813('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d8744e1..97d59b4 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 _0x0fe8=['download','create','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','put','mailinteraction:update','update','delete','mail','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages'];(function(_0x527b58,_0x1d4d4a){var _0x44203a=function(_0x5610db){while(--_0x5610db){_0x527b58['push'](_0x527b58['shift']());}};_0x44203a(++_0x1d4d4a);}(_0x0fe8,0xc4));var _0x80fe=function(_0x5ece65,_0x2410d3){_0x5ece65=_0x5ece65-0x0;var _0x25f70f=_0x0fe8[_0x5ece65];return _0x25f70f;};'use strict';var express=require(_0x80fe('0x0'));var router=express[_0x80fe('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x80fe('0x2'));var controller=require(_0x80fe('0x3'));router[_0x80fe('0x4')]('/',auth[_0x80fe('0x5')](),controller['index']);router[_0x80fe('0x4')](_0x80fe('0x6'),auth['isAuthenticated'](),controller[_0x80fe('0x7')]);router[_0x80fe('0x4')](_0x80fe('0x8'),auth[_0x80fe('0x5')](),controller[_0x80fe('0x9')]);router[_0x80fe('0x4')](_0x80fe('0xa'),auth[_0x80fe('0x5')](),controller[_0x80fe('0xb')]);router['get']('/:id/download',auth[_0x80fe('0x5')](),controller[_0x80fe('0xc')]);router['post']('/',auth[_0x80fe('0x5')](),controller[_0x80fe('0xd')]);router[_0x80fe('0xe')](_0x80fe('0xa'),auth[_0x80fe('0x5')](),controller[_0x80fe('0xf')]);router[_0x80fe('0xe')](_0x80fe('0x10'),auth[_0x80fe('0x5')](),interaction[_0x80fe('0x11')]('mail',_0x80fe('0x12')),controller['addTags']);router[_0x80fe('0x13')](_0x80fe('0x8'),auth['isAuthenticated'](),interaction[_0x80fe('0x11')]('mail',_0x80fe('0x14')),controller[_0x80fe('0x15')]);router[_0x80fe('0x16')]('/:id',auth[_0x80fe('0x5')](),interaction[_0x80fe('0x11')](_0x80fe('0x17'),'mailinteraction:destroy'),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x80fe('0x18')]);module[_0x80fe('0x19')]=router; \ No newline at end of file +var _0x1c28=['delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x1c28,0x127));var _0x81c2=function(_0x584b8d,_0x90690d){_0x584b8d=_0x584b8d-0x0;var _0x46a9f4=_0x1c28[_0x584b8d];return _0x46a9f4;};'use strict';var express=require(_0x81c2('0x0'));var router=express[_0x81c2('0x1')]();var auth=require(_0x81c2('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x81c2('0x3'));router[_0x81c2('0x4')]('/',auth[_0x81c2('0x5')](),controller[_0x81c2('0x6')]);router['get'](_0x81c2('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x81c2('0x4')](_0x81c2('0x8'),auth[_0x81c2('0x5')](),controller[_0x81c2('0x9')]);router['get'](_0x81c2('0xa'),auth[_0x81c2('0x5')](),controller['getMessages']);router['get'](_0x81c2('0xb'),auth[_0x81c2('0x5')](),controller[_0x81c2('0xc')]);router[_0x81c2('0xd')]('/',auth[_0x81c2('0x5')](),controller[_0x81c2('0xe')]);router[_0x81c2('0xd')]('/:id/messages',auth['isAuthenticated'](),controller[_0x81c2('0xf')]);router['post'](_0x81c2('0x10'),auth[_0x81c2('0x5')](),interaction[_0x81c2('0x11')](_0x81c2('0x12'),_0x81c2('0x13')),controller[_0x81c2('0x14')]);router[_0x81c2('0x15')]('/:id',auth[_0x81c2('0x5')](),interaction[_0x81c2('0x11')](_0x81c2('0x12'),_0x81c2('0x16')),controller[_0x81c2('0x17')]);router[_0x81c2('0x18')](_0x81c2('0x8'),auth[_0x81c2('0x5')](),interaction[_0x81c2('0x11')](_0x81c2('0x12'),_0x81c2('0x19')),controller[_0x81c2('0x1a')]);router[_0x81c2('0x18')](_0x81c2('0x10'),auth[_0x81c2('0x5')](),controller[_0x81c2('0x1b')]);module[_0x81c2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b2d4231..6010125 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 _0xe7ef=['exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x4dc112,_0x4ea900){var _0x371a8f=function(_0x36efbb){while(--_0x36efbb){_0x4dc112['push'](_0x4dc112['shift']());}};_0x371a8f(++_0x4ea900);}(_0xe7ef,0x190));var _0xfe7e=function(_0x284dcf,_0x324ab3){_0x284dcf=_0x284dcf-0x0;var _0x5a7f42=_0xe7ef[_0x284dcf];return _0x5a7f42;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xfe7e('0x0')]={'closed':{'type':Sequelize[_0xfe7e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfe7e('0x2')]},'disposition':{'type':Sequelize[_0xfe7e('0x3')]},'secondDisposition':{'type':Sequelize[_0xfe7e('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfe7e('0x3')]},'note':{'type':Sequelize[_0xfe7e('0x3')]},'inReplyTo':{'type':Sequelize[_0xfe7e('0x3')](0x1fe)},'to':{'type':Sequelize[_0xfe7e('0x3')]},'cc':{'type':Sequelize[_0xfe7e('0x4')](_0xfe7e('0x5'))},'subject':{'type':Sequelize[_0xfe7e('0x4')]()},'attach':{'type':Sequelize[_0xfe7e('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfe7e('0x2')]},'substatus':{'type':Sequelize[_0xfe7e('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xfe7e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfe7e('0x6')]('in',_0xfe7e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfe7e('0x6')]('in',_0xfe7e('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfe7e('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x6f28=['iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x2bfd7f,_0x19ebb5){var _0x454754=function(_0x1e6bd2){while(--_0x1e6bd2){_0x2bfd7f['push'](_0x2bfd7f['shift']());}};_0x454754(++_0x19ebb5);}(_0x6f28,0x148));var _0x86f2=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x6f28[_0x912d27];return _0x31b918;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x86f2('0x0'));module['exports']={'closed':{'type':Sequelize[_0x86f2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x86f2('0x2')]},'disposition':{'type':Sequelize[_0x86f2('0x3')]},'secondDisposition':{'type':Sequelize[_0x86f2('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x86f2('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x86f2('0x3')]},'cc':{'type':Sequelize[_0x86f2('0x4')](_0x86f2('0x5'))},'subject':{'type':Sequelize[_0x86f2('0x4')]()},'attach':{'type':Sequelize[_0x86f2('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x86f2('0x2')]},'substatus':{'type':Sequelize[_0x86f2('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x86f2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x86f2('0x6')]('in',_0x86f2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x86f2('0x6')]('in',_0x86f2('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x86f2('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e16387f..4964244 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 _0xecd6=['params','model','keys','MailInteraction','filters','attributes','intersection','fields','length','includeAll','merge','options','create','body','find','describe','addMessage','ids','omit','getMessages','MailMessage','nolimit','sort','where','pick','MailInteractionId','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','rows','addTags','setTags','spread','Tag','emit','removeTags','download','unix','toString','root','files','tmp','server','attachments','transcript-%d-%s.zip','join','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','push','readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','util','lodash','juice','ioredis','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','getOptions','mail','query','catch','show'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0xecd6,0x19b));var _0x6ecd=function(_0x5b12cf,_0x4414a7){_0x5b12cf=_0x5b12cf-0x0;var _0x39ab39=_0xecd6[_0x5b12cf];return _0x39ab39;};'use strict';var emlformat=require(_0x6ecd('0x0'));var rimraf=require(_0x6ecd('0x1'));var zipdir=require(_0x6ecd('0x2'));var moment=require('moment');var BPromise=require(_0x6ecd('0x3'));var util=require(_0x6ecd('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x6ecd('0x5'));var juice=require(_0x6ecd('0x6'));var Redis=require(_0x6ecd('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x6ecd('0x8'));var db=require(_0x6ecd('0x9'))['db'];var htmlEntities=require(_0x6ecd('0xa'));config[_0x6ecd('0xb')]=_[_0x6ecd('0xc')](config[_0x6ecd('0xb')],{'host':_0x6ecd('0xd'),'port':0x18eb});var socket=require(_0x6ecd('0xe'))(new Redis(config[_0x6ecd('0xb')]));require(_0x6ecd('0xf'))[_0x6ecd('0x10')](socket);function respondWithStatusCode(_0x190352,_0x4692f8){_0x4692f8=_0x4692f8||0xcc;return function(_0x1f73b7){if(_0x1f73b7){return _0x190352[_0x6ecd('0x11')](_0x4692f8);}return _0x190352['status'](_0x4692f8)['end']();};}function respondWithResult(_0x4a1eb6,_0x5e2dde){_0x5e2dde=_0x5e2dde||0xc8;return function(_0x220165){if(_0x220165){return _0x4a1eb6[_0x6ecd('0x12')](_0x5e2dde)[_0x6ecd('0x13')](_0x220165);}};}function respondWithFilteredResult(_0x2d42a3,_0x1429f6){return function(_0x4069b6){if(_0x4069b6){var _0x2e65b7=typeof _0x1429f6[_0x6ecd('0x14')]===_0x6ecd('0x15')&&typeof _0x1429f6[_0x6ecd('0x16')]===_0x6ecd('0x15');var _0x533ad4=_0x4069b6['count'];var _0x25ee24=_0x2e65b7?0x0:_0x1429f6[_0x6ecd('0x14')];var _0x5657a9=_0x2e65b7?_0x4069b6[_0x6ecd('0x17')]:_0x1429f6[_0x6ecd('0x14')]+_0x1429f6[_0x6ecd('0x16')];var _0x9592eb;if(_0x5657a9>=_0x533ad4){_0x5657a9=_0x533ad4;_0x9592eb=0xc8;}else{_0x9592eb=0xce;}_0x2d42a3[_0x6ecd('0x12')](_0x9592eb);return _0x2d42a3['set']('Content-Range',_0x25ee24+'-'+_0x5657a9+'/'+_0x533ad4)[_0x6ecd('0x13')](_0x4069b6);}return null;};}function saveUpdates(_0x3a135b){return function(_0x1cbdd1){if(_0x1cbdd1){return _0x1cbdd1[_0x6ecd('0x18')](_0x3a135b)[_0x6ecd('0x19')](function(_0x79236d){return _0x79236d;});}return null;};}function removeEntity(_0x72497f){return function(_0x3a1795){if(_0x3a1795){return _0x3a1795[_0x6ecd('0x1a')]()[_0x6ecd('0x19')](function(){_0x72497f[_0x6ecd('0x12')](0xcc)[_0x6ecd('0x1b')]();});}};}function handleEntityNotFound(_0x588f0c){return function(_0x308139){if(!_0x308139){_0x588f0c[_0x6ecd('0x11')](0x194);}return _0x308139;};}function handleError(_0x1abd4a,_0x4694bf){_0x4694bf=_0x4694bf||0x1f4;return function(_0xad29f5){logger[_0x6ecd('0x1c')](_0xad29f5[_0x6ecd('0x1d')]);if(_0xad29f5[_0x6ecd('0x1e')]){delete _0xad29f5[_0x6ecd('0x1e')];}_0x1abd4a[_0x6ecd('0x12')](_0x4694bf)['send'](_0xad29f5);};}exports[_0x6ecd('0x1f')]=function(_0x22ce15,_0x2d94a4){var _0x1c3685={};var _0x344d53=_['map'](db['MailInteraction'][_0x6ecd('0x20')],function(_0x249c70){return{'name':_0x249c70[_0x6ecd('0x21')],'type':_0x249c70[_0x6ecd('0x22')][_0x6ecd('0x23')]};});_0x1c3685=qs[_0x6ecd('0x24')](_0x344d53,_0x22ce15);return interaction['findAll'](_0x6ecd('0x25'),_0x22ce15[_0x6ecd('0x26')],_0x22ce15['user'],_0x1c3685,_0x344d53)[_0x6ecd('0x19')](respondWithFilteredResult(_0x2d94a4,_0x1c3685))[_0x6ecd('0x27')](handleError(_0x2d94a4,null));};exports[_0x6ecd('0x28')]=function(_0x4f42cb,_0xfa60cd){var _0x156110={'raw':![],'where':{'id':_0x4f42cb[_0x6ecd('0x29')]['id']}},_0x1df045={};_0x1df045[_0x6ecd('0x2a')]=_[_0x6ecd('0x2b')](db[_0x6ecd('0x2c')][_0x6ecd('0x20')]);_0x1df045[_0x6ecd('0x26')]=_[_0x6ecd('0x2b')](_0x4f42cb[_0x6ecd('0x26')]);_0x1df045[_0x6ecd('0x2d')]=_['intersection'](_0x1df045['model'],_0x1df045[_0x6ecd('0x26')]);_0x156110[_0x6ecd('0x2e')]=_[_0x6ecd('0x2f')](_0x1df045[_0x6ecd('0x2a')],qs['fields'](_0x4f42cb[_0x6ecd('0x26')][_0x6ecd('0x30')]));_0x156110['attributes']=_0x156110[_0x6ecd('0x2e')][_0x6ecd('0x31')]?_0x156110[_0x6ecd('0x2e')]:_0x1df045['model'];if(_0x4f42cb[_0x6ecd('0x26')][_0x6ecd('0x32')]){_0x156110['include']=[{'all':!![]}];}_0x156110=_[_0x6ecd('0x33')]({},_0x156110,_0x4f42cb[_0x6ecd('0x34')]);return db[_0x6ecd('0x2c')]['find'](_0x156110)[_0x6ecd('0x19')](handleEntityNotFound(_0xfa60cd,null))[_0x6ecd('0x19')](respondWithResult(_0xfa60cd,null))[_0x6ecd('0x27')](handleError(_0xfa60cd,null));};exports[_0x6ecd('0x35')]=function(_0x4d31e9,_0x4dfe14){return db['MailInteraction'][_0x6ecd('0x35')](_0x4d31e9[_0x6ecd('0x36')],{})[_0x6ecd('0x19')](respondWithResult(_0x4dfe14,0xc9))['catch'](handleError(_0x4dfe14,null));};exports['update']=function(_0x22a9e7,_0x4b087c){if(_0x22a9e7['body']['id']){delete _0x22a9e7[_0x6ecd('0x36')]['id'];}return db[_0x6ecd('0x2c')][_0x6ecd('0x37')]({'where':{'id':_0x22a9e7[_0x6ecd('0x29')]['id']}})[_0x6ecd('0x19')](handleEntityNotFound(_0x4b087c,null))['then'](saveUpdates(_0x22a9e7[_0x6ecd('0x36')],null))[_0x6ecd('0x19')](respondWithResult(_0x4b087c,null))[_0x6ecd('0x27')](handleError(_0x4b087c,null));};exports['destroy']=function(_0x33e7ca,_0x169ecb){return db['MailInteraction']['find']({'where':{'id':_0x33e7ca['params']['id']}})[_0x6ecd('0x19')](handleEntityNotFound(_0x169ecb,null))['then'](removeEntity(_0x169ecb,null))[_0x6ecd('0x27')](handleError(_0x169ecb,null));};exports['describe']=function(_0x28497d,_0x33978b){return db['MailInteraction'][_0x6ecd('0x38')]()[_0x6ecd('0x19')](respondWithResult(_0x33978b,null))[_0x6ecd('0x27')](handleError(_0x33978b,null));};exports[_0x6ecd('0x39')]=function(_0x575ac5,_0x219e3f){return db['MailMessage'][_0x6ecd('0x37')]({'where':{'id':_0x575ac5[_0x6ecd('0x29')]['id']}})[_0x6ecd('0x19')](handleEntityNotFound(_0x219e3f,null))[_0x6ecd('0x19')](function(_0x33c45a){if(_0x33c45a){return _0x33c45a['addMessage'](_0x575ac5['body'][_0x6ecd('0x3a')],_[_0x6ecd('0x3b')](_0x575ac5['body'],[_0x6ecd('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x219e3f,null))[_0x6ecd('0x27')](handleError(_0x219e3f,null));};exports[_0x6ecd('0x3c')]=function(_0x2dea51,_0x3f12f3){var _0xebd674={'raw':![],'where':{}};var _0x3ec075={};var _0x51378a={'count':0x0,'rows':[]};return db[_0x6ecd('0x2c')]['findOne']({'where':{'id':_0x2dea51['params']['id']}})[_0x6ecd('0x19')](handleEntityNotFound(_0x3f12f3,null))[_0x6ecd('0x19')](function(_0x121d72){if(_0x121d72){_0x3ec075[_0x6ecd('0x2a')]=_[_0x6ecd('0x2b')](db[_0x6ecd('0x3d')][_0x6ecd('0x20')]);_0x3ec075[_0x6ecd('0x26')]=_[_0x6ecd('0x2b')](_0x2dea51[_0x6ecd('0x26')]);_0x3ec075['filters']=_['intersection'](_0x3ec075[_0x6ecd('0x2a')],_0x3ec075[_0x6ecd('0x26')]);_0xebd674['attributes']=_[_0x6ecd('0x2f')](_0x3ec075['model'],qs[_0x6ecd('0x30')](_0x2dea51[_0x6ecd('0x26')][_0x6ecd('0x30')]));_0xebd674[_0x6ecd('0x2e')]=_0xebd674['attributes'][_0x6ecd('0x31')]?_0xebd674['attributes']:_0x3ec075[_0x6ecd('0x2a')];if(!_0x2dea51[_0x6ecd('0x26')]['hasOwnProperty'](_0x6ecd('0x3e'))){_0xebd674['limit']=qs['limit'](_0x2dea51[_0x6ecd('0x26')]['limit']);_0xebd674[_0x6ecd('0x14')]=qs[_0x6ecd('0x14')](_0x2dea51[_0x6ecd('0x26')]['offset']);}_0xebd674['order']=qs[_0x6ecd('0x3f')](_0x2dea51['query'][_0x6ecd('0x3f')]);_0xebd674[_0x6ecd('0x40')]=qs[_0x6ecd('0x2d')](_[_0x6ecd('0x41')](_0x2dea51[_0x6ecd('0x26')],_0x3ec075[_0x6ecd('0x2d')]));_0xebd674[_0x6ecd('0x40')][_0x6ecd('0x42')]=_0x121d72['id'];if(_0x2dea51[_0x6ecd('0x26')]['filter']){_0xebd674['where']=_[_0x6ecd('0x33')](_0xebd674[_0x6ecd('0x40')],{'$or':_[_0x6ecd('0x43')](_0xebd674[_0x6ecd('0x2e')],function(_0x1bfc3b){var _0x5bb3ee={};_0x5bb3ee[_0x1bfc3b]={'$like':'%'+_0x2dea51[_0x6ecd('0x26')]['filter']+'%'};return _0x5bb3ee;})});}if(_0x2dea51['query'][_0x6ecd('0x44')]){var _0x4dc23c=_0x2dea51['query'][_0x6ecd('0x44')][_0x6ecd('0x45')](',');var _0x4b76c9={};_0x4b76c9[_0x4dc23c[0x0]]={'$gte':moment(_0x4dc23c[0x1])[_0x6ecd('0x46')](_0x6ecd('0x47'))};_0xebd674['where']=_['merge'](_0xebd674[_0x6ecd('0x40')],_0x4b76c9);}_0xebd674=_['merge']({},_0xebd674,_0x2dea51['options']);return db['MailMessage']['count']({'where':_0xebd674['where']})[_0x6ecd('0x19')](function(_0x3b6c95){_0x51378a[_0x6ecd('0x17')]=_0x3b6c95;if(_0x2dea51[_0x6ecd('0x26')][_0x6ecd('0x32')]){_0xebd674['include']=[{'all':!![]}];}return db[_0x6ecd('0x3d')][_0x6ecd('0x48')](_0xebd674);})['then'](function(_0x510f49){if(_0x2dea51['query'][_0x6ecd('0x49')]===_0x6ecd('0x4a')){for(var _0x347c0e=0x0;_0x347c0e<_0x510f49[_0x6ecd('0x31')];_0x347c0e++){_0x510f49[_0x347c0e]['body']=juice(_0x510f49[_0x347c0e]['body']);}}_0x51378a[_0x6ecd('0x4b')]=_0x510f49;return _0x51378a;});}})[_0x6ecd('0x19')](respondWithFilteredResult(_0x3f12f3,_0xebd674))[_0x6ecd('0x27')](handleError(_0x3f12f3,null));};exports[_0x6ecd('0x4c')]=function(_0x3fa11c,_0x28feb1){return db[_0x6ecd('0x2c')][_0x6ecd('0x37')]({'where':{'id':_0x3fa11c[_0x6ecd('0x29')]['id']}})[_0x6ecd('0x19')](handleEntityNotFound(_0x28feb1,null))[_0x6ecd('0x19')](function(_0x318a3d){if(_0x318a3d){return _0x318a3d[_0x6ecd('0x4d')](_0x3fa11c[_0x6ecd('0x36')][_0x6ecd('0x3a')],_[_0x6ecd('0x3b')](_0x3fa11c[_0x6ecd('0x36')],['ids','id'])||{})[_0x6ecd('0x4e')](function(){return db[_0x6ecd('0x4f')][_0x6ecd('0x48')]({'attributes':['id','name','color'],'where':{'id':_0x3fa11c[_0x6ecd('0x36')][_0x6ecd('0x3a')]}});})[_0x6ecd('0x19')](function(_0x45449b){socket[_0x6ecd('0x50')]('mailInteractionTags:save',{'id':Number(_0x3fa11c['params']['id']),'tags':_0x45449b||[]});return{'id':Number(_0x3fa11c[_0x6ecd('0x29')]['id']),'tags':_0x45449b||[]};});}})[_0x6ecd('0x19')](respondWithResult(_0x28feb1,null))[_0x6ecd('0x27')](handleError(_0x28feb1,null));};exports[_0x6ecd('0x51')]=function(_0x5640d2,_0x4cf601){return db['MailInteraction'][_0x6ecd('0x37')]({'where':{'id':_0x5640d2[_0x6ecd('0x29')]['id']}})[_0x6ecd('0x19')](handleEntityNotFound(_0x4cf601,null))[_0x6ecd('0x19')](function(_0x446a55){if(_0x446a55){return _0x446a55[_0x6ecd('0x51')](_0x5640d2[_0x6ecd('0x26')]['ids']);}})[_0x6ecd('0x19')](respondWithStatusCode(_0x4cf601,null))[_0x6ecd('0x27')](handleError(_0x4cf601,null));};exports[_0x6ecd('0x52')]=function(_0x4104bd,_0x5f55da){var _0x182c63=moment()[_0x6ecd('0x53')]()[_0x6ecd('0x54')]();var _0xdb000a=path['join'](config[_0x6ecd('0x55')],'server',_0x6ecd('0x56'),_0x6ecd('0x57'));var _0x55011d=path['join'](config[_0x6ecd('0x55')],_0x6ecd('0x58'),_0x6ecd('0x56'),_0x6ecd('0x59'));var _0x5ac87b=path['join'](_0xdb000a,_0x182c63);var _0xa3b509=util[_0x6ecd('0x46')](_0x6ecd('0x5a'),_0x4104bd['params']['id'],_0x182c63);var _0x483daf=path[_0x6ecd('0x5b')](_0xdb000a,_0xa3b509);var _0x1439a8=[];if(_0x4104bd['query'][_0x6ecd('0x59')]){_0x1439a8['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x5d06a5=[{'model':db['MailMessage'],'as':_0x6ecd('0x5c'),'attributes':['id',_0x6ecd('0x36'),_0x6ecd('0x5d'),'to','cc',_0x6ecd('0x5e'),_0x6ecd('0x5f'),_0x6ecd('0x60')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1439a8}];return db[_0x6ecd('0x2c')]['find']({'where':{'id':_0x4104bd[_0x6ecd('0x29')]['id']},'include':_0x5d06a5})[_0x6ecd('0x19')](handleEntityNotFound(_0x5f55da,null))[_0x6ecd('0x19')](function(_0x52572d){if(_0x52572d&&_0x52572d[_0x6ecd('0x5c')]){var _0x174e54=_0x52572d[_0x6ecd('0x61')]({'plain':!![]});fs[_0x6ecd('0x62')](_0x5ac87b);return BPromise[_0x6ecd('0x63')](_0x174e54['Messages'],function(_0xdea3c4,_0x2783d2){var _0x3fe2e9={'from':_0xdea3c4[_0x6ecd('0x5d')],'to':_0xdea3c4['to']||_0x6ecd('0x64'),'subject':_0xdea3c4[_0x6ecd('0x5f')],'html':htmlEntities[_0x6ecd('0x65')](_0xdea3c4[_0x6ecd('0x36')]),'headers':{'Date':moment(_0xdea3c4['createdAt'])['format'](_0x6ecd('0x66'))},'attachments':[]};if(_0xdea3c4['cc']){_0x3fe2e9['headers']['Cc']=_0xdea3c4['cc'];}if(_0xdea3c4[_0x6ecd('0x5e')]){_0x3fe2e9[_0x6ecd('0x67')][_0x6ecd('0x68')]=_0xdea3c4['bcc'];}return new BPromise(function(_0xddbcd7,_0x5f3322){if(_0xdea3c4[_0x6ecd('0x69')]){for(var _0x549268=0x0;_0x549268<_0xdea3c4['Attachments'][_0x6ecd('0x31')];_0x549268++){var _0x518bee=_0xdea3c4[_0x6ecd('0x69')][_0x549268];var _0x10da1e=path[_0x6ecd('0x5b')](_0x55011d,_0x518bee[_0x6ecd('0x6a')]);if(fs[_0x6ecd('0x6b')](_0x10da1e)){_0x3fe2e9['attachments'][_0x6ecd('0x6c')]({'name':_0x518bee[_0x6ecd('0x1e')],'contentType':_0x518bee[_0x6ecd('0x22')],'data':fs[_0x6ecd('0x6d')](_0x10da1e)});}}}emlformat[_0x6ecd('0x6e')](_0x3fe2e9,function(_0x3be42f,_0x502a8c){if(_0x3be42f)return _0x5f3322(_0x3be42f);fs[_0x6ecd('0x6f')](path[_0x6ecd('0x5b')](_0x5ac87b,util[_0x6ecd('0x46')](_0x6ecd('0x70'),_0x2783d2)),_0x502a8c);return _0xddbcd7(_0x502a8c);});});})[_0x6ecd('0x19')](function(){return new BPromise(function(_0x576280,_0x1045d0){zipdir(_0x5ac87b,{'saveTo':_0x483daf},function(_0x13c3a0,_0x30e203){if(_0x13c3a0)return _0x1045d0(_0x13c3a0);return _0x576280(_0x30e203);});})[_0x6ecd('0x19')](function(){return new BPromise(function(_0x52765f,_0x43339d){rimraf(_0x5ac87b,function(_0x2bcfe8){if(_0x2bcfe8)_0x43339d(_0x2bcfe8);return _0x52765f();});});})[_0x6ecd('0x19')](function(){return _0x5f55da[_0x6ecd('0x52')](_0x483daf,_0xa3b509,function(_0x3905d3){if(!_0x3905d3)fs['unlinkSync'](_0x483daf);});});});}else{return _0x5f55da[_0x6ecd('0x11')](0xc8);}})['catch'](handleError(_0x5f55da,null));}; \ No newline at end of file +var _0x32ad=['download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','status','json','offset','undefined','count','set','Content-Range','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','type','key','getOptions','findAll','mail','query','user','catch','params','keys','MailInteraction','filters','model','intersection','fields','attributes','length','include','merge','options','find','create','body','describe','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','limit','order','sort','where','MailInteractionId','filter','$gte','format','includeAll','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','basename','readFileSync','build','message%d.eml'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x32ad,0x71));var _0xd32a=function(_0x3ac6c0,_0x419f80){_0x3ac6c0=_0x3ac6c0-0x0;var _0x1930c0=_0x32ad[_0x3ac6c0];return _0x1930c0;};'use strict';var emlformat=require(_0xd32a('0x0'));var rimraf=require(_0xd32a('0x1'));var zipdir=require(_0xd32a('0x2'));var moment=require(_0xd32a('0x3'));var BPromise=require(_0xd32a('0x4'));var util=require(_0xd32a('0x5'));var path=require(_0xd32a('0x6'));var fs=require('fs');var _=require('lodash');var juice=require(_0xd32a('0x7'));var Redis=require(_0xd32a('0x8'));var interaction=require(_0xd32a('0x9'));var qs=require(_0xd32a('0xa'));var logger=require('../../config/logger')(_0xd32a('0xb'));var config=require(_0xd32a('0xc'));var db=require(_0xd32a('0xd'))['db'];var htmlEntities=require(_0xd32a('0xe'));config['redis']=_[_0xd32a('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd32a('0x10')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4a5559,_0x42ce53){_0x42ce53=_0x42ce53||0xcc;return function(_0x3c1008){if(_0x3c1008){return _0x4a5559['sendStatus'](_0x42ce53);}return _0x4a5559[_0xd32a('0x11')](_0x42ce53)['end']();};}function respondWithResult(_0x34c708,_0x2629c8){_0x2629c8=_0x2629c8||0xc8;return function(_0x4ea23f){if(_0x4ea23f){return _0x34c708['status'](_0x2629c8)[_0xd32a('0x12')](_0x4ea23f);}};}function respondWithFilteredResult(_0x35d26d,_0xe340c9){return function(_0x33bfd9){if(_0x33bfd9){var _0x12521b=typeof _0xe340c9[_0xd32a('0x13')]===_0xd32a('0x14')&&typeof _0xe340c9['limit']===_0xd32a('0x14');var _0xde82ea=_0x33bfd9['count'];var _0x2174a0=_0x12521b?0x0:_0xe340c9[_0xd32a('0x13')];var _0x27eeda=_0x12521b?_0x33bfd9[_0xd32a('0x15')]:_0xe340c9[_0xd32a('0x13')]+_0xe340c9['limit'];var _0x37a0b5;if(_0x27eeda>=_0xde82ea){_0x27eeda=_0xde82ea;_0x37a0b5=0xc8;}else{_0x37a0b5=0xce;}_0x35d26d[_0xd32a('0x11')](_0x37a0b5);return _0x35d26d[_0xd32a('0x16')](_0xd32a('0x17'),_0x2174a0+'-'+_0x27eeda+'/'+_0xde82ea)[_0xd32a('0x12')](_0x33bfd9);}return null;};}function saveUpdates(_0x418616){return function(_0x34fcd3){if(_0x34fcd3){return _0x34fcd3['update'](_0x418616)[_0xd32a('0x18')](function(_0x15a559){return _0x15a559;});}return null;};}function removeEntity(_0x1dedd3){return function(_0x1bd866){if(_0x1bd866){return _0x1bd866[_0xd32a('0x19')]()[_0xd32a('0x18')](function(){_0x1dedd3[_0xd32a('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x402137){return function(_0x115941){if(!_0x115941){_0x402137[_0xd32a('0x1a')](0x194);}return _0x115941;};}function handleError(_0x275296,_0x49203a){_0x49203a=_0x49203a||0x1f4;return function(_0x2bc50b){logger[_0xd32a('0x1b')](_0x2bc50b[_0xd32a('0x1c')]);if(_0x2bc50b[_0xd32a('0x1d')]){delete _0x2bc50b['name'];}_0x275296['status'](_0x49203a)['send'](_0x2bc50b);};}exports[_0xd32a('0x1e')]=function(_0x5ea866,_0x184980){var _0x1b1400={};var _0x367df0=_[_0xd32a('0x1f')](db['MailInteraction'][_0xd32a('0x20')],function(_0x384efc){return{'name':_0x384efc['fieldName'],'type':_0x384efc[_0xd32a('0x21')][_0xd32a('0x22')]};});_0x1b1400=qs[_0xd32a('0x23')](_0x367df0,_0x5ea866);return interaction[_0xd32a('0x24')](_0xd32a('0x25'),_0x5ea866[_0xd32a('0x26')],_0x5ea866[_0xd32a('0x27')],_0x1b1400,_0x367df0)[_0xd32a('0x18')](respondWithFilteredResult(_0x184980,_0x1b1400))[_0xd32a('0x28')](handleError(_0x184980,null));};exports['show']=function(_0x540763,_0x1cbe1f){var _0x34cab2={'raw':![],'where':{'id':_0x540763[_0xd32a('0x29')]['id']}},_0x55666f={};_0x55666f['model']=_[_0xd32a('0x2a')](db[_0xd32a('0x2b')][_0xd32a('0x20')]);_0x55666f[_0xd32a('0x26')]=_[_0xd32a('0x2a')](_0x540763[_0xd32a('0x26')]);_0x55666f[_0xd32a('0x2c')]=_['intersection'](_0x55666f[_0xd32a('0x2d')],_0x55666f[_0xd32a('0x26')]);_0x34cab2['attributes']=_[_0xd32a('0x2e')](_0x55666f[_0xd32a('0x2d')],qs[_0xd32a('0x2f')](_0x540763['query'][_0xd32a('0x2f')]));_0x34cab2[_0xd32a('0x30')]=_0x34cab2[_0xd32a('0x30')][_0xd32a('0x31')]?_0x34cab2['attributes']:_0x55666f['model'];if(_0x540763[_0xd32a('0x26')]['includeAll']){_0x34cab2[_0xd32a('0x32')]=[{'all':!![]}];}_0x34cab2=_[_0xd32a('0x33')]({},_0x34cab2,_0x540763[_0xd32a('0x34')]);return db['MailInteraction'][_0xd32a('0x35')](_0x34cab2)[_0xd32a('0x18')](handleEntityNotFound(_0x1cbe1f,null))['then'](respondWithResult(_0x1cbe1f,null))[_0xd32a('0x28')](handleError(_0x1cbe1f,null));};exports['create']=function(_0x2d0b81,_0x4ccbc5){return db['MailInteraction'][_0xd32a('0x36')](_0x2d0b81[_0xd32a('0x37')],{})[_0xd32a('0x18')](respondWithResult(_0x4ccbc5,0xc9))[_0xd32a('0x28')](handleError(_0x4ccbc5,null));};exports['update']=function(_0x1fda38,_0x580591){if(_0x1fda38[_0xd32a('0x37')]['id']){delete _0x1fda38[_0xd32a('0x37')]['id'];}return db[_0xd32a('0x2b')][_0xd32a('0x35')]({'where':{'id':_0x1fda38['params']['id']}})[_0xd32a('0x18')](handleEntityNotFound(_0x580591,null))[_0xd32a('0x18')](saveUpdates(_0x1fda38[_0xd32a('0x37')],null))[_0xd32a('0x18')](respondWithResult(_0x580591,null))['catch'](handleError(_0x580591,null));};exports[_0xd32a('0x19')]=function(_0x2cd215,_0x531da5){return db[_0xd32a('0x2b')][_0xd32a('0x35')]({'where':{'id':_0x2cd215[_0xd32a('0x29')]['id']}})[_0xd32a('0x18')](handleEntityNotFound(_0x531da5,null))[_0xd32a('0x18')](removeEntity(_0x531da5,null))[_0xd32a('0x28')](handleError(_0x531da5,null));};exports[_0xd32a('0x38')]=function(_0x1e1ad3,_0x4559e7){return db[_0xd32a('0x2b')]['describe']()[_0xd32a('0x18')](respondWithResult(_0x4559e7,null))[_0xd32a('0x28')](handleError(_0x4559e7,null));};exports['addMessage']=function(_0x537aee,_0xaa2a85){return db[_0xd32a('0x39')]['find']({'where':{'id':_0x537aee[_0xd32a('0x29')]['id']}})[_0xd32a('0x18')](handleEntityNotFound(_0xaa2a85,null))[_0xd32a('0x18')](function(_0x2b2fc3){if(_0x2b2fc3){return _0x2b2fc3['addMessage'](_0x537aee[_0xd32a('0x37')][_0xd32a('0x3a')],_[_0xd32a('0x3b')](_0x537aee[_0xd32a('0x37')],[_0xd32a('0x3a'),'id'])||{});}})[_0xd32a('0x18')](respondWithResult(_0xaa2a85,null))['catch'](handleError(_0xaa2a85,null));};exports[_0xd32a('0x3c')]=function(_0x3e0e12,_0xb2cb7f){var _0x1ec39c={'raw':![],'where':{}};var _0x54bc5b={};var _0x16fb45={'count':0x0,'rows':[]};return db[_0xd32a('0x2b')][_0xd32a('0x3d')]({'where':{'id':_0x3e0e12[_0xd32a('0x29')]['id']}})[_0xd32a('0x18')](handleEntityNotFound(_0xb2cb7f,null))[_0xd32a('0x18')](function(_0x3072a9){if(_0x3072a9){_0x54bc5b[_0xd32a('0x2d')]=_['keys'](db[_0xd32a('0x39')][_0xd32a('0x20')]);_0x54bc5b[_0xd32a('0x26')]=_[_0xd32a('0x2a')](_0x3e0e12['query']);_0x54bc5b[_0xd32a('0x2c')]=_['intersection'](_0x54bc5b[_0xd32a('0x2d')],_0x54bc5b[_0xd32a('0x26')]);_0x1ec39c[_0xd32a('0x30')]=_[_0xd32a('0x2e')](_0x54bc5b['model'],qs[_0xd32a('0x2f')](_0x3e0e12[_0xd32a('0x26')][_0xd32a('0x2f')]));_0x1ec39c[_0xd32a('0x30')]=_0x1ec39c[_0xd32a('0x30')][_0xd32a('0x31')]?_0x1ec39c[_0xd32a('0x30')]:_0x54bc5b[_0xd32a('0x2d')];if(!_0x3e0e12[_0xd32a('0x26')][_0xd32a('0x3e')](_0xd32a('0x3f'))){_0x1ec39c[_0xd32a('0x40')]=qs[_0xd32a('0x40')](_0x3e0e12[_0xd32a('0x26')][_0xd32a('0x40')]);_0x1ec39c['offset']=qs[_0xd32a('0x13')](_0x3e0e12[_0xd32a('0x26')][_0xd32a('0x13')]);}_0x1ec39c[_0xd32a('0x41')]=qs[_0xd32a('0x42')](_0x3e0e12[_0xd32a('0x26')][_0xd32a('0x42')]);_0x1ec39c[_0xd32a('0x43')]=qs[_0xd32a('0x2c')](_['pick'](_0x3e0e12[_0xd32a('0x26')],_0x54bc5b[_0xd32a('0x2c')]));_0x1ec39c['where'][_0xd32a('0x44')]=_0x3072a9['id'];if(_0x3e0e12['query'][_0xd32a('0x45')]){_0x1ec39c[_0xd32a('0x43')]=_[_0xd32a('0x33')](_0x1ec39c['where'],{'$or':_[_0xd32a('0x1f')](_0x1ec39c['attributes'],function(_0x1c55d2){var _0x40b2e4={};_0x40b2e4[_0x1c55d2]={'$like':'%'+_0x3e0e12['query']['filter']+'%'};return _0x40b2e4;})});}if(_0x3e0e12['query'][_0xd32a('0x46')]){var _0x28e6f6=_0x3e0e12[_0xd32a('0x26')][_0xd32a('0x46')]['split'](',');var _0x33da84={};_0x33da84[_0x28e6f6[0x0]]={'$gte':moment(_0x28e6f6[0x1])[_0xd32a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ec39c[_0xd32a('0x43')]=_[_0xd32a('0x33')](_0x1ec39c[_0xd32a('0x43')],_0x33da84);}_0x1ec39c=_[_0xd32a('0x33')]({},_0x1ec39c,_0x3e0e12['options']);return db[_0xd32a('0x39')][_0xd32a('0x15')]({'where':_0x1ec39c[_0xd32a('0x43')]})['then'](function(_0x5cebcf){_0x16fb45[_0xd32a('0x15')]=_0x5cebcf;if(_0x3e0e12['query'][_0xd32a('0x48')]){_0x1ec39c[_0xd32a('0x32')]=[{'all':!![]}];}return db[_0xd32a('0x39')][_0xd32a('0x24')](_0x1ec39c);})[_0xd32a('0x18')](function(_0x3ae17f){if(_0x3e0e12[_0xd32a('0x26')]['inlineCss']===_0xd32a('0x49')){for(var _0x1644a6=0x0;_0x1644a6<_0x3ae17f[_0xd32a('0x31')];_0x1644a6++){_0x3ae17f[_0x1644a6][_0xd32a('0x37')]=juice(_0x3ae17f[_0x1644a6][_0xd32a('0x37')]);}}_0x16fb45[_0xd32a('0x4a')]=_0x3ae17f;return _0x16fb45;});}})[_0xd32a('0x18')](respondWithFilteredResult(_0xb2cb7f,_0x1ec39c))[_0xd32a('0x28')](handleError(_0xb2cb7f,null));};exports[_0xd32a('0x4b')]=function(_0x3a44a3,_0x30d9d8){return db[_0xd32a('0x2b')][_0xd32a('0x35')]({'where':{'id':_0x3a44a3['params']['id']}})['then'](handleEntityNotFound(_0x30d9d8,null))[_0xd32a('0x18')](function(_0x2c3e10){if(_0x2c3e10){return _0x2c3e10[_0xd32a('0x4c')](_0x3a44a3[_0xd32a('0x37')][_0xd32a('0x3a')],_[_0xd32a('0x3b')](_0x3a44a3[_0xd32a('0x37')],[_0xd32a('0x3a'),'id'])||{})[_0xd32a('0x4d')](function(){return db[_0xd32a('0x4e')][_0xd32a('0x24')]({'attributes':['id','name',_0xd32a('0x4f')],'where':{'id':_0x3a44a3['body']['ids']}});})[_0xd32a('0x18')](function(_0x5ec02b){socket[_0xd32a('0x50')](_0xd32a('0x51'),{'id':Number(_0x3a44a3[_0xd32a('0x29')]['id']),'tags':_0x5ec02b||[]});return{'id':Number(_0x3a44a3[_0xd32a('0x29')]['id']),'tags':_0x5ec02b||[]};});}})['then'](respondWithResult(_0x30d9d8,null))[_0xd32a('0x28')](handleError(_0x30d9d8,null));};exports[_0xd32a('0x52')]=function(_0x51c002,_0x56e958){return db[_0xd32a('0x2b')][_0xd32a('0x35')]({'where':{'id':_0x51c002[_0xd32a('0x29')]['id']}})[_0xd32a('0x18')](handleEntityNotFound(_0x56e958,null))[_0xd32a('0x18')](function(_0x283740){if(_0x283740){return _0x283740[_0xd32a('0x52')](_0x51c002[_0xd32a('0x26')][_0xd32a('0x3a')]);}})[_0xd32a('0x18')](respondWithStatusCode(_0x56e958,null))[_0xd32a('0x28')](handleError(_0x56e958,null));};exports['download']=function(_0x5c9f5f,_0x10c343){var _0x554813=moment()['unix']()['toString']();var _0xd14aa4=path[_0xd32a('0x53')](config[_0xd32a('0x54')],_0xd32a('0x55'),_0xd32a('0x56'),_0xd32a('0x57'));var _0x26527b=path[_0xd32a('0x53')](config['root'],_0xd32a('0x55'),'files',_0xd32a('0x58'));var _0x92807f=path[_0xd32a('0x53')](_0xd14aa4,_0x554813);var _0x5963b3=util[_0xd32a('0x47')](_0xd32a('0x59'),_0x5c9f5f[_0xd32a('0x29')]['id'],_0x554813);var _0xe0e6fd=path[_0xd32a('0x53')](_0xd14aa4,_0x5963b3);var _0x28b041=[];if(_0x5c9f5f[_0xd32a('0x26')][_0xd32a('0x58')]){_0x28b041[_0xd32a('0x5a')]({'model':db[_0xd32a('0x5b')],'as':_0xd32a('0x5c'),'raw':!![]});}var _0x275548=[{'model':db[_0xd32a('0x39')],'as':_0xd32a('0x5d'),'attributes':['id',_0xd32a('0x37'),_0xd32a('0x5e'),'to','cc',_0xd32a('0x5f'),_0xd32a('0x60'),_0xd32a('0x61')],'where':{'secret':![]},'order':qs[_0xd32a('0x42')]('id'),'include':_0x28b041}];return db[_0xd32a('0x2b')]['find']({'where':{'id':_0x5c9f5f[_0xd32a('0x29')]['id']},'include':_0x275548})[_0xd32a('0x18')](handleEntityNotFound(_0x10c343,null))[_0xd32a('0x18')](function(_0x789878){if(_0x789878&&_0x789878['Messages']){var _0x5d862c=_0x789878[_0xd32a('0x62')]({'plain':!![]});fs[_0xd32a('0x63')](_0x92807f);return BPromise[_0xd32a('0x64')](_0x5d862c['Messages'],function(_0x348da1,_0xed2faa){var _0x467848={'from':_0x348da1['from'],'to':_0x348da1['to']||_0xd32a('0x65'),'subject':_0x348da1[_0xd32a('0x60')],'html':htmlEntities[_0xd32a('0x66')](_0x348da1[_0xd32a('0x37')]),'headers':{'Date':moment(_0x348da1[_0xd32a('0x61')])[_0xd32a('0x47')](_0xd32a('0x67'))},'attachments':[]};if(_0x348da1['cc']){_0x467848['headers']['Cc']=_0x348da1['cc'];}if(_0x348da1['bcc']){_0x467848['headers'][_0xd32a('0x68')]=_0x348da1[_0xd32a('0x5f')];}return new BPromise(function(_0x66b3e4,_0xd7502c){if(_0x348da1[_0xd32a('0x5c')]){for(var _0x44b261=0x0;_0x44b261<_0x348da1[_0xd32a('0x5c')][_0xd32a('0x31')];_0x44b261++){var _0x4c7a3c=_0x348da1[_0xd32a('0x5c')][_0x44b261];var _0x4dbb81=path[_0xd32a('0x53')](_0x26527b,_0x4c7a3c[_0xd32a('0x69')]);if(fs['existsSync'](_0x4dbb81)){_0x467848['attachments'][_0xd32a('0x5a')]({'name':_0x4c7a3c[_0xd32a('0x1d')],'contentType':_0x4c7a3c[_0xd32a('0x21')],'data':fs[_0xd32a('0x6a')](_0x4dbb81)});}}}emlformat[_0xd32a('0x6b')](_0x467848,function(_0x249bbf,_0x3dc16f){if(_0x249bbf)return _0xd7502c(_0x249bbf);fs['writeFileSync'](path[_0xd32a('0x53')](_0x92807f,util['format'](_0xd32a('0x6c'),_0xed2faa)),_0x3dc16f);return _0x66b3e4(_0x3dc16f);});});})[_0xd32a('0x18')](function(){return new BPromise(function(_0x2fb58d,_0x41648c){zipdir(_0x92807f,{'saveTo':_0xe0e6fd},function(_0x318653,_0x4544ea){if(_0x318653)return _0x41648c(_0x318653);return _0x2fb58d(_0x4544ea);});})[_0xd32a('0x18')](function(){return new BPromise(function(_0x17564b,_0xdae473){rimraf(_0x92807f,function(_0x56958e){if(_0x56958e)_0xdae473(_0x56958e);return _0x17564b();});});})[_0xd32a('0x18')](function(){return _0x10c343[_0xd32a('0x6d')](_0xe0e6fd,_0x5963b3,function(_0x2bae8c){if(!_0x2bae8c)fs[_0xd32a('0x6e')](_0xe0e6fd);});});});}else{return _0x10c343[_0xd32a('0x1a')](0xc8);}})[_0xd32a('0x28')](handleError(_0x10c343,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 539a6ce..8a1a33c 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 _0x4647=['setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4647,0x13f));var _0x7464=function(_0x30110d,_0x47618e){_0x30110d=_0x30110d-0x0;var _0x37fb32=_0x4647[_0x30110d];return _0x37fb32;};'use strict';var EventEmitter=require(_0x7464('0x0'));var MailInteraction=require(_0x7464('0x1'))['db'][_0x7464('0x2')];var MailMessage=require(_0x7464('0x1'))['db'][_0x7464('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7464('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7464('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3d2a86){return function(_0x5d5293,_0x28c146,_0x311f1a){_0x5d5293[_0x7464('0x6')]({'attributes':['id'],'raw':!![]})[_0x7464('0x7')](function(_0x2b5337){_0x5d5293[_0x7464('0x8')](_0x7464('0x9'),_0x2b5337[_0x7464('0xa')](function(_0x2a231a){return{'id':_0x2a231a['id']};}));return MailMessage[_0x7464('0xb')]({'where':{'MailInteractionId':_0x5d5293['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7464('0x7')](function(_0x4b3d53){_0x5d5293[_0x7464('0x8')](_0x7464('0xc'),_0x4b3d53['length']);MailInteractionEvents[_0x7464('0xd')](_0x3d2a86+':'+_0x5d5293['id'],_0x5d5293);MailInteractionEvents[_0x7464('0xd')](_0x3d2a86,_0x5d5293);_0x311f1a(null);})[_0x7464('0xe')](_0x311f1a(null));};}for(var e in events){if(events[_0x7464('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x7464('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x9c79=['map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','MailInteraction','MailMessage','update','remove','getUsers','then','Users'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x9c79,0x134));var _0x99c7=function(_0x4d9c3b,_0x3c4663){_0x4d9c3b=_0x4d9c3b-0x0;var _0x35c391=_0x9c79[_0x4d9c3b];return _0x35c391;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x99c7('0x0')];var MailMessage=require('../../mysqldb')['db'][_0x99c7('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x99c7('0x2'),'afterDestroy':_0x99c7('0x3')};function emitEvent(_0x76b7c7){return function(_0x4cc0fe,_0x269d85,_0x341fd9){_0x4cc0fe[_0x99c7('0x4')]({'attributes':['id'],'raw':!![]})[_0x99c7('0x5')](function(_0x561e84){_0x4cc0fe['setDataValue'](_0x99c7('0x6'),_0x561e84[_0x99c7('0x7')](function(_0x1c18bf){return{'id':_0x1c18bf['id']};}));return MailMessage[_0x99c7('0x8')]({'where':{'MailInteractionId':_0x4cc0fe['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1bbc07){_0x4cc0fe[_0x99c7('0x9')](_0x99c7('0xa'),_0x1bbc07['length']);MailInteractionEvents[_0x99c7('0xb')](_0x76b7c7+':'+_0x4cc0fe['id'],_0x4cc0fe);MailInteractionEvents[_0x99c7('0xb')](_0x76b7c7,_0x4cc0fe);_0x341fd9(null);})[_0x99c7('0xc')](_0x341fd9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x99c7('0xd')](e,emitEvent(event));}}module[_0x99c7('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index be3989b..49c4e30 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 _0x136f=['get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','substatusAt','models'];(function(_0x99a6a8,_0x229834){var _0xcaff9b=function(_0x12756f){while(--_0x12756f){_0x99a6a8['push'](_0x99a6a8['shift']());}};_0xcaff9b(++_0x229834);}(_0x136f,0x17d));var _0xf136=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x136f[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xf136('0x0'));var util=require('util');var logger=require(_0xf136('0x1'))(_0xf136('0x2'));var moment=require('moment');var BPromise=require(_0xf136('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf136('0x4'));var rimraf=require('rimraf');var config=require(_0xf136('0x5'));var attributes=require(_0xf136('0x6'));module[_0xf136('0x7')]=function(_0x69e66a,_0xd4b061){return _0x69e66a['define'](_0xf136('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xf136('0x9'),'fields':['subject','to'],'type':_0xf136('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xd9b12f,_0x282a02,_0x12c176){if(_0xd9b12f[_0xf136('0xb')]){_0xd9b12f['substatusAt']=moment()[_0xf136('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xd9b12f['closed']){_0xd9b12f['closedAt']=moment()[_0xf136('0xc')](_0xf136('0xd'));}_0x12c176(null,_0x282a02);},'beforeUpdate':function(_0x19464a,_0x1b06c8,_0x11a722){if(_0x19464a[_0xf136('0xe')](_0xf136('0xb'))){_0x19464a['substatusAt']=_0x19464a['substatus']?moment()[_0xf136('0xc')](_0xf136('0xd')):null;}if(_0x19464a[_0xf136('0xe')](_0xf136('0xf'))){_0x19464a[_0xf136('0x10')]=moment()[_0xf136('0xc')](_0xf136('0xd'));_0x19464a[_0xf136('0xb')]=null;_0x19464a[_0xf136('0x11')]=null;}_0x11a722(null,_0x19464a);},'afterUpdate':function(_0x44d2ff,_0x3b67c2,_0x8d1e52){var _0x3c60ce=_0x69e66a[_0xf136('0x12')];var _0x2cb5b3=_0x44d2ff[_0xf136('0x13')]({'plain':!![]});if(_0x2cb5b3[_0xf136('0xf')]){return _0x3c60ce['MailMessage'][_0xf136('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x2cb5b3['id']}})[_0xf136('0x15')](function(){_0x8d1e52();})[_0xf136('0x16')](function(_0x2b365e){_0x8d1e52(_0x2b365e);});}else{_0x8d1e52();}}},'charset':_0xf136('0x17'),'collate':_0xf136('0x18')});}; \ No newline at end of file +var _0x1ba9=['moment','bluebird','request-promise','path','../../config/environment','exports','define','MailInteraction','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','get','MailMessage','update','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x39887a,_0x19f8d5){var _0x25b5cf=function(_0x12f71b){while(--_0x12f71b){_0x39887a['push'](_0x39887a['shift']());}};_0x25b5cf(++_0x19f8d5);}(_0x1ba9,0xab));var _0x91ba=function(_0x3e5fb1,_0x4785bf){_0x3e5fb1=_0x3e5fb1-0x0;var _0x1463f1=_0x1ba9[_0x3e5fb1];return _0x1463f1;};'use strict';var _=require(_0x91ba('0x0'));var util=require(_0x91ba('0x1'));var logger=require(_0x91ba('0x2'))(_0x91ba('0x3'));var moment=require(_0x91ba('0x4'));var BPromise=require(_0x91ba('0x5'));var rp=require(_0x91ba('0x6'));var fs=require('fs');var path=require(_0x91ba('0x7'));var rimraf=require('rimraf');var config=require(_0x91ba('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x91ba('0x9')]=function(_0x55b6f2,_0x3f3ccf){return _0x55b6f2[_0x91ba('0xa')](_0x91ba('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x91ba('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49f04d,_0x3ff8dc,_0x38aae7){if(_0x49f04d[_0x91ba('0xd')]){_0x49f04d['substatusAt']=moment()[_0x91ba('0xe')](_0x91ba('0xf'));}if(_0x49f04d[_0x91ba('0x10')]){_0x49f04d[_0x91ba('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x38aae7(null,_0x3ff8dc);},'beforeUpdate':function(_0x228fdf,_0x1bce3a,_0x2bc3e2){if(_0x228fdf[_0x91ba('0x12')](_0x91ba('0xd'))){_0x228fdf[_0x91ba('0x13')]=_0x228fdf[_0x91ba('0xd')]?moment()[_0x91ba('0xe')](_0x91ba('0xf')):null;}if(_0x228fdf[_0x91ba('0x12')](_0x91ba('0x10'))){_0x228fdf[_0x91ba('0x11')]=moment()[_0x91ba('0xe')](_0x91ba('0xf'));_0x228fdf[_0x91ba('0xd')]=null;_0x228fdf[_0x91ba('0x13')]=null;}_0x2bc3e2(null,_0x228fdf);},'afterUpdate':function(_0xd8b962,_0x167507,_0x24b266){var _0x158e0d=_0x55b6f2['models'];var _0x5518d6=_0xd8b962[_0x91ba('0x14')]({'plain':!![]});if(_0x5518d6[_0x91ba('0x10')]){return _0x158e0d[_0x91ba('0x15')][_0x91ba('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x5518d6['id']}})['then'](function(){_0x24b266();})[_0x91ba('0x17')](function(_0x26596b){_0x24b266(_0x26596b);});}else{_0x24b266();}}},'charset':'utf8mb4','collate':_0x91ba('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 197ac2e..03a1f7b 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 _0xfcf3=['find','addTags','ids','AddTags','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','update','body','options','raw','where','limit','then','UpdateMailInteraction','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcf3,0xcd));var _0x3fcf=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xfcf3[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0x3fcf('0x0'));var util=require(_0x3fcf('0x1'));var moment=require(_0x3fcf('0x2'));var BPromise=require(_0x3fcf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fcf('0x4'))['db'];var utils=require(_0x3fcf('0x5'));var logger=require('../../config/logger')(_0x3fcf('0x6'));var config=require(_0x3fcf('0x7'));var jayson=require(_0x3fcf('0x8'));var client=jayson[_0x3fcf('0x9')][_0x3fcf('0xa')]({'port':0x232a});config[_0x3fcf('0xb')]=_[_0x3fcf('0xc')](config[_0x3fcf('0xb')],{'host':_0x3fcf('0xd'),'port':0x18eb});var socket=require(_0x3fcf('0xe'))(new Redis(config[_0x3fcf('0xb')]));require(_0x3fcf('0xf'))[_0x3fcf('0x10')](socket);function respondWithRpcPromise(_0x15cd7d,_0x3c4411,_0x377839){return new BPromise(function(_0x24815c,_0xfd0c6){return client['request'](_0x15cd7d,_0x377839)['then'](function(_0x48c99d){logger[_0x3fcf('0x11')](_0x3fcf('0x12'),_0x3c4411,'request\x20sent');logger[_0x3fcf('0x13')](_0x3fcf('0x14'),_0x3c4411,_0x3fcf('0x15'),JSON['stringify'](_0x48c99d));if(_0x48c99d[_0x3fcf('0x16')]){if(_0x48c99d[_0x3fcf('0x16')][_0x3fcf('0x17')]===0x1f4){logger['error'](_0x3fcf('0x12'),_0x3c4411,_0x48c99d[_0x3fcf('0x16')][_0x3fcf('0x18')]);return _0xfd0c6(_0x48c99d[_0x3fcf('0x16')][_0x3fcf('0x18')]);}logger[_0x3fcf('0x16')](_0x3fcf('0x12'),_0x3c4411,_0x48c99d[_0x3fcf('0x16')][_0x3fcf('0x18')]);return _0x24815c(_0x48c99d[_0x3fcf('0x16')][_0x3fcf('0x18')]);}else{logger[_0x3fcf('0x11')](_0x3fcf('0x12'),_0x3c4411,_0x3fcf('0x15'));_0x24815c(_0x48c99d[_0x3fcf('0x19')]['message']);}})['catch'](function(_0x38d652){logger['error'](_0x3fcf('0x12'),_0x3c4411,_0x38d652);_0xfd0c6(_0x38d652);});});}exports['UpdateMailInteraction']=function(_0x3e808d){var _0x4f6be5=this;return new Promise(function(_0x9d4c2d,_0x53d2b4){return db['MailInteraction'][_0x3fcf('0x1a')](_0x3e808d[_0x3fcf('0x1b')],{'raw':_0x3e808d['options']?_0x3e808d[_0x3fcf('0x1c')][_0x3fcf('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e808d[_0x3fcf('0x1c')]?_0x3e808d[_0x3fcf('0x1c')][_0x3fcf('0x1e')]||null:null,'attributes':_0x3e808d[_0x3fcf('0x1c')]?_0x3e808d[_0x3fcf('0x1c')]['attributes']||null:null,'limit':_0x3e808d[_0x3fcf('0x1c')]?_0x3e808d[_0x3fcf('0x1c')][_0x3fcf('0x1f')]||null:null})[_0x3fcf('0x20')](function(_0x5a65f2){logger[_0x3fcf('0x11')](_0x3fcf('0x21'),_0x3e808d);logger[_0x3fcf('0x13')](_0x3fcf('0x21'),_0x3e808d,JSON['stringify'](_0x5a65f2));_0x9d4c2d(_0x5a65f2);})[_0x3fcf('0x22')](function(_0x25c9a5){logger['error'](_0x3fcf('0x21'),_0x25c9a5[_0x3fcf('0x18')],_0x3e808d);_0x53d2b4(_0x4f6be5[_0x3fcf('0x16')](0x1f4,_0x25c9a5[_0x3fcf('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x5cee7d){return new Promise(function(_0x56eab3,_0x261771){return db['MailInteraction'][_0x3fcf('0x23')]({'where':_0x5cee7d[_0x3fcf('0x1c')]?_0x5cee7d[_0x3fcf('0x1c')]['where']||null:null})['then'](function(_0x239121){if(_0x239121){return _0x239121[_0x3fcf('0x24')](_0x5cee7d[_0x3fcf('0x1b')][_0x3fcf('0x25')],_['omit'](_0x5cee7d[_0x3fcf('0x1b')],[_0x3fcf('0x25'),'id'])||{});}})['spread'](function(_0x18804e){logger['info']('AddTags',_0x5cee7d);logger[_0x3fcf('0x13')](_0x3fcf('0x26'),_0x5cee7d,JSON[_0x3fcf('0x27')](_0x18804e));_0x56eab3(_0x18804e);})['catch'](function(_0x339592){logger[_0x3fcf('0x16')](_0x3fcf('0x26'),_0x339592[_0x3fcf('0x18')],_0x5cee7d);_0x261771(_this[_0x3fcf('0x16')](0x1f4,_0x339592[_0x3fcf('0x18')]));});});}; \ No newline at end of file +var _0x1365=['rpc','jayson/promise','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','UpdateMailInteraction','update','options','raw','where','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3743b0,_0xac9ede){var _0x513294=function(_0x4374a5){while(--_0x4374a5){_0x3743b0['push'](_0x3743b0['shift']());}};_0x513294(++_0xac9ede);}(_0x1365,0x1a4));var _0x5136=function(_0x4108f7,_0x51d271){_0x4108f7=_0x4108f7-0x0;var _0x4c394c=_0x1365[_0x4108f7];return _0x4c394c;};'use strict';var _=require(_0x5136('0x0'));var util=require(_0x5136('0x1'));var moment=require(_0x5136('0x2'));var BPromise=require(_0x5136('0x3'));var rs=require(_0x5136('0x4'));var fs=require('fs');var Redis=require(_0x5136('0x5'));var db=require(_0x5136('0x6'))['db'];var utils=require(_0x5136('0x7'));var logger=require(_0x5136('0x8'))(_0x5136('0x9'));var config=require('../../config/environment');var jayson=require(_0x5136('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x5136('0xb')]=_['defaults'](config[_0x5136('0xb')],{'host':_0x5136('0xc'),'port':0x18eb});var socket=require(_0x5136('0xd'))(new Redis(config[_0x5136('0xb')]));require(_0x5136('0xe'))[_0x5136('0xf')](socket);function respondWithRpcPromise(_0x5d2251,_0x40b375,_0x2f6681){return new BPromise(function(_0x4a43d1,_0x286489){return client['request'](_0x5d2251,_0x2f6681)[_0x5136('0x10')](function(_0x38164c){logger[_0x5136('0x11')]('MailInteraction,\x20%s,\x20%s',_0x40b375,_0x5136('0x12'));logger[_0x5136('0x13')](_0x5136('0x14'),_0x40b375,_0x5136('0x12'),JSON[_0x5136('0x15')](_0x38164c));if(_0x38164c[_0x5136('0x16')]){if(_0x38164c[_0x5136('0x16')][_0x5136('0x17')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x40b375,_0x38164c['error']['message']);return _0x286489(_0x38164c[_0x5136('0x16')]['message']);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x40b375,_0x38164c[_0x5136('0x16')][_0x5136('0x18')]);return _0x4a43d1(_0x38164c[_0x5136('0x16')][_0x5136('0x18')]);}else{logger[_0x5136('0x11')](_0x5136('0x19'),_0x40b375,_0x5136('0x12'));_0x4a43d1(_0x38164c['result'][_0x5136('0x18')]);}})['catch'](function(_0x22ec2a){logger[_0x5136('0x16')](_0x5136('0x19'),_0x40b375,_0x22ec2a);_0x286489(_0x22ec2a);});});}exports[_0x5136('0x1a')]=function(_0x582dd9){var _0x5cbb94=this;return new Promise(function(_0x5de7e9,_0x76a12e){return db['MailInteraction'][_0x5136('0x1b')](_0x582dd9['body'],{'raw':_0x582dd9['options']?_0x582dd9[_0x5136('0x1c')][_0x5136('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x582dd9['options']?_0x582dd9['options'][_0x5136('0x1e')]||null:null,'attributes':_0x582dd9[_0x5136('0x1c')]?_0x582dd9['options'][_0x5136('0x1f')]||null:null,'limit':_0x582dd9[_0x5136('0x1c')]?_0x582dd9[_0x5136('0x1c')][_0x5136('0x20')]||null:null})[_0x5136('0x10')](function(_0x1fc377){logger[_0x5136('0x11')]('UpdateMailInteraction',_0x582dd9);logger[_0x5136('0x13')]('UpdateMailInteraction',_0x582dd9,JSON[_0x5136('0x15')](_0x1fc377));_0x5de7e9(_0x1fc377);})['catch'](function(_0x10d5bf){logger[_0x5136('0x16')](_0x5136('0x1a'),_0x10d5bf[_0x5136('0x18')],_0x582dd9);_0x76a12e(_0x5cbb94['error'](0x1f4,_0x10d5bf['message']));});});};exports[_0x5136('0x21')]=function(_0x43f4e4){return new Promise(function(_0x38c752,_0x221693){return db[_0x5136('0x22')][_0x5136('0x23')]({'where':_0x43f4e4[_0x5136('0x1c')]?_0x43f4e4[_0x5136('0x1c')][_0x5136('0x1e')]||null:null})[_0x5136('0x10')](function(_0x3a94ab){if(_0x3a94ab){return _0x3a94ab['addTags'](_0x43f4e4['body'][_0x5136('0x24')],_['omit'](_0x43f4e4['body'],['ids','id'])||{});}})[_0x5136('0x25')](function(_0x1d2874){logger[_0x5136('0x11')](_0x5136('0x26'),_0x43f4e4);logger[_0x5136('0x13')]('AddTags',_0x43f4e4,JSON['stringify'](_0x1d2874));_0x38c752(_0x1d2874);})['catch'](function(_0x4763f7){logger['error']('AddTags',_0x4763f7['message'],_0x43f4e4);_0x221693(_this[_0x5136('0x16')](0x1f4,_0x4763f7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 14ba112..9381797 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 _0xafeb=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x137924,_0x5a9e70){var _0x428c3b=function(_0x449d7a){while(--_0x449d7a){_0x137924['push'](_0x137924['shift']());}};_0x428c3b(++_0x5a9e70);}(_0xafeb,0x14a));var _0xbafe=function(_0x19232c,_0x444854){_0x19232c=_0x19232c-0x0;var _0x5f56e4=_0xafeb[_0x19232c];return _0x5f56e4;};'use strict';var MailInteractionEvents=require(_0xbafe('0x0'));var events=[_0xbafe('0x1'),_0xbafe('0x2'),_0xbafe('0x3')];function createListener(_0x15923d,_0xb5e986){return function(_0x2500e8){_0xb5e986[_0xbafe('0x4')](_0x15923d,_0x2500e8);};}function removeListener(_0x481e71,_0x673d2c){return function(){MailInteractionEvents[_0xbafe('0x5')](_0x481e71,_0x673d2c);};}exports[_0xbafe('0x6')]=function(_0x10a998){for(var _0x33ee77=0x0,_0x54d043=events[_0xbafe('0x7')];_0x33ee77<_0x54d043;_0x33ee77++){var _0x3822a1=events[_0x33ee77];var _0x4aa795=createListener(_0xbafe('0x8')+_0x3822a1,_0x10a998);MailInteractionEvents['on'](_0x3822a1,_0x4aa795);}}; \ No newline at end of file +var _0x5fe7=['register','./mailInteraction.events','save','update','emit'];(function(_0x24309e,_0x40413c){var _0x553337=function(_0xe25531){while(--_0xe25531){_0x24309e['push'](_0x24309e['shift']());}};_0x553337(++_0x40413c);}(_0x5fe7,0xce));var _0x75fe=function(_0x435a99,_0x43c3b4){_0x435a99=_0x435a99-0x0;var _0x36860f=_0x5fe7[_0x435a99];return _0x36860f;};'use strict';var MailInteractionEvents=require(_0x75fe('0x0'));var events=[_0x75fe('0x1'),'remove',_0x75fe('0x2')];function createListener(_0x1ee247,_0x4321c7){return function(_0x365fba){_0x4321c7[_0x75fe('0x3')](_0x1ee247,_0x365fba);};}function removeListener(_0x117210,_0x26ec23){return function(){MailInteractionEvents['removeListener'](_0x117210,_0x26ec23);};}exports[_0x75fe('0x4')]=function(_0x4453bf){for(var _0x5f5a3a=0x0,_0x539644=events['length'];_0x5f5a3a<_0x539644;_0x5f5a3a++){var _0x32f3bc=events[_0x5f5a3a];var _0x42ea12=createListener('mailInteraction:'+_0x32f3bc,_0x4453bf);MailInteractionEvents['on'](_0x32f3bc,_0x42ea12);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5e3b141..f6ece12 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 _0xae75=['accept','/:id/reject','/:id','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','/describe','describe','get','/:id/download','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept'];(function(_0xecf2cc,_0x187d35){var _0x669c37=function(_0x30c0a6){while(--_0x30c0a6){_0xecf2cc['push'](_0xecf2cc['shift']());}};_0x669c37(++_0x187d35);}(_0xae75,0x1a8));var _0x5ae7=function(_0x48e736,_0x412d46){_0x48e736=_0x48e736-0x0;var _0x27116d=_0xae75[_0x48e736];return _0x27116d;};'use strict';var multer=require(_0x5ae7('0x0'));var util=require(_0x5ae7('0x1'));var path=require(_0x5ae7('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ae7('0x3'));var router=express[_0x5ae7('0x4')]();var fs_extra=require(_0x5ae7('0x5'));var auth=require(_0x5ae7('0x6'));var interaction=require(_0x5ae7('0x7'));var config=require(_0x5ae7('0x8'));var controller=require(_0x5ae7('0x9'));router['get']('/',auth[_0x5ae7('0xa')](),controller[_0x5ae7('0xb')]);router['get'](_0x5ae7('0xc'),auth[_0x5ae7('0xa')](),controller[_0x5ae7('0xd')]);router[_0x5ae7('0xe')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x5ae7('0xf'),auth['isAuthenticated'](),controller[_0x5ae7('0x10')]);router['post']('/',auth[_0x5ae7('0xa')](),interaction[_0x5ae7('0x11')](_0x5ae7('0x12'),_0x5ae7('0x13')),controller[_0x5ae7('0x14')]);router[_0x5ae7('0x15')]('/:id',auth[_0x5ae7('0xa')](),controller[_0x5ae7('0x16')]);router[_0x5ae7('0x15')](_0x5ae7('0x17'),auth['isAuthenticated'](),controller[_0x5ae7('0x18')]);router[_0x5ae7('0x15')](_0x5ae7('0x19'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x5ae7('0x1a'),auth[_0x5ae7('0xa')](),controller[_0x5ae7('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x4a1d=['/:id/download','download','tracked','mail','create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4a1d,0x77));var _0xd4a1=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4a1d[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xd4a1('0x0'));var util=require(_0xd4a1('0x1'));var path=require(_0xd4a1('0x2'));var timeout=require(_0xd4a1('0x3'));var express=require(_0xd4a1('0x4'));var router=express['Router']();var fs_extra=require(_0xd4a1('0x5'));var auth=require(_0xd4a1('0x6'));var interaction=require(_0xd4a1('0x7'));var config=require(_0xd4a1('0x8'));var controller=require(_0xd4a1('0x9'));router[_0xd4a1('0xa')]('/',auth[_0xd4a1('0xb')](),controller[_0xd4a1('0xc')]);router['get'](_0xd4a1('0xd'),auth[_0xd4a1('0xb')](),controller[_0xd4a1('0xe')]);router[_0xd4a1('0xa')](_0xd4a1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xd4a1('0xa')](_0xd4a1('0x10'),auth[_0xd4a1('0xb')](),controller[_0xd4a1('0x11')]);router['post']('/',auth[_0xd4a1('0xb')](),interaction[_0xd4a1('0x12')](_0xd4a1('0x13'),'mailmessage:create'),controller[_0xd4a1('0x14')]);router[_0xd4a1('0x15')](_0xd4a1('0xf'),auth[_0xd4a1('0xb')](),controller['update']);router[_0xd4a1('0x15')](_0xd4a1('0x16'),auth[_0xd4a1('0xb')](),controller['accept']);router[_0xd4a1('0x15')](_0xd4a1('0x17'),auth[_0xd4a1('0xb')](),controller[_0xd4a1('0x18')]);router['delete']('/:id',auth[_0xd4a1('0xb')](),controller[_0xd4a1('0x19')]);module[_0xd4a1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 973f00f..351ef32 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 _0xd422=['Chat','lodash','TEXT','long','medium','BOOLEAN','out','STRING','INTEGER','DATE','ENUM','Email'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xd422,0x1ed));var _0x2d42=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xd422[_0x87b0ff];return _0x3bc0b2;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2d42('0x0'));module['exports']={'body':{'type':Sequelize[_0x2d42('0x1')](_0x2d42('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2d42('0x1')](_0x2d42('0x3'))},'read':{'type':Sequelize[_0x2d42('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d42('0x5')),'defaultValue':_0x2d42('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2d42('0x6')]},'to':{'type':Sequelize[_0x2d42('0x1')](_0x2d42('0x2'))},'cc':{'type':Sequelize[_0x2d42('0x1')](_0x2d42('0x2'))},'bcc':{'type':Sequelize[_0x2d42('0x1')](_0x2d42('0x2'))},'subject':{'type':Sequelize[_0x2d42('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x2d42('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2d42('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2d42('0x8')]},'originTo':{'type':Sequelize[_0x2d42('0x1')](_0x2d42('0x2'))},'originCc':{'type':Sequelize[_0x2d42('0x1')](_0x2d42('0x2'))},'originChannel':{'type':Sequelize[_0x2d42('0x9')](_0x2d42('0xa'),_0x2d42('0xb')),'defaultValue':_0x2d42('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xa1ef=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x1a5623,_0x5ea1a6){var _0x40a418=function(_0x30ecae){while(--_0x30ecae){_0x1a5623['push'](_0x1a5623['shift']());}};_0x40a418(++_0x5ea1a6);}(_0xa1ef,0x1f4));var _0xfa1e=function(_0x681ca3,_0x19e409){_0x681ca3=_0x681ca3-0x0;var _0x42435d=_0xa1ef[_0x681ca3];return _0x42435d;};'use strict';var Sequelize=require(_0xfa1e('0x0'));var _=require(_0xfa1e('0x1'));module[_0xfa1e('0x2')]={'body':{'type':Sequelize[_0xfa1e('0x3')](_0xfa1e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfa1e('0x3')](_0xfa1e('0x5'))},'read':{'type':Sequelize[_0xfa1e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfa1e('0x7')]('in',_0xfa1e('0x8')),'defaultValue':_0xfa1e('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfa1e('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xfa1e('0x3')](_0xfa1e('0x4'))},'cc':{'type':Sequelize[_0xfa1e('0x3')]('long')},'bcc':{'type':Sequelize[_0xfa1e('0x3')](_0xfa1e('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xfa1e('0xa')]},'attach':{'type':Sequelize[_0xfa1e('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfa1e('0xa')]},'originTo':{'type':Sequelize[_0xfa1e('0x3')](_0xfa1e('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xfa1e('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0xfa1e('0xc'),_0xfa1e('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4416084..948d7f1 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 _0xcdd5=['ContactId','sequelize','Sequelize','SELECT','contact','User','internal','manual','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','fullname','email','interface','rejectmessage','toString','files','tmp','root','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','count','set','Content-Range','json','update','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','body','find','create','out','MailAccount','findOne','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','basename','List','Contacts','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'];(function(_0x287d08,_0x55ab1e){var _0x3e7834=function(_0x3cada6){while(--_0x3cada6){_0x287d08['push'](_0x287d08['shift']());}};_0x3e7834(++_0x55ab1e);}(_0xcdd5,0x15d));var _0x5cdd=function(_0xddc32d,_0x53ae4c){_0xddc32d=_0xddc32d-0x0;var _0x45f398=_0xcdd5[_0xddc32d];return _0x45f398;};'use strict';var emlformat=require(_0x5cdd('0x0'));var moment=require(_0x5cdd('0x1'));var BPromise=require(_0x5cdd('0x2'));var util=require('util');var path=require(_0x5cdd('0x3'));var fs=require('fs');var _=require(_0x5cdd('0x4'));var Redis=require(_0x5cdd('0x5'));var htmlToText=require(_0x5cdd('0x6'));var qs=require(_0x5cdd('0x7'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x5cdd('0x8'))(_0x5cdd('0x9'));var config=require(_0x5cdd('0xa'));var db=require(_0x5cdd('0xb'))['db'];config['redis']=_[_0x5cdd('0xc')](config[_0x5cdd('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5cdd('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x5cdd('0xf'));require(_0x5cdd('0x10'))[_0x5cdd('0x11')](socket);var jayson=require(_0x5cdd('0x12'));var client=jayson[_0x5cdd('0x13')]['http']({'port':0x232c});var client9003=jayson[_0x5cdd('0x13')][_0x5cdd('0x14')]({'port':0x232b});var client9002=jayson['client'][_0x5cdd('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x3e790f,_0x20b18d,_0x35fc31,_0x251e7e){return new BPromise(function(_0x173481,_0x30731c){var _0x433c19=_0x251e7e||client;return _0x433c19[_0x5cdd('0x15')](_0x3e790f,_0x35fc31)[_0x5cdd('0x16')](function(_0x918f77){logger[_0x5cdd('0x17')]('MailMessage,\x20%s,\x20%s',_0x20b18d,_0x5cdd('0x18'));logger[_0x5cdd('0x19')](_0x5cdd('0x1a'),_0x20b18d,_0x5cdd('0x18'),JSON['stringify'](_0x918f77));if(_0x918f77[_0x5cdd('0x1b')]){if(_0x918f77[_0x5cdd('0x1b')]['code']===0x1f4){logger[_0x5cdd('0x1b')](_0x5cdd('0x1c'),_0x20b18d,_0x918f77[_0x5cdd('0x1b')]['message']);return _0x30731c(_0x918f77[_0x5cdd('0x1b')][_0x5cdd('0x1d')]);}logger[_0x5cdd('0x1b')](_0x5cdd('0x1c'),_0x20b18d,_0x918f77['error'][_0x5cdd('0x1d')]);return _0x173481(_0x918f77[_0x5cdd('0x1b')][_0x5cdd('0x1d')]);}else{logger[_0x5cdd('0x17')](_0x5cdd('0x1c'),_0x20b18d,_0x5cdd('0x18'));_0x173481(_0x918f77[_0x5cdd('0x1e')][_0x5cdd('0x1d')]);}})[_0x5cdd('0x1f')](function(_0x4677b9){logger[_0x5cdd('0x1b')](_0x5cdd('0x1c'),_0x20b18d,_0x4677b9);_0x30731c(_0x4677b9);});});}function respondWithResult(_0x158292,_0x44ac58){_0x44ac58=_0x44ac58||0xc8;return function(_0x2eba01){if(_0x2eba01){return _0x158292[_0x5cdd('0x20')](_0x44ac58)['json'](_0x2eba01);}};}function respondWithFilteredResult(_0x28df4c,_0x24104c){return function(_0x40d0e3){if(_0x40d0e3){var _0x10d8d3=typeof _0x24104c[_0x5cdd('0x21')]===_0x5cdd('0x22')&&typeof _0x24104c['limit']==='undefined';var _0x200aa3=_0x40d0e3[_0x5cdd('0x23')];var _0x374165=_0x10d8d3?0x0:_0x24104c[_0x5cdd('0x21')];var _0x32a628=_0x10d8d3?_0x40d0e3[_0x5cdd('0x23')]:_0x24104c[_0x5cdd('0x21')]+_0x24104c['limit'];var _0x16ca8a;if(_0x32a628>=_0x200aa3){_0x32a628=_0x200aa3;_0x16ca8a=0xc8;}else{_0x16ca8a=0xce;}_0x28df4c[_0x5cdd('0x20')](_0x16ca8a);return _0x28df4c[_0x5cdd('0x24')](_0x5cdd('0x25'),_0x374165+'-'+_0x32a628+'/'+_0x200aa3)[_0x5cdd('0x26')](_0x40d0e3);}return null;};}function saveUpdates(_0x26cd8a){return function(_0x4ea858){if(_0x4ea858){return _0x4ea858[_0x5cdd('0x27')](_0x26cd8a)[_0x5cdd('0x16')](function(_0x4f8f28){return _0x4f8f28;});}return null;};}function removeEntity(_0x1e7df1){return function(_0x4f82ae){if(_0x4f82ae){return _0x4f82ae['destroy']()[_0x5cdd('0x16')](function(){_0x1e7df1[_0x5cdd('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f69f8){return function(_0x5b72be){if(!_0x5b72be){_0x1f69f8['sendStatus'](0x194);}return _0x5b72be;};}function handleError(_0xa5ec,_0x24422){_0x24422=_0x24422||0x1f4;return function(_0x392974){logger[_0x5cdd('0x1b')](_0x392974[_0x5cdd('0x28')]);if(_0x392974[_0x5cdd('0x29')]){delete _0x392974[_0x5cdd('0x29')];}_0xa5ec[_0x5cdd('0x20')](_0x24422)[_0x5cdd('0x2a')](_0x392974);};}exports[_0x5cdd('0x2b')]=function(_0x176cb3,_0x4143ff){var _0x668a9c={},_0x931494={},_0x14f547={'count':0x0,'rows':[]};var _0x2d0f52=_[_0x5cdd('0x2c')](db[_0x5cdd('0x2d')][_0x5cdd('0x2e')],function(_0xffd550){return{'name':_0xffd550[_0x5cdd('0x2f')],'type':_0xffd550[_0x5cdd('0x30')]['key']};});_0x931494['model']=_[_0x5cdd('0x2c')](_0x2d0f52,_0x5cdd('0x29'));_0x931494[_0x5cdd('0x31')]=_[_0x5cdd('0x32')](_0x176cb3[_0x5cdd('0x31')]);_0x931494[_0x5cdd('0x33')]=_[_0x5cdd('0x34')](_0x931494['model'],_0x931494[_0x5cdd('0x31')]);_0x668a9c[_0x5cdd('0x35')]=_[_0x5cdd('0x34')](_0x931494[_0x5cdd('0x36')],qs[_0x5cdd('0x37')](_0x176cb3[_0x5cdd('0x31')]['fields']));_0x668a9c['attributes']=_0x668a9c['attributes'][_0x5cdd('0x38')]?_0x668a9c[_0x5cdd('0x35')]:_0x931494[_0x5cdd('0x36')];if(!_0x176cb3[_0x5cdd('0x31')][_0x5cdd('0x39')](_0x5cdd('0x3a'))){_0x668a9c[_0x5cdd('0x3b')]=qs['limit'](_0x176cb3[_0x5cdd('0x31')][_0x5cdd('0x3b')]);_0x668a9c['offset']=qs[_0x5cdd('0x21')](_0x176cb3[_0x5cdd('0x31')]['offset']);}_0x668a9c[_0x5cdd('0x3c')]=qs[_0x5cdd('0x3d')](_0x176cb3[_0x5cdd('0x31')][_0x5cdd('0x3d')]);_0x668a9c[_0x5cdd('0x3e')]=qs[_0x5cdd('0x33')](_[_0x5cdd('0x3f')](_0x176cb3[_0x5cdd('0x31')],_0x931494[_0x5cdd('0x33')]),_0x2d0f52);if(_0x176cb3[_0x5cdd('0x31')][_0x5cdd('0x40')]){_0x668a9c['where']=_[_0x5cdd('0x41')](_0x668a9c['where'],{'$or':_['map'](_0x2d0f52,function(_0x1ac6ec){if(_0x1ac6ec[_0x5cdd('0x30')]!==_0x5cdd('0x42')){var _0x2256df={};_0x2256df[_0x1ac6ec[_0x5cdd('0x29')]]={'$like':'%'+_0x176cb3[_0x5cdd('0x31')]['filter']+'%'};return _0x2256df;}})});}_0x668a9c=_[_0x5cdd('0x41')]({},_0x668a9c,_0x176cb3[_0x5cdd('0x43')]);var _0xcfd1de={'where':_0x668a9c['where']};return db['MailMessage'][_0x5cdd('0x23')](_0xcfd1de)[_0x5cdd('0x16')](function(_0x1ed389){_0x14f547[_0x5cdd('0x23')]=_0x1ed389;if(_0x176cb3[_0x5cdd('0x31')]['includeAll']){_0x668a9c[_0x5cdd('0x44')]=[{'all':!![]}];}return db['MailMessage'][_0x5cdd('0x45')](_0x668a9c);})[_0x5cdd('0x16')](function(_0x405568){_0x14f547[_0x5cdd('0x46')]=_0x405568;return _0x14f547;})[_0x5cdd('0x16')](respondWithFilteredResult(_0x4143ff,_0x668a9c))['catch'](handleError(_0x4143ff,null));};exports[_0x5cdd('0x47')]=function(_0x202d5f,_0x2c595b){var _0x1bf204={'raw':!![],'where':{'id':_0x202d5f[_0x5cdd('0x48')]['id']}},_0x2aec4e={};_0x2aec4e[_0x5cdd('0x36')]=_[_0x5cdd('0x32')](db[_0x5cdd('0x2d')]['rawAttributes']);_0x2aec4e[_0x5cdd('0x31')]=_[_0x5cdd('0x32')](_0x202d5f[_0x5cdd('0x31')]);_0x2aec4e['filters']=_[_0x5cdd('0x34')](_0x2aec4e[_0x5cdd('0x36')],_0x2aec4e['query']);_0x1bf204['attributes']=_[_0x5cdd('0x34')](_0x2aec4e[_0x5cdd('0x36')],qs[_0x5cdd('0x37')](_0x202d5f[_0x5cdd('0x31')][_0x5cdd('0x37')]));_0x1bf204[_0x5cdd('0x35')]=_0x1bf204[_0x5cdd('0x35')]['length']?_0x1bf204[_0x5cdd('0x35')]:_0x2aec4e['model'];if(_0x202d5f[_0x5cdd('0x31')]['includeAll']){_0x1bf204[_0x5cdd('0x44')]=[{'all':!![]}];}_0x1bf204=_[_0x5cdd('0x41')]({},_0x1bf204,_0x202d5f['options']);return db['MailMessage']['find'](_0x1bf204)[_0x5cdd('0x16')](handleEntityNotFound(_0x2c595b,null))[_0x5cdd('0x16')](respondWithResult(_0x2c595b,null))['catch'](handleError(_0x2c595b,null));};exports['update']=function(_0x5f09ca,_0x19c229){if(_0x5f09ca[_0x5cdd('0x49')]['id']){delete _0x5f09ca['body']['id'];}return db[_0x5cdd('0x2d')][_0x5cdd('0x4a')]({'where':{'id':_0x5f09ca[_0x5cdd('0x48')]['id']}})[_0x5cdd('0x16')](handleEntityNotFound(_0x19c229,null))[_0x5cdd('0x16')](saveUpdates(_0x5f09ca[_0x5cdd('0x49')],null))[_0x5cdd('0x16')](respondWithResult(_0x19c229,null))[_0x5cdd('0x1f')](handleError(_0x19c229,null));};exports['destroy']=function(_0x2e3be9,_0x3c8e03){return db[_0x5cdd('0x2d')][_0x5cdd('0x4a')]({'where':{'id':_0x2e3be9[_0x5cdd('0x48')]['id']}})[_0x5cdd('0x16')](handleEntityNotFound(_0x3c8e03,null))[_0x5cdd('0x16')](removeEntity(_0x3c8e03,null))[_0x5cdd('0x1f')](handleError(_0x3c8e03,null));};exports['describe']=function(_0x4ac3d0,_0xcc6e9){return db[_0x5cdd('0x2d')]['describe']()['then'](respondWithResult(_0xcc6e9,null))[_0x5cdd('0x1f')](handleError(_0xcc6e9,null));};exports['create']=function(_0x5c7bee,_0x27136f){return db['MailMessage'][_0x5cdd('0x4b')](_0x5c7bee['body'])['then'](function(_0x56cfc4){if(_0x56cfc4){if(_0x56cfc4['direction']===_0x5cdd('0x4c')&&!_0x56cfc4['secret']){var _0x11daa3,_0x553330,_0xa59047;if(_0x5c7bee[_0x5cdd('0x49')]['to']){_0x553330=_0x5c7bee[_0x5cdd('0x49')]['to']['split'](',')[0x0];}return db[_0x5cdd('0x4d')][_0x5cdd('0x4e')]({'where':{'id':_0x56cfc4['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x5cdd('0x4f')],'as':'Contacts','where':{'email':_0x553330},'limit':0x1,'order':[[_0x5cdd('0x50'),_0x5cdd('0x51')]]}]},{'model':db[_0x5cdd('0x52')],'as':_0x5cdd('0x53'),'raw':!![],'include':[{'model':db[_0x5cdd('0x54')],'as':_0x5cdd('0x54'),'raw':!![]}]}]})['then'](function(_0x4632d9){_0x11daa3=_0x4632d9;if(!_0x11daa3||!_0x11daa3[_0x5cdd('0x53')])return;var _0x1b1c69=_0x11daa3[_0x5cdd('0x55')]();if(_0x5c7bee['body'][_0x5cdd('0x56')]&&_0x5c7bee[_0x5cdd('0x49')]['attachments'][_0x5cdd('0x38')]){for(var _0x1af60e=0x0;_0x1af60e<_0x5c7bee[_0x5cdd('0x49')][_0x5cdd('0x56')][_0x5cdd('0x38')];_0x1af60e+=0x1){_0x5c7bee[_0x5cdd('0x49')][_0x5cdd('0x56')][_0x1af60e]={'filename':_0x5c7bee['body']['attachments'][_0x1af60e]['name'],'path':path[_0x5cdd('0x57')](config['root'],'server/files/attachments',_0x5c7bee[_0x5cdd('0x49')][_0x5cdd('0x56')][_0x1af60e][_0x5cdd('0x58')])};}}_0xa59047={'account':_0x1b1c69,'message':_0x5c7bee[_0x5cdd('0x49')]};return;})[_0x5cdd('0x16')](function(){if(_0x11daa3['List']){if(_0x11daa3[_0x5cdd('0x59')][_0x5cdd('0x5a')]['length']){return _0x11daa3[_0x5cdd('0x59')][_0x5cdd('0x5a')][0x0];}else{return db[_0x5cdd('0x4f')][_0x5cdd('0x4b')](_[_0x5cdd('0xc')](_0x5c7bee[_0x5cdd('0x49')],{'firstName':_0x5c7bee[_0x5cdd('0x49')]['to'],'email':_0x5c7bee[_0x5cdd('0x49')]['to'],'phone':_0x5c7bee[_0x5cdd('0x49')]['to'],'ListId':_0x11daa3[_0x5cdd('0x5b')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0xa59047){return respondWithRpcPromise(_0x5cdd('0x5c'),_0x5cdd('0x5d'),_0xa59047,client9003)[_0x5cdd('0x16')](function(_0x21ed4a){return _0x56cfc4[_0x5cdd('0x27')]({'read':!![],'messageId':_0x21ed4a['messageId'],'sentAt':moment()[_0x5cdd('0x5e')](_0x5cdd('0x5f'))});})['catch'](function(_0x5f585f){logger[_0x5cdd('0x1b')]('%s',JSON['stringify'](_0x5f585f));return _0x56cfc4;});}return _0x56cfc4;});}return _0x56cfc4;}})[_0x5cdd('0x16')](respondWithResult(_0x27136f,0xc9))['catch'](handleError(_0x27136f,null));};exports[_0x5cdd('0x60')]=function(_0x2683ee,_0x3cce7c){var _0x4c9be4={'agent':{},'channel':_0x5cdd('0x61')};if(_0x2683ee['body']['id']){delete _0x2683ee[_0x5cdd('0x49')]['id'];}_0x2683ee[_0x5cdd('0x49')][_0x5cdd('0x62')]=!![];_0x2683ee['body'][_0x5cdd('0x63')]=moment()[_0x5cdd('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2683ee[_0x5cdd('0x49')][_0x5cdd('0x64')]=_0x2683ee[_0x5cdd('0x49')][_0x5cdd('0x64')]||_0x2683ee[_0x5cdd('0x65')]['id'];_0x4c9be4[_0x5cdd('0x66')]['id']=_0x2683ee['body'][_0x5cdd('0x64')];return db[_0x5cdd('0x2d')][_0x5cdd('0x4a')]({'where':{'id':_0x2683ee['params']['id'],'UserId':null}})[_0x5cdd('0x16')](handleEntityNotFound(_0x3cce7c,null))['then'](saveUpdates(_0x2683ee[_0x5cdd('0x49')],null))[_0x5cdd('0x16')](function(_0xb261f9){if(_0xb261f9){_0x4c9be4[_0x5cdd('0x1d')]=_0xb261f9['get']({'plain':!![]});return db[_0x5cdd('0x67')][_0x5cdd('0x4a')]({'where':{'id':_0xb261f9[_0x5cdd('0x68')]}});}return null;})[_0x5cdd('0x16')](handleEntityNotFound(_0x3cce7c,null))[_0x5cdd('0x16')](function(_0x48bb7e){if(_0x48bb7e){return _0x48bb7e[_0x5cdd('0x27')]({'UserId':_0x2683ee['body'][_0x5cdd('0x64')],'read1stAt':_[_0x5cdd('0x69')](_0x48bb7e['read1stAt'])?moment()[_0x5cdd('0x5e')](_0x5cdd('0x5f')):undefined});}return null;})[_0x5cdd('0x16')](function(_0x1f0561){if(_0x1f0561){_0x4c9be4['interaction']=_0x1f0561[_0x5cdd('0x6a')]({'plain':!![]});interaction_log[_0x5cdd('0x17')](_0x5cdd('0x6b'),_0x2683ee[_0x5cdd('0x65')]['id'],_0x2683ee[_0x5cdd('0x65')][_0x5cdd('0x29')],_0x2683ee[_0x5cdd('0x65')]['role'],_0x4c9be4[_0x5cdd('0x6c')]['id'],_0x2683ee['body']?JSON[_0x5cdd('0x6d')](_0x2683ee[_0x5cdd('0x49')]):'null');return respondWithRpcPromise(_0x5cdd('0x6e'),_0x5cdd('0x6f'),_0x4c9be4);}return null;})['then'](function(_0xf55555){var _0x571544=_0x5cdd('0x70')+_0xf55555[_0x5cdd('0x1d')][_0x5cdd('0x71')];return db[_0x5cdd('0x72')][_0x5cdd('0x31')](_0x571544,{'type':db[_0x5cdd('0x73')]['QueryTypes'][_0x5cdd('0x74')],'raw':!![]})[_0x5cdd('0x16')](function(_0x2490d6){return _0x2490d6;});})[_0x5cdd('0x16')](function(_0x54868b){if(_0x54868b){_0x4c9be4[_0x5cdd('0x1d')][_0x5cdd('0x75')]=_0x54868b[0x0];if(!_0x2683ee[_0x5cdd('0x49')][_0x5cdd('0x64')])return;return db[_0x5cdd('0x76')][_0x5cdd('0x4a')]({'where':{'id':_0x2683ee[_0x5cdd('0x49')][_0x5cdd('0x64')],'role':_0x5cdd('0x66')},'attributes':['id',_0x5cdd('0x29'),'fullname','email',_0x5cdd('0x77')],'raw':!![]});}return null;})[_0x5cdd('0x16')](function(_0x3899eb){if(!_0x3899eb)return null;_0x4c9be4[_0x5cdd('0x1d')][_0x5cdd('0x66')]=_0x3899eb;return _0x4c9be4;})['then'](function(_0xc55d68){if(_0xc55d68){if(_0x2683ee[_0x5cdd('0x49')][_0x5cdd('0x78')]){_0x4c9be4[_0x5cdd('0x1d')]['interface']=util[_0x5cdd('0x5e')](_0x5cdd('0x79'),_0x2683ee[_0x5cdd('0x65')][_0x5cdd('0x29')]);_0x4c9be4[_0x5cdd('0x1d')]['channel']=_0x4c9be4[_0x5cdd('0x7a')];_0x4c9be4[_0x5cdd('0x1d')][_0x5cdd('0x7b')]=_0x4c9be4[_0x5cdd('0x7a')];_0x4c9be4[_0x5cdd('0x1d')]['event']='accept';_0x4c9be4['message'][_0x5cdd('0x49')]=htmlToText[_0x5cdd('0x7c')](_0x4c9be4[_0x5cdd('0x1d')][_0x5cdd('0x49')]);return respondWithRpcPromise(_0x5cdd('0x7d'),'EventManager',{'event':_0x5cdd('0x7e'),'message':_0x4c9be4[_0x5cdd('0x1d')]},client9002)[_0x5cdd('0x16')](function(){return _0x4c9be4;});}return _0x4c9be4;}return null;})['then'](respondWithResult(_0x3cce7c,null))[_0x5cdd('0x1f')](handleError(_0x3cce7c,null));};exports[_0x5cdd('0x7f')]=function(_0x2a9a65,_0x4dc192){var _0x168c5e={'agent':{},'channel':_0x5cdd('0x61')};if(_0x2a9a65['body']['id']){delete _0x2a9a65[_0x5cdd('0x49')]['id'];}_0x2a9a65[_0x5cdd('0x49')][_0x5cdd('0x64')]=_0x2a9a65[_0x5cdd('0x49')][_0x5cdd('0x64')]||_0x2a9a65['user']['id'];_0x168c5e[_0x5cdd('0x66')]['id']=_0x2a9a65[_0x5cdd('0x49')][_0x5cdd('0x64')];return db['MailMessage'][_0x5cdd('0x4a')]({'where':{'id':_0x2a9a65[_0x5cdd('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4dc192,null))[_0x5cdd('0x16')](function(_0x2088ce){if(_0x2088ce){_0x168c5e[_0x5cdd('0x1d')]=_0x2088ce['get']({'plain':!![]});return db[_0x5cdd('0x67')][_0x5cdd('0x4a')]({'where':{'id':_0x2088ce[_0x5cdd('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x4dc192,null))[_0x5cdd('0x16')](function(_0xef6397){if(_0xef6397){_0x168c5e[_0x5cdd('0x6c')]=_0xef6397['get']({'plain':!![]});interaction_log[_0x5cdd('0x17')](_0x5cdd('0x80'),_0x2a9a65[_0x5cdd('0x65')]['id'],_0x2a9a65[_0x5cdd('0x65')][_0x5cdd('0x29')],_0x2a9a65[_0x5cdd('0x65')][_0x5cdd('0x81')],_0x168c5e[_0x5cdd('0x6c')]['id'],_0x2a9a65['body']?JSON[_0x5cdd('0x6d')](_0x2a9a65[_0x5cdd('0x49')]):'null');return respondWithRpcPromise(_0x5cdd('0x82'),_0x5cdd('0x83'),_0x168c5e);}return null;})['then'](function(_0x12cd1e){var _0x50b7ae=_0x5cdd('0x70')+_0x12cd1e['message']['ContactId'];return db['sequelize'][_0x5cdd('0x31')](_0x50b7ae,{'type':db['Sequelize']['QueryTypes'][_0x5cdd('0x74')],'raw':!![]})['then'](function(_0x18b1e0){return _0x18b1e0;});})[_0x5cdd('0x16')](function(_0x4910b9){if(_0x4910b9){_0x168c5e['message']['contact']=_0x4910b9[0x0];if(!_0x2a9a65['body']['UserId'])return;return db['User'][_0x5cdd('0x4a')]({'where':{'id':_0x2a9a65[_0x5cdd('0x49')][_0x5cdd('0x64')],'role':_0x5cdd('0x66')},'attributes':['id',_0x5cdd('0x29'),_0x5cdd('0x84'),_0x5cdd('0x85'),_0x5cdd('0x77')],'raw':!![]});}return null;})[_0x5cdd('0x16')](function(_0x4f9311){if(!_0x4f9311)return null;_0x168c5e['message'][_0x5cdd('0x66')]=_0x4f9311;return _0x168c5e;})[_0x5cdd('0x16')](function(_0x264769){if(_0x264769){_0x264769[_0x5cdd('0x1d')][_0x5cdd('0x86')]=util[_0x5cdd('0x5e')](_0x5cdd('0x79'),_0x2a9a65[_0x5cdd('0x65')]['name']);_0x264769[_0x5cdd('0x1d')][_0x5cdd('0x7a')]=_0x168c5e[_0x5cdd('0x7a')];_0x264769[_0x5cdd('0x1d')]['motionChannel']=_0x168c5e[_0x5cdd('0x7a')];_0x264769['message']['event']=_0x5cdd('0x7f');_0x264769[_0x5cdd('0x1d')][_0x5cdd('0x49')]=htmlToText[_0x5cdd('0x7c')](_0x168c5e[_0x5cdd('0x1d')]['body']);respondWithRpcPromise('EventManager',_0x5cdd('0x7d'),{'event':_0x5cdd('0x87'),'message':_0x264769[_0x5cdd('0x1d')]},client9002);return _0x168c5e;}return null;})[_0x5cdd('0x16')](respondWithResult(_0x4dc192,null))[_0x5cdd('0x1f')](handleError(_0x4dc192,null));};exports['download']=function(_0x2315a5,_0x350494){var _0x28b953=moment()['unix']()[_0x5cdd('0x88')]();var _0x2a6c62=path[_0x5cdd('0x57')](config['root'],'server',_0x5cdd('0x89'),_0x5cdd('0x8a'));var _0x1fd684=path[_0x5cdd('0x57')](config[_0x5cdd('0x8b')],'server','files',_0x5cdd('0x56'));var _0x111ebe=util[_0x5cdd('0x5e')](_0x5cdd('0x8c'),_0x28b953);return db[_0x5cdd('0x2d')]['find']({'where':{'id':_0x2315a5[_0x5cdd('0x48')]['id']},'attributes':['id','body',_0x5cdd('0x8d'),'to','cc',_0x5cdd('0x8e'),_0x5cdd('0x8f'),_0x5cdd('0x90')],'include':_0x2315a5[_0x5cdd('0x31')]['attachments']?[{'model':db['Attachment'],'as':_0x5cdd('0x91')}]:undefined})[_0x5cdd('0x16')](handleEntityNotFound(_0x350494,null))['then'](function(_0xa4d100){if(_0xa4d100){var _0x328a6f=_0xa4d100;var _0x41c827={'from':_0x328a6f['from'],'to':_0x328a6f['to'],'subject':_0x328a6f[_0x5cdd('0x8f')],'html':htmlEntities[_0x5cdd('0x92')](_0x328a6f[_0x5cdd('0x49')]),'headers':{'Date':moment(_0x328a6f[_0x5cdd('0x90')])['format'](_0x5cdd('0x93'))},'attachments':[]};if(_0xa4d100['cc']){_0x41c827[_0x5cdd('0x94')]['Cc']=_0xa4d100['cc'];}if(_0xa4d100['bcc']){_0x41c827['headers']['Bcc']=_0xa4d100[_0x5cdd('0x8e')];}return new BPromise(function(_0x3db31b,_0x1dfdf0){if(_0xa4d100['Attachments']){for(var _0x37abc6=0x0;_0x37abc6<_0xa4d100[_0x5cdd('0x91')][_0x5cdd('0x38')];_0x37abc6++){var _0x2bdd88=_0xa4d100[_0x5cdd('0x91')][_0x37abc6];var _0x8f23af=path[_0x5cdd('0x57')](_0x1fd684,_0x2bdd88[_0x5cdd('0x58')]);if(fs[_0x5cdd('0x95')](_0x8f23af)){_0x41c827['attachments']['push']({'name':_0x2bdd88['name'],'contentType':_0x2bdd88['type'],'data':fs[_0x5cdd('0x96')](_0x8f23af)});}}}emlformat['build'](_0x41c827,function(_0x2d719a,_0x841e87){if(_0x2d719a)return _0x1dfdf0(_0x2d719a);fs[_0x5cdd('0x97')](path[_0x5cdd('0x57')](_0x2a6c62,_0x111ebe),_0x841e87);return _0x3db31b(_0x841e87);});});}})[_0x5cdd('0x16')](function(_0xbe4851){if(_0xbe4851){return _0x350494[_0x5cdd('0x98')](path[_0x5cdd('0x57')](_0x2a6c62,_0x111ebe),_0x111ebe,function(_0x4df04c){if(!_0x4df04c)fs[_0x5cdd('0x99')](path[_0x5cdd('0x57')](_0x2a6c62,_0x111ebe));});}})['catch'](handleError(_0x350494,null));}; \ No newline at end of file +var _0xcdcd=['socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','destroy','end','sendStatus','name','send','index','map','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','order','sort','where','pick','filter','merge','type','MailMessage','includeAll','include','findAll','rows','show','params','options','find','body','describe','create','direction','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp','getSmtpOptions','attachments','length','join','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','channel','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','internal','interface','SIP/%s','motionChannel','rejectmessage','download','files','tmp','server','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','build','writeFileSync','unlinkSync','eml-format','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xcdcd,0x123));var _0xdcdc=function(_0x3ccac1,_0x5cc7ea){_0x3ccac1=_0x3ccac1-0x0;var _0x10b20b=_0xcdcd[_0x3ccac1];return _0x10b20b;};'use strict';var emlformat=require(_0xdcdc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xdcdc('0x1'));var Redis=require(_0xdcdc('0x2'));var htmlToText=require(_0xdcdc('0x3'));var qs=require(_0xdcdc('0x4'));var logger=require(_0xdcdc('0x5'))(_0xdcdc('0x6'));var interaction_log=require(_0xdcdc('0x5'))('mail-interactions');var config=require('../../config/environment');var db=require(_0xdcdc('0x7'))['db'];config[_0xdcdc('0x8')]=_[_0xdcdc('0x9')](config[_0xdcdc('0x8')],{'host':_0xdcdc('0xa'),'port':0x18eb});var socket=require(_0xdcdc('0xb'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xdcdc('0xc'))[_0xdcdc('0xd')](socket);var jayson=require(_0xdcdc('0xe'));var client=jayson[_0xdcdc('0xf')][_0xdcdc('0x10')]({'port':0x232c});var client9003=jayson[_0xdcdc('0xf')][_0xdcdc('0x10')]({'port':0x232b});var client9002=jayson[_0xdcdc('0xf')][_0xdcdc('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x2fb4c9,_0x38a3c0,_0x75fcd9,_0x1062ca){return new BPromise(function(_0x54f2cd,_0x260131){var _0x27eeb4=_0x1062ca||client;return _0x27eeb4[_0xdcdc('0x11')](_0x2fb4c9,_0x75fcd9)[_0xdcdc('0x12')](function(_0x424e77){logger[_0xdcdc('0x13')](_0xdcdc('0x14'),_0x38a3c0,_0xdcdc('0x15'));logger['debug'](_0xdcdc('0x16'),_0x38a3c0,'request\x20sent',JSON[_0xdcdc('0x17')](_0x424e77));if(_0x424e77[_0xdcdc('0x18')]){if(_0x424e77[_0xdcdc('0x18')][_0xdcdc('0x19')]===0x1f4){logger[_0xdcdc('0x18')]('MailMessage,\x20%s,\x20%s',_0x38a3c0,_0x424e77[_0xdcdc('0x18')][_0xdcdc('0x1a')]);return _0x260131(_0x424e77[_0xdcdc('0x18')][_0xdcdc('0x1a')]);}logger[_0xdcdc('0x18')](_0xdcdc('0x14'),_0x38a3c0,_0x424e77[_0xdcdc('0x18')]['message']);return _0x54f2cd(_0x424e77[_0xdcdc('0x18')][_0xdcdc('0x1a')]);}else{logger['info'](_0xdcdc('0x14'),_0x38a3c0,_0xdcdc('0x15'));_0x54f2cd(_0x424e77['result'][_0xdcdc('0x1a')]);}})[_0xdcdc('0x1b')](function(_0x54426a){logger[_0xdcdc('0x18')](_0xdcdc('0x14'),_0x38a3c0,_0x54426a);_0x260131(_0x54426a);});});}function respondWithResult(_0x44538b,_0x2270cb){_0x2270cb=_0x2270cb||0xc8;return function(_0x4b611e){if(_0x4b611e){return _0x44538b[_0xdcdc('0x1c')](_0x2270cb)[_0xdcdc('0x1d')](_0x4b611e);}};}function respondWithFilteredResult(_0xb21c5a,_0x50a13b){return function(_0x22d2fb){if(_0x22d2fb){var _0xcd1b7a=typeof _0x50a13b[_0xdcdc('0x1e')]===_0xdcdc('0x1f')&&typeof _0x50a13b[_0xdcdc('0x20')]===_0xdcdc('0x1f');var _0x46e4ab=_0x22d2fb[_0xdcdc('0x21')];var _0x10248a=_0xcd1b7a?0x0:_0x50a13b['offset'];var _0x5c1c5a=_0xcd1b7a?_0x22d2fb[_0xdcdc('0x21')]:_0x50a13b[_0xdcdc('0x1e')]+_0x50a13b[_0xdcdc('0x20')];var _0x4aaefd;if(_0x5c1c5a>=_0x46e4ab){_0x5c1c5a=_0x46e4ab;_0x4aaefd=0xc8;}else{_0x4aaefd=0xce;}_0xb21c5a[_0xdcdc('0x1c')](_0x4aaefd);return _0xb21c5a['set']('Content-Range',_0x10248a+'-'+_0x5c1c5a+'/'+_0x46e4ab)[_0xdcdc('0x1d')](_0x22d2fb);}return null;};}function saveUpdates(_0x17217d){return function(_0x3ad053){if(_0x3ad053){return _0x3ad053['update'](_0x17217d)[_0xdcdc('0x12')](function(_0x5266b4){return _0x5266b4;});}return null;};}function removeEntity(_0x33d5c8){return function(_0xa6056b){if(_0xa6056b){return _0xa6056b[_0xdcdc('0x22')]()[_0xdcdc('0x12')](function(){_0x33d5c8[_0xdcdc('0x1c')](0xcc)[_0xdcdc('0x23')]();});}};}function handleEntityNotFound(_0x35337e){return function(_0x59ada4){if(!_0x59ada4){_0x35337e[_0xdcdc('0x24')](0x194);}return _0x59ada4;};}function handleError(_0x2f1b2a,_0x35be77){_0x35be77=_0x35be77||0x1f4;return function(_0x4f7446){logger[_0xdcdc('0x18')](_0x4f7446['stack']);if(_0x4f7446[_0xdcdc('0x25')]){delete _0x4f7446[_0xdcdc('0x25')];}_0x2f1b2a[_0xdcdc('0x1c')](_0x35be77)[_0xdcdc('0x26')](_0x4f7446);};}exports[_0xdcdc('0x27')]=function(_0xec4852,_0x56d544){var _0x18fc26={},_0x1cc63e={},_0x5017b5={'count':0x0,'rows':[]};var _0x70e789=_[_0xdcdc('0x28')](db['MailMessage'][_0xdcdc('0x29')],function(_0x3580f2){return{'name':_0x3580f2['fieldName'],'type':_0x3580f2['type'][_0xdcdc('0x2a')]};});_0x1cc63e['model']=_[_0xdcdc('0x28')](_0x70e789,_0xdcdc('0x25'));_0x1cc63e['query']=_[_0xdcdc('0x2b')](_0xec4852[_0xdcdc('0x2c')]);_0x1cc63e[_0xdcdc('0x2d')]=_[_0xdcdc('0x2e')](_0x1cc63e['model'],_0x1cc63e['query']);_0x18fc26[_0xdcdc('0x2f')]=_[_0xdcdc('0x2e')](_0x1cc63e[_0xdcdc('0x30')],qs['fields'](_0xec4852[_0xdcdc('0x2c')][_0xdcdc('0x31')]));_0x18fc26[_0xdcdc('0x2f')]=_0x18fc26[_0xdcdc('0x2f')]['length']?_0x18fc26[_0xdcdc('0x2f')]:_0x1cc63e[_0xdcdc('0x30')];if(!_0xec4852[_0xdcdc('0x2c')]['hasOwnProperty']('nolimit')){_0x18fc26['limit']=qs['limit'](_0xec4852[_0xdcdc('0x2c')][_0xdcdc('0x20')]);_0x18fc26['offset']=qs[_0xdcdc('0x1e')](_0xec4852[_0xdcdc('0x2c')][_0xdcdc('0x1e')]);}_0x18fc26[_0xdcdc('0x32')]=qs[_0xdcdc('0x33')](_0xec4852['query']['sort']);_0x18fc26[_0xdcdc('0x34')]=qs['filters'](_[_0xdcdc('0x35')](_0xec4852[_0xdcdc('0x2c')],_0x1cc63e[_0xdcdc('0x2d')]),_0x70e789);if(_0xec4852[_0xdcdc('0x2c')][_0xdcdc('0x36')]){_0x18fc26['where']=_[_0xdcdc('0x37')](_0x18fc26[_0xdcdc('0x34')],{'$or':_['map'](_0x70e789,function(_0x243383){if(_0x243383[_0xdcdc('0x38')]!=='VIRTUAL'){var _0x4df6a3={};_0x4df6a3[_0x243383['name']]={'$like':'%'+_0xec4852['query'][_0xdcdc('0x36')]+'%'};return _0x4df6a3;}})});}_0x18fc26=_[_0xdcdc('0x37')]({},_0x18fc26,_0xec4852['options']);var _0x561d6c={'where':_0x18fc26[_0xdcdc('0x34')]};return db[_0xdcdc('0x39')]['count'](_0x561d6c)['then'](function(_0x2b50d5){_0x5017b5[_0xdcdc('0x21')]=_0x2b50d5;if(_0xec4852[_0xdcdc('0x2c')][_0xdcdc('0x3a')]){_0x18fc26[_0xdcdc('0x3b')]=[{'all':!![]}];}return db['MailMessage'][_0xdcdc('0x3c')](_0x18fc26);})['then'](function(_0x5e32bb){_0x5017b5[_0xdcdc('0x3d')]=_0x5e32bb;return _0x5017b5;})['then'](respondWithFilteredResult(_0x56d544,_0x18fc26))[_0xdcdc('0x1b')](handleError(_0x56d544,null));};exports[_0xdcdc('0x3e')]=function(_0x1ecacb,_0x444ea5){var _0x47f50a={'raw':!![],'where':{'id':_0x1ecacb[_0xdcdc('0x3f')]['id']}},_0x3cd271={};_0x3cd271[_0xdcdc('0x30')]=_[_0xdcdc('0x2b')](db[_0xdcdc('0x39')][_0xdcdc('0x29')]);_0x3cd271[_0xdcdc('0x2c')]=_[_0xdcdc('0x2b')](_0x1ecacb[_0xdcdc('0x2c')]);_0x3cd271[_0xdcdc('0x2d')]=_['intersection'](_0x3cd271['model'],_0x3cd271['query']);_0x47f50a[_0xdcdc('0x2f')]=_[_0xdcdc('0x2e')](_0x3cd271['model'],qs[_0xdcdc('0x31')](_0x1ecacb['query']['fields']));_0x47f50a[_0xdcdc('0x2f')]=_0x47f50a['attributes']['length']?_0x47f50a[_0xdcdc('0x2f')]:_0x3cd271[_0xdcdc('0x30')];if(_0x1ecacb[_0xdcdc('0x2c')][_0xdcdc('0x3a')]){_0x47f50a[_0xdcdc('0x3b')]=[{'all':!![]}];}_0x47f50a=_[_0xdcdc('0x37')]({},_0x47f50a,_0x1ecacb[_0xdcdc('0x40')]);return db['MailMessage'][_0xdcdc('0x41')](_0x47f50a)[_0xdcdc('0x12')](handleEntityNotFound(_0x444ea5,null))[_0xdcdc('0x12')](respondWithResult(_0x444ea5,null))[_0xdcdc('0x1b')](handleError(_0x444ea5,null));};exports['update']=function(_0x40f060,_0x379330){if(_0x40f060[_0xdcdc('0x42')]['id']){delete _0x40f060[_0xdcdc('0x42')]['id'];}return db['MailMessage'][_0xdcdc('0x41')]({'where':{'id':_0x40f060[_0xdcdc('0x3f')]['id']}})[_0xdcdc('0x12')](handleEntityNotFound(_0x379330,null))[_0xdcdc('0x12')](saveUpdates(_0x40f060[_0xdcdc('0x42')],null))[_0xdcdc('0x12')](respondWithResult(_0x379330,null))['catch'](handleError(_0x379330,null));};exports[_0xdcdc('0x22')]=function(_0x198c0f,_0x58b4ff){return db[_0xdcdc('0x39')][_0xdcdc('0x41')]({'where':{'id':_0x198c0f['params']['id']}})[_0xdcdc('0x12')](handleEntityNotFound(_0x58b4ff,null))[_0xdcdc('0x12')](removeEntity(_0x58b4ff,null))['catch'](handleError(_0x58b4ff,null));};exports['describe']=function(_0x398544,_0x255af1){return db[_0xdcdc('0x39')][_0xdcdc('0x43')]()['then'](respondWithResult(_0x255af1,null))[_0xdcdc('0x1b')](handleError(_0x255af1,null));};exports[_0xdcdc('0x44')]=function(_0x2415f3,_0x179028){return db[_0xdcdc('0x39')]['create'](_0x2415f3[_0xdcdc('0x42')])[_0xdcdc('0x12')](function(_0x1fccec){if(_0x1fccec){if(_0x1fccec[_0xdcdc('0x45')]===_0xdcdc('0x46')&&!_0x1fccec[_0xdcdc('0x47')]){var _0x2164ad,_0x2a08a9,_0x167716;if(_0x2415f3[_0xdcdc('0x42')]['to']){_0x2a08a9=_0x2415f3[_0xdcdc('0x42')]['to']['split'](',')[0x0];}return db[_0xdcdc('0x48')]['findOne']({'where':{'id':_0x1fccec[_0xdcdc('0x49')]},'include':[{'model':db[_0xdcdc('0x4a')],'as':_0xdcdc('0x4b'),'include':[{'model':db[_0xdcdc('0x4c')],'as':_0xdcdc('0x4d'),'where':{'email':_0x2a08a9},'limit':0x1,'order':[[_0xdcdc('0x4e'),_0xdcdc('0x4f')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xdcdc('0x50')],'as':_0xdcdc('0x50'),'raw':!![]}]}]})[_0xdcdc('0x12')](function(_0x1a8f79){_0x2164ad=_0x1a8f79;if(!_0x2164ad||!_0x2164ad[_0xdcdc('0x51')])return;var _0x27b885=_0x2164ad[_0xdcdc('0x52')]();if(_0x2415f3[_0xdcdc('0x42')][_0xdcdc('0x53')]&&_0x2415f3[_0xdcdc('0x42')]['attachments'][_0xdcdc('0x54')]){for(var _0x3fbe6a=0x0;_0x3fbe6a<_0x2415f3[_0xdcdc('0x42')][_0xdcdc('0x53')][_0xdcdc('0x54')];_0x3fbe6a+=0x1){_0x2415f3['body'][_0xdcdc('0x53')][_0x3fbe6a]={'filename':_0x2415f3['body']['attachments'][_0x3fbe6a][_0xdcdc('0x25')],'path':path[_0xdcdc('0x55')](config[_0xdcdc('0x56')],_0xdcdc('0x57'),_0x2415f3[_0xdcdc('0x42')][_0xdcdc('0x53')][_0x3fbe6a]['basename'])};}}_0x167716={'account':_0x27b885,'message':_0x2415f3[_0xdcdc('0x42')]};return;})[_0xdcdc('0x12')](function(){if(_0x2164ad[_0xdcdc('0x4b')]){if(_0x2164ad[_0xdcdc('0x4b')][_0xdcdc('0x4d')]['length']){return _0x2164ad[_0xdcdc('0x4b')][_0xdcdc('0x4d')][0x0];}else{return db[_0xdcdc('0x4c')]['create'](_['defaults'](_0x2415f3[_0xdcdc('0x42')],{'firstName':_0x2415f3['body']['to'],'email':_0x2415f3[_0xdcdc('0x42')]['to'],'phone':_0x2415f3[_0xdcdc('0x42')]['to'],'ListId':_0x2164ad[_0xdcdc('0x58')]}));}}else{throw new Error(_0xdcdc('0x59'));}})[_0xdcdc('0x12')](function(){if(_0x167716){return respondWithRpcPromise(_0xdcdc('0x5a'),'sendMail',_0x167716,client9003)['then'](function(_0x153179){return _0x1fccec[_0xdcdc('0x5b')]({'read':!![],'messageId':_0x153179[_0xdcdc('0x5c')],'sentAt':moment()[_0xdcdc('0x5d')](_0xdcdc('0x5e'))});})[_0xdcdc('0x1b')](function(_0x2f5e9b){logger['error']('%s',JSON[_0xdcdc('0x17')](_0x2f5e9b));return _0x1fccec;});}return _0x1fccec;});}return _0x1fccec;}})[_0xdcdc('0x12')](respondWithResult(_0x179028,0xc9))[_0xdcdc('0x1b')](handleError(_0x179028,null));};exports[_0xdcdc('0x5f')]=function(_0x7cca5c,_0x567c3f){var _0x3bb950={'agent':{},'channel':_0xdcdc('0x60')};if(_0x7cca5c[_0xdcdc('0x42')]['id']){delete _0x7cca5c[_0xdcdc('0x42')]['id'];}_0x7cca5c[_0xdcdc('0x42')]['read']=!![];_0x7cca5c[_0xdcdc('0x42')][_0xdcdc('0x61')]=moment()['format'](_0xdcdc('0x5e'));_0x7cca5c[_0xdcdc('0x42')][_0xdcdc('0x62')]=_0x7cca5c[_0xdcdc('0x42')][_0xdcdc('0x62')]||_0x7cca5c[_0xdcdc('0x63')]['id'];_0x3bb950[_0xdcdc('0x64')]['id']=_0x7cca5c[_0xdcdc('0x42')]['UserId'];return db['MailMessage'][_0xdcdc('0x41')]({'where':{'id':_0x7cca5c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x567c3f,null))['then'](saveUpdates(_0x7cca5c[_0xdcdc('0x42')],null))[_0xdcdc('0x12')](function(_0x24bf34){if(_0x24bf34){_0x3bb950[_0xdcdc('0x1a')]=_0x24bf34[_0xdcdc('0x65')]({'plain':!![]});return db[_0xdcdc('0x66')][_0xdcdc('0x41')]({'where':{'id':_0x24bf34[_0xdcdc('0x67')]}});}return null;})[_0xdcdc('0x12')](handleEntityNotFound(_0x567c3f,null))['then'](function(_0x50c5d3){if(_0x50c5d3){return _0x50c5d3['update']({'UserId':_0x7cca5c[_0xdcdc('0x42')]['UserId'],'read1stAt':_[_0xdcdc('0x68')](_0x50c5d3['read1stAt'])?moment()[_0xdcdc('0x5d')](_0xdcdc('0x5e')):undefined});}return null;})[_0xdcdc('0x12')](function(_0x4584e1){if(_0x4584e1){_0x3bb950[_0xdcdc('0x69')]=_0x4584e1['get']({'plain':!![]});interaction_log['info'](_0xdcdc('0x6a'),_0x7cca5c[_0xdcdc('0x63')]['id'],_0x7cca5c[_0xdcdc('0x63')]['name'],_0x7cca5c[_0xdcdc('0x63')][_0xdcdc('0x6b')],_0x3bb950['interaction']['id'],_0x7cca5c['body']?JSON[_0xdcdc('0x17')](_0x7cca5c[_0xdcdc('0x42')]):_0xdcdc('0x6c'));return respondWithRpcPromise(_0xdcdc('0x6d'),_0xdcdc('0x6e'),_0x3bb950);}return null;})[_0xdcdc('0x12')](function(_0x3ba0d2){var _0x14c0f1=_0xdcdc('0x6f')+_0x3ba0d2['message'][_0xdcdc('0x70')];return db[_0xdcdc('0x71')]['query'](_0x14c0f1,{'type':db[_0xdcdc('0x72')][_0xdcdc('0x73')][_0xdcdc('0x74')],'raw':!![]})['then'](function(_0x48adc1){return _0x48adc1;});})[_0xdcdc('0x12')](function(_0x431a0e){if(_0x431a0e){_0x3bb950[_0xdcdc('0x1a')][_0xdcdc('0x75')]=_0x431a0e[0x0];if(!_0x7cca5c['body']['UserId'])return;return db[_0xdcdc('0x76')][_0xdcdc('0x41')]({'where':{'id':_0x7cca5c[_0xdcdc('0x42')][_0xdcdc('0x62')],'role':'agent'},'attributes':['id','name',_0xdcdc('0x77'),_0xdcdc('0x78'),'internal'],'raw':!![]});}return null;})[_0xdcdc('0x12')](function(_0x45d296){if(!_0x45d296)return null;_0x3bb950[_0xdcdc('0x1a')][_0xdcdc('0x64')]=_0x45d296;return _0x3bb950;})[_0xdcdc('0x12')](function(_0x4adaa8){if(_0x4adaa8){if(_0x7cca5c['body'][_0xdcdc('0x79')]){_0x3bb950[_0xdcdc('0x1a')]['interface']=util[_0xdcdc('0x5d')]('SIP/%s',_0x7cca5c['user'][_0xdcdc('0x25')]);_0x3bb950[_0xdcdc('0x1a')][_0xdcdc('0x7a')]=_0x3bb950[_0xdcdc('0x7a')];_0x3bb950[_0xdcdc('0x1a')]['motionChannel']=_0x3bb950[_0xdcdc('0x7a')];_0x3bb950[_0xdcdc('0x1a')]['event']=_0xdcdc('0x5f');_0x3bb950[_0xdcdc('0x1a')][_0xdcdc('0x42')]=htmlToText[_0xdcdc('0x7b')](_0x3bb950[_0xdcdc('0x1a')]['body']);return respondWithRpcPromise(_0xdcdc('0x7c'),'EventManager',{'event':'acceptmessage','message':_0x3bb950[_0xdcdc('0x1a')]},client9002)[_0xdcdc('0x12')](function(){return _0x3bb950;});}return _0x3bb950;}return null;})['then'](respondWithResult(_0x567c3f,null))[_0xdcdc('0x1b')](handleError(_0x567c3f,null));};exports[_0xdcdc('0x7d')]=function(_0xa358b6,_0x2f3ee5){var _0x2b1b4d={'agent':{},'channel':_0xdcdc('0x60')};if(_0xa358b6['body']['id']){delete _0xa358b6[_0xdcdc('0x42')]['id'];}_0xa358b6[_0xdcdc('0x42')]['UserId']=_0xa358b6[_0xdcdc('0x42')][_0xdcdc('0x62')]||_0xa358b6[_0xdcdc('0x63')]['id'];_0x2b1b4d['agent']['id']=_0xa358b6[_0xdcdc('0x42')]['UserId'];return db['MailMessage'][_0xdcdc('0x41')]({'where':{'id':_0xa358b6[_0xdcdc('0x3f')]['id'],'UserId':null}})[_0xdcdc('0x12')](handleEntityNotFound(_0x2f3ee5,null))[_0xdcdc('0x12')](function(_0xaaf52c){if(_0xaaf52c){_0x2b1b4d[_0xdcdc('0x1a')]=_0xaaf52c[_0xdcdc('0x65')]({'plain':!![]});return db[_0xdcdc('0x66')]['find']({'where':{'id':_0xaaf52c[_0xdcdc('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2f3ee5,null))[_0xdcdc('0x12')](function(_0x20cc40){if(_0x20cc40){_0x2b1b4d['interaction']=_0x20cc40['get']({'plain':!![]});interaction_log[_0xdcdc('0x13')](_0xdcdc('0x7e'),_0xa358b6[_0xdcdc('0x63')]['id'],_0xa358b6['user'][_0xdcdc('0x25')],_0xa358b6[_0xdcdc('0x63')][_0xdcdc('0x6b')],_0x2b1b4d[_0xdcdc('0x69')]['id'],_0xa358b6[_0xdcdc('0x42')]?JSON[_0xdcdc('0x17')](_0xa358b6[_0xdcdc('0x42')]):_0xdcdc('0x6c'));return respondWithRpcPromise(_0xdcdc('0x7f'),'rejectMessage',_0x2b1b4d);}return null;})['then'](function(_0x47496e){var _0x55f48e=_0xdcdc('0x6f')+_0x47496e['message'][_0xdcdc('0x70')];return db['sequelize'][_0xdcdc('0x2c')](_0x55f48e,{'type':db[_0xdcdc('0x72')][_0xdcdc('0x73')]['SELECT'],'raw':!![]})[_0xdcdc('0x12')](function(_0x3e8e9b){return _0x3e8e9b;});})[_0xdcdc('0x12')](function(_0x8110ae){if(_0x8110ae){_0x2b1b4d[_0xdcdc('0x1a')]['contact']=_0x8110ae[0x0];if(!_0xa358b6[_0xdcdc('0x42')]['UserId'])return;return db['User'][_0xdcdc('0x41')]({'where':{'id':_0xa358b6['body'][_0xdcdc('0x62')],'role':_0xdcdc('0x64')},'attributes':['id',_0xdcdc('0x25'),'fullname',_0xdcdc('0x78'),_0xdcdc('0x80')],'raw':!![]});}return null;})['then'](function(_0x43fecf){if(!_0x43fecf)return null;_0x2b1b4d[_0xdcdc('0x1a')][_0xdcdc('0x64')]=_0x43fecf;return _0x2b1b4d;})[_0xdcdc('0x12')](function(_0x5051b5){if(_0x5051b5){_0x5051b5[_0xdcdc('0x1a')][_0xdcdc('0x81')]=util['format'](_0xdcdc('0x82'),_0xa358b6[_0xdcdc('0x63')][_0xdcdc('0x25')]);_0x5051b5['message']['channel']=_0x2b1b4d[_0xdcdc('0x7a')];_0x5051b5[_0xdcdc('0x1a')][_0xdcdc('0x83')]=_0x2b1b4d[_0xdcdc('0x7a')];_0x5051b5['message']['event']='reject';_0x5051b5[_0xdcdc('0x1a')][_0xdcdc('0x42')]=htmlToText[_0xdcdc('0x7b')](_0x2b1b4d['message'][_0xdcdc('0x42')]);respondWithRpcPromise('EventManager',_0xdcdc('0x7c'),{'event':_0xdcdc('0x84'),'message':_0x5051b5['message']},client9002);return _0x2b1b4d;}return null;})['then'](respondWithResult(_0x2f3ee5,null))[_0xdcdc('0x1b')](handleError(_0x2f3ee5,null));};exports[_0xdcdc('0x85')]=function(_0x567e40,_0x5f17e6){var _0x92ce3b=moment()['unix']()['toString']();var _0x35e9f5=path['join'](config['root'],'server',_0xdcdc('0x86'),_0xdcdc('0x87'));var _0x649a6=path['join'](config[_0xdcdc('0x56')],_0xdcdc('0x88'),_0xdcdc('0x86'),_0xdcdc('0x53'));var _0x4b16c0=util['format']('message-%s.eml',_0x92ce3b);return db[_0xdcdc('0x39')][_0xdcdc('0x41')]({'where':{'id':_0x567e40[_0xdcdc('0x3f')]['id']},'attributes':['id',_0xdcdc('0x42'),_0xdcdc('0x89'),'to','cc','bcc',_0xdcdc('0x8a'),_0xdcdc('0x8b')],'include':_0x567e40[_0xdcdc('0x2c')][_0xdcdc('0x53')]?[{'model':db[_0xdcdc('0x8c')],'as':_0xdcdc('0x8d')}]:undefined})['then'](handleEntityNotFound(_0x5f17e6,null))['then'](function(_0x27839d){if(_0x27839d){var _0x11c89f=_0x27839d;var _0x5d5542={'from':_0x11c89f[_0xdcdc('0x89')],'to':_0x11c89f['to'],'subject':_0x11c89f['subject'],'html':htmlEntities[_0xdcdc('0x8e')](_0x11c89f[_0xdcdc('0x42')]),'headers':{'Date':moment(_0x11c89f['createdAt'])[_0xdcdc('0x5d')](_0xdcdc('0x8f'))},'attachments':[]};if(_0x27839d['cc']){_0x5d5542[_0xdcdc('0x90')]['Cc']=_0x27839d['cc'];}if(_0x27839d[_0xdcdc('0x91')]){_0x5d5542[_0xdcdc('0x90')][_0xdcdc('0x92')]=_0x27839d[_0xdcdc('0x91')];}return new BPromise(function(_0x3c224f,_0x4c01f0){if(_0x27839d[_0xdcdc('0x8d')]){for(var _0xba3772=0x0;_0xba3772<_0x27839d['Attachments'][_0xdcdc('0x54')];_0xba3772++){var _0x13075a=_0x27839d[_0xdcdc('0x8d')][_0xba3772];var _0xf2bfe0=path[_0xdcdc('0x55')](_0x649a6,_0x13075a[_0xdcdc('0x93')]);if(fs['existsSync'](_0xf2bfe0)){_0x5d5542[_0xdcdc('0x53')]['push']({'name':_0x13075a['name'],'contentType':_0x13075a[_0xdcdc('0x38')],'data':fs['readFileSync'](_0xf2bfe0)});}}}emlformat[_0xdcdc('0x94')](_0x5d5542,function(_0x1c3152,_0x34749b){if(_0x1c3152)return _0x4c01f0(_0x1c3152);fs[_0xdcdc('0x95')](path[_0xdcdc('0x55')](_0x35e9f5,_0x4b16c0),_0x34749b);return _0x3c224f(_0x34749b);});});}})['then'](function(_0x1d8772){if(_0x1d8772){return _0x5f17e6['download'](path[_0xdcdc('0x55')](_0x35e9f5,_0x4b16c0),_0x4b16c0,function(_0x32a0d5){if(!_0x32a0d5)fs[_0xdcdc('0x96')](path[_0xdcdc('0x55')](_0x35e9f5,_0x4b16c0));});}})[_0xdcdc('0x1b')](handleError(_0x5f17e6,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 454c59f..0ddbd7d 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 _0x9a90=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x348b29,_0x3be5e9){var _0xc260c5=function(_0x568363){while(--_0x568363){_0x348b29['push'](_0x348b29['shift']());}};_0xc260c5(++_0x3be5e9);}(_0x9a90,0x89));var _0x09a9=function(_0x5dba24,_0xcc96ff){_0x5dba24=_0x5dba24-0x0;var _0x4fa586=_0x9a90[_0x5dba24];return _0x4fa586;};'use strict';var EventEmitter=require(_0x09a9('0x0'));var MailMessage=require(_0x09a9('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x09a9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x09a9('0x3'),'afterDestroy':_0x09a9('0x4')};function emitEvent(_0xb47048){return function(_0x29d58d,_0x47a05b,_0x6a35ca){MailMessageEvents[_0x09a9('0x5')](_0xb47048+':'+_0x29d58d['id'],_0x29d58d);MailMessageEvents[_0x09a9('0x5')](_0xb47048,_0x29d58d);_0x6a35ca(null);};}for(var e in events){if(events[_0x09a9('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x09a9('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x1f90=['save','update','remove','emit','hook','exports','MailMessage','setMaxListeners'];(function(_0x2e34f8,_0x53a191){var _0x2b147a=function(_0x10003c){while(--_0x10003c){_0x2e34f8['push'](_0x2e34f8['shift']());}};_0x2b147a(++_0x53a191);}(_0x1f90,0x1a6));var _0x01f9=function(_0x2103dd,_0x2cb8f6){_0x2103dd=_0x2103dd-0x0;var _0x457cf6=_0x1f90[_0x2103dd];return _0x457cf6;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x01f9('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x01f9('0x1')](0x0);var events={'afterCreate':_0x01f9('0x2'),'afterUpdate':_0x01f9('0x3'),'afterDestroy':_0x01f9('0x4')};function emitEvent(_0x2c3013){return function(_0x18ed21,_0x58da4e,_0x4fbbf2){MailMessageEvents[_0x01f9('0x5')](_0x2c3013+':'+_0x18ed21['id'],_0x18ed21);MailMessageEvents[_0x01f9('0x5')](_0x2c3013,_0x18ed21);_0x4fbbf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x01f9('0x6')](e,emitEvent(event));}}module[_0x01f9('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 5f2051d..b69b36e 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 _0x7513=['body','plainBody','fromString','toLowerCase','secret','UserId','MailInteraction','MailInteractionId','then','createdAt','catch','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x7513,0x156));var _0x3751=function(_0x3c0111,_0x40c3e4){_0x3c0111=_0x3c0111-0x0;var _0x4f955d=_0x7513[_0x3c0111];return _0x4f955d;};'use strict';var _=require('lodash');var util=require(_0x3751('0x0'));var logger=require(_0x3751('0x1'))(_0x3751('0x2'));var moment=require('moment');var BPromise=require(_0x3751('0x3'));var rp=require(_0x3751('0x4'));var htmlToText=require(_0x3751('0x5'));var fs=require('fs');var path=require(_0x3751('0x6'));var rimraf=require(_0x3751('0x7'));var config=require(_0x3751('0x8'));var attributes=require(_0x3751('0x9'));module[_0x3751('0xa')]=function(_0x106c22,_0x27a9e0){return _0x106c22[_0x3751('0xb')](_0x3751('0xc'),attributes,{'tableName':_0x3751('0xd'),'paranoid':![],'indexes':[{'name':_0x3751('0xe'),'fields':[_0x3751('0xe')]},{'name':_0x3751('0xf'),'fields':['plainBody',_0x3751('0x10')],'type':_0x3751('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d5756,_0x5e7b4f,_0x5f5c62){if(_0x4d5756[_0x3751('0x12')]){_0x4d5756[_0x3751('0x13')]=htmlToText[_0x3751('0x14')](_0x4d5756[_0x3751('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5f5c62(null,_0x5e7b4f);},'afterCreate':function(_0x4e124d,_0x1d31aa,_0x1d9b90){var _0x9ce4b8=_0x106c22['models'];var _0x585735=_0x4e124d['get']({'plain':!![]});if(_0x585735['direction']['toLowerCase']()==='in'||_0x585735['direction'][_0x3751('0x15')]()==='out'&&!_0x585735[_0x3751('0x16')]&&!_['isNil'](_0x585735[_0x3751('0x17')])){_0x9ce4b8[_0x3751('0x18')]['findOne']({'where':{'id':_0x585735[_0x3751('0x19')]}})[_0x3751('0x1a')](function(_0x1823ac){if(_0x1823ac){_0x1823ac['update']({'lastMsgAt':_0x585735[_0x3751('0x1b')],'lastMsgDirection':_0x585735['direction'][_0x3751('0x15')]()});}})[_0x3751('0x1c')](function(_0x2e253a){console['error'](_0x2e253a);});}_0x1d9b90();}},'charset':'utf8mb4','collate':_0x3751('0x1d')});}; \ No newline at end of file +var _0xd839=['MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','direction','toLowerCase','out','secret','UserId'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xd839,0x153));var _0x9d83=function(_0x489e8c,_0x487e3d){_0x489e8c=_0x489e8c-0x0;var _0x25cc0f=_0xd839[_0x489e8c];return _0x25cc0f;};'use strict';var _=require(_0x9d83('0x0'));var util=require('util');var logger=require(_0x9d83('0x1'))(_0x9d83('0x2'));var moment=require(_0x9d83('0x3'));var BPromise=require(_0x9d83('0x4'));var rp=require(_0x9d83('0x5'));var htmlToText=require(_0x9d83('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d83('0x7'));var config=require(_0x9d83('0x8'));var attributes=require('./mailMessage.attributes');module[_0x9d83('0x9')]=function(_0x3b6607,_0x16d7d4){return _0x3b6607[_0x9d83('0xa')]('MailMessage',attributes,{'tableName':_0x9d83('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9d83('0xc')]},{'name':_0x9d83('0xd'),'fields':[_0x9d83('0xe'),_0x9d83('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44a362,_0xf67806,_0x334e3c){if(_0x44a362[_0x9d83('0x10')]){_0x44a362[_0x9d83('0xe')]=htmlToText[_0x9d83('0x11')](_0x44a362[_0x9d83('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x334e3c(null,_0xf67806);},'afterCreate':function(_0x484b0a,_0x37ab92,_0x15fe5d){var _0x29b6de=_0x3b6607[_0x9d83('0x12')];var _0x57df7d=_0x484b0a['get']({'plain':!![]});if(_0x57df7d[_0x9d83('0x13')][_0x9d83('0x14')]()==='in'||_0x57df7d[_0x9d83('0x13')][_0x9d83('0x14')]()===_0x9d83('0x15')&&!_0x57df7d[_0x9d83('0x16')]&&!_['isNil'](_0x57df7d[_0x9d83('0x17')])){_0x29b6de[_0x9d83('0x18')][_0x9d83('0x19')]({'where':{'id':_0x57df7d[_0x9d83('0x1a')]}})['then'](function(_0x3d44b6){if(_0x3d44b6){_0x3d44b6[_0x9d83('0x1b')]({'lastMsgAt':_0x57df7d[_0x9d83('0x1c')],'lastMsgDirection':_0x57df7d[_0x9d83('0x13')][_0x9d83('0x14')]()});}})[_0x9d83('0x1d')](function(_0x3e0f43){console[_0x9d83('0x1e')](_0x3e0f43);});}_0x15fe5d();}},'charset':_0x9d83('0x1f'),'collate':_0x9d83('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 05be427..d4f7082 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 _0x77e6=['catch','CreateMailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2e1387,_0x2fd52a){var _0xda65a6=function(_0x59d3f5){while(--_0x59d3f5){_0x2e1387['push'](_0x2e1387['shift']());}};_0xda65a6(++_0x2fd52a);}(_0x77e6,0x1a6));var _0x677e=function(_0x2e9672,_0x2873e1){_0x2e9672=_0x2e9672-0x0;var _0x53860c=_0x77e6[_0x2e9672];return _0x53860c;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});config[_0x677e('0xb')]=_['defaults'](config['redis'],{'host':_0x677e('0xc'),'port':0x18eb});var socket=require(_0x677e('0xd'))(new Redis(config[_0x677e('0xb')]));require(_0x677e('0xe'))['register'](socket);function respondWithRpcPromise(_0x206305,_0x5bf52d,_0x3cdbe3){return new BPromise(function(_0x227084,_0x1e4fd9){return client[_0x677e('0xf')](_0x206305,_0x3cdbe3)[_0x677e('0x10')](function(_0x49ca35){logger[_0x677e('0x11')](_0x677e('0x12'),_0x5bf52d,_0x677e('0x13'));logger[_0x677e('0x14')](_0x677e('0x15'),_0x5bf52d,_0x677e('0x13'),JSON[_0x677e('0x16')](_0x49ca35));if(_0x49ca35[_0x677e('0x17')]){if(_0x49ca35['error']['code']===0x1f4){logger['error'](_0x677e('0x12'),_0x5bf52d,_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);return _0x1e4fd9(_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);}logger[_0x677e('0x17')](_0x677e('0x12'),_0x5bf52d,_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);return _0x227084(_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);}else{logger[_0x677e('0x11')]('MailMessage,\x20%s,\x20%s',_0x5bf52d,_0x677e('0x13'));_0x227084(_0x49ca35[_0x677e('0x19')][_0x677e('0x18')]);}})[_0x677e('0x1a')](function(_0xba1c26){logger[_0x677e('0x17')]('MailMessage,\x20%s,\x20%s',_0x5bf52d,_0xba1c26);_0x1e4fd9(_0xba1c26);});});}exports[_0x677e('0x1b')]=function(_0x4bfbb6){var _0x18424e=this;return new Promise(function(_0x267aac,_0x26e9c5){return db['MailMessage'][_0x677e('0x1c')](_0x4bfbb6[_0x677e('0x1d')],{'raw':_0x4bfbb6[_0x677e('0x1e')]?_0x4bfbb6[_0x677e('0x1e')][_0x677e('0x1f')]===undefined?!![]:![]:!![]})[_0x677e('0x10')](function(_0x3a7895){logger['info']('CreateMailMessage',_0x4bfbb6);logger['debug'](_0x677e('0x1b'),_0x4bfbb6,JSON[_0x677e('0x16')](_0x3a7895));_0x267aac(_0x3a7895);})[_0x677e('0x1a')](function(_0x540d0e){logger[_0x677e('0x17')](_0x677e('0x1b'),_0x540d0e[_0x677e('0x18')],_0x4bfbb6);_0x26e9c5(_0x18424e[_0x677e('0x17')](0x1f4,_0x540d0e[_0x677e('0x18')]));});});}; \ No newline at end of file +var _0x958a=['./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4c508e,_0x454421){var _0x380db2=function(_0x131689){while(--_0x131689){_0x4c508e['push'](_0x4c508e['shift']());}};_0x380db2(++_0x454421);}(_0x958a,0x128));var _0xa958=function(_0x5b0a91,_0x160cc1){_0x5b0a91=_0x5b0a91-0x0;var _0x407b2d=_0x958a[_0x5b0a91];return _0x407b2d;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});config[_0xa958('0xb')]=_[_0xa958('0xc')](config[_0xa958('0xb')],{'host':_0xa958('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa958('0xe'))[_0xa958('0xf')](socket);function respondWithRpcPromise(_0x11f090,_0x44b66e,_0x37afa0){return new BPromise(function(_0x94caac,_0xebb1c6){return client[_0xa958('0x10')](_0x11f090,_0x37afa0)[_0xa958('0x11')](function(_0x250999){logger[_0xa958('0x12')](_0xa958('0x13'),_0x44b66e,_0xa958('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x44b66e,'request\x20sent',JSON[_0xa958('0x15')](_0x250999));if(_0x250999[_0xa958('0x16')]){if(_0x250999[_0xa958('0x16')]['code']===0x1f4){logger[_0xa958('0x16')]('MailMessage,\x20%s,\x20%s',_0x44b66e,_0x250999['error']['message']);return _0xebb1c6(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0x250999[_0xa958('0x16')][_0xa958('0x17')]);return _0x94caac(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}else{logger['info'](_0xa958('0x13'),_0x44b66e,'request\x20sent');_0x94caac(_0x250999[_0xa958('0x18')][_0xa958('0x17')]);}})['catch'](function(_0xe4129a){logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0xe4129a);_0xebb1c6(_0xe4129a);});});}exports[_0xa958('0x19')]=function(_0x2759ad){var _0x1f82aa=this;return new Promise(function(_0x56314b,_0x4a90c2){return db[_0xa958('0x1a')][_0xa958('0x1b')](_0x2759ad[_0xa958('0x1c')],{'raw':_0x2759ad['options']?_0x2759ad[_0xa958('0x1d')][_0xa958('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x28cf12){logger[_0xa958('0x12')]('CreateMailMessage',_0x2759ad);logger['debug'](_0xa958('0x19'),_0x2759ad,JSON[_0xa958('0x15')](_0x28cf12));_0x56314b(_0x28cf12);})['catch'](function(_0x25f461){logger[_0xa958('0x16')](_0xa958('0x19'),_0x25f461[_0xa958('0x17')],_0x2759ad);_0x4a90c2(_0x1f82aa[_0xa958('0x16')](0x1f4,_0x25f461[_0xa958('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 278dcad..7b463b9 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 _0x919e=['save','remove','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x5455ac,_0x4add11){var _0x42b45e=function(_0x2778b9){while(--_0x2778b9){_0x5455ac['push'](_0x5455ac['shift']());}};_0x42b45e(++_0x4add11);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var MailMessageEvents=require(_0xe919('0x0'));var events=[_0xe919('0x1'),_0xe919('0x2'),'update'];function createListener(_0x115b01,_0x55cc54){return function(_0x4f9fcd){_0x55cc54[_0xe919('0x3')](_0x115b01,_0x4f9fcd);};}function removeListener(_0x3a1192,_0x2bf552){return function(){MailMessageEvents[_0xe919('0x4')](_0x3a1192,_0x2bf552);};}exports[_0xe919('0x5')]=function(_0x5a27ad){for(var _0x1225a5=0x0,_0x493b47=events[_0xe919('0x6')];_0x1225a5<_0x493b47;_0x1225a5++){var _0x2ceb41=events[_0x1225a5];var _0x57c3fe=createListener(_0xe919('0x7')+_0x2ceb41,_0x5a27ad);MailMessageEvents['on'](_0x2ceb41,_0x57c3fe);}}; \ No newline at end of file +var _0x1d99=['length','mailMessage:','./mailMessage.events','save','remove','emit','removeListener','register'];(function(_0x469c69,_0x504187){var _0x498115=function(_0x59bde2){while(--_0x59bde2){_0x469c69['push'](_0x469c69['shift']());}};_0x498115(++_0x504187);}(_0x1d99,0xaa));var _0x91d9=function(_0xa46cd1,_0x5abdf7){_0xa46cd1=_0xa46cd1-0x0;var _0x1f845d=_0x1d99[_0xa46cd1];return _0x1f845d;};'use strict';var MailMessageEvents=require(_0x91d9('0x0'));var events=[_0x91d9('0x1'),_0x91d9('0x2'),'update'];function createListener(_0x3f2b79,_0x259e6c){return function(_0x1e8e6c){_0x259e6c[_0x91d9('0x3')](_0x3f2b79,_0x1e8e6c);};}function removeListener(_0x4785e2,_0x4ea821){return function(){MailMessageEvents[_0x91d9('0x4')](_0x4785e2,_0x4ea821);};}exports[_0x91d9('0x5')]=function(_0x10f31b){for(var _0x57a450=0x0,_0x3f5086=events[_0x91d9('0x6')];_0x57a450<_0x3f5086;_0x57a450++){var _0x1c56d0=events[_0x57a450];var _0x520cf7=createListener(_0x91d9('0x7')+_0x1c56d0,_0x10f31b);MailMessageEvents['on'](_0x1c56d0,_0x520cf7);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3946002..e5d9a7e 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 _0x70a1=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','getTeams','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete'];(function(_0x30baf4,_0x3fbe93){var _0x4d9ba5=function(_0x38669a){while(--_0x38669a){_0x30baf4['push'](_0x30baf4['shift']());}};_0x4d9ba5(++_0x3fbe93);}(_0x70a1,0x16d));var _0x170a=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x70a1[_0x1b02bb];return _0x131245;};'use strict';var multer=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var path=require(_0x170a('0x2'));var timeout=require(_0x170a('0x3'));var express=require('express');var router=express[_0x170a('0x4')]();var fs_extra=require(_0x170a('0x5'));var auth=require(_0x170a('0x6'));var interaction=require(_0x170a('0x7'));var config=require(_0x170a('0x8'));var controller=require(_0x170a('0x9'));router[_0x170a('0xa')]('/',auth[_0x170a('0xb')](),controller['index']);router[_0x170a('0xa')](_0x170a('0xc'),auth[_0x170a('0xb')](),controller[_0x170a('0xd')]);router[_0x170a('0xa')](_0x170a('0xe'),auth['isAuthenticated'](),controller[_0x170a('0xf')]);router[_0x170a('0xa')]('/:id/members',auth[_0x170a('0xb')](),controller[_0x170a('0x10')]);router[_0x170a('0xa')]('/:id/teams',auth[_0x170a('0xb')](),controller[_0x170a('0x11')]);router[_0x170a('0xa')]('/:id/users',auth[_0x170a('0xb')](),controller['getAgents']);router[_0x170a('0x12')]('/',auth[_0x170a('0xb')](),controller[_0x170a('0x13')]);router['post'](_0x170a('0x14'),auth['isAuthenticated'](),controller[_0x170a('0x15')]);router[_0x170a('0x12')](_0x170a('0x16'),auth['isAuthenticated'](),controller[_0x170a('0x17')]);router[_0x170a('0x18')](_0x170a('0xe'),auth[_0x170a('0xb')](),controller[_0x170a('0x19')]);router[_0x170a('0x1a')](_0x170a('0xe'),auth[_0x170a('0xb')](),controller['destroy']);router[_0x170a('0x1a')]('/:id/teams',auth[_0x170a('0xb')](),controller['removeTeams']);router['delete'](_0x170a('0x16'),auth[_0x170a('0xb')](),controller['removeAgents']);module[_0x170a('0x1b')]=router; \ No newline at end of file +var _0xb438=['/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams'];(function(_0x2a0ba8,_0x49bcf4){var _0x176a81=function(_0x5d360c){while(--_0x5d360c){_0x2a0ba8['push'](_0x2a0ba8['shift']());}};_0x176a81(++_0x49bcf4);}(_0xb438,0xdd));var _0x8b43=function(_0x16a061,_0x5ccfe3){_0x16a061=_0x16a061-0x0;var _0x426871=_0xb438[_0x16a061];return _0x426871;};'use strict';var multer=require(_0x8b43('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b43('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x8b43('0x2'));var interaction=require(_0x8b43('0x3'));var config=require('../../config/environment');var controller=require(_0x8b43('0x4'));router[_0x8b43('0x5')]('/',auth[_0x8b43('0x6')](),controller['index']);router[_0x8b43('0x5')](_0x8b43('0x7'),auth[_0x8b43('0x6')](),controller[_0x8b43('0x8')]);router[_0x8b43('0x5')](_0x8b43('0x9'),auth[_0x8b43('0x6')](),controller['show']);router[_0x8b43('0x5')](_0x8b43('0xa'),auth[_0x8b43('0x6')](),controller[_0x8b43('0xb')]);router['get'](_0x8b43('0xc'),auth[_0x8b43('0x6')](),controller['getTeams']);router[_0x8b43('0x5')](_0x8b43('0xd'),auth['isAuthenticated'](),controller[_0x8b43('0xe')]);router[_0x8b43('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b43('0x10')]);router[_0x8b43('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8b43('0x11')]);router[_0x8b43('0xf')](_0x8b43('0xd'),auth[_0x8b43('0x6')](),controller[_0x8b43('0x12')]);router[_0x8b43('0x13')](_0x8b43('0x9'),auth[_0x8b43('0x6')](),controller[_0x8b43('0x14')]);router['delete'](_0x8b43('0x9'),auth[_0x8b43('0x6')](),controller[_0x8b43('0x15')]);router['delete'](_0x8b43('0xc'),auth[_0x8b43('0x6')](),controller[_0x8b43('0x16')]);router[_0x8b43('0x17')](_0x8b43('0xd'),auth[_0x8b43('0x6')](),controller[_0x8b43('0x18')]);module[_0x8b43('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b9145f6..a45421c 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 _0xd979=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0xa18c89,_0x431a80){var _0x58f42c=function(_0x1fba12){while(--_0x1fba12){_0xa18c89['push'](_0xa18c89['shift']());}};_0x58f42c(++_0x431a80);}(_0xd979,0x107));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d97('0x0'));module[_0x9d97('0x1')]={'name':{'type':Sequelize[_0x9d97('0x2')],'unique':_0x9d97('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9d97('0x2')]},'timeout':{'type':Sequelize[_0x9d97('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9d97('0x5')]('rrmemory',_0x9d97('0x6'),_0x9d97('0x7'))}}; \ No newline at end of file +var _0x8f1a=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x8f1a,0x1bf));var _0xa8f1=function(_0x4fffa9,_0xe24b9a){_0x4fffa9=_0x4fffa9-0x0;var _0x1712bb=_0x8f1a[_0x4fffa9];return _0x1712bb;};'use strict';var Sequelize=require(_0xa8f1('0x0'));module[_0xa8f1('0x1')]={'name':{'type':Sequelize[_0xa8f1('0x2')],'unique':_0xa8f1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa8f1('0x2')]},'timeout':{'type':Sequelize[_0xa8f1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa8f1('0x5')]('rrmemory',_0xa8f1('0x6'),_0xa8f1('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1de28a4..e692e7d 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 _0x3455=['flatMap','sequelize','transaction','findOrCreate','removeTeams','field','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','rawAttributes','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','MailQueue','includeAll','findAll','rows','catch','show','keys','find','create','body','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','params','UserMailQueue','pick','MailQueueId','User','findAndCountAll','UserId','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x3455,0x13c));var _0x5345=function(_0x5cacd3,_0x292f47){_0x5cacd3=_0x5cacd3-0x0;var _0x3a40ba=_0x3455[_0x5cacd3];return _0x3a40ba;};'use strict';var emlformat=require(_0x5345('0x0'));var rimraf=require(_0x5345('0x1'));var zipdir=require(_0x5345('0x2'));var jsonpatch=require(_0x5345('0x3'));var rp=require(_0x5345('0x4'));var moment=require(_0x5345('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5345('0x6'));var util=require(_0x5345('0x7'));var path=require(_0x5345('0x8'));var sox=require(_0x5345('0x9'));var csv=require(_0x5345('0xa'));var ejs=require(_0x5345('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5345('0xc'));var squel=require('squel');var crypto=require(_0x5345('0xd'));var jsforce=require(_0x5345('0xe'));var deskjs=require(_0x5345('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5345('0x10'));var Papa=require(_0x5345('0x11'));var Redis=require('ioredis');var authService=require(_0x5345('0x12'));var qs=require(_0x5345('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5345('0x14'));var logger=require(_0x5345('0x15'))(_0x5345('0x16'));var utils=require(_0x5345('0x17'));var config=require(_0x5345('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5345('0x19'))['db'];config[_0x5345('0x1a')]=_[_0x5345('0x1b')](config[_0x5345('0x1a')],{'host':_0x5345('0x1c'),'port':0x18eb});var socket=require(_0x5345('0x1d'))(new Redis(config[_0x5345('0x1a')]));require(_0x5345('0x1e'))[_0x5345('0x1f')](socket);function respondWithStatusCode(_0x4738fb,_0x3054c1){_0x3054c1=_0x3054c1||0xcc;return function(_0x219ca2){if(_0x219ca2){return _0x4738fb[_0x5345('0x20')](_0x3054c1);}return _0x4738fb[_0x5345('0x21')](_0x3054c1)['end']();};}function respondWithResult(_0x9abeb2,_0x17a06e){_0x17a06e=_0x17a06e||0xc8;return function(_0x3b0fbb){if(_0x3b0fbb){return _0x9abeb2[_0x5345('0x21')](_0x17a06e)[_0x5345('0x22')](_0x3b0fbb);}};}function respondWithFilteredResult(_0x134218,_0x2a4cdc){return function(_0x30067b){if(_0x30067b){var _0x17d06a=typeof _0x2a4cdc[_0x5345('0x23')]===_0x5345('0x24')&&typeof _0x2a4cdc[_0x5345('0x25')]===_0x5345('0x24');var _0x551c29=_0x30067b[_0x5345('0x26')];var _0x106a35=_0x17d06a?0x0:_0x2a4cdc[_0x5345('0x23')];var _0x53e9cf=_0x17d06a?_0x30067b[_0x5345('0x26')]:_0x2a4cdc[_0x5345('0x23')]+_0x2a4cdc['limit'];var _0x2d118d;if(_0x53e9cf>=_0x551c29){_0x53e9cf=_0x551c29;_0x2d118d=0xc8;}else{_0x2d118d=0xce;}_0x134218['status'](_0x2d118d);return _0x134218[_0x5345('0x27')](_0x5345('0x28'),_0x106a35+'-'+_0x53e9cf+'/'+_0x551c29)[_0x5345('0x22')](_0x30067b);}return null;};}function patchUpdates(_0x3dad33){return function(_0x2e5db1){try{jsonpatch[_0x5345('0x29')](_0x2e5db1,_0x3dad33,!![]);}catch(_0x2e9e91){return BPromise[_0x5345('0x2a')](_0x2e9e91);}return _0x2e5db1[_0x5345('0x2b')]();};}function saveUpdates(_0x52a31e,_0x529f96){return function(_0x22c851){if(_0x22c851){return _0x22c851[_0x5345('0x2c')](_0x52a31e)[_0x5345('0x2d')](function(_0x2a86a9){return _0x2a86a9;});}return null;};}function removeEntity(_0x362979,_0x2950b9){return function(_0x5f1ede){if(_0x5f1ede){return _0x5f1ede[_0x5345('0x2e')]()['then'](function(){var _0xff7b4d=_0x5f1ede[_0x5345('0x2f')]({'plain':!![]});var _0x247dd3='MailQueues';return db[_0x5345('0x30')][_0x5345('0x2e')]({'where':{'type':_0x247dd3,'resourceId':_0xff7b4d['id']}})[_0x5345('0x2d')](function(){return _0x5f1ede;});})[_0x5345('0x2d')](function(){_0x362979[_0x5345('0x21')](0xcc)[_0x5345('0x31')]();});}};}function handleEntityNotFound(_0x476964,_0x3e8412){return function(_0x4b66ab){if(!_0x4b66ab){_0x476964['sendStatus'](0x194);}return _0x4b66ab;};}function handleError(_0x16acde,_0x6c6687){_0x6c6687=_0x6c6687||0x1f4;return function(_0x42b3d1){logger[_0x5345('0x32')](_0x42b3d1[_0x5345('0x33')]);if(_0x42b3d1['name']){delete _0x42b3d1['name'];}_0x16acde['status'](_0x6c6687)[_0x5345('0x34')](_0x42b3d1);};}exports[_0x5345('0x35')]=function(_0x378566,_0x588b5e){var _0x1200a7={},_0x552545={},_0x5aa5b9={'count':0x0,'rows':[]};var _0x14fc77=_['map'](db['MailQueue'][_0x5345('0x36')],function(_0x5d8ccb){return{'name':_0x5d8ccb['fieldName'],'type':_0x5d8ccb[_0x5345('0x37')][_0x5345('0x38')]};});_0x552545[_0x5345('0x39')]=_['map'](_0x14fc77,_0x5345('0x3a'));_0x552545[_0x5345('0x3b')]=_['keys'](_0x378566[_0x5345('0x3b')]);_0x552545['filters']=_[_0x5345('0x3c')](_0x552545[_0x5345('0x39')],_0x552545['query']);_0x1200a7['attributes']=_[_0x5345('0x3c')](_0x552545[_0x5345('0x39')],qs['fields'](_0x378566[_0x5345('0x3b')][_0x5345('0x3d')]));_0x1200a7[_0x5345('0x3e')]=_0x1200a7['attributes'][_0x5345('0x3f')]?_0x1200a7['attributes']:_0x552545[_0x5345('0x39')];if(!_0x378566[_0x5345('0x3b')][_0x5345('0x40')](_0x5345('0x41'))){_0x1200a7[_0x5345('0x25')]=qs['limit'](_0x378566['query']['limit']);_0x1200a7[_0x5345('0x23')]=qs[_0x5345('0x23')](_0x378566[_0x5345('0x3b')][_0x5345('0x23')]);}_0x1200a7[_0x5345('0x42')]=qs[_0x5345('0x43')](_0x378566[_0x5345('0x3b')][_0x5345('0x43')]);_0x1200a7[_0x5345('0x44')]=qs[_0x5345('0x45')](_['pick'](_0x378566[_0x5345('0x3b')],_0x552545[_0x5345('0x45')]),_0x14fc77);if(_0x378566[_0x5345('0x3b')][_0x5345('0x46')]){_0x1200a7[_0x5345('0x44')]=_[_0x5345('0x47')](_0x1200a7[_0x5345('0x44')],{'$or':_[_0x5345('0x48')](_0x14fc77,function(_0x86be87){if(_0x86be87[_0x5345('0x37')]!==_0x5345('0x49')){var _0x3cd917={};_0x3cd917[_0x86be87[_0x5345('0x3a')]]={'$like':'%'+_0x378566[_0x5345('0x3b')][_0x5345('0x46')]+'%'};return _0x3cd917;}})});}_0x1200a7=_[_0x5345('0x47')]({},_0x1200a7,_0x378566[_0x5345('0x4a')]);var _0x2b0075={'where':_0x1200a7[_0x5345('0x44')]};return db[_0x5345('0x4b')]['count'](_0x2b0075)[_0x5345('0x2d')](function(_0x249d7e){_0x5aa5b9[_0x5345('0x26')]=_0x249d7e;if(_0x378566['query'][_0x5345('0x4c')]){_0x1200a7['include']=[{'all':!![]}];}return db[_0x5345('0x4b')][_0x5345('0x4d')](_0x1200a7);})[_0x5345('0x2d')](function(_0x20c785){_0x5aa5b9[_0x5345('0x4e')]=_0x20c785;return _0x5aa5b9;})[_0x5345('0x2d')](respondWithFilteredResult(_0x588b5e,_0x1200a7))[_0x5345('0x4f')](handleError(_0x588b5e,null));};exports[_0x5345('0x50')]=function(_0x495f9b,_0xa13fef){var _0x4692e5={'raw':!![],'where':{'id':_0x495f9b['params']['id']}},_0x47e8ab={};_0x47e8ab[_0x5345('0x39')]=_[_0x5345('0x51')](db[_0x5345('0x4b')][_0x5345('0x36')]);_0x47e8ab['query']=_[_0x5345('0x51')](_0x495f9b['query']);_0x47e8ab[_0x5345('0x45')]=_[_0x5345('0x3c')](_0x47e8ab[_0x5345('0x39')],_0x47e8ab['query']);_0x4692e5['attributes']=_[_0x5345('0x3c')](_0x47e8ab[_0x5345('0x39')],qs[_0x5345('0x3d')](_0x495f9b[_0x5345('0x3b')][_0x5345('0x3d')]));_0x4692e5[_0x5345('0x3e')]=_0x4692e5[_0x5345('0x3e')]['length']?_0x4692e5[_0x5345('0x3e')]:_0x47e8ab['model'];if(_0x495f9b['query']['includeAll']){_0x4692e5['include']=[{'all':!![]}];}_0x4692e5=_['merge']({},_0x4692e5,_0x495f9b[_0x5345('0x4a')]);return db['MailQueue'][_0x5345('0x52')](_0x4692e5)[_0x5345('0x2d')](handleEntityNotFound(_0xa13fef,null))[_0x5345('0x2d')](respondWithResult(_0xa13fef,null))[_0x5345('0x4f')](handleError(_0xa13fef,null));};exports[_0x5345('0x53')]=function(_0x528b20,_0x246f92){return db[_0x5345('0x4b')][_0x5345('0x53')](_0x528b20[_0x5345('0x54')],{})[_0x5345('0x2d')](function(_0x3ef1de){var _0x25472e=_0x528b20[_0x5345('0x55')]['get']({'plain':!![]});if(!_0x25472e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25472e['role']===_0x5345('0x55')){var _0x41c08a=_0x3ef1de[_0x5345('0x2f')]({'plain':!![]});var _0x569565=_0x5345('0x56');return db[_0x5345('0x57')][_0x5345('0x52')]({'where':{'name':_0x569565,'userProfileId':_0x25472e[_0x5345('0x58')]},'raw':!![]})[_0x5345('0x2d')](function(_0x4ed045){if(_0x4ed045&&_0x4ed045[_0x5345('0x59')]===0x0){return db[_0x5345('0x30')][_0x5345('0x53')]({'name':_0x41c08a[_0x5345('0x3a')],'resourceId':_0x41c08a['id'],'type':_0x4ed045[_0x5345('0x3a')],'sectionId':_0x4ed045['id']},{})[_0x5345('0x2d')](function(){return _0x3ef1de;});}else{return _0x3ef1de;}})[_0x5345('0x4f')](function(_0x1a9b35){logger[_0x5345('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a9b35);throw _0x1a9b35;});}return _0x3ef1de;})[_0x5345('0x2d')](respondWithResult(_0x246f92,0xc9))[_0x5345('0x4f')](handleError(_0x246f92,null));};exports[_0x5345('0x2c')]=function(_0x341852,_0x4ccd95){if(_0x341852[_0x5345('0x54')]['id']){delete _0x341852[_0x5345('0x54')]['id'];}return db['MailQueue'][_0x5345('0x52')]({'where':{'id':_0x341852['params']['id']}})[_0x5345('0x2d')](handleEntityNotFound(_0x4ccd95,null))[_0x5345('0x2d')](saveUpdates(_0x341852[_0x5345('0x54')],null))[_0x5345('0x2d')](respondWithResult(_0x4ccd95,null))[_0x5345('0x4f')](handleError(_0x4ccd95,null));};exports[_0x5345('0x2e')]=function(_0xc3b088,_0x15a5b6){return db[_0x5345('0x4b')][_0x5345('0x52')]({'where':{'id':_0xc3b088['params']['id']}})[_0x5345('0x2d')](handleEntityNotFound(_0x15a5b6,null))['then'](removeEntity(_0x15a5b6,null))[_0x5345('0x4f')](handleError(_0x15a5b6,null));};exports[_0x5345('0x5a')]=function(_0x49343a,_0x2e6afa){return db[_0x5345('0x4b')][_0x5345('0x5a')]()[_0x5345('0x2d')](respondWithResult(_0x2e6afa,null))[_0x5345('0x4f')](handleError(_0x2e6afa,null));};exports[_0x5345('0x5b')]=function(_0x2c9ebb,_0x1d4902,_0x47b36c){var _0x265fd5={'raw':!![],'where':{}},_0x1a666f={},_0x9da2cf;return db['MailQueue'][_0x5345('0x5c')]({'where':{'id':_0x2c9ebb[_0x5345('0x5d')]['id']}})[_0x5345('0x2d')](handleEntityNotFound(_0x1d4902,null))[_0x5345('0x2d')](function(_0x1c1379){if(_0x1c1379){_0x9da2cf=_0x1c1379[_0x5345('0x2f')]({'plain':!![]});_0x1a666f[_0x5345('0x39')]=_[_0x5345('0x51')](db[_0x5345('0x5e')][_0x5345('0x36')]);_0x1a666f[_0x5345('0x3b')]=_[_0x5345('0x51')](_0x2c9ebb[_0x5345('0x3b')]);_0x1a666f[_0x5345('0x45')]=_['intersection'](_0x1a666f[_0x5345('0x39')],_0x1a666f[_0x5345('0x3b')]);_0x265fd5[_0x5345('0x3e')]=_[_0x5345('0x3c')](_0x1a666f[_0x5345('0x39')],qs['fields'](_0x2c9ebb[_0x5345('0x3b')][_0x5345('0x3d')]));_0x265fd5['attributes']=_0x265fd5[_0x5345('0x3e')][_0x5345('0x3f')]?_0x265fd5[_0x5345('0x3e')]:_0x1a666f[_0x5345('0x39')];if(!_0x2c9ebb[_0x5345('0x3b')][_0x5345('0x40')](_0x5345('0x41'))){_0x265fd5[_0x5345('0x25')]=qs[_0x5345('0x25')](_0x2c9ebb['query'][_0x5345('0x25')]);_0x265fd5['offset']=qs[_0x5345('0x23')](_0x2c9ebb[_0x5345('0x3b')]['offset']);}_0x265fd5[_0x5345('0x42')]=qs[_0x5345('0x43')](_0x2c9ebb[_0x5345('0x3b')][_0x5345('0x43')]);_0x265fd5['where']=qs[_0x5345('0x45')](_[_0x5345('0x5f')](_0x2c9ebb[_0x5345('0x3b')],_0x1a666f[_0x5345('0x45')]));_0x265fd5[_0x5345('0x44')][_0x5345('0x60')]=_0x1c1379['id'];if(_0x2c9ebb[_0x5345('0x3b')]['filter']){_0x265fd5[_0x5345('0x44')]=_['merge'](_0x265fd5['where'],{'$or':_['map'](_0x265fd5['attributes'],function(_0x3422b8){var _0x88b8ea={};_0x88b8ea[_0x3422b8]={'$like':'%'+_0x2c9ebb['query']['filter']+'%'};return _0x88b8ea;})});}_0x265fd5=_[_0x5345('0x47')]({},_0x265fd5,_0x2c9ebb[_0x5345('0x4a')]);return db[_0x5345('0x5e')][_0x5345('0x4d')](_0x265fd5);}})['then'](function(_0x11606e){if(_0x11606e){return db[_0x5345('0x61')][_0x5345('0x62')]({'where':{'id':_[_0x5345('0x48')](_0x11606e,_0x5345('0x63')),'role':'agent'},'attributes':['id',_0x5345('0x3a'),'mailPause','updatedAt',_0x5345('0x64')]});}})['then'](function(_0x3d6232){if(_0x3d6232){return{'count':_0x3d6232[_0x5345('0x26')],'rows':_[_0x5345('0x48')](_0x3d6232[_0x5345('0x4e')],function(_0x3a2f6d){return{'membername':_0x3a2f6d[_0x5345('0x3a')],'UserId':_0x3a2f6d['id'],'queue_name':_0x9da2cf[_0x5345('0x3a')],'MailQueueId':_0x9da2cf['id'],'interface':util[_0x5345('0x65')](_0x5345('0x66'),_0x5345('0x67'),_0x3a2f6d['name']),'penalty':0x0,'paused':_0x3a2f6d['mailPause'],'createdAt':_0x3a2f6d[_0x5345('0x64')],'updatedAt':_0x3a2f6d[_0x5345('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5345('0x2d')](respondWithFilteredResult(_0x1d4902,_0x265fd5))[_0x5345('0x4f')](handleError(_0x1d4902,null));};exports[_0x5345('0x69')]=function(_0x2e71c9,_0x42efc4,_0x54c468){var _0x104fe1={};var _0xae66cb={};var _0xe0830;var _0x39407d;return db[_0x5345('0x4b')][_0x5345('0x5c')]({'where':{'id':_0x2e71c9[_0x5345('0x5d')]['id']}})['then'](handleEntityNotFound(_0x42efc4,null))[_0x5345('0x2d')](function(_0x7ee98c){if(_0x7ee98c){_0xe0830=_0x7ee98c;_0xae66cb[_0x5345('0x39')]=_['keys'](db[_0x5345('0x6a')][_0x5345('0x36')]);_0xae66cb['query']=_[_0x5345('0x51')](_0x2e71c9[_0x5345('0x3b')]);_0xae66cb[_0x5345('0x45')]=_[_0x5345('0x3c')](_0xae66cb[_0x5345('0x39')],_0xae66cb[_0x5345('0x3b')]);_0x104fe1['attributes']=_[_0x5345('0x3c')](_0xae66cb['model'],qs[_0x5345('0x3d')](_0x2e71c9['query']['fields']));_0x104fe1[_0x5345('0x3e')]=_0x104fe1[_0x5345('0x3e')][_0x5345('0x3f')]?_0x104fe1['attributes']:_0xae66cb[_0x5345('0x39')];_0x104fe1[_0x5345('0x42')]=qs[_0x5345('0x43')](_0x2e71c9[_0x5345('0x3b')]['sort']);_0x104fe1[_0x5345('0x44')]=qs[_0x5345('0x45')](_['pick'](_0x2e71c9[_0x5345('0x3b')],_0xae66cb[_0x5345('0x45')]));if(_0x2e71c9[_0x5345('0x3b')][_0x5345('0x46')]){_0x104fe1[_0x5345('0x44')]=_['merge'](_0x104fe1[_0x5345('0x44')],{'$or':_[_0x5345('0x48')](_0x104fe1['attributes'],function(_0x54e747){var _0x6572a={};_0x6572a[_0x54e747]={'$like':'%'+_0x2e71c9[_0x5345('0x3b')]['filter']+'%'};return _0x6572a;})});}_0x104fe1=_[_0x5345('0x47')]({},_0x104fe1,_0x2e71c9[_0x5345('0x4a')]);return _0xe0830['getTeams'](_0x104fe1);}})[_0x5345('0x2d')](function(_0x30e218){if(_0x30e218){_0x39407d=_0x30e218['length'];if(!_0x2e71c9['query'][_0x5345('0x40')](_0x5345('0x41'))){_0x104fe1['limit']=qs[_0x5345('0x25')](_0x2e71c9[_0x5345('0x3b')][_0x5345('0x25')]);_0x104fe1['offset']=qs[_0x5345('0x23')](_0x2e71c9[_0x5345('0x3b')]['offset']);}return _0xe0830['getTeams'](_0x104fe1);}})[_0x5345('0x2d')](function(_0x5bb54f){if(_0x5bb54f){return _0x5bb54f?{'count':_0x39407d,'rows':_0x5bb54f}:null;}})[_0x5345('0x2d')](respondWithResult(_0x42efc4,null))[_0x5345('0x4f')](handleError(_0x42efc4,null));};exports[_0x5345('0x6b')]=function(_0x7f6f84,_0x15b24e,_0x4b8b1e){var _0x568f15=_0x7f6f84[_0x5345('0x54')][_0x5345('0x6c')];return db[_0x5345('0x6a')]['findAll']({'where':{'id':_0x568f15},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5345('0x6d'),'attributes':['id',_0x5345('0x3a'),_0x5345('0x6e'),_0x5345('0x6f'),_0x5345('0x70')],'raw':!![]}]})['then'](function(_0x3d01c9){if(_0x3d01c9){var _0x4fe3e7=_[_0x5345('0x71')](_0x3d01c9,function(_0x37b963){var _0x144561=_0x37b963[_0x5345('0x2f')]({'plain':!![]});return _0x144561[_0x5345('0x6d')];});return db[_0x5345('0x4b')][_0x5345('0x52')]({'where':{'id':_0x7f6f84[_0x5345('0x5d')]['id']}})['then'](function(_0x296087){return db[_0x5345('0x72')][_0x5345('0x73')](function(_0x33f5db){return _0x296087[_0x5345('0x6b')](_0x568f15,{'transaction':_0x33f5db})['then'](function(){return BPromise['each'](_0x4fe3e7,function(_0x3eaea3){return db[_0x5345('0x5e')][_0x5345('0x74')]({'where':{'UserId':_0x3eaea3['id'],'MailQueueId':_0x7f6f84[_0x5345('0x5d')]['id']},'transaction':_0x33f5db});});})['then'](function(){_0x4fe3e7['forEach'](function(_0x23f017){socket['emit']('userMailQueue:save',{'UserId':_0x23f017['id'],'MailQueueId':_0x296087['id']});});});});});}})['then'](respondWithStatusCode(_0x15b24e,null))['catch'](handleError(_0x15b24e,null));};exports[_0x5345('0x75')]=function(_0x39fc78,_0x5cc8d5,_0x2d808a){return db[_0x5345('0x6a')]['findAll']({'where':{'id':_0x39fc78[_0x5345('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5345('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x5345('0x2d')](handleEntityNotFound(_0x5cc8d5,null))[_0x5345('0x2d')](function(_0x548ec8){var _0x1c0eb0=_[_0x5345('0x48')](_0x548ec8,'id');var _0x776948=[];var _0x5a364d=[];var _0xe6ddd9=squel['select']();_0xe6ddd9[_0x5345('0x76')]('tq.TeamId')[_0x5345('0x77')]('team_has_mail_queues','tq')[_0x5345('0x78')]('user_has_teams','ut',_0x5345('0x79'))[_0x5345('0x44')](_0x5345('0x7a'),_0x39fc78['params']['id']);for(var _0x13c755=0x0;_0x13c755<_0x548ec8[_0x5345('0x3f')];_0x13c755+=0x1){let _0x28edc1=_0x548ec8[_0x13c755];for(var _0x7ff26b=0x0;_0x7ff26b<_0x28edc1['Agents']['length'];_0x7ff26b+=0x1){let _0x587a1b=_0x28edc1[_0x5345('0x6d')][_0x7ff26b];var _0x2403be=_0xe6ddd9[_0x5345('0x7b')]();_0x2403be['where'](_0x5345('0x7c'),_0x587a1b['id']);_0x5a364d[_0x5345('0x7d')](db[_0x5345('0x72')][_0x5345('0x3b')](_0x2403be[_0x5345('0x7e')](),{'type':db['sequelize'][_0x5345('0x7f')][_0x5345('0x80')]})[_0x5345('0x2d')](function(_0x48bac3){if(_0x48bac3['length']===0x1){return _0x587a1b['id'];}else{var _0x1ebec8=_[_0x5345('0x81')](_[_0x5345('0x48')](_0x48bac3,_0x5345('0x82')),function(_0x54a565){return _['includes'](_0x1c0eb0,_0x54a565);});if(_0x1ebec8){return _0x587a1b['id'];}}}));}}return BPromise[_0x5345('0x83')](_0x5a364d)[_0x5345('0x2d')](function(_0x399cde){_0x776948=_(_0x776948)[_0x5345('0x84')](_0x399cde)[_0x5345('0x85')]()[_0x5345('0x86')]();return db['MailQueue']['find']({'where':{'id':_0x39fc78[_0x5345('0x5d')]['id']}})[_0x5345('0x2d')](function(_0x2a80d3){return db[_0x5345('0x72')]['transaction'](function(_0x357c2a){return _0x2a80d3['removeTeams'](_0x39fc78[_0x5345('0x3b')]['ids'],{'transaction':_0x357c2a})[_0x5345('0x2d')](function(){if(!_['isEmpty'](_0x776948)){return _0x2a80d3[_0x5345('0x87')](_0x776948,{'transaction':_0x357c2a});}})[_0x5345('0x2d')](function(){_0x776948['forEach'](function(_0x534321){socket['emit'](_0x5345('0x88'),{'UserId':_0x534321,'MailQueueId':_0x2a80d3['id']});});});});});});})[_0x5345('0x2d')](respondWithStatusCode(_0x5cc8d5,null))[_0x5345('0x4f')](handleError(_0x5cc8d5,null));};exports['addAgents']=function(_0x362180,_0x2490a4,_0x1b3544){return db[_0x5345('0x4b')][_0x5345('0x52')]({'where':{'id':_0x362180[_0x5345('0x5d')]['id']}})[_0x5345('0x2d')](handleEntityNotFound(_0x2490a4,null))[_0x5345('0x2d')](function(_0x4d7b21){if(_0x4d7b21){return _0x4d7b21[_0x5345('0x89')](_0x362180[_0x5345('0x54')][_0x5345('0x6c')],_[_0x5345('0x8a')](_0x362180[_0x5345('0x54')],[_0x5345('0x6c'),'id'])||{})[_0x5345('0x8b')](function(_0x3a2396){for(var _0x4899b5=0x0;_0x4899b5<_0x362180[_0x5345('0x54')][_0x5345('0x6c')][_0x5345('0x3f')];_0x4899b5+=0x1){socket[_0x5345('0x8c')]('userMailQueue:save',{'UserId':Number(_0x362180[_0x5345('0x54')][_0x5345('0x6c')][_0x4899b5]),'MailQueueId':Number(_0x362180[_0x5345('0x5d')]['id'])});}return _0x3a2396;});}})[_0x5345('0x2d')](respondWithResult(_0x2490a4,null))[_0x5345('0x4f')](handleError(_0x2490a4,null));};exports[_0x5345('0x87')]=function(_0xf640b8,_0x28cddc,_0x5d5bf6){return db[_0x5345('0x4b')]['find']({'where':{'id':_0xf640b8['params']['id']}})[_0x5345('0x2d')](handleEntityNotFound(_0x28cddc,null))[_0x5345('0x2d')](function(_0x567ba7){if(_0x567ba7){return _0x567ba7[_0x5345('0x87')](_0xf640b8[_0x5345('0x3b')][_0x5345('0x6c')])[_0x5345('0x2d')](function(){if(_[_0x5345('0x8d')](_0xf640b8['query'][_0x5345('0x6c')])){for(var _0x4333bd=0x0;_0x4333bd<_0xf640b8['query'][_0x5345('0x6c')][_0x5345('0x3f')];_0x4333bd+=0x1){socket[_0x5345('0x8c')](_0x5345('0x88'),{'UserId':Number(_0xf640b8[_0x5345('0x3b')][_0x5345('0x6c')][_0x4333bd]),'MailQueueId':Number(_0xf640b8[_0x5345('0x5d')]['id'])});}}else{socket[_0x5345('0x8c')]('userMailQueue:remove',{'UserId':Number(_0xf640b8[_0x5345('0x3b')]['ids']),'MailQueueId':Number(_0xf640b8[_0x5345('0x5d')]['id'])});}});}})[_0x5345('0x2d')](respondWithStatusCode(_0x28cddc,null))['catch'](handleError(_0x28cddc,null));};exports[_0x5345('0x8e')]=function(_0x4a88c5,_0x5ceb57,_0x38e217){var _0x1c9c61={};var _0x313d33={};var _0x2a94e4;var _0x18f29a;return db[_0x5345('0x4b')][_0x5345('0x5c')]({'where':{'id':_0x4a88c5[_0x5345('0x5d')]['id']}})[_0x5345('0x2d')](handleEntityNotFound(_0x5ceb57,null))[_0x5345('0x2d')](function(_0x271e39){if(_0x271e39){_0x2a94e4=_0x271e39;_0x313d33[_0x5345('0x39')]=_['keys'](db[_0x5345('0x61')][_0x5345('0x36')]);_0x313d33[_0x5345('0x3b')]=_[_0x5345('0x51')](_0x4a88c5[_0x5345('0x3b')]);_0x313d33[_0x5345('0x45')]=_['intersection'](_0x313d33['model'],_0x313d33['query']);_0x1c9c61[_0x5345('0x3e')]=_['intersection'](_0x313d33[_0x5345('0x39')],qs[_0x5345('0x3d')](_0x4a88c5[_0x5345('0x3b')][_0x5345('0x3d')]));_0x1c9c61[_0x5345('0x3e')]=_0x1c9c61[_0x5345('0x3e')][_0x5345('0x3f')]?_0x1c9c61[_0x5345('0x3e')]:_0x313d33[_0x5345('0x39')];_0x1c9c61[_0x5345('0x42')]=qs[_0x5345('0x43')](_0x4a88c5[_0x5345('0x3b')][_0x5345('0x43')]);_0x1c9c61['where']=qs['filters'](_[_0x5345('0x5f')](_0x4a88c5[_0x5345('0x3b')],_0x313d33[_0x5345('0x45')]));if(_0x4a88c5['query'][_0x5345('0x46')]){_0x1c9c61[_0x5345('0x44')]=_[_0x5345('0x47')](_0x1c9c61[_0x5345('0x44')],{'$or':_[_0x5345('0x48')](_0x1c9c61[_0x5345('0x3e')],function(_0x5a0e40){var _0x3bb1aa={};_0x3bb1aa[_0x5a0e40]={'$like':'%'+_0x4a88c5[_0x5345('0x3b')][_0x5345('0x46')]+'%'};return _0x3bb1aa;})});}_0x1c9c61=_[_0x5345('0x47')]({},_0x1c9c61,_0x4a88c5['options']);return _0x2a94e4[_0x5345('0x8e')](_0x1c9c61);}})[_0x5345('0x2d')](function(_0x1bf3be){if(_0x1bf3be){_0x18f29a=_0x1bf3be['length'];if(!_0x4a88c5[_0x5345('0x3b')][_0x5345('0x40')](_0x5345('0x41'))){_0x1c9c61['limit']=qs['limit'](_0x4a88c5[_0x5345('0x3b')][_0x5345('0x25')]);_0x1c9c61[_0x5345('0x23')]=qs[_0x5345('0x23')](_0x4a88c5[_0x5345('0x3b')][_0x5345('0x23')]);}return _0x2a94e4['getAgents'](_0x1c9c61);}})[_0x5345('0x2d')](function(_0x4ec3b2){if(_0x4ec3b2){return _0x4ec3b2?{'count':_0x18f29a,'rows':_0x4ec3b2}:null;}})[_0x5345('0x2d')](respondWithResult(_0x5ceb57,null))['catch'](handleError(_0x5ceb57,null));}; \ No newline at end of file +var _0x7ee1=['getTeams','addTeams','ids','online','interface','Agents','transaction','userMailQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','value','removeTeams','removeAgents','forEach','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','stack','name','send','index','map','MailQueue','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','rawAttributes','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','MailQueueId','UserMailQueue','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','Team','nolimit'];(function(_0x5decec,_0x4e5761){var _0x35e1b4=function(_0x27066d){while(--_0x27066d){_0x5decec['push'](_0x5decec['shift']());}};_0x35e1b4(++_0x4e5761);}(_0x7ee1,0x1c5));var _0x17ee=function(_0x26b211,_0x1b4dbd){_0x26b211=_0x26b211-0x0;var _0x2dbbc6=_0x7ee1[_0x26b211];return _0x2dbbc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17ee('0x0'));var zipdir=require(_0x17ee('0x1'));var jsonpatch=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var moment=require(_0x17ee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x17ee('0x5'));var util=require(_0x17ee('0x6'));var path=require(_0x17ee('0x7'));var sox=require('sox');var csv=require(_0x17ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17ee('0x9'));var _=require(_0x17ee('0xa'));var squel=require(_0x17ee('0xb'));var crypto=require(_0x17ee('0xc'));var jsforce=require(_0x17ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x17ee('0x8'));var querystring=require(_0x17ee('0xe'));var Papa=require(_0x17ee('0xf'));var Redis=require(_0x17ee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x17ee('0x11'));var as=require(_0x17ee('0x12'));var hardwareService=require(_0x17ee('0x13'));var logger=require(_0x17ee('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x17ee('0x15'));var licenseUtil=require(_0x17ee('0x16'));var db=require(_0x17ee('0x17'))['db'];config['redis']=_[_0x17ee('0x18')](config[_0x17ee('0x19')],{'host':_0x17ee('0x1a'),'port':0x18eb});var socket=require(_0x17ee('0x1b'))(new Redis(config[_0x17ee('0x19')]));require('./mailQueue.socket')[_0x17ee('0x1c')](socket);function respondWithStatusCode(_0x390d1e,_0x177e42){_0x177e42=_0x177e42||0xcc;return function(_0x5c3ca0){if(_0x5c3ca0){return _0x390d1e['sendStatus'](_0x177e42);}return _0x390d1e[_0x17ee('0x1d')](_0x177e42)[_0x17ee('0x1e')]();};}function respondWithResult(_0x506da5,_0x16e104){_0x16e104=_0x16e104||0xc8;return function(_0x1b268c){if(_0x1b268c){return _0x506da5[_0x17ee('0x1d')](_0x16e104)[_0x17ee('0x1f')](_0x1b268c);}};}function respondWithFilteredResult(_0x5131ce,_0x2a5ec8){return function(_0x49a861){if(_0x49a861){var _0x19892a=typeof _0x2a5ec8[_0x17ee('0x20')]===_0x17ee('0x21')&&typeof _0x2a5ec8[_0x17ee('0x22')]===_0x17ee('0x21');var _0x27abc4=_0x49a861[_0x17ee('0x23')];var _0x583b9a=_0x19892a?0x0:_0x2a5ec8[_0x17ee('0x20')];var _0x4f949d=_0x19892a?_0x49a861[_0x17ee('0x23')]:_0x2a5ec8[_0x17ee('0x20')]+_0x2a5ec8[_0x17ee('0x22')];var _0x4c89a2;if(_0x4f949d>=_0x27abc4){_0x4f949d=_0x27abc4;_0x4c89a2=0xc8;}else{_0x4c89a2=0xce;}_0x5131ce[_0x17ee('0x1d')](_0x4c89a2);return _0x5131ce[_0x17ee('0x24')]('Content-Range',_0x583b9a+'-'+_0x4f949d+'/'+_0x27abc4)[_0x17ee('0x1f')](_0x49a861);}return null;};}function patchUpdates(_0x2d5e1e){return function(_0x2dd0fa){try{jsonpatch['apply'](_0x2dd0fa,_0x2d5e1e,!![]);}catch(_0x5c6510){return BPromise[_0x17ee('0x25')](_0x5c6510);}return _0x2dd0fa[_0x17ee('0x26')]();};}function saveUpdates(_0x2ab640,_0x5e58a9){return function(_0x9f1af0){if(_0x9f1af0){return _0x9f1af0[_0x17ee('0x27')](_0x2ab640)[_0x17ee('0x28')](function(_0x29d962){return _0x29d962;});}return null;};}function removeEntity(_0x19d5ec,_0x143f6){return function(_0xe18726){if(_0xe18726){return _0xe18726[_0x17ee('0x29')]()[_0x17ee('0x28')](function(){var _0x2264a1=_0xe18726[_0x17ee('0x2a')]({'plain':!![]});var _0x1e8c85=_0x17ee('0x2b');return db[_0x17ee('0x2c')][_0x17ee('0x29')]({'where':{'type':_0x1e8c85,'resourceId':_0x2264a1['id']}})[_0x17ee('0x28')](function(){return _0xe18726;});})['then'](function(){_0x19d5ec['status'](0xcc)[_0x17ee('0x1e')]();});}};}function handleEntityNotFound(_0x171808,_0x32b198){return function(_0x315644){if(!_0x315644){_0x171808[_0x17ee('0x2d')](0x194);}return _0x315644;};}function handleError(_0x59b8e5,_0x30fbfa){_0x30fbfa=_0x30fbfa||0x1f4;return function(_0x5199f2){logger['error'](_0x5199f2[_0x17ee('0x2e')]);if(_0x5199f2[_0x17ee('0x2f')]){delete _0x5199f2[_0x17ee('0x2f')];}_0x59b8e5[_0x17ee('0x1d')](_0x30fbfa)[_0x17ee('0x30')](_0x5199f2);};}exports[_0x17ee('0x31')]=function(_0x3a5b6f,_0x4bffb0){var _0x556878={},_0x29da03={},_0x296a47={'count':0x0,'rows':[]};var _0x38174f=_[_0x17ee('0x32')](db[_0x17ee('0x33')]['rawAttributes'],function(_0x33a174){return{'name':_0x33a174['fieldName'],'type':_0x33a174['type'][_0x17ee('0x34')]};});_0x29da03[_0x17ee('0x35')]=_[_0x17ee('0x32')](_0x38174f,_0x17ee('0x2f'));_0x29da03[_0x17ee('0x36')]=_[_0x17ee('0x37')](_0x3a5b6f[_0x17ee('0x36')]);_0x29da03[_0x17ee('0x38')]=_['intersection'](_0x29da03[_0x17ee('0x35')],_0x29da03[_0x17ee('0x36')]);_0x556878[_0x17ee('0x39')]=_[_0x17ee('0x3a')](_0x29da03[_0x17ee('0x35')],qs[_0x17ee('0x3b')](_0x3a5b6f['query']['fields']));_0x556878['attributes']=_0x556878[_0x17ee('0x39')][_0x17ee('0x3c')]?_0x556878['attributes']:_0x29da03[_0x17ee('0x35')];if(!_0x3a5b6f[_0x17ee('0x36')][_0x17ee('0x3d')]('nolimit')){_0x556878[_0x17ee('0x22')]=qs[_0x17ee('0x22')](_0x3a5b6f['query'][_0x17ee('0x22')]);_0x556878['offset']=qs[_0x17ee('0x20')](_0x3a5b6f[_0x17ee('0x36')]['offset']);}_0x556878[_0x17ee('0x3e')]=qs[_0x17ee('0x3f')](_0x3a5b6f[_0x17ee('0x36')][_0x17ee('0x3f')]);_0x556878[_0x17ee('0x40')]=qs[_0x17ee('0x38')](_[_0x17ee('0x41')](_0x3a5b6f[_0x17ee('0x36')],_0x29da03[_0x17ee('0x38')]),_0x38174f);if(_0x3a5b6f[_0x17ee('0x36')][_0x17ee('0x42')]){_0x556878['where']=_[_0x17ee('0x43')](_0x556878[_0x17ee('0x40')],{'$or':_[_0x17ee('0x32')](_0x38174f,function(_0x202c9e){if(_0x202c9e[_0x17ee('0x44')]!==_0x17ee('0x45')){var _0xd7af15={};_0xd7af15[_0x202c9e[_0x17ee('0x2f')]]={'$like':'%'+_0x3a5b6f[_0x17ee('0x36')]['filter']+'%'};return _0xd7af15;}})});}_0x556878=_[_0x17ee('0x43')]({},_0x556878,_0x3a5b6f['options']);var _0x4d2ef8={'where':_0x556878[_0x17ee('0x40')]};return db[_0x17ee('0x33')][_0x17ee('0x23')](_0x4d2ef8)[_0x17ee('0x28')](function(_0x1788cf){_0x296a47[_0x17ee('0x23')]=_0x1788cf;if(_0x3a5b6f[_0x17ee('0x36')][_0x17ee('0x46')]){_0x556878['include']=[{'all':!![]}];}return db[_0x17ee('0x33')][_0x17ee('0x47')](_0x556878);})['then'](function(_0x10f592){_0x296a47[_0x17ee('0x48')]=_0x10f592;return _0x296a47;})[_0x17ee('0x28')](respondWithFilteredResult(_0x4bffb0,_0x556878))[_0x17ee('0x49')](handleError(_0x4bffb0,null));};exports[_0x17ee('0x4a')]=function(_0x2025b6,_0x96ee4e){var _0x2c7863={'raw':!![],'where':{'id':_0x2025b6['params']['id']}},_0x256e68={};_0x256e68[_0x17ee('0x35')]=_[_0x17ee('0x37')](db[_0x17ee('0x33')][_0x17ee('0x4b')]);_0x256e68[_0x17ee('0x36')]=_[_0x17ee('0x37')](_0x2025b6[_0x17ee('0x36')]);_0x256e68['filters']=_[_0x17ee('0x3a')](_0x256e68[_0x17ee('0x35')],_0x256e68['query']);_0x2c7863['attributes']=_['intersection'](_0x256e68[_0x17ee('0x35')],qs[_0x17ee('0x3b')](_0x2025b6['query'][_0x17ee('0x3b')]));_0x2c7863['attributes']=_0x2c7863['attributes']['length']?_0x2c7863['attributes']:_0x256e68[_0x17ee('0x35')];if(_0x2025b6[_0x17ee('0x36')]['includeAll']){_0x2c7863['include']=[{'all':!![]}];}_0x2c7863=_[_0x17ee('0x43')]({},_0x2c7863,_0x2025b6[_0x17ee('0x4c')]);return db['MailQueue'][_0x17ee('0x4d')](_0x2c7863)[_0x17ee('0x28')](handleEntityNotFound(_0x96ee4e,null))[_0x17ee('0x28')](respondWithResult(_0x96ee4e,null))[_0x17ee('0x49')](handleError(_0x96ee4e,null));};exports['create']=function(_0x5e2916,_0x4d70c8){return db[_0x17ee('0x33')][_0x17ee('0x4e')](_0x5e2916['body'],{})['then'](function(_0x887bbd){var _0x21fe81=_0x5e2916[_0x17ee('0x4f')][_0x17ee('0x2a')]({'plain':!![]});if(!_0x21fe81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21fe81[_0x17ee('0x50')]==='user'){var _0x52005d=_0x887bbd[_0x17ee('0x2a')]({'plain':!![]});var _0x31d7de=_0x17ee('0x2b');return db[_0x17ee('0x51')][_0x17ee('0x4d')]({'where':{'name':_0x31d7de,'userProfileId':_0x21fe81[_0x17ee('0x52')]},'raw':!![]})['then'](function(_0x44b7ee){if(_0x44b7ee&&_0x44b7ee[_0x17ee('0x53')]===0x0){return db[_0x17ee('0x2c')][_0x17ee('0x4e')]({'name':_0x52005d[_0x17ee('0x2f')],'resourceId':_0x52005d['id'],'type':_0x44b7ee[_0x17ee('0x2f')],'sectionId':_0x44b7ee['id']},{})[_0x17ee('0x28')](function(){return _0x887bbd;});}else{return _0x887bbd;}})[_0x17ee('0x49')](function(_0x4522b7){logger[_0x17ee('0x54')](_0x17ee('0x55'),_0x4522b7);throw _0x4522b7;});}return _0x887bbd;})['then'](respondWithResult(_0x4d70c8,0xc9))['catch'](handleError(_0x4d70c8,null));};exports[_0x17ee('0x27')]=function(_0x3eeaef,_0x59a016){if(_0x3eeaef[_0x17ee('0x56')]['id']){delete _0x3eeaef['body']['id'];}return db[_0x17ee('0x33')][_0x17ee('0x4d')]({'where':{'id':_0x3eeaef[_0x17ee('0x57')]['id']}})[_0x17ee('0x28')](handleEntityNotFound(_0x59a016,null))[_0x17ee('0x28')](saveUpdates(_0x3eeaef['body'],null))[_0x17ee('0x28')](respondWithResult(_0x59a016,null))[_0x17ee('0x49')](handleError(_0x59a016,null));};exports[_0x17ee('0x29')]=function(_0x5ecdfb,_0xb3ae01){return db['MailQueue']['find']({'where':{'id':_0x5ecdfb[_0x17ee('0x57')]['id']}})[_0x17ee('0x28')](handleEntityNotFound(_0xb3ae01,null))[_0x17ee('0x28')](removeEntity(_0xb3ae01,null))['catch'](handleError(_0xb3ae01,null));};exports['describe']=function(_0x246364,_0x3f638b){return db[_0x17ee('0x33')][_0x17ee('0x58')]()[_0x17ee('0x28')](respondWithResult(_0x3f638b,null))[_0x17ee('0x49')](handleError(_0x3f638b,null));};exports[_0x17ee('0x59')]=function(_0x578cd7,_0xf4f3a5,_0x274a63){var _0x257b1d={'raw':!![],'where':{}},_0x677efa={},_0x2e26f;return db[_0x17ee('0x33')][_0x17ee('0x5a')]({'where':{'id':_0x578cd7[_0x17ee('0x57')]['id']}})[_0x17ee('0x28')](handleEntityNotFound(_0xf4f3a5,null))[_0x17ee('0x28')](function(_0x82897c){if(_0x82897c){_0x2e26f=_0x82897c['get']({'plain':!![]});_0x677efa[_0x17ee('0x35')]=_['keys'](db['UserMailQueue'][_0x17ee('0x4b')]);_0x677efa[_0x17ee('0x36')]=_[_0x17ee('0x37')](_0x578cd7[_0x17ee('0x36')]);_0x677efa['filters']=_[_0x17ee('0x3a')](_0x677efa['model'],_0x677efa['query']);_0x257b1d[_0x17ee('0x39')]=_[_0x17ee('0x3a')](_0x677efa[_0x17ee('0x35')],qs[_0x17ee('0x3b')](_0x578cd7[_0x17ee('0x36')]['fields']));_0x257b1d[_0x17ee('0x39')]=_0x257b1d[_0x17ee('0x39')][_0x17ee('0x3c')]?_0x257b1d[_0x17ee('0x39')]:_0x677efa[_0x17ee('0x35')];if(!_0x578cd7[_0x17ee('0x36')]['hasOwnProperty']('nolimit')){_0x257b1d[_0x17ee('0x22')]=qs[_0x17ee('0x22')](_0x578cd7[_0x17ee('0x36')][_0x17ee('0x22')]);_0x257b1d[_0x17ee('0x20')]=qs[_0x17ee('0x20')](_0x578cd7[_0x17ee('0x36')][_0x17ee('0x20')]);}_0x257b1d[_0x17ee('0x3e')]=qs[_0x17ee('0x3f')](_0x578cd7[_0x17ee('0x36')][_0x17ee('0x3f')]);_0x257b1d[_0x17ee('0x40')]=qs[_0x17ee('0x38')](_[_0x17ee('0x41')](_0x578cd7[_0x17ee('0x36')],_0x677efa['filters']));_0x257b1d[_0x17ee('0x40')][_0x17ee('0x5b')]=_0x82897c['id'];if(_0x578cd7[_0x17ee('0x36')][_0x17ee('0x42')]){_0x257b1d[_0x17ee('0x40')]=_[_0x17ee('0x43')](_0x257b1d[_0x17ee('0x40')],{'$or':_['map'](_0x257b1d[_0x17ee('0x39')],function(_0x5ef06a){var _0x199260={};_0x199260[_0x5ef06a]={'$like':'%'+_0x578cd7[_0x17ee('0x36')]['filter']+'%'};return _0x199260;})});}_0x257b1d=_[_0x17ee('0x43')]({},_0x257b1d,_0x578cd7['options']);return db[_0x17ee('0x5c')][_0x17ee('0x47')](_0x257b1d);}})['then'](function(_0xfad8a3){if(_0xfad8a3){return db[_0x17ee('0x5d')][_0x17ee('0x5e')]({'where':{'id':_[_0x17ee('0x32')](_0xfad8a3,'UserId'),'role':_0x17ee('0x5f')},'attributes':['id',_0x17ee('0x2f'),_0x17ee('0x60'),_0x17ee('0x61'),_0x17ee('0x62')]});}})[_0x17ee('0x28')](function(_0x2c5571){if(_0x2c5571){return{'count':_0x2c5571[_0x17ee('0x23')],'rows':_[_0x17ee('0x32')](_0x2c5571[_0x17ee('0x48')],function(_0x4bb675){return{'membername':_0x4bb675['name'],'UserId':_0x4bb675['id'],'queue_name':_0x2e26f[_0x17ee('0x2f')],'MailQueueId':_0x2e26f['id'],'interface':util['format'](_0x17ee('0x63'),_0x17ee('0x64'),_0x4bb675[_0x17ee('0x2f')]),'penalty':0x0,'paused':_0x4bb675[_0x17ee('0x60')],'createdAt':_0x4bb675[_0x17ee('0x62')],'updatedAt':_0x4bb675['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x17ee('0x28')](respondWithFilteredResult(_0xf4f3a5,_0x257b1d))['catch'](handleError(_0xf4f3a5,null));};exports['getTeams']=function(_0x47b365,_0x20780b,_0x40593f){var _0x3b9874={};var _0x208c7d={};var _0x20f273;var _0x1f9001;return db[_0x17ee('0x33')]['findOne']({'where':{'id':_0x47b365[_0x17ee('0x57')]['id']}})['then'](handleEntityNotFound(_0x20780b,null))[_0x17ee('0x28')](function(_0x34c2eb){if(_0x34c2eb){_0x20f273=_0x34c2eb;_0x208c7d[_0x17ee('0x35')]=_[_0x17ee('0x37')](db[_0x17ee('0x65')][_0x17ee('0x4b')]);_0x208c7d[_0x17ee('0x36')]=_[_0x17ee('0x37')](_0x47b365['query']);_0x208c7d[_0x17ee('0x38')]=_[_0x17ee('0x3a')](_0x208c7d['model'],_0x208c7d['query']);_0x3b9874[_0x17ee('0x39')]=_[_0x17ee('0x3a')](_0x208c7d['model'],qs['fields'](_0x47b365[_0x17ee('0x36')][_0x17ee('0x3b')]));_0x3b9874[_0x17ee('0x39')]=_0x3b9874[_0x17ee('0x39')][_0x17ee('0x3c')]?_0x3b9874[_0x17ee('0x39')]:_0x208c7d['model'];_0x3b9874[_0x17ee('0x3e')]=qs[_0x17ee('0x3f')](_0x47b365['query'][_0x17ee('0x3f')]);_0x3b9874[_0x17ee('0x40')]=qs[_0x17ee('0x38')](_[_0x17ee('0x41')](_0x47b365[_0x17ee('0x36')],_0x208c7d[_0x17ee('0x38')]));if(_0x47b365[_0x17ee('0x36')][_0x17ee('0x42')]){_0x3b9874[_0x17ee('0x40')]=_['merge'](_0x3b9874[_0x17ee('0x40')],{'$or':_[_0x17ee('0x32')](_0x3b9874[_0x17ee('0x39')],function(_0xe8cb5c){var _0x3a3325={};_0x3a3325[_0xe8cb5c]={'$like':'%'+_0x47b365[_0x17ee('0x36')]['filter']+'%'};return _0x3a3325;})});}_0x3b9874=_[_0x17ee('0x43')]({},_0x3b9874,_0x47b365[_0x17ee('0x4c')]);return _0x20f273['getTeams'](_0x3b9874);}})[_0x17ee('0x28')](function(_0x249d62){if(_0x249d62){_0x1f9001=_0x249d62[_0x17ee('0x3c')];if(!_0x47b365[_0x17ee('0x36')][_0x17ee('0x3d')](_0x17ee('0x66'))){_0x3b9874[_0x17ee('0x22')]=qs['limit'](_0x47b365[_0x17ee('0x36')][_0x17ee('0x22')]);_0x3b9874[_0x17ee('0x20')]=qs[_0x17ee('0x20')](_0x47b365[_0x17ee('0x36')][_0x17ee('0x20')]);}return _0x20f273[_0x17ee('0x67')](_0x3b9874);}})['then'](function(_0xef737c){if(_0xef737c){return _0xef737c?{'count':_0x1f9001,'rows':_0xef737c}:null;}})['then'](respondWithResult(_0x20780b,null))[_0x17ee('0x49')](handleError(_0x20780b,null));};exports[_0x17ee('0x68')]=function(_0x2bf0c9,_0x987a41,_0x5a77a6){var _0x332df7=_0x2bf0c9['body'][_0x17ee('0x69')];return db['Team'][_0x17ee('0x47')]({'where':{'id':_0x332df7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x17ee('0x2f'),_0x17ee('0x6a'),'voicePause',_0x17ee('0x6b')],'raw':!![]}]})[_0x17ee('0x28')](function(_0x5627f1){if(_0x5627f1){var _0x521b86=_['flatMap'](_0x5627f1,function(_0x4dd939){var _0x23e381=_0x4dd939[_0x17ee('0x2a')]({'plain':!![]});return _0x23e381[_0x17ee('0x6c')];});return db[_0x17ee('0x33')][_0x17ee('0x4d')]({'where':{'id':_0x2bf0c9[_0x17ee('0x57')]['id']}})[_0x17ee('0x28')](function(_0x53b366){return db['sequelize'][_0x17ee('0x6d')](function(_0x1302f2){return _0x53b366[_0x17ee('0x68')](_0x332df7,{'transaction':_0x1302f2})[_0x17ee('0x28')](function(){return BPromise['each'](_0x521b86,function(_0x491a1b){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x491a1b['id'],'MailQueueId':_0x2bf0c9[_0x17ee('0x57')]['id']},'transaction':_0x1302f2});});})['then'](function(){_0x521b86['forEach'](function(_0x4c6960){socket['emit'](_0x17ee('0x6e'),{'UserId':_0x4c6960['id'],'MailQueueId':_0x53b366['id']});});});});});}})[_0x17ee('0x28')](respondWithStatusCode(_0x987a41,null))[_0x17ee('0x49')](handleError(_0x987a41,null));};exports['removeTeams']=function(_0x4f57f7,_0x230289,_0x47f441){return db[_0x17ee('0x65')][_0x17ee('0x47')]({'where':{'id':_0x4f57f7[_0x17ee('0x36')][_0x17ee('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x17ee('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x17ee('0x28')](handleEntityNotFound(_0x230289,null))['then'](function(_0x641bd8){var _0x5302a0=_[_0x17ee('0x32')](_0x641bd8,'id');var _0x2f392d=[];var _0x3af3a4=[];var _0x31b466=squel[_0x17ee('0x6f')]();_0x31b466[_0x17ee('0x70')](_0x17ee('0x71'))[_0x17ee('0x72')]('team_has_mail_queues','tq')[_0x17ee('0x73')]('user_has_teams','ut',_0x17ee('0x74'))['where'](_0x17ee('0x75'),_0x4f57f7[_0x17ee('0x57')]['id']);for(var _0x3c2fec=0x0;_0x3c2fec<_0x641bd8[_0x17ee('0x3c')];_0x3c2fec+=0x1){let _0x2ecfad=_0x641bd8[_0x3c2fec];for(var _0x907733=0x0;_0x907733<_0x2ecfad[_0x17ee('0x6c')][_0x17ee('0x3c')];_0x907733+=0x1){let _0x59af25=_0x2ecfad[_0x17ee('0x6c')][_0x907733];var _0x2e8085=_0x31b466[_0x17ee('0x76')]();_0x2e8085[_0x17ee('0x40')](_0x17ee('0x77'),_0x59af25['id']);_0x3af3a4[_0x17ee('0x78')](db[_0x17ee('0x79')]['query'](_0x2e8085[_0x17ee('0x7a')](),{'type':db[_0x17ee('0x79')]['QueryTypes'][_0x17ee('0x7b')]})['then'](function(_0x1f6247){if(_0x1f6247['length']===0x1){return _0x59af25['id'];}else{var _0x15c3b7=_[_0x17ee('0x7c')](_[_0x17ee('0x32')](_0x1f6247,_0x17ee('0x7d')),function(_0x26be09){return _[_0x17ee('0x7e')](_0x5302a0,_0x26be09);});if(_0x15c3b7){return _0x59af25['id'];}}}));}}return BPromise['all'](_0x3af3a4)['then'](function(_0xc3e2d4){_0x2f392d=_(_0x2f392d)[_0x17ee('0x7f')](_0xc3e2d4)['compact']()[_0x17ee('0x80')]();return db[_0x17ee('0x33')]['find']({'where':{'id':_0x4f57f7['params']['id']}})[_0x17ee('0x28')](function(_0x32eec2){return db['sequelize']['transaction'](function(_0x480d33){return _0x32eec2[_0x17ee('0x81')](_0x4f57f7[_0x17ee('0x36')][_0x17ee('0x69')],{'transaction':_0x480d33})['then'](function(){if(!_['isEmpty'](_0x2f392d)){return _0x32eec2[_0x17ee('0x82')](_0x2f392d,{'transaction':_0x480d33});}})[_0x17ee('0x28')](function(){_0x2f392d[_0x17ee('0x83')](function(_0x1a19ce){socket[_0x17ee('0x84')](_0x17ee('0x85'),{'UserId':_0x1a19ce,'MailQueueId':_0x32eec2['id']});});});});});});})['then'](respondWithStatusCode(_0x230289,null))[_0x17ee('0x49')](handleError(_0x230289,null));};exports[_0x17ee('0x86')]=function(_0x186c7f,_0x456a7b,_0x1ff075){return db[_0x17ee('0x33')][_0x17ee('0x4d')]({'where':{'id':_0x186c7f['params']['id']}})['then'](handleEntityNotFound(_0x456a7b,null))[_0x17ee('0x28')](function(_0x2ec7b2){if(_0x2ec7b2){return _0x2ec7b2[_0x17ee('0x86')](_0x186c7f[_0x17ee('0x56')][_0x17ee('0x69')],_[_0x17ee('0x87')](_0x186c7f[_0x17ee('0x56')],[_0x17ee('0x69'),'id'])||{})[_0x17ee('0x88')](function(_0xa2f518){for(var _0x4ac9c0=0x0;_0x4ac9c0<_0x186c7f[_0x17ee('0x56')][_0x17ee('0x69')]['length'];_0x4ac9c0+=0x1){socket[_0x17ee('0x84')](_0x17ee('0x6e'),{'UserId':Number(_0x186c7f['body'][_0x17ee('0x69')][_0x4ac9c0]),'MailQueueId':Number(_0x186c7f['params']['id'])});}return _0xa2f518;});}})[_0x17ee('0x28')](respondWithResult(_0x456a7b,null))['catch'](handleError(_0x456a7b,null));};exports[_0x17ee('0x82')]=function(_0x6a66de,_0x221285,_0x257fdf){return db[_0x17ee('0x33')][_0x17ee('0x4d')]({'where':{'id':_0x6a66de[_0x17ee('0x57')]['id']}})[_0x17ee('0x28')](handleEntityNotFound(_0x221285,null))[_0x17ee('0x28')](function(_0x239989){if(_0x239989){return _0x239989['removeAgents'](_0x6a66de[_0x17ee('0x36')]['ids'])[_0x17ee('0x28')](function(){if(_[_0x17ee('0x89')](_0x6a66de[_0x17ee('0x36')][_0x17ee('0x69')])){for(var _0x7734fd=0x0;_0x7734fd<_0x6a66de['query'][_0x17ee('0x69')]['length'];_0x7734fd+=0x1){socket[_0x17ee('0x84')]('userMailQueue:remove',{'UserId':Number(_0x6a66de[_0x17ee('0x36')][_0x17ee('0x69')][_0x7734fd]),'MailQueueId':Number(_0x6a66de[_0x17ee('0x57')]['id'])});}}else{socket[_0x17ee('0x84')](_0x17ee('0x85'),{'UserId':Number(_0x6a66de['query']['ids']),'MailQueueId':Number(_0x6a66de['params']['id'])});}});}})[_0x17ee('0x28')](respondWithStatusCode(_0x221285,null))['catch'](handleError(_0x221285,null));};exports['getAgents']=function(_0x3126ea,_0x19a4b0,_0x4fd5f9){var _0x3fb6fb={};var _0x240e1c={};var _0x149f09;var _0xb70217;return db[_0x17ee('0x33')][_0x17ee('0x5a')]({'where':{'id':_0x3126ea[_0x17ee('0x57')]['id']}})[_0x17ee('0x28')](handleEntityNotFound(_0x19a4b0,null))['then'](function(_0x452774){if(_0x452774){_0x149f09=_0x452774;_0x240e1c[_0x17ee('0x35')]=_[_0x17ee('0x37')](db['User'][_0x17ee('0x4b')]);_0x240e1c[_0x17ee('0x36')]=_[_0x17ee('0x37')](_0x3126ea[_0x17ee('0x36')]);_0x240e1c[_0x17ee('0x38')]=_['intersection'](_0x240e1c[_0x17ee('0x35')],_0x240e1c[_0x17ee('0x36')]);_0x3fb6fb[_0x17ee('0x39')]=_['intersection'](_0x240e1c['model'],qs[_0x17ee('0x3b')](_0x3126ea[_0x17ee('0x36')][_0x17ee('0x3b')]));_0x3fb6fb[_0x17ee('0x39')]=_0x3fb6fb[_0x17ee('0x39')][_0x17ee('0x3c')]?_0x3fb6fb[_0x17ee('0x39')]:_0x240e1c['model'];_0x3fb6fb[_0x17ee('0x3e')]=qs[_0x17ee('0x3f')](_0x3126ea[_0x17ee('0x36')]['sort']);_0x3fb6fb[_0x17ee('0x40')]=qs['filters'](_[_0x17ee('0x41')](_0x3126ea[_0x17ee('0x36')],_0x240e1c[_0x17ee('0x38')]));if(_0x3126ea['query']['filter']){_0x3fb6fb[_0x17ee('0x40')]=_[_0x17ee('0x43')](_0x3fb6fb['where'],{'$or':_[_0x17ee('0x32')](_0x3fb6fb[_0x17ee('0x39')],function(_0x3b7eaf){var _0x2446b6={};_0x2446b6[_0x3b7eaf]={'$like':'%'+_0x3126ea['query'][_0x17ee('0x42')]+'%'};return _0x2446b6;})});}_0x3fb6fb=_[_0x17ee('0x43')]({},_0x3fb6fb,_0x3126ea[_0x17ee('0x4c')]);return _0x149f09[_0x17ee('0x8a')](_0x3fb6fb);}})['then'](function(_0x4a7fcb){if(_0x4a7fcb){_0xb70217=_0x4a7fcb[_0x17ee('0x3c')];if(!_0x3126ea[_0x17ee('0x36')][_0x17ee('0x3d')]('nolimit')){_0x3fb6fb[_0x17ee('0x22')]=qs[_0x17ee('0x22')](_0x3126ea[_0x17ee('0x36')][_0x17ee('0x22')]);_0x3fb6fb[_0x17ee('0x20')]=qs[_0x17ee('0x20')](_0x3126ea[_0x17ee('0x36')]['offset']);}return _0x149f09[_0x17ee('0x8a')](_0x3fb6fb);}})['then'](function(_0x53229e){if(_0x53229e){return _0x53229e?{'count':_0xb70217,'rows':_0x53229e}:null;}})['then'](respondWithResult(_0x19a4b0,null))[_0x17ee('0x49')](handleError(_0x19a4b0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 42d0f0b..cc44941 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 _0xf4fb=['emit','hook','exports','events','MailQueue','setMaxListeners'];(function(_0x12135f,_0x39b7f3){var _0x13fe3e=function(_0x36b18f){while(--_0x36b18f){_0x12135f['push'](_0x12135f['shift']());}};_0x13fe3e(++_0x39b7f3);}(_0xf4fb,0x87));var _0xbf4f=function(_0x15c14f,_0x14eda9){_0x15c14f=_0x15c14f-0x0;var _0x55d8a6=_0xf4fb[_0x15c14f];return _0x55d8a6;};'use strict';var EventEmitter=require(_0xbf4f('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xbf4f('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbf4f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x54e4c8){return function(_0x5a9a72,_0x25f7ad,_0x209edb){MailQueueEvents['emit'](_0x54e4c8+':'+_0x5a9a72['id'],_0x5a9a72);MailQueueEvents[_0xbf4f('0x3')](_0x54e4c8,_0x5a9a72);_0x209edb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xbf4f('0x4')](e,emitEvent(event));}}module[_0xbf4f('0x5')]=MailQueueEvents; \ No newline at end of file +var _0x418b=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xc6dfc8,_0x367250){var _0xf74dac=function(_0x5e901f){while(--_0x5e901f){_0xc6dfc8['push'](_0xc6dfc8['shift']());}};_0xf74dac(++_0x367250);}(_0x418b,0x18a));var _0xb418=function(_0x707c06,_0x3c93cd){_0x707c06=_0x707c06-0x0;var _0x3618a8=_0x418b[_0x707c06];return _0x3618a8;};'use strict';var EventEmitter=require(_0xb418('0x0'));var MailQueue=require(_0xb418('0x1'))['db'][_0xb418('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb418('0x3')](0x0);var events={'afterCreate':_0xb418('0x4'),'afterUpdate':_0xb418('0x5'),'afterDestroy':_0xb418('0x6')};function emitEvent(_0x5f5d1a){return function(_0x44bd02,_0x186977,_0x47fa32){MailQueueEvents['emit'](_0x5f5d1a+':'+_0x44bd02['id'],_0x44bd02);MailQueueEvents[_0xb418('0x7')](_0x5f5d1a,_0x44bd02);_0x47fa32(null);};}for(var e in events){if(events[_0xb418('0x8')](e)){var event=events[e];MailQueue[_0xb418('0x9')](e,emitEvent(event));}}module[_0xb418('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 459b607..bf9f35c 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 _0x751d=['request-promise','path','rimraf','../../config/environment','exports','MailQueue','lodash','util','api','moment'];(function(_0x3806cd,_0x52ca5d){var _0x4d61fd=function(_0x240f13){while(--_0x240f13){_0x3806cd['push'](_0x3806cd['shift']());}};_0x4d61fd(++_0x52ca5d);}(_0x751d,0xe2));var _0xd751=function(_0x460dae,_0x3a907f){_0x460dae=_0x460dae-0x0;var _0x36e6d0=_0x751d[_0x460dae];return _0x36e6d0;};'use strict';var _=require(_0xd751('0x0'));var util=require(_0xd751('0x1'));var logger=require('../../config/logger')(_0xd751('0x2'));var moment=require(_0xd751('0x3'));var BPromise=require('bluebird');var rp=require(_0xd751('0x4'));var fs=require('fs');var path=require(_0xd751('0x5'));var rimraf=require(_0xd751('0x6'));var config=require(_0xd751('0x7'));var attributes=require('./mailQueue.attributes');module[_0xd751('0x8')]=function(_0x1eb0d2,_0x1fb46c){return _0x1eb0d2['define'](_0xd751('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd24=['path','../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd24,0x1a9));var _0x4cd2=function(_0x2006cf,_0x410386){_0x2006cf=_0x2006cf-0x0;var _0x437451=_0xcd24[_0x2006cf];return _0x437451;};'use strict';var _=require(_0x4cd2('0x0'));var util=require(_0x4cd2('0x1'));var logger=require(_0x4cd2('0x2'))(_0x4cd2('0x3'));var moment=require(_0x4cd2('0x4'));var BPromise=require(_0x4cd2('0x5'));var rp=require(_0x4cd2('0x6'));var fs=require('fs');var path=require(_0x4cd2('0x7'));var rimraf=require('rimraf');var config=require(_0x4cd2('0x8'));var attributes=require(_0x4cd2('0x9'));module['exports']=function(_0x3b2091,_0x3d81f0){return _0x3b2091['define'](_0x4cd2('0xa'),attributes,{'tableName':_0x4cd2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 3c0e99d..9520d40 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 _0xb281=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','socket.io-emitter','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','model','include','map','ShowMailQueue','find'];(function(_0xb343b6,_0x48ca3e){var _0x2dc7ad=function(_0x37fbf3){while(--_0x37fbf3){_0xb343b6['push'](_0xb343b6['shift']());}};_0x2dc7ad(++_0x48ca3e);}(_0xb281,0x176));var _0x1b28=function(_0x1e21f5,_0x108b95){_0x1e21f5=_0x1e21f5-0x0;var _0x541da9=_0xb281[_0x1e21f5];return _0x541da9;};'use strict';var _=require(_0x1b28('0x0'));var util=require('util');var moment=require(_0x1b28('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b28('0x2'));var fs=require('fs');var Redis=require(_0x1b28('0x3'));var db=require(_0x1b28('0x4'))['db'];var utils=require(_0x1b28('0x5'));var logger=require('../../config/logger')(_0x1b28('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1b28('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1b28('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b28('0x9'))(new Redis(config[_0x1b28('0x8')]));require(_0x1b28('0xa'))['register'](socket);function respondWithRpcPromise(_0x4a6d71,_0x38847d,_0x51e30a){return new BPromise(function(_0x44581f,_0x2c5d41){return client['request'](_0x4a6d71,_0x51e30a)[_0x1b28('0xb')](function(_0x1cb844){logger[_0x1b28('0xc')](_0x1b28('0xd'),_0x38847d,_0x1b28('0xe'));logger[_0x1b28('0xf')](_0x1b28('0x10'),_0x38847d,'request\x20sent',JSON[_0x1b28('0x11')](_0x1cb844));if(_0x1cb844[_0x1b28('0x12')]){if(_0x1cb844[_0x1b28('0x12')][_0x1b28('0x13')]===0x1f4){logger[_0x1b28('0x12')](_0x1b28('0xd'),_0x38847d,_0x1cb844[_0x1b28('0x12')][_0x1b28('0x14')]);return _0x2c5d41(_0x1cb844[_0x1b28('0x12')][_0x1b28('0x14')]);}logger['error'](_0x1b28('0xd'),_0x38847d,_0x1cb844['error'][_0x1b28('0x14')]);return _0x44581f(_0x1cb844[_0x1b28('0x12')][_0x1b28('0x14')]);}else{logger[_0x1b28('0xc')](_0x1b28('0xd'),_0x38847d,_0x1b28('0xe'));_0x44581f(_0x1cb844['result'][_0x1b28('0x14')]);}})[_0x1b28('0x15')](function(_0x22ae92){logger[_0x1b28('0x12')]('MailQueue,\x20%s,\x20%s',_0x38847d,_0x22ae92);_0x2c5d41(_0x22ae92);});});}exports[_0x1b28('0x16')]=function(_0x178ac5){var _0x9de87e=this;return new Promise(function(_0x2ba3e2,_0x58075b){return db[_0x1b28('0x17')][_0x1b28('0x18')]({'raw':_0x178ac5['options']?_0x178ac5[_0x1b28('0x19')][_0x1b28('0x1a')]===undefined?!![]:![]:!![],'where':_0x178ac5['options']?_0x178ac5[_0x1b28('0x19')][_0x1b28('0x1b')]||null:null,'attributes':_0x178ac5[_0x1b28('0x19')]?_0x178ac5[_0x1b28('0x19')][_0x1b28('0x1c')]||null:null,'limit':_0x178ac5[_0x1b28('0x19')]?_0x178ac5[_0x1b28('0x19')]['limit']||null:null,'include':_0x178ac5[_0x1b28('0x19')]?_0x178ac5[_0x1b28('0x19')]['include']?_['map'](_0x178ac5[_0x1b28('0x19')]['include'],function(_0x471681){return{'model':db[_0x471681[_0x1b28('0x1d')]],'as':_0x471681['as'],'attributes':_0x471681[_0x1b28('0x1c')],'include':_0x471681[_0x1b28('0x1e')]?_[_0x1b28('0x1f')](_0x471681[_0x1b28('0x1e')],function(_0x2778d5){return{'model':db[_0x2778d5[_0x1b28('0x1d')]],'as':_0x2778d5['as'],'attributes':_0x2778d5[_0x1b28('0x1c')],'include':_0x2778d5[_0x1b28('0x1e')]?_[_0x1b28('0x1f')](_0x2778d5[_0x1b28('0x1e')],function(_0x30b345){return{'model':db[_0x30b345[_0x1b28('0x1d')]],'as':_0x30b345['as'],'attributes':_0x30b345[_0x1b28('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1b28('0xb')](function(_0x26f29c){logger[_0x1b28('0xc')]('GetMailQueue',_0x178ac5);logger[_0x1b28('0xf')](_0x1b28('0x16'),_0x178ac5,JSON[_0x1b28('0x11')](_0x26f29c));_0x2ba3e2(_0x26f29c);})['catch'](function(_0x345e73){logger[_0x1b28('0x12')](_0x1b28('0x16'),_0x345e73[_0x1b28('0x14')],_0x178ac5);_0x58075b(_0x9de87e[_0x1b28('0x12')](0x1f4,_0x345e73[_0x1b28('0x14')]));});});};exports[_0x1b28('0x20')]=function(_0x2d020b){var _0x538d31=this;return new Promise(function(_0x1b0cb0,_0x1d9742){return db[_0x1b28('0x17')][_0x1b28('0x21')]({'raw':_0x2d020b[_0x1b28('0x19')]?_0x2d020b[_0x1b28('0x19')][_0x1b28('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d020b[_0x1b28('0x19')]?_0x2d020b[_0x1b28('0x19')][_0x1b28('0x1b')]||null:null,'attributes':_0x2d020b[_0x1b28('0x19')]?_0x2d020b['options'][_0x1b28('0x1c')]||null:null,'include':_0x2d020b[_0x1b28('0x19')]?_0x2d020b[_0x1b28('0x19')][_0x1b28('0x1e')]?_[_0x1b28('0x1f')](_0x2d020b[_0x1b28('0x19')][_0x1b28('0x1e')],function(_0x3975e0){return{'model':db[_0x3975e0[_0x1b28('0x1d')]],'as':_0x3975e0['as'],'attributes':_0x3975e0[_0x1b28('0x1c')],'include':_0x3975e0[_0x1b28('0x1e')]?_[_0x1b28('0x1f')](_0x3975e0[_0x1b28('0x1e')],function(_0x5ccb03){return{'model':db[_0x5ccb03[_0x1b28('0x1d')]],'as':_0x5ccb03['as'],'attributes':_0x5ccb03[_0x1b28('0x1c')],'include':_0x5ccb03[_0x1b28('0x1e')]?_['map'](_0x5ccb03[_0x1b28('0x1e')],function(_0x4792f5){return{'model':db[_0x4792f5['model']],'as':_0x4792f5['as'],'attributes':_0x4792f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b28('0xb')](function(_0x529a1c){logger[_0x1b28('0xc')](_0x1b28('0x20'),_0x2d020b);logger[_0x1b28('0xf')]('ShowMailQueue',_0x2d020b,JSON[_0x1b28('0x11')](_0x529a1c));_0x1b0cb0(_0x529a1c);})[_0x1b28('0x15')](function(_0x5689c0){logger['error'](_0x1b28('0x20'),_0x5689c0[_0x1b28('0x14')],_0x2d020b);_0x1d9742(_0x538d31[_0x1b28('0x12')](0x1f4,_0x5689c0[_0x1b28('0x14')]));});});}; \ No newline at end of file +var _0xca77=['model','include','then','ShowMailQueue','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','map'];(function(_0x3206ec,_0x2fc529){var _0x174241=function(_0x354695){while(--_0x354695){_0x3206ec['push'](_0x3206ec['shift']());}};_0x174241(++_0x2fc529);}(_0xca77,0x164));var _0x7ca7=function(_0xa100b9,_0x8abc7a){_0xa100b9=_0xa100b9-0x0;var _0x18022f=_0xca77[_0xa100b9];return _0x18022f;};'use strict';var _=require('lodash');var util=require(_0x7ca7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7ca7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ca7('0x2'))['db'];var utils=require(_0x7ca7('0x3'));var logger=require(_0x7ca7('0x4'))(_0x7ca7('0x5'));var config=require(_0x7ca7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7ca7('0x7')][_0x7ca7('0x8')]({'port':0x232a});config[_0x7ca7('0x9')]=_[_0x7ca7('0xa')](config[_0x7ca7('0x9')],{'host':_0x7ca7('0xb'),'port':0x18eb});var socket=require(_0x7ca7('0xc'))(new Redis(config[_0x7ca7('0x9')]));require(_0x7ca7('0xd'))['register'](socket);function respondWithRpcPromise(_0x2f6cfc,_0x4d7f25,_0x18ff3d){return new BPromise(function(_0x180403,_0x5227d0){return client[_0x7ca7('0xe')](_0x2f6cfc,_0x18ff3d)['then'](function(_0x1072c4){logger[_0x7ca7('0xf')](_0x7ca7('0x10'),_0x4d7f25,'request\x20sent');logger[_0x7ca7('0x11')](_0x7ca7('0x12'),_0x4d7f25,_0x7ca7('0x13'),JSON[_0x7ca7('0x14')](_0x1072c4));if(_0x1072c4[_0x7ca7('0x15')]){if(_0x1072c4[_0x7ca7('0x15')][_0x7ca7('0x16')]===0x1f4){logger[_0x7ca7('0x15')]('MailQueue,\x20%s,\x20%s',_0x4d7f25,_0x1072c4[_0x7ca7('0x15')]['message']);return _0x5227d0(_0x1072c4['error'][_0x7ca7('0x17')]);}logger[_0x7ca7('0x15')](_0x7ca7('0x10'),_0x4d7f25,_0x1072c4['error'][_0x7ca7('0x17')]);return _0x180403(_0x1072c4['error']['message']);}else{logger[_0x7ca7('0xf')](_0x7ca7('0x10'),_0x4d7f25,_0x7ca7('0x13'));_0x180403(_0x1072c4[_0x7ca7('0x18')]['message']);}})[_0x7ca7('0x19')](function(_0x4ecd38){logger[_0x7ca7('0x15')](_0x7ca7('0x10'),_0x4d7f25,_0x4ecd38);_0x5227d0(_0x4ecd38);});});}exports[_0x7ca7('0x1a')]=function(_0x3b0245){var _0x474629=this;return new Promise(function(_0x129f1d,_0x16a0a7){return db['MailQueue'][_0x7ca7('0x1b')]({'raw':_0x3b0245[_0x7ca7('0x1c')]?_0x3b0245[_0x7ca7('0x1c')][_0x7ca7('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b0245[_0x7ca7('0x1c')]?_0x3b0245['options'][_0x7ca7('0x1e')]||null:null,'attributes':_0x3b0245['options']?_0x3b0245[_0x7ca7('0x1c')][_0x7ca7('0x1f')]||null:null,'limit':_0x3b0245[_0x7ca7('0x1c')]?_0x3b0245[_0x7ca7('0x1c')][_0x7ca7('0x20')]||null:null,'include':_0x3b0245[_0x7ca7('0x1c')]?_0x3b0245[_0x7ca7('0x1c')]['include']?_[_0x7ca7('0x21')](_0x3b0245[_0x7ca7('0x1c')]['include'],function(_0x1e72fd){return{'model':db[_0x1e72fd[_0x7ca7('0x22')]],'as':_0x1e72fd['as'],'attributes':_0x1e72fd[_0x7ca7('0x1f')],'include':_0x1e72fd[_0x7ca7('0x23')]?_[_0x7ca7('0x21')](_0x1e72fd[_0x7ca7('0x23')],function(_0xc463c2){return{'model':db[_0xc463c2[_0x7ca7('0x22')]],'as':_0xc463c2['as'],'attributes':_0xc463c2[_0x7ca7('0x1f')],'include':_0xc463c2[_0x7ca7('0x23')]?_[_0x7ca7('0x21')](_0xc463c2[_0x7ca7('0x23')],function(_0xce4916){return{'model':db[_0xce4916[_0x7ca7('0x22')]],'as':_0xce4916['as'],'attributes':_0xce4916[_0x7ca7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7ca7('0x24')](function(_0x31fa16){logger[_0x7ca7('0xf')](_0x7ca7('0x1a'),_0x3b0245);logger['debug'](_0x7ca7('0x1a'),_0x3b0245,JSON[_0x7ca7('0x14')](_0x31fa16));_0x129f1d(_0x31fa16);})[_0x7ca7('0x19')](function(_0x16c60d){logger[_0x7ca7('0x15')]('GetMailQueue',_0x16c60d[_0x7ca7('0x17')],_0x3b0245);_0x16a0a7(_0x474629[_0x7ca7('0x15')](0x1f4,_0x16c60d[_0x7ca7('0x17')]));});});};exports[_0x7ca7('0x25')]=function(_0x1624e3){var _0x482260=this;return new Promise(function(_0x27a35e,_0xa79b29){return db['MailQueue'][_0x7ca7('0x26')]({'raw':_0x1624e3[_0x7ca7('0x1c')]?_0x1624e3[_0x7ca7('0x1c')][_0x7ca7('0x1d')]===undefined?!![]:![]:!![],'where':_0x1624e3[_0x7ca7('0x1c')]?_0x1624e3[_0x7ca7('0x1c')][_0x7ca7('0x1e')]||null:null,'attributes':_0x1624e3[_0x7ca7('0x1c')]?_0x1624e3[_0x7ca7('0x1c')]['attributes']||null:null,'include':_0x1624e3[_0x7ca7('0x1c')]?_0x1624e3['options'][_0x7ca7('0x23')]?_[_0x7ca7('0x21')](_0x1624e3['options'][_0x7ca7('0x23')],function(_0x3ee8f3){return{'model':db[_0x3ee8f3[_0x7ca7('0x22')]],'as':_0x3ee8f3['as'],'attributes':_0x3ee8f3[_0x7ca7('0x1f')],'include':_0x3ee8f3['include']?_[_0x7ca7('0x21')](_0x3ee8f3[_0x7ca7('0x23')],function(_0x20f5de){return{'model':db[_0x20f5de[_0x7ca7('0x22')]],'as':_0x20f5de['as'],'attributes':_0x20f5de[_0x7ca7('0x1f')],'include':_0x20f5de[_0x7ca7('0x23')]?_[_0x7ca7('0x21')](_0x20f5de[_0x7ca7('0x23')],function(_0x283954){return{'model':db[_0x283954[_0x7ca7('0x22')]],'as':_0x283954['as'],'attributes':_0x283954[_0x7ca7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7ca7('0x24')](function(_0x3f2e79){logger[_0x7ca7('0xf')]('ShowMailQueue',_0x1624e3);logger['debug']('ShowMailQueue',_0x1624e3,JSON[_0x7ca7('0x14')](_0x3f2e79));_0x27a35e(_0x3f2e79);})[_0x7ca7('0x19')](function(_0x4970aa){logger[_0x7ca7('0x15')](_0x7ca7('0x25'),_0x4970aa[_0x7ca7('0x17')],_0x1624e3);_0xa79b29(_0x482260[_0x7ca7('0x15')](0x1f4,_0x4970aa[_0x7ca7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 119e797..9b6963e 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 _0x51b1=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x1ad4aa,_0x79cfdb){var _0x5ee61b=function(_0xfe6ead){while(--_0xfe6ead){_0x1ad4aa['push'](_0x1ad4aa['shift']());}};_0x5ee61b(++_0x79cfdb);}(_0x51b1,0x70));var _0x151b=function(_0x3b2e0a,_0x49a3f9){_0x3b2e0a=_0x3b2e0a-0x0;var _0x4a84bd=_0x51b1[_0x3b2e0a];return _0x4a84bd;};'use strict';var MailQueueEvents=require(_0x151b('0x0'));var events=[_0x151b('0x1'),_0x151b('0x2'),_0x151b('0x3')];function createListener(_0x4be472,_0x281284){return function(_0xd9d45e){_0x281284[_0x151b('0x4')](_0x4be472,_0xd9d45e);};}function removeListener(_0x45e466,_0x144002){return function(){MailQueueEvents[_0x151b('0x5')](_0x45e466,_0x144002);};}exports[_0x151b('0x6')]=function(_0x694ef8){for(var _0x446497=0x0,_0x5c1db3=events[_0x151b('0x7')];_0x446497<_0x5c1db3;_0x446497++){var _0x1c624a=events[_0x446497];var _0x1ca1e9=createListener(_0x151b('0x8')+_0x1c624a,_0x694ef8);MailQueueEvents['on'](_0x1c624a,_0x1ca1e9);}}; \ No newline at end of file +var _0x505c=['remove','update','emit','removeListener','register','./mailQueue.events'];(function(_0x10c634,_0x406922){var _0x57390b=function(_0x2bce24){while(--_0x2bce24){_0x10c634['push'](_0x10c634['shift']());}};_0x57390b(++_0x406922);}(_0x505c,0x149));var _0xc505=function(_0x2aefff,_0x26a24b){_0x2aefff=_0x2aefff-0x0;var _0x4e4534=_0x505c[_0x2aefff];return _0x4e4534;};'use strict';var MailQueueEvents=require(_0xc505('0x0'));var events=['save',_0xc505('0x1'),_0xc505('0x2')];function createListener(_0x2d5022,_0x132a07){return function(_0x9f15b4){_0x132a07[_0xc505('0x3')](_0x2d5022,_0x9f15b4);};}function removeListener(_0x5856fb,_0x1a5f51){return function(){MailQueueEvents[_0xc505('0x4')](_0x5856fb,_0x1a5f51);};}exports[_0xc505('0x5')]=function(_0x5a5877){for(var _0x70741=0x0,_0x2ba551=events['length'];_0x70741<_0x2ba551;_0x70741++){var _0x4ed102=events[_0x70741];var _0x1a32b0=createListener('mailQueue:'+_0x4ed102,_0x5a5877);MailQueueEvents['on'](_0x4ed102,_0x1a32b0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6d4d64f..a3c93f9 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 _0x01b1=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','post','/:id','update','exports','multer','path'];(function(_0x33886e,_0x352de5){var _0x23f5e5=function(_0x3cf1de){while(--_0x3cf1de){_0x33886e['push'](_0x33886e['shift']());}};_0x23f5e5(++_0x352de5);}(_0x01b1,0x185));var _0x101b=function(_0x1c3f44,_0x3b9db4){_0x1c3f44=_0x1c3f44-0x0;var _0x1bc285=_0x01b1[_0x1c3f44];return _0x1bc285;};'use strict';var multer=require(_0x101b('0x0'));var util=require('util');var path=require(_0x101b('0x1'));var timeout=require(_0x101b('0x2'));var express=require(_0x101b('0x3'));var router=express[_0x101b('0x4')]();var fs_extra=require(_0x101b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x101b('0x6'));var config=require(_0x101b('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x101b('0x8')](),controller[_0x101b('0x9')]);router[_0x101b('0xa')](_0x101b('0xb'),auth[_0x101b('0x8')](),controller[_0x101b('0xc')]);router[_0x101b('0xa')]('/:id',auth[_0x101b('0x8')](),controller['show']);router[_0x101b('0xd')]('/',auth[_0x101b('0x8')](),controller['create']);router['put'](_0x101b('0xe'),auth[_0x101b('0x8')](),controller[_0x101b('0xf')]);router['delete']('/:id',auth[_0x101b('0x8')](),controller['destroy']);module[_0x101b('0x10')]=router; \ No newline at end of file +var _0xdd3b=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd3b,0x1cd));var _0xbdd3=function(_0x314a23,_0x25836f){_0x314a23=_0x314a23-0x0;var _0x35dd44=_0xdd3b[_0x314a23];return _0x35dd44;};'use strict';var multer=require(_0xbdd3('0x0'));var util=require(_0xbdd3('0x1'));var path=require('path');var timeout=require(_0xbdd3('0x2'));var express=require(_0xbdd3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbdd3('0x4'));var interaction=require(_0xbdd3('0x5'));var config=require(_0xbdd3('0x6'));var controller=require('./mailQueueReport.controller');router[_0xbdd3('0x7')]('/',auth[_0xbdd3('0x8')](),controller['index']);router[_0xbdd3('0x7')](_0xbdd3('0x9'),auth['isAuthenticated'](),controller[_0xbdd3('0xa')]);router['get'](_0xbdd3('0xb'),auth[_0xbdd3('0x8')](),controller[_0xbdd3('0xc')]);router[_0xbdd3('0xd')]('/',auth['isAuthenticated'](),controller[_0xbdd3('0xe')]);router[_0xbdd3('0xf')](_0xbdd3('0xb'),auth[_0xbdd3('0x8')](),controller[_0xbdd3('0x10')]);router[_0xbdd3('0x11')]('/:id',auth[_0xbdd3('0x8')](),controller['destroy']);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 48c51d9..9014c2f 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 _0xbc35=['sequelize','exports','STRING','DATE'];(function(_0x2f23dc,_0x583e49){var _0x1fcac7=function(_0x328622){while(--_0x328622){_0x2f23dc['push'](_0x2f23dc['shift']());}};_0x1fcac7(++_0x583e49);}(_0xbc35,0x18c));var _0x5bc3=function(_0x361fcd,_0x211558){_0x361fcd=_0x361fcd-0x0;var _0x233e7a=_0xbc35[_0x361fcd];return _0x233e7a;};'use strict';var moment=require('moment');var Sequelize=require(_0x5bc3('0x0'));module[_0x5bc3('0x1')]={'uniqueid':{'type':Sequelize[_0x5bc3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5bc3('0x2')]},'joinAt':{'type':Sequelize[_0x5bc3('0x3')]},'leaveAt':{'type':Sequelize[_0x5bc3('0x3')]},'acceptAt':{'type':Sequelize[_0x5bc3('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5bc3('0x2')]}}; \ No newline at end of file +var _0x41b5=['sequelize','exports','STRING','DATE'];(function(_0x595486,_0x427df7){var _0x13ab19=function(_0x49fcab){while(--_0x49fcab){_0x595486['push'](_0x595486['shift']());}};_0x13ab19(++_0x427df7);}(_0x41b5,0x94));var _0x541b=function(_0x21c835,_0x347926){_0x21c835=_0x21c835-0x0;var _0x37b59a=_0x41b5[_0x21c835];return _0x37b59a;};'use strict';var moment=require('moment');var Sequelize=require(_0x541b('0x0'));module[_0x541b('0x1')]={'uniqueid':{'type':Sequelize[_0x541b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x541b('0x3')]},'leaveAt':{'type':Sequelize[_0x541b('0x3')]},'acceptAt':{'type':Sequelize[_0x541b('0x3')]},'exitAt':{'type':Sequelize[_0x541b('0x3')]},'reason':{'type':Sequelize[_0x541b('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ed8462c..5927833 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 _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x245ec8,_0x340b44){var _0x26c57f=function(_0x1da325){while(--_0x1da325){_0x245ec8['push'](_0x245ec8['shift']());}};_0x26c57f(++_0x340b44);}(_0x47c5,0x165));var _0x547c=function(_0x1e6346,_0x57ccbd){_0x1e6346=_0x1e6346-0x0;var _0x770c06=_0x47c5[_0x1e6346];return _0x770c06;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['MailQueueReport'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['MailQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['MailQueueReport'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['MailQueueReport'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5dfba5,_0x2caa21){_0x5dfba5=_0x5dfba5-0x0;var _0x3083a0=_0xbbbc[_0x5dfba5];return _0x3083a0;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['MailQueueReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['MailQueueReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6be0db6..6f266bf 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 _0x1c64=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x52ac56,_0x36b227){var _0x3f8da0=function(_0x3429c2){while(--_0x3429c2){_0x52ac56['push'](_0x52ac56['shift']());}};_0x3f8da0(++_0x36b227);}(_0x1c64,0xf7));var _0x41c6=function(_0x3c56f2,_0x148c63){_0x3c56f2=_0x3c56f2-0x0;var _0x39edf8=_0x1c64[_0x3c56f2];return _0x39edf8;};'use strict';var _=require(_0x41c6('0x0'));var util=require(_0x41c6('0x1'));var logger=require(_0x41c6('0x2'))(_0x41c6('0x3'));var moment=require(_0x41c6('0x4'));var BPromise=require('bluebird');var rp=require(_0x41c6('0x5'));var fs=require('fs');var path=require(_0x41c6('0x6'));var rimraf=require(_0x41c6('0x7'));var config=require(_0x41c6('0x8'));var attributes=require(_0x41c6('0x9'));module[_0x41c6('0xa')]=function(_0x2cdb3b,_0x422028){return _0x2cdb3b['define'](_0x41c6('0xb'),attributes,{'tableName':_0x41c6('0xc'),'paranoid':![],'indexes':[{'name':_0x41c6('0xd'),'fields':[_0x41c6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb53e=['./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xb53e,0xa9));var _0xeb53=function(_0x58e5bb,_0x371c27){_0x58e5bb=_0x58e5bb-0x0;var _0x4e99d6=_0xb53e[_0x58e5bb];return _0x4e99d6;};'use strict';var _=require(_0xeb53('0x0'));var util=require(_0xeb53('0x1'));var logger=require('../../config/logger')(_0xeb53('0x2'));var moment=require(_0xeb53('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb53('0x4'));var fs=require('fs');var path=require(_0xeb53('0x5'));var rimraf=require('rimraf');var config=require(_0xeb53('0x6'));var attributes=require(_0xeb53('0x7'));module['exports']=function(_0x4e49c5,_0x40391f){return _0x4e49c5[_0xeb53('0x8')](_0xeb53('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xeb53('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a1e0dd5..6f98fb9 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x155ddc,_0x5913f0){var _0x57f704=function(_0x20bc94){while(--_0x20bc94){_0x155ddc['push'](_0x155ddc['shift']());}};_0x57f704(++_0x5913f0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'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')]('MailQueueReport,\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);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x2001b7,_0x20961c){var _0x32dec4=function(_0x4031bc){while(--_0x4031bc){_0x2001b7['push'](_0x2001b7['shift']());}};_0x32dec4(++_0x20961c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56524a,_0x3e8a54){_0x56524a=_0x56524a-0x0;var _0x40f630=_0x5f2f[_0x56524a];return _0x40f630;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index ff5a945..4d1c751 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(_0x5c5b4d,_0x3b4781){var _0x448a9e=function(_0x44710f){while(--_0x44710f){_0x5c5b4d['push'](_0x5c5b4d['shift']());}};_0x448a9e(++_0x3b4781);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x575297,_0xf90a9c){var _0x17b6ad=function(_0x48fbd5){while(--_0x48fbd5){_0x575297['push'](_0x575297['shift']());}};_0x17b6ad(++_0xf90a9c);}(_0x70e0,0x17b));var _0x070e=function(_0x2d56e6,_0x23b2f5){_0x2d56e6=_0x2d56e6-0x0;var _0x305f08=_0x70e0[_0x2d56e6];return _0x305f08;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 6997d89..12f99a0 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 _0x286e=['INBOX','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x2ee808,_0x4f85cf){var _0x110d91=function(_0x237a29){while(--_0x237a29){_0x2ee808['push'](_0x2ee808['shift']());}};_0x110d91(++_0x4f85cf);}(_0x286e,0x85));var _0xe286=function(_0x5e253,_0x16f688){_0x5e253=_0x5e253-0x0;var _0x56b21d=_0x286e[_0x5e253];return _0x56b21d;};'use strict';var Sequelize=require(_0xe286('0x0'));module[_0xe286('0x1')]={'description':{'type':Sequelize[_0xe286('0x2')]},'host':{'type':Sequelize[_0xe286('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe286('0x2')]},'port':{'type':Sequelize[_0xe286('0x3')]},'tls':{'type':Sequelize[_0xe286('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xe286('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe286('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe286('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1c68=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1c68,0xe9));var _0x81c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c68[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x81c6('0x0'));module[_0x81c6('0x1')]={'description':{'type':Sequelize[_0x81c6('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x81c6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x81c6('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x81c6('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x81c6('0x2')],'defaultValue':_0x81c6('0x5')},'connTimeout':{'type':Sequelize[_0x81c6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x81c6('0x2')]},'modernAuthentication':{'type':Sequelize[_0x81c6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 109a929..3b9a8f7 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 _0x2948=['exports','define','mail_servers_in','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x573852,_0x12ed32){var _0x474f06=function(_0x426a38){while(--_0x426a38){_0x573852['push'](_0x573852['shift']());}};_0x474f06(++_0x12ed32);}(_0x2948,0x87));var _0x8294=function(_0x5e035d,_0x43d8a2){_0x5e035d=_0x5e035d-0x0;var _0xcc4278=_0x2948[_0x5e035d];return _0xcc4278;};'use strict';var _=require('lodash');var util=require(_0x8294('0x0'));var logger=require(_0x8294('0x1'))(_0x8294('0x2'));var moment=require(_0x8294('0x3'));var BPromise=require(_0x8294('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8294('0x5'));var rimraf=require(_0x8294('0x6'));var config=require(_0x8294('0x7'));var attributes=require(_0x8294('0x8'));module[_0x8294('0x9')]=function(_0x32c6f0,_0x2f5ca4){return _0x32c6f0[_0x8294('0xa')]('MailServerIn',attributes,{'tableName':_0x8294('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf10=['MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./mailServerIn.attributes','define'];(function(_0x39e024,_0x825153){var _0x329a8b=function(_0x238e1f){while(--_0x238e1f){_0x39e024['push'](_0x39e024['shift']());}};_0x329a8b(++_0x825153);}(_0xaf10,0x115));var _0x0af1=function(_0x3ae7b7,_0x2e5f6d){_0x3ae7b7=_0x3ae7b7-0x0;var _0x54b43b=_0xaf10[_0x3ae7b7];return _0x54b43b;};'use strict';var _=require(_0x0af1('0x0'));var util=require('util');var logger=require(_0x0af1('0x1'))(_0x0af1('0x2'));var moment=require(_0x0af1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0af1('0x4'));var fs=require('fs');var path=require(_0x0af1('0x5'));var rimraf=require(_0x0af1('0x6'));var config=require('../../config/environment');var attributes=require(_0x0af1('0x7'));module['exports']=function(_0x24bc80,_0x193bb2){return _0x24bc80[_0x0af1('0x8')](_0x0af1('0x9'),attributes,{'tableName':_0x0af1('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 90e68e0..d4ae09c 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 _0x188e=['stringify','error','message','result','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','map','model','include','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x3e0d3f,_0x1302cc){var _0x5268c7=function(_0x4d9901){while(--_0x4d9901){_0x3e0d3f['push'](_0x3e0d3f['shift']());}};_0x5268c7(++_0x1302cc);}(_0x188e,0x1cf));var _0xe188=function(_0x3962fb,_0x7d22eb){_0x3962fb=_0x3962fb-0x0;var _0x85b7d2=_0x188e[_0x3962fb];return _0x85b7d2;};'use strict';var _=require('lodash');var util=require(_0xe188('0x0'));var moment=require(_0xe188('0x1'));var BPromise=require('bluebird');var rs=require(_0xe188('0x2'));var fs=require('fs');var Redis=require(_0xe188('0x3'));var db=require(_0xe188('0x4'))['db'];var utils=require(_0xe188('0x5'));var logger=require(_0xe188('0x6'))(_0xe188('0x7'));var config=require(_0xe188('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe188('0x9')][_0xe188('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x311420,_0x3a7a9a,_0x2afab2){return new BPromise(function(_0x3080f0,_0x9a4d21){return client['request'](_0x311420,_0x2afab2)[_0xe188('0xb')](function(_0x26343b){logger[_0xe188('0xc')](_0xe188('0xd'),_0x3a7a9a,_0xe188('0xe'));logger[_0xe188('0xf')](_0xe188('0x10'),_0x3a7a9a,'request\x20sent',JSON[_0xe188('0x11')](_0x26343b));if(_0x26343b[_0xe188('0x12')]){if(_0x26343b[_0xe188('0x12')]['code']===0x1f4){logger[_0xe188('0x12')](_0xe188('0xd'),_0x3a7a9a,_0x26343b[_0xe188('0x12')][_0xe188('0x13')]);return _0x9a4d21(_0x26343b[_0xe188('0x12')][_0xe188('0x13')]);}logger['error'](_0xe188('0xd'),_0x3a7a9a,_0x26343b[_0xe188('0x12')][_0xe188('0x13')]);return _0x3080f0(_0x26343b[_0xe188('0x12')][_0xe188('0x13')]);}else{logger[_0xe188('0xc')]('MailServerIn,\x20%s,\x20%s',_0x3a7a9a,_0xe188('0xe'));_0x3080f0(_0x26343b[_0xe188('0x14')][_0xe188('0x13')]);}})['catch'](function(_0x1f27ed){logger[_0xe188('0x12')](_0xe188('0xd'),_0x3a7a9a,_0x1f27ed);_0x9a4d21(_0x1f27ed);});});}exports[_0xe188('0x15')]=function(_0x2f1ea2){var _0x1d65d8=this;return new Promise(function(_0x28d1e8,_0x284c3b){return db[_0xe188('0x16')]['findAll']({'raw':_0x2f1ea2[_0xe188('0x17')]?_0x2f1ea2['options'][_0xe188('0x18')]===undefined?!![]:![]:!![],'where':_0x2f1ea2[_0xe188('0x17')]?_0x2f1ea2[_0xe188('0x17')][_0xe188('0x19')]||null:null,'attributes':_0x2f1ea2[_0xe188('0x17')]?_0x2f1ea2['options'][_0xe188('0x1a')]||null:null,'limit':_0x2f1ea2['options']?_0x2f1ea2[_0xe188('0x17')][_0xe188('0x1b')]||null:null,'include':_0x2f1ea2['options']?_0x2f1ea2[_0xe188('0x17')]['include']?_[_0xe188('0x1c')](_0x2f1ea2[_0xe188('0x17')]['include'],function(_0x52856d){return{'model':db[_0x52856d[_0xe188('0x1d')]],'as':_0x52856d['as'],'attributes':_0x52856d['attributes'],'include':_0x52856d[_0xe188('0x1e')]?_[_0xe188('0x1c')](_0x52856d[_0xe188('0x1e')],function(_0x207160){return{'model':db[_0x207160[_0xe188('0x1d')]],'as':_0x207160['as'],'attributes':_0x207160[_0xe188('0x1a')],'include':_0x207160[_0xe188('0x1e')]?_['map'](_0x207160['include'],function(_0x5ea084){return{'model':db[_0x5ea084[_0xe188('0x1d')]],'as':_0x5ea084['as'],'attributes':_0x5ea084['attributes']};}):[]};}):[]};}):[]:[]})[_0xe188('0xb')](function(_0x52282b){logger['info']('GetMailServerIn',_0x2f1ea2);logger[_0xe188('0xf')](_0xe188('0x15'),_0x2f1ea2,JSON[_0xe188('0x11')](_0x52282b));_0x28d1e8(_0x52282b);})[_0xe188('0x1f')](function(_0x3f1075){logger[_0xe188('0x12')](_0xe188('0x15'),_0x3f1075['message'],_0x2f1ea2);_0x284c3b(_0x1d65d8['error'](0x1f4,_0x3f1075['message']));});});}; \ No newline at end of file +var _0x634d=['MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','include','model','map','debug','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x1d8bbd,_0x54b35e){var _0x630de=function(_0x375126){while(--_0x375126){_0x1d8bbd['push'](_0x1d8bbd['shift']());}};_0x630de(++_0x54b35e);}(_0x634d,0x120));var _0xd634=function(_0x30e4a9,_0x4a5b98){_0x30e4a9=_0x30e4a9-0x0;var _0x210e25=_0x634d[_0x30e4a9];return _0x210e25;};'use strict';var _=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var moment=require(_0xd634('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd634('0x3'))['db'];var utils=require(_0xd634('0x4'));var logger=require(_0xd634('0x5'))('rpc');var config=require(_0xd634('0x6'));var jayson=require(_0xd634('0x7'));var client=jayson['client'][_0xd634('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c930f,_0x121b88,_0x10c5d2){return new BPromise(function(_0x11b091,_0x14bfc7){return client['request'](_0x5c930f,_0x10c5d2)[_0xd634('0x9')](function(_0x38bb9e){logger['info'](_0xd634('0xa'),_0x121b88,_0xd634('0xb'));logger['debug'](_0xd634('0xc'),_0x121b88,'request\x20sent',JSON['stringify'](_0x38bb9e));if(_0x38bb9e['error']){if(_0x38bb9e[_0xd634('0xd')][_0xd634('0xe')]===0x1f4){logger[_0xd634('0xd')]('MailServerIn,\x20%s,\x20%s',_0x121b88,_0x38bb9e['error'][_0xd634('0xf')]);return _0x14bfc7(_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);}logger['error'](_0xd634('0xa'),_0x121b88,_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);return _0x11b091(_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);}else{logger[_0xd634('0x10')](_0xd634('0xa'),_0x121b88,_0xd634('0xb'));_0x11b091(_0x38bb9e[_0xd634('0x11')]['message']);}})[_0xd634('0x12')](function(_0x123c26){logger[_0xd634('0xd')](_0xd634('0xa'),_0x121b88,_0x123c26);_0x14bfc7(_0x123c26);});});}exports[_0xd634('0x13')]=function(_0x271fa2){var _0x1a9696=this;return new Promise(function(_0x16ee0a,_0x17c604){return db[_0xd634('0x14')]['findAll']({'raw':_0x271fa2[_0xd634('0x15')]?_0x271fa2[_0xd634('0x15')][_0xd634('0x16')]===undefined?!![]:![]:!![],'where':_0x271fa2[_0xd634('0x15')]?_0x271fa2[_0xd634('0x15')][_0xd634('0x17')]||null:null,'attributes':_0x271fa2[_0xd634('0x15')]?_0x271fa2[_0xd634('0x15')][_0xd634('0x18')]||null:null,'limit':_0x271fa2[_0xd634('0x15')]?_0x271fa2['options']['limit']||null:null,'include':_0x271fa2[_0xd634('0x15')]?_0x271fa2[_0xd634('0x15')][_0xd634('0x19')]?_['map'](_0x271fa2[_0xd634('0x15')][_0xd634('0x19')],function(_0x55b212){return{'model':db[_0x55b212['model']],'as':_0x55b212['as'],'attributes':_0x55b212[_0xd634('0x18')],'include':_0x55b212['include']?_['map'](_0x55b212[_0xd634('0x19')],function(_0x1017b3){return{'model':db[_0x1017b3[_0xd634('0x1a')]],'as':_0x1017b3['as'],'attributes':_0x1017b3['attributes'],'include':_0x1017b3['include']?_[_0xd634('0x1b')](_0x1017b3['include'],function(_0x11a215){return{'model':db[_0x11a215[_0xd634('0x1a')]],'as':_0x11a215['as'],'attributes':_0x11a215[_0xd634('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd634('0x9')](function(_0x29182d){logger[_0xd634('0x10')](_0xd634('0x13'),_0x271fa2);logger[_0xd634('0x1c')](_0xd634('0x13'),_0x271fa2,JSON[_0xd634('0x1d')](_0x29182d));_0x16ee0a(_0x29182d);})[_0xd634('0x12')](function(_0x36311f){logger[_0xd634('0xd')](_0xd634('0x13'),_0x36311f[_0xd634('0xf')],_0x271fa2);_0x17c604(_0x1a9696[_0xd634('0xd')](0x1f4,_0x36311f[_0xd634('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3b367f4..b8f126b 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x101479,_0x3b6096){_0x101479=_0x101479-0x0;var _0x3bc07a=_0x7a54[_0x101479];return _0x3bc07a;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index bcd63d2..14bfc9a 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a7=['BOOLEAN','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9a7,0x112));var _0x7b9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb9a7[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x7b9a('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x7b9a('0x1')]},'authentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6f7a=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3497db,_0x5088c5){_0x3497db=_0x3497db-0x0;var _0x4fdeae=_0x6f7a[_0x3497db];return _0x4fdeae;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'description':{'type':Sequelize[_0xa6f7('0x2')]},'host':{'type':Sequelize[_0xa6f7('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xa6f7('0x2')]},'port':{'type':Sequelize[_0xa6f7('0x3')]},'secure':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xa6f7('0x2')]},'authentication':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1dce8ae..c330250 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 _0xb66d=['ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','length','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv'];(function(_0x465c62,_0x245481){var _0x7af36c=function(_0x23f6ed){while(--_0x23f6ed){_0x465c62['push'](_0x465c62['shift']());}};_0x7af36c(++_0x245481);}(_0xb66d,0x1b3));var _0xdb66=function(_0x133425,_0x2d60f2){_0x133425=_0x133425-0x0;var _0x45c4a4=_0xb66d[_0x133425];return _0x45c4a4;};'use strict';var emlformat=require(_0xdb66('0x0'));var rimraf=require(_0xdb66('0x1'));var zipdir=require(_0xdb66('0x2'));var jsonpatch=require(_0xdb66('0x3'));var rp=require('request-promise');var moment=require(_0xdb66('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb66('0x5'));var util=require(_0xdb66('0x6'));var path=require(_0xdb66('0x7'));var sox=require('sox');var csv=require(_0xdb66('0x8'));var ejs=require(_0xdb66('0x9'));var fs=require('fs');var fs_extra=require(_0xdb66('0xa'));var _=require(_0xdb66('0xb'));var squel=require(_0xdb66('0xc'));var crypto=require(_0xdb66('0xd'));var jsforce=require(_0xdb66('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdb66('0x8'));var querystring=require('querystring');var Papa=require(_0xdb66('0xf'));var Redis=require(_0xdb66('0x10'));var authService=require(_0xdb66('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb66('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb66('0x13'))('api');var utils=require(_0xdb66('0x14'));var config=require(_0xdb66('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb770d6,_0x4a8159){_0x4a8159=_0x4a8159||0xcc;return function(_0xe871c5){if(_0xe871c5){return _0xb770d6[_0xdb66('0x16')](_0x4a8159);}return _0xb770d6[_0xdb66('0x17')](_0x4a8159)['end']();};}function respondWithResult(_0x5d3907,_0x302db4){_0x302db4=_0x302db4||0xc8;return function(_0x4446f4){if(_0x4446f4){return _0x5d3907[_0xdb66('0x17')](_0x302db4)[_0xdb66('0x18')](_0x4446f4);}};}function respondWithFilteredResult(_0x2f5f6b,_0x26453f){return function(_0x3d4492){if(_0x3d4492){var _0x7f8bb=typeof _0x26453f['offset']===_0xdb66('0x19')&&typeof _0x26453f[_0xdb66('0x1a')]===_0xdb66('0x19');var _0xb217f=_0x3d4492['count'];var _0x542763=_0x7f8bb?0x0:_0x26453f[_0xdb66('0x1b')];var _0x5a1fcc=_0x7f8bb?_0x3d4492[_0xdb66('0x1c')]:_0x26453f[_0xdb66('0x1b')]+_0x26453f[_0xdb66('0x1a')];var _0x379b56;if(_0x5a1fcc>=_0xb217f){_0x5a1fcc=_0xb217f;_0x379b56=0xc8;}else{_0x379b56=0xce;}_0x2f5f6b[_0xdb66('0x17')](_0x379b56);return _0x2f5f6b[_0xdb66('0x1d')](_0xdb66('0x1e'),_0x542763+'-'+_0x5a1fcc+'/'+_0xb217f)[_0xdb66('0x18')](_0x3d4492);}return null;};}function patchUpdates(_0x57fb73){return function(_0x211526){try{jsonpatch[_0xdb66('0x1f')](_0x211526,_0x57fb73,!![]);}catch(_0x46e656){return BPromise[_0xdb66('0x20')](_0x46e656);}return _0x211526['save']();};}function saveUpdates(_0x5160a3,_0x105e00){return function(_0x3a13ed){if(_0x3a13ed){return _0x3a13ed[_0xdb66('0x21')](_0x5160a3)['then'](function(_0x533b4b){return _0x533b4b;});}return null;};}function removeEntity(_0x16d37f,_0x16214a){return function(_0x180962){if(_0x180962){return _0x180962[_0xdb66('0x22')]()[_0xdb66('0x23')](function(){_0x16d37f['status'](0xcc)[_0xdb66('0x24')]();});}};}function handleEntityNotFound(_0x3940c3,_0x20f96a){return function(_0xb60c7a){if(!_0xb60c7a){_0x3940c3[_0xdb66('0x16')](0x194);}return _0xb60c7a;};}function handleError(_0x1676d6,_0x30f453){_0x30f453=_0x30f453||0x1f4;return function(_0x4f1ebe){logger[_0xdb66('0x25')](_0x4f1ebe[_0xdb66('0x26')]);if(_0x4f1ebe[_0xdb66('0x27')]){delete _0x4f1ebe[_0xdb66('0x27')];}_0x1676d6[_0xdb66('0x17')](_0x30f453)[_0xdb66('0x28')](_0x4f1ebe);};}exports['index']=function(_0x3b72e0,_0x3a43aa){var _0x3bee07={},_0x10012a={},_0x2e6c13={'count':0x0,'rows':[]};var _0xc270e4=_[_0xdb66('0x29')](db[_0xdb66('0x2a')][_0xdb66('0x2b')],function(_0x3f55da){return{'name':_0x3f55da[_0xdb66('0x2c')],'type':_0x3f55da['type'][_0xdb66('0x2d')]};});_0x10012a[_0xdb66('0x2e')]=_['map'](_0xc270e4,_0xdb66('0x27'));_0x10012a[_0xdb66('0x2f')]=_['keys'](_0x3b72e0[_0xdb66('0x2f')]);_0x10012a[_0xdb66('0x30')]=_[_0xdb66('0x31')](_0x10012a['model'],_0x10012a['query']);_0x3bee07[_0xdb66('0x32')]=_[_0xdb66('0x31')](_0x10012a[_0xdb66('0x2e')],qs[_0xdb66('0x33')](_0x3b72e0[_0xdb66('0x2f')][_0xdb66('0x33')]));_0x3bee07[_0xdb66('0x32')]=_0x3bee07[_0xdb66('0x32')]['length']?_0x3bee07[_0xdb66('0x32')]:_0x10012a[_0xdb66('0x2e')];if(!_0x3b72e0[_0xdb66('0x2f')][_0xdb66('0x34')](_0xdb66('0x35'))){_0x3bee07[_0xdb66('0x1a')]=qs['limit'](_0x3b72e0[_0xdb66('0x2f')][_0xdb66('0x1a')]);_0x3bee07[_0xdb66('0x1b')]=qs[_0xdb66('0x1b')](_0x3b72e0['query'][_0xdb66('0x1b')]);}_0x3bee07[_0xdb66('0x36')]=qs['sort'](_0x3b72e0[_0xdb66('0x2f')][_0xdb66('0x37')]);_0x3bee07[_0xdb66('0x38')]=qs[_0xdb66('0x30')](_[_0xdb66('0x39')](_0x3b72e0[_0xdb66('0x2f')],_0x10012a[_0xdb66('0x30')]),_0xc270e4);if(_0x3b72e0[_0xdb66('0x2f')]['filter']){_0x3bee07['where']=_['merge'](_0x3bee07[_0xdb66('0x38')],{'$or':_['map'](_0xc270e4,function(_0x18e29e){if(_0x18e29e[_0xdb66('0x3a')]!==_0xdb66('0x3b')){var _0x2ad671={};_0x2ad671[_0x18e29e[_0xdb66('0x27')]]={'$like':'%'+_0x3b72e0[_0xdb66('0x2f')][_0xdb66('0x3c')]+'%'};return _0x2ad671;}})});}_0x3bee07=_['merge']({},_0x3bee07,_0x3b72e0[_0xdb66('0x3d')]);var _0x4015bf={'where':_0x3bee07[_0xdb66('0x38')]};return db[_0xdb66('0x2a')][_0xdb66('0x1c')](_0x4015bf)[_0xdb66('0x23')](function(_0x5cad00){_0x2e6c13[_0xdb66('0x1c')]=_0x5cad00;if(_0x3b72e0[_0xdb66('0x2f')][_0xdb66('0x3e')]){_0x3bee07[_0xdb66('0x3f')]=[{'all':!![]}];}return db[_0xdb66('0x2a')]['findAll'](_0x3bee07);})[_0xdb66('0x23')](function(_0x193acf){_0x2e6c13[_0xdb66('0x40')]=_0x193acf;return _0x2e6c13;})[_0xdb66('0x23')](respondWithFilteredResult(_0x3a43aa,_0x3bee07))[_0xdb66('0x41')](handleError(_0x3a43aa,null));};exports[_0xdb66('0x42')]=function(_0x3bbebe,_0x495ed9){var _0x538817={'raw':!![],'where':{'id':_0x3bbebe[_0xdb66('0x43')]['id']}},_0x2d14c5={};_0x2d14c5[_0xdb66('0x2e')]=_[_0xdb66('0x44')](db['MailServerOut'][_0xdb66('0x2b')]);_0x2d14c5[_0xdb66('0x2f')]=_[_0xdb66('0x44')](_0x3bbebe[_0xdb66('0x2f')]);_0x2d14c5[_0xdb66('0x30')]=_['intersection'](_0x2d14c5[_0xdb66('0x2e')],_0x2d14c5['query']);_0x538817[_0xdb66('0x32')]=_[_0xdb66('0x31')](_0x2d14c5[_0xdb66('0x2e')],qs[_0xdb66('0x33')](_0x3bbebe['query'][_0xdb66('0x33')]));_0x538817['attributes']=_0x538817['attributes'][_0xdb66('0x45')]?_0x538817[_0xdb66('0x32')]:_0x2d14c5[_0xdb66('0x2e')];if(_0x3bbebe[_0xdb66('0x2f')]['includeAll']){_0x538817[_0xdb66('0x3f')]=[{'all':!![]}];}_0x538817=_[_0xdb66('0x46')]({},_0x538817,_0x3bbebe['options']);return db['MailServerOut'][_0xdb66('0x47')](_0x538817)[_0xdb66('0x23')](handleEntityNotFound(_0x495ed9,null))[_0xdb66('0x23')](respondWithResult(_0x495ed9,null))[_0xdb66('0x41')](handleError(_0x495ed9,null));};exports[_0xdb66('0x48')]=function(_0x5437d2,_0xf34bc1){return db['MailServerOut'][_0xdb66('0x48')](_0x5437d2[_0xdb66('0x49')],{})[_0xdb66('0x23')](respondWithResult(_0xf34bc1,0xc9))[_0xdb66('0x41')](handleError(_0xf34bc1,null));};exports[_0xdb66('0x21')]=function(_0x4f6c6e,_0x43b886){if(_0x4f6c6e[_0xdb66('0x49')]['id']){delete _0x4f6c6e[_0xdb66('0x49')]['id'];}return db[_0xdb66('0x2a')][_0xdb66('0x47')]({'where':{'id':_0x4f6c6e['params']['id']}})[_0xdb66('0x23')](handleEntityNotFound(_0x43b886,null))[_0xdb66('0x23')](saveUpdates(_0x4f6c6e[_0xdb66('0x49')],null))['then'](respondWithResult(_0x43b886,null))[_0xdb66('0x41')](handleError(_0x43b886,null));};exports[_0xdb66('0x22')]=function(_0x341755,_0x5c3740){return db[_0xdb66('0x2a')][_0xdb66('0x47')]({'where':{'id':_0x341755[_0xdb66('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c3740,null))[_0xdb66('0x23')](removeEntity(_0x5c3740,null))[_0xdb66('0x41')](handleError(_0x5c3740,null));}; \ No newline at end of file +var _0x3383=['catch','show','params','rawAttributes','find','create','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','MailServerOut','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x3d59da,_0x17f319){var _0x462dc4=function(_0x1a57a5){while(--_0x1a57a5){_0x3d59da['push'](_0x3d59da['shift']());}};_0x462dc4(++_0x17f319);}(_0x3383,0x16f));var _0x3338=function(_0x4bd9b8,_0x5a48dc){_0x4bd9b8=_0x4bd9b8-0x0;var _0x422ebb=_0x3383[_0x4bd9b8];return _0x422ebb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3338('0x0'));var jsonpatch=require(_0x3338('0x1'));var rp=require('request-promise');var moment=require(_0x3338('0x2'));var BPromise=require(_0x3338('0x3'));var Mustache=require(_0x3338('0x4'));var util=require(_0x3338('0x5'));var path=require('path');var sox=require(_0x3338('0x6'));var csv=require(_0x3338('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3338('0x8'));var _=require('lodash');var squel=require(_0x3338('0x9'));var crypto=require(_0x3338('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3338('0xb'));var toCsv=require(_0x3338('0x7'));var querystring=require(_0x3338('0xc'));var Papa=require(_0x3338('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3338('0xe'));var as=require(_0x3338('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3338('0x10'))(_0x3338('0x11'));var utils=require('../../config/utils');var config=require(_0x3338('0x12'));var licenseUtil=require(_0x3338('0x13'));var db=require(_0x3338('0x14'))['db'];function respondWithStatusCode(_0x2da232,_0x2b7111){_0x2b7111=_0x2b7111||0xcc;return function(_0x7ecbe0){if(_0x7ecbe0){return _0x2da232[_0x3338('0x15')](_0x2b7111);}return _0x2da232[_0x3338('0x16')](_0x2b7111)[_0x3338('0x17')]();};}function respondWithResult(_0x59984d,_0x308f70){_0x308f70=_0x308f70||0xc8;return function(_0x270d2d){if(_0x270d2d){return _0x59984d[_0x3338('0x16')](_0x308f70)[_0x3338('0x18')](_0x270d2d);}};}function respondWithFilteredResult(_0x14f38c,_0x3639d7){return function(_0x7d79c6){if(_0x7d79c6){var _0x2abc92=typeof _0x3639d7[_0x3338('0x19')]==='undefined'&&typeof _0x3639d7[_0x3338('0x1a')]===_0x3338('0x1b');var _0x47bb9a=_0x7d79c6[_0x3338('0x1c')];var _0xb67e7=_0x2abc92?0x0:_0x3639d7[_0x3338('0x19')];var _0x1cdd4d=_0x2abc92?_0x7d79c6[_0x3338('0x1c')]:_0x3639d7[_0x3338('0x19')]+_0x3639d7[_0x3338('0x1a')];var _0x5a9c54;if(_0x1cdd4d>=_0x47bb9a){_0x1cdd4d=_0x47bb9a;_0x5a9c54=0xc8;}else{_0x5a9c54=0xce;}_0x14f38c[_0x3338('0x16')](_0x5a9c54);return _0x14f38c[_0x3338('0x1d')](_0x3338('0x1e'),_0xb67e7+'-'+_0x1cdd4d+'/'+_0x47bb9a)['json'](_0x7d79c6);}return null;};}function patchUpdates(_0x5affd6){return function(_0x35804b){try{jsonpatch[_0x3338('0x1f')](_0x35804b,_0x5affd6,!![]);}catch(_0xd36d68){return BPromise[_0x3338('0x20')](_0xd36d68);}return _0x35804b['save']();};}function saveUpdates(_0x1e1578,_0xedfe31){return function(_0x533632){if(_0x533632){return _0x533632['update'](_0x1e1578)[_0x3338('0x21')](function(_0x1eec35){return _0x1eec35;});}return null;};}function removeEntity(_0x3030e0,_0x283748){return function(_0x28f7ee){if(_0x28f7ee){return _0x28f7ee[_0x3338('0x22')]()[_0x3338('0x21')](function(){_0x3030e0['status'](0xcc)[_0x3338('0x17')]();});}};}function handleEntityNotFound(_0x383311,_0x143977){return function(_0x5a553a){if(!_0x5a553a){_0x383311[_0x3338('0x15')](0x194);}return _0x5a553a;};}function handleError(_0xa1ac3d,_0xc1ae84){_0xc1ae84=_0xc1ae84||0x1f4;return function(_0x168aa5){logger[_0x3338('0x23')](_0x168aa5[_0x3338('0x24')]);if(_0x168aa5['name']){delete _0x168aa5[_0x3338('0x25')];}_0xa1ac3d['status'](_0xc1ae84)[_0x3338('0x26')](_0x168aa5);};}exports[_0x3338('0x27')]=function(_0x543622,_0x30eddf){var _0x2b94f4={},_0x2967ea={},_0x2646c2={'count':0x0,'rows':[]};var _0x4b34d9=_[_0x3338('0x28')](db[_0x3338('0x29')]['rawAttributes'],function(_0x3a622a){return{'name':_0x3a622a['fieldName'],'type':_0x3a622a[_0x3338('0x2a')][_0x3338('0x2b')]};});_0x2967ea['model']=_[_0x3338('0x28')](_0x4b34d9,_0x3338('0x25'));_0x2967ea[_0x3338('0x2c')]=_[_0x3338('0x2d')](_0x543622[_0x3338('0x2c')]);_0x2967ea[_0x3338('0x2e')]=_[_0x3338('0x2f')](_0x2967ea[_0x3338('0x30')],_0x2967ea['query']);_0x2b94f4[_0x3338('0x31')]=_[_0x3338('0x2f')](_0x2967ea[_0x3338('0x30')],qs[_0x3338('0x32')](_0x543622[_0x3338('0x2c')][_0x3338('0x32')]));_0x2b94f4[_0x3338('0x31')]=_0x2b94f4[_0x3338('0x31')][_0x3338('0x33')]?_0x2b94f4[_0x3338('0x31')]:_0x2967ea[_0x3338('0x30')];if(!_0x543622['query']['hasOwnProperty'](_0x3338('0x34'))){_0x2b94f4['limit']=qs[_0x3338('0x1a')](_0x543622[_0x3338('0x2c')][_0x3338('0x1a')]);_0x2b94f4[_0x3338('0x19')]=qs[_0x3338('0x19')](_0x543622[_0x3338('0x2c')][_0x3338('0x19')]);}_0x2b94f4[_0x3338('0x35')]=qs[_0x3338('0x36')](_0x543622[_0x3338('0x2c')][_0x3338('0x36')]);_0x2b94f4[_0x3338('0x37')]=qs[_0x3338('0x2e')](_[_0x3338('0x38')](_0x543622[_0x3338('0x2c')],_0x2967ea['filters']),_0x4b34d9);if(_0x543622[_0x3338('0x2c')][_0x3338('0x39')]){_0x2b94f4[_0x3338('0x37')]=_[_0x3338('0x3a')](_0x2b94f4['where'],{'$or':_[_0x3338('0x28')](_0x4b34d9,function(_0xb70552){if(_0xb70552[_0x3338('0x2a')]!==_0x3338('0x3b')){var _0x27ff67={};_0x27ff67[_0xb70552[_0x3338('0x25')]]={'$like':'%'+_0x543622[_0x3338('0x2c')][_0x3338('0x39')]+'%'};return _0x27ff67;}})});}_0x2b94f4=_[_0x3338('0x3a')]({},_0x2b94f4,_0x543622[_0x3338('0x3c')]);var _0xd6c7ba={'where':_0x2b94f4[_0x3338('0x37')]};return db['MailServerOut'][_0x3338('0x1c')](_0xd6c7ba)[_0x3338('0x21')](function(_0x22181f){_0x2646c2[_0x3338('0x1c')]=_0x22181f;if(_0x543622[_0x3338('0x2c')][_0x3338('0x3d')]){_0x2b94f4[_0x3338('0x3e')]=[{'all':!![]}];}return db[_0x3338('0x29')][_0x3338('0x3f')](_0x2b94f4);})[_0x3338('0x21')](function(_0x4c0117){_0x2646c2[_0x3338('0x40')]=_0x4c0117;return _0x2646c2;})[_0x3338('0x21')](respondWithFilteredResult(_0x30eddf,_0x2b94f4))[_0x3338('0x41')](handleError(_0x30eddf,null));};exports[_0x3338('0x42')]=function(_0x2f60d7,_0x51bf1e){var _0x3474cc={'raw':!![],'where':{'id':_0x2f60d7[_0x3338('0x43')]['id']}},_0x1fcaff={};_0x1fcaff[_0x3338('0x30')]=_[_0x3338('0x2d')](db[_0x3338('0x29')][_0x3338('0x44')]);_0x1fcaff[_0x3338('0x2c')]=_['keys'](_0x2f60d7['query']);_0x1fcaff['filters']=_[_0x3338('0x2f')](_0x1fcaff[_0x3338('0x30')],_0x1fcaff['query']);_0x3474cc[_0x3338('0x31')]=_['intersection'](_0x1fcaff[_0x3338('0x30')],qs[_0x3338('0x32')](_0x2f60d7[_0x3338('0x2c')][_0x3338('0x32')]));_0x3474cc[_0x3338('0x31')]=_0x3474cc[_0x3338('0x31')][_0x3338('0x33')]?_0x3474cc['attributes']:_0x1fcaff[_0x3338('0x30')];if(_0x2f60d7['query'][_0x3338('0x3d')]){_0x3474cc['include']=[{'all':!![]}];}_0x3474cc=_[_0x3338('0x3a')]({},_0x3474cc,_0x2f60d7[_0x3338('0x3c')]);return db['MailServerOut'][_0x3338('0x45')](_0x3474cc)[_0x3338('0x21')](handleEntityNotFound(_0x51bf1e,null))[_0x3338('0x21')](respondWithResult(_0x51bf1e,null))[_0x3338('0x41')](handleError(_0x51bf1e,null));};exports[_0x3338('0x46')]=function(_0x352864,_0x5b4f11){return db[_0x3338('0x29')][_0x3338('0x46')](_0x352864[_0x3338('0x47')],{})[_0x3338('0x21')](respondWithResult(_0x5b4f11,0xc9))[_0x3338('0x41')](handleError(_0x5b4f11,null));};exports['update']=function(_0x72772a,_0x567dae){if(_0x72772a['body']['id']){delete _0x72772a[_0x3338('0x47')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x72772a['params']['id']}})[_0x3338('0x21')](handleEntityNotFound(_0x567dae,null))[_0x3338('0x21')](saveUpdates(_0x72772a[_0x3338('0x47')],null))['then'](respondWithResult(_0x567dae,null))[_0x3338('0x41')](handleError(_0x567dae,null));};exports[_0x3338('0x22')]=function(_0x23bcb4,_0x9ba839){return db[_0x3338('0x29')][_0x3338('0x45')]({'where':{'id':_0x23bcb4['params']['id']}})[_0x3338('0x21')](handleEntityNotFound(_0x9ba839,null))[_0x3338('0x21')](removeEntity(_0x9ba839,null))[_0x3338('0x41')](handleError(_0x9ba839,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4af1fd9..89a7e14 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 _0x41da=['bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash','util','moment'];(function(_0x4cc69a,_0x34d672){var _0x4d5958=function(_0x33662f){while(--_0x33662f){_0x4cc69a['push'](_0x4cc69a['shift']());}};_0x4d5958(++_0x34d672);}(_0x41da,0x197));var _0xa41d=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x41da[_0x12254f];return _0x3a4fa2;};'use strict';var _=require(_0xa41d('0x0'));var util=require(_0xa41d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa41d('0x2'));var BPromise=require(_0xa41d('0x3'));var rp=require(_0xa41d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa41d('0x5'));var config=require(_0xa41d('0x6'));var attributes=require(_0xa41d('0x7'));module['exports']=function(_0x14bf4c,_0x3a53e8){return _0x14bf4c[_0xa41d('0x8')](_0xa41d('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd94b=['moment','path','rimraf','../../config/environment','define','MailServerOut','lodash','util','api'];(function(_0x1194e1,_0x25817a){var _0x54b5bc=function(_0x1ced2e){while(--_0x1ced2e){_0x1194e1['push'](_0x1194e1['shift']());}};_0x54b5bc(++_0x25817a);}(_0xd94b,0xa8));var _0xbd94=function(_0x54b45c,_0xbfb39b){_0x54b45c=_0x54b45c-0x0;var _0x101941=_0xd94b[_0x54b45c];return _0x101941;};'use strict';var _=require(_0xbd94('0x0'));var util=require(_0xbd94('0x1'));var logger=require('../../config/logger')(_0xbd94('0x2'));var moment=require(_0xbd94('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd94('0x4'));var rimraf=require(_0xbd94('0x5'));var config=require(_0xbd94('0x6'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x599628,_0x54328a){return _0x599628[_0xbd94('0x7')](_0xbd94('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 1e78bbf..be06a52 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x559e63,_0x4bdcc1){var _0x2111c7=function(_0x20cbff){while(--_0x20cbff){_0x559e63['push'](_0x559e63['shift']());}};_0x2111c7(++_0x4bdcc1);}(_0xdb28,0x106));var _0x8db2=function(_0x2fbe0b,_0x13d402){_0x2fbe0b=_0x2fbe0b-0x0;var _0x28d913=_0xdb28[_0x2fbe0b];return _0x28d913;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x48d133,_0xecfe43){var _0x33758=function(_0x310752){while(--_0x310752){_0x48d133['push'](_0x48d133['shift']());}};_0x33758(++_0xecfe43);}(_0xadb5,0xad));var _0x5adb=function(_0x57643c,_0x1f2cb6){_0x57643c=_0x57643c-0x0;var _0xcf8038=_0xadb5[_0x57643c];return _0xcf8038;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b5e322f..070e276 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 _0x58dc=['../../config/environment','./mailSubstatus.controller','get','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x422ec1,_0x1e8e94){var _0x5bc1b5=function(_0x2e4d24){while(--_0x2e4d24){_0x422ec1['push'](_0x422ec1['shift']());}};_0x5bc1b5(++_0x1e8e94);}(_0x58dc,0x189));var _0xc58d=function(_0x577270,_0x259e6f){_0x577270=_0x577270-0x0;var _0x17b5c2=_0x58dc[_0x577270];return _0x17b5c2;};'use strict';var multer=require(_0xc58d('0x0'));var util=require('util');var path=require(_0xc58d('0x1'));var timeout=require(_0xc58d('0x2'));var express=require(_0xc58d('0x3'));var router=express[_0xc58d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc58d('0x5'));var config=require(_0xc58d('0x6'));var controller=require(_0xc58d('0x7'));router[_0xc58d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc58d('0x9')]);router[_0xc58d('0x8')](_0xc58d('0xa'),auth[_0xc58d('0xb')](),controller[_0xc58d('0xc')]);router[_0xc58d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc58d('0xe')](_0xc58d('0xa'),auth['isAuthenticated'](),controller[_0xc58d('0xf')]);router[_0xc58d('0x10')](_0xc58d('0xa'),auth[_0xc58d('0xb')](),controller[_0xc58d('0x11')]);module[_0xc58d('0x12')]=router; \ No newline at end of file +var _0x8b77=['/describe','describe','/:id','post','isAuthenticated','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get'];(function(_0x1d130d,_0xe7024c){var _0x1ea9eb=function(_0x262aae){while(--_0x262aae){_0x1d130d['push'](_0x1d130d['shift']());}};_0x1ea9eb(++_0xe7024c);}(_0x8b77,0x1b8));var _0x78b7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8b77[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x78b7('0x0'));var util=require(_0x78b7('0x1'));var path=require(_0x78b7('0x2'));var timeout=require(_0x78b7('0x3'));var express=require(_0x78b7('0x4'));var router=express[_0x78b7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x78b7('0x6'));var interaction=require(_0x78b7('0x7'));var config=require('../../config/environment');var controller=require(_0x78b7('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x78b7('0x9')](_0x78b7('0xa'),auth['isAuthenticated'](),controller[_0x78b7('0xb')]);router[_0x78b7('0x9')](_0x78b7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x78b7('0xd')]('/',auth[_0x78b7('0xe')](),controller[_0x78b7('0xf')]);router['put'](_0x78b7('0xc'),auth[_0x78b7('0xe')](),controller[_0x78b7('0x10')]);router[_0x78b7('0x11')](_0x78b7('0xc'),auth[_0x78b7('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index d0a3367..8980505 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 _0x323f=['name','STRING','exports'];(function(_0x2d5a8e,_0x333734){var _0x3d97f8=function(_0x41b763){while(--_0x41b763){_0x2d5a8e['push'](_0x2d5a8e['shift']());}};_0x3d97f8(++_0x333734);}(_0x323f,0x1ee));var _0xf323=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x323f[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module[_0xf323('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf323('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf323('0x2')]}}; \ No newline at end of file +var _0x6c45=['STRING','sequelize','exports','name'];(function(_0x50f02f,_0x3f303a){var _0x1127c7=function(_0xddaece){while(--_0xddaece){_0x50f02f['push'](_0x50f02f['shift']());}};_0x1127c7(++_0x3f303a);}(_0x6c45,0xb1));var _0x56c4=function(_0x592f81,_0xec6e7c){_0x592f81=_0x592f81-0x0;var _0x1d4a96=_0x6c45[_0x592f81];return _0x1d4a96;};'use strict';var Sequelize=require(_0x56c4('0x0'));module[_0x56c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x56c4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x56c4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a00551b..3b6929a 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 _0x37b2=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','MailSubstatus','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','length','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0xe8fcff,_0x401bd0){var _0x1d228c=function(_0x499537){while(--_0x499537){_0xe8fcff['push'](_0xe8fcff['shift']());}};_0x1d228c(++_0x401bd0);}(_0x37b2,0x166));var _0x237b=function(_0x3ff598,_0x37e3a2){_0x3ff598=_0x3ff598-0x0;var _0x2fe97b=_0x37b2[_0x3ff598];return _0x2fe97b;};'use strict';var emlformat=require(_0x237b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x237b('0x1'));var jsonpatch=require(_0x237b('0x2'));var rp=require('request-promise');var moment=require(_0x237b('0x3'));var BPromise=require(_0x237b('0x4'));var Mustache=require(_0x237b('0x5'));var util=require(_0x237b('0x6'));var path=require(_0x237b('0x7'));var sox=require(_0x237b('0x8'));var csv=require(_0x237b('0x9'));var ejs=require(_0x237b('0xa'));var fs=require('fs');var fs_extra=require(_0x237b('0xb'));var _=require('lodash');var squel=require(_0x237b('0xc'));var crypto=require(_0x237b('0xd'));var jsforce=require(_0x237b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x237b('0x9'));var querystring=require(_0x237b('0xf'));var Papa=require(_0x237b('0x10'));var Redis=require(_0x237b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x237b('0x12'));var hardwareService=require(_0x237b('0x13'));var logger=require('../../config/logger')(_0x237b('0x14'));var utils=require(_0x237b('0x15'));var config=require(_0x237b('0x16'));var licenseUtil=require(_0x237b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f5df,_0xc001d9){_0xc001d9=_0xc001d9||0xcc;return function(_0x53ab20){if(_0x53ab20){return _0x43f5df[_0x237b('0x18')](_0xc001d9);}return _0x43f5df[_0x237b('0x19')](_0xc001d9)['end']();};}function respondWithResult(_0x1429cb,_0x141f4a){_0x141f4a=_0x141f4a||0xc8;return function(_0x173811){if(_0x173811){return _0x1429cb[_0x237b('0x19')](_0x141f4a)[_0x237b('0x1a')](_0x173811);}};}function respondWithFilteredResult(_0x5e0241,_0x1d0c96){return function(_0x364d1c){if(_0x364d1c){var _0x564de2=typeof _0x1d0c96[_0x237b('0x1b')]===_0x237b('0x1c')&&typeof _0x1d0c96['limit']===_0x237b('0x1c');var _0x22e4bf=_0x364d1c[_0x237b('0x1d')];var _0x4b7824=_0x564de2?0x0:_0x1d0c96[_0x237b('0x1b')];var _0x2f5c85=_0x564de2?_0x364d1c[_0x237b('0x1d')]:_0x1d0c96[_0x237b('0x1b')]+_0x1d0c96[_0x237b('0x1e')];var _0x172b9d;if(_0x2f5c85>=_0x22e4bf){_0x2f5c85=_0x22e4bf;_0x172b9d=0xc8;}else{_0x172b9d=0xce;}_0x5e0241['status'](_0x172b9d);return _0x5e0241['set'](_0x237b('0x1f'),_0x4b7824+'-'+_0x2f5c85+'/'+_0x22e4bf)['json'](_0x364d1c);}return null;};}function patchUpdates(_0x265646){return function(_0x211987){try{jsonpatch[_0x237b('0x20')](_0x211987,_0x265646,!![]);}catch(_0x5f4b0d){return BPromise[_0x237b('0x21')](_0x5f4b0d);}return _0x211987[_0x237b('0x22')]();};}function saveUpdates(_0x2da520,_0x22cbb7){return function(_0x1431ff){if(_0x1431ff){return _0x1431ff[_0x237b('0x23')](_0x2da520)[_0x237b('0x24')](function(_0x5841f5){return _0x5841f5;});}return null;};}function removeEntity(_0x3ac56c,_0x1b476f){return function(_0x54c7d0){if(_0x54c7d0){return _0x54c7d0[_0x237b('0x25')]()['then'](function(){_0x3ac56c['status'](0xcc)[_0x237b('0x26')]();});}};}function handleEntityNotFound(_0x4c57ed,_0x2dc683){return function(_0x491b51){if(!_0x491b51){_0x4c57ed[_0x237b('0x18')](0x194);}return _0x491b51;};}function handleError(_0x388696,_0x5146ff){_0x5146ff=_0x5146ff||0x1f4;return function(_0x5cde30){logger['error'](_0x5cde30[_0x237b('0x27')]);if(_0x5cde30[_0x237b('0x28')]){delete _0x5cde30[_0x237b('0x28')];}_0x388696[_0x237b('0x19')](_0x5146ff)[_0x237b('0x29')](_0x5cde30);};}exports['index']=function(_0x11a0ff,_0x21b735){var _0x143238={},_0x2f0b3f={},_0x3e75eb={'count':0x0,'rows':[]};var _0x2e8ee9=_[_0x237b('0x2a')](db[_0x237b('0x2b')][_0x237b('0x2c')],function(_0x4ad8f0){return{'name':_0x4ad8f0['fieldName'],'type':_0x4ad8f0[_0x237b('0x2d')][_0x237b('0x2e')]};});_0x2f0b3f['model']=_[_0x237b('0x2a')](_0x2e8ee9,'name');_0x2f0b3f[_0x237b('0x2f')]=_[_0x237b('0x30')](_0x11a0ff['query']);_0x2f0b3f[_0x237b('0x31')]=_[_0x237b('0x32')](_0x2f0b3f[_0x237b('0x33')],_0x2f0b3f[_0x237b('0x2f')]);_0x143238[_0x237b('0x34')]=_['intersection'](_0x2f0b3f['model'],qs[_0x237b('0x35')](_0x11a0ff[_0x237b('0x2f')][_0x237b('0x35')]));_0x143238[_0x237b('0x34')]=_0x143238['attributes']['length']?_0x143238[_0x237b('0x34')]:_0x2f0b3f[_0x237b('0x33')];if(!_0x11a0ff['query'][_0x237b('0x36')]('nolimit')){_0x143238[_0x237b('0x1e')]=qs[_0x237b('0x1e')](_0x11a0ff['query'][_0x237b('0x1e')]);_0x143238[_0x237b('0x1b')]=qs[_0x237b('0x1b')](_0x11a0ff[_0x237b('0x2f')][_0x237b('0x1b')]);}_0x143238[_0x237b('0x37')]=qs['sort'](_0x11a0ff[_0x237b('0x2f')][_0x237b('0x38')]);_0x143238[_0x237b('0x39')]=qs[_0x237b('0x31')](_[_0x237b('0x3a')](_0x11a0ff[_0x237b('0x2f')],_0x2f0b3f[_0x237b('0x31')]),_0x2e8ee9);if(_0x11a0ff[_0x237b('0x2f')]['filter']){_0x143238[_0x237b('0x39')]=_[_0x237b('0x3b')](_0x143238[_0x237b('0x39')],{'$or':_[_0x237b('0x2a')](_0x2e8ee9,function(_0x4fac5a){if(_0x4fac5a[_0x237b('0x2d')]!==_0x237b('0x3c')){var _0x1a9b3c={};_0x1a9b3c[_0x4fac5a[_0x237b('0x28')]]={'$like':'%'+_0x11a0ff[_0x237b('0x2f')][_0x237b('0x3d')]+'%'};return _0x1a9b3c;}})});}_0x143238=_[_0x237b('0x3b')]({},_0x143238,_0x11a0ff[_0x237b('0x3e')]);var _0x4478d5={'where':_0x143238['where']};return db[_0x237b('0x2b')]['count'](_0x4478d5)[_0x237b('0x24')](function(_0x2d0f43){_0x3e75eb[_0x237b('0x1d')]=_0x2d0f43;if(_0x11a0ff[_0x237b('0x2f')]['includeAll']){_0x143238[_0x237b('0x3f')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x143238);})[_0x237b('0x24')](function(_0x113b5e){_0x3e75eb[_0x237b('0x40')]=_0x113b5e;return _0x3e75eb;})[_0x237b('0x24')](respondWithFilteredResult(_0x21b735,_0x143238))['catch'](handleError(_0x21b735,null));};exports[_0x237b('0x41')]=function(_0x41eee7,_0x264af3){var _0x4a1009={'raw':!![],'where':{'id':_0x41eee7[_0x237b('0x42')]['id']}},_0x248500={};_0x248500[_0x237b('0x33')]=_[_0x237b('0x30')](db[_0x237b('0x2b')][_0x237b('0x2c')]);_0x248500['query']=_[_0x237b('0x30')](_0x41eee7[_0x237b('0x2f')]);_0x248500['filters']=_[_0x237b('0x32')](_0x248500[_0x237b('0x33')],_0x248500[_0x237b('0x2f')]);_0x4a1009[_0x237b('0x34')]=_[_0x237b('0x32')](_0x248500[_0x237b('0x33')],qs[_0x237b('0x35')](_0x41eee7[_0x237b('0x2f')]['fields']));_0x4a1009[_0x237b('0x34')]=_0x4a1009['attributes'][_0x237b('0x43')]?_0x4a1009[_0x237b('0x34')]:_0x248500[_0x237b('0x33')];if(_0x41eee7['query']['includeAll']){_0x4a1009[_0x237b('0x3f')]=[{'all':!![]}];}_0x4a1009=_[_0x237b('0x3b')]({},_0x4a1009,_0x41eee7[_0x237b('0x3e')]);return db[_0x237b('0x2b')][_0x237b('0x44')](_0x4a1009)[_0x237b('0x24')](handleEntityNotFound(_0x264af3,null))[_0x237b('0x24')](respondWithResult(_0x264af3,null))['catch'](handleError(_0x264af3,null));};exports['create']=function(_0x7b917c,_0xa87786){return db[_0x237b('0x2b')][_0x237b('0x45')](_0x7b917c[_0x237b('0x46')],{})[_0x237b('0x24')](respondWithResult(_0xa87786,0xc9))[_0x237b('0x47')](handleError(_0xa87786,null));};exports['update']=function(_0x36f0ed,_0x12fa2a){if(_0x36f0ed['body']['id']){delete _0x36f0ed[_0x237b('0x46')]['id'];}return db[_0x237b('0x2b')][_0x237b('0x44')]({'where':{'id':_0x36f0ed[_0x237b('0x42')]['id']}})[_0x237b('0x24')](handleEntityNotFound(_0x12fa2a,null))['then'](saveUpdates(_0x36f0ed[_0x237b('0x46')],null))[_0x237b('0x24')](respondWithResult(_0x12fa2a,null))['catch'](handleError(_0x12fa2a,null));};exports[_0x237b('0x25')]=function(_0x4bcd4f,_0x579a80){return db[_0x237b('0x2b')]['find']({'where':{'id':_0x4bcd4f[_0x237b('0x42')]['id']}})[_0x237b('0x24')](handleEntityNotFound(_0x579a80,null))['then'](removeEntity(_0x579a80,null))[_0x237b('0x47')](handleError(_0x579a80,null));};exports[_0x237b('0x48')]=function(_0x69e160,_0x41b5ca){return db[_0x237b('0x2b')][_0x237b('0x48')]()['then'](respondWithResult(_0x41b5ca,null))[_0x237b('0x47')](handleError(_0x41b5ca,null));}; \ No newline at end of file +var _0xf894=['rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','MailSubstatus'];(function(_0x6a49c8,_0x535aba){var _0x5ca51d=function(_0x1048d4){while(--_0x1048d4){_0x6a49c8['push'](_0x6a49c8['shift']());}};_0x5ca51d(++_0x535aba);}(_0xf894,0x1e0));var _0x4f89=function(_0x586f5a,_0x25c459){_0x586f5a=_0x586f5a-0x0;var _0x2830ea=_0xf894[_0x586f5a];return _0x2830ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f89('0x0'));var zipdir=require(_0x4f89('0x1'));var jsonpatch=require(_0x4f89('0x2'));var rp=require(_0x4f89('0x3'));var moment=require(_0x4f89('0x4'));var BPromise=require(_0x4f89('0x5'));var Mustache=require(_0x4f89('0x6'));var util=require(_0x4f89('0x7'));var path=require(_0x4f89('0x8'));var sox=require('sox');var csv=require(_0x4f89('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f89('0xa'));var _=require(_0x4f89('0xb'));var squel=require(_0x4f89('0xc'));var crypto=require(_0x4f89('0xd'));var jsforce=require(_0x4f89('0xe'));var deskjs=require(_0x4f89('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f89('0x10'));var Papa=require('papaparse');var Redis=require(_0x4f89('0x11'));var authService=require(_0x4f89('0x12'));var qs=require(_0x4f89('0x13'));var as=require(_0x4f89('0x14'));var hardwareService=require(_0x4f89('0x15'));var logger=require('../../config/logger')(_0x4f89('0x16'));var utils=require('../../config/utils');var config=require(_0x4f89('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f89('0x18'))['db'];function respondWithStatusCode(_0x3dec78,_0x433f02){_0x433f02=_0x433f02||0xcc;return function(_0x3ec092){if(_0x3ec092){return _0x3dec78[_0x4f89('0x19')](_0x433f02);}return _0x3dec78[_0x4f89('0x1a')](_0x433f02)[_0x4f89('0x1b')]();};}function respondWithResult(_0x581d33,_0x5966c9){_0x5966c9=_0x5966c9||0xc8;return function(_0x438c27){if(_0x438c27){return _0x581d33[_0x4f89('0x1a')](_0x5966c9)['json'](_0x438c27);}};}function respondWithFilteredResult(_0x232b59,_0x1b0e1e){return function(_0x3ff179){if(_0x3ff179){var _0x5d7680=typeof _0x1b0e1e['offset']===_0x4f89('0x1c')&&typeof _0x1b0e1e[_0x4f89('0x1d')]==='undefined';var _0x4d9420=_0x3ff179[_0x4f89('0x1e')];var _0x4feccf=_0x5d7680?0x0:_0x1b0e1e[_0x4f89('0x1f')];var _0x2d2ff1=_0x5d7680?_0x3ff179[_0x4f89('0x1e')]:_0x1b0e1e[_0x4f89('0x1f')]+_0x1b0e1e[_0x4f89('0x1d')];var _0x3d3d;if(_0x2d2ff1>=_0x4d9420){_0x2d2ff1=_0x4d9420;_0x3d3d=0xc8;}else{_0x3d3d=0xce;}_0x232b59[_0x4f89('0x1a')](_0x3d3d);return _0x232b59[_0x4f89('0x20')](_0x4f89('0x21'),_0x4feccf+'-'+_0x2d2ff1+'/'+_0x4d9420)['json'](_0x3ff179);}return null;};}function patchUpdates(_0x21a112){return function(_0x54a0b5){try{jsonpatch['apply'](_0x54a0b5,_0x21a112,!![]);}catch(_0x32a641){return BPromise[_0x4f89('0x22')](_0x32a641);}return _0x54a0b5[_0x4f89('0x23')]();};}function saveUpdates(_0x56c279,_0x47ad0b){return function(_0x40b72b){if(_0x40b72b){return _0x40b72b[_0x4f89('0x24')](_0x56c279)['then'](function(_0x347ba8){return _0x347ba8;});}return null;};}function removeEntity(_0x2b51ab,_0x3e6896){return function(_0x4b7f62){if(_0x4b7f62){return _0x4b7f62[_0x4f89('0x25')]()[_0x4f89('0x26')](function(){_0x2b51ab[_0x4f89('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33a8c7,_0x5d1565){return function(_0x341f75){if(!_0x341f75){_0x33a8c7[_0x4f89('0x19')](0x194);}return _0x341f75;};}function handleError(_0xea6f57,_0x50fbf7){_0x50fbf7=_0x50fbf7||0x1f4;return function(_0x161532){logger[_0x4f89('0x27')](_0x161532['stack']);if(_0x161532[_0x4f89('0x28')]){delete _0x161532[_0x4f89('0x28')];}_0xea6f57[_0x4f89('0x1a')](_0x50fbf7)[_0x4f89('0x29')](_0x161532);};}exports[_0x4f89('0x2a')]=function(_0xc35d5c,_0x393390){var _0x34fd4a={},_0x5c57f5={},_0x33fa11={'count':0x0,'rows':[]};var _0x119897=_[_0x4f89('0x2b')](db[_0x4f89('0x2c')][_0x4f89('0x2d')],function(_0x392306){return{'name':_0x392306['fieldName'],'type':_0x392306['type'][_0x4f89('0x2e')]};});_0x5c57f5[_0x4f89('0x2f')]=_[_0x4f89('0x2b')](_0x119897,_0x4f89('0x28'));_0x5c57f5[_0x4f89('0x30')]=_[_0x4f89('0x31')](_0xc35d5c[_0x4f89('0x30')]);_0x5c57f5[_0x4f89('0x32')]=_['intersection'](_0x5c57f5['model'],_0x5c57f5[_0x4f89('0x30')]);_0x34fd4a[_0x4f89('0x33')]=_[_0x4f89('0x34')](_0x5c57f5[_0x4f89('0x2f')],qs[_0x4f89('0x35')](_0xc35d5c[_0x4f89('0x30')][_0x4f89('0x35')]));_0x34fd4a['attributes']=_0x34fd4a['attributes'][_0x4f89('0x36')]?_0x34fd4a[_0x4f89('0x33')]:_0x5c57f5[_0x4f89('0x2f')];if(!_0xc35d5c[_0x4f89('0x30')][_0x4f89('0x37')]('nolimit')){_0x34fd4a[_0x4f89('0x1d')]=qs[_0x4f89('0x1d')](_0xc35d5c[_0x4f89('0x30')]['limit']);_0x34fd4a[_0x4f89('0x1f')]=qs[_0x4f89('0x1f')](_0xc35d5c[_0x4f89('0x30')][_0x4f89('0x1f')]);}_0x34fd4a[_0x4f89('0x38')]=qs[_0x4f89('0x39')](_0xc35d5c['query']['sort']);_0x34fd4a[_0x4f89('0x3a')]=qs['filters'](_[_0x4f89('0x3b')](_0xc35d5c[_0x4f89('0x30')],_0x5c57f5['filters']),_0x119897);if(_0xc35d5c[_0x4f89('0x30')][_0x4f89('0x3c')]){_0x34fd4a[_0x4f89('0x3a')]=_[_0x4f89('0x3d')](_0x34fd4a[_0x4f89('0x3a')],{'$or':_[_0x4f89('0x2b')](_0x119897,function(_0x415616){if(_0x415616[_0x4f89('0x3e')]!=='VIRTUAL'){var _0x3997a9={};_0x3997a9[_0x415616[_0x4f89('0x28')]]={'$like':'%'+_0xc35d5c[_0x4f89('0x30')][_0x4f89('0x3c')]+'%'};return _0x3997a9;}})});}_0x34fd4a=_['merge']({},_0x34fd4a,_0xc35d5c[_0x4f89('0x3f')]);var _0x5d24ac={'where':_0x34fd4a[_0x4f89('0x3a')]};return db[_0x4f89('0x2c')][_0x4f89('0x1e')](_0x5d24ac)['then'](function(_0xbc1ab9){_0x33fa11['count']=_0xbc1ab9;if(_0xc35d5c['query'][_0x4f89('0x40')]){_0x34fd4a[_0x4f89('0x41')]=[{'all':!![]}];}return db[_0x4f89('0x2c')][_0x4f89('0x42')](_0x34fd4a);})[_0x4f89('0x26')](function(_0x58fd6e){_0x33fa11[_0x4f89('0x43')]=_0x58fd6e;return _0x33fa11;})['then'](respondWithFilteredResult(_0x393390,_0x34fd4a))[_0x4f89('0x44')](handleError(_0x393390,null));};exports[_0x4f89('0x45')]=function(_0x97ae58,_0x1cef5c){var _0x5bd9d2={'raw':!![],'where':{'id':_0x97ae58[_0x4f89('0x46')]['id']}},_0x406db6={};_0x406db6[_0x4f89('0x2f')]=_[_0x4f89('0x31')](db[_0x4f89('0x2c')][_0x4f89('0x2d')]);_0x406db6['query']=_[_0x4f89('0x31')](_0x97ae58[_0x4f89('0x30')]);_0x406db6[_0x4f89('0x32')]=_[_0x4f89('0x34')](_0x406db6['model'],_0x406db6['query']);_0x5bd9d2[_0x4f89('0x33')]=_[_0x4f89('0x34')](_0x406db6[_0x4f89('0x2f')],qs[_0x4f89('0x35')](_0x97ae58[_0x4f89('0x30')]['fields']));_0x5bd9d2[_0x4f89('0x33')]=_0x5bd9d2[_0x4f89('0x33')]['length']?_0x5bd9d2[_0x4f89('0x33')]:_0x406db6[_0x4f89('0x2f')];if(_0x97ae58['query'][_0x4f89('0x40')]){_0x5bd9d2[_0x4f89('0x41')]=[{'all':!![]}];}_0x5bd9d2=_[_0x4f89('0x3d')]({},_0x5bd9d2,_0x97ae58['options']);return db[_0x4f89('0x2c')]['find'](_0x5bd9d2)[_0x4f89('0x26')](handleEntityNotFound(_0x1cef5c,null))[_0x4f89('0x26')](respondWithResult(_0x1cef5c,null))[_0x4f89('0x44')](handleError(_0x1cef5c,null));};exports[_0x4f89('0x47')]=function(_0x5cebe7,_0x3f0084){return db[_0x4f89('0x2c')][_0x4f89('0x47')](_0x5cebe7[_0x4f89('0x48')],{})[_0x4f89('0x26')](respondWithResult(_0x3f0084,0xc9))[_0x4f89('0x44')](handleError(_0x3f0084,null));};exports[_0x4f89('0x24')]=function(_0x2633a5,_0x3e4600){if(_0x2633a5[_0x4f89('0x48')]['id']){delete _0x2633a5[_0x4f89('0x48')]['id'];}return db[_0x4f89('0x2c')]['find']({'where':{'id':_0x2633a5[_0x4f89('0x46')]['id']}})[_0x4f89('0x26')](handleEntityNotFound(_0x3e4600,null))[_0x4f89('0x26')](saveUpdates(_0x2633a5[_0x4f89('0x48')],null))[_0x4f89('0x26')](respondWithResult(_0x3e4600,null))[_0x4f89('0x44')](handleError(_0x3e4600,null));};exports[_0x4f89('0x25')]=function(_0x1a0950,_0x10e138){return db[_0x4f89('0x2c')][_0x4f89('0x49')]({'where':{'id':_0x1a0950[_0x4f89('0x46')]['id']}})[_0x4f89('0x26')](handleEntityNotFound(_0x10e138,null))[_0x4f89('0x26')](removeEntity(_0x10e138,null))[_0x4f89('0x44')](handleError(_0x10e138,null));};exports[_0x4f89('0x4a')]=function(_0x274bc2,_0x1cc6fd){return db['MailSubstatus'][_0x4f89('0x4a')]()[_0x4f89('0x26')](respondWithResult(_0x1cc6fd,null))[_0x4f89('0x44')](handleError(_0x1cc6fd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 07d5eee..afbfd99 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 _0x8c86=['hasOwnProperty','hook','events','MailSubstatus','update','emit'];(function(_0x28cef5,_0x5ed280){var _0x5b4cf3=function(_0x5530bb){while(--_0x5530bb){_0x28cef5['push'](_0x28cef5['shift']());}};_0x5b4cf3(++_0x5ed280);}(_0x8c86,0x122));var _0x68c8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8c86[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x68c8('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x68c8('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x68c8('0x2')};function emitEvent(_0x29c12c){return function(_0x53ce9a,_0x16af78,_0x1752bf){MailSubstatusEvents['emit'](_0x29c12c+':'+_0x53ce9a['id'],_0x53ce9a);MailSubstatusEvents[_0x68c8('0x3')](_0x29c12c,_0x53ce9a);_0x1752bf(null);};}for(var e in events){if(events[_0x68c8('0x4')](e)){var event=events[e];MailSubstatus[_0x68c8('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xc8a9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc8a9,0x12d));var _0x9c8a=function(_0x5076bc,_0x3ad1e7){_0x5076bc=_0x5076bc-0x0;var _0x1308bd=_0xc8a9[_0x5076bc];return _0x1308bd;};'use strict';var EventEmitter=require(_0x9c8a('0x0'));var MailSubstatus=require(_0x9c8a('0x1'))['db'][_0x9c8a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x9c8a('0x3')](0x0);var events={'afterUpdate':_0x9c8a('0x4')};function emitEvent(_0x4673ef){return function(_0x561534,_0x4778ba,_0xe0e506){MailSubstatusEvents[_0x9c8a('0x5')](_0x4673ef+':'+_0x561534['id'],_0x561534);MailSubstatusEvents['emit'](_0x4673ef,_0x561534);_0xe0e506(null);};}for(var e in events){if(events[_0x9c8a('0x6')](e)){var event=events[e];MailSubstatus[_0x9c8a('0x7')](e,emitEvent(event));}}module[_0x9c8a('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 1654503..09190fb 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 _0x9ddd=['name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','define','mail_substatuses','Condition'];(function(_0x296836,_0x2b6b57){var _0x44b500=function(_0x5eb346){while(--_0x5eb346){_0x296836['push'](_0x296836['shift']());}};_0x44b500(++_0x2b6b57);}(_0x9ddd,0xe5));var _0xd9dd=function(_0xf8e203,_0x3289f6){_0xf8e203=_0xf8e203-0x0;var _0x343f90=_0x9ddd[_0xf8e203];return _0x343f90;};'use strict';var attributes=require(_0xd9dd('0x0'));module[_0xd9dd('0x1')]=function(_0x280dcf){var _0x57e002=_0x280dcf['models'];return _0x280dcf[_0xd9dd('0x2')]('MailSubstatus',attributes,{'tableName':_0xd9dd('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x36458a,_0x234b82,_0x2f5f32){return _0x57e002[_0xd9dd('0x4')]['update']({'value':_0x36458a[_0xd9dd('0x5')]},{'where':{'field':_0xd9dd('0x6'),'value':_0x36458a[_0xd9dd('0x7')]['name']}})[_0xd9dd('0x8')](function(){_0x2f5f32();})['catch'](function(_0xcf038c){_0x2f5f32(_0xcf038c);});}}});}; \ No newline at end of file +var _0xa5d7=['define','MailSubstatus','mail_substatuses','Condition','update','name','_previousDataValues','catch','./mailSubstatus.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5d7,0xf8));var _0x7a5d=function(_0x5b133d,_0x59bd25){_0x5b133d=_0x5b133d-0x0;var _0x379730=_0xa5d7[_0x5b133d];return _0x379730;};'use strict';var attributes=require(_0x7a5d('0x0'));module[_0x7a5d('0x1')]=function(_0x38e249){var _0x83549b=_0x38e249['models'];return _0x38e249[_0x7a5d('0x2')](_0x7a5d('0x3'),attributes,{'tableName':_0x7a5d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x158372,_0x52ce31,_0x29ca80){return _0x83549b[_0x7a5d('0x5')][_0x7a5d('0x6')]({'value':_0x158372[_0x7a5d('0x7')]},{'where':{'field':'mailSubstatus','value':_0x158372[_0x7a5d('0x8')]['name']}})['then'](function(){_0x29ca80();})[_0x7a5d('0x9')](function(_0x4e536d){_0x29ca80(_0x4e536d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c6007c3..944ca7b 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 _0x6bed=['then','info','request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0x56e60b,_0x3c1bdc){var _0x305ce1=function(_0x98659c){while(--_0x98659c){_0x56e60b['push'](_0x56e60b['shift']());}};_0x305ce1(++_0x3c1bdc);}(_0x6bed,0x88));var _0xd6be=function(_0x399cc0,_0x45bc1f){_0x399cc0=_0x399cc0-0x0;var _0x170b21=_0x6bed[_0x399cc0];return _0x170b21;};'use strict';var _=require(_0xd6be('0x0'));var util=require(_0xd6be('0x1'));var moment=require(_0xd6be('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6be('0x3'));var fs=require('fs');var Redis=require(_0xd6be('0x4'));var db=require(_0xd6be('0x5'))['db'];var utils=require(_0xd6be('0x6'));var logger=require('../../config/logger')(_0xd6be('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6be('0x8')][_0xd6be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fe578,_0x19e327,_0xcd0692){return new BPromise(function(_0x4e5ed0,_0x51212e){return client[_0xd6be('0xa')](_0x3fe578,_0xcd0692)[_0xd6be('0xb')](function(_0x299bdf){logger[_0xd6be('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x19e327,_0xd6be('0xd'));logger[_0xd6be('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x19e327,_0xd6be('0xd'),JSON[_0xd6be('0xf')](_0x299bdf));if(_0x299bdf[_0xd6be('0x10')]){if(_0x299bdf[_0xd6be('0x10')][_0xd6be('0x11')]===0x1f4){logger[_0xd6be('0x10')](_0xd6be('0x12'),_0x19e327,_0x299bdf[_0xd6be('0x10')][_0xd6be('0x13')]);return _0x51212e(_0x299bdf['error'][_0xd6be('0x13')]);}logger[_0xd6be('0x10')](_0xd6be('0x12'),_0x19e327,_0x299bdf[_0xd6be('0x10')][_0xd6be('0x13')]);return _0x4e5ed0(_0x299bdf[_0xd6be('0x10')]['message']);}else{logger[_0xd6be('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x19e327,'request\x20sent');_0x4e5ed0(_0x299bdf['result']['message']);}})[_0xd6be('0x14')](function(_0x28cb3e){logger[_0xd6be('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x19e327,_0x28cb3e);_0x51212e(_0x28cb3e);});});} \ No newline at end of file +var _0x268a=['jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xeef2e3,_0x2d3fbd){var _0xff89a8=function(_0x476c6c){while(--_0x476c6c){_0xeef2e3['push'](_0xeef2e3['shift']());}};_0xff89a8(++_0x2d3fbd);}(_0x268a,0xce));var _0xa268=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0x268a[_0x2341c6];return _0x54c34d;};'use strict';var _=require(_0xa268('0x0'));var util=require(_0xa268('0x1'));var moment=require(_0xa268('0x2'));var BPromise=require(_0xa268('0x3'));var rs=require(_0xa268('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa268('0x5'))['db'];var utils=require(_0xa268('0x6'));var logger=require(_0xa268('0x7'))(_0xa268('0x8'));var config=require(_0xa268('0x9'));var jayson=require(_0xa268('0xa'));var client=jayson['client'][_0xa268('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3265c4,_0x3d6bb5,_0xaba16e){return new BPromise(function(_0x10de85,_0x16fa74){return client[_0xa268('0xc')](_0x3265c4,_0xaba16e)[_0xa268('0xd')](function(_0x138c59){logger[_0xa268('0xe')](_0xa268('0xf'),_0x3d6bb5,_0xa268('0x10'));logger[_0xa268('0x11')](_0xa268('0x12'),_0x3d6bb5,_0xa268('0x10'),JSON['stringify'](_0x138c59));if(_0x138c59[_0xa268('0x13')]){if(_0x138c59['error'][_0xa268('0x14')]===0x1f4){logger['error'](_0xa268('0xf'),_0x3d6bb5,_0x138c59[_0xa268('0x13')][_0xa268('0x15')]);return _0x16fa74(_0x138c59[_0xa268('0x13')][_0xa268('0x15')]);}logger[_0xa268('0x13')](_0xa268('0xf'),_0x3d6bb5,_0x138c59[_0xa268('0x13')]['message']);return _0x10de85(_0x138c59[_0xa268('0x13')]['message']);}else{logger[_0xa268('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x3d6bb5,_0xa268('0x10'));_0x10de85(_0x138c59[_0xa268('0x16')][_0xa268('0x15')]);}})[_0xa268('0x17')](function(_0x5ee21a){logger[_0xa268('0x13')](_0xa268('0xf'),_0x3d6bb5,_0x5ee21a);_0x16fa74(_0x5ee21a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e75c49f..9e364b1 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 _0xca18=['./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e0b12,_0x4857d0){var _0x4f22a9=function(_0x362dd9){while(--_0x362dd9){_0x1e0b12['push'](_0x1e0b12['shift']());}};_0x4f22a9(++_0x4857d0);}(_0xca18,0x6a));var _0x8ca1=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0xca18[_0x3474ac];return _0x5345ec;};'use strict';var multer=require(_0x8ca1('0x0'));var util=require(_0x8ca1('0x1'));var path=require('path');var timeout=require(_0x8ca1('0x2'));var express=require(_0x8ca1('0x3'));var router=express[_0x8ca1('0x4')]();var fs_extra=require(_0x8ca1('0x5'));var auth=require(_0x8ca1('0x6'));var interaction=require(_0x8ca1('0x7'));var config=require(_0x8ca1('0x8'));var controller=require(_0x8ca1('0x9'));router[_0x8ca1('0xa')]('/',auth[_0x8ca1('0xb')](),controller['index']);router['get'](_0x8ca1('0xc'),auth[_0x8ca1('0xb')](),controller[_0x8ca1('0xd')]);router[_0x8ca1('0xa')](_0x8ca1('0xe'),auth[_0x8ca1('0xb')](),controller[_0x8ca1('0xf')]);router[_0x8ca1('0x10')]('/',auth['isAuthenticated'](),controller[_0x8ca1('0x11')]);router[_0x8ca1('0x12')]('/:id',auth[_0x8ca1('0xb')](),controller[_0x8ca1('0x13')]);router[_0x8ca1('0x14')](_0x8ca1('0xe'),auth['isAuthenticated'](),controller[_0x8ca1('0x15')]);module[_0x8ca1('0x16')]=router; \ No newline at end of file +var _0x82e3=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./mailTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x5b49c6,_0x46fd1b){var _0x3cc65d=function(_0x47057d){while(--_0x47057d){_0x5b49c6['push'](_0x5b49c6['shift']());}};_0x3cc65d(++_0x46fd1b);}(_0x82e3,0x17f));var _0x382e=function(_0x53bce7,_0x5cf88d){_0x53bce7=_0x53bce7-0x0;var _0x4b824e=_0x82e3[_0x53bce7];return _0x4b824e;};'use strict';var multer=require(_0x382e('0x0'));var util=require(_0x382e('0x1'));var path=require(_0x382e('0x2'));var timeout=require(_0x382e('0x3'));var express=require('express');var router=express[_0x382e('0x4')]();var fs_extra=require(_0x382e('0x5'));var auth=require(_0x382e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x382e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x382e('0x8')]);router[_0x382e('0x9')](_0x382e('0xa'),auth[_0x382e('0xb')](),controller[_0x382e('0xc')]);router[_0x382e('0x9')](_0x382e('0xd'),auth[_0x382e('0xb')](),controller[_0x382e('0xe')]);router[_0x382e('0xf')]('/',auth[_0x382e('0xb')](),controller[_0x382e('0x10')]);router[_0x382e('0x11')](_0x382e('0xd'),auth[_0x382e('0xb')](),controller['update']);router[_0x382e('0x12')]('/:id',auth[_0x382e('0xb')](),controller[_0x382e('0x13')]);module[_0x382e('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 1df0907..e79b28f 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x32e779,_0x1c2596){var _0x47d7b3=function(_0x37c2d8){while(--_0x37c2d8){_0x32e779['push'](_0x32e779['shift']());}};_0x47d7b3(++_0x1c2596);}(_0x54ef,0x112));var _0xf54e=function(_0x501aa1,_0x19aca8){_0x501aa1=_0x501aa1-0x0;var _0x5b76e2=_0x54ef[_0x501aa1];return _0x5b76e2;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x5c660a,_0x4b5262){var _0x3a77a4=function(_0x479c95){while(--_0x479c95){_0x5c660a['push'](_0x5c660a['shift']());}};_0x3a77a4(++_0x4b5262);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 54af8d7..db67fcd 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 _0xe0f4=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','options','includeAll','include','rows','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','MailTransferReport','rawAttributes','fieldName'];(function(_0x5d1b7b,_0x56c35b){var _0x1773bd=function(_0x17fe19){while(--_0x17fe19){_0x5d1b7b['push'](_0x5d1b7b['shift']());}};_0x1773bd(++_0x56c35b);}(_0xe0f4,0x14b));var _0x4e0f=function(_0x5e4277,_0x2d8266){_0x5e4277=_0x5e4277-0x0;var _0x16f32b=_0xe0f4[_0x5e4277];return _0x16f32b;};'use strict';var emlformat=require(_0x4e0f('0x0'));var rimraf=require(_0x4e0f('0x1'));var zipdir=require(_0x4e0f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e0f('0x3'));var moment=require(_0x4e0f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e0f('0x5'));var util=require(_0x4e0f('0x6'));var path=require(_0x4e0f('0x7'));var sox=require('sox');var csv=require(_0x4e0f('0x8'));var ejs=require(_0x4e0f('0x9'));var fs=require('fs');var fs_extra=require(_0x4e0f('0xa'));var _=require(_0x4e0f('0xb'));var squel=require('squel');var crypto=require(_0x4e0f('0xc'));var jsforce=require(_0x4e0f('0xd'));var deskjs=require(_0x4e0f('0xe'));var toCsv=require(_0x4e0f('0x8'));var querystring=require(_0x4e0f('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e0f('0x10'));var authService=require(_0x4e0f('0x11'));var qs=require(_0x4e0f('0x12'));var as=require(_0x4e0f('0x13'));var hardwareService=require(_0x4e0f('0x14'));var logger=require(_0x4e0f('0x15'))(_0x4e0f('0x16'));var utils=require(_0x4e0f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4e0f('0x18'));var db=require(_0x4e0f('0x19'))['db'];function respondWithStatusCode(_0x29d24b,_0x5e326e){_0x5e326e=_0x5e326e||0xcc;return function(_0x280104){if(_0x280104){return _0x29d24b[_0x4e0f('0x1a')](_0x5e326e);}return _0x29d24b[_0x4e0f('0x1b')](_0x5e326e)[_0x4e0f('0x1c')]();};}function respondWithResult(_0x2cfbd5,_0x41b240){_0x41b240=_0x41b240||0xc8;return function(_0x58a683){if(_0x58a683){return _0x2cfbd5[_0x4e0f('0x1b')](_0x41b240)['json'](_0x58a683);}};}function respondWithFilteredResult(_0x412202,_0xa5a9e){return function(_0x472613){if(_0x472613){var _0x1061a6=typeof _0xa5a9e[_0x4e0f('0x1d')]==='undefined'&&typeof _0xa5a9e[_0x4e0f('0x1e')]===_0x4e0f('0x1f');var _0x556f94=_0x472613['count'];var _0x48b3f6=_0x1061a6?0x0:_0xa5a9e[_0x4e0f('0x1d')];var _0x561eb3=_0x1061a6?_0x472613[_0x4e0f('0x20')]:_0xa5a9e[_0x4e0f('0x1d')]+_0xa5a9e[_0x4e0f('0x1e')];var _0x19a1cd;if(_0x561eb3>=_0x556f94){_0x561eb3=_0x556f94;_0x19a1cd=0xc8;}else{_0x19a1cd=0xce;}_0x412202[_0x4e0f('0x1b')](_0x19a1cd);return _0x412202[_0x4e0f('0x21')](_0x4e0f('0x22'),_0x48b3f6+'-'+_0x561eb3+'/'+_0x556f94)[_0x4e0f('0x23')](_0x472613);}return null;};}function patchUpdates(_0x336c6a){return function(_0x3a0948){try{jsonpatch[_0x4e0f('0x24')](_0x3a0948,_0x336c6a,!![]);}catch(_0x1264c0){return BPromise[_0x4e0f('0x25')](_0x1264c0);}return _0x3a0948[_0x4e0f('0x26')]();};}function saveUpdates(_0x5977bc,_0x5d91b8){return function(_0x4ac300){if(_0x4ac300){return _0x4ac300[_0x4e0f('0x27')](_0x5977bc)['then'](function(_0x3f6838){return _0x3f6838;});}return null;};}function removeEntity(_0x15f0ec,_0x47d9fa){return function(_0xebfe03){if(_0xebfe03){return _0xebfe03[_0x4e0f('0x28')]()[_0x4e0f('0x29')](function(){_0x15f0ec[_0x4e0f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44ed0a,_0x4a662c){return function(_0x3fe26a){if(!_0x3fe26a){_0x44ed0a[_0x4e0f('0x1a')](0x194);}return _0x3fe26a;};}function handleError(_0x46613c,_0xe7a04c){_0xe7a04c=_0xe7a04c||0x1f4;return function(_0x87b92b){logger[_0x4e0f('0x2a')](_0x87b92b[_0x4e0f('0x2b')]);if(_0x87b92b['name']){delete _0x87b92b[_0x4e0f('0x2c')];}_0x46613c['status'](_0xe7a04c)['send'](_0x87b92b);};}exports[_0x4e0f('0x2d')]=function(_0x5709dd,_0x517538){var _0x222cd7={},_0x26f1e3={},_0x5a1d19={'count':0x0,'rows':[]};var _0x23a05e=_['map'](db[_0x4e0f('0x2e')][_0x4e0f('0x2f')],function(_0x46f89d){return{'name':_0x46f89d[_0x4e0f('0x30')],'type':_0x46f89d[_0x4e0f('0x31')]['key']};});_0x26f1e3[_0x4e0f('0x32')]=_['map'](_0x23a05e,_0x4e0f('0x2c'));_0x26f1e3[_0x4e0f('0x33')]=_['keys'](_0x5709dd[_0x4e0f('0x33')]);_0x26f1e3[_0x4e0f('0x34')]=_[_0x4e0f('0x35')](_0x26f1e3[_0x4e0f('0x32')],_0x26f1e3[_0x4e0f('0x33')]);_0x222cd7[_0x4e0f('0x36')]=_[_0x4e0f('0x35')](_0x26f1e3[_0x4e0f('0x32')],qs[_0x4e0f('0x37')](_0x5709dd[_0x4e0f('0x33')][_0x4e0f('0x37')]));_0x222cd7[_0x4e0f('0x36')]=_0x222cd7['attributes'][_0x4e0f('0x38')]?_0x222cd7['attributes']:_0x26f1e3[_0x4e0f('0x32')];if(!_0x5709dd[_0x4e0f('0x33')][_0x4e0f('0x39')](_0x4e0f('0x3a'))){_0x222cd7[_0x4e0f('0x1e')]=qs[_0x4e0f('0x1e')](_0x5709dd[_0x4e0f('0x33')][_0x4e0f('0x1e')]);_0x222cd7[_0x4e0f('0x1d')]=qs[_0x4e0f('0x1d')](_0x5709dd[_0x4e0f('0x33')]['offset']);}_0x222cd7[_0x4e0f('0x3b')]=qs['sort'](_0x5709dd[_0x4e0f('0x33')][_0x4e0f('0x3c')]);_0x222cd7['where']=qs[_0x4e0f('0x34')](_['pick'](_0x5709dd[_0x4e0f('0x33')],_0x26f1e3[_0x4e0f('0x34')]),_0x23a05e);if(_0x5709dd[_0x4e0f('0x33')][_0x4e0f('0x3d')]){_0x222cd7[_0x4e0f('0x3e')]=_[_0x4e0f('0x3f')](_0x222cd7[_0x4e0f('0x3e')],{'$or':_[_0x4e0f('0x40')](_0x23a05e,function(_0x3cfd54){if(_0x3cfd54[_0x4e0f('0x31')]!=='VIRTUAL'){var _0x433806={};_0x433806[_0x3cfd54[_0x4e0f('0x2c')]]={'$like':'%'+_0x5709dd[_0x4e0f('0x33')][_0x4e0f('0x3d')]+'%'};return _0x433806;}})});}_0x222cd7=_[_0x4e0f('0x3f')]({},_0x222cd7,_0x5709dd[_0x4e0f('0x41')]);var _0x59e297={'where':_0x222cd7[_0x4e0f('0x3e')]};return db[_0x4e0f('0x2e')][_0x4e0f('0x20')](_0x59e297)['then'](function(_0x477bb0){_0x5a1d19[_0x4e0f('0x20')]=_0x477bb0;if(_0x5709dd[_0x4e0f('0x33')][_0x4e0f('0x42')]){_0x222cd7[_0x4e0f('0x43')]=[{'all':!![]}];}return db[_0x4e0f('0x2e')]['findAll'](_0x222cd7);})[_0x4e0f('0x29')](function(_0x7660bc){_0x5a1d19[_0x4e0f('0x44')]=_0x7660bc;return _0x5a1d19;})[_0x4e0f('0x29')](respondWithFilteredResult(_0x517538,_0x222cd7))['catch'](handleError(_0x517538,null));};exports['show']=function(_0xaacf37,_0x50a681){var _0x34c1f3={'raw':!![],'where':{'id':_0xaacf37[_0x4e0f('0x45')]['id']}},_0x23ace1={};_0x23ace1[_0x4e0f('0x32')]=_[_0x4e0f('0x46')](db[_0x4e0f('0x2e')][_0x4e0f('0x2f')]);_0x23ace1['query']=_[_0x4e0f('0x46')](_0xaacf37[_0x4e0f('0x33')]);_0x23ace1[_0x4e0f('0x34')]=_['intersection'](_0x23ace1[_0x4e0f('0x32')],_0x23ace1[_0x4e0f('0x33')]);_0x34c1f3[_0x4e0f('0x36')]=_[_0x4e0f('0x35')](_0x23ace1[_0x4e0f('0x32')],qs[_0x4e0f('0x37')](_0xaacf37['query']['fields']));_0x34c1f3[_0x4e0f('0x36')]=_0x34c1f3['attributes'][_0x4e0f('0x38')]?_0x34c1f3[_0x4e0f('0x36')]:_0x23ace1[_0x4e0f('0x32')];if(_0xaacf37[_0x4e0f('0x33')][_0x4e0f('0x42')]){_0x34c1f3[_0x4e0f('0x43')]=[{'all':!![]}];}_0x34c1f3=_[_0x4e0f('0x3f')]({},_0x34c1f3,_0xaacf37[_0x4e0f('0x41')]);return db[_0x4e0f('0x2e')][_0x4e0f('0x47')](_0x34c1f3)[_0x4e0f('0x29')](handleEntityNotFound(_0x50a681,null))[_0x4e0f('0x29')](respondWithResult(_0x50a681,null))[_0x4e0f('0x48')](handleError(_0x50a681,null));};exports[_0x4e0f('0x49')]=function(_0x463720,_0x5393b6){return db[_0x4e0f('0x2e')][_0x4e0f('0x49')](_0x463720[_0x4e0f('0x4a')],{})['then'](respondWithResult(_0x5393b6,0xc9))[_0x4e0f('0x48')](handleError(_0x5393b6,null));};exports[_0x4e0f('0x27')]=function(_0x24a30d,_0x3fb0e9){if(_0x24a30d[_0x4e0f('0x4a')]['id']){delete _0x24a30d['body']['id'];}return db[_0x4e0f('0x2e')][_0x4e0f('0x47')]({'where':{'id':_0x24a30d[_0x4e0f('0x45')]['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x3fb0e9,null))[_0x4e0f('0x29')](saveUpdates(_0x24a30d[_0x4e0f('0x4a')],null))[_0x4e0f('0x29')](respondWithResult(_0x3fb0e9,null))[_0x4e0f('0x48')](handleError(_0x3fb0e9,null));};exports[_0x4e0f('0x28')]=function(_0x14738f,_0x1f6d72){return db[_0x4e0f('0x2e')][_0x4e0f('0x47')]({'where':{'id':_0x14738f['params']['id']}})[_0x4e0f('0x29')](handleEntityNotFound(_0x1f6d72,null))[_0x4e0f('0x29')](removeEntity(_0x1f6d72,null))[_0x4e0f('0x48')](handleError(_0x1f6d72,null));};exports[_0x4e0f('0x4b')]=function(_0x21e88c,_0x21478d){return db[_0x4e0f('0x2e')][_0x4e0f('0x4b')]()[_0x4e0f('0x29')](respondWithResult(_0x21478d,null))['catch'](handleError(_0x21478d,null));}; \ No newline at end of file +var _0x1f26=['rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','error','name','send','index','map','MailTransferReport'];(function(_0x52ae40,_0x23c2bf){var _0xab6ed1=function(_0x36d880){while(--_0x36d880){_0x52ae40['push'](_0x52ae40['shift']());}};_0xab6ed1(++_0x23c2bf);}(_0x1f26,0xb9));var _0x61f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1f26[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x61f2('0x0'));var rimraf=require(_0x61f2('0x1'));var zipdir=require(_0x61f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x61f2('0x3'));var moment=require(_0x61f2('0x4'));var BPromise=require(_0x61f2('0x5'));var Mustache=require(_0x61f2('0x6'));var util=require(_0x61f2('0x7'));var path=require('path');var sox=require(_0x61f2('0x8'));var csv=require('to-csv');var ejs=require(_0x61f2('0x9'));var fs=require('fs');var fs_extra=require(_0x61f2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x61f2('0xb'));var jsforce=require(_0x61f2('0xc'));var deskjs=require(_0x61f2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x61f2('0xe'));var Papa=require(_0x61f2('0xf'));var Redis=require(_0x61f2('0x10'));var authService=require(_0x61f2('0x11'));var qs=require(_0x61f2('0x12'));var as=require(_0x61f2('0x13'));var hardwareService=require(_0x61f2('0x14'));var logger=require(_0x61f2('0x15'))(_0x61f2('0x16'));var utils=require(_0x61f2('0x17'));var config=require(_0x61f2('0x18'));var licenseUtil=require(_0x61f2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cd22f,_0x281199){_0x281199=_0x281199||0xcc;return function(_0x2939e6){if(_0x2939e6){return _0x2cd22f[_0x61f2('0x1a')](_0x281199);}return _0x2cd22f[_0x61f2('0x1b')](_0x281199)['end']();};}function respondWithResult(_0x238d92,_0x5739f2){_0x5739f2=_0x5739f2||0xc8;return function(_0xe1fd95){if(_0xe1fd95){return _0x238d92['status'](_0x5739f2)[_0x61f2('0x1c')](_0xe1fd95);}};}function respondWithFilteredResult(_0x203ad4,_0x54708f){return function(_0x57eed4){if(_0x57eed4){var _0x4acc11=typeof _0x54708f[_0x61f2('0x1d')]===_0x61f2('0x1e')&&typeof _0x54708f[_0x61f2('0x1f')]==='undefined';var _0xc3a498=_0x57eed4[_0x61f2('0x20')];var _0x388806=_0x4acc11?0x0:_0x54708f['offset'];var _0x4ac0a3=_0x4acc11?_0x57eed4[_0x61f2('0x20')]:_0x54708f[_0x61f2('0x1d')]+_0x54708f[_0x61f2('0x1f')];var _0x30f824;if(_0x4ac0a3>=_0xc3a498){_0x4ac0a3=_0xc3a498;_0x30f824=0xc8;}else{_0x30f824=0xce;}_0x203ad4[_0x61f2('0x1b')](_0x30f824);return _0x203ad4[_0x61f2('0x21')](_0x61f2('0x22'),_0x388806+'-'+_0x4ac0a3+'/'+_0xc3a498)[_0x61f2('0x1c')](_0x57eed4);}return null;};}function patchUpdates(_0x9405fd){return function(_0x367bc3){try{jsonpatch['apply'](_0x367bc3,_0x9405fd,!![]);}catch(_0x1c1e0e){return BPromise[_0x61f2('0x23')](_0x1c1e0e);}return _0x367bc3[_0x61f2('0x24')]();};}function saveUpdates(_0x558fb9,_0x340e69){return function(_0x5b8727){if(_0x5b8727){return _0x5b8727[_0x61f2('0x25')](_0x558fb9)[_0x61f2('0x26')](function(_0x4cda03){return _0x4cda03;});}return null;};}function removeEntity(_0x5ad8e9,_0x414049){return function(_0x51dc82){if(_0x51dc82){return _0x51dc82['destroy']()[_0x61f2('0x26')](function(){_0x5ad8e9[_0x61f2('0x1b')](0xcc)[_0x61f2('0x27')]();});}};}function handleEntityNotFound(_0x15c592,_0x1def12){return function(_0x5268f3){if(!_0x5268f3){_0x15c592[_0x61f2('0x1a')](0x194);}return _0x5268f3;};}function handleError(_0x1684fa,_0x2d084c){_0x2d084c=_0x2d084c||0x1f4;return function(_0x345e9f){logger[_0x61f2('0x28')](_0x345e9f['stack']);if(_0x345e9f[_0x61f2('0x29')]){delete _0x345e9f[_0x61f2('0x29')];}_0x1684fa['status'](_0x2d084c)[_0x61f2('0x2a')](_0x345e9f);};}exports[_0x61f2('0x2b')]=function(_0xcef23a,_0x28949c){var _0x1a35f0={},_0x5a7828={},_0x40a3ca={'count':0x0,'rows':[]};var _0x54db28=_[_0x61f2('0x2c')](db[_0x61f2('0x2d')][_0x61f2('0x2e')],function(_0x8ba496){return{'name':_0x8ba496['fieldName'],'type':_0x8ba496[_0x61f2('0x2f')][_0x61f2('0x30')]};});_0x5a7828[_0x61f2('0x31')]=_[_0x61f2('0x2c')](_0x54db28,_0x61f2('0x29'));_0x5a7828[_0x61f2('0x32')]=_['keys'](_0xcef23a[_0x61f2('0x32')]);_0x5a7828[_0x61f2('0x33')]=_['intersection'](_0x5a7828[_0x61f2('0x31')],_0x5a7828[_0x61f2('0x32')]);_0x1a35f0[_0x61f2('0x34')]=_[_0x61f2('0x35')](_0x5a7828['model'],qs['fields'](_0xcef23a[_0x61f2('0x32')][_0x61f2('0x36')]));_0x1a35f0[_0x61f2('0x34')]=_0x1a35f0['attributes'][_0x61f2('0x37')]?_0x1a35f0[_0x61f2('0x34')]:_0x5a7828[_0x61f2('0x31')];if(!_0xcef23a[_0x61f2('0x32')]['hasOwnProperty'](_0x61f2('0x38'))){_0x1a35f0[_0x61f2('0x1f')]=qs[_0x61f2('0x1f')](_0xcef23a[_0x61f2('0x32')]['limit']);_0x1a35f0[_0x61f2('0x1d')]=qs[_0x61f2('0x1d')](_0xcef23a[_0x61f2('0x32')][_0x61f2('0x1d')]);}_0x1a35f0[_0x61f2('0x39')]=qs['sort'](_0xcef23a[_0x61f2('0x32')][_0x61f2('0x3a')]);_0x1a35f0[_0x61f2('0x3b')]=qs[_0x61f2('0x33')](_[_0x61f2('0x3c')](_0xcef23a[_0x61f2('0x32')],_0x5a7828[_0x61f2('0x33')]),_0x54db28);if(_0xcef23a[_0x61f2('0x32')][_0x61f2('0x3d')]){_0x1a35f0[_0x61f2('0x3b')]=_[_0x61f2('0x3e')](_0x1a35f0['where'],{'$or':_['map'](_0x54db28,function(_0x1812cc){if(_0x1812cc['type']!==_0x61f2('0x3f')){var _0x51843f={};_0x51843f[_0x1812cc[_0x61f2('0x29')]]={'$like':'%'+_0xcef23a[_0x61f2('0x32')][_0x61f2('0x3d')]+'%'};return _0x51843f;}})});}_0x1a35f0=_[_0x61f2('0x3e')]({},_0x1a35f0,_0xcef23a['options']);var _0x32f6e4={'where':_0x1a35f0[_0x61f2('0x3b')]};return db[_0x61f2('0x2d')][_0x61f2('0x20')](_0x32f6e4)['then'](function(_0x185a50){_0x40a3ca[_0x61f2('0x20')]=_0x185a50;if(_0xcef23a[_0x61f2('0x32')][_0x61f2('0x40')]){_0x1a35f0[_0x61f2('0x41')]=[{'all':!![]}];}return db[_0x61f2('0x2d')][_0x61f2('0x42')](_0x1a35f0);})[_0x61f2('0x26')](function(_0x3ab826){_0x40a3ca[_0x61f2('0x43')]=_0x3ab826;return _0x40a3ca;})[_0x61f2('0x26')](respondWithFilteredResult(_0x28949c,_0x1a35f0))[_0x61f2('0x44')](handleError(_0x28949c,null));};exports[_0x61f2('0x45')]=function(_0x58390a,_0x386c43){var _0x46cf3b={'raw':!![],'where':{'id':_0x58390a[_0x61f2('0x46')]['id']}},_0x38efe5={};_0x38efe5[_0x61f2('0x31')]=_[_0x61f2('0x47')](db[_0x61f2('0x2d')][_0x61f2('0x2e')]);_0x38efe5[_0x61f2('0x32')]=_[_0x61f2('0x47')](_0x58390a[_0x61f2('0x32')]);_0x38efe5[_0x61f2('0x33')]=_[_0x61f2('0x35')](_0x38efe5[_0x61f2('0x31')],_0x38efe5[_0x61f2('0x32')]);_0x46cf3b[_0x61f2('0x34')]=_[_0x61f2('0x35')](_0x38efe5[_0x61f2('0x31')],qs[_0x61f2('0x36')](_0x58390a[_0x61f2('0x32')][_0x61f2('0x36')]));_0x46cf3b[_0x61f2('0x34')]=_0x46cf3b[_0x61f2('0x34')][_0x61f2('0x37')]?_0x46cf3b[_0x61f2('0x34')]:_0x38efe5[_0x61f2('0x31')];if(_0x58390a[_0x61f2('0x32')][_0x61f2('0x40')]){_0x46cf3b[_0x61f2('0x41')]=[{'all':!![]}];}_0x46cf3b=_[_0x61f2('0x3e')]({},_0x46cf3b,_0x58390a['options']);return db['MailTransferReport'][_0x61f2('0x48')](_0x46cf3b)['then'](handleEntityNotFound(_0x386c43,null))[_0x61f2('0x26')](respondWithResult(_0x386c43,null))[_0x61f2('0x44')](handleError(_0x386c43,null));};exports[_0x61f2('0x49')]=function(_0x4402dd,_0x4ba8f9){return db[_0x61f2('0x2d')][_0x61f2('0x49')](_0x4402dd[_0x61f2('0x4a')],{})[_0x61f2('0x26')](respondWithResult(_0x4ba8f9,0xc9))[_0x61f2('0x44')](handleError(_0x4ba8f9,null));};exports[_0x61f2('0x25')]=function(_0x28b4e0,_0x15242e){if(_0x28b4e0[_0x61f2('0x4a')]['id']){delete _0x28b4e0[_0x61f2('0x4a')]['id'];}return db[_0x61f2('0x2d')][_0x61f2('0x48')]({'where':{'id':_0x28b4e0[_0x61f2('0x46')]['id']}})[_0x61f2('0x26')](handleEntityNotFound(_0x15242e,null))[_0x61f2('0x26')](saveUpdates(_0x28b4e0[_0x61f2('0x4a')],null))['then'](respondWithResult(_0x15242e,null))[_0x61f2('0x44')](handleError(_0x15242e,null));};exports[_0x61f2('0x4b')]=function(_0x555870,_0x331706){return db['MailTransferReport']['find']({'where':{'id':_0x555870[_0x61f2('0x46')]['id']}})[_0x61f2('0x26')](handleEntityNotFound(_0x331706,null))[_0x61f2('0x26')](removeEntity(_0x331706,null))[_0x61f2('0x44')](handleError(_0x331706,null));};exports[_0x61f2('0x4c')]=function(_0x17043b,_0x382ee9){return db['MailTransferReport'][_0x61f2('0x4c')]()[_0x61f2('0x26')](respondWithResult(_0x382ee9,null))[_0x61f2('0x44')](handleError(_0x382ee9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d5b6e4d..87e46db 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 _0xf7df=['path','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1a161f,_0x587181){var _0x697efb=function(_0x1e5ca7){while(--_0x1e5ca7){_0x1a161f['push'](_0x1a161f['shift']());}};_0x697efb(++_0x587181);}(_0xf7df,0x10e));var _0xff7d=function(_0x5e4f1d,_0x16a0fb){_0x5e4f1d=_0x5e4f1d-0x0;var _0x3a435d=_0xf7df[_0x5e4f1d];return _0x3a435d;};'use strict';var _=require(_0xff7d('0x0'));var util=require('util');var logger=require(_0xff7d('0x1'))(_0xff7d('0x2'));var moment=require(_0xff7d('0x3'));var BPromise=require(_0xff7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff7d('0x5'));var rimraf=require('rimraf');var config=require(_0xff7d('0x6'));var attributes=require(_0xff7d('0x7'));module['exports']=function(_0x758bfb,_0x54644b){return _0x758bfb['define'](_0xff7d('0x8'),attributes,{'tableName':_0xff7d('0x9'),'paranoid':![],'indexes':[{'name':_0xff7d('0xa'),'fields':[_0xff7d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xed1f,0x6a));var _0xfed1=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xed1f[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[{'name':_0xfed1('0xf'),'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 d75b577..3b4327b 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 _0x826b=['error','code','MailTransferReport,\x20%s,\x20%s','info','result','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x49a9f5,_0x28b1eb){var _0x4e8691=function(_0x21c85e){while(--_0x21c85e){_0x49a9f5['push'](_0x49a9f5['shift']());}};_0x4e8691(++_0x28b1eb);}(_0x826b,0x151));var _0xb826=function(_0x3957a5,_0x876c61){_0x3957a5=_0x3957a5-0x0;var _0x291a8d=_0x826b[_0x3957a5];return _0x291a8d;};'use strict';var _=require('lodash');var util=require(_0xb826('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb826('0x1'));var fs=require('fs');var Redis=require(_0xb826('0x2'));var db=require(_0xb826('0x3'))['db'];var utils=require(_0xb826('0x4'));var logger=require(_0xb826('0x5'))(_0xb826('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb826('0x7')][_0xb826('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x263563,_0x5670b9,_0x269ed9){return new BPromise(function(_0xe1cc5d,_0x5b8f5e){return client[_0xb826('0x9')](_0x263563,_0x269ed9)[_0xb826('0xa')](function(_0x51bf4f){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5670b9,_0xb826('0xb'));logger[_0xb826('0xc')](_0xb826('0xd'),_0x5670b9,_0xb826('0xb'),JSON[_0xb826('0xe')](_0x51bf4f));if(_0x51bf4f['error']){if(_0x51bf4f[_0xb826('0xf')][_0xb826('0x10')]===0x1f4){logger['error'](_0xb826('0x11'),_0x5670b9,_0x51bf4f['error']['message']);return _0x5b8f5e(_0x51bf4f[_0xb826('0xf')]['message']);}logger[_0xb826('0xf')](_0xb826('0x11'),_0x5670b9,_0x51bf4f[_0xb826('0xf')]['message']);return _0xe1cc5d(_0x51bf4f[_0xb826('0xf')]['message']);}else{logger[_0xb826('0x12')](_0xb826('0x11'),_0x5670b9,_0xb826('0xb'));_0xe1cc5d(_0x51bf4f[_0xb826('0x13')][_0xb826('0x14')]);}})[_0xb826('0x15')](function(_0x21be2c){logger[_0xb826('0xf')](_0xb826('0x11'),_0x5670b9,_0x21be2c);_0x5b8f5e(_0x21be2c);});});} \ No newline at end of file +var _0xf7a5=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x2efb5b,_0x2986b4){var _0x477163=function(_0x380f50){while(--_0x380f50){_0x2efb5b['push'](_0x2efb5b['shift']());}};_0x477163(++_0x2986b4);}(_0xf7a5,0xf4));var _0x5f7a=function(_0x4cab1e,_0xfc5cde){_0x4cab1e=_0x4cab1e-0x0;var _0x1a8cd8=_0xf7a5[_0x4cab1e];return _0x1a8cd8;};'use strict';var _=require(_0x5f7a('0x0'));var util=require('util');var moment=require(_0x5f7a('0x1'));var BPromise=require(_0x5f7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5f7a('0x3'));var logger=require('../../config/logger')(_0x5f7a('0x4'));var config=require(_0x5f7a('0x5'));var jayson=require(_0x5f7a('0x6'));var client=jayson[_0x5f7a('0x7')][_0x5f7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14ffda,_0x5c718a,_0x55a17b){return new BPromise(function(_0xb2382f,_0xa4da89){return client['request'](_0x14ffda,_0x55a17b)[_0x5f7a('0x9')](function(_0x114c01){logger[_0x5f7a('0xa')](_0x5f7a('0xb'),_0x5c718a,_0x5f7a('0xc'));logger[_0x5f7a('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5c718a,_0x5f7a('0xc'),JSON[_0x5f7a('0xe')](_0x114c01));if(_0x114c01[_0x5f7a('0xf')]){if(_0x114c01[_0x5f7a('0xf')]['code']===0x1f4){logger[_0x5f7a('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x5c718a,_0x114c01[_0x5f7a('0xf')][_0x5f7a('0x10')]);return _0xa4da89(_0x114c01[_0x5f7a('0xf')][_0x5f7a('0x10')]);}logger['error'](_0x5f7a('0xb'),_0x5c718a,_0x114c01[_0x5f7a('0xf')][_0x5f7a('0x10')]);return _0xb2382f(_0x114c01[_0x5f7a('0xf')]['message']);}else{logger[_0x5f7a('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x5c718a,'request\x20sent');_0xb2382f(_0x114c01[_0x5f7a('0x11')][_0x5f7a('0x10')]);}})[_0x5f7a('0x12')](function(_0x5bc3df){logger[_0x5f7a('0xf')](_0x5f7a('0xb'),_0x5c718a,_0x5bc3df);_0xa4da89(_0x5bc3df);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ad497b0..15e48b1 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 _0x089a=['create','put','update','delete','exports','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x159641,_0x292389){var _0x41c53a=function(_0x21dd62){while(--_0x21dd62){_0x159641['push'](_0x159641['shift']());}};_0x41c53a(++_0x292389);}(_0x089a,0x1eb));var _0xa089=function(_0x3d322b,_0x284140){_0x3d322b=_0x3d322b-0x0;var _0x5edee0=_0x089a[_0x3d322b];return _0x5edee0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa089('0x0'));var timeout=require(_0xa089('0x1'));var express=require('express');var router=express[_0xa089('0x2')]();var fs_extra=require(_0xa089('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa089('0x4'));var controller=require(_0xa089('0x5'));router[_0xa089('0x6')]('/',auth[_0xa089('0x7')](),controller[_0xa089('0x8')]);router['get']('/describe',auth[_0xa089('0x7')](),controller[_0xa089('0x9')]);router[_0xa089('0x6')](_0xa089('0xa'),auth['isAuthenticated'](),controller[_0xa089('0xb')]);router[_0xa089('0xc')]('/',auth[_0xa089('0x7')](),controller[_0xa089('0xd')]);router[_0xa089('0xe')](_0xa089('0xa'),auth['isAuthenticated'](),controller[_0xa089('0xf')]);router[_0xa089('0x10')]('/:id',auth[_0xa089('0x7')](),controller['destroy']);module[_0xa089('0x11')]=router; \ No newline at end of file +var _0x8671=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','get','/describe','describe','/:id','show','update'];(function(_0xc7fb04,_0x402e85){var _0x3d1ed8=function(_0x2935e9){while(--_0x2935e9){_0xc7fb04['push'](_0xc7fb04['shift']());}};_0x3d1ed8(++_0x402e85);}(_0x8671,0xdf));var _0x1867=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8671[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x1867('0x0'));var util=require('util');var path=require(_0x1867('0x1'));var timeout=require(_0x1867('0x2'));var express=require(_0x1867('0x3'));var router=express[_0x1867('0x4')]();var fs_extra=require(_0x1867('0x5'));var auth=require(_0x1867('0x6'));var interaction=require(_0x1867('0x7'));var config=require(_0x1867('0x8'));var controller=require(_0x1867('0x9'));router['get']('/',auth[_0x1867('0xa')](),controller['index']);router[_0x1867('0xb')](_0x1867('0xc'),auth['isAuthenticated'](),controller[_0x1867('0xd')]);router[_0x1867('0xb')](_0x1867('0xe'),auth[_0x1867('0xa')](),controller[_0x1867('0xf')]);router['post']('/',auth[_0x1867('0xa')](),controller['create']);router['put']('/:id',auth[_0x1867('0xa')](),controller[_0x1867('0x10')]);router[_0x1867('0x11')](_0x1867('0xe'),auth[_0x1867('0xa')](),controller[_0x1867('0x12')]);module[_0x1867('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 82a411f..445418f 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 _0xab0d=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xab0d,0x7a));var _0xdab0=function(_0x13e51c,_0x40379f){_0x13e51c=_0x13e51c-0x0;var _0x229a14=_0xab0d[_0x13e51c];return _0x229a14;};'use strict';var Sequelize=require(_0xdab0('0x0'));var moment=require(_0xdab0('0x1'));module[_0xdab0('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdab0('0x3')]},'interface':{'type':Sequelize[_0xdab0('0x3')]},'type':{'type':Sequelize[_0xdab0('0x3')],'defaultValue':_0xdab0('0x4'),'comment':_0xdab0('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdab0('0x6')],'set':function(_0x3adae5){var _0x174918=moment(_0x3adae5);var _0x1a94b8=moment(this[_0xdab0('0x7')](_0xdab0('0x8')));var _0x37d6a5=_0x174918[_0xdab0('0x9')](_0x1a94b8,_0xdab0('0xa'));this['setDataValue']('exitAt',_0x3adae5);this[_0xdab0('0xb')](_0xdab0('0xc'),_0x37d6a5>=0x0?_0x37d6a5:null);}},'data1':{'type':Sequelize[_0xdab0('0x3')],'comment':_0xdab0('0xd')},'data2':{'type':Sequelize[_0xdab0('0x3')],'comment':_0xdab0('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xdab0('0xf')},'data4':{'type':Sequelize[_0xdab0('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xdab0('0x3')],'comment':_0xdab0('0x10')},'role':{'type':Sequelize[_0xdab0('0x3')]},'internal':{'type':Sequelize[_0xdab0('0x11')]},'uniqueid':{'type':Sequelize[_0xdab0('0x3')]}}; \ No newline at end of file +var _0xf7f9=['talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x59bd39,_0x63c2a5){var _0xf2bc65=function(_0x589710){while(--_0x589710){_0x59bd39['push'](_0x59bd39['shift']());}};_0xf2bc65(++_0x63c2a5);}(_0xf7f9,0x17d));var _0x9f7f=function(_0x78601a,_0x83dd){_0x78601a=_0x78601a-0x0;var _0x4ed023=_0xf7f9[_0x78601a];return _0x4ed023;};'use strict';var Sequelize=require(_0x9f7f('0x0'));var moment=require(_0x9f7f('0x1'));module[_0x9f7f('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9f7f('0x3')]},'interface':{'type':Sequelize[_0x9f7f('0x3')]},'type':{'type':Sequelize[_0x9f7f('0x3')],'defaultValue':_0x9f7f('0x4'),'comment':_0x9f7f('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9f7f('0x6')]},'exitAt':{'type':Sequelize[_0x9f7f('0x6')],'set':function(_0x5843e7){var _0x346c75=moment(_0x5843e7);var _0xac0d3f=moment(this[_0x9f7f('0x7')](_0x9f7f('0x8')));var _0x38f2b3=_0x346c75[_0x9f7f('0x9')](_0xac0d3f,'seconds');this[_0x9f7f('0xa')]('exitAt',_0x5843e7);this[_0x9f7f('0xa')](_0x9f7f('0xb'),_0x38f2b3>=0x0?_0x38f2b3:null);}},'data1':{'type':Sequelize[_0x9f7f('0x3')],'comment':_0x9f7f('0xc')},'data2':{'type':Sequelize[_0x9f7f('0x3')],'comment':_0x9f7f('0xd')},'data3':{'type':Sequelize[_0x9f7f('0x3')],'comment':_0x9f7f('0xe')},'data4':{'type':Sequelize[_0x9f7f('0x3')],'comment':_0x9f7f('0xf')},'data5':{'type':Sequelize[_0x9f7f('0x3')],'comment':_0x9f7f('0x10')},'role':{'type':Sequelize[_0x9f7f('0x3')]},'internal':{'type':Sequelize[_0x9f7f('0x11')]},'uniqueid':{'type':Sequelize[_0x9f7f('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f914a10..46ce0f3 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(_0x265150,_0x3b39ad){var _0x592239=function(_0xfa3866){while(--_0xfa3866){_0x265150['push'](_0x265150['shift']());}};_0x592239(++_0x3b39ad);}(_0x008c,0x188));var _0xc008=function(_0x10dfdf,_0xd11233){_0x10dfdf=_0x10dfdf-0x0;var _0x2ff0c7=_0x008c[_0x10dfdf];return _0x2ff0c7;};'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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x4fa916,_0x3ec36a){var _0x576439=function(_0x5692e0){while(--_0x5692e0){_0x4fa916['push'](_0x4fa916['shift']());}};_0x576439(++_0x3ec36a);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d5994f7..88f062f 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 _0x2709=['interface','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface'];(function(_0x1b1546,_0x32c441){var _0x42382d=function(_0x1a923c){while(--_0x1a923c){_0x1b1546['push'](_0x1b1546['shift']());}};_0x42382d(++_0x32c441);}(_0x2709,0x189));var _0x9270=function(_0x17ef90,_0x46a08f){_0x17ef90=_0x17ef90-0x0;var _0x5e886c=_0x2709[_0x17ef90];return _0x5e886c;};'use strict';var _=require(_0x9270('0x0'));var util=require('util');var logger=require(_0x9270('0x1'))(_0x9270('0x2'));var moment=require('moment');var BPromise=require(_0x9270('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9270('0x4'));var rimraf=require(_0x9270('0x5'));var config=require(_0x9270('0x6'));var attributes=require(_0x9270('0x7'));module[_0x9270('0x8')]=function(_0x446f78,_0x4c71c5){return _0x446f78[_0x9270('0x9')](_0x9270('0xa'),attributes,{'tableName':_0x9270('0xb'),'paranoid':![],'indexes':[{'name':_0x9270('0xc'),'fields':['membername',_0x9270('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f29=['report_member','membername_interface','membername','interface','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x4f29,0x1e0));var _0x94f2=function(_0x1bc55c,_0x3d99e5){_0x1bc55c=_0x1bc55c-0x0;var _0x4a27ff=_0x4f29[_0x1bc55c];return _0x4a27ff;};'use strict';var _=require(_0x94f2('0x0'));var util=require(_0x94f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x94f2('0x2'));var BPromise=require('bluebird');var rp=require(_0x94f2('0x3'));var fs=require('fs');var path=require(_0x94f2('0x4'));var rimraf=require(_0x94f2('0x5'));var config=require(_0x94f2('0x6'));var attributes=require(_0x94f2('0x7'));module['exports']=function(_0x33e1b8,_0x2f4436){return _0x33e1b8[_0x94f2('0x8')](_0x94f2('0x9'),attributes,{'tableName':_0x94f2('0xa'),'paranoid':![],'indexes':[{'name':_0x94f2('0xb'),'fields':[_0x94f2('0xc'),_0x94f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 95c540a..00b1ef1 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 _0xbac8=['request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','body','UpdateMemberReport','update','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','MemberReport,\x20%s,\x20%s'];(function(_0x566f65,_0x1062d2){var _0x9a703a=function(_0x2c15cc){while(--_0x2c15cc){_0x566f65['push'](_0x566f65['shift']());}};_0x9a703a(++_0x1062d2);}(_0xbac8,0x140));var _0x8bac=function(_0x1ef864,_0x143fcf){_0x1ef864=_0x1ef864-0x0;var _0xd1f902=_0xbac8[_0x1ef864];return _0xd1f902;};'use strict';var _=require(_0x8bac('0x0'));var util=require(_0x8bac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8bac('0x2'));var fs=require('fs');var Redis=require(_0x8bac('0x3'));var db=require(_0x8bac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bac('0x5'))(_0x8bac('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8bac('0x7')][_0x8bac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e95bb,_0x65a44b,_0x2e6c33){return new BPromise(function(_0x3a315c,_0x1593a1){return client[_0x8bac('0x9')](_0x3e95bb,_0x2e6c33)[_0x8bac('0xa')](function(_0x5a934f){logger[_0x8bac('0xb')](_0x8bac('0xc'),_0x65a44b,_0x8bac('0xd'));logger['debug'](_0x8bac('0xe'),_0x65a44b,'request\x20sent',JSON[_0x8bac('0xf')](_0x5a934f));if(_0x5a934f[_0x8bac('0x10')]){if(_0x5a934f['error'][_0x8bac('0x11')]===0x1f4){logger[_0x8bac('0x10')](_0x8bac('0xc'),_0x65a44b,_0x5a934f[_0x8bac('0x10')][_0x8bac('0x12')]);return _0x1593a1(_0x5a934f['error']['message']);}logger[_0x8bac('0x10')](_0x8bac('0xc'),_0x65a44b,_0x5a934f['error'][_0x8bac('0x12')]);return _0x3a315c(_0x5a934f['error']['message']);}else{logger[_0x8bac('0xb')](_0x8bac('0xc'),_0x65a44b,_0x8bac('0xd'));_0x3a315c(_0x5a934f[_0x8bac('0x13')][_0x8bac('0x12')]);}})[_0x8bac('0x14')](function(_0x50dba1){logger['error'](_0x8bac('0xc'),_0x65a44b,_0x50dba1);_0x1593a1(_0x50dba1);});});}exports['GetMemberReport']=function(_0x5e700a){var _0x3ab89d=this;return new Promise(function(_0x447814,_0x105e06){return db[_0x8bac('0x15')][_0x8bac('0x16')]({'raw':_0x5e700a[_0x8bac('0x17')]?_0x5e700a['options'][_0x8bac('0x18')]===undefined?!![]:![]:!![],'where':_0x5e700a[_0x8bac('0x17')]?_0x5e700a[_0x8bac('0x17')][_0x8bac('0x19')]||null:null,'attributes':_0x5e700a[_0x8bac('0x17')]?_0x5e700a[_0x8bac('0x17')][_0x8bac('0x1a')]||null:null,'limit':_0x5e700a[_0x8bac('0x17')]?_0x5e700a['options'][_0x8bac('0x1b')]||null:null,'include':_0x5e700a['options']?_0x5e700a[_0x8bac('0x17')][_0x8bac('0x1c')]?_[_0x8bac('0x1d')](_0x5e700a[_0x8bac('0x17')]['include'],function(_0x41fc20){return{'model':db[_0x41fc20[_0x8bac('0x1e')]],'as':_0x41fc20['as'],'attributes':_0x41fc20[_0x8bac('0x1a')],'include':_0x41fc20['include']?_[_0x8bac('0x1d')](_0x41fc20[_0x8bac('0x1c')],function(_0x30916b){return{'model':db[_0x30916b['model']],'as':_0x30916b['as'],'attributes':_0x30916b['attributes'],'include':_0x30916b['include']?_[_0x8bac('0x1d')](_0x30916b[_0x8bac('0x1c')],function(_0xaedf36){return{'model':db[_0xaedf36[_0x8bac('0x1e')]],'as':_0xaedf36['as'],'attributes':_0xaedf36[_0x8bac('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8bac('0xa')](function(_0x4e472e){logger[_0x8bac('0xb')](_0x8bac('0x1f'),_0x5e700a);logger['debug'](_0x8bac('0x1f'),_0x5e700a,JSON[_0x8bac('0xf')](_0x4e472e));_0x447814(_0x4e472e);})[_0x8bac('0x14')](function(_0x4cf137){logger[_0x8bac('0x10')](_0x8bac('0x1f'),_0x4cf137[_0x8bac('0x12')],_0x5e700a);_0x105e06(_0x3ab89d[_0x8bac('0x10')](0x1f4,_0x4cf137['message']));});});};exports[_0x8bac('0x20')]=function(_0x29fd31){var _0x5795d1=this;return new Promise(function(_0x5c3ad1,_0x200a10){return db['MemberReport']['create'](_0x29fd31[_0x8bac('0x21')],{'raw':_0x29fd31[_0x8bac('0x17')]?_0x29fd31[_0x8bac('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x8bac('0xa')](function(_0x17242d){logger[_0x8bac('0xb')]('CreateMemberReport',_0x29fd31);logger['debug'](_0x8bac('0x20'),_0x29fd31,JSON[_0x8bac('0xf')](_0x17242d));_0x5c3ad1(_0x17242d);})[_0x8bac('0x14')](function(_0x5d92b6){logger['error']('CreateMemberReport',_0x5d92b6[_0x8bac('0x12')],_0x29fd31);_0x200a10(_0x5795d1['error'](0x1f4,_0x5d92b6[_0x8bac('0x12')]));});});};exports[_0x8bac('0x22')]=function(_0x212406){var _0x1c028e=this;return new Promise(function(_0x2f7aa7,_0x206f8f){return db['MemberReport'][_0x8bac('0x23')](_0x212406[_0x8bac('0x21')],{'raw':_0x212406[_0x8bac('0x17')]?_0x212406[_0x8bac('0x17')][_0x8bac('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212406[_0x8bac('0x17')]?_0x212406[_0x8bac('0x17')][_0x8bac('0x19')]||null:null,'attributes':_0x212406['options']?_0x212406[_0x8bac('0x17')][_0x8bac('0x1a')]||null:null,'limit':_0x212406['options']?_0x212406[_0x8bac('0x17')][_0x8bac('0x1b')]||null:null})[_0x8bac('0xa')](function(_0x59c88){logger[_0x8bac('0xb')](_0x8bac('0x22'),_0x212406);logger[_0x8bac('0x24')]('UpdateMemberReport',_0x212406,JSON['stringify'](_0x59c88));_0x2f7aa7(_0x59c88);})['catch'](function(_0x189288){logger[_0x8bac('0x10')]('UpdateMemberReport',_0x189288[_0x8bac('0x12')],_0x212406);_0x206f8f(_0x1c028e[_0x8bac('0x10')](0x1f4,_0x189288[_0x8bac('0x12')]));});});}; \ No newline at end of file +var _0x1c9a=['raw','CreateMemberReport','UpdateMemberReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','GetMemberReport','MemberReport','findAll','options','where','attributes','map','include','model','catch','create','body'];(function(_0x1c6800,_0x5a8ced){var _0x3bf651=function(_0x183c37){while(--_0x183c37){_0x1c6800['push'](_0x1c6800['shift']());}};_0x3bf651(++_0x5a8ced);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x54efe1,_0x3df429){_0x54efe1=_0x54efe1-0x0;var _0x4497da=_0x1c9a[_0x54efe1];return _0x4497da;};'use strict';var _=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var moment=require('moment');var BPromise=require(_0xa1c9('0x2'));var rs=require(_0xa1c9('0x3'));var fs=require('fs');var Redis=require(_0xa1c9('0x4'));var db=require(_0xa1c9('0x5'))['db'];var utils=require(_0xa1c9('0x6'));var logger=require('../../config/logger')(_0xa1c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1c9('0x8'));var client=jayson[_0xa1c9('0x9')][_0xa1c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0c89,_0x1a0364,_0x46b19a){return new BPromise(function(_0x3b1a2c,_0xc8bc5a){return client[_0xa1c9('0xb')](_0x2b0c89,_0x46b19a)[_0xa1c9('0xc')](function(_0x2fcbcd){logger[_0xa1c9('0xd')]('MemberReport,\x20%s,\x20%s',_0x1a0364,'request\x20sent');logger[_0xa1c9('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x1a0364,_0xa1c9('0xf'),JSON[_0xa1c9('0x10')](_0x2fcbcd));if(_0x2fcbcd[_0xa1c9('0x11')]){if(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0xc8bc5a(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0x3b1a2c(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xd')](_0xa1c9('0x13'),_0x1a0364,_0xa1c9('0xf'));_0x3b1a2c(_0x2fcbcd['result'][_0xa1c9('0x14')]);}})['catch'](function(_0x12d989){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x12d989);_0xc8bc5a(_0x12d989);});});}exports[_0xa1c9('0x15')]=function(_0x13086a){var _0x2d2ad4=this;return new Promise(function(_0x223932,_0x414d70){return db[_0xa1c9('0x16')][_0xa1c9('0x17')]({'raw':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')][_0xa1c9('0x19')]||null:null,'attributes':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')][_0xa1c9('0x1a')]||null:null,'limit':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')]['limit']||null:null,'include':_0x13086a[_0xa1c9('0x18')]?_0x13086a[_0xa1c9('0x18')]['include']?_[_0xa1c9('0x1b')](_0x13086a[_0xa1c9('0x18')][_0xa1c9('0x1c')],function(_0x25418a){return{'model':db[_0x25418a[_0xa1c9('0x1d')]],'as':_0x25418a['as'],'attributes':_0x25418a['attributes'],'include':_0x25418a[_0xa1c9('0x1c')]?_[_0xa1c9('0x1b')](_0x25418a[_0xa1c9('0x1c')],function(_0x484a6b){return{'model':db[_0x484a6b[_0xa1c9('0x1d')]],'as':_0x484a6b['as'],'attributes':_0x484a6b[_0xa1c9('0x1a')],'include':_0x484a6b[_0xa1c9('0x1c')]?_[_0xa1c9('0x1b')](_0x484a6b[_0xa1c9('0x1c')],function(_0x339dee){return{'model':db[_0x339dee[_0xa1c9('0x1d')]],'as':_0x339dee['as'],'attributes':_0x339dee[_0xa1c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0xc')](function(_0x177f9b){logger[_0xa1c9('0xd')](_0xa1c9('0x15'),_0x13086a);logger[_0xa1c9('0xe')](_0xa1c9('0x15'),_0x13086a,JSON[_0xa1c9('0x10')](_0x177f9b));_0x223932(_0x177f9b);})[_0xa1c9('0x1e')](function(_0x568996){logger[_0xa1c9('0x11')](_0xa1c9('0x15'),_0x568996[_0xa1c9('0x14')],_0x13086a);_0x414d70(_0x2d2ad4[_0xa1c9('0x11')](0x1f4,_0x568996[_0xa1c9('0x14')]));});});};exports['CreateMemberReport']=function(_0x42df4e){var _0x1e09f8=this;return new Promise(function(_0x48ec74,_0x4278cd){return db[_0xa1c9('0x16')][_0xa1c9('0x1f')](_0x42df4e[_0xa1c9('0x20')],{'raw':_0x42df4e[_0xa1c9('0x18')]?_0x42df4e[_0xa1c9('0x18')][_0xa1c9('0x21')]===undefined?!![]:![]:!![]})[_0xa1c9('0xc')](function(_0x2c391e){logger[_0xa1c9('0xd')](_0xa1c9('0x22'),_0x42df4e);logger[_0xa1c9('0xe')](_0xa1c9('0x22'),_0x42df4e,JSON[_0xa1c9('0x10')](_0x2c391e));_0x48ec74(_0x2c391e);})[_0xa1c9('0x1e')](function(_0x4abab8){logger[_0xa1c9('0x11')](_0xa1c9('0x22'),_0x4abab8[_0xa1c9('0x14')],_0x42df4e);_0x4278cd(_0x1e09f8[_0xa1c9('0x11')](0x1f4,_0x4abab8['message']));});});};exports[_0xa1c9('0x23')]=function(_0x365f46){var _0x4eb4fd=this;return new Promise(function(_0x5ab2f2,_0x1aae5d){return db[_0xa1c9('0x16')][_0xa1c9('0x24')](_0x365f46[_0xa1c9('0x20')],{'raw':_0x365f46[_0xa1c9('0x18')]?_0x365f46[_0xa1c9('0x18')][_0xa1c9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x365f46[_0xa1c9('0x18')]?_0x365f46[_0xa1c9('0x18')][_0xa1c9('0x19')]||null:null,'attributes':_0x365f46[_0xa1c9('0x18')]?_0x365f46['options'][_0xa1c9('0x1a')]||null:null,'limit':_0x365f46[_0xa1c9('0x18')]?_0x365f46[_0xa1c9('0x18')][_0xa1c9('0x25')]||null:null})[_0xa1c9('0xc')](function(_0x3dc9fd){logger[_0xa1c9('0xd')](_0xa1c9('0x23'),_0x365f46);logger['debug'](_0xa1c9('0x23'),_0x365f46,JSON[_0xa1c9('0x10')](_0x3dc9fd));_0x5ab2f2(_0x3dc9fd);})[_0xa1c9('0x1e')](function(_0x5236fd){logger[_0xa1c9('0x11')](_0xa1c9('0x23'),_0x5236fd[_0xa1c9('0x14')],_0x365f46);_0x1aae5d(_0x4eb4fd[_0xa1c9('0x11')](0x1f4,_0x5236fd[_0xa1c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a0274e8..70e02c4 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 _0x0631=['../../config/environment','./migration.controller','get','index','exports','multer','path','connect-timeout'];(function(_0x29bb0a,_0x4a49e6){var _0x1725e4=function(_0xc984bd){while(--_0xc984bd){_0x29bb0a['push'](_0x29bb0a['shift']());}};_0x1725e4(++_0x4a49e6);}(_0x0631,0xcd));var _0x1063=function(_0x1e8aa9,_0x589c35){_0x1e8aa9=_0x1e8aa9-0x0;var _0x41237f=_0x0631[_0x1e8aa9];return _0x41237f;};'use strict';var multer=require(_0x1063('0x0'));var util=require('util');var path=require(_0x1063('0x1'));var timeout=require(_0x1063('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1063('0x3'));var controller=require(_0x1063('0x4'));router[_0x1063('0x5')]('/',controller[_0x1063('0x6')]);module[_0x1063('0x7')]=router; \ No newline at end of file +var _0x063a=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports'];(function(_0x4aef9f,_0x20028c){var _0x24d38b=function(_0x1b8d37){while(--_0x1b8d37){_0x4aef9f['push'](_0x4aef9f['shift']());}};_0x24d38b(++_0x20028c);}(_0x063a,0x1e0));var _0xa063=function(_0x5368a9,_0x3e5571){_0x5368a9=_0x5368a9-0x0;var _0x41bb88=_0x063a[_0x5368a9];return _0x41bb88;};'use strict';var multer=require(_0xa063('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa063('0x1'));var express=require('express');var router=express[_0xa063('0x2')]();var fs_extra=require(_0xa063('0x3'));var auth=require(_0xa063('0x4'));var interaction=require(_0xa063('0x5'));var config=require(_0xa063('0x6'));var controller=require('./migration.controller');router[_0xa063('0x7')]('/',controller[_0xa063('0x8')]);module[_0xa063('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index baba9a4..c66f297 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 _0xac27=['exports','STRING','sequelize'];(function(_0x2fa0a7,_0x188ed4){var _0x366c65=function(_0x251995){while(--_0x251995){_0x2fa0a7['push'](_0x2fa0a7['shift']());}};_0x366c65(++_0x188ed4);}(_0xac27,0x182));var _0x7ac2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xac27[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x7ac2('0x0'));module[_0x7ac2('0x1')]={'version':{'type':Sequelize[_0x7ac2('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xb97b=['STRING','sequelize'];(function(_0x2ecaf6,_0x60d2f5){var _0x29004f=function(_0x4f4324){while(--_0x4f4324){_0x2ecaf6['push'](_0x2ecaf6['shift']());}};_0x29004f(++_0x60d2f5);}(_0xb97b,0x12b));var _0xbb97=function(_0x7ac2d,_0x50b7eb){_0x7ac2d=_0x7ac2d-0x0;var _0x4d91e2=_0xb97b[_0x7ac2d];return _0x4d91e2;};'use strict';var Sequelize=require(_0xbb97('0x0'));module['exports']={'version':{'type':Sequelize[_0xbb97('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8c05e6c..e6c105d 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 _0x15c2=['save','update','destroy','then','stack','name','send','index','map','Migration','rawAttributes','type','key','model','query','filters','attributes','fields','length','order','sort','pick','where','VIRTUAL','filter','merge','include','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x15c2,0xef));var _0x215c=function(_0x356138,_0x5b9452){_0x356138=_0x356138-0x0;var _0x1896bb=_0x15c2[_0x356138];return _0x1896bb;};'use strict';var emlformat=require(_0x215c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x215c('0x1'));var jsonpatch=require(_0x215c('0x2'));var rp=require(_0x215c('0x3'));var moment=require(_0x215c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x215c('0x5'));var util=require(_0x215c('0x6'));var path=require(_0x215c('0x7'));var sox=require(_0x215c('0x8'));var csv=require(_0x215c('0x9'));var ejs=require(_0x215c('0xa'));var fs=require('fs');var fs_extra=require(_0x215c('0xb'));var _=require(_0x215c('0xc'));var squel=require('squel');var crypto=require(_0x215c('0xd'));var jsforce=require(_0x215c('0xe'));var deskjs=require(_0x215c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x215c('0x10'));var Papa=require(_0x215c('0x11'));var Redis=require(_0x215c('0x12'));var authService=require(_0x215c('0x13'));var qs=require(_0x215c('0x14'));var as=require(_0x215c('0x15'));var hardwareService=require(_0x215c('0x16'));var logger=require(_0x215c('0x17'))(_0x215c('0x18'));var utils=require(_0x215c('0x19'));var config=require(_0x215c('0x1a'));var licenseUtil=require(_0x215c('0x1b'));var db=require(_0x215c('0x1c'))['db'];function respondWithStatusCode(_0x2234b2,_0x22f52b){_0x22f52b=_0x22f52b||0xcc;return function(_0x4bf2cb){if(_0x4bf2cb){return _0x2234b2[_0x215c('0x1d')](_0x22f52b);}return _0x2234b2['status'](_0x22f52b)[_0x215c('0x1e')]();};}function respondWithResult(_0x950867,_0x314367){_0x314367=_0x314367||0xc8;return function(_0xfc0980){if(_0xfc0980){return _0x950867[_0x215c('0x1f')](_0x314367)[_0x215c('0x20')](_0xfc0980);}};}function respondWithFilteredResult(_0x1e1b5e,_0x320da5){return function(_0x17792c){if(_0x17792c){var _0x20d91f=typeof _0x320da5[_0x215c('0x21')]===_0x215c('0x22')&&typeof _0x320da5[_0x215c('0x23')]===_0x215c('0x22');var _0x41a1cc=_0x17792c[_0x215c('0x24')];var _0x298422=_0x20d91f?0x0:_0x320da5[_0x215c('0x21')];var _0x48d24f=_0x20d91f?_0x17792c[_0x215c('0x24')]:_0x320da5[_0x215c('0x21')]+_0x320da5['limit'];var _0xba9c45;if(_0x48d24f>=_0x41a1cc){_0x48d24f=_0x41a1cc;_0xba9c45=0xc8;}else{_0xba9c45=0xce;}_0x1e1b5e[_0x215c('0x1f')](_0xba9c45);return _0x1e1b5e[_0x215c('0x25')](_0x215c('0x26'),_0x298422+'-'+_0x48d24f+'/'+_0x41a1cc)['json'](_0x17792c);}return null;};}function patchUpdates(_0x40b288){return function(_0x14ccbb){try{jsonpatch[_0x215c('0x27')](_0x14ccbb,_0x40b288,!![]);}catch(_0x3d62fa){return BPromise[_0x215c('0x28')](_0x3d62fa);}return _0x14ccbb[_0x215c('0x29')]();};}function saveUpdates(_0x40e015,_0x519cb9){return function(_0x447d43){if(_0x447d43){return _0x447d43[_0x215c('0x2a')](_0x40e015)['then'](function(_0x36fd91){return _0x36fd91;});}return null;};}function removeEntity(_0x171720,_0x10f03a){return function(_0x54ba0c){if(_0x54ba0c){return _0x54ba0c[_0x215c('0x2b')]()[_0x215c('0x2c')](function(){_0x171720['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2852c6,_0x130156){return function(_0x7ec46e){if(!_0x7ec46e){_0x2852c6[_0x215c('0x1d')](0x194);}return _0x7ec46e;};}function handleError(_0xca7da0,_0x7d7e96){_0x7d7e96=_0x7d7e96||0x1f4;return function(_0x499d1f){logger['error'](_0x499d1f[_0x215c('0x2d')]);if(_0x499d1f['name']){delete _0x499d1f[_0x215c('0x2e')];}_0xca7da0[_0x215c('0x1f')](_0x7d7e96)[_0x215c('0x2f')](_0x499d1f);};}exports[_0x215c('0x30')]=function(_0x2cd649,_0x3b607d){var _0x503aae={},_0x321fe6={},_0x3e32e6={'count':0x0,'rows':[]};var _0x1a0030=_[_0x215c('0x31')](db[_0x215c('0x32')][_0x215c('0x33')],function(_0x1aaa0c){return{'name':_0x1aaa0c['fieldName'],'type':_0x1aaa0c[_0x215c('0x34')][_0x215c('0x35')]};});_0x321fe6[_0x215c('0x36')]=_['map'](_0x1a0030,_0x215c('0x2e'));_0x321fe6[_0x215c('0x37')]=_['keys'](_0x2cd649['query']);_0x321fe6[_0x215c('0x38')]=_['intersection'](_0x321fe6[_0x215c('0x36')],_0x321fe6['query']);_0x503aae[_0x215c('0x39')]=_['intersection'](_0x321fe6[_0x215c('0x36')],qs[_0x215c('0x3a')](_0x2cd649[_0x215c('0x37')][_0x215c('0x3a')]));_0x503aae[_0x215c('0x39')]=_0x503aae[_0x215c('0x39')][_0x215c('0x3b')]?_0x503aae[_0x215c('0x39')]:_0x321fe6[_0x215c('0x36')];if(!_0x2cd649[_0x215c('0x37')]['hasOwnProperty']('nolimit')){_0x503aae[_0x215c('0x23')]=qs[_0x215c('0x23')](_0x2cd649[_0x215c('0x37')][_0x215c('0x23')]);_0x503aae[_0x215c('0x21')]=qs['offset'](_0x2cd649[_0x215c('0x37')]['offset']);}_0x503aae[_0x215c('0x3c')]=qs[_0x215c('0x3d')](_0x2cd649[_0x215c('0x37')][_0x215c('0x3d')]);_0x503aae['where']=qs[_0x215c('0x38')](_[_0x215c('0x3e')](_0x2cd649[_0x215c('0x37')],_0x321fe6['filters']),_0x1a0030);if(_0x2cd649['query']['filter']){_0x503aae[_0x215c('0x3f')]=_['merge'](_0x503aae[_0x215c('0x3f')],{'$or':_[_0x215c('0x31')](_0x1a0030,function(_0x4aa184){if(_0x4aa184[_0x215c('0x34')]!==_0x215c('0x40')){var _0x46dc49={};_0x46dc49[_0x4aa184[_0x215c('0x2e')]]={'$like':'%'+_0x2cd649[_0x215c('0x37')][_0x215c('0x41')]+'%'};return _0x46dc49;}})});}_0x503aae=_[_0x215c('0x42')]({},_0x503aae,_0x2cd649['options']);var _0x3d032e={'where':_0x503aae[_0x215c('0x3f')]};return db[_0x215c('0x32')][_0x215c('0x24')](_0x3d032e)[_0x215c('0x2c')](function(_0x3223ce){_0x3e32e6[_0x215c('0x24')]=_0x3223ce;if(_0x2cd649[_0x215c('0x37')]['includeAll']){_0x503aae[_0x215c('0x43')]=[{'all':!![]}];}return db[_0x215c('0x32')]['findAll'](_0x503aae);})[_0x215c('0x2c')](function(_0x15aecb){_0x3e32e6[_0x215c('0x44')]=_0x15aecb;return _0x3e32e6;})[_0x215c('0x2c')](respondWithFilteredResult(_0x3b607d,_0x503aae))[_0x215c('0x45')](handleError(_0x3b607d,null));}; \ No newline at end of file +var _0x0299=['filter','where','type','VIRTUAL','merge','options','then','includeAll','findAll','rows','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','error','stack','index','rawAttributes','fieldName','key','model','map','name','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0299,0x1df));var _0x9029=function(_0x17b4b5,_0x28878a){_0x17b4b5=_0x17b4b5-0x0;var _0x30a930=_0x0299[_0x17b4b5];return _0x30a930;};'use strict';var emlformat=require(_0x9029('0x0'));var rimraf=require(_0x9029('0x1'));var zipdir=require(_0x9029('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9029('0x3'));var BPromise=require(_0x9029('0x4'));var Mustache=require(_0x9029('0x5'));var util=require('util');var path=require(_0x9029('0x6'));var sox=require(_0x9029('0x7'));var csv=require('to-csv');var ejs=require(_0x9029('0x8'));var fs=require('fs');var fs_extra=require(_0x9029('0x9'));var _=require(_0x9029('0xa'));var squel=require(_0x9029('0xb'));var crypto=require(_0x9029('0xc'));var jsforce=require(_0x9029('0xd'));var deskjs=require(_0x9029('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9029('0xf'));var Redis=require(_0x9029('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9029('0x11'));var as=require(_0x9029('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9029('0x13'))(_0x9029('0x14'));var utils=require(_0x9029('0x15'));var config=require(_0x9029('0x16'));var licenseUtil=require(_0x9029('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a983f,_0x26574b){_0x26574b=_0x26574b||0xcc;return function(_0x380ac6){if(_0x380ac6){return _0x2a983f[_0x9029('0x18')](_0x26574b);}return _0x2a983f[_0x9029('0x19')](_0x26574b)[_0x9029('0x1a')]();};}function respondWithResult(_0x171049,_0x7c2077){_0x7c2077=_0x7c2077||0xc8;return function(_0x11e89d){if(_0x11e89d){return _0x171049['status'](_0x7c2077)[_0x9029('0x1b')](_0x11e89d);}};}function respondWithFilteredResult(_0x2e9c9f,_0x3d51c8){return function(_0xa214c1){if(_0xa214c1){var _0x2ac1b3=typeof _0x3d51c8['offset']===_0x9029('0x1c')&&typeof _0x3d51c8[_0x9029('0x1d')]===_0x9029('0x1c');var _0x26aecb=_0xa214c1[_0x9029('0x1e')];var _0x33288b=_0x2ac1b3?0x0:_0x3d51c8[_0x9029('0x1f')];var _0x5a4d08=_0x2ac1b3?_0xa214c1['count']:_0x3d51c8[_0x9029('0x1f')]+_0x3d51c8[_0x9029('0x1d')];var _0x5dc0d3;if(_0x5a4d08>=_0x26aecb){_0x5a4d08=_0x26aecb;_0x5dc0d3=0xc8;}else{_0x5dc0d3=0xce;}_0x2e9c9f[_0x9029('0x19')](_0x5dc0d3);return _0x2e9c9f[_0x9029('0x20')](_0x9029('0x21'),_0x33288b+'-'+_0x5a4d08+'/'+_0x26aecb)['json'](_0xa214c1);}return null;};}function patchUpdates(_0x2546d3){return function(_0xe6490){try{jsonpatch[_0x9029('0x22')](_0xe6490,_0x2546d3,!![]);}catch(_0x4ce169){return BPromise[_0x9029('0x23')](_0x4ce169);}return _0xe6490[_0x9029('0x24')]();};}function saveUpdates(_0x2b6ec0,_0x19fa93){return function(_0x1ceb5f){if(_0x1ceb5f){return _0x1ceb5f['update'](_0x2b6ec0)['then'](function(_0x21fa03){return _0x21fa03;});}return null;};}function removeEntity(_0x399443,_0xd6a9ef){return function(_0x5dc834){if(_0x5dc834){return _0x5dc834[_0x9029('0x25')]()['then'](function(){_0x399443[_0x9029('0x19')](0xcc)[_0x9029('0x1a')]();});}};}function handleEntityNotFound(_0x54e1e0,_0x3746b1){return function(_0x53ab51){if(!_0x53ab51){_0x54e1e0['sendStatus'](0x194);}return _0x53ab51;};}function handleError(_0x3129cb,_0x12e9c5){_0x12e9c5=_0x12e9c5||0x1f4;return function(_0x4914e1){logger[_0x9029('0x26')](_0x4914e1[_0x9029('0x27')]);if(_0x4914e1['name']){delete _0x4914e1['name'];}_0x3129cb[_0x9029('0x19')](_0x12e9c5)['send'](_0x4914e1);};}exports[_0x9029('0x28')]=function(_0x11286e,_0x5a3600){var _0x553f56={},_0x3db79c={},_0x2a7aa2={'count':0x0,'rows':[]};var _0x4891cd=_['map'](db['Migration'][_0x9029('0x29')],function(_0x29df41){return{'name':_0x29df41[_0x9029('0x2a')],'type':_0x29df41['type'][_0x9029('0x2b')]};});_0x3db79c[_0x9029('0x2c')]=_[_0x9029('0x2d')](_0x4891cd,_0x9029('0x2e'));_0x3db79c['query']=_[_0x9029('0x2f')](_0x11286e[_0x9029('0x30')]);_0x3db79c['filters']=_[_0x9029('0x31')](_0x3db79c[_0x9029('0x2c')],_0x3db79c[_0x9029('0x30')]);_0x553f56[_0x9029('0x32')]=_[_0x9029('0x31')](_0x3db79c[_0x9029('0x2c')],qs[_0x9029('0x33')](_0x11286e[_0x9029('0x30')][_0x9029('0x33')]));_0x553f56[_0x9029('0x32')]=_0x553f56[_0x9029('0x32')]['length']?_0x553f56[_0x9029('0x32')]:_0x3db79c[_0x9029('0x2c')];if(!_0x11286e['query'][_0x9029('0x34')](_0x9029('0x35'))){_0x553f56['limit']=qs[_0x9029('0x1d')](_0x11286e[_0x9029('0x30')][_0x9029('0x1d')]);_0x553f56[_0x9029('0x1f')]=qs[_0x9029('0x1f')](_0x11286e[_0x9029('0x30')][_0x9029('0x1f')]);}_0x553f56[_0x9029('0x36')]=qs[_0x9029('0x37')](_0x11286e[_0x9029('0x30')]['sort']);_0x553f56['where']=qs['filters'](_['pick'](_0x11286e['query'],_0x3db79c[_0x9029('0x38')]),_0x4891cd);if(_0x11286e[_0x9029('0x30')][_0x9029('0x39')]){_0x553f56[_0x9029('0x3a')]=_['merge'](_0x553f56[_0x9029('0x3a')],{'$or':_[_0x9029('0x2d')](_0x4891cd,function(_0x195ffa){if(_0x195ffa[_0x9029('0x3b')]!==_0x9029('0x3c')){var _0x240800={};_0x240800[_0x195ffa[_0x9029('0x2e')]]={'$like':'%'+_0x11286e[_0x9029('0x30')][_0x9029('0x39')]+'%'};return _0x240800;}})});}_0x553f56=_[_0x9029('0x3d')]({},_0x553f56,_0x11286e[_0x9029('0x3e')]);var _0x49701d={'where':_0x553f56[_0x9029('0x3a')]};return db['Migration']['count'](_0x49701d)[_0x9029('0x3f')](function(_0x3c5aac){_0x2a7aa2[_0x9029('0x1e')]=_0x3c5aac;if(_0x11286e[_0x9029('0x30')][_0x9029('0x40')]){_0x553f56['include']=[{'all':!![]}];}return db['Migration'][_0x9029('0x41')](_0x553f56);})[_0x9029('0x3f')](function(_0x390d76){_0x2a7aa2[_0x9029('0x42')]=_0x390d76;return _0x2a7aa2;})[_0x9029('0x3f')](respondWithFilteredResult(_0x5a3600,_0x553f56))['catch'](handleError(_0x5a3600,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f026e7a..b0c3942 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 _0xf990=['util','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','lodash'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0xf990,0xfb));var _0x0f99=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0xf990[_0x29bf80];return _0x932096;};'use strict';var _=require(_0x0f99('0x0'));var util=require(_0x0f99('0x1'));var logger=require(_0x0f99('0x2'))(_0x0f99('0x3'));var moment=require(_0x0f99('0x4'));var BPromise=require(_0x0f99('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0f99('0x6'));var attributes=require('./migration.attributes');module[_0x0f99('0x7')]=function(_0x5da1bf,_0x568174){return _0x5da1bf[_0x0f99('0x8')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96bf=['../../config/logger','api','moment','request-promise','../../config/environment','./migration.attributes','exports','define','Migration','lodash','util'];(function(_0x1dc065,_0x1ed5fb){var _0xd91173=function(_0xd5607){while(--_0xd5607){_0x1dc065['push'](_0x1dc065['shift']());}};_0xd91173(++_0x1ed5fb);}(_0x96bf,0x98));var _0xf96b=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x96bf[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0xf96b('0x0'));var util=require(_0xf96b('0x1'));var logger=require(_0xf96b('0x2'))(_0xf96b('0x3'));var moment=require(_0xf96b('0x4'));var BPromise=require('bluebird');var rp=require(_0xf96b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf96b('0x6'));var attributes=require(_0xf96b('0x7'));module[_0xf96b('0x8')]=function(_0x58c834,_0x42f3cb){return _0x58c834[_0xf96b('0x9')](_0xf96b('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5d68e95..93e12e1 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 _0x0434=['../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x0434,0x1ad));var _0x4043=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x0434[_0x487496];return _0x539dc8;};'use strict';var _=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var moment=require(_0x4043('0x2'));var BPromise=require(_0x4043('0x3'));var rs=require(_0x4043('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4043('0x5'));var logger=require(_0x4043('0x6'))(_0x4043('0x7'));var config=require(_0x4043('0x8'));var jayson=require(_0x4043('0x9'));var client=jayson[_0x4043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d0a9,_0x1ed6c4,_0x5080e5){return new BPromise(function(_0x56355c,_0x14694d){return client[_0x4043('0xb')](_0x41d0a9,_0x5080e5)[_0x4043('0xc')](function(_0x31cb1f){logger[_0x4043('0xd')](_0x4043('0xe'),_0x1ed6c4,_0x4043('0xf'));logger[_0x4043('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x1ed6c4,_0x4043('0xf'),JSON[_0x4043('0x11')](_0x31cb1f));if(_0x31cb1f[_0x4043('0x12')]){if(_0x31cb1f[_0x4043('0x12')][_0x4043('0x13')]===0x1f4){logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);return _0x14694d(_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);}logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);return _0x56355c(_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);}else{logger[_0x4043('0xd')](_0x4043('0xe'),_0x1ed6c4,_0x4043('0xf'));_0x56355c(_0x31cb1f[_0x4043('0x15')][_0x4043('0x14')]);}})[_0x4043('0x16')](function(_0x38aefa){logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x38aefa);_0x14694d(_0x38aefa);});});} \ No newline at end of file +var _0x9086=['debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x4954c8,_0x49dd98){var _0x248047=function(_0x56f9c6){while(--_0x56f9c6){_0x4954c8['push'](_0x4954c8['shift']());}};_0x248047(++_0x49dd98);}(_0x9086,0x10b));var _0x6908=function(_0x43c680,_0x553703){_0x43c680=_0x43c680-0x0;var _0x4af29c=_0x9086[_0x43c680];return _0x4af29c;};'use strict';var _=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var moment=require('moment');var BPromise=require(_0x6908('0x2'));var rs=require(_0x6908('0x3'));var fs=require('fs');var Redis=require(_0x6908('0x4'));var db=require(_0x6908('0x5'))['db'];var utils=require(_0x6908('0x6'));var logger=require(_0x6908('0x7'))('rpc');var config=require(_0x6908('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6908('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8ff0,_0xd81571,_0x2049a1){return new BPromise(function(_0x2ce577,_0x56df93){return client[_0x6908('0xa')](_0x4e8ff0,_0x2049a1)['then'](function(_0x1efa71){logger['info'](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));logger[_0x6908('0xd')](_0x6908('0xe'),_0xd81571,_0x6908('0xc'),JSON['stringify'](_0x1efa71));if(_0x1efa71[_0x6908('0xf')]){if(_0x1efa71[_0x6908('0xf')][_0x6908('0x10')]===0x1f4){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);return _0x56df93(_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);}logger['error'](_0x6908('0xb'),_0xd81571,_0x1efa71['error'][_0x6908('0x11')]);return _0x2ce577(_0x1efa71[_0x6908('0xf')]['message']);}else{logger[_0x6908('0x12')](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));_0x2ce577(_0x1efa71[_0x6908('0x13')][_0x6908('0x11')]);}})['catch'](function(_0x538ad1){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x538ad1);_0x56df93(_0x538ad1);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f3c46bf..60b07a9 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 _0x6659=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x8bc67a,_0x3bef32){var _0x2b9783=function(_0x43cd67){while(--_0x43cd67){_0x8bc67a['push'](_0x8bc67a['shift']());}};_0x2b9783(++_0x3bef32);}(_0x6659,0x169));var _0x9665=function(_0x4800aa,_0x3a8cdc){_0x4800aa=_0x4800aa-0x0;var _0x548866=_0x6659[_0x4800aa];return _0x548866;};'use strict';var multer=require(_0x9665('0x0'));var util=require(_0x9665('0x1'));var path=require(_0x9665('0x2'));var timeout=require(_0x9665('0x3'));var express=require(_0x9665('0x4'));var router=express[_0x9665('0x5')]();var fs_extra=require(_0x9665('0x6'));var auth=require(_0x9665('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9665('0x8'));var controller=require(_0x9665('0x9'));router[_0x9665('0xa')]('/',auth[_0x9665('0xb')](),controller[_0x9665('0xc')]);router[_0x9665('0xa')]('/:id',auth[_0x9665('0xb')](),controller[_0x9665('0xd')]);router[_0x9665('0xe')]('/',auth[_0x9665('0xb')](),controller[_0x9665('0xf')]);router[_0x9665('0x10')](_0x9665('0x11'),auth[_0x9665('0xb')](),controller[_0x9665('0x12')]);router[_0x9665('0x13')](_0x9665('0x11'),auth[_0x9665('0xb')](),controller['destroy']);module[_0x9665('0x14')]=router; \ No newline at end of file +var _0xa81d=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','index','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util'];(function(_0x465404,_0x3db2ce){var _0x426f8a=function(_0xab75bd){while(--_0xab75bd){_0x465404['push'](_0x465404['shift']());}};_0x426f8a(++_0x3db2ce);}(_0xa81d,0x11e));var _0xda81=function(_0x59dfec,_0x2409e7){_0x59dfec=_0x59dfec-0x0;var _0x1e194a=_0xa81d[_0x59dfec];return _0x1e194a;};'use strict';var multer=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var path=require('path');var timeout=require(_0xda81('0x2'));var express=require('express');var router=express[_0xda81('0x3')]();var fs_extra=require(_0xda81('0x4'));var auth=require(_0xda81('0x5'));var interaction=require(_0xda81('0x6'));var config=require(_0xda81('0x7'));var controller=require(_0xda81('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xda81('0x9')]);router['get'](_0xda81('0xa'),auth[_0xda81('0xb')](),controller[_0xda81('0xc')]);router[_0xda81('0xd')]('/',auth[_0xda81('0xb')](),controller[_0xda81('0xe')]);router['put']('/:id',auth[_0xda81('0xb')](),controller['update']);router[_0xda81('0xf')](_0xda81('0xa'),auth[_0xda81('0xb')](),controller[_0xda81('0x10')]);module[_0xda81('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 88d117a..4d948f6 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 _0xd22c=['sequelize','localnet','externip','stun','turn','STRING'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xd22c,0x9c));var _0xcd22=function(_0x40b898,_0x2fd575){_0x40b898=_0x40b898-0x0;var _0x2ff0bb=_0xd22c[_0x40b898];return _0x2ff0bb;};'use strict';var Sequelize=require(_0xcd22('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xcd22('0x1'),_0xcd22('0x2'),_0xcd22('0x3'),_0xcd22('0x4'))},'value':{'type':Sequelize[_0xcd22('0x5')]},'username':{'type':Sequelize[_0xcd22('0x5')]},'password':{'type':Sequelize[_0xcd22('0x5')]}}; \ No newline at end of file +var _0x34a4=['exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x34a4,0x1b2));var _0x434a=function(_0x2bb285,_0x154426){_0x2bb285=_0x2bb285-0x0;var _0xeac565=_0x34a4[_0x2bb285];return _0xeac565;};'use strict';var Sequelize=require('sequelize');module[_0x434a('0x0')]={'type':{'type':Sequelize[_0x434a('0x1')](_0x434a('0x2'),_0x434a('0x3'),_0x434a('0x4'),_0x434a('0x5'))},'value':{'type':Sequelize[_0x434a('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x434a('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c260d55..44e79e7 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 _0x369d=['findAll','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','TURN','toLowerCase','util','path','lodash','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','json','offset','limit','count','status','set','update','then','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','length','include','options','find','create','body'];(function(_0x3e1750,_0x43d206){var _0x2b5681=function(_0xe66848){while(--_0xe66848){_0x3e1750['push'](_0x3e1750['shift']());}};_0x2b5681(++_0x43d206);}(_0x369d,0x1c3));var _0xd369=function(_0x433e71,_0x55f699){_0x433e71=_0x433e71-0x0;var _0x3041ab=_0x369d[_0x433e71];return _0x3041ab;};'use strict';var util=require(_0xd369('0x0'));var path=require(_0xd369('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd369('0x2'));var qs=require(_0xd369('0x3'));var logger=require('../../config/logger')(_0xd369('0x4'));var config=require('../../config/environment');var db=require(_0xd369('0x5'))['db'];var jayson=require(_0xd369('0x6'));var client=jayson[_0xd369('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x505e14,_0x14cf79,_0x17f075,_0x150e87){return new Promise(function(_0x56bdf2,_0x402021){var _0x25265b=_0x150e87||client;return _0x25265b[_0xd369('0x8')](_0x505e14,_0x17f075)['then'](function(_0x53c4a8){logger[_0xd369('0x9')](_0xd369('0xa'),_0x14cf79,_0xd369('0xb'));logger[_0xd369('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x14cf79,'request\x20sent',JSON[_0xd369('0xd')](_0x53c4a8));if(_0x53c4a8[_0xd369('0xe')]){if(_0x53c4a8[_0xd369('0xe')][_0xd369('0xf')]===0x1f4){logger[_0xd369('0xe')](_0xd369('0xa'),_0x14cf79,_0x53c4a8[_0xd369('0xe')]['message']);return _0x402021(_0x53c4a8[_0xd369('0xe')][_0xd369('0x10')]);}logger['error'](_0xd369('0xa'),_0x14cf79,_0x53c4a8[_0xd369('0xe')][_0xd369('0x10')]);return _0x56bdf2(_0x53c4a8['error'][_0xd369('0x10')]);}else{logger[_0xd369('0x9')](_0xd369('0xa'),_0x14cf79,_0xd369('0xb'));_0x56bdf2(_0x53c4a8[_0xd369('0x11')][_0xd369('0x10')]);}})[_0xd369('0x12')](function(_0x42a1a6){logger[_0xd369('0xe')]('Network,\x20%s,\x20%s',_0x14cf79,_0x42a1a6);_0x402021(_0x42a1a6);});});}function respondWithResult(_0x276145,_0x3827e){_0x3827e=_0x3827e||0xc8;return function(_0x149d76){if(_0x149d76){return _0x276145['status'](_0x3827e)[_0xd369('0x13')](_0x149d76);}};}function respondWithFilteredResult(_0x4e7905,_0x174606){return function(_0x3cb21e){if(_0x3cb21e){var _0x1f6312=typeof _0x174606[_0xd369('0x14')]==='undefined'&&typeof _0x174606[_0xd369('0x15')]==='undefined';var _0x3c1128=_0x3cb21e[_0xd369('0x16')];var _0x2ea4dd=_0x1f6312?0x0:_0x174606[_0xd369('0x14')];var _0x2dea85=_0x1f6312?_0x3cb21e[_0xd369('0x16')]:_0x174606[_0xd369('0x14')]+_0x174606[_0xd369('0x15')];var _0x4b8040;if(_0x2dea85>=_0x3c1128){_0x2dea85=_0x3c1128;_0x4b8040=0xc8;}else{_0x4b8040=0xce;}_0x4e7905[_0xd369('0x17')](_0x4b8040);return _0x4e7905[_0xd369('0x18')]('Content-Range',_0x2ea4dd+'-'+_0x2dea85+'/'+_0x3c1128)[_0xd369('0x13')](_0x3cb21e);}return null;};}function saveUpdates(_0x3d9ddb){return function(_0x42b5a6){if(_0x42b5a6){return _0x42b5a6[_0xd369('0x19')](_0x3d9ddb)[_0xd369('0x1a')](function(_0x2c03f8){return _0x2c03f8;});}return null;};}function removeEntity(_0x1c4c34){return function(_0x52cfe1){if(_0x52cfe1){return _0x52cfe1[_0xd369('0x1b')]()['then'](function(){_0x1c4c34['status'](0xcc)[_0xd369('0x1c')]();});}};}function handleEntityNotFound(_0x13f36e){return function(_0x345eff){if(!_0x345eff){_0x13f36e[_0xd369('0x1d')](0x194);}return _0x345eff;};}function handleError(_0x572b17,_0x2cf07e){_0x2cf07e=_0x2cf07e||0x1f4;return function(_0x1cfa2f){logger[_0xd369('0xe')](_0x1cfa2f[_0xd369('0x1e')]);if(_0x1cfa2f[_0xd369('0x1f')]){delete _0x1cfa2f[_0xd369('0x1f')];}_0x572b17[_0xd369('0x17')](_0x2cf07e)[_0xd369('0x20')](_0x1cfa2f);};}exports[_0xd369('0x21')]=function(_0xaa493d,_0x164d2d){var _0x3de9b8={},_0x18a90f={},_0x3e86f5={'count':0x0,'rows':[]};var _0x342c0b=_[_0xd369('0x22')](db[_0xd369('0x23')][_0xd369('0x24')],function(_0xcf0c25){return{'name':_0xcf0c25[_0xd369('0x25')],'type':_0xcf0c25[_0xd369('0x26')][_0xd369('0x27')]};});_0x18a90f[_0xd369('0x28')]=_[_0xd369('0x22')](_0x342c0b,_0xd369('0x1f'));_0x18a90f['query']=_[_0xd369('0x29')](_0xaa493d['query']);_0x18a90f[_0xd369('0x2a')]=_[_0xd369('0x2b')](_0x18a90f[_0xd369('0x28')],_0x18a90f[_0xd369('0x2c')]);_0x3de9b8[_0xd369('0x2d')]=_[_0xd369('0x2b')](_0x18a90f[_0xd369('0x28')],qs[_0xd369('0x2e')](_0xaa493d['query']['fields']));_0x3de9b8[_0xd369('0x2d')]=_0x3de9b8[_0xd369('0x2d')]['length']?_0x3de9b8['attributes']:_0x18a90f[_0xd369('0x28')];if(!_0xaa493d[_0xd369('0x2c')][_0xd369('0x2f')]('nolimit')){_0x3de9b8[_0xd369('0x15')]=qs[_0xd369('0x15')](_0xaa493d[_0xd369('0x2c')][_0xd369('0x15')]);_0x3de9b8['offset']=qs[_0xd369('0x14')](_0xaa493d[_0xd369('0x2c')][_0xd369('0x14')]);}_0x3de9b8[_0xd369('0x30')]=qs[_0xd369('0x31')](_0xaa493d[_0xd369('0x2c')][_0xd369('0x31')]);_0x3de9b8[_0xd369('0x32')]=qs[_0xd369('0x2a')](_[_0xd369('0x33')](_0xaa493d[_0xd369('0x2c')],_0x18a90f[_0xd369('0x2a')]),_0x342c0b);if(_0xaa493d[_0xd369('0x2c')][_0xd369('0x34')]){_0x3de9b8['where']=_[_0xd369('0x35')](_0x3de9b8[_0xd369('0x32')],{'$or':_[_0xd369('0x22')](_0x342c0b,function(_0x12ec62){if(_0x12ec62[_0xd369('0x26')]!==_0xd369('0x36')){var _0x22248a={};_0x22248a[_0x12ec62[_0xd369('0x1f')]]={'$like':'%'+_0xaa493d[_0xd369('0x2c')][_0xd369('0x34')]+'%'};return _0x22248a;}})});}_0x3de9b8=_['merge']({},_0x3de9b8,_0xaa493d['options']);var _0xb752e7={'where':_0x3de9b8['where']};return db[_0xd369('0x23')]['count'](_0xb752e7)[_0xd369('0x1a')](function(_0x40ba3a){_0x3e86f5[_0xd369('0x16')]=_0x40ba3a;if(_0xaa493d[_0xd369('0x2c')][_0xd369('0x37')]){_0x3de9b8['include']=[{'all':!![]}];}return db[_0xd369('0x23')]['findAll'](_0x3de9b8);})['then'](function(_0x5c0cb2){_0x3e86f5[_0xd369('0x38')]=_0x5c0cb2;return _0x3e86f5;})[_0xd369('0x1a')](respondWithFilteredResult(_0x164d2d,_0x3de9b8))['catch'](handleError(_0x164d2d,null));};exports[_0xd369('0x39')]=function(_0x51ed9c,_0xaefee7){var _0x5f3051={'raw':!![],'where':{'id':_0x51ed9c[_0xd369('0x3a')]['id']}},_0x592dec={};_0x592dec[_0xd369('0x28')]=_[_0xd369('0x29')](db[_0xd369('0x23')][_0xd369('0x24')]);_0x592dec[_0xd369('0x2c')]=_[_0xd369('0x29')](_0x51ed9c['query']);_0x592dec[_0xd369('0x2a')]=_['intersection'](_0x592dec[_0xd369('0x28')],_0x592dec['query']);_0x5f3051[_0xd369('0x2d')]=_[_0xd369('0x2b')](_0x592dec['model'],qs[_0xd369('0x2e')](_0x51ed9c[_0xd369('0x2c')][_0xd369('0x2e')]));_0x5f3051[_0xd369('0x2d')]=_0x5f3051[_0xd369('0x2d')][_0xd369('0x3b')]?_0x5f3051[_0xd369('0x2d')]:_0x592dec[_0xd369('0x28')];if(_0x51ed9c[_0xd369('0x2c')][_0xd369('0x37')]){_0x5f3051[_0xd369('0x3c')]=[{'all':!![]}];}_0x5f3051=_['merge']({},_0x5f3051,_0x51ed9c[_0xd369('0x3d')]);return db[_0xd369('0x23')][_0xd369('0x3e')](_0x5f3051)[_0xd369('0x1a')](handleEntityNotFound(_0xaefee7,null))[_0xd369('0x1a')](respondWithResult(_0xaefee7,null))['catch'](handleError(_0xaefee7,null));};exports[_0xd369('0x3f')]=function(_0x164eac,_0x4e18e7){var _0x5d29c6;return db['Network'][_0xd369('0x3f')](_0x164eac[_0xd369('0x40')],{'raw':!![]})['then'](function(_0x49e761){_0x5d29c6=_0x49e761;return db[_0xd369('0x23')][_0xd369('0x41')]({'where':{'type':_0x164eac[_0xd369('0x40')][_0xd369('0x26')]},'raw':!![]});})['then'](function(_0x4efb07){if(_0x5d29c6['type']['toUpperCase']()==_0xd369('0x42')){var _0x415fe2=fs[_0xd369('0x43')](path[_0xd369('0x44')](config[_0xd369('0x45')],_0xd369('0x46')),'utf8');var _0xf4d65=ejs[_0xd369('0x47')](_0x415fe2,{'networks':_0x4efb07||[]});fs['writeFileSync'](_0xd369('0x48'),_0xf4d65);return respondWithRpcPromise(_0xd369('0x49'),'create',{'module':'res_stun_monitor.so'});}else if(_0x5d29c6[_0xd369('0x26')][_0xd369('0x4a')]()=='TURN'){var _0x26936e=fs[_0xd369('0x43')](path[_0xd369('0x44')](config[_0xd369('0x45')],_0xd369('0x4b')),'utf8');var _0xa4e0d0=ejs[_0xd369('0x47')](_0x26936e,{'networks':_0x4efb07||[]});fs[_0xd369('0x4c')](_0xd369('0x4d'),_0xa4e0d0);return respondWithRpcPromise(_0xd369('0x49'),_0xd369('0x3f'),{'module':_0xd369('0x4e')});}else{var _0x52358c=fs[_0xd369('0x43')](path[_0xd369('0x44')](config['root'],_0xd369('0x4f')),_0xd369('0x50'));var _0x1df225=ejs[_0xd369('0x47')](_0x52358c,{'networks':_0x4efb07||[]});fs['writeFileSync'](util[_0xd369('0x51')](_0xd369('0x52'),_0x164eac[_0xd369('0x40')]['type']['toLowerCase']()),_0x1df225);return respondWithRpcPromise('Reload','create',{'module':_0xd369('0x53')});}})['then'](function(){return _0x5d29c6;})[_0xd369('0x1a')](respondWithResult(_0x4e18e7,0xc9))[_0xd369('0x12')](handleError(_0x4e18e7,null));};exports[_0xd369('0x19')]=function(_0x450261,_0x33789b){var _0x28e84e;return db['Network']['find']({'where':{'id':_0x450261[_0xd369('0x3a')]['id']}})[_0xd369('0x1a')](handleEntityNotFound(_0x33789b,null))[_0xd369('0x1a')](saveUpdates(_0x450261['body'],null))['then'](function(_0x4dcbb7){if(_0x4dcbb7){_0x28e84e=_0x4dcbb7;return db[_0xd369('0x23')]['findAll']({'where':{'type':_0x28e84e['type']},'raw':!![]});}return null;})[_0xd369('0x1a')](function(_0x44c463){if(_0x28e84e[_0xd369('0x26')][_0xd369('0x4a')]()==_0xd369('0x42')){var _0x3adafe=fs['readFileSync'](path['join'](config[_0xd369('0x45')],_0xd369('0x46')),'utf8');var _0x449d67=ejs['render'](_0x3adafe,{'networks':_0x44c463||[]});fs['writeFileSync'](_0xd369('0x48'),_0x449d67);return respondWithRpcPromise(_0xd369('0x49'),_0xd369('0x19'),{'module':_0xd369('0x4e')});}else if(_0x28e84e[_0xd369('0x26')][_0xd369('0x4a')]()==_0xd369('0x54')){var _0x4d9d72=fs['readFileSync'](path[_0xd369('0x44')](config[_0xd369('0x45')],_0xd369('0x4b')),_0xd369('0x50'));var _0x4aa4c1=ejs['render'](_0x4d9d72,{'networks':_0x44c463||[]});fs[_0xd369('0x4c')](_0xd369('0x4d'),_0x4aa4c1);return respondWithRpcPromise(_0xd369('0x49'),_0xd369('0x19'),{'module':_0xd369('0x4e')});}else{var _0x192330=fs[_0xd369('0x43')](path['join'](config[_0xd369('0x45')],_0xd369('0x4f')),_0xd369('0x50'));var _0x29c031=ejs[_0xd369('0x47')](_0x192330,{'networks':_0x44c463||[]});fs[_0xd369('0x4c')](util[_0xd369('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x450261['body'][_0xd369('0x26')][_0xd369('0x55')]()),_0x29c031);return respondWithRpcPromise(_0xd369('0x49'),'update',{'module':_0xd369('0x53')});}})[_0xd369('0x1a')](function(_0x3d720f){if(_0x3d720f){return _0x28e84e;}return null;})[_0xd369('0x1a')](respondWithResult(_0x33789b,null))[_0xd369('0x12')](handleError(_0x33789b,null));};exports[_0xd369('0x1b')]=function(_0x1e2c36,_0xb132c9){var _0x148b23;return db[_0xd369('0x23')][_0xd369('0x3e')]({'where':{'id':_0x1e2c36[_0xd369('0x3a')]['id']}})[_0xd369('0x1a')](function(_0x441ec0){_0x148b23=_0x441ec0;return _0x441ec0;})[_0xd369('0x1a')](handleEntityNotFound(_0xb132c9,null))[_0xd369('0x1a')](removeEntity(_0xb132c9,null))[_0xd369('0x1a')](function(){if(_0x148b23){return db[_0xd369('0x23')]['findAll']({'where':{'type':_0x148b23['type']},'raw':!![]});}})[_0xd369('0x1a')](function(_0x19b353){if(_0x148b23[_0xd369('0x26')][_0xd369('0x4a')]()==_0xd369('0x42')){var _0x32c590=fs[_0xd369('0x43')](path[_0xd369('0x44')](config[_0xd369('0x45')],_0xd369('0x46')),_0xd369('0x50'));var _0x489153=ejs[_0xd369('0x47')](_0x32c590,{'networks':_0x19b353||[]});fs['writeFileSync'](_0xd369('0x48'),_0x489153);return respondWithRpcPromise('Reload','destroy',{'module':_0xd369('0x4e')});}else if(_0x148b23['type'][_0xd369('0x4a')]()==_0xd369('0x54')){var _0x86d1f8=fs[_0xd369('0x43')](path['join'](config[_0xd369('0x45')],_0xd369('0x4b')),'utf8');var _0x1b3032=ejs['render'](_0x86d1f8,{'networks':_0x19b353||[]});fs[_0xd369('0x4c')](_0xd369('0x4d'),_0x1b3032);return respondWithRpcPromise(_0xd369('0x49'),_0xd369('0x1b'),{'module':_0xd369('0x4e')});}else{var _0x41d83a=fs['readFileSync'](path[_0xd369('0x44')](config[_0xd369('0x45')],_0xd369('0x4f')),'utf8');var _0x3f6602=ejs[_0xd369('0x47')](_0x41d83a,{'networks':_0x19b353||[]});fs[_0xd369('0x4c')](util[_0xd369('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x148b23['type'][_0xd369('0x55')]()),_0x3f6602);return respondWithRpcPromise(_0xd369('0x49'),_0xd369('0x1b'),{'module':_0xd369('0x53')});}})[_0xd369('0x12')](handleError(_0xb132c9,null));}; \ No newline at end of file +var _0xa363=['request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','catch','status','undefined','limit','count','offset','set','update','end','sendStatus','stack','name','index','map','Network','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','toUpperCase','readFileSync','server/files/templates/stun_multiple.ejs','render','writeFileSync','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','STUN','/etc/asterisk/stun_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s'];(function(_0x459e98,_0x2454fe){var _0x1e5005=function(_0x1bfa32){while(--_0x1bfa32){_0x459e98['push'](_0x459e98['shift']());}};_0x1e5005(++_0x2454fe);}(_0xa363,0x1d7));var _0x3a36=function(_0x26a08b,_0x2b3db4){_0x26a08b=_0x26a08b-0x0;var _0x422b1b=_0xa363[_0x26a08b];return _0x422b1b;};'use strict';var util=require(_0x3a36('0x0'));var path=require(_0x3a36('0x1'));var ejs=require(_0x3a36('0x2'));var fs=require('fs');var _=require(_0x3a36('0x3'));var qs=require(_0x3a36('0x4'));var logger=require(_0x3a36('0x5'))(_0x3a36('0x6'));var config=require(_0x3a36('0x7'));var db=require(_0x3a36('0x8'))['db'];var jayson=require(_0x3a36('0x9'));var client=jayson[_0x3a36('0xa')][_0x3a36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd118ce,_0x199f6b,_0x5e41e7,_0x88bf99){return new Promise(function(_0x588d00,_0x114fee){var _0xd11cc4=_0x88bf99||client;return _0xd11cc4['request'](_0xd118ce,_0x5e41e7)[_0x3a36('0xc')](function(_0x3f088d){logger[_0x3a36('0xd')](_0x3a36('0xe'),_0x199f6b,_0x3a36('0xf'));logger['debug'](_0x3a36('0x10'),_0x199f6b,_0x3a36('0xf'),JSON['stringify'](_0x3f088d));if(_0x3f088d['error']){if(_0x3f088d[_0x3a36('0x11')]['code']===0x1f4){logger[_0x3a36('0x11')]('Network,\x20%s,\x20%s',_0x199f6b,_0x3f088d[_0x3a36('0x11')]['message']);return _0x114fee(_0x3f088d[_0x3a36('0x11')]['message']);}logger[_0x3a36('0x11')](_0x3a36('0xe'),_0x199f6b,_0x3f088d[_0x3a36('0x11')][_0x3a36('0x12')]);return _0x588d00(_0x3f088d[_0x3a36('0x11')]['message']);}else{logger[_0x3a36('0xd')](_0x3a36('0xe'),_0x199f6b,_0x3a36('0xf'));_0x588d00(_0x3f088d['result']['message']);}})[_0x3a36('0x13')](function(_0x1947b4){logger['error'](_0x3a36('0xe'),_0x199f6b,_0x1947b4);_0x114fee(_0x1947b4);});});}function respondWithResult(_0x2d5518,_0x2d0c75){_0x2d0c75=_0x2d0c75||0xc8;return function(_0xdf8bfa){if(_0xdf8bfa){return _0x2d5518[_0x3a36('0x14')](_0x2d0c75)['json'](_0xdf8bfa);}};}function respondWithFilteredResult(_0x15c6cf,_0x523955){return function(_0x3cd960){if(_0x3cd960){var _0x340ab2=typeof _0x523955['offset']===_0x3a36('0x15')&&typeof _0x523955[_0x3a36('0x16')]==='undefined';var _0x20d12f=_0x3cd960[_0x3a36('0x17')];var _0x5add4b=_0x340ab2?0x0:_0x523955[_0x3a36('0x18')];var _0x39f8d2=_0x340ab2?_0x3cd960[_0x3a36('0x17')]:_0x523955[_0x3a36('0x18')]+_0x523955['limit'];var _0x20c2c5;if(_0x39f8d2>=_0x20d12f){_0x39f8d2=_0x20d12f;_0x20c2c5=0xc8;}else{_0x20c2c5=0xce;}_0x15c6cf[_0x3a36('0x14')](_0x20c2c5);return _0x15c6cf[_0x3a36('0x19')]('Content-Range',_0x5add4b+'-'+_0x39f8d2+'/'+_0x20d12f)['json'](_0x3cd960);}return null;};}function saveUpdates(_0x50e4e8){return function(_0x2dc06f){if(_0x2dc06f){return _0x2dc06f[_0x3a36('0x1a')](_0x50e4e8)[_0x3a36('0xc')](function(_0x2fbb0e){return _0x2fbb0e;});}return null;};}function removeEntity(_0x548132){return function(_0x16f8f2){if(_0x16f8f2){return _0x16f8f2['destroy']()[_0x3a36('0xc')](function(){_0x548132[_0x3a36('0x14')](0xcc)[_0x3a36('0x1b')]();});}};}function handleEntityNotFound(_0x39d280){return function(_0x5ab00c){if(!_0x5ab00c){_0x39d280[_0x3a36('0x1c')](0x194);}return _0x5ab00c;};}function handleError(_0x12d7a3,_0xab113c){_0xab113c=_0xab113c||0x1f4;return function(_0x390208){logger[_0x3a36('0x11')](_0x390208[_0x3a36('0x1d')]);if(_0x390208['name']){delete _0x390208[_0x3a36('0x1e')];}_0x12d7a3['status'](_0xab113c)['send'](_0x390208);};}exports[_0x3a36('0x1f')]=function(_0x44203f,_0x2b5d53){var _0x884ec3={},_0x464680={},_0xf25c7f={'count':0x0,'rows':[]};var _0x1d13a4=_[_0x3a36('0x20')](db[_0x3a36('0x21')]['rawAttributes'],function(_0x4c58b2){return{'name':_0x4c58b2['fieldName'],'type':_0x4c58b2['type'][_0x3a36('0x22')]};});_0x464680[_0x3a36('0x23')]=_['map'](_0x1d13a4,_0x3a36('0x1e'));_0x464680[_0x3a36('0x24')]=_[_0x3a36('0x25')](_0x44203f[_0x3a36('0x24')]);_0x464680[_0x3a36('0x26')]=_[_0x3a36('0x27')](_0x464680[_0x3a36('0x23')],_0x464680[_0x3a36('0x24')]);_0x884ec3[_0x3a36('0x28')]=_[_0x3a36('0x27')](_0x464680[_0x3a36('0x23')],qs[_0x3a36('0x29')](_0x44203f['query'][_0x3a36('0x29')]));_0x884ec3['attributes']=_0x884ec3[_0x3a36('0x28')][_0x3a36('0x2a')]?_0x884ec3[_0x3a36('0x28')]:_0x464680[_0x3a36('0x23')];if(!_0x44203f['query']['hasOwnProperty']('nolimit')){_0x884ec3[_0x3a36('0x16')]=qs[_0x3a36('0x16')](_0x44203f[_0x3a36('0x24')][_0x3a36('0x16')]);_0x884ec3[_0x3a36('0x18')]=qs['offset'](_0x44203f[_0x3a36('0x24')][_0x3a36('0x18')]);}_0x884ec3[_0x3a36('0x2b')]=qs[_0x3a36('0x2c')](_0x44203f[_0x3a36('0x24')][_0x3a36('0x2c')]);_0x884ec3[_0x3a36('0x2d')]=qs[_0x3a36('0x26')](_[_0x3a36('0x2e')](_0x44203f[_0x3a36('0x24')],_0x464680[_0x3a36('0x26')]),_0x1d13a4);if(_0x44203f[_0x3a36('0x24')][_0x3a36('0x2f')]){_0x884ec3[_0x3a36('0x2d')]=_['merge'](_0x884ec3[_0x3a36('0x2d')],{'$or':_[_0x3a36('0x20')](_0x1d13a4,function(_0x118186){if(_0x118186[_0x3a36('0x30')]!=='VIRTUAL'){var _0x565768={};_0x565768[_0x118186[_0x3a36('0x1e')]]={'$like':'%'+_0x44203f[_0x3a36('0x24')][_0x3a36('0x2f')]+'%'};return _0x565768;}})});}_0x884ec3=_[_0x3a36('0x31')]({},_0x884ec3,_0x44203f['options']);var _0x3f7f07={'where':_0x884ec3[_0x3a36('0x2d')]};return db[_0x3a36('0x21')][_0x3a36('0x17')](_0x3f7f07)[_0x3a36('0xc')](function(_0xcad1c2){_0xf25c7f[_0x3a36('0x17')]=_0xcad1c2;if(_0x44203f['query'][_0x3a36('0x32')]){_0x884ec3[_0x3a36('0x33')]=[{'all':!![]}];}return db[_0x3a36('0x21')][_0x3a36('0x34')](_0x884ec3);})[_0x3a36('0xc')](function(_0x1dbb9e){_0xf25c7f[_0x3a36('0x35')]=_0x1dbb9e;return _0xf25c7f;})['then'](respondWithFilteredResult(_0x2b5d53,_0x884ec3))[_0x3a36('0x13')](handleError(_0x2b5d53,null));};exports[_0x3a36('0x36')]=function(_0x5dc4e0,_0x5abc88){var _0x3d436f={'raw':!![],'where':{'id':_0x5dc4e0[_0x3a36('0x37')]['id']}},_0x301365={};_0x301365[_0x3a36('0x23')]=_[_0x3a36('0x25')](db[_0x3a36('0x21')]['rawAttributes']);_0x301365[_0x3a36('0x24')]=_[_0x3a36('0x25')](_0x5dc4e0[_0x3a36('0x24')]);_0x301365[_0x3a36('0x26')]=_[_0x3a36('0x27')](_0x301365['model'],_0x301365[_0x3a36('0x24')]);_0x3d436f[_0x3a36('0x28')]=_[_0x3a36('0x27')](_0x301365['model'],qs[_0x3a36('0x29')](_0x5dc4e0['query']['fields']));_0x3d436f[_0x3a36('0x28')]=_0x3d436f[_0x3a36('0x28')][_0x3a36('0x2a')]?_0x3d436f[_0x3a36('0x28')]:_0x301365[_0x3a36('0x23')];if(_0x5dc4e0[_0x3a36('0x24')]['includeAll']){_0x3d436f[_0x3a36('0x33')]=[{'all':!![]}];}_0x3d436f=_[_0x3a36('0x31')]({},_0x3d436f,_0x5dc4e0[_0x3a36('0x38')]);return db['Network'][_0x3a36('0x39')](_0x3d436f)['then'](handleEntityNotFound(_0x5abc88,null))[_0x3a36('0xc')](respondWithResult(_0x5abc88,null))[_0x3a36('0x13')](handleError(_0x5abc88,null));};exports[_0x3a36('0x3a')]=function(_0x3f40c1,_0x45e16c){var _0x39be19;return db[_0x3a36('0x21')][_0x3a36('0x3a')](_0x3f40c1[_0x3a36('0x3b')],{'raw':!![]})[_0x3a36('0xc')](function(_0x348fbe){_0x39be19=_0x348fbe;return db['Network']['findAll']({'where':{'type':_0x3f40c1[_0x3a36('0x3b')][_0x3a36('0x30')]},'raw':!![]});})[_0x3a36('0xc')](function(_0x54cfb2){if(_0x39be19[_0x3a36('0x30')][_0x3a36('0x3c')]()=='STUN'){var _0xffa0ea=fs[_0x3a36('0x3d')](path['join'](config['root'],_0x3a36('0x3e')),'utf8');var _0x11ac6e=ejs[_0x3a36('0x3f')](_0xffa0ea,{'networks':_0x54cfb2||[]});fs[_0x3a36('0x40')]('/etc/asterisk/stun_xcally.conf',_0x11ac6e);return respondWithRpcPromise(_0x3a36('0x41'),'create',{'module':_0x3a36('0x42')});}else if(_0x39be19['type'][_0x3a36('0x3c')]()==_0x3a36('0x43')){var _0x229fc9=fs[_0x3a36('0x3d')](path[_0x3a36('0x44')](config[_0x3a36('0x45')],_0x3a36('0x46')),_0x3a36('0x47'));var _0x516d8d=ejs[_0x3a36('0x3f')](_0x229fc9,{'networks':_0x54cfb2||[]});fs['writeFileSync'](_0x3a36('0x48'),_0x516d8d);return respondWithRpcPromise(_0x3a36('0x41'),_0x3a36('0x3a'),{'module':_0x3a36('0x42')});}else{var _0x2df2e3=fs[_0x3a36('0x3d')](path[_0x3a36('0x44')](config['root'],_0x3a36('0x49')),_0x3a36('0x47'));var _0x527f88=ejs[_0x3a36('0x3f')](_0x2df2e3,{'networks':_0x54cfb2||[]});fs['writeFileSync'](util[_0x3a36('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x3f40c1[_0x3a36('0x3b')][_0x3a36('0x30')][_0x3a36('0x4b')]()),_0x527f88);return respondWithRpcPromise('Reload',_0x3a36('0x3a'),{'module':'chan_sip.so'});}})[_0x3a36('0xc')](function(){return _0x39be19;})[_0x3a36('0xc')](respondWithResult(_0x45e16c,0xc9))[_0x3a36('0x13')](handleError(_0x45e16c,null));};exports['update']=function(_0x28401a,_0x2e2296){var _0x23643a;return db[_0x3a36('0x21')][_0x3a36('0x39')]({'where':{'id':_0x28401a['params']['id']}})[_0x3a36('0xc')](handleEntityNotFound(_0x2e2296,null))['then'](saveUpdates(_0x28401a[_0x3a36('0x3b')],null))[_0x3a36('0xc')](function(_0x2844be){if(_0x2844be){_0x23643a=_0x2844be;return db[_0x3a36('0x21')]['findAll']({'where':{'type':_0x23643a[_0x3a36('0x30')]},'raw':!![]});}return null;})[_0x3a36('0xc')](function(_0x29777a){if(_0x23643a['type']['toUpperCase']()==_0x3a36('0x4c')){var _0x1f391f=fs[_0x3a36('0x3d')](path['join'](config[_0x3a36('0x45')],_0x3a36('0x3e')),'utf8');var _0x5e954c=ejs[_0x3a36('0x3f')](_0x1f391f,{'networks':_0x29777a||[]});fs[_0x3a36('0x40')](_0x3a36('0x4d'),_0x5e954c);return respondWithRpcPromise(_0x3a36('0x41'),'update',{'module':'res_stun_monitor.so'});}else if(_0x23643a[_0x3a36('0x30')][_0x3a36('0x3c')]()==_0x3a36('0x43')){var _0x1ac397=fs[_0x3a36('0x3d')](path[_0x3a36('0x44')](config[_0x3a36('0x45')],_0x3a36('0x46')),_0x3a36('0x47'));var _0xadbcc0=ejs[_0x3a36('0x3f')](_0x1ac397,{'networks':_0x29777a||[]});fs['writeFileSync'](_0x3a36('0x48'),_0xadbcc0);return respondWithRpcPromise(_0x3a36('0x41'),_0x3a36('0x1a'),{'module':'res_stun_monitor.so'});}else{var _0x291161=fs[_0x3a36('0x3d')](path[_0x3a36('0x44')](config['root'],_0x3a36('0x49')),_0x3a36('0x47'));var _0x47910d=ejs[_0x3a36('0x3f')](_0x291161,{'networks':_0x29777a||[]});fs[_0x3a36('0x40')](util['format'](_0x3a36('0x4e'),_0x28401a[_0x3a36('0x3b')][_0x3a36('0x30')]['toLowerCase']()),_0x47910d);return respondWithRpcPromise(_0x3a36('0x41'),_0x3a36('0x1a'),{'module':_0x3a36('0x4f')});}})['then'](function(_0x32277b){if(_0x32277b){return _0x23643a;}return null;})[_0x3a36('0xc')](respondWithResult(_0x2e2296,null))[_0x3a36('0x13')](handleError(_0x2e2296,null));};exports['destroy']=function(_0xff95b2,_0x1cc598){var _0x46c622;return db[_0x3a36('0x21')][_0x3a36('0x39')]({'where':{'id':_0xff95b2['params']['id']}})[_0x3a36('0xc')](function(_0x43ba6c){_0x46c622=_0x43ba6c;return _0x43ba6c;})[_0x3a36('0xc')](handleEntityNotFound(_0x1cc598,null))[_0x3a36('0xc')](removeEntity(_0x1cc598,null))[_0x3a36('0xc')](function(){if(_0x46c622){return db[_0x3a36('0x21')][_0x3a36('0x34')]({'where':{'type':_0x46c622[_0x3a36('0x30')]},'raw':!![]});}})[_0x3a36('0xc')](function(_0x2693ae){if(_0x46c622['type']['toUpperCase']()==_0x3a36('0x4c')){var _0x3f04d8=fs[_0x3a36('0x3d')](path[_0x3a36('0x44')](config[_0x3a36('0x45')],_0x3a36('0x3e')),'utf8');var _0x1cb5f6=ejs[_0x3a36('0x3f')](_0x3f04d8,{'networks':_0x2693ae||[]});fs['writeFileSync'](_0x3a36('0x4d'),_0x1cb5f6);return respondWithRpcPromise('Reload',_0x3a36('0x50'),{'module':_0x3a36('0x42')});}else if(_0x46c622['type'][_0x3a36('0x3c')]()==_0x3a36('0x43')){var _0x54bd6d=fs[_0x3a36('0x3d')](path[_0x3a36('0x44')](config[_0x3a36('0x45')],_0x3a36('0x46')),_0x3a36('0x47'));var _0x200699=ejs['render'](_0x54bd6d,{'networks':_0x2693ae||[]});fs['writeFileSync'](_0x3a36('0x48'),_0x200699);return respondWithRpcPromise(_0x3a36('0x41'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x516323=fs[_0x3a36('0x3d')](path[_0x3a36('0x44')](config[_0x3a36('0x45')],_0x3a36('0x49')),_0x3a36('0x47'));var _0x527e4e=ejs[_0x3a36('0x3f')](_0x516323,{'networks':_0x2693ae||[]});fs[_0x3a36('0x40')](util[_0x3a36('0x4a')](_0x3a36('0x4e'),_0x46c622['type']['toLowerCase']()),_0x527e4e);return respondWithRpcPromise(_0x3a36('0x41'),_0x3a36('0x50'),{'module':'chan_sip.so'});}})[_0x3a36('0x13')](handleError(_0x1cc598,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index dc9bfb2..d895ae5 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 _0x6308=['bluebird','request-promise','path','rimraf','../../config/environment','define','Network','network','lodash','../../config/logger'];(function(_0x566cff,_0x383570){var _0x6bf187=function(_0x3645ca){while(--_0x3645ca){_0x566cff['push'](_0x566cff['shift']());}};_0x6bf187(++_0x383570);}(_0x6308,0x1f2));var _0x8630=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6308[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var logger=require(_0x8630('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8630('0x2'));var rp=require(_0x8630('0x3'));var fs=require('fs');var path=require(_0x8630('0x4'));var rimraf=require(_0x8630('0x5'));var config=require(_0x8630('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x1d62c8,_0x571543){return _0x1d62c8[_0x8630('0x7')](_0x8630('0x8'),attributes,{'tableName':_0x8630('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0db9=['network','lodash','moment','bluebird','path','../../config/environment','./network.attributes','define','Network'];(function(_0x3b4679,_0x22a98c){var _0x454857=function(_0x2890df){while(--_0x2890df){_0x3b4679['push'](_0x3b4679['shift']());}};_0x454857(++_0x22a98c);}(_0x0db9,0xa3));var _0x90db=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x0db9[_0x1fcaf1];return _0x55f464;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 8861eb4..9b7c2af 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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5aeb6a,_0x1f56d8){_0x5aeb6a=_0x5aeb6a-0x0;var _0x435c44=_0x7a54[_0x5aeb6a];return _0x435c44;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +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(_0x18d170,_0x41a596){var _0xb5ebe4=function(_0x1e558c){while(--_0x1e558c){_0x18d170['push'](_0x18d170['shift']());}};_0xb5ebe4(++_0x41a596);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 db038d5..a153d02 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 _0x901b=['/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addAgents','/:id/send','send','put','/:id','delete','removeDispositions','removeAnswers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications'];(function(_0x3c5f28,_0x11018a){var _0x1c3b05=function(_0x440953){while(--_0x440953){_0x3c5f28['push'](_0x3c5f28['shift']());}};_0x1c3b05(++_0x11018a);}(_0x901b,0x1ce));var _0xb901=function(_0x9188e2,_0x43089a){_0x9188e2=_0x9188e2-0x0;var _0x2e6fa4=_0x901b[_0x9188e2];return _0x2e6fa4;};'use strict';var multer=require(_0xb901('0x0'));var util=require(_0xb901('0x1'));var path=require('path');var timeout=require(_0xb901('0x2'));var express=require(_0xb901('0x3'));var router=express[_0xb901('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb901('0x5'));var interaction=require(_0xb901('0x6'));var config=require(_0xb901('0x7'));var controller=require(_0xb901('0x8'));router[_0xb901('0x9')]('/',auth[_0xb901('0xa')](),controller[_0xb901('0xb')]);router[_0xb901('0x9')](_0xb901('0xc'),auth['isAuthenticated'](),controller[_0xb901('0xd')]);router[_0xb901('0x9')]('/:id',auth[_0xb901('0xa')](),controller['show']);router[_0xb901('0x9')](_0xb901('0xe'),auth[_0xb901('0xa')](),controller[_0xb901('0xf')]);router[_0xb901('0x9')](_0xb901('0x10'),auth[_0xb901('0xa')](),controller[_0xb901('0x11')]);router[_0xb901('0x9')]('/:id/applications',auth[_0xb901('0xa')](),controller[_0xb901('0x12')]);router[_0xb901('0x9')](_0xb901('0x13'),auth[_0xb901('0xa')](),controller[_0xb901('0x14')]);router[_0xb901('0x9')](_0xb901('0x15'),auth[_0xb901('0xa')](),controller[_0xb901('0x16')]);router['post']('/',auth[_0xb901('0xa')](),controller[_0xb901('0x17')]);router[_0xb901('0x18')]('/:id/dispositions',auth[_0xb901('0xa')](),controller[_0xb901('0x19')]);router['post'](_0xb901('0x10'),auth[_0xb901('0xa')](),controller[_0xb901('0x1a')]);router[_0xb901('0x18')](_0xb901('0x1b'),controller['notify']);router[_0xb901('0x18')](_0xb901('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb901('0x18')]('/:id/users',auth[_0xb901('0xa')](),controller[_0xb901('0x1d')]);router[_0xb901('0x18')](_0xb901('0x1e'),auth[_0xb901('0xa')](),controller[_0xb901('0x1f')]);router[_0xb901('0x20')](_0xb901('0x21'),auth[_0xb901('0xa')](),controller['update']);router['delete'](_0xb901('0x21'),auth[_0xb901('0xa')](),controller['destroy']);router[_0xb901('0x22')](_0xb901('0xe'),auth[_0xb901('0xa')](),controller[_0xb901('0x23')]);router[_0xb901('0x22')](_0xb901('0x10'),auth[_0xb901('0xa')](),controller[_0xb901('0x24')]);router[_0xb901('0x22')](_0xb901('0x15'),auth[_0xb901('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x7930=['../../components/interaction/service','./openchannelAccount.controller','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','isAuthenticated','getApplications','/:id/interactions','getInteractions','/:id/users','create','addDisposition','post','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7930,0x8b));var _0x0793=function(_0x2156f9,_0x7c681c){_0x2156f9=_0x2156f9-0x0;var _0x339fff=_0x7930[_0x2156f9];return _0x339fff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0793('0x0'));var timeout=require(_0x0793('0x1'));var express=require(_0x0793('0x2'));var router=express['Router']();var fs_extra=require(_0x0793('0x3'));var auth=require(_0x0793('0x4'));var interaction=require(_0x0793('0x5'));var config=require('../../config/environment');var controller=require(_0x0793('0x6'));router[_0x0793('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0793('0x7')](_0x0793('0x8'),auth['isAuthenticated'](),controller[_0x0793('0x9')]);router[_0x0793('0x7')](_0x0793('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0793('0x7')](_0x0793('0xb'),auth['isAuthenticated'](),controller[_0x0793('0xc')]);router['get'](_0x0793('0xd'),auth[_0x0793('0xe')](),controller['getAnswers']);router[_0x0793('0x7')]('/:id/applications',auth[_0x0793('0xe')](),controller[_0x0793('0xf')]);router[_0x0793('0x7')](_0x0793('0x10'),auth[_0x0793('0xe')](),controller[_0x0793('0x11')]);router[_0x0793('0x7')](_0x0793('0x12'),auth[_0x0793('0xe')](),controller['getAgents']);router['post']('/',auth[_0x0793('0xe')](),controller[_0x0793('0x13')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0793('0x14')]);router[_0x0793('0x15')](_0x0793('0xd'),auth['isAuthenticated'](),controller[_0x0793('0x16')]);router[_0x0793('0x15')](_0x0793('0x17'),controller[_0x0793('0x18')]);router[_0x0793('0x15')](_0x0793('0x19'),auth['isAuthenticated'](),controller[_0x0793('0x1a')]);router[_0x0793('0x15')]('/:id/users',auth[_0x0793('0xe')](),controller[_0x0793('0x1b')]);router[_0x0793('0x15')](_0x0793('0x1c'),auth['isAuthenticated'](),controller[_0x0793('0x1d')]);router['put'](_0x0793('0xa'),auth[_0x0793('0xe')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0793('0x1e')]);router[_0x0793('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0793('0x20')]);router[_0x0793('0x1f')](_0x0793('0xd'),auth[_0x0793('0xe')](),controller[_0x0793('0x21')]);router[_0x0793('0x1f')]('/:id/users',auth[_0x0793('0xe')](),controller[_0x0793('0x22')]);module[_0x0793('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index daaed89..93849c6 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 _0xcd15=['name','STRING','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','sequelize','exports'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xcd15,0xa6));var _0x5cd1=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xcd15[_0x1bc013];return _0x55df36;};'use strict';var Sequelize=require(_0x5cd1('0x0'));var rs=require('randomstring');module[_0x5cd1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5cd1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5cd1('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5cd1('0x4')]();}},'replyUri':{'type':Sequelize[_0x5cd1('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5cd1('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5cd1('0x5');}},'notificationSound':{'type':Sequelize[_0x5cd1('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5cd1('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5cd1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5cd1('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5cd1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5cd1('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5cd1('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5cd1('0x9'),'set':function(_0x4033ac){if(!_0x4033ac)this[_0x5cd1('0xa')](_0x5cd1('0xb'),null);this[_0x5cd1('0xa')]('mandatoryDisposition',_0x4033ac);}}}; \ No newline at end of file +var _0x4e02=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','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'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x4e02,0x199));var _0x24e0=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x4e02[_0x56756b];return _0xa3002;};'use strict';var Sequelize=require(_0x24e0('0x0'));var rs=require(_0x24e0('0x1'));module[_0x24e0('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x24e0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x24e0('0x4')]},'token':{'type':Sequelize[_0x24e0('0x4')],'defaultValue':function(){return rs[_0x24e0('0x5')]();}},'replyUri':{'type':Sequelize[_0x24e0('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x24e0('0x6')],'defaultValue':function(){return _0x24e0('0x7');}},'notificationSound':{'type':Sequelize[_0x24e0('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x24e0('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x24e0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x24e0('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x24e0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x24e0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x24e0('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x24e0('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x24e0('0xb'),'set':function(_0x31dc03){if(!_0x31dc03)this[_0x24e0('0xc')](_0x24e0('0xd'),null);this[_0x24e0('0xc')](_0x24e0('0xe'),_0x31dc03);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 43a8c56..5e3c306 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 _0x4016=['model','map','query','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','Pause','keys','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','sort','removeDispositions','ids','addAnswer','CannedAnswer','findOne','pick','rows','removeAnswers','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','Applications','account','applications','priority','contact','firstName','lastName','OpenchannelInteraction','threadId','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','bluebird','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key'];(function(_0x56ccd2,_0x1fbef1){var _0x341819=function(_0x5b0bc1){while(--_0x5b0bc1){_0x56ccd2['push'](_0x56ccd2['shift']());}};_0x341819(++_0x1fbef1);}(_0x4016,0x131));var _0x6401=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4016[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6401('0x0'));var zipdir=require(_0x6401('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6401('0x2'));var Mustache=require('mustache');var util=require(_0x6401('0x3'));var path=require(_0x6401('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6401('0x5'));var fs=require('fs');var fs_extra=require(_0x6401('0x6'));var _=require('lodash');var squel=require(_0x6401('0x7'));var crypto=require('crypto');var jsforce=require(_0x6401('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6401('0x9'));var querystring=require(_0x6401('0xa'));var Papa=require(_0x6401('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6401('0xc'));var as=require(_0x6401('0xd'));var hardwareService=require(_0x6401('0xe'));var logger=require('../../config/logger')(_0x6401('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6401('0x10'));var db=require(_0x6401('0x11'))['db'];config[_0x6401('0x12')]=_[_0x6401('0x13')](config[_0x6401('0x12')],{'host':_0x6401('0x14'),'port':0x18eb});var socket=require(_0x6401('0x15'))(new Redis(config[_0x6401('0x12')]));require(_0x6401('0x16'))[_0x6401('0x17')](socket);var jayson=require(_0x6401('0x18'));var client=jayson[_0x6401('0x19')][_0x6401('0x1a')]({'port':0x232c});var client9002=jayson[_0x6401('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b510e,_0x1fd3b8,_0x2c7f05,_0xd56185){return new BPromise(function(_0x21b595,_0x1a1c55){var _0x4521b6=_0xd56185||client;return _0x4521b6['request'](_0x1b510e,_0x2c7f05)['then'](function(_0x2d8f2d){logger['info'](_0x6401('0x1b'),_0x1fd3b8,_0x6401('0x1c'));logger[_0x6401('0x1d')](_0x6401('0x1e'),_0x1fd3b8,_0x6401('0x1c'),JSON[_0x6401('0x1f')](_0x2d8f2d));if(_0x2d8f2d[_0x6401('0x20')]){if(_0x2d8f2d['error'][_0x6401('0x21')]===0x1f4){logger[_0x6401('0x20')](_0x6401('0x1b'),_0x1fd3b8,_0x2d8f2d[_0x6401('0x20')]['message']);return _0x1a1c55(_0x2d8f2d[_0x6401('0x20')][_0x6401('0x22')]);}logger['error'](_0x6401('0x1b'),_0x1fd3b8,_0x2d8f2d[_0x6401('0x20')][_0x6401('0x22')]);return _0x21b595(_0x2d8f2d[_0x6401('0x20')][_0x6401('0x22')]);}else{logger[_0x6401('0x23')](_0x6401('0x1b'),_0x1fd3b8,_0x6401('0x1c'));_0x21b595(_0x2d8f2d[_0x6401('0x24')]['message']);}})['catch'](function(_0x55818a){logger[_0x6401('0x20')](_0x6401('0x1b'),_0x1fd3b8,_0x55818a);_0x1a1c55(_0x55818a);});});}function respondWithStatusCode(_0x409d11,_0x4e6d9f){_0x4e6d9f=_0x4e6d9f||0xcc;return function(_0x3b1d99){if(_0x3b1d99){return _0x409d11[_0x6401('0x25')](_0x4e6d9f);}return _0x409d11[_0x6401('0x26')](_0x4e6d9f)[_0x6401('0x27')]();};}function respondWithResult(_0x514427,_0x49c7ad){_0x49c7ad=_0x49c7ad||0xc8;return function(_0x3254f0){if(_0x3254f0){return _0x514427[_0x6401('0x26')](_0x49c7ad)[_0x6401('0x28')](_0x3254f0);}};}function respondWithFilteredResult(_0x466a35,_0x549b8c){return function(_0x7f6e88){if(_0x7f6e88){var _0x43e089=typeof _0x549b8c[_0x6401('0x29')]===_0x6401('0x2a')&&typeof _0x549b8c[_0x6401('0x2b')]===_0x6401('0x2a');var _0x374b1=_0x7f6e88[_0x6401('0x2c')];var _0x4eb4f1=_0x43e089?0x0:_0x549b8c[_0x6401('0x29')];var _0x2f0de6=_0x43e089?_0x7f6e88[_0x6401('0x2c')]:_0x549b8c[_0x6401('0x29')]+_0x549b8c['limit'];var _0x211cb5;if(_0x2f0de6>=_0x374b1){_0x2f0de6=_0x374b1;_0x211cb5=0xc8;}else{_0x211cb5=0xce;}_0x466a35[_0x6401('0x26')](_0x211cb5);return _0x466a35[_0x6401('0x2d')]('Content-Range',_0x4eb4f1+'-'+_0x2f0de6+'/'+_0x374b1)['json'](_0x7f6e88);}return null;};}function patchUpdates(_0x24a318){return function(_0x509c39){try{jsonpatch[_0x6401('0x2e')](_0x509c39,_0x24a318,!![]);}catch(_0x34c938){return BPromise[_0x6401('0x2f')](_0x34c938);}return _0x509c39[_0x6401('0x30')]();};}function saveUpdates(_0x29ffb6,_0x35250b){return function(_0x1d79a3){if(_0x1d79a3){return _0x1d79a3[_0x6401('0x31')](_0x29ffb6)[_0x6401('0x32')](function(_0x4a1871){return _0x4a1871;});}return null;};}function removeEntity(_0x26f2c9,_0x416573){return function(_0x251a77){if(_0x251a77){return _0x251a77[_0x6401('0x33')]()[_0x6401('0x32')](function(){var _0x556354=_0x251a77[_0x6401('0x34')]({'plain':!![]});var _0x2ae81b='OpenchannelAccounts';return db[_0x6401('0x35')]['destroy']({'where':{'type':_0x2ae81b,'resourceId':_0x556354['id']}})[_0x6401('0x32')](function(){return _0x251a77;});})[_0x6401('0x32')](function(){_0x26f2c9['status'](0xcc)[_0x6401('0x27')]();});}};}function handleEntityNotFound(_0x1c0550,_0x16a3fc){return function(_0x1e08f6){if(!_0x1e08f6){_0x1c0550['sendStatus'](0x194);}return _0x1e08f6;};}function handleError(_0x2efbed,_0x433648){_0x433648=_0x433648||0x1f4;return function(_0x2aedda){logger['error'](_0x2aedda[_0x6401('0x36')]);if(_0x2aedda[_0x6401('0x37')]){delete _0x2aedda['name'];}_0x2efbed[_0x6401('0x26')](_0x433648)[_0x6401('0x38')](_0x2aedda);};}exports[_0x6401('0x39')]=function(_0x4ca723,_0x3a4a62){var _0x3fbfa6={'include':[{'model':db['Pause'],'as':_0x6401('0x3a')}]},_0x22e50f={},_0x1e9ab4={'count':0x0,'rows':[]};var _0x3eca0f=_['map'](db[_0x6401('0x3b')][_0x6401('0x3c')],function(_0x46d358){return{'name':_0x46d358[_0x6401('0x3d')],'type':_0x46d358['type'][_0x6401('0x3e')]};});_0x22e50f[_0x6401('0x3f')]=_[_0x6401('0x40')](_0x3eca0f,_0x6401('0x37'));_0x22e50f[_0x6401('0x41')]=_['keys'](_0x4ca723[_0x6401('0x41')]);_0x22e50f[_0x6401('0x42')]=_[_0x6401('0x43')](_0x22e50f[_0x6401('0x3f')],_0x22e50f['query']);_0x3fbfa6[_0x6401('0x44')]=_[_0x6401('0x43')](_0x22e50f[_0x6401('0x3f')],qs[_0x6401('0x45')](_0x4ca723[_0x6401('0x41')][_0x6401('0x45')]));_0x3fbfa6[_0x6401('0x44')]=_0x3fbfa6[_0x6401('0x44')][_0x6401('0x46')]?_0x3fbfa6[_0x6401('0x44')]:_0x22e50f[_0x6401('0x3f')];if(!_0x4ca723['query']['hasOwnProperty'](_0x6401('0x47'))){_0x3fbfa6[_0x6401('0x2b')]=qs['limit'](_0x4ca723[_0x6401('0x41')][_0x6401('0x2b')]);_0x3fbfa6[_0x6401('0x29')]=qs[_0x6401('0x29')](_0x4ca723[_0x6401('0x41')]['offset']);}_0x3fbfa6[_0x6401('0x48')]=qs['sort'](_0x4ca723[_0x6401('0x41')]['sort']);_0x3fbfa6[_0x6401('0x49')]=qs[_0x6401('0x42')](_['pick'](_0x4ca723[_0x6401('0x41')],_0x22e50f['filters']),_0x3eca0f);if(_0x4ca723['query'][_0x6401('0x4a')]){_0x3fbfa6['where']=_[_0x6401('0x4b')](_0x3fbfa6[_0x6401('0x49')],{'$or':_[_0x6401('0x40')](_0x3eca0f,function(_0x353930){if(_0x353930[_0x6401('0x4c')]!==_0x6401('0x4d')){var _0x440d8f={};_0x440d8f[_0x353930['name']]={'$like':'%'+_0x4ca723[_0x6401('0x41')][_0x6401('0x4a')]+'%'};return _0x440d8f;}})});}_0x3fbfa6=_[_0x6401('0x4b')]({},_0x3fbfa6,_0x4ca723[_0x6401('0x4e')]);var _0x29fdff={'where':_0x3fbfa6[_0x6401('0x49')]};return db[_0x6401('0x3b')][_0x6401('0x2c')](_0x29fdff)[_0x6401('0x32')](function(_0x83068d){_0x1e9ab4[_0x6401('0x2c')]=_0x83068d;if(_0x4ca723[_0x6401('0x41')][_0x6401('0x4f')]){_0x3fbfa6['include']=[{'all':!![]}];}return db[_0x6401('0x3b')][_0x6401('0x50')](_0x3fbfa6);})['then'](function(_0x58958c){_0x1e9ab4['rows']=_0x58958c;return _0x1e9ab4;})['then'](respondWithFilteredResult(_0x3a4a62,_0x3fbfa6))[_0x6401('0x51')](handleError(_0x3a4a62,null));};exports['show']=function(_0x1a6a0f,_0x408aaa){var _0x1a1d05={'raw':![],'where':{'id':_0x1a6a0f[_0x6401('0x52')]['id']},'include':[{'model':db[_0x6401('0x53')],'as':_0x6401('0x3a')}]},_0x4597df={};_0x4597df['model']=_[_0x6401('0x54')](db[_0x6401('0x3b')][_0x6401('0x3c')]);_0x4597df[_0x6401('0x41')]=_['keys'](_0x1a6a0f['query']);_0x4597df[_0x6401('0x42')]=_[_0x6401('0x43')](_0x4597df[_0x6401('0x3f')],_0x4597df[_0x6401('0x41')]);_0x1a1d05['attributes']=_[_0x6401('0x43')](_0x4597df['model'],qs[_0x6401('0x45')](_0x1a6a0f['query'][_0x6401('0x45')]));_0x1a1d05['attributes']=_0x1a1d05[_0x6401('0x44')]['length']?_0x1a1d05[_0x6401('0x44')]:_0x4597df['model'];if(_0x1a6a0f[_0x6401('0x41')][_0x6401('0x4f')]){_0x1a1d05[_0x6401('0x55')]=[{'all':!![]}];}_0x1a1d05=_[_0x6401('0x4b')]({},_0x1a1d05,_0x1a6a0f[_0x6401('0x4e')]);return db[_0x6401('0x3b')][_0x6401('0x56')](_0x1a1d05)[_0x6401('0x32')](handleEntityNotFound(_0x408aaa,null))[_0x6401('0x32')](respondWithResult(_0x408aaa,null))['catch'](handleError(_0x408aaa,null));};exports['create']=function(_0x4e52d5,_0x56cbe8){return db[_0x6401('0x3b')]['create'](_0x4e52d5['body'],{})[_0x6401('0x32')](function(_0x473a3e){var _0x5af7c7=_0x4e52d5[_0x6401('0x57')][_0x6401('0x34')]({'plain':!![]});if(!_0x5af7c7)throw new Error(_0x6401('0x58'));if(_0x5af7c7[_0x6401('0x59')]===_0x6401('0x57')){var _0x4e9e7e=_0x473a3e[_0x6401('0x34')]({'plain':!![]});var _0x44a85e='OpenchannelAccounts';return db[_0x6401('0x5a')]['find']({'where':{'name':_0x44a85e,'userProfileId':_0x5af7c7['userProfileId']},'raw':!![]})[_0x6401('0x32')](function(_0xc55227){if(_0xc55227&&_0xc55227[_0x6401('0x5b')]===0x0){return db[_0x6401('0x35')][_0x6401('0x5c')]({'name':_0x4e9e7e[_0x6401('0x37')],'resourceId':_0x4e9e7e['id'],'type':_0xc55227[_0x6401('0x37')],'sectionId':_0xc55227['id']},{})['then'](function(){return _0x473a3e;});}else{return _0x473a3e;}})[_0x6401('0x51')](function(_0x108e59){logger[_0x6401('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x108e59);throw _0x108e59;});}return _0x473a3e;})[_0x6401('0x32')](respondWithResult(_0x56cbe8,0xc9))[_0x6401('0x51')](handleError(_0x56cbe8,null));};exports[_0x6401('0x31')]=function(_0xedeb3c,_0x1a07c6){if(_0xedeb3c[_0x6401('0x5d')]['id']){delete _0xedeb3c['body']['id'];}return db['OpenchannelAccount'][_0x6401('0x56')]({'where':{'id':_0xedeb3c[_0x6401('0x52')]['id']},'include':[{'model':db[_0x6401('0x53')],'as':_0x6401('0x3a')}]})['then'](handleEntityNotFound(_0x1a07c6,null))[_0x6401('0x32')](saveUpdates(_0xedeb3c['body'],null))['then'](respondWithResult(_0x1a07c6,null))['catch'](handleError(_0x1a07c6,null));};exports[_0x6401('0x33')]=function(_0x4f4145,_0x3e63ab){return db[_0x6401('0x3b')][_0x6401('0x56')]({'where':{'id':_0x4f4145[_0x6401('0x52')]['id']}})['then'](handleEntityNotFound(_0x3e63ab,null))[_0x6401('0x32')](removeEntity(_0x3e63ab,null))['catch'](handleError(_0x3e63ab,null));};exports[_0x6401('0x5e')]=function(_0x360e0c,_0x30f7fc){return db[_0x6401('0x3b')]['describe']()[_0x6401('0x32')](respondWithResult(_0x30f7fc,null))[_0x6401('0x51')](handleError(_0x30f7fc,null));};exports[_0x6401('0x5f')]=function(_0x4a2cb3,_0x5d2e02,_0x374e1c){if(_0x4a2cb3['body']['id']){delete _0x4a2cb3[_0x6401('0x5d')]['id'];}return db[_0x6401('0x3b')][_0x6401('0x56')]({'where':{'id':_0x4a2cb3[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x5d2e02,null))['then'](function(_0x1ebac9){if(_0x1ebac9){_0x4a2cb3['body'][_0x6401('0x60')]=_0x1ebac9['id'];return db[_0x6401('0x61')][_0x6401('0x5c')](_0x4a2cb3['body']);}})[_0x6401('0x32')](respondWithResult(_0x5d2e02,null))[_0x6401('0x51')](handleError(_0x5d2e02,null));};exports[_0x6401('0x62')]=function(_0x185815,_0x353d3b,_0x297948){var _0x5be94b={'raw':![],'where':{}};var _0xa0d7fa={};var _0x527829={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x185815[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x353d3b,null))[_0x6401('0x32')](function(_0x1972ad){if(_0x1972ad){_0xa0d7fa[_0x6401('0x3f')]=_[_0x6401('0x54')](db[_0x6401('0x61')][_0x6401('0x3c')]);_0xa0d7fa['query']=_[_0x6401('0x54')](_0x185815['query']);_0xa0d7fa['filters']=_['intersection'](_0xa0d7fa[_0x6401('0x3f')],_0xa0d7fa[_0x6401('0x41')]);_0x5be94b[_0x6401('0x44')]=_['intersection'](_0xa0d7fa[_0x6401('0x3f')],qs[_0x6401('0x45')](_0x185815[_0x6401('0x41')][_0x6401('0x45')]));_0x5be94b[_0x6401('0x44')]=_0x5be94b[_0x6401('0x44')][_0x6401('0x46')]?_0x5be94b[_0x6401('0x44')]:_0xa0d7fa[_0x6401('0x3f')];if(!_0x185815[_0x6401('0x41')][_0x6401('0x63')](_0x6401('0x47'))){_0x5be94b['limit']=qs[_0x6401('0x2b')](_0x185815[_0x6401('0x41')][_0x6401('0x2b')]);_0x5be94b[_0x6401('0x29')]=qs['offset'](_0x185815[_0x6401('0x41')]['offset']);}_0x5be94b[_0x6401('0x48')]=qs[_0x6401('0x64')](_0x185815['query'][_0x6401('0x64')]);_0x5be94b[_0x6401('0x49')]=qs[_0x6401('0x42')](_['pick'](_0x185815['query'],_0xa0d7fa['filters']));_0x5be94b[_0x6401('0x49')][_0x6401('0x60')]=_0x1972ad['id'];if(_0x185815[_0x6401('0x41')][_0x6401('0x4a')]){_0x5be94b['where']=_[_0x6401('0x4b')](_0x5be94b['where'],{'$or':_[_0x6401('0x40')](_0x5be94b[_0x6401('0x44')],function(_0x458154){var _0x13a72a={};_0x13a72a[_0x458154]={'$like':'%'+_0x185815[_0x6401('0x41')][_0x6401('0x4a')]+'%'};return _0x13a72a;})});}_0x5be94b=_[_0x6401('0x4b')]({},_0x5be94b,_0x185815[_0x6401('0x4e')]);return db[_0x6401('0x61')][_0x6401('0x2c')]({'where':_0x5be94b[_0x6401('0x49')]})[_0x6401('0x32')](function(_0x1c5595){_0x527829[_0x6401('0x2c')]=_0x1c5595;if(_0x185815[_0x6401('0x41')][_0x6401('0x4f')]){_0x5be94b[_0x6401('0x55')]=[{'all':!![]}];}return db[_0x6401('0x61')][_0x6401('0x50')](_0x5be94b);})[_0x6401('0x32')](function(_0x6ef616){_0x527829['rows']=_0x6ef616;return _0x527829;});}})[_0x6401('0x32')](respondWithFilteredResult(_0x353d3b,_0x5be94b))[_0x6401('0x51')](handleError(_0x353d3b,null));};exports[_0x6401('0x65')]=function(_0x4c0332,_0x5e6960,_0x4ea601){return db[_0x6401('0x3b')][_0x6401('0x56')]({'where':{'id':_0x4c0332[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x5e6960,null))['then'](function(_0x15c127){if(_0x15c127){return _0x15c127[_0x6401('0x65')](_0x4c0332[_0x6401('0x41')][_0x6401('0x66')]);}})[_0x6401('0x32')](respondWithStatusCode(_0x5e6960,null))[_0x6401('0x51')](handleError(_0x5e6960,null));};exports[_0x6401('0x67')]=function(_0x39be86,_0x2c64aa,_0x69ff03){if(_0x39be86[_0x6401('0x5d')]['id']){delete _0x39be86['body']['id'];}return db[_0x6401('0x3b')][_0x6401('0x56')]({'where':{'id':_0x39be86['params']['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x2c64aa,null))[_0x6401('0x32')](function(_0x4c80a0){if(_0x4c80a0){_0x39be86[_0x6401('0x5d')][_0x6401('0x60')]=_0x4c80a0['id'];return db[_0x6401('0x68')]['create'](_0x39be86[_0x6401('0x5d')]);}})[_0x6401('0x32')](respondWithResult(_0x2c64aa,null))[_0x6401('0x51')](handleError(_0x2c64aa,null));};exports['getAnswers']=function(_0x3ceb3b,_0x5bcaba,_0x50841b){var _0xa7b3a0={'raw':![],'where':{}};var _0x18727a={};var _0x50ff08={'count':0x0,'rows':[]};return db[_0x6401('0x3b')][_0x6401('0x69')]({'where':{'id':_0x3ceb3b[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x5bcaba,null))['then'](function(_0x30bbd1){if(_0x30bbd1){_0x18727a[_0x6401('0x3f')]=_[_0x6401('0x54')](db['CannedAnswer']['rawAttributes']);_0x18727a[_0x6401('0x41')]=_[_0x6401('0x54')](_0x3ceb3b[_0x6401('0x41')]);_0x18727a[_0x6401('0x42')]=_['intersection'](_0x18727a[_0x6401('0x3f')],_0x18727a['query']);_0xa7b3a0[_0x6401('0x44')]=_[_0x6401('0x43')](_0x18727a[_0x6401('0x3f')],qs[_0x6401('0x45')](_0x3ceb3b[_0x6401('0x41')]['fields']));_0xa7b3a0[_0x6401('0x44')]=_0xa7b3a0[_0x6401('0x44')]['length']?_0xa7b3a0[_0x6401('0x44')]:_0x18727a['model'];if(!_0x3ceb3b[_0x6401('0x41')][_0x6401('0x63')](_0x6401('0x47'))){_0xa7b3a0['limit']=qs[_0x6401('0x2b')](_0x3ceb3b[_0x6401('0x41')][_0x6401('0x2b')]);_0xa7b3a0[_0x6401('0x29')]=qs[_0x6401('0x29')](_0x3ceb3b['query'][_0x6401('0x29')]);}_0xa7b3a0[_0x6401('0x48')]=qs[_0x6401('0x64')](_0x3ceb3b['query'][_0x6401('0x64')]);_0xa7b3a0[_0x6401('0x49')]=qs[_0x6401('0x42')](_[_0x6401('0x6a')](_0x3ceb3b['query'],_0x18727a[_0x6401('0x42')]));_0xa7b3a0[_0x6401('0x49')][_0x6401('0x60')]=_0x30bbd1['id'];if(_0x3ceb3b[_0x6401('0x41')][_0x6401('0x4a')]){_0xa7b3a0[_0x6401('0x49')]=_[_0x6401('0x4b')](_0xa7b3a0[_0x6401('0x49')],{'$or':_['map'](_0xa7b3a0['attributes'],function(_0x430109){var _0x5cd5d8={};_0x5cd5d8[_0x430109]={'$like':'%'+_0x3ceb3b[_0x6401('0x41')][_0x6401('0x4a')]+'%'};return _0x5cd5d8;})});}_0xa7b3a0=_[_0x6401('0x4b')]({},_0xa7b3a0,_0x3ceb3b['options']);return db['CannedAnswer'][_0x6401('0x2c')]({'where':_0xa7b3a0['where']})['then'](function(_0x30cddc){_0x50ff08[_0x6401('0x2c')]=_0x30cddc;if(_0x3ceb3b['query'][_0x6401('0x4f')]){_0xa7b3a0['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xa7b3a0);})['then'](function(_0x1fd4d2){_0x50ff08[_0x6401('0x6b')]=_0x1fd4d2;return _0x50ff08;});}})[_0x6401('0x32')](respondWithFilteredResult(_0x5bcaba,_0xa7b3a0))[_0x6401('0x51')](handleError(_0x5bcaba,null));};exports[_0x6401('0x6c')]=function(_0x212e97,_0x10ee53,_0x4cba43){return db['OpenchannelAccount'][_0x6401('0x56')]({'where':{'id':_0x212e97[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x10ee53,null))[_0x6401('0x32')](function(_0x31a72a){if(_0x31a72a){return _0x31a72a['removeAnswers'](_0x212e97['query']['ids']);}})[_0x6401('0x32')](respondWithStatusCode(_0x10ee53,null))[_0x6401('0x51')](handleError(_0x10ee53,null));};exports['notify']=function(_0x1968e2,_0x1f8ebf,_0x547c64){var _0x2aea67={'body':_0x1968e2[_0x6401('0x5d')],'channel':'openchannel'};var _0x4bc45c=[];var _0x4ba15b=[];var _0x49f346={};var _0x1e93f9=![];return db['CmContact'][_0x6401('0x5e')]()[_0x6401('0x32')](function(_0x55c57d){if(!_0x55c57d){throw new db[(_0x6401('0x6d'))]['ValidationError'](_0x6401('0x6e'));}_0x4bc45c=_[_0x6401('0x6f')](_['keys'](_0x55c57d),['createdAt','updatedAt']);_0x4ba15b=_[_0x6401('0x6f')](_[_0x6401('0x54')](_0x55c57d),[_0x6401('0x70'),_0x6401('0x71'),_0x6401('0x72'),_0x6401('0x73')]);if(_0x1968e2['body']['id']){delete _0x1968e2[_0x6401('0x5d')]['id'];}if(_[_0x6401('0x74')](_0x1968e2['body'][_0x6401('0x75')])){throw new db[(_0x6401('0x6d'))][(_0x6401('0x76'))](_0x6401('0x77'));}if(_[_0x6401('0x74')](_0x1968e2[_0x6401('0x5d')][_0x6401('0x5d')])||_0x1968e2[_0x6401('0x5d')]['body']===''){throw new db[(_0x6401('0x6d'))][(_0x6401('0x76'))](_0x6401('0x78'));}if(_[_0x6401('0x74')](_0x1968e2[_0x6401('0x5d')][_0x6401('0x79')])){throw new db[(_0x6401('0x6d'))][(_0x6401('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ba15b);}if(!_[_0x6401('0x7a')](_0x4ba15b,_0x1968e2[_0x6401('0x5d')]['mapKey'])){throw new db[(_0x6401('0x6d'))]['ValidationError'](_0x6401('0x7b')+_0x4ba15b);}_0x49f346[_0x1968e2[_0x6401('0x5d')][_0x6401('0x79')]]=_0x1968e2[_0x6401('0x5d')]['from'];})['then'](function(){return db['OpenchannelAccount'][_0x6401('0x56')]({'where':{'id':_0x1968e2[_0x6401('0x52')]['id']},'include':[{'model':db[_0x6401('0x7c')],'as':_0x6401('0x7d'),'include':[{'model':db[_0x6401('0x7e')],'as':_0x6401('0x7f'),'where':_0x49f346,'limit':0x1,'order':[[_0x6401('0x71'),_0x6401('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x6401('0x81')}]});})[_0x6401('0x32')](handleEntityNotFound(_0x1f8ebf,null))['then'](function(_0x265a58){if(_0x265a58&&_0x265a58[_0x6401('0x7d')]){_0x2aea67[_0x6401('0x82')]=_0x265a58;_0x2aea67[_0x6401('0x83')]=_0x265a58[_0x6401('0x81')];_0x2aea67['list']=_0x265a58[_0x6401('0x7d')];_0x2aea67[_0x6401('0x83')]=_['orderBy'](_0x2aea67[_0x6401('0x83')],[_0x6401('0x84')],['asc']);if(_0x2aea67['account'][_0x6401('0x81')]){delete _0x2aea67[_0x6401('0x82')][_0x6401('0x81')];}if(_0x2aea67[_0x6401('0x82')]['List']&&_0x2aea67[_0x6401('0x82')]['List'][_0x6401('0x7f')][_0x6401('0x46')]){return _0x2aea67['account'][_0x6401('0x7d')]['Contacts'][0x0];}var _0x750a95=_[_0x6401('0x13')](_0x1968e2[_0x6401('0x5d')],{'firstName':_0x1968e2[_0x6401('0x5d')][_0x6401('0x75')],'ListId':_0x265a58[_0x6401('0x73')]});_0x750a95[_0x1968e2[_0x6401('0x5d')]['mapKey']]=_0x1968e2[_0x6401('0x5d')][_0x6401('0x75')];return db['CmContact']['create'](_0x750a95,{'fields':_0x4bc45c,'raw':!![]});}})[_0x6401('0x32')](handleEntityNotFound(_0x1f8ebf,null))[_0x6401('0x32')](function(_0x93c689){_0x2aea67[_0x6401('0x85')]=_0x93c689;if(_0x93c689){var _0x3dd8d8={'ContactId':_0x93c689['id'],'OpenchannelAccountId':_0x1968e2['params']['id'],'from':(_0x93c689[_0x6401('0x86')]||'')+'\x20'+(_0x93c689[_0x6401('0x87')]||'')};var _0x4c3441={'OpenchannelAccountId':_0x1968e2['params']['id'],'closed':![]};if(_0x1968e2[_0x6401('0x5d')]['threadId']){_0x4c3441['threadId']=_0x1968e2[_0x6401('0x5d')]['threadId'];return db[_0x6401('0x88')][_0x6401('0x56')]({'where':_0x4c3441})[_0x6401('0x32')](function(_0x1af3bd){if(_0x1af3bd){return[_0x1af3bd,![]];}_0x3dd8d8[_0x6401('0x89')]=_0x1968e2[_0x6401('0x5d')][_0x6401('0x89')];_0x3dd8d8[_0x6401('0x8a')]=_0x1968e2[_0x6401('0x5d')][_0x6401('0x8a')];return db[_0x6401('0x88')][_0x6401('0x5c')](_0x3dd8d8)[_0x6401('0x32')](function(_0x21f570){return[_0x21f570,!![]];});});}else{_0x4c3441['threadId']=null;}_0x4c3441['ContactId']=_0x93c689['id'];return db['OpenchannelInteraction'][_0x6401('0x56')]({'where':_0x4c3441})[_0x6401('0x32')](function(_0x422c7e){if(_0x422c7e){return[_0x422c7e,![]];}return db[_0x6401('0x88')][_0x6401('0x5c')](_0x3dd8d8)['then'](function(_0x50b2b0){return[_0x50b2b0,!![]];});});}})[_0x6401('0x8b')](function(_0x800a7d,_0x30691c){if(_0x800a7d){_0x1e93f9=_0x30691c;if(!_0x30691c){var _0xeae4ad={'from':(_0x2aea67[_0x6401('0x85')][_0x6401('0x86')]||'')+'\x20'+(_0x2aea67[_0x6401('0x85')][_0x6401('0x87')]||'')};if(_0x1968e2[_0x6401('0x5d')][_0x6401('0x89')]&&_0x1968e2[_0x6401('0x5d')][_0x6401('0x8c')]&&_0x1968e2[_0x6401('0x5d')]['threadId']!=_0x1968e2[_0x6401('0x5d')]['messageId']){_0xeae4ad[_0x6401('0x89')]=_0x1968e2[_0x6401('0x5d')]['messageId'];}return _0x800a7d[_0x6401('0x31')](_0xeae4ad);}else{return _0x800a7d;}}})[_0x6401('0x32')](function(_0xc88a74){_0x2aea67[_0x6401('0x8d')]=_0xc88a74[_0x6401('0x34')]({'plain':!![]});_0x2aea67[_0x6401('0x8d')][_0x6401('0x8e')]=_0x1e93f9;if(_0x2aea67[_0x6401('0x8d')][_0x6401('0x8e')]){if(_0x2aea67[_0x6401('0x82')][_0x6401('0x8f')]){_0x2aea67[_0x6401('0x83')][_0x6401('0x90')]({'id':0x0,'priority':_0x2aea67['applications'][_0x6401('0x46')]+0x1,'app':_0x6401('0x91'),'appdata':_0x6401('0x92'),'interval':_0x6401('0x93')});}}return db[_0x6401('0x94')]['create']({'body':_0x1968e2[_0x6401('0x5d')][_0x6401('0x5d')],'OpenchannelAccountId':_0x1968e2['params']['id'],'OpenchannelInteractionId':_0xc88a74['id'],'direction':'in','ContactId':_0x2aea67['contact']['id'],'AttachmentId':_0x1968e2[_0x6401('0x5d')][_0x6401('0x95')]});})[_0x6401('0x32')](function(_0x2e9259){_0x2aea67[_0x6401('0x22')]=_0x2e9259;if(_0x2aea67[_0x6401('0x8d')][_0x6401('0x96')]){return db[_0x6401('0x97')]['find']({'attributes':['id',_0x6401('0x37')],'where':{'id':_0x2aea67[_0x6401('0x8d')][_0x6401('0x96')]}})[_0x6401('0x32')](function(_0x3c0e6b){if(_0x3c0e6b){_0x2aea67['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3c0e6b[_0x6401('0x37')]+','+(_0x2aea67[_0x6401('0x82')][_0x6401('0x98')]||0xa),'interval':_0x6401('0x93')});_0x2aea67[_0x6401('0x99')]=![];}return respondWithRpcPromise(_0x6401('0x9a'),_0x6401('0x9b'),_0x2aea67);});}return respondWithRpcPromise(_0x6401('0x9a'),_0x6401('0x9b'),_0x2aea67);})[_0x6401('0x32')](function(_0x394503){respondWithRpcPromise(_0x6401('0x9c'),'EventManager',{'event':_0x6401('0x9d'),'message':_0x394503},client9002);return _0x394503;})[_0x6401('0x32')](respondWithResult(_0x1f8ebf,null))[_0x6401('0x51')](handleError(_0x1f8ebf,null));};exports[_0x6401('0x9e')]=function(_0x1f4069,_0x9cde49){var _0x1c9bc9=_0x1f4069[_0x6401('0x52')]['id'];var _0x421eb1=_0x1f4069[_0x6401('0x5d')];var _0x3b2c15=0xc8;var _0x9200e9=null;return db[_0x6401('0x9f')][_0x6401('0xa0')]({'isolationLevel':db[_0x6401('0x9f')][_0x6401('0xa1')][_0x6401('0xa2')][_0x6401('0xa3')]},function(_0x590561){return db[_0x6401('0x3b')][_0x6401('0x69')]({'where':{'id':_0x1c9bc9},'transaction':_0x590561})[_0x6401('0x32')](function(_0x485f89){if(_0x485f89){return db[_0x6401('0xa4')][_0x6401('0x33')]({'where':{'OpenchannelAccountId':_0x1c9bc9},'transaction':_0x590561})['then'](function(){var _0x2740bf=_[_0x6401('0x40')](_0x421eb1,function(_0x2a4bd3){_0x2a4bd3[_0x6401('0x60')]=_0x1c9bc9;return _0x2a4bd3;});return db[_0x6401('0xa4')][_0x6401('0xa5')](_0x2740bf,{'transaction':_0x590561});});}else{_0x3b2c15=0x194;_0x9200e9=[];}});})['then'](function(){if(_0x3b2c15!==0x194){return db['OpenchannelApplication'][_0x6401('0xa6')]({'where':{'OpenchannelAccountId':_0x1c9bc9},'order':'priority'})[_0x6401('0x32')](function(_0x199b72){_0x9200e9=_0x199b72;});}})[_0x6401('0x51')](function(_0x456a5f){_0x3b2c15=0x1f4;logger[_0x6401('0x20')](_0x456a5f[_0x6401('0x36')]);if(_0x456a5f[_0x6401('0x37')]){delete _0x456a5f['name'];}_0x9200e9=_0x456a5f;})['finally'](function(){if(_0x9200e9===null){_0x9cde49[_0x6401('0x25')](_0x3b2c15);}else{if(_0x3b2c15===0x1f4){_0x9cde49[_0x6401('0x26')](_0x3b2c15)['send'](_0x9200e9);}else{_0x9cde49['status'](_0x3b2c15)[_0x6401('0x28')](_0x9200e9);}}});};exports[_0x6401('0xa7')]=function(_0x147b0c,_0x491cd8,_0x43fafb){var _0x1c96bf={};var _0x181956={};var _0x541bf4;var _0x337c33;return db[_0x6401('0x3b')][_0x6401('0x69')]({'where':{'id':_0x147b0c['params']['id']}})['then'](handleEntityNotFound(_0x491cd8,null))[_0x6401('0x32')](function(_0x3c3b1a){if(_0x3c3b1a){_0x541bf4=_0x3c3b1a;_0x181956[_0x6401('0x3f')]=_[_0x6401('0x54')](db[_0x6401('0xa4')][_0x6401('0x3c')]);_0x181956[_0x6401('0x41')]=_[_0x6401('0x54')](_0x147b0c['query']);_0x181956['filters']=_[_0x6401('0x43')](_0x181956[_0x6401('0x3f')],_0x181956[_0x6401('0x41')]);_0x1c96bf[_0x6401('0x44')]=_[_0x6401('0x43')](_0x181956[_0x6401('0x3f')],qs['fields'](_0x147b0c[_0x6401('0x41')][_0x6401('0x45')]));_0x1c96bf['attributes']=_0x1c96bf[_0x6401('0x44')][_0x6401('0x46')]?_0x1c96bf['attributes']:_0x181956[_0x6401('0x3f')];_0x1c96bf[_0x6401('0x48')]=qs[_0x6401('0x64')](_0x147b0c[_0x6401('0x41')][_0x6401('0x64')]);_0x1c96bf['where']=qs[_0x6401('0x42')](_['pick'](_0x147b0c[_0x6401('0x41')],_0x181956['filters']));if(_0x147b0c[_0x6401('0x41')]['filter']){_0x1c96bf[_0x6401('0x49')]=_[_0x6401('0x4b')](_0x1c96bf[_0x6401('0x49')],{'$or':_['map'](_0x1c96bf[_0x6401('0x44')],function(_0xe7e86f){var _0x173dd7={};_0x173dd7[_0xe7e86f]={'$like':'%'+_0x147b0c[_0x6401('0x41')][_0x6401('0x4a')]+'%'};return _0x173dd7;})});}_0x1c96bf=_['merge']({},_0x1c96bf,_0x147b0c[_0x6401('0x4e')]);return _0x541bf4[_0x6401('0xa7')](_0x1c96bf);}})['then'](function(_0x9b82ad){if(_0x9b82ad){_0x337c33=_0x9b82ad[_0x6401('0x46')];if(!_0x147b0c[_0x6401('0x41')][_0x6401('0x63')]('nolimit')){_0x1c96bf[_0x6401('0x2b')]=qs[_0x6401('0x2b')](_0x147b0c[_0x6401('0x41')][_0x6401('0x2b')]);_0x1c96bf[_0x6401('0x29')]=qs[_0x6401('0x29')](_0x147b0c[_0x6401('0x41')]['offset']);}return _0x541bf4[_0x6401('0xa7')](_0x1c96bf);}})['then'](function(_0x3e0706){if(_0x3e0706){return _0x3e0706?{'count':_0x337c33,'rows':_0x3e0706}:null;}})['then'](respondWithResult(_0x491cd8,null))[_0x6401('0x51')](handleError(_0x491cd8,null));};exports['getInteractions']=function(_0x50b9a7,_0x433d1c,_0x548f6f){var _0x27c849={'raw':![],'where':{}};var _0x2b165a={};var _0x168179={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6401('0x69')]({'where':{'id':_0x50b9a7[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x433d1c,null))[_0x6401('0x32')](function(_0x56b9a9){if(_0x56b9a9){_0x2b165a[_0x6401('0x3f')]=_[_0x6401('0x54')](db[_0x6401('0x88')]['rawAttributes']);_0x2b165a[_0x6401('0x41')]=_[_0x6401('0x54')](_0x50b9a7['query']);_0x2b165a[_0x6401('0x42')]=_['intersection'](_0x2b165a[_0x6401('0x3f')],_0x2b165a['query']);_0x27c849[_0x6401('0x44')]=_[_0x6401('0x43')](_0x2b165a[_0x6401('0x3f')],qs[_0x6401('0x45')](_0x50b9a7[_0x6401('0x41')][_0x6401('0x45')]));_0x27c849['attributes']=_0x27c849['attributes'][_0x6401('0x46')]?_0x27c849[_0x6401('0x44')]:_0x2b165a['model'];if(!_0x50b9a7['query'][_0x6401('0x63')](_0x6401('0x47'))){_0x27c849[_0x6401('0x2b')]=qs[_0x6401('0x2b')](_0x50b9a7[_0x6401('0x41')][_0x6401('0x2b')]);_0x27c849[_0x6401('0x29')]=qs[_0x6401('0x29')](_0x50b9a7[_0x6401('0x41')][_0x6401('0x29')]);}_0x27c849[_0x6401('0x48')]=qs[_0x6401('0x64')](_0x50b9a7[_0x6401('0x41')][_0x6401('0x64')]);_0x27c849[_0x6401('0x49')]=qs[_0x6401('0x42')](_[_0x6401('0x6a')](_0x50b9a7['query'],_0x2b165a[_0x6401('0x42')]));_0x27c849[_0x6401('0x49')][_0x6401('0x60')]=_0x56b9a9['id'];if(_0x50b9a7[_0x6401('0x41')]['filter']){_0x27c849[_0x6401('0x49')]=_[_0x6401('0x4b')](_0x27c849[_0x6401('0x49')],{'$or':_['map'](_0x27c849[_0x6401('0x44')],function(_0x1637af){var _0x3f94ac={};_0x3f94ac[_0x1637af]={'$like':'%'+_0x50b9a7[_0x6401('0x41')]['filter']+'%'};return _0x3f94ac;})});}_0x27c849=_[_0x6401('0x4b')]({},_0x27c849,_0x50b9a7[_0x6401('0x4e')]);return db[_0x6401('0x88')][_0x6401('0x2c')]({'where':_0x27c849[_0x6401('0x49')]})[_0x6401('0x32')](function(_0x4a2b5e){_0x168179[_0x6401('0x2c')]=_0x4a2b5e;if(_0x50b9a7[_0x6401('0x41')][_0x6401('0x4f')]){_0x27c849['include']=[{'model':db[_0x6401('0x7e')],'as':_0x6401('0xa8'),'required':![]},{'model':db[_0x6401('0x97')],'as':'Owner','attributes':[_0x6401('0x37'),_0x6401('0xa9'),_0x6401('0xaa')],'required':![]},{'model':db[_0x6401('0xab')],'as':_0x6401('0xac'),'attributes':['id',_0x6401('0x37'),'color'],'where':_0x50b9a7[_0x6401('0x41')]['tag']?{'id':_0x50b9a7['query'][_0x6401('0xad')]}:undefined,'required':_0x50b9a7[_0x6401('0x41')][_0x6401('0xad')]?!![]:![]}];}return db[_0x6401('0x88')][_0x6401('0x50')](_0x27c849);})[_0x6401('0x32')](function(_0x284906){_0x168179[_0x6401('0x6b')]=_0x284906;return _0x168179;});}})[_0x6401('0x32')](respondWithFilteredResult(_0x433d1c,_0x27c849))['catch'](handleError(_0x433d1c,null));};exports[_0x6401('0xae')]=function(_0x339c0d,_0x843d8e,_0x3d5878){return db['OpenchannelAccount'][_0x6401('0x56')]({'where':{'id':_0x339c0d['params']['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x843d8e,null))['then'](function(_0x186cb9){if(_0x186cb9){return _0x186cb9[_0x6401('0xae')](_0x339c0d[_0x6401('0x5d')][_0x6401('0x66')],_[_0x6401('0xaf')](_0x339c0d[_0x6401('0x5d')],[_0x6401('0x66'),'id'])||{})[_0x6401('0x8b')](function(_0x5ad3b9){for(var _0x1d2fe2=0x0;_0x1d2fe2<_0x339c0d[_0x6401('0x5d')][_0x6401('0x66')][_0x6401('0x46')];_0x1d2fe2+=0x1){socket[_0x6401('0xb0')]('userOpenchannelAccount:save',{'UserId':Number(_0x339c0d[_0x6401('0x5d')][_0x6401('0x66')][_0x1d2fe2]),'OpenchannelAccountId':Number(_0x339c0d[_0x6401('0x52')]['id'])});}return _0x5ad3b9;});}})['then'](respondWithResult(_0x843d8e,null))[_0x6401('0x51')](handleError(_0x843d8e,null));};exports['removeAgents']=function(_0x1fa077,_0x575499,_0x333ea5){return db[_0x6401('0x3b')][_0x6401('0x56')]({'where':{'id':_0x1fa077['params']['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x575499,null))['then'](function(_0x2ac84e){if(_0x2ac84e){return _0x2ac84e[_0x6401('0xb1')](_0x1fa077['query'][_0x6401('0x66')])[_0x6401('0x32')](function(){if(_[_0x6401('0xb2')](_0x1fa077[_0x6401('0x41')][_0x6401('0x66')])){for(var _0x4f3ea5=0x0;_0x4f3ea5<_0x1fa077[_0x6401('0x41')][_0x6401('0x66')][_0x6401('0x46')];_0x4f3ea5+=0x1){socket['emit'](_0x6401('0xb3'),{'UserId':Number(_0x1fa077[_0x6401('0x41')]['ids'][_0x4f3ea5]),'OpenchannelAccountId':Number(_0x1fa077[_0x6401('0x52')]['id'])});}}else{socket[_0x6401('0xb0')](_0x6401('0xb3'),{'UserId':Number(_0x1fa077[_0x6401('0x41')][_0x6401('0x66')]),'OpenchannelAccountId':Number(_0x1fa077[_0x6401('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x575499,null))[_0x6401('0x51')](handleError(_0x575499,null));};exports[_0x6401('0xb4')]=function(_0x4f537e,_0xd33e3,_0x20fff4){var _0x1af855={};var _0x27da31={};var _0x454d54;var _0x31bf95;return db[_0x6401('0x3b')][_0x6401('0x69')]({'where':{'id':_0x4f537e[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0xd33e3,null))[_0x6401('0x32')](function(_0x1ca92d){if(_0x1ca92d){_0x454d54=_0x1ca92d;_0x27da31[_0x6401('0x3f')]=_[_0x6401('0x54')](db['User']['rawAttributes']);_0x27da31[_0x6401('0x41')]=_['keys'](_0x4f537e[_0x6401('0x41')]);_0x27da31[_0x6401('0x42')]=_[_0x6401('0x43')](_0x27da31['model'],_0x27da31[_0x6401('0x41')]);_0x1af855[_0x6401('0x44')]=_[_0x6401('0x43')](_0x27da31[_0x6401('0x3f')],qs['fields'](_0x4f537e[_0x6401('0x41')]['fields']));_0x1af855[_0x6401('0x44')]=_0x1af855['attributes'][_0x6401('0x46')]?_0x1af855['attributes']:_0x27da31[_0x6401('0x3f')];_0x1af855[_0x6401('0x48')]=qs[_0x6401('0x64')](_0x4f537e[_0x6401('0x41')][_0x6401('0x64')]);_0x1af855[_0x6401('0x49')]=qs['filters'](_[_0x6401('0x6a')](_0x4f537e[_0x6401('0x41')],_0x27da31['filters']));if(_0x4f537e[_0x6401('0x41')]['filter']){_0x1af855[_0x6401('0x49')]=_[_0x6401('0x4b')](_0x1af855[_0x6401('0x49')],{'$or':_[_0x6401('0x40')](_0x1af855[_0x6401('0x44')],function(_0x16f508){var _0x18dc02={};_0x18dc02[_0x16f508]={'$like':'%'+_0x4f537e[_0x6401('0x41')][_0x6401('0x4a')]+'%'};return _0x18dc02;})});}_0x1af855=_[_0x6401('0x4b')]({},_0x1af855,_0x4f537e[_0x6401('0x4e')]);return _0x454d54[_0x6401('0xb4')](_0x1af855);}})['then'](function(_0x41b094){if(_0x41b094){_0x31bf95=_0x41b094['length'];if(!_0x4f537e[_0x6401('0x41')][_0x6401('0x63')](_0x6401('0x47'))){_0x1af855[_0x6401('0x2b')]=qs['limit'](_0x4f537e[_0x6401('0x41')][_0x6401('0x2b')]);_0x1af855[_0x6401('0x29')]=qs[_0x6401('0x29')](_0x4f537e[_0x6401('0x41')][_0x6401('0x29')]);}return _0x454d54[_0x6401('0xb4')](_0x1af855);}})['then'](function(_0x417829){if(_0x417829){return _0x417829?{'count':_0x31bf95,'rows':_0x417829}:null;}})[_0x6401('0x32')](respondWithResult(_0xd33e3,null))[_0x6401('0x51')](handleError(_0xd33e3,null));};exports[_0x6401('0x38')]=function(_0x266c80,_0x54c5d5,_0xb187f2){var _0x39d97b,_0x3f3844,_0x10750a;if(_[_0x6401('0x74')](_0x266c80[_0x6401('0x5d')][_0x6401('0x5d')])||_0x266c80[_0x6401('0x5d')][_0x6401('0x5d')]===''){throw new db[(_0x6401('0x6d'))][(_0x6401('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6401('0x74')](_0x266c80[_0x6401('0x5d')]['to'])){}_0x39d97b=_0x266c80[_0x6401('0x5d')]['to'];return db[_0x6401('0x3b')][_0x6401('0x69')]({'where':{'id':_0x266c80[_0x6401('0x52')]['id']}})[_0x6401('0x32')](handleEntityNotFound(_0x54c5d5,null))[_0x6401('0x32')](function(_0x165d5d){if(_0x165d5d){return db[_0x6401('0x3b')][_0x6401('0x56')]({'where':{'id':_0x165d5d['id']},'include':[{'model':db['CmList'],'as':_0x6401('0x7d'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x165d5d[_0x6401('0x79')]]:_0x39d97b},'limit':0x1,'order':[['updatedAt',_0x6401('0x80')]]}]}]})['then'](handleEntityNotFound(_0x54c5d5,null))[_0x6401('0x32')](function(_0x22f79c){if(_0x22f79c&&_0x22f79c[_0x6401('0x7d')]){_0x3f3844=_0x22f79c[_0x6401('0x34')]({'plain':!![]});if(_0x3f3844[_0x6401('0x7d')]&&_0x3f3844['List'][_0x6401('0x7f')][_0x6401('0x46')]){return _0x3f3844[_0x6401('0x7d')][_0x6401('0x7f')][0x0];}return db[_0x6401('0x7e')][_0x6401('0x5c')](_['defaults'](_0x266c80[_0x6401('0x5d')],{'firstName':_0x39d97b,[_0x22f79c[_0x6401('0x79')]]:_0x39d97b,'phone':_0x39d97b,'ListId':_0x3f3844[_0x6401('0x73')]}));}})[_0x6401('0x32')](handleEntityNotFound(_0x54c5d5,null))[_0x6401('0x32')](function(_0x24266e){if(_0x24266e){_0x10750a=_0x24266e;return db[_0x6401('0x88')][_0x6401('0x56')]({'where':{'ContactId':_0x10750a['id'],'closed':![],'OpenchannelAccountId':_0x3f3844['id']}})['then'](function(_0x96ecec){if(_0x96ecec){return[_0x96ecec,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x266c80[_0x6401('0x57')]['id'],'ContactId':_0x10750a['id'],'OpenchannelAccountId':_0x3f3844['id'],'lastMsgDirection':_0x6401('0xb5'),'firstMsgDirection':_0x6401('0xb5'),'Messages':[_[_0x6401('0x4b')](_0x266c80[_0x6401('0x5d')],{'read':![],'body':_0x266c80[_0x6401('0x5d')][_0x6401('0x5d')],'OpenchannelAccountId':_0x3f3844['id'],'UserId':_0x266c80[_0x6401('0x57')]['id'],'ContactId':_0x10750a['id']})]},{'include':[{'model':db[_0x6401('0x94')],'as':_0x6401('0xb6')}]})[_0x6401('0x32')](function(_0x44332c){return[_0x44332c,!![]];});});}})[_0x6401('0x8b')](function(_0x10ec9a,_0x335e45){if(_0x335e45){return _0x10ec9a;}return db[_0x6401('0x94')][_0x6401('0x5c')](_[_0x6401('0x4b')](_0x266c80[_0x6401('0x5d')],{'read':![],'body':_0x266c80[_0x6401('0x5d')]['body'],'OpenchannelAccountId':_0x3f3844['id'],'OpenchannelInteractionId':_0x10ec9a['id'],'UserId':_0x266c80[_0x6401('0x57')]['id'],'ContactId':_0x10750a['id']}))['then'](function(_0x324a73){_0x10ec9a['dataValues']['Messages']=[];_0x10ec9a[_0x6401('0xb7')]['Messages']['push'](_0x324a73[_0x6401('0xb7')]);return _0x10ec9a;});});}})[_0x6401('0x32')](respondWithResult(_0x54c5d5,null))[_0x6401('0x51')](handleError(_0x54c5d5,null));}; \ No newline at end of file +var _0x6505=['get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','Disposition','getDispositions','order','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','orderBy','priority','asc','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','messageId','update','interaction','created','push','close','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x415e32,_0xce0a3d){var _0x514717=function(_0x92bd36){while(--_0x92bd36){_0x415e32['push'](_0x415e32['shift']());}};_0x514717(++_0xce0a3d);}(_0x6505,0x8c));var _0x5650=function(_0x4a08f1,_0x40b257){_0x4a08f1=_0x4a08f1-0x0;var _0x1f4d5d=_0x6505[_0x4a08f1];return _0x1f4d5d;};'use strict';var emlformat=require(_0x5650('0x0'));var rimraf=require(_0x5650('0x1'));var zipdir=require(_0x5650('0x2'));var jsonpatch=require(_0x5650('0x3'));var rp=require(_0x5650('0x4'));var moment=require(_0x5650('0x5'));var BPromise=require(_0x5650('0x6'));var Mustache=require(_0x5650('0x7'));var util=require(_0x5650('0x8'));var path=require(_0x5650('0x9'));var sox=require(_0x5650('0xa'));var csv=require('to-csv');var ejs=require(_0x5650('0xb'));var fs=require('fs');var fs_extra=require(_0x5650('0xc'));var _=require(_0x5650('0xd'));var squel=require(_0x5650('0xe'));var crypto=require(_0x5650('0xf'));var jsforce=require(_0x5650('0x10'));var deskjs=require(_0x5650('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5650('0x12'));var Papa=require('papaparse');var Redis=require(_0x5650('0x13'));var authService=require(_0x5650('0x14'));var qs=require(_0x5650('0x15'));var as=require(_0x5650('0x16'));var hardwareService=require(_0x5650('0x17'));var logger=require(_0x5650('0x18'))(_0x5650('0x19'));var utils=require(_0x5650('0x1a'));var config=require(_0x5650('0x1b'));var licenseUtil=require(_0x5650('0x1c'));var db=require(_0x5650('0x1d'))['db'];config[_0x5650('0x1e')]=_[_0x5650('0x1f')](config[_0x5650('0x1e')],{'host':_0x5650('0x20'),'port':0x18eb});var socket=require(_0x5650('0x21'))(new Redis(config[_0x5650('0x1e')]));require(_0x5650('0x22'))[_0x5650('0x23')](socket);var jayson=require(_0x5650('0x24'));var client=jayson['client'][_0x5650('0x25')]({'port':0x232c});var client9002=jayson[_0x5650('0x26')][_0x5650('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x239db9,_0x16e969,_0x96833c,_0x49efcd){return new BPromise(function(_0x3f0aa8,_0xee73cc){var _0x212418=_0x49efcd||client;return _0x212418[_0x5650('0x27')](_0x239db9,_0x96833c)[_0x5650('0x28')](function(_0x2896e2){logger[_0x5650('0x29')](_0x5650('0x2a'),_0x16e969,_0x5650('0x2b'));logger[_0x5650('0x2c')](_0x5650('0x2d'),_0x16e969,_0x5650('0x2b'),JSON[_0x5650('0x2e')](_0x2896e2));if(_0x2896e2[_0x5650('0x2f')]){if(_0x2896e2[_0x5650('0x2f')][_0x5650('0x30')]===0x1f4){logger[_0x5650('0x2f')]('OpenchannelAccount,\x20%s,\x20%s',_0x16e969,_0x2896e2[_0x5650('0x2f')][_0x5650('0x31')]);return _0xee73cc(_0x2896e2[_0x5650('0x2f')][_0x5650('0x31')]);}logger[_0x5650('0x2f')](_0x5650('0x2a'),_0x16e969,_0x2896e2[_0x5650('0x2f')][_0x5650('0x31')]);return _0x3f0aa8(_0x2896e2[_0x5650('0x2f')][_0x5650('0x31')]);}else{logger[_0x5650('0x29')](_0x5650('0x2a'),_0x16e969,_0x5650('0x2b'));_0x3f0aa8(_0x2896e2['result']['message']);}})['catch'](function(_0x138ae0){logger[_0x5650('0x2f')](_0x5650('0x2a'),_0x16e969,_0x138ae0);_0xee73cc(_0x138ae0);});});}function respondWithStatusCode(_0x58f88f,_0x5f4bbc){_0x5f4bbc=_0x5f4bbc||0xcc;return function(_0x269c4d){if(_0x269c4d){return _0x58f88f['sendStatus'](_0x5f4bbc);}return _0x58f88f[_0x5650('0x32')](_0x5f4bbc)[_0x5650('0x33')]();};}function respondWithResult(_0x2827d9,_0x985f4){_0x985f4=_0x985f4||0xc8;return function(_0xd01e4e){if(_0xd01e4e){return _0x2827d9[_0x5650('0x32')](_0x985f4)['json'](_0xd01e4e);}};}function respondWithFilteredResult(_0x5b3fc7,_0x42f52d){return function(_0x1aae82){if(_0x1aae82){var _0x322bdc=typeof _0x42f52d[_0x5650('0x34')]===_0x5650('0x35')&&typeof _0x42f52d[_0x5650('0x36')]==='undefined';var _0x32c425=_0x1aae82['count'];var _0x58ee91=_0x322bdc?0x0:_0x42f52d[_0x5650('0x34')];var _0x2a731f=_0x322bdc?_0x1aae82[_0x5650('0x37')]:_0x42f52d['offset']+_0x42f52d[_0x5650('0x36')];var _0x172545;if(_0x2a731f>=_0x32c425){_0x2a731f=_0x32c425;_0x172545=0xc8;}else{_0x172545=0xce;}_0x5b3fc7['status'](_0x172545);return _0x5b3fc7[_0x5650('0x38')](_0x5650('0x39'),_0x58ee91+'-'+_0x2a731f+'/'+_0x32c425)[_0x5650('0x3a')](_0x1aae82);}return null;};}function patchUpdates(_0x15b57f){return function(_0x31ebbc){try{jsonpatch[_0x5650('0x3b')](_0x31ebbc,_0x15b57f,!![]);}catch(_0x42e017){return BPromise[_0x5650('0x3c')](_0x42e017);}return _0x31ebbc[_0x5650('0x3d')]();};}function saveUpdates(_0x463a09,_0x79a5e5){return function(_0x42a6e9){if(_0x42a6e9){return _0x42a6e9['update'](_0x463a09)[_0x5650('0x28')](function(_0x415fef){return _0x415fef;});}return null;};}function removeEntity(_0x5b7763,_0x29a4fc){return function(_0x1f3aa4){if(_0x1f3aa4){return _0x1f3aa4['destroy']()['then'](function(){var _0x227447=_0x1f3aa4[_0x5650('0x3e')]({'plain':!![]});var _0x3db13f=_0x5650('0x3f');return db[_0x5650('0x40')]['destroy']({'where':{'type':_0x3db13f,'resourceId':_0x227447['id']}})['then'](function(){return _0x1f3aa4;});})[_0x5650('0x28')](function(){_0x5b7763[_0x5650('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415660,_0x38a3d8){return function(_0x4a1244){if(!_0x4a1244){_0x415660[_0x5650('0x41')](0x194);}return _0x4a1244;};}function handleError(_0x4fc5a5,_0x54931c){_0x54931c=_0x54931c||0x1f4;return function(_0xee03fb){logger[_0x5650('0x2f')](_0xee03fb[_0x5650('0x42')]);if(_0xee03fb[_0x5650('0x43')]){delete _0xee03fb['name'];}_0x4fc5a5[_0x5650('0x32')](_0x54931c)[_0x5650('0x44')](_0xee03fb);};}exports[_0x5650('0x45')]=function(_0xbab77f,_0x3f3415){var _0x2d1027={'include':[{'model':db[_0x5650('0x46')],'as':_0x5650('0x47')}]},_0x26c7ab={},_0x48ab08={'count':0x0,'rows':[]};var _0x1eea28=_[_0x5650('0x48')](db[_0x5650('0x49')][_0x5650('0x4a')],function(_0x4631a4){return{'name':_0x4631a4['fieldName'],'type':_0x4631a4[_0x5650('0x4b')][_0x5650('0x4c')]};});_0x26c7ab['model']=_[_0x5650('0x48')](_0x1eea28,_0x5650('0x43'));_0x26c7ab[_0x5650('0x4d')]=_[_0x5650('0x4e')](_0xbab77f[_0x5650('0x4d')]);_0x26c7ab['filters']=_[_0x5650('0x4f')](_0x26c7ab[_0x5650('0x50')],_0x26c7ab[_0x5650('0x4d')]);_0x2d1027[_0x5650('0x51')]=_['intersection'](_0x26c7ab[_0x5650('0x50')],qs[_0x5650('0x52')](_0xbab77f['query']['fields']));_0x2d1027['attributes']=_0x2d1027['attributes'][_0x5650('0x53')]?_0x2d1027[_0x5650('0x51')]:_0x26c7ab[_0x5650('0x50')];if(!_0xbab77f[_0x5650('0x4d')][_0x5650('0x54')](_0x5650('0x55'))){_0x2d1027[_0x5650('0x36')]=qs[_0x5650('0x36')](_0xbab77f[_0x5650('0x4d')][_0x5650('0x36')]);_0x2d1027[_0x5650('0x34')]=qs[_0x5650('0x34')](_0xbab77f[_0x5650('0x4d')][_0x5650('0x34')]);}_0x2d1027['order']=qs[_0x5650('0x56')](_0xbab77f[_0x5650('0x4d')][_0x5650('0x56')]);_0x2d1027[_0x5650('0x57')]=qs[_0x5650('0x58')](_[_0x5650('0x59')](_0xbab77f[_0x5650('0x4d')],_0x26c7ab[_0x5650('0x58')]),_0x1eea28);if(_0xbab77f[_0x5650('0x4d')][_0x5650('0x5a')]){_0x2d1027[_0x5650('0x57')]=_['merge'](_0x2d1027['where'],{'$or':_[_0x5650('0x48')](_0x1eea28,function(_0x50c4a4){if(_0x50c4a4[_0x5650('0x4b')]!==_0x5650('0x5b')){var _0x45f52a={};_0x45f52a[_0x50c4a4[_0x5650('0x43')]]={'$like':'%'+_0xbab77f['query'][_0x5650('0x5a')]+'%'};return _0x45f52a;}})});}_0x2d1027=_[_0x5650('0x5c')]({},_0x2d1027,_0xbab77f[_0x5650('0x5d')]);var _0xb0b082={'where':_0x2d1027['where']};return db[_0x5650('0x49')][_0x5650('0x37')](_0xb0b082)[_0x5650('0x28')](function(_0x42709a){_0x48ab08[_0x5650('0x37')]=_0x42709a;if(_0xbab77f[_0x5650('0x4d')][_0x5650('0x5e')]){_0x2d1027['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x5650('0x5f')](_0x2d1027);})[_0x5650('0x28')](function(_0xb6ac36){_0x48ab08[_0x5650('0x60')]=_0xb6ac36;return _0x48ab08;})[_0x5650('0x28')](respondWithFilteredResult(_0x3f3415,_0x2d1027))['catch'](handleError(_0x3f3415,null));};exports[_0x5650('0x61')]=function(_0x89b787,_0xef84db){var _0x44cd3e={'raw':![],'where':{'id':_0x89b787[_0x5650('0x62')]['id']},'include':[{'model':db[_0x5650('0x46')],'as':_0x5650('0x47')}]},_0x5b3f5a={};_0x5b3f5a[_0x5650('0x50')]=_['keys'](db[_0x5650('0x49')][_0x5650('0x4a')]);_0x5b3f5a['query']=_[_0x5650('0x4e')](_0x89b787[_0x5650('0x4d')]);_0x5b3f5a[_0x5650('0x58')]=_[_0x5650('0x4f')](_0x5b3f5a[_0x5650('0x50')],_0x5b3f5a[_0x5650('0x4d')]);_0x44cd3e['attributes']=_['intersection'](_0x5b3f5a[_0x5650('0x50')],qs[_0x5650('0x52')](_0x89b787[_0x5650('0x4d')][_0x5650('0x52')]));_0x44cd3e['attributes']=_0x44cd3e['attributes']['length']?_0x44cd3e['attributes']:_0x5b3f5a[_0x5650('0x50')];if(_0x89b787[_0x5650('0x4d')][_0x5650('0x5e')]){_0x44cd3e[_0x5650('0x63')]=[{'all':!![]}];}_0x44cd3e=_[_0x5650('0x5c')]({},_0x44cd3e,_0x89b787[_0x5650('0x5d')]);return db['OpenchannelAccount'][_0x5650('0x64')](_0x44cd3e)['then'](handleEntityNotFound(_0xef84db,null))[_0x5650('0x28')](respondWithResult(_0xef84db,null))[_0x5650('0x65')](handleError(_0xef84db,null));};exports[_0x5650('0x66')]=function(_0x38ddc9,_0x12a63c){return db['OpenchannelAccount']['create'](_0x38ddc9[_0x5650('0x67')],{})[_0x5650('0x28')](function(_0x495316){var _0x9433a6=_0x38ddc9[_0x5650('0x68')][_0x5650('0x3e')]({'plain':!![]});if(!_0x9433a6)throw new Error(_0x5650('0x69'));if(_0x9433a6['role']==='user'){var _0x27a51e=_0x495316[_0x5650('0x3e')]({'plain':!![]});var _0x4a2c27='OpenchannelAccounts';return db[_0x5650('0x6a')][_0x5650('0x64')]({'where':{'name':_0x4a2c27,'userProfileId':_0x9433a6[_0x5650('0x6b')]},'raw':!![]})[_0x5650('0x28')](function(_0x5e7fb9){if(_0x5e7fb9&&_0x5e7fb9[_0x5650('0x6c')]===0x0){return db[_0x5650('0x40')]['create']({'name':_0x27a51e[_0x5650('0x43')],'resourceId':_0x27a51e['id'],'type':_0x5e7fb9[_0x5650('0x43')],'sectionId':_0x5e7fb9['id']},{})[_0x5650('0x28')](function(){return _0x495316;});}else{return _0x495316;}})[_0x5650('0x65')](function(_0xe10f12){logger[_0x5650('0x2f')](_0x5650('0x6d'),_0xe10f12);throw _0xe10f12;});}return _0x495316;})[_0x5650('0x28')](respondWithResult(_0x12a63c,0xc9))[_0x5650('0x65')](handleError(_0x12a63c,null));};exports['update']=function(_0x5a4b58,_0x3c0f00){if(_0x5a4b58[_0x5650('0x67')]['id']){delete _0x5a4b58[_0x5650('0x67')]['id'];}return db[_0x5650('0x49')][_0x5650('0x64')]({'where':{'id':_0x5a4b58[_0x5650('0x62')]['id']},'include':[{'model':db[_0x5650('0x46')],'as':_0x5650('0x47')}]})[_0x5650('0x28')](handleEntityNotFound(_0x3c0f00,null))[_0x5650('0x28')](saveUpdates(_0x5a4b58[_0x5650('0x67')],null))[_0x5650('0x28')](respondWithResult(_0x3c0f00,null))[_0x5650('0x65')](handleError(_0x3c0f00,null));};exports[_0x5650('0x6e')]=function(_0x14cb12,_0x2ee826){return db[_0x5650('0x49')][_0x5650('0x64')]({'where':{'id':_0x14cb12[_0x5650('0x62')]['id']}})['then'](handleEntityNotFound(_0x2ee826,null))[_0x5650('0x28')](removeEntity(_0x2ee826,null))[_0x5650('0x65')](handleError(_0x2ee826,null));};exports[_0x5650('0x6f')]=function(_0x8f11fe,_0x28d448){return db[_0x5650('0x49')][_0x5650('0x6f')]()['then'](respondWithResult(_0x28d448,null))[_0x5650('0x65')](handleError(_0x28d448,null));};exports[_0x5650('0x70')]=function(_0x3f4573,_0x5cdd1f,_0x58ebba){if(_0x3f4573[_0x5650('0x67')]['id']){delete _0x3f4573['body']['id'];}return db[_0x5650('0x49')][_0x5650('0x64')]({'where':{'id':_0x3f4573[_0x5650('0x62')]['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x5cdd1f,null))[_0x5650('0x28')](function(_0xc9deec){if(_0xc9deec){_0x3f4573['body']['OpenchannelAccountId']=_0xc9deec['id'];return db[_0x5650('0x71')][_0x5650('0x66')](_0x3f4573['body']);}})[_0x5650('0x28')](respondWithResult(_0x5cdd1f,null))[_0x5650('0x65')](handleError(_0x5cdd1f,null));};exports[_0x5650('0x72')]=function(_0x27ca43,_0x13f915,_0x177e62){var _0x546da0={'raw':![],'where':{}};var _0x58cdf9={};var _0x548f0f={'count':0x0,'rows':[]};return db[_0x5650('0x49')]['findOne']({'where':{'id':_0x27ca43['params']['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x13f915,null))[_0x5650('0x28')](function(_0x5ad3e5){if(_0x5ad3e5){_0x58cdf9[_0x5650('0x50')]=_[_0x5650('0x4e')](db[_0x5650('0x71')]['rawAttributes']);_0x58cdf9[_0x5650('0x4d')]=_[_0x5650('0x4e')](_0x27ca43[_0x5650('0x4d')]);_0x58cdf9['filters']=_[_0x5650('0x4f')](_0x58cdf9[_0x5650('0x50')],_0x58cdf9[_0x5650('0x4d')]);_0x546da0[_0x5650('0x51')]=_[_0x5650('0x4f')](_0x58cdf9[_0x5650('0x50')],qs[_0x5650('0x52')](_0x27ca43[_0x5650('0x4d')][_0x5650('0x52')]));_0x546da0[_0x5650('0x51')]=_0x546da0['attributes']['length']?_0x546da0[_0x5650('0x51')]:_0x58cdf9['model'];if(!_0x27ca43[_0x5650('0x4d')]['hasOwnProperty']('nolimit')){_0x546da0[_0x5650('0x36')]=qs[_0x5650('0x36')](_0x27ca43[_0x5650('0x4d')][_0x5650('0x36')]);_0x546da0[_0x5650('0x34')]=qs[_0x5650('0x34')](_0x27ca43[_0x5650('0x4d')][_0x5650('0x34')]);}_0x546da0[_0x5650('0x73')]=qs[_0x5650('0x56')](_0x27ca43['query']['sort']);_0x546da0[_0x5650('0x57')]=qs['filters'](_[_0x5650('0x59')](_0x27ca43[_0x5650('0x4d')],_0x58cdf9[_0x5650('0x58')]));_0x546da0[_0x5650('0x57')][_0x5650('0x74')]=_0x5ad3e5['id'];if(_0x27ca43[_0x5650('0x4d')]['filter']){_0x546da0[_0x5650('0x57')]=_[_0x5650('0x5c')](_0x546da0[_0x5650('0x57')],{'$or':_[_0x5650('0x48')](_0x546da0[_0x5650('0x51')],function(_0x4e468d){var _0x383cba={};_0x383cba[_0x4e468d]={'$like':'%'+_0x27ca43[_0x5650('0x4d')][_0x5650('0x5a')]+'%'};return _0x383cba;})});}_0x546da0=_[_0x5650('0x5c')]({},_0x546da0,_0x27ca43['options']);return db[_0x5650('0x71')]['count']({'where':_0x546da0['where']})['then'](function(_0x7eff3a){_0x548f0f[_0x5650('0x37')]=_0x7eff3a;if(_0x27ca43[_0x5650('0x4d')][_0x5650('0x5e')]){_0x546da0[_0x5650('0x63')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x546da0);})[_0x5650('0x28')](function(_0x269686){_0x548f0f[_0x5650('0x60')]=_0x269686;return _0x548f0f;});}})['then'](respondWithFilteredResult(_0x13f915,_0x546da0))[_0x5650('0x65')](handleError(_0x13f915,null));};exports[_0x5650('0x75')]=function(_0x9c8c2d,_0x5e9e18,_0x1ab659){return db[_0x5650('0x49')][_0x5650('0x64')]({'where':{'id':_0x9c8c2d[_0x5650('0x62')]['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x5e9e18,null))[_0x5650('0x28')](function(_0x141e37){if(_0x141e37){return _0x141e37[_0x5650('0x75')](_0x9c8c2d[_0x5650('0x4d')][_0x5650('0x76')]);}})[_0x5650('0x28')](respondWithStatusCode(_0x5e9e18,null))[_0x5650('0x65')](handleError(_0x5e9e18,null));};exports[_0x5650('0x77')]=function(_0x19521d,_0x420753,_0x1ee5c3){if(_0x19521d['body']['id']){delete _0x19521d[_0x5650('0x67')]['id'];}return db[_0x5650('0x49')]['find']({'where':{'id':_0x19521d[_0x5650('0x62')]['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x420753,null))[_0x5650('0x28')](function(_0x45039c){if(_0x45039c){_0x19521d[_0x5650('0x67')]['OpenchannelAccountId']=_0x45039c['id'];return db[_0x5650('0x78')][_0x5650('0x66')](_0x19521d[_0x5650('0x67')]);}})[_0x5650('0x28')](respondWithResult(_0x420753,null))[_0x5650('0x65')](handleError(_0x420753,null));};exports[_0x5650('0x79')]=function(_0xb66754,_0x461172,_0x13ce6a){var _0xd5ce42={'raw':![],'where':{}};var _0x5e3c7e={};var _0x990591={'count':0x0,'rows':[]};return db[_0x5650('0x49')][_0x5650('0x7a')]({'where':{'id':_0xb66754[_0x5650('0x62')]['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x461172,null))['then'](function(_0x3795a9){if(_0x3795a9){_0x5e3c7e['model']=_[_0x5650('0x4e')](db[_0x5650('0x78')]['rawAttributes']);_0x5e3c7e[_0x5650('0x4d')]=_[_0x5650('0x4e')](_0xb66754[_0x5650('0x4d')]);_0x5e3c7e['filters']=_[_0x5650('0x4f')](_0x5e3c7e['model'],_0x5e3c7e[_0x5650('0x4d')]);_0xd5ce42[_0x5650('0x51')]=_['intersection'](_0x5e3c7e['model'],qs['fields'](_0xb66754[_0x5650('0x4d')]['fields']));_0xd5ce42[_0x5650('0x51')]=_0xd5ce42[_0x5650('0x51')]['length']?_0xd5ce42['attributes']:_0x5e3c7e[_0x5650('0x50')];if(!_0xb66754['query'][_0x5650('0x54')](_0x5650('0x55'))){_0xd5ce42[_0x5650('0x36')]=qs['limit'](_0xb66754[_0x5650('0x4d')][_0x5650('0x36')]);_0xd5ce42[_0x5650('0x34')]=qs['offset'](_0xb66754[_0x5650('0x4d')][_0x5650('0x34')]);}_0xd5ce42[_0x5650('0x73')]=qs[_0x5650('0x56')](_0xb66754[_0x5650('0x4d')][_0x5650('0x56')]);_0xd5ce42[_0x5650('0x57')]=qs[_0x5650('0x58')](_[_0x5650('0x59')](_0xb66754[_0x5650('0x4d')],_0x5e3c7e[_0x5650('0x58')]));_0xd5ce42[_0x5650('0x57')][_0x5650('0x74')]=_0x3795a9['id'];if(_0xb66754[_0x5650('0x4d')]['filter']){_0xd5ce42['where']=_['merge'](_0xd5ce42['where'],{'$or':_['map'](_0xd5ce42[_0x5650('0x51')],function(_0x3cfc76){var _0x47a8de={};_0x47a8de[_0x3cfc76]={'$like':'%'+_0xb66754[_0x5650('0x4d')][_0x5650('0x5a')]+'%'};return _0x47a8de;})});}_0xd5ce42=_[_0x5650('0x5c')]({},_0xd5ce42,_0xb66754[_0x5650('0x5d')]);return db['CannedAnswer']['count']({'where':_0xd5ce42[_0x5650('0x57')]})[_0x5650('0x28')](function(_0x5f57db){_0x990591['count']=_0x5f57db;if(_0xb66754[_0x5650('0x4d')][_0x5650('0x5e')]){_0xd5ce42[_0x5650('0x63')]=[{'all':!![]}];}return db[_0x5650('0x78')][_0x5650('0x5f')](_0xd5ce42);})['then'](function(_0x17807a){_0x990591[_0x5650('0x60')]=_0x17807a;return _0x990591;});}})[_0x5650('0x28')](respondWithFilteredResult(_0x461172,_0xd5ce42))[_0x5650('0x65')](handleError(_0x461172,null));};exports[_0x5650('0x7b')]=function(_0x30c632,_0x4b92fc,_0xe805c3){return db['OpenchannelAccount'][_0x5650('0x64')]({'where':{'id':_0x30c632[_0x5650('0x62')]['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x4b92fc,null))['then'](function(_0x44d32d){if(_0x44d32d){return _0x44d32d['removeAnswers'](_0x30c632[_0x5650('0x4d')][_0x5650('0x76')]);}})[_0x5650('0x28')](respondWithStatusCode(_0x4b92fc,null))[_0x5650('0x65')](handleError(_0x4b92fc,null));};exports[_0x5650('0x7c')]=function(_0x41b280,_0x24624a,_0x22ec11){var _0x1e3020={'body':_0x41b280[_0x5650('0x67')],'channel':_0x5650('0x7d')};var _0x2deb33=[];var _0x4e2bd2=[];var _0x1d5bfa={};var _0x566356=![];return db[_0x5650('0x7e')]['describe']()[_0x5650('0x28')](function(_0x1eef75){if(!_0x1eef75){throw new db[(_0x5650('0x7f'))][(_0x5650('0x80'))]('no\x20available\x20attributes');}_0x2deb33=_[_0x5650('0x81')](_[_0x5650('0x4e')](_0x1eef75),[_0x5650('0x82'),_0x5650('0x83')]);_0x4e2bd2=_[_0x5650('0x81')](_['keys'](_0x1eef75),[_0x5650('0x82'),_0x5650('0x83'),_0x5650('0x84'),_0x5650('0x85')]);if(_0x41b280[_0x5650('0x67')]['id']){delete _0x41b280['body']['id'];}if(_[_0x5650('0x86')](_0x41b280[_0x5650('0x67')][_0x5650('0x87')])){throw new db['Sequelize'][(_0x5650('0x80'))]('from\x20is\x20mandatory');}if(_[_0x5650('0x86')](_0x41b280[_0x5650('0x67')]['body'])||_0x41b280[_0x5650('0x67')][_0x5650('0x67')]===''){throw new db[(_0x5650('0x7f'))][(_0x5650('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x41b280[_0x5650('0x67')][_0x5650('0x88')])){throw new db[(_0x5650('0x7f'))]['ValidationError'](_0x5650('0x89')+_0x4e2bd2);}if(!_[_0x5650('0x8a')](_0x4e2bd2,_0x41b280[_0x5650('0x67')][_0x5650('0x88')])){throw new db['Sequelize'][(_0x5650('0x80'))](_0x5650('0x8b')+_0x4e2bd2);}_0x1d5bfa[_0x41b280[_0x5650('0x67')][_0x5650('0x88')]]=_0x41b280[_0x5650('0x67')][_0x5650('0x87')];})[_0x5650('0x28')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x41b280[_0x5650('0x62')]['id']},'include':[{'model':db[_0x5650('0x8c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x5650('0x8d'),'where':_0x1d5bfa,'limit':0x1,'order':[['updatedAt',_0x5650('0x8e')]]}]},{'model':db[_0x5650('0x8f')],'as':_0x5650('0x90')}]});})[_0x5650('0x28')](handleEntityNotFound(_0x24624a,null))[_0x5650('0x28')](function(_0xf1bd54){if(_0xf1bd54&&_0xf1bd54[_0x5650('0x91')]){_0x1e3020[_0x5650('0x92')]=_0xf1bd54;_0x1e3020[_0x5650('0x93')]=_0xf1bd54[_0x5650('0x90')];_0x1e3020['list']=_0xf1bd54['List'];_0x1e3020['applications']=_[_0x5650('0x94')](_0x1e3020[_0x5650('0x93')],[_0x5650('0x95')],[_0x5650('0x96')]);if(_0x1e3020[_0x5650('0x92')][_0x5650('0x90')]){delete _0x1e3020[_0x5650('0x92')][_0x5650('0x90')];}if(_0x1e3020[_0x5650('0x92')][_0x5650('0x91')]&&_0x1e3020[_0x5650('0x92')][_0x5650('0x91')]['Contacts'][_0x5650('0x53')]){return _0x1e3020['account'][_0x5650('0x91')][_0x5650('0x8d')][0x0];}var _0x22c5dc=_['defaults'](_0x41b280[_0x5650('0x67')],{'firstName':_0x41b280['body'][_0x5650('0x87')],'ListId':_0xf1bd54[_0x5650('0x85')]});_0x22c5dc[_0x41b280[_0x5650('0x67')][_0x5650('0x88')]]=_0x41b280[_0x5650('0x67')][_0x5650('0x87')];return db[_0x5650('0x7e')][_0x5650('0x66')](_0x22c5dc,{'fields':_0x2deb33,'raw':!![]});}})['then'](handleEntityNotFound(_0x24624a,null))['then'](function(_0x3f7834){_0x1e3020['contact']=_0x3f7834;if(_0x3f7834){var _0x7d5ad0={'ContactId':_0x3f7834['id'],'OpenchannelAccountId':_0x41b280[_0x5650('0x62')]['id'],'from':(_0x3f7834[_0x5650('0x97')]||'')+'\x20'+(_0x3f7834[_0x5650('0x98')]||'')};var _0x42d0cb={'OpenchannelAccountId':_0x41b280[_0x5650('0x62')]['id'],'closed':![]};if(_0x41b280[_0x5650('0x67')][_0x5650('0x99')]){_0x42d0cb[_0x5650('0x99')]=_0x41b280[_0x5650('0x67')][_0x5650('0x99')];return db['OpenchannelInteraction'][_0x5650('0x64')]({'where':_0x42d0cb})[_0x5650('0x28')](function(_0x44bc5d){if(_0x44bc5d){return[_0x44bc5d,![]];}_0x7d5ad0[_0x5650('0x99')]=_0x41b280[_0x5650('0x67')][_0x5650('0x99')];_0x7d5ad0[_0x5650('0x9a')]=_0x41b280[_0x5650('0x67')][_0x5650('0x9a')];return db['OpenchannelInteraction'][_0x5650('0x66')](_0x7d5ad0)['then'](function(_0x25e42b){return[_0x25e42b,!![]];});});}else{_0x42d0cb[_0x5650('0x99')]=null;}_0x42d0cb[_0x5650('0x9b')]=_0x3f7834['id'];return db[_0x5650('0x9c')][_0x5650('0x64')]({'where':_0x42d0cb})[_0x5650('0x28')](function(_0x4828e8){if(_0x4828e8){return[_0x4828e8,![]];}return db['OpenchannelInteraction'][_0x5650('0x66')](_0x7d5ad0)['then'](function(_0x4f16c2){return[_0x4f16c2,!![]];});});}})[_0x5650('0x9d')](function(_0x32aa58,_0x8e8e76){if(_0x32aa58){_0x566356=_0x8e8e76;if(!_0x8e8e76){var _0x206380={'from':(_0x1e3020['contact'][_0x5650('0x97')]||'')+'\x20'+(_0x1e3020[_0x5650('0x9e')]['lastName']||'')};if(_0x41b280[_0x5650('0x67')]['threadId']&&_0x41b280['body'][_0x5650('0x9f')]&&_0x41b280[_0x5650('0x67')][_0x5650('0x99')]!=_0x41b280[_0x5650('0x67')]['messageId']){_0x206380[_0x5650('0x99')]=_0x41b280[_0x5650('0x67')][_0x5650('0x9f')];}return _0x32aa58[_0x5650('0xa0')](_0x206380);}else{return _0x32aa58;}}})[_0x5650('0x28')](function(_0x4ce09e){_0x1e3020[_0x5650('0xa1')]=_0x4ce09e[_0x5650('0x3e')]({'plain':!![]});_0x1e3020[_0x5650('0xa1')][_0x5650('0xa2')]=_0x566356;if(_0x1e3020['interaction'][_0x5650('0xa2')]){if(_0x1e3020[_0x5650('0x92')]['autoclose']){_0x1e3020['applications'][_0x5650('0xa3')]({'id':0x0,'priority':_0x1e3020[_0x5650('0x93')][_0x5650('0x53')]+0x1,'app':_0x5650('0xa4'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x5650('0xa5')][_0x5650('0x66')]({'body':_0x41b280[_0x5650('0x67')][_0x5650('0x67')],'OpenchannelAccountId':_0x41b280['params']['id'],'OpenchannelInteractionId':_0x4ce09e['id'],'direction':'in','ContactId':_0x1e3020[_0x5650('0x9e')]['id'],'AttachmentId':_0x41b280['body'][_0x5650('0xa6')]});})[_0x5650('0x28')](function(_0x5737ee){_0x1e3020[_0x5650('0x31')]=_0x5737ee;if(_0x1e3020[_0x5650('0xa1')][_0x5650('0xa7')]){return db[_0x5650('0xa8')][_0x5650('0x64')]({'attributes':['id',_0x5650('0x43')],'where':{'id':_0x1e3020[_0x5650('0xa1')]['UserId']}})[_0x5650('0x28')](function(_0x45d2d4){if(_0x45d2d4){_0x1e3020['applications'][_0x5650('0xa9')]({'id':0x0,'priority':0x0,'app':_0x5650('0xaa'),'appdata':_0x45d2d4[_0x5650('0x43')]+','+(_0x1e3020[_0x5650('0x92')][_0x5650('0xab')]||0xa),'interval':'*,*,*,*'});_0x1e3020[_0x5650('0xac')]=![];}return respondWithRpcPromise(_0x5650('0xad'),_0x5650('0xae'),_0x1e3020);});}return respondWithRpcPromise(_0x5650('0xad'),'startRouting',_0x1e3020);})[_0x5650('0x28')](function(_0x35497d){respondWithRpcPromise(_0x5650('0xaf'),_0x5650('0xaf'),{'event':_0x5650('0x7c'),'message':_0x35497d},client9002);return _0x35497d;})[_0x5650('0x28')](respondWithResult(_0x24624a,null))['catch'](handleError(_0x24624a,null));};exports[_0x5650('0xb0')]=function(_0x26572d,_0x3d9d70){var _0x492643=_0x26572d[_0x5650('0x62')]['id'];var _0x14e67a=_0x26572d[_0x5650('0x67')];var _0xaacafe=0xc8;var _0x152685=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x5650('0xb1')][_0x5650('0xb2')]['ISOLATION_LEVELS'][_0x5650('0xb3')]},function(_0x46ba5e){return db[_0x5650('0x49')][_0x5650('0x7a')]({'where':{'id':_0x492643},'transaction':_0x46ba5e})[_0x5650('0x28')](function(_0x317841){if(_0x317841){return db[_0x5650('0x8f')][_0x5650('0x6e')]({'where':{'OpenchannelAccountId':_0x492643},'transaction':_0x46ba5e})['then'](function(){var _0x30b133=_[_0x5650('0x48')](_0x14e67a,function(_0x14d000){_0x14d000[_0x5650('0x74')]=_0x492643;return _0x14d000;});return db['OpenchannelApplication'][_0x5650('0xb4')](_0x30b133,{'transaction':_0x46ba5e});});}else{_0xaacafe=0x194;_0x152685=[];}});})[_0x5650('0x28')](function(){if(_0xaacafe!==0x194){return db[_0x5650('0x8f')][_0x5650('0xb5')]({'where':{'OpenchannelAccountId':_0x492643},'order':_0x5650('0x95')})[_0x5650('0x28')](function(_0x326f91){_0x152685=_0x326f91;});}})[_0x5650('0x65')](function(_0x41d76d){_0xaacafe=0x1f4;logger[_0x5650('0x2f')](_0x41d76d[_0x5650('0x42')]);if(_0x41d76d[_0x5650('0x43')]){delete _0x41d76d[_0x5650('0x43')];}_0x152685=_0x41d76d;})['finally'](function(){if(_0x152685===null){_0x3d9d70[_0x5650('0x41')](_0xaacafe);}else{if(_0xaacafe===0x1f4){_0x3d9d70[_0x5650('0x32')](_0xaacafe)['send'](_0x152685);}else{_0x3d9d70[_0x5650('0x32')](_0xaacafe)['json'](_0x152685);}}});};exports['getApplications']=function(_0x5e642a,_0x146445,_0xaa70c6){var _0x80b662={};var _0x4482d2={};var _0x239c05;var _0x4e905c;return db[_0x5650('0x49')]['findOne']({'where':{'id':_0x5e642a[_0x5650('0x62')]['id']}})['then'](handleEntityNotFound(_0x146445,null))[_0x5650('0x28')](function(_0x2c65d8){if(_0x2c65d8){_0x239c05=_0x2c65d8;_0x4482d2[_0x5650('0x50')]=_[_0x5650('0x4e')](db[_0x5650('0x8f')][_0x5650('0x4a')]);_0x4482d2[_0x5650('0x4d')]=_[_0x5650('0x4e')](_0x5e642a['query']);_0x4482d2[_0x5650('0x58')]=_[_0x5650('0x4f')](_0x4482d2['model'],_0x4482d2['query']);_0x80b662[_0x5650('0x51')]=_[_0x5650('0x4f')](_0x4482d2[_0x5650('0x50')],qs[_0x5650('0x52')](_0x5e642a[_0x5650('0x4d')][_0x5650('0x52')]));_0x80b662[_0x5650('0x51')]=_0x80b662[_0x5650('0x51')][_0x5650('0x53')]?_0x80b662['attributes']:_0x4482d2['model'];_0x80b662[_0x5650('0x73')]=qs[_0x5650('0x56')](_0x5e642a['query'][_0x5650('0x56')]);_0x80b662['where']=qs['filters'](_['pick'](_0x5e642a['query'],_0x4482d2[_0x5650('0x58')]));if(_0x5e642a['query']['filter']){_0x80b662[_0x5650('0x57')]=_[_0x5650('0x5c')](_0x80b662[_0x5650('0x57')],{'$or':_[_0x5650('0x48')](_0x80b662[_0x5650('0x51')],function(_0x1c6b99){var _0x3d001c={};_0x3d001c[_0x1c6b99]={'$like':'%'+_0x5e642a[_0x5650('0x4d')]['filter']+'%'};return _0x3d001c;})});}_0x80b662=_[_0x5650('0x5c')]({},_0x80b662,_0x5e642a[_0x5650('0x5d')]);return _0x239c05[_0x5650('0xb6')](_0x80b662);}})[_0x5650('0x28')](function(_0x773ef7){if(_0x773ef7){_0x4e905c=_0x773ef7[_0x5650('0x53')];if(!_0x5e642a[_0x5650('0x4d')][_0x5650('0x54')](_0x5650('0x55'))){_0x80b662[_0x5650('0x36')]=qs[_0x5650('0x36')](_0x5e642a['query']['limit']);_0x80b662[_0x5650('0x34')]=qs[_0x5650('0x34')](_0x5e642a['query'][_0x5650('0x34')]);}return _0x239c05[_0x5650('0xb6')](_0x80b662);}})[_0x5650('0x28')](function(_0x5efe02){if(_0x5efe02){return _0x5efe02?{'count':_0x4e905c,'rows':_0x5efe02}:null;}})[_0x5650('0x28')](respondWithResult(_0x146445,null))[_0x5650('0x65')](handleError(_0x146445,null));};exports[_0x5650('0xb7')]=function(_0x3e3412,_0xa9d523,_0x111890){var _0x119769={'raw':![],'where':{}};var _0x21253b={};var _0x4a4906={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5650('0x7a')]({'where':{'id':_0x3e3412['params']['id']}})[_0x5650('0x28')](handleEntityNotFound(_0xa9d523,null))[_0x5650('0x28')](function(_0x4dd0ec){if(_0x4dd0ec){_0x21253b['model']=_[_0x5650('0x4e')](db[_0x5650('0x9c')]['rawAttributes']);_0x21253b[_0x5650('0x4d')]=_[_0x5650('0x4e')](_0x3e3412[_0x5650('0x4d')]);_0x21253b[_0x5650('0x58')]=_[_0x5650('0x4f')](_0x21253b['model'],_0x21253b[_0x5650('0x4d')]);_0x119769[_0x5650('0x51')]=_[_0x5650('0x4f')](_0x21253b[_0x5650('0x50')],qs[_0x5650('0x52')](_0x3e3412['query'][_0x5650('0x52')]));_0x119769[_0x5650('0x51')]=_0x119769[_0x5650('0x51')]['length']?_0x119769[_0x5650('0x51')]:_0x21253b[_0x5650('0x50')];if(!_0x3e3412[_0x5650('0x4d')]['hasOwnProperty'](_0x5650('0x55'))){_0x119769[_0x5650('0x36')]=qs[_0x5650('0x36')](_0x3e3412['query'][_0x5650('0x36')]);_0x119769[_0x5650('0x34')]=qs[_0x5650('0x34')](_0x3e3412[_0x5650('0x4d')][_0x5650('0x34')]);}_0x119769[_0x5650('0x73')]=qs[_0x5650('0x56')](_0x3e3412[_0x5650('0x4d')][_0x5650('0x56')]);_0x119769[_0x5650('0x57')]=qs['filters'](_['pick'](_0x3e3412['query'],_0x21253b[_0x5650('0x58')]));_0x119769[_0x5650('0x57')][_0x5650('0x74')]=_0x4dd0ec['id'];if(_0x3e3412['query']['filter']){_0x119769[_0x5650('0x57')]=_[_0x5650('0x5c')](_0x119769[_0x5650('0x57')],{'$or':_[_0x5650('0x48')](_0x119769['attributes'],function(_0x306156){var _0x30ea2f={};_0x30ea2f[_0x306156]={'$like':'%'+_0x3e3412[_0x5650('0x4d')]['filter']+'%'};return _0x30ea2f;})});}_0x119769=_['merge']({},_0x119769,_0x3e3412['options']);return db[_0x5650('0x9c')][_0x5650('0x37')]({'where':_0x119769['where']})[_0x5650('0x28')](function(_0xf21929){_0x4a4906[_0x5650('0x37')]=_0xf21929;if(_0x3e3412[_0x5650('0x4d')][_0x5650('0x5e')]){_0x119769[_0x5650('0x63')]=[{'model':db['CmContact'],'as':_0x5650('0xb8'),'required':![]},{'model':db[_0x5650('0xa8')],'as':_0x5650('0xb9'),'attributes':[_0x5650('0x43'),_0x5650('0xba'),_0x5650('0xbb')],'required':![]},{'model':db[_0x5650('0xbc')],'as':'Tags','attributes':['id','name',_0x5650('0xbd')],'where':_0x3e3412[_0x5650('0x4d')][_0x5650('0xbe')]?{'id':_0x3e3412[_0x5650('0x4d')][_0x5650('0xbe')]}:undefined,'required':_0x3e3412['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x5650('0x5f')](_0x119769);})[_0x5650('0x28')](function(_0x3f6fbb){_0x4a4906[_0x5650('0x60')]=_0x3f6fbb;return _0x4a4906;});}})['then'](respondWithFilteredResult(_0xa9d523,_0x119769))[_0x5650('0x65')](handleError(_0xa9d523,null));};exports[_0x5650('0xbf')]=function(_0x1a3b54,_0x314153,_0x2592e1){return db[_0x5650('0x49')][_0x5650('0x64')]({'where':{'id':_0x1a3b54['params']['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x314153,null))[_0x5650('0x28')](function(_0x399273){if(_0x399273){return _0x399273[_0x5650('0xbf')](_0x1a3b54[_0x5650('0x67')][_0x5650('0x76')],_[_0x5650('0xc0')](_0x1a3b54[_0x5650('0x67')],[_0x5650('0x76'),'id'])||{})[_0x5650('0x9d')](function(_0x445507){for(var _0x203425=0x0;_0x203425<_0x1a3b54['body'][_0x5650('0x76')][_0x5650('0x53')];_0x203425+=0x1){socket[_0x5650('0xc1')](_0x5650('0xc2'),{'UserId':Number(_0x1a3b54[_0x5650('0x67')][_0x5650('0x76')][_0x203425]),'OpenchannelAccountId':Number(_0x1a3b54[_0x5650('0x62')]['id'])});}return _0x445507;});}})[_0x5650('0x28')](respondWithResult(_0x314153,null))[_0x5650('0x65')](handleError(_0x314153,null));};exports[_0x5650('0xc3')]=function(_0x517bf1,_0xea5901,_0x46b082){return db[_0x5650('0x49')][_0x5650('0x64')]({'where':{'id':_0x517bf1['params']['id']}})[_0x5650('0x28')](handleEntityNotFound(_0xea5901,null))[_0x5650('0x28')](function(_0x55356c){if(_0x55356c){return _0x55356c[_0x5650('0xc3')](_0x517bf1['query']['ids'])['then'](function(){if(_['isArray'](_0x517bf1[_0x5650('0x4d')]['ids'])){for(var _0x409e86=0x0;_0x409e86<_0x517bf1['query'][_0x5650('0x76')][_0x5650('0x53')];_0x409e86+=0x1){socket[_0x5650('0xc1')]('userOpenchannelAccount:remove',{'UserId':Number(_0x517bf1[_0x5650('0x4d')][_0x5650('0x76')][_0x409e86]),'OpenchannelAccountId':Number(_0x517bf1['params']['id'])});}}else{socket[_0x5650('0xc1')](_0x5650('0xc4'),{'UserId':Number(_0x517bf1[_0x5650('0x4d')][_0x5650('0x76')]),'OpenchannelAccountId':Number(_0x517bf1[_0x5650('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0xea5901,null))[_0x5650('0x65')](handleError(_0xea5901,null));};exports[_0x5650('0xc5')]=function(_0x473658,_0x119c1e,_0x22bbe6){var _0x447f02={};var _0x214ba4={};var _0xe911ee;var _0x57ac90;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x473658[_0x5650('0x62')]['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x119c1e,null))[_0x5650('0x28')](function(_0x42c113){if(_0x42c113){_0xe911ee=_0x42c113;_0x214ba4[_0x5650('0x50')]=_['keys'](db[_0x5650('0xa8')][_0x5650('0x4a')]);_0x214ba4[_0x5650('0x4d')]=_[_0x5650('0x4e')](_0x473658[_0x5650('0x4d')]);_0x214ba4[_0x5650('0x58')]=_['intersection'](_0x214ba4[_0x5650('0x50')],_0x214ba4[_0x5650('0x4d')]);_0x447f02[_0x5650('0x51')]=_[_0x5650('0x4f')](_0x214ba4[_0x5650('0x50')],qs[_0x5650('0x52')](_0x473658[_0x5650('0x4d')]['fields']));_0x447f02[_0x5650('0x51')]=_0x447f02[_0x5650('0x51')]['length']?_0x447f02[_0x5650('0x51')]:_0x214ba4['model'];_0x447f02[_0x5650('0x73')]=qs[_0x5650('0x56')](_0x473658[_0x5650('0x4d')][_0x5650('0x56')]);_0x447f02[_0x5650('0x57')]=qs[_0x5650('0x58')](_['pick'](_0x473658[_0x5650('0x4d')],_0x214ba4[_0x5650('0x58')]));if(_0x473658[_0x5650('0x4d')][_0x5650('0x5a')]){_0x447f02[_0x5650('0x57')]=_[_0x5650('0x5c')](_0x447f02['where'],{'$or':_[_0x5650('0x48')](_0x447f02[_0x5650('0x51')],function(_0x1cb662){var _0x3d8998={};_0x3d8998[_0x1cb662]={'$like':'%'+_0x473658[_0x5650('0x4d')][_0x5650('0x5a')]+'%'};return _0x3d8998;})});}_0x447f02=_[_0x5650('0x5c')]({},_0x447f02,_0x473658[_0x5650('0x5d')]);return _0xe911ee['getAgents'](_0x447f02);}})[_0x5650('0x28')](function(_0x13cae4){if(_0x13cae4){_0x57ac90=_0x13cae4[_0x5650('0x53')];if(!_0x473658['query']['hasOwnProperty'](_0x5650('0x55'))){_0x447f02['limit']=qs[_0x5650('0x36')](_0x473658['query'][_0x5650('0x36')]);_0x447f02['offset']=qs[_0x5650('0x34')](_0x473658[_0x5650('0x4d')][_0x5650('0x34')]);}return _0xe911ee[_0x5650('0xc5')](_0x447f02);}})['then'](function(_0x3ff72c){if(_0x3ff72c){return _0x3ff72c?{'count':_0x57ac90,'rows':_0x3ff72c}:null;}})[_0x5650('0x28')](respondWithResult(_0x119c1e,null))[_0x5650('0x65')](handleError(_0x119c1e,null));};exports[_0x5650('0x44')]=function(_0x18e4c3,_0x4b5c50,_0x49ea18){var _0x2476b3,_0x1c87a9,_0x27ffd7;if(_[_0x5650('0x86')](_0x18e4c3[_0x5650('0x67')][_0x5650('0x67')])||_0x18e4c3['body']['body']===''){throw new db[(_0x5650('0x7f'))][(_0x5650('0x80'))](_0x5650('0xc6'));}if(_[_0x5650('0x86')](_0x18e4c3[_0x5650('0x67')]['to'])){}_0x2476b3=_0x18e4c3[_0x5650('0x67')]['to'];return db[_0x5650('0x49')][_0x5650('0x7a')]({'where':{'id':_0x18e4c3[_0x5650('0x62')]['id']}})[_0x5650('0x28')](handleEntityNotFound(_0x4b5c50,null))[_0x5650('0x28')](function(_0x3cebf6){if(_0x3cebf6){return db[_0x5650('0x49')][_0x5650('0x64')]({'where':{'id':_0x3cebf6['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x5650('0x7e')],'as':_0x5650('0x8d'),'where':{[_0x3cebf6['mapKey']]:_0x2476b3},'limit':0x1,'order':[[_0x5650('0x83'),_0x5650('0x8e')]]}]}]})[_0x5650('0x28')](handleEntityNotFound(_0x4b5c50,null))[_0x5650('0x28')](function(_0x28d0c2){if(_0x28d0c2&&_0x28d0c2[_0x5650('0x91')]){_0x1c87a9=_0x28d0c2[_0x5650('0x3e')]({'plain':!![]});if(_0x1c87a9[_0x5650('0x91')]&&_0x1c87a9[_0x5650('0x91')][_0x5650('0x8d')]['length']){return _0x1c87a9[_0x5650('0x91')]['Contacts'][0x0];}return db['CmContact'][_0x5650('0x66')](_['defaults'](_0x18e4c3[_0x5650('0x67')],{'firstName':_0x2476b3,[_0x28d0c2['mapKey']]:_0x2476b3,'phone':_0x2476b3,'ListId':_0x1c87a9[_0x5650('0x85')]}));}})['then'](handleEntityNotFound(_0x4b5c50,null))[_0x5650('0x28')](function(_0x5a387b){if(_0x5a387b){_0x27ffd7=_0x5a387b;return db[_0x5650('0x9c')][_0x5650('0x64')]({'where':{'ContactId':_0x27ffd7['id'],'closed':![],'OpenchannelAccountId':_0x1c87a9['id']}})[_0x5650('0x28')](function(_0x3755d3){if(_0x3755d3){return[_0x3755d3,![]];}return db[_0x5650('0x9c')][_0x5650('0x66')]({'UserId':_0x18e4c3[_0x5650('0x68')]['id'],'ContactId':_0x27ffd7['id'],'OpenchannelAccountId':_0x1c87a9['id'],'lastMsgDirection':'out','firstMsgDirection':_0x5650('0xc7'),'Messages':[_[_0x5650('0x5c')](_0x18e4c3[_0x5650('0x67')],{'read':![],'body':_0x18e4c3[_0x5650('0x67')][_0x5650('0x67')],'OpenchannelAccountId':_0x1c87a9['id'],'UserId':_0x18e4c3[_0x5650('0x68')]['id'],'ContactId':_0x27ffd7['id']})]},{'include':[{'model':db[_0x5650('0xa5')],'as':_0x5650('0xc8')}]})[_0x5650('0x28')](function(_0x3e58d2){return[_0x3e58d2,!![]];});});}})[_0x5650('0x9d')](function(_0x47ddf7,_0x59468f){if(_0x59468f){return _0x47ddf7;}return db['OpenchannelMessage'][_0x5650('0x66')](_[_0x5650('0x5c')](_0x18e4c3[_0x5650('0x67')],{'read':![],'body':_0x18e4c3[_0x5650('0x67')][_0x5650('0x67')],'OpenchannelAccountId':_0x1c87a9['id'],'OpenchannelInteractionId':_0x47ddf7['id'],'UserId':_0x18e4c3[_0x5650('0x68')]['id'],'ContactId':_0x27ffd7['id']}))[_0x5650('0x28')](function(_0x200ef2){_0x47ddf7[_0x5650('0xc9')][_0x5650('0xc8')]=[];_0x47ddf7[_0x5650('0xc9')]['Messages'][_0x5650('0xa3')](_0x200ef2[_0x5650('0xc9')]);return _0x47ddf7;});});}})[_0x5650('0x28')](respondWithResult(_0x4b5c50,null))[_0x5650('0x65')](handleError(_0x4b5c50,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index df1bc83..1d42e4f 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 _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0x668b,0x140));var _0xb668=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0x668b[_0x4ea955];return _0x558561;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x418ac5,_0xca9bf4){var _0x583c66=function(_0x280999){while(--_0x280999){_0x418ac5['push'](_0x418ac5['shift']());}};_0x583c66(++_0xca9bf4);}(_0x4522,0x1a0));var _0x2452=function(_0xb68066,_0x389da8){_0xb68066=_0xb68066-0x0;var _0x477ff4=_0x4522[_0xb68066];return _0x477ff4;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e1cd296..5c5c0f6 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(_0x1a3491,_0x49ac1f){var _0x5fdd43=function(_0x54634f){while(--_0x54634f){_0x1a3491['push'](_0x1a3491['shift']());}};_0x5fdd43(++_0x49ac1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x137dac,_0xd03b98){var _0x138673=function(_0x4c2cd7){while(--_0x4c2cd7){_0x137dac['push'](_0x137dac['shift']());}};_0x138673(++_0xd03b98);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 4642711..291aedb 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 _0x3c81=['bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1e3029,_0x36fcee){var _0x298540=function(_0x57741d){while(--_0x57741d){_0x1e3029['push'](_0x1e3029['shift']());}};_0x298540(++_0x36fcee);}(_0x3c81,0x102));var _0x13c8=function(_0x488e14,_0x1e0888){_0x488e14=_0x488e14-0x0;var _0x51123e=_0x3c81[_0x488e14];return _0x51123e;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});config[_0x13c8('0x9')]=_[_0x13c8('0xa')](config['redis'],{'host':_0x13c8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13c8('0x9')]));require(_0x13c8('0xc'))[_0x13c8('0xd')](socket);function respondWithRpcPromise(_0x30b4d6,_0xaa58b6,_0x13c717){return new BPromise(function(_0x29074d,_0x2ce95a){return client[_0x13c8('0xe')](_0x30b4d6,_0x13c717)[_0x13c8('0xf')](function(_0x3ca0a6){logger[_0x13c8('0x10')](_0x13c8('0x11'),_0xaa58b6,_0x13c8('0x12'));logger['debug'](_0x13c8('0x13'),_0xaa58b6,_0x13c8('0x12'),JSON[_0x13c8('0x14')](_0x3ca0a6));if(_0x3ca0a6[_0x13c8('0x15')]){if(_0x3ca0a6['error'][_0x13c8('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xaa58b6,_0x3ca0a6['error'][_0x13c8('0x17')]);return _0x2ce95a(_0x3ca0a6['error'][_0x13c8('0x17')]);}logger[_0x13c8('0x15')](_0x13c8('0x11'),_0xaa58b6,_0x3ca0a6[_0x13c8('0x15')]['message']);return _0x29074d(_0x3ca0a6[_0x13c8('0x15')][_0x13c8('0x17')]);}else{logger[_0x13c8('0x10')](_0x13c8('0x11'),_0xaa58b6,_0x13c8('0x12'));_0x29074d(_0x3ca0a6[_0x13c8('0x18')][_0x13c8('0x17')]);}})[_0x13c8('0x19')](function(_0x34fbc0){logger[_0x13c8('0x15')](_0x13c8('0x11'),_0xaa58b6,_0x34fbc0);_0x2ce95a(_0x34fbc0);});});} \ No newline at end of file +var _0x0c5d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x310712,_0x4915dc){var _0x1d1415=function(_0x191d1a){while(--_0x191d1a){_0x310712['push'](_0x310712['shift']());}};_0x1d1415(++_0x4915dc);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x5af92e,_0x28158f){_0x5af92e=_0x5af92e-0x0;var _0x497daf=_0x0c5d[_0x5af92e];return _0x497daf;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var moment=require('moment');var BPromise=require(_0xd0c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0c5('0x3'));var db=require(_0xd0c5('0x4'))['db'];var utils=require(_0xd0c5('0x5'));var logger=require(_0xd0c5('0x6'))(_0xd0c5('0x7'));var config=require(_0xd0c5('0x8'));var jayson=require(_0xd0c5('0x9'));var client=jayson[_0xd0c5('0xa')]['http']({'port':0x232a});config[_0xd0c5('0xb')]=_['defaults'](config['redis'],{'host':_0xd0c5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd0c5('0xd'))[_0xd0c5('0xe')](socket);function respondWithRpcPromise(_0x50ed33,_0x33a77b,_0x3d53ab){return new BPromise(function(_0x5ae844,_0x458d02){return client[_0xd0c5('0xf')](_0x50ed33,_0x3d53ab)[_0xd0c5('0x10')](function(_0x30ea26){logger[_0xd0c5('0x11')](_0xd0c5('0x12'),_0x33a77b,_0xd0c5('0x13'));logger[_0xd0c5('0x14')](_0xd0c5('0x15'),_0x33a77b,_0xd0c5('0x13'),JSON[_0xd0c5('0x16')](_0x30ea26));if(_0x30ea26[_0xd0c5('0x17')]){if(_0x30ea26['error'][_0xd0c5('0x18')]===0x1f4){logger[_0xd0c5('0x17')](_0xd0c5('0x12'),_0x33a77b,_0x30ea26[_0xd0c5('0x17')]['message']);return _0x458d02(_0x30ea26[_0xd0c5('0x17')][_0xd0c5('0x19')]);}logger[_0xd0c5('0x17')](_0xd0c5('0x12'),_0x33a77b,_0x30ea26['error'][_0xd0c5('0x19')]);return _0x5ae844(_0x30ea26['error'][_0xd0c5('0x19')]);}else{logger['info'](_0xd0c5('0x12'),_0x33a77b,_0xd0c5('0x13'));_0x5ae844(_0x30ea26[_0xd0c5('0x1a')][_0xd0c5('0x19')]);}})[_0xd0c5('0x1b')](function(_0x410445){logger[_0xd0c5('0x17')](_0xd0c5('0x12'),_0x33a77b,_0x410445);_0x458d02(_0x410445);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 69e59f6..6d9314d 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 _0xa37e=['openchannelAccount:','remove','update','emit','removeListener','register'];(function(_0x3aeec6,_0x10487f){var _0x53afd6=function(_0x10c749){while(--_0x10c749){_0x3aeec6['push'](_0x3aeec6['shift']());}};_0x53afd6(++_0x10487f);}(_0xa37e,0x97));var _0xea37=function(_0x40bc60,_0x14fb86){_0x40bc60=_0x40bc60-0x0;var _0x55bfc4=_0xa37e[_0x40bc60];return _0x55bfc4;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xea37('0x0'),_0xea37('0x1')];function createListener(_0x204a22,_0x475c71){return function(_0x5430aa){_0x475c71[_0xea37('0x2')](_0x204a22,_0x5430aa);};}function removeListener(_0x537c5a,_0x360ed5){return function(){OpenchannelAccountEvents[_0xea37('0x3')](_0x537c5a,_0x360ed5);};}exports[_0xea37('0x4')]=function(_0x4d380b){for(var _0x57135b=0x0,_0x36c489=events['length'];_0x57135b<_0x36c489;_0x57135b++){var _0x4ae081=events[_0x57135b];var _0x2c2890=createListener(_0xea37('0x5')+_0x4ae081,_0x4d380b);OpenchannelAccountEvents['on'](_0x4ae081,_0x2c2890);}}; \ No newline at end of file +var _0xdb76=['remove','update','emit','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x5dea8,_0x6b36ec){var _0x5f441f=function(_0x1143ff){while(--_0x1143ff){_0x5dea8['push'](_0x5dea8['shift']());}};_0x5f441f(++_0x6b36ec);}(_0xdb76,0x1be));var _0x6db7=function(_0x4ebd1c,_0x24984b){_0x4ebd1c=_0x4ebd1c-0x0;var _0x59d638=_0xdb76[_0x4ebd1c];return _0x59d638;};'use strict';var OpenchannelAccountEvents=require(_0x6db7('0x0'));var events=[_0x6db7('0x1'),_0x6db7('0x2'),_0x6db7('0x3')];function createListener(_0x27d5fd,_0x4fee62){return function(_0x448591){_0x4fee62[_0x6db7('0x4')](_0x27d5fd,_0x448591);};}function removeListener(_0x3e17d8,_0x40f6ce){return function(){OpenchannelAccountEvents['removeListener'](_0x3e17d8,_0x40f6ce);};}exports[_0x6db7('0x5')]=function(_0x7bba2d){for(var _0x8a8fe2=0x0,_0x417e71=events[_0x6db7('0x6')];_0x8a8fe2<_0x417e71;_0x8a8fe2++){var _0x58f6e4=events[_0x8a8fe2];var _0x1c7f92=createListener(_0x6db7('0x7')+_0x58f6e4,_0x7bba2d);OpenchannelAccountEvents['on'](_0x58f6e4,_0x1c7f92);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f6c1ba2..a133d57 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 _0xf376=['index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0xf376,0x1af));var _0x6f37=function(_0x2b18cb,_0x59de5b){_0x2b18cb=_0x2b18cb-0x0;var _0x550900=_0xf376[_0x2b18cb];return _0x550900;};'use strict';var multer=require(_0x6f37('0x0'));var util=require('util');var path=require(_0x6f37('0x1'));var timeout=require(_0x6f37('0x2'));var express=require(_0x6f37('0x3'));var router=express[_0x6f37('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6f37('0x5'));var interaction=require(_0x6f37('0x6'));var config=require(_0x6f37('0x7'));var controller=require('./openchannelApplication.controller');router[_0x6f37('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f37('0x9')]);router['get'](_0x6f37('0xa'),auth[_0x6f37('0xb')](),controller[_0x6f37('0xc')]);router[_0x6f37('0xd')]('/',auth[_0x6f37('0xb')](),controller[_0x6f37('0xe')]);router[_0x6f37('0xf')]('/:id',auth[_0x6f37('0xb')](),controller[_0x6f37('0x10')]);router[_0x6f37('0x11')](_0x6f37('0xa'),auth['isAuthenticated'](),controller[_0x6f37('0x12')]);module[_0x6f37('0x13')]=router; \ No newline at end of file +var _0xa5c2=['isAuthenticated','index','post','create','put','/:id','update','destroy','exports','util','path','express','Router','../../config/environment','./openchannelApplication.controller','get'];(function(_0x52dc67,_0x522727){var _0xf7e651=function(_0xe20b7d){while(--_0xe20b7d){_0x52dc67['push'](_0x52dc67['shift']());}};_0xf7e651(++_0x522727);}(_0xa5c2,0x79));var _0x2a5c=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0xa5c2[_0x2431d6];return _0x4d0f9b;};'use strict';var multer=require('multer');var util=require(_0x2a5c('0x0'));var path=require(_0x2a5c('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a5c('0x2'));var router=express[_0x2a5c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a5c('0x4'));var controller=require(_0x2a5c('0x5'));router[_0x2a5c('0x6')]('/',auth[_0x2a5c('0x7')](),controller[_0x2a5c('0x8')]);router[_0x2a5c('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2a5c('0x9')]('/',auth[_0x2a5c('0x7')](),controller[_0x2a5c('0xa')]);router[_0x2a5c('0xb')](_0x2a5c('0xc'),auth[_0x2a5c('0x7')](),controller[_0x2a5c('0xd')]);router['delete'](_0x2a5c('0xc'),auth[_0x2a5c('0x7')](),controller[_0x2a5c('0xe')]);module[_0x2a5c('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index efe5e78..ad36728 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 _0x2128=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x234ffb,_0x1ee20d){var _0xaf543b=function(_0xc01e20){while(--_0xc01e20){_0x234ffb['push'](_0x234ffb['shift']());}};_0xaf543b(++_0x1ee20d);}(_0x2128,0xa1));var _0x8212=function(_0x154264,_0x3e02bb){_0x154264=_0x154264-0x0;var _0x8ea914=_0x2128[_0x154264];return _0x8ea914;};'use strict';var Sequelize=require(_0x8212('0x0'));module[_0x8212('0x1')]={'priority':{'type':Sequelize[_0x8212('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8212('0x3')],'allowNull':![],'defaultValue':_0x8212('0x4')},'appdata':{'type':Sequelize[_0x8212('0x5')]()},'description':{'type':Sequelize[_0x8212('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8212('0x6')}}; \ No newline at end of file +var _0xe669=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1c6b87,_0x1af288){var _0x51ed8c=function(_0x4e37d6){while(--_0x4e37d6){_0x1c6b87['push'](_0x1c6b87['shift']());}};_0x51ed8c(++_0x1af288);}(_0xe669,0xda));var _0x9e66=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0xe669[_0x558e45];return _0x3e9075;};'use strict';var Sequelize=require(_0x9e66('0x0'));module[_0x9e66('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9e66('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9e66('0x3')]()},'description':{'type':Sequelize[_0x9e66('0x2')]},'interval':{'type':Sequelize[_0x9e66('0x2')],'defaultValue':_0x9e66('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f2d8455..54b6836 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 _0xa217=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length'];(function(_0x53c9c8,_0x5f4bb8){var _0x4c10e9=function(_0x8ddfcc){while(--_0x8ddfcc){_0x53c9c8['push'](_0x53c9c8['shift']());}};_0x4c10e9(++_0x5f4bb8);}(_0xa217,0x199));var _0x7a21=function(_0x243fd3,_0x25e8d3){_0x243fd3=_0x243fd3-0x0;var _0x1575b7=_0xa217[_0x243fd3];return _0x1575b7;};'use strict';var emlformat=require(_0x7a21('0x0'));var rimraf=require(_0x7a21('0x1'));var zipdir=require(_0x7a21('0x2'));var jsonpatch=require(_0x7a21('0x3'));var rp=require(_0x7a21('0x4'));var moment=require(_0x7a21('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7a21('0x6'));var path=require(_0x7a21('0x7'));var sox=require(_0x7a21('0x8'));var csv=require(_0x7a21('0x9'));var ejs=require(_0x7a21('0xa'));var fs=require('fs');var fs_extra=require(_0x7a21('0xb'));var _=require(_0x7a21('0xc'));var squel=require(_0x7a21('0xd'));var crypto=require(_0x7a21('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7a21('0xf'));var Papa=require(_0x7a21('0x10'));var Redis=require(_0x7a21('0x11'));var authService=require(_0x7a21('0x12'));var qs=require(_0x7a21('0x13'));var as=require(_0x7a21('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a21('0x15'))('api');var utils=require(_0x7a21('0x16'));var config=require(_0x7a21('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fc18b,_0x48880b){_0x48880b=_0x48880b||0xcc;return function(_0x19eeae){if(_0x19eeae){return _0x2fc18b[_0x7a21('0x18')](_0x48880b);}return _0x2fc18b['status'](_0x48880b)[_0x7a21('0x19')]();};}function respondWithResult(_0x71a9cb,_0x391020){_0x391020=_0x391020||0xc8;return function(_0x9708df){if(_0x9708df){return _0x71a9cb[_0x7a21('0x1a')](_0x391020)[_0x7a21('0x1b')](_0x9708df);}};}function respondWithFilteredResult(_0xcde3bd,_0x26889b){return function(_0x3e3e31){if(_0x3e3e31){var _0x1dddf5=typeof _0x26889b[_0x7a21('0x1c')]===_0x7a21('0x1d')&&typeof _0x26889b[_0x7a21('0x1e')]===_0x7a21('0x1d');var _0x153e5b=_0x3e3e31[_0x7a21('0x1f')];var _0x40061f=_0x1dddf5?0x0:_0x26889b[_0x7a21('0x1c')];var _0x531b05=_0x1dddf5?_0x3e3e31['count']:_0x26889b[_0x7a21('0x1c')]+_0x26889b[_0x7a21('0x1e')];var _0x25a0a8;if(_0x531b05>=_0x153e5b){_0x531b05=_0x153e5b;_0x25a0a8=0xc8;}else{_0x25a0a8=0xce;}_0xcde3bd[_0x7a21('0x1a')](_0x25a0a8);return _0xcde3bd[_0x7a21('0x20')](_0x7a21('0x21'),_0x40061f+'-'+_0x531b05+'/'+_0x153e5b)[_0x7a21('0x1b')](_0x3e3e31);}return null;};}function patchUpdates(_0x911d79){return function(_0x10e72d){try{jsonpatch[_0x7a21('0x22')](_0x10e72d,_0x911d79,!![]);}catch(_0x437f5e){return BPromise[_0x7a21('0x23')](_0x437f5e);}return _0x10e72d[_0x7a21('0x24')]();};}function saveUpdates(_0x2c27e4,_0x1dc74a){return function(_0x476f01){if(_0x476f01){return _0x476f01[_0x7a21('0x25')](_0x2c27e4)[_0x7a21('0x26')](function(_0x523b60){return _0x523b60;});}return null;};}function removeEntity(_0x623930,_0x53cf8c){return function(_0xd6e8dc){if(_0xd6e8dc){return _0xd6e8dc[_0x7a21('0x27')]()[_0x7a21('0x26')](function(){_0x623930[_0x7a21('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36854b,_0x4bff1d){return function(_0x4b4a9c){if(!_0x4b4a9c){_0x36854b[_0x7a21('0x18')](0x194);}return _0x4b4a9c;};}function handleError(_0x5bcec7,_0x38b1a4){_0x38b1a4=_0x38b1a4||0x1f4;return function(_0x132b87){logger[_0x7a21('0x28')](_0x132b87[_0x7a21('0x29')]);if(_0x132b87['name']){delete _0x132b87[_0x7a21('0x2a')];}_0x5bcec7[_0x7a21('0x1a')](_0x38b1a4)[_0x7a21('0x2b')](_0x132b87);};}exports[_0x7a21('0x2c')]=function(_0x93ebb5,_0xe223d3){var _0x2960a9={},_0x293e61={},_0x1851dd={'count':0x0,'rows':[]};var _0x1e3b6f=_[_0x7a21('0x2d')](db[_0x7a21('0x2e')][_0x7a21('0x2f')],function(_0x1674a7){return{'name':_0x1674a7[_0x7a21('0x30')],'type':_0x1674a7[_0x7a21('0x31')][_0x7a21('0x32')]};});_0x293e61[_0x7a21('0x33')]=_['map'](_0x1e3b6f,_0x7a21('0x2a'));_0x293e61['query']=_[_0x7a21('0x34')](_0x93ebb5['query']);_0x293e61[_0x7a21('0x35')]=_[_0x7a21('0x36')](_0x293e61[_0x7a21('0x33')],_0x293e61['query']);_0x2960a9[_0x7a21('0x37')]=_[_0x7a21('0x36')](_0x293e61[_0x7a21('0x33')],qs[_0x7a21('0x38')](_0x93ebb5[_0x7a21('0x39')][_0x7a21('0x38')]));_0x2960a9[_0x7a21('0x37')]=_0x2960a9[_0x7a21('0x37')][_0x7a21('0x3a')]?_0x2960a9[_0x7a21('0x37')]:_0x293e61['model'];if(!_0x93ebb5[_0x7a21('0x39')][_0x7a21('0x3b')](_0x7a21('0x3c'))){_0x2960a9['limit']=qs[_0x7a21('0x1e')](_0x93ebb5[_0x7a21('0x39')]['limit']);_0x2960a9[_0x7a21('0x1c')]=qs['offset'](_0x93ebb5[_0x7a21('0x39')]['offset']);}_0x2960a9[_0x7a21('0x3d')]=qs[_0x7a21('0x3e')](_0x93ebb5[_0x7a21('0x39')][_0x7a21('0x3e')]);_0x2960a9[_0x7a21('0x3f')]=qs[_0x7a21('0x35')](_[_0x7a21('0x40')](_0x93ebb5[_0x7a21('0x39')],_0x293e61[_0x7a21('0x35')]),_0x1e3b6f);if(_0x93ebb5[_0x7a21('0x39')][_0x7a21('0x41')]){_0x2960a9[_0x7a21('0x3f')]=_[_0x7a21('0x42')](_0x2960a9[_0x7a21('0x3f')],{'$or':_[_0x7a21('0x2d')](_0x1e3b6f,function(_0x458c54){if(_0x458c54[_0x7a21('0x31')]!=='VIRTUAL'){var _0x12d8c0={};_0x12d8c0[_0x458c54[_0x7a21('0x2a')]]={'$like':'%'+_0x93ebb5[_0x7a21('0x39')][_0x7a21('0x41')]+'%'};return _0x12d8c0;}})});}_0x2960a9=_[_0x7a21('0x42')]({},_0x2960a9,_0x93ebb5[_0x7a21('0x43')]);var _0x290f86={'where':_0x2960a9[_0x7a21('0x3f')]};return db['OpenchannelApplication'][_0x7a21('0x1f')](_0x290f86)[_0x7a21('0x26')](function(_0x112bbb){_0x1851dd[_0x7a21('0x1f')]=_0x112bbb;if(_0x93ebb5[_0x7a21('0x39')]['includeAll']){_0x2960a9[_0x7a21('0x44')]=[{'all':!![]}];}return db[_0x7a21('0x2e')][_0x7a21('0x45')](_0x2960a9);})[_0x7a21('0x26')](function(_0x32b33c){_0x1851dd[_0x7a21('0x46')]=_0x32b33c;return _0x1851dd;})['then'](respondWithFilteredResult(_0xe223d3,_0x2960a9))[_0x7a21('0x47')](handleError(_0xe223d3,null));};exports[_0x7a21('0x48')]=function(_0x4122d6,_0x5e05ec){var _0x53b657={'raw':!![],'where':{'id':_0x4122d6['params']['id']}},_0x4f8ad5={};_0x4f8ad5[_0x7a21('0x33')]=_['keys'](db['OpenchannelApplication'][_0x7a21('0x2f')]);_0x4f8ad5[_0x7a21('0x39')]=_['keys'](_0x4122d6[_0x7a21('0x39')]);_0x4f8ad5[_0x7a21('0x35')]=_[_0x7a21('0x36')](_0x4f8ad5['model'],_0x4f8ad5[_0x7a21('0x39')]);_0x53b657['attributes']=_['intersection'](_0x4f8ad5[_0x7a21('0x33')],qs[_0x7a21('0x38')](_0x4122d6[_0x7a21('0x39')][_0x7a21('0x38')]));_0x53b657[_0x7a21('0x37')]=_0x53b657['attributes']['length']?_0x53b657[_0x7a21('0x37')]:_0x4f8ad5['model'];if(_0x4122d6[_0x7a21('0x39')][_0x7a21('0x49')]){_0x53b657[_0x7a21('0x44')]=[{'all':!![]}];}_0x53b657=_[_0x7a21('0x42')]({},_0x53b657,_0x4122d6['options']);return db[_0x7a21('0x2e')][_0x7a21('0x4a')](_0x53b657)['then'](handleEntityNotFound(_0x5e05ec,null))[_0x7a21('0x26')](respondWithResult(_0x5e05ec,null))[_0x7a21('0x47')](handleError(_0x5e05ec,null));};exports['create']=function(_0xce0fa6,_0x4aa73e){return db['OpenchannelApplication'][_0x7a21('0x4b')](_0xce0fa6[_0x7a21('0x4c')],{})[_0x7a21('0x26')](respondWithResult(_0x4aa73e,0xc9))[_0x7a21('0x47')](handleError(_0x4aa73e,null));};exports[_0x7a21('0x25')]=function(_0x52792c,_0x11f6b3){if(_0x52792c[_0x7a21('0x4c')]['id']){delete _0x52792c['body']['id'];}return db[_0x7a21('0x2e')]['find']({'where':{'id':_0x52792c[_0x7a21('0x4d')]['id']}})['then'](handleEntityNotFound(_0x11f6b3,null))[_0x7a21('0x26')](saveUpdates(_0x52792c[_0x7a21('0x4c')],null))[_0x7a21('0x26')](respondWithResult(_0x11f6b3,null))[_0x7a21('0x47')](handleError(_0x11f6b3,null));};exports[_0x7a21('0x27')]=function(_0x348a6b,_0x2e4441){return db[_0x7a21('0x2e')][_0x7a21('0x4a')]({'where':{'id':_0x348a6b[_0x7a21('0x4d')]['id']}})[_0x7a21('0x26')](handleEntityNotFound(_0x2e4441,null))[_0x7a21('0x26')](removeEntity(_0x2e4441,null))[_0x7a21('0x47')](handleError(_0x2e4441,null));}; \ No newline at end of file +var _0x2bda=['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','../../config/license/hardware','api','../../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','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir'];(function(_0x53916a,_0x302d07){var _0x3371af=function(_0x621915){while(--_0x621915){_0x53916a['push'](_0x53916a['shift']());}};_0x3371af(++_0x302d07);}(_0x2bda,0x1cb));var _0xa2bd=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x2bda[_0x12ddb2];return _0x10b6dd;};'use strict';var emlformat=require(_0xa2bd('0x0'));var rimraf=require(_0xa2bd('0x1'));var zipdir=require(_0xa2bd('0x2'));var jsonpatch=require(_0xa2bd('0x3'));var rp=require(_0xa2bd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa2bd('0x5'));var util=require(_0xa2bd('0x6'));var path=require(_0xa2bd('0x7'));var sox=require(_0xa2bd('0x8'));var csv=require(_0xa2bd('0x9'));var ejs=require(_0xa2bd('0xa'));var fs=require('fs');var fs_extra=require(_0xa2bd('0xb'));var _=require(_0xa2bd('0xc'));var squel=require(_0xa2bd('0xd'));var crypto=require(_0xa2bd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa2bd('0xf'));var toCsv=require(_0xa2bd('0x9'));var querystring=require(_0xa2bd('0x10'));var Papa=require(_0xa2bd('0x11'));var Redis=require(_0xa2bd('0x12'));var authService=require(_0xa2bd('0x13'));var qs=require(_0xa2bd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2bd('0x15'));var logger=require('../../config/logger')(_0xa2bd('0x16'));var utils=require(_0xa2bd('0x17'));var config=require(_0xa2bd('0x18'));var licenseUtil=require(_0xa2bd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9fd6d2,_0x3d7021){_0x3d7021=_0x3d7021||0xcc;return function(_0x11cde2){if(_0x11cde2){return _0x9fd6d2[_0xa2bd('0x1a')](_0x3d7021);}return _0x9fd6d2[_0xa2bd('0x1b')](_0x3d7021)[_0xa2bd('0x1c')]();};}function respondWithResult(_0x2f5af6,_0x2b155e){_0x2b155e=_0x2b155e||0xc8;return function(_0x18e3c1){if(_0x18e3c1){return _0x2f5af6[_0xa2bd('0x1b')](_0x2b155e)[_0xa2bd('0x1d')](_0x18e3c1);}};}function respondWithFilteredResult(_0x3b126f,_0x409a0d){return function(_0x3adae6){if(_0x3adae6){var _0x4633b1=typeof _0x409a0d['offset']===_0xa2bd('0x1e')&&typeof _0x409a0d[_0xa2bd('0x1f')]===_0xa2bd('0x1e');var _0x14ad0c=_0x3adae6[_0xa2bd('0x20')];var _0x4dce82=_0x4633b1?0x0:_0x409a0d[_0xa2bd('0x21')];var _0x3b8fa6=_0x4633b1?_0x3adae6[_0xa2bd('0x20')]:_0x409a0d[_0xa2bd('0x21')]+_0x409a0d[_0xa2bd('0x1f')];var _0x28ccd7;if(_0x3b8fa6>=_0x14ad0c){_0x3b8fa6=_0x14ad0c;_0x28ccd7=0xc8;}else{_0x28ccd7=0xce;}_0x3b126f[_0xa2bd('0x1b')](_0x28ccd7);return _0x3b126f[_0xa2bd('0x22')]('Content-Range',_0x4dce82+'-'+_0x3b8fa6+'/'+_0x14ad0c)[_0xa2bd('0x1d')](_0x3adae6);}return null;};}function patchUpdates(_0x1dfbf2){return function(_0x5ca080){try{jsonpatch[_0xa2bd('0x23')](_0x5ca080,_0x1dfbf2,!![]);}catch(_0x4c24c8){return BPromise[_0xa2bd('0x24')](_0x4c24c8);}return _0x5ca080[_0xa2bd('0x25')]();};}function saveUpdates(_0x30717a,_0x229f6e){return function(_0x4c7c92){if(_0x4c7c92){return _0x4c7c92[_0xa2bd('0x26')](_0x30717a)[_0xa2bd('0x27')](function(_0x1bbb0c){return _0x1bbb0c;});}return null;};}function removeEntity(_0x4ed2b9,_0x534b7b){return function(_0x232b11){if(_0x232b11){return _0x232b11[_0xa2bd('0x28')]()['then'](function(){_0x4ed2b9['status'](0xcc)[_0xa2bd('0x1c')]();});}};}function handleEntityNotFound(_0x4f6c0a,_0x5b1699){return function(_0x5bdf09){if(!_0x5bdf09){_0x4f6c0a['sendStatus'](0x194);}return _0x5bdf09;};}function handleError(_0x2583ea,_0x3a1e65){_0x3a1e65=_0x3a1e65||0x1f4;return function(_0x2aec3d){logger[_0xa2bd('0x29')](_0x2aec3d[_0xa2bd('0x2a')]);if(_0x2aec3d[_0xa2bd('0x2b')]){delete _0x2aec3d['name'];}_0x2583ea[_0xa2bd('0x1b')](_0x3a1e65)['send'](_0x2aec3d);};}exports[_0xa2bd('0x2c')]=function(_0x2243f7,_0x1afe81){var _0x412a42={},_0x12a0a0={},_0x10ad24={'count':0x0,'rows':[]};var _0x453848=_[_0xa2bd('0x2d')](db[_0xa2bd('0x2e')][_0xa2bd('0x2f')],function(_0x5b08c4){return{'name':_0x5b08c4[_0xa2bd('0x30')],'type':_0x5b08c4[_0xa2bd('0x31')][_0xa2bd('0x32')]};});_0x12a0a0[_0xa2bd('0x33')]=_['map'](_0x453848,_0xa2bd('0x2b'));_0x12a0a0[_0xa2bd('0x34')]=_[_0xa2bd('0x35')](_0x2243f7[_0xa2bd('0x34')]);_0x12a0a0['filters']=_[_0xa2bd('0x36')](_0x12a0a0[_0xa2bd('0x33')],_0x12a0a0[_0xa2bd('0x34')]);_0x412a42[_0xa2bd('0x37')]=_[_0xa2bd('0x36')](_0x12a0a0[_0xa2bd('0x33')],qs[_0xa2bd('0x38')](_0x2243f7[_0xa2bd('0x34')][_0xa2bd('0x38')]));_0x412a42[_0xa2bd('0x37')]=_0x412a42[_0xa2bd('0x37')]['length']?_0x412a42['attributes']:_0x12a0a0['model'];if(!_0x2243f7[_0xa2bd('0x34')][_0xa2bd('0x39')]('nolimit')){_0x412a42[_0xa2bd('0x1f')]=qs[_0xa2bd('0x1f')](_0x2243f7[_0xa2bd('0x34')][_0xa2bd('0x1f')]);_0x412a42[_0xa2bd('0x21')]=qs['offset'](_0x2243f7[_0xa2bd('0x34')][_0xa2bd('0x21')]);}_0x412a42[_0xa2bd('0x3a')]=qs[_0xa2bd('0x3b')](_0x2243f7[_0xa2bd('0x34')][_0xa2bd('0x3b')]);_0x412a42[_0xa2bd('0x3c')]=qs[_0xa2bd('0x3d')](_[_0xa2bd('0x3e')](_0x2243f7['query'],_0x12a0a0[_0xa2bd('0x3d')]),_0x453848);if(_0x2243f7['query'][_0xa2bd('0x3f')]){_0x412a42[_0xa2bd('0x3c')]=_[_0xa2bd('0x40')](_0x412a42[_0xa2bd('0x3c')],{'$or':_[_0xa2bd('0x2d')](_0x453848,function(_0x502fab){if(_0x502fab[_0xa2bd('0x31')]!==_0xa2bd('0x41')){var _0x2fcffa={};_0x2fcffa[_0x502fab[_0xa2bd('0x2b')]]={'$like':'%'+_0x2243f7['query']['filter']+'%'};return _0x2fcffa;}})});}_0x412a42=_[_0xa2bd('0x40')]({},_0x412a42,_0x2243f7[_0xa2bd('0x42')]);var _0x50c3be={'where':_0x412a42['where']};return db[_0xa2bd('0x2e')][_0xa2bd('0x20')](_0x50c3be)[_0xa2bd('0x27')](function(_0x45d6b4){_0x10ad24[_0xa2bd('0x20')]=_0x45d6b4;if(_0x2243f7[_0xa2bd('0x34')][_0xa2bd('0x43')]){_0x412a42[_0xa2bd('0x44')]=[{'all':!![]}];}return db[_0xa2bd('0x2e')]['findAll'](_0x412a42);})[_0xa2bd('0x27')](function(_0x5a5a73){_0x10ad24[_0xa2bd('0x45')]=_0x5a5a73;return _0x10ad24;})['then'](respondWithFilteredResult(_0x1afe81,_0x412a42))[_0xa2bd('0x46')](handleError(_0x1afe81,null));};exports[_0xa2bd('0x47')]=function(_0x1d44c6,_0x1f1f2a){var _0x278d7e={'raw':!![],'where':{'id':_0x1d44c6[_0xa2bd('0x48')]['id']}},_0x574133={};_0x574133[_0xa2bd('0x33')]=_[_0xa2bd('0x35')](db[_0xa2bd('0x2e')]['rawAttributes']);_0x574133[_0xa2bd('0x34')]=_[_0xa2bd('0x35')](_0x1d44c6['query']);_0x574133[_0xa2bd('0x3d')]=_[_0xa2bd('0x36')](_0x574133[_0xa2bd('0x33')],_0x574133[_0xa2bd('0x34')]);_0x278d7e['attributes']=_[_0xa2bd('0x36')](_0x574133[_0xa2bd('0x33')],qs['fields'](_0x1d44c6[_0xa2bd('0x34')][_0xa2bd('0x38')]));_0x278d7e[_0xa2bd('0x37')]=_0x278d7e[_0xa2bd('0x37')][_0xa2bd('0x49')]?_0x278d7e[_0xa2bd('0x37')]:_0x574133[_0xa2bd('0x33')];if(_0x1d44c6['query'][_0xa2bd('0x43')]){_0x278d7e[_0xa2bd('0x44')]=[{'all':!![]}];}_0x278d7e=_['merge']({},_0x278d7e,_0x1d44c6[_0xa2bd('0x42')]);return db[_0xa2bd('0x2e')]['find'](_0x278d7e)[_0xa2bd('0x27')](handleEntityNotFound(_0x1f1f2a,null))[_0xa2bd('0x27')](respondWithResult(_0x1f1f2a,null))[_0xa2bd('0x46')](handleError(_0x1f1f2a,null));};exports[_0xa2bd('0x4a')]=function(_0x338618,_0x58923f){return db[_0xa2bd('0x2e')][_0xa2bd('0x4a')](_0x338618[_0xa2bd('0x4b')],{})['then'](respondWithResult(_0x58923f,0xc9))[_0xa2bd('0x46')](handleError(_0x58923f,null));};exports[_0xa2bd('0x26')]=function(_0x5da676,_0x47667a){if(_0x5da676[_0xa2bd('0x4b')]['id']){delete _0x5da676[_0xa2bd('0x4b')]['id'];}return db['OpenchannelApplication'][_0xa2bd('0x4c')]({'where':{'id':_0x5da676[_0xa2bd('0x48')]['id']}})[_0xa2bd('0x27')](handleEntityNotFound(_0x47667a,null))[_0xa2bd('0x27')](saveUpdates(_0x5da676[_0xa2bd('0x4b')],null))[_0xa2bd('0x27')](respondWithResult(_0x47667a,null))[_0xa2bd('0x46')](handleError(_0x47667a,null));};exports[_0xa2bd('0x28')]=function(_0x33fe0b,_0x18a7a8){return db[_0xa2bd('0x2e')][_0xa2bd('0x4c')]({'where':{'id':_0x33fe0b['params']['id']}})[_0xa2bd('0x27')](handleEntityNotFound(_0x18a7a8,null))[_0xa2bd('0x27')](removeEntity(_0x18a7a8,null))[_0xa2bd('0x46')](handleError(_0x18a7a8,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ba312f4..ca55bb1 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 _0x743c=['exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x743c,0xbb));var _0xc743=function(_0x3a6930,_0x1d329e){_0x3a6930=_0x3a6930-0x0;var _0x9ebbe8=_0x743c[_0x3a6930];return _0x9ebbe8;};'use strict';var _=require(_0xc743('0x0'));var util=require(_0xc743('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc743('0x2'));var BPromise=require('bluebird');var rp=require(_0xc743('0x3'));var fs=require('fs');var path=require(_0xc743('0x4'));var rimraf=require(_0xc743('0x5'));var config=require(_0xc743('0x6'));var attributes=require(_0xc743('0x7'));module[_0xc743('0x8')]=function(_0x253162,_0x17d761){return _0x253162[_0xc743('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xc743('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc743('0xb'),'collate':_0xc743('0xc')});}; \ No newline at end of file +var _0x2eb0=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','openchannel_applications'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x2eb0,0x91));var _0x02eb=function(_0x116371,_0x145137){_0x116371=_0x116371-0x0;var _0x5a854b=_0x2eb0[_0x116371];return _0x5a854b;};'use strict';var _=require(_0x02eb('0x0'));var util=require(_0x02eb('0x1'));var logger=require(_0x02eb('0x2'))(_0x02eb('0x3'));var moment=require(_0x02eb('0x4'));var BPromise=require(_0x02eb('0x5'));var rp=require(_0x02eb('0x6'));var fs=require('fs');var path=require(_0x02eb('0x7'));var rimraf=require(_0x02eb('0x8'));var config=require('../../config/environment');var attributes=require(_0x02eb('0x9'));module['exports']=function(_0x7a40d0,_0x818f52){return _0x7a40d0['define']('OpenchannelApplication',attributes,{'tableName':_0x02eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x02eb('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 63f7754..fbea532 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 _0x7e1a=['OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','body','options','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x5a9d01,_0x4a8b82){var _0xfe0c9f=function(_0x29e891){while(--_0x29e891){_0x5a9d01['push'](_0x5a9d01['shift']());}};_0xfe0c9f(++_0x4a8b82);}(_0x7e1a,0x7c));var _0xa7e1=function(_0x2ee99a,_0x4615cd){_0x2ee99a=_0x2ee99a-0x0;var _0x252e86=_0x7e1a[_0x2ee99a];return _0x252e86;};'use strict';var _=require(_0xa7e1('0x0'));var util=require('util');var moment=require(_0xa7e1('0x1'));var BPromise=require(_0xa7e1('0x2'));var rs=require(_0xa7e1('0x3'));var fs=require('fs');var Redis=require(_0xa7e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa7e1('0x5'));var jayson=require(_0xa7e1('0x6'));var client=jayson['client'][_0xa7e1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xfb8f29,_0x12a36b,_0x49bead){return new BPromise(function(_0x213525,_0x243e9e){return client[_0xa7e1('0x8')](_0xfb8f29,_0x49bead)[_0xa7e1('0x9')](function(_0x3cee91){logger[_0xa7e1('0xa')](_0xa7e1('0xb'),_0x12a36b,_0xa7e1('0xc'));logger['debug'](_0xa7e1('0xd'),_0x12a36b,'request\x20sent',JSON[_0xa7e1('0xe')](_0x3cee91));if(_0x3cee91[_0xa7e1('0xf')]){if(_0x3cee91[_0xa7e1('0xf')][_0xa7e1('0x10')]===0x1f4){logger[_0xa7e1('0xf')](_0xa7e1('0xb'),_0x12a36b,_0x3cee91[_0xa7e1('0xf')][_0xa7e1('0x11')]);return _0x243e9e(_0x3cee91['error'][_0xa7e1('0x11')]);}logger[_0xa7e1('0xf')](_0xa7e1('0xb'),_0x12a36b,_0x3cee91[_0xa7e1('0xf')][_0xa7e1('0x11')]);return _0x213525(_0x3cee91[_0xa7e1('0xf')][_0xa7e1('0x11')]);}else{logger[_0xa7e1('0xa')](_0xa7e1('0xb'),_0x12a36b,_0xa7e1('0xc'));_0x213525(_0x3cee91[_0xa7e1('0x12')]['message']);}})['catch'](function(_0x27e178){logger[_0xa7e1('0xf')](_0xa7e1('0xb'),_0x12a36b,_0x27e178);_0x243e9e(_0x27e178);});});}exports[_0xa7e1('0x13')]=function(_0x2ab5b7){var _0x3b8f22=this;return new Promise(function(_0x184563,_0x471e02){return db['OpenchannelApplication']['update'](_0x2ab5b7[_0xa7e1('0x14')],{'raw':_0x2ab5b7[_0xa7e1('0x15')]?_0x2ab5b7[_0xa7e1('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab5b7[_0xa7e1('0x15')]?_0x2ab5b7[_0xa7e1('0x15')][_0xa7e1('0x16')]||null:null,'attributes':_0x2ab5b7[_0xa7e1('0x15')]?_0x2ab5b7[_0xa7e1('0x15')][_0xa7e1('0x17')]||null:null,'limit':_0x2ab5b7['options']?_0x2ab5b7[_0xa7e1('0x15')][_0xa7e1('0x18')]||null:null})['then'](function(_0x1f97f3){logger[_0xa7e1('0xa')](_0xa7e1('0x13'),_0x2ab5b7);logger[_0xa7e1('0x19')](_0xa7e1('0x13'),_0x2ab5b7,JSON[_0xa7e1('0xe')](_0x1f97f3));_0x184563(_0x1f97f3);})[_0xa7e1('0x1a')](function(_0x26e290){logger[_0xa7e1('0xf')]('UpdateOpenchannelApplication',_0x26e290[_0xa7e1('0x11')],_0x2ab5b7);_0x471e02(_0x3b8f22[_0xa7e1('0xf')](0x1f4,_0x26e290[_0xa7e1('0x11')]));});});}; \ No newline at end of file +var _0xd94b=['http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','OpenchannelApplication','body','options','where','attributes','UpdateOpenchannelApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x39929,_0x2a0471){var _0x330cb6=function(_0x17a7f2){while(--_0x17a7f2){_0x39929['push'](_0x39929['shift']());}};_0x330cb6(++_0x2a0471);}(_0xd94b,0xf9));var _0xbd94=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0xd94b[_0x13f980];return _0x27153c;};'use strict';var _=require(_0xbd94('0x0'));var util=require(_0xbd94('0x1'));var moment=require('moment');var BPromise=require(_0xbd94('0x2'));var rs=require(_0xbd94('0x3'));var fs=require('fs');var Redis=require(_0xbd94('0x4'));var db=require(_0xbd94('0x5'))['db'];var utils=require(_0xbd94('0x6'));var logger=require(_0xbd94('0x7'))(_0xbd94('0x8'));var config=require(_0xbd94('0x9'));var jayson=require(_0xbd94('0xa'));var client=jayson[_0xbd94('0xb')][_0xbd94('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f23f9,_0x127d56,_0x4c6f21){return new BPromise(function(_0x1e2c2e,_0x510ca1){return client[_0xbd94('0xd')](_0x3f23f9,_0x4c6f21)[_0xbd94('0xe')](function(_0x358811){logger[_0xbd94('0xf')](_0xbd94('0x10'),_0x127d56,_0xbd94('0x11'));logger[_0xbd94('0x12')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x127d56,_0xbd94('0x11'),JSON[_0xbd94('0x13')](_0x358811));if(_0x358811['error']){if(_0x358811['error']['code']===0x1f4){logger[_0xbd94('0x14')](_0xbd94('0x10'),_0x127d56,_0x358811['error'][_0xbd94('0x15')]);return _0x510ca1(_0x358811['error'][_0xbd94('0x15')]);}logger['error'](_0xbd94('0x10'),_0x127d56,_0x358811['error']['message']);return _0x1e2c2e(_0x358811[_0xbd94('0x14')][_0xbd94('0x15')]);}else{logger[_0xbd94('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x127d56,_0xbd94('0x11'));_0x1e2c2e(_0x358811['result'][_0xbd94('0x15')]);}})[_0xbd94('0x16')](function(_0x26ce47){logger[_0xbd94('0x14')](_0xbd94('0x10'),_0x127d56,_0x26ce47);_0x510ca1(_0x26ce47);});});}exports['UpdateOpenchannelApplication']=function(_0x440ea8){var _0x191520=this;return new Promise(function(_0x478cbb,_0x1def18){return db[_0xbd94('0x17')]['update'](_0x440ea8[_0xbd94('0x18')],{'raw':_0x440ea8['options']?_0x440ea8[_0xbd94('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x440ea8[_0xbd94('0x19')]?_0x440ea8['options'][_0xbd94('0x1a')]||null:null,'attributes':_0x440ea8[_0xbd94('0x19')]?_0x440ea8[_0xbd94('0x19')][_0xbd94('0x1b')]||null:null,'limit':_0x440ea8['options']?_0x440ea8['options']['limit']||null:null})[_0xbd94('0xe')](function(_0x593723){logger['info'](_0xbd94('0x1c'),_0x440ea8);logger[_0xbd94('0x12')]('UpdateOpenchannelApplication',_0x440ea8,JSON[_0xbd94('0x13')](_0x593723));_0x478cbb(_0x593723);})['catch'](function(_0x34348c){logger[_0xbd94('0x14')](_0xbd94('0x1c'),_0x34348c['message'],_0x440ea8);_0x1def18(_0x191520[_0xbd94('0x14')](0x1f4,_0x34348c[_0xbd94('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4801b28..df4cb49 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 _0xac43=['delete','openchannelinteraction:destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','tracked','openchannelinteraction:update','update'];(function(_0x3dc422,_0x3a1342){var _0xd062b9=function(_0x531537){while(--_0x531537){_0x3dc422['push'](_0x3dc422['shift']());}};_0xd062b9(++_0x3a1342);}(_0xac43,0xcd));var _0x3ac4=function(_0x44088c,_0x300f0f){_0x44088c=_0x44088c-0x0;var _0xc07aaf=_0xac43[_0x44088c];return _0xc07aaf;};'use strict';var multer=require(_0x3ac4('0x0'));var util=require(_0x3ac4('0x1'));var path=require('path');var timeout=require(_0x3ac4('0x2'));var express=require(_0x3ac4('0x3'));var router=express[_0x3ac4('0x4')]();var fs_extra=require(_0x3ac4('0x5'));var auth=require(_0x3ac4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3ac4('0x7'));var controller=require(_0x3ac4('0x8'));router[_0x3ac4('0x9')]('/',auth['isAuthenticated'](),controller[_0x3ac4('0xa')]);router['get'](_0x3ac4('0xb'),auth[_0x3ac4('0xc')](),controller[_0x3ac4('0xd')]);router['get'](_0x3ac4('0xe'),auth[_0x3ac4('0xc')](),controller['show']);router[_0x3ac4('0x9')](_0x3ac4('0xf'),auth[_0x3ac4('0xc')](),controller[_0x3ac4('0x10')]);router[_0x3ac4('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x3ac4('0x11')]('/',auth[_0x3ac4('0xc')](),controller[_0x3ac4('0x12')]);router[_0x3ac4('0x11')](_0x3ac4('0xf'),auth[_0x3ac4('0xc')](),controller[_0x3ac4('0x13')]);router[_0x3ac4('0x11')](_0x3ac4('0x14'),auth[_0x3ac4('0xc')](),interaction['tracked'](_0x3ac4('0x15'),_0x3ac4('0x16')),controller[_0x3ac4('0x17')]);router['put'](_0x3ac4('0xe'),auth[_0x3ac4('0xc')](),interaction[_0x3ac4('0x18')](_0x3ac4('0x15'),_0x3ac4('0x19')),controller[_0x3ac4('0x1a')]);router[_0x3ac4('0x1b')](_0x3ac4('0xe'),auth[_0x3ac4('0xc')](),interaction[_0x3ac4('0x18')](_0x3ac4('0x15'),_0x3ac4('0x1c')),controller['destroy']);router[_0x3ac4('0x1b')](_0x3ac4('0x14'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xe716=['delete','tracked','openchannelinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update'];(function(_0x13d8ec,_0x4a8ebe){var _0x9ede1c=function(_0x5c4e8b){while(--_0x5c4e8b){_0x13d8ec['push'](_0x13d8ec['shift']());}};_0x9ede1c(++_0x4a8ebe);}(_0xe716,0xec));var _0x6e71=function(_0x103fbe,_0xab297c){_0x103fbe=_0x103fbe-0x0;var _0x3930ac=_0xe716[_0x103fbe];return _0x3930ac;};'use strict';var multer=require(_0x6e71('0x0'));var util=require(_0x6e71('0x1'));var path=require('path');var timeout=require(_0x6e71('0x2'));var express=require(_0x6e71('0x3'));var router=express[_0x6e71('0x4')]();var fs_extra=require(_0x6e71('0x5'));var auth=require(_0x6e71('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6e71('0x7'));router[_0x6e71('0x8')]('/',auth[_0x6e71('0x9')](),controller[_0x6e71('0xa')]);router[_0x6e71('0x8')](_0x6e71('0xb'),auth['isAuthenticated'](),controller[_0x6e71('0xc')]);router[_0x6e71('0x8')](_0x6e71('0xd'),auth[_0x6e71('0x9')](),controller[_0x6e71('0xe')]);router[_0x6e71('0x8')](_0x6e71('0xf'),auth[_0x6e71('0x9')](),controller[_0x6e71('0x10')]);router[_0x6e71('0x8')](_0x6e71('0x11'),auth[_0x6e71('0x9')](),controller[_0x6e71('0x12')]);router[_0x6e71('0x13')]('/',auth[_0x6e71('0x9')](),controller['create']);router[_0x6e71('0x13')](_0x6e71('0xf'),auth[_0x6e71('0x9')](),controller[_0x6e71('0x14')]);router['post'](_0x6e71('0x15'),auth[_0x6e71('0x9')](),interaction['tracked'](_0x6e71('0x16'),_0x6e71('0x17')),controller[_0x6e71('0x18')]);router[_0x6e71('0x19')](_0x6e71('0xd'),auth[_0x6e71('0x9')](),interaction['tracked']('openchannel',_0x6e71('0x1a')),controller[_0x6e71('0x1b')]);router[_0x6e71('0x1c')]('/:id',auth[_0x6e71('0x9')](),interaction[_0x6e71('0x1d')](_0x6e71('0x16'),_0x6e71('0x1e')),controller['destroy']);router[_0x6e71('0x1c')]('/:id/tags',auth[_0x6e71('0x9')](),controller[_0x6e71('0x1f')]);module[_0x6e71('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index da06c58..bddc500 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 _0xb43b=['ENUM','sequelize','BOOLEAN','DATE','STRING'];(function(_0x147e5c,_0x532025){var _0x1c42d4=function(_0x1f474c){while(--_0x1f474c){_0x147e5c['push'](_0x147e5c['shift']());}};_0x1c42d4(++_0x532025);}(_0xb43b,0xbf));var _0xbb43=function(_0x4dbea3,_0x332617){_0x4dbea3=_0x4dbea3-0x0;var _0x2e79ea=_0xb43b[_0x4dbea3];return _0x2e79ea;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'closed':{'type':Sequelize[_0xbb43('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb43('0x2')]},'disposition':{'type':Sequelize[_0xbb43('0x3')]},'secondDisposition':{'type':Sequelize[_0xbb43('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbb43('0x3')]},'note':{'type':Sequelize[_0xbb43('0x3')]},'read1stAt':{'type':Sequelize[_0xbb43('0x2')]},'threadId':{'type':Sequelize[_0xbb43('0x3')]},'externalUrl':{'type':Sequelize[_0xbb43('0x3')]},'lastMsgAt':{'type':Sequelize[_0xbb43('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xbb43('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xbb43('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xbb43('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ad3=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x3977dc,_0x18499a){var _0x40e46e=function(_0x3ea4bc){while(--_0x3ea4bc){_0x3977dc['push'](_0x3977dc['shift']());}};_0x40e46e(++_0x18499a);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0x5ad3[_0x99facc];return _0xd39ed0;};'use strict';var Sequelize=require(_0x35ad('0x0'));module[_0x35ad('0x1')]={'closed':{'type':Sequelize[_0x35ad('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x35ad('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x35ad('0x4')]},'thirdDisposition':{'type':Sequelize[_0x35ad('0x4')]},'note':{'type':Sequelize[_0x35ad('0x4')]},'read1stAt':{'type':Sequelize[_0x35ad('0x3')]},'threadId':{'type':Sequelize[_0x35ad('0x4')]},'externalUrl':{'type':Sequelize[_0x35ad('0x4')]},'lastMsgAt':{'type':Sequelize[_0x35ad('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x35ad('0x5')]('in',_0x35ad('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x35ad('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x35ad('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x35ad('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f786c63..454e02d 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 _0xbfad=['catch','create','body','addMessage','OpenchannelMessage','ids','omit','fields','hasOwnProperty','limit','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','files','tmp','join','server','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','lastName','Attachment','Messages','direction','secret','read','Account','Owner','get','mkdirSync','Openchannel','createdAt','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','fullname','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','zip-dir','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','getOptions','findAll','query','type','from','params','keys','filters','model','attributes','intersection','length','includeAll','include','merge','options','find'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xbfad,0x1b9));var _0xdbfa=function(_0x4f0b6d,_0x1a7bb8){_0x4f0b6d=_0x4f0b6d-0x0;var _0x4abe88=_0xbfad[_0x4f0b6d];return _0x4abe88;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdbfa('0x0'));var moment=require('moment');var util=require('util');var path=require(_0xdbfa('0x1'));var ejs=require(_0xdbfa('0x2'));var fs=require('fs');var _=require(_0xdbfa('0x3'));var Redis=require(_0xdbfa('0x4'));var interaction=require(_0xdbfa('0x5'));var qs=require(_0xdbfa('0x6'));var pdf=require(_0xdbfa('0x7'));var logger=require('../../config/logger')(_0xdbfa('0x8'));var config=require('../../config/environment');var db=require(_0xdbfa('0x9'))['db'];config[_0xdbfa('0xa')]=_['defaults'](config[_0xdbfa('0xa')],{'host':_0xdbfa('0xb'),'port':0x18eb});var socket=require(_0xdbfa('0xc'))(new Redis(config[_0xdbfa('0xa')]));require(_0xdbfa('0xd'))[_0xdbfa('0xe')](socket);function respondWithStatusCode(_0xdbabeb,_0x29e741){_0x29e741=_0x29e741||0xcc;return function(_0x59d4d5){if(_0x59d4d5){return _0xdbabeb[_0xdbfa('0xf')](_0x29e741);}return _0xdbabeb[_0xdbfa('0x10')](_0x29e741)[_0xdbfa('0x11')]();};}function respondWithResult(_0x16cf7b,_0x328540){_0x328540=_0x328540||0xc8;return function(_0x2cdeac){if(_0x2cdeac){return _0x16cf7b[_0xdbfa('0x10')](_0x328540)[_0xdbfa('0x12')](_0x2cdeac);}};}function respondWithFilteredResult(_0x4b996a,_0xacf073){return function(_0x47c8a6){if(_0x47c8a6){var _0x116de9=typeof _0xacf073[_0xdbfa('0x13')]===_0xdbfa('0x14')&&typeof _0xacf073['limit']===_0xdbfa('0x14');var _0x53a46c=_0x47c8a6[_0xdbfa('0x15')];var _0x275d82=_0x116de9?0x0:_0xacf073[_0xdbfa('0x13')];var _0x1c95a3=_0x116de9?_0x47c8a6['count']:_0xacf073[_0xdbfa('0x13')]+_0xacf073['limit'];var _0x396f0b;if(_0x1c95a3>=_0x53a46c){_0x1c95a3=_0x53a46c;_0x396f0b=0xc8;}else{_0x396f0b=0xce;}_0x4b996a['status'](_0x396f0b);return _0x4b996a[_0xdbfa('0x16')]('Content-Range',_0x275d82+'-'+_0x1c95a3+'/'+_0x53a46c)[_0xdbfa('0x12')](_0x47c8a6);}return null;};}function saveUpdates(_0x538e56){return function(_0x2b0806){if(_0x2b0806){return _0x2b0806[_0xdbfa('0x17')](_0x538e56)[_0xdbfa('0x18')](function(_0x30cdd8){return _0x30cdd8;});}return null;};}function removeEntity(_0x4d4814){return function(_0x3a2627){if(_0x3a2627){return _0x3a2627[_0xdbfa('0x19')]()[_0xdbfa('0x18')](function(){_0x4d4814[_0xdbfa('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4270d6){return function(_0x135346){if(!_0x135346){_0x4270d6[_0xdbfa('0xf')](0x194);}return _0x135346;};}function handleError(_0x1c5f2f,_0x48094e){_0x48094e=_0x48094e||0x1f4;return function(_0x2496e2){logger[_0xdbfa('0x1a')](_0x2496e2[_0xdbfa('0x1b')]);if(_0x2496e2[_0xdbfa('0x1c')]){delete _0x2496e2[_0xdbfa('0x1c')];}_0x1c5f2f[_0xdbfa('0x10')](_0x48094e)[_0xdbfa('0x1d')](_0x2496e2);};}exports[_0xdbfa('0x1e')]=function(_0x516b1f,_0x46108a){var _0x4110c1={};var _0x48eb30=_[_0xdbfa('0x1f')](db[_0xdbfa('0x20')][_0xdbfa('0x21')],function(_0x4f722a){return{'name':_0x4f722a['fieldName'],'type':_0x4f722a['type']['key']};});_0x4110c1=qs[_0xdbfa('0x22')](_0x48eb30,_0x516b1f);return interaction[_0xdbfa('0x23')]('openchannel',_0x516b1f[_0xdbfa('0x24')],_0x516b1f['user'],_0x4110c1,_0x48eb30)[_0xdbfa('0x18')](respondWithFilteredResult(_0x46108a,_0x4110c1))['catch'](handleError(_0x46108a,null));};exports['show']=function(_0x44fca9,_0x34110f){var _0x2e02c7={};if(_0x44fca9[_0xdbfa('0x24')]['type']&&_0x44fca9[_0xdbfa('0x24')][_0xdbfa('0x25')]==='from'){_0x2e02c7[_0xdbfa('0x26')]=_0x44fca9[_0xdbfa('0x27')]['id'];}else{_0x2e02c7['id']=_0x44fca9[_0xdbfa('0x27')]['id'];}var _0x14c8ab={'raw':![],'where':_0x2e02c7},_0x10b189={};_0x10b189['model']=_[_0xdbfa('0x28')](db['OpenchannelInteraction']['rawAttributes']);_0x10b189[_0xdbfa('0x24')]=_['keys'](_0x44fca9['query']);_0x10b189[_0xdbfa('0x29')]=_['intersection'](_0x10b189[_0xdbfa('0x2a')],_0x10b189[_0xdbfa('0x24')]);_0x14c8ab[_0xdbfa('0x2b')]=_[_0xdbfa('0x2c')](_0x10b189[_0xdbfa('0x2a')],qs['fields'](_0x44fca9[_0xdbfa('0x24')]['fields']));_0x14c8ab[_0xdbfa('0x2b')]=_0x14c8ab[_0xdbfa('0x2b')][_0xdbfa('0x2d')]?_0x14c8ab[_0xdbfa('0x2b')]:_0x10b189[_0xdbfa('0x2a')];if(_0x44fca9[_0xdbfa('0x24')][_0xdbfa('0x2e')]){_0x14c8ab[_0xdbfa('0x2f')]=[{'all':!![]}];}_0x14c8ab=_[_0xdbfa('0x30')]({},_0x14c8ab,_0x44fca9[_0xdbfa('0x31')]);return db['OpenchannelInteraction'][_0xdbfa('0x32')](_0x14c8ab)[_0xdbfa('0x18')](handleEntityNotFound(_0x34110f,null))[_0xdbfa('0x18')](respondWithResult(_0x34110f,null))[_0xdbfa('0x33')](handleError(_0x34110f,null));};exports[_0xdbfa('0x34')]=function(_0x378274,_0x26f965){return db[_0xdbfa('0x20')]['create'](_0x378274[_0xdbfa('0x35')],{})[_0xdbfa('0x18')](respondWithResult(_0x26f965,0xc9))['catch'](handleError(_0x26f965,null));};exports[_0xdbfa('0x17')]=function(_0x47e079,_0x2b160d){if(_0x47e079[_0xdbfa('0x35')]['id']){delete _0x47e079[_0xdbfa('0x35')]['id'];}return db[_0xdbfa('0x20')]['find']({'where':{'id':_0x47e079[_0xdbfa('0x27')]['id']}})['then'](handleEntityNotFound(_0x2b160d,null))['then'](saveUpdates(_0x47e079[_0xdbfa('0x35')],null))['then'](respondWithResult(_0x2b160d,null))['catch'](handleError(_0x2b160d,null));};exports[_0xdbfa('0x19')]=function(_0x1d9ab4,_0x1beaa){return db[_0xdbfa('0x20')]['find']({'where':{'id':_0x1d9ab4[_0xdbfa('0x27')]['id']}})[_0xdbfa('0x18')](handleEntityNotFound(_0x1beaa,null))[_0xdbfa('0x18')](removeEntity(_0x1beaa,null))[_0xdbfa('0x33')](handleError(_0x1beaa,null));};exports['describe']=function(_0x492823,_0x337a8f){return db[_0xdbfa('0x20')]['describe']()[_0xdbfa('0x18')](respondWithResult(_0x337a8f,null))[_0xdbfa('0x33')](handleError(_0x337a8f,null));};exports[_0xdbfa('0x36')]=function(_0x18456c,_0x2452e9){return db[_0xdbfa('0x37')][_0xdbfa('0x32')]({'where':{'id':_0x18456c[_0xdbfa('0x27')]['id']}})[_0xdbfa('0x18')](handleEntityNotFound(_0x2452e9,null))[_0xdbfa('0x18')](function(_0x100f1c){if(_0x100f1c){return _0x100f1c['addMessage'](_0x18456c[_0xdbfa('0x35')][_0xdbfa('0x38')],_[_0xdbfa('0x39')](_0x18456c[_0xdbfa('0x35')],[_0xdbfa('0x38'),'id'])||{});}})[_0xdbfa('0x18')](respondWithResult(_0x2452e9,null))[_0xdbfa('0x33')](handleError(_0x2452e9,null));};exports['getMessages']=function(_0x21fb78,_0x3785d7){var _0xb4c6e5={'raw':![],'where':{}};var _0x3209b2={};var _0x3f0b68={'count':0x0,'rows':[]};return db[_0xdbfa('0x20')]['findOne']({'where':{'id':_0x21fb78[_0xdbfa('0x27')]['id']}})[_0xdbfa('0x18')](handleEntityNotFound(_0x3785d7,null))[_0xdbfa('0x18')](function(_0x5b3622){if(_0x5b3622){_0x3209b2['model']=_[_0xdbfa('0x28')](db['OpenchannelMessage'][_0xdbfa('0x21')]);_0x3209b2[_0xdbfa('0x24')]=_['keys'](_0x21fb78[_0xdbfa('0x24')]);_0x3209b2[_0xdbfa('0x29')]=_[_0xdbfa('0x2c')](_0x3209b2[_0xdbfa('0x2a')],_0x3209b2[_0xdbfa('0x24')]);_0xb4c6e5['attributes']=_['intersection'](_0x3209b2[_0xdbfa('0x2a')],qs[_0xdbfa('0x3a')](_0x21fb78[_0xdbfa('0x24')]['fields']));_0xb4c6e5[_0xdbfa('0x2b')]=_0xb4c6e5[_0xdbfa('0x2b')]['length']?_0xb4c6e5[_0xdbfa('0x2b')]:_0x3209b2['model'];if(!_0x21fb78['query'][_0xdbfa('0x3b')]('nolimit')){_0xb4c6e5['limit']=qs[_0xdbfa('0x3c')](_0x21fb78[_0xdbfa('0x24')][_0xdbfa('0x3c')]);_0xb4c6e5[_0xdbfa('0x13')]=qs[_0xdbfa('0x13')](_0x21fb78[_0xdbfa('0x24')][_0xdbfa('0x13')]);}_0xb4c6e5['order']=qs['sort'](_0x21fb78[_0xdbfa('0x24')][_0xdbfa('0x3d')]);_0xb4c6e5[_0xdbfa('0x3e')]=qs[_0xdbfa('0x29')](_['pick'](_0x21fb78[_0xdbfa('0x24')],_0x3209b2[_0xdbfa('0x29')]));_0xb4c6e5[_0xdbfa('0x3e')][_0xdbfa('0x3f')]=_0x5b3622['id'];if(_0x21fb78[_0xdbfa('0x24')][_0xdbfa('0x40')]){_0xb4c6e5[_0xdbfa('0x3e')]=_[_0xdbfa('0x30')](_0xb4c6e5['where'],{'$or':_[_0xdbfa('0x1f')](_0xb4c6e5[_0xdbfa('0x2b')],function(_0x1dafd7){var _0xfc7787={};_0xfc7787[_0x1dafd7]={'$like':'%'+_0x21fb78[_0xdbfa('0x24')][_0xdbfa('0x40')]+'%'};return _0xfc7787;})});}if(_0x21fb78['query'][_0xdbfa('0x41')]){var _0x3a1083=_0x21fb78[_0xdbfa('0x24')][_0xdbfa('0x41')][_0xdbfa('0x42')](',');var _0x42c5f0={};_0x42c5f0[_0x3a1083[0x0]]={'$gte':moment(_0x3a1083[0x1])[_0xdbfa('0x43')](_0xdbfa('0x44'))};_0xb4c6e5[_0xdbfa('0x3e')]=_[_0xdbfa('0x30')](_0xb4c6e5[_0xdbfa('0x3e')],_0x42c5f0);}_0xb4c6e5=_[_0xdbfa('0x30')]({},_0xb4c6e5,_0x21fb78[_0xdbfa('0x31')]);return db[_0xdbfa('0x37')]['count']({'where':_0xb4c6e5[_0xdbfa('0x3e')]})[_0xdbfa('0x18')](function(_0x57e19c){_0x3f0b68['count']=_0x57e19c;if(_0x21fb78['query'][_0xdbfa('0x2e')]){_0xb4c6e5[_0xdbfa('0x2f')]=[{'all':!![]}];}return db[_0xdbfa('0x37')]['findAll'](_0xb4c6e5);})[_0xdbfa('0x18')](function(_0x12a0cb){_0x3f0b68[_0xdbfa('0x45')]=_0x12a0cb;return _0x3f0b68;});}})[_0xdbfa('0x18')](respondWithFilteredResult(_0x3785d7,_0xb4c6e5))[_0xdbfa('0x33')](handleError(_0x3785d7,null));};exports[_0xdbfa('0x46')]=function(_0x36af46,_0x2ba11f){return db[_0xdbfa('0x20')]['find']({'where':{'id':_0x36af46[_0xdbfa('0x27')]['id']}})[_0xdbfa('0x18')](handleEntityNotFound(_0x2ba11f,null))[_0xdbfa('0x18')](function(_0x3f1382){if(_0x3f1382){return _0x3f1382[_0xdbfa('0x47')](_0x36af46[_0xdbfa('0x35')][_0xdbfa('0x38')],_['omit'](_0x36af46['body'],['ids','id'])||{})[_0xdbfa('0x48')](function(){return db[_0xdbfa('0x49')][_0xdbfa('0x23')]({'attributes':['id','name',_0xdbfa('0x4a')],'where':{'id':_0x36af46[_0xdbfa('0x35')][_0xdbfa('0x38')]}});})['then'](function(_0x184403){socket[_0xdbfa('0x4b')]('openchannelInteractionTags:save',{'id':Number(_0x36af46[_0xdbfa('0x27')]['id']),'tags':_0x184403||[]});return{'id':Number(_0x36af46['params']['id']),'tags':_0x184403||[]};});}})[_0xdbfa('0x18')](respondWithResult(_0x2ba11f,null))['catch'](handleError(_0x2ba11f,null));};exports['removeTags']=function(_0x381292,_0x5bdc73){return db['OpenchannelInteraction'][_0xdbfa('0x32')]({'where':{'id':_0x381292['params']['id']}})[_0xdbfa('0x18')](handleEntityNotFound(_0x5bdc73,null))['then'](function(_0x87c8ab){if(_0x87c8ab){return _0x87c8ab[_0xdbfa('0x4c')](_0x381292[_0xdbfa('0x24')][_0xdbfa('0x38')]);}})[_0xdbfa('0x18')](respondWithStatusCode(_0x5bdc73,null))[_0xdbfa('0x33')](handleError(_0x5bdc73,null));};exports[_0xdbfa('0x4d')]=function(_0x26fe3d,_0x473d10){var _0x2ca235=moment()[_0xdbfa('0x4e')]()[_0xdbfa('0x4f')]();var _0x2cc248=path['join'](config['root'],'server',_0xdbfa('0x50'),_0xdbfa('0x51'));var _0x30bf0a=path[_0xdbfa('0x52')](config['root'],_0xdbfa('0x53'),'files',_0xdbfa('0x54'));var _0x2307a3=path[_0xdbfa('0x52')](_0x2cc248,_0x2ca235);var _0x3be407=util['format'](_0xdbfa('0x55'),_0x26fe3d[_0xdbfa('0x27')]['id'],_0x2ca235);var _0x34c15e=path[_0xdbfa('0x52')](_0x2cc248,_0x3be407);var _0xc43e2c=[];_0xc43e2c['push']({'model':db[_0xdbfa('0x56')],'as':_0xdbfa('0x56'),'attributes':['id','fullname'],'raw':!![]});_0xc43e2c[_0xdbfa('0x57')]({'model':db[_0xdbfa('0x58')],'as':_0xdbfa('0x59'),'attributes':['id','firstName',_0xdbfa('0x5a')],'raw':!![]});if(_0x26fe3d[_0xdbfa('0x24')][_0xdbfa('0x54')]){_0xc43e2c[_0xdbfa('0x57')]({'model':db[_0xdbfa('0x5b')],'as':'Attachment','raw':!![]});}var _0xec1661=[{'model':db[_0xdbfa('0x37')],'as':_0xdbfa('0x5c'),'attributes':['id',_0xdbfa('0x35'),'createdAt',_0xdbfa('0x5d'),_0xdbfa('0x5e'),_0xdbfa('0x5f')],'include':_0xc43e2c}];_0xec1661[_0xdbfa('0x57')]({'model':db['OpenchannelAccount'],'as':_0xdbfa('0x60'),'attributes':['id','name']});_0xec1661['push']({'model':db[_0xdbfa('0x56')],'as':_0xdbfa('0x61'),'attributes':['id','fullname']});return db[_0xdbfa('0x20')][_0xdbfa('0x32')]({'where':{'id':_0x26fe3d[_0xdbfa('0x27')]['id']},'include':_0xec1661})[_0xdbfa('0x18')](handleEntityNotFound(_0x473d10,null))[_0xdbfa('0x18')](function(_0x143e54){if(_0x143e54){var _0x1aa9d4=_0x143e54[_0xdbfa('0x62')]({'plain':!![]});fs[_0xdbfa('0x63')](_0x2307a3);var _0x12dbd5={'channel':_0xdbfa('0x64'),'account':_0x1aa9d4['Account'][_0xdbfa('0x1c')],'agent':_0x1aa9d4['Owner']?_0x1aa9d4['Owner']['fullname']:'N.A.','createdAt':moment(_0x1aa9d4[_0xdbfa('0x65')])['format'](_0xdbfa('0x44'))['toString'](),'closedAt':_0x1aa9d4[_0xdbfa('0x66')]?moment(_0x1aa9d4[_0xdbfa('0x67')])['format'](_0xdbfa('0x44'))[_0xdbfa('0x4f')]():'','disposition':_0x1aa9d4[_0xdbfa('0x68')],'visibility':_0x1aa9d4[_0xdbfa('0x69')]?_0xdbfa('0x6a'):'Private','messages':_(_0x1aa9d4['Messages'])[_0xdbfa('0x40')]({'secret':![]})[_0xdbfa('0x1f')](function(_0x54e166){if(_0x54e166[_0xdbfa('0x5b')]){var _0x36be91=path[_0xdbfa('0x52')](_0x30bf0a,_0x54e166[_0xdbfa('0x5b')][_0xdbfa('0x6b')]);if(fs[_0xdbfa('0x6c')](_0x36be91)){fs[_0xdbfa('0x6d')](_0x36be91)[_0xdbfa('0x6e')](fs[_0xdbfa('0x6f')](path['join'](_0x2307a3,_0x54e166['Attachment'][_0xdbfa('0x6b')])));}}return{'date':moment(_0x54e166[_0xdbfa('0x65')])[_0xdbfa('0x43')](_0xdbfa('0x44'))[_0xdbfa('0x4f')](),'sender':_0x54e166[_0xdbfa('0x5d')]===_0xdbfa('0x70')?_0x54e166[_0xdbfa('0x56')]?_0x54e166['User'][_0xdbfa('0x71')]:_0xdbfa('0x72'):_0x54e166['Contact'][_0xdbfa('0x73')]+(_0x54e166[_0xdbfa('0x59')][_0xdbfa('0x5a')]?'\x20'+_0x54e166[_0xdbfa('0x59')][_0xdbfa('0x5a')]:''),'body':_0x54e166[_0xdbfa('0x5b')]?_0x54e166[_0xdbfa('0x5b')][_0xdbfa('0x6b')]:_0x54e166[_0xdbfa('0x35')],'direction':_0x54e166['direction']==='out'?'A':'C','secret':_0x54e166[_0xdbfa('0x5e')],'read':_0x54e166['read'],'attachment':_0x54e166[_0xdbfa('0x5b')]};})[_0xdbfa('0x74')]()};return ejs[_0xdbfa('0x75')](path['join'](config['root'],_0xdbfa('0x53'),_0xdbfa('0x76'),_0xdbfa('0x77')),{'interaction':_0x12dbd5})[_0xdbfa('0x18')](function(_0x5a946b){var _0xdce3a9=path[_0xdbfa('0x52')](_0x2307a3,_0xdbfa('0x78')+_0x1aa9d4['id']+'-'+_0x2ca235+_0xdbfa('0x79'));var _0x3ce981={'path':_0xdce3a9,'channel':_0xdbfa('0x64'),'interactionId':_0x1aa9d4['id']};return pdf[_0xdbfa('0x7a')](_0x5a946b,_0x3ce981);})[_0xdbfa('0x18')](function(){return new Promise(function(_0x2ee718,_0x596c7a){zipdir(_0x2307a3,{'saveTo':_0x34c15e},function(_0x67be6d,_0x3ccbff){if(_0x67be6d)return _0x596c7a(_0x67be6d);return _0x2ee718(_0x3ccbff);});})[_0xdbfa('0x18')](function(){return new Promise(function(_0x80e55b,_0x69545c){rimraf(_0x2307a3,function(_0x5344f7){if(_0x5344f7)_0x69545c(_0x5344f7);return _0x80e55b();});});})[_0xdbfa('0x18')](function(){return _0x473d10['download'](_0x34c15e,_0x3be407,function(_0x4cbacf){if(_0x4cbacf){logger[_0xdbfa('0x1a')]('Unable\x20to\x20delete\x20zip\x20file',_0x4cbacf);}else{fs['unlinkSync'](_0x34c15e);}});});});}else{return _0x473d10['sendStatus'](0xc8);}})[_0xdbfa('0x33')](handleError(_0x473d10,null));}; \ No newline at end of file +var _0xb5e1=['disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','firstName','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','end','status','json','offset','limit','undefined','count','set','update','destroy','then','sendStatus','stack','name','index','map','OpenchannelInteraction','rawAttributes','key','findAll','query','user','catch','show','type','from','params','keys','filters','model','fields','attributes','length','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','includeAll','rows','addTags','setTags','spread','Tag','openchannelInteractionTags:save','removeTags','unix','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb5e1,0x112));var _0x1b5e=function(_0x41f37f,_0x5032cf){_0x41f37f=_0x41f37f-0x0;var _0xc14e94=_0xb5e1[_0x41f37f];return _0xc14e94;};'use strict';var rimraf=require(_0x1b5e('0x0'));var zipdir=require(_0x1b5e('0x1'));var moment=require(_0x1b5e('0x2'));var util=require(_0x1b5e('0x3'));var path=require(_0x1b5e('0x4'));var ejs=require(_0x1b5e('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1b5e('0x6'));var interaction=require(_0x1b5e('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x1b5e('0x8'));var config=require(_0x1b5e('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1b5e('0xa')](config[_0x1b5e('0xb')],{'host':_0x1b5e('0xc'),'port':0x18eb});var socket=require(_0x1b5e('0xd'))(new Redis(config[_0x1b5e('0xb')]));require(_0x1b5e('0xe'))[_0x1b5e('0xf')](socket);function respondWithStatusCode(_0xfc861b,_0x2f2aa0){_0x2f2aa0=_0x2f2aa0||0xcc;return function(_0x5cc438){if(_0x5cc438){return _0xfc861b['sendStatus'](_0x2f2aa0);}return _0xfc861b['status'](_0x2f2aa0)[_0x1b5e('0x10')]();};}function respondWithResult(_0x2b7b46,_0x4b7657){_0x4b7657=_0x4b7657||0xc8;return function(_0x4dc8c8){if(_0x4dc8c8){return _0x2b7b46[_0x1b5e('0x11')](_0x4b7657)[_0x1b5e('0x12')](_0x4dc8c8);}};}function respondWithFilteredResult(_0x369654,_0x1c472b){return function(_0x500d47){if(_0x500d47){var _0x2686f0=typeof _0x1c472b[_0x1b5e('0x13')]==='undefined'&&typeof _0x1c472b[_0x1b5e('0x14')]===_0x1b5e('0x15');var _0x5b710a=_0x500d47[_0x1b5e('0x16')];var _0x4716bf=_0x2686f0?0x0:_0x1c472b[_0x1b5e('0x13')];var _0x2f73cc=_0x2686f0?_0x500d47[_0x1b5e('0x16')]:_0x1c472b[_0x1b5e('0x13')]+_0x1c472b[_0x1b5e('0x14')];var _0x41e404;if(_0x2f73cc>=_0x5b710a){_0x2f73cc=_0x5b710a;_0x41e404=0xc8;}else{_0x41e404=0xce;}_0x369654[_0x1b5e('0x11')](_0x41e404);return _0x369654[_0x1b5e('0x17')]('Content-Range',_0x4716bf+'-'+_0x2f73cc+'/'+_0x5b710a)[_0x1b5e('0x12')](_0x500d47);}return null;};}function saveUpdates(_0x2a2ebc){return function(_0x5596fd){if(_0x5596fd){return _0x5596fd[_0x1b5e('0x18')](_0x2a2ebc)['then'](function(_0x20e2d8){return _0x20e2d8;});}return null;};}function removeEntity(_0x1bc432){return function(_0x33fa6b){if(_0x33fa6b){return _0x33fa6b[_0x1b5e('0x19')]()[_0x1b5e('0x1a')](function(){_0x1bc432[_0x1b5e('0x11')](0xcc)[_0x1b5e('0x10')]();});}};}function handleEntityNotFound(_0x1ccb88){return function(_0x11a12c){if(!_0x11a12c){_0x1ccb88[_0x1b5e('0x1b')](0x194);}return _0x11a12c;};}function handleError(_0x34b97e,_0x116838){_0x116838=_0x116838||0x1f4;return function(_0x2de8a7){logger['error'](_0x2de8a7[_0x1b5e('0x1c')]);if(_0x2de8a7[_0x1b5e('0x1d')]){delete _0x2de8a7[_0x1b5e('0x1d')];}_0x34b97e[_0x1b5e('0x11')](_0x116838)['send'](_0x2de8a7);};}exports[_0x1b5e('0x1e')]=function(_0x12d4d6,_0x86cb94){var _0x46efb1={};var _0x4cd83a=_[_0x1b5e('0x1f')](db[_0x1b5e('0x20')][_0x1b5e('0x21')],function(_0x599065){return{'name':_0x599065['fieldName'],'type':_0x599065['type'][_0x1b5e('0x22')]};});_0x46efb1=qs['getOptions'](_0x4cd83a,_0x12d4d6);return interaction[_0x1b5e('0x23')]('openchannel',_0x12d4d6[_0x1b5e('0x24')],_0x12d4d6[_0x1b5e('0x25')],_0x46efb1,_0x4cd83a)[_0x1b5e('0x1a')](respondWithFilteredResult(_0x86cb94,_0x46efb1))[_0x1b5e('0x26')](handleError(_0x86cb94,null));};exports[_0x1b5e('0x27')]=function(_0x42a9f9,_0x20cfff){var _0x2a2989={};if(_0x42a9f9[_0x1b5e('0x24')][_0x1b5e('0x28')]&&_0x42a9f9[_0x1b5e('0x24')][_0x1b5e('0x28')]===_0x1b5e('0x29')){_0x2a2989[_0x1b5e('0x29')]=_0x42a9f9[_0x1b5e('0x2a')]['id'];}else{_0x2a2989['id']=_0x42a9f9[_0x1b5e('0x2a')]['id'];}var _0x397c71={'raw':![],'where':_0x2a2989},_0x4dac9c={};_0x4dac9c['model']=_[_0x1b5e('0x2b')](db[_0x1b5e('0x20')][_0x1b5e('0x21')]);_0x4dac9c[_0x1b5e('0x24')]=_['keys'](_0x42a9f9[_0x1b5e('0x24')]);_0x4dac9c[_0x1b5e('0x2c')]=_['intersection'](_0x4dac9c[_0x1b5e('0x2d')],_0x4dac9c[_0x1b5e('0x24')]);_0x397c71['attributes']=_['intersection'](_0x4dac9c['model'],qs[_0x1b5e('0x2e')](_0x42a9f9[_0x1b5e('0x24')][_0x1b5e('0x2e')]));_0x397c71[_0x1b5e('0x2f')]=_0x397c71[_0x1b5e('0x2f')][_0x1b5e('0x30')]?_0x397c71[_0x1b5e('0x2f')]:_0x4dac9c['model'];if(_0x42a9f9['query']['includeAll']){_0x397c71[_0x1b5e('0x31')]=[{'all':!![]}];}_0x397c71=_[_0x1b5e('0x32')]({},_0x397c71,_0x42a9f9[_0x1b5e('0x33')]);return db[_0x1b5e('0x20')][_0x1b5e('0x34')](_0x397c71)[_0x1b5e('0x1a')](handleEntityNotFound(_0x20cfff,null))['then'](respondWithResult(_0x20cfff,null))[_0x1b5e('0x26')](handleError(_0x20cfff,null));};exports[_0x1b5e('0x35')]=function(_0x5e7354,_0x195841){return db[_0x1b5e('0x20')][_0x1b5e('0x35')](_0x5e7354[_0x1b5e('0x36')],{})[_0x1b5e('0x1a')](respondWithResult(_0x195841,0xc9))['catch'](handleError(_0x195841,null));};exports['update']=function(_0x163741,_0x12d079){if(_0x163741['body']['id']){delete _0x163741['body']['id'];}return db[_0x1b5e('0x20')][_0x1b5e('0x34')]({'where':{'id':_0x163741[_0x1b5e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x12d079,null))['then'](saveUpdates(_0x163741[_0x1b5e('0x36')],null))[_0x1b5e('0x1a')](respondWithResult(_0x12d079,null))[_0x1b5e('0x26')](handleError(_0x12d079,null));};exports[_0x1b5e('0x19')]=function(_0x270c2f,_0x57d0a6){return db[_0x1b5e('0x20')][_0x1b5e('0x34')]({'where':{'id':_0x270c2f['params']['id']}})[_0x1b5e('0x1a')](handleEntityNotFound(_0x57d0a6,null))[_0x1b5e('0x1a')](removeEntity(_0x57d0a6,null))[_0x1b5e('0x26')](handleError(_0x57d0a6,null));};exports[_0x1b5e('0x37')]=function(_0x112f22,_0x867b5a){return db['OpenchannelInteraction'][_0x1b5e('0x37')]()[_0x1b5e('0x1a')](respondWithResult(_0x867b5a,null))[_0x1b5e('0x26')](handleError(_0x867b5a,null));};exports[_0x1b5e('0x38')]=function(_0x4b731a,_0x3e3515){return db[_0x1b5e('0x39')][_0x1b5e('0x34')]({'where':{'id':_0x4b731a[_0x1b5e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3e3515,null))[_0x1b5e('0x1a')](function(_0x42d43c){if(_0x42d43c){return _0x42d43c[_0x1b5e('0x38')](_0x4b731a[_0x1b5e('0x36')][_0x1b5e('0x3a')],_[_0x1b5e('0x3b')](_0x4b731a[_0x1b5e('0x36')],['ids','id'])||{});}})[_0x1b5e('0x1a')](respondWithResult(_0x3e3515,null))[_0x1b5e('0x26')](handleError(_0x3e3515,null));};exports[_0x1b5e('0x3c')]=function(_0x4c4167,_0x363e30){var _0x105942={'raw':![],'where':{}};var _0x15f477={};var _0x26032e={'count':0x0,'rows':[]};return db[_0x1b5e('0x20')][_0x1b5e('0x3d')]({'where':{'id':_0x4c4167[_0x1b5e('0x2a')]['id']}})[_0x1b5e('0x1a')](handleEntityNotFound(_0x363e30,null))[_0x1b5e('0x1a')](function(_0x43ec80){if(_0x43ec80){_0x15f477[_0x1b5e('0x2d')]=_[_0x1b5e('0x2b')](db[_0x1b5e('0x39')][_0x1b5e('0x21')]);_0x15f477[_0x1b5e('0x24')]=_[_0x1b5e('0x2b')](_0x4c4167['query']);_0x15f477[_0x1b5e('0x2c')]=_[_0x1b5e('0x3e')](_0x15f477[_0x1b5e('0x2d')],_0x15f477[_0x1b5e('0x24')]);_0x105942['attributes']=_[_0x1b5e('0x3e')](_0x15f477[_0x1b5e('0x2d')],qs[_0x1b5e('0x2e')](_0x4c4167['query'][_0x1b5e('0x2e')]));_0x105942[_0x1b5e('0x2f')]=_0x105942[_0x1b5e('0x2f')][_0x1b5e('0x30')]?_0x105942[_0x1b5e('0x2f')]:_0x15f477['model'];if(!_0x4c4167[_0x1b5e('0x24')][_0x1b5e('0x3f')](_0x1b5e('0x40'))){_0x105942['limit']=qs[_0x1b5e('0x14')](_0x4c4167[_0x1b5e('0x24')]['limit']);_0x105942['offset']=qs[_0x1b5e('0x13')](_0x4c4167['query'][_0x1b5e('0x13')]);}_0x105942[_0x1b5e('0x41')]=qs[_0x1b5e('0x42')](_0x4c4167[_0x1b5e('0x24')][_0x1b5e('0x42')]);_0x105942['where']=qs[_0x1b5e('0x2c')](_['pick'](_0x4c4167[_0x1b5e('0x24')],_0x15f477[_0x1b5e('0x2c')]));_0x105942[_0x1b5e('0x43')][_0x1b5e('0x44')]=_0x43ec80['id'];if(_0x4c4167['query'][_0x1b5e('0x45')]){_0x105942['where']=_[_0x1b5e('0x32')](_0x105942[_0x1b5e('0x43')],{'$or':_[_0x1b5e('0x1f')](_0x105942[_0x1b5e('0x2f')],function(_0x75a748){var _0x1e3e9f={};_0x1e3e9f[_0x75a748]={'$like':'%'+_0x4c4167[_0x1b5e('0x24')][_0x1b5e('0x45')]+'%'};return _0x1e3e9f;})});}if(_0x4c4167[_0x1b5e('0x24')][_0x1b5e('0x46')]){var _0x185657=_0x4c4167[_0x1b5e('0x24')][_0x1b5e('0x46')][_0x1b5e('0x47')](',');var _0x3be7fd={};_0x3be7fd[_0x185657[0x0]]={'$gte':moment(_0x185657[0x1])[_0x1b5e('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x105942[_0x1b5e('0x43')]=_['merge'](_0x105942[_0x1b5e('0x43')],_0x3be7fd);}_0x105942=_[_0x1b5e('0x32')]({},_0x105942,_0x4c4167[_0x1b5e('0x33')]);return db[_0x1b5e('0x39')][_0x1b5e('0x16')]({'where':_0x105942['where']})['then'](function(_0x21c815){_0x26032e['count']=_0x21c815;if(_0x4c4167[_0x1b5e('0x24')][_0x1b5e('0x49')]){_0x105942[_0x1b5e('0x31')]=[{'all':!![]}];}return db[_0x1b5e('0x39')][_0x1b5e('0x23')](_0x105942);})[_0x1b5e('0x1a')](function(_0x35a26c){_0x26032e[_0x1b5e('0x4a')]=_0x35a26c;return _0x26032e;});}})[_0x1b5e('0x1a')](respondWithFilteredResult(_0x363e30,_0x105942))[_0x1b5e('0x26')](handleError(_0x363e30,null));};exports[_0x1b5e('0x4b')]=function(_0x3685e3,_0x2ae68c){return db[_0x1b5e('0x20')]['find']({'where':{'id':_0x3685e3[_0x1b5e('0x2a')]['id']}})[_0x1b5e('0x1a')](handleEntityNotFound(_0x2ae68c,null))[_0x1b5e('0x1a')](function(_0x53429c){if(_0x53429c){return _0x53429c[_0x1b5e('0x4c')](_0x3685e3['body']['ids'],_[_0x1b5e('0x3b')](_0x3685e3['body'],[_0x1b5e('0x3a'),'id'])||{})[_0x1b5e('0x4d')](function(){return db[_0x1b5e('0x4e')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x3685e3['body'][_0x1b5e('0x3a')]}});})[_0x1b5e('0x1a')](function(_0x5994e2){socket['emit'](_0x1b5e('0x4f'),{'id':Number(_0x3685e3[_0x1b5e('0x2a')]['id']),'tags':_0x5994e2||[]});return{'id':Number(_0x3685e3['params']['id']),'tags':_0x5994e2||[]};});}})['then'](respondWithResult(_0x2ae68c,null))[_0x1b5e('0x26')](handleError(_0x2ae68c,null));};exports[_0x1b5e('0x50')]=function(_0x59c88f,_0x136af8){return db[_0x1b5e('0x20')][_0x1b5e('0x34')]({'where':{'id':_0x59c88f[_0x1b5e('0x2a')]['id']}})[_0x1b5e('0x1a')](handleEntityNotFound(_0x136af8,null))[_0x1b5e('0x1a')](function(_0x4d88f9){if(_0x4d88f9){return _0x4d88f9[_0x1b5e('0x50')](_0x59c88f[_0x1b5e('0x24')][_0x1b5e('0x3a')]);}})[_0x1b5e('0x1a')](respondWithStatusCode(_0x136af8,null))[_0x1b5e('0x26')](handleError(_0x136af8,null));};exports['download']=function(_0x42e304,_0x33238a){var _0x27938d=moment()[_0x1b5e('0x51')]()['toString']();var _0x1d1a55=path['join'](config[_0x1b5e('0x52')],_0x1b5e('0x53'),_0x1b5e('0x54'),'tmp');var _0x11627c=path[_0x1b5e('0x55')](config[_0x1b5e('0x52')],_0x1b5e('0x53'),_0x1b5e('0x54'),_0x1b5e('0x56'));var _0x2b8ed8=path[_0x1b5e('0x55')](_0x1d1a55,_0x27938d);var _0x127b23=util[_0x1b5e('0x48')](_0x1b5e('0x57'),_0x42e304[_0x1b5e('0x2a')]['id'],_0x27938d);var _0x81839f=path[_0x1b5e('0x55')](_0x1d1a55,_0x127b23);var _0x9a110d=[];_0x9a110d[_0x1b5e('0x58')]({'model':db[_0x1b5e('0x59')],'as':_0x1b5e('0x59'),'attributes':['id',_0x1b5e('0x5a')],'raw':!![]});_0x9a110d['push']({'model':db[_0x1b5e('0x5b')],'as':_0x1b5e('0x5c'),'attributes':['id','firstName',_0x1b5e('0x5d')],'raw':!![]});if(_0x42e304[_0x1b5e('0x24')][_0x1b5e('0x56')]){_0x9a110d[_0x1b5e('0x58')]({'model':db[_0x1b5e('0x5e')],'as':_0x1b5e('0x5e'),'raw':!![]});}var _0x92e98f=[{'model':db['OpenchannelMessage'],'as':_0x1b5e('0x5f'),'attributes':['id',_0x1b5e('0x36'),_0x1b5e('0x60'),_0x1b5e('0x61'),_0x1b5e('0x62'),_0x1b5e('0x63')],'include':_0x9a110d}];_0x92e98f[_0x1b5e('0x58')]({'model':db[_0x1b5e('0x64')],'as':_0x1b5e('0x65'),'attributes':['id',_0x1b5e('0x1d')]});_0x92e98f['push']({'model':db[_0x1b5e('0x59')],'as':_0x1b5e('0x66'),'attributes':['id','fullname']});return db[_0x1b5e('0x20')][_0x1b5e('0x34')]({'where':{'id':_0x42e304['params']['id']},'include':_0x92e98f})[_0x1b5e('0x1a')](handleEntityNotFound(_0x33238a,null))[_0x1b5e('0x1a')](function(_0x339e90){if(_0x339e90){var _0x10da86=_0x339e90['get']({'plain':!![]});fs[_0x1b5e('0x67')](_0x2b8ed8);var _0x450ef2={'channel':_0x1b5e('0x68'),'account':_0x10da86[_0x1b5e('0x65')][_0x1b5e('0x1d')],'agent':_0x10da86[_0x1b5e('0x66')]?_0x10da86[_0x1b5e('0x66')][_0x1b5e('0x5a')]:_0x1b5e('0x69'),'createdAt':moment(_0x10da86['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x10da86[_0x1b5e('0x6a')]?moment(_0x10da86[_0x1b5e('0x6b')])[_0x1b5e('0x48')](_0x1b5e('0x6c'))[_0x1b5e('0x6d')]():'','disposition':_0x10da86[_0x1b5e('0x6e')],'visibility':_0x10da86[_0x1b5e('0x6f')]?_0x1b5e('0x70'):_0x1b5e('0x71'),'messages':_(_0x10da86['Messages'])['filter']({'secret':![]})[_0x1b5e('0x1f')](function(_0x123b84){if(_0x123b84[_0x1b5e('0x5e')]){var _0x3eb67a=path[_0x1b5e('0x55')](_0x11627c,_0x123b84['Attachment'][_0x1b5e('0x72')]);if(fs[_0x1b5e('0x73')](_0x3eb67a)){fs['createReadStream'](_0x3eb67a)[_0x1b5e('0x74')](fs[_0x1b5e('0x75')](path[_0x1b5e('0x55')](_0x2b8ed8,_0x123b84['Attachment'][_0x1b5e('0x72')])));}}return{'date':moment(_0x123b84[_0x1b5e('0x60')])[_0x1b5e('0x48')](_0x1b5e('0x6c'))[_0x1b5e('0x6d')](),'sender':_0x123b84[_0x1b5e('0x61')]==='out'?_0x123b84[_0x1b5e('0x59')]?_0x123b84[_0x1b5e('0x59')][_0x1b5e('0x5a')]:'System':_0x123b84[_0x1b5e('0x5c')][_0x1b5e('0x76')]+(_0x123b84[_0x1b5e('0x5c')][_0x1b5e('0x5d')]?'\x20'+_0x123b84[_0x1b5e('0x5c')][_0x1b5e('0x5d')]:''),'body':_0x123b84[_0x1b5e('0x5e')]?_0x123b84[_0x1b5e('0x5e')]['basename']:_0x123b84[_0x1b5e('0x36')],'direction':_0x123b84[_0x1b5e('0x61')]===_0x1b5e('0x77')?'A':'C','secret':_0x123b84[_0x1b5e('0x62')],'read':_0x123b84['read'],'attachment':_0x123b84['Attachment']};})[_0x1b5e('0x78')]()};return ejs[_0x1b5e('0x79')](path[_0x1b5e('0x55')](config[_0x1b5e('0x52')],_0x1b5e('0x53'),_0x1b5e('0x7a'),_0x1b5e('0x7b')),{'interaction':_0x450ef2})[_0x1b5e('0x1a')](function(_0x425d56){var _0x54bbb0=path[_0x1b5e('0x55')](_0x2b8ed8,_0x1b5e('0x7c')+_0x10da86['id']+'-'+_0x27938d+_0x1b5e('0x7d'));var _0x311a1b={'path':_0x54bbb0,'channel':_0x1b5e('0x68'),'interactionId':_0x10da86['id']};return pdf[_0x1b5e('0x7e')](_0x425d56,_0x311a1b);})[_0x1b5e('0x1a')](function(){return new Promise(function(_0x318003,_0x3970c9){zipdir(_0x2b8ed8,{'saveTo':_0x81839f},function(_0xab155f,_0x2d02c0){if(_0xab155f)return _0x3970c9(_0xab155f);return _0x318003(_0x2d02c0);});})[_0x1b5e('0x1a')](function(){return new Promise(function(_0x49804b,_0x49c5ba){rimraf(_0x2b8ed8,function(_0x3c97a3){if(_0x3c97a3)_0x49c5ba(_0x3c97a3);return _0x49804b();});});})[_0x1b5e('0x1a')](function(){return _0x33238a['download'](_0x81839f,_0x127b23,function(_0x5928c6){if(_0x5928c6){logger['error'](_0x1b5e('0x7f'),_0x5928c6);}else{fs['unlinkSync'](_0x81839f);}});});});}else{return _0x33238a[_0x1b5e('0x1b')](0xc8);}})['catch'](handleError(_0x33238a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 07a35bc..cfadafb 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 _0xd120=['exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x2a2df3,_0x54f312){var _0x19b560=function(_0x19d8c9){while(--_0x19d8c9){_0x2a2df3['push'](_0x2a2df3['shift']());}};_0x19b560(++_0x54f312);}(_0xd120,0xd9));var _0x0d12=function(_0x43905b,_0x23c08b){_0x43905b=_0x43905b-0x0;var _0x97fc16=_0xd120[_0x43905b];return _0x97fc16;};'use strict';var EventEmitter=require(_0x0d12('0x0'));var OpenchannelInteraction=require(_0x0d12('0x1'))['db'][_0x0d12('0x2')];var OpenchannelMessage=require(_0x0d12('0x1'))['db'][_0x0d12('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0d12('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d12('0x5'),'afterDestroy':_0x0d12('0x6')};function emitEvent(_0x44883b){return function(_0x3743dd,_0x2dd9af,_0x3e46cf){_0x3743dd[_0x0d12('0x7')]({'attributes':['id'],'raw':!![]})[_0x0d12('0x8')](function(_0x30688c){_0x3743dd[_0x0d12('0x9')]('Users',_0x30688c[_0x0d12('0xa')](function(_0x19cb67){return{'id':_0x19cb67['id']};}));return OpenchannelMessage[_0x0d12('0xb')]({'where':{'OpenchannelInteractionId':_0x3743dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0d12('0x8')](function(_0x5f3646){_0x3743dd['setDataValue'](_0x0d12('0xc'),_0x5f3646[_0x0d12('0xd')]);OpenchannelInteractionEvents[_0x0d12('0xe')](_0x44883b+':'+_0x3743dd['id'],_0x3743dd);OpenchannelInteractionEvents[_0x0d12('0xe')](_0x44883b,_0x3743dd);_0x3e46cf(null);})['catch'](_0x3e46cf(null));};}for(var e in events){if(events[_0x0d12('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x0d12('0x10')](e,emitEvent(event));}}module[_0x0d12('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x98fd=['hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x59e92a,_0x1af481){var _0x3ae514=function(_0x4cc877){while(--_0x4cc877){_0x59e92a['push'](_0x59e92a['shift']());}};_0x3ae514(++_0x1af481);}(_0x98fd,0x1e9));var _0xd98f=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x98fd[_0x2c9b79];return _0x265032;};'use strict';var EventEmitter=require(_0xd98f('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd98f('0x1')];var OpenchannelMessage=require(_0xd98f('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd98f('0x3')](0x0);var events={'afterCreate':_0xd98f('0x4'),'afterUpdate':_0xd98f('0x5'),'afterDestroy':_0xd98f('0x6')};function emitEvent(_0x4cdd45){return function(_0x581c65,_0x3d7589,_0x3ec658){_0x581c65['getUsers']({'attributes':['id'],'raw':!![]})[_0xd98f('0x7')](function(_0x26d712){_0x581c65['setDataValue'](_0xd98f('0x8'),_0x26d712[_0xd98f('0x9')](function(_0x28fa43){return{'id':_0x28fa43['id']};}));return OpenchannelMessage[_0xd98f('0xa')]({'where':{'OpenchannelInteractionId':_0x581c65['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41ac6f){_0x581c65[_0xd98f('0xb')](_0xd98f('0xc'),_0x41ac6f[_0xd98f('0xd')]);OpenchannelInteractionEvents[_0xd98f('0xe')](_0x4cdd45+':'+_0x581c65['id'],_0x581c65);OpenchannelInteractionEvents[_0xd98f('0xe')](_0x4cdd45,_0x581c65);_0x3ec658(null);})['catch'](_0x3ec658(null));};}for(var e in events){if(events[_0xd98f('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xd98f('0x10')](e,emitEvent(event));}}module[_0xd98f('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 723ac53..ca4c5ad 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 _0x45a4=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x347cc6,_0x37a443){var _0x49de66=function(_0x4428a3){while(--_0x4428a3){_0x347cc6['push'](_0x347cc6['shift']());}};_0x49de66(++_0x37a443);}(_0x45a4,0x19c));var _0x445a=function(_0x4ab52c,_0x491865){_0x4ab52c=_0x4ab52c-0x0;var _0x429c68=_0x45a4[_0x4ab52c];return _0x429c68;};'use strict';var _=require(_0x445a('0x0'));var util=require(_0x445a('0x1'));var logger=require(_0x445a('0x2'))(_0x445a('0x3'));var moment=require('moment');var BPromise=require(_0x445a('0x4'));var rp=require(_0x445a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x445a('0x6'));var config=require(_0x445a('0x7'));var attributes=require(_0x445a('0x8'));module[_0x445a('0x9')]=function(_0x346ae7,_0x475b80){return _0x346ae7['define'](_0x445a('0xa'),attributes,{'tableName':_0x445a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x445a('0xc'),'collate':_0x445a('0xd'),'hooks':{'beforeUpdate':function(_0x24868b,_0x36432d,_0x555b02){if(_0x24868b[_0x445a('0xe')](_0x445a('0xf'))){_0x24868b[_0x445a('0x10')]=moment()[_0x445a('0x11')](_0x445a('0x12'));}_0x555b02(null,_0x24868b);}}});}; \ No newline at end of file +var _0x50fe=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','closed','format','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x4163e7,_0x5e2907){var _0x855acf=function(_0x37f756){while(--_0x37f756){_0x4163e7['push'](_0x4163e7['shift']());}};_0x855acf(++_0x5e2907);}(_0x50fe,0x136));var _0xe50f=function(_0x3a83f6,_0x4ee495){_0x3a83f6=_0x3a83f6-0x0;var _0x26692f=_0x50fe[_0x3a83f6];return _0x26692f;};'use strict';var _=require(_0xe50f('0x0'));var util=require(_0xe50f('0x1'));var logger=require(_0xe50f('0x2'))('api');var moment=require(_0xe50f('0x3'));var BPromise=require(_0xe50f('0x4'));var rp=require(_0xe50f('0x5'));var fs=require('fs');var path=require(_0xe50f('0x6'));var rimraf=require('rimraf');var config=require(_0xe50f('0x7'));var attributes=require(_0xe50f('0x8'));module[_0xe50f('0x9')]=function(_0x5db174,_0x263497){return _0x5db174[_0xe50f('0xa')](_0xe50f('0xb'),attributes,{'tableName':_0xe50f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe50f('0xd'),'hooks':{'beforeUpdate':function(_0x421aee,_0x481b0e,_0x2aea8f){if(_0x421aee['changed'](_0xe50f('0xe'))){_0x421aee['closedAt']=moment()[_0xe50f('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2aea8f(null,_0x421aee);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index baf88ce..dafb1c5 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 _0x634f=['result','catch','UpdateOpenchannelInteraction','body','options','raw','where','attributes','limit','then','AddTagsToOpenchannelInteraction','find','ids','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x634f,0xbc));var _0xf634=function(_0x5e3e46,_0xb348cb){_0x5e3e46=_0x5e3e46-0x0;var _0x33c4d9=_0x634f[_0x5e3e46];return _0x33c4d9;};'use strict';var _=require(_0xf634('0x0'));var util=require(_0xf634('0x1'));var moment=require(_0xf634('0x2'));var BPromise=require(_0xf634('0x3'));var rs=require(_0xf634('0x4'));var fs=require('fs');var Redis=require(_0xf634('0x5'));var db=require(_0xf634('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf634('0x7'))(_0xf634('0x8'));var config=require(_0xf634('0x9'));var jayson=require(_0xf634('0xa'));var client=jayson[_0xf634('0xb')]['http']({'port':0x232a});config['redis']=_[_0xf634('0xc')](config['redis'],{'host':_0xf634('0xd'),'port':0x18eb});var socket=require(_0xf634('0xe'))(new Redis(config[_0xf634('0xf')]));require(_0xf634('0x10'))[_0xf634('0x11')](socket);function respondWithRpcPromise(_0x4a4aa4,_0x3cf3b7,_0x528ae5){return new BPromise(function(_0x5370d9,_0x402280){return client[_0xf634('0x12')](_0x4a4aa4,_0x528ae5)['then'](function(_0x516954){logger[_0xf634('0x13')](_0xf634('0x14'),_0x3cf3b7,_0xf634('0x15'));logger['debug'](_0xf634('0x16'),_0x3cf3b7,_0xf634('0x15'),JSON[_0xf634('0x17')](_0x516954));if(_0x516954[_0xf634('0x18')]){if(_0x516954[_0xf634('0x18')][_0xf634('0x19')]===0x1f4){logger[_0xf634('0x18')](_0xf634('0x14'),_0x3cf3b7,_0x516954[_0xf634('0x18')][_0xf634('0x1a')]);return _0x402280(_0x516954['error'][_0xf634('0x1a')]);}logger[_0xf634('0x18')](_0xf634('0x14'),_0x3cf3b7,_0x516954[_0xf634('0x18')][_0xf634('0x1a')]);return _0x5370d9(_0x516954['error']['message']);}else{logger[_0xf634('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3cf3b7,_0xf634('0x15'));_0x5370d9(_0x516954[_0xf634('0x1b')][_0xf634('0x1a')]);}})[_0xf634('0x1c')](function(_0x157556){logger['error'](_0xf634('0x14'),_0x3cf3b7,_0x157556);_0x402280(_0x157556);});});}exports[_0xf634('0x1d')]=function(_0x37208a){var _0x464d80=this;return new Promise(function(_0x432522,_0x38a6d3){return db['OpenchannelInteraction']['update'](_0x37208a[_0xf634('0x1e')],{'raw':_0x37208a[_0xf634('0x1f')]?_0x37208a['options'][_0xf634('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37208a[_0xf634('0x1f')]?_0x37208a[_0xf634('0x1f')][_0xf634('0x21')]||null:null,'attributes':_0x37208a[_0xf634('0x1f')]?_0x37208a[_0xf634('0x1f')][_0xf634('0x22')]||null:null,'limit':_0x37208a[_0xf634('0x1f')]?_0x37208a[_0xf634('0x1f')][_0xf634('0x23')]||null:null})[_0xf634('0x24')](function(_0x3da705){logger[_0xf634('0x13')]('UpdateOpenchannelInteraction',_0x37208a);logger['debug'](_0xf634('0x1d'),_0x37208a,JSON[_0xf634('0x17')](_0x3da705));_0x432522(_0x3da705);})[_0xf634('0x1c')](function(_0x58bcac){logger['error'](_0xf634('0x1d'),_0x58bcac[_0xf634('0x1a')],_0x37208a);_0x38a6d3(_0x464d80[_0xf634('0x18')](0x1f4,_0x58bcac[_0xf634('0x1a')]));});});};exports[_0xf634('0x25')]=function(_0x5654d4){return new Promise(function(_0x3b2b14,_0xaaa901){return db['OpenchannelInteraction'][_0xf634('0x26')]({'where':_0x5654d4[_0xf634('0x1f')]?_0x5654d4[_0xf634('0x1f')]['where']||null:null})[_0xf634('0x24')](function(_0x3c4cec){if(_0x3c4cec){return _0x3c4cec['addTags'](_0x5654d4[_0xf634('0x1e')][_0xf634('0x27')],_['omit'](_0x5654d4[_0xf634('0x1e')],[_0xf634('0x27'),'id'])||{});}})[_0xf634('0x28')](function(_0xd43db0){logger['info'](_0xf634('0x29'),_0x5654d4);logger[_0xf634('0x2a')](_0xf634('0x29'),_0x5654d4,JSON['stringify'](_0xd43db0));_0x3b2b14(_0xd43db0);})[_0xf634('0x1c')](function(_0x5502fd){logger[_0xf634('0x18')](_0xf634('0x29'),_0x5502fd[_0xf634('0x1a')],_0x5654d4);_0xaaa901(_this[_0xf634('0x18')](0x1f4,_0x5502fd['message']));});});}; \ No newline at end of file +var _0x619f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelInteraction.socket','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','stringify','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','body','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x619f,0x19e));var _0xf619=function(_0x1a36ec,_0x377b94){_0x1a36ec=_0x1a36ec-0x0;var _0x5dfdf4=_0x619f[_0x1a36ec];return _0x5dfdf4;};'use strict';var _=require(_0xf619('0x0'));var util=require(_0xf619('0x1'));var moment=require('moment');var BPromise=require(_0xf619('0x2'));var rs=require(_0xf619('0x3'));var fs=require('fs');var Redis=require(_0xf619('0x4'));var db=require(_0xf619('0x5'))['db'];var utils=require(_0xf619('0x6'));var logger=require(_0xf619('0x7'))(_0xf619('0x8'));var config=require(_0xf619('0x9'));var jayson=require(_0xf619('0xa'));var client=jayson[_0xf619('0xb')][_0xf619('0xc')]({'port':0x232a});config[_0xf619('0xd')]=_['defaults'](config[_0xf619('0xd')],{'host':_0xf619('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf619('0xd')]));require(_0xf619('0xf'))['register'](socket);function respondWithRpcPromise(_0x726d4c,_0xbc54fe,_0xf365da){return new BPromise(function(_0x47f4e9,_0x1881a3){return client[_0xf619('0x10')](_0x726d4c,_0xf365da)[_0xf619('0x11')](function(_0x513bf6){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xbc54fe,_0xf619('0x12'));logger[_0xf619('0x13')](_0xf619('0x14'),_0xbc54fe,_0xf619('0x12'),JSON['stringify'](_0x513bf6));if(_0x513bf6['error']){if(_0x513bf6[_0xf619('0x15')][_0xf619('0x16')]===0x1f4){logger[_0xf619('0x15')](_0xf619('0x17'),_0xbc54fe,_0x513bf6[_0xf619('0x15')]['message']);return _0x1881a3(_0x513bf6[_0xf619('0x15')][_0xf619('0x18')]);}logger[_0xf619('0x15')](_0xf619('0x17'),_0xbc54fe,_0x513bf6[_0xf619('0x15')]['message']);return _0x47f4e9(_0x513bf6[_0xf619('0x15')][_0xf619('0x18')]);}else{logger[_0xf619('0x19')](_0xf619('0x17'),_0xbc54fe,_0xf619('0x12'));_0x47f4e9(_0x513bf6['result'][_0xf619('0x18')]);}})['catch'](function(_0x22b27b){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xbc54fe,_0x22b27b);_0x1881a3(_0x22b27b);});});}exports[_0xf619('0x1a')]=function(_0x48db14){var _0x208401=this;return new Promise(function(_0x524192,_0x41846){return db[_0xf619('0x1b')]['update'](_0x48db14['body'],{'raw':_0x48db14[_0xf619('0x1c')]?_0x48db14[_0xf619('0x1c')][_0xf619('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48db14[_0xf619('0x1c')]?_0x48db14[_0xf619('0x1c')][_0xf619('0x1e')]||null:null,'attributes':_0x48db14['options']?_0x48db14[_0xf619('0x1c')][_0xf619('0x1f')]||null:null,'limit':_0x48db14['options']?_0x48db14[_0xf619('0x1c')][_0xf619('0x20')]||null:null})[_0xf619('0x11')](function(_0x3841ae){logger['info']('UpdateOpenchannelInteraction',_0x48db14);logger[_0xf619('0x13')](_0xf619('0x1a'),_0x48db14,JSON[_0xf619('0x21')](_0x3841ae));_0x524192(_0x3841ae);})[_0xf619('0x22')](function(_0xdc48){logger[_0xf619('0x15')](_0xf619('0x1a'),_0xdc48[_0xf619('0x18')],_0x48db14);_0x41846(_0x208401[_0xf619('0x15')](0x1f4,_0xdc48[_0xf619('0x18')]));});});};exports[_0xf619('0x23')]=function(_0x178fc8){return new Promise(function(_0x1fd9f2,_0x58e39a){return db[_0xf619('0x1b')][_0xf619('0x24')]({'where':_0x178fc8[_0xf619('0x1c')]?_0x178fc8[_0xf619('0x1c')][_0xf619('0x1e')]||null:null})['then'](function(_0x223ebc){if(_0x223ebc){return _0x223ebc[_0xf619('0x25')](_0x178fc8['body'][_0xf619('0x26')],_[_0xf619('0x27')](_0x178fc8[_0xf619('0x28')],[_0xf619('0x26'),'id'])||{});}})['spread'](function(_0x3f0fde){logger[_0xf619('0x19')](_0xf619('0x29'),_0x178fc8);logger['debug']('AddTags',_0x178fc8,JSON[_0xf619('0x21')](_0x3f0fde));_0x1fd9f2(_0x3f0fde);})[_0xf619('0x22')](function(_0x2a19ca){logger[_0xf619('0x15')](_0xf619('0x29'),_0x2a19ca[_0xf619('0x18')],_0x178fc8);_0x58e39a(_this[_0xf619('0x15')](0x1f4,_0x2a19ca['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 586ec5a..e3cf71f 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 _0x5713=['save','remove','update','emit','removeListener','register','./openchannelInteraction.events'];(function(_0x200771,_0x36e07e){var _0x44b597=function(_0x309568){while(--_0x309568){_0x200771['push'](_0x200771['shift']());}};_0x44b597(++_0x36e07e);}(_0x5713,0x1db));var _0x3571=function(_0x55ccf6,_0x581c86){_0x55ccf6=_0x55ccf6-0x0;var _0x29b03f=_0x5713[_0x55ccf6];return _0x29b03f;};'use strict';var OpenchannelInteractionEvents=require(_0x3571('0x0'));var events=[_0x3571('0x1'),_0x3571('0x2'),_0x3571('0x3')];function createListener(_0x414262,_0x2e21a9){return function(_0x15cac3){_0x2e21a9[_0x3571('0x4')](_0x414262,_0x15cac3);};}function removeListener(_0x1db65b,_0x278e74){return function(){OpenchannelInteractionEvents[_0x3571('0x5')](_0x1db65b,_0x278e74);};}exports[_0x3571('0x6')]=function(_0x10b972){for(var _0x4c18f7=0x0,_0x1c2e13=events['length'];_0x4c18f7<_0x1c2e13;_0x4c18f7++){var _0x531003=events[_0x4c18f7];var _0x3cbd3c=createListener('openchannelInteraction:'+_0x531003,_0x10b972);OpenchannelInteractionEvents['on'](_0x531003,_0x3cbd3c);}}; \ No newline at end of file +var _0x184b=['save','remove','update','emit','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x54b9c6,_0x2c697e){var _0x251824=function(_0x269f7c){while(--_0x269f7c){_0x54b9c6['push'](_0x54b9c6['shift']());}};_0x251824(++_0x2c697e);}(_0x184b,0xfb));var _0xb184=function(_0x4de29d,_0x10a255){_0x4de29d=_0x4de29d-0x0;var _0x37013b=_0x184b[_0x4de29d];return _0x37013b;};'use strict';var OpenchannelInteractionEvents=require(_0xb184('0x0'));var events=[_0xb184('0x1'),_0xb184('0x2'),_0xb184('0x3')];function createListener(_0x248f03,_0x26e3e9){return function(_0xddd93f){_0x26e3e9[_0xb184('0x4')](_0x248f03,_0xddd93f);};}function removeListener(_0x437e4c,_0x220836){return function(){OpenchannelInteractionEvents['removeListener'](_0x437e4c,_0x220836);};}exports['register']=function(_0x9d3e52){for(var _0x32e835=0x0,_0x443743=events[_0xb184('0x5')];_0x32e835<_0x443743;_0x32e835++){var _0x3a8987=events[_0x32e835];var _0x13901a=createListener(_0xb184('0x6')+_0x3a8987,_0x9d3e52);OpenchannelInteractionEvents['on'](_0x3a8987,_0x13901a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8a82bf4..1830eb7 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 _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(_0x1a8d4a,_0x374281){var _0x5242ff=function(_0x2cac4f){while(--_0x2cac4f){_0x1a8d4a['push'](_0x1a8d4a['shift']());}};_0x5242ff(++_0x374281);}(_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('./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 +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x3067f3,_0x55914e){var _0xcecdf4=function(_0x2a5929){while(--_0x2a5929){_0x3067f3['push'](_0x3067f3['shift']());}};_0xcecdf4(++_0x55914e);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 8ed0645..cfaee72 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 _0xb688=['TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','exports'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xb688,0xcf));var _0x8b68=function(_0x5e6d7e,_0x2e653a){_0x5e6d7e=_0x5e6d7e-0x0;var _0x36314d=_0xb688[_0x5e6d7e];return _0x36314d;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'body':{'type':Sequelize[_0x8b68('0x1')](_0x8b68('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b68('0x4')]('in','out'),'defaultValue':_0x8b68('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8b68('0x6')]},'providerName':{'type':Sequelize[_0x8b68('0x7')]},'providerResponse':{'type':Sequelize[_0x8b68('0x1')]}}; \ No newline at end of file +var _0xfd6f=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x4039bb,_0x12ced9){var _0x5c9e1f=function(_0x28a4b3){while(--_0x28a4b3){_0x4039bb['push'](_0x4039bb['shift']());}};_0x5c9e1f(++_0x12ced9);}(_0xfd6f,0x19d));var _0xffd6=function(_0x2f79f5,_0x3ca9a3){_0x2f79f5=_0x2f79f5-0x0;var _0x194e1=_0xfd6f[_0x2f79f5];return _0x194e1;};'use strict';var Sequelize=require(_0xffd6('0x0'));module[_0xffd6('0x1')]={'body':{'type':Sequelize[_0xffd6('0x2')](_0xffd6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xffd6('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xffd6('0x5')]('in',_0xffd6('0x6')),'defaultValue':_0xffd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xffd6('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xffd6('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index cb21f50..87844e5 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 _0x6c20=['acceptmessage','reject','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','sequelize','contact','SIP/%s','rejectmessage','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','findAll','rows','show','params','includeAll','body','find','describe','openchannel-interactions','readAt','format','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','channel','motionChannel','EventManager'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6c20,0x88));var _0x06c2=function(_0x54b677,_0x21ee34){_0x54b677=_0x54b677-0x0;var _0x27eb0e=_0x6c20[_0x54b677];return _0x27eb0e;};'use strict';var emlformat=require(_0x06c2('0x0'));var rimraf=require(_0x06c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x06c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x06c2('0x3'));var util=require(_0x06c2('0x4'));var path=require(_0x06c2('0x5'));var sox=require(_0x06c2('0x6'));var csv=require(_0x06c2('0x7'));var ejs=require(_0x06c2('0x8'));var fs=require('fs');var fs_extra=require(_0x06c2('0x9'));var _=require(_0x06c2('0xa'));var squel=require(_0x06c2('0xb'));var crypto=require('crypto');var jsforce=require(_0x06c2('0xc'));var deskjs=require(_0x06c2('0xd'));var toCsv=require(_0x06c2('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x06c2('0xe'));var qs=require(_0x06c2('0xf'));var as=require(_0x06c2('0x10'));var hardwareService=require(_0x06c2('0x11'));var logger=require(_0x06c2('0x12'))(_0x06c2('0x13'));var utils=require(_0x06c2('0x14'));var config=require(_0x06c2('0x15'));var licenseUtil=require(_0x06c2('0x16'));var db=require(_0x06c2('0x17'))['db'];config['redis']=_[_0x06c2('0x18')](config[_0x06c2('0x19')],{'host':_0x06c2('0x1a'),'port':0x18eb});var socket=require(_0x06c2('0x1b'))(new Redis(config['redis']));require(_0x06c2('0x1c'))['register'](socket);var jayson=require(_0x06c2('0x1d'));var client=jayson[_0x06c2('0x1e')][_0x06c2('0x1f')]({'port':0x232c});var client9002=jayson[_0x06c2('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x946f15,_0x224baa,_0x112ab2,_0x1df697){return new BPromise(function(_0x5cec76,_0x483736){var _0x58485a=_0x1df697||client;return _0x58485a['request'](_0x946f15,_0x112ab2)['then'](function(_0x4bcba7){logger[_0x06c2('0x20')](_0x06c2('0x21'),_0x224baa,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x224baa,_0x06c2('0x22'),JSON[_0x06c2('0x23')](_0x4bcba7));if(_0x4bcba7[_0x06c2('0x24')]){if(_0x4bcba7[_0x06c2('0x24')][_0x06c2('0x25')]===0x1f4){logger[_0x06c2('0x24')](_0x06c2('0x21'),_0x224baa,_0x4bcba7['error'][_0x06c2('0x26')]);return _0x483736(_0x4bcba7[_0x06c2('0x24')][_0x06c2('0x26')]);}logger[_0x06c2('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x224baa,_0x4bcba7['error'][_0x06c2('0x26')]);return _0x5cec76(_0x4bcba7['error'][_0x06c2('0x26')]);}else{logger[_0x06c2('0x20')](_0x06c2('0x21'),_0x224baa,_0x06c2('0x22'));_0x5cec76(_0x4bcba7['result'][_0x06c2('0x26')]);}})[_0x06c2('0x27')](function(_0x128e64){logger[_0x06c2('0x24')](_0x06c2('0x21'),_0x224baa,_0x128e64);_0x483736(_0x128e64);});});}function respondWithStatusCode(_0x30bece,_0xfd6f20){_0xfd6f20=_0xfd6f20||0xcc;return function(_0x41dcdc){if(_0x41dcdc){return _0x30bece[_0x06c2('0x28')](_0xfd6f20);}return _0x30bece[_0x06c2('0x29')](_0xfd6f20)[_0x06c2('0x2a')]();};}function respondWithResult(_0x4c12ca,_0x228229){_0x228229=_0x228229||0xc8;return function(_0x2d772e){if(_0x2d772e){return _0x4c12ca[_0x06c2('0x29')](_0x228229)[_0x06c2('0x2b')](_0x2d772e);}};}function respondWithFilteredResult(_0xe2b961,_0x2c6a15){return function(_0x4330f0){if(_0x4330f0){var _0x5583e8=typeof _0x2c6a15[_0x06c2('0x2c')]===_0x06c2('0x2d')&&typeof _0x2c6a15[_0x06c2('0x2e')]===_0x06c2('0x2d');var _0xe6b93c=_0x4330f0['count'];var _0x3e4d7f=_0x5583e8?0x0:_0x2c6a15[_0x06c2('0x2c')];var _0x4fd36f=_0x5583e8?_0x4330f0[_0x06c2('0x2f')]:_0x2c6a15['offset']+_0x2c6a15[_0x06c2('0x2e')];var _0x2d4ac7;if(_0x4fd36f>=_0xe6b93c){_0x4fd36f=_0xe6b93c;_0x2d4ac7=0xc8;}else{_0x2d4ac7=0xce;}_0xe2b961[_0x06c2('0x29')](_0x2d4ac7);return _0xe2b961['set'](_0x06c2('0x30'),_0x3e4d7f+'-'+_0x4fd36f+'/'+_0xe6b93c)[_0x06c2('0x2b')](_0x4330f0);}return null;};}function patchUpdates(_0x3850a7){return function(_0x5be2cd){try{jsonpatch[_0x06c2('0x31')](_0x5be2cd,_0x3850a7,!![]);}catch(_0x3a55b6){return BPromise['reject'](_0x3a55b6);}return _0x5be2cd['save']();};}function saveUpdates(_0x286ba4,_0x4cc4d3){return function(_0x1d5106){if(_0x1d5106){return _0x1d5106[_0x06c2('0x32')](_0x286ba4)[_0x06c2('0x33')](function(_0x5eee96){return _0x5eee96;});}return null;};}function removeEntity(_0xfd4e47,_0x31a790){return function(_0x1fcba8){if(_0x1fcba8){return _0x1fcba8[_0x06c2('0x34')]()[_0x06c2('0x33')](function(){_0xfd4e47['status'](0xcc)[_0x06c2('0x2a')]();});}};}function handleEntityNotFound(_0x1c10ed,_0x1c933d){return function(_0x1cd245){if(!_0x1cd245){_0x1c10ed[_0x06c2('0x28')](0x194);}return _0x1cd245;};}function handleError(_0x3da257,_0x227ea7){_0x227ea7=_0x227ea7||0x1f4;return function(_0x1ad475){logger[_0x06c2('0x24')](_0x1ad475[_0x06c2('0x35')]);if(_0x1ad475['name']){delete _0x1ad475[_0x06c2('0x36')];}_0x3da257[_0x06c2('0x29')](_0x227ea7)[_0x06c2('0x37')](_0x1ad475);};}exports[_0x06c2('0x38')]=function(_0x18d2d1,_0x10bfca){var _0x507e63={},_0x552982={},_0x481abd={'count':0x0,'rows':[]};var _0x41264c=_[_0x06c2('0x39')](db[_0x06c2('0x3a')][_0x06c2('0x3b')],function(_0x271c20){return{'name':_0x271c20[_0x06c2('0x3c')],'type':_0x271c20['type'][_0x06c2('0x3d')]};});_0x552982[_0x06c2('0x3e')]=_[_0x06c2('0x39')](_0x41264c,_0x06c2('0x36'));_0x552982[_0x06c2('0x3f')]=_[_0x06c2('0x40')](_0x18d2d1['query']);_0x552982['filters']=_[_0x06c2('0x41')](_0x552982[_0x06c2('0x3e')],_0x552982[_0x06c2('0x3f')]);_0x507e63['attributes']=_[_0x06c2('0x41')](_0x552982['model'],qs[_0x06c2('0x42')](_0x18d2d1['query'][_0x06c2('0x42')]));_0x507e63[_0x06c2('0x43')]=_0x507e63[_0x06c2('0x43')][_0x06c2('0x44')]?_0x507e63[_0x06c2('0x43')]:_0x552982[_0x06c2('0x3e')];if(!_0x18d2d1['query']['hasOwnProperty']('nolimit')){_0x507e63['limit']=qs[_0x06c2('0x2e')](_0x18d2d1[_0x06c2('0x3f')]['limit']);_0x507e63['offset']=qs[_0x06c2('0x2c')](_0x18d2d1[_0x06c2('0x3f')][_0x06c2('0x2c')]);}_0x507e63[_0x06c2('0x45')]=qs[_0x06c2('0x46')](_0x18d2d1[_0x06c2('0x3f')][_0x06c2('0x46')]);_0x507e63['where']=qs[_0x06c2('0x47')](_[_0x06c2('0x48')](_0x18d2d1[_0x06c2('0x3f')],_0x552982[_0x06c2('0x47')]),_0x41264c);if(_0x18d2d1[_0x06c2('0x3f')][_0x06c2('0x49')]){_0x507e63['where']=_[_0x06c2('0x4a')](_0x507e63[_0x06c2('0x4b')],{'$or':_[_0x06c2('0x39')](_0x41264c,function(_0x288207){if(_0x288207[_0x06c2('0x4c')]!==_0x06c2('0x4d')){var _0x1be682={};_0x1be682[_0x288207[_0x06c2('0x36')]]={'$like':'%'+_0x18d2d1[_0x06c2('0x3f')][_0x06c2('0x49')]+'%'};return _0x1be682;}})});}_0x507e63=_['merge']({},_0x507e63,_0x18d2d1[_0x06c2('0x4e')]);var _0x23e01e={'where':_0x507e63[_0x06c2('0x4b')]};return db[_0x06c2('0x3a')]['count'](_0x23e01e)[_0x06c2('0x33')](function(_0x3f81e0){_0x481abd[_0x06c2('0x2f')]=_0x3f81e0;if(_0x18d2d1['query']['includeAll']){_0x507e63['include']=[{'all':!![]}];}return db[_0x06c2('0x3a')][_0x06c2('0x4f')](_0x507e63);})[_0x06c2('0x33')](function(_0x208cf4){_0x481abd[_0x06c2('0x50')]=_0x208cf4;return _0x481abd;})[_0x06c2('0x33')](respondWithFilteredResult(_0x10bfca,_0x507e63))[_0x06c2('0x27')](handleError(_0x10bfca,null));};exports[_0x06c2('0x51')]=function(_0x2fb099,_0x4d1cad){var _0x1e3965={'raw':!![],'where':{'id':_0x2fb099[_0x06c2('0x52')]['id']}},_0x4c27cf={};_0x4c27cf['model']=_['keys'](db[_0x06c2('0x3a')][_0x06c2('0x3b')]);_0x4c27cf[_0x06c2('0x3f')]=_[_0x06c2('0x40')](_0x2fb099['query']);_0x4c27cf['filters']=_[_0x06c2('0x41')](_0x4c27cf[_0x06c2('0x3e')],_0x4c27cf[_0x06c2('0x3f')]);_0x1e3965[_0x06c2('0x43')]=_['intersection'](_0x4c27cf[_0x06c2('0x3e')],qs[_0x06c2('0x42')](_0x2fb099[_0x06c2('0x3f')][_0x06c2('0x42')]));_0x1e3965[_0x06c2('0x43')]=_0x1e3965['attributes'][_0x06c2('0x44')]?_0x1e3965[_0x06c2('0x43')]:_0x4c27cf['model'];if(_0x2fb099[_0x06c2('0x3f')][_0x06c2('0x53')]){_0x1e3965['include']=[{'all':!![]}];}_0x1e3965=_[_0x06c2('0x4a')]({},_0x1e3965,_0x2fb099[_0x06c2('0x4e')]);return db[_0x06c2('0x3a')]['find'](_0x1e3965)[_0x06c2('0x33')](handleEntityNotFound(_0x4d1cad,null))[_0x06c2('0x33')](respondWithResult(_0x4d1cad,null))[_0x06c2('0x27')](handleError(_0x4d1cad,null));};exports['create']=function(_0x17896f,_0x1ff7da){return db['OpenchannelMessage']['create'](_0x17896f[_0x06c2('0x54')],{})[_0x06c2('0x33')](respondWithResult(_0x1ff7da,0xc9))['catch'](handleError(_0x1ff7da,null));};exports[_0x06c2('0x32')]=function(_0x133385,_0x4e4e5a){if(_0x133385[_0x06c2('0x54')]['id']){delete _0x133385[_0x06c2('0x54')]['id'];}return db['OpenchannelMessage'][_0x06c2('0x55')]({'where':{'id':_0x133385[_0x06c2('0x52')]['id']}})[_0x06c2('0x33')](handleEntityNotFound(_0x4e4e5a,null))['then'](saveUpdates(_0x133385[_0x06c2('0x54')],null))[_0x06c2('0x33')](respondWithResult(_0x4e4e5a,null))[_0x06c2('0x27')](handleError(_0x4e4e5a,null));};exports[_0x06c2('0x34')]=function(_0x1f1fbc,_0xf79af0){return db[_0x06c2('0x3a')][_0x06c2('0x55')]({'where':{'id':_0x1f1fbc[_0x06c2('0x52')]['id']}})[_0x06c2('0x33')](handleEntityNotFound(_0xf79af0,null))[_0x06c2('0x33')](removeEntity(_0xf79af0,null))[_0x06c2('0x27')](handleError(_0xf79af0,null));};exports[_0x06c2('0x56')]=function(_0x5b2a59,_0x1f2fbd){return db[_0x06c2('0x3a')][_0x06c2('0x56')]()['then'](respondWithResult(_0x1f2fbd,null))[_0x06c2('0x27')](handleError(_0x1f2fbd,null));};var interaction_log=require(_0x06c2('0x12'))(_0x06c2('0x57'));exports['accept']=function(_0x400df8,_0x5e48e3,_0x1c1676){var _0x48f88d={'agent':{},'channel':'openchannel'};if(_0x400df8['body']['id']){delete _0x400df8[_0x06c2('0x54')]['id'];}_0x400df8[_0x06c2('0x54')]['read']=!![];_0x400df8[_0x06c2('0x54')][_0x06c2('0x58')]=moment()[_0x06c2('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x400df8[_0x06c2('0x54')][_0x06c2('0x5a')]=_0x400df8[_0x06c2('0x54')][_0x06c2('0x5a')]||_0x400df8[_0x06c2('0x5b')]['id'];_0x48f88d[_0x06c2('0x5c')]['id']=_0x400df8[_0x06c2('0x54')][_0x06c2('0x5a')];return db[_0x06c2('0x3a')]['find']({'where':{'id':_0x400df8[_0x06c2('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5e48e3,null))[_0x06c2('0x33')](saveUpdates(_0x400df8[_0x06c2('0x54')],null))['then'](function(_0x21ea80){if(_0x21ea80){_0x48f88d[_0x06c2('0x26')]=_0x21ea80[_0x06c2('0x5d')]({'plain':!![]});return db[_0x06c2('0x5e')][_0x06c2('0x55')]({'where':{'id':_0x21ea80['OpenchannelInteractionId']}});}return null;})[_0x06c2('0x33')](handleEntityNotFound(_0x5e48e3,null))[_0x06c2('0x33')](function(_0x60887e){if(_0x60887e){return _0x60887e[_0x06c2('0x32')]({'UserId':_0x400df8[_0x06c2('0x54')]['UserId'],'read1stAt':_[_0x06c2('0x5f')](_0x60887e[_0x06c2('0x60')])?moment()[_0x06c2('0x59')](_0x06c2('0x61')):undefined});}return null;})['then'](function(_0x126357){if(_0x126357){_0x48f88d[_0x06c2('0x62')]=_0x126357['get']({'plain':!![]});interaction_log[_0x06c2('0x20')](_0x06c2('0x63'),_0x400df8[_0x06c2('0x5b')]['id'],_0x400df8['user'][_0x06c2('0x36')],_0x400df8[_0x06c2('0x5b')]['role'],_0x48f88d[_0x06c2('0x62')]['id'],_0x400df8[_0x06c2('0x54')]?JSON[_0x06c2('0x23')](_0x400df8['body']):_0x06c2('0x64'));return respondWithRpcPromise(_0x06c2('0x65'),'acceptMessage',_0x48f88d);}return null;})['then'](function(_0x4dd83e){var _0x46609c=_0x06c2('0x66')+_0x4dd83e[_0x06c2('0x26')]['ContactId'];return db['sequelize'][_0x06c2('0x3f')](_0x46609c,{'type':db[_0x06c2('0x67')][_0x06c2('0x68')][_0x06c2('0x69')],'raw':!![]})['then'](function(_0x176c18){return _0x176c18;});})[_0x06c2('0x33')](function(_0x1c091b){if(_0x1c091b){_0x48f88d[_0x06c2('0x26')]['contact']=_0x1c091b[0x0];if(!_0x400df8[_0x06c2('0x54')][_0x06c2('0x5a')])return;return db[_0x06c2('0x6a')][_0x06c2('0x55')]({'where':{'id':_0x400df8[_0x06c2('0x54')][_0x06c2('0x5a')],'role':_0x06c2('0x5c')},'attributes':['id',_0x06c2('0x36'),_0x06c2('0x6b'),_0x06c2('0x6c'),'internal'],'raw':!![]});}return null;})['then'](function(_0x161028){if(!_0x161028)return null;_0x48f88d[_0x06c2('0x26')][_0x06c2('0x5c')]=_0x161028;return _0x48f88d;})['then'](function(_0x21950b){if(_0x21950b){if(_0x400df8[_0x06c2('0x54')][_0x06c2('0x6d')]){_0x48f88d[_0x06c2('0x26')][_0x06c2('0x6e')]=util[_0x06c2('0x59')]('SIP/%s',_0x400df8['user'][_0x06c2('0x36')]);_0x48f88d['message']['channel']=_0x48f88d[_0x06c2('0x6f')];_0x48f88d[_0x06c2('0x26')][_0x06c2('0x70')]=_0x48f88d[_0x06c2('0x6f')];_0x48f88d[_0x06c2('0x26')]['event']='accept';return respondWithRpcPromise(_0x06c2('0x71'),_0x06c2('0x71'),{'event':_0x06c2('0x72'),'message':_0x48f88d[_0x06c2('0x26')]},client9002)[_0x06c2('0x33')](function(){return _0x48f88d;});}return _0x48f88d;}return null;})['then'](respondWithResult(_0x5e48e3,null))[_0x06c2('0x27')](handleError(_0x5e48e3,null));};var interaction_log=require(_0x06c2('0x12'))(_0x06c2('0x57'));exports[_0x06c2('0x73')]=function(_0x2fb7c7,_0x5d6a13,_0x116a7a){var _0x16bfb1={'agent':{},'channel':_0x06c2('0x74')};if(_0x2fb7c7['body']['id']){delete _0x2fb7c7['body']['id'];}_0x2fb7c7[_0x06c2('0x54')]['UserId']=_0x2fb7c7[_0x06c2('0x54')]['UserId']||_0x2fb7c7['user']['id'];_0x16bfb1[_0x06c2('0x5c')]['id']=_0x2fb7c7[_0x06c2('0x54')][_0x06c2('0x5a')];return db[_0x06c2('0x3a')][_0x06c2('0x55')]({'where':{'id':_0x2fb7c7[_0x06c2('0x52')]['id'],'UserId':null}})[_0x06c2('0x33')](handleEntityNotFound(_0x5d6a13,null))[_0x06c2('0x33')](function(_0x53d353){if(_0x53d353){_0x16bfb1[_0x06c2('0x26')]=_0x53d353[_0x06c2('0x5d')]({'plain':!![]});return db[_0x06c2('0x5e')][_0x06c2('0x55')]({'where':{'id':_0x53d353[_0x06c2('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x5d6a13,null))[_0x06c2('0x33')](function(_0x1f3bdd){if(_0x1f3bdd){_0x16bfb1[_0x06c2('0x62')]=_0x1f3bdd[_0x06c2('0x5d')]({'plain':!![]});interaction_log[_0x06c2('0x20')](_0x06c2('0x76'),_0x2fb7c7['user']['id'],_0x2fb7c7['user'][_0x06c2('0x36')],_0x2fb7c7[_0x06c2('0x5b')][_0x06c2('0x77')],_0x16bfb1[_0x06c2('0x62')]['id'],_0x2fb7c7['body']?JSON[_0x06c2('0x23')](_0x2fb7c7[_0x06c2('0x54')]):_0x06c2('0x64'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x16bfb1);}return null;})[_0x06c2('0x33')](function(_0x4052b0){var _0x23c662='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4052b0[_0x06c2('0x26')][_0x06c2('0x78')];return db[_0x06c2('0x79')]['query'](_0x23c662,{'type':db[_0x06c2('0x67')][_0x06c2('0x68')][_0x06c2('0x69')],'raw':!![]})[_0x06c2('0x33')](function(_0x4d6943){return _0x4d6943;});})[_0x06c2('0x33')](function(_0x1c81ce){if(_0x1c81ce){_0x16bfb1[_0x06c2('0x26')][_0x06c2('0x7a')]=_0x1c81ce[0x0];if(!_0x2fb7c7[_0x06c2('0x54')][_0x06c2('0x5a')])return;return db[_0x06c2('0x6a')][_0x06c2('0x55')]({'where':{'id':_0x2fb7c7[_0x06c2('0x54')]['UserId'],'role':_0x06c2('0x5c')},'attributes':['id',_0x06c2('0x36'),'fullname',_0x06c2('0x6c'),'internal'],'raw':!![]});}return null;})['then'](function(_0x338abe){if(!_0x338abe)return null;_0x16bfb1['message'][_0x06c2('0x5c')]=_0x338abe;return _0x16bfb1;})[_0x06c2('0x33')](function(_0xc70bd6){if(_0xc70bd6){_0xc70bd6[_0x06c2('0x26')][_0x06c2('0x6e')]=util[_0x06c2('0x59')](_0x06c2('0x7b'),_0x2fb7c7['user'][_0x06c2('0x36')]);_0xc70bd6[_0x06c2('0x26')]['channel']=_0x16bfb1['channel'];_0xc70bd6[_0x06c2('0x26')][_0x06c2('0x70')]=_0x16bfb1['channel'];_0xc70bd6[_0x06c2('0x26')]['event']=_0x06c2('0x73');respondWithRpcPromise(_0x06c2('0x71'),_0x06c2('0x71'),{'event':_0x06c2('0x7c'),'message':_0xc70bd6[_0x06c2('0x26')]},client9002);return _0x16bfb1;}return null;})[_0x06c2('0x33')](respondWithResult(_0x5d6a13,null))[_0x06c2('0x27')](handleError(_0x5d6a13,null));}; \ No newline at end of file +var _0xdc1e=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','create','body','update','describe','../../config/logger','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','params','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','reject','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','undefined','limit','count','offset','set','apply','save','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x30f4a0,_0x1468bb){var _0x1fdef8=function(_0x347f18){while(--_0x347f18){_0x30f4a0['push'](_0x30f4a0['shift']());}};_0x1fdef8(++_0x1468bb);}(_0xdc1e,0xc1));var _0xedc1=function(_0x3be525,_0x40ce01){_0x3be525=_0x3be525-0x0;var _0x498085=_0xdc1e[_0x3be525];return _0x498085;};'use strict';var emlformat=require(_0xedc1('0x0'));var rimraf=require(_0xedc1('0x1'));var zipdir=require(_0xedc1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedc1('0x3'));var moment=require(_0xedc1('0x4'));var BPromise=require(_0xedc1('0x5'));var Mustache=require('mustache');var util=require(_0xedc1('0x6'));var path=require('path');var sox=require(_0xedc1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedc1('0x8'));var squel=require('squel');var crypto=require(_0xedc1('0x9'));var jsforce=require(_0xedc1('0xa'));var deskjs=require(_0xedc1('0xb'));var toCsv=require(_0xedc1('0xc'));var querystring=require(_0xedc1('0xd'));var Papa=require(_0xedc1('0xe'));var Redis=require(_0xedc1('0xf'));var authService=require(_0xedc1('0x10'));var qs=require(_0xedc1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedc1('0x12'));var logger=require('../../config/logger')(_0xedc1('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedc1('0x14'));var db=require(_0xedc1('0x15'))['db'];config[_0xedc1('0x16')]=_[_0xedc1('0x17')](config[_0xedc1('0x16')],{'host':_0xedc1('0x18'),'port':0x18eb});var socket=require(_0xedc1('0x19'))(new Redis(config[_0xedc1('0x16')]));require(_0xedc1('0x1a'))[_0xedc1('0x1b')](socket);var jayson=require(_0xedc1('0x1c'));var client=jayson[_0xedc1('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0xedc1('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x43cb2e,_0x32e4ef,_0x5da3f8,_0x4ebedf){return new BPromise(function(_0x21e4ee,_0xffb069){var _0x5620b3=_0x4ebedf||client;return _0x5620b3[_0xedc1('0x1f')](_0x43cb2e,_0x5da3f8)[_0xedc1('0x20')](function(_0x38c01e){logger['info'](_0xedc1('0x21'),_0x32e4ef,_0xedc1('0x22'));logger[_0xedc1('0x23')](_0xedc1('0x24'),_0x32e4ef,_0xedc1('0x22'),JSON['stringify'](_0x38c01e));if(_0x38c01e['error']){if(_0x38c01e[_0xedc1('0x25')][_0xedc1('0x26')]===0x1f4){logger[_0xedc1('0x25')](_0xedc1('0x21'),_0x32e4ef,_0x38c01e[_0xedc1('0x25')][_0xedc1('0x27')]);return _0xffb069(_0x38c01e[_0xedc1('0x25')][_0xedc1('0x27')]);}logger['error'](_0xedc1('0x21'),_0x32e4ef,_0x38c01e[_0xedc1('0x25')][_0xedc1('0x27')]);return _0x21e4ee(_0x38c01e[_0xedc1('0x25')][_0xedc1('0x27')]);}else{logger['info'](_0xedc1('0x21'),_0x32e4ef,_0xedc1('0x22'));_0x21e4ee(_0x38c01e['result'][_0xedc1('0x27')]);}})[_0xedc1('0x28')](function(_0x5cb1e0){logger[_0xedc1('0x25')](_0xedc1('0x21'),_0x32e4ef,_0x5cb1e0);_0xffb069(_0x5cb1e0);});});}function respondWithStatusCode(_0x281423,_0x17a945){_0x17a945=_0x17a945||0xcc;return function(_0x3d159f){if(_0x3d159f){return _0x281423['sendStatus'](_0x17a945);}return _0x281423[_0xedc1('0x29')](_0x17a945)[_0xedc1('0x2a')]();};}function respondWithResult(_0xb79b,_0x13aa50){_0x13aa50=_0x13aa50||0xc8;return function(_0x4f8f1f){if(_0x4f8f1f){return _0xb79b['status'](_0x13aa50)[_0xedc1('0x2b')](_0x4f8f1f);}};}function respondWithFilteredResult(_0x560d6b,_0x446e95){return function(_0x2deb6b){if(_0x2deb6b){var _0x4d6beb=typeof _0x446e95['offset']===_0xedc1('0x2c')&&typeof _0x446e95[_0xedc1('0x2d')]===_0xedc1('0x2c');var _0x10e6ad=_0x2deb6b[_0xedc1('0x2e')];var _0x2a5529=_0x4d6beb?0x0:_0x446e95[_0xedc1('0x2f')];var _0x58ba04=_0x4d6beb?_0x2deb6b[_0xedc1('0x2e')]:_0x446e95[_0xedc1('0x2f')]+_0x446e95[_0xedc1('0x2d')];var _0x1dee14;if(_0x58ba04>=_0x10e6ad){_0x58ba04=_0x10e6ad;_0x1dee14=0xc8;}else{_0x1dee14=0xce;}_0x560d6b[_0xedc1('0x29')](_0x1dee14);return _0x560d6b[_0xedc1('0x30')]('Content-Range',_0x2a5529+'-'+_0x58ba04+'/'+_0x10e6ad)[_0xedc1('0x2b')](_0x2deb6b);}return null;};}function patchUpdates(_0x352a9e){return function(_0x4b6353){try{jsonpatch[_0xedc1('0x31')](_0x4b6353,_0x352a9e,!![]);}catch(_0x14acad){return BPromise['reject'](_0x14acad);}return _0x4b6353[_0xedc1('0x32')]();};}function saveUpdates(_0x25924a,_0x2fd912){return function(_0x3cade5){if(_0x3cade5){return _0x3cade5['update'](_0x25924a)[_0xedc1('0x20')](function(_0x4e41a6){return _0x4e41a6;});}return null;};}function removeEntity(_0x19d96e,_0xd816a){return function(_0x4605e9){if(_0x4605e9){return _0x4605e9[_0xedc1('0x33')]()['then'](function(){_0x19d96e[_0xedc1('0x29')](0xcc)[_0xedc1('0x2a')]();});}};}function handleEntityNotFound(_0x5846a5,_0x198a10){return function(_0x51a762){if(!_0x51a762){_0x5846a5[_0xedc1('0x34')](0x194);}return _0x51a762;};}function handleError(_0x32fdca,_0xbd8d39){_0xbd8d39=_0xbd8d39||0x1f4;return function(_0xc3302e){logger[_0xedc1('0x25')](_0xc3302e[_0xedc1('0x35')]);if(_0xc3302e[_0xedc1('0x36')]){delete _0xc3302e[_0xedc1('0x36')];}_0x32fdca[_0xedc1('0x29')](_0xbd8d39)[_0xedc1('0x37')](_0xc3302e);};}exports['index']=function(_0x185162,_0x51e777){var _0x204663={},_0x3403aa={},_0x2cc058={'count':0x0,'rows':[]};var _0x534913=_[_0xedc1('0x38')](db[_0xedc1('0x39')][_0xedc1('0x3a')],function(_0xa87550){return{'name':_0xa87550['fieldName'],'type':_0xa87550['type'][_0xedc1('0x3b')]};});_0x3403aa[_0xedc1('0x3c')]=_['map'](_0x534913,'name');_0x3403aa[_0xedc1('0x3d')]=_[_0xedc1('0x3e')](_0x185162['query']);_0x3403aa[_0xedc1('0x3f')]=_[_0xedc1('0x40')](_0x3403aa[_0xedc1('0x3c')],_0x3403aa['query']);_0x204663[_0xedc1('0x41')]=_['intersection'](_0x3403aa[_0xedc1('0x3c')],qs['fields'](_0x185162[_0xedc1('0x3d')][_0xedc1('0x42')]));_0x204663[_0xedc1('0x41')]=_0x204663[_0xedc1('0x41')][_0xedc1('0x43')]?_0x204663[_0xedc1('0x41')]:_0x3403aa[_0xedc1('0x3c')];if(!_0x185162[_0xedc1('0x3d')][_0xedc1('0x44')](_0xedc1('0x45'))){_0x204663[_0xedc1('0x2d')]=qs['limit'](_0x185162[_0xedc1('0x3d')][_0xedc1('0x2d')]);_0x204663[_0xedc1('0x2f')]=qs[_0xedc1('0x2f')](_0x185162[_0xedc1('0x3d')][_0xedc1('0x2f')]);}_0x204663['order']=qs['sort'](_0x185162[_0xedc1('0x3d')][_0xedc1('0x46')]);_0x204663[_0xedc1('0x47')]=qs[_0xedc1('0x3f')](_[_0xedc1('0x48')](_0x185162[_0xedc1('0x3d')],_0x3403aa[_0xedc1('0x3f')]),_0x534913);if(_0x185162['query'][_0xedc1('0x49')]){_0x204663[_0xedc1('0x47')]=_[_0xedc1('0x4a')](_0x204663[_0xedc1('0x47')],{'$or':_[_0xedc1('0x38')](_0x534913,function(_0x5beb64){if(_0x5beb64['type']!=='VIRTUAL'){var _0x49d546={};_0x49d546[_0x5beb64[_0xedc1('0x36')]]={'$like':'%'+_0x185162[_0xedc1('0x3d')][_0xedc1('0x49')]+'%'};return _0x49d546;}})});}_0x204663=_[_0xedc1('0x4a')]({},_0x204663,_0x185162[_0xedc1('0x4b')]);var _0x4a567f={'where':_0x204663[_0xedc1('0x47')]};return db['OpenchannelMessage'][_0xedc1('0x2e')](_0x4a567f)[_0xedc1('0x20')](function(_0xec81db){_0x2cc058[_0xedc1('0x2e')]=_0xec81db;if(_0x185162[_0xedc1('0x3d')][_0xedc1('0x4c')]){_0x204663[_0xedc1('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xedc1('0x4e')](_0x204663);})[_0xedc1('0x20')](function(_0x87f47a){_0x2cc058['rows']=_0x87f47a;return _0x2cc058;})[_0xedc1('0x20')](respondWithFilteredResult(_0x51e777,_0x204663))[_0xedc1('0x28')](handleError(_0x51e777,null));};exports['show']=function(_0x50c6c5,_0xb4f1b3){var _0x31f4e8={'raw':!![],'where':{'id':_0x50c6c5['params']['id']}},_0x63fb36={};_0x63fb36['model']=_[_0xedc1('0x3e')](db[_0xedc1('0x39')][_0xedc1('0x3a')]);_0x63fb36[_0xedc1('0x3d')]=_[_0xedc1('0x3e')](_0x50c6c5[_0xedc1('0x3d')]);_0x63fb36['filters']=_[_0xedc1('0x40')](_0x63fb36[_0xedc1('0x3c')],_0x63fb36[_0xedc1('0x3d')]);_0x31f4e8['attributes']=_[_0xedc1('0x40')](_0x63fb36[_0xedc1('0x3c')],qs[_0xedc1('0x42')](_0x50c6c5['query'][_0xedc1('0x42')]));_0x31f4e8[_0xedc1('0x41')]=_0x31f4e8[_0xedc1('0x41')][_0xedc1('0x43')]?_0x31f4e8[_0xedc1('0x41')]:_0x63fb36[_0xedc1('0x3c')];if(_0x50c6c5[_0xedc1('0x3d')][_0xedc1('0x4c')]){_0x31f4e8[_0xedc1('0x4d')]=[{'all':!![]}];}_0x31f4e8=_['merge']({},_0x31f4e8,_0x50c6c5[_0xedc1('0x4b')]);return db['OpenchannelMessage'][_0xedc1('0x4f')](_0x31f4e8)[_0xedc1('0x20')](handleEntityNotFound(_0xb4f1b3,null))[_0xedc1('0x20')](respondWithResult(_0xb4f1b3,null))[_0xedc1('0x28')](handleError(_0xb4f1b3,null));};exports[_0xedc1('0x50')]=function(_0x2c60f9,_0x24d104){return db[_0xedc1('0x39')][_0xedc1('0x50')](_0x2c60f9[_0xedc1('0x51')],{})[_0xedc1('0x20')](respondWithResult(_0x24d104,0xc9))[_0xedc1('0x28')](handleError(_0x24d104,null));};exports[_0xedc1('0x52')]=function(_0x2d866d,_0xe4f7f2){if(_0x2d866d[_0xedc1('0x51')]['id']){delete _0x2d866d[_0xedc1('0x51')]['id'];}return db['OpenchannelMessage'][_0xedc1('0x4f')]({'where':{'id':_0x2d866d['params']['id']}})[_0xedc1('0x20')](handleEntityNotFound(_0xe4f7f2,null))[_0xedc1('0x20')](saveUpdates(_0x2d866d[_0xedc1('0x51')],null))[_0xedc1('0x20')](respondWithResult(_0xe4f7f2,null))[_0xedc1('0x28')](handleError(_0xe4f7f2,null));};exports[_0xedc1('0x33')]=function(_0x1a4d7d,_0x505e87){return db[_0xedc1('0x39')][_0xedc1('0x4f')]({'where':{'id':_0x1a4d7d['params']['id']}})[_0xedc1('0x20')](handleEntityNotFound(_0x505e87,null))[_0xedc1('0x20')](removeEntity(_0x505e87,null))[_0xedc1('0x28')](handleError(_0x505e87,null));};exports[_0xedc1('0x53')]=function(_0xac1896,_0x37b597){return db[_0xedc1('0x39')][_0xedc1('0x53')]()['then'](respondWithResult(_0x37b597,null))[_0xedc1('0x28')](handleError(_0x37b597,null));};var interaction_log=require(_0xedc1('0x54'))('openchannel-interactions');exports[_0xedc1('0x55')]=function(_0x42ef1b,_0x57f5e0,_0x2ad1bb){var _0x3bba02={'agent':{},'channel':'openchannel'};if(_0x42ef1b[_0xedc1('0x51')]['id']){delete _0x42ef1b[_0xedc1('0x51')]['id'];}_0x42ef1b[_0xedc1('0x51')][_0xedc1('0x56')]=!![];_0x42ef1b[_0xedc1('0x51')][_0xedc1('0x57')]=moment()[_0xedc1('0x58')](_0xedc1('0x59'));_0x42ef1b[_0xedc1('0x51')][_0xedc1('0x5a')]=_0x42ef1b[_0xedc1('0x51')][_0xedc1('0x5a')]||_0x42ef1b[_0xedc1('0x5b')]['id'];_0x3bba02[_0xedc1('0x5c')]['id']=_0x42ef1b['body'][_0xedc1('0x5a')];return db[_0xedc1('0x39')][_0xedc1('0x4f')]({'where':{'id':_0x42ef1b[_0xedc1('0x5d')]['id'],'UserId':null}})[_0xedc1('0x20')](handleEntityNotFound(_0x57f5e0,null))[_0xedc1('0x20')](saveUpdates(_0x42ef1b[_0xedc1('0x51')],null))[_0xedc1('0x20')](function(_0x4f599f){if(_0x4f599f){_0x3bba02[_0xedc1('0x27')]=_0x4f599f[_0xedc1('0x5e')]({'plain':!![]});return db[_0xedc1('0x5f')]['find']({'where':{'id':_0x4f599f[_0xedc1('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x57f5e0,null))[_0xedc1('0x20')](function(_0x351b76){if(_0x351b76){return _0x351b76[_0xedc1('0x52')]({'UserId':_0x42ef1b['body'][_0xedc1('0x5a')],'read1stAt':_['isNil'](_0x351b76[_0xedc1('0x61')])?moment()['format'](_0xedc1('0x59')):undefined});}return null;})[_0xedc1('0x20')](function(_0x1c12b5){if(_0x1c12b5){_0x3bba02[_0xedc1('0x62')]=_0x1c12b5['get']({'plain':!![]});interaction_log[_0xedc1('0x63')](_0xedc1('0x64'),_0x42ef1b['user']['id'],_0x42ef1b[_0xedc1('0x5b')][_0xedc1('0x36')],_0x42ef1b['user'][_0xedc1('0x65')],_0x3bba02['interaction']['id'],_0x42ef1b[_0xedc1('0x51')]?JSON['stringify'](_0x42ef1b[_0xedc1('0x51')]):_0xedc1('0x66'));return respondWithRpcPromise(_0xedc1('0x67'),_0xedc1('0x68'),_0x3bba02);}return null;})[_0xedc1('0x20')](function(_0x1b4e06){var _0x21d06b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1b4e06['message'][_0xedc1('0x69')];return db[_0xedc1('0x6a')][_0xedc1('0x3d')](_0x21d06b,{'type':db[_0xedc1('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0xedc1('0x20')](function(_0x4c0735){return _0x4c0735;});})[_0xedc1('0x20')](function(_0x2d22d5){if(_0x2d22d5){_0x3bba02[_0xedc1('0x27')]['contact']=_0x2d22d5[0x0];if(!_0x42ef1b['body'][_0xedc1('0x5a')])return;return db['User'][_0xedc1('0x4f')]({'where':{'id':_0x42ef1b[_0xedc1('0x51')]['UserId'],'role':_0xedc1('0x5c')},'attributes':['id','name',_0xedc1('0x6c'),_0xedc1('0x6d'),_0xedc1('0x6e')],'raw':!![]});}return null;})[_0xedc1('0x20')](function(_0x3e1077){if(!_0x3e1077)return null;_0x3bba02[_0xedc1('0x27')][_0xedc1('0x5c')]=_0x3e1077;return _0x3bba02;})[_0xedc1('0x20')](function(_0x1d9fd7){if(_0x1d9fd7){if(_0x42ef1b[_0xedc1('0x51')][_0xedc1('0x6f')]){_0x3bba02[_0xedc1('0x27')][_0xedc1('0x70')]=util[_0xedc1('0x58')](_0xedc1('0x71'),_0x42ef1b[_0xedc1('0x5b')][_0xedc1('0x36')]);_0x3bba02[_0xedc1('0x27')][_0xedc1('0x72')]=_0x3bba02[_0xedc1('0x72')];_0x3bba02['message'][_0xedc1('0x73')]=_0x3bba02[_0xedc1('0x72')];_0x3bba02[_0xedc1('0x27')][_0xedc1('0x74')]=_0xedc1('0x55');return respondWithRpcPromise(_0xedc1('0x75'),_0xedc1('0x75'),{'event':_0xedc1('0x76'),'message':_0x3bba02[_0xedc1('0x27')]},client9002)['then'](function(){return _0x3bba02;});}return _0x3bba02;}return null;})['then'](respondWithResult(_0x57f5e0,null))[_0xedc1('0x28')](handleError(_0x57f5e0,null));};var interaction_log=require(_0xedc1('0x54'))(_0xedc1('0x77'));exports['reject']=function(_0x212337,_0x3766bc,_0x5aa137){var _0x523188={'agent':{},'channel':_0xedc1('0x78')};if(_0x212337[_0xedc1('0x51')]['id']){delete _0x212337[_0xedc1('0x51')]['id'];}_0x212337['body'][_0xedc1('0x5a')]=_0x212337[_0xedc1('0x51')]['UserId']||_0x212337[_0xedc1('0x5b')]['id'];_0x523188[_0xedc1('0x5c')]['id']=_0x212337[_0xedc1('0x51')]['UserId'];return db[_0xedc1('0x39')][_0xedc1('0x4f')]({'where':{'id':_0x212337[_0xedc1('0x5d')]['id'],'UserId':null}})[_0xedc1('0x20')](handleEntityNotFound(_0x3766bc,null))[_0xedc1('0x20')](function(_0x167dbc){if(_0x167dbc){_0x523188[_0xedc1('0x27')]=_0x167dbc[_0xedc1('0x5e')]({'plain':!![]});return db[_0xedc1('0x5f')][_0xedc1('0x4f')]({'where':{'id':_0x167dbc[_0xedc1('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x3766bc,null))['then'](function(_0x171b88){if(_0x171b88){_0x523188[_0xedc1('0x62')]=_0x171b88['get']({'plain':!![]});interaction_log[_0xedc1('0x63')](_0xedc1('0x79'),_0x212337[_0xedc1('0x5b')]['id'],_0x212337[_0xedc1('0x5b')][_0xedc1('0x36')],_0x212337[_0xedc1('0x5b')][_0xedc1('0x65')],_0x523188[_0xedc1('0x62')]['id'],_0x212337[_0xedc1('0x51')]?JSON['stringify'](_0x212337[_0xedc1('0x51')]):_0xedc1('0x66'));return respondWithRpcPromise(_0xedc1('0x7a'),'rejectMessage',_0x523188);}return null;})[_0xedc1('0x20')](function(_0x58a1fe){var _0x3b03ed=_0xedc1('0x7b')+_0x58a1fe[_0xedc1('0x27')]['ContactId'];return db[_0xedc1('0x6a')][_0xedc1('0x3d')](_0x3b03ed,{'type':db[_0xedc1('0x6b')][_0xedc1('0x7c')][_0xedc1('0x7d')],'raw':!![]})[_0xedc1('0x20')](function(_0x2f0989){return _0x2f0989;});})['then'](function(_0x2569fa){if(_0x2569fa){_0x523188['message'][_0xedc1('0x7e')]=_0x2569fa[0x0];if(!_0x212337[_0xedc1('0x51')][_0xedc1('0x5a')])return;return db[_0xedc1('0x7f')]['find']({'where':{'id':_0x212337['body']['UserId'],'role':'agent'},'attributes':['id','name',_0xedc1('0x6c'),_0xedc1('0x6d'),_0xedc1('0x6e')],'raw':!![]});}return null;})[_0xedc1('0x20')](function(_0x11b3d1){if(!_0x11b3d1)return null;_0x523188[_0xedc1('0x27')]['agent']=_0x11b3d1;return _0x523188;})[_0xedc1('0x20')](function(_0x2db3d8){if(_0x2db3d8){_0x2db3d8[_0xedc1('0x27')][_0xedc1('0x70')]=util['format'](_0xedc1('0x71'),_0x212337['user'][_0xedc1('0x36')]);_0x2db3d8[_0xedc1('0x27')]['channel']=_0x523188['channel'];_0x2db3d8[_0xedc1('0x27')][_0xedc1('0x73')]=_0x523188[_0xedc1('0x72')];_0x2db3d8[_0xedc1('0x27')][_0xedc1('0x74')]=_0xedc1('0x80');respondWithRpcPromise(_0xedc1('0x75'),_0xedc1('0x75'),{'event':_0xedc1('0x81'),'message':_0x2db3d8['message']},client9002);return _0x523188;}return null;})[_0xedc1('0x20')](respondWithResult(_0x3766bc,null))[_0xedc1('0x28')](handleError(_0x3766bc,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d4eb1b9..0adab2d 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 _0xfa2b=['remove','emit','hook','exports','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0xfa2b,0x1bc));var _0xbfa2=function(_0x5892c2,_0x200fca){_0x5892c2=_0x5892c2-0x0;var _0x52732d=_0xfa2b[_0x5892c2];return _0x52732d;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0xbfa2('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbfa2('0x1')](0x0);var events={'afterCreate':_0xbfa2('0x2'),'afterUpdate':_0xbfa2('0x3'),'afterDestroy':_0xbfa2('0x4')};function emitEvent(_0x3e6dea){return function(_0x533dce,_0xac3d7b,_0x187514){OpenchannelMessageEvents[_0xbfa2('0x5')](_0x3e6dea+':'+_0x533dce['id'],_0x533dce);OpenchannelMessageEvents[_0xbfa2('0x5')](_0x3e6dea,_0x533dce);_0x187514(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xbfa2('0x6')](e,emitEvent(event));}}module[_0xbfa2('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x4147=['OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4147,0xfa));var _0x7414=function(_0x5497de,_0x5e2bc4){_0x5497de=_0x5497de-0x0;var _0x384ee0=_0x4147[_0x5497de];return _0x384ee0;};'use strict';var EventEmitter=require(_0x7414('0x0'));var OpenchannelMessage=require(_0x7414('0x1'))['db'][_0x7414('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7414('0x3')](0x0);var events={'afterCreate':_0x7414('0x4'),'afterUpdate':'update','afterDestroy':_0x7414('0x5')};function emitEvent(_0x3948ac){return function(_0x1ba766,_0x15acf4,_0x4319e1){OpenchannelMessageEvents[_0x7414('0x6')](_0x3948ac+':'+_0x1ba766['id'],_0x1ba766);OpenchannelMessageEvents[_0x7414('0x6')](_0x3948ac,_0x1ba766);_0x4319e1(null);};}for(var e in events){if(events[_0x7414('0x7')](e)){var event=events[e];OpenchannelMessage[_0x7414('0x8')](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 d04f362..f71663c 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 _0xf85c=['CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','Contact','keys','get','replyUri','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','method','GET','POST','OpenchannelMessage,\x20%s,\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','then','update','createdAt','catch','error','out'];(function(_0x367659,_0x501a3b){var _0x14bbf3=function(_0x4c8971){while(--_0x4c8971){_0x367659['push'](_0x367659['shift']());}};_0x14bbf3(++_0x501a3b);}(_0xf85c,0x11f));var _0xcf85=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf85c[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var logger=require(_0xcf85('0x2'))('api');var moment=require(_0xcf85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf85('0x4'));var rimraf=require(_0xcf85('0x5'));var config=require(_0xcf85('0x6'));var attributes=require(_0xcf85('0x7'));module[_0xcf85('0x8')]=function(_0x5b2874,_0x2aa1ee){return _0x5b2874[_0xcf85('0x9')](_0xcf85('0xa'),attributes,{'tableName':_0xcf85('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xcf85('0xc')],'type':_0xcf85('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x249328,_0x127cb0,_0x563dea){var _0x4f69ad=_0x5b2874[_0xcf85('0xe')];var _0x21d91c=_0x249328['get']({'plain':!![]});if(_0x21d91c[_0xcf85('0xf')][_0xcf85('0x10')]()==='in'||_0x21d91c['direction'][_0xcf85('0x10')]()==='out'&&!_0x21d91c[_0xcf85('0x11')]&&!_[_0xcf85('0x12')](_0x21d91c['UserId'])){_0x4f69ad['OpenchannelInteraction']['findOne']({'where':{'id':_0x21d91c['OpenchannelInteractionId']}})[_0xcf85('0x13')](function(_0xb6d09e){if(_0xb6d09e){_0xb6d09e[_0xcf85('0x14')]({'lastMsgAt':_0x21d91c[_0xcf85('0x15')],'lastMsgDirection':_0x21d91c[_0xcf85('0xf')]['toLowerCase']()});}})[_0xcf85('0x16')](function(_0x366bc9){console[_0xcf85('0x17')](_0x366bc9);});}if(_0x21d91c[_0xcf85('0xf')]===_0xcf85('0x18')&&!_0x21d91c['secret']){var _0x1546ba;_0x4f69ad[_0xcf85('0x19')][_0xcf85('0x1a')]()['then'](function(_0x55c98c){return _0x4f69ad[_0xcf85('0x1b')][_0xcf85('0x1c')]({'where':{'id':_0x21d91c[_0xcf85('0x1d')]},'include':[{'model':_0x4f69ad[_0xcf85('0x1e')],'as':_0xcf85('0x1f'),'where':{'id':_0x21d91c[_0xcf85('0x20')]},'limit':0x1,'include':[{'model':_0x4f69ad[_0xcf85('0x19')],'as':_0xcf85('0x21'),'attributes':_[_0xcf85('0x22')](_0x55c98c)}]}]});})[_0xcf85('0x13')](function(_0x287c66){_0x1546ba=_0x287c66[_0xcf85('0x23')]({'plain':!![]});if(_0x1546ba&&_0x1546ba[_0xcf85('0x24')]){logger[_0xcf85('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xcf85('0x26'),util['format'](_0xcf85('0x27'),_0x21d91c['id'],_0x1546ba['replyUri']));if(_0x1546ba[_0xcf85('0x1f')]&&_0x1546ba[_0xcf85('0x1f')][_0xcf85('0x28')]){_0x21d91c['Interaction']=_[_0xcf85('0x29')](_0x1546ba[_0xcf85('0x1f')][0x0],_0xcf85('0x21'));_0x21d91c[_0xcf85('0x21')]=_0x1546ba['Interactions'][0x0]['Contact'];}var _0x127cb0={'method':'POST','uri':encodeURI(_0x1546ba[_0xcf85('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x127cb0[_0xcf85('0x2a')]){case _0xcf85('0x2b'):_0x127cb0['qs']=_0x21d91c;break;case _0xcf85('0x2c'):_0x127cb0[_0xcf85('0xc')]=_0x21d91c;break;}return rp(_0x127cb0)['then'](function(_0x57a459){logger[_0xcf85('0x25')](_0xcf85('0x2d'),_0xcf85('0x26'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x21d91c['id'],_0x1546ba[_0xcf85('0x24')]));if(_0x57a459[_0xcf85('0xc')][_0xcf85('0x2e')]&&_0x57a459[_0xcf85('0xc')][_0xcf85('0x2e')]!=_0x21d91c[_0xcf85('0x2f')][_0xcf85('0x2e')]){return _0x4f69ad['OpenchannelInteraction'][_0xcf85('0x14')]({'threadId':_0x57a459[_0xcf85('0xc')]['threadId']},{'where':{'id':_0x21d91c[_0xcf85('0x2f')]['id']}});}else{return;}})[_0xcf85('0x13')](function(){return _0x249328[_0xcf85('0x14')]({'read':!![]});})[_0xcf85('0x16')](function(_0x2a351d){logger[_0xcf85('0x17')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xcf85('0x30')](_0x2a351d,{'showHidden':![],'depth':null}));_0x563dea();});}else{_0x563dea();}})[_0xcf85('0x31')](function(){_0x563dea();});}else{_0x563dea();}}},'charset':_0xcf85('0x32'),'collate':_0xcf85('0x33')});}; \ No newline at end of file +var _0x319d=['exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','method','info','threadId','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x319d,0xd9));var _0xd319=function(_0xc9c128,_0x13d604){_0xc9c128=_0xc9c128-0x0;var _0x2abd60=_0x319d[_0xc9c128];return _0x2abd60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd319('0x0'))(_0xd319('0x1'));var moment=require(_0xd319('0x2'));var BPromise=require(_0xd319('0x3'));var rp=require(_0xd319('0x4'));var fs=require('fs');var path=require(_0xd319('0x5'));var rimraf=require(_0xd319('0x6'));var config=require(_0xd319('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xd319('0x8')]=function(_0x19927b,_0x40497b){return _0x19927b[_0xd319('0x9')](_0xd319('0xa'),attributes,{'tableName':_0xd319('0xb'),'paranoid':![],'indexes':[{'name':_0xd319('0xc'),'fields':[_0xd319('0xd')],'type':_0xd319('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15c109,_0x4d665f,_0x32af87){var _0x3f5e4a=_0x19927b['models'];var _0x21736c=_0x15c109[_0xd319('0xf')]({'plain':!![]});if(_0x21736c[_0xd319('0x10')][_0xd319('0x11')]()==='in'||_0x21736c[_0xd319('0x10')][_0xd319('0x11')]()===_0xd319('0x12')&&!_0x21736c[_0xd319('0x13')]&&!_[_0xd319('0x14')](_0x21736c['UserId'])){_0x3f5e4a[_0xd319('0x15')][_0xd319('0x16')]({'where':{'id':_0x21736c[_0xd319('0x17')]}})[_0xd319('0x18')](function(_0x44d25e){if(_0x44d25e){_0x44d25e[_0xd319('0x19')]({'lastMsgAt':_0x21736c[_0xd319('0x1a')],'lastMsgDirection':_0x21736c[_0xd319('0x10')]['toLowerCase']()});}})[_0xd319('0x1b')](function(_0x43d2b9){console['error'](_0x43d2b9);});}if(_0x21736c[_0xd319('0x10')]===_0xd319('0x12')&&!_0x21736c['secret']){var _0x51b3a3;_0x3f5e4a[_0xd319('0x1c')]['describe']()[_0xd319('0x18')](function(_0x446210){return _0x3f5e4a['OpenchannelAccount']['find']({'where':{'id':_0x21736c['OpenchannelAccountId']},'include':[{'model':_0x3f5e4a[_0xd319('0x15')],'as':_0xd319('0x1d'),'where':{'id':_0x21736c[_0xd319('0x17')]},'limit':0x1,'include':[{'model':_0x3f5e4a['CmContact'],'as':_0xd319('0x1e'),'attributes':_[_0xd319('0x1f')](_0x446210)}]}]});})[_0xd319('0x18')](function(_0x3ab320){_0x51b3a3=_0x3ab320[_0xd319('0xf')]({'plain':!![]});if(_0x51b3a3&&_0x51b3a3[_0xd319('0x20')]){logger['info'](_0xd319('0x21'),_0xd319('0x22'),util[_0xd319('0x23')](_0xd319('0x24'),_0x21736c['id'],_0x51b3a3['replyUri']));if(_0x51b3a3[_0xd319('0x1d')]&&_0x51b3a3[_0xd319('0x1d')]['length']){_0x21736c['Interaction']=_[_0xd319('0x25')](_0x51b3a3['Interactions'][0x0],_0xd319('0x1e'));_0x21736c[_0xd319('0x1e')]=_0x51b3a3[_0xd319('0x1d')][0x0][_0xd319('0x1e')];}var _0x4d665f={'method':_0xd319('0x26'),'uri':encodeURI(_0x51b3a3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d665f[_0xd319('0x27')]){case'GET':_0x4d665f['qs']=_0x21736c;break;case _0xd319('0x26'):_0x4d665f[_0xd319('0xd')]=_0x21736c;break;}return rp(_0x4d665f)['then'](function(_0x40ac0){logger[_0xd319('0x28')](_0xd319('0x21'),_0xd319('0x22'),util[_0xd319('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x21736c['id'],_0x51b3a3[_0xd319('0x20')]));if(_0x40ac0[_0xd319('0xd')][_0xd319('0x29')]&&_0x40ac0['body'][_0xd319('0x29')]!=_0x21736c['Interaction'][_0xd319('0x29')]){return _0x3f5e4a[_0xd319('0x15')][_0xd319('0x19')]({'threadId':_0x40ac0[_0xd319('0xd')][_0xd319('0x29')]},{'where':{'id':_0x21736c['Interaction']['id']}});}else{return;}})[_0xd319('0x18')](function(){return _0x15c109[_0xd319('0x19')]({'read':!![]});})[_0xd319('0x1b')](function(_0x2da881){logger[_0xd319('0x2a')](_0xd319('0x21'),'afterCreate',util['inspect'](_0x2da881,{'showHidden':![],'depth':null}));_0x32af87();});}else{_0x32af87();}})['finally'](function(){_0x32af87();});}else{_0x32af87();}}},'charset':_0xd319('0x2b'),'collate':_0xd319('0x2c')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 87b6813..a662760 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x59a10f,_0x251dfb){var _0x1f5305=function(_0x78aea8){while(--_0x78aea8){_0x59a10f['push'](_0x59a10f['shift']());}};_0x1f5305(++_0x251dfb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x14e03e,_0x4b43c9){var _0x24a5a1=function(_0x5b98ee){while(--_0x5b98ee){_0x14e03e['push'](_0x14e03e['shift']());}};_0x24a5a1(++_0x4b43c9);}(_0xadb5,0xad));var _0x5adb=function(_0x5a342d,_0x14f3c8){_0x5a342d=_0x5a342d-0x0;var _0x456fef=_0xadb5[_0x5a342d];return _0x456fef;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0e3264d..f4e2f97 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 _0x0960=['update','emit','removeListener','register','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x9ac550,_0x56836e){var _0x146077=function(_0x3f2015){while(--_0x3f2015){_0x9ac550['push'](_0x9ac550['shift']());}};_0x146077(++_0x56836e);}(_0x0960,0xc2));var _0x0096=function(_0x3e391b,_0x1a4141){_0x3e391b=_0x3e391b-0x0;var _0x4a6478=_0x0960[_0x3e391b];return _0x4a6478;};'use strict';var OpenchannelMessageEvents=require(_0x0096('0x0'));var events=[_0x0096('0x1'),'remove',_0x0096('0x2')];function createListener(_0x1078f3,_0x41a86e){return function(_0x136f7a){_0x41a86e[_0x0096('0x3')](_0x1078f3,_0x136f7a);};}function removeListener(_0xd0d4c6,_0x3ee9fb){return function(){OpenchannelMessageEvents[_0x0096('0x4')](_0xd0d4c6,_0x3ee9fb);};}exports[_0x0096('0x5')]=function(_0x6ea572){for(var _0x59b3cc=0x0,_0x81cc41=events['length'];_0x59b3cc<_0x81cc41;_0x59b3cc++){var _0x1d35f1=events[_0x59b3cc];var _0x44e168=createListener(_0x0096('0x6')+_0x1d35f1,_0x6ea572);OpenchannelMessageEvents['on'](_0x1d35f1,_0x44e168);}}; \ No newline at end of file +var _0xa95a=['save','update','emit','register','openchannelMessage:','./openchannelMessage.events'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0xa95a,0x191));var _0xaa95=function(_0x3e4c87,_0x10f5b3){_0x3e4c87=_0x3e4c87-0x0;var _0x215a34=_0xa95a[_0x3e4c87];return _0x215a34;};'use strict';var OpenchannelMessageEvents=require(_0xaa95('0x0'));var events=[_0xaa95('0x1'),'remove',_0xaa95('0x2')];function createListener(_0x30ed3a,_0x4886ad){return function(_0x2961dc){_0x4886ad[_0xaa95('0x3')](_0x30ed3a,_0x2961dc);};}function removeListener(_0x55c044,_0x19b8f8){return function(){OpenchannelMessageEvents['removeListener'](_0x55c044,_0x19b8f8);};}exports[_0xaa95('0x4')]=function(_0x381c07){for(var _0x298cd0=0x0,_0x41033f=events['length'];_0x298cd0<_0x41033f;_0x298cd0++){var _0x1e3e14=events[_0x298cd0];var _0x51cf19=createListener(_0xaa95('0x5')+_0x1e3e14,_0x381c07);OpenchannelMessageEvents['on'](_0x1e3e14,_0x51cf19);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9243129..7881b64 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 _0x2e63=['/:id/members','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','/:id','isAuthenticated'];(function(_0x140a2c,_0x234dbc){var _0x498d93=function(_0x4b568c){while(--_0x4b568c){_0x140a2c['push'](_0x140a2c['shift']());}};_0x498d93(++_0x234dbc);}(_0x2e63,0x153));var _0x32e6=function(_0x37e09b,_0x4c5ee9){_0x37e09b=_0x37e09b-0x0;var _0x26a1ed=_0x2e63[_0x37e09b];return _0x26a1ed;};'use strict';var multer=require(_0x32e6('0x0'));var util=require(_0x32e6('0x1'));var path=require(_0x32e6('0x2'));var timeout=require('connect-timeout');var express=require(_0x32e6('0x3'));var router=express[_0x32e6('0x4')]();var fs_extra=require(_0x32e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x32e6('0x6'));var config=require(_0x32e6('0x7'));var controller=require(_0x32e6('0x8'));router[_0x32e6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32e6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x32e6('0x9')](_0x32e6('0xa'),auth[_0x32e6('0xb')](),controller['show']);router['get'](_0x32e6('0xc'),auth[_0x32e6('0xb')](),controller['getMembers']);router[_0x32e6('0x9')]('/:id/teams',auth[_0x32e6('0xb')](),controller[_0x32e6('0xd')]);router['get'](_0x32e6('0xe'),auth['isAuthenticated'](),controller[_0x32e6('0xf')]);router[_0x32e6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32e6('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0x32e6('0x11')]);router[_0x32e6('0x10')]('/:id/users',auth[_0x32e6('0xb')](),controller[_0x32e6('0x12')]);router[_0x32e6('0x13')](_0x32e6('0xa'),auth[_0x32e6('0xb')](),controller[_0x32e6('0x14')]);router['delete'](_0x32e6('0xa'),auth[_0x32e6('0xb')](),controller[_0x32e6('0x15')]);router[_0x32e6('0x16')](_0x32e6('0x17'),auth[_0x32e6('0xb')](),controller[_0x32e6('0x18')]);router[_0x32e6('0x16')](_0x32e6('0xe'),auth[_0x32e6('0xb')](),controller[_0x32e6('0x19')]);module[_0x32e6('0x1a')]=router; \ No newline at end of file +var _0xfd53=['post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','index','isAuthenticated','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','create','/:id/teams'];(function(_0x90db95,_0x5b5da7){var _0x3dfd93=function(_0x514c5d){while(--_0x514c5d){_0x90db95['push'](_0x90db95['shift']());}};_0x3dfd93(++_0x5b5da7);}(_0xfd53,0x1ad));var _0x3fd5=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xfd53[_0x424a9a];return _0xa7831c;};'use strict';var multer=require(_0x3fd5('0x0'));var util=require(_0x3fd5('0x1'));var path=require('path');var timeout=require(_0x3fd5('0x2'));var express=require(_0x3fd5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3fd5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3fd5('0x5'));var controller=require(_0x3fd5('0x6'));router[_0x3fd5('0x7')]('/',auth['isAuthenticated'](),controller[_0x3fd5('0x8')]);router['get']('/describe',auth[_0x3fd5('0x9')](),controller[_0x3fd5('0xa')]);router['get'](_0x3fd5('0xb'),auth[_0x3fd5('0x9')](),controller[_0x3fd5('0xc')]);router[_0x3fd5('0x7')]('/:id/members',auth[_0x3fd5('0x9')](),controller[_0x3fd5('0xd')]);router['get']('/:id/teams',auth[_0x3fd5('0x9')](),controller[_0x3fd5('0xe')]);router[_0x3fd5('0x7')](_0x3fd5('0xf'),auth[_0x3fd5('0x9')](),controller[_0x3fd5('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3fd5('0x11')]);router['post'](_0x3fd5('0x12'),auth[_0x3fd5('0x9')](),controller['addTeams']);router[_0x3fd5('0x13')](_0x3fd5('0xf'),auth['isAuthenticated'](),controller[_0x3fd5('0x14')]);router[_0x3fd5('0x15')](_0x3fd5('0xb'),auth[_0x3fd5('0x9')](),controller[_0x3fd5('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3fd5('0x17')]);router[_0x3fd5('0x18')]('/:id/teams',auth[_0x3fd5('0x9')](),controller[_0x3fd5('0x19')]);router[_0x3fd5('0x18')](_0x3fd5('0xf'),auth['isAuthenticated'](),controller[_0x3fd5('0x1a')]);module[_0x3fd5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 6a8e648..0b58b34 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 _0xa220=['STRING','name','INTEGER','rrmemory','beepall','sequelize','exports'];(function(_0x15a3c8,_0x49207a){var _0x248c30=function(_0x2c615d){while(--_0x2c615d){_0x15a3c8['push'](_0x15a3c8['shift']());}};_0x248c30(++_0x49207a);}(_0xa220,0x10f));var _0x0a22=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa220[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x0a22('0x0'));module[_0x0a22('0x1')]={'name':{'type':Sequelize[_0x0a22('0x2')],'unique':_0x0a22('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0a22('0x2')]},'timeout':{'type':Sequelize[_0x0a22('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0a22('0x5'),_0x0a22('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x28ad=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0xc7679b,_0x2511a2){var _0x4e8f0b=function(_0x166401){while(--_0x166401){_0xc7679b['push'](_0xc7679b['shift']());}};_0x4e8f0b(++_0x2511a2);}(_0x28ad,0x126));var _0xd28a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x28ad[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd28a('0x0'));module[_0xd28a('0x1')]={'name':{'type':Sequelize[_0xd28a('0x2')],'unique':_0xd28a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd28a('0x2')]},'timeout':{'type':Sequelize[_0xd28a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd28a('0x5')](_0xd28a('0x6'),_0xd28a('0x7'),_0xd28a('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 704b192..137b59b 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 _0x4fe7=['catch','params','rawAttributes','includeAll','find','create','body','user','role','OpenchannelQueues','autoAssociation','UserProfileResource','error','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','value','removeTeams','ids','removeAgents','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','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','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','save','then','destroy','get','stack','name','index','OpenchannelQueue','fieldName','type','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows'];(function(_0x593b01,_0x244afd){var _0x47cac0=function(_0x5070c3){while(--_0x5070c3){_0x593b01['push'](_0x593b01['shift']());}};_0x47cac0(++_0x244afd);}(_0x4fe7,0x152));var _0x74fe=function(_0x4eaaa0,_0x2bbf58){_0x4eaaa0=_0x4eaaa0-0x0;var _0x1171f5=_0x4fe7[_0x4eaaa0];return _0x1171f5;};'use strict';var emlformat=require(_0x74fe('0x0'));var rimraf=require(_0x74fe('0x1'));var zipdir=require(_0x74fe('0x2'));var jsonpatch=require(_0x74fe('0x3'));var rp=require(_0x74fe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x74fe('0x5'));var util=require(_0x74fe('0x6'));var path=require(_0x74fe('0x7'));var sox=require(_0x74fe('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74fe('0x9'));var squel=require(_0x74fe('0xa'));var crypto=require('crypto');var jsforce=require(_0x74fe('0xb'));var deskjs=require(_0x74fe('0xc'));var toCsv=require(_0x74fe('0xd'));var querystring=require(_0x74fe('0xe'));var Papa=require(_0x74fe('0xf'));var Redis=require(_0x74fe('0x10'));var authService=require(_0x74fe('0x11'));var qs=require(_0x74fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74fe('0x13'));var logger=require(_0x74fe('0x14'))(_0x74fe('0x15'));var utils=require(_0x74fe('0x16'));var config=require(_0x74fe('0x17'));var licenseUtil=require(_0x74fe('0x18'));var db=require(_0x74fe('0x19'))['db'];config[_0x74fe('0x1a')]=_[_0x74fe('0x1b')](config[_0x74fe('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x74fe('0x1c'))[_0x74fe('0x1d')](socket);function respondWithStatusCode(_0xceeb58,_0x37a5ec){_0x37a5ec=_0x37a5ec||0xcc;return function(_0x353fe1){if(_0x353fe1){return _0xceeb58[_0x74fe('0x1e')](_0x37a5ec);}return _0xceeb58[_0x74fe('0x1f')](_0x37a5ec)[_0x74fe('0x20')]();};}function respondWithResult(_0x50480d,_0x1b252c){_0x1b252c=_0x1b252c||0xc8;return function(_0x3b139a){if(_0x3b139a){return _0x50480d['status'](_0x1b252c)[_0x74fe('0x21')](_0x3b139a);}};}function respondWithFilteredResult(_0x597afd,_0x2fff00){return function(_0x19f12c){if(_0x19f12c){var _0x114356=typeof _0x2fff00['offset']===_0x74fe('0x22')&&typeof _0x2fff00[_0x74fe('0x23')]==='undefined';var _0xd9d79d=_0x19f12c[_0x74fe('0x24')];var _0x3b09af=_0x114356?0x0:_0x2fff00[_0x74fe('0x25')];var _0x23d3fa=_0x114356?_0x19f12c['count']:_0x2fff00[_0x74fe('0x25')]+_0x2fff00[_0x74fe('0x23')];var _0x3f0244;if(_0x23d3fa>=_0xd9d79d){_0x23d3fa=_0xd9d79d;_0x3f0244=0xc8;}else{_0x3f0244=0xce;}_0x597afd[_0x74fe('0x1f')](_0x3f0244);return _0x597afd['set']('Content-Range',_0x3b09af+'-'+_0x23d3fa+'/'+_0xd9d79d)[_0x74fe('0x21')](_0x19f12c);}return null;};}function patchUpdates(_0x4da623){return function(_0x1383ec){try{jsonpatch['apply'](_0x1383ec,_0x4da623,!![]);}catch(_0x5c4e30){return BPromise['reject'](_0x5c4e30);}return _0x1383ec[_0x74fe('0x26')]();};}function saveUpdates(_0x212804,_0x226679){return function(_0x1b5631){if(_0x1b5631){return _0x1b5631['update'](_0x212804)[_0x74fe('0x27')](function(_0x1e4a9a){return _0x1e4a9a;});}return null;};}function removeEntity(_0x304c7a,_0x5f4628){return function(_0x47d37b){if(_0x47d37b){return _0x47d37b[_0x74fe('0x28')]()[_0x74fe('0x27')](function(){var _0x4a6dcd=_0x47d37b[_0x74fe('0x29')]({'plain':!![]});var _0x81e2bf='OpenchannelQueues';return db['UserProfileResource'][_0x74fe('0x28')]({'where':{'type':_0x81e2bf,'resourceId':_0x4a6dcd['id']}})['then'](function(){return _0x47d37b;});})[_0x74fe('0x27')](function(){_0x304c7a[_0x74fe('0x1f')](0xcc)[_0x74fe('0x20')]();});}};}function handleEntityNotFound(_0x37c62b,_0x429b0e){return function(_0x1ae7c8){if(!_0x1ae7c8){_0x37c62b['sendStatus'](0x194);}return _0x1ae7c8;};}function handleError(_0x509f61,_0x280ba0){_0x280ba0=_0x280ba0||0x1f4;return function(_0x2c40c5){logger['error'](_0x2c40c5[_0x74fe('0x2a')]);if(_0x2c40c5['name']){delete _0x2c40c5[_0x74fe('0x2b')];}_0x509f61[_0x74fe('0x1f')](_0x280ba0)['send'](_0x2c40c5);};}exports[_0x74fe('0x2c')]=function(_0x478b37,_0x1b8477){var _0x7a2c17={},_0x26395c={},_0x320fc4={'count':0x0,'rows':[]};var _0x252104=_['map'](db[_0x74fe('0x2d')]['rawAttributes'],function(_0x3d81e9){return{'name':_0x3d81e9[_0x74fe('0x2e')],'type':_0x3d81e9[_0x74fe('0x2f')][_0x74fe('0x30')]};});_0x26395c['model']=_[_0x74fe('0x31')](_0x252104,'name');_0x26395c[_0x74fe('0x32')]=_[_0x74fe('0x33')](_0x478b37['query']);_0x26395c[_0x74fe('0x34')]=_['intersection'](_0x26395c['model'],_0x26395c[_0x74fe('0x32')]);_0x7a2c17[_0x74fe('0x35')]=_[_0x74fe('0x36')](_0x26395c[_0x74fe('0x37')],qs[_0x74fe('0x38')](_0x478b37[_0x74fe('0x32')][_0x74fe('0x38')]));_0x7a2c17[_0x74fe('0x35')]=_0x7a2c17[_0x74fe('0x35')][_0x74fe('0x39')]?_0x7a2c17[_0x74fe('0x35')]:_0x26395c[_0x74fe('0x37')];if(!_0x478b37[_0x74fe('0x32')][_0x74fe('0x3a')](_0x74fe('0x3b'))){_0x7a2c17['limit']=qs['limit'](_0x478b37[_0x74fe('0x32')][_0x74fe('0x23')]);_0x7a2c17[_0x74fe('0x25')]=qs[_0x74fe('0x25')](_0x478b37[_0x74fe('0x32')][_0x74fe('0x25')]);}_0x7a2c17[_0x74fe('0x3c')]=qs[_0x74fe('0x3d')](_0x478b37['query'][_0x74fe('0x3d')]);_0x7a2c17[_0x74fe('0x3e')]=qs[_0x74fe('0x34')](_[_0x74fe('0x3f')](_0x478b37[_0x74fe('0x32')],_0x26395c[_0x74fe('0x34')]),_0x252104);if(_0x478b37[_0x74fe('0x32')][_0x74fe('0x40')]){_0x7a2c17['where']=_[_0x74fe('0x41')](_0x7a2c17[_0x74fe('0x3e')],{'$or':_[_0x74fe('0x31')](_0x252104,function(_0x1741a3){if(_0x1741a3['type']!==_0x74fe('0x42')){var _0x354a92={};_0x354a92[_0x1741a3['name']]={'$like':'%'+_0x478b37[_0x74fe('0x32')][_0x74fe('0x40')]+'%'};return _0x354a92;}})});}_0x7a2c17=_['merge']({},_0x7a2c17,_0x478b37[_0x74fe('0x43')]);var _0x31b7b0={'where':_0x7a2c17[_0x74fe('0x3e')]};return db['OpenchannelQueue'][_0x74fe('0x24')](_0x31b7b0)[_0x74fe('0x27')](function(_0x2db898){_0x320fc4[_0x74fe('0x24')]=_0x2db898;if(_0x478b37[_0x74fe('0x32')]['includeAll']){_0x7a2c17[_0x74fe('0x44')]=[{'all':!![]}];}return db[_0x74fe('0x2d')]['findAll'](_0x7a2c17);})[_0x74fe('0x27')](function(_0x4e027){_0x320fc4[_0x74fe('0x45')]=_0x4e027;return _0x320fc4;})[_0x74fe('0x27')](respondWithFilteredResult(_0x1b8477,_0x7a2c17))[_0x74fe('0x46')](handleError(_0x1b8477,null));};exports['show']=function(_0x59459e,_0x3b2491){var _0x299275={'raw':!![],'where':{'id':_0x59459e[_0x74fe('0x47')]['id']}},_0x12b095={};_0x12b095[_0x74fe('0x37')]=_[_0x74fe('0x33')](db['OpenchannelQueue'][_0x74fe('0x48')]);_0x12b095[_0x74fe('0x32')]=_[_0x74fe('0x33')](_0x59459e['query']);_0x12b095[_0x74fe('0x34')]=_[_0x74fe('0x36')](_0x12b095[_0x74fe('0x37')],_0x12b095[_0x74fe('0x32')]);_0x299275[_0x74fe('0x35')]=_[_0x74fe('0x36')](_0x12b095['model'],qs['fields'](_0x59459e[_0x74fe('0x32')]['fields']));_0x299275[_0x74fe('0x35')]=_0x299275['attributes'][_0x74fe('0x39')]?_0x299275[_0x74fe('0x35')]:_0x12b095[_0x74fe('0x37')];if(_0x59459e[_0x74fe('0x32')][_0x74fe('0x49')]){_0x299275[_0x74fe('0x44')]=[{'all':!![]}];}_0x299275=_['merge']({},_0x299275,_0x59459e[_0x74fe('0x43')]);return db['OpenchannelQueue'][_0x74fe('0x4a')](_0x299275)[_0x74fe('0x27')](handleEntityNotFound(_0x3b2491,null))[_0x74fe('0x27')](respondWithResult(_0x3b2491,null))['catch'](handleError(_0x3b2491,null));};exports[_0x74fe('0x4b')]=function(_0x4cdbbb,_0x356c0d){return db[_0x74fe('0x2d')][_0x74fe('0x4b')](_0x4cdbbb[_0x74fe('0x4c')],{})[_0x74fe('0x27')](function(_0x13ba1e){var _0x290351=_0x4cdbbb[_0x74fe('0x4d')][_0x74fe('0x29')]({'plain':!![]});if(!_0x290351)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x290351[_0x74fe('0x4e')]===_0x74fe('0x4d')){var _0x24b990=_0x13ba1e[_0x74fe('0x29')]({'plain':!![]});var _0x10d90d=_0x74fe('0x4f');return db['UserProfileSection'][_0x74fe('0x4a')]({'where':{'name':_0x10d90d,'userProfileId':_0x290351['userProfileId']},'raw':!![]})[_0x74fe('0x27')](function(_0x294c49){if(_0x294c49&&_0x294c49[_0x74fe('0x50')]===0x0){return db[_0x74fe('0x51')]['create']({'name':_0x24b990['name'],'resourceId':_0x24b990['id'],'type':_0x294c49[_0x74fe('0x2b')],'sectionId':_0x294c49['id']},{})['then'](function(){return _0x13ba1e;});}else{return _0x13ba1e;}})[_0x74fe('0x46')](function(_0x44de8d){logger[_0x74fe('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44de8d);throw _0x44de8d;});}return _0x13ba1e;})[_0x74fe('0x27')](respondWithResult(_0x356c0d,0xc9))['catch'](handleError(_0x356c0d,null));};exports['update']=function(_0x64e450,_0x5ead1b){if(_0x64e450[_0x74fe('0x4c')]['id']){delete _0x64e450[_0x74fe('0x4c')]['id'];}return db[_0x74fe('0x2d')]['find']({'where':{'id':_0x64e450[_0x74fe('0x47')]['id']}})[_0x74fe('0x27')](handleEntityNotFound(_0x5ead1b,null))[_0x74fe('0x27')](saveUpdates(_0x64e450[_0x74fe('0x4c')],null))[_0x74fe('0x27')](respondWithResult(_0x5ead1b,null))['catch'](handleError(_0x5ead1b,null));};exports['destroy']=function(_0xe94322,_0xf784d){return db['OpenchannelQueue'][_0x74fe('0x4a')]({'where':{'id':_0xe94322['params']['id']}})[_0x74fe('0x27')](handleEntityNotFound(_0xf784d,null))['then'](removeEntity(_0xf784d,null))[_0x74fe('0x46')](handleError(_0xf784d,null));};exports[_0x74fe('0x53')]=function(_0x55a6f3,_0x13532b){return db[_0x74fe('0x2d')]['describe']()[_0x74fe('0x27')](respondWithResult(_0x13532b,null))[_0x74fe('0x46')](handleError(_0x13532b,null));};exports[_0x74fe('0x54')]=function(_0x6b8d8c,_0x51a933,_0x39101b){var _0x25bd89={'raw':!![],'where':{}},_0x16b0e5={},_0x45981e;return db['OpenchannelQueue'][_0x74fe('0x55')]({'where':{'id':_0x6b8d8c[_0x74fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x51a933,null))[_0x74fe('0x27')](function(_0x2f5787){if(_0x2f5787){_0x45981e=_0x2f5787[_0x74fe('0x29')]({'plain':!![]});_0x16b0e5['model']=_[_0x74fe('0x33')](db[_0x74fe('0x56')][_0x74fe('0x48')]);_0x16b0e5[_0x74fe('0x32')]=_[_0x74fe('0x33')](_0x6b8d8c[_0x74fe('0x32')]);_0x16b0e5[_0x74fe('0x34')]=_[_0x74fe('0x36')](_0x16b0e5[_0x74fe('0x37')],_0x16b0e5[_0x74fe('0x32')]);_0x25bd89[_0x74fe('0x35')]=_[_0x74fe('0x36')](_0x16b0e5[_0x74fe('0x37')],qs[_0x74fe('0x38')](_0x6b8d8c[_0x74fe('0x32')]['fields']));_0x25bd89['attributes']=_0x25bd89[_0x74fe('0x35')][_0x74fe('0x39')]?_0x25bd89['attributes']:_0x16b0e5[_0x74fe('0x37')];if(!_0x6b8d8c[_0x74fe('0x32')][_0x74fe('0x3a')]('nolimit')){_0x25bd89[_0x74fe('0x23')]=qs[_0x74fe('0x23')](_0x6b8d8c[_0x74fe('0x32')]['limit']);_0x25bd89[_0x74fe('0x25')]=qs['offset'](_0x6b8d8c[_0x74fe('0x32')]['offset']);}_0x25bd89[_0x74fe('0x3c')]=qs[_0x74fe('0x3d')](_0x6b8d8c[_0x74fe('0x32')][_0x74fe('0x3d')]);_0x25bd89[_0x74fe('0x3e')]=qs['filters'](_[_0x74fe('0x3f')](_0x6b8d8c[_0x74fe('0x32')],_0x16b0e5[_0x74fe('0x34')]));_0x25bd89[_0x74fe('0x3e')][_0x74fe('0x57')]=_0x2f5787['id'];if(_0x6b8d8c['query'][_0x74fe('0x40')]){_0x25bd89['where']=_['merge'](_0x25bd89[_0x74fe('0x3e')],{'$or':_['map'](_0x25bd89[_0x74fe('0x35')],function(_0x9f4cd0){var _0x5a3336={};_0x5a3336[_0x9f4cd0]={'$like':'%'+_0x6b8d8c['query']['filter']+'%'};return _0x5a3336;})});}_0x25bd89=_['merge']({},_0x25bd89,_0x6b8d8c[_0x74fe('0x43')]);return db['UserOpenchannelQueue'][_0x74fe('0x58')](_0x25bd89);}})['then'](function(_0x11c4cf){if(_0x11c4cf){return db[_0x74fe('0x59')][_0x74fe('0x5a')]({'where':{'id':_[_0x74fe('0x31')](_0x11c4cf,_0x74fe('0x5b')),'role':_0x74fe('0x5c')},'attributes':['id',_0x74fe('0x2b'),_0x74fe('0x5d'),_0x74fe('0x5e'),'createdAt']});}})[_0x74fe('0x27')](function(_0x54f98b){if(_0x54f98b){return{'count':_0x54f98b[_0x74fe('0x24')],'rows':_['map'](_0x54f98b[_0x74fe('0x45')],function(_0x117a31){return{'membername':_0x117a31['name'],'UserId':_0x117a31['id'],'queue_name':_0x45981e[_0x74fe('0x2b')],'OpenchannelQueueId':_0x45981e['id'],'interface':util['format']('%s/%s',_0x74fe('0x5f'),_0x117a31['name']),'penalty':0x0,'paused':_0x117a31['openchannelPause'],'createdAt':_0x117a31[_0x74fe('0x60')],'updatedAt':_0x117a31[_0x74fe('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x74fe('0x27')](respondWithFilteredResult(_0x51a933,_0x25bd89))['catch'](handleError(_0x51a933,null));};exports[_0x74fe('0x61')]=function(_0x5a28a2,_0x229e96,_0x21615e){var _0x3d2b70={};var _0x49ae61={};var _0x8a7996;var _0xe57ed9;return db[_0x74fe('0x2d')]['findOne']({'where':{'id':_0x5a28a2['params']['id']}})[_0x74fe('0x27')](handleEntityNotFound(_0x229e96,null))[_0x74fe('0x27')](function(_0x3ef06f){if(_0x3ef06f){_0x8a7996=_0x3ef06f;_0x49ae61[_0x74fe('0x37')]=_[_0x74fe('0x33')](db[_0x74fe('0x62')]['rawAttributes']);_0x49ae61['query']=_['keys'](_0x5a28a2[_0x74fe('0x32')]);_0x49ae61['filters']=_['intersection'](_0x49ae61[_0x74fe('0x37')],_0x49ae61[_0x74fe('0x32')]);_0x3d2b70['attributes']=_[_0x74fe('0x36')](_0x49ae61[_0x74fe('0x37')],qs[_0x74fe('0x38')](_0x5a28a2['query'][_0x74fe('0x38')]));_0x3d2b70[_0x74fe('0x35')]=_0x3d2b70[_0x74fe('0x35')][_0x74fe('0x39')]?_0x3d2b70[_0x74fe('0x35')]:_0x49ae61['model'];_0x3d2b70[_0x74fe('0x3c')]=qs[_0x74fe('0x3d')](_0x5a28a2[_0x74fe('0x32')][_0x74fe('0x3d')]);_0x3d2b70[_0x74fe('0x3e')]=qs['filters'](_[_0x74fe('0x3f')](_0x5a28a2[_0x74fe('0x32')],_0x49ae61[_0x74fe('0x34')]));if(_0x5a28a2['query'][_0x74fe('0x40')]){_0x3d2b70['where']=_[_0x74fe('0x41')](_0x3d2b70['where'],{'$or':_[_0x74fe('0x31')](_0x3d2b70['attributes'],function(_0x77f1fc){var _0x5ba871={};_0x5ba871[_0x77f1fc]={'$like':'%'+_0x5a28a2[_0x74fe('0x32')][_0x74fe('0x40')]+'%'};return _0x5ba871;})});}_0x3d2b70=_[_0x74fe('0x41')]({},_0x3d2b70,_0x5a28a2[_0x74fe('0x43')]);return _0x8a7996[_0x74fe('0x61')](_0x3d2b70);}})[_0x74fe('0x27')](function(_0x38ceb2){if(_0x38ceb2){_0xe57ed9=_0x38ceb2[_0x74fe('0x39')];if(!_0x5a28a2['query'][_0x74fe('0x3a')](_0x74fe('0x3b'))){_0x3d2b70[_0x74fe('0x23')]=qs['limit'](_0x5a28a2[_0x74fe('0x32')]['limit']);_0x3d2b70[_0x74fe('0x25')]=qs[_0x74fe('0x25')](_0x5a28a2[_0x74fe('0x32')]['offset']);}return _0x8a7996[_0x74fe('0x61')](_0x3d2b70);}})[_0x74fe('0x27')](function(_0x35401){if(_0x35401){return _0x35401?{'count':_0xe57ed9,'rows':_0x35401}:null;}})[_0x74fe('0x27')](respondWithResult(_0x229e96,null))[_0x74fe('0x46')](handleError(_0x229e96,null));};exports[_0x74fe('0x63')]=function(_0x127f1d,_0x472ef0,_0xdb235a){var _0x1f4551=_0x127f1d['body']['ids'];return db[_0x74fe('0x62')][_0x74fe('0x58')]({'where':{'id':_0x1f4551},'attributes':['id'],'include':[{'model':db[_0x74fe('0x59')],'as':_0x74fe('0x64'),'attributes':['id',_0x74fe('0x2b'),_0x74fe('0x65'),_0x74fe('0x66'),_0x74fe('0x67')],'raw':!![]}]})[_0x74fe('0x27')](function(_0x15c419){if(_0x15c419){var _0x5f3e62=_[_0x74fe('0x68')](_0x15c419,function(_0x2c4c88){var _0x50b6de=_0x2c4c88[_0x74fe('0x29')]({'plain':!![]});return _0x50b6de[_0x74fe('0x64')];});return db[_0x74fe('0x2d')][_0x74fe('0x4a')]({'where':{'id':_0x127f1d[_0x74fe('0x47')]['id']}})[_0x74fe('0x27')](function(_0x4f8821){return db[_0x74fe('0x69')][_0x74fe('0x6a')](function(_0x71f554){return _0x4f8821[_0x74fe('0x63')](_0x1f4551,{'transaction':_0x71f554})[_0x74fe('0x27')](function(){return BPromise[_0x74fe('0x6b')](_0x5f3e62,function(_0x38cbe0){return db['UserOpenchannelQueue'][_0x74fe('0x6c')]({'where':{'UserId':_0x38cbe0['id'],'OpenchannelQueueId':_0x127f1d[_0x74fe('0x47')]['id']},'transaction':_0x71f554});});})['then'](function(){_0x5f3e62[_0x74fe('0x6d')](function(_0x11d5d8){socket[_0x74fe('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x11d5d8['id'],'OpenchannelQueueId':_0x4f8821['id']});});});});});}})[_0x74fe('0x27')](respondWithStatusCode(_0x472ef0,null))[_0x74fe('0x46')](handleError(_0x472ef0,null));};exports['removeTeams']=function(_0x53e394,_0xd4e3ba,_0x1cf7e5){return db[_0x74fe('0x62')][_0x74fe('0x58')]({'where':{'id':_0x53e394['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x74fe('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74fe('0x27')](handleEntityNotFound(_0xd4e3ba,null))[_0x74fe('0x27')](function(_0x487ea9){var _0x43cf02=_[_0x74fe('0x31')](_0x487ea9,'id');var _0x292444=[];var _0x3bd399=[];var _0x270646=squel[_0x74fe('0x6f')]();_0x270646['field'](_0x74fe('0x70'))[_0x74fe('0x71')]('team_has_openchannel_queues','tq')[_0x74fe('0x72')](_0x74fe('0x73'),'ut',_0x74fe('0x74'))[_0x74fe('0x3e')](_0x74fe('0x75'),_0x53e394[_0x74fe('0x47')]['id']);for(var _0x4ca199=0x0;_0x4ca199<_0x487ea9['length'];_0x4ca199+=0x1){let _0x82baa1=_0x487ea9[_0x4ca199];for(var _0x45eb30=0x0;_0x45eb30<_0x82baa1['Agents'][_0x74fe('0x39')];_0x45eb30+=0x1){let _0x5f2daf=_0x82baa1[_0x74fe('0x64')][_0x45eb30];var _0x3c2d40=_0x270646[_0x74fe('0x76')]();_0x3c2d40[_0x74fe('0x3e')]('ut.UserId\x20=\x20?',_0x5f2daf['id']);_0x3bd399[_0x74fe('0x77')](db[_0x74fe('0x69')][_0x74fe('0x32')](_0x3c2d40[_0x74fe('0x78')](),{'type':db[_0x74fe('0x69')][_0x74fe('0x79')]['SELECT']})[_0x74fe('0x27')](function(_0x81bf4c){if(_0x81bf4c[_0x74fe('0x39')]===0x1){return _0x5f2daf['id'];}else{var _0x2f39b0=_[_0x74fe('0x7a')](_[_0x74fe('0x31')](_0x81bf4c,_0x74fe('0x7b')),function(_0x288f5d){return _['includes'](_0x43cf02,_0x288f5d);});if(_0x2f39b0){return _0x5f2daf['id'];}}}));}}return BPromise[_0x74fe('0x7c')](_0x3bd399)['then'](function(_0x54967b){_0x292444=_(_0x292444)[_0x74fe('0x7d')](_0x54967b)[_0x74fe('0x7e')]()[_0x74fe('0x7f')]();return db[_0x74fe('0x2d')][_0x74fe('0x4a')]({'where':{'id':_0x53e394[_0x74fe('0x47')]['id']}})[_0x74fe('0x27')](function(_0x5d6ca0){return db[_0x74fe('0x69')][_0x74fe('0x6a')](function(_0x3db47c){return _0x5d6ca0[_0x74fe('0x80')](_0x53e394[_0x74fe('0x32')][_0x74fe('0x81')],{'transaction':_0x3db47c})[_0x74fe('0x27')](function(){if(!_['isEmpty'](_0x292444)){return _0x5d6ca0[_0x74fe('0x82')](_0x292444,{'transaction':_0x3db47c});}})[_0x74fe('0x27')](function(){_0x292444[_0x74fe('0x6d')](function(_0x5f2a65){socket['emit'](_0x74fe('0x83'),{'UserId':_0x5f2a65,'OpenchannelQueueId':_0x5d6ca0['id']});});});});});});})[_0x74fe('0x27')](respondWithStatusCode(_0xd4e3ba,null))[_0x74fe('0x46')](handleError(_0xd4e3ba,null));};exports[_0x74fe('0x84')]=function(_0x6b5112,_0x5dd8ad,_0x2d2069){return db[_0x74fe('0x2d')][_0x74fe('0x4a')]({'where':{'id':_0x6b5112['params']['id']}})[_0x74fe('0x27')](handleEntityNotFound(_0x5dd8ad,null))[_0x74fe('0x27')](function(_0x1d522b){if(_0x1d522b){return _0x1d522b[_0x74fe('0x84')](_0x6b5112[_0x74fe('0x4c')][_0x74fe('0x81')],_['omit'](_0x6b5112[_0x74fe('0x4c')],[_0x74fe('0x81'),'id'])||{})[_0x74fe('0x85')](function(_0x5677d7){for(var _0x429e3f=0x0;_0x429e3f<_0x6b5112['body'][_0x74fe('0x81')][_0x74fe('0x39')];_0x429e3f+=0x1){socket[_0x74fe('0x6e')](_0x74fe('0x86'),{'UserId':Number(_0x6b5112[_0x74fe('0x4c')]['ids'][_0x429e3f]),'OpenchannelQueueId':Number(_0x6b5112[_0x74fe('0x47')]['id'])});}return _0x5677d7;});}})[_0x74fe('0x27')](respondWithResult(_0x5dd8ad,null))['catch'](handleError(_0x5dd8ad,null));};exports['removeAgents']=function(_0x19d90c,_0x32abbd,_0x34abce){return db[_0x74fe('0x2d')]['find']({'where':{'id':_0x19d90c[_0x74fe('0x47')]['id']}})[_0x74fe('0x27')](handleEntityNotFound(_0x32abbd,null))[_0x74fe('0x27')](function(_0x38d7a8){if(_0x38d7a8){return _0x38d7a8['removeAgents'](_0x19d90c[_0x74fe('0x32')]['ids'])[_0x74fe('0x27')](function(){if(_['isArray'](_0x19d90c[_0x74fe('0x32')][_0x74fe('0x81')])){for(var _0x4c776f=0x0;_0x4c776f<_0x19d90c['query'][_0x74fe('0x81')]['length'];_0x4c776f+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x19d90c[_0x74fe('0x32')][_0x74fe('0x81')][_0x4c776f]),'OpenchannelQueueId':Number(_0x19d90c['params']['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x19d90c[_0x74fe('0x32')][_0x74fe('0x81')]),'OpenchannelQueueId':Number(_0x19d90c['params']['id'])});}});}})[_0x74fe('0x27')](respondWithStatusCode(_0x32abbd,null))[_0x74fe('0x46')](handleError(_0x32abbd,null));};exports['getAgents']=function(_0x577de8,_0x4b3685,_0x416318){var _0x494dd3={};var _0x18242b={};var _0x4b7d4c;var _0x326710;return db['OpenchannelQueue'][_0x74fe('0x55')]({'where':{'id':_0x577de8[_0x74fe('0x47')]['id']}})[_0x74fe('0x27')](handleEntityNotFound(_0x4b3685,null))['then'](function(_0x209e12){if(_0x209e12){_0x4b7d4c=_0x209e12;_0x18242b[_0x74fe('0x37')]=_['keys'](db[_0x74fe('0x59')][_0x74fe('0x48')]);_0x18242b[_0x74fe('0x32')]=_['keys'](_0x577de8[_0x74fe('0x32')]);_0x18242b[_0x74fe('0x34')]=_[_0x74fe('0x36')](_0x18242b['model'],_0x18242b[_0x74fe('0x32')]);_0x494dd3['attributes']=_[_0x74fe('0x36')](_0x18242b[_0x74fe('0x37')],qs[_0x74fe('0x38')](_0x577de8[_0x74fe('0x32')][_0x74fe('0x38')]));_0x494dd3[_0x74fe('0x35')]=_0x494dd3[_0x74fe('0x35')][_0x74fe('0x39')]?_0x494dd3[_0x74fe('0x35')]:_0x18242b['model'];_0x494dd3[_0x74fe('0x3c')]=qs[_0x74fe('0x3d')](_0x577de8[_0x74fe('0x32')][_0x74fe('0x3d')]);_0x494dd3[_0x74fe('0x3e')]=qs['filters'](_[_0x74fe('0x3f')](_0x577de8[_0x74fe('0x32')],_0x18242b[_0x74fe('0x34')]));if(_0x577de8[_0x74fe('0x32')][_0x74fe('0x40')]){_0x494dd3[_0x74fe('0x3e')]=_[_0x74fe('0x41')](_0x494dd3[_0x74fe('0x3e')],{'$or':_[_0x74fe('0x31')](_0x494dd3[_0x74fe('0x35')],function(_0x5014ab){var _0x509d15={};_0x509d15[_0x5014ab]={'$like':'%'+_0x577de8['query']['filter']+'%'};return _0x509d15;})});}_0x494dd3=_[_0x74fe('0x41')]({},_0x494dd3,_0x577de8[_0x74fe('0x43')]);return _0x4b7d4c[_0x74fe('0x87')](_0x494dd3);}})[_0x74fe('0x27')](function(_0xb4e2e9){if(_0xb4e2e9){_0x326710=_0xb4e2e9[_0x74fe('0x39')];if(!_0x577de8[_0x74fe('0x32')][_0x74fe('0x3a')](_0x74fe('0x3b'))){_0x494dd3[_0x74fe('0x23')]=qs[_0x74fe('0x23')](_0x577de8[_0x74fe('0x32')]['limit']);_0x494dd3[_0x74fe('0x25')]=qs[_0x74fe('0x25')](_0x577de8[_0x74fe('0x32')][_0x74fe('0x25')]);}return _0x4b7d4c[_0x74fe('0x87')](_0x494dd3);}})['then'](function(_0x162af5){if(_0x162af5){return _0x162af5?{'count':_0x326710,'rows':_0x162af5}:null;}})[_0x74fe('0x27')](respondWithResult(_0x4b3685,null))[_0x74fe('0x46')](handleError(_0x4b3685,null));}; \ No newline at end of file +var _0xdbcb=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','OpenchannelQueues','sendStatus','error','stack','name','index','OpenchannelQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','update','describe','findOne','UserOpenchannelQueue','sort','OpenchannelQueueId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','interface','flatMap','transaction','forEach','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.UserId\x20=\x20?','sequelize','QueryTypes','includes','all','union','compact','value','removeTeams','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv'];(function(_0x501821,_0x4f395a){var _0x37ad9c=function(_0x200f94){while(--_0x200f94){_0x501821['push'](_0x501821['shift']());}};_0x37ad9c(++_0x4f395a);}(_0xdbcb,0x178));var _0xbdbc=function(_0x1eb4e0,_0x4ebc2d){_0x1eb4e0=_0x1eb4e0-0x0;var _0x18ec21=_0xdbcb[_0x1eb4e0];return _0x18ec21;};'use strict';var emlformat=require(_0xbdbc('0x0'));var rimraf=require(_0xbdbc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdbc('0x2'));var rp=require(_0xbdbc('0x3'));var moment=require('moment');var BPromise=require(_0xbdbc('0x4'));var Mustache=require(_0xbdbc('0x5'));var util=require(_0xbdbc('0x6'));var path=require(_0xbdbc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbdbc('0x8'));var fs=require('fs');var fs_extra=require(_0xbdbc('0x9'));var _=require(_0xbdbc('0xa'));var squel=require('squel');var crypto=require(_0xbdbc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbdbc('0xc'));var toCsv=require(_0xbdbc('0xd'));var querystring=require('querystring');var Papa=require(_0xbdbc('0xe'));var Redis=require(_0xbdbc('0xf'));var authService=require(_0xbdbc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbdbc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbdbc('0x12'))('api');var utils=require(_0xbdbc('0x13'));var config=require(_0xbdbc('0x14'));var licenseUtil=require(_0xbdbc('0x15'));var db=require('../../mysqldb')['db'];config[_0xbdbc('0x16')]=_['defaults'](config[_0xbdbc('0x16')],{'host':_0xbdbc('0x17'),'port':0x18eb});var socket=require(_0xbdbc('0x18'))(new Redis(config[_0xbdbc('0x16')]));require(_0xbdbc('0x19'))[_0xbdbc('0x1a')](socket);function respondWithStatusCode(_0x3f4f30,_0x348c68){_0x348c68=_0x348c68||0xcc;return function(_0x4faab2){if(_0x4faab2){return _0x3f4f30['sendStatus'](_0x348c68);}return _0x3f4f30[_0xbdbc('0x1b')](_0x348c68)[_0xbdbc('0x1c')]();};}function respondWithResult(_0x23fe0f,_0x4050d7){_0x4050d7=_0x4050d7||0xc8;return function(_0x441f51){if(_0x441f51){return _0x23fe0f[_0xbdbc('0x1b')](_0x4050d7)['json'](_0x441f51);}};}function respondWithFilteredResult(_0x46575a,_0x3df3b8){return function(_0x19f36e){if(_0x19f36e){var _0x91502c=typeof _0x3df3b8[_0xbdbc('0x1d')]===_0xbdbc('0x1e')&&typeof _0x3df3b8[_0xbdbc('0x1f')]===_0xbdbc('0x1e');var _0x2cbad8=_0x19f36e[_0xbdbc('0x20')];var _0x565e3d=_0x91502c?0x0:_0x3df3b8[_0xbdbc('0x1d')];var _0x328086=_0x91502c?_0x19f36e[_0xbdbc('0x20')]:_0x3df3b8[_0xbdbc('0x1d')]+_0x3df3b8[_0xbdbc('0x1f')];var _0x297f6f;if(_0x328086>=_0x2cbad8){_0x328086=_0x2cbad8;_0x297f6f=0xc8;}else{_0x297f6f=0xce;}_0x46575a[_0xbdbc('0x1b')](_0x297f6f);return _0x46575a[_0xbdbc('0x21')]('Content-Range',_0x565e3d+'-'+_0x328086+'/'+_0x2cbad8)[_0xbdbc('0x22')](_0x19f36e);}return null;};}function patchUpdates(_0x239cc4){return function(_0x51d192){try{jsonpatch[_0xbdbc('0x23')](_0x51d192,_0x239cc4,!![]);}catch(_0x3b2bb2){return BPromise[_0xbdbc('0x24')](_0x3b2bb2);}return _0x51d192['save']();};}function saveUpdates(_0x42ddee,_0x29ddfc){return function(_0x42b490){if(_0x42b490){return _0x42b490['update'](_0x42ddee)[_0xbdbc('0x25')](function(_0x135376){return _0x135376;});}return null;};}function removeEntity(_0x19973e,_0x48f69f){return function(_0x23bba5){if(_0x23bba5){return _0x23bba5[_0xbdbc('0x26')]()['then'](function(){var _0x581025=_0x23bba5['get']({'plain':!![]});var _0x409e9f=_0xbdbc('0x27');return db['UserProfileResource'][_0xbdbc('0x26')]({'where':{'type':_0x409e9f,'resourceId':_0x581025['id']}})['then'](function(){return _0x23bba5;});})[_0xbdbc('0x25')](function(){_0x19973e[_0xbdbc('0x1b')](0xcc)[_0xbdbc('0x1c')]();});}};}function handleEntityNotFound(_0x15d6a6,_0x158377){return function(_0x382910){if(!_0x382910){_0x15d6a6[_0xbdbc('0x28')](0x194);}return _0x382910;};}function handleError(_0x55e937,_0x16bf0a){_0x16bf0a=_0x16bf0a||0x1f4;return function(_0xa0fb79){logger[_0xbdbc('0x29')](_0xa0fb79[_0xbdbc('0x2a')]);if(_0xa0fb79[_0xbdbc('0x2b')]){delete _0xa0fb79[_0xbdbc('0x2b')];}_0x55e937['status'](_0x16bf0a)['send'](_0xa0fb79);};}exports[_0xbdbc('0x2c')]=function(_0x316aea,_0x2c7e15){var _0x3b5d85={},_0x1d7373={},_0x547f11={'count':0x0,'rows':[]};var _0x431d98=_['map'](db[_0xbdbc('0x2d')][_0xbdbc('0x2e')],function(_0x37dd0d){return{'name':_0x37dd0d[_0xbdbc('0x2f')],'type':_0x37dd0d['type'][_0xbdbc('0x30')]};});_0x1d7373[_0xbdbc('0x31')]=_[_0xbdbc('0x32')](_0x431d98,_0xbdbc('0x2b'));_0x1d7373[_0xbdbc('0x33')]=_[_0xbdbc('0x34')](_0x316aea[_0xbdbc('0x33')]);_0x1d7373['filters']=_['intersection'](_0x1d7373['model'],_0x1d7373['query']);_0x3b5d85['attributes']=_[_0xbdbc('0x35')](_0x1d7373[_0xbdbc('0x31')],qs[_0xbdbc('0x36')](_0x316aea[_0xbdbc('0x33')][_0xbdbc('0x36')]));_0x3b5d85[_0xbdbc('0x37')]=_0x3b5d85[_0xbdbc('0x37')][_0xbdbc('0x38')]?_0x3b5d85[_0xbdbc('0x37')]:_0x1d7373[_0xbdbc('0x31')];if(!_0x316aea[_0xbdbc('0x33')][_0xbdbc('0x39')](_0xbdbc('0x3a'))){_0x3b5d85[_0xbdbc('0x1f')]=qs['limit'](_0x316aea[_0xbdbc('0x33')]['limit']);_0x3b5d85['offset']=qs[_0xbdbc('0x1d')](_0x316aea[_0xbdbc('0x33')][_0xbdbc('0x1d')]);}_0x3b5d85[_0xbdbc('0x3b')]=qs['sort'](_0x316aea[_0xbdbc('0x33')]['sort']);_0x3b5d85['where']=qs[_0xbdbc('0x3c')](_[_0xbdbc('0x3d')](_0x316aea[_0xbdbc('0x33')],_0x1d7373[_0xbdbc('0x3c')]),_0x431d98);if(_0x316aea['query'][_0xbdbc('0x3e')]){_0x3b5d85[_0xbdbc('0x3f')]=_['merge'](_0x3b5d85[_0xbdbc('0x3f')],{'$or':_[_0xbdbc('0x32')](_0x431d98,function(_0x5953d4){if(_0x5953d4[_0xbdbc('0x40')]!==_0xbdbc('0x41')){var _0x24525a={};_0x24525a[_0x5953d4[_0xbdbc('0x2b')]]={'$like':'%'+_0x316aea['query']['filter']+'%'};return _0x24525a;}})});}_0x3b5d85=_['merge']({},_0x3b5d85,_0x316aea[_0xbdbc('0x42')]);var _0x6933df={'where':_0x3b5d85['where']};return db[_0xbdbc('0x2d')]['count'](_0x6933df)[_0xbdbc('0x25')](function(_0x5c851e){_0x547f11['count']=_0x5c851e;if(_0x316aea[_0xbdbc('0x33')][_0xbdbc('0x43')]){_0x3b5d85['include']=[{'all':!![]}];}return db[_0xbdbc('0x2d')][_0xbdbc('0x44')](_0x3b5d85);})[_0xbdbc('0x25')](function(_0x443cff){_0x547f11[_0xbdbc('0x45')]=_0x443cff;return _0x547f11;})[_0xbdbc('0x25')](respondWithFilteredResult(_0x2c7e15,_0x3b5d85))[_0xbdbc('0x46')](handleError(_0x2c7e15,null));};exports[_0xbdbc('0x47')]=function(_0x13d95b,_0x2715a0){var _0x3c91eb={'raw':!![],'where':{'id':_0x13d95b[_0xbdbc('0x48')]['id']}},_0x447260={};_0x447260[_0xbdbc('0x31')]=_['keys'](db[_0xbdbc('0x2d')]['rawAttributes']);_0x447260[_0xbdbc('0x33')]=_[_0xbdbc('0x34')](_0x13d95b['query']);_0x447260[_0xbdbc('0x3c')]=_['intersection'](_0x447260['model'],_0x447260[_0xbdbc('0x33')]);_0x3c91eb[_0xbdbc('0x37')]=_[_0xbdbc('0x35')](_0x447260[_0xbdbc('0x31')],qs[_0xbdbc('0x36')](_0x13d95b[_0xbdbc('0x33')]['fields']));_0x3c91eb[_0xbdbc('0x37')]=_0x3c91eb[_0xbdbc('0x37')]['length']?_0x3c91eb[_0xbdbc('0x37')]:_0x447260[_0xbdbc('0x31')];if(_0x13d95b[_0xbdbc('0x33')]['includeAll']){_0x3c91eb[_0xbdbc('0x49')]=[{'all':!![]}];}_0x3c91eb=_[_0xbdbc('0x4a')]({},_0x3c91eb,_0x13d95b['options']);return db[_0xbdbc('0x2d')][_0xbdbc('0x4b')](_0x3c91eb)['then'](handleEntityNotFound(_0x2715a0,null))[_0xbdbc('0x25')](respondWithResult(_0x2715a0,null))[_0xbdbc('0x46')](handleError(_0x2715a0,null));};exports[_0xbdbc('0x4c')]=function(_0x251e3f,_0x47d39f){return db[_0xbdbc('0x2d')][_0xbdbc('0x4c')](_0x251e3f[_0xbdbc('0x4d')],{})[_0xbdbc('0x25')](function(_0x5cf9a4){var _0xc7d22b=_0x251e3f['user'][_0xbdbc('0x4e')]({'plain':!![]});if(!_0xc7d22b)throw new Error(_0xbdbc('0x4f'));if(_0xc7d22b[_0xbdbc('0x50')]===_0xbdbc('0x51')){var _0x59d2d3=_0x5cf9a4[_0xbdbc('0x4e')]({'plain':!![]});var _0x1a30ea=_0xbdbc('0x27');return db[_0xbdbc('0x52')][_0xbdbc('0x4b')]({'where':{'name':_0x1a30ea,'userProfileId':_0xc7d22b[_0xbdbc('0x53')]},'raw':!![]})[_0xbdbc('0x25')](function(_0x58e014){if(_0x58e014&&_0x58e014['autoAssociation']===0x0){return db[_0xbdbc('0x54')][_0xbdbc('0x4c')]({'name':_0x59d2d3['name'],'resourceId':_0x59d2d3['id'],'type':_0x58e014[_0xbdbc('0x2b')],'sectionId':_0x58e014['id']},{})['then'](function(){return _0x5cf9a4;});}else{return _0x5cf9a4;}})[_0xbdbc('0x46')](function(_0x1c2117){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2117);throw _0x1c2117;});}return _0x5cf9a4;})['then'](respondWithResult(_0x47d39f,0xc9))[_0xbdbc('0x46')](handleError(_0x47d39f,null));};exports[_0xbdbc('0x55')]=function(_0x236348,_0x3cf7e8){if(_0x236348[_0xbdbc('0x4d')]['id']){delete _0x236348[_0xbdbc('0x4d')]['id'];}return db['OpenchannelQueue'][_0xbdbc('0x4b')]({'where':{'id':_0x236348[_0xbdbc('0x48')]['id']}})[_0xbdbc('0x25')](handleEntityNotFound(_0x3cf7e8,null))[_0xbdbc('0x25')](saveUpdates(_0x236348[_0xbdbc('0x4d')],null))['then'](respondWithResult(_0x3cf7e8,null))[_0xbdbc('0x46')](handleError(_0x3cf7e8,null));};exports[_0xbdbc('0x26')]=function(_0x541c70,_0x3e5aef){return db[_0xbdbc('0x2d')][_0xbdbc('0x4b')]({'where':{'id':_0x541c70['params']['id']}})[_0xbdbc('0x25')](handleEntityNotFound(_0x3e5aef,null))[_0xbdbc('0x25')](removeEntity(_0x3e5aef,null))[_0xbdbc('0x46')](handleError(_0x3e5aef,null));};exports[_0xbdbc('0x56')]=function(_0xc872f5,_0x26a0bd){return db[_0xbdbc('0x2d')][_0xbdbc('0x56')]()[_0xbdbc('0x25')](respondWithResult(_0x26a0bd,null))[_0xbdbc('0x46')](handleError(_0x26a0bd,null));};exports['getMembers']=function(_0x233f16,_0x476283,_0x3a2363){var _0x314beb={'raw':!![],'where':{}},_0x249e95={},_0x31eae5;return db[_0xbdbc('0x2d')][_0xbdbc('0x57')]({'where':{'id':_0x233f16['params']['id']}})['then'](handleEntityNotFound(_0x476283,null))[_0xbdbc('0x25')](function(_0x1d1e8d){if(_0x1d1e8d){_0x31eae5=_0x1d1e8d[_0xbdbc('0x4e')]({'plain':!![]});_0x249e95['model']=_[_0xbdbc('0x34')](db[_0xbdbc('0x58')][_0xbdbc('0x2e')]);_0x249e95['query']=_[_0xbdbc('0x34')](_0x233f16[_0xbdbc('0x33')]);_0x249e95[_0xbdbc('0x3c')]=_[_0xbdbc('0x35')](_0x249e95['model'],_0x249e95[_0xbdbc('0x33')]);_0x314beb[_0xbdbc('0x37')]=_[_0xbdbc('0x35')](_0x249e95['model'],qs[_0xbdbc('0x36')](_0x233f16[_0xbdbc('0x33')][_0xbdbc('0x36')]));_0x314beb[_0xbdbc('0x37')]=_0x314beb[_0xbdbc('0x37')][_0xbdbc('0x38')]?_0x314beb[_0xbdbc('0x37')]:_0x249e95[_0xbdbc('0x31')];if(!_0x233f16['query'][_0xbdbc('0x39')](_0xbdbc('0x3a'))){_0x314beb[_0xbdbc('0x1f')]=qs[_0xbdbc('0x1f')](_0x233f16[_0xbdbc('0x33')]['limit']);_0x314beb[_0xbdbc('0x1d')]=qs[_0xbdbc('0x1d')](_0x233f16[_0xbdbc('0x33')][_0xbdbc('0x1d')]);}_0x314beb[_0xbdbc('0x3b')]=qs[_0xbdbc('0x59')](_0x233f16[_0xbdbc('0x33')][_0xbdbc('0x59')]);_0x314beb[_0xbdbc('0x3f')]=qs['filters'](_[_0xbdbc('0x3d')](_0x233f16[_0xbdbc('0x33')],_0x249e95['filters']));_0x314beb[_0xbdbc('0x3f')][_0xbdbc('0x5a')]=_0x1d1e8d['id'];if(_0x233f16[_0xbdbc('0x33')][_0xbdbc('0x3e')]){_0x314beb[_0xbdbc('0x3f')]=_[_0xbdbc('0x4a')](_0x314beb[_0xbdbc('0x3f')],{'$or':_['map'](_0x314beb['attributes'],function(_0x16e7d4){var _0x206186={};_0x206186[_0x16e7d4]={'$like':'%'+_0x233f16['query']['filter']+'%'};return _0x206186;})});}_0x314beb=_[_0xbdbc('0x4a')]({},_0x314beb,_0x233f16['options']);return db[_0xbdbc('0x58')][_0xbdbc('0x44')](_0x314beb);}})['then'](function(_0x5eea6e){if(_0x5eea6e){return db['User']['findAndCountAll']({'where':{'id':_[_0xbdbc('0x32')](_0x5eea6e,'UserId'),'role':_0xbdbc('0x5b')},'attributes':['id',_0xbdbc('0x2b'),_0xbdbc('0x5c'),_0xbdbc('0x5d'),_0xbdbc('0x5e')]});}})[_0xbdbc('0x25')](function(_0x11da54){if(_0x11da54){return{'count':_0x11da54[_0xbdbc('0x20')],'rows':_[_0xbdbc('0x32')](_0x11da54['rows'],function(_0x4ffc38){return{'membername':_0x4ffc38['name'],'UserId':_0x4ffc38['id'],'queue_name':_0x31eae5[_0xbdbc('0x2b')],'OpenchannelQueueId':_0x31eae5['id'],'interface':util['format'](_0xbdbc('0x5f'),_0xbdbc('0x60'),_0x4ffc38['name']),'penalty':0x0,'paused':_0x4ffc38['openchannelPause'],'createdAt':_0x4ffc38['createdAt'],'updatedAt':_0x4ffc38[_0xbdbc('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbdbc('0x25')](respondWithFilteredResult(_0x476283,_0x314beb))[_0xbdbc('0x46')](handleError(_0x476283,null));};exports['getTeams']=function(_0x2969d8,_0x40f580,_0x1018ad){var _0x57a137={};var _0x384022={};var _0x4165ff;var _0x357a2c;return db[_0xbdbc('0x2d')][_0xbdbc('0x57')]({'where':{'id':_0x2969d8[_0xbdbc('0x48')]['id']}})[_0xbdbc('0x25')](handleEntityNotFound(_0x40f580,null))['then'](function(_0x31e81c){if(_0x31e81c){_0x4165ff=_0x31e81c;_0x384022[_0xbdbc('0x31')]=_[_0xbdbc('0x34')](db[_0xbdbc('0x61')][_0xbdbc('0x2e')]);_0x384022[_0xbdbc('0x33')]=_[_0xbdbc('0x34')](_0x2969d8[_0xbdbc('0x33')]);_0x384022[_0xbdbc('0x3c')]=_[_0xbdbc('0x35')](_0x384022['model'],_0x384022[_0xbdbc('0x33')]);_0x57a137['attributes']=_[_0xbdbc('0x35')](_0x384022[_0xbdbc('0x31')],qs['fields'](_0x2969d8[_0xbdbc('0x33')][_0xbdbc('0x36')]));_0x57a137[_0xbdbc('0x37')]=_0x57a137['attributes'][_0xbdbc('0x38')]?_0x57a137[_0xbdbc('0x37')]:_0x384022[_0xbdbc('0x31')];_0x57a137['order']=qs['sort'](_0x2969d8[_0xbdbc('0x33')][_0xbdbc('0x59')]);_0x57a137[_0xbdbc('0x3f')]=qs[_0xbdbc('0x3c')](_[_0xbdbc('0x3d')](_0x2969d8[_0xbdbc('0x33')],_0x384022[_0xbdbc('0x3c')]));if(_0x2969d8[_0xbdbc('0x33')][_0xbdbc('0x3e')]){_0x57a137[_0xbdbc('0x3f')]=_[_0xbdbc('0x4a')](_0x57a137[_0xbdbc('0x3f')],{'$or':_['map'](_0x57a137['attributes'],function(_0x2aef35){var _0x450c39={};_0x450c39[_0x2aef35]={'$like':'%'+_0x2969d8[_0xbdbc('0x33')][_0xbdbc('0x3e')]+'%'};return _0x450c39;})});}_0x57a137=_[_0xbdbc('0x4a')]({},_0x57a137,_0x2969d8[_0xbdbc('0x42')]);return _0x4165ff[_0xbdbc('0x62')](_0x57a137);}})[_0xbdbc('0x25')](function(_0x2e268f){if(_0x2e268f){_0x357a2c=_0x2e268f['length'];if(!_0x2969d8[_0xbdbc('0x33')][_0xbdbc('0x39')](_0xbdbc('0x3a'))){_0x57a137['limit']=qs[_0xbdbc('0x1f')](_0x2969d8['query'][_0xbdbc('0x1f')]);_0x57a137['offset']=qs['offset'](_0x2969d8[_0xbdbc('0x33')][_0xbdbc('0x1d')]);}return _0x4165ff[_0xbdbc('0x62')](_0x57a137);}})[_0xbdbc('0x25')](function(_0x3ce2b0){if(_0x3ce2b0){return _0x3ce2b0?{'count':_0x357a2c,'rows':_0x3ce2b0}:null;}})[_0xbdbc('0x25')](respondWithResult(_0x40f580,null))[_0xbdbc('0x46')](handleError(_0x40f580,null));};exports[_0xbdbc('0x63')]=function(_0x5be312,_0x5679f5,_0x5e31ac){var _0x57b0e5=_0x5be312[_0xbdbc('0x4d')][_0xbdbc('0x64')];return db[_0xbdbc('0x61')][_0xbdbc('0x44')]({'where':{'id':_0x57b0e5},'attributes':['id'],'include':[{'model':db[_0xbdbc('0x65')],'as':_0xbdbc('0x66'),'attributes':['id','name','online','voicePause',_0xbdbc('0x67')],'raw':!![]}]})[_0xbdbc('0x25')](function(_0x33ca76){if(_0x33ca76){var _0x2300a3=_[_0xbdbc('0x68')](_0x33ca76,function(_0x468864){var _0x511fc5=_0x468864[_0xbdbc('0x4e')]({'plain':!![]});return _0x511fc5[_0xbdbc('0x66')];});return db[_0xbdbc('0x2d')][_0xbdbc('0x4b')]({'where':{'id':_0x5be312['params']['id']}})[_0xbdbc('0x25')](function(_0x50efb3){return db['sequelize'][_0xbdbc('0x69')](function(_0x46c61c){return _0x50efb3[_0xbdbc('0x63')](_0x57b0e5,{'transaction':_0x46c61c})[_0xbdbc('0x25')](function(){return BPromise['each'](_0x2300a3,function(_0xf5bc77){return db[_0xbdbc('0x58')]['findOrCreate']({'where':{'UserId':_0xf5bc77['id'],'OpenchannelQueueId':_0x5be312[_0xbdbc('0x48')]['id']},'transaction':_0x46c61c});});})[_0xbdbc('0x25')](function(){_0x2300a3[_0xbdbc('0x6a')](function(_0x416a8d){socket[_0xbdbc('0x6b')](_0xbdbc('0x6c'),{'UserId':_0x416a8d['id'],'OpenchannelQueueId':_0x50efb3['id']});});});});});}})[_0xbdbc('0x25')](respondWithStatusCode(_0x5679f5,null))['catch'](handleError(_0x5679f5,null));};exports['removeTeams']=function(_0x35cefc,_0x400e6e,_0x468a47){return db[_0xbdbc('0x61')][_0xbdbc('0x44')]({'where':{'id':_0x35cefc['query'][_0xbdbc('0x64')]},'attributes':['id'],'include':[{'model':db[_0xbdbc('0x65')],'as':_0xbdbc('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x400e6e,null))['then'](function(_0x5f3333){var _0x42c49f=_['map'](_0x5f3333,'id');var _0x4ed587=[];var _0x2e94b3=[];var _0x3ce5bb=squel[_0xbdbc('0x6d')]();_0x3ce5bb['field'](_0xbdbc('0x6e'))[_0xbdbc('0x6f')](_0xbdbc('0x70'),'tq')[_0xbdbc('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbdbc('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x35cefc[_0xbdbc('0x48')]['id']);for(var _0x8e80f2=0x0;_0x8e80f2<_0x5f3333[_0xbdbc('0x38')];_0x8e80f2+=0x1){let _0x19be13=_0x5f3333[_0x8e80f2];for(var _0x6da35d=0x0;_0x6da35d<_0x19be13['Agents']['length'];_0x6da35d+=0x1){let _0x35beaa=_0x19be13[_0xbdbc('0x66')][_0x6da35d];var _0x3ae460=_0x3ce5bb['clone']();_0x3ae460[_0xbdbc('0x3f')](_0xbdbc('0x72'),_0x35beaa['id']);_0x2e94b3['push'](db['sequelize']['query'](_0x3ae460['toString'](),{'type':db[_0xbdbc('0x73')][_0xbdbc('0x74')]['SELECT']})[_0xbdbc('0x25')](function(_0x2de80e){if(_0x2de80e[_0xbdbc('0x38')]===0x1){return _0x35beaa['id'];}else{var _0xe5a604=_['every'](_['map'](_0x2de80e,'TeamId'),function(_0x32a862){return _[_0xbdbc('0x75')](_0x42c49f,_0x32a862);});if(_0xe5a604){return _0x35beaa['id'];}}}));}}return BPromise[_0xbdbc('0x76')](_0x2e94b3)[_0xbdbc('0x25')](function(_0x3ba6f5){_0x4ed587=_(_0x4ed587)[_0xbdbc('0x77')](_0x3ba6f5)[_0xbdbc('0x78')]()[_0xbdbc('0x79')]();return db['OpenchannelQueue'][_0xbdbc('0x4b')]({'where':{'id':_0x35cefc['params']['id']}})[_0xbdbc('0x25')](function(_0x534c1b){return db[_0xbdbc('0x73')][_0xbdbc('0x69')](function(_0x242fba){return _0x534c1b[_0xbdbc('0x7a')](_0x35cefc['query'][_0xbdbc('0x64')],{'transaction':_0x242fba})[_0xbdbc('0x25')](function(){if(!_['isEmpty'](_0x4ed587)){return _0x534c1b[_0xbdbc('0x7b')](_0x4ed587,{'transaction':_0x242fba});}})[_0xbdbc('0x25')](function(){_0x4ed587[_0xbdbc('0x6a')](function(_0x146761){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x146761,'OpenchannelQueueId':_0x534c1b['id']});});});});});});})[_0xbdbc('0x25')](respondWithStatusCode(_0x400e6e,null))['catch'](handleError(_0x400e6e,null));};exports[_0xbdbc('0x7c')]=function(_0x158cd8,_0x6d4a00,_0x16474f){return db[_0xbdbc('0x2d')][_0xbdbc('0x4b')]({'where':{'id':_0x158cd8[_0xbdbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x6d4a00,null))['then'](function(_0x3641a8){if(_0x3641a8){return _0x3641a8[_0xbdbc('0x7c')](_0x158cd8[_0xbdbc('0x4d')]['ids'],_[_0xbdbc('0x7d')](_0x158cd8['body'],[_0xbdbc('0x64'),'id'])||{})[_0xbdbc('0x7e')](function(_0x12a5a1){for(var _0x22111e=0x0;_0x22111e<_0x158cd8[_0xbdbc('0x4d')][_0xbdbc('0x64')][_0xbdbc('0x38')];_0x22111e+=0x1){socket[_0xbdbc('0x6b')]('userOpenchannelQueue:save',{'UserId':Number(_0x158cd8['body']['ids'][_0x22111e]),'OpenchannelQueueId':Number(_0x158cd8[_0xbdbc('0x48')]['id'])});}return _0x12a5a1;});}})[_0xbdbc('0x25')](respondWithResult(_0x6d4a00,null))['catch'](handleError(_0x6d4a00,null));};exports['removeAgents']=function(_0x196b64,_0x4166d4,_0x4cbf61){return db[_0xbdbc('0x2d')][_0xbdbc('0x4b')]({'where':{'id':_0x196b64[_0xbdbc('0x48')]['id']}})[_0xbdbc('0x25')](handleEntityNotFound(_0x4166d4,null))[_0xbdbc('0x25')](function(_0x2b6b7a){if(_0x2b6b7a){return _0x2b6b7a[_0xbdbc('0x7b')](_0x196b64[_0xbdbc('0x33')][_0xbdbc('0x64')])[_0xbdbc('0x25')](function(){if(_[_0xbdbc('0x7f')](_0x196b64[_0xbdbc('0x33')]['ids'])){for(var _0x13b04d=0x0;_0x13b04d<_0x196b64[_0xbdbc('0x33')]['ids']['length'];_0x13b04d+=0x1){socket['emit'](_0xbdbc('0x80'),{'UserId':Number(_0x196b64[_0xbdbc('0x33')]['ids'][_0x13b04d]),'OpenchannelQueueId':Number(_0x196b64[_0xbdbc('0x48')]['id'])});}}else{socket[_0xbdbc('0x6b')](_0xbdbc('0x80'),{'UserId':Number(_0x196b64[_0xbdbc('0x33')][_0xbdbc('0x64')]),'OpenchannelQueueId':Number(_0x196b64[_0xbdbc('0x48')]['id'])});}});}})[_0xbdbc('0x25')](respondWithStatusCode(_0x4166d4,null))[_0xbdbc('0x46')](handleError(_0x4166d4,null));};exports[_0xbdbc('0x81')]=function(_0x1b64a4,_0x5497fa,_0x357d94){var _0x10826a={};var _0x483c71={};var _0x433774;var _0x142b18;return db[_0xbdbc('0x2d')][_0xbdbc('0x57')]({'where':{'id':_0x1b64a4[_0xbdbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x5497fa,null))[_0xbdbc('0x25')](function(_0x11b479){if(_0x11b479){_0x433774=_0x11b479;_0x483c71['model']=_[_0xbdbc('0x34')](db[_0xbdbc('0x65')][_0xbdbc('0x2e')]);_0x483c71[_0xbdbc('0x33')]=_['keys'](_0x1b64a4[_0xbdbc('0x33')]);_0x483c71[_0xbdbc('0x3c')]=_['intersection'](_0x483c71[_0xbdbc('0x31')],_0x483c71[_0xbdbc('0x33')]);_0x10826a[_0xbdbc('0x37')]=_[_0xbdbc('0x35')](_0x483c71[_0xbdbc('0x31')],qs[_0xbdbc('0x36')](_0x1b64a4[_0xbdbc('0x33')][_0xbdbc('0x36')]));_0x10826a[_0xbdbc('0x37')]=_0x10826a[_0xbdbc('0x37')][_0xbdbc('0x38')]?_0x10826a[_0xbdbc('0x37')]:_0x483c71[_0xbdbc('0x31')];_0x10826a[_0xbdbc('0x3b')]=qs[_0xbdbc('0x59')](_0x1b64a4['query']['sort']);_0x10826a[_0xbdbc('0x3f')]=qs['filters'](_['pick'](_0x1b64a4[_0xbdbc('0x33')],_0x483c71['filters']));if(_0x1b64a4['query'][_0xbdbc('0x3e')]){_0x10826a['where']=_[_0xbdbc('0x4a')](_0x10826a[_0xbdbc('0x3f')],{'$or':_[_0xbdbc('0x32')](_0x10826a[_0xbdbc('0x37')],function(_0x5c04b4){var _0x4edccd={};_0x4edccd[_0x5c04b4]={'$like':'%'+_0x1b64a4[_0xbdbc('0x33')][_0xbdbc('0x3e')]+'%'};return _0x4edccd;})});}_0x10826a=_['merge']({},_0x10826a,_0x1b64a4[_0xbdbc('0x42')]);return _0x433774[_0xbdbc('0x81')](_0x10826a);}})[_0xbdbc('0x25')](function(_0x2268c5){if(_0x2268c5){_0x142b18=_0x2268c5['length'];if(!_0x1b64a4['query'][_0xbdbc('0x39')](_0xbdbc('0x3a'))){_0x10826a['limit']=qs['limit'](_0x1b64a4['query'][_0xbdbc('0x1f')]);_0x10826a['offset']=qs[_0xbdbc('0x1d')](_0x1b64a4['query'][_0xbdbc('0x1d')]);}return _0x433774[_0xbdbc('0x81')](_0x10826a);}})[_0xbdbc('0x25')](function(_0x1baaf7){if(_0x1baaf7){return _0x1baaf7?{'count':_0x142b18,'rows':_0x1baaf7}:null;}})[_0xbdbc('0x25')](respondWithResult(_0x5497fa,null))[_0xbdbc('0x46')](handleError(_0x5497fa,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f595855..a423b0b 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 _0x4114=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','OpenchannelQueue'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x4114,0x16f));var _0x4411=function(_0x1c413e,_0x51788b){_0x1c413e=_0x1c413e-0x0;var _0x1d8309=_0x4114[_0x1c413e];return _0x1d8309;};'use strict';var EventEmitter=require(_0x4411('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4411('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4411('0x2')](0x0);var events={'afterCreate':_0x4411('0x3'),'afterUpdate':_0x4411('0x4'),'afterDestroy':_0x4411('0x5')};function emitEvent(_0x54b0ca){return function(_0x584a2c,_0x5e5935,_0x5df121){OpenchannelQueueEvents[_0x4411('0x6')](_0x54b0ca+':'+_0x584a2c['id'],_0x584a2c);OpenchannelQueueEvents[_0x4411('0x6')](_0x54b0ca,_0x584a2c);_0x5df121(null);};}for(var e in events){if(events[_0x4411('0x7')](e)){var event=events[e];OpenchannelQueue[_0x4411('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x9364=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x19d12b,_0x5a2e45){var _0x7a4a27=function(_0x223495){while(--_0x223495){_0x19d12b['push'](_0x19d12b['shift']());}};_0x7a4a27(++_0x5a2e45);}(_0x9364,0x19b));var _0x4936=function(_0x16dba9,_0x138570){_0x16dba9=_0x16dba9-0x0;var _0x1e7a7e=_0x9364[_0x16dba9];return _0x1e7a7e;};'use strict';var EventEmitter=require(_0x4936('0x0'));var OpenchannelQueue=require(_0x4936('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4936('0x2')](0x0);var events={'afterCreate':_0x4936('0x3'),'afterUpdate':_0x4936('0x4'),'afterDestroy':_0x4936('0x5')};function emitEvent(_0xbd1feb){return function(_0x22d08c,_0x249ab8,_0x4c10f9){OpenchannelQueueEvents[_0x4936('0x6')](_0xbd1feb+':'+_0x22d08c['id'],_0x22d08c);OpenchannelQueueEvents[_0x4936('0x6')](_0xbd1feb,_0x22d08c);_0x4c10f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4936('0x7')](e,emitEvent(event));}}module[_0x4936('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f787655..5a526f4 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 _0xc659=['./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc659,0xbf));var _0x9c65=function(_0x567238,_0x32dea8){_0x567238=_0x567238-0x0;var _0x590383=_0xc659[_0x567238];return _0x590383;};'use strict';var _=require(_0x9c65('0x0'));var util=require('util');var logger=require(_0x9c65('0x1'))('api');var moment=require(_0x9c65('0x2'));var BPromise=require('bluebird');var rp=require(_0x9c65('0x3'));var fs=require('fs');var path=require(_0x9c65('0x4'));var rimraf=require(_0x9c65('0x5'));var config=require(_0x9c65('0x6'));var attributes=require(_0x9c65('0x7'));module[_0x9c65('0x8')]=function(_0x326f94,_0xb5aaa2){return _0x326f94['define'](_0x9c65('0x9'),attributes,{'tableName':_0x9c65('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa54f=['moment','bluebird','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','../../config/logger','api'];(function(_0x48aea9,_0x13d3b1){var _0x229e5c=function(_0x391b89){while(--_0x391b89){_0x48aea9['push'](_0x48aea9['shift']());}};_0x229e5c(++_0x13d3b1);}(_0xa54f,0x167));var _0xfa54=function(_0x25279c,_0x5d1586){_0x25279c=_0x25279c-0x0;var _0x337735=_0xa54f[_0x25279c];return _0x337735;};'use strict';var _=require(_0xfa54('0x0'));var util=require(_0xfa54('0x1'));var logger=require(_0xfa54('0x2'))(_0xfa54('0x3'));var moment=require(_0xfa54('0x4'));var BPromise=require(_0xfa54('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfa54('0x6'));var config=require('../../config/environment');var attributes=require(_0xfa54('0x7'));module[_0xfa54('0x8')]=function(_0xaa0000,_0x5716b1){return _0xaa0000[_0xfa54('0x9')](_0xfa54('0xa'),attributes,{'tableName':'openchannel_queues','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 8b303a9..6418a6f 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 _0xb44d=['findAll','options','raw','where','attributes','limit','include','model','map','ShowOpenchannelQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x198f57,_0x520f89){var _0x16f2a0=function(_0x3e9033){while(--_0x3e9033){_0x198f57['push'](_0x198f57['shift']());}};_0x16f2a0(++_0x520f89);}(_0xb44d,0x7d));var _0xdb44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb44d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xdb44('0x0'));var moment=require(_0xdb44('0x1'));var BPromise=require(_0xdb44('0x2'));var rs=require(_0xdb44('0x3'));var fs=require('fs');var Redis=require(_0xdb44('0x4'));var db=require(_0xdb44('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdb44('0x6'));var client=jayson[_0xdb44('0x7')][_0xdb44('0x8')]({'port':0x232a});config[_0xdb44('0x9')]=_[_0xdb44('0xa')](config[_0xdb44('0x9')],{'host':_0xdb44('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb44('0x9')]));require(_0xdb44('0xc'))[_0xdb44('0xd')](socket);function respondWithRpcPromise(_0x10eaf8,_0x4ff2b2,_0x103d78){return new BPromise(function(_0x32c6d0,_0x4afba3){return client[_0xdb44('0xe')](_0x10eaf8,_0x103d78)[_0xdb44('0xf')](function(_0x104aec){logger[_0xdb44('0x10')](_0xdb44('0x11'),_0x4ff2b2,'request\x20sent');logger[_0xdb44('0x12')](_0xdb44('0x13'),_0x4ff2b2,'request\x20sent',JSON[_0xdb44('0x14')](_0x104aec));if(_0x104aec[_0xdb44('0x15')]){if(_0x104aec[_0xdb44('0x15')]['code']===0x1f4){logger[_0xdb44('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ff2b2,_0x104aec[_0xdb44('0x15')][_0xdb44('0x16')]);return _0x4afba3(_0x104aec[_0xdb44('0x15')]['message']);}logger[_0xdb44('0x15')](_0xdb44('0x11'),_0x4ff2b2,_0x104aec[_0xdb44('0x15')]['message']);return _0x32c6d0(_0x104aec[_0xdb44('0x15')][_0xdb44('0x16')]);}else{logger[_0xdb44('0x10')](_0xdb44('0x11'),_0x4ff2b2,'request\x20sent');_0x32c6d0(_0x104aec[_0xdb44('0x17')]['message']);}})[_0xdb44('0x18')](function(_0x16e770){logger[_0xdb44('0x15')](_0xdb44('0x11'),_0x4ff2b2,_0x16e770);_0x4afba3(_0x16e770);});});}exports[_0xdb44('0x19')]=function(_0xb0085c){var _0xaea008=this;return new Promise(function(_0x2c9a4d,_0x2223ce){return db[_0xdb44('0x1a')][_0xdb44('0x1b')]({'raw':_0xb0085c[_0xdb44('0x1c')]?_0xb0085c[_0xdb44('0x1c')][_0xdb44('0x1d')]===undefined?!![]:![]:!![],'where':_0xb0085c[_0xdb44('0x1c')]?_0xb0085c[_0xdb44('0x1c')][_0xdb44('0x1e')]||null:null,'attributes':_0xb0085c[_0xdb44('0x1c')]?_0xb0085c[_0xdb44('0x1c')][_0xdb44('0x1f')]||null:null,'limit':_0xb0085c['options']?_0xb0085c[_0xdb44('0x1c')][_0xdb44('0x20')]||null:null,'include':_0xb0085c[_0xdb44('0x1c')]?_0xb0085c[_0xdb44('0x1c')][_0xdb44('0x21')]?_['map'](_0xb0085c['options'][_0xdb44('0x21')],function(_0x8b10f8){return{'model':db[_0x8b10f8[_0xdb44('0x22')]],'as':_0x8b10f8['as'],'attributes':_0x8b10f8[_0xdb44('0x1f')],'include':_0x8b10f8[_0xdb44('0x21')]?_[_0xdb44('0x23')](_0x8b10f8[_0xdb44('0x21')],function(_0x430d09){return{'model':db[_0x430d09[_0xdb44('0x22')]],'as':_0x430d09['as'],'attributes':_0x430d09[_0xdb44('0x1f')],'include':_0x430d09[_0xdb44('0x21')]?_[_0xdb44('0x23')](_0x430d09[_0xdb44('0x21')],function(_0x27a8ef){return{'model':db[_0x27a8ef[_0xdb44('0x22')]],'as':_0x27a8ef['as'],'attributes':_0x27a8ef[_0xdb44('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2068c6){logger[_0xdb44('0x10')](_0xdb44('0x19'),_0xb0085c);logger[_0xdb44('0x12')]('GetOpenchannelQueue',_0xb0085c,JSON[_0xdb44('0x14')](_0x2068c6));_0x2c9a4d(_0x2068c6);})[_0xdb44('0x18')](function(_0x81d96e){logger[_0xdb44('0x15')](_0xdb44('0x19'),_0x81d96e[_0xdb44('0x16')],_0xb0085c);_0x2223ce(_0xaea008[_0xdb44('0x15')](0x1f4,_0x81d96e[_0xdb44('0x16')]));});});};exports[_0xdb44('0x24')]=function(_0x292cb1){var _0xb0a466=this;return new Promise(function(_0x3d6a55,_0x21ed18){return db[_0xdb44('0x1a')][_0xdb44('0x25')]({'raw':_0x292cb1[_0xdb44('0x1c')]?_0x292cb1[_0xdb44('0x1c')][_0xdb44('0x1d')]===undefined?!![]:![]:!![],'where':_0x292cb1[_0xdb44('0x1c')]?_0x292cb1[_0xdb44('0x1c')][_0xdb44('0x1e')]||null:null,'attributes':_0x292cb1[_0xdb44('0x1c')]?_0x292cb1['options'][_0xdb44('0x1f')]||null:null,'include':_0x292cb1[_0xdb44('0x1c')]?_0x292cb1[_0xdb44('0x1c')][_0xdb44('0x21')]?_['map'](_0x292cb1[_0xdb44('0x1c')][_0xdb44('0x21')],function(_0x4f1ffe){return{'model':db[_0x4f1ffe[_0xdb44('0x22')]],'as':_0x4f1ffe['as'],'attributes':_0x4f1ffe[_0xdb44('0x1f')],'include':_0x4f1ffe[_0xdb44('0x21')]?_[_0xdb44('0x23')](_0x4f1ffe[_0xdb44('0x21')],function(_0x1fcf35){return{'model':db[_0x1fcf35[_0xdb44('0x22')]],'as':_0x1fcf35['as'],'attributes':_0x1fcf35[_0xdb44('0x1f')],'include':_0x1fcf35[_0xdb44('0x21')]?_[_0xdb44('0x23')](_0x1fcf35['include'],function(_0x515536){return{'model':db[_0x515536[_0xdb44('0x22')]],'as':_0x515536['as'],'attributes':_0x515536[_0xdb44('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdb44('0xf')](function(_0x4ccd5c){logger[_0xdb44('0x10')](_0xdb44('0x24'),_0x292cb1);logger[_0xdb44('0x12')](_0xdb44('0x24'),_0x292cb1,JSON['stringify'](_0x4ccd5c));_0x3d6a55(_0x4ccd5c);})['catch'](function(_0x5188dd){logger[_0xdb44('0x15')](_0xdb44('0x24'),_0x5188dd[_0xdb44('0x16')],_0x292cb1);_0x21ed18(_0xb0a466[_0xdb44('0x15')](0x1f4,_0x5188dd[_0xdb44('0x16')]));});});}; \ No newline at end of file +var _0xdadc=['include','model','map','debug','ShowOpenchannelQueue','where','stringify','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','attributes'];(function(_0xcc24e8,_0x230fe5){var _0x279917=function(_0x5838ad){while(--_0x5838ad){_0xcc24e8['push'](_0xcc24e8['shift']());}};_0x279917(++_0x230fe5);}(_0xdadc,0x1e8));var _0xcdad=function(_0x46362d,_0x25a2ad){_0x46362d=_0x46362d-0x0;var _0x4f6c47=_0xdadc[_0x46362d];return _0x4f6c47;};'use strict';var _=require('lodash');var util=require(_0xcdad('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcdad('0x1'));var fs=require('fs');var Redis=require(_0xcdad('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdad('0x3'));var logger=require(_0xcdad('0x4'))(_0xcdad('0x5'));var config=require(_0xcdad('0x6'));var jayson=require(_0xcdad('0x7'));var client=jayson[_0xcdad('0x8')]['http']({'port':0x232a});config[_0xcdad('0x9')]=_[_0xcdad('0xa')](config['redis'],{'host':_0xcdad('0xb'),'port':0x18eb});var socket=require(_0xcdad('0xc'))(new Redis(config[_0xcdad('0x9')]));require(_0xcdad('0xd'))['register'](socket);function respondWithRpcPromise(_0x34bb83,_0x350ee1,_0x3bf61f){return new BPromise(function(_0x4b418b,_0x48eff5){return client[_0xcdad('0xe')](_0x34bb83,_0x3bf61f)[_0xcdad('0xf')](function(_0x7e11f4){logger[_0xcdad('0x10')](_0xcdad('0x11'),_0x350ee1,_0xcdad('0x12'));logger['debug'](_0xcdad('0x13'),_0x350ee1,_0xcdad('0x12'),JSON['stringify'](_0x7e11f4));if(_0x7e11f4[_0xcdad('0x14')]){if(_0x7e11f4[_0xcdad('0x14')]['code']===0x1f4){logger['error'](_0xcdad('0x11'),_0x350ee1,_0x7e11f4[_0xcdad('0x14')][_0xcdad('0x15')]);return _0x48eff5(_0x7e11f4[_0xcdad('0x14')]['message']);}logger[_0xcdad('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x350ee1,_0x7e11f4[_0xcdad('0x14')]['message']);return _0x4b418b(_0x7e11f4[_0xcdad('0x14')][_0xcdad('0x15')]);}else{logger['info'](_0xcdad('0x11'),_0x350ee1,_0xcdad('0x12'));_0x4b418b(_0x7e11f4[_0xcdad('0x16')][_0xcdad('0x15')]);}})[_0xcdad('0x17')](function(_0x167069){logger['error'](_0xcdad('0x11'),_0x350ee1,_0x167069);_0x48eff5(_0x167069);});});}exports[_0xcdad('0x18')]=function(_0x472440){var _0x26b03f=this;return new Promise(function(_0x4e6986,_0x1f92ef){return db[_0xcdad('0x19')][_0xcdad('0x1a')]({'raw':_0x472440['options']?_0x472440['options'][_0xcdad('0x1b')]===undefined?!![]:![]:!![],'where':_0x472440[_0xcdad('0x1c')]?_0x472440['options']['where']||null:null,'attributes':_0x472440['options']?_0x472440[_0xcdad('0x1c')][_0xcdad('0x1d')]||null:null,'limit':_0x472440[_0xcdad('0x1c')]?_0x472440[_0xcdad('0x1c')]['limit']||null:null,'include':_0x472440['options']?_0x472440[_0xcdad('0x1c')][_0xcdad('0x1e')]?_['map'](_0x472440[_0xcdad('0x1c')]['include'],function(_0x32ae17){return{'model':db[_0x32ae17[_0xcdad('0x1f')]],'as':_0x32ae17['as'],'attributes':_0x32ae17[_0xcdad('0x1d')],'include':_0x32ae17['include']?_['map'](_0x32ae17[_0xcdad('0x1e')],function(_0x23f27e){return{'model':db[_0x23f27e[_0xcdad('0x1f')]],'as':_0x23f27e['as'],'attributes':_0x23f27e[_0xcdad('0x1d')],'include':_0x23f27e[_0xcdad('0x1e')]?_[_0xcdad('0x20')](_0x23f27e[_0xcdad('0x1e')],function(_0x572879){return{'model':db[_0x572879['model']],'as':_0x572879['as'],'attributes':_0x572879['attributes']};}):[]};}):[]};}):[]:[]})[_0xcdad('0xf')](function(_0x5da846){logger[_0xcdad('0x10')]('GetOpenchannelQueue',_0x472440);logger[_0xcdad('0x21')](_0xcdad('0x18'),_0x472440,JSON['stringify'](_0x5da846));_0x4e6986(_0x5da846);})[_0xcdad('0x17')](function(_0x5c6b40){logger['error']('GetOpenchannelQueue',_0x5c6b40[_0xcdad('0x15')],_0x472440);_0x1f92ef(_0x26b03f['error'](0x1f4,_0x5c6b40[_0xcdad('0x15')]));});});};exports[_0xcdad('0x22')]=function(_0x4f57ab){var _0x5cc292=this;return new Promise(function(_0x33b260,_0x9cc37c){return db[_0xcdad('0x19')]['find']({'raw':_0x4f57ab['options']?_0x4f57ab[_0xcdad('0x1c')][_0xcdad('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f57ab[_0xcdad('0x1c')]?_0x4f57ab['options'][_0xcdad('0x23')]||null:null,'attributes':_0x4f57ab['options']?_0x4f57ab[_0xcdad('0x1c')]['attributes']||null:null,'include':_0x4f57ab['options']?_0x4f57ab[_0xcdad('0x1c')][_0xcdad('0x1e')]?_[_0xcdad('0x20')](_0x4f57ab[_0xcdad('0x1c')][_0xcdad('0x1e')],function(_0x3e4e35){return{'model':db[_0x3e4e35[_0xcdad('0x1f')]],'as':_0x3e4e35['as'],'attributes':_0x3e4e35[_0xcdad('0x1d')],'include':_0x3e4e35[_0xcdad('0x1e')]?_['map'](_0x3e4e35[_0xcdad('0x1e')],function(_0x320e2f){return{'model':db[_0x320e2f['model']],'as':_0x320e2f['as'],'attributes':_0x320e2f[_0xcdad('0x1d')],'include':_0x320e2f[_0xcdad('0x1e')]?_['map'](_0x320e2f[_0xcdad('0x1e')],function(_0x333152){return{'model':db[_0x333152[_0xcdad('0x1f')]],'as':_0x333152['as'],'attributes':_0x333152[_0xcdad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdad('0xf')](function(_0x3c837b){logger['info']('ShowOpenchannelQueue',_0x4f57ab);logger[_0xcdad('0x21')](_0xcdad('0x22'),_0x4f57ab,JSON[_0xcdad('0x24')](_0x3c837b));_0x33b260(_0x3c837b);})[_0xcdad('0x17')](function(_0x502265){logger['error'](_0xcdad('0x22'),_0x502265[_0xcdad('0x15')],_0x4f57ab);_0x9cc37c(_0x5cc292[_0xcdad('0x14')](0x1f4,_0x502265[_0xcdad('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 7745f71..2fca260 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 _0xeb35=['emit','length','save','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb35,0x1d8));var _0x5eb3=function(_0x41ff52,_0x327e2b){_0x41ff52=_0x41ff52-0x0;var _0x2e859e=_0xeb35[_0x41ff52];return _0x2e859e;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x5eb3('0x0'),_0x5eb3('0x1'),_0x5eb3('0x2')];function createListener(_0x2b4697,_0x354ab2){return function(_0x3651ce){_0x354ab2[_0x5eb3('0x3')](_0x2b4697,_0x3651ce);};}function removeListener(_0x4fa8d3,_0x1fa49f){return function(){OpenchannelQueueEvents['removeListener'](_0x4fa8d3,_0x1fa49f);};}exports['register']=function(_0x4be254){for(var _0x274989=0x0,_0x4a6f65=events[_0x5eb3('0x4')];_0x274989<_0x4a6f65;_0x274989++){var _0x4e197c=events[_0x274989];var _0x44b9cd=createListener('openchannelQueue:'+_0x4e197c,_0x4be254);OpenchannelQueueEvents['on'](_0x4e197c,_0x44b9cd);}}; \ No newline at end of file +var _0x9e41=['length','openchannelQueue:','./openchannelQueue.events','save','removeListener','register'];(function(_0x5dedee,_0x169380){var _0x198eef=function(_0xadf638){while(--_0xadf638){_0x5dedee['push'](_0x5dedee['shift']());}};_0x198eef(++_0x169380);}(_0x9e41,0x1a0));var _0x19e4=function(_0x23db9c,_0x32ec43){_0x23db9c=_0x23db9c-0x0;var _0x24c947=_0x9e41[_0x23db9c];return _0x24c947;};'use strict';var OpenchannelQueueEvents=require(_0x19e4('0x0'));var events=[_0x19e4('0x1'),'remove','update'];function createListener(_0x5c57bd,_0x568eec){return function(_0x43e9b8){_0x568eec['emit'](_0x5c57bd,_0x43e9b8);};}function removeListener(_0x2d5d82,_0x2aa770){return function(){OpenchannelQueueEvents[_0x19e4('0x2')](_0x2d5d82,_0x2aa770);};}exports[_0x19e4('0x3')]=function(_0x27ff24){for(var _0x4eadb0=0x0,_0x10b8c8=events[_0x19e4('0x4')];_0x4eadb0<_0x10b8c8;_0x4eadb0++){var _0x295d64=events[_0x4eadb0];var _0x4d6429=createListener(_0x19e4('0x5')+_0x295d64,_0x27ff24);OpenchannelQueueEvents['on'](_0x295d64,_0x4d6429);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 49e060c..3cad7f9 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 _0x27bf=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x24f25b,_0x1d695d){var _0x3c642b=function(_0x136cad){while(--_0x136cad){_0x24f25b['push'](_0x24f25b['shift']());}};_0x3c642b(++_0x1d695d);}(_0x27bf,0x166));var _0xf27b=function(_0x4dae90,_0x310097){_0x4dae90=_0x4dae90-0x0;var _0x211ef6=_0x27bf[_0x4dae90];return _0x211ef6;};'use strict';var multer=require('multer');var util=require(_0xf27b('0x0'));var path=require(_0xf27b('0x1'));var timeout=require(_0xf27b('0x2'));var express=require(_0xf27b('0x3'));var router=express['Router']();var fs_extra=require(_0xf27b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf27b('0x5'));var config=require(_0xf27b('0x6'));var controller=require(_0xf27b('0x7'));router[_0xf27b('0x8')]('/',auth[_0xf27b('0x9')](),controller[_0xf27b('0xa')]);router[_0xf27b('0x8')](_0xf27b('0xb'),auth['isAuthenticated'](),controller[_0xf27b('0xc')]);router[_0xf27b('0x8')](_0xf27b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf27b('0xe')]('/',auth[_0xf27b('0x9')](),controller[_0xf27b('0xf')]);router[_0xf27b('0x10')](_0xf27b('0xd'),auth['isAuthenticated'](),controller[_0xf27b('0x11')]);router[_0xf27b('0x12')](_0xf27b('0xd'),auth[_0xf27b('0x9')](),controller[_0xf27b('0x13')]);module[_0xf27b('0x14')]=router; \ No newline at end of file +var _0xbdfb=['describe','show','post','/:id','delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x44e843,_0x18e958){var _0x4f0a2d=function(_0xd7cb2){while(--_0xd7cb2){_0x44e843['push'](_0x44e843['shift']());}};_0x4f0a2d(++_0x18e958);}(_0xbdfb,0x116));var _0xbbdf=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xbdfb[_0x1558ab];return _0x53b64a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbbdf('0x0'));var timeout=require(_0xbbdf('0x1'));var express=require(_0xbbdf('0x2'));var router=express['Router']();var fs_extra=require(_0xbbdf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbbdf('0x4'));var config=require(_0xbbdf('0x5'));var controller=require(_0xbbdf('0x6'));router[_0xbbdf('0x7')]('/',auth[_0xbbdf('0x8')](),controller['index']);router['get'](_0xbbdf('0x9'),auth[_0xbbdf('0x8')](),controller[_0xbbdf('0xa')]);router[_0xbbdf('0x7')]('/:id',auth[_0xbbdf('0x8')](),controller[_0xbbdf('0xb')]);router[_0xbbdf('0xc')]('/',auth[_0xbbdf('0x8')](),controller['create']);router['put'](_0xbbdf('0xd'),auth[_0xbbdf('0x8')](),controller['update']);router[_0xbbdf('0xe')](_0xbbdf('0xd'),auth['isAuthenticated'](),controller[_0xbbdf('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ea45956..a15a915 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 _0xa007=['moment','sequelize','exports','STRING','DATE'];(function(_0x55b030,_0x57f3e7){var _0x56bcf6=function(_0x1c9e0f){while(--_0x1c9e0f){_0x55b030['push'](_0x55b030['shift']());}};_0x56bcf6(++_0x57f3e7);}(_0xa007,0x15e));var _0x7a00=function(_0x170522,_0x273df0){_0x170522=_0x170522-0x0;var _0x2a0a7b=_0xa007[_0x170522];return _0x2a0a7b;};'use strict';var moment=require(_0x7a00('0x0'));var Sequelize=require(_0x7a00('0x1'));module[_0x7a00('0x2')]={'uniqueid':{'type':Sequelize[_0x7a00('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7a00('0x3')]},'joinAt':{'type':Sequelize[_0x7a00('0x4')]},'leaveAt':{'type':Sequelize[_0x7a00('0x4')]},'acceptAt':{'type':Sequelize[_0x7a00('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7a00('0x3')]}}; \ No newline at end of file +var _0xd38a=['STRING','DATE','sequelize','exports'];(function(_0x2b2094,_0x59e69d){var _0x3d56ff=function(_0x138bdf){while(--_0x138bdf){_0x2b2094['push'](_0x2b2094['shift']());}};_0x3d56ff(++_0x59e69d);}(_0xd38a,0x1aa));var _0xad38=function(_0x4bdaf4,_0x369605){_0x4bdaf4=_0x4bdaf4-0x0;var _0x4c2a2d=_0xd38a[_0x4bdaf4];return _0x4c2a2d;};'use strict';var moment=require('moment');var Sequelize=require(_0xad38('0x0'));module[_0xad38('0x1')]={'uniqueid':{'type':Sequelize[_0xad38('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xad38('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xad38('0x3')]},'acceptAt':{'type':Sequelize[_0xad38('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xad38('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5ccdf1f..313b12c 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 _0x5575=['moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','destroy','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1498de,_0x1ba8dc){var _0x204ecb=function(_0x547eeb){while(--_0x547eeb){_0x1498de['push'](_0x1498de['shift']());}};_0x204ecb(++_0x1ba8dc);}(_0x5575,0x1a5));var _0x5557=function(_0x40c49b,_0x1b944d){_0x40c49b=_0x40c49b-0x0;var _0x43f082=_0x5575[_0x40c49b];return _0x43f082;};'use strict';var emlformat=require(_0x5557('0x0'));var rimraf=require(_0x5557('0x1'));var zipdir=require(_0x5557('0x2'));var jsonpatch=require(_0x5557('0x3'));var rp=require(_0x5557('0x4'));var moment=require(_0x5557('0x5'));var BPromise=require(_0x5557('0x6'));var Mustache=require(_0x5557('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5557('0x8'));var ejs=require(_0x5557('0x9'));var fs=require('fs');var fs_extra=require(_0x5557('0xa'));var _=require('lodash');var squel=require(_0x5557('0xb'));var crypto=require(_0x5557('0xc'));var jsforce=require(_0x5557('0xd'));var deskjs=require(_0x5557('0xe'));var toCsv=require(_0x5557('0x8'));var querystring=require(_0x5557('0xf'));var Papa=require(_0x5557('0x10'));var Redis=require(_0x5557('0x11'));var authService=require(_0x5557('0x12'));var qs=require(_0x5557('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5557('0x14'));var logger=require(_0x5557('0x15'))(_0x5557('0x16'));var utils=require(_0x5557('0x17'));var config=require(_0x5557('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5557('0x19'))['db'];function respondWithStatusCode(_0x2b69d0,_0x18ed76){_0x18ed76=_0x18ed76||0xcc;return function(_0x1d5228){if(_0x1d5228){return _0x2b69d0[_0x5557('0x1a')](_0x18ed76);}return _0x2b69d0[_0x5557('0x1b')](_0x18ed76)[_0x5557('0x1c')]();};}function respondWithResult(_0x489941,_0x261200){_0x261200=_0x261200||0xc8;return function(_0x20e669){if(_0x20e669){return _0x489941[_0x5557('0x1b')](_0x261200)[_0x5557('0x1d')](_0x20e669);}};}function respondWithFilteredResult(_0x981f59,_0x226db7){return function(_0x1e7125){if(_0x1e7125){var _0x34b4b5=typeof _0x226db7[_0x5557('0x1e')]==='undefined'&&typeof _0x226db7['limit']===_0x5557('0x1f');var _0x178104=_0x1e7125['count'];var _0x1655ee=_0x34b4b5?0x0:_0x226db7[_0x5557('0x1e')];var _0x375046=_0x34b4b5?_0x1e7125[_0x5557('0x20')]:_0x226db7[_0x5557('0x1e')]+_0x226db7['limit'];var _0x3a2217;if(_0x375046>=_0x178104){_0x375046=_0x178104;_0x3a2217=0xc8;}else{_0x3a2217=0xce;}_0x981f59[_0x5557('0x1b')](_0x3a2217);return _0x981f59[_0x5557('0x21')]('Content-Range',_0x1655ee+'-'+_0x375046+'/'+_0x178104)[_0x5557('0x1d')](_0x1e7125);}return null;};}function patchUpdates(_0x492f1c){return function(_0x107af1){try{jsonpatch['apply'](_0x107af1,_0x492f1c,!![]);}catch(_0x54eb8c){return BPromise[_0x5557('0x22')](_0x54eb8c);}return _0x107af1[_0x5557('0x23')]();};}function saveUpdates(_0x2a29a1,_0x247a05){return function(_0x53b29){if(_0x53b29){return _0x53b29[_0x5557('0x24')](_0x2a29a1)[_0x5557('0x25')](function(_0x4e8109){return _0x4e8109;});}return null;};}function removeEntity(_0x51af56,_0x1ae6c5){return function(_0xa2f3aa){if(_0xa2f3aa){return _0xa2f3aa[_0x5557('0x26')]()[_0x5557('0x25')](function(){_0x51af56[_0x5557('0x1b')](0xcc)[_0x5557('0x1c')]();});}};}function handleEntityNotFound(_0x1185d8,_0x30ad45){return function(_0x4fd54e){if(!_0x4fd54e){_0x1185d8[_0x5557('0x1a')](0x194);}return _0x4fd54e;};}function handleError(_0x2d7cb0,_0x2102c2){_0x2102c2=_0x2102c2||0x1f4;return function(_0x360d1e){logger['error'](_0x360d1e['stack']);if(_0x360d1e[_0x5557('0x27')]){delete _0x360d1e[_0x5557('0x27')];}_0x2d7cb0[_0x5557('0x1b')](_0x2102c2)[_0x5557('0x28')](_0x360d1e);};}exports[_0x5557('0x29')]=function(_0xad243,_0x200d9e){var _0x3734c0={},_0x10c299={},_0x4e7322={'count':0x0,'rows':[]};var _0xb63afe=_[_0x5557('0x2a')](db[_0x5557('0x2b')][_0x5557('0x2c')],function(_0x68f97a){return{'name':_0x68f97a[_0x5557('0x2d')],'type':_0x68f97a[_0x5557('0x2e')]['key']};});_0x10c299[_0x5557('0x2f')]=_[_0x5557('0x2a')](_0xb63afe,_0x5557('0x27'));_0x10c299[_0x5557('0x30')]=_[_0x5557('0x31')](_0xad243[_0x5557('0x30')]);_0x10c299[_0x5557('0x32')]=_[_0x5557('0x33')](_0x10c299['model'],_0x10c299[_0x5557('0x30')]);_0x3734c0[_0x5557('0x34')]=_[_0x5557('0x33')](_0x10c299[_0x5557('0x2f')],qs[_0x5557('0x35')](_0xad243[_0x5557('0x30')][_0x5557('0x35')]));_0x3734c0[_0x5557('0x34')]=_0x3734c0[_0x5557('0x34')][_0x5557('0x36')]?_0x3734c0[_0x5557('0x34')]:_0x10c299[_0x5557('0x2f')];if(!_0xad243[_0x5557('0x30')]['hasOwnProperty'](_0x5557('0x37'))){_0x3734c0[_0x5557('0x38')]=qs[_0x5557('0x38')](_0xad243[_0x5557('0x30')][_0x5557('0x38')]);_0x3734c0[_0x5557('0x1e')]=qs['offset'](_0xad243[_0x5557('0x30')][_0x5557('0x1e')]);}_0x3734c0['order']=qs[_0x5557('0x39')](_0xad243['query'][_0x5557('0x39')]);_0x3734c0[_0x5557('0x3a')]=qs[_0x5557('0x32')](_[_0x5557('0x3b')](_0xad243[_0x5557('0x30')],_0x10c299[_0x5557('0x32')]),_0xb63afe);if(_0xad243[_0x5557('0x30')][_0x5557('0x3c')]){_0x3734c0[_0x5557('0x3a')]=_[_0x5557('0x3d')](_0x3734c0[_0x5557('0x3a')],{'$or':_[_0x5557('0x2a')](_0xb63afe,function(_0x4bf8b5){if(_0x4bf8b5[_0x5557('0x2e')]!=='VIRTUAL'){var _0x48cff8={};_0x48cff8[_0x4bf8b5[_0x5557('0x27')]]={'$like':'%'+_0xad243[_0x5557('0x30')][_0x5557('0x3c')]+'%'};return _0x48cff8;}})});}_0x3734c0=_[_0x5557('0x3d')]({},_0x3734c0,_0xad243[_0x5557('0x3e')]);var _0x4b9ee3={'where':_0x3734c0['where']};return db[_0x5557('0x2b')][_0x5557('0x20')](_0x4b9ee3)['then'](function(_0x575887){_0x4e7322[_0x5557('0x20')]=_0x575887;if(_0xad243[_0x5557('0x30')][_0x5557('0x3f')]){_0x3734c0[_0x5557('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5557('0x41')](_0x3734c0);})['then'](function(_0x3d3971){_0x4e7322['rows']=_0x3d3971;return _0x4e7322;})[_0x5557('0x25')](respondWithFilteredResult(_0x200d9e,_0x3734c0))[_0x5557('0x42')](handleError(_0x200d9e,null));};exports['show']=function(_0x59a4c0,_0x3e3bbd){var _0x1ee42d={'raw':!![],'where':{'id':_0x59a4c0[_0x5557('0x43')]['id']}},_0x566425={};_0x566425[_0x5557('0x2f')]=_[_0x5557('0x31')](db['OpenchannelQueueReport'][_0x5557('0x2c')]);_0x566425[_0x5557('0x30')]=_[_0x5557('0x31')](_0x59a4c0['query']);_0x566425[_0x5557('0x32')]=_['intersection'](_0x566425['model'],_0x566425['query']);_0x1ee42d[_0x5557('0x34')]=_['intersection'](_0x566425[_0x5557('0x2f')],qs[_0x5557('0x35')](_0x59a4c0[_0x5557('0x30')][_0x5557('0x35')]));_0x1ee42d[_0x5557('0x34')]=_0x1ee42d[_0x5557('0x34')]['length']?_0x1ee42d['attributes']:_0x566425[_0x5557('0x2f')];if(_0x59a4c0[_0x5557('0x30')][_0x5557('0x3f')]){_0x1ee42d[_0x5557('0x40')]=[{'all':!![]}];}_0x1ee42d=_[_0x5557('0x3d')]({},_0x1ee42d,_0x59a4c0['options']);return db[_0x5557('0x2b')][_0x5557('0x44')](_0x1ee42d)[_0x5557('0x25')](handleEntityNotFound(_0x3e3bbd,null))[_0x5557('0x25')](respondWithResult(_0x3e3bbd,null))[_0x5557('0x42')](handleError(_0x3e3bbd,null));};exports[_0x5557('0x45')]=function(_0x1dd06a,_0x2b9375){return db[_0x5557('0x2b')][_0x5557('0x45')](_0x1dd06a[_0x5557('0x46')],{})[_0x5557('0x25')](respondWithResult(_0x2b9375,0xc9))[_0x5557('0x42')](handleError(_0x2b9375,null));};exports[_0x5557('0x24')]=function(_0x2924c2,_0x39fa3e){if(_0x2924c2[_0x5557('0x46')]['id']){delete _0x2924c2[_0x5557('0x46')]['id'];}return db[_0x5557('0x2b')][_0x5557('0x44')]({'where':{'id':_0x2924c2[_0x5557('0x43')]['id']}})['then'](handleEntityNotFound(_0x39fa3e,null))[_0x5557('0x25')](saveUpdates(_0x2924c2[_0x5557('0x46')],null))[_0x5557('0x25')](respondWithResult(_0x39fa3e,null))['catch'](handleError(_0x39fa3e,null));};exports[_0x5557('0x26')]=function(_0x2eeefb,_0x5b1fd8){return db[_0x5557('0x2b')]['find']({'where':{'id':_0x2eeefb[_0x5557('0x43')]['id']}})[_0x5557('0x25')](handleEntityNotFound(_0x5b1fd8,null))['then'](removeEntity(_0x5b1fd8,null))[_0x5557('0x42')](handleError(_0x5b1fd8,null));};exports['describe']=function(_0x30ab8d,_0x4589b4){return db['OpenchannelQueueReport']['describe']()[_0x5557('0x25')](respondWithResult(_0x4589b4,null))[_0x5557('0x42')](handleError(_0x4589b4,null));}; \ No newline at end of file +var _0x0738=['pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','stack','name','send','index','OpenchannelQueueReport','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x44c844,_0x1e3d7d){var _0x1d51b7=function(_0x575840){while(--_0x575840){_0x44c844['push'](_0x44c844['shift']());}};_0x1d51b7(++_0x1e3d7d);}(_0x0738,0xef));var _0x8073=function(_0x3fd50c,_0x1b41ed){_0x3fd50c=_0x3fd50c-0x0;var _0x4cebb2=_0x0738[_0x3fd50c];return _0x4cebb2;};'use strict';var emlformat=require(_0x8073('0x0'));var rimraf=require(_0x8073('0x1'));var zipdir=require(_0x8073('0x2'));var jsonpatch=require(_0x8073('0x3'));var rp=require(_0x8073('0x4'));var moment=require(_0x8073('0x5'));var BPromise=require(_0x8073('0x6'));var Mustache=require(_0x8073('0x7'));var util=require('util');var path=require(_0x8073('0x8'));var sox=require(_0x8073('0x9'));var csv=require('to-csv');var ejs=require(_0x8073('0xa'));var fs=require('fs');var fs_extra=require(_0x8073('0xb'));var _=require(_0x8073('0xc'));var squel=require(_0x8073('0xd'));var crypto=require(_0x8073('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8073('0xf'));var Papa=require(_0x8073('0x10'));var Redis=require(_0x8073('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8073('0x12'));var as=require(_0x8073('0x13'));var hardwareService=require(_0x8073('0x14'));var logger=require(_0x8073('0x15'))(_0x8073('0x16'));var utils=require(_0x8073('0x17'));var config=require(_0x8073('0x18'));var licenseUtil=require(_0x8073('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49df88,_0x46edff){_0x46edff=_0x46edff||0xcc;return function(_0x4fc058){if(_0x4fc058){return _0x49df88[_0x8073('0x1a')](_0x46edff);}return _0x49df88[_0x8073('0x1b')](_0x46edff)[_0x8073('0x1c')]();};}function respondWithResult(_0x391510,_0x36cbe4){_0x36cbe4=_0x36cbe4||0xc8;return function(_0x2b2fd6){if(_0x2b2fd6){return _0x391510[_0x8073('0x1b')](_0x36cbe4)['json'](_0x2b2fd6);}};}function respondWithFilteredResult(_0x46599e,_0x5037b9){return function(_0x598394){if(_0x598394){var _0x63d2bf=typeof _0x5037b9[_0x8073('0x1d')]===_0x8073('0x1e')&&typeof _0x5037b9[_0x8073('0x1f')]===_0x8073('0x1e');var _0x38be77=_0x598394[_0x8073('0x20')];var _0xa91642=_0x63d2bf?0x0:_0x5037b9['offset'];var _0x17d95d=_0x63d2bf?_0x598394['count']:_0x5037b9['offset']+_0x5037b9[_0x8073('0x1f')];var _0x134499;if(_0x17d95d>=_0x38be77){_0x17d95d=_0x38be77;_0x134499=0xc8;}else{_0x134499=0xce;}_0x46599e['status'](_0x134499);return _0x46599e[_0x8073('0x21')]('Content-Range',_0xa91642+'-'+_0x17d95d+'/'+_0x38be77)[_0x8073('0x22')](_0x598394);}return null;};}function patchUpdates(_0x354c9c){return function(_0x741569){try{jsonpatch['apply'](_0x741569,_0x354c9c,!![]);}catch(_0x5ede6b){return BPromise['reject'](_0x5ede6b);}return _0x741569[_0x8073('0x23')]();};}function saveUpdates(_0x4ec03a,_0x32945d){return function(_0x2bbdf2){if(_0x2bbdf2){return _0x2bbdf2[_0x8073('0x24')](_0x4ec03a)[_0x8073('0x25')](function(_0x5b385a){return _0x5b385a;});}return null;};}function removeEntity(_0x14a8c5,_0xcdf23c){return function(_0x21712c){if(_0x21712c){return _0x21712c[_0x8073('0x26')]()[_0x8073('0x25')](function(){_0x14a8c5[_0x8073('0x1b')](0xcc)[_0x8073('0x1c')]();});}};}function handleEntityNotFound(_0x2fa21a,_0x165cd8){return function(_0x2693d8){if(!_0x2693d8){_0x2fa21a[_0x8073('0x1a')](0x194);}return _0x2693d8;};}function handleError(_0x35412e,_0x2ea9be){_0x2ea9be=_0x2ea9be||0x1f4;return function(_0x12822f){logger['error'](_0x12822f[_0x8073('0x27')]);if(_0x12822f['name']){delete _0x12822f[_0x8073('0x28')];}_0x35412e[_0x8073('0x1b')](_0x2ea9be)[_0x8073('0x29')](_0x12822f);};}exports[_0x8073('0x2a')]=function(_0x218796,_0x1a3dc3){var _0x489084={},_0x5823a6={},_0x5b4258={'count':0x0,'rows':[]};var _0xfa23bb=_['map'](db[_0x8073('0x2b')]['rawAttributes'],function(_0x48d5e8){return{'name':_0x48d5e8[_0x8073('0x2c')],'type':_0x48d5e8[_0x8073('0x2d')][_0x8073('0x2e')]};});_0x5823a6['model']=_[_0x8073('0x2f')](_0xfa23bb,_0x8073('0x28'));_0x5823a6[_0x8073('0x30')]=_[_0x8073('0x31')](_0x218796[_0x8073('0x30')]);_0x5823a6[_0x8073('0x32')]=_[_0x8073('0x33')](_0x5823a6[_0x8073('0x34')],_0x5823a6[_0x8073('0x30')]);_0x489084[_0x8073('0x35')]=_['intersection'](_0x5823a6[_0x8073('0x34')],qs[_0x8073('0x36')](_0x218796[_0x8073('0x30')][_0x8073('0x36')]));_0x489084[_0x8073('0x35')]=_0x489084['attributes'][_0x8073('0x37')]?_0x489084['attributes']:_0x5823a6[_0x8073('0x34')];if(!_0x218796[_0x8073('0x30')][_0x8073('0x38')](_0x8073('0x39'))){_0x489084['limit']=qs['limit'](_0x218796[_0x8073('0x30')][_0x8073('0x1f')]);_0x489084[_0x8073('0x1d')]=qs['offset'](_0x218796['query'][_0x8073('0x1d')]);}_0x489084[_0x8073('0x3a')]=qs[_0x8073('0x3b')](_0x218796['query']['sort']);_0x489084[_0x8073('0x3c')]=qs[_0x8073('0x32')](_[_0x8073('0x3d')](_0x218796[_0x8073('0x30')],_0x5823a6[_0x8073('0x32')]),_0xfa23bb);if(_0x218796['query'][_0x8073('0x3e')]){_0x489084['where']=_[_0x8073('0x3f')](_0x489084[_0x8073('0x3c')],{'$or':_['map'](_0xfa23bb,function(_0x53dc0b){if(_0x53dc0b['type']!=='VIRTUAL'){var _0x5a94fc={};_0x5a94fc[_0x53dc0b[_0x8073('0x28')]]={'$like':'%'+_0x218796[_0x8073('0x30')][_0x8073('0x3e')]+'%'};return _0x5a94fc;}})});}_0x489084=_['merge']({},_0x489084,_0x218796[_0x8073('0x40')]);var _0x37687={'where':_0x489084['where']};return db['OpenchannelQueueReport'][_0x8073('0x20')](_0x37687)[_0x8073('0x25')](function(_0x22c55a){_0x5b4258[_0x8073('0x20')]=_0x22c55a;if(_0x218796['query'][_0x8073('0x41')]){_0x489084[_0x8073('0x42')]=[{'all':!![]}];}return db[_0x8073('0x2b')][_0x8073('0x43')](_0x489084);})[_0x8073('0x25')](function(_0x35182f){_0x5b4258['rows']=_0x35182f;return _0x5b4258;})[_0x8073('0x25')](respondWithFilteredResult(_0x1a3dc3,_0x489084))[_0x8073('0x44')](handleError(_0x1a3dc3,null));};exports[_0x8073('0x45')]=function(_0x466488,_0x17aeaa){var _0x12f220={'raw':!![],'where':{'id':_0x466488[_0x8073('0x46')]['id']}},_0x3bf9f1={};_0x3bf9f1['model']=_[_0x8073('0x31')](db[_0x8073('0x2b')][_0x8073('0x47')]);_0x3bf9f1[_0x8073('0x30')]=_[_0x8073('0x31')](_0x466488[_0x8073('0x30')]);_0x3bf9f1['filters']=_[_0x8073('0x33')](_0x3bf9f1[_0x8073('0x34')],_0x3bf9f1['query']);_0x12f220[_0x8073('0x35')]=_[_0x8073('0x33')](_0x3bf9f1['model'],qs[_0x8073('0x36')](_0x466488[_0x8073('0x30')][_0x8073('0x36')]));_0x12f220['attributes']=_0x12f220[_0x8073('0x35')][_0x8073('0x37')]?_0x12f220[_0x8073('0x35')]:_0x3bf9f1[_0x8073('0x34')];if(_0x466488[_0x8073('0x30')][_0x8073('0x41')]){_0x12f220[_0x8073('0x42')]=[{'all':!![]}];}_0x12f220=_['merge']({},_0x12f220,_0x466488[_0x8073('0x40')]);return db[_0x8073('0x2b')][_0x8073('0x48')](_0x12f220)[_0x8073('0x25')](handleEntityNotFound(_0x17aeaa,null))[_0x8073('0x25')](respondWithResult(_0x17aeaa,null))['catch'](handleError(_0x17aeaa,null));};exports['create']=function(_0x3ee535,_0x2b0d2f){return db['OpenchannelQueueReport']['create'](_0x3ee535[_0x8073('0x49')],{})['then'](respondWithResult(_0x2b0d2f,0xc9))[_0x8073('0x44')](handleError(_0x2b0d2f,null));};exports['update']=function(_0x546915,_0x752bc6){if(_0x546915['body']['id']){delete _0x546915[_0x8073('0x49')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x546915[_0x8073('0x46')]['id']}})[_0x8073('0x25')](handleEntityNotFound(_0x752bc6,null))['then'](saveUpdates(_0x546915[_0x8073('0x49')],null))['then'](respondWithResult(_0x752bc6,null))['catch'](handleError(_0x752bc6,null));};exports['destroy']=function(_0xbb10ab,_0x50dc83){return db['OpenchannelQueueReport'][_0x8073('0x48')]({'where':{'id':_0xbb10ab[_0x8073('0x46')]['id']}})[_0x8073('0x25')](handleEntityNotFound(_0x50dc83,null))[_0x8073('0x25')](removeEntity(_0x50dc83,null))['catch'](handleError(_0x50dc83,null));};exports[_0x8073('0x4a')]=function(_0x514025,_0x163a7f){return db[_0x8073('0x2b')][_0x8073('0x4a')]()[_0x8073('0x25')](respondWithResult(_0x163a7f,null))['catch'](handleError(_0x163a7f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e949565..f02acb6 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x52eb14,_0x44676a){var _0x4885d6=function(_0x1b9e3e){while(--_0x1b9e3e){_0x52eb14['push'](_0x52eb14['shift']());}};_0x4885d6(++_0x44676a);}(_0x7a54,0x106));var _0x47a5=function(_0x5672fb,_0x3ece29){_0x5672fb=_0x5672fb-0x0;var _0x59c176=_0x7a54[_0x5672fb];return _0x59c176;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x41556d,_0x2138e9){var _0x3a611e=function(_0x3ecb9c){while(--_0x3ecb9c){_0x41556d['push'](_0x41556d['shift']());}};_0x3a611e(++_0x2138e9);}(_0x326f,0xd1));var _0xf326=function(_0xbf7f46,_0x2cea15){_0xbf7f46=_0xbf7f46-0x0;var _0x26cb49=_0x326f[_0xbf7f46];return _0x26cb49;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 72a42ed..143c466 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x52ea8c,_0x1750d0){var _0x108340=function(_0x48e839){while(--_0x48e839){_0x52ea8c['push'](_0x52ea8c['shift']());}};_0x108340(++_0x1750d0);}(_0x5c3c,0x132));var _0xc5c3=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x5c3c[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![]})[_0xc5c3('0xd')](function(_0x3cc612){logger[_0xc5c3('0x15')](_0xc5c3('0x17'),_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x3cc612));_0x28bae6(_0x3cc612);})[_0xc5c3('0x1d')](function(_0x2de266){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x2de266[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2de266['message']));});});};exports[_0xc5c3('0x1e')]=function(_0x38dd9e){var _0x53ab72=this;return new Promise(function(_0x5c7329,_0x23e2fb){return db[_0xc5c3('0x18')][_0xc5c3('0x1f')](_0x38dd9e['body'],{'raw':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e[_0xc5c3('0x1b')]['where']||null:null,'attributes':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e['options'][_0xc5c3('0x20')]||null:null,'limit':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x21')]||null:null})[_0xc5c3('0xd')](function(_0x4773c5){logger[_0xc5c3('0x15')](_0xc5c3('0x1e'),_0x38dd9e);logger[_0xc5c3('0x22')]('UpdateOpenchannelQueueReport',_0x38dd9e,JSON[_0xc5c3('0x11')](_0x4773c5));_0x5c7329(_0x4773c5);})['catch'](function(_0xc4b134){logger[_0xc5c3('0x12')]('UpdateOpenchannelQueueReport',_0xc4b134['message'],_0x38dd9e);_0x23e2fb(_0x53ab72[_0xc5c3('0x12')](0x1f4,_0xc4b134[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0x23a3=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','raw','UpdateOpenchannelQueueReport','body','options','where','attributes','limit','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x23a3,0x131));var _0x323a=function(_0xb85d15,_0x4861d0){_0xb85d15=_0xb85d15-0x0;var _0xf7cc71=_0x23a3[_0xb85d15];return _0xf7cc71;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});}exports[_0x323a('0x17')]=function(_0x221ae4){var _0x2feed1=this;return new Promise(function(_0x29dd21,_0x303338){return db[_0x323a('0x18')]['create'](_0x221ae4['body'],{'raw':_0x221ae4['options']?_0x221ae4['options'][_0x323a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xc0f3e4){logger[_0x323a('0xc')](_0x323a('0x17'),_0x221ae4);logger[_0x323a('0xf')]('CreateOpenchannelQueueReport',_0x221ae4,JSON[_0x323a('0x11')](_0xc0f3e4));_0x29dd21(_0xc0f3e4);})['catch'](function(_0x12c8d7){logger[_0x323a('0x12')](_0x323a('0x17'),_0x12c8d7['message'],_0x221ae4);_0x303338(_0x2feed1[_0x323a('0x12')](0x1f4,_0x12c8d7[_0x323a('0x14')]));});});};exports[_0x323a('0x1a')]=function(_0x2960e0){var _0x35f8ec=this;return new Promise(function(_0x204f76,_0x5ba015){return db[_0x323a('0x18')]['update'](_0x2960e0[_0x323a('0x1b')],{'raw':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1d')]||null:null,'attributes':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x1e')]||null:null,'limit':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1f')]||null:null})['then'](function(_0x24747b){logger[_0x323a('0xc')](_0x323a('0x1a'),_0x2960e0);logger[_0x323a('0xf')](_0x323a('0x1a'),_0x2960e0,JSON[_0x323a('0x11')](_0x24747b));_0x204f76(_0x24747b);})['catch'](function(_0x2a1a85){logger[_0x323a('0x12')]('UpdateOpenchannelQueueReport',_0x2a1a85[_0x323a('0x14')],_0x2960e0);_0x5ba015(_0x35f8ec['error'](0x1f4,_0x2a1a85['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6b58306..d30477b 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 _0x9060=['/describe','describe','/:id','isAuthenticated','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index'];(function(_0x1572da,_0x2b9e53){var _0x132b7e=function(_0x10ab30){while(--_0x10ab30){_0x1572da['push'](_0x1572da['shift']());}};_0x132b7e(++_0x2b9e53);}(_0x9060,0x87));var _0x0906=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x9060[_0x9cfe28];return _0x54a1d0;};'use strict';var multer=require(_0x0906('0x0'));var util=require(_0x0906('0x1'));var path=require(_0x0906('0x2'));var timeout=require(_0x0906('0x3'));var express=require(_0x0906('0x4'));var router=express[_0x0906('0x5')]();var fs_extra=require(_0x0906('0x6'));var auth=require(_0x0906('0x7'));var interaction=require(_0x0906('0x8'));var config=require('../../config/environment');var controller=require(_0x0906('0x9'));router[_0x0906('0xa')]('/',auth['isAuthenticated'](),controller[_0x0906('0xb')]);router[_0x0906('0xa')](_0x0906('0xc'),auth['isAuthenticated'](),controller[_0x0906('0xd')]);router[_0x0906('0xa')](_0x0906('0xe'),auth[_0x0906('0xf')](),controller['show']);router[_0x0906('0x10')]('/',auth[_0x0906('0xf')](),controller['create']);router['put'](_0x0906('0xe'),auth[_0x0906('0xf')](),controller[_0x0906('0x11')]);router[_0x0906('0x12')]('/:id',auth[_0x0906('0xf')](),controller[_0x0906('0x13')]);module[_0x0906('0x14')]=router; \ No newline at end of file +var _0xc949=['post','create','put','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2dcce4,_0x544203){var _0x14867b=function(_0x8816bb){while(--_0x8816bb){_0x2dcce4['push'](_0x2dcce4['shift']());}};_0x14867b(++_0x544203);}(_0xc949,0x95));var _0x9c94=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xc949[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x9c94('0x0'));var util=require(_0x9c94('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9c94('0x2'));var router=express[_0x9c94('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9c94('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c94('0x5'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9c94('0x6')]);router[_0x9c94('0x7')](_0x9c94('0x8'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xa')]);router['get'](_0x9c94('0xb'),auth['isAuthenticated'](),controller[_0x9c94('0xc')]);router[_0x9c94('0xd')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xe')]);router[_0x9c94('0xf')](_0x9c94('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x10')]);module[_0x9c94('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ef371fb..45365e5 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x14c9c5,_0x16c438){var _0x51b5fe=function(_0x23ecb7){while(--_0x23ecb7){_0x14c9c5['push'](_0x14c9c5['shift']());}};_0x51b5fe(++_0x16c438);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x00bb[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3ac70c,_0x56e605){var _0x77f848=function(_0x484a55){while(--_0x484a55){_0x3ac70c['push'](_0x3ac70c['shift']());}};_0x77f848(++_0x56e605);}(_0xaa88,0x137));var _0x8aa8=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0xaa88[_0x21f3bf];return _0x249d08;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d840e99..19cc80c 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 _0x9f4c=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x171bc5,_0x135765){var _0x129bdf=function(_0x3351c3){while(--_0x3351c3){_0x171bc5['push'](_0x171bc5['shift']());}};_0x129bdf(++_0x135765);}(_0x9f4c,0x19a));var _0xc9f4=function(_0x4df9dc,_0x56ded0){_0x4df9dc=_0x4df9dc-0x0;var _0x507118=_0x9f4c[_0x4df9dc];return _0x507118;};'use strict';var emlformat=require(_0xc9f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9f4('0x2'));var moment=require(_0xc9f4('0x3'));var BPromise=require(_0xc9f4('0x4'));var Mustache=require(_0xc9f4('0x5'));var util=require('util');var path=require(_0xc9f4('0x6'));var sox=require(_0xc9f4('0x7'));var csv=require('to-csv');var ejs=require(_0xc9f4('0x8'));var fs=require('fs');var fs_extra=require(_0xc9f4('0x9'));var _=require(_0xc9f4('0xa'));var squel=require('squel');var crypto=require(_0xc9f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc9f4('0xc'));var toCsv=require(_0xc9f4('0xd'));var querystring=require(_0xc9f4('0xe'));var Papa=require(_0xc9f4('0xf'));var Redis=require(_0xc9f4('0x10'));var authService=require(_0xc9f4('0x11'));var qs=require(_0xc9f4('0x12'));var as=require(_0xc9f4('0x13'));var hardwareService=require(_0xc9f4('0x14'));var logger=require(_0xc9f4('0x15'))(_0xc9f4('0x16'));var utils=require(_0xc9f4('0x17'));var config=require(_0xc9f4('0x18'));var licenseUtil=require(_0xc9f4('0x19'));var db=require(_0xc9f4('0x1a'))['db'];function respondWithStatusCode(_0x424b4f,_0x32d264){_0x32d264=_0x32d264||0xcc;return function(_0x2db6fc){if(_0x2db6fc){return _0x424b4f['sendStatus'](_0x32d264);}return _0x424b4f['status'](_0x32d264)['end']();};}function respondWithResult(_0x56c2b0,_0x2de969){_0x2de969=_0x2de969||0xc8;return function(_0x592e21){if(_0x592e21){return _0x56c2b0[_0xc9f4('0x1b')](_0x2de969)[_0xc9f4('0x1c')](_0x592e21);}};}function respondWithFilteredResult(_0x53c6ad,_0xc95bbe){return function(_0x29c09c){if(_0x29c09c){var _0x124ea5=typeof _0xc95bbe[_0xc9f4('0x1d')]===_0xc9f4('0x1e')&&typeof _0xc95bbe[_0xc9f4('0x1f')]===_0xc9f4('0x1e');var _0x36c3ad=_0x29c09c[_0xc9f4('0x20')];var _0x5c30a3=_0x124ea5?0x0:_0xc95bbe[_0xc9f4('0x1d')];var _0x68f824=_0x124ea5?_0x29c09c[_0xc9f4('0x20')]:_0xc95bbe[_0xc9f4('0x1d')]+_0xc95bbe['limit'];var _0x561bb8;if(_0x68f824>=_0x36c3ad){_0x68f824=_0x36c3ad;_0x561bb8=0xc8;}else{_0x561bb8=0xce;}_0x53c6ad[_0xc9f4('0x1b')](_0x561bb8);return _0x53c6ad[_0xc9f4('0x21')](_0xc9f4('0x22'),_0x5c30a3+'-'+_0x68f824+'/'+_0x36c3ad)[_0xc9f4('0x1c')](_0x29c09c);}return null;};}function patchUpdates(_0x240850){return function(_0x35a79a){try{jsonpatch[_0xc9f4('0x23')](_0x35a79a,_0x240850,!![]);}catch(_0x1dfaf4){return BPromise['reject'](_0x1dfaf4);}return _0x35a79a[_0xc9f4('0x24')]();};}function saveUpdates(_0x21dd0c,_0x5f18bf){return function(_0x3f554a){if(_0x3f554a){return _0x3f554a[_0xc9f4('0x25')](_0x21dd0c)[_0xc9f4('0x26')](function(_0x2ac88b){return _0x2ac88b;});}return null;};}function removeEntity(_0x35eafc,_0x47236f){return function(_0x2ad1ab){if(_0x2ad1ab){return _0x2ad1ab['destroy']()[_0xc9f4('0x26')](function(){_0x35eafc[_0xc9f4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c393b,_0x28c8e9){return function(_0x21f811){if(!_0x21f811){_0x1c393b[_0xc9f4('0x27')](0x194);}return _0x21f811;};}function handleError(_0x4b3260,_0x503ab4){_0x503ab4=_0x503ab4||0x1f4;return function(_0x201f1c){logger[_0xc9f4('0x28')](_0x201f1c[_0xc9f4('0x29')]);if(_0x201f1c[_0xc9f4('0x2a')]){delete _0x201f1c[_0xc9f4('0x2a')];}_0x4b3260[_0xc9f4('0x1b')](_0x503ab4)[_0xc9f4('0x2b')](_0x201f1c);};}exports[_0xc9f4('0x2c')]=function(_0x54e416,_0x927a62){var _0x42007c={},_0x3debb3={},_0x1b3c96={'count':0x0,'rows':[]};var _0x25f1d5=_['map'](db[_0xc9f4('0x2d')][_0xc9f4('0x2e')],function(_0x4db97e){return{'name':_0x4db97e[_0xc9f4('0x2f')],'type':_0x4db97e[_0xc9f4('0x30')][_0xc9f4('0x31')]};});_0x3debb3[_0xc9f4('0x32')]=_[_0xc9f4('0x33')](_0x25f1d5,_0xc9f4('0x2a'));_0x3debb3[_0xc9f4('0x34')]=_[_0xc9f4('0x35')](_0x54e416[_0xc9f4('0x34')]);_0x3debb3['filters']=_[_0xc9f4('0x36')](_0x3debb3['model'],_0x3debb3['query']);_0x42007c[_0xc9f4('0x37')]=_[_0xc9f4('0x36')](_0x3debb3['model'],qs[_0xc9f4('0x38')](_0x54e416[_0xc9f4('0x34')]['fields']));_0x42007c[_0xc9f4('0x37')]=_0x42007c[_0xc9f4('0x37')]['length']?_0x42007c[_0xc9f4('0x37')]:_0x3debb3['model'];if(!_0x54e416['query'][_0xc9f4('0x39')](_0xc9f4('0x3a'))){_0x42007c['limit']=qs[_0xc9f4('0x1f')](_0x54e416[_0xc9f4('0x34')][_0xc9f4('0x1f')]);_0x42007c[_0xc9f4('0x1d')]=qs[_0xc9f4('0x1d')](_0x54e416[_0xc9f4('0x34')][_0xc9f4('0x1d')]);}_0x42007c[_0xc9f4('0x3b')]=qs[_0xc9f4('0x3c')](_0x54e416[_0xc9f4('0x34')][_0xc9f4('0x3c')]);_0x42007c[_0xc9f4('0x3d')]=qs[_0xc9f4('0x3e')](_[_0xc9f4('0x3f')](_0x54e416['query'],_0x3debb3[_0xc9f4('0x3e')]),_0x25f1d5);if(_0x54e416[_0xc9f4('0x34')]['filter']){_0x42007c[_0xc9f4('0x3d')]=_[_0xc9f4('0x40')](_0x42007c[_0xc9f4('0x3d')],{'$or':_[_0xc9f4('0x33')](_0x25f1d5,function(_0x112831){if(_0x112831[_0xc9f4('0x30')]!==_0xc9f4('0x41')){var _0x13653a={};_0x13653a[_0x112831[_0xc9f4('0x2a')]]={'$like':'%'+_0x54e416[_0xc9f4('0x34')]['filter']+'%'};return _0x13653a;}})});}_0x42007c=_[_0xc9f4('0x40')]({},_0x42007c,_0x54e416[_0xc9f4('0x42')]);var _0x2a9952={'where':_0x42007c[_0xc9f4('0x3d')]};return db[_0xc9f4('0x2d')][_0xc9f4('0x20')](_0x2a9952)[_0xc9f4('0x26')](function(_0x22dc9d){_0x1b3c96[_0xc9f4('0x20')]=_0x22dc9d;if(_0x54e416[_0xc9f4('0x34')][_0xc9f4('0x43')]){_0x42007c[_0xc9f4('0x44')]=[{'all':!![]}];}return db[_0xc9f4('0x2d')][_0xc9f4('0x45')](_0x42007c);})[_0xc9f4('0x26')](function(_0xdf148b){_0x1b3c96[_0xc9f4('0x46')]=_0xdf148b;return _0x1b3c96;})[_0xc9f4('0x26')](respondWithFilteredResult(_0x927a62,_0x42007c))[_0xc9f4('0x47')](handleError(_0x927a62,null));};exports[_0xc9f4('0x48')]=function(_0x36bdb5,_0x499f54){var _0x23ee9e={'raw':!![],'where':{'id':_0x36bdb5[_0xc9f4('0x49')]['id']}},_0x795d2a={};_0x795d2a[_0xc9f4('0x32')]=_['keys'](db[_0xc9f4('0x2d')]['rawAttributes']);_0x795d2a['query']=_[_0xc9f4('0x35')](_0x36bdb5[_0xc9f4('0x34')]);_0x795d2a['filters']=_[_0xc9f4('0x36')](_0x795d2a[_0xc9f4('0x32')],_0x795d2a[_0xc9f4('0x34')]);_0x23ee9e[_0xc9f4('0x37')]=_[_0xc9f4('0x36')](_0x795d2a['model'],qs[_0xc9f4('0x38')](_0x36bdb5[_0xc9f4('0x34')][_0xc9f4('0x38')]));_0x23ee9e[_0xc9f4('0x37')]=_0x23ee9e[_0xc9f4('0x37')]['length']?_0x23ee9e[_0xc9f4('0x37')]:_0x795d2a[_0xc9f4('0x32')];if(_0x36bdb5[_0xc9f4('0x34')][_0xc9f4('0x43')]){_0x23ee9e[_0xc9f4('0x44')]=[{'all':!![]}];}_0x23ee9e=_[_0xc9f4('0x40')]({},_0x23ee9e,_0x36bdb5[_0xc9f4('0x42')]);return db[_0xc9f4('0x2d')]['find'](_0x23ee9e)[_0xc9f4('0x26')](handleEntityNotFound(_0x499f54,null))[_0xc9f4('0x26')](respondWithResult(_0x499f54,null))[_0xc9f4('0x47')](handleError(_0x499f54,null));};exports[_0xc9f4('0x4a')]=function(_0x24e771,_0x43939a){return db[_0xc9f4('0x2d')][_0xc9f4('0x4a')](_0x24e771[_0xc9f4('0x4b')],{})['then'](respondWithResult(_0x43939a,0xc9))[_0xc9f4('0x47')](handleError(_0x43939a,null));};exports[_0xc9f4('0x25')]=function(_0x608ffe,_0x562892){if(_0x608ffe['body']['id']){delete _0x608ffe[_0xc9f4('0x4b')]['id'];}return db[_0xc9f4('0x2d')][_0xc9f4('0x4c')]({'where':{'id':_0x608ffe[_0xc9f4('0x49')]['id']}})['then'](handleEntityNotFound(_0x562892,null))[_0xc9f4('0x26')](saveUpdates(_0x608ffe[_0xc9f4('0x4b')],null))[_0xc9f4('0x26')](respondWithResult(_0x562892,null))[_0xc9f4('0x47')](handleError(_0x562892,null));};exports[_0xc9f4('0x4d')]=function(_0x258bc5,_0x5f0516){return db[_0xc9f4('0x2d')][_0xc9f4('0x4c')]({'where':{'id':_0x258bc5[_0xc9f4('0x49')]['id']}})[_0xc9f4('0x26')](handleEntityNotFound(_0x5f0516,null))[_0xc9f4('0x26')](removeEntity(_0x5f0516,null))[_0xc9f4('0x47')](handleError(_0x5f0516,null));};exports[_0xc9f4('0x4e')]=function(_0xcc31b6,_0x112b41){return db['OpenchannelTransferReport'][_0xc9f4('0x4e')]()['then'](respondWithResult(_0x112b41,null))[_0xc9f4('0x47')](handleError(_0x112b41,null));}; \ No newline at end of file +var _0x1d9c=['catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','OpenchannelTransferReport','includeAll','include','findAll','rows'];(function(_0x3676ed,_0xf7c543){var _0x299233=function(_0x4289bb){while(--_0x4289bb){_0x3676ed['push'](_0x3676ed['shift']());}};_0x299233(++_0xf7c543);}(_0x1d9c,0x14c));var _0xc1d9=function(_0xaa0140,_0xd6c719){_0xaa0140=_0xaa0140-0x0;var _0x11ac88=_0x1d9c[_0xaa0140];return _0x11ac88;};'use strict';var emlformat=require(_0xc1d9('0x0'));var rimraf=require(_0xc1d9('0x1'));var zipdir=require(_0xc1d9('0x2'));var jsonpatch=require(_0xc1d9('0x3'));var rp=require(_0xc1d9('0x4'));var moment=require(_0xc1d9('0x5'));var BPromise=require(_0xc1d9('0x6'));var Mustache=require(_0xc1d9('0x7'));var util=require(_0xc1d9('0x8'));var path=require(_0xc1d9('0x9'));var sox=require(_0xc1d9('0xa'));var csv=require(_0xc1d9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1d9('0xc'));var squel=require(_0xc1d9('0xd'));var crypto=require(_0xc1d9('0xe'));var jsforce=require(_0xc1d9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc1d9('0xb'));var querystring=require(_0xc1d9('0x10'));var Papa=require(_0xc1d9('0x11'));var Redis=require(_0xc1d9('0x12'));var authService=require(_0xc1d9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc1d9('0x14'));var hardwareService=require(_0xc1d9('0x15'));var logger=require(_0xc1d9('0x16'))(_0xc1d9('0x17'));var utils=require(_0xc1d9('0x18'));var config=require(_0xc1d9('0x19'));var licenseUtil=require(_0xc1d9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b7eeb,_0x21968b){_0x21968b=_0x21968b||0xcc;return function(_0x1a8b83){if(_0x1a8b83){return _0x4b7eeb[_0xc1d9('0x1b')](_0x21968b);}return _0x4b7eeb[_0xc1d9('0x1c')](_0x21968b)[_0xc1d9('0x1d')]();};}function respondWithResult(_0x2778df,_0x5a5799){_0x5a5799=_0x5a5799||0xc8;return function(_0x2f5261){if(_0x2f5261){return _0x2778df[_0xc1d9('0x1c')](_0x5a5799)['json'](_0x2f5261);}};}function respondWithFilteredResult(_0x718491,_0x2b027a){return function(_0xaa63bd){if(_0xaa63bd){var _0x5c579c=typeof _0x2b027a[_0xc1d9('0x1e')]===_0xc1d9('0x1f')&&typeof _0x2b027a[_0xc1d9('0x20')]===_0xc1d9('0x1f');var _0x4e1160=_0xaa63bd[_0xc1d9('0x21')];var _0x1c3ed2=_0x5c579c?0x0:_0x2b027a[_0xc1d9('0x1e')];var _0x9f07ea=_0x5c579c?_0xaa63bd[_0xc1d9('0x21')]:_0x2b027a[_0xc1d9('0x1e')]+_0x2b027a[_0xc1d9('0x20')];var _0x25dbf8;if(_0x9f07ea>=_0x4e1160){_0x9f07ea=_0x4e1160;_0x25dbf8=0xc8;}else{_0x25dbf8=0xce;}_0x718491[_0xc1d9('0x1c')](_0x25dbf8);return _0x718491[_0xc1d9('0x22')](_0xc1d9('0x23'),_0x1c3ed2+'-'+_0x9f07ea+'/'+_0x4e1160)[_0xc1d9('0x24')](_0xaa63bd);}return null;};}function patchUpdates(_0x22c292){return function(_0x19ae38){try{jsonpatch[_0xc1d9('0x25')](_0x19ae38,_0x22c292,!![]);}catch(_0x5cc862){return BPromise[_0xc1d9('0x26')](_0x5cc862);}return _0x19ae38[_0xc1d9('0x27')]();};}function saveUpdates(_0x2d2ab9,_0x2a95e3){return function(_0x1ae0b1){if(_0x1ae0b1){return _0x1ae0b1[_0xc1d9('0x28')](_0x2d2ab9)[_0xc1d9('0x29')](function(_0x445d26){return _0x445d26;});}return null;};}function removeEntity(_0x24fcdb,_0x8832f4){return function(_0x4ce798){if(_0x4ce798){return _0x4ce798[_0xc1d9('0x2a')]()[_0xc1d9('0x29')](function(){_0x24fcdb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0253,_0x4ec3fe){return function(_0x132cdd){if(!_0x132cdd){_0x1d0253[_0xc1d9('0x1b')](0x194);}return _0x132cdd;};}function handleError(_0x44c3bd,_0x329dc3){_0x329dc3=_0x329dc3||0x1f4;return function(_0x11de3e){logger['error'](_0x11de3e[_0xc1d9('0x2b')]);if(_0x11de3e[_0xc1d9('0x2c')]){delete _0x11de3e['name'];}_0x44c3bd[_0xc1d9('0x1c')](_0x329dc3)[_0xc1d9('0x2d')](_0x11de3e);};}exports[_0xc1d9('0x2e')]=function(_0x323947,_0x14c771){var _0x24501e={},_0x77c654={},_0x23add5={'count':0x0,'rows':[]};var _0x436eb3=_[_0xc1d9('0x2f')](db['OpenchannelTransferReport'][_0xc1d9('0x30')],function(_0x571de5){return{'name':_0x571de5[_0xc1d9('0x31')],'type':_0x571de5[_0xc1d9('0x32')][_0xc1d9('0x33')]};});_0x77c654['model']=_[_0xc1d9('0x2f')](_0x436eb3,'name');_0x77c654[_0xc1d9('0x34')]=_[_0xc1d9('0x35')](_0x323947[_0xc1d9('0x34')]);_0x77c654[_0xc1d9('0x36')]=_[_0xc1d9('0x37')](_0x77c654[_0xc1d9('0x38')],_0x77c654[_0xc1d9('0x34')]);_0x24501e[_0xc1d9('0x39')]=_['intersection'](_0x77c654[_0xc1d9('0x38')],qs[_0xc1d9('0x3a')](_0x323947[_0xc1d9('0x34')][_0xc1d9('0x3a')]));_0x24501e['attributes']=_0x24501e['attributes']['length']?_0x24501e[_0xc1d9('0x39')]:_0x77c654[_0xc1d9('0x38')];if(!_0x323947[_0xc1d9('0x34')][_0xc1d9('0x3b')](_0xc1d9('0x3c'))){_0x24501e['limit']=qs['limit'](_0x323947['query'][_0xc1d9('0x20')]);_0x24501e[_0xc1d9('0x1e')]=qs['offset'](_0x323947[_0xc1d9('0x34')][_0xc1d9('0x1e')]);}_0x24501e['order']=qs['sort'](_0x323947[_0xc1d9('0x34')][_0xc1d9('0x3d')]);_0x24501e['where']=qs[_0xc1d9('0x36')](_[_0xc1d9('0x3e')](_0x323947[_0xc1d9('0x34')],_0x77c654['filters']),_0x436eb3);if(_0x323947[_0xc1d9('0x34')]['filter']){_0x24501e[_0xc1d9('0x3f')]=_[_0xc1d9('0x40')](_0x24501e[_0xc1d9('0x3f')],{'$or':_[_0xc1d9('0x2f')](_0x436eb3,function(_0x4b04f5){if(_0x4b04f5[_0xc1d9('0x32')]!==_0xc1d9('0x41')){var _0x30d632={};_0x30d632[_0x4b04f5[_0xc1d9('0x2c')]]={'$like':'%'+_0x323947[_0xc1d9('0x34')][_0xc1d9('0x42')]+'%'};return _0x30d632;}})});}_0x24501e=_[_0xc1d9('0x40')]({},_0x24501e,_0x323947[_0xc1d9('0x43')]);var _0x4b2141={'where':_0x24501e[_0xc1d9('0x3f')]};return db[_0xc1d9('0x44')]['count'](_0x4b2141)[_0xc1d9('0x29')](function(_0x3cfa3f){_0x23add5[_0xc1d9('0x21')]=_0x3cfa3f;if(_0x323947['query'][_0xc1d9('0x45')]){_0x24501e[_0xc1d9('0x46')]=[{'all':!![]}];}return db[_0xc1d9('0x44')][_0xc1d9('0x47')](_0x24501e);})[_0xc1d9('0x29')](function(_0x19d313){_0x23add5[_0xc1d9('0x48')]=_0x19d313;return _0x23add5;})[_0xc1d9('0x29')](respondWithFilteredResult(_0x14c771,_0x24501e))[_0xc1d9('0x49')](handleError(_0x14c771,null));};exports[_0xc1d9('0x4a')]=function(_0x2b2e45,_0x541b92){var _0x2d8023={'raw':!![],'where':{'id':_0x2b2e45[_0xc1d9('0x4b')]['id']}},_0xa97238={};_0xa97238[_0xc1d9('0x38')]=_[_0xc1d9('0x35')](db['OpenchannelTransferReport'][_0xc1d9('0x30')]);_0xa97238['query']=_['keys'](_0x2b2e45[_0xc1d9('0x34')]);_0xa97238['filters']=_['intersection'](_0xa97238[_0xc1d9('0x38')],_0xa97238[_0xc1d9('0x34')]);_0x2d8023['attributes']=_['intersection'](_0xa97238['model'],qs[_0xc1d9('0x3a')](_0x2b2e45['query']['fields']));_0x2d8023[_0xc1d9('0x39')]=_0x2d8023['attributes'][_0xc1d9('0x4c')]?_0x2d8023[_0xc1d9('0x39')]:_0xa97238[_0xc1d9('0x38')];if(_0x2b2e45[_0xc1d9('0x34')]['includeAll']){_0x2d8023[_0xc1d9('0x46')]=[{'all':!![]}];}_0x2d8023=_['merge']({},_0x2d8023,_0x2b2e45[_0xc1d9('0x43')]);return db['OpenchannelTransferReport']['find'](_0x2d8023)[_0xc1d9('0x29')](handleEntityNotFound(_0x541b92,null))[_0xc1d9('0x29')](respondWithResult(_0x541b92,null))[_0xc1d9('0x49')](handleError(_0x541b92,null));};exports[_0xc1d9('0x4d')]=function(_0x1b95fb,_0x4757d0){return db[_0xc1d9('0x44')][_0xc1d9('0x4d')](_0x1b95fb[_0xc1d9('0x4e')],{})[_0xc1d9('0x29')](respondWithResult(_0x4757d0,0xc9))['catch'](handleError(_0x4757d0,null));};exports['update']=function(_0x38a1f9,_0x4aff38){if(_0x38a1f9[_0xc1d9('0x4e')]['id']){delete _0x38a1f9[_0xc1d9('0x4e')]['id'];}return db[_0xc1d9('0x44')][_0xc1d9('0x4f')]({'where':{'id':_0x38a1f9[_0xc1d9('0x4b')]['id']}})[_0xc1d9('0x29')](handleEntityNotFound(_0x4aff38,null))[_0xc1d9('0x29')](saveUpdates(_0x38a1f9[_0xc1d9('0x4e')],null))[_0xc1d9('0x29')](respondWithResult(_0x4aff38,null))[_0xc1d9('0x49')](handleError(_0x4aff38,null));};exports[_0xc1d9('0x2a')]=function(_0x42ac86,_0x50e5da){return db[_0xc1d9('0x44')]['find']({'where':{'id':_0x42ac86[_0xc1d9('0x4b')]['id']}})[_0xc1d9('0x29')](handleEntityNotFound(_0x50e5da,null))[_0xc1d9('0x29')](removeEntity(_0x50e5da,null))[_0xc1d9('0x49')](handleError(_0x50e5da,null));};exports['describe']=function(_0x4d4c04,_0x4155d2){return db['OpenchannelTransferReport'][_0xc1d9('0x50')]()[_0xc1d9('0x29')](respondWithResult(_0x4155d2,null))['catch'](handleError(_0x4155d2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c27fe7c..89c8b86 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 _0x4693=['request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x53a023,_0xb03e6a){var _0xb9582e=function(_0x5d1798){while(--_0x5d1798){_0x53a023['push'](_0x53a023['shift']());}};_0xb9582e(++_0xb03e6a);}(_0x4693,0xcd));var _0x3469=function(_0x478f1f,_0x496105){_0x478f1f=_0x478f1f-0x0;var _0x4100a0=_0x4693[_0x478f1f];return _0x4100a0;};'use strict';var _=require('lodash');var util=require(_0x3469('0x0'));var logger=require(_0x3469('0x1'))(_0x3469('0x2'));var moment=require(_0x3469('0x3'));var BPromise=require('bluebird');var rp=require(_0x3469('0x4'));var fs=require('fs');var path=require(_0x3469('0x5'));var rimraf=require('rimraf');var config=require(_0x3469('0x6'));var attributes=require(_0x3469('0x7'));module[_0x3469('0x8')]=function(_0x140c4f,_0x2564d7){return _0x140c4f['define'](_0x3469('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3469('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5841=['lodash','util','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes','define','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5841,0x132));var _0x1584=function(_0x55557e,_0x526cd6){_0x55557e=_0x55557e-0x0;var _0x25edf5=_0x5841[_0x55557e];return _0x25edf5;};'use strict';var _=require(_0x1584('0x0'));var util=require(_0x1584('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1584('0x2'));var BPromise=require(_0x1584('0x3'));var rp=require(_0x1584('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1584('0x5'));var attributes=require(_0x1584('0x6'));module['exports']=function(_0x8070cd,_0x24ece4){return _0x8070cd[_0x1584('0x7')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x1584('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3357578..29b3990 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 _0x943c=['stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x7758f8,_0x1c3b28){var _0x5c3cab=function(_0x1a4176){while(--_0x1a4176){_0x7758f8['push'](_0x7758f8['shift']());}};_0x5c3cab(++_0x1c3b28);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var moment=require(_0xc943('0x2'));var BPromise=require(_0xc943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc943('0x4'))['db'];var utils=require(_0xc943('0x5'));var logger=require(_0xc943('0x6'))('rpc');var config=require(_0xc943('0x7'));var jayson=require(_0xc943('0x8'));var client=jayson[_0xc943('0x9')][_0xc943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b73ad,_0x4091fd,_0x3f718f){return new BPromise(function(_0x56e665,_0x3ec7da){return client[_0xc943('0xb')](_0x1b73ad,_0x3f718f)[_0xc943('0xc')](function(_0x455eed){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));logger[_0xc943('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4091fd,'request\x20sent',JSON[_0xc943('0xf')](_0x455eed));if(_0x455eed[_0xc943('0x10')]){if(_0x455eed[_0xc943('0x10')][_0xc943('0x11')]===0x1f4){logger[_0xc943('0x10')](_0xc943('0x12'),_0x4091fd,_0x455eed['error'][_0xc943('0x13')]);return _0x3ec7da(_0x455eed[_0xc943('0x10')]['message']);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0x455eed[_0xc943('0x10')][_0xc943('0x13')]);return _0x56e665(_0x455eed['error'][_0xc943('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));_0x56e665(_0x455eed['result'][_0xc943('0x13')]);}})[_0xc943('0x14')](function(_0x1eb50a){logger[_0xc943('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0x1eb50a);_0x3ec7da(_0x1eb50a);});});} \ No newline at end of file +var _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x113bef,_0x82b4a5){var _0x3b6d82=function(_0xc0df02){while(--_0xc0df02){_0x113bef['push'](_0x113bef['shift']());}};_0x3b6d82(++_0x82b4a5);}(_0x7c09,0x102));var _0x97c0=function(_0x4b1573,_0x746985){_0x4b1573=_0x4b1573-0x0;var _0x3ca77d=_0x7c09[_0x4b1573];return _0x3ca77d;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d6713ce..9010a84 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 _0xf219=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0xf219,0x179));var _0x9f21=function(_0x5bc75a,_0x38ce5c){_0x5bc75a=_0x5bc75a-0x0;var _0x51abb3=_0xf219[_0x5bc75a];return _0x51abb3;};'use strict';var multer=require('multer');var util=require(_0x9f21('0x0'));var path=require('path');var timeout=require(_0x9f21('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f21('0x2'));var auth=require(_0x9f21('0x3'));var interaction=require(_0x9f21('0x4'));var config=require(_0x9f21('0x5'));var controller=require(_0x9f21('0x6'));router[_0x9f21('0x7')]('/',auth[_0x9f21('0x8')](),controller[_0x9f21('0x9')]);router[_0x9f21('0x7')](_0x9f21('0xa'),auth[_0x9f21('0x8')](),controller[_0x9f21('0xb')]);router[_0x9f21('0xc')]('/',auth[_0x9f21('0x8')](),controller[_0x9f21('0xd')]);router['put'](_0x9f21('0xa'),auth['isAuthenticated'](),controller[_0x9f21('0xe')]);router[_0x9f21('0xf')](_0x9f21('0xa'),auth[_0x9f21('0x8')](),controller[_0x9f21('0x10')]);module[_0x9f21('0x11')]=router; \ No newline at end of file +var _0xfaba=['put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','./pause.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x11d5ed,_0x2f0b6d){var _0x3af45f=function(_0x247813){while(--_0x247813){_0x11d5ed['push'](_0x11d5ed['shift']());}};_0x3af45f(++_0x2f0b6d);}(_0xfaba,0x16a));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xafab('0x0'));var util=require(_0xafab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xafab('0x2')]();var fs_extra=require(_0xafab('0x3'));var auth=require(_0xafab('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xafab('0x5'));router[_0xafab('0x6')]('/',auth[_0xafab('0x7')](),controller['index']);router[_0xafab('0x6')](_0xafab('0x8'),auth['isAuthenticated'](),controller[_0xafab('0x9')]);router[_0xafab('0xa')]('/',auth['isAuthenticated'](),controller[_0xafab('0xb')]);router[_0xafab('0xc')](_0xafab('0x8'),auth['isAuthenticated'](),controller[_0xafab('0xd')]);router[_0xafab('0xe')](_0xafab('0x8'),auth[_0xafab('0x7')](),controller[_0xafab('0xf')]);module[_0xafab('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 6fb462c..95ae0ba 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 _0xdb6f=['STRING','name','exports'];(function(_0x4a7d6c,_0x35cc3f){var _0x3dbeb7=function(_0x46896c){while(--_0x46896c){_0x4a7d6c['push'](_0x4a7d6c['shift']());}};_0x3dbeb7(++_0x35cc3f);}(_0xdb6f,0x143));var _0xfdb6=function(_0x3ce53d,_0x1cda93){_0x3ce53d=_0x3ce53d-0x0;var _0x5c36ed=_0xdb6f[_0x3ce53d];return _0x5c36ed;};'use strict';var Sequelize=require('sequelize');module[_0xfdb6('0x0')]={'name':{'type':Sequelize[_0xfdb6('0x1')],'unique':_0xfdb6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xfdb6('0x1')]}}; \ No newline at end of file +var _0xce17=['name','STRING','exports'];(function(_0x4c887e,_0x422965){var _0x135a75=function(_0x42d528){while(--_0x42d528){_0x4c887e['push'](_0x4c887e['shift']());}};_0x135a75(++_0x422965);}(_0xce17,0x164));var _0x7ce1=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0xce17[_0x3f6bcf];return _0x1c5350;};'use strict';var Sequelize=require('sequelize');module[_0x7ce1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ce1('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x7ce1('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6aa504f..06a0745 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 _0xa66e=['../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','map','Pause','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','include','catch','show','params','rawAttributes','includeAll','create','body','user','role','Pauses','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x48840c,_0x259771){var _0x862920=function(_0x1d3114){while(--_0x1d3114){_0x48840c['push'](_0x48840c['shift']());}};_0x862920(++_0x259771);}(_0xa66e,0x189));var _0xea66=function(_0x94a671,_0x26d360){_0x94a671=_0x94a671-0x0;var _0x2e8274=_0xa66e[_0x94a671];return _0x2e8274;};'use strict';var emlformat=require(_0xea66('0x0'));var rimraf=require(_0xea66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea66('0x2'));var rp=require(_0xea66('0x3'));var moment=require(_0xea66('0x4'));var BPromise=require(_0xea66('0x5'));var Mustache=require(_0xea66('0x6'));var util=require(_0xea66('0x7'));var path=require(_0xea66('0x8'));var sox=require(_0xea66('0x9'));var csv=require(_0xea66('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea66('0xb'));var _=require('lodash');var squel=require(_0xea66('0xc'));var crypto=require(_0xea66('0xd'));var jsforce=require(_0xea66('0xe'));var deskjs=require(_0xea66('0xf'));var toCsv=require(_0xea66('0xa'));var querystring=require(_0xea66('0x10'));var Papa=require(_0xea66('0x11'));var Redis=require(_0xea66('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xea66('0x13'));var as=require(_0xea66('0x14'));var hardwareService=require(_0xea66('0x15'));var logger=require(_0xea66('0x16'))('api');var utils=require(_0xea66('0x17'));var config=require(_0xea66('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1da2d9,_0x29573c){_0x29573c=_0x29573c||0xcc;return function(_0x1d884a){if(_0x1d884a){return _0x1da2d9['sendStatus'](_0x29573c);}return _0x1da2d9[_0xea66('0x19')](_0x29573c)[_0xea66('0x1a')]();};}function respondWithResult(_0x3fcf57,_0x506545){_0x506545=_0x506545||0xc8;return function(_0x2468b2){if(_0x2468b2){return _0x3fcf57[_0xea66('0x19')](_0x506545)['json'](_0x2468b2);}};}function respondWithFilteredResult(_0x1aae33,_0x5d9c28){return function(_0x58504b){if(_0x58504b){var _0x423b00=typeof _0x5d9c28[_0xea66('0x1b')]===_0xea66('0x1c')&&typeof _0x5d9c28[_0xea66('0x1d')]===_0xea66('0x1c');var _0x5e38da=_0x58504b[_0xea66('0x1e')];var _0x7efb1c=_0x423b00?0x0:_0x5d9c28['offset'];var _0x53eafe=_0x423b00?_0x58504b[_0xea66('0x1e')]:_0x5d9c28['offset']+_0x5d9c28[_0xea66('0x1d')];var _0x231286;if(_0x53eafe>=_0x5e38da){_0x53eafe=_0x5e38da;_0x231286=0xc8;}else{_0x231286=0xce;}_0x1aae33['status'](_0x231286);return _0x1aae33[_0xea66('0x1f')](_0xea66('0x20'),_0x7efb1c+'-'+_0x53eafe+'/'+_0x5e38da)[_0xea66('0x21')](_0x58504b);}return null;};}function patchUpdates(_0x23b7e7){return function(_0x3c8a34){try{jsonpatch[_0xea66('0x22')](_0x3c8a34,_0x23b7e7,!![]);}catch(_0x2bd473){return BPromise[_0xea66('0x23')](_0x2bd473);}return _0x3c8a34[_0xea66('0x24')]();};}function saveUpdates(_0x8a2456,_0x123658){return function(_0x5ee06f){if(_0x5ee06f){return _0x5ee06f[_0xea66('0x25')](_0x8a2456)['then'](function(_0x2ed660){return _0x2ed660;});}return null;};}function removeEntity(_0x90aa41,_0x48e5f2){return function(_0x4f6b0a){if(_0x4f6b0a){return _0x4f6b0a[_0xea66('0x26')]()[_0xea66('0x27')](function(){var _0x29285e=_0x4f6b0a[_0xea66('0x28')]({'plain':!![]});var _0x5abcca='Pauses';return db[_0xea66('0x29')][_0xea66('0x26')]({'where':{'type':_0x5abcca,'resourceId':_0x29285e['id']}})[_0xea66('0x27')](function(){return _0x4f6b0a;});})[_0xea66('0x27')](function(){_0x90aa41[_0xea66('0x19')](0xcc)[_0xea66('0x1a')]();});}};}function handleEntityNotFound(_0x2e7ed0,_0x124ffe){return function(_0x77a8b5){if(!_0x77a8b5){_0x2e7ed0[_0xea66('0x2a')](0x194);}return _0x77a8b5;};}function handleError(_0x13ffe,_0x3c5ec5){_0x3c5ec5=_0x3c5ec5||0x1f4;return function(_0x3bd46a){logger['error'](_0x3bd46a[_0xea66('0x2b')]);if(_0x3bd46a['name']){delete _0x3bd46a[_0xea66('0x2c')];}_0x13ffe['status'](_0x3c5ec5)[_0xea66('0x2d')](_0x3bd46a);};}exports['index']=function(_0x5363a4,_0x84f2ef){var _0x51a7b2={},_0x49ebea={},_0x330702={'count':0x0,'rows':[]};var _0x4d032a=_[_0xea66('0x2e')](db[_0xea66('0x2f')]['rawAttributes'],function(_0x23ce38){return{'name':_0x23ce38[_0xea66('0x30')],'type':_0x23ce38[_0xea66('0x31')][_0xea66('0x32')]};});_0x49ebea[_0xea66('0x33')]=_[_0xea66('0x2e')](_0x4d032a,'name');_0x49ebea[_0xea66('0x34')]=_[_0xea66('0x35')](_0x5363a4[_0xea66('0x34')]);_0x49ebea['filters']=_[_0xea66('0x36')](_0x49ebea[_0xea66('0x33')],_0x49ebea['query']);_0x51a7b2[_0xea66('0x37')]=_[_0xea66('0x36')](_0x49ebea[_0xea66('0x33')],qs[_0xea66('0x38')](_0x5363a4[_0xea66('0x34')][_0xea66('0x38')]));_0x51a7b2[_0xea66('0x37')]=_0x51a7b2[_0xea66('0x37')][_0xea66('0x39')]?_0x51a7b2[_0xea66('0x37')]:_0x49ebea[_0xea66('0x33')];if(!_0x5363a4[_0xea66('0x34')][_0xea66('0x3a')](_0xea66('0x3b'))){_0x51a7b2[_0xea66('0x1d')]=qs[_0xea66('0x1d')](_0x5363a4[_0xea66('0x34')]['limit']);_0x51a7b2[_0xea66('0x1b')]=qs['offset'](_0x5363a4['query'][_0xea66('0x1b')]);}_0x51a7b2[_0xea66('0x3c')]=qs[_0xea66('0x3d')](_0x5363a4['query']['sort']);_0x51a7b2['where']=qs[_0xea66('0x3e')](_['pick'](_0x5363a4['query'],_0x49ebea[_0xea66('0x3e')]),_0x4d032a);if(_0x5363a4[_0xea66('0x34')][_0xea66('0x3f')]){_0x51a7b2[_0xea66('0x40')]=_[_0xea66('0x41')](_0x51a7b2[_0xea66('0x40')],{'$or':_['map'](_0x4d032a,function(_0x676b7c){if(_0x676b7c[_0xea66('0x31')]!=='VIRTUAL'){var _0x487419={};_0x487419[_0x676b7c['name']]={'$like':'%'+_0x5363a4[_0xea66('0x34')]['filter']+'%'};return _0x487419;}})});}_0x51a7b2=_[_0xea66('0x41')]({},_0x51a7b2,_0x5363a4[_0xea66('0x42')]);var _0x3313d7={'where':_0x51a7b2[_0xea66('0x40')]};return db[_0xea66('0x2f')][_0xea66('0x1e')](_0x3313d7)[_0xea66('0x27')](function(_0x1622bf){_0x330702[_0xea66('0x1e')]=_0x1622bf;if(_0x5363a4['query']['includeAll']){_0x51a7b2[_0xea66('0x43')]=[{'all':!![]}];}return db[_0xea66('0x2f')]['findAll'](_0x51a7b2);})[_0xea66('0x27')](function(_0x503c36){_0x330702['rows']=_0x503c36;return _0x330702;})['then'](respondWithFilteredResult(_0x84f2ef,_0x51a7b2))[_0xea66('0x44')](handleError(_0x84f2ef,null));};exports[_0xea66('0x45')]=function(_0x7b2a6d,_0x1e23e3){var _0x33d139={'raw':!![],'where':{'id':_0x7b2a6d[_0xea66('0x46')]['id']}},_0x58c548={};_0x58c548[_0xea66('0x33')]=_[_0xea66('0x35')](db[_0xea66('0x2f')][_0xea66('0x47')]);_0x58c548[_0xea66('0x34')]=_[_0xea66('0x35')](_0x7b2a6d['query']);_0x58c548[_0xea66('0x3e')]=_[_0xea66('0x36')](_0x58c548[_0xea66('0x33')],_0x58c548[_0xea66('0x34')]);_0x33d139['attributes']=_[_0xea66('0x36')](_0x58c548[_0xea66('0x33')],qs[_0xea66('0x38')](_0x7b2a6d[_0xea66('0x34')][_0xea66('0x38')]));_0x33d139[_0xea66('0x37')]=_0x33d139[_0xea66('0x37')][_0xea66('0x39')]?_0x33d139[_0xea66('0x37')]:_0x58c548[_0xea66('0x33')];if(_0x7b2a6d[_0xea66('0x34')][_0xea66('0x48')]){_0x33d139['include']=[{'all':!![]}];}_0x33d139=_['merge']({},_0x33d139,_0x7b2a6d['options']);return db[_0xea66('0x2f')]['find'](_0x33d139)[_0xea66('0x27')](handleEntityNotFound(_0x1e23e3,null))[_0xea66('0x27')](respondWithResult(_0x1e23e3,null))[_0xea66('0x44')](handleError(_0x1e23e3,null));};exports[_0xea66('0x49')]=function(_0x1cadc1,_0x422705){return db['Pause'][_0xea66('0x49')](_0x1cadc1[_0xea66('0x4a')],{})[_0xea66('0x27')](function(_0x44fd99){var _0x4fddd6=_0x1cadc1[_0xea66('0x4b')]['get']({'plain':!![]});if(!_0x4fddd6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fddd6[_0xea66('0x4c')]===_0xea66('0x4b')){var _0x257056=_0x44fd99['get']({'plain':!![]});var _0x27f033=_0xea66('0x4d');return db['UserProfileSection'][_0xea66('0x4e')]({'where':{'name':_0x27f033,'userProfileId':_0x4fddd6[_0xea66('0x4f')]},'raw':!![]})[_0xea66('0x27')](function(_0xd00040){if(_0xd00040&&_0xd00040[_0xea66('0x50')]===0x0){return db[_0xea66('0x29')][_0xea66('0x49')]({'name':_0x257056[_0xea66('0x2c')],'resourceId':_0x257056['id'],'type':_0xd00040[_0xea66('0x2c')],'sectionId':_0xd00040['id']},{})[_0xea66('0x27')](function(){return _0x44fd99;});}else{return _0x44fd99;}})[_0xea66('0x44')](function(_0x3295d6){logger[_0xea66('0x51')](_0xea66('0x52'),_0x3295d6);throw _0x3295d6;});}return _0x44fd99;})[_0xea66('0x27')](respondWithResult(_0x422705,0xc9))[_0xea66('0x44')](handleError(_0x422705,null));};exports['update']=function(_0x5e5063,_0x51ee7a){if(_0x5e5063[_0xea66('0x4a')]['id']){delete _0x5e5063['body']['id'];}return db[_0xea66('0x2f')]['find']({'where':{'id':_0x5e5063[_0xea66('0x46')]['id']}})[_0xea66('0x27')](handleEntityNotFound(_0x51ee7a,null))['then'](saveUpdates(_0x5e5063['body'],null))[_0xea66('0x27')](respondWithResult(_0x51ee7a,null))['catch'](handleError(_0x51ee7a,null));};exports[_0xea66('0x26')]=function(_0x156f06,_0x22d36a){return db['Pause']['find']({'where':{'id':_0x156f06[_0xea66('0x46')]['id']}})[_0xea66('0x27')](handleEntityNotFound(_0x22d36a,null))[_0xea66('0x27')](removeEntity(_0x22d36a,null))[_0xea66('0x44')](handleError(_0x22d36a,null));}; \ No newline at end of file +var _0x057b=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','name','send','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x2702f5,_0x3c5883){var _0x347695=function(_0x41fb1b){while(--_0x41fb1b){_0x2702f5['push'](_0x2702f5['shift']());}};_0x347695(++_0x3c5883);}(_0x057b,0x117));var _0xb057=function(_0x12dc7b,_0xa01bc8){_0x12dc7b=_0x12dc7b-0x0;var _0x2e61c4=_0x057b[_0x12dc7b];return _0x2e61c4;};'use strict';var emlformat=require(_0xb057('0x0'));var rimraf=require(_0xb057('0x1'));var zipdir=require(_0xb057('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb057('0x3'));var moment=require(_0xb057('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb057('0x5'));var path=require(_0xb057('0x6'));var sox=require(_0xb057('0x7'));var csv=require('to-csv');var ejs=require(_0xb057('0x8'));var fs=require('fs');var fs_extra=require(_0xb057('0x9'));var _=require(_0xb057('0xa'));var squel=require(_0xb057('0xb'));var crypto=require('crypto');var jsforce=require(_0xb057('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb057('0xd'));var querystring=require(_0xb057('0xe'));var Papa=require(_0xb057('0xf'));var Redis=require(_0xb057('0x10'));var authService=require(_0xb057('0x11'));var qs=require(_0xb057('0x12'));var as=require(_0xb057('0x13'));var hardwareService=require(_0xb057('0x14'));var logger=require(_0xb057('0x15'))(_0xb057('0x16'));var utils=require(_0xb057('0x17'));var config=require(_0xb057('0x18'));var licenseUtil=require(_0xb057('0x19'));var db=require(_0xb057('0x1a'))['db'];function respondWithStatusCode(_0xd6d940,_0x45975f){_0x45975f=_0x45975f||0xcc;return function(_0x29d12e){if(_0x29d12e){return _0xd6d940[_0xb057('0x1b')](_0x45975f);}return _0xd6d940[_0xb057('0x1c')](_0x45975f)[_0xb057('0x1d')]();};}function respondWithResult(_0x448ffa,_0x3e36e4){_0x3e36e4=_0x3e36e4||0xc8;return function(_0x552982){if(_0x552982){return _0x448ffa['status'](_0x3e36e4)[_0xb057('0x1e')](_0x552982);}};}function respondWithFilteredResult(_0x1427a1,_0x39a894){return function(_0x11560b){if(_0x11560b){var _0x461dc7=typeof _0x39a894[_0xb057('0x1f')]===_0xb057('0x20')&&typeof _0x39a894[_0xb057('0x21')]===_0xb057('0x20');var _0x52a99d=_0x11560b[_0xb057('0x22')];var _0x31dfd1=_0x461dc7?0x0:_0x39a894['offset'];var _0x5814d5=_0x461dc7?_0x11560b[_0xb057('0x22')]:_0x39a894[_0xb057('0x1f')]+_0x39a894['limit'];var _0x515078;if(_0x5814d5>=_0x52a99d){_0x5814d5=_0x52a99d;_0x515078=0xc8;}else{_0x515078=0xce;}_0x1427a1[_0xb057('0x1c')](_0x515078);return _0x1427a1[_0xb057('0x23')](_0xb057('0x24'),_0x31dfd1+'-'+_0x5814d5+'/'+_0x52a99d)[_0xb057('0x1e')](_0x11560b);}return null;};}function patchUpdates(_0x23d98d){return function(_0x4e58ef){try{jsonpatch[_0xb057('0x25')](_0x4e58ef,_0x23d98d,!![]);}catch(_0x100d07){return BPromise['reject'](_0x100d07);}return _0x4e58ef[_0xb057('0x26')]();};}function saveUpdates(_0x17b2a7,_0x54b189){return function(_0x472129){if(_0x472129){return _0x472129[_0xb057('0x27')](_0x17b2a7)[_0xb057('0x28')](function(_0x7bc52){return _0x7bc52;});}return null;};}function removeEntity(_0xbb1153,_0x572b14){return function(_0x1aded1){if(_0x1aded1){return _0x1aded1['destroy']()[_0xb057('0x28')](function(){var _0x1f0ff7=_0x1aded1[_0xb057('0x29')]({'plain':!![]});var _0x37a021='Pauses';return db[_0xb057('0x2a')][_0xb057('0x2b')]({'where':{'type':_0x37a021,'resourceId':_0x1f0ff7['id']}})[_0xb057('0x28')](function(){return _0x1aded1;});})[_0xb057('0x28')](function(){_0xbb1153[_0xb057('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb89d,_0x13c225){return function(_0x236cc9){if(!_0x236cc9){_0x5cb89d[_0xb057('0x1b')](0x194);}return _0x236cc9;};}function handleError(_0x5ef252,_0x5a3fd0){_0x5a3fd0=_0x5a3fd0||0x1f4;return function(_0x57679f){logger['error'](_0x57679f['stack']);if(_0x57679f[_0xb057('0x2c')]){delete _0x57679f[_0xb057('0x2c')];}_0x5ef252[_0xb057('0x1c')](_0x5a3fd0)[_0xb057('0x2d')](_0x57679f);};}exports['index']=function(_0x53404e,_0x6f534c){var _0x265d0c={},_0xf00130={},_0xe68ca0={'count':0x0,'rows':[]};var _0x40da57=_[_0xb057('0x2e')](db[_0xb057('0x2f')][_0xb057('0x30')],function(_0x45857c){return{'name':_0x45857c[_0xb057('0x31')],'type':_0x45857c[_0xb057('0x32')][_0xb057('0x33')]};});_0xf00130[_0xb057('0x34')]=_[_0xb057('0x2e')](_0x40da57,_0xb057('0x2c'));_0xf00130['query']=_[_0xb057('0x35')](_0x53404e[_0xb057('0x36')]);_0xf00130[_0xb057('0x37')]=_[_0xb057('0x38')](_0xf00130[_0xb057('0x34')],_0xf00130[_0xb057('0x36')]);_0x265d0c['attributes']=_[_0xb057('0x38')](_0xf00130['model'],qs[_0xb057('0x39')](_0x53404e['query']['fields']));_0x265d0c['attributes']=_0x265d0c['attributes']['length']?_0x265d0c[_0xb057('0x3a')]:_0xf00130[_0xb057('0x34')];if(!_0x53404e[_0xb057('0x36')][_0xb057('0x3b')](_0xb057('0x3c'))){_0x265d0c['limit']=qs['limit'](_0x53404e[_0xb057('0x36')][_0xb057('0x21')]);_0x265d0c['offset']=qs[_0xb057('0x1f')](_0x53404e[_0xb057('0x36')][_0xb057('0x1f')]);}_0x265d0c[_0xb057('0x3d')]=qs[_0xb057('0x3e')](_0x53404e[_0xb057('0x36')][_0xb057('0x3e')]);_0x265d0c[_0xb057('0x3f')]=qs[_0xb057('0x37')](_['pick'](_0x53404e[_0xb057('0x36')],_0xf00130[_0xb057('0x37')]),_0x40da57);if(_0x53404e[_0xb057('0x36')][_0xb057('0x40')]){_0x265d0c['where']=_[_0xb057('0x41')](_0x265d0c[_0xb057('0x3f')],{'$or':_[_0xb057('0x2e')](_0x40da57,function(_0x37320c){if(_0x37320c[_0xb057('0x32')]!==_0xb057('0x42')){var _0x5c7458={};_0x5c7458[_0x37320c['name']]={'$like':'%'+_0x53404e[_0xb057('0x36')][_0xb057('0x40')]+'%'};return _0x5c7458;}})});}_0x265d0c=_[_0xb057('0x41')]({},_0x265d0c,_0x53404e[_0xb057('0x43')]);var _0x202b42={'where':_0x265d0c[_0xb057('0x3f')]};return db[_0xb057('0x2f')]['count'](_0x202b42)[_0xb057('0x28')](function(_0x4e84bd){_0xe68ca0[_0xb057('0x22')]=_0x4e84bd;if(_0x53404e[_0xb057('0x36')][_0xb057('0x44')]){_0x265d0c[_0xb057('0x45')]=[{'all':!![]}];}return db[_0xb057('0x2f')]['findAll'](_0x265d0c);})['then'](function(_0x8e9d0f){_0xe68ca0[_0xb057('0x46')]=_0x8e9d0f;return _0xe68ca0;})[_0xb057('0x28')](respondWithFilteredResult(_0x6f534c,_0x265d0c))[_0xb057('0x47')](handleError(_0x6f534c,null));};exports['show']=function(_0x4f4c9b,_0x448771){var _0x151564={'raw':!![],'where':{'id':_0x4f4c9b['params']['id']}},_0x215908={};_0x215908[_0xb057('0x34')]=_[_0xb057('0x35')](db[_0xb057('0x2f')][_0xb057('0x30')]);_0x215908[_0xb057('0x36')]=_['keys'](_0x4f4c9b[_0xb057('0x36')]);_0x215908[_0xb057('0x37')]=_[_0xb057('0x38')](_0x215908[_0xb057('0x34')],_0x215908[_0xb057('0x36')]);_0x151564[_0xb057('0x3a')]=_[_0xb057('0x38')](_0x215908[_0xb057('0x34')],qs[_0xb057('0x39')](_0x4f4c9b['query']['fields']));_0x151564['attributes']=_0x151564[_0xb057('0x3a')][_0xb057('0x48')]?_0x151564[_0xb057('0x3a')]:_0x215908[_0xb057('0x34')];if(_0x4f4c9b[_0xb057('0x36')]['includeAll']){_0x151564[_0xb057('0x45')]=[{'all':!![]}];}_0x151564=_[_0xb057('0x41')]({},_0x151564,_0x4f4c9b[_0xb057('0x43')]);return db[_0xb057('0x2f')]['find'](_0x151564)[_0xb057('0x28')](handleEntityNotFound(_0x448771,null))[_0xb057('0x28')](respondWithResult(_0x448771,null))[_0xb057('0x47')](handleError(_0x448771,null));};exports[_0xb057('0x49')]=function(_0x42fcdb,_0x287034){return db[_0xb057('0x2f')][_0xb057('0x49')](_0x42fcdb[_0xb057('0x4a')],{})[_0xb057('0x28')](function(_0x519693){var _0x50411b=_0x42fcdb[_0xb057('0x4b')][_0xb057('0x29')]({'plain':!![]});if(!_0x50411b)throw new Error(_0xb057('0x4c'));if(_0x50411b[_0xb057('0x4d')]==='user'){var _0xa0fc5a=_0x519693[_0xb057('0x29')]({'plain':!![]});var _0x471af7=_0xb057('0x4e');return db[_0xb057('0x4f')]['find']({'where':{'name':_0x471af7,'userProfileId':_0x50411b['userProfileId']},'raw':!![]})[_0xb057('0x28')](function(_0x595dd8){if(_0x595dd8&&_0x595dd8[_0xb057('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xa0fc5a[_0xb057('0x2c')],'resourceId':_0xa0fc5a['id'],'type':_0x595dd8[_0xb057('0x2c')],'sectionId':_0x595dd8['id']},{})[_0xb057('0x28')](function(){return _0x519693;});}else{return _0x519693;}})[_0xb057('0x47')](function(_0x2cfb13){logger[_0xb057('0x51')](_0xb057('0x52'),_0x2cfb13);throw _0x2cfb13;});}return _0x519693;})[_0xb057('0x28')](respondWithResult(_0x287034,0xc9))['catch'](handleError(_0x287034,null));};exports[_0xb057('0x27')]=function(_0x315fc9,_0x447bd3){if(_0x315fc9['body']['id']){delete _0x315fc9[_0xb057('0x4a')]['id'];}return db['Pause']['find']({'where':{'id':_0x315fc9[_0xb057('0x53')]['id']}})[_0xb057('0x28')](handleEntityNotFound(_0x447bd3,null))[_0xb057('0x28')](saveUpdates(_0x315fc9['body'],null))['then'](respondWithResult(_0x447bd3,null))['catch'](handleError(_0x447bd3,null));};exports[_0xb057('0x2b')]=function(_0x4a3908,_0x189516){return db[_0xb057('0x2f')]['find']({'where':{'id':_0x4a3908[_0xb057('0x53')]['id']}})[_0xb057('0x28')](handleEntityNotFound(_0x189516,null))[_0xb057('0x28')](removeEntity(_0x189516,null))['catch'](handleError(_0x189516,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5b1ac8a..59d1a0a 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0x7217,0x19e));var _0x7721=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7217[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6aa7,0x178));var _0x76aa=function(_0x87256f,_0x36fcf2){_0x87256f=_0x87256f-0x0;var _0x53be13=_0x6aa7[_0x87256f];return _0x53be13;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 28ac76d..32cc9c5 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(_0x5d0fbb,_0x3b16ba){var _0x1a74e2=function(_0x1a17db){while(--_0x1a17db){_0x5d0fbb['push'](_0x5d0fbb['shift']());}};_0x1a74e2(++_0x3b16ba);}(_0x7a54,0x106));var _0x47a5=function(_0x5ddfec,_0x320761){_0x5ddfec=_0x5ddfec-0x0;var _0x5adf38=_0x7a54[_0x5ddfec];return _0x5adf38;};'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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x156b81,_0x307bbd){var _0x2cda94=function(_0x5a6a45){while(--_0x5a6a45){_0x156b81['push'](_0x156b81['shift']());}};_0x2cda94(++_0x307bbd);}(_0xb10b,0x12a));var _0xbb10=function(_0xbaeba7,_0x578dfa){_0xbaeba7=_0xbaeba7-0x0;var _0x4b42e7=_0xb10b[_0xbaeba7];return _0x4b42e7;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 6e0967f..0a57f99 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 _0xcb99=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','join'];(function(_0x3c78db,_0x103620){var _0x177589=function(_0x24975b){while(--_0x24975b){_0x3c78db['push'](_0x3c78db['shift']());}};_0x177589(++_0x103620);}(_0xcb99,0x8b));var _0x9cb9=function(_0x5b8608,_0x527731){_0x5b8608=_0x5b8608-0x0;var _0x3f8d3d=_0xcb99[_0x5b8608];return _0x3f8d3d;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);var upload=multer({'storage':multer[_0x9cb9('0xe')]({'destination':function(_0x1b4fa6,_0x5a0ac7,_0x3be02c){_0x3be02c(null,path[_0x9cb9('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x227d49,_0x2e687e,_0x3382c8){_0x2e687e[_0x9cb9('0x10')]=_0x2e687e['originalname'][_0x9cb9('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3382c8(null,util[_0x9cb9('0x12')](_0x9cb9('0x13'),path[_0x9cb9('0x14')](_0x2e687e[_0x9cb9('0x10')],path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])),Date[_0x9cb9('0x16')](),path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])));}})});router[_0x9cb9('0x17')]('/',upload[_0x9cb9('0x18')](_0x9cb9('0x19')),controller[_0x9cb9('0x1a')]);router[_0x9cb9('0x17')](_0x9cb9('0x9'),controller[_0x9cb9('0x1b')]);router[_0x9cb9('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x4d9e=['upload','webhookPost','put','delete','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','%s-%s%s','basename','originalname','now','extname','single','file'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x345c47,_0x1c5af7){_0x345c47=_0x345c47-0x0;var _0x40006b=_0x4d9e[_0x345c47];return _0x40006b;};'use strict';var multer=require(_0xe4d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4d9('0x1'));var express=require('express');var router=express[_0xe4d9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe4d9('0x3'));var interaction=require(_0xe4d9('0x4'));var config=require('../../config/environment');var controller=require(_0xe4d9('0x5'));router[_0xe4d9('0x6')]('/',auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x8')]);router[_0xe4d9('0x6')](_0xe4d9('0x9'),controller['webhookGet']);router[_0xe4d9('0x6')](_0xe4d9('0xa'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0xb')]);router[_0xe4d9('0x6')](_0xe4d9('0xc'),auth['isAuthenticated'](),controller[_0xe4d9('0xd')]);var upload=multer({'storage':multer[_0xe4d9('0xe')]({'destination':function(_0x32eb8a,_0x3575ac,_0xddd1fb){_0xddd1fb(null,path[_0xe4d9('0xf')](config[_0xe4d9('0x10')],'server/files/plugins'));},'filename':function(_0x5ee099,_0x580c50,_0x4e0d15){_0x580c50['originalname']=_0x580c50['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e0d15(null,util['format'](_0xe4d9('0x11'),path[_0xe4d9('0x12')](_0x580c50[_0xe4d9('0x13')],path['extname'](_0x580c50[_0xe4d9('0x13')])),Date[_0xe4d9('0x14')](),path[_0xe4d9('0x15')](_0x580c50[_0xe4d9('0x13')])));}})});router['post']('/',upload[_0xe4d9('0x16')](_0xe4d9('0x17')),controller[_0xe4d9('0x18')]);router['post']('/webhook',controller[_0xe4d9('0x19')]);router[_0xe4d9('0x1a')]('/:id',auth[_0xe4d9('0x7')](),controller['update']);router[_0xe4d9('0x1b')](_0xe4d9('0xa'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d2711f7..5ec9005 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 _0x5021=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x540c31,_0x32bac3){var _0x331424=function(_0x283dbd){while(--_0x283dbd){_0x540c31['push'](_0x540c31['shift']());}};_0x331424(++_0x32bac3);}(_0x5021,0xfa));var _0x1502=function(_0x4c1183,_0x322f66){_0x4c1183=_0x4c1183-0x0;var _0x1ea492=_0x5021[_0x4c1183];return _0x1ea492;};'use strict';var Sequelize=require(_0x1502('0x0'));module[_0x1502('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1502('0x2')]('html',_0x1502('0x3'))},'description':{'type':Sequelize[_0x1502('0x4')]},'version':{'type':Sequelize[_0x1502('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x1502('0x5')},'active':{'type':Sequelize[_0x1502('0x6')],'defaultValue':0x0,'comment':_0x1502('0x7')},'sidebar':{'type':Sequelize[_0x1502('0x2')](_0x1502('0x8'),_0x1502('0x9'),_0x1502('0xa'),'never'),'defaultValue':_0x1502('0xa'),'comment':_0x1502('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x1502('0xc')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x1502('0xc')]},'scriptPath':{'type':Sequelize[_0x1502('0xc')]}}; \ No newline at end of file +var _0xd238=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x505fee,_0x1bceac){var _0x166fc1=function(_0x5d6ec2){while(--_0x5d6ec2){_0x505fee['push'](_0x505fee['shift']());}};_0x166fc1(++_0x1bceac);}(_0xd238,0x1e5));var _0x8d23=function(_0x6fad91,_0x19fea3){_0x6fad91=_0x6fad91-0x0;var _0x5e30c9=_0xd238[_0x6fad91];return _0x5e30c9;};'use strict';var Sequelize=require(_0x8d23('0x0'));module[_0x8d23('0x1')]={'name':{'type':Sequelize[_0x8d23('0x2')]},'type':{'type':Sequelize[_0x8d23('0x3')](_0x8d23('0x4'),_0x8d23('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x8d23('0x6')]},'path':{'type':Sequelize[_0x8d23('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8d23('0x7')},'sidebar':{'type':Sequelize[_0x8d23('0x3')](_0x8d23('0x8'),_0x8d23('0x9'),_0x8d23('0xa'),'never'),'defaultValue':_0x8d23('0xa'),'comment':_0x8d23('0xb')},'icon':{'type':Sequelize[_0x8d23('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x8d23('0x2')]},'scriptName':{'type':Sequelize[_0x8d23('0x2')]},'scriptPath':{'type':Sequelize[_0x8d23('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a827c37..8d4c36d 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 _0xc097=['Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','Plugins','UserProfileResource','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','find','download','join','server/files/plugins','format','%s.zip','basename','zip','code','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','**/*','root','dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','filename','extname','file','chmodSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc097,0xde));var _0x7c09=function(_0xf64cc,_0xad64a7){_0xf64cc=_0xf64cc-0x0;var _0x1282eb=_0xc097[_0xf64cc];return _0x1282eb;};'use strict';var emlformat=require(_0x7c09('0x0'));var rimraf=require(_0x7c09('0x1'));var zipdir=require(_0x7c09('0x2'));var jsonpatch=require(_0x7c09('0x3'));var rp=require(_0x7c09('0x4'));var moment=require('moment');var BPromise=require(_0x7c09('0x5'));var Mustache=require(_0x7c09('0x6'));var util=require('util');var path=require(_0x7c09('0x7'));var sox=require(_0x7c09('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c09('0x9'));var _=require(_0x7c09('0xa'));var squel=require(_0x7c09('0xb'));var crypto=require(_0x7c09('0xc'));var jsforce=require(_0x7c09('0xd'));var deskjs=require(_0x7c09('0xe'));var toCsv=require(_0x7c09('0xf'));var querystring=require('querystring');var Papa=require(_0x7c09('0x10'));var extract=require(_0x7c09('0x11'));var rimraf=require(_0x7c09('0x1'));var archiver=require(_0x7c09('0x12'));var Redis=require(_0x7c09('0x13'));var authService=require(_0x7c09('0x14'));var qs=require(_0x7c09('0x15'));var as=require(_0x7c09('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c09('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7c09('0x18'));var licenseUtil=require(_0x7c09('0x19'));var db=require(_0x7c09('0x1a'))['db'];config[_0x7c09('0x1b')]=_[_0x7c09('0x1c')](config[_0x7c09('0x1b')],{'host':_0x7c09('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7c09('0x1e'))[_0x7c09('0x1f')](socket);function respondWithStatusCode(_0x1f19a8,_0x4fb8a5){_0x4fb8a5=_0x4fb8a5||0xcc;return function(_0x3d7466){if(_0x3d7466){return _0x1f19a8[_0x7c09('0x20')](_0x4fb8a5);}return _0x1f19a8[_0x7c09('0x21')](_0x4fb8a5)[_0x7c09('0x22')]();};}function respondWithResult(_0x20f1cb,_0x24e68c){_0x24e68c=_0x24e68c||0xc8;return function(_0x33b0de){if(_0x33b0de){return _0x20f1cb[_0x7c09('0x21')](_0x24e68c)[_0x7c09('0x23')](_0x33b0de);}};}function respondWithFilteredResult(_0x188024,_0x30dac0){return function(_0x49d951){if(_0x49d951){var _0x3226d0=typeof _0x30dac0[_0x7c09('0x24')]===_0x7c09('0x25')&&typeof _0x30dac0[_0x7c09('0x26')]===_0x7c09('0x25');var _0x5e0aae=_0x49d951[_0x7c09('0x27')];var _0x58b4d6=_0x3226d0?0x0:_0x30dac0[_0x7c09('0x24')];var _0x24c8e5=_0x3226d0?_0x49d951[_0x7c09('0x27')]:_0x30dac0[_0x7c09('0x24')]+_0x30dac0[_0x7c09('0x26')];var _0x5a06a1;if(_0x24c8e5>=_0x5e0aae){_0x24c8e5=_0x5e0aae;_0x5a06a1=0xc8;}else{_0x5a06a1=0xce;}_0x188024[_0x7c09('0x21')](_0x5a06a1);return _0x188024['set'](_0x7c09('0x28'),_0x58b4d6+'-'+_0x24c8e5+'/'+_0x5e0aae)[_0x7c09('0x23')](_0x49d951);}return null;};}function patchUpdates(_0x2f9db5){return function(_0x12b4f8){try{jsonpatch[_0x7c09('0x29')](_0x12b4f8,_0x2f9db5,!![]);}catch(_0xd58c6){return BPromise[_0x7c09('0x2a')](_0xd58c6);}return _0x12b4f8[_0x7c09('0x2b')]();};}function saveUpdates(_0x344a44,_0x29b82c){return function(_0x4a7cf4){if(_0x4a7cf4){return _0x4a7cf4[_0x7c09('0x2c')](_0x344a44)['then'](function(_0x18adf4){return _0x18adf4;});}return null;};}function removeEntity(_0x3b7d94,_0x41682e){return function(_0x5e8399){if(_0x5e8399){return _0x5e8399['destroy']()[_0x7c09('0x2d')](function(){var _0x1d6d2b=_0x5e8399['get']({'plain':!![]});var _0x3979bb=_0x7c09('0x2e');return db[_0x7c09('0x2f')]['destroy']({'where':{'type':_0x3979bb,'resourceId':_0x1d6d2b['id']}})['then'](function(){return _0x5e8399;});})[_0x7c09('0x2d')](function(){_0x3b7d94['status'](0xcc)[_0x7c09('0x22')]();});}};}function handleEntityNotFound(_0x4868bb,_0x579d87){return function(_0x3a9a07){if(!_0x3a9a07){_0x4868bb['sendStatus'](0x194);}return _0x3a9a07;};}function handleError(_0x3eebb0,_0xb5edf9){_0xb5edf9=_0xb5edf9||0x1f4;return function(_0x4babe4){logger['error'](_0x4babe4[_0x7c09('0x30')]);if(_0x4babe4[_0x7c09('0x31')]){delete _0x4babe4[_0x7c09('0x31')];}_0x3eebb0['status'](_0xb5edf9)[_0x7c09('0x32')](_0x4babe4);};}exports[_0x7c09('0x33')]=function(_0x31649c,_0x40ac5c){var _0x5aa78f={},_0xeed23={},_0x3f971b={'count':0x0,'rows':[]};var _0x7603e6=_[_0x7c09('0x34')](db[_0x7c09('0x35')][_0x7c09('0x36')],function(_0x10bef3){return{'name':_0x10bef3[_0x7c09('0x37')],'type':_0x10bef3[_0x7c09('0x38')]['key']};});_0xeed23[_0x7c09('0x39')]=_[_0x7c09('0x34')](_0x7603e6,'name');_0xeed23[_0x7c09('0x3a')]=_[_0x7c09('0x3b')](_0x31649c['query']);_0xeed23[_0x7c09('0x3c')]=_['intersection'](_0xeed23[_0x7c09('0x39')],_0xeed23[_0x7c09('0x3a')]);_0x5aa78f[_0x7c09('0x3d')]=_[_0x7c09('0x3e')](_0xeed23[_0x7c09('0x39')],qs[_0x7c09('0x3f')](_0x31649c['query'][_0x7c09('0x3f')]));_0x5aa78f[_0x7c09('0x3d')]=_0x5aa78f[_0x7c09('0x3d')]['length']?_0x5aa78f[_0x7c09('0x3d')]:_0xeed23[_0x7c09('0x39')];if(!_0x31649c[_0x7c09('0x3a')][_0x7c09('0x40')](_0x7c09('0x41'))){_0x5aa78f[_0x7c09('0x26')]=qs[_0x7c09('0x26')](_0x31649c[_0x7c09('0x3a')]['limit']);_0x5aa78f[_0x7c09('0x24')]=qs['offset'](_0x31649c[_0x7c09('0x3a')]['offset']);}_0x5aa78f[_0x7c09('0x42')]=qs[_0x7c09('0x43')](_0x31649c[_0x7c09('0x3a')][_0x7c09('0x43')]);_0x5aa78f[_0x7c09('0x44')]=qs['filters'](_['pick'](_0x31649c[_0x7c09('0x3a')],_0xeed23[_0x7c09('0x3c')]),_0x7603e6);if(_0x31649c[_0x7c09('0x3a')]['filter']){_0x5aa78f[_0x7c09('0x44')]=_[_0x7c09('0x45')](_0x5aa78f[_0x7c09('0x44')],{'$or':_['map'](_0x7603e6,function(_0x4efa2a){if(_0x4efa2a[_0x7c09('0x38')]!==_0x7c09('0x46')){var _0x297f99={};_0x297f99[_0x4efa2a[_0x7c09('0x31')]]={'$like':'%'+_0x31649c['query'][_0x7c09('0x47')]+'%'};return _0x297f99;}})});}_0x5aa78f=_[_0x7c09('0x45')]({},_0x5aa78f,_0x31649c[_0x7c09('0x48')]);var _0x2c3a3d={'where':_0x5aa78f[_0x7c09('0x44')]};return db[_0x7c09('0x35')][_0x7c09('0x27')](_0x2c3a3d)['then'](function(_0x31f05c){_0x3f971b[_0x7c09('0x27')]=_0x31f05c;if(_0x31649c[_0x7c09('0x3a')][_0x7c09('0x49')]){_0x5aa78f[_0x7c09('0x4a')]=[{'all':!![]}];}return db[_0x7c09('0x35')][_0x7c09('0x4b')](_0x5aa78f);})[_0x7c09('0x2d')](function(_0x8d974b){_0x3f971b['rows']=_0x8d974b;return _0x3f971b;})[_0x7c09('0x2d')](respondWithFilteredResult(_0x40ac5c,_0x5aa78f))[_0x7c09('0x4c')](handleError(_0x40ac5c,null));};exports['show']=function(_0xeb6dd,_0x3c77ca){var _0x2eee70={'raw':!![],'where':{'id':_0xeb6dd[_0x7c09('0x4d')]['id']}},_0x22a929={};_0x22a929[_0x7c09('0x39')]=_[_0x7c09('0x3b')](db[_0x7c09('0x35')][_0x7c09('0x36')]);_0x22a929[_0x7c09('0x3a')]=_['keys'](_0xeb6dd['query']);_0x22a929[_0x7c09('0x3c')]=_[_0x7c09('0x3e')](_0x22a929[_0x7c09('0x39')],_0x22a929[_0x7c09('0x3a')]);_0x2eee70[_0x7c09('0x3d')]=_[_0x7c09('0x3e')](_0x22a929[_0x7c09('0x39')],qs['fields'](_0xeb6dd[_0x7c09('0x3a')][_0x7c09('0x3f')]));_0x2eee70[_0x7c09('0x3d')]=_0x2eee70[_0x7c09('0x3d')][_0x7c09('0x4e')]?_0x2eee70[_0x7c09('0x3d')]:_0x22a929[_0x7c09('0x39')];if(_0xeb6dd[_0x7c09('0x3a')][_0x7c09('0x49')]){_0x2eee70['include']=[{'all':!![]}];}_0x2eee70=_['merge']({},_0x2eee70,_0xeb6dd[_0x7c09('0x48')]);return db[_0x7c09('0x35')][_0x7c09('0x4f')](_0x2eee70)[_0x7c09('0x2d')](handleEntityNotFound(_0x3c77ca,null))[_0x7c09('0x2d')](respondWithResult(_0x3c77ca,null))['catch'](handleError(_0x3c77ca,null));};exports[_0x7c09('0x50')]=function(_0x29ed23,_0x35ab90,_0x406274){return db['Plugin'][_0x7c09('0x4f')]({'where':{'id':_0x29ed23[_0x7c09('0x4d')]['id']},'attributes':[_0x7c09('0x31'),'path'],'raw':!![]})[_0x7c09('0x2d')](handleEntityNotFound(_0x35ab90,null))['then'](function(_0x21c8dd){if(_0x21c8dd){var _0xac3679=path[_0x7c09('0x51')](config['root'],_0x7c09('0x52'),util[_0x7c09('0x53')](_0x7c09('0x54'),path[_0x7c09('0x55')](_0x21c8dd['path'])));var _0xc4022e=fs['createWriteStream'](_0xac3679);var _0x160e53=archiver(_0x7c09('0x56'),{'zlib':{'level':0x9}});_0x160e53['on']('warning',function(_0x5622a7){if(_0x5622a7[_0x7c09('0x57')]===_0x7c09('0x58')){logger[_0x7c09('0x59')](_0x5622a7);}else{throw new db[(_0x7c09('0x5a'))]['Error'](_0x7c09('0x5b'));}});_0x160e53['on']('error',function(_0x548342){throw new db[(_0x7c09('0x5a'))][(_0x7c09('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x160e53['pipe'](_0xc4022e);_0x160e53['glob'](_0x7c09('0x5d'),{'cwd':path[_0x7c09('0x51')](config[_0x7c09('0x5e')],_0x7c09('0x52'),path[_0x7c09('0x5f')](_0x21c8dd['path'])),'ignore':[path[_0x7c09('0x51')](path['basename'](_0x21c8dd[_0x7c09('0x7')]),'node_modules/**/*'),path[_0x7c09('0x51')](path[_0x7c09('0x55')](_0x21c8dd[_0x7c09('0x7')]),_0x7c09('0x60'))],'nodir':!![]})['finalize']();_0xc4022e['on'](_0x7c09('0x61'),function(){if(!fs[_0x7c09('0x62')](_0xac3679)){throw new db['Sequelize']['Error'](_0x7c09('0x63'));}return _0x35ab90['download'](_0xac3679,util[_0x7c09('0x53')]('%s.zip',path[_0x7c09('0x55')](_0x21c8dd['path'])),function(_0x46c3bb){if(_0x46c3bb){throw new db['Sequelize']['Error'](_0x7c09('0x64'));}fs[_0x7c09('0x65')](_0xac3679);logger[_0x7c09('0x66')]('Download\x20completed');logger[_0x7c09('0x66')](_0x7c09('0x67'));});});}return null;})[_0x7c09('0x4c')](handleError(_0x35ab90,null));};exports[_0x7c09('0x68')]=function(_0x19d90d,_0x32dc39,_0x144184){var _0xda1496=path[_0x7c09('0x55')](_0x19d90d['file'][_0x7c09('0x69')],path[_0x7c09('0x6a')](_0x19d90d[_0x7c09('0x6b')]['filename']));var _0x25fa40=path[_0x7c09('0x51')](config['root'],'server/files/plugins',_0x19d90d[_0x7c09('0x6b')][_0x7c09('0x69')]);var _0x16d579=path[_0x7c09('0x51')](config[_0x7c09('0x5e')],_0x7c09('0x52'),_0xda1496);logger[_0x7c09('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x25fa40);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x16d579);try{fs[_0x7c09('0x6c')](_0x25fa40,parseInt('0777',0x8));extract(_0x25fa40,{'dir':_0x16d579},function(_0x2312cf){if(_0x2312cf){logger[_0x7c09('0x59')](_0x2312cf);handleError(_0x2312cf,!![]);};var _0x2a6b6b=fs['readdirSync'](_0x16d579);if(_0x2a6b6b[_0x7c09('0x4e')]>0x1){removeReferences(_0x25fa40,_0x16d579);logger['error'](_0x7c09('0x6d'));return _0x144184(new Error(_0x7c09('0x6d')));}var _0x4d5fe6=fs['lstatSync'](path[_0x7c09('0x51')](_0x16d579,_0x2a6b6b[0x0]));if(_0x4d5fe6[_0x7c09('0x6e')]()){removeReferences(_0x25fa40,_0x16d579);logger['error'](_0x7c09('0x6d'));return _0x144184(new Error('Invalid\x20plugin\x20structure'));}if(_0x4d5fe6[_0x7c09('0x6f')]()){var _0x2d6f64=fs['readdirSync'](path['join'](_0x16d579,_0x2a6b6b[0x0]));if(_0x2d6f64[_0x7c09('0x4e')]===0x0){removeReferences(_0x25fa40,_0x16d579);logger[_0x7c09('0x59')](_0x7c09('0x6d'));return _0x144184(new Error(_0x7c09('0x6d')));}var _0x4e91c5=_0x2d6f64[_0x7c09('0x70')](function(_0x19f98e){return _0x19f98e===_0x7c09('0x71');});if(!_0x4e91c5){return _0x144184(new Error(_0x7c09('0x72')));}var _0x2dde1f=fs[_0x7c09('0x73')](path[_0x7c09('0x51')](_0x16d579,_0x2a6b6b[0x0],_0x7c09('0x71')));var _0x1714af=JSON[_0x7c09('0x74')](_0x2dde1f);if('undefined'==typeof _0x1714af[_0x7c09('0x31')]){return _0x144184(new Error(_0x7c09('0x75')));}if(_0x7c09('0x25')==typeof _0x1714af[_0x7c09('0x38')]){return _0x144184(new Error(_0x7c09('0x76')));}if(_0x7c09('0x25')==typeof _0x1714af[_0x7c09('0x77')]){return _0x144184(new Error(_0x7c09('0x78')));}if(_0x7c09('0x25')==typeof _0x1714af[_0x7c09('0x79')]){return _0x144184(new Error(_0x7c09('0x7a')));}if(_0x1714af['type']===_0x7c09('0x7b')){if(_0x7c09('0x25')==typeof _0x1714af[_0x7c09('0x79')][_0x7c09('0x7c')]){return _0x144184(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x7c09('0x25')==typeof _0x1714af[_0x7c09('0x79')]['views'][_0x7c09('0x7d')]&&'undefined'==typeof _0x1714af[_0x7c09('0x79')][_0x7c09('0x7c')][_0x7c09('0x7e')]){return _0x144184(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1714af[_0x7c09('0x38')]===_0x7c09('0x7f')){if('undefined'==typeof _0x1714af[_0x7c09('0x79')][_0x7c09('0x80')]){return _0x144184(new Error(_0x7c09('0x81')));}if(_0x7c09('0x25')==typeof _0x1714af[_0x7c09('0x79')][_0x7c09('0x82')]){return _0x144184(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x144184(new Error(_0x7c09('0x83')));}var _0x4d2e12=_0x1714af[_0x7c09('0x31')];var _0x263e57=_0x1714af[_0x7c09('0x84')];var _0x206950=_0x1714af[_0x7c09('0x38')];var _0x22266c=_0x1714af[_0x7c09('0x85')]?_0x1714af[_0x7c09('0x85')]:_0x7c09('0x86');var _0x3e8bc3=_0x1714af['icon']?_0x1714af[_0x7c09('0x87')]:_0x7c09('0x88');var _0xefc660='';var _0x333670='';var _0x3bb849='';var _0x14c90d='';var _0x83ac02=_0x1714af['version'];if(_0x206950===_0x7c09('0x7b')){if(_0x7c09('0x25')!=typeof _0x1714af[_0x7c09('0x79')][_0x7c09('0x7c')][_0x7c09('0x7d')]){var _0x2dc2d2=_0x1714af['parameters'][_0x7c09('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7c09('0x89')](_0x2dc2d2)){_0xefc660=path[_0x7c09('0x51')](_0x7c09('0x8a'),_0xda1496,_0x2a6b6b[0x0],_0x2dc2d2);}else{_0xefc660=_0x2dc2d2;}}else{logger[_0x7c09('0x66')](_0x7c09('0x8b'));}if(_0x7c09('0x25')!=typeof _0x1714af[_0x7c09('0x79')][_0x7c09('0x7c')][_0x7c09('0x7e')]){var _0x58da73=_0x1714af[_0x7c09('0x79')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x7c09('0x89')](_0x58da73)){_0x333670=path[_0x7c09('0x51')]('plugins',_0xda1496,_0x2a6b6b[0x0],_0x58da73);}else{_0x333670=_0x58da73;}}else{logger[_0x7c09('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x206950===_0x7c09('0x7f')){_0x3bb849=_0x1714af[_0x7c09('0x79')][_0x7c09('0x80')];_0x14c90d=_0x1714af[_0x7c09('0x79')][_0x7c09('0x82')];if(_0x7c09('0x25')!=typeof _0x1714af[_0x7c09('0x79')]['views']){if('undefined'!=typeof _0x1714af[_0x7c09('0x79')]['views'][_0x7c09('0x7d')]){var _0x2dc2d2=_0x1714af['parameters'][_0x7c09('0x7c')][_0x7c09('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2dc2d2)){_0xefc660=path['join']('plugins',_0xda1496,_0x2a6b6b[0x0],_0x2dc2d2);}else{_0xefc660=_0x2dc2d2;}}if(_0x7c09('0x25')!=typeof _0x1714af[_0x7c09('0x79')][_0x7c09('0x7c')][_0x7c09('0x7e')]){var _0x58da73=_0x1714af[_0x7c09('0x79')][_0x7c09('0x7c')][_0x7c09('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x7c09('0x89')](_0x58da73)){_0x333670=path[_0x7c09('0x51')](_0x7c09('0x8a'),_0xda1496,_0x2a6b6b[0x0],_0x58da73);}else{_0x333670=_0x58da73;}}}}var _0x14bdd5={'name':_0x4d2e12,'description':_0x263e57,'path':path[_0x7c09('0x51')](_0xda1496,_0x2a6b6b[0x0]),'type':_0x206950,'sidebar':_0x22266c,'icon':_0x3e8bc3,'adminUrl':_0xefc660,'agentUrl':_0x333670,'scriptName':_0x3bb849,'scriptPath':_0x14c90d,'version':_0x83ac02};removeReferences(_0x25fa40,null);return db[_0x7c09('0x35')][_0x7c09('0x8c')](_0x14bdd5)['then'](function(_0x5060ea){var _0x3ad464={'role':_0x19d90d['body'][_0x7c09('0x8d')],'userProfileId':_0x19d90d[_0x7c09('0x8e')]['userProfileId']};if(!_0x3ad464)throw new Error(_0x7c09('0x8f'));if(_0x3ad464[_0x7c09('0x8d')]===_0x7c09('0x90')){var _0x5472e6=_0x5060ea[_0x7c09('0x91')]({'plain':!![]});return db[_0x7c09('0x92')][_0x7c09('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x3ad464[_0x7c09('0x93')]},'raw':!![]})[_0x7c09('0x2d')](function(_0x4e5c7e){if(_0x4e5c7e&&_0x4e5c7e[_0x7c09('0x94')]===0x0){return db[_0x7c09('0x2f')][_0x7c09('0x8c')]({'name':_0x5472e6['name'],'resourceId':_0x5472e6['id'],'type':_0x4e5c7e[_0x7c09('0x31')],'sectionId':_0x4e5c7e['id']},{})[_0x7c09('0x2d')](function(){return _0x5060ea;});}else{return _0x5060ea;}})[_0x7c09('0x4c')](function(_0x282765){logger['error'](_0x7c09('0x95'),_0x282765);throw _0x282765;});}return _0x5060ea;})[_0x7c09('0x2d')](respondWithResult(_0x32dc39,null))[_0x7c09('0x4c')](handleError(_0x32dc39,null));}});}catch(_0x45e705){_0x32dc39['status'](0x1f4)[_0x7c09('0x32')](_0x45e705);}};function removeReferences(_0x11abc4,_0x589d21){try{if(_0x11abc4){fs[_0x7c09('0x65')](_0x11abc4);logger['info'](_0x7c09('0x96'));}if(_0x589d21){rimraf(_0x589d21,function(){});logger[_0x7c09('0x66')](_0x7c09('0x97'));}}catch(_0x108edf){logger['error'](_0x108edf);}}exports[_0x7c09('0x2c')]=function(_0x214d45,_0x235938,_0x5be67c){return db['Plugin'][_0x7c09('0x4f')]({'where':{'id':_0x214d45[_0x7c09('0x4d')]['id']}})[_0x7c09('0x2d')](handleEntityNotFound(_0x235938,null))[_0x7c09('0x2d')](saveUpdates(_0x214d45[_0x7c09('0x8e')],null))[_0x7c09('0x2d')](respondWithResult(_0x235938,null))[_0x7c09('0x4c')](handleError(_0x235938,null));};exports[_0x7c09('0x98')]=function(_0x883ffb,_0xf3cd7a,_0x5e9046){return db[_0x7c09('0x35')]['find']({'where':{'id':_0x883ffb[_0x7c09('0x4d')]['id']}})[_0x7c09('0x2d')](function(_0x16f38f){if(_0x16f38f){return _0x16f38f['destroy']();}})[_0x7c09('0x2d')](function(_0x1bc86e){rimraf(path['join'](config[_0x7c09('0x5e')],'server/files/plugins',path[_0x7c09('0x5f')](_0x1bc86e[_0x7c09('0x7')])),function(){});return _0x1bc86e;})[_0x7c09('0x2d')](handleEntityNotFound(_0xf3cd7a,null))[_0x7c09('0x2d')](respondWithStatusCode(_0xf3cd7a,null))[_0x7c09('0x4c')](handleError(_0xf3cd7a,null));};exports[_0x7c09('0x99')]=function(_0x48cf8f,_0x4400a1,_0x526b60){return BPromise[_0x7c09('0x9a')]()[_0x7c09('0x2d')](function(){if(!_0x48cf8f[_0x7c09('0x3a')][_0x7c09('0x7')]){throw new Error(_0x7c09('0x9b'));}if(!_0x48cf8f[_0x7c09('0x3a')][_0x7c09('0x9c')]){throw new Error(_0x7c09('0x9d'));}var _0x2cd7b4=_0x48cf8f['query']['hostname']?_0x48cf8f[_0x7c09('0x3a')][_0x7c09('0x9e')]+':'+_0x48cf8f['query'][_0x7c09('0x9c')]:_0x7c09('0x9f')+_0x48cf8f[_0x7c09('0x3a')][_0x7c09('0x9c')];var _0x15ea8c=_0x48cf8f['query'][_0x7c09('0x23')]?_0x48cf8f['query']['json']:!![];var _0x26b415=_0x48cf8f['query'][_0x7c09('0xa0')]?_0x48cf8f[_0x7c09('0x3a')]['encoding']:null;var _0x5a9a26={'method':_0x48cf8f[_0x7c09('0xa1')],'uri':util[_0x7c09('0x53')](_0x7c09('0xa2'),_0x2cd7b4,_0x48cf8f['query']['path']),'json':_0x15ea8c,'resolveWithFullResponse':!![],'encoding':_0x26b415,'qs':_0x48cf8f[_0x7c09('0x3a')]};if(_0x48cf8f[_0x7c09('0xa3')]){_0x5a9a26[_0x7c09('0xa3')]=_0x48cf8f[_0x7c09('0xa3')];if(_0x5a9a26[_0x7c09('0xa3')]['content-length']){delete _0x5a9a26[_0x7c09('0xa3')][_0x7c09('0xa4')];}}if(_0x5a9a26[_0x7c09('0xa3')][_0x7c09('0xa5')]){delete _0x5a9a26[_0x7c09('0xa3')][_0x7c09('0xa5')];}return rp(_0x5a9a26);})[_0x7c09('0x2d')](function(_0x4f8bc2){if(_0x4f8bc2){_0x4400a1[_0x7c09('0xa6')](_0x4f8bc2['headers']);logger[_0x7c09('0x66')](_0x4f8bc2['body']);if(_[_0x7c09('0xa7')](_0x48cf8f[_0x7c09('0x3a')][_0x7c09('0x7')],_0x7c09('0x50'))&&_0x4f8bc2[_0x7c09('0xa8')]==0x1f4){return _0x4400a1[_0x7c09('0x20')](_0x4f8bc2[_0x7c09('0xa8')]);}else{return _0x4400a1[_0x7c09('0x21')](_0x4f8bc2[_0x7c09('0xa8')])[_0x7c09('0x32')](_0x4f8bc2[_0x7c09('0x8e')]);}}else{return _0x4400a1[_0x7c09('0x20')](0xc8);}})[_0x7c09('0x4c')](handleError(_0x4400a1,null));};exports[_0x7c09('0xa9')]=function(_0x4dca15,_0x599a5e,_0x8ab6bd){return BPromise['resolve']()['then'](function(){if(!_0x4dca15['query'][_0x7c09('0x7')]){throw new Error(_0x7c09('0x9b'));}if(!_0x4dca15[_0x7c09('0x3a')]['port']){throw new Error(_0x7c09('0x9d'));}var _0x30d374=_0x4dca15[_0x7c09('0x3a')][_0x7c09('0x9e')]?_0x4dca15[_0x7c09('0x3a')]['hostname']+':'+_0x4dca15['query'][_0x7c09('0x9c')]:_0x7c09('0x9f')+_0x4dca15[_0x7c09('0x3a')][_0x7c09('0x9c')];var _0x470d80=_0x4dca15[_0x7c09('0x3a')][_0x7c09('0x23')]?_0x4dca15[_0x7c09('0x3a')][_0x7c09('0x23')]:!![];var _0x5d8f92=_0x4dca15[_0x7c09('0x3a')][_0x7c09('0xa0')]?_0x4dca15['query']['encoding']:null;var _0xac301e={'method':_0x4dca15['method'],'uri':util['format'](_0x7c09('0xa2'),_0x30d374,_0x4dca15[_0x7c09('0x3a')]['path']),'json':_0x470d80,'resolveWithFullResponse':!![],'encoding':_0x5d8f92,'body':_0x4dca15['body']};if(_0x4dca15[_0x7c09('0xa3')]){_0xac301e[_0x7c09('0xa3')]=_0x4dca15['headers'];if(_0xac301e[_0x7c09('0xa3')][_0x7c09('0xa4')]){delete _0xac301e[_0x7c09('0xa3')]['content-length'];}}if(_0xac301e[_0x7c09('0xa3')][_0x7c09('0xa5')]){delete _0xac301e[_0x7c09('0xa3')][_0x7c09('0xa5')];}return rp(_0xac301e);})['then'](function(_0x5b748f){if(_0x5b748f){_0x599a5e['set'](_0x5b748f['headers']);logger[_0x7c09('0x66')](_0x5b748f[_0x7c09('0x8e')]);return _0x599a5e[_0x7c09('0x21')](_0x5b748f[_0x7c09('0xa8')])[_0x7c09('0x32')](_0x5b748f[_0x7c09('0x8e')]);}else{return _0x599a5e[_0x7c09('0x20')](0xc8);}})[_0x7c09('0x4c')](handleError(_0x599a5e,null));}; \ No newline at end of file +var _0x7114=['Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Extracted\x20folder\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','headers','content-length','endsWith','statusCode','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','content-type','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','get','Plugins','UserProfileResource','destroy','sendStatus','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','download','find','join','root','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','**/*','dirname','finalize','existsSync','Plugin\x20not\x20found','%s.zip','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing'];(function(_0x4d7673,_0x4db88d){var _0x4781dc=function(_0x4cbced){while(--_0x4cbced){_0x4d7673['push'](_0x4d7673['shift']());}};_0x4781dc(++_0x4db88d);}(_0x7114,0xde));var _0x4711=function(_0x51a5e0,_0x5d4862){_0x51a5e0=_0x51a5e0-0x0;var _0x4207e8=_0x7114[_0x51a5e0];return _0x4207e8;};'use strict';var emlformat=require(_0x4711('0x0'));var rimraf=require(_0x4711('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4711('0x2'));var rp=require(_0x4711('0x3'));var moment=require(_0x4711('0x4'));var BPromise=require(_0x4711('0x5'));var Mustache=require(_0x4711('0x6'));var util=require(_0x4711('0x7'));var path=require(_0x4711('0x8'));var sox=require(_0x4711('0x9'));var csv=require(_0x4711('0xa'));var ejs=require(_0x4711('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4711('0xc'));var squel=require(_0x4711('0xd'));var crypto=require(_0x4711('0xe'));var jsforce=require(_0x4711('0xf'));var deskjs=require(_0x4711('0x10'));var toCsv=require(_0x4711('0xa'));var querystring=require('querystring');var Papa=require(_0x4711('0x11'));var extract=require(_0x4711('0x12'));var rimraf=require(_0x4711('0x1'));var archiver=require(_0x4711('0x13'));var Redis=require(_0x4711('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x4711('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4711('0x16'));var logger=require(_0x4711('0x17'))(_0x4711('0x18'));var utils=require(_0x4711('0x19'));var config=require(_0x4711('0x1a'));var licenseUtil=require(_0x4711('0x1b'));var db=require(_0x4711('0x1c'))['db'];config[_0x4711('0x1d')]=_['defaults'](config[_0x4711('0x1d')],{'host':_0x4711('0x1e'),'port':0x18eb});var socket=require(_0x4711('0x1f'))(new Redis(config[_0x4711('0x1d')]));require(_0x4711('0x20'))['register'](socket);function respondWithStatusCode(_0xa025c,_0x2557ab){_0x2557ab=_0x2557ab||0xcc;return function(_0x4c2aff){if(_0x4c2aff){return _0xa025c['sendStatus'](_0x2557ab);}return _0xa025c[_0x4711('0x21')](_0x2557ab)[_0x4711('0x22')]();};}function respondWithResult(_0x534422,_0x5a1bbb){_0x5a1bbb=_0x5a1bbb||0xc8;return function(_0x371db4){if(_0x371db4){return _0x534422[_0x4711('0x21')](_0x5a1bbb)[_0x4711('0x23')](_0x371db4);}};}function respondWithFilteredResult(_0x2b97a0,_0xa4a82e){return function(_0x4ac3f6){if(_0x4ac3f6){var _0x55bf58=typeof _0xa4a82e['offset']===_0x4711('0x24')&&typeof _0xa4a82e[_0x4711('0x25')]===_0x4711('0x24');var _0x205d5b=_0x4ac3f6['count'];var _0x5d87ab=_0x55bf58?0x0:_0xa4a82e[_0x4711('0x26')];var _0x420d45=_0x55bf58?_0x4ac3f6[_0x4711('0x27')]:_0xa4a82e[_0x4711('0x26')]+_0xa4a82e[_0x4711('0x25')];var _0x5ba81c;if(_0x420d45>=_0x205d5b){_0x420d45=_0x205d5b;_0x5ba81c=0xc8;}else{_0x5ba81c=0xce;}_0x2b97a0[_0x4711('0x21')](_0x5ba81c);return _0x2b97a0[_0x4711('0x28')](_0x4711('0x29'),_0x5d87ab+'-'+_0x420d45+'/'+_0x205d5b)[_0x4711('0x23')](_0x4ac3f6);}return null;};}function patchUpdates(_0x915711){return function(_0x3a0067){try{jsonpatch[_0x4711('0x2a')](_0x3a0067,_0x915711,!![]);}catch(_0x1352d1){return BPromise[_0x4711('0x2b')](_0x1352d1);}return _0x3a0067[_0x4711('0x2c')]();};}function saveUpdates(_0x56967b,_0xb966dd){return function(_0x270ad1){if(_0x270ad1){return _0x270ad1['update'](_0x56967b)[_0x4711('0x2d')](function(_0x5a33f2){return _0x5a33f2;});}return null;};}function removeEntity(_0x211a3a,_0x190c69){return function(_0x1cae7d){if(_0x1cae7d){return _0x1cae7d['destroy']()[_0x4711('0x2d')](function(){var _0x366e92=_0x1cae7d[_0x4711('0x2e')]({'plain':!![]});var _0x31a73e=_0x4711('0x2f');return db[_0x4711('0x30')][_0x4711('0x31')]({'where':{'type':_0x31a73e,'resourceId':_0x366e92['id']}})['then'](function(){return _0x1cae7d;});})[_0x4711('0x2d')](function(){_0x211a3a[_0x4711('0x21')](0xcc)[_0x4711('0x22')]();});}};}function handleEntityNotFound(_0x254063,_0x11acd2){return function(_0x40c2ad){if(!_0x40c2ad){_0x254063[_0x4711('0x32')](0x194);}return _0x40c2ad;};}function handleError(_0x5a3db2,_0x3085b1){_0x3085b1=_0x3085b1||0x1f4;return function(_0x19f388){logger['error'](_0x19f388[_0x4711('0x33')]);if(_0x19f388[_0x4711('0x34')]){delete _0x19f388[_0x4711('0x34')];}_0x5a3db2['status'](_0x3085b1)['send'](_0x19f388);};}exports[_0x4711('0x35')]=function(_0x1889d7,_0x5c0368){var _0x4c5e05={},_0x1a5851={},_0x4deced={'count':0x0,'rows':[]};var _0x308b9d=_[_0x4711('0x36')](db[_0x4711('0x37')][_0x4711('0x38')],function(_0x1283c6){return{'name':_0x1283c6[_0x4711('0x39')],'type':_0x1283c6[_0x4711('0x3a')][_0x4711('0x3b')]};});_0x1a5851[_0x4711('0x3c')]=_['map'](_0x308b9d,'name');_0x1a5851[_0x4711('0x3d')]=_[_0x4711('0x3e')](_0x1889d7[_0x4711('0x3d')]);_0x1a5851[_0x4711('0x3f')]=_[_0x4711('0x40')](_0x1a5851[_0x4711('0x3c')],_0x1a5851[_0x4711('0x3d')]);_0x4c5e05[_0x4711('0x41')]=_[_0x4711('0x40')](_0x1a5851[_0x4711('0x3c')],qs['fields'](_0x1889d7[_0x4711('0x3d')]['fields']));_0x4c5e05[_0x4711('0x41')]=_0x4c5e05['attributes'][_0x4711('0x42')]?_0x4c5e05[_0x4711('0x41')]:_0x1a5851[_0x4711('0x3c')];if(!_0x1889d7[_0x4711('0x3d')][_0x4711('0x43')](_0x4711('0x44'))){_0x4c5e05[_0x4711('0x25')]=qs[_0x4711('0x25')](_0x1889d7['query']['limit']);_0x4c5e05['offset']=qs[_0x4711('0x26')](_0x1889d7[_0x4711('0x3d')]['offset']);}_0x4c5e05[_0x4711('0x45')]=qs[_0x4711('0x46')](_0x1889d7[_0x4711('0x3d')][_0x4711('0x46')]);_0x4c5e05[_0x4711('0x47')]=qs[_0x4711('0x3f')](_[_0x4711('0x48')](_0x1889d7[_0x4711('0x3d')],_0x1a5851[_0x4711('0x3f')]),_0x308b9d);if(_0x1889d7[_0x4711('0x3d')][_0x4711('0x49')]){_0x4c5e05[_0x4711('0x47')]=_[_0x4711('0x4a')](_0x4c5e05[_0x4711('0x47')],{'$or':_[_0x4711('0x36')](_0x308b9d,function(_0xc94ad1){if(_0xc94ad1[_0x4711('0x3a')]!==_0x4711('0x4b')){var _0x327f92={};_0x327f92[_0xc94ad1[_0x4711('0x34')]]={'$like':'%'+_0x1889d7[_0x4711('0x3d')][_0x4711('0x49')]+'%'};return _0x327f92;}})});}_0x4c5e05=_[_0x4711('0x4a')]({},_0x4c5e05,_0x1889d7[_0x4711('0x4c')]);var _0x2e2d6e={'where':_0x4c5e05['where']};return db['Plugin'][_0x4711('0x27')](_0x2e2d6e)[_0x4711('0x2d')](function(_0x59ca94){_0x4deced[_0x4711('0x27')]=_0x59ca94;if(_0x1889d7['query'][_0x4711('0x4d')]){_0x4c5e05[_0x4711('0x4e')]=[{'all':!![]}];}return db[_0x4711('0x37')][_0x4711('0x4f')](_0x4c5e05);})['then'](function(_0x98d4e1){_0x4deced[_0x4711('0x50')]=_0x98d4e1;return _0x4deced;})[_0x4711('0x2d')](respondWithFilteredResult(_0x5c0368,_0x4c5e05))[_0x4711('0x51')](handleError(_0x5c0368,null));};exports[_0x4711('0x52')]=function(_0xe5834,_0x11d01a){var _0x4e33df={'raw':!![],'where':{'id':_0xe5834[_0x4711('0x53')]['id']}},_0x373b42={};_0x373b42[_0x4711('0x3c')]=_[_0x4711('0x3e')](db[_0x4711('0x37')][_0x4711('0x38')]);_0x373b42['query']=_[_0x4711('0x3e')](_0xe5834[_0x4711('0x3d')]);_0x373b42[_0x4711('0x3f')]=_[_0x4711('0x40')](_0x373b42[_0x4711('0x3c')],_0x373b42[_0x4711('0x3d')]);_0x4e33df[_0x4711('0x41')]=_[_0x4711('0x40')](_0x373b42['model'],qs[_0x4711('0x54')](_0xe5834[_0x4711('0x3d')]['fields']));_0x4e33df['attributes']=_0x4e33df[_0x4711('0x41')]['length']?_0x4e33df[_0x4711('0x41')]:_0x373b42[_0x4711('0x3c')];if(_0xe5834[_0x4711('0x3d')][_0x4711('0x4d')]){_0x4e33df[_0x4711('0x4e')]=[{'all':!![]}];}_0x4e33df=_[_0x4711('0x4a')]({},_0x4e33df,_0xe5834[_0x4711('0x4c')]);return db[_0x4711('0x37')]['find'](_0x4e33df)[_0x4711('0x2d')](handleEntityNotFound(_0x11d01a,null))[_0x4711('0x2d')](respondWithResult(_0x11d01a,null))[_0x4711('0x51')](handleError(_0x11d01a,null));};exports[_0x4711('0x55')]=function(_0x16d154,_0x3e21df,_0x961678){return db['Plugin'][_0x4711('0x56')]({'where':{'id':_0x16d154[_0x4711('0x53')]['id']},'attributes':[_0x4711('0x34'),_0x4711('0x8')],'raw':!![]})[_0x4711('0x2d')](handleEntityNotFound(_0x3e21df,null))[_0x4711('0x2d')](function(_0x52fac0){if(_0x52fac0){var _0x9a64b9=path[_0x4711('0x57')](config[_0x4711('0x58')],_0x4711('0x59'),util[_0x4711('0x5a')]('%s.zip',path[_0x4711('0x5b')](_0x52fac0['path'])));var _0x5e96ff=fs[_0x4711('0x5c')](_0x9a64b9);var _0x255c82=archiver(_0x4711('0x5d'),{'zlib':{'level':0x9}});_0x255c82['on']('warning',function(_0x569258){if(_0x569258[_0x4711('0x5e')]===_0x4711('0x5f')){logger[_0x4711('0x60')](_0x569258);}else{throw new db['Sequelize'][(_0x4711('0x61'))](_0x4711('0x62'));}});_0x255c82['on'](_0x4711('0x60'),function(_0x342fb0){throw new db[(_0x4711('0x63'))][(_0x4711('0x61'))](_0x4711('0x62'));});_0x255c82['pipe'](_0x5e96ff);_0x255c82['glob'](_0x4711('0x64'),{'cwd':path[_0x4711('0x57')](config['root'],'server/files/plugins',path[_0x4711('0x65')](_0x52fac0[_0x4711('0x8')])),'ignore':[path[_0x4711('0x57')](path[_0x4711('0x5b')](_0x52fac0[_0x4711('0x8')]),'node_modules/**/*'),path[_0x4711('0x57')](path[_0x4711('0x5b')](_0x52fac0['path']),'attachments/**/*')],'nodir':!![]})[_0x4711('0x66')]();_0x5e96ff['on']('close',function(){if(!fs[_0x4711('0x67')](_0x9a64b9)){throw new db['Sequelize']['Error'](_0x4711('0x68'));}return _0x3e21df[_0x4711('0x55')](_0x9a64b9,util[_0x4711('0x5a')](_0x4711('0x69'),path[_0x4711('0x5b')](_0x52fac0[_0x4711('0x8')])),function(_0x18b179){if(_0x18b179){throw new db[(_0x4711('0x63'))][(_0x4711('0x61'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x9a64b9);logger[_0x4711('0x6a')](_0x4711('0x6b'));logger[_0x4711('0x6a')](_0x4711('0x6c'));});});}return null;})['catch'](handleError(_0x3e21df,null));};exports[_0x4711('0x6d')]=function(_0x43afb0,_0x5bbbc0,_0x57e26a){var _0x5e9ba2=path[_0x4711('0x5b')](_0x43afb0[_0x4711('0x6e')][_0x4711('0x6f')],path['extname'](_0x43afb0[_0x4711('0x6e')][_0x4711('0x6f')]));var _0x35a40a=path[_0x4711('0x57')](config[_0x4711('0x58')],_0x4711('0x59'),_0x43afb0[_0x4711('0x6e')]['filename']);var _0x3a10bb=path['join'](config[_0x4711('0x58')],_0x4711('0x59'),_0x5e9ba2);logger['info'](_0x4711('0x70'),_0x35a40a);logger['info'](_0x4711('0x71'),_0x3a10bb);try{fs[_0x4711('0x72')](_0x35a40a,parseInt(_0x4711('0x73'),0x8));extract(_0x35a40a,{'dir':_0x3a10bb},function(_0x5e68ce){if(_0x5e68ce){logger[_0x4711('0x60')](_0x5e68ce);handleError(_0x5e68ce,!![]);};var _0x2b9fc5=fs[_0x4711('0x74')](_0x3a10bb);if(_0x2b9fc5[_0x4711('0x42')]>0x1){removeReferences(_0x35a40a,_0x3a10bb);logger[_0x4711('0x60')]('Invalid\x20plugin\x20structure');return _0x57e26a(new Error('Invalid\x20plugin\x20structure'));}var _0x98a2c8=fs[_0x4711('0x75')](path['join'](_0x3a10bb,_0x2b9fc5[0x0]));if(_0x98a2c8[_0x4711('0x76')]()){removeReferences(_0x35a40a,_0x3a10bb);logger[_0x4711('0x60')](_0x4711('0x77'));return _0x57e26a(new Error(_0x4711('0x77')));}if(_0x98a2c8[_0x4711('0x78')]()){var _0x5eeba1=fs[_0x4711('0x74')](path['join'](_0x3a10bb,_0x2b9fc5[0x0]));if(_0x5eeba1['length']===0x0){removeReferences(_0x35a40a,_0x3a10bb);logger[_0x4711('0x60')](_0x4711('0x77'));return _0x57e26a(new Error(_0x4711('0x77')));}var _0x5d32cc=_0x5eeba1[_0x4711('0x79')](function(_0x207e95){return _0x207e95==='manifest.json';});if(!_0x5d32cc){return _0x57e26a(new Error(_0x4711('0x7a')));}var _0x36a824=fs[_0x4711('0x7b')](path[_0x4711('0x57')](_0x3a10bb,_0x2b9fc5[0x0],_0x4711('0x7c')));var _0x273b21=JSON['parse'](_0x36a824);if('undefined'==typeof _0x273b21[_0x4711('0x34')]){return _0x57e26a(new Error(_0x4711('0x7d')));}if(_0x4711('0x24')==typeof _0x273b21[_0x4711('0x3a')]){return _0x57e26a(new Error(_0x4711('0x7e')));}if('undefined'==typeof _0x273b21['version']){return _0x57e26a(new Error(_0x4711('0x7f')));}if('undefined'==typeof _0x273b21[_0x4711('0x80')]){return _0x57e26a(new Error(_0x4711('0x81')));}if(_0x273b21[_0x4711('0x3a')]==='html'){if(_0x4711('0x24')==typeof _0x273b21[_0x4711('0x80')]['views']){return _0x57e26a(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4711('0x24')==typeof _0x273b21[_0x4711('0x80')][_0x4711('0x82')][_0x4711('0x83')]&&_0x4711('0x24')==typeof _0x273b21[_0x4711('0x80')][_0x4711('0x82')][_0x4711('0x84')]){return _0x57e26a(new Error(_0x4711('0x85')));}}else if(_0x273b21[_0x4711('0x3a')]===_0x4711('0x86')){if(_0x4711('0x24')==typeof _0x273b21[_0x4711('0x80')][_0x4711('0x87')]){return _0x57e26a(new Error(_0x4711('0x88')));}if('undefined'==typeof _0x273b21['parameters'][_0x4711('0x89')]){return _0x57e26a(new Error(_0x4711('0x8a')));}}else{return _0x57e26a(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x7307f2=_0x273b21['name'];var _0x50dce5=_0x273b21[_0x4711('0x8b')];var _0x59e418=_0x273b21[_0x4711('0x3a')];var _0x5cb698=_0x273b21[_0x4711('0x8c')]?_0x273b21[_0x4711('0x8c')]:'always';var _0x58577a=_0x273b21['icon']?_0x273b21['icon']:_0x4711('0x8d');var _0x44d8be='';var _0x16a574='';var _0x2ef1c3='';var _0xccf782='';var _0x39cc28=_0x273b21[_0x4711('0x8e')];if(_0x59e418==='html'){if(_0x4711('0x24')!=typeof _0x273b21[_0x4711('0x80')][_0x4711('0x82')][_0x4711('0x83')]){var _0x3e11b4=_0x273b21[_0x4711('0x80')]['views'][_0x4711('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3e11b4)){_0x44d8be=path[_0x4711('0x57')]('plugins',_0x5e9ba2,_0x2b9fc5[0x0],_0x3e11b4);}else{_0x44d8be=_0x3e11b4;}}else{logger[_0x4711('0x6a')](_0x4711('0x8f'));}if(_0x4711('0x24')!=typeof _0x273b21[_0x4711('0x80')][_0x4711('0x82')][_0x4711('0x84')]){var _0x36eb90=_0x273b21['parameters'][_0x4711('0x82')][_0x4711('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x4711('0x90')](_0x36eb90)){_0x16a574=path[_0x4711('0x57')](_0x4711('0x91'),_0x5e9ba2,_0x2b9fc5[0x0],_0x36eb90);}else{_0x16a574=_0x36eb90;}}else{logger['info'](_0x4711('0x92'));}}else if(_0x59e418==='script'){_0x2ef1c3=_0x273b21[_0x4711('0x80')][_0x4711('0x87')];_0xccf782=_0x273b21['parameters'][_0x4711('0x89')];if(_0x4711('0x24')!=typeof _0x273b21['parameters'][_0x4711('0x82')]){if(_0x4711('0x24')!=typeof _0x273b21['parameters']['views'][_0x4711('0x83')]){var _0x3e11b4=_0x273b21[_0x4711('0x80')][_0x4711('0x82')][_0x4711('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3e11b4)){_0x44d8be=path['join'](_0x4711('0x91'),_0x5e9ba2,_0x2b9fc5[0x0],_0x3e11b4);}else{_0x44d8be=_0x3e11b4;}}if(_0x4711('0x24')!=typeof _0x273b21[_0x4711('0x80')]['views']['agent']){var _0x36eb90=_0x273b21[_0x4711('0x80')][_0x4711('0x82')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x36eb90)){_0x16a574=path['join'](_0x4711('0x91'),_0x5e9ba2,_0x2b9fc5[0x0],_0x36eb90);}else{_0x16a574=_0x36eb90;}}}}var _0x5eccb0={'name':_0x7307f2,'description':_0x50dce5,'path':path[_0x4711('0x57')](_0x5e9ba2,_0x2b9fc5[0x0]),'type':_0x59e418,'sidebar':_0x5cb698,'icon':_0x58577a,'adminUrl':_0x44d8be,'agentUrl':_0x16a574,'scriptName':_0x2ef1c3,'scriptPath':_0xccf782,'version':_0x39cc28};removeReferences(_0x35a40a,null);return db[_0x4711('0x37')][_0x4711('0x93')](_0x5eccb0)['then'](function(_0x2fa68e){var _0x4afe32={'role':_0x43afb0[_0x4711('0x94')][_0x4711('0x95')],'userProfileId':_0x43afb0[_0x4711('0x94')][_0x4711('0x96')]};if(!_0x4afe32)throw new Error(_0x4711('0x97'));if(_0x4afe32[_0x4711('0x95')]===_0x4711('0x98')){var _0x3b8399=_0x2fa68e['get']({'plain':!![]});return db[_0x4711('0x99')]['find']({'where':{'name':_0x4711('0x2f'),'userProfileId':_0x4afe32[_0x4711('0x96')]},'raw':!![]})[_0x4711('0x2d')](function(_0x3d5440){if(_0x3d5440&&_0x3d5440['autoAssociation']===0x0){return db[_0x4711('0x30')][_0x4711('0x93')]({'name':_0x3b8399[_0x4711('0x34')],'resourceId':_0x3b8399['id'],'type':_0x3d5440[_0x4711('0x34')],'sectionId':_0x3d5440['id']},{})[_0x4711('0x2d')](function(){return _0x2fa68e;});}else{return _0x2fa68e;}})[_0x4711('0x51')](function(_0x15ac0c){logger['error'](_0x4711('0x9a'),_0x15ac0c);throw _0x15ac0c;});}return _0x2fa68e;})[_0x4711('0x2d')](respondWithResult(_0x5bbbc0,null))[_0x4711('0x51')](handleError(_0x5bbbc0,null));}});}catch(_0x52cf53){_0x5bbbc0['status'](0x1f4)[_0x4711('0x9b')](_0x52cf53);}};function removeReferences(_0x1f8c89,_0x2c8785){try{if(_0x1f8c89){fs[_0x4711('0x9c')](_0x1f8c89);logger[_0x4711('0x6a')]('Zip\x20archive\x20removed');}if(_0x2c8785){rimraf(_0x2c8785,function(){});logger[_0x4711('0x6a')](_0x4711('0x9d'));}}catch(_0x15a611){logger['error'](_0x15a611);}}exports[_0x4711('0x9e')]=function(_0x441f0c,_0xbb79f,_0x51190e){return db[_0x4711('0x37')]['find']({'where':{'id':_0x441f0c['params']['id']}})['then'](handleEntityNotFound(_0xbb79f,null))[_0x4711('0x2d')](saveUpdates(_0x441f0c[_0x4711('0x94')],null))[_0x4711('0x2d')](respondWithResult(_0xbb79f,null))[_0x4711('0x51')](handleError(_0xbb79f,null));};exports[_0x4711('0x9f')]=function(_0x4bcf82,_0x511fe6,_0x379d66){return db[_0x4711('0x37')][_0x4711('0x56')]({'where':{'id':_0x4bcf82[_0x4711('0x53')]['id']}})[_0x4711('0x2d')](function(_0x450025){if(_0x450025){return _0x450025[_0x4711('0x31')]();}})['then'](function(_0x399cb5){rimraf(path[_0x4711('0x57')](config[_0x4711('0x58')],'server/files/plugins',path[_0x4711('0x65')](_0x399cb5[_0x4711('0x8')])),function(){});return _0x399cb5;})[_0x4711('0x2d')](handleEntityNotFound(_0x511fe6,null))['then'](respondWithStatusCode(_0x511fe6,null))[_0x4711('0x51')](handleError(_0x511fe6,null));};exports[_0x4711('0xa0')]=function(_0x525c9a,_0x279f6b,_0x46225f){return BPromise['resolve']()[_0x4711('0x2d')](function(){if(!_0x525c9a[_0x4711('0x3d')][_0x4711('0x8')]){throw new Error(_0x4711('0xa1'));}if(!_0x525c9a[_0x4711('0x3d')][_0x4711('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x278196=_0x525c9a[_0x4711('0x3d')][_0x4711('0xa3')]?_0x525c9a[_0x4711('0x3d')]['hostname']+':'+_0x525c9a[_0x4711('0x3d')][_0x4711('0xa2')]:_0x4711('0xa4')+_0x525c9a[_0x4711('0x3d')][_0x4711('0xa2')];var _0x2a94e4=_0x525c9a[_0x4711('0x3d')]['json']?_0x525c9a['query']['json']:!![];var _0x1101ca=_0x525c9a['query'][_0x4711('0xa5')]?_0x525c9a[_0x4711('0x3d')]['encoding']:null;var _0x321dda={'method':_0x525c9a['method'],'uri':util[_0x4711('0x5a')]('%s%s',_0x278196,_0x525c9a[_0x4711('0x3d')][_0x4711('0x8')]),'json':_0x2a94e4,'resolveWithFullResponse':!![],'encoding':_0x1101ca,'qs':_0x525c9a[_0x4711('0x3d')]};if(_0x525c9a[_0x4711('0xa6')]){_0x321dda['headers']=_0x525c9a[_0x4711('0xa6')];if(_0x321dda[_0x4711('0xa6')][_0x4711('0xa7')]){delete _0x321dda['headers']['content-length'];}}if(_0x321dda[_0x4711('0xa6')]['content-type']){delete _0x321dda['headers']['content-type'];}return rp(_0x321dda);})[_0x4711('0x2d')](function(_0x2e98f8){if(_0x2e98f8){_0x279f6b[_0x4711('0x28')](_0x2e98f8[_0x4711('0xa6')]);logger[_0x4711('0x6a')](_0x2e98f8[_0x4711('0x94')]);if(_[_0x4711('0xa8')](_0x525c9a[_0x4711('0x3d')][_0x4711('0x8')],_0x4711('0x55'))&&_0x2e98f8[_0x4711('0xa9')]==0x1f4){return _0x279f6b[_0x4711('0x32')](_0x2e98f8[_0x4711('0xa9')]);}else{return _0x279f6b[_0x4711('0x21')](_0x2e98f8[_0x4711('0xa9')])[_0x4711('0x9b')](_0x2e98f8[_0x4711('0x94')]);}}else{return _0x279f6b[_0x4711('0x32')](0xc8);}})[_0x4711('0x51')](handleError(_0x279f6b,null));};exports['webhookPost']=function(_0x381abb,_0x3cd5da,_0x268ce8){return BPromise[_0x4711('0xaa')]()[_0x4711('0x2d')](function(){if(!_0x381abb[_0x4711('0x3d')][_0x4711('0x8')]){throw new Error(_0x4711('0xa1'));}if(!_0x381abb[_0x4711('0x3d')]['port']){throw new Error(_0x4711('0xab'));}var _0x32cf92=_0x381abb[_0x4711('0x3d')][_0x4711('0xa3')]?_0x381abb[_0x4711('0x3d')][_0x4711('0xa3')]+':'+_0x381abb[_0x4711('0x3d')]['port']:_0x4711('0xa4')+_0x381abb[_0x4711('0x3d')][_0x4711('0xa2')];var _0x4840a5=_0x381abb[_0x4711('0x3d')][_0x4711('0x23')]?_0x381abb[_0x4711('0x3d')]['json']:!![];var _0xc25a07=_0x381abb[_0x4711('0x3d')][_0x4711('0xa5')]?_0x381abb[_0x4711('0x3d')][_0x4711('0xa5')]:null;var _0x39bd3c={'method':_0x381abb['method'],'uri':util['format'](_0x4711('0xac'),_0x32cf92,_0x381abb[_0x4711('0x3d')][_0x4711('0x8')]),'json':_0x4840a5,'resolveWithFullResponse':!![],'encoding':_0xc25a07,'body':_0x381abb[_0x4711('0x94')]};if(_0x381abb[_0x4711('0xa6')]){_0x39bd3c[_0x4711('0xa6')]=_0x381abb[_0x4711('0xa6')];if(_0x39bd3c[_0x4711('0xa6')]['content-length']){delete _0x39bd3c[_0x4711('0xa6')][_0x4711('0xa7')];}}if(_0x39bd3c[_0x4711('0xa6')][_0x4711('0xad')]){delete _0x39bd3c['headers'][_0x4711('0xad')];}return rp(_0x39bd3c);})[_0x4711('0x2d')](function(_0x3e3e66){if(_0x3e3e66){_0x3cd5da[_0x4711('0x28')](_0x3e3e66['headers']);logger[_0x4711('0x6a')](_0x3e3e66[_0x4711('0x94')]);return _0x3cd5da[_0x4711('0x21')](_0x3e3e66[_0x4711('0xa9')])[_0x4711('0x9b')](_0x3e3e66['body']);}else{return _0x3cd5da[_0x4711('0x32')](0xc8);}})[_0x4711('0x51')](handleError(_0x3cd5da,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6a8e1ca..f91fead 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 _0xaa48=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x4ad896,_0x5cd4b9){var _0x53e943=function(_0x823503){while(--_0x823503){_0x4ad896['push'](_0x4ad896['shift']());}};_0x53e943(++_0x5cd4b9);}(_0xaa48,0x15a));var _0x8aa4=function(_0x5d0593,_0x456318){_0x5d0593=_0x5d0593-0x0;var _0x12a90a=_0xaa48[_0x5d0593];return _0x12a90a;};'use strict';var EventEmitter=require(_0x8aa4('0x0'));var Plugin=require(_0x8aa4('0x1'))['db'][_0x8aa4('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8aa4('0x3')](0x0);var events={'afterCreate':_0x8aa4('0x4'),'afterUpdate':_0x8aa4('0x5'),'afterDestroy':_0x8aa4('0x6')};function emitEvent(_0x4357b2){return function(_0x229357,_0x1005db,_0x2871a4){PluginEvents[_0x8aa4('0x7')](_0x4357b2+':'+_0x229357['id'],_0x229357);PluginEvents[_0x8aa4('0x7')](_0x4357b2,_0x229357);_0x2871a4(null);};}for(var e in events){if(events[_0x8aa4('0x8')](e)){var event=events[e];Plugin[_0x8aa4('0x9')](e,emitEvent(event));}}module[_0x8aa4('0xa')]=PluginEvents; \ No newline at end of file +var _0x0309=['events','Plugin','save','update','remove','hasOwnProperty','hook'];(function(_0x2be0a3,_0x1dfe6f){var _0x3e064b=function(_0x4d2773){while(--_0x4d2773){_0x2be0a3['push'](_0x2be0a3['shift']());}};_0x3e064b(++_0x1dfe6f);}(_0x0309,0x165));var _0x9030=function(_0x322717,_0x330209){_0x322717=_0x322717-0x0;var _0x95c804=_0x0309[_0x322717];return _0x95c804;};'use strict';var EventEmitter=require(_0x9030('0x0'));var Plugin=require('../../mysqldb')['db'][_0x9030('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9030('0x2'),'afterUpdate':_0x9030('0x3'),'afterDestroy':_0x9030('0x4')};function emitEvent(_0x4236be){return function(_0x29e331,_0x2e6276,_0xcbbe57){PluginEvents['emit'](_0x4236be+':'+_0x29e331['id'],_0x29e331);PluginEvents['emit'](_0x4236be,_0x29e331);_0xcbbe57(null);};}for(var e in events){if(events[_0x9030('0x5')](e)){var event=events[e];Plugin[_0x9030('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bd4c506..383e027 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 _0x84c6=['Plugin','lodash','util','../../config/logger','bluebird','path','../../config/environment','./plugin.attributes','exports','define'];(function(_0x22a245,_0x1a7fff){var _0xcc8f98=function(_0x51da19){while(--_0x51da19){_0x22a245['push'](_0x22a245['shift']());}};_0xcc8f98(++_0x1a7fff);}(_0x84c6,0x137));var _0x684c=function(_0x296d1b,_0x1f0bf0){_0x296d1b=_0x296d1b-0x0;var _0x3c747f=_0x84c6[_0x296d1b];return _0x3c747f;};'use strict';var _=require(_0x684c('0x0'));var util=require(_0x684c('0x1'));var logger=require(_0x684c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x684c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x684c('0x4'));var rimraf=require('rimraf');var config=require(_0x684c('0x5'));var attributes=require(_0x684c('0x6'));module[_0x684c('0x7')]=function(_0x317609,_0x47950f){return _0x317609[_0x684c('0x8')](_0x684c('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76b9=['path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x76b9,0x12f));var _0x976b=function(_0x157298,_0x2f1dd2){_0x157298=_0x157298-0x0;var _0x43368c=_0x76b9[_0x157298];return _0x43368c;};'use strict';var _=require('lodash');var util=require(_0x976b('0x0'));var logger=require(_0x976b('0x1'))(_0x976b('0x2'));var moment=require(_0x976b('0x3'));var BPromise=require(_0x976b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x976b('0x5'));var rimraf=require(_0x976b('0x6'));var config=require(_0x976b('0x7'));var attributes=require(_0x976b('0x8'));module[_0x976b('0x9')]=function(_0x578501,_0x1ecf07){return _0x578501['define'](_0x976b('0xa'),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 bc4d4a8..f4bf43a 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 _0xe839=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','register','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','Plugin,\x20%s,\x20%s','info','catch','Plugin','options','raw','CreatePlugin','lodash','util','bluebird','randomstring'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0xe839,0xf8));var _0x9e83=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xe839[_0x154192];return _0x3c2792;};'use strict';var _=require(_0x9e83('0x0'));var util=require(_0x9e83('0x1'));var moment=require('moment');var BPromise=require(_0x9e83('0x2'));var rs=require(_0x9e83('0x3'));var fs=require('fs');var Redis=require(_0x9e83('0x4'));var db=require(_0x9e83('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e83('0x6'))(_0x9e83('0x7'));var config=require(_0x9e83('0x8'));var jayson=require(_0x9e83('0x9'));var client=jayson[_0x9e83('0xa')][_0x9e83('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9e83('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e83('0xc')]));require('./plugin.socket')[_0x9e83('0xd')](socket);function respondWithRpcPromise(_0x40187a,_0x340829,_0x34b63c){return new BPromise(function(_0x5bb938,_0x2d399a){return client['request'](_0x40187a,_0x34b63c)[_0x9e83('0xe')](function(_0x5ca54c){logger['info']('Plugin,\x20%s,\x20%s',_0x340829,_0x9e83('0xf'));logger[_0x9e83('0x10')](_0x9e83('0x11'),_0x340829,_0x9e83('0xf'),JSON[_0x9e83('0x12')](_0x5ca54c));if(_0x5ca54c[_0x9e83('0x13')]){if(_0x5ca54c['error']['code']===0x1f4){logger[_0x9e83('0x13')]('Plugin,\x20%s,\x20%s',_0x340829,_0x5ca54c[_0x9e83('0x13')]['message']);return _0x2d399a(_0x5ca54c[_0x9e83('0x13')][_0x9e83('0x14')]);}logger[_0x9e83('0x13')](_0x9e83('0x15'),_0x340829,_0x5ca54c['error'][_0x9e83('0x14')]);return _0x5bb938(_0x5ca54c[_0x9e83('0x13')][_0x9e83('0x14')]);}else{logger[_0x9e83('0x16')](_0x9e83('0x15'),_0x340829,_0x9e83('0xf'));_0x5bb938(_0x5ca54c['result']['message']);}})[_0x9e83('0x17')](function(_0x17bd6a){logger[_0x9e83('0x13')](_0x9e83('0x15'),_0x340829,_0x17bd6a);_0x2d399a(_0x17bd6a);});});}exports['CreatePlugin']=function(_0x303558){var _0x48bfb8=this;return new Promise(function(_0x4bb2aa,_0x5ec27a){return db[_0x9e83('0x18')]['create'](_0x303558['body'],{'raw':_0x303558[_0x9e83('0x19')]?_0x303558[_0x9e83('0x19')][_0x9e83('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x167085){logger[_0x9e83('0x16')](_0x9e83('0x1b'),_0x303558);logger[_0x9e83('0x10')](_0x9e83('0x1b'),_0x303558,JSON[_0x9e83('0x12')](_0x167085));_0x4bb2aa(_0x167085);})[_0x9e83('0x17')](function(_0x471037){logger[_0x9e83('0x13')](_0x9e83('0x1b'),_0x471037[_0x9e83('0x14')],_0x303558);_0x5ec27a(_0x48bfb8['error'](0x1f4,_0x471037[_0x9e83('0x14')]));});});}; \ No newline at end of file +var _0x7158=['create','body','options','raw','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','Plugin'];(function(_0x2ecbf1,_0x1e8d32){var _0x405272=function(_0x4ea519){while(--_0x4ea519){_0x2ecbf1['push'](_0x2ecbf1['shift']());}};_0x405272(++_0x1e8d32);}(_0x7158,0xc5));var _0x8715=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x7158[_0x1526e1];return _0x249a1e;};'use strict';var _=require(_0x8715('0x0'));var util=require(_0x8715('0x1'));var moment=require(_0x8715('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8715('0x3'));var db=require(_0x8715('0x4'))['db'];var utils=require(_0x8715('0x5'));var logger=require(_0x8715('0x6'))(_0x8715('0x7'));var config=require(_0x8715('0x8'));var jayson=require(_0x8715('0x9'));var client=jayson['client'][_0x8715('0xa')]({'port':0x232a});config[_0x8715('0xb')]=_['defaults'](config[_0x8715('0xb')],{'host':_0x8715('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8715('0xb')]));require(_0x8715('0xd'))[_0x8715('0xe')](socket);function respondWithRpcPromise(_0x154c75,_0xa0e19b,_0x9d84e0){return new BPromise(function(_0x50a0be,_0xd7a1ca){return client['request'](_0x154c75,_0x9d84e0)[_0x8715('0xf')](function(_0x1a6c08){logger[_0x8715('0x10')](_0x8715('0x11'),_0xa0e19b,_0x8715('0x12'));logger[_0x8715('0x13')](_0x8715('0x14'),_0xa0e19b,'request\x20sent',JSON['stringify'](_0x1a6c08));if(_0x1a6c08[_0x8715('0x15')]){if(_0x1a6c08[_0x8715('0x15')][_0x8715('0x16')]===0x1f4){logger[_0x8715('0x15')]('Plugin,\x20%s,\x20%s',_0xa0e19b,_0x1a6c08[_0x8715('0x15')]['message']);return _0xd7a1ca(_0x1a6c08[_0x8715('0x15')][_0x8715('0x17')]);}logger[_0x8715('0x15')]('Plugin,\x20%s,\x20%s',_0xa0e19b,_0x1a6c08['error']['message']);return _0x50a0be(_0x1a6c08[_0x8715('0x15')][_0x8715('0x17')]);}else{logger['info'](_0x8715('0x11'),_0xa0e19b,_0x8715('0x12'));_0x50a0be(_0x1a6c08[_0x8715('0x18')][_0x8715('0x17')]);}})['catch'](function(_0x2725b6){logger[_0x8715('0x15')](_0x8715('0x11'),_0xa0e19b,_0x2725b6);_0xd7a1ca(_0x2725b6);});});}exports[_0x8715('0x19')]=function(_0xfffe1a){var _0x4bf69e=this;return new Promise(function(_0x526bc8,_0x388745){return db[_0x8715('0x1a')][_0x8715('0x1b')](_0xfffe1a[_0x8715('0x1c')],{'raw':_0xfffe1a[_0x8715('0x1d')]?_0xfffe1a['options'][_0x8715('0x1e')]===undefined?!![]:![]:!![]})[_0x8715('0xf')](function(_0x4ff6f5){logger[_0x8715('0x10')]('CreatePlugin',_0xfffe1a);logger[_0x8715('0x13')](_0x8715('0x19'),_0xfffe1a,JSON[_0x8715('0x1f')](_0x4ff6f5));_0x526bc8(_0x4ff6f5);})['catch'](function(_0x1df0d5){logger[_0x8715('0x15')](_0x8715('0x19'),_0x1df0d5['message'],_0xfffe1a);_0x388745(_0x4bf69e[_0x8715('0x15')](0x1f4,_0x1df0d5[_0x8715('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f898100..97a185e 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 _0xf63d=['update','emit','removeListener','register','length','plugin:','save','remove'];(function(_0x288ce9,_0x46dd4a){var _0x2a19f2=function(_0x3e9fca){while(--_0x3e9fca){_0x288ce9['push'](_0x288ce9['shift']());}};_0x2a19f2(++_0x46dd4a);}(_0xf63d,0x1de));var _0xdf63=function(_0x1798cb,_0xafe39f){_0x1798cb=_0x1798cb-0x0;var _0x4a68ed=_0xf63d[_0x1798cb];return _0x4a68ed;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xdf63('0x0'),_0xdf63('0x1'),_0xdf63('0x2')];function createListener(_0x575019,_0x32805e){return function(_0x4166f5){_0x32805e[_0xdf63('0x3')](_0x575019,_0x4166f5);};}function removeListener(_0x11e62d,_0x57f662){return function(){PluginEvents[_0xdf63('0x4')](_0x11e62d,_0x57f662);};}exports[_0xdf63('0x5')]=function(_0x484695){for(var _0x32a2e3=0x0,_0x4d6f3d=events[_0xdf63('0x6')];_0x32a2e3<_0x4d6f3d;_0x32a2e3++){var _0x8271c1=events[_0x32a2e3];var _0x4c655d=createListener(_0xdf63('0x7')+_0x8271c1,_0x484695);PluginEvents['on'](_0x8271c1,_0x4c655d);}}; \ No newline at end of file +var _0xd047=['length','./plugin.events','save','update','emit','removeListener'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xd047,0xc1));var _0x7d04=function(_0x5b6f6e,_0x289af1){_0x5b6f6e=_0x5b6f6e-0x0;var _0x168914=_0xd047[_0x5b6f6e];return _0x168914;};'use strict';var PluginEvents=require(_0x7d04('0x0'));var events=[_0x7d04('0x1'),'remove',_0x7d04('0x2')];function createListener(_0x3cc53f,_0x526fc0){return function(_0x5c78b9){_0x526fc0[_0x7d04('0x3')](_0x3cc53f,_0x5c78b9);};}function removeListener(_0x4cf0a4,_0x5ade4e){return function(){PluginEvents[_0x7d04('0x4')](_0x4cf0a4,_0x5ade4e);};}exports['register']=function(_0x2a66df){for(var _0x752ddc=0x0,_0x293733=events[_0x7d04('0x5')];_0x752ddc<_0x293733;_0x752ddc++){var _0x38a131=events[_0x752ddc];var _0x2c132a=createListener('plugin:'+_0x38a131,_0x2a66df);PluginEvents['on'](_0x38a131,_0x2c132a);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index d66409a..1ca30ac 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(_0x37a7b1,_0x3a2bea){var _0x4a9bd4=function(_0xec9cff){while(--_0xec9cff){_0x37a7b1['push'](_0x37a7b1['shift']());}};_0x4a9bd4(++_0x3a2bea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x24d911,_0x5ab437){var _0x4f0516=function(_0x1e1c2a){while(--_0x1e1c2a){_0x24d911['push'](_0x24d911['shift']());}};_0x4f0516(++_0x5ab437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 ddaabae..5af1557 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 _0xe706=['dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','index','express','motion2','then','catch','params','create','body','script','join','../../files/plugins','cwd'];(function(_0x40951a,_0x2cbe60){var _0xdb2028=function(_0x134fa6){while(--_0x134fa6){_0x40951a['push'](_0x40951a['shift']());}};_0xdb2028(++_0x2cbe60);}(_0xe706,0xa3));var _0x6e70=function(_0x53ec7a,_0x2c1f7e){_0x53ec7a=_0x53ec7a-0x0;var _0x3a1407=_0xe706[_0x53ec7a];return _0x3a1407;};'use strict';var _=require(_0x6e70('0x0'));var pm2=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var path=require(_0x6e70('0x3'));var exec=require(_0x6e70('0x4'))[_0x6e70('0x5')];var BPromise=require(_0x6e70('0x6'));function handleEntityNotFound(_0x142c27,_0x2164a4){return function(_0x376a8d){if(!_0x376a8d){_0x142c27[_0x6e70('0x7')](0x194);;}return _0x376a8d;};}function respondWithResult(_0x1b0389,_0x4381d1){_0x4381d1=_0x4381d1||0xc8;return function(_0x36357b){if(_0x36357b){return _0x1b0389[_0x6e70('0x8')](_0x4381d1)[_0x6e70('0x9')](_0x36357b);}return null;};}function handleError(_0x188ed3,_0x3c4843){_0x3c4843=_0x3c4843||0x1f4;return function(_0x449b48){logger[_0x6e70('0xa')](_0x449b48[_0x6e70('0xb')]);if(_0x449b48[_0x6e70('0xc')]){delete _0x449b48[_0x6e70('0xc')];}_0x188ed3[_0x6e70('0x8')](_0x3c4843)[_0x6e70('0xd')](_0x449b48);};}function execChildProcess(){return new BPromise(function(_0x37b3e0,_0x4600f9){exec('npm\x20install',function(_0x47f6b2,_0x3594c1,_0x15a1a5){logger[_0x6e70('0xe')](_0x3594c1);logger[_0x6e70('0xe')](_0x15a1a5);if(_0x47f6b2){logger[_0x6e70('0xa')](_0x47f6b2);return _0x4600f9(_0x47f6b2);}return _0x37b3e0(_0x3594c1);});});}exports[_0x6e70('0xf')]=function(_0xa1eb74,_0x181005){return pm2['list']()['then'](function(_0x48bc72){if(_0x48bc72){var _0x257e81=_['reject'](_0x48bc72,function(_0x53aed0){return _0x53aed0[_0x6e70('0xc')]===_0x6e70('0x10')||_0x53aed0['name']===_0x6e70('0x11');});return{'rows':_0x257e81,'count':_0x257e81['length']};}return null;})[_0x6e70('0x12')](respondWithResult(_0x181005,null))[_0x6e70('0x13')](handleError(_0x181005,null));};exports['show']=function(_0x49029f,_0x3bd572){return pm2['describe'](_0x49029f[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](respondWithResult(_0x3bd572,null))['then'](handleEntityNotFound(_0x3bd572,null))['catch'](handleError(_0x3bd572,null));};exports[_0x6e70('0x15')]=function(_0x208e21,_0x2368eb){if(_0x208e21[_0x6e70('0x16')][_0x6e70('0xc')]&&_0x208e21[_0x6e70('0x16')][_0x6e70('0x17')]){var _0x44a49f=path[_0x6e70('0x18')](__dirname,_0x6e70('0x19'),_0x208e21['body'][_0x6e70('0x17')]);var _0x344b65=process[_0x6e70('0x1a')]();process['chdir'](path[_0x6e70('0x1b')](_0x44a49f));return execChildProcess()[_0x6e70('0x12')](function(_0x3337a6){process['chdir'](_0x344b65);return pm2[_0x6e70('0x1c')]({'name':_0x208e21['body']['name'],'script':_0x44a49f});})['then'](function(_0x41e352){pm2[_0x6e70('0x1d')]();return _0x41e352[0x0];})['then'](respondWithResult(_0x2368eb,0xc9))[_0x6e70('0x13')](handleError(_0x2368eb,null));}else{return _0x2368eb[_0x6e70('0x8')](0x1f4)['send']({'message':_0x6e70('0x1e')});}};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){if(_0x2bb231['body']['id']){delete _0x2bb231[_0x6e70('0x16')]['id'];}var _0x3af17f={'online':_0x6e70('0x20'),'stopped':_0x6e70('0x21')};if(_0x3af17f[_0x6e70('0x22')](_0x2bb231['body'][_0x6e70('0x8')])){return pm2[_0x3af17f[_0x2bb231[_0x6e70('0x16')][_0x6e70('0x8')]]](_0x2bb231[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](respondWithResult(_0x4a67ac,0xc8))[_0x6e70('0x13')](handleError(_0x4a67ac,null));}else{return _0x4a67ac[_0x6e70('0x8')](0x1f4)[_0x6e70('0xd')]({'message':_0x6e70('0x23')});}};exports[_0x6e70('0x24')]=function(_0x4b1229,_0x1b27d8){if(_0x4b1229['body']['id']){delete _0x4b1229[_0x6e70('0x16')]['id'];}if(_0x4b1229['params']['id']){return pm2[_0x6e70('0x25')](_0x4b1229[_0x6e70('0x14')]['id'])[_0x6e70('0x12')](function(_0x56f6f7){pm2[_0x6e70('0x1d')]();return _0x56f6f7[0x0];})[_0x6e70('0x12')](respondWithResult(_0x1b27d8,null))['catch'](handleError(_0x1b27d8,null));}else{return _0x1b27d8[_0x6e70('0x8')](0x1f4)[_0x6e70('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xbee3=['sendStatus','status','json','error','name','send','info','index','then','reject','length','describe','params','catch','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20id','../../config/pm2','path','child_process','bluebird'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0xbee3,0xd5));var _0x3bee=function(_0x59ebfc,_0x11c88c){_0x59ebfc=_0x59ebfc-0x0;var _0x5a1575=_0xbee3[_0x59ebfc];return _0x5a1575;};'use strict';var _=require('lodash');var pm2=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x3bee('0x1'));var exec=require(_0x3bee('0x2'))['exec'];var BPromise=require(_0x3bee('0x3'));function handleEntityNotFound(_0x1956c1,_0x1cf379){return function(_0x507c6a){if(!_0x507c6a){_0x1956c1[_0x3bee('0x4')](0x194);;}return _0x507c6a;};}function respondWithResult(_0x3baf77,_0x4c5ef5){_0x4c5ef5=_0x4c5ef5||0xc8;return function(_0x2fdeec){if(_0x2fdeec){return _0x3baf77[_0x3bee('0x5')](_0x4c5ef5)[_0x3bee('0x6')](_0x2fdeec);}return null;};}function handleError(_0x339223,_0xbdd5d5){_0xbdd5d5=_0xbdd5d5||0x1f4;return function(_0x9aab05){logger[_0x3bee('0x7')](_0x9aab05['stack']);if(_0x9aab05[_0x3bee('0x8')]){delete _0x9aab05[_0x3bee('0x8')];}_0x339223[_0x3bee('0x5')](_0xbdd5d5)[_0x3bee('0x9')](_0x9aab05);};}function execChildProcess(){return new BPromise(function(_0x356fef,_0xc53ada){exec('npm\x20install',function(_0x32c0b,_0x5bb283,_0x2da716){logger[_0x3bee('0xa')](_0x5bb283);logger[_0x3bee('0xa')](_0x2da716);if(_0x32c0b){logger[_0x3bee('0x7')](_0x32c0b);return _0xc53ada(_0x32c0b);}return _0x356fef(_0x5bb283);});});}exports[_0x3bee('0xb')]=function(_0x459129,_0xc8c1f0){return pm2['list']()[_0x3bee('0xc')](function(_0x33504d){if(_0x33504d){var _0x31ac52=_[_0x3bee('0xd')](_0x33504d,function(_0x3a0396){return _0x3a0396['name']==='express'||_0x3a0396[_0x3bee('0x8')]==='motion2';});return{'rows':_0x31ac52,'count':_0x31ac52[_0x3bee('0xe')]};}return null;})[_0x3bee('0xc')](respondWithResult(_0xc8c1f0,null))['catch'](handleError(_0xc8c1f0,null));};exports['show']=function(_0x1582a4,_0x36c5aa){return pm2[_0x3bee('0xf')](_0x1582a4[_0x3bee('0x10')]['id'])['then'](respondWithResult(_0x36c5aa,null))[_0x3bee('0xc')](handleEntityNotFound(_0x36c5aa,null))[_0x3bee('0x11')](handleError(_0x36c5aa,null));};exports[_0x3bee('0x12')]=function(_0x49b32d,_0x33d812){if(_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')]&&_0x49b32d['body']['script']){var _0x1afd0f=path[_0x3bee('0x14')](__dirname,'../../files/plugins',_0x49b32d[_0x3bee('0x13')][_0x3bee('0x15')]);var _0x2eea75=process[_0x3bee('0x16')]();process[_0x3bee('0x17')](path[_0x3bee('0x18')](_0x1afd0f));return execChildProcess()[_0x3bee('0xc')](function(_0x582fa9){process[_0x3bee('0x17')](_0x2eea75);return pm2[_0x3bee('0x19')]({'name':_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')],'script':_0x1afd0f});})['then'](function(_0x45249c){pm2[_0x3bee('0x1a')]();return _0x45249c[0x0];})[_0x3bee('0xc')](respondWithResult(_0x33d812,0xc9))['catch'](handleError(_0x33d812,null));}else{return _0x33d812['status'](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1b')});}};exports['update']=function(_0x2c0e50,_0x1b4ce0){if(_0x2c0e50[_0x3bee('0x13')]['id']){delete _0x2c0e50['body']['id'];}var _0x1984c4={'online':_0x3bee('0x1c'),'stopped':_0x3bee('0x1d')};if(_0x1984c4['hasOwnProperty'](_0x2c0e50[_0x3bee('0x13')][_0x3bee('0x5')])){return pm2[_0x1984c4[_0x2c0e50[_0x3bee('0x13')]['status']]](_0x2c0e50[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](respondWithResult(_0x1b4ce0,0xc8))[_0x3bee('0x11')](handleError(_0x1b4ce0,null));}else{return _0x1b4ce0[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x3fbc8c,_0x1e1529){if(_0x3fbc8c[_0x3bee('0x13')]['id']){delete _0x3fbc8c[_0x3bee('0x13')]['id'];}if(_0x3fbc8c['params']['id']){return pm2['delete'](_0x3fbc8c[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](function(_0x4f5b58){pm2['dump']();return _0x4f5b58[0x0];})[_0x3bee('0xc')](respondWithResult(_0x1e1529,null))[_0x3bee('0x11')](handleError(_0x1e1529,null));}else{return _0x1e1529[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1e')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index bcafe19..eec9853 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 _0x376a=['../../components/auth/service','get','isAuthenticated','/queues','getQueues','exports','Router'];(function(_0x3178de,_0x305575){var _0x44a1ad=function(_0x53f065){while(--_0x53f065){_0x3178de['push'](_0x3178de['shift']());}};_0x44a1ad(++_0x305575);}(_0x376a,0x11e));var _0xa376=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x376a[_0x511bd1];return _0x4c48ec;};'use strict';var express=require('express');var router=express[_0xa376('0x0')]();var auth=require(_0xa376('0x1'));var controller=require('./realtime.controller');router[_0xa376('0x2')]('/agents',auth[_0xa376('0x3')](),controller['getAgents']);router[_0xa376('0x2')](_0xa376('0x4'),auth[_0xa376('0x3')](),controller[_0xa376('0x5')]);module[_0xa376('0x6')]=router; \ No newline at end of file +var _0x69e4=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','getQueues','exports'];(function(_0x1a1a85,_0x1775fa){var _0x9125f0=function(_0x45bc35){while(--_0x45bc35){_0x1a1a85['push'](_0x1a1a85['shift']());}};_0x9125f0(++_0x1775fa);}(_0x69e4,0xa5));var _0x469e=function(_0x4c24d2,_0x33b0e3){_0x4c24d2=_0x4c24d2-0x0;var _0x26abf3=_0x69e4[_0x4c24d2];return _0x26abf3;};'use strict';var express=require(_0x469e('0x0'));var router=express[_0x469e('0x1')]();var auth=require(_0x469e('0x2'));var controller=require(_0x469e('0x3'));router[_0x469e('0x4')](_0x469e('0x5'),auth['isAuthenticated'](),controller[_0x469e('0x6')]);router[_0x469e('0x4')](_0x469e('0x7'),auth[_0x469e('0x8')](),controller[_0x469e('0x9')]);module[_0x469e('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e666dc3..701e901 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 _0x69f8=['getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','rawAttributes','fieldName','type','role','agent','sequelize','FIELD(id,','forEach','where','user','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','filterAgentAttributes','globalStatus','includes','Status','sortAgentsByStatus','getQueues','key','getOptions','userProfileId','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/utils','api','../../mysqldb','client','http','undefined','limit','count','offset','status','set','Content-Range','json','error','stack','name','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','paused','voice','push','pTalking','originated','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','agents','available','talking','busy','merge','pick','filter','queue','some','connectedlinenum','internal','toString','length','find','UserId','accountcode','voiceStatus','online','loggedInDb','Queue','Pause','QueueId','getChannels','toLowerCase','Invalid\x20channel','getAgents','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','sort','validateSortParameter','join','order'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x69f8,0x18c));var _0x869f=function(_0x1ef734,_0x2dbab1){_0x1ef734=_0x1ef734-0x0;var _0x1ef074=_0x69f8[_0x1ef734];return _0x1ef074;};'use strict';var util=require(_0x869f('0x0'));var _=require(_0x869f('0x1'));var jayson=require(_0x869f('0x2'));var rta=require('../../components/realtime/agents');var qs=require(_0x869f('0x3'));var utils=require(_0x869f('0x4'));var logger=require('../../config/logger')(_0x869f('0x5'));var db=require(_0x869f('0x6'))['db'];var amiClient=jayson[_0x869f('0x7')][_0x869f('0x8')]({'port':0x232a});var routingClient=jayson['client'][_0x869f('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x416b19,_0x446d1e){return function(_0x4c2cae){if(_0x4c2cae){var _0x17776c=typeof _0x446d1e['offset']===_0x869f('0x9')&&typeof _0x446d1e[_0x869f('0xa')]===_0x869f('0x9');var _0xb9efca=_0x4c2cae['count'];var _0x5c66e5=_0x17776c?0x0:_0x446d1e['offset'];var _0x35f822=_0x17776c?_0x4c2cae[_0x869f('0xb')]:_0x446d1e[_0x869f('0xc')]+_0x446d1e[_0x869f('0xa')];var _0x52266a;if(_0x35f822>=_0xb9efca){_0x35f822=_0xb9efca;_0x52266a=0xc8;}else{_0x52266a=0xce;}_0x416b19[_0x869f('0xd')](_0x52266a);return _0x416b19[_0x869f('0xe')](_0x869f('0xf'),_0x5c66e5+'-'+_0x35f822+'/'+_0xb9efca)[_0x869f('0x10')](_0x4c2cae);}return null;};}function handleError(_0x1b5627,_0x4f9194){_0x4f9194=_0x4f9194||0x1f4;return function(_0xd199cb){logger[_0x869f('0x11')](_0xd199cb[_0x869f('0x12')]);if(_0xd199cb[_0x869f('0x13')]){delete _0xd199cb[_0x869f('0x13')];}_0x1b5627[_0x869f('0xd')](_0x4f9194)['send'](_0xd199cb);};}function getRealtimeQueues(_0x2ff55a,_0xd4313e){return new Promise(function(_0x529b6a,_0x1d569c){var _0x1536c1=_0xd4313e==='voice'?amiClient:routingClient;return _0x1536c1[_0x869f('0x14')](_[_0x869f('0x15')](_0xd4313e)+_0x869f('0x16'),_0x2ff55a)[_0x869f('0x17')](function(_0x3e9b12){if(_0x3e9b12[_0x869f('0x11')])throw new Error(util[_0x869f('0x18')](_0x869f('0x19'),_0xd4313e));return _0x529b6a(_0x3e9b12[_0x869f('0x1a')]);})[_0x869f('0x1b')](function(_0x552cb3){_0x1d569c(_0x552cb3);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x224d4c,_0x12a6e0){return amiClient[_0x869f('0x14')](_0x869f('0x1c'),{})[_0x869f('0x17')](function(_0x46c865){if(_0x46c865['error'])throw new Error(_0x869f('0x1d'));return _0x224d4c(_0x46c865['result']);})[_0x869f('0x1b')](function(_0x4cfeba){_0x12a6e0(_0x4cfeba);});});}function initializeQueues(_0x4aed0b,_0xc283db,_0x58651a,_0x1ce313){var _0x58758f=[_0x869f('0x1e'),'available',_0x869f('0x1f'),'talking',_0x869f('0x20')];if(_0x58651a===_0x869f('0x21')&&_0x1ce313==='outbound'){_0x58758f[_0x869f('0x22')](_0x869f('0x23'),_0x869f('0x24'),'message','dialActive',_0x869f('0x25'),_0x869f('0x26'),_0x869f('0x27'),_0x869f('0x28'),_0x869f('0x29'),_0x869f('0x2a'),_0x869f('0x2b'),_0x869f('0x2c'),_0x869f('0x2d'),_0x869f('0x2e'),_0x869f('0x2f'),_0x869f('0x30'),_0x869f('0x31'),_0x869f('0x32'),'predictiveIntervalDroppedCallsTimeout',_0x869f('0x33'),_0x869f('0x34'),_0x869f('0x35'));}return _0x4aed0b[_0x869f('0x36')](function(_0x2696ae){var _0x3c5562=_0x2696ae['get']({'plain':!![]});_0x3c5562[_0x869f('0x37')]=[];_0x3c5562['paused']=0x0;_0x3c5562['loggedInDb']=0x0;_0x3c5562[_0x869f('0x1e')]=0x0;_0x3c5562[_0x869f('0x38')]=0x0;_0x3c5562['waiting']=0x0;if(_0x58651a==='voice'){_0x3c5562[_0x869f('0x39')]=0x0;_0x3c5562[_0x869f('0x3a')]=0x0;if(_0x1ce313==='outbound'){_0x3c5562[_0x869f('0x23')]=0x0;_0x3c5562[_0x869f('0x24')]=0x0;}}var _0x2081a8=_['find'](_0xc283db,['id',_0x3c5562['id']]);if(_0x2081a8)_[_0x869f('0x3b')](_0x3c5562,_[_0x869f('0x3c')](_0x2081a8,_0x58758f));return _0x3c5562;});}function updateAgentVoiceStatus(_0x250ec9,_0x484c8a,_0x5f02da){var _0x2341d=_[_0x869f('0x3d')](_0x5f02da,[_0x869f('0x3e'),_0x484c8a['name']]);if(_0x2341d['length']===0x0)return _0x250ec9[_0x869f('0x3a')]=!![];if(_[_0x869f('0x3f')](_0x2341d,[_0x869f('0x40'),_0x250ec9[_0x869f('0x41')][_0x869f('0x42')]()]))return _0x250ec9[_0x869f('0x39')]=!![];if(!_0x250ec9[_0x869f('0x39')])return _0x250ec9[_0x869f('0x3a')]=!![];}function getVoiceQueueAgents(_0x1fc805,_0x5686df,_0x200863,_0x1aa113){var _0x504826=_['find'](_0x5686df,['id',_0x1fc805['id']]);if(!_0x504826)return _0x1fc805;return _0x504826['getMembers']({'raw':!![]})[_0x869f('0x17')](function(_0x446360){for(var _0x399286=0x0;_0x399286<_0x446360[_0x869f('0x43')];_0x399286++){var _0x4cf8e0=_[_0x869f('0x44')](_0x200863,['id',_0x446360[_0x399286][_0x869f('0x45')]]);if(!_0x4cf8e0){_0x4cf8e0={'id':_0x446360[_0x399286][_0x869f('0x45')],'name':_0x446360[_0x399286][_0x869f('0x45')],'accountcode':'','online':![]};}var _0x51bcfd={'id':_0x4cf8e0['id'],'name':_0x4cf8e0['name'],'internal':_0x4cf8e0[_0x869f('0x46')],'online':Boolean(_0x4cf8e0['online']),'paused':Boolean(_0x446360[_0x399286]['paused'])};if(_0x4cf8e0[_0x869f('0x47')]===_0x869f('0x39'))updateAgentVoiceStatus(_0x51bcfd,_0x1fc805,_0x1aa113);if(_0x51bcfd[_0x869f('0x48')])_0x1fc805[_0x869f('0x49')]++;if(_0x51bcfd[_0x869f('0x3a')])_0x1fc805['busy']++;if(_0x51bcfd['paused']&&!_0x51bcfd['busy']&&!_0x51bcfd[_0x869f('0x39')])_0x1fc805[_0x869f('0x20')]++;_0x1fc805[_0x869f('0x37')]['push'](_0x51bcfd);}return _0x1fc805;});}function getQueueAgents(_0xe2acfa,_0x307f7d,_0x11ebcc){var _0x3fa1ec='User'+_[_0x869f('0x15')](_0x11ebcc)+_0x869f('0x4a');var _0x1dd7c5=_0x11ebcc+_0x869f('0x4b');return db[_0x3fa1ec]['findAll']({'where':{[_['startCase'](_0x11ebcc)+_0x869f('0x4c')]:_0xe2acfa['id']},'raw':!![]})['then'](function(_0x14f21f){for(var _0x89bb98=0x0;_0x89bb98<_0x14f21f[_0x869f('0x43')];_0x89bb98++){var _0x25de3c=_['find'](_0x307f7d,['id',_0x14f21f[_0x89bb98]['UserId']]);if(!_0x25de3c){_0x25de3c={'id':_0x14f21f[_0x89bb98][_0x869f('0x45')],'name':_0x14f21f[_0x89bb98][_0x869f('0x45')],'online':![],['pauseField']:![]};}var _0x2546a2={'id':_0x25de3c['id'],'name':_0x25de3c[_0x869f('0x13')],'online':Boolean(_0x25de3c[_0x869f('0x48')]),'paused':Boolean(_0x25de3c[_0x1dd7c5])};if(_0x2546a2[_0x869f('0x48')])_0xe2acfa[_0x869f('0x49')]++;_0xe2acfa[_0x869f('0x37')][_0x869f('0x22')](_0x2546a2);}return _0xe2acfa;});}function validateChannel(_0x131d90){var _0x49ddad=utils[_0x869f('0x4d')]();if(!_['includes'](_0x49ddad,_0x131d90[_0x869f('0x4e')]()))throw new Error(_0x869f('0x4f'));return _0x131d90['toLowerCase']();}exports[_0x869f('0x50')]=function(_0xac1250,_0x5ae098){var _0x2bef99={'count':0x0,'rows':[]};var _0x167982={};var _0x309742;var _0x31bd29;var _0xb8fb54;var _0x2e8df0;var _0x4305d3=utils[_0x869f('0x4d')]();var _0x520eb4=_0xac1250[_0x869f('0x51')]['globalQueueFilter'];var _0x1cb1aa=_0xac1250[_0x869f('0x51')][_0x869f('0x52')];var _0x30364d=_0xac1250[_0x869f('0x51')][_0x869f('0x53')];var _0x487344=_0x1cb1aa===_0x869f('0x54')||_0x1cb1aa===_0x869f('0x55')?!![]:![];var _0x3eb17a=[];var _0x2010f1;Promise[_0x869f('0x56')]()[_0x869f('0x17')](function(){if(_0xac1250[_0x869f('0x51')][_0x869f('0x57')]){_0x309742=validateChannel(_0xac1250[_0x869f('0x51')]['channel']);}if(!_0xac1250['query'][_0x869f('0x58')]||!_0xac1250[_0x869f('0x51')][_0x869f('0x58')]['includes']('globalStatus')){_0xac1250[_0x869f('0x51')][_0x869f('0x58')]=rta[_0x869f('0x59')](_0xac1250[_0x869f('0x51')]['sort']);return;}var _0x5a24a2=rta['getUpdatedSortOptions'](_0xac1250[_0x869f('0x51')][_0x869f('0x58')]);_0xac1250['query'][_0x869f('0x58')]=_0x5a24a2['fields'][_0x869f('0x5a')](',');_0x31bd29=_0x5a24a2[_0x869f('0x5b')];})[_0x869f('0x17')](function(){if(!_0x520eb4){return[];}return rta[_0x869f('0x5c')](_0x520eb4,_0x309742);})[_0x869f('0x17')](function(_0x179878){_0x3eb17a=_0x179878;return rta[_0x869f('0x5d')]();})[_0x869f('0x17')](function(_0x83cfd6){_0x2e8df0=_0x83cfd6[_0x869f('0x5e')];if((!_0x1cb1aa||_0x487344)&&!_0x31bd29){return _0x3eb17a;}if(_0x31bd29&&!_0x1cb1aa){return rta['getSortedAgentsIdsByStatus'](_0x2e8df0,_0x3eb17a,_0x31bd29);}else{return rta[_0x869f('0x5f')](_0x2e8df0,_0x3eb17a,_0x1cb1aa);}})[_0x869f('0x17')](function(_0x5366d2){_0x3eb17a=_0x5366d2;var _0x21f99d=![];if(_0x3eb17a[_0x869f('0x43')]===0x0){if(_0x520eb4||_0x1cb1aa){_0x21f99d=!![];}if(_0x487344){_0x21f99d=![];}}if(_0x21f99d){return _0x2bef99;}var _0x1462d8=_[_0x869f('0x36')](db['User'][_0x869f('0x60')],function(_0x5ab5ec){return{'name':_0x5ab5ec[_0x869f('0x61')],'type':_0x5ab5ec[_0x869f('0x62')]['key']};});_0xac1250[_0x869f('0x51')][_0x869f('0x63')]=_0x869f('0x64');_0xac1250[_0x869f('0x51')]['online']=!![];_0x167982=qs['getOptions'](_0x1462d8,_0xac1250);_0x167982['raw']=!![];var _0x426ef4=[];if(_0x3eb17a[_0x869f('0x43')]>0x0){_0x426ef4[_0x869f('0x22')]({'id':{'$in':_0x3eb17a}});if(_0x31bd29&&!_0x1cb1aa){_0x2010f1=[db[_0x869f('0x65')]['literal'](_0x869f('0x66')+_0x3eb17a+')')];_0x167982[_0x869f('0x5b')]=_0x2010f1;}}if(_0x487344){_0x4305d3[_0x869f('0x67')](function(_0x4e6bce){var _0x1e095f=!![];if(_0x1cb1aa===_0x869f('0x55')&&_0x309742!==_0x4e6bce){_0x1e095f=![];}_0x426ef4[_0x869f('0x22')]({[_0x4e6bce+_0x869f('0x4b')]:_0x1e095f});});if(_0x30364d){_0x426ef4[_0x869f('0x22')]({'pauseType':_0x30364d});}}else if(_0x1cb1aa){_0x4305d3[_0x869f('0x67')](function(_0xf4f144){_0x426ef4[_0x869f('0x22')]({[_0xf4f144+'Pause']:![]});});}_0x167982[_0x869f('0x68')]=_[_0x869f('0x3b')](_0x167982[_0x869f('0x68')],{'$and':_0x426ef4});if(_0xac1250['user'][_0x869f('0x63')]===_0x869f('0x69')){var _0x5ce73e={'params':{'id':_0xac1250['user']['userProfileId']},'query':{'section':'Agents','role':_0x869f('0x64'),'online':!![],'raw':!![],'ids':_0x3eb17a,'customSorting':_0x2010f1}};if(_0x487344){_0x5ce73e['query'][_0x869f('0x6a')]=_0x426ef4;}_0x5ce73e[_0x869f('0x51')]=Object[_0x869f('0x6b')](_0x5ce73e['query'],_0xac1250['query']);delete _0x5ce73e[_0x869f('0x51')]['id'];return db[_0x869f('0x6c')][_0x869f('0x6d')](_0x5ce73e);}return db[_0x869f('0x6e')][_0x869f('0x6f')](_0x167982);})['then'](function(_0x3acb86){_0x2bef99[_0x869f('0xb')]=_0x3acb86['count'];_0xb8fb54=_0x3acb86[_0x869f('0x5e')];return _0xb8fb54[_0x869f('0x36')](function(_0x1fa7b3){var _0x3b23f5=_['find'](_0x2e8df0,['id',_0x1fa7b3['id']]);if(_0x3b23f5){var _0x165f84=rta[_0x869f('0x70')](_0x3b23f5);_['merge'](_0x1fa7b3,_0x165f84);}_0x1fa7b3[_0x869f('0x71')]=rta['getAgentStatus'](_0x1fa7b3);if(_0x1fa7b3['globalStatus'][_0x869f('0x72')]('pause')){_0x4305d3[_0x869f('0x67')](function(_0x354261){if(_0x1fa7b3[_0x354261+_0x869f('0x4b')]){_0x1fa7b3[_0x354261+_0x869f('0x73')]='pause';}});}return _0x1fa7b3;});})[_0x869f('0x17')](function(_0x1cb877){if(!_0x31bd29||_0x2010f1){return _0x1cb877;}return rta[_0x869f('0x74')](_0x1cb877,_0x31bd29);})[_0x869f('0x17')](function(_0x3d9741){_0x2bef99[_0x869f('0x5e')]=_0x3d9741;return _0x2bef99;})['then'](respondWithFilteredResult(_0x5ae098,_0x167982))[_0x869f('0x1b')](handleError(_0x5ae098,null));};exports[_0x869f('0x75')]=function(_0x2f020d,_0xb3df36){var _0x582218={'count':0x0,'rows':[]},_0x13f3a3={},_0x1ca7ed,_0x5b57b5,_0x524884,_0x14ec8b,_0x29d9bf;Promise[_0x869f('0x56')]()['then'](function(){if(_0x2f020d['query'][_0x869f('0x57')])_0x1ca7ed=validateChannel(_0x2f020d[_0x869f('0x51')]['channel']);var _0x1368ca=_['startCase'](_0x1ca7ed)+'Queue';var _0x43f19e=_[_0x869f('0x36')](db[_0x1368ca][_0x869f('0x60')],function(_0x4a0ddd){return{'name':_0x4a0ddd[_0x869f('0x61')],'type':_0x4a0ddd[_0x869f('0x62')][_0x869f('0x76')]};});_0x13f3a3=qs[_0x869f('0x77')](_0x43f19e,_0x2f020d);if(_0x2f020d['user']['role']===_0x869f('0x69')){var _0x1792a2={'params':{'id':_0x2f020d[_0x869f('0x69')][_0x869f('0x78')]},'query':{'section':_0x1ca7ed==='voice'&&_0x2f020d[_0x869f('0x51')][_0x869f('0x62')]==='outbound'?'QueueCampaigns':_['startCase'](_0x1ca7ed)+_0x869f('0x16'),'type':_0x2f020d['query'][_0x869f('0x62')],'nolimit':!![],'sort':_0x869f('0x13'),'filter':_0x2f020d[_0x869f('0x51')][_0x869f('0x3d')]}};return db[_0x869f('0x6c')][_0x869f('0x6d')](_0x1792a2);}return db[_0x1368ca]['findAndCountAll'](_0x13f3a3);})[_0x869f('0x17')](function(_0x1e2b2c){_0x582218[_0x869f('0xb')]=_0x1e2b2c['count'];_0x5b57b5=_0x1e2b2c[_0x869f('0x5e')];return getRealtimeQueues(_0x2f020d,_0x1ca7ed);})[_0x869f('0x17')](function(_0x210796){_0x14ec8b=_0x210796[_0x869f('0x5e')];return rta['getRealtimeAgents']();})[_0x869f('0x17')](function(_0x5a14b5){_0x524884=_0x5a14b5[_0x869f('0x5e')];if(_0x1ca7ed!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x869f('0x17')](function(_0x341f45){_0x29d9bf=_0x341f45?_0x341f45['rows']:[];return initializeQueues(_0x5b57b5,_0x14ec8b,_0x1ca7ed,_0x2f020d[_0x869f('0x51')][_0x869f('0x62')]);})[_0x869f('0x17')](function(_0x537ac6){var _0x5ec07e=_0x537ac6[_0x869f('0x36')](function(_0x1a91ed){if(_0x1ca7ed===_0x869f('0x21'))return getVoiceQueueAgents(_0x1a91ed,_0x5b57b5,_0x524884,_0x29d9bf);else return getQueueAgents(_0x1a91ed,_0x524884,_0x1ca7ed);});return Promise[_0x869f('0x79')](_0x5ec07e);})['then'](function(_0x2a4e8d){_0x582218[_0x869f('0x5e')]=_0x2a4e8d;return _0x582218;})['then'](respondWithFilteredResult(_0xb3df36,_0x13f3a3))[_0x869f('0x1b')](handleError(_0xb3df36,null));}; \ No newline at end of file +var _0xbdaa=['../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','stack','name','voice','request','startCase','then','format','catch','VoiceQueuesChannels','available','talking','paused','outbound','push','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','loggedInDb','waiting','busy','pTalking','find','pick','filter','queue','length','some','connectedlinenum','toString','getMembers','UserId','accountcode','online','voiceStatus','agents','User','Pause','findAll','QueueId','getChannels','includes','Invalid\x20channel','toLowerCase','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','channel','sort','globalStatus','validateSortParameter','fields','join','order','getRealtimeAgents','rows','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','getAgentStatus','pause','Status','resolve','rawAttributes','QueueCampaigns','../../components/realtime/agents','../../components/parsers/qs','../../config/utils'];(function(_0xa75c23,_0x5131c0){var _0x3a07c8=function(_0x252b43){while(--_0x252b43){_0xa75c23['push'](_0xa75c23['shift']());}};_0x3a07c8(++_0x5131c0);}(_0xbdaa,0x6f));var _0xabda=function(_0xc9ab68,_0x25d5bd){_0xc9ab68=_0xc9ab68-0x0;var _0x44054d=_0xbdaa[_0xc9ab68];return _0x44054d;};'use strict';var util=require('util');var _=require('lodash');var jayson=require('jayson/promise');var rta=require(_0xabda('0x0'));var qs=require(_0xabda('0x1'));var utils=require(_0xabda('0x2'));var logger=require('../../config/logger')('api');var db=require(_0xabda('0x3'))['db'];var amiClient=jayson[_0xabda('0x4')][_0xabda('0x5')]({'port':0x232a});var routingClient=jayson[_0xabda('0x4')][_0xabda('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x5826da,_0x19bdee){return function(_0x5b21de){if(_0x5b21de){var _0x268211=typeof _0x19bdee[_0xabda('0x6')]===_0xabda('0x7')&&typeof _0x19bdee[_0xabda('0x8')]==='undefined';var _0x4b2200=_0x5b21de[_0xabda('0x9')];var _0x552ad7=_0x268211?0x0:_0x19bdee[_0xabda('0x6')];var _0x1a459d=_0x268211?_0x5b21de[_0xabda('0x9')]:_0x19bdee[_0xabda('0x6')]+_0x19bdee[_0xabda('0x8')];var _0x1bac9b;if(_0x1a459d>=_0x4b2200){_0x1a459d=_0x4b2200;_0x1bac9b=0xc8;}else{_0x1bac9b=0xce;}_0x5826da[_0xabda('0xa')](_0x1bac9b);return _0x5826da[_0xabda('0xb')](_0xabda('0xc'),_0x552ad7+'-'+_0x1a459d+'/'+_0x4b2200)[_0xabda('0xd')](_0x5b21de);}return null;};}function handleError(_0x878dde,_0xb8d154){_0xb8d154=_0xb8d154||0x1f4;return function(_0x52a4fc){logger[_0xabda('0xe')](_0x52a4fc[_0xabda('0xf')]);if(_0x52a4fc[_0xabda('0x10')]){delete _0x52a4fc[_0xabda('0x10')];}_0x878dde[_0xabda('0xa')](_0xb8d154)['send'](_0x52a4fc);};}function getRealtimeQueues(_0x2fbec1,_0x3b75b0){return new Promise(function(_0x1dee41,_0x3965af){var _0x457ce5=_0x3b75b0===_0xabda('0x11')?amiClient:routingClient;return _0x457ce5[_0xabda('0x12')](_[_0xabda('0x13')](_0x3b75b0)+'Queues',_0x2fbec1)[_0xabda('0x14')](function(_0x3329d0){if(_0x3329d0[_0xabda('0xe')])throw new Error(util[_0xabda('0x15')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x3b75b0));return _0x1dee41(_0x3329d0['result']);})[_0xabda('0x16')](function(_0x2f2dee){_0x3965af(_0x2f2dee);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x12b6cb,_0x5352cb){return amiClient[_0xabda('0x12')](_0xabda('0x17'),{})[_0xabda('0x14')](function(_0x1bf6f3){if(_0x1bf6f3[_0xabda('0xe')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x12b6cb(_0x1bf6f3['result']);})[_0xabda('0x16')](function(_0x41e0c8){_0x5352cb(_0x41e0c8);});});}function initializeQueues(_0x5ecca0,_0x34972a,_0x5a6bd5,_0x40b41b){var _0x59071a=['loggedIn',_0xabda('0x18'),'waiting',_0xabda('0x19'),_0xabda('0x1a')];if(_0x5a6bd5===_0xabda('0x11')&&_0x40b41b===_0xabda('0x1b')){_0x59071a[_0xabda('0x1c')]('pTalking','originated','message',_0xabda('0x1d'),_0xabda('0x1e'),_0xabda('0x1f'),_0xabda('0x20'),_0xabda('0x21'),'erlangCalls',_0xabda('0x22'),'erlangAbandonmentRate',_0xabda('0x23'),_0xabda('0x24'),_0xabda('0x25'),_0xabda('0x26'),'predictiveIntervalAvailable',_0xabda('0x27'),_0xabda('0x28'),_0xabda('0x29'),_0xabda('0x2a'),_0xabda('0x2b'),_0xabda('0x2c'));}return _0x5ecca0[_0xabda('0x2d')](function(_0x5a378c){var _0x195a76=_0x5a378c[_0xabda('0x2e')]({'plain':!![]});_0x195a76['agents']=[];_0x195a76[_0xabda('0x1a')]=0x0;_0x195a76[_0xabda('0x2f')]=0x0;_0x195a76['loggedIn']=0x0;_0x195a76['available']=0x0;_0x195a76[_0xabda('0x30')]=0x0;if(_0x5a6bd5===_0xabda('0x11')){_0x195a76[_0xabda('0x19')]=0x0;_0x195a76[_0xabda('0x31')]=0x0;if(_0x40b41b===_0xabda('0x1b')){_0x195a76[_0xabda('0x32')]=0x0;_0x195a76['originated']=0x0;}}var _0x11704=_[_0xabda('0x33')](_0x34972a,['id',_0x195a76['id']]);if(_0x11704)_['merge'](_0x195a76,_[_0xabda('0x34')](_0x11704,_0x59071a));return _0x195a76;});}function updateAgentVoiceStatus(_0x3cba24,_0x1a4988,_0x187b97){var _0x1a65d6=_[_0xabda('0x35')](_0x187b97,[_0xabda('0x36'),_0x1a4988[_0xabda('0x10')]]);if(_0x1a65d6[_0xabda('0x37')]===0x0)return _0x3cba24[_0xabda('0x31')]=!![];if(_[_0xabda('0x38')](_0x1a65d6,[_0xabda('0x39'),_0x3cba24['internal'][_0xabda('0x3a')]()]))return _0x3cba24[_0xabda('0x19')]=!![];if(!_0x3cba24[_0xabda('0x19')])return _0x3cba24[_0xabda('0x31')]=!![];}function getVoiceQueueAgents(_0x1ff33b,_0x14771e,_0x429574,_0x167769){var _0x4c4312=_[_0xabda('0x33')](_0x14771e,['id',_0x1ff33b['id']]);if(!_0x4c4312)return _0x1ff33b;return _0x4c4312[_0xabda('0x3b')]({'raw':!![]})[_0xabda('0x14')](function(_0x48e252){for(var _0x50f4f9=0x0;_0x50f4f9<_0x48e252[_0xabda('0x37')];_0x50f4f9++){var _0x956227=_[_0xabda('0x33')](_0x429574,['id',_0x48e252[_0x50f4f9][_0xabda('0x3c')]]);if(!_0x956227){_0x956227={'id':_0x48e252[_0x50f4f9][_0xabda('0x3c')],'name':_0x48e252[_0x50f4f9][_0xabda('0x3c')],'accountcode':'','online':![]};}var _0x5bc56d={'id':_0x956227['id'],'name':_0x956227[_0xabda('0x10')],'internal':_0x956227[_0xabda('0x3d')],'online':Boolean(_0x956227[_0xabda('0x3e')]),'paused':Boolean(_0x48e252[_0x50f4f9]['paused'])};if(_0x956227[_0xabda('0x3f')]===_0xabda('0x19'))updateAgentVoiceStatus(_0x5bc56d,_0x1ff33b,_0x167769);if(_0x5bc56d[_0xabda('0x3e')])_0x1ff33b['loggedInDb']++;if(_0x5bc56d[_0xabda('0x31')])_0x1ff33b[_0xabda('0x31')]++;if(_0x5bc56d[_0xabda('0x1a')]&&!_0x5bc56d[_0xabda('0x31')]&&!_0x5bc56d['talking'])_0x1ff33b['paused']++;_0x1ff33b[_0xabda('0x40')][_0xabda('0x1c')](_0x5bc56d);}return _0x1ff33b;});}function getQueueAgents(_0x4fa984,_0x1e1b3f,_0x1cec40){var _0x42b069=_0xabda('0x41')+_[_0xabda('0x13')](_0x1cec40)+'Queue';var _0x3e4ff4=_0x1cec40+_0xabda('0x42');return db[_0x42b069][_0xabda('0x43')]({'where':{[_[_0xabda('0x13')](_0x1cec40)+_0xabda('0x44')]:_0x4fa984['id']},'raw':!![]})['then'](function(_0x2e6464){for(var _0x154447=0x0;_0x154447<_0x2e6464[_0xabda('0x37')];_0x154447++){var _0x439703=_[_0xabda('0x33')](_0x1e1b3f,['id',_0x2e6464[_0x154447][_0xabda('0x3c')]]);if(!_0x439703){_0x439703={'id':_0x2e6464[_0x154447][_0xabda('0x3c')],'name':_0x2e6464[_0x154447][_0xabda('0x3c')],'online':![],['pauseField']:![]};}var _0x171f5b={'id':_0x439703['id'],'name':_0x439703[_0xabda('0x10')],'online':Boolean(_0x439703['online']),'paused':Boolean(_0x439703[_0x3e4ff4])};if(_0x171f5b[_0xabda('0x3e')])_0x4fa984[_0xabda('0x2f')]++;_0x4fa984[_0xabda('0x40')][_0xabda('0x1c')](_0x171f5b);}return _0x4fa984;});}function validateChannel(_0x3159c5){var _0xb807dd=utils[_0xabda('0x45')]();if(!_[_0xabda('0x46')](_0xb807dd,_0x3159c5['toLowerCase']()))throw new Error(_0xabda('0x47'));return _0x3159c5[_0xabda('0x48')]();}exports['getAgents']=function(_0x4bdef6,_0x3a5545){var _0x396402={'count':0x0,'rows':[]};var _0x341482={};var _0x182408;var _0x2a14c5;var _0x1e031b;var _0x2d5cc6;var _0x493465=utils[_0xabda('0x45')]();var _0x2115d6=_0x4bdef6[_0xabda('0x49')][_0xabda('0x4a')];var _0x21ca52=_0x4bdef6[_0xabda('0x49')][_0xabda('0x4b')];var _0x37036b=_0x4bdef6[_0xabda('0x49')][_0xabda('0x4c')];var _0x992cb8=_0x21ca52==='pause'||_0x21ca52===_0xabda('0x4d')?!![]:![];var _0x465900=[];var _0x4d3925;Promise['resolve']()[_0xabda('0x14')](function(){if(_0x4bdef6[_0xabda('0x49')][_0xabda('0x4e')]){_0x182408=validateChannel(_0x4bdef6[_0xabda('0x49')][_0xabda('0x4e')]);}if(!_0x4bdef6[_0xabda('0x49')]['sort']||!_0x4bdef6['query'][_0xabda('0x4f')]['includes'](_0xabda('0x50'))){_0x4bdef6[_0xabda('0x49')][_0xabda('0x4f')]=rta[_0xabda('0x51')](_0x4bdef6[_0xabda('0x49')]['sort']);return;}var _0x1939d4=rta['getUpdatedSortOptions'](_0x4bdef6[_0xabda('0x49')]['sort']);_0x4bdef6[_0xabda('0x49')][_0xabda('0x4f')]=_0x1939d4[_0xabda('0x52')][_0xabda('0x53')](',');_0x2a14c5=_0x1939d4[_0xabda('0x54')];})[_0xabda('0x14')](function(){if(!_0x2115d6){return[];}return rta['getAgentIdsByQueues'](_0x2115d6,_0x182408);})[_0xabda('0x14')](function(_0x12a590){_0x465900=_0x12a590;return rta[_0xabda('0x55')]();})[_0xabda('0x14')](function(_0x596ea1){_0x2d5cc6=_0x596ea1[_0xabda('0x56')];if((!_0x21ca52||_0x992cb8)&&!_0x2a14c5){return _0x465900;}if(_0x2a14c5&&!_0x21ca52){return rta['getSortedAgentsIdsByStatus'](_0x2d5cc6,_0x465900,_0x2a14c5);}else{return rta['getAgentIdsByStatus'](_0x2d5cc6,_0x465900,_0x21ca52);}})[_0xabda('0x14')](function(_0x29b8a8){_0x465900=_0x29b8a8;var _0x551a18=![];if(_0x465900[_0xabda('0x37')]===0x0){if(_0x2115d6||_0x21ca52){_0x551a18=!![];}if(_0x992cb8){_0x551a18=![];}}if(_0x551a18){return _0x396402;}var _0x2a4a76=_[_0xabda('0x2d')](db[_0xabda('0x41')]['rawAttributes'],function(_0x25a50a){return{'name':_0x25a50a[_0xabda('0x57')],'type':_0x25a50a[_0xabda('0x58')][_0xabda('0x59')]};});_0x4bdef6[_0xabda('0x49')][_0xabda('0x5a')]=_0xabda('0x5b');_0x4bdef6[_0xabda('0x49')][_0xabda('0x3e')]=!![];_0x341482=qs[_0xabda('0x5c')](_0x2a4a76,_0x4bdef6);_0x341482[_0xabda('0x5d')]=!![];var _0x5ba1fa=[];if(_0x465900[_0xabda('0x37')]>0x0){_0x5ba1fa['push']({'id':{'$in':_0x465900}});if(_0x2a14c5&&!_0x21ca52){_0x4d3925=[db[_0xabda('0x5e')][_0xabda('0x5f')](_0xabda('0x60')+_0x465900+')')];_0x341482[_0xabda('0x54')]=_0x4d3925;}}if(_0x992cb8){_0x493465[_0xabda('0x61')](function(_0x45b5cc){var _0x59bed4=!![];if(_0x21ca52==='*pause'&&_0x182408!==_0x45b5cc){_0x59bed4=![];}_0x5ba1fa['push']({[_0x45b5cc+_0xabda('0x42')]:_0x59bed4});});if(_0x37036b){_0x5ba1fa[_0xabda('0x1c')]({'pauseType':_0x37036b});}}else if(_0x21ca52){_0x493465[_0xabda('0x61')](function(_0x2f3296){_0x5ba1fa[_0xabda('0x1c')]({[_0x2f3296+_0xabda('0x42')]:![]});});}_0x341482[_0xabda('0x62')]=_[_0xabda('0x63')](_0x341482[_0xabda('0x62')],{'$and':_0x5ba1fa});if(_0x4bdef6['user'][_0xabda('0x5a')]===_0xabda('0x64')){var _0x48d2e9={'params':{'id':_0x4bdef6[_0xabda('0x64')][_0xabda('0x65')]},'query':{'section':_0xabda('0x66'),'role':'agent','online':!![],'raw':!![],'ids':_0x465900,'customSorting':_0x4d3925}};if(_0x992cb8){_0x48d2e9['query'][_0xabda('0x67')]=_0x5ba1fa;}_0x48d2e9[_0xabda('0x49')]=Object[_0xabda('0x68')](_0x48d2e9[_0xabda('0x49')],_0x4bdef6[_0xabda('0x49')]);delete _0x48d2e9[_0xabda('0x49')]['id'];return db[_0xabda('0x69')][_0xabda('0x6a')](_0x48d2e9);}return db[_0xabda('0x41')][_0xabda('0x6b')](_0x341482);})[_0xabda('0x14')](function(_0x58fa64){_0x396402['count']=_0x58fa64[_0xabda('0x9')];_0x1e031b=_0x58fa64['rows'];return _0x1e031b[_0xabda('0x2d')](function(_0x544b20){var _0x59adab=_['find'](_0x2d5cc6,['id',_0x544b20['id']]);if(_0x59adab){var _0xd9b3ec=rta['filterAgentAttributes'](_0x59adab);_[_0xabda('0x63')](_0x544b20,_0xd9b3ec);}_0x544b20[_0xabda('0x50')]=rta[_0xabda('0x6c')](_0x544b20);if(_0x544b20[_0xabda('0x50')][_0xabda('0x46')](_0xabda('0x6d'))){_0x493465[_0xabda('0x61')](function(_0x4d3d49){if(_0x544b20[_0x4d3d49+_0xabda('0x42')]){_0x544b20[_0x4d3d49+_0xabda('0x6e')]=_0xabda('0x6d');}});}return _0x544b20;});})[_0xabda('0x14')](function(_0x13d3ad){if(!_0x2a14c5||_0x4d3925){return _0x13d3ad;}return rta['sortAgentsByStatus'](_0x13d3ad,_0x2a14c5);})[_0xabda('0x14')](function(_0x5553ef){_0x396402[_0xabda('0x56')]=_0x5553ef;return _0x396402;})[_0xabda('0x14')](respondWithFilteredResult(_0x3a5545,_0x341482))[_0xabda('0x16')](handleError(_0x3a5545,null));};exports['getQueues']=function(_0x5d0d61,_0x407958){var _0x321e8f={'count':0x0,'rows':[]},_0x177f43={},_0x17ff06,_0x7104f5,_0x18c1cb,_0x42215a,_0x1fa8f6;Promise[_0xabda('0x6f')]()['then'](function(){if(_0x5d0d61[_0xabda('0x49')][_0xabda('0x4e')])_0x17ff06=validateChannel(_0x5d0d61['query'][_0xabda('0x4e')]);var _0xf28daf=_[_0xabda('0x13')](_0x17ff06)+'Queue';var _0x12a47d=_[_0xabda('0x2d')](db[_0xf28daf][_0xabda('0x70')],function(_0x2ea5e3){return{'name':_0x2ea5e3[_0xabda('0x57')],'type':_0x2ea5e3['type'][_0xabda('0x59')]};});_0x177f43=qs['getOptions'](_0x12a47d,_0x5d0d61);if(_0x5d0d61['user'][_0xabda('0x5a')]===_0xabda('0x64')){var _0x3cf2c9={'params':{'id':_0x5d0d61[_0xabda('0x64')][_0xabda('0x65')]},'query':{'section':_0x17ff06===_0xabda('0x11')&&_0x5d0d61[_0xabda('0x49')][_0xabda('0x58')]===_0xabda('0x1b')?_0xabda('0x71'):_[_0xabda('0x13')](_0x17ff06)+'Queues','type':_0x5d0d61[_0xabda('0x49')][_0xabda('0x58')],'nolimit':!![],'sort':_0xabda('0x10'),'filter':_0x5d0d61[_0xabda('0x49')][_0xabda('0x35')]}};return db[_0xabda('0x69')][_0xabda('0x6a')](_0x3cf2c9);}return db[_0xf28daf]['findAndCountAll'](_0x177f43);})[_0xabda('0x14')](function(_0x27a860){_0x321e8f[_0xabda('0x9')]=_0x27a860[_0xabda('0x9')];_0x7104f5=_0x27a860[_0xabda('0x56')];return getRealtimeQueues(_0x5d0d61,_0x17ff06);})[_0xabda('0x14')](function(_0x53b6ba){_0x42215a=_0x53b6ba[_0xabda('0x56')];return rta[_0xabda('0x55')]();})[_0xabda('0x14')](function(_0x5ea64d){_0x18c1cb=_0x5ea64d[_0xabda('0x56')];if(_0x17ff06!=_0xabda('0x11'))return;return getRealtimeVoiceQueueChannels();})[_0xabda('0x14')](function(_0x10d2cd){_0x1fa8f6=_0x10d2cd?_0x10d2cd[_0xabda('0x56')]:[];return initializeQueues(_0x7104f5,_0x42215a,_0x17ff06,_0x5d0d61[_0xabda('0x49')]['type']);})[_0xabda('0x14')](function(_0x359aad){var _0x1d8ce2=_0x359aad[_0xabda('0x2d')](function(_0x2475d3){if(_0x17ff06===_0xabda('0x11'))return getVoiceQueueAgents(_0x2475d3,_0x7104f5,_0x18c1cb,_0x1fa8f6);else return getQueueAgents(_0x2475d3,_0x18c1cb,_0x17ff06);});return Promise['all'](_0x1d8ce2);})['then'](function(_0x346fec){_0x321e8f['rows']=_0x346fec;return _0x321e8f;})['then'](respondWithFilteredResult(_0x407958,_0x177f43))[_0xabda('0x16')](handleError(_0x407958,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4c0726a..79a34c9 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5e1855,_0x17161e){var _0x4faf68=function(_0x2bfb27){while(--_0x2bfb27){_0x5e1855['push'](_0x5e1855['shift']());}};_0x4faf68(++_0x17161e);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'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(_0x132bc6,_0x3d9dce){var _0x40ba2d=function(_0x1f55a2){while(--_0x1f55a2){_0x132bc6['push'](_0x132bc6['shift']());}};_0x40ba2d(++_0x3d9dce);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xcb91[_0x191154];return _0x3dcd73;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 32f117a..c552108 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 _0x02b6=['STRING','DATE','sequelize','INTEGER'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x02b6,0xfe));var _0x602b=function(_0x53f6f7,_0x3d14c9){_0x53f6f7=_0x53f6f7-0x0;var _0x5ae36d=_0x02b6[_0x53f6f7];return _0x5ae36d;};'use strict';var Sequelize=require(_0x602b('0x0'));module['exports']={'state':{'type':Sequelize[_0x602b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x602b('0x2')]},'scheduledat':{'type':Sequelize[_0x602b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x602b('0x3')]},'ringtime':{'type':Sequelize[_0x602b('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x602b('0x2')]},'campaigntype':{'type':Sequelize[_0x602b('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa786=['DATE','INTEGER','STRING'];(function(_0x13d6f3,_0xec837c){var _0x17a727=function(_0xa2050c){while(--_0xa2050c){_0x13d6f3['push'](_0x13d6f3['shift']());}};_0x17a727(++_0xec837c);}(_0xa786,0x1d2));var _0x6a78=function(_0x123835,_0x828ce2){_0x123835=_0x123835-0x0;var _0x3fbfed=_0xa786[_0x123835];return _0x3fbfed;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x6a78('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x6a78('0x1')]},'scheduledat':{'type':Sequelize[_0x6a78('0x2')]},'uniqueid':{'type':Sequelize[_0x6a78('0x1')]},'starttime':{'type':Sequelize[_0x6a78('0x2')]},'responsetime':{'type':Sequelize[_0x6a78('0x2')]},'ringtime':{'type':Sequelize[_0x6a78('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6a78('0x1')]},'membername':{'type':Sequelize[_0x6a78('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 7c708af..84ce725 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 _0xa6ac=['ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x499e52,_0x237493){var _0x1cb1cb=function(_0x1b4c7c){while(--_0x1b4c7c){_0x499e52['push'](_0x499e52['shift']());}};_0x1cb1cb(++_0x237493);}(_0xa6ac,0xc5));var _0xca6a=function(_0x4d03ca,_0x3f4059){_0x4d03ca=_0x4d03ca-0x0;var _0x2b444d=_0xa6ac[_0x4d03ca];return _0x2b444d;};'use strict';var _=require(_0xca6a('0x0'));var util=require(_0xca6a('0x1'));var logger=require(_0xca6a('0x2'))(_0xca6a('0x3'));var moment=require(_0xca6a('0x4'));var BPromise=require(_0xca6a('0x5'));var rp=require(_0xca6a('0x6'));var fs=require('fs');var path=require(_0xca6a('0x7'));var rimraf=require(_0xca6a('0x8'));var config=require(_0xca6a('0x9'));var attributes=require(_0xca6a('0xa'));module[_0xca6a('0xb')]=function(_0x24519a,_0x434ad4){return _0x24519a[_0xca6a('0xc')](_0xca6a('0xd'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f3b=['./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x5303a2,_0x49716b){var _0x448ac5=function(_0xff8c40){while(--_0xff8c40){_0x5303a2['push'](_0x5303a2['shift']());}};_0x448ac5(++_0x49716b);}(_0x4f3b,0x7c));var _0xb4f3=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x4f3b[_0x2e3545];return _0xcf18f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb4f3('0x0'))(_0xb4f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4f3('0x2'));var fs=require('fs');var path=require(_0xb4f3('0x3'));var rimraf=require(_0xb4f3('0x4'));var config=require(_0xb4f3('0x5'));var attributes=require(_0xb4f3('0x6'));module[_0xb4f3('0x7')]=function(_0x19ba76,_0x58978d){return _0x19ba76['define'](_0xb4f3('0x8'),attributes,{'tableName':_0xb4f3('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 78dba8a..daee58d 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 _0xa110=['create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x3baa62,_0x41efa0){var _0x329115=function(_0x1db528){while(--_0x1db528){_0x3baa62['push'](_0x3baa62['shift']());}};_0x329115(++_0x41efa0);}(_0xa110,0x111));var _0x0a11=function(_0x1a1f48,_0x5c4df6){_0x1a1f48=_0x1a1f48-0x0;var _0xd539d0=_0xa110[_0x1a1f48];return _0xd539d0;};'use strict';var _=require(_0x0a11('0x0'));var util=require(_0x0a11('0x1'));var moment=require('moment');var BPromise=require(_0x0a11('0x2'));var rs=require(_0x0a11('0x3'));var fs=require('fs');var Redis=require(_0x0a11('0x4'));var db=require(_0x0a11('0x5'))['db'];var utils=require(_0x0a11('0x6'));var logger=require(_0x0a11('0x7'))(_0x0a11('0x8'));var config=require(_0x0a11('0x9'));var jayson=require(_0x0a11('0xa'));var client=jayson[_0x0a11('0xb')][_0x0a11('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2576ad,_0x1faaeb,_0x5ac9f1){return new BPromise(function(_0x5c7ad9,_0x1716f5){return client['request'](_0x2576ad,_0x5ac9f1)[_0x0a11('0xd')](function(_0x42b6e3){logger[_0x0a11('0xe')](_0x0a11('0xf'),_0x1faaeb,'request\x20sent');logger[_0x0a11('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1faaeb,_0x0a11('0x11'),JSON[_0x0a11('0x12')](_0x42b6e3));if(_0x42b6e3['error']){if(_0x42b6e3[_0x0a11('0x13')]['code']===0x1f4){logger[_0x0a11('0x13')](_0x0a11('0xf'),_0x1faaeb,_0x42b6e3[_0x0a11('0x13')][_0x0a11('0x14')]);return _0x1716f5(_0x42b6e3[_0x0a11('0x13')][_0x0a11('0x14')]);}logger[_0x0a11('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x1faaeb,_0x42b6e3[_0x0a11('0x13')][_0x0a11('0x14')]);return _0x5c7ad9(_0x42b6e3[_0x0a11('0x13')][_0x0a11('0x14')]);}else{logger[_0x0a11('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x1faaeb,_0x0a11('0x11'));_0x5c7ad9(_0x42b6e3['result'][_0x0a11('0x14')]);}})[_0x0a11('0x15')](function(_0x5bbfa9){logger[_0x0a11('0x13')](_0x0a11('0xf'),_0x1faaeb,_0x5bbfa9);_0x1716f5(_0x5bbfa9);});});}exports[_0x0a11('0x16')]=function(_0x415441){var _0x522bbe=this;return new Promise(function(_0x9c043b,_0x10bbad){return db[_0x0a11('0x17')][_0x0a11('0x18')](_0x415441[_0x0a11('0x19')],{'raw':_0x415441[_0x0a11('0x1a')]?_0x415441[_0x0a11('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0a11('0xd')](function(_0x24efed){logger['info']('CreateReportAgentPreview',_0x415441);logger['debug'](_0x0a11('0x16'),_0x415441,JSON[_0x0a11('0x12')](_0x24efed));_0x9c043b(_0x24efed);})[_0x0a11('0x15')](function(_0x1ded1c){logger[_0x0a11('0x13')](_0x0a11('0x16'),_0x1ded1c['message'],_0x415441);_0x10bbad(_0x522bbe['error'](0x1f4,_0x1ded1c['message']));});});}; \ No newline at end of file +var _0x8163=['../../config/utils','../../config/logger','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0x8163,0x127));var _0x3816=function(_0x1e6016,_0xc94eda){_0x1e6016=_0x1e6016-0x0;var _0x265be=_0x8163[_0x1e6016];return _0x265be;};'use strict';var _=require(_0x3816('0x0'));var util=require(_0x3816('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3816('0x2'));var fs=require('fs');var Redis=require(_0x3816('0x3'));var db=require(_0x3816('0x4'))['db'];var utils=require(_0x3816('0x5'));var logger=require(_0x3816('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3816('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbdf279,_0x5cdb27,_0x315f9c){return new BPromise(function(_0x60f5bf,_0x514a55){return client[_0x3816('0x8')](_0xbdf279,_0x315f9c)[_0x3816('0x9')](function(_0x3b18f9){logger[_0x3816('0xa')](_0x3816('0xb'),_0x5cdb27,_0x3816('0xc'));logger[_0x3816('0xd')](_0x3816('0xe'),_0x5cdb27,'request\x20sent',JSON[_0x3816('0xf')](_0x3b18f9));if(_0x3b18f9[_0x3816('0x10')]){if(_0x3b18f9[_0x3816('0x10')][_0x3816('0x11')]===0x1f4){logger[_0x3816('0x10')](_0x3816('0xb'),_0x5cdb27,_0x3b18f9['error'][_0x3816('0x12')]);return _0x514a55(_0x3b18f9[_0x3816('0x10')][_0x3816('0x12')]);}logger[_0x3816('0x10')](_0x3816('0xb'),_0x5cdb27,_0x3b18f9[_0x3816('0x10')]['message']);return _0x60f5bf(_0x3b18f9[_0x3816('0x10')][_0x3816('0x12')]);}else{logger['info'](_0x3816('0xb'),_0x5cdb27,_0x3816('0xc'));_0x60f5bf(_0x3b18f9['result'][_0x3816('0x12')]);}})['catch'](function(_0x3f4211){logger[_0x3816('0x10')](_0x3816('0xb'),_0x5cdb27,_0x3f4211);_0x514a55(_0x3f4211);});});}exports['CreateReportAgentPreview']=function(_0x26506f){var _0x155888=this;return new Promise(function(_0x2a213b,_0x32be6d){return db[_0x3816('0x13')][_0x3816('0x14')](_0x26506f['body'],{'raw':_0x26506f[_0x3816('0x15')]?_0x26506f[_0x3816('0x15')][_0x3816('0x16')]===undefined?!![]:![]:!![]})[_0x3816('0x9')](function(_0xc724b){logger[_0x3816('0xa')](_0x3816('0x17'),_0x26506f);logger[_0x3816('0xd')]('CreateReportAgentPreview',_0x26506f,JSON[_0x3816('0xf')](_0xc724b));_0x2a213b(_0xc724b);})[_0x3816('0x18')](function(_0x43070b){logger[_0x3816('0x10')](_0x3816('0x17'),_0x43070b[_0x3816('0x12')],_0x26506f);_0x32be6d(_0x155888['error'](0x1f4,_0x43070b[_0x3816('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0fe8154..ad8e486 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 _0x602a=['/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','mailQueues','/mail/accounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','agents','agentCapacity','/telephones','telephones','/trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify'];(function(_0x3364fc,_0x559233){var _0x10df36=function(_0x28d38d){while(--_0x28d38d){_0x3364fc['push'](_0x3364fc['shift']());}};_0x10df36(++_0x559233);}(_0x602a,0x1de));var _0xa602=function(_0x5ed7ea,_0x2d213b){_0x5ed7ea=_0x5ed7ea-0x0;var _0x4ac361=_0x602a[_0x5ed7ea];return _0x4ac361;};'use strict';var multer=require(_0xa602('0x0'));var util=require('util');var path=require(_0xa602('0x1'));var express=require(_0xa602('0x2'));var router=express[_0xa602('0x3')]();var auth=require(_0xa602('0x4'));var controller=require('./rpc.controller');router[_0xa602('0x5')](_0xa602('0x6'),auth['isAuthenticated'](),controller[_0xa602('0x7')]);router[_0xa602('0x5')](_0xa602('0x8'),auth[_0xa602('0x9')](),controller['voiceChannelMixMonitor']);router[_0xa602('0x5')](_0xa602('0xa'),auth[_0xa602('0x9')](),controller[_0xa602('0xb')]);router[_0xa602('0x5')](_0xa602('0xc'),auth['isAuthenticated'](),controller[_0xa602('0xd')]);router[_0xa602('0x5')](_0xa602('0xe'),auth['isAuthenticated'](),controller['chatQueues']);router['get']('/mail/queues',auth[_0xa602('0x9')](),controller[_0xa602('0xf')]);router[_0xa602('0x5')](_0xa602('0x10'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0xa602('0x5')](_0xa602('0x11'),auth[_0xa602('0x9')](),controller['openchannelQueues']);router['get'](_0xa602('0x12'),auth[_0xa602('0x9')](),controller[_0xa602('0x13')]);router[_0xa602('0x5')](_0xa602('0x14'),auth[_0xa602('0x9')](),controller[_0xa602('0x15')]);router[_0xa602('0x5')](_0xa602('0x16'),auth[_0xa602('0x9')](),controller[_0xa602('0x17')]);router[_0xa602('0x5')](_0xa602('0x18'),auth[_0xa602('0x9')](),controller[_0xa602('0x19')]);router['get'](_0xa602('0x1a'),auth[_0xa602('0x9')](),controller[_0xa602('0x1b')]);router[_0xa602('0x5')](_0xa602('0x1c'),auth[_0xa602('0x9')](),controller[_0xa602('0x1d')]);router[_0xa602('0x5')](_0xa602('0x1e'),auth['isAuthenticated'](),controller[_0xa602('0x1f')]);router[_0xa602('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0xa602('0x5')](_0xa602('0x20'),auth[_0xa602('0x9')](),controller[_0xa602('0x21')]);router[_0xa602('0x22')](_0xa602('0x20'),auth[_0xa602('0x9')](),controller['updateVoiceQueue']);router['get'](_0xa602('0x23'),auth[_0xa602('0x9')](),controller[_0xa602('0x24')]);router[_0xa602('0x5')](_0xa602('0x25'),auth[_0xa602('0x9')](),controller[_0xa602('0x26')]);router[_0xa602('0x5')]('/agents',auth['isAuthenticated'](),controller[_0xa602('0x27')]);router[_0xa602('0x22')]('/agents/:id/capacity',auth[_0xa602('0x9')](),controller[_0xa602('0x28')]);router[_0xa602('0x5')](_0xa602('0x29'),auth[_0xa602('0x9')](),controller[_0xa602('0x2a')]);router[_0xa602('0x5')](_0xa602('0x2b'),auth[_0xa602('0x9')](),controller['trunks']);router['get']('/campaigns',auth[_0xa602('0x9')](),controller[_0xa602('0x2c')]);router['get'](_0xa602('0x2d'),auth[_0xa602('0x9')](),controller['faxAccounts']);router[_0xa602('0x5')](_0xa602('0x2e'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xa602('0x5')](_0xa602('0x2f'),auth[_0xa602('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0xa602('0x5')](_0xa602('0x30'),auth[_0xa602('0x9')](),controller[_0xa602('0x31')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xa602('0x9')](),controller[_0xa602('0x32')]);router[_0xa602('0x5')](_0xa602('0x33'),auth[_0xa602('0x9')](),controller[_0xa602('0x34')]);router['get'](_0xa602('0x35'),auth[_0xa602('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0xa602('0x5')](_0xa602('0x36'),auth[_0xa602('0x9')](),controller[_0xa602('0x37')]);router[_0xa602('0x38')]('/mail/queues/:id/notify',auth[_0xa602('0x9')](),controller[_0xa602('0x39')](_0xa602('0x3a')));router[_0xa602('0x5')]('/mail/queues/:id',auth[_0xa602('0x9')](),controller[_0xa602('0x3b')]);router[_0xa602('0x38')](_0xa602('0x3c'),auth[_0xa602('0x9')](),controller[_0xa602('0x39')]('chat'));router[_0xa602('0x5')](_0xa602('0x3d'),auth['isAuthenticated'](),controller[_0xa602('0x3e')]);router['post']('/fax/queues/:id/notify',auth[_0xa602('0x9')](),controller[_0xa602('0x39')](_0xa602('0x3f')));router[_0xa602('0x5')](_0xa602('0x40'),auth[_0xa602('0x9')](),controller[_0xa602('0x41')]);router[_0xa602('0x38')]('/openchannel/queues/:id/notify',auth[_0xa602('0x9')](),controller[_0xa602('0x39')](_0xa602('0x42')));router[_0xa602('0x5')](_0xa602('0x43'),auth[_0xa602('0x9')](),controller[_0xa602('0x44')]);router[_0xa602('0x38')](_0xa602('0x45'),auth[_0xa602('0x9')](),controller[_0xa602('0x39')](_0xa602('0x46')));router[_0xa602('0x38')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('whatsapp'));router['get'](_0xa602('0x47'),auth[_0xa602('0x9')](),controller['showSmsQueues']);router[_0xa602('0x5')](_0xa602('0x48'),auth[_0xa602('0x9')](),controller[_0xa602('0x49')]);router[_0xa602('0x38')](_0xa602('0x4a'),auth[_0xa602('0x9')](),controller[_0xa602('0x4b')]);module[_0xa602('0x4c')]=router; \ No newline at end of file +var _0x122d=['/fax/queues/:id/notify','queueNotify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound/channels','outboundChannels','/agents','put','/agents/:id/capacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','post','chat','/chat/queues/:id'];(function(_0x369884,_0x1ce251){var _0x42f0e4=function(_0x2a3ba3){while(--_0x2a3ba3){_0x369884['push'](_0x369884['shift']());}};_0x42f0e4(++_0x1ce251);}(_0x122d,0x1ab));var _0xd122=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0x122d[_0x134d5e];return _0x1e166a;};'use strict';var multer=require(_0xd122('0x0'));var util=require(_0xd122('0x1'));var path=require(_0xd122('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xd122('0x3'));var controller=require('./rpc.controller');router[_0xd122('0x4')](_0xd122('0x5'),auth[_0xd122('0x6')](),controller[_0xd122('0x7')]);router[_0xd122('0x4')](_0xd122('0x8'),auth[_0xd122('0x6')](),controller[_0xd122('0x9')]);router[_0xd122('0x4')](_0xd122('0xa'),auth['isAuthenticated'](),controller[_0xd122('0xb')]);router[_0xd122('0x4')](_0xd122('0xc'),auth[_0xd122('0x6')](),controller[_0xd122('0xd')]);router[_0xd122('0x4')](_0xd122('0xe'),auth[_0xd122('0x6')](),controller[_0xd122('0xf')]);router[_0xd122('0x4')](_0xd122('0x10'),auth[_0xd122('0x6')](),controller[_0xd122('0x11')]);router['get']('/mail/accounts',auth[_0xd122('0x6')](),controller[_0xd122('0x12')]);router[_0xd122('0x4')](_0xd122('0x13'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xd122('0x4')](_0xd122('0x14'),auth[_0xd122('0x6')](),controller[_0xd122('0x15')]);router['get'](_0xd122('0x16'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xd122('0x4')](_0xd122('0x17'),auth[_0xd122('0x6')](),controller[_0xd122('0x18')]);router[_0xd122('0x4')]('/voice/queues/preview/:id',auth[_0xd122('0x6')](),controller[_0xd122('0x19')]);router[_0xd122('0x4')](_0xd122('0x1a'),auth['isAuthenticated'](),controller[_0xd122('0x1b')]);router['get'](_0xd122('0x1c'),auth[_0xd122('0x6')](),controller[_0xd122('0x1d')]);router[_0xd122('0x4')](_0xd122('0x1e'),auth[_0xd122('0x6')](),controller[_0xd122('0x1f')]);router['get'](_0xd122('0x20'),auth[_0xd122('0x6')](),controller[_0xd122('0x21')]);router[_0xd122('0x4')](_0xd122('0x22'),auth[_0xd122('0x6')](),controller[_0xd122('0x23')]);router['put'](_0xd122('0x22'),auth['isAuthenticated'](),controller[_0xd122('0x24')]);router[_0xd122('0x4')]('/outbound',auth['isAuthenticated'](),controller['outbound']);router[_0xd122('0x4')](_0xd122('0x25'),auth[_0xd122('0x6')](),controller[_0xd122('0x26')]);router['get'](_0xd122('0x27'),auth[_0xd122('0x6')](),controller['agents']);router[_0xd122('0x28')](_0xd122('0x29'),auth[_0xd122('0x6')](),controller['agentCapacity']);router[_0xd122('0x4')]('/telephones',auth[_0xd122('0x6')](),controller[_0xd122('0x2a')]);router[_0xd122('0x4')]('/trunks',auth[_0xd122('0x6')](),controller[_0xd122('0x2b')]);router[_0xd122('0x4')](_0xd122('0x2c'),auth[_0xd122('0x6')](),controller[_0xd122('0x2d')]);router[_0xd122('0x4')](_0xd122('0x2e'),auth[_0xd122('0x6')](),controller[_0xd122('0x2f')]);router[_0xd122('0x4')](_0xd122('0x30'),auth['isAuthenticated'](),controller[_0xd122('0x31')]);router[_0xd122('0x4')](_0xd122('0x32'),auth[_0xd122('0x6')](),controller[_0xd122('0x33')]);router['get'](_0xd122('0x34'),auth[_0xd122('0x6')](),controller[_0xd122('0x35')]);router[_0xd122('0x4')](_0xd122('0x36'),auth[_0xd122('0x6')](),controller[_0xd122('0x37')]);router[_0xd122('0x4')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0xd122('0x38'),auth[_0xd122('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0xd122('0x4')](_0xd122('0x39'),auth[_0xd122('0x6')](),controller[_0xd122('0x3a')]);router['post'](_0xd122('0x3b'),auth['isAuthenticated'](),controller['queueNotify'](_0xd122('0x3c')));router[_0xd122('0x4')](_0xd122('0x3d'),auth[_0xd122('0x6')](),controller['showMailQueues']);router[_0xd122('0x3e')]('/chat/queues/:id/notify',auth[_0xd122('0x6')](),controller['queueNotify'](_0xd122('0x3f')));router[_0xd122('0x4')](_0xd122('0x40'),auth[_0xd122('0x6')](),controller['showChatQueues']);router['post'](_0xd122('0x41'),auth[_0xd122('0x6')](),controller[_0xd122('0x42')]('fax'));router[_0xd122('0x4')]('/fax/queues/:id',auth[_0xd122('0x6')](),controller[_0xd122('0x43')]);router[_0xd122('0x3e')](_0xd122('0x44'),auth['isAuthenticated'](),controller[_0xd122('0x42')](_0xd122('0x45')));router[_0xd122('0x4')](_0xd122('0x46'),auth['isAuthenticated'](),controller[_0xd122('0x47')]);router[_0xd122('0x3e')](_0xd122('0x48'),auth[_0xd122('0x6')](),controller['queueNotify'](_0xd122('0x49')));router['post'](_0xd122('0x4a'),auth[_0xd122('0x6')](),controller[_0xd122('0x42')](_0xd122('0x4b')));router[_0xd122('0x4')]('/sms/queues/:id',auth[_0xd122('0x6')](),controller[_0xd122('0x4c')]);router[_0xd122('0x4')](_0xd122('0x4d'),auth[_0xd122('0x6')](),controller[_0xd122('0x4e')]);router['post'](_0xd122('0x4f'),auth[_0xd122('0x6')](),controller[_0xd122('0x50')]);module[_0xd122('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6ba90ac..87fede8 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 _0x3eea=['whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','catch','status','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','format','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xcdac76,_0x5d5ceb){_0xcdac76=_0xcdac76-0x0;var _0x44187c=_0x3eea[_0xcdac76];return _0x44187c;};'use strict';var BPromise=require(_0xa3ee('0x0'));var moment=require('moment');var _=require(_0xa3ee('0x1'));var util=require(_0xa3ee('0x2'));var db=require(_0xa3ee('0x3'))['db'];var logger=require(_0xa3ee('0x4'))(_0xa3ee('0x5'));var jayson=require(_0xa3ee('0x6'));var amiClient=jayson[_0xa3ee('0x7')][_0xa3ee('0x8')]({'port':0x232a});var mailClient=jayson[_0xa3ee('0x7')][_0xa3ee('0x8')]({'port':0x232b});var routingClient=jayson[_0xa3ee('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){var _0x1eeb5b=_0x4e4588?_0x4e4588:amiClient;return _0x1eeb5b['request'](_0x538bf9,_0x4183ee)[_0xa3ee('0x9')](function(_0x5ef236){if(_0x5ef236[_0xa3ee('0xa')]){if(_0x5ef236[_0xa3ee('0xa')][_0xa3ee('0xb')]===0x1f4){return _0x56f37b(_0x5ef236['error'][_0xa3ee('0xc')]);}return _0x37a3f0(_0x5ef236[_0xa3ee('0xa')]['message']);}else{_0x37a3f0(_0x5ef236['result']);}})[_0xa3ee('0xd')](function(_0x30e652){_0x56f37b(_0x30e652);});});}function respondWithResult(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xc8;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0xe')](_0x4363d1)['json'](_0x594c88);}return _0x403518[_0xa3ee('0xf')](0x194);};}function handleError(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0x1f4;return function(_0x150e20){logger['error'](_0x150e20[_0xa3ee('0x10')]);if(_0x150e20[_0xa3ee('0x11')]){delete _0x150e20['name'];}_0x20535f['status'](_0x2c34cf)['send'](_0x150e20);};}function findById(_0x40decb){return function(_0x7277cd){if(!_[_0xa3ee('0x12')](_0x40decb)&&!_[_0xa3ee('0x12')](_0x7277cd)&&!_['isNil'](_0x7277cd[_0xa3ee('0x13')])){return _[_0xa3ee('0x14')](_0x7277cd[_0xa3ee('0x13')],function(_0x299b1e){return _0x299b1e['id']==_0x40decb;});}return null;};}exports[_0xa3ee('0x15')]=function(_0x4aac0e,_0x377b9d){return respondWithRpcPromise(_0xa3ee('0x16'),_0x4aac0e[_0xa3ee('0x17')])[_0xa3ee('0x9')](respondWithResult(_0x377b9d,null))[_0xa3ee('0xd')](handleError(_0x377b9d,null));};exports[_0xa3ee('0x18')]=function(_0x4f8c56,_0x3f5d70){return respondWithRpcPromise(_0xa3ee('0x19'),_['merge'](_0x4f8c56[_0xa3ee('0x17')],_0x4f8c56['params']))[_0xa3ee('0x9')](respondWithResult(_0x3f5d70,null))[_0xa3ee('0xd')](handleError(_0x3f5d70,null));};exports[_0xa3ee('0x1a')]=function(_0x1bd196,_0x60b899){return respondWithRpcPromise(_0xa3ee('0x1b'),_[_0xa3ee('0x1c')](_0x1bd196[_0xa3ee('0x17')],_0x1bd196[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x60b899,null))['catch'](handleError(_0x60b899,null));};exports[_0xa3ee('0x1e')]=function(_0x1dca29,_0x157071){return respondWithRpcPromise(_0xa3ee('0x1f'),_0x1dca29[_0xa3ee('0x17')])['then'](respondWithResult(_0x157071,null))[_0xa3ee('0xd')](handleError(_0x157071,null));};exports[_0xa3ee('0x20')]=function(_0x146493,_0xd9a7f8){return respondWithRpcPromise(_0xa3ee('0x1f'),_0x146493[_0xa3ee('0x17')])[_0xa3ee('0x9')](findById(_0x146493[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0xd9a7f8,null))[_0xa3ee('0xd')](handleError(_0xd9a7f8,null));};exports['updateVoiceQueue']=function(_0x5ba571,_0x4abf49){return respondWithRpcPromise(_0xa3ee('0x21'),_['merge'](_0x5ba571[_0xa3ee('0x22')],_0x5ba571[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x4abf49,null))[_0xa3ee('0xd')](handleError(_0x4abf49,null));};exports[_0xa3ee('0x23')]=function(_0x14547d,_0x30ba4e){return respondWithRpcPromise(_0xa3ee('0x24'),_[_0xa3ee('0x1c')](_0x14547d[_0xa3ee('0x17')],_0x14547d['params']))[_0xa3ee('0x9')](respondWithResult(_0x30ba4e,null))['catch'](handleError(_0x30ba4e,null));};exports[_0xa3ee('0x25')]=function(_0x332d61,_0x496839){return respondWithRpcPromise(_0xa3ee('0x26'),_0x332d61['query'])[_0xa3ee('0x9')](respondWithResult(_0x496839,null))['catch'](handleError(_0x496839,null));};exports[_0xa3ee('0x27')]=function(_0x299099,_0x2f803c){return respondWithRpcPromise(_0xa3ee('0x28'),_[_0xa3ee('0x1c')](_0x299099['query'],_0x299099[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x2f803c,null))[_0xa3ee('0xd')](handleError(_0x2f803c,null));};exports['voiceQueuesChannelHangup']=function(_0x1599e4,_0x531f58){return respondWithRpcPromise(_0xa3ee('0x29'),_['merge'](_0x1599e4[_0xa3ee('0x17')],_0x1599e4['params']))[_0xa3ee('0x9')](respondWithResult(_0x531f58,null))[_0xa3ee('0xd')](handleError(_0x531f58,null));};exports[_0xa3ee('0x2a')]=function(_0x45be9b,_0x1717ba){return respondWithRpcPromise(_0xa3ee('0x2b'),_[_0xa3ee('0x1c')](_0x45be9b[_0xa3ee('0x17')],_0x45be9b[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x1717ba,null))[_0xa3ee('0xd')](handleError(_0x1717ba,null));};exports[_0xa3ee('0x2c')]=function(_0x447efd,_0x595b55){return respondWithRpcPromise(_0xa3ee('0x2d'),_0x447efd[_0xa3ee('0x17')])[_0xa3ee('0x9')](respondWithResult(_0x595b55,null))[_0xa3ee('0xd')](handleError(_0x595b55,null));};exports['outboundChannels']=function(_0x257627,_0x11a721){return respondWithRpcPromise(_0xa3ee('0x2e'),_0x257627['query'])[_0xa3ee('0x9')](respondWithResult(_0x11a721,null))[_0xa3ee('0xd')](handleError(_0x11a721,null));};exports['agents']=function(_0x319c26,_0x3ecbe6){var _0x4ef99a;return respondWithRpcPromise(_0xa3ee('0x2f'),_0x319c26[_0xa3ee('0x17')])[_0xa3ee('0x9')](function(_0x2c8873){_0x4ef99a=_0x2c8873;return respondWithRpcPromise(_0xa3ee('0x2f'),_0x319c26[_0xa3ee('0x17')],routingClient);})[_0xa3ee('0x9')](function(_0x3e0eec){return _[_0xa3ee('0x1c')]({},_0x3e0eec,_0x4ef99a);})[_0xa3ee('0x9')](respondWithResult(_0x3ecbe6,null))[_0xa3ee('0xd')](handleError(_0x3ecbe6,null));};exports['agentCapacity']=function(_0x5aa4b3,_0x548534){if(_0x5aa4b3[_0xa3ee('0x22')]&&_0x5aa4b3[_0xa3ee('0x22')]['interaction']&&_0x5aa4b3[_0xa3ee('0x30')]&&_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')]){for(var _0x55f47f in _0x5aa4b3[_0xa3ee('0x22')]['interaction']){if(_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0xa3ee('0x32')](_0x55f47f)){db[_0xa3ee('0x33')][_0xa3ee('0x34')]({'where':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')],'type':_0xa3ee('0x35'),'exitAt':null,'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f]&&_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0xa3ee('0x36')]?{'$notIn':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f]}:{'$ne':null}}})[_0xa3ee('0x9')](function(_0x25e0fe){var _0x4594e1=moment()['format'](_0xa3ee('0x37'));for(var _0xdca412=0x0,_0x112e80=_0x25e0fe[_0xa3ee('0x36')];_0xdca412<_0x112e80;_0xdca412+=0x1){_0x25e0fe[_0xdca412]['updateAttributes']({'exitAt':_0x4594e1});}});for(var _0x30fcf1=0x0;_0x30fcf1<_0x5aa4b3['body'][_0xa3ee('0x31')][_0x55f47f][_0xa3ee('0x36')];_0x30fcf1+=0x1){db[_0xa3ee('0x33')][_0xa3ee('0x38')]({'where':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')],'type':_0xa3ee('0x35'),'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0x30fcf1],'exitAt':null},'defaults':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')]['name'],'interface':_[_0xa3ee('0x12')](_0x5aa4b3['user']['interface'])?util[_0xa3ee('0x39')](_0xa3ee('0x3a'),_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')]):_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x3b')],'type':_0xa3ee('0x35'),'enterAt':moment()['format'](_0xa3ee('0x37')),'role':_0xa3ee('0x3c'),'internal':_0x5aa4b3['user'][_0xa3ee('0x3d')],'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0x30fcf1]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5aa4b3['params']['id'],'capacity':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x3e')]},routingClient)[_0xa3ee('0x9')](respondWithResult(_0x548534,null))[_0xa3ee('0xd')](handleError(_0x548534,null));};exports[_0xa3ee('0x3f')]=function(_0x57e654,_0x55678e){return respondWithRpcPromise(_0xa3ee('0x40'),_0x57e654[_0xa3ee('0x17')])['then'](respondWithResult(_0x55678e,null))[_0xa3ee('0xd')](handleError(_0x55678e,null));};exports[_0xa3ee('0x41')]=function(_0x13cd8b,_0x579ec8){return respondWithRpcPromise('Trunks',_0x13cd8b[_0xa3ee('0x17')])['then'](respondWithResult(_0x579ec8,null))[_0xa3ee('0xd')](handleError(_0x579ec8,null));};exports[_0xa3ee('0x42')]=function(_0x5b8e79,_0x4232e0){return respondWithRpcPromise(_0xa3ee('0x43'),_0x5b8e79[_0xa3ee('0x17')])['then'](respondWithResult(_0x4232e0,null))[_0xa3ee('0xd')](handleError(_0x4232e0,null));};exports[_0xa3ee('0x44')]=function(_0x594034,_0x1d832c){return respondWithRpcPromise(_0xa3ee('0x45'),_0x594034[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x1d832c,null))['catch'](handleError(_0x1d832c,null));};exports[_0xa3ee('0x46')]=function(_0x17ac07,_0x4a1a2f){return respondWithRpcPromise(_0xa3ee('0x45'),_0x17ac07[_0xa3ee('0x17')],routingClient)['then'](findById(_0x17ac07['params']['id']))[_0xa3ee('0x9')](respondWithResult(_0x4a1a2f,null))[_0xa3ee('0xd')](handleError(_0x4a1a2f,null));};exports[_0xa3ee('0x47')]=function(_0x52b824,_0x11fb6e){return respondWithRpcPromise(_0xa3ee('0x48'),_0x52b824[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x11fb6e,null))[_0xa3ee('0xd')](handleError(_0x11fb6e,null));};exports[_0xa3ee('0x49')]=function(_0x497be4,_0x10f508){return respondWithRpcPromise(_0xa3ee('0x48'),_0x497be4['query'],routingClient)[_0xa3ee('0x9')](findById(_0x497be4[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0x10f508,null))[_0xa3ee('0xd')](handleError(_0x10f508,null));};exports[_0xa3ee('0x4a')]=function(_0x330778,_0x4a2255){return respondWithRpcPromise(_0xa3ee('0x4b'),_0x330778[_0xa3ee('0x17')],mailClient)[_0xa3ee('0x9')](respondWithResult(_0x4a2255,null))['catch'](handleError(_0x4a2255,null));};exports[_0xa3ee('0x4c')]=function(_0x13b81b,_0x519f10){return respondWithRpcPromise('OpenchannelQueues',_0x13b81b['query'],routingClient)['then'](respondWithResult(_0x519f10,null))[_0xa3ee('0xd')](handleError(_0x519f10,null));};exports[_0xa3ee('0x4d')]=function(_0x3adafb,_0x2f0424){return respondWithRpcPromise(_0xa3ee('0x4e'),_0x3adafb[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x3adafb['params']['id']))[_0xa3ee('0x9')](respondWithResult(_0x2f0424,null))[_0xa3ee('0xd')](handleError(_0x2f0424,null));};exports[_0xa3ee('0x4f')]=function(_0xaff641,_0x147024){return respondWithRpcPromise('SmsQueues',_0xaff641['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x147024,null))[_0xa3ee('0xd')](handleError(_0x147024,null));};exports[_0xa3ee('0x50')]=function(_0x24613d,_0x16aabe){return respondWithRpcPromise(_0xa3ee('0x51'),_0x24613d[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x24613d[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0x16aabe,null))[_0xa3ee('0xd')](handleError(_0x16aabe,null));};exports[_0xa3ee('0x52')]=function(_0x64f353,_0x224790){return respondWithRpcPromise(_0xa3ee('0x53'),_0x64f353['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x224790,null))['catch'](handleError(_0x224790,null));};exports['showWhatsappQueues']=function(_0x2b1c6e,_0x49daf9){return respondWithRpcPromise(_0xa3ee('0x53'),_0x2b1c6e[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x2b1c6e[_0xa3ee('0x1d')]['id']))['then'](respondWithResult(_0x49daf9,null))[_0xa3ee('0xd')](handleError(_0x49daf9,null));};exports[_0xa3ee('0x54')]=function(_0x179ae2,_0x370e3e){return respondWithRpcPromise('FaxQueues',_0x179ae2[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x370e3e,null))['catch'](handleError(_0x370e3e,null));};exports[_0xa3ee('0x55')]=function(_0x52a066,_0x4f3aac){return respondWithRpcPromise(_0xa3ee('0x56'),_0x52a066['query'],routingClient)['then'](findById(_0x52a066[_0xa3ee('0x1d')]['id']))['then'](respondWithResult(_0x4f3aac,null))['catch'](handleError(_0x4f3aac,null));};exports[_0xa3ee('0x57')]=function(_0xf8689f,_0x538a9b){return respondWithRpcPromise('FaxAccounts',_0xf8689f['query'])[_0xa3ee('0x9')](respondWithResult(_0x538a9b,null))[_0xa3ee('0xd')](handleError(_0x538a9b,null));};exports[_0xa3ee('0x58')]=function(_0x7844ae,_0x389547){return respondWithRpcPromise(_0xa3ee('0x59'),_0x7844ae['query'],routingClient)['then'](respondWithResult(_0x389547,null))[_0xa3ee('0xd')](handleError(_0x389547,null));};exports[_0xa3ee('0x5a')]=function(_0x42a79e,_0x5675fb){return respondWithRpcPromise(_0xa3ee('0x5b'),_0x42a79e[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x5675fb,null))[_0xa3ee('0xd')](handleError(_0x5675fb,null));};exports[_0xa3ee('0x5c')]=function(_0x3be877,_0x2ad745){return respondWithRpcPromise(_0xa3ee('0x5d'),_0x3be877['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x2ad745,null))[_0xa3ee('0xd')](handleError(_0x2ad745,null));};exports[_0xa3ee('0x5e')]=function(_0x37e1c2,_0xbfb429){return respondWithRpcPromise(_0xa3ee('0x5d'),_0x37e1c2[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](function(_0x448f14){if(_0x37e1c2['query']['type']!==undefined){var _0x228671=_(_0x448f14['rows'])[_0xa3ee('0x5f')]([_0x37e1c2[_0xa3ee('0x17')][_0xa3ee('0x60')],_0x37e1c2[_0xa3ee('0x1d')]['id']])['map'](_0xa3ee('0x61'))[_0xa3ee('0x62')]()[_0xa3ee('0x63')]();return _0x448f14[_0xa3ee('0x13')][_0xa3ee('0x5f')](function(_0x4e9473){return _0x228671[_0xa3ee('0x64')](_0x4e9473[_0xa3ee('0x61')])>-0x1;});}else{return _0x448f14[_0xa3ee('0x13')]['filter'](function(_0x3ca523){return _0x3ca523['queue_id']===parseInt(_0x37e1c2[_0xa3ee('0x1d')]['id']);});}})['then'](respondWithResult(_0xbfb429,null))[_0xa3ee('0xd')](handleError(_0xbfb429,null));};exports[_0xa3ee('0x65')]=function(_0x119c3d,_0x140ee0){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x119c3d[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x140ee0,null))['catch'](handleError(_0x140ee0,null));};exports[_0xa3ee('0x66')]=function(_0xa82482,_0x44b084){return respondWithRpcPromise(_0xa3ee('0x67'),_0xa82482[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x44b084,null))[_0xa3ee('0xd')](handleError(_0x44b084,null));};exports[_0xa3ee('0x68')]=function(_0x55a6b7,_0x2535ef){return respondWithRpcPromise(_0xa3ee('0x69'),_0x55a6b7[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x2535ef,null))[_0xa3ee('0xd')](handleError(_0x2535ef,null));};exports[_0xa3ee('0x6a')]=function(_0x31d3ca){return function(_0x329e32,_0x37bde3){var _0x25334c,_0x4f7ace;var _0x21fd56=_[_0xa3ee('0x6b')](_0x31d3ca);var _0x26a124=_0x31d3ca==='chat'?_0xa3ee('0x6c'):'Account';return db[_0x21fd56+_0xa3ee('0x6d')][_0xa3ee('0x6e')]({'raw':!![],'where':{'id':_0x329e32['params']['id']}})[_0xa3ee('0x9')](function(_0x44f27b){if(_['isNil'](_0x44f27b)){throw new Error(_0x21fd56+_0xa3ee('0x6f'));}_0x25334c=_0x44f27b;return db[_0x21fd56+_0xa3ee('0x70')][_0xa3ee('0x6e')]({'where':{'id':_0x329e32[_0xa3ee('0x22')][_0xa3ee('0x71')]},'include':[{'model':db[_0x21fd56+_0xa3ee('0x72')],'as':'Interaction'},{'model':db[_0x21fd56+_0x26a124],'as':'Account'}]});})['then'](function(_0x27454a){if(_['isNil'](_0x27454a)){throw new Error(_0x21fd56+_0xa3ee('0x73'));}_0x4f7ace=_0x27454a;return _0x27454a[_0xa3ee('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa3ee('0x9')](function(){var _0x312ad8={'uniqueid':_0x31d3ca+'.'+_0x4f7ace['id']+'.'+_0x4f7ace[_0xa3ee('0x72')]['id'],'FromUserId':_0x329e32[_0xa3ee('0x30')]['id'],'type':_0xa3ee('0x75')};_0x312ad8[_0x21fd56+_0xa3ee('0x76')]=_0x4f7ace['id'];_0x312ad8[_0x21fd56+_0xa3ee('0x77')]=_0x4f7ace[_0xa3ee('0x72')]['id'];_0x312ad8[_0xa3ee('0x78')+_0x21fd56+_0x26a124+'Id']=_0x4f7ace[_0xa3ee('0x79')]['id'];_0x312ad8['To'+_0x21fd56+_0xa3ee('0x7a')]=_0x25334c['id'];return db[_0x21fd56+_0xa3ee('0x7b')][_0xa3ee('0x7c')](_0x312ad8);})[_0xa3ee('0x9')](function(){return respondWithRpcPromise(_0xa3ee('0x7d'),{'channel':_0x31d3ca,'interaction':_0x4f7ace[_0xa3ee('0x72')],'message':_0x4f7ace,'account':_0x4f7ace[_0xa3ee('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x25334c[_0xa3ee('0x11')]+','+(_0x4f7ace[_0xa3ee('0x79')][_0xa3ee('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x37bde3,null))[_0xa3ee('0xd')](handleError(_0x37bde3,null));};};exports[_0xa3ee('0x7f')]=function(_0x591bfa,_0x5b53f1){var _0x24cbc9,_0x157436;if(_[_0xa3ee('0x12')](_0x591bfa[_0xa3ee('0x22')][_0xa3ee('0x80')])){throw new Error(_0xa3ee('0x81'));}var _0x18a74b=_0x591bfa[_0xa3ee('0x22')][_0xa3ee('0x80')];var _0x3e6657=_[_0xa3ee('0x6b')](_0x18a74b);var _0x3236b3=_0x18a74b===_0xa3ee('0x82')?'Website':_0xa3ee('0x79');return db[_0xa3ee('0x83')][_0xa3ee('0x6e')]({'raw':!![],'where':{'id':_0x591bfa[_0xa3ee('0x1d')]['id'],'role':_0xa3ee('0x3c')}})[_0xa3ee('0x9')](function(_0x4cc5e5){if(_['isNil'](_0x4cc5e5)){throw new Error(_0xa3ee('0x84'));}_0x24cbc9=_0x4cc5e5;return db[_0x3e6657+_0xa3ee('0x70')][_0xa3ee('0x6e')]({'where':{'id':_0x591bfa['body'][_0xa3ee('0x71')]},'include':[{'model':db[_0x3e6657+'Interaction'],'as':_0xa3ee('0x72')},{'model':db[_0x3e6657+_0x3236b3],'as':_0xa3ee('0x79')}]});})[_0xa3ee('0x9')](function(_0x10ec99){if(_[_0xa3ee('0x12')](_0x10ec99)){throw new Error(_0x3e6657+_0xa3ee('0x73'));}_0x157436=_0x10ec99;return _0x10ec99[_0xa3ee('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa3ee('0x9')](function(){var _0x116de1={'uniqueid':_0x18a74b+'.'+_0x157436['id']+'.'+_0x157436[_0xa3ee('0x72')]['id'],'FromUserId':_0x591bfa['user']['id'],'type':'queue','ToUserId':_0x24cbc9['id']};_0x116de1[_0x3e6657+'MessageId']=_0x157436['id'];_0x116de1[_0x3e6657+_0xa3ee('0x77')]=_0x157436['Interaction']['id'];_0x116de1[_0xa3ee('0x78')+_0x3e6657+_0x3236b3+'Id']=_0x157436[_0xa3ee('0x79')]['id'];return db[_0x3e6657+_0xa3ee('0x7b')][_0xa3ee('0x7c')](_0x116de1);})[_0xa3ee('0x9')](function(){return respondWithRpcPromise(_0xa3ee('0x7d'),{'channel':_0x18a74b,'interaction':_0x157436[_0xa3ee('0x72')],'message':_0x157436,'account':_0x157436[_0xa3ee('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa3ee('0x3c'),'appdata':_0x24cbc9['name']+','+(_0x157436['Account'][_0xa3ee('0x85')]||0x12c),'interval':_0xa3ee('0x86')}]},routingClient);})[_0xa3ee('0x9')](respondWithResult(_0x5b53f1,null))[_0xa3ee('0xd')](handleError(_0x5b53f1,null));}; \ No newline at end of file +var _0xee14=['telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','channel','Website','User','agent','Agent\x20not\x20found','\x20Message\x20not\x20found','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','INTERACTION','SIP/%s','AgentCapacity'];(function(_0x450450,_0x2b3e6e){var _0x1d7637=function(_0x29d24a){while(--_0x29d24a){_0x450450['push'](_0x450450['shift']());}};_0x1d7637(++_0x2b3e6e);}(_0xee14,0x13a));var _0x4ee1=function(_0x1f2fad,_0x54e902){_0x1f2fad=_0x1f2fad-0x0;var _0x5d1ca6=_0xee14[_0x1f2fad];return _0x5d1ca6;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x4ee1('0x0'));var util=require(_0x4ee1('0x1'));var db=require(_0x4ee1('0x2'))['db'];var logger=require(_0x4ee1('0x3'))(_0x4ee1('0x4'));var jayson=require(_0x4ee1('0x5'));var amiClient=jayson[_0x4ee1('0x6')][_0x4ee1('0x7')]({'port':0x232a});var mailClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){var _0x1fd8c8=_0x187656?_0x187656:amiClient;return _0x1fd8c8['request'](_0x327c18,_0x3a45a3)[_0x4ee1('0x8')](function(_0x38be25){if(_0x38be25['error']){if(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xa')]===0x1f4){return _0xdfe9c1(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xb')]);}return _0x293d5f(_0x38be25['error'][_0x4ee1('0xb')]);}else{_0x293d5f(_0x38be25[_0x4ee1('0xc')]);}})[_0x4ee1('0xd')](function(_0x2d5d3c){_0xdfe9c1(_0x2d5d3c);});});}function respondWithResult(_0x2f864e,_0x174427){_0x174427=_0x174427||0xc8;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0xe')](_0x174427)[_0x4ee1('0xf')](_0x5616d6);}return _0x2f864e[_0x4ee1('0x10')](0x194);};}function handleError(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0x1f4;return function(_0x1c342a){logger[_0x4ee1('0x9')](_0x1c342a[_0x4ee1('0x11')]);if(_0x1c342a[_0x4ee1('0x12')]){delete _0x1c342a['name'];}_0x24a915[_0x4ee1('0xe')](_0x46d2c2)[_0x4ee1('0x13')](_0x1c342a);};}function findById(_0x34651b){return function(_0x1b1e0e){if(!_[_0x4ee1('0x14')](_0x34651b)&&!_[_0x4ee1('0x14')](_0x1b1e0e)&&!_[_0x4ee1('0x14')](_0x1b1e0e[_0x4ee1('0x15')])){return _[_0x4ee1('0x16')](_0x1b1e0e[_0x4ee1('0x15')],function(_0x274de5){return _0x274de5['id']==_0x34651b;});}return null;};}exports['voiceChannels']=function(_0x236215,_0x3db827){return respondWithRpcPromise(_0x4ee1('0x17'),_0x236215[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3db827,null))[_0x4ee1('0xd')](handleError(_0x3db827,null));};exports['voiceChannelMixMonitor']=function(_0x8a631f,_0x333e96){return respondWithRpcPromise(_0x4ee1('0x19'),_[_0x4ee1('0x1a')](_0x8a631f[_0x4ee1('0x18')],_0x8a631f[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x333e96,null))[_0x4ee1('0xd')](handleError(_0x333e96,null));};exports[_0x4ee1('0x1c')]=function(_0x3e5038,_0x4faaf6){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x4ee1('0x1a')](_0x3e5038[_0x4ee1('0x18')],_0x3e5038[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x4faaf6,null))[_0x4ee1('0xd')](handleError(_0x4faaf6,null));};exports[_0x4ee1('0x1d')]=function(_0x57d45d,_0x5cc0b5){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x57d45d[_0x4ee1('0x18')])['then'](respondWithResult(_0x5cc0b5,null))[_0x4ee1('0xd')](handleError(_0x5cc0b5,null));};exports[_0x4ee1('0x1f')]=function(_0x36654c,_0x215949){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x36654c[_0x4ee1('0x18')])[_0x4ee1('0x8')](findById(_0x36654c['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x215949,null))['catch'](handleError(_0x215949,null));};exports[_0x4ee1('0x20')]=function(_0x4ec408,_0x3dc870){return respondWithRpcPromise(_0x4ee1('0x21'),_[_0x4ee1('0x1a')](_0x4ec408[_0x4ee1('0x22')],_0x4ec408[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x3dc870,null))[_0x4ee1('0xd')](handleError(_0x3dc870,null));};exports['voiceQueuesPreview']=function(_0x121301,_0x3d5e6c){return respondWithRpcPromise(_0x4ee1('0x23'),_[_0x4ee1('0x1a')](_0x121301[_0x4ee1('0x18')],_0x121301['params']))[_0x4ee1('0x8')](respondWithResult(_0x3d5e6c,null))[_0x4ee1('0xd')](handleError(_0x3d5e6c,null));};exports[_0x4ee1('0x24')]=function(_0x2e37a3,_0x79f87c){return respondWithRpcPromise(_0x4ee1('0x25'),_0x2e37a3['query'])['then'](respondWithResult(_0x79f87c,null))[_0x4ee1('0xd')](handleError(_0x79f87c,null));};exports[_0x4ee1('0x26')]=function(_0x41ab60,_0x5a2f6f){return respondWithRpcPromise(_0x4ee1('0x27'),_[_0x4ee1('0x1a')](_0x41ab60[_0x4ee1('0x18')],_0x41ab60[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x5a2f6f,null))[_0x4ee1('0xd')](handleError(_0x5a2f6f,null));};exports[_0x4ee1('0x28')]=function(_0x199e11,_0x36898c){return respondWithRpcPromise(_0x4ee1('0x29'),_[_0x4ee1('0x1a')](_0x199e11[_0x4ee1('0x18')],_0x199e11[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x36898c,null))[_0x4ee1('0xd')](handleError(_0x36898c,null));};exports[_0x4ee1('0x2a')]=function(_0x882468,_0x50539f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4ee1('0x1a')](_0x882468[_0x4ee1('0x18')],_0x882468[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x50539f,null))['catch'](handleError(_0x50539f,null));};exports[_0x4ee1('0x2b')]=function(_0x2ed16f,_0x11721a){return respondWithRpcPromise(_0x4ee1('0x2c'),_0x2ed16f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x11721a,null))[_0x4ee1('0xd')](handleError(_0x11721a,null));};exports[_0x4ee1('0x2d')]=function(_0x59b5cc,_0x3b346e){return respondWithRpcPromise(_0x4ee1('0x2e'),_0x59b5cc[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3b346e,null))[_0x4ee1('0xd')](handleError(_0x3b346e,null));};exports[_0x4ee1('0x2f')]=function(_0x543b2e,_0x3e2ca7){var _0x37176a;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')])[_0x4ee1('0x8')](function(_0x352dc5){_0x37176a=_0x352dc5;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')],routingClient);})[_0x4ee1('0x8')](function(_0x29493d){return _[_0x4ee1('0x1a')]({},_0x29493d,_0x37176a);})[_0x4ee1('0x8')](respondWithResult(_0x3e2ca7,null))[_0x4ee1('0xd')](handleError(_0x3e2ca7,null));};exports['agentCapacity']=function(_0x3b3bed,_0x40a3e3){if(_0x3b3bed['body']&&_0x3b3bed[_0x4ee1('0x22')]['interaction']&&_0x3b3bed[_0x4ee1('0x31')]&&_0x3b3bed['user'][_0x4ee1('0x12')]){for(var _0xc7580c in _0x3b3bed['body'][_0x4ee1('0x32')]){if(_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0x4ee1('0x33')](_0xc7580c)){db['MemberReport'][_0x4ee1('0x34')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3b3bed['body'][_0x4ee1('0x32')][_0xc7580c]&&_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')]?{'$notIn':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c]}:{'$ne':null}}})['then'](function(_0xaa71d5){var _0x266add=moment()[_0x4ee1('0x36')](_0x4ee1('0x37'));for(var _0x5c5862=0x0,_0x3d6bf4=_0xaa71d5[_0x4ee1('0x35')];_0x5c5862<_0x3d6bf4;_0x5c5862+=0x1){_0xaa71d5[_0x5c5862]['updateAttributes']({'exitAt':_0x266add});}});for(var _0x21ebb8=0x0;_0x21ebb8<_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')];_0x21ebb8+=0x1){db[_0x4ee1('0x38')][_0x4ee1('0x39')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':_0x4ee1('0x3a'),'uniqueid':_0x3b3bed['body']['interaction'][_0xc7580c][_0x21ebb8],'exitAt':null},'defaults':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'interface':_[_0x4ee1('0x14')](_0x3b3bed[_0x4ee1('0x31')]['interface'])?util[_0x4ee1('0x36')](_0x4ee1('0x3b'),_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')]):_0x3b3bed[_0x4ee1('0x31')]['interface'],'type':_0x4ee1('0x3a'),'enterAt':moment()[_0x4ee1('0x36')](_0x4ee1('0x37')),'role':'agent','internal':_0x3b3bed[_0x4ee1('0x31')]['internal'],'uniqueid':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c][_0x21ebb8]}});}}}}return respondWithRpcPromise(_0x4ee1('0x3c'),{'id':_0x3b3bed['params']['id'],'capacity':_0x3b3bed[_0x4ee1('0x22')]['capacity']},routingClient)[_0x4ee1('0x8')](respondWithResult(_0x40a3e3,null))[_0x4ee1('0xd')](handleError(_0x40a3e3,null));};exports[_0x4ee1('0x3d')]=function(_0x5f4f78,_0x3368ed){return respondWithRpcPromise(_0x4ee1('0x3e'),_0x5f4f78[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3368ed,null))[_0x4ee1('0xd')](handleError(_0x3368ed,null));};exports[_0x4ee1('0x3f')]=function(_0x3f1c32,_0x517729){return respondWithRpcPromise('Trunks',_0x3f1c32[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x517729,null))[_0x4ee1('0xd')](handleError(_0x517729,null));};exports[_0x4ee1('0x40')]=function(_0x44e65f,_0x31e82d){return respondWithRpcPromise(_0x4ee1('0x41'),_0x44e65f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x31e82d,null))[_0x4ee1('0xd')](handleError(_0x31e82d,null));};exports[_0x4ee1('0x42')]=function(_0x2453ac,_0x3c2e42){return respondWithRpcPromise('ChatQueues',_0x2453ac[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x3c2e42,null))[_0x4ee1('0xd')](handleError(_0x3c2e42,null));};exports[_0x4ee1('0x43')]=function(_0x59bbca,_0x1e0aac){return respondWithRpcPromise(_0x4ee1('0x44'),_0x59bbca['query'],routingClient)['then'](findById(_0x59bbca[_0x4ee1('0x1b')]['id']))['then'](respondWithResult(_0x1e0aac,null))[_0x4ee1('0xd')](handleError(_0x1e0aac,null));};exports[_0x4ee1('0x45')]=function(_0x59ba70,_0x43489c){return respondWithRpcPromise(_0x4ee1('0x46'),_0x59ba70[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x43489c,null))[_0x4ee1('0xd')](handleError(_0x43489c,null));};exports[_0x4ee1('0x47')]=function(_0x11f619,_0x5f5694){return respondWithRpcPromise('MailQueues',_0x11f619[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x11f619['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x5f5694,null))[_0x4ee1('0xd')](handleError(_0x5f5694,null));};exports[_0x4ee1('0x48')]=function(_0x51e341,_0x1ad933){return respondWithRpcPromise('MailAccounts',_0x51e341[_0x4ee1('0x18')],mailClient)['then'](respondWithResult(_0x1ad933,null))['catch'](handleError(_0x1ad933,null));};exports[_0x4ee1('0x49')]=function(_0x16fcd0,_0x290451){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x16fcd0[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x290451,null))[_0x4ee1('0xd')](handleError(_0x290451,null));};exports[_0x4ee1('0x4b')]=function(_0x10f4e,_0x58eb1d){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x10f4e[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x10f4e[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x58eb1d,null))[_0x4ee1('0xd')](handleError(_0x58eb1d,null));};exports[_0x4ee1('0x4c')]=function(_0x20ca0b,_0x19fa31){return respondWithRpcPromise(_0x4ee1('0x4d'),_0x20ca0b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x19fa31,null))['catch'](handleError(_0x19fa31,null));};exports[_0x4ee1('0x4e')]=function(_0x5bf5e9,_0x25cfc3){return respondWithRpcPromise('SmsQueues',_0x5bf5e9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x5bf5e9[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x25cfc3,null))[_0x4ee1('0xd')](handleError(_0x25cfc3,null));};exports[_0x4ee1('0x4f')]=function(_0x342aa1,_0x447060){return respondWithRpcPromise(_0x4ee1('0x50'),_0x342aa1[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x447060,null))[_0x4ee1('0xd')](handleError(_0x447060,null));};exports['showWhatsappQueues']=function(_0x759888,_0x24308c){return respondWithRpcPromise(_0x4ee1('0x50'),_0x759888['query'],routingClient)['then'](findById(_0x759888[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x24308c,null))['catch'](handleError(_0x24308c,null));};exports[_0x4ee1('0x51')]=function(_0x431dfa,_0x3f8f94){return respondWithRpcPromise(_0x4ee1('0x52'),_0x431dfa[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x3f8f94,null))[_0x4ee1('0xd')](handleError(_0x3f8f94,null));};exports[_0x4ee1('0x53')]=function(_0x28e11c,_0x3824bf){return respondWithRpcPromise('FaxQueues',_0x28e11c[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x28e11c['params']['id']))['then'](respondWithResult(_0x3824bf,null))[_0x4ee1('0xd')](handleError(_0x3824bf,null));};exports[_0x4ee1('0x54')]=function(_0x19e095,_0x38e06){return respondWithRpcPromise(_0x4ee1('0x55'),_0x19e095[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x38e06,null))['catch'](handleError(_0x38e06,null));};exports[_0x4ee1('0x56')]=function(_0x39583b,_0x44af66){return respondWithRpcPromise(_0x4ee1('0x57'),_0x39583b[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x44af66,null))[_0x4ee1('0xd')](handleError(_0x44af66,null));};exports['mailQueuesWaitingInteractions']=function(_0x1d360f,_0x29371c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1d360f['query'],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x29371c,null))[_0x4ee1('0xd')](handleError(_0x29371c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2beb82,_0x5aacf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2beb82[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x5aacf1,null))[_0x4ee1('0xd')](handleError(_0x5aacf1,null));};exports[_0x4ee1('0x58')]=function(_0x37fa42,_0x38698a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37fa42[_0x4ee1('0x18')],routingClient)['then'](function(_0x57f66c){if(_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')]!==undefined){var _0x411c99=_(_0x57f66c[_0x4ee1('0x15')])[_0x4ee1('0x5a')]([_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')],_0x37fa42[_0x4ee1('0x1b')]['id']])['map'](_0x4ee1('0x5b'))[_0x4ee1('0x5c')]()['value']();return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0xcd0dd9){return _0x411c99[_0x4ee1('0x5d')](_0xcd0dd9[_0x4ee1('0x5b')])>-0x1;});}else{return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0x4dee3a){return _0x4dee3a[_0x4ee1('0x5b')]===parseInt(_0x37fa42['params']['id']);});}})[_0x4ee1('0x8')](respondWithResult(_0x38698a,null))[_0x4ee1('0xd')](handleError(_0x38698a,null));};exports[_0x4ee1('0x5e')]=function(_0x35a719,_0x48c51c){return respondWithRpcPromise(_0x4ee1('0x5f'),_0x35a719[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x48c51c,null))['catch'](handleError(_0x48c51c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2ef7c9,_0x4b4ad5){return respondWithRpcPromise(_0x4ee1('0x60'),_0x2ef7c9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x4b4ad5,null))['catch'](handleError(_0x4b4ad5,null));};exports['faxQueuesWaitingInteractions']=function(_0x27fd3b,_0x1e2360){return respondWithRpcPromise(_0x4ee1('0x61'),_0x27fd3b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x1e2360,null))[_0x4ee1('0xd')](handleError(_0x1e2360,null));};exports[_0x4ee1('0x62')]=function(_0x5727ef){return function(_0x4a3201,_0x50645b){var _0x3fba19,_0x3a75a7;var _0x33f5af=_[_0x4ee1('0x63')](_0x5727ef);var _0x4db801=_0x5727ef===_0x4ee1('0x64')?'Website':_0x4ee1('0x65');return db[_0x33f5af+_0x4ee1('0x66')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x4a3201[_0x4ee1('0x1b')]['id']}})[_0x4ee1('0x8')](function(_0x190f59){if(_['isNil'](_0x190f59)){throw new Error(_0x33f5af+_0x4ee1('0x68'));}_0x3fba19=_0x190f59;return db[_0x33f5af+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x4a3201[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0x33f5af+_0x4ee1('0x6b')],'as':_0x4ee1('0x6b')},{'model':db[_0x33f5af+_0x4db801],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x207758){if(_[_0x4ee1('0x14')](_0x207758)){throw new Error(_0x33f5af+'\x20Message\x20not\x20found');}_0x3a75a7=_0x207758;return _0x207758[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x646878={'uniqueid':_0x5727ef+'.'+_0x3a75a7['id']+'.'+_0x3a75a7[_0x4ee1('0x6b')]['id'],'FromUserId':_0x4a3201[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d')};_0x646878[_0x33f5af+_0x4ee1('0x6e')]=_0x3a75a7['id'];_0x646878[_0x33f5af+_0x4ee1('0x6f')]=_0x3a75a7[_0x4ee1('0x6b')]['id'];_0x646878[_0x4ee1('0x70')+_0x33f5af+_0x4db801+'Id']=_0x3a75a7[_0x4ee1('0x65')]['id'];_0x646878['To'+_0x33f5af+_0x4ee1('0x71')]=_0x3fba19['id'];return db[_0x33f5af+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x646878);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x5727ef,'interaction':_0x3a75a7['Interaction'],'message':_0x3a75a7,'account':_0x3a75a7[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x6d'),'appdata':_0x3fba19['name']+','+(_0x3a75a7[_0x4ee1('0x65')][_0x4ee1('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x50645b,null))[_0x4ee1('0xd')](handleError(_0x50645b,null));};};exports['agentNotify']=function(_0x13a755,_0x1a00a4){var _0x47b854,_0x1700c6;if(_[_0x4ee1('0x14')](_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2bc05a=_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')];var _0xc07f75=_[_0x4ee1('0x63')](_0x2bc05a);var _0x4315e9=_0x2bc05a===_0x4ee1('0x64')?_0x4ee1('0x77'):'Account';return db[_0x4ee1('0x78')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x13a755['params']['id'],'role':_0x4ee1('0x79')}})['then'](function(_0x5cf7fb){if(_[_0x4ee1('0x14')](_0x5cf7fb)){throw new Error(_0x4ee1('0x7a'));}_0x47b854=_0x5cf7fb;return db[_0xc07f75+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0xc07f75+'Interaction'],'as':_0x4ee1('0x6b')},{'model':db[_0xc07f75+_0x4315e9],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x17ae2d){if(_[_0x4ee1('0x14')](_0x17ae2d)){throw new Error(_0xc07f75+_0x4ee1('0x7b'));}_0x1700c6=_0x17ae2d;return _0x17ae2d[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x5076c6={'uniqueid':_0x2bc05a+'.'+_0x1700c6['id']+'.'+_0x1700c6[_0x4ee1('0x6b')]['id'],'FromUserId':_0x13a755[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d'),'ToUserId':_0x47b854['id']};_0x5076c6[_0xc07f75+_0x4ee1('0x6e')]=_0x1700c6['id'];_0x5076c6[_0xc07f75+_0x4ee1('0x6f')]=_0x1700c6['Interaction']['id'];_0x5076c6[_0x4ee1('0x70')+_0xc07f75+_0x4315e9+'Id']=_0x1700c6['Account']['id'];return db[_0xc07f75+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x5076c6);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x2bc05a,'interaction':_0x1700c6['Interaction'],'message':_0x1700c6,'account':_0x1700c6[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x79'),'appdata':_0x47b854['name']+','+(_0x1700c6[_0x4ee1('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x4ee1('0x7c')}]},routingClient);})[_0x4ee1('0x8')](respondWithResult(_0x1a00a4,null))['catch'](handleError(_0x1a00a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 059943e..a892998 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 _0x8b44=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4db087,_0x576599){var _0x2e2dcb=function(_0x1b39e2){while(--_0x1b39e2){_0x4db087['push'](_0x4db087['shift']());}};_0x2e2dcb(++_0x576599);}(_0x8b44,0x1a0));var _0x48b4=function(_0x3cc10d,_0x5c4a9e){_0x3cc10d=_0x3cc10d-0x0;var _0x2593f7=_0x8b44[_0x3cc10d];return _0x2593f7;};'use strict';var multer=require(_0x48b4('0x0'));var util=require(_0x48b4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x48b4('0x2'));var router=express[_0x48b4('0x3')]();var fs_extra=require(_0x48b4('0x4'));var auth=require(_0x48b4('0x5'));var interaction=require(_0x48b4('0x6'));var config=require(_0x48b4('0x7'));var controller=require(_0x48b4('0x8'));router[_0x48b4('0x9')]('/',auth[_0x48b4('0xa')](),controller['index']);router[_0x48b4('0x9')](_0x48b4('0xb'),auth[_0x48b4('0xa')](),controller[_0x48b4('0xc')]);router['get'](_0x48b4('0xd'),auth[_0x48b4('0xa')](),controller[_0x48b4('0xe')]);router[_0x48b4('0xf')]('/',auth[_0x48b4('0xa')](),controller[_0x48b4('0x10')]);router[_0x48b4('0x11')](_0x48b4('0xb'),auth[_0x48b4('0xa')](),controller[_0x48b4('0x12')]);router[_0x48b4('0x13')](_0x48b4('0xb'),auth['isAuthenticated'](),controller[_0x48b4('0x14')]);module[_0x48b4('0x15')]=router; \ No newline at end of file +var _0x09e1=['create','exports','path','Router','fs-extra','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x09e1,0xab));var _0x109e=function(_0x4ba36e,_0x55559d){_0x4ba36e=_0x4ba36e-0x0;var _0x4556b7=_0x09e1[_0x4ba36e];return _0x4556b7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x109e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x109e('0x1')]();var fs_extra=require(_0x109e('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x109e('0x3'));var controller=require(_0x109e('0x4'));router[_0x109e('0x5')]('/',auth[_0x109e('0x6')](),controller['index']);router[_0x109e('0x5')](_0x109e('0x7'),auth[_0x109e('0x6')](),controller[_0x109e('0x8')]);router['get'](_0x109e('0x9'),auth[_0x109e('0x6')](),controller[_0x109e('0xa')]);router['post']('/',auth[_0x109e('0x6')](),controller[_0x109e('0xb')]);router['put'](_0x109e('0x7'),auth[_0x109e('0x6')](),controller['update']);router['delete']('/:id',auth[_0x109e('0x6')](),controller['destroy']);module[_0x109e('0xc')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 98b4085..1f43e21 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 _0x9805=['ENUM','csv','custom','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters','months','days','hours','minutes'];(function(_0x4b4e1b,_0x2f37e3){var _0x4c1cbb=function(_0x57c38a){while(--_0x57c38a){_0x4b4e1b['push'](_0x4b4e1b['shift']());}};_0x4c1cbb(++_0x2f37e3);}(_0x9805,0x9a));var _0x5980=function(_0x4e27c3,_0x4f890f){_0x4e27c3=_0x4e27c3-0x0;var _0x12d23d=_0x9805[_0x4e27c3];return _0x12d23d;};'use strict';var Sequelize=require(_0x5980('0x0'));module['exports']={'name':{'type':Sequelize[_0x5980('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5980('0x1')]},'active':{'type':Sequelize[_0x5980('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5980('0x3')},'startAt':{'type':Sequelize[_0x5980('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5980('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x5980('0x6'),_0x5980('0x7'),'weeks',_0x5980('0x8'),_0x5980('0x9'),_0x5980('0xa')),'allowNull':![],'defaultValue':_0x5980('0x8')},'output':{'type':Sequelize[_0x5980('0xb')](_0x5980('0xc'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x5980('0xd'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5980('0x1')]},'cc':{'type':Sequelize[_0x5980('0xe')]},'bcc':{'type':Sequelize[_0x5980('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x5980('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8c79=['hours','minutes','days','ENUM','pdf','csv','custom','default','TEXT','sequelize','exports','BOOLEAN','STRING','DATE','INTEGER','quarters','months','weeks'];(function(_0x27df84,_0x734b17){var _0x2c080e=function(_0x29e7ce){while(--_0x29e7ce){_0x27df84['push'](_0x27df84['shift']());}};_0x2c080e(++_0x734b17);}(_0x8c79,0x13b));var _0x98c7=function(_0x4fdc26,_0x5765b4){_0x4fdc26=_0x4fdc26-0x0;var _0x3df58f=_0x8c79[_0x4fdc26];return _0x3df58f;};'use strict';var Sequelize=require(_0x98c7('0x0'));module[_0x98c7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x98c7('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x98c7('0x3')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x98c7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x98c7('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x98c7('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x98c7('0x6'),_0x98c7('0x7'),_0x98c7('0x8'),'days',_0x98c7('0x9'),_0x98c7('0xa')),'allowNull':![],'defaultValue':_0x98c7('0xb')},'output':{'type':Sequelize[_0x98c7('0xc')]('csv',_0x98c7('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x98c7('0xe')},'type':{'type':Sequelize[_0x98c7('0xc')](_0x98c7('0xf'),_0x98c7('0x10')),'allowNull':![],'defaultValue':_0x98c7('0xf')},'sendMail':{'type':Sequelize[_0x98c7('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x98c7('0x11')]},'bcc':{'type':Sequelize[_0x98c7('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index ab92248..19cea3e 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 _0x68b2=['attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','keys','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','UserProfileSection','userProfileId','autoAssociation','body','destroy','find','run','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','then','get','UserProfileResource','end','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','filters','intersection','fields'];(function(_0x3f1a8b,_0xb18cdb){var _0x2b2af7=function(_0x2c8fc7){while(--_0x2c8fc7){_0x3f1a8b['push'](_0x3f1a8b['shift']());}};_0x2b2af7(++_0xb18cdb);}(_0x68b2,0x1a6));var _0x268b=function(_0x8f10f9,_0x44280b){_0x8f10f9=_0x8f10f9-0x0;var _0x32b6c1=_0x68b2[_0x8f10f9];return _0x32b6c1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x268b('0x0'));var jsonpatch=require(_0x268b('0x1'));var rp=require(_0x268b('0x2'));var moment=require(_0x268b('0x3'));var BPromise=require(_0x268b('0x4'));var Mustache=require(_0x268b('0x5'));var util=require(_0x268b('0x6'));var path=require(_0x268b('0x7'));var sox=require(_0x268b('0x8'));var csv=require(_0x268b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x268b('0xa'));var _=require(_0x268b('0xb'));var squel=require(_0x268b('0xc'));var crypto=require(_0x268b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x268b('0xe'));var toCsv=require(_0x268b('0x9'));var querystring=require(_0x268b('0xf'));var Papa=require(_0x268b('0x10'));var Redis=require(_0x268b('0x11'));var authService=require(_0x268b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x268b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x268b('0x14'))(_0x268b('0x15'));var utils=require(_0x268b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x268b('0x17'))['db'];function respondWithStatusCode(_0x5aa3ba,_0x5ec3fa){_0x5ec3fa=_0x5ec3fa||0xcc;return function(_0x26e09c){if(_0x26e09c){return _0x5aa3ba[_0x268b('0x18')](_0x5ec3fa);}return _0x5aa3ba['status'](_0x5ec3fa)['end']();};}function respondWithResult(_0x4579a3,_0x310130){_0x310130=_0x310130||0xc8;return function(_0x3f4d52){if(_0x3f4d52){return _0x4579a3[_0x268b('0x19')](_0x310130)[_0x268b('0x1a')](_0x3f4d52);}};}function respondWithFilteredResult(_0x4c32aa,_0x5bb562){return function(_0x17b3d1){if(_0x17b3d1){var _0x21bb2f=typeof _0x5bb562[_0x268b('0x1b')]==='undefined'&&typeof _0x5bb562[_0x268b('0x1c')]==='undefined';var _0x54f2d0=_0x17b3d1[_0x268b('0x1d')];var _0x4f0e04=_0x21bb2f?0x0:_0x5bb562[_0x268b('0x1b')];var _0x21c401=_0x21bb2f?_0x17b3d1[_0x268b('0x1d')]:_0x5bb562[_0x268b('0x1b')]+_0x5bb562[_0x268b('0x1c')];var _0x59ef34;if(_0x21c401>=_0x54f2d0){_0x21c401=_0x54f2d0;_0x59ef34=0xc8;}else{_0x59ef34=0xce;}_0x4c32aa[_0x268b('0x19')](_0x59ef34);return _0x4c32aa[_0x268b('0x1e')](_0x268b('0x1f'),_0x4f0e04+'-'+_0x21c401+'/'+_0x54f2d0)[_0x268b('0x1a')](_0x17b3d1);}return null;};}function patchUpdates(_0x41671f){return function(_0x1e8e27){try{jsonpatch['apply'](_0x1e8e27,_0x41671f,!![]);}catch(_0xf38cd0){return BPromise[_0x268b('0x20')](_0xf38cd0);}return _0x1e8e27['save']();};}function saveUpdates(_0x31a389,_0x3a7d17){return function(_0x60ce41){if(_0x60ce41){return _0x60ce41[_0x268b('0x21')](_0x31a389)['then'](function(_0x36a59e){return _0x36a59e;});}return null;};}function removeEntity(_0xfc3952,_0x39a8af){return function(_0x1e49d2){if(_0x1e49d2){return _0x1e49d2['destroy']()[_0x268b('0x22')](function(){var _0x28c1b1=_0x1e49d2[_0x268b('0x23')]({'plain':!![]});var _0x157a78='Scheduler';return db[_0x268b('0x24')]['destroy']({'where':{'type':_0x157a78,'resourceId':_0x28c1b1['id']}})[_0x268b('0x22')](function(){return _0x1e49d2;});})['then'](function(){_0xfc3952[_0x268b('0x19')](0xcc)[_0x268b('0x25')]();});}};}function handleEntityNotFound(_0x3754e3,_0x1df4ab){return function(_0x15dd56){if(!_0x15dd56){_0x3754e3['sendStatus'](0x194);}return _0x15dd56;};}function handleError(_0x1e7454,_0x22f7bc){_0x22f7bc=_0x22f7bc||0x1f4;return function(_0x146300){logger[_0x268b('0x26')](_0x146300['stack']);if(_0x146300['name']){delete _0x146300[_0x268b('0x27')];}_0x1e7454[_0x268b('0x19')](_0x22f7bc)[_0x268b('0x28')](_0x146300);};}exports[_0x268b('0x29')]=function(_0x48970f,_0x397ea4){var _0x54afbf={},_0x4f27be={},_0x2eeffb={'count':0x0,'rows':[]};var _0x253db1=_[_0x268b('0x2a')](db[_0x268b('0x2b')][_0x268b('0x2c')],function(_0x4200f5){return{'name':_0x4200f5[_0x268b('0x2d')],'type':_0x4200f5[_0x268b('0x2e')]['key']};});_0x4f27be[_0x268b('0x2f')]=_['map'](_0x253db1,_0x268b('0x27'));_0x4f27be['query']=_['keys'](_0x48970f[_0x268b('0x30')]);_0x4f27be[_0x268b('0x31')]=_[_0x268b('0x32')](_0x4f27be[_0x268b('0x2f')],_0x4f27be['query']);_0x54afbf['attributes']=_[_0x268b('0x32')](_0x4f27be['model'],qs[_0x268b('0x33')](_0x48970f['query'][_0x268b('0x33')]));_0x54afbf[_0x268b('0x34')]=_0x54afbf[_0x268b('0x34')]['length']?_0x54afbf[_0x268b('0x34')]:_0x4f27be['model'];if(!_0x48970f[_0x268b('0x30')][_0x268b('0x35')](_0x268b('0x36'))){_0x54afbf[_0x268b('0x1c')]=qs['limit'](_0x48970f[_0x268b('0x30')][_0x268b('0x1c')]);_0x54afbf[_0x268b('0x1b')]=qs['offset'](_0x48970f['query'][_0x268b('0x1b')]);}_0x54afbf[_0x268b('0x37')]=qs[_0x268b('0x38')](_0x48970f['query'][_0x268b('0x38')]);_0x54afbf[_0x268b('0x39')]=qs[_0x268b('0x31')](_['pick'](_0x48970f[_0x268b('0x30')],_0x4f27be['filters']),_0x253db1);if(_0x48970f[_0x268b('0x30')][_0x268b('0x3a')]){_0x54afbf[_0x268b('0x39')]=_['merge'](_0x54afbf[_0x268b('0x39')],{'$or':_['map'](_0x253db1,function(_0x52f79a){if(_0x52f79a[_0x268b('0x2e')]!=='VIRTUAL'){var _0x596561={};_0x596561[_0x52f79a[_0x268b('0x27')]]={'$like':'%'+_0x48970f['query']['filter']+'%'};return _0x596561;}})});}_0x54afbf=_[_0x268b('0x3b')]({},_0x54afbf,_0x48970f[_0x268b('0x3c')]);var _0x53c4b9={'where':_0x54afbf[_0x268b('0x39')]};return db[_0x268b('0x2b')]['count'](_0x53c4b9)[_0x268b('0x22')](function(_0x4a1129){_0x2eeffb[_0x268b('0x1d')]=_0x4a1129;if(_0x48970f[_0x268b('0x30')][_0x268b('0x3d')]){_0x54afbf[_0x268b('0x3e')]=[{'all':!![]}];}return db[_0x268b('0x2b')]['findAll'](_0x54afbf);})[_0x268b('0x22')](function(_0x315459){_0x2eeffb[_0x268b('0x3f')]=_0x315459;return _0x2eeffb;})[_0x268b('0x22')](respondWithFilteredResult(_0x397ea4,_0x54afbf))['catch'](handleError(_0x397ea4,null));};exports[_0x268b('0x40')]=function(_0x13c4fb,_0x1f54d4){var _0x90f52e={'raw':![],'where':{'id':_0x13c4fb[_0x268b('0x41')]['id']}},_0x3b8d8e={};_0x3b8d8e[_0x268b('0x2f')]=_[_0x268b('0x42')](db['Schedule'][_0x268b('0x2c')]);_0x3b8d8e[_0x268b('0x30')]=_[_0x268b('0x42')](_0x13c4fb[_0x268b('0x30')]);_0x3b8d8e[_0x268b('0x31')]=_['intersection'](_0x3b8d8e['model'],_0x3b8d8e['query']);_0x90f52e['attributes']=_['intersection'](_0x3b8d8e[_0x268b('0x2f')],qs['fields'](_0x13c4fb['query'][_0x268b('0x33')]));_0x90f52e['attributes']=_0x90f52e[_0x268b('0x34')]['length']?_0x90f52e[_0x268b('0x34')]:_0x3b8d8e[_0x268b('0x2f')];if(_0x13c4fb[_0x268b('0x30')]['includeAll']){_0x90f52e['include']=[{'all':!![]}];}_0x90f52e=_['merge']({},_0x90f52e,_0x13c4fb[_0x268b('0x3c')]);return db[_0x268b('0x2b')]['find'](_0x90f52e)[_0x268b('0x22')](handleEntityNotFound(_0x1f54d4,null))['then'](respondWithResult(_0x1f54d4,null))[_0x268b('0x43')](handleError(_0x1f54d4,null));};exports['create']=function(_0x40a8b2,_0x5afce3){return db['Schedule'][_0x268b('0x44')](_0x40a8b2['body'],{})[_0x268b('0x22')](function(_0x4236c6){var _0x3fc2a9=_0x40a8b2[_0x268b('0x45')][_0x268b('0x23')]({'plain':!![]});if(!_0x3fc2a9)throw new Error(_0x268b('0x46'));if(_0x3fc2a9['role']===_0x268b('0x45')){var _0x2e4efb=_0x4236c6['get']({'plain':!![]});var _0xe4535d=_0x268b('0x47');return db[_0x268b('0x48')]['find']({'where':{'name':_0xe4535d,'userProfileId':_0x3fc2a9[_0x268b('0x49')]},'raw':!![]})['then'](function(_0x58add7){if(_0x58add7&&_0x58add7[_0x268b('0x4a')]===0x0){return db[_0x268b('0x24')][_0x268b('0x44')]({'name':_0x2e4efb[_0x268b('0x27')],'resourceId':_0x2e4efb['id'],'type':_0x58add7[_0x268b('0x27')],'sectionId':_0x58add7['id']},{})[_0x268b('0x22')](function(){return _0x4236c6;});}else{return _0x4236c6;}})['catch'](function(_0x55544f){logger[_0x268b('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55544f);throw _0x55544f;});}return _0x4236c6;})[_0x268b('0x22')](respondWithResult(_0x5afce3,0xc9))[_0x268b('0x43')](handleError(_0x5afce3,null));};exports[_0x268b('0x21')]=function(_0x5d04d9,_0x421982){if(_0x5d04d9[_0x268b('0x4b')]['id']){delete _0x5d04d9['body']['id'];}return db[_0x268b('0x2b')]['find']({'where':{'id':_0x5d04d9[_0x268b('0x41')]['id']}})[_0x268b('0x22')](handleEntityNotFound(_0x421982,null))[_0x268b('0x22')](saveUpdates(_0x5d04d9[_0x268b('0x4b')],null))[_0x268b('0x22')](respondWithResult(_0x421982,null))[_0x268b('0x43')](handleError(_0x421982,null));};exports[_0x268b('0x4c')]=function(_0x1fc77d,_0x3b58e5){return db[_0x268b('0x2b')][_0x268b('0x4d')]({'where':{'id':_0x1fc77d[_0x268b('0x41')]['id']}})[_0x268b('0x22')](handleEntityNotFound(_0x3b58e5,null))['then'](removeEntity(_0x3b58e5,null))['catch'](handleError(_0x3b58e5,null));};exports[_0x268b('0x4e')]=function(_0x2ea744,_0x22afc8,_0xf8ad93){var _0x17127f=require('../../config/schedule');return db[_0x268b('0x2b')]['find']({'where':{'id':_0x2ea744[_0x268b('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x22afc8,null))['then'](function(){_0x17127f[_0x268b('0x4e')](_0x2ea744['params']['id']);})[_0x268b('0x22')](respondWithStatusCode(_0x22afc8,null))[_0x268b('0x43')](handleError(_0x22afc8,null));}; \ No newline at end of file +var _0xaf16=['type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','role','user','get','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','map','Schedule'];(function(_0x325ee2,_0xaf1371){var _0x7f2741=function(_0x15569a){while(--_0x15569a){_0x325ee2['push'](_0x325ee2['shift']());}};_0x7f2741(++_0xaf1371);}(_0xaf16,0xcb));var _0x6af1=function(_0x485865,_0x11d29a){_0x485865=_0x485865-0x0;var _0x11ef06=_0xaf16[_0x485865];return _0x11ef06;};'use strict';var emlformat=require(_0x6af1('0x0'));var rimraf=require(_0x6af1('0x1'));var zipdir=require(_0x6af1('0x2'));var jsonpatch=require(_0x6af1('0x3'));var rp=require(_0x6af1('0x4'));var moment=require(_0x6af1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6af1('0x6'));var path=require(_0x6af1('0x7'));var sox=require('sox');var csv=require(_0x6af1('0x8'));var ejs=require(_0x6af1('0x9'));var fs=require('fs');var fs_extra=require(_0x6af1('0xa'));var _=require('lodash');var squel=require(_0x6af1('0xb'));var crypto=require('crypto');var jsforce=require(_0x6af1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6af1('0x8'));var querystring=require(_0x6af1('0xd'));var Papa=require(_0x6af1('0xe'));var Redis=require(_0x6af1('0xf'));var authService=require(_0x6af1('0x10'));var qs=require(_0x6af1('0x11'));var as=require(_0x6af1('0x12'));var hardwareService=require(_0x6af1('0x13'));var logger=require(_0x6af1('0x14'))(_0x6af1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6af1('0x16'))['db'];function respondWithStatusCode(_0x4e9959,_0x1a2a2a){_0x1a2a2a=_0x1a2a2a||0xcc;return function(_0x1f14f8){if(_0x1f14f8){return _0x4e9959[_0x6af1('0x17')](_0x1a2a2a);}return _0x4e9959[_0x6af1('0x18')](_0x1a2a2a)[_0x6af1('0x19')]();};}function respondWithResult(_0x222a82,_0x265adf){_0x265adf=_0x265adf||0xc8;return function(_0xb245b1){if(_0xb245b1){return _0x222a82[_0x6af1('0x18')](_0x265adf)['json'](_0xb245b1);}};}function respondWithFilteredResult(_0x18ed5f,_0x11d2f7){return function(_0x5c1c17){if(_0x5c1c17){var _0x1e0eb3=typeof _0x11d2f7['offset']===_0x6af1('0x1a')&&typeof _0x11d2f7['limit']==='undefined';var _0x5a507f=_0x5c1c17[_0x6af1('0x1b')];var _0x300368=_0x1e0eb3?0x0:_0x11d2f7[_0x6af1('0x1c')];var _0x1955b9=_0x1e0eb3?_0x5c1c17[_0x6af1('0x1b')]:_0x11d2f7['offset']+_0x11d2f7[_0x6af1('0x1d')];var _0x8d1e6c;if(_0x1955b9>=_0x5a507f){_0x1955b9=_0x5a507f;_0x8d1e6c=0xc8;}else{_0x8d1e6c=0xce;}_0x18ed5f[_0x6af1('0x18')](_0x8d1e6c);return _0x18ed5f[_0x6af1('0x1e')](_0x6af1('0x1f'),_0x300368+'-'+_0x1955b9+'/'+_0x5a507f)['json'](_0x5c1c17);}return null;};}function patchUpdates(_0x1d4f77){return function(_0x40f969){try{jsonpatch[_0x6af1('0x20')](_0x40f969,_0x1d4f77,!![]);}catch(_0x1946c6){return BPromise['reject'](_0x1946c6);}return _0x40f969[_0x6af1('0x21')]();};}function saveUpdates(_0x2498a5,_0x1bd237){return function(_0x1b967c){if(_0x1b967c){return _0x1b967c[_0x6af1('0x22')](_0x2498a5)[_0x6af1('0x23')](function(_0x30d871){return _0x30d871;});}return null;};}function removeEntity(_0x31cb1f,_0x5c76e9){return function(_0x2c2a4f){if(_0x2c2a4f){return _0x2c2a4f[_0x6af1('0x24')]()[_0x6af1('0x23')](function(){var _0x2718cd=_0x2c2a4f['get']({'plain':!![]});var _0x3110d4='Scheduler';return db[_0x6af1('0x25')][_0x6af1('0x24')]({'where':{'type':_0x3110d4,'resourceId':_0x2718cd['id']}})[_0x6af1('0x23')](function(){return _0x2c2a4f;});})['then'](function(){_0x31cb1f[_0x6af1('0x18')](0xcc)[_0x6af1('0x19')]();});}};}function handleEntityNotFound(_0x15bfa0,_0x235cb7){return function(_0x5b71e0){if(!_0x5b71e0){_0x15bfa0[_0x6af1('0x17')](0x194);}return _0x5b71e0;};}function handleError(_0x2526bb,_0x29c75a){_0x29c75a=_0x29c75a||0x1f4;return function(_0x397ef3){logger[_0x6af1('0x26')](_0x397ef3[_0x6af1('0x27')]);if(_0x397ef3['name']){delete _0x397ef3[_0x6af1('0x28')];}_0x2526bb[_0x6af1('0x18')](_0x29c75a)['send'](_0x397ef3);};}exports['index']=function(_0x23a2ab,_0x548e9f){var _0x410b92={},_0x4dd642={},_0x63a97f={'count':0x0,'rows':[]};var _0x4ed1ba=_[_0x6af1('0x29')](db[_0x6af1('0x2a')]['rawAttributes'],function(_0x22b280){return{'name':_0x22b280['fieldName'],'type':_0x22b280[_0x6af1('0x2b')]['key']};});_0x4dd642[_0x6af1('0x2c')]=_[_0x6af1('0x29')](_0x4ed1ba,_0x6af1('0x28'));_0x4dd642[_0x6af1('0x2d')]=_[_0x6af1('0x2e')](_0x23a2ab[_0x6af1('0x2d')]);_0x4dd642[_0x6af1('0x2f')]=_[_0x6af1('0x30')](_0x4dd642['model'],_0x4dd642['query']);_0x410b92[_0x6af1('0x31')]=_[_0x6af1('0x30')](_0x4dd642[_0x6af1('0x2c')],qs[_0x6af1('0x32')](_0x23a2ab[_0x6af1('0x2d')]['fields']));_0x410b92[_0x6af1('0x31')]=_0x410b92['attributes'][_0x6af1('0x33')]?_0x410b92['attributes']:_0x4dd642[_0x6af1('0x2c')];if(!_0x23a2ab[_0x6af1('0x2d')]['hasOwnProperty'](_0x6af1('0x34'))){_0x410b92['limit']=qs[_0x6af1('0x1d')](_0x23a2ab[_0x6af1('0x2d')][_0x6af1('0x1d')]);_0x410b92['offset']=qs[_0x6af1('0x1c')](_0x23a2ab[_0x6af1('0x2d')][_0x6af1('0x1c')]);}_0x410b92[_0x6af1('0x35')]=qs['sort'](_0x23a2ab[_0x6af1('0x2d')][_0x6af1('0x36')]);_0x410b92[_0x6af1('0x37')]=qs[_0x6af1('0x2f')](_[_0x6af1('0x38')](_0x23a2ab[_0x6af1('0x2d')],_0x4dd642[_0x6af1('0x2f')]),_0x4ed1ba);if(_0x23a2ab[_0x6af1('0x2d')][_0x6af1('0x39')]){_0x410b92[_0x6af1('0x37')]=_[_0x6af1('0x3a')](_0x410b92[_0x6af1('0x37')],{'$or':_[_0x6af1('0x29')](_0x4ed1ba,function(_0x2bb93a){if(_0x2bb93a[_0x6af1('0x2b')]!==_0x6af1('0x3b')){var _0xcba854={};_0xcba854[_0x2bb93a[_0x6af1('0x28')]]={'$like':'%'+_0x23a2ab[_0x6af1('0x2d')][_0x6af1('0x39')]+'%'};return _0xcba854;}})});}_0x410b92=_[_0x6af1('0x3a')]({},_0x410b92,_0x23a2ab['options']);var _0x4ce0d4={'where':_0x410b92[_0x6af1('0x37')]};return db[_0x6af1('0x2a')][_0x6af1('0x1b')](_0x4ce0d4)[_0x6af1('0x23')](function(_0x10e5d4){_0x63a97f[_0x6af1('0x1b')]=_0x10e5d4;if(_0x23a2ab[_0x6af1('0x2d')][_0x6af1('0x3c')]){_0x410b92[_0x6af1('0x3d')]=[{'all':!![]}];}return db[_0x6af1('0x2a')][_0x6af1('0x3e')](_0x410b92);})[_0x6af1('0x23')](function(_0xf8b896){_0x63a97f[_0x6af1('0x3f')]=_0xf8b896;return _0x63a97f;})['then'](respondWithFilteredResult(_0x548e9f,_0x410b92))[_0x6af1('0x40')](handleError(_0x548e9f,null));};exports[_0x6af1('0x41')]=function(_0x2c0763,_0x205d2c){var _0x34a3c6={'raw':![],'where':{'id':_0x2c0763[_0x6af1('0x42')]['id']}},_0x1604e0={};_0x1604e0[_0x6af1('0x2c')]=_[_0x6af1('0x2e')](db[_0x6af1('0x2a')][_0x6af1('0x43')]);_0x1604e0[_0x6af1('0x2d')]=_[_0x6af1('0x2e')](_0x2c0763[_0x6af1('0x2d')]);_0x1604e0[_0x6af1('0x2f')]=_['intersection'](_0x1604e0[_0x6af1('0x2c')],_0x1604e0[_0x6af1('0x2d')]);_0x34a3c6[_0x6af1('0x31')]=_[_0x6af1('0x30')](_0x1604e0[_0x6af1('0x2c')],qs[_0x6af1('0x32')](_0x2c0763[_0x6af1('0x2d')][_0x6af1('0x32')]));_0x34a3c6[_0x6af1('0x31')]=_0x34a3c6[_0x6af1('0x31')]['length']?_0x34a3c6['attributes']:_0x1604e0[_0x6af1('0x2c')];if(_0x2c0763['query']['includeAll']){_0x34a3c6[_0x6af1('0x3d')]=[{'all':!![]}];}_0x34a3c6=_[_0x6af1('0x3a')]({},_0x34a3c6,_0x2c0763[_0x6af1('0x44')]);return db[_0x6af1('0x2a')][_0x6af1('0x45')](_0x34a3c6)[_0x6af1('0x23')](handleEntityNotFound(_0x205d2c,null))[_0x6af1('0x23')](respondWithResult(_0x205d2c,null))[_0x6af1('0x40')](handleError(_0x205d2c,null));};exports['create']=function(_0x28759c,_0x161cd4){return db['Schedule'][_0x6af1('0x46')](_0x28759c[_0x6af1('0x47')],{})[_0x6af1('0x23')](function(_0x2bf70d){var _0x6d3950=_0x28759c['user']['get']({'plain':!![]});if(!_0x6d3950)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6d3950[_0x6af1('0x48')]===_0x6af1('0x49')){var _0x575335=_0x2bf70d[_0x6af1('0x4a')]({'plain':!![]});var _0x1d55f6=_0x6af1('0x4b');return db[_0x6af1('0x4c')][_0x6af1('0x45')]({'where':{'name':_0x1d55f6,'userProfileId':_0x6d3950[_0x6af1('0x4d')]},'raw':!![]})[_0x6af1('0x23')](function(_0x483fbc){if(_0x483fbc&&_0x483fbc[_0x6af1('0x4e')]===0x0){return db['UserProfileResource'][_0x6af1('0x46')]({'name':_0x575335[_0x6af1('0x28')],'resourceId':_0x575335['id'],'type':_0x483fbc[_0x6af1('0x28')],'sectionId':_0x483fbc['id']},{})[_0x6af1('0x23')](function(){return _0x2bf70d;});}else{return _0x2bf70d;}})[_0x6af1('0x40')](function(_0x453326){logger[_0x6af1('0x26')](_0x6af1('0x4f'),_0x453326);throw _0x453326;});}return _0x2bf70d;})[_0x6af1('0x23')](respondWithResult(_0x161cd4,0xc9))[_0x6af1('0x40')](handleError(_0x161cd4,null));};exports[_0x6af1('0x22')]=function(_0x251b5f,_0x5f0c04){if(_0x251b5f[_0x6af1('0x47')]['id']){delete _0x251b5f[_0x6af1('0x47')]['id'];}return db[_0x6af1('0x2a')][_0x6af1('0x45')]({'where':{'id':_0x251b5f['params']['id']}})[_0x6af1('0x23')](handleEntityNotFound(_0x5f0c04,null))[_0x6af1('0x23')](saveUpdates(_0x251b5f[_0x6af1('0x47')],null))[_0x6af1('0x23')](respondWithResult(_0x5f0c04,null))[_0x6af1('0x40')](handleError(_0x5f0c04,null));};exports[_0x6af1('0x24')]=function(_0x3e1668,_0x10cfba){return db[_0x6af1('0x2a')]['find']({'where':{'id':_0x3e1668[_0x6af1('0x42')]['id']}})[_0x6af1('0x23')](handleEntityNotFound(_0x10cfba,null))[_0x6af1('0x23')](removeEntity(_0x10cfba,null))[_0x6af1('0x40')](handleError(_0x10cfba,null));};exports[_0x6af1('0x50')]=function(_0x5f5840,_0xa86371,_0xdb5d17){var _0x2e6541=require(_0x6af1('0x51'));return db[_0x6af1('0x2a')]['find']({'where':{'id':_0x5f5840[_0x6af1('0x42')]['id']},'raw':!![]})[_0x6af1('0x23')](handleEntityNotFound(_0xa86371,null))[_0x6af1('0x23')](function(){_0x2e6541[_0x6af1('0x50')](_0x5f5840['params']['id']);})[_0x6af1('0x23')](respondWithStatusCode(_0xa86371,null))[_0x6af1('0x40')](handleError(_0xa86371,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f3c7923..1f696b5 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 _0x264f=['rimraf','../../config/environment','exports','Schedule','tools_schedules','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x2856ff,_0x44ebcd){var _0x7ee87f=function(_0x99cd32){while(--_0x99cd32){_0x2856ff['push'](_0x2856ff['shift']());}};_0x7ee87f(++_0x44ebcd);}(_0x264f,0x13b));var _0xf264=function(_0xb9b213,_0x310e5e){_0xb9b213=_0xb9b213-0x0;var _0x4f48a3=_0x264f[_0xb9b213];return _0x4f48a3;};'use strict';var _=require(_0xf264('0x0'));var util=require('util');var logger=require(_0xf264('0x1'))(_0xf264('0x2'));var moment=require('moment');var BPromise=require(_0xf264('0x3'));var rp=require(_0xf264('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf264('0x5'));var config=require(_0xf264('0x6'));var attributes=require('./schedule.attributes');module[_0xf264('0x7')]=function(_0xfc8322,_0x4ff6c8){return _0xfc8322['define'](_0xf264('0x8'),attributes,{'tableName':_0xf264('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ba5=['define','Schedule','tools_schedules','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports'];(function(_0x56ec80,_0x4c7006){var _0x1afa34=function(_0x265c5b){while(--_0x265c5b){_0x56ec80['push'](_0x56ec80['shift']());}};_0x1afa34(++_0x4c7006);}(_0x5ba5,0x66));var _0x55ba=function(_0x401936,_0x4acf75){_0x401936=_0x401936-0x0;var _0x350b85=_0x5ba5[_0x401936];return _0x350b85;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x55ba('0x0'));var rp=require(_0x55ba('0x1'));var fs=require('fs');var path=require(_0x55ba('0x2'));var rimraf=require('rimraf');var config=require(_0x55ba('0x3'));var attributes=require(_0x55ba('0x4'));module[_0x55ba('0x5')]=function(_0x429006,_0x5ccc7b){return _0x429006[_0x55ba('0x6')](_0x55ba('0x7'),attributes,{'tableName':_0x55ba('0x8'),'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 a93ceaf..16d151b 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 _0x1b3e=['stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x46c4d1,_0x1cc9ce){var _0x555c69=function(_0x48b07a){while(--_0x48b07a){_0x46c4d1['push'](_0x46c4d1['shift']());}};_0x555c69(++_0x1cc9ce);}(_0x1b3e,0x148));var _0xe1b3=function(_0x570466,_0x23e381){_0x570466=_0x570466-0x0;var _0x59c686=_0x1b3e[_0x570466];return _0x59c686;};'use strict';var _=require(_0xe1b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe1b3('0x1'));var rs=require(_0xe1b3('0x2'));var fs=require('fs');var Redis=require(_0xe1b3('0x3'));var db=require(_0xe1b3('0x4'))['db'];var utils=require(_0xe1b3('0x5'));var logger=require(_0xe1b3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe1b3('0x7'));var client=jayson[_0xe1b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58f1d0,_0x44bab7,_0x5d163c){return new BPromise(function(_0x30256f,_0x717d72){return client['request'](_0x58f1d0,_0x5d163c)[_0xe1b3('0x9')](function(_0x2eb2ae){logger[_0xe1b3('0xa')](_0xe1b3('0xb'),_0x44bab7,_0xe1b3('0xc'));logger['debug'](_0xe1b3('0xd'),_0x44bab7,_0xe1b3('0xc'),JSON[_0xe1b3('0xe')](_0x2eb2ae));if(_0x2eb2ae[_0xe1b3('0xf')]){if(_0x2eb2ae['error']['code']===0x1f4){logger[_0xe1b3('0xf')](_0xe1b3('0xb'),_0x44bab7,_0x2eb2ae[_0xe1b3('0xf')]['message']);return _0x717d72(_0x2eb2ae[_0xe1b3('0xf')][_0xe1b3('0x10')]);}logger[_0xe1b3('0xf')](_0xe1b3('0xb'),_0x44bab7,_0x2eb2ae[_0xe1b3('0xf')][_0xe1b3('0x10')]);return _0x30256f(_0x2eb2ae[_0xe1b3('0xf')][_0xe1b3('0x10')]);}else{logger[_0xe1b3('0xa')](_0xe1b3('0xb'),_0x44bab7,'request\x20sent');_0x30256f(_0x2eb2ae['result']['message']);}})[_0xe1b3('0x11')](function(_0x23889a){logger[_0xe1b3('0xf')]('Schedule,\x20%s,\x20%s',_0x44bab7,_0x23889a);_0x717d72(_0x23889a);});});} \ No newline at end of file +var _0x8e24=['http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4576b7,_0x50057b){var _0x3a81e0=function(_0x5e2814){while(--_0x5e2814){_0x4576b7['push'](_0x4576b7['shift']());}};_0x3a81e0(++_0x50057b);}(_0x8e24,0x1ab));var _0x48e2=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x8e24[_0x4169d8];return _0x32084a;};'use strict';var _=require('lodash');var util=require(_0x48e2('0x0'));var moment=require(_0x48e2('0x1'));var BPromise=require(_0x48e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48e2('0x4'));var logger=require(_0x48e2('0x5'))(_0x48e2('0x6'));var config=require(_0x48e2('0x7'));var jayson=require(_0x48e2('0x8'));var client=jayson[_0x48e2('0x9')][_0x48e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c92ae,_0x2d745f,_0x32c48d){return new BPromise(function(_0x52e903,_0xbf393a){return client[_0x48e2('0xb')](_0x4c92ae,_0x32c48d)[_0x48e2('0xc')](function(_0x34c955){logger[_0x48e2('0xd')]('Schedule,\x20%s,\x20%s',_0x2d745f,_0x48e2('0xe'));logger[_0x48e2('0xf')](_0x48e2('0x10'),_0x2d745f,_0x48e2('0xe'),JSON[_0x48e2('0x11')](_0x34c955));if(_0x34c955[_0x48e2('0x12')]){if(_0x34c955[_0x48e2('0x12')][_0x48e2('0x13')]===0x1f4){logger[_0x48e2('0x12')](_0x48e2('0x14'),_0x2d745f,_0x34c955[_0x48e2('0x12')]['message']);return _0xbf393a(_0x34c955['error'][_0x48e2('0x15')]);}logger[_0x48e2('0x12')]('Schedule,\x20%s,\x20%s',_0x2d745f,_0x34c955[_0x48e2('0x12')][_0x48e2('0x15')]);return _0x52e903(_0x34c955['error']['message']);}else{logger[_0x48e2('0xd')](_0x48e2('0x14'),_0x2d745f,_0x48e2('0xe'));_0x52e903(_0x34c955[_0x48e2('0x16')][_0x48e2('0x15')]);}})['catch'](function(_0x3a3012){logger['error']('Schedule,\x20%s,\x20%s',_0x2d745f,_0x3a3012);_0xbf393a(_0x3a3012);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 9fcfd5d..d99e05a 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 _0xdd45=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x464258,_0x477a29){var _0x4db583=function(_0x48ed28){while(--_0x48ed28){_0x464258['push'](_0x464258['shift']());}};_0x4db583(++_0x477a29);}(_0xdd45,0x128));var _0x5dd4=function(_0x3ebc5b,_0x5d2ef6){_0x3ebc5b=_0x3ebc5b-0x0;var _0x2f6d6e=_0xdd45[_0x3ebc5b];return _0x2f6d6e;};'use strict';var multer=require(_0x5dd4('0x0'));var util=require(_0x5dd4('0x1'));var path=require('path');var timeout=require(_0x5dd4('0x2'));var express=require(_0x5dd4('0x3'));var router=express[_0x5dd4('0x4')]();var fs_extra=require(_0x5dd4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5dd4('0x6'));var config=require(_0x5dd4('0x7'));var controller=require(_0x5dd4('0x8'));router[_0x5dd4('0x9')]('/',auth[_0x5dd4('0xa')](),controller[_0x5dd4('0xb')]);router[_0x5dd4('0x9')](_0x5dd4('0xc'),auth['isAuthenticated'](),controller[_0x5dd4('0xd')]);router[_0x5dd4('0x9')](_0x5dd4('0xe'),auth['isAuthenticated'](),controller[_0x5dd4('0xf')]);router[_0x5dd4('0x9')]('/:id/download',auth[_0x5dd4('0xa')](),controller[_0x5dd4('0x10')]);router[_0x5dd4('0x11')]('/',auth[_0x5dd4('0xa')](),controller[_0x5dd4('0x12')]);router['put']('/:id',auth[_0x5dd4('0xa')](),controller[_0x5dd4('0x13')]);router[_0x5dd4('0x14')](_0x5dd4('0xe'),auth['isAuthenticated'](),controller[_0x5dd4('0x15')]);module[_0x5dd4('0x16')]=router; \ No newline at end of file +var _0x9e2a=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','download','post','create','put','update','delete','destroy','exports','multer','Router','fs-extra'];(function(_0x13baf2,_0x7be982){var _0x5c256c=function(_0x50fb44){while(--_0x50fb44){_0x13baf2['push'](_0x13baf2['shift']());}};_0x5c256c(++_0x7be982);}(_0x9e2a,0xe1));var _0xa9e2=function(_0x22c725,_0x558fd1){_0x22c725=_0x22c725-0x0;var _0x2b5aea=_0x9e2a[_0x22c725];return _0x2b5aea;};'use strict';var multer=require(_0xa9e2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9e2('0x1')]();var fs_extra=require(_0xa9e2('0x2'));var auth=require(_0xa9e2('0x3'));var interaction=require(_0xa9e2('0x4'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0xa9e2('0x5')](),controller[_0xa9e2('0x6')]);router[_0xa9e2('0x7')](_0xa9e2('0x8'),auth[_0xa9e2('0x5')](),controller[_0xa9e2('0x9')]);router['get'](_0xa9e2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa9e2('0x7')]('/:id/download',auth[_0xa9e2('0x5')](),controller[_0xa9e2('0xb')]);router[_0xa9e2('0xc')]('/',auth['isAuthenticated'](),controller[_0xa9e2('0xd')]);router[_0xa9e2('0xe')](_0xa9e2('0xa'),auth['isAuthenticated'](),controller[_0xa9e2('0xf')]);router[_0xa9e2('0x10')](_0xa9e2('0xa'),auth[_0xa9e2('0x5')](),controller[_0xa9e2('0x11')]);module[_0xa9e2('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8027b98..fa00a7e 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 _0xca6e=['startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','../../config/environment','exports','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x473ed3,_0x36b961){var _0x597269=function(_0x1d31cf){while(--_0x1d31cf){_0x473ed3['push'](_0x473ed3['shift']());}};_0x597269(++_0x36b961);}(_0xca6e,0x1c1));var _0xeca6=function(_0x3ae9ce,_0x3833f2){_0x3ae9ce=_0x3ae9ce-0x0;var _0x1986cf=_0xca6e[_0x3ae9ce];return _0x1986cf;};'use strict';var Sequelize=require(_0xeca6('0x0'));var moment=require(_0xeca6('0x1'));var path=require(_0xeca6('0x2'));var config=require(_0xeca6('0x3'));module[_0xeca6('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xeca6('0x5')](_0xeca6('0x6'))?path['extname'](this[_0xeca6('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xeca6('0x7')]},'channel':{'type':Sequelize[_0xeca6('0x7')]},'value':{'type':Sequelize[_0xeca6('0x7')],'set':function(_0x5bec20){var _0x2ea018=_0x5bec20['replace'](/\\/g,'/');this[_0xeca6('0x8')](_0xeca6('0x6'),_0x2ea018);}},'rating':{'type':Sequelize[_0xeca6('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xeca6('0x9')],'set':function(_0xb5853c){this['setDataValue'](_0xeca6('0xa'),moment()[_0xeca6('0xb')](_0xb5853c,'ms'));this[_0xeca6('0x8')](_0xeca6('0xc'),moment());this[_0xeca6('0x8')]('duration',_0xb5853c);}},'startedAt':{'type':Sequelize[_0xeca6('0xd')],'get':function(){return moment(this[_0xeca6('0x5')](_0xeca6('0xa')))[_0xeca6('0xe')](_0xeca6('0xf'))[_0xeca6('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xeca6('0xc')))[_0xeca6('0xe')](_0xeca6('0xf'))[_0xeca6('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xeca6('0x5')]('createdAt'))[_0xeca6('0xe')](_0xeca6('0xf'))[_0xeca6('0x10')]();}},'updatedAt':{'type':Sequelize[_0xeca6('0xd')],'get':function(){return moment(this[_0xeca6('0x5')]('updatedAt'))[_0xeca6('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xeca6('0x10')]();}}}; \ No newline at end of file +var _0x1219=['createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x1cc901,_0x2eb97e){var _0x1b05dc=function(_0x52bb32){while(--_0x52bb32){_0x1cc901['push'](_0x1cc901['shift']());}};_0x1b05dc(++_0x2eb97e);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9121('0x0'));var moment=require(_0x9121('0x1'));var path=require(_0x9121('0x2'));var config=require(_0x9121('0x3'));module[_0x9121('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9121('0x5')]('value')?path[_0x9121('0x6')](this[_0x9121('0x5')](_0x9121('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x9121('0x8')]},'channel':{'type':Sequelize[_0x9121('0x8')]},'value':{'type':Sequelize[_0x9121('0x8')],'set':function(_0x437bac){var _0x1387b7=_0x437bac[_0x9121('0x9')](/\\/g,'/');this[_0x9121('0xa')](_0x9121('0x7'),_0x1387b7);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9121('0xb')],'set':function(_0x2bf1d6){this[_0x9121('0xa')](_0x9121('0xc'),moment()['subtract'](_0x2bf1d6,'ms'));this[_0x9121('0xa')](_0x9121('0xd'),moment());this[_0x9121('0xa')](_0x9121('0xe'),_0x2bf1d6);}},'startedAt':{'type':Sequelize[_0x9121('0xf')],'get':function(){return moment(this[_0x9121('0x5')](_0x9121('0xc')))[_0x9121('0x10')](_0x9121('0x11'))[_0x9121('0x12')]();}},'closedAt':{'type':Sequelize[_0x9121('0xf')],'get':function(){return moment(this[_0x9121('0x5')](_0x9121('0xd')))[_0x9121('0x10')](_0x9121('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x9121('0xf')],'get':function(){return moment(this[_0x9121('0x5')](_0x9121('0x13')))[_0x9121('0x10')](_0x9121('0x11'))[_0x9121('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x9121('0x14')))[_0x9121('0x10')](_0x9121('0x11'))[_0x9121('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 689f747..e3506eb 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 _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x30a8ab,_0x26b8be){var _0x5c3e7e=function(_0x26247d){while(--_0x26247d){_0x30a8ab['push'](_0x30a8ab['shift']());}};_0x5c3e7e(++_0x26b8be);}(_0x6f47,0xc7));var _0x76f4=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x6f47[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,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(_0x108c43,_0x2649f4){var _0x223cc2=function(_0x25a10b){while(--_0x25a10b){_0x108c43['push'](_0x108c43['shift']());}};_0x223cc2(++_0x2649f4);}(_0xee14,0x13a));var _0x4ee1=function(_0x14eae5,_0x216db4){_0x14eae5=_0x14eae5-0x0;var _0x3ebd1e=_0xee14[_0x14eae5];return _0x3ebd1e;};'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 1554d10..5f2d789 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 _0x3752=['api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','lodash','../../config/logger'];(function(_0x2878ed,_0x11c26d){var _0x357d07=function(_0x9f009e){while(--_0x9f009e){_0x2878ed['push'](_0x2878ed['shift']());}};_0x357d07(++_0x11c26d);}(_0x3752,0x11e));var _0x2375=function(_0x2c0557,_0x4314fd){_0x2c0557=_0x2c0557-0x0;var _0x2878cd=_0x3752[_0x2c0557];return _0x2878cd;};'use strict';var _=require(_0x2375('0x0'));var util=require('util');var logger=require(_0x2375('0x1'))(_0x2375('0x2'));var moment=require(_0x2375('0x3'));var BPromise=require(_0x2375('0x4'));var rp=require(_0x2375('0x5'));var fs=require('fs');var path=require(_0x2375('0x6'));var rimraf=require(_0x2375('0x7'));var config=require('../../config/environment');var attributes=require(_0x2375('0x8'));module[_0x2375('0x9')]=function(_0x6ddb51,_0x17ebf1){return _0x6ddb51['define'](_0x2375('0xa'),attributes,{'tableName':_0x2375('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a05=['screen_recordings','interactionid','util','api','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','ScreenRecording'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a05,0xf4));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x55a0('0x0'));var logger=require('../../config/logger')(_0x55a0('0x1'));var moment=require('moment');var BPromise=require(_0x55a0('0x2'));var rp=require(_0x55a0('0x3'));var fs=require('fs');var path=require(_0x55a0('0x4'));var rimraf=require(_0x55a0('0x5'));var config=require('../../config/environment');var attributes=require(_0x55a0('0x6'));module[_0x55a0('0x7')]=function(_0x305955,_0x892a44){return _0x305955['define'](_0x55a0('0x8'),attributes,{'tableName':_0x55a0('0x9'),'paranoid':![],'indexes':[{'name':_0x55a0('0xa'),'fields':[_0x55a0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 95200ef..7935ad4 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 _0x355a=['rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc06a11,_0x30fee2){var _0x10227b=function(_0x16ade9){while(--_0x16ade9){_0xc06a11['push'](_0xc06a11['shift']());}};_0x10227b(++_0x30fee2);}(_0x355a,0x1eb));var _0xa355=function(_0x2835fd,_0xe341a4){_0x2835fd=_0x2835fd-0x0;var _0x17b08a=_0x355a[_0x2835fd];return _0x17b08a;};'use strict';var _=require(_0xa355('0x0'));var util=require(_0xa355('0x1'));var moment=require(_0xa355('0x2'));var BPromise=require(_0xa355('0x3'));var rs=require(_0xa355('0x4'));var fs=require('fs');var Redis=require(_0xa355('0x5'));var db=require(_0xa355('0x6'))['db'];var utils=require(_0xa355('0x7'));var logger=require(_0xa355('0x8'))(_0xa355('0x9'));var config=require(_0xa355('0xa'));var jayson=require(_0xa355('0xb'));var client=jayson['client'][_0xa355('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23a0e7,_0x512e47,_0x568f83){return new BPromise(function(_0x10faee,_0x57e67f){return client[_0xa355('0xd')](_0x23a0e7,_0x568f83)[_0xa355('0xe')](function(_0x4becd1){logger[_0xa355('0xf')](_0xa355('0x10'),_0x512e47,_0xa355('0x11'));logger[_0xa355('0x12')](_0xa355('0x13'),_0x512e47,_0xa355('0x11'),JSON[_0xa355('0x14')](_0x4becd1));if(_0x4becd1[_0xa355('0x15')]){if(_0x4becd1[_0xa355('0x15')][_0xa355('0x16')]===0x1f4){logger['error'](_0xa355('0x10'),_0x512e47,_0x4becd1[_0xa355('0x15')][_0xa355('0x17')]);return _0x57e67f(_0x4becd1[_0xa355('0x15')][_0xa355('0x17')]);}logger[_0xa355('0x15')](_0xa355('0x10'),_0x512e47,_0x4becd1[_0xa355('0x15')][_0xa355('0x17')]);return _0x10faee(_0x4becd1[_0xa355('0x15')][_0xa355('0x17')]);}else{logger[_0xa355('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x512e47,_0xa355('0x11'));_0x10faee(_0x4becd1[_0xa355('0x18')][_0xa355('0x17')]);}})['catch'](function(_0x2589a1){logger['error'](_0xa355('0x10'),_0x512e47,_0x2589a1);_0x57e67f(_0x2589a1);});});} \ No newline at end of file +var _0x1d81=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d81,0x71));var _0x11d8=function(_0x7d261d,_0x4e1d2f){_0x7d261d=_0x7d261d-0x0;var _0x1a992a=_0x1d81[_0x7d261d];return _0x1a992a;};'use strict';var _=require(_0x11d8('0x0'));var util=require('util');var moment=require(_0x11d8('0x1'));var BPromise=require('bluebird');var rs=require(_0x11d8('0x2'));var fs=require('fs');var Redis=require(_0x11d8('0x3'));var db=require(_0x11d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x11d8('0x5'));var config=require(_0x11d8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x11d8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59d213,_0x27e2de,_0x18ca2a){return new BPromise(function(_0x12c39c,_0x63a099){return client['request'](_0x59d213,_0x18ca2a)[_0x11d8('0x8')](function(_0x30001a){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x27e2de,_0x11d8('0x9'));logger[_0x11d8('0xa')](_0x11d8('0xb'),_0x27e2de,_0x11d8('0x9'),JSON['stringify'](_0x30001a));if(_0x30001a[_0x11d8('0xc')]){if(_0x30001a[_0x11d8('0xc')][_0x11d8('0xd')]===0x1f4){logger[_0x11d8('0xc')](_0x11d8('0xe'),_0x27e2de,_0x30001a[_0x11d8('0xc')][_0x11d8('0xf')]);return _0x63a099(_0x30001a[_0x11d8('0xc')]['message']);}logger[_0x11d8('0xc')](_0x11d8('0xe'),_0x27e2de,_0x30001a[_0x11d8('0xc')][_0x11d8('0xf')]);return _0x12c39c(_0x30001a['error'][_0x11d8('0xf')]);}else{logger[_0x11d8('0x10')](_0x11d8('0xe'),_0x27e2de,'request\x20sent');_0x12c39c(_0x30001a[_0x11d8('0x11')][_0x11d8('0xf')]);}})[_0x11d8('0x12')](function(_0x50f47e){logger[_0x11d8('0xc')](_0x11d8('0xe'),_0x27e2de,_0x50f47e);_0x63a099(_0x50f47e);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fb4a6ad..e2c249c 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 _0x2d8c=['update','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','single','file','addLogo','format','logologin','addLogoLogin','preferred','post','/:id/preferred','addPreferred','favicon','addFavicon','put'];(function(_0x45dad2,_0x27f1f8){var _0x14a3e1=function(_0x1a60a6){while(--_0x1a60a6){_0x45dad2['push'](_0x45dad2['shift']());}};_0x14a3e1(++_0x27f1f8);}(_0x2d8c,0x89));var _0xc2d8=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x2d8c[_0x54a2e4];return _0x4742d0;};'use strict';var multer=require('multer');var util=require(_0xc2d8('0x0'));var path=require(_0xc2d8('0x1'));var timeout=require(_0xc2d8('0x2'));var express=require('express');var router=express[_0xc2d8('0x3')]();var fs_extra=require(_0xc2d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc2d8('0x5'));var config=require('../../config/environment');var controller=require(_0xc2d8('0x6'));router[_0xc2d8('0x7')]('/',auth[_0xc2d8('0x8')](),controller[_0xc2d8('0x9')]);router[_0xc2d8('0x7')](_0xc2d8('0xa'),controller[_0xc2d8('0xb')]);router[_0xc2d8('0x7')](_0xc2d8('0xc'),controller[_0xc2d8('0xd')]);router['get'](_0xc2d8('0xe'),controller['getLogo']);router[_0xc2d8('0x7')](_0xc2d8('0xf'),controller[_0xc2d8('0x10')]);router[_0xc2d8('0x7')](_0xc2d8('0x11'),controller[_0xc2d8('0x12')]);router[_0xc2d8('0x7')]('/:id/preferred',controller[_0xc2d8('0x13')]);router[_0xc2d8('0x7')](_0xc2d8('0x14'),controller[_0xc2d8('0x15')]);var upload=multer({'storage':multer[_0xc2d8('0x16')]({'destination':function(_0x45bdda,_0x250492,_0x2adbf4){_0x2adbf4(null,path[_0xc2d8('0x17')](config[_0xc2d8('0x18')],_0xc2d8('0x19')));},'filename':function(_0x3fee63,_0x53811,_0x121570){_0x121570(null,util['format'](_0xc2d8('0x1a'),_0xc2d8('0x1b'),path[_0xc2d8('0x1c')](_0x53811[_0xc2d8('0x1d')])));}})});router['post'](_0xc2d8('0xe'),upload[_0xc2d8('0x1e')](_0xc2d8('0x1f')),controller[_0xc2d8('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53e730,_0x2e487d,_0x4abacb){_0x4abacb(null,path[_0xc2d8('0x17')](config[_0xc2d8('0x18')],_0xc2d8('0x19')));},'filename':function(_0x4896e5,_0xb81d35,_0x115a8b){_0x115a8b(null,util[_0xc2d8('0x21')]('%s%s',_0xc2d8('0x22'),path[_0xc2d8('0x1c')](_0xb81d35[_0xc2d8('0x1d')])));}})});router['post'](_0xc2d8('0xf'),upload[_0xc2d8('0x1e')](_0xc2d8('0x1f')),controller[_0xc2d8('0x23')]);var upload=multer({'storage':multer[_0xc2d8('0x16')]({'destination':function(_0x19f756,_0x37a74e,_0x30b9bc){_0x30b9bc(null,path['join'](config[_0xc2d8('0x18')],_0xc2d8('0x19')));},'filename':function(_0x5ec864,_0xa27c65,_0x189cf6){_0x189cf6(null,util[_0xc2d8('0x21')](_0xc2d8('0x1a'),_0xc2d8('0x24'),path[_0xc2d8('0x1c')](_0xa27c65[_0xc2d8('0x1d')])));}})});router[_0xc2d8('0x25')](_0xc2d8('0x26'),upload[_0xc2d8('0x1e')](_0xc2d8('0x1f')),controller[_0xc2d8('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d6f6d,_0x5f4288,_0x3fe773){_0x3fe773(null,path['join'](config['root'],_0xc2d8('0x19')));},'filename':function(_0x1b812e,_0x11406a,_0xcb9f1a){_0xcb9f1a(null,util[_0xc2d8('0x21')](_0xc2d8('0x1a'),_0xc2d8('0x28'),path['extname'](_0x11406a[_0xc2d8('0x1d')])));}})});router[_0xc2d8('0x25')](_0xc2d8('0x14'),upload['single'](_0xc2d8('0x1f')),controller[_0xc2d8('0x29')]);router[_0xc2d8('0x2a')](_0xc2d8('0xc'),auth[_0xc2d8('0x8')](),controller[_0xc2d8('0x2b')]);module[_0xc2d8('0x2c')]=router; \ No newline at end of file +var _0x7ad3=['/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','logologin','preferred','addPreferred','favicon','addFavicon','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','getDate','/:id','show'];(function(_0x5c6d51,_0x1855c4){var _0x1b1232=function(_0x58949e){while(--_0x58949e){_0x5c6d51['push'](_0x5c6d51['shift']());}};_0x1b1232(++_0x1855c4);}(_0x7ad3,0x148));var _0x37ad=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x7ad3[_0x55abd9];return _0x3e5669;};'use strict';var multer=require(_0x37ad('0x0'));var util=require(_0x37ad('0x1'));var path=require(_0x37ad('0x2'));var timeout=require(_0x37ad('0x3'));var express=require(_0x37ad('0x4'));var router=express[_0x37ad('0x5')]();var fs_extra=require(_0x37ad('0x6'));var auth=require(_0x37ad('0x7'));var interaction=require(_0x37ad('0x8'));var config=require(_0x37ad('0x9'));var controller=require(_0x37ad('0xa'));router[_0x37ad('0xb')]('/',auth[_0x37ad('0xc')](),controller['index']);router[_0x37ad('0xb')]('/now',controller[_0x37ad('0xd')]);router[_0x37ad('0xb')](_0x37ad('0xe'),controller[_0x37ad('0xf')]);router[_0x37ad('0xb')](_0x37ad('0x10'),controller['getLogo']);router['get'](_0x37ad('0x11'),controller[_0x37ad('0x12')]);router[_0x37ad('0xb')](_0x37ad('0x13'),controller[_0x37ad('0x14')]);router[_0x37ad('0xb')](_0x37ad('0x15'),controller[_0x37ad('0x16')]);router['get'](_0x37ad('0x17'),controller[_0x37ad('0x18')]);var upload=multer({'storage':multer[_0x37ad('0x19')]({'destination':function(_0x55f918,_0x21ab42,_0x580776){_0x580776(null,path[_0x37ad('0x1a')](config[_0x37ad('0x1b')],_0x37ad('0x1c')));},'filename':function(_0x1b5d20,_0x2069e1,_0x2fac3e){_0x2fac3e(null,util[_0x37ad('0x1d')](_0x37ad('0x1e'),_0x37ad('0x1f'),path[_0x37ad('0x20')](_0x2069e1['originalname'])));}})});router[_0x37ad('0x21')](_0x37ad('0x10'),upload[_0x37ad('0x22')](_0x37ad('0x23')),controller[_0x37ad('0x24')]);var upload=multer({'storage':multer[_0x37ad('0x19')]({'destination':function(_0x18d936,_0x4d73d1,_0x59f28a){_0x59f28a(null,path['join'](config[_0x37ad('0x1b')],_0x37ad('0x1c')));},'filename':function(_0x32b30c,_0x466e1e,_0x273c6b){_0x273c6b(null,util['format'](_0x37ad('0x1e'),_0x37ad('0x25'),path[_0x37ad('0x20')](_0x466e1e['originalname'])));}})});router[_0x37ad('0x21')](_0x37ad('0x11'),upload['single'](_0x37ad('0x23')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x37ad('0x19')]({'destination':function(_0x4d35fc,_0x2fd0ad,_0x321062){_0x321062(null,path[_0x37ad('0x1a')](config[_0x37ad('0x1b')],_0x37ad('0x1c')));},'filename':function(_0x342aec,_0x2b748b,_0x12a6c9){_0x12a6c9(null,util[_0x37ad('0x1d')](_0x37ad('0x1e'),_0x37ad('0x26'),path['extname'](_0x2b748b['originalname'])));}})});router[_0x37ad('0x21')](_0x37ad('0x15'),upload[_0x37ad('0x22')]('file'),controller[_0x37ad('0x27')]);var upload=multer({'storage':multer[_0x37ad('0x19')]({'destination':function(_0x2742d3,_0x4bc7e8,_0x55109b){_0x55109b(null,path[_0x37ad('0x1a')](config[_0x37ad('0x1b')],_0x37ad('0x1c')));},'filename':function(_0xb0749d,_0x3fa6d5,_0x4fc941){_0x4fc941(null,util[_0x37ad('0x1d')]('%s%s',_0x37ad('0x28'),path['extname'](_0x3fa6d5['originalname'])));}})});router[_0x37ad('0x21')]('/:id/favicon',upload[_0x37ad('0x22')]('file'),controller[_0x37ad('0x29')]);router[_0x37ad('0x2a')](_0x37ad('0xe'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index bf04352..dee4a55 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(_0x40ead5,_0x2acc4f){var _0x1d951a=function(_0xcd366f){while(--_0xcd366f){_0x40ead5['push'](_0x40ead5['shift']());}};_0x1d951a(++_0x2acc4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x3c11e7,_0x4953ec){var _0x2efad7=function(_0x43d390){while(--_0x43d390){_0x3c11e7['push'](_0x3c11e7['shift']());}};_0x2efad7(++_0x4953ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 2736401..e86fe59 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 _0xf128=['default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','../../config/license/util','getLogoLogin','preferred','defaultLoginLogo','default_loginLogo.svg','ValidationError','download','gdpr','securePassword','addPreferred','defaultFavicon','default_preferred.png','custom','addFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','stack','name','index','Setting','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','filters','find','body','addLogo','file','filename','logo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLogo','defaultPreferred','existsSync','join','root','toLower'];(function(_0x2c8be2,_0x16dc35){var _0x4543fa=function(_0x2b7d24){while(--_0x2b7d24){_0x2c8be2['push'](_0x2c8be2['shift']());}};_0x4543fa(++_0x16dc35);}(_0xf128,0x109));var _0x8f12=function(_0x3b204d,_0x2868c6){_0x3b204d=_0x3b204d-0x0;var _0x31c4dd=_0xf128[_0x3b204d];return _0x31c4dd;};'use strict';var emlformat=require(_0x8f12('0x0'));var rimraf=require(_0x8f12('0x1'));var zipdir=require(_0x8f12('0x2'));var jsonpatch=require(_0x8f12('0x3'));var rp=require(_0x8f12('0x4'));var moment=require(_0x8f12('0x5'));var BPromise=require(_0x8f12('0x6'));var Mustache=require(_0x8f12('0x7'));var util=require('util');var path=require(_0x8f12('0x8'));var sox=require(_0x8f12('0x9'));var csv=require(_0x8f12('0xa'));var ejs=require(_0x8f12('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f12('0xc'));var squel=require(_0x8f12('0xd'));var crypto=require(_0x8f12('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8f12('0xf'));var toCsv=require(_0x8f12('0xa'));var querystring=require(_0x8f12('0x10'));var Papa=require(_0x8f12('0x11'));var Redis=require('ioredis');var authService=require(_0x8f12('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f12('0x13'));var logger=require(_0x8f12('0x14'))('api');var utils=require(_0x8f12('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8f12('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8f12('0x17')][_0x8f12('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3dbe3d,_0x19d420,_0x1dfcf8,_0x110319){return new BPromise(function(_0x43c084,_0x4ef551){var _0x40183f=_0x110319||client;return _0x40183f[_0x8f12('0x19')](_0x3dbe3d,_0x1dfcf8)[_0x8f12('0x1a')](function(_0x9d15ec){logger[_0x8f12('0x1b')](_0x8f12('0x1c'),_0x19d420,_0x8f12('0x1d'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x19d420,_0x8f12('0x1d'),JSON[_0x8f12('0x1e')](_0x9d15ec));if(_0x9d15ec[_0x8f12('0x1f')]){if(_0x9d15ec['error']['code']===0x1f4){logger[_0x8f12('0x1f')](_0x8f12('0x1c'),_0x19d420,_0x9d15ec[_0x8f12('0x1f')][_0x8f12('0x20')]);return _0x4ef551(_0x9d15ec[_0x8f12('0x1f')][_0x8f12('0x20')]);}logger[_0x8f12('0x1f')](_0x8f12('0x1c'),_0x19d420,_0x9d15ec[_0x8f12('0x1f')]['message']);return _0x43c084(_0x9d15ec[_0x8f12('0x1f')][_0x8f12('0x20')]);}else{logger[_0x8f12('0x1b')](_0x8f12('0x1c'),_0x19d420,_0x8f12('0x1d'));_0x43c084(_0x9d15ec[_0x8f12('0x21')][_0x8f12('0x20')]);}})[_0x8f12('0x22')](function(_0x242472){logger[_0x8f12('0x1f')](_0x8f12('0x1c'),_0x19d420,_0x242472);_0x4ef551(_0x242472);});});}function respondWithStatusCode(_0x29b9d9,_0xc8304c){_0xc8304c=_0xc8304c||0xcc;return function(_0x35f3bd){if(_0x35f3bd){return _0x29b9d9[_0x8f12('0x23')](_0xc8304c);}return _0x29b9d9[_0x8f12('0x24')](_0xc8304c)[_0x8f12('0x25')]();};}function respondWithResult(_0x3c8017,_0x3b07a2){_0x3b07a2=_0x3b07a2||0xc8;return function(_0x47c8b0){if(_0x47c8b0){return _0x3c8017['status'](_0x3b07a2)[_0x8f12('0x26')](_0x47c8b0);}};}function respondWithFilteredResult(_0x3cb339,_0x473dce){return function(_0x5906c8){if(_0x5906c8){var _0x525d48=typeof _0x473dce['offset']===_0x8f12('0x27')&&typeof _0x473dce[_0x8f12('0x28')]===_0x8f12('0x27');var _0x36f299=_0x5906c8['count'];var _0x555fd3=_0x525d48?0x0:_0x473dce[_0x8f12('0x29')];var _0x3687fc=_0x525d48?_0x5906c8[_0x8f12('0x2a')]:_0x473dce[_0x8f12('0x29')]+_0x473dce['limit'];var _0x42b9f3;if(_0x3687fc>=_0x36f299){_0x3687fc=_0x36f299;_0x42b9f3=0xc8;}else{_0x42b9f3=0xce;}_0x3cb339[_0x8f12('0x24')](_0x42b9f3);return _0x3cb339[_0x8f12('0x2b')](_0x8f12('0x2c'),_0x555fd3+'-'+_0x3687fc+'/'+_0x36f299)[_0x8f12('0x26')](_0x5906c8);}return null;};}function patchUpdates(_0xf04aff){return function(_0x534861){try{jsonpatch[_0x8f12('0x2d')](_0x534861,_0xf04aff,!![]);}catch(_0x16f0ee){return BPromise['reject'](_0x16f0ee);}return _0x534861[_0x8f12('0x2e')]();};}function saveUpdates(_0x309144,_0x2dbeca){return function(_0x14718b){if(_0x14718b){return _0x14718b[_0x8f12('0x2f')](_0x309144)['then'](function(_0x350663){return _0x350663;});}return null;};}function removeEntity(_0x39dd10,_0x5b5beb){return function(_0x173ad1){if(_0x173ad1){return _0x173ad1[_0x8f12('0x30')]()[_0x8f12('0x1a')](function(){_0x39dd10[_0x8f12('0x24')](0xcc)[_0x8f12('0x25')]();});}};}function handleEntityNotFound(_0x5eed39,_0x889fc1){return function(_0x4bd376){if(!_0x4bd376){_0x5eed39[_0x8f12('0x23')](0x194);}return _0x4bd376;};}function handleError(_0x59c4a5,_0x35411f){_0x35411f=_0x35411f||0x1f4;return function(_0x4071fd){logger[_0x8f12('0x1f')](_0x4071fd[_0x8f12('0x31')]);if(_0x4071fd[_0x8f12('0x32')]){delete _0x4071fd[_0x8f12('0x32')];}_0x59c4a5[_0x8f12('0x24')](_0x35411f)['send'](_0x4071fd);};}exports[_0x8f12('0x33')]=function(_0x3cf68a,_0x192872){var _0x402df2={},_0x2aab20={},_0x6e49ec={'count':0x0,'rows':[]};var _0x1f995c=_['map'](db[_0x8f12('0x34')][_0x8f12('0x35')],function(_0x598487){return{'name':_0x598487[_0x8f12('0x36')],'type':_0x598487[_0x8f12('0x37')][_0x8f12('0x38')]};});_0x2aab20[_0x8f12('0x39')]=_[_0x8f12('0x3a')](_0x1f995c,'name');_0x2aab20[_0x8f12('0x3b')]=_['keys'](_0x3cf68a['query']);_0x2aab20['filters']=_[_0x8f12('0x3c')](_0x2aab20[_0x8f12('0x39')],_0x2aab20[_0x8f12('0x3b')]);_0x402df2[_0x8f12('0x3d')]=_['intersection'](_0x2aab20['model'],qs['fields'](_0x3cf68a['query'][_0x8f12('0x3e')]));_0x402df2[_0x8f12('0x3d')]=_0x402df2['attributes'][_0x8f12('0x3f')]?_0x402df2['attributes']:_0x2aab20['model'];if(!_0x3cf68a[_0x8f12('0x3b')]['hasOwnProperty'](_0x8f12('0x40'))){_0x402df2['limit']=qs[_0x8f12('0x28')](_0x3cf68a[_0x8f12('0x3b')][_0x8f12('0x28')]);_0x402df2[_0x8f12('0x29')]=qs[_0x8f12('0x29')](_0x3cf68a[_0x8f12('0x3b')][_0x8f12('0x29')]);}_0x402df2['order']=qs[_0x8f12('0x41')](_0x3cf68a[_0x8f12('0x3b')][_0x8f12('0x41')]);_0x402df2['where']=qs['filters'](_[_0x8f12('0x42')](_0x3cf68a[_0x8f12('0x3b')],_0x2aab20['filters']),_0x1f995c);if(_0x3cf68a[_0x8f12('0x3b')][_0x8f12('0x43')]){_0x402df2[_0x8f12('0x44')]=_[_0x8f12('0x45')](_0x402df2[_0x8f12('0x44')],{'$or':_[_0x8f12('0x3a')](_0x1f995c,function(_0x2a7ba4){if(_0x2a7ba4[_0x8f12('0x37')]!=='VIRTUAL'){var _0x4ac607={};_0x4ac607[_0x2a7ba4[_0x8f12('0x32')]]={'$like':'%'+_0x3cf68a[_0x8f12('0x3b')][_0x8f12('0x43')]+'%'};return _0x4ac607;}})});}_0x402df2=_['merge']({},_0x402df2,_0x3cf68a[_0x8f12('0x46')]);var _0x74cdc={'where':_0x402df2[_0x8f12('0x44')]};return db[_0x8f12('0x34')][_0x8f12('0x2a')](_0x74cdc)[_0x8f12('0x1a')](function(_0x16c229){_0x6e49ec[_0x8f12('0x2a')]=_0x16c229;if(_0x3cf68a[_0x8f12('0x3b')][_0x8f12('0x47')]){_0x402df2[_0x8f12('0x48')]=[{'all':!![]}];}return db[_0x8f12('0x34')][_0x8f12('0x49')](_0x402df2);})[_0x8f12('0x1a')](function(_0xffd297){_0x6e49ec[_0x8f12('0x4a')]=_0xffd297;return _0x6e49ec;})[_0x8f12('0x1a')](respondWithFilteredResult(_0x192872,_0x402df2))[_0x8f12('0x22')](handleError(_0x192872,null));};exports[_0x8f12('0x4b')]=function(_0x5d982a,_0x6793ff){var _0x4c1056={'raw':![],'where':{'id':_0x5d982a[_0x8f12('0x4c')]['id']}},_0x248422={};_0x248422[_0x8f12('0x39')]=_[_0x8f12('0x4d')](db[_0x8f12('0x34')][_0x8f12('0x35')]);_0x248422[_0x8f12('0x3b')]=_[_0x8f12('0x4d')](_0x5d982a[_0x8f12('0x3b')]);_0x248422[_0x8f12('0x4e')]=_[_0x8f12('0x3c')](_0x248422[_0x8f12('0x39')],_0x248422[_0x8f12('0x3b')]);_0x4c1056[_0x8f12('0x3d')]=_[_0x8f12('0x3c')](_0x248422[_0x8f12('0x39')],qs[_0x8f12('0x3e')](_0x5d982a[_0x8f12('0x3b')][_0x8f12('0x3e')]));_0x4c1056[_0x8f12('0x3d')]=_0x4c1056[_0x8f12('0x3d')][_0x8f12('0x3f')]?_0x4c1056[_0x8f12('0x3d')]:_0x248422['model'];if(_0x5d982a['query'][_0x8f12('0x47')]){_0x4c1056[_0x8f12('0x48')]=[{'all':!![]}];}_0x4c1056=_[_0x8f12('0x45')]({},_0x4c1056,_0x5d982a[_0x8f12('0x46')]);return db['Setting'][_0x8f12('0x4f')](_0x4c1056)[_0x8f12('0x1a')](handleEntityNotFound(_0x6793ff,null))[_0x8f12('0x1a')](respondWithResult(_0x6793ff,null))[_0x8f12('0x22')](handleError(_0x6793ff,null));};exports[_0x8f12('0x2f')]=function(_0x5c592a,_0x578c8a){if(_0x5c592a[_0x8f12('0x50')]['id']){delete _0x5c592a[_0x8f12('0x50')]['id'];}return db[_0x8f12('0x34')][_0x8f12('0x4f')]({'where':{'id':_0x5c592a[_0x8f12('0x4c')]['id']}})[_0x8f12('0x1a')](handleEntityNotFound(_0x578c8a,null))['then'](saveUpdates(_0x5c592a['body'],null))[_0x8f12('0x1a')](respondWithResult(_0x578c8a,null))[_0x8f12('0x22')](handleError(_0x578c8a,null));};exports[_0x8f12('0x51')]=function(_0x3d5f8e,_0x5dbd6a,_0x5a5ac1){if(_0x3d5f8e[_0x8f12('0x52')]&&_0x3d5f8e[_0x8f12('0x52')][_0x8f12('0x53')]){_0x3d5f8e[_0x8f12('0x50')][_0x8f12('0x54')]=_0x3d5f8e[_0x8f12('0x52')]['filename'];}return db[_0x8f12('0x34')]['find']({'where':{'id':_0x3d5f8e[_0x8f12('0x4c')]['id']}})[_0x8f12('0x1a')](handleEntityNotFound(_0x5dbd6a,null))['then'](saveUpdates(_0x3d5f8e['body'],null))[_0x8f12('0x1a')](respondWithResult(_0x5dbd6a,null))[_0x8f12('0x22')](handleError(_0x5dbd6a,null));};exports['addLogoLogin']=function(_0x2de28,_0x31f4ad,_0x254dec){if(_0x2de28[_0x8f12('0x52')]&&_0x2de28[_0x8f12('0x52')]['filename']){_0x2de28[_0x8f12('0x50')]['loginLogo']=_0x2de28[_0x8f12('0x52')][_0x8f12('0x53')];}return db[_0x8f12('0x34')]['find']({'where':{'id':_0x2de28[_0x8f12('0x4c')]['id']}})[_0x8f12('0x1a')](handleEntityNotFound(_0x31f4ad,null))[_0x8f12('0x1a')](saveUpdates(_0x2de28['body'],null))[_0x8f12('0x1a')](respondWithResult(_0x31f4ad,null))['catch'](handleError(_0x31f4ad,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x1cbd89,_0x42cd00,_0x19cffe){var _0x103d62=_0x8f12('0x55');var _0x3b80ee={'custom':![]};return utilLicense[_0x8f12('0x56')]()[_0x8f12('0x1a')](function(_0x197044){if(_0x197044){_0x3b80ee=_0x197044;}return db[_0x8f12('0x34')][_0x8f12('0x4f')]({'where':{'id':_0x1cbd89[_0x8f12('0x4c')]['id']},'attributes':[_0x8f12('0x54'),_0x8f12('0x57'),'preferred',_0x8f12('0x58'),_0x8f12('0x59'),'defaultLoginLogo',_0x8f12('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x8f12('0x1a')](handleEntityNotFound(_0x42cd00,null))[_0x8f12('0x1a')](function(_0x9c51a4){if(_0x9c51a4){var _0x2502d5=_0x9c51a4[_0x8f12('0x54')]&&fs[_0x8f12('0x5b')](path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x103d62,_[_0x8f12('0x5e')](_0x9c51a4[_0x8f12('0x54')])))?path[_0x8f12('0x5c')](config['root'],_0x103d62,_['toLower'](_0x9c51a4[_0x8f12('0x54')])):path['join'](config[_0x8f12('0x5d')],_0x103d62,_[_0x8f12('0x5e')](_0x8f12('0x5f')));var _0x1a54e8=_0x8f12('0x60')+_[_0x8f12('0x61')](_0x8f12('0x54'));if(_0x9c51a4[_0x1a54e8]||!_0x3b80ee['custom']){_0x2502d5=path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x103d62,_['toLower'](_0x8f12('0x5f')));}if(!fs[_0x8f12('0x5b')](_0x2502d5)){throw new db[(_0x8f12('0x62'))]['ValidationError'](_[_0x8f12('0x61')]('logo')+_0x8f12('0x63'));}return _0x42cd00['download'](_0x2502d5);}})[_0x8f12('0x22')](handleError(_0x42cd00,null));};var utilLicense=require(_0x8f12('0x64'));exports[_0x8f12('0x65')]=function(_0x493e15,_0x4ffd1e,_0x21bf88){var _0x16fed5=_0x8f12('0x55');var _0x47c344={'custom':![]};return utilLicense[_0x8f12('0x56')]()['then'](function(_0x458e65){if(_0x458e65){_0x47c344=_0x458e65;}return db[_0x8f12('0x34')][_0x8f12('0x4f')]({'where':{'id':_0x493e15[_0x8f12('0x4c')]['id']},'attributes':['logo',_0x8f12('0x57'),_0x8f12('0x66'),'favicon',_0x8f12('0x59'),_0x8f12('0x67'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x8f12('0x1a')](handleEntityNotFound(_0x4ffd1e,null))[_0x8f12('0x1a')](function(_0x4ce226){if(_0x4ce226){var _0x188830=_0x4ce226[_0x8f12('0x57')]&&fs[_0x8f12('0x5b')](path[_0x8f12('0x5c')](config['root'],_0x16fed5,_['toLower'](_0x4ce226[_0x8f12('0x57')])))?path[_0x8f12('0x5c')](config['root'],_0x16fed5,_[_0x8f12('0x5e')](_0x4ce226['loginLogo'])):path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x16fed5,_['toLower'](_0x8f12('0x68')));var _0xa098fc=_0x8f12('0x60')+_[_0x8f12('0x61')](_0x8f12('0x57'));if(_0x4ce226[_0xa098fc]||!_0x47c344['custom']){_0x188830=path[_0x8f12('0x5c')](config['root'],_0x16fed5,_[_0x8f12('0x5e')](_0x8f12('0x68')));}if(!fs[_0x8f12('0x5b')](_0x188830)){throw new db[(_0x8f12('0x62'))][(_0x8f12('0x69'))](_[_0x8f12('0x61')](_0x8f12('0x57'))+_0x8f12('0x63'));}return _0x4ffd1e[_0x8f12('0x6a')](_0x188830);}})['catch'](handleError(_0x4ffd1e,null));};exports[_0x8f12('0x6b')]=function(_0x53a405,_0x3b9f65){return db[_0x8f12('0x34')][_0x8f12('0x4f')]({'where':{'id':_0x53a405[_0x8f12('0x4c')]['id']},'attributes':[_0x8f12('0x6c')]})[_0x8f12('0x1a')](respondWithResult(_0x3b9f65,null))[_0x8f12('0x22')](handleError(_0x3b9f65,null));};exports[_0x8f12('0x6d')]=function(_0x272fd1,_0x4dcdde,_0x4a8715){if(_0x272fd1[_0x8f12('0x52')]&&_0x272fd1[_0x8f12('0x52')][_0x8f12('0x53')]){_0x272fd1[_0x8f12('0x50')][_0x8f12('0x66')]=_0x272fd1[_0x8f12('0x52')][_0x8f12('0x53')];}return db[_0x8f12('0x34')]['find']({'where':{'id':_0x272fd1[_0x8f12('0x4c')]['id']}})[_0x8f12('0x1a')](handleEntityNotFound(_0x4dcdde,null))['then'](saveUpdates(_0x272fd1[_0x8f12('0x50')],null))[_0x8f12('0x1a')](respondWithResult(_0x4dcdde,null))[_0x8f12('0x22')](handleError(_0x4dcdde,null));};var utilLicense=require(_0x8f12('0x64'));exports['getPreferred']=function(_0x16465b,_0x29473f,_0x307f1c){var _0x156cba=_0x8f12('0x55');var _0x30bdf8={'custom':![]};return utilLicense[_0x8f12('0x56')]()[_0x8f12('0x1a')](function(_0x511f34){if(_0x511f34){_0x30bdf8=_0x511f34;}return db[_0x8f12('0x34')][_0x8f12('0x4f')]({'where':{'id':_0x16465b[_0x8f12('0x4c')]['id']},'attributes':['logo','loginLogo',_0x8f12('0x66'),'favicon',_0x8f12('0x59'),_0x8f12('0x67'),_0x8f12('0x5a'),_0x8f12('0x6e')],'raw':!![]});})[_0x8f12('0x1a')](handleEntityNotFound(_0x29473f,null))[_0x8f12('0x1a')](function(_0x978894){if(_0x978894){var _0x402193=_0x978894[_0x8f12('0x66')]&&fs[_0x8f12('0x5b')](path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x156cba,_[_0x8f12('0x5e')](_0x978894[_0x8f12('0x66')])))?path['join'](config[_0x8f12('0x5d')],_0x156cba,_[_0x8f12('0x5e')](_0x978894['preferred'])):path['join'](config['root'],_0x156cba,_[_0x8f12('0x5e')](_0x8f12('0x6f')));var _0x396d7b=_0x8f12('0x60')+_[_0x8f12('0x61')](_0x8f12('0x66'));if(_0x978894[_0x396d7b]||!_0x30bdf8[_0x8f12('0x70')]||!_0x30bdf8[_0x8f12('0x66')]){_0x402193=path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x156cba,_['toLower'](_0x8f12('0x6f')));}if(!fs['existsSync'](_0x402193)){throw new db[(_0x8f12('0x62'))][(_0x8f12('0x69'))](_[_0x8f12('0x61')](_0x8f12('0x66'))+_0x8f12('0x63'));}return _0x29473f[_0x8f12('0x6a')](_0x402193);}})['catch'](handleError(_0x29473f,null));};exports[_0x8f12('0x71')]=function(_0x58c58a,_0xcfc469,_0x212a1f){if(_0x58c58a[_0x8f12('0x52')]&&_0x58c58a[_0x8f12('0x52')][_0x8f12('0x53')]){_0x58c58a[_0x8f12('0x50')]['favicon']=_0x58c58a['file'][_0x8f12('0x53')];}return db[_0x8f12('0x34')][_0x8f12('0x4f')]({'where':{'id':_0x58c58a[_0x8f12('0x4c')]['id']}})[_0x8f12('0x1a')](handleEntityNotFound(_0xcfc469,null))['then'](saveUpdates(_0x58c58a[_0x8f12('0x50')],null))[_0x8f12('0x1a')](respondWithResult(_0xcfc469,null))[_0x8f12('0x22')](handleError(_0xcfc469,null));};var utilLicense=require(_0x8f12('0x64'));exports['getFavicon']=function(_0x1ca0e8,_0x28040b,_0x53267a){var _0x2cf07c=_0x8f12('0x55');var _0x2fc83a={'custom':![]};return utilLicense[_0x8f12('0x56')]()[_0x8f12('0x1a')](function(_0x230391){if(_0x230391){_0x2fc83a=_0x230391;}return db['Setting'][_0x8f12('0x4f')]({'where':{'id':_0x1ca0e8['params']['id']},'attributes':[_0x8f12('0x54'),'loginLogo',_0x8f12('0x66'),_0x8f12('0x58'),_0x8f12('0x59'),_0x8f12('0x67'),_0x8f12('0x5a'),_0x8f12('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x28040b,null))[_0x8f12('0x1a')](function(_0x34fd1b){if(_0x34fd1b){var _0x4397d0=_0x34fd1b[_0x8f12('0x58')]&&fs[_0x8f12('0x5b')](path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x2cf07c,_[_0x8f12('0x5e')](_0x34fd1b[_0x8f12('0x58')])))?path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x2cf07c,_[_0x8f12('0x5e')](_0x34fd1b['favicon'])):path[_0x8f12('0x5c')](config['root'],_0x2cf07c,_[_0x8f12('0x5e')]('default_favicon.ico'));var _0x382624='default'+_[_0x8f12('0x61')]('favicon');if(_0x34fd1b[_0x382624]||!_0x2fc83a[_0x8f12('0x70')]){_0x4397d0=path[_0x8f12('0x5c')](config[_0x8f12('0x5d')],_0x2cf07c,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x4397d0)){throw new db[(_0x8f12('0x62'))][(_0x8f12('0x69'))](_[_0x8f12('0x61')](_0x8f12('0x58'))+_0x8f12('0x63'));}return _0x28040b[_0x8f12('0x6a')](_0x4397d0);}})[_0x8f12('0x22')](handleError(_0x28040b,null));};exports[_0x8f12('0x72')]=function(_0x43ba3e,_0x5d1a47){var _0x4b605f={'offset':moment()['utcOffset']()};_0x4b605f[_0x8f12('0x73')]=moment()[_0x8f12('0x74')](_0x4b605f[_0x8f12('0x29')])[_0x8f12('0x75')](_0x8f12('0x76'));return _0x5d1a47[_0x8f12('0x24')](0xc8)[_0x8f12('0x77')](_0x4b605f);}; \ No newline at end of file +var _0x16e4=['getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','ValidationError','gdpr','securePassword','getPreferred','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','Setting','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','findAll','params','keys','rawAttributes','length','include','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x16e4,0x97));var _0x416e=function(_0x464f02,_0x42ceb3){_0x464f02=_0x464f02-0x0;var _0x1491be=_0x16e4[_0x464f02];return _0x1491be;};'use strict';var emlformat=require(_0x416e('0x0'));var rimraf=require(_0x416e('0x1'));var zipdir=require(_0x416e('0x2'));var jsonpatch=require(_0x416e('0x3'));var rp=require(_0x416e('0x4'));var moment=require(_0x416e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x416e('0x6'));var util=require('util');var path=require(_0x416e('0x7'));var sox=require(_0x416e('0x8'));var csv=require('to-csv');var ejs=require(_0x416e('0x9'));var fs=require('fs');var fs_extra=require(_0x416e('0xa'));var _=require(_0x416e('0xb'));var squel=require(_0x416e('0xc'));var crypto=require(_0x416e('0xd'));var jsforce=require(_0x416e('0xe'));var deskjs=require(_0x416e('0xf'));var toCsv=require(_0x416e('0x10'));var querystring=require(_0x416e('0x11'));var Papa=require('papaparse');var Redis=require(_0x416e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x416e('0x13'));var as=require(_0x416e('0x14'));var hardwareService=require(_0x416e('0x15'));var logger=require('../../config/logger')(_0x416e('0x16'));var utils=require(_0x416e('0x17'));var config=require(_0x416e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x416e('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x416e('0x1a')][_0x416e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2221ca,_0x6a28c9,_0x507d36,_0x2684d0){return new BPromise(function(_0x457e49,_0x30b23f){var _0x1188de=_0x2684d0||client;return _0x1188de[_0x416e('0x1c')](_0x2221ca,_0x507d36)[_0x416e('0x1d')](function(_0x30ead5){logger[_0x416e('0x1e')](_0x416e('0x1f'),_0x6a28c9,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x6a28c9,_0x416e('0x20'),JSON[_0x416e('0x21')](_0x30ead5));if(_0x30ead5[_0x416e('0x22')]){if(_0x30ead5[_0x416e('0x22')]['code']===0x1f4){logger[_0x416e('0x22')](_0x416e('0x1f'),_0x6a28c9,_0x30ead5['error'][_0x416e('0x23')]);return _0x30b23f(_0x30ead5[_0x416e('0x22')][_0x416e('0x23')]);}logger[_0x416e('0x22')](_0x416e('0x1f'),_0x6a28c9,_0x30ead5[_0x416e('0x22')][_0x416e('0x23')]);return _0x457e49(_0x30ead5[_0x416e('0x22')][_0x416e('0x23')]);}else{logger[_0x416e('0x1e')](_0x416e('0x1f'),_0x6a28c9,'request\x20sent');_0x457e49(_0x30ead5[_0x416e('0x24')][_0x416e('0x23')]);}})[_0x416e('0x25')](function(_0x41e5e8){logger[_0x416e('0x22')](_0x416e('0x1f'),_0x6a28c9,_0x41e5e8);_0x30b23f(_0x41e5e8);});});}function respondWithStatusCode(_0x4a2e9c,_0x25070a){_0x25070a=_0x25070a||0xcc;return function(_0x3bbbad){if(_0x3bbbad){return _0x4a2e9c[_0x416e('0x26')](_0x25070a);}return _0x4a2e9c['status'](_0x25070a)[_0x416e('0x27')]();};}function respondWithResult(_0x11af15,_0x47679a){_0x47679a=_0x47679a||0xc8;return function(_0x6cb20a){if(_0x6cb20a){return _0x11af15['status'](_0x47679a)[_0x416e('0x28')](_0x6cb20a);}};}function respondWithFilteredResult(_0x3fa936,_0x3ab2fd){return function(_0x21bc79){if(_0x21bc79){var _0x3b3487=typeof _0x3ab2fd[_0x416e('0x29')]===_0x416e('0x2a')&&typeof _0x3ab2fd[_0x416e('0x2b')]===_0x416e('0x2a');var _0x58a6d8=_0x21bc79[_0x416e('0x2c')];var _0x21fd79=_0x3b3487?0x0:_0x3ab2fd[_0x416e('0x29')];var _0x12fa28=_0x3b3487?_0x21bc79[_0x416e('0x2c')]:_0x3ab2fd[_0x416e('0x29')]+_0x3ab2fd[_0x416e('0x2b')];var _0x5c4b5d;if(_0x12fa28>=_0x58a6d8){_0x12fa28=_0x58a6d8;_0x5c4b5d=0xc8;}else{_0x5c4b5d=0xce;}_0x3fa936[_0x416e('0x2d')](_0x5c4b5d);return _0x3fa936[_0x416e('0x2e')](_0x416e('0x2f'),_0x21fd79+'-'+_0x12fa28+'/'+_0x58a6d8)['json'](_0x21bc79);}return null;};}function patchUpdates(_0x429f9a){return function(_0x1c0888){try{jsonpatch[_0x416e('0x30')](_0x1c0888,_0x429f9a,!![]);}catch(_0x310702){return BPromise[_0x416e('0x31')](_0x310702);}return _0x1c0888[_0x416e('0x32')]();};}function saveUpdates(_0x3541b2,_0x231847){return function(_0x253b81){if(_0x253b81){return _0x253b81[_0x416e('0x33')](_0x3541b2)['then'](function(_0xf5add1){return _0xf5add1;});}return null;};}function removeEntity(_0xa1616b,_0x138ac7){return function(_0x5ddac6){if(_0x5ddac6){return _0x5ddac6[_0x416e('0x34')]()[_0x416e('0x1d')](function(){_0xa1616b[_0x416e('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x131774,_0x150bf4){return function(_0x4ee490){if(!_0x4ee490){_0x131774[_0x416e('0x26')](0x194);}return _0x4ee490;};}function handleError(_0x5abc31,_0x56cf77){_0x56cf77=_0x56cf77||0x1f4;return function(_0x76fcaf){logger[_0x416e('0x22')](_0x76fcaf[_0x416e('0x35')]);if(_0x76fcaf[_0x416e('0x36')]){delete _0x76fcaf[_0x416e('0x36')];}_0x5abc31[_0x416e('0x2d')](_0x56cf77)[_0x416e('0x37')](_0x76fcaf);};}exports[_0x416e('0x38')]=function(_0x2ead66,_0x48225f){var _0x243911={},_0x4f5f7a={},_0x624e1e={'count':0x0,'rows':[]};var _0x291e08=_['map'](db[_0x416e('0x39')]['rawAttributes'],function(_0x1bab49){return{'name':_0x1bab49[_0x416e('0x3a')],'type':_0x1bab49['type'][_0x416e('0x3b')]};});_0x4f5f7a[_0x416e('0x3c')]=_[_0x416e('0x3d')](_0x291e08,'name');_0x4f5f7a['query']=_['keys'](_0x2ead66[_0x416e('0x3e')]);_0x4f5f7a[_0x416e('0x3f')]=_[_0x416e('0x40')](_0x4f5f7a[_0x416e('0x3c')],_0x4f5f7a[_0x416e('0x3e')]);_0x243911[_0x416e('0x41')]=_[_0x416e('0x40')](_0x4f5f7a[_0x416e('0x3c')],qs[_0x416e('0x42')](_0x2ead66[_0x416e('0x3e')][_0x416e('0x42')]));_0x243911['attributes']=_0x243911[_0x416e('0x41')]['length']?_0x243911['attributes']:_0x4f5f7a[_0x416e('0x3c')];if(!_0x2ead66[_0x416e('0x3e')][_0x416e('0x43')](_0x416e('0x44'))){_0x243911[_0x416e('0x2b')]=qs[_0x416e('0x2b')](_0x2ead66['query']['limit']);_0x243911[_0x416e('0x29')]=qs[_0x416e('0x29')](_0x2ead66['query']['offset']);}_0x243911[_0x416e('0x45')]=qs[_0x416e('0x46')](_0x2ead66[_0x416e('0x3e')][_0x416e('0x46')]);_0x243911[_0x416e('0x47')]=qs[_0x416e('0x3f')](_[_0x416e('0x48')](_0x2ead66[_0x416e('0x3e')],_0x4f5f7a[_0x416e('0x3f')]),_0x291e08);if(_0x2ead66[_0x416e('0x3e')][_0x416e('0x49')]){_0x243911[_0x416e('0x47')]=_[_0x416e('0x4a')](_0x243911[_0x416e('0x47')],{'$or':_['map'](_0x291e08,function(_0x186c8d){if(_0x186c8d[_0x416e('0x4b')]!=='VIRTUAL'){var _0x3abc6a={};_0x3abc6a[_0x186c8d['name']]={'$like':'%'+_0x2ead66[_0x416e('0x3e')]['filter']+'%'};return _0x3abc6a;}})});}_0x243911=_[_0x416e('0x4a')]({},_0x243911,_0x2ead66['options']);var _0x5ac1c6={'where':_0x243911['where']};return db[_0x416e('0x39')][_0x416e('0x2c')](_0x5ac1c6)[_0x416e('0x1d')](function(_0xdcaf55){_0x624e1e[_0x416e('0x2c')]=_0xdcaf55;if(_0x2ead66[_0x416e('0x3e')][_0x416e('0x4c')]){_0x243911['include']=[{'all':!![]}];}return db[_0x416e('0x39')][_0x416e('0x4d')](_0x243911);})['then'](function(_0x29ab79){_0x624e1e['rows']=_0x29ab79;return _0x624e1e;})[_0x416e('0x1d')](respondWithFilteredResult(_0x48225f,_0x243911))[_0x416e('0x25')](handleError(_0x48225f,null));};exports['show']=function(_0x4646a9,_0x4f699c){var _0x51f449={'raw':![],'where':{'id':_0x4646a9[_0x416e('0x4e')]['id']}},_0xd26fd3={};_0xd26fd3[_0x416e('0x3c')]=_[_0x416e('0x4f')](db[_0x416e('0x39')][_0x416e('0x50')]);_0xd26fd3['query']=_[_0x416e('0x4f')](_0x4646a9[_0x416e('0x3e')]);_0xd26fd3[_0x416e('0x3f')]=_['intersection'](_0xd26fd3[_0x416e('0x3c')],_0xd26fd3[_0x416e('0x3e')]);_0x51f449['attributes']=_[_0x416e('0x40')](_0xd26fd3['model'],qs['fields'](_0x4646a9['query'][_0x416e('0x42')]));_0x51f449['attributes']=_0x51f449[_0x416e('0x41')][_0x416e('0x51')]?_0x51f449[_0x416e('0x41')]:_0xd26fd3[_0x416e('0x3c')];if(_0x4646a9[_0x416e('0x3e')]['includeAll']){_0x51f449[_0x416e('0x52')]=[{'all':!![]}];}_0x51f449=_[_0x416e('0x4a')]({},_0x51f449,_0x4646a9[_0x416e('0x53')]);return db[_0x416e('0x39')][_0x416e('0x54')](_0x51f449)['then'](handleEntityNotFound(_0x4f699c,null))[_0x416e('0x1d')](respondWithResult(_0x4f699c,null))[_0x416e('0x25')](handleError(_0x4f699c,null));};exports[_0x416e('0x33')]=function(_0x31126b,_0x33515f){if(_0x31126b[_0x416e('0x55')]['id']){delete _0x31126b[_0x416e('0x55')]['id'];}return db[_0x416e('0x39')][_0x416e('0x54')]({'where':{'id':_0x31126b[_0x416e('0x4e')]['id']}})[_0x416e('0x1d')](handleEntityNotFound(_0x33515f,null))[_0x416e('0x1d')](saveUpdates(_0x31126b[_0x416e('0x55')],null))[_0x416e('0x1d')](respondWithResult(_0x33515f,null))[_0x416e('0x25')](handleError(_0x33515f,null));};exports[_0x416e('0x56')]=function(_0x4acf9c,_0x182c64,_0x46cfaf){if(_0x4acf9c[_0x416e('0x57')]&&_0x4acf9c[_0x416e('0x57')][_0x416e('0x58')]){_0x4acf9c[_0x416e('0x55')][_0x416e('0x59')]=_0x4acf9c['file']['filename'];}return db[_0x416e('0x39')]['find']({'where':{'id':_0x4acf9c[_0x416e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x182c64,null))['then'](saveUpdates(_0x4acf9c[_0x416e('0x55')],null))[_0x416e('0x1d')](respondWithResult(_0x182c64,null))['catch'](handleError(_0x182c64,null));};exports[_0x416e('0x5a')]=function(_0x37c1e9,_0x249750,_0x3d76ac){if(_0x37c1e9['file']&&_0x37c1e9[_0x416e('0x57')][_0x416e('0x58')]){_0x37c1e9['body'][_0x416e('0x5b')]=_0x37c1e9['file']['filename'];}return db[_0x416e('0x39')][_0x416e('0x54')]({'where':{'id':_0x37c1e9[_0x416e('0x4e')]['id']}})[_0x416e('0x1d')](handleEntityNotFound(_0x249750,null))['then'](saveUpdates(_0x37c1e9['body'],null))[_0x416e('0x1d')](respondWithResult(_0x249750,null))['catch'](handleError(_0x249750,null));};var utilLicense=require(_0x416e('0x5c'));exports[_0x416e('0x5d')]=function(_0x483692,_0x438b4d,_0x15f45c){var _0x4bec6b=_0x416e('0x5e');var _0x164316={'custom':![]};return utilLicense[_0x416e('0x5f')]()[_0x416e('0x1d')](function(_0x12be94){if(_0x12be94){_0x164316=_0x12be94;}return db[_0x416e('0x39')]['find']({'where':{'id':_0x483692['params']['id']},'attributes':[_0x416e('0x59'),'loginLogo',_0x416e('0x60'),_0x416e('0x61'),'defaultLogo',_0x416e('0x62'),_0x416e('0x63'),_0x416e('0x64')],'raw':!![]});})[_0x416e('0x1d')](handleEntityNotFound(_0x438b4d,null))[_0x416e('0x1d')](function(_0x41ddfa){if(_0x41ddfa){var _0x325570=_0x41ddfa[_0x416e('0x59')]&&fs[_0x416e('0x65')](path[_0x416e('0x66')](config[_0x416e('0x67')],_0x4bec6b,_[_0x416e('0x68')](_0x41ddfa[_0x416e('0x59')])))?path[_0x416e('0x66')](config['root'],_0x4bec6b,_[_0x416e('0x68')](_0x41ddfa[_0x416e('0x59')])):path[_0x416e('0x66')](config['root'],_0x4bec6b,_['toLower']('default_logo.svg'));var _0x4f9046=_0x416e('0x69')+_[_0x416e('0x6a')]('logo');if(_0x41ddfa[_0x4f9046]||!_0x164316[_0x416e('0x6b')]){_0x325570=path[_0x416e('0x66')](config[_0x416e('0x67')],_0x4bec6b,_[_0x416e('0x68')]('default_logo.svg'));}if(!fs[_0x416e('0x65')](_0x325570)){throw new db[(_0x416e('0x6c'))]['ValidationError'](_[_0x416e('0x6a')](_0x416e('0x59'))+_0x416e('0x6d'));}return _0x438b4d[_0x416e('0x6e')](_0x325570);}})[_0x416e('0x25')](handleError(_0x438b4d,null));};var utilLicense=require(_0x416e('0x5c'));exports[_0x416e('0x6f')]=function(_0x3461d,_0x4bf94e,_0x45ad50){var _0x36c214=_0x416e('0x5e');var _0x458bd7={'custom':![]};return utilLicense[_0x416e('0x5f')]()[_0x416e('0x1d')](function(_0x3e8552){if(_0x3e8552){_0x458bd7=_0x3e8552;}return db[_0x416e('0x39')]['find']({'where':{'id':_0x3461d[_0x416e('0x4e')]['id']},'attributes':[_0x416e('0x59'),_0x416e('0x5b'),_0x416e('0x60'),_0x416e('0x61'),_0x416e('0x70'),'defaultLoginLogo',_0x416e('0x63'),_0x416e('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x4bf94e,null))[_0x416e('0x1d')](function(_0x225016){if(_0x225016){var _0x32a08a=_0x225016[_0x416e('0x5b')]&&fs[_0x416e('0x65')](path['join'](config[_0x416e('0x67')],_0x36c214,_[_0x416e('0x68')](_0x225016[_0x416e('0x5b')])))?path[_0x416e('0x66')](config[_0x416e('0x67')],_0x36c214,_[_0x416e('0x68')](_0x225016[_0x416e('0x5b')])):path[_0x416e('0x66')](config['root'],_0x36c214,_[_0x416e('0x68')](_0x416e('0x71')));var _0x3f45e9=_0x416e('0x69')+_[_0x416e('0x6a')](_0x416e('0x5b'));if(_0x225016[_0x3f45e9]||!_0x458bd7[_0x416e('0x6b')]){_0x32a08a=path[_0x416e('0x66')](config[_0x416e('0x67')],_0x36c214,_['toLower'](_0x416e('0x71')));}if(!fs[_0x416e('0x65')](_0x32a08a)){throw new db[(_0x416e('0x6c'))][(_0x416e('0x72'))](_[_0x416e('0x6a')](_0x416e('0x5b'))+'\x20not\x20found');}return _0x4bf94e[_0x416e('0x6e')](_0x32a08a);}})[_0x416e('0x25')](handleError(_0x4bf94e,null));};exports[_0x416e('0x73')]=function(_0x1069e0,_0xdc5cd5){return db['Setting'][_0x416e('0x54')]({'where':{'id':_0x1069e0[_0x416e('0x4e')]['id']},'attributes':[_0x416e('0x74')]})[_0x416e('0x1d')](respondWithResult(_0xdc5cd5,null))[_0x416e('0x25')](handleError(_0xdc5cd5,null));};exports['addPreferred']=function(_0xa04528,_0x39ca8d,_0x5ada69){if(_0xa04528[_0x416e('0x57')]&&_0xa04528[_0x416e('0x57')][_0x416e('0x58')]){_0xa04528[_0x416e('0x55')]['preferred']=_0xa04528['file'][_0x416e('0x58')];}return db[_0x416e('0x39')][_0x416e('0x54')]({'where':{'id':_0xa04528[_0x416e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x39ca8d,null))[_0x416e('0x1d')](saveUpdates(_0xa04528[_0x416e('0x55')],null))[_0x416e('0x1d')](respondWithResult(_0x39ca8d,null))['catch'](handleError(_0x39ca8d,null));};var utilLicense=require(_0x416e('0x5c'));exports[_0x416e('0x75')]=function(_0x56eedc,_0x7ae2bb,_0x20a603){var _0x33d29b=_0x416e('0x5e');var _0x556ea5={'custom':![]};return utilLicense[_0x416e('0x5f')]()[_0x416e('0x1d')](function(_0x29980f){if(_0x29980f){_0x556ea5=_0x29980f;}return db['Setting'][_0x416e('0x54')]({'where':{'id':_0x56eedc[_0x416e('0x4e')]['id']},'attributes':[_0x416e('0x59'),_0x416e('0x5b'),'preferred',_0x416e('0x61'),_0x416e('0x70'),_0x416e('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x416e('0x1d')](handleEntityNotFound(_0x7ae2bb,null))[_0x416e('0x1d')](function(_0xf56e40){if(_0xf56e40){var _0x15eb38=_0xf56e40[_0x416e('0x60')]&&fs[_0x416e('0x65')](path['join'](config['root'],_0x33d29b,_[_0x416e('0x68')](_0xf56e40[_0x416e('0x60')])))?path[_0x416e('0x66')](config[_0x416e('0x67')],_0x33d29b,_[_0x416e('0x68')](_0xf56e40[_0x416e('0x60')])):path[_0x416e('0x66')](config['root'],_0x33d29b,_[_0x416e('0x68')]('default_preferred.png'));var _0x52bcaf=_0x416e('0x69')+_[_0x416e('0x6a')](_0x416e('0x60'));if(_0xf56e40[_0x52bcaf]||!_0x556ea5[_0x416e('0x6b')]||!_0x556ea5['preferred']){_0x15eb38=path[_0x416e('0x66')](config['root'],_0x33d29b,_['toLower']('default_preferred.png'));}if(!fs[_0x416e('0x65')](_0x15eb38)){throw new db[(_0x416e('0x6c'))][(_0x416e('0x72'))](_[_0x416e('0x6a')](_0x416e('0x60'))+'\x20not\x20found');}return _0x7ae2bb[_0x416e('0x6e')](_0x15eb38);}})[_0x416e('0x25')](handleError(_0x7ae2bb,null));};exports['addFavicon']=function(_0x42f262,_0x593806,_0x48fbb1){if(_0x42f262['file']&&_0x42f262[_0x416e('0x57')]['filename']){_0x42f262['body'][_0x416e('0x61')]=_0x42f262['file'][_0x416e('0x58')];}return db['Setting'][_0x416e('0x54')]({'where':{'id':_0x42f262[_0x416e('0x4e')]['id']}})[_0x416e('0x1d')](handleEntityNotFound(_0x593806,null))[_0x416e('0x1d')](saveUpdates(_0x42f262['body'],null))[_0x416e('0x1d')](respondWithResult(_0x593806,null))[_0x416e('0x25')](handleError(_0x593806,null));};var utilLicense=require(_0x416e('0x5c'));exports[_0x416e('0x76')]=function(_0x2edfc6,_0x53eca4,_0x2f2275){var _0x54b4ce=_0x416e('0x5e');var _0x4e306b={'custom':![]};return utilLicense[_0x416e('0x5f')]()[_0x416e('0x1d')](function(_0x15e11d){if(_0x15e11d){_0x4e306b=_0x15e11d;}return db['Setting'][_0x416e('0x54')]({'where':{'id':_0x2edfc6['params']['id']},'attributes':[_0x416e('0x59'),_0x416e('0x5b'),_0x416e('0x60'),_0x416e('0x61'),_0x416e('0x70'),_0x416e('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x53eca4,null))['then'](function(_0xf59761){if(_0xf59761){var _0x1e5425=_0xf59761[_0x416e('0x61')]&&fs[_0x416e('0x65')](path[_0x416e('0x66')](config['root'],_0x54b4ce,_[_0x416e('0x68')](_0xf59761['favicon'])))?path[_0x416e('0x66')](config[_0x416e('0x67')],_0x54b4ce,_['toLower'](_0xf59761[_0x416e('0x61')])):path[_0x416e('0x66')](config['root'],_0x54b4ce,_[_0x416e('0x68')](_0x416e('0x77')));var _0x161861=_0x416e('0x69')+_['upperFirst']('favicon');if(_0xf59761[_0x161861]||!_0x4e306b[_0x416e('0x6b')]){_0x1e5425=path['join'](config['root'],_0x54b4ce,_[_0x416e('0x68')](_0x416e('0x77')));}if(!fs['existsSync'](_0x1e5425)){throw new db[(_0x416e('0x6c'))]['ValidationError'](_[_0x416e('0x6a')](_0x416e('0x61'))+_0x416e('0x6d'));}return _0x53eca4['download'](_0x1e5425);}})[_0x416e('0x25')](handleError(_0x53eca4,null));};exports[_0x416e('0x78')]=function(_0x23168f,_0x3b5a7e){var _0x491634={'offset':moment()['utcOffset']()};_0x491634['now']=moment()[_0x416e('0x79')](_0x491634[_0x416e('0x29')])['format'](_0x416e('0x7a'));return _0x3b5a7e[_0x416e('0x2d')](0xc8)[_0x416e('0x37')](_0x491634);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 0a7502e..06037cc 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(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0x3e74,0x175));var _0x43e7=function(_0x32fe81,_0xfc68b6){_0x32fe81=_0x32fe81-0x0;var _0x4e75a8=_0x3e74[_0x32fe81];return _0x4e75a8;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x5ae22d,_0x1d3e8b){var _0x37fb4e=function(_0x23723c){while(--_0x23723c){_0x5ae22d['push'](_0x5ae22d['shift']());}};_0x37fb4e(++_0x1d3e8b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e38cd,_0x446de2){_0x2e38cd=_0x2e38cd-0x0;var _0x5120c9=_0xedd9[_0x2e38cd];return _0x5120c9;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7953142..22f4981 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 _0x2ea3=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','then','info','lodash','util'];(function(_0x4dd043,_0x2b2d5b){var _0x5aa10d=function(_0x5b2dad){while(--_0x5b2dad){_0x4dd043['push'](_0x4dd043['shift']());}};_0x5aa10d(++_0x2b2d5b);}(_0x2ea3,0x1de));var _0x32ea=function(_0xc58e97,_0x4b7beb){_0xc58e97=_0xc58e97-0x0;var _0x93f8d2=_0x2ea3[_0xc58e97];return _0x93f8d2;};'use strict';var _=require(_0x32ea('0x0'));var util=require(_0x32ea('0x1'));var moment=require(_0x32ea('0x2'));var BPromise=require(_0x32ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32ea('0x4'));var db=require(_0x32ea('0x5'))['db'];var utils=require(_0x32ea('0x6'));var logger=require(_0x32ea('0x7'))(_0x32ea('0x8'));var config=require(_0x32ea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x32ea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556d32,_0x5b3f3c,_0x2b1c43){return new BPromise(function(_0x5d85d8,_0x38d1eb){return client[_0x32ea('0xb')](_0x556d32,_0x2b1c43)['then'](function(_0x3f9992){logger['info'](_0x32ea('0xc'),_0x5b3f3c,_0x32ea('0xd'));logger[_0x32ea('0xe')](_0x32ea('0xf'),_0x5b3f3c,'request\x20sent',JSON[_0x32ea('0x10')](_0x3f9992));if(_0x3f9992['error']){if(_0x3f9992['error'][_0x32ea('0x11')]===0x1f4){logger[_0x32ea('0x12')]('Setting,\x20%s,\x20%s',_0x5b3f3c,_0x3f9992[_0x32ea('0x12')][_0x32ea('0x13')]);return _0x38d1eb(_0x3f9992[_0x32ea('0x12')][_0x32ea('0x13')]);}logger[_0x32ea('0x12')](_0x32ea('0xc'),_0x5b3f3c,_0x3f9992[_0x32ea('0x12')][_0x32ea('0x13')]);return _0x5d85d8(_0x3f9992[_0x32ea('0x12')][_0x32ea('0x13')]);}else{logger['info'](_0x32ea('0xc'),_0x5b3f3c,_0x32ea('0xd'));_0x5d85d8(_0x3f9992['result'][_0x32ea('0x13')]);}})['catch'](function(_0x47cbc0){logger[_0x32ea('0x12')](_0x32ea('0xc'),_0x5b3f3c,_0x47cbc0);_0x38d1eb(_0x47cbc0);});});}exports[_0x32ea('0x14')]=function(_0x10f53a){var _0x47df21=this;return new Promise(function(_0xf5e969,_0x1c302c){return db[_0x32ea('0x15')][_0x32ea('0x16')]({'raw':_0x10f53a[_0x32ea('0x17')]?_0x10f53a[_0x32ea('0x17')][_0x32ea('0x18')]===undefined?!![]:![]:!![],'where':_0x10f53a[_0x32ea('0x17')]?_0x10f53a['options'][_0x32ea('0x19')]||null:null,'attributes':_0x10f53a['options']?_0x10f53a[_0x32ea('0x17')][_0x32ea('0x1a')]||null:null,'include':_0x10f53a[_0x32ea('0x17')]?_0x10f53a[_0x32ea('0x17')][_0x32ea('0x1b')]?_[_0x32ea('0x1c')](_0x10f53a[_0x32ea('0x17')][_0x32ea('0x1b')],function(_0x3d2aeb){return{'model':db[_0x3d2aeb[_0x32ea('0x1d')]],'as':_0x3d2aeb['as'],'attributes':_0x3d2aeb[_0x32ea('0x1a')],'include':_0x3d2aeb['include']?_[_0x32ea('0x1c')](_0x3d2aeb[_0x32ea('0x1b')],function(_0x5375f7){return{'model':db[_0x5375f7[_0x32ea('0x1d')]],'as':_0x5375f7['as'],'attributes':_0x5375f7[_0x32ea('0x1a')],'include':_0x5375f7['include']?_[_0x32ea('0x1c')](_0x5375f7['include'],function(_0x6bca02){return{'model':db[_0x6bca02['model']],'as':_0x6bca02['as'],'attributes':_0x6bca02[_0x32ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x32ea('0x1e')](function(_0x5269fd){logger[_0x32ea('0x1f')]('ShowSetting',_0x10f53a);logger[_0x32ea('0xe')]('ShowSetting',_0x10f53a,JSON['stringify'](_0x5269fd));_0xf5e969(_0x5269fd);})['catch'](function(_0x117523){logger[_0x32ea('0x12')](_0x32ea('0x14'),_0x117523['message'],_0x10f53a);_0x1c302c(_0x47df21[_0x32ea('0x12')](0x1f4,_0x117523[_0x32ea('0x13')]));});});}; \ No newline at end of file +var _0xeffd=['include','map','model','attributes','ShowSetting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','find','options','raw','where'];(function(_0x5bee3a,_0x5da455){var _0x5dad34=function(_0x4d55d6){while(--_0x4d55d6){_0x5bee3a['push'](_0x5bee3a['shift']());}};_0x5dad34(++_0x5da455);}(_0xeffd,0xd1));var _0xdeff=function(_0xbe06ac,_0x5c8b80){_0xbe06ac=_0xbe06ac-0x0;var _0x459e5e=_0xeffd[_0xbe06ac];return _0x459e5e;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdeff('0x4'))['db'];var utils=require(_0xdeff('0x5'));var logger=require(_0xdeff('0x6'))(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var jayson=require(_0xdeff('0x9'));var client=jayson[_0xdeff('0xa')][_0xdeff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33ac03,_0x1d9854,_0x422fb0){return new BPromise(function(_0x4bf581,_0x11b9fe){return client[_0xdeff('0xc')](_0x33ac03,_0x422fb0)[_0xdeff('0xd')](function(_0x1b3740){logger[_0xdeff('0xe')]('Setting,\x20%s,\x20%s',_0x1d9854,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x1d9854,'request\x20sent',JSON[_0xdeff('0x12')](_0x1b3740));if(_0x1b3740[_0xdeff('0x13')]){if(_0x1b3740[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger[_0xdeff('0x13')](_0xdeff('0x15'),_0x1d9854,_0x1b3740['error'][_0xdeff('0x16')]);return _0x11b9fe(_0x1b3740[_0xdeff('0x13')][_0xdeff('0x16')]);}logger[_0xdeff('0x13')](_0xdeff('0x15'),_0x1d9854,_0x1b3740[_0xdeff('0x13')]['message']);return _0x4bf581(_0x1b3740['error'][_0xdeff('0x16')]);}else{logger[_0xdeff('0xe')]('Setting,\x20%s,\x20%s',_0x1d9854,_0xdeff('0xf'));_0x4bf581(_0x1b3740[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x1fd9dc){logger[_0xdeff('0x13')]('Setting,\x20%s,\x20%s',_0x1d9854,_0x1fd9dc);_0x11b9fe(_0x1fd9dc);});});}exports['ShowSetting']=function(_0x32a60a){var _0x33ec5e=this;return new Promise(function(_0x4aa239,_0x599fbd){return db['Setting'][_0xdeff('0x19')]({'raw':_0x32a60a[_0xdeff('0x1a')]?_0x32a60a['options'][_0xdeff('0x1b')]===undefined?!![]:![]:!![],'where':_0x32a60a[_0xdeff('0x1a')]?_0x32a60a['options'][_0xdeff('0x1c')]||null:null,'attributes':_0x32a60a[_0xdeff('0x1a')]?_0x32a60a['options']['attributes']||null:null,'include':_0x32a60a['options']?_0x32a60a[_0xdeff('0x1a')][_0xdeff('0x1d')]?_[_0xdeff('0x1e')](_0x32a60a['options']['include'],function(_0x28b3cf){return{'model':db[_0x28b3cf[_0xdeff('0x1f')]],'as':_0x28b3cf['as'],'attributes':_0x28b3cf['attributes'],'include':_0x28b3cf[_0xdeff('0x1d')]?_[_0xdeff('0x1e')](_0x28b3cf['include'],function(_0x3ff22a){return{'model':db[_0x3ff22a[_0xdeff('0x1f')]],'as':_0x3ff22a['as'],'attributes':_0x3ff22a[_0xdeff('0x20')],'include':_0x3ff22a[_0xdeff('0x1d')]?_['map'](_0x3ff22a[_0xdeff('0x1d')],function(_0x487a73){return{'model':db[_0x487a73[_0xdeff('0x1f')]],'as':_0x487a73['as'],'attributes':_0x487a73[_0xdeff('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x131346){logger[_0xdeff('0xe')](_0xdeff('0x21'),_0x32a60a);logger[_0xdeff('0x10')](_0xdeff('0x21'),_0x32a60a,JSON[_0xdeff('0x12')](_0x131346));_0x4aa239(_0x131346);})[_0xdeff('0x18')](function(_0x549c8e){logger[_0xdeff('0x13')](_0xdeff('0x21'),_0x549c8e['message'],_0x32a60a);_0x599fbd(_0x33ec5e[_0xdeff('0x13')](0x1f4,_0x549c8e[_0xdeff('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8357ef0..d4530a0 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x275c9c,_0x1fdf1c){var _0x6e7ebe=function(_0x4e9eb1){while(--_0x4e9eb1){_0x275c9c['push'](_0x275c9c['shift']());}};_0x6e7ebe(++_0x1fdf1c);}(_0x53ec,0x192));var _0xc53e=function(_0x3e64ed,_0x491816){_0x3e64ed=_0x3e64ed-0x0;var _0x14d8bc=_0x53ec[_0x3e64ed];return _0x14d8bc;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7217,0x19e));var _0x7721=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7217[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e80ea70..a705c07 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 _0x6645=['connectel','clickatell','bandwidth','csc','infobip','ENUM','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','skebby'];(function(_0x5775d1,_0x520e96){var _0xe2fc8f=function(_0x1ceae1){while(--_0x1ceae1){_0x5775d1['push'](_0x5775d1['shift']());}};_0xe2fc8f(++_0x520e96);}(_0x6645,0x80));var _0x5664=function(_0x194ee8,_0x24d565){_0x194ee8=_0x194ee8-0x0;var _0x3f7148=_0x6645[_0x194ee8];return _0x3f7148;};'use strict';var Sequelize=require(_0x5664('0x0'));var rs=require(_0x5664('0x1'));module['exports']={'name':{'type':Sequelize[_0x5664('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5664('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x5664('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x5664('0x2')],'defaultValue':function(){return rs[_0x5664('0x3')]();}},'phone':{'type':Sequelize[_0x5664('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0x5664('0x4'),_0x5664('0x5'),'clicksend','plivo',_0x5664('0x6'),_0x5664('0x7'),_0x5664('0x8'),_0x5664('0x9'),'intelepeer')},'accountSid':{'type':Sequelize[_0x5664('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x5664('0x2')]},'smsMethod':{'type':Sequelize[_0x5664('0xa')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5664('0x2')]},'apiKey':{'type':Sequelize[_0x5664('0x2')]},'applicationId':{'type':Sequelize[_0x5664('0x2')]},'accountId':{'type':Sequelize[_0x5664('0x2')]},'senderString':{'type':Sequelize[_0x5664('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5664('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5664('0xb')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5664('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5664('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5664('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5664('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5664('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5664('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5664('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5664('0xd')],'comment':_0x5664('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x5664('0xc')],'defaultValue':![],'comment':_0x5664('0xf'),'set':function(_0x22b9a7){if(!_0x22b9a7)this[_0x5664('0x10')](_0x5664('0x11'),null);this[_0x5664('0x10')](_0x5664('0x12'),_0x22b9a7);}}}; \ No newline at end of file +var _0x23db=['generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','exports','STRING'];(function(_0x275753,_0x131f5f){var _0x4a293c=function(_0x1b8f69){while(--_0x1b8f69){_0x275753['push'](_0x275753['shift']());}};_0x4a293c(++_0x131f5f);}(_0x23db,0xb2));var _0xb23d=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x23db[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb23d('0x0')]={'name':{'type':Sequelize[_0xb23d('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xb23d('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb23d('0x1')],'defaultValue':function(){return rs[_0xb23d('0x2')]();}},'phone':{'type':Sequelize[_0xb23d('0x1')]},'type':{'type':Sequelize[_0xb23d('0x3')](_0xb23d('0x4'),_0xb23d('0x5'),'connectel',_0xb23d('0x6'),_0xb23d('0x7'),_0xb23d('0x8'),_0xb23d('0x9'),_0xb23d('0xa'),_0xb23d('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0xb23d('0x1')]},'authId':{'type':Sequelize[_0xb23d('0x1')]},'authToken':{'type':Sequelize[_0xb23d('0x1')]},'smsMethod':{'type':Sequelize[_0xb23d('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb23d('0x1')]},'password':{'type':Sequelize[_0xb23d('0x1')]},'apiKey':{'type':Sequelize[_0xb23d('0x1')]},'applicationId':{'type':Sequelize[_0xb23d('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xb23d('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb23d('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb23d('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb23d('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb23d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb23d('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb23d('0xe')],'comment':_0xb23d('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xb23d('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c1226){if(!_0x4c1226)this['setDataValue'](_0xb23d('0x10'),null);this[_0xb23d('0x11')]('mandatoryDisposition',_0x4c1226);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 84a4c02..b6cdc9d 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 _0x4394=['error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','get','SmsAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','SmsAccount','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','findAll','rows','show','rawAttributes','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','SmsAccountId','Disposition','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','createdAt','updatedAt','difference','CompanyId','from','From','Body','messageId','MessageSid','sender','connectel','message_id','plivo','infobip','results','text','csc','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','ListId','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5202e8,_0x2446f9){var _0x2d9ee9=function(_0x250018){while(--_0x250018){_0x5202e8['push'](_0x5202e8['shift']());}};_0x2d9ee9(++_0x2446f9);}(_0x4394,0xbf));var _0x4439=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0x4394[_0x4667b2];return _0x1070f2;};'use strict';var emlformat=require(_0x4439('0x0'));var rimraf=require(_0x4439('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4439('0x2'));var rp=require(_0x4439('0x3'));var moment=require(_0x4439('0x4'));var BPromise=require(_0x4439('0x5'));var Mustache=require('mustache');var util=require(_0x4439('0x6'));var path=require(_0x4439('0x7'));var sox=require(_0x4439('0x8'));var csv=require(_0x4439('0x9'));var ejs=require(_0x4439('0xa'));var fs=require('fs');var fs_extra=require(_0x4439('0xb'));var _=require(_0x4439('0xc'));var squel=require(_0x4439('0xd'));var crypto=require(_0x4439('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4439('0xf'));var toCsv=require(_0x4439('0x9'));var querystring=require(_0x4439('0x10'));var Papa=require(_0x4439('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4439('0x12'));var hardwareService=require(_0x4439('0x13'));var logger=require(_0x4439('0x14'))(_0x4439('0x15'));var utils=require(_0x4439('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4439('0x17'));var db=require(_0x4439('0x18'))['db'];config[_0x4439('0x19')]=_['defaults'](config[_0x4439('0x19')],{'host':_0x4439('0x1a'),'port':0x18eb});var socket=require(_0x4439('0x1b'))(new Redis(config['redis']));require(_0x4439('0x1c'))[_0x4439('0x1d')](socket);var jayson=require(_0x4439('0x1e'));var client=jayson[_0x4439('0x1f')][_0x4439('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x46e061,_0x43d587,_0x19d2d3,_0x1e5dc7){return new BPromise(function(_0x31737d,_0x44d52c){var _0xf7f9e4=_0x1e5dc7||client;return _0xf7f9e4[_0x4439('0x21')](_0x46e061,_0x19d2d3)[_0x4439('0x22')](function(_0x3c1f65){logger[_0x4439('0x23')](_0x4439('0x24'),_0x43d587,'request\x20sent');logger[_0x4439('0x25')](_0x4439('0x26'),_0x43d587,_0x4439('0x27'),JSON[_0x4439('0x28')](_0x3c1f65));if(_0x3c1f65[_0x4439('0x29')]){if(_0x3c1f65[_0x4439('0x29')][_0x4439('0x2a')]===0x1f4){logger[_0x4439('0x29')]('SmsAccount,\x20%s,\x20%s',_0x43d587,_0x3c1f65['error'][_0x4439('0x2b')]);return _0x44d52c(_0x3c1f65['error'][_0x4439('0x2b')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x43d587,_0x3c1f65[_0x4439('0x29')][_0x4439('0x2b')]);return _0x31737d(_0x3c1f65[_0x4439('0x29')][_0x4439('0x2b')]);}else{logger[_0x4439('0x23')](_0x4439('0x24'),_0x43d587,_0x4439('0x27'));_0x31737d(_0x3c1f65[_0x4439('0x2c')]['message']);}})[_0x4439('0x2d')](function(_0x48a971){logger[_0x4439('0x29')](_0x4439('0x24'),_0x43d587,_0x48a971);_0x44d52c(_0x48a971);});});}function respondWithStatusCode(_0x304eb3,_0x398298){_0x398298=_0x398298||0xcc;return function(_0x2825fb){if(_0x2825fb){return _0x304eb3[_0x4439('0x2e')](_0x398298);}return _0x304eb3[_0x4439('0x2f')](_0x398298)[_0x4439('0x30')]();};}function respondWithResult(_0x2164b1,_0x500036){_0x500036=_0x500036||0xc8;return function(_0x494457){if(_0x494457){return _0x2164b1[_0x4439('0x2f')](_0x500036)['json'](_0x494457);}};}function respondWithFilteredResult(_0x538c00,_0x1c7f8b){return function(_0x38f80b){if(_0x38f80b){var _0x280ebd=typeof _0x1c7f8b['offset']===_0x4439('0x31')&&typeof _0x1c7f8b[_0x4439('0x32')]==='undefined';var _0x21c943=_0x38f80b[_0x4439('0x33')];var _0x4f0039=_0x280ebd?0x0:_0x1c7f8b[_0x4439('0x34')];var _0x31cf7a=_0x280ebd?_0x38f80b['count']:_0x1c7f8b['offset']+_0x1c7f8b[_0x4439('0x32')];var _0x2530d6;if(_0x31cf7a>=_0x21c943){_0x31cf7a=_0x21c943;_0x2530d6=0xc8;}else{_0x2530d6=0xce;}_0x538c00[_0x4439('0x2f')](_0x2530d6);return _0x538c00[_0x4439('0x35')](_0x4439('0x36'),_0x4f0039+'-'+_0x31cf7a+'/'+_0x21c943)[_0x4439('0x37')](_0x38f80b);}return null;};}function patchUpdates(_0x55bc48){return function(_0x505af1){try{jsonpatch[_0x4439('0x38')](_0x505af1,_0x55bc48,!![]);}catch(_0x288d89){return BPromise[_0x4439('0x39')](_0x288d89);}return _0x505af1[_0x4439('0x3a')]();};}function saveUpdates(_0x5d1a62,_0x4326f4){return function(_0x47217e){if(_0x47217e){return _0x47217e[_0x4439('0x3b')](_0x5d1a62)[_0x4439('0x22')](function(_0x5a41f5){return _0x5a41f5;});}return null;};}function removeEntity(_0xba4a6d,_0x3e9e8e){return function(_0x1695a3){if(_0x1695a3){return _0x1695a3['destroy']()[_0x4439('0x22')](function(){var _0x2de0e6=_0x1695a3[_0x4439('0x3c')]({'plain':!![]});var _0x89723c=_0x4439('0x3d');return db[_0x4439('0x3e')]['destroy']({'where':{'type':_0x89723c,'resourceId':_0x2de0e6['id']}})[_0x4439('0x22')](function(){return _0x1695a3;});})[_0x4439('0x22')](function(){_0xba4a6d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x451603,_0x547b8c){return function(_0x4a3e8f){if(!_0x4a3e8f){_0x451603[_0x4439('0x2e')](0x194);}return _0x4a3e8f;};}function handleError(_0x3f24a1,_0x4cd2f4){_0x4cd2f4=_0x4cd2f4||0x1f4;return function(_0x158d3b){logger[_0x4439('0x29')](_0x158d3b[_0x4439('0x3f')]);if(_0x158d3b['name']){delete _0x158d3b['name'];}_0x3f24a1[_0x4439('0x2f')](_0x4cd2f4)[_0x4439('0x40')](_0x158d3b);};}exports[_0x4439('0x41')]=function(_0x62ced8,_0x533ffa){var _0x39d0ca={'include':[{'model':db[_0x4439('0x42')],'as':_0x4439('0x43')}]},_0x4c5c7f={},_0x3f7683={'count':0x0,'rows':[]};var _0x34bafb=_['map'](db[_0x4439('0x44')]['rawAttributes'],function(_0x4de7c5){return{'name':_0x4de7c5[_0x4439('0x45')],'type':_0x4de7c5[_0x4439('0x46')][_0x4439('0x47')]};});_0x4c5c7f['model']=_[_0x4439('0x48')](_0x34bafb,'name');_0x4c5c7f[_0x4439('0x49')]=_[_0x4439('0x4a')](_0x62ced8[_0x4439('0x49')]);_0x4c5c7f[_0x4439('0x4b')]=_['intersection'](_0x4c5c7f[_0x4439('0x4c')],_0x4c5c7f[_0x4439('0x49')]);_0x39d0ca[_0x4439('0x4d')]=_[_0x4439('0x4e')](_0x4c5c7f[_0x4439('0x4c')],qs[_0x4439('0x4f')](_0x62ced8['query']['fields']));_0x39d0ca[_0x4439('0x4d')]=_0x39d0ca['attributes'][_0x4439('0x50')]?_0x39d0ca[_0x4439('0x4d')]:_0x4c5c7f['model'];if(!_0x62ced8[_0x4439('0x49')]['hasOwnProperty']('nolimit')){_0x39d0ca[_0x4439('0x32')]=qs[_0x4439('0x32')](_0x62ced8['query'][_0x4439('0x32')]);_0x39d0ca[_0x4439('0x34')]=qs[_0x4439('0x34')](_0x62ced8[_0x4439('0x49')]['offset']);}_0x39d0ca[_0x4439('0x51')]=qs[_0x4439('0x52')](_0x62ced8[_0x4439('0x49')][_0x4439('0x52')]);_0x39d0ca[_0x4439('0x53')]=qs[_0x4439('0x4b')](_[_0x4439('0x54')](_0x62ced8[_0x4439('0x49')],_0x4c5c7f[_0x4439('0x4b')]),_0x34bafb);if(_0x62ced8[_0x4439('0x49')]['filter']){_0x39d0ca[_0x4439('0x53')]=_[_0x4439('0x55')](_0x39d0ca[_0x4439('0x53')],{'$or':_[_0x4439('0x48')](_0x34bafb,function(_0x516ad8){if(_0x516ad8[_0x4439('0x46')]!==_0x4439('0x56')){var _0x2a3548={};_0x2a3548[_0x516ad8[_0x4439('0x57')]]={'$like':'%'+_0x62ced8[_0x4439('0x49')][_0x4439('0x58')]+'%'};return _0x2a3548;}})});}_0x39d0ca=_[_0x4439('0x55')]({},_0x39d0ca,_0x62ced8[_0x4439('0x59')]);var _0x24adb2={'where':_0x39d0ca[_0x4439('0x53')]};return db[_0x4439('0x44')][_0x4439('0x33')](_0x24adb2)[_0x4439('0x22')](function(_0x26da24){_0x3f7683[_0x4439('0x33')]=_0x26da24;if(_0x62ced8[_0x4439('0x49')][_0x4439('0x5a')]){_0x39d0ca['include']=[{'all':!![]}];}return db[_0x4439('0x44')][_0x4439('0x5b')](_0x39d0ca);})[_0x4439('0x22')](function(_0x386fef){_0x3f7683[_0x4439('0x5c')]=_0x386fef;return _0x3f7683;})['then'](respondWithFilteredResult(_0x533ffa,_0x39d0ca))[_0x4439('0x2d')](handleError(_0x533ffa,null));};exports[_0x4439('0x5d')]=function(_0x191ef9,_0x583b1d){var _0x2eac9a={'raw':![],'where':{'id':_0x191ef9['params']['id']},'include':[{'model':db[_0x4439('0x42')],'as':_0x4439('0x43')}]},_0x21ef67={};_0x21ef67[_0x4439('0x4c')]=_['keys'](db[_0x4439('0x44')][_0x4439('0x5e')]);_0x21ef67[_0x4439('0x49')]=_['keys'](_0x191ef9['query']);_0x21ef67[_0x4439('0x4b')]=_[_0x4439('0x4e')](_0x21ef67['model'],_0x21ef67['query']);_0x2eac9a[_0x4439('0x4d')]=_[_0x4439('0x4e')](_0x21ef67[_0x4439('0x4c')],qs[_0x4439('0x4f')](_0x191ef9[_0x4439('0x49')][_0x4439('0x4f')]));_0x2eac9a['attributes']=_0x2eac9a[_0x4439('0x4d')]['length']?_0x2eac9a[_0x4439('0x4d')]:_0x21ef67[_0x4439('0x4c')];if(_0x191ef9[_0x4439('0x49')][_0x4439('0x5a')]){_0x2eac9a[_0x4439('0x5f')]=[{'all':!![]}];}_0x2eac9a=_[_0x4439('0x55')]({},_0x2eac9a,_0x191ef9[_0x4439('0x59')]);return db[_0x4439('0x44')][_0x4439('0x60')](_0x2eac9a)[_0x4439('0x22')](handleEntityNotFound(_0x583b1d,null))[_0x4439('0x22')](respondWithResult(_0x583b1d,null))['catch'](handleError(_0x583b1d,null));};exports[_0x4439('0x61')]=function(_0x504373,_0x2d29ed){return db[_0x4439('0x44')][_0x4439('0x61')](_0x504373[_0x4439('0x62')],{})[_0x4439('0x22')](function(_0x130ab8){var _0x2b54d5=_0x504373[_0x4439('0x63')]['get']({'plain':!![]});if(!_0x2b54d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b54d5['role']===_0x4439('0x63')){var _0x8de86c=_0x130ab8[_0x4439('0x3c')]({'plain':!![]});var _0x1078e5='SmsAccounts';return db[_0x4439('0x64')][_0x4439('0x60')]({'where':{'name':_0x1078e5,'userProfileId':_0x2b54d5[_0x4439('0x65')]},'raw':!![]})['then'](function(_0x276e62){if(_0x276e62&&_0x276e62[_0x4439('0x66')]===0x0){return db[_0x4439('0x3e')][_0x4439('0x61')]({'name':_0x8de86c['name'],'resourceId':_0x8de86c['id'],'type':_0x276e62[_0x4439('0x57')],'sectionId':_0x276e62['id']},{})[_0x4439('0x22')](function(){return _0x130ab8;});}else{return _0x130ab8;}})[_0x4439('0x2d')](function(_0x36fabf){logger[_0x4439('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36fabf);throw _0x36fabf;});}return _0x130ab8;})[_0x4439('0x22')](respondWithResult(_0x2d29ed,0xc9))[_0x4439('0x2d')](handleError(_0x2d29ed,null));};exports[_0x4439('0x3b')]=function(_0x408454,_0x2d2a15){if(_0x408454['body']['id']){delete _0x408454[_0x4439('0x62')]['id'];}return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x408454[_0x4439('0x67')]['id']},'include':[{'model':db[_0x4439('0x42')],'as':_0x4439('0x43')}]})[_0x4439('0x22')](handleEntityNotFound(_0x2d2a15,null))[_0x4439('0x22')](saveUpdates(_0x408454[_0x4439('0x62')],null))[_0x4439('0x22')](respondWithResult(_0x2d2a15,null))[_0x4439('0x2d')](handleError(_0x2d2a15,null));};exports['destroy']=function(_0x31c904,_0x21e13d){return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x31c904[_0x4439('0x67')]['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x21e13d,null))[_0x4439('0x22')](removeEntity(_0x21e13d,null))[_0x4439('0x2d')](handleError(_0x21e13d,null));};exports[_0x4439('0x68')]=function(_0x87cb82,_0x459911){return db[_0x4439('0x44')]['describe']()['then'](respondWithResult(_0x459911,null))[_0x4439('0x2d')](handleError(_0x459911,null));};exports[_0x4439('0x69')]=function(_0x5dabae,_0x4116b0,_0x343558){if(_0x5dabae[_0x4439('0x62')]['id']){delete _0x5dabae['body']['id'];}return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x5dabae[_0x4439('0x67')]['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x4116b0,null))['then'](function(_0x179bdd){if(_0x179bdd){_0x5dabae[_0x4439('0x62')][_0x4439('0x6a')]=_0x179bdd['id'];return db[_0x4439('0x6b')][_0x4439('0x61')](_0x5dabae['body']);}})[_0x4439('0x22')](respondWithResult(_0x4116b0,null))['catch'](handleError(_0x4116b0,null));};exports['getDispositions']=function(_0x1d9306,_0x4dc6d6,_0x2f7161){var _0x4ceabc={'raw':![],'where':{}};var _0x30a75f={};var _0x4b6643={'count':0x0,'rows':[]};return db[_0x4439('0x44')]['findOne']({'where':{'id':_0x1d9306['params']['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x4dc6d6,null))[_0x4439('0x22')](function(_0x18a333){if(_0x18a333){_0x30a75f[_0x4439('0x4c')]=_[_0x4439('0x4a')](db[_0x4439('0x6b')][_0x4439('0x5e')]);_0x30a75f[_0x4439('0x49')]=_[_0x4439('0x4a')](_0x1d9306['query']);_0x30a75f[_0x4439('0x4b')]=_[_0x4439('0x4e')](_0x30a75f[_0x4439('0x4c')],_0x30a75f[_0x4439('0x49')]);_0x4ceabc[_0x4439('0x4d')]=_[_0x4439('0x4e')](_0x30a75f[_0x4439('0x4c')],qs[_0x4439('0x4f')](_0x1d9306[_0x4439('0x49')]['fields']));_0x4ceabc['attributes']=_0x4ceabc[_0x4439('0x4d')][_0x4439('0x50')]?_0x4ceabc[_0x4439('0x4d')]:_0x30a75f[_0x4439('0x4c')];if(!_0x1d9306[_0x4439('0x49')][_0x4439('0x6c')](_0x4439('0x6d'))){_0x4ceabc['limit']=qs[_0x4439('0x32')](_0x1d9306[_0x4439('0x49')][_0x4439('0x32')]);_0x4ceabc['offset']=qs['offset'](_0x1d9306[_0x4439('0x49')][_0x4439('0x34')]);}_0x4ceabc[_0x4439('0x51')]=qs[_0x4439('0x52')](_0x1d9306['query'][_0x4439('0x52')]);_0x4ceabc[_0x4439('0x53')]=qs[_0x4439('0x4b')](_[_0x4439('0x54')](_0x1d9306['query'],_0x30a75f[_0x4439('0x4b')]));_0x4ceabc['where'][_0x4439('0x6a')]=_0x18a333['id'];if(_0x1d9306[_0x4439('0x49')][_0x4439('0x58')]){_0x4ceabc[_0x4439('0x53')]=_['merge'](_0x4ceabc[_0x4439('0x53')],{'$or':_[_0x4439('0x48')](_0x4ceabc[_0x4439('0x4d')],function(_0x4e76a0){var _0x430a32={};_0x430a32[_0x4e76a0]={'$like':'%'+_0x1d9306['query']['filter']+'%'};return _0x430a32;})});}_0x4ceabc=_[_0x4439('0x55')]({},_0x4ceabc,_0x1d9306[_0x4439('0x59')]);return db['Disposition'][_0x4439('0x33')]({'where':_0x4ceabc[_0x4439('0x53')]})['then'](function(_0x2093a1){_0x4b6643[_0x4439('0x33')]=_0x2093a1;if(_0x1d9306[_0x4439('0x49')]['includeAll']){_0x4ceabc['include']=[{'all':!![]}];}return db[_0x4439('0x6b')][_0x4439('0x5b')](_0x4ceabc);})['then'](function(_0x12c3f0){_0x4b6643['rows']=_0x12c3f0;return _0x4b6643;});}})['then'](respondWithFilteredResult(_0x4dc6d6,_0x4ceabc))[_0x4439('0x2d')](handleError(_0x4dc6d6,null));};exports['removeDispositions']=function(_0x54c24f,_0xbc2518,_0x505f65){return db['SmsAccount'][_0x4439('0x60')]({'where':{'id':_0x54c24f['params']['id']}})['then'](handleEntityNotFound(_0xbc2518,null))[_0x4439('0x22')](function(_0x4f2d0d){if(_0x4f2d0d){return _0x4f2d0d[_0x4439('0x6e')](_0x54c24f['query'][_0x4439('0x6f')]);}})['then'](respondWithStatusCode(_0xbc2518,null))['catch'](handleError(_0xbc2518,null));};exports[_0x4439('0x70')]=function(_0x29765b,_0x2714f1,_0x384648){if(_0x29765b[_0x4439('0x62')]['id']){delete _0x29765b[_0x4439('0x62')]['id'];}return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x29765b[_0x4439('0x67')]['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x2714f1,null))[_0x4439('0x22')](function(_0x5a155a){if(_0x5a155a){_0x29765b[_0x4439('0x62')]['SmsAccountId']=_0x5a155a['id'];return db[_0x4439('0x71')][_0x4439('0x61')](_0x29765b[_0x4439('0x62')]);}})[_0x4439('0x22')](respondWithResult(_0x2714f1,null))[_0x4439('0x2d')](handleError(_0x2714f1,null));};exports[_0x4439('0x72')]=function(_0x50d867,_0x59044b,_0x38c482){var _0x39a2e8={'raw':![],'where':{}};var _0xf19b15={};var _0x15cf0a={'count':0x0,'rows':[]};return db[_0x4439('0x44')][_0x4439('0x73')]({'where':{'id':_0x50d867[_0x4439('0x67')]['id']}})['then'](handleEntityNotFound(_0x59044b,null))[_0x4439('0x22')](function(_0x5cf1fa){if(_0x5cf1fa){_0xf19b15[_0x4439('0x4c')]=_[_0x4439('0x4a')](db[_0x4439('0x71')][_0x4439('0x5e')]);_0xf19b15[_0x4439('0x49')]=_[_0x4439('0x4a')](_0x50d867[_0x4439('0x49')]);_0xf19b15[_0x4439('0x4b')]=_[_0x4439('0x4e')](_0xf19b15['model'],_0xf19b15['query']);_0x39a2e8['attributes']=_[_0x4439('0x4e')](_0xf19b15[_0x4439('0x4c')],qs[_0x4439('0x4f')](_0x50d867[_0x4439('0x49')][_0x4439('0x4f')]));_0x39a2e8['attributes']=_0x39a2e8[_0x4439('0x4d')]['length']?_0x39a2e8['attributes']:_0xf19b15['model'];if(!_0x50d867[_0x4439('0x49')][_0x4439('0x6c')](_0x4439('0x6d'))){_0x39a2e8['limit']=qs[_0x4439('0x32')](_0x50d867['query'][_0x4439('0x32')]);_0x39a2e8[_0x4439('0x34')]=qs[_0x4439('0x34')](_0x50d867[_0x4439('0x49')]['offset']);}_0x39a2e8['order']=qs[_0x4439('0x52')](_0x50d867[_0x4439('0x49')][_0x4439('0x52')]);_0x39a2e8[_0x4439('0x53')]=qs[_0x4439('0x4b')](_[_0x4439('0x54')](_0x50d867['query'],_0xf19b15[_0x4439('0x4b')]));_0x39a2e8['where'][_0x4439('0x6a')]=_0x5cf1fa['id'];if(_0x50d867['query'][_0x4439('0x58')]){_0x39a2e8['where']=_[_0x4439('0x55')](_0x39a2e8[_0x4439('0x53')],{'$or':_['map'](_0x39a2e8[_0x4439('0x4d')],function(_0x5192dd){var _0x199ba0={};_0x199ba0[_0x5192dd]={'$like':'%'+_0x50d867[_0x4439('0x49')]['filter']+'%'};return _0x199ba0;})});}_0x39a2e8=_[_0x4439('0x55')]({},_0x39a2e8,_0x50d867[_0x4439('0x59')]);return db['CannedAnswer']['count']({'where':_0x39a2e8['where']})[_0x4439('0x22')](function(_0x838528){_0x15cf0a[_0x4439('0x33')]=_0x838528;if(_0x50d867[_0x4439('0x49')][_0x4439('0x5a')]){_0x39a2e8['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x4439('0x5b')](_0x39a2e8);})[_0x4439('0x22')](function(_0x3e5d66){_0x15cf0a[_0x4439('0x5c')]=_0x3e5d66;return _0x15cf0a;});}})['then'](respondWithFilteredResult(_0x59044b,_0x39a2e8))[_0x4439('0x2d')](handleError(_0x59044b,null));};exports[_0x4439('0x74')]=function(_0x33feef,_0x3fa6bd,_0x505998){return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x33feef[_0x4439('0x67')]['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x3fa6bd,null))[_0x4439('0x22')](function(_0x6d1834){if(_0x6d1834){return _0x6d1834[_0x4439('0x74')](_0x33feef[_0x4439('0x49')]['ids']);}})[_0x4439('0x22')](respondWithStatusCode(_0x3fa6bd,null))['catch'](handleError(_0x3fa6bd,null));};exports[_0x4439('0x75')]=function(_0x389057,_0x118115,_0x33bef5){var _0x54204c={'channel':_0x4439('0x76')};var _0x374ca0=[];var _0x18ce8d=[];var _0x14d476={};return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x389057[_0x4439('0x67')]['id']},'include':[{'model':db[_0x4439('0x77')],'as':_0x4439('0x78')}]})[_0x4439('0x22')](handleEntityNotFound(_0x118115,null))['then'](function(_0x4c6ae7){_0x54204c[_0x4439('0x79')]=_0x4c6ae7;_0x54204c['applications']=_[_0x4439('0x7a')](_0x4c6ae7[_0x4439('0x78')],[_0x4439('0x7b')],[_0x4439('0x7c')]);if(_0x54204c[_0x4439('0x79')][_0x4439('0x78')]){delete _0x54204c['account'][_0x4439('0x78')];}return db[_0x4439('0x7d')][_0x4439('0x68')]();})[_0x4439('0x22')](function(_0x4f41b6){if(!_0x4f41b6){throw new db[(_0x4439('0x7e'))]['ValidationError']('no\x20available\x20attributes');}_0x374ca0=_['difference'](_['keys'](_0x4f41b6),[_0x4439('0x7f'),_0x4439('0x80')]);_0x18ce8d=_[_0x4439('0x81')](_[_0x4439('0x4a')](_0x4f41b6),[_0x4439('0x7f'),'updatedAt',_0x4439('0x82'),'ListId']);_0x54204c[_0x4439('0x62')]={'mapKey':'mobile'};if(_0x54204c['account'][_0x4439('0x46')]){switch(_0x54204c[_0x4439('0x79')][_0x4439('0x46')]){case'twilio':_0x54204c[_0x4439('0x62')][_0x4439('0x83')]=_0x389057[_0x4439('0x62')][_0x4439('0x84')];_0x54204c[_0x4439('0x62')]['body']=_0x389057[_0x4439('0x62')][_0x4439('0x85')];_0x54204c[_0x4439('0x62')][_0x4439('0x86')]=_0x389057['body'][_0x4439('0x87')];break;case'skebby':_0x54204c[_0x4439('0x62')][_0x4439('0x83')]='+'+_0x389057[_0x4439('0x62')][_0x4439('0x88')];_0x54204c[_0x4439('0x62')][_0x4439('0x62')]=_0x389057[_0x4439('0x62')]['text'];break;case _0x4439('0x89'):_0x54204c[_0x4439('0x62')][_0x4439('0x83')]=_0x389057[_0x4439('0x62')]['from'];_0x54204c[_0x4439('0x62')][_0x4439('0x62')]=_0x389057[_0x4439('0x62')][_0x4439('0x2b')];break;case'clicksend':_0x54204c[_0x4439('0x62')]['from']=_0x389057[_0x4439('0x62')][_0x4439('0x83')];_0x54204c[_0x4439('0x62')][_0x4439('0x62')]=_0x389057[_0x4439('0x62')][_0x4439('0x62')];_0x54204c['body']['messageId']=_0x389057[_0x4439('0x62')][_0x4439('0x8a')];break;case _0x4439('0x8b'):_0x54204c[_0x4439('0x62')][_0x4439('0x83')]=_0x389057['body'][_0x4439('0x84')];_0x54204c[_0x4439('0x62')][_0x4439('0x62')]=_0x389057[_0x4439('0x62')]['Text'];_0x54204c[_0x4439('0x62')][_0x4439('0x86')]=_0x389057[_0x4439('0x62')]['MessageUUID'];break;case _0x4439('0x8c'):_0x54204c[_0x4439('0x62')][_0x4439('0x83')]='+'+_0x389057[_0x4439('0x62')]['results'][0x0][_0x4439('0x83')];_0x54204c[_0x4439('0x62')]['body']=_0x389057[_0x4439('0x62')][_0x4439('0x8d')][0x0][_0x4439('0x8e')];_0x54204c[_0x4439('0x62')][_0x4439('0x86')]=_0x389057[_0x4439('0x62')][_0x4439('0x8d')][0x0][_0x4439('0x86')];break;case _0x4439('0x8f'):_0x54204c[_0x4439('0x62')][_0x4439('0x83')]=_0x389057['body']['originatingAddress'];_0x54204c[_0x4439('0x62')][_0x4439('0x62')]=_0x389057[_0x4439('0x62')]['segmentedMessage'][_0x4439('0x2b')];break;case _0x4439('0x90'):_0x54204c[_0x4439('0x62')]['from']=_0x389057[_0x4439('0x62')][_0x4439('0x91')];_0x54204c['body'][_0x4439('0x62')]=_0x389057['body']['text'];_0x54204c[_0x4439('0x62')][_0x4439('0x86')]=_0x389057[_0x4439('0x62')][_0x4439('0x92')];break;case _0x4439('0x93'):_0x54204c[_0x4439('0x62')][_0x4439('0x86')]=_0x389057[_0x4439('0x62')][0x0][_0x4439('0x2b')]['id'];_0x54204c[_0x4439('0x62')]['from']=_0x389057['body'][0x0][_0x4439('0x2b')][_0x4439('0x83')];_0x54204c[_0x4439('0x62')]['body']=_0x389057[_0x4439('0x62')][0x0]['message'][_0x4439('0x8e')];break;case _0x4439('0x94'):_0x54204c['body'][_0x4439('0x83')]=_0x389057[_0x4439('0x62')][_0x4439('0x83')];_0x54204c[_0x4439('0x62')]['body']=_0x389057[_0x4439('0x62')][_0x4439('0x2b')];_0x54204c[_0x4439('0x62')][_0x4439('0x86')]=_0x389057[_0x4439('0x62')][_0x4439('0x95')];break;}}if(_0x54204c[_0x4439('0x62')]['id']){delete _0x54204c['body']['id'];}if(_[_0x4439('0x96')](_0x54204c[_0x4439('0x62')][_0x4439('0x83')])){throw new db[(_0x4439('0x7e'))][(_0x4439('0x97'))]('from\x20is\x20mandatory');}if(_[_0x4439('0x96')](_0x54204c[_0x4439('0x62')][_0x4439('0x62')])||_0x54204c[_0x4439('0x62')][_0x4439('0x62')]===''){throw new db['Sequelize']['ValidationError'](_0x4439('0x98'));}if(_[_0x4439('0x96')](_0x54204c[_0x4439('0x62')]['mapKey'])){throw new db[(_0x4439('0x7e'))][(_0x4439('0x97'))](_0x4439('0x99')+_0x18ce8d);}if(!_[_0x4439('0x9a')](_0x18ce8d,_0x54204c['body']['mapKey'])){throw new db[(_0x4439('0x7e'))][(_0x4439('0x97'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18ce8d);}_0x14d476[_0x54204c['body'][_0x4439('0x9b')]]=_0x54204c['body'][_0x4439('0x83')];return db[_0x4439('0x9c')][_0x4439('0x60')]({'where':{'id':_0x54204c[_0x4439('0x79')][_0x4439('0x9d')]},'include':[{'model':db[_0x4439('0x7d')],'as':_0x4439('0x9e'),'where':_0x14d476,'limit':0x1,'order':[[_0x4439('0x80'),_0x4439('0x9f')]]}]});})['then'](handleEntityNotFound(_0x118115,null))[_0x4439('0x22')](function(_0x1e81eb){if(_0x1e81eb){_0x54204c[_0x4439('0xa0')]=_[_0x4439('0xa1')](_0x1e81eb,['Contacts']);if(_0x1e81eb[_0x4439('0x9e')]['length']){return _0x1e81eb['Contacts'][0x0];}var _0x408a93=_[_0x4439('0xa2')](_0x54204c[_0x4439('0x62')],{'firstName':_0x54204c[_0x4439('0x62')][_0x4439('0x83')],'ListId':_0x1e81eb['id']});_0x408a93[_0x54204c[_0x4439('0x62')][_0x4439('0x9b')]]=_0x54204c[_0x4439('0x62')][_0x4439('0x83')];return db[_0x4439('0x7d')]['create'](_0x408a93,{'fields':_0x374ca0,'raw':!![]});}})[_0x4439('0x22')](handleEntityNotFound(_0x118115,null))[_0x4439('0x22')](function(_0x2f6629){if(_0x2f6629){_0x54204c[_0x4439('0xa3')]=_0x2f6629;var _0x2c187f={'ContactId':_0x2f6629['id'],'phone':_0x54204c[_0x4439('0x62')][_0x4439('0x83')],'SmsAccountId':_0x389057[_0x4439('0x67')]['id']};var _0x4e14fd={'ContactId':_0x2f6629['id'],'SmsAccountId':_0x389057[_0x4439('0x67')]['id'],'closed':![]};return db[_0x4439('0xa4')][_0x4439('0x60')]({'where':_0x4e14fd})[_0x4439('0x22')](function(_0x43317f){if(_0x43317f){return[_0x43317f,![]];}return db[_0x4439('0xa4')][_0x4439('0x61')](_0x2c187f)[_0x4439('0x22')](function(_0x234667){return[_0x234667,!![]];});});}})[_0x4439('0xa5')](function(_0x4207c9,_0x444fc4){_0x54204c[_0x4439('0xa6')]=_0x4207c9[_0x4439('0x3c')]({'plain':!![]});_0x54204c['interaction'][_0x4439('0xa7')]=![];if(_0x444fc4){if(_0x54204c['account'][_0x4439('0xa8')]){_0x54204c[_0x4439('0xa9')][_0x4439('0xaa')]({'id':0x0,'priority':_0x54204c[_0x4439('0xa9')][_0x4439('0x50')]+0x1,'app':_0x4439('0xab'),'appdata':_0x4439('0xac'),'interval':_0x4439('0xad')});}_0x54204c['interaction'][_0x4439('0xa7')]=!![];}return db[_0x4439('0xae')][_0x4439('0x61')]({'phone':_0x54204c[_0x4439('0x62')][_0x4439('0x83')],'messageId':_0x54204c[_0x4439('0x62')]['messageId'],'body':_0x54204c[_0x4439('0x62')][_0x4439('0x62')],'SmsAccountId':_0x389057['params']['id'],'SmsInteractionId':_0x4207c9['id'],'direction':'in','ContactId':_0x4207c9['ContactId'],'AttachmentId':_0x54204c[_0x4439('0x62')][_0x4439('0xaf')]});})['then'](function(_0x58edb3){_0x54204c[_0x4439('0x2b')]=_0x58edb3;if(_0x54204c['interaction']['UserId']){return db[_0x4439('0xb0')][_0x4439('0x60')]({'attributes':['id',_0x4439('0x57')],'where':{'id':_0x54204c['interaction']['UserId']}})[_0x4439('0x22')](function(_0x3db6ad){if(_0x3db6ad){_0x54204c['applications'][_0x4439('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3db6ad['name']+','+(_0x54204c[_0x4439('0x79')][_0x4439('0xb2')]||0xa),'interval':_0x4439('0xad')});}return respondWithRpcPromise(_0x4439('0xb3'),_0x4439('0xb4'),_0x54204c);});}return respondWithRpcPromise(_0x4439('0xb3'),_0x4439('0xb4'),_0x54204c);})['then'](function(_0x45d6be){if(_0x45d6be){var _0x25ec49=0xc8;var _0x1ec982=_0x4439('0xb5');logger['info'](_0x4439('0x26'),_0x1ec982,_0x25ec49,_0x4439('0xb6'));logger[_0x4439('0x25')](_0x4439('0xb7'),_0x1ec982,_0x25ec49,'entity\x20found',JSON[_0x4439('0x28')](_0x45d6be));if(_0x54204c[_0x4439('0x79')]['type']===_0x4439('0xb8')){return _0x118115[_0x4439('0x2f')](_0x25ec49)[_0x4439('0x35')](_0x4439('0xb9'),_0x4439('0xba'))[_0x4439('0x40')](_0x4439('0xbb'));}else{return _0x118115['status'](_0x25ec49)['json'](_0x45d6be);}}})[_0x4439('0x2d')](handleError(_0x118115,null));};exports[_0x4439('0xbc')]=function(_0x143de9,_0xbd3dce){var _0x4099ec=_0x143de9[_0x4439('0x67')]['id'];var _0x417d82=_0x143de9['body'];var _0x4750f9=0xc8;var _0x147506=null;return db[_0x4439('0xbd')]['transaction']({'isolationLevel':db[_0x4439('0xbd')][_0x4439('0xbe')]['ISOLATION_LEVELS'][_0x4439('0xbf')]},function(_0x54baab){return db[_0x4439('0x44')][_0x4439('0x73')]({'where':{'id':_0x4099ec},'transaction':_0x54baab})['then'](function(_0x55c5e1){if(_0x55c5e1){return db[_0x4439('0x77')]['destroy']({'where':{'SmsAccountId':_0x4099ec},'transaction':_0x54baab})['then'](function(){var _0x2e4a10=_['map'](_0x417d82,function(_0x56fc62){_0x56fc62[_0x4439('0x6a')]=_0x4099ec;return _0x56fc62;});return db[_0x4439('0x77')][_0x4439('0xc0')](_0x2e4a10,{'transaction':_0x54baab});});}else{_0x4750f9=0x194;_0x147506=[];}});})['then'](function(){if(_0x4750f9!==0x194){return db[_0x4439('0x77')][_0x4439('0xc1')]({'where':{'SmsAccountId':_0x4099ec},'order':_0x4439('0x7b')})[_0x4439('0x22')](function(_0x205574){_0x147506=_0x205574;});}})['catch'](function(_0x309195){_0x4750f9=0x1f4;logger['error'](_0x309195[_0x4439('0x3f')]);if(_0x309195[_0x4439('0x57')]){delete _0x309195['name'];}_0x147506=_0x309195;})[_0x4439('0xc2')](function(){if(_0x147506===null){_0xbd3dce['sendStatus'](_0x4750f9);}else{if(_0x4750f9===0x1f4){_0xbd3dce[_0x4439('0x2f')](_0x4750f9)[_0x4439('0x40')](_0x147506);}else{_0xbd3dce['status'](_0x4750f9)['json'](_0x147506);}}});};exports[_0x4439('0xc3')]=function(_0x4b968f,_0x139ef8,_0x2870af){var _0x4abb00={};var _0x19e900={};var _0x5455db;var _0x181e06;return db[_0x4439('0x44')]['findOne']({'where':{'id':_0x4b968f['params']['id']}})['then'](handleEntityNotFound(_0x139ef8,null))[_0x4439('0x22')](function(_0x122b88){if(_0x122b88){_0x5455db=_0x122b88;_0x19e900[_0x4439('0x4c')]=_[_0x4439('0x4a')](db['SmsApplication'][_0x4439('0x5e')]);_0x19e900[_0x4439('0x49')]=_[_0x4439('0x4a')](_0x4b968f[_0x4439('0x49')]);_0x19e900[_0x4439('0x4b')]=_[_0x4439('0x4e')](_0x19e900[_0x4439('0x4c')],_0x19e900[_0x4439('0x49')]);_0x4abb00[_0x4439('0x4d')]=_[_0x4439('0x4e')](_0x19e900[_0x4439('0x4c')],qs[_0x4439('0x4f')](_0x4b968f[_0x4439('0x49')]['fields']));_0x4abb00[_0x4439('0x4d')]=_0x4abb00['attributes'][_0x4439('0x50')]?_0x4abb00['attributes']:_0x19e900['model'];_0x4abb00[_0x4439('0x51')]=qs['sort'](_0x4b968f['query'][_0x4439('0x52')]);_0x4abb00['where']=qs[_0x4439('0x4b')](_[_0x4439('0x54')](_0x4b968f[_0x4439('0x49')],_0x19e900[_0x4439('0x4b')]));if(_0x4b968f['query'][_0x4439('0x58')]){_0x4abb00[_0x4439('0x53')]=_[_0x4439('0x55')](_0x4abb00['where'],{'$or':_[_0x4439('0x48')](_0x4abb00[_0x4439('0x4d')],function(_0x1f161c){var _0x3c678c={};_0x3c678c[_0x1f161c]={'$like':'%'+_0x4b968f['query'][_0x4439('0x58')]+'%'};return _0x3c678c;})});}_0x4abb00=_['merge']({},_0x4abb00,_0x4b968f[_0x4439('0x59')]);return _0x5455db[_0x4439('0xc3')](_0x4abb00);}})['then'](function(_0x14b0e3){if(_0x14b0e3){_0x181e06=_0x14b0e3[_0x4439('0x50')];if(!_0x4b968f[_0x4439('0x49')]['hasOwnProperty'](_0x4439('0x6d'))){_0x4abb00[_0x4439('0x32')]=qs['limit'](_0x4b968f[_0x4439('0x49')][_0x4439('0x32')]);_0x4abb00[_0x4439('0x34')]=qs[_0x4439('0x34')](_0x4b968f[_0x4439('0x49')][_0x4439('0x34')]);}return _0x5455db['getApplications'](_0x4abb00);}})[_0x4439('0x22')](function(_0x247843){if(_0x247843){return _0x247843?{'count':_0x181e06,'rows':_0x247843}:null;}})[_0x4439('0x22')](respondWithResult(_0x139ef8,null))[_0x4439('0x2d')](handleError(_0x139ef8,null));};exports[_0x4439('0xc4')]=function(_0x2c501d,_0x51e439,_0x19660f){var _0x170c39={'raw':![],'where':{}};var _0x7ca7bb={};var _0x558bd1={'count':0x0,'rows':[]};return db[_0x4439('0x44')]['findOne']({'where':{'id':_0x2c501d[_0x4439('0x67')]['id']}})['then'](handleEntityNotFound(_0x51e439,null))['then'](function(_0x415275){if(_0x415275){_0x7ca7bb[_0x4439('0x4c')]=_['keys'](db[_0x4439('0xa4')][_0x4439('0x5e')]);_0x7ca7bb[_0x4439('0x49')]=_[_0x4439('0x4a')](_0x2c501d['query']);_0x7ca7bb[_0x4439('0x4b')]=_[_0x4439('0x4e')](_0x7ca7bb['model'],_0x7ca7bb['query']);_0x170c39['attributes']=_['intersection'](_0x7ca7bb['model'],qs['fields'](_0x2c501d[_0x4439('0x49')][_0x4439('0x4f')]));_0x170c39[_0x4439('0x4d')]=_0x170c39[_0x4439('0x4d')]['length']?_0x170c39[_0x4439('0x4d')]:_0x7ca7bb['model'];if(!_0x2c501d[_0x4439('0x49')][_0x4439('0x6c')](_0x4439('0x6d'))){_0x170c39[_0x4439('0x32')]=qs['limit'](_0x2c501d[_0x4439('0x49')][_0x4439('0x32')]);_0x170c39[_0x4439('0x34')]=qs[_0x4439('0x34')](_0x2c501d[_0x4439('0x49')]['offset']);}_0x170c39[_0x4439('0x51')]=qs[_0x4439('0x52')](_0x2c501d[_0x4439('0x49')][_0x4439('0x52')]);_0x170c39['where']=qs[_0x4439('0x4b')](_['pick'](_0x2c501d[_0x4439('0x49')],_0x7ca7bb[_0x4439('0x4b')]));_0x170c39[_0x4439('0x53')][_0x4439('0x6a')]=_0x415275['id'];if(_0x2c501d[_0x4439('0x49')]['filter']){_0x170c39['where']=_[_0x4439('0x55')](_0x170c39['where'],{'$or':_[_0x4439('0x48')](_0x170c39[_0x4439('0x4d')],function(_0xe76463){var _0x1f4e79={};_0x1f4e79[_0xe76463]={'$like':'%'+_0x2c501d[_0x4439('0x49')][_0x4439('0x58')]+'%'};return _0x1f4e79;})});}_0x170c39=_[_0x4439('0x55')]({},_0x170c39,_0x2c501d[_0x4439('0x59')]);return db[_0x4439('0xa4')][_0x4439('0x33')]({'where':_0x170c39[_0x4439('0x53')]})[_0x4439('0x22')](function(_0x45853d){_0x558bd1['count']=_0x45853d;if(_0x2c501d[_0x4439('0x49')][_0x4439('0x5a')]){_0x170c39[_0x4439('0x5f')]=[{'model':db['CmContact'],'as':_0x4439('0xc5'),'required':![]},{'model':db[_0x4439('0xb0')],'as':'Owner','attributes':[_0x4439('0x57'),_0x4439('0xc6'),_0x4439('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x4439('0xc8'),'attributes':['id',_0x4439('0x57'),_0x4439('0xc9')],'where':_0x2c501d[_0x4439('0x49')][_0x4439('0xca')]?{'id':_0x2c501d[_0x4439('0x49')][_0x4439('0xca')]}:undefined,'required':_0x2c501d[_0x4439('0x49')][_0x4439('0xca')]?!![]:![]}];}return db[_0x4439('0xa4')]['findAll'](_0x170c39);})[_0x4439('0x22')](function(_0x563069){_0x558bd1[_0x4439('0x5c')]=_0x563069;return _0x558bd1;});}})[_0x4439('0x22')](respondWithFilteredResult(_0x51e439,_0x170c39))[_0x4439('0x2d')](handleError(_0x51e439,null));};exports['send']=function(_0x5f50ba,_0x49c2de,_0x298f02){var _0x1bcb44,_0x11dd58,_0x3349c1;if(_['isNil'](_0x5f50ba[_0x4439('0x62')][_0x4439('0x62')])||_0x5f50ba[_0x4439('0x62')][_0x4439('0x62')]===''){throw new db[(_0x4439('0x7e'))][(_0x4439('0x97'))](_0x4439('0x98'));}if(_['isNil'](_0x5f50ba['body']['to'])){throw new db[(_0x4439('0x7e'))]['ValidationError'](_0x4439('0xcb'));}_0x1bcb44=_0x5f50ba['body']['to'];return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x5f50ba['params']['id']},'include':[{'model':db['CmList'],'as':_0x4439('0xcc'),'include':[{'model':db[_0x4439('0x7d')],'as':_0x4439('0x9e'),'where':{'mobile':_0x1bcb44},'limit':0x1,'order':[['updatedAt',_0x4439('0x9f')]]}]}]})[_0x4439('0x22')](handleEntityNotFound(_0x49c2de,null))['then'](function(_0x4d6653){if(_0x4d6653&&_0x4d6653[_0x4439('0xcc')]){_0x11dd58=_0x4d6653['get']({'plain':!![]});if(_0x11dd58[_0x4439('0xcc')]&&_0x11dd58[_0x4439('0xcc')][_0x4439('0x9e')]['length']){return _0x11dd58['List'][_0x4439('0x9e')][0x0];}return db[_0x4439('0x7d')]['create'](_[_0x4439('0xa2')](_0x5f50ba[_0x4439('0x62')],{'firstName':_0x1bcb44,'mobile':_0x1bcb44,'phone':_0x1bcb44,'ListId':_0x11dd58[_0x4439('0x9d')]}));}})[_0x4439('0x22')](handleEntityNotFound(_0x49c2de,null))[_0x4439('0x22')](function(_0x1c7bdd){if(_0x1c7bdd){_0x3349c1=_0x1c7bdd;return db[_0x4439('0xa4')][_0x4439('0x60')]({'where':{'ContactId':_0x3349c1['id'],'closed':![],'SmsAccountId':_0x11dd58['id']}})[_0x4439('0x22')](function(_0x47b755){if(_0x47b755){return[_0x47b755,![]];}return db['SmsInteraction']['create']({'UserId':_0x5f50ba['user']['id'],'ContactId':_0x3349c1['id'],'SmsAccountId':_0x11dd58['id'],'phone':_0x1bcb44,'firstMsgDirection':_0x4439('0xcd'),'Messages':[_[_0x4439('0x55')](_0x5f50ba[_0x4439('0x62')],{'read':![],'body':_0x5f50ba[_0x4439('0x62')]['body'],'phone':_0x1bcb44,'SmsAccountId':_0x11dd58['id'],'UserId':_0x5f50ba[_0x4439('0x63')]['id'],'ContactId':_0x3349c1['id']})]},{'include':[{'model':db[_0x4439('0xae')],'as':_0x4439('0xce')}]})[_0x4439('0x22')](function(_0xba32e9){return[_0xba32e9,!![]];});});}})['spread'](function(_0x4cde39,_0x4996fa){if(_0x4996fa){return _0x4cde39;}return db[_0x4439('0xae')][_0x4439('0x61')](_['merge'](_0x5f50ba[_0x4439('0x62')],{'read':![],'body':_0x5f50ba['body'][_0x4439('0x62')],'phone':_0x1bcb44,'SmsAccountId':_0x11dd58['id'],'SmsInteractionId':_0x4cde39['id'],'UserId':_0x5f50ba[_0x4439('0x63')]['id'],'ContactId':_0x3349c1['id']}))[_0x4439('0x22')](function(_0x3bae56){_0x4cde39['dataValues'][_0x4439('0xce')]=[];_0x4cde39[_0x4439('0xcf')][_0x4439('0xce')]['push'](_0x3bae56[_0x4439('0xcf')]);return _0x4cde39;});})[_0x4439('0x22')](respondWithResult(_0x49c2de,null))[_0x4439('0x2d')](handleError(_0x49c2de,null));};exports[_0x4439('0x2f')]=function(_0x42f91f,_0x453ddd,_0x2539c5){if(_0x42f91f[_0x4439('0x62')]['id']){delete _0x42f91f[_0x4439('0x62')]['id'];}var _0x14beac,_0x54dfa7,_0x150c66;return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x42f91f[_0x4439('0x67')]['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x453ddd,null))[_0x4439('0x22')](function(_0x20d2ad){if(_0x20d2ad){_0x150c66=_0x20d2ad;logger['debug'](_0x4439('0x26'),_0x4439('0x2f'),'received\x20delivery\x20report\x20from',_0x20d2ad[_0x4439('0x46')],util[_0x4439('0xd0')](_0x42f91f[_0x4439('0x62')],{'showHidden':![],'depth':null}));switch(_0x20d2ad[_0x4439('0x46')]){case _0x4439('0xd1'):if(_0x42f91f[_0x4439('0x62')][_0x4439('0xd2')]&&_0x42f91f[_0x4439('0x62')][_0x4439('0x2f')]){_0x54dfa7=_0x42f91f['body'][_0x4439('0x2f')];return db[_0x4439('0xae')][_0x4439('0x60')]({'where':{'messageId':_0x42f91f[_0x4439('0x62')]['skebby_dispatch_id']}});}break;case _0x4439('0x89'):if(_0x42f91f[_0x4439('0x62')][_0x4439('0xd3')]&&_0x42f91f[_0x4439('0x62')]['statusInt']){_0x54dfa7=_0x42f91f[_0x4439('0x62')][_0x4439('0xd4')];return db['SmsMessage'][_0x4439('0x60')]({'where':{'messageId':_0x42f91f[_0x4439('0x62')][_0x4439('0xd3')]}});}break;case _0x4439('0xd5'):if(_0x42f91f[_0x4439('0x62')]['message_id']&&_0x42f91f['body'][_0x4439('0xd6')]){_0x54dfa7=_0x42f91f[_0x4439('0x62')]['status_code'];return db[_0x4439('0xae')][_0x4439('0x60')]({'where':{'messageId':_0x42f91f[_0x4439('0x62')][_0x4439('0x8a')]}});}break;case _0x4439('0x8c'):var _0x4954d1=_0x42f91f['body'][_0x4439('0x8d')][0x0];if(_0x4954d1[_0x4439('0x86')]&&_0x4954d1[_0x4439('0x2f')][_0x4439('0xd7')]===_0x4439('0xd8')){_0x54dfa7=_0x4954d1[_0x4439('0x2f')]['groupName'];return db[_0x4439('0xae')]['find']({'where':{'messageId':_0x4954d1[_0x4439('0x86')]}});}break;case _0x4439('0x90'):if(_0x42f91f[_0x4439('0x62')][_0x4439('0x86')]&&_0x42f91f[_0x4439('0x62')][_0x4439('0x2f')]){_0x54dfa7=_0x42f91f[_0x4439('0x62')]['status'];return db[_0x4439('0xae')][_0x4439('0x60')]({'where':{'messageId':_0x42f91f[_0x4439('0x62')][_0x4439('0x86')]}});}break;case'bandwidth':if(_0x42f91f[_0x4439('0x62')][0x0][_0x4439('0x2b')]['id']){_0x54dfa7=_0x42f91f[_0x4439('0x62')][0x0][_0x4439('0x46')];return db['SmsMessage'][_0x4439('0x60')]({'where':{'messageId':_0x42f91f[_0x4439('0x62')][0x0]['message']['id']}});}break;case _0x4439('0x94'):if(_0x42f91f[_0x4439('0x62')][_0x4439('0xd9')]&&_0x42f91f[_0x4439('0x62')]['status']){_0x54dfa7=_0x42f91f[_0x4439('0x62')][_0x4439('0x2f')];return db[_0x4439('0xae')][_0x4439('0x60')]({'where':{'messageId':_0x42f91f[_0x4439('0x62')][_0x4439('0xd9')]}});}break;}}})[_0x4439('0x22')](handleEntityNotFound(_0x453ddd,null))[_0x4439('0x22')](function(_0x537a54){if(_0x537a54){_0x14beac=_0x537a54;switch(_0x150c66[_0x4439('0x46')]){case _0x4439('0xd1'):if(_0x54dfa7===_0x4439('0xd8')){return _0x14beac[_0x4439('0x3b')]({'read':!![]});}else{logger[_0x4439('0x29')](_0x4439('0x26'),'status','skebby',util[_0x4439('0xd0')](_0x42f91f[_0x4439('0x62')],{'showHidden':![],'depth':null}));}break;case _0x4439('0x89'):if(_0x54dfa7==='1'){return _0x14beac[_0x4439('0x3b')]({'read':!![]});}else{logger[_0x4439('0x29')](_0x4439('0x26'),_0x4439('0x2f'),_0x4439('0xd1'),util[_0x4439('0xd0')](_0x42f91f[_0x4439('0x62')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x42f91f[_0x4439('0x62')][_0x4439('0xda')]&&_0x54dfa7>=0xc8&&_0x54dfa7<=0xce){return _0x14beac[_0x4439('0x3b')]({'read':!![]});}else{logger['error'](_0x4439('0x26'),_0x4439('0x2f'),_0x4439('0xd5'),util[_0x4439('0xd0')](_0x42f91f['body'],{'showHidden':![],'depth':null}));}break;case _0x4439('0x8c'):var _0x1b331c=_0x42f91f[_0x4439('0x62')][_0x4439('0x8d')][0x0];if(_0x1b331c[_0x4439('0x2f')][_0x4439('0xd7')]===_0x4439('0xd8')){return _0x14beac[_0x4439('0x3b')]({'read':!![]});}else{logger[_0x4439('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4439('0x2f'),_0x4439('0x8c'),util[_0x4439('0xd0')](_0x42f91f[_0x4439('0x62')],{'showHidden':![],'depth':null}));}break;case _0x4439('0x90'):if(_0x54dfa7==_0x4439('0xdb')||_0x54dfa7==_0x4439('0xdc')){return _0x14beac[_0x4439('0x3b')]({'read':!![]});}else{logger[_0x4439('0x29')](_0x4439('0x26'),_0x4439('0x2f'),_0x4439('0x90'),util[_0x4439('0xd0')](_0x42f91f[_0x4439('0x62')],{'showHidden':![],'depth':null}));}break;case _0x4439('0x93'):if(_0x54dfa7=='message-delivered'){return _0x14beac[_0x4439('0x3b')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4439('0x2f'),_0x4439('0x93'),util['inspect'](_0x42f91f[_0x4439('0x62')],{'showHidden':![],'depth':null}));}break;case _0x4439('0x94'):if(_0x54dfa7===_0x4439('0xdd')||_0x54dfa7==='ACCEPTD'){return _0x14beac['update']({'read':!![]});}else{logger[_0x4439('0x29')](_0x4439('0x26'),'status',_0x4439('0x94'),util[_0x4439('0xd0')](_0x42f91f['body'],{'showHidden':![],'depth':null}));}break;}return _0x14beac;}})[_0x4439('0x22')](respondWithResult(_0x453ddd,null))[_0x4439('0x2d')](handleError(_0x453ddd,null));};exports['statusGet']=function(_0x3563f3,_0xe7d9c7,_0x66211d){var _0x568752,_0x167463,_0x48c2d2;return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x3563f3['params']['id']}})['then'](handleEntityNotFound(_0xe7d9c7,null))[_0x4439('0x22')](function(_0x5dff11){if(_0x5dff11){_0x48c2d2=_0x5dff11;logger[_0x4439('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4439('0x2f'),_0x4439('0xde'),_0x5dff11['type'],util[_0x4439('0xd0')](_0x3563f3['query'],{'showHidden':![],'depth':null}));switch(_0x5dff11[_0x4439('0x46')]){case _0x4439('0x8f'):if(_0x3563f3[_0x4439('0x49')][_0x4439('0xdf')]&&_0x3563f3['query'][_0x4439('0xe0')]){_0x167463=_0x3563f3[_0x4439('0x49')][_0x4439('0xe0')];return db[_0x4439('0xae')][_0x4439('0x60')]({'where':{'messageId':_0x3563f3['query']['message-id']}});}break;}}})[_0x4439('0x22')](handleEntityNotFound(_0xe7d9c7,null))[_0x4439('0x22')](function(_0x1304bf){if(_0x1304bf){_0x568752=_0x1304bf;switch(_0x48c2d2[_0x4439('0x46')]){case _0x4439('0x8f'):if(_0x167463==='2'||_0x167463==='6'){return _0x568752['update']({'read':!![]});}else{logger[_0x4439('0x29')](_0x4439('0x26'),_0x4439('0x2f'),_0x4439('0x8f'),util[_0x4439('0xd0')](_0x3563f3[_0x4439('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x568752;}})[_0x4439('0x22')](respondWithResult(_0xe7d9c7,null))['catch'](handleError(_0xe7d9c7,null));};exports[_0x4439('0xe1')]=function(_0x27b51a,_0x1c3632,_0x4a2fbe){return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x27b51a[_0x4439('0x67')]['id']}})['then'](handleEntityNotFound(_0x1c3632,null))[_0x4439('0x22')](function(_0x583f38){if(_0x583f38){return _0x583f38[_0x4439('0xe1')](_0x27b51a[_0x4439('0x62')][_0x4439('0x6f')],_['omit'](_0x27b51a[_0x4439('0x62')],[_0x4439('0x6f'),'id'])||{})['spread'](function(_0x167439){for(var _0x4b759e=0x0;_0x4b759e<_0x27b51a[_0x4439('0x62')][_0x4439('0x6f')][_0x4439('0x50')];_0x4b759e+=0x1){socket[_0x4439('0xe2')](_0x4439('0xe3'),{'UserId':Number(_0x27b51a[_0x4439('0x62')][_0x4439('0x6f')][_0x4b759e]),'SmsAccountId':Number(_0x27b51a[_0x4439('0x67')]['id'])});}return _0x167439;});}})['then'](respondWithResult(_0x1c3632,null))[_0x4439('0x2d')](handleError(_0x1c3632,null));};exports[_0x4439('0xe4')]=function(_0x14c7b6,_0x4af3b8,_0xd49fc4){return db[_0x4439('0x44')][_0x4439('0x60')]({'where':{'id':_0x14c7b6[_0x4439('0x67')]['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x4af3b8,null))[_0x4439('0x22')](function(_0x18062e){if(_0x18062e){return _0x18062e[_0x4439('0xe4')](_0x14c7b6[_0x4439('0x49')][_0x4439('0x6f')])[_0x4439('0x22')](function(){if(_[_0x4439('0xe5')](_0x14c7b6['query'][_0x4439('0x6f')])){for(var _0x3bf1ab=0x0;_0x3bf1ab<_0x14c7b6[_0x4439('0x49')][_0x4439('0x6f')][_0x4439('0x50')];_0x3bf1ab+=0x1){socket[_0x4439('0xe2')](_0x4439('0xe6'),{'UserId':Number(_0x14c7b6['query'][_0x4439('0x6f')][_0x3bf1ab]),'SmsAccountId':Number(_0x14c7b6[_0x4439('0x67')]['id'])});}}else{socket[_0x4439('0xe2')](_0x4439('0xe6'),{'UserId':Number(_0x14c7b6[_0x4439('0x49')][_0x4439('0x6f')]),'SmsAccountId':Number(_0x14c7b6[_0x4439('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x4af3b8,null))[_0x4439('0x2d')](handleError(_0x4af3b8,null));};exports['getAgents']=function(_0x290ce5,_0x3bdfd8,_0x1aaf4f){var _0x59e20e={};var _0x10d617={};var _0x28712a;var _0x3e76a4;return db[_0x4439('0x44')]['findOne']({'where':{'id':_0x290ce5['params']['id']}})[_0x4439('0x22')](handleEntityNotFound(_0x3bdfd8,null))[_0x4439('0x22')](function(_0x448acd){if(_0x448acd){_0x28712a=_0x448acd;_0x10d617[_0x4439('0x4c')]=_[_0x4439('0x4a')](db[_0x4439('0xb0')][_0x4439('0x5e')]);_0x10d617[_0x4439('0x49')]=_[_0x4439('0x4a')](_0x290ce5[_0x4439('0x49')]);_0x10d617[_0x4439('0x4b')]=_[_0x4439('0x4e')](_0x10d617['model'],_0x10d617['query']);_0x59e20e[_0x4439('0x4d')]=_['intersection'](_0x10d617[_0x4439('0x4c')],qs[_0x4439('0x4f')](_0x290ce5[_0x4439('0x49')]['fields']));_0x59e20e[_0x4439('0x4d')]=_0x59e20e[_0x4439('0x4d')][_0x4439('0x50')]?_0x59e20e['attributes']:_0x10d617[_0x4439('0x4c')];_0x59e20e[_0x4439('0x51')]=qs[_0x4439('0x52')](_0x290ce5[_0x4439('0x49')]['sort']);_0x59e20e[_0x4439('0x53')]=qs[_0x4439('0x4b')](_['pick'](_0x290ce5['query'],_0x10d617['filters']));if(_0x290ce5[_0x4439('0x49')][_0x4439('0x58')]){_0x59e20e[_0x4439('0x53')]=_[_0x4439('0x55')](_0x59e20e['where'],{'$or':_[_0x4439('0x48')](_0x59e20e[_0x4439('0x4d')],function(_0xbde989){var _0x4225e8={};_0x4225e8[_0xbde989]={'$like':'%'+_0x290ce5[_0x4439('0x49')]['filter']+'%'};return _0x4225e8;})});}_0x59e20e=_[_0x4439('0x55')]({},_0x59e20e,_0x290ce5[_0x4439('0x59')]);return _0x28712a[_0x4439('0xe7')](_0x59e20e);}})[_0x4439('0x22')](function(_0x2ec077){if(_0x2ec077){_0x3e76a4=_0x2ec077[_0x4439('0x50')];if(!_0x290ce5[_0x4439('0x49')][_0x4439('0x6c')](_0x4439('0x6d'))){_0x59e20e[_0x4439('0x32')]=qs[_0x4439('0x32')](_0x290ce5[_0x4439('0x49')][_0x4439('0x32')]);_0x59e20e[_0x4439('0x34')]=qs[_0x4439('0x34')](_0x290ce5['query'][_0x4439('0x34')]);}return _0x28712a[_0x4439('0xe7')](_0x59e20e);}})[_0x4439('0x22')](function(_0x1ee395){if(_0x1ee395){return _0x1ee395?{'count':_0x3e76a4,'rows':_0x1ee395}:null;}})[_0x4439('0x22')](respondWithResult(_0x3bdfd8,null))[_0x4439('0x2d')](handleError(_0x3bdfd8,null));}; \ No newline at end of file +var _0xd5d2=['code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','SmsAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','ids','notify','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','Body','messageId','MessageSid','from','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','originatingAddress','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','text/xml','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','List','ListId','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','redif','skebby','DELIVERED','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xd5d2,0xbf));var _0x2d5d=function(_0x575ca3,_0x39bf0d){_0x575ca3=_0x575ca3-0x0;var _0xb349a0=_0xd5d2[_0x575ca3];return _0xb349a0;};'use strict';var emlformat=require(_0x2d5d('0x0'));var rimraf=require(_0x2d5d('0x1'));var zipdir=require(_0x2d5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d5d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d5d('0x4'));var util=require(_0x2d5d('0x5'));var path=require('path');var sox=require(_0x2d5d('0x6'));var csv=require(_0x2d5d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d5d('0x8'));var _=require(_0x2d5d('0x9'));var squel=require(_0x2d5d('0xa'));var crypto=require(_0x2d5d('0xb'));var jsforce=require(_0x2d5d('0xc'));var deskjs=require(_0x2d5d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d5d('0xe'));var Redis=require(_0x2d5d('0xf'));var authService=require(_0x2d5d('0x10'));var qs=require(_0x2d5d('0x11'));var as=require(_0x2d5d('0x12'));var hardwareService=require(_0x2d5d('0x13'));var logger=require(_0x2d5d('0x14'))(_0x2d5d('0x15'));var utils=require(_0x2d5d('0x16'));var config=require(_0x2d5d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d5d('0x18'))['db'];config[_0x2d5d('0x19')]=_[_0x2d5d('0x1a')](config[_0x2d5d('0x19')],{'host':_0x2d5d('0x1b'),'port':0x18eb});var socket=require(_0x2d5d('0x1c'))(new Redis(config[_0x2d5d('0x19')]));require('./smsAccount.socket')[_0x2d5d('0x1d')](socket);var jayson=require(_0x2d5d('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x4ff3ad,_0x5ac11e,_0x20d7b0,_0x576f0f){return new BPromise(function(_0x2aea26,_0xe245d5){var _0x5e8a0e=_0x576f0f||client;return _0x5e8a0e[_0x2d5d('0x1f')](_0x4ff3ad,_0x20d7b0)[_0x2d5d('0x20')](function(_0x1eea81){logger[_0x2d5d('0x21')](_0x2d5d('0x22'),_0x5ac11e,_0x2d5d('0x23'));logger[_0x2d5d('0x24')](_0x2d5d('0x25'),_0x5ac11e,_0x2d5d('0x23'),JSON[_0x2d5d('0x26')](_0x1eea81));if(_0x1eea81['error']){if(_0x1eea81[_0x2d5d('0x27')][_0x2d5d('0x28')]===0x1f4){logger[_0x2d5d('0x27')](_0x2d5d('0x22'),_0x5ac11e,_0x1eea81['error'][_0x2d5d('0x29')]);return _0xe245d5(_0x1eea81['error']['message']);}logger[_0x2d5d('0x27')]('SmsAccount,\x20%s,\x20%s',_0x5ac11e,_0x1eea81[_0x2d5d('0x27')][_0x2d5d('0x29')]);return _0x2aea26(_0x1eea81[_0x2d5d('0x27')][_0x2d5d('0x29')]);}else{logger[_0x2d5d('0x21')](_0x2d5d('0x22'),_0x5ac11e,_0x2d5d('0x23'));_0x2aea26(_0x1eea81['result'][_0x2d5d('0x29')]);}})[_0x2d5d('0x2a')](function(_0x32959d){logger['error'](_0x2d5d('0x22'),_0x5ac11e,_0x32959d);_0xe245d5(_0x32959d);});});}function respondWithStatusCode(_0x583c54,_0x5f5736){_0x5f5736=_0x5f5736||0xcc;return function(_0x221e70){if(_0x221e70){return _0x583c54[_0x2d5d('0x2b')](_0x5f5736);}return _0x583c54[_0x2d5d('0x2c')](_0x5f5736)[_0x2d5d('0x2d')]();};}function respondWithResult(_0x7e2eb,_0x5b5bc3){_0x5b5bc3=_0x5b5bc3||0xc8;return function(_0x1a7c2b){if(_0x1a7c2b){return _0x7e2eb[_0x2d5d('0x2c')](_0x5b5bc3)[_0x2d5d('0x2e')](_0x1a7c2b);}};}function respondWithFilteredResult(_0x48b4f5,_0x2781df){return function(_0x278cd6){if(_0x278cd6){var _0x51173a=typeof _0x2781df['offset']===_0x2d5d('0x2f')&&typeof _0x2781df[_0x2d5d('0x30')]===_0x2d5d('0x2f');var _0x4f0935=_0x278cd6[_0x2d5d('0x31')];var _0x31b30f=_0x51173a?0x0:_0x2781df[_0x2d5d('0x32')];var _0x1e7ffa=_0x51173a?_0x278cd6['count']:_0x2781df[_0x2d5d('0x32')]+_0x2781df[_0x2d5d('0x30')];var _0x246482;if(_0x1e7ffa>=_0x4f0935){_0x1e7ffa=_0x4f0935;_0x246482=0xc8;}else{_0x246482=0xce;}_0x48b4f5['status'](_0x246482);return _0x48b4f5['set'](_0x2d5d('0x33'),_0x31b30f+'-'+_0x1e7ffa+'/'+_0x4f0935)['json'](_0x278cd6);}return null;};}function patchUpdates(_0x2ad82c){return function(_0x574f4e){try{jsonpatch[_0x2d5d('0x34')](_0x574f4e,_0x2ad82c,!![]);}catch(_0x3097e5){return BPromise['reject'](_0x3097e5);}return _0x574f4e['save']();};}function saveUpdates(_0x3d5297,_0x274c30){return function(_0x49fb7a){if(_0x49fb7a){return _0x49fb7a[_0x2d5d('0x35')](_0x3d5297)['then'](function(_0x4f5a1b){return _0x4f5a1b;});}return null;};}function removeEntity(_0x38b8a7,_0x180dd3){return function(_0x171a65){if(_0x171a65){return _0x171a65[_0x2d5d('0x36')]()['then'](function(){var _0x18ebe7=_0x171a65[_0x2d5d('0x37')]({'plain':!![]});var _0x53877a=_0x2d5d('0x38');return db[_0x2d5d('0x39')][_0x2d5d('0x36')]({'where':{'type':_0x53877a,'resourceId':_0x18ebe7['id']}})[_0x2d5d('0x20')](function(){return _0x171a65;});})[_0x2d5d('0x20')](function(){_0x38b8a7[_0x2d5d('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb17c,_0x45b713){return function(_0x27fbe5){if(!_0x27fbe5){_0x4fb17c[_0x2d5d('0x2b')](0x194);}return _0x27fbe5;};}function handleError(_0x27231b,_0x3e198b){_0x3e198b=_0x3e198b||0x1f4;return function(_0x3fbab0){logger[_0x2d5d('0x27')](_0x3fbab0[_0x2d5d('0x3a')]);if(_0x3fbab0[_0x2d5d('0x3b')]){delete _0x3fbab0['name'];}_0x27231b[_0x2d5d('0x2c')](_0x3e198b)[_0x2d5d('0x3c')](_0x3fbab0);};}exports[_0x2d5d('0x3d')]=function(_0x11cf9e,_0x2c6781){var _0x5bb420={'include':[{'model':db[_0x2d5d('0x3e')],'as':'mandatoryDispositionPause'}]},_0x2e1923={},_0x414321={'count':0x0,'rows':[]};var _0x2227da=_[_0x2d5d('0x3f')](db['SmsAccount'][_0x2d5d('0x40')],function(_0x5f345d){return{'name':_0x5f345d[_0x2d5d('0x41')],'type':_0x5f345d[_0x2d5d('0x42')][_0x2d5d('0x43')]};});_0x2e1923[_0x2d5d('0x44')]=_['map'](_0x2227da,_0x2d5d('0x3b'));_0x2e1923[_0x2d5d('0x45')]=_[_0x2d5d('0x46')](_0x11cf9e['query']);_0x2e1923[_0x2d5d('0x47')]=_['intersection'](_0x2e1923[_0x2d5d('0x44')],_0x2e1923[_0x2d5d('0x45')]);_0x5bb420[_0x2d5d('0x48')]=_[_0x2d5d('0x49')](_0x2e1923[_0x2d5d('0x44')],qs[_0x2d5d('0x4a')](_0x11cf9e[_0x2d5d('0x45')][_0x2d5d('0x4a')]));_0x5bb420[_0x2d5d('0x48')]=_0x5bb420[_0x2d5d('0x48')][_0x2d5d('0x4b')]?_0x5bb420[_0x2d5d('0x48')]:_0x2e1923['model'];if(!_0x11cf9e['query'][_0x2d5d('0x4c')](_0x2d5d('0x4d'))){_0x5bb420[_0x2d5d('0x30')]=qs['limit'](_0x11cf9e['query'][_0x2d5d('0x30')]);_0x5bb420['offset']=qs[_0x2d5d('0x32')](_0x11cf9e['query'][_0x2d5d('0x32')]);}_0x5bb420['order']=qs[_0x2d5d('0x4e')](_0x11cf9e[_0x2d5d('0x45')][_0x2d5d('0x4e')]);_0x5bb420['where']=qs['filters'](_[_0x2d5d('0x4f')](_0x11cf9e[_0x2d5d('0x45')],_0x2e1923['filters']),_0x2227da);if(_0x11cf9e[_0x2d5d('0x45')][_0x2d5d('0x50')]){_0x5bb420[_0x2d5d('0x51')]=_[_0x2d5d('0x52')](_0x5bb420[_0x2d5d('0x51')],{'$or':_[_0x2d5d('0x3f')](_0x2227da,function(_0x51fdef){if(_0x51fdef['type']!=='VIRTUAL'){var _0x407e11={};_0x407e11[_0x51fdef['name']]={'$like':'%'+_0x11cf9e[_0x2d5d('0x45')][_0x2d5d('0x50')]+'%'};return _0x407e11;}})});}_0x5bb420=_[_0x2d5d('0x52')]({},_0x5bb420,_0x11cf9e[_0x2d5d('0x53')]);var _0x13ef2e={'where':_0x5bb420[_0x2d5d('0x51')]};return db[_0x2d5d('0x54')]['count'](_0x13ef2e)[_0x2d5d('0x20')](function(_0x12ec93){_0x414321[_0x2d5d('0x31')]=_0x12ec93;if(_0x11cf9e['query'][_0x2d5d('0x55')]){_0x5bb420[_0x2d5d('0x56')]=[{'all':!![]}];}return db[_0x2d5d('0x54')][_0x2d5d('0x57')](_0x5bb420);})['then'](function(_0xf12a4){_0x414321[_0x2d5d('0x58')]=_0xf12a4;return _0x414321;})[_0x2d5d('0x20')](respondWithFilteredResult(_0x2c6781,_0x5bb420))[_0x2d5d('0x2a')](handleError(_0x2c6781,null));};exports[_0x2d5d('0x59')]=function(_0x2f4c10,_0x403698){var _0x31dbb7={'raw':![],'where':{'id':_0x2f4c10[_0x2d5d('0x5a')]['id']},'include':[{'model':db[_0x2d5d('0x3e')],'as':_0x2d5d('0x5b')}]},_0x1de72f={};_0x1de72f['model']=_[_0x2d5d('0x46')](db[_0x2d5d('0x54')][_0x2d5d('0x40')]);_0x1de72f[_0x2d5d('0x45')]=_['keys'](_0x2f4c10[_0x2d5d('0x45')]);_0x1de72f[_0x2d5d('0x47')]=_[_0x2d5d('0x49')](_0x1de72f[_0x2d5d('0x44')],_0x1de72f[_0x2d5d('0x45')]);_0x31dbb7[_0x2d5d('0x48')]=_['intersection'](_0x1de72f['model'],qs['fields'](_0x2f4c10['query'][_0x2d5d('0x4a')]));_0x31dbb7[_0x2d5d('0x48')]=_0x31dbb7[_0x2d5d('0x48')][_0x2d5d('0x4b')]?_0x31dbb7[_0x2d5d('0x48')]:_0x1de72f[_0x2d5d('0x44')];if(_0x2f4c10[_0x2d5d('0x45')][_0x2d5d('0x55')]){_0x31dbb7[_0x2d5d('0x56')]=[{'all':!![]}];}_0x31dbb7=_[_0x2d5d('0x52')]({},_0x31dbb7,_0x2f4c10[_0x2d5d('0x53')]);return db['SmsAccount'][_0x2d5d('0x5c')](_0x31dbb7)[_0x2d5d('0x20')](handleEntityNotFound(_0x403698,null))[_0x2d5d('0x20')](respondWithResult(_0x403698,null))['catch'](handleError(_0x403698,null));};exports['create']=function(_0x2ec33c,_0x55c1c1){return db[_0x2d5d('0x54')]['create'](_0x2ec33c['body'],{})['then'](function(_0x146097){var _0x26e361=_0x2ec33c[_0x2d5d('0x5d')][_0x2d5d('0x37')]({'plain':!![]});if(!_0x26e361)throw new Error(_0x2d5d('0x5e'));if(_0x26e361[_0x2d5d('0x5f')]===_0x2d5d('0x5d')){var _0x27ee26=_0x146097[_0x2d5d('0x37')]({'plain':!![]});var _0x1116fd=_0x2d5d('0x38');return db[_0x2d5d('0x60')]['find']({'where':{'name':_0x1116fd,'userProfileId':_0x26e361[_0x2d5d('0x61')]},'raw':!![]})[_0x2d5d('0x20')](function(_0x716df0){if(_0x716df0&&_0x716df0['autoAssociation']===0x0){return db['UserProfileResource'][_0x2d5d('0x62')]({'name':_0x27ee26['name'],'resourceId':_0x27ee26['id'],'type':_0x716df0[_0x2d5d('0x3b')],'sectionId':_0x716df0['id']},{})[_0x2d5d('0x20')](function(){return _0x146097;});}else{return _0x146097;}})['catch'](function(_0x1b68d1){logger[_0x2d5d('0x27')](_0x2d5d('0x63'),_0x1b68d1);throw _0x1b68d1;});}return _0x146097;})['then'](respondWithResult(_0x55c1c1,0xc9))['catch'](handleError(_0x55c1c1,null));};exports['update']=function(_0x11d7ae,_0x3b94c7){if(_0x11d7ae[_0x2d5d('0x64')]['id']){delete _0x11d7ae['body']['id'];}return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0x11d7ae[_0x2d5d('0x5a')]['id']},'include':[{'model':db[_0x2d5d('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x2d5d('0x20')](handleEntityNotFound(_0x3b94c7,null))[_0x2d5d('0x20')](saveUpdates(_0x11d7ae[_0x2d5d('0x64')],null))[_0x2d5d('0x20')](respondWithResult(_0x3b94c7,null))['catch'](handleError(_0x3b94c7,null));};exports[_0x2d5d('0x36')]=function(_0xca68a7,_0xceb266){return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0xca68a7[_0x2d5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0xceb266,null))[_0x2d5d('0x20')](removeEntity(_0xceb266,null))[_0x2d5d('0x2a')](handleError(_0xceb266,null));};exports[_0x2d5d('0x65')]=function(_0x47a53c,_0x42d215){return db[_0x2d5d('0x54')][_0x2d5d('0x65')]()[_0x2d5d('0x20')](respondWithResult(_0x42d215,null))[_0x2d5d('0x2a')](handleError(_0x42d215,null));};exports['addDisposition']=function(_0x50ae8c,_0x394eca,_0x52a8a8){if(_0x50ae8c['body']['id']){delete _0x50ae8c[_0x2d5d('0x64')]['id'];}return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0x50ae8c[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x394eca,null))[_0x2d5d('0x20')](function(_0xb16c0f){if(_0xb16c0f){_0x50ae8c['body'][_0x2d5d('0x66')]=_0xb16c0f['id'];return db[_0x2d5d('0x67')][_0x2d5d('0x62')](_0x50ae8c[_0x2d5d('0x64')]);}})[_0x2d5d('0x20')](respondWithResult(_0x394eca,null))[_0x2d5d('0x2a')](handleError(_0x394eca,null));};exports[_0x2d5d('0x68')]=function(_0xeb7da5,_0x4804d5,_0x525a9a){var _0xf5221d={'raw':![],'where':{}};var _0x53e2ba={};var _0x141646={'count':0x0,'rows':[]};return db[_0x2d5d('0x54')][_0x2d5d('0x69')]({'where':{'id':_0xeb7da5[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x4804d5,null))[_0x2d5d('0x20')](function(_0x2e4de2){if(_0x2e4de2){_0x53e2ba['model']=_['keys'](db[_0x2d5d('0x67')][_0x2d5d('0x40')]);_0x53e2ba[_0x2d5d('0x45')]=_[_0x2d5d('0x46')](_0xeb7da5[_0x2d5d('0x45')]);_0x53e2ba[_0x2d5d('0x47')]=_[_0x2d5d('0x49')](_0x53e2ba['model'],_0x53e2ba[_0x2d5d('0x45')]);_0xf5221d['attributes']=_['intersection'](_0x53e2ba['model'],qs[_0x2d5d('0x4a')](_0xeb7da5['query'][_0x2d5d('0x4a')]));_0xf5221d['attributes']=_0xf5221d[_0x2d5d('0x48')][_0x2d5d('0x4b')]?_0xf5221d[_0x2d5d('0x48')]:_0x53e2ba[_0x2d5d('0x44')];if(!_0xeb7da5['query'][_0x2d5d('0x4c')](_0x2d5d('0x4d'))){_0xf5221d[_0x2d5d('0x30')]=qs[_0x2d5d('0x30')](_0xeb7da5['query'][_0x2d5d('0x30')]);_0xf5221d['offset']=qs['offset'](_0xeb7da5['query'][_0x2d5d('0x32')]);}_0xf5221d['order']=qs[_0x2d5d('0x4e')](_0xeb7da5['query'][_0x2d5d('0x4e')]);_0xf5221d[_0x2d5d('0x51')]=qs[_0x2d5d('0x47')](_['pick'](_0xeb7da5['query'],_0x53e2ba['filters']));_0xf5221d[_0x2d5d('0x51')][_0x2d5d('0x66')]=_0x2e4de2['id'];if(_0xeb7da5[_0x2d5d('0x45')][_0x2d5d('0x50')]){_0xf5221d['where']=_[_0x2d5d('0x52')](_0xf5221d[_0x2d5d('0x51')],{'$or':_[_0x2d5d('0x3f')](_0xf5221d[_0x2d5d('0x48')],function(_0x1ed607){var _0x184e57={};_0x184e57[_0x1ed607]={'$like':'%'+_0xeb7da5[_0x2d5d('0x45')][_0x2d5d('0x50')]+'%'};return _0x184e57;})});}_0xf5221d=_[_0x2d5d('0x52')]({},_0xf5221d,_0xeb7da5[_0x2d5d('0x53')]);return db[_0x2d5d('0x67')][_0x2d5d('0x31')]({'where':_0xf5221d[_0x2d5d('0x51')]})[_0x2d5d('0x20')](function(_0xe3867a){_0x141646[_0x2d5d('0x31')]=_0xe3867a;if(_0xeb7da5[_0x2d5d('0x45')][_0x2d5d('0x55')]){_0xf5221d[_0x2d5d('0x56')]=[{'all':!![]}];}return db[_0x2d5d('0x67')]['findAll'](_0xf5221d);})[_0x2d5d('0x20')](function(_0x39f98d){_0x141646[_0x2d5d('0x58')]=_0x39f98d;return _0x141646;});}})[_0x2d5d('0x20')](respondWithFilteredResult(_0x4804d5,_0xf5221d))[_0x2d5d('0x2a')](handleError(_0x4804d5,null));};exports[_0x2d5d('0x6a')]=function(_0x3806eb,_0x1fd114,_0x2a13cc){return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0x3806eb['params']['id']}})['then'](handleEntityNotFound(_0x1fd114,null))['then'](function(_0x48ce02){if(_0x48ce02){return _0x48ce02[_0x2d5d('0x6a')](_0x3806eb['query']['ids']);}})[_0x2d5d('0x20')](respondWithStatusCode(_0x1fd114,null))['catch'](handleError(_0x1fd114,null));};exports[_0x2d5d('0x6b')]=function(_0x1f65d8,_0x4cd1a3,_0x1bbb36){if(_0x1f65d8['body']['id']){delete _0x1f65d8[_0x2d5d('0x64')]['id'];}return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0x1f65d8[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x4cd1a3,null))[_0x2d5d('0x20')](function(_0x46a0bd){if(_0x46a0bd){_0x1f65d8[_0x2d5d('0x64')]['SmsAccountId']=_0x46a0bd['id'];return db[_0x2d5d('0x6c')][_0x2d5d('0x62')](_0x1f65d8[_0x2d5d('0x64')]);}})[_0x2d5d('0x20')](respondWithResult(_0x4cd1a3,null))[_0x2d5d('0x2a')](handleError(_0x4cd1a3,null));};exports[_0x2d5d('0x6d')]=function(_0x3a2e62,_0x8caca4,_0x53dabf){var _0x24c24b={'raw':![],'where':{}};var _0x3f20be={};var _0x2f8504={'count':0x0,'rows':[]};return db[_0x2d5d('0x54')][_0x2d5d('0x69')]({'where':{'id':_0x3a2e62[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x8caca4,null))[_0x2d5d('0x20')](function(_0x3c300b){if(_0x3c300b){_0x3f20be['model']=_[_0x2d5d('0x46')](db[_0x2d5d('0x6c')][_0x2d5d('0x40')]);_0x3f20be[_0x2d5d('0x45')]=_['keys'](_0x3a2e62[_0x2d5d('0x45')]);_0x3f20be[_0x2d5d('0x47')]=_['intersection'](_0x3f20be['model'],_0x3f20be[_0x2d5d('0x45')]);_0x24c24b[_0x2d5d('0x48')]=_[_0x2d5d('0x49')](_0x3f20be['model'],qs[_0x2d5d('0x4a')](_0x3a2e62[_0x2d5d('0x45')][_0x2d5d('0x4a')]));_0x24c24b[_0x2d5d('0x48')]=_0x24c24b['attributes']['length']?_0x24c24b[_0x2d5d('0x48')]:_0x3f20be['model'];if(!_0x3a2e62[_0x2d5d('0x45')][_0x2d5d('0x4c')](_0x2d5d('0x4d'))){_0x24c24b[_0x2d5d('0x30')]=qs[_0x2d5d('0x30')](_0x3a2e62[_0x2d5d('0x45')][_0x2d5d('0x30')]);_0x24c24b[_0x2d5d('0x32')]=qs[_0x2d5d('0x32')](_0x3a2e62['query'][_0x2d5d('0x32')]);}_0x24c24b[_0x2d5d('0x6e')]=qs[_0x2d5d('0x4e')](_0x3a2e62['query'][_0x2d5d('0x4e')]);_0x24c24b['where']=qs[_0x2d5d('0x47')](_['pick'](_0x3a2e62[_0x2d5d('0x45')],_0x3f20be[_0x2d5d('0x47')]));_0x24c24b[_0x2d5d('0x51')][_0x2d5d('0x66')]=_0x3c300b['id'];if(_0x3a2e62[_0x2d5d('0x45')][_0x2d5d('0x50')]){_0x24c24b[_0x2d5d('0x51')]=_[_0x2d5d('0x52')](_0x24c24b[_0x2d5d('0x51')],{'$or':_[_0x2d5d('0x3f')](_0x24c24b[_0x2d5d('0x48')],function(_0x117972){var _0x4b1130={};_0x4b1130[_0x117972]={'$like':'%'+_0x3a2e62[_0x2d5d('0x45')][_0x2d5d('0x50')]+'%'};return _0x4b1130;})});}_0x24c24b=_[_0x2d5d('0x52')]({},_0x24c24b,_0x3a2e62[_0x2d5d('0x53')]);return db[_0x2d5d('0x6c')][_0x2d5d('0x31')]({'where':_0x24c24b['where']})['then'](function(_0x594480){_0x2f8504[_0x2d5d('0x31')]=_0x594480;if(_0x3a2e62['query'][_0x2d5d('0x55')]){_0x24c24b[_0x2d5d('0x56')]=[{'all':!![]}];}return db[_0x2d5d('0x6c')][_0x2d5d('0x57')](_0x24c24b);})[_0x2d5d('0x20')](function(_0x416019){_0x2f8504[_0x2d5d('0x58')]=_0x416019;return _0x2f8504;});}})[_0x2d5d('0x20')](respondWithFilteredResult(_0x8caca4,_0x24c24b))[_0x2d5d('0x2a')](handleError(_0x8caca4,null));};exports[_0x2d5d('0x6f')]=function(_0xe54d3c,_0x579ebd,_0x382f76){return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0xe54d3c['params']['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x579ebd,null))[_0x2d5d('0x20')](function(_0x1f2b00){if(_0x1f2b00){return _0x1f2b00[_0x2d5d('0x6f')](_0xe54d3c[_0x2d5d('0x45')][_0x2d5d('0x70')]);}})[_0x2d5d('0x20')](respondWithStatusCode(_0x579ebd,null))['catch'](handleError(_0x579ebd,null));};exports[_0x2d5d('0x71')]=function(_0x3e4f10,_0x578c50,_0x15ef39){var _0x5c651d={'channel':'sms'};var _0x6babd=[];var _0x418017=[];var _0x4887f0={};return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0x3e4f10[_0x2d5d('0x5a')]['id']},'include':[{'model':db[_0x2d5d('0x72')],'as':_0x2d5d('0x73')}]})[_0x2d5d('0x20')](handleEntityNotFound(_0x578c50,null))[_0x2d5d('0x20')](function(_0x58fdd4){_0x5c651d[_0x2d5d('0x74')]=_0x58fdd4;_0x5c651d[_0x2d5d('0x75')]=_[_0x2d5d('0x76')](_0x58fdd4[_0x2d5d('0x73')],[_0x2d5d('0x77')],[_0x2d5d('0x78')]);if(_0x5c651d[_0x2d5d('0x74')][_0x2d5d('0x73')]){delete _0x5c651d[_0x2d5d('0x74')]['Applications'];}return db[_0x2d5d('0x79')][_0x2d5d('0x65')]();})['then'](function(_0x502b61){if(!_0x502b61){throw new db[(_0x2d5d('0x7a'))]['ValidationError'](_0x2d5d('0x7b'));}_0x6babd=_[_0x2d5d('0x7c')](_['keys'](_0x502b61),[_0x2d5d('0x7d'),_0x2d5d('0x7e')]);_0x418017=_[_0x2d5d('0x7c')](_[_0x2d5d('0x46')](_0x502b61),['createdAt',_0x2d5d('0x7e'),_0x2d5d('0x7f'),'ListId']);_0x5c651d['body']={'mapKey':_0x2d5d('0x80')};if(_0x5c651d['account'][_0x2d5d('0x42')]){switch(_0x5c651d[_0x2d5d('0x74')][_0x2d5d('0x42')]){case'twilio':_0x5c651d[_0x2d5d('0x64')]['from']=_0x3e4f10[_0x2d5d('0x64')]['From'];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x64')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x81')];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x82')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x83')];break;case'skebby':_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')]='+'+_0x3e4f10[_0x2d5d('0x64')]['sender'];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x64')]=_0x3e4f10[_0x2d5d('0x64')]['text'];break;case'connectel':_0x5c651d['body'][_0x2d5d('0x84')]=_0x3e4f10[_0x2d5d('0x64')]['from'];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x64')]=_0x3e4f10[_0x2d5d('0x64')]['message'];break;case _0x2d5d('0x85'):_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x84')];_0x5c651d[_0x2d5d('0x64')]['body']=_0x3e4f10['body']['body'];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x82')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x86')];break;case _0x2d5d('0x87'):_0x5c651d[_0x2d5d('0x64')]['from']=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x88')];_0x5c651d['body'][_0x2d5d('0x64')]=_0x3e4f10['body'][_0x2d5d('0x89')];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x82')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x8a')];break;case _0x2d5d('0x8b'):_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')]='+'+_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x8c')][0x0][_0x2d5d('0x84')];_0x5c651d['body'][_0x2d5d('0x64')]=_0x3e4f10['body'][_0x2d5d('0x8c')][0x0]['text'];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x82')]=_0x3e4f10['body'][_0x2d5d('0x8c')][0x0]['messageId'];break;case'csc':_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x8d')];_0x5c651d[_0x2d5d('0x64')]['body']=_0x3e4f10[_0x2d5d('0x64')]['segmentedMessage']['message'];break;case _0x2d5d('0x8e'):_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')]=_0x3e4f10['body'][_0x2d5d('0x8f')];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x64')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x90')];_0x5c651d['body'][_0x2d5d('0x82')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x91')];break;case _0x2d5d('0x92'):_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x82')]=_0x3e4f10[_0x2d5d('0x64')][0x0]['message']['id'];_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')]=_0x3e4f10['body'][0x0]['message'][_0x2d5d('0x84')];_0x5c651d['body'][_0x2d5d('0x64')]=_0x3e4f10[_0x2d5d('0x64')][0x0]['message'][_0x2d5d('0x90')];break;case _0x2d5d('0x93'):_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')]=_0x3e4f10['body'][_0x2d5d('0x84')];_0x5c651d[_0x2d5d('0x64')]['body']=_0x3e4f10['body'][_0x2d5d('0x29')];_0x5c651d['body'][_0x2d5d('0x82')]=_0x3e4f10[_0x2d5d('0x64')][_0x2d5d('0x94')];break;}}if(_0x5c651d[_0x2d5d('0x64')]['id']){delete _0x5c651d[_0x2d5d('0x64')]['id'];}if(_[_0x2d5d('0x95')](_0x5c651d[_0x2d5d('0x64')]['from'])){throw new db[(_0x2d5d('0x7a'))][(_0x2d5d('0x96'))]('from\x20is\x20mandatory');}if(_[_0x2d5d('0x95')](_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x64')])||_0x5c651d[_0x2d5d('0x64')]['body']===''){throw new db[(_0x2d5d('0x7a'))]['ValidationError'](_0x2d5d('0x97'));}if(_[_0x2d5d('0x95')](_0x5c651d[_0x2d5d('0x64')]['mapKey'])){throw new db[(_0x2d5d('0x7a'))][(_0x2d5d('0x96'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x418017);}if(!_[_0x2d5d('0x98')](_0x418017,_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x99')])){throw new db[(_0x2d5d('0x7a'))][(_0x2d5d('0x96'))](_0x2d5d('0x9a')+_0x418017);}_0x4887f0[_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x99')]]=_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')];return db[_0x2d5d('0x9b')][_0x2d5d('0x5c')]({'where':{'id':_0x5c651d[_0x2d5d('0x74')]['ListId']},'include':[{'model':db[_0x2d5d('0x79')],'as':_0x2d5d('0x9c'),'where':_0x4887f0,'limit':0x1,'order':[[_0x2d5d('0x7e'),_0x2d5d('0x9d')]]}]});})[_0x2d5d('0x20')](handleEntityNotFound(_0x578c50,null))[_0x2d5d('0x20')](function(_0x3782aa){if(_0x3782aa){_0x5c651d[_0x2d5d('0x9e')]=_[_0x2d5d('0x9f')](_0x3782aa,['Contacts']);if(_0x3782aa[_0x2d5d('0x9c')][_0x2d5d('0x4b')]){return _0x3782aa[_0x2d5d('0x9c')][0x0];}var _0x561c4a=_[_0x2d5d('0x1a')](_0x5c651d[_0x2d5d('0x64')],{'firstName':_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')],'ListId':_0x3782aa['id']});_0x561c4a[_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x99')]]=_0x5c651d['body'][_0x2d5d('0x84')];return db[_0x2d5d('0x79')]['create'](_0x561c4a,{'fields':_0x6babd,'raw':!![]});}})[_0x2d5d('0x20')](handleEntityNotFound(_0x578c50,null))[_0x2d5d('0x20')](function(_0x330ec9){if(_0x330ec9){_0x5c651d[_0x2d5d('0xa0')]=_0x330ec9;var _0x2ebc39={'ContactId':_0x330ec9['id'],'phone':_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x84')],'SmsAccountId':_0x3e4f10[_0x2d5d('0x5a')]['id']};var _0x3b29e7={'ContactId':_0x330ec9['id'],'SmsAccountId':_0x3e4f10['params']['id'],'closed':![]};return db[_0x2d5d('0xa1')][_0x2d5d('0x5c')]({'where':_0x3b29e7})[_0x2d5d('0x20')](function(_0x3fb3c4){if(_0x3fb3c4){return[_0x3fb3c4,![]];}return db[_0x2d5d('0xa1')]['create'](_0x2ebc39)[_0x2d5d('0x20')](function(_0x241735){return[_0x241735,!![]];});});}})[_0x2d5d('0xa2')](function(_0x40a2b1,_0x3f40b4){_0x5c651d[_0x2d5d('0xa3')]=_0x40a2b1[_0x2d5d('0x37')]({'plain':!![]});_0x5c651d[_0x2d5d('0xa3')][_0x2d5d('0xa4')]=![];if(_0x3f40b4){if(_0x5c651d[_0x2d5d('0x74')][_0x2d5d('0xa5')]){_0x5c651d['applications'][_0x2d5d('0xa6')]({'id':0x0,'priority':_0x5c651d[_0x2d5d('0x75')][_0x2d5d('0x4b')]+0x1,'app':_0x2d5d('0xa7'),'appdata':'unmanaged','interval':_0x2d5d('0xa8')});}_0x5c651d[_0x2d5d('0xa3')][_0x2d5d('0xa4')]=!![];}return db[_0x2d5d('0xa9')][_0x2d5d('0x62')]({'phone':_0x5c651d[_0x2d5d('0x64')]['from'],'messageId':_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x82')],'body':_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0x64')],'SmsAccountId':_0x3e4f10[_0x2d5d('0x5a')]['id'],'SmsInteractionId':_0x40a2b1['id'],'direction':'in','ContactId':_0x40a2b1[_0x2d5d('0xaa')],'AttachmentId':_0x5c651d[_0x2d5d('0x64')][_0x2d5d('0xab')]});})['then'](function(_0x14e150){_0x5c651d[_0x2d5d('0x29')]=_0x14e150;if(_0x5c651d[_0x2d5d('0xa3')][_0x2d5d('0xac')]){return db['User'][_0x2d5d('0x5c')]({'attributes':['id',_0x2d5d('0x3b')],'where':{'id':_0x5c651d['interaction']['UserId']}})[_0x2d5d('0x20')](function(_0x57ae20){if(_0x57ae20){_0x5c651d[_0x2d5d('0x75')][_0x2d5d('0xad')]({'id':0x0,'priority':0x0,'app':_0x2d5d('0xae'),'appdata':_0x57ae20[_0x2d5d('0x3b')]+','+(_0x5c651d[_0x2d5d('0x74')][_0x2d5d('0xaf')]||0xa),'interval':_0x2d5d('0xa8')});}return respondWithRpcPromise(_0x2d5d('0xb0'),_0x2d5d('0xb1'),_0x5c651d);});}return respondWithRpcPromise(_0x2d5d('0xb0'),_0x2d5d('0xb1'),_0x5c651d);})[_0x2d5d('0x20')](function(_0x45aafc){if(_0x45aafc){var _0x2a329d=0xc8;var _0x7c5158=_0x2d5d('0xb2');logger[_0x2d5d('0x21')](_0x2d5d('0x25'),_0x7c5158,_0x2a329d,_0x2d5d('0xb3'));logger['debug'](_0x2d5d('0xb4'),_0x7c5158,_0x2a329d,'entity\x20found',JSON[_0x2d5d('0x26')](_0x45aafc));if(_0x5c651d[_0x2d5d('0x74')][_0x2d5d('0x42')]===_0x2d5d('0xb5')){return _0x578c50[_0x2d5d('0x2c')](_0x2a329d)[_0x2d5d('0xb6')]('Content-Type',_0x2d5d('0xb7'))[_0x2d5d('0x3c')]('\x0a');}else{return _0x578c50[_0x2d5d('0x2c')](_0x2a329d)[_0x2d5d('0x2e')](_0x45aafc);}}})[_0x2d5d('0x2a')](handleError(_0x578c50,null));};exports['addApplications']=function(_0x3fa3a2,_0x34dc1d){var _0x881a28=_0x3fa3a2[_0x2d5d('0x5a')]['id'];var _0x171862=_0x3fa3a2[_0x2d5d('0x64')];var _0x3b19a1=0xc8;var _0x460c23=null;return db[_0x2d5d('0xb8')][_0x2d5d('0xb9')]({'isolationLevel':db['sequelize'][_0x2d5d('0xba')][_0x2d5d('0xbb')]['READ_COMMITTED']},function(_0x38daed){return db[_0x2d5d('0x54')][_0x2d5d('0x69')]({'where':{'id':_0x881a28},'transaction':_0x38daed})[_0x2d5d('0x20')](function(_0x290ea9){if(_0x290ea9){return db[_0x2d5d('0x72')][_0x2d5d('0x36')]({'where':{'SmsAccountId':_0x881a28},'transaction':_0x38daed})['then'](function(){var _0x42b908=_['map'](_0x171862,function(_0x1f7ac4){_0x1f7ac4[_0x2d5d('0x66')]=_0x881a28;return _0x1f7ac4;});return db[_0x2d5d('0x72')]['bulkCreate'](_0x42b908,{'transaction':_0x38daed});});}else{_0x3b19a1=0x194;_0x460c23=[];}});})[_0x2d5d('0x20')](function(){if(_0x3b19a1!==0x194){return db['SmsApplication'][_0x2d5d('0xbc')]({'where':{'SmsAccountId':_0x881a28},'order':_0x2d5d('0x77')})[_0x2d5d('0x20')](function(_0x2423f3){_0x460c23=_0x2423f3;});}})['catch'](function(_0x1bce6f){_0x3b19a1=0x1f4;logger['error'](_0x1bce6f['stack']);if(_0x1bce6f['name']){delete _0x1bce6f[_0x2d5d('0x3b')];}_0x460c23=_0x1bce6f;})[_0x2d5d('0xbd')](function(){if(_0x460c23===null){_0x34dc1d[_0x2d5d('0x2b')](_0x3b19a1);}else{if(_0x3b19a1===0x1f4){_0x34dc1d['status'](_0x3b19a1)[_0x2d5d('0x3c')](_0x460c23);}else{_0x34dc1d['status'](_0x3b19a1)[_0x2d5d('0x2e')](_0x460c23);}}});};exports['getApplications']=function(_0x2a836d,_0x5a35a2,_0x3cdbab){var _0x104999={};var _0x4a29d6={};var _0x72e64a;var _0x3da544;return db[_0x2d5d('0x54')]['findOne']({'where':{'id':_0x2a836d['params']['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x5a35a2,null))[_0x2d5d('0x20')](function(_0x267165){if(_0x267165){_0x72e64a=_0x267165;_0x4a29d6[_0x2d5d('0x44')]=_[_0x2d5d('0x46')](db[_0x2d5d('0x72')][_0x2d5d('0x40')]);_0x4a29d6['query']=_[_0x2d5d('0x46')](_0x2a836d[_0x2d5d('0x45')]);_0x4a29d6['filters']=_[_0x2d5d('0x49')](_0x4a29d6[_0x2d5d('0x44')],_0x4a29d6['query']);_0x104999[_0x2d5d('0x48')]=_[_0x2d5d('0x49')](_0x4a29d6[_0x2d5d('0x44')],qs[_0x2d5d('0x4a')](_0x2a836d[_0x2d5d('0x45')][_0x2d5d('0x4a')]));_0x104999[_0x2d5d('0x48')]=_0x104999['attributes']['length']?_0x104999[_0x2d5d('0x48')]:_0x4a29d6['model'];_0x104999[_0x2d5d('0x6e')]=qs[_0x2d5d('0x4e')](_0x2a836d[_0x2d5d('0x45')]['sort']);_0x104999[_0x2d5d('0x51')]=qs['filters'](_[_0x2d5d('0x4f')](_0x2a836d[_0x2d5d('0x45')],_0x4a29d6[_0x2d5d('0x47')]));if(_0x2a836d[_0x2d5d('0x45')][_0x2d5d('0x50')]){_0x104999[_0x2d5d('0x51')]=_['merge'](_0x104999[_0x2d5d('0x51')],{'$or':_['map'](_0x104999['attributes'],function(_0x447c99){var _0x887bae={};_0x887bae[_0x447c99]={'$like':'%'+_0x2a836d['query'][_0x2d5d('0x50')]+'%'};return _0x887bae;})});}_0x104999=_[_0x2d5d('0x52')]({},_0x104999,_0x2a836d[_0x2d5d('0x53')]);return _0x72e64a[_0x2d5d('0xbe')](_0x104999);}})[_0x2d5d('0x20')](function(_0xe10ca6){if(_0xe10ca6){_0x3da544=_0xe10ca6[_0x2d5d('0x4b')];if(!_0x2a836d[_0x2d5d('0x45')][_0x2d5d('0x4c')](_0x2d5d('0x4d'))){_0x104999[_0x2d5d('0x30')]=qs[_0x2d5d('0x30')](_0x2a836d['query']['limit']);_0x104999['offset']=qs[_0x2d5d('0x32')](_0x2a836d[_0x2d5d('0x45')]['offset']);}return _0x72e64a[_0x2d5d('0xbe')](_0x104999);}})[_0x2d5d('0x20')](function(_0x1c807f){if(_0x1c807f){return _0x1c807f?{'count':_0x3da544,'rows':_0x1c807f}:null;}})[_0x2d5d('0x20')](respondWithResult(_0x5a35a2,null))[_0x2d5d('0x2a')](handleError(_0x5a35a2,null));};exports[_0x2d5d('0xbf')]=function(_0x197928,_0x5caf64,_0x2adf4a){var _0x29ec48={'raw':![],'where':{}};var _0x5e8b3b={};var _0x3388fc={'count':0x0,'rows':[]};return db[_0x2d5d('0x54')][_0x2d5d('0x69')]({'where':{'id':_0x197928[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x5caf64,null))[_0x2d5d('0x20')](function(_0x483997){if(_0x483997){_0x5e8b3b[_0x2d5d('0x44')]=_[_0x2d5d('0x46')](db['SmsInteraction'][_0x2d5d('0x40')]);_0x5e8b3b[_0x2d5d('0x45')]=_[_0x2d5d('0x46')](_0x197928[_0x2d5d('0x45')]);_0x5e8b3b[_0x2d5d('0x47')]=_[_0x2d5d('0x49')](_0x5e8b3b[_0x2d5d('0x44')],_0x5e8b3b[_0x2d5d('0x45')]);_0x29ec48[_0x2d5d('0x48')]=_[_0x2d5d('0x49')](_0x5e8b3b[_0x2d5d('0x44')],qs[_0x2d5d('0x4a')](_0x197928['query']['fields']));_0x29ec48['attributes']=_0x29ec48[_0x2d5d('0x48')][_0x2d5d('0x4b')]?_0x29ec48[_0x2d5d('0x48')]:_0x5e8b3b[_0x2d5d('0x44')];if(!_0x197928[_0x2d5d('0x45')][_0x2d5d('0x4c')](_0x2d5d('0x4d'))){_0x29ec48[_0x2d5d('0x30')]=qs['limit'](_0x197928['query']['limit']);_0x29ec48[_0x2d5d('0x32')]=qs[_0x2d5d('0x32')](_0x197928[_0x2d5d('0x45')][_0x2d5d('0x32')]);}_0x29ec48[_0x2d5d('0x6e')]=qs['sort'](_0x197928[_0x2d5d('0x45')][_0x2d5d('0x4e')]);_0x29ec48[_0x2d5d('0x51')]=qs[_0x2d5d('0x47')](_[_0x2d5d('0x4f')](_0x197928[_0x2d5d('0x45')],_0x5e8b3b['filters']));_0x29ec48[_0x2d5d('0x51')][_0x2d5d('0x66')]=_0x483997['id'];if(_0x197928[_0x2d5d('0x45')][_0x2d5d('0x50')]){_0x29ec48['where']=_[_0x2d5d('0x52')](_0x29ec48[_0x2d5d('0x51')],{'$or':_[_0x2d5d('0x3f')](_0x29ec48['attributes'],function(_0x335f08){var _0x1a9835={};_0x1a9835[_0x335f08]={'$like':'%'+_0x197928[_0x2d5d('0x45')][_0x2d5d('0x50')]+'%'};return _0x1a9835;})});}_0x29ec48=_[_0x2d5d('0x52')]({},_0x29ec48,_0x197928[_0x2d5d('0x53')]);return db['SmsInteraction']['count']({'where':_0x29ec48[_0x2d5d('0x51')]})[_0x2d5d('0x20')](function(_0x2cbf46){_0x3388fc[_0x2d5d('0x31')]=_0x2cbf46;if(_0x197928[_0x2d5d('0x45')][_0x2d5d('0x55')]){_0x29ec48['include']=[{'model':db['CmContact'],'as':_0x2d5d('0xc0'),'required':![]},{'model':db[_0x2d5d('0xc1')],'as':'Owner','attributes':['name',_0x2d5d('0xc2'),_0x2d5d('0xc3')],'required':![]},{'model':db[_0x2d5d('0xc4')],'as':_0x2d5d('0xc5'),'attributes':['id',_0x2d5d('0x3b'),_0x2d5d('0xc6')],'where':_0x197928[_0x2d5d('0x45')][_0x2d5d('0xc7')]?{'id':_0x197928['query'][_0x2d5d('0xc7')]}:undefined,'required':_0x197928['query'][_0x2d5d('0xc7')]?!![]:![]}];}return db[_0x2d5d('0xa1')][_0x2d5d('0x57')](_0x29ec48);})[_0x2d5d('0x20')](function(_0x4a2624){_0x3388fc[_0x2d5d('0x58')]=_0x4a2624;return _0x3388fc;});}})[_0x2d5d('0x20')](respondWithFilteredResult(_0x5caf64,_0x29ec48))[_0x2d5d('0x2a')](handleError(_0x5caf64,null));};exports[_0x2d5d('0x3c')]=function(_0xd3e624,_0x34f45e,_0x4b2ebe){var _0x32a3bd,_0x490f64,_0x39f033;if(_[_0x2d5d('0x95')](_0xd3e624[_0x2d5d('0x64')][_0x2d5d('0x64')])||_0xd3e624[_0x2d5d('0x64')]['body']===''){throw new db[(_0x2d5d('0x7a'))][(_0x2d5d('0x96'))](_0x2d5d('0x97'));}if(_[_0x2d5d('0x95')](_0xd3e624[_0x2d5d('0x64')]['to'])){throw new db[(_0x2d5d('0x7a'))]['ValidationError']('to\x20is\x20mandatory');}_0x32a3bd=_0xd3e624['body']['to'];return db[_0x2d5d('0x54')][_0x2d5d('0x5c')]({'where':{'id':_0xd3e624['params']['id']},'include':[{'model':db['CmList'],'as':_0x2d5d('0xc8'),'include':[{'model':db['CmContact'],'as':_0x2d5d('0x9c'),'where':{'mobile':_0x32a3bd},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x2d5d('0x20')](handleEntityNotFound(_0x34f45e,null))['then'](function(_0x1060cd){if(_0x1060cd&&_0x1060cd[_0x2d5d('0xc8')]){_0x490f64=_0x1060cd[_0x2d5d('0x37')]({'plain':!![]});if(_0x490f64[_0x2d5d('0xc8')]&&_0x490f64['List'][_0x2d5d('0x9c')][_0x2d5d('0x4b')]){return _0x490f64[_0x2d5d('0xc8')][_0x2d5d('0x9c')][0x0];}return db[_0x2d5d('0x79')][_0x2d5d('0x62')](_[_0x2d5d('0x1a')](_0xd3e624[_0x2d5d('0x64')],{'firstName':_0x32a3bd,'mobile':_0x32a3bd,'phone':_0x32a3bd,'ListId':_0x490f64[_0x2d5d('0xc9')]}));}})[_0x2d5d('0x20')](handleEntityNotFound(_0x34f45e,null))[_0x2d5d('0x20')](function(_0x488fa4){if(_0x488fa4){_0x39f033=_0x488fa4;return db[_0x2d5d('0xa1')][_0x2d5d('0x5c')]({'where':{'ContactId':_0x39f033['id'],'closed':![],'SmsAccountId':_0x490f64['id']}})[_0x2d5d('0x20')](function(_0xfd691c){if(_0xfd691c){return[_0xfd691c,![]];}return db[_0x2d5d('0xa1')][_0x2d5d('0x62')]({'UserId':_0xd3e624['user']['id'],'ContactId':_0x39f033['id'],'SmsAccountId':_0x490f64['id'],'phone':_0x32a3bd,'firstMsgDirection':_0x2d5d('0xca'),'Messages':[_[_0x2d5d('0x52')](_0xd3e624[_0x2d5d('0x64')],{'read':![],'body':_0xd3e624[_0x2d5d('0x64')]['body'],'phone':_0x32a3bd,'SmsAccountId':_0x490f64['id'],'UserId':_0xd3e624[_0x2d5d('0x5d')]['id'],'ContactId':_0x39f033['id']})]},{'include':[{'model':db[_0x2d5d('0xa9')],'as':_0x2d5d('0xcb')}]})[_0x2d5d('0x20')](function(_0x5d8656){return[_0x5d8656,!![]];});});}})['spread'](function(_0x16b0bc,_0x12e073){if(_0x12e073){return _0x16b0bc;}return db[_0x2d5d('0xa9')][_0x2d5d('0x62')](_['merge'](_0xd3e624[_0x2d5d('0x64')],{'read':![],'body':_0xd3e624[_0x2d5d('0x64')]['body'],'phone':_0x32a3bd,'SmsAccountId':_0x490f64['id'],'SmsInteractionId':_0x16b0bc['id'],'UserId':_0xd3e624[_0x2d5d('0x5d')]['id'],'ContactId':_0x39f033['id']}))[_0x2d5d('0x20')](function(_0x124375){_0x16b0bc[_0x2d5d('0xcc')]['Messages']=[];_0x16b0bc[_0x2d5d('0xcc')][_0x2d5d('0xcb')][_0x2d5d('0xa6')](_0x124375[_0x2d5d('0xcc')]);return _0x16b0bc;});})[_0x2d5d('0x20')](respondWithResult(_0x34f45e,null))[_0x2d5d('0x2a')](handleError(_0x34f45e,null));};exports[_0x2d5d('0x2c')]=function(_0x3bcaf6,_0x235b16,_0x48cdb3){if(_0x3bcaf6[_0x2d5d('0x64')]['id']){delete _0x3bcaf6[_0x2d5d('0x64')]['id'];}var _0x1697e4,_0x44a0a7,_0x1e53af;return db[_0x2d5d('0x54')]['find']({'where':{'id':_0x3bcaf6[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x235b16,null))[_0x2d5d('0x20')](function(_0x89395c){if(_0x89395c){_0x1e53af=_0x89395c;logger[_0x2d5d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2d5d('0xcd'),_0x89395c[_0x2d5d('0x42')],util['inspect'](_0x3bcaf6[_0x2d5d('0x64')],{'showHidden':![],'depth':null}));switch(_0x89395c[_0x2d5d('0x42')]){case'skebby':if(_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0xce')]&&_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0x2c')]){_0x44a0a7=_0x3bcaf6[_0x2d5d('0x64')]['status'];return db[_0x2d5d('0xa9')][_0x2d5d('0x5c')]({'where':{'messageId':_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0xce')]}});}break;case _0x2d5d('0xcf'):if(_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0xd0')]&&_0x3bcaf6['body'][_0x2d5d('0xd1')]){_0x44a0a7=_0x3bcaf6[_0x2d5d('0x64')]['statusInt'];return db[_0x2d5d('0xa9')]['find']({'where':{'messageId':_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0xd0')]}});}break;case'clicksend':if(_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0x86')]&&_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0xd2')]){_0x44a0a7=_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0xd2')];return db[_0x2d5d('0xa9')]['find']({'where':{'messageId':_0x3bcaf6['body'][_0x2d5d('0x86')]}});}break;case _0x2d5d('0x8b'):var _0xed3b81=_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0x8c')][0x0];if(_0xed3b81[_0x2d5d('0x82')]&&_0xed3b81[_0x2d5d('0x2c')][_0x2d5d('0xd3')]==='DELIVERED'){_0x44a0a7=_0xed3b81['status']['groupName'];return db[_0x2d5d('0xa9')][_0x2d5d('0x5c')]({'where':{'messageId':_0xed3b81[_0x2d5d('0x82')]}});}break;case _0x2d5d('0x8e'):if(_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0x82')]&&_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0x2c')]){_0x44a0a7=_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0x82')]}});}break;case _0x2d5d('0x92'):if(_0x3bcaf6[_0x2d5d('0x64')][0x0][_0x2d5d('0x29')]['id']){_0x44a0a7=_0x3bcaf6[_0x2d5d('0x64')][0x0][_0x2d5d('0x42')];return db[_0x2d5d('0xa9')][_0x2d5d('0x5c')]({'where':{'messageId':_0x3bcaf6[_0x2d5d('0x64')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x3bcaf6['body'][_0x2d5d('0xd4')]&&_0x3bcaf6['body'][_0x2d5d('0x2c')]){_0x44a0a7=_0x3bcaf6['body'][_0x2d5d('0x2c')];return db[_0x2d5d('0xa9')][_0x2d5d('0x5c')]({'where':{'messageId':_0x3bcaf6[_0x2d5d('0x64')][_0x2d5d('0xd4')]}});}break;}}})[_0x2d5d('0x20')](handleEntityNotFound(_0x235b16,null))[_0x2d5d('0x20')](function(_0x32c3b7){if(_0x32c3b7){_0x1697e4=_0x32c3b7;switch(_0x1e53af[_0x2d5d('0x42')]){case _0x2d5d('0xd5'):if(_0x44a0a7===_0x2d5d('0xd6')){return _0x1697e4[_0x2d5d('0x35')]({'read':!![]});}else{logger[_0x2d5d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d5d('0x2c'),_0x2d5d('0xd5'),util['inspect'](_0x3bcaf6[_0x2d5d('0x64')],{'showHidden':![],'depth':null}));}break;case _0x2d5d('0xcf'):if(_0x44a0a7==='1'){return _0x1697e4['update']({'read':!![]});}else{logger[_0x2d5d('0x27')](_0x2d5d('0x25'),'status',_0x2d5d('0xd5'),util[_0x2d5d('0xd7')](_0x3bcaf6[_0x2d5d('0x64')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3bcaf6[_0x2d5d('0x64')]['error_code']&&_0x44a0a7>=0xc8&&_0x44a0a7<=0xce){return _0x1697e4['update']({'read':!![]});}else{logger['error'](_0x2d5d('0x25'),'status',_0x2d5d('0x85'),util[_0x2d5d('0xd7')](_0x3bcaf6['body'],{'showHidden':![],'depth':null}));}break;case _0x2d5d('0x8b'):var _0x5a3906=_0x3bcaf6['body'][_0x2d5d('0x8c')][0x0];if(_0x5a3906['status'][_0x2d5d('0xd3')]==='DELIVERED'){return _0x1697e4[_0x2d5d('0x35')]({'read':!![]});}else{logger[_0x2d5d('0x27')](_0x2d5d('0x25'),_0x2d5d('0x2c'),_0x2d5d('0x8b'),util[_0x2d5d('0xd7')](_0x3bcaf6[_0x2d5d('0x64')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x44a0a7==_0x2d5d('0xd8')||_0x44a0a7==_0x2d5d('0xd9')){return _0x1697e4['update']({'read':!![]});}else{logger['error'](_0x2d5d('0x25'),_0x2d5d('0x2c'),'clickatell',util['inspect'](_0x3bcaf6['body'],{'showHidden':![],'depth':null}));}break;case _0x2d5d('0x92'):if(_0x44a0a7==_0x2d5d('0xda')){return _0x1697e4[_0x2d5d('0x35')]({'read':!![]});}else{logger[_0x2d5d('0x27')](_0x2d5d('0x25'),_0x2d5d('0x2c'),'bandwidth',util['inspect'](_0x3bcaf6[_0x2d5d('0x64')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x44a0a7===_0x2d5d('0xdb')||_0x44a0a7===_0x2d5d('0xdc')){return _0x1697e4[_0x2d5d('0x35')]({'read':!![]});}else{logger[_0x2d5d('0x27')](_0x2d5d('0x25'),_0x2d5d('0x2c'),_0x2d5d('0x93'),util[_0x2d5d('0xd7')](_0x3bcaf6[_0x2d5d('0x64')],{'showHidden':![],'depth':null}));}break;}return _0x1697e4;}})[_0x2d5d('0x20')](respondWithResult(_0x235b16,null))[_0x2d5d('0x2a')](handleError(_0x235b16,null));};exports[_0x2d5d('0xdd')]=function(_0x8abd4b,_0x4818be,_0x232647){var _0xdaeff3,_0x2b6dcb,_0x31fe54;return db['SmsAccount']['find']({'where':{'id':_0x8abd4b[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x4818be,null))['then'](function(_0x1856a2){if(_0x1856a2){_0x31fe54=_0x1856a2;logger['debug'](_0x2d5d('0x25'),_0x2d5d('0x2c'),_0x2d5d('0xcd'),_0x1856a2[_0x2d5d('0x42')],util[_0x2d5d('0xd7')](_0x8abd4b[_0x2d5d('0x45')],{'showHidden':![],'depth':null}));switch(_0x1856a2[_0x2d5d('0x42')]){case _0x2d5d('0xde'):if(_0x8abd4b[_0x2d5d('0x45')][_0x2d5d('0xdf')]&&_0x8abd4b[_0x2d5d('0x45')][_0x2d5d('0xe0')]){_0x2b6dcb=_0x8abd4b[_0x2d5d('0x45')][_0x2d5d('0xe0')];return db[_0x2d5d('0xa9')][_0x2d5d('0x5c')]({'where':{'messageId':_0x8abd4b['query']['message-id']}});}break;}}})[_0x2d5d('0x20')](handleEntityNotFound(_0x4818be,null))[_0x2d5d('0x20')](function(_0x878648){if(_0x878648){_0xdaeff3=_0x878648;switch(_0x31fe54[_0x2d5d('0x42')]){case'csc':if(_0x2b6dcb==='2'||_0x2b6dcb==='6'){return _0xdaeff3[_0x2d5d('0x35')]({'read':!![]});}else{logger[_0x2d5d('0x27')](_0x2d5d('0x25'),_0x2d5d('0x2c'),_0x2d5d('0xde'),util[_0x2d5d('0xd7')](_0x8abd4b['query'],{'showHidden':![],'depth':null}));};break;}return _0xdaeff3;}})[_0x2d5d('0x20')](respondWithResult(_0x4818be,null))[_0x2d5d('0x2a')](handleError(_0x4818be,null));};exports[_0x2d5d('0xe1')]=function(_0x73dcff,_0x335533,_0x54a4b5){return db[_0x2d5d('0x54')]['find']({'where':{'id':_0x73dcff[_0x2d5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x335533,null))[_0x2d5d('0x20')](function(_0x745471){if(_0x745471){return _0x745471['addAgents'](_0x73dcff[_0x2d5d('0x64')][_0x2d5d('0x70')],_[_0x2d5d('0x9f')](_0x73dcff[_0x2d5d('0x64')],['ids','id'])||{})['spread'](function(_0x2d846d){for(var _0x45e3e7=0x0;_0x45e3e7<_0x73dcff[_0x2d5d('0x64')][_0x2d5d('0x70')]['length'];_0x45e3e7+=0x1){socket[_0x2d5d('0xe2')](_0x2d5d('0xe3'),{'UserId':Number(_0x73dcff[_0x2d5d('0x64')][_0x2d5d('0x70')][_0x45e3e7]),'SmsAccountId':Number(_0x73dcff[_0x2d5d('0x5a')]['id'])});}return _0x2d846d;});}})[_0x2d5d('0x20')](respondWithResult(_0x335533,null))['catch'](handleError(_0x335533,null));};exports[_0x2d5d('0xe4')]=function(_0x6bdc91,_0x5786d6,_0x385444){return db['SmsAccount']['find']({'where':{'id':_0x6bdc91['params']['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0x5786d6,null))[_0x2d5d('0x20')](function(_0x27dbaf){if(_0x27dbaf){return _0x27dbaf[_0x2d5d('0xe4')](_0x6bdc91[_0x2d5d('0x45')]['ids'])[_0x2d5d('0x20')](function(){if(_['isArray'](_0x6bdc91[_0x2d5d('0x45')][_0x2d5d('0x70')])){for(var _0x426680=0x0;_0x426680<_0x6bdc91[_0x2d5d('0x45')]['ids'][_0x2d5d('0x4b')];_0x426680+=0x1){socket[_0x2d5d('0xe2')](_0x2d5d('0xe5'),{'UserId':Number(_0x6bdc91['query'][_0x2d5d('0x70')][_0x426680]),'SmsAccountId':Number(_0x6bdc91['params']['id'])});}}else{socket[_0x2d5d('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x6bdc91[_0x2d5d('0x45')][_0x2d5d('0x70')]),'SmsAccountId':Number(_0x6bdc91[_0x2d5d('0x5a')]['id'])});}});}})[_0x2d5d('0x20')](respondWithStatusCode(_0x5786d6,null))[_0x2d5d('0x2a')](handleError(_0x5786d6,null));};exports[_0x2d5d('0xe6')]=function(_0x1406c8,_0xbe46e0,_0x4eee1f){var _0x587e88={};var _0x5df986={};var _0x5463ec;var _0x14c8f4;return db[_0x2d5d('0x54')]['findOne']({'where':{'id':_0x1406c8[_0x2d5d('0x5a')]['id']}})[_0x2d5d('0x20')](handleEntityNotFound(_0xbe46e0,null))['then'](function(_0x1745d4){if(_0x1745d4){_0x5463ec=_0x1745d4;_0x5df986[_0x2d5d('0x44')]=_[_0x2d5d('0x46')](db[_0x2d5d('0xc1')][_0x2d5d('0x40')]);_0x5df986[_0x2d5d('0x45')]=_[_0x2d5d('0x46')](_0x1406c8[_0x2d5d('0x45')]);_0x5df986[_0x2d5d('0x47')]=_[_0x2d5d('0x49')](_0x5df986[_0x2d5d('0x44')],_0x5df986[_0x2d5d('0x45')]);_0x587e88[_0x2d5d('0x48')]=_[_0x2d5d('0x49')](_0x5df986['model'],qs[_0x2d5d('0x4a')](_0x1406c8[_0x2d5d('0x45')][_0x2d5d('0x4a')]));_0x587e88[_0x2d5d('0x48')]=_0x587e88[_0x2d5d('0x48')]['length']?_0x587e88[_0x2d5d('0x48')]:_0x5df986[_0x2d5d('0x44')];_0x587e88['order']=qs[_0x2d5d('0x4e')](_0x1406c8[_0x2d5d('0x45')][_0x2d5d('0x4e')]);_0x587e88[_0x2d5d('0x51')]=qs[_0x2d5d('0x47')](_['pick'](_0x1406c8[_0x2d5d('0x45')],_0x5df986['filters']));if(_0x1406c8[_0x2d5d('0x45')][_0x2d5d('0x50')]){_0x587e88[_0x2d5d('0x51')]=_[_0x2d5d('0x52')](_0x587e88[_0x2d5d('0x51')],{'$or':_[_0x2d5d('0x3f')](_0x587e88['attributes'],function(_0x1dcc1c){var _0x257913={};_0x257913[_0x1dcc1c]={'$like':'%'+_0x1406c8['query'][_0x2d5d('0x50')]+'%'};return _0x257913;})});}_0x587e88=_['merge']({},_0x587e88,_0x1406c8[_0x2d5d('0x53')]);return _0x5463ec['getAgents'](_0x587e88);}})[_0x2d5d('0x20')](function(_0x46d41d){if(_0x46d41d){_0x14c8f4=_0x46d41d[_0x2d5d('0x4b')];if(!_0x1406c8[_0x2d5d('0x45')]['hasOwnProperty'](_0x2d5d('0x4d'))){_0x587e88[_0x2d5d('0x30')]=qs[_0x2d5d('0x30')](_0x1406c8[_0x2d5d('0x45')]['limit']);_0x587e88[_0x2d5d('0x32')]=qs[_0x2d5d('0x32')](_0x1406c8[_0x2d5d('0x45')]['offset']);}return _0x5463ec['getAgents'](_0x587e88);}})[_0x2d5d('0x20')](function(_0x75c21c){if(_0x75c21c){return _0x75c21c?{'count':_0x14c8f4,'rows':_0x75c21c}:null;}})[_0x2d5d('0x20')](respondWithResult(_0xbe46e0,null))[_0x2d5d('0x2a')](handleError(_0xbe46e0,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 99dffac..f3fcab0 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 _0xea2f=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x141782,_0x20a5de){var _0x504c01=function(_0x50452f){while(--_0x50452f){_0x141782['push'](_0x141782['shift']());}};_0x504c01(++_0x20a5de);}(_0xea2f,0xce));var _0xfea2=function(_0xa3eddb,_0x57d506){_0xa3eddb=_0xa3eddb-0x0;var _0x21f4e0=_0xea2f[_0xa3eddb];return _0x21f4e0;};'use strict';var EventEmitter=require(_0xfea2('0x0'));var SmsAccount=require(_0xfea2('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfea2('0x2')](0x0);var events={'afterCreate':_0xfea2('0x3'),'afterUpdate':_0xfea2('0x4'),'afterDestroy':_0xfea2('0x5')};function emitEvent(_0x121344){return function(_0x30f053,_0x3e8ab5,_0x5da3dd){SmsAccountEvents['emit'](_0x121344+':'+_0x30f053['id'],_0x30f053);SmsAccountEvents[_0xfea2('0x6')](_0x121344,_0x30f053);_0x5da3dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xfea2('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x53e1=['SmsAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x54a011,_0x33dfbd){var _0x263848=function(_0x1f7a85){while(--_0x1f7a85){_0x54a011['push'](_0x54a011['shift']());}};_0x263848(++_0x33dfbd);}(_0x53e1,0x16f));var _0x153e=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x53e1[_0x446208];return _0xe49563;};'use strict';var EventEmitter=require(_0x153e('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x153e('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x153e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x153e('0x3')};function emitEvent(_0x10ce79){return function(_0x38d6c6,_0x7937f2,_0x5c3c04){SmsAccountEvents[_0x153e('0x4')](_0x10ce79+':'+_0x38d6c6['id'],_0x38d6c6);SmsAccountEvents[_0x153e('0x4')](_0x10ce79,_0x38d6c6);_0x5c3c04(null);};}for(var e in events){if(events[_0x153e('0x5')](e)){var event=events[e];SmsAccount[_0x153e('0x6')](e,emitEvent(event));}}module[_0x153e('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 53c5bbe..ca12a1d 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 _0x5702=['lodash','api','moment','bluebird','path','../../config/environment','exports','sms_accounts'];(function(_0x18abd7,_0x10724f){var _0x384dd6=function(_0x1d3de3){while(--_0x1d3de3){_0x18abd7['push'](_0x18abd7['shift']());}};_0x384dd6(++_0x10724f);}(_0x5702,0x140));var _0x2570=function(_0x5adb34,_0x511d88){_0x5adb34=_0x5adb34-0x0;var _0x347dcc=_0x5702[_0x5adb34];return _0x347dcc;};'use strict';var _=require(_0x2570('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2570('0x1'));var moment=require(_0x2570('0x2'));var BPromise=require(_0x2570('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2570('0x4'));var rimraf=require('rimraf');var config=require(_0x2570('0x5'));var attributes=require('./smsAccount.attributes');module[_0x2570('0x6')]=function(_0x3a703b,_0x2cef99){return _0x3a703b['define']('SmsAccount',attributes,{'tableName':_0x2570('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf60a=['bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf60a,0x10d));var _0xaf60=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0xf60a[_0x29975a];return _0x41bcac;};'use strict';var _=require(_0xaf60('0x0'));var util=require('util');var logger=require(_0xaf60('0x1'))(_0xaf60('0x2'));var moment=require(_0xaf60('0x3'));var BPromise=require(_0xaf60('0x4'));var rp=require(_0xaf60('0x5'));var fs=require('fs');var path=require(_0xaf60('0x6'));var rimraf=require(_0xaf60('0x7'));var config=require(_0xaf60('0x8'));var attributes=require(_0xaf60('0x9'));module['exports']=function(_0x23dda7,_0x4208a5){return _0x23dda7[_0xaf60('0xa')](_0xaf60('0xb'),attributes,{'tableName':_0xaf60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 4426516..73670e7 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 _0xbe68=['code','SmsAccount,\x20%s,\x20%s','message','result','find','options','raw','where','attributes','map','include','model','ShowSmsAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','request\x20sent','stringify','error'];(function(_0x53081f,_0x31fbd5){var _0x15b682=function(_0x451719){while(--_0x451719){_0x53081f['push'](_0x53081f['shift']());}};_0x15b682(++_0x31fbd5);}(_0xbe68,0x194));var _0x8be6=function(_0x1fbc82,_0x4163a0){_0x1fbc82=_0x1fbc82-0x0;var _0x291cb9=_0xbe68[_0x1fbc82];return _0x291cb9;};'use strict';var _=require(_0x8be6('0x0'));var util=require(_0x8be6('0x1'));var moment=require(_0x8be6('0x2'));var BPromise=require(_0x8be6('0x3'));var rs=require(_0x8be6('0x4'));var fs=require('fs');var Redis=require(_0x8be6('0x5'));var db=require(_0x8be6('0x6'))['db'];var utils=require(_0x8be6('0x7'));var logger=require(_0x8be6('0x8'))(_0x8be6('0x9'));var config=require(_0x8be6('0xa'));var jayson=require(_0x8be6('0xb'));var client=jayson[_0x8be6('0xc')][_0x8be6('0xd')]({'port':0x232a});config[_0x8be6('0xe')]=_[_0x8be6('0xf')](config['redis'],{'host':_0x8be6('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8be6('0xe')]));require(_0x8be6('0x11'))[_0x8be6('0x12')](socket);function respondWithRpcPromise(_0x3d93bd,_0x15be67,_0x19e421){return new BPromise(function(_0x3f1a9f,_0x3abe5f){return client[_0x8be6('0x13')](_0x3d93bd,_0x19e421)[_0x8be6('0x14')](function(_0x4709cd){logger[_0x8be6('0x15')]('SmsAccount,\x20%s,\x20%s',_0x15be67,_0x8be6('0x16'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x15be67,_0x8be6('0x16'),JSON[_0x8be6('0x17')](_0x4709cd));if(_0x4709cd['error']){if(_0x4709cd[_0x8be6('0x18')][_0x8be6('0x19')]===0x1f4){logger['error'](_0x8be6('0x1a'),_0x15be67,_0x4709cd[_0x8be6('0x18')]['message']);return _0x3abe5f(_0x4709cd['error']['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x15be67,_0x4709cd[_0x8be6('0x18')][_0x8be6('0x1b')]);return _0x3f1a9f(_0x4709cd[_0x8be6('0x18')][_0x8be6('0x1b')]);}else{logger[_0x8be6('0x15')](_0x8be6('0x1a'),_0x15be67,_0x8be6('0x16'));_0x3f1a9f(_0x4709cd[_0x8be6('0x1c')]['message']);}})['catch'](function(_0x2372cb){logger['error']('SmsAccount,\x20%s,\x20%s',_0x15be67,_0x2372cb);_0x3abe5f(_0x2372cb);});});}exports['ShowSmsAccount']=function(_0x34a8f1){var _0xd2261b=this;return new Promise(function(_0x4a97b9,_0x85fd14){return db['SmsAccount'][_0x8be6('0x1d')]({'raw':_0x34a8f1[_0x8be6('0x1e')]?_0x34a8f1[_0x8be6('0x1e')][_0x8be6('0x1f')]===undefined?!![]:![]:!![],'where':_0x34a8f1[_0x8be6('0x1e')]?_0x34a8f1[_0x8be6('0x1e')][_0x8be6('0x20')]||null:null,'attributes':_0x34a8f1['options']?_0x34a8f1['options'][_0x8be6('0x21')]||null:null,'include':_0x34a8f1[_0x8be6('0x1e')]?_0x34a8f1[_0x8be6('0x1e')]['include']?_[_0x8be6('0x22')](_0x34a8f1[_0x8be6('0x1e')][_0x8be6('0x23')],function(_0x2e9dae){return{'model':db[_0x2e9dae['model']],'as':_0x2e9dae['as'],'attributes':_0x2e9dae[_0x8be6('0x21')],'include':_0x2e9dae[_0x8be6('0x23')]?_['map'](_0x2e9dae[_0x8be6('0x23')],function(_0x12ddfa){return{'model':db[_0x12ddfa[_0x8be6('0x24')]],'as':_0x12ddfa['as'],'attributes':_0x12ddfa[_0x8be6('0x21')],'include':_0x12ddfa[_0x8be6('0x23')]?_[_0x8be6('0x22')](_0x12ddfa[_0x8be6('0x23')],function(_0x3666c0){return{'model':db[_0x3666c0[_0x8be6('0x24')]],'as':_0x3666c0['as'],'attributes':_0x3666c0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8be6('0x14')](function(_0x2a5d82){logger['info'](_0x8be6('0x25'),_0x34a8f1);logger['debug'](_0x8be6('0x25'),_0x34a8f1,JSON['stringify'](_0x2a5d82));_0x4a97b9(_0x2a5d82);})[_0x8be6('0x26')](function(_0x38a86c){logger['error']('ShowSmsAccount',_0x38a86c[_0x8be6('0x1b')],_0x34a8f1);_0x85fd14(_0xd2261b[_0x8be6('0x18')](0x1f4,_0x38a86c['message']));});});}; \ No newline at end of file +var _0xd646=['defaults','redis','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x560baf,_0x5c83d4){var _0x34c4b1=function(_0x14bb80){while(--_0x14bb80){_0x560baf['push'](_0x560baf['shift']());}};_0x34c4b1(++_0x5c83d4);}(_0xd646,0x85));var _0x6d64=function(_0x538230,_0x522250){_0x538230=_0x538230-0x0;var _0x30f32b=_0xd646[_0x538230];return _0x30f32b;};'use strict';var _=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var moment=require(_0x6d64('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d64('0x4'))['db'];var utils=require(_0x6d64('0x5'));var logger=require('../../config/logger')(_0x6d64('0x6'));var config=require(_0x6d64('0x7'));var jayson=require(_0x6d64('0x8'));var client=jayson[_0x6d64('0x9')][_0x6d64('0xa')]({'port':0x232a});config['redis']=_[_0x6d64('0xb')](config[_0x6d64('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d64('0xd'))(new Redis(config['redis']));require(_0x6d64('0xe'))[_0x6d64('0xf')](socket);function respondWithRpcPromise(_0x1f9654,_0x4f6722,_0x607fe3){return new BPromise(function(_0xbb9d22,_0x499c88){return client[_0x6d64('0x10')](_0x1f9654,_0x607fe3)[_0x6d64('0x11')](function(_0x46b0c0){logger['info'](_0x6d64('0x12'),_0x4f6722,_0x6d64('0x13'));logger[_0x6d64('0x14')](_0x6d64('0x15'),_0x4f6722,_0x6d64('0x13'),JSON['stringify'](_0x46b0c0));if(_0x46b0c0[_0x6d64('0x16')]){if(_0x46b0c0[_0x6d64('0x16')][_0x6d64('0x17')]===0x1f4){logger[_0x6d64('0x16')](_0x6d64('0x12'),_0x4f6722,_0x46b0c0[_0x6d64('0x16')][_0x6d64('0x18')]);return _0x499c88(_0x46b0c0[_0x6d64('0x16')]['message']);}logger[_0x6d64('0x16')]('SmsAccount,\x20%s,\x20%s',_0x4f6722,_0x46b0c0[_0x6d64('0x16')][_0x6d64('0x18')]);return _0xbb9d22(_0x46b0c0[_0x6d64('0x16')]['message']);}else{logger[_0x6d64('0x19')]('SmsAccount,\x20%s,\x20%s',_0x4f6722,_0x6d64('0x13'));_0xbb9d22(_0x46b0c0['result'][_0x6d64('0x18')]);}})['catch'](function(_0x5c3499){logger[_0x6d64('0x16')](_0x6d64('0x12'),_0x4f6722,_0x5c3499);_0x499c88(_0x5c3499);});});}exports[_0x6d64('0x1a')]=function(_0x76f3ce){var _0x1fbca3=this;return new Promise(function(_0x1919fc,_0x3f78b5){return db[_0x6d64('0x1b')][_0x6d64('0x1c')]({'raw':_0x76f3ce[_0x6d64('0x1d')]?_0x76f3ce[_0x6d64('0x1d')][_0x6d64('0x1e')]===undefined?!![]:![]:!![],'where':_0x76f3ce[_0x6d64('0x1d')]?_0x76f3ce[_0x6d64('0x1d')]['where']||null:null,'attributes':_0x76f3ce['options']?_0x76f3ce['options'][_0x6d64('0x1f')]||null:null,'include':_0x76f3ce[_0x6d64('0x1d')]?_0x76f3ce[_0x6d64('0x1d')][_0x6d64('0x20')]?_['map'](_0x76f3ce[_0x6d64('0x1d')]['include'],function(_0x382094){return{'model':db[_0x382094['model']],'as':_0x382094['as'],'attributes':_0x382094[_0x6d64('0x1f')],'include':_0x382094['include']?_[_0x6d64('0x21')](_0x382094['include'],function(_0x5f50ac){return{'model':db[_0x5f50ac[_0x6d64('0x22')]],'as':_0x5f50ac['as'],'attributes':_0x5f50ac['attributes'],'include':_0x5f50ac[_0x6d64('0x20')]?_[_0x6d64('0x21')](_0x5f50ac[_0x6d64('0x20')],function(_0x1b141f){return{'model':db[_0x1b141f[_0x6d64('0x22')]],'as':_0x1b141f['as'],'attributes':_0x1b141f[_0x6d64('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d64('0x11')](function(_0xc8f325){logger[_0x6d64('0x19')](_0x6d64('0x1a'),_0x76f3ce);logger['debug']('ShowSmsAccount',_0x76f3ce,JSON[_0x6d64('0x23')](_0xc8f325));_0x1919fc(_0xc8f325);})['catch'](function(_0x56cebd){logger[_0x6d64('0x16')](_0x6d64('0x1a'),_0x56cebd[_0x6d64('0x18')],_0x76f3ce);_0x3f78b5(_0x1fbca3[_0x6d64('0x16')](0x1f4,_0x56cebd[_0x6d64('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0f6ff64..6d1106a 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(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 16a8708..cc6f995 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1b58b4,_0x52a82b){var _0x2ac852=function(_0x19c945){while(--_0x19c945){_0x1b58b4['push'](_0x1b58b4['shift']());}};_0x2ac852(++_0x52a82b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2b7f72,_0x277613){_0x2b7f72=_0x2b7f72-0x0;var _0x25963b=_0xedd9[_0x2b7f72];return _0x25963b;};'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('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1651de6..dd4defc 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 _0xae51=['sequelize','exports','STRING','*,*,*,*'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xae51,0x160));var _0x1ae5=function(_0x40d326,_0x5b9118){_0x40d326=_0x40d326-0x0;var _0x3ea0e7=_0xae51[_0x40d326];return _0x3ea0e7;};'use strict';var Sequelize=require(_0x1ae5('0x0'));module[_0x1ae5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1ae5('0x2')]},'interval':{'type':Sequelize[_0x1ae5('0x2')],'defaultValue':_0x1ae5('0x3')}}; \ No newline at end of file +var _0x5bbd=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x1f29dc,_0x58070a){var _0x358c8c=function(_0x3dd881){while(--_0x3dd881){_0x1f29dc['push'](_0x1f29dc['shift']());}};_0x358c8c(++_0x58070a);}(_0x5bbd,0x13d));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd5bb('0x0')]={'priority':{'type':Sequelize[_0xd5bb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd5bb('0x2')],'allowNull':![],'defaultValue':_0xd5bb('0x3')},'appdata':{'type':Sequelize[_0xd5bb('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd5bb('0x2')],'defaultValue':_0xd5bb('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a9f96af..9188b04 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 _0x9c0e=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','end','sendStatus','error','stack','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv'];(function(_0x2dc661,_0x7d8136){var _0x18315d=function(_0x2586e7){while(--_0x2586e7){_0x2dc661['push'](_0x2dc661['shift']());}};_0x18315d(++_0x7d8136);}(_0x9c0e,0xe0));var _0xe9c0=function(_0x102d62,_0x17910a){_0x102d62=_0x102d62-0x0;var _0x343b11=_0x9c0e[_0x102d62];return _0x343b11;};'use strict';var emlformat=require(_0xe9c0('0x0'));var rimraf=require(_0xe9c0('0x1'));var zipdir=require(_0xe9c0('0x2'));var jsonpatch=require(_0xe9c0('0x3'));var rp=require(_0xe9c0('0x4'));var moment=require(_0xe9c0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c0('0x6'));var path=require(_0xe9c0('0x7'));var sox=require(_0xe9c0('0x8'));var csv=require(_0xe9c0('0x9'));var ejs=require(_0xe9c0('0xa'));var fs=require('fs');var fs_extra=require(_0xe9c0('0xb'));var _=require(_0xe9c0('0xc'));var squel=require(_0xe9c0('0xd'));var crypto=require(_0xe9c0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe9c0('0xf'));var toCsv=require(_0xe9c0('0x9'));var querystring=require(_0xe9c0('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9c0('0x11'));var authService=require(_0xe9c0('0x12'));var qs=require(_0xe9c0('0x13'));var as=require(_0xe9c0('0x14'));var hardwareService=require(_0xe9c0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe9c0('0x16'));var config=require(_0xe9c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9c0('0x18'))['db'];function respondWithStatusCode(_0x539556,_0x5f0af9){_0x5f0af9=_0x5f0af9||0xcc;return function(_0x7b6325){if(_0x7b6325){return _0x539556['sendStatus'](_0x5f0af9);}return _0x539556[_0xe9c0('0x19')](_0x5f0af9)['end']();};}function respondWithResult(_0x1ee71f,_0x56b297){_0x56b297=_0x56b297||0xc8;return function(_0x53e753){if(_0x53e753){return _0x1ee71f[_0xe9c0('0x19')](_0x56b297)['json'](_0x53e753);}};}function respondWithFilteredResult(_0x352796,_0x6fbe1){return function(_0x27f9c1){if(_0x27f9c1){var _0x5a1ef4=typeof _0x6fbe1['offset']===_0xe9c0('0x1a')&&typeof _0x6fbe1[_0xe9c0('0x1b')]==='undefined';var _0x4d42a8=_0x27f9c1['count'];var _0x4f947d=_0x5a1ef4?0x0:_0x6fbe1['offset'];var _0x480b71=_0x5a1ef4?_0x27f9c1[_0xe9c0('0x1c')]:_0x6fbe1[_0xe9c0('0x1d')]+_0x6fbe1['limit'];var _0x4be31b;if(_0x480b71>=_0x4d42a8){_0x480b71=_0x4d42a8;_0x4be31b=0xc8;}else{_0x4be31b=0xce;}_0x352796['status'](_0x4be31b);return _0x352796[_0xe9c0('0x1e')](_0xe9c0('0x1f'),_0x4f947d+'-'+_0x480b71+'/'+_0x4d42a8)[_0xe9c0('0x20')](_0x27f9c1);}return null;};}function patchUpdates(_0x2cf248){return function(_0x22657e){try{jsonpatch[_0xe9c0('0x21')](_0x22657e,_0x2cf248,!![]);}catch(_0x149f5b){return BPromise[_0xe9c0('0x22')](_0x149f5b);}return _0x22657e['save']();};}function saveUpdates(_0x560b54,_0x3c0d2e){return function(_0x1bac80){if(_0x1bac80){return _0x1bac80[_0xe9c0('0x23')](_0x560b54)['then'](function(_0x30d1e7){return _0x30d1e7;});}return null;};}function removeEntity(_0x3c80d1,_0x11dbfd){return function(_0x23fc82){if(_0x23fc82){return _0x23fc82[_0xe9c0('0x24')]()['then'](function(){_0x3c80d1[_0xe9c0('0x19')](0xcc)[_0xe9c0('0x25')]();});}};}function handleEntityNotFound(_0x3243a6,_0x355d5c){return function(_0x3c2bda){if(!_0x3c2bda){_0x3243a6[_0xe9c0('0x26')](0x194);}return _0x3c2bda;};}function handleError(_0x586976,_0x11ecdb){_0x11ecdb=_0x11ecdb||0x1f4;return function(_0x26c045){logger[_0xe9c0('0x27')](_0x26c045[_0xe9c0('0x28')]);if(_0x26c045['name']){delete _0x26c045['name'];}_0x586976['status'](_0x11ecdb)[_0xe9c0('0x29')](_0x26c045);};}exports[_0xe9c0('0x2a')]=function(_0x18d758,_0x58c45a){var _0x5558c3={},_0x5ec4c9={},_0x5b7965={'count':0x0,'rows':[]};var _0x49890e=_[_0xe9c0('0x2b')](db[_0xe9c0('0x2c')][_0xe9c0('0x2d')],function(_0xa6f513){return{'name':_0xa6f513[_0xe9c0('0x2e')],'type':_0xa6f513[_0xe9c0('0x2f')][_0xe9c0('0x30')]};});_0x5ec4c9[_0xe9c0('0x31')]=_['map'](_0x49890e,_0xe9c0('0x32'));_0x5ec4c9[_0xe9c0('0x33')]=_[_0xe9c0('0x34')](_0x18d758[_0xe9c0('0x33')]);_0x5ec4c9[_0xe9c0('0x35')]=_[_0xe9c0('0x36')](_0x5ec4c9[_0xe9c0('0x31')],_0x5ec4c9['query']);_0x5558c3[_0xe9c0('0x37')]=_[_0xe9c0('0x36')](_0x5ec4c9[_0xe9c0('0x31')],qs[_0xe9c0('0x38')](_0x18d758['query']['fields']));_0x5558c3[_0xe9c0('0x37')]=_0x5558c3[_0xe9c0('0x37')]['length']?_0x5558c3['attributes']:_0x5ec4c9[_0xe9c0('0x31')];if(!_0x18d758[_0xe9c0('0x33')][_0xe9c0('0x39')](_0xe9c0('0x3a'))){_0x5558c3[_0xe9c0('0x1b')]=qs[_0xe9c0('0x1b')](_0x18d758[_0xe9c0('0x33')][_0xe9c0('0x1b')]);_0x5558c3['offset']=qs['offset'](_0x18d758[_0xe9c0('0x33')][_0xe9c0('0x1d')]);}_0x5558c3['order']=qs[_0xe9c0('0x3b')](_0x18d758['query'][_0xe9c0('0x3b')]);_0x5558c3['where']=qs['filters'](_[_0xe9c0('0x3c')](_0x18d758['query'],_0x5ec4c9[_0xe9c0('0x35')]),_0x49890e);if(_0x18d758[_0xe9c0('0x33')][_0xe9c0('0x3d')]){_0x5558c3['where']=_[_0xe9c0('0x3e')](_0x5558c3[_0xe9c0('0x3f')],{'$or':_[_0xe9c0('0x2b')](_0x49890e,function(_0x426471){if(_0x426471[_0xe9c0('0x2f')]!==_0xe9c0('0x40')){var _0x2e4e96={};_0x2e4e96[_0x426471['name']]={'$like':'%'+_0x18d758['query']['filter']+'%'};return _0x2e4e96;}})});}_0x5558c3=_['merge']({},_0x5558c3,_0x18d758[_0xe9c0('0x41')]);var _0x3b02cc={'where':_0x5558c3['where']};return db[_0xe9c0('0x2c')][_0xe9c0('0x1c')](_0x3b02cc)[_0xe9c0('0x42')](function(_0x56edde){_0x5b7965[_0xe9c0('0x1c')]=_0x56edde;if(_0x18d758[_0xe9c0('0x33')][_0xe9c0('0x43')]){_0x5558c3['include']=[{'all':!![]}];}return db['SmsApplication'][_0xe9c0('0x44')](_0x5558c3);})[_0xe9c0('0x42')](function(_0xae7a3f){_0x5b7965[_0xe9c0('0x45')]=_0xae7a3f;return _0x5b7965;})[_0xe9c0('0x42')](respondWithFilteredResult(_0x58c45a,_0x5558c3))[_0xe9c0('0x46')](handleError(_0x58c45a,null));};exports[_0xe9c0('0x47')]=function(_0x504e96,_0x5f0ec3){var _0x5a61ab={'raw':!![],'where':{'id':_0x504e96[_0xe9c0('0x48')]['id']}},_0x3976b7={};_0x3976b7[_0xe9c0('0x31')]=_['keys'](db[_0xe9c0('0x2c')][_0xe9c0('0x2d')]);_0x3976b7[_0xe9c0('0x33')]=_[_0xe9c0('0x34')](_0x504e96['query']);_0x3976b7['filters']=_['intersection'](_0x3976b7['model'],_0x3976b7[_0xe9c0('0x33')]);_0x5a61ab[_0xe9c0('0x37')]=_[_0xe9c0('0x36')](_0x3976b7['model'],qs['fields'](_0x504e96[_0xe9c0('0x33')][_0xe9c0('0x38')]));_0x5a61ab[_0xe9c0('0x37')]=_0x5a61ab[_0xe9c0('0x37')][_0xe9c0('0x49')]?_0x5a61ab[_0xe9c0('0x37')]:_0x3976b7[_0xe9c0('0x31')];if(_0x504e96[_0xe9c0('0x33')][_0xe9c0('0x43')]){_0x5a61ab[_0xe9c0('0x4a')]=[{'all':!![]}];}_0x5a61ab=_[_0xe9c0('0x3e')]({},_0x5a61ab,_0x504e96[_0xe9c0('0x41')]);return db['SmsApplication']['find'](_0x5a61ab)['then'](handleEntityNotFound(_0x5f0ec3,null))[_0xe9c0('0x42')](respondWithResult(_0x5f0ec3,null))[_0xe9c0('0x46')](handleError(_0x5f0ec3,null));};exports[_0xe9c0('0x4b')]=function(_0x27b33e,_0x57e38b){return db['SmsApplication'][_0xe9c0('0x4b')](_0x27b33e[_0xe9c0('0x4c')],{})['then'](respondWithResult(_0x57e38b,0xc9))[_0xe9c0('0x46')](handleError(_0x57e38b,null));};exports['update']=function(_0x5c6d23,_0x5989d6){if(_0x5c6d23[_0xe9c0('0x4c')]['id']){delete _0x5c6d23[_0xe9c0('0x4c')]['id'];}return db[_0xe9c0('0x2c')][_0xe9c0('0x4d')]({'where':{'id':_0x5c6d23[_0xe9c0('0x48')]['id']}})[_0xe9c0('0x42')](handleEntityNotFound(_0x5989d6,null))[_0xe9c0('0x42')](saveUpdates(_0x5c6d23[_0xe9c0('0x4c')],null))[_0xe9c0('0x42')](respondWithResult(_0x5989d6,null))['catch'](handleError(_0x5989d6,null));};exports[_0xe9c0('0x24')]=function(_0x4776e7,_0x343a60){return db[_0xe9c0('0x2c')]['find']({'where':{'id':_0x4776e7[_0xe9c0('0x48')]['id']}})[_0xe9c0('0x42')](handleEntityNotFound(_0x343a60,null))['then'](removeEntity(_0x343a60,null))['catch'](handleError(_0x343a60,null));}; \ No newline at end of file +var _0xf8dd=['mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x15d019,_0x476dcc){var _0x5b691b=function(_0x9a9ef0){while(--_0x9a9ef0){_0x15d019['push'](_0x15d019['shift']());}};_0x5b691b(++_0x476dcc);}(_0xf8dd,0xd0));var _0xdf8d=function(_0x1cbcd2,_0x1a7234){_0x1cbcd2=_0x1cbcd2-0x0;var _0x31ad32=_0xf8dd[_0x1cbcd2];return _0x31ad32;};'use strict';var emlformat=require(_0xdf8d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdf8d('0x1'));var rp=require(_0xdf8d('0x2'));var moment=require(_0xdf8d('0x3'));var BPromise=require(_0xdf8d('0x4'));var Mustache=require(_0xdf8d('0x5'));var util=require(_0xdf8d('0x6'));var path=require('path');var sox=require(_0xdf8d('0x7'));var csv=require(_0xdf8d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf8d('0x9'));var squel=require(_0xdf8d('0xa'));var crypto=require(_0xdf8d('0xb'));var jsforce=require(_0xdf8d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf8d('0x8'));var querystring=require(_0xdf8d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdf8d('0xe'));var qs=require(_0xdf8d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf8d('0x10'));var logger=require(_0xdf8d('0x11'))('api');var utils=require(_0xdf8d('0x12'));var config=require(_0xdf8d('0x13'));var licenseUtil=require(_0xdf8d('0x14'));var db=require(_0xdf8d('0x15'))['db'];function respondWithStatusCode(_0x59a5f1,_0x39d6db){_0x39d6db=_0x39d6db||0xcc;return function(_0x4f1b57){if(_0x4f1b57){return _0x59a5f1[_0xdf8d('0x16')](_0x39d6db);}return _0x59a5f1['status'](_0x39d6db)[_0xdf8d('0x17')]();};}function respondWithResult(_0x3bb777,_0x51495d){_0x51495d=_0x51495d||0xc8;return function(_0x1331c8){if(_0x1331c8){return _0x3bb777[_0xdf8d('0x18')](_0x51495d)['json'](_0x1331c8);}};}function respondWithFilteredResult(_0x17d151,_0x2159ee){return function(_0x66062a){if(_0x66062a){var _0x5462aa=typeof _0x2159ee['offset']==='undefined'&&typeof _0x2159ee[_0xdf8d('0x19')]==='undefined';var _0x5de6b=_0x66062a[_0xdf8d('0x1a')];var _0x11a211=_0x5462aa?0x0:_0x2159ee[_0xdf8d('0x1b')];var _0x1d5490=_0x5462aa?_0x66062a['count']:_0x2159ee[_0xdf8d('0x1b')]+_0x2159ee['limit'];var _0x269501;if(_0x1d5490>=_0x5de6b){_0x1d5490=_0x5de6b;_0x269501=0xc8;}else{_0x269501=0xce;}_0x17d151[_0xdf8d('0x18')](_0x269501);return _0x17d151[_0xdf8d('0x1c')](_0xdf8d('0x1d'),_0x11a211+'-'+_0x1d5490+'/'+_0x5de6b)[_0xdf8d('0x1e')](_0x66062a);}return null;};}function patchUpdates(_0x4446de){return function(_0x34b711){try{jsonpatch[_0xdf8d('0x1f')](_0x34b711,_0x4446de,!![]);}catch(_0x3d9e5a){return BPromise[_0xdf8d('0x20')](_0x3d9e5a);}return _0x34b711['save']();};}function saveUpdates(_0x2e04d8,_0x4e47ff){return function(_0x414fbf){if(_0x414fbf){return _0x414fbf[_0xdf8d('0x21')](_0x2e04d8)[_0xdf8d('0x22')](function(_0x58ff6d){return _0x58ff6d;});}return null;};}function removeEntity(_0x367709,_0x4c414){return function(_0x49fcc8){if(_0x49fcc8){return _0x49fcc8['destroy']()[_0xdf8d('0x22')](function(){_0x367709['status'](0xcc)[_0xdf8d('0x17')]();});}};}function handleEntityNotFound(_0x2a6633,_0x32dcc8){return function(_0x25bfe1){if(!_0x25bfe1){_0x2a6633[_0xdf8d('0x16')](0x194);}return _0x25bfe1;};}function handleError(_0x503884,_0x1f5ad4){_0x1f5ad4=_0x1f5ad4||0x1f4;return function(_0x2d4315){logger[_0xdf8d('0x23')](_0x2d4315['stack']);if(_0x2d4315[_0xdf8d('0x24')]){delete _0x2d4315[_0xdf8d('0x24')];}_0x503884[_0xdf8d('0x18')](_0x1f5ad4)[_0xdf8d('0x25')](_0x2d4315);};}exports[_0xdf8d('0x26')]=function(_0x47f368,_0x26fbe8){var _0x292c91={},_0x540817={},_0x530f99={'count':0x0,'rows':[]};var _0xc9270e=_[_0xdf8d('0x27')](db[_0xdf8d('0x28')][_0xdf8d('0x29')],function(_0x4fd0cb){return{'name':_0x4fd0cb[_0xdf8d('0x2a')],'type':_0x4fd0cb[_0xdf8d('0x2b')][_0xdf8d('0x2c')]};});_0x540817['model']=_[_0xdf8d('0x27')](_0xc9270e,_0xdf8d('0x24'));_0x540817[_0xdf8d('0x2d')]=_[_0xdf8d('0x2e')](_0x47f368[_0xdf8d('0x2d')]);_0x540817[_0xdf8d('0x2f')]=_[_0xdf8d('0x30')](_0x540817[_0xdf8d('0x31')],_0x540817[_0xdf8d('0x2d')]);_0x292c91['attributes']=_[_0xdf8d('0x30')](_0x540817[_0xdf8d('0x31')],qs[_0xdf8d('0x32')](_0x47f368[_0xdf8d('0x2d')][_0xdf8d('0x32')]));_0x292c91[_0xdf8d('0x33')]=_0x292c91[_0xdf8d('0x33')][_0xdf8d('0x34')]?_0x292c91[_0xdf8d('0x33')]:_0x540817[_0xdf8d('0x31')];if(!_0x47f368[_0xdf8d('0x2d')][_0xdf8d('0x35')](_0xdf8d('0x36'))){_0x292c91[_0xdf8d('0x19')]=qs[_0xdf8d('0x19')](_0x47f368[_0xdf8d('0x2d')]['limit']);_0x292c91[_0xdf8d('0x1b')]=qs['offset'](_0x47f368[_0xdf8d('0x2d')][_0xdf8d('0x1b')]);}_0x292c91[_0xdf8d('0x37')]=qs[_0xdf8d('0x38')](_0x47f368[_0xdf8d('0x2d')][_0xdf8d('0x38')]);_0x292c91[_0xdf8d('0x39')]=qs[_0xdf8d('0x2f')](_[_0xdf8d('0x3a')](_0x47f368['query'],_0x540817['filters']),_0xc9270e);if(_0x47f368[_0xdf8d('0x2d')][_0xdf8d('0x3b')]){_0x292c91['where']=_['merge'](_0x292c91['where'],{'$or':_[_0xdf8d('0x27')](_0xc9270e,function(_0x6882a4){if(_0x6882a4['type']!==_0xdf8d('0x3c')){var _0x5ed3a6={};_0x5ed3a6[_0x6882a4[_0xdf8d('0x24')]]={'$like':'%'+_0x47f368['query'][_0xdf8d('0x3b')]+'%'};return _0x5ed3a6;}})});}_0x292c91=_['merge']({},_0x292c91,_0x47f368['options']);var _0x347b08={'where':_0x292c91[_0xdf8d('0x39')]};return db[_0xdf8d('0x28')]['count'](_0x347b08)[_0xdf8d('0x22')](function(_0x4ba3db){_0x530f99[_0xdf8d('0x1a')]=_0x4ba3db;if(_0x47f368[_0xdf8d('0x2d')][_0xdf8d('0x3d')]){_0x292c91[_0xdf8d('0x3e')]=[{'all':!![]}];}return db[_0xdf8d('0x28')][_0xdf8d('0x3f')](_0x292c91);})[_0xdf8d('0x22')](function(_0x4dc07d){_0x530f99[_0xdf8d('0x40')]=_0x4dc07d;return _0x530f99;})['then'](respondWithFilteredResult(_0x26fbe8,_0x292c91))['catch'](handleError(_0x26fbe8,null));};exports['show']=function(_0x2397cc,_0x5e32e6){var _0x403eda={'raw':!![],'where':{'id':_0x2397cc[_0xdf8d('0x41')]['id']}},_0x51a7d9={};_0x51a7d9[_0xdf8d('0x31')]=_[_0xdf8d('0x2e')](db[_0xdf8d('0x28')][_0xdf8d('0x29')]);_0x51a7d9['query']=_[_0xdf8d('0x2e')](_0x2397cc[_0xdf8d('0x2d')]);_0x51a7d9[_0xdf8d('0x2f')]=_['intersection'](_0x51a7d9[_0xdf8d('0x31')],_0x51a7d9[_0xdf8d('0x2d')]);_0x403eda[_0xdf8d('0x33')]=_[_0xdf8d('0x30')](_0x51a7d9['model'],qs[_0xdf8d('0x32')](_0x2397cc[_0xdf8d('0x2d')][_0xdf8d('0x32')]));_0x403eda[_0xdf8d('0x33')]=_0x403eda[_0xdf8d('0x33')][_0xdf8d('0x34')]?_0x403eda['attributes']:_0x51a7d9['model'];if(_0x2397cc[_0xdf8d('0x2d')][_0xdf8d('0x3d')]){_0x403eda[_0xdf8d('0x3e')]=[{'all':!![]}];}_0x403eda=_['merge']({},_0x403eda,_0x2397cc[_0xdf8d('0x42')]);return db[_0xdf8d('0x28')][_0xdf8d('0x43')](_0x403eda)['then'](handleEntityNotFound(_0x5e32e6,null))[_0xdf8d('0x22')](respondWithResult(_0x5e32e6,null))[_0xdf8d('0x44')](handleError(_0x5e32e6,null));};exports[_0xdf8d('0x45')]=function(_0x506fe7,_0x3bcf21){return db[_0xdf8d('0x28')][_0xdf8d('0x45')](_0x506fe7[_0xdf8d('0x46')],{})[_0xdf8d('0x22')](respondWithResult(_0x3bcf21,0xc9))[_0xdf8d('0x44')](handleError(_0x3bcf21,null));};exports[_0xdf8d('0x21')]=function(_0x263167,_0x204a29){if(_0x263167[_0xdf8d('0x46')]['id']){delete _0x263167[_0xdf8d('0x46')]['id'];}return db[_0xdf8d('0x28')]['find']({'where':{'id':_0x263167[_0xdf8d('0x41')]['id']}})[_0xdf8d('0x22')](handleEntityNotFound(_0x204a29,null))[_0xdf8d('0x22')](saveUpdates(_0x263167[_0xdf8d('0x46')],null))[_0xdf8d('0x22')](respondWithResult(_0x204a29,null))[_0xdf8d('0x44')](handleError(_0x204a29,null));};exports['destroy']=function(_0x513e4b,_0x11e4ef){return db[_0xdf8d('0x28')][_0xdf8d('0x43')]({'where':{'id':_0x513e4b[_0xdf8d('0x41')]['id']}})[_0xdf8d('0x22')](handleEntityNotFound(_0x11e4ef,null))['then'](removeEntity(_0x11e4ef,null))[_0xdf8d('0x44')](handleError(_0x11e4ef,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index dc81f7f..01b1f9c 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 _0x5203=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x1ed0ab,_0x3234d9){var _0x4889fb=function(_0x2566c9){while(--_0x2566c9){_0x1ed0ab['push'](_0x1ed0ab['shift']());}};_0x4889fb(++_0x3234d9);}(_0x5203,0x174));var _0x3520=function(_0x52862f,_0x1b3198){_0x52862f=_0x52862f-0x0;var _0x34ca3f=_0x5203[_0x52862f];return _0x34ca3f;};'use strict';var _=require(_0x3520('0x0'));var util=require('util');var logger=require(_0x3520('0x1'))('api');var moment=require(_0x3520('0x2'));var BPromise=require('bluebird');var rp=require(_0x3520('0x3'));var fs=require('fs');var path=require(_0x3520('0x4'));var rimraf=require(_0x3520('0x5'));var config=require(_0x3520('0x6'));var attributes=require(_0x3520('0x7'));module[_0x3520('0x8')]=function(_0x59f40e,_0x183a46){return _0x59f40e[_0x3520('0x9')](_0x3520('0xa'),attributes,{'tableName':_0x3520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3520('0xc'),'collate':_0x3520('0xd')});}; \ No newline at end of file +var _0x2482=['request-promise','path','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x2482,0x194));var _0x2248=function(_0x41d902,_0x29d0b){_0x41d902=_0x41d902-0x0;var _0x360fb1=_0x2482[_0x41d902];return _0x360fb1;};'use strict';var _=require('lodash');var util=require(_0x2248('0x0'));var logger=require(_0x2248('0x1'))(_0x2248('0x2'));var moment=require('moment');var BPromise=require(_0x2248('0x3'));var rp=require(_0x2248('0x4'));var fs=require('fs');var path=require(_0x2248('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2248('0x6'));module[_0x2248('0x7')]=function(_0x1b10e1,_0x306af8){return _0x1b10e1[_0x2248('0x8')]('SmsApplication',attributes,{'tableName':_0x2248('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2248('0xa'),'collate':_0x2248('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8176bfc..9916d14 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 _0xbecf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x19493c,_0x25531e){var _0x4814e8=function(_0x50ef52){while(--_0x50ef52){_0x19493c['push'](_0x19493c['shift']());}};_0x4814e8(++_0x25531e);}(_0xbecf,0x15c));var _0xfbec=function(_0x369033,_0x2f8d8f){_0x369033=_0x369033-0x0;var _0x51112b=_0xbecf[_0x369033];return _0x51112b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbec('0x0'));var BPromise=require(_0xfbec('0x1'));var rs=require(_0xfbec('0x2'));var fs=require('fs');var Redis=require(_0xfbec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbec('0x4'));var logger=require(_0xfbec('0x5'))(_0xfbec('0x6'));var config=require(_0xfbec('0x7'));var jayson=require(_0xfbec('0x8'));var client=jayson['client'][_0xfbec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a717,_0x33c701,_0x410cab){return new BPromise(function(_0x43bc5b,_0x312ad1){return client[_0xfbec('0xa')](_0x34a717,_0x410cab)[_0xfbec('0xb')](function(_0x21863f){logger['info']('SmsApplication,\x20%s,\x20%s',_0x33c701,'request\x20sent');logger[_0xfbec('0xc')](_0xfbec('0xd'),_0x33c701,_0xfbec('0xe'),JSON[_0xfbec('0xf')](_0x21863f));if(_0x21863f[_0xfbec('0x10')]){if(_0x21863f['error'][_0xfbec('0x11')]===0x1f4){logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f[_0xfbec('0x10')]['message']);return _0x312ad1(_0x21863f[_0xfbec('0x10')][_0xfbec('0x13')]);}logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f['error'][_0xfbec('0x13')]);return _0x43bc5b(_0x21863f['error'][_0xfbec('0x13')]);}else{logger['info'](_0xfbec('0x12'),_0x33c701,_0xfbec('0xe'));_0x43bc5b(_0x21863f[_0xfbec('0x14')]['message']);}})[_0xfbec('0x15')](function(_0x2a3329){logger[_0xfbec('0x10')]('SmsApplication,\x20%s,\x20%s',_0x33c701,_0x2a3329);_0x312ad1(_0x2a3329);});});} \ No newline at end of file +var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3fd898,_0x49c85c){var _0x271223=function(_0x48532e){while(--_0x48532e){_0x3fd898['push'](_0x3fd898['shift']());}};_0x271223(++_0x49c85c);}(_0x2a07,0x74));var _0x72a0=function(_0x5154a6,_0x428f5a){_0x5154a6=_0x5154a6-0x0;var _0x3c8400=_0x2a07[_0x5154a6];return _0x3c8400;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('SmsApplication,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1db0a8a..e63ce56 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 _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x11781e,_0x1f3f87){var _0x1cc09e=function(_0x76216c){while(--_0x76216c){_0x11781e['push'](_0x11781e['shift']());}};_0x1cc09e(++_0x1f3f87);}(_0x13f6,0x124));var _0x613f=function(_0x8fb66b,_0x537fe1){_0x8fb66b=_0x8fb66b-0x0;var _0x2fa2c7=_0x13f6[_0x8fb66b];return _0x2fa2c7;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x291c12,_0x373276){var _0x20ac06=function(_0x5394f4){while(--_0x5394f4){_0x291c12['push'](_0x291c12['shift']());}};_0x20ac06(++_0x373276);}(_0xea28,0x13a));var _0x8ea2=function(_0x252d79,_0x1220d7){_0x252d79=_0x252d79-0x0;var _0x410277=_0xea28[_0x252d79];return _0x410277;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('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 9c65404..8ab95d6 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 _0x16cc=['out','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x5d7b48,_0x1c8eaa){var _0x31bd82=function(_0x3632d5){while(--_0x3632d5){_0x5d7b48['push'](_0x5d7b48['shift']());}};_0x31bd82(++_0x1c8eaa);}(_0x16cc,0x120));var _0xc16c=function(_0x4a0b77,_0x429302){_0x4a0b77=_0x4a0b77-0x0;var _0x34f229=_0x16cc[_0x4a0b77];return _0x34f229;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc16c('0x0'));module[_0xc16c('0x1')]={'closed':{'type':Sequelize[_0xc16c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc16c('0x3')]},'disposition':{'type':Sequelize[_0xc16c('0x4')]},'secondDisposition':{'type':Sequelize[_0xc16c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc16c('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc16c('0x4')]},'read1stAt':{'type':Sequelize[_0xc16c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc16c('0x5')]('in',_0xc16c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc16c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc16c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x308a=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x12e31e,_0x52e2bb){var _0x5bdf1a=function(_0x2bdadf){while(--_0x2bdadf){_0x12e31e['push'](_0x12e31e['shift']());}};_0x5bdf1a(++_0x52e2bb);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa308('0x0'));var moment=require('moment');module[_0xa308('0x1')]={'closed':{'type':Sequelize[_0xa308('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa308('0x3')]},'disposition':{'type':Sequelize[_0xa308('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa308('0x4')]},'phone':{'type':Sequelize[_0xa308('0x4')]},'read1stAt':{'type':Sequelize[_0xa308('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa308('0x5')]('in',_0xa308('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa308('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa308('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 58def37..90c6583 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 _0xe933=['toString','join','root','files','transcript-%d-%s.zip','push','User','Contact','firstName','Messages','direction','secret','read','SmsAccount','Account','Owner','fullname','get','Sms','N.A.','createdAt','closed','closedAt','value','renderFile','server','views','transcript-','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','index','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','sort','where','SmsInteractionId','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','SmsMessage','rows','addTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xe933,0x103));var _0x3e93=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe933[_0x2dadb9];return _0x2f0097;};'use strict';var rimraf=require(_0x3e93('0x0'));var zipdir=require(_0x3e93('0x1'));var moment=require(_0x3e93('0x2'));var BPromise=require(_0x3e93('0x3'));var util=require(_0x3e93('0x4'));var path=require('path');var ejs=require(_0x3e93('0x5'));var fs=require('fs');var _=require(_0x3e93('0x6'));var Redis=require(_0x3e93('0x7'));var interaction=require(_0x3e93('0x8'));var qs=require(_0x3e93('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x3e93('0xa'))(_0x3e93('0xb'));var config=require(_0x3e93('0xc'));var db=require(_0x3e93('0xd'))['db'];config[_0x3e93('0xe')]=_[_0x3e93('0xf')](config[_0x3e93('0xe')],{'host':_0x3e93('0x10'),'port':0x18eb});var socket=require(_0x3e93('0x11'))(new Redis(config[_0x3e93('0xe')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2e6d4b,_0x17cb2e){_0x17cb2e=_0x17cb2e||0xcc;return function(_0x27a019){if(_0x27a019){return _0x2e6d4b[_0x3e93('0x12')](_0x17cb2e);}return _0x2e6d4b[_0x3e93('0x13')](_0x17cb2e)[_0x3e93('0x14')]();};}function respondWithResult(_0x2c38fc,_0x399234){_0x399234=_0x399234||0xc8;return function(_0x125d58){if(_0x125d58){return _0x2c38fc['status'](_0x399234)[_0x3e93('0x15')](_0x125d58);}};}function respondWithFilteredResult(_0x554f78,_0x2625ff){return function(_0x15bec9){if(_0x15bec9){var _0x208729=typeof _0x2625ff[_0x3e93('0x16')]===_0x3e93('0x17')&&typeof _0x2625ff[_0x3e93('0x18')]===_0x3e93('0x17');var _0x3916d5=_0x15bec9[_0x3e93('0x19')];var _0x105fda=_0x208729?0x0:_0x2625ff[_0x3e93('0x16')];var _0x348a64=_0x208729?_0x15bec9['count']:_0x2625ff[_0x3e93('0x16')]+_0x2625ff[_0x3e93('0x18')];var _0xa104a6;if(_0x348a64>=_0x3916d5){_0x348a64=_0x3916d5;_0xa104a6=0xc8;}else{_0xa104a6=0xce;}_0x554f78[_0x3e93('0x13')](_0xa104a6);return _0x554f78[_0x3e93('0x1a')]('Content-Range',_0x105fda+'-'+_0x348a64+'/'+_0x3916d5)[_0x3e93('0x15')](_0x15bec9);}return null;};}function saveUpdates(_0x30237c){return function(_0x4ebd2e){if(_0x4ebd2e){return _0x4ebd2e[_0x3e93('0x1b')](_0x30237c)[_0x3e93('0x1c')](function(_0x47ee2a){return _0x47ee2a;});}return null;};}function removeEntity(_0xf665d){return function(_0x2abdac){if(_0x2abdac){return _0x2abdac['destroy']()[_0x3e93('0x1c')](function(){_0xf665d[_0x3e93('0x13')](0xcc)[_0x3e93('0x14')]();});}};}function handleEntityNotFound(_0x48c77c){return function(_0x32b2bb){if(!_0x32b2bb){_0x48c77c[_0x3e93('0x12')](0x194);}return _0x32b2bb;};}function handleError(_0x511899,_0x13b8c1){_0x13b8c1=_0x13b8c1||0x1f4;return function(_0x276931){logger[_0x3e93('0x1d')](_0x276931[_0x3e93('0x1e')]);if(_0x276931['name']){delete _0x276931[_0x3e93('0x1f')];}_0x511899[_0x3e93('0x13')](_0x13b8c1)['send'](_0x276931);};}exports[_0x3e93('0x20')]=function(_0x111a36,_0x295a3c){var _0x52aeb4={};var _0x150966=_['map'](db[_0x3e93('0x21')][_0x3e93('0x22')],function(_0x1a9506){return{'name':_0x1a9506[_0x3e93('0x23')],'type':_0x1a9506[_0x3e93('0x24')]['key']};});_0x52aeb4=qs[_0x3e93('0x25')](_0x150966,_0x111a36);return interaction[_0x3e93('0x26')](_0x3e93('0x27'),_0x111a36[_0x3e93('0x28')],_0x111a36['user'],_0x52aeb4,_0x150966)[_0x3e93('0x1c')](respondWithFilteredResult(_0x295a3c,_0x52aeb4))[_0x3e93('0x29')](handleError(_0x295a3c,null));};exports[_0x3e93('0x2a')]=function(_0x142b22,_0x7bed97){var _0x44aba4={'raw':![],'where':{'id':_0x142b22[_0x3e93('0x2b')]['id']}},_0x298bcb={};_0x298bcb[_0x3e93('0x2c')]=_[_0x3e93('0x2d')](db['SmsInteraction'][_0x3e93('0x22')]);_0x298bcb[_0x3e93('0x28')]=_[_0x3e93('0x2d')](_0x142b22['query']);_0x298bcb[_0x3e93('0x2e')]=_[_0x3e93('0x2f')](_0x298bcb[_0x3e93('0x2c')],_0x298bcb[_0x3e93('0x28')]);_0x44aba4['attributes']=_[_0x3e93('0x2f')](_0x298bcb[_0x3e93('0x2c')],qs[_0x3e93('0x30')](_0x142b22[_0x3e93('0x28')][_0x3e93('0x30')]));_0x44aba4[_0x3e93('0x31')]=_0x44aba4[_0x3e93('0x31')][_0x3e93('0x32')]?_0x44aba4[_0x3e93('0x31')]:_0x298bcb[_0x3e93('0x2c')];if(_0x142b22[_0x3e93('0x28')][_0x3e93('0x33')]){_0x44aba4[_0x3e93('0x34')]=[{'all':!![]}];}_0x44aba4=_['merge']({},_0x44aba4,_0x142b22['options']);return db[_0x3e93('0x21')][_0x3e93('0x35')](_0x44aba4)['then'](handleEntityNotFound(_0x7bed97,null))[_0x3e93('0x1c')](respondWithResult(_0x7bed97,null))['catch'](handleError(_0x7bed97,null));};exports['create']=function(_0x2ade06,_0x609806){return db[_0x3e93('0x21')][_0x3e93('0x36')](_0x2ade06['body'],{})[_0x3e93('0x1c')](respondWithResult(_0x609806,0xc9))[_0x3e93('0x29')](handleError(_0x609806,null));};exports[_0x3e93('0x1b')]=function(_0x225451,_0x125c25){if(_0x225451[_0x3e93('0x37')]['id']){delete _0x225451[_0x3e93('0x37')]['id'];}return db['SmsInteraction'][_0x3e93('0x35')]({'where':{'id':_0x225451[_0x3e93('0x2b')]['id']}})[_0x3e93('0x1c')](handleEntityNotFound(_0x125c25,null))[_0x3e93('0x1c')](saveUpdates(_0x225451[_0x3e93('0x37')],null))[_0x3e93('0x1c')](respondWithResult(_0x125c25,null))[_0x3e93('0x29')](handleError(_0x125c25,null));};exports[_0x3e93('0x38')]=function(_0x15f2c6,_0x10ce35){return db[_0x3e93('0x21')][_0x3e93('0x35')]({'where':{'id':_0x15f2c6[_0x3e93('0x2b')]['id']}})[_0x3e93('0x1c')](handleEntityNotFound(_0x10ce35,null))[_0x3e93('0x1c')](removeEntity(_0x10ce35,null))[_0x3e93('0x29')](handleError(_0x10ce35,null));};exports['describe']=function(_0x1f9976,_0xb499a8){return db['SmsInteraction'][_0x3e93('0x39')]()[_0x3e93('0x1c')](respondWithResult(_0xb499a8,null))[_0x3e93('0x29')](handleError(_0xb499a8,null));};exports[_0x3e93('0x3a')]=function(_0x529ff8,_0x4d8e2c){return db['SmsMessage']['find']({'where':{'id':_0x529ff8['params']['id']}})[_0x3e93('0x1c')](handleEntityNotFound(_0x4d8e2c,null))[_0x3e93('0x1c')](function(_0x3db7f4){if(_0x3db7f4){return _0x3db7f4[_0x3e93('0x3a')](_0x529ff8[_0x3e93('0x37')][_0x3e93('0x3b')],_[_0x3e93('0x3c')](_0x529ff8[_0x3e93('0x37')],[_0x3e93('0x3b'),'id'])||{});}})[_0x3e93('0x1c')](respondWithResult(_0x4d8e2c,null))[_0x3e93('0x29')](handleError(_0x4d8e2c,null));};exports[_0x3e93('0x3d')]=function(_0x4f307a,_0x354925){var _0x3f85d7={'raw':![],'where':{}};var _0x45b0a5={};var _0x5d6f0c={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x3e93('0x3e')]({'where':{'id':_0x4f307a['params']['id']}})['then'](handleEntityNotFound(_0x354925,null))[_0x3e93('0x1c')](function(_0x174ad2){if(_0x174ad2){_0x45b0a5[_0x3e93('0x2c')]=_['keys'](db['SmsMessage'][_0x3e93('0x22')]);_0x45b0a5[_0x3e93('0x28')]=_[_0x3e93('0x2d')](_0x4f307a[_0x3e93('0x28')]);_0x45b0a5[_0x3e93('0x2e')]=_['intersection'](_0x45b0a5[_0x3e93('0x2c')],_0x45b0a5[_0x3e93('0x28')]);_0x3f85d7[_0x3e93('0x31')]=_['intersection'](_0x45b0a5[_0x3e93('0x2c')],qs[_0x3e93('0x30')](_0x4f307a[_0x3e93('0x28')][_0x3e93('0x30')]));_0x3f85d7[_0x3e93('0x31')]=_0x3f85d7[_0x3e93('0x31')]['length']?_0x3f85d7[_0x3e93('0x31')]:_0x45b0a5[_0x3e93('0x2c')];if(!_0x4f307a[_0x3e93('0x28')]['hasOwnProperty']('nolimit')){_0x3f85d7[_0x3e93('0x18')]=qs[_0x3e93('0x18')](_0x4f307a[_0x3e93('0x28')]['limit']);_0x3f85d7[_0x3e93('0x16')]=qs[_0x3e93('0x16')](_0x4f307a[_0x3e93('0x28')][_0x3e93('0x16')]);}_0x3f85d7['order']=qs[_0x3e93('0x3f')](_0x4f307a[_0x3e93('0x28')][_0x3e93('0x3f')]);_0x3f85d7[_0x3e93('0x40')]=qs[_0x3e93('0x2e')](_['pick'](_0x4f307a['query'],_0x45b0a5['filters']));_0x3f85d7['where'][_0x3e93('0x41')]=_0x174ad2['id'];if(_0x4f307a[_0x3e93('0x28')][_0x3e93('0x42')]){_0x3f85d7['where']=_['merge'](_0x3f85d7[_0x3e93('0x40')],{'$or':_[_0x3e93('0x43')](_0x3f85d7['attributes'],function(_0x4fd811){var _0x5b4d31={};_0x5b4d31[_0x4fd811]={'$like':'%'+_0x4f307a['query'][_0x3e93('0x42')]+'%'};return _0x5b4d31;})});}if(_0x4f307a[_0x3e93('0x28')][_0x3e93('0x44')]){var _0x53f643=_0x4f307a[_0x3e93('0x28')]['$gte']['split'](',');var _0x5e9820={};_0x5e9820[_0x53f643[0x0]]={'$gte':moment(_0x53f643[0x1])[_0x3e93('0x45')](_0x3e93('0x46'))};_0x3f85d7[_0x3e93('0x40')]=_['merge'](_0x3f85d7[_0x3e93('0x40')],_0x5e9820);}_0x3f85d7=_[_0x3e93('0x47')]({},_0x3f85d7,_0x4f307a['options']);return db[_0x3e93('0x48')][_0x3e93('0x19')]({'where':_0x3f85d7[_0x3e93('0x40')]})[_0x3e93('0x1c')](function(_0xfb7bb2){_0x5d6f0c['count']=_0xfb7bb2;if(_0x4f307a[_0x3e93('0x28')][_0x3e93('0x33')]){_0x3f85d7[_0x3e93('0x34')]=[{'all':!![]}];}return db[_0x3e93('0x48')][_0x3e93('0x26')](_0x3f85d7);})[_0x3e93('0x1c')](function(_0x3e5078){_0x5d6f0c[_0x3e93('0x49')]=_0x3e5078;return _0x5d6f0c;});}})[_0x3e93('0x1c')](respondWithFilteredResult(_0x354925,_0x3f85d7))['catch'](handleError(_0x354925,null));};exports[_0x3e93('0x4a')]=function(_0x29d7b5,_0x49440e){return db[_0x3e93('0x21')][_0x3e93('0x35')]({'where':{'id':_0x29d7b5[_0x3e93('0x2b')]['id']}})[_0x3e93('0x1c')](handleEntityNotFound(_0x49440e,null))[_0x3e93('0x1c')](function(_0x36a884){if(_0x36a884){return _0x36a884['setTags'](_0x29d7b5[_0x3e93('0x37')][_0x3e93('0x3b')],_[_0x3e93('0x3c')](_0x29d7b5['body'],[_0x3e93('0x3b'),'id'])||{})[_0x3e93('0x4b')](function(){return db[_0x3e93('0x4c')][_0x3e93('0x26')]({'attributes':['id','name',_0x3e93('0x4d')],'where':{'id':_0x29d7b5[_0x3e93('0x37')]['ids']}});})['then'](function(_0x5c3a07){socket[_0x3e93('0x4e')](_0x3e93('0x4f'),{'id':Number(_0x29d7b5[_0x3e93('0x2b')]['id']),'tags':_0x5c3a07||[]});return{'id':Number(_0x29d7b5['params']['id']),'tags':_0x5c3a07||[]};});}})['then'](respondWithResult(_0x49440e,null))[_0x3e93('0x29')](handleError(_0x49440e,null));};exports['removeTags']=function(_0x312c43,_0xde458){return db[_0x3e93('0x21')][_0x3e93('0x35')]({'where':{'id':_0x312c43[_0x3e93('0x2b')]['id']}})[_0x3e93('0x1c')](handleEntityNotFound(_0xde458,null))[_0x3e93('0x1c')](function(_0x2b4d77){if(_0x2b4d77){return _0x2b4d77[_0x3e93('0x50')](_0x312c43[_0x3e93('0x28')][_0x3e93('0x3b')]);}})['then'](respondWithStatusCode(_0xde458,null))['catch'](handleError(_0xde458,null));};exports[_0x3e93('0x51')]=function(_0x241674,_0x362e07){var _0x156635=moment()[_0x3e93('0x52')]()[_0x3e93('0x53')]();var _0x57a4fc=path[_0x3e93('0x54')](config[_0x3e93('0x55')],'server',_0x3e93('0x56'),'tmp');var _0x2eabbd=path[_0x3e93('0x54')](_0x57a4fc,_0x156635);var _0x29bb41=util[_0x3e93('0x45')](_0x3e93('0x57'),_0x241674[_0x3e93('0x2b')]['id'],_0x156635);var _0x4894ae=path['join'](_0x57a4fc,_0x29bb41);var _0x15287b=[];_0x15287b[_0x3e93('0x58')]({'model':db[_0x3e93('0x59')],'as':_0x3e93('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x15287b[_0x3e93('0x58')]({'model':db['CmContact'],'as':_0x3e93('0x5a'),'attributes':['id',_0x3e93('0x5b'),'lastName'],'raw':!![]});var _0x245cea=[{'model':db['SmsMessage'],'as':_0x3e93('0x5c'),'attributes':['id',_0x3e93('0x37'),'createdAt',_0x3e93('0x5d'),_0x3e93('0x5e'),_0x3e93('0x5f')],'include':_0x15287b}];_0x245cea['push']({'model':db[_0x3e93('0x60')],'as':_0x3e93('0x61'),'attributes':['id',_0x3e93('0x1f')]});_0x245cea[_0x3e93('0x58')]({'model':db['User'],'as':_0x3e93('0x62'),'attributes':['id',_0x3e93('0x63')]});return db['SmsInteraction'][_0x3e93('0x35')]({'where':{'id':_0x241674['params']['id']},'include':_0x245cea})[_0x3e93('0x1c')](handleEntityNotFound(_0x362e07,null))[_0x3e93('0x1c')](function(_0x4b86a2){if(_0x4b86a2){var _0x1257bd=_0x4b86a2[_0x3e93('0x64')]({'plain':!![]});fs['mkdirSync'](_0x2eabbd);var _0x5806da={'channel':_0x3e93('0x65'),'account':_0x1257bd['Account']['name'],'agent':_0x1257bd[_0x3e93('0x62')]?_0x1257bd[_0x3e93('0x62')][_0x3e93('0x63')]:_0x3e93('0x66'),'createdAt':moment(_0x1257bd[_0x3e93('0x67')])[_0x3e93('0x45')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1257bd[_0x3e93('0x68')]?moment(_0x1257bd[_0x3e93('0x69')])[_0x3e93('0x45')](_0x3e93('0x46'))['toString']():'','disposition':_0x1257bd['disposition'],'messages':_(_0x1257bd[_0x3e93('0x5c')])[_0x3e93('0x42')]({'secret':![]})['map'](function(_0xe04a5f){return{'date':moment(_0xe04a5f['createdAt'])[_0x3e93('0x45')](_0x3e93('0x46'))[_0x3e93('0x53')](),'sender':_0xe04a5f['direction']==='out'?_0xe04a5f[_0x3e93('0x59')]?_0xe04a5f['User'][_0x3e93('0x63')]:'System':_0xe04a5f[_0x3e93('0x5a')]['firstName']+(_0xe04a5f[_0x3e93('0x5a')]['lastName']?'\x20'+_0xe04a5f[_0x3e93('0x5a')]['lastName']:''),'body':_0xe04a5f[_0x3e93('0x37')],'direction':_0xe04a5f[_0x3e93('0x5d')]==='out'?'A':'C','secret':_0xe04a5f['secret'],'read':_0xe04a5f['read']};})[_0x3e93('0x6a')]()};return ejs[_0x3e93('0x6b')](path[_0x3e93('0x54')](config[_0x3e93('0x55')],_0x3e93('0x6c'),_0x3e93('0x6d'),'downloadInteraction.ejs'),{'interaction':_0x5806da})[_0x3e93('0x1c')](function(_0x5d1ce0){var _0x4a9746=path['join'](_0x2eabbd,_0x3e93('0x6e')+_0x1257bd['id']+'-'+_0x156635+'.pdf');var _0x4e99ee={'path':_0x4a9746,'channel':'Sms','interactionId':_0x1257bd['id']};return pdf[_0x3e93('0x6f')](_0x5d1ce0,_0x4e99ee);})[_0x3e93('0x1c')](function(){return new BPromise(function(_0x487f61,_0x2ecb65){zipdir(_0x2eabbd,{'saveTo':_0x4894ae},function(_0x2a16d4,_0x5301db){if(_0x2a16d4)return _0x2ecb65(_0x2a16d4);return _0x487f61(_0x5301db);});})[_0x3e93('0x1c')](function(){return new BPromise(function(_0x1d1728,_0x23d377){rimraf(_0x2eabbd,function(_0xfb5c80){if(_0xfb5c80)_0x23d377(_0xfb5c80);return _0x1d1728();});});})[_0x3e93('0x1c')](function(){return _0x362e07[_0x3e93('0x51')](_0x4894ae,_0x29bb41,function(_0x287909){if(_0x287909){console[_0x3e93('0x70')](_0x3e93('0x71'),_0x287909);}else{fs['unlinkSync'](_0x4894ae);}});});});}else{return _0x362e07['sendStatus'](0xc8);}})[_0x3e93('0x29')](handleError(_0x362e07,null));}; \ No newline at end of file +var _0xea64=['defaults','redis','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','findAll','sms','query','user','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','find','catch','create','body','describe','addMessage','SmsMessage','ids','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','omit','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','transcript-%d-%s.zip','User','push','Contact','firstName','Messages','createdAt','direction','secret','read','Account','Owner','mkdirSync','Sms','fullname','N.A.','closed','toString','disposition','System','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','sendStatus','rimraf','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0xea64,0xdf));var _0x4ea6=function(_0x231829,_0x376ec3){_0x231829=_0x231829-0x0;var _0x5b6c7d=_0xea64[_0x231829];return _0x5b6c7d;};'use strict';var rimraf=require(_0x4ea6('0x0'));var zipdir=require('zip-dir');var moment=require(_0x4ea6('0x1'));var BPromise=require(_0x4ea6('0x2'));var util=require(_0x4ea6('0x3'));var path=require('path');var ejs=require(_0x4ea6('0x4'));var fs=require('fs');var _=require(_0x4ea6('0x5'));var Redis=require(_0x4ea6('0x6'));var interaction=require(_0x4ea6('0x7'));var qs=require(_0x4ea6('0x8'));var pdf=require(_0x4ea6('0x9'));var logger=require('../../config/logger')(_0x4ea6('0xa'));var config=require(_0x4ea6('0xb'));var db=require(_0x4ea6('0xc'))['db'];config['redis']=_[_0x4ea6('0xd')](config[_0x4ea6('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ea6('0xf'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x4ea6('0x10')](socket);function respondWithStatusCode(_0x3e1f01,_0x597865){_0x597865=_0x597865||0xcc;return function(_0x310de5){if(_0x310de5){return _0x3e1f01['sendStatus'](_0x597865);}return _0x3e1f01[_0x4ea6('0x11')](_0x597865)[_0x4ea6('0x12')]();};}function respondWithResult(_0x400a1e,_0x1b62be){_0x1b62be=_0x1b62be||0xc8;return function(_0x58764d){if(_0x58764d){return _0x400a1e['status'](_0x1b62be)[_0x4ea6('0x13')](_0x58764d);}};}function respondWithFilteredResult(_0x7fab00,_0x56dc17){return function(_0x138215){if(_0x138215){var _0x3ebc24=typeof _0x56dc17['offset']===_0x4ea6('0x14')&&typeof _0x56dc17[_0x4ea6('0x15')]==='undefined';var _0x1064fe=_0x138215['count'];var _0x4414b0=_0x3ebc24?0x0:_0x56dc17['offset'];var _0x37a883=_0x3ebc24?_0x138215[_0x4ea6('0x16')]:_0x56dc17[_0x4ea6('0x17')]+_0x56dc17['limit'];var _0x175cf3;if(_0x37a883>=_0x1064fe){_0x37a883=_0x1064fe;_0x175cf3=0xc8;}else{_0x175cf3=0xce;}_0x7fab00[_0x4ea6('0x11')](_0x175cf3);return _0x7fab00[_0x4ea6('0x18')](_0x4ea6('0x19'),_0x4414b0+'-'+_0x37a883+'/'+_0x1064fe)[_0x4ea6('0x13')](_0x138215);}return null;};}function saveUpdates(_0x2d0ab5){return function(_0x5c1017){if(_0x5c1017){return _0x5c1017[_0x4ea6('0x1a')](_0x2d0ab5)[_0x4ea6('0x1b')](function(_0x155ee6){return _0x155ee6;});}return null;};}function removeEntity(_0x38edf3){return function(_0xb58dc5){if(_0xb58dc5){return _0xb58dc5[_0x4ea6('0x1c')]()[_0x4ea6('0x1b')](function(){_0x38edf3[_0x4ea6('0x11')](0xcc)[_0x4ea6('0x12')]();});}};}function handleEntityNotFound(_0x1423ef){return function(_0x355014){if(!_0x355014){_0x1423ef['sendStatus'](0x194);}return _0x355014;};}function handleError(_0x181129,_0x2d9285){_0x2d9285=_0x2d9285||0x1f4;return function(_0x3a3264){logger['error'](_0x3a3264[_0x4ea6('0x1d')]);if(_0x3a3264[_0x4ea6('0x1e')]){delete _0x3a3264[_0x4ea6('0x1e')];}_0x181129[_0x4ea6('0x11')](_0x2d9285)[_0x4ea6('0x1f')](_0x3a3264);};}exports[_0x4ea6('0x20')]=function(_0x6ed3aa,_0xc9970e){var _0x46a4d1={};var _0x34b620=_[_0x4ea6('0x21')](db[_0x4ea6('0x22')][_0x4ea6('0x23')],function(_0x572be2){return{'name':_0x572be2[_0x4ea6('0x24')],'type':_0x572be2['type']['key']};});_0x46a4d1=qs['getOptions'](_0x34b620,_0x6ed3aa);return interaction[_0x4ea6('0x25')](_0x4ea6('0x26'),_0x6ed3aa[_0x4ea6('0x27')],_0x6ed3aa[_0x4ea6('0x28')],_0x46a4d1,_0x34b620)['then'](respondWithFilteredResult(_0xc9970e,_0x46a4d1))['catch'](handleError(_0xc9970e,null));};exports[_0x4ea6('0x29')]=function(_0x296a06,_0x473582){var _0x39405d={'raw':![],'where':{'id':_0x296a06[_0x4ea6('0x2a')]['id']}},_0x193dec={};_0x193dec[_0x4ea6('0x2b')]=_[_0x4ea6('0x2c')](db[_0x4ea6('0x22')][_0x4ea6('0x23')]);_0x193dec['query']=_[_0x4ea6('0x2c')](_0x296a06[_0x4ea6('0x27')]);_0x193dec[_0x4ea6('0x2d')]=_[_0x4ea6('0x2e')](_0x193dec[_0x4ea6('0x2b')],_0x193dec[_0x4ea6('0x27')]);_0x39405d[_0x4ea6('0x2f')]=_['intersection'](_0x193dec[_0x4ea6('0x2b')],qs['fields'](_0x296a06['query'][_0x4ea6('0x30')]));_0x39405d[_0x4ea6('0x2f')]=_0x39405d['attributes']['length']?_0x39405d['attributes']:_0x193dec[_0x4ea6('0x2b')];if(_0x296a06['query'][_0x4ea6('0x31')]){_0x39405d[_0x4ea6('0x32')]=[{'all':!![]}];}_0x39405d=_[_0x4ea6('0x33')]({},_0x39405d,_0x296a06['options']);return db[_0x4ea6('0x22')][_0x4ea6('0x34')](_0x39405d)[_0x4ea6('0x1b')](handleEntityNotFound(_0x473582,null))[_0x4ea6('0x1b')](respondWithResult(_0x473582,null))[_0x4ea6('0x35')](handleError(_0x473582,null));};exports[_0x4ea6('0x36')]=function(_0x4c9db8,_0x16f406){return db[_0x4ea6('0x22')][_0x4ea6('0x36')](_0x4c9db8[_0x4ea6('0x37')],{})[_0x4ea6('0x1b')](respondWithResult(_0x16f406,0xc9))[_0x4ea6('0x35')](handleError(_0x16f406,null));};exports[_0x4ea6('0x1a')]=function(_0x890a5a,_0x12c9f4){if(_0x890a5a['body']['id']){delete _0x890a5a[_0x4ea6('0x37')]['id'];}return db[_0x4ea6('0x22')]['find']({'where':{'id':_0x890a5a[_0x4ea6('0x2a')]['id']}})[_0x4ea6('0x1b')](handleEntityNotFound(_0x12c9f4,null))[_0x4ea6('0x1b')](saveUpdates(_0x890a5a[_0x4ea6('0x37')],null))[_0x4ea6('0x1b')](respondWithResult(_0x12c9f4,null))[_0x4ea6('0x35')](handleError(_0x12c9f4,null));};exports[_0x4ea6('0x1c')]=function(_0x499774,_0x25a841){return db[_0x4ea6('0x22')][_0x4ea6('0x34')]({'where':{'id':_0x499774[_0x4ea6('0x2a')]['id']}})[_0x4ea6('0x1b')](handleEntityNotFound(_0x25a841,null))[_0x4ea6('0x1b')](removeEntity(_0x25a841,null))[_0x4ea6('0x35')](handleError(_0x25a841,null));};exports[_0x4ea6('0x38')]=function(_0x2335bf,_0x748eba){return db[_0x4ea6('0x22')][_0x4ea6('0x38')]()[_0x4ea6('0x1b')](respondWithResult(_0x748eba,null))[_0x4ea6('0x35')](handleError(_0x748eba,null));};exports[_0x4ea6('0x39')]=function(_0x22e792,_0x1802b5){return db[_0x4ea6('0x3a')][_0x4ea6('0x34')]({'where':{'id':_0x22e792['params']['id']}})[_0x4ea6('0x1b')](handleEntityNotFound(_0x1802b5,null))[_0x4ea6('0x1b')](function(_0x2b5e9b){if(_0x2b5e9b){return _0x2b5e9b[_0x4ea6('0x39')](_0x22e792[_0x4ea6('0x37')][_0x4ea6('0x3b')],_['omit'](_0x22e792['body'],[_0x4ea6('0x3b'),'id'])||{});}})[_0x4ea6('0x1b')](respondWithResult(_0x1802b5,null))[_0x4ea6('0x35')](handleError(_0x1802b5,null));};exports['getMessages']=function(_0x38c13a,_0x5e2451){var _0x5cb21f={'raw':![],'where':{}};var _0x4c454e={};var _0x50fd23={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x4ea6('0x3c')]({'where':{'id':_0x38c13a['params']['id']}})[_0x4ea6('0x1b')](handleEntityNotFound(_0x5e2451,null))[_0x4ea6('0x1b')](function(_0x4ecc8e){if(_0x4ecc8e){_0x4c454e[_0x4ea6('0x2b')]=_['keys'](db[_0x4ea6('0x3a')]['rawAttributes']);_0x4c454e[_0x4ea6('0x27')]=_[_0x4ea6('0x2c')](_0x38c13a[_0x4ea6('0x27')]);_0x4c454e[_0x4ea6('0x2d')]=_[_0x4ea6('0x2e')](_0x4c454e[_0x4ea6('0x2b')],_0x4c454e['query']);_0x5cb21f['attributes']=_['intersection'](_0x4c454e[_0x4ea6('0x2b')],qs[_0x4ea6('0x30')](_0x38c13a[_0x4ea6('0x27')][_0x4ea6('0x30')]));_0x5cb21f['attributes']=_0x5cb21f[_0x4ea6('0x2f')][_0x4ea6('0x3d')]?_0x5cb21f[_0x4ea6('0x2f')]:_0x4c454e['model'];if(!_0x38c13a[_0x4ea6('0x27')][_0x4ea6('0x3e')](_0x4ea6('0x3f'))){_0x5cb21f[_0x4ea6('0x15')]=qs['limit'](_0x38c13a[_0x4ea6('0x27')]['limit']);_0x5cb21f[_0x4ea6('0x17')]=qs[_0x4ea6('0x17')](_0x38c13a[_0x4ea6('0x27')][_0x4ea6('0x17')]);}_0x5cb21f[_0x4ea6('0x40')]=qs['sort'](_0x38c13a[_0x4ea6('0x27')][_0x4ea6('0x41')]);_0x5cb21f[_0x4ea6('0x42')]=qs[_0x4ea6('0x2d')](_[_0x4ea6('0x43')](_0x38c13a[_0x4ea6('0x27')],_0x4c454e[_0x4ea6('0x2d')]));_0x5cb21f[_0x4ea6('0x42')]['SmsInteractionId']=_0x4ecc8e['id'];if(_0x38c13a['query'][_0x4ea6('0x44')]){_0x5cb21f[_0x4ea6('0x42')]=_['merge'](_0x5cb21f[_0x4ea6('0x42')],{'$or':_[_0x4ea6('0x21')](_0x5cb21f[_0x4ea6('0x2f')],function(_0x35e24e){var _0xe80679={};_0xe80679[_0x35e24e]={'$like':'%'+_0x38c13a[_0x4ea6('0x27')][_0x4ea6('0x44')]+'%'};return _0xe80679;})});}if(_0x38c13a[_0x4ea6('0x27')][_0x4ea6('0x45')]){var _0x52f544=_0x38c13a['query']['$gte'][_0x4ea6('0x46')](',');var _0x2674ef={};_0x2674ef[_0x52f544[0x0]]={'$gte':moment(_0x52f544[0x1])[_0x4ea6('0x47')](_0x4ea6('0x48'))};_0x5cb21f[_0x4ea6('0x42')]=_[_0x4ea6('0x33')](_0x5cb21f[_0x4ea6('0x42')],_0x2674ef);}_0x5cb21f=_[_0x4ea6('0x33')]({},_0x5cb21f,_0x38c13a[_0x4ea6('0x49')]);return db[_0x4ea6('0x3a')][_0x4ea6('0x16')]({'where':_0x5cb21f[_0x4ea6('0x42')]})[_0x4ea6('0x1b')](function(_0x304bd5){_0x50fd23['count']=_0x304bd5;if(_0x38c13a[_0x4ea6('0x27')][_0x4ea6('0x31')]){_0x5cb21f[_0x4ea6('0x32')]=[{'all':!![]}];}return db[_0x4ea6('0x3a')][_0x4ea6('0x25')](_0x5cb21f);})[_0x4ea6('0x1b')](function(_0xbca8f2){_0x50fd23[_0x4ea6('0x4a')]=_0xbca8f2;return _0x50fd23;});}})[_0x4ea6('0x1b')](respondWithFilteredResult(_0x5e2451,_0x5cb21f))['catch'](handleError(_0x5e2451,null));};exports[_0x4ea6('0x4b')]=function(_0x782e54,_0x323030){return db[_0x4ea6('0x22')][_0x4ea6('0x34')]({'where':{'id':_0x782e54[_0x4ea6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x323030,null))[_0x4ea6('0x1b')](function(_0x2595bd){if(_0x2595bd){return _0x2595bd['setTags'](_0x782e54[_0x4ea6('0x37')][_0x4ea6('0x3b')],_[_0x4ea6('0x4c')](_0x782e54[_0x4ea6('0x37')],['ids','id'])||{})['spread'](function(){return db[_0x4ea6('0x4d')][_0x4ea6('0x25')]({'attributes':['id',_0x4ea6('0x1e'),_0x4ea6('0x4e')],'where':{'id':_0x782e54[_0x4ea6('0x37')][_0x4ea6('0x3b')]}});})[_0x4ea6('0x1b')](function(_0x57f0bb){socket[_0x4ea6('0x4f')](_0x4ea6('0x50'),{'id':Number(_0x782e54[_0x4ea6('0x2a')]['id']),'tags':_0x57f0bb||[]});return{'id':Number(_0x782e54[_0x4ea6('0x2a')]['id']),'tags':_0x57f0bb||[]};});}})[_0x4ea6('0x1b')](respondWithResult(_0x323030,null))[_0x4ea6('0x35')](handleError(_0x323030,null));};exports[_0x4ea6('0x51')]=function(_0x40074a,_0x54367e){return db[_0x4ea6('0x22')][_0x4ea6('0x34')]({'where':{'id':_0x40074a['params']['id']}})['then'](handleEntityNotFound(_0x54367e,null))[_0x4ea6('0x1b')](function(_0x5c4d86){if(_0x5c4d86){return _0x5c4d86[_0x4ea6('0x51')](_0x40074a[_0x4ea6('0x27')][_0x4ea6('0x3b')]);}})['then'](respondWithStatusCode(_0x54367e,null))['catch'](handleError(_0x54367e,null));};exports[_0x4ea6('0x52')]=function(_0x78c7e9,_0x37732e){var _0x2ff856=moment()[_0x4ea6('0x53')]()['toString']();var _0x35bb94=path[_0x4ea6('0x54')](config[_0x4ea6('0x55')],'server',_0x4ea6('0x56'),_0x4ea6('0x57'));var _0x182483=path[_0x4ea6('0x54')](_0x35bb94,_0x2ff856);var _0x17c790=util[_0x4ea6('0x47')](_0x4ea6('0x58'),_0x78c7e9[_0x4ea6('0x2a')]['id'],_0x2ff856);var _0x2c4a74=path['join'](_0x35bb94,_0x17c790);var _0x162921=[];_0x162921['push']({'model':db[_0x4ea6('0x59')],'as':_0x4ea6('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x162921[_0x4ea6('0x5a')]({'model':db['CmContact'],'as':_0x4ea6('0x5b'),'attributes':['id',_0x4ea6('0x5c'),'lastName'],'raw':!![]});var _0x39b365=[{'model':db['SmsMessage'],'as':_0x4ea6('0x5d'),'attributes':['id',_0x4ea6('0x37'),_0x4ea6('0x5e'),_0x4ea6('0x5f'),_0x4ea6('0x60'),_0x4ea6('0x61')],'include':_0x162921}];_0x39b365[_0x4ea6('0x5a')]({'model':db['SmsAccount'],'as':_0x4ea6('0x62'),'attributes':['id',_0x4ea6('0x1e')]});_0x39b365[_0x4ea6('0x5a')]({'model':db[_0x4ea6('0x59')],'as':_0x4ea6('0x63'),'attributes':['id','fullname']});return db[_0x4ea6('0x22')][_0x4ea6('0x34')]({'where':{'id':_0x78c7e9[_0x4ea6('0x2a')]['id']},'include':_0x39b365})[_0x4ea6('0x1b')](handleEntityNotFound(_0x37732e,null))[_0x4ea6('0x1b')](function(_0x32bcc6){if(_0x32bcc6){var _0x1acee9=_0x32bcc6['get']({'plain':!![]});fs[_0x4ea6('0x64')](_0x182483);var _0x48b9e9={'channel':_0x4ea6('0x65'),'account':_0x1acee9[_0x4ea6('0x62')][_0x4ea6('0x1e')],'agent':_0x1acee9[_0x4ea6('0x63')]?_0x1acee9['Owner'][_0x4ea6('0x66')]:_0x4ea6('0x67'),'createdAt':moment(_0x1acee9[_0x4ea6('0x5e')])[_0x4ea6('0x47')](_0x4ea6('0x48'))['toString'](),'closedAt':_0x1acee9[_0x4ea6('0x68')]?moment(_0x1acee9['closedAt'])[_0x4ea6('0x47')](_0x4ea6('0x48'))[_0x4ea6('0x69')]():'','disposition':_0x1acee9[_0x4ea6('0x6a')],'messages':_(_0x1acee9[_0x4ea6('0x5d')])[_0x4ea6('0x44')]({'secret':![]})[_0x4ea6('0x21')](function(_0x330d04){return{'date':moment(_0x330d04[_0x4ea6('0x5e')])['format'](_0x4ea6('0x48'))[_0x4ea6('0x69')](),'sender':_0x330d04['direction']==='out'?_0x330d04[_0x4ea6('0x59')]?_0x330d04[_0x4ea6('0x59')][_0x4ea6('0x66')]:_0x4ea6('0x6b'):_0x330d04[_0x4ea6('0x5b')][_0x4ea6('0x5c')]+(_0x330d04[_0x4ea6('0x5b')]['lastName']?'\x20'+_0x330d04[_0x4ea6('0x5b')][_0x4ea6('0x6c')]:''),'body':_0x330d04['body'],'direction':_0x330d04[_0x4ea6('0x5f')]==='out'?'A':'C','secret':_0x330d04['secret'],'read':_0x330d04['read']};})[_0x4ea6('0x6d')]()};return ejs[_0x4ea6('0x6e')](path[_0x4ea6('0x54')](config[_0x4ea6('0x55')],'server',_0x4ea6('0x6f'),_0x4ea6('0x70')),{'interaction':_0x48b9e9})[_0x4ea6('0x1b')](function(_0x3bbeb7){var _0x4d5d1d=path[_0x4ea6('0x54')](_0x182483,_0x4ea6('0x71')+_0x1acee9['id']+'-'+_0x2ff856+'.pdf');var _0x1d5332={'path':_0x4d5d1d,'channel':_0x4ea6('0x65'),'interactionId':_0x1acee9['id']};return pdf[_0x4ea6('0x72')](_0x3bbeb7,_0x1d5332);})['then'](function(){return new BPromise(function(_0x3f5f49,_0x50bad4){zipdir(_0x182483,{'saveTo':_0x2c4a74},function(_0x178d9f,_0x43ff52){if(_0x178d9f)return _0x50bad4(_0x178d9f);return _0x3f5f49(_0x43ff52);});})[_0x4ea6('0x1b')](function(){return new BPromise(function(_0x361e64,_0x120ab1){rimraf(_0x182483,function(_0x57c8e2){if(_0x57c8e2)_0x120ab1(_0x57c8e2);return _0x361e64();});});})['then'](function(){return _0x37732e[_0x4ea6('0x52')](_0x2c4a74,_0x17c790,function(_0xed1235){if(_0xed1235){console[_0x4ea6('0x73')](_0x4ea6('0x74'),_0xed1235);}else{fs['unlinkSync'](_0x2c4a74);}});});});}else{return _0x37732e[_0x4ea6('0x75')](0xc8);}})[_0x4ea6('0x35')](handleError(_0x37732e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4f9e65d..33b362e 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 _0x66fa=['remove','getUsers','then','setDataValue','map','findAll','emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x6fa8e3,_0x358491){var _0x37b268=function(_0x15747b){while(--_0x15747b){_0x6fa8e3['push'](_0x6fa8e3['shift']());}};_0x37b268(++_0x358491);}(_0x66fa,0x117));var _0xa66f=function(_0x419ecf,_0xa1574d){_0x419ecf=_0x419ecf-0x0;var _0x1ed0b3=_0x66fa[_0x419ecf];return _0x1ed0b3;};'use strict';var EventEmitter=require(_0xa66f('0x0'));var SmsInteraction=require(_0xa66f('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa66f('0x1'))['db'][_0xa66f('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa66f('0x3')](0x0);var events={'afterCreate':_0xa66f('0x4'),'afterUpdate':_0xa66f('0x5'),'afterDestroy':_0xa66f('0x6')};function emitEvent(_0x3f4904){return function(_0x5ebea5,_0x4fd9d0,_0x2239d3){_0x5ebea5[_0xa66f('0x7')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x8')](function(_0x1d02fc){_0x5ebea5[_0xa66f('0x9')]('Users',_0x1d02fc[_0xa66f('0xa')](function(_0x4f6717){return{'id':_0x4f6717['id']};}));return SmsMessage[_0xa66f('0xb')]({'where':{'SmsInteractionId':_0x5ebea5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x101e10){_0x5ebea5['setDataValue']('unreadMessages',_0x101e10['length']);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904+':'+_0x5ebea5['id'],_0x5ebea5);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904,_0x5ebea5);_0x2239d3(null);})['catch'](_0x2239d3(null));};}for(var e in events){if(events[_0xa66f('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xa66f('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xfef3=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x16dbb9,_0x32e899){var _0x4ae6c0=function(_0x3b02bc){while(--_0x3b02bc){_0x16dbb9['push'](_0x16dbb9['shift']());}};_0x4ae6c0(++_0x32e899);}(_0xfef3,0x118));var _0x3fef=function(_0x2a2b09,_0x3c7893){_0x2a2b09=_0x2a2b09-0x0;var _0x2343f9=_0xfef3[_0x2a2b09];return _0x2343f9;};'use strict';var EventEmitter=require(_0x3fef('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x3fef('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x3fef('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3fef('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fef('0x4'),'afterDestroy':_0x3fef('0x5')};function emitEvent(_0x538f28){return function(_0x2f88b8,_0x1351b1,_0x5dd9fb){_0x2f88b8[_0x3fef('0x6')]({'attributes':['id'],'raw':!![]})[_0x3fef('0x7')](function(_0x800850){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0x9'),_0x800850[_0x3fef('0xa')](function(_0x356ad8){return{'id':_0x356ad8['id']};}));return SmsMessage[_0x3fef('0xb')]({'where':{'SmsInteractionId':_0x2f88b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fef('0x7')](function(_0x307586){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0xc'),_0x307586[_0x3fef('0xd')]);SmsInteractionEvents[_0x3fef('0xe')](_0x538f28+':'+_0x2f88b8['id'],_0x2f88b8);SmsInteractionEvents['emit'](_0x538f28,_0x2f88b8);_0x5dd9fb(null);})[_0x3fef('0xf')](_0x5dd9fb(null));};}for(var e in events){if(events[_0x3fef('0x10')](e)){var event=events[e];SmsInteraction[_0x3fef('0x11')](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 a1f5705..09deab4 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 _0x3b6e=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt','format','lodash','util','../../config/logger','api'];(function(_0x5932b8,_0x13e127){var _0x208c70=function(_0x42fb1e){while(--_0x42fb1e){_0x5932b8['push'](_0x5932b8['shift']());}};_0x208c70(++_0x13e127);}(_0x3b6e,0x7c));var _0xe3b6=function(_0x5bb843,_0x190e60){_0x5bb843=_0x5bb843-0x0;var _0x591b8c=_0x3b6e[_0x5bb843];return _0x591b8c;};'use strict';var _=require(_0xe3b6('0x0'));var util=require(_0xe3b6('0x1'));var logger=require(_0xe3b6('0x2'))(_0xe3b6('0x3'));var moment=require(_0xe3b6('0x4'));var BPromise=require(_0xe3b6('0x5'));var rp=require(_0xe3b6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3b6('0x7'));var config=require(_0xe3b6('0x8'));var attributes=require(_0xe3b6('0x9'));module[_0xe3b6('0xa')]=function(_0x32cdbc,_0x13f0dd){return _0x32cdbc[_0xe3b6('0xb')](_0xe3b6('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e3e86,_0x3c95b7,_0x3fad53){if(_0x3e3e86[_0xe3b6('0xd')]('closed')){_0x3e3e86[_0xe3b6('0xe')]=moment()[_0xe3b6('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3fad53(null,_0x3e3e86);}}});}; \ No newline at end of file +var _0xa192=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xa192,0x7f));var _0x2a19=function(_0x14bcbf,_0x574598){_0x14bcbf=_0x14bcbf-0x0;var _0x25904e=_0xa192[_0x14bcbf];return _0x25904e;};'use strict';var _=require(_0x2a19('0x0'));var util=require(_0x2a19('0x1'));var logger=require(_0x2a19('0x2'))(_0x2a19('0x3'));var moment=require(_0x2a19('0x4'));var BPromise=require(_0x2a19('0x5'));var rp=require(_0x2a19('0x6'));var fs=require('fs');var path=require(_0x2a19('0x7'));var rimraf=require(_0x2a19('0x8'));var config=require(_0x2a19('0x9'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x5e3d96,_0x9633fc){return _0x5e3d96[_0x2a19('0xa')](_0x2a19('0xb'),attributes,{'tableName':_0x2a19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31c503,_0x29fdf5,_0x58e871){if(_0x31c503[_0x2a19('0xd')](_0x2a19('0xe'))){_0x31c503[_0x2a19('0xf')]=moment()[_0x2a19('0x10')](_0x2a19('0x11'));}_0x58e871(null,_0x31c503);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b3c558e..74dbb6e 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 _0xb32c=['catch','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','options','where','attributes','limit','debug','stringify'];(function(_0xe09d0,_0x1e55d0){var _0x44ad05=function(_0x5095b0){while(--_0x5095b0){_0xe09d0['push'](_0xe09d0['shift']());}};_0x44ad05(++_0x1e55d0);}(_0xb32c,0x18c));var _0xcb32=function(_0x427315,_0x2604ec){_0x427315=_0x427315-0x0;var _0xace65b=_0xb32c[_0x427315];return _0xace65b;};'use strict';var _=require(_0xcb32('0x0'));var util=require(_0xcb32('0x1'));var moment=require(_0xcb32('0x2'));var BPromise=require(_0xcb32('0x3'));var rs=require(_0xcb32('0x4'));var fs=require('fs');var Redis=require(_0xcb32('0x5'));var db=require(_0xcb32('0x6'))['db'];var utils=require(_0xcb32('0x7'));var logger=require('../../config/logger')(_0xcb32('0x8'));var config=require(_0xcb32('0x9'));var jayson=require(_0xcb32('0xa'));var client=jayson[_0xcb32('0xb')][_0xcb32('0xc')]({'port':0x232a});config[_0xcb32('0xd')]=_[_0xcb32('0xe')](config['redis'],{'host':_0xcb32('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb32('0xd')]));require(_0xcb32('0x10'))['register'](socket);function respondWithRpcPromise(_0x1ab66f,_0xdc8aa8,_0x2e0080){return new BPromise(function(_0x54a8bc,_0x126153){return client['request'](_0x1ab66f,_0x2e0080)[_0xcb32('0x11')](function(_0xac4bae){logger[_0xcb32('0x12')](_0xcb32('0x13'),_0xdc8aa8,_0xcb32('0x14'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xdc8aa8,'request\x20sent',JSON['stringify'](_0xac4bae));if(_0xac4bae[_0xcb32('0x15')]){if(_0xac4bae[_0xcb32('0x15')][_0xcb32('0x16')]===0x1f4){logger[_0xcb32('0x15')](_0xcb32('0x13'),_0xdc8aa8,_0xac4bae[_0xcb32('0x15')][_0xcb32('0x17')]);return _0x126153(_0xac4bae[_0xcb32('0x15')][_0xcb32('0x17')]);}logger[_0xcb32('0x15')](_0xcb32('0x13'),_0xdc8aa8,_0xac4bae[_0xcb32('0x15')][_0xcb32('0x17')]);return _0x54a8bc(_0xac4bae[_0xcb32('0x15')][_0xcb32('0x17')]);}else{logger[_0xcb32('0x12')](_0xcb32('0x13'),_0xdc8aa8,_0xcb32('0x14'));_0x54a8bc(_0xac4bae[_0xcb32('0x18')][_0xcb32('0x17')]);}})['catch'](function(_0x57aa4a){logger[_0xcb32('0x15')](_0xcb32('0x13'),_0xdc8aa8,_0x57aa4a);_0x126153(_0x57aa4a);});});}exports[_0xcb32('0x19')]=function(_0x126e9c){var _0x343532=this;return new Promise(function(_0xcddcdc,_0x30963f){return db[_0xcb32('0x1a')][_0xcb32('0x1b')](_0x126e9c['body'],{'raw':_0x126e9c[_0xcb32('0x1c')]?_0x126e9c[_0xcb32('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x126e9c[_0xcb32('0x1c')]?_0x126e9c[_0xcb32('0x1c')][_0xcb32('0x1d')]||null:null,'attributes':_0x126e9c[_0xcb32('0x1c')]?_0x126e9c[_0xcb32('0x1c')][_0xcb32('0x1e')]||null:null,'limit':_0x126e9c[_0xcb32('0x1c')]?_0x126e9c[_0xcb32('0x1c')][_0xcb32('0x1f')]||null:null})[_0xcb32('0x11')](function(_0x4bc3c6){logger[_0xcb32('0x12')](_0xcb32('0x19'),_0x126e9c);logger[_0xcb32('0x20')](_0xcb32('0x19'),_0x126e9c,JSON[_0xcb32('0x21')](_0x4bc3c6));_0xcddcdc(_0x4bc3c6);})[_0xcb32('0x22')](function(_0x3790ad){logger[_0xcb32('0x15')](_0xcb32('0x19'),_0x3790ad[_0xcb32('0x17')],_0x126e9c);_0x30963f(_0x343532[_0xcb32('0x15')](0x1f4,_0x3790ad[_0xcb32('0x17')]));});});};exports[_0xcb32('0x23')]=function(_0xbfe557){return new Promise(function(_0xf2d309,_0x23e302){return db['SmsInteraction'][_0xcb32('0x24')]({'where':_0xbfe557[_0xcb32('0x1c')]?_0xbfe557[_0xcb32('0x1c')]['where']||null:null})['then'](function(_0x35036f){if(_0x35036f){return _0x35036f[_0xcb32('0x25')](_0xbfe557[_0xcb32('0x26')][_0xcb32('0x27')],_[_0xcb32('0x28')](_0xbfe557[_0xcb32('0x26')],[_0xcb32('0x27'),'id'])||{});}})[_0xcb32('0x29')](function(_0x452a8f){logger[_0xcb32('0x12')](_0xcb32('0x2a'),_0xbfe557);logger[_0xcb32('0x20')]('AddTags',_0xbfe557,JSON[_0xcb32('0x21')](_0x452a8f));_0xf2d309(_0x452a8f);})['catch'](function(_0x5457a2){logger[_0xcb32('0x15')](_0xcb32('0x2a'),_0x5457a2[_0xcb32('0x17')],_0xbfe557);_0x23e302(_this[_0xcb32('0x15')](0x1f4,_0x5457a2[_0xcb32('0x17')]));});});}; \ No newline at end of file +var _0x49e1=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','limit','then','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./smsInteraction.socket','register','request'];(function(_0xe89d97,_0x33e5ac){var _0x1b6e5d=function(_0x5618cb){while(--_0x5618cb){_0xe89d97['push'](_0xe89d97['shift']());}};_0x1b6e5d(++_0x33e5ac);}(_0x49e1,0x15e));var _0x149e=function(_0x4a37f9,_0x1d0a8f){_0x4a37f9=_0x4a37f9-0x0;var _0x16b671=_0x49e1[_0x4a37f9];return _0x16b671;};'use strict';var _=require(_0x149e('0x0'));var util=require(_0x149e('0x1'));var moment=require(_0x149e('0x2'));var BPromise=require(_0x149e('0x3'));var rs=require(_0x149e('0x4'));var fs=require('fs');var Redis=require(_0x149e('0x5'));var db=require(_0x149e('0x6'))['db'];var utils=require(_0x149e('0x7'));var logger=require(_0x149e('0x8'))(_0x149e('0x9'));var config=require(_0x149e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x149e('0xb')]['http']({'port':0x232a});config[_0x149e('0xc')]=_[_0x149e('0xd')](config[_0x149e('0xc')],{'host':_0x149e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x149e('0xc')]));require(_0x149e('0xf'))[_0x149e('0x10')](socket);function respondWithRpcPromise(_0x125eaa,_0x2a970f,_0x191a96){return new BPromise(function(_0x45d6b9,_0x4831dd){return client[_0x149e('0x11')](_0x125eaa,_0x191a96)['then'](function(_0x2f3917){logger[_0x149e('0x12')](_0x149e('0x13'),_0x2a970f,_0x149e('0x14'));logger[_0x149e('0x15')](_0x149e('0x16'),_0x2a970f,_0x149e('0x14'),JSON[_0x149e('0x17')](_0x2f3917));if(_0x2f3917[_0x149e('0x18')]){if(_0x2f3917[_0x149e('0x18')][_0x149e('0x19')]===0x1f4){logger[_0x149e('0x18')](_0x149e('0x13'),_0x2a970f,_0x2f3917[_0x149e('0x18')][_0x149e('0x1a')]);return _0x4831dd(_0x2f3917['error'][_0x149e('0x1a')]);}logger['error'](_0x149e('0x13'),_0x2a970f,_0x2f3917[_0x149e('0x18')]['message']);return _0x45d6b9(_0x2f3917[_0x149e('0x18')][_0x149e('0x1a')]);}else{logger[_0x149e('0x12')](_0x149e('0x13'),_0x2a970f,_0x149e('0x14'));_0x45d6b9(_0x2f3917[_0x149e('0x1b')][_0x149e('0x1a')]);}})[_0x149e('0x1c')](function(_0x278fb0){logger[_0x149e('0x18')](_0x149e('0x13'),_0x2a970f,_0x278fb0);_0x4831dd(_0x278fb0);});});}exports[_0x149e('0x1d')]=function(_0x5a6cbb){var _0x53b57f=this;return new Promise(function(_0x449421,_0xa9be79){return db[_0x149e('0x1e')][_0x149e('0x1f')](_0x5a6cbb[_0x149e('0x20')],{'raw':_0x5a6cbb[_0x149e('0x21')]?_0x5a6cbb[_0x149e('0x21')][_0x149e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6cbb['options']?_0x5a6cbb[_0x149e('0x21')]['where']||null:null,'attributes':_0x5a6cbb[_0x149e('0x21')]?_0x5a6cbb[_0x149e('0x21')][_0x149e('0x23')]||null:null,'limit':_0x5a6cbb['options']?_0x5a6cbb[_0x149e('0x21')][_0x149e('0x24')]||null:null})[_0x149e('0x25')](function(_0x96c1b8){logger['info'](_0x149e('0x1d'),_0x5a6cbb);logger[_0x149e('0x15')]('UpdateSmsInteraction',_0x5a6cbb,JSON['stringify'](_0x96c1b8));_0x449421(_0x96c1b8);})[_0x149e('0x1c')](function(_0x1b995a){logger['error']('UpdateSmsInteraction',_0x1b995a['message'],_0x5a6cbb);_0xa9be79(_0x53b57f[_0x149e('0x18')](0x1f4,_0x1b995a[_0x149e('0x1a')]));});});};exports[_0x149e('0x26')]=function(_0x27b1e0){return new Promise(function(_0x4edce4,_0x4187f6){return db['SmsInteraction'][_0x149e('0x27')]({'where':_0x27b1e0[_0x149e('0x21')]?_0x27b1e0[_0x149e('0x21')][_0x149e('0x28')]||null:null})[_0x149e('0x25')](function(_0xf60050){if(_0xf60050){return _0xf60050[_0x149e('0x29')](_0x27b1e0[_0x149e('0x20')][_0x149e('0x2a')],_[_0x149e('0x2b')](_0x27b1e0[_0x149e('0x20')],[_0x149e('0x2a'),'id'])||{});}})[_0x149e('0x2c')](function(_0x410519){logger['info'](_0x149e('0x2d'),_0x27b1e0);logger['debug'](_0x149e('0x2d'),_0x27b1e0,JSON['stringify'](_0x410519));_0x4edce4(_0x410519);})[_0x149e('0x1c')](function(_0x22a831){logger[_0x149e('0x18')](_0x149e('0x2d'),_0x22a831[_0x149e('0x1a')],_0x27b1e0);_0x4187f6(_this[_0x149e('0x18')](0x1f4,_0x22a831[_0x149e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index dcd05e3..448a0a5 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 _0x0236=['./smsInteraction.events','save','remove','removeListener','length','smsInteraction:'];(function(_0xd2760f,_0x45c711){var _0x127e53=function(_0x447cb6){while(--_0x447cb6){_0xd2760f['push'](_0xd2760f['shift']());}};_0x127e53(++_0x45c711);}(_0x0236,0x1d4));var _0x6023=function(_0x2e1207,_0x2620c8){_0x2e1207=_0x2e1207-0x0;var _0x164111=_0x0236[_0x2e1207];return _0x164111;};'use strict';var SmsInteractionEvents=require(_0x6023('0x0'));var events=[_0x6023('0x1'),_0x6023('0x2'),'update'];function createListener(_0x2e63f0,_0x46ead8){return function(_0x1cbb33){_0x46ead8['emit'](_0x2e63f0,_0x1cbb33);};}function removeListener(_0x77a5e5,_0x1de605){return function(){SmsInteractionEvents[_0x6023('0x3')](_0x77a5e5,_0x1de605);};}exports['register']=function(_0x260d06){for(var _0x1e2824=0x0,_0x521271=events[_0x6023('0x4')];_0x1e2824<_0x521271;_0x1e2824++){var _0x6156da=events[_0x1e2824];var _0x1d455a=createListener(_0x6023('0x5')+_0x6156da,_0x260d06);SmsInteractionEvents['on'](_0x6156da,_0x1d455a);}}; \ No newline at end of file +var _0x0af0=['./smsInteraction.events','save','remove','update','emit','register'];(function(_0x6d0552,_0x4eef0b){var _0x5a3cdc=function(_0x44fcba){while(--_0x44fcba){_0x6d0552['push'](_0x6d0552['shift']());}};_0x5a3cdc(++_0x4eef0b);}(_0x0af0,0x15c));var _0x00af=function(_0x1f48e5,_0x451e6e){_0x1f48e5=_0x1f48e5-0x0;var _0x342f42=_0x0af0[_0x1f48e5];return _0x342f42;};'use strict';var SmsInteractionEvents=require(_0x00af('0x0'));var events=[_0x00af('0x1'),_0x00af('0x2'),_0x00af('0x3')];function createListener(_0x439b4f,_0x925a4b){return function(_0x58da66){_0x925a4b[_0x00af('0x4')](_0x439b4f,_0x58da66);};}function removeListener(_0x4bbcd3,_0x367f7b){return function(){SmsInteractionEvents['removeListener'](_0x4bbcd3,_0x367f7b);};}exports[_0x00af('0x5')]=function(_0x507ff9){for(var _0x312c0f=0x0,_0xaec042=events['length'];_0x312c0f<_0xaec042;_0x312c0f++){var _0x57db86=events[_0x312c0f];var _0x13b15f=createListener('smsInteraction:'+_0x57db86,_0x507ff9);SmsInteractionEvents['on'](_0x57db86,_0x13b15f);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 08a4012..7b055cd 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 _0x45c0=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id','update','/:id/accept','accept','reject','delete','destroy','util'];(function(_0x5c40b6,_0x527e94){var _0x12203f=function(_0x308997){while(--_0x308997){_0x5c40b6['push'](_0x5c40b6['shift']());}};_0x12203f(++_0x527e94);}(_0x45c0,0x67));var _0x045c=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x45c0[_0x53cf8e];return _0x459197;};'use strict';var multer=require('multer');var util=require(_0x045c('0x0'));var path=require(_0x045c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x045c('0x2'));var auth=require(_0x045c('0x3'));var interaction=require(_0x045c('0x4'));var config=require(_0x045c('0x5'));var controller=require('./smsMessage.controller');router[_0x045c('0x6')]('/',auth[_0x045c('0x7')](),controller[_0x045c('0x8')]);router[_0x045c('0x6')](_0x045c('0x9'),auth['isAuthenticated'](),controller[_0x045c('0xa')]);router[_0x045c('0x6')]('/:id',auth[_0x045c('0x7')](),controller[_0x045c('0xb')]);router[_0x045c('0xc')]('/',auth['isAuthenticated'](),interaction[_0x045c('0xd')](_0x045c('0xe'),_0x045c('0xf')),controller['create']);router['post'](_0x045c('0x10'),controller[_0x045c('0x11')]);router[_0x045c('0x12')](_0x045c('0x13'),auth[_0x045c('0x7')](),controller[_0x045c('0x14')]);router[_0x045c('0x12')](_0x045c('0x15'),auth[_0x045c('0x7')](),controller[_0x045c('0x16')]);router[_0x045c('0x12')]('/:id/reject',auth[_0x045c('0x7')](),controller[_0x045c('0x17')]);router[_0x045c('0x18')](_0x045c('0x13'),auth[_0x045c('0x7')](),controller[_0x045c('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9197=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','status','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x73536b,_0x17e09a){var _0xfd965f=function(_0x5486ea){while(--_0x5486ea){_0x73536b['push'](_0x73536b['shift']());}};_0xfd965f(++_0x17e09a);}(_0x9197,0x97));var _0x7919=function(_0x5a0a2f,_0x3ad30d){_0x5a0a2f=_0x5a0a2f-0x0;var _0x1b1d9a=_0x9197[_0x5a0a2f];return _0x1b1d9a;};'use strict';var multer=require(_0x7919('0x0'));var util=require(_0x7919('0x1'));var path=require(_0x7919('0x2'));var timeout=require(_0x7919('0x3'));var express=require(_0x7919('0x4'));var router=express[_0x7919('0x5')]();var fs_extra=require(_0x7919('0x6'));var auth=require(_0x7919('0x7'));var interaction=require(_0x7919('0x8'));var config=require(_0x7919('0x9'));var controller=require('./smsMessage.controller');router[_0x7919('0xa')]('/',auth[_0x7919('0xb')](),controller[_0x7919('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7919('0xd')]);router[_0x7919('0xa')](_0x7919('0xe'),auth[_0x7919('0xb')](),controller[_0x7919('0xf')]);router[_0x7919('0x10')]('/',auth[_0x7919('0xb')](),interaction['tracked']('sms','smsmessage:create'),controller[_0x7919('0x11')]);router['post']('/:id/status',controller[_0x7919('0x12')]);router[_0x7919('0x13')](_0x7919('0xe'),auth[_0x7919('0xb')](),controller[_0x7919('0x14')]);router[_0x7919('0x13')](_0x7919('0x15'),auth[_0x7919('0xb')](),controller[_0x7919('0x16')]);router['put'](_0x7919('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x7919('0x18')](_0x7919('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7919('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 5da7a24..b2fc642 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 _0xc94e=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xc94e,0x85));var _0xec94=function(_0x341f9f,_0x1d482f){_0x341f9f=_0x341f9f-0x0;var _0x9488d=_0xc94e[_0x341f9f];return _0x9488d;};'use strict';var Sequelize=require(_0xec94('0x0'));module[_0xec94('0x1')]={'body':{'type':Sequelize[_0xec94('0x2')](_0xec94('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xec94('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xec94('0x5')]('in',_0xec94('0x6')),'defaultValue':_0xec94('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xec94('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xec94('0x2')]}}; \ No newline at end of file +var _0x5573=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x5b84e5,_0x26076b){var _0xff9066=function(_0x3f17df){while(--_0x3f17df){_0x5b84e5['push'](_0x5b84e5['shift']());}};_0xff9066(++_0x26076b);}(_0x5573,0x9e));var _0x3557=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x5573[_0x374ccf];return _0x443cde;};'use strict';var Sequelize=require(_0x3557('0x0'));module['exports']={'body':{'type':Sequelize[_0x3557('0x1')](_0x3557('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3557('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3557('0x4')]('in','out'),'defaultValue':_0x3557('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3557('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3557('0x6')]},'readAt':{'type':Sequelize[_0x3557('0x7')]},'secret':{'type':Sequelize[_0x3557('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3557('0x6')]},'providerResponse':{'type':Sequelize[_0x3557('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 945b476..8200bc9 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 _0x9c9b=['redis','socket.io-emitter','jayson/promise','client','http','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','params','includeAll','find','create','body','describe','accept','sms','read','format','UserId','user','agent','get','SmsInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x20b310,_0x192a70){var _0x4c1bfc=function(_0x17a2bc){while(--_0x17a2bc){_0x20b310['push'](_0x20b310['shift']());}};_0x4c1bfc(++_0x192a70);}(_0x9c9b,0x194));var _0xb9c9=function(_0x43f6f1,_0x10bab8){_0x43f6f1=_0x43f6f1-0x0;var _0x4c4e41=_0x9c9b[_0x43f6f1];return _0x4c4e41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9c9('0x0'));var zipdir=require(_0xb9c9('0x1'));var jsonpatch=require(_0xb9c9('0x2'));var rp=require(_0xb9c9('0x3'));var moment=require(_0xb9c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb9c9('0x5'));var util=require(_0xb9c9('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb9c9('0x7'));var fs=require('fs');var fs_extra=require(_0xb9c9('0x8'));var _=require(_0xb9c9('0x9'));var squel=require(_0xb9c9('0xa'));var crypto=require(_0xb9c9('0xb'));var jsforce=require(_0xb9c9('0xc'));var deskjs=require(_0xb9c9('0xd'));var toCsv=require(_0xb9c9('0xe'));var querystring=require(_0xb9c9('0xf'));var Papa=require(_0xb9c9('0x10'));var Redis=require(_0xb9c9('0x11'));var authService=require(_0xb9c9('0x12'));var qs=require(_0xb9c9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9c9('0x14'))(_0xb9c9('0x15'));var utils=require(_0xb9c9('0x16'));var config=require(_0xb9c9('0x17'));var licenseUtil=require(_0xb9c9('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xb9c9('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9c9('0x1a'))(new Redis(config[_0xb9c9('0x19')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xb9c9('0x1b'));var client=jayson[_0xb9c9('0x1c')][_0xb9c9('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xb9c9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1af04b,_0xf55953,_0xf48fa6,_0x13abaf){return new BPromise(function(_0x49f17c,_0x36719c){var _0x3fbf85=_0x13abaf||client;return _0x3fbf85[_0xb9c9('0x1e')](_0x1af04b,_0xf48fa6)['then'](function(_0x5b9586){logger['info']('SmsMessage,\x20%s,\x20%s',_0xf55953,_0xb9c9('0x1f'));logger[_0xb9c9('0x20')](_0xb9c9('0x21'),_0xf55953,_0xb9c9('0x1f'),JSON[_0xb9c9('0x22')](_0x5b9586));if(_0x5b9586[_0xb9c9('0x23')]){if(_0x5b9586[_0xb9c9('0x23')][_0xb9c9('0x24')]===0x1f4){logger[_0xb9c9('0x23')](_0xb9c9('0x25'),_0xf55953,_0x5b9586[_0xb9c9('0x23')][_0xb9c9('0x26')]);return _0x36719c(_0x5b9586[_0xb9c9('0x23')]['message']);}logger[_0xb9c9('0x23')]('SmsMessage,\x20%s,\x20%s',_0xf55953,_0x5b9586[_0xb9c9('0x23')][_0xb9c9('0x26')]);return _0x49f17c(_0x5b9586[_0xb9c9('0x23')][_0xb9c9('0x26')]);}else{logger[_0xb9c9('0x27')]('SmsMessage,\x20%s,\x20%s',_0xf55953,_0xb9c9('0x1f'));_0x49f17c(_0x5b9586[_0xb9c9('0x28')][_0xb9c9('0x26')]);}})[_0xb9c9('0x29')](function(_0x57b6a7){logger[_0xb9c9('0x23')]('SmsMessage,\x20%s,\x20%s',_0xf55953,_0x57b6a7);_0x36719c(_0x57b6a7);});});}function respondWithStatusCode(_0x4bdfd4,_0x572215){_0x572215=_0x572215||0xcc;return function(_0x24011f){if(_0x24011f){return _0x4bdfd4[_0xb9c9('0x2a')](_0x572215);}return _0x4bdfd4[_0xb9c9('0x2b')](_0x572215)['end']();};}function respondWithResult(_0xe3198c,_0x139b84){_0x139b84=_0x139b84||0xc8;return function(_0xdf8e50){if(_0xdf8e50){return _0xe3198c[_0xb9c9('0x2b')](_0x139b84)[_0xb9c9('0x2c')](_0xdf8e50);}};}function respondWithFilteredResult(_0x3bfc70,_0x2fb33f){return function(_0x45f88e){if(_0x45f88e){var _0x39d009=typeof _0x2fb33f['offset']===_0xb9c9('0x2d')&&typeof _0x2fb33f[_0xb9c9('0x2e')]===_0xb9c9('0x2d');var _0x5c6e48=_0x45f88e[_0xb9c9('0x2f')];var _0x1811a5=_0x39d009?0x0:_0x2fb33f[_0xb9c9('0x30')];var _0x8f749a=_0x39d009?_0x45f88e['count']:_0x2fb33f[_0xb9c9('0x30')]+_0x2fb33f[_0xb9c9('0x2e')];var _0x315f8b;if(_0x8f749a>=_0x5c6e48){_0x8f749a=_0x5c6e48;_0x315f8b=0xc8;}else{_0x315f8b=0xce;}_0x3bfc70['status'](_0x315f8b);return _0x3bfc70[_0xb9c9('0x31')](_0xb9c9('0x32'),_0x1811a5+'-'+_0x8f749a+'/'+_0x5c6e48)[_0xb9c9('0x2c')](_0x45f88e);}return null;};}function patchUpdates(_0x34ff7c){return function(_0x1be799){try{jsonpatch[_0xb9c9('0x33')](_0x1be799,_0x34ff7c,!![]);}catch(_0x2dadec){return BPromise[_0xb9c9('0x34')](_0x2dadec);}return _0x1be799[_0xb9c9('0x35')]();};}function saveUpdates(_0x28424d,_0x144113){return function(_0x5f138a){if(_0x5f138a){return _0x5f138a[_0xb9c9('0x36')](_0x28424d)['then'](function(_0x303d4e){return _0x303d4e;});}return null;};}function removeEntity(_0x4edcfb,_0xc8a4c7){return function(_0x29d68c){if(_0x29d68c){return _0x29d68c[_0xb9c9('0x37')]()[_0xb9c9('0x38')](function(){_0x4edcfb[_0xb9c9('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa194a,_0x27fca0){return function(_0x5093fd){if(!_0x5093fd){_0xaa194a[_0xb9c9('0x2a')](0x194);}return _0x5093fd;};}function handleError(_0x1e6aba,_0x26d75b){_0x26d75b=_0x26d75b||0x1f4;return function(_0x717e9d){logger[_0xb9c9('0x23')](_0x717e9d['stack']);if(_0x717e9d[_0xb9c9('0x39')]){delete _0x717e9d[_0xb9c9('0x39')];}_0x1e6aba[_0xb9c9('0x2b')](_0x26d75b)[_0xb9c9('0x3a')](_0x717e9d);};}exports[_0xb9c9('0x3b')]=function(_0x151e6f,_0x2b8ba3){var _0x27e027={},_0xfe1d9a={},_0x555993={'count':0x0,'rows':[]};var _0x1c6db0=_[_0xb9c9('0x3c')](db[_0xb9c9('0x3d')][_0xb9c9('0x3e')],function(_0x4f093c){return{'name':_0x4f093c[_0xb9c9('0x3f')],'type':_0x4f093c[_0xb9c9('0x40')]['key']};});_0xfe1d9a['model']=_[_0xb9c9('0x3c')](_0x1c6db0,_0xb9c9('0x39'));_0xfe1d9a[_0xb9c9('0x41')]=_[_0xb9c9('0x42')](_0x151e6f[_0xb9c9('0x41')]);_0xfe1d9a[_0xb9c9('0x43')]=_[_0xb9c9('0x44')](_0xfe1d9a['model'],_0xfe1d9a[_0xb9c9('0x41')]);_0x27e027[_0xb9c9('0x45')]=_[_0xb9c9('0x44')](_0xfe1d9a[_0xb9c9('0x46')],qs[_0xb9c9('0x47')](_0x151e6f[_0xb9c9('0x41')][_0xb9c9('0x47')]));_0x27e027[_0xb9c9('0x45')]=_0x27e027[_0xb9c9('0x45')][_0xb9c9('0x48')]?_0x27e027[_0xb9c9('0x45')]:_0xfe1d9a[_0xb9c9('0x46')];if(!_0x151e6f[_0xb9c9('0x41')]['hasOwnProperty'](_0xb9c9('0x49'))){_0x27e027[_0xb9c9('0x2e')]=qs[_0xb9c9('0x2e')](_0x151e6f['query'][_0xb9c9('0x2e')]);_0x27e027['offset']=qs[_0xb9c9('0x30')](_0x151e6f[_0xb9c9('0x41')]['offset']);}_0x27e027[_0xb9c9('0x4a')]=qs[_0xb9c9('0x4b')](_0x151e6f[_0xb9c9('0x41')][_0xb9c9('0x4b')]);_0x27e027[_0xb9c9('0x4c')]=qs[_0xb9c9('0x43')](_['pick'](_0x151e6f['query'],_0xfe1d9a['filters']),_0x1c6db0);if(_0x151e6f[_0xb9c9('0x41')][_0xb9c9('0x4d')]){_0x27e027['where']=_[_0xb9c9('0x4e')](_0x27e027[_0xb9c9('0x4c')],{'$or':_[_0xb9c9('0x3c')](_0x1c6db0,function(_0x403143){if(_0x403143[_0xb9c9('0x40')]!==_0xb9c9('0x4f')){var _0x1ca424={};_0x1ca424[_0x403143['name']]={'$like':'%'+_0x151e6f[_0xb9c9('0x41')][_0xb9c9('0x4d')]+'%'};return _0x1ca424;}})});}_0x27e027=_[_0xb9c9('0x4e')]({},_0x27e027,_0x151e6f[_0xb9c9('0x50')]);var _0x4769bc={'where':_0x27e027[_0xb9c9('0x4c')]};return db[_0xb9c9('0x3d')][_0xb9c9('0x2f')](_0x4769bc)[_0xb9c9('0x38')](function(_0x330a15){_0x555993['count']=_0x330a15;if(_0x151e6f[_0xb9c9('0x41')]['includeAll']){_0x27e027[_0xb9c9('0x51')]=[{'all':!![]}];}return db[_0xb9c9('0x3d')][_0xb9c9('0x52')](_0x27e027);})['then'](function(_0x5dd635){_0x555993['rows']=_0x5dd635;return _0x555993;})[_0xb9c9('0x38')](respondWithFilteredResult(_0x2b8ba3,_0x27e027))['catch'](handleError(_0x2b8ba3,null));};exports['show']=function(_0x57dd16,_0x4cf86d){var _0x227bf3={'raw':!![],'where':{'id':_0x57dd16[_0xb9c9('0x53')]['id']}},_0x47eb4b={};_0x47eb4b['model']=_[_0xb9c9('0x42')](db[_0xb9c9('0x3d')][_0xb9c9('0x3e')]);_0x47eb4b[_0xb9c9('0x41')]=_['keys'](_0x57dd16[_0xb9c9('0x41')]);_0x47eb4b[_0xb9c9('0x43')]=_[_0xb9c9('0x44')](_0x47eb4b[_0xb9c9('0x46')],_0x47eb4b[_0xb9c9('0x41')]);_0x227bf3[_0xb9c9('0x45')]=_[_0xb9c9('0x44')](_0x47eb4b['model'],qs[_0xb9c9('0x47')](_0x57dd16['query']['fields']));_0x227bf3[_0xb9c9('0x45')]=_0x227bf3[_0xb9c9('0x45')][_0xb9c9('0x48')]?_0x227bf3[_0xb9c9('0x45')]:_0x47eb4b[_0xb9c9('0x46')];if(_0x57dd16[_0xb9c9('0x41')][_0xb9c9('0x54')]){_0x227bf3[_0xb9c9('0x51')]=[{'all':!![]}];}_0x227bf3=_[_0xb9c9('0x4e')]({},_0x227bf3,_0x57dd16[_0xb9c9('0x50')]);return db[_0xb9c9('0x3d')][_0xb9c9('0x55')](_0x227bf3)[_0xb9c9('0x38')](handleEntityNotFound(_0x4cf86d,null))[_0xb9c9('0x38')](respondWithResult(_0x4cf86d,null))[_0xb9c9('0x29')](handleError(_0x4cf86d,null));};exports[_0xb9c9('0x56')]=function(_0x565c36,_0x531437){return db[_0xb9c9('0x3d')][_0xb9c9('0x56')](_0x565c36[_0xb9c9('0x57')],{})[_0xb9c9('0x38')](respondWithResult(_0x531437,0xc9))[_0xb9c9('0x29')](handleError(_0x531437,null));};exports[_0xb9c9('0x36')]=function(_0x35ee56,_0x5618da){if(_0x35ee56[_0xb9c9('0x57')]['id']){delete _0x35ee56['body']['id'];}return db[_0xb9c9('0x3d')][_0xb9c9('0x55')]({'where':{'id':_0x35ee56[_0xb9c9('0x53')]['id']}})['then'](handleEntityNotFound(_0x5618da,null))[_0xb9c9('0x38')](saveUpdates(_0x35ee56[_0xb9c9('0x57')],null))[_0xb9c9('0x38')](respondWithResult(_0x5618da,null))['catch'](handleError(_0x5618da,null));};exports[_0xb9c9('0x37')]=function(_0x598354,_0x17a130){return db[_0xb9c9('0x3d')][_0xb9c9('0x55')]({'where':{'id':_0x598354[_0xb9c9('0x53')]['id']}})[_0xb9c9('0x38')](handleEntityNotFound(_0x17a130,null))[_0xb9c9('0x38')](removeEntity(_0x17a130,null))[_0xb9c9('0x29')](handleError(_0x17a130,null));};exports[_0xb9c9('0x58')]=function(_0x4586b6,_0x5952cc){return db[_0xb9c9('0x3d')][_0xb9c9('0x58')]()[_0xb9c9('0x38')](respondWithResult(_0x5952cc,null))[_0xb9c9('0x29')](handleError(_0x5952cc,null));};var interaction_log=require(_0xb9c9('0x14'))('sms-interactions');exports[_0xb9c9('0x59')]=function(_0x2ee67a,_0x1322b6,_0x401b41){var _0x1b65a9={'agent':{},'channel':_0xb9c9('0x5a')};if(_0x2ee67a['body']['id']){delete _0x2ee67a['body']['id'];}_0x2ee67a[_0xb9c9('0x57')][_0xb9c9('0x5b')]=!![];_0x2ee67a[_0xb9c9('0x57')]['readAt']=moment()[_0xb9c9('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ee67a['body'][_0xb9c9('0x5d')]=_0x2ee67a['body']['UserId']||_0x2ee67a[_0xb9c9('0x5e')]['id'];_0x1b65a9[_0xb9c9('0x5f')]['id']=_0x2ee67a[_0xb9c9('0x57')][_0xb9c9('0x5d')];return db['SmsMessage']['find']({'where':{'id':_0x2ee67a[_0xb9c9('0x53')]['id'],'UserId':null}})[_0xb9c9('0x38')](handleEntityNotFound(_0x1322b6,null))['then'](saveUpdates(_0x2ee67a[_0xb9c9('0x57')],null))['then'](function(_0x3a0b6b){if(_0x3a0b6b){_0x1b65a9[_0xb9c9('0x26')]=_0x3a0b6b[_0xb9c9('0x60')]({'plain':!![]});return db[_0xb9c9('0x61')][_0xb9c9('0x55')]({'where':{'id':_0x3a0b6b['SmsInteractionId']}});}return null;})[_0xb9c9('0x38')](handleEntityNotFound(_0x1322b6,null))['then'](function(_0x1ddfb4){if(_0x1ddfb4){return _0x1ddfb4[_0xb9c9('0x36')]({'UserId':_0x2ee67a[_0xb9c9('0x57')]['UserId'],'read1stAt':_['isNil'](_0x1ddfb4[_0xb9c9('0x62')])?moment()[_0xb9c9('0x5c')](_0xb9c9('0x63')):undefined});}return null;})['then'](function(_0x3ba50a){if(_0x3ba50a){_0x1b65a9[_0xb9c9('0x64')]=_0x3ba50a[_0xb9c9('0x60')]({'plain':!![]});interaction_log[_0xb9c9('0x27')](_0xb9c9('0x65'),_0x2ee67a[_0xb9c9('0x5e')]['id'],_0x2ee67a[_0xb9c9('0x5e')][_0xb9c9('0x39')],_0x2ee67a[_0xb9c9('0x5e')][_0xb9c9('0x66')],_0x1b65a9[_0xb9c9('0x64')]['id'],_0x2ee67a[_0xb9c9('0x57')]?JSON[_0xb9c9('0x22')](_0x2ee67a[_0xb9c9('0x57')]):_0xb9c9('0x67'));return respondWithRpcPromise(_0xb9c9('0x68'),_0xb9c9('0x69'),_0x1b65a9);}return null;})[_0xb9c9('0x38')](function(_0x5091b1){var _0x21a59e=_0xb9c9('0x6a')+_0x5091b1[_0xb9c9('0x26')][_0xb9c9('0x6b')];return db[_0xb9c9('0x6c')][_0xb9c9('0x41')](_0x21a59e,{'type':db[_0xb9c9('0x6d')][_0xb9c9('0x6e')][_0xb9c9('0x6f')],'raw':!![]})[_0xb9c9('0x38')](function(_0x162ad0){return _0x162ad0;});})[_0xb9c9('0x38')](function(_0x3f5029){if(_0x3f5029){_0x1b65a9[_0xb9c9('0x26')][_0xb9c9('0x70')]=_0x3f5029[0x0];if(!_0x2ee67a[_0xb9c9('0x57')][_0xb9c9('0x5d')])return;return db['User'][_0xb9c9('0x55')]({'where':{'id':_0x2ee67a[_0xb9c9('0x57')][_0xb9c9('0x5d')],'role':_0xb9c9('0x5f')},'attributes':['id',_0xb9c9('0x39'),_0xb9c9('0x71'),_0xb9c9('0x72'),_0xb9c9('0x73')],'raw':!![]});}return null;})[_0xb9c9('0x38')](function(_0xf5902a){if(!_0xf5902a)return null;_0x1b65a9[_0xb9c9('0x26')]['agent']=_0xf5902a;return _0x1b65a9;})[_0xb9c9('0x38')](function(_0x3a8948){if(_0x3a8948){if(_0x2ee67a[_0xb9c9('0x57')][_0xb9c9('0x74')]){_0x1b65a9[_0xb9c9('0x26')]['interface']=util[_0xb9c9('0x5c')](_0xb9c9('0x75'),_0x2ee67a[_0xb9c9('0x5e')]['name']);_0x1b65a9[_0xb9c9('0x26')][_0xb9c9('0x76')]=_0x1b65a9['channel'];_0x1b65a9['message'][_0xb9c9('0x77')]=_0x1b65a9['channel'];_0x1b65a9[_0xb9c9('0x26')][_0xb9c9('0x78')]='accept';return respondWithRpcPromise(_0xb9c9('0x79'),_0xb9c9('0x79'),{'event':_0xb9c9('0x7a'),'message':_0x1b65a9[_0xb9c9('0x26')]},client9002)[_0xb9c9('0x38')](function(){return _0x1b65a9;});}return _0x1b65a9;}return null;})[_0xb9c9('0x38')](respondWithResult(_0x1322b6,null))['catch'](handleError(_0x1322b6,null));};var interaction_log=require(_0xb9c9('0x14'))(_0xb9c9('0x7b'));exports['reject']=function(_0x4ade9e,_0x3cd19e,_0x389501){var _0x3028c1={'agent':{},'channel':_0xb9c9('0x5a')};if(_0x4ade9e[_0xb9c9('0x57')]['id']){delete _0x4ade9e['body']['id'];}_0x4ade9e[_0xb9c9('0x57')]['UserId']=_0x4ade9e[_0xb9c9('0x57')]['UserId']||_0x4ade9e[_0xb9c9('0x5e')]['id'];_0x3028c1[_0xb9c9('0x5f')]['id']=_0x4ade9e[_0xb9c9('0x57')][_0xb9c9('0x5d')];return db[_0xb9c9('0x3d')]['find']({'where':{'id':_0x4ade9e[_0xb9c9('0x53')]['id'],'UserId':null}})[_0xb9c9('0x38')](handleEntityNotFound(_0x3cd19e,null))[_0xb9c9('0x38')](function(_0x309656){if(_0x309656){_0x3028c1[_0xb9c9('0x26')]=_0x309656[_0xb9c9('0x60')]({'plain':!![]});return db[_0xb9c9('0x61')][_0xb9c9('0x55')]({'where':{'id':_0x309656[_0xb9c9('0x7c')]}});}return null;})[_0xb9c9('0x38')](handleEntityNotFound(_0x3cd19e,null))['then'](function(_0x3e437f){if(_0x3e437f){_0x3028c1[_0xb9c9('0x64')]=_0x3e437f[_0xb9c9('0x60')]({'plain':!![]});interaction_log[_0xb9c9('0x27')](_0xb9c9('0x7d'),_0x4ade9e[_0xb9c9('0x5e')]['id'],_0x4ade9e[_0xb9c9('0x5e')][_0xb9c9('0x39')],_0x4ade9e[_0xb9c9('0x5e')][_0xb9c9('0x66')],_0x3028c1[_0xb9c9('0x64')]['id'],_0x4ade9e[_0xb9c9('0x57')]?JSON[_0xb9c9('0x22')](_0x4ade9e[_0xb9c9('0x57')]):_0xb9c9('0x67'));return respondWithRpcPromise('RejectMessage',_0xb9c9('0x7e'),_0x3028c1);}return null;})[_0xb9c9('0x38')](function(_0x3d7054){var _0x37b8e0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3d7054[_0xb9c9('0x26')]['ContactId'];return db[_0xb9c9('0x6c')][_0xb9c9('0x41')](_0x37b8e0,{'type':db[_0xb9c9('0x6d')][_0xb9c9('0x6e')][_0xb9c9('0x6f')],'raw':!![]})[_0xb9c9('0x38')](function(_0x4546af){return _0x4546af;});})[_0xb9c9('0x38')](function(_0x1d161c){if(_0x1d161c){_0x3028c1[_0xb9c9('0x26')][_0xb9c9('0x70')]=_0x1d161c[0x0];if(!_0x4ade9e[_0xb9c9('0x57')][_0xb9c9('0x5d')])return;return db['User'][_0xb9c9('0x55')]({'where':{'id':_0x4ade9e[_0xb9c9('0x57')][_0xb9c9('0x5d')],'role':_0xb9c9('0x5f')},'attributes':['id','name',_0xb9c9('0x71'),_0xb9c9('0x72'),_0xb9c9('0x73')],'raw':!![]});}return null;})[_0xb9c9('0x38')](function(_0x553d56){if(!_0x553d56)return null;_0x3028c1[_0xb9c9('0x26')][_0xb9c9('0x5f')]=_0x553d56;return _0x3028c1;})[_0xb9c9('0x38')](function(_0x263e39){if(_0x263e39){_0x263e39[_0xb9c9('0x26')][_0xb9c9('0x7f')]=util['format'](_0xb9c9('0x75'),_0x4ade9e[_0xb9c9('0x5e')]['name']);_0x263e39[_0xb9c9('0x26')][_0xb9c9('0x76')]=_0x3028c1[_0xb9c9('0x76')];_0x263e39[_0xb9c9('0x26')][_0xb9c9('0x77')]=_0x3028c1[_0xb9c9('0x76')];_0x263e39['message'][_0xb9c9('0x78')]=_0xb9c9('0x34');respondWithRpcPromise(_0xb9c9('0x79'),_0xb9c9('0x79'),{'event':'rejectmessage','message':_0x263e39[_0xb9c9('0x26')]},client9002);return _0x3028c1;}return null;})['then'](respondWithResult(_0x3cd19e,null))['catch'](handleError(_0x3cd19e,null));};exports['status']=function(_0x1915eb,_0x14fe17,_0x1d46b8){if(_0x1915eb[_0xb9c9('0x57')]['id']){delete _0x1915eb['body']['id'];}var _0x3f4410;return db['SmsMessage']['find']({'where':{'id':_0x1915eb[_0xb9c9('0x53')]['id']}})['then'](handleEntityNotFound(_0x14fe17,null))[_0xb9c9('0x38')](function(_0x4cf222){if(_0x4cf222){_0x3f4410=_0x4cf222;return db['SmsAccount'][_0xb9c9('0x55')]({'where':{'id':_0x4cf222['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x14fe17,null))[_0xb9c9('0x38')](function(_0x221cb9){if(_0x221cb9){logger[_0xb9c9('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb9c9('0x2b'),'received\x20delivery\x20report\x20from',_0x221cb9[_0xb9c9('0x40')],util[_0xb9c9('0x80')](_0x1915eb[_0xb9c9('0x57')],{'showHidden':![],'depth':null}));switch(_0x221cb9[_0xb9c9('0x40')]){case _0xb9c9('0x81'):if(_0x1915eb['body'][_0xb9c9('0x82')]&&_0x1915eb['body'][_0xb9c9('0x82')]===_0x3f4410[_0xb9c9('0x83')]){return _0x3f4410[_0xb9c9('0x36')]({'read':!![]});}else{logger['error'](_0xb9c9('0x84'),_0xb9c9('0x2b'),_0xb9c9('0x81'),util[_0xb9c9('0x80')](_0x1915eb[_0xb9c9('0x57')],{'showHidden':![],'depth':null}));}break;case _0xb9c9('0x85'):if(_0x1915eb[_0xb9c9('0x57')][_0xb9c9('0x86')]&&_0x1915eb[_0xb9c9('0x57')][_0xb9c9('0x86')]===_0x3f4410['messageId']&&_[_0xb9c9('0x87')]([_0xb9c9('0x88'),_0xb9c9('0x89')],_0x1915eb[_0xb9c9('0x57')][_0xb9c9('0x8a')])>=0x0){return _0x3f4410['update']({'read':!![]});}else{logger[_0xb9c9('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb9c9('0x2b'),_0xb9c9('0x8b'),util[_0xb9c9('0x80')](_0x1915eb['body'],{'showHidden':![],'depth':null}));}break;case _0xb9c9('0x8c'):var _0x2a4997=_0x1915eb[_0xb9c9('0x57')][_0xb9c9('0x8d')][0x0];if(_0x2a4997['status'][_0xb9c9('0x8e')]==='DELIVERED'){return _0x3f4410[_0xb9c9('0x36')]({'read':!![]});}else{logger['error'](_0xb9c9('0x84'),_0xb9c9('0x2b'),'infobip',util[_0xb9c9('0x80')](_0x1915eb[_0xb9c9('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x3f4410;}})['then'](respondWithResult(_0x14fe17,null))[_0xb9c9('0x29')](handleError(_0x14fe17,null));}; \ No newline at end of file +var _0x68a5=['Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsMessage','includeAll','findAll','show','params','include','find','create','body','describe','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','../../config/logger','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','contact','User','motionChannel','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x3917b7,_0x33253f){var _0x3bb311=function(_0x5c48af){while(--_0x5c48af){_0x3917b7['push'](_0x3917b7['shift']());}};_0x3bb311(++_0x33253f);}(_0x68a5,0xfc));var _0x568a=function(_0x5f3bfb,_0x2ab7d9){_0x5f3bfb=_0x5f3bfb-0x0;var _0xa3e1a9=_0x68a5[_0x5f3bfb];return _0xa3e1a9;};'use strict';var emlformat=require(_0x568a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x568a('0x1'));var jsonpatch=require(_0x568a('0x2'));var rp=require('request-promise');var moment=require(_0x568a('0x3'));var BPromise=require(_0x568a('0x4'));var Mustache=require(_0x568a('0x5'));var util=require(_0x568a('0x6'));var path=require('path');var sox=require(_0x568a('0x7'));var csv=require('to-csv');var ejs=require(_0x568a('0x8'));var fs=require('fs');var fs_extra=require(_0x568a('0x9'));var _=require(_0x568a('0xa'));var squel=require(_0x568a('0xb'));var crypto=require('crypto');var jsforce=require(_0x568a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x568a('0xd'));var querystring=require(_0x568a('0xe'));var Papa=require(_0x568a('0xf'));var Redis=require(_0x568a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x568a('0x11'));var hardwareService=require(_0x568a('0x12'));var logger=require('../../config/logger')(_0x568a('0x13'));var utils=require('../../config/utils');var config=require(_0x568a('0x14'));var licenseUtil=require(_0x568a('0x15'));var db=require(_0x568a('0x16'))['db'];config[_0x568a('0x17')]=_[_0x568a('0x18')](config[_0x568a('0x17')],{'host':_0x568a('0x19'),'port':0x18eb});var socket=require(_0x568a('0x1a'))(new Redis(config[_0x568a('0x17')]));require(_0x568a('0x1b'))[_0x568a('0x1c')](socket);var jayson=require(_0x568a('0x1d'));var client=jayson[_0x568a('0x1e')][_0x568a('0x1f')]({'port':0x232c});var client9002=jayson[_0x568a('0x1e')][_0x568a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x375bac,_0x4e6f9a,_0x323bf3,_0x573b17){return new BPromise(function(_0xa77de8,_0x28875e){var _0x497ee0=_0x573b17||client;return _0x497ee0[_0x568a('0x20')](_0x375bac,_0x323bf3)['then'](function(_0x40d4a1){logger[_0x568a('0x21')](_0x568a('0x22'),_0x4e6f9a,_0x568a('0x23'));logger['debug'](_0x568a('0x24'),_0x4e6f9a,'request\x20sent',JSON[_0x568a('0x25')](_0x40d4a1));if(_0x40d4a1[_0x568a('0x26')]){if(_0x40d4a1[_0x568a('0x26')][_0x568a('0x27')]===0x1f4){logger[_0x568a('0x26')](_0x568a('0x22'),_0x4e6f9a,_0x40d4a1[_0x568a('0x26')][_0x568a('0x28')]);return _0x28875e(_0x40d4a1['error'][_0x568a('0x28')]);}logger[_0x568a('0x26')]('SmsMessage,\x20%s,\x20%s',_0x4e6f9a,_0x40d4a1[_0x568a('0x26')][_0x568a('0x28')]);return _0xa77de8(_0x40d4a1[_0x568a('0x26')]['message']);}else{logger[_0x568a('0x21')](_0x568a('0x22'),_0x4e6f9a,_0x568a('0x23'));_0xa77de8(_0x40d4a1[_0x568a('0x29')][_0x568a('0x28')]);}})[_0x568a('0x2a')](function(_0x1dcda2){logger[_0x568a('0x26')](_0x568a('0x22'),_0x4e6f9a,_0x1dcda2);_0x28875e(_0x1dcda2);});});}function respondWithStatusCode(_0x5721a5,_0x1b228f){_0x1b228f=_0x1b228f||0xcc;return function(_0x63decd){if(_0x63decd){return _0x5721a5[_0x568a('0x2b')](_0x1b228f);}return _0x5721a5[_0x568a('0x2c')](_0x1b228f)[_0x568a('0x2d')]();};}function respondWithResult(_0x438402,_0x5d8c2e){_0x5d8c2e=_0x5d8c2e||0xc8;return function(_0x473ba8){if(_0x473ba8){return _0x438402[_0x568a('0x2c')](_0x5d8c2e)[_0x568a('0x2e')](_0x473ba8);}};}function respondWithFilteredResult(_0x23d444,_0x20498b){return function(_0x5911f4){if(_0x5911f4){var _0x460b31=typeof _0x20498b[_0x568a('0x2f')]===_0x568a('0x30')&&typeof _0x20498b[_0x568a('0x31')]===_0x568a('0x30');var _0x153e1a=_0x5911f4[_0x568a('0x32')];var _0x396ee9=_0x460b31?0x0:_0x20498b[_0x568a('0x2f')];var _0x464d34=_0x460b31?_0x5911f4['count']:_0x20498b[_0x568a('0x2f')]+_0x20498b[_0x568a('0x31')];var _0x43842e;if(_0x464d34>=_0x153e1a){_0x464d34=_0x153e1a;_0x43842e=0xc8;}else{_0x43842e=0xce;}_0x23d444[_0x568a('0x2c')](_0x43842e);return _0x23d444[_0x568a('0x33')](_0x568a('0x34'),_0x396ee9+'-'+_0x464d34+'/'+_0x153e1a)['json'](_0x5911f4);}return null;};}function patchUpdates(_0x481261){return function(_0x4d028b){try{jsonpatch[_0x568a('0x35')](_0x4d028b,_0x481261,!![]);}catch(_0x153792){return BPromise[_0x568a('0x36')](_0x153792);}return _0x4d028b[_0x568a('0x37')]();};}function saveUpdates(_0x2febce,_0x555cbb){return function(_0x54ebd4){if(_0x54ebd4){return _0x54ebd4[_0x568a('0x38')](_0x2febce)[_0x568a('0x39')](function(_0x18ed09){return _0x18ed09;});}return null;};}function removeEntity(_0x10807d,_0x4664c7){return function(_0x4b9a2a){if(_0x4b9a2a){return _0x4b9a2a[_0x568a('0x3a')]()['then'](function(){_0x10807d[_0x568a('0x2c')](0xcc)[_0x568a('0x2d')]();});}};}function handleEntityNotFound(_0x4d16ee,_0xff4d14){return function(_0x4fe52f){if(!_0x4fe52f){_0x4d16ee[_0x568a('0x2b')](0x194);}return _0x4fe52f;};}function handleError(_0x3fbd33,_0x3dabf9){_0x3dabf9=_0x3dabf9||0x1f4;return function(_0x4a982b){logger['error'](_0x4a982b[_0x568a('0x3b')]);if(_0x4a982b[_0x568a('0x3c')]){delete _0x4a982b[_0x568a('0x3c')];}_0x3fbd33[_0x568a('0x2c')](_0x3dabf9)[_0x568a('0x3d')](_0x4a982b);};}exports[_0x568a('0x3e')]=function(_0x247215,_0x57902d){var _0x52df42={},_0x2d7a88={},_0x176196={'count':0x0,'rows':[]};var _0x301a93=_['map'](db['SmsMessage'][_0x568a('0x3f')],function(_0x16742e){return{'name':_0x16742e['fieldName'],'type':_0x16742e[_0x568a('0x40')][_0x568a('0x41')]};});_0x2d7a88['model']=_[_0x568a('0x42')](_0x301a93,_0x568a('0x3c'));_0x2d7a88[_0x568a('0x43')]=_[_0x568a('0x44')](_0x247215[_0x568a('0x43')]);_0x2d7a88[_0x568a('0x45')]=_['intersection'](_0x2d7a88['model'],_0x2d7a88[_0x568a('0x43')]);_0x52df42[_0x568a('0x46')]=_[_0x568a('0x47')](_0x2d7a88[_0x568a('0x48')],qs[_0x568a('0x49')](_0x247215[_0x568a('0x43')][_0x568a('0x49')]));_0x52df42[_0x568a('0x46')]=_0x52df42['attributes'][_0x568a('0x4a')]?_0x52df42[_0x568a('0x46')]:_0x2d7a88[_0x568a('0x48')];if(!_0x247215[_0x568a('0x43')][_0x568a('0x4b')]('nolimit')){_0x52df42[_0x568a('0x31')]=qs['limit'](_0x247215[_0x568a('0x43')][_0x568a('0x31')]);_0x52df42[_0x568a('0x2f')]=qs[_0x568a('0x2f')](_0x247215[_0x568a('0x43')][_0x568a('0x2f')]);}_0x52df42[_0x568a('0x4c')]=qs['sort'](_0x247215[_0x568a('0x43')][_0x568a('0x4d')]);_0x52df42[_0x568a('0x4e')]=qs['filters'](_[_0x568a('0x4f')](_0x247215['query'],_0x2d7a88['filters']),_0x301a93);if(_0x247215[_0x568a('0x43')]['filter']){_0x52df42[_0x568a('0x4e')]=_[_0x568a('0x50')](_0x52df42['where'],{'$or':_[_0x568a('0x42')](_0x301a93,function(_0x214fb1){if(_0x214fb1[_0x568a('0x40')]!==_0x568a('0x51')){var _0x41676a={};_0x41676a[_0x214fb1['name']]={'$like':'%'+_0x247215[_0x568a('0x43')][_0x568a('0x52')]+'%'};return _0x41676a;}})});}_0x52df42=_['merge']({},_0x52df42,_0x247215[_0x568a('0x53')]);var _0x72cbbe={'where':_0x52df42[_0x568a('0x4e')]};return db[_0x568a('0x54')][_0x568a('0x32')](_0x72cbbe)[_0x568a('0x39')](function(_0x402e05){_0x176196['count']=_0x402e05;if(_0x247215[_0x568a('0x43')][_0x568a('0x55')]){_0x52df42['include']=[{'all':!![]}];}return db[_0x568a('0x54')][_0x568a('0x56')](_0x52df42);})['then'](function(_0x1e1013){_0x176196['rows']=_0x1e1013;return _0x176196;})[_0x568a('0x39')](respondWithFilteredResult(_0x57902d,_0x52df42))[_0x568a('0x2a')](handleError(_0x57902d,null));};exports[_0x568a('0x57')]=function(_0x2fc1ac,_0x3d408e){var _0x4a2f95={'raw':!![],'where':{'id':_0x2fc1ac[_0x568a('0x58')]['id']}},_0xcca49a={};_0xcca49a['model']=_[_0x568a('0x44')](db[_0x568a('0x54')][_0x568a('0x3f')]);_0xcca49a[_0x568a('0x43')]=_['keys'](_0x2fc1ac[_0x568a('0x43')]);_0xcca49a[_0x568a('0x45')]=_[_0x568a('0x47')](_0xcca49a[_0x568a('0x48')],_0xcca49a[_0x568a('0x43')]);_0x4a2f95[_0x568a('0x46')]=_[_0x568a('0x47')](_0xcca49a[_0x568a('0x48')],qs['fields'](_0x2fc1ac[_0x568a('0x43')][_0x568a('0x49')]));_0x4a2f95[_0x568a('0x46')]=_0x4a2f95[_0x568a('0x46')][_0x568a('0x4a')]?_0x4a2f95['attributes']:_0xcca49a[_0x568a('0x48')];if(_0x2fc1ac[_0x568a('0x43')][_0x568a('0x55')]){_0x4a2f95[_0x568a('0x59')]=[{'all':!![]}];}_0x4a2f95=_[_0x568a('0x50')]({},_0x4a2f95,_0x2fc1ac[_0x568a('0x53')]);return db['SmsMessage'][_0x568a('0x5a')](_0x4a2f95)[_0x568a('0x39')](handleEntityNotFound(_0x3d408e,null))[_0x568a('0x39')](respondWithResult(_0x3d408e,null))[_0x568a('0x2a')](handleError(_0x3d408e,null));};exports[_0x568a('0x5b')]=function(_0x15212b,_0x336e41){return db[_0x568a('0x54')][_0x568a('0x5b')](_0x15212b[_0x568a('0x5c')],{})[_0x568a('0x39')](respondWithResult(_0x336e41,0xc9))[_0x568a('0x2a')](handleError(_0x336e41,null));};exports[_0x568a('0x38')]=function(_0x3b27c3,_0x3ba367){if(_0x3b27c3[_0x568a('0x5c')]['id']){delete _0x3b27c3[_0x568a('0x5c')]['id'];}return db['SmsMessage'][_0x568a('0x5a')]({'where':{'id':_0x3b27c3['params']['id']}})[_0x568a('0x39')](handleEntityNotFound(_0x3ba367,null))['then'](saveUpdates(_0x3b27c3['body'],null))[_0x568a('0x39')](respondWithResult(_0x3ba367,null))['catch'](handleError(_0x3ba367,null));};exports['destroy']=function(_0x560c19,_0x4c0860){return db[_0x568a('0x54')][_0x568a('0x5a')]({'where':{'id':_0x560c19[_0x568a('0x58')]['id']}})[_0x568a('0x39')](handleEntityNotFound(_0x4c0860,null))['then'](removeEntity(_0x4c0860,null))[_0x568a('0x2a')](handleError(_0x4c0860,null));};exports[_0x568a('0x5d')]=function(_0x3bb126,_0x3894c9){return db['SmsMessage'][_0x568a('0x5d')]()[_0x568a('0x39')](respondWithResult(_0x3894c9,null))[_0x568a('0x2a')](handleError(_0x3894c9,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x568a('0x5e')]=function(_0x464507,_0x4459cd,_0x501748){var _0x58b755={'agent':{},'channel':_0x568a('0x5f')};if(_0x464507['body']['id']){delete _0x464507[_0x568a('0x5c')]['id'];}_0x464507[_0x568a('0x5c')]['read']=!![];_0x464507[_0x568a('0x5c')][_0x568a('0x60')]=moment()[_0x568a('0x61')](_0x568a('0x62'));_0x464507[_0x568a('0x5c')][_0x568a('0x63')]=_0x464507[_0x568a('0x5c')][_0x568a('0x63')]||_0x464507[_0x568a('0x64')]['id'];_0x58b755[_0x568a('0x65')]['id']=_0x464507[_0x568a('0x5c')]['UserId'];return db[_0x568a('0x54')]['find']({'where':{'id':_0x464507['params']['id'],'UserId':null}})[_0x568a('0x39')](handleEntityNotFound(_0x4459cd,null))[_0x568a('0x39')](saveUpdates(_0x464507['body'],null))['then'](function(_0x25aaa7){if(_0x25aaa7){_0x58b755['message']=_0x25aaa7['get']({'plain':!![]});return db[_0x568a('0x66')][_0x568a('0x5a')]({'where':{'id':_0x25aaa7[_0x568a('0x67')]}});}return null;})[_0x568a('0x39')](handleEntityNotFound(_0x4459cd,null))[_0x568a('0x39')](function(_0x4cd948){if(_0x4cd948){return _0x4cd948[_0x568a('0x38')]({'UserId':_0x464507['body'][_0x568a('0x63')],'read1stAt':_['isNil'](_0x4cd948[_0x568a('0x68')])?moment()[_0x568a('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x568a('0x39')](function(_0x1c1e6a){if(_0x1c1e6a){_0x58b755[_0x568a('0x69')]=_0x1c1e6a[_0x568a('0x6a')]({'plain':!![]});interaction_log['info'](_0x568a('0x6b'),_0x464507[_0x568a('0x64')]['id'],_0x464507[_0x568a('0x64')][_0x568a('0x3c')],_0x464507[_0x568a('0x64')][_0x568a('0x6c')],_0x58b755['interaction']['id'],_0x464507['body']?JSON['stringify'](_0x464507[_0x568a('0x5c')]):_0x568a('0x6d'));return respondWithRpcPromise(_0x568a('0x6e'),_0x568a('0x6f'),_0x58b755);}return null;})[_0x568a('0x39')](function(_0x5f6674){var _0x292c6f=_0x568a('0x70')+_0x5f6674[_0x568a('0x28')][_0x568a('0x71')];return db[_0x568a('0x72')][_0x568a('0x43')](_0x292c6f,{'type':db[_0x568a('0x73')]['QueryTypes'][_0x568a('0x74')],'raw':!![]})[_0x568a('0x39')](function(_0x4db258){return _0x4db258;});})['then'](function(_0x47557d){if(_0x47557d){_0x58b755[_0x568a('0x28')]['contact']=_0x47557d[0x0];if(!_0x464507[_0x568a('0x5c')][_0x568a('0x63')])return;return db['User']['find']({'where':{'id':_0x464507[_0x568a('0x5c')][_0x568a('0x63')],'role':_0x568a('0x65')},'attributes':['id',_0x568a('0x3c'),_0x568a('0x75'),_0x568a('0x76'),_0x568a('0x77')],'raw':!![]});}return null;})[_0x568a('0x39')](function(_0x112ef6){if(!_0x112ef6)return null;_0x58b755[_0x568a('0x28')][_0x568a('0x65')]=_0x112ef6;return _0x58b755;})[_0x568a('0x39')](function(_0x67ce5b){if(_0x67ce5b){if(_0x464507[_0x568a('0x5c')][_0x568a('0x78')]){_0x58b755[_0x568a('0x28')][_0x568a('0x79')]=util[_0x568a('0x61')](_0x568a('0x7a'),_0x464507[_0x568a('0x64')][_0x568a('0x3c')]);_0x58b755[_0x568a('0x28')][_0x568a('0x7b')]=_0x58b755[_0x568a('0x7b')];_0x58b755[_0x568a('0x28')]['motionChannel']=_0x58b755['channel'];_0x58b755[_0x568a('0x28')]['event']=_0x568a('0x5e');return respondWithRpcPromise(_0x568a('0x7c'),_0x568a('0x7c'),{'event':'acceptmessage','message':_0x58b755[_0x568a('0x28')]},client9002)['then'](function(){return _0x58b755;});}return _0x58b755;}return null;})[_0x568a('0x39')](respondWithResult(_0x4459cd,null))[_0x568a('0x2a')](handleError(_0x4459cd,null));};var interaction_log=require(_0x568a('0x7d'))(_0x568a('0x7e'));exports[_0x568a('0x36')]=function(_0x402b29,_0x59e3c9,_0x413109){var _0x414972={'agent':{},'channel':_0x568a('0x5f')};if(_0x402b29['body']['id']){delete _0x402b29[_0x568a('0x5c')]['id'];}_0x402b29[_0x568a('0x5c')][_0x568a('0x63')]=_0x402b29['body'][_0x568a('0x63')]||_0x402b29[_0x568a('0x64')]['id'];_0x414972['agent']['id']=_0x402b29[_0x568a('0x5c')][_0x568a('0x63')];return db[_0x568a('0x54')][_0x568a('0x5a')]({'where':{'id':_0x402b29[_0x568a('0x58')]['id'],'UserId':null}})[_0x568a('0x39')](handleEntityNotFound(_0x59e3c9,null))[_0x568a('0x39')](function(_0x95287e){if(_0x95287e){_0x414972[_0x568a('0x28')]=_0x95287e[_0x568a('0x6a')]({'plain':!![]});return db[_0x568a('0x66')][_0x568a('0x5a')]({'where':{'id':_0x95287e[_0x568a('0x67')]}});}return null;})[_0x568a('0x39')](handleEntityNotFound(_0x59e3c9,null))[_0x568a('0x39')](function(_0x4ddc3e){if(_0x4ddc3e){_0x414972[_0x568a('0x69')]=_0x4ddc3e[_0x568a('0x6a')]({'plain':!![]});interaction_log[_0x568a('0x21')](_0x568a('0x7f'),_0x402b29['user']['id'],_0x402b29[_0x568a('0x64')][_0x568a('0x3c')],_0x402b29['user'][_0x568a('0x6c')],_0x414972[_0x568a('0x69')]['id'],_0x402b29['body']?JSON['stringify'](_0x402b29[_0x568a('0x5c')]):_0x568a('0x6d'));return respondWithRpcPromise(_0x568a('0x80'),_0x568a('0x81'),_0x414972);}return null;})['then'](function(_0x3eca45){var _0x5cc4e4=_0x568a('0x70')+_0x3eca45[_0x568a('0x28')]['ContactId'];return db[_0x568a('0x72')][_0x568a('0x43')](_0x5cc4e4,{'type':db[_0x568a('0x73')][_0x568a('0x82')]['SELECT'],'raw':!![]})[_0x568a('0x39')](function(_0x49867a){return _0x49867a;});})[_0x568a('0x39')](function(_0xc4c656){if(_0xc4c656){_0x414972[_0x568a('0x28')][_0x568a('0x83')]=_0xc4c656[0x0];if(!_0x402b29[_0x568a('0x5c')][_0x568a('0x63')])return;return db[_0x568a('0x84')][_0x568a('0x5a')]({'where':{'id':_0x402b29[_0x568a('0x5c')][_0x568a('0x63')],'role':_0x568a('0x65')},'attributes':['id',_0x568a('0x3c'),_0x568a('0x75'),_0x568a('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1ef9db){if(!_0x1ef9db)return null;_0x414972[_0x568a('0x28')][_0x568a('0x65')]=_0x1ef9db;return _0x414972;})[_0x568a('0x39')](function(_0xb59d00){if(_0xb59d00){_0xb59d00[_0x568a('0x28')][_0x568a('0x79')]=util[_0x568a('0x61')](_0x568a('0x7a'),_0x402b29[_0x568a('0x64')][_0x568a('0x3c')]);_0xb59d00[_0x568a('0x28')][_0x568a('0x7b')]=_0x414972[_0x568a('0x7b')];_0xb59d00[_0x568a('0x28')][_0x568a('0x85')]=_0x414972['channel'];_0xb59d00[_0x568a('0x28')]['event']='reject';respondWithRpcPromise(_0x568a('0x7c'),'EventManager',{'event':_0x568a('0x86'),'message':_0xb59d00[_0x568a('0x28')]},client9002);return _0x414972;}return null;})[_0x568a('0x39')](respondWithResult(_0x59e3c9,null))[_0x568a('0x2a')](handleError(_0x59e3c9,null));};exports[_0x568a('0x2c')]=function(_0x57f175,_0x5520ad,_0x27cdb7){if(_0x57f175[_0x568a('0x5c')]['id']){delete _0x57f175[_0x568a('0x5c')]['id'];}var _0x3428a0;return db['SmsMessage'][_0x568a('0x5a')]({'where':{'id':_0x57f175[_0x568a('0x58')]['id']}})['then'](handleEntityNotFound(_0x5520ad,null))['then'](function(_0x5237e5){if(_0x5237e5){_0x3428a0=_0x5237e5;return db[_0x568a('0x87')][_0x568a('0x5a')]({'where':{'id':_0x5237e5[_0x568a('0x88')]}});}})['then'](handleEntityNotFound(_0x5520ad,null))[_0x568a('0x39')](function(_0x7f23a8){if(_0x7f23a8){logger['debug'](_0x568a('0x24'),_0x568a('0x2c'),'received\x20delivery\x20report\x20from',_0x7f23a8[_0x568a('0x40')],util[_0x568a('0x89')](_0x57f175[_0x568a('0x5c')],{'showHidden':![],'depth':null}));switch(_0x7f23a8[_0x568a('0x40')]){case _0x568a('0x8a'):if(_0x57f175[_0x568a('0x5c')][_0x568a('0x8b')]&&_0x57f175[_0x568a('0x5c')][_0x568a('0x8b')]===_0x3428a0['messageId']){return _0x3428a0[_0x568a('0x38')]({'read':!![]});}else{logger['error'](_0x568a('0x8c'),_0x568a('0x2c'),_0x568a('0x8a'),util[_0x568a('0x89')](_0x57f175[_0x568a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x568a('0x8d'):if(_0x57f175[_0x568a('0x5c')][_0x568a('0x8e')]&&_0x57f175[_0x568a('0x5c')][_0x568a('0x8e')]===_0x3428a0[_0x568a('0x8f')]&&_[_0x568a('0x90')]([_0x568a('0x91'),_0x568a('0x92')],_0x57f175[_0x568a('0x5c')][_0x568a('0x93')])>=0x0){return _0x3428a0[_0x568a('0x38')]({'read':!![]});}else{logger[_0x568a('0x26')](_0x568a('0x8c'),_0x568a('0x2c'),'plivio',util['inspect'](_0x57f175[_0x568a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x568a('0x94'):var _0x2cbf31=_0x57f175['body'][_0x568a('0x95')][0x0];if(_0x2cbf31['status'][_0x568a('0x96')]===_0x568a('0x97')){return _0x3428a0[_0x568a('0x38')]({'read':!![]});}else{logger[_0x568a('0x26')](_0x568a('0x8c'),_0x568a('0x2c'),_0x568a('0x94'),util['inspect'](_0x57f175[_0x568a('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x3428a0;}})['then'](respondWithResult(_0x5520ad,null))[_0x568a('0x2a')](handleError(_0x5520ad,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index feaeafb..14a2790 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 _0x1ed1=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x1ed1,0x1a5));var _0x11ed=function(_0x376f17,_0x163737){_0x376f17=_0x376f17-0x0;var _0x55929b=_0x1ed1[_0x376f17];return _0x55929b;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x11ed('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x11ed('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11ed('0x2'),'afterDestroy':_0x11ed('0x3')};function emitEvent(_0x4e71e5){return function(_0x52d566,_0x1b0c19,_0x38c77e){SmsMessageEvents[_0x11ed('0x4')](_0x4e71e5+':'+_0x52d566['id'],_0x52d566);SmsMessageEvents[_0x11ed('0x4')](_0x4e71e5,_0x52d566);_0x38c77e(null);};}for(var e in events){if(events[_0x11ed('0x5')](e)){var event=events[e];SmsMessage[_0x11ed('0x6')](e,emitEvent(event));}}module[_0x11ed('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xb999=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x2a5f1d,_0x23dbdd){var _0x2f3f4d=function(_0x1cb2ba){while(--_0x1cb2ba){_0x2a5f1d['push'](_0x2a5f1d['shift']());}};_0x2f3f4d(++_0x23dbdd);}(_0xb999,0x102));var _0x9b99=function(_0x1644e6,_0xc94242){_0x1644e6=_0x1644e6-0x0;var _0x2d2022=_0xb999[_0x1644e6];return _0x2d2022;};'use strict';var EventEmitter=require(_0x9b99('0x0'));var SmsMessage=require(_0x9b99('0x1'))['db'][_0x9b99('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9b99('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b99('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fc88e){return function(_0x56d70d,_0xcc68db,_0x5b0f56){SmsMessageEvents['emit'](_0x2fc88e+':'+_0x56d70d['id'],_0x56d70d);SmsMessageEvents[_0x9b99('0x5')](_0x2fc88e,_0x56d70d);_0x5b0f56(null);};}for(var e in events){if(events[_0x9b99('0x6')](e)){var event=events[e];SmsMessage[_0x9b99('0x7')](e,emitEvent(event));}}module[_0x9b99('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index cae3593..c066d59 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 _0x52cd=['Token\x20not\x20received','finally','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','update','out','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','split','sms','POST','user_key','session_key','internal_order_id','read','inspect','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','login','text','keys','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiKey','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','application/json','refid','status'];(function(_0x44b91b,_0x182042){var _0xfeb56b=function(_0x3db83f){while(--_0x3db83f){_0x44b91b['push'](_0x44b91b['shift']());}};_0xfeb56b(++_0x182042);}(_0x52cd,0x7d));var _0xd52c=function(_0x1cd123,_0x1eb799){_0x1cd123=_0x1cd123-0x0;var _0x1206c5=_0x52cd[_0x1cd123];return _0x1206c5;};'use strict';var _=require('lodash');var util=require(_0xd52c('0x0'));var logger=require(_0xd52c('0x1'))('api');var moment=require(_0xd52c('0x2'));var BPromise=require(_0xd52c('0x3'));var rp=require(_0xd52c('0x4'));var fs=require('fs');var path=require(_0xd52c('0x5'));var rimraf=require(_0xd52c('0x6'));var config=require(_0xd52c('0x7'));var attributes=require(_0xd52c('0x8'));module['exports']=function(_0x525683,_0x26ac65){return _0x525683[_0xd52c('0x9')]('SmsMessage',attributes,{'tableName':_0xd52c('0xa'),'paranoid':![],'indexes':[{'name':_0xd52c('0xb'),'fields':[_0xd52c('0xb')]},{'name':_0xd52c('0xc'),'fields':[_0xd52c('0xd')],'type':_0xd52c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18e97c,_0x1e9c83,_0x14fa4e){var _0x1c34fb=_0x525683['models'];var _0x55089d=_0x18e97c[_0xd52c('0xf')]({'plain':!![]});if(_0x55089d[_0xd52c('0x10')][_0xd52c('0x11')]()==='in'||_0x55089d['direction'][_0xd52c('0x11')]()==='out'&&!_0x55089d[_0xd52c('0x12')]&&!_[_0xd52c('0x13')](_0x55089d[_0xd52c('0x14')])&&!_[_0xd52c('0x13')](_0x55089d[_0xd52c('0x15')])){_0x1c34fb[_0xd52c('0x16')]['findOne']({'where':{'id':_0x55089d[_0xd52c('0x15')]}})['then'](function(_0x688fc9){if(_0x688fc9){_0x688fc9[_0xd52c('0x17')]({'lastMsgAt':_0x55089d['createdAt'],'lastMsgDirection':_0x55089d[_0xd52c('0x10')][_0xd52c('0x11')]()});}})['catch'](function(_0x398512){console['error'](_0x398512);});}if(_0x55089d[_0xd52c('0x10')]===_0xd52c('0x18')&&!_0x55089d[_0xd52c('0x12')]){var _0x2ec52b;_0x1c34fb[_0xd52c('0x19')][_0xd52c('0x1a')]({'where':{'id':_0x55089d[_0xd52c('0x1b')]},'raw':!![]})[_0xd52c('0x1c')](function(_0x525a92){_0x2ec52b=_0x525a92;if(_0x2ec52b&&_0x2ec52b[_0xd52c('0x1d')]){switch(_0x2ec52b['type']){case'twilio':var _0x1468a5=require(_0xd52c('0x1e'));if(_0x2ec52b[_0xd52c('0x1f')]&&_0x2ec52b[_0xd52c('0x20')]&&_0x2ec52b[_0xd52c('0x21')]){var _0x1f65b7=new _0x1468a5(_0x2ec52b[_0xd52c('0x1f')],_0x2ec52b[_0xd52c('0x20')]);_0x1f65b7[_0xd52c('0x22')][_0xd52c('0x23')]({'body':_0x55089d[_0xd52c('0xd')],'to':_0x55089d[_0xd52c('0x21')],'from':_0x2ec52b[_0xd52c('0x21')],'statusCallback':_0x2ec52b[_0xd52c('0x24')]+_0xd52c('0x25')+_0x55089d['id']+_0xd52c('0x26')+_0x2ec52b[_0xd52c('0x27')]})[_0xd52c('0x1c')](function(_0x588c62){if(_0x588c62['sid']){return _0x18e97c[_0xd52c('0x17')]({'messageId':_0x588c62[_0xd52c('0x28')]});}})['catch'](function(_0x234d55){logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x1e'),util['inspect'](_0x234d55,{'showHidden':![],'depth':null}));});}else{logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xd52c('0x2c'):var _0x3cea0c=_0xd52c('0x2d');if(_0x2ec52b[_0xd52c('0x2e')]&&_0x2ec52b[_0xd52c('0x2f')]){var _0x21dea2={'recipient':[_0x55089d['phone']],'message':_0x55089d[_0xd52c('0xd')],'message_type':_0x2ec52b[_0xd52c('0x30')]};if(_0x2ec52b[_0xd52c('0x30')]&&_0x2ec52b[_0xd52c('0x30')]!=='SI'){_0x21dea2[_0xd52c('0x31')]=_0x2ec52b[_0xd52c('0x21')];}var _0x3ade3e={'url':_0x3cea0c+'login?username='+_0x2ec52b[_0xd52c('0x2e')]+_0xd52c('0x32')+_0x2ec52b[_0xd52c('0x2f')],'method':'GET'};rp(_0x3ade3e)[_0xd52c('0x1c')](function(_0x1e0e4a){var _0x44c9b9=_0x1e0e4a[_0xd52c('0x33')](';');var _0x5ed655={'user_key':_0x44c9b9[0x0],'session_key':_0x44c9b9[0x1]};_0x3ade3e={'url':_0x3cea0c+_0xd52c('0x34'),'method':_0xd52c('0x35'),'headers':{'user_key':_0x5ed655[_0xd52c('0x36')],'Session_key':_0x5ed655[_0xd52c('0x37')]},'json':!![],'body':_0x21dea2};return rp(_0x3ade3e);})[_0xd52c('0x1c')](function(_0x4d9790){if(_0x4d9790['total_sent']>=0x1){var _0x3ccb60={'messageId':_0x4d9790[_0xd52c('0x38')]};if(_0x2ec52b[_0xd52c('0x30')]!=='GP'||!_0x2ec52b['deliveryReport']){_0x3ccb60[_0xd52c('0x39')]=!![];}return _0x18e97c['update'](_0x3ccb60);}else{return logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x2c'),util[_0xd52c('0x3a')](_0x4d9790,{'showHidden':![],'depth':null}));}})[_0xd52c('0x3b')](function(_0x329b03){return logger['error'](_0xd52c('0x2a'),'afterCreate',_0xd52c('0x2c'),util[_0xd52c('0x3a')](_0x329b03,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd52c('0x2b'),_0xd52c('0x2c'),_0xd52c('0x3c'));}break;case _0xd52c('0x3d'):if(_0x2ec52b['authToken']){var _0x48d285={'recipient':_0x55089d[_0xd52c('0x21')],'message':_0x55089d['body'],'sender':_0x2ec52b[_0xd52c('0x3e')]||_0x2ec52b[_0xd52c('0x21')],'authorization':_0x2ec52b['authToken']};var _0x1e9c83={'method':_0xd52c('0x35'),'uri':_0xd52c('0x3f'),'body':_0x48d285,'json':!![]};rp(_0x1e9c83)['then'](function(_0x34d23b){var _0x46d35e={'messageId':_0x34d23b['requestid']};if(!_0x2ec52b['deliveryReport']){_0x46d35e[_0xd52c('0x39')]=!![];}return _0x18e97c[_0xd52c('0x17')](_0x46d35e);})['catch'](function(_0x286124){logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),'connectel',util[_0xd52c('0x3a')](_0x286124,{'showHidden':![],'depth':null}));});}else{logger[_0xd52c('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd52c('0x2b'),_0xd52c('0x3d'),_0xd52c('0x40'));}break;case _0xd52c('0x41'):if(_0x2ec52b[_0xd52c('0x2e')]&&_0x2ec52b[_0xd52c('0x2f')]){var _0x48d285={'messages':[{'source':_0xd52c('0x42'),'to':_0x55089d[_0xd52c('0x21')],'body':_0x55089d[_0xd52c('0xd')],'from':_0x2ec52b['senderString']||_0x2ec52b[_0xd52c('0x21')]}]};var _0xfdab98=util[_0xd52c('0x43')](_0xd52c('0x44'),_0x2ec52b[_0xd52c('0x2e')],_0x2ec52b[_0xd52c('0x2f')]);var _0x1e9c83={'method':_0xd52c('0x35'),'uri':_0xd52c('0x45'),'body':_0x48d285,'headers':{'Authorization':util[_0xd52c('0x43')]('Basic\x20%s',new Buffer(_0xfdab98)[_0xd52c('0x46')]('base64'))},'json':!![]};rp(_0x1e9c83)[_0xd52c('0x1c')](function(_0x2f386a){if(_0x2f386a[_0xd52c('0x47')]>=0xc8&&_0x2f386a['http_code']<=0xce){if(_0x2f386a['data']&&_0x2f386a[_0xd52c('0x48')][_0xd52c('0x49')]>0x0){var _0x59e7e0=_[_0xd52c('0x4a')](_0x2f386a['data'][_0xd52c('0x22')]);var _0x1f0680={'messageId':_0x59e7e0[_0xd52c('0x4b')]};if(!_0x2ec52b[_0xd52c('0x4c')]){_0x1f0680[_0xd52c('0x39')]=!![];}return _0x18e97c[_0xd52c('0x17')](_0x1f0680);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd52c('0x4d'),util[_0xd52c('0x3a')](_0x2f386a,{'showHidden':![],'depth':null}));}}else{logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x4d'),util[_0xd52c('0x3a')](_0x2f386a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1bcc85){logger[_0xd52c('0x29')](_0xd52c('0x2a'),'afterCreate',_0xd52c('0x4d'),util[_0xd52c('0x3a')](_0x1bcc85,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd52c('0x2a'),'afterCreate',_0xd52c('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x2ec52b[_0xd52c('0x4e')]&&_0x2ec52b[_0xd52c('0x20')]){var _0x48d285={'dst':_0x55089d[_0xd52c('0x21')],'text':_0x55089d[_0xd52c('0xd')],'src':_0x2ec52b['senderString']||_0x2ec52b[_0xd52c('0x21')],'url':_0x2ec52b['remote']+_0xd52c('0x25')+_0x55089d['id']+_0xd52c('0x26')+_0x2ec52b[_0xd52c('0x27')]};var _0xfdab98=util[_0xd52c('0x43')](_0xd52c('0x44'),_0x2ec52b[_0xd52c('0x4e')],_0x2ec52b[_0xd52c('0x20')]);var _0x1e9c83={'method':_0xd52c('0x35'),'uri':util[_0xd52c('0x43')](_0xd52c('0x4f'),_0x2ec52b['authId']),'body':_0x48d285,'headers':{'Authorization':util[_0xd52c('0x43')](_0xd52c('0x50'),new Buffer(_0xfdab98)['toString']('base64'))},'json':!![]};rp(_0x1e9c83)[_0xd52c('0x1c')](function(_0x23bda9){var _0x50f060={'messageId':_0x23bda9[_0xd52c('0x51')][0x0]};return _0x18e97c[_0xd52c('0x17')](_0x50f060);})[_0xd52c('0x3b')](function(_0x119bfd){logger[_0xd52c('0x29')](_0xd52c('0x2a'),'afterCreate',_0xd52c('0x52'),util[_0xd52c('0x3a')](_0x119bfd,{'showHidden':![],'depth':null}));});}else{logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xd52c('0x53'):if(_0x2ec52b['username']&&_0x2ec52b['password']){if(_0x2ec52b['baseUrl']){var _0x5da0b3={'method':_0xd52c('0x35'),'uri':_0x2ec52b[_0xd52c('0x54')]+_0xd52c('0x55'),'body':{'username':_0x2ec52b['username'],'password':_0x2ec52b[_0xd52c('0x2f')]},'json':!![]};return rp(_0x5da0b3)[_0xd52c('0x1c')](function(_0x76e8bb){var _0xcc07f3={'method':_0xd52c('0x35'),'uri':_0x2ec52b[_0xd52c('0x54')]+_0xd52c('0x56'),'body':{'messages':[{'from':_0x2ec52b[_0xd52c('0x21')],'destinations':[{'to':_0x55089d['phone']}],'text':_0x55089d[_0xd52c('0xd')],'notifyUrl':_0x2ec52b[_0xd52c('0x24')]+_0xd52c('0x25')+_0x55089d['id']+'/status?token='+_0x2ec52b[_0xd52c('0x27')],'notifyContentType':'application/json','callbackData':_0x2ec52b['phone']+';'+_0x55089d[_0xd52c('0xd')]}]},'headers':{'Authorization':_0xd52c('0x57')+_0x76e8bb[_0xd52c('0x27')]},'json':!![]};return rp(_0xcc07f3)[_0xd52c('0x1c')](function(_0x2e1ccd){if(_0x2e1ccd[_0xd52c('0x22')]){var _0x58921d={'messageId':_0x2e1ccd[_0xd52c('0x22')][0x0]['messageId']};if(!_0x2ec52b[_0xd52c('0x4c')]){_0x58921d[_0xd52c('0x39')]=!![];}return _0x18e97c['update'](_0x58921d);}else{return logger[_0xd52c('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd52c('0x2b'),'infobip',util['inspect'](_0x2e1ccd,{'showHidden':![],'depth':null}));}});})[_0xd52c('0x3b')](function(_0x3ba4da){return logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),'infobip',util[_0xd52c('0x3a')](_0x3ba4da,{'showHidden':![],'depth':null}));});}else{logger[_0xd52c('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd52c('0x2b'),'infobip',_0xd52c('0x58'));}}else{logger[_0xd52c('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd52c('0x2b'),_0xd52c('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x3af519=require(_0xd52c('0x59'));if(_0x2ec52b['apiKey']){var _0x357e2b={};_0x357e2b[_0xd52c('0x5a')]=_0x2ec52b[_0xd52c('0x2e')];_0x357e2b[_0xd52c('0x21')]=_0x55089d[_0xd52c('0x21')];_0x357e2b[_0xd52c('0x31')]=_0x2ec52b['phone'];_0x357e2b[_0xd52c('0x5b')]=_0x55089d[_0xd52c('0xd')];_0x357e2b['timestamp']=+new Date();var _0x490d4e='';var _0x1c79ec='';var _0x390f62=Object[_0xd52c('0x5c')](_0x357e2b);_0x390f62[_0xd52c('0x5d')]();for(var _0xd02e3=0x0;_0xd02e3<_0x390f62[_0xd52c('0x5e')];_0xd02e3++){if(_0x490d4e!=''){_0x490d4e+='&';}_0x490d4e+=_0x390f62[_0xd02e3]+'='+encodeURIComponent(_0x357e2b[_0x390f62[_0xd02e3]]);_0x1c79ec+=_0x357e2b[_0x390f62[_0xd02e3]];}_0x1c79ec+=_0x2ec52b['apiKey'];_0x1c79ec=_0x3af519[_0xd52c('0x5f')](_0xd52c('0x60'))['update'](_0x1c79ec)['digest'](_0xd52c('0x61'));if(_0x490d4e!==''){_0x490d4e+='&';}_0x490d4e+=_0xd52c('0x62')+_0x1c79ec;var _0x3ade3e={'method':'GET','uri':_0x2ec52b['baseUrl']+_0xd52c('0x63')+_0x490d4e,'json':!![]};return rp(_0x3ade3e)['then'](function(_0xf394ed){var _0x188e1e=Object[_0xd52c('0x5c')](_0xf394ed);if(_0xf394ed[_0x188e1e[0x0]][_0xd52c('0x29')]&&parseInt(_0xf394ed[_0x188e1e[0x0]][_0xd52c('0x29')])===0x0){var _0x5dc86c={'messageId':_0xf394ed[_0x188e1e[0x0]]['id_sms']};if(!_0x2ec52b[_0xd52c('0x4c')]){_0x5dc86c[_0xd52c('0x39')]=!![];}return _0x18e97c[_0xd52c('0x17')](_0x5dc86c);}else{return logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x64'),util[_0xd52c('0x3a')](_0xf394ed[_0xd52c('0x29')],{'showHidden':![],'depth':null}));}})[_0xd52c('0x3b')](function(_0x316290){return logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x64'),util['inspect'](_0x316290,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd52c('0x2a'),'afterCreate',_0xd52c('0x64'),_0xd52c('0x65'));}break;case _0xd52c('0x66'):if(_0x2ec52b['apiKey']){var _0x400cf7={'method':_0xd52c('0x35'),'uri':_0xd52c('0x67'),'headers':{'Authorization':_0x2ec52b[_0xd52c('0x68')]},'body':{'content':_0x55089d['body'],'to':[_0x55089d[_0xd52c('0x21')]],'from':_0x2ec52b['phone'],'binary':![],'clientMessageId':_0xd52c('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x400cf7)[_0xd52c('0x1c')](function(_0x4f11e5){if(!_0x4f11e5['error']){var _0x1a74e7={'messageId':_0x4f11e5[_0xd52c('0x22')][0x0][_0xd52c('0x6a')]};if(!_0x2ec52b[_0xd52c('0x4c')]){_0x1a74e7[_0xd52c('0x39')]=!![];}return _0x18e97c[_0xd52c('0x17')](_0x1a74e7);}else{return logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),'clickatell',util[_0xd52c('0x3a')](_0x4f11e5[_0xd52c('0x29')],{'showHidden':![],'depth':null}));}})[_0xd52c('0x3b')](function(_0x14307b){return logger[_0xd52c('0x29')](_0xd52c('0x2a'),'afterCreate',_0xd52c('0x66'),util[_0xd52c('0x3a')](_0x14307b,{'showHidden':![],'depth':null}));});}else{logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),'clickatell',_0xd52c('0x65'));}break;case _0xd52c('0x6b'):if(_0x2ec52b['username']&&_0x2ec52b[_0xd52c('0x2f')]){var _0xfdab98=util[_0xd52c('0x43')](_0xd52c('0x44'),_0x2ec52b['username'],_0x2ec52b[_0xd52c('0x2f')]);var _0x1e9c83={'method':'POST','uri':_0xd52c('0x6c')+_0x2ec52b[_0xd52c('0x6d')]+_0xd52c('0x6e'),'body':{'to':[_0x55089d[_0xd52c('0x21')]],'text':_0x55089d['body'],'from':_0x2ec52b[_0xd52c('0x21')],'applicationId':_0x2ec52b[_0xd52c('0x6f')]},'headers':{'Authorization':util[_0xd52c('0x43')](_0xd52c('0x50'),new Buffer(_0xfdab98)['toString'](_0xd52c('0x70')))},'json':!![]};rp(_0x1e9c83)['then'](function(_0x399510){if(_0x399510['id']){var _0x5f05c6={'messageId':_0x399510['id']};return _0x18e97c[_0xd52c('0x17')](_0x5f05c6);}else{logger['error'](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x6b'),util[_0xd52c('0x3a')](_0x399510,{'showHidden':![],'depth':null}));}})[_0xd52c('0x3b')](function(_0x122bc9){logger[_0xd52c('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd52c('0x2b'),_0xd52c('0x6b'),util[_0xd52c('0x3a')](_0x122bc9,{'showHidden':![],'depth':null}));});}else{logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd52c('0x71'):if(_0x2ec52b[_0xd52c('0x68')]){var _0x5e61dc={};var _0x3ade3e={'method':'POST','uri':_0xd52c('0x72'),'headers':{'Authorization':_0xd52c('0x73')+_0x2ec52b[_0xd52c('0x68')],'Content-Type':'application/json'},'body':{'from':_0x2ec52b['phone'],'to':_0x55089d[_0xd52c('0x21')],'text':_0x55089d[_0xd52c('0xd')]},'json':!![]};return rp(_0x3ade3e)[_0xd52c('0x1c')](function(_0x38f7c6){if(_0x38f7c6[_0xd52c('0x74')]==0xca){_0x5e61dc[_0xd52c('0x75')]=_0x38f7c6;var _0x2a459d={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xd52c('0x73')+_0x2ec52b[_0xd52c('0x68')],'Content-Type':_0xd52c('0x76')},'body':{'refid':_0x5e61dc['message'][_0xd52c('0x77')]},'json':!![]};return rp(_0x2a459d)['then'](function(_0x1299c9){_0x5e61dc[_0xd52c('0x78')]=_0x1299c9;var _0x1b4004={'messageId':_0x5e61dc[_0xd52c('0x75')]['refid'],'read':!![]};return _0x18e97c[_0xd52c('0x17')](_0x1b4004);});}else{return logger[_0xd52c('0x29')](_0xd52c('0x2a'),'afterCreate',_0xd52c('0x71'),util[_0xd52c('0x3a')](_0x38f7c6,{'showHidden':![],'depth':null}));}})[_0xd52c('0x3b')](function(_0x4b634b){return logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),'intelepeer',util['inspect'](_0x4b634b,{'showHidden':![],'depth':null}));});}else{return logger[_0xd52c('0x29')](_0xd52c('0x2a'),_0xd52c('0x2b'),_0xd52c('0x71'),_0xd52c('0x79'));}break;}}})[_0xd52c('0x7a')](function(){_0x14fa4e();});}else{_0x14fa4e();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1b42=['application/json','IBSSO\x20','crypto','login','text','keys','length','apiKey','md5','digest','hex','id_sms','csc','clickatell','https://platform.clickatell.com/messages','apiMessageId','bandwidth','accountId','/messages','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','smsMethod','sender','login?username=','&password=','password','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','username','format','%s:%s','Basic\x20%s','toString','base64','http_code','queued_count','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session'];(function(_0x307404,_0x5a1f32){var _0xb54a5d=function(_0xaeb4f6){while(--_0xaeb4f6){_0x307404['push'](_0x307404['shift']());}};_0xb54a5d(++_0x5a1f32);}(_0x1b42,0x1dd));var _0x21b4=function(_0x47f07d,_0x195757){_0x47f07d=_0x47f07d-0x0;var _0x3fbb32=_0x1b42[_0x47f07d];return _0x3fbb32;};'use strict';var _=require('lodash');var util=require(_0x21b4('0x0'));var logger=require(_0x21b4('0x1'))(_0x21b4('0x2'));var moment=require('moment');var BPromise=require(_0x21b4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21b4('0x4'));var rimraf=require(_0x21b4('0x5'));var config=require('../../config/environment');var attributes=require(_0x21b4('0x6'));module[_0x21b4('0x7')]=function(_0x123b7f,_0x42c22d){return _0x123b7f[_0x21b4('0x8')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x21b4('0x9')]},{'name':_0x21b4('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8dc886,_0x3f1c02,_0x28965d){var _0x3d4f5d=_0x123b7f[_0x21b4('0xb')];var _0x200aec=_0x8dc886[_0x21b4('0xc')]({'plain':!![]});if(_0x200aec['direction']['toLowerCase']()==='in'||_0x200aec[_0x21b4('0xd')][_0x21b4('0xe')]()===_0x21b4('0xf')&&!_0x200aec[_0x21b4('0x10')]&&!_[_0x21b4('0x11')](_0x200aec[_0x21b4('0x12')])&&!_[_0x21b4('0x11')](_0x200aec[_0x21b4('0x13')])){_0x3d4f5d[_0x21b4('0x14')][_0x21b4('0x15')]({'where':{'id':_0x200aec[_0x21b4('0x13')]}})[_0x21b4('0x16')](function(_0x1c9055){if(_0x1c9055){_0x1c9055[_0x21b4('0x17')]({'lastMsgAt':_0x200aec[_0x21b4('0x18')],'lastMsgDirection':_0x200aec['direction'][_0x21b4('0xe')]()});}})[_0x21b4('0x19')](function(_0x230788){console[_0x21b4('0x1a')](_0x230788);});}if(_0x200aec['direction']===_0x21b4('0xf')&&!_0x200aec[_0x21b4('0x10')]){var _0x4121f1;_0x3d4f5d[_0x21b4('0x1b')]['find']({'where':{'id':_0x200aec[_0x21b4('0x1c')]},'raw':!![]})[_0x21b4('0x16')](function(_0x16b335){_0x4121f1=_0x16b335;if(_0x4121f1&&_0x4121f1[_0x21b4('0x1d')]){switch(_0x4121f1['type']){case'twilio':var _0x868f8c=require(_0x21b4('0x1e'));if(_0x4121f1[_0x21b4('0x1f')]&&_0x4121f1[_0x21b4('0x20')]&&_0x4121f1[_0x21b4('0x21')]){var _0xa21776=new _0x868f8c(_0x4121f1['accountSid'],_0x4121f1[_0x21b4('0x20')]);_0xa21776[_0x21b4('0x22')][_0x21b4('0x23')]({'body':_0x200aec[_0x21b4('0x24')],'to':_0x200aec[_0x21b4('0x21')],'from':_0x4121f1[_0x21b4('0x21')],'statusCallback':_0x4121f1[_0x21b4('0x25')]+'/api/sms/messages/'+_0x200aec['id']+'/status?token='+_0x4121f1[_0x21b4('0x26')]})['then'](function(_0x176c7d){if(_0x176c7d['sid']){return _0x8dc886[_0x21b4('0x17')]({'messageId':_0x176c7d[_0x21b4('0x27')]});}})['catch'](function(_0x27d88f){logger['error'](_0x21b4('0x28'),'afterCreate','twilio',util[_0x21b4('0x29')](_0x27d88f,{'showHidden':![],'depth':null}));});}else{logger[_0x21b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b4('0x2a'),'twilio',_0x21b4('0x2b'));}break;case _0x21b4('0x2c'):var _0x32392f='https://api.skebby.it/API/v1.0/REST/';if(_0x4121f1['username']&&_0x4121f1['password']){var _0x3312cf={'recipient':[_0x200aec[_0x21b4('0x21')]],'message':_0x200aec[_0x21b4('0x24')],'message_type':_0x4121f1[_0x21b4('0x2d')]};if(_0x4121f1[_0x21b4('0x2d')]&&_0x4121f1['smsMethod']!=='SI'){_0x3312cf[_0x21b4('0x2e')]=_0x4121f1['phone'];}var _0x3e29b2={'url':_0x32392f+_0x21b4('0x2f')+_0x4121f1['username']+_0x21b4('0x30')+_0x4121f1[_0x21b4('0x31')],'method':'GET'};rp(_0x3e29b2)[_0x21b4('0x16')](function(_0x3d9c97){var _0x520c31=_0x3d9c97['split'](';');var _0x48bf34={'user_key':_0x520c31[0x0],'session_key':_0x520c31[0x1]};_0x3e29b2={'url':_0x32392f+_0x21b4('0x32'),'method':_0x21b4('0x33'),'headers':{'user_key':_0x48bf34[_0x21b4('0x34')],'Session_key':_0x48bf34['session_key']},'json':!![],'body':_0x3312cf};return rp(_0x3e29b2);})[_0x21b4('0x16')](function(_0xfcc70c){if(_0xfcc70c[_0x21b4('0x35')]>=0x1){var _0x3c0310={'messageId':_0xfcc70c[_0x21b4('0x36')]};if(_0x4121f1['smsMethod']!=='GP'||!_0x4121f1[_0x21b4('0x37')]){_0x3c0310[_0x21b4('0x38')]=!![];}return _0x8dc886[_0x21b4('0x17')](_0x3c0310);}else{return logger[_0x21b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b4('0x2a'),_0x21b4('0x2c'),util[_0x21b4('0x29')](_0xfcc70c,{'showHidden':![],'depth':null}));}})[_0x21b4('0x19')](function(_0x167885){return logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x2c'),util['inspect'](_0x167885,{'showHidden':![],'depth':null}));});}else{logger[_0x21b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x21b4('0x2c'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x4121f1[_0x21b4('0x20')]){var _0xa63954={'recipient':_0x200aec[_0x21b4('0x21')],'message':_0x200aec['body'],'sender':_0x4121f1['senderString']||_0x4121f1[_0x21b4('0x21')],'authorization':_0x4121f1[_0x21b4('0x20')]};var _0x3f1c02={'method':_0x21b4('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xa63954,'json':!![]};rp(_0x3f1c02)[_0x21b4('0x16')](function(_0x2503b0){var _0x35785a={'messageId':_0x2503b0[_0x21b4('0x39')]};if(!_0x4121f1['deliveryReport']){_0x35785a[_0x21b4('0x38')]=!![];}return _0x8dc886[_0x21b4('0x17')](_0x35785a);})[_0x21b4('0x19')](function(_0x17293e){logger[_0x21b4('0x1a')](_0x21b4('0x28'),'afterCreate','connectel',util[_0x21b4('0x29')](_0x17293e,{'showHidden':![],'depth':null}));});}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x3a'),_0x21b4('0x3b'));}break;case _0x21b4('0x3c'):if(_0x4121f1[_0x21b4('0x3d')]&&_0x4121f1[_0x21b4('0x31')]){var _0xa63954={'messages':[{'source':'xCALLY\x20Motion','to':_0x200aec[_0x21b4('0x21')],'body':_0x200aec[_0x21b4('0x24')],'from':_0x4121f1['senderString']||_0x4121f1['phone']}]};var _0x3724d1=util[_0x21b4('0x3e')](_0x21b4('0x3f'),_0x4121f1[_0x21b4('0x3d')],_0x4121f1['password']);var _0x3f1c02={'method':_0x21b4('0x33'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xa63954,'headers':{'Authorization':util[_0x21b4('0x3e')](_0x21b4('0x40'),new Buffer(_0x3724d1)[_0x21b4('0x41')](_0x21b4('0x42')))},'json':!![]};rp(_0x3f1c02)[_0x21b4('0x16')](function(_0x565264){if(_0x565264[_0x21b4('0x43')]>=0xc8&&_0x565264[_0x21b4('0x43')]<=0xce){if(_0x565264['data']&&_0x565264['data'][_0x21b4('0x44')]>0x0){var _0x2c7e22=_['head'](_0x565264[_0x21b4('0x45')][_0x21b4('0x22')]);var _0x524fa3={'messageId':_0x2c7e22[_0x21b4('0x46')]};if(!_0x4121f1['deliveryReport']){_0x524fa3[_0x21b4('0x38')]=!![];}return _0x8dc886[_0x21b4('0x17')](_0x524fa3);}else{logger[_0x21b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x21b4('0x29')](_0x565264,{'showHidden':![],'depth':null}));}}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x47'),util[_0x21b4('0x29')](_0x565264,{'showHidden':![],'depth':null}));}})[_0x21b4('0x19')](function(_0x18d169){logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x47'),util['inspect'](_0x18d169,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x47'),_0x21b4('0x48'));}break;case _0x21b4('0x49'):if(_0x4121f1[_0x21b4('0x4a')]&&_0x4121f1[_0x21b4('0x20')]){var _0xa63954={'dst':_0x200aec[_0x21b4('0x21')],'text':_0x200aec[_0x21b4('0x24')],'src':_0x4121f1['senderString']||_0x4121f1[_0x21b4('0x21')],'url':_0x4121f1[_0x21b4('0x25')]+_0x21b4('0x4b')+_0x200aec['id']+_0x21b4('0x4c')+_0x4121f1['token']};var _0x3724d1=util[_0x21b4('0x3e')](_0x21b4('0x3f'),_0x4121f1['authId'],_0x4121f1['authToken']);var _0x3f1c02={'method':_0x21b4('0x33'),'uri':util[_0x21b4('0x3e')](_0x21b4('0x4d'),_0x4121f1[_0x21b4('0x4a')]),'body':_0xa63954,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x3724d1)[_0x21b4('0x41')]('base64'))},'json':!![]};rp(_0x3f1c02)[_0x21b4('0x16')](function(_0x5e24dd){var _0x35b148={'messageId':_0x5e24dd[_0x21b4('0x4e')][0x0]};return _0x8dc886[_0x21b4('0x17')](_0x35b148);})[_0x21b4('0x19')](function(_0x5b361e){logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x49'),util['inspect'](_0x5b361e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x21b4('0x28'),'afterCreate','plivo',_0x21b4('0x4f'));}break;case _0x21b4('0x50'):if(_0x4121f1[_0x21b4('0x3d')]&&_0x4121f1[_0x21b4('0x31')]){if(_0x4121f1[_0x21b4('0x51')]){var _0x13f240={'method':'POST','uri':_0x4121f1[_0x21b4('0x51')]+_0x21b4('0x52'),'body':{'username':_0x4121f1[_0x21b4('0x3d')],'password':_0x4121f1[_0x21b4('0x31')]},'json':!![]};return rp(_0x13f240)[_0x21b4('0x16')](function(_0x429ded){var _0xc32764={'method':_0x21b4('0x33'),'uri':_0x4121f1[_0x21b4('0x51')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4121f1[_0x21b4('0x21')],'destinations':[{'to':_0x200aec[_0x21b4('0x21')]}],'text':_0x200aec[_0x21b4('0x24')],'notifyUrl':_0x4121f1[_0x21b4('0x25')]+_0x21b4('0x4b')+_0x200aec['id']+_0x21b4('0x4c')+_0x4121f1['token'],'notifyContentType':_0x21b4('0x53'),'callbackData':_0x4121f1[_0x21b4('0x21')]+';'+_0x200aec[_0x21b4('0x24')]}]},'headers':{'Authorization':_0x21b4('0x54')+_0x429ded[_0x21b4('0x26')]},'json':!![]};return rp(_0xc32764)['then'](function(_0x46798c){if(_0x46798c[_0x21b4('0x22')]){var _0x141e23={'messageId':_0x46798c[_0x21b4('0x22')][0x0]['messageId']};if(!_0x4121f1[_0x21b4('0x37')]){_0x141e23['read']=!![];}return _0x8dc886[_0x21b4('0x17')](_0x141e23);}else{return logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x50'),util[_0x21b4('0x29')](_0x46798c,{'showHidden':![],'depth':null}));}});})[_0x21b4('0x19')](function(_0x26df76){return logger[_0x21b4('0x1a')](_0x21b4('0x28'),'afterCreate','infobip',util['inspect'](_0x26df76,{'showHidden':![],'depth':null}));});}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x50'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x50'),_0x21b4('0x48'));}break;case'csc':var _0x4473e2=require(_0x21b4('0x55'));if(_0x4121f1['apiKey']){var _0x11bc5a={};_0x11bc5a[_0x21b4('0x56')]=_0x4121f1[_0x21b4('0x3d')];_0x11bc5a[_0x21b4('0x21')]=_0x200aec[_0x21b4('0x21')];_0x11bc5a[_0x21b4('0x2e')]=_0x4121f1['phone'];_0x11bc5a[_0x21b4('0x57')]=_0x200aec['body'];_0x11bc5a['timestamp']=+new Date();var _0xf483e7='';var _0x53daeb='';var _0x366904=Object[_0x21b4('0x58')](_0x11bc5a);_0x366904['sort']();for(var _0x367d3f=0x0;_0x367d3f<_0x366904[_0x21b4('0x59')];_0x367d3f++){if(_0xf483e7!=''){_0xf483e7+='&';}_0xf483e7+=_0x366904[_0x367d3f]+'='+encodeURIComponent(_0x11bc5a[_0x366904[_0x367d3f]]);_0x53daeb+=_0x11bc5a[_0x366904[_0x367d3f]];}_0x53daeb+=_0x4121f1[_0x21b4('0x5a')];_0x53daeb=_0x4473e2['createHash'](_0x21b4('0x5b'))['update'](_0x53daeb)[_0x21b4('0x5c')](_0x21b4('0x5d'));if(_0xf483e7!==''){_0xf483e7+='&';}_0xf483e7+='signature='+_0x53daeb;var _0x3e29b2={'method':'GET','uri':_0x4121f1[_0x21b4('0x51')]+'/external/get/send.php?'+_0xf483e7,'json':!![]};return rp(_0x3e29b2)['then'](function(_0x18e55e){var _0x40dcc1=Object[_0x21b4('0x58')](_0x18e55e);if(_0x18e55e[_0x40dcc1[0x0]][_0x21b4('0x1a')]&&parseInt(_0x18e55e[_0x40dcc1[0x0]][_0x21b4('0x1a')])===0x0){var _0x2884ce={'messageId':_0x18e55e[_0x40dcc1[0x0]][_0x21b4('0x5e')]};if(!_0x4121f1[_0x21b4('0x37')]){_0x2884ce['read']=!![];}return _0x8dc886['update'](_0x2884ce);}else{return logger[_0x21b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b4('0x2a'),_0x21b4('0x5f'),util[_0x21b4('0x29')](_0x18e55e[_0x21b4('0x1a')],{'showHidden':![],'depth':null}));}})[_0x21b4('0x19')](function(_0x12c045){return logger[_0x21b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b4('0x2a'),'csc',util['inspect'](_0x12c045,{'showHidden':![],'depth':null}));});}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case _0x21b4('0x60'):if(_0x4121f1[_0x21b4('0x5a')]){var _0x37ebf6={'method':_0x21b4('0x33'),'uri':_0x21b4('0x61'),'headers':{'Authorization':_0x4121f1[_0x21b4('0x5a')]},'body':{'content':_0x200aec['body'],'to':[_0x200aec[_0x21b4('0x21')]],'from':_0x4121f1['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x37ebf6)[_0x21b4('0x16')](function(_0x174116){if(!_0x174116[_0x21b4('0x1a')]){var _0x55387f={'messageId':_0x174116[_0x21b4('0x22')][0x0][_0x21b4('0x62')]};if(!_0x4121f1[_0x21b4('0x37')]){_0x55387f['read']=!![];}return _0x8dc886[_0x21b4('0x17')](_0x55387f);}else{return logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x60'),util[_0x21b4('0x29')](_0x174116['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x269034){return logger[_0x21b4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b4('0x2a'),_0x21b4('0x60'),util[_0x21b4('0x29')](_0x269034,{'showHidden':![],'depth':null}));});}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x21b4('0x63'):if(_0x4121f1['username']&&_0x4121f1[_0x21b4('0x31')]){var _0x3724d1=util[_0x21b4('0x3e')](_0x21b4('0x3f'),_0x4121f1['username'],_0x4121f1[_0x21b4('0x31')]);var _0x3f1c02={'method':_0x21b4('0x33'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x4121f1[_0x21b4('0x64')]+_0x21b4('0x65'),'body':{'to':[_0x200aec[_0x21b4('0x21')]],'text':_0x200aec[_0x21b4('0x24')],'from':_0x4121f1[_0x21b4('0x21')],'applicationId':_0x4121f1['applicationId']},'headers':{'Authorization':util[_0x21b4('0x3e')](_0x21b4('0x40'),new Buffer(_0x3724d1)[_0x21b4('0x41')](_0x21b4('0x42')))},'json':!![]};rp(_0x3f1c02)[_0x21b4('0x16')](function(_0x4f8b4c){if(_0x4f8b4c['id']){var _0x1ea522={'messageId':_0x4f8b4c['id']};return _0x8dc886[_0x21b4('0x17')](_0x1ea522);}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x63'),util['inspect'](_0x4f8b4c,{'showHidden':![],'depth':null}));}})[_0x21b4('0x19')](function(_0x168960){logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x63'),util['inspect'](_0x168960,{'showHidden':![],'depth':null}));});}else{logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x63'),_0x21b4('0x48'));}break;case'intelepeer':if(_0x4121f1[_0x21b4('0x5a')]){var _0x283810={};var _0x3e29b2={'method':_0x21b4('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x21b4('0x66')+_0x4121f1['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x4121f1['phone'],'to':_0x200aec[_0x21b4('0x21')],'text':_0x200aec[_0x21b4('0x24')]},'json':!![]};return rp(_0x3e29b2)['then'](function(_0xd9de5a){if(_0xd9de5a[_0x21b4('0x67')]==0xca){_0x283810[_0x21b4('0x68')]=_0xd9de5a;var _0x5868e={'method':_0x21b4('0x33'),'uri':_0x21b4('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x4121f1[_0x21b4('0x5a')],'Content-Type':_0x21b4('0x53')},'body':{'refid':_0x283810[_0x21b4('0x68')][_0x21b4('0x6a')]},'json':!![]};return rp(_0x5868e)[_0x21b4('0x16')](function(_0x35e2ae){_0x283810[_0x21b4('0x6b')]=_0x35e2ae;var _0x2cf4be={'messageId':_0x283810[_0x21b4('0x68')][_0x21b4('0x6a')],'read':!![]};return _0x8dc886[_0x21b4('0x17')](_0x2cf4be);});}else{return logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x6c'),util[_0x21b4('0x29')](_0xd9de5a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x142292){return logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),_0x21b4('0x6c'),util['inspect'](_0x142292,{'showHidden':![],'depth':null}));});}else{return logger[_0x21b4('0x1a')](_0x21b4('0x28'),_0x21b4('0x2a'),'intelepeer',_0x21b4('0x6d'));}break;}}})[_0x21b4('0x6e')](function(){_0x28965d();});}else{_0x28965d();}}},'charset':'utf8mb4','collate':_0x21b4('0x6f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d03a7e3..079a7c0 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 _0x3f31=['SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','register','then','info'];(function(_0x2245d4,_0x4478d5){var _0x2c8df9=function(_0x411eec){while(--_0x411eec){_0x2245d4['push'](_0x2245d4['shift']());}};_0x2c8df9(++_0x4478d5);}(_0x3f31,0xe1));var _0x13f3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3f31[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x13f3('0x0'));var util=require('util');var moment=require(_0x13f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x13f3('0x2'));var fs=require('fs');var Redis=require(_0x13f3('0x3'));var db=require(_0x13f3('0x4'))['db'];var utils=require(_0x13f3('0x5'));var logger=require(_0x13f3('0x6'))(_0x13f3('0x7'));var config=require('../../config/environment');var jayson=require(_0x13f3('0x8'));var client=jayson['client'][_0x13f3('0x9')]({'port':0x232a});config[_0x13f3('0xa')]=_['defaults'](config[_0x13f3('0xa')],{'host':_0x13f3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x13f3('0xc')](socket);function respondWithRpcPromise(_0x448adf,_0x2666dd,_0x564659){return new BPromise(function(_0x5f1e37,_0x3ae4fd){return client['request'](_0x448adf,_0x564659)[_0x13f3('0xd')](function(_0x2d69bf){logger[_0x13f3('0xe')](_0x13f3('0xf'),_0x2666dd,_0x13f3('0x10'));logger[_0x13f3('0x11')](_0x13f3('0x12'),_0x2666dd,_0x13f3('0x10'),JSON[_0x13f3('0x13')](_0x2d69bf));if(_0x2d69bf[_0x13f3('0x14')]){if(_0x2d69bf['error']['code']===0x1f4){logger['error'](_0x13f3('0xf'),_0x2666dd,_0x2d69bf[_0x13f3('0x14')][_0x13f3('0x15')]);return _0x3ae4fd(_0x2d69bf[_0x13f3('0x14')][_0x13f3('0x15')]);}logger[_0x13f3('0x14')](_0x13f3('0xf'),_0x2666dd,_0x2d69bf[_0x13f3('0x14')][_0x13f3('0x15')]);return _0x5f1e37(_0x2d69bf[_0x13f3('0x14')]['message']);}else{logger['info'](_0x13f3('0xf'),_0x2666dd,_0x13f3('0x10'));_0x5f1e37(_0x2d69bf[_0x13f3('0x16')][_0x13f3('0x15')]);}})[_0x13f3('0x17')](function(_0x57e456){logger[_0x13f3('0x14')](_0x13f3('0xf'),_0x2666dd,_0x57e456);_0x3ae4fd(_0x57e456);});});}exports['CreateSmsMessage']=function(_0x321ab1){var _0x3196b2=this;return new Promise(function(_0x1a094c,_0x408056){return db[_0x13f3('0x18')][_0x13f3('0x19')](_0x321ab1[_0x13f3('0x1a')],{'raw':_0x321ab1[_0x13f3('0x1b')]?_0x321ab1[_0x13f3('0x1b')][_0x13f3('0x1c')]===undefined?!![]:![]:!![]})[_0x13f3('0xd')](function(_0x4efeb9){logger['info'](_0x13f3('0x1d'),_0x321ab1);logger[_0x13f3('0x11')](_0x13f3('0x1d'),_0x321ab1,JSON[_0x13f3('0x13')](_0x4efeb9));_0x1a094c(_0x4efeb9);})[_0x13f3('0x17')](function(_0xa2c4c8){logger['error'](_0x13f3('0x1d'),_0xa2c4c8[_0x13f3('0x15')],_0x321ab1);_0x408056(_0x3196b2[_0x13f3('0x14')](0x1f4,_0xa2c4c8[_0x13f3('0x15')]));});});}; \ No newline at end of file +var _0x647f=['SmsMessage','options','raw','CreateSmsMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message'];(function(_0x19d059,_0x2c3324){var _0x28b4df=function(_0x550161){while(--_0x550161){_0x19d059['push'](_0x19d059['shift']());}};_0x28b4df(++_0x2c3324);}(_0x647f,0x1e5));var _0xf647=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x647f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf647('0x0'));var util=require(_0xf647('0x1'));var moment=require(_0xf647('0x2'));var BPromise=require(_0xf647('0x3'));var rs=require(_0xf647('0x4'));var fs=require('fs');var Redis=require(_0xf647('0x5'));var db=require(_0xf647('0x6'))['db'];var utils=require(_0xf647('0x7'));var logger=require(_0xf647('0x8'))(_0xf647('0x9'));var config=require(_0xf647('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf647('0xb')][_0xf647('0xc')]({'port':0x232a});config[_0xf647('0xd')]=_[_0xf647('0xe')](config[_0xf647('0xd')],{'host':_0xf647('0xf'),'port':0x18eb});var socket=require(_0xf647('0x10'))(new Redis(config['redis']));require(_0xf647('0x11'))[_0xf647('0x12')](socket);function respondWithRpcPromise(_0x5a4986,_0x2bebbb,_0x3ff027){return new BPromise(function(_0x15b03f,_0x185d27){return client['request'](_0x5a4986,_0x3ff027)['then'](function(_0xd6544d){logger[_0xf647('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2bebbb,_0xf647('0x14'));logger[_0xf647('0x15')](_0xf647('0x16'),_0x2bebbb,'request\x20sent',JSON['stringify'](_0xd6544d));if(_0xd6544d[_0xf647('0x17')]){if(_0xd6544d[_0xf647('0x17')][_0xf647('0x18')]===0x1f4){logger[_0xf647('0x17')](_0xf647('0x19'),_0x2bebbb,_0xd6544d[_0xf647('0x17')]['message']);return _0x185d27(_0xd6544d[_0xf647('0x17')][_0xf647('0x1a')]);}logger[_0xf647('0x17')](_0xf647('0x19'),_0x2bebbb,_0xd6544d[_0xf647('0x17')][_0xf647('0x1a')]);return _0x15b03f(_0xd6544d[_0xf647('0x17')]['message']);}else{logger['info'](_0xf647('0x19'),_0x2bebbb,_0xf647('0x14'));_0x15b03f(_0xd6544d['result'][_0xf647('0x1a')]);}})['catch'](function(_0x274039){logger[_0xf647('0x17')](_0xf647('0x19'),_0x2bebbb,_0x274039);_0x185d27(_0x274039);});});}exports['CreateSmsMessage']=function(_0x2023c1){var _0x1f775d=this;return new Promise(function(_0x34636a,_0x2917a2){return db[_0xf647('0x1b')]['create'](_0x2023c1['body'],{'raw':_0x2023c1[_0xf647('0x1c')]?_0x2023c1[_0xf647('0x1c')][_0xf647('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5f2d0f){logger[_0xf647('0x13')](_0xf647('0x1e'),_0x2023c1);logger[_0xf647('0x15')]('CreateSmsMessage',_0x2023c1,JSON['stringify'](_0x5f2d0f));_0x34636a(_0x5f2d0f);})[_0xf647('0x1f')](function(_0x3d9df0){logger[_0xf647('0x17')](_0xf647('0x1e'),_0x3d9df0[_0xf647('0x1a')],_0x2023c1);_0x2917a2(_0x1f775d[_0xf647('0x17')](0x1f4,_0x3d9df0[_0xf647('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 080785d..e602bd7 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 _0x0a66=['removeListener','register','./smsMessage.events','remove','update','emit'];(function(_0x5e9b5c,_0x576060){var _0x125d63=function(_0x1a8286){while(--_0x1a8286){_0x5e9b5c['push'](_0x5e9b5c['shift']());}};_0x125d63(++_0x576060);}(_0x0a66,0x8c));var _0x60a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a66[_0x20a584];return _0x4b41a8;};'use strict';var SmsMessageEvents=require(_0x60a6('0x0'));var events=['save',_0x60a6('0x1'),_0x60a6('0x2')];function createListener(_0x139b7d,_0x16e743){return function(_0x20c663){_0x16e743[_0x60a6('0x3')](_0x139b7d,_0x20c663);};}function removeListener(_0x3eddf8,_0xa367db){return function(){SmsMessageEvents[_0x60a6('0x4')](_0x3eddf8,_0xa367db);};}exports[_0x60a6('0x5')]=function(_0x38d1bc){for(var _0x306855=0x0,_0x440720=events['length'];_0x306855<_0x440720;_0x306855++){var _0x5ba218=events[_0x306855];var _0x1651cc=createListener('smsMessage:'+_0x5ba218,_0x38d1bc);SmsMessageEvents['on'](_0x5ba218,_0x1651cc);}}; \ No newline at end of file +var _0x2891=['remove','update','emit','length','./smsMessage.events','save'];(function(_0x2069dc,_0x456e5a){var _0x304430=function(_0x434cd4){while(--_0x434cd4){_0x2069dc['push'](_0x2069dc['shift']());}};_0x304430(++_0x456e5a);}(_0x2891,0x94));var _0x1289=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x2891[_0x9df060];return _0x338dfe;};'use strict';var SmsMessageEvents=require(_0x1289('0x0'));var events=[_0x1289('0x1'),_0x1289('0x2'),_0x1289('0x3')];function createListener(_0x254d34,_0x3e21d6){return function(_0x2c66e4){_0x3e21d6[_0x1289('0x4')](_0x254d34,_0x2c66e4);};}function removeListener(_0x5d7b8e,_0x592e04){return function(){SmsMessageEvents['removeListener'](_0x5d7b8e,_0x592e04);};}exports['register']=function(_0x28f190){for(var _0x29e7de=0x0,_0x2f2dc1=events[_0x1289('0x5')];_0x29e7de<_0x2f2dc1;_0x29e7de++){var _0x52dbc2=events[_0x29e7de];var _0x531927=createListener('smsMessage:'+_0x52dbc2,_0x28f190);SmsMessageEvents['on'](_0x52dbc2,_0x531927);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a36d4d5..0b1084c 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 _0x1ef0=['/describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get'];(function(_0x36861a,_0x582850){var _0x16b7d4=function(_0x5da848){while(--_0x5da848){_0x36861a['push'](_0x36861a['shift']());}};_0x16b7d4(++_0x582850);}(_0x1ef0,0x13e));var _0x01ef=function(_0x276d10,_0x435d5f){_0x276d10=_0x276d10-0x0;var _0x56f291=_0x1ef0[_0x276d10];return _0x56f291;};'use strict';var multer=require(_0x01ef('0x0'));var util=require('util');var path=require(_0x01ef('0x1'));var timeout=require(_0x01ef('0x2'));var express=require(_0x01ef('0x3'));var router=express[_0x01ef('0x4')]();var fs_extra=require(_0x01ef('0x5'));var auth=require(_0x01ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x01ef('0x7'));var controller=require(_0x01ef('0x8'));router['get']('/',auth[_0x01ef('0x9')](),controller[_0x01ef('0xa')]);router[_0x01ef('0xb')](_0x01ef('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x01ef('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x01ef('0xd')]);router['get']('/:id/members',auth[_0x01ef('0x9')](),controller[_0x01ef('0xe')]);router['get'](_0x01ef('0xf'),auth[_0x01ef('0x9')](),controller[_0x01ef('0x10')]);router[_0x01ef('0xb')](_0x01ef('0x11'),auth[_0x01ef('0x9')](),controller[_0x01ef('0x12')]);router[_0x01ef('0x13')]('/',auth[_0x01ef('0x9')](),controller[_0x01ef('0x14')]);router[_0x01ef('0x13')](_0x01ef('0xf'),auth[_0x01ef('0x9')](),controller[_0x01ef('0x15')]);router[_0x01ef('0x13')](_0x01ef('0x11'),auth[_0x01ef('0x9')](),controller[_0x01ef('0x16')]);router[_0x01ef('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x01ef('0x18')](_0x01ef('0x19'),auth[_0x01ef('0x9')](),controller[_0x01ef('0x1a')]);router[_0x01ef('0x18')](_0x01ef('0xf'),auth[_0x01ef('0x9')](),controller[_0x01ef('0x1b')]);router['delete'](_0x01ef('0x11'),auth[_0x01ef('0x9')](),controller[_0x01ef('0x1c')]);module[_0x01ef('0x1d')]=router; \ No newline at end of file +var _0x2dc0=['delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','fs-extra','./smsQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update'];(function(_0x937998,_0x58c26){var _0x4b0ffe=function(_0x4ce3d8){while(--_0x4ce3d8){_0x937998['push'](_0x937998['shift']());}};_0x4b0ffe(++_0x58c26);}(_0x2dc0,0xef));var _0x02dc=function(_0x1b685f,_0x298a87){_0x1b685f=_0x1b685f-0x0;var _0x50d20e=_0x2dc0[_0x1b685f];return _0x50d20e;};'use strict';var multer=require(_0x02dc('0x0'));var util=require(_0x02dc('0x1'));var path=require('path');var timeout=require(_0x02dc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x02dc('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x02dc('0x4'));router[_0x02dc('0x5')]('/',auth[_0x02dc('0x6')](),controller['index']);router[_0x02dc('0x5')](_0x02dc('0x7'),auth[_0x02dc('0x6')](),controller['describe']);router['get'](_0x02dc('0x8'),auth['isAuthenticated'](),controller[_0x02dc('0x9')]);router[_0x02dc('0x5')](_0x02dc('0xa'),auth[_0x02dc('0x6')](),controller[_0x02dc('0xb')]);router[_0x02dc('0x5')](_0x02dc('0xc'),auth[_0x02dc('0x6')](),controller[_0x02dc('0xd')]);router['get'](_0x02dc('0xe'),auth[_0x02dc('0x6')](),controller['getAgents']);router[_0x02dc('0xf')]('/',auth[_0x02dc('0x6')](),controller[_0x02dc('0x10')]);router[_0x02dc('0xf')](_0x02dc('0xc'),auth[_0x02dc('0x6')](),controller[_0x02dc('0x11')]);router['post'](_0x02dc('0xe'),auth[_0x02dc('0x6')](),controller[_0x02dc('0x12')]);router[_0x02dc('0x13')](_0x02dc('0x8'),auth['isAuthenticated'](),controller[_0x02dc('0x14')]);router[_0x02dc('0x15')](_0x02dc('0x8'),auth['isAuthenticated'](),controller[_0x02dc('0x16')]);router[_0x02dc('0x15')](_0x02dc('0xc'),auth[_0x02dc('0x6')](),controller[_0x02dc('0x17')]);router[_0x02dc('0x15')](_0x02dc('0xe'),auth[_0x02dc('0x6')](),controller[_0x02dc('0x18')]);module[_0x02dc('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9d7c983..2ee94d7 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 _0x3a8e=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3a8e,0x112));var _0xe3a8=function(_0x1993a8,_0xd34e39){_0x1993a8=_0x1993a8-0x0;var _0x353428=_0x3a8e[_0x1993a8];return _0x353428;};'use strict';var Sequelize=require(_0xe3a8('0x0'));module[_0xe3a8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe3a8('0x2')](_0xe3a8('0x3'),_0xe3a8('0x4'),_0xe3a8('0x5'))}}; \ No newline at end of file +var _0xb54e=['beepall','roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xb54e,0x1d0));var _0xeb54=function(_0x5e1e77,_0x1b1221){_0x5e1e77=_0x5e1e77-0x0;var _0x3c832c=_0xb54e[_0x5e1e77];return _0x3c832c;};'use strict';var Sequelize=require(_0xeb54('0x0'));module[_0xeb54('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xeb54('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xeb54('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeb54('0x4')]('rrmemory',_0xeb54('0x5'),_0xeb54('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 175feea..c8414fe 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 _0x19e7=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','params','UserSmsQueue','length','SmsQueueId','options','UserId','agent','smsPause','updatedAt','rows','format','SIP','createdAt','Team','getTeams','addTeams','ids','findAll','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','field','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','sequelize','SELECT','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','defaults','socket.io-emitter','redis','./smsQueue.socket','register','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','SmsQueue','catch','includeAll','find','create','body','user'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x19e7,0xc8));var _0x719e=function(_0x222a4b,_0x1dc16c){_0x222a4b=_0x222a4b-0x0;var _0x59355f=_0x19e7[_0x222a4b];return _0x59355f;};'use strict';var emlformat=require(_0x719e('0x0'));var rimraf=require(_0x719e('0x1'));var zipdir=require(_0x719e('0x2'));var jsonpatch=require(_0x719e('0x3'));var rp=require(_0x719e('0x4'));var moment=require(_0x719e('0x5'));var BPromise=require(_0x719e('0x6'));var Mustache=require(_0x719e('0x7'));var util=require(_0x719e('0x8'));var path=require(_0x719e('0x9'));var sox=require(_0x719e('0xa'));var csv=require(_0x719e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x719e('0xc'));var squel=require(_0x719e('0xd'));var crypto=require('crypto');var jsforce=require(_0x719e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x719e('0xb'));var querystring=require(_0x719e('0xf'));var Papa=require(_0x719e('0x10'));var Redis=require(_0x719e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x719e('0x12'));var as=require(_0x719e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x719e('0x14'));var utils=require(_0x719e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x719e('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x719e('0x17'))(new Redis(config[_0x719e('0x18')]));require(_0x719e('0x19'))[_0x719e('0x1a')](socket);function respondWithStatusCode(_0x2cc32b,_0x57b30a){_0x57b30a=_0x57b30a||0xcc;return function(_0x34f845){if(_0x34f845){return _0x2cc32b['sendStatus'](_0x57b30a);}return _0x2cc32b[_0x719e('0x1b')](_0x57b30a)[_0x719e('0x1c')]();};}function respondWithResult(_0x241f11,_0x5908ca){_0x5908ca=_0x5908ca||0xc8;return function(_0x1d620f){if(_0x1d620f){return _0x241f11['status'](_0x5908ca)['json'](_0x1d620f);}};}function respondWithFilteredResult(_0x5d3c72,_0x57f802){return function(_0x2b3b8b){if(_0x2b3b8b){var _0x49541a=typeof _0x57f802[_0x719e('0x1d')]===_0x719e('0x1e')&&typeof _0x57f802[_0x719e('0x1f')]===_0x719e('0x1e');var _0x566321=_0x2b3b8b['count'];var _0x486c9e=_0x49541a?0x0:_0x57f802[_0x719e('0x1d')];var _0x1079ac=_0x49541a?_0x2b3b8b[_0x719e('0x20')]:_0x57f802[_0x719e('0x1d')]+_0x57f802[_0x719e('0x1f')];var _0x4e9529;if(_0x1079ac>=_0x566321){_0x1079ac=_0x566321;_0x4e9529=0xc8;}else{_0x4e9529=0xce;}_0x5d3c72[_0x719e('0x1b')](_0x4e9529);return _0x5d3c72[_0x719e('0x21')]('Content-Range',_0x486c9e+'-'+_0x1079ac+'/'+_0x566321)[_0x719e('0x22')](_0x2b3b8b);}return null;};}function patchUpdates(_0x57721a){return function(_0x41ebe4){try{jsonpatch[_0x719e('0x23')](_0x41ebe4,_0x57721a,!![]);}catch(_0x5c75e8){return BPromise[_0x719e('0x24')](_0x5c75e8);}return _0x41ebe4[_0x719e('0x25')]();};}function saveUpdates(_0x14e175,_0x24408a){return function(_0x114d87){if(_0x114d87){return _0x114d87[_0x719e('0x26')](_0x14e175)['then'](function(_0x259d40){return _0x259d40;});}return null;};}function removeEntity(_0x43cd78,_0xcbfd9d){return function(_0x256a79){if(_0x256a79){return _0x256a79[_0x719e('0x27')]()[_0x719e('0x28')](function(){var _0x4cac20=_0x256a79['get']({'plain':!![]});var _0x3966ff='SmsQueues';return db[_0x719e('0x29')]['destroy']({'where':{'type':_0x3966ff,'resourceId':_0x4cac20['id']}})[_0x719e('0x28')](function(){return _0x256a79;});})['then'](function(){_0x43cd78[_0x719e('0x1b')](0xcc)[_0x719e('0x1c')]();});}};}function handleEntityNotFound(_0x275496,_0x442e2d){return function(_0x5a4386){if(!_0x5a4386){_0x275496[_0x719e('0x2a')](0x194);}return _0x5a4386;};}function handleError(_0x11f103,_0x2a7628){_0x2a7628=_0x2a7628||0x1f4;return function(_0x49c8ff){logger[_0x719e('0x2b')](_0x49c8ff[_0x719e('0x2c')]);if(_0x49c8ff[_0x719e('0x2d')]){delete _0x49c8ff[_0x719e('0x2d')];}_0x11f103['status'](_0x2a7628)['send'](_0x49c8ff);};}exports[_0x719e('0x2e')]=function(_0x22ec30,_0x4ec514){var _0x449458={},_0x221fd3={},_0x11d6d2={'count':0x0,'rows':[]};var _0x4815bc=_[_0x719e('0x2f')](db['SmsQueue'][_0x719e('0x30')],function(_0x10869b){return{'name':_0x10869b['fieldName'],'type':_0x10869b['type'][_0x719e('0x31')]};});_0x221fd3[_0x719e('0x32')]=_['map'](_0x4815bc,'name');_0x221fd3['query']=_[_0x719e('0x33')](_0x22ec30[_0x719e('0x34')]);_0x221fd3['filters']=_[_0x719e('0x35')](_0x221fd3['model'],_0x221fd3[_0x719e('0x34')]);_0x449458[_0x719e('0x36')]=_['intersection'](_0x221fd3[_0x719e('0x32')],qs[_0x719e('0x37')](_0x22ec30[_0x719e('0x34')][_0x719e('0x37')]));_0x449458[_0x719e('0x36')]=_0x449458['attributes']['length']?_0x449458[_0x719e('0x36')]:_0x221fd3['model'];if(!_0x22ec30[_0x719e('0x34')][_0x719e('0x38')](_0x719e('0x39'))){_0x449458['limit']=qs[_0x719e('0x1f')](_0x22ec30[_0x719e('0x34')][_0x719e('0x1f')]);_0x449458[_0x719e('0x1d')]=qs[_0x719e('0x1d')](_0x22ec30['query'][_0x719e('0x1d')]);}_0x449458[_0x719e('0x3a')]=qs[_0x719e('0x3b')](_0x22ec30['query'][_0x719e('0x3b')]);_0x449458[_0x719e('0x3c')]=qs[_0x719e('0x3d')](_[_0x719e('0x3e')](_0x22ec30[_0x719e('0x34')],_0x221fd3['filters']),_0x4815bc);if(_0x22ec30['query']['filter']){_0x449458['where']=_[_0x719e('0x3f')](_0x449458[_0x719e('0x3c')],{'$or':_['map'](_0x4815bc,function(_0x2edc59){if(_0x2edc59[_0x719e('0x40')]!==_0x719e('0x41')){var _0x4a0992={};_0x4a0992[_0x2edc59[_0x719e('0x2d')]]={'$like':'%'+_0x22ec30[_0x719e('0x34')][_0x719e('0x42')]+'%'};return _0x4a0992;}})});}_0x449458=_['merge']({},_0x449458,_0x22ec30['options']);var _0x3efb9e={'where':_0x449458[_0x719e('0x3c')]};return db[_0x719e('0x43')][_0x719e('0x20')](_0x3efb9e)['then'](function(_0x59f755){_0x11d6d2[_0x719e('0x20')]=_0x59f755;if(_0x22ec30[_0x719e('0x34')]['includeAll']){_0x449458['include']=[{'all':!![]}];}return db[_0x719e('0x43')]['findAll'](_0x449458);})[_0x719e('0x28')](function(_0x52e5b2){_0x11d6d2['rows']=_0x52e5b2;return _0x11d6d2;})[_0x719e('0x28')](respondWithFilteredResult(_0x4ec514,_0x449458))[_0x719e('0x44')](handleError(_0x4ec514,null));};exports['show']=function(_0x3dee20,_0x2be390){var _0xf70c1b={'raw':!![],'where':{'id':_0x3dee20['params']['id']}},_0x1479b6={};_0x1479b6['model']=_[_0x719e('0x33')](db['SmsQueue'][_0x719e('0x30')]);_0x1479b6[_0x719e('0x34')]=_[_0x719e('0x33')](_0x3dee20[_0x719e('0x34')]);_0x1479b6[_0x719e('0x3d')]=_[_0x719e('0x35')](_0x1479b6[_0x719e('0x32')],_0x1479b6[_0x719e('0x34')]);_0xf70c1b['attributes']=_[_0x719e('0x35')](_0x1479b6[_0x719e('0x32')],qs['fields'](_0x3dee20[_0x719e('0x34')][_0x719e('0x37')]));_0xf70c1b[_0x719e('0x36')]=_0xf70c1b[_0x719e('0x36')]['length']?_0xf70c1b['attributes']:_0x1479b6[_0x719e('0x32')];if(_0x3dee20[_0x719e('0x34')][_0x719e('0x45')]){_0xf70c1b['include']=[{'all':!![]}];}_0xf70c1b=_[_0x719e('0x3f')]({},_0xf70c1b,_0x3dee20['options']);return db[_0x719e('0x43')][_0x719e('0x46')](_0xf70c1b)[_0x719e('0x28')](handleEntityNotFound(_0x2be390,null))[_0x719e('0x28')](respondWithResult(_0x2be390,null))[_0x719e('0x44')](handleError(_0x2be390,null));};exports[_0x719e('0x47')]=function(_0x39cab9,_0x17e0c9){return db['SmsQueue'][_0x719e('0x47')](_0x39cab9[_0x719e('0x48')],{})['then'](function(_0x6edecc){var _0x56db42=_0x39cab9[_0x719e('0x49')][_0x719e('0x4a')]({'plain':!![]});if(!_0x56db42)throw new Error(_0x719e('0x4b'));if(_0x56db42[_0x719e('0x4c')]===_0x719e('0x49')){var _0x1e87c9=_0x6edecc[_0x719e('0x4a')]({'plain':!![]});var _0x34f76c=_0x719e('0x4d');return db[_0x719e('0x4e')][_0x719e('0x46')]({'where':{'name':_0x34f76c,'userProfileId':_0x56db42[_0x719e('0x4f')]},'raw':!![]})[_0x719e('0x28')](function(_0x2a1f52){if(_0x2a1f52&&_0x2a1f52[_0x719e('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e87c9[_0x719e('0x2d')],'resourceId':_0x1e87c9['id'],'type':_0x2a1f52['name'],'sectionId':_0x2a1f52['id']},{})['then'](function(){return _0x6edecc;});}else{return _0x6edecc;}})[_0x719e('0x44')](function(_0x52f59d){logger[_0x719e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52f59d);throw _0x52f59d;});}return _0x6edecc;})[_0x719e('0x28')](respondWithResult(_0x17e0c9,0xc9))[_0x719e('0x44')](handleError(_0x17e0c9,null));};exports['update']=function(_0x2de5b1,_0x9eee2d){if(_0x2de5b1[_0x719e('0x48')]['id']){delete _0x2de5b1['body']['id'];}return db[_0x719e('0x43')][_0x719e('0x46')]({'where':{'id':_0x2de5b1['params']['id']}})[_0x719e('0x28')](handleEntityNotFound(_0x9eee2d,null))[_0x719e('0x28')](saveUpdates(_0x2de5b1[_0x719e('0x48')],null))['then'](respondWithResult(_0x9eee2d,null))[_0x719e('0x44')](handleError(_0x9eee2d,null));};exports[_0x719e('0x27')]=function(_0x37c77c,_0x44e2c5){return db[_0x719e('0x43')][_0x719e('0x46')]({'where':{'id':_0x37c77c['params']['id']}})[_0x719e('0x28')](handleEntityNotFound(_0x44e2c5,null))[_0x719e('0x28')](removeEntity(_0x44e2c5,null))[_0x719e('0x44')](handleError(_0x44e2c5,null));};exports[_0x719e('0x51')]=function(_0xa39162,_0xdd0c16){return db['SmsQueue'][_0x719e('0x51')]()[_0x719e('0x28')](respondWithResult(_0xdd0c16,null))[_0x719e('0x44')](handleError(_0xdd0c16,null));};exports[_0x719e('0x52')]=function(_0x15e877,_0x14f66f,_0x365470){var _0x16bb40={'raw':!![],'where':{}},_0x1e9e5d={},_0x467c4f;return db[_0x719e('0x43')][_0x719e('0x53')]({'where':{'id':_0x15e877[_0x719e('0x54')]['id']}})[_0x719e('0x28')](handleEntityNotFound(_0x14f66f,null))[_0x719e('0x28')](function(_0x2f04d7){if(_0x2f04d7){_0x467c4f=_0x2f04d7[_0x719e('0x4a')]({'plain':!![]});_0x1e9e5d[_0x719e('0x32')]=_[_0x719e('0x33')](db[_0x719e('0x55')][_0x719e('0x30')]);_0x1e9e5d[_0x719e('0x34')]=_['keys'](_0x15e877['query']);_0x1e9e5d[_0x719e('0x3d')]=_[_0x719e('0x35')](_0x1e9e5d[_0x719e('0x32')],_0x1e9e5d[_0x719e('0x34')]);_0x16bb40[_0x719e('0x36')]=_[_0x719e('0x35')](_0x1e9e5d['model'],qs[_0x719e('0x37')](_0x15e877[_0x719e('0x34')][_0x719e('0x37')]));_0x16bb40[_0x719e('0x36')]=_0x16bb40[_0x719e('0x36')][_0x719e('0x56')]?_0x16bb40[_0x719e('0x36')]:_0x1e9e5d[_0x719e('0x32')];if(!_0x15e877[_0x719e('0x34')]['hasOwnProperty'](_0x719e('0x39'))){_0x16bb40[_0x719e('0x1f')]=qs['limit'](_0x15e877[_0x719e('0x34')][_0x719e('0x1f')]);_0x16bb40[_0x719e('0x1d')]=qs[_0x719e('0x1d')](_0x15e877[_0x719e('0x34')][_0x719e('0x1d')]);}_0x16bb40[_0x719e('0x3a')]=qs['sort'](_0x15e877['query'][_0x719e('0x3b')]);_0x16bb40[_0x719e('0x3c')]=qs[_0x719e('0x3d')](_[_0x719e('0x3e')](_0x15e877['query'],_0x1e9e5d[_0x719e('0x3d')]));_0x16bb40[_0x719e('0x3c')][_0x719e('0x57')]=_0x2f04d7['id'];if(_0x15e877['query'][_0x719e('0x42')]){_0x16bb40[_0x719e('0x3c')]=_[_0x719e('0x3f')](_0x16bb40['where'],{'$or':_['map'](_0x16bb40[_0x719e('0x36')],function(_0x21d934){var _0x3bb87c={};_0x3bb87c[_0x21d934]={'$like':'%'+_0x15e877[_0x719e('0x34')][_0x719e('0x42')]+'%'};return _0x3bb87c;})});}_0x16bb40=_[_0x719e('0x3f')]({},_0x16bb40,_0x15e877[_0x719e('0x58')]);return db[_0x719e('0x55')]['findAll'](_0x16bb40);}})['then'](function(_0x4b06b){if(_0x4b06b){return db['User']['findAndCountAll']({'where':{'id':_[_0x719e('0x2f')](_0x4b06b,_0x719e('0x59')),'role':_0x719e('0x5a')},'attributes':['id',_0x719e('0x2d'),_0x719e('0x5b'),_0x719e('0x5c'),'createdAt']});}})[_0x719e('0x28')](function(_0x53e408){if(_0x53e408){return{'count':_0x53e408[_0x719e('0x20')],'rows':_[_0x719e('0x2f')](_0x53e408[_0x719e('0x5d')],function(_0x99784f){return{'membername':_0x99784f[_0x719e('0x2d')],'UserId':_0x99784f['id'],'queue_name':_0x467c4f['name'],'SmsQueueId':_0x467c4f['id'],'interface':util[_0x719e('0x5e')]('%s/%s',_0x719e('0x5f'),_0x99784f[_0x719e('0x2d')]),'penalty':0x0,'paused':_0x99784f[_0x719e('0x5b')],'createdAt':_0x99784f[_0x719e('0x60')],'updatedAt':_0x99784f[_0x719e('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14f66f,_0x16bb40))[_0x719e('0x44')](handleError(_0x14f66f,null));};exports['getTeams']=function(_0x556c3e,_0x28a051,_0x1c8f98){var _0x5a888f={};var _0x7fbb6e={};var _0x5e7c26;var _0x27a0a7;return db[_0x719e('0x43')]['findOne']({'where':{'id':_0x556c3e[_0x719e('0x54')]['id']}})['then'](handleEntityNotFound(_0x28a051,null))[_0x719e('0x28')](function(_0x2113ea){if(_0x2113ea){_0x5e7c26=_0x2113ea;_0x7fbb6e[_0x719e('0x32')]=_[_0x719e('0x33')](db[_0x719e('0x61')]['rawAttributes']);_0x7fbb6e[_0x719e('0x34')]=_['keys'](_0x556c3e['query']);_0x7fbb6e['filters']=_[_0x719e('0x35')](_0x7fbb6e[_0x719e('0x32')],_0x7fbb6e[_0x719e('0x34')]);_0x5a888f[_0x719e('0x36')]=_[_0x719e('0x35')](_0x7fbb6e[_0x719e('0x32')],qs[_0x719e('0x37')](_0x556c3e['query'][_0x719e('0x37')]));_0x5a888f[_0x719e('0x36')]=_0x5a888f[_0x719e('0x36')][_0x719e('0x56')]?_0x5a888f[_0x719e('0x36')]:_0x7fbb6e['model'];_0x5a888f[_0x719e('0x3a')]=qs[_0x719e('0x3b')](_0x556c3e[_0x719e('0x34')][_0x719e('0x3b')]);_0x5a888f[_0x719e('0x3c')]=qs['filters'](_[_0x719e('0x3e')](_0x556c3e['query'],_0x7fbb6e[_0x719e('0x3d')]));if(_0x556c3e[_0x719e('0x34')][_0x719e('0x42')]){_0x5a888f[_0x719e('0x3c')]=_[_0x719e('0x3f')](_0x5a888f[_0x719e('0x3c')],{'$or':_['map'](_0x5a888f[_0x719e('0x36')],function(_0xa7500b){var _0x5a8018={};_0x5a8018[_0xa7500b]={'$like':'%'+_0x556c3e['query'][_0x719e('0x42')]+'%'};return _0x5a8018;})});}_0x5a888f=_[_0x719e('0x3f')]({},_0x5a888f,_0x556c3e[_0x719e('0x58')]);return _0x5e7c26[_0x719e('0x62')](_0x5a888f);}})[_0x719e('0x28')](function(_0x7c0150){if(_0x7c0150){_0x27a0a7=_0x7c0150[_0x719e('0x56')];if(!_0x556c3e['query'][_0x719e('0x38')](_0x719e('0x39'))){_0x5a888f[_0x719e('0x1f')]=qs[_0x719e('0x1f')](_0x556c3e[_0x719e('0x34')][_0x719e('0x1f')]);_0x5a888f[_0x719e('0x1d')]=qs[_0x719e('0x1d')](_0x556c3e[_0x719e('0x34')][_0x719e('0x1d')]);}return _0x5e7c26[_0x719e('0x62')](_0x5a888f);}})[_0x719e('0x28')](function(_0x505539){if(_0x505539){return _0x505539?{'count':_0x27a0a7,'rows':_0x505539}:null;}})[_0x719e('0x28')](respondWithResult(_0x28a051,null))[_0x719e('0x44')](handleError(_0x28a051,null));};exports[_0x719e('0x63')]=function(_0x3f6c8d,_0x23a7de,_0x470db9){var _0x2d8ac4=_0x3f6c8d[_0x719e('0x48')][_0x719e('0x64')];return db[_0x719e('0x61')][_0x719e('0x65')]({'where':{'id':_0x2d8ac4},'attributes':['id'],'include':[{'model':db[_0x719e('0x66')],'as':_0x719e('0x67'),'attributes':['id',_0x719e('0x2d'),_0x719e('0x68'),_0x719e('0x69'),_0x719e('0x6a')],'raw':!![]}]})[_0x719e('0x28')](function(_0x5f2866){if(_0x5f2866){var _0x2c12f9=_[_0x719e('0x6b')](_0x5f2866,function(_0x4a6edd){var _0x497321=_0x4a6edd['get']({'plain':!![]});return _0x497321[_0x719e('0x67')];});return db[_0x719e('0x43')][_0x719e('0x46')]({'where':{'id':_0x3f6c8d[_0x719e('0x54')]['id']}})[_0x719e('0x28')](function(_0x28f508){return db['sequelize']['transaction'](function(_0x144d9e){return _0x28f508[_0x719e('0x63')](_0x2d8ac4,{'transaction':_0x144d9e})[_0x719e('0x28')](function(){return BPromise[_0x719e('0x6c')](_0x2c12f9,function(_0xf63b48){return db[_0x719e('0x55')][_0x719e('0x6d')]({'where':{'UserId':_0xf63b48['id'],'SmsQueueId':_0x3f6c8d[_0x719e('0x54')]['id']},'transaction':_0x144d9e});});})['then'](function(){_0x2c12f9[_0x719e('0x6e')](function(_0x1d2257){socket['emit'](_0x719e('0x6f'),{'UserId':_0x1d2257['id'],'SmsQueueId':_0x28f508['id']});});});});});}})[_0x719e('0x28')](respondWithStatusCode(_0x23a7de,null))[_0x719e('0x44')](handleError(_0x23a7de,null));};exports[_0x719e('0x70')]=function(_0x22ed11,_0x16d480,_0x24e618){return db[_0x719e('0x61')][_0x719e('0x65')]({'where':{'id':_0x22ed11[_0x719e('0x34')][_0x719e('0x64')]},'attributes':['id'],'include':[{'model':db[_0x719e('0x66')],'as':_0x719e('0x67'),'attributes':['id'],'raw':!![]}]})[_0x719e('0x28')](handleEntityNotFound(_0x16d480,null))[_0x719e('0x28')](function(_0x49cdc9){var _0xa3ef1=_[_0x719e('0x2f')](_0x49cdc9,'id');var _0x81aa6d=[];var _0x25f297=[];var _0x3dbd86=squel['select']();_0x3dbd86[_0x719e('0x71')]('tq.TeamId')['from'](_0x719e('0x72'),'tq')[_0x719e('0x73')](_0x719e('0x74'),'ut',_0x719e('0x75'))[_0x719e('0x3c')](_0x719e('0x76'),_0x22ed11[_0x719e('0x54')]['id']);for(var _0x336bc7=0x0;_0x336bc7<_0x49cdc9['length'];_0x336bc7+=0x1){let _0x285d08=_0x49cdc9[_0x336bc7];for(var _0xa8f9f0=0x0;_0xa8f9f0<_0x285d08[_0x719e('0x67')][_0x719e('0x56')];_0xa8f9f0+=0x1){let _0x4be136=_0x285d08[_0x719e('0x67')][_0xa8f9f0];var _0x2f3188=_0x3dbd86['clone']();_0x2f3188['where']('ut.UserId\x20=\x20?',_0x4be136['id']);_0x25f297[_0x719e('0x77')](db[_0x719e('0x78')][_0x719e('0x34')](_0x2f3188['toString'](),{'type':db[_0x719e('0x78')]['QueryTypes'][_0x719e('0x79')]})['then'](function(_0x13b1e7){if(_0x13b1e7[_0x719e('0x56')]===0x1){return _0x4be136['id'];}else{var _0x1ae0a1=_['every'](_['map'](_0x13b1e7,_0x719e('0x7a')),function(_0x4b8214){return _[_0x719e('0x7b')](_0xa3ef1,_0x4b8214);});if(_0x1ae0a1){return _0x4be136['id'];}}}));}}return BPromise['all'](_0x25f297)[_0x719e('0x28')](function(_0x20d89d){_0x81aa6d=_(_0x81aa6d)[_0x719e('0x7c')](_0x20d89d)[_0x719e('0x7d')]()[_0x719e('0x7e')]();return db[_0x719e('0x43')]['find']({'where':{'id':_0x22ed11['params']['id']}})[_0x719e('0x28')](function(_0x494482){return db[_0x719e('0x78')][_0x719e('0x7f')](function(_0x3117e4){return _0x494482['removeTeams'](_0x22ed11[_0x719e('0x34')][_0x719e('0x64')],{'transaction':_0x3117e4})[_0x719e('0x28')](function(){if(!_[_0x719e('0x80')](_0x81aa6d)){return _0x494482[_0x719e('0x81')](_0x81aa6d,{'transaction':_0x3117e4});}})[_0x719e('0x28')](function(){_0x81aa6d[_0x719e('0x6e')](function(_0x2607b0){socket[_0x719e('0x82')](_0x719e('0x83'),{'UserId':_0x2607b0,'SmsQueueId':_0x494482['id']});});});});});});})[_0x719e('0x28')](respondWithStatusCode(_0x16d480,null))['catch'](handleError(_0x16d480,null));};exports[_0x719e('0x84')]=function(_0x55a3b6,_0x40c281,_0x1f0c6b){return db[_0x719e('0x43')][_0x719e('0x46')]({'where':{'id':_0x55a3b6[_0x719e('0x54')]['id']}})[_0x719e('0x28')](handleEntityNotFound(_0x40c281,null))['then'](function(_0x5066b5){if(_0x5066b5){return _0x5066b5['addAgents'](_0x55a3b6[_0x719e('0x48')][_0x719e('0x64')],_[_0x719e('0x85')](_0x55a3b6[_0x719e('0x48')],[_0x719e('0x64'),'id'])||{})[_0x719e('0x86')](function(_0x2c9d34){for(var _0x53a559=0x0;_0x53a559<_0x55a3b6[_0x719e('0x48')]['ids'][_0x719e('0x56')];_0x53a559+=0x1){socket[_0x719e('0x82')](_0x719e('0x6f'),{'UserId':Number(_0x55a3b6[_0x719e('0x48')][_0x719e('0x64')][_0x53a559]),'SmsQueueId':Number(_0x55a3b6[_0x719e('0x54')]['id'])});}return _0x2c9d34;});}})[_0x719e('0x28')](respondWithResult(_0x40c281,null))[_0x719e('0x44')](handleError(_0x40c281,null));};exports['removeAgents']=function(_0x224ac5,_0x258132,_0x4d0e9b){return db[_0x719e('0x43')][_0x719e('0x46')]({'where':{'id':_0x224ac5[_0x719e('0x54')]['id']}})[_0x719e('0x28')](handleEntityNotFound(_0x258132,null))['then'](function(_0x19dda0){if(_0x19dda0){return _0x19dda0['removeAgents'](_0x224ac5[_0x719e('0x34')][_0x719e('0x64')])[_0x719e('0x28')](function(){if(_[_0x719e('0x87')](_0x224ac5[_0x719e('0x34')][_0x719e('0x64')])){for(var _0x13f574=0x0;_0x13f574<_0x224ac5[_0x719e('0x34')][_0x719e('0x64')]['length'];_0x13f574+=0x1){socket[_0x719e('0x82')](_0x719e('0x83'),{'UserId':Number(_0x224ac5[_0x719e('0x34')][_0x719e('0x64')][_0x13f574]),'SmsQueueId':Number(_0x224ac5['params']['id'])});}}else{socket[_0x719e('0x82')](_0x719e('0x83'),{'UserId':Number(_0x224ac5[_0x719e('0x34')]['ids']),'SmsQueueId':Number(_0x224ac5[_0x719e('0x54')]['id'])});}});}})[_0x719e('0x28')](respondWithStatusCode(_0x258132,null))[_0x719e('0x44')](handleError(_0x258132,null));};exports[_0x719e('0x88')]=function(_0x22af24,_0x1a6fda,_0x4d5856){var _0xb3ed3f={};var _0xf0f11a={};var _0x23bdfd;var _0x126a65;return db[_0x719e('0x43')]['findOne']({'where':{'id':_0x22af24[_0x719e('0x54')]['id']}})[_0x719e('0x28')](handleEntityNotFound(_0x1a6fda,null))['then'](function(_0x3b98ec){if(_0x3b98ec){_0x23bdfd=_0x3b98ec;_0xf0f11a[_0x719e('0x32')]=_[_0x719e('0x33')](db['User']['rawAttributes']);_0xf0f11a[_0x719e('0x34')]=_[_0x719e('0x33')](_0x22af24['query']);_0xf0f11a[_0x719e('0x3d')]=_['intersection'](_0xf0f11a[_0x719e('0x32')],_0xf0f11a[_0x719e('0x34')]);_0xb3ed3f[_0x719e('0x36')]=_[_0x719e('0x35')](_0xf0f11a['model'],qs['fields'](_0x22af24['query'][_0x719e('0x37')]));_0xb3ed3f[_0x719e('0x36')]=_0xb3ed3f[_0x719e('0x36')][_0x719e('0x56')]?_0xb3ed3f[_0x719e('0x36')]:_0xf0f11a[_0x719e('0x32')];_0xb3ed3f[_0x719e('0x3a')]=qs['sort'](_0x22af24[_0x719e('0x34')][_0x719e('0x3b')]);_0xb3ed3f[_0x719e('0x3c')]=qs[_0x719e('0x3d')](_[_0x719e('0x3e')](_0x22af24[_0x719e('0x34')],_0xf0f11a[_0x719e('0x3d')]));if(_0x22af24[_0x719e('0x34')][_0x719e('0x42')]){_0xb3ed3f['where']=_['merge'](_0xb3ed3f['where'],{'$or':_[_0x719e('0x2f')](_0xb3ed3f[_0x719e('0x36')],function(_0x2b484e){var _0x2b249e={};_0x2b249e[_0x2b484e]={'$like':'%'+_0x22af24[_0x719e('0x34')][_0x719e('0x42')]+'%'};return _0x2b249e;})});}_0xb3ed3f=_['merge']({},_0xb3ed3f,_0x22af24['options']);return _0x23bdfd[_0x719e('0x88')](_0xb3ed3f);}})[_0x719e('0x28')](function(_0x5460fd){if(_0x5460fd){_0x126a65=_0x5460fd[_0x719e('0x56')];if(!_0x22af24[_0x719e('0x34')][_0x719e('0x38')](_0x719e('0x39'))){_0xb3ed3f[_0x719e('0x1f')]=qs[_0x719e('0x1f')](_0x22af24['query'][_0x719e('0x1f')]);_0xb3ed3f[_0x719e('0x1d')]=qs['offset'](_0x22af24[_0x719e('0x34')][_0x719e('0x1d')]);}return _0x23bdfd[_0x719e('0x88')](_0xb3ed3f);}})[_0x719e('0x28')](function(_0x27dda1){if(_0x27dda1){return _0x27dda1?{'count':_0x126a65,'rows':_0x27dda1}:null;}})[_0x719e('0x28')](respondWithResult(_0x1a6fda,null))[_0x719e('0x44')](handleError(_0x1a6fda,null));}; \ No newline at end of file +var _0x960c=['isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsQueue','findAll','rows','catch','show','length','includeAll','include','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','hasOwnProperty','SmsQueueId','UserSmsQueue','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','Team','getTeams','addTeams','ids','User','Agents','online','sequelize','transaction','forEach','removeTeams','select','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','includes','all','union','compact','value'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x960c,0x8f));var _0xc960=function(_0x2ae05c,_0x1cc990){_0x2ae05c=_0x2ae05c-0x0;var _0x23f9ef=_0x960c[_0x2ae05c];return _0x23f9ef;};'use strict';var emlformat=require(_0xc960('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc960('0x1'));var jsonpatch=require(_0xc960('0x2'));var rp=require(_0xc960('0x3'));var moment=require(_0xc960('0x4'));var BPromise=require(_0xc960('0x5'));var Mustache=require(_0xc960('0x6'));var util=require(_0xc960('0x7'));var path=require('path');var sox=require(_0xc960('0x8'));var csv=require(_0xc960('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc960('0xa'));var _=require('lodash');var squel=require(_0xc960('0xb'));var crypto=require(_0xc960('0xc'));var jsforce=require(_0xc960('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc960('0x9'));var querystring=require(_0xc960('0xe'));var Papa=require(_0xc960('0xf'));var Redis=require('ioredis');var authService=require(_0xc960('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc960('0x11'));var logger=require(_0xc960('0x12'))('api');var utils=require(_0xc960('0x13'));var config=require(_0xc960('0x14'));var licenseUtil=require(_0xc960('0x15'));var db=require(_0xc960('0x16'))['db'];config['redis']=_[_0xc960('0x17')](config[_0xc960('0x18')],{'host':_0xc960('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc960('0x18')]));require('./smsQueue.socket')[_0xc960('0x1a')](socket);function respondWithStatusCode(_0x50faff,_0x4d4581){_0x4d4581=_0x4d4581||0xcc;return function(_0xb854c5){if(_0xb854c5){return _0x50faff[_0xc960('0x1b')](_0x4d4581);}return _0x50faff[_0xc960('0x1c')](_0x4d4581)[_0xc960('0x1d')]();};}function respondWithResult(_0x3879c4,_0x2384f8){_0x2384f8=_0x2384f8||0xc8;return function(_0x5b0557){if(_0x5b0557){return _0x3879c4['status'](_0x2384f8)[_0xc960('0x1e')](_0x5b0557);}};}function respondWithFilteredResult(_0x2bb7f4,_0x29d0e0){return function(_0x13593d){if(_0x13593d){var _0x193380=typeof _0x29d0e0[_0xc960('0x1f')]===_0xc960('0x20')&&typeof _0x29d0e0['limit']==='undefined';var _0x4382d0=_0x13593d[_0xc960('0x21')];var _0x59f819=_0x193380?0x0:_0x29d0e0[_0xc960('0x1f')];var _0x433b63=_0x193380?_0x13593d[_0xc960('0x21')]:_0x29d0e0[_0xc960('0x1f')]+_0x29d0e0[_0xc960('0x22')];var _0xa9490f;if(_0x433b63>=_0x4382d0){_0x433b63=_0x4382d0;_0xa9490f=0xc8;}else{_0xa9490f=0xce;}_0x2bb7f4['status'](_0xa9490f);return _0x2bb7f4['set']('Content-Range',_0x59f819+'-'+_0x433b63+'/'+_0x4382d0)[_0xc960('0x1e')](_0x13593d);}return null;};}function patchUpdates(_0x5508f9){return function(_0x3c3848){try{jsonpatch['apply'](_0x3c3848,_0x5508f9,!![]);}catch(_0x1998a4){return BPromise[_0xc960('0x23')](_0x1998a4);}return _0x3c3848[_0xc960('0x24')]();};}function saveUpdates(_0x255912,_0x525ec4){return function(_0x26502b){if(_0x26502b){return _0x26502b['update'](_0x255912)[_0xc960('0x25')](function(_0x1fb2b3){return _0x1fb2b3;});}return null;};}function removeEntity(_0x1a40ff,_0x43d172){return function(_0x1ad93b){if(_0x1ad93b){return _0x1ad93b[_0xc960('0x26')]()['then'](function(){var _0x3780d0=_0x1ad93b[_0xc960('0x27')]({'plain':!![]});var _0x5779ff=_0xc960('0x28');return db[_0xc960('0x29')][_0xc960('0x26')]({'where':{'type':_0x5779ff,'resourceId':_0x3780d0['id']}})[_0xc960('0x25')](function(){return _0x1ad93b;});})[_0xc960('0x25')](function(){_0x1a40ff[_0xc960('0x1c')](0xcc)[_0xc960('0x1d')]();});}};}function handleEntityNotFound(_0x41aec0,_0x434a30){return function(_0x409e78){if(!_0x409e78){_0x41aec0[_0xc960('0x1b')](0x194);}return _0x409e78;};}function handleError(_0x2f61b2,_0x54b5ec){_0x54b5ec=_0x54b5ec||0x1f4;return function(_0x358c23){logger[_0xc960('0x2a')](_0x358c23['stack']);if(_0x358c23['name']){delete _0x358c23[_0xc960('0x2b')];}_0x2f61b2[_0xc960('0x1c')](_0x54b5ec)[_0xc960('0x2c')](_0x358c23);};}exports[_0xc960('0x2d')]=function(_0x301a66,_0x2590d4){var _0x56a69a={},_0x2dc898={},_0xb32477={'count':0x0,'rows':[]};var _0x15a539=_[_0xc960('0x2e')](db['SmsQueue'][_0xc960('0x2f')],function(_0x51b329){return{'name':_0x51b329['fieldName'],'type':_0x51b329[_0xc960('0x30')][_0xc960('0x31')]};});_0x2dc898[_0xc960('0x32')]=_['map'](_0x15a539,_0xc960('0x2b'));_0x2dc898['query']=_[_0xc960('0x33')](_0x301a66[_0xc960('0x34')]);_0x2dc898[_0xc960('0x35')]=_[_0xc960('0x36')](_0x2dc898[_0xc960('0x32')],_0x2dc898[_0xc960('0x34')]);_0x56a69a[_0xc960('0x37')]=_[_0xc960('0x36')](_0x2dc898[_0xc960('0x32')],qs[_0xc960('0x38')](_0x301a66['query']['fields']));_0x56a69a[_0xc960('0x37')]=_0x56a69a[_0xc960('0x37')]['length']?_0x56a69a[_0xc960('0x37')]:_0x2dc898[_0xc960('0x32')];if(!_0x301a66[_0xc960('0x34')]['hasOwnProperty'](_0xc960('0x39'))){_0x56a69a[_0xc960('0x22')]=qs[_0xc960('0x22')](_0x301a66[_0xc960('0x34')][_0xc960('0x22')]);_0x56a69a[_0xc960('0x1f')]=qs['offset'](_0x301a66[_0xc960('0x34')]['offset']);}_0x56a69a[_0xc960('0x3a')]=qs[_0xc960('0x3b')](_0x301a66[_0xc960('0x34')][_0xc960('0x3b')]);_0x56a69a[_0xc960('0x3c')]=qs['filters'](_[_0xc960('0x3d')](_0x301a66[_0xc960('0x34')],_0x2dc898[_0xc960('0x35')]),_0x15a539);if(_0x301a66['query'][_0xc960('0x3e')]){_0x56a69a[_0xc960('0x3c')]=_[_0xc960('0x3f')](_0x56a69a['where'],{'$or':_[_0xc960('0x2e')](_0x15a539,function(_0x4a6506){if(_0x4a6506[_0xc960('0x30')]!==_0xc960('0x40')){var _0x1a98a5={};_0x1a98a5[_0x4a6506['name']]={'$like':'%'+_0x301a66[_0xc960('0x34')][_0xc960('0x3e')]+'%'};return _0x1a98a5;}})});}_0x56a69a=_[_0xc960('0x3f')]({},_0x56a69a,_0x301a66['options']);var _0x2756d0={'where':_0x56a69a[_0xc960('0x3c')]};return db[_0xc960('0x41')][_0xc960('0x21')](_0x2756d0)['then'](function(_0x34d92a){_0xb32477['count']=_0x34d92a;if(_0x301a66[_0xc960('0x34')]['includeAll']){_0x56a69a['include']=[{'all':!![]}];}return db['SmsQueue'][_0xc960('0x42')](_0x56a69a);})['then'](function(_0x5d84bb){_0xb32477[_0xc960('0x43')]=_0x5d84bb;return _0xb32477;})[_0xc960('0x25')](respondWithFilteredResult(_0x2590d4,_0x56a69a))[_0xc960('0x44')](handleError(_0x2590d4,null));};exports[_0xc960('0x45')]=function(_0x413a49,_0x1fe64b){var _0x503aeb={'raw':!![],'where':{'id':_0x413a49['params']['id']}},_0x13934e={};_0x13934e[_0xc960('0x32')]=_[_0xc960('0x33')](db['SmsQueue']['rawAttributes']);_0x13934e[_0xc960('0x34')]=_[_0xc960('0x33')](_0x413a49[_0xc960('0x34')]);_0x13934e[_0xc960('0x35')]=_[_0xc960('0x36')](_0x13934e[_0xc960('0x32')],_0x13934e[_0xc960('0x34')]);_0x503aeb[_0xc960('0x37')]=_[_0xc960('0x36')](_0x13934e[_0xc960('0x32')],qs[_0xc960('0x38')](_0x413a49[_0xc960('0x34')][_0xc960('0x38')]));_0x503aeb[_0xc960('0x37')]=_0x503aeb[_0xc960('0x37')][_0xc960('0x46')]?_0x503aeb[_0xc960('0x37')]:_0x13934e[_0xc960('0x32')];if(_0x413a49[_0xc960('0x34')][_0xc960('0x47')]){_0x503aeb[_0xc960('0x48')]=[{'all':!![]}];}_0x503aeb=_[_0xc960('0x3f')]({},_0x503aeb,_0x413a49[_0xc960('0x49')]);return db[_0xc960('0x41')][_0xc960('0x4a')](_0x503aeb)[_0xc960('0x25')](handleEntityNotFound(_0x1fe64b,null))[_0xc960('0x25')](respondWithResult(_0x1fe64b,null))['catch'](handleError(_0x1fe64b,null));};exports['create']=function(_0x28da2b,_0x5aed9f){return db[_0xc960('0x41')]['create'](_0x28da2b[_0xc960('0x4b')],{})[_0xc960('0x25')](function(_0x5bd4fa){var _0xd64c46=_0x28da2b[_0xc960('0x4c')][_0xc960('0x27')]({'plain':!![]});if(!_0xd64c46)throw new Error(_0xc960('0x4d'));if(_0xd64c46[_0xc960('0x4e')]===_0xc960('0x4c')){var _0x16abd9=_0x5bd4fa[_0xc960('0x27')]({'plain':!![]});var _0x14beeb=_0xc960('0x28');return db[_0xc960('0x4f')][_0xc960('0x4a')]({'where':{'name':_0x14beeb,'userProfileId':_0xd64c46[_0xc960('0x50')]},'raw':!![]})[_0xc960('0x25')](function(_0x97bf96){if(_0x97bf96&&_0x97bf96[_0xc960('0x51')]===0x0){return db['UserProfileResource'][_0xc960('0x52')]({'name':_0x16abd9[_0xc960('0x2b')],'resourceId':_0x16abd9['id'],'type':_0x97bf96[_0xc960('0x2b')],'sectionId':_0x97bf96['id']},{})[_0xc960('0x25')](function(){return _0x5bd4fa;});}else{return _0x5bd4fa;}})[_0xc960('0x44')](function(_0x488ce2){logger['error'](_0xc960('0x53'),_0x488ce2);throw _0x488ce2;});}return _0x5bd4fa;})[_0xc960('0x25')](respondWithResult(_0x5aed9f,0xc9))['catch'](handleError(_0x5aed9f,null));};exports[_0xc960('0x54')]=function(_0x4d1a81,_0x175865){if(_0x4d1a81[_0xc960('0x4b')]['id']){delete _0x4d1a81[_0xc960('0x4b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x4d1a81[_0xc960('0x55')]['id']}})[_0xc960('0x25')](handleEntityNotFound(_0x175865,null))[_0xc960('0x25')](saveUpdates(_0x4d1a81[_0xc960('0x4b')],null))[_0xc960('0x25')](respondWithResult(_0x175865,null))[_0xc960('0x44')](handleError(_0x175865,null));};exports['destroy']=function(_0x2843a9,_0x436665){return db[_0xc960('0x41')][_0xc960('0x4a')]({'where':{'id':_0x2843a9['params']['id']}})[_0xc960('0x25')](handleEntityNotFound(_0x436665,null))[_0xc960('0x25')](removeEntity(_0x436665,null))[_0xc960('0x44')](handleError(_0x436665,null));};exports[_0xc960('0x56')]=function(_0x4cadfa,_0x352ec1){return db[_0xc960('0x41')][_0xc960('0x56')]()[_0xc960('0x25')](respondWithResult(_0x352ec1,null))[_0xc960('0x44')](handleError(_0x352ec1,null));};exports[_0xc960('0x57')]=function(_0x2496c8,_0x28ed09,_0x1d3d2c){var _0xc12ef4={'raw':!![],'where':{}},_0x4cb4d8={},_0x26fab3;return db[_0xc960('0x41')][_0xc960('0x58')]({'where':{'id':_0x2496c8[_0xc960('0x55')]['id']}})[_0xc960('0x25')](handleEntityNotFound(_0x28ed09,null))[_0xc960('0x25')](function(_0x5293ef){if(_0x5293ef){_0x26fab3=_0x5293ef[_0xc960('0x27')]({'plain':!![]});_0x4cb4d8[_0xc960('0x32')]=_[_0xc960('0x33')](db['UserSmsQueue'][_0xc960('0x2f')]);_0x4cb4d8['query']=_[_0xc960('0x33')](_0x2496c8[_0xc960('0x34')]);_0x4cb4d8['filters']=_[_0xc960('0x36')](_0x4cb4d8[_0xc960('0x32')],_0x4cb4d8[_0xc960('0x34')]);_0xc12ef4['attributes']=_[_0xc960('0x36')](_0x4cb4d8[_0xc960('0x32')],qs[_0xc960('0x38')](_0x2496c8[_0xc960('0x34')][_0xc960('0x38')]));_0xc12ef4[_0xc960('0x37')]=_0xc12ef4['attributes'][_0xc960('0x46')]?_0xc12ef4[_0xc960('0x37')]:_0x4cb4d8['model'];if(!_0x2496c8[_0xc960('0x34')][_0xc960('0x59')]('nolimit')){_0xc12ef4[_0xc960('0x22')]=qs[_0xc960('0x22')](_0x2496c8[_0xc960('0x34')][_0xc960('0x22')]);_0xc12ef4[_0xc960('0x1f')]=qs[_0xc960('0x1f')](_0x2496c8[_0xc960('0x34')][_0xc960('0x1f')]);}_0xc12ef4[_0xc960('0x3a')]=qs[_0xc960('0x3b')](_0x2496c8[_0xc960('0x34')][_0xc960('0x3b')]);_0xc12ef4['where']=qs['filters'](_[_0xc960('0x3d')](_0x2496c8[_0xc960('0x34')],_0x4cb4d8['filters']));_0xc12ef4['where'][_0xc960('0x5a')]=_0x5293ef['id'];if(_0x2496c8[_0xc960('0x34')][_0xc960('0x3e')]){_0xc12ef4[_0xc960('0x3c')]=_[_0xc960('0x3f')](_0xc12ef4[_0xc960('0x3c')],{'$or':_['map'](_0xc12ef4[_0xc960('0x37')],function(_0x6afb39){var _0x4640a6={};_0x4640a6[_0x6afb39]={'$like':'%'+_0x2496c8['query'][_0xc960('0x3e')]+'%'};return _0x4640a6;})});}_0xc12ef4=_[_0xc960('0x3f')]({},_0xc12ef4,_0x2496c8[_0xc960('0x49')]);return db[_0xc960('0x5b')][_0xc960('0x42')](_0xc12ef4);}})[_0xc960('0x25')](function(_0x50b429){if(_0x50b429){return db['User'][_0xc960('0x5c')]({'where':{'id':_[_0xc960('0x2e')](_0x50b429,_0xc960('0x5d')),'role':_0xc960('0x5e')},'attributes':['id','name','smsPause',_0xc960('0x5f'),_0xc960('0x60')]});}})[_0xc960('0x25')](function(_0x3ddf34){if(_0x3ddf34){return{'count':_0x3ddf34[_0xc960('0x21')],'rows':_[_0xc960('0x2e')](_0x3ddf34[_0xc960('0x43')],function(_0xb1dcda){return{'membername':_0xb1dcda['name'],'UserId':_0xb1dcda['id'],'queue_name':_0x26fab3[_0xc960('0x2b')],'SmsQueueId':_0x26fab3['id'],'interface':util[_0xc960('0x61')](_0xc960('0x62'),_0xc960('0x63'),_0xb1dcda[_0xc960('0x2b')]),'penalty':0x0,'paused':_0xb1dcda[_0xc960('0x64')],'createdAt':_0xb1dcda[_0xc960('0x60')],'updatedAt':_0xb1dcda[_0xc960('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc960('0x25')](respondWithFilteredResult(_0x28ed09,_0xc12ef4))[_0xc960('0x44')](handleError(_0x28ed09,null));};exports['getTeams']=function(_0x2b6dab,_0xf4de42,_0x220bb9){var _0x3d7d12={};var _0x589626={};var _0x2b7124;var _0x24f8e0;return db[_0xc960('0x41')][_0xc960('0x58')]({'where':{'id':_0x2b6dab['params']['id']}})[_0xc960('0x25')](handleEntityNotFound(_0xf4de42,null))[_0xc960('0x25')](function(_0x1e7636){if(_0x1e7636){_0x2b7124=_0x1e7636;_0x589626[_0xc960('0x32')]=_[_0xc960('0x33')](db[_0xc960('0x65')]['rawAttributes']);_0x589626[_0xc960('0x34')]=_[_0xc960('0x33')](_0x2b6dab['query']);_0x589626[_0xc960('0x35')]=_[_0xc960('0x36')](_0x589626['model'],_0x589626['query']);_0x3d7d12[_0xc960('0x37')]=_['intersection'](_0x589626[_0xc960('0x32')],qs['fields'](_0x2b6dab[_0xc960('0x34')][_0xc960('0x38')]));_0x3d7d12[_0xc960('0x37')]=_0x3d7d12['attributes'][_0xc960('0x46')]?_0x3d7d12[_0xc960('0x37')]:_0x589626[_0xc960('0x32')];_0x3d7d12[_0xc960('0x3a')]=qs[_0xc960('0x3b')](_0x2b6dab[_0xc960('0x34')][_0xc960('0x3b')]);_0x3d7d12[_0xc960('0x3c')]=qs[_0xc960('0x35')](_[_0xc960('0x3d')](_0x2b6dab[_0xc960('0x34')],_0x589626[_0xc960('0x35')]));if(_0x2b6dab[_0xc960('0x34')][_0xc960('0x3e')]){_0x3d7d12[_0xc960('0x3c')]=_['merge'](_0x3d7d12[_0xc960('0x3c')],{'$or':_[_0xc960('0x2e')](_0x3d7d12[_0xc960('0x37')],function(_0xf0dab5){var _0x5f3360={};_0x5f3360[_0xf0dab5]={'$like':'%'+_0x2b6dab['query']['filter']+'%'};return _0x5f3360;})});}_0x3d7d12=_['merge']({},_0x3d7d12,_0x2b6dab[_0xc960('0x49')]);return _0x2b7124[_0xc960('0x66')](_0x3d7d12);}})[_0xc960('0x25')](function(_0x231b18){if(_0x231b18){_0x24f8e0=_0x231b18[_0xc960('0x46')];if(!_0x2b6dab[_0xc960('0x34')][_0xc960('0x59')](_0xc960('0x39'))){_0x3d7d12[_0xc960('0x22')]=qs[_0xc960('0x22')](_0x2b6dab[_0xc960('0x34')][_0xc960('0x22')]);_0x3d7d12[_0xc960('0x1f')]=qs[_0xc960('0x1f')](_0x2b6dab[_0xc960('0x34')]['offset']);}return _0x2b7124[_0xc960('0x66')](_0x3d7d12);}})['then'](function(_0x1f43cf){if(_0x1f43cf){return _0x1f43cf?{'count':_0x24f8e0,'rows':_0x1f43cf}:null;}})['then'](respondWithResult(_0xf4de42,null))[_0xc960('0x44')](handleError(_0xf4de42,null));};exports[_0xc960('0x67')]=function(_0x5d5def,_0x5d9daa,_0x2800d6){var _0x3253a5=_0x5d5def[_0xc960('0x4b')][_0xc960('0x68')];return db[_0xc960('0x65')][_0xc960('0x42')]({'where':{'id':_0x3253a5},'attributes':['id'],'include':[{'model':db[_0xc960('0x69')],'as':_0xc960('0x6a'),'attributes':['id',_0xc960('0x2b'),_0xc960('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0xc960('0x25')](function(_0x4f8d27){if(_0x4f8d27){var _0x19aaae=_['flatMap'](_0x4f8d27,function(_0x98271e){var _0x1f271e=_0x98271e[_0xc960('0x27')]({'plain':!![]});return _0x1f271e[_0xc960('0x6a')];});return db[_0xc960('0x41')][_0xc960('0x4a')]({'where':{'id':_0x5d5def['params']['id']}})[_0xc960('0x25')](function(_0x1bb9ff){return db[_0xc960('0x6c')][_0xc960('0x6d')](function(_0xa3e10f){return _0x1bb9ff[_0xc960('0x67')](_0x3253a5,{'transaction':_0xa3e10f})['then'](function(){return BPromise['each'](_0x19aaae,function(_0xd3ab8e){return db[_0xc960('0x5b')]['findOrCreate']({'where':{'UserId':_0xd3ab8e['id'],'SmsQueueId':_0x5d5def[_0xc960('0x55')]['id']},'transaction':_0xa3e10f});});})[_0xc960('0x25')](function(){_0x19aaae[_0xc960('0x6e')](function(_0x34507c){socket['emit']('userSmsQueue:save',{'UserId':_0x34507c['id'],'SmsQueueId':_0x1bb9ff['id']});});});});});}})['then'](respondWithStatusCode(_0x5d9daa,null))[_0xc960('0x44')](handleError(_0x5d9daa,null));};exports[_0xc960('0x6f')]=function(_0x5a1fa8,_0x176692,_0x752048){return db['Team'][_0xc960('0x42')]({'where':{'id':_0x5a1fa8[_0xc960('0x34')][_0xc960('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc960('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xc960('0x25')](handleEntityNotFound(_0x176692,null))[_0xc960('0x25')](function(_0x5d8bbc){var _0x146d26=_['map'](_0x5d8bbc,'id');var _0x504e48=[];var _0x459fcb=[];var _0x19e11c=squel[_0xc960('0x70')]();_0x19e11c['field']('tq.TeamId')[_0xc960('0x71')](_0xc960('0x72'),'tq')['join'](_0xc960('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc960('0x3c')](_0xc960('0x74'),_0x5a1fa8[_0xc960('0x55')]['id']);for(var _0xdba41a=0x0;_0xdba41a<_0x5d8bbc[_0xc960('0x46')];_0xdba41a+=0x1){let _0x1e92ba=_0x5d8bbc[_0xdba41a];for(var _0x3c31ca=0x0;_0x3c31ca<_0x1e92ba[_0xc960('0x6a')][_0xc960('0x46')];_0x3c31ca+=0x1){let _0xb7a0d3=_0x1e92ba[_0xc960('0x6a')][_0x3c31ca];var _0x4e675c=_0x19e11c[_0xc960('0x75')]();_0x4e675c[_0xc960('0x3c')](_0xc960('0x76'),_0xb7a0d3['id']);_0x459fcb['push'](db[_0xc960('0x6c')][_0xc960('0x34')](_0x4e675c['toString'](),{'type':db[_0xc960('0x6c')]['QueryTypes'][_0xc960('0x77')]})[_0xc960('0x25')](function(_0x189fdf){if(_0x189fdf[_0xc960('0x46')]===0x1){return _0xb7a0d3['id'];}else{var _0xe7f75b=_['every'](_['map'](_0x189fdf,'TeamId'),function(_0x16f4ee){return _[_0xc960('0x78')](_0x146d26,_0x16f4ee);});if(_0xe7f75b){return _0xb7a0d3['id'];}}}));}}return BPromise[_0xc960('0x79')](_0x459fcb)[_0xc960('0x25')](function(_0x564a96){_0x504e48=_(_0x504e48)[_0xc960('0x7a')](_0x564a96)[_0xc960('0x7b')]()[_0xc960('0x7c')]();return db['SmsQueue']['find']({'where':{'id':_0x5a1fa8[_0xc960('0x55')]['id']}})['then'](function(_0x37c9eb){return db[_0xc960('0x6c')][_0xc960('0x6d')](function(_0x3fd135){return _0x37c9eb[_0xc960('0x6f')](_0x5a1fa8['query'][_0xc960('0x68')],{'transaction':_0x3fd135})['then'](function(){if(!_[_0xc960('0x7d')](_0x504e48)){return _0x37c9eb['removeAgents'](_0x504e48,{'transaction':_0x3fd135});}})[_0xc960('0x25')](function(){_0x504e48[_0xc960('0x6e')](function(_0x2ba736){socket[_0xc960('0x7e')](_0xc960('0x7f'),{'UserId':_0x2ba736,'SmsQueueId':_0x37c9eb['id']});});});});});});})[_0xc960('0x25')](respondWithStatusCode(_0x176692,null))[_0xc960('0x44')](handleError(_0x176692,null));};exports['addAgents']=function(_0x506898,_0x92529b,_0xc866bc){return db[_0xc960('0x41')][_0xc960('0x4a')]({'where':{'id':_0x506898[_0xc960('0x55')]['id']}})['then'](handleEntityNotFound(_0x92529b,null))[_0xc960('0x25')](function(_0x2b455a){if(_0x2b455a){return _0x2b455a[_0xc960('0x80')](_0x506898[_0xc960('0x4b')][_0xc960('0x68')],_[_0xc960('0x81')](_0x506898['body'],[_0xc960('0x68'),'id'])||{})[_0xc960('0x82')](function(_0xeb1ec5){for(var _0x8eec32=0x0;_0x8eec32<_0x506898[_0xc960('0x4b')][_0xc960('0x68')][_0xc960('0x46')];_0x8eec32+=0x1){socket[_0xc960('0x7e')]('userSmsQueue:save',{'UserId':Number(_0x506898[_0xc960('0x4b')]['ids'][_0x8eec32]),'SmsQueueId':Number(_0x506898[_0xc960('0x55')]['id'])});}return _0xeb1ec5;});}})[_0xc960('0x25')](respondWithResult(_0x92529b,null))['catch'](handleError(_0x92529b,null));};exports[_0xc960('0x83')]=function(_0x518661,_0x5e40ed,_0x207e75){return db[_0xc960('0x41')]['find']({'where':{'id':_0x518661[_0xc960('0x55')]['id']}})[_0xc960('0x25')](handleEntityNotFound(_0x5e40ed,null))[_0xc960('0x25')](function(_0x2ad910){if(_0x2ad910){return _0x2ad910[_0xc960('0x83')](_0x518661['query'][_0xc960('0x68')])['then'](function(){if(_[_0xc960('0x84')](_0x518661['query'][_0xc960('0x68')])){for(var _0x352771=0x0;_0x352771<_0x518661[_0xc960('0x34')][_0xc960('0x68')][_0xc960('0x46')];_0x352771+=0x1){socket[_0xc960('0x7e')](_0xc960('0x7f'),{'UserId':Number(_0x518661[_0xc960('0x34')]['ids'][_0x352771]),'SmsQueueId':Number(_0x518661['params']['id'])});}}else{socket['emit'](_0xc960('0x7f'),{'UserId':Number(_0x518661[_0xc960('0x34')]['ids']),'SmsQueueId':Number(_0x518661['params']['id'])});}});}})[_0xc960('0x25')](respondWithStatusCode(_0x5e40ed,null))[_0xc960('0x44')](handleError(_0x5e40ed,null));};exports[_0xc960('0x85')]=function(_0x612bb1,_0x4fe968,_0x47487e){var _0x343980={};var _0x548fcc={};var _0x45f915;var _0x3e8e11;return db[_0xc960('0x41')][_0xc960('0x58')]({'where':{'id':_0x612bb1[_0xc960('0x55')]['id']}})[_0xc960('0x25')](handleEntityNotFound(_0x4fe968,null))[_0xc960('0x25')](function(_0x4f31d4){if(_0x4f31d4){_0x45f915=_0x4f31d4;_0x548fcc[_0xc960('0x32')]=_[_0xc960('0x33')](db[_0xc960('0x69')][_0xc960('0x2f')]);_0x548fcc[_0xc960('0x34')]=_[_0xc960('0x33')](_0x612bb1['query']);_0x548fcc[_0xc960('0x35')]=_[_0xc960('0x36')](_0x548fcc[_0xc960('0x32')],_0x548fcc[_0xc960('0x34')]);_0x343980[_0xc960('0x37')]=_[_0xc960('0x36')](_0x548fcc[_0xc960('0x32')],qs[_0xc960('0x38')](_0x612bb1[_0xc960('0x34')][_0xc960('0x38')]));_0x343980[_0xc960('0x37')]=_0x343980[_0xc960('0x37')]['length']?_0x343980[_0xc960('0x37')]:_0x548fcc[_0xc960('0x32')];_0x343980[_0xc960('0x3a')]=qs['sort'](_0x612bb1['query'][_0xc960('0x3b')]);_0x343980[_0xc960('0x3c')]=qs[_0xc960('0x35')](_[_0xc960('0x3d')](_0x612bb1[_0xc960('0x34')],_0x548fcc[_0xc960('0x35')]));if(_0x612bb1[_0xc960('0x34')][_0xc960('0x3e')]){_0x343980[_0xc960('0x3c')]=_['merge'](_0x343980[_0xc960('0x3c')],{'$or':_[_0xc960('0x2e')](_0x343980[_0xc960('0x37')],function(_0x11ffdd){var _0x556a01={};_0x556a01[_0x11ffdd]={'$like':'%'+_0x612bb1['query'][_0xc960('0x3e')]+'%'};return _0x556a01;})});}_0x343980=_[_0xc960('0x3f')]({},_0x343980,_0x612bb1[_0xc960('0x49')]);return _0x45f915['getAgents'](_0x343980);}})[_0xc960('0x25')](function(_0x4229c1){if(_0x4229c1){_0x3e8e11=_0x4229c1[_0xc960('0x46')];if(!_0x612bb1['query'][_0xc960('0x59')](_0xc960('0x39'))){_0x343980[_0xc960('0x22')]=qs['limit'](_0x612bb1[_0xc960('0x34')][_0xc960('0x22')]);_0x343980[_0xc960('0x1f')]=qs[_0xc960('0x1f')](_0x612bb1[_0xc960('0x34')][_0xc960('0x1f')]);}return _0x45f915[_0xc960('0x85')](_0x343980);}})['then'](function(_0x52592f){if(_0x52592f){return _0x52592f?{'count':_0x3e8e11,'rows':_0x52592f}:null;}})[_0xc960('0x25')](respondWithResult(_0x4fe968,null))[_0xc960('0x44')](handleError(_0x4fe968,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9281130..b4e6cde 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 _0xc668=['events','../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x24b1de,_0x382beb){var _0x53c393=function(_0x170c5f){while(--_0x170c5f){_0x24b1de['push'](_0x24b1de['shift']());}};_0x53c393(++_0x382beb);}(_0xc668,0x1cc));var _0x8c66=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc668[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x8c66('0x0'));var SmsQueue=require(_0x8c66('0x1'))['db'][_0x8c66('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c66('0x3'),'afterUpdate':_0x8c66('0x4'),'afterDestroy':_0x8c66('0x5')};function emitEvent(_0x3238a8){return function(_0xe567ea,_0x3651de,_0x2303a3){SmsQueueEvents[_0x8c66('0x6')](_0x3238a8+':'+_0xe567ea['id'],_0xe567ea);SmsQueueEvents['emit'](_0x3238a8,_0xe567ea);_0x2303a3(null);};}for(var e in events){if(events[_0x8c66('0x7')](e)){var event=events[e];SmsQueue[_0x8c66('0x8')](e,emitEvent(event));}}module[_0x8c66('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x9422=['exports','../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4d52b0,_0x499144){var _0x4300ee=function(_0x44c1ee){while(--_0x44c1ee){_0x4d52b0['push'](_0x4d52b0['shift']());}};_0x4300ee(++_0x499144);}(_0x9422,0x160));var _0x2942=function(_0x210344,_0x5ccfa4){_0x210344=_0x210344-0x0;var _0x26d586=_0x9422[_0x210344];return _0x26d586;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x2942('0x0'))['db'][_0x2942('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2942('0x2'),'afterUpdate':_0x2942('0x3'),'afterDestroy':_0x2942('0x4')};function emitEvent(_0xf6d07f){return function(_0x4fad4b,_0x3baf5c,_0x45cc19){SmsQueueEvents['emit'](_0xf6d07f+':'+_0x4fad4b['id'],_0x4fad4b);SmsQueueEvents[_0x2942('0x5')](_0xf6d07f,_0x4fad4b);_0x45cc19(null);};}for(var e in events){if(events[_0x2942('0x6')](e)){var event=events[e];SmsQueue[_0x2942('0x7')](e,emitEvent(event));}}module[_0x2942('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 07d75af..155c9e0 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 _0x3a5c=['exports','define','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x3a5c,0x9c));var _0xc3a5=function(_0x499a43,_0x3cbee7){_0x499a43=_0x499a43-0x0;var _0x4e607e=_0x3a5c[_0x499a43];return _0x4e607e;};'use strict';var _=require('lodash');var util=require(_0xc3a5('0x0'));var logger=require(_0xc3a5('0x1'))(_0xc3a5('0x2'));var moment=require('moment');var BPromise=require(_0xc3a5('0x3'));var rp=require(_0xc3a5('0x4'));var fs=require('fs');var path=require(_0xc3a5('0x5'));var rimraf=require(_0xc3a5('0x6'));var config=require(_0xc3a5('0x7'));var attributes=require(_0xc3a5('0x8'));module[_0xc3a5('0x9')]=function(_0x2353fa,_0x486678){return _0x2353fa[_0xc3a5('0xa')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0876=['sms_queues','lodash','util','bluebird','request-promise','path','../../config/environment','exports','define','SmsQueue'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0x0876,0xb5));var _0x6087=function(_0x1c827d,_0x177855){_0x1c827d=_0x1c827d-0x0;var _0x8e23a2=_0x0876[_0x1c827d];return _0x8e23a2;};'use strict';var _=require(_0x6087('0x0'));var util=require(_0x6087('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6087('0x2'));var rp=require(_0x6087('0x3'));var fs=require('fs');var path=require(_0x6087('0x4'));var rimraf=require('rimraf');var config=require(_0x6087('0x5'));var attributes=require('./smsQueue.attributes');module[_0x6087('0x6')]=function(_0x5a5af5,_0x56bcd0){return _0x5a5af5[_0x6087('0x7')](_0x6087('0x8'),attributes,{'tableName':_0x6087('0x9'),'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 b43b87c..bfc4b9f 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 _0xa7dd=['then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','include','map','model','ShowSmsQueue','find','raw','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request'];(function(_0x131484,_0x2cb23f){var _0x3938f0=function(_0x2a6fee){while(--_0x2a6fee){_0x131484['push'](_0x131484['shift']());}};_0x3938f0(++_0x2cb23f);}(_0xa7dd,0xc1));var _0xda7d=function(_0x460ac8,_0x2f385){_0x460ac8=_0x460ac8-0x0;var _0x518f6c=_0xa7dd[_0x460ac8];return _0x518f6c;};'use strict';var _=require(_0xda7d('0x0'));var util=require(_0xda7d('0x1'));var moment=require('moment');var BPromise=require(_0xda7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda7d('0x3'));var db=require(_0xda7d('0x4'))['db'];var utils=require(_0xda7d('0x5'));var logger=require(_0xda7d('0x6'))(_0xda7d('0x7'));var config=require(_0xda7d('0x8'));var jayson=require(_0xda7d('0x9'));var client=jayson[_0xda7d('0xa')][_0xda7d('0xb')]({'port':0x232a});config[_0xda7d('0xc')]=_[_0xda7d('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xda7d('0xe'))(new Redis(config[_0xda7d('0xc')]));require('./smsQueue.socket')[_0xda7d('0xf')](socket);function respondWithRpcPromise(_0x2a9f17,_0x4cb47c,_0x4d8e1c){return new BPromise(function(_0x41ea2e,_0x390284){return client[_0xda7d('0x10')](_0x2a9f17,_0x4d8e1c)[_0xda7d('0x11')](function(_0x123530){logger[_0xda7d('0x12')](_0xda7d('0x13'),_0x4cb47c,_0xda7d('0x14'));logger[_0xda7d('0x15')](_0xda7d('0x16'),_0x4cb47c,_0xda7d('0x14'),JSON[_0xda7d('0x17')](_0x123530));if(_0x123530['error']){if(_0x123530[_0xda7d('0x18')][_0xda7d('0x19')]===0x1f4){logger[_0xda7d('0x18')](_0xda7d('0x13'),_0x4cb47c,_0x123530[_0xda7d('0x18')][_0xda7d('0x1a')]);return _0x390284(_0x123530[_0xda7d('0x18')]['message']);}logger[_0xda7d('0x18')](_0xda7d('0x13'),_0x4cb47c,_0x123530[_0xda7d('0x18')][_0xda7d('0x1a')]);return _0x41ea2e(_0x123530[_0xda7d('0x18')][_0xda7d('0x1a')]);}else{logger['info'](_0xda7d('0x13'),_0x4cb47c,'request\x20sent');_0x41ea2e(_0x123530[_0xda7d('0x1b')][_0xda7d('0x1a')]);}})[_0xda7d('0x1c')](function(_0x2a25bb){logger[_0xda7d('0x18')](_0xda7d('0x13'),_0x4cb47c,_0x2a25bb);_0x390284(_0x2a25bb);});});}exports[_0xda7d('0x1d')]=function(_0x1a6684){var _0x19d98c=this;return new Promise(function(_0x1fc04f,_0x3096e9){return db[_0xda7d('0x1e')][_0xda7d('0x1f')]({'raw':_0x1a6684[_0xda7d('0x20')]?_0x1a6684[_0xda7d('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x1a6684[_0xda7d('0x20')]?_0x1a6684[_0xda7d('0x20')]['where']||null:null,'attributes':_0x1a6684['options']?_0x1a6684['options'][_0xda7d('0x21')]||null:null,'limit':_0x1a6684[_0xda7d('0x20')]?_0x1a6684['options'][_0xda7d('0x22')]||null:null,'include':_0x1a6684[_0xda7d('0x20')]?_0x1a6684[_0xda7d('0x20')][_0xda7d('0x23')]?_[_0xda7d('0x24')](_0x1a6684[_0xda7d('0x20')][_0xda7d('0x23')],function(_0x480c88){return{'model':db[_0x480c88[_0xda7d('0x25')]],'as':_0x480c88['as'],'attributes':_0x480c88[_0xda7d('0x21')],'include':_0x480c88[_0xda7d('0x23')]?_[_0xda7d('0x24')](_0x480c88[_0xda7d('0x23')],function(_0x35a359){return{'model':db[_0x35a359['model']],'as':_0x35a359['as'],'attributes':_0x35a359[_0xda7d('0x21')],'include':_0x35a359[_0xda7d('0x23')]?_[_0xda7d('0x24')](_0x35a359[_0xda7d('0x23')],function(_0x3e3309){return{'model':db[_0x3e3309[_0xda7d('0x25')]],'as':_0x3e3309['as'],'attributes':_0x3e3309['attributes']};}):[]};}):[]};}):[]:[]})[_0xda7d('0x11')](function(_0x61ccdb){logger[_0xda7d('0x12')](_0xda7d('0x1d'),_0x1a6684);logger['debug'](_0xda7d('0x1d'),_0x1a6684,JSON[_0xda7d('0x17')](_0x61ccdb));_0x1fc04f(_0x61ccdb);})['catch'](function(_0x481ee7){logger[_0xda7d('0x18')](_0xda7d('0x1d'),_0x481ee7[_0xda7d('0x1a')],_0x1a6684);_0x3096e9(_0x19d98c[_0xda7d('0x18')](0x1f4,_0x481ee7[_0xda7d('0x1a')]));});});};exports[_0xda7d('0x26')]=function(_0x51a56d){var _0x1e5524=this;return new Promise(function(_0x1cd944,_0x4541a7){return db[_0xda7d('0x1e')][_0xda7d('0x27')]({'raw':_0x51a56d[_0xda7d('0x20')]?_0x51a56d['options'][_0xda7d('0x28')]===undefined?!![]:![]:!![],'where':_0x51a56d[_0xda7d('0x20')]?_0x51a56d[_0xda7d('0x20')][_0xda7d('0x29')]||null:null,'attributes':_0x51a56d['options']?_0x51a56d['options'][_0xda7d('0x21')]||null:null,'include':_0x51a56d[_0xda7d('0x20')]?_0x51a56d[_0xda7d('0x20')][_0xda7d('0x23')]?_[_0xda7d('0x24')](_0x51a56d[_0xda7d('0x20')]['include'],function(_0x23618f){return{'model':db[_0x23618f[_0xda7d('0x25')]],'as':_0x23618f['as'],'attributes':_0x23618f[_0xda7d('0x21')],'include':_0x23618f[_0xda7d('0x23')]?_['map'](_0x23618f[_0xda7d('0x23')],function(_0x5626e5){return{'model':db[_0x5626e5[_0xda7d('0x25')]],'as':_0x5626e5['as'],'attributes':_0x5626e5[_0xda7d('0x21')],'include':_0x5626e5[_0xda7d('0x23')]?_[_0xda7d('0x24')](_0x5626e5['include'],function(_0x44db63){return{'model':db[_0x44db63[_0xda7d('0x25')]],'as':_0x44db63['as'],'attributes':_0x44db63['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ffcb5){logger[_0xda7d('0x12')]('ShowSmsQueue',_0x51a56d);logger['debug'](_0xda7d('0x26'),_0x51a56d,JSON[_0xda7d('0x17')](_0x1ffcb5));_0x1cd944(_0x1ffcb5);})[_0xda7d('0x1c')](function(_0x3fafe){logger[_0xda7d('0x18')](_0xda7d('0x26'),_0x3fafe[_0xda7d('0x1a')],_0x51a56d);_0x4541a7(_0x1e5524[_0xda7d('0x18')](0x1f4,_0x3fafe['message']));});});}; \ No newline at end of file +var _0x4f54=['ShowSmsQueue','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetSmsQueue','options','raw','where','attributes','limit','include','model','map','then','debug','catch','find'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x4f54,0x13a));var _0x44f5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4f54[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x44f5('0x0'));var moment=require(_0x44f5('0x1'));var BPromise=require(_0x44f5('0x2'));var rs=require(_0x44f5('0x3'));var fs=require('fs');var Redis=require(_0x44f5('0x4'));var db=require(_0x44f5('0x5'))['db'];var utils=require(_0x44f5('0x6'));var logger=require(_0x44f5('0x7'))('rpc');var config=require(_0x44f5('0x8'));var jayson=require(_0x44f5('0x9'));var client=jayson[_0x44f5('0xa')][_0x44f5('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x44f5('0xc')],{'host':_0x44f5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44f5('0xc')]));require(_0x44f5('0xe'))[_0x44f5('0xf')](socket);function respondWithRpcPromise(_0x1e35c5,_0xaeb464,_0x48b09e){return new BPromise(function(_0x548e7b,_0x549bfe){return client['request'](_0x1e35c5,_0x48b09e)['then'](function(_0x19fe04){logger[_0x44f5('0x10')](_0x44f5('0x11'),_0xaeb464,'request\x20sent');logger['debug'](_0x44f5('0x12'),_0xaeb464,_0x44f5('0x13'),JSON['stringify'](_0x19fe04));if(_0x19fe04['error']){if(_0x19fe04[_0x44f5('0x14')][_0x44f5('0x15')]===0x1f4){logger[_0x44f5('0x14')](_0x44f5('0x11'),_0xaeb464,_0x19fe04[_0x44f5('0x14')][_0x44f5('0x16')]);return _0x549bfe(_0x19fe04[_0x44f5('0x14')][_0x44f5('0x16')]);}logger[_0x44f5('0x14')](_0x44f5('0x11'),_0xaeb464,_0x19fe04[_0x44f5('0x14')]['message']);return _0x548e7b(_0x19fe04['error'][_0x44f5('0x16')]);}else{logger[_0x44f5('0x10')](_0x44f5('0x11'),_0xaeb464,'request\x20sent');_0x548e7b(_0x19fe04[_0x44f5('0x17')]['message']);}})['catch'](function(_0x383e77){logger['error'](_0x44f5('0x11'),_0xaeb464,_0x383e77);_0x549bfe(_0x383e77);});});}exports[_0x44f5('0x18')]=function(_0x16e9cf){var _0x280319=this;return new Promise(function(_0x1dda90,_0x2f39a1){return db['SmsQueue']['findAll']({'raw':_0x16e9cf[_0x44f5('0x19')]?_0x16e9cf[_0x44f5('0x19')][_0x44f5('0x1a')]===undefined?!![]:![]:!![],'where':_0x16e9cf['options']?_0x16e9cf[_0x44f5('0x19')][_0x44f5('0x1b')]||null:null,'attributes':_0x16e9cf[_0x44f5('0x19')]?_0x16e9cf[_0x44f5('0x19')][_0x44f5('0x1c')]||null:null,'limit':_0x16e9cf['options']?_0x16e9cf['options'][_0x44f5('0x1d')]||null:null,'include':_0x16e9cf['options']?_0x16e9cf[_0x44f5('0x19')][_0x44f5('0x1e')]?_['map'](_0x16e9cf[_0x44f5('0x19')][_0x44f5('0x1e')],function(_0x5759f5){return{'model':db[_0x5759f5[_0x44f5('0x1f')]],'as':_0x5759f5['as'],'attributes':_0x5759f5[_0x44f5('0x1c')],'include':_0x5759f5[_0x44f5('0x1e')]?_[_0x44f5('0x20')](_0x5759f5[_0x44f5('0x1e')],function(_0x4f1e12){return{'model':db[_0x4f1e12[_0x44f5('0x1f')]],'as':_0x4f1e12['as'],'attributes':_0x4f1e12['attributes'],'include':_0x4f1e12[_0x44f5('0x1e')]?_[_0x44f5('0x20')](_0x4f1e12['include'],function(_0x8379ec){return{'model':db[_0x8379ec[_0x44f5('0x1f')]],'as':_0x8379ec['as'],'attributes':_0x8379ec[_0x44f5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x44f5('0x21')](function(_0x1a7fdb){logger['info']('GetSmsQueue',_0x16e9cf);logger[_0x44f5('0x22')](_0x44f5('0x18'),_0x16e9cf,JSON['stringify'](_0x1a7fdb));_0x1dda90(_0x1a7fdb);})[_0x44f5('0x23')](function(_0x50e9c4){logger[_0x44f5('0x14')](_0x44f5('0x18'),_0x50e9c4[_0x44f5('0x16')],_0x16e9cf);_0x2f39a1(_0x280319[_0x44f5('0x14')](0x1f4,_0x50e9c4[_0x44f5('0x16')]));});});};exports['ShowSmsQueue']=function(_0x49c70b){var _0x2042d6=this;return new Promise(function(_0x7a916c,_0x187a5e){return db['SmsQueue'][_0x44f5('0x24')]({'raw':_0x49c70b[_0x44f5('0x19')]?_0x49c70b['options']['raw']===undefined?!![]:![]:!![],'where':_0x49c70b['options']?_0x49c70b[_0x44f5('0x19')][_0x44f5('0x1b')]||null:null,'attributes':_0x49c70b[_0x44f5('0x19')]?_0x49c70b[_0x44f5('0x19')]['attributes']||null:null,'include':_0x49c70b[_0x44f5('0x19')]?_0x49c70b[_0x44f5('0x19')][_0x44f5('0x1e')]?_[_0x44f5('0x20')](_0x49c70b[_0x44f5('0x19')][_0x44f5('0x1e')],function(_0x528bf7){return{'model':db[_0x528bf7[_0x44f5('0x1f')]],'as':_0x528bf7['as'],'attributes':_0x528bf7[_0x44f5('0x1c')],'include':_0x528bf7[_0x44f5('0x1e')]?_[_0x44f5('0x20')](_0x528bf7['include'],function(_0x14d403){return{'model':db[_0x14d403[_0x44f5('0x1f')]],'as':_0x14d403['as'],'attributes':_0x14d403[_0x44f5('0x1c')],'include':_0x14d403[_0x44f5('0x1e')]?_['map'](_0x14d403[_0x44f5('0x1e')],function(_0x2071e5){return{'model':db[_0x2071e5[_0x44f5('0x1f')]],'as':_0x2071e5['as'],'attributes':_0x2071e5[_0x44f5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x44f5('0x21')](function(_0x59d183){logger['info'](_0x44f5('0x25'),_0x49c70b);logger['debug'](_0x44f5('0x25'),_0x49c70b,JSON[_0x44f5('0x26')](_0x59d183));_0x7a916c(_0x59d183);})[_0x44f5('0x23')](function(_0x5da62b){logger[_0x44f5('0x14')](_0x44f5('0x25'),_0x5da62b[_0x44f5('0x16')],_0x49c70b);_0x187a5e(_0x2042d6[_0x44f5('0x14')](0x1f4,_0x5da62b[_0x44f5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2027007..fe20701 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 _0x285d=['save','remove','emit','register','length','smsQueue:','./smsQueue.events'];(function(_0x2f640d,_0x40bd1b){var _0x5dd3ae=function(_0x579f2f){while(--_0x579f2f){_0x2f640d['push'](_0x2f640d['shift']());}};_0x5dd3ae(++_0x40bd1b);}(_0x285d,0x133));var _0xd285=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x285d[_0x5447fd];return _0x15b28a;};'use strict';var SmsQueueEvents=require(_0xd285('0x0'));var events=[_0xd285('0x1'),_0xd285('0x2'),'update'];function createListener(_0x2d0603,_0x1f06ff){return function(_0x12273c){_0x1f06ff[_0xd285('0x3')](_0x2d0603,_0x12273c);};}function removeListener(_0x452a5d,_0x52289a){return function(){SmsQueueEvents['removeListener'](_0x452a5d,_0x52289a);};}exports[_0xd285('0x4')]=function(_0x49b5f6){for(var _0x5d3e23=0x0,_0x5eb1ea=events[_0xd285('0x5')];_0x5d3e23<_0x5eb1ea;_0x5d3e23++){var _0x25f66b=events[_0x5d3e23];var _0x4122e0=createListener(_0xd285('0x6')+_0x25f66b,_0x49b5f6);SmsQueueEvents['on'](_0x25f66b,_0x4122e0);}}; \ No newline at end of file +var _0x8899=['length','smsQueue:','./smsQueue.events','save','update','removeListener','register'];(function(_0x135573,_0x479526){var _0x13ea56=function(_0x49c990){while(--_0x49c990){_0x135573['push'](_0x135573['shift']());}};_0x13ea56(++_0x479526);}(_0x8899,0xaa));var _0x9889=function(_0x5ef663,_0x496095){_0x5ef663=_0x5ef663-0x0;var _0x4cfd9b=_0x8899[_0x5ef663];return _0x4cfd9b;};'use strict';var SmsQueueEvents=require(_0x9889('0x0'));var events=[_0x9889('0x1'),'remove',_0x9889('0x2')];function createListener(_0x2cd908,_0x4eaf5e){return function(_0x5024d0){_0x4eaf5e['emit'](_0x2cd908,_0x5024d0);};}function removeListener(_0xb14e88,_0x2e0886){return function(){SmsQueueEvents[_0x9889('0x3')](_0xb14e88,_0x2e0886);};}exports[_0x9889('0x4')]=function(_0x4c6c90){for(var _0x5d54a4=0x0,_0x3635d9=events[_0x9889('0x5')];_0x5d54a4<_0x3635d9;_0x5d54a4++){var _0x953d3b=events[_0x5d54a4];var _0x80956=createListener(_0x9889('0x6')+_0x953d3b,_0x4c6c90);SmsQueueEvents['on'](_0x953d3b,_0x80956);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8f5e414..f77eb2a 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 _0xe984=['show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x451177,_0x3c6daa){var _0x493f37=function(_0x28dc64){while(--_0x28dc64){_0x451177['push'](_0x451177['shift']());}};_0x493f37(++_0x3c6daa);}(_0xe984,0xe2));var _0x4e98=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xe984[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require(_0x4e98('0x0'));var path=require(_0x4e98('0x1'));var timeout=require(_0x4e98('0x2'));var express=require(_0x4e98('0x3'));var router=express[_0x4e98('0x4')]();var fs_extra=require(_0x4e98('0x5'));var auth=require(_0x4e98('0x6'));var interaction=require(_0x4e98('0x7'));var config=require(_0x4e98('0x8'));var controller=require(_0x4e98('0x9'));router['get']('/',auth[_0x4e98('0xa')](),controller[_0x4e98('0xb')]);router[_0x4e98('0xc')](_0x4e98('0xd'),auth['isAuthenticated'](),controller[_0x4e98('0xe')]);router[_0x4e98('0xc')](_0x4e98('0xf'),auth[_0x4e98('0xa')](),controller[_0x4e98('0x10')]);router['post']('/',auth[_0x4e98('0xa')](),controller['create']);router[_0x4e98('0x11')](_0x4e98('0xf'),auth[_0x4e98('0xa')](),controller[_0x4e98('0x12')]);router[_0x4e98('0x13')]('/:id',auth[_0x4e98('0xa')](),controller[_0x4e98('0x14')]);module[_0x4e98('0x15')]=router; \ No newline at end of file +var _0x448b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x448b,0x125));var _0xb448=function(_0x2abfd9,_0x50504f){_0x2abfd9=_0x2abfd9-0x0;var _0x326a8a=_0x448b[_0x2abfd9];return _0x326a8a;};'use strict';var multer=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var path=require(_0xb448('0x2'));var timeout=require(_0xb448('0x3'));var express=require(_0xb448('0x4'));var router=express[_0xb448('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb448('0x6'));var interaction=require(_0xb448('0x7'));var config=require(_0xb448('0x8'));var controller=require(_0xb448('0x9'));router[_0xb448('0xa')]('/',auth[_0xb448('0xb')](),controller[_0xb448('0xc')]);router['get'](_0xb448('0xd'),auth[_0xb448('0xb')](),controller[_0xb448('0xe')]);router[_0xb448('0xa')](_0xb448('0xf'),auth[_0xb448('0xb')](),controller[_0xb448('0x10')]);router[_0xb448('0x11')]('/',auth['isAuthenticated'](),controller[_0xb448('0x12')]);router[_0xb448('0x13')](_0xb448('0xf'),auth[_0xb448('0xb')](),controller[_0xb448('0x14')]);router[_0xb448('0x15')]('/:id',auth[_0xb448('0xb')](),controller['destroy']);module[_0xb448('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b90c193..d914a19 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 _0x76da=['STRING','DATE','moment','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x76da,0x15e));var _0xa76d=function(_0xed5b08,_0x17f24f){_0xed5b08=_0xed5b08-0x0;var _0x5b319a=_0x76da[_0xed5b08];return _0x5b319a;};'use strict';var moment=require(_0xa76d('0x0'));var Sequelize=require('sequelize');module[_0xa76d('0x1')]={'uniqueid':{'type':Sequelize[_0xa76d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa76d('0x2')]},'joinAt':{'type':Sequelize[_0xa76d('0x3')]},'leaveAt':{'type':Sequelize[_0xa76d('0x3')]},'acceptAt':{'type':Sequelize[_0xa76d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa76d('0x2')]}}; \ No newline at end of file +var _0x6227=['STRING','DATE','moment','sequelize','exports'];(function(_0x5b770e,_0x4a2319){var _0x5aa0de=function(_0x2faa6b){while(--_0x2faa6b){_0x5b770e['push'](_0x5b770e['shift']());}};_0x5aa0de(++_0x4a2319);}(_0x6227,0x6b));var _0x7622=function(_0x21b948,_0x452b83){_0x21b948=_0x21b948-0x0;var _0x3ac1fd=_0x6227[_0x21b948];return _0x3ac1fd;};'use strict';var moment=require(_0x7622('0x0'));var Sequelize=require(_0x7622('0x1'));module[_0x7622('0x2')]={'uniqueid':{'type':Sequelize[_0x7622('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7622('0x3')]},'joinAt':{'type':Sequelize[_0x7622('0x4')]},'leaveAt':{'type':Sequelize[_0x7622('0x4')]},'acceptAt':{'type':Sequelize[_0x7622('0x4')]},'exitAt':{'type':Sequelize[_0x7622('0x4')]},'reason':{'type':Sequelize[_0x7622('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b8a1378..7115cfa 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 _0xb8a4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','SmsQueueReport','includeAll','include','catch','show','params','keys','intersection','length','create','body','find','destroy','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb8a4,0x149));var _0x4b8a=function(_0x3a9c2d,_0x4e2d78){_0x3a9c2d=_0x3a9c2d-0x0;var _0x3d4492=_0xb8a4[_0x3a9c2d];return _0x3d4492;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4b8a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b8a('0x1'));var moment=require(_0x4b8a('0x2'));var BPromise=require(_0x4b8a('0x3'));var Mustache=require(_0x4b8a('0x4'));var util=require(_0x4b8a('0x5'));var path=require(_0x4b8a('0x6'));var sox=require(_0x4b8a('0x7'));var csv=require(_0x4b8a('0x8'));var ejs=require(_0x4b8a('0x9'));var fs=require('fs');var fs_extra=require(_0x4b8a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4b8a('0x8'));var querystring=require(_0x4b8a('0xb'));var Papa=require(_0x4b8a('0xc'));var Redis=require(_0x4b8a('0xd'));var authService=require(_0x4b8a('0xe'));var qs=require(_0x4b8a('0xf'));var as=require(_0x4b8a('0x10'));var hardwareService=require(_0x4b8a('0x11'));var logger=require(_0x4b8a('0x12'))(_0x4b8a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b8a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a4fbf,_0x578fb2){_0x578fb2=_0x578fb2||0xcc;return function(_0x5cfd37){if(_0x5cfd37){return _0x5a4fbf[_0x4b8a('0x15')](_0x578fb2);}return _0x5a4fbf['status'](_0x578fb2)[_0x4b8a('0x16')]();};}function respondWithResult(_0x336113,_0x123d8c){_0x123d8c=_0x123d8c||0xc8;return function(_0x2c6efe){if(_0x2c6efe){return _0x336113[_0x4b8a('0x17')](_0x123d8c)[_0x4b8a('0x18')](_0x2c6efe);}};}function respondWithFilteredResult(_0x177765,_0x445a7b){return function(_0x140aec){if(_0x140aec){var _0x2cad97=typeof _0x445a7b['offset']==='undefined'&&typeof _0x445a7b['limit']==='undefined';var _0x2c173d=_0x140aec[_0x4b8a('0x19')];var _0x44ca8c=_0x2cad97?0x0:_0x445a7b['offset'];var _0x18a941=_0x2cad97?_0x140aec[_0x4b8a('0x19')]:_0x445a7b[_0x4b8a('0x1a')]+_0x445a7b[_0x4b8a('0x1b')];var _0x24544c;if(_0x18a941>=_0x2c173d){_0x18a941=_0x2c173d;_0x24544c=0xc8;}else{_0x24544c=0xce;}_0x177765['status'](_0x24544c);return _0x177765[_0x4b8a('0x1c')](_0x4b8a('0x1d'),_0x44ca8c+'-'+_0x18a941+'/'+_0x2c173d)[_0x4b8a('0x18')](_0x140aec);}return null;};}function patchUpdates(_0xdc0a7a){return function(_0x525144){try{jsonpatch[_0x4b8a('0x1e')](_0x525144,_0xdc0a7a,!![]);}catch(_0x3532e1){return BPromise[_0x4b8a('0x1f')](_0x3532e1);}return _0x525144[_0x4b8a('0x20')]();};}function saveUpdates(_0x10efb4,_0x1f6ca3){return function(_0x1a3bc2){if(_0x1a3bc2){return _0x1a3bc2[_0x4b8a('0x21')](_0x10efb4)[_0x4b8a('0x22')](function(_0x5da43f){return _0x5da43f;});}return null;};}function removeEntity(_0x52521b,_0x393533){return function(_0x3efee9){if(_0x3efee9){return _0x3efee9['destroy']()[_0x4b8a('0x22')](function(){_0x52521b[_0x4b8a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf4cb,_0x503eaa){return function(_0x3478f9){if(!_0x3478f9){_0x1cf4cb[_0x4b8a('0x15')](0x194);}return _0x3478f9;};}function handleError(_0x23f28c,_0x44bbac){_0x44bbac=_0x44bbac||0x1f4;return function(_0x11709f){logger[_0x4b8a('0x23')](_0x11709f[_0x4b8a('0x24')]);if(_0x11709f[_0x4b8a('0x25')]){delete _0x11709f[_0x4b8a('0x25')];}_0x23f28c[_0x4b8a('0x17')](_0x44bbac)[_0x4b8a('0x26')](_0x11709f);};}exports['index']=function(_0x336051,_0x5bf6e3){var _0x26e521={},_0x41dcee={},_0x57584e={'count':0x0,'rows':[]};var _0xde817d=_[_0x4b8a('0x27')](db['SmsQueueReport'][_0x4b8a('0x28')],function(_0x3184a7){return{'name':_0x3184a7[_0x4b8a('0x29')],'type':_0x3184a7[_0x4b8a('0x2a')][_0x4b8a('0x2b')]};});_0x41dcee[_0x4b8a('0x2c')]=_[_0x4b8a('0x27')](_0xde817d,_0x4b8a('0x25'));_0x41dcee[_0x4b8a('0x2d')]=_['keys'](_0x336051[_0x4b8a('0x2d')]);_0x41dcee['filters']=_['intersection'](_0x41dcee[_0x4b8a('0x2c')],_0x41dcee[_0x4b8a('0x2d')]);_0x26e521['attributes']=_['intersection'](_0x41dcee[_0x4b8a('0x2c')],qs[_0x4b8a('0x2e')](_0x336051['query'][_0x4b8a('0x2e')]));_0x26e521[_0x4b8a('0x2f')]=_0x26e521['attributes']['length']?_0x26e521[_0x4b8a('0x2f')]:_0x41dcee[_0x4b8a('0x2c')];if(!_0x336051[_0x4b8a('0x2d')][_0x4b8a('0x30')]('nolimit')){_0x26e521[_0x4b8a('0x1b')]=qs[_0x4b8a('0x1b')](_0x336051[_0x4b8a('0x2d')][_0x4b8a('0x1b')]);_0x26e521[_0x4b8a('0x1a')]=qs['offset'](_0x336051[_0x4b8a('0x2d')]['offset']);}_0x26e521['order']=qs[_0x4b8a('0x31')](_0x336051['query'][_0x4b8a('0x31')]);_0x26e521[_0x4b8a('0x32')]=qs[_0x4b8a('0x33')](_[_0x4b8a('0x34')](_0x336051[_0x4b8a('0x2d')],_0x41dcee['filters']),_0xde817d);if(_0x336051[_0x4b8a('0x2d')][_0x4b8a('0x35')]){_0x26e521[_0x4b8a('0x32')]=_['merge'](_0x26e521[_0x4b8a('0x32')],{'$or':_[_0x4b8a('0x27')](_0xde817d,function(_0x14b90b){if(_0x14b90b[_0x4b8a('0x2a')]!=='VIRTUAL'){var _0x73c0={};_0x73c0[_0x14b90b[_0x4b8a('0x25')]]={'$like':'%'+_0x336051[_0x4b8a('0x2d')]['filter']+'%'};return _0x73c0;}})});}_0x26e521=_[_0x4b8a('0x36')]({},_0x26e521,_0x336051['options']);var _0x39d0b6={'where':_0x26e521[_0x4b8a('0x32')]};return db[_0x4b8a('0x37')][_0x4b8a('0x19')](_0x39d0b6)[_0x4b8a('0x22')](function(_0x15ec34){_0x57584e[_0x4b8a('0x19')]=_0x15ec34;if(_0x336051[_0x4b8a('0x2d')][_0x4b8a('0x38')]){_0x26e521[_0x4b8a('0x39')]=[{'all':!![]}];}return db[_0x4b8a('0x37')]['findAll'](_0x26e521);})[_0x4b8a('0x22')](function(_0x574657){_0x57584e['rows']=_0x574657;return _0x57584e;})['then'](respondWithFilteredResult(_0x5bf6e3,_0x26e521))[_0x4b8a('0x3a')](handleError(_0x5bf6e3,null));};exports[_0x4b8a('0x3b')]=function(_0x4e857d,_0x3a0ef8){var _0x389293={'raw':!![],'where':{'id':_0x4e857d[_0x4b8a('0x3c')]['id']}},_0xb5f6d4={};_0xb5f6d4['model']=_[_0x4b8a('0x3d')](db[_0x4b8a('0x37')][_0x4b8a('0x28')]);_0xb5f6d4[_0x4b8a('0x2d')]=_[_0x4b8a('0x3d')](_0x4e857d[_0x4b8a('0x2d')]);_0xb5f6d4[_0x4b8a('0x33')]=_[_0x4b8a('0x3e')](_0xb5f6d4['model'],_0xb5f6d4[_0x4b8a('0x2d')]);_0x389293[_0x4b8a('0x2f')]=_[_0x4b8a('0x3e')](_0xb5f6d4[_0x4b8a('0x2c')],qs[_0x4b8a('0x2e')](_0x4e857d['query'][_0x4b8a('0x2e')]));_0x389293[_0x4b8a('0x2f')]=_0x389293[_0x4b8a('0x2f')][_0x4b8a('0x3f')]?_0x389293['attributes']:_0xb5f6d4[_0x4b8a('0x2c')];if(_0x4e857d[_0x4b8a('0x2d')][_0x4b8a('0x38')]){_0x389293[_0x4b8a('0x39')]=[{'all':!![]}];}_0x389293=_[_0x4b8a('0x36')]({},_0x389293,_0x4e857d['options']);return db[_0x4b8a('0x37')]['find'](_0x389293)[_0x4b8a('0x22')](handleEntityNotFound(_0x3a0ef8,null))[_0x4b8a('0x22')](respondWithResult(_0x3a0ef8,null))['catch'](handleError(_0x3a0ef8,null));};exports['create']=function(_0x3f1298,_0x4a867d){return db[_0x4b8a('0x37')][_0x4b8a('0x40')](_0x3f1298[_0x4b8a('0x41')],{})[_0x4b8a('0x22')](respondWithResult(_0x4a867d,0xc9))[_0x4b8a('0x3a')](handleError(_0x4a867d,null));};exports[_0x4b8a('0x21')]=function(_0x37885b,_0x1ea723){if(_0x37885b[_0x4b8a('0x41')]['id']){delete _0x37885b['body']['id'];}return db[_0x4b8a('0x37')][_0x4b8a('0x42')]({'where':{'id':_0x37885b[_0x4b8a('0x3c')]['id']}})[_0x4b8a('0x22')](handleEntityNotFound(_0x1ea723,null))['then'](saveUpdates(_0x37885b[_0x4b8a('0x41')],null))[_0x4b8a('0x22')](respondWithResult(_0x1ea723,null))[_0x4b8a('0x3a')](handleError(_0x1ea723,null));};exports[_0x4b8a('0x43')]=function(_0x15e361,_0x1d3d43){return db[_0x4b8a('0x37')][_0x4b8a('0x42')]({'where':{'id':_0x15e361[_0x4b8a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1d3d43,null))[_0x4b8a('0x22')](removeEntity(_0x1d3d43,null))[_0x4b8a('0x3a')](handleError(_0x1d3d43,null));};exports[_0x4b8a('0x44')]=function(_0x2c6c58,_0x1c26fc){return db[_0x4b8a('0x37')][_0x4b8a('0x44')]()[_0x4b8a('0x22')](respondWithResult(_0x1c26fc,null))['catch'](handleError(_0x1c26fc,null));}; \ No newline at end of file +var _0xb559=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','show','find','catch','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key'];(function(_0x5dde06,_0x475301){var _0x1ab2ac=function(_0x27172f){while(--_0x27172f){_0x5dde06['push'](_0x5dde06['shift']());}};_0x1ab2ac(++_0x475301);}(_0xb559,0x150));var _0x9b55=function(_0x92b4dc,_0x20f18a){_0x92b4dc=_0x92b4dc-0x0;var _0xe68d92=_0xb559[_0x92b4dc];return _0xe68d92;};'use strict';var emlformat=require(_0x9b55('0x0'));var rimraf=require(_0x9b55('0x1'));var zipdir=require(_0x9b55('0x2'));var jsonpatch=require(_0x9b55('0x3'));var rp=require('request-promise');var moment=require(_0x9b55('0x4'));var BPromise=require(_0x9b55('0x5'));var Mustache=require(_0x9b55('0x6'));var util=require(_0x9b55('0x7'));var path=require(_0x9b55('0x8'));var sox=require(_0x9b55('0x9'));var csv=require(_0x9b55('0xa'));var ejs=require(_0x9b55('0xb'));var fs=require('fs');var fs_extra=require(_0x9b55('0xc'));var _=require(_0x9b55('0xd'));var squel=require(_0x9b55('0xe'));var crypto=require(_0x9b55('0xf'));var jsforce=require(_0x9b55('0x10'));var deskjs=require(_0x9b55('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9b55('0x12'));var Papa=require(_0x9b55('0x13'));var Redis=require('ioredis');var authService=require(_0x9b55('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9b55('0x15'));var hardwareService=require(_0x9b55('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9b55('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9b55('0x18'));var db=require(_0x9b55('0x19'))['db'];function respondWithStatusCode(_0x533ba3,_0x50c932){_0x50c932=_0x50c932||0xcc;return function(_0x51cb8e){if(_0x51cb8e){return _0x533ba3[_0x9b55('0x1a')](_0x50c932);}return _0x533ba3[_0x9b55('0x1b')](_0x50c932)[_0x9b55('0x1c')]();};}function respondWithResult(_0x2e5556,_0x79e1d7){_0x79e1d7=_0x79e1d7||0xc8;return function(_0x39d929){if(_0x39d929){return _0x2e5556[_0x9b55('0x1b')](_0x79e1d7)[_0x9b55('0x1d')](_0x39d929);}};}function respondWithFilteredResult(_0x44c28b,_0x2c5978){return function(_0x3255a7){if(_0x3255a7){var _0x54af86=typeof _0x2c5978['offset']===_0x9b55('0x1e')&&typeof _0x2c5978[_0x9b55('0x1f')]===_0x9b55('0x1e');var _0x13524a=_0x3255a7['count'];var _0x44c953=_0x54af86?0x0:_0x2c5978[_0x9b55('0x20')];var _0x47c565=_0x54af86?_0x3255a7[_0x9b55('0x21')]:_0x2c5978['offset']+_0x2c5978[_0x9b55('0x1f')];var _0x688a67;if(_0x47c565>=_0x13524a){_0x47c565=_0x13524a;_0x688a67=0xc8;}else{_0x688a67=0xce;}_0x44c28b[_0x9b55('0x1b')](_0x688a67);return _0x44c28b['set'](_0x9b55('0x22'),_0x44c953+'-'+_0x47c565+'/'+_0x13524a)[_0x9b55('0x1d')](_0x3255a7);}return null;};}function patchUpdates(_0x2fdf80){return function(_0x12692d){try{jsonpatch[_0x9b55('0x23')](_0x12692d,_0x2fdf80,!![]);}catch(_0x53f340){return BPromise[_0x9b55('0x24')](_0x53f340);}return _0x12692d[_0x9b55('0x25')]();};}function saveUpdates(_0x2a2229,_0x64245d){return function(_0x10ef89){if(_0x10ef89){return _0x10ef89['update'](_0x2a2229)['then'](function(_0x270e65){return _0x270e65;});}return null;};}function removeEntity(_0x3588f6,_0x13935b){return function(_0x2b1079){if(_0x2b1079){return _0x2b1079['destroy']()[_0x9b55('0x26')](function(){_0x3588f6[_0x9b55('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42c874,_0x5c650d){return function(_0x285d0d){if(!_0x285d0d){_0x42c874[_0x9b55('0x1a')](0x194);}return _0x285d0d;};}function handleError(_0xb87620,_0x102d25){_0x102d25=_0x102d25||0x1f4;return function(_0x1e9b40){logger[_0x9b55('0x27')](_0x1e9b40[_0x9b55('0x28')]);if(_0x1e9b40[_0x9b55('0x29')]){delete _0x1e9b40['name'];}_0xb87620[_0x9b55('0x1b')](_0x102d25)['send'](_0x1e9b40);};}exports[_0x9b55('0x2a')]=function(_0x53d1d3,_0x58b98b){var _0x2b9701={},_0x491fb7={},_0x45fd39={'count':0x0,'rows':[]};var _0x5d8c7a=_[_0x9b55('0x2b')](db[_0x9b55('0x2c')][_0x9b55('0x2d')],function(_0x468f0d){return{'name':_0x468f0d[_0x9b55('0x2e')],'type':_0x468f0d[_0x9b55('0x2f')][_0x9b55('0x30')]};});_0x491fb7[_0x9b55('0x31')]=_[_0x9b55('0x2b')](_0x5d8c7a,_0x9b55('0x29'));_0x491fb7[_0x9b55('0x32')]=_[_0x9b55('0x33')](_0x53d1d3[_0x9b55('0x32')]);_0x491fb7[_0x9b55('0x34')]=_[_0x9b55('0x35')](_0x491fb7[_0x9b55('0x31')],_0x491fb7[_0x9b55('0x32')]);_0x2b9701[_0x9b55('0x36')]=_[_0x9b55('0x35')](_0x491fb7[_0x9b55('0x31')],qs[_0x9b55('0x37')](_0x53d1d3[_0x9b55('0x32')][_0x9b55('0x37')]));_0x2b9701[_0x9b55('0x36')]=_0x2b9701[_0x9b55('0x36')][_0x9b55('0x38')]?_0x2b9701['attributes']:_0x491fb7['model'];if(!_0x53d1d3['query'][_0x9b55('0x39')](_0x9b55('0x3a'))){_0x2b9701[_0x9b55('0x1f')]=qs[_0x9b55('0x1f')](_0x53d1d3['query'][_0x9b55('0x1f')]);_0x2b9701[_0x9b55('0x20')]=qs[_0x9b55('0x20')](_0x53d1d3[_0x9b55('0x32')][_0x9b55('0x20')]);}_0x2b9701[_0x9b55('0x3b')]=qs[_0x9b55('0x3c')](_0x53d1d3[_0x9b55('0x32')][_0x9b55('0x3c')]);_0x2b9701[_0x9b55('0x3d')]=qs['filters'](_['pick'](_0x53d1d3[_0x9b55('0x32')],_0x491fb7['filters']),_0x5d8c7a);if(_0x53d1d3['query']['filter']){_0x2b9701[_0x9b55('0x3d')]=_[_0x9b55('0x3e')](_0x2b9701[_0x9b55('0x3d')],{'$or':_[_0x9b55('0x2b')](_0x5d8c7a,function(_0x416d74){if(_0x416d74[_0x9b55('0x2f')]!==_0x9b55('0x3f')){var _0x33193e={};_0x33193e[_0x416d74[_0x9b55('0x29')]]={'$like':'%'+_0x53d1d3[_0x9b55('0x32')][_0x9b55('0x40')]+'%'};return _0x33193e;}})});}_0x2b9701=_['merge']({},_0x2b9701,_0x53d1d3['options']);var _0x66fa82={'where':_0x2b9701['where']};return db[_0x9b55('0x2c')][_0x9b55('0x21')](_0x66fa82)[_0x9b55('0x26')](function(_0x50bbdb){_0x45fd39['count']=_0x50bbdb;if(_0x53d1d3['query'][_0x9b55('0x41')]){_0x2b9701['include']=[{'all':!![]}];}return db[_0x9b55('0x2c')][_0x9b55('0x42')](_0x2b9701);})[_0x9b55('0x26')](function(_0x5c3fc8){_0x45fd39[_0x9b55('0x43')]=_0x5c3fc8;return _0x45fd39;})['then'](respondWithFilteredResult(_0x58b98b,_0x2b9701))['catch'](handleError(_0x58b98b,null));};exports[_0x9b55('0x44')]=function(_0x996c6d,_0x1b3f51){var _0x407993={'raw':!![],'where':{'id':_0x996c6d['params']['id']}},_0x3d2f7e={};_0x3d2f7e[_0x9b55('0x31')]=_[_0x9b55('0x33')](db[_0x9b55('0x2c')][_0x9b55('0x2d')]);_0x3d2f7e[_0x9b55('0x32')]=_[_0x9b55('0x33')](_0x996c6d[_0x9b55('0x32')]);_0x3d2f7e[_0x9b55('0x34')]=_[_0x9b55('0x35')](_0x3d2f7e[_0x9b55('0x31')],_0x3d2f7e[_0x9b55('0x32')]);_0x407993[_0x9b55('0x36')]=_['intersection'](_0x3d2f7e['model'],qs[_0x9b55('0x37')](_0x996c6d[_0x9b55('0x32')][_0x9b55('0x37')]));_0x407993[_0x9b55('0x36')]=_0x407993[_0x9b55('0x36')][_0x9b55('0x38')]?_0x407993[_0x9b55('0x36')]:_0x3d2f7e[_0x9b55('0x31')];if(_0x996c6d[_0x9b55('0x32')][_0x9b55('0x41')]){_0x407993['include']=[{'all':!![]}];}_0x407993=_[_0x9b55('0x3e')]({},_0x407993,_0x996c6d['options']);return db['SmsQueueReport'][_0x9b55('0x45')](_0x407993)['then'](handleEntityNotFound(_0x1b3f51,null))['then'](respondWithResult(_0x1b3f51,null))[_0x9b55('0x46')](handleError(_0x1b3f51,null));};exports[_0x9b55('0x47')]=function(_0x513f75,_0x5d5521){return db[_0x9b55('0x2c')][_0x9b55('0x47')](_0x513f75[_0x9b55('0x48')],{})[_0x9b55('0x26')](respondWithResult(_0x5d5521,0xc9))[_0x9b55('0x46')](handleError(_0x5d5521,null));};exports[_0x9b55('0x49')]=function(_0x88bd84,_0x326a6f){if(_0x88bd84[_0x9b55('0x48')]['id']){delete _0x88bd84[_0x9b55('0x48')]['id'];}return db[_0x9b55('0x2c')][_0x9b55('0x45')]({'where':{'id':_0x88bd84[_0x9b55('0x4a')]['id']}})[_0x9b55('0x26')](handleEntityNotFound(_0x326a6f,null))[_0x9b55('0x26')](saveUpdates(_0x88bd84[_0x9b55('0x48')],null))['then'](respondWithResult(_0x326a6f,null))['catch'](handleError(_0x326a6f,null));};exports[_0x9b55('0x4b')]=function(_0x46bf16,_0x14df68){return db[_0x9b55('0x2c')]['find']({'where':{'id':_0x46bf16['params']['id']}})[_0x9b55('0x26')](handleEntityNotFound(_0x14df68,null))['then'](removeEntity(_0x14df68,null))['catch'](handleError(_0x14df68,null));};exports[_0x9b55('0x4c')]=function(_0x3cd882,_0x4bed4e){return db['SmsQueueReport']['describe']()[_0x9b55('0x26')](respondWithResult(_0x4bed4e,null))[_0x9b55('0x46')](handleError(_0x4bed4e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 135f209..01ec062 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x138d29,_0x5653e3){var _0x430dba=function(_0x5644d3){while(--_0x5644d3){_0x138d29['push'](_0x138d29['shift']());}};_0x430dba(++_0x5653e3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xcb91[_0x4232d8];return _0x324de2;};'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')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'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(_0x13c386,_0x3e1231){var _0x17e909=function(_0x3f2871){while(--_0x3f2871){_0x13c386['push'](_0x13c386['shift']());}};_0x17e909(++_0x3e1231);}(_0x70e0,0x17b));var _0x070e=function(_0x16d5b9,_0x20c1b8){_0x16d5b9=_0x16d5b9-0x0;var _0x5be8cb=_0x70e0[_0x16d5b9];return _0x5be8cb;};'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 c340da9..acfe1d4 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 _0x4571=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4571,0x1a6));var _0x1457=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x4571[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x1457('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1457('0x1'));var rs=require(_0x1457('0x2'));var fs=require('fs');var Redis=require(_0x1457('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1457('0x4'));var logger=require(_0x1457('0x5'))(_0x1457('0x6'));var config=require(_0x1457('0x7'));var jayson=require(_0x1457('0x8'));var client=jayson[_0x1457('0x9')][_0x1457('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf149ab,_0x10a803,_0x44f3f8){return new BPromise(function(_0x31aa89,_0x2e04b3){return client[_0x1457('0xb')](_0xf149ab,_0x44f3f8)[_0x1457('0xc')](function(_0x4ee601){logger[_0x1457('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x10a803,_0x1457('0xe'));logger[_0x1457('0xf')](_0x1457('0x10'),_0x10a803,_0x1457('0xe'),JSON[_0x1457('0x11')](_0x4ee601));if(_0x4ee601[_0x1457('0x12')]){if(_0x4ee601[_0x1457('0x12')][_0x1457('0x13')]===0x1f4){logger[_0x1457('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x10a803,_0x4ee601['error']['message']);return _0x2e04b3(_0x4ee601[_0x1457('0x12')][_0x1457('0x14')]);}logger[_0x1457('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x10a803,_0x4ee601[_0x1457('0x12')][_0x1457('0x14')]);return _0x31aa89(_0x4ee601[_0x1457('0x12')][_0x1457('0x14')]);}else{logger[_0x1457('0xd')](_0x1457('0x15'),_0x10a803,'request\x20sent');_0x31aa89(_0x4ee601['result']['message']);}})[_0x1457('0x16')](function(_0x5bfe5c){logger[_0x1457('0x12')](_0x1457('0x15'),_0x10a803,_0x5bfe5c);_0x2e04b3(_0x5bfe5c);});});}exports[_0x1457('0x17')]=function(_0x264c47){var _0x9fb142=this;return new Promise(function(_0x2410c5,_0x595f5f){return db[_0x1457('0x18')]['create'](_0x264c47[_0x1457('0x19')],{'raw':_0x264c47[_0x1457('0x1a')]?_0x264c47[_0x1457('0x1a')][_0x1457('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x58497e){logger[_0x1457('0xd')](_0x1457('0x17'),_0x264c47);logger[_0x1457('0xf')](_0x1457('0x17'),_0x264c47,JSON[_0x1457('0x11')](_0x58497e));_0x2410c5(_0x58497e);})[_0x1457('0x16')](function(_0x2063f2){logger[_0x1457('0x12')]('CreateSmsQueueReport',_0x2063f2[_0x1457('0x14')],_0x264c47);_0x595f5f(_0x9fb142['error'](0x1f4,_0x2063f2[_0x1457('0x14')]));});});};exports[_0x1457('0x1c')]=function(_0x293fbf){var _0x1819a9=this;return new Promise(function(_0x1bacd9,_0x1f7757){return db[_0x1457('0x18')][_0x1457('0x1d')](_0x293fbf[_0x1457('0x19')],{'raw':_0x293fbf['options']?_0x293fbf[_0x1457('0x1a')][_0x1457('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293fbf['options']?_0x293fbf[_0x1457('0x1a')][_0x1457('0x1e')]||null:null,'attributes':_0x293fbf[_0x1457('0x1a')]?_0x293fbf[_0x1457('0x1a')][_0x1457('0x1f')]||null:null,'limit':_0x293fbf[_0x1457('0x1a')]?_0x293fbf['options'][_0x1457('0x20')]||null:null})['then'](function(_0x10a2a8){logger[_0x1457('0xd')](_0x1457('0x1c'),_0x293fbf);logger[_0x1457('0xf')](_0x1457('0x1c'),_0x293fbf,JSON[_0x1457('0x11')](_0x10a2a8));_0x1bacd9(_0x10a2a8);})[_0x1457('0x16')](function(_0x54fe99){logger[_0x1457('0x12')]('UpdateSmsQueueReport',_0x54fe99[_0x1457('0x14')],_0x293fbf);_0x1f7757(_0x1819a9['error'](0x1f4,_0x54fe99[_0x1457('0x14')]));});});}; \ No newline at end of file +var _0xbcc8=['raw','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options'];(function(_0x1c2b1f,_0x1c6f22){var _0x8baefe=function(_0x24033a){while(--_0x24033a){_0x1c2b1f['push'](_0x1c2b1f['shift']());}};_0x8baefe(++_0x1c6f22);}(_0xbcc8,0x17d));var _0x8bcc=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0xbcc8[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0x8bcc('0x0'));var util=require('util');var moment=require(_0x8bcc('0x1'));var BPromise=require(_0x8bcc('0x2'));var rs=require(_0x8bcc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bcc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bcc('0x5'))('rpc');var config=require(_0x8bcc('0x6'));var jayson=require(_0x8bcc('0x7'));var client=jayson[_0x8bcc('0x8')][_0x8bcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x571d29,_0x342bb8,_0x35eee4){return new BPromise(function(_0x365957,_0x5308c3){return client[_0x8bcc('0xa')](_0x571d29,_0x35eee4)[_0x8bcc('0xb')](function(_0x1da7dc){logger['info'](_0x8bcc('0xc'),_0x342bb8,_0x8bcc('0xd'));logger[_0x8bcc('0xe')](_0x8bcc('0xf'),_0x342bb8,_0x8bcc('0xd'),JSON[_0x8bcc('0x10')](_0x1da7dc));if(_0x1da7dc[_0x8bcc('0x11')]){if(_0x1da7dc[_0x8bcc('0x11')][_0x8bcc('0x12')]===0x1f4){logger[_0x8bcc('0x11')](_0x8bcc('0xc'),_0x342bb8,_0x1da7dc['error'][_0x8bcc('0x13')]);return _0x5308c3(_0x1da7dc['error'][_0x8bcc('0x13')]);}logger['error'](_0x8bcc('0xc'),_0x342bb8,_0x1da7dc[_0x8bcc('0x11')][_0x8bcc('0x13')]);return _0x365957(_0x1da7dc[_0x8bcc('0x11')][_0x8bcc('0x13')]);}else{logger[_0x8bcc('0x14')](_0x8bcc('0xc'),_0x342bb8,_0x8bcc('0xd'));_0x365957(_0x1da7dc[_0x8bcc('0x15')][_0x8bcc('0x13')]);}})[_0x8bcc('0x16')](function(_0x4cf824){logger[_0x8bcc('0x11')](_0x8bcc('0xc'),_0x342bb8,_0x4cf824);_0x5308c3(_0x4cf824);});});}exports[_0x8bcc('0x17')]=function(_0x489007){var _0x28de3d=this;return new Promise(function(_0x4069c9,_0x4a7e2e){return db[_0x8bcc('0x18')][_0x8bcc('0x19')](_0x489007['body'],{'raw':_0x489007[_0x8bcc('0x1a')]?_0x489007[_0x8bcc('0x1a')][_0x8bcc('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3b761a){logger[_0x8bcc('0x14')](_0x8bcc('0x17'),_0x489007);logger[_0x8bcc('0xe')](_0x8bcc('0x17'),_0x489007,JSON[_0x8bcc('0x10')](_0x3b761a));_0x4069c9(_0x3b761a);})[_0x8bcc('0x16')](function(_0x2ad9a0){logger[_0x8bcc('0x11')]('CreateSmsQueueReport',_0x2ad9a0[_0x8bcc('0x13')],_0x489007);_0x4a7e2e(_0x28de3d[_0x8bcc('0x11')](0x1f4,_0x2ad9a0[_0x8bcc('0x13')]));});});};exports[_0x8bcc('0x1c')]=function(_0x330c5a){var _0x4600fe=this;return new Promise(function(_0x297f1f,_0x5df963){return db[_0x8bcc('0x18')][_0x8bcc('0x1d')](_0x330c5a[_0x8bcc('0x1e')],{'raw':_0x330c5a[_0x8bcc('0x1a')]?_0x330c5a[_0x8bcc('0x1a')][_0x8bcc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x330c5a[_0x8bcc('0x1a')]?_0x330c5a[_0x8bcc('0x1a')][_0x8bcc('0x1f')]||null:null,'attributes':_0x330c5a[_0x8bcc('0x1a')]?_0x330c5a['options'][_0x8bcc('0x20')]||null:null,'limit':_0x330c5a[_0x8bcc('0x1a')]?_0x330c5a[_0x8bcc('0x1a')][_0x8bcc('0x21')]||null:null})['then'](function(_0x46c362){logger[_0x8bcc('0x14')](_0x8bcc('0x1c'),_0x330c5a);logger[_0x8bcc('0xe')](_0x8bcc('0x1c'),_0x330c5a,JSON[_0x8bcc('0x10')](_0x46c362));_0x297f1f(_0x46c362);})[_0x8bcc('0x16')](function(_0x2f8ead){logger[_0x8bcc('0x11')](_0x8bcc('0x1c'),_0x2f8ead[_0x8bcc('0x13')],_0x330c5a);_0x5df963(_0x4600fe['error'](0x1f4,_0x2f8ead[_0x8bcc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 0246f55..a1ffe76 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 _0x55ca=['create','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x83ebd,_0x133437){var _0x1f18cc=function(_0x22f920){while(--_0x22f920){_0x83ebd['push'](_0x83ebd['shift']());}};_0x1f18cc(++_0x133437);}(_0x55ca,0x126));var _0xa55c=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x55ca[_0x456a4b];return _0x42957c;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xf')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x08d9=['fs-extra','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','path','express','Router'];(function(_0x415322,_0x54057d){var _0x269af3=function(_0x1275cb){while(--_0x1275cb){_0x415322['push'](_0x415322['shift']());}};_0x269af3(++_0x54057d);}(_0x08d9,0xc2));var _0x908d=function(_0x4bd7cf,_0x29e2df){_0x4bd7cf=_0x4bd7cf-0x0;var _0xad6335=_0x08d9[_0x4bd7cf];return _0xad6335;};'use strict';var multer=require(_0x908d('0x0'));var util=require('util');var path=require(_0x908d('0x1'));var timeout=require('connect-timeout');var express=require(_0x908d('0x2'));var router=express[_0x908d('0x3')]();var fs_extra=require(_0x908d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x908d('0x5'));var controller=require(_0x908d('0x6'));router[_0x908d('0x7')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0x9')]);router['get'](_0x908d('0xa'),auth[_0x908d('0x8')](),controller[_0x908d('0xb')]);router[_0x908d('0x7')](_0x908d('0xc'),auth[_0x908d('0x8')](),controller[_0x908d('0xd')]);router[_0x908d('0xe')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0xf')]);router['put'](_0x908d('0xc'),auth[_0x908d('0x8')](),controller[_0x908d('0x10')]);router[_0x908d('0x11')](_0x908d('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1e20638..d5a64a9 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3ae306,_0x4fa845){var _0x508c9a=function(_0x1b8396){while(--_0x1b8396){_0x3ae306['push'](_0x3ae306['shift']());}};_0x508c9a(++_0x4fa845);}(_0x00bb,0x1d8));var _0xb00b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x00bb[_0x618414];return _0x21c19a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1ca0d3,_0x50fcdf){var _0xf1cd04=function(_0x589deb){while(--_0x589deb){_0x1ca0d3['push'](_0x1ca0d3['shift']());}};_0xf1cd04(++_0x50fcdf);}(_0x70e0,0x17b));var _0x070e=function(_0x12a166,_0x2d1198){_0x12a166=_0x12a166-0x0;var _0x23dcd4=_0x70e0[_0x12a166];return _0x23dcd4;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ca9fd66..b1a7b31 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 _0xd5a3=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','count','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','SmsTransferReport','includeAll','include','findAll','catch','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xa30c5d,_0x2934f6){var _0x280310=function(_0x2faa66){while(--_0x2faa66){_0xa30c5d['push'](_0xa30c5d['shift']());}};_0x280310(++_0x2934f6);}(_0xd5a3,0x78));var _0x3d5a=function(_0xa68cd9,_0x35b670){_0xa68cd9=_0xa68cd9-0x0;var _0x567abc=_0xd5a3[_0xa68cd9];return _0x567abc;};'use strict';var emlformat=require(_0x3d5a('0x0'));var rimraf=require(_0x3d5a('0x1'));var zipdir=require(_0x3d5a('0x2'));var jsonpatch=require(_0x3d5a('0x3'));var rp=require(_0x3d5a('0x4'));var moment=require(_0x3d5a('0x5'));var BPromise=require(_0x3d5a('0x6'));var Mustache=require(_0x3d5a('0x7'));var util=require(_0x3d5a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3d5a('0x9'));var ejs=require(_0x3d5a('0xa'));var fs=require('fs');var fs_extra=require(_0x3d5a('0xb'));var _=require(_0x3d5a('0xc'));var squel=require(_0x3d5a('0xd'));var crypto=require(_0x3d5a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3d5a('0xf'));var toCsv=require(_0x3d5a('0x9'));var querystring=require(_0x3d5a('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d5a('0x11'));var authService=require(_0x3d5a('0x12'));var qs=require(_0x3d5a('0x13'));var as=require(_0x3d5a('0x14'));var hardwareService=require(_0x3d5a('0x15'));var logger=require(_0x3d5a('0x16'))('api');var utils=require(_0x3d5a('0x17'));var config=require(_0x3d5a('0x18'));var licenseUtil=require(_0x3d5a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d3c30,_0x4f18e6){_0x4f18e6=_0x4f18e6||0xcc;return function(_0x275a0a){if(_0x275a0a){return _0x3d3c30['sendStatus'](_0x4f18e6);}return _0x3d3c30[_0x3d5a('0x1a')](_0x4f18e6)['end']();};}function respondWithResult(_0x10c1fe,_0xf98c5){_0xf98c5=_0xf98c5||0xc8;return function(_0x298a85){if(_0x298a85){return _0x10c1fe[_0x3d5a('0x1a')](_0xf98c5)[_0x3d5a('0x1b')](_0x298a85);}};}function respondWithFilteredResult(_0x393902,_0x4d3489){return function(_0x1ace1c){if(_0x1ace1c){var _0x209c46=typeof _0x4d3489[_0x3d5a('0x1c')]==='undefined'&&typeof _0x4d3489['limit']==='undefined';var _0x5d128f=_0x1ace1c[_0x3d5a('0x1d')];var _0x19045f=_0x209c46?0x0:_0x4d3489['offset'];var _0xeb233=_0x209c46?_0x1ace1c[_0x3d5a('0x1d')]:_0x4d3489[_0x3d5a('0x1c')]+_0x4d3489['limit'];var _0x1757f5;if(_0xeb233>=_0x5d128f){_0xeb233=_0x5d128f;_0x1757f5=0xc8;}else{_0x1757f5=0xce;}_0x393902[_0x3d5a('0x1a')](_0x1757f5);return _0x393902['set'](_0x3d5a('0x1e'),_0x19045f+'-'+_0xeb233+'/'+_0x5d128f)[_0x3d5a('0x1b')](_0x1ace1c);}return null;};}function patchUpdates(_0x5c9c31){return function(_0x23fee6){try{jsonpatch['apply'](_0x23fee6,_0x5c9c31,!![]);}catch(_0x398782){return BPromise[_0x3d5a('0x1f')](_0x398782);}return _0x23fee6[_0x3d5a('0x20')]();};}function saveUpdates(_0x3a969f,_0xf30ab1){return function(_0x36f9c7){if(_0x36f9c7){return _0x36f9c7[_0x3d5a('0x21')](_0x3a969f)[_0x3d5a('0x22')](function(_0x352ea6){return _0x352ea6;});}return null;};}function removeEntity(_0xde857e,_0x1af333){return function(_0x1d2301){if(_0x1d2301){return _0x1d2301[_0x3d5a('0x23')]()[_0x3d5a('0x22')](function(){_0xde857e[_0x3d5a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ee96a,_0x2c4098){return function(_0x479f36){if(!_0x479f36){_0x4ee96a['sendStatus'](0x194);}return _0x479f36;};}function handleError(_0x3a51d1,_0x4cefb3){_0x4cefb3=_0x4cefb3||0x1f4;return function(_0xfa878a){logger[_0x3d5a('0x24')](_0xfa878a[_0x3d5a('0x25')]);if(_0xfa878a['name']){delete _0xfa878a[_0x3d5a('0x26')];}_0x3a51d1[_0x3d5a('0x1a')](_0x4cefb3)['send'](_0xfa878a);};}exports[_0x3d5a('0x27')]=function(_0xfe4276,_0x3f5072){var _0x95b8f5={},_0x319fa3={},_0x141f9e={'count':0x0,'rows':[]};var _0x45bfda=_[_0x3d5a('0x28')](db['SmsTransferReport'][_0x3d5a('0x29')],function(_0x4122ed){return{'name':_0x4122ed['fieldName'],'type':_0x4122ed[_0x3d5a('0x2a')][_0x3d5a('0x2b')]};});_0x319fa3[_0x3d5a('0x2c')]=_[_0x3d5a('0x28')](_0x45bfda,_0x3d5a('0x26'));_0x319fa3[_0x3d5a('0x2d')]=_[_0x3d5a('0x2e')](_0xfe4276[_0x3d5a('0x2d')]);_0x319fa3['filters']=_['intersection'](_0x319fa3[_0x3d5a('0x2c')],_0x319fa3[_0x3d5a('0x2d')]);_0x95b8f5['attributes']=_[_0x3d5a('0x2f')](_0x319fa3['model'],qs[_0x3d5a('0x30')](_0xfe4276[_0x3d5a('0x2d')]['fields']));_0x95b8f5['attributes']=_0x95b8f5[_0x3d5a('0x31')][_0x3d5a('0x32')]?_0x95b8f5[_0x3d5a('0x31')]:_0x319fa3[_0x3d5a('0x2c')];if(!_0xfe4276['query'][_0x3d5a('0x33')](_0x3d5a('0x34'))){_0x95b8f5['limit']=qs[_0x3d5a('0x35')](_0xfe4276['query'][_0x3d5a('0x35')]);_0x95b8f5['offset']=qs[_0x3d5a('0x1c')](_0xfe4276[_0x3d5a('0x2d')][_0x3d5a('0x1c')]);}_0x95b8f5[_0x3d5a('0x36')]=qs['sort'](_0xfe4276[_0x3d5a('0x2d')][_0x3d5a('0x37')]);_0x95b8f5[_0x3d5a('0x38')]=qs[_0x3d5a('0x39')](_['pick'](_0xfe4276[_0x3d5a('0x2d')],_0x319fa3[_0x3d5a('0x39')]),_0x45bfda);if(_0xfe4276[_0x3d5a('0x2d')][_0x3d5a('0x3a')]){_0x95b8f5['where']=_[_0x3d5a('0x3b')](_0x95b8f5[_0x3d5a('0x38')],{'$or':_[_0x3d5a('0x28')](_0x45bfda,function(_0x36889b){if(_0x36889b[_0x3d5a('0x2a')]!=='VIRTUAL'){var _0x2ee3ec={};_0x2ee3ec[_0x36889b[_0x3d5a('0x26')]]={'$like':'%'+_0xfe4276[_0x3d5a('0x2d')][_0x3d5a('0x3a')]+'%'};return _0x2ee3ec;}})});}_0x95b8f5=_['merge']({},_0x95b8f5,_0xfe4276[_0x3d5a('0x3c')]);var _0x4d499d={'where':_0x95b8f5[_0x3d5a('0x38')]};return db[_0x3d5a('0x3d')][_0x3d5a('0x1d')](_0x4d499d)[_0x3d5a('0x22')](function(_0x4ea7d6){_0x141f9e[_0x3d5a('0x1d')]=_0x4ea7d6;if(_0xfe4276[_0x3d5a('0x2d')][_0x3d5a('0x3e')]){_0x95b8f5[_0x3d5a('0x3f')]=[{'all':!![]}];}return db[_0x3d5a('0x3d')][_0x3d5a('0x40')](_0x95b8f5);})[_0x3d5a('0x22')](function(_0x2ac186){_0x141f9e['rows']=_0x2ac186;return _0x141f9e;})['then'](respondWithFilteredResult(_0x3f5072,_0x95b8f5))[_0x3d5a('0x41')](handleError(_0x3f5072,null));};exports['show']=function(_0x292beb,_0x1b1829){var _0x25c160={'raw':!![],'where':{'id':_0x292beb['params']['id']}},_0x1872c1={};_0x1872c1[_0x3d5a('0x2c')]=_[_0x3d5a('0x2e')](db[_0x3d5a('0x3d')]['rawAttributes']);_0x1872c1[_0x3d5a('0x2d')]=_[_0x3d5a('0x2e')](_0x292beb['query']);_0x1872c1['filters']=_[_0x3d5a('0x2f')](_0x1872c1[_0x3d5a('0x2c')],_0x1872c1[_0x3d5a('0x2d')]);_0x25c160[_0x3d5a('0x31')]=_['intersection'](_0x1872c1['model'],qs[_0x3d5a('0x30')](_0x292beb[_0x3d5a('0x2d')]['fields']));_0x25c160[_0x3d5a('0x31')]=_0x25c160[_0x3d5a('0x31')][_0x3d5a('0x32')]?_0x25c160[_0x3d5a('0x31')]:_0x1872c1[_0x3d5a('0x2c')];if(_0x292beb['query'][_0x3d5a('0x3e')]){_0x25c160[_0x3d5a('0x3f')]=[{'all':!![]}];}_0x25c160=_['merge']({},_0x25c160,_0x292beb[_0x3d5a('0x3c')]);return db['SmsTransferReport'][_0x3d5a('0x42')](_0x25c160)[_0x3d5a('0x22')](handleEntityNotFound(_0x1b1829,null))['then'](respondWithResult(_0x1b1829,null))[_0x3d5a('0x41')](handleError(_0x1b1829,null));};exports[_0x3d5a('0x43')]=function(_0x4d8117,_0x360cfb){return db[_0x3d5a('0x3d')]['create'](_0x4d8117['body'],{})[_0x3d5a('0x22')](respondWithResult(_0x360cfb,0xc9))['catch'](handleError(_0x360cfb,null));};exports[_0x3d5a('0x21')]=function(_0x3f3dd9,_0x378fe0){if(_0x3f3dd9[_0x3d5a('0x44')]['id']){delete _0x3f3dd9[_0x3d5a('0x44')]['id'];}return db[_0x3d5a('0x3d')][_0x3d5a('0x42')]({'where':{'id':_0x3f3dd9['params']['id']}})[_0x3d5a('0x22')](handleEntityNotFound(_0x378fe0,null))[_0x3d5a('0x22')](saveUpdates(_0x3f3dd9[_0x3d5a('0x44')],null))[_0x3d5a('0x22')](respondWithResult(_0x378fe0,null))['catch'](handleError(_0x378fe0,null));};exports['destroy']=function(_0x3d85b8,_0x879be9){return db[_0x3d5a('0x3d')][_0x3d5a('0x42')]({'where':{'id':_0x3d85b8['params']['id']}})['then'](handleEntityNotFound(_0x879be9,null))[_0x3d5a('0x22')](removeEntity(_0x879be9,null))[_0x3d5a('0x41')](handleError(_0x879be9,null));};exports[_0x3d5a('0x45')]=function(_0x59cf81,_0x3d4984){return db['SmsTransferReport'][_0x3d5a('0x45')]()[_0x3d5a('0x22')](respondWithResult(_0x3d4984,null))['catch'](handleError(_0x3d4984,null));}; \ No newline at end of file +var _0xf3f6=['catch','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','fieldName','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','type','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','create','body','find'];(function(_0x5be611,_0x16cd9d){var _0x2c18ae=function(_0x36dba1){while(--_0x36dba1){_0x5be611['push'](_0x5be611['shift']());}};_0x2c18ae(++_0x16cd9d);}(_0xf3f6,0x165));var _0x6f3f=function(_0x131ac6,_0x198f36){_0x131ac6=_0x131ac6-0x0;var _0x2d3c89=_0xf3f6[_0x131ac6];return _0x2d3c89;};'use strict';var emlformat=require(_0x6f3f('0x0'));var rimraf=require(_0x6f3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f3f('0x2'));var rp=require(_0x6f3f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6f3f('0x4'));var path=require('path');var sox=require(_0x6f3f('0x5'));var csv=require('to-csv');var ejs=require(_0x6f3f('0x6'));var fs=require('fs');var fs_extra=require(_0x6f3f('0x7'));var _=require(_0x6f3f('0x8'));var squel=require(_0x6f3f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f3f('0xa'));var toCsv=require(_0x6f3f('0xb'));var querystring=require(_0x6f3f('0xc'));var Papa=require(_0x6f3f('0xd'));var Redis=require(_0x6f3f('0xe'));var authService=require(_0x6f3f('0xf'));var qs=require(_0x6f3f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f3f('0x11'));var logger=require(_0x6f3f('0x12'))('api');var utils=require(_0x6f3f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6f3f('0x14'));var db=require(_0x6f3f('0x15'))['db'];function respondWithStatusCode(_0x42d452,_0x224115){_0x224115=_0x224115||0xcc;return function(_0x3d45a8){if(_0x3d45a8){return _0x42d452[_0x6f3f('0x16')](_0x224115);}return _0x42d452[_0x6f3f('0x17')](_0x224115)[_0x6f3f('0x18')]();};}function respondWithResult(_0x1dbf7d,_0x24f73a){_0x24f73a=_0x24f73a||0xc8;return function(_0x200d99){if(_0x200d99){return _0x1dbf7d[_0x6f3f('0x17')](_0x24f73a)[_0x6f3f('0x19')](_0x200d99);}};}function respondWithFilteredResult(_0x2c0458,_0x3497e6){return function(_0x2edb13){if(_0x2edb13){var _0x34ff16=typeof _0x3497e6['offset']===_0x6f3f('0x1a')&&typeof _0x3497e6['limit']===_0x6f3f('0x1a');var _0xc37d10=_0x2edb13[_0x6f3f('0x1b')];var _0x538fc0=_0x34ff16?0x0:_0x3497e6[_0x6f3f('0x1c')];var _0x19f7c0=_0x34ff16?_0x2edb13['count']:_0x3497e6[_0x6f3f('0x1c')]+_0x3497e6[_0x6f3f('0x1d')];var _0x4e1757;if(_0x19f7c0>=_0xc37d10){_0x19f7c0=_0xc37d10;_0x4e1757=0xc8;}else{_0x4e1757=0xce;}_0x2c0458[_0x6f3f('0x17')](_0x4e1757);return _0x2c0458['set'](_0x6f3f('0x1e'),_0x538fc0+'-'+_0x19f7c0+'/'+_0xc37d10)['json'](_0x2edb13);}return null;};}function patchUpdates(_0x2c408b){return function(_0xa97b52){try{jsonpatch[_0x6f3f('0x1f')](_0xa97b52,_0x2c408b,!![]);}catch(_0xe0bc33){return BPromise['reject'](_0xe0bc33);}return _0xa97b52['save']();};}function saveUpdates(_0x5d06ec,_0x2ab9c8){return function(_0x14c9e0){if(_0x14c9e0){return _0x14c9e0[_0x6f3f('0x20')](_0x5d06ec)[_0x6f3f('0x21')](function(_0x1b95b6){return _0x1b95b6;});}return null;};}function removeEntity(_0xa6bc84,_0x37ed42){return function(_0x363d74){if(_0x363d74){return _0x363d74[_0x6f3f('0x22')]()['then'](function(){_0xa6bc84[_0x6f3f('0x17')](0xcc)[_0x6f3f('0x18')]();});}};}function handleEntityNotFound(_0x472179,_0x31d2ee){return function(_0x2e9be5){if(!_0x2e9be5){_0x472179[_0x6f3f('0x16')](0x194);}return _0x2e9be5;};}function handleError(_0x34c03b,_0x3776bc){_0x3776bc=_0x3776bc||0x1f4;return function(_0x4b494c){logger[_0x6f3f('0x23')](_0x4b494c[_0x6f3f('0x24')]);if(_0x4b494c[_0x6f3f('0x25')]){delete _0x4b494c[_0x6f3f('0x25')];}_0x34c03b['status'](_0x3776bc)[_0x6f3f('0x26')](_0x4b494c);};}exports[_0x6f3f('0x27')]=function(_0x4bbc81,_0x118cfe){var _0x46c43d={},_0x1ea345={},_0x18a562={'count':0x0,'rows':[]};var _0xffb624=_[_0x6f3f('0x28')](db[_0x6f3f('0x29')]['rawAttributes'],function(_0x466ca3){return{'name':_0x466ca3[_0x6f3f('0x2a')],'type':_0x466ca3['type']['key']};});_0x1ea345[_0x6f3f('0x2b')]=_[_0x6f3f('0x28')](_0xffb624,_0x6f3f('0x25'));_0x1ea345[_0x6f3f('0x2c')]=_['keys'](_0x4bbc81['query']);_0x1ea345[_0x6f3f('0x2d')]=_['intersection'](_0x1ea345[_0x6f3f('0x2b')],_0x1ea345[_0x6f3f('0x2c')]);_0x46c43d['attributes']=_[_0x6f3f('0x2e')](_0x1ea345[_0x6f3f('0x2b')],qs[_0x6f3f('0x2f')](_0x4bbc81[_0x6f3f('0x2c')][_0x6f3f('0x2f')]));_0x46c43d['attributes']=_0x46c43d['attributes'][_0x6f3f('0x30')]?_0x46c43d[_0x6f3f('0x31')]:_0x1ea345[_0x6f3f('0x2b')];if(!_0x4bbc81[_0x6f3f('0x2c')][_0x6f3f('0x32')]('nolimit')){_0x46c43d['limit']=qs[_0x6f3f('0x1d')](_0x4bbc81[_0x6f3f('0x2c')]['limit']);_0x46c43d[_0x6f3f('0x1c')]=qs[_0x6f3f('0x1c')](_0x4bbc81[_0x6f3f('0x2c')][_0x6f3f('0x1c')]);}_0x46c43d[_0x6f3f('0x33')]=qs[_0x6f3f('0x34')](_0x4bbc81[_0x6f3f('0x2c')][_0x6f3f('0x34')]);_0x46c43d[_0x6f3f('0x35')]=qs['filters'](_[_0x6f3f('0x36')](_0x4bbc81[_0x6f3f('0x2c')],_0x1ea345[_0x6f3f('0x2d')]),_0xffb624);if(_0x4bbc81[_0x6f3f('0x2c')][_0x6f3f('0x37')]){_0x46c43d[_0x6f3f('0x35')]=_['merge'](_0x46c43d[_0x6f3f('0x35')],{'$or':_['map'](_0xffb624,function(_0xb1ad84){if(_0xb1ad84[_0x6f3f('0x38')]!=='VIRTUAL'){var _0x13b030={};_0x13b030[_0xb1ad84[_0x6f3f('0x25')]]={'$like':'%'+_0x4bbc81[_0x6f3f('0x2c')][_0x6f3f('0x37')]+'%'};return _0x13b030;}})});}_0x46c43d=_['merge']({},_0x46c43d,_0x4bbc81['options']);var _0x2713b1={'where':_0x46c43d[_0x6f3f('0x35')]};return db[_0x6f3f('0x29')]['count'](_0x2713b1)[_0x6f3f('0x21')](function(_0x19b07f){_0x18a562[_0x6f3f('0x1b')]=_0x19b07f;if(_0x4bbc81[_0x6f3f('0x2c')][_0x6f3f('0x39')]){_0x46c43d[_0x6f3f('0x3a')]=[{'all':!![]}];}return db[_0x6f3f('0x29')][_0x6f3f('0x3b')](_0x46c43d);})[_0x6f3f('0x21')](function(_0x28bd6b){_0x18a562[_0x6f3f('0x3c')]=_0x28bd6b;return _0x18a562;})['then'](respondWithFilteredResult(_0x118cfe,_0x46c43d))['catch'](handleError(_0x118cfe,null));};exports[_0x6f3f('0x3d')]=function(_0x10f546,_0x4e6da5){var _0x4fe547={'raw':!![],'where':{'id':_0x10f546[_0x6f3f('0x3e')]['id']}},_0x2f51e7={};_0x2f51e7[_0x6f3f('0x2b')]=_[_0x6f3f('0x3f')](db[_0x6f3f('0x29')][_0x6f3f('0x40')]);_0x2f51e7[_0x6f3f('0x2c')]=_[_0x6f3f('0x3f')](_0x10f546[_0x6f3f('0x2c')]);_0x2f51e7[_0x6f3f('0x2d')]=_[_0x6f3f('0x2e')](_0x2f51e7[_0x6f3f('0x2b')],_0x2f51e7[_0x6f3f('0x2c')]);_0x4fe547[_0x6f3f('0x31')]=_[_0x6f3f('0x2e')](_0x2f51e7[_0x6f3f('0x2b')],qs['fields'](_0x10f546[_0x6f3f('0x2c')][_0x6f3f('0x2f')]));_0x4fe547[_0x6f3f('0x31')]=_0x4fe547['attributes']['length']?_0x4fe547[_0x6f3f('0x31')]:_0x2f51e7['model'];if(_0x10f546[_0x6f3f('0x2c')]['includeAll']){_0x4fe547['include']=[{'all':!![]}];}_0x4fe547=_['merge']({},_0x4fe547,_0x10f546[_0x6f3f('0x41')]);return db['SmsTransferReport']['find'](_0x4fe547)[_0x6f3f('0x21')](handleEntityNotFound(_0x4e6da5,null))[_0x6f3f('0x21')](respondWithResult(_0x4e6da5,null))['catch'](handleError(_0x4e6da5,null));};exports[_0x6f3f('0x42')]=function(_0x53d80e,_0x33ec1f){return db[_0x6f3f('0x29')]['create'](_0x53d80e[_0x6f3f('0x43')],{})[_0x6f3f('0x21')](respondWithResult(_0x33ec1f,0xc9))['catch'](handleError(_0x33ec1f,null));};exports[_0x6f3f('0x20')]=function(_0x167505,_0x3495e1){if(_0x167505['body']['id']){delete _0x167505[_0x6f3f('0x43')]['id'];}return db[_0x6f3f('0x29')]['find']({'where':{'id':_0x167505[_0x6f3f('0x3e')]['id']}})[_0x6f3f('0x21')](handleEntityNotFound(_0x3495e1,null))[_0x6f3f('0x21')](saveUpdates(_0x167505[_0x6f3f('0x43')],null))[_0x6f3f('0x21')](respondWithResult(_0x3495e1,null))['catch'](handleError(_0x3495e1,null));};exports['destroy']=function(_0x13d41e,_0x3da1c5){return db['SmsTransferReport'][_0x6f3f('0x44')]({'where':{'id':_0x13d41e[_0x6f3f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3da1c5,null))[_0x6f3f('0x21')](removeEntity(_0x3da1c5,null))[_0x6f3f('0x45')](handleError(_0x3da1c5,null));};exports[_0x6f3f('0x46')]=function(_0x26aada,_0x13cc7b){return db[_0x6f3f('0x29')]['describe']()[_0x6f3f('0x21')](respondWithResult(_0x13cc7b,null))[_0x6f3f('0x45')](handleError(_0x13cc7b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4d3a287..71297ae 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 _0xfa2b=['exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x270e9e,_0x454d47){_0x270e9e=_0x270e9e-0x0;var _0x42be3f=_0xfa2b[_0x270e9e];return _0x42be3f;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var attributes=require(_0xbfa2('0xa'));module[_0xbfa2('0xb')]=function(_0x12d71e,_0x237a99){return _0x12d71e[_0xbfa2('0xc')](_0xbfa2('0xd'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xbfa2('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8251=['bluebird','path','rimraf','../../config/environment','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x57116b,_0x43c37a){var _0x4b7d0a=function(_0x554b83){while(--_0x554b83){_0x57116b['push'](_0x57116b['shift']());}};_0x4b7d0a(++_0x43c37a);}(_0x8251,0x1cf));var _0x1825=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8251[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x1825('0x0'));var util=require(_0x1825('0x1'));var logger=require(_0x1825('0x2'))(_0x1825('0x3'));var moment=require(_0x1825('0x4'));var BPromise=require(_0x1825('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1825('0x6'));var rimraf=require(_0x1825('0x7'));var config=require(_0x1825('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0x1825('0x9')]=function(_0x3be5a3,_0x20c8a2){return _0x3be5a3[_0x1825('0xa')]('SmsTransferReport',attributes,{'tableName':_0x1825('0xb'),'paranoid':![],'indexes':[{'name':_0x1825('0xc'),'fields':[_0x1825('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a0dfb08..356e822 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 _0x303a=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x303a,0x1a0));var _0xa303=function(_0x24a48a,_0x3843a5){_0x24a48a=_0x24a48a-0x0;var _0x2f9b60=_0x303a[_0x24a48a];return _0x2f9b60;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});} \ No newline at end of file +var _0xedf2=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x331958,_0x383b87){var _0x4d6768=function(_0x327fac){while(--_0x327fac){_0x331958['push'](_0x331958['shift']());}};_0x4d6768(++_0x383b87);}(_0xedf2,0x1ac));var _0x2edf=function(_0x4d203f,_0x4b4464){_0x4d203f=_0x4d203f-0x0;var _0x44bce4=_0xedf2[_0x4d203f];return _0x44bce4;};'use strict';var _=require('lodash');var util=require(_0x2edf('0x0'));var moment=require(_0x2edf('0x1'));var BPromise=require(_0x2edf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2edf('0x3'));var db=require(_0x2edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2edf('0x5'))(_0x2edf('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2edf('0x7')][_0x2edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5af8d9,_0x4d27fa,_0x2b7b21){return new BPromise(function(_0x498c41,_0x2316e2){return client['request'](_0x5af8d9,_0x2b7b21)[_0x2edf('0x9')](function(_0x3d60f0){logger[_0x2edf('0xa')](_0x2edf('0xb'),_0x4d27fa,_0x2edf('0xc'));logger[_0x2edf('0xd')](_0x2edf('0xe'),_0x4d27fa,_0x2edf('0xc'),JSON[_0x2edf('0xf')](_0x3d60f0));if(_0x3d60f0['error']){if(_0x3d60f0[_0x2edf('0x10')][_0x2edf('0x11')]===0x1f4){logger[_0x2edf('0x10')](_0x2edf('0xb'),_0x4d27fa,_0x3d60f0[_0x2edf('0x10')][_0x2edf('0x12')]);return _0x2316e2(_0x3d60f0['error'][_0x2edf('0x12')]);}logger[_0x2edf('0x10')](_0x2edf('0xb'),_0x4d27fa,_0x3d60f0[_0x2edf('0x10')]['message']);return _0x498c41(_0x3d60f0[_0x2edf('0x10')][_0x2edf('0x12')]);}else{logger[_0x2edf('0xa')](_0x2edf('0xb'),_0x4d27fa,_0x2edf('0xc'));_0x498c41(_0x3d60f0[_0x2edf('0x13')]['message']);}})[_0x2edf('0x14')](function(_0x36ecfc){logger[_0x2edf('0x10')](_0x2edf('0xb'),_0x4d27fa,_0x36ecfc);_0x2316e2(_0x36ecfc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 7d2265d..d2dcdff 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 _0x5e9a=['%s-%s%s','basename','extname','file','/:id','update','delete','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','index','get','isAuthenticated','download','diskStorage','root','originalname','replace','format'];(function(_0x29065a,_0x377721){var _0x4962d2=function(_0x266523){while(--_0x266523){_0x29065a['push'](_0x29065a['shift']());}};_0x4962d2(++_0x377721);}(_0x5e9a,0x8b));var _0xa5e9=function(_0x347d03,_0x50c0a2){_0x347d03=_0x347d03-0x0;var _0x5c6345=_0x5e9a[_0x347d03];return _0x5c6345;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa5e9('0x0'));var timeout=require(_0xa5e9('0x1'));var express=require('express');var router=express[_0xa5e9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa5e9('0x3'));var interaction=require(_0xa5e9('0x4'));var config=require('../../config/environment');var controller=require(_0xa5e9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xa5e9('0x6')]);router[_0xa5e9('0x7')]('/:id',auth[_0xa5e9('0x8')](),controller['show']);router['get']('/:id/download',auth[_0xa5e9('0x8')](),controller[_0xa5e9('0x9')]);var upload=multer({'storage':multer[_0xa5e9('0xa')]({'destination':function(_0x8e4b92,_0x347172,_0x536105){_0x536105(null,path['join'](config[_0xa5e9('0xb')],'server/files/sounds/original/'));},'filename':function(_0xfdad40,_0x48dbc4,_0x4e60d0){_0x48dbc4[_0xa5e9('0xc')]=_0x48dbc4[_0xa5e9('0xc')][_0xa5e9('0xd')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e60d0(null,util[_0xa5e9('0xe')](_0xa5e9('0xf'),path[_0xa5e9('0x10')](_0x48dbc4[_0xa5e9('0xc')],path['extname'](_0x48dbc4['originalname'])),Date['now'](),path[_0xa5e9('0x11')](_0x48dbc4[_0xa5e9('0xc')])));}})});router['post']('/',upload['single'](_0xa5e9('0x12')),controller['create']);router['put'](_0xa5e9('0x13'),auth[_0xa5e9('0x8')](),controller[_0xa5e9('0x14')]);router['delete'](_0xa5e9('0x13'),auth[_0xa5e9('0x8')](),controller[_0xa5e9('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd417=['root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','create','put','/:id','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','show','/:id/download','download'];(function(_0x3c44b1,_0x396eb2){var _0x53ad16=function(_0x516b43){while(--_0x516b43){_0x3c44b1['push'](_0x3c44b1['shift']());}};_0x53ad16(++_0x396eb2);}(_0xd417,0x91));var _0x7d41=function(_0x331735,_0x488c7e){_0x331735=_0x331735-0x0;var _0x5b4bb2=_0xd417[_0x331735];return _0x5b4bb2;};'use strict';var multer=require('multer');var util=require(_0x7d41('0x0'));var path=require(_0x7d41('0x1'));var timeout=require(_0x7d41('0x2'));var express=require('express');var router=express[_0x7d41('0x3')]();var fs_extra=require(_0x7d41('0x4'));var auth=require(_0x7d41('0x5'));var interaction=require(_0x7d41('0x6'));var config=require(_0x7d41('0x7'));var controller=require(_0x7d41('0x8'));router['get']('/',auth[_0x7d41('0x9')](),controller[_0x7d41('0xa')]);router[_0x7d41('0xb')]('/:id',auth[_0x7d41('0x9')](),controller[_0x7d41('0xc')]);router[_0x7d41('0xb')](_0x7d41('0xd'),auth[_0x7d41('0x9')](),controller[_0x7d41('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eaa48,_0x3a055b,_0x43d866){_0x43d866(null,path['join'](config[_0x7d41('0xf')],_0x7d41('0x10')));},'filename':function(_0x123a07,_0x427b8b,_0xe5afbc){_0x427b8b[_0x7d41('0x11')]=_0x427b8b[_0x7d41('0x11')][_0x7d41('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe5afbc(null,util[_0x7d41('0x13')]('%s-%s%s',path[_0x7d41('0x14')](_0x427b8b[_0x7d41('0x11')],path[_0x7d41('0x15')](_0x427b8b[_0x7d41('0x11')])),Date[_0x7d41('0x16')](),path[_0x7d41('0x15')](_0x427b8b[_0x7d41('0x11')])));}})});router[_0x7d41('0x17')]('/',upload[_0x7d41('0x18')](_0x7d41('0x19')),controller[_0x7d41('0x1a')]);router[_0x7d41('0x1b')](_0x7d41('0x1c'),auth['isAuthenticated'](),controller[_0x7d41('0x1d')]);router[_0x7d41('0x1e')](_0x7d41('0x1c'),auth[_0x7d41('0x9')](),controller['delete']);module[_0x7d41('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 4f4272c..94a75fe 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 _0x54d2=['STRING','FLOAT','BIGINT','INTEGER'];(function(_0x2ec991,_0x4c9f2b){var _0x4d3f43=function(_0x26a1b2){while(--_0x26a1b2){_0x2ec991['push'](_0x2ec991['shift']());}};_0x4d3f43(++_0x4c9f2b);}(_0x54d2,0x17c));var _0x254d=function(_0x4eb114,_0x546c01){_0x4eb114=_0x4eb114-0x0;var _0x196245=_0x54d2[_0x4eb114];return _0x196245;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x254d('0x0')]},'display_name':{'type':Sequelize[_0x254d('0x0')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x254d('0x0')]},'original_duration':{'type':Sequelize[_0x254d('0x1')]},'original_sampleCount':{'type':Sequelize[_0x254d('0x2')]},'original_channelCount':{'type':Sequelize[_0x254d('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x254d('0x3')]},'converted_format':{'type':Sequelize[_0x254d('0x0')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x254d('0x2')]},'converted_channelCount':{'type':Sequelize[_0x254d('0x3')]},'converted_bitRate':{'type':Sequelize[_0x254d('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x254d('0x3')]}}; \ No newline at end of file +var _0x8467=['BIGINT','exports','STRING','name','FLOAT','INTEGER'];(function(_0x1a91f8,_0x59f4f5){var _0x466009=function(_0x48078c){while(--_0x48078c){_0x1a91f8['push'](_0x1a91f8['shift']());}};_0x466009(++_0x59f4f5);}(_0x8467,0x103));var _0x7846=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x8467[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require('sequelize');module[_0x7846('0x0')]={'name':{'type':Sequelize[_0x7846('0x1')],'unique':_0x7846('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x7846('0x1')]},'original_duration':{'type':Sequelize[_0x7846('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x7846('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x7846('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x7846('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7846('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0c86481..1e3b7b2 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 _0xbd45=['save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','basename','filename','extname','wav','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','start','send','description','destroy','server/files/sounds/original','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','get','Sounds','UserProfileResource','error','name','index','map','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','show','params','find','catch','converted_format','existsSync','join','root','server/files/sounds/converted'];(function(_0x4f6dce,_0x3d9f27){var _0x54fc02=function(_0x4e4c8e){while(--_0x4e4c8e){_0x4f6dce['push'](_0x4f6dce['shift']());}};_0x54fc02(++_0x3d9f27);}(_0xbd45,0x121));var _0x5bd4=function(_0x59c3a3,_0x4097d9){_0x59c3a3=_0x59c3a3-0x0;var _0x4966d=_0xbd45[_0x59c3a3];return _0x4966d;};'use strict';var emlformat=require(_0x5bd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bd4('0x1'));var jsonpatch=require(_0x5bd4('0x2'));var rp=require(_0x5bd4('0x3'));var moment=require(_0x5bd4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5bd4('0x5'));var util=require(_0x5bd4('0x6'));var path=require(_0x5bd4('0x7'));var sox=require(_0x5bd4('0x8'));var csv=require(_0x5bd4('0x9'));var ejs=require(_0x5bd4('0xa'));var fs=require('fs');var fs_extra=require(_0x5bd4('0xb'));var _=require(_0x5bd4('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5bd4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5bd4('0x9'));var querystring=require(_0x5bd4('0xe'));var Papa=require(_0x5bd4('0xf'));var Redis=require(_0x5bd4('0x10'));var authService=require(_0x5bd4('0x11'));var qs=require(_0x5bd4('0x12'));var as=require(_0x5bd4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bd4('0x14'))(_0x5bd4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5bd4('0x16'));var db=require(_0x5bd4('0x17'))['db'];function respondWithStatusCode(_0x4b92e3,_0x15c75f){_0x15c75f=_0x15c75f||0xcc;return function(_0x6001d){if(_0x6001d){return _0x4b92e3[_0x5bd4('0x18')](_0x15c75f);}return _0x4b92e3[_0x5bd4('0x19')](_0x15c75f)[_0x5bd4('0x1a')]();};}function respondWithResult(_0x272093,_0x56c7f4){_0x56c7f4=_0x56c7f4||0xc8;return function(_0x41a8a7){if(_0x41a8a7){return _0x272093['status'](_0x56c7f4)[_0x5bd4('0x1b')](_0x41a8a7);}};}function respondWithFilteredResult(_0x590e3e,_0x4c52b9){return function(_0x4f6dbd){if(_0x4f6dbd){var _0x5f2113=typeof _0x4c52b9[_0x5bd4('0x1c')]===_0x5bd4('0x1d')&&typeof _0x4c52b9['limit']==='undefined';var _0x31645b=_0x4f6dbd['count'];var _0x5718ce=_0x5f2113?0x0:_0x4c52b9['offset'];var _0x34a76f=_0x5f2113?_0x4f6dbd['count']:_0x4c52b9[_0x5bd4('0x1c')]+_0x4c52b9[_0x5bd4('0x1e')];var _0x4cf89e;if(_0x34a76f>=_0x31645b){_0x34a76f=_0x31645b;_0x4cf89e=0xc8;}else{_0x4cf89e=0xce;}_0x590e3e['status'](_0x4cf89e);return _0x590e3e[_0x5bd4('0x1f')](_0x5bd4('0x20'),_0x5718ce+'-'+_0x34a76f+'/'+_0x31645b)['json'](_0x4f6dbd);}return null;};}function patchUpdates(_0x50da78){return function(_0x352433){try{jsonpatch['apply'](_0x352433,_0x50da78,!![]);}catch(_0xf88db1){return BPromise[_0x5bd4('0x21')](_0xf88db1);}return _0x352433[_0x5bd4('0x22')]();};}function saveUpdates(_0x2084d7,_0x5cc39e){return function(_0x465552){if(_0x465552){return _0x465552[_0x5bd4('0x23')](_0x2084d7)[_0x5bd4('0x24')](function(_0x36262a){return _0x36262a;});}return null;};}function removeEntity(_0x592d0c,_0x374912){return function(_0x7bf80a){if(_0x7bf80a){return _0x7bf80a['destroy']()[_0x5bd4('0x24')](function(){var _0x3f3117=_0x7bf80a[_0x5bd4('0x25')]({'plain':!![]});var _0x302145=_0x5bd4('0x26');return db[_0x5bd4('0x27')]['destroy']({'where':{'type':_0x302145,'resourceId':_0x3f3117['id']}})[_0x5bd4('0x24')](function(){return _0x7bf80a;});})[_0x5bd4('0x24')](function(){_0x592d0c[_0x5bd4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x163e37,_0x330055){return function(_0x449959){if(!_0x449959){_0x163e37[_0x5bd4('0x18')](0x194);}return _0x449959;};}function handleError(_0x2aa5b6,_0x3ccde7){_0x3ccde7=_0x3ccde7||0x1f4;return function(_0x546282){logger[_0x5bd4('0x28')](_0x546282['stack']);if(_0x546282[_0x5bd4('0x29')]){delete _0x546282[_0x5bd4('0x29')];}_0x2aa5b6['status'](_0x3ccde7)['send'](_0x546282);};}exports[_0x5bd4('0x2a')]=function(_0x3ad16d,_0x2ba719){var _0x30cf71={},_0x4ed510={},_0x5f2044={'count':0x0,'rows':[]};var _0x537534=_[_0x5bd4('0x2b')](db['Sound'][_0x5bd4('0x2c')],function(_0x4d9bc3){return{'name':_0x4d9bc3['fieldName'],'type':_0x4d9bc3[_0x5bd4('0x2d')]['key']};});_0x4ed510['model']=_[_0x5bd4('0x2b')](_0x537534,_0x5bd4('0x29'));_0x4ed510[_0x5bd4('0x2e')]=_[_0x5bd4('0x2f')](_0x3ad16d[_0x5bd4('0x2e')]);_0x4ed510['filters']=_[_0x5bd4('0x30')](_0x4ed510[_0x5bd4('0x31')],_0x4ed510[_0x5bd4('0x2e')]);_0x30cf71[_0x5bd4('0x32')]=_[_0x5bd4('0x30')](_0x4ed510[_0x5bd4('0x31')],qs['fields'](_0x3ad16d[_0x5bd4('0x2e')][_0x5bd4('0x33')]));_0x30cf71[_0x5bd4('0x32')]=_0x30cf71[_0x5bd4('0x32')][_0x5bd4('0x34')]?_0x30cf71['attributes']:_0x4ed510['model'];if(!_0x3ad16d[_0x5bd4('0x2e')][_0x5bd4('0x35')]('nolimit')){_0x30cf71[_0x5bd4('0x1e')]=qs[_0x5bd4('0x1e')](_0x3ad16d[_0x5bd4('0x2e')][_0x5bd4('0x1e')]);_0x30cf71[_0x5bd4('0x1c')]=qs[_0x5bd4('0x1c')](_0x3ad16d[_0x5bd4('0x2e')]['offset']);}_0x30cf71[_0x5bd4('0x36')]=qs['sort'](_0x3ad16d[_0x5bd4('0x2e')][_0x5bd4('0x37')]);_0x30cf71['where']=qs[_0x5bd4('0x38')](_[_0x5bd4('0x39')](_0x3ad16d[_0x5bd4('0x2e')],_0x4ed510['filters']),_0x537534);if(_0x3ad16d[_0x5bd4('0x2e')][_0x5bd4('0x3a')]){_0x30cf71[_0x5bd4('0x3b')]=_[_0x5bd4('0x3c')](_0x30cf71[_0x5bd4('0x3b')],{'$or':_[_0x5bd4('0x2b')](_0x537534,function(_0x37952c){if(_0x37952c[_0x5bd4('0x2d')]!==_0x5bd4('0x3d')){var _0xb61607={};_0xb61607[_0x37952c['name']]={'$like':'%'+_0x3ad16d[_0x5bd4('0x2e')][_0x5bd4('0x3a')]+'%'};return _0xb61607;}})});}_0x30cf71=_[_0x5bd4('0x3c')]({},_0x30cf71,_0x3ad16d[_0x5bd4('0x3e')]);var _0x220d56={'where':_0x30cf71[_0x5bd4('0x3b')]};return db[_0x5bd4('0x3f')]['count'](_0x220d56)[_0x5bd4('0x24')](function(_0x51888b){_0x5f2044['count']=_0x51888b;if(_0x3ad16d[_0x5bd4('0x2e')][_0x5bd4('0x40')]){_0x30cf71[_0x5bd4('0x41')]=[{'all':!![]}];}return db['Sound'][_0x5bd4('0x42')](_0x30cf71);})[_0x5bd4('0x24')](function(_0x3d8719){_0x5f2044[_0x5bd4('0x43')]=_0x3d8719;return _0x5f2044;})[_0x5bd4('0x24')](respondWithFilteredResult(_0x2ba719,_0x30cf71))['catch'](handleError(_0x2ba719,null));};exports[_0x5bd4('0x44')]=function(_0x516e6f,_0x4d5105){var _0x26c0b7={'raw':!![],'where':{'id':_0x516e6f[_0x5bd4('0x45')]['id']}},_0x2f976c={};_0x2f976c[_0x5bd4('0x31')]=_[_0x5bd4('0x2f')](db[_0x5bd4('0x3f')][_0x5bd4('0x2c')]);_0x2f976c[_0x5bd4('0x2e')]=_[_0x5bd4('0x2f')](_0x516e6f[_0x5bd4('0x2e')]);_0x2f976c[_0x5bd4('0x38')]=_[_0x5bd4('0x30')](_0x2f976c[_0x5bd4('0x31')],_0x2f976c['query']);_0x26c0b7[_0x5bd4('0x32')]=_[_0x5bd4('0x30')](_0x2f976c[_0x5bd4('0x31')],qs['fields'](_0x516e6f['query']['fields']));_0x26c0b7[_0x5bd4('0x32')]=_0x26c0b7[_0x5bd4('0x32')][_0x5bd4('0x34')]?_0x26c0b7['attributes']:_0x2f976c[_0x5bd4('0x31')];if(_0x516e6f[_0x5bd4('0x2e')][_0x5bd4('0x40')]){_0x26c0b7['include']=[{'all':!![]}];}_0x26c0b7=_[_0x5bd4('0x3c')]({},_0x26c0b7,_0x516e6f[_0x5bd4('0x3e')]);return db['Sound'][_0x5bd4('0x46')](_0x26c0b7)[_0x5bd4('0x24')](handleEntityNotFound(_0x4d5105,null))[_0x5bd4('0x24')](respondWithResult(_0x4d5105,null))[_0x5bd4('0x47')](handleError(_0x4d5105,null));};exports['download']=function(_0x522ecf,_0x1cab1b,_0x4fb316){return db[_0x5bd4('0x3f')][_0x5bd4('0x46')]({'where':{'id':_0x522ecf[_0x5bd4('0x45')]['id']},'attributes':[_0x5bd4('0x29'),'save_name',_0x5bd4('0x48')],'raw':!![]})[_0x5bd4('0x24')](handleEntityNotFound(_0x1cab1b,null))[_0x5bd4('0x24')](function(_0x31ebcb){if(_0x31ebcb){if(!fs[_0x5bd4('0x49')](path[_0x5bd4('0x4a')](config[_0x5bd4('0x4b')],_0x5bd4('0x4c'),_0x31ebcb[_0x5bd4('0x4d')]+'.'+_0x31ebcb['converted_format']))){throw new db[(_0x5bd4('0x4e'))][(_0x5bd4('0x4f'))](_0x5bd4('0x50'));}return _0x1cab1b['download'](path['join'](config[_0x5bd4('0x4b')],_0x5bd4('0x4c'),util[_0x5bd4('0x51')](_0x5bd4('0x52'),_0x31ebcb['save_name'],_0x31ebcb[_0x5bd4('0x48')])),util['format']('%s.%s',_0x31ebcb[_0x5bd4('0x29')],_0x31ebcb[_0x5bd4('0x48')]));}return null;})[_0x5bd4('0x47')](handleError(_0x1cab1b,null));};exports[_0x5bd4('0x53')]=function(_0x385dd9,_0x12ffb4,_0x85e22b){var _0x3f9b55={'name':path['basename'](_0x385dd9[_0x5bd4('0x54')][_0x5bd4('0x55')],path['extname'](_0x385dd9['file'][_0x5bd4('0x55')])),'save_name':path[_0x5bd4('0x56')](_0x385dd9[_0x5bd4('0x54')][_0x5bd4('0x57')],path[_0x5bd4('0x58')](_0x385dd9[_0x5bd4('0x54')][_0x5bd4('0x57')])),'original_format':path['extname'](_0x385dd9[_0x5bd4('0x54')][_0x5bd4('0x55')])['substring'](0x1),'converted_format':_0x5bd4('0x59')};var _0x247dd4=path['join'](config[_0x5bd4('0x4b')],'server/files/sounds/original',_0x385dd9[_0x5bd4('0x54')][_0x5bd4('0x57')]);var _0xd73c34=path[_0x5bd4('0x4a')](config[_0x5bd4('0x4b')],_0x5bd4('0x4c'),util[_0x5bd4('0x51')](_0x5bd4('0x52'),path[_0x5bd4('0x56')](_0x385dd9[_0x5bd4('0x54')]['filename'],path[_0x5bd4('0x58')](_0x385dd9[_0x5bd4('0x54')]['filename'])),_0x3f9b55[_0x5bd4('0x48')]));logger['info'](_0x5bd4('0x5a'),_0x247dd4);logger[_0x5bd4('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0xd73c34);try{fs[_0x5bd4('0x5c')](_0x247dd4,parseInt(_0x5bd4('0x5d'),0x8));var _0x21a168=sox[_0x5bd4('0x5e')](_0x247dd4,_0xd73c34,{'sampleRate':0x1f40,'format':_0x5bd4('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21a168['on'](_0x5bd4('0x28'),function(_0x4bf2ed){fs[_0x5bd4('0x5f')](_0x247dd4);_0x12ffb4[_0x5bd4('0x19')](0x1f4)['send'](_0x4bf2ed);});_0x21a168['on'](_0x5bd4('0x60'),function(_0x130efa){_0x3f9b55[_0x5bd4('0x61')]=isNaN(_0x130efa[_0x5bd4('0x62')])?null:_0x130efa['duration']*0x3e8;_0x3f9b55[_0x5bd4('0x63')]=isNaN(_0x130efa[_0x5bd4('0x64')])?null:_0x130efa['sampleCount'];_0x3f9b55[_0x5bd4('0x65')]=isNaN(_0x130efa[_0x5bd4('0x66')])?null:_0x130efa[_0x5bd4('0x66')];_0x3f9b55['original_bitRate']=isNaN(_0x130efa['bitRate'])?null:_0x130efa[_0x5bd4('0x67')];_0x3f9b55[_0x5bd4('0x68')]=isNaN(_0x130efa[_0x5bd4('0x69')])?null:_0x130efa[_0x5bd4('0x69')];});_0x21a168['on']('dest',function(_0x34fa4c){_0x3f9b55[_0x5bd4('0x6a')]=isNaN(_0x34fa4c[_0x5bd4('0x62')])?null:_0x34fa4c[_0x5bd4('0x62')]*0x3e8;_0x3f9b55[_0x5bd4('0x6b')]=isNaN(_0x34fa4c['sampleCount'])?null:_0x34fa4c[_0x5bd4('0x64')];_0x3f9b55[_0x5bd4('0x6c')]=isNaN(_0x34fa4c[_0x5bd4('0x66')])?null:_0x34fa4c[_0x5bd4('0x66')];_0x3f9b55['converted_bitRate']=isNaN(_0x34fa4c[_0x5bd4('0x67')])?null:_0x34fa4c[_0x5bd4('0x67')];_0x3f9b55[_0x5bd4('0x6d')]=isNaN(_0x34fa4c[_0x5bd4('0x69')])?null:_0x34fa4c[_0x5bd4('0x69')];});_0x21a168['on'](_0x5bd4('0x1a'),function(){fs[_0x5bd4('0x5c')](_0xd73c34,parseInt(_0x5bd4('0x5d'),0x8));return db[_0x5bd4('0x3f')][_0x5bd4('0x53')](_0x3f9b55)[_0x5bd4('0x24')](function(_0x5f02d5){var _0x2b81e3={'role':_0x385dd9[_0x5bd4('0x6e')][_0x5bd4('0x6f')],'userProfileId':_0x385dd9[_0x5bd4('0x6e')]['userProfileId']};if(!_0x2b81e3)throw new Error(_0x5bd4('0x70'));if(_0x2b81e3['role']===_0x5bd4('0x71')){var _0x55c3f1=_0x5f02d5[_0x5bd4('0x25')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Sounds','userProfileId':_0x2b81e3[_0x5bd4('0x72')]},'raw':!![]})[_0x5bd4('0x24')](function(_0x43f74e){if(_0x43f74e&&_0x43f74e[_0x5bd4('0x73')]===0x0){return db[_0x5bd4('0x27')][_0x5bd4('0x53')]({'name':_0x55c3f1[_0x5bd4('0x29')],'resourceId':_0x55c3f1['id'],'type':_0x43f74e['name'],'sectionId':_0x43f74e['id']},{})['then'](function(){return _0x5f02d5;});}else{return _0x5f02d5;}})[_0x5bd4('0x47')](function(_0x5672f5){logger[_0x5bd4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5672f5);throw _0x5672f5;});}return _0x5f02d5;})[_0x5bd4('0x24')](respondWithResult(_0x12ffb4,null))[_0x5bd4('0x47')](handleError(_0x12ffb4,null));});_0x21a168[_0x5bd4('0x74')]();}catch(_0x5103ff){_0x12ffb4[_0x5bd4('0x19')](0x1f4)[_0x5bd4('0x75')](_0x5103ff);}};exports[_0x5bd4('0x23')]=function(_0x436dc7,_0xc27cbd,_0x97215c){return db[_0x5bd4('0x3f')][_0x5bd4('0x46')]({'where':{'id':_0x436dc7[_0x5bd4('0x45')]['id']}})[_0x5bd4('0x24')](handleEntityNotFound(_0xc27cbd,null))[_0x5bd4('0x24')](saveUpdates(_[_0x5bd4('0x39')](_0x436dc7[_0x5bd4('0x6e')],['name',_0x5bd4('0x76')]),null))[_0x5bd4('0x24')](respondWithResult(_0xc27cbd,null))[_0x5bd4('0x47')](handleError(_0xc27cbd,null));};exports['delete']=function(_0xab0b3d,_0x210617,_0x19893e){return db[_0x5bd4('0x3f')][_0x5bd4('0x46')]({'where':{'id':_0xab0b3d['params']['id']}})['then'](function(_0x1f8cf2){if(_0x1f8cf2){return _0x1f8cf2[_0x5bd4('0x77')]();}})[_0x5bd4('0x24')](function(_0x584caa){var _0x2863f9=path['join'](config[_0x5bd4('0x4b')],_0x5bd4('0x78'),util[_0x5bd4('0x51')](_0x5bd4('0x52'),_0x584caa[_0x5bd4('0x4d')],_0x584caa[_0x5bd4('0x79')]));var _0x273ea4=path[_0x5bd4('0x4a')](config[_0x5bd4('0x4b')],_0x5bd4('0x4c'),util['format'](_0x5bd4('0x52'),_0x584caa['save_name'],_0x584caa[_0x5bd4('0x48')]));fs[_0x5bd4('0x5f')](_0x2863f9);fs[_0x5bd4('0x5f')](_0x273ea4);return _0x584caa;})[_0x5bd4('0x24')](function(_0x15ddd7){if(_0x15ddd7){return _0x210617['status'](0xcc)[_0x5bd4('0x1a')]();}})[_0x5bd4('0x24')](handleEntityNotFound(_0x210617,null))['catch'](handleError(_0x210617,null));}; \ No newline at end of file +var _0xe1e3=['extname','originalname','substring','wav','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_channelCount','converted_bitRate','converted_sampleRate','end','body','user','UserProfileSection','Sounds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','options','includeAll','include','findAll','rows','catch','params','length','find','download','save_name','existsSync','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','root','format','converted_format','create','basename','file','filename'];(function(_0xe98e39,_0x5d2206){var _0x1c1a97=function(_0x378c3a){while(--_0x378c3a){_0xe98e39['push'](_0xe98e39['shift']());}};_0x1c1a97(++_0x5d2206);}(_0xe1e3,0x1aa));var _0x3e1e=function(_0x2cd3be,_0x4fff12){_0x2cd3be=_0x2cd3be-0x0;var _0x5e99dd=_0xe1e3[_0x2cd3be];return _0x5e99dd;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require(_0x3e1e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e1e('0x3'));var moment=require(_0x3e1e('0x4'));var BPromise=require(_0x3e1e('0x5'));var Mustache=require('mustache');var util=require(_0x3e1e('0x6'));var path=require(_0x3e1e('0x7'));var sox=require(_0x3e1e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require(_0x3e1e('0xa'));var squel=require(_0x3e1e('0xb'));var crypto=require(_0x3e1e('0xc'));var jsforce=require(_0x3e1e('0xd'));var deskjs=require(_0x3e1e('0xe'));var toCsv=require(_0x3e1e('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e1e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3e1e('0x11'));var hardwareService=require(_0x3e1e('0x12'));var logger=require(_0x3e1e('0x13'))(_0x3e1e('0x14'));var utils=require(_0x3e1e('0x15'));var config=require(_0x3e1e('0x16'));var licenseUtil=require(_0x3e1e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20bf81,_0x3394f5){_0x3394f5=_0x3394f5||0xcc;return function(_0x1cc7ab){if(_0x1cc7ab){return _0x20bf81[_0x3e1e('0x18')](_0x3394f5);}return _0x20bf81[_0x3e1e('0x19')](_0x3394f5)['end']();};}function respondWithResult(_0x98c226,_0x51f1ed){_0x51f1ed=_0x51f1ed||0xc8;return function(_0x4f1ac2){if(_0x4f1ac2){return _0x98c226[_0x3e1e('0x19')](_0x51f1ed)['json'](_0x4f1ac2);}};}function respondWithFilteredResult(_0x3bf83e,_0x116947){return function(_0x388091){if(_0x388091){var _0xb70673=typeof _0x116947['offset']===_0x3e1e('0x1a')&&typeof _0x116947[_0x3e1e('0x1b')]===_0x3e1e('0x1a');var _0x382c6e=_0x388091['count'];var _0x254177=_0xb70673?0x0:_0x116947[_0x3e1e('0x1c')];var _0x283937=_0xb70673?_0x388091[_0x3e1e('0x1d')]:_0x116947[_0x3e1e('0x1c')]+_0x116947['limit'];var _0x3d2945;if(_0x283937>=_0x382c6e){_0x283937=_0x382c6e;_0x3d2945=0xc8;}else{_0x3d2945=0xce;}_0x3bf83e['status'](_0x3d2945);return _0x3bf83e[_0x3e1e('0x1e')](_0x3e1e('0x1f'),_0x254177+'-'+_0x283937+'/'+_0x382c6e)[_0x3e1e('0x20')](_0x388091);}return null;};}function patchUpdates(_0x1a6af9){return function(_0x2bddc1){try{jsonpatch[_0x3e1e('0x21')](_0x2bddc1,_0x1a6af9,!![]);}catch(_0x59b220){return BPromise[_0x3e1e('0x22')](_0x59b220);}return _0x2bddc1[_0x3e1e('0x23')]();};}function saveUpdates(_0x5892ae,_0x5ec23c){return function(_0x40b908){if(_0x40b908){return _0x40b908['update'](_0x5892ae)[_0x3e1e('0x24')](function(_0x2f4eb9){return _0x2f4eb9;});}return null;};}function removeEntity(_0x2b2173,_0x29d46e){return function(_0xe2f428){if(_0xe2f428){return _0xe2f428['destroy']()['then'](function(){var _0x38b2a0=_0xe2f428[_0x3e1e('0x25')]({'plain':!![]});var _0x4af74c='Sounds';return db[_0x3e1e('0x26')][_0x3e1e('0x27')]({'where':{'type':_0x4af74c,'resourceId':_0x38b2a0['id']}})['then'](function(){return _0xe2f428;});})['then'](function(){_0x2b2173[_0x3e1e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x421372,_0x4fa0a4){return function(_0x5c61a3){if(!_0x5c61a3){_0x421372['sendStatus'](0x194);}return _0x5c61a3;};}function handleError(_0x4757ea,_0x281528){_0x281528=_0x281528||0x1f4;return function(_0x5eb714){logger[_0x3e1e('0x28')](_0x5eb714[_0x3e1e('0x29')]);if(_0x5eb714[_0x3e1e('0x2a')]){delete _0x5eb714['name'];}_0x4757ea[_0x3e1e('0x19')](_0x281528)[_0x3e1e('0x2b')](_0x5eb714);};}exports[_0x3e1e('0x2c')]=function(_0x5741d5,_0x1566e9){var _0xf15ba5={},_0x2b2e29={},_0x5e39f5={'count':0x0,'rows':[]};var _0x279617=_['map'](db[_0x3e1e('0x2d')][_0x3e1e('0x2e')],function(_0x281075){return{'name':_0x281075[_0x3e1e('0x2f')],'type':_0x281075[_0x3e1e('0x30')][_0x3e1e('0x31')]};});_0x2b2e29[_0x3e1e('0x32')]=_['map'](_0x279617,_0x3e1e('0x2a'));_0x2b2e29[_0x3e1e('0x33')]=_[_0x3e1e('0x34')](_0x5741d5[_0x3e1e('0x33')]);_0x2b2e29[_0x3e1e('0x35')]=_[_0x3e1e('0x36')](_0x2b2e29['model'],_0x2b2e29['query']);_0xf15ba5['attributes']=_['intersection'](_0x2b2e29['model'],qs[_0x3e1e('0x37')](_0x5741d5['query'][_0x3e1e('0x37')]));_0xf15ba5[_0x3e1e('0x38')]=_0xf15ba5[_0x3e1e('0x38')]['length']?_0xf15ba5[_0x3e1e('0x38')]:_0x2b2e29[_0x3e1e('0x32')];if(!_0x5741d5[_0x3e1e('0x33')][_0x3e1e('0x39')](_0x3e1e('0x3a'))){_0xf15ba5[_0x3e1e('0x1b')]=qs['limit'](_0x5741d5[_0x3e1e('0x33')][_0x3e1e('0x1b')]);_0xf15ba5[_0x3e1e('0x1c')]=qs[_0x3e1e('0x1c')](_0x5741d5[_0x3e1e('0x33')][_0x3e1e('0x1c')]);}_0xf15ba5[_0x3e1e('0x3b')]=qs[_0x3e1e('0x3c')](_0x5741d5[_0x3e1e('0x33')][_0x3e1e('0x3c')]);_0xf15ba5['where']=qs[_0x3e1e('0x35')](_[_0x3e1e('0x3d')](_0x5741d5[_0x3e1e('0x33')],_0x2b2e29[_0x3e1e('0x35')]),_0x279617);if(_0x5741d5['query'][_0x3e1e('0x3e')]){_0xf15ba5[_0x3e1e('0x3f')]=_['merge'](_0xf15ba5[_0x3e1e('0x3f')],{'$or':_[_0x3e1e('0x40')](_0x279617,function(_0x215034){if(_0x215034[_0x3e1e('0x30')]!=='VIRTUAL'){var _0x56f045={};_0x56f045[_0x215034[_0x3e1e('0x2a')]]={'$like':'%'+_0x5741d5[_0x3e1e('0x33')][_0x3e1e('0x3e')]+'%'};return _0x56f045;}})});}_0xf15ba5=_[_0x3e1e('0x41')]({},_0xf15ba5,_0x5741d5[_0x3e1e('0x42')]);var _0x3e85d3={'where':_0xf15ba5[_0x3e1e('0x3f')]};return db['Sound']['count'](_0x3e85d3)[_0x3e1e('0x24')](function(_0x372414){_0x5e39f5[_0x3e1e('0x1d')]=_0x372414;if(_0x5741d5[_0x3e1e('0x33')][_0x3e1e('0x43')]){_0xf15ba5[_0x3e1e('0x44')]=[{'all':!![]}];}return db[_0x3e1e('0x2d')][_0x3e1e('0x45')](_0xf15ba5);})[_0x3e1e('0x24')](function(_0x29975b){_0x5e39f5[_0x3e1e('0x46')]=_0x29975b;return _0x5e39f5;})[_0x3e1e('0x24')](respondWithFilteredResult(_0x1566e9,_0xf15ba5))[_0x3e1e('0x47')](handleError(_0x1566e9,null));};exports['show']=function(_0x1aa109,_0x51afb4){var _0x5603fc={'raw':!![],'where':{'id':_0x1aa109[_0x3e1e('0x48')]['id']}},_0x4c98ba={};_0x4c98ba[_0x3e1e('0x32')]=_['keys'](db[_0x3e1e('0x2d')][_0x3e1e('0x2e')]);_0x4c98ba[_0x3e1e('0x33')]=_[_0x3e1e('0x34')](_0x1aa109[_0x3e1e('0x33')]);_0x4c98ba[_0x3e1e('0x35')]=_[_0x3e1e('0x36')](_0x4c98ba[_0x3e1e('0x32')],_0x4c98ba[_0x3e1e('0x33')]);_0x5603fc[_0x3e1e('0x38')]=_[_0x3e1e('0x36')](_0x4c98ba[_0x3e1e('0x32')],qs[_0x3e1e('0x37')](_0x1aa109[_0x3e1e('0x33')][_0x3e1e('0x37')]));_0x5603fc[_0x3e1e('0x38')]=_0x5603fc['attributes'][_0x3e1e('0x49')]?_0x5603fc[_0x3e1e('0x38')]:_0x4c98ba[_0x3e1e('0x32')];if(_0x1aa109['query'][_0x3e1e('0x43')]){_0x5603fc[_0x3e1e('0x44')]=[{'all':!![]}];}_0x5603fc=_['merge']({},_0x5603fc,_0x1aa109[_0x3e1e('0x42')]);return db[_0x3e1e('0x2d')][_0x3e1e('0x4a')](_0x5603fc)[_0x3e1e('0x24')](handleEntityNotFound(_0x51afb4,null))[_0x3e1e('0x24')](respondWithResult(_0x51afb4,null))['catch'](handleError(_0x51afb4,null));};exports[_0x3e1e('0x4b')]=function(_0x35f401,_0x31f4ae,_0x2ee505){return db[_0x3e1e('0x2d')]['find']({'where':{'id':_0x35f401[_0x3e1e('0x48')]['id']},'attributes':[_0x3e1e('0x2a'),_0x3e1e('0x4c'),'converted_format'],'raw':!![]})[_0x3e1e('0x24')](handleEntityNotFound(_0x31f4ae,null))['then'](function(_0x1b9716){if(_0x1b9716){if(!fs[_0x3e1e('0x4d')](path['join'](config['root'],_0x3e1e('0x4e'),_0x1b9716[_0x3e1e('0x4c')]+'.'+_0x1b9716['converted_format']))){throw new db[(_0x3e1e('0x4f'))][(_0x3e1e('0x50'))](_0x3e1e('0x51'));}return _0x31f4ae[_0x3e1e('0x4b')](path[_0x3e1e('0x52')](config[_0x3e1e('0x53')],_0x3e1e('0x4e'),util[_0x3e1e('0x54')]('%s.%s',_0x1b9716['save_name'],_0x1b9716[_0x3e1e('0x55')])),util[_0x3e1e('0x54')]('%s.%s',_0x1b9716[_0x3e1e('0x2a')],_0x1b9716[_0x3e1e('0x55')]));}return null;})[_0x3e1e('0x47')](handleError(_0x31f4ae,null));};exports[_0x3e1e('0x56')]=function(_0xda2807,_0xf61b27,_0x130e0f){var _0x29509e={'name':path[_0x3e1e('0x57')](_0xda2807[_0x3e1e('0x58')]['originalname'],path['extname'](_0xda2807[_0x3e1e('0x58')]['originalname'])),'save_name':path['basename'](_0xda2807[_0x3e1e('0x58')][_0x3e1e('0x59')],path[_0x3e1e('0x5a')](_0xda2807['file'][_0x3e1e('0x59')])),'original_format':path['extname'](_0xda2807['file'][_0x3e1e('0x5b')])[_0x3e1e('0x5c')](0x1),'converted_format':_0x3e1e('0x5d')};var _0x509e45=path[_0x3e1e('0x52')](config[_0x3e1e('0x53')],'server/files/sounds/original',_0xda2807['file'][_0x3e1e('0x59')]);var _0x2e0a06=path[_0x3e1e('0x52')](config[_0x3e1e('0x53')],_0x3e1e('0x4e'),util[_0x3e1e('0x54')](_0x3e1e('0x5e'),path[_0x3e1e('0x57')](_0xda2807['file'][_0x3e1e('0x59')],path[_0x3e1e('0x5a')](_0xda2807['file'][_0x3e1e('0x59')])),_0x29509e[_0x3e1e('0x55')]));logger[_0x3e1e('0x5f')](_0x3e1e('0x60'),_0x509e45);logger[_0x3e1e('0x5f')](_0x3e1e('0x61'),_0x2e0a06);try{fs[_0x3e1e('0x62')](_0x509e45,parseInt(_0x3e1e('0x63'),0x8));var _0x3171f9=sox['transcode'](_0x509e45,_0x2e0a06,{'sampleRate':0x1f40,'format':_0x3e1e('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3171f9['on'](_0x3e1e('0x28'),function(_0x10df79){fs[_0x3e1e('0x64')](_0x509e45);_0xf61b27[_0x3e1e('0x19')](0x1f4)[_0x3e1e('0x2b')](_0x10df79);});_0x3171f9['on'](_0x3e1e('0x65'),function(_0x308259){_0x29509e[_0x3e1e('0x66')]=isNaN(_0x308259['duration'])?null:_0x308259['duration']*0x3e8;_0x29509e[_0x3e1e('0x67')]=isNaN(_0x308259[_0x3e1e('0x68')])?null:_0x308259[_0x3e1e('0x68')];_0x29509e[_0x3e1e('0x69')]=isNaN(_0x308259[_0x3e1e('0x6a')])?null:_0x308259[_0x3e1e('0x6a')];_0x29509e[_0x3e1e('0x6b')]=isNaN(_0x308259[_0x3e1e('0x6c')])?null:_0x308259[_0x3e1e('0x6c')];_0x29509e[_0x3e1e('0x6d')]=isNaN(_0x308259['sampleRate'])?null:_0x308259[_0x3e1e('0x6e')];});_0x3171f9['on'](_0x3e1e('0x6f'),function(_0x40ad09){_0x29509e[_0x3e1e('0x70')]=isNaN(_0x40ad09[_0x3e1e('0x71')])?null:_0x40ad09['duration']*0x3e8;_0x29509e['converted_sampleCount']=isNaN(_0x40ad09[_0x3e1e('0x68')])?null:_0x40ad09['sampleCount'];_0x29509e[_0x3e1e('0x72')]=isNaN(_0x40ad09[_0x3e1e('0x6a')])?null:_0x40ad09[_0x3e1e('0x6a')];_0x29509e[_0x3e1e('0x73')]=isNaN(_0x40ad09[_0x3e1e('0x6c')])?null:_0x40ad09[_0x3e1e('0x6c')];_0x29509e[_0x3e1e('0x74')]=isNaN(_0x40ad09['sampleRate'])?null:_0x40ad09['sampleRate'];});_0x3171f9['on'](_0x3e1e('0x75'),function(){fs[_0x3e1e('0x62')](_0x2e0a06,parseInt(_0x3e1e('0x63'),0x8));return db[_0x3e1e('0x2d')][_0x3e1e('0x56')](_0x29509e)[_0x3e1e('0x24')](function(_0x24b595){var _0x52c70f={'role':_0xda2807[_0x3e1e('0x76')]['role'],'userProfileId':_0xda2807[_0x3e1e('0x76')]['userProfileId']};if(!_0x52c70f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52c70f['role']===_0x3e1e('0x77')){var _0x537e25=_0x24b595[_0x3e1e('0x25')]({'plain':!![]});return db[_0x3e1e('0x78')][_0x3e1e('0x4a')]({'where':{'name':_0x3e1e('0x79'),'userProfileId':_0x52c70f[_0x3e1e('0x7a')]},'raw':!![]})[_0x3e1e('0x24')](function(_0x11ce38){if(_0x11ce38&&_0x11ce38['autoAssociation']===0x0){return db[_0x3e1e('0x26')][_0x3e1e('0x56')]({'name':_0x537e25[_0x3e1e('0x2a')],'resourceId':_0x537e25['id'],'type':_0x11ce38[_0x3e1e('0x2a')],'sectionId':_0x11ce38['id']},{})['then'](function(){return _0x24b595;});}else{return _0x24b595;}})[_0x3e1e('0x47')](function(_0x25ef2b){logger[_0x3e1e('0x28')](_0x3e1e('0x7b'),_0x25ef2b);throw _0x25ef2b;});}return _0x24b595;})[_0x3e1e('0x24')](respondWithResult(_0xf61b27,null))[_0x3e1e('0x47')](handleError(_0xf61b27,null));});_0x3171f9[_0x3e1e('0x7c')]();}catch(_0x6576ad){_0xf61b27['status'](0x1f4)[_0x3e1e('0x2b')](_0x6576ad);}};exports[_0x3e1e('0x7d')]=function(_0x441942,_0x44ea73,_0x1b44b7){return db[_0x3e1e('0x2d')][_0x3e1e('0x4a')]({'where':{'id':_0x441942[_0x3e1e('0x48')]['id']}})['then'](handleEntityNotFound(_0x44ea73,null))['then'](saveUpdates(_[_0x3e1e('0x3d')](_0x441942[_0x3e1e('0x76')],[_0x3e1e('0x2a'),'description']),null))['then'](respondWithResult(_0x44ea73,null))[_0x3e1e('0x47')](handleError(_0x44ea73,null));};exports[_0x3e1e('0x7e')]=function(_0x27164b,_0x18f59a,_0x383af9){return db[_0x3e1e('0x2d')][_0x3e1e('0x4a')]({'where':{'id':_0x27164b[_0x3e1e('0x48')]['id']}})[_0x3e1e('0x24')](function(_0x2503af){if(_0x2503af){return _0x2503af['destroy']();}})[_0x3e1e('0x24')](function(_0x117e69){var _0x50e3e3=path['join'](config[_0x3e1e('0x53')],_0x3e1e('0x7f'),util[_0x3e1e('0x54')](_0x3e1e('0x5e'),_0x117e69[_0x3e1e('0x4c')],_0x117e69[_0x3e1e('0x80')]));var _0x4959a7=path[_0x3e1e('0x52')](config[_0x3e1e('0x53')],_0x3e1e('0x4e'),util[_0x3e1e('0x54')](_0x3e1e('0x5e'),_0x117e69[_0x3e1e('0x4c')],_0x117e69[_0x3e1e('0x55')]));fs['unlinkSync'](_0x50e3e3);fs[_0x3e1e('0x64')](_0x4959a7);return _0x117e69;})[_0x3e1e('0x24')](function(_0x25339a){if(_0x25339a){return _0x18f59a['status'](0xcc)[_0x3e1e('0x75')]();}})['then'](handleEntityNotFound(_0x18f59a,null))['catch'](handleError(_0x18f59a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3806f2a..088f042 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 _0xb578=['define','tools_sounds','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x17e2e7,_0xe9e1d0){var _0x2ed751=function(_0x4292a4){while(--_0x4292a4){_0x17e2e7['push'](_0x17e2e7['shift']());}};_0x2ed751(++_0xe9e1d0);}(_0xb578,0xc8));var _0x8b57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb578[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8b57('0x0'));var util=require(_0x8b57('0x1'));var logger=require('../../config/logger')(_0x8b57('0x2'));var moment=require('moment');var BPromise=require(_0x8b57('0x3'));var rp=require(_0x8b57('0x4'));var fs=require('fs');var path=require(_0x8b57('0x5'));var rimraf=require(_0x8b57('0x6'));var config=require(_0x8b57('0x7'));var attributes=require(_0x8b57('0x8'));module['exports']=function(_0x33bf72,_0x3511b1){return _0x33bf72[_0x8b57('0x9')]('Sound',attributes,{'tableName':_0x8b57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc56=['../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x39408b,_0x36bedf){var _0x2b4a70=function(_0x20545c){while(--_0x20545c){_0x39408b['push'](_0x39408b['shift']());}};_0x2b4a70(++_0x36bedf);}(_0xdc56,0x75));var _0x6dc5=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0xdc56[_0x18b344];return _0x5ef6bb;};'use strict';var _=require(_0x6dc5('0x0'));var util=require(_0x6dc5('0x1'));var logger=require(_0x6dc5('0x2'))(_0x6dc5('0x3'));var moment=require(_0x6dc5('0x4'));var BPromise=require(_0x6dc5('0x5'));var rp=require(_0x6dc5('0x6'));var fs=require('fs');var path=require(_0x6dc5('0x7'));var rimraf=require(_0x6dc5('0x8'));var config=require(_0x6dc5('0x9'));var attributes=require(_0x6dc5('0xa'));module[_0x6dc5('0xb')]=function(_0x21f555,_0x56f946){return _0x21f555[_0x6dc5('0xc')](_0x6dc5('0xd'),attributes,{'tableName':'tools_sounds','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 fa134bb..95bfa2c 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 _0x5290=['error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','where','include','map','model','attributes','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b88cc,_0x5ede96){var _0xa581ee=function(_0x419b0c){while(--_0x419b0c){_0x5b88cc['push'](_0x5b88cc['shift']());}};_0xa581ee(++_0x5ede96);}(_0x5290,0x130));var _0x0529=function(_0x24a72e,_0x23aaad){_0x24a72e=_0x24a72e-0x0;var _0x249e5c=_0x5290[_0x24a72e];return _0x249e5c;};'use strict';var _=require(_0x0529('0x0'));var util=require(_0x0529('0x1'));var moment=require('moment');var BPromise=require(_0x0529('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0529('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0529('0x4'));var logger=require(_0x0529('0x5'))(_0x0529('0x6'));var config=require(_0x0529('0x7'));var jayson=require(_0x0529('0x8'));var client=jayson[_0x0529('0x9')][_0x0529('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d192a,_0x5b1b4b,_0x49e715){return new BPromise(function(_0x43089d,_0xd3f8ca){return client['request'](_0x2d192a,_0x49e715)[_0x0529('0xb')](function(_0x2f116d){logger[_0x0529('0xc')]('Sound,\x20%s,\x20%s',_0x5b1b4b,_0x0529('0xd'));logger['debug'](_0x0529('0xe'),_0x5b1b4b,_0x0529('0xd'),JSON[_0x0529('0xf')](_0x2f116d));if(_0x2f116d['error']){if(_0x2f116d[_0x0529('0x10')][_0x0529('0x11')]===0x1f4){logger['error'](_0x0529('0x12'),_0x5b1b4b,_0x2f116d[_0x0529('0x10')][_0x0529('0x13')]);return _0xd3f8ca(_0x2f116d[_0x0529('0x10')][_0x0529('0x13')]);}logger['error'](_0x0529('0x12'),_0x5b1b4b,_0x2f116d[_0x0529('0x10')][_0x0529('0x13')]);return _0x43089d(_0x2f116d[_0x0529('0x10')][_0x0529('0x13')]);}else{logger[_0x0529('0xc')]('Sound,\x20%s,\x20%s',_0x5b1b4b,_0x0529('0xd'));_0x43089d(_0x2f116d[_0x0529('0x14')][_0x0529('0x13')]);}})[_0x0529('0x15')](function(_0x560940){logger[_0x0529('0x10')](_0x0529('0x12'),_0x5b1b4b,_0x560940);_0xd3f8ca(_0x560940);});});}exports[_0x0529('0x16')]=function(_0x2f63ca){var _0x5cdb7e=this;return new Promise(function(_0x315376,_0x177b55){return db[_0x0529('0x17')][_0x0529('0x18')]({'raw':_0x2f63ca[_0x0529('0x19')]?_0x2f63ca[_0x0529('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2f63ca[_0x0529('0x19')]?_0x2f63ca['options'][_0x0529('0x1a')]||null:null,'attributes':_0x2f63ca[_0x0529('0x19')]?_0x2f63ca['options']['attributes']||null:null,'include':_0x2f63ca['options']?_0x2f63ca[_0x0529('0x19')][_0x0529('0x1b')]?_[_0x0529('0x1c')](_0x2f63ca[_0x0529('0x19')]['include'],function(_0x30617e){return{'model':db[_0x30617e[_0x0529('0x1d')]],'as':_0x30617e['as'],'attributes':_0x30617e['attributes'],'include':_0x30617e[_0x0529('0x1b')]?_['map'](_0x30617e['include'],function(_0x5caef6){return{'model':db[_0x5caef6['model']],'as':_0x5caef6['as'],'attributes':_0x5caef6[_0x0529('0x1e')],'include':_0x5caef6['include']?_[_0x0529('0x1c')](_0x5caef6['include'],function(_0x39366b){return{'model':db[_0x39366b[_0x0529('0x1d')]],'as':_0x39366b['as'],'attributes':_0x39366b[_0x0529('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0529('0xb')](function(_0x414270){logger[_0x0529('0xc')]('ShowSound',_0x2f63ca);logger[_0x0529('0x1f')]('ShowSound',_0x2f63ca,JSON[_0x0529('0xf')](_0x414270));_0x315376(_0x414270);})['catch'](function(_0x28f546){logger[_0x0529('0x10')](_0x0529('0x16'),_0x28f546[_0x0529('0x13')],_0x2f63ca);_0x177b55(_0x5cdb7e[_0x0529('0x10')](0x1f4,_0x28f546[_0x0529('0x13')]));});});}; \ No newline at end of file +var _0x66f1=['error','message','result','catch','ShowSound','find','options','raw','where','attributes','map','include','model','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x66f1,0x11c));var _0x166f=function(_0x45ca1f,_0x2341c9){_0x45ca1f=_0x45ca1f-0x0;var _0x11b2ce=_0x66f1[_0x45ca1f];return _0x11b2ce;};'use strict';var _=require('lodash');var util=require(_0x166f('0x0'));var moment=require('moment');var BPromise=require(_0x166f('0x1'));var rs=require(_0x166f('0x2'));var fs=require('fs');var Redis=require(_0x166f('0x3'));var db=require(_0x166f('0x4'))['db'];var utils=require(_0x166f('0x5'));var logger=require(_0x166f('0x6'))(_0x166f('0x7'));var config=require('../../config/environment');var jayson=require(_0x166f('0x8'));var client=jayson[_0x166f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb6dc43,_0x1d735c,_0x17cce9){return new BPromise(function(_0x493703,_0x104b50){return client[_0x166f('0xa')](_0xb6dc43,_0x17cce9)[_0x166f('0xb')](function(_0x104e2f){logger[_0x166f('0xc')](_0x166f('0xd'),_0x1d735c,_0x166f('0xe'));logger['debug'](_0x166f('0xf'),_0x1d735c,_0x166f('0xe'),JSON['stringify'](_0x104e2f));if(_0x104e2f[_0x166f('0x10')]){if(_0x104e2f[_0x166f('0x10')]['code']===0x1f4){logger[_0x166f('0x10')](_0x166f('0xd'),_0x1d735c,_0x104e2f['error'][_0x166f('0x11')]);return _0x104b50(_0x104e2f[_0x166f('0x10')][_0x166f('0x11')]);}logger['error'](_0x166f('0xd'),_0x1d735c,_0x104e2f[_0x166f('0x10')][_0x166f('0x11')]);return _0x493703(_0x104e2f[_0x166f('0x10')][_0x166f('0x11')]);}else{logger[_0x166f('0xc')](_0x166f('0xd'),_0x1d735c,'request\x20sent');_0x493703(_0x104e2f[_0x166f('0x12')][_0x166f('0x11')]);}})[_0x166f('0x13')](function(_0xff1596){logger['error'](_0x166f('0xd'),_0x1d735c,_0xff1596);_0x104b50(_0xff1596);});});}exports[_0x166f('0x14')]=function(_0x2e5afe){var _0x1ecc18=this;return new Promise(function(_0x24a681,_0x3e9680){return db['Sound'][_0x166f('0x15')]({'raw':_0x2e5afe[_0x166f('0x16')]?_0x2e5afe[_0x166f('0x16')][_0x166f('0x17')]===undefined?!![]:![]:!![],'where':_0x2e5afe[_0x166f('0x16')]?_0x2e5afe[_0x166f('0x16')][_0x166f('0x18')]||null:null,'attributes':_0x2e5afe[_0x166f('0x16')]?_0x2e5afe[_0x166f('0x16')][_0x166f('0x19')]||null:null,'include':_0x2e5afe[_0x166f('0x16')]?_0x2e5afe[_0x166f('0x16')]['include']?_[_0x166f('0x1a')](_0x2e5afe[_0x166f('0x16')][_0x166f('0x1b')],function(_0x26f9cd){return{'model':db[_0x26f9cd[_0x166f('0x1c')]],'as':_0x26f9cd['as'],'attributes':_0x26f9cd[_0x166f('0x19')],'include':_0x26f9cd[_0x166f('0x1b')]?_['map'](_0x26f9cd['include'],function(_0x413061){return{'model':db[_0x413061[_0x166f('0x1c')]],'as':_0x413061['as'],'attributes':_0x413061[_0x166f('0x19')],'include':_0x413061['include']?_[_0x166f('0x1a')](_0x413061['include'],function(_0xdd09e9){return{'model':db[_0xdd09e9['model']],'as':_0xdd09e9['as'],'attributes':_0xdd09e9[_0x166f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x166f('0xb')](function(_0x3a7db6){logger['info'](_0x166f('0x14'),_0x2e5afe);logger['debug']('ShowSound',_0x2e5afe,JSON[_0x166f('0x1d')](_0x3a7db6));_0x24a681(_0x3a7db6);})['catch'](function(_0x52456c){logger['error'](_0x166f('0x14'),_0x52456c[_0x166f('0x11')],_0x2e5afe);_0x3e9680(_0x1ecc18[_0x166f('0x10')](0x1f4,_0x52456c[_0x166f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d8c5d16..6ab99d0 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x3b1caf,_0x8a35c5){var _0x416b17=function(_0x105e1b){while(--_0x105e1b){_0x3b1caf['push'](_0x3b1caf['shift']());}};_0x416b17(++_0x8a35c5);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x5b2f89,_0x2fc5a5){var _0x5905ab=function(_0x38a4e1){while(--_0x38a4e1){_0x5b2f89['push'](_0x5b2f89['shift']());}};_0x5905ab(++_0x2fc5a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'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('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 736893f..ed973dc 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 _0x3fab=['out','sequelize','exports','TEXT','medium','ENUM'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x3fab,0x127));var _0xb3fa=function(_0x572c70,_0x18467e){_0x572c70=_0x572c70-0x0;var _0x4964c1=_0x3fab[_0x572c70];return _0x4964c1;};'use strict';var Sequelize=require(_0xb3fa('0x0'));module[_0xb3fa('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xb3fa('0x2')](_0xb3fa('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xb3fa('0x4')]('in','out'),'defaultValue':_0xb3fa('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb3fa('0x2')]}}; \ No newline at end of file +var _0x0363=['medium','ENUM','out','sequelize','exports','STRING'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0x0363,0xa5));var _0x3036=function(_0xdd27d1,_0xb6f0da){_0xdd27d1=_0xdd27d1-0x0;var _0x58220e=_0x0363[_0xdd27d1];return _0x58220e;};'use strict';var Sequelize=require(_0x3036('0x0'));module[_0x3036('0x1')]={'uniqueid':{'type':Sequelize[_0x3036('0x2')]},'body':{'type':Sequelize['TEXT'](_0x3036('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x3036('0x4')]('in',_0x3036('0x5')),'defaultValue':_0x3036('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3036('0x2')]},'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 372b04b..c215163 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 _0x79b5=['params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','crypto','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','end','json','offset','limit','count','status','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','SquareMessage','findAll','catch','show','find','create','body'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x79b5,0x1bd));var _0x579b=function(_0x248d50,_0x468351){_0x248d50=_0x248d50-0x0;var _0x18755e=_0x79b5[_0x248d50];return _0x18755e;};'use strict';var emlformat=require(_0x579b('0x0'));var rimraf=require(_0x579b('0x1'));var zipdir=require(_0x579b('0x2'));var jsonpatch=require(_0x579b('0x3'));var rp=require('request-promise');var moment=require(_0x579b('0x4'));var BPromise=require(_0x579b('0x5'));var Mustache=require(_0x579b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x579b('0x7'));var csv=require(_0x579b('0x8'));var ejs=require(_0x579b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x579b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x579b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x579b('0xc'));var Papa=require(_0x579b('0xd'));var Redis=require(_0x579b('0xe'));var authService=require(_0x579b('0xf'));var qs=require(_0x579b('0x10'));var as=require(_0x579b('0x11'));var hardwareService=require(_0x579b('0x12'));var logger=require(_0x579b('0x13'))('api');var utils=require(_0x579b('0x14'));var config=require(_0x579b('0x15'));var licenseUtil=require(_0x579b('0x16'));var db=require(_0x579b('0x17'))['db'];function respondWithStatusCode(_0x38168f,_0x743583){_0x743583=_0x743583||0xcc;return function(_0x152fd7){if(_0x152fd7){return _0x38168f['sendStatus'](_0x743583);}return _0x38168f['status'](_0x743583)[_0x579b('0x18')]();};}function respondWithResult(_0x22d6ae,_0x5dfda5){_0x5dfda5=_0x5dfda5||0xc8;return function(_0x3b8614){if(_0x3b8614){return _0x22d6ae['status'](_0x5dfda5)[_0x579b('0x19')](_0x3b8614);}};}function respondWithFilteredResult(_0x4a72b6,_0x5e0697){return function(_0x322060){if(_0x322060){var _0x2a8cc0=typeof _0x5e0697[_0x579b('0x1a')]==='undefined'&&typeof _0x5e0697[_0x579b('0x1b')]==='undefined';var _0x5003a3=_0x322060[_0x579b('0x1c')];var _0x830e4c=_0x2a8cc0?0x0:_0x5e0697[_0x579b('0x1a')];var _0x1eafce=_0x2a8cc0?_0x322060['count']:_0x5e0697[_0x579b('0x1a')]+_0x5e0697['limit'];var _0x264d0a;if(_0x1eafce>=_0x5003a3){_0x1eafce=_0x5003a3;_0x264d0a=0xc8;}else{_0x264d0a=0xce;}_0x4a72b6[_0x579b('0x1d')](_0x264d0a);return _0x4a72b6['set'](_0x579b('0x1e'),_0x830e4c+'-'+_0x1eafce+'/'+_0x5003a3)[_0x579b('0x19')](_0x322060);}return null;};}function patchUpdates(_0x10f72d){return function(_0x47d21d){try{jsonpatch['apply'](_0x47d21d,_0x10f72d,!![]);}catch(_0x6d2d04){return BPromise[_0x579b('0x1f')](_0x6d2d04);}return _0x47d21d[_0x579b('0x20')]();};}function saveUpdates(_0xfb69d6,_0x2a1ad5){return function(_0x37b08c){if(_0x37b08c){return _0x37b08c[_0x579b('0x21')](_0xfb69d6)['then'](function(_0x2ff904){return _0x2ff904;});}return null;};}function removeEntity(_0x1355a2,_0x562291){return function(_0x37b269){if(_0x37b269){return _0x37b269[_0x579b('0x22')]()[_0x579b('0x23')](function(){_0x1355a2[_0x579b('0x1d')](0xcc)[_0x579b('0x18')]();});}};}function handleEntityNotFound(_0x33bf67,_0x5cb1fc){return function(_0x492e4e){if(!_0x492e4e){_0x33bf67[_0x579b('0x24')](0x194);}return _0x492e4e;};}function handleError(_0x5aa965,_0x130fc7){_0x130fc7=_0x130fc7||0x1f4;return function(_0x450a9b){logger[_0x579b('0x25')](_0x450a9b[_0x579b('0x26')]);if(_0x450a9b['name']){delete _0x450a9b[_0x579b('0x27')];}_0x5aa965['status'](_0x130fc7)[_0x579b('0x28')](_0x450a9b);};}exports['index']=function(_0x5dd850,_0x2e41e7){var _0x59b9e4={},_0x4afa63={},_0x31e14c={'count':0x0,'rows':[]};var _0x2f47ea=_[_0x579b('0x29')](db['SquareMessage'][_0x579b('0x2a')],function(_0x54c7fd){return{'name':_0x54c7fd[_0x579b('0x2b')],'type':_0x54c7fd[_0x579b('0x2c')][_0x579b('0x2d')]};});_0x4afa63[_0x579b('0x2e')]=_[_0x579b('0x29')](_0x2f47ea,_0x579b('0x27'));_0x4afa63['query']=_[_0x579b('0x2f')](_0x5dd850['query']);_0x4afa63[_0x579b('0x30')]=_['intersection'](_0x4afa63[_0x579b('0x2e')],_0x4afa63[_0x579b('0x31')]);_0x59b9e4['attributes']=_[_0x579b('0x32')](_0x4afa63[_0x579b('0x2e')],qs[_0x579b('0x33')](_0x5dd850[_0x579b('0x31')][_0x579b('0x33')]));_0x59b9e4[_0x579b('0x34')]=_0x59b9e4[_0x579b('0x34')][_0x579b('0x35')]?_0x59b9e4['attributes']:_0x4afa63[_0x579b('0x2e')];if(!_0x5dd850['query'][_0x579b('0x36')](_0x579b('0x37'))){_0x59b9e4['limit']=qs[_0x579b('0x1b')](_0x5dd850[_0x579b('0x31')][_0x579b('0x1b')]);_0x59b9e4[_0x579b('0x1a')]=qs[_0x579b('0x1a')](_0x5dd850[_0x579b('0x31')][_0x579b('0x1a')]);}_0x59b9e4[_0x579b('0x38')]=qs[_0x579b('0x39')](_0x5dd850[_0x579b('0x31')][_0x579b('0x39')]);_0x59b9e4[_0x579b('0x3a')]=qs[_0x579b('0x30')](_[_0x579b('0x3b')](_0x5dd850['query'],_0x4afa63['filters']),_0x2f47ea);if(_0x5dd850['query']['filter']){_0x59b9e4[_0x579b('0x3a')]=_['merge'](_0x59b9e4[_0x579b('0x3a')],{'$or':_[_0x579b('0x29')](_0x2f47ea,function(_0x3de481){if(_0x3de481[_0x579b('0x2c')]!==_0x579b('0x3c')){var _0xfa6e2={};_0xfa6e2[_0x3de481[_0x579b('0x27')]]={'$like':'%'+_0x5dd850[_0x579b('0x31')][_0x579b('0x3d')]+'%'};return _0xfa6e2;}})});}_0x59b9e4=_[_0x579b('0x3e')]({},_0x59b9e4,_0x5dd850[_0x579b('0x3f')]);var _0x5b7501={'where':_0x59b9e4['where']};return db['SquareMessage']['count'](_0x5b7501)[_0x579b('0x23')](function(_0x5d2b74){_0x31e14c[_0x579b('0x1c')]=_0x5d2b74;if(_0x5dd850[_0x579b('0x31')][_0x579b('0x40')]){_0x59b9e4[_0x579b('0x41')]=[{'all':!![]}];}return db[_0x579b('0x42')][_0x579b('0x43')](_0x59b9e4);})['then'](function(_0x208e9a){_0x31e14c['rows']=_0x208e9a;return _0x31e14c;})['then'](respondWithFilteredResult(_0x2e41e7,_0x59b9e4))[_0x579b('0x44')](handleError(_0x2e41e7,null));};exports[_0x579b('0x45')]=function(_0x1c1c60,_0x262cd8){var _0x3d94bf={'raw':!![],'where':{'id':_0x1c1c60['params']['id']}},_0x5752ac={};_0x5752ac['model']=_['keys'](db[_0x579b('0x42')][_0x579b('0x2a')]);_0x5752ac[_0x579b('0x31')]=_['keys'](_0x1c1c60[_0x579b('0x31')]);_0x5752ac[_0x579b('0x30')]=_['intersection'](_0x5752ac['model'],_0x5752ac[_0x579b('0x31')]);_0x3d94bf[_0x579b('0x34')]=_[_0x579b('0x32')](_0x5752ac[_0x579b('0x2e')],qs[_0x579b('0x33')](_0x1c1c60['query'][_0x579b('0x33')]));_0x3d94bf[_0x579b('0x34')]=_0x3d94bf['attributes']['length']?_0x3d94bf[_0x579b('0x34')]:_0x5752ac[_0x579b('0x2e')];if(_0x1c1c60['query'][_0x579b('0x40')]){_0x3d94bf[_0x579b('0x41')]=[{'all':!![]}];}_0x3d94bf=_[_0x579b('0x3e')]({},_0x3d94bf,_0x1c1c60['options']);return db[_0x579b('0x42')][_0x579b('0x46')](_0x3d94bf)['then'](handleEntityNotFound(_0x262cd8,null))[_0x579b('0x23')](respondWithResult(_0x262cd8,null))[_0x579b('0x44')](handleError(_0x262cd8,null));};exports[_0x579b('0x47')]=function(_0xfc95b0,_0x1ef874){return db['SquareMessage']['create'](_0xfc95b0[_0x579b('0x48')],{})[_0x579b('0x23')](respondWithResult(_0x1ef874,0xc9))[_0x579b('0x44')](handleError(_0x1ef874,null));};exports[_0x579b('0x21')]=function(_0x5747c5,_0x168682){if(_0x5747c5['body']['id']){delete _0x5747c5[_0x579b('0x48')]['id'];}return db[_0x579b('0x42')][_0x579b('0x46')]({'where':{'id':_0x5747c5['params']['id']}})[_0x579b('0x23')](handleEntityNotFound(_0x168682,null))[_0x579b('0x23')](saveUpdates(_0x5747c5[_0x579b('0x48')],null))[_0x579b('0x23')](respondWithResult(_0x168682,null))[_0x579b('0x44')](handleError(_0x168682,null));};exports[_0x579b('0x22')]=function(_0x9afb0b,_0x4ac3ef){return db['SquareMessage'][_0x579b('0x46')]({'where':{'id':_0x9afb0b[_0x579b('0x49')]['id']}})[_0x579b('0x23')](handleEntityNotFound(_0x4ac3ef,null))[_0x579b('0x23')](removeEntity(_0x4ac3ef,null))[_0x579b('0x44')](handleError(_0x4ac3ef,null));}; \ No newline at end of file +var _0x33cd=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','then','sendStatus','error','stack','name','send','index','map','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareMessage','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x33cd,0x180));var _0xd33c=function(_0x3d760e,_0x4acb52){_0x3d760e=_0x3d760e-0x0;var _0x316567=_0x33cd[_0x3d760e];return _0x316567;};'use strict';var emlformat=require(_0xd33c('0x0'));var rimraf=require(_0xd33c('0x1'));var zipdir=require(_0xd33c('0x2'));var jsonpatch=require(_0xd33c('0x3'));var rp=require(_0xd33c('0x4'));var moment=require(_0xd33c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd33c('0x6'));var path=require(_0xd33c('0x7'));var sox=require(_0xd33c('0x8'));var csv=require(_0xd33c('0x9'));var ejs=require(_0xd33c('0xa'));var fs=require('fs');var fs_extra=require(_0xd33c('0xb'));var _=require(_0xd33c('0xc'));var squel=require(_0xd33c('0xd'));var crypto=require(_0xd33c('0xe'));var jsforce=require(_0xd33c('0xf'));var deskjs=require(_0xd33c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd33c('0x11'));var Redis=require(_0xd33c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd33c('0x13'));var as=require(_0xd33c('0x14'));var hardwareService=require(_0xd33c('0x15'));var logger=require(_0xd33c('0x16'))(_0xd33c('0x17'));var utils=require(_0xd33c('0x18'));var config=require(_0xd33c('0x19'));var licenseUtil=require(_0xd33c('0x1a'));var db=require(_0xd33c('0x1b'))['db'];function respondWithStatusCode(_0x155727,_0x2f6a77){_0x2f6a77=_0x2f6a77||0xcc;return function(_0x3a38af){if(_0x3a38af){return _0x155727['sendStatus'](_0x2f6a77);}return _0x155727[_0xd33c('0x1c')](_0x2f6a77)[_0xd33c('0x1d')]();};}function respondWithResult(_0x4ca174,_0x2ec24d){_0x2ec24d=_0x2ec24d||0xc8;return function(_0x829443){if(_0x829443){return _0x4ca174[_0xd33c('0x1c')](_0x2ec24d)[_0xd33c('0x1e')](_0x829443);}};}function respondWithFilteredResult(_0x4b014c,_0x191593){return function(_0x1a1b24){if(_0x1a1b24){var _0x19967a=typeof _0x191593[_0xd33c('0x1f')]==='undefined'&&typeof _0x191593[_0xd33c('0x20')]===_0xd33c('0x21');var _0x3e5104=_0x1a1b24[_0xd33c('0x22')];var _0x140c79=_0x19967a?0x0:_0x191593[_0xd33c('0x1f')];var _0x41b39a=_0x19967a?_0x1a1b24[_0xd33c('0x22')]:_0x191593[_0xd33c('0x1f')]+_0x191593[_0xd33c('0x20')];var _0x4d551;if(_0x41b39a>=_0x3e5104){_0x41b39a=_0x3e5104;_0x4d551=0xc8;}else{_0x4d551=0xce;}_0x4b014c[_0xd33c('0x1c')](_0x4d551);return _0x4b014c[_0xd33c('0x23')]('Content-Range',_0x140c79+'-'+_0x41b39a+'/'+_0x3e5104)[_0xd33c('0x1e')](_0x1a1b24);}return null;};}function patchUpdates(_0x1bdd52){return function(_0x347480){try{jsonpatch[_0xd33c('0x24')](_0x347480,_0x1bdd52,!![]);}catch(_0x973bc5){return BPromise['reject'](_0x973bc5);}return _0x347480['save']();};}function saveUpdates(_0x156acb,_0xe07e1a){return function(_0xc60004){if(_0xc60004){return _0xc60004['update'](_0x156acb)[_0xd33c('0x25')](function(_0xc36199){return _0xc36199;});}return null;};}function removeEntity(_0x190411,_0x23ed07){return function(_0x119713){if(_0x119713){return _0x119713['destroy']()[_0xd33c('0x25')](function(){_0x190411['status'](0xcc)[_0xd33c('0x1d')]();});}};}function handleEntityNotFound(_0x18a68c,_0x2c04a2){return function(_0xd5122){if(!_0xd5122){_0x18a68c[_0xd33c('0x26')](0x194);}return _0xd5122;};}function handleError(_0x465bc8,_0x41c9a1){_0x41c9a1=_0x41c9a1||0x1f4;return function(_0x327e17){logger[_0xd33c('0x27')](_0x327e17[_0xd33c('0x28')]);if(_0x327e17[_0xd33c('0x29')]){delete _0x327e17[_0xd33c('0x29')];}_0x465bc8['status'](_0x41c9a1)[_0xd33c('0x2a')](_0x327e17);};}exports[_0xd33c('0x2b')]=function(_0xa7c096,_0x2d5a12){var _0x258b3e={},_0x414dd1={},_0x29c77c={'count':0x0,'rows':[]};var _0x3b0ef8=_[_0xd33c('0x2c')](db['SquareMessage']['rawAttributes'],function(_0x27cb65){return{'name':_0x27cb65[_0xd33c('0x2d')],'type':_0x27cb65[_0xd33c('0x2e')]['key']};});_0x414dd1[_0xd33c('0x2f')]=_['map'](_0x3b0ef8,_0xd33c('0x29'));_0x414dd1['query']=_[_0xd33c('0x30')](_0xa7c096[_0xd33c('0x31')]);_0x414dd1[_0xd33c('0x32')]=_['intersection'](_0x414dd1['model'],_0x414dd1[_0xd33c('0x31')]);_0x258b3e[_0xd33c('0x33')]=_['intersection'](_0x414dd1[_0xd33c('0x2f')],qs[_0xd33c('0x34')](_0xa7c096[_0xd33c('0x31')][_0xd33c('0x34')]));_0x258b3e[_0xd33c('0x33')]=_0x258b3e[_0xd33c('0x33')][_0xd33c('0x35')]?_0x258b3e[_0xd33c('0x33')]:_0x414dd1['model'];if(!_0xa7c096['query'][_0xd33c('0x36')](_0xd33c('0x37'))){_0x258b3e[_0xd33c('0x20')]=qs[_0xd33c('0x20')](_0xa7c096[_0xd33c('0x31')][_0xd33c('0x20')]);_0x258b3e[_0xd33c('0x1f')]=qs[_0xd33c('0x1f')](_0xa7c096['query'][_0xd33c('0x1f')]);}_0x258b3e[_0xd33c('0x38')]=qs[_0xd33c('0x39')](_0xa7c096['query'][_0xd33c('0x39')]);_0x258b3e[_0xd33c('0x3a')]=qs[_0xd33c('0x32')](_[_0xd33c('0x3b')](_0xa7c096[_0xd33c('0x31')],_0x414dd1[_0xd33c('0x32')]),_0x3b0ef8);if(_0xa7c096[_0xd33c('0x31')][_0xd33c('0x3c')]){_0x258b3e[_0xd33c('0x3a')]=_['merge'](_0x258b3e[_0xd33c('0x3a')],{'$or':_[_0xd33c('0x2c')](_0x3b0ef8,function(_0x454388){if(_0x454388[_0xd33c('0x2e')]!==_0xd33c('0x3d')){var _0x3369a9={};_0x3369a9[_0x454388['name']]={'$like':'%'+_0xa7c096[_0xd33c('0x31')][_0xd33c('0x3c')]+'%'};return _0x3369a9;}})});}_0x258b3e=_[_0xd33c('0x3e')]({},_0x258b3e,_0xa7c096[_0xd33c('0x3f')]);var _0x2ab53f={'where':_0x258b3e[_0xd33c('0x3a')]};return db[_0xd33c('0x40')][_0xd33c('0x22')](_0x2ab53f)[_0xd33c('0x25')](function(_0x382b7b){_0x29c77c['count']=_0x382b7b;if(_0xa7c096[_0xd33c('0x31')][_0xd33c('0x41')]){_0x258b3e[_0xd33c('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0xd33c('0x43')](_0x258b3e);})[_0xd33c('0x25')](function(_0x54555b){_0x29c77c[_0xd33c('0x44')]=_0x54555b;return _0x29c77c;})['then'](respondWithFilteredResult(_0x2d5a12,_0x258b3e))['catch'](handleError(_0x2d5a12,null));};exports[_0xd33c('0x45')]=function(_0xb0dc83,_0x11c5b1){var _0x35cae2={'raw':!![],'where':{'id':_0xb0dc83[_0xd33c('0x46')]['id']}},_0x16d8f4={};_0x16d8f4['model']=_[_0xd33c('0x30')](db[_0xd33c('0x40')]['rawAttributes']);_0x16d8f4['query']=_[_0xd33c('0x30')](_0xb0dc83[_0xd33c('0x31')]);_0x16d8f4[_0xd33c('0x32')]=_[_0xd33c('0x47')](_0x16d8f4['model'],_0x16d8f4[_0xd33c('0x31')]);_0x35cae2[_0xd33c('0x33')]=_['intersection'](_0x16d8f4[_0xd33c('0x2f')],qs[_0xd33c('0x34')](_0xb0dc83[_0xd33c('0x31')][_0xd33c('0x34')]));_0x35cae2[_0xd33c('0x33')]=_0x35cae2[_0xd33c('0x33')]['length']?_0x35cae2[_0xd33c('0x33')]:_0x16d8f4[_0xd33c('0x2f')];if(_0xb0dc83[_0xd33c('0x31')]['includeAll']){_0x35cae2[_0xd33c('0x42')]=[{'all':!![]}];}_0x35cae2=_['merge']({},_0x35cae2,_0xb0dc83[_0xd33c('0x3f')]);return db[_0xd33c('0x40')][_0xd33c('0x48')](_0x35cae2)[_0xd33c('0x25')](handleEntityNotFound(_0x11c5b1,null))['then'](respondWithResult(_0x11c5b1,null))['catch'](handleError(_0x11c5b1,null));};exports[_0xd33c('0x49')]=function(_0xb47f06,_0x346f91){return db[_0xd33c('0x40')][_0xd33c('0x49')](_0xb47f06[_0xd33c('0x4a')],{})[_0xd33c('0x25')](respondWithResult(_0x346f91,0xc9))[_0xd33c('0x4b')](handleError(_0x346f91,null));};exports[_0xd33c('0x4c')]=function(_0x6307fc,_0xb9a40d){if(_0x6307fc[_0xd33c('0x4a')]['id']){delete _0x6307fc[_0xd33c('0x4a')]['id'];}return db['SquareMessage'][_0xd33c('0x48')]({'where':{'id':_0x6307fc[_0xd33c('0x46')]['id']}})[_0xd33c('0x25')](handleEntityNotFound(_0xb9a40d,null))[_0xd33c('0x25')](saveUpdates(_0x6307fc['body'],null))['then'](respondWithResult(_0xb9a40d,null))[_0xd33c('0x4b')](handleError(_0xb9a40d,null));};exports[_0xd33c('0x4d')]=function(_0x44f21d,_0x588130){return db['SquareMessage'][_0xd33c('0x48')]({'where':{'id':_0x44f21d[_0xd33c('0x46')]['id']}})[_0xd33c('0x25')](handleEntityNotFound(_0x588130,null))['then'](removeEntity(_0x588130,null))[_0xd33c('0x4b')](handleError(_0x588130,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5c8ec5c..2afac08 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 _0x762a=['path','rimraf','exports','define','SquareMessage','square_messages','lodash','api','moment','bluebird','request-promise'];(function(_0x378e21,_0x3470be){var _0x459630=function(_0x53a142){while(--_0x53a142){_0x378e21['push'](_0x378e21['shift']());}};_0x459630(++_0x3470be);}(_0x762a,0x103));var _0xa762=function(_0x4afa41,_0x423759){_0x4afa41=_0x4afa41-0x0;var _0x2dfeb2=_0x762a[_0x4afa41];return _0x2dfeb2;};'use strict';var _=require(_0xa762('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa762('0x1'));var moment=require(_0xa762('0x2'));var BPromise=require(_0xa762('0x3'));var rp=require(_0xa762('0x4'));var fs=require('fs');var path=require(_0xa762('0x5'));var rimraf=require(_0xa762('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xa762('0x7')]=function(_0x27758f,_0x286941){return _0x27758f[_0xa762('0x8')](_0xa762('0x9'),attributes,{'tableName':_0xa762('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f33=['./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f33,0x170));var _0x39f3=function(_0x499a5c,_0x1cca1c){_0x499a5c=_0x499a5c-0x0;var _0x5723d8=_0x9f33[_0x499a5c];return _0x5723d8;};'use strict';var _=require(_0x39f3('0x0'));var util=require(_0x39f3('0x1'));var logger=require(_0x39f3('0x2'))(_0x39f3('0x3'));var moment=require(_0x39f3('0x4'));var BPromise=require(_0x39f3('0x5'));var rp=require(_0x39f3('0x6'));var fs=require('fs');var path=require(_0x39f3('0x7'));var rimraf=require(_0x39f3('0x8'));var config=require('../../config/environment');var attributes=require(_0x39f3('0x9'));module['exports']=function(_0x1c37f3,_0x55e582){return _0x1c37f3[_0x39f3('0xa')](_0x39f3('0xb'),attributes,{'tableName':_0x39f3('0xc'),'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 87cd31e..0bacb9b 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 _0x68d4=['info','catch','CreateSquareMessage','SquareMessage','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4b33d1,_0x2414e1){var _0x9e7221=function(_0x476ecc){while(--_0x476ecc){_0x4b33d1['push'](_0x4b33d1['shift']());}};_0x9e7221(++_0x2414e1);}(_0x68d4,0xd8));var _0x468d=function(_0x109767,_0x151aa9){_0x109767=_0x109767-0x0;var _0x515859=_0x68d4[_0x109767];return _0x515859;};'use strict';var _=require(_0x468d('0x0'));var util=require(_0x468d('0x1'));var moment=require('moment');var BPromise=require(_0x468d('0x2'));var rs=require(_0x468d('0x3'));var fs=require('fs');var Redis=require(_0x468d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x468d('0x5'));var logger=require(_0x468d('0x6'))(_0x468d('0x7'));var config=require('../../config/environment');var jayson=require(_0x468d('0x8'));var client=jayson[_0x468d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b71e,_0x5c4d0f,_0x1f34a6){return new BPromise(function(_0x581a62,_0x3207c1){return client[_0x468d('0xa')](_0x36b71e,_0x1f34a6)['then'](function(_0x47a783){logger['info'](_0x468d('0xb'),_0x5c4d0f,_0x468d('0xc'));logger[_0x468d('0xd')](_0x468d('0xe'),_0x5c4d0f,_0x468d('0xc'),JSON[_0x468d('0xf')](_0x47a783));if(_0x47a783[_0x468d('0x10')]){if(_0x47a783[_0x468d('0x10')]['code']===0x1f4){logger['error'](_0x468d('0xb'),_0x5c4d0f,_0x47a783[_0x468d('0x10')][_0x468d('0x11')]);return _0x3207c1(_0x47a783['error'][_0x468d('0x11')]);}logger[_0x468d('0x10')](_0x468d('0xb'),_0x5c4d0f,_0x47a783[_0x468d('0x10')][_0x468d('0x11')]);return _0x581a62(_0x47a783[_0x468d('0x10')]['message']);}else{logger[_0x468d('0x12')](_0x468d('0xb'),_0x5c4d0f,_0x468d('0xc'));_0x581a62(_0x47a783['result'][_0x468d('0x11')]);}})[_0x468d('0x13')](function(_0x133a24){logger[_0x468d('0x10')](_0x468d('0xb'),_0x5c4d0f,_0x133a24);_0x3207c1(_0x133a24);});});}exports[_0x468d('0x14')]=function(_0x28b257){var _0x46d586=this;return new Promise(function(_0x298b57,_0x410559){return db[_0x468d('0x15')]['create'](_0x28b257[_0x468d('0x16')],{'raw':_0x28b257[_0x468d('0x17')]?_0x28b257[_0x468d('0x17')][_0x468d('0x18')]===undefined?!![]:![]:!![]})[_0x468d('0x19')](function(_0x4be96a){logger[_0x468d('0x12')](_0x468d('0x14'),_0x28b257);logger[_0x468d('0xd')](_0x468d('0x14'),_0x28b257,JSON[_0x468d('0xf')](_0x4be96a));_0x298b57(_0x4be96a);})[_0x468d('0x13')](function(_0x3c7c5a){logger[_0x468d('0x10')](_0x468d('0x14'),_0x3c7c5a['message'],_0x28b257);_0x410559(_0x46d586['error'](0x1f4,_0x3c7c5a[_0x468d('0x11')]));});});}; \ No newline at end of file +var _0x10fd=['SquareMessage','body','raw','debug','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareMessage'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x10fd,0xd5));var _0xd10f=function(_0xfa260b,_0xd2d0d){_0xfa260b=_0xfa260b-0x0;var _0x48fb84=_0x10fd[_0xfa260b];return _0x48fb84;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd10f('0x0'));var BPromise=require(_0xd10f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd10f('0x2'));var db=require(_0xd10f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd10f('0x4'))('rpc');var config=require(_0xd10f('0x5'));var jayson=require(_0xd10f('0x6'));var client=jayson[_0xd10f('0x7')][_0xd10f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a0794,_0x4d2946,_0x5e8fa5){return new BPromise(function(_0x27adb7,_0x50db70){return client[_0xd10f('0x9')](_0x1a0794,_0x5e8fa5)[_0xd10f('0xa')](function(_0x4e8bf8){logger[_0xd10f('0xb')](_0xd10f('0xc'),_0x4d2946,'request\x20sent');logger['debug'](_0xd10f('0xd'),_0x4d2946,_0xd10f('0xe'),JSON['stringify'](_0x4e8bf8));if(_0x4e8bf8[_0xd10f('0xf')]){if(_0x4e8bf8['error'][_0xd10f('0x10')]===0x1f4){logger['error'](_0xd10f('0xc'),_0x4d2946,_0x4e8bf8[_0xd10f('0xf')]['message']);return _0x50db70(_0x4e8bf8[_0xd10f('0xf')]['message']);}logger[_0xd10f('0xf')](_0xd10f('0xc'),_0x4d2946,_0x4e8bf8['error'][_0xd10f('0x11')]);return _0x27adb7(_0x4e8bf8['error']['message']);}else{logger[_0xd10f('0xb')](_0xd10f('0xc'),_0x4d2946,_0xd10f('0xe'));_0x27adb7(_0x4e8bf8[_0xd10f('0x12')][_0xd10f('0x11')]);}})[_0xd10f('0x13')](function(_0x5f32b9){logger['error']('SquareMessage,\x20%s,\x20%s',_0x4d2946,_0x5f32b9);_0x50db70(_0x5f32b9);});});}exports[_0xd10f('0x14')]=function(_0xafb215){var _0x1dff1b=this;return new Promise(function(_0x404a75,_0x32262a){return db[_0xd10f('0x15')]['create'](_0xafb215[_0xd10f('0x16')],{'raw':_0xafb215['options']?_0xafb215['options'][_0xd10f('0x17')]===undefined?!![]:![]:!![]})[_0xd10f('0xa')](function(_0x228244){logger['info'](_0xd10f('0x14'),_0xafb215);logger[_0xd10f('0x18')]('CreateSquareMessage',_0xafb215,JSON[_0xd10f('0x19')](_0x228244));_0x404a75(_0x228244);})[_0xd10f('0x13')](function(_0x2ea2e2){logger[_0xd10f('0xf')](_0xd10f('0x14'),_0x2ea2e2[_0xd10f('0x11')],_0xafb215);_0x32262a(_0x1dff1b['error'](0x1f4,_0x2ea2e2[_0xd10f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f3ab37f..f8a20bf 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 _0x5a3f=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','15s','test','post','put','update','delete','multer','path'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5a3f,0xe8));var _0xf5a3=function(_0xa2cb8d,_0x287111){_0xa2cb8d=_0xa2cb8d-0x0;var _0x3ba251=_0x5a3f[_0xa2cb8d];return _0x3ba251;};'use strict';var multer=require(_0xf5a3('0x0'));var util=require('util');var path=require(_0xf5a3('0x1'));var timeout=require(_0xf5a3('0x2'));var express=require(_0xf5a3('0x3'));var router=express[_0xf5a3('0x4')]();var fs_extra=require(_0xf5a3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf5a3('0x6'));var config=require(_0xf5a3('0x7'));var controller=require('./squareOdbc.controller');router[_0xf5a3('0x8')]('/',auth[_0xf5a3('0x9')](),controller[_0xf5a3('0xa')]);router[_0xf5a3('0x8')](_0xf5a3('0xb'),auth[_0xf5a3('0x9')](),controller['show']);router[_0xf5a3('0x8')]('/:id/test',auth[_0xf5a3('0x9')](),timeout(_0xf5a3('0xc')),controller[_0xf5a3('0xd')]);router[_0xf5a3('0xe')]('/',auth[_0xf5a3('0x9')](),controller['create']);router[_0xf5a3('0xf')]('/:id',auth[_0xf5a3('0x9')](),controller[_0xf5a3('0x10')]);router[_0xf5a3('0x11')](_0xf5a3('0xb'),auth[_0xf5a3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x568a=['/:id','show','/:id/test','15s','test','post','create','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x3b936f,_0x7e6228){var _0x2ce25a=function(_0x250d49){while(--_0x250d49){_0x3b936f['push'](_0x3b936f['shift']());}};_0x2ce25a(++_0x7e6228);}(_0x568a,0xc6));var _0xa568=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x568a[_0x2faddb];return _0x273c05;};'use strict';var multer=require(_0xa568('0x0'));var util=require('util');var path=require(_0xa568('0x1'));var timeout=require(_0xa568('0x2'));var express=require(_0xa568('0x3'));var router=express[_0xa568('0x4')]();var fs_extra=require(_0xa568('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa568('0x6'));var config=require('../../config/environment');var controller=require(_0xa568('0x7'));router[_0xa568('0x8')]('/',auth[_0xa568('0x9')](),controller[_0xa568('0xa')]);router[_0xa568('0x8')](_0xa568('0xb'),auth[_0xa568('0x9')](),controller[_0xa568('0xc')]);router['get'](_0xa568('0xd'),auth[_0xa568('0x9')](),timeout(_0xa568('0xe')),controller[_0xa568('0xf')]);router[_0xa568('0x10')]('/',auth[_0xa568('0x9')](),controller[_0xa568('0x11')]);router['put']('/:id',auth[_0xa568('0x9')](),controller['update']);router['delete'](_0xa568('0xb'),auth[_0xa568('0x9')](),controller['destroy']);module[_0xa568('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 60c2bba..64911b1 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 _0x357a=['exports','STRING','name','sequelize'];(function(_0x29bc39,_0x59970e){var _0x50999e=function(_0x33b2a2){while(--_0x33b2a2){_0x29bc39['push'](_0x29bc39['shift']());}};_0x50999e(++_0x59970e);}(_0x357a,0xa7));var _0xa357=function(_0x3254f5,_0x37c712){_0x3254f5=_0x3254f5-0x0;var _0x32af33=_0x357a[_0x3254f5];return _0x32af33;};'use strict';var Sequelize=require(_0xa357('0x0'));module[_0xa357('0x1')]={'name':{'type':Sequelize[_0xa357('0x2')],'unique':_0xa357('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa357('0x2')]},'description':{'type':Sequelize[_0xa357('0x2')]}}; \ No newline at end of file +var _0x4b3b=['STRING','name','sequelize','exports'];(function(_0x5023f5,_0x2bd3fe){var _0x2281eb=function(_0x2fc29e){while(--_0x2fc29e){_0x5023f5['push'](_0x5023f5['shift']());}};_0x2281eb(++_0x2bd3fe);}(_0x4b3b,0x106));var _0xb4b3=function(_0x384966,_0x4c41f1){_0x384966=_0x384966-0x0;var _0x3c9274=_0x4b3b[_0x384966];return _0x3c9274;};'use strict';var Sequelize=require(_0xb4b3('0x0'));module[_0xb4b3('0x1')]={'name':{'type':Sequelize[_0xb4b3('0x2')],'unique':_0xb4b3('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb4b3('0x2')]},'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 38ff905..7023dbe 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 _0x390e=['../../mysqldb','sendStatus','status','json','limit','undefined','offset','set','Content-Range','apply','update','then','destroy','ODBC','UserProfileResource','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x550b0d,_0x460668){var _0x1c669d=function(_0x14d9df){while(--_0x14d9df){_0x550b0d['push'](_0x550b0d['shift']());}};_0x1c669d(++_0x460668);}(_0x390e,0x92));var _0xe390=function(_0x4897b5,_0x3d2e27){_0x4897b5=_0x4897b5-0x0;var _0x3adafe=_0x390e[_0x4897b5];return _0x3adafe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe390('0x0'));var jsonpatch=require(_0xe390('0x1'));var rp=require(_0xe390('0x2'));var moment=require('moment');var BPromise=require(_0xe390('0x3'));var Mustache=require(_0xe390('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe390('0x5'));var csv=require(_0xe390('0x6'));var ejs=require(_0xe390('0x7'));var fs=require('fs');var fs_extra=require(_0xe390('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe390('0x9'));var deskjs=require(_0xe390('0xa'));var toCsv=require(_0xe390('0x6'));var querystring=require(_0xe390('0xb'));var Papa=require(_0xe390('0xc'));var Redis=require(_0xe390('0xd'));var authService=require(_0xe390('0xe'));var qs=require(_0xe390('0xf'));var as=require(_0xe390('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe390('0x11'));var config=require(_0xe390('0x12'));var licenseUtil=require(_0xe390('0x13'));var db=require(_0xe390('0x14'))['db'];function respondWithStatusCode(_0x52373b,_0x5b905d){_0x5b905d=_0x5b905d||0xcc;return function(_0x4bee91){if(_0x4bee91){return _0x52373b[_0xe390('0x15')](_0x5b905d);}return _0x52373b[_0xe390('0x16')](_0x5b905d)['end']();};}function respondWithResult(_0x267e96,_0x1f4b09){_0x1f4b09=_0x1f4b09||0xc8;return function(_0x4460ec){if(_0x4460ec){return _0x267e96['status'](_0x1f4b09)[_0xe390('0x17')](_0x4460ec);}};}function respondWithFilteredResult(_0x3bf67b,_0xd79ce8){return function(_0x40cc37){if(_0x40cc37){var _0x182091=typeof _0xd79ce8['offset']==='undefined'&&typeof _0xd79ce8[_0xe390('0x18')]===_0xe390('0x19');var _0x20449a=_0x40cc37['count'];var _0x2ce323=_0x182091?0x0:_0xd79ce8[_0xe390('0x1a')];var _0x107094=_0x182091?_0x40cc37['count']:_0xd79ce8['offset']+_0xd79ce8[_0xe390('0x18')];var _0x50027c;if(_0x107094>=_0x20449a){_0x107094=_0x20449a;_0x50027c=0xc8;}else{_0x50027c=0xce;}_0x3bf67b[_0xe390('0x16')](_0x50027c);return _0x3bf67b[_0xe390('0x1b')](_0xe390('0x1c'),_0x2ce323+'-'+_0x107094+'/'+_0x20449a)[_0xe390('0x17')](_0x40cc37);}return null;};}function patchUpdates(_0x3d6def){return function(_0x56dec2){try{jsonpatch[_0xe390('0x1d')](_0x56dec2,_0x3d6def,!![]);}catch(_0x9628c5){return BPromise['reject'](_0x9628c5);}return _0x56dec2['save']();};}function saveUpdates(_0x567b26,_0x2b3304){return function(_0x239c35){if(_0x239c35){return _0x239c35[_0xe390('0x1e')](_0x567b26)[_0xe390('0x1f')](function(_0x53fe27){return _0x53fe27;});}return null;};}function removeEntity(_0xfc05a,_0x3b26d8){return function(_0x270d0c){if(_0x270d0c){return _0x270d0c[_0xe390('0x20')]()[_0xe390('0x1f')](function(){var _0x5aa037=_0x270d0c['get']({'plain':!![]});var _0x119e6c=_0xe390('0x21');return db[_0xe390('0x22')][_0xe390('0x20')]({'where':{'type':_0x119e6c,'resourceId':_0x5aa037['id']}})[_0xe390('0x1f')](function(){return _0x270d0c;});})[_0xe390('0x1f')](function(){_0xfc05a[_0xe390('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa1ff,_0x3740a2){return function(_0x350e57){if(!_0x350e57){_0x3fa1ff['sendStatus'](0x194);}return _0x350e57;};}function handleError(_0x29a3c6,_0x56707a){_0x56707a=_0x56707a||0x1f4;return function(_0x56b5d5){logger['error'](_0x56b5d5['stack']);if(_0x56b5d5['name']){delete _0x56b5d5[_0xe390('0x23')];}_0x29a3c6[_0xe390('0x16')](_0x56707a)[_0xe390('0x24')](_0x56b5d5);};}exports[_0xe390('0x25')]=function(_0x5f445a,_0x700bd2){var _0x3e5ddb={},_0x31e678={},_0x1b3f90={'count':0x0,'rows':[]};var _0x433bea=_[_0xe390('0x26')](db[_0xe390('0x27')][_0xe390('0x28')],function(_0xbbcb6){return{'name':_0xbbcb6[_0xe390('0x29')],'type':_0xbbcb6[_0xe390('0x2a')][_0xe390('0x2b')]};});_0x31e678[_0xe390('0x2c')]=_[_0xe390('0x26')](_0x433bea,_0xe390('0x23'));_0x31e678[_0xe390('0x2d')]=_[_0xe390('0x2e')](_0x5f445a['query']);_0x31e678['filters']=_[_0xe390('0x2f')](_0x31e678['model'],_0x31e678[_0xe390('0x2d')]);_0x3e5ddb['attributes']=_['intersection'](_0x31e678['model'],qs[_0xe390('0x30')](_0x5f445a[_0xe390('0x2d')][_0xe390('0x30')]));_0x3e5ddb['attributes']=_0x3e5ddb[_0xe390('0x31')][_0xe390('0x32')]?_0x3e5ddb[_0xe390('0x31')]:_0x31e678[_0xe390('0x2c')];if(!_0x5f445a[_0xe390('0x2d')][_0xe390('0x33')](_0xe390('0x34'))){_0x3e5ddb['limit']=qs['limit'](_0x5f445a['query'][_0xe390('0x18')]);_0x3e5ddb[_0xe390('0x1a')]=qs[_0xe390('0x1a')](_0x5f445a['query'][_0xe390('0x1a')]);}_0x3e5ddb[_0xe390('0x35')]=qs[_0xe390('0x36')](_0x5f445a[_0xe390('0x2d')][_0xe390('0x36')]);_0x3e5ddb['where']=qs[_0xe390('0x37')](_['pick'](_0x5f445a[_0xe390('0x2d')],_0x31e678[_0xe390('0x37')]),_0x433bea);if(_0x5f445a['query']['filter']){_0x3e5ddb[_0xe390('0x38')]=_['merge'](_0x3e5ddb['where'],{'$or':_[_0xe390('0x26')](_0x433bea,function(_0x223198){if(_0x223198['type']!=='VIRTUAL'){var _0x2400d3={};_0x2400d3[_0x223198[_0xe390('0x23')]]={'$like':'%'+_0x5f445a['query'][_0xe390('0x39')]+'%'};return _0x2400d3;}})});}_0x3e5ddb=_[_0xe390('0x3a')]({},_0x3e5ddb,_0x5f445a[_0xe390('0x3b')]);var _0xb53d8f={'where':_0x3e5ddb['where']};return db['SquareOdbc'][_0xe390('0x3c')](_0xb53d8f)[_0xe390('0x1f')](function(_0x4bc0fc){_0x1b3f90[_0xe390('0x3c')]=_0x4bc0fc;if(_0x5f445a[_0xe390('0x2d')][_0xe390('0x3d')]){_0x3e5ddb[_0xe390('0x3e')]=[{'all':!![]}];}return db[_0xe390('0x27')][_0xe390('0x3f')](_0x3e5ddb);})[_0xe390('0x1f')](function(_0x486ea2){_0x1b3f90[_0xe390('0x40')]=_0x486ea2;return _0x1b3f90;})[_0xe390('0x1f')](respondWithFilteredResult(_0x700bd2,_0x3e5ddb))[_0xe390('0x41')](handleError(_0x700bd2,null));};exports[_0xe390('0x42')]=function(_0x1fb418,_0x510313){var _0x38e88d={'raw':!![],'where':{'id':_0x1fb418[_0xe390('0x43')]['id']}},_0x3f246b={};_0x3f246b['model']=_[_0xe390('0x2e')](db[_0xe390('0x27')][_0xe390('0x28')]);_0x3f246b['query']=_[_0xe390('0x2e')](_0x1fb418[_0xe390('0x2d')]);_0x3f246b[_0xe390('0x37')]=_[_0xe390('0x2f')](_0x3f246b['model'],_0x3f246b[_0xe390('0x2d')]);_0x38e88d['attributes']=_[_0xe390('0x2f')](_0x3f246b[_0xe390('0x2c')],qs[_0xe390('0x30')](_0x1fb418['query'][_0xe390('0x30')]));_0x38e88d['attributes']=_0x38e88d[_0xe390('0x31')][_0xe390('0x32')]?_0x38e88d['attributes']:_0x3f246b[_0xe390('0x2c')];if(_0x1fb418[_0xe390('0x2d')]['includeAll']){_0x38e88d[_0xe390('0x3e')]=[{'all':!![]}];}_0x38e88d=_[_0xe390('0x3a')]({},_0x38e88d,_0x1fb418['options']);return db[_0xe390('0x27')]['find'](_0x38e88d)[_0xe390('0x1f')](handleEntityNotFound(_0x510313,null))[_0xe390('0x1f')](respondWithResult(_0x510313,null))['catch'](handleError(_0x510313,null));};exports[_0xe390('0x44')]=function(_0x2055d5,_0x494413){return db[_0xe390('0x27')]['create'](_0x2055d5[_0xe390('0x45')],{})[_0xe390('0x1f')](function(_0x3001d5){var _0x3241b4=_0x2055d5[_0xe390('0x46')]['get']({'plain':!![]});if(!_0x3241b4)throw new Error(_0xe390('0x47'));if(_0x3241b4[_0xe390('0x48')]===_0xe390('0x46')){var _0x17fcd8=_0x3001d5[_0xe390('0x49')]({'plain':!![]});var _0x3b5497='ODBC';return db[_0xe390('0x4a')][_0xe390('0x4b')]({'where':{'name':_0x3b5497,'userProfileId':_0x3241b4[_0xe390('0x4c')]},'raw':!![]})[_0xe390('0x1f')](function(_0x6e009f){if(_0x6e009f&&_0x6e009f[_0xe390('0x4d')]===0x0){return db[_0xe390('0x22')]['create']({'name':_0x17fcd8['name'],'resourceId':_0x17fcd8['id'],'type':_0x6e009f[_0xe390('0x23')],'sectionId':_0x6e009f['id']},{})[_0xe390('0x1f')](function(){return _0x3001d5;});}else{return _0x3001d5;}})[_0xe390('0x41')](function(_0x140346){logger['error'](_0xe390('0x4e'),_0x140346);throw _0x140346;});}return _0x3001d5;})[_0xe390('0x1f')](respondWithResult(_0x494413,0xc9))[_0xe390('0x41')](handleError(_0x494413,null));};exports['update']=function(_0x277d82,_0x20e17e){if(_0x277d82[_0xe390('0x45')]['id']){delete _0x277d82[_0xe390('0x45')]['id'];}return db[_0xe390('0x27')][_0xe390('0x4b')]({'where':{'id':_0x277d82['params']['id']}})[_0xe390('0x1f')](handleEntityNotFound(_0x20e17e,null))[_0xe390('0x1f')](saveUpdates(_0x277d82[_0xe390('0x45')],null))[_0xe390('0x1f')](respondWithResult(_0x20e17e,null))[_0xe390('0x41')](handleError(_0x20e17e,null));};exports['destroy']=function(_0xddbb41,_0x3a0d5e){return db[_0xe390('0x27')][_0xe390('0x4b')]({'where':{'id':_0xddbb41[_0xe390('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a0d5e,null))[_0xe390('0x1f')](removeEntity(_0x3a0d5e,null))[_0xe390('0x41')](handleError(_0x3a0d5e,null));};exports[_0xe390('0x4f')]=function(_0x490220,_0x59eefe,_0x4a9343){var _0x51ec9c;return db[_0xe390('0x27')][_0xe390('0x4b')]({'where':{'id':_0x490220[_0xe390('0x43')]['id']},'attributes':['id',_0xe390('0x50')]})[_0xe390('0x1f')](handleEntityNotFound(_0x59eefe,null))[_0xe390('0x1f')](function(_0x4215d6){if(_0x4215d6){var _0x135551=require(_0xe390('0x51'))();_0x135551[_0xe390('0x52')](_0x4215d6[_0xe390('0x50')]);_0x135551['closeSync']();return _0x4215d6;}})[_0xe390('0x1f')](respondWithResult(_0x59eefe,null))[_0xe390('0x41')](handleError(_0x59eefe,null));}; \ No newline at end of file +var _0x269b=['limit','count','set','Content-Range','reject','save','then','destroy','get','ODBC','end','error','stack','name','send','index','SquareOdbc','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','type','VIRTUAL','filter','merge','include','findAll','rows','catch','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','update','params','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset'];(function(_0x24166f,_0x33e4b8){var _0x280943=function(_0x5301eb){while(--_0x5301eb){_0x24166f['push'](_0x24166f['shift']());}};_0x280943(++_0x33e4b8);}(_0x269b,0x13c));var _0xb269=function(_0x549a84,_0x225007){_0x549a84=_0x549a84-0x0;var _0x121d5d=_0x269b[_0x549a84];return _0x121d5d;};'use strict';var emlformat=require(_0xb269('0x0'));var rimraf=require(_0xb269('0x1'));var zipdir=require(_0xb269('0x2'));var jsonpatch=require(_0xb269('0x3'));var rp=require(_0xb269('0x4'));var moment=require(_0xb269('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb269('0x6'));var util=require(_0xb269('0x7'));var path=require(_0xb269('0x8'));var sox=require(_0xb269('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb269('0xa'));var _=require('lodash');var squel=require(_0xb269('0xb'));var crypto=require('crypto');var jsforce=require(_0xb269('0xc'));var deskjs=require(_0xb269('0xd'));var toCsv=require(_0xb269('0xe'));var querystring=require(_0xb269('0xf'));var Papa=require(_0xb269('0x10'));var Redis=require('ioredis');var authService=require(_0xb269('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb269('0x12'));var logger=require(_0xb269('0x13'))(_0xb269('0x14'));var utils=require(_0xb269('0x15'));var config=require(_0xb269('0x16'));var licenseUtil=require(_0xb269('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b63e9,_0xd1d6d9){_0xd1d6d9=_0xd1d6d9||0xcc;return function(_0xe16214){if(_0xe16214){return _0x4b63e9[_0xb269('0x18')](_0xd1d6d9);}return _0x4b63e9[_0xb269('0x19')](_0xd1d6d9)['end']();};}function respondWithResult(_0x126f73,_0x1d0385){_0x1d0385=_0x1d0385||0xc8;return function(_0x3623fb){if(_0x3623fb){return _0x126f73['status'](_0x1d0385)[_0xb269('0x1a')](_0x3623fb);}};}function respondWithFilteredResult(_0x2e246d,_0x5bb371){return function(_0x5942a5){if(_0x5942a5){var _0x1b7c6b=typeof _0x5bb371[_0xb269('0x1b')]==='undefined'&&typeof _0x5bb371[_0xb269('0x1c')]==='undefined';var _0x14a0f7=_0x5942a5[_0xb269('0x1d')];var _0x4e72cc=_0x1b7c6b?0x0:_0x5bb371[_0xb269('0x1b')];var _0x201bda=_0x1b7c6b?_0x5942a5[_0xb269('0x1d')]:_0x5bb371[_0xb269('0x1b')]+_0x5bb371[_0xb269('0x1c')];var _0x1fb62a;if(_0x201bda>=_0x14a0f7){_0x201bda=_0x14a0f7;_0x1fb62a=0xc8;}else{_0x1fb62a=0xce;}_0x2e246d[_0xb269('0x19')](_0x1fb62a);return _0x2e246d[_0xb269('0x1e')](_0xb269('0x1f'),_0x4e72cc+'-'+_0x201bda+'/'+_0x14a0f7)['json'](_0x5942a5);}return null;};}function patchUpdates(_0x3f85db){return function(_0x1604b4){try{jsonpatch['apply'](_0x1604b4,_0x3f85db,!![]);}catch(_0x9bb304){return BPromise[_0xb269('0x20')](_0x9bb304);}return _0x1604b4[_0xb269('0x21')]();};}function saveUpdates(_0xb085ee,_0x39d212){return function(_0x420424){if(_0x420424){return _0x420424['update'](_0xb085ee)[_0xb269('0x22')](function(_0x149bf1){return _0x149bf1;});}return null;};}function removeEntity(_0x5c989f,_0x130661){return function(_0xed489){if(_0xed489){return _0xed489[_0xb269('0x23')]()[_0xb269('0x22')](function(){var _0x3a0672=_0xed489[_0xb269('0x24')]({'plain':!![]});var _0x4078f4=_0xb269('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4078f4,'resourceId':_0x3a0672['id']}})[_0xb269('0x22')](function(){return _0xed489;});})[_0xb269('0x22')](function(){_0x5c989f[_0xb269('0x19')](0xcc)[_0xb269('0x26')]();});}};}function handleEntityNotFound(_0x1b8951,_0x445001){return function(_0x1ba892){if(!_0x1ba892){_0x1b8951[_0xb269('0x18')](0x194);}return _0x1ba892;};}function handleError(_0x250b0c,_0x646bf1){_0x646bf1=_0x646bf1||0x1f4;return function(_0x335739){logger[_0xb269('0x27')](_0x335739[_0xb269('0x28')]);if(_0x335739[_0xb269('0x29')]){delete _0x335739[_0xb269('0x29')];}_0x250b0c['status'](_0x646bf1)[_0xb269('0x2a')](_0x335739);};}exports[_0xb269('0x2b')]=function(_0x3d2e31,_0x18ac10){var _0x4f5ee5={},_0x3d9a1a={},_0x38ae37={'count':0x0,'rows':[]};var _0x3f81ad=_['map'](db[_0xb269('0x2c')][_0xb269('0x2d')],function(_0x51ef17){return{'name':_0x51ef17['fieldName'],'type':_0x51ef17['type'][_0xb269('0x2e')]};});_0x3d9a1a[_0xb269('0x2f')]=_['map'](_0x3f81ad,_0xb269('0x29'));_0x3d9a1a[_0xb269('0x30')]=_[_0xb269('0x31')](_0x3d2e31[_0xb269('0x30')]);_0x3d9a1a[_0xb269('0x32')]=_[_0xb269('0x33')](_0x3d9a1a[_0xb269('0x2f')],_0x3d9a1a[_0xb269('0x30')]);_0x4f5ee5[_0xb269('0x34')]=_[_0xb269('0x33')](_0x3d9a1a['model'],qs[_0xb269('0x35')](_0x3d2e31[_0xb269('0x30')][_0xb269('0x35')]));_0x4f5ee5[_0xb269('0x34')]=_0x4f5ee5['attributes'][_0xb269('0x36')]?_0x4f5ee5['attributes']:_0x3d9a1a[_0xb269('0x2f')];if(!_0x3d2e31[_0xb269('0x30')][_0xb269('0x37')]('nolimit')){_0x4f5ee5[_0xb269('0x1c')]=qs['limit'](_0x3d2e31['query'][_0xb269('0x1c')]);_0x4f5ee5[_0xb269('0x1b')]=qs[_0xb269('0x1b')](_0x3d2e31['query'][_0xb269('0x1b')]);}_0x4f5ee5[_0xb269('0x38')]=qs[_0xb269('0x39')](_0x3d2e31['query'][_0xb269('0x39')]);_0x4f5ee5[_0xb269('0x3a')]=qs['filters'](_[_0xb269('0x3b')](_0x3d2e31[_0xb269('0x30')],_0x3d9a1a[_0xb269('0x32')]),_0x3f81ad);if(_0x3d2e31[_0xb269('0x30')]['filter']){_0x4f5ee5[_0xb269('0x3a')]=_['merge'](_0x4f5ee5['where'],{'$or':_[_0xb269('0x3c')](_0x3f81ad,function(_0x188072){if(_0x188072[_0xb269('0x3d')]!==_0xb269('0x3e')){var _0x32319c={};_0x32319c[_0x188072[_0xb269('0x29')]]={'$like':'%'+_0x3d2e31[_0xb269('0x30')][_0xb269('0x3f')]+'%'};return _0x32319c;}})});}_0x4f5ee5=_[_0xb269('0x40')]({},_0x4f5ee5,_0x3d2e31['options']);var _0x35b0c0={'where':_0x4f5ee5[_0xb269('0x3a')]};return db[_0xb269('0x2c')][_0xb269('0x1d')](_0x35b0c0)[_0xb269('0x22')](function(_0x287c95){_0x38ae37['count']=_0x287c95;if(_0x3d2e31[_0xb269('0x30')]['includeAll']){_0x4f5ee5[_0xb269('0x41')]=[{'all':!![]}];}return db[_0xb269('0x2c')][_0xb269('0x42')](_0x4f5ee5);})[_0xb269('0x22')](function(_0x5055ab){_0x38ae37[_0xb269('0x43')]=_0x5055ab;return _0x38ae37;})[_0xb269('0x22')](respondWithFilteredResult(_0x18ac10,_0x4f5ee5))[_0xb269('0x44')](handleError(_0x18ac10,null));};exports['show']=function(_0x217888,_0x927d4d){var _0x22031a={'raw':!![],'where':{'id':_0x217888['params']['id']}},_0x5843b5={};_0x5843b5[_0xb269('0x2f')]=_[_0xb269('0x31')](db['SquareOdbc'][_0xb269('0x2d')]);_0x5843b5[_0xb269('0x30')]=_['keys'](_0x217888[_0xb269('0x30')]);_0x5843b5['filters']=_[_0xb269('0x33')](_0x5843b5[_0xb269('0x2f')],_0x5843b5[_0xb269('0x30')]);_0x22031a[_0xb269('0x34')]=_['intersection'](_0x5843b5['model'],qs[_0xb269('0x35')](_0x217888['query'][_0xb269('0x35')]));_0x22031a['attributes']=_0x22031a[_0xb269('0x34')][_0xb269('0x36')]?_0x22031a['attributes']:_0x5843b5[_0xb269('0x2f')];if(_0x217888[_0xb269('0x30')][_0xb269('0x45')]){_0x22031a[_0xb269('0x41')]=[{'all':!![]}];}_0x22031a=_[_0xb269('0x40')]({},_0x22031a,_0x217888[_0xb269('0x46')]);return db[_0xb269('0x2c')]['find'](_0x22031a)[_0xb269('0x22')](handleEntityNotFound(_0x927d4d,null))[_0xb269('0x22')](respondWithResult(_0x927d4d,null))[_0xb269('0x44')](handleError(_0x927d4d,null));};exports[_0xb269('0x47')]=function(_0x3c19b2,_0x1571f6){return db['SquareOdbc'][_0xb269('0x47')](_0x3c19b2[_0xb269('0x48')],{})[_0xb269('0x22')](function(_0x5815fb){var _0xa1a90d=_0x3c19b2[_0xb269('0x49')][_0xb269('0x24')]({'plain':!![]});if(!_0xa1a90d)throw new Error(_0xb269('0x4a'));if(_0xa1a90d[_0xb269('0x4b')]===_0xb269('0x49')){var _0x513271=_0x5815fb[_0xb269('0x24')]({'plain':!![]});var _0x4d77f8=_0xb269('0x25');return db[_0xb269('0x4c')][_0xb269('0x4d')]({'where':{'name':_0x4d77f8,'userProfileId':_0xa1a90d[_0xb269('0x4e')]},'raw':!![]})[_0xb269('0x22')](function(_0x3544b7){if(_0x3544b7&&_0x3544b7['autoAssociation']===0x0){return db[_0xb269('0x4f')]['create']({'name':_0x513271[_0xb269('0x29')],'resourceId':_0x513271['id'],'type':_0x3544b7[_0xb269('0x29')],'sectionId':_0x3544b7['id']},{})[_0xb269('0x22')](function(){return _0x5815fb;});}else{return _0x5815fb;}})[_0xb269('0x44')](function(_0x2b096b){logger[_0xb269('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b096b);throw _0x2b096b;});}return _0x5815fb;})[_0xb269('0x22')](respondWithResult(_0x1571f6,0xc9))[_0xb269('0x44')](handleError(_0x1571f6,null));};exports[_0xb269('0x50')]=function(_0x2aaf4a,_0x5b2be9){if(_0x2aaf4a[_0xb269('0x48')]['id']){delete _0x2aaf4a[_0xb269('0x48')]['id'];}return db[_0xb269('0x2c')][_0xb269('0x4d')]({'where':{'id':_0x2aaf4a[_0xb269('0x51')]['id']}})[_0xb269('0x22')](handleEntityNotFound(_0x5b2be9,null))[_0xb269('0x22')](saveUpdates(_0x2aaf4a[_0xb269('0x48')],null))[_0xb269('0x22')](respondWithResult(_0x5b2be9,null))['catch'](handleError(_0x5b2be9,null));};exports[_0xb269('0x23')]=function(_0x28e61d,_0x4f0fcf){return db[_0xb269('0x2c')]['find']({'where':{'id':_0x28e61d[_0xb269('0x51')]['id']}})[_0xb269('0x22')](handleEntityNotFound(_0x4f0fcf,null))[_0xb269('0x22')](removeEntity(_0x4f0fcf,null))[_0xb269('0x44')](handleError(_0x4f0fcf,null));};exports[_0xb269('0x52')]=function(_0x2fbef9,_0x1df856,_0x465dd0){var _0x5aaf82;return db[_0xb269('0x2c')][_0xb269('0x4d')]({'where':{'id':_0x2fbef9[_0xb269('0x51')]['id']},'attributes':['id',_0xb269('0x53')]})[_0xb269('0x22')](handleEntityNotFound(_0x1df856,null))['then'](function(_0x1873d1){if(_0x1873d1){var _0x2cdffe=require('odbc')();_0x2cdffe[_0xb269('0x54')](_0x1873d1[_0xb269('0x53')]);_0x2cdffe[_0xb269('0x55')]();return _0x1873d1;}})[_0xb269('0x22')](respondWithResult(_0x1df856,null))[_0xb269('0x44')](handleError(_0x1df856,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a11db0f..d3a3dd4 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 _0xd1d8=['path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xd1d8,0x1e3));var _0x8d1d=function(_0xf8ef4a,_0x34a9d5){_0xf8ef4a=_0xf8ef4a-0x0;var _0x1869c9=_0xd1d8[_0xf8ef4a];return _0x1869c9;};'use strict';var _=require(_0x8d1d('0x0'));var util=require(_0x8d1d('0x1'));var logger=require(_0x8d1d('0x2'))(_0x8d1d('0x3'));var moment=require(_0x8d1d('0x4'));var BPromise=require(_0x8d1d('0x5'));var rp=require(_0x8d1d('0x6'));var fs=require('fs');var path=require(_0x8d1d('0x7'));var rimraf=require(_0x8d1d('0x8'));var config=require('../../config/environment');var attributes=require(_0x8d1d('0x9'));module[_0x8d1d('0xa')]=function(_0x25bd1e,_0x5720b9){return _0x25bd1e[_0x8d1d('0xb')](_0x8d1d('0xc'),attributes,{'tableName':_0x8d1d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7eb=['define','SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7eb,0x106));var _0xbc7e=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0xc7eb[_0x147497];return _0x35f45;};'use strict';var _=require(_0xbc7e('0x0'));var util=require(_0xbc7e('0x1'));var logger=require(_0xbc7e('0x2'))(_0xbc7e('0x3'));var moment=require(_0xbc7e('0x4'));var BPromise=require(_0xbc7e('0x5'));var rp=require(_0xbc7e('0x6'));var fs=require('fs');var path=require(_0xbc7e('0x7'));var rimraf=require(_0xbc7e('0x8'));var config=require(_0xbc7e('0x9'));var attributes=require('./squareOdbc.attributes');module[_0xbc7e('0xa')]=function(_0x2bc8ba,_0x191d8a){return _0x2bc8ba[_0xbc7e('0xb')](_0xbc7e('0xc'),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 ccca081..c9393c3 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 _0xf8ce=['include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf8ce,0x1e5));var _0xef8c=function(_0x53c780,_0x59d452){_0x53c780=_0x53c780-0x0;var _0x409cc7=_0xf8ce[_0x53c780];return _0x409cc7;};'use strict';var _=require(_0xef8c('0x0'));var util=require(_0xef8c('0x1'));var moment=require(_0xef8c('0x2'));var BPromise=require(_0xef8c('0x3'));var rs=require(_0xef8c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef8c('0x5'))['db'];var utils=require(_0xef8c('0x6'));var logger=require(_0xef8c('0x7'))(_0xef8c('0x8'));var config=require(_0xef8c('0x9'));var jayson=require(_0xef8c('0xa'));var client=jayson[_0xef8c('0xb')][_0xef8c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd5d4f9,_0x588245,_0x4f4a07){return new BPromise(function(_0x117ead,_0x497ebf){return client['request'](_0xd5d4f9,_0x4f4a07)['then'](function(_0x1a3364){logger[_0xef8c('0xd')](_0xef8c('0xe'),_0x588245,_0xef8c('0xf'));logger[_0xef8c('0x10')](_0xef8c('0x11'),_0x588245,_0xef8c('0xf'),JSON['stringify'](_0x1a3364));if(_0x1a3364[_0xef8c('0x12')]){if(_0x1a3364['error'][_0xef8c('0x13')]===0x1f4){logger[_0xef8c('0x12')](_0xef8c('0xe'),_0x588245,_0x1a3364[_0xef8c('0x12')][_0xef8c('0x14')]);return _0x497ebf(_0x1a3364[_0xef8c('0x12')][_0xef8c('0x14')]);}logger[_0xef8c('0x12')](_0xef8c('0xe'),_0x588245,_0x1a3364['error'][_0xef8c('0x14')]);return _0x117ead(_0x1a3364[_0xef8c('0x12')][_0xef8c('0x14')]);}else{logger['info'](_0xef8c('0xe'),_0x588245,_0xef8c('0xf'));_0x117ead(_0x1a3364['result']['message']);}})['catch'](function(_0x807816){logger['error'](_0xef8c('0xe'),_0x588245,_0x807816);_0x497ebf(_0x807816);});});}exports[_0xef8c('0x15')]=function(_0x37d22e){var _0x39a9e2=this;return new Promise(function(_0x279e5d,_0x32f768){return db[_0xef8c('0x16')][_0xef8c('0x17')]({'raw':_0x37d22e[_0xef8c('0x18')]?_0x37d22e['options'][_0xef8c('0x19')]===undefined?!![]:![]:!![],'where':_0x37d22e[_0xef8c('0x18')]?_0x37d22e[_0xef8c('0x18')]['where']||null:null,'attributes':_0x37d22e[_0xef8c('0x18')]?_0x37d22e[_0xef8c('0x18')][_0xef8c('0x1a')]||null:null,'include':_0x37d22e[_0xef8c('0x18')]?_0x37d22e[_0xef8c('0x18')][_0xef8c('0x1b')]?_[_0xef8c('0x1c')](_0x37d22e[_0xef8c('0x18')][_0xef8c('0x1b')],function(_0x1c0a40){return{'model':db[_0x1c0a40['model']],'as':_0x1c0a40['as'],'attributes':_0x1c0a40[_0xef8c('0x1a')],'include':_0x1c0a40[_0xef8c('0x1b')]?_[_0xef8c('0x1c')](_0x1c0a40[_0xef8c('0x1b')],function(_0x56dc61){return{'model':db[_0x56dc61[_0xef8c('0x1d')]],'as':_0x56dc61['as'],'attributes':_0x56dc61[_0xef8c('0x1a')],'include':_0x56dc61[_0xef8c('0x1b')]?_['map'](_0x56dc61[_0xef8c('0x1b')],function(_0x122da1){return{'model':db[_0x122da1[_0xef8c('0x1d')]],'as':_0x122da1['as'],'attributes':_0x122da1[_0xef8c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22b284){logger[_0xef8c('0xd')](_0xef8c('0x15'),_0x37d22e);logger[_0xef8c('0x10')]('ShowSquareOdbc',_0x37d22e,JSON[_0xef8c('0x1e')](_0x22b284));_0x279e5d(_0x22b284);})[_0xef8c('0x1f')](function(_0xe9398c){logger[_0xef8c('0x12')](_0xef8c('0x15'),_0xe9398c[_0xef8c('0x14')],_0x37d22e);_0x32f768(_0x39a9e2[_0xef8c('0x12')](0x1f4,_0xe9398c[_0xef8c('0x14')]));});});}; \ No newline at end of file +var _0xae5e=['attributes','map','model','include','then','debug','stringify','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ShowSquareOdbc','SquareOdbc','options'];(function(_0x52e040,_0x583d2f){var _0x4cd278=function(_0xa844b5){while(--_0xa844b5){_0x52e040['push'](_0x52e040['shift']());}};_0x4cd278(++_0x583d2f);}(_0xae5e,0x10c));var _0xeae5=function(_0x3f7892,_0x320b37){_0x3f7892=_0x3f7892-0x0;var _0x237ce1=_0xae5e[_0x3f7892];return _0x237ce1;};'use strict';var _=require('lodash');var util=require(_0xeae5('0x0'));var moment=require(_0xeae5('0x1'));var BPromise=require(_0xeae5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeae5('0x3'))['db'];var utils=require(_0xeae5('0x4'));var logger=require(_0xeae5('0x5'))(_0xeae5('0x6'));var config=require(_0xeae5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeae5('0x8')][_0xeae5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b39a0,_0x54638c,_0x13c082){return new BPromise(function(_0x2800d6,_0x24a72e){return client[_0xeae5('0xa')](_0x4b39a0,_0x13c082)['then'](function(_0x34ec91){logger['info'](_0xeae5('0xb'),_0x54638c,_0xeae5('0xc'));logger['debug'](_0xeae5('0xd'),_0x54638c,_0xeae5('0xc'),JSON['stringify'](_0x34ec91));if(_0x34ec91[_0xeae5('0xe')]){if(_0x34ec91[_0xeae5('0xe')]['code']===0x1f4){logger[_0xeae5('0xe')](_0xeae5('0xb'),_0x54638c,_0x34ec91[_0xeae5('0xe')][_0xeae5('0xf')]);return _0x24a72e(_0x34ec91['error'][_0xeae5('0xf')]);}logger[_0xeae5('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x54638c,_0x34ec91[_0xeae5('0xe')]['message']);return _0x2800d6(_0x34ec91[_0xeae5('0xe')][_0xeae5('0xf')]);}else{logger[_0xeae5('0x10')](_0xeae5('0xb'),_0x54638c,'request\x20sent');_0x2800d6(_0x34ec91[_0xeae5('0x11')][_0xeae5('0xf')]);}})[_0xeae5('0x12')](function(_0x2b2c1d){logger[_0xeae5('0xe')](_0xeae5('0xb'),_0x54638c,_0x2b2c1d);_0x24a72e(_0x2b2c1d);});});}exports[_0xeae5('0x13')]=function(_0x1ed206){var _0x427f91=this;return new Promise(function(_0x3b53a8,_0x366f12){return db[_0xeae5('0x14')]['find']({'raw':_0x1ed206[_0xeae5('0x15')]?_0x1ed206[_0xeae5('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1ed206[_0xeae5('0x15')]?_0x1ed206[_0xeae5('0x15')]['where']||null:null,'attributes':_0x1ed206['options']?_0x1ed206[_0xeae5('0x15')][_0xeae5('0x16')]||null:null,'include':_0x1ed206[_0xeae5('0x15')]?_0x1ed206[_0xeae5('0x15')]['include']?_[_0xeae5('0x17')](_0x1ed206[_0xeae5('0x15')]['include'],function(_0xd592a3){return{'model':db[_0xd592a3[_0xeae5('0x18')]],'as':_0xd592a3['as'],'attributes':_0xd592a3[_0xeae5('0x16')],'include':_0xd592a3[_0xeae5('0x19')]?_[_0xeae5('0x17')](_0xd592a3[_0xeae5('0x19')],function(_0x192b96){return{'model':db[_0x192b96[_0xeae5('0x18')]],'as':_0x192b96['as'],'attributes':_0x192b96['attributes'],'include':_0x192b96[_0xeae5('0x19')]?_[_0xeae5('0x17')](_0x192b96[_0xeae5('0x19')],function(_0x249e83){return{'model':db[_0x249e83[_0xeae5('0x18')]],'as':_0x249e83['as'],'attributes':_0x249e83['attributes']};}):[]};}):[]};}):[]:[]})[_0xeae5('0x1a')](function(_0x31b2d2){logger[_0xeae5('0x10')](_0xeae5('0x13'),_0x1ed206);logger[_0xeae5('0x1b')]('ShowSquareOdbc',_0x1ed206,JSON[_0xeae5('0x1c')](_0x31b2d2));_0x3b53a8(_0x31b2d2);})['catch'](function(_0x2becf4){logger[_0xeae5('0xe')](_0xeae5('0x13'),_0x2becf4['message'],_0x1ed206);_0x366f12(_0x427f91['error'](0x1f4,_0x2becf4['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 34717bd..e3aa0d7 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 _0x5523=['destroy','removeUsers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id/users','create','post','addUsers','put','/:id','update','delete'];(function(_0x2e7c1b,_0x232f79){var _0x42f565=function(_0x31ee5a){while(--_0x31ee5a){_0x2e7c1b['push'](_0x2e7c1b['shift']());}};_0x42f565(++_0x232f79);}(_0x5523,0x137));var _0x3552=function(_0x50f70d,_0x5d3e56){_0x50f70d=_0x50f70d-0x0;var _0x1d2de1=_0x5523[_0x50f70d];return _0x1d2de1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3552('0x0'));var timeout=require(_0x3552('0x1'));var express=require(_0x3552('0x2'));var router=express[_0x3552('0x3')]();var fs_extra=require(_0x3552('0x4'));var auth=require(_0x3552('0x5'));var interaction=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var controller=require(_0x3552('0x8'));router[_0x3552('0x9')]('/',auth[_0x3552('0xa')](),controller['index']);router['get']('/:id',auth[_0x3552('0xa')](),controller['show']);router[_0x3552('0x9')](_0x3552('0xb'),auth[_0x3552('0xa')](),controller['getUsers']);router['post']('/',auth[_0x3552('0xa')](),controller[_0x3552('0xc')]);router[_0x3552('0xd')](_0x3552('0xb'),auth[_0x3552('0xa')](),controller[_0x3552('0xe')]);router[_0x3552('0xf')](_0x3552('0x10'),auth[_0x3552('0xa')](),controller[_0x3552('0x11')]);router[_0x3552('0x12')]('/:id',auth[_0x3552('0xa')](),controller[_0x3552('0x13')]);router[_0x3552('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x3552('0x14')]);module[_0x3552('0x15')]=router; \ No newline at end of file +var _0xa9e2=['path','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','update','delete','destroy','util'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e2,0x1e5));var _0x2a9e=function(_0x3b94b6,_0x4d8127){_0x3b94b6=_0x3b94b6-0x0;var _0x5eaed8=_0xa9e2[_0x3b94b6];return _0x5eaed8;};'use strict';var multer=require('multer');var util=require(_0x2a9e('0x0'));var path=require(_0x2a9e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a9e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2a9e('0x3'));var config=require(_0x2a9e('0x4'));var controller=require(_0x2a9e('0x5'));router[_0x2a9e('0x6')]('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0x8')]);router['get'](_0x2a9e('0x9'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xa')]);router[_0x2a9e('0x6')](_0x2a9e('0xb'),auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xc')]);router[_0x2a9e('0xd')]('/',auth[_0x2a9e('0x7')](),controller[_0x2a9e('0xe')]);router[_0x2a9e('0xd')]('/:id/users',auth[_0x2a9e('0x7')](),controller['addUsers']);router['put'](_0x2a9e('0x9'),auth['isAuthenticated'](),controller[_0x2a9e('0xf')]);router[_0x2a9e('0x10')](_0x2a9e('0x9'),auth['isAuthenticated'](),controller[_0x2a9e('0x11')]);router[_0x2a9e('0x10')](_0x2a9e('0xb'),auth[_0x2a9e('0x7')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f14e46d..f2cfb2e 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 _0xeca9=['DATE','exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0xeca9,0x1da));var _0x9eca=function(_0x105eb1,_0x2d2040){_0x105eb1=_0x105eb1-0x0;var _0x54d5a9=_0xeca9[_0x105eb1];return _0x54d5a9;};'use strict';var Sequelize=require('sequelize');module[_0x9eca('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9eca('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x9eca('0x2')]},'notes':{'type':Sequelize[_0x9eca('0x3')]},'preproduction':{'type':Sequelize[_0x9eca('0x4')](_0x9eca('0x5')),'get':function(){if(this[_0x9eca('0x6')](_0x9eca('0x7'))){return this[_0x9eca('0x6')]('preproduction')[_0x9eca('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x9eca('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x9eca('0x9'))){return this[_0x9eca('0x6')](_0x9eca('0x9'))[_0x9eca('0x8')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x9eca('0xa')]}}; \ No newline at end of file +var _0xfc20=['DATE','sequelize','name','TEXT','BLOB','long','getDataValue','preproduction','utf8','production'];(function(_0xa99763,_0x29b162){var _0x1d9feb=function(_0x13232a){while(--_0x13232a){_0xa99763['push'](_0xa99763['shift']());}};_0x1d9feb(++_0x29b162);}(_0xfc20,0x12d));var _0x0fc2=function(_0x12d592,_0xe568ed){_0x12d592=_0x12d592-0x0;var _0xb5ceda=_0xfc20[_0x12d592];return _0xb5ceda;};'use strict';var Sequelize=require(_0x0fc2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0fc2('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x0fc2('0x2')]},'preproduction':{'type':Sequelize[_0x0fc2('0x3')](_0x0fc2('0x4')),'get':function(){if(this[_0x0fc2('0x5')]('preproduction')){return this[_0x0fc2('0x5')](_0x0fc2('0x6'))['toString'](_0x0fc2('0x7'));}}},'production':{'type':Sequelize[_0x0fc2('0x3')](_0x0fc2('0x4')),'get':function(){if(this[_0x0fc2('0x5')]('production')){return this[_0x0fc2('0x5')](_0x0fc2('0x8'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x0fc2('0x9')]},'publishedAt':{'type':Sequelize[_0x0fc2('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 4241014..8b072f4 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 _0x01d9=['SquareProject','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SquareProjects','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x9bc7e,_0x489c0b){var _0x5bfd1c=function(_0x5dda51){while(--_0x5dda51){_0x9bc7e['push'](_0x9bc7e['shift']());}};_0x5bfd1c(++_0x489c0b);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var Redis=require(_0x901d('0x1'));var qs=require(_0x901d('0x2'));var logger=require(_0x901d('0x3'))('api');var config=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];config[_0x901d('0x6')]=_[_0x901d('0x7')](config[_0x901d('0x6')],{'host':_0x901d('0x8'),'port':0x18eb});var socket=require(_0x901d('0x9'))(new Redis(config['redis']));require(_0x901d('0xa'))[_0x901d('0xb')](socket);function respondWithStatusCode(_0x21e1d7,_0x12c39f){_0x12c39f=_0x12c39f||0xcc;return function(_0x313f85){if(_0x313f85){return _0x21e1d7[_0x901d('0xc')](_0x12c39f);}return _0x21e1d7[_0x901d('0xd')](_0x12c39f)[_0x901d('0xe')]();};}function respondWithResult(_0x15076e,_0xacff40){_0xacff40=_0xacff40||0xc8;return function(_0x440fb0){if(_0x440fb0){return _0x15076e[_0x901d('0xd')](_0xacff40)[_0x901d('0xf')](_0x440fb0);}};}function respondWithFilteredResult(_0x5d74e2,_0x439f17){return function(_0x5ba100){if(_0x5ba100){var _0x220153=typeof _0x439f17[_0x901d('0x10')]===_0x901d('0x11')&&typeof _0x439f17[_0x901d('0x12')]===_0x901d('0x11');var _0x5d2345=_0x5ba100[_0x901d('0x13')];var _0x31cbbd=_0x220153?0x0:_0x439f17[_0x901d('0x10')];var _0x1618a8=_0x220153?_0x5ba100[_0x901d('0x13')]:_0x439f17[_0x901d('0x10')]+_0x439f17['limit'];var _0x991ee2;if(_0x1618a8>=_0x5d2345){_0x1618a8=_0x5d2345;_0x991ee2=0xc8;}else{_0x991ee2=0xce;}_0x5d74e2[_0x901d('0xd')](_0x991ee2);return _0x5d74e2[_0x901d('0x14')](_0x901d('0x15'),_0x31cbbd+'-'+_0x1618a8+'/'+_0x5d2345)[_0x901d('0xf')](_0x5ba100);}return null;};}function saveUpdates(_0x7dd5f4){return function(_0x477cd4){if(_0x477cd4){return _0x477cd4[_0x901d('0x16')](_0x7dd5f4)[_0x901d('0x17')](function(_0x3b62e5){return _0x3b62e5;});}return null;};}function removeEntity(_0x28caae){return function(_0x390c33){if(_0x390c33){return _0x390c33[_0x901d('0x18')]()[_0x901d('0x17')](function(){var _0x38f42b=_0x390c33[_0x901d('0x19')]({'plain':!![]});var _0xf3c66a=_0x901d('0x1a');return db['UserProfileResource'][_0x901d('0x18')]({'where':{'type':_0xf3c66a,'resourceId':_0x38f42b['id']}})[_0x901d('0x17')](function(){return _0x390c33;});})['then'](function(){var _0x5bdff4=new Redis(config['redis']);_0x5bdff4['publish'](_0x901d('0x1b'),JSON[_0x901d('0x1c')]({'id':_0x390c33['id'],'deleted':!![]}));})['then'](function(){_0x28caae[_0x901d('0xd')](0xcc)[_0x901d('0xe')]();});}};}function handleEntityNotFound(_0x488e24){return function(_0x20778b){if(!_0x20778b){_0x488e24[_0x901d('0xc')](0x194);}return _0x20778b;};}function handleError(_0x2402de,_0x3f80b9){_0x3f80b9=_0x3f80b9||0x1f4;return function(_0x1e7d36){logger[_0x901d('0x1d')](_0x1e7d36[_0x901d('0x1e')]);if(_0x1e7d36[_0x901d('0x1f')]){delete _0x1e7d36['name'];}_0x2402de[_0x901d('0xd')](_0x3f80b9)[_0x901d('0x20')](_0x1e7d36);};}exports[_0x901d('0x21')]=function(_0x1f0ee5,_0x557809){var _0x293119={},_0x23fd43={},_0x27f4ca={'count':0x0,'rows':[]};var _0x3cbe43=_[_0x901d('0x22')](db['SquareProject'][_0x901d('0x23')],function(_0xc52d0f){return{'name':_0xc52d0f[_0x901d('0x24')],'type':_0xc52d0f[_0x901d('0x25')][_0x901d('0x26')]};});_0x23fd43[_0x901d('0x27')]=_['map'](_0x3cbe43,_0x901d('0x1f'));_0x23fd43['query']=_[_0x901d('0x28')](_0x1f0ee5[_0x901d('0x29')]);_0x23fd43[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x23fd43[_0x901d('0x27')],_0x23fd43[_0x901d('0x29')]);_0x293119[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x23fd43[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x2d')]));_0x293119[_0x901d('0x2c')]=_0x293119[_0x901d('0x2c')][_0x901d('0x2e')]?_0x293119['attributes']:_0x23fd43[_0x901d('0x27')];if(!_0x1f0ee5[_0x901d('0x29')][_0x901d('0x2f')]('nolimit')){_0x293119[_0x901d('0x12')]=qs[_0x901d('0x12')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x12')]);_0x293119[_0x901d('0x10')]=qs[_0x901d('0x10')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x10')]);}_0x293119[_0x901d('0x30')]=qs[_0x901d('0x31')](_0x1f0ee5['query']['sort']);_0x293119[_0x901d('0x32')]=qs['filters'](_[_0x901d('0x33')](_0x1f0ee5[_0x901d('0x29')],_0x23fd43['filters']),_0x3cbe43);if(_0x1f0ee5[_0x901d('0x29')][_0x901d('0x34')]){_0x293119[_0x901d('0x32')]=_['merge'](_0x293119[_0x901d('0x32')],{'$or':_[_0x901d('0x22')](_0x3cbe43,function(_0x1a1f9c){if(_0x1a1f9c[_0x901d('0x25')]!==_0x901d('0x35')){var _0x32aa29={};_0x32aa29[_0x1a1f9c[_0x901d('0x1f')]]={'$like':'%'+_0x1f0ee5[_0x901d('0x29')][_0x901d('0x34')]+'%'};return _0x32aa29;}})});}_0x293119=_[_0x901d('0x36')]({},_0x293119,_0x1f0ee5[_0x901d('0x37')]);var _0x3d4f8b={'where':_0x293119[_0x901d('0x32')]};return db[_0x901d('0x38')][_0x901d('0x13')](_0x3d4f8b)[_0x901d('0x17')](function(_0x54a654){_0x27f4ca[_0x901d('0x13')]=_0x54a654;if(_0x1f0ee5[_0x901d('0x29')]['includeAll']){_0x293119['include']=[{'all':!![]}];}return db[_0x901d('0x38')]['findAll'](_0x293119);})[_0x901d('0x17')](function(_0x3d0556){_0x27f4ca[_0x901d('0x39')]=_0x3d0556;return _0x27f4ca;})[_0x901d('0x17')](respondWithFilteredResult(_0x557809,_0x293119))[_0x901d('0x3a')](handleError(_0x557809,null));};exports[_0x901d('0x3b')]=function(_0x5df4cb,_0x4ce6e4){var _0x4ee804={'raw':![],'where':{'id':_0x5df4cb[_0x901d('0x3c')]['id']}},_0x4c4fd0={};_0x4c4fd0[_0x901d('0x27')]=_['keys'](db[_0x901d('0x38')][_0x901d('0x23')]);_0x4c4fd0['query']=_[_0x901d('0x28')](_0x5df4cb[_0x901d('0x29')]);_0x4c4fd0[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x4c4fd0['model'],_0x4c4fd0['query']);_0x4ee804[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x4c4fd0[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x5df4cb[_0x901d('0x29')][_0x901d('0x2d')]));_0x4ee804[_0x901d('0x2c')]=_0x4ee804[_0x901d('0x2c')][_0x901d('0x2e')]?_0x4ee804[_0x901d('0x2c')]:_0x4c4fd0[_0x901d('0x27')];if(_0x5df4cb['query'][_0x901d('0x3d')]){_0x4ee804['include']=[{'all':!![]}];}_0x4ee804=_[_0x901d('0x36')]({},_0x4ee804,_0x5df4cb['options']);return db[_0x901d('0x38')]['find'](_0x4ee804)[_0x901d('0x17')](handleEntityNotFound(_0x4ce6e4,null))[_0x901d('0x17')](respondWithResult(_0x4ce6e4,null))[_0x901d('0x3a')](handleError(_0x4ce6e4,null));};exports[_0x901d('0x3e')]=function(_0x2fc1d2,_0x2787ae){return db[_0x901d('0x38')][_0x901d('0x3e')](_0x2fc1d2[_0x901d('0x3f')],{})[_0x901d('0x17')](function(_0x1a27c0){var _0x54fc19=_0x2fc1d2[_0x901d('0x40')][_0x901d('0x19')]({'plain':!![]});if(!_0x54fc19)throw new Error(_0x901d('0x41'));if(_0x54fc19[_0x901d('0x42')]===_0x901d('0x40')){var _0x24b6fa=_0x1a27c0[_0x901d('0x19')]({'plain':!![]});var _0x43135c=_0x901d('0x1a');return db[_0x901d('0x43')][_0x901d('0x44')]({'where':{'name':_0x43135c,'userProfileId':_0x54fc19[_0x901d('0x45')]},'raw':!![]})[_0x901d('0x17')](function(_0x23f2a9){if(_0x23f2a9&&_0x23f2a9['autoAssociation']===0x0){return db['UserProfileResource'][_0x901d('0x3e')]({'name':_0x24b6fa[_0x901d('0x1f')],'resourceId':_0x24b6fa['id'],'type':_0x23f2a9[_0x901d('0x1f')],'sectionId':_0x23f2a9['id']},{})[_0x901d('0x17')](function(){return _0x1a27c0;});}else{return _0x1a27c0;}})[_0x901d('0x3a')](function(_0x5cbc90){logger['error'](_0x901d('0x46'),_0x5cbc90);throw _0x5cbc90;});}return _0x1a27c0;})[_0x901d('0x17')](respondWithResult(_0x2787ae,0xc9))['catch'](handleError(_0x2787ae,null));};exports[_0x901d('0x16')]=function(_0x165207,_0x4d2b2d){if(_0x165207[_0x901d('0x3f')]['id']){delete _0x165207['body']['id'];}return db[_0x901d('0x38')][_0x901d('0x44')]({'where':{'id':_0x165207[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x4d2b2d,null))['then'](saveUpdates(_0x165207[_0x901d('0x3f')],null))[_0x901d('0x17')](function(_0x1d5880){if(!_0x1d5880)return;var _0x8af950=_0x1d5880[_0x901d('0x19')]({'plain':!![]});return _0x8af950;})[_0x901d('0x17')](function(_0x17c716){var _0x42ddd=new Redis(config[_0x901d('0x6')]);_0x42ddd[_0x901d('0x47')]('agi',JSON[_0x901d('0x1c')](_['pick'](_0x17c716,['id',_0x901d('0x1f'),_0x901d('0x48')])));return _0x17c716;})[_0x901d('0x17')](respondWithResult(_0x4d2b2d,null))[_0x901d('0x3a')](handleError(_0x4d2b2d,null));};exports[_0x901d('0x18')]=function(_0x21f3bd,_0x45c730){return db[_0x901d('0x38')]['find']({'where':{'id':_0x21f3bd[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x45c730,null))[_0x901d('0x17')](removeEntity(_0x45c730,null))['catch'](handleError(_0x45c730,null));};exports[_0x901d('0x49')]=function(_0x5d049d,_0x1c99ce){return db[_0x901d('0x38')][_0x901d('0x44')]({'where':{'id':_0x5d049d['params']['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x1c99ce,null))[_0x901d('0x17')](function(_0x3740a3){if(_0x3740a3){return _0x3740a3[_0x901d('0x49')](_0x5d049d[_0x901d('0x3f')][_0x901d('0x4a')],_['omit'](_0x5d049d[_0x901d('0x3f')],[_0x901d('0x4a'),'id'])||{});}})[_0x901d('0x17')](respondWithResult(_0x1c99ce,null))[_0x901d('0x3a')](handleError(_0x1c99ce,null));};exports[_0x901d('0x4b')]=function(_0x41f8a5,_0x52eb30){return db[_0x901d('0x38')]['find']({'where':{'id':_0x41f8a5['params']['id']}})['then'](handleEntityNotFound(_0x52eb30,null))['then'](function(_0x23a9aa){if(_0x23a9aa){return _0x23a9aa[_0x901d('0x4b')](_0x41f8a5[_0x901d('0x29')]['ids'])[_0x901d('0x17')](function(){if(_['isArray'](_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')])){for(var _0xecc8f9=0x0;_0xecc8f9<_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')][_0x901d('0x2e')];_0xecc8f9+=0x1){socket[_0x901d('0x4c')](_0x901d('0x4d'),{'UserId':Number(_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')][_0xecc8f9]),'SquareProjectId':Number(_0x41f8a5[_0x901d('0x3c')]['id'])});}}else{socket[_0x901d('0x4c')](_0x901d('0x4d'),{'UserId':Number(_0x41f8a5[_0x901d('0x29')]['ids']),'SquareProjectId':Number(_0x41f8a5['params']['id'])});}});}})[_0x901d('0x17')](respondWithStatusCode(_0x52eb30,null))[_0x901d('0x3a')](handleError(_0x52eb30,null));};exports[_0x901d('0x4e')]=function(_0x3fbb32,_0x109e0a){var _0x383b06={};var _0x2d6431={};var _0x4e9d42;var _0x596a04;return db['SquareProject'][_0x901d('0x4f')]({'where':{'id':_0x3fbb32[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x109e0a,null))[_0x901d('0x17')](function(_0x32bb51){if(_0x32bb51){_0x4e9d42=_0x32bb51;_0x2d6431[_0x901d('0x27')]=_[_0x901d('0x28')](db[_0x901d('0x50')][_0x901d('0x23')]);_0x2d6431['query']=_['keys'](_0x3fbb32[_0x901d('0x29')]);_0x2d6431[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x2d6431[_0x901d('0x27')],_0x2d6431[_0x901d('0x29')]);_0x383b06[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x2d6431[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x3fbb32[_0x901d('0x29')]['fields']));_0x383b06[_0x901d('0x2c')]=_0x383b06[_0x901d('0x2c')]['length']?_0x383b06['attributes']:_0x2d6431[_0x901d('0x27')];_0x383b06[_0x901d('0x30')]=qs['sort'](_0x3fbb32[_0x901d('0x29')][_0x901d('0x31')]);_0x383b06[_0x901d('0x32')]=qs[_0x901d('0x2a')](_['pick'](_0x3fbb32[_0x901d('0x29')],_0x2d6431[_0x901d('0x2a')]));if(_0x3fbb32[_0x901d('0x29')][_0x901d('0x34')]){_0x383b06[_0x901d('0x32')]=_[_0x901d('0x36')](_0x383b06['where'],{'$or':_[_0x901d('0x22')](_0x383b06[_0x901d('0x2c')],function(_0x26b498){var _0x5763ef={};_0x5763ef[_0x26b498]={'$like':'%'+_0x3fbb32[_0x901d('0x29')][_0x901d('0x34')]+'%'};return _0x5763ef;})});}_0x383b06=_[_0x901d('0x36')]({},_0x383b06,_0x3fbb32['options']);return _0x4e9d42['getUsers'](_0x383b06);}})['then'](function(_0x2350ac){if(_0x2350ac){_0x596a04=_0x2350ac[_0x901d('0x2e')];if(!_0x3fbb32['query']['hasOwnProperty'](_0x901d('0x51'))){_0x383b06[_0x901d('0x12')]=qs[_0x901d('0x12')](_0x3fbb32[_0x901d('0x29')][_0x901d('0x12')]);_0x383b06['offset']=qs[_0x901d('0x10')](_0x3fbb32[_0x901d('0x29')][_0x901d('0x10')]);}return _0x4e9d42[_0x901d('0x4e')](_0x383b06);}})['then'](function(_0x2e1dcb){if(_0x2e1dcb){return _0x2e1dcb?{'count':_0x596a04,'rows':_0x2e1dcb}:null;}})['then'](respondWithResult(_0x109e0a,null))[_0x901d('0x3a')](handleError(_0x109e0a,null));}; \ No newline at end of file +var _0x1a85=['name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','pick','production','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','order','getUsers','../../components/parsers/qs','../../config/logger','api','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','end','stack'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x1a85,0x178));var _0x51a8=function(_0xa1dcbd,_0x39a535){_0xa1dcbd=_0xa1dcbd-0x0;var _0x5a20dc=_0x1a85[_0xa1dcbd];return _0x5a20dc;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x51a8('0x0'));var logger=require(_0x51a8('0x1'))(_0x51a8('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x51a8('0x3')]=_[_0x51a8('0x4')](config[_0x51a8('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0x5'))(new Redis(config['redis']));require(_0x51a8('0x6'))['register'](socket);function respondWithStatusCode(_0x331117,_0x16a21e){_0x16a21e=_0x16a21e||0xcc;return function(_0x4f3919){if(_0x4f3919){return _0x331117[_0x51a8('0x7')](_0x16a21e);}return _0x331117['status'](_0x16a21e)['end']();};}function respondWithResult(_0x39e06a,_0x2f276b){_0x2f276b=_0x2f276b||0xc8;return function(_0x1a476d){if(_0x1a476d){return _0x39e06a[_0x51a8('0x8')](_0x2f276b)[_0x51a8('0x9')](_0x1a476d);}};}function respondWithFilteredResult(_0x421fa4,_0x3f93c7){return function(_0x273a3f){if(_0x273a3f){var _0x34c887=typeof _0x3f93c7[_0x51a8('0xa')]===_0x51a8('0xb')&&typeof _0x3f93c7[_0x51a8('0xc')]===_0x51a8('0xb');var _0x1827e6=_0x273a3f[_0x51a8('0xd')];var _0x2e1629=_0x34c887?0x0:_0x3f93c7[_0x51a8('0xa')];var _0x47b988=_0x34c887?_0x273a3f[_0x51a8('0xd')]:_0x3f93c7[_0x51a8('0xa')]+_0x3f93c7[_0x51a8('0xc')];var _0x50d992;if(_0x47b988>=_0x1827e6){_0x47b988=_0x1827e6;_0x50d992=0xc8;}else{_0x50d992=0xce;}_0x421fa4[_0x51a8('0x8')](_0x50d992);return _0x421fa4['set'](_0x51a8('0xe'),_0x2e1629+'-'+_0x47b988+'/'+_0x1827e6)[_0x51a8('0x9')](_0x273a3f);}return null;};}function saveUpdates(_0x39cd45){return function(_0x2b0521){if(_0x2b0521){return _0x2b0521[_0x51a8('0xf')](_0x39cd45)[_0x51a8('0x10')](function(_0x1f49ee){return _0x1f49ee;});}return null;};}function removeEntity(_0x516abc){return function(_0x1c2f25){if(_0x1c2f25){return _0x1c2f25[_0x51a8('0x11')]()[_0x51a8('0x10')](function(){var _0x23539e=_0x1c2f25[_0x51a8('0x12')]({'plain':!![]});var _0x544886='SquareProjects';return db[_0x51a8('0x13')][_0x51a8('0x11')]({'where':{'type':_0x544886,'resourceId':_0x23539e['id']}})[_0x51a8('0x10')](function(){return _0x1c2f25;});})[_0x51a8('0x10')](function(){var _0x2a4c4c=new Redis(config[_0x51a8('0x3')]);_0x2a4c4c[_0x51a8('0x14')](_0x51a8('0x15'),JSON['stringify']({'id':_0x1c2f25['id'],'deleted':!![]}));})[_0x51a8('0x10')](function(){_0x516abc['status'](0xcc)[_0x51a8('0x16')]();});}};}function handleEntityNotFound(_0x12c029){return function(_0x8bda40){if(!_0x8bda40){_0x12c029[_0x51a8('0x7')](0x194);}return _0x8bda40;};}function handleError(_0x51f737,_0xae3588){_0xae3588=_0xae3588||0x1f4;return function(_0x4b9cdd){logger['error'](_0x4b9cdd[_0x51a8('0x17')]);if(_0x4b9cdd['name']){delete _0x4b9cdd[_0x51a8('0x18')];}_0x51f737[_0x51a8('0x8')](_0xae3588)[_0x51a8('0x19')](_0x4b9cdd);};}exports[_0x51a8('0x1a')]=function(_0x157554,_0x2f2f05){var _0x291ed6={},_0x1326a2={},_0x5b3f49={'count':0x0,'rows':[]};var _0x273ce2=_[_0x51a8('0x1b')](db[_0x51a8('0x1c')][_0x51a8('0x1d')],function(_0x1c150d){return{'name':_0x1c150d[_0x51a8('0x1e')],'type':_0x1c150d[_0x51a8('0x1f')][_0x51a8('0x20')]};});_0x1326a2[_0x51a8('0x21')]=_[_0x51a8('0x1b')](_0x273ce2,_0x51a8('0x18'));_0x1326a2[_0x51a8('0x22')]=_['keys'](_0x157554[_0x51a8('0x22')]);_0x1326a2['filters']=_[_0x51a8('0x23')](_0x1326a2[_0x51a8('0x21')],_0x1326a2[_0x51a8('0x22')]);_0x291ed6[_0x51a8('0x24')]=_[_0x51a8('0x23')](_0x1326a2['model'],qs[_0x51a8('0x25')](_0x157554['query'][_0x51a8('0x25')]));_0x291ed6[_0x51a8('0x24')]=_0x291ed6[_0x51a8('0x24')]['length']?_0x291ed6[_0x51a8('0x24')]:_0x1326a2['model'];if(!_0x157554[_0x51a8('0x22')][_0x51a8('0x26')](_0x51a8('0x27'))){_0x291ed6[_0x51a8('0xc')]=qs[_0x51a8('0xc')](_0x157554['query'][_0x51a8('0xc')]);_0x291ed6['offset']=qs[_0x51a8('0xa')](_0x157554[_0x51a8('0x22')][_0x51a8('0xa')]);}_0x291ed6['order']=qs[_0x51a8('0x28')](_0x157554[_0x51a8('0x22')][_0x51a8('0x28')]);_0x291ed6[_0x51a8('0x29')]=qs[_0x51a8('0x2a')](_['pick'](_0x157554['query'],_0x1326a2['filters']),_0x273ce2);if(_0x157554[_0x51a8('0x22')][_0x51a8('0x2b')]){_0x291ed6['where']=_[_0x51a8('0x2c')](_0x291ed6['where'],{'$or':_[_0x51a8('0x1b')](_0x273ce2,function(_0x38aa25){if(_0x38aa25[_0x51a8('0x1f')]!==_0x51a8('0x2d')){var _0x256cda={};_0x256cda[_0x38aa25[_0x51a8('0x18')]]={'$like':'%'+_0x157554['query']['filter']+'%'};return _0x256cda;}})});}_0x291ed6=_[_0x51a8('0x2c')]({},_0x291ed6,_0x157554['options']);var _0x5d7214={'where':_0x291ed6['where']};return db[_0x51a8('0x1c')][_0x51a8('0xd')](_0x5d7214)[_0x51a8('0x10')](function(_0x5956b8){_0x5b3f49[_0x51a8('0xd')]=_0x5956b8;if(_0x157554[_0x51a8('0x22')][_0x51a8('0x2e')]){_0x291ed6[_0x51a8('0x2f')]=[{'all':!![]}];}return db['SquareProject'][_0x51a8('0x30')](_0x291ed6);})[_0x51a8('0x10')](function(_0x1b0333){_0x5b3f49['rows']=_0x1b0333;return _0x5b3f49;})[_0x51a8('0x10')](respondWithFilteredResult(_0x2f2f05,_0x291ed6))['catch'](handleError(_0x2f2f05,null));};exports[_0x51a8('0x31')]=function(_0x1e637a,_0x2a98bd){var _0x37d50b={'raw':![],'where':{'id':_0x1e637a[_0x51a8('0x32')]['id']}},_0x5c44a9={};_0x5c44a9[_0x51a8('0x21')]=_[_0x51a8('0x33')](db[_0x51a8('0x1c')][_0x51a8('0x1d')]);_0x5c44a9[_0x51a8('0x22')]=_[_0x51a8('0x33')](_0x1e637a[_0x51a8('0x22')]);_0x5c44a9[_0x51a8('0x2a')]=_['intersection'](_0x5c44a9[_0x51a8('0x21')],_0x5c44a9[_0x51a8('0x22')]);_0x37d50b['attributes']=_['intersection'](_0x5c44a9[_0x51a8('0x21')],qs[_0x51a8('0x25')](_0x1e637a[_0x51a8('0x22')][_0x51a8('0x25')]));_0x37d50b[_0x51a8('0x24')]=_0x37d50b[_0x51a8('0x24')][_0x51a8('0x34')]?_0x37d50b[_0x51a8('0x24')]:_0x5c44a9[_0x51a8('0x21')];if(_0x1e637a[_0x51a8('0x22')]['includeAll']){_0x37d50b[_0x51a8('0x2f')]=[{'all':!![]}];}_0x37d50b=_[_0x51a8('0x2c')]({},_0x37d50b,_0x1e637a[_0x51a8('0x35')]);return db[_0x51a8('0x1c')][_0x51a8('0x36')](_0x37d50b)[_0x51a8('0x10')](handleEntityNotFound(_0x2a98bd,null))['then'](respondWithResult(_0x2a98bd,null))[_0x51a8('0x37')](handleError(_0x2a98bd,null));};exports['create']=function(_0xa215ab,_0x3a33f3){return db[_0x51a8('0x1c')][_0x51a8('0x38')](_0xa215ab[_0x51a8('0x39')],{})['then'](function(_0x513586){var _0x4653e3=_0xa215ab[_0x51a8('0x3a')][_0x51a8('0x12')]({'plain':!![]});if(!_0x4653e3)throw new Error(_0x51a8('0x3b'));if(_0x4653e3[_0x51a8('0x3c')]==='user'){var _0x504a43=_0x513586[_0x51a8('0x12')]({'plain':!![]});var _0x108131=_0x51a8('0x3d');return db[_0x51a8('0x3e')][_0x51a8('0x36')]({'where':{'name':_0x108131,'userProfileId':_0x4653e3[_0x51a8('0x3f')]},'raw':!![]})[_0x51a8('0x10')](function(_0x1103a3){if(_0x1103a3&&_0x1103a3[_0x51a8('0x40')]===0x0){return db['UserProfileResource']['create']({'name':_0x504a43['name'],'resourceId':_0x504a43['id'],'type':_0x1103a3[_0x51a8('0x18')],'sectionId':_0x1103a3['id']},{})[_0x51a8('0x10')](function(){return _0x513586;});}else{return _0x513586;}})[_0x51a8('0x37')](function(_0x5259f3){logger[_0x51a8('0x41')](_0x51a8('0x42'),_0x5259f3);throw _0x5259f3;});}return _0x513586;})['then'](respondWithResult(_0x3a33f3,0xc9))[_0x51a8('0x37')](handleError(_0x3a33f3,null));};exports['update']=function(_0x50a2f8,_0xbf828b){if(_0x50a2f8[_0x51a8('0x39')]['id']){delete _0x50a2f8[_0x51a8('0x39')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x50a2f8[_0x51a8('0x32')]['id']}})['then'](handleEntityNotFound(_0xbf828b,null))[_0x51a8('0x10')](saveUpdates(_0x50a2f8[_0x51a8('0x39')],null))[_0x51a8('0x10')](function(_0x1ace5b){if(!_0x1ace5b)return;var _0xee9bee=_0x1ace5b[_0x51a8('0x12')]({'plain':!![]});return _0xee9bee;})[_0x51a8('0x10')](function(_0x406a87){var _0x29d31e=new Redis(config['redis']);_0x29d31e[_0x51a8('0x14')](_0x51a8('0x15'),JSON[_0x51a8('0x43')](_[_0x51a8('0x44')](_0x406a87,['id','name',_0x51a8('0x45')])));return _0x406a87;})['then'](respondWithResult(_0xbf828b,null))[_0x51a8('0x37')](handleError(_0xbf828b,null));};exports[_0x51a8('0x11')]=function(_0x5c66e8,_0x56dd7a){return db[_0x51a8('0x1c')][_0x51a8('0x36')]({'where':{'id':_0x5c66e8[_0x51a8('0x32')]['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x56dd7a,null))[_0x51a8('0x10')](removeEntity(_0x56dd7a,null))['catch'](handleError(_0x56dd7a,null));};exports[_0x51a8('0x46')]=function(_0xd1ddd5,_0x7a9dc){return db[_0x51a8('0x1c')][_0x51a8('0x36')]({'where':{'id':_0xd1ddd5['params']['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x7a9dc,null))[_0x51a8('0x10')](function(_0x3656ac){if(_0x3656ac){return _0x3656ac[_0x51a8('0x46')](_0xd1ddd5[_0x51a8('0x39')][_0x51a8('0x47')],_['omit'](_0xd1ddd5['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x7a9dc,null))[_0x51a8('0x37')](handleError(_0x7a9dc,null));};exports[_0x51a8('0x48')]=function(_0x51f9f7,_0x7ac0ae){return db['SquareProject'][_0x51a8('0x36')]({'where':{'id':_0x51f9f7['params']['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x7ac0ae,null))[_0x51a8('0x10')](function(_0x53ed73){if(_0x53ed73){return _0x53ed73['removeUsers'](_0x51f9f7['query'][_0x51a8('0x47')])[_0x51a8('0x10')](function(){if(_[_0x51a8('0x49')](_0x51f9f7[_0x51a8('0x22')][_0x51a8('0x47')])){for(var _0x21c8e0=0x0;_0x21c8e0<_0x51f9f7[_0x51a8('0x22')][_0x51a8('0x47')]['length'];_0x21c8e0+=0x1){socket[_0x51a8('0x4a')](_0x51a8('0x4b'),{'UserId':Number(_0x51f9f7['query'][_0x51a8('0x47')][_0x21c8e0]),'SquareProjectId':Number(_0x51f9f7[_0x51a8('0x32')]['id'])});}}else{socket[_0x51a8('0x4a')](_0x51a8('0x4b'),{'UserId':Number(_0x51f9f7[_0x51a8('0x22')][_0x51a8('0x47')]),'SquareProjectId':Number(_0x51f9f7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x7ac0ae,null))[_0x51a8('0x37')](handleError(_0x7ac0ae,null));};exports['getUsers']=function(_0x4ca01a,_0x50a6ad){var _0x4ec2ee={};var _0x483a5a={};var _0x426aec;var _0x529b2f;return db[_0x51a8('0x1c')][_0x51a8('0x4c')]({'where':{'id':_0x4ca01a[_0x51a8('0x32')]['id']}})[_0x51a8('0x10')](handleEntityNotFound(_0x50a6ad,null))[_0x51a8('0x10')](function(_0x2d8b9b){if(_0x2d8b9b){_0x426aec=_0x2d8b9b;_0x483a5a[_0x51a8('0x21')]=_[_0x51a8('0x33')](db[_0x51a8('0x4d')][_0x51a8('0x1d')]);_0x483a5a['query']=_[_0x51a8('0x33')](_0x4ca01a[_0x51a8('0x22')]);_0x483a5a[_0x51a8('0x2a')]=_['intersection'](_0x483a5a['model'],_0x483a5a['query']);_0x4ec2ee[_0x51a8('0x24')]=_[_0x51a8('0x23')](_0x483a5a[_0x51a8('0x21')],qs[_0x51a8('0x25')](_0x4ca01a[_0x51a8('0x22')][_0x51a8('0x25')]));_0x4ec2ee[_0x51a8('0x24')]=_0x4ec2ee[_0x51a8('0x24')][_0x51a8('0x34')]?_0x4ec2ee[_0x51a8('0x24')]:_0x483a5a[_0x51a8('0x21')];_0x4ec2ee[_0x51a8('0x4e')]=qs[_0x51a8('0x28')](_0x4ca01a['query'][_0x51a8('0x28')]);_0x4ec2ee[_0x51a8('0x29')]=qs['filters'](_[_0x51a8('0x44')](_0x4ca01a['query'],_0x483a5a['filters']));if(_0x4ca01a['query'][_0x51a8('0x2b')]){_0x4ec2ee[_0x51a8('0x29')]=_[_0x51a8('0x2c')](_0x4ec2ee[_0x51a8('0x29')],{'$or':_[_0x51a8('0x1b')](_0x4ec2ee[_0x51a8('0x24')],function(_0x8fe514){var _0x5a37c1={};_0x5a37c1[_0x8fe514]={'$like':'%'+_0x4ca01a['query']['filter']+'%'};return _0x5a37c1;})});}_0x4ec2ee=_[_0x51a8('0x2c')]({},_0x4ec2ee,_0x4ca01a[_0x51a8('0x35')]);return _0x426aec[_0x51a8('0x4f')](_0x4ec2ee);}})[_0x51a8('0x10')](function(_0x32a40b){if(_0x32a40b){_0x529b2f=_0x32a40b[_0x51a8('0x34')];if(!_0x4ca01a['query'][_0x51a8('0x26')]('nolimit')){_0x4ec2ee[_0x51a8('0xc')]=qs[_0x51a8('0xc')](_0x4ca01a[_0x51a8('0x22')][_0x51a8('0xc')]);_0x4ec2ee[_0x51a8('0xa')]=qs[_0x51a8('0xa')](_0x4ca01a[_0x51a8('0x22')][_0x51a8('0xa')]);}return _0x426aec[_0x51a8('0x4f')](_0x4ec2ee);}})[_0x51a8('0x10')](function(_0x2289d9){if(_0x2289d9){return _0x2289d9?{'count':_0x529b2f,'rows':_0x2289d9}:null;}})['then'](respondWithResult(_0x50a6ad,null))['catch'](handleError(_0x50a6ad,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ae25d00..ca7b400 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 _0xc602=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x17eaad,_0x17aba3){var _0x5960ff=function(_0x5be04d){while(--_0x5be04d){_0x17eaad['push'](_0x17eaad['shift']());}};_0x5960ff(++_0x17aba3);}(_0xc602,0x1e4));var _0x2c60=function(_0x53695e,_0x4f52b0){_0x53695e=_0x53695e-0x0;var _0x2fcf5f=_0xc602[_0x53695e];return _0x2fcf5f;};'use strict';var EventEmitter=require(_0x2c60('0x0'));var SquareProject=require(_0x2c60('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c60('0x2'),'afterUpdate':_0x2c60('0x3'),'afterDestroy':_0x2c60('0x4')};function emitEvent(_0x20d578){return function(_0x2cfab8,_0x58748d,_0x1882c2){SquareProjectEvents[_0x2c60('0x5')](_0x20d578+':'+_0x2cfab8['id'],_0x2cfab8);SquareProjectEvents['emit'](_0x20d578,_0x2cfab8);_0x1882c2(null);};}for(var e in events){if(events[_0x2c60('0x6')](e)){var event=events[e];SquareProject[_0x2c60('0x7')](e,emitEvent(event));}}module[_0x2c60('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xb140=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x60b050,_0x3d2b9d){var _0x1d1e58=function(_0xf8917d){while(--_0xf8917d){_0x60b050['push'](_0x60b050['shift']());}};_0x1d1e58(++_0x3d2b9d);}(_0xb140,0x6f));var _0x0b14=function(_0x5ddafe,_0x1fb508){_0x5ddafe=_0x5ddafe-0x0;var _0x5e23aa=_0xb140[_0x5ddafe];return _0x5e23aa;};'use strict';var EventEmitter=require(_0x0b14('0x0'));var SquareProject=require(_0x0b14('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b14('0x2'),'afterUpdate':_0x0b14('0x3'),'afterDestroy':_0x0b14('0x4')};function emitEvent(_0x625906){return function(_0x256d91,_0x3d344b,_0x3fc635){SquareProjectEvents['emit'](_0x625906+':'+_0x256d91['id'],_0x256d91);SquareProjectEvents[_0x0b14('0x5')](_0x625906,_0x256d91);_0x3fc635(null);};}for(var e in events){if(events[_0x0b14('0x6')](e)){var event=events[e];SquareProject[_0x0b14('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 145dde1..a6a2307 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 _0xa6e9=['rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2776b9,_0x2d23c5){var _0x5d71f1=function(_0x3049c0){while(--_0x3049c0){_0x2776b9['push'](_0x2776b9['shift']());}};_0x5d71f1(++_0x2d23c5);}(_0xa6e9,0x162));var _0x9a6e=function(_0x37ffd8,_0x53c369){_0x37ffd8=_0x37ffd8-0x0;var _0x42046b=_0xa6e9[_0x37ffd8];return _0x42046b;};'use strict';var _=require(_0x9a6e('0x0'));var util=require('util');var logger=require(_0x9a6e('0x1'))(_0x9a6e('0x2'));var moment=require(_0x9a6e('0x3'));var BPromise=require(_0x9a6e('0x4'));var rp=require(_0x9a6e('0x5'));var fs=require('fs');var path=require(_0x9a6e('0x6'));var rimraf=require(_0x9a6e('0x7'));var config=require(_0x9a6e('0x8'));var attributes=require(_0x9a6e('0x9'));module[_0x9a6e('0xa')]=function(_0x43e43a,_0x258fb2){return _0x43e43a[_0x9a6e('0xb')]('SquareProject',attributes,{'tableName':_0x9a6e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e9c04,_0x4b0d97,_0x42476b){if(_0x4e9c04['changed'](_0x9a6e('0xd'))){_0x4e9c04[_0x9a6e('0xe')]=moment()[_0x9a6e('0xf')](_0x9a6e('0x10'));}if(_0x4e9c04['changed'](_0x9a6e('0x11'))){_0x4e9c04[_0x9a6e('0x12')]=moment()[_0x9a6e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x42476b(null,_0x4e9c04);}}});}; \ No newline at end of file +var _0xd150=['bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd150,0x113));var _0x0d15=function(_0xa62fb6,_0x3c3f2c){_0xa62fb6=_0xa62fb6-0x0;var _0x29b284=_0xd150[_0xa62fb6];return _0x29b284;};'use strict';var _=require(_0x0d15('0x0'));var util=require(_0x0d15('0x1'));var logger=require(_0x0d15('0x2'))(_0x0d15('0x3'));var moment=require(_0x0d15('0x4'));var BPromise=require(_0x0d15('0x5'));var rp=require(_0x0d15('0x6'));var fs=require('fs');var path=require(_0x0d15('0x7'));var rimraf=require(_0x0d15('0x8'));var config=require(_0x0d15('0x9'));var attributes=require(_0x0d15('0xa'));module[_0x0d15('0xb')]=function(_0x1e33aa,_0x2798f2){return _0x1e33aa[_0x0d15('0xc')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x325a73,_0x499eb5,_0x2830f9){if(_0x325a73[_0x0d15('0xd')](_0x0d15('0xe'))){_0x325a73[_0x0d15('0xf')]=moment()[_0x0d15('0x10')](_0x0d15('0x11'));}if(_0x325a73[_0x0d15('0xd')](_0x0d15('0x12'))){_0x325a73[_0x0d15('0x13')]=moment()[_0x0d15('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2830f9(null,_0x325a73);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7eefe2c..8710b41 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 _0xaf73=['SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','error','message','find','info','ShowSquareProject','catch','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects'];(function(_0x11f9d8,_0x500843){var _0x552f38=function(_0x319947){while(--_0x319947){_0x11f9d8['push'](_0x11f9d8['shift']());}};_0x552f38(++_0x500843);}(_0xaf73,0xe5));var _0x3af7=function(_0x323be7,_0x2b8ed5){_0x323be7=_0x323be7-0x0;var _0x349559=_0xaf73[_0x323be7];return _0x349559;};'use strict';var _=require(_0x3af7('0x0'));var Redis=require('ioredis');var db=require(_0x3af7('0x1'))['db'];var logger=require(_0x3af7('0x2'))(_0x3af7('0x3'));var config=require(_0x3af7('0x4'));config[_0x3af7('0x5')]=_[_0x3af7('0x6')](config[_0x3af7('0x5')],{'host':_0x3af7('0x7'),'port':0x18eb});var socket=require(_0x3af7('0x8'))(new Redis(config['redis']));require(_0x3af7('0x9'))['register'](socket);exports[_0x3af7('0xa')]=function(_0x414fb8){var _0x500e00=this;return new Promise(function(_0x3940ab,_0x4979c5){return db[_0x3af7('0xb')][_0x3af7('0xc')]({'raw':_0x414fb8['options']?_0x414fb8[_0x3af7('0xd')][_0x3af7('0xe')]===undefined?!![]:![]:!![],'where':_0x414fb8['options']?_0x414fb8[_0x3af7('0xd')][_0x3af7('0xf')]||null:null,'attributes':_0x414fb8[_0x3af7('0xd')]?_0x414fb8[_0x3af7('0xd')][_0x3af7('0x10')]||null:null,'limit':_0x414fb8['options']?_0x414fb8['options'][_0x3af7('0x11')]||null:null,'include':_0x414fb8['options']?_0x414fb8[_0x3af7('0xd')][_0x3af7('0x12')]?_['map'](_0x414fb8[_0x3af7('0xd')][_0x3af7('0x12')],function(_0x4685ee){return{'model':db[_0x4685ee['model']],'as':_0x4685ee['as'],'attributes':_0x4685ee[_0x3af7('0x10')],'include':_0x4685ee[_0x3af7('0x12')]?_[_0x3af7('0x13')](_0x4685ee[_0x3af7('0x12')],function(_0x2407e3){return{'model':db[_0x2407e3[_0x3af7('0x14')]],'as':_0x2407e3['as'],'attributes':_0x2407e3['attributes'],'include':_0x2407e3[_0x3af7('0x12')]?_[_0x3af7('0x13')](_0x2407e3[_0x3af7('0x12')],function(_0x3d4a27){return{'model':db[_0x3d4a27[_0x3af7('0x14')]],'as':_0x3d4a27['as'],'attributes':_0x3d4a27[_0x3af7('0x10')]};}):[]};}):[]};}):[]:[]})[_0x3af7('0x15')](function(_0x456f5f){logger['info'](_0x3af7('0xa'),_0x414fb8);logger[_0x3af7('0x16')](_0x3af7('0xa'),_0x414fb8,JSON[_0x3af7('0x17')](_0x456f5f));_0x3940ab(_0x456f5f);})['catch'](function(_0x41aa0d){logger[_0x3af7('0x18')]('GetSquareProjects',_0x41aa0d[_0x3af7('0x19')],_0x414fb8);_0x4979c5(_0x500e00[_0x3af7('0x18')](0x1f4,_0x41aa0d[_0x3af7('0x19')]));});});};exports['ShowSquareProject']=function(_0x154554){var _0x3a4a53=this;return new Promise(function(_0x309602,_0xda42d1){return db[_0x3af7('0xb')][_0x3af7('0x1a')]({'raw':_0x154554['options']?_0x154554[_0x3af7('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x154554[_0x3af7('0xd')]?_0x154554[_0x3af7('0xd')][_0x3af7('0xf')]||null:null,'attributes':_0x154554[_0x3af7('0xd')]?_0x154554[_0x3af7('0xd')][_0x3af7('0x10')]||null:null,'include':_0x154554[_0x3af7('0xd')]?_0x154554[_0x3af7('0xd')]['include']?_[_0x3af7('0x13')](_0x154554[_0x3af7('0xd')][_0x3af7('0x12')],function(_0x35da33){return{'model':db[_0x35da33[_0x3af7('0x14')]],'as':_0x35da33['as'],'attributes':_0x35da33[_0x3af7('0x10')],'include':_0x35da33['include']?_[_0x3af7('0x13')](_0x35da33['include'],function(_0x45915c){return{'model':db[_0x45915c[_0x3af7('0x14')]],'as':_0x45915c['as'],'attributes':_0x45915c[_0x3af7('0x10')],'include':_0x45915c['include']?_[_0x3af7('0x13')](_0x45915c[_0x3af7('0x12')],function(_0x857bfc){return{'model':db[_0x857bfc['model']],'as':_0x857bfc['as'],'attributes':_0x857bfc['attributes']};}):[]};}):[]};}):[]:[]})[_0x3af7('0x15')](function(_0x36ca9f){logger[_0x3af7('0x1b')](_0x3af7('0x1c'),_0x154554);logger[_0x3af7('0x16')]('ShowSquareProject',_0x154554,JSON[_0x3af7('0x17')](_0x36ca9f));_0x309602(_0x36ca9f);})[_0x3af7('0x1d')](function(_0xbc28f){logger[_0x3af7('0x18')](_0x3af7('0x1c'),_0xbc28f['message'],_0x154554);_0xda42d1(_0x3a4a53['error'](0x1f4,_0xbc28f[_0x3af7('0x19')]));});});}; \ No newline at end of file +var _0x0292=['raw','where','attributes','limit','map','include','model','stringify','error','message','ShowSquareProject','SquareProject','then','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','register','GetSquareProjects','findAll','options'];(function(_0x5144d5,_0x142832){var _0x3408e6=function(_0x5f0c87){while(--_0x5f0c87){_0x5144d5['push'](_0x5144d5['shift']());}};_0x3408e6(++_0x142832);}(_0x0292,0x16d));var _0x2029=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x0292[_0x510b98];return _0x45e775;};'use strict';var _=require(_0x2029('0x0'));var Redis=require(_0x2029('0x1'));var db=require(_0x2029('0x2'))['db'];var logger=require(_0x2029('0x3'))(_0x2029('0x4'));var config=require(_0x2029('0x5'));config[_0x2029('0x6')]=_[_0x2029('0x7')](config[_0x2029('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x2029('0x8'))(new Redis(config[_0x2029('0x6')]));require('./squareProject.socket')[_0x2029('0x9')](socket);exports[_0x2029('0xa')]=function(_0x1868ea){var _0x3a4a45=this;return new Promise(function(_0x1969cf,_0x3933ff){return db['SquareProject'][_0x2029('0xb')]({'raw':_0x1868ea[_0x2029('0xc')]?_0x1868ea[_0x2029('0xc')][_0x2029('0xd')]===undefined?!![]:![]:!![],'where':_0x1868ea[_0x2029('0xc')]?_0x1868ea[_0x2029('0xc')][_0x2029('0xe')]||null:null,'attributes':_0x1868ea['options']?_0x1868ea[_0x2029('0xc')][_0x2029('0xf')]||null:null,'limit':_0x1868ea[_0x2029('0xc')]?_0x1868ea['options'][_0x2029('0x10')]||null:null,'include':_0x1868ea[_0x2029('0xc')]?_0x1868ea[_0x2029('0xc')]['include']?_[_0x2029('0x11')](_0x1868ea[_0x2029('0xc')][_0x2029('0x12')],function(_0x2e4bb3){return{'model':db[_0x2e4bb3[_0x2029('0x13')]],'as':_0x2e4bb3['as'],'attributes':_0x2e4bb3[_0x2029('0xf')],'include':_0x2e4bb3[_0x2029('0x12')]?_[_0x2029('0x11')](_0x2e4bb3[_0x2029('0x12')],function(_0x10c605){return{'model':db[_0x10c605[_0x2029('0x13')]],'as':_0x10c605['as'],'attributes':_0x10c605['attributes'],'include':_0x10c605[_0x2029('0x12')]?_[_0x2029('0x11')](_0x10c605[_0x2029('0x12')],function(_0x2bcffe){return{'model':db[_0x2bcffe[_0x2029('0x13')]],'as':_0x2bcffe['as'],'attributes':_0x2bcffe[_0x2029('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46332f){logger['info']('GetSquareProjects',_0x1868ea);logger['debug'](_0x2029('0xa'),_0x1868ea,JSON[_0x2029('0x14')](_0x46332f));_0x1969cf(_0x46332f);})['catch'](function(_0x2c48c9){logger[_0x2029('0x15')](_0x2029('0xa'),_0x2c48c9[_0x2029('0x16')],_0x1868ea);_0x3933ff(_0x3a4a45[_0x2029('0x15')](0x1f4,_0x2c48c9[_0x2029('0x16')]));});});};exports[_0x2029('0x17')]=function(_0x1094fe){var _0x38a626=this;return new Promise(function(_0x5e35e1,_0x21bdd6){return db[_0x2029('0x18')]['find']({'raw':_0x1094fe[_0x2029('0xc')]?_0x1094fe['options']['raw']===undefined?!![]:![]:!![],'where':_0x1094fe[_0x2029('0xc')]?_0x1094fe[_0x2029('0xc')][_0x2029('0xe')]||null:null,'attributes':_0x1094fe['options']?_0x1094fe[_0x2029('0xc')]['attributes']||null:null,'include':_0x1094fe[_0x2029('0xc')]?_0x1094fe[_0x2029('0xc')][_0x2029('0x12')]?_['map'](_0x1094fe[_0x2029('0xc')][_0x2029('0x12')],function(_0x55580c){return{'model':db[_0x55580c[_0x2029('0x13')]],'as':_0x55580c['as'],'attributes':_0x55580c['attributes'],'include':_0x55580c['include']?_[_0x2029('0x11')](_0x55580c['include'],function(_0x401394){return{'model':db[_0x401394[_0x2029('0x13')]],'as':_0x401394['as'],'attributes':_0x401394[_0x2029('0xf')],'include':_0x401394['include']?_[_0x2029('0x11')](_0x401394[_0x2029('0x12')],function(_0x55cfb5){return{'model':db[_0x55cfb5[_0x2029('0x13')]],'as':_0x55cfb5['as'],'attributes':_0x55cfb5[_0x2029('0xf')]};}):[]};}):[]};}):[]:[]})[_0x2029('0x19')](function(_0xacc4bd){logger['info'](_0x2029('0x17'),_0x1094fe);logger['debug']('ShowSquareProject',_0x1094fe,JSON[_0x2029('0x14')](_0xacc4bd));_0x5e35e1(_0xacc4bd);})[_0x2029('0x1a')](function(_0x398ea7){logger[_0x2029('0x15')]('ShowSquareProject',_0x398ea7[_0x2029('0x16')],_0x1094fe);_0x21bdd6(_0x38a626[_0x2029('0x15')](0x1f4,_0x398ea7[_0x2029('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c7e25cd..4821e95 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 _0x5293=['removeListener','register','length','squareProject:','./squareProject.events','save','update'];(function(_0x3053ad,_0x5a4fd6){var _0xa14182=function(_0x406f32){while(--_0x406f32){_0x3053ad['push'](_0x3053ad['shift']());}};_0xa14182(++_0x5a4fd6);}(_0x5293,0xa5));var _0x3529=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x5293[_0x2fb87c];return _0x43038b;};'use strict';var SquareProjectEvents=require(_0x3529('0x0'));var events=[_0x3529('0x1'),'remove',_0x3529('0x2')];function createListener(_0x32bbc9,_0x37e4d2){return function(_0x72f726){_0x37e4d2['emit'](_0x32bbc9,_0x72f726);};}function removeListener(_0x21c8ee,_0x25c8e4){return function(){SquareProjectEvents[_0x3529('0x3')](_0x21c8ee,_0x25c8e4);};}exports[_0x3529('0x4')]=function(_0xfd3d14){for(var _0x544f9f=0x0,_0x5989a4=events[_0x3529('0x5')];_0x544f9f<_0x5989a4;_0x544f9f++){var _0x28f466=events[_0x544f9f];var _0x3c8627=createListener(_0x3529('0x6')+_0x28f466,_0xfd3d14);SquareProjectEvents['on'](_0x28f466,_0x3c8627);}}; \ No newline at end of file +var _0xf2c1=['./squareProject.events','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0xf2c1,0xc8));var _0x1f2c=function(_0x19bd6c,_0xebbbf1){_0x19bd6c=_0x19bd6c-0x0;var _0x179091=_0xf2c1[_0x19bd6c];return _0x179091;};'use strict';var SquareProjectEvents=require(_0x1f2c('0x0'));var events=['save',_0x1f2c('0x1'),_0x1f2c('0x2')];function createListener(_0x4702a8,_0x4fed28){return function(_0x50c009){_0x4fed28[_0x1f2c('0x3')](_0x4702a8,_0x50c009);};}function removeListener(_0x5a1bc8,_0x5c2fbd){return function(){SquareProjectEvents[_0x1f2c('0x4')](_0x5a1bc8,_0x5c2fbd);};}exports[_0x1f2c('0x5')]=function(_0xce023d){for(var _0x5c4178=0x0,_0x3b249f=events[_0x1f2c('0x6')];_0x5c4178<_0x3b249f;_0x5c4178++){var _0x504941=events[_0x5c4178];var _0x279eca=createListener(_0x1f2c('0x7')+_0x504941,_0xce023d);SquareProjectEvents['on'](_0x504941,_0x279eca);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 96157b9..3cfa047 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 _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(_0x4bebc9,_0x511263){var _0x995245=function(_0x56ba14){while(--_0x56ba14){_0x4bebc9['push'](_0x4bebc9['shift']());}};_0x995245(++_0x511263);}(_0xabce,0x103));var _0xeabc=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xabce[_0x3899d1];return _0xeb4a7d;};'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 +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x3406d4,_0x339fbb){var _0x2cdbc3=function(_0x3ced52){while(--_0x3ced52){_0x3406d4['push'](_0x3406d4['shift']());}};_0x2cdbc3(++_0x339fbb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0x5fc3[_0x1aed80];return _0x43961e;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 22e9868..61d7af0 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 _0x207c=['savePath','substring','exports','STRING','VIRTUAL','getDataValue'];(function(_0x48524d,_0x39cb0e){var _0x18a570=function(_0x4cc4e4){while(--_0x4cc4e4){_0x48524d['push'](_0x48524d['shift']());}};_0x18a570(++_0x39cb0e);}(_0x207c,0x1e8));var _0xc207=function(_0x10b4d3,_0x12e69b){_0x10b4d3=_0x10b4d3-0x0;var _0x12615b=_0x207c[_0x10b4d3];return _0x12615b;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'uniqueid':{'type':Sequelize[_0xc207('0x1')]},'callerid':{'type':Sequelize[_0xc207('0x1')]},'calleridname':{'type':Sequelize[_0xc207('0x1')]},'context':{'type':Sequelize[_0xc207('0x1')]},'extension':{'type':Sequelize[_0xc207('0x1')]},'priority':{'type':Sequelize[_0xc207('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc207('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xc207('0x1')]},'format':{'type':Sequelize[_0xc207('0x2')],'get':function(){var _0x3395e4='';var _0x59ff6f=this[_0xc207('0x3')](_0xc207('0x4'));if(_0x59ff6f){_0x3395e4=_0x59ff6f[_0xc207('0x5')](_0x59ff6f['lastIndexOf']('.'));}return _0x3395e4;}}}; \ No newline at end of file +var _0x207c=['savePath','substring','exports','STRING','VIRTUAL','getDataValue'];(function(_0x21210b,_0x4225ac){var _0x23ce2e=function(_0x340e34){while(--_0x340e34){_0x21210b['push'](_0x21210b['shift']());}};_0x23ce2e(++_0x4225ac);}(_0x207c,0x1e8));var _0xc207=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0x207c[_0x1ce9ea];return _0x2a95b9;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'uniqueid':{'type':Sequelize[_0xc207('0x1')]},'callerid':{'type':Sequelize[_0xc207('0x1')]},'calleridname':{'type':Sequelize[_0xc207('0x1')]},'context':{'type':Sequelize[_0xc207('0x1')]},'extension':{'type':Sequelize[_0xc207('0x1')]},'priority':{'type':Sequelize[_0xc207('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc207('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xc207('0x1')]},'format':{'type':Sequelize[_0xc207('0x2')],'get':function(){var _0x3395e4='';var _0x59ff6f=this[_0xc207('0x3')](_0xc207('0x4'));if(_0x59ff6f){_0x3395e4=_0x59ff6f[_0xc207('0x5')](_0x59ff6f['lastIndexOf']('.'));}return _0x3395e4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index dc148d5..cec8174 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 _0xc17f=['update','then','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','include','findAll','catch','show','params','includeAll','options','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','Content-Range','reject'];(function(_0x379944,_0x3f4787){var _0x404585=function(_0x277eb0){while(--_0x277eb0){_0x379944['push'](_0x379944['shift']());}};_0x404585(++_0x3f4787);}(_0xc17f,0xf9));var _0xfc17=function(_0x2e8c4c,_0x3738a7){_0x2e8c4c=_0x2e8c4c-0x0;var _0x567d65=_0xc17f[_0x2e8c4c];return _0x567d65;};'use strict';var emlformat=require(_0xfc17('0x0'));var rimraf=require(_0xfc17('0x1'));var zipdir=require(_0xfc17('0x2'));var jsonpatch=require(_0xfc17('0x3'));var rp=require(_0xfc17('0x4'));var moment=require(_0xfc17('0x5'));var BPromise=require(_0xfc17('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfc17('0x7'));var sox=require(_0xfc17('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc17('0x9'));var _=require(_0xfc17('0xa'));var squel=require(_0xfc17('0xb'));var crypto=require(_0xfc17('0xc'));var jsforce=require(_0xfc17('0xd'));var deskjs=require(_0xfc17('0xe'));var toCsv=require(_0xfc17('0xf'));var querystring=require(_0xfc17('0x10'));var Papa=require(_0xfc17('0x11'));var Redis=require(_0xfc17('0x12'));var authService=require(_0xfc17('0x13'));var qs=require(_0xfc17('0x14'));var as=require(_0xfc17('0x15'));var hardwareService=require(_0xfc17('0x16'));var logger=require(_0xfc17('0x17'))(_0xfc17('0x18'));var utils=require(_0xfc17('0x19'));var config=require(_0xfc17('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x569ab9,_0xcdfa26){_0xcdfa26=_0xcdfa26||0xcc;return function(_0x3d7f34){if(_0x3d7f34){return _0x569ab9[_0xfc17('0x1b')](_0xcdfa26);}return _0x569ab9[_0xfc17('0x1c')](_0xcdfa26)[_0xfc17('0x1d')]();};}function respondWithResult(_0x1ccfa1,_0x3a6c56){_0x3a6c56=_0x3a6c56||0xc8;return function(_0x39eebd){if(_0x39eebd){return _0x1ccfa1[_0xfc17('0x1c')](_0x3a6c56)['json'](_0x39eebd);}};}function respondWithFilteredResult(_0x5ccd5e,_0x2dd5bf){return function(_0x299903){if(_0x299903){var _0xd89627=typeof _0x2dd5bf['offset']===_0xfc17('0x1e')&&typeof _0x2dd5bf[_0xfc17('0x1f')]==='undefined';var _0x2d8961=_0x299903[_0xfc17('0x20')];var _0x9d4ccf=_0xd89627?0x0:_0x2dd5bf['offset'];var _0x23ed40=_0xd89627?_0x299903[_0xfc17('0x20')]:_0x2dd5bf[_0xfc17('0x21')]+_0x2dd5bf[_0xfc17('0x1f')];var _0x25c19a;if(_0x23ed40>=_0x2d8961){_0x23ed40=_0x2d8961;_0x25c19a=0xc8;}else{_0x25c19a=0xce;}_0x5ccd5e[_0xfc17('0x1c')](_0x25c19a);return _0x5ccd5e['set'](_0xfc17('0x22'),_0x9d4ccf+'-'+_0x23ed40+'/'+_0x2d8961)['json'](_0x299903);}return null;};}function patchUpdates(_0x46e63a){return function(_0xc07bb6){try{jsonpatch['apply'](_0xc07bb6,_0x46e63a,!![]);}catch(_0x388947){return BPromise[_0xfc17('0x23')](_0x388947);}return _0xc07bb6['save']();};}function saveUpdates(_0x354d7c,_0x2b131c){return function(_0x584fc8){if(_0x584fc8){return _0x584fc8[_0xfc17('0x24')](_0x354d7c)[_0xfc17('0x25')](function(_0x41f9ba){return _0x41f9ba;});}return null;};}function removeEntity(_0x541cd1,_0x49ba05){return function(_0x151cc5){if(_0x151cc5){return _0x151cc5[_0xfc17('0x26')]()[_0xfc17('0x25')](function(){_0x541cd1[_0xfc17('0x1c')](0xcc)[_0xfc17('0x1d')]();});}};}function handleEntityNotFound(_0x5eda55,_0x3737b8){return function(_0x2de9bd){if(!_0x2de9bd){_0x5eda55['sendStatus'](0x194);}return _0x2de9bd;};}function handleError(_0x334ba7,_0x3e99a8){_0x3e99a8=_0x3e99a8||0x1f4;return function(_0x2a5ec3){logger[_0xfc17('0x27')](_0x2a5ec3[_0xfc17('0x28')]);if(_0x2a5ec3['name']){delete _0x2a5ec3[_0xfc17('0x29')];}_0x334ba7['status'](_0x3e99a8)['send'](_0x2a5ec3);};}exports[_0xfc17('0x2a')]=function(_0x45bf7b,_0x3ede5f){var _0x1cabd0={},_0x58ed02={},_0xbe645a={'count':0x0,'rows':[]};var _0x5787e4=_[_0xfc17('0x2b')](db[_0xfc17('0x2c')][_0xfc17('0x2d')],function(_0x12f0d2){return{'name':_0x12f0d2['fieldName'],'type':_0x12f0d2[_0xfc17('0x2e')][_0xfc17('0x2f')]};});_0x58ed02['model']=_['map'](_0x5787e4,_0xfc17('0x29'));_0x58ed02[_0xfc17('0x30')]=_[_0xfc17('0x31')](_0x45bf7b[_0xfc17('0x30')]);_0x58ed02[_0xfc17('0x32')]=_[_0xfc17('0x33')](_0x58ed02[_0xfc17('0x34')],_0x58ed02[_0xfc17('0x30')]);_0x1cabd0[_0xfc17('0x35')]=_[_0xfc17('0x33')](_0x58ed02[_0xfc17('0x34')],qs[_0xfc17('0x36')](_0x45bf7b[_0xfc17('0x30')][_0xfc17('0x36')]));_0x1cabd0[_0xfc17('0x35')]=_0x1cabd0[_0xfc17('0x35')][_0xfc17('0x37')]?_0x1cabd0['attributes']:_0x58ed02[_0xfc17('0x34')];if(!_0x45bf7b[_0xfc17('0x30')][_0xfc17('0x38')](_0xfc17('0x39'))){_0x1cabd0[_0xfc17('0x1f')]=qs[_0xfc17('0x1f')](_0x45bf7b[_0xfc17('0x30')][_0xfc17('0x1f')]);_0x1cabd0['offset']=qs[_0xfc17('0x21')](_0x45bf7b[_0xfc17('0x30')][_0xfc17('0x21')]);}_0x1cabd0['order']=qs[_0xfc17('0x3a')](_0x45bf7b[_0xfc17('0x30')][_0xfc17('0x3a')]);_0x1cabd0[_0xfc17('0x3b')]=qs[_0xfc17('0x32')](_[_0xfc17('0x3c')](_0x45bf7b[_0xfc17('0x30')],_0x58ed02[_0xfc17('0x32')]),_0x5787e4);if(_0x45bf7b[_0xfc17('0x30')]['filter']){_0x1cabd0[_0xfc17('0x3b')]=_['merge'](_0x1cabd0[_0xfc17('0x3b')],{'$or':_['map'](_0x5787e4,function(_0x59a78a){if(_0x59a78a[_0xfc17('0x2e')]!==_0xfc17('0x3d')){var _0x1ab15e={};_0x1ab15e[_0x59a78a['name']]={'$like':'%'+_0x45bf7b[_0xfc17('0x30')][_0xfc17('0x3e')]+'%'};return _0x1ab15e;}})});}_0x1cabd0=_[_0xfc17('0x3f')]({},_0x1cabd0,_0x45bf7b['options']);var _0x527da9={'where':_0x1cabd0['where']};return db[_0xfc17('0x2c')]['count'](_0x527da9)[_0xfc17('0x25')](function(_0x1f8249){_0xbe645a['count']=_0x1f8249;if(_0x45bf7b[_0xfc17('0x30')]['includeAll']){_0x1cabd0[_0xfc17('0x40')]=[{'all':!![]}];}return db[_0xfc17('0x2c')][_0xfc17('0x41')](_0x1cabd0);})[_0xfc17('0x25')](function(_0x1beb38){_0xbe645a['rows']=_0x1beb38;return _0xbe645a;})['then'](respondWithFilteredResult(_0x3ede5f,_0x1cabd0))[_0xfc17('0x42')](handleError(_0x3ede5f,null));};exports[_0xfc17('0x43')]=function(_0x3db54d,_0x27527a){var _0x16f510={'raw':!![],'where':{'id':_0x3db54d[_0xfc17('0x44')]['id']}},_0x36f83e={};_0x36f83e[_0xfc17('0x34')]=_['keys'](db[_0xfc17('0x2c')][_0xfc17('0x2d')]);_0x36f83e['query']=_[_0xfc17('0x31')](_0x3db54d[_0xfc17('0x30')]);_0x36f83e[_0xfc17('0x32')]=_[_0xfc17('0x33')](_0x36f83e['model'],_0x36f83e[_0xfc17('0x30')]);_0x16f510[_0xfc17('0x35')]=_['intersection'](_0x36f83e[_0xfc17('0x34')],qs[_0xfc17('0x36')](_0x3db54d[_0xfc17('0x30')][_0xfc17('0x36')]));_0x16f510['attributes']=_0x16f510[_0xfc17('0x35')][_0xfc17('0x37')]?_0x16f510[_0xfc17('0x35')]:_0x36f83e['model'];if(_0x3db54d[_0xfc17('0x30')][_0xfc17('0x45')]){_0x16f510[_0xfc17('0x40')]=[{'all':!![]}];}_0x16f510=_[_0xfc17('0x3f')]({},_0x16f510,_0x3db54d[_0xfc17('0x46')]);return db[_0xfc17('0x2c')]['find'](_0x16f510)[_0xfc17('0x25')](handleEntityNotFound(_0x27527a,null))[_0xfc17('0x25')](respondWithResult(_0x27527a,null))[_0xfc17('0x42')](handleError(_0x27527a,null));};exports[_0xfc17('0x47')]=function(_0xd7abef,_0x2fd3f5){return db['SquareRecording'][_0xfc17('0x47')](_0xd7abef[_0xfc17('0x48')],{})[_0xfc17('0x25')](respondWithResult(_0x2fd3f5,0xc9))[_0xfc17('0x42')](handleError(_0x2fd3f5,null));};exports[_0xfc17('0x24')]=function(_0x4fed8f,_0x54ea61){if(_0x4fed8f['body']['id']){delete _0x4fed8f[_0xfc17('0x48')]['id'];}return db[_0xfc17('0x2c')][_0xfc17('0x49')]({'where':{'id':_0x4fed8f['params']['id']}})[_0xfc17('0x25')](handleEntityNotFound(_0x54ea61,null))[_0xfc17('0x25')](saveUpdates(_0x4fed8f[_0xfc17('0x48')],null))[_0xfc17('0x25')](respondWithResult(_0x54ea61,null))['catch'](handleError(_0x54ea61,null));};exports[_0xfc17('0x4a')]=function(_0x192e29,_0x235ed6,_0x14f961){var _0x822e1e=require(_0xfc17('0x4b'));var _0x441e86=![];var _0x55f727={};if(_0x192e29['query']['type']&&_0x192e29[_0xfc17('0x30')][_0xfc17('0x2e')]===_0xfc17('0x4c')){_0x55f727[_0xfc17('0x4c')]=_0x192e29['params']['id'];}else{_0x55f727['id']=_0x192e29[_0xfc17('0x44')]['id'];}return db[_0xfc17('0x2c')][_0xfc17('0x49')]({'where':_0x55f727,'attributes':['id',_0xfc17('0x4d'),_0xfc17('0x4e')],'raw':!![]})[_0xfc17('0x25')](handleEntityNotFound(_0x235ed6,null))[_0xfc17('0x25')](function(_0x193697){if(_0x193697){var _0x1ca57e=_0x193697[_0xfc17('0x4d')];var _0x59b1a9=util['format'](_0xfc17('0x4f'),_0x1ca57e);if(fs[_0xfc17('0x50')](_0x59b1a9)){_0x441e86=!![];return _0x822e1e['decryptFile'](_0x59b1a9,_0x1ca57e,config[_0xfc17('0x51')]['recording'])['then'](function(){return _0x193697;});}return _0x193697;}})['then'](function(_0x45bbe6){if(_0x45bbe6){var _0x4883e3=_0x45bbe6[_0xfc17('0x4d')];if(!fs[_0xfc17('0x50')](_0x4883e3)){throw new db[(_0xfc17('0x52'))][(_0xfc17('0x53'))](_0xfc17('0x54'));}if(_0x45bbe6['filename']){return _0x235ed6['download'](_0x4883e3,_0x45bbe6[_0xfc17('0x4e')]+path[_0xfc17('0x55')](_0x4883e3),function(){if(_0x441e86){fs[_0xfc17('0x56')](_0x4883e3);}});}else{return _0x235ed6[_0xfc17('0x4a')](_0x4883e3,function(_0x49c9ee){if(_0x441e86){fs[_0xfc17('0x56')](_0x4883e3);}});}}})[_0xfc17('0x42')](function(_0x2b3a2e){if(_0x2b3a2e['message']===_0xfc17('0x54')){_0x235ed6['status'](0x194)[_0xfc17('0x57')]('Not\x20found');}else{return handleError(_0x235ed6,null);}});};exports[_0xfc17('0x26')]=function(_0xbcfeac,_0x121744){return db['SquareRecording'][_0xfc17('0x49')]({'where':{'id':_0xbcfeac[_0xfc17('0x44')]['id']}})['then'](function(_0x1eef0e){if(_['isNil'](_0x1eef0e)){throw new ReferenceError(_0xfc17('0x58'));}return _0x1eef0e;})['then'](function(_0x1b78f7){var _0x3c74c2=_0x1b78f7[_0xfc17('0x4d')];logger[_0xfc17('0x59')](_0xfc17('0x5a'),_0x3c74c2);if(!_[_0xfc17('0x5b')](_0x1b78f7['savePath'])&&fs[_0xfc17('0x50')](_0x3c74c2)){logger[_0xfc17('0x59')](_0xfc17('0x5c')+_0x3c74c2+_0xfc17('0x5d'));fs['unlinkSync'](_0x3c74c2);}_0x3c74c2=_0x3c74c2+'.cypher';if(!_[_0xfc17('0x5b')](_0x1b78f7[_0xfc17('0x4d')])&&fs[_0xfc17('0x50')](_0x3c74c2)){logger[_0xfc17('0x59')](_0xfc17('0x5c')+_0x3c74c2+_0xfc17('0x5d'));fs[_0xfc17('0x5e')](_0x3c74c2);}return _0x1b78f7;})[_0xfc17('0x25')](function(_0x319e9e){if(!_0x319e9e)throw new InternalError();return _0x319e9e[_0xfc17('0x26')]();})['then'](function(){_0x121744[_0xfc17('0x1c')](0xcc)[_0xfc17('0x1d')]();})[_0xfc17('0x42')](handleError(_0x121744,null));}; \ No newline at end of file +var _0x70a4=['VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','reject','then','error','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3df5c1,_0x17c1f4){var _0x11b0e2=function(_0xdb118){while(--_0xdb118){_0x3df5c1['push'](_0x3df5c1['shift']());}};_0x11b0e2(++_0x17c1f4);}(_0x70a4,0x1a2));var _0x470a=function(_0x10dd4a,_0x27271f){_0x10dd4a=_0x10dd4a-0x0;var _0x556311=_0x70a4[_0x10dd4a];return _0x556311;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x470a('0x0'));var zipdir=require(_0x470a('0x1'));var jsonpatch=require(_0x470a('0x2'));var rp=require('request-promise');var moment=require(_0x470a('0x3'));var BPromise=require(_0x470a('0x4'));var Mustache=require('mustache');var util=require(_0x470a('0x5'));var path=require('path');var sox=require(_0x470a('0x6'));var csv=require(_0x470a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x470a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x470a('0x9'));var jsforce=require(_0x470a('0xa'));var deskjs=require(_0x470a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x470a('0xc'));var Papa=require(_0x470a('0xd'));var Redis=require(_0x470a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x470a('0xf'));var as=require(_0x470a('0x10'));var hardwareService=require(_0x470a('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x470a('0x12'));var licenseUtil=require(_0x470a('0x13'));var db=require(_0x470a('0x14'))['db'];function respondWithStatusCode(_0x413ce0,_0x5ad10){_0x5ad10=_0x5ad10||0xcc;return function(_0x3acadf){if(_0x3acadf){return _0x413ce0[_0x470a('0x15')](_0x5ad10);}return _0x413ce0['status'](_0x5ad10)[_0x470a('0x16')]();};}function respondWithResult(_0x55f56c,_0x39d137){_0x39d137=_0x39d137||0xc8;return function(_0x41f11b){if(_0x41f11b){return _0x55f56c[_0x470a('0x17')](_0x39d137)['json'](_0x41f11b);}};}function respondWithFilteredResult(_0x33ccd6,_0xccf210){return function(_0x323d54){if(_0x323d54){var _0x3ddc10=typeof _0xccf210[_0x470a('0x18')]===_0x470a('0x19')&&typeof _0xccf210['limit']===_0x470a('0x19');var _0x5022c3=_0x323d54[_0x470a('0x1a')];var _0x570122=_0x3ddc10?0x0:_0xccf210['offset'];var _0x27f30d=_0x3ddc10?_0x323d54['count']:_0xccf210['offset']+_0xccf210[_0x470a('0x1b')];var _0x92cecb;if(_0x27f30d>=_0x5022c3){_0x27f30d=_0x5022c3;_0x92cecb=0xc8;}else{_0x92cecb=0xce;}_0x33ccd6['status'](_0x92cecb);return _0x33ccd6[_0x470a('0x1c')]('Content-Range',_0x570122+'-'+_0x27f30d+'/'+_0x5022c3)[_0x470a('0x1d')](_0x323d54);}return null;};}function patchUpdates(_0x3d5446){return function(_0x5f0d6e){try{jsonpatch['apply'](_0x5f0d6e,_0x3d5446,!![]);}catch(_0x2d00f0){return BPromise[_0x470a('0x1e')](_0x2d00f0);}return _0x5f0d6e['save']();};}function saveUpdates(_0x454ac5,_0x2a68a6){return function(_0x31458d){if(_0x31458d){return _0x31458d['update'](_0x454ac5)[_0x470a('0x1f')](function(_0xaf0f13){return _0xaf0f13;});}return null;};}function removeEntity(_0x3e6e16,_0x4dbbd1){return function(_0x5aa798){if(_0x5aa798){return _0x5aa798['destroy']()[_0x470a('0x1f')](function(){_0x3e6e16[_0x470a('0x17')](0xcc)[_0x470a('0x16')]();});}};}function handleEntityNotFound(_0xad4fb7,_0x57e202){return function(_0x3e8dd3){if(!_0x3e8dd3){_0xad4fb7[_0x470a('0x15')](0x194);}return _0x3e8dd3;};}function handleError(_0x20be7b,_0x36c232){_0x36c232=_0x36c232||0x1f4;return function(_0xa9af15){logger[_0x470a('0x20')](_0xa9af15[_0x470a('0x21')]);if(_0xa9af15[_0x470a('0x22')]){delete _0xa9af15[_0x470a('0x22')];}_0x20be7b[_0x470a('0x17')](_0x36c232)[_0x470a('0x23')](_0xa9af15);};}exports['index']=function(_0x4ead84,_0x5520ea){var _0x437ce9={},_0xe98f6e={},_0x29a187={'count':0x0,'rows':[]};var _0x502a84=_['map'](db[_0x470a('0x24')][_0x470a('0x25')],function(_0x5b2f13){return{'name':_0x5b2f13[_0x470a('0x26')],'type':_0x5b2f13[_0x470a('0x27')][_0x470a('0x28')]};});_0xe98f6e[_0x470a('0x29')]=_[_0x470a('0x2a')](_0x502a84,_0x470a('0x22'));_0xe98f6e['query']=_['keys'](_0x4ead84[_0x470a('0x2b')]);_0xe98f6e[_0x470a('0x2c')]=_[_0x470a('0x2d')](_0xe98f6e[_0x470a('0x29')],_0xe98f6e[_0x470a('0x2b')]);_0x437ce9[_0x470a('0x2e')]=_['intersection'](_0xe98f6e[_0x470a('0x29')],qs[_0x470a('0x2f')](_0x4ead84[_0x470a('0x2b')][_0x470a('0x2f')]));_0x437ce9['attributes']=_0x437ce9[_0x470a('0x2e')][_0x470a('0x30')]?_0x437ce9[_0x470a('0x2e')]:_0xe98f6e[_0x470a('0x29')];if(!_0x4ead84[_0x470a('0x2b')][_0x470a('0x31')](_0x470a('0x32'))){_0x437ce9['limit']=qs[_0x470a('0x1b')](_0x4ead84[_0x470a('0x2b')][_0x470a('0x1b')]);_0x437ce9[_0x470a('0x18')]=qs['offset'](_0x4ead84[_0x470a('0x2b')][_0x470a('0x18')]);}_0x437ce9[_0x470a('0x33')]=qs[_0x470a('0x34')](_0x4ead84['query'][_0x470a('0x34')]);_0x437ce9[_0x470a('0x35')]=qs[_0x470a('0x2c')](_[_0x470a('0x36')](_0x4ead84[_0x470a('0x2b')],_0xe98f6e[_0x470a('0x2c')]),_0x502a84);if(_0x4ead84[_0x470a('0x2b')][_0x470a('0x37')]){_0x437ce9[_0x470a('0x35')]=_[_0x470a('0x38')](_0x437ce9[_0x470a('0x35')],{'$or':_[_0x470a('0x2a')](_0x502a84,function(_0x2bddd7){if(_0x2bddd7[_0x470a('0x27')]!==_0x470a('0x39')){var _0x31f8b5={};_0x31f8b5[_0x2bddd7['name']]={'$like':'%'+_0x4ead84[_0x470a('0x2b')]['filter']+'%'};return _0x31f8b5;}})});}_0x437ce9=_['merge']({},_0x437ce9,_0x4ead84['options']);var _0x57b515={'where':_0x437ce9['where']};return db['SquareRecording']['count'](_0x57b515)[_0x470a('0x1f')](function(_0x21c0fb){_0x29a187[_0x470a('0x1a')]=_0x21c0fb;if(_0x4ead84[_0x470a('0x2b')][_0x470a('0x3a')]){_0x437ce9['include']=[{'all':!![]}];}return db['SquareRecording'][_0x470a('0x3b')](_0x437ce9);})[_0x470a('0x1f')](function(_0x142696){_0x29a187[_0x470a('0x3c')]=_0x142696;return _0x29a187;})[_0x470a('0x1f')](respondWithFilteredResult(_0x5520ea,_0x437ce9))[_0x470a('0x3d')](handleError(_0x5520ea,null));};exports[_0x470a('0x3e')]=function(_0x283185,_0x341925){var _0x369f7f={'raw':!![],'where':{'id':_0x283185[_0x470a('0x3f')]['id']}},_0x8f3d99={};_0x8f3d99[_0x470a('0x29')]=_[_0x470a('0x40')](db[_0x470a('0x24')]['rawAttributes']);_0x8f3d99['query']=_['keys'](_0x283185['query']);_0x8f3d99[_0x470a('0x2c')]=_[_0x470a('0x2d')](_0x8f3d99['model'],_0x8f3d99[_0x470a('0x2b')]);_0x369f7f[_0x470a('0x2e')]=_[_0x470a('0x2d')](_0x8f3d99[_0x470a('0x29')],qs['fields'](_0x283185['query'][_0x470a('0x2f')]));_0x369f7f[_0x470a('0x2e')]=_0x369f7f[_0x470a('0x2e')][_0x470a('0x30')]?_0x369f7f[_0x470a('0x2e')]:_0x8f3d99['model'];if(_0x283185[_0x470a('0x2b')][_0x470a('0x3a')]){_0x369f7f['include']=[{'all':!![]}];}_0x369f7f=_[_0x470a('0x38')]({},_0x369f7f,_0x283185[_0x470a('0x41')]);return db[_0x470a('0x24')][_0x470a('0x42')](_0x369f7f)[_0x470a('0x1f')](handleEntityNotFound(_0x341925,null))[_0x470a('0x1f')](respondWithResult(_0x341925,null))['catch'](handleError(_0x341925,null));};exports[_0x470a('0x43')]=function(_0x2c5265,_0x2ce5d2){return db[_0x470a('0x24')][_0x470a('0x43')](_0x2c5265['body'],{})[_0x470a('0x1f')](respondWithResult(_0x2ce5d2,0xc9))['catch'](handleError(_0x2ce5d2,null));};exports['update']=function(_0x3024aa,_0x5dec5c){if(_0x3024aa[_0x470a('0x44')]['id']){delete _0x3024aa[_0x470a('0x44')]['id'];}return db[_0x470a('0x24')][_0x470a('0x42')]({'where':{'id':_0x3024aa[_0x470a('0x3f')]['id']}})[_0x470a('0x1f')](handleEntityNotFound(_0x5dec5c,null))[_0x470a('0x1f')](saveUpdates(_0x3024aa['body'],null))[_0x470a('0x1f')](respondWithResult(_0x5dec5c,null))[_0x470a('0x3d')](handleError(_0x5dec5c,null));};exports[_0x470a('0x45')]=function(_0x41c85f,_0x58fe47,_0x13d63c){var _0x27c9c2=require(_0x470a('0x46'));var _0xcbce61=![];var _0x55fa70={};if(_0x41c85f[_0x470a('0x2b')][_0x470a('0x27')]&&_0x41c85f[_0x470a('0x2b')]['type']===_0x470a('0x47')){_0x55fa70[_0x470a('0x47')]=_0x41c85f[_0x470a('0x3f')]['id'];}else{_0x55fa70['id']=_0x41c85f[_0x470a('0x3f')]['id'];}return db[_0x470a('0x24')]['find']({'where':_0x55fa70,'attributes':['id',_0x470a('0x48'),_0x470a('0x49')],'raw':!![]})[_0x470a('0x1f')](handleEntityNotFound(_0x58fe47,null))[_0x470a('0x1f')](function(_0x3572ae){if(_0x3572ae){var _0x442717=_0x3572ae[_0x470a('0x48')];var _0xa1c1b9=util[_0x470a('0x4a')](_0x470a('0x4b'),_0x442717);if(fs[_0x470a('0x4c')](_0xa1c1b9)){_0xcbce61=!![];return _0x27c9c2[_0x470a('0x4d')](_0xa1c1b9,_0x442717,config['secrets'][_0x470a('0x4e')])['then'](function(){return _0x3572ae;});}return _0x3572ae;}})[_0x470a('0x1f')](function(_0x1b513c){if(_0x1b513c){var _0x44441a=_0x1b513c[_0x470a('0x48')];if(!fs[_0x470a('0x4c')](_0x44441a)){throw new db[(_0x470a('0x4f'))][(_0x470a('0x50'))](_0x470a('0x51'));}if(_0x1b513c[_0x470a('0x49')]){return _0x58fe47[_0x470a('0x45')](_0x44441a,_0x1b513c['filename']+path[_0x470a('0x52')](_0x44441a),function(){if(_0xcbce61){fs['unlink'](_0x44441a);}});}else{return _0x58fe47[_0x470a('0x45')](_0x44441a,function(_0x1bc826){if(_0xcbce61){fs[_0x470a('0x53')](_0x44441a);}});}}})[_0x470a('0x3d')](function(_0x4728f9){if(_0x4728f9[_0x470a('0x54')]===_0x470a('0x51')){_0x58fe47['status'](0x194)['send'](_0x470a('0x55'));}else{return handleError(_0x58fe47,null);}});};exports[_0x470a('0x56')]=function(_0x178091,_0x4b8772){return db[_0x470a('0x24')]['find']({'where':{'id':_0x178091[_0x470a('0x3f')]['id']}})['then'](function(_0x4f506a){if(_[_0x470a('0x57')](_0x4f506a)){throw new ReferenceError(_0x470a('0x58'));}return _0x4f506a;})['then'](function(_0x51a905){var _0x2ce07d=_0x51a905[_0x470a('0x48')];logger[_0x470a('0x59')](_0x470a('0x5a'),_0x2ce07d);if(!_['isNil'](_0x51a905['savePath'])&&fs['existsSync'](_0x2ce07d)){logger[_0x470a('0x59')](_0x470a('0x5b')+_0x2ce07d+_0x470a('0x5c'));fs[_0x470a('0x5d')](_0x2ce07d);}_0x2ce07d=_0x2ce07d+_0x470a('0x5e');if(!_[_0x470a('0x57')](_0x51a905['savePath'])&&fs[_0x470a('0x4c')](_0x2ce07d)){logger[_0x470a('0x59')](_0x470a('0x5b')+_0x2ce07d+_0x470a('0x5c'));fs['unlinkSync'](_0x2ce07d);}return _0x51a905;})['then'](function(_0x234752){if(!_0x234752)throw new InternalError();return _0x234752[_0x470a('0x56')]();})[_0x470a('0x1f')](function(){_0x4b8772[_0x470a('0x17')](0xcc)['end']();})['catch'](handleError(_0x4b8772,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 498653f..51317cd 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 _0x34f0=['request-promise','path','rimraf','../../config/environment','exports','define','square_recordings','lodash','util','api','bluebird'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x34f0,0x13b));var _0x034f=function(_0x399d2d,_0x125485){_0x399d2d=_0x399d2d-0x0;var _0x54b72e=_0x34f0[_0x399d2d];return _0x54b72e;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var logger=require('../../config/logger')(_0x034f('0x2'));var moment=require('moment');var BPromise=require(_0x034f('0x3'));var rp=require(_0x034f('0x4'));var fs=require('fs');var path=require(_0x034f('0x5'));var rimraf=require(_0x034f('0x6'));var config=require(_0x034f('0x7'));var attributes=require('./squareRecording.attributes');module[_0x034f('0x8')]=function(_0x1fd628,_0x4f349b){return _0x1fd628[_0x034f('0x9')]('SquareRecording',attributes,{'tableName':_0x034f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ce=['square_recordings','util','../../config/logger','api','moment','bluebird','request-promise','./squareRecording.attributes','define','SquareRecording'];(function(_0x32a348,_0x264811){var _0x29bd48=function(_0x537485){while(--_0x537485){_0x32a348['push'](_0x32a348['shift']());}};_0x29bd48(++_0x264811);}(_0x16ce,0xfb));var _0xe16c=function(_0x4a8583,_0x3e79cb){_0x4a8583=_0x4a8583-0x0;var _0x40b904=_0x16ce[_0x4a8583];return _0x40b904;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var logger=require(_0xe16c('0x1'))(_0xe16c('0x2'));var moment=require(_0xe16c('0x3'));var BPromise=require(_0xe16c('0x4'));var rp=require(_0xe16c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe16c('0x6'));module['exports']=function(_0x1707f9,_0x13ee4a){return _0x1707f9[_0xe16c('0x7')](_0xe16c('0x8'),attributes,{'tableName':_0xe16c('0x9'),'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 fae7ee2..04caed5 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 _0x9615=['http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0x9615,0xae));var _0x5961=function(_0x257ffc,_0x36a43f){_0x257ffc=_0x257ffc-0x0;var _0x4a03b2=_0x9615[_0x257ffc];return _0x4a03b2;};'use strict';var _=require(_0x5961('0x0'));var util=require(_0x5961('0x1'));var moment=require(_0x5961('0x2'));var BPromise=require('bluebird');var rs=require(_0x5961('0x3'));var fs=require('fs');var Redis=require(_0x5961('0x4'));var db=require(_0x5961('0x5'))['db'];var utils=require(_0x5961('0x6'));var logger=require(_0x5961('0x7'))(_0x5961('0x8'));var config=require(_0x5961('0x9'));var jayson=require(_0x5961('0xa'));var client=jayson[_0x5961('0xb')][_0x5961('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cab02,_0x856442,_0x123568){return new BPromise(function(_0x4d6046,_0x54e471){return client[_0x5961('0xd')](_0x2cab02,_0x123568)[_0x5961('0xe')](function(_0x55b06e){logger[_0x5961('0xf')](_0x5961('0x10'),_0x856442,'request\x20sent');logger[_0x5961('0x11')](_0x5961('0x12'),_0x856442,_0x5961('0x13'),JSON[_0x5961('0x14')](_0x55b06e));if(_0x55b06e[_0x5961('0x15')]){if(_0x55b06e[_0x5961('0x15')][_0x5961('0x16')]===0x1f4){logger[_0x5961('0x15')](_0x5961('0x10'),_0x856442,_0x55b06e['error'][_0x5961('0x17')]);return _0x54e471(_0x55b06e[_0x5961('0x15')][_0x5961('0x17')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x856442,_0x55b06e[_0x5961('0x15')][_0x5961('0x17')]);return _0x4d6046(_0x55b06e[_0x5961('0x15')][_0x5961('0x17')]);}else{logger[_0x5961('0xf')](_0x5961('0x10'),_0x856442,_0x5961('0x13'));_0x4d6046(_0x55b06e[_0x5961('0x18')][_0x5961('0x17')]);}})[_0x5961('0x19')](function(_0x4e2a5f){logger[_0x5961('0x15')](_0x5961('0x10'),_0x856442,_0x4e2a5f);_0x54e471(_0x4e2a5f);});});}exports[_0x5961('0x1a')]=function(_0x4392df){var _0x5b18ed=this;return new Promise(function(_0x4f342c,_0x1d2c7a){return db['SquareRecording'][_0x5961('0x1b')](_0x4392df[_0x5961('0x1c')],{'raw':_0x4392df[_0x5961('0x1d')]?_0x4392df[_0x5961('0x1d')][_0x5961('0x1e')]===undefined?!![]:![]:!![]})[_0x5961('0xe')](function(_0x4db9c9){logger[_0x5961('0xf')](_0x5961('0x1a'),_0x4392df);logger[_0x5961('0x11')](_0x5961('0x1a'),_0x4392df,JSON[_0x5961('0x14')](_0x4db9c9));_0x4f342c(_0x4db9c9);})['catch'](function(_0x15bd54){logger[_0x5961('0x15')](_0x5961('0x1a'),_0x15bd54[_0x5961('0x17')],_0x4392df);_0x1d2c7a(_0x5b18ed[_0x5961('0x15')](0x1f4,_0x15bd54[_0x5961('0x17')]));});});}; \ No newline at end of file +var _0xb4b9=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2d62ae,_0x620706){var _0x5623b7=function(_0x5e1fdb){while(--_0x5e1fdb){_0x2d62ae['push'](_0x2d62ae['shift']());}};_0x5623b7(++_0x620706);}(_0xb4b9,0x14c));var _0x9b4b=function(_0x5927bb,_0x17b912){_0x5927bb=_0x5927bb-0x0;var _0x276b61=_0xb4b9[_0x5927bb];return _0x276b61;};'use strict';var _=require('lodash');var util=require(_0x9b4b('0x0'));var moment=require(_0x9b4b('0x1'));var BPromise=require(_0x9b4b('0x2'));var rs=require(_0x9b4b('0x3'));var fs=require('fs');var Redis=require(_0x9b4b('0x4'));var db=require(_0x9b4b('0x5'))['db'];var utils=require(_0x9b4b('0x6'));var logger=require(_0x9b4b('0x7'))(_0x9b4b('0x8'));var config=require(_0x9b4b('0x9'));var jayson=require(_0x9b4b('0xa'));var client=jayson[_0x9b4b('0xb')][_0x9b4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56eb35,_0x5e3c54,_0x57c593){return new BPromise(function(_0x58b591,_0x151337){return client[_0x9b4b('0xd')](_0x56eb35,_0x57c593)[_0x9b4b('0xe')](function(_0xabea20){logger[_0x9b4b('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5e3c54,_0x9b4b('0x10'));logger[_0x9b4b('0x11')](_0x9b4b('0x12'),_0x5e3c54,_0x9b4b('0x10'),JSON[_0x9b4b('0x13')](_0xabea20));if(_0xabea20[_0x9b4b('0x14')]){if(_0xabea20[_0x9b4b('0x14')]['code']===0x1f4){logger[_0x9b4b('0x14')](_0x9b4b('0x15'),_0x5e3c54,_0xabea20[_0x9b4b('0x14')]['message']);return _0x151337(_0xabea20[_0x9b4b('0x14')][_0x9b4b('0x16')]);}logger[_0x9b4b('0x14')]('SquareRecording,\x20%s,\x20%s',_0x5e3c54,_0xabea20[_0x9b4b('0x14')][_0x9b4b('0x16')]);return _0x58b591(_0xabea20[_0x9b4b('0x14')][_0x9b4b('0x16')]);}else{logger[_0x9b4b('0xf')](_0x9b4b('0x15'),_0x5e3c54,_0x9b4b('0x10'));_0x58b591(_0xabea20['result'][_0x9b4b('0x16')]);}})[_0x9b4b('0x17')](function(_0x2867b9){logger[_0x9b4b('0x14')](_0x9b4b('0x15'),_0x5e3c54,_0x2867b9);_0x151337(_0x2867b9);});});}exports[_0x9b4b('0x18')]=function(_0x5d6417){var _0x1ae623=this;return new Promise(function(_0x57e3c0,_0x51dc6b){return db['SquareRecording'][_0x9b4b('0x19')](_0x5d6417[_0x9b4b('0x1a')],{'raw':_0x5d6417['options']?_0x5d6417[_0x9b4b('0x1b')][_0x9b4b('0x1c')]===undefined?!![]:![]:!![]})[_0x9b4b('0xe')](function(_0x52af59){logger[_0x9b4b('0xf')](_0x9b4b('0x18'),_0x5d6417);logger[_0x9b4b('0x11')](_0x9b4b('0x18'),_0x5d6417,JSON[_0x9b4b('0x13')](_0x52af59));_0x57e3c0(_0x52af59);})[_0x9b4b('0x17')](function(_0x2e5066){logger[_0x9b4b('0x14')](_0x9b4b('0x18'),_0x2e5066[_0x9b4b('0x16')],_0x5d6417);_0x51dc6b(_0x1ae623[_0x9b4b('0x14')](0x1f4,_0x2e5066[_0x9b4b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 45b2304..155da10 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x5b1e3b,_0x18e4cf){var _0x575cff=function(_0x1ea755){while(--_0x1ea755){_0x5b1e3b['push'](_0x5b1e3b['shift']());}};_0x575cff(++_0x18e4cf);}(_0xe706,0xa3));var _0x6e70=function(_0x25ea25,_0x1e6541){_0x25ea25=_0x25ea25-0x0;var _0x150ba9=_0xe706[_0x25ea25];return _0x150ba9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x195699,_0x37db02){var _0x32d906=function(_0x2f1fa1){while(--_0x2f1fa1){_0x195699['push'](_0x195699['shift']());}};_0x32d906(++_0x37db02);}(_0xe706,0xa3));var _0x6e70=function(_0x3722b3,_0x18a764){_0x3722b3=_0x3722b3-0x0;var _0x4614ae=_0xe706[_0x3722b3];return _0x4614ae;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 75b9d9c..f9df67b 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 _0xafde=['DATE','sequelize','STRING'];(function(_0x490558,_0x287d0c){var _0x4a8d3a=function(_0x282448){while(--_0x282448){_0x490558['push'](_0x490558['shift']());}};_0x4a8d3a(++_0x287d0c);}(_0xafde,0x151));var _0xeafd=function(_0x22efa0,_0x421401){_0x22efa0=_0x22efa0-0x0;var _0x165717=_0xafde[_0x22efa0];return _0x165717;};'use strict';var Sequelize=require(_0xeafd('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xeafd('0x1')]},'request':{'type':Sequelize[_0xeafd('0x1')]},'channel':{'type':Sequelize[_0xeafd('0x1')]},'language':{'type':Sequelize[_0xeafd('0x1')]},'type':{'type':Sequelize[_0xeafd('0x1')]},'uniqueid':{'type':Sequelize[_0xeafd('0x1')]},'version':{'type':Sequelize[_0xeafd('0x1')]},'callerid':{'type':Sequelize[_0xeafd('0x1')]},'calleridname':{'type':Sequelize[_0xeafd('0x1')]},'callingpres':{'type':Sequelize[_0xeafd('0x1')]},'callingani2':{'type':Sequelize[_0xeafd('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xeafd('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xeafd('0x1')]},'context':{'type':Sequelize[_0xeafd('0x1')]},'extension':{'type':Sequelize[_0xeafd('0x1')]},'priority':{'type':Sequelize[_0xeafd('0x1')]},'enhanced':{'type':Sequelize[_0xeafd('0x1')]},'accountcode':{'type':Sequelize[_0xeafd('0x1')]},'threadid':{'type':Sequelize[_0xeafd('0x1')]},'project_name':{'type':Sequelize[_0xeafd('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xeafd('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4206=['BOOLEAN','exports','STRING','DATE'];(function(_0x25c740,_0x40562c){var _0x5dc7b8=function(_0x226988){while(--_0x226988){_0x25c740['push'](_0x25c740['shift']());}};_0x5dc7b8(++_0x40562c);}(_0x4206,0x111));var _0x6420=function(_0x4bd11e,_0x34ca03){_0x4bd11e=_0x4bd11e-0x0;var _0x5b35d1=_0x4206[_0x4bd11e];return _0x5b35d1;};'use strict';var Sequelize=require('sequelize');module[_0x6420('0x0')]={'network':{'type':Sequelize[_0x6420('0x1')]},'network_script':{'type':Sequelize[_0x6420('0x1')]},'request':{'type':Sequelize[_0x6420('0x1')]},'channel':{'type':Sequelize[_0x6420('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6420('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x6420('0x1')]},'callerid':{'type':Sequelize[_0x6420('0x1')]},'calleridname':{'type':Sequelize[_0x6420('0x1')]},'callingpres':{'type':Sequelize[_0x6420('0x1')]},'callingani2':{'type':Sequelize[_0x6420('0x1')]},'callington':{'type':Sequelize[_0x6420('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6420('0x1')]},'rdnis':{'type':Sequelize[_0x6420('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6420('0x1')]},'enhanced':{'type':Sequelize[_0x6420('0x1')]},'accountcode':{'type':Sequelize[_0x6420('0x1')]},'threadid':{'type':Sequelize[_0x6420('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6420('0x2')]},'bot':{'type':Sequelize[_0x6420('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d4b1a34..eacd492 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 _0xa73b=['../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','save','then','destroy','stack','name','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5f52a4,_0x5706d9){var _0xde1bce=function(_0x16ef65){while(--_0x16ef65){_0x5f52a4['push'](_0x5f52a4['shift']());}};_0xde1bce(++_0x5706d9);}(_0xa73b,0x199));var _0xba73=function(_0x394e8f,_0x57e73b){_0x394e8f=_0x394e8f-0x0;var _0x55f611=_0xa73b[_0x394e8f];return _0x55f611;};'use strict';var emlformat=require(_0xba73('0x0'));var rimraf=require(_0xba73('0x1'));var zipdir=require(_0xba73('0x2'));var jsonpatch=require(_0xba73('0x3'));var rp=require(_0xba73('0x4'));var moment=require('moment');var BPromise=require(_0xba73('0x5'));var Mustache=require(_0xba73('0x6'));var util=require(_0xba73('0x7'));var path=require(_0xba73('0x8'));var sox=require(_0xba73('0x9'));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(_0xba73('0xa'));var crypto=require(_0xba73('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xba73('0xc'));var toCsv=require(_0xba73('0xd'));var querystring=require('querystring');var Papa=require(_0xba73('0xe'));var Redis=require('ioredis');var authService=require(_0xba73('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba73('0x10'));var hardwareService=require(_0xba73('0x11'));var logger=require(_0xba73('0x12'))(_0xba73('0x13'));var utils=require(_0xba73('0x14'));var config=require(_0xba73('0x15'));var licenseUtil=require(_0xba73('0x16'));var db=require(_0xba73('0x17'))['db'];function respondWithStatusCode(_0x5a1ded,_0x4ac2e7){_0x4ac2e7=_0x4ac2e7||0xcc;return function(_0x3a3a23){if(_0x3a3a23){return _0x5a1ded[_0xba73('0x18')](_0x4ac2e7);}return _0x5a1ded[_0xba73('0x19')](_0x4ac2e7)['end']();};}function respondWithResult(_0x2f4cc9,_0x22e070){_0x22e070=_0x22e070||0xc8;return function(_0x1e0bc1){if(_0x1e0bc1){return _0x2f4cc9[_0xba73('0x19')](_0x22e070)[_0xba73('0x1a')](_0x1e0bc1);}};}function respondWithFilteredResult(_0xc3a324,_0x39e43c){return function(_0x2f6ac7){if(_0x2f6ac7){var _0x5035e9=typeof _0x39e43c['offset']==='undefined'&&typeof _0x39e43c['limit']===_0xba73('0x1b');var _0x1bf3cb=_0x2f6ac7[_0xba73('0x1c')];var _0x332412=_0x5035e9?0x0:_0x39e43c[_0xba73('0x1d')];var _0x4f5821=_0x5035e9?_0x2f6ac7[_0xba73('0x1c')]:_0x39e43c[_0xba73('0x1d')]+_0x39e43c[_0xba73('0x1e')];var _0x28f35f;if(_0x4f5821>=_0x1bf3cb){_0x4f5821=_0x1bf3cb;_0x28f35f=0xc8;}else{_0x28f35f=0xce;}_0xc3a324[_0xba73('0x19')](_0x28f35f);return _0xc3a324[_0xba73('0x1f')]('Content-Range',_0x332412+'-'+_0x4f5821+'/'+_0x1bf3cb)['json'](_0x2f6ac7);}return null;};}function patchUpdates(_0x27baa8){return function(_0x862f66){try{jsonpatch[_0xba73('0x20')](_0x862f66,_0x27baa8,!![]);}catch(_0x2af600){return BPromise['reject'](_0x2af600);}return _0x862f66[_0xba73('0x21')]();};}function saveUpdates(_0x1d4a6b,_0x1c149e){return function(_0x6f9517){if(_0x6f9517){return _0x6f9517['update'](_0x1d4a6b)[_0xba73('0x22')](function(_0x58ad41){return _0x58ad41;});}return null;};}function removeEntity(_0x23fc4d,_0x11db75){return function(_0x2b35dc){if(_0x2b35dc){return _0x2b35dc[_0xba73('0x23')]()[_0xba73('0x22')](function(){_0x23fc4d[_0xba73('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253bfa,_0x226064){return function(_0x268e82){if(!_0x268e82){_0x253bfa[_0xba73('0x18')](0x194);}return _0x268e82;};}function handleError(_0x19fdf5,_0x1b3f3e){_0x1b3f3e=_0x1b3f3e||0x1f4;return function(_0x22ae9e){logger['error'](_0x22ae9e[_0xba73('0x24')]);if(_0x22ae9e[_0xba73('0x25')]){delete _0x22ae9e[_0xba73('0x25')];}_0x19fdf5[_0xba73('0x19')](_0x1b3f3e)['send'](_0x22ae9e);};}exports['index']=function(_0x41bb1d,_0x269499){var _0x2c1cd1={},_0x5a5b03={},_0xa9b202={'count':0x0,'rows':[]};var _0x3fbe37=_[_0xba73('0x26')](db[_0xba73('0x27')][_0xba73('0x28')],function(_0x4b6906){return{'name':_0x4b6906[_0xba73('0x29')],'type':_0x4b6906[_0xba73('0x2a')][_0xba73('0x2b')]};});_0x5a5b03[_0xba73('0x2c')]=_['map'](_0x3fbe37,_0xba73('0x25'));_0x5a5b03[_0xba73('0x2d')]=_[_0xba73('0x2e')](_0x41bb1d[_0xba73('0x2d')]);_0x5a5b03['filters']=_[_0xba73('0x2f')](_0x5a5b03[_0xba73('0x2c')],_0x5a5b03['query']);_0x2c1cd1[_0xba73('0x30')]=_[_0xba73('0x2f')](_0x5a5b03['model'],qs[_0xba73('0x31')](_0x41bb1d[_0xba73('0x2d')][_0xba73('0x31')]));_0x2c1cd1[_0xba73('0x30')]=_0x2c1cd1['attributes'][_0xba73('0x32')]?_0x2c1cd1['attributes']:_0x5a5b03['model'];if(!_0x41bb1d[_0xba73('0x2d')][_0xba73('0x33')](_0xba73('0x34'))){_0x2c1cd1[_0xba73('0x1e')]=qs[_0xba73('0x1e')](_0x41bb1d['query']['limit']);_0x2c1cd1['offset']=qs[_0xba73('0x1d')](_0x41bb1d['query'][_0xba73('0x1d')]);}_0x2c1cd1['order']=qs[_0xba73('0x35')](_0x41bb1d[_0xba73('0x2d')][_0xba73('0x35')]);_0x2c1cd1[_0xba73('0x36')]=qs[_0xba73('0x37')](_[_0xba73('0x38')](_0x41bb1d['query'],_0x5a5b03[_0xba73('0x37')]),_0x3fbe37);if(_0x41bb1d[_0xba73('0x2d')][_0xba73('0x39')]){_0x2c1cd1[_0xba73('0x36')]=_[_0xba73('0x3a')](_0x2c1cd1[_0xba73('0x36')],{'$or':_[_0xba73('0x26')](_0x3fbe37,function(_0x19b0fe){if(_0x19b0fe[_0xba73('0x2a')]!==_0xba73('0x3b')){var _0x5f3c19={};_0x5f3c19[_0x19b0fe[_0xba73('0x25')]]={'$like':'%'+_0x41bb1d[_0xba73('0x2d')][_0xba73('0x39')]+'%'};return _0x5f3c19;}})});}_0x2c1cd1=_[_0xba73('0x3a')]({},_0x2c1cd1,_0x41bb1d['options']);var _0x539768={'where':_0x2c1cd1[_0xba73('0x36')]};return db[_0xba73('0x27')][_0xba73('0x1c')](_0x539768)[_0xba73('0x22')](function(_0x336e59){_0xa9b202['count']=_0x336e59;if(_0x41bb1d[_0xba73('0x2d')][_0xba73('0x3c')]){_0x2c1cd1[_0xba73('0x3d')]=[{'all':!![]}];}return db['SquareReport'][_0xba73('0x3e')](_0x2c1cd1);})[_0xba73('0x22')](function(_0x1d24a2){_0xa9b202[_0xba73('0x3f')]=_0x1d24a2;return _0xa9b202;})[_0xba73('0x22')](respondWithFilteredResult(_0x269499,_0x2c1cd1))[_0xba73('0x40')](handleError(_0x269499,null));};exports[_0xba73('0x41')]=function(_0x562b99,_0xfcb6eb){var _0x5a7dea={'raw':!![],'where':{'id':_0x562b99[_0xba73('0x42')]['id']}},_0x40dbe7={};_0x40dbe7[_0xba73('0x2c')]=_[_0xba73('0x2e')](db[_0xba73('0x27')][_0xba73('0x28')]);_0x40dbe7[_0xba73('0x2d')]=_['keys'](_0x562b99[_0xba73('0x2d')]);_0x40dbe7[_0xba73('0x37')]=_[_0xba73('0x2f')](_0x40dbe7[_0xba73('0x2c')],_0x40dbe7[_0xba73('0x2d')]);_0x5a7dea['attributes']=_[_0xba73('0x2f')](_0x40dbe7[_0xba73('0x2c')],qs[_0xba73('0x31')](_0x562b99[_0xba73('0x2d')][_0xba73('0x31')]));_0x5a7dea[_0xba73('0x30')]=_0x5a7dea[_0xba73('0x30')][_0xba73('0x32')]?_0x5a7dea[_0xba73('0x30')]:_0x40dbe7['model'];if(_0x562b99[_0xba73('0x2d')]['includeAll']){_0x5a7dea[_0xba73('0x3d')]=[{'all':!![]}];}_0x5a7dea=_[_0xba73('0x3a')]({},_0x5a7dea,_0x562b99[_0xba73('0x43')]);return db[_0xba73('0x27')][_0xba73('0x44')](_0x5a7dea)[_0xba73('0x22')](handleEntityNotFound(_0xfcb6eb,null))[_0xba73('0x22')](respondWithResult(_0xfcb6eb,null))['catch'](handleError(_0xfcb6eb,null));};exports[_0xba73('0x45')]=function(_0x2e4d33,_0x409c36){return db[_0xba73('0x27')][_0xba73('0x45')](_0x2e4d33[_0xba73('0x46')],{})[_0xba73('0x22')](respondWithResult(_0x409c36,0xc9))[_0xba73('0x40')](handleError(_0x409c36,null));};exports['update']=function(_0x56a346,_0x261bc4){if(_0x56a346['body']['id']){delete _0x56a346[_0xba73('0x46')]['id'];}return db[_0xba73('0x27')]['find']({'where':{'id':_0x56a346[_0xba73('0x42')]['id']}})[_0xba73('0x22')](handleEntityNotFound(_0x261bc4,null))[_0xba73('0x22')](saveUpdates(_0x56a346[_0xba73('0x46')],null))[_0xba73('0x22')](respondWithResult(_0x261bc4,null))[_0xba73('0x40')](handleError(_0x261bc4,null));};exports[_0xba73('0x23')]=function(_0x29cc57,_0xdc334b){return db['SquareReport'][_0xba73('0x44')]({'where':{'id':_0x29cc57['params']['id']}})[_0xba73('0x22')](handleEntityNotFound(_0xdc334b,null))[_0xba73('0x22')](removeEntity(_0xdc334b,null))[_0xba73('0x40')](handleError(_0xdc334b,null));};exports[_0xba73('0x47')]=function(_0x4d4fbb,_0x48fb16){return db['SquareReport'][_0xba73('0x47')]()[_0xba73('0x22')](respondWithResult(_0x48fb16,null))[_0xba73('0x40')](handleError(_0x48fb16,null));}; \ No newline at end of file +var _0x2f04=['nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','send','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields'];(function(_0x43d9c7,_0x3ffe21){var _0x4f2106=function(_0x3527e9){while(--_0x3527e9){_0x43d9c7['push'](_0x43d9c7['shift']());}};_0x4f2106(++_0x3ffe21);}(_0x2f04,0x134));var _0x42f0=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2f04[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0x42f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42f0('0x1'));var jsonpatch=require(_0x42f0('0x2'));var rp=require(_0x42f0('0x3'));var moment=require(_0x42f0('0x4'));var BPromise=require(_0x42f0('0x5'));var Mustache=require(_0x42f0('0x6'));var util=require(_0x42f0('0x7'));var path=require(_0x42f0('0x8'));var sox=require('sox');var csv=require(_0x42f0('0x9'));var ejs=require(_0x42f0('0xa'));var fs=require('fs');var fs_extra=require(_0x42f0('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42f0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42f0('0x9'));var querystring=require(_0x42f0('0xd'));var Papa=require(_0x42f0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x42f0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42f0('0x10'));var logger=require(_0x42f0('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x42f0('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x42f0('0x13'))['db'];function respondWithStatusCode(_0x1209db,_0x148774){_0x148774=_0x148774||0xcc;return function(_0x25941c){if(_0x25941c){return _0x1209db[_0x42f0('0x14')](_0x148774);}return _0x1209db[_0x42f0('0x15')](_0x148774)[_0x42f0('0x16')]();};}function respondWithResult(_0x183757,_0x462382){_0x462382=_0x462382||0xc8;return function(_0x4e1516){if(_0x4e1516){return _0x183757[_0x42f0('0x15')](_0x462382)[_0x42f0('0x17')](_0x4e1516);}};}function respondWithFilteredResult(_0x5eb8a9,_0x336007){return function(_0x288e44){if(_0x288e44){var _0x19716f=typeof _0x336007[_0x42f0('0x18')]===_0x42f0('0x19')&&typeof _0x336007[_0x42f0('0x1a')]===_0x42f0('0x19');var _0x2c24c6=_0x288e44['count'];var _0x2dff38=_0x19716f?0x0:_0x336007['offset'];var _0x44f7cf=_0x19716f?_0x288e44[_0x42f0('0x1b')]:_0x336007[_0x42f0('0x18')]+_0x336007['limit'];var _0x312b6d;if(_0x44f7cf>=_0x2c24c6){_0x44f7cf=_0x2c24c6;_0x312b6d=0xc8;}else{_0x312b6d=0xce;}_0x5eb8a9[_0x42f0('0x15')](_0x312b6d);return _0x5eb8a9['set'](_0x42f0('0x1c'),_0x2dff38+'-'+_0x44f7cf+'/'+_0x2c24c6)[_0x42f0('0x17')](_0x288e44);}return null;};}function patchUpdates(_0x3baf84){return function(_0x39f19b){try{jsonpatch[_0x42f0('0x1d')](_0x39f19b,_0x3baf84,!![]);}catch(_0x37619b){return BPromise['reject'](_0x37619b);}return _0x39f19b[_0x42f0('0x1e')]();};}function saveUpdates(_0x1dd3dd,_0x43efd0){return function(_0x508264){if(_0x508264){return _0x508264[_0x42f0('0x1f')](_0x1dd3dd)[_0x42f0('0x20')](function(_0x3307db){return _0x3307db;});}return null;};}function removeEntity(_0x1dfc0a,_0x2dab31){return function(_0x484ca0){if(_0x484ca0){return _0x484ca0[_0x42f0('0x21')]()[_0x42f0('0x20')](function(){_0x1dfc0a[_0x42f0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x988ea4,_0x13ea34){return function(_0x316393){if(!_0x316393){_0x988ea4[_0x42f0('0x14')](0x194);}return _0x316393;};}function handleError(_0x5b3b83,_0x146e01){_0x146e01=_0x146e01||0x1f4;return function(_0x2309b7){logger['error'](_0x2309b7[_0x42f0('0x22')]);if(_0x2309b7['name']){delete _0x2309b7['name'];}_0x5b3b83[_0x42f0('0x15')](_0x146e01)[_0x42f0('0x23')](_0x2309b7);};}exports['index']=function(_0x43dcda,_0x2b8b52){var _0x2b7c1e={},_0x274cdc={},_0x2aa82d={'count':0x0,'rows':[]};var _0x2a0104=_[_0x42f0('0x24')](db['SquareReport'][_0x42f0('0x25')],function(_0x31c058){return{'name':_0x31c058[_0x42f0('0x26')],'type':_0x31c058['type'][_0x42f0('0x27')]};});_0x274cdc[_0x42f0('0x28')]=_[_0x42f0('0x24')](_0x2a0104,_0x42f0('0x29'));_0x274cdc[_0x42f0('0x2a')]=_['keys'](_0x43dcda[_0x42f0('0x2a')]);_0x274cdc[_0x42f0('0x2b')]=_[_0x42f0('0x2c')](_0x274cdc[_0x42f0('0x28')],_0x274cdc[_0x42f0('0x2a')]);_0x2b7c1e[_0x42f0('0x2d')]=_[_0x42f0('0x2c')](_0x274cdc[_0x42f0('0x28')],qs[_0x42f0('0x2e')](_0x43dcda[_0x42f0('0x2a')]['fields']));_0x2b7c1e[_0x42f0('0x2d')]=_0x2b7c1e[_0x42f0('0x2d')]['length']?_0x2b7c1e[_0x42f0('0x2d')]:_0x274cdc[_0x42f0('0x28')];if(!_0x43dcda['query']['hasOwnProperty'](_0x42f0('0x2f'))){_0x2b7c1e[_0x42f0('0x1a')]=qs[_0x42f0('0x1a')](_0x43dcda[_0x42f0('0x2a')][_0x42f0('0x1a')]);_0x2b7c1e[_0x42f0('0x18')]=qs[_0x42f0('0x18')](_0x43dcda[_0x42f0('0x2a')][_0x42f0('0x18')]);}_0x2b7c1e[_0x42f0('0x30')]=qs[_0x42f0('0x31')](_0x43dcda[_0x42f0('0x2a')][_0x42f0('0x31')]);_0x2b7c1e[_0x42f0('0x32')]=qs[_0x42f0('0x2b')](_[_0x42f0('0x33')](_0x43dcda[_0x42f0('0x2a')],_0x274cdc[_0x42f0('0x2b')]),_0x2a0104);if(_0x43dcda[_0x42f0('0x2a')][_0x42f0('0x34')]){_0x2b7c1e['where']=_[_0x42f0('0x35')](_0x2b7c1e[_0x42f0('0x32')],{'$or':_[_0x42f0('0x24')](_0x2a0104,function(_0x306517){if(_0x306517[_0x42f0('0x36')]!==_0x42f0('0x37')){var _0x29d45c={};_0x29d45c[_0x306517['name']]={'$like':'%'+_0x43dcda[_0x42f0('0x2a')][_0x42f0('0x34')]+'%'};return _0x29d45c;}})});}_0x2b7c1e=_[_0x42f0('0x35')]({},_0x2b7c1e,_0x43dcda[_0x42f0('0x38')]);var _0x25e5de={'where':_0x2b7c1e[_0x42f0('0x32')]};return db[_0x42f0('0x39')][_0x42f0('0x1b')](_0x25e5de)[_0x42f0('0x20')](function(_0x4fe1df){_0x2aa82d[_0x42f0('0x1b')]=_0x4fe1df;if(_0x43dcda['query'][_0x42f0('0x3a')]){_0x2b7c1e[_0x42f0('0x3b')]=[{'all':!![]}];}return db[_0x42f0('0x39')][_0x42f0('0x3c')](_0x2b7c1e);})[_0x42f0('0x20')](function(_0x1ffb6e){_0x2aa82d[_0x42f0('0x3d')]=_0x1ffb6e;return _0x2aa82d;})[_0x42f0('0x20')](respondWithFilteredResult(_0x2b8b52,_0x2b7c1e))[_0x42f0('0x3e')](handleError(_0x2b8b52,null));};exports[_0x42f0('0x3f')]=function(_0x1e5892,_0x4300a5){var _0x52d1e9={'raw':!![],'where':{'id':_0x1e5892[_0x42f0('0x40')]['id']}},_0x427984={};_0x427984[_0x42f0('0x28')]=_[_0x42f0('0x41')](db[_0x42f0('0x39')]['rawAttributes']);_0x427984[_0x42f0('0x2a')]=_[_0x42f0('0x41')](_0x1e5892['query']);_0x427984['filters']=_[_0x42f0('0x2c')](_0x427984[_0x42f0('0x28')],_0x427984[_0x42f0('0x2a')]);_0x52d1e9['attributes']=_[_0x42f0('0x2c')](_0x427984[_0x42f0('0x28')],qs[_0x42f0('0x2e')](_0x1e5892[_0x42f0('0x2a')][_0x42f0('0x2e')]));_0x52d1e9[_0x42f0('0x2d')]=_0x52d1e9[_0x42f0('0x2d')][_0x42f0('0x42')]?_0x52d1e9[_0x42f0('0x2d')]:_0x427984[_0x42f0('0x28')];if(_0x1e5892[_0x42f0('0x2a')][_0x42f0('0x3a')]){_0x52d1e9['include']=[{'all':!![]}];}_0x52d1e9=_['merge']({},_0x52d1e9,_0x1e5892['options']);return db[_0x42f0('0x39')][_0x42f0('0x43')](_0x52d1e9)[_0x42f0('0x20')](handleEntityNotFound(_0x4300a5,null))[_0x42f0('0x20')](respondWithResult(_0x4300a5,null))[_0x42f0('0x3e')](handleError(_0x4300a5,null));};exports[_0x42f0('0x44')]=function(_0x3810e8,_0x333b32){return db[_0x42f0('0x39')][_0x42f0('0x44')](_0x3810e8['body'],{})['then'](respondWithResult(_0x333b32,0xc9))['catch'](handleError(_0x333b32,null));};exports[_0x42f0('0x1f')]=function(_0x5e62b5,_0x162be9){if(_0x5e62b5[_0x42f0('0x45')]['id']){delete _0x5e62b5[_0x42f0('0x45')]['id'];}return db[_0x42f0('0x39')]['find']({'where':{'id':_0x5e62b5[_0x42f0('0x40')]['id']}})[_0x42f0('0x20')](handleEntityNotFound(_0x162be9,null))['then'](saveUpdates(_0x5e62b5[_0x42f0('0x45')],null))['then'](respondWithResult(_0x162be9,null))[_0x42f0('0x3e')](handleError(_0x162be9,null));};exports[_0x42f0('0x21')]=function(_0x26af53,_0x55565a){return db[_0x42f0('0x39')][_0x42f0('0x43')]({'where':{'id':_0x26af53['params']['id']}})['then'](handleEntityNotFound(_0x55565a,null))['then'](removeEntity(_0x55565a,null))[_0x42f0('0x3e')](handleError(_0x55565a,null));};exports[_0x42f0('0x46')]=function(_0x12449c,_0x43e8af){return db['SquareReport']['describe']()[_0x42f0('0x20')](respondWithResult(_0x43e8af,null))['catch'](handleError(_0x43e8af,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7832d4b..43d6ab1 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 _0x77f3=['path','rimraf','./squareReport.attributes','exports','define','SquareReport','uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird'];(function(_0x2de3a6,_0x1e27e4){var _0x391121=function(_0x5bf80d){while(--_0x5bf80d){_0x2de3a6['push'](_0x2de3a6['shift']());}};_0x391121(++_0x1e27e4);}(_0x77f3,0x1e5));var _0x377f=function(_0x5955e8,_0x2e00c9){_0x5955e8=_0x5955e8-0x0;var _0x1642bf=_0x77f3[_0x5955e8];return _0x1642bf;};'use strict';var _=require(_0x377f('0x0'));var util=require(_0x377f('0x1'));var logger=require('../../config/logger')(_0x377f('0x2'));var moment=require(_0x377f('0x3'));var BPromise=require(_0x377f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x377f('0x5'));var rimraf=require(_0x377f('0x6'));var config=require('../../config/environment');var attributes=require(_0x377f('0x7'));module[_0x377f('0x8')]=function(_0x34c5db,_0x5d788c){return _0x34c5db[_0x377f('0x9')](_0x377f('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x377f('0xb'),_0x377f('0xc')]},{'name':_0x377f('0xd'),'fields':[_0x377f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf75=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash'];(function(_0x1af5b2,_0x268d76){var _0xe76e7=function(_0x8e0187){while(--_0x8e0187){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xe76e7(++_0x268d76);}(_0xaf75,0xc3));var _0x5af7=function(_0x253535,_0x2b21a3){_0x253535=_0x253535-0x0;var _0x4cf6d4=_0xaf75[_0x253535];return _0x4cf6d4;};'use strict';var _=require(_0x5af7('0x0'));var util=require('util');var logger=require(_0x5af7('0x1'))(_0x5af7('0x2'));var moment=require(_0x5af7('0x3'));var BPromise=require(_0x5af7('0x4'));var rp=require(_0x5af7('0x5'));var fs=require('fs');var path=require(_0x5af7('0x6'));var rimraf=require(_0x5af7('0x7'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x281c51,_0x49eb3f){return _0x281c51[_0x5af7('0x8')](_0x5af7('0x9'),attributes,{'tableName':_0x5af7('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x5af7('0xb'),_0x5af7('0xc')]},{'name':_0x5af7('0xd'),'fields':[_0x5af7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index de74bf6..b712ce3 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 _0xaf67=['catch','SquareReport','create','body','options','raw','debug','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xaf67,0x12d));var _0x7af6=function(_0x222c29,_0x4bcade){_0x222c29=_0x222c29-0x0;var _0x373565=_0xaf67[_0x222c29];return _0x373565;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7af6('0x0'));var BPromise=require(_0x7af6('0x1'));var rs=require(_0x7af6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7af6('0x3'))['db'];var utils=require(_0x7af6('0x4'));var logger=require('../../config/logger')(_0x7af6('0x5'));var config=require(_0x7af6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7af6('0x7')][_0x7af6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36be55,_0x50d8e8,_0xbc7631){return new BPromise(function(_0x5220c3,_0x379c40){return client['request'](_0x36be55,_0xbc7631)[_0x7af6('0x9')](function(_0x5a1290){logger[_0x7af6('0xa')](_0x7af6('0xb'),_0x50d8e8,_0x7af6('0xc'));logger['debug'](_0x7af6('0xd'),_0x50d8e8,_0x7af6('0xc'),JSON[_0x7af6('0xe')](_0x5a1290));if(_0x5a1290['error']){if(_0x5a1290['error'][_0x7af6('0xf')]===0x1f4){logger[_0x7af6('0x10')](_0x7af6('0xb'),_0x50d8e8,_0x5a1290[_0x7af6('0x10')]['message']);return _0x379c40(_0x5a1290[_0x7af6('0x10')][_0x7af6('0x11')]);}logger[_0x7af6('0x10')](_0x7af6('0xb'),_0x50d8e8,_0x5a1290[_0x7af6('0x10')][_0x7af6('0x11')]);return _0x5220c3(_0x5a1290['error'][_0x7af6('0x11')]);}else{logger[_0x7af6('0xa')](_0x7af6('0xb'),_0x50d8e8,'request\x20sent');_0x5220c3(_0x5a1290[_0x7af6('0x12')]['message']);}})[_0x7af6('0x13')](function(_0x1716f7){logger[_0x7af6('0x10')](_0x7af6('0xb'),_0x50d8e8,_0x1716f7);_0x379c40(_0x1716f7);});});}exports['CreateSquareReport']=function(_0x38cc5b){var _0x25e5a6=this;return new Promise(function(_0x391cb0,_0x511117){return db[_0x7af6('0x14')][_0x7af6('0x15')](_0x38cc5b[_0x7af6('0x16')],{'raw':_0x38cc5b[_0x7af6('0x17')]?_0x38cc5b[_0x7af6('0x17')][_0x7af6('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3fa51b){logger[_0x7af6('0xa')]('CreateSquareReport',_0x38cc5b);logger[_0x7af6('0x19')](_0x7af6('0x1a'),_0x38cc5b,JSON[_0x7af6('0xe')](_0x3fa51b));_0x391cb0(_0x3fa51b);})[_0x7af6('0x13')](function(_0x2b9d11){logger[_0x7af6('0x10')]('CreateSquareReport',_0x2b9d11['message'],_0x38cc5b);_0x511117(_0x25e5a6[_0x7af6('0x10')](0x1f4,_0x2b9d11[_0x7af6('0x11')]));});});};exports[_0x7af6('0x1b')]=function(_0x294834){var _0x6cff67=this;return new Promise(function(_0x4421df,_0x88ee04){return db[_0x7af6('0x14')][_0x7af6('0x1c')](_0x294834[_0x7af6('0x16')],{'raw':_0x294834[_0x7af6('0x17')]?_0x294834['options'][_0x7af6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294834[_0x7af6('0x17')]?_0x294834[_0x7af6('0x17')][_0x7af6('0x1d')]||null:null,'attributes':_0x294834[_0x7af6('0x17')]?_0x294834[_0x7af6('0x17')][_0x7af6('0x1e')]||null:null,'limit':_0x294834[_0x7af6('0x17')]?_0x294834[_0x7af6('0x17')][_0x7af6('0x1f')]||null:null})['then'](function(_0x50a812){logger['info'](_0x7af6('0x1b'),_0x294834);logger[_0x7af6('0x19')](_0x7af6('0x1b'),_0x294834,JSON[_0x7af6('0xe')](_0x50a812));_0x4421df(_0x50a812);})['catch'](function(_0x4b327b){logger[_0x7af6('0x10')](_0x7af6('0x1b'),_0x4b327b[_0x7af6('0x11')],_0x294834);_0x88ee04(_0x6cff67[_0x7af6('0x10')](0x1f4,_0x4b327b[_0x7af6('0x11')]));});});}; \ No newline at end of file +var _0x5c4b=['body','options','raw','debug','UpdateSquareReport','update','where','attributes','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','SquareReport'];(function(_0x1045ef,_0xfea295){var _0x3e99f2=function(_0x373c6b){while(--_0x373c6b){_0x1045ef['push'](_0x1045ef['shift']());}};_0x3e99f2(++_0xfea295);}(_0x5c4b,0xbd));var _0xb5c4=function(_0x3a23f5,_0x59a640){_0x3a23f5=_0x3a23f5-0x0;var _0x446fde=_0x5c4b[_0x3a23f5];return _0x446fde;};'use strict';var _=require(_0xb5c4('0x0'));var util=require(_0xb5c4('0x1'));var moment=require('moment');var BPromise=require(_0xb5c4('0x2'));var rs=require(_0xb5c4('0x3'));var fs=require('fs');var Redis=require(_0xb5c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5c4('0x5'))(_0xb5c4('0x6'));var config=require(_0xb5c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb5c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b8d9d,_0x314ab1,_0x296141){return new BPromise(function(_0x11c283,_0x1d802b){return client[_0xb5c4('0x9')](_0x5b8d9d,_0x296141)[_0xb5c4('0xa')](function(_0x598c46){logger[_0xb5c4('0xb')]('SquareReport,\x20%s,\x20%s',_0x314ab1,_0xb5c4('0xc'));logger['debug'](_0xb5c4('0xd'),_0x314ab1,'request\x20sent',JSON[_0xb5c4('0xe')](_0x598c46));if(_0x598c46[_0xb5c4('0xf')]){if(_0x598c46[_0xb5c4('0xf')]['code']===0x1f4){logger[_0xb5c4('0xf')](_0xb5c4('0x10'),_0x314ab1,_0x598c46[_0xb5c4('0xf')]['message']);return _0x1d802b(_0x598c46[_0xb5c4('0xf')][_0xb5c4('0x11')]);}logger[_0xb5c4('0xf')]('SquareReport,\x20%s,\x20%s',_0x314ab1,_0x598c46['error'][_0xb5c4('0x11')]);return _0x11c283(_0x598c46['error'][_0xb5c4('0x11')]);}else{logger[_0xb5c4('0xb')](_0xb5c4('0x10'),_0x314ab1,_0xb5c4('0xc'));_0x11c283(_0x598c46[_0xb5c4('0x12')]['message']);}})['catch'](function(_0x4cddae){logger['error'](_0xb5c4('0x10'),_0x314ab1,_0x4cddae);_0x1d802b(_0x4cddae);});});}exports[_0xb5c4('0x13')]=function(_0x2d1ee0){var _0x8d8a8f=this;return new Promise(function(_0x594076,_0x3ad887){return db[_0xb5c4('0x14')]['create'](_0x2d1ee0[_0xb5c4('0x15')],{'raw':_0x2d1ee0['options']?_0x2d1ee0[_0xb5c4('0x16')][_0xb5c4('0x17')]===undefined?!![]:![]:!![]})[_0xb5c4('0xa')](function(_0x1c64d8){logger['info'](_0xb5c4('0x13'),_0x2d1ee0);logger[_0xb5c4('0x18')]('CreateSquareReport',_0x2d1ee0,JSON[_0xb5c4('0xe')](_0x1c64d8));_0x594076(_0x1c64d8);})['catch'](function(_0x32cdc2){logger[_0xb5c4('0xf')]('CreateSquareReport',_0x32cdc2[_0xb5c4('0x11')],_0x2d1ee0);_0x3ad887(_0x8d8a8f['error'](0x1f4,_0x32cdc2[_0xb5c4('0x11')]));});});};exports[_0xb5c4('0x19')]=function(_0x441070){var _0x37d3cf=this;return new Promise(function(_0x585a12,_0x590685){return db['SquareReport'][_0xb5c4('0x1a')](_0x441070[_0xb5c4('0x15')],{'raw':_0x441070[_0xb5c4('0x16')]?_0x441070['options'][_0xb5c4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441070[_0xb5c4('0x16')]?_0x441070['options'][_0xb5c4('0x1b')]||null:null,'attributes':_0x441070[_0xb5c4('0x16')]?_0x441070['options'][_0xb5c4('0x1c')]||null:null,'limit':_0x441070[_0xb5c4('0x16')]?_0x441070[_0xb5c4('0x16')]['limit']||null:null})[_0xb5c4('0xa')](function(_0x5cd4a5){logger[_0xb5c4('0xb')]('UpdateSquareReport',_0x441070);logger[_0xb5c4('0x18')]('UpdateSquareReport',_0x441070,JSON[_0xb5c4('0xe')](_0x5cd4a5));_0x585a12(_0x5cd4a5);})[_0xb5c4('0x1d')](function(_0x564f88){logger[_0xb5c4('0xf')](_0xb5c4('0x19'),_0x564f88['message'],_0x441070);_0x590685(_0x37d3cf['error'](0x1f4,_0x564f88[_0xb5c4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9f9be5b..db34f39 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 _0xb1a6=['isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x5587ce,_0x3fd9ac){var _0x348ecc=function(_0x4b2d62){while(--_0x4b2d62){_0x5587ce['push'](_0x5587ce['shift']());}};_0x348ecc(++_0x3fd9ac);}(_0xb1a6,0x1bb));var _0x6b1a=function(_0x12c5dd,_0x7bf6fe){_0x12c5dd=_0x12c5dd-0x0;var _0x4c71a0=_0xb1a6[_0x12c5dd];return _0x4c71a0;};'use strict';var multer=require(_0x6b1a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b1a('0x1'));var router=express[_0x6b1a('0x2')]();var fs_extra=require(_0x6b1a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6b1a('0x4'));var config=require(_0x6b1a('0x5'));var controller=require(_0x6b1a('0x6'));router['get']('/',auth[_0x6b1a('0x7')](),controller['index']);router[_0x6b1a('0x8')](_0x6b1a('0x9'),auth[_0x6b1a('0x7')](),controller[_0x6b1a('0xa')]);router[_0x6b1a('0x8')](_0x6b1a('0xb'),auth['isAuthenticated'](),controller[_0x6b1a('0xc')]);router[_0x6b1a('0xd')]('/',auth[_0x6b1a('0x7')](),controller[_0x6b1a('0xe')]);router[_0x6b1a('0xf')](_0x6b1a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6b1a('0x10')](_0x6b1a('0xb'),auth[_0x6b1a('0x7')](),controller['destroy']);module[_0x6b1a('0x11')]=router; \ No newline at end of file +var _0xc577=['isAuthenticated','index','/:id','show','update','delete','multer','path','express','fs-extra','../../config/environment','./squareReportDetail.controller','get'];(function(_0x3e040c,_0x5a94c3){var _0x3fd6d4=function(_0x478c2c){while(--_0x478c2c){_0x3e040c['push'](_0x3e040c['shift']());}};_0x3fd6d4(++_0x5a94c3);}(_0xc577,0x124));var _0x7c57=function(_0x516044,_0x3677f7){_0x516044=_0x516044-0x0;var _0x31684b=_0xc577[_0x516044];return _0x31684b;};'use strict';var multer=require(_0x7c57('0x0'));var util=require('util');var path=require(_0x7c57('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c57('0x2'));var router=express['Router']();var fs_extra=require(_0x7c57('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7c57('0x4'));var controller=require(_0x7c57('0x5'));router[_0x7c57('0x6')]('/',auth[_0x7c57('0x7')](),controller[_0x7c57('0x8')]);router[_0x7c57('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7c57('0x6')](_0x7c57('0x9'),auth[_0x7c57('0x7')](),controller[_0x7c57('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7c57('0x9'),auth[_0x7c57('0x7')](),controller[_0x7c57('0xb')]);router[_0x7c57('0xc')]('/:id',auth[_0x7c57('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e6ca679..90c6fe6 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 _0x705e=['exports','STRING'];(function(_0x235751,_0x5d628a){var _0x336647=function(_0x214bbb){while(--_0x214bbb){_0x235751['push'](_0x235751['shift']());}};_0x336647(++_0x5d628a);}(_0x705e,0x146));var _0xe705=function(_0x4aba27,_0x157e5c){_0x4aba27=_0x4aba27-0x0;var _0x513055=_0x705e[_0x4aba27];return _0x513055;};'use strict';var Sequelize=require('sequelize');module[_0xe705('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xe705('0x1')]},'application':{'type':Sequelize[_0xe705('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xe705('0x1')]},'callerid':{'type':Sequelize[_0xe705('0x1')]}}; \ No newline at end of file +var _0xa264=['STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa264,0x1d3));var _0x4a26=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0xa264[_0x20cf8a];return _0x54e165;};'use strict';var Sequelize=require(_0x4a26('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4a26('0x1')]},'node':{'type':Sequelize[_0x4a26('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x4a26('0x2')]},'project_name':{'type':Sequelize[_0x4a26('0x1')]},'callerid':{'type':Sequelize[_0x4a26('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9be8b9b..ace3652 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 _0x9f95=['body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','status','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create'];(function(_0x57aa48,_0x46939e){var _0x27b818=function(_0x41de10){while(--_0x41de10){_0x57aa48['push'](_0x57aa48['shift']());}};_0x27b818(++_0x46939e);}(_0x9f95,0x97));var _0x59f9=function(_0x5a7282,_0xa6e195){_0x5a7282=_0x5a7282-0x0;var _0x4928ec=_0x9f95[_0x5a7282];return _0x4928ec;};'use strict';var emlformat=require(_0x59f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59f9('0x1'));var jsonpatch=require(_0x59f9('0x2'));var rp=require(_0x59f9('0x3'));var moment=require(_0x59f9('0x4'));var BPromise=require(_0x59f9('0x5'));var Mustache=require(_0x59f9('0x6'));var util=require(_0x59f9('0x7'));var path=require('path');var sox=require(_0x59f9('0x8'));var csv=require('to-csv');var ejs=require(_0x59f9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x59f9('0xa'));var crypto=require(_0x59f9('0xb'));var jsforce=require(_0x59f9('0xc'));var deskjs=require(_0x59f9('0xd'));var toCsv=require(_0x59f9('0xe'));var querystring=require('querystring');var Papa=require(_0x59f9('0xf'));var Redis=require('ioredis');var authService=require(_0x59f9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x59f9('0x11'));var hardwareService=require(_0x59f9('0x12'));var logger=require('../../config/logger')(_0x59f9('0x13'));var utils=require(_0x59f9('0x14'));var config=require(_0x59f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x59f9('0x16'))['db'];function respondWithStatusCode(_0x24ad39,_0x30b7ec){_0x30b7ec=_0x30b7ec||0xcc;return function(_0x42820b){if(_0x42820b){return _0x24ad39[_0x59f9('0x17')](_0x30b7ec);}return _0x24ad39['status'](_0x30b7ec)[_0x59f9('0x18')]();};}function respondWithResult(_0x1f93b5,_0x5c96f8){_0x5c96f8=_0x5c96f8||0xc8;return function(_0xe3c428){if(_0xe3c428){return _0x1f93b5['status'](_0x5c96f8)[_0x59f9('0x19')](_0xe3c428);}};}function respondWithFilteredResult(_0x4fa0ce,_0xc1a307){return function(_0xfbe3f){if(_0xfbe3f){var _0x5ac128=typeof _0xc1a307[_0x59f9('0x1a')]===_0x59f9('0x1b')&&typeof _0xc1a307[_0x59f9('0x1c')]===_0x59f9('0x1b');var _0x1638ec=_0xfbe3f[_0x59f9('0x1d')];var _0x1929cd=_0x5ac128?0x0:_0xc1a307[_0x59f9('0x1a')];var _0x54ae1e=_0x5ac128?_0xfbe3f[_0x59f9('0x1d')]:_0xc1a307[_0x59f9('0x1a')]+_0xc1a307[_0x59f9('0x1c')];var _0x3df237;if(_0x54ae1e>=_0x1638ec){_0x54ae1e=_0x1638ec;_0x3df237=0xc8;}else{_0x3df237=0xce;}_0x4fa0ce['status'](_0x3df237);return _0x4fa0ce[_0x59f9('0x1e')]('Content-Range',_0x1929cd+'-'+_0x54ae1e+'/'+_0x1638ec)['json'](_0xfbe3f);}return null;};}function patchUpdates(_0x510159){return function(_0x4baea9){try{jsonpatch[_0x59f9('0x1f')](_0x4baea9,_0x510159,!![]);}catch(_0x2719b0){return BPromise[_0x59f9('0x20')](_0x2719b0);}return _0x4baea9['save']();};}function saveUpdates(_0x58a180,_0x4ad13b){return function(_0x1a3494){if(_0x1a3494){return _0x1a3494['update'](_0x58a180)[_0x59f9('0x21')](function(_0x5761b0){return _0x5761b0;});}return null;};}function removeEntity(_0x24a46a,_0x1a9f3c){return function(_0x3fa145){if(_0x3fa145){return _0x3fa145[_0x59f9('0x22')]()[_0x59f9('0x21')](function(){_0x24a46a['status'](0xcc)[_0x59f9('0x18')]();});}};}function handleEntityNotFound(_0x35b5ac,_0x3b16aa){return function(_0x5bd4f1){if(!_0x5bd4f1){_0x35b5ac[_0x59f9('0x17')](0x194);}return _0x5bd4f1;};}function handleError(_0x24cab7,_0x5620fc){_0x5620fc=_0x5620fc||0x1f4;return function(_0x21e05c){logger[_0x59f9('0x23')](_0x21e05c[_0x59f9('0x24')]);if(_0x21e05c[_0x59f9('0x25')]){delete _0x21e05c[_0x59f9('0x25')];}_0x24cab7[_0x59f9('0x26')](_0x5620fc)[_0x59f9('0x27')](_0x21e05c);};}exports[_0x59f9('0x28')]=function(_0x459624,_0x5020cd){var _0x7fb9f9={},_0x5e485a={},_0x545e8e={'count':0x0,'rows':[]};var _0x595111=_[_0x59f9('0x29')](db[_0x59f9('0x2a')][_0x59f9('0x2b')],function(_0xaa9a31){return{'name':_0xaa9a31[_0x59f9('0x2c')],'type':_0xaa9a31[_0x59f9('0x2d')][_0x59f9('0x2e')]};});_0x5e485a[_0x59f9('0x2f')]=_['map'](_0x595111,_0x59f9('0x25'));_0x5e485a['query']=_[_0x59f9('0x30')](_0x459624[_0x59f9('0x31')]);_0x5e485a[_0x59f9('0x32')]=_[_0x59f9('0x33')](_0x5e485a[_0x59f9('0x2f')],_0x5e485a['query']);_0x7fb9f9['attributes']=_['intersection'](_0x5e485a['model'],qs[_0x59f9('0x34')](_0x459624['query'][_0x59f9('0x34')]));_0x7fb9f9[_0x59f9('0x35')]=_0x7fb9f9[_0x59f9('0x35')]['length']?_0x7fb9f9[_0x59f9('0x35')]:_0x5e485a['model'];if(!_0x459624[_0x59f9('0x31')][_0x59f9('0x36')](_0x59f9('0x37'))){_0x7fb9f9[_0x59f9('0x1c')]=qs[_0x59f9('0x1c')](_0x459624['query'][_0x59f9('0x1c')]);_0x7fb9f9[_0x59f9('0x1a')]=qs[_0x59f9('0x1a')](_0x459624[_0x59f9('0x31')][_0x59f9('0x1a')]);}_0x7fb9f9[_0x59f9('0x38')]=qs['sort'](_0x459624[_0x59f9('0x31')][_0x59f9('0x39')]);_0x7fb9f9[_0x59f9('0x3a')]=qs[_0x59f9('0x32')](_[_0x59f9('0x3b')](_0x459624[_0x59f9('0x31')],_0x5e485a['filters']),_0x595111);if(_0x459624[_0x59f9('0x31')][_0x59f9('0x3c')]){_0x7fb9f9[_0x59f9('0x3a')]=_[_0x59f9('0x3d')](_0x7fb9f9[_0x59f9('0x3a')],{'$or':_['map'](_0x595111,function(_0x3c7077){if(_0x3c7077['type']!=='VIRTUAL'){var _0x31b871={};_0x31b871[_0x3c7077['name']]={'$like':'%'+_0x459624['query'][_0x59f9('0x3c')]+'%'};return _0x31b871;}})});}_0x7fb9f9=_[_0x59f9('0x3d')]({},_0x7fb9f9,_0x459624[_0x59f9('0x3e')]);var _0xd52a1a={'where':_0x7fb9f9[_0x59f9('0x3a')]};return db[_0x59f9('0x2a')][_0x59f9('0x1d')](_0xd52a1a)[_0x59f9('0x21')](function(_0x301bde){_0x545e8e['count']=_0x301bde;if(_0x459624[_0x59f9('0x31')]['includeAll']){_0x7fb9f9[_0x59f9('0x3f')]=[{'all':!![]}];}return db[_0x59f9('0x2a')][_0x59f9('0x40')](_0x7fb9f9);})['then'](function(_0x42adf2){_0x545e8e['rows']=_0x42adf2;return _0x545e8e;})[_0x59f9('0x21')](respondWithFilteredResult(_0x5020cd,_0x7fb9f9))[_0x59f9('0x41')](handleError(_0x5020cd,null));};exports['show']=function(_0x516d5d,_0x549653){var _0x2b611f={'raw':!![],'where':{'id':_0x516d5d[_0x59f9('0x42')]['id']}},_0x4e588e={};_0x4e588e[_0x59f9('0x2f')]=_[_0x59f9('0x30')](db[_0x59f9('0x2a')][_0x59f9('0x2b')]);_0x4e588e[_0x59f9('0x31')]=_[_0x59f9('0x30')](_0x516d5d[_0x59f9('0x31')]);_0x4e588e[_0x59f9('0x32')]=_[_0x59f9('0x33')](_0x4e588e[_0x59f9('0x2f')],_0x4e588e[_0x59f9('0x31')]);_0x2b611f['attributes']=_[_0x59f9('0x33')](_0x4e588e[_0x59f9('0x2f')],qs[_0x59f9('0x34')](_0x516d5d[_0x59f9('0x31')]['fields']));_0x2b611f['attributes']=_0x2b611f[_0x59f9('0x35')][_0x59f9('0x43')]?_0x2b611f[_0x59f9('0x35')]:_0x4e588e[_0x59f9('0x2f')];if(_0x516d5d[_0x59f9('0x31')][_0x59f9('0x44')]){_0x2b611f[_0x59f9('0x3f')]=[{'all':!![]}];}_0x2b611f=_[_0x59f9('0x3d')]({},_0x2b611f,_0x516d5d[_0x59f9('0x3e')]);return db[_0x59f9('0x2a')][_0x59f9('0x45')](_0x2b611f)[_0x59f9('0x21')](handleEntityNotFound(_0x549653,null))[_0x59f9('0x21')](respondWithResult(_0x549653,null))['catch'](handleError(_0x549653,null));};exports['create']=function(_0x1e01bc,_0x4cd601){return db[_0x59f9('0x2a')][_0x59f9('0x46')](_0x1e01bc[_0x59f9('0x47')],{})[_0x59f9('0x21')](respondWithResult(_0x4cd601,0xc9))[_0x59f9('0x41')](handleError(_0x4cd601,null));};exports[_0x59f9('0x48')]=function(_0x1c70b0,_0x18f2f2){if(_0x1c70b0[_0x59f9('0x47')]['id']){delete _0x1c70b0[_0x59f9('0x47')]['id'];}return db[_0x59f9('0x2a')][_0x59f9('0x45')]({'where':{'id':_0x1c70b0[_0x59f9('0x42')]['id']}})[_0x59f9('0x21')](handleEntityNotFound(_0x18f2f2,null))['then'](saveUpdates(_0x1c70b0['body'],null))['then'](respondWithResult(_0x18f2f2,null))[_0x59f9('0x41')](handleError(_0x18f2f2,null));};exports[_0x59f9('0x22')]=function(_0xe04b5,_0x413426){return db[_0x59f9('0x2a')][_0x59f9('0x45')]({'where':{'id':_0xe04b5[_0x59f9('0x42')]['id']}})[_0x59f9('0x21')](handleEntityNotFound(_0x413426,null))['then'](removeEntity(_0x413426,null))[_0x59f9('0x41')](handleError(_0x413426,null));};exports[_0x59f9('0x49')]=function(_0xdc5e1e,_0x4b3d40){return db[_0x59f9('0x2a')][_0x59f9('0x49')]()['then'](respondWithResult(_0x4b3d40,null))[_0x59f9('0x41')](handleError(_0x4b3d40,null));}; \ No newline at end of file +var _0xf9ca=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','query','intersection'];(function(_0x59bd64,_0x237f2b){var _0x378c0e=function(_0x24e2be){while(--_0x24e2be){_0x59bd64['push'](_0x59bd64['shift']());}};_0x378c0e(++_0x237f2b);}(_0xf9ca,0xf6));var _0xaf9c=function(_0x38ac7d,_0xd6c03d){_0x38ac7d=_0x38ac7d-0x0;var _0x2053c1=_0xf9ca[_0x38ac7d];return _0x2053c1;};'use strict';var emlformat=require(_0xaf9c('0x0'));var rimraf=require(_0xaf9c('0x1'));var zipdir=require(_0xaf9c('0x2'));var jsonpatch=require(_0xaf9c('0x3'));var rp=require(_0xaf9c('0x4'));var moment=require(_0xaf9c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaf9c('0x6'));var util=require(_0xaf9c('0x7'));var path=require('path');var sox=require(_0xaf9c('0x8'));var csv=require(_0xaf9c('0x9'));var ejs=require(_0xaf9c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf9c('0xb'));var squel=require(_0xaf9c('0xc'));var crypto=require(_0xaf9c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaf9c('0x9'));var querystring=require(_0xaf9c('0xe'));var Papa=require(_0xaf9c('0xf'));var Redis=require(_0xaf9c('0x10'));var authService=require(_0xaf9c('0x11'));var qs=require(_0xaf9c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf9c('0x13'));var logger=require(_0xaf9c('0x14'))('api');var utils=require(_0xaf9c('0x15'));var config=require(_0xaf9c('0x16'));var licenseUtil=require(_0xaf9c('0x17'));var db=require(_0xaf9c('0x18'))['db'];function respondWithStatusCode(_0x68a523,_0xca7bf){_0xca7bf=_0xca7bf||0xcc;return function(_0x2f3687){if(_0x2f3687){return _0x68a523[_0xaf9c('0x19')](_0xca7bf);}return _0x68a523[_0xaf9c('0x1a')](_0xca7bf)['end']();};}function respondWithResult(_0x52d6f5,_0x44f0da){_0x44f0da=_0x44f0da||0xc8;return function(_0x2c3c7a){if(_0x2c3c7a){return _0x52d6f5[_0xaf9c('0x1a')](_0x44f0da)[_0xaf9c('0x1b')](_0x2c3c7a);}};}function respondWithFilteredResult(_0x5ba775,_0x4d97a6){return function(_0x1d84fd){if(_0x1d84fd){var _0x37560f=typeof _0x4d97a6[_0xaf9c('0x1c')]===_0xaf9c('0x1d')&&typeof _0x4d97a6[_0xaf9c('0x1e')]==='undefined';var _0x496e50=_0x1d84fd[_0xaf9c('0x1f')];var _0x294892=_0x37560f?0x0:_0x4d97a6['offset'];var _0x487002=_0x37560f?_0x1d84fd[_0xaf9c('0x1f')]:_0x4d97a6[_0xaf9c('0x1c')]+_0x4d97a6[_0xaf9c('0x1e')];var _0x3b8529;if(_0x487002>=_0x496e50){_0x487002=_0x496e50;_0x3b8529=0xc8;}else{_0x3b8529=0xce;}_0x5ba775[_0xaf9c('0x1a')](_0x3b8529);return _0x5ba775[_0xaf9c('0x20')](_0xaf9c('0x21'),_0x294892+'-'+_0x487002+'/'+_0x496e50)[_0xaf9c('0x1b')](_0x1d84fd);}return null;};}function patchUpdates(_0x3ef203){return function(_0x4c63e7){try{jsonpatch[_0xaf9c('0x22')](_0x4c63e7,_0x3ef203,!![]);}catch(_0x3762aa){return BPromise[_0xaf9c('0x23')](_0x3762aa);}return _0x4c63e7[_0xaf9c('0x24')]();};}function saveUpdates(_0x387766,_0x5acb19){return function(_0x20de67){if(_0x20de67){return _0x20de67[_0xaf9c('0x25')](_0x387766)[_0xaf9c('0x26')](function(_0x512c8e){return _0x512c8e;});}return null;};}function removeEntity(_0x511f67,_0x2619a9){return function(_0x27d55a){if(_0x27d55a){return _0x27d55a[_0xaf9c('0x27')]()[_0xaf9c('0x26')](function(){_0x511f67[_0xaf9c('0x1a')](0xcc)[_0xaf9c('0x28')]();});}};}function handleEntityNotFound(_0x2572d0,_0x31393d){return function(_0x4df18d){if(!_0x4df18d){_0x2572d0[_0xaf9c('0x19')](0x194);}return _0x4df18d;};}function handleError(_0x3a6b61,_0x575626){_0x575626=_0x575626||0x1f4;return function(_0x231025){logger['error'](_0x231025['stack']);if(_0x231025[_0xaf9c('0x29')]){delete _0x231025['name'];}_0x3a6b61['status'](_0x575626)[_0xaf9c('0x2a')](_0x231025);};}exports[_0xaf9c('0x2b')]=function(_0xedc6f2,_0xf44b9e){var _0x8f7d95={},_0x54e039={},_0x12b042={'count':0x0,'rows':[]};var _0xf9ea0e=_[_0xaf9c('0x2c')](db[_0xaf9c('0x2d')][_0xaf9c('0x2e')],function(_0x7a9c4e){return{'name':_0x7a9c4e[_0xaf9c('0x2f')],'type':_0x7a9c4e['type']['key']};});_0x54e039['model']=_[_0xaf9c('0x2c')](_0xf9ea0e,_0xaf9c('0x29'));_0x54e039[_0xaf9c('0x30')]=_['keys'](_0xedc6f2['query']);_0x54e039['filters']=_[_0xaf9c('0x31')](_0x54e039[_0xaf9c('0x32')],_0x54e039[_0xaf9c('0x30')]);_0x8f7d95['attributes']=_[_0xaf9c('0x31')](_0x54e039[_0xaf9c('0x32')],qs[_0xaf9c('0x33')](_0xedc6f2[_0xaf9c('0x30')][_0xaf9c('0x33')]));_0x8f7d95[_0xaf9c('0x34')]=_0x8f7d95[_0xaf9c('0x34')][_0xaf9c('0x35')]?_0x8f7d95[_0xaf9c('0x34')]:_0x54e039[_0xaf9c('0x32')];if(!_0xedc6f2[_0xaf9c('0x30')][_0xaf9c('0x36')](_0xaf9c('0x37'))){_0x8f7d95[_0xaf9c('0x1e')]=qs[_0xaf9c('0x1e')](_0xedc6f2['query'][_0xaf9c('0x1e')]);_0x8f7d95[_0xaf9c('0x1c')]=qs[_0xaf9c('0x1c')](_0xedc6f2[_0xaf9c('0x30')][_0xaf9c('0x1c')]);}_0x8f7d95[_0xaf9c('0x38')]=qs[_0xaf9c('0x39')](_0xedc6f2[_0xaf9c('0x30')][_0xaf9c('0x39')]);_0x8f7d95[_0xaf9c('0x3a')]=qs[_0xaf9c('0x3b')](_[_0xaf9c('0x3c')](_0xedc6f2[_0xaf9c('0x30')],_0x54e039[_0xaf9c('0x3b')]),_0xf9ea0e);if(_0xedc6f2[_0xaf9c('0x30')][_0xaf9c('0x3d')]){_0x8f7d95[_0xaf9c('0x3a')]=_[_0xaf9c('0x3e')](_0x8f7d95[_0xaf9c('0x3a')],{'$or':_[_0xaf9c('0x2c')](_0xf9ea0e,function(_0x1132e1){if(_0x1132e1['type']!==_0xaf9c('0x3f')){var _0xc77bf7={};_0xc77bf7[_0x1132e1[_0xaf9c('0x29')]]={'$like':'%'+_0xedc6f2[_0xaf9c('0x30')][_0xaf9c('0x3d')]+'%'};return _0xc77bf7;}})});}_0x8f7d95=_[_0xaf9c('0x3e')]({},_0x8f7d95,_0xedc6f2[_0xaf9c('0x40')]);var _0x284c03={'where':_0x8f7d95['where']};return db[_0xaf9c('0x2d')][_0xaf9c('0x1f')](_0x284c03)[_0xaf9c('0x26')](function(_0x180164){_0x12b042[_0xaf9c('0x1f')]=_0x180164;if(_0xedc6f2[_0xaf9c('0x30')][_0xaf9c('0x41')]){_0x8f7d95['include']=[{'all':!![]}];}return db[_0xaf9c('0x2d')]['findAll'](_0x8f7d95);})[_0xaf9c('0x26')](function(_0x9f57df){_0x12b042['rows']=_0x9f57df;return _0x12b042;})[_0xaf9c('0x26')](respondWithFilteredResult(_0xf44b9e,_0x8f7d95))[_0xaf9c('0x42')](handleError(_0xf44b9e,null));};exports[_0xaf9c('0x43')]=function(_0xb954d6,_0x10002a){var _0x54b34a={'raw':!![],'where':{'id':_0xb954d6[_0xaf9c('0x44')]['id']}},_0x103a4b={};_0x103a4b[_0xaf9c('0x32')]=_[_0xaf9c('0x45')](db['SquareDetailsReport'][_0xaf9c('0x2e')]);_0x103a4b[_0xaf9c('0x30')]=_['keys'](_0xb954d6[_0xaf9c('0x30')]);_0x103a4b['filters']=_['intersection'](_0x103a4b[_0xaf9c('0x32')],_0x103a4b[_0xaf9c('0x30')]);_0x54b34a['attributes']=_[_0xaf9c('0x31')](_0x103a4b[_0xaf9c('0x32')],qs['fields'](_0xb954d6[_0xaf9c('0x30')][_0xaf9c('0x33')]));_0x54b34a['attributes']=_0x54b34a['attributes'][_0xaf9c('0x35')]?_0x54b34a[_0xaf9c('0x34')]:_0x103a4b[_0xaf9c('0x32')];if(_0xb954d6['query'][_0xaf9c('0x41')]){_0x54b34a['include']=[{'all':!![]}];}_0x54b34a=_['merge']({},_0x54b34a,_0xb954d6[_0xaf9c('0x40')]);return db[_0xaf9c('0x2d')][_0xaf9c('0x46')](_0x54b34a)[_0xaf9c('0x26')](handleEntityNotFound(_0x10002a,null))[_0xaf9c('0x26')](respondWithResult(_0x10002a,null))['catch'](handleError(_0x10002a,null));};exports[_0xaf9c('0x47')]=function(_0x32cbb0,_0x17a141){return db[_0xaf9c('0x2d')][_0xaf9c('0x47')](_0x32cbb0[_0xaf9c('0x48')],{})['then'](respondWithResult(_0x17a141,0xc9))[_0xaf9c('0x42')](handleError(_0x17a141,null));};exports[_0xaf9c('0x25')]=function(_0x2f6f34,_0x5ca92b){if(_0x2f6f34[_0xaf9c('0x48')]['id']){delete _0x2f6f34[_0xaf9c('0x48')]['id'];}return db['SquareDetailsReport'][_0xaf9c('0x46')]({'where':{'id':_0x2f6f34['params']['id']}})[_0xaf9c('0x26')](handleEntityNotFound(_0x5ca92b,null))[_0xaf9c('0x26')](saveUpdates(_0x2f6f34[_0xaf9c('0x48')],null))['then'](respondWithResult(_0x5ca92b,null))[_0xaf9c('0x42')](handleError(_0x5ca92b,null));};exports[_0xaf9c('0x27')]=function(_0xb5641b,_0x655487){return db[_0xaf9c('0x2d')][_0xaf9c('0x46')]({'where':{'id':_0xb5641b[_0xaf9c('0x44')]['id']}})[_0xaf9c('0x26')](handleEntityNotFound(_0x655487,null))[_0xaf9c('0x26')](removeEntity(_0x655487,null))['catch'](handleError(_0x655487,null));};exports[_0xaf9c('0x49')]=function(_0x457250,_0x585be7){return db['SquareDetailsReport'][_0xaf9c('0x49')]()['then'](respondWithResult(_0x585be7,null))[_0xaf9c('0x42')](handleError(_0x585be7,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b958dd9..4ed9ee8 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 _0x3072=['../../config/environment','exports','SquareDetailsReport','api','bluebird','request-promise','rimraf'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x3072,0x96));var _0x2307=function(_0x4b49d9,_0x9b9f33){_0x4b49d9=_0x4b49d9-0x0;var _0x1482ff=_0x3072[_0x4b49d9];return _0x1482ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2307('0x0'));var moment=require('moment');var BPromise=require(_0x2307('0x1'));var rp=require(_0x2307('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2307('0x3'));var config=require(_0x2307('0x4'));var attributes=require('./squareReportDetail.attributes');module[_0x2307('0x5')]=function(_0x50620d,_0x139c7c){return _0x50620d['define'](_0x2307('0x6'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf6f=['report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x1ff968,_0x1ec47b){var _0x133077=function(_0x31ee18){while(--_0x31ee18){_0x1ff968['push'](_0x1ff968['shift']());}};_0x133077(++_0x1ec47b);}(_0xbf6f,0x85));var _0xfbf6=function(_0x432295,_0x3de054){_0x432295=_0x432295-0x0;var _0x5a44e0=_0xbf6f[_0x432295];return _0x5a44e0;};'use strict';var _=require(_0xfbf6('0x0'));var util=require('util');var logger=require(_0xfbf6('0x1'))(_0xfbf6('0x2'));var moment=require(_0xfbf6('0x3'));var BPromise=require(_0xfbf6('0x4'));var rp=require(_0xfbf6('0x5'));var fs=require('fs');var path=require(_0xfbf6('0x6'));var rimraf=require('rimraf');var config=require(_0xfbf6('0x7'));var attributes=require(_0xfbf6('0x8'));module[_0xfbf6('0x9')]=function(_0x5386d7,_0x16cdbf){return _0x5386d7[_0xfbf6('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xfbf6('0xb'),'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 541797f..4eadc1b 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 _0x55f1=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info'];(function(_0xe2726a,_0x4cbdf0){var _0x3afdff=function(_0x9de232){while(--_0x9de232){_0xe2726a['push'](_0xe2726a['shift']());}};_0x3afdff(++_0x4cbdf0);}(_0x55f1,0x9b));var _0x155f=function(_0x496c2a,_0x23ad31){_0x496c2a=_0x496c2a-0x0;var _0x2adda3=_0x55f1[_0x496c2a];return _0x2adda3;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22e07f,_0x39b14d,_0x1bcf84){return new BPromise(function(_0x2a0a02,_0x9fc06e){return client[_0x155f('0xa')](_0x22e07f,_0x1bcf84)[_0x155f('0xb')](function(_0x100e9a){logger[_0x155f('0xc')](_0x155f('0xd'),_0x39b14d,_0x155f('0xe'));logger[_0x155f('0xf')](_0x155f('0x10'),_0x39b14d,_0x155f('0xe'),JSON[_0x155f('0x11')](_0x100e9a));if(_0x100e9a[_0x155f('0x12')]){if(_0x100e9a['error'][_0x155f('0x13')]===0x1f4){logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x100e9a['error']['message']);return _0x9fc06e(_0x100e9a[_0x155f('0x12')][_0x155f('0x14')]);}logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x100e9a[_0x155f('0x12')][_0x155f('0x14')]);return _0x2a0a02(_0x100e9a[_0x155f('0x12')]['message']);}else{logger[_0x155f('0xc')](_0x155f('0xd'),_0x39b14d,'request\x20sent');_0x2a0a02(_0x100e9a[_0x155f('0x15')][_0x155f('0x14')]);}})[_0x155f('0x16')](function(_0x7ad1c2){logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x7ad1c2);_0x9fc06e(_0x7ad1c2);});});}exports[_0x155f('0x17')]=function(_0x343a1e){var _0x2f5b83=this;return new Promise(function(_0x407e26,_0x2e248d){return db[_0x155f('0x18')][_0x155f('0x19')](_0x343a1e[_0x155f('0x1a')],{'raw':_0x343a1e[_0x155f('0x1b')]?_0x343a1e[_0x155f('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x155f('0xb')](function(_0x26a322){logger[_0x155f('0xc')](_0x155f('0x17'),_0x343a1e);logger['debug']('CreateSquareDetailsReport',_0x343a1e,JSON['stringify'](_0x26a322));_0x407e26(_0x26a322);})[_0x155f('0x16')](function(_0x3a40b4){logger[_0x155f('0x12')](_0x155f('0x17'),_0x3a40b4[_0x155f('0x14')],_0x343a1e);_0x2e248d(_0x2f5b83['error'](0x1f4,_0x3a40b4[_0x155f('0x14')]));});});}; \ No newline at end of file +var _0xe9e8=['info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xe9e8,0x6b));var _0x8e9e=function(_0xd7afd9,_0x1a7995){_0xd7afd9=_0xd7afd9-0x0;var _0x1347ea=_0xe9e8[_0xd7afd9];return _0x1347ea;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204f5c,_0x1fb8d3,_0x58f822){return new BPromise(function(_0x3b5d21,_0x2ae896){return client[_0x8e9e('0xc')](_0x204f5c,_0x58f822)['then'](function(_0x39f5e5){logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');logger[_0x8e9e('0xf')](_0x8e9e('0x10'),_0x1fb8d3,_0x8e9e('0x11'),JSON[_0x8e9e('0x12')](_0x39f5e5));if(_0x39f5e5[_0x8e9e('0x13')]){if(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x14')]===0x1f4){logger['error'](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5['error'][_0x8e9e('0x15')]);return _0x2ae896(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);}logger[_0x8e9e('0x13')](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);return _0x3b5d21(_0x39f5e5['error']['message']);}else{logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');_0x3b5d21(_0x39f5e5[_0x8e9e('0x16')][_0x8e9e('0x15')]);}})[_0x8e9e('0x17')](function(_0x22b2c7){logger[_0x8e9e('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x1fb8d3,_0x22b2c7);_0x2ae896(_0x22b2c7);});});}exports['CreateSquareDetailsReport']=function(_0x42f8e8){var _0x40f4fd=this;return new Promise(function(_0x41cdc0,_0x28584b){return db[_0x8e9e('0x18')][_0x8e9e('0x19')](_0x42f8e8[_0x8e9e('0x1a')],{'raw':_0x42f8e8['options']?_0x42f8e8[_0x8e9e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8e9e('0x1c')](function(_0x19a890){logger['info'](_0x8e9e('0x1d'),_0x42f8e8);logger[_0x8e9e('0xf')](_0x8e9e('0x1d'),_0x42f8e8,JSON[_0x8e9e('0x12')](_0x19a890));_0x41cdc0(_0x19a890);})[_0x8e9e('0x17')](function(_0x6a311b){logger[_0x8e9e('0x13')](_0x8e9e('0x1d'),_0x6a311b['message'],_0x42f8e8);_0x28584b(_0x40f4fd['error'](0x1f4,_0x6a311b[_0x8e9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 56c59f2..5b84b95 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 _0xda52=['get','/process/:pid/kill','killProcess','exports','express','./system.controller','isAuthenticated'];(function(_0x359848,_0x4e288e){var _0x3943d2=function(_0x231872){while(--_0x231872){_0x359848['push'](_0x359848['shift']());}};_0x3943d2(++_0x4e288e);}(_0xda52,0x1c4));var _0x2da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda52[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x2da5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x2da5('0x1'));router['get']('/',auth[_0x2da5('0x2')](),controller['index']);router[_0x2da5('0x3')](_0x2da5('0x4'),auth[_0x2da5('0x2')](),controller[_0x2da5('0x5')]);module[_0x2da5('0x6')]=router; \ No newline at end of file +var _0x0ce6=['index','/process/:pid/kill','isAuthenticated','exports','express','Router','../../components/auth/service','get'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0ce6,0xfc));var _0x60ce=function(_0x25e7fb,_0x12a75e){_0x25e7fb=_0x25e7fb-0x0;var _0x501c08=_0x0ce6[_0x25e7fb];return _0x501c08;};'use strict';var express=require(_0x60ce('0x0'));var router=express[_0x60ce('0x1')]();var auth=require(_0x60ce('0x2'));var controller=require('./system.controller');router[_0x60ce('0x3')]('/',auth['isAuthenticated'](),controller[_0x60ce('0x4')]);router[_0x60ce('0x3')](_0x60ce('0x5'),auth[_0x60ce('0x6')](),controller['killProcess']);module[_0x60ce('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 07f6caf..c221363 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 _0xbf40=['then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','params','kill','killProcess','child_process','exec','util','bluebird','inspect','name','status','send','index','getAllData'];(function(_0x2e0ff3,_0x577f33){var _0x4835dc=function(_0x1144ec){while(--_0x1144ec){_0x2e0ff3['push'](_0x2e0ff3['shift']());}};_0x4835dc(++_0x577f33);}(_0xbf40,0xbc));var _0x0bf4=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xbf40[_0x3b1b23];return _0x1efc85;};'use strict';var info=require('systeminformation');var exec=require(_0x0bf4('0x0'))[_0x0bf4('0x1')];var logger=require('../../config/logger')('api');var util=require(_0x0bf4('0x2'));var BPromise=require(_0x0bf4('0x3'));var _=require('lodash');function handleError(_0x109374,_0x4f1118,_0x5066ee){_0x4f1118=_0x4f1118||0x1f4;return function(_0x4b43af){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5066ee,_0x4f1118,util[_0x0bf4('0x4')](_0x4b43af,{'showHidden':![],'depth':null}));delete _0x4b43af[_0x0bf4('0x5')];_0x109374[_0x0bf4('0x6')](_0x4f1118)[_0x0bf4('0x7')](_0x4b43af);};}exports[_0x0bf4('0x8')]=function(_0x18e75e,_0x26902a){return info[_0x0bf4('0x9')]()[_0x0bf4('0xa')](function(_0x238669){return _0x26902a[_0x0bf4('0x6')](0xc8)[_0x0bf4('0xb')](_0x238669);})[_0x0bf4('0xc')](function(_0x27c8e4){return _0x26902a[_0x0bf4('0x6')](0x1f4)[_0x0bf4('0xb')](_0x27c8e4);});};exports['killProcess']=function(_0x6aff49,_0x4e4bbc){var _0xa8d6de=[_0x0bf4('0xd')];return new BPromise(function(_0x848c93,_0x45a51d){return exec(util[_0x0bf4('0xe')](_0x0bf4('0xf'),_0x6aff49['params'][_0x0bf4('0x10')]),function(_0x201026,_0x211a05,_0x2f403d){if(_0x201026){return _0x45a51d(_0x201026);}return _0x848c93(_0x211a05);});})['then'](function(_0x1118c2){var _0x1f0570=![];var _0x31c668=_0x1118c2['split'](/\n/);for(var _0x2bf186=0x0,_0x3a8129=_0xa8d6de[_0x0bf4('0x11')];_0x2bf186<_0x3a8129,_0x1f0570===![];_0x2bf186+=0x1){if(_0x1118c2[_0x0bf4('0x12')](_0xa8d6de[_0x2bf186])>=0x0){_0x1f0570=!![];}}if(!_0x1f0570){throw new Error(util[_0x0bf4('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x6aff49[_0x0bf4('0x13')][_0x0bf4('0x10')]));}process[_0x0bf4('0x14')](_0x6aff49['params'][_0x0bf4('0x10')],'SIGINT');return _0x4e4bbc[_0x0bf4('0x6')](0xc8)[_0x0bf4('0xb')]({'message':util[_0x0bf4('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x6aff49[_0x0bf4('0x13')][_0x0bf4('0x10')])});})[_0x0bf4('0xc')](handleError(_0x4e4bbc,null,_0x0bf4('0x15')));}; \ No newline at end of file +var _0x83e8=['error','inspect','name','status','getAllData','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','params','catch','systeminformation','exec','../../config/logger','util','bluebird'];(function(_0x3acf11,_0x3012b3){var _0x8179d4=function(_0x5185bd){while(--_0x5185bd){_0x3acf11['push'](_0x3acf11['shift']());}};_0x8179d4(++_0x3012b3);}(_0x83e8,0xd7));var _0x883e=function(_0x7b4912,_0x44bf2b){_0x7b4912=_0x7b4912-0x0;var _0x3c40a3=_0x83e8[_0x7b4912];return _0x3c40a3;};'use strict';var info=require(_0x883e('0x0'));var exec=require('child_process')[_0x883e('0x1')];var logger=require(_0x883e('0x2'))('api');var util=require(_0x883e('0x3'));var BPromise=require(_0x883e('0x4'));var _=require('lodash');function handleError(_0x12411c,_0x3b214b,_0x45e219){_0x3b214b=_0x3b214b||0x1f4;return function(_0x4bc196){logger[_0x883e('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x45e219,_0x3b214b,util[_0x883e('0x6')](_0x4bc196,{'showHidden':![],'depth':null}));delete _0x4bc196[_0x883e('0x7')];_0x12411c[_0x883e('0x8')](_0x3b214b)['send'](_0x4bc196);};}exports['index']=function(_0x30af4e,_0x3b60ab){return info[_0x883e('0x9')]()[_0x883e('0xa')](function(_0x3ed374){return _0x3b60ab[_0x883e('0x8')](0xc8)[_0x883e('0xb')](_0x3ed374);})['catch'](function(_0xefb4f){return _0x3b60ab['status'](0x1f4)[_0x883e('0xb')](_0xefb4f);});};exports[_0x883e('0xc')]=function(_0xdd679b,_0x3b86dc){var _0x5cd1af=['components/import/cm'];return new BPromise(function(_0x3a3c23,_0x37c974){return exec(util[_0x883e('0xd')](_0x883e('0xe'),_0xdd679b['params']['pid']),function(_0x17e940,_0x517f0e,_0x1d2705){if(_0x17e940){return _0x37c974(_0x17e940);}return _0x3a3c23(_0x517f0e);});})['then'](function(_0xf7101f){var _0x2e8f87=![];var _0x3de4df=_0xf7101f[_0x883e('0xf')](/\n/);for(var _0x40ba18=0x0,_0x58ea56=_0x5cd1af[_0x883e('0x10')];_0x40ba18<_0x58ea56,_0x2e8f87===![];_0x40ba18+=0x1){if(_0xf7101f['indexOf'](_0x5cd1af[_0x40ba18])>=0x0){_0x2e8f87=!![];}}if(!_0x2e8f87){throw new Error(util[_0x883e('0xd')](_0x883e('0x11'),_0xdd679b['params'][_0x883e('0x12')]));}process[_0x883e('0x13')](_0xdd679b['params']['pid'],'SIGINT');return _0x3b86dc['status'](0xc8)[_0x883e('0xb')]({'message':util[_0x883e('0xd')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0xdd679b[_0x883e('0x14')][_0x883e('0x12')])});})[_0x883e('0x15')](handleError(_0x3b86dc,null,_0x883e('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8d40178..f671fca 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 _0xace1=['./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3a87fd,_0x2a0cc0){var _0x324a63=function(_0x40ae69){while(--_0x40ae69){_0x3a87fd['push'](_0x3a87fd['shift']());}};_0x324a63(++_0x2a0cc0);}(_0xace1,0x11b));var _0x1ace=function(_0x3dc30d,_0x3eee3c){_0x3dc30d=_0x3dc30d-0x0;var _0x225236=_0xace1[_0x3dc30d];return _0x225236;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1ace('0x0'));var timeout=require(_0x1ace('0x1'));var express=require(_0x1ace('0x2'));var router=express[_0x1ace('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ace('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1ace('0x5'));router[_0x1ace('0x6')]('/',auth[_0x1ace('0x7')](),controller[_0x1ace('0x8')]);router[_0x1ace('0x6')](_0x1ace('0x9'),auth[_0x1ace('0x7')](),controller[_0x1ace('0xa')]);router[_0x1ace('0xb')]('/',auth[_0x1ace('0x7')](),controller[_0x1ace('0xc')]);router[_0x1ace('0xd')](_0x1ace('0x9'),auth[_0x1ace('0x7')](),controller['update']);router[_0x1ace('0xe')](_0x1ace('0x9'),auth[_0x1ace('0x7')](),controller[_0x1ace('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf4d6=['index','get','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated'];(function(_0x3345f6,_0xe0bc90){var _0x1b4b0c=function(_0x362cbd){while(--_0x362cbd){_0x3345f6['push'](_0x3345f6['shift']());}};_0x1b4b0c(++_0xe0bc90);}(_0xf4d6,0xc6));var _0x6f4d=function(_0x57fcc7,_0x36e087){_0x57fcc7=_0x57fcc7-0x0;var _0x44d20a=_0xf4d6[_0x57fcc7];return _0x44d20a;};'use strict';var multer=require(_0x6f4d('0x0'));var util=require(_0x6f4d('0x1'));var path=require(_0x6f4d('0x2'));var timeout=require(_0x6f4d('0x3'));var express=require(_0x6f4d('0x4'));var router=express[_0x6f4d('0x5')]();var fs_extra=require(_0x6f4d('0x6'));var auth=require(_0x6f4d('0x7'));var interaction=require(_0x6f4d('0x8'));var config=require(_0x6f4d('0x9'));var controller=require(_0x6f4d('0xa'));router['get']('/',auth[_0x6f4d('0xb')](),controller[_0x6f4d('0xc')]);router[_0x6f4d('0xd')]('/:id',auth[_0x6f4d('0xb')](),controller['show']);router[_0x6f4d('0xe')]('/',auth[_0x6f4d('0xb')](),controller[_0x6f4d('0xf')]);router[_0x6f4d('0x10')](_0x6f4d('0x11'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x12')]);router['delete'](_0x6f4d('0x11'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x13')]);module[_0x6f4d('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 866c521..bb8a17d 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 _0xc2da=['sequelize','STRING'];(function(_0x2b8388,_0x246b8f){var _0x3ba12a=function(_0x848995){while(--_0x848995){_0x2b8388['push'](_0x2b8388['shift']());}};_0x3ba12a(++_0x246b8f);}(_0xc2da,0x124));var _0xac2d=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0xc2da[_0x3b56c0];return _0x377efe;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'name':{'type':Sequelize[_0xac2d('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xac2d('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xac2d('0x1')]}}; \ No newline at end of file +var _0x18c9=['#0091EA','sequelize','exports','STRING','name'];(function(_0x2a071e,_0x1b7960){var _0x10f862=function(_0x2f69b3){while(--_0x2f69b3){_0x2a071e['push'](_0x2a071e['shift']());}};_0x10f862(++_0x1b7960);}(_0x18c9,0x13c));var _0x918c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x18c9[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x918c('0x0'));module[_0x918c('0x1')]={'name':{'type':Sequelize[_0x918c('0x2')],'unique':_0x918c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x918c('0x2')],'defaultValue':_0x918c('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5521a20..8381640 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 _0x0b78=['model','map','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','Tag','rawAttributes','type','key'];(function(_0x29a790,_0x425fe9){var _0x236cb2=function(_0x3e3bd8){while(--_0x3e3bd8){_0x29a790['push'](_0x29a790['shift']());}};_0x236cb2(++_0x425fe9);}(_0x0b78,0x1ad));var _0x80b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0b78[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x80b7('0x0'));var rimraf=require(_0x80b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80b7('0x2'));var rp=require(_0x80b7('0x3'));var moment=require('moment');var BPromise=require(_0x80b7('0x4'));var Mustache=require('mustache');var util=require(_0x80b7('0x5'));var path=require(_0x80b7('0x6'));var sox=require(_0x80b7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80b7('0x8'));var _=require('lodash');var squel=require(_0x80b7('0x9'));var crypto=require(_0x80b7('0xa'));var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x80b7('0xd'));var Papa=require(_0x80b7('0xe'));var Redis=require(_0x80b7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80b7('0x11'));var logger=require(_0x80b7('0x12'))(_0x80b7('0x13'));var utils=require(_0x80b7('0x14'));var config=require(_0x80b7('0x15'));var licenseUtil=require(_0x80b7('0x16'));var db=require(_0x80b7('0x17'))['db'];function respondWithStatusCode(_0x145241,_0x323d06){_0x323d06=_0x323d06||0xcc;return function(_0x366e34){if(_0x366e34){return _0x145241[_0x80b7('0x18')](_0x323d06);}return _0x145241['status'](_0x323d06)[_0x80b7('0x19')]();};}function respondWithResult(_0x401ad3,_0x527c5b){_0x527c5b=_0x527c5b||0xc8;return function(_0x2ee168){if(_0x2ee168){return _0x401ad3[_0x80b7('0x1a')](_0x527c5b)['json'](_0x2ee168);}};}function respondWithFilteredResult(_0x46822c,_0x3b6b13){return function(_0x21ea65){if(_0x21ea65){var _0x2c0c4e=typeof _0x3b6b13[_0x80b7('0x1b')]===_0x80b7('0x1c')&&typeof _0x3b6b13[_0x80b7('0x1d')]===_0x80b7('0x1c');var _0x2d4008=_0x21ea65[_0x80b7('0x1e')];var _0x4c12b1=_0x2c0c4e?0x0:_0x3b6b13[_0x80b7('0x1b')];var _0x1d62ed=_0x2c0c4e?_0x21ea65[_0x80b7('0x1e')]:_0x3b6b13[_0x80b7('0x1b')]+_0x3b6b13['limit'];var _0x48c356;if(_0x1d62ed>=_0x2d4008){_0x1d62ed=_0x2d4008;_0x48c356=0xc8;}else{_0x48c356=0xce;}_0x46822c[_0x80b7('0x1a')](_0x48c356);return _0x46822c[_0x80b7('0x1f')](_0x80b7('0x20'),_0x4c12b1+'-'+_0x1d62ed+'/'+_0x2d4008)[_0x80b7('0x21')](_0x21ea65);}return null;};}function patchUpdates(_0x574e5c){return function(_0x4f6eec){try{jsonpatch[_0x80b7('0x22')](_0x4f6eec,_0x574e5c,!![]);}catch(_0x3aed77){return BPromise[_0x80b7('0x23')](_0x3aed77);}return _0x4f6eec[_0x80b7('0x24')]();};}function saveUpdates(_0x527d0f,_0x18d407){return function(_0x4c3bed){if(_0x4c3bed){return _0x4c3bed['update'](_0x527d0f)[_0x80b7('0x25')](function(_0xdab5e0){return _0xdab5e0;});}return null;};}function removeEntity(_0x65d31d,_0x155c00){return function(_0x3f3aa5){if(_0x3f3aa5){return _0x3f3aa5[_0x80b7('0x26')]()[_0x80b7('0x25')](function(){var _0x8fa95e=_0x3f3aa5[_0x80b7('0x27')]({'plain':!![]});var _0x1e751a=_0x80b7('0x28');return db[_0x80b7('0x29')][_0x80b7('0x26')]({'where':{'type':_0x1e751a,'resourceId':_0x8fa95e['id']}})[_0x80b7('0x25')](function(){return _0x3f3aa5;});})[_0x80b7('0x25')](function(){_0x65d31d['status'](0xcc)[_0x80b7('0x19')]();});}};}function handleEntityNotFound(_0x1661be,_0x5e3f6f){return function(_0x370bfb){if(!_0x370bfb){_0x1661be[_0x80b7('0x18')](0x194);}return _0x370bfb;};}function handleError(_0x17d845,_0x5497e2){_0x5497e2=_0x5497e2||0x1f4;return function(_0x1b7715){logger[_0x80b7('0x2a')](_0x1b7715[_0x80b7('0x2b')]);if(_0x1b7715[_0x80b7('0x2c')]){delete _0x1b7715[_0x80b7('0x2c')];}_0x17d845[_0x80b7('0x1a')](_0x5497e2)[_0x80b7('0x2d')](_0x1b7715);};}exports[_0x80b7('0x2e')]=function(_0x3fbdf3,_0x940c7a){var _0x3fb3da={},_0x44c3ec={},_0xf35e83={'count':0x0,'rows':[]};var _0x4ae8ad=_['map'](db[_0x80b7('0x2f')][_0x80b7('0x30')],function(_0x4fa26a){return{'name':_0x4fa26a['fieldName'],'type':_0x4fa26a[_0x80b7('0x31')][_0x80b7('0x32')]};});_0x44c3ec[_0x80b7('0x33')]=_[_0x80b7('0x34')](_0x4ae8ad,_0x80b7('0x2c'));_0x44c3ec[_0x80b7('0x35')]=_['keys'](_0x3fbdf3[_0x80b7('0x35')]);_0x44c3ec[_0x80b7('0x36')]=_[_0x80b7('0x37')](_0x44c3ec[_0x80b7('0x33')],_0x44c3ec['query']);_0x3fb3da[_0x80b7('0x38')]=_[_0x80b7('0x37')](_0x44c3ec['model'],qs[_0x80b7('0x39')](_0x3fbdf3[_0x80b7('0x35')][_0x80b7('0x39')]));_0x3fb3da[_0x80b7('0x38')]=_0x3fb3da[_0x80b7('0x38')][_0x80b7('0x3a')]?_0x3fb3da[_0x80b7('0x38')]:_0x44c3ec[_0x80b7('0x33')];if(!_0x3fbdf3['query']['hasOwnProperty']('nolimit')){_0x3fb3da[_0x80b7('0x1d')]=qs[_0x80b7('0x1d')](_0x3fbdf3[_0x80b7('0x35')][_0x80b7('0x1d')]);_0x3fb3da[_0x80b7('0x1b')]=qs[_0x80b7('0x1b')](_0x3fbdf3[_0x80b7('0x35')][_0x80b7('0x1b')]);}_0x3fb3da['order']=qs[_0x80b7('0x3b')](_0x3fbdf3[_0x80b7('0x35')][_0x80b7('0x3b')]);_0x3fb3da[_0x80b7('0x3c')]=qs[_0x80b7('0x36')](_[_0x80b7('0x3d')](_0x3fbdf3['query'],_0x44c3ec[_0x80b7('0x36')]),_0x4ae8ad);if(_0x3fbdf3['query'][_0x80b7('0x3e')]){_0x3fb3da[_0x80b7('0x3c')]=_['merge'](_0x3fb3da['where'],{'$or':_[_0x80b7('0x34')](_0x4ae8ad,function(_0x5e21eb){if(_0x5e21eb['type']!==_0x80b7('0x3f')){var _0x2f3b26={};_0x2f3b26[_0x5e21eb['name']]={'$like':'%'+_0x3fbdf3[_0x80b7('0x35')][_0x80b7('0x3e')]+'%'};return _0x2f3b26;}})});}_0x3fb3da=_['merge']({},_0x3fb3da,_0x3fbdf3['options']);var _0x2fdd6d={'where':_0x3fb3da[_0x80b7('0x3c')]};return db[_0x80b7('0x2f')][_0x80b7('0x1e')](_0x2fdd6d)[_0x80b7('0x25')](function(_0x21d4f2){_0xf35e83['count']=_0x21d4f2;if(_0x3fbdf3[_0x80b7('0x35')][_0x80b7('0x40')]){_0x3fb3da[_0x80b7('0x41')]=[{'all':!![]}];}return db[_0x80b7('0x2f')]['findAll'](_0x3fb3da);})[_0x80b7('0x25')](function(_0x5741ec){_0xf35e83[_0x80b7('0x42')]=_0x5741ec;return _0xf35e83;})[_0x80b7('0x25')](respondWithFilteredResult(_0x940c7a,_0x3fb3da))[_0x80b7('0x43')](handleError(_0x940c7a,null));};exports[_0x80b7('0x44')]=function(_0x132a0d,_0x3be2eb){var _0x3e77e4={'raw':!![],'where':{'id':_0x132a0d[_0x80b7('0x45')]['id']}},_0x39cd2c={};_0x39cd2c[_0x80b7('0x33')]=_[_0x80b7('0x46')](db[_0x80b7('0x2f')][_0x80b7('0x30')]);_0x39cd2c['query']=_[_0x80b7('0x46')](_0x132a0d[_0x80b7('0x35')]);_0x39cd2c['filters']=_[_0x80b7('0x37')](_0x39cd2c['model'],_0x39cd2c['query']);_0x3e77e4[_0x80b7('0x38')]=_['intersection'](_0x39cd2c['model'],qs[_0x80b7('0x39')](_0x132a0d[_0x80b7('0x35')]['fields']));_0x3e77e4[_0x80b7('0x38')]=_0x3e77e4[_0x80b7('0x38')][_0x80b7('0x3a')]?_0x3e77e4['attributes']:_0x39cd2c[_0x80b7('0x33')];if(_0x132a0d[_0x80b7('0x35')][_0x80b7('0x40')]){_0x3e77e4[_0x80b7('0x41')]=[{'all':!![]}];}_0x3e77e4=_['merge']({},_0x3e77e4,_0x132a0d['options']);return db['Tag'][_0x80b7('0x47')](_0x3e77e4)[_0x80b7('0x25')](handleEntityNotFound(_0x3be2eb,null))[_0x80b7('0x25')](respondWithResult(_0x3be2eb,null))[_0x80b7('0x43')](handleError(_0x3be2eb,null));};exports[_0x80b7('0x48')]=function(_0x44b23d,_0x398925){return db[_0x80b7('0x2f')]['create'](_0x44b23d['body'],{})[_0x80b7('0x25')](function(_0x13ebaa){var _0x3d01c6=_0x44b23d[_0x80b7('0x49')][_0x80b7('0x27')]({'plain':!![]});if(!_0x3d01c6)throw new Error(_0x80b7('0x4a'));if(_0x3d01c6['role']===_0x80b7('0x49')){var _0x36e5a5=_0x13ebaa['get']({'plain':!![]});var _0x12dc7b=_0x80b7('0x28');return db[_0x80b7('0x4b')]['find']({'where':{'name':_0x12dc7b,'userProfileId':_0x3d01c6['userProfileId']},'raw':!![]})[_0x80b7('0x25')](function(_0x66202){if(_0x66202&&_0x66202[_0x80b7('0x4c')]===0x0){return db[_0x80b7('0x29')][_0x80b7('0x48')]({'name':_0x36e5a5[_0x80b7('0x2c')],'resourceId':_0x36e5a5['id'],'type':_0x66202['name'],'sectionId':_0x66202['id']},{})[_0x80b7('0x25')](function(){return _0x13ebaa;});}else{return _0x13ebaa;}})[_0x80b7('0x43')](function(_0xeece0a){logger[_0x80b7('0x2a')](_0x80b7('0x4d'),_0xeece0a);throw _0xeece0a;});}return _0x13ebaa;})['then'](respondWithResult(_0x398925,0xc9))['catch'](handleError(_0x398925,null));};exports[_0x80b7('0x4e')]=function(_0x2129d3,_0x274708){if(_0x2129d3['body']['id']){delete _0x2129d3[_0x80b7('0x4f')]['id'];}return db['Tag'][_0x80b7('0x47')]({'where':{'id':_0x2129d3[_0x80b7('0x45')]['id']}})[_0x80b7('0x25')](handleEntityNotFound(_0x274708,null))[_0x80b7('0x25')](saveUpdates(_0x2129d3[_0x80b7('0x4f')],null))[_0x80b7('0x25')](respondWithResult(_0x274708,null))[_0x80b7('0x43')](handleError(_0x274708,null));};exports[_0x80b7('0x26')]=function(_0x43ea4f,_0x4f2588){return db[_0x80b7('0x2f')][_0x80b7('0x47')]({'where':{'id':_0x43ea4f[_0x80b7('0x45')]['id']}})[_0x80b7('0x25')](handleEntityNotFound(_0x4f2588,null))['then'](removeEntity(_0x4f2588,null))[_0x80b7('0x43')](handleError(_0x4f2588,null));}; \ No newline at end of file +var _0x6921=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','limit','apply','save','update','then','UserProfileResource','destroy','error','stack','name','map','Tag','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','role','Tags','UserProfileSection','userProfileId','autoAssociation','body','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x6921,0x1d1));var _0x1692=function(_0x5008fd,_0x2eb36f){_0x5008fd=_0x5008fd-0x0;var _0x554bab=_0x6921[_0x5008fd];return _0x554bab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1692('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1692('0x1'));var rp=require('request-promise');var moment=require(_0x1692('0x2'));var BPromise=require(_0x1692('0x3'));var Mustache=require('mustache');var util=require(_0x1692('0x4'));var path=require('path');var sox=require(_0x1692('0x5'));var csv=require(_0x1692('0x6'));var ejs=require(_0x1692('0x7'));var fs=require('fs');var fs_extra=require(_0x1692('0x8'));var _=require(_0x1692('0x9'));var squel=require(_0x1692('0xa'));var crypto=require(_0x1692('0xb'));var jsforce=require(_0x1692('0xc'));var deskjs=require(_0x1692('0xd'));var toCsv=require(_0x1692('0x6'));var querystring=require(_0x1692('0xe'));var Papa=require('papaparse');var Redis=require(_0x1692('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1692('0x10'));var as=require(_0x1692('0x11'));var hardwareService=require(_0x1692('0x12'));var logger=require(_0x1692('0x13'))(_0x1692('0x14'));var utils=require(_0x1692('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1692('0x16'));var db=require(_0x1692('0x17'))['db'];function respondWithStatusCode(_0x1d8ae3,_0x26492b){_0x26492b=_0x26492b||0xcc;return function(_0x2c84fe){if(_0x2c84fe){return _0x1d8ae3[_0x1692('0x18')](_0x26492b);}return _0x1d8ae3['status'](_0x26492b)[_0x1692('0x19')]();};}function respondWithResult(_0xa6e81,_0xddfb0c){_0xddfb0c=_0xddfb0c||0xc8;return function(_0x1b488f){if(_0x1b488f){return _0xa6e81[_0x1692('0x1a')](_0xddfb0c)[_0x1692('0x1b')](_0x1b488f);}};}function respondWithFilteredResult(_0x5e33d8,_0x1377e3){return function(_0x57401c){if(_0x57401c){var _0x12989e=typeof _0x1377e3['offset']===_0x1692('0x1c')&&typeof _0x1377e3['limit']===_0x1692('0x1c');var _0x28db17=_0x57401c[_0x1692('0x1d')];var _0x4ea36d=_0x12989e?0x0:_0x1377e3['offset'];var _0x3c0960=_0x12989e?_0x57401c[_0x1692('0x1d')]:_0x1377e3['offset']+_0x1377e3[_0x1692('0x1e')];var _0x4e6bfc;if(_0x3c0960>=_0x28db17){_0x3c0960=_0x28db17;_0x4e6bfc=0xc8;}else{_0x4e6bfc=0xce;}_0x5e33d8[_0x1692('0x1a')](_0x4e6bfc);return _0x5e33d8['set']('Content-Range',_0x4ea36d+'-'+_0x3c0960+'/'+_0x28db17)[_0x1692('0x1b')](_0x57401c);}return null;};}function patchUpdates(_0x4e544b){return function(_0x2eb232){try{jsonpatch[_0x1692('0x1f')](_0x2eb232,_0x4e544b,!![]);}catch(_0x26571d){return BPromise['reject'](_0x26571d);}return _0x2eb232[_0x1692('0x20')]();};}function saveUpdates(_0x1d156a,_0x477e9d){return function(_0x1bc519){if(_0x1bc519){return _0x1bc519[_0x1692('0x21')](_0x1d156a)[_0x1692('0x22')](function(_0x4146af){return _0x4146af;});}return null;};}function removeEntity(_0x4e76ff,_0x35ecc8){return function(_0x312bf8){if(_0x312bf8){return _0x312bf8['destroy']()['then'](function(){var _0x53d4a1=_0x312bf8['get']({'plain':!![]});var _0x2fa81a='Tags';return db[_0x1692('0x23')][_0x1692('0x24')]({'where':{'type':_0x2fa81a,'resourceId':_0x53d4a1['id']}})[_0x1692('0x22')](function(){return _0x312bf8;});})[_0x1692('0x22')](function(){_0x4e76ff[_0x1692('0x1a')](0xcc)[_0x1692('0x19')]();});}};}function handleEntityNotFound(_0x5a355b,_0x1a6708){return function(_0x1a4e1c){if(!_0x1a4e1c){_0x5a355b[_0x1692('0x18')](0x194);}return _0x1a4e1c;};}function handleError(_0x46fec4,_0x534aba){_0x534aba=_0x534aba||0x1f4;return function(_0x5364cd){logger[_0x1692('0x25')](_0x5364cd[_0x1692('0x26')]);if(_0x5364cd[_0x1692('0x27')]){delete _0x5364cd[_0x1692('0x27')];}_0x46fec4['status'](_0x534aba)['send'](_0x5364cd);};}exports['index']=function(_0x38c5bd,_0x274dba){var _0x3d86f3={},_0x3fd03f={},_0x1442d6={'count':0x0,'rows':[]};var _0x44499f=_[_0x1692('0x28')](db[_0x1692('0x29')]['rawAttributes'],function(_0x170884){return{'name':_0x170884['fieldName'],'type':_0x170884[_0x1692('0x2a')][_0x1692('0x2b')]};});_0x3fd03f[_0x1692('0x2c')]=_[_0x1692('0x28')](_0x44499f,'name');_0x3fd03f[_0x1692('0x2d')]=_[_0x1692('0x2e')](_0x38c5bd[_0x1692('0x2d')]);_0x3fd03f[_0x1692('0x2f')]=_[_0x1692('0x30')](_0x3fd03f[_0x1692('0x2c')],_0x3fd03f['query']);_0x3d86f3[_0x1692('0x31')]=_[_0x1692('0x30')](_0x3fd03f[_0x1692('0x2c')],qs[_0x1692('0x32')](_0x38c5bd[_0x1692('0x2d')][_0x1692('0x32')]));_0x3d86f3[_0x1692('0x31')]=_0x3d86f3[_0x1692('0x31')][_0x1692('0x33')]?_0x3d86f3[_0x1692('0x31')]:_0x3fd03f[_0x1692('0x2c')];if(!_0x38c5bd[_0x1692('0x2d')][_0x1692('0x34')](_0x1692('0x35'))){_0x3d86f3['limit']=qs[_0x1692('0x1e')](_0x38c5bd[_0x1692('0x2d')][_0x1692('0x1e')]);_0x3d86f3['offset']=qs[_0x1692('0x36')](_0x38c5bd[_0x1692('0x2d')][_0x1692('0x36')]);}_0x3d86f3['order']=qs['sort'](_0x38c5bd['query'][_0x1692('0x37')]);_0x3d86f3[_0x1692('0x38')]=qs[_0x1692('0x2f')](_[_0x1692('0x39')](_0x38c5bd[_0x1692('0x2d')],_0x3fd03f[_0x1692('0x2f')]),_0x44499f);if(_0x38c5bd[_0x1692('0x2d')][_0x1692('0x3a')]){_0x3d86f3[_0x1692('0x38')]=_[_0x1692('0x3b')](_0x3d86f3[_0x1692('0x38')],{'$or':_[_0x1692('0x28')](_0x44499f,function(_0x5356fe){if(_0x5356fe[_0x1692('0x2a')]!==_0x1692('0x3c')){var _0xdb4303={};_0xdb4303[_0x5356fe['name']]={'$like':'%'+_0x38c5bd[_0x1692('0x2d')][_0x1692('0x3a')]+'%'};return _0xdb4303;}})});}_0x3d86f3=_['merge']({},_0x3d86f3,_0x38c5bd[_0x1692('0x3d')]);var _0x6c25a7={'where':_0x3d86f3[_0x1692('0x38')]};return db['Tag'][_0x1692('0x1d')](_0x6c25a7)[_0x1692('0x22')](function(_0x2f6052){_0x1442d6[_0x1692('0x1d')]=_0x2f6052;if(_0x38c5bd[_0x1692('0x2d')][_0x1692('0x3e')]){_0x3d86f3[_0x1692('0x3f')]=[{'all':!![]}];}return db[_0x1692('0x29')][_0x1692('0x40')](_0x3d86f3);})[_0x1692('0x22')](function(_0x36022e){_0x1442d6[_0x1692('0x41')]=_0x36022e;return _0x1442d6;})[_0x1692('0x22')](respondWithFilteredResult(_0x274dba,_0x3d86f3))[_0x1692('0x42')](handleError(_0x274dba,null));};exports[_0x1692('0x43')]=function(_0x17c965,_0x31d6a8){var _0x3c53f3={'raw':!![],'where':{'id':_0x17c965[_0x1692('0x44')]['id']}},_0x125396={};_0x125396[_0x1692('0x2c')]=_[_0x1692('0x2e')](db[_0x1692('0x29')]['rawAttributes']);_0x125396[_0x1692('0x2d')]=_['keys'](_0x17c965[_0x1692('0x2d')]);_0x125396[_0x1692('0x2f')]=_[_0x1692('0x30')](_0x125396[_0x1692('0x2c')],_0x125396['query']);_0x3c53f3[_0x1692('0x31')]=_[_0x1692('0x30')](_0x125396[_0x1692('0x2c')],qs[_0x1692('0x32')](_0x17c965[_0x1692('0x2d')][_0x1692('0x32')]));_0x3c53f3[_0x1692('0x31')]=_0x3c53f3[_0x1692('0x31')][_0x1692('0x33')]?_0x3c53f3[_0x1692('0x31')]:_0x125396['model'];if(_0x17c965['query'][_0x1692('0x3e')]){_0x3c53f3[_0x1692('0x3f')]=[{'all':!![]}];}_0x3c53f3=_[_0x1692('0x3b')]({},_0x3c53f3,_0x17c965[_0x1692('0x3d')]);return db[_0x1692('0x29')][_0x1692('0x45')](_0x3c53f3)['then'](handleEntityNotFound(_0x31d6a8,null))['then'](respondWithResult(_0x31d6a8,null))['catch'](handleError(_0x31d6a8,null));};exports[_0x1692('0x46')]=function(_0xffbb6,_0x38d869){return db[_0x1692('0x29')][_0x1692('0x46')](_0xffbb6['body'],{})['then'](function(_0x21a087){var _0x52cf9d=_0xffbb6[_0x1692('0x47')][_0x1692('0x48')]({'plain':!![]});if(!_0x52cf9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52cf9d[_0x1692('0x49')]===_0x1692('0x47')){var _0x302daa=_0x21a087[_0x1692('0x48')]({'plain':!![]});var _0x275b53=_0x1692('0x4a');return db[_0x1692('0x4b')][_0x1692('0x45')]({'where':{'name':_0x275b53,'userProfileId':_0x52cf9d[_0x1692('0x4c')]},'raw':!![]})[_0x1692('0x22')](function(_0x1d1c66){if(_0x1d1c66&&_0x1d1c66[_0x1692('0x4d')]===0x0){return db['UserProfileResource'][_0x1692('0x46')]({'name':_0x302daa[_0x1692('0x27')],'resourceId':_0x302daa['id'],'type':_0x1d1c66[_0x1692('0x27')],'sectionId':_0x1d1c66['id']},{})[_0x1692('0x22')](function(){return _0x21a087;});}else{return _0x21a087;}})[_0x1692('0x42')](function(_0x3fc057){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fc057);throw _0x3fc057;});}return _0x21a087;})[_0x1692('0x22')](respondWithResult(_0x38d869,0xc9))[_0x1692('0x42')](handleError(_0x38d869,null));};exports['update']=function(_0x17bdd5,_0x18376f){if(_0x17bdd5['body']['id']){delete _0x17bdd5[_0x1692('0x4e')]['id'];}return db[_0x1692('0x29')][_0x1692('0x45')]({'where':{'id':_0x17bdd5[_0x1692('0x44')]['id']}})['then'](handleEntityNotFound(_0x18376f,null))[_0x1692('0x22')](saveUpdates(_0x17bdd5[_0x1692('0x4e')],null))[_0x1692('0x22')](respondWithResult(_0x18376f,null))[_0x1692('0x42')](handleError(_0x18376f,null));};exports[_0x1692('0x24')]=function(_0xaf8c1b,_0x4eec6a){return db[_0x1692('0x29')][_0x1692('0x45')]({'where':{'id':_0xaf8c1b['params']['id']}})[_0x1692('0x22')](handleEntityNotFound(_0x4eec6a,null))['then'](removeEntity(_0x4eec6a,null))[_0x1692('0x42')](handleError(_0x4eec6a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 75ccd73..19e1e33 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 _0xcc10=['define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./tag.attributes'];(function(_0x205efe,_0x48f53e){var _0x21be9b=function(_0x5aa203){while(--_0x5aa203){_0x205efe['push'](_0x205efe['shift']());}};_0x21be9b(++_0x48f53e);}(_0xcc10,0x1a7));var _0x0cc1=function(_0x50eab0,_0x6c70b2){_0x50eab0=_0x50eab0-0x0;var _0x88c2e7=_0xcc10[_0x50eab0];return _0x88c2e7;};'use strict';var _=require(_0x0cc1('0x0'));var util=require(_0x0cc1('0x1'));var logger=require(_0x0cc1('0x2'))(_0x0cc1('0x3'));var moment=require(_0x0cc1('0x4'));var BPromise=require(_0x0cc1('0x5'));var rp=require(_0x0cc1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cc1('0x7'));var config=require('../../config/environment');var attributes=require(_0x0cc1('0x8'));module['exports']=function(_0x83365c,_0x413bcd){return _0x83365c[_0x0cc1('0x9')](_0x0cc1('0xa'),attributes,{'tableName':_0x0cc1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57d4=['exports','Tag','tools_tags','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x57d4,0x78));var _0x457d=function(_0x426044,_0x498e23){_0x426044=_0x426044-0x0;var _0x18cb62=_0x57d4[_0x426044];return _0x18cb62;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index b3557ad..c69b18b 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 _0x54f3=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util'];(function(_0x4c82ef,_0xca326){var _0x37c3d1=function(_0x51af8a){while(--_0x51af8a){_0x4c82ef['push'](_0x4c82ef['shift']());}};_0x37c3d1(++_0xca326);}(_0x54f3,0x120));var _0x354f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x54f3[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var moment=require(_0x354f('0x1'));var BPromise=require(_0x354f('0x2'));var rs=require(_0x354f('0x3'));var fs=require('fs');var Redis=require(_0x354f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x354f('0x5'))(_0x354f('0x6'));var config=require(_0x354f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x354f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51cd16,_0x1da503,_0x4311ad){return new BPromise(function(_0x2f111a,_0x173e1d){return client['request'](_0x51cd16,_0x4311ad)[_0x354f('0x9')](function(_0x5d1e5d){logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,'request\x20sent');logger['debug'](_0x354f('0xc'),_0x1da503,_0x354f('0xd'),JSON['stringify'](_0x5d1e5d));if(_0x5d1e5d[_0x354f('0xe')]){if(_0x5d1e5d[_0x354f('0xe')]['code']===0x1f4){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x173e1d(_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);}logger[_0x354f('0xe')]('Tag,\x20%s,\x20%s',_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x2f111a(_0x5d1e5d[_0x354f('0xe')]['message']);}else{logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,_0x354f('0xd'));_0x2f111a(_0x5d1e5d['result']['message']);}})[_0x354f('0x10')](function(_0x1d7627){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x1d7627);_0x173e1d(_0x1d7627);});});} \ No newline at end of file +var _0x01fe=['http','request','then','info','request\x20sent','debug','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1cc520,_0x5dd106){var _0x47be6a=function(_0x356daf){while(--_0x356daf){_0x1cc520['push'](_0x1cc520['shift']());}};_0x47be6a(++_0x5dd106);}(_0x01fe,0x102));var _0xe01f=function(_0x36a155,_0xe2878a){_0x36a155=_0x36a155-0x0;var _0x454ccf=_0x01fe[_0x36a155];return _0x454ccf;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var moment=require(_0xe01f('0x1'));var BPromise=require(_0xe01f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe01f('0x3'))['db'];var utils=require(_0xe01f('0x4'));var logger=require(_0xe01f('0x5'))(_0xe01f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe01f('0x7'));var client=jayson['client'][_0xe01f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b754f,_0x45431b,_0x40376f){return new BPromise(function(_0x377881,_0x4d1775){return client[_0xe01f('0x9')](_0x3b754f,_0x40376f)[_0xe01f('0xa')](function(_0x47dc30){logger[_0xe01f('0xb')]('Tag,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'));logger[_0xe01f('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'),JSON['stringify'](_0x47dc30));if(_0x47dc30[_0xe01f('0xe')]){if(_0x47dc30[_0xe01f('0xe')][_0xe01f('0xf')]===0x1f4){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x4d1775(_0x47dc30[_0xe01f('0xe')]['message']);}logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x377881(_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);}else{logger[_0xe01f('0xb')]('Tag,\x20%s,\x20%s',_0x45431b,'request\x20sent');_0x377881(_0x47dc30['result'][_0xe01f('0x11')]);}})[_0xe01f('0x12')](function(_0x88606f){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x88606f);_0x4d1775(_0x88606f);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6449cda..8f636d6 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 6ee473f..27775a0 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 _0x757a=['exports','STRING'];(function(_0x435d98,_0x5074d9){var _0x4a715c=function(_0x2acb25){while(--_0x2acb25){_0x435d98['push'](_0x435d98['shift']());}};_0x4a715c(++_0x5074d9);}(_0x757a,0xde));var _0xa757=function(_0x3c8306,_0x22b1a9){_0x3c8306=_0x3c8306-0x0;var _0xf6ad2a=_0x757a[_0x3c8306];return _0xf6ad2a;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x27ec60,_0x50957d){var _0x771467=function(_0x5e225a){while(--_0x5e225a){_0x27ec60['push'](_0x27ec60['shift']());}};_0x771467(++_0x50957d);}(_0x757a,0xde));var _0xa757=function(_0x45b37e,_0x29947c){_0x45b37e=_0x45b37e-0x0;var _0x7b24f8=_0x757a[_0x45b37e];return _0x7b24f8;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c019caa..5b5cd65 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 _0x3fe0=['eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','Team','then','rows','params','length','find','catch','create','user','get','role','UserProfileResource','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','Unknown\x20channel','remove','isArray','Voice','Chat','Mail','Sms','penalty','QueueId','defaults','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','removeAgents','Fax','Openchannel','Whatsapp','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3fe0,0x12c));var _0x03fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3fe0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x03fe('0x0'));var rimraf=require(_0x03fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x03fe('0x2'));var moment=require(_0x03fe('0x3'));var BPromise=require(_0x03fe('0x4'));var Mustache=require('mustache');var util=require(_0x03fe('0x5'));var path=require(_0x03fe('0x6'));var sox=require(_0x03fe('0x7'));var csv=require(_0x03fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03fe('0x9'));var _=require(_0x03fe('0xa'));var squel=require(_0x03fe('0xb'));var crypto=require(_0x03fe('0xc'));var jsforce=require(_0x03fe('0xd'));var deskjs=require(_0x03fe('0xe'));var toCsv=require(_0x03fe('0x8'));var querystring=require(_0x03fe('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x03fe('0x10'));var qs=require(_0x03fe('0x11'));var as=require(_0x03fe('0x12'));var hardwareService=require(_0x03fe('0x13'));var logger=require(_0x03fe('0x14'))(_0x03fe('0x15'));var utils=require(_0x03fe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x03fe('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x03fe('0x18')],{'host':_0x03fe('0x19'),'port':0x18eb});var socket=require(_0x03fe('0x1a'))(new Redis(config['redis']));require('./team.socket')[_0x03fe('0x1b')](socket);function respondWithStatusCode(_0x521d13,_0x3b8ad5){_0x3b8ad5=_0x3b8ad5||0xcc;return function(_0xaf607f){if(_0xaf607f){return _0x521d13[_0x03fe('0x1c')](_0x3b8ad5);}return _0x521d13[_0x03fe('0x1d')](_0x3b8ad5)[_0x03fe('0x1e')]();};}function respondWithResult(_0x325bee,_0xd2e1b4){_0xd2e1b4=_0xd2e1b4||0xc8;return function(_0x3d7928){if(_0x3d7928){return _0x325bee[_0x03fe('0x1d')](_0xd2e1b4)[_0x03fe('0x1f')](_0x3d7928);}};}function respondWithFilteredResult(_0x1a58e0,_0x47cebd){return function(_0x152c10){if(_0x152c10){var _0x116679=typeof _0x47cebd[_0x03fe('0x20')]===_0x03fe('0x21')&&typeof _0x47cebd['limit']===_0x03fe('0x21');var _0x5f55ac=_0x152c10['count'];var _0x567d37=_0x116679?0x0:_0x47cebd[_0x03fe('0x20')];var _0x2680a1=_0x116679?_0x152c10['count']:_0x47cebd['offset']+_0x47cebd[_0x03fe('0x22')];var _0x726397;if(_0x2680a1>=_0x5f55ac){_0x2680a1=_0x5f55ac;_0x726397=0xc8;}else{_0x726397=0xce;}_0x1a58e0[_0x03fe('0x1d')](_0x726397);return _0x1a58e0[_0x03fe('0x23')]('Content-Range',_0x567d37+'-'+_0x2680a1+'/'+_0x5f55ac)[_0x03fe('0x1f')](_0x152c10);}return null;};}function patchUpdates(_0x2fd7c1){return function(_0x3ec19e){try{jsonpatch[_0x03fe('0x24')](_0x3ec19e,_0x2fd7c1,!![]);}catch(_0xbd4c6){return BPromise['reject'](_0xbd4c6);}return _0x3ec19e[_0x03fe('0x25')]();};}function saveUpdates(_0x43e238,_0x310087){return function(_0x5c3341){if(_0x5c3341){return _0x5c3341[_0x03fe('0x26')](_0x43e238)['then'](function(_0x3c843e){return _0x3c843e;});}return null;};}function handleEntityNotFound(_0x4c2b5d,_0x4c78ce){return function(_0x23b3f3){if(!_0x23b3f3){_0x4c2b5d['sendStatus'](0x194);}return _0x23b3f3;};}function handleError(_0x2ba6d7,_0x43e377){_0x43e377=_0x43e377||0x1f4;return function(_0x4e38e7){logger['error'](_0x4e38e7[_0x03fe('0x27')]);if(_0x4e38e7[_0x03fe('0x28')]){delete _0x4e38e7[_0x03fe('0x28')];}_0x2ba6d7[_0x03fe('0x1d')](_0x43e377)[_0x03fe('0x29')](_0x4e38e7);};}exports[_0x03fe('0x2a')]=function(_0x533454,_0x28cc9c){var _0x386fbe={},_0x2a3365={},_0x1f5695={'count':0x0,'rows':[]};var _0xdb22=_[_0x03fe('0x2b')](db['Team'][_0x03fe('0x2c')],function(_0x17266c){return{'name':_0x17266c['fieldName'],'type':_0x17266c[_0x03fe('0x2d')][_0x03fe('0x2e')]};});_0x2a3365[_0x03fe('0x2f')]=_[_0x03fe('0x2b')](_0xdb22,_0x03fe('0x28'));_0x2a3365[_0x03fe('0x30')]=_[_0x03fe('0x31')](_0x533454[_0x03fe('0x30')]);_0x2a3365[_0x03fe('0x32')]=_['intersection'](_0x2a3365[_0x03fe('0x2f')],_0x2a3365[_0x03fe('0x30')]);_0x386fbe[_0x03fe('0x33')]=_[_0x03fe('0x34')](_0x2a3365[_0x03fe('0x2f')],qs[_0x03fe('0x35')](_0x533454[_0x03fe('0x30')]['fields']));_0x386fbe[_0x03fe('0x33')]=_0x386fbe[_0x03fe('0x33')]['length']?_0x386fbe[_0x03fe('0x33')]:_0x2a3365[_0x03fe('0x2f')];if(!_0x533454['query'][_0x03fe('0x36')](_0x03fe('0x37'))){_0x386fbe['limit']=qs[_0x03fe('0x22')](_0x533454['query'][_0x03fe('0x22')]);_0x386fbe[_0x03fe('0x20')]=qs[_0x03fe('0x20')](_0x533454[_0x03fe('0x30')]['offset']);}_0x386fbe[_0x03fe('0x38')]=qs[_0x03fe('0x39')](_0x533454[_0x03fe('0x30')][_0x03fe('0x39')]);_0x386fbe[_0x03fe('0x3a')]=qs[_0x03fe('0x32')](_[_0x03fe('0x3b')](_0x533454[_0x03fe('0x30')],_0x2a3365[_0x03fe('0x32')]),_0xdb22);if(_0x533454[_0x03fe('0x30')][_0x03fe('0x3c')]){_0x386fbe[_0x03fe('0x3a')]=_[_0x03fe('0x3d')](_0x386fbe[_0x03fe('0x3a')],{'$or':_[_0x03fe('0x2b')](_0xdb22,function(_0xcdf282){if(_0xcdf282[_0x03fe('0x2d')]!==_0x03fe('0x3e')){var _0x58cbe5={};_0x58cbe5[_0xcdf282[_0x03fe('0x28')]]={'$like':'%'+_0x533454[_0x03fe('0x30')][_0x03fe('0x3c')]+'%'};return _0x58cbe5;}})});}_0x386fbe=_[_0x03fe('0x3d')]({},_0x386fbe,_0x533454[_0x03fe('0x3f')]);var _0x52984b={'where':_0x386fbe[_0x03fe('0x3a')]};return db['Team'][_0x03fe('0x40')](_0x52984b)['then'](function(_0x7697f){_0x1f5695['count']=_0x7697f;if(_0x533454[_0x03fe('0x30')][_0x03fe('0x41')]){_0x386fbe[_0x03fe('0x42')]=[{'all':!![]}];}return db[_0x03fe('0x43')]['findAll'](_0x386fbe);})[_0x03fe('0x44')](function(_0x3ca378){_0x1f5695[_0x03fe('0x45')]=_0x3ca378;return _0x1f5695;})['then'](respondWithFilteredResult(_0x28cc9c,_0x386fbe))['catch'](handleError(_0x28cc9c,null));};exports['show']=function(_0x129c60,_0x2130cc){var _0x5eea1a={'raw':![],'where':{'id':_0x129c60[_0x03fe('0x46')]['id']}},_0x320893={};_0x320893[_0x03fe('0x2f')]=_[_0x03fe('0x31')](db[_0x03fe('0x43')][_0x03fe('0x2c')]);_0x320893[_0x03fe('0x30')]=_[_0x03fe('0x31')](_0x129c60[_0x03fe('0x30')]);_0x320893['filters']=_[_0x03fe('0x34')](_0x320893[_0x03fe('0x2f')],_0x320893[_0x03fe('0x30')]);_0x5eea1a[_0x03fe('0x33')]=_['intersection'](_0x320893[_0x03fe('0x2f')],qs['fields'](_0x129c60[_0x03fe('0x30')][_0x03fe('0x35')]));_0x5eea1a[_0x03fe('0x33')]=_0x5eea1a[_0x03fe('0x33')][_0x03fe('0x47')]?_0x5eea1a[_0x03fe('0x33')]:_0x320893[_0x03fe('0x2f')];if(_0x129c60['query'][_0x03fe('0x41')]){_0x5eea1a[_0x03fe('0x42')]=[{'all':!![]}];}_0x5eea1a=_[_0x03fe('0x3d')]({},_0x5eea1a,_0x129c60[_0x03fe('0x3f')]);return db[_0x03fe('0x43')][_0x03fe('0x48')](_0x5eea1a)[_0x03fe('0x44')](handleEntityNotFound(_0x2130cc,null))[_0x03fe('0x44')](respondWithResult(_0x2130cc,null))[_0x03fe('0x49')](handleError(_0x2130cc,null));};exports[_0x03fe('0x4a')]=function(_0x2f6ddb,_0x426848){return db[_0x03fe('0x43')][_0x03fe('0x4a')](_0x2f6ddb['body'],{})['then'](function(_0x307182){var _0xfded98=_0x2f6ddb[_0x03fe('0x4b')][_0x03fe('0x4c')]({'plain':!![]});if(!_0xfded98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfded98[_0x03fe('0x4d')]===_0x03fe('0x4b')){var _0x33202d=_0x307182[_0x03fe('0x4c')]({'plain':!![]});var _0x20801e='Teams';return db['UserProfileSection'][_0x03fe('0x48')]({'where':{'name':_0x20801e,'userProfileId':_0xfded98['userProfileId']},'raw':!![]})['then'](function(_0x31c033){if(_0x31c033&&_0x31c033['autoAssociation']===0x0){return db[_0x03fe('0x4e')][_0x03fe('0x4a')]({'name':_0x33202d[_0x03fe('0x28')],'resourceId':_0x33202d['id'],'type':_0x31c033['name'],'sectionId':_0x31c033['id']},{})[_0x03fe('0x44')](function(){return _0x307182;});}else{return _0x307182;}})[_0x03fe('0x49')](function(_0x1a5295){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a5295);throw _0x1a5295;});}return _0x307182;})[_0x03fe('0x44')](respondWithResult(_0x426848,0xc9))[_0x03fe('0x49')](handleError(_0x426848,null));};exports[_0x03fe('0x26')]=function(_0x547592,_0x4b35ee){if(_0x547592['body']['id']){delete _0x547592[_0x03fe('0x4f')]['id'];}return db[_0x03fe('0x43')]['find']({'where':{'id':_0x547592[_0x03fe('0x46')]['id']}})[_0x03fe('0x44')](handleEntityNotFound(_0x4b35ee,null))['then'](saveUpdates(_0x547592['body'],null))['then'](respondWithResult(_0x4b35ee,null))[_0x03fe('0x49')](handleError(_0x4b35ee,null));};exports[_0x03fe('0x50')]=function(_0x19aa18,_0x4ec9bb){var _0x1ebc63=_0x19aa18[_0x03fe('0x46')]['id'];var _0x151dee=[];return db[_0x03fe('0x51')][_0x03fe('0x52')](function(_0x53c86b){var _0x7cbd2=_0x03fe('0x53')+_0x1ebc63;return db[_0x03fe('0x51')][_0x03fe('0x30')](_0x7cbd2,{'type':db[_0x03fe('0x54')][_0x03fe('0x55')][_0x03fe('0x56')],'raw':!![],'transaction':_0x53c86b})['then'](function(_0x2958a3){_0x151dee=_[_0x03fe('0x2b')](_0x2958a3,function(_0xe1cb09){return Number(_0xe1cb09[_0x03fe('0x57')]);});})[_0x03fe('0x44')](function(){var _0x44374b=_0x03fe('0x58')+_0x1ebc63;return db[_0x03fe('0x51')][_0x03fe('0x30')](_0x44374b,{'type':db[_0x03fe('0x54')][_0x03fe('0x55')]['SELECT'],'raw':!![],'transaction':_0x53c86b});})[_0x03fe('0x44')](function(_0x42ef8d){var _0x200d24=_['map'](_0x42ef8d,function(_0x16d096){return Number(_0x16d096['VoiceQueueId']);});return db[_0x03fe('0x59')]['destroy']({'where':{'UserId':{'$in':_0x151dee},'VoiceQueueId':{'$in':_0x200d24}},'transaction':_0x53c86b});})['then'](function(){var _0x437c9a=_0x03fe('0x5a')+_0x1ebc63;return db['sequelize'][_0x03fe('0x30')](_0x437c9a,{'type':db[_0x03fe('0x54')][_0x03fe('0x55')]['SELECT'],'raw':!![],'transaction':_0x53c86b});})[_0x03fe('0x44')](function(_0x8fe066){var _0x446aed=_[_0x03fe('0x2b')](_0x8fe066,function(_0x322e27){return Number(_0x322e27[_0x03fe('0x5b')]);});return db[_0x03fe('0x5c')][_0x03fe('0x50')]({'where':{'UserId':{'$in':_0x151dee},'MailQueueId':{'$in':_0x446aed}},'transaction':_0x53c86b});})[_0x03fe('0x44')](function(){var _0x4d4ff1='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1ebc63;return db[_0x03fe('0x51')][_0x03fe('0x30')](_0x4d4ff1,{'type':db[_0x03fe('0x54')]['QueryTypes'][_0x03fe('0x56')],'raw':!![],'transaction':_0x53c86b});})[_0x03fe('0x44')](function(_0x25a980){var _0x122039=_[_0x03fe('0x2b')](_0x25a980,function(_0x54917f){return Number(_0x54917f[_0x03fe('0x5d')]);});return db[_0x03fe('0x5e')][_0x03fe('0x50')]({'where':{'UserId':{'$in':_0x151dee},'SmsQueueId':{'$in':_0x122039}},'transaction':_0x53c86b});})['then'](function(){var _0x345870='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1ebc63;return db[_0x03fe('0x51')][_0x03fe('0x30')](_0x345870,{'type':db[_0x03fe('0x54')][_0x03fe('0x55')][_0x03fe('0x56')],'raw':!![],'transaction':_0x53c86b});})[_0x03fe('0x44')](function(_0x4a61de){var _0x12f3e5=_[_0x03fe('0x2b')](_0x4a61de,function(_0x4e85a1){return Number(_0x4e85a1[_0x03fe('0x5f')]);});return db[_0x03fe('0x60')]['destroy']({'where':{'UserId':{'$in':_0x151dee},'ChatQueueId':{'$in':_0x12f3e5}},'transaction':_0x53c86b});})[_0x03fe('0x44')](function(){var _0x5b0916=_0x03fe('0x61')+_0x1ebc63;return db['sequelize']['query'](_0x5b0916,{'type':db[_0x03fe('0x54')][_0x03fe('0x55')][_0x03fe('0x56')],'raw':!![],'transaction':_0x53c86b});})['then'](function(_0x15c316){var _0x2ae2da=_[_0x03fe('0x2b')](_0x15c316,function(_0x5e52e9){return Number(_0x5e52e9[_0x03fe('0x62')]);});return db[_0x03fe('0x63')][_0x03fe('0x50')]({'where':{'UserId':{'$in':_0x151dee},'FaxQueueId':{'$in':_0x2ae2da}},'transaction':_0x53c86b});})[_0x03fe('0x44')](function(){var _0x497074=_0x03fe('0x64')+_0x1ebc63;return db['sequelize'][_0x03fe('0x30')](_0x497074,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x53c86b});})[_0x03fe('0x44')](function(_0x24f847){var _0x406e8b=_[_0x03fe('0x2b')](_0x24f847,function(_0x1e5e46){return Number(_0x1e5e46[_0x03fe('0x65')]);});return db['UserOpenchannelQueue'][_0x03fe('0x50')]({'where':{'UserId':{'$in':_0x151dee},'OpenchannelQueueId':{'$in':_0x406e8b}},'transaction':_0x53c86b});})[_0x03fe('0x44')](function(){var _0x37f2ae='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1ebc63;return db[_0x03fe('0x51')]['query'](_0x37f2ae,{'type':db[_0x03fe('0x54')]['QueryTypes'][_0x03fe('0x56')],'raw':!![],'transaction':_0x53c86b});})[_0x03fe('0x44')](function(_0x23acdc){var _0x50a317=_[_0x03fe('0x2b')](_0x23acdc,function(_0x2abe4c){return Number(_0x2abe4c[_0x03fe('0x66')]);});return db[_0x03fe('0x67')][_0x03fe('0x50')]({'where':{'UserId':{'$in':_0x151dee},'WhatsappQueueId':{'$in':_0x50a317}},'transaction':_0x53c86b});})['then'](function(){return db['TeamVoicePrefix'][_0x03fe('0x48')]({'where':{'TeamId':_0x1ebc63}});})['then'](function(_0x42ff0f){if(_0x42ff0f===null){return;}return db[_0x03fe('0x68')][_0x03fe('0x50')]({'where':{'UserId':{'$in':_0x151dee},'VoicePrefixId':_0x42ff0f[_0x03fe('0x69')]},'transaction':_0x53c86b});})['then'](function(){return db[_0x03fe('0x43')]['destroy']({'where':{'id':_0x1ebc63},'cascade':!![],'transaction':_0x53c86b});})[_0x03fe('0x44')](function(_0x5d669a){if(_0x5d669a===0x0){_0x4ec9bb[_0x03fe('0x1c')](0x194);}else{return db[_0x03fe('0x4e')][_0x03fe('0x50')]({'where':{'type':_0x03fe('0x6a'),'resourceId':_0x1ebc63},'cascade':!![],'transaction':_0x53c86b})[_0x03fe('0x44')](function(){_0x4ec9bb[_0x03fe('0x1d')](0xcc)[_0x03fe('0x1e')]();});}})[_0x03fe('0x49')](function(_0x3ff38f){_0x4ec9bb['status'](0x1f4)[_0x03fe('0x29')](_0x3ff38f);});});};exports[_0x03fe('0x6b')]=function(_0x4f5f24,_0x48068b,_0x1ebb6e){return db['Team'][_0x03fe('0x6c')]({'where':{'id':_0x4f5f24[_0x03fe('0x46')]['id']}})[_0x03fe('0x44')](handleEntityNotFound(_0x48068b,null))[_0x03fe('0x44')](function(_0x980712){if(!_0x4f5f24[_0x03fe('0x30')][_0x03fe('0x6d')]||!utils[_0x03fe('0x6e')](_0x4f5f24['query'][_0x03fe('0x6d')])){throw new db['Sequelize'][(_0x03fe('0x6f'))]('Unknown\x20channel');}var _0x465a34={};var _0x9c1d9={};_0x9c1d9[_0x03fe('0x2f')]=_[_0x03fe('0x31')](db[_[_0x03fe('0x70')](_0x4f5f24['query']['channel'][_0x03fe('0x71')]())+_0x03fe('0x72')][_0x03fe('0x2c')]);_0x9c1d9['query']=_[_0x03fe('0x31')](_0x4f5f24[_0x03fe('0x30')]);_0x9c1d9[_0x03fe('0x32')]=_['intersection'](_0x9c1d9[_0x03fe('0x2f')],_0x9c1d9['query']);_0x465a34[_0x03fe('0x33')]=_[_0x03fe('0x34')](_0x9c1d9[_0x03fe('0x2f')],qs[_0x03fe('0x35')](_0x4f5f24[_0x03fe('0x30')]['fields']));_0x465a34[_0x03fe('0x33')]=_0x465a34[_0x03fe('0x33')]['length']?_0x465a34['attributes']:_0x9c1d9[_0x03fe('0x2f')];_0x465a34[_0x03fe('0x22')]=qs[_0x03fe('0x22')](_0x4f5f24[_0x03fe('0x30')][_0x03fe('0x22')]);_0x465a34[_0x03fe('0x20')]=qs['offset'](_0x4f5f24[_0x03fe('0x30')]['offset']);_0x465a34[_0x03fe('0x38')]=qs['sort'](_0x4f5f24[_0x03fe('0x30')][_0x03fe('0x39')]);_0x465a34[_0x03fe('0x3a')]=qs[_0x03fe('0x32')](_[_0x03fe('0x3b')](_0x4f5f24[_0x03fe('0x30')],_0x9c1d9[_0x03fe('0x32')]));_0x465a34=_['merge']({},_0x465a34,_0x4f5f24[_0x03fe('0x3f')]);return _0x980712[_0x03fe('0x4c')+_[_0x03fe('0x70')](_0x4f5f24[_0x03fe('0x30')][_0x03fe('0x6d')][_0x03fe('0x71')]())+_0x03fe('0x73')](_0x465a34);})[_0x03fe('0x44')](respondWithResult(_0x48068b,null))[_0x03fe('0x49')](handleError(_0x48068b,null));};exports[_0x03fe('0x74')]=function(_0xb21064,_0x44bce0,_0x3aa3ef){return db[_0x03fe('0x43')][_0x03fe('0x6c')]({'where':{'id':_0xb21064['params']['id']}})['then'](function(_0x1e2cc){if(_0x1e2cc){if(!_0xb21064['body']['channel']||!utils[_0x03fe('0x6e')](_0xb21064[_0x03fe('0x4f')][_0x03fe('0x6d')])){throw new db[(_0x03fe('0x54'))]['ValidationError']('Unknown\x20channel');}return _0x1e2cc[_0x03fe('0x75')+_['capitalize'](_0xb21064[_0x03fe('0x4f')]['channel'][_0x03fe('0x71')]())+'Queues'](_0xb21064[_0x03fe('0x4f')][_0x03fe('0x76')]);}return null;})[_0x03fe('0x44')](handleEntityNotFound(_0x44bce0,null))[_0x03fe('0x44')](respondWithStatusCode(_0x44bce0,null))[_0x03fe('0x49')](handleError(_0x44bce0,null));};exports[_0x03fe('0x77')]=function(_0x318a35,_0x196313,_0xd5c4f3){return db[_0x03fe('0x43')]['findOne']({'where':{'id':_0x318a35['params']['id']}})[_0x03fe('0x44')](function(_0x31fd3a){if(_0x31fd3a){if(!_0x318a35[_0x03fe('0x30')][_0x03fe('0x6d')]||!utils[_0x03fe('0x6e')](_0x318a35[_0x03fe('0x30')][_0x03fe('0x6d')])){throw new db[(_0x03fe('0x54'))]['ValidationError'](_0x03fe('0x78'));}return _0x31fd3a[_0x03fe('0x79')+_['capitalize'](_0x318a35[_0x03fe('0x30')][_0x03fe('0x6d')]['toLowerCase']())+_0x03fe('0x73')](_0x318a35[_0x03fe('0x30')][_0x03fe('0x76')]);}return null;})[_0x03fe('0x44')](handleEntityNotFound(_0x196313,null))['then'](respondWithStatusCode(_0x196313,null))['catch'](handleError(_0x196313,null));};exports['addAgents']=function(_0x167aa2,_0x52dfbd){var _0x25ff07=_[_0x03fe('0x7a')](_0x167aa2[_0x03fe('0x4f')][_0x03fe('0x76')])?_0x167aa2[_0x03fe('0x4f')][_0x03fe('0x76')]:[_0x167aa2[_0x03fe('0x4f')][_0x03fe('0x76')]];var _0x1aec30=_0x167aa2['params']['id'];return db[_0x03fe('0x43')][_0x03fe('0x48')]({'where':{'id':_0x1aec30}})[_0x03fe('0x44')](handleEntityNotFound(_0x52dfbd,null))[_0x03fe('0x44')](function(_0x40cc09){if(_0x40cc09){var _0x12454c=[_0x03fe('0x7b'),_0x03fe('0x7c'),_0x03fe('0x7d'),_0x03fe('0x7e'),'Fax','Openchannel','Whatsapp'];return db[_0x03fe('0x51')]['transaction'](function(_0x2ad8b5){var _0x8488dd=_[_0x03fe('0x2b')](_0x12454c,function(_0x4c093e){var _0x231e9f={'attributes':['id','name']};if(_0x4c093e==='Voice'){_0x231e9f['through']={'attributes':[_0x03fe('0x7f')]};}return _0x40cc09[_0x03fe('0x4c')+_0x4c093e+_0x03fe('0x73')](_0x231e9f)['then'](function(_0x3905c4){var _0x56df59=_['map'](_0x3905c4,function(_0x5cc8a8){var _0x3975dc=_[_0x03fe('0x2b')](_0x25ff07,function(_0x81b224){var _0x56dc0b={'where':{'UserId':_0x81b224,[_0x4c093e+_0x03fe('0x80')]:_0x5cc8a8['id']},'transaction':_0x2ad8b5};if(_0x4c093e===_0x03fe('0x7b')){_0x56dc0b[_0x03fe('0x81')]={'penalty':_0x5cc8a8[_0x03fe('0x82')][_0x03fe('0x7f')]};}return db['User'+_0x4c093e+_0x03fe('0x72')][_0x03fe('0x83')](_0x56dc0b)['then'](function(){socket[_0x03fe('0x84')](_0x03fe('0x4b')+_0x4c093e+_0x03fe('0x85'),{'UserId':_0x81b224,[_0x4c093e+_0x03fe('0x80')]:_0x5cc8a8['id']});if(_0x4c093e!==_0x03fe('0x7b')){return;}return db[_0x03fe('0x86')]['findAll']({'where':{'id':_0x25ff07,'online':0x1},'attributes':['id',_0x03fe('0x28'),_0x03fe('0x87'),_0x03fe('0x88'),_0x03fe('0x89')],'raw':!![]})[_0x03fe('0x44')](function(_0x30d317){var _0x488ecc=_[_0x03fe('0x2b')](_0x30d317,function(_0xe49532){return db[_0x03fe('0x8a')][_0x03fe('0x8b')]({'membername':_0xe49532[_0x03fe('0x28')],'UserId':_0xe49532['id'],'queue_name':_0x5cc8a8['name'],'VoiceQueueId':_0x5cc8a8['id'],'interface':_[_0x03fe('0x8c')](_0xe49532['interface'])?util[_0x03fe('0x8d')](_0x03fe('0x8e'),_0xe49532[_0x03fe('0x28')]):_0xe49532[_0x03fe('0x89')],'paused':_0xe49532[_0x03fe('0x88')]||![],'penalty':_0x5cc8a8[_0x03fe('0x82')][_0x03fe('0x7f')]},{'transaction':_0x2ad8b5});});return Promise[_0x03fe('0x8f')](_0x488ecc);});});});return Promise[_0x03fe('0x8f')](_0x3975dc);});return Promise[_0x03fe('0x8f')](_0x56df59);})[_0x03fe('0x44')](function(){return db[_0x03fe('0x90')]['findOne']({'where':{'teamId':_0x1aec30}})[_0x03fe('0x44')](function(_0x107146){if(_0x107146){var _0x4e0c29=_[_0x03fe('0x2b')](_0x25ff07,function(_0x46e808){db[_0x03fe('0x68')]['upsert']({'UserId':_0x46e808,'VoicePrefixId':_0x107146[_0x03fe('0x69')]});});return Promise[_0x03fe('0x8f')](_0x4e0c29);}});});});return Promise['all'](_0x8488dd)['then'](function(){return _0x40cc09['addAgents'](_0x25ff07,{'transaction':_0x2ad8b5})['spread'](function(_0x4534a3){return _0x4534a3;});});});}})['then'](respondWithResult(_0x52dfbd,null))['catch'](handleError(_0x52dfbd,null));};exports[_0x03fe('0x91')]=function(_0x53ab74,_0x34d8e6){var _0x283712=_['isArray'](_0x53ab74['query'][_0x03fe('0x76')])?_0x53ab74[_0x03fe('0x30')][_0x03fe('0x76')]:[_0x53ab74['query']['ids']];var _0x5a7fed=_0x53ab74['params']['id'];return db[_0x03fe('0x43')][_0x03fe('0x48')]({'where':{'id':_0x5a7fed}})['then'](handleEntityNotFound(_0x34d8e6,null))['then'](function(_0x44c99f){if(_0x44c99f){var _0x18d10b=[_0x03fe('0x7b'),_0x03fe('0x7c'),_0x03fe('0x7d'),_0x03fe('0x7e'),_0x03fe('0x92'),_0x03fe('0x93'),_0x03fe('0x94')];return db[_0x03fe('0x51')][_0x03fe('0x52')](function(_0x2b1efc){var _0x2c3fdd=_[_0x03fe('0x2b')](_0x18d10b,function(_0x1dad0f){var _0x566761={'attributes':['id',_0x03fe('0x28')]};return _0x44c99f[_0x03fe('0x4c')+_0x1dad0f+_0x03fe('0x73')](_0x566761)[_0x03fe('0x44')](function(_0x19a9fa){var _0x2e9f0d=_[_0x03fe('0x2b')](_0x19a9fa,function(_0x44b3cc){return _0x44b3cc[_0x03fe('0x91')](_0x283712,{'transaction':_0x2b1efc})[_0x03fe('0x44')](function(){var _0x4c0f87=_[_0x03fe('0x2b')](_0x283712,function(_0x3596e1){socket['emit'](_0x03fe('0x4b')+_0x1dad0f+'Queue:remove',{'UserId':Number(_0x3596e1),[_0x1dad0f+'QueueId']:_0x44b3cc['id']});if(_0x1dad0f!==_0x03fe('0x7b')){return;}return db[_0x03fe('0x8a')][_0x03fe('0x50')]({'where':{'VoiceQueueId':_0x44b3cc['id'],'UserId':_0x3596e1},'transaction':_0x2b1efc});});return Promise['all'](_0x4c0f87);});});return Promise[_0x03fe('0x8f')](_0x2e9f0d);});});return Promise[_0x03fe('0x8f')](_0x2c3fdd)['then'](function(){return _0x44c99f['removeAgents'](_0x283712,{'transaction':_0x2b1efc});})[_0x03fe('0x44')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x5a7fed}})[_0x03fe('0x44')](function(_0x15d150){if(_0x15d150){var _0xd2d945=_[_0x03fe('0x2b')](_0x283712,function(_0x3d73ec){db[_0x03fe('0x68')]['destroy']({'where':{'UserId':_0x3d73ec,'VoicePrefixId':_0x15d150[_0x03fe('0x69')]}});});return Promise[_0x03fe('0x8f')](_0xd2d945);}});});});}})[_0x03fe('0x44')](respondWithStatusCode(_0x34d8e6,null))[_0x03fe('0x49')](handleError(_0x34d8e6,null));};exports[_0x03fe('0x95')]=function(_0x3e653d,_0x175f85,_0x5423ee){var _0x193f47={};var _0x4ea892={};var _0x5cd944;var _0xb0e812;return db[_0x03fe('0x43')][_0x03fe('0x6c')]({'where':{'id':_0x3e653d[_0x03fe('0x46')]['id']}})[_0x03fe('0x44')](handleEntityNotFound(_0x175f85,null))[_0x03fe('0x44')](function(_0x536d2f){if(_0x536d2f){_0x5cd944=_0x536d2f;_0x4ea892['model']=_[_0x03fe('0x31')](db[_0x03fe('0x86')][_0x03fe('0x2c')]);_0x4ea892[_0x03fe('0x30')]=_[_0x03fe('0x31')](_0x3e653d[_0x03fe('0x30')]);_0x4ea892[_0x03fe('0x32')]=_[_0x03fe('0x34')](_0x4ea892[_0x03fe('0x2f')],_0x4ea892['query']);_0x193f47[_0x03fe('0x33')]=_[_0x03fe('0x34')](_0x4ea892[_0x03fe('0x2f')],qs['fields'](_0x3e653d[_0x03fe('0x30')][_0x03fe('0x35')]));_0x193f47[_0x03fe('0x33')]=_0x193f47[_0x03fe('0x33')][_0x03fe('0x47')]?_0x193f47[_0x03fe('0x33')]:_0x4ea892[_0x03fe('0x2f')];_0x193f47['order']=qs[_0x03fe('0x39')](_0x3e653d[_0x03fe('0x30')][_0x03fe('0x39')]);_0x193f47[_0x03fe('0x3a')]=qs[_0x03fe('0x32')](_['pick'](_0x3e653d[_0x03fe('0x30')],_0x4ea892[_0x03fe('0x32')]));if(_0x3e653d[_0x03fe('0x30')]['filter']){_0x193f47['where']=_[_0x03fe('0x3d')](_0x193f47[_0x03fe('0x3a')],{'$or':_[_0x03fe('0x2b')](_0x193f47['attributes'],function(_0x48e326){var _0x131382={};_0x131382[_0x48e326]={'$like':'%'+_0x3e653d[_0x03fe('0x30')][_0x03fe('0x3c')]+'%'};return _0x131382;})});}_0x193f47=_[_0x03fe('0x3d')]({},_0x193f47,_0x3e653d[_0x03fe('0x3f')]);return _0x5cd944[_0x03fe('0x95')](_0x193f47);}})[_0x03fe('0x44')](function(_0xc027d6){if(_0xc027d6){_0xb0e812=_0xc027d6[_0x03fe('0x47')];if(!_0x3e653d[_0x03fe('0x30')][_0x03fe('0x36')](_0x03fe('0x37'))){_0x193f47['limit']=qs['limit'](_0x3e653d[_0x03fe('0x30')][_0x03fe('0x22')]);_0x193f47['offset']=qs[_0x03fe('0x20')](_0x3e653d[_0x03fe('0x30')][_0x03fe('0x20')]);}return _0x5cd944[_0x03fe('0x95')](_0x193f47);}})[_0x03fe('0x44')](function(_0x3768a1){if(_0x3768a1){return _0x3768a1?{'count':_0xb0e812,'rows':_0x3768a1}:null;}})[_0x03fe('0x44')](respondWithResult(_0x175f85,null))[_0x03fe('0x49')](handleError(_0x175f85,null));}; \ No newline at end of file +var _0xf959=['redis','defaults','./team.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','keys','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Chat','Sms','Openchannel','Whatsapp','Voice','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','Queue:remove','getAgents','rimraf','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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'];(function(_0x1cbc75,_0x456173){var _0x51ecd8=function(_0x335455){while(--_0x335455){_0x1cbc75['push'](_0x1cbc75['shift']());}};_0x51ecd8(++_0x456173);}(_0xf959,0x1c5));var _0x9f95=function(_0x3a4464,_0x37afa0){_0x3a4464=_0x3a4464-0x0;var _0x42503f=_0xf959[_0x3a4464];return _0x42503f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f95('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f95('0x1'));var moment=require(_0x9f95('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9f95('0x3'));var sox=require(_0x9f95('0x4'));var csv=require(_0x9f95('0x5'));var ejs=require(_0x9f95('0x6'));var fs=require('fs');var fs_extra=require(_0x9f95('0x7'));var _=require(_0x9f95('0x8'));var squel=require('squel');var crypto=require(_0x9f95('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9f95('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9f95('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9f95('0xc'));var qs=require(_0x9f95('0xd'));var as=require(_0x9f95('0xe'));var hardwareService=require(_0x9f95('0xf'));var logger=require(_0x9f95('0x10'))(_0x9f95('0x11'));var utils=require(_0x9f95('0x12'));var config=require(_0x9f95('0x13'));var licenseUtil=require(_0x9f95('0x14'));var db=require('../../mysqldb')['db'];config[_0x9f95('0x15')]=_[_0x9f95('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f95('0x15')]));require(_0x9f95('0x17'))['register'](socket);function respondWithStatusCode(_0x139042,_0xc03735){_0xc03735=_0xc03735||0xcc;return function(_0x26ce8e){if(_0x26ce8e){return _0x139042['sendStatus'](_0xc03735);}return _0x139042[_0x9f95('0x18')](_0xc03735)['end']();};}function respondWithResult(_0x1416d7,_0x5ba6e7){_0x5ba6e7=_0x5ba6e7||0xc8;return function(_0x5b0acf){if(_0x5b0acf){return _0x1416d7[_0x9f95('0x18')](_0x5ba6e7)[_0x9f95('0x19')](_0x5b0acf);}};}function respondWithFilteredResult(_0xf725c9,_0x3500ab){return function(_0x46792d){if(_0x46792d){var _0x8a0d86=typeof _0x3500ab[_0x9f95('0x1a')]===_0x9f95('0x1b')&&typeof _0x3500ab[_0x9f95('0x1c')]===_0x9f95('0x1b');var _0xe1a5a2=_0x46792d['count'];var _0x42eda3=_0x8a0d86?0x0:_0x3500ab[_0x9f95('0x1a')];var _0x992ca5=_0x8a0d86?_0x46792d[_0x9f95('0x1d')]:_0x3500ab[_0x9f95('0x1a')]+_0x3500ab[_0x9f95('0x1c')];var _0x10b76c;if(_0x992ca5>=_0xe1a5a2){_0x992ca5=_0xe1a5a2;_0x10b76c=0xc8;}else{_0x10b76c=0xce;}_0xf725c9['status'](_0x10b76c);return _0xf725c9[_0x9f95('0x1e')](_0x9f95('0x1f'),_0x42eda3+'-'+_0x992ca5+'/'+_0xe1a5a2)[_0x9f95('0x19')](_0x46792d);}return null;};}function patchUpdates(_0x1b5632){return function(_0x5723b0){try{jsonpatch[_0x9f95('0x20')](_0x5723b0,_0x1b5632,!![]);}catch(_0x5e98fd){return BPromise[_0x9f95('0x21')](_0x5e98fd);}return _0x5723b0[_0x9f95('0x22')]();};}function saveUpdates(_0xfbcf9d,_0x53e102){return function(_0x5086d4){if(_0x5086d4){return _0x5086d4[_0x9f95('0x23')](_0xfbcf9d)[_0x9f95('0x24')](function(_0x4c9bc4){return _0x4c9bc4;});}return null;};}function handleEntityNotFound(_0x41225b,_0xac427){return function(_0x5d04bf){if(!_0x5d04bf){_0x41225b[_0x9f95('0x25')](0x194);}return _0x5d04bf;};}function handleError(_0x4b3a25,_0x3aa27a){_0x3aa27a=_0x3aa27a||0x1f4;return function(_0x9afabe){logger[_0x9f95('0x26')](_0x9afabe[_0x9f95('0x27')]);if(_0x9afabe['name']){delete _0x9afabe[_0x9f95('0x28')];}_0x4b3a25[_0x9f95('0x18')](_0x3aa27a)[_0x9f95('0x29')](_0x9afabe);};}exports[_0x9f95('0x2a')]=function(_0x1de177,_0x24a7e){var _0xc1d3c4={},_0x28f281={},_0x9010ce={'count':0x0,'rows':[]};var _0x3385d5=_[_0x9f95('0x2b')](db[_0x9f95('0x2c')][_0x9f95('0x2d')],function(_0x10bf0b){return{'name':_0x10bf0b[_0x9f95('0x2e')],'type':_0x10bf0b[_0x9f95('0x2f')][_0x9f95('0x30')]};});_0x28f281[_0x9f95('0x31')]=_[_0x9f95('0x2b')](_0x3385d5,_0x9f95('0x28'));_0x28f281[_0x9f95('0x32')]=_['keys'](_0x1de177[_0x9f95('0x32')]);_0x28f281[_0x9f95('0x33')]=_['intersection'](_0x28f281[_0x9f95('0x31')],_0x28f281[_0x9f95('0x32')]);_0xc1d3c4[_0x9f95('0x34')]=_[_0x9f95('0x35')](_0x28f281['model'],qs[_0x9f95('0x36')](_0x1de177['query'][_0x9f95('0x36')]));_0xc1d3c4['attributes']=_0xc1d3c4[_0x9f95('0x34')][_0x9f95('0x37')]?_0xc1d3c4[_0x9f95('0x34')]:_0x28f281[_0x9f95('0x31')];if(!_0x1de177['query'][_0x9f95('0x38')](_0x9f95('0x39'))){_0xc1d3c4[_0x9f95('0x1c')]=qs['limit'](_0x1de177[_0x9f95('0x32')][_0x9f95('0x1c')]);_0xc1d3c4[_0x9f95('0x1a')]=qs[_0x9f95('0x1a')](_0x1de177['query'][_0x9f95('0x1a')]);}_0xc1d3c4[_0x9f95('0x3a')]=qs[_0x9f95('0x3b')](_0x1de177['query'][_0x9f95('0x3b')]);_0xc1d3c4['where']=qs[_0x9f95('0x33')](_[_0x9f95('0x3c')](_0x1de177['query'],_0x28f281[_0x9f95('0x33')]),_0x3385d5);if(_0x1de177[_0x9f95('0x32')][_0x9f95('0x3d')]){_0xc1d3c4['where']=_['merge'](_0xc1d3c4[_0x9f95('0x3e')],{'$or':_['map'](_0x3385d5,function(_0x4de806){if(_0x4de806['type']!==_0x9f95('0x3f')){var _0x55d6b7={};_0x55d6b7[_0x4de806[_0x9f95('0x28')]]={'$like':'%'+_0x1de177[_0x9f95('0x32')][_0x9f95('0x3d')]+'%'};return _0x55d6b7;}})});}_0xc1d3c4=_[_0x9f95('0x40')]({},_0xc1d3c4,_0x1de177[_0x9f95('0x41')]);var _0x51d89b={'where':_0xc1d3c4[_0x9f95('0x3e')]};return db[_0x9f95('0x2c')]['count'](_0x51d89b)['then'](function(_0x27c84d){_0x9010ce[_0x9f95('0x1d')]=_0x27c84d;if(_0x1de177[_0x9f95('0x32')]['includeAll']){_0xc1d3c4[_0x9f95('0x42')]=[{'all':!![]}];}return db[_0x9f95('0x2c')][_0x9f95('0x43')](_0xc1d3c4);})[_0x9f95('0x24')](function(_0x562fc6){_0x9010ce[_0x9f95('0x44')]=_0x562fc6;return _0x9010ce;})['then'](respondWithFilteredResult(_0x24a7e,_0xc1d3c4))[_0x9f95('0x45')](handleError(_0x24a7e,null));};exports['show']=function(_0xed01c8,_0x4462f9){var _0x1f4c14={'raw':![],'where':{'id':_0xed01c8['params']['id']}},_0x2d4dc4={};_0x2d4dc4[_0x9f95('0x31')]=_[_0x9f95('0x46')](db[_0x9f95('0x2c')][_0x9f95('0x2d')]);_0x2d4dc4[_0x9f95('0x32')]=_['keys'](_0xed01c8[_0x9f95('0x32')]);_0x2d4dc4[_0x9f95('0x33')]=_[_0x9f95('0x35')](_0x2d4dc4['model'],_0x2d4dc4[_0x9f95('0x32')]);_0x1f4c14[_0x9f95('0x34')]=_[_0x9f95('0x35')](_0x2d4dc4['model'],qs['fields'](_0xed01c8[_0x9f95('0x32')][_0x9f95('0x36')]));_0x1f4c14[_0x9f95('0x34')]=_0x1f4c14[_0x9f95('0x34')][_0x9f95('0x37')]?_0x1f4c14[_0x9f95('0x34')]:_0x2d4dc4[_0x9f95('0x31')];if(_0xed01c8[_0x9f95('0x32')][_0x9f95('0x47')]){_0x1f4c14[_0x9f95('0x42')]=[{'all':!![]}];}_0x1f4c14=_[_0x9f95('0x40')]({},_0x1f4c14,_0xed01c8[_0x9f95('0x41')]);return db[_0x9f95('0x2c')][_0x9f95('0x48')](_0x1f4c14)[_0x9f95('0x24')](handleEntityNotFound(_0x4462f9,null))[_0x9f95('0x24')](respondWithResult(_0x4462f9,null))[_0x9f95('0x45')](handleError(_0x4462f9,null));};exports[_0x9f95('0x49')]=function(_0x364737,_0x4c8489){return db[_0x9f95('0x2c')][_0x9f95('0x49')](_0x364737['body'],{})[_0x9f95('0x24')](function(_0x2e977b){var _0x1cb0e6=_0x364737[_0x9f95('0x4a')][_0x9f95('0x4b')]({'plain':!![]});if(!_0x1cb0e6)throw new Error(_0x9f95('0x4c'));if(_0x1cb0e6[_0x9f95('0x4d')]===_0x9f95('0x4a')){var _0xb379c4=_0x2e977b[_0x9f95('0x4b')]({'plain':!![]});var _0x46df80=_0x9f95('0x4e');return db[_0x9f95('0x4f')][_0x9f95('0x48')]({'where':{'name':_0x46df80,'userProfileId':_0x1cb0e6[_0x9f95('0x50')]},'raw':!![]})[_0x9f95('0x24')](function(_0x2de877){if(_0x2de877&&_0x2de877[_0x9f95('0x51')]===0x0){return db[_0x9f95('0x52')]['create']({'name':_0xb379c4['name'],'resourceId':_0xb379c4['id'],'type':_0x2de877[_0x9f95('0x28')],'sectionId':_0x2de877['id']},{})[_0x9f95('0x24')](function(){return _0x2e977b;});}else{return _0x2e977b;}})[_0x9f95('0x45')](function(_0x925e84){logger[_0x9f95('0x26')](_0x9f95('0x53'),_0x925e84);throw _0x925e84;});}return _0x2e977b;})[_0x9f95('0x24')](respondWithResult(_0x4c8489,0xc9))[_0x9f95('0x45')](handleError(_0x4c8489,null));};exports[_0x9f95('0x23')]=function(_0x7100ab,_0x215298){if(_0x7100ab['body']['id']){delete _0x7100ab[_0x9f95('0x54')]['id'];}return db[_0x9f95('0x2c')]['find']({'where':{'id':_0x7100ab[_0x9f95('0x55')]['id']}})['then'](handleEntityNotFound(_0x215298,null))[_0x9f95('0x24')](saveUpdates(_0x7100ab[_0x9f95('0x54')],null))[_0x9f95('0x24')](respondWithResult(_0x215298,null))[_0x9f95('0x45')](handleError(_0x215298,null));};exports[_0x9f95('0x56')]=function(_0x542d53,_0x14ee99){var _0x34dfdf=_0x542d53[_0x9f95('0x55')]['id'];var _0xf6a2df=[];return db[_0x9f95('0x57')][_0x9f95('0x58')](function(_0x2b4eb2){var _0x53eabd=_0x9f95('0x59')+_0x34dfdf;return db[_0x9f95('0x57')][_0x9f95('0x32')](_0x53eabd,{'type':db[_0x9f95('0x5a')][_0x9f95('0x5b')]['SELECT'],'raw':!![],'transaction':_0x2b4eb2})[_0x9f95('0x24')](function(_0x4431e9){_0xf6a2df=_[_0x9f95('0x2b')](_0x4431e9,function(_0x2ce50f){return Number(_0x2ce50f[_0x9f95('0x5c')]);});})[_0x9f95('0x24')](function(){var _0x5bcdb1=_0x9f95('0x5d')+_0x34dfdf;return db[_0x9f95('0x57')][_0x9f95('0x32')](_0x5bcdb1,{'type':db[_0x9f95('0x5a')][_0x9f95('0x5b')]['SELECT'],'raw':!![],'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(_0x5f453f){var _0x69e51f=_[_0x9f95('0x2b')](_0x5f453f,function(_0x31831f){return Number(_0x31831f[_0x9f95('0x5e')]);});return db[_0x9f95('0x5f')]['destroy']({'where':{'UserId':{'$in':_0xf6a2df},'VoiceQueueId':{'$in':_0x69e51f}},'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(){var _0x30c57c=_0x9f95('0x60')+_0x34dfdf;return db[_0x9f95('0x57')][_0x9f95('0x32')](_0x30c57c,{'type':db[_0x9f95('0x5a')][_0x9f95('0x5b')][_0x9f95('0x61')],'raw':!![],'transaction':_0x2b4eb2});})['then'](function(_0x617d13){var _0x40d057=_[_0x9f95('0x2b')](_0x617d13,function(_0x12b1e0){return Number(_0x12b1e0[_0x9f95('0x62')]);});return db[_0x9f95('0x63')]['destroy']({'where':{'UserId':{'$in':_0xf6a2df},'MailQueueId':{'$in':_0x40d057}},'transaction':_0x2b4eb2});})['then'](function(){var _0x3edeb5=_0x9f95('0x64')+_0x34dfdf;return db[_0x9f95('0x57')]['query'](_0x3edeb5,{'type':db[_0x9f95('0x5a')]['QueryTypes'][_0x9f95('0x61')],'raw':!![],'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(_0x4f1b00){var _0x5ae30f=_[_0x9f95('0x2b')](_0x4f1b00,function(_0x4b195d){return Number(_0x4b195d[_0x9f95('0x65')]);});return db[_0x9f95('0x66')]['destroy']({'where':{'UserId':{'$in':_0xf6a2df},'SmsQueueId':{'$in':_0x5ae30f}},'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(){var _0x1ca2a2='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x34dfdf;return db['sequelize'][_0x9f95('0x32')](_0x1ca2a2,{'type':db[_0x9f95('0x5a')][_0x9f95('0x5b')][_0x9f95('0x61')],'raw':!![],'transaction':_0x2b4eb2});})['then'](function(_0x544adf){var _0x42d3ca=_[_0x9f95('0x2b')](_0x544adf,function(_0x1fedce){return Number(_0x1fedce[_0x9f95('0x67')]);});return db[_0x9f95('0x68')][_0x9f95('0x56')]({'where':{'UserId':{'$in':_0xf6a2df},'ChatQueueId':{'$in':_0x42d3ca}},'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(){var _0x52239b=_0x9f95('0x69')+_0x34dfdf;return db[_0x9f95('0x57')]['query'](_0x52239b,{'type':db[_0x9f95('0x5a')][_0x9f95('0x5b')][_0x9f95('0x61')],'raw':!![],'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(_0x49e884){var _0x280078=_[_0x9f95('0x2b')](_0x49e884,function(_0x330bdc){return Number(_0x330bdc[_0x9f95('0x6a')]);});return db[_0x9f95('0x6b')]['destroy']({'where':{'UserId':{'$in':_0xf6a2df},'FaxQueueId':{'$in':_0x280078}},'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(){var _0x5a190f=_0x9f95('0x6c')+_0x34dfdf;return db[_0x9f95('0x57')]['query'](_0x5a190f,{'type':db[_0x9f95('0x5a')][_0x9f95('0x5b')][_0x9f95('0x61')],'raw':!![],'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(_0x382423){var _0x3a4e8e=_[_0x9f95('0x2b')](_0x382423,function(_0x2720f2){return Number(_0x2720f2[_0x9f95('0x6d')]);});return db[_0x9f95('0x6e')]['destroy']({'where':{'UserId':{'$in':_0xf6a2df},'OpenchannelQueueId':{'$in':_0x3a4e8e}},'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(){var _0x5b55fe=_0x9f95('0x6f')+_0x34dfdf;return db['sequelize'][_0x9f95('0x32')](_0x5b55fe,{'type':db[_0x9f95('0x5a')][_0x9f95('0x5b')]['SELECT'],'raw':!![],'transaction':_0x2b4eb2});})['then'](function(_0x53642c){var _0x224d43=_[_0x9f95('0x2b')](_0x53642c,function(_0xc461){return Number(_0xc461[_0x9f95('0x70')]);});return db[_0x9f95('0x71')][_0x9f95('0x56')]({'where':{'UserId':{'$in':_0xf6a2df},'WhatsappQueueId':{'$in':_0x224d43}},'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(){return db['TeamVoicePrefix'][_0x9f95('0x48')]({'where':{'TeamId':_0x34dfdf}});})['then'](function(_0x271383){if(_0x271383===null){return;}return db[_0x9f95('0x72')][_0x9f95('0x56')]({'where':{'UserId':{'$in':_0xf6a2df},'VoicePrefixId':_0x271383[_0x9f95('0x73')]},'transaction':_0x2b4eb2});})[_0x9f95('0x24')](function(){return db[_0x9f95('0x2c')][_0x9f95('0x56')]({'where':{'id':_0x34dfdf},'cascade':!![],'transaction':_0x2b4eb2});})['then'](function(_0x592706){if(_0x592706===0x0){_0x14ee99['sendStatus'](0x194);}else{return db[_0x9f95('0x52')][_0x9f95('0x56')]({'where':{'type':'Teams','resourceId':_0x34dfdf},'cascade':!![],'transaction':_0x2b4eb2})[_0x9f95('0x24')](function(){_0x14ee99[_0x9f95('0x18')](0xcc)[_0x9f95('0x74')]();});}})[_0x9f95('0x45')](function(_0x53ee2d){_0x14ee99[_0x9f95('0x18')](0x1f4)['send'](_0x53ee2d);});});};exports[_0x9f95('0x75')]=function(_0x3d09c9,_0x171908,_0x22ec06){return db[_0x9f95('0x2c')][_0x9f95('0x76')]({'where':{'id':_0x3d09c9[_0x9f95('0x55')]['id']}})['then'](handleEntityNotFound(_0x171908,null))['then'](function(_0x11eda2){if(!_0x3d09c9[_0x9f95('0x32')]['channel']||!utils[_0x9f95('0x77')](_0x3d09c9[_0x9f95('0x32')][_0x9f95('0x78')])){throw new db[(_0x9f95('0x5a'))][(_0x9f95('0x79'))](_0x9f95('0x7a'));}var _0x5bfd34={};var _0x521617={};_0x521617['model']=_[_0x9f95('0x46')](db[_[_0x9f95('0x7b')](_0x3d09c9[_0x9f95('0x32')][_0x9f95('0x78')][_0x9f95('0x7c')]())+_0x9f95('0x7d')][_0x9f95('0x2d')]);_0x521617[_0x9f95('0x32')]=_['keys'](_0x3d09c9[_0x9f95('0x32')]);_0x521617[_0x9f95('0x33')]=_[_0x9f95('0x35')](_0x521617['model'],_0x521617[_0x9f95('0x32')]);_0x5bfd34[_0x9f95('0x34')]=_[_0x9f95('0x35')](_0x521617[_0x9f95('0x31')],qs['fields'](_0x3d09c9[_0x9f95('0x32')][_0x9f95('0x36')]));_0x5bfd34[_0x9f95('0x34')]=_0x5bfd34[_0x9f95('0x34')][_0x9f95('0x37')]?_0x5bfd34[_0x9f95('0x34')]:_0x521617[_0x9f95('0x31')];_0x5bfd34[_0x9f95('0x1c')]=qs['limit'](_0x3d09c9['query']['limit']);_0x5bfd34[_0x9f95('0x1a')]=qs['offset'](_0x3d09c9[_0x9f95('0x32')][_0x9f95('0x1a')]);_0x5bfd34[_0x9f95('0x3a')]=qs[_0x9f95('0x3b')](_0x3d09c9['query'][_0x9f95('0x3b')]);_0x5bfd34['where']=qs['filters'](_[_0x9f95('0x3c')](_0x3d09c9[_0x9f95('0x32')],_0x521617['filters']));_0x5bfd34=_[_0x9f95('0x40')]({},_0x5bfd34,_0x3d09c9['options']);return _0x11eda2[_0x9f95('0x4b')+_[_0x9f95('0x7b')](_0x3d09c9[_0x9f95('0x32')][_0x9f95('0x78')][_0x9f95('0x7c')]())+_0x9f95('0x7e')](_0x5bfd34);})['then'](respondWithResult(_0x171908,null))[_0x9f95('0x45')](handleError(_0x171908,null));};exports[_0x9f95('0x7f')]=function(_0x300226,_0x375e95,_0x4e095c){return db[_0x9f95('0x2c')][_0x9f95('0x76')]({'where':{'id':_0x300226['params']['id']}})[_0x9f95('0x24')](function(_0x32dd25){if(_0x32dd25){if(!_0x300226[_0x9f95('0x54')][_0x9f95('0x78')]||!utils[_0x9f95('0x77')](_0x300226[_0x9f95('0x54')][_0x9f95('0x78')])){throw new db[(_0x9f95('0x5a'))][(_0x9f95('0x79'))](_0x9f95('0x7a'));}return _0x32dd25[_0x9f95('0x80')+_[_0x9f95('0x7b')](_0x300226[_0x9f95('0x54')]['channel'][_0x9f95('0x7c')]())+_0x9f95('0x7e')](_0x300226[_0x9f95('0x54')][_0x9f95('0x81')]);}return null;})[_0x9f95('0x24')](handleEntityNotFound(_0x375e95,null))[_0x9f95('0x24')](respondWithStatusCode(_0x375e95,null))['catch'](handleError(_0x375e95,null));};exports[_0x9f95('0x82')]=function(_0x2024dd,_0x365f9e,_0x4980e5){return db[_0x9f95('0x2c')]['findOne']({'where':{'id':_0x2024dd[_0x9f95('0x55')]['id']}})[_0x9f95('0x24')](function(_0x965425){if(_0x965425){if(!_0x2024dd[_0x9f95('0x32')]['channel']||!utils[_0x9f95('0x77')](_0x2024dd[_0x9f95('0x32')][_0x9f95('0x78')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x965425[_0x9f95('0x83')+_['capitalize'](_0x2024dd['query']['channel'][_0x9f95('0x7c')]())+_0x9f95('0x7e')](_0x2024dd[_0x9f95('0x32')][_0x9f95('0x81')]);}return null;})['then'](handleEntityNotFound(_0x365f9e,null))[_0x9f95('0x24')](respondWithStatusCode(_0x365f9e,null))[_0x9f95('0x45')](handleError(_0x365f9e,null));};exports[_0x9f95('0x84')]=function(_0x227d28,_0x4a9a19){var _0x59f7c7=_[_0x9f95('0x85')](_0x227d28['body'][_0x9f95('0x81')])?_0x227d28[_0x9f95('0x54')][_0x9f95('0x81')]:[_0x227d28[_0x9f95('0x54')][_0x9f95('0x81')]];var _0x11ae16=_0x227d28['params']['id'];return db[_0x9f95('0x2c')]['find']({'where':{'id':_0x11ae16}})[_0x9f95('0x24')](handleEntityNotFound(_0x4a9a19,null))[_0x9f95('0x24')](function(_0x55a8a5){if(_0x55a8a5){var _0x30ba07=['Voice',_0x9f95('0x86'),'Mail',_0x9f95('0x87'),'Fax',_0x9f95('0x88'),_0x9f95('0x89')];return db[_0x9f95('0x57')][_0x9f95('0x58')](function(_0x561ceb){var _0x488a31=_['map'](_0x30ba07,function(_0x46da46){var _0x479bdb={'attributes':['id',_0x9f95('0x28')]};if(_0x46da46===_0x9f95('0x8a')){_0x479bdb['through']={'attributes':[_0x9f95('0x8b')]};}return _0x55a8a5[_0x9f95('0x4b')+_0x46da46+'Queues'](_0x479bdb)[_0x9f95('0x24')](function(_0x1357df){var _0x3b21c8=_['map'](_0x1357df,function(_0x407e67){var _0x1c2acc=_[_0x9f95('0x2b')](_0x59f7c7,function(_0x447687){var _0x825154={'where':{'UserId':_0x447687,[_0x46da46+'QueueId']:_0x407e67['id']},'transaction':_0x561ceb};if(_0x46da46==='Voice'){_0x825154[_0x9f95('0x16')]={'penalty':_0x407e67[_0x9f95('0x8c')][_0x9f95('0x8b')]};}return db[_0x9f95('0x8d')+_0x46da46+_0x9f95('0x7d')][_0x9f95('0x8e')](_0x825154)[_0x9f95('0x24')](function(){socket[_0x9f95('0x8f')](_0x9f95('0x4a')+_0x46da46+_0x9f95('0x90'),{'UserId':_0x447687,[_0x46da46+_0x9f95('0x91')]:_0x407e67['id']});if(_0x46da46!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x59f7c7,'online':0x1},'attributes':['id',_0x9f95('0x28'),_0x9f95('0x92'),_0x9f95('0x93'),_0x9f95('0x94')],'raw':!![]})[_0x9f95('0x24')](function(_0x3c4ca5){var _0x372889=_[_0x9f95('0x2b')](_0x3c4ca5,function(_0x7ebca1){return db[_0x9f95('0x95')][_0x9f95('0x96')]({'membername':_0x7ebca1[_0x9f95('0x28')],'UserId':_0x7ebca1['id'],'queue_name':_0x407e67[_0x9f95('0x28')],'VoiceQueueId':_0x407e67['id'],'interface':_['isNil'](_0x7ebca1['interface'])?util['format'](_0x9f95('0x97'),_0x7ebca1['name']):_0x7ebca1[_0x9f95('0x94')],'paused':_0x7ebca1[_0x9f95('0x93')]||![],'penalty':_0x407e67[_0x9f95('0x8c')][_0x9f95('0x8b')]},{'transaction':_0x561ceb});});return Promise[_0x9f95('0x98')](_0x372889);});});});return Promise[_0x9f95('0x98')](_0x1c2acc);});return Promise[_0x9f95('0x98')](_0x3b21c8);})['then'](function(){return db[_0x9f95('0x99')]['findOne']({'where':{'teamId':_0x11ae16}})[_0x9f95('0x24')](function(_0x139da0){if(_0x139da0){var _0x390da4=_['map'](_0x59f7c7,function(_0x82e6d6){db[_0x9f95('0x72')][_0x9f95('0x96')]({'UserId':_0x82e6d6,'VoicePrefixId':_0x139da0[_0x9f95('0x73')]});});return Promise[_0x9f95('0x98')](_0x390da4);}});});});return Promise['all'](_0x488a31)[_0x9f95('0x24')](function(){return _0x55a8a5[_0x9f95('0x84')](_0x59f7c7,{'transaction':_0x561ceb})[_0x9f95('0x9a')](function(_0x506146){return _0x506146;});});});}})[_0x9f95('0x24')](respondWithResult(_0x4a9a19,null))[_0x9f95('0x45')](handleError(_0x4a9a19,null));};exports['removeAgents']=function(_0x3e6c90,_0x34de57){var _0x20c03a=_[_0x9f95('0x85')](_0x3e6c90[_0x9f95('0x32')]['ids'])?_0x3e6c90[_0x9f95('0x32')][_0x9f95('0x81')]:[_0x3e6c90[_0x9f95('0x32')][_0x9f95('0x81')]];var _0x26a69e=_0x3e6c90[_0x9f95('0x55')]['id'];return db[_0x9f95('0x2c')][_0x9f95('0x48')]({'where':{'id':_0x26a69e}})[_0x9f95('0x24')](handleEntityNotFound(_0x34de57,null))[_0x9f95('0x24')](function(_0x24e78b){if(_0x24e78b){var _0x5aa4fd=['Voice',_0x9f95('0x86'),'Mail',_0x9f95('0x87'),'Fax','Openchannel',_0x9f95('0x89')];return db[_0x9f95('0x57')][_0x9f95('0x58')](function(_0x47da38){var _0x3ac5c3=_[_0x9f95('0x2b')](_0x5aa4fd,function(_0x39eead){var _0x10f7ef={'attributes':['id',_0x9f95('0x28')]};return _0x24e78b[_0x9f95('0x4b')+_0x39eead+'Queues'](_0x10f7ef)[_0x9f95('0x24')](function(_0x101d72){var _0x322146=_['map'](_0x101d72,function(_0x3afbe9){return _0x3afbe9[_0x9f95('0x9b')](_0x20c03a,{'transaction':_0x47da38})['then'](function(){var _0x425a8b=_[_0x9f95('0x2b')](_0x20c03a,function(_0x52bca2){socket['emit']('user'+_0x39eead+_0x9f95('0x9c'),{'UserId':Number(_0x52bca2),[_0x39eead+_0x9f95('0x91')]:_0x3afbe9['id']});if(_0x39eead!==_0x9f95('0x8a')){return;}return db[_0x9f95('0x95')]['destroy']({'where':{'VoiceQueueId':_0x3afbe9['id'],'UserId':_0x52bca2},'transaction':_0x47da38});});return Promise[_0x9f95('0x98')](_0x425a8b);});});return Promise['all'](_0x322146);});});return Promise[_0x9f95('0x98')](_0x3ac5c3)['then'](function(){return _0x24e78b[_0x9f95('0x9b')](_0x20c03a,{'transaction':_0x47da38});})[_0x9f95('0x24')](function(){return db['TeamVoicePrefix'][_0x9f95('0x76')]({'where':{'teamId':_0x26a69e}})[_0x9f95('0x24')](function(_0x2b2950){if(_0x2b2950){var _0x87f1bb=_[_0x9f95('0x2b')](_0x20c03a,function(_0x268599){db[_0x9f95('0x72')]['destroy']({'where':{'UserId':_0x268599,'VoicePrefixId':_0x2b2950[_0x9f95('0x73')]}});});return Promise[_0x9f95('0x98')](_0x87f1bb);}});});});}})[_0x9f95('0x24')](respondWithStatusCode(_0x34de57,null))[_0x9f95('0x45')](handleError(_0x34de57,null));};exports[_0x9f95('0x9d')]=function(_0x4d0989,_0x1343b8,_0x14e7b9){var _0x2616c0={};var _0x1b904e={};var _0x1cb013;var _0xebff9f;return db['Team']['findOne']({'where':{'id':_0x4d0989[_0x9f95('0x55')]['id']}})[_0x9f95('0x24')](handleEntityNotFound(_0x1343b8,null))[_0x9f95('0x24')](function(_0x53a76c){if(_0x53a76c){_0x1cb013=_0x53a76c;_0x1b904e[_0x9f95('0x31')]=_[_0x9f95('0x46')](db['User']['rawAttributes']);_0x1b904e[_0x9f95('0x32')]=_['keys'](_0x4d0989[_0x9f95('0x32')]);_0x1b904e['filters']=_['intersection'](_0x1b904e[_0x9f95('0x31')],_0x1b904e[_0x9f95('0x32')]);_0x2616c0[_0x9f95('0x34')]=_[_0x9f95('0x35')](_0x1b904e[_0x9f95('0x31')],qs[_0x9f95('0x36')](_0x4d0989['query']['fields']));_0x2616c0[_0x9f95('0x34')]=_0x2616c0['attributes'][_0x9f95('0x37')]?_0x2616c0[_0x9f95('0x34')]:_0x1b904e['model'];_0x2616c0[_0x9f95('0x3a')]=qs[_0x9f95('0x3b')](_0x4d0989[_0x9f95('0x32')][_0x9f95('0x3b')]);_0x2616c0['where']=qs[_0x9f95('0x33')](_[_0x9f95('0x3c')](_0x4d0989[_0x9f95('0x32')],_0x1b904e[_0x9f95('0x33')]));if(_0x4d0989['query'][_0x9f95('0x3d')]){_0x2616c0['where']=_[_0x9f95('0x40')](_0x2616c0[_0x9f95('0x3e')],{'$or':_[_0x9f95('0x2b')](_0x2616c0[_0x9f95('0x34')],function(_0x5772df){var _0x19f6b3={};_0x19f6b3[_0x5772df]={'$like':'%'+_0x4d0989[_0x9f95('0x32')][_0x9f95('0x3d')]+'%'};return _0x19f6b3;})});}_0x2616c0=_[_0x9f95('0x40')]({},_0x2616c0,_0x4d0989[_0x9f95('0x41')]);return _0x1cb013['getAgents'](_0x2616c0);}})[_0x9f95('0x24')](function(_0x213ed4){if(_0x213ed4){_0xebff9f=_0x213ed4[_0x9f95('0x37')];if(!_0x4d0989['query'][_0x9f95('0x38')](_0x9f95('0x39'))){_0x2616c0[_0x9f95('0x1c')]=qs[_0x9f95('0x1c')](_0x4d0989[_0x9f95('0x32')]['limit']);_0x2616c0[_0x9f95('0x1a')]=qs[_0x9f95('0x1a')](_0x4d0989[_0x9f95('0x32')][_0x9f95('0x1a')]);}return _0x1cb013[_0x9f95('0x9d')](_0x2616c0);}})[_0x9f95('0x24')](function(_0x438efb){if(_0x438efb){return _0x438efb?{'count':_0xebff9f,'rows':_0x438efb}:null;}})['then'](respondWithResult(_0x1343b8,null))['catch'](handleError(_0x1343b8,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 768d4b6..f0f0d29 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 _0xbb65=['Team','setMaxListeners','update','remove','emit','events','../../mysqldb'];(function(_0x13911a,_0x5aaea7){var _0x5c7cef=function(_0x44f04c){while(--_0x44f04c){_0x13911a['push'](_0x13911a['shift']());}};_0x5c7cef(++_0x5aaea7);}(_0xbb65,0x1d3));var _0x5bb6=function(_0x3e8b43,_0x1460ba){_0x3e8b43=_0x3e8b43-0x0;var _0x46ba6e=_0xbb65[_0x3e8b43];return _0x46ba6e;};'use strict';var EventEmitter=require(_0x5bb6('0x0'));var Team=require(_0x5bb6('0x1'))['db'][_0x5bb6('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5bb6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5bb6('0x4'),'afterDestroy':_0x5bb6('0x5')};function emitEvent(_0x53c27b){return function(_0x275286,_0x5b705a,_0x29126f){TeamEvents[_0x5bb6('0x6')](_0x53c27b+':'+_0x275286['id'],_0x275286);TeamEvents[_0x5bb6('0x6')](_0x53c27b,_0x275286);_0x29126f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x1509=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0x1509,0x1b4));var _0x9150=function(_0x565e07,_0xe6434d){_0x565e07=_0x565e07-0x0;var _0x327052=_0x1509[_0x565e07];return _0x327052;};'use strict';var EventEmitter=require(_0x9150('0x0'));var Team=require(_0x9150('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9150('0x2')](0x0);var events={'afterCreate':_0x9150('0x3'),'afterUpdate':_0x9150('0x4'),'afterDestroy':_0x9150('0x5')};function emitEvent(_0x4a6b16){return function(_0x51e0d3,_0x26ce22,_0x586fc2){TeamEvents[_0x9150('0x6')](_0x4a6b16+':'+_0x51e0d3['id'],_0x51e0d3);TeamEvents[_0x9150('0x6')](_0x4a6b16,_0x51e0d3);_0x586fc2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x9150('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c3a5081..48fc2be 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 _0x5c8b=['all','lodash','./team.attributes','Queues','then','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Openchannel','Sms','Voice','resolve'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5c8b,0x155));var _0xb5c8=function(_0x440015,_0x348a5d){_0x440015=_0x440015-0x0;var _0x40d06f=_0x5c8b[_0x440015];return _0x40d06f;};'use strict';var _=require(_0xb5c8('0x0'));var attributes=require(_0xb5c8('0x1'));function getQueuesByChannel(_0x329079,_0x1a8af9){var _0xd85777='get'+_0x1a8af9+_0xb5c8('0x2');return _0x329079[_0xd85777]()[_0xb5c8('0x3')](function(_0x17dcbe){return _['map'](_0x17dcbe,function(_0x2a9f52){_0x2a9f52[_0xb5c8('0x4')](_0xb5c8('0x5'),_0x1a8af9);return _0x2a9f52;});})['catch'](function(_0xae9ee6){throw _0xae9ee6;});}module[_0xb5c8('0x6')]=function(_0x3e694a){return _0x3e694a[_0xb5c8('0x7')](_0xb5c8('0x8'),attributes,{'tableName':_0xb5c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x44e5bb=this;var _0x3028a6=[_0xb5c8('0xa'),_0xb5c8('0xb'),'Mail',_0xb5c8('0xc'),_0xb5c8('0xd'),_0xb5c8('0xe'),'Whatsapp'];return Promise[_0xb5c8('0xf')]()['then'](function(){var _0x4a32e8=_['map'](_0x3028a6,function(_0x53f959){return getQueuesByChannel(_0x44e5bb,_0x53f959);});return Promise[_0xb5c8('0x10')](_0x4a32e8);})['catch'](function(_0x49d775){throw _0x49d775;});}}});}; \ No newline at end of file +var _0x80e3=['Voice','Whatsapp','resolve','then','all','./team.attributes','Queues','map','setDataValue','catch','exports','define','Team','Mail','Openchannel'];(function(_0x20d074,_0x5e289a){var _0x8862ef=function(_0xdc71a0){while(--_0xdc71a0){_0x20d074['push'](_0x20d074['shift']());}};_0x8862ef(++_0x5e289a);}(_0x80e3,0xf5));var _0x380e=function(_0x48a99d,_0x4d0a33){_0x48a99d=_0x48a99d-0x0;var _0x9537f3=_0x80e3[_0x48a99d];return _0x9537f3;};'use strict';var _=require('lodash');var attributes=require(_0x380e('0x0'));function getQueuesByChannel(_0x5e32b3,_0x595281){var _0x5712ab='get'+_0x595281+_0x380e('0x1');return _0x5e32b3[_0x5712ab]()['then'](function(_0x192dac){return _[_0x380e('0x2')](_0x192dac,function(_0xc01e40){_0xc01e40[_0x380e('0x3')]('channel',_0x595281);return _0xc01e40;});})[_0x380e('0x4')](function(_0x49dc86){throw _0x49dc86;});}module[_0x380e('0x5')]=function(_0x56c923){return _0x56c923[_0x380e('0x6')](_0x380e('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x8c1cf4=this;var _0x3b98df=['Chat','Fax',_0x380e('0x8'),_0x380e('0x9'),'Sms',_0x380e('0xa'),_0x380e('0xb')];return Promise[_0x380e('0xc')]()[_0x380e('0xd')](function(){var _0x37c77e=_[_0x380e('0x2')](_0x3b98df,function(_0x32b65b){return getQueuesByChannel(_0x8c1cf4,_0x32b65b);});return Promise[_0x380e('0xe')](_0x37c77e);})['catch'](function(_0x2c05db){throw _0x2c05db;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ef0c1ec..5855106 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 _0xd3a5=['stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x3aaf4e,_0x4ec368){var _0x280648=function(_0x48bb12){while(--_0x48bb12){_0x3aaf4e['push'](_0x3aaf4e['shift']());}};_0x280648(++_0x4ec368);}(_0xd3a5,0xb5));var _0x5d3a=function(_0x2d0c48,_0x5146ef){_0x2d0c48=_0x2d0c48-0x0;var _0x44b4db=_0xd3a5[_0x2d0c48];return _0x44b4db;};'use strict';var _=require(_0x5d3a('0x0'));var util=require(_0x5d3a('0x1'));var moment=require(_0x5d3a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d3a('0x4'));var logger=require('../../config/logger')(_0x5d3a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d3a('0x6')][_0x5d3a('0x7')]({'port':0x232a});config[_0x5d3a('0x8')]=_[_0x5d3a('0x9')](config['redis'],{'host':_0x5d3a('0xa'),'port':0x18eb});var socket=require(_0x5d3a('0xb'))(new Redis(config[_0x5d3a('0x8')]));require(_0x5d3a('0xc'))[_0x5d3a('0xd')](socket);function respondWithRpcPromise(_0xaee02b,_0x8b648d,_0x10b18a){return new BPromise(function(_0x53fd04,_0x51a20c){return client[_0x5d3a('0xe')](_0xaee02b,_0x10b18a)[_0x5d3a('0xf')](function(_0x2a6a28){logger['info']('Team,\x20%s,\x20%s',_0x8b648d,_0x5d3a('0x10'));logger[_0x5d3a('0x11')](_0x5d3a('0x12'),_0x8b648d,_0x5d3a('0x10'),JSON[_0x5d3a('0x13')](_0x2a6a28));if(_0x2a6a28[_0x5d3a('0x14')]){if(_0x2a6a28[_0x5d3a('0x14')]['code']===0x1f4){logger[_0x5d3a('0x14')](_0x5d3a('0x15'),_0x8b648d,_0x2a6a28[_0x5d3a('0x14')][_0x5d3a('0x16')]);return _0x51a20c(_0x2a6a28['error'][_0x5d3a('0x16')]);}logger[_0x5d3a('0x14')](_0x5d3a('0x15'),_0x8b648d,_0x2a6a28['error'][_0x5d3a('0x16')]);return _0x53fd04(_0x2a6a28['error'][_0x5d3a('0x16')]);}else{logger['info'](_0x5d3a('0x15'),_0x8b648d,'request\x20sent');_0x53fd04(_0x2a6a28[_0x5d3a('0x17')][_0x5d3a('0x16')]);}})[_0x5d3a('0x18')](function(_0x26b81a){logger['error']('Team,\x20%s,\x20%s',_0x8b648d,_0x26b81a);_0x51a20c(_0x26b81a);});});} \ No newline at end of file +var _0xc765=['request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x459014,_0x54395f){var _0x3d392c=function(_0x403392){while(--_0x403392){_0x459014['push'](_0x459014['shift']());}};_0x3d392c(++_0x54395f);}(_0xc765,0xf5));var _0x5c76=function(_0x38a345,_0x3a0f4e){_0x38a345=_0x38a345-0x0;var _0x5107a8=_0xc765[_0x38a345];return _0x5107a8;};'use strict';var _=require(_0x5c76('0x0'));var util=require(_0x5c76('0x1'));var moment=require(_0x5c76('0x2'));var BPromise=require(_0x5c76('0x3'));var rs=require(_0x5c76('0x4'));var fs=require('fs');var Redis=require(_0x5c76('0x5'));var db=require(_0x5c76('0x6'))['db'];var utils=require(_0x5c76('0x7'));var logger=require('../../config/logger')(_0x5c76('0x8'));var config=require(_0x5c76('0x9'));var jayson=require(_0x5c76('0xa'));var client=jayson[_0x5c76('0xb')][_0x5c76('0xc')]({'port':0x232a});config[_0x5c76('0xd')]=_[_0x5c76('0xe')](config[_0x5c76('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c76('0xf'))(new Redis(config[_0x5c76('0xd')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x4942f1,_0x5be470,_0x117269){return new BPromise(function(_0x4cdd15,_0x147b59){return client[_0x5c76('0x10')](_0x4942f1,_0x117269)[_0x5c76('0x11')](function(_0xea10cf){logger[_0x5c76('0x12')](_0x5c76('0x13'),_0x5be470,_0x5c76('0x14'));logger[_0x5c76('0x15')](_0x5c76('0x16'),_0x5be470,_0x5c76('0x14'),JSON[_0x5c76('0x17')](_0xea10cf));if(_0xea10cf['error']){if(_0xea10cf['error'][_0x5c76('0x18')]===0x1f4){logger[_0x5c76('0x19')](_0x5c76('0x13'),_0x5be470,_0xea10cf[_0x5c76('0x19')]['message']);return _0x147b59(_0xea10cf[_0x5c76('0x19')]['message']);}logger['error'](_0x5c76('0x13'),_0x5be470,_0xea10cf['error'][_0x5c76('0x1a')]);return _0x4cdd15(_0xea10cf[_0x5c76('0x19')][_0x5c76('0x1a')]);}else{logger['info'](_0x5c76('0x13'),_0x5be470,_0x5c76('0x14'));_0x4cdd15(_0xea10cf[_0x5c76('0x1b')][_0x5c76('0x1a')]);}})[_0x5c76('0x1c')](function(_0x2b749e){logger[_0x5c76('0x19')](_0x5c76('0x13'),_0x5be470,_0x2b749e);_0x147b59(_0x2b749e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 1c4b47e..95df7f1 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 _0x1730=['length','team:','save','remove','update','emit','removeListener','register'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x1730,0xda));var _0x0173=function(_0x593258,_0x480066){_0x593258=_0x593258-0x0;var _0xfbba09=_0x1730[_0x593258];return _0xfbba09;};'use strict';var TeamEvents=require('./team.events');var events=[_0x0173('0x0'),_0x0173('0x1'),_0x0173('0x2')];function createListener(_0xc65a7,_0x154940){return function(_0x21d07f){_0x154940[_0x0173('0x3')](_0xc65a7,_0x21d07f);};}function removeListener(_0x1ec2c2,_0x23e0a1){return function(){TeamEvents[_0x0173('0x4')](_0x1ec2c2,_0x23e0a1);};}exports[_0x0173('0x5')]=function(_0x30ce5a){for(var _0x321169=0x0,_0x16db40=events[_0x0173('0x6')];_0x321169<_0x16db40;_0x321169++){var _0xc62d3=events[_0x321169];var _0x10b805=createListener(_0x0173('0x7')+_0xc62d3,_0x30ce5a);TeamEvents['on'](_0xc62d3,_0x10b805);}}; \ No newline at end of file +var _0xfa20=['team:','./team.events','save','remove','update','emit','removeListener','length'];(function(_0x2a5a35,_0x1b41bf){var _0x3c2725=function(_0xc6f965){while(--_0xc6f965){_0x2a5a35['push'](_0x2a5a35['shift']());}};_0x3c2725(++_0x1b41bf);}(_0xfa20,0x141));var _0x0fa2=function(_0x3fefc7,_0x20a7dc){_0x3fefc7=_0x3fefc7-0x0;var _0x1fe591=_0xfa20[_0x3fefc7];return _0x1fe591;};'use strict';var TeamEvents=require(_0x0fa2('0x0'));var events=[_0x0fa2('0x1'),_0x0fa2('0x2'),_0x0fa2('0x3')];function createListener(_0x22096a,_0x97b979){return function(_0x10a7c4){_0x97b979[_0x0fa2('0x4')](_0x22096a,_0x10a7c4);};}function removeListener(_0x39123f,_0x30f4e1){return function(){TeamEvents[_0x0fa2('0x5')](_0x39123f,_0x30f4e1);};}exports['register']=function(_0x19387c){for(var _0x2247e9=0x0,_0x59b8ad=events[_0x0fa2('0x6')];_0x2247e9<_0x59b8ad;_0x2247e9++){var _0x3fde44=events[_0x2247e9];var _0x1f3223=createListener(_0x0fa2('0x7')+_0x3fde44,_0x19387c);TeamEvents['on'](_0x3fde44,_0x1f3223);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index ea642ac..b1cb646 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 _0x1b73=['INTEGER','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1b73,0x1d5));var _0x31b7=function(_0x48c2a8,_0x5d866e){_0x48c2a8=_0x48c2a8-0x0;var _0x1a303c=_0x1b73[_0x48c2a8];return _0x1a303c;};'use strict';var Sequelize=require('sequelize');module[_0x31b7('0x0')]={'TeamId':{'type':Sequelize[_0x31b7('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x31b7('0x1')]}}; \ No newline at end of file +var _0x573e=['exports','INTEGER'];(function(_0x4f3da4,_0x121375){var _0x1df1a1=function(_0x329dfc){while(--_0x329dfc){_0x4f3da4['push'](_0x4f3da4['shift']());}};_0x1df1a1(++_0x121375);}(_0x573e,0x134));var _0xe573=function(_0x5376d4,_0x4ace67){_0x5376d4=_0x5376d4-0x0;var _0x1e933d=_0x573e[_0x5376d4];return _0x1e933d;};'use strict';var Sequelize=require('sequelize');module[_0xe573('0x0')]={'TeamId':{'type':Sequelize[_0xe573('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index aa388b1..d071143 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 _0x4b74=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x4b74,0x103));var _0x44b7=function(_0x28aa6e,_0x5bae9c){_0x28aa6e=_0x28aa6e-0x0;var _0x4a28d1=_0x4b74[_0x28aa6e];return _0x4a28d1;};'use strict';var _=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var logger=require(_0x44b7('0x2'))('api');var moment=require(_0x44b7('0x3'));var BPromise=require(_0x44b7('0x4'));var rp=require(_0x44b7('0x5'));var fs=require('fs');var path=require(_0x44b7('0x6'));var rimraf=require(_0x44b7('0x7'));var config=require(_0x44b7('0x8'));var attributes=require(_0x44b7('0x9'));module[_0x44b7('0xa')]=function(_0x5ef96c,_0xdfcf5){return _0x5ef96c[_0x44b7('0xb')](_0x44b7('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1707=['../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','moment','bluebird','path','rimraf'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1707,0x1df));var _0x7170=function(_0x18804f,_0x3f95c0){_0x18804f=_0x18804f-0x0;var _0x2edfe4=_0x1707[_0x18804f];return _0x2edfe4;};'use strict';var _=require(_0x7170('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7170('0x1'));var BPromise=require(_0x7170('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7170('0x3'));var rimraf=require(_0x7170('0x4'));var config=require(_0x7170('0x5'));var attributes=require(_0x7170('0x6'));module[_0x7170('0x7')]=function(_0x19d043,_0x215acb){return _0x19d043[_0x7170('0x8')](_0x7170('0x9'),attributes,{'tableName':_0x7170('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 a5f72d6..899cd0c 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2c984d,_0x5a6f2f){var _0x31df62=function(_0x180acd){while(--_0x180acd){_0x2c984d['push'](_0x2c984d['shift']());}};_0x31df62(++_0x5a6f2f);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x12e650,_0x33f29f){var _0x5b56b1=function(_0xa7f3d8){while(--_0xa7f3d8){_0x12e650['push'](_0x12e650['shift']());}};_0x5b56b1(++_0x33f29f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 39ee372..5603a0f 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 _0x51e3=['exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x51e3,0x1e4));var _0x351e=function(_0xcf56d3,_0x4b0a74){_0xcf56d3=_0xcf56d3-0x0;var _0x1dffa1=_0x51e3[_0xcf56d3];return _0x1dffa1;};'use strict';var Sequelize=require('sequelize');module[_0x351e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8c31=['exports'];(function(_0x280ed8,_0x26fc9d){var _0x3a711a=function(_0x462c19){while(--_0x462c19){_0x280ed8['push'](_0x280ed8['shift']());}};_0x3a711a(++_0x26fc9d);}(_0x8c31,0x98));var _0x18c3=function(_0x1e82f8,_0x41f9e3){_0x1e82f8=_0x1e82f8-0x0;var _0x11b1c5=_0x8c31[_0x1e82f8];return _0x11b1c5;};'use strict';var Sequelize=require('sequelize');module[_0x18c3('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 7e55642..a31739f 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 _0x3685=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','moment'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var moment=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var rp=require(_0x5368('0x5'));var fs=require('fs');var path=require(_0x5368('0x6'));var rimraf=require(_0x5368('0x7'));var config=require(_0x5368('0x8'));var attributes=require(_0x5368('0x9'));module[_0x5368('0xa')]=function(_0x4fc6ed,_0x1a4450){return _0x4fc6ed[_0x5368('0xb')](_0x5368('0xc'),attributes,{'tableName':_0x5368('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66fa=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x6be190,_0x25e8dd){var _0x3867df=function(_0x204898){while(--_0x204898){_0x6be190['push'](_0x6be190['shift']());}};_0x3867df(++_0x25e8dd);}(_0x66fa,0x168));var _0xa66f=function(_0xff44c8,_0xf83d1){_0xff44c8=_0xff44c8-0x0;var _0x42952d=_0x66fa[_0xff44c8];return _0x42952d;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require(_0xa66f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var fs=require('fs');var path=require(_0xa66f('0x5'));var rimraf=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var attributes=require(_0xa66f('0x8'));module[_0xa66f('0x9')]=function(_0x4532ee,_0x25a7a0){return _0x4532ee[_0xa66f('0xa')](_0xa66f('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 22e1574..a088d77 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 _0xd1a6=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x467b04,_0x34c4c7){var _0x599e5e=function(_0x186700){while(--_0x186700){_0x467b04['push'](_0x467b04['shift']());}};_0x599e5e(++_0x34c4c7);}(_0xd1a6,0x176));var _0x6d1a=function(_0x18fec8,_0x31d0cd){_0x18fec8=_0x18fec8-0x0;var _0x5e400c=_0xd1a6[_0x18fec8];return _0x5e400c;};'use strict';var _=require('lodash');var util=require(_0x6d1a('0x0'));var moment=require(_0x6d1a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d1a('0x2'));var fs=require('fs');var Redis=require(_0x6d1a('0x3'));var db=require(_0x6d1a('0x4'))['db'];var utils=require(_0x6d1a('0x5'));var logger=require(_0x6d1a('0x6'))(_0x6d1a('0x7'));var config=require(_0x6d1a('0x8'));var jayson=require(_0x6d1a('0x9'));var client=jayson[_0x6d1a('0xa')][_0x6d1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a0c3d,_0x108d18,_0x2ee44c){return new BPromise(function(_0xf58310,_0x7edb45){return client[_0x6d1a('0xc')](_0x2a0c3d,_0x2ee44c)[_0x6d1a('0xd')](function(_0x398142){logger['info'](_0x6d1a('0xe'),_0x108d18,_0x6d1a('0xf'));logger['debug'](_0x6d1a('0x10'),_0x108d18,_0x6d1a('0xf'),JSON['stringify'](_0x398142));if(_0x398142[_0x6d1a('0x11')]){if(_0x398142['error'][_0x6d1a('0x12')]===0x1f4){logger[_0x6d1a('0x11')](_0x6d1a('0xe'),_0x108d18,_0x398142['error'][_0x6d1a('0x13')]);return _0x7edb45(_0x398142[_0x6d1a('0x11')][_0x6d1a('0x13')]);}logger['error'](_0x6d1a('0xe'),_0x108d18,_0x398142[_0x6d1a('0x11')]['message']);return _0xf58310(_0x398142['error']['message']);}else{logger[_0x6d1a('0x14')](_0x6d1a('0xe'),_0x108d18,_0x6d1a('0xf'));_0xf58310(_0x398142['result'][_0x6d1a('0x13')]);}})[_0x6d1a('0x15')](function(_0x122795){logger['error'](_0x6d1a('0xe'),_0x108d18,_0x122795);_0x7edb45(_0x122795);});});} \ No newline at end of file +var _0xbf83=['jayson/promise','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x481a03,_0x27a80b){var _0x149186=function(_0x2a0952){while(--_0x2a0952){_0x481a03['push'](_0x481a03['shift']());}};_0x149186(++_0x27a80b);}(_0xbf83,0x11e));var _0x3bf8=function(_0x42e1ac,_0x1bf631){_0x42e1ac=_0x42e1ac-0x0;var _0x33256c=_0xbf83[_0x42e1ac];return _0x33256c;};'use strict';var _=require(_0x3bf8('0x0'));var util=require('util');var moment=require(_0x3bf8('0x1'));var BPromise=require(_0x3bf8('0x2'));var rs=require(_0x3bf8('0x3'));var fs=require('fs');var Redis=require(_0x3bf8('0x4'));var db=require(_0x3bf8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3bf8('0x6'));var config=require(_0x3bf8('0x7'));var jayson=require(_0x3bf8('0x8'));var client=jayson[_0x3bf8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0c12,_0x168a20,_0x2df7c9){return new BPromise(function(_0x4adc52,_0x27c23f){return client['request'](_0x5b0c12,_0x2df7c9)[_0x3bf8('0xa')](function(_0x2eca24){logger[_0x3bf8('0xb')](_0x3bf8('0xc'),_0x168a20,_0x3bf8('0xd'));logger[_0x3bf8('0xe')](_0x3bf8('0xf'),_0x168a20,'request\x20sent',JSON[_0x3bf8('0x10')](_0x2eca24));if(_0x2eca24[_0x3bf8('0x11')]){if(_0x2eca24['error'][_0x3bf8('0x12')]===0x1f4){logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x2eca24[_0x3bf8('0x11')][_0x3bf8('0x13')]);return _0x27c23f(_0x2eca24[_0x3bf8('0x11')][_0x3bf8('0x13')]);}logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x2eca24[_0x3bf8('0x11')]['message']);return _0x4adc52(_0x2eca24['error'][_0x3bf8('0x13')]);}else{logger[_0x3bf8('0xb')](_0x3bf8('0xc'),_0x168a20,_0x3bf8('0xd'));_0x4adc52(_0x2eca24['result'][_0x3bf8('0x13')]);}})[_0x3bf8('0x14')](function(_0x1a77fc){logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x1a77fc);_0x27c23f(_0x1a77fc);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3c9b9da..5f1ec1a 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 _0x1a37=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','put','update','delete','destroy'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x1a37,0xb4));var _0x71a3=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x1a37[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./template.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x71a3('0xe')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller[_0x71a3('0xf')]);router[_0x71a3('0x10')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x676c=['isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc676('0x0'));var util=require(_0xc676('0x1'));var path=require(_0xc676('0x2'));var timeout=require('connect-timeout');var express=require(_0xc676('0x3'));var router=express[_0xc676('0x4')]();var fs_extra=require(_0xc676('0x5'));var auth=require(_0xc676('0x6'));var interaction=require(_0xc676('0x7'));var config=require(_0xc676('0x8'));var controller=require('./template.controller');router[_0xc676('0x9')]('/',auth[_0xc676('0xa')](),controller[_0xc676('0xb')]);router[_0xc676('0x9')](_0xc676('0xc'),auth['isAuthenticated'](),controller[_0xc676('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc676('0xe')]);router[_0xc676('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc676('0x10')]);router[_0xc676('0x11')](_0xc676('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc676('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index aa5472d..a5d16f7 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 _0x8037=['STRING','TEXT','sequelize','exports'];(function(_0x10e76f,_0x515c58){var _0x3b955c=function(_0x2f291a){while(--_0x2f291a){_0x10e76f['push'](_0x10e76f['shift']());}};_0x3b955c(++_0x515c58);}(_0x8037,0x9a));var _0x7803=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8037[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7803('0x0'));module[_0x7803('0x1')]={'name':{'type':Sequelize[_0x7803('0x2')]},'description':{'type':Sequelize[_0x7803('0x2')]},'html':{'type':Sequelize[_0x7803('0x3')]}}; \ No newline at end of file +var _0x11ac=['STRING','exports'];(function(_0x1967b8,_0x2ce618){var _0xeacbb7=function(_0x4e5c73){while(--_0x4e5c73){_0x1967b8['push'](_0x1967b8['shift']());}};_0xeacbb7(++_0x2ce618);}(_0x11ac,0x183));var _0xc11a=function(_0x5ac5c7,_0x22d57f){_0x5ac5c7=_0x5ac5c7-0x0;var _0xaca016=_0x11ac[_0x5ac5c7];return _0xaca016;};'use strict';var Sequelize=require('sequelize');module[_0xc11a('0x0')]={'name':{'type':Sequelize[_0xc11a('0x1')]},'description':{'type':Sequelize[_0xc11a('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1d076e3..ece1681 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 _0xf63a=['key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','limit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','Template','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x45c1ce,_0x29febe){var _0x286bd8=function(_0x3782e6){while(--_0x3782e6){_0x45c1ce['push'](_0x45c1ce['shift']());}};_0x286bd8(++_0x29febe);}(_0xf63a,0x1d2));var _0xaf63=function(_0x197683,_0x21df72){_0x197683=_0x197683-0x0;var _0x137639=_0xf63a[_0x197683];return _0x137639;};'use strict';var emlformat=require(_0xaf63('0x0'));var rimraf=require(_0xaf63('0x1'));var zipdir=require(_0xaf63('0x2'));var jsonpatch=require(_0xaf63('0x3'));var rp=require(_0xaf63('0x4'));var moment=require(_0xaf63('0x5'));var BPromise=require(_0xaf63('0x6'));var Mustache=require(_0xaf63('0x7'));var util=require('util');var path=require(_0xaf63('0x8'));var sox=require(_0xaf63('0x9'));var csv=require(_0xaf63('0xa'));var ejs=require(_0xaf63('0xb'));var fs=require('fs');var fs_extra=require(_0xaf63('0xc'));var _=require(_0xaf63('0xd'));var squel=require('squel');var crypto=require(_0xaf63('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaf63('0xf'));var toCsv=require(_0xaf63('0xa'));var querystring=require('querystring');var Papa=require(_0xaf63('0x10'));var Redis=require('ioredis');var authService=require(_0xaf63('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaf63('0x12'));var hardwareService=require(_0xaf63('0x13'));var logger=require(_0xaf63('0x14'))(_0xaf63('0x15'));var utils=require('../../config/utils');var config=require(_0xaf63('0x16'));var licenseUtil=require(_0xaf63('0x17'));var db=require(_0xaf63('0x18'))['db'];function respondWithStatusCode(_0x4b237b,_0x81378d){_0x81378d=_0x81378d||0xcc;return function(_0x20c209){if(_0x20c209){return _0x4b237b[_0xaf63('0x19')](_0x81378d);}return _0x4b237b['status'](_0x81378d)[_0xaf63('0x1a')]();};}function respondWithResult(_0x2b92ad,_0x774f81){_0x774f81=_0x774f81||0xc8;return function(_0x26a36f){if(_0x26a36f){return _0x2b92ad[_0xaf63('0x1b')](_0x774f81)[_0xaf63('0x1c')](_0x26a36f);}};}function respondWithFilteredResult(_0x33f816,_0x4832da){return function(_0x2666ea){if(_0x2666ea){var _0x1a36fd=typeof _0x4832da[_0xaf63('0x1d')]===_0xaf63('0x1e')&&typeof _0x4832da['limit']===_0xaf63('0x1e');var _0x3263d4=_0x2666ea[_0xaf63('0x1f')];var _0x235fcd=_0x1a36fd?0x0:_0x4832da[_0xaf63('0x1d')];var _0x466d54=_0x1a36fd?_0x2666ea[_0xaf63('0x1f')]:_0x4832da[_0xaf63('0x1d')]+_0x4832da['limit'];var _0x2514fd;if(_0x466d54>=_0x3263d4){_0x466d54=_0x3263d4;_0x2514fd=0xc8;}else{_0x2514fd=0xce;}_0x33f816[_0xaf63('0x1b')](_0x2514fd);return _0x33f816[_0xaf63('0x20')]('Content-Range',_0x235fcd+'-'+_0x466d54+'/'+_0x3263d4)[_0xaf63('0x1c')](_0x2666ea);}return null;};}function patchUpdates(_0x274e86){return function(_0x108819){try{jsonpatch[_0xaf63('0x21')](_0x108819,_0x274e86,!![]);}catch(_0x13cc58){return BPromise[_0xaf63('0x22')](_0x13cc58);}return _0x108819[_0xaf63('0x23')]();};}function saveUpdates(_0x3c0c81,_0x47b1c9){return function(_0x2a4194){if(_0x2a4194){return _0x2a4194['update'](_0x3c0c81)[_0xaf63('0x24')](function(_0x350c29){return _0x350c29;});}return null;};}function removeEntity(_0x30c731,_0x1f0c3d){return function(_0x4cf1c3){if(_0x4cf1c3){return _0x4cf1c3[_0xaf63('0x25')]()['then'](function(){var _0x2afae8=_0x4cf1c3[_0xaf63('0x26')]({'plain':!![]});var _0x1beb8b=_0xaf63('0x27');return db[_0xaf63('0x28')]['destroy']({'where':{'type':_0x1beb8b,'resourceId':_0x2afae8['id']}})[_0xaf63('0x24')](function(){return _0x4cf1c3;});})['then'](function(){_0x30c731[_0xaf63('0x1b')](0xcc)[_0xaf63('0x1a')]();});}};}function handleEntityNotFound(_0xa2bac4,_0x28d494){return function(_0x20648d){if(!_0x20648d){_0xa2bac4['sendStatus'](0x194);}return _0x20648d;};}function handleError(_0x25a9d9,_0x20a488){_0x20a488=_0x20a488||0x1f4;return function(_0x4f2fbf){logger[_0xaf63('0x29')](_0x4f2fbf[_0xaf63('0x2a')]);if(_0x4f2fbf['name']){delete _0x4f2fbf[_0xaf63('0x2b')];}_0x25a9d9['status'](_0x20a488)[_0xaf63('0x2c')](_0x4f2fbf);};}exports[_0xaf63('0x2d')]=function(_0x2b328c,_0x120d2f){var _0xb8e57f={},_0x38754c={},_0x5cb330={'count':0x0,'rows':[]};var _0x1b9d77=_[_0xaf63('0x2e')](db['Template'][_0xaf63('0x2f')],function(_0x3b1b27){return{'name':_0x3b1b27[_0xaf63('0x30')],'type':_0x3b1b27[_0xaf63('0x31')][_0xaf63('0x32')]};});_0x38754c[_0xaf63('0x33')]=_['map'](_0x1b9d77,'name');_0x38754c['query']=_[_0xaf63('0x34')](_0x2b328c[_0xaf63('0x35')]);_0x38754c['filters']=_[_0xaf63('0x36')](_0x38754c[_0xaf63('0x33')],_0x38754c[_0xaf63('0x35')]);_0xb8e57f['attributes']=_['intersection'](_0x38754c[_0xaf63('0x33')],qs[_0xaf63('0x37')](_0x2b328c[_0xaf63('0x35')]['fields']));_0xb8e57f['attributes']=_0xb8e57f['attributes'][_0xaf63('0x38')]?_0xb8e57f[_0xaf63('0x39')]:_0x38754c[_0xaf63('0x33')];if(!_0x2b328c['query'][_0xaf63('0x3a')]('nolimit')){_0xb8e57f[_0xaf63('0x3b')]=qs[_0xaf63('0x3b')](_0x2b328c['query'][_0xaf63('0x3b')]);_0xb8e57f[_0xaf63('0x1d')]=qs['offset'](_0x2b328c['query'][_0xaf63('0x1d')]);}_0xb8e57f[_0xaf63('0x3c')]=qs['sort'](_0x2b328c[_0xaf63('0x35')]['sort']);_0xb8e57f[_0xaf63('0x3d')]=qs[_0xaf63('0x3e')](_[_0xaf63('0x3f')](_0x2b328c['query'],_0x38754c[_0xaf63('0x3e')]),_0x1b9d77);if(_0x2b328c[_0xaf63('0x35')][_0xaf63('0x40')]){_0xb8e57f['where']=_[_0xaf63('0x41')](_0xb8e57f['where'],{'$or':_[_0xaf63('0x2e')](_0x1b9d77,function(_0x33cb77){if(_0x33cb77['type']!==_0xaf63('0x42')){var _0xe7c057={};_0xe7c057[_0x33cb77[_0xaf63('0x2b')]]={'$like':'%'+_0x2b328c[_0xaf63('0x35')][_0xaf63('0x40')]+'%'};return _0xe7c057;}})});}_0xb8e57f=_[_0xaf63('0x41')]({},_0xb8e57f,_0x2b328c[_0xaf63('0x43')]);var _0x1eb3c4={'where':_0xb8e57f[_0xaf63('0x3d')]};return db['Template'][_0xaf63('0x1f')](_0x1eb3c4)[_0xaf63('0x24')](function(_0x24c28c){_0x5cb330[_0xaf63('0x1f')]=_0x24c28c;if(_0x2b328c[_0xaf63('0x35')][_0xaf63('0x44')]){_0xb8e57f['include']=[{'all':!![]}];}return db['Template'][_0xaf63('0x45')](_0xb8e57f);})['then'](function(_0x4cb487){_0x5cb330[_0xaf63('0x46')]=_0x4cb487;return _0x5cb330;})[_0xaf63('0x24')](respondWithFilteredResult(_0x120d2f,_0xb8e57f))[_0xaf63('0x47')](handleError(_0x120d2f,null));};exports[_0xaf63('0x48')]=function(_0x1d9993,_0x100714){var _0x17224f={'raw':!![],'where':{'id':_0x1d9993[_0xaf63('0x49')]['id']}},_0x202bcc={};_0x202bcc[_0xaf63('0x33')]=_['keys'](db[_0xaf63('0x4a')][_0xaf63('0x2f')]);_0x202bcc['query']=_[_0xaf63('0x34')](_0x1d9993[_0xaf63('0x35')]);_0x202bcc[_0xaf63('0x3e')]=_['intersection'](_0x202bcc[_0xaf63('0x33')],_0x202bcc['query']);_0x17224f[_0xaf63('0x39')]=_['intersection'](_0x202bcc[_0xaf63('0x33')],qs[_0xaf63('0x37')](_0x1d9993[_0xaf63('0x35')]['fields']));_0x17224f[_0xaf63('0x39')]=_0x17224f[_0xaf63('0x39')][_0xaf63('0x38')]?_0x17224f[_0xaf63('0x39')]:_0x202bcc[_0xaf63('0x33')];if(_0x1d9993[_0xaf63('0x35')][_0xaf63('0x44')]){_0x17224f[_0xaf63('0x4b')]=[{'all':!![]}];}_0x17224f=_['merge']({},_0x17224f,_0x1d9993[_0xaf63('0x43')]);return db[_0xaf63('0x4a')][_0xaf63('0x4c')](_0x17224f)[_0xaf63('0x24')](handleEntityNotFound(_0x100714,null))[_0xaf63('0x24')](respondWithResult(_0x100714,null))[_0xaf63('0x47')](handleError(_0x100714,null));};exports[_0xaf63('0x4d')]=function(_0x2fb9e0,_0x4c491d){return db[_0xaf63('0x4a')][_0xaf63('0x4d')](_0x2fb9e0[_0xaf63('0x4e')],{})[_0xaf63('0x24')](function(_0xd3e88f){var _0x11a430=_0x2fb9e0[_0xaf63('0x4f')][_0xaf63('0x26')]({'plain':!![]});if(!_0x11a430)throw new Error(_0xaf63('0x50'));if(_0x11a430['role']===_0xaf63('0x4f')){var _0x98fb9e=_0xd3e88f[_0xaf63('0x26')]({'plain':!![]});var _0x46d0f1=_0xaf63('0x27');return db[_0xaf63('0x51')][_0xaf63('0x4c')]({'where':{'name':_0x46d0f1,'userProfileId':_0x11a430[_0xaf63('0x52')]},'raw':!![]})[_0xaf63('0x24')](function(_0x4e1284){if(_0x4e1284&&_0x4e1284[_0xaf63('0x53')]===0x0){return db[_0xaf63('0x28')][_0xaf63('0x4d')]({'name':_0x98fb9e[_0xaf63('0x2b')],'resourceId':_0x98fb9e['id'],'type':_0x4e1284[_0xaf63('0x2b')],'sectionId':_0x4e1284['id']},{})[_0xaf63('0x24')](function(){return _0xd3e88f;});}else{return _0xd3e88f;}})[_0xaf63('0x47')](function(_0x40dd05){logger[_0xaf63('0x29')](_0xaf63('0x54'),_0x40dd05);throw _0x40dd05;});}return _0xd3e88f;})['then'](respondWithResult(_0x4c491d,0xc9))[_0xaf63('0x47')](handleError(_0x4c491d,null));};exports[_0xaf63('0x55')]=function(_0x5eca79,_0x36b432){if(_0x5eca79[_0xaf63('0x4e')]['id']){delete _0x5eca79['body']['id'];}return db[_0xaf63('0x4a')]['find']({'where':{'id':_0x5eca79[_0xaf63('0x49')]['id']}})['then'](handleEntityNotFound(_0x36b432,null))[_0xaf63('0x24')](saveUpdates(_0x5eca79['body'],null))['then'](respondWithResult(_0x36b432,null))[_0xaf63('0x47')](handleError(_0x36b432,null));};exports[_0xaf63('0x25')]=function(_0x3f9ba1,_0x1f2d0e){return db[_0xaf63('0x4a')][_0xaf63('0x4c')]({'where':{'id':_0x3f9ba1['params']['id']}})[_0xaf63('0x24')](handleEntityNotFound(_0x1f2d0e,null))[_0xaf63('0x24')](removeEntity(_0x1f2d0e,null))['catch'](handleError(_0x1f2d0e,null));}; \ No newline at end of file +var _0x8e0b=['undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','type','options','includeAll','include','findAll','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x46bb73,_0x44f394){var _0x44f271=function(_0x2a96bc){while(--_0x2a96bc){_0x46bb73['push'](_0x46bb73['shift']());}};_0x44f271(++_0x44f394);}(_0x8e0b,0x1a9));var _0xb8e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e0b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb8e0('0x0'));var rimraf=require(_0xb8e0('0x1'));var zipdir=require(_0xb8e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb8e0('0x3'));var BPromise=require(_0xb8e0('0x4'));var Mustache=require('mustache');var util=require(_0xb8e0('0x5'));var path=require('path');var sox=require(_0xb8e0('0x6'));var csv=require(_0xb8e0('0x7'));var ejs=require(_0xb8e0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8e0('0x9'));var squel=require(_0xb8e0('0xa'));var crypto=require(_0xb8e0('0xb'));var jsforce=require(_0xb8e0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb8e0('0x7'));var querystring=require(_0xb8e0('0xd'));var Papa=require(_0xb8e0('0xe'));var Redis=require(_0xb8e0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8e0('0x10'));var logger=require(_0xb8e0('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xb8e0('0x12'));var licenseUtil=require(_0xb8e0('0x13'));var db=require(_0xb8e0('0x14'))['db'];function respondWithStatusCode(_0x1a2281,_0x2c545c){_0x2c545c=_0x2c545c||0xcc;return function(_0x499b4a){if(_0x499b4a){return _0x1a2281[_0xb8e0('0x15')](_0x2c545c);}return _0x1a2281[_0xb8e0('0x16')](_0x2c545c)['end']();};}function respondWithResult(_0x2de8ea,_0x4e01a2){_0x4e01a2=_0x4e01a2||0xc8;return function(_0x3c7de9){if(_0x3c7de9){return _0x2de8ea[_0xb8e0('0x16')](_0x4e01a2)[_0xb8e0('0x17')](_0x3c7de9);}};}function respondWithFilteredResult(_0x3a4354,_0x5d0852){return function(_0x495103){if(_0x495103){var _0x375715=typeof _0x5d0852[_0xb8e0('0x18')]===_0xb8e0('0x19')&&typeof _0x5d0852[_0xb8e0('0x1a')]===_0xb8e0('0x19');var _0xb66fc2=_0x495103[_0xb8e0('0x1b')];var _0x2f1037=_0x375715?0x0:_0x5d0852[_0xb8e0('0x18')];var _0x498dd8=_0x375715?_0x495103[_0xb8e0('0x1b')]:_0x5d0852['offset']+_0x5d0852[_0xb8e0('0x1a')];var _0x257f3d;if(_0x498dd8>=_0xb66fc2){_0x498dd8=_0xb66fc2;_0x257f3d=0xc8;}else{_0x257f3d=0xce;}_0x3a4354['status'](_0x257f3d);return _0x3a4354[_0xb8e0('0x1c')](_0xb8e0('0x1d'),_0x2f1037+'-'+_0x498dd8+'/'+_0xb66fc2)[_0xb8e0('0x17')](_0x495103);}return null;};}function patchUpdates(_0x54f1d9){return function(_0x4cfe53){try{jsonpatch['apply'](_0x4cfe53,_0x54f1d9,!![]);}catch(_0x4264ef){return BPromise[_0xb8e0('0x1e')](_0x4264ef);}return _0x4cfe53[_0xb8e0('0x1f')]();};}function saveUpdates(_0x4f8920,_0x42d83b){return function(_0xcee17f){if(_0xcee17f){return _0xcee17f[_0xb8e0('0x20')](_0x4f8920)[_0xb8e0('0x21')](function(_0x105e08){return _0x105e08;});}return null;};}function removeEntity(_0x4f3539,_0x2f5f1){return function(_0x5a62a9){if(_0x5a62a9){return _0x5a62a9[_0xb8e0('0x22')]()[_0xb8e0('0x21')](function(){var _0x1a6950=_0x5a62a9[_0xb8e0('0x23')]({'plain':!![]});var _0x2dbd78='Templates';return db[_0xb8e0('0x24')][_0xb8e0('0x22')]({'where':{'type':_0x2dbd78,'resourceId':_0x1a6950['id']}})[_0xb8e0('0x21')](function(){return _0x5a62a9;});})[_0xb8e0('0x21')](function(){_0x4f3539[_0xb8e0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45fbeb,_0x2c0ec){return function(_0x50185a){if(!_0x50185a){_0x45fbeb[_0xb8e0('0x15')](0x194);}return _0x50185a;};}function handleError(_0x5121ab,_0x48b588){_0x48b588=_0x48b588||0x1f4;return function(_0x537ae7){logger[_0xb8e0('0x25')](_0x537ae7[_0xb8e0('0x26')]);if(_0x537ae7[_0xb8e0('0x27')]){delete _0x537ae7['name'];}_0x5121ab[_0xb8e0('0x16')](_0x48b588)[_0xb8e0('0x28')](_0x537ae7);};}exports[_0xb8e0('0x29')]=function(_0x24c68e,_0x1783c3){var _0x53fcf7={},_0x119ef3={},_0x267f65={'count':0x0,'rows':[]};var _0x2b5456=_[_0xb8e0('0x2a')](db[_0xb8e0('0x2b')][_0xb8e0('0x2c')],function(_0x1ab9a9){return{'name':_0x1ab9a9['fieldName'],'type':_0x1ab9a9['type']['key']};});_0x119ef3[_0xb8e0('0x2d')]=_[_0xb8e0('0x2a')](_0x2b5456,_0xb8e0('0x27'));_0x119ef3[_0xb8e0('0x2e')]=_[_0xb8e0('0x2f')](_0x24c68e[_0xb8e0('0x2e')]);_0x119ef3['filters']=_[_0xb8e0('0x30')](_0x119ef3[_0xb8e0('0x2d')],_0x119ef3[_0xb8e0('0x2e')]);_0x53fcf7[_0xb8e0('0x31')]=_[_0xb8e0('0x30')](_0x119ef3[_0xb8e0('0x2d')],qs[_0xb8e0('0x32')](_0x24c68e[_0xb8e0('0x2e')][_0xb8e0('0x32')]));_0x53fcf7['attributes']=_0x53fcf7[_0xb8e0('0x31')][_0xb8e0('0x33')]?_0x53fcf7['attributes']:_0x119ef3[_0xb8e0('0x2d')];if(!_0x24c68e[_0xb8e0('0x2e')]['hasOwnProperty'](_0xb8e0('0x34'))){_0x53fcf7[_0xb8e0('0x1a')]=qs[_0xb8e0('0x1a')](_0x24c68e[_0xb8e0('0x2e')]['limit']);_0x53fcf7[_0xb8e0('0x18')]=qs[_0xb8e0('0x18')](_0x24c68e[_0xb8e0('0x2e')][_0xb8e0('0x18')]);}_0x53fcf7[_0xb8e0('0x35')]=qs[_0xb8e0('0x36')](_0x24c68e[_0xb8e0('0x2e')][_0xb8e0('0x36')]);_0x53fcf7[_0xb8e0('0x37')]=qs[_0xb8e0('0x38')](_['pick'](_0x24c68e[_0xb8e0('0x2e')],_0x119ef3[_0xb8e0('0x38')]),_0x2b5456);if(_0x24c68e['query']['filter']){_0x53fcf7['where']=_[_0xb8e0('0x39')](_0x53fcf7[_0xb8e0('0x37')],{'$or':_[_0xb8e0('0x2a')](_0x2b5456,function(_0x4997e6){if(_0x4997e6[_0xb8e0('0x3a')]!=='VIRTUAL'){var _0x56f055={};_0x56f055[_0x4997e6[_0xb8e0('0x27')]]={'$like':'%'+_0x24c68e['query']['filter']+'%'};return _0x56f055;}})});}_0x53fcf7=_[_0xb8e0('0x39')]({},_0x53fcf7,_0x24c68e[_0xb8e0('0x3b')]);var _0x13228d={'where':_0x53fcf7[_0xb8e0('0x37')]};return db[_0xb8e0('0x2b')][_0xb8e0('0x1b')](_0x13228d)['then'](function(_0x28e4fe){_0x267f65[_0xb8e0('0x1b')]=_0x28e4fe;if(_0x24c68e[_0xb8e0('0x2e')][_0xb8e0('0x3c')]){_0x53fcf7[_0xb8e0('0x3d')]=[{'all':!![]}];}return db[_0xb8e0('0x2b')][_0xb8e0('0x3e')](_0x53fcf7);})['then'](function(_0x526233){_0x267f65['rows']=_0x526233;return _0x267f65;})['then'](respondWithFilteredResult(_0x1783c3,_0x53fcf7))[_0xb8e0('0x3f')](handleError(_0x1783c3,null));};exports[_0xb8e0('0x40')]=function(_0xb2ab42,_0x2e077e){var _0x36640f={'raw':!![],'where':{'id':_0xb2ab42['params']['id']}},_0x5d028f={};_0x5d028f[_0xb8e0('0x2d')]=_[_0xb8e0('0x2f')](db['Template'][_0xb8e0('0x2c')]);_0x5d028f['query']=_[_0xb8e0('0x2f')](_0xb2ab42[_0xb8e0('0x2e')]);_0x5d028f[_0xb8e0('0x38')]=_['intersection'](_0x5d028f[_0xb8e0('0x2d')],_0x5d028f[_0xb8e0('0x2e')]);_0x36640f['attributes']=_[_0xb8e0('0x30')](_0x5d028f[_0xb8e0('0x2d')],qs['fields'](_0xb2ab42['query'][_0xb8e0('0x32')]));_0x36640f[_0xb8e0('0x31')]=_0x36640f[_0xb8e0('0x31')][_0xb8e0('0x33')]?_0x36640f[_0xb8e0('0x31')]:_0x5d028f[_0xb8e0('0x2d')];if(_0xb2ab42['query'][_0xb8e0('0x3c')]){_0x36640f['include']=[{'all':!![]}];}_0x36640f=_[_0xb8e0('0x39')]({},_0x36640f,_0xb2ab42['options']);return db[_0xb8e0('0x2b')]['find'](_0x36640f)['then'](handleEntityNotFound(_0x2e077e,null))[_0xb8e0('0x21')](respondWithResult(_0x2e077e,null))[_0xb8e0('0x3f')](handleError(_0x2e077e,null));};exports['create']=function(_0x379e55,_0x2de3f4){return db[_0xb8e0('0x2b')][_0xb8e0('0x41')](_0x379e55[_0xb8e0('0x42')],{})['then'](function(_0x192ae2){var _0x583540=_0x379e55[_0xb8e0('0x43')]['get']({'plain':!![]});if(!_0x583540)throw new Error(_0xb8e0('0x44'));if(_0x583540[_0xb8e0('0x45')]===_0xb8e0('0x43')){var _0x26e0cb=_0x192ae2[_0xb8e0('0x23')]({'plain':!![]});var _0x5ea299=_0xb8e0('0x46');return db[_0xb8e0('0x47')]['find']({'where':{'name':_0x5ea299,'userProfileId':_0x583540['userProfileId']},'raw':!![]})[_0xb8e0('0x21')](function(_0x490e4f){if(_0x490e4f&&_0x490e4f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x26e0cb[_0xb8e0('0x27')],'resourceId':_0x26e0cb['id'],'type':_0x490e4f[_0xb8e0('0x27')],'sectionId':_0x490e4f['id']},{})[_0xb8e0('0x21')](function(){return _0x192ae2;});}else{return _0x192ae2;}})['catch'](function(_0x46f9ab){logger['error'](_0xb8e0('0x48'),_0x46f9ab);throw _0x46f9ab;});}return _0x192ae2;})[_0xb8e0('0x21')](respondWithResult(_0x2de3f4,0xc9))[_0xb8e0('0x3f')](handleError(_0x2de3f4,null));};exports['update']=function(_0x24cfb2,_0x5d6626){if(_0x24cfb2['body']['id']){delete _0x24cfb2[_0xb8e0('0x42')]['id'];}return db['Template'][_0xb8e0('0x49')]({'where':{'id':_0x24cfb2[_0xb8e0('0x4a')]['id']}})[_0xb8e0('0x21')](handleEntityNotFound(_0x5d6626,null))[_0xb8e0('0x21')](saveUpdates(_0x24cfb2['body'],null))['then'](respondWithResult(_0x5d6626,null))[_0xb8e0('0x3f')](handleError(_0x5d6626,null));};exports['destroy']=function(_0x198fd2,_0x1589ab){return db['Template'][_0xb8e0('0x49')]({'where':{'id':_0x198fd2[_0xb8e0('0x4a')]['id']}})[_0xb8e0('0x21')](handleEntityNotFound(_0x1589ab,null))[_0xb8e0('0x21')](removeEntity(_0x1589ab,null))[_0xb8e0('0x3f')](handleError(_0x1589ab,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d972532..c4c27e7 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 _0xd312=['path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','api','request-promise'];(function(_0x522ec9,_0x3d0021){var _0x227aca=function(_0x2c8789){while(--_0x2c8789){_0x522ec9['push'](_0x522ec9['shift']());}};_0x227aca(++_0x3d0021);}(_0xd312,0x1e7));var _0x2d31=function(_0x29711d,_0x2572c4){_0x29711d=_0x29711d-0x0;var _0x266dc3=_0xd312[_0x29711d];return _0x266dc3;};'use strict';var _=require(_0x2d31('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d31('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d31('0x2'));var fs=require('fs');var path=require(_0x2d31('0x3'));var rimraf=require(_0x2d31('0x4'));var config=require('../../config/environment');var attributes=require(_0x2d31('0x5'));module[_0x2d31('0x6')]=function(_0x20ac81,_0x1e7c14){return _0x20ac81[_0x2d31('0x7')](_0x2d31('0x8'),attributes,{'tableName':_0x2d31('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bdf=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports'];(function(_0x5204cf,_0x242ca8){var _0x154c81=function(_0x38b46b){while(--_0x38b46b){_0x5204cf['push'](_0x5204cf['shift']());}};_0x154c81(++_0x242ca8);}(_0x7bdf,0x1e1));var _0xf7bd=function(_0x478206,_0x40de1b){_0x478206=_0x478206-0x0;var _0x41069a=_0x7bdf[_0x478206];return _0x41069a;};'use strict';var _=require('lodash');var util=require(_0xf7bd('0x0'));var logger=require(_0xf7bd('0x1'))(_0xf7bd('0x2'));var moment=require(_0xf7bd('0x3'));var BPromise=require(_0xf7bd('0x4'));var rp=require(_0xf7bd('0x5'));var fs=require('fs');var path=require(_0xf7bd('0x6'));var rimraf=require(_0xf7bd('0x7'));var config=require(_0xf7bd('0x8'));var attributes=require(_0xf7bd('0x9'));module[_0xf7bd('0xa')]=function(_0x82a192,_0x1b7b32){return _0x82a192[_0xf7bd('0xb')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index c3d4697..f7e7c83 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 _0x5da7=['map','include','model','GetTemplate','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','Template','findAll','raw','options','where','attributes','limit'];(function(_0x42d776,_0x293ae4){var _0x3c5803=function(_0x2c8943){while(--_0x2c8943){_0x42d776['push'](_0x42d776['shift']());}};_0x3c5803(++_0x293ae4);}(_0x5da7,0x13a));var _0x75da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x75da('0x0'));var moment=require(_0x75da('0x1'));var BPromise=require(_0x75da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75da('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75da('0x4'))(_0x75da('0x5'));var config=require(_0x75da('0x6'));var jayson=require(_0x75da('0x7'));var client=jayson['client'][_0x75da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45b032,_0x11cf3a,_0x383041){return new BPromise(function(_0x5e9423,_0x184bdf){return client['request'](_0x45b032,_0x383041)[_0x75da('0x9')](function(_0x558a57){logger[_0x75da('0xa')](_0x75da('0xb'),_0x11cf3a,'request\x20sent');logger[_0x75da('0xc')](_0x75da('0xd'),_0x11cf3a,'request\x20sent',JSON[_0x75da('0xe')](_0x558a57));if(_0x558a57[_0x75da('0xf')]){if(_0x558a57['error'][_0x75da('0x10')]===0x1f4){logger[_0x75da('0xf')](_0x75da('0xb'),_0x11cf3a,_0x558a57[_0x75da('0xf')][_0x75da('0x11')]);return _0x184bdf(_0x558a57[_0x75da('0xf')][_0x75da('0x11')]);}logger['error'](_0x75da('0xb'),_0x11cf3a,_0x558a57[_0x75da('0xf')][_0x75da('0x11')]);return _0x5e9423(_0x558a57[_0x75da('0xf')][_0x75da('0x11')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x11cf3a,_0x75da('0x12'));_0x5e9423(_0x558a57['result']['message']);}})[_0x75da('0x13')](function(_0x7005af){logger[_0x75da('0xf')]('Template,\x20%s,\x20%s',_0x11cf3a,_0x7005af);_0x184bdf(_0x7005af);});});}exports['GetTemplate']=function(_0x34ab3a){var _0x846e8c=this;return new Promise(function(_0x2625f9,_0x11d325){return db[_0x75da('0x14')][_0x75da('0x15')]({'raw':_0x34ab3a['options']?_0x34ab3a['options'][_0x75da('0x16')]===undefined?!![]:![]:!![],'where':_0x34ab3a[_0x75da('0x17')]?_0x34ab3a['options'][_0x75da('0x18')]||null:null,'attributes':_0x34ab3a[_0x75da('0x17')]?_0x34ab3a[_0x75da('0x17')][_0x75da('0x19')]||null:null,'limit':_0x34ab3a['options']?_0x34ab3a[_0x75da('0x17')][_0x75da('0x1a')]||null:null,'include':_0x34ab3a[_0x75da('0x17')]?_0x34ab3a[_0x75da('0x17')]['include']?_[_0x75da('0x1b')](_0x34ab3a[_0x75da('0x17')][_0x75da('0x1c')],function(_0x28fe86){return{'model':db[_0x28fe86[_0x75da('0x1d')]],'as':_0x28fe86['as'],'attributes':_0x28fe86[_0x75da('0x19')],'include':_0x28fe86[_0x75da('0x1c')]?_[_0x75da('0x1b')](_0x28fe86[_0x75da('0x1c')],function(_0x76a467){return{'model':db[_0x76a467[_0x75da('0x1d')]],'as':_0x76a467['as'],'attributes':_0x76a467['attributes'],'include':_0x76a467['include']?_['map'](_0x76a467['include'],function(_0x3d0a20){return{'model':db[_0x3d0a20[_0x75da('0x1d')]],'as':_0x3d0a20['as'],'attributes':_0x3d0a20[_0x75da('0x19')]};}):[]};}):[]};}):[]:[]})[_0x75da('0x9')](function(_0x451711){logger[_0x75da('0xa')](_0x75da('0x1e'),_0x34ab3a);logger[_0x75da('0xc')](_0x75da('0x1e'),_0x34ab3a,JSON[_0x75da('0xe')](_0x451711));_0x2625f9(_0x451711);})[_0x75da('0x13')](function(_0x4483ee){logger['error'](_0x75da('0x1e'),_0x4483ee[_0x75da('0x11')],_0x34ab3a);_0x11d325(_0x846e8c['error'](0x1f4,_0x4483ee[_0x75da('0x11')]));});});}; \ No newline at end of file +var _0x4d1f=['attributes','limit','include','model','map','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','code','error','Template,\x20%s,\x20%s','message','result','Template','findAll','options','where'];(function(_0x430f53,_0x47ec74){var _0x179ebd=function(_0x330cbe){while(--_0x330cbe){_0x430f53['push'](_0x430f53['shift']());}};_0x179ebd(++_0x47ec74);}(_0x4d1f,0x64));var _0xf4d1=function(_0x3b6a84,_0x3b5126){_0x3b6a84=_0x3b6a84-0x0;var _0xbc8be3=_0x4d1f[_0x3b6a84];return _0xbc8be3;};'use strict';var _=require(_0xf4d1('0x0'));var util=require(_0xf4d1('0x1'));var moment=require(_0xf4d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4d1('0x3'));var fs=require('fs');var Redis=require(_0xf4d1('0x4'));var db=require(_0xf4d1('0x5'))['db'];var utils=require(_0xf4d1('0x6'));var logger=require(_0xf4d1('0x7'))(_0xf4d1('0x8'));var config=require('../../config/environment');var jayson=require(_0xf4d1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6748e4,_0xa65219,_0x518adb){return new BPromise(function(_0x633999,_0x3d69be){return client['request'](_0x6748e4,_0x518adb)[_0xf4d1('0xa')](function(_0x52ee38){logger[_0xf4d1('0xb')]('Template,\x20%s,\x20%s',_0xa65219,_0xf4d1('0xc'));logger[_0xf4d1('0xd')](_0xf4d1('0xe'),_0xa65219,_0xf4d1('0xc'),JSON['stringify'](_0x52ee38));if(_0x52ee38['error']){if(_0x52ee38['error'][_0xf4d1('0xf')]===0x1f4){logger[_0xf4d1('0x10')](_0xf4d1('0x11'),_0xa65219,_0x52ee38[_0xf4d1('0x10')][_0xf4d1('0x12')]);return _0x3d69be(_0x52ee38[_0xf4d1('0x10')][_0xf4d1('0x12')]);}logger[_0xf4d1('0x10')](_0xf4d1('0x11'),_0xa65219,_0x52ee38[_0xf4d1('0x10')][_0xf4d1('0x12')]);return _0x633999(_0x52ee38['error']['message']);}else{logger['info'](_0xf4d1('0x11'),_0xa65219,'request\x20sent');_0x633999(_0x52ee38[_0xf4d1('0x13')][_0xf4d1('0x12')]);}})['catch'](function(_0x206a20){logger[_0xf4d1('0x10')]('Template,\x20%s,\x20%s',_0xa65219,_0x206a20);_0x3d69be(_0x206a20);});});}exports['GetTemplate']=function(_0x3a27d0){var _0x3ab896=this;return new Promise(function(_0x3a3139,_0x372190){return db[_0xf4d1('0x14')][_0xf4d1('0x15')]({'raw':_0x3a27d0[_0xf4d1('0x16')]?_0x3a27d0['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a27d0[_0xf4d1('0x16')]?_0x3a27d0[_0xf4d1('0x16')][_0xf4d1('0x17')]||null:null,'attributes':_0x3a27d0[_0xf4d1('0x16')]?_0x3a27d0[_0xf4d1('0x16')][_0xf4d1('0x18')]||null:null,'limit':_0x3a27d0[_0xf4d1('0x16')]?_0x3a27d0['options'][_0xf4d1('0x19')]||null:null,'include':_0x3a27d0[_0xf4d1('0x16')]?_0x3a27d0[_0xf4d1('0x16')][_0xf4d1('0x1a')]?_['map'](_0x3a27d0[_0xf4d1('0x16')][_0xf4d1('0x1a')],function(_0x565c46){return{'model':db[_0x565c46[_0xf4d1('0x1b')]],'as':_0x565c46['as'],'attributes':_0x565c46['attributes'],'include':_0x565c46['include']?_[_0xf4d1('0x1c')](_0x565c46[_0xf4d1('0x1a')],function(_0x2ab120){return{'model':db[_0x2ab120[_0xf4d1('0x1b')]],'as':_0x2ab120['as'],'attributes':_0x2ab120[_0xf4d1('0x18')],'include':_0x2ab120['include']?_[_0xf4d1('0x1c')](_0x2ab120['include'],function(_0x337326){return{'model':db[_0x337326[_0xf4d1('0x1b')]],'as':_0x337326['as'],'attributes':_0x337326['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4d1('0xa')](function(_0x437fbc){logger[_0xf4d1('0xb')]('GetTemplate',_0x3a27d0);logger[_0xf4d1('0xd')]('GetTemplate',_0x3a27d0,JSON[_0xf4d1('0x1d')](_0x437fbc));_0x3a3139(_0x437fbc);})[_0xf4d1('0x1e')](function(_0x12650a){logger[_0xf4d1('0x10')]('GetTemplate',_0x12650a[_0xf4d1('0x12')],_0x3a27d0);_0x372190(_0x3ab896[_0xf4d1('0x10')](0x1f4,_0x12650a[_0xf4d1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 141769c..cf296f1 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 _0x2357=['/:id/any_conditions','getAnyConditions','create','addAllCondition','post','addAction','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','index','get','show','/:id/all_conditions','isAuthenticated','getAllConditions'];(function(_0x87cb2b,_0x33c1a6){var _0x152d0d=function(_0x26357e){while(--_0x26357e){_0x87cb2b['push'](_0x87cb2b['shift']());}};_0x152d0d(++_0x33c1a6);}(_0x2357,0xa9));var _0x7235=function(_0x2341ec,_0x4b5c63){_0x2341ec=_0x2341ec-0x0;var _0x4765b1=_0x2357[_0x2341ec];return _0x4765b1;};'use strict';var multer=require('multer');var util=require(_0x7235('0x0'));var path=require(_0x7235('0x1'));var timeout=require(_0x7235('0x2'));var express=require(_0x7235('0x3'));var router=express[_0x7235('0x4')]();var fs_extra=require(_0x7235('0x5'));var auth=require(_0x7235('0x6'));var interaction=require(_0x7235('0x7'));var config=require('../../config/environment');var controller=require(_0x7235('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7235('0x9')]);router[_0x7235('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7235('0xb')]);router[_0x7235('0xa')](_0x7235('0xc'),auth[_0x7235('0xd')](),controller[_0x7235('0xe')]);router[_0x7235('0xa')](_0x7235('0xf'),auth[_0x7235('0xd')](),controller[_0x7235('0x10')]);router['get']('/:id/actions',auth[_0x7235('0xd')](),controller['getActions']);router['post']('/',auth[_0x7235('0xd')](),controller[_0x7235('0x11')]);router['post'](_0x7235('0xc'),auth[_0x7235('0xd')](),controller[_0x7235('0x12')]);router[_0x7235('0x13')](_0x7235('0xf'),auth[_0x7235('0xd')](),controller['addAnyCondition']);router[_0x7235('0x13')]('/:id/actions',auth[_0x7235('0xd')](),controller[_0x7235('0x14')]);router['put'](_0x7235('0x15'),auth[_0x7235('0xd')](),controller['update']);router['delete'](_0x7235('0x15'),auth[_0x7235('0xd')](),controller[_0x7235('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb1a5=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAction','/:id','destroy'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0xb1a5,0x1cd));var _0x5b1a=function(_0x341cd3,_0x13c9c8){_0x341cd3=_0x341cd3-0x0;var _0xee5608=_0xb1a5[_0x341cd3];return _0xee5608;};'use strict';var multer=require(_0x5b1a('0x0'));var util=require('util');var path=require(_0x5b1a('0x1'));var timeout=require(_0x5b1a('0x2'));var express=require(_0x5b1a('0x3'));var router=express[_0x5b1a('0x4')]();var fs_extra=require(_0x5b1a('0x5'));var auth=require(_0x5b1a('0x6'));var interaction=require(_0x5b1a('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x5b1a('0x8')]('/',auth[_0x5b1a('0x9')](),controller[_0x5b1a('0xa')]);router[_0x5b1a('0x8')]('/:id',auth[_0x5b1a('0x9')](),controller[_0x5b1a('0xb')]);router[_0x5b1a('0x8')](_0x5b1a('0xc'),auth['isAuthenticated'](),controller[_0x5b1a('0xd')]);router[_0x5b1a('0x8')](_0x5b1a('0xe'),auth['isAuthenticated'](),controller[_0x5b1a('0xf')]);router[_0x5b1a('0x8')](_0x5b1a('0x10'),auth[_0x5b1a('0x9')](),controller[_0x5b1a('0x11')]);router[_0x5b1a('0x12')]('/',auth[_0x5b1a('0x9')](),controller['create']);router[_0x5b1a('0x12')]('/:id/all_conditions',auth[_0x5b1a('0x9')](),controller['addAllCondition']);router[_0x5b1a('0x12')](_0x5b1a('0xe'),auth[_0x5b1a('0x9')](),controller['addAnyCondition']);router[_0x5b1a('0x12')](_0x5b1a('0x10'),auth[_0x5b1a('0x9')](),controller[_0x5b1a('0x13')]);router['put'](_0x5b1a('0x14'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x5b1a('0x9')](),controller[_0x5b1a('0x15')]);module[_0x5b1a('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 15b1782..e137012 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 _0xf628=['sequelize','STRING','BOOLEAN'];(function(_0x5ed3e6,_0x12ba53){var _0x4c4c19=function(_0x1fb519){while(--_0x1fb519){_0x5ed3e6['push'](_0x5ed3e6['shift']());}};_0x4c4c19(++_0x12ba53);}(_0xf628,0x114));var _0x8f62=function(_0x3c4637,_0x1791cb){_0x3c4637=_0x3c4637-0x0;var _0x31e7a6=_0xf628[_0x3c4637];return _0x31e7a6;};'use strict';var Sequelize=require(_0x8f62('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8f62('0x1')]},'description':{'type':Sequelize[_0x8f62('0x1')]},'status':{'type':Sequelize[_0x8f62('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xba5d=['sequelize','STRING','BOOLEAN'];(function(_0x5c7e21,_0x55970c){var _0x476dc3=function(_0x45c03a){while(--_0x45c03a){_0x5c7e21['push'](_0x5c7e21['shift']());}};_0x476dc3(++_0x55970c);}(_0xba5d,0x1a4));var _0xdba5=function(_0x4efe55,_0x6174ea){_0x4efe55=_0x4efe55-0x0;var _0x3a15da=_0xba5d[_0x4efe55];return _0x3a15da;};'use strict';var Sequelize=require(_0xdba5('0x0'));module['exports']={'name':{'type':Sequelize[_0xdba5('0x1')]},'channel':{'type':Sequelize[_0xdba5('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xdba5('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 12bd897..65828d3 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 _0xe410=['find','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','order','pick','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','reject','save','then','destroy','Triggers','error','name','send','index','map','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x279288,_0x4fd4e8){var _0x277452=function(_0x5db9e2){while(--_0x5db9e2){_0x279288['push'](_0x279288['shift']());}};_0x277452(++_0x4fd4e8);}(_0xe410,0x11e));var _0x0e41=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0xe410[_0x3662b4];return _0x50928c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e41('0x0'));var zipdir=require(_0x0e41('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e41('0x2'));var BPromise=require(_0x0e41('0x3'));var Mustache=require(_0x0e41('0x4'));var util=require(_0x0e41('0x5'));var path=require(_0x0e41('0x6'));var sox=require(_0x0e41('0x7'));var csv=require('to-csv');var ejs=require(_0x0e41('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e41('0x9'));var squel=require('squel');var crypto=require(_0x0e41('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0e41('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0e41('0xc'));var Papa=require(_0x0e41('0xd'));var Redis=require(_0x0e41('0xe'));var authService=require(_0x0e41('0xf'));var qs=require(_0x0e41('0x10'));var as=require(_0x0e41('0x11'));var hardwareService=require(_0x0e41('0x12'));var logger=require(_0x0e41('0x13'))(_0x0e41('0x14'));var utils=require(_0x0e41('0x15'));var config=require(_0x0e41('0x16'));var licenseUtil=require(_0x0e41('0x17'));var db=require(_0x0e41('0x18'))['db'];function respondWithStatusCode(_0x553c07,_0x4226a3){_0x4226a3=_0x4226a3||0xcc;return function(_0x426243){if(_0x426243){return _0x553c07[_0x0e41('0x19')](_0x4226a3);}return _0x553c07[_0x0e41('0x1a')](_0x4226a3)['end']();};}function respondWithResult(_0x8c609,_0x127dfa){_0x127dfa=_0x127dfa||0xc8;return function(_0x532571){if(_0x532571){return _0x8c609[_0x0e41('0x1a')](_0x127dfa)['json'](_0x532571);}};}function respondWithFilteredResult(_0x15ed03,_0x55a182){return function(_0x11e17c){if(_0x11e17c){var _0x55f308=typeof _0x55a182[_0x0e41('0x1b')]==='undefined'&&typeof _0x55a182[_0x0e41('0x1c')]===_0x0e41('0x1d');var _0x58aca5=_0x11e17c[_0x0e41('0x1e')];var _0x38b864=_0x55f308?0x0:_0x55a182[_0x0e41('0x1b')];var _0x3f3f27=_0x55f308?_0x11e17c[_0x0e41('0x1e')]:_0x55a182[_0x0e41('0x1b')]+_0x55a182[_0x0e41('0x1c')];var _0x599746;if(_0x3f3f27>=_0x58aca5){_0x3f3f27=_0x58aca5;_0x599746=0xc8;}else{_0x599746=0xce;}_0x15ed03[_0x0e41('0x1a')](_0x599746);return _0x15ed03[_0x0e41('0x1f')]('Content-Range',_0x38b864+'-'+_0x3f3f27+'/'+_0x58aca5)['json'](_0x11e17c);}return null;};}function patchUpdates(_0x45db9c){return function(_0x590ee3){try{jsonpatch['apply'](_0x590ee3,_0x45db9c,!![]);}catch(_0x46272){return BPromise[_0x0e41('0x20')](_0x46272);}return _0x590ee3[_0x0e41('0x21')]();};}function saveUpdates(_0x3691a4,_0x57e62f){return function(_0x2c2785){if(_0x2c2785){return _0x2c2785['update'](_0x3691a4)[_0x0e41('0x22')](function(_0x5d0235){return _0x5d0235;});}return null;};}function removeEntity(_0x4c8361,_0x4a99f4){return function(_0x36db0b){if(_0x36db0b){return _0x36db0b[_0x0e41('0x23')]()['then'](function(){var _0x19ad21=_0x36db0b['get']({'plain':!![]});var _0x2bd29f=_0x0e41('0x24');return db['UserProfileResource'][_0x0e41('0x23')]({'where':{'type':_0x2bd29f,'resourceId':_0x19ad21['id']}})['then'](function(){return _0x36db0b;});})['then'](function(){_0x4c8361[_0x0e41('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b820,_0x2f59e2){return function(_0x3ea739){if(!_0x3ea739){_0x51b820[_0x0e41('0x19')](0x194);}return _0x3ea739;};}function handleError(_0x5ed414,_0x57ac2c){_0x57ac2c=_0x57ac2c||0x1f4;return function(_0x190dd0){logger[_0x0e41('0x25')](_0x190dd0['stack']);if(_0x190dd0[_0x0e41('0x26')]){delete _0x190dd0[_0x0e41('0x26')];}_0x5ed414['status'](_0x57ac2c)[_0x0e41('0x27')](_0x190dd0);};}exports[_0x0e41('0x28')]=function(_0x40c322,_0x462a01){var _0x4b728c={},_0x3fe01f={},_0x4e367e={'count':0x0,'rows':[]};var _0x65500c=_[_0x0e41('0x29')](db['Trigger']['rawAttributes'],function(_0x1b9717){return{'name':_0x1b9717[_0x0e41('0x2a')],'type':_0x1b9717[_0x0e41('0x2b')]['key']};});_0x3fe01f['model']=_[_0x0e41('0x29')](_0x65500c,_0x0e41('0x26'));_0x3fe01f[_0x0e41('0x2c')]=_[_0x0e41('0x2d')](_0x40c322[_0x0e41('0x2c')]);_0x3fe01f['filters']=_[_0x0e41('0x2e')](_0x3fe01f[_0x0e41('0x2f')],_0x3fe01f['query']);_0x4b728c[_0x0e41('0x30')]=_[_0x0e41('0x2e')](_0x3fe01f[_0x0e41('0x2f')],qs[_0x0e41('0x31')](_0x40c322['query'][_0x0e41('0x31')]));_0x4b728c[_0x0e41('0x30')]=_0x4b728c[_0x0e41('0x30')][_0x0e41('0x32')]?_0x4b728c['attributes']:_0x3fe01f['model'];if(!_0x40c322[_0x0e41('0x2c')][_0x0e41('0x33')]('nolimit')){_0x4b728c[_0x0e41('0x1c')]=qs[_0x0e41('0x1c')](_0x40c322['query'][_0x0e41('0x1c')]);_0x4b728c[_0x0e41('0x1b')]=qs['offset'](_0x40c322[_0x0e41('0x2c')]['offset']);}_0x4b728c['order']=qs['sort'](_0x40c322[_0x0e41('0x2c')][_0x0e41('0x34')]);_0x4b728c[_0x0e41('0x35')]=qs[_0x0e41('0x36')](_['pick'](_0x40c322[_0x0e41('0x2c')],_0x3fe01f[_0x0e41('0x36')]),_0x65500c);if(_0x40c322['query'][_0x0e41('0x37')]){_0x4b728c['where']=_[_0x0e41('0x38')](_0x4b728c[_0x0e41('0x35')],{'$or':_[_0x0e41('0x29')](_0x65500c,function(_0x4e22d9){if(_0x4e22d9['type']!==_0x0e41('0x39')){var _0x2e3938={};_0x2e3938[_0x4e22d9[_0x0e41('0x26')]]={'$like':'%'+_0x40c322['query'][_0x0e41('0x37')]+'%'};return _0x2e3938;}})});}_0x4b728c=_['merge']({},_0x4b728c,_0x40c322[_0x0e41('0x3a')]);var _0x38d7d3={'where':_0x4b728c[_0x0e41('0x35')]};return db[_0x0e41('0x3b')][_0x0e41('0x1e')](_0x38d7d3)[_0x0e41('0x22')](function(_0x461bd7){_0x4e367e['count']=_0x461bd7;if(_0x40c322[_0x0e41('0x2c')][_0x0e41('0x3c')]){_0x4b728c[_0x0e41('0x3d')]=[{'all':!![]}];}return db[_0x0e41('0x3b')][_0x0e41('0x3e')](_0x4b728c);})[_0x0e41('0x22')](function(_0x351410){_0x4e367e[_0x0e41('0x3f')]=_0x351410;return _0x4e367e;})[_0x0e41('0x22')](respondWithFilteredResult(_0x462a01,_0x4b728c))[_0x0e41('0x40')](handleError(_0x462a01,null));};exports[_0x0e41('0x41')]=function(_0x57a375,_0xd13ee4){var _0x5e62c6={'raw':![],'where':{'id':_0x57a375[_0x0e41('0x42')]['id']}},_0x524a62={};_0x524a62[_0x0e41('0x2f')]=_[_0x0e41('0x2d')](db[_0x0e41('0x3b')][_0x0e41('0x43')]);_0x524a62[_0x0e41('0x2c')]=_[_0x0e41('0x2d')](_0x57a375[_0x0e41('0x2c')]);_0x524a62[_0x0e41('0x36')]=_[_0x0e41('0x2e')](_0x524a62['model'],_0x524a62[_0x0e41('0x2c')]);_0x5e62c6[_0x0e41('0x30')]=_[_0x0e41('0x2e')](_0x524a62[_0x0e41('0x2f')],qs[_0x0e41('0x31')](_0x57a375[_0x0e41('0x2c')]['fields']));_0x5e62c6[_0x0e41('0x30')]=_0x5e62c6[_0x0e41('0x30')][_0x0e41('0x32')]?_0x5e62c6[_0x0e41('0x30')]:_0x524a62['model'];if(_0x57a375['query'][_0x0e41('0x3c')]){_0x5e62c6['include']=[{'all':!![]}];}_0x5e62c6=_['merge']({},_0x5e62c6,_0x57a375['options']);return db[_0x0e41('0x3b')]['find'](_0x5e62c6)[_0x0e41('0x22')](handleEntityNotFound(_0xd13ee4,null))[_0x0e41('0x22')](respondWithResult(_0xd13ee4,null))[_0x0e41('0x40')](handleError(_0xd13ee4,null));};exports['create']=function(_0x484afc,_0x1d1b9f){return db[_0x0e41('0x3b')][_0x0e41('0x44')](_0x484afc[_0x0e41('0x45')],{})[_0x0e41('0x22')](function(_0x89f23){var _0x1b106c=_0x484afc[_0x0e41('0x46')][_0x0e41('0x47')]({'plain':!![]});if(!_0x1b106c)throw new Error(_0x0e41('0x48'));if(_0x1b106c['role']===_0x0e41('0x46')){var _0x2180df=_0x89f23[_0x0e41('0x47')]({'plain':!![]});var _0x52c6d1=_0x0e41('0x24');return db[_0x0e41('0x49')]['find']({'where':{'name':_0x52c6d1,'userProfileId':_0x1b106c[_0x0e41('0x4a')]},'raw':!![]})[_0x0e41('0x22')](function(_0x3a9313){if(_0x3a9313&&_0x3a9313['autoAssociation']===0x0){return db[_0x0e41('0x4b')][_0x0e41('0x44')]({'name':_0x2180df[_0x0e41('0x26')],'resourceId':_0x2180df['id'],'type':_0x3a9313['name'],'sectionId':_0x3a9313['id']},{})[_0x0e41('0x22')](function(){return _0x89f23;});}else{return _0x89f23;}})[_0x0e41('0x40')](function(_0x47a142){logger['error'](_0x0e41('0x4c'),_0x47a142);throw _0x47a142;});}return _0x89f23;})[_0x0e41('0x22')](respondWithResult(_0x1d1b9f,0xc9))[_0x0e41('0x40')](handleError(_0x1d1b9f,null));};exports[_0x0e41('0x4d')]=function(_0x3b4ce5,_0x1d4efe){if(_0x3b4ce5[_0x0e41('0x45')]['id']){delete _0x3b4ce5['body']['id'];}return db['Trigger'][_0x0e41('0x4e')]({'where':{'id':_0x3b4ce5[_0x0e41('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d4efe,null))[_0x0e41('0x22')](saveUpdates(_0x3b4ce5[_0x0e41('0x45')],null))['then'](respondWithResult(_0x1d4efe,null))[_0x0e41('0x40')](handleError(_0x1d4efe,null));};exports[_0x0e41('0x23')]=function(_0xed007f,_0x5d4ec2){return db[_0x0e41('0x3b')][_0x0e41('0x4e')]({'where':{'id':_0xed007f[_0x0e41('0x42')]['id']}})[_0x0e41('0x22')](handleEntityNotFound(_0x5d4ec2,null))[_0x0e41('0x22')](removeEntity(_0x5d4ec2,null))[_0x0e41('0x40')](handleError(_0x5d4ec2,null));};exports[_0x0e41('0x4f')]=function(_0x426ee4,_0x1729eb,_0xc48178){if(_0x426ee4[_0x0e41('0x45')]['id']){delete _0x426ee4[_0x0e41('0x45')]['id'];}return db[_0x0e41('0x3b')]['find']({'where':{'id':_0x426ee4['params']['id']}})['then'](handleEntityNotFound(_0x1729eb,null))[_0x0e41('0x22')](function(_0x4e62e5){if(_0x4e62e5){_0x426ee4['body'][_0x0e41('0x50')]=_0x4e62e5['id'];return db['Condition'][_0x0e41('0x44')](_0x426ee4['body']);}})[_0x0e41('0x22')](respondWithResult(_0x1729eb,null))[_0x0e41('0x40')](handleError(_0x1729eb,null));};exports['addAnyCondition']=function(_0x5a90f3,_0x2224b9,_0x433311){if(_0x5a90f3[_0x0e41('0x45')]['id']){delete _0x5a90f3[_0x0e41('0x45')]['id'];}return db[_0x0e41('0x3b')]['find']({'where':{'id':_0x5a90f3[_0x0e41('0x42')]['id']}})[_0x0e41('0x22')](handleEntityNotFound(_0x2224b9,null))[_0x0e41('0x22')](function(_0x2f079e){if(_0x2f079e){_0x5a90f3[_0x0e41('0x45')][_0x0e41('0x51')]=_0x2f079e['id'];return db[_0x0e41('0x52')]['create'](_0x5a90f3[_0x0e41('0x45')]);}})['then'](respondWithResult(_0x2224b9,null))[_0x0e41('0x40')](handleError(_0x2224b9,null));};exports[_0x0e41('0x53')]=function(_0x24ce75,_0x251bdb,_0x51f62c){var _0x1f1b60={};var _0x1a7ed9={};var _0x5d9ad5;var _0x1f198e;return db[_0x0e41('0x3b')][_0x0e41('0x54')]({'where':{'id':_0x24ce75[_0x0e41('0x42')]['id']}})[_0x0e41('0x22')](handleEntityNotFound(_0x251bdb,null))[_0x0e41('0x22')](function(_0x8fde41){if(_0x8fde41){_0x5d9ad5=_0x8fde41;_0x1a7ed9[_0x0e41('0x2f')]=_['keys'](db[_0x0e41('0x52')][_0x0e41('0x43')]);_0x1a7ed9[_0x0e41('0x2c')]=_[_0x0e41('0x2d')](_0x24ce75['query']);_0x1a7ed9['filters']=_['intersection'](_0x1a7ed9['model'],_0x1a7ed9[_0x0e41('0x2c')]);_0x1f1b60[_0x0e41('0x30')]=_[_0x0e41('0x2e')](_0x1a7ed9[_0x0e41('0x2f')],qs[_0x0e41('0x31')](_0x24ce75[_0x0e41('0x2c')]['fields']));_0x1f1b60[_0x0e41('0x30')]=_0x1f1b60[_0x0e41('0x30')][_0x0e41('0x32')]?_0x1f1b60[_0x0e41('0x30')]:_0x1a7ed9[_0x0e41('0x2f')];_0x1f1b60[_0x0e41('0x55')]=qs[_0x0e41('0x34')](_0x24ce75[_0x0e41('0x2c')]['sort']);_0x1f1b60[_0x0e41('0x35')]=qs[_0x0e41('0x36')](_[_0x0e41('0x56')](_0x24ce75[_0x0e41('0x2c')],_0x1a7ed9[_0x0e41('0x36')]));if(_0x24ce75[_0x0e41('0x2c')][_0x0e41('0x37')]){_0x1f1b60[_0x0e41('0x35')]=_[_0x0e41('0x38')](_0x1f1b60[_0x0e41('0x35')],{'$or':_['map'](_0x1f1b60['attributes'],function(_0x6f1022){var _0x132595={};_0x132595[_0x6f1022]={'$like':'%'+_0x24ce75[_0x0e41('0x2c')]['filter']+'%'};return _0x132595;})});}_0x1f1b60=_[_0x0e41('0x38')]({},_0x1f1b60,_0x24ce75[_0x0e41('0x3a')]);return _0x5d9ad5[_0x0e41('0x53')](_0x1f1b60);}})['then'](function(_0x22b913){if(_0x22b913){_0x1f198e=_0x22b913['length'];if(!_0x24ce75[_0x0e41('0x2c')][_0x0e41('0x33')]('nolimit')){_0x1f1b60[_0x0e41('0x1c')]=qs['limit'](_0x24ce75[_0x0e41('0x2c')][_0x0e41('0x1c')]);_0x1f1b60[_0x0e41('0x1b')]=qs[_0x0e41('0x1b')](_0x24ce75[_0x0e41('0x2c')]['offset']);}return _0x5d9ad5[_0x0e41('0x53')](_0x1f1b60);}})[_0x0e41('0x22')](function(_0x5a0ce9){if(_0x5a0ce9){return _0x5a0ce9?{'count':_0x1f198e,'rows':_0x5a0ce9}:null;}})[_0x0e41('0x22')](respondWithResult(_0x251bdb,null))[_0x0e41('0x40')](handleError(_0x251bdb,null));};exports[_0x0e41('0x57')]=function(_0x22405d,_0x271efd,_0x42e3f0){var _0x204681={};var _0x5a429a={};var _0x4e9e31;var _0xe11ae6;return db[_0x0e41('0x3b')][_0x0e41('0x54')]({'where':{'id':_0x22405d[_0x0e41('0x42')]['id']}})[_0x0e41('0x22')](handleEntityNotFound(_0x271efd,null))['then'](function(_0x20bbbe){if(_0x20bbbe){_0x4e9e31=_0x20bbbe;_0x5a429a['model']=_[_0x0e41('0x2d')](db[_0x0e41('0x52')][_0x0e41('0x43')]);_0x5a429a[_0x0e41('0x2c')]=_[_0x0e41('0x2d')](_0x22405d['query']);_0x5a429a[_0x0e41('0x36')]=_['intersection'](_0x5a429a[_0x0e41('0x2f')],_0x5a429a[_0x0e41('0x2c')]);_0x204681[_0x0e41('0x30')]=_[_0x0e41('0x2e')](_0x5a429a['model'],qs['fields'](_0x22405d[_0x0e41('0x2c')][_0x0e41('0x31')]));_0x204681[_0x0e41('0x30')]=_0x204681['attributes']['length']?_0x204681[_0x0e41('0x30')]:_0x5a429a[_0x0e41('0x2f')];_0x204681[_0x0e41('0x55')]=qs[_0x0e41('0x34')](_0x22405d[_0x0e41('0x2c')][_0x0e41('0x34')]);_0x204681[_0x0e41('0x35')]=qs[_0x0e41('0x36')](_[_0x0e41('0x56')](_0x22405d[_0x0e41('0x2c')],_0x5a429a[_0x0e41('0x36')]));if(_0x22405d['query'][_0x0e41('0x37')]){_0x204681[_0x0e41('0x35')]=_[_0x0e41('0x38')](_0x204681['where'],{'$or':_[_0x0e41('0x29')](_0x204681[_0x0e41('0x30')],function(_0x3e33b1){var _0x11b749={};_0x11b749[_0x3e33b1]={'$like':'%'+_0x22405d['query']['filter']+'%'};return _0x11b749;})});}_0x204681=_['merge']({},_0x204681,_0x22405d[_0x0e41('0x3a')]);return _0x4e9e31['getAnyConditions'](_0x204681);}})[_0x0e41('0x22')](function(_0x5a041b){if(_0x5a041b){_0xe11ae6=_0x5a041b['length'];if(!_0x22405d['query'][_0x0e41('0x33')]('nolimit')){_0x204681[_0x0e41('0x1c')]=qs[_0x0e41('0x1c')](_0x22405d[_0x0e41('0x2c')]['limit']);_0x204681[_0x0e41('0x1b')]=qs[_0x0e41('0x1b')](_0x22405d['query'][_0x0e41('0x1b')]);}return _0x4e9e31[_0x0e41('0x57')](_0x204681);}})[_0x0e41('0x22')](function(_0x5a7f89){if(_0x5a7f89){return _0x5a7f89?{'count':_0xe11ae6,'rows':_0x5a7f89}:null;}})[_0x0e41('0x22')](respondWithResult(_0x271efd,null))[_0x0e41('0x40')](handleError(_0x271efd,null));};exports['addAction']=function(_0x3b90ee,_0x44774d,_0x2df060){if(_0x3b90ee['body']['id']){delete _0x3b90ee['body']['id'];}return db[_0x0e41('0x3b')][_0x0e41('0x4e')]({'where':{'id':_0x3b90ee[_0x0e41('0x42')]['id']}})[_0x0e41('0x22')](handleEntityNotFound(_0x44774d,null))['then'](function(_0x471b68){if(_0x471b68){_0x3b90ee[_0x0e41('0x45')][_0x0e41('0x58')]=_0x471b68['id'];return db[_0x0e41('0x59')][_0x0e41('0x44')](_0x3b90ee[_0x0e41('0x45')]);}})[_0x0e41('0x22')](respondWithResult(_0x44774d,null))[_0x0e41('0x40')](handleError(_0x44774d,null));};exports[_0x0e41('0x5a')]=function(_0x23dae0,_0x897f4d,_0x43b7da){var _0x30ac85={};var _0x671955={};var _0x1df2b9;var _0x923bdc;return db[_0x0e41('0x3b')]['findOne']({'where':{'id':_0x23dae0['params']['id']}})[_0x0e41('0x22')](handleEntityNotFound(_0x897f4d,null))[_0x0e41('0x22')](function(_0x392285){if(_0x392285){_0x1df2b9=_0x392285;_0x671955['model']=_[_0x0e41('0x2d')](db[_0x0e41('0x59')]['rawAttributes']);_0x671955[_0x0e41('0x2c')]=_[_0x0e41('0x2d')](_0x23dae0[_0x0e41('0x2c')]);_0x671955[_0x0e41('0x36')]=_[_0x0e41('0x2e')](_0x671955[_0x0e41('0x2f')],_0x671955[_0x0e41('0x2c')]);_0x30ac85['attributes']=_[_0x0e41('0x2e')](_0x671955[_0x0e41('0x2f')],qs['fields'](_0x23dae0[_0x0e41('0x2c')][_0x0e41('0x31')]));_0x30ac85['attributes']=_0x30ac85[_0x0e41('0x30')][_0x0e41('0x32')]?_0x30ac85[_0x0e41('0x30')]:_0x671955['model'];_0x30ac85[_0x0e41('0x55')]=qs[_0x0e41('0x34')](_0x23dae0[_0x0e41('0x2c')][_0x0e41('0x34')]);_0x30ac85[_0x0e41('0x35')]=qs[_0x0e41('0x36')](_[_0x0e41('0x56')](_0x23dae0[_0x0e41('0x2c')],_0x671955[_0x0e41('0x36')]));if(_0x23dae0['query']['filter']){_0x30ac85['where']=_['merge'](_0x30ac85[_0x0e41('0x35')],{'$or':_[_0x0e41('0x29')](_0x30ac85[_0x0e41('0x30')],function(_0x2dae6f){var _0x465eb1={};_0x465eb1[_0x2dae6f]={'$like':'%'+_0x23dae0[_0x0e41('0x2c')][_0x0e41('0x37')]+'%'};return _0x465eb1;})});}_0x30ac85=_[_0x0e41('0x38')]({},_0x30ac85,_0x23dae0[_0x0e41('0x3a')]);return _0x1df2b9['getActions'](_0x30ac85);}})['then'](function(_0x4bdef9){if(_0x4bdef9){_0x923bdc=_0x4bdef9[_0x0e41('0x32')];if(!_0x23dae0[_0x0e41('0x2c')][_0x0e41('0x33')]('nolimit')){_0x30ac85['limit']=qs[_0x0e41('0x1c')](_0x23dae0[_0x0e41('0x2c')][_0x0e41('0x1c')]);_0x30ac85[_0x0e41('0x1b')]=qs[_0x0e41('0x1b')](_0x23dae0[_0x0e41('0x2c')][_0x0e41('0x1b')]);}return _0x1df2b9[_0x0e41('0x5a')](_0x30ac85);}})['then'](function(_0x39ce5c){if(_0x39ce5c){return _0x39ce5c?{'count':_0x923bdc,'rows':_0x39ce5c}:null;}})[_0x0e41('0x22')](respondWithResult(_0x897f4d,null))['catch'](handleError(_0x897f4d,null));}; \ No newline at end of file +var _0xc3f2=['stack','name','send','index','map','Trigger','rawAttributes','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','TriggerAnyId','findOne','order','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error'];(function(_0x41cba9,_0x4f01ab){var _0x4ffa4a=function(_0x53a6fd){while(--_0x53a6fd){_0x41cba9['push'](_0x41cba9['shift']());}};_0x4ffa4a(++_0x4f01ab);}(_0xc3f2,0xec));var _0x2c3f=function(_0x4ebbf7,_0x402757){_0x4ebbf7=_0x4ebbf7-0x0;var _0x5861d7=_0xc3f2[_0x4ebbf7];return _0x5861d7;};'use strict';var emlformat=require(_0x2c3f('0x0'));var rimraf=require(_0x2c3f('0x1'));var zipdir=require(_0x2c3f('0x2'));var jsonpatch=require(_0x2c3f('0x3'));var rp=require('request-promise');var moment=require(_0x2c3f('0x4'));var BPromise=require(_0x2c3f('0x5'));var Mustache=require(_0x2c3f('0x6'));var util=require(_0x2c3f('0x7'));var path=require(_0x2c3f('0x8'));var sox=require(_0x2c3f('0x9'));var csv=require(_0x2c3f('0xa'));var ejs=require(_0x2c3f('0xb'));var fs=require('fs');var fs_extra=require(_0x2c3f('0xc'));var _=require(_0x2c3f('0xd'));var squel=require(_0x2c3f('0xe'));var crypto=require(_0x2c3f('0xf'));var jsforce=require(_0x2c3f('0x10'));var deskjs=require(_0x2c3f('0x11'));var toCsv=require(_0x2c3f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c3f('0x12'));var qs=require(_0x2c3f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c3f('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c3f('0x15'))['db'];function respondWithStatusCode(_0x40ecf7,_0x5a746a){_0x5a746a=_0x5a746a||0xcc;return function(_0x2eb9ec){if(_0x2eb9ec){return _0x40ecf7[_0x2c3f('0x16')](_0x5a746a);}return _0x40ecf7[_0x2c3f('0x17')](_0x5a746a)[_0x2c3f('0x18')]();};}function respondWithResult(_0x139d42,_0x1fa574){_0x1fa574=_0x1fa574||0xc8;return function(_0x5d34f9){if(_0x5d34f9){return _0x139d42[_0x2c3f('0x17')](_0x1fa574)[_0x2c3f('0x19')](_0x5d34f9);}};}function respondWithFilteredResult(_0x1e43cf,_0x126474){return function(_0x36eb02){if(_0x36eb02){var _0x5909f7=typeof _0x126474[_0x2c3f('0x1a')]===_0x2c3f('0x1b')&&typeof _0x126474[_0x2c3f('0x1c')]===_0x2c3f('0x1b');var _0x36484e=_0x36eb02['count'];var _0x58a400=_0x5909f7?0x0:_0x126474[_0x2c3f('0x1a')];var _0x5e9196=_0x5909f7?_0x36eb02[_0x2c3f('0x1d')]:_0x126474[_0x2c3f('0x1a')]+_0x126474[_0x2c3f('0x1c')];var _0x3b272c;if(_0x5e9196>=_0x36484e){_0x5e9196=_0x36484e;_0x3b272c=0xc8;}else{_0x3b272c=0xce;}_0x1e43cf[_0x2c3f('0x17')](_0x3b272c);return _0x1e43cf[_0x2c3f('0x1e')]('Content-Range',_0x58a400+'-'+_0x5e9196+'/'+_0x36484e)[_0x2c3f('0x19')](_0x36eb02);}return null;};}function patchUpdates(_0x5b9407){return function(_0x58f500){try{jsonpatch[_0x2c3f('0x1f')](_0x58f500,_0x5b9407,!![]);}catch(_0x27d1a8){return BPromise['reject'](_0x27d1a8);}return _0x58f500[_0x2c3f('0x20')]();};}function saveUpdates(_0x42efcc,_0x3825af){return function(_0x26e09c){if(_0x26e09c){return _0x26e09c[_0x2c3f('0x21')](_0x42efcc)[_0x2c3f('0x22')](function(_0x2797a9){return _0x2797a9;});}return null;};}function removeEntity(_0x20a909,_0xa45fd6){return function(_0x25f357){if(_0x25f357){return _0x25f357[_0x2c3f('0x23')]()['then'](function(){var _0x386014=_0x25f357[_0x2c3f('0x24')]({'plain':!![]});var _0x15d479=_0x2c3f('0x25');return db[_0x2c3f('0x26')]['destroy']({'where':{'type':_0x15d479,'resourceId':_0x386014['id']}})[_0x2c3f('0x22')](function(){return _0x25f357;});})[_0x2c3f('0x22')](function(){_0x20a909[_0x2c3f('0x17')](0xcc)[_0x2c3f('0x18')]();});}};}function handleEntityNotFound(_0xb1c3cf,_0x36023b){return function(_0x73de96){if(!_0x73de96){_0xb1c3cf[_0x2c3f('0x16')](0x194);}return _0x73de96;};}function handleError(_0x2e54b2,_0x44780c){_0x44780c=_0x44780c||0x1f4;return function(_0x3507a8){logger[_0x2c3f('0x27')](_0x3507a8[_0x2c3f('0x28')]);if(_0x3507a8[_0x2c3f('0x29')]){delete _0x3507a8['name'];}_0x2e54b2['status'](_0x44780c)[_0x2c3f('0x2a')](_0x3507a8);};}exports[_0x2c3f('0x2b')]=function(_0x3bd43d,_0x30c668){var _0x55f469={},_0x2c30c8={},_0x5b9f61={'count':0x0,'rows':[]};var _0x122107=_[_0x2c3f('0x2c')](db[_0x2c3f('0x2d')][_0x2c3f('0x2e')],function(_0x27c74c){return{'name':_0x27c74c['fieldName'],'type':_0x27c74c[_0x2c3f('0x2f')]['key']};});_0x2c30c8['model']=_[_0x2c3f('0x2c')](_0x122107,_0x2c3f('0x29'));_0x2c30c8[_0x2c3f('0x30')]=_['keys'](_0x3bd43d[_0x2c3f('0x30')]);_0x2c30c8[_0x2c3f('0x31')]=_['intersection'](_0x2c30c8['model'],_0x2c30c8[_0x2c3f('0x30')]);_0x55f469[_0x2c3f('0x32')]=_[_0x2c3f('0x33')](_0x2c30c8[_0x2c3f('0x34')],qs[_0x2c3f('0x35')](_0x3bd43d[_0x2c3f('0x30')][_0x2c3f('0x35')]));_0x55f469[_0x2c3f('0x32')]=_0x55f469[_0x2c3f('0x32')][_0x2c3f('0x36')]?_0x55f469[_0x2c3f('0x32')]:_0x2c30c8[_0x2c3f('0x34')];if(!_0x3bd43d[_0x2c3f('0x30')][_0x2c3f('0x37')](_0x2c3f('0x38'))){_0x55f469[_0x2c3f('0x1c')]=qs['limit'](_0x3bd43d[_0x2c3f('0x30')][_0x2c3f('0x1c')]);_0x55f469[_0x2c3f('0x1a')]=qs[_0x2c3f('0x1a')](_0x3bd43d[_0x2c3f('0x30')][_0x2c3f('0x1a')]);}_0x55f469['order']=qs[_0x2c3f('0x39')](_0x3bd43d['query'][_0x2c3f('0x39')]);_0x55f469[_0x2c3f('0x3a')]=qs[_0x2c3f('0x31')](_[_0x2c3f('0x3b')](_0x3bd43d[_0x2c3f('0x30')],_0x2c30c8[_0x2c3f('0x31')]),_0x122107);if(_0x3bd43d[_0x2c3f('0x30')][_0x2c3f('0x3c')]){_0x55f469[_0x2c3f('0x3a')]=_['merge'](_0x55f469[_0x2c3f('0x3a')],{'$or':_[_0x2c3f('0x2c')](_0x122107,function(_0x7ce297){if(_0x7ce297['type']!==_0x2c3f('0x3d')){var _0x370cea={};_0x370cea[_0x7ce297[_0x2c3f('0x29')]]={'$like':'%'+_0x3bd43d[_0x2c3f('0x30')][_0x2c3f('0x3c')]+'%'};return _0x370cea;}})});}_0x55f469=_[_0x2c3f('0x3e')]({},_0x55f469,_0x3bd43d[_0x2c3f('0x3f')]);var _0x1c36d3={'where':_0x55f469[_0x2c3f('0x3a')]};return db['Trigger'][_0x2c3f('0x1d')](_0x1c36d3)[_0x2c3f('0x22')](function(_0x3ab01e){_0x5b9f61[_0x2c3f('0x1d')]=_0x3ab01e;if(_0x3bd43d[_0x2c3f('0x30')][_0x2c3f('0x40')]){_0x55f469[_0x2c3f('0x41')]=[{'all':!![]}];}return db[_0x2c3f('0x2d')][_0x2c3f('0x42')](_0x55f469);})[_0x2c3f('0x22')](function(_0x386748){_0x5b9f61[_0x2c3f('0x43')]=_0x386748;return _0x5b9f61;})[_0x2c3f('0x22')](respondWithFilteredResult(_0x30c668,_0x55f469))[_0x2c3f('0x44')](handleError(_0x30c668,null));};exports[_0x2c3f('0x45')]=function(_0x1ea8fb,_0x28e03e){var _0x5df81b={'raw':![],'where':{'id':_0x1ea8fb[_0x2c3f('0x46')]['id']}},_0x3142b0={};_0x3142b0[_0x2c3f('0x34')]=_[_0x2c3f('0x47')](db[_0x2c3f('0x2d')]['rawAttributes']);_0x3142b0['query']=_[_0x2c3f('0x47')](_0x1ea8fb[_0x2c3f('0x30')]);_0x3142b0['filters']=_[_0x2c3f('0x33')](_0x3142b0[_0x2c3f('0x34')],_0x3142b0['query']);_0x5df81b[_0x2c3f('0x32')]=_[_0x2c3f('0x33')](_0x3142b0[_0x2c3f('0x34')],qs[_0x2c3f('0x35')](_0x1ea8fb[_0x2c3f('0x30')]['fields']));_0x5df81b['attributes']=_0x5df81b[_0x2c3f('0x32')]['length']?_0x5df81b[_0x2c3f('0x32')]:_0x3142b0['model'];if(_0x1ea8fb[_0x2c3f('0x30')][_0x2c3f('0x40')]){_0x5df81b['include']=[{'all':!![]}];}_0x5df81b=_[_0x2c3f('0x3e')]({},_0x5df81b,_0x1ea8fb[_0x2c3f('0x3f')]);return db[_0x2c3f('0x2d')][_0x2c3f('0x48')](_0x5df81b)[_0x2c3f('0x22')](handleEntityNotFound(_0x28e03e,null))['then'](respondWithResult(_0x28e03e,null))[_0x2c3f('0x44')](handleError(_0x28e03e,null));};exports[_0x2c3f('0x49')]=function(_0x321338,_0x50a629){return db[_0x2c3f('0x2d')][_0x2c3f('0x49')](_0x321338[_0x2c3f('0x4a')],{})[_0x2c3f('0x22')](function(_0x47b6ee){var _0x391b1d=_0x321338['user'][_0x2c3f('0x24')]({'plain':!![]});if(!_0x391b1d)throw new Error(_0x2c3f('0x4b'));if(_0x391b1d[_0x2c3f('0x4c')]==='user'){var _0x9faa8e=_0x47b6ee['get']({'plain':!![]});var _0x467e82='Triggers';return db[_0x2c3f('0x4d')][_0x2c3f('0x48')]({'where':{'name':_0x467e82,'userProfileId':_0x391b1d[_0x2c3f('0x4e')]},'raw':!![]})[_0x2c3f('0x22')](function(_0x39625f){if(_0x39625f&&_0x39625f[_0x2c3f('0x4f')]===0x0){return db[_0x2c3f('0x26')]['create']({'name':_0x9faa8e[_0x2c3f('0x29')],'resourceId':_0x9faa8e['id'],'type':_0x39625f[_0x2c3f('0x29')],'sectionId':_0x39625f['id']},{})[_0x2c3f('0x22')](function(){return _0x47b6ee;});}else{return _0x47b6ee;}})[_0x2c3f('0x44')](function(_0x8c80e4){logger['error'](_0x2c3f('0x50'),_0x8c80e4);throw _0x8c80e4;});}return _0x47b6ee;})[_0x2c3f('0x22')](respondWithResult(_0x50a629,0xc9))[_0x2c3f('0x44')](handleError(_0x50a629,null));};exports[_0x2c3f('0x21')]=function(_0x30c413,_0x1aaeeb){if(_0x30c413[_0x2c3f('0x4a')]['id']){delete _0x30c413[_0x2c3f('0x4a')]['id'];}return db[_0x2c3f('0x2d')][_0x2c3f('0x48')]({'where':{'id':_0x30c413[_0x2c3f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1aaeeb,null))['then'](saveUpdates(_0x30c413[_0x2c3f('0x4a')],null))['then'](respondWithResult(_0x1aaeeb,null))[_0x2c3f('0x44')](handleError(_0x1aaeeb,null));};exports[_0x2c3f('0x23')]=function(_0xf642f6,_0x359013){return db[_0x2c3f('0x2d')][_0x2c3f('0x48')]({'where':{'id':_0xf642f6[_0x2c3f('0x46')]['id']}})[_0x2c3f('0x22')](handleEntityNotFound(_0x359013,null))[_0x2c3f('0x22')](removeEntity(_0x359013,null))[_0x2c3f('0x44')](handleError(_0x359013,null));};exports['addAllCondition']=function(_0x25c8c6,_0xa8a056,_0x2bca35){if(_0x25c8c6[_0x2c3f('0x4a')]['id']){delete _0x25c8c6[_0x2c3f('0x4a')]['id'];}return db[_0x2c3f('0x2d')][_0x2c3f('0x48')]({'where':{'id':_0x25c8c6[_0x2c3f('0x46')]['id']}})[_0x2c3f('0x22')](handleEntityNotFound(_0xa8a056,null))[_0x2c3f('0x22')](function(_0x6a856){if(_0x6a856){_0x25c8c6['body']['TriggerAllId']=_0x6a856['id'];return db[_0x2c3f('0x51')]['create'](_0x25c8c6[_0x2c3f('0x4a')]);}})[_0x2c3f('0x22')](respondWithResult(_0xa8a056,null))['catch'](handleError(_0xa8a056,null));};exports[_0x2c3f('0x52')]=function(_0x4bb055,_0x12c42c,_0x338994){if(_0x4bb055[_0x2c3f('0x4a')]['id']){delete _0x4bb055[_0x2c3f('0x4a')]['id'];}return db[_0x2c3f('0x2d')][_0x2c3f('0x48')]({'where':{'id':_0x4bb055[_0x2c3f('0x46')]['id']}})[_0x2c3f('0x22')](handleEntityNotFound(_0x12c42c,null))[_0x2c3f('0x22')](function(_0x2c2e6f){if(_0x2c2e6f){_0x4bb055['body'][_0x2c3f('0x53')]=_0x2c2e6f['id'];return db['Condition'][_0x2c3f('0x49')](_0x4bb055[_0x2c3f('0x4a')]);}})[_0x2c3f('0x22')](respondWithResult(_0x12c42c,null))['catch'](handleError(_0x12c42c,null));};exports['getAllConditions']=function(_0x4cdcb6,_0x520e6f,_0x53d561){var _0x5f1ba0={};var _0x544c70={};var _0x28b742;var _0x3ce6c5;return db['Trigger'][_0x2c3f('0x54')]({'where':{'id':_0x4cdcb6[_0x2c3f('0x46')]['id']}})['then'](handleEntityNotFound(_0x520e6f,null))[_0x2c3f('0x22')](function(_0x1c5dcf){if(_0x1c5dcf){_0x28b742=_0x1c5dcf;_0x544c70['model']=_['keys'](db['Condition'][_0x2c3f('0x2e')]);_0x544c70[_0x2c3f('0x30')]=_[_0x2c3f('0x47')](_0x4cdcb6[_0x2c3f('0x30')]);_0x544c70[_0x2c3f('0x31')]=_['intersection'](_0x544c70[_0x2c3f('0x34')],_0x544c70[_0x2c3f('0x30')]);_0x5f1ba0[_0x2c3f('0x32')]=_[_0x2c3f('0x33')](_0x544c70[_0x2c3f('0x34')],qs[_0x2c3f('0x35')](_0x4cdcb6[_0x2c3f('0x30')][_0x2c3f('0x35')]));_0x5f1ba0['attributes']=_0x5f1ba0[_0x2c3f('0x32')]['length']?_0x5f1ba0['attributes']:_0x544c70['model'];_0x5f1ba0[_0x2c3f('0x55')]=qs['sort'](_0x4cdcb6[_0x2c3f('0x30')][_0x2c3f('0x39')]);_0x5f1ba0['where']=qs[_0x2c3f('0x31')](_['pick'](_0x4cdcb6[_0x2c3f('0x30')],_0x544c70[_0x2c3f('0x31')]));if(_0x4cdcb6[_0x2c3f('0x30')][_0x2c3f('0x3c')]){_0x5f1ba0[_0x2c3f('0x3a')]=_['merge'](_0x5f1ba0['where'],{'$or':_[_0x2c3f('0x2c')](_0x5f1ba0[_0x2c3f('0x32')],function(_0x5a1510){var _0x536570={};_0x536570[_0x5a1510]={'$like':'%'+_0x4cdcb6[_0x2c3f('0x30')][_0x2c3f('0x3c')]+'%'};return _0x536570;})});}_0x5f1ba0=_['merge']({},_0x5f1ba0,_0x4cdcb6[_0x2c3f('0x3f')]);return _0x28b742[_0x2c3f('0x56')](_0x5f1ba0);}})[_0x2c3f('0x22')](function(_0x3e85eb){if(_0x3e85eb){_0x3ce6c5=_0x3e85eb['length'];if(!_0x4cdcb6['query'][_0x2c3f('0x37')](_0x2c3f('0x38'))){_0x5f1ba0[_0x2c3f('0x1c')]=qs[_0x2c3f('0x1c')](_0x4cdcb6[_0x2c3f('0x30')][_0x2c3f('0x1c')]);_0x5f1ba0[_0x2c3f('0x1a')]=qs['offset'](_0x4cdcb6['query'][_0x2c3f('0x1a')]);}return _0x28b742[_0x2c3f('0x56')](_0x5f1ba0);}})[_0x2c3f('0x22')](function(_0x2dea38){if(_0x2dea38){return _0x2dea38?{'count':_0x3ce6c5,'rows':_0x2dea38}:null;}})[_0x2c3f('0x22')](respondWithResult(_0x520e6f,null))[_0x2c3f('0x44')](handleError(_0x520e6f,null));};exports[_0x2c3f('0x57')]=function(_0x46e899,_0x436e86,_0x51c2b9){var _0x237f94={};var _0x32da74={};var _0xea420a;var _0x30c60d;return db[_0x2c3f('0x2d')]['findOne']({'where':{'id':_0x46e899[_0x2c3f('0x46')]['id']}})[_0x2c3f('0x22')](handleEntityNotFound(_0x436e86,null))['then'](function(_0x19f3e4){if(_0x19f3e4){_0xea420a=_0x19f3e4;_0x32da74[_0x2c3f('0x34')]=_[_0x2c3f('0x47')](db[_0x2c3f('0x51')][_0x2c3f('0x2e')]);_0x32da74[_0x2c3f('0x30')]=_[_0x2c3f('0x47')](_0x46e899[_0x2c3f('0x30')]);_0x32da74[_0x2c3f('0x31')]=_['intersection'](_0x32da74['model'],_0x32da74[_0x2c3f('0x30')]);_0x237f94[_0x2c3f('0x32')]=_[_0x2c3f('0x33')](_0x32da74[_0x2c3f('0x34')],qs[_0x2c3f('0x35')](_0x46e899[_0x2c3f('0x30')]['fields']));_0x237f94['attributes']=_0x237f94[_0x2c3f('0x32')][_0x2c3f('0x36')]?_0x237f94['attributes']:_0x32da74[_0x2c3f('0x34')];_0x237f94['order']=qs[_0x2c3f('0x39')](_0x46e899[_0x2c3f('0x30')][_0x2c3f('0x39')]);_0x237f94['where']=qs['filters'](_[_0x2c3f('0x3b')](_0x46e899['query'],_0x32da74['filters']));if(_0x46e899['query'][_0x2c3f('0x3c')]){_0x237f94['where']=_[_0x2c3f('0x3e')](_0x237f94[_0x2c3f('0x3a')],{'$or':_['map'](_0x237f94['attributes'],function(_0x1c5a9c){var _0x4c3376={};_0x4c3376[_0x1c5a9c]={'$like':'%'+_0x46e899['query'][_0x2c3f('0x3c')]+'%'};return _0x4c3376;})});}_0x237f94=_[_0x2c3f('0x3e')]({},_0x237f94,_0x46e899[_0x2c3f('0x3f')]);return _0xea420a['getAnyConditions'](_0x237f94);}})[_0x2c3f('0x22')](function(_0x45af5a){if(_0x45af5a){_0x30c60d=_0x45af5a[_0x2c3f('0x36')];if(!_0x46e899['query'][_0x2c3f('0x37')](_0x2c3f('0x38'))){_0x237f94[_0x2c3f('0x1c')]=qs[_0x2c3f('0x1c')](_0x46e899['query'][_0x2c3f('0x1c')]);_0x237f94[_0x2c3f('0x1a')]=qs['offset'](_0x46e899[_0x2c3f('0x30')]['offset']);}return _0xea420a['getAnyConditions'](_0x237f94);}})[_0x2c3f('0x22')](function(_0x4e28c6){if(_0x4e28c6){return _0x4e28c6?{'count':_0x30c60d,'rows':_0x4e28c6}:null;}})[_0x2c3f('0x22')](respondWithResult(_0x436e86,null))[_0x2c3f('0x44')](handleError(_0x436e86,null));};exports[_0x2c3f('0x58')]=function(_0x4c06d6,_0x5927b8,_0x413ac1){if(_0x4c06d6['body']['id']){delete _0x4c06d6[_0x2c3f('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4c06d6['params']['id']}})['then'](handleEntityNotFound(_0x5927b8,null))[_0x2c3f('0x22')](function(_0x172cfd){if(_0x172cfd){_0x4c06d6[_0x2c3f('0x4a')][_0x2c3f('0x59')]=_0x172cfd['id'];return db[_0x2c3f('0x5a')][_0x2c3f('0x49')](_0x4c06d6[_0x2c3f('0x4a')]);}})[_0x2c3f('0x22')](respondWithResult(_0x5927b8,null))[_0x2c3f('0x44')](handleError(_0x5927b8,null));};exports[_0x2c3f('0x5b')]=function(_0x2ab297,_0x2dae33,_0x3d39cc){var _0x87eadf={};var _0x32875f={};var _0x32c18b;var _0x334e31;return db[_0x2c3f('0x2d')][_0x2c3f('0x54')]({'where':{'id':_0x2ab297[_0x2c3f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2dae33,null))['then'](function(_0x3388f7){if(_0x3388f7){_0x32c18b=_0x3388f7;_0x32875f[_0x2c3f('0x34')]=_[_0x2c3f('0x47')](db['Action'][_0x2c3f('0x2e')]);_0x32875f['query']=_[_0x2c3f('0x47')](_0x2ab297[_0x2c3f('0x30')]);_0x32875f[_0x2c3f('0x31')]=_[_0x2c3f('0x33')](_0x32875f[_0x2c3f('0x34')],_0x32875f[_0x2c3f('0x30')]);_0x87eadf[_0x2c3f('0x32')]=_['intersection'](_0x32875f['model'],qs[_0x2c3f('0x35')](_0x2ab297[_0x2c3f('0x30')]['fields']));_0x87eadf[_0x2c3f('0x32')]=_0x87eadf[_0x2c3f('0x32')][_0x2c3f('0x36')]?_0x87eadf['attributes']:_0x32875f[_0x2c3f('0x34')];_0x87eadf[_0x2c3f('0x55')]=qs['sort'](_0x2ab297['query']['sort']);_0x87eadf[_0x2c3f('0x3a')]=qs[_0x2c3f('0x31')](_['pick'](_0x2ab297[_0x2c3f('0x30')],_0x32875f[_0x2c3f('0x31')]));if(_0x2ab297['query'][_0x2c3f('0x3c')]){_0x87eadf[_0x2c3f('0x3a')]=_[_0x2c3f('0x3e')](_0x87eadf[_0x2c3f('0x3a')],{'$or':_[_0x2c3f('0x2c')](_0x87eadf[_0x2c3f('0x32')],function(_0x46156e){var _0x4dbbf2={};_0x4dbbf2[_0x46156e]={'$like':'%'+_0x2ab297[_0x2c3f('0x30')]['filter']+'%'};return _0x4dbbf2;})});}_0x87eadf=_[_0x2c3f('0x3e')]({},_0x87eadf,_0x2ab297[_0x2c3f('0x3f')]);return _0x32c18b[_0x2c3f('0x5b')](_0x87eadf);}})[_0x2c3f('0x22')](function(_0x4364b1){if(_0x4364b1){_0x334e31=_0x4364b1[_0x2c3f('0x36')];if(!_0x2ab297[_0x2c3f('0x30')][_0x2c3f('0x37')](_0x2c3f('0x38'))){_0x87eadf[_0x2c3f('0x1c')]=qs[_0x2c3f('0x1c')](_0x2ab297[_0x2c3f('0x30')][_0x2c3f('0x1c')]);_0x87eadf['offset']=qs[_0x2c3f('0x1a')](_0x2ab297[_0x2c3f('0x30')][_0x2c3f('0x1a')]);}return _0x32c18b[_0x2c3f('0x5b')](_0x87eadf);}})[_0x2c3f('0x22')](function(_0x2110c9){if(_0x2110c9){return _0x2110c9?{'count':_0x334e31,'rows':_0x2110c9}:null;}})[_0x2c3f('0x22')](respondWithResult(_0x2dae33,null))[_0x2c3f('0x44')](handleError(_0x2dae33,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 4c75d7c..673454d 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 _0xbacb=['rimraf','exports','define','tools_triggers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x45b36c,_0x4efbfe){var _0x1dad2f=function(_0x1532af){while(--_0x1532af){_0x45b36c['push'](_0x45b36c['shift']());}};_0x1dad2f(++_0x4efbfe);}(_0xbacb,0x1a6));var _0xbbac=function(_0x2710c7,_0x3d04fd){_0x2710c7=_0x2710c7-0x0;var _0x443e7a=_0xbacb[_0x2710c7];return _0x443e7a;};'use strict';var _=require(_0xbbac('0x0'));var util=require(_0xbbac('0x1'));var logger=require('../../config/logger')(_0xbbac('0x2'));var moment=require(_0xbbac('0x3'));var BPromise=require(_0xbbac('0x4'));var rp=require(_0xbbac('0x5'));var fs=require('fs');var path=require(_0xbbac('0x6'));var rimraf=require(_0xbbac('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xbbac('0x8')]=function(_0x2b9236,_0x210763){return _0x2b9236[_0xbbac('0x9')]('Trigger',attributes,{'tableName':_0xbbac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5243=['rimraf','./trigger.attributes','define','Trigger','tools_triggers','lodash','api','moment','path'];(function(_0x16e5d1,_0x9cf085){var _0x3f72e6=function(_0x26c06a){while(--_0x26c06a){_0x16e5d1['push'](_0x16e5d1['shift']());}};_0x3f72e6(++_0x9cf085);}(_0x5243,0x71));var _0x3524=function(_0x2bb184,_0x5a3a32){_0x2bb184=_0x2bb184-0x0;var _0x3b4e0d=_0x5243[_0x2bb184];return _0x3b4e0d;};'use strict';var _=require(_0x3524('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3524('0x1'));var moment=require(_0x3524('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3524('0x3'));var rimraf=require(_0x3524('0x4'));var config=require('../../config/environment');var attributes=require(_0x3524('0x5'));module['exports']=function(_0x2d8995,_0x564239){return _0x2d8995[_0x3524('0x6')](_0x3524('0x7'),attributes,{'tableName':_0x3524('0x8'),'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 727b3d4..a01b897 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 _0x6522=['map','model','attributes','stringify','find','ShowTrigger','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include'];(function(_0x52aeab,_0x3fb558){var _0x4b3832=function(_0x240a8e){while(--_0x240a8e){_0x52aeab['push'](_0x52aeab['shift']());}};_0x4b3832(++_0x3fb558);}(_0x6522,0x1f0));var _0x2652=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6522[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2652('0x0'));var BPromise=require(_0x2652('0x1'));var rs=require(_0x2652('0x2'));var fs=require('fs');var Redis=require(_0x2652('0x3'));var db=require(_0x2652('0x4'))['db'];var utils=require(_0x2652('0x5'));var logger=require('../../config/logger')(_0x2652('0x6'));var config=require(_0x2652('0x7'));var jayson=require(_0x2652('0x8'));var client=jayson['client'][_0x2652('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4323d1,_0x397cdd,_0x5f080e){return new BPromise(function(_0x12ff8b,_0x31d247){return client[_0x2652('0xa')](_0x4323d1,_0x5f080e)[_0x2652('0xb')](function(_0x5898ea){logger[_0x2652('0xc')](_0x2652('0xd'),_0x397cdd,_0x2652('0xe'));logger[_0x2652('0xf')](_0x2652('0x10'),_0x397cdd,_0x2652('0xe'),JSON['stringify'](_0x5898ea));if(_0x5898ea['error']){if(_0x5898ea[_0x2652('0x11')]['code']===0x1f4){logger[_0x2652('0x11')](_0x2652('0xd'),_0x397cdd,_0x5898ea[_0x2652('0x11')][_0x2652('0x12')]);return _0x31d247(_0x5898ea[_0x2652('0x11')][_0x2652('0x12')]);}logger[_0x2652('0x11')](_0x2652('0xd'),_0x397cdd,_0x5898ea[_0x2652('0x11')][_0x2652('0x12')]);return _0x12ff8b(_0x5898ea[_0x2652('0x11')]['message']);}else{logger[_0x2652('0xc')](_0x2652('0xd'),_0x397cdd,'request\x20sent');_0x12ff8b(_0x5898ea[_0x2652('0x13')]['message']);}})[_0x2652('0x14')](function(_0x3957db){logger['error'](_0x2652('0xd'),_0x397cdd,_0x3957db);_0x31d247(_0x3957db);});});}exports[_0x2652('0x15')]=function(_0x372410){var _0x46dc0c=this;return new Promise(function(_0x1c6d38,_0x56755c){return db[_0x2652('0x16')][_0x2652('0x17')]({'raw':_0x372410[_0x2652('0x18')]?_0x372410[_0x2652('0x18')][_0x2652('0x19')]===undefined?!![]:![]:!![],'where':_0x372410['options']?_0x372410['options'][_0x2652('0x1a')]||null:null,'attributes':_0x372410['options']?_0x372410['options']['attributes']||null:null,'limit':_0x372410[_0x2652('0x18')]?_0x372410[_0x2652('0x18')][_0x2652('0x1b')]||null:null,'include':_0x372410[_0x2652('0x18')]?_0x372410[_0x2652('0x18')][_0x2652('0x1c')]?_[_0x2652('0x1d')](_0x372410[_0x2652('0x18')]['include'],function(_0xfbd304){return{'model':db[_0xfbd304[_0x2652('0x1e')]],'as':_0xfbd304['as'],'attributes':_0xfbd304[_0x2652('0x1f')],'include':_0xfbd304['include']?_[_0x2652('0x1d')](_0xfbd304[_0x2652('0x1c')],function(_0x261de7){return{'model':db[_0x261de7[_0x2652('0x1e')]],'as':_0x261de7['as'],'attributes':_0x261de7['attributes'],'include':_0x261de7[_0x2652('0x1c')]?_[_0x2652('0x1d')](_0x261de7[_0x2652('0x1c')],function(_0x51def1){return{'model':db[_0x51def1[_0x2652('0x1e')]],'as':_0x51def1['as'],'attributes':_0x51def1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x395f30){logger[_0x2652('0xc')](_0x2652('0x15'),_0x372410);logger[_0x2652('0xf')]('GetTrigger',_0x372410,JSON[_0x2652('0x20')](_0x395f30));_0x1c6d38(_0x395f30);})[_0x2652('0x14')](function(_0x221ec6){logger[_0x2652('0x11')](_0x2652('0x15'),_0x221ec6[_0x2652('0x12')],_0x372410);_0x56755c(_0x46dc0c[_0x2652('0x11')](0x1f4,_0x221ec6['message']));});});};exports['ShowTrigger']=function(_0x5b409f){var _0x290bd5=this;return new Promise(function(_0x1907bf,_0x195106){return db['Trigger'][_0x2652('0x21')]({'raw':_0x5b409f[_0x2652('0x18')]?_0x5b409f['options'][_0x2652('0x19')]===undefined?!![]:![]:!![],'where':_0x5b409f[_0x2652('0x18')]?_0x5b409f[_0x2652('0x18')][_0x2652('0x1a')]||null:null,'attributes':_0x5b409f[_0x2652('0x18')]?_0x5b409f[_0x2652('0x18')][_0x2652('0x1f')]||null:null,'include':_0x5b409f[_0x2652('0x18')]?_0x5b409f[_0x2652('0x18')]['include']?_['map'](_0x5b409f[_0x2652('0x18')][_0x2652('0x1c')],function(_0x2a3e74){return{'model':db[_0x2a3e74[_0x2652('0x1e')]],'as':_0x2a3e74['as'],'attributes':_0x2a3e74[_0x2652('0x1f')],'include':_0x2a3e74['include']?_[_0x2652('0x1d')](_0x2a3e74[_0x2652('0x1c')],function(_0x1bbca9){return{'model':db[_0x1bbca9[_0x2652('0x1e')]],'as':_0x1bbca9['as'],'attributes':_0x1bbca9[_0x2652('0x1f')],'include':_0x1bbca9[_0x2652('0x1c')]?_[_0x2652('0x1d')](_0x1bbca9[_0x2652('0x1c')],function(_0x1452c7){return{'model':db[_0x1452c7[_0x2652('0x1e')]],'as':_0x1452c7['as'],'attributes':_0x1452c7[_0x2652('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2652('0xb')](function(_0x1ac853){logger['info'](_0x2652('0x22'),_0x5b409f);logger[_0x2652('0xf')]('ShowTrigger',_0x5b409f,JSON[_0x2652('0x20')](_0x1ac853));_0x1907bf(_0x1ac853);})['catch'](function(_0xf0b563){logger[_0x2652('0x11')](_0x2652('0x22'),_0xf0b563[_0x2652('0x12')],_0x5b409f);_0x195106(_0x290bd5[_0x2652('0x11')](0x1f4,_0xf0b563[_0x2652('0x12')]));});});}; \ No newline at end of file +var _0x76fe=['info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0x76fe,0x1b6));var _0xe76f=function(_0x3727d3,_0x48ee26){_0x3727d3=_0x3727d3-0x0;var _0x400020=_0x76fe[_0x3727d3];return _0x400020;};'use strict';var _=require(_0xe76f('0x0'));var util=require(_0xe76f('0x1'));var moment=require(_0xe76f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe76f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe76f('0x4'));var logger=require(_0xe76f('0x5'))(_0xe76f('0x6'));var config=require(_0xe76f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe76f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32432f,_0x399399,_0x49f3b7){return new BPromise(function(_0x12bcdb,_0x58d568){return client['request'](_0x32432f,_0x49f3b7)[_0xe76f('0x9')](function(_0x30a4ef){logger[_0xe76f('0xa')](_0xe76f('0xb'),_0x399399,_0xe76f('0xc'));logger[_0xe76f('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x399399,_0xe76f('0xc'),JSON[_0xe76f('0xe')](_0x30a4ef));if(_0x30a4ef[_0xe76f('0xf')]){if(_0x30a4ef['error']['code']===0x1f4){logger[_0xe76f('0xf')](_0xe76f('0xb'),_0x399399,_0x30a4ef[_0xe76f('0xf')]['message']);return _0x58d568(_0x30a4ef[_0xe76f('0xf')][_0xe76f('0x10')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x399399,_0x30a4ef[_0xe76f('0xf')][_0xe76f('0x10')]);return _0x12bcdb(_0x30a4ef[_0xe76f('0xf')]['message']);}else{logger[_0xe76f('0xa')](_0xe76f('0xb'),_0x399399,_0xe76f('0xc'));_0x12bcdb(_0x30a4ef[_0xe76f('0x11')][_0xe76f('0x10')]);}})[_0xe76f('0x12')](function(_0x5f093f){logger[_0xe76f('0xf')](_0xe76f('0xb'),_0x399399,_0x5f093f);_0x58d568(_0x5f093f);});});}exports[_0xe76f('0x13')]=function(_0x4232b1){var _0x16cbc9=this;return new Promise(function(_0x67c1d5,_0x4f5832){return db[_0xe76f('0x14')][_0xe76f('0x15')]({'raw':_0x4232b1[_0xe76f('0x16')]?_0x4232b1['options'][_0xe76f('0x17')]===undefined?!![]:![]:!![],'where':_0x4232b1[_0xe76f('0x16')]?_0x4232b1['options'][_0xe76f('0x18')]||null:null,'attributes':_0x4232b1[_0xe76f('0x16')]?_0x4232b1[_0xe76f('0x16')][_0xe76f('0x19')]||null:null,'limit':_0x4232b1[_0xe76f('0x16')]?_0x4232b1[_0xe76f('0x16')][_0xe76f('0x1a')]||null:null,'include':_0x4232b1[_0xe76f('0x16')]?_0x4232b1[_0xe76f('0x16')][_0xe76f('0x1b')]?_[_0xe76f('0x1c')](_0x4232b1[_0xe76f('0x16')][_0xe76f('0x1b')],function(_0x315658){return{'model':db[_0x315658[_0xe76f('0x1d')]],'as':_0x315658['as'],'attributes':_0x315658[_0xe76f('0x19')],'include':_0x315658[_0xe76f('0x1b')]?_[_0xe76f('0x1c')](_0x315658[_0xe76f('0x1b')],function(_0x5d694b){return{'model':db[_0x5d694b[_0xe76f('0x1d')]],'as':_0x5d694b['as'],'attributes':_0x5d694b[_0xe76f('0x19')],'include':_0x5d694b[_0xe76f('0x1b')]?_[_0xe76f('0x1c')](_0x5d694b[_0xe76f('0x1b')],function(_0x1d9d88){return{'model':db[_0x1d9d88[_0xe76f('0x1d')]],'as':_0x1d9d88['as'],'attributes':_0x1d9d88[_0xe76f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe76f('0x9')](function(_0x1edd05){logger[_0xe76f('0xa')](_0xe76f('0x13'),_0x4232b1);logger[_0xe76f('0xd')]('GetTrigger',_0x4232b1,JSON[_0xe76f('0xe')](_0x1edd05));_0x67c1d5(_0x1edd05);})[_0xe76f('0x12')](function(_0x53ac42){logger['error'](_0xe76f('0x13'),_0x53ac42[_0xe76f('0x10')],_0x4232b1);_0x4f5832(_0x16cbc9['error'](0x1f4,_0x53ac42[_0xe76f('0x10')]));});});};exports[_0xe76f('0x1e')]=function(_0xdff814){var _0x4d694c=this;return new Promise(function(_0x485fac,_0x361be0){return db['Trigger'][_0xe76f('0x1f')]({'raw':_0xdff814['options']?_0xdff814[_0xe76f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xdff814['options']?_0xdff814[_0xe76f('0x16')]['where']||null:null,'attributes':_0xdff814[_0xe76f('0x16')]?_0xdff814[_0xe76f('0x16')][_0xe76f('0x19')]||null:null,'include':_0xdff814['options']?_0xdff814[_0xe76f('0x16')]['include']?_[_0xe76f('0x1c')](_0xdff814[_0xe76f('0x16')][_0xe76f('0x1b')],function(_0x17eac3){return{'model':db[_0x17eac3['model']],'as':_0x17eac3['as'],'attributes':_0x17eac3[_0xe76f('0x19')],'include':_0x17eac3[_0xe76f('0x1b')]?_[_0xe76f('0x1c')](_0x17eac3[_0xe76f('0x1b')],function(_0x513e4b){return{'model':db[_0x513e4b[_0xe76f('0x1d')]],'as':_0x513e4b['as'],'attributes':_0x513e4b[_0xe76f('0x19')],'include':_0x513e4b[_0xe76f('0x1b')]?_[_0xe76f('0x1c')](_0x513e4b[_0xe76f('0x1b')],function(_0x10875c){return{'model':db[_0x10875c['model']],'as':_0x10875c['as'],'attributes':_0x10875c[_0xe76f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe76f('0x9')](function(_0x385e98){logger['info'](_0xe76f('0x1e'),_0xdff814);logger[_0xe76f('0xd')](_0xe76f('0x1e'),_0xdff814,JSON[_0xe76f('0xe')](_0x385e98));_0x485fac(_0x385e98);})[_0xe76f('0x12')](function(_0x17a0b8){logger['error'](_0xe76f('0x1e'),_0x17a0b8['message'],_0xdff814);_0x361be0(_0x4d694c[_0xe76f('0xf')](0x1f4,_0x17a0b8[_0xe76f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c8ab4ec..ea4e4db 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 _0xf2f4=['/:id','show','/:id/clone','clone','post','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0xf2f4,0x6d));var _0x4f2f=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf2f4[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0x4f2f('0x0'));var util=require(_0x4f2f('0x1'));var path=require(_0x4f2f('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f2f('0x3'));var router=express[_0x4f2f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4f2f('0x5'));var config=require(_0x4f2f('0x6'));var controller=require(_0x4f2f('0x7'));router['get']('/',auth[_0x4f2f('0x8')](),controller[_0x4f2f('0x9')]);router[_0x4f2f('0xa')](_0x4f2f('0xb'),auth[_0x4f2f('0x8')](),controller[_0x4f2f('0xc')]);router['post'](_0x4f2f('0xd'),auth[_0x4f2f('0x8')](),controller[_0x4f2f('0xe')]);router[_0x4f2f('0xf')]('/',auth[_0x4f2f('0x8')](),controller['create']);router[_0x4f2f('0x10')](_0x4f2f('0xb'),auth[_0x4f2f('0x8')](),controller['update']);router[_0x4f2f('0x11')](_0x4f2f('0xb'),auth[_0x4f2f('0x8')](),controller[_0x4f2f('0x12')]);module[_0x4f2f('0x13')]=router; \ No newline at end of file +var _0x75b1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','clone','post','create','put','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x116ec2,_0x23b3d9){var _0x44c06e=function(_0x26dac3){while(--_0x26dac3){_0x116ec2['push'](_0x116ec2['shift']());}};_0x44c06e(++_0x23b3d9);}(_0x75b1,0x6d));var _0x175b=function(_0x1c612c,_0xc92a29){_0x1c612c=_0x1c612c-0x0;var _0x55229f=_0x75b1[_0x1c612c];return _0x55229f;};'use strict';var multer=require(_0x175b('0x0'));var util=require(_0x175b('0x1'));var path=require(_0x175b('0x2'));var timeout=require(_0x175b('0x3'));var express=require('express');var router=express[_0x175b('0x4')]();var fs_extra=require(_0x175b('0x5'));var auth=require(_0x175b('0x6'));var interaction=require(_0x175b('0x7'));var config=require(_0x175b('0x8'));var controller=require(_0x175b('0x9'));router[_0x175b('0xa')]('/',auth[_0x175b('0xb')](),controller['index']);router[_0x175b('0xa')](_0x175b('0xc'),auth[_0x175b('0xb')](),controller['show']);router['post']('/:id/clone',auth[_0x175b('0xb')](),controller[_0x175b('0xd')]);router[_0x175b('0xe')]('/',auth[_0x175b('0xb')](),controller[_0x175b('0xf')]);router[_0x175b('0x10')]('/:id',auth[_0x175b('0xb')](),controller['update']);router[_0x175b('0x11')](_0x175b('0xc'),auth[_0x175b('0xb')](),controller['destroy']);module[_0x175b('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 97489fc..f082000 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 _0xcc6d=['insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','nonat','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow'];(function(_0x2d3146,_0x115b0e){var _0x4524ee=function(_0x5a8222){while(--_0x5a8222){_0x2d3146['push'](_0x2d3146['shift']());}};_0x4524ee(++_0x115b0e);}(_0xcc6d,0x1c8));var _0xdcc6=function(_0x39c06e,_0x591429){_0x39c06e=_0x39c06e-0x0;var _0x5c94d5=_0xcc6d[_0x39c06e];return _0x5c94d5;};'use strict';var Sequelize=require(_0xdcc6('0x0'));module['exports']={'name':{'type':Sequelize[_0xdcc6('0x1')],'allowNull':![],'unique':_0xdcc6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x4'),'user',_0xdcc6('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xdcc6('0x1')],'allowNull':![],'defaultValue':_0xdcc6('0x6')},'callingpres':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x7'),'ALLOWED_PASSED_SCREEN',_0xdcc6('0x8'),'ALLOWED',_0xdcc6('0x9'),_0xdcc6('0xa'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xdcc6('0x1')]},'permit':{'type':Sequelize[_0xdcc6('0x1')]},'secret':{'type':Sequelize[_0xdcc6('0x1')]},'md5secret':{'type':Sequelize[_0xdcc6('0x1')]},'remotesecret':{'type':Sequelize[_0xdcc6('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xdcc6('0xb'),'set':function(_0x4ef2c1){this[_0xdcc6('0xc')](_0xdcc6('0xd'),_0x4ef2c1?_0x4ef2c1[_0xdcc6('0xe')](','):null);},'get':function(){return this[_0xdcc6('0xf')](_0xdcc6('0xd'))?this['getDataValue'](_0xdcc6('0xd'))['split'](','):null;},'comment':_0xdcc6('0x10')},'dtmfmode':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x11'),'info','shortinfo','inband',_0xdcc6('0x12')),'defaultValue':_0xdcc6('0x11')},'directmedia':{'type':Sequelize[_0xdcc6('0x3')]('yes','no',_0xdcc6('0x13'),'update',_0xdcc6('0x14')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdcc6('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xdcc6('0x1')],'defaultValue':_0xdcc6('0x16'),'set':function(_0x4b5d98){this[_0xdcc6('0xc')]('nat',_0x4b5d98?_0x4b5d98['join'](','):null);},'get':function(){return this[_0xdcc6('0xf')](_0xdcc6('0x17'))?this['getDataValue'](_0xdcc6('0x17'))[_0xdcc6('0x18')](','):null;},'comment':_0xdcc6('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdcc6('0x1')]},'pickupgroup':{'type':Sequelize[_0xdcc6('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xdcc6('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdcc6('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xdcc6('0x1a')},'allow':{'type':Sequelize[_0xdcc6('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2027f8){this[_0xdcc6('0xc')](_0xdcc6('0x1b'),_0x2027f8?_0x2027f8[_0xdcc6('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xdcc6('0xf')](_0xdcc6('0x1b'))?this[_0xdcc6('0xf')]('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no')},'insecure':{'type':Sequelize[_0xdcc6('0x1')],'defaultValue':'port,invite','set':function(_0xbcbc4b){this[_0xdcc6('0xc')](_0xdcc6('0x1c'),_0xbcbc4b?_0xbcbc4b['join'](','):null);},'get':function(){return this[_0xdcc6('0xf')]('insecure')?this['getDataValue']('insecure')[_0xdcc6('0x18')](','):null;},'comment':_0xdcc6('0x1d')},'trustrpid':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdcc6('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xdcc6('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xdcc6('0x1')],'defaultValue':_0xdcc6('0x1f')},'amaflags':{'type':Sequelize[_0xdcc6('0x1')]},'callcounter':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no'),'defaultValue':_0xdcc6('0x15')},'busylevel':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'allowoverlap':{'type':Sequelize[_0xdcc6('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xdcc6('0x1')]},'template':{'type':Sequelize[_0xdcc6('0x1')]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdcc6('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xdcc6('0x1')]},'session_timers':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x20'),_0xdcc6('0x21'),_0xdcc6('0x22'))},'session_expires':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'session_minse':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xdcc6('0x23'),_0xdcc6('0x24')),'defaultValue':_0xdcc6('0x24')},'t38pt_usertpsource':{'type':Sequelize[_0xdcc6('0x1')]},'regexten':{'type':Sequelize[_0xdcc6('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xdcc6('0x1')]},'port':{'type':Sequelize[_0xdcc6('0x1e')](0x5)},'qualify':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no'),'defaultValue':_0xdcc6('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xdcc6('0x1')]},'defaultuser':{'type':Sequelize[_0xdcc6('0x1')]},'rtptimeout':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'sendrpid':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no',_0xdcc6('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xdcc6('0x1')]},'timert1':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xdcc6('0x1')]},'contactacl':{'type':Sequelize[_0xdcc6('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xdcc6('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no')},'force_avp':{'type':Sequelize[_0xdcc6('0x3')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no',_0xdcc6('0x26'),_0xdcc6('0x27'))},'dtlsrekey':{'type':Sequelize[_0xdcc6('0x1e')](0xb)},'dtlscertfile':{'type':Sequelize[_0xdcc6('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xdcc6('0x1')]},'dtlscipher':{'type':Sequelize[_0xdcc6('0x1')]},'dtlscafile':{'type':Sequelize[_0xdcc6('0x1')]},'dtlscapath':{'type':Sequelize[_0xdcc6('0x1')]},'dtlssetup':{'type':Sequelize[_0xdcc6('0x3')]('active',_0xdcc6('0x28'),_0xdcc6('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdcc6('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0xdcc6('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdcc6('0x1')]},'recordofffeature':{'type':Sequelize[_0xdcc6('0x1')]},'call_limit':{'type':Sequelize[_0xdcc6('0x1e')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no')},'vmexten':{'type':Sequelize[_0xdcc6('0x1')]},'mohinterpret':{'type':Sequelize[_0xdcc6('0x1')]},'mohsuggest':{'type':Sequelize[_0xdcc6('0x1')]},'parkinglot':{'type':Sequelize[_0xdcc6('0x1')]},'description':{'type':Sequelize[_0xdcc6('0x1')]},'host':{'type':Sequelize[_0xdcc6('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xdcc6('0x3')](_0xdcc6('0x15'),'no',_0xdcc6('0x13'),'update',_0xdcc6('0x2a')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdcc6('0x1')]},'otherFields':{'type':Sequelize[_0xdcc6('0x1')]},'active':{'type':Sequelize[_0xdcc6('0x2b')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdcc6('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x51a6=['rfc2833','info','shortinfo','inband','auto','yes','outgoing','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','refuse','uac','uas','fingerprint','certificate','passive','dynamic','update,nonat','BOOLEAN','sequelize','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','STRING','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x127565,_0x554a72){var _0x2b2bd5=function(_0x80e21){while(--_0x80e21){_0x127565['push'](_0x127565['shift']());}};_0x2b2bd5(++_0x554a72);}(_0x51a6,0x162));var _0x651a=function(_0x1109eb,_0x68f359){_0x1109eb=_0x1109eb-0x0;var _0x120d4e=_0x51a6[_0x1109eb];return _0x120d4e;};'use strict';var Sequelize=require(_0x651a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x651a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x651a('0x2')]('friend',_0x651a('0x3'),_0x651a('0x4')),'allowNull':![],'defaultValue':_0x651a('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x651a('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x651a('0x7'),_0x651a('0x8'),_0x651a('0x9'),_0x651a('0xa'),_0x651a('0xb'),_0x651a('0xc'),_0x651a('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x651a('0xe')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x651a('0xe')]},'md5secret':{'type':Sequelize[_0x651a('0xe')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x651a('0xe')],'defaultValue':_0x651a('0xf'),'set':function(_0x37cc04){this[_0x651a('0x10')](_0x651a('0x11'),_0x37cc04?_0x37cc04[_0x651a('0x12')](','):null);},'get':function(){return this[_0x651a('0x13')](_0x651a('0x11'))?this[_0x651a('0x13')](_0x651a('0x11'))[_0x651a('0x14')](','):null;},'comment':_0x651a('0x15')},'dtmfmode':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x16'),_0x651a('0x17'),_0x651a('0x18'),_0x651a('0x19'),_0x651a('0x1a')),'defaultValue':_0x651a('0x16')},'directmedia':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no','nonat','update',_0x651a('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x651a('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x651a('0xe')]},'directmediadeny':{'type':Sequelize[_0x651a('0xe')]},'nat':{'type':Sequelize[_0x651a('0xe')],'defaultValue':'force_rport,comedia','set':function(_0x55ced6){this['setDataValue']('nat',_0x55ced6?_0x55ced6[_0x651a('0x12')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x651a('0x13')]('nat')[_0x651a('0x14')](','):null;},'comment':_0x651a('0x1d')},'callgroup':{'type':Sequelize[_0x651a('0xe')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x651a('0xe')]},'namedpickupgroup':{'type':Sequelize[_0x651a('0xe')]},'language':{'type':Sequelize[_0x651a('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x651a('0xe')],'defaultValue':_0x651a('0x1e')},'allow':{'type':Sequelize[_0x651a('0xe')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3ded0c){this[_0x651a('0x10')]('allow',_0x3ded0c?_0x3ded0c['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x651a('0x1f'))?this['getDataValue']('allow')[_0x651a('0x14')](';'):null;},'comment':_0x651a('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x6f761f){this[_0x651a('0x10')](_0x651a('0x21'),_0x6f761f?_0x6f761f[_0x651a('0x12')](','):null);},'get':function(){return this['getDataValue'](_0x651a('0x21'))?this[_0x651a('0x13')]('insecure')[_0x651a('0x14')](','):null;},'comment':_0x651a('0x22')},'trustrpid':{'type':Sequelize[_0x651a('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x651a('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x651a('0x1b'),'no',_0x651a('0x23'))},'promiscredir':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x651a('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x651a('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x651a('0x25')},'amaflags':{'type':Sequelize[_0x651a('0xe')]},'callcounter':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no'),'defaultValue':_0x651a('0x1b')},'busylevel':{'type':Sequelize[_0x651a('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x651a('0xe')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x651a('0x2')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x651a('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x651a('0xe')]},'session_timers':{'type':Sequelize[_0x651a('0x2')]('accept',_0x651a('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x651a('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x27'),_0x651a('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x651a('0xe')]},'regexten':{'type':Sequelize[_0x651a('0xe')]},'fromdomain':{'type':Sequelize[_0x651a('0xe')]},'fromuser':{'type':Sequelize[_0x651a('0xe')]},'port':{'type':Sequelize[_0x651a('0x24')](0x5)},'qualify':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x651a('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x651a('0xe')]},'defaultuser':{'type':Sequelize[_0x651a('0xe')]},'rtptimeout':{'type':Sequelize[_0x651a('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x651a('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x651a('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x651a('0xe')]},'callbackextension':{'type':Sequelize[_0x651a('0xe')]},'timert1':{'type':Sequelize[_0x651a('0x24')](0xb)},'timerb':{'type':Sequelize[_0x651a('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x651a('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x651a('0xe')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x651a('0xe')]},'use_q850_reason':{'type':Sequelize[_0x651a('0xe')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x651a('0x2')]('yes','no',_0x651a('0x29'),_0x651a('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x651a('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x651a('0xe')]},'dtlsprivatekey':{'type':Sequelize[_0x651a('0xe')]},'dtlscipher':{'type':Sequelize[_0x651a('0xe')]},'dtlscafile':{'type':Sequelize[_0x651a('0xe')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x651a('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x651a('0xe')]},'usereqphone':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x651a('0xe')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x651a('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x651a('0x2')](_0x651a('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x651a('0xe')]},'mohinterpret':{'type':Sequelize[_0x651a('0xe')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x651a('0xe')]},'description':{'type':Sequelize[_0x651a('0xe')]},'host':{'type':Sequelize[_0x651a('0xe')],'defaultValue':_0x651a('0x2c')},'canreinvite':{'type':Sequelize['ENUM'](_0x651a('0x1b'),'no','nonat','update',_0x651a('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x651a('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x651a('0xe')],'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 8033277..6c8dd44 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 _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0xcb58ab,_0x4879fa){var _0xa31cf7=function(_0x550596){while(--_0x550596){_0xcb58ab['push'](_0xcb58ab['shift']());}};_0xa31cf7(++_0x4879fa);}(_0x9a19,0x114));var _0x99a1=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x9a19[_0x58547b];return _0x1d3fd2;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4b9617,_0x1bdf76){var _0x5f04ab=function(_0x5c0dee){while(--_0x5c0dee){_0x4b9617['push'](_0x4b9617['shift']());}};_0x5f04ab(++_0x1bdf76);}(_0x24ca,0x1bc));var _0xa24c=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x24ca[_0x329d13];return _0x33efd9;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 47b920c..38663d1 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 _0xffb3=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','lodash','../../config/logger','api','bluebird'];(function(_0x37d6eb,_0x1843b5){var _0xfa2f57=function(_0x54d0f7){while(--_0x54d0f7){_0x37d6eb['push'](_0x37d6eb['shift']());}};_0xfa2f57(++_0x1843b5);}(_0xffb3,0x1a9));var _0x3ffb=function(_0x297df1,_0x54a4d2){_0x297df1=_0x297df1-0x0;var _0xe79af=_0xffb3[_0x297df1];return _0xe79af;};'use strict';var _=require(_0x3ffb('0x0'));var util=require('util');var logger=require(_0x3ffb('0x1'))(_0x3ffb('0x2'));var moment=require('moment');var BPromise=require(_0x3ffb('0x3'));var rp=require(_0x3ffb('0x4'));var fs=require('fs');var path=require(_0x3ffb('0x5'));var rimraf=require(_0x3ffb('0x6'));var config=require(_0x3ffb('0x7'));var attributes=require(_0x3ffb('0x8'));module['exports']=function(_0x54b46d,_0x4f3b1e){return _0x54b46d[_0x3ffb('0x9')](_0x3ffb('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e7e=['util','../../config/logger','api','request-promise','rimraf','./trunk.attributes','define','Trunk','tools_trunks','lodash'];(function(_0x46a334,_0x56f4a4){var _0x2eda5e=function(_0x3114c7){while(--_0x3114c7){_0x46a334['push'](_0x46a334['shift']());}};_0x2eda5e(++_0x56f4a4);}(_0x8e7e,0x171));var _0xe8e7=function(_0x3f01b8,_0xbfcebb){_0x3f01b8=_0x3f01b8-0x0;var _0x3ec399=_0x8e7e[_0x3f01b8];return _0x3ec399;};'use strict';var _=require(_0xe8e7('0x0'));var util=require(_0xe8e7('0x1'));var logger=require(_0xe8e7('0x2'))(_0xe8e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe8e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8e7('0x5'));var config=require('../../config/environment');var attributes=require(_0xe8e7('0x6'));module['exports']=function(_0x37d637,_0x356e69){return _0x37d637[_0xe8e7('0x7')](_0xe8e7('0x8'),attributes,{'tableName':_0xe8e7('0x9'),'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 9ad99e9..889140f 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 _0x7be7=['Trunk,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','findAll','options','raw','attributes','limit','include','map','model','debug','GetTrunk','stringify','ShowTrunk','Trunk','find','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x571833,_0x5383e8){var _0x38bc03=function(_0x494048){while(--_0x494048){_0x571833['push'](_0x571833['shift']());}};_0x38bc03(++_0x5383e8);}(_0x7be7,0x13f));var _0x77be=function(_0x162f7c,_0x22d1a5){_0x162f7c=_0x162f7c-0x0;var _0xe1687c=_0x7be7[_0x162f7c];return _0xe1687c;};'use strict';var _=require(_0x77be('0x0'));var util=require(_0x77be('0x1'));var moment=require(_0x77be('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77be('0x3'));var db=require(_0x77be('0x4'))['db'];var utils=require(_0x77be('0x5'));var logger=require('../../config/logger')(_0x77be('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x170f85,_0x1d604c,_0x2d2636){return new BPromise(function(_0x5269b2,_0x189c06){return client[_0x77be('0x7')](_0x170f85,_0x2d2636)[_0x77be('0x8')](function(_0x2d6550){logger['info'](_0x77be('0x9'),_0x1d604c,_0x77be('0xa'));logger['debug'](_0x77be('0xb'),_0x1d604c,_0x77be('0xa'),JSON['stringify'](_0x2d6550));if(_0x2d6550['error']){if(_0x2d6550['error'][_0x77be('0xc')]===0x1f4){logger[_0x77be('0xd')](_0x77be('0x9'),_0x1d604c,_0x2d6550[_0x77be('0xd')][_0x77be('0xe')]);return _0x189c06(_0x2d6550[_0x77be('0xd')][_0x77be('0xe')]);}logger[_0x77be('0xd')](_0x77be('0x9'),_0x1d604c,_0x2d6550[_0x77be('0xd')]['message']);return _0x5269b2(_0x2d6550[_0x77be('0xd')][_0x77be('0xe')]);}else{logger[_0x77be('0xf')](_0x77be('0x9'),_0x1d604c,_0x77be('0xa'));_0x5269b2(_0x2d6550[_0x77be('0x10')]['message']);}})[_0x77be('0x11')](function(_0x38a9f3){logger[_0x77be('0xd')](_0x77be('0x9'),_0x1d604c,_0x38a9f3);_0x189c06(_0x38a9f3);});});}exports['GetTrunk']=function(_0x5767fd){var _0x221985=this;return new Promise(function(_0x432f95,_0x3c5deb){return db['Trunk'][_0x77be('0x12')]({'raw':_0x5767fd[_0x77be('0x13')]?_0x5767fd[_0x77be('0x13')][_0x77be('0x14')]===undefined?!![]:![]:!![],'where':_0x5767fd[_0x77be('0x13')]?_0x5767fd['options']['where']||null:null,'attributes':_0x5767fd[_0x77be('0x13')]?_0x5767fd[_0x77be('0x13')][_0x77be('0x15')]||null:null,'limit':_0x5767fd[_0x77be('0x13')]?_0x5767fd[_0x77be('0x13')][_0x77be('0x16')]||null:null,'include':_0x5767fd['options']?_0x5767fd[_0x77be('0x13')][_0x77be('0x17')]?_['map'](_0x5767fd[_0x77be('0x13')][_0x77be('0x17')],function(_0xfa27b8){return{'model':db[_0xfa27b8['model']],'as':_0xfa27b8['as'],'attributes':_0xfa27b8[_0x77be('0x15')],'include':_0xfa27b8[_0x77be('0x17')]?_[_0x77be('0x18')](_0xfa27b8[_0x77be('0x17')],function(_0x35b0d2){return{'model':db[_0x35b0d2[_0x77be('0x19')]],'as':_0x35b0d2['as'],'attributes':_0x35b0d2[_0x77be('0x15')],'include':_0x35b0d2[_0x77be('0x17')]?_['map'](_0x35b0d2[_0x77be('0x17')],function(_0x5b44a3){return{'model':db[_0x5b44a3[_0x77be('0x19')]],'as':_0x5b44a3['as'],'attributes':_0x5b44a3[_0x77be('0x15')]};}):[]};}):[]};}):[]:[]})[_0x77be('0x8')](function(_0x5632cc){logger[_0x77be('0xf')]('GetTrunk',_0x5767fd);logger[_0x77be('0x1a')](_0x77be('0x1b'),_0x5767fd,JSON[_0x77be('0x1c')](_0x5632cc));_0x432f95(_0x5632cc);})[_0x77be('0x11')](function(_0x1efefa){logger[_0x77be('0xd')]('GetTrunk',_0x1efefa[_0x77be('0xe')],_0x5767fd);_0x3c5deb(_0x221985[_0x77be('0xd')](0x1f4,_0x1efefa[_0x77be('0xe')]));});});};exports[_0x77be('0x1d')]=function(_0x3f0f0b){var _0x10fd83=this;return new Promise(function(_0x2a1eb5,_0x1ea2da){return db[_0x77be('0x1e')][_0x77be('0x1f')]({'raw':_0x3f0f0b[_0x77be('0x13')]?_0x3f0f0b[_0x77be('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3f0f0b[_0x77be('0x13')]?_0x3f0f0b[_0x77be('0x13')][_0x77be('0x20')]||null:null,'attributes':_0x3f0f0b[_0x77be('0x13')]?_0x3f0f0b[_0x77be('0x13')][_0x77be('0x15')]||null:null,'include':_0x3f0f0b['options']?_0x3f0f0b[_0x77be('0x13')]['include']?_[_0x77be('0x18')](_0x3f0f0b[_0x77be('0x13')]['include'],function(_0x5820fa){return{'model':db[_0x5820fa[_0x77be('0x19')]],'as':_0x5820fa['as'],'attributes':_0x5820fa['attributes'],'include':_0x5820fa[_0x77be('0x17')]?_[_0x77be('0x18')](_0x5820fa[_0x77be('0x17')],function(_0xb6a81b){return{'model':db[_0xb6a81b[_0x77be('0x19')]],'as':_0xb6a81b['as'],'attributes':_0xb6a81b[_0x77be('0x15')],'include':_0xb6a81b[_0x77be('0x17')]?_[_0x77be('0x18')](_0xb6a81b[_0x77be('0x17')],function(_0x3bc4d6){return{'model':db[_0x3bc4d6[_0x77be('0x19')]],'as':_0x3bc4d6['as'],'attributes':_0x3bc4d6[_0x77be('0x15')]};}):[]};}):[]};}):[]:[]})[_0x77be('0x8')](function(_0x11f0e9){logger[_0x77be('0xf')](_0x77be('0x1d'),_0x3f0f0b);logger[_0x77be('0x1a')](_0x77be('0x1d'),_0x3f0f0b,JSON[_0x77be('0x1c')](_0x11f0e9));_0x2a1eb5(_0x11f0e9);})[_0x77be('0x11')](function(_0x4e7e0c){logger[_0x77be('0xd')](_0x77be('0x1d'),_0x4e7e0c[_0x77be('0xe')],_0x3f0f0b);_0x1ea2da(_0x10fd83[_0x77be('0xd')](0x1f4,_0x4e7e0c['message']));});});}; \ No newline at end of file +var _0x1851=['raw','where','limit','include','map','model','attributes','then','GetTrunk','debug','find','ShowTrunk','lodash','util','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk','findAll','options'];(function(_0x17db16,_0x365174){var _0x5cdd5c=function(_0x2d26bd){while(--_0x2d26bd){_0x17db16['push'](_0x17db16['shift']());}};_0x5cdd5c(++_0x365174);}(_0x1851,0x16c));var _0x1185=function(_0x287a9a,_0x2a3fdc){_0x287a9a=_0x287a9a-0x0;var _0x240cc0=_0x1851[_0x287a9a];return _0x240cc0;};'use strict';var _=require(_0x1185('0x0'));var util=require(_0x1185('0x1'));var moment=require('moment');var BPromise=require(_0x1185('0x2'));var rs=require(_0x1185('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1185('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1185('0x5'));var config=require('../../config/environment');var jayson=require(_0x1185('0x6'));var client=jayson[_0x1185('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0f4f,_0x4077ef,_0x22af74){return new BPromise(function(_0x4767eb,_0x3bf2c8){return client[_0x1185('0x8')](_0x5e0f4f,_0x22af74)['then'](function(_0x5362de){logger[_0x1185('0x9')](_0x1185('0xa'),_0x4077ef,'request\x20sent');logger['debug'](_0x1185('0xb'),_0x4077ef,'request\x20sent',JSON[_0x1185('0xc')](_0x5362de));if(_0x5362de['error']){if(_0x5362de[_0x1185('0xd')]['code']===0x1f4){logger[_0x1185('0xd')](_0x1185('0xa'),_0x4077ef,_0x5362de['error'][_0x1185('0xe')]);return _0x3bf2c8(_0x5362de[_0x1185('0xd')][_0x1185('0xe')]);}logger[_0x1185('0xd')]('Trunk,\x20%s,\x20%s',_0x4077ef,_0x5362de[_0x1185('0xd')][_0x1185('0xe')]);return _0x4767eb(_0x5362de[_0x1185('0xd')][_0x1185('0xe')]);}else{logger[_0x1185('0x9')]('Trunk,\x20%s,\x20%s',_0x4077ef,'request\x20sent');_0x4767eb(_0x5362de[_0x1185('0xf')][_0x1185('0xe')]);}})[_0x1185('0x10')](function(_0x890ea0){logger['error'](_0x1185('0xa'),_0x4077ef,_0x890ea0);_0x3bf2c8(_0x890ea0);});});}exports['GetTrunk']=function(_0x19afc9){var _0x51e5a2=this;return new Promise(function(_0x24574e,_0x189f2d){return db[_0x1185('0x11')][_0x1185('0x12')]({'raw':_0x19afc9['options']?_0x19afc9[_0x1185('0x13')][_0x1185('0x14')]===undefined?!![]:![]:!![],'where':_0x19afc9[_0x1185('0x13')]?_0x19afc9[_0x1185('0x13')][_0x1185('0x15')]||null:null,'attributes':_0x19afc9[_0x1185('0x13')]?_0x19afc9[_0x1185('0x13')]['attributes']||null:null,'limit':_0x19afc9['options']?_0x19afc9['options'][_0x1185('0x16')]||null:null,'include':_0x19afc9[_0x1185('0x13')]?_0x19afc9[_0x1185('0x13')][_0x1185('0x17')]?_[_0x1185('0x18')](_0x19afc9['options']['include'],function(_0x20c074){return{'model':db[_0x20c074[_0x1185('0x19')]],'as':_0x20c074['as'],'attributes':_0x20c074[_0x1185('0x1a')],'include':_0x20c074[_0x1185('0x17')]?_[_0x1185('0x18')](_0x20c074[_0x1185('0x17')],function(_0x40c9de){return{'model':db[_0x40c9de[_0x1185('0x19')]],'as':_0x40c9de['as'],'attributes':_0x40c9de[_0x1185('0x1a')],'include':_0x40c9de[_0x1185('0x17')]?_[_0x1185('0x18')](_0x40c9de[_0x1185('0x17')],function(_0x48b3cd){return{'model':db[_0x48b3cd[_0x1185('0x19')]],'as':_0x48b3cd['as'],'attributes':_0x48b3cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x1185('0x1b')](function(_0x20a9d6){logger[_0x1185('0x9')](_0x1185('0x1c'),_0x19afc9);logger[_0x1185('0x1d')](_0x1185('0x1c'),_0x19afc9,JSON[_0x1185('0xc')](_0x20a9d6));_0x24574e(_0x20a9d6);})[_0x1185('0x10')](function(_0x3a6488){logger[_0x1185('0xd')](_0x1185('0x1c'),_0x3a6488['message'],_0x19afc9);_0x189f2d(_0x51e5a2[_0x1185('0xd')](0x1f4,_0x3a6488[_0x1185('0xe')]));});});};exports['ShowTrunk']=function(_0x446b57){var _0x15f540=this;return new Promise(function(_0x400d41,_0x4db0f6){return db[_0x1185('0x11')][_0x1185('0x1e')]({'raw':_0x446b57[_0x1185('0x13')]?_0x446b57[_0x1185('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x446b57[_0x1185('0x13')]?_0x446b57['options'][_0x1185('0x15')]||null:null,'attributes':_0x446b57[_0x1185('0x13')]?_0x446b57[_0x1185('0x13')]['attributes']||null:null,'include':_0x446b57[_0x1185('0x13')]?_0x446b57['options']['include']?_[_0x1185('0x18')](_0x446b57[_0x1185('0x13')][_0x1185('0x17')],function(_0x4fd7bc){return{'model':db[_0x4fd7bc[_0x1185('0x19')]],'as':_0x4fd7bc['as'],'attributes':_0x4fd7bc[_0x1185('0x1a')],'include':_0x4fd7bc[_0x1185('0x17')]?_[_0x1185('0x18')](_0x4fd7bc[_0x1185('0x17')],function(_0xa78e5){return{'model':db[_0xa78e5[_0x1185('0x19')]],'as':_0xa78e5['as'],'attributes':_0xa78e5[_0x1185('0x1a')],'include':_0xa78e5[_0x1185('0x17')]?_[_0x1185('0x18')](_0xa78e5[_0x1185('0x17')],function(_0x5303d8){return{'model':db[_0x5303d8['model']],'as':_0x5303d8['as'],'attributes':_0x5303d8[_0x1185('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40e4e4){logger['info'](_0x1185('0x1f'),_0x446b57);logger['debug'](_0x1185('0x1f'),_0x446b57,JSON[_0x1185('0xc')](_0x40e4e4));_0x400d41(_0x40e4e4);})[_0x1185('0x10')](function(_0x2915d0){logger['error'](_0x1185('0x1f'),_0x2915d0['message'],_0x446b57);_0x4db0f6(_0x15f540[_0x1185('0xd')](0x1f4,_0x2915d0[_0x1185('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 4e9f5dd..8687b71 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 _0x8dbe=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put','isAuthenticated'];(function(_0xd5f3ac,_0x5a575a){var _0x38aed8=function(_0x4ed927){while(--_0x4ed927){_0xd5f3ac['push'](_0xd5f3ac['shift']());}};_0x38aed8(++_0x5a575a);}(_0x8dbe,0x1da));var _0xe8db=function(_0x1a9f20,_0x385205){_0x1a9f20=_0x1a9f20-0x0;var _0x6ddb1c=_0x8dbe[_0x1a9f20];return _0x6ddb1c;};'use strict';var express=require(_0xe8db('0x0'));var router=express[_0xe8db('0x1')]();var auth=require(_0xe8db('0x2'));var controller=require(_0xe8db('0x3'));router[_0xe8db('0x4')]('/:id',auth[_0xe8db('0x5')](),controller[_0xe8db('0x6')]);module[_0xe8db('0x7')]=router; \ No newline at end of file +var _0x6286=['exports','express','Router','./user-setting.controller','put'];(function(_0x4b51ef,_0xef05a6){var _0x510881=function(_0x31213e){while(--_0x31213e){_0x4b51ef['push'](_0x4b51ef['shift']());}};_0x510881(++_0xef05a6);}(_0x6286,0xd3));var _0x6628=function(_0x4d02cf,_0x245f68){_0x4d02cf=_0x4d02cf-0x0;var _0x543b18=_0x6286[_0x4d02cf];return _0x543b18;};'use strict';var express=require(_0x6628('0x0'));var router=express[_0x6628('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6628('0x2'));router[_0x6628('0x3')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x6628('0x4')]=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 16109de..5a84e26 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 _0xe63b=['DATE','UserId','sequelize','error','warning','debug','ENUM','TEXT'];(function(_0x2faec8,_0x3e1d8a){var _0xd57dda=function(_0x4c3711){while(--_0x4c3711){_0x2faec8['push'](_0x2faec8['shift']());}};_0xd57dda(++_0x3e1d8a);}(_0xe63b,0x122));var _0xbe63=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0xe63b[_0x5cabfd];return _0x4bc06c;};'use strict';var Sequelize=require(_0xbe63('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xbe63('0x1'),_0xbe63('0x2'),'info',_0xbe63('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xbe63('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xbe63('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xbe63('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xbe63('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xbe63('0x7')}}; \ No newline at end of file +var _0xa781=['TEXT','INTEGER','error','warning','info','debug','exports','BOOLEAN'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xa781,0xba));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x1a78('0x0'),_0x1a78('0x1'),_0x1a78('0x2'),_0x1a78('0x3')];module[_0x1a78('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1a78('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x1a78('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1a78('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x1a78('0x7')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 5d0eaf3..4597d45 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 _0xcf95=['catch','lodash','ioredis','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','status','json','update','then','error','name','send','user','admin','Unauthorized','params','body'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5cf9('0x0'));var Redis=require(_0x5cf9('0x1'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x5cf9('0x2'))['db'];var socket=require(_0x5cf9('0x3'))(new Redis(config[_0x5cf9('0x4')]));require(_0x5cf9('0x5'))['register'](socket);config[_0x5cf9('0x4')]=_[_0x5cf9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x1c0c3a,_0x2d24df){_0x2d24df=_0x2d24df||0xc8;return function(_0x51acd7){if(_0x51acd7){return _0x1c0c3a[_0x5cf9('0x7')](_0x2d24df)[_0x5cf9('0x8')](_0x51acd7);}};}function saveUpdates(_0x23c40e){return function(_0x34c019){if(_0x34c019){return _0x34c019[_0x5cf9('0x9')](_0x23c40e)[_0x5cf9('0xa')](function(_0x20ebed){return _0x20ebed;});}return null;};}function handleEntityNotFound(_0x3d3481){return function(_0x364263){if(!_0x364263){_0x3d3481['sendStatus'](0x194);}return _0x364263;};}function handleError(_0x2aaf4f,_0x29fbff){_0x29fbff=_0x29fbff||0x1f4;return function(_0x39c2b9){logger[_0x5cf9('0xb')](_0x39c2b9['stack']);if(_0x39c2b9[_0x5cf9('0xc')]){delete _0x39c2b9[_0x5cf9('0xc')];}_0x2aaf4f[_0x5cf9('0x7')](_0x29fbff)[_0x5cf9('0xd')](_0x39c2b9);};}exports[_0x5cf9('0x9')]=function(_0x3d4758,_0xda5539){if(_0x3d4758[_0x5cf9('0xe')]['role']!==_0x5cf9('0xf'))throw new Error(_0x5cf9('0x10'));if(isNaN(Number(_0x3d4758['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting']['find']({'where':{'id':_0x3d4758[_0x5cf9('0x11')]['id']}})[_0x5cf9('0xa')](handleEntityNotFound(_0xda5539,null))[_0x5cf9('0xa')](saveUpdates(_0x3d4758[_0x5cf9('0x12')],null))['then'](respondWithResult(_0xda5539,null))[_0x5cf9('0x13')](handleError(_0xda5539,null));}; \ No newline at end of file +var _0xacfe=['send','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','params','then','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','sendStatus','error','stack','name'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xacfe,0xfd));var _0xeacf=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xacfe[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var config=require(_0xeacf('0x2'));var db=require(_0xeacf('0x3'))['db'];var socket=require(_0xeacf('0x4'))(new Redis(config[_0xeacf('0x5')]));require(_0xeacf('0x6'))[_0xeacf('0x7')](socket);config[_0xeacf('0x5')]=_[_0xeacf('0x8')](config[_0xeacf('0x5')],{'host':_0xeacf('0x9'),'port':0x18eb});function respondWithResult(_0x13cba2,_0x5eb516){_0x5eb516=_0x5eb516||0xc8;return function(_0x411634){if(_0x411634){return _0x13cba2[_0xeacf('0xa')](_0x5eb516)[_0xeacf('0xb')](_0x411634);}};}function saveUpdates(_0xf5c2e4){return function(_0x48acc3){if(_0x48acc3){return _0x48acc3[_0xeacf('0xc')](_0xf5c2e4)['then'](function(_0x41f6ed){return _0x41f6ed;});}return null;};}function handleEntityNotFound(_0x20e7d7){return function(_0x355070){if(!_0x355070){_0x20e7d7[_0xeacf('0xd')](0x194);}return _0x355070;};}function handleError(_0x3935a4,_0x3a0dd9){_0x3a0dd9=_0x3a0dd9||0x1f4;return function(_0x107c58){logger[_0xeacf('0xe')](_0x107c58[_0xeacf('0xf')]);if(_0x107c58[_0xeacf('0x10')]){delete _0x107c58['name'];}_0x3935a4[_0xeacf('0xa')](_0x3a0dd9)[_0xeacf('0x11')](_0x107c58);};}exports[_0xeacf('0xc')]=function(_0x2466d7,_0x56ec79){if(_0x2466d7[_0xeacf('0x12')][_0xeacf('0x13')]!==_0xeacf('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x2466d7['params']['id'])))throw new Error(_0xeacf('0x15'));return db[_0xeacf('0x16')]['find']({'where':{'id':_0x2466d7[_0xeacf('0x17')]['id']}})['then'](handleEntityNotFound(_0x56ec79,null))[_0xeacf('0x18')](saveUpdates(_0x2466d7[_0xeacf('0x19')],null))['then'](respondWithResult(_0x56ec79,null))[_0xeacf('0x1a')](handleError(_0x56ec79,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 5cd3376..718dc3f 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 _0x3066=['emit','hasOwnProperty','exports','events','../../mysqldb','UserSetting','setMaxListeners','update'];(function(_0x440d18,_0x28febc){var _0x493b55=function(_0x4d7e6e){while(--_0x4d7e6e){_0x440d18['push'](_0x440d18['shift']());}};_0x493b55(++_0x28febc);}(_0x3066,0xc3));var _0x6306=function(_0x1ef6a2,_0x1a0daf){_0x1ef6a2=_0x1ef6a2-0x0;var _0x245152=_0x3066[_0x1ef6a2];return _0x245152;};'use strict';var EventEmitter=require(_0x6306('0x0'));var UserSetting=require(_0x6306('0x1'))['db'][_0x6306('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6306('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6306('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ab45a){return function(_0x48166f,_0x3a442d,_0x3599f6){UserSettingEvents[_0x6306('0x5')](_0x1ab45a+':'+_0x48166f['id'],_0x48166f);UserSettingEvents[_0x6306('0x5')](_0x1ab45a,_0x48166f);_0x3599f6(null);};}for(var e in events){if(events[_0x6306('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x6306('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x22c8=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4003e9,_0x440634){var _0x3985cd=function(_0x38be6e){while(--_0x38be6e){_0x4003e9['push'](_0x4003e9['shift']());}};_0x3985cd(++_0x440634);}(_0x22c8,0xcd));var _0x822c=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0x22c8[_0x53f04f];return _0x16a824;};'use strict';var EventEmitter=require(_0x822c('0x0'));var UserSetting=require(_0x822c('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x822c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x822c('0x3'),'afterDestroy':_0x822c('0x4')};function emitEvent(_0x44ff40){return function(_0x10a4f7,_0x205846,_0x2d558a){UserSettingEvents['emit'](_0x44ff40+':'+_0x10a4f7['id'],_0x10a4f7);UserSettingEvents[_0x822c('0x5')](_0x44ff40,_0x10a4f7);_0x2d558a(null);};}for(var e in events){if(events[_0x822c('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x822c('0x7')]=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 2fa680a..2513a8d 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 _0x9d02=['./user-setting.attributes','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d02,0x118));var _0x29d0=function(_0x4e6468,_0x5014a4){_0x4e6468=_0x4e6468-0x0;var _0x547df0=_0x9d02[_0x4e6468];return _0x547df0;};'use strict';var attributes=require(_0x29d0('0x0'));module['exports']=function(_0x38b711){return _0x38b711['define'](_0x29d0('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10d9e4){if(!_0x10d9e4[_0x29d0('0x2')])_0x10d9e4['clientSideLoggingEnabledSince']=null;else if(_0x10d9e4[_0x29d0('0x3')]===null)_0x10d9e4[_0x29d0('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x5b02=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5b02,0xe9));var _0x25b0=function(_0xb80458,_0x36094d){_0xb80458=_0xb80458-0x0;var _0x42b20b=_0x5b02[_0xb80458];return _0x42b20b;};'use strict';var attributes=require(_0x25b0('0x0'));module[_0x25b0('0x1')]=function(_0x428458){return _0x428458[_0x25b0('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b5f2d){if(!_0x2b5f2d['clientSideLoggingEnabled'])_0x2b5f2d[_0x25b0('0x3')]=null;else if(_0x2b5f2d[_0x25b0('0x3')]===null)_0x2b5f2d[_0x25b0('0x3')]=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 248a0c5..11a263a 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 _0x20ee=['update','emit','user-setting:update','UserId','register','length','./user-setting.events','remove'];(function(_0x335e95,_0x2e53d){var _0x3da5a6=function(_0x392e6e){while(--_0x392e6e){_0x335e95['push'](_0x335e95['shift']());}};_0x3da5a6(++_0x2e53d);}(_0x20ee,0x7e));var _0xe20e=function(_0x3d9b3c,_0xf534b5){_0x3d9b3c=_0x3d9b3c-0x0;var _0xf8ea23=_0x20ee[_0x3d9b3c];return _0xf8ea23;};'use strict';var UserSettingEvents=require(_0xe20e('0x0'));var events=['save',_0xe20e('0x1'),_0xe20e('0x2')];function createListener(_0x143aec,_0x310f84){return function(_0x1c6a3c){_0x310f84[_0xe20e('0x3')](_0x143aec,_0x1c6a3c);if(_0x143aec===_0xe20e('0x4')){_0x310f84[_0xe20e('0x3')]('user-setting:update:user-'+_0x1c6a3c[_0xe20e('0x5')],_0x1c6a3c);}};}exports[_0xe20e('0x6')]=function(_0x10f659){for(var _0x1309fd=0x0,_0x391bbf=events[_0xe20e('0x7')];_0x1309fd<_0x391bbf;_0x1309fd++){var _0x485691=events[_0x1309fd];var _0xc1684d=createListener('user-setting:'+_0x485691,_0x10f659);UserSettingEvents['on'](_0x485691,_0xc1684d);}}; \ No newline at end of file +var _0x968c=['update','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events','save'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x968c,0x73));var _0xc968=function(_0x4ced26,_0x120996){_0x4ced26=_0x4ced26-0x0;var _0xdff59a=_0x968c[_0x4ced26];return _0xdff59a;};'use strict';var UserSettingEvents=require(_0xc968('0x0'));var events=[_0xc968('0x1'),'remove',_0xc968('0x2')];function createListener(_0x19630d,_0x4f8a21){return function(_0x344f24){_0x4f8a21[_0xc968('0x3')](_0x19630d,_0x344f24);if(_0x19630d===_0xc968('0x4')){_0x4f8a21[_0xc968('0x3')](_0xc968('0x5')+_0x344f24['UserId'],_0x344f24);}};}exports[_0xc968('0x6')]=function(_0x4841e6){for(var _0xb1817e=0x0,_0x5cdc80=events[_0xc968('0x7')];_0xb1817e<_0x5cdc80;_0xb1817e++){var _0x501663=events[_0xb1817e];var _0x462757=createListener(_0xc968('0x8')+_0x501663,_0x4841e6);UserSettingEvents['on'](_0x501663,_0x462757);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5e3af88..8784b9d 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 _0xe894=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','/describe','describe','/whoami','isAuthenticated','whoami','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','post','create','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','express'];(function(_0x1d3bb9,_0x53e071){var _0xe2227=function(_0x2b6b4d){while(--_0x2b6b4d){_0x1d3bb9['push'](_0x1d3bb9['shift']());}};_0xe2227(++_0x53e071);}(_0xe894,0xe8));var _0x4e89=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0xe894[_0x1e8c4e];return _0x19088a;};'use strict';var multer=require(_0x4e89('0x0'));var util=require(_0x4e89('0x1'));var path=require(_0x4e89('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e89('0x3'));var router=express[_0x4e89('0x4')]();var fs_extra=require(_0x4e89('0x5'));var auth=require(_0x4e89('0x6'));var interaction=require(_0x4e89('0x7'));var config=require('../../config/environment');var controller=require(_0x4e89('0x8'));router[_0x4e89('0x9')]('/',auth['isAuthenticated'](),controller[_0x4e89('0xa')]);router[_0x4e89('0x9')](_0x4e89('0xb'),auth['isAuthenticated'](),controller[_0x4e89('0xc')]);router[_0x4e89('0x9')](_0x4e89('0xd'),auth[_0x4e89('0xe')](),controller[_0x4e89('0xf')]);router[_0x4e89('0x9')]('/presence',auth[_0x4e89('0xe')](),controller['getPresence']);router[_0x4e89('0x9')](_0x4e89('0x10'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x11')]);router[_0x4e89('0x9')](_0x4e89('0x12'),controller[_0x4e89('0x13')]);router[_0x4e89('0x9')]('/:id/open_tabs',auth[_0x4e89('0xe')](),controller[_0x4e89('0x14')]);router[_0x4e89('0x9')](_0x4e89('0x15'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x16')]);router[_0x4e89('0x9')](_0x4e89('0x17'),auth[_0x4e89('0xe')](),controller['getQueues']);router[_0x4e89('0x9')](_0x4e89('0x18'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x19')]);router[_0x4e89('0x9')](_0x4e89('0x1a'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x1b')]);router[_0x4e89('0x9')]('/:id/recordings',auth[_0x4e89('0xe')](),controller[_0x4e89('0x1c')]);router[_0x4e89('0x9')](_0x4e89('0x1d'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x1e')]);router[_0x4e89('0x9')](_0x4e89('0x1f'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x20')]);router[_0x4e89('0x9')](_0x4e89('0x21'),auth['isAuthenticated'](),controller[_0x4e89('0x22')]);router[_0x4e89('0x9')](_0x4e89('0x23'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x24')]);router[_0x4e89('0x9')](_0x4e89('0x25'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x26')]);router[_0x4e89('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x4e89('0x27')]);router[_0x4e89('0x9')](_0x4e89('0x28'),auth[_0x4e89('0xe')](),controller['getWhatsappInteractions']);router[_0x4e89('0x9')](_0x4e89('0x29'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x2a')]);router[_0x4e89('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0x4e89('0x2b')]);router[_0x4e89('0x9')](_0x4e89('0x2c'),auth['isAuthenticated'](),controller[_0x4e89('0x2d')]);router[_0x4e89('0x9')](_0x4e89('0x2e'),auth[_0x4e89('0xe')](),controller['getVoicePrefixes']);router[_0x4e89('0x9')](_0x4e89('0x2f'),auth['isAuthenticated'](),controller[_0x4e89('0x30')]);router[_0x4e89('0x9')](_0x4e89('0x31'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x32')]);router[_0x4e89('0x9')](_0x4e89('0x33'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x34')]);router[_0x4e89('0x9')](_0x4e89('0x35'),auth['isAuthenticated'](),controller[_0x4e89('0x36')]);router[_0x4e89('0x9')](_0x4e89('0x37'),auth[_0x4e89('0xe')](),controller['getChatWebsites']);router[_0x4e89('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x4e89('0x38')]);router['get']('/:id/square_projects',auth['isAuthenticated'](),controller[_0x4e89('0x39')]);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x4e89('0x3a')]);router[_0x4e89('0x9')](_0x4e89('0x3b'),auth[_0x4e89('0xe')](),controller['getApiKey']);router[_0x4e89('0x3c')](_0x4e89('0x15'),auth[_0x4e89('0xe')](),controller['addContacts']);router['post']('/',auth[_0x4e89('0xe')](),controller[_0x4e89('0x3d')]);router[_0x4e89('0x3c')](_0x4e89('0x3e'),auth['isAuthenticated'](),controller[_0x4e89('0x3f')]);router[_0x4e89('0x3c')](_0x4e89('0x17'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x40')]);var upload=multer({'storage':multer[_0x4e89('0x41')]({'destination':function(_0x1e8280,_0x3c3902,_0x2c51ce){_0x2c51ce(null,path['join'](config[_0x4e89('0x42')],_0x4e89('0x43')));},'filename':function(_0x323448,_0x1607c8,_0x138ddd){_0x138ddd(null,util[_0x4e89('0x44')](_0x4e89('0x45'),Date[_0x4e89('0x46')](),_0x1607c8['originalname']));}})});router[_0x4e89('0x3c')](_0x4e89('0x12'),upload[_0x4e89('0x47')](_0x4e89('0x48')),controller[_0x4e89('0x49')]);router[_0x4e89('0x3c')]('/:id/login',auth['isAuthenticated'](),controller[_0x4e89('0x4a')]);router['post'](_0x4e89('0x4b'),auth['isAuthenticated'](),controller[_0x4e89('0x4c')]);router[_0x4e89('0x3c')]('/:id/pause',auth[_0x4e89('0xe')](),controller[_0x4e89('0x4d')]);router[_0x4e89('0x3c')](_0x4e89('0x4e'),auth[_0x4e89('0xe')](),controller['unpause']);router['post'](_0x4e89('0x29'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x4f')]);router[_0x4e89('0x3c')](_0x4e89('0x50'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x51')]);router[_0x4e89('0x3c')](_0x4e89('0x52'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x53')]);router[_0x4e89('0x3c')]('/:id/fax_interactions',auth[_0x4e89('0xe')](),controller[_0x4e89('0x54')]);router[_0x4e89('0x3c')]('/:id/sms_interactions',auth[_0x4e89('0xe')](),controller['addSmsInteractions']);router[_0x4e89('0x3c')](_0x4e89('0x55'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x56')]);router[_0x4e89('0x3c')](_0x4e89('0x57'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x58')]);router[_0x4e89('0x3c')](_0x4e89('0x2f'),auth[_0x4e89('0xe')](),controller['addFaxAccounts']);router[_0x4e89('0x3c')](_0x4e89('0x31'),auth[_0x4e89('0xe')](),controller['addMailAccounts']);router['post'](_0x4e89('0x33'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x59')]);router[_0x4e89('0x3c')]('/:id/sms_accounts',auth[_0x4e89('0xe')](),controller['addSmsAccounts']);router[_0x4e89('0x3c')](_0x4e89('0x37'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x5a')]);router[_0x4e89('0x3c')](_0x4e89('0x5b'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x4e89('0x3c')](_0x4e89('0x5c'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x5d')]);router[_0x4e89('0x3c')]('/:id/api_key',auth[_0x4e89('0xe')](),controller[_0x4e89('0x5e')]);router[_0x4e89('0x5f')]('/:id',auth[_0x4e89('0xe')](),controller[_0x4e89('0x60')]);router[_0x4e89('0x5f')](_0x4e89('0x61'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x62')]);router[_0x4e89('0x63')](_0x4e89('0x17'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x64')]);router[_0x4e89('0x63')](_0x4e89('0x29'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x65')]);router[_0x4e89('0x63')](_0x4e89('0x10'),auth['isAuthenticated'](),controller[_0x4e89('0x66')]);router[_0x4e89('0x63')](_0x4e89('0x50'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x67')]);router[_0x4e89('0x63')]('/:id/mail_interactions',auth[_0x4e89('0xe')](),controller['removeMailInteractions']);router['delete']('/:id/fax_interactions',auth[_0x4e89('0xe')](),controller[_0x4e89('0x68')]);router[_0x4e89('0x63')](_0x4e89('0x69'),auth['isAuthenticated'](),controller[_0x4e89('0x6a')]);router['delete'](_0x4e89('0x55'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x6b')]);router[_0x4e89('0x63')](_0x4e89('0x57'),auth['isAuthenticated'](),controller[_0x4e89('0x6c')]);router[_0x4e89('0x63')](_0x4e89('0x2f'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x6d')]);router[_0x4e89('0x63')](_0x4e89('0x31'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x6e')]);router[_0x4e89('0x63')]('/:id/openchannel_accounts',auth[_0x4e89('0xe')](),controller[_0x4e89('0x6f')]);router[_0x4e89('0x63')](_0x4e89('0x35'),auth['isAuthenticated'](),controller[_0x4e89('0x70')]);router['delete']('/:id/chat_websites',auth[_0x4e89('0xe')](),controller[_0x4e89('0x71')]);router['delete'](_0x4e89('0x5b'),auth['isAuthenticated'](),controller[_0x4e89('0x72')]);router['delete']('/:id/square_projects',auth[_0x4e89('0xe')](),controller[_0x4e89('0x73')]);router[_0x4e89('0x63')](_0x4e89('0x3b'),auth[_0x4e89('0xe')](),controller[_0x4e89('0x74')]);module[_0x4e89('0x75')]=router; \ No newline at end of file +var _0x7c59=['removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','addQueues','join','format','%s-%s','single','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addSquareProjects','createApiKey','put','/:id/password','delete','removeQueues','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions'];(function(_0x127c58,_0x3d6791){var _0x334e6d=function(_0x34c038){while(--_0x34c038){_0x127c58['push'](_0x127c58['shift']());}};_0x334e6d(++_0x3d6791);}(_0x7c59,0xeb));var _0x97c5=function(_0x25c7a2,_0x1db678){_0x25c7a2=_0x25c7a2-0x0;var _0x4b4254=_0x7c59[_0x25c7a2];return _0x4b4254;};'use strict';var multer=require(_0x97c5('0x0'));var util=require(_0x97c5('0x1'));var path=require('path');var timeout=require(_0x97c5('0x2'));var express=require(_0x97c5('0x3'));var router=express[_0x97c5('0x4')]();var fs_extra=require(_0x97c5('0x5'));var auth=require(_0x97c5('0x6'));var interaction=require(_0x97c5('0x7'));var config=require(_0x97c5('0x8'));var controller=require(_0x97c5('0x9'));router[_0x97c5('0xa')]('/',auth['isAuthenticated'](),controller[_0x97c5('0xb')]);router[_0x97c5('0xa')](_0x97c5('0xc'),auth[_0x97c5('0xd')](),controller[_0x97c5('0xe')]);router[_0x97c5('0xa')](_0x97c5('0xf'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x10')]);router[_0x97c5('0xa')](_0x97c5('0x11'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x12')]);router[_0x97c5('0xa')]('/:id',auth[_0x97c5('0xd')](),controller['show']);router[_0x97c5('0xa')](_0x97c5('0x13'),controller[_0x97c5('0x14')]);router[_0x97c5('0xa')](_0x97c5('0x15'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x16')]);router[_0x97c5('0xa')](_0x97c5('0x17'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x18')]);router[_0x97c5('0xa')](_0x97c5('0x19'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x1a')]);router[_0x97c5('0xa')](_0x97c5('0x1b'),auth['isAuthenticated'](),controller[_0x97c5('0x1c')]);router['get'](_0x97c5('0x1d'),auth['isAuthenticated'](),controller[_0x97c5('0x1e')]);router[_0x97c5('0xa')]('/:id/recordings',auth[_0x97c5('0xd')](),controller[_0x97c5('0x1f')]);router[_0x97c5('0xa')](_0x97c5('0x20'),auth[_0x97c5('0xd')](),controller['getScreenRecordings']);router[_0x97c5('0xa')](_0x97c5('0x21'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x22')]);router[_0x97c5('0xa')](_0x97c5('0x23'),auth['isAuthenticated'](),controller[_0x97c5('0x24')]);router[_0x97c5('0xa')]('/:id/mail/interactions',auth[_0x97c5('0xd')](),controller[_0x97c5('0x25')]);router[_0x97c5('0xa')](_0x97c5('0x26'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x27')]);router[_0x97c5('0xa')](_0x97c5('0x28'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x29')]);router[_0x97c5('0xa')](_0x97c5('0x2a'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x97c5('0xa')](_0x97c5('0x2b'),auth[_0x97c5('0xd')](),controller['getTeams']);router[_0x97c5('0xa')]('/:id/lists',auth[_0x97c5('0xd')](),controller[_0x97c5('0x2c')]);router[_0x97c5('0xa')](_0x97c5('0x2d'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x2e')]);router[_0x97c5('0xa')](_0x97c5('0x2f'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x30')]);router[_0x97c5('0xa')]('/:id/fax_accounts',auth[_0x97c5('0xd')](),controller['getFaxAccounts']);router[_0x97c5('0xa')](_0x97c5('0x31'),auth[_0x97c5('0xd')](),controller['getMailAccounts']);router[_0x97c5('0xa')](_0x97c5('0x32'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x33')]);router[_0x97c5('0xa')](_0x97c5('0x34'),auth['isAuthenticated'](),controller[_0x97c5('0x35')]);router[_0x97c5('0xa')]('/:id/chat_websites',auth[_0x97c5('0xd')](),controller[_0x97c5('0x36')]);router[_0x97c5('0xa')](_0x97c5('0x37'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x38')]);router[_0x97c5('0xa')](_0x97c5('0x39'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x97c5('0xa')](_0x97c5('0x3a'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x3b')]);router['get'](_0x97c5('0x3c'),auth['isAuthenticated'](),controller[_0x97c5('0x3d')]);router[_0x97c5('0x3e')](_0x97c5('0x17'),auth['isAuthenticated'](),controller[_0x97c5('0x3f')]);router[_0x97c5('0x3e')]('/',auth[_0x97c5('0xd')](),controller[_0x97c5('0x40')]);router[_0x97c5('0x3e')]('/create_many',auth[_0x97c5('0xd')](),controller['bulkCreate']);router[_0x97c5('0x3e')](_0x97c5('0x19'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x41')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13ed19,_0x147ca5,_0x535f12){_0x535f12(null,path[_0x97c5('0x42')](config['root'],'server/files/images/'));},'filename':function(_0xaa89c,_0x29f45d,_0x24abbc){_0x24abbc(null,util[_0x97c5('0x43')](_0x97c5('0x44'),Date['now'](),_0x29f45d['originalname']));}})});router[_0x97c5('0x3e')]('/:id/avatar',upload[_0x97c5('0x45')]('file'),controller['addAvatar']);router[_0x97c5('0x3e')](_0x97c5('0x46'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x47')]);router[_0x97c5('0x3e')](_0x97c5('0x48'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x49')]);router['post'](_0x97c5('0x4a'),auth[_0x97c5('0xd')](),controller['pause']);router['post'](_0x97c5('0x4b'),auth[_0x97c5('0xd')](),controller['unpause']);router['post'](_0x97c5('0x2b'),auth['isAuthenticated'](),controller[_0x97c5('0x4c')]);router[_0x97c5('0x3e')](_0x97c5('0x4d'),auth[_0x97c5('0xd')](),controller['addChatInteractions']);router[_0x97c5('0x3e')](_0x97c5('0x4e'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x4f')]);router['post']('/:id/fax_interactions',auth[_0x97c5('0xd')](),controller['addFaxInteractions']);router[_0x97c5('0x3e')](_0x97c5('0x50'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x51')]);router[_0x97c5('0x3e')](_0x97c5('0x52'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x53')]);router[_0x97c5('0x3e')](_0x97c5('0x54'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x97c5('0x3e')](_0x97c5('0x55'),auth[_0x97c5('0xd')](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x97c5('0x56')]);router[_0x97c5('0x3e')](_0x97c5('0x32'),auth['isAuthenticated'](),controller[_0x97c5('0x57')]);router[_0x97c5('0x3e')](_0x97c5('0x34'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x97c5('0x3e')](_0x97c5('0x58'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x59')]);router[_0x97c5('0x3e')](_0x97c5('0x37'),auth[_0x97c5('0xd')](),controller['addWhatsappAccounts']);router[_0x97c5('0x3e')](_0x97c5('0x39'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x5a')]);router[_0x97c5('0x3e')](_0x97c5('0x3c'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x5b')]);router['put']('/:id',auth[_0x97c5('0xd')](),controller['update']);router[_0x97c5('0x5c')](_0x97c5('0x5d'),auth[_0x97c5('0xd')](),controller['changePassword']);router[_0x97c5('0x5e')](_0x97c5('0x19'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x5f')]);router[_0x97c5('0x5e')]('/:id/teams',auth['isAuthenticated'](),controller[_0x97c5('0x60')]);router['delete'](_0x97c5('0x61'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x62')]);router['delete'](_0x97c5('0x4d'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x63')]);router['delete'](_0x97c5('0x4e'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x64')]);router[_0x97c5('0x5e')](_0x97c5('0x65'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x66')]);router[_0x97c5('0x5e')](_0x97c5('0x50'),auth['isAuthenticated'](),controller[_0x97c5('0x67')]);router[_0x97c5('0x5e')](_0x97c5('0x52'),auth[_0x97c5('0xd')](),controller['removeOpenchannelInteractions']);router[_0x97c5('0x5e')](_0x97c5('0x54'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x68')]);router[_0x97c5('0x5e')]('/:id/fax_accounts',auth[_0x97c5('0xd')](),controller[_0x97c5('0x69')]);router[_0x97c5('0x5e')](_0x97c5('0x31'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x6a')]);router[_0x97c5('0x5e')]('/:id/openchannel_accounts',auth[_0x97c5('0xd')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0x97c5('0xd')](),controller[_0x97c5('0x6b')]);router[_0x97c5('0x5e')](_0x97c5('0x58'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x6c')]);router[_0x97c5('0x5e')]('/:id/whatsapp_accounts',auth[_0x97c5('0xd')](),controller[_0x97c5('0x6d')]);router[_0x97c5('0x5e')](_0x97c5('0x39'),auth[_0x97c5('0xd')](),controller[_0x97c5('0x6e')]);router[_0x97c5('0x5e')]('/:id/api_key',auth[_0x97c5('0xd')](),controller[_0x97c5('0x6f')]);module[_0x97c5('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0e5dfbe..a781831 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','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]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x58dc9e,_0x5c820b){var _0x12f410=function(_0x38a0b3){while(--_0x38a0b3){_0x58dc9e['push'](_0x58dc9e['shift']());}};_0x12f410(++_0x5c820b);}(_0x34e8,0x12c));var _0x834e=function(_0x5701f0,_0x2da5be){_0x5701f0=_0x5701f0-0x0;var _0x5dd208=_0x34e8[_0x5701f0];return _0x5dd208;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'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(_0x219772,_0x435faf){var _0x3bfdeb=function(_0x48ec48){while(--_0x48ec48){_0x219772['push'](_0x219772['shift']());}};_0x3bfdeb(++_0x435faf);}(_0xedd9,0xfc));var _0x9edd=function(_0x506792,_0x27b4c5){_0x506792=_0x506792-0x0;var _0x54af78=_0xedd9[_0x506792];return _0x54af78;};'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 a243064..bb8855e 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 _0x84c4=['FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','order','sort','where','options','hasOwnProperty','CmList','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','pick','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','getAssociatedQueues','flattenDeep','addAgent','getDataValue','VoicePrefixId','Queue:save','removeTeams','transaction','removeAgent','Voice','TeamVoicePrefix','UserVoicePrefix','Queue:remove','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','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','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lte','$eq','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','phone','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','teams','inbound','flatten','lower','asc','desc','substring','uniqBy','orderBy','client','http','idle','unavailable','ringing','voiceStatus','busy','charAt','toUpperCase','slice','select','field','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','emit','userNotification:recalc:','destroy','get','role','Users','user','Telephones','telephone','filter','map','value','find','UserProfileResource','stack','name','send','index','rawAttributes','type','includes','password','getOptions','User','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','query','openTabs','rows','length','dataValues','sms','fax','mail','openchannel','whatsapp','show','params','model','keys','filters','intersection','fields','merge','chat','all','update','body','describe','addContacts','ids','omit','Setting','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','agent','permissions','101','102','103','110','104','105','106','107','108','109','100','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','UserProfileSection','Agents','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','checkUserLimits','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','Queues','spread','VoiceQueue','voice','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','toLowerCase','isArray','QueueId','addAvatar','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt'];(function(_0x37436d,_0x125e06){var _0xcb79bc=function(_0x4d04a9){while(--_0x4d04a9){_0x37436d['push'](_0x37436d['shift']());}};_0xcb79bc(++_0x125e06);}(_0x84c4,0xd1));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x484c('0x0'));var util=require(_0x484c('0x1'));var path=require(_0x484c('0x2'));var fs=require('fs');var _=require(_0x484c('0x3'));var squel=require(_0x484c('0x4'));var jayson=require(_0x484c('0x5'));var Redis=require(_0x484c('0x6'));var authService=require(_0x484c('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x484c('0x8'))(_0x484c('0x9'));var utils=require(_0x484c('0xa'));var config=require(_0x484c('0xb'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x484c('0xc'))[_0x484c('0xd')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0x484c('0xe')];var db=require(_0x484c('0xf'))['db'];var socket=require(_0x484c('0x10'))(new Redis(config[_0x484c('0x11')]));require('./user.socket')[_0x484c('0x12')](socket);config[_0x484c('0x11')]=_[_0x484c('0x13')](config[_0x484c('0x11')],{'host':_0x484c('0x14'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x396510,_0x388d33,_0x6fd592,_0x3bfa73){return new Promise(function(_0x1fcd03,_0x525ba7){var _0x18c66d=_0x3bfa73||amiClient;return _0x18c66d[_0x484c('0x15')](_0x396510,_0x6fd592)[_0x484c('0x16')](function(_0x57cc94){logger[_0x484c('0x17')](_0x484c('0x18'),_0x388d33,_0x484c('0x19'));logger[_0x484c('0x1a')](_0x484c('0x1b'),_0x388d33,_0x484c('0x19'),JSON[_0x484c('0x1c')](_0x57cc94));if(_0x57cc94[_0x484c('0x1d')]){if(_0x57cc94[_0x484c('0x1d')][_0x484c('0x1e')]===0x1f4){logger[_0x484c('0x1d')](_0x484c('0x18'),_0x388d33,_0x57cc94[_0x484c('0x1d')]['message']);return _0x525ba7(_0x57cc94['error'][_0x484c('0x1f')]);}logger[_0x484c('0x1d')]('User,\x20%s,\x20%s',_0x388d33,_0x57cc94[_0x484c('0x1d')]['message']);return _0x1fcd03(_0x57cc94[_0x484c('0x1d')]['message']);}else{logger['info'](_0x484c('0x18'),_0x388d33,_0x484c('0x19'));_0x1fcd03(_0x57cc94[_0x484c('0x20')][_0x484c('0x1f')]);}})[_0x484c('0x21')](function(_0x4f1ab4){logger['error']('User,\x20%s,\x20%s',_0x388d33,_0x4f1ab4);_0x525ba7(_0x4f1ab4);});});}function respondWithStatusCode(_0x5461df,_0x3dfa9a){_0x3dfa9a=_0x3dfa9a||0xcc;return function(_0xead056){if(_0xead056){return _0x5461df['sendStatus'](_0x3dfa9a);}return _0x5461df[_0x484c('0x22')](_0x3dfa9a)[_0x484c('0x23')]();};}function respondWithResult(_0x4d6741,_0x328fe6){_0x328fe6=_0x328fe6||0xc8;return function(_0x5ee313){if(_0x5ee313){return _0x4d6741['status'](_0x328fe6)['json'](_0x5ee313);}};}function respondWithFilteredResult(_0x463cd6,_0x27e9b6){return function(_0x4fbbd4){if(_0x4fbbd4){var _0x370b3d=typeof _0x27e9b6[_0x484c('0x24')]===_0x484c('0x25')&&typeof _0x27e9b6['limit']==='undefined';var _0x4784a8=_0x4fbbd4[_0x484c('0x26')];var _0x2b3793=_0x370b3d?0x0:_0x27e9b6['offset'];var _0x35866c=_0x370b3d?_0x4fbbd4[_0x484c('0x26')]:_0x27e9b6[_0x484c('0x24')]+_0x27e9b6[_0x484c('0x27')];var _0x562b82;if(_0x35866c>=_0x4784a8){_0x35866c=_0x4784a8;_0x562b82=0xc8;}else{_0x562b82=0xce;}_0x463cd6[_0x484c('0x22')](_0x562b82);return _0x463cd6[_0x484c('0x28')](_0x484c('0x29'),_0x2b3793+'-'+_0x35866c+'/'+_0x4784a8)[_0x484c('0x2a')](_0x4fbbd4);}return null;};}function saveUpdates(_0x2dc73f){return function(_0x1fbb86){if(_0x1fbb86){return _0x1fbb86['update'](_0x2dc73f)['then'](function(_0x54a54d){socket[_0x484c('0x2b')](_0x484c('0x2c')+_0x54a54d['id'],{});return _0x54a54d;});}return null;};}function removeEntity(_0x1825a5){return function(_0x29d2a3){if(_0x29d2a3){return _0x29d2a3[_0x484c('0x2d')]()[_0x484c('0x16')](function(){var _0x4be0d6=_0x29d2a3[_0x484c('0x2e')]({'plain':!![]});if(_0x4be0d6[_0x484c('0x2f')]==='admin')return;var _0x1d1fcd=[{'name':_0x484c('0x30'),'value':_0x484c('0x31'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x484c('0x32'),'value':_0x484c('0x33'),'ignore':![]}];var _0x5f0a1e=_(_0x1d1fcd)[_0x484c('0x34')]('ignore')[_0x484c('0x35')](_0x484c('0x36'))[_0x484c('0x36')]();if(_['includes'](_0x5f0a1e,_0x4be0d6[_0x484c('0x2f')])){return;}var _0x3b9522=_[_0x484c('0x37')](_0x1d1fcd,[_0x484c('0x36'),_0x4be0d6[_0x484c('0x2f')]])['name'];return db[_0x484c('0x38')][_0x484c('0x2d')]({'where':{'type':_0x3b9522,'resourceId':_0x4be0d6['id']}})['then'](function(){return _0x29d2a3;});})[_0x484c('0x16')](function(){_0x1825a5[_0x484c('0x22')](0xcc)[_0x484c('0x23')]();});}};}function handleEntityNotFound(_0x39f2da){return function(_0x276742){if(!_0x276742){_0x39f2da['sendStatus'](0x194);}return _0x276742;};}function handleError(_0x2b5354,_0x5b7951){_0x5b7951=_0x5b7951||0x1f4;return function(_0x309a7a){logger[_0x484c('0x1d')](_0x309a7a[_0x484c('0x39')]);if(_0x309a7a[_0x484c('0x3a')]){delete _0x309a7a[_0x484c('0x3a')];}_0x2b5354['status'](_0x5b7951)[_0x484c('0x3b')](_0x309a7a);};}exports[_0x484c('0x3c')]=function(_0x36be2a,_0x58d96f){var _0x44d0ad={},_0x286ab7={'count':0x0,'rows':[]};var _0x595846=_(db['User'][_0x484c('0x3d')])['map'](function(_0x273e11){return{'name':_0x273e11['fieldName'],'type':_0x273e11[_0x484c('0x3e')]['key']};})['filter'](function(_0x4ccbc0){return!_[_0x484c('0x3f')]([_0x484c('0x40'),'salt'],_0x4ccbc0[_0x484c('0x3a')]);})[_0x484c('0x36')]();_0x44d0ad=qs[_0x484c('0x41')](_0x595846,_0x36be2a);var _0x358688={'where':_0x44d0ad['where']};return db[_0x484c('0x42')][_0x484c('0x26')](_0x358688)['then'](function(_0x5632ae){_0x286ab7[_0x484c('0x26')]=_0x5632ae;if(_0x36be2a['query'][_0x484c('0x43')]){_0x44d0ad[_0x484c('0x44')]=[{'all':!![]}];}if(_0x36be2a['query'][_0x484c('0x45')]===_0x484c('0x46')){_0x44d0ad['include']=[{'model':db[_0x484c('0x47')],'as':'userSetting'}];}if(!_[_0x484c('0x3f')](_0x44d0ad[_0x484c('0x48')],'id')){_0x44d0ad[_0x484c('0x48')][_0x484c('0x49')]('id');}return db['User'][_0x484c('0x4a')](_0x44d0ad);})[_0x484c('0x16')](function(_0x3cf446){_0x286ab7['rows']=_0x3cf446;if(_0x36be2a[_0x484c('0x4b')][_0x484c('0x4c')]==='true'){var _0x2b8937=[];for(var _0x17d111=0x0;_0x17d111<_0x286ab7[_0x484c('0x4d')][_0x484c('0x4e')];_0x17d111++){_0x2b8937[_0x484c('0x49')](get_open_tabs('chat',_0x286ab7[_0x484c('0x4d')][_0x17d111][_0x484c('0x4f')]));_0x2b8937['push'](get_open_tabs(_0x484c('0x50'),_0x286ab7[_0x484c('0x4d')][_0x17d111][_0x484c('0x4f')]));_0x2b8937['push'](get_open_tabs(_0x484c('0x51'),_0x286ab7[_0x484c('0x4d')][_0x17d111][_0x484c('0x4f')]));_0x2b8937[_0x484c('0x49')](get_open_tabs(_0x484c('0x52'),_0x286ab7[_0x484c('0x4d')][_0x17d111][_0x484c('0x4f')]));_0x2b8937['push'](get_open_tabs(_0x484c('0x53'),_0x286ab7[_0x484c('0x4d')][_0x17d111][_0x484c('0x4f')]));_0x2b8937[_0x484c('0x49')](get_open_tabs(_0x484c('0x54'),_0x286ab7[_0x484c('0x4d')][_0x17d111]['dataValues']));}return Promise['all'](_0x2b8937)['then'](function(){return _0x286ab7;});}else{return _0x286ab7;}})[_0x484c('0x16')](respondWithFilteredResult(_0x58d96f,_0x44d0ad))[_0x484c('0x21')](handleError(_0x58d96f,null));};exports[_0x484c('0x55')]=function(_0x570715,_0x57ab2e){var _0x566b15={'raw':![],'where':{'id':_0x570715[_0x484c('0x56')]['id']}},_0x45d5ca={};_0x45d5ca[_0x484c('0x57')]=_['differenceBy'](_['keys'](db['User'][_0x484c('0x3d')]),[_0x484c('0x40'),'salt']);_0x45d5ca[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x570715['query']);_0x45d5ca[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x45d5ca[_0x484c('0x57')],_0x45d5ca[_0x484c('0x4b')]);_0x566b15[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x45d5ca[_0x484c('0x57')],qs['fields'](_0x570715[_0x484c('0x4b')][_0x484c('0x5b')]));_0x566b15['attributes']=_0x566b15['attributes'][_0x484c('0x4e')]?_0x566b15[_0x484c('0x48')]:_0x45d5ca[_0x484c('0x57')];if(_0x570715[_0x484c('0x4b')]['includeAll']){_0x566b15[_0x484c('0x44')]=[{'all':!![]}];}if(_0x570715[_0x484c('0x4b')]['userSetting']===_0x484c('0x46')){_0x566b15[_0x484c('0x44')]=[{'model':db[_0x484c('0x47')],'as':_0x484c('0x45')}];}_0x566b15=_[_0x484c('0x5c')]({},_0x566b15,_0x570715['options']);if(!_[_0x484c('0x3f')](_0x566b15[_0x484c('0x48')],'id')){_0x566b15[_0x484c('0x48')]['push']('id');}return db[_0x484c('0x42')][_0x484c('0x37')](_0x566b15)['then'](handleEntityNotFound(_0x57ab2e,null))[_0x484c('0x16')](function(_0x289d84){var _0x2c6130=[];values=_0x289d84;if(_0x570715[_0x484c('0x4b')][_0x484c('0x4c')]===_0x484c('0x46')){_0x2c6130[_0x484c('0x49')](get_open_tabs(_0x484c('0x5d'),_0x289d84['dataValues']));_0x2c6130['push'](get_open_tabs(_0x484c('0x50'),_0x289d84['dataValues']));_0x2c6130[_0x484c('0x49')](get_open_tabs('openchannel',_0x289d84['dataValues']));_0x2c6130[_0x484c('0x49')](get_open_tabs(_0x484c('0x54'),_0x289d84['dataValues']));_0x2c6130['push'](get_open_tabs(_0x484c('0x51'),_0x289d84[_0x484c('0x4f')]));_0x2c6130[_0x484c('0x49')](get_open_tabs(_0x484c('0x52'),_0x289d84['dataValues']));return Promise[_0x484c('0x5e')](_0x2c6130);}else{return values;}})[_0x484c('0x16')](function(){return values;})[_0x484c('0x16')](respondWithResult(_0x57ab2e,null))[_0x484c('0x21')](handleError(_0x57ab2e,null));};exports[_0x484c('0x5f')]=function(_0x138913,_0xce12bd){if(_0x138913['body']['id']){delete _0x138913[_0x484c('0x60')]['id'];}delete _0x138913[_0x484c('0x60')][_0x484c('0x2f')];return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x138913[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0xce12bd,null))[_0x484c('0x16')](saveUpdates(_0x138913[_0x484c('0x60')],null))[_0x484c('0x16')](respondWithResult(_0xce12bd,null))[_0x484c('0x21')](handleError(_0xce12bd,null));};exports[_0x484c('0x61')]=function(_0x7486f8,_0x5f36e0){return db[_0x484c('0x42')][_0x484c('0x61')]()[_0x484c('0x16')](respondWithResult(_0x5f36e0,null))[_0x484c('0x21')](handleError(_0x5f36e0,null));};exports[_0x484c('0x62')]=function(_0x21638a,_0x5e721e){return db[_0x484c('0x42')]['find']({'where':{'id':_0x21638a['params']['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x5e721e,null))[_0x484c('0x16')](function(_0x1bbcfe){if(_0x1bbcfe){return _0x1bbcfe[_0x484c('0x62')](_0x21638a[_0x484c('0x60')][_0x484c('0x63')],_[_0x484c('0x64')](_0x21638a[_0x484c('0x60')],[_0x484c('0x63'),'id'])||{});}})['then'](respondWithResult(_0x5e721e,null))[_0x484c('0x21')](handleError(_0x5e721e,null));};function validateUser(_0x287a4c){return new Promise(function(_0x46d83d,_0x52685c){if(_0x287a4c['internal'])return _0x46d83d(_0x287a4c);return db[_0x484c('0x65')]['findById'](0x1)[_0x484c('0x16')](function(_0x12e370){if(_0x12e370[_0x484c('0x66')])authService[_0x484c('0x67')](_0x287a4c[_0x484c('0x40')]);db['User'][_0x484c('0x68')](_0x484c('0x69'))[_0x484c('0x16')](function(_0x4a79ca){if(_[_0x484c('0x6a')](_0x4a79ca)){_0x287a4c[_0x484c('0x69')]=_0x12e370[_0x484c('0x6b')]||0x1;return;}if(_[_0x484c('0x6a')](_0x12e370[_0x484c('0x6b')])||_0x12e370[_0x484c('0x6b')]===_0x4a79ca){_0x287a4c[_0x484c('0x69')]=_0x4a79ca+0x1;return;}if(_0x12e370[_0x484c('0x6b')]>_0x4a79ca){_0x287a4c[_0x484c('0x69')]=_0x12e370[_0x484c('0x6b')];return;}return db[_0x484c('0x6c')][_0x484c('0x4b')](_0x484c('0x6d'),{'type':db[_0x484c('0x6c')][_0x484c('0x6e')][_0x484c('0x6f')]})[_0x484c('0x16')](function(_0x48e711){if(_0x48e711&&_0x48e711[_0x484c('0x4e')]){for(var _0x48b978=0x0,_0x2be298=_0x48e711['length'];_0x48b978<_0x2be298&&_[_0x484c('0x6a')](_0x287a4c[_0x484c('0x69')]);_0x48b978++){if(_0x12e370[_0x484c('0x6b')]<=_0x48e711[_0x48b978][_0x484c('0x70')]){_0x287a4c[_0x484c('0x69')]=_0x48e711[_0x48b978]['from'];}else if(_0x12e370[_0x484c('0x6b')]>_0x48e711[_0x48b978]['from']&&_0x12e370[_0x484c('0x6b')]<=_0x48e711[_0x48b978]['to']){_0x287a4c['internal']=_0x12e370['min_internal'];}}}if(_[_0x484c('0x6a')](_0x287a4c[_0x484c('0x69')])){_0x287a4c[_0x484c('0x69')]=_0x4a79ca+0x1;}return _0x46d83d(_0x287a4c);});});})[_0x484c('0x21')](function(_0x59f07f){_0x52685c(_0x59f07f);});});}function updateUser(_0x25fd5a){return new Promise(function(_0x375122,_0x566985){try{if(_0x25fd5a[_0x484c('0x71')]){_0x25fd5a[_0x484c('0x72')]=_0x25fd5a[_0x484c('0x69')];_0x25fd5a[_0x484c('0x73')]={'mailbox':_0x25fd5a[_0x484c('0x69')],'password':_0x25fd5a[_0x484c('0x40')],'fullname':_0x25fd5a['fullname'],'email':_0x25fd5a[_0x484c('0x74')]};}if(_0x25fd5a['role']===_0x484c('0x75')){if(!_0x25fd5a[_0x484c('0x76')])_0x25fd5a['permissions']=[_0x484c('0x77'),_0x484c('0x78'),_0x484c('0x79'),'113',_0x484c('0x7a'),_0x484c('0x7b'),_0x484c('0x7c'),_0x484c('0x7d'),_0x484c('0x7e'),_0x484c('0x7f'),_0x484c('0x80'),_0x484c('0x81'),'111',_0x484c('0x82'),_0x484c('0x83')];}_0x375122(_0x25fd5a);}catch(_0x2c9012){_0x566985(_0x2c9012);}});}exports[_0x484c('0x84')]=function(_0xae818e,_0xc97206){if(_0xae818e[_0x484c('0x31')][_0x484c('0x2f')]==='agent')throw new Error(_0x484c('0x85'));if(_0xae818e[_0x484c('0x60')]['role']===_0x484c('0x31')&&_0xae818e['user'][_0x484c('0x2f')]!==_0x484c('0x86')){throw new Error(_0x484c('0x87'));}if(_0xae818e['body'][_0x484c('0x2f')]===_0x484c('0x86')&&_0xae818e[_0x484c('0x31')]['role']!==_0x484c('0x86')){throw new Error(_0x484c('0x88'));}return licenseUtil['checkUserLimits']([_0xae818e[_0x484c('0x60')]])['then'](function(){return validateUser(_0xae818e[_0x484c('0x60')]);})[_0x484c('0x16')](function(_0x1d2776){return updateUser(_0x1d2776)[_0x484c('0x16')](function(_0x20de04){if(_0x20de04[_0x484c('0x2f')]===_0x484c('0x86')){_0x20de04[_0x484c('0x89')]=_0xae818e[_0x484c('0x31')][_0x484c('0x89')];delete _0x20de04['userProfileId'];}return _0x20de04;});})[_0x484c('0x16')](function(_0x540de5){return db[_0x484c('0x42')][_0x484c('0x84')](_0x540de5,{'include':[{'model':db['VoiceMail'],'as':_0x484c('0x73')}]});})[_0x484c('0x16')](function(_0x3abc80){if(_0xae818e[_0x484c('0x60')][_0x484c('0x2f')]===_0x484c('0x31'))return _0x3abc80;if(_0xae818e[_0x484c('0x31')][_0x484c('0x2f')]!=='user')return _0x3abc80;return db[_0x484c('0x8a')]['find']({'where':{'name':_0x3abc80['role']==='agent'?_0x484c('0x8b'):_0x484c('0x32'),'userProfileId':_0xae818e[_0x484c('0x31')][_0x484c('0x8c')]},'raw':!![]})['then'](function(_0x33e9da){if(!_0x33e9da||_0x33e9da[_0x484c('0x8d')]!=0x0)return _0x3abc80;return db['UserProfileResource'][_0x484c('0x84')]({'name':_0x3abc80['name'],'resourceId':_0x3abc80['id'],'type':_0x33e9da[_0x484c('0x3a')],'sectionId':_0x33e9da['id']},{})[_0x484c('0x16')](function(){return _0x3abc80;});})['catch'](function(_0x41131d){logger[_0x484c('0x1d')](_0x484c('0x8e'),_0x41131d);throw _0x41131d;});})['then'](respondWithResult(_0xc97206,0xc9))[_0x484c('0x21')](handleError(_0xc97206,null));};exports['bulkCreate']=function(_0x259fb1,_0x4b8531){var _0x2a27d1=_0x259fb1[_0x484c('0x60')];var _0x4122c8=[];if(_0x259fb1[_0x484c('0x31')][_0x484c('0x2f')]===_0x484c('0x75'))throw new Error(_0x484c('0x85'));if(_[_0x484c('0x8f')](_0x2a27d1,['role',_0x484c('0x31')])&&_0x259fb1['user'][_0x484c('0x2f')]!==_0x484c('0x86')){throw new Error(_0x484c('0x87'));}if(_['some'](_0x2a27d1,[_0x484c('0x2f'),_0x484c('0x86')])&&_0x259fb1[_0x484c('0x31')][_0x484c('0x2f')]!==_0x484c('0x86')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x484c('0x90')](_0x2a27d1)[_0x484c('0x16')](function(){return validateUser(_0x2a27d1[0x0]);})[_0x484c('0x16')](function(){for(var _0x5ea933=0x1;_0x5ea933<_0x2a27d1[_0x484c('0x4e')];_0x5ea933++){var _0x1f916a=_0x2a27d1[_0x5ea933-0x1][_0x484c('0x69')];if(!_0x2a27d1[_0x5ea933][_0x484c('0x69')])_0x2a27d1[_0x5ea933][_0x484c('0x69')]=_0x1f916a+0x1;_0x4122c8[_0x484c('0x49')](validateUser(_0x2a27d1[_0x5ea933]));}return Promise[_0x484c('0x5e')](_0x4122c8);})[_0x484c('0x16')](function(){_0x4122c8=[];for(var _0x123f49=0x0;_0x123f49<_0x2a27d1['length'];_0x123f49++){_0x4122c8[_0x484c('0x49')](updateUser(_0x2a27d1[_0x123f49]));}return Promise['all'](_0x4122c8);})[_0x484c('0x16')](function(){_0x4122c8=_0x2a27d1['map'](function(_0x58c74b){return db[_0x484c('0x42')][_0x484c('0x84')](_0x58c74b,{'include':[{'model':db['VoiceMail'],'as':_0x484c('0x73')}]})['then'](function(_0x41accf){_0x58c74b['id']=_0x41accf['id'];return _0x58c74b;});});return Promise[_0x484c('0x5e')](_0x4122c8);})[_0x484c('0x16')](function(_0x5d905f){if(_0x259fb1[_0x484c('0x60')][_0x484c('0x2f')]===_0x484c('0x31'))return _0x5d905f;if(_0x259fb1[_0x484c('0x31')][_0x484c('0x2f')]!==_0x484c('0x31'))return _0x5d905f;var _0x570a1e=_[_0x484c('0x8f')](_0x5d905f,function(_0x97fe67){return _0x97fe67[_0x484c('0x2f')]===_0x484c('0x75')||_0x97fe67['role']===_0x484c('0x33');});if(!_0x570a1e)return _0x5d905f;return db[_0x484c('0x8a')][_0x484c('0x4a')]({'where':{'name':{'$or':[_0x484c('0x8b'),_0x484c('0x32')]},'userProfileId':_0x259fb1[_0x484c('0x31')][_0x484c('0x8c')]},'raw':!![]})['then'](function(_0x58f87c){if(_[_0x484c('0x91')](_0x58f87c)||!_[_0x484c('0x8f')](_0x58f87c,[_0x484c('0x8d'),0x0]))return _0x5d905f;_0x4122c8=[];var _0x59dc57=_(_0x58f87c)[_0x484c('0x35')](function(_0x488d62){if(_0x488d62['autoAssociation']===0x1)return;return _0x488d62[_0x484c('0x3a')]===_0x484c('0x8b')?'agent':_0x484c('0x33');})[_0x484c('0x92')]()[_0x484c('0x36')]();for(var _0x1cf707=0x0;_0x1cf707<_0x5d905f['length'];_0x1cf707++){if(!_['includes'](_0x59dc57,_0x5d905f[_0x1cf707][_0x484c('0x2f')]))return;var _0x4378f0=_0x5d905f[_0x1cf707][_0x484c('0x2f')]==='agent'?_0x484c('0x8b'):'Telephones';_0x4122c8[_0x484c('0x49')](db[_0x484c('0x38')]['create']({'name':_0x5d905f[_0x1cf707][_0x484c('0x3a')],'resourceId':_0x5d905f[_0x1cf707]['id'],'type':_0x4378f0,'sectionId':_[_0x484c('0x37')](_0x58f87c,[_0x484c('0x3a'),_0x4378f0])['id']},{}));}return Promise[_0x484c('0x5e')](_0x4122c8);});})['then'](respondWithResult(_0x4b8531,0xc9))[_0x484c('0x21')](handleError(_0x4b8531,null));};exports[_0x484c('0x93')]=function(_0x592430,_0x180122){if(_0x592430['body']['id']){delete _0x592430[_0x484c('0x60')]['id'];}return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x592430[_0x484c('0x56')]['id']}})[_0x484c('0x16')](function(_0x3910d4){if(!_0x3910d4)return null;if(_0x3910d4['id']===_0x592430['user']['id']){if(!_0x592430[_0x484c('0x60')][_0x484c('0x94')]||!_0x592430[_0x484c('0x60')][_0x484c('0x95')]){throw new db[(_0x484c('0x96'))][(_0x484c('0x97'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3910d4['authenticate'](_0x592430['body'][_0x484c('0x94')])){throw new db['Sequelize'][(_0x484c('0x97'))](_0x484c('0x98'));}if(_0x592430[_0x484c('0x60')]['oldPassword']===_0x592430['body']['newPassword']){throw new db[(_0x484c('0x96'))][(_0x484c('0x97'))](_0x484c('0x99'));}}else if(_0x592430[_0x484c('0x31')][_0x484c('0x2f')]===_0x484c('0x86')){if(!_0x592430[_0x484c('0x60')][_0x484c('0x95')]){throw new db[(_0x484c('0x96'))][(_0x484c('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x592430[_0x484c('0x31')][_0x484c('0x2f')]===_0x484c('0x31')){if(!_0x592430[_0x484c('0x60')][_0x484c('0x95')]){throw new db[(_0x484c('0x96'))][(_0x484c('0x97'))](_0x484c('0x9a'));}if(_0x3910d4[_0x484c('0x2f')]!==_0x484c('0x75')){throw new db[(_0x484c('0x96'))][(_0x484c('0x97'))](_0x484c('0x85'));}}else{throw new db[(_0x484c('0x96'))]['ValidationError'](_0x484c('0x85'));}return _0x3910d4;})[_0x484c('0x16')](handleEntityNotFound(_0x180122,null))['then'](function(_0x396854){return db[_0x484c('0x65')][_0x484c('0x9b')]({'attributes':['id',_0x484c('0x66'),_0x484c('0x9c'),_0x484c('0x9d')]})[_0x484c('0x16')](function(_0xf60d87){if(_0xf60d87['securePassword'])authService[_0x484c('0x67')](_0x592430[_0x484c('0x60')][_0x484c('0x95')]);if(!_0xf60d87[_0x484c('0x9c')]||!_0x396854[_0x484c('0x9e')])return _0x396854;authService[_0x484c('0x9f')](_0x592430[_0x484c('0x60')]['newPassword'],_0x396854['previousPasswords'],_0xf60d87[_0x484c('0x9d')]);return _0x396854;})[_0x484c('0x16')](saveUpdates({'password':_0x592430[_0x484c('0x60')]['newPassword'],'passwordResetAt':_0x592430[_0x484c('0x31')]['id']==_0x592430['params']['id']?moment():null,'previousPasswords':authService[_0x484c('0xa0')](_0x592430[_0x484c('0x60')][_0x484c('0x95')],_0x396854[_0x484c('0x9e')])},null));})[_0x484c('0x16')](respondWithResult(_0x180122,null))[_0x484c('0x21')](handleError(_0x180122,null));};exports[_0x484c('0xa1')]=function(_0x16c8af,_0xa3faec){var _0x378e09=_0x16c8af['body'][_0x484c('0xa2')];return db[_0x484c('0x42')]['find']({'where':{'id':_0x16c8af[_0x484c('0x56')]['id']},'attributes':['id','name',_0x484c('0x2f'),_0x484c('0xa3'),_0x484c('0xa4'),_0x484c('0xa5'),_0x484c('0xa6')]})[_0x484c('0x16')](handleEntityNotFound(_0xa3faec,null))[_0x484c('0x16')](function(_0x57adbd){if(_0x57adbd){if(!utils[_0x484c('0xa7')](_0x378e09)){throw new db['Sequelize'][(_0x484c('0x97'))]('Unknown\x20channel');}return _0x57adbd[_0x484c('0xa8')+_[_0x484c('0xa9')](_0x378e09['toLowerCase']())+_0x484c('0xaa')](_0x16c8af['body'][_0x484c('0x63')],{'penalty':_0x16c8af[_0x484c('0x60')]['penalty']||0x0})[_0x484c('0xab')](function(_0x989b3f){for(var _0x338df1=0x0;_0x338df1<_0x16c8af[_0x484c('0x60')][_0x484c('0x63')]['length'];_0x338df1+=0x1){var _0x2b2023={'UserId':Number(_0x16c8af[_0x484c('0x56')]['id'])};_0x2b2023[_[_0x484c('0xa9')](_0x378e09['toLowerCase']())+'QueueId']=Number(_0x16c8af[_0x484c('0x60')]['ids'][_0x338df1]);socket['emit'](_0x484c('0x31')+_[_0x484c('0xa9')](_0x378e09['toLowerCase']())+'Queue:save',_0x2b2023);}return _0x989b3f;})[_0x484c('0x16')](function(){if(_0x378e09==='voice'){return db[_0x484c('0xac')][_0x484c('0x4a')]({'where':{'id':_0x16c8af[_0x484c('0x60')]['ids']||[]},'raw':!![],'attributes':['id',_0x484c('0x3a')]});}})['then'](function(_0x2d3780){var _0x296a67=_0x57adbd[_0x484c('0x2e')]({'plain':!![]});var _0x415ae7=[];if(_0x378e09===_0x484c('0xad')&&_0x296a67[_0x484c('0x2f')]==='agent'&&_0x296a67[_0x484c('0xa3')]){for(let _0x4d3e1f=0x0;_0x4d3e1f<_0x2d3780[_0x484c('0x4e')];_0x4d3e1f+=0x1){_0x415ae7[_0x484c('0x49')]({'membername':_0x296a67['name'],'UserId':_0x296a67['id'],'queue_name':_0x2d3780[_0x4d3e1f][_0x484c('0x3a')],'VoiceQueueId':_0x2d3780[_0x4d3e1f]['id'],'interface':_[_0x484c('0x6a')](_0x296a67['interface'])?util[_0x484c('0xae')](_0x484c('0xaf'),_0x296a67[_0x484c('0x3a')]):_0x296a67['interface'],'paused':_0x296a67[_0x484c('0xa5')]||![],'penalty':_0x16c8af[_0x484c('0x60')][_0x484c('0xb0')]||0x0});}return Promise[_0x484c('0x5e')](_0x415ae7['map'](function(_0x53609c){return db[_0x484c('0xb1')][_0x484c('0xb2')](_0x53609c);}));}return _0x57adbd;});}})[_0x484c('0x16')](respondWithStatusCode(_0xa3faec,null))['catch'](handleError(_0xa3faec,null));};exports[_0x484c('0xb3')]=function(_0x22d2ce,_0x1a4da2){var _0x48088b,_0x3a7d3d;return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x22d2ce[_0x484c('0x56')]['id']},'attributes':['id',_0x484c('0x3a'),'role']})['then'](handleEntityNotFound(_0x1a4da2,null))[_0x484c('0x16')](function(_0x55adc0){if(_0x55adc0){_0x48088b=_0x55adc0;if(!_0x22d2ce[_0x484c('0x4b')][_0x484c('0xa2')]||!utils[_0x484c('0xa7')](_0x22d2ce['query']['channel'])){throw new db[(_0x484c('0x96'))]['ValidationError'](_0x484c('0xb4'));}return _0x55adc0[_0x484c('0xb5')+_['capitalize'](_0x22d2ce[_0x484c('0x4b')]['channel'][_0x484c('0xb6')]())+_0x484c('0xaa')](_0x22d2ce[_0x484c('0x4b')][_0x484c('0x63')]);}})[_0x484c('0x16')](function(_0x3e33e5){if(_[_0x484c('0xb7')](_0x22d2ce[_0x484c('0x4b')]['ids'])){for(var _0x582b2b=0x0;_0x582b2b<_0x22d2ce[_0x484c('0x4b')]['ids'][_0x484c('0x4e')];_0x582b2b+=0x1){_0x3a7d3d={'UserId':Number(_0x22d2ce[_0x484c('0x56')]['id'])};_0x3a7d3d[_[_0x484c('0xa9')](_0x22d2ce[_0x484c('0x4b')][_0x484c('0xa2')][_0x484c('0xb6')]())+_0x484c('0xb8')]=Number(_0x22d2ce[_0x484c('0x4b')][_0x484c('0x63')][_0x582b2b]);socket[_0x484c('0x2b')](_0x484c('0x31')+_[_0x484c('0xa9')](_0x22d2ce['query'][_0x484c('0xa2')][_0x484c('0xb6')]())+'Queue:remove',_0x3a7d3d);}}else{_0x3a7d3d={'UserId':Number(_0x22d2ce['params']['id'])};_0x3a7d3d[_['capitalize'](_0x22d2ce[_0x484c('0x4b')]['channel']['toLowerCase']())+_0x484c('0xb8')]=Number(_0x22d2ce[_0x484c('0x4b')][_0x484c('0x63')]);socket[_0x484c('0x2b')]('user'+_[_0x484c('0xa9')](_0x22d2ce[_0x484c('0x4b')][_0x484c('0xa2')]['toLowerCase']())+'Queue:remove',_0x3a7d3d);}return _0x3e33e5;})['then'](function(){if(_0x22d2ce['query']['channel']==='voice'){return db[_0x484c('0xb1')][_0x484c('0x2d')]({'where':{'UserId':_0x22d2ce[_0x484c('0x56')]['id'],'VoiceQueueId':_0x22d2ce[_0x484c('0x4b')][_0x484c('0x63')]},'individualHooks':!![]})['then'](function(){return _0x48088b;});}return _0x48088b;})[_0x484c('0x16')](respondWithStatusCode(_0x1a4da2,null))[_0x484c('0x21')](handleError(_0x1a4da2,null));};exports[_0x484c('0xb9')]=function(_0x3dabd0,_0x9593b0){_0x3dabd0[_0x484c('0x60')][_0x484c('0xba')]=_0x3dabd0[_0x484c('0xbb')]['filename'];return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x3dabd0[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x9593b0,null))[_0x484c('0x16')](saveUpdates(_0x3dabd0['body'],null))[_0x484c('0x16')](respondWithResult(_0x9593b0,null))[_0x484c('0x21')](handleError(_0x9593b0,null));};exports[_0x484c('0xbc')]=function(_0x29dc3f,_0x304f5c){var _0x5bc777=path['join'](config[_0x484c('0xbd')],_0x484c('0xbe'));return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x29dc3f['params']['id']},'attributes':['id',_0x484c('0xba')],'raw':!![]})[_0x484c('0x16')](handleEntityNotFound(_0x304f5c,null))[_0x484c('0x16')](function(_0x243a7c){if(_0x243a7c){if(_['isNil'](_0x243a7c[_0x484c('0xba')])){return _0x304f5c[_0x484c('0xbf')](_0x5bc777);}else{if(!fs[_0x484c('0xc0')](path[_0x484c('0xc1')](config['root'],_0x484c('0xc2'),_0x243a7c['userpic']))){return _0x304f5c['download'](_0x5bc777);}return _0x304f5c[_0x484c('0xbf')](path[_0x484c('0xc1')](config[_0x484c('0xbd')],_0x484c('0xc2'),_0x243a7c[_0x484c('0xba')]));}}})[_0x484c('0x21')](handleError(_0x304f5c,null));};exports[_0x484c('0xc3')]=function(_0x524dde,_0x59adb8){return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x524dde['params']['id']},'attributes':['id']})[_0x484c('0x16')](handleEntityNotFound(_0x59adb8,null))[_0x484c('0x16')](function(_0x1ca40c){var _0xc1c5e6=[];values=_0x1ca40c['dataValues'];_0xc1c5e6[_0x484c('0x49')](get_open_tabs(_0x484c('0x5d'),_0x1ca40c[_0x484c('0x4f')]));_0xc1c5e6[_0x484c('0x49')](get_open_tabs(_0x484c('0x50'),_0x1ca40c[_0x484c('0x4f')]));_0xc1c5e6[_0x484c('0x49')](get_open_tabs('openchannel',_0x1ca40c[_0x484c('0x4f')]));_0xc1c5e6[_0x484c('0x49')](get_open_tabs(_0x484c('0x54'),_0x1ca40c['dataValues']));_0xc1c5e6['push'](get_open_tabs(_0x484c('0x51'),_0x1ca40c[_0x484c('0x4f')]));_0xc1c5e6[_0x484c('0x49')](get_open_tabs('mail',_0x1ca40c[_0x484c('0x4f')]));return Promise[_0x484c('0x5e')](_0xc1c5e6);})['then'](function(_0x205bc3){if(_0x205bc3){var _0x3e36e8=_['map'](values[_0x484c('0xc4')],function(_0x468010){return{'channel':_0x484c('0xc5'),'id':_0x468010['id'],'createdAt':_0x468010[_0x484c('0xc6')]};});var _0x4671cc=_['map'](values[_0x484c('0xc7')],function(_0x58e3dc){return{'channel':_0x484c('0xc8'),'id':_0x58e3dc['id'],'createdAt':_0x58e3dc[_0x484c('0xc6')]};});var _0xeed044=_['map'](values[_0x484c('0xc9')],function(_0x50cedd){return{'channel':_0x484c('0xca'),'id':_0x50cedd['id'],'createdAt':_0x50cedd[_0x484c('0xc6')]};});var _0x2d4da8=_[_0x484c('0x35')](values[_0x484c('0xcb')],function(_0x50df09){return{'channel':_0x484c('0xcc'),'id':_0x50df09['id'],'createdAt':_0x50df09[_0x484c('0xc6')]};});var _0x5739ce=_[_0x484c('0x35')](values[_0x484c('0xcd')],function(_0x4b8fbb){return{'channel':_0x484c('0xce'),'id':_0x4b8fbb['id'],'createdAt':_0x4b8fbb[_0x484c('0xc6')]};});var _0x8a752b=_[_0x484c('0x35')](values[_0x484c('0xcf')],function(_0x11587b){return{'channel':_0x484c('0xd0'),'id':_0x11587b['id'],'createdAt':_0x11587b['createdAt']};});var _0x103110=_['concat'](_0x3e36e8,_0x4671cc,_0xeed044,_0x2d4da8,_0x5739ce,_0x8a752b);var _0x5622fa={'count':_0x103110['length'],'rows':_0x103110};return _0x5622fa;}else return null;})[_0x484c('0x16')](respondWithResult(_0x59adb8,null))[_0x484c('0x21')](handleError(_0x59adb8,null));};exports[_0x484c('0xd1')]=function(_0x5ec1d7,_0x202aac){var _0x1cb75e={};var _0x2e7048={};var _0x404ecf;var _0x1902cd;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x5ec1d7[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x202aac,null))[_0x484c('0x16')](function(_0x174c35){if(_0x174c35){_0x404ecf=_0x174c35;_0x2e7048[_0x484c('0x57')]=_[_0x484c('0x58')](db[_0x484c('0xd2')][_0x484c('0x3d')]);_0x2e7048['query']=_[_0x484c('0x58')](_0x5ec1d7[_0x484c('0x4b')]);_0x2e7048['filters']=_['intersection'](_0x2e7048[_0x484c('0x57')],_0x2e7048[_0x484c('0x4b')]);_0x1cb75e[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x2e7048[_0x484c('0x57')],qs['fields'](_0x5ec1d7[_0x484c('0x4b')][_0x484c('0x5b')]));_0x1cb75e[_0x484c('0x48')]=_0x1cb75e['attributes']['length']?_0x1cb75e[_0x484c('0x48')]:_0x2e7048[_0x484c('0x57')];_0x1cb75e[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x5ec1d7[_0x484c('0x4b')][_0x484c('0xd4')]);_0x1cb75e[_0x484c('0xd5')]=qs[_0x484c('0x59')](_['pick'](_0x5ec1d7[_0x484c('0x4b')],_0x2e7048[_0x484c('0x59')]));if(_0x5ec1d7[_0x484c('0x4b')][_0x484c('0x34')]){_0x1cb75e[_0x484c('0xd5')]=_['merge'](_0x1cb75e[_0x484c('0xd5')],{'$or':_['map'](_0x1cb75e[_0x484c('0x48')],function(_0x4930b8){var _0x427180={};_0x427180[_0x4930b8]={'$like':'%'+_0x5ec1d7[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x427180;})});}_0x1cb75e=_[_0x484c('0x5c')]({},_0x1cb75e,_0x5ec1d7[_0x484c('0xd6')]);return _0x404ecf[_0x484c('0xd1')](_0x1cb75e);}})[_0x484c('0x16')](function(_0x44e662){if(_0x44e662){_0x1902cd=_0x44e662[_0x484c('0x4e')];if(_0x5ec1d7['query'][_0x484c('0xd7')](_0x484c('0x43'))){_0x1cb75e['include']=[{'model':db[_0x484c('0xd8')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x484c('0xd9'),'attributes':['id',_0x484c('0x3a'),_0x484c('0xda')],'where':_0x5ec1d7['query'][_0x484c('0xdb')]?{'id':_0x5ec1d7[_0x484c('0x4b')][_0x484c('0xdb')]}:undefined,'required':_0x5ec1d7[_0x484c('0x4b')]['tag']?!![]:![]}];}if(!_0x5ec1d7[_0x484c('0x4b')][_0x484c('0xd7')](_0x484c('0xdc'))){_0x1cb75e[_0x484c('0x27')]=qs['limit'](_0x5ec1d7[_0x484c('0x4b')][_0x484c('0x27')]);_0x1cb75e['offset']=qs['offset'](_0x5ec1d7[_0x484c('0x4b')]['offset']);}return _0x404ecf['getContacts'](_0x1cb75e);}})[_0x484c('0x16')](function(_0x4d28f4){if(_0x4d28f4){return _0x4d28f4?{'count':_0x1902cd,'rows':_0x4d28f4}:null;}})['then'](respondWithResult(_0x202aac,null))['catch'](handleError(_0x202aac,null));};exports[_0x484c('0xdd')]=function(_0x747e9d,_0x3c35db){var _0x576a13;var _0x48adf7={};var _0x5576eb;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x747e9d['params']['id']},'attributes':['id','name',_0x484c('0x2f')]})[_0x484c('0x16')](handleEntityNotFound(_0x3c35db,null))[_0x484c('0x16')](function(_0x5b9c85){if(!utils[_0x484c('0xa7')](_0x747e9d[_0x484c('0x4b')][_0x484c('0xa2')])){throw new db[(_0x484c('0x96'))]['ValidationError']('Unknown\x20channel');}_0x576a13=_0x5b9c85;var _0x1f124d={};_0x1f124d[_0x484c('0x57')]=_[_0x484c('0x58')](db[_['capitalize'](_0x747e9d[_0x484c('0x4b')][_0x484c('0xa2')])+_0x484c('0xde')]['rawAttributes']);_0x1f124d[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x747e9d[_0x484c('0x4b')]);_0x1f124d[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x1f124d[_0x484c('0x57')],_0x1f124d['query']);_0x48adf7['attributes']=_[_0x484c('0x5a')](_0x1f124d[_0x484c('0x57')],qs[_0x484c('0x5b')](_0x747e9d[_0x484c('0x4b')][_0x484c('0x5b')]));_0x48adf7[_0x484c('0x48')]=_0x48adf7['attributes']['length']?_0x48adf7['attributes']:_0x1f124d[_0x484c('0x57')];_0x48adf7[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x747e9d[_0x484c('0x4b')][_0x484c('0xd4')]);_0x48adf7['where']=qs[_0x484c('0x59')](_['pick'](_0x747e9d['query'],_0x1f124d[_0x484c('0x59')]));if(_0x747e9d[_0x484c('0x4b')][_0x484c('0x34')]){_0x48adf7[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x48adf7['where'],{'$or':_[_0x484c('0x35')](_0x48adf7[_0x484c('0x48')],function(_0x8e46ee){var _0x4af654={};_0x4af654[_0x8e46ee]={'$like':'%'+_0x747e9d[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x4af654;})});}_0x48adf7=_['merge']({},_0x48adf7,_0x747e9d[_0x484c('0xd6')]);switch(_0x576a13[_0x484c('0x2f')]){case _0x484c('0x86'):return db[_[_0x484c('0xa9')](_0x747e9d[_0x484c('0x4b')][_0x484c('0xa2')])+_0x484c('0xde')]['findAll'](_0x48adf7);case _0x484c('0x31'):case _0x484c('0x75'):return _0x576a13[_0x484c('0x2e')+_[_0x484c('0xa9')](_0x747e9d[_0x484c('0x4b')][_0x484c('0xa2')])+'Queues'](_0x48adf7);default:throw new db[(_0x484c('0x96'))][(_0x484c('0x97'))](_0x484c('0xdf'));}})[_0x484c('0x16')](function(_0x2f5859){_0x5576eb=_0x2f5859['length'];if(!_0x747e9d[_0x484c('0x4b')][_0x484c('0xd7')](_0x484c('0xdc'))){_0x48adf7[_0x484c('0x27')]=qs['limit'](_0x747e9d[_0x484c('0x4b')][_0x484c('0x27')]);_0x48adf7['offset']=qs[_0x484c('0x24')](_0x747e9d[_0x484c('0x4b')][_0x484c('0x24')]);}switch(_0x576a13[_0x484c('0x2f')]){case'admin':return db[_[_0x484c('0xa9')](_0x747e9d[_0x484c('0x4b')][_0x484c('0xa2')])+_0x484c('0xde')][_0x484c('0x4a')](_0x48adf7);case _0x484c('0x31'):case _0x484c('0x75'):return _0x576a13[_0x484c('0x2e')+_[_0x484c('0xa9')](_0x747e9d['query'][_0x484c('0xa2')])+_0x484c('0xaa')](_0x48adf7);}})['then'](function(_0x29bd43){return{'count':_0x5576eb,'rows':_0x29bd43};})[_0x484c('0x16')](respondWithResult(_0x3c35db,null))[_0x484c('0x21')](handleError(_0x3c35db,null));};exports[_0x484c('0xe0')]=function(_0x34319f,_0x5aead2){var _0x52cd0a={};var _0x597991={};var _0x580447;var _0x2c3d9e;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x34319f['params']['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x5aead2,null))[_0x484c('0x16')](function(_0x5511ef){if(_0x5511ef){_0x580447=_0x5511ef;_0x597991['model']=_[_0x484c('0x58')](db['UserVoiceQueueRt']['rawAttributes']);_0x597991['query']=_[_0x484c('0x58')](_0x34319f['query']);_0x597991[_0x484c('0x59')]=_['intersection'](_0x597991[_0x484c('0x57')],_0x597991[_0x484c('0x4b')]);_0x52cd0a[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x597991[_0x484c('0x57')],qs[_0x484c('0x5b')](_0x34319f[_0x484c('0x4b')]['fields']));_0x52cd0a[_0x484c('0x48')]=_0x52cd0a[_0x484c('0x48')][_0x484c('0x4e')]?_0x52cd0a['attributes']:_0x597991[_0x484c('0x57')];_0x52cd0a[_0x484c('0xd3')]=qs['sort'](_0x34319f[_0x484c('0x4b')][_0x484c('0xd4')]);_0x52cd0a[_0x484c('0xd5')]=qs[_0x484c('0x59')](_['pick'](_0x34319f['query'],_0x597991[_0x484c('0x59')]));if(_0x34319f[_0x484c('0x4b')][_0x484c('0x34')]){_0x52cd0a[_0x484c('0xd5')]=_['merge'](_0x52cd0a[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x52cd0a[_0x484c('0x48')],function(_0x3e143b){var _0x561bba={};_0x561bba[_0x3e143b]={'$like':'%'+_0x34319f[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x561bba;})});}_0x52cd0a=_[_0x484c('0x5c')]({},_0x52cd0a,_0x34319f[_0x484c('0xd6')]);return _0x580447[_0x484c('0xe0')](_0x52cd0a);}})['then'](function(_0x20a595){if(_0x20a595){_0x2c3d9e=_0x20a595[_0x484c('0x4e')];if(!_0x34319f['query'][_0x484c('0xd7')](_0x484c('0xdc'))){_0x52cd0a[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x34319f['query'][_0x484c('0x27')]);_0x52cd0a['offset']=qs[_0x484c('0x24')](_0x34319f[_0x484c('0x4b')][_0x484c('0x24')]);}return _0x580447['getVoiceQueuesRt'](_0x52cd0a);}})['then'](function(_0x512798){if(_0x512798){return _0x512798?{'count':_0x2c3d9e,'rows':_0x512798}:null;}})[_0x484c('0x16')](respondWithResult(_0x5aead2,null))[_0x484c('0x21')](handleError(_0x5aead2,null));};exports[_0x484c('0xe1')]=function(_0x2a4144,_0x3d56d0){var _0x2d100e={};var _0x385d5b={};var _0x5b6186;var _0xa79488;return db[_0x484c('0x42')]['findOne']({'where':{'id':_0x2a4144['params']['id']}})['then'](handleEntityNotFound(_0x3d56d0,null))['then'](function(_0x4d45b7){if(_0x4d45b7){_0x5b6186=_0x4d45b7;_0x385d5b['model']=_[_0x484c('0x58')](db['ChatGroup'][_0x484c('0x3d')]);_0x385d5b[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x2a4144['query']);_0x385d5b[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x385d5b[_0x484c('0x57')],_0x385d5b[_0x484c('0x4b')]);_0x2d100e[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x385d5b[_0x484c('0x57')],qs[_0x484c('0x5b')](_0x2a4144[_0x484c('0x4b')][_0x484c('0x5b')]));_0x2d100e[_0x484c('0x48')]=_0x2d100e[_0x484c('0x48')][_0x484c('0x4e')]?_0x2d100e[_0x484c('0x48')]:_0x385d5b['model'];_0x2d100e['order']=qs['sort'](_0x2a4144[_0x484c('0x4b')][_0x484c('0xd4')]);_0x2d100e['where']=qs[_0x484c('0x59')](_[_0x484c('0xe2')](_0x2a4144['query'],_0x385d5b[_0x484c('0x59')]));if(_0x2a4144[_0x484c('0x4b')][_0x484c('0x34')]){_0x2d100e[_0x484c('0xd5')]=_['merge'](_0x2d100e[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x2d100e[_0x484c('0x48')],function(_0x29c419){var _0x10331d={};_0x10331d[_0x29c419]={'$like':'%'+_0x2a4144['query'][_0x484c('0x34')]+'%'};return _0x10331d;})});}_0x2d100e=_[_0x484c('0x5c')]({},_0x2d100e,_0x2a4144['options']);return _0x5b6186[_0x484c('0xe1')](_0x2d100e);}})[_0x484c('0x16')](function(_0x35d431){if(_0x35d431){_0xa79488=_0x35d431[_0x484c('0x4e')];if(!_0x2a4144[_0x484c('0x4b')][_0x484c('0xd7')](_0x484c('0xdc'))){_0x2d100e[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x2a4144[_0x484c('0x4b')][_0x484c('0x27')]);_0x2d100e[_0x484c('0x24')]=qs[_0x484c('0x24')](_0x2a4144[_0x484c('0x4b')][_0x484c('0x24')]);}return _0x5b6186[_0x484c('0xe1')](_0x2d100e);}})[_0x484c('0x16')](function(_0x28bfc2){if(_0x28bfc2){return _0x28bfc2?{'count':_0xa79488,'rows':_0x28bfc2}:null;}})[_0x484c('0x16')](respondWithResult(_0x3d56d0,null))[_0x484c('0x21')](handleError(_0x3d56d0,null));};exports[_0x484c('0xe3')]=function(_0x33a783,_0x91e254){var _0x5f1416={'raw':!![],'where':{}};var _0x1014f5={};var _0x2dab7f={'count':0x0,'rows':[]};return db['User'][_0x484c('0x9b')]({'where':{'id':_0x33a783[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x91e254,null))['then'](function(_0x52f3f8){if(_0x52f3f8){_0x1014f5[_0x484c('0x57')]=_[_0x484c('0x58')](db['VoiceRecording'][_0x484c('0x3d')]);_0x1014f5[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x33a783['query']);_0x1014f5[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x1014f5['model'],_0x1014f5[_0x484c('0x4b')]);_0x5f1416[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x1014f5[_0x484c('0x57')],qs[_0x484c('0x5b')](_0x33a783[_0x484c('0x4b')][_0x484c('0x5b')]));_0x5f1416[_0x484c('0x48')]=_0x5f1416[_0x484c('0x48')]['length']?_0x5f1416[_0x484c('0x48')]:_0x1014f5[_0x484c('0x57')];if(!_0x33a783[_0x484c('0x4b')]['hasOwnProperty'](_0x484c('0xdc'))){_0x5f1416['limit']=qs[_0x484c('0x27')](_0x33a783[_0x484c('0x4b')][_0x484c('0x27')]);_0x5f1416[_0x484c('0x24')]=qs['offset'](_0x33a783[_0x484c('0x4b')]['offset']);}_0x5f1416[_0x484c('0xd3')]=qs['sort'](_0x33a783[_0x484c('0x4b')][_0x484c('0xd4')]);_0x5f1416['where']=qs['filters'](_[_0x484c('0xe2')](_0x33a783['query'],_0x1014f5['filters']));_0x5f1416[_0x484c('0xd5')][_0x484c('0xe4')]=_0x52f3f8['id'];if(_0x33a783[_0x484c('0x4b')][_0x484c('0x34')]){_0x5f1416[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x5f1416[_0x484c('0xd5')],{'$or':_['map'](_0x5f1416['attributes'],function(_0x433690){var _0x1740d4={};_0x1740d4[_0x433690]={'$like':'%'+_0x33a783[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x1740d4;})});}_0x5f1416=_[_0x484c('0x5c')]({},_0x5f1416,_0x33a783[_0x484c('0xd6')]);return db[_0x484c('0xe5')][_0x484c('0x26')]({'where':_0x5f1416[_0x484c('0xd5')]})[_0x484c('0x16')](function(_0xc474ae){_0x2dab7f[_0x484c('0x26')]=_0xc474ae;if(_0x33a783[_0x484c('0x4b')][_0x484c('0x43')]){_0x5f1416[_0x484c('0x44')]=[{'all':!![]}];}return db[_0x484c('0xe5')]['findAll'](_0x5f1416);})['then'](function(_0x1b1d12){_0x2dab7f[_0x484c('0x4d')]=_0x1b1d12;return _0x2dab7f;});}})[_0x484c('0x16')](respondWithFilteredResult(_0x91e254,_0x5f1416))[_0x484c('0x21')](handleError(_0x91e254,null));};exports['getScreenRecordings']=function(_0x357c29,_0x5f243d){var _0x240e73={'raw':!![],'where':{}};var _0x2bf317={};var _0x15a447={'count':0x0,'rows':[]};return db[_0x484c('0x42')]['findOne']({'where':{'id':_0x357c29[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x5f243d,null))[_0x484c('0x16')](function(_0xc50913){if(_0xc50913){_0x2bf317['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x2bf317[_0x484c('0x4b')]=_['keys'](_0x357c29[_0x484c('0x4b')]);_0x2bf317['filters']=_[_0x484c('0x5a')](_0x2bf317[_0x484c('0x57')],_0x2bf317[_0x484c('0x4b')]);_0x240e73[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x2bf317['model'],qs[_0x484c('0x5b')](_0x357c29[_0x484c('0x4b')][_0x484c('0x5b')]));_0x240e73['attributes']=_0x240e73[_0x484c('0x48')][_0x484c('0x4e')]?_0x240e73[_0x484c('0x48')]:_0x2bf317['model'];if(!_0x357c29[_0x484c('0x4b')][_0x484c('0xd7')](_0x484c('0xdc'))){_0x240e73[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x357c29[_0x484c('0x4b')][_0x484c('0x27')]);_0x240e73[_0x484c('0x24')]=qs['offset'](_0x357c29[_0x484c('0x4b')][_0x484c('0x24')]);}_0x240e73[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x357c29[_0x484c('0x4b')]['sort']);_0x240e73[_0x484c('0xd5')]=qs[_0x484c('0x59')](_[_0x484c('0xe2')](_0x357c29[_0x484c('0x4b')],_0x2bf317['filters']));_0x240e73[_0x484c('0xd5')][_0x484c('0xe4')]=_0xc50913['id'];if(_0x357c29['query'][_0x484c('0x34')]){_0x240e73[_0x484c('0xd5')]=_['merge'](_0x240e73[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x240e73[_0x484c('0x48')],function(_0x59e617){var _0x488da1={};_0x488da1[_0x59e617]={'$like':'%'+_0x357c29[_0x484c('0x4b')]['filter']+'%'};return _0x488da1;})});}_0x240e73=_[_0x484c('0x5c')]({},_0x240e73,_0x357c29['options']);return db[_0x484c('0xe6')]['count']({'where':_0x240e73[_0x484c('0xd5')]})[_0x484c('0x16')](function(_0x4fb909){_0x15a447[_0x484c('0x26')]=_0x4fb909;if(_0x357c29['query'][_0x484c('0x43')]){_0x240e73[_0x484c('0x44')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x240e73);})[_0x484c('0x16')](function(_0x2b3db5){_0x15a447[_0x484c('0x4d')]=_0x2b3db5;return _0x15a447;});}})[_0x484c('0x16')](respondWithFilteredResult(_0x5f243d,_0x240e73))[_0x484c('0x21')](handleError(_0x5f243d,null));};exports[_0x484c('0xe7')]=function(_0x4caead,_0x121781){var _0x20f428={};var _0x14a9ed={};var _0x2dbb3c;var _0x460f5b;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x4caead[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x121781,null))['then'](function(_0x1ab228){if(_0x1ab228){_0x2dbb3c=_0x1ab228;_0x14a9ed[_0x484c('0x57')]=_[_0x484c('0x58')](db['ChatInteraction']['rawAttributes']);_0x14a9ed[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x4caead[_0x484c('0x4b')]);_0x14a9ed[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x14a9ed[_0x484c('0x57')],_0x14a9ed['query']);_0x20f428[_0x484c('0x48')]=_['intersection'](_0x14a9ed[_0x484c('0x57')],qs[_0x484c('0x5b')](_0x4caead['query'][_0x484c('0x5b')]));_0x20f428['attributes']=_0x20f428[_0x484c('0x48')][_0x484c('0x4e')]?_0x20f428[_0x484c('0x48')]:_0x14a9ed['model'];_0x20f428[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x4caead[_0x484c('0x4b')][_0x484c('0xd4')]);_0x20f428[_0x484c('0xd5')]=qs['filters'](_[_0x484c('0xe2')](_0x4caead[_0x484c('0x4b')],_0x14a9ed[_0x484c('0x59')]));if(_0x4caead[_0x484c('0x4b')]['filter']){_0x20f428[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x20f428['where'],{'$or':_[_0x484c('0x35')](_0x20f428[_0x484c('0x48')],function(_0x144586){var _0x110149={};_0x110149[_0x144586]={'$like':'%'+_0x4caead[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x110149;})});}_0x20f428=_[_0x484c('0x5c')]({},_0x20f428,_0x4caead[_0x484c('0xd6')]);return _0x2dbb3c[_0x484c('0xe7')](_0x20f428);}})[_0x484c('0x16')](function(_0x4a30ab){if(_0x4a30ab){_0x460f5b=_0x4a30ab['length'];if(!_0x4caead[_0x484c('0x4b')]['hasOwnProperty']('nolimit')){_0x20f428[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x4caead['query'][_0x484c('0x27')]);_0x20f428[_0x484c('0x24')]=qs[_0x484c('0x24')](_0x4caead['query'][_0x484c('0x24')]);}return _0x2dbb3c[_0x484c('0xe7')](_0x20f428);}})[_0x484c('0x16')](function(_0x5f1533){if(_0x5f1533){return _0x5f1533?{'count':_0x460f5b,'rows':_0x5f1533}:null;}})[_0x484c('0x16')](respondWithResult(_0x121781,null))[_0x484c('0x21')](handleError(_0x121781,null));};exports[_0x484c('0xe8')]=function(_0x348fab,_0xb296f5){var _0x49d337={};var _0x4a2dc6={};var _0x49b8df;var _0x4e0f6c;return db['User']['findOne']({'where':{'id':_0x348fab[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0xb296f5,null))[_0x484c('0x16')](function(_0x4bf024){if(_0x4bf024){_0x49b8df=_0x4bf024;_0x4a2dc6['model']=_['keys'](db[_0x484c('0xe9')][_0x484c('0x3d')]);_0x4a2dc6[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x348fab[_0x484c('0x4b')]);_0x4a2dc6[_0x484c('0x59')]=_['intersection'](_0x4a2dc6[_0x484c('0x57')],_0x4a2dc6[_0x484c('0x4b')]);_0x49d337[_0x484c('0x48')]=_['intersection'](_0x4a2dc6['model'],qs[_0x484c('0x5b')](_0x348fab[_0x484c('0x4b')][_0x484c('0x5b')]));_0x49d337[_0x484c('0x48')]=_0x49d337[_0x484c('0x48')][_0x484c('0x4e')]?_0x49d337[_0x484c('0x48')]:_0x4a2dc6[_0x484c('0x57')];_0x49d337[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x348fab[_0x484c('0x4b')][_0x484c('0xd4')]);_0x49d337['where']=qs[_0x484c('0x59')](_[_0x484c('0xe2')](_0x348fab[_0x484c('0x4b')],_0x4a2dc6[_0x484c('0x59')]));if(_0x348fab[_0x484c('0x4b')][_0x484c('0x34')]){_0x49d337[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x49d337[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x49d337[_0x484c('0x48')],function(_0x1c4398){var _0x5c7174={};_0x5c7174[_0x1c4398]={'$like':'%'+_0x348fab[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x5c7174;})});}_0x49d337=_['merge']({},_0x49d337,_0x348fab['options']);return _0x49b8df[_0x484c('0xe8')](_0x49d337);}})[_0x484c('0x16')](function(_0xa8353f){if(_0xa8353f){_0x4e0f6c=_0xa8353f[_0x484c('0x4e')];if(!_0x348fab[_0x484c('0x4b')][_0x484c('0xd7')](_0x484c('0xdc'))){_0x49d337[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x348fab[_0x484c('0x4b')][_0x484c('0x27')]);_0x49d337['offset']=qs[_0x484c('0x24')](_0x348fab['query'][_0x484c('0x24')]);}return _0x49b8df[_0x484c('0xe8')](_0x49d337);}})[_0x484c('0x16')](function(_0x246795){if(_0x246795){return _0x246795?{'count':_0x4e0f6c,'rows':_0x246795}:null;}})[_0x484c('0x16')](respondWithResult(_0xb296f5,null))[_0x484c('0x21')](handleError(_0xb296f5,null));};exports[_0x484c('0xea')]=function(_0x5823fc,_0x3448b2){var _0x4333ef={'raw':!![],'where':{}};var _0x2af5c0={};var _0xaf8d06={'count':0x0,'rows':[]};return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x5823fc[_0x484c('0x56')]['id']}})['then'](handleEntityNotFound(_0x3448b2,null))[_0x484c('0x16')](function(_0x4d4af3){if(_0x4d4af3){_0x2af5c0[_0x484c('0x57')]=_[_0x484c('0x58')](db[_0x484c('0xeb')][_0x484c('0x3d')]);_0x2af5c0[_0x484c('0x4b')]=_['keys'](_0x5823fc[_0x484c('0x4b')]);_0x2af5c0[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x2af5c0[_0x484c('0x57')],_0x2af5c0[_0x484c('0x4b')]);_0x4333ef[_0x484c('0x48')]=_['intersection'](_0x2af5c0[_0x484c('0x57')],qs['fields'](_0x5823fc[_0x484c('0x4b')][_0x484c('0x5b')]));_0x4333ef[_0x484c('0x48')]=_0x4333ef[_0x484c('0x48')]['length']?_0x4333ef[_0x484c('0x48')]:_0x2af5c0[_0x484c('0x57')];if(!_0x5823fc[_0x484c('0x4b')][_0x484c('0xd7')]('nolimit')){_0x4333ef[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x5823fc[_0x484c('0x4b')]['limit']);_0x4333ef[_0x484c('0x24')]=qs[_0x484c('0x24')](_0x5823fc[_0x484c('0x4b')][_0x484c('0x24')]);}_0x4333ef[_0x484c('0xd3')]=qs['sort'](_0x5823fc[_0x484c('0x4b')][_0x484c('0xd4')]);_0x4333ef['where']=qs[_0x484c('0x59')](_[_0x484c('0xe2')](_0x5823fc[_0x484c('0x4b')],_0x2af5c0[_0x484c('0x59')]));_0x4333ef[_0x484c('0xd5')][_0x484c('0xe4')]=_0x4d4af3['id'];if(_0x5823fc[_0x484c('0x4b')]['filter']){_0x4333ef['where']=_[_0x484c('0x5c')](_0x4333ef['where'],{'$or':_[_0x484c('0x35')](_0x4333ef[_0x484c('0x48')],function(_0x248ddb){var _0xeadc9e={};_0xeadc9e[_0x248ddb]={'$like':'%'+_0x5823fc[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0xeadc9e;})});}_0x4333ef=_[_0x484c('0x5c')]({},_0x4333ef,_0x5823fc[_0x484c('0xd6')]);return db[_0x484c('0xeb')][_0x484c('0x26')]({'where':_0x4333ef[_0x484c('0xd5')]})['then'](function(_0x5caa95){_0xaf8d06[_0x484c('0x26')]=_0x5caa95;if(_0x5823fc['query'][_0x484c('0x43')]){_0x4333ef[_0x484c('0x44')]=[{'all':!![]}];}return db[_0x484c('0xeb')][_0x484c('0x4a')](_0x4333ef);})[_0x484c('0x16')](function(_0x4014bf){_0xaf8d06['rows']=_0x4014bf;return _0xaf8d06;});}})[_0x484c('0x16')](respondWithFilteredResult(_0x3448b2,_0x4333ef))['catch'](handleError(_0x3448b2,null));};exports['getSmsInteractions']=function(_0x124925,_0x3a1aa0){var _0x16602a={};var _0x1c6e6a={};var _0x248123;var _0x35e6d5;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x124925[_0x484c('0x56')]['id']}})['then'](handleEntityNotFound(_0x3a1aa0,null))['then'](function(_0x5f55b4){if(_0x5f55b4){_0x248123=_0x5f55b4;_0x1c6e6a[_0x484c('0x57')]=_['keys'](db[_0x484c('0xec')][_0x484c('0x3d')]);_0x1c6e6a[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x124925[_0x484c('0x4b')]);_0x1c6e6a[_0x484c('0x59')]=_['intersection'](_0x1c6e6a['model'],_0x1c6e6a[_0x484c('0x4b')]);_0x16602a['attributes']=_['intersection'](_0x1c6e6a[_0x484c('0x57')],qs[_0x484c('0x5b')](_0x124925[_0x484c('0x4b')]['fields']));_0x16602a[_0x484c('0x48')]=_0x16602a[_0x484c('0x48')][_0x484c('0x4e')]?_0x16602a[_0x484c('0x48')]:_0x1c6e6a['model'];_0x16602a[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x124925[_0x484c('0x4b')][_0x484c('0xd4')]);_0x16602a[_0x484c('0xd5')]=qs['filters'](_[_0x484c('0xe2')](_0x124925[_0x484c('0x4b')],_0x1c6e6a[_0x484c('0x59')]));if(_0x124925['query'][_0x484c('0x34')]){_0x16602a[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x16602a[_0x484c('0xd5')],{'$or':_['map'](_0x16602a[_0x484c('0x48')],function(_0x147e56){var _0x526084={};_0x526084[_0x147e56]={'$like':'%'+_0x124925[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x526084;})});}_0x16602a=_['merge']({},_0x16602a,_0x124925[_0x484c('0xd6')]);return _0x248123[_0x484c('0xed')](_0x16602a);}})[_0x484c('0x16')](function(_0xad6184){if(_0xad6184){_0x35e6d5=_0xad6184[_0x484c('0x4e')];if(!_0x124925[_0x484c('0x4b')][_0x484c('0xd7')]('nolimit')){_0x16602a[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x124925[_0x484c('0x4b')][_0x484c('0x27')]);_0x16602a[_0x484c('0x24')]=qs[_0x484c('0x24')](_0x124925[_0x484c('0x4b')][_0x484c('0x24')]);}return _0x248123['getSmsInteractions'](_0x16602a);}})['then'](function(_0x501047){if(_0x501047){return _0x501047?{'count':_0x35e6d5,'rows':_0x501047}:null;}})['then'](respondWithResult(_0x3a1aa0,null))[_0x484c('0x21')](handleError(_0x3a1aa0,null));};exports[_0x484c('0xee')]=function(_0x279485,_0x4201d6){var _0x1b797f={};var _0x308626={};var _0x2f0337;var _0x1b4b8c;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x279485[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x4201d6,null))[_0x484c('0x16')](function(_0x3c0414){if(_0x3c0414){_0x2f0337=_0x3c0414;_0x308626[_0x484c('0x57')]=_['keys'](db['FaxInteraction'][_0x484c('0x3d')]);_0x308626[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x279485[_0x484c('0x4b')]);_0x308626[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x308626[_0x484c('0x57')],_0x308626[_0x484c('0x4b')]);_0x1b797f[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x308626['model'],qs[_0x484c('0x5b')](_0x279485[_0x484c('0x4b')][_0x484c('0x5b')]));_0x1b797f[_0x484c('0x48')]=_0x1b797f[_0x484c('0x48')]['length']?_0x1b797f[_0x484c('0x48')]:_0x308626['model'];_0x1b797f[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x279485[_0x484c('0x4b')][_0x484c('0xd4')]);_0x1b797f['where']=qs[_0x484c('0x59')](_['pick'](_0x279485[_0x484c('0x4b')],_0x308626['filters']));if(_0x279485[_0x484c('0x4b')][_0x484c('0x34')]){_0x1b797f['where']=_[_0x484c('0x5c')](_0x1b797f[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x1b797f[_0x484c('0x48')],function(_0x27a34d){var _0x151ee9={};_0x151ee9[_0x27a34d]={'$like':'%'+_0x279485[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x151ee9;})});}_0x1b797f=_[_0x484c('0x5c')]({},_0x1b797f,_0x279485['options']);return _0x2f0337[_0x484c('0xee')](_0x1b797f);}})[_0x484c('0x16')](function(_0x10fd62){if(_0x10fd62){_0x1b4b8c=_0x10fd62[_0x484c('0x4e')];if(!_0x279485[_0x484c('0x4b')]['hasOwnProperty'](_0x484c('0xdc'))){_0x1b797f[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x279485['query'][_0x484c('0x27')]);_0x1b797f[_0x484c('0x24')]=qs[_0x484c('0x24')](_0x279485[_0x484c('0x4b')][_0x484c('0x24')]);}return _0x2f0337[_0x484c('0xee')](_0x1b797f);}})[_0x484c('0x16')](function(_0x1a9eab){if(_0x1a9eab){return _0x1a9eab?{'count':_0x1b4b8c,'rows':_0x1a9eab}:null;}})[_0x484c('0x16')](respondWithResult(_0x4201d6,null))[_0x484c('0x21')](handleError(_0x4201d6,null));};exports['getWhatsappInteractions']=function(_0x4263bd,_0xeaac2a){var _0x498f6a={};var _0x57a82f={};var _0x4420c7;var _0x2a5f55;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x4263bd[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0xeaac2a,null))[_0x484c('0x16')](function(_0x1e7ea7){if(_0x1e7ea7){_0x4420c7=_0x1e7ea7;_0x57a82f[_0x484c('0x57')]=_['keys'](db[_0x484c('0xef')][_0x484c('0x3d')]);_0x57a82f['query']=_['keys'](_0x4263bd['query']);_0x57a82f[_0x484c('0x59')]=_['intersection'](_0x57a82f['model'],_0x57a82f[_0x484c('0x4b')]);_0x498f6a[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x57a82f['model'],qs['fields'](_0x4263bd[_0x484c('0x4b')][_0x484c('0x5b')]));_0x498f6a['attributes']=_0x498f6a['attributes'][_0x484c('0x4e')]?_0x498f6a[_0x484c('0x48')]:_0x57a82f[_0x484c('0x57')];_0x498f6a[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x4263bd[_0x484c('0x4b')][_0x484c('0xd4')]);_0x498f6a[_0x484c('0xd5')]=qs[_0x484c('0x59')](_['pick'](_0x4263bd[_0x484c('0x4b')],_0x57a82f[_0x484c('0x59')]));if(_0x4263bd[_0x484c('0x4b')][_0x484c('0x34')]){_0x498f6a[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x498f6a[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x498f6a[_0x484c('0x48')],function(_0x3b0eee){var _0xec3fe9={};_0xec3fe9[_0x3b0eee]={'$like':'%'+_0x4263bd[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0xec3fe9;})});}_0x498f6a=_[_0x484c('0x5c')]({},_0x498f6a,_0x4263bd[_0x484c('0xd6')]);return _0x4420c7[_0x484c('0xf0')](_0x498f6a);}})['then'](function(_0x47c24a){if(_0x47c24a){_0x2a5f55=_0x47c24a[_0x484c('0x4e')];if(!_0x4263bd[_0x484c('0x4b')][_0x484c('0xd7')](_0x484c('0xdc'))){_0x498f6a[_0x484c('0x27')]=qs[_0x484c('0x27')](_0x4263bd[_0x484c('0x4b')][_0x484c('0x27')]);_0x498f6a[_0x484c('0x24')]=qs[_0x484c('0x24')](_0x4263bd['query'][_0x484c('0x24')]);}return _0x4420c7[_0x484c('0xf0')](_0x498f6a);}})[_0x484c('0x16')](function(_0xf8d5af){if(_0xf8d5af){return _0xf8d5af?{'count':_0x2a5f55,'rows':_0xf8d5af}:null;}})[_0x484c('0x16')](respondWithResult(_0xeaac2a,null))[_0x484c('0x21')](handleError(_0xeaac2a,null));};exports[_0x484c('0xf1')]=function(_0x52132a,_0x593499,_0x41ad00){var _0x4e36c2;var _0x308777;var _0x37f0ef;var _0x3cb966=!_[_0x484c('0x6a')](_0x52132a[_0x484c('0x56')]['id'])?_0x52132a[_0x484c('0x56')]['id']:!_['isNil'](_0x52132a[_0x484c('0x31')]['id'])?_0x52132a['user']['id']:null;return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x3cb966,'role':{'$or':['admin',_0x484c('0x31'),_0x484c('0x75')]}},'attributes':['id',_0x484c('0x3a'),'phone',_0x484c('0xf2'),_0x484c('0x2f'),'internal',_0x484c('0xa4')]})[_0x484c('0x16')](function(_0x21ac60){if(_0x21ac60){if(_0x21ac60['role']===_0x484c('0x75')){_0x4e36c2=_0x21ac60;if(_0x52132a[_0x484c('0x60')][_0x484c('0xa6')]){_0x37f0ef=util[_0x484c('0xae')](_0x484c('0xf3'),_0x4e36c2[_0x52132a[_0x484c('0x60')]['interface']]);}else if(_0x52132a['body'][_0x484c('0xf4')]){_0x37f0ef=util[_0x484c('0xae')](_0x484c('0xaf'),_0x52132a['body']['intrf']);}else{_0x37f0ef=util[_0x484c('0xae')](_0x484c('0xaf'),_0x4e36c2['name']);}socket['to'](util[_0x484c('0xae')]('user:%s',_0x4e36c2[_0x484c('0x3a')]))[_0x484c('0x2b')]('user:forcelogout',{'user':{'id':_0x4e36c2['id'],'name':_0x4e36c2['name']},'ip':_0x52132a[_0x484c('0xf5')]['x-forwarded-for']||_0x52132a[_0x484c('0xf6')][_0x484c('0xf7')]||_0x52132a[_0x484c('0xf8')][_0x484c('0xf7')]||_0x52132a[_0x484c('0xf6')][_0x484c('0xf8')][_0x484c('0xf7')]});return db[_0x484c('0xb1')][_0x484c('0x2d')]({'where':{'membername':_0x4e36c2[_0x484c('0x3a')]},'individualHooks':!![]});}}else{throw new db[(_0x484c('0x96'))][(_0x484c('0x97'))](_0x484c('0xf9'));}})[_0x484c('0x16')](function(){if(_0x4e36c2){return _0x4e36c2[_0x484c('0xfa')]({'raw':!![]});}})[_0x484c('0x16')](function(_0x960bc2){if(_0x4e36c2){if(_0x960bc2){_0x308777=_0x960bc2;if(_0x308777[_0x484c('0x4e')]){var _0xc5b970=_0x308777[_0x484c('0x35')](function(_0xea421d){var _0x5437ef={'membername':_0x4e36c2['name'],'UserId':_0x4e36c2['id'],'queue_name':_0xea421d['name'],'VoiceQueueId':_0xea421d['id'],'interface':_0x37f0ef,'paused':_0x4e36c2[_0x484c('0xa4')]||![],'penalty':_0xea421d['UserVoiceQueue.penalty']||0x0};return db[_0x484c('0xb1')][_0x484c('0xb2')](_0x5437ef);});return Promise[_0x484c('0x5e')](_0xc5b970);}}}})[_0x484c('0x16')](function(){if(_0x4e36c2){return db[_0x484c('0xfb')][_0x484c('0x4a')]({'where':{'membername':_0x4e36c2['name'],'exitAt':null}});}})[_0x484c('0x16')](function(_0x490181){if(_0x4e36c2){var _0x114c53=[];_0x490181[_0x484c('0xfc')](function(_0x4842b7){_0x114c53[_0x484c('0x49')](_0x4842b7['update']({'exitAt':moment()[_0x484c('0xae')](_0x484c('0xfd'))}));});return Promise[_0x484c('0x5e')](_0x114c53);}})['then'](function(){if(_0x4e36c2){var _0x35f0cd=[];var _0x432fbe=[];var _0x55eebb=utils[_0x484c('0xfe')]();var _0x25dd3d={'membername':_0x4e36c2[_0x484c('0x3a')],'interface':_0x37f0ef,'enterAt':moment()['format'](_0x484c('0xfd')),'role':_0x4e36c2['role'],'internal':_0x4e36c2[_0x484c('0x69')]};_0x55eebb['forEach'](function(_0x614ac){_0x35f0cd[_0x484c('0x49')](_[_0x484c('0x5c')]({'channel':_0x614ac,'type':_0x484c('0xff'),'data1':_0x52132a[_0x484c('0x60')]['device'],'data2':_0x37f0ef},_0x25dd3d));if(_0x4e36c2[_0x484c('0xa4')]){_0x432fbe[_0x484c('0x49')](_[_0x484c('0x5c')]({'channel':_0x614ac,'type':_0x484c('0x100'),'data1':_0x484c('0x101')},_0x25dd3d));}});return db[_0x484c('0xfb')][_0x484c('0x102')](_0x35f0cd[_0x484c('0x103')](_0x432fbe),{'individualHooks':!![]});}})['then'](function(){if(_0x4e36c2){return _0x4e36c2[_0x484c('0x5f')]({'online':!![],'lastLoginAt':moment()[_0x484c('0xae')](_0x484c('0xfd')),'voicePause':_0x4e36c2[_0x484c('0xa4')]||![],'mailPause':_0x4e36c2['loginInPause']||![],'chatPause':_0x4e36c2[_0x484c('0xa4')]||![],'faxPause':_0x4e36c2[_0x484c('0xa4')]||![],'smsPause':_0x4e36c2[_0x484c('0xa4')]||![],'openchannelPause':_0x4e36c2[_0x484c('0xa4')]||![],'whatsappPause':_0x4e36c2[_0x484c('0xa4')]||![],'pauseType':_0x4e36c2[_0x484c('0xa4')]?_0x484c('0x101'):null,'interface':_0x37f0ef,'lastPauseAt':moment()['format'](_0x484c('0xfd'))});}})[_0x484c('0x16')](function(_0x31a1cc){if(_0x52132a[_0x484c('0x104')]){return _0x41ad00();}else{return Promise[_0x484c('0x105')](_0x31a1cc)['then'](respondWithResult(_0x593499,null));}})[_0x484c('0x21')](handleError(_0x593499,null));};exports[_0x484c('0x106')]=function(_0x379c5f,_0x5136a2){var _0x4dcf49;return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x379c5f['params']['id'],'role':_0x484c('0x75')},'attributes':['id',_0x484c('0x3a'),_0x484c('0x2f')]})['then'](handleEntityNotFound(_0x5136a2,null))[_0x484c('0x16')](function(_0x2c3962){if(_0x2c3962){_0x4dcf49=_0x2c3962;return db[_0x484c('0xb1')][_0x484c('0x2d')]({'where':{'membername':_0x4dcf49['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x484c('0xfb')][_0x484c('0x4a')]({'where':{'membername':_0x4dcf49['name'],'exitAt':null}});})[_0x484c('0x16')](function(_0x56fad0){var _0x3aeefe=[];_0x56fad0[_0x484c('0xfc')](function(_0x402a78){_0x3aeefe[_0x484c('0x49')](_0x402a78[_0x484c('0x5f')]({'exitAt':moment()[_0x484c('0xae')](_0x484c('0xfd'))}));});return Promise[_0x484c('0x5e')](_0x3aeefe);})[_0x484c('0x16')](function(){return _0x4dcf49[_0x484c('0x5f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x484c('0x16')](respondWithResult(_0x5136a2,null))[_0x484c('0x21')](handleError(_0x5136a2,null));};exports['pause']=function(_0x262267,_0x138484){var _0x3ea141;return db['UserVoiceQueueRt'][_0x484c('0x5f')]({'paused':0x1},{'where':{'UserId':_0x262267[_0x484c('0x56')]['id']},'individualHooks':!![]})[_0x484c('0x16')](function(){return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x262267[_0x484c('0x56')]['id'],'role':_0x484c('0x75')},'attributes':['id',_0x484c('0x3a'),_0x484c('0x2f'),_0x484c('0x69'),_0x484c('0xa6'),'online']});})[_0x484c('0x16')](handleEntityNotFound(_0x138484,null))[_0x484c('0x16')](function(_0x53ace5){if(_0x53ace5){_0x3ea141=_0x53ace5;return respondWithRpcPromise(_0x484c('0x107'),_0x484c('0x108'),{'id':_0x3ea141['id'],'name':_0x3ea141[_0x484c('0x3a')],'pause':!![]});}})[_0x484c('0x16')](function(){if(_0x3ea141){return db[_0x484c('0xfb')][_0x484c('0x4a')]({'where':{'membername':_0x3ea141[_0x484c('0x3a')],'type':'PAUSE','exitAt':null}});}})[_0x484c('0x16')](function(_0x1c9f72){if(_0x1c9f72[_0x484c('0x4e')]){var _0x10fab4=moment()[_0x484c('0xae')](_0x484c('0xfd'));for(var _0x1e7c1b=0x0,_0x212372=_0x1c9f72[_0x484c('0x4e')];_0x1e7c1b<_0x212372;_0x1e7c1b++){_0x1c9f72[_0x1e7c1b][_0x484c('0x109')]({'exitAt':_0x10fab4});}}})['then'](function(){var _0x2e53c6=[];var _0x23c37f=utils['getChannels']();_0x23c37f[_0x484c('0xfc')](function(_0x295efe){_0x2e53c6['push']({'channel':_0x295efe,'membername':_0x3ea141[_0x484c('0x3a')],'interface':_[_0x484c('0x6a')](_0x3ea141[_0x484c('0xa6')])?util['format'](_0x484c('0xaf'),_0x3ea141[_0x484c('0x3a')]):_0x3ea141['interface'],'type':_0x484c('0x100'),'enterAt':moment()[_0x484c('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x262267[_0x484c('0x60')]['type']||'DEFAULT\x20PAUSE','role':_0x3ea141[_0x484c('0x2f')],'internal':_0x3ea141[_0x484c('0x69')]});});return db['MemberReport'][_0x484c('0x102')](_0x2e53c6,{'individualHooks':!![]});})[_0x484c('0x16')](function(){return _0x3ea141['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x262267['body'][_0x484c('0x3e')]||_0x484c('0x10a'),'lastPauseAt':moment()[_0x484c('0xae')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x484c('0x16')](respondWithResult(_0x138484,null))['catch'](handleError(_0x138484,null));};exports[_0x484c('0x10b')]=function(_0x348266,_0x3405cc){if(_0x348266[_0x484c('0x60')][_0x484c('0xa2')]&&!utils[_0x484c('0xa7')](_0x348266[_0x484c('0x60')][_0x484c('0xa2')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x348266[_0x484c('0x60')][_0x484c('0xa2')]));}return db[_0x484c('0x42')][_0x484c('0x37')]({'where':{'id':_0x348266[_0x484c('0x56')]['id']},'attributes':['id','name','role',_0x484c('0x69'),_0x484c('0xa6'),'online',_0x484c('0xa5'),_0x484c('0x10c'),_0x484c('0x10d'),_0x484c('0x10e'),_0x484c('0x10f'),_0x484c('0x110'),_0x484c('0x111'),_0x484c('0x112'),_0x484c('0x113')]})[_0x484c('0x16')](function(_0x152a12){if(!_0x152a12){throw new APINotFoundError(util[_0x484c('0xae')]('User\x20with\x20id\x20%s\x20not\x20found',_0x348266['params']['id']));}return _0x152a12[_0x484c('0x10b')](_0x348266[_0x484c('0x60')][_0x484c('0xa2')]);})[_0x484c('0x16')](respondWithResult(_0x3405cc,null))[_0x484c('0x21')](APIHandleError(_0x3405cc));};exports['getTeams']=function(_0x31ea8e,_0x14c0ed){var _0x118d94={};var _0x304403={};var _0x4c4a3a;var _0x5e33fd;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x31ea8e['params']['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x14c0ed,null))[_0x484c('0x16')](function(_0x14306e){if(_0x14306e){_0x4c4a3a=_0x14306e;_0x304403[_0x484c('0x57')]=_[_0x484c('0x58')](db[_0x484c('0x114')][_0x484c('0x3d')]);_0x304403[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x31ea8e['query']);_0x304403[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x304403[_0x484c('0x57')],_0x304403[_0x484c('0x4b')]);_0x118d94[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x304403[_0x484c('0x57')],qs['fields'](_0x31ea8e[_0x484c('0x4b')]['fields']));_0x118d94[_0x484c('0x48')]=_0x118d94[_0x484c('0x48')][_0x484c('0x4e')]?_0x118d94['attributes']:_0x304403['model'];_0x118d94['order']=qs[_0x484c('0xd4')](_0x31ea8e[_0x484c('0x4b')][_0x484c('0xd4')]);_0x118d94[_0x484c('0xd5')]=qs[_0x484c('0x59')](_[_0x484c('0xe2')](_0x31ea8e['query'],_0x304403['filters']));if(_0x31ea8e[_0x484c('0x4b')]['filter']){_0x118d94[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x118d94[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x118d94[_0x484c('0x48')],function(_0x34f4c2){var _0x2ac600={};_0x2ac600[_0x34f4c2]={'$like':'%'+_0x31ea8e['query']['filter']+'%'};return _0x2ac600;})});}_0x118d94=_['merge']({},_0x118d94,_0x31ea8e[_0x484c('0xd6')]);return _0x4c4a3a['getTeams'](_0x118d94);}})[_0x484c('0x16')](function(_0x2b1c72){if(_0x2b1c72){_0x5e33fd=_0x2b1c72[_0x484c('0x4e')];if(!_0x31ea8e[_0x484c('0x4b')]['hasOwnProperty']('nolimit')){_0x118d94[_0x484c('0x27')]=qs['limit'](_0x31ea8e[_0x484c('0x4b')][_0x484c('0x27')]);_0x118d94['offset']=qs['offset'](_0x31ea8e[_0x484c('0x4b')]['offset']);}return _0x4c4a3a['getTeams'](_0x118d94);}})[_0x484c('0x16')](function(_0x5e4a53){if(_0x5e4a53){return _0x5e4a53?{'count':_0x5e33fd,'rows':_0x5e4a53}:null;}})[_0x484c('0x16')](respondWithResult(_0x14c0ed,null))['catch'](handleError(_0x14c0ed,null));};exports[_0x484c('0x115')]=function(_0x14c9e0,_0x775968){var _0x52df89=_0x14c9e0[_0x484c('0x56')]['id'];var _0x204cf1=_0x14c9e0[_0x484c('0x60')]?_0x14c9e0[_0x484c('0x60')]['ids']:null;var _0x82afc1=[];return Promise[_0x484c('0x105')]()[_0x484c('0x16')](function(){if(!_0x204cf1)throw new APIBadRequestError(_0x484c('0x116'));})[_0x484c('0x16')](function(){return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x52df89}});})[_0x484c('0x16')](function(_0x5a2fb6){if(!_0x5a2fb6)throw new APINotFoundError(util[_0x484c('0xae')](_0x484c('0x117'),_0x14c9e0[_0x484c('0x56')]['id']));return db[_0x484c('0x6c')]['transaction'](function(_0x3a99ff){return _0x5a2fb6[_0x484c('0x115')](_0x204cf1,{'transaction':_0x3a99ff})[_0x484c('0x16')](function(){return db[_0x484c('0x114')]['findAll']({'where':{'id':{'$in':_0x204cf1}}});})[_0x484c('0x16')](function(_0x42f784){var _0x27e508=_[_0x484c('0x35')](_0x42f784,function(_0x568cc4){return _0x568cc4[_0x484c('0x118')]();});return Promise[_0x484c('0x5e')](_0x27e508);})[_0x484c('0x16')](function(_0x3c4966){_0x82afc1=_[_0x484c('0x119')](_0x3c4966);var _0x57ac09=_['map'](_0x82afc1,function(_0x4e26d6){return _0x4e26d6[_0x484c('0x11a')](_0x5a2fb6['id'],{'transaction':_0x3a99ff});});return Promise['all'](_0x57ac09);})[_0x484c('0x16')](function(){if(!_0x5a2fb6['online'])return;var _0x41d802=_[_0x484c('0x34')](_0x82afc1,function(_0x28f90d){return _0x28f90d[_0x484c('0x11b')](_0x484c('0xa2'))==='Voice';});var _0xe6d832=_[_0x484c('0x35')](_0x41d802,function(_0x25bbf7){return db[_0x484c('0xb1')][_0x484c('0xb2')]({'membername':_0x5a2fb6[_0x484c('0x3a')],'UserId':_0x5a2fb6['id'],'queue_name':_0x25bbf7[_0x484c('0x3a')],'VoiceQueueId':_0x25bbf7['id'],'interface':_[_0x484c('0x6a')](_0x5a2fb6['interface'])?util['format']('SIP/%s',_0x5a2fb6[_0x484c('0x3a')]):_0x5a2fb6[_0x484c('0xa6')],'paused':_0x5a2fb6[_0x484c('0xa5')]||![],'penalty':_0x5a2fb6['penalty']},{'transaction':_0x3a99ff});});return Promise[_0x484c('0x5e')](_0xe6d832);})[_0x484c('0x16')](function(){return db['TeamVoicePrefix'][_0x484c('0x4a')]({'where':{'teamId':{'$in':_0x204cf1}}});})['then'](function(_0x11a11a){var _0x555a82=_['map'](_0x11a11a,function(_0x284891){return db['UserVoicePrefix'][_0x484c('0x84')]({'UserId':_0x5a2fb6['id'],'VoicePrefixId':_0x284891[_0x484c('0x11c')]},{'transaction':_0x3a99ff});});return Promise[_0x484c('0x5e')](_0x555a82);});});})[_0x484c('0x16')](function(){for(var _0x4e4124=0x0;_0x4e4124<_0x82afc1[_0x484c('0x4e')];_0x4e4124++){var _0x3f5d6f=_0x82afc1[_0x4e4124][_0x484c('0x11b')](_0x484c('0xa2'));var _0x17355b=_0x3f5d6f+_0x484c('0xb8');socket[_0x484c('0x2b')](_0x484c('0x31')+_0x3f5d6f+_0x484c('0x11d'),{'UserId':_0x52df89,['queueField']:_0x82afc1[_0x4e4124]['id']});}})[_0x484c('0x16')](respondWithStatusCode(_0x775968,null))['catch'](APIHandleError(_0x775968));};exports[_0x484c('0x11e')]=function(_0x3f9141,_0x5c009b){var _0x51c2e4=_0x3f9141[_0x484c('0x56')]['id'];var _0x559b6a=null;if(_0x3f9141[_0x484c('0x4b')][_0x484c('0x63')]){_0x559b6a=_[_0x484c('0xb7')](_0x3f9141[_0x484c('0x4b')][_0x484c('0x63')])?_0x3f9141[_0x484c('0x4b')]['ids']:[_0x3f9141['query'][_0x484c('0x63')]];}var _0x2421ab=[];return Promise[_0x484c('0x105')]()[_0x484c('0x16')](function(){if(!_0x559b6a)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x484c('0x16')](function(){return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x51c2e4}});})['then'](function(_0x388a71){if(!_0x388a71)throw new APINotFoundError(util['format'](_0x484c('0x117'),_0x3f9141['params']['id']));return db[_0x484c('0x6c')][_0x484c('0x11f')](function(_0x5155ac){return _0x388a71['removeTeams'](_0x559b6a,{'transaction':_0x5155ac})['then'](function(){return db[_0x484c('0x114')][_0x484c('0x4a')]({'where':{'id':{'$in':_0x559b6a}}});})[_0x484c('0x16')](function(_0x429e8e){var _0x3f6fc6=_[_0x484c('0x35')](_0x429e8e,function(_0x9d5e18){return _0x9d5e18[_0x484c('0x118')]();});return Promise[_0x484c('0x5e')](_0x3f6fc6);})[_0x484c('0x16')](function(_0x4b88ca){_0x2421ab=_[_0x484c('0x119')](_0x4b88ca);var _0xa3226d=_[_0x484c('0x35')](_0x2421ab,function(_0x340119){return _0x340119[_0x484c('0x120')](_0x388a71['id'],{'transaction':_0x5155ac});});return Promise[_0x484c('0x5e')](_0xa3226d);})[_0x484c('0x16')](function(){if(!_0x388a71[_0x484c('0xa3')])return;var _0x56e005=_['filter'](_0x2421ab,function(_0x3d411c){return _0x3d411c[_0x484c('0x11b')](_0x484c('0xa2'))===_0x484c('0x121');});var _0x1c5dfa=_[_0x484c('0x35')](_0x56e005,function(_0x309940){return db['UserVoiceQueueRt'][_0x484c('0x2d')]({'where':{'VoiceQueueId':_0x309940['id'],'UserId':_0x388a71['id']},'transaction':_0x5155ac});});return Promise[_0x484c('0x5e')](_0x1c5dfa);})['then'](function(){return db[_0x484c('0x122')][_0x484c('0x4a')]({'where':{'teamId':{'$in':_0x559b6a}}});})['then'](function(_0x19066f){var _0x486ec1=_[_0x484c('0x35')](_0x19066f,function(_0x4498e4){return db[_0x484c('0x123')][_0x484c('0x2d')]({'where':{'UserId':_0x388a71['id'],'VoicePrefixId':_0x4498e4[_0x484c('0x11c')]}},{'transaction':_0x5155ac});});return Promise['all'](_0x486ec1);});});})['then'](function(){for(var _0x2588d2=0x0;_0x2588d2<_0x2421ab[_0x484c('0x4e')];_0x2588d2++){var _0x1702ab=_0x2421ab[_0x2588d2][_0x484c('0x11b')]('channel');var _0x52b155=_0x1702ab+_0x484c('0xb8');socket[_0x484c('0x2b')](_0x484c('0x31')+_0x1702ab+_0x484c('0x124'),{'UserId':_0x51c2e4,['queueField']:_0x2421ab[_0x2588d2]['id']});}})[_0x484c('0x16')](respondWithStatusCode(_0x5c009b,null))[_0x484c('0x21')](APIHandleError(_0x5c009b));};exports['getLists']=function(_0xb9ba06,_0x58da80){var _0x16c028={};var _0x40d2d7={};var _0x4a12b2;var _0x271b63;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0xb9ba06[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x58da80,null))[_0x484c('0x16')](function(_0x3378a7){if(_0x3378a7){_0x4a12b2=_0x3378a7;_0x40d2d7[_0x484c('0x57')]=_['keys'](db[_0x484c('0xd8')][_0x484c('0x3d')]);_0x40d2d7[_0x484c('0x4b')]=_[_0x484c('0x58')](_0xb9ba06['query']);_0x40d2d7['filters']=_[_0x484c('0x5a')](_0x40d2d7[_0x484c('0x57')],_0x40d2d7[_0x484c('0x4b')]);_0x16c028[_0x484c('0x48')]=_[_0x484c('0x5a')](_0x40d2d7[_0x484c('0x57')],qs[_0x484c('0x5b')](_0xb9ba06[_0x484c('0x4b')][_0x484c('0x5b')]));_0x16c028[_0x484c('0x48')]=_0x16c028[_0x484c('0x48')][_0x484c('0x4e')]?_0x16c028['attributes']:_0x40d2d7[_0x484c('0x57')];_0x16c028['order']=qs['sort'](_0xb9ba06[_0x484c('0x4b')][_0x484c('0xd4')]);_0x16c028[_0x484c('0xd5')]=qs[_0x484c('0x59')](_['pick'](_0xb9ba06[_0x484c('0x4b')],_0x40d2d7[_0x484c('0x59')]));if(_0xb9ba06[_0x484c('0x4b')][_0x484c('0x34')]){_0x16c028[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x16c028[_0x484c('0xd5')],{'$or':_[_0x484c('0x35')](_0x16c028['attributes'],function(_0x2372ce){var _0x32f704={};_0x32f704[_0x2372ce]={'$like':'%'+_0xb9ba06[_0x484c('0x4b')][_0x484c('0x34')]+'%'};return _0x32f704;})});}_0x16c028=_[_0x484c('0x5c')]({},_0x16c028,_0xb9ba06[_0x484c('0xd6')]);return _0x4a12b2[_0x484c('0x125')](_0x16c028);}})[_0x484c('0x16')](function(_0x4573c6){if(_0x4573c6){_0x271b63=_0x4573c6[_0x484c('0x4e')];if(!_0xb9ba06[_0x484c('0x4b')][_0x484c('0xd7')](_0x484c('0xdc'))){_0x16c028[_0x484c('0x27')]=qs[_0x484c('0x27')](_0xb9ba06[_0x484c('0x4b')][_0x484c('0x27')]);_0x16c028['offset']=qs['offset'](_0xb9ba06[_0x484c('0x4b')]['offset']);}return _0x4a12b2[_0x484c('0x125')](_0x16c028);}})[_0x484c('0x16')](function(_0x38db07){if(_0x38db07){return _0x38db07?{'count':_0x271b63,'rows':_0x38db07}:null;}})[_0x484c('0x16')](respondWithResult(_0x58da80,null))['catch'](handleError(_0x58da80,null));};exports[_0x484c('0x126')]=function(_0x469045,_0x3697da){var _0x51d2a3={};var _0x1b8d55={};var _0x4c18a5;return db[_0x484c('0x42')][_0x484c('0x9b')]({'where':{'id':_0x469045[_0x484c('0x56')]['id']}})[_0x484c('0x16')](handleEntityNotFound(_0x3697da,null))[_0x484c('0x16')](function(_0x15d71c){if(_0x15d71c){_0x4c18a5=_0x15d71c;_0x1b8d55[_0x484c('0x57')]=_['keys'](db[_0x484c('0x42')][_0x484c('0x3d')]);_0x1b8d55[_0x484c('0x4b')]=_[_0x484c('0x58')](_0x469045[_0x484c('0x4b')]);_0x1b8d55[_0x484c('0x59')]=_[_0x484c('0x5a')](_0x1b8d55['model'],_0x1b8d55['query']);_0x51d2a3['attributes']=_[_0x484c('0x5a')](_0x1b8d55[_0x484c('0x57')],qs[_0x484c('0x5b')](_0x469045[_0x484c('0x4b')][_0x484c('0x5b')]));_0x51d2a3[_0x484c('0x48')]=_0x51d2a3['attributes'][_0x484c('0x4e')]?_0x51d2a3[_0x484c('0x48')]:_0x1b8d55['model'];_0x51d2a3[_0x484c('0xd3')]=qs[_0x484c('0xd4')](_0x469045['query'][_0x484c('0xd4')]);_0x51d2a3[_0x484c('0xd5')]=qs[_0x484c('0x59')](_[_0x484c('0xe2')](_0x469045['query'],_0x1b8d55[_0x484c('0x59')]));if(_0x469045['query'][_0x484c('0x34')]){_0x51d2a3[_0x484c('0xd5')]=_[_0x484c('0x5c')](_0x51d2a3['where'],{'$or':_[_0x484c('0x35')](_0x51d2a3[_0x484c('0x48')],function(_0xe4a99c){var _0x114555={};_0x114555[_0xe4a99c]={'$like':'%'+_0x469045['query']['filter']+'%'};return _0x114555;})});}_0x51d2a3['model']=db[_0x484c('0x42')];_0x51d2a3['as']=_0x484c('0x8b');_0x51d2a3=_['merge']({},_0x51d2a3,_0x469045['options']);return _0x4c18a5[_0x484c('0xfa')]({'include':[_0x51d2a3]});}})[_0x484c('0x16')](function(_0x3b8311){if(_0x3b8311){var _0x40289e={},_0x78292a=[];for(var _0xec3c3=0x0;_0xec3c3<_0x3b8311[_0x484c('0x4e')];_0xec3c3+=0x1){for(var _0x2e6481=0x0,_0x287c69;_0x2e6481<_0x3b8311[_0xec3c3][_0x484c('0x8b')]['length'];_0x2e6481+=0x1){_0x287c69=_0x3b8311[_0xec3c3]['Agents'][_0x2e6481][_0x484c('0x2e')]({'plain':!![]});_0x40289e[_0x287c69['id']]=_0x287c69;}}_0x40289e=_[_0x484c('0x127')](_0x40289e);for(var _0xb2e7b8=qs['offset'](_0x469045[_0x484c('0x4b')][_0x484c('0x24')]);_0xb2e7b8<_0x40289e['length']&&_0x78292a['length']=_0xebfc54){_0x49af7e=_0xebfc54;_0x418c63=0xc8;}else{_0x418c63=0xce;}_0x1cb10f[_0xc988('0x20')](_0x418c63);return _0x1cb10f[_0xc988('0x26')](_0xc988('0x27'),_0x18ccb0+'-'+_0x49af7e+'/'+_0xebfc54)['json'](_0x5e24b0);}return null;};}function saveUpdates(_0x5519d5){return function(_0x2a1c8b){if(_0x2a1c8b){return _0x2a1c8b[_0xc988('0x28')](_0x5519d5)[_0xc988('0x16')](function(_0x3d6591){socket[_0xc988('0x29')]('userNotification:recalc:'+_0x3d6591['id'],{});return _0x3d6591;});}return null;};}function removeEntity(_0x4262f2){return function(_0x2dd6e2){if(_0x2dd6e2){return _0x2dd6e2['destroy']()['then'](function(){var _0x40de73=_0x2dd6e2['get']({'plain':!![]});if(_0x40de73[_0xc988('0x2a')]===_0xc988('0x2b'))return;var _0x385eda=[{'name':'Users','value':_0xc988('0x2c'),'ignore':!![]},{'name':_0xc988('0x2d'),'value':_0xc988('0x2e'),'ignore':![]},{'name':_0xc988('0x2f'),'value':_0xc988('0x30'),'ignore':![]}];var _0x5666c3=_(_0x385eda)['filter'](_0xc988('0x31'))[_0xc988('0x32')](_0xc988('0x33'))['value']();if(_[_0xc988('0x34')](_0x5666c3,_0x40de73['role'])){return;}var _0x3b8259=_[_0xc988('0x35')](_0x385eda,[_0xc988('0x33'),_0x40de73[_0xc988('0x2a')]])[_0xc988('0x36')];return db['UserProfileResource'][_0xc988('0x37')]({'where':{'type':_0x3b8259,'resourceId':_0x40de73['id']}})['then'](function(){return _0x2dd6e2;});})[_0xc988('0x16')](function(){_0x4262f2[_0xc988('0x20')](0xcc)[_0xc988('0x21')]();});}};}function handleEntityNotFound(_0x4d4cef){return function(_0x191134){if(!_0x191134){_0x4d4cef[_0xc988('0x1f')](0x194);}return _0x191134;};}function handleError(_0x310a67,_0x33b966){_0x33b966=_0x33b966||0x1f4;return function(_0x5cbe76){logger[_0xc988('0x1b')](_0x5cbe76[_0xc988('0x38')]);if(_0x5cbe76['name']){delete _0x5cbe76['name'];}_0x310a67['status'](_0x33b966)[_0xc988('0x39')](_0x5cbe76);};}exports[_0xc988('0x3a')]=function(_0x216b4b,_0x53347a){var _0x2ca27f={},_0x7b2209={'count':0x0,'rows':[]};var _0x1d7364=_(db[_0xc988('0x3b')]['rawAttributes'])[_0xc988('0x32')](function(_0x128713){return{'name':_0x128713[_0xc988('0x3c')],'type':_0x128713[_0xc988('0x3d')][_0xc988('0x3e')]};})[_0xc988('0x3f')](function(_0x3cdf95){return!_[_0xc988('0x34')]([_0xc988('0x40'),'salt'],_0x3cdf95[_0xc988('0x36')]);})[_0xc988('0x33')]();_0x2ca27f=qs[_0xc988('0x41')](_0x1d7364,_0x216b4b);var _0x49335f={'where':_0x2ca27f['where']};return db[_0xc988('0x3b')]['count'](_0x49335f)['then'](function(_0x22e296){_0x7b2209['count']=_0x22e296;if(_0x216b4b[_0xc988('0x42')]['includeAll']){_0x2ca27f[_0xc988('0x43')]=[{'all':!![]}];}if(_0x216b4b[_0xc988('0x42')]['userSetting']===_0xc988('0x44')){_0x2ca27f[_0xc988('0x43')]=[{'model':db['UserSetting'],'as':_0xc988('0x45')}];}if(!_[_0xc988('0x34')](_0x2ca27f[_0xc988('0x46')],'id')){_0x2ca27f[_0xc988('0x46')][_0xc988('0x47')]('id');}return db[_0xc988('0x3b')][_0xc988('0x48')](_0x2ca27f);})[_0xc988('0x16')](function(_0x437c2e){_0x7b2209[_0xc988('0x49')]=_0x437c2e;if(_0x216b4b['query'][_0xc988('0x4a')]===_0xc988('0x44')){var _0x5b06b4=[];for(var _0x4cbdb7=0x0;_0x4cbdb7<_0x7b2209[_0xc988('0x49')][_0xc988('0x4b')];_0x4cbdb7++){_0x5b06b4[_0xc988('0x47')](get_open_tabs(_0xc988('0x4c'),_0x7b2209['rows'][_0x4cbdb7][_0xc988('0x4d')]));_0x5b06b4[_0xc988('0x47')](get_open_tabs(_0xc988('0x4e'),_0x7b2209[_0xc988('0x49')][_0x4cbdb7][_0xc988('0x4d')]));_0x5b06b4[_0xc988('0x47')](get_open_tabs(_0xc988('0x4f'),_0x7b2209[_0xc988('0x49')][_0x4cbdb7][_0xc988('0x4d')]));_0x5b06b4['push'](get_open_tabs('mail',_0x7b2209[_0xc988('0x49')][_0x4cbdb7][_0xc988('0x4d')]));_0x5b06b4[_0xc988('0x47')](get_open_tabs('openchannel',_0x7b2209[_0xc988('0x49')][_0x4cbdb7]['dataValues']));_0x5b06b4['push'](get_open_tabs('whatsapp',_0x7b2209['rows'][_0x4cbdb7][_0xc988('0x4d')]));}return Promise[_0xc988('0x50')](_0x5b06b4)[_0xc988('0x16')](function(){return _0x7b2209;});}else{return _0x7b2209;}})[_0xc988('0x16')](respondWithFilteredResult(_0x53347a,_0x2ca27f))[_0xc988('0x51')](handleError(_0x53347a,null));};exports[_0xc988('0x52')]=function(_0x3d61d1,_0x25e1e8){var _0x43c904={'raw':![],'where':{'id':_0x3d61d1[_0xc988('0x53')]['id']}},_0x714270={};_0x714270[_0xc988('0x54')]=_[_0xc988('0x55')](_[_0xc988('0x56')](db[_0xc988('0x3b')][_0xc988('0x57')]),[_0xc988('0x40'),'salt']);_0x714270['query']=_['keys'](_0x3d61d1[_0xc988('0x42')]);_0x714270[_0xc988('0x58')]=_[_0xc988('0x59')](_0x714270[_0xc988('0x54')],_0x714270[_0xc988('0x42')]);_0x43c904[_0xc988('0x46')]=_[_0xc988('0x59')](_0x714270[_0xc988('0x54')],qs['fields'](_0x3d61d1[_0xc988('0x42')]['fields']));_0x43c904['attributes']=_0x43c904['attributes'][_0xc988('0x4b')]?_0x43c904['attributes']:_0x714270[_0xc988('0x54')];if(_0x3d61d1['query'][_0xc988('0x5a')]){_0x43c904[_0xc988('0x43')]=[{'all':!![]}];}if(_0x3d61d1[_0xc988('0x42')][_0xc988('0x45')]===_0xc988('0x44')){_0x43c904[_0xc988('0x43')]=[{'model':db[_0xc988('0x5b')],'as':_0xc988('0x45')}];}_0x43c904=_[_0xc988('0x5c')]({},_0x43c904,_0x3d61d1[_0xc988('0x5d')]);if(!_[_0xc988('0x34')](_0x43c904[_0xc988('0x46')],'id')){_0x43c904[_0xc988('0x46')][_0xc988('0x47')]('id');}return db[_0xc988('0x3b')][_0xc988('0x35')](_0x43c904)['then'](handleEntityNotFound(_0x25e1e8,null))[_0xc988('0x16')](function(_0x1d574a){var _0x2605e4=[];values=_0x1d574a;if(_0x3d61d1['query'][_0xc988('0x4a')]===_0xc988('0x44')){_0x2605e4[_0xc988('0x47')](get_open_tabs(_0xc988('0x4c'),_0x1d574a['dataValues']));_0x2605e4[_0xc988('0x47')](get_open_tabs(_0xc988('0x4e'),_0x1d574a['dataValues']));_0x2605e4[_0xc988('0x47')](get_open_tabs(_0xc988('0x5e'),_0x1d574a['dataValues']));_0x2605e4[_0xc988('0x47')](get_open_tabs(_0xc988('0x5f'),_0x1d574a[_0xc988('0x4d')]));_0x2605e4[_0xc988('0x47')](get_open_tabs(_0xc988('0x4f'),_0x1d574a['dataValues']));_0x2605e4[_0xc988('0x47')](get_open_tabs(_0xc988('0x60'),_0x1d574a[_0xc988('0x4d')]));return Promise[_0xc988('0x50')](_0x2605e4);}else{return values;}})[_0xc988('0x16')](function(){return values;})['then'](respondWithResult(_0x25e1e8,null))['catch'](handleError(_0x25e1e8,null));};exports[_0xc988('0x28')]=function(_0x4d4747,_0x4927fa){if(_0x4d4747[_0xc988('0x61')]['id']){delete _0x4d4747[_0xc988('0x61')]['id'];}delete _0x4d4747[_0xc988('0x61')][_0xc988('0x2a')];return db[_0xc988('0x3b')]['find']({'where':{'id':_0x4d4747[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x4927fa,null))[_0xc988('0x16')](saveUpdates(_0x4d4747['body'],null))[_0xc988('0x16')](respondWithResult(_0x4927fa,null))[_0xc988('0x51')](handleError(_0x4927fa,null));};exports[_0xc988('0x62')]=function(_0x1fcf34,_0x23cc98){return db[_0xc988('0x3b')]['describe']()[_0xc988('0x16')](respondWithResult(_0x23cc98,null))[_0xc988('0x51')](handleError(_0x23cc98,null));};exports[_0xc988('0x63')]=function(_0x5d673e,_0x372f1b){return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x5d673e[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x372f1b,null))[_0xc988('0x16')](function(_0x592f0e){if(_0x592f0e){return _0x592f0e[_0xc988('0x63')](_0x5d673e[_0xc988('0x61')][_0xc988('0x64')],_[_0xc988('0x65')](_0x5d673e[_0xc988('0x61')],[_0xc988('0x64'),'id'])||{});}})[_0xc988('0x16')](respondWithResult(_0x372f1b,null))[_0xc988('0x51')](handleError(_0x372f1b,null));};function validateUser(_0x23548b){return new Promise(function(_0x5b5f8d,_0x4ac35e){if(_0x23548b[_0xc988('0x66')])return _0x5b5f8d(_0x23548b);return db[_0xc988('0x67')]['findById'](0x1)[_0xc988('0x16')](function(_0x594727){if(_0x594727[_0xc988('0x68')])authService[_0xc988('0x69')](_0x23548b[_0xc988('0x40')]);db['User'][_0xc988('0x6a')](_0xc988('0x66'))[_0xc988('0x16')](function(_0x301f62){if(_[_0xc988('0x6b')](_0x301f62)){_0x23548b[_0xc988('0x66')]=_0x594727[_0xc988('0x6c')]||0x1;return;}if(_[_0xc988('0x6b')](_0x594727['min_internal'])||_0x594727[_0xc988('0x6c')]===_0x301f62){_0x23548b['internal']=_0x301f62+0x1;return;}if(_0x594727['min_internal']>_0x301f62){_0x23548b[_0xc988('0x66')]=_0x594727[_0xc988('0x6c')];return;}return db[_0xc988('0x6d')][_0xc988('0x42')](_0xc988('0x6e'),{'type':db['sequelize']['QueryTypes'][_0xc988('0x6f')]})[_0xc988('0x16')](function(_0x13a2a5){if(_0x13a2a5&&_0x13a2a5[_0xc988('0x4b')]){for(var _0x38acbc=0x0,_0x4b15de=_0x13a2a5[_0xc988('0x4b')];_0x38acbc<_0x4b15de&&_[_0xc988('0x6b')](_0x23548b[_0xc988('0x66')]);_0x38acbc++){if(_0x594727[_0xc988('0x6c')]<=_0x13a2a5[_0x38acbc][_0xc988('0x70')]){_0x23548b[_0xc988('0x66')]=_0x13a2a5[_0x38acbc][_0xc988('0x70')];}else if(_0x594727[_0xc988('0x6c')]>_0x13a2a5[_0x38acbc][_0xc988('0x70')]&&_0x594727[_0xc988('0x6c')]<=_0x13a2a5[_0x38acbc]['to']){_0x23548b['internal']=_0x594727[_0xc988('0x6c')];}}}if(_[_0xc988('0x6b')](_0x23548b['internal'])){_0x23548b[_0xc988('0x66')]=_0x301f62+0x1;}return _0x5b5f8d(_0x23548b);});});})[_0xc988('0x51')](function(_0x5b718a){_0x4ac35e(_0x5b718a);});});}function updateUser(_0x3eb8cd){return new Promise(function(_0x402b11,_0x2b8416){try{if(_0x3eb8cd['voicemail']){_0x3eb8cd[_0xc988('0x71')]=_0x3eb8cd[_0xc988('0x66')];_0x3eb8cd[_0xc988('0x72')]={'mailbox':_0x3eb8cd[_0xc988('0x66')],'password':_0x3eb8cd[_0xc988('0x40')],'fullname':_0x3eb8cd[_0xc988('0x73')],'email':_0x3eb8cd['email']};}if(_0x3eb8cd[_0xc988('0x2a')]===_0xc988('0x2e')){if(!_0x3eb8cd[_0xc988('0x74')])_0x3eb8cd[_0xc988('0x74')]=[_0xc988('0x75'),_0xc988('0x76'),'103',_0xc988('0x77'),_0xc988('0x78'),_0xc988('0x79'),_0xc988('0x7a'),_0xc988('0x7b'),_0xc988('0x7c'),'108',_0xc988('0x7d'),'100','111',_0xc988('0x7e'),_0xc988('0x7f')];}_0x402b11(_0x3eb8cd);}catch(_0x2cffcc){_0x2b8416(_0x2cffcc);}});}exports[_0xc988('0x80')]=function(_0x4b7c85,_0x13f1b7){if(_0x4b7c85[_0xc988('0x2c')][_0xc988('0x2a')]===_0xc988('0x2e'))throw new Error(_0xc988('0x81'));if(_0x4b7c85['body'][_0xc988('0x2a')]===_0xc988('0x2c')&&_0x4b7c85['user'][_0xc988('0x2a')]!=='admin'){throw new Error(_0xc988('0x82'));}if(_0x4b7c85['body']['role']===_0xc988('0x2b')&&_0x4b7c85[_0xc988('0x2c')]['role']!==_0xc988('0x2b')){throw new Error(_0xc988('0x83'));}return licenseUtil['checkUserLimits']([_0x4b7c85[_0xc988('0x61')]])['then'](function(){return validateUser(_0x4b7c85['body']);})[_0xc988('0x16')](function(_0x461923){return updateUser(_0x461923)[_0xc988('0x16')](function(_0x336862){if(_0x336862[_0xc988('0x2a')]==='admin'){_0x336862[_0xc988('0x84')]=_0x4b7c85[_0xc988('0x2c')][_0xc988('0x84')];delete _0x336862[_0xc988('0x85')];}return _0x336862;});})['then'](function(_0x5f5970){return db['User'][_0xc988('0x80')](_0x5f5970,{'include':[{'model':db[_0xc988('0x72')],'as':_0xc988('0x72')}]});})[_0xc988('0x16')](function(_0xb3d6c){if(_0x4b7c85[_0xc988('0x61')]['role']===_0xc988('0x2c'))return _0xb3d6c;if(_0x4b7c85[_0xc988('0x2c')]['role']!==_0xc988('0x2c'))return _0xb3d6c;return db['UserProfileSection'][_0xc988('0x35')]({'where':{'name':_0xb3d6c['role']===_0xc988('0x2e')?'Agents':_0xc988('0x2f'),'userProfileId':_0x4b7c85[_0xc988('0x2c')][_0xc988('0x85')]},'raw':!![]})['then'](function(_0x1ae573){if(!_0x1ae573||_0x1ae573[_0xc988('0x86')]!=0x0)return _0xb3d6c;return db['UserProfileResource']['create']({'name':_0xb3d6c[_0xc988('0x36')],'resourceId':_0xb3d6c['id'],'type':_0x1ae573[_0xc988('0x36')],'sectionId':_0x1ae573['id']},{})['then'](function(){return _0xb3d6c;});})[_0xc988('0x51')](function(_0x5d6ce7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d6ce7);throw _0x5d6ce7;});})[_0xc988('0x16')](respondWithResult(_0x13f1b7,0xc9))[_0xc988('0x51')](handleError(_0x13f1b7,null));};exports['bulkCreate']=function(_0x33e741,_0x243d7b){var _0xc698b7=_0x33e741[_0xc988('0x61')];var _0x4dc517=[];if(_0x33e741[_0xc988('0x2c')]['role']==='agent')throw new Error(_0xc988('0x81'));if(_[_0xc988('0x87')](_0xc698b7,[_0xc988('0x2a'),_0xc988('0x2c')])&&_0x33e741[_0xc988('0x2c')][_0xc988('0x2a')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0xc698b7,[_0xc988('0x2a'),'admin'])&&_0x33e741[_0xc988('0x2c')][_0xc988('0x2a')]!==_0xc988('0x2b')){throw new Error(_0xc988('0x88'));}return licenseUtil['checkUserLimits'](_0xc698b7)[_0xc988('0x16')](function(){return validateUser(_0xc698b7[0x0]);})[_0xc988('0x16')](function(){for(var _0x212ebb=0x1;_0x212ebb<_0xc698b7['length'];_0x212ebb++){var _0x26fc1f=_0xc698b7[_0x212ebb-0x1][_0xc988('0x66')];if(!_0xc698b7[_0x212ebb]['internal'])_0xc698b7[_0x212ebb]['internal']=_0x26fc1f+0x1;_0x4dc517[_0xc988('0x47')](validateUser(_0xc698b7[_0x212ebb]));}return Promise[_0xc988('0x50')](_0x4dc517);})['then'](function(){_0x4dc517=[];for(var _0x59393d=0x0;_0x59393d<_0xc698b7[_0xc988('0x4b')];_0x59393d++){_0x4dc517['push'](updateUser(_0xc698b7[_0x59393d]));}return Promise[_0xc988('0x50')](_0x4dc517);})['then'](function(){_0x4dc517=_0xc698b7[_0xc988('0x32')](function(_0x3598f3){return db[_0xc988('0x3b')][_0xc988('0x80')](_0x3598f3,{'include':[{'model':db['VoiceMail'],'as':_0xc988('0x72')}]})[_0xc988('0x16')](function(_0x44b24f){_0x3598f3['id']=_0x44b24f['id'];return _0x3598f3;});});return Promise[_0xc988('0x50')](_0x4dc517);})[_0xc988('0x16')](function(_0x2a13d9){if(_0x33e741[_0xc988('0x61')][_0xc988('0x2a')]===_0xc988('0x2c'))return _0x2a13d9;if(_0x33e741['user'][_0xc988('0x2a')]!==_0xc988('0x2c'))return _0x2a13d9;var _0xd0f8f3=_['some'](_0x2a13d9,function(_0x2dcc6c){return _0x2dcc6c[_0xc988('0x2a')]===_0xc988('0x2e')||_0x2dcc6c[_0xc988('0x2a')]===_0xc988('0x30');});if(!_0xd0f8f3)return _0x2a13d9;return db['UserProfileSection'][_0xc988('0x48')]({'where':{'name':{'$or':[_0xc988('0x2d'),_0xc988('0x2f')]},'userProfileId':_0x33e741[_0xc988('0x2c')][_0xc988('0x85')]},'raw':!![]})['then'](function(_0x1042e7){if(_['isEmpty'](_0x1042e7)||!_[_0xc988('0x87')](_0x1042e7,['autoAssociation',0x0]))return _0x2a13d9;_0x4dc517=[];var _0x5403e8=_(_0x1042e7)[_0xc988('0x32')](function(_0x39f134){if(_0x39f134[_0xc988('0x86')]===0x1)return;return _0x39f134[_0xc988('0x36')]===_0xc988('0x2d')?'agent':'telephone';})['compact']()[_0xc988('0x33')]();for(var _0x45967f=0x0;_0x45967f<_0x2a13d9[_0xc988('0x4b')];_0x45967f++){if(!_[_0xc988('0x34')](_0x5403e8,_0x2a13d9[_0x45967f][_0xc988('0x2a')]))return;var _0x2e31c4=_0x2a13d9[_0x45967f][_0xc988('0x2a')]==='agent'?'Agents':_0xc988('0x2f');_0x4dc517[_0xc988('0x47')](db['UserProfileResource'][_0xc988('0x80')]({'name':_0x2a13d9[_0x45967f][_0xc988('0x36')],'resourceId':_0x2a13d9[_0x45967f]['id'],'type':_0x2e31c4,'sectionId':_[_0xc988('0x35')](_0x1042e7,['name',_0x2e31c4])['id']},{}));}return Promise['all'](_0x4dc517);});})[_0xc988('0x16')](respondWithResult(_0x243d7b,0xc9))[_0xc988('0x51')](handleError(_0x243d7b,null));};exports[_0xc988('0x89')]=function(_0x2e3e07,_0x4bd5cf){if(_0x2e3e07[_0xc988('0x61')]['id']){delete _0x2e3e07[_0xc988('0x61')]['id'];}return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x2e3e07[_0xc988('0x53')]['id']}})[_0xc988('0x16')](function(_0x5e390c){if(!_0x5e390c)return null;if(_0x5e390c['id']===_0x2e3e07[_0xc988('0x2c')]['id']){if(!_0x2e3e07[_0xc988('0x61')]['oldPassword']||!_0x2e3e07[_0xc988('0x61')][_0xc988('0x8a')]){throw new db[(_0xc988('0x8b'))][(_0xc988('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x5e390c[_0xc988('0x8d')](_0x2e3e07[_0xc988('0x61')][_0xc988('0x8e')])){throw new db[(_0xc988('0x8b'))][(_0xc988('0x8c'))](_0xc988('0x8f'));}if(_0x2e3e07[_0xc988('0x61')][_0xc988('0x8e')]===_0x2e3e07[_0xc988('0x61')][_0xc988('0x8a')]){throw new db[(_0xc988('0x8b'))][(_0xc988('0x8c'))](_0xc988('0x90'));}}else if(_0x2e3e07[_0xc988('0x2c')]['role']===_0xc988('0x2b')){if(!_0x2e3e07[_0xc988('0x61')][_0xc988('0x8a')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x2e3e07[_0xc988('0x2c')]['role']==='user'){if(!_0x2e3e07[_0xc988('0x61')]['newPassword']){throw new db[(_0xc988('0x8b'))][(_0xc988('0x8c'))](_0xc988('0x91'));}if(_0x5e390c[_0xc988('0x2a')]!==_0xc988('0x2e')){throw new db['Sequelize']['ValidationError'](_0xc988('0x81'));}}else{throw new db[(_0xc988('0x8b'))]['ValidationError'](_0xc988('0x81'));}return _0x5e390c;})[_0xc988('0x16')](handleEntityNotFound(_0x4bd5cf,null))['then'](function(_0x22f07d){return db[_0xc988('0x67')][_0xc988('0x92')]({'attributes':['id',_0xc988('0x68'),'enforcePasswordHistory',_0xc988('0x93')]})[_0xc988('0x16')](function(_0xdb2bf3){if(_0xdb2bf3['securePassword'])authService['validatePasswordPattern'](_0x2e3e07[_0xc988('0x61')][_0xc988('0x8a')]);if(!_0xdb2bf3[_0xc988('0x94')]||!_0x22f07d[_0xc988('0x95')])return _0x22f07d;authService[_0xc988('0x96')](_0x2e3e07[_0xc988('0x61')][_0xc988('0x8a')],_0x22f07d[_0xc988('0x95')],_0xdb2bf3[_0xc988('0x93')]);return _0x22f07d;})[_0xc988('0x16')](saveUpdates({'password':_0x2e3e07['body'][_0xc988('0x8a')],'passwordResetAt':_0x2e3e07['user']['id']==_0x2e3e07[_0xc988('0x53')]['id']?moment():null,'previousPasswords':authService[_0xc988('0x97')](_0x2e3e07[_0xc988('0x61')][_0xc988('0x8a')],_0x22f07d[_0xc988('0x95')])},null));})[_0xc988('0x16')](respondWithResult(_0x4bd5cf,null))[_0xc988('0x51')](handleError(_0x4bd5cf,null));};exports[_0xc988('0x98')]=function(_0x5a82b8,_0x4ae077){var _0xb5a1f4=_0x5a82b8[_0xc988('0x61')][_0xc988('0x99')];return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x5a82b8[_0xc988('0x53')]['id']},'attributes':['id',_0xc988('0x36'),_0xc988('0x2a'),'online',_0xc988('0x9a'),_0xc988('0x9b'),_0xc988('0x9c')]})[_0xc988('0x16')](handleEntityNotFound(_0x4ae077,null))['then'](function(_0x3f3905){if(_0x3f3905){if(!utils['isValidChannel'](_0xb5a1f4)){throw new db[(_0xc988('0x8b'))][(_0xc988('0x8c'))](_0xc988('0x9d'));}return _0x3f3905['add'+_[_0xc988('0x9e')](_0xb5a1f4[_0xc988('0x9f')]())+_0xc988('0xa0')](_0x5a82b8[_0xc988('0x61')][_0xc988('0x64')],{'penalty':_0x5a82b8[_0xc988('0x61')]['penalty']||0x0})[_0xc988('0xa1')](function(_0x1f5202){for(var _0x69833a=0x0;_0x69833a<_0x5a82b8[_0xc988('0x61')][_0xc988('0x64')][_0xc988('0x4b')];_0x69833a+=0x1){var _0x305bd2={'UserId':Number(_0x5a82b8['params']['id'])};_0x305bd2[_[_0xc988('0x9e')](_0xb5a1f4['toLowerCase']())+_0xc988('0xa2')]=Number(_0x5a82b8['body']['ids'][_0x69833a]);socket[_0xc988('0x29')](_0xc988('0x2c')+_[_0xc988('0x9e')](_0xb5a1f4[_0xc988('0x9f')]())+_0xc988('0xa3'),_0x305bd2);}return _0x1f5202;})[_0xc988('0x16')](function(){if(_0xb5a1f4==='voice'){return db[_0xc988('0xa4')][_0xc988('0x48')]({'where':{'id':_0x5a82b8[_0xc988('0x61')][_0xc988('0x64')]||[]},'raw':!![],'attributes':['id',_0xc988('0x36')]});}})[_0xc988('0x16')](function(_0x5edee8){var _0xf818ba=_0x3f3905[_0xc988('0xa5')]({'plain':!![]});var _0x22cfd1=[];if(_0xb5a1f4===_0xc988('0xa6')&&_0xf818ba[_0xc988('0x2a')]===_0xc988('0x2e')&&_0xf818ba[_0xc988('0xa7')]){for(let _0x3cde59=0x0;_0x3cde59<_0x5edee8[_0xc988('0x4b')];_0x3cde59+=0x1){_0x22cfd1[_0xc988('0x47')]({'membername':_0xf818ba[_0xc988('0x36')],'UserId':_0xf818ba['id'],'queue_name':_0x5edee8[_0x3cde59][_0xc988('0x36')],'VoiceQueueId':_0x5edee8[_0x3cde59]['id'],'interface':_[_0xc988('0x6b')](_0xf818ba[_0xc988('0x9c')])?util[_0xc988('0xa8')](_0xc988('0xa9'),_0xf818ba[_0xc988('0x36')]):_0xf818ba[_0xc988('0x9c')],'paused':_0xf818ba['voicePause']||![],'penalty':_0x5a82b8[_0xc988('0x61')][_0xc988('0xaa')]||0x0});}return Promise[_0xc988('0x50')](_0x22cfd1[_0xc988('0x32')](function(_0x4a9731){return db[_0xc988('0xab')][_0xc988('0xac')](_0x4a9731);}));}return _0x3f3905;});}})[_0xc988('0x16')](respondWithStatusCode(_0x4ae077,null))[_0xc988('0x51')](handleError(_0x4ae077,null));};exports[_0xc988('0xad')]=function(_0x26ecd4,_0x548a4a){var _0x5daa0b,_0x2b5650;return db['User'][_0xc988('0x35')]({'where':{'id':_0x26ecd4[_0xc988('0x53')]['id']},'attributes':['id',_0xc988('0x36'),'role']})['then'](handleEntityNotFound(_0x548a4a,null))[_0xc988('0x16')](function(_0x4b64c6){if(_0x4b64c6){_0x5daa0b=_0x4b64c6;if(!_0x26ecd4[_0xc988('0x42')][_0xc988('0x99')]||!utils[_0xc988('0xae')](_0x26ecd4[_0xc988('0x42')][_0xc988('0x99')])){throw new db[(_0xc988('0x8b'))]['ValidationError']('Unknown\x20channel');}return _0x4b64c6[_0xc988('0xaf')+_['capitalize'](_0x26ecd4[_0xc988('0x42')][_0xc988('0x99')][_0xc988('0x9f')]())+_0xc988('0xa0')](_0x26ecd4[_0xc988('0x42')]['ids']);}})['then'](function(_0x257db1){if(_['isArray'](_0x26ecd4['query'][_0xc988('0x64')])){for(var _0x1c02d5=0x0;_0x1c02d5<_0x26ecd4['query'][_0xc988('0x64')]['length'];_0x1c02d5+=0x1){_0x2b5650={'UserId':Number(_0x26ecd4[_0xc988('0x53')]['id'])};_0x2b5650[_[_0xc988('0x9e')](_0x26ecd4[_0xc988('0x42')][_0xc988('0x99')][_0xc988('0x9f')]())+'QueueId']=Number(_0x26ecd4[_0xc988('0x42')][_0xc988('0x64')][_0x1c02d5]);socket[_0xc988('0x29')](_0xc988('0x2c')+_['capitalize'](_0x26ecd4['query']['channel'][_0xc988('0x9f')]())+'Queue:remove',_0x2b5650);}}else{_0x2b5650={'UserId':Number(_0x26ecd4[_0xc988('0x53')]['id'])};_0x2b5650[_[_0xc988('0x9e')](_0x26ecd4['query']['channel']['toLowerCase']())+'QueueId']=Number(_0x26ecd4[_0xc988('0x42')][_0xc988('0x64')]);socket[_0xc988('0x29')](_0xc988('0x2c')+_[_0xc988('0x9e')](_0x26ecd4[_0xc988('0x42')]['channel'][_0xc988('0x9f')]())+_0xc988('0xb0'),_0x2b5650);}return _0x257db1;})[_0xc988('0x16')](function(){if(_0x26ecd4[_0xc988('0x42')][_0xc988('0x99')]===_0xc988('0xa6')){return db[_0xc988('0xab')][_0xc988('0x37')]({'where':{'UserId':_0x26ecd4['params']['id'],'VoiceQueueId':_0x26ecd4[_0xc988('0x42')][_0xc988('0x64')]},'individualHooks':!![]})[_0xc988('0x16')](function(){return _0x5daa0b;});}return _0x5daa0b;})[_0xc988('0x16')](respondWithStatusCode(_0x548a4a,null))[_0xc988('0x51')](handleError(_0x548a4a,null));};exports[_0xc988('0xb1')]=function(_0x56d1dc,_0x16b04e){_0x56d1dc[_0xc988('0x61')][_0xc988('0xb2')]=_0x56d1dc[_0xc988('0xb3')]['filename'];return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x56d1dc[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x16b04e,null))[_0xc988('0x16')](saveUpdates(_0x56d1dc[_0xc988('0x61')],null))[_0xc988('0x16')](respondWithResult(_0x16b04e,null))['catch'](handleError(_0x16b04e,null));};exports[_0xc988('0xb4')]=function(_0x452d10,_0xbb0944){var _0x27d8d7=path[_0xc988('0xb5')](config[_0xc988('0xb6')],_0xc988('0xb7'));return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x452d10[_0xc988('0x53')]['id']},'attributes':['id',_0xc988('0xb2')],'raw':!![]})[_0xc988('0x16')](handleEntityNotFound(_0xbb0944,null))[_0xc988('0x16')](function(_0x327bbc){if(_0x327bbc){if(_['isNil'](_0x327bbc[_0xc988('0xb2')])){return _0xbb0944[_0xc988('0xb8')](_0x27d8d7);}else{if(!fs[_0xc988('0xb9')](path['join'](config[_0xc988('0xb6')],_0xc988('0xba'),_0x327bbc['userpic']))){return _0xbb0944['download'](_0x27d8d7);}return _0xbb0944['download'](path[_0xc988('0xb5')](config['root'],'server/files/images/',_0x327bbc['userpic']));}}})[_0xc988('0x51')](handleError(_0xbb0944,null));};exports[_0xc988('0xbb')]=function(_0x3c95d5,_0x321249){return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x3c95d5['params']['id']},'attributes':['id']})[_0xc988('0x16')](handleEntityNotFound(_0x321249,null))['then'](function(_0x332042){var _0x380bc0=[];values=_0x332042[_0xc988('0x4d')];_0x380bc0[_0xc988('0x47')](get_open_tabs(_0xc988('0x4c'),_0x332042[_0xc988('0x4d')]));_0x380bc0['push'](get_open_tabs('sms',_0x332042[_0xc988('0x4d')]));_0x380bc0[_0xc988('0x47')](get_open_tabs(_0xc988('0x5e'),_0x332042[_0xc988('0x4d')]));_0x380bc0['push'](get_open_tabs(_0xc988('0x5f'),_0x332042['dataValues']));_0x380bc0[_0xc988('0x47')](get_open_tabs('fax',_0x332042[_0xc988('0x4d')]));_0x380bc0[_0xc988('0x47')](get_open_tabs(_0xc988('0x60'),_0x332042[_0xc988('0x4d')]));return Promise['all'](_0x380bc0);})[_0xc988('0x16')](function(_0x4f107c){if(_0x4f107c){var _0x5495ee=_['map'](values[_0xc988('0xbc')],function(_0x14a928){return{'channel':_0xc988('0xbd'),'id':_0x14a928['id'],'createdAt':_0x14a928[_0xc988('0xbe')]};});var _0x51be2d=_['map'](values[_0xc988('0xbf')],function(_0x4b9b0e){return{'channel':_0xc988('0xc0'),'id':_0x4b9b0e['id'],'createdAt':_0x4b9b0e[_0xc988('0xbe')]};});var _0x57438d=_[_0xc988('0x32')](values[_0xc988('0xc1')],function(_0x5ebaae){return{'channel':_0xc988('0xc2'),'id':_0x5ebaae['id'],'createdAt':_0x5ebaae[_0xc988('0xbe')]};});var _0x14ec05=_[_0xc988('0x32')](values[_0xc988('0xc3')],function(_0x5a7bae){return{'channel':_0xc988('0xc4'),'id':_0x5a7bae['id'],'createdAt':_0x5a7bae[_0xc988('0xbe')]};});var _0x4fe06c=_[_0xc988('0x32')](values[_0xc988('0xc5')],function(_0x4226c5){return{'channel':_0xc988('0xc6'),'id':_0x4226c5['id'],'createdAt':_0x4226c5['createdAt']};});var _0x57b698=_[_0xc988('0x32')](values['WhatsappOpenTabs'],function(_0x2016b7){return{'channel':'WHATSAPP','id':_0x2016b7['id'],'createdAt':_0x2016b7[_0xc988('0xbe')]};});var _0x1b3594=_[_0xc988('0xc7')](_0x5495ee,_0x51be2d,_0x57438d,_0x14ec05,_0x4fe06c,_0x57b698);var _0x888f89={'count':_0x1b3594[_0xc988('0x4b')],'rows':_0x1b3594};return _0x888f89;}else return null;})[_0xc988('0x16')](respondWithResult(_0x321249,null))[_0xc988('0x51')](handleError(_0x321249,null));};exports[_0xc988('0xc8')]=function(_0x57ee58,_0x3e2e45){var _0x226eb6={};var _0x35a31e={};var _0x437121;var _0x4f17f6;return db[_0xc988('0x3b')]['findOne']({'where':{'id':_0x57ee58[_0xc988('0x53')]['id']}})['then'](handleEntityNotFound(_0x3e2e45,null))[_0xc988('0x16')](function(_0x187299){if(_0x187299){_0x437121=_0x187299;_0x35a31e[_0xc988('0x54')]=_['keys'](db['CmContact']['rawAttributes']);_0x35a31e[_0xc988('0x42')]=_[_0xc988('0x56')](_0x57ee58[_0xc988('0x42')]);_0x35a31e[_0xc988('0x58')]=_[_0xc988('0x59')](_0x35a31e[_0xc988('0x54')],_0x35a31e['query']);_0x226eb6[_0xc988('0x46')]=_[_0xc988('0x59')](_0x35a31e[_0xc988('0x54')],qs['fields'](_0x57ee58[_0xc988('0x42')][_0xc988('0xc9')]));_0x226eb6[_0xc988('0x46')]=_0x226eb6['attributes'][_0xc988('0x4b')]?_0x226eb6[_0xc988('0x46')]:_0x35a31e[_0xc988('0x54')];_0x226eb6[_0xc988('0xca')]=qs['sort'](_0x57ee58[_0xc988('0x42')][_0xc988('0xcb')]);_0x226eb6['where']=qs['filters'](_['pick'](_0x57ee58[_0xc988('0x42')],_0x35a31e[_0xc988('0x58')]));if(_0x57ee58[_0xc988('0x42')][_0xc988('0x3f')]){_0x226eb6[_0xc988('0xcc')]=_['merge'](_0x226eb6[_0xc988('0xcc')],{'$or':_[_0xc988('0x32')](_0x226eb6[_0xc988('0x46')],function(_0x4c0fc8){var _0x3cd25d={};_0x3cd25d[_0x4c0fc8]={'$like':'%'+_0x57ee58['query'][_0xc988('0x3f')]+'%'};return _0x3cd25d;})});}_0x226eb6=_[_0xc988('0x5c')]({},_0x226eb6,_0x57ee58[_0xc988('0x5d')]);return _0x437121[_0xc988('0xc8')](_0x226eb6);}})[_0xc988('0x16')](function(_0x5f1214){if(_0x5f1214){_0x4f17f6=_0x5f1214['length'];if(_0x57ee58[_0xc988('0x42')][_0xc988('0xcd')](_0xc988('0x5a'))){_0x226eb6['include']=[{'model':db[_0xc988('0xce')],'as':'List','required':![]},{'model':db['Tag'],'as':_0xc988('0xcf'),'attributes':['id',_0xc988('0x36'),_0xc988('0xd0')],'where':_0x57ee58[_0xc988('0x42')][_0xc988('0xd1')]?{'id':_0x57ee58['query'][_0xc988('0xd1')]}:undefined,'required':_0x57ee58[_0xc988('0x42')]['tag']?!![]:![]}];}if(!_0x57ee58[_0xc988('0x42')][_0xc988('0xcd')](_0xc988('0xd2'))){_0x226eb6[_0xc988('0x24')]=qs['limit'](_0x57ee58['query'][_0xc988('0x24')]);_0x226eb6[_0xc988('0x22')]=qs[_0xc988('0x22')](_0x57ee58[_0xc988('0x42')][_0xc988('0x22')]);}return _0x437121[_0xc988('0xc8')](_0x226eb6);}})[_0xc988('0x16')](function(_0x17681c){if(_0x17681c){return _0x17681c?{'count':_0x4f17f6,'rows':_0x17681c}:null;}})[_0xc988('0x16')](respondWithResult(_0x3e2e45,null))[_0xc988('0x51')](handleError(_0x3e2e45,null));};exports[_0xc988('0xd3')]=function(_0x4f85d5,_0x4e2ee9){var _0x398c23;var _0x4490b9={};var _0x3169ae;return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x4f85d5[_0xc988('0x53')]['id']},'attributes':['id',_0xc988('0x36'),'role']})[_0xc988('0x16')](handleEntityNotFound(_0x4e2ee9,null))[_0xc988('0x16')](function(_0x94ded9){if(!utils[_0xc988('0xae')](_0x4f85d5[_0xc988('0x42')][_0xc988('0x99')])){throw new db[(_0xc988('0x8b'))][(_0xc988('0x8c'))](_0xc988('0x9d'));}_0x398c23=_0x94ded9;var _0x2f0d2a={};_0x2f0d2a[_0xc988('0x54')]=_[_0xc988('0x56')](db[_[_0xc988('0x9e')](_0x4f85d5[_0xc988('0x42')]['channel'])+_0xc988('0xd4')][_0xc988('0x57')]);_0x2f0d2a[_0xc988('0x42')]=_[_0xc988('0x56')](_0x4f85d5[_0xc988('0x42')]);_0x2f0d2a[_0xc988('0x58')]=_[_0xc988('0x59')](_0x2f0d2a[_0xc988('0x54')],_0x2f0d2a['query']);_0x4490b9['attributes']=_[_0xc988('0x59')](_0x2f0d2a[_0xc988('0x54')],qs['fields'](_0x4f85d5[_0xc988('0x42')][_0xc988('0xc9')]));_0x4490b9[_0xc988('0x46')]=_0x4490b9[_0xc988('0x46')][_0xc988('0x4b')]?_0x4490b9[_0xc988('0x46')]:_0x2f0d2a[_0xc988('0x54')];_0x4490b9[_0xc988('0xca')]=qs[_0xc988('0xcb')](_0x4f85d5[_0xc988('0x42')][_0xc988('0xcb')]);_0x4490b9[_0xc988('0xcc')]=qs[_0xc988('0x58')](_['pick'](_0x4f85d5[_0xc988('0x42')],_0x2f0d2a[_0xc988('0x58')]));if(_0x4f85d5['query']['filter']){_0x4490b9[_0xc988('0xcc')]=_['merge'](_0x4490b9[_0xc988('0xcc')],{'$or':_['map'](_0x4490b9[_0xc988('0x46')],function(_0x1e2652){var _0x66e3e={};_0x66e3e[_0x1e2652]={'$like':'%'+_0x4f85d5['query'][_0xc988('0x3f')]+'%'};return _0x66e3e;})});}_0x4490b9=_[_0xc988('0x5c')]({},_0x4490b9,_0x4f85d5[_0xc988('0x5d')]);switch(_0x398c23['role']){case _0xc988('0x2b'):return db[_[_0xc988('0x9e')](_0x4f85d5[_0xc988('0x42')][_0xc988('0x99')])+_0xc988('0xd4')][_0xc988('0x48')](_0x4490b9);case _0xc988('0x2c'):case _0xc988('0x2e'):return _0x398c23[_0xc988('0xa5')+_[_0xc988('0x9e')](_0x4f85d5['query'][_0xc988('0x99')])+'Queues'](_0x4490b9);default:throw new db[(_0xc988('0x8b'))]['ValidationError'](_0xc988('0xd5'));}})[_0xc988('0x16')](function(_0x421a9b){_0x3169ae=_0x421a9b['length'];if(!_0x4f85d5[_0xc988('0x42')][_0xc988('0xcd')]('nolimit')){_0x4490b9[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x4f85d5['query'][_0xc988('0x24')]);_0x4490b9[_0xc988('0x22')]=qs['offset'](_0x4f85d5['query'][_0xc988('0x22')]);}switch(_0x398c23[_0xc988('0x2a')]){case _0xc988('0x2b'):return db[_[_0xc988('0x9e')](_0x4f85d5[_0xc988('0x42')][_0xc988('0x99')])+'Queue'][_0xc988('0x48')](_0x4490b9);case _0xc988('0x2c'):case _0xc988('0x2e'):return _0x398c23[_0xc988('0xa5')+_[_0xc988('0x9e')](_0x4f85d5[_0xc988('0x42')][_0xc988('0x99')])+_0xc988('0xa0')](_0x4490b9);}})[_0xc988('0x16')](function(_0x922b46){return{'count':_0x3169ae,'rows':_0x922b46};})['then'](respondWithResult(_0x4e2ee9,null))['catch'](handleError(_0x4e2ee9,null));};exports['getVoiceQueuesRt']=function(_0x148d7e,_0x210b2c){var _0x132cc4={};var _0x1c3e40={};var _0x477ef3;var _0x4b7d35;return db[_0xc988('0x3b')]['findOne']({'where':{'id':_0x148d7e['params']['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x210b2c,null))[_0xc988('0x16')](function(_0x46ae14){if(_0x46ae14){_0x477ef3=_0x46ae14;_0x1c3e40[_0xc988('0x54')]=_[_0xc988('0x56')](db[_0xc988('0xab')][_0xc988('0x57')]);_0x1c3e40[_0xc988('0x42')]=_[_0xc988('0x56')](_0x148d7e[_0xc988('0x42')]);_0x1c3e40[_0xc988('0x58')]=_['intersection'](_0x1c3e40['model'],_0x1c3e40[_0xc988('0x42')]);_0x132cc4['attributes']=_[_0xc988('0x59')](_0x1c3e40[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x148d7e[_0xc988('0x42')][_0xc988('0xc9')]));_0x132cc4['attributes']=_0x132cc4[_0xc988('0x46')][_0xc988('0x4b')]?_0x132cc4[_0xc988('0x46')]:_0x1c3e40[_0xc988('0x54')];_0x132cc4[_0xc988('0xca')]=qs[_0xc988('0xcb')](_0x148d7e['query'][_0xc988('0xcb')]);_0x132cc4[_0xc988('0xcc')]=qs[_0xc988('0x58')](_[_0xc988('0xd6')](_0x148d7e[_0xc988('0x42')],_0x1c3e40['filters']));if(_0x148d7e[_0xc988('0x42')][_0xc988('0x3f')]){_0x132cc4[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x132cc4[_0xc988('0xcc')],{'$or':_[_0xc988('0x32')](_0x132cc4[_0xc988('0x46')],function(_0x578979){var _0x465d22={};_0x465d22[_0x578979]={'$like':'%'+_0x148d7e[_0xc988('0x42')][_0xc988('0x3f')]+'%'};return _0x465d22;})});}_0x132cc4=_['merge']({},_0x132cc4,_0x148d7e['options']);return _0x477ef3[_0xc988('0xd7')](_0x132cc4);}})[_0xc988('0x16')](function(_0x4ea7af){if(_0x4ea7af){_0x4b7d35=_0x4ea7af[_0xc988('0x4b')];if(!_0x148d7e[_0xc988('0x42')][_0xc988('0xcd')](_0xc988('0xd2'))){_0x132cc4['limit']=qs[_0xc988('0x24')](_0x148d7e[_0xc988('0x42')][_0xc988('0x24')]);_0x132cc4['offset']=qs[_0xc988('0x22')](_0x148d7e[_0xc988('0x42')][_0xc988('0x22')]);}return _0x477ef3[_0xc988('0xd7')](_0x132cc4);}})[_0xc988('0x16')](function(_0x2d5a7b){if(_0x2d5a7b){return _0x2d5a7b?{'count':_0x4b7d35,'rows':_0x2d5a7b}:null;}})[_0xc988('0x16')](respondWithResult(_0x210b2c,null))[_0xc988('0x51')](handleError(_0x210b2c,null));};exports['getGroups']=function(_0x426aa2,_0x44c6f3){var _0x26d181={};var _0x555ed8={};var _0x3a3d6e;var _0x24ad6b;return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x426aa2['params']['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x44c6f3,null))[_0xc988('0x16')](function(_0x2550ff){if(_0x2550ff){_0x3a3d6e=_0x2550ff;_0x555ed8[_0xc988('0x54')]=_['keys'](db[_0xc988('0xd8')][_0xc988('0x57')]);_0x555ed8[_0xc988('0x42')]=_['keys'](_0x426aa2[_0xc988('0x42')]);_0x555ed8['filters']=_[_0xc988('0x59')](_0x555ed8['model'],_0x555ed8[_0xc988('0x42')]);_0x26d181['attributes']=_[_0xc988('0x59')](_0x555ed8[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x426aa2[_0xc988('0x42')][_0xc988('0xc9')]));_0x26d181[_0xc988('0x46')]=_0x26d181[_0xc988('0x46')][_0xc988('0x4b')]?_0x26d181[_0xc988('0x46')]:_0x555ed8['model'];_0x26d181['order']=qs['sort'](_0x426aa2[_0xc988('0x42')][_0xc988('0xcb')]);_0x26d181[_0xc988('0xcc')]=qs[_0xc988('0x58')](_[_0xc988('0xd6')](_0x426aa2[_0xc988('0x42')],_0x555ed8[_0xc988('0x58')]));if(_0x426aa2[_0xc988('0x42')][_0xc988('0x3f')]){_0x26d181[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x26d181[_0xc988('0xcc')],{'$or':_[_0xc988('0x32')](_0x26d181['attributes'],function(_0x3d4509){var _0x3e528e={};_0x3e528e[_0x3d4509]={'$like':'%'+_0x426aa2[_0xc988('0x42')]['filter']+'%'};return _0x3e528e;})});}_0x26d181=_[_0xc988('0x5c')]({},_0x26d181,_0x426aa2[_0xc988('0x5d')]);return _0x3a3d6e[_0xc988('0xd9')](_0x26d181);}})[_0xc988('0x16')](function(_0x5c5d27){if(_0x5c5d27){_0x24ad6b=_0x5c5d27[_0xc988('0x4b')];if(!_0x426aa2[_0xc988('0x42')][_0xc988('0xcd')](_0xc988('0xd2'))){_0x26d181[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x426aa2['query'][_0xc988('0x24')]);_0x26d181[_0xc988('0x22')]=qs['offset'](_0x426aa2[_0xc988('0x42')][_0xc988('0x22')]);}return _0x3a3d6e[_0xc988('0xd9')](_0x26d181);}})[_0xc988('0x16')](function(_0x58dc13){if(_0x58dc13){return _0x58dc13?{'count':_0x24ad6b,'rows':_0x58dc13}:null;}})[_0xc988('0x16')](respondWithResult(_0x44c6f3,null))[_0xc988('0x51')](handleError(_0x44c6f3,null));};exports[_0xc988('0xda')]=function(_0x22ef8b,_0x1e7395){var _0x27dc8a={'raw':!![],'where':{}};var _0x4834ce={};var _0x1e5503={'count':0x0,'rows':[]};return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x22ef8b[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x1e7395,null))[_0xc988('0x16')](function(_0x110715){if(_0x110715){_0x4834ce[_0xc988('0x54')]=_[_0xc988('0x56')](db[_0xc988('0xdb')]['rawAttributes']);_0x4834ce[_0xc988('0x42')]=_[_0xc988('0x56')](_0x22ef8b[_0xc988('0x42')]);_0x4834ce[_0xc988('0x58')]=_[_0xc988('0x59')](_0x4834ce[_0xc988('0x54')],_0x4834ce[_0xc988('0x42')]);_0x27dc8a[_0xc988('0x46')]=_['intersection'](_0x4834ce[_0xc988('0x54')],qs['fields'](_0x22ef8b[_0xc988('0x42')][_0xc988('0xc9')]));_0x27dc8a[_0xc988('0x46')]=_0x27dc8a[_0xc988('0x46')][_0xc988('0x4b')]?_0x27dc8a[_0xc988('0x46')]:_0x4834ce['model'];if(!_0x22ef8b['query'][_0xc988('0xcd')](_0xc988('0xd2'))){_0x27dc8a[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x22ef8b[_0xc988('0x42')][_0xc988('0x24')]);_0x27dc8a['offset']=qs[_0xc988('0x22')](_0x22ef8b[_0xc988('0x42')]['offset']);}_0x27dc8a['order']=qs['sort'](_0x22ef8b['query'][_0xc988('0xcb')]);_0x27dc8a[_0xc988('0xcc')]=qs[_0xc988('0x58')](_[_0xc988('0xd6')](_0x22ef8b['query'],_0x4834ce[_0xc988('0x58')]));_0x27dc8a[_0xc988('0xcc')][_0xc988('0xdc')]=_0x110715['id'];if(_0x22ef8b['query'][_0xc988('0x3f')]){_0x27dc8a[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x27dc8a['where'],{'$or':_[_0xc988('0x32')](_0x27dc8a[_0xc988('0x46')],function(_0x540822){var _0x273ec3={};_0x273ec3[_0x540822]={'$like':'%'+_0x22ef8b[_0xc988('0x42')]['filter']+'%'};return _0x273ec3;})});}_0x27dc8a=_[_0xc988('0x5c')]({},_0x27dc8a,_0x22ef8b[_0xc988('0x5d')]);return db[_0xc988('0xdb')]['count']({'where':_0x27dc8a[_0xc988('0xcc')]})[_0xc988('0x16')](function(_0xabadd8){_0x1e5503[_0xc988('0x25')]=_0xabadd8;if(_0x22ef8b[_0xc988('0x42')][_0xc988('0x5a')]){_0x27dc8a[_0xc988('0x43')]=[{'all':!![]}];}return db[_0xc988('0xdb')]['findAll'](_0x27dc8a);})[_0xc988('0x16')](function(_0x1841b3){_0x1e5503['rows']=_0x1841b3;return _0x1e5503;});}})[_0xc988('0x16')](respondWithFilteredResult(_0x1e7395,_0x27dc8a))[_0xc988('0x51')](handleError(_0x1e7395,null));};exports[_0xc988('0xdd')]=function(_0x39eb0a,_0x444fb5){var _0x2ae12f={'raw':!![],'where':{}};var _0x1286f8={};var _0x476f85={'count':0x0,'rows':[]};return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x39eb0a[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x444fb5,null))[_0xc988('0x16')](function(_0x453f31){if(_0x453f31){_0x1286f8[_0xc988('0x54')]=_['keys'](db['ScreenRecording'][_0xc988('0x57')]);_0x1286f8[_0xc988('0x42')]=_[_0xc988('0x56')](_0x39eb0a['query']);_0x1286f8['filters']=_['intersection'](_0x1286f8[_0xc988('0x54')],_0x1286f8['query']);_0x2ae12f[_0xc988('0x46')]=_[_0xc988('0x59')](_0x1286f8[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x39eb0a['query'][_0xc988('0xc9')]));_0x2ae12f[_0xc988('0x46')]=_0x2ae12f[_0xc988('0x46')][_0xc988('0x4b')]?_0x2ae12f[_0xc988('0x46')]:_0x1286f8[_0xc988('0x54')];if(!_0x39eb0a[_0xc988('0x42')][_0xc988('0xcd')](_0xc988('0xd2'))){_0x2ae12f[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x39eb0a['query'][_0xc988('0x24')]);_0x2ae12f[_0xc988('0x22')]=qs['offset'](_0x39eb0a[_0xc988('0x42')][_0xc988('0x22')]);}_0x2ae12f['order']=qs[_0xc988('0xcb')](_0x39eb0a[_0xc988('0x42')][_0xc988('0xcb')]);_0x2ae12f[_0xc988('0xcc')]=qs[_0xc988('0x58')](_[_0xc988('0xd6')](_0x39eb0a[_0xc988('0x42')],_0x1286f8[_0xc988('0x58')]));_0x2ae12f[_0xc988('0xcc')]['UserId']=_0x453f31['id'];if(_0x39eb0a[_0xc988('0x42')]['filter']){_0x2ae12f[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x2ae12f['where'],{'$or':_['map'](_0x2ae12f['attributes'],function(_0x4fa5bc){var _0x3a9c72={};_0x3a9c72[_0x4fa5bc]={'$like':'%'+_0x39eb0a[_0xc988('0x42')][_0xc988('0x3f')]+'%'};return _0x3a9c72;})});}_0x2ae12f=_['merge']({},_0x2ae12f,_0x39eb0a[_0xc988('0x5d')]);return db[_0xc988('0xde')]['count']({'where':_0x2ae12f['where']})[_0xc988('0x16')](function(_0x427d43){_0x476f85[_0xc988('0x25')]=_0x427d43;if(_0x39eb0a['query'][_0xc988('0x5a')]){_0x2ae12f['include']=[{'all':!![]}];}return db[_0xc988('0xde')][_0xc988('0x48')](_0x2ae12f);})['then'](function(_0x32e655){_0x476f85[_0xc988('0x49')]=_0x32e655;return _0x476f85;});}})[_0xc988('0x16')](respondWithFilteredResult(_0x444fb5,_0x2ae12f))[_0xc988('0x51')](handleError(_0x444fb5,null));};exports[_0xc988('0xdf')]=function(_0x5f2927,_0x47e429){var _0x7d83af={};var _0x307fc1={};var _0xd89d9d;var _0x1d6bf6;return db[_0xc988('0x3b')]['findOne']({'where':{'id':_0x5f2927[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x47e429,null))['then'](function(_0x492328){if(_0x492328){_0xd89d9d=_0x492328;_0x307fc1['model']=_['keys'](db[_0xc988('0xe0')][_0xc988('0x57')]);_0x307fc1['query']=_[_0xc988('0x56')](_0x5f2927[_0xc988('0x42')]);_0x307fc1[_0xc988('0x58')]=_[_0xc988('0x59')](_0x307fc1['model'],_0x307fc1[_0xc988('0x42')]);_0x7d83af[_0xc988('0x46')]=_[_0xc988('0x59')](_0x307fc1[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x5f2927[_0xc988('0x42')][_0xc988('0xc9')]));_0x7d83af[_0xc988('0x46')]=_0x7d83af[_0xc988('0x46')][_0xc988('0x4b')]?_0x7d83af[_0xc988('0x46')]:_0x307fc1['model'];_0x7d83af[_0xc988('0xca')]=qs[_0xc988('0xcb')](_0x5f2927[_0xc988('0x42')][_0xc988('0xcb')]);_0x7d83af['where']=qs[_0xc988('0x58')](_['pick'](_0x5f2927[_0xc988('0x42')],_0x307fc1[_0xc988('0x58')]));if(_0x5f2927[_0xc988('0x42')][_0xc988('0x3f')]){_0x7d83af[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x7d83af[_0xc988('0xcc')],{'$or':_['map'](_0x7d83af['attributes'],function(_0x1d8e98){var _0x199514={};_0x199514[_0x1d8e98]={'$like':'%'+_0x5f2927['query'][_0xc988('0x3f')]+'%'};return _0x199514;})});}_0x7d83af=_[_0xc988('0x5c')]({},_0x7d83af,_0x5f2927[_0xc988('0x5d')]);return _0xd89d9d[_0xc988('0xdf')](_0x7d83af);}})[_0xc988('0x16')](function(_0x1ca69b){if(_0x1ca69b){_0x1d6bf6=_0x1ca69b['length'];if(!_0x5f2927[_0xc988('0x42')][_0xc988('0xcd')](_0xc988('0xd2'))){_0x7d83af[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x5f2927[_0xc988('0x42')][_0xc988('0x24')]);_0x7d83af[_0xc988('0x22')]=qs[_0xc988('0x22')](_0x5f2927[_0xc988('0x42')][_0xc988('0x22')]);}return _0xd89d9d[_0xc988('0xdf')](_0x7d83af);}})[_0xc988('0x16')](function(_0x420158){if(_0x420158){return _0x420158?{'count':_0x1d6bf6,'rows':_0x420158}:null;}})[_0xc988('0x16')](respondWithResult(_0x47e429,null))[_0xc988('0x51')](handleError(_0x47e429,null));};exports[_0xc988('0xe1')]=function(_0x1bd35f,_0x4a02e8){var _0x5bf2f9={};var _0x209c69={};var _0x3bbf6e;var _0x4c7d93;return db[_0xc988('0x3b')]['findOne']({'where':{'id':_0x1bd35f['params']['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x4a02e8,null))[_0xc988('0x16')](function(_0x3f438d){if(_0x3f438d){_0x3bbf6e=_0x3f438d;_0x209c69['model']=_[_0xc988('0x56')](db['OpenchannelInteraction']['rawAttributes']);_0x209c69['query']=_[_0xc988('0x56')](_0x1bd35f[_0xc988('0x42')]);_0x209c69[_0xc988('0x58')]=_[_0xc988('0x59')](_0x209c69[_0xc988('0x54')],_0x209c69[_0xc988('0x42')]);_0x5bf2f9[_0xc988('0x46')]=_[_0xc988('0x59')](_0x209c69[_0xc988('0x54')],qs['fields'](_0x1bd35f[_0xc988('0x42')]['fields']));_0x5bf2f9[_0xc988('0x46')]=_0x5bf2f9[_0xc988('0x46')][_0xc988('0x4b')]?_0x5bf2f9[_0xc988('0x46')]:_0x209c69['model'];_0x5bf2f9[_0xc988('0xca')]=qs[_0xc988('0xcb')](_0x1bd35f['query'][_0xc988('0xcb')]);_0x5bf2f9[_0xc988('0xcc')]=qs['filters'](_[_0xc988('0xd6')](_0x1bd35f[_0xc988('0x42')],_0x209c69['filters']));if(_0x1bd35f[_0xc988('0x42')][_0xc988('0x3f')]){_0x5bf2f9[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x5bf2f9['where'],{'$or':_[_0xc988('0x32')](_0x5bf2f9[_0xc988('0x46')],function(_0x148123){var _0x51ed41={};_0x51ed41[_0x148123]={'$like':'%'+_0x1bd35f[_0xc988('0x42')]['filter']+'%'};return _0x51ed41;})});}_0x5bf2f9=_['merge']({},_0x5bf2f9,_0x1bd35f[_0xc988('0x5d')]);return _0x3bbf6e[_0xc988('0xe1')](_0x5bf2f9);}})[_0xc988('0x16')](function(_0xff5258){if(_0xff5258){_0x4c7d93=_0xff5258[_0xc988('0x4b')];if(!_0x1bd35f['query'][_0xc988('0xcd')](_0xc988('0xd2'))){_0x5bf2f9[_0xc988('0x24')]=qs['limit'](_0x1bd35f[_0xc988('0x42')][_0xc988('0x24')]);_0x5bf2f9[_0xc988('0x22')]=qs[_0xc988('0x22')](_0x1bd35f[_0xc988('0x42')]['offset']);}return _0x3bbf6e['getOpenchannelInteractions'](_0x5bf2f9);}})['then'](function(_0x3e5149){if(_0x3e5149){return _0x3e5149?{'count':_0x4c7d93,'rows':_0x3e5149}:null;}})['then'](respondWithResult(_0x4a02e8,null))[_0xc988('0x51')](handleError(_0x4a02e8,null));};exports[_0xc988('0xe2')]=function(_0x52f754,_0x258f0f){var _0x26292f={'raw':!![],'where':{}};var _0x332f7f={};var _0x24ea86={'count':0x0,'rows':[]};return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x52f754[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x258f0f,null))[_0xc988('0x16')](function(_0x5d30d3){if(_0x5d30d3){_0x332f7f['model']=_['keys'](db[_0xc988('0xe3')][_0xc988('0x57')]);_0x332f7f[_0xc988('0x42')]=_['keys'](_0x52f754[_0xc988('0x42')]);_0x332f7f[_0xc988('0x58')]=_[_0xc988('0x59')](_0x332f7f[_0xc988('0x54')],_0x332f7f[_0xc988('0x42')]);_0x26292f[_0xc988('0x46')]=_[_0xc988('0x59')](_0x332f7f[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x52f754[_0xc988('0x42')][_0xc988('0xc9')]));_0x26292f[_0xc988('0x46')]=_0x26292f[_0xc988('0x46')]['length']?_0x26292f['attributes']:_0x332f7f[_0xc988('0x54')];if(!_0x52f754['query'][_0xc988('0xcd')]('nolimit')){_0x26292f[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x52f754[_0xc988('0x42')][_0xc988('0x24')]);_0x26292f[_0xc988('0x22')]=qs['offset'](_0x52f754['query'][_0xc988('0x22')]);}_0x26292f[_0xc988('0xca')]=qs[_0xc988('0xcb')](_0x52f754[_0xc988('0x42')][_0xc988('0xcb')]);_0x26292f[_0xc988('0xcc')]=qs[_0xc988('0x58')](_[_0xc988('0xd6')](_0x52f754[_0xc988('0x42')],_0x332f7f[_0xc988('0x58')]));_0x26292f[_0xc988('0xcc')][_0xc988('0xdc')]=_0x5d30d3['id'];if(_0x52f754[_0xc988('0x42')][_0xc988('0x3f')]){_0x26292f['where']=_[_0xc988('0x5c')](_0x26292f[_0xc988('0xcc')],{'$or':_[_0xc988('0x32')](_0x26292f['attributes'],function(_0x38f05){var _0x4b5b32={};_0x4b5b32[_0x38f05]={'$like':'%'+_0x52f754[_0xc988('0x42')][_0xc988('0x3f')]+'%'};return _0x4b5b32;})});}_0x26292f=_['merge']({},_0x26292f,_0x52f754[_0xc988('0x5d')]);return db['MailInteraction'][_0xc988('0x25')]({'where':_0x26292f[_0xc988('0xcc')]})['then'](function(_0x904df){_0x24ea86['count']=_0x904df;if(_0x52f754[_0xc988('0x42')]['includeAll']){_0x26292f['include']=[{'all':!![]}];}return db[_0xc988('0xe3')]['findAll'](_0x26292f);})['then'](function(_0x3272d2){_0x24ea86['rows']=_0x3272d2;return _0x24ea86;});}})[_0xc988('0x16')](respondWithFilteredResult(_0x258f0f,_0x26292f))['catch'](handleError(_0x258f0f,null));};exports[_0xc988('0xe4')]=function(_0x4d989e,_0x5adb85){var _0x5af821={};var _0x3abe81={};var _0x6f6695;var _0x4173ed;return db[_0xc988('0x3b')]['findOne']({'where':{'id':_0x4d989e[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x5adb85,null))[_0xc988('0x16')](function(_0x57184a){if(_0x57184a){_0x6f6695=_0x57184a;_0x3abe81[_0xc988('0x54')]=_[_0xc988('0x56')](db['SmsInteraction']['rawAttributes']);_0x3abe81[_0xc988('0x42')]=_[_0xc988('0x56')](_0x4d989e['query']);_0x3abe81[_0xc988('0x58')]=_[_0xc988('0x59')](_0x3abe81[_0xc988('0x54')],_0x3abe81[_0xc988('0x42')]);_0x5af821['attributes']=_[_0xc988('0x59')](_0x3abe81[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x4d989e[_0xc988('0x42')][_0xc988('0xc9')]));_0x5af821['attributes']=_0x5af821[_0xc988('0x46')][_0xc988('0x4b')]?_0x5af821[_0xc988('0x46')]:_0x3abe81[_0xc988('0x54')];_0x5af821[_0xc988('0xca')]=qs[_0xc988('0xcb')](_0x4d989e['query'][_0xc988('0xcb')]);_0x5af821['where']=qs[_0xc988('0x58')](_[_0xc988('0xd6')](_0x4d989e[_0xc988('0x42')],_0x3abe81[_0xc988('0x58')]));if(_0x4d989e['query'][_0xc988('0x3f')]){_0x5af821['where']=_[_0xc988('0x5c')](_0x5af821[_0xc988('0xcc')],{'$or':_[_0xc988('0x32')](_0x5af821[_0xc988('0x46')],function(_0x3575c1){var _0xb3924f={};_0xb3924f[_0x3575c1]={'$like':'%'+_0x4d989e[_0xc988('0x42')]['filter']+'%'};return _0xb3924f;})});}_0x5af821=_[_0xc988('0x5c')]({},_0x5af821,_0x4d989e[_0xc988('0x5d')]);return _0x6f6695[_0xc988('0xe4')](_0x5af821);}})[_0xc988('0x16')](function(_0x56bc21){if(_0x56bc21){_0x4173ed=_0x56bc21[_0xc988('0x4b')];if(!_0x4d989e[_0xc988('0x42')][_0xc988('0xcd')](_0xc988('0xd2'))){_0x5af821[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x4d989e[_0xc988('0x42')][_0xc988('0x24')]);_0x5af821[_0xc988('0x22')]=qs[_0xc988('0x22')](_0x4d989e[_0xc988('0x42')][_0xc988('0x22')]);}return _0x6f6695['getSmsInteractions'](_0x5af821);}})[_0xc988('0x16')](function(_0x32ec60){if(_0x32ec60){return _0x32ec60?{'count':_0x4173ed,'rows':_0x32ec60}:null;}})[_0xc988('0x16')](respondWithResult(_0x5adb85,null))[_0xc988('0x51')](handleError(_0x5adb85,null));};exports[_0xc988('0xe5')]=function(_0x263c02,_0x6583f5){var _0x4e8930={};var _0xfaa4d1={};var _0x32573e;var _0x3cc802;return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x263c02[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x6583f5,null))[_0xc988('0x16')](function(_0x48ccd6){if(_0x48ccd6){_0x32573e=_0x48ccd6;_0xfaa4d1[_0xc988('0x54')]=_[_0xc988('0x56')](db[_0xc988('0xe6')][_0xc988('0x57')]);_0xfaa4d1[_0xc988('0x42')]=_[_0xc988('0x56')](_0x263c02['query']);_0xfaa4d1['filters']=_[_0xc988('0x59')](_0xfaa4d1[_0xc988('0x54')],_0xfaa4d1['query']);_0x4e8930['attributes']=_[_0xc988('0x59')](_0xfaa4d1['model'],qs[_0xc988('0xc9')](_0x263c02[_0xc988('0x42')][_0xc988('0xc9')]));_0x4e8930[_0xc988('0x46')]=_0x4e8930['attributes'][_0xc988('0x4b')]?_0x4e8930[_0xc988('0x46')]:_0xfaa4d1[_0xc988('0x54')];_0x4e8930['order']=qs[_0xc988('0xcb')](_0x263c02[_0xc988('0x42')][_0xc988('0xcb')]);_0x4e8930[_0xc988('0xcc')]=qs[_0xc988('0x58')](_['pick'](_0x263c02[_0xc988('0x42')],_0xfaa4d1[_0xc988('0x58')]));if(_0x263c02['query'][_0xc988('0x3f')]){_0x4e8930['where']=_['merge'](_0x4e8930[_0xc988('0xcc')],{'$or':_[_0xc988('0x32')](_0x4e8930['attributes'],function(_0x5b8c50){var _0x2f3adb={};_0x2f3adb[_0x5b8c50]={'$like':'%'+_0x263c02[_0xc988('0x42')][_0xc988('0x3f')]+'%'};return _0x2f3adb;})});}_0x4e8930=_[_0xc988('0x5c')]({},_0x4e8930,_0x263c02[_0xc988('0x5d')]);return _0x32573e[_0xc988('0xe5')](_0x4e8930);}})['then'](function(_0x26f022){if(_0x26f022){_0x3cc802=_0x26f022[_0xc988('0x4b')];if(!_0x263c02['query'][_0xc988('0xcd')](_0xc988('0xd2'))){_0x4e8930['limit']=qs[_0xc988('0x24')](_0x263c02[_0xc988('0x42')][_0xc988('0x24')]);_0x4e8930['offset']=qs[_0xc988('0x22')](_0x263c02[_0xc988('0x42')][_0xc988('0x22')]);}return _0x32573e[_0xc988('0xe5')](_0x4e8930);}})[_0xc988('0x16')](function(_0x1acc54){if(_0x1acc54){return _0x1acc54?{'count':_0x3cc802,'rows':_0x1acc54}:null;}})[_0xc988('0x16')](respondWithResult(_0x6583f5,null))[_0xc988('0x51')](handleError(_0x6583f5,null));};exports[_0xc988('0xe7')]=function(_0x554eb3,_0x24ce7f){var _0x2c3995={};var _0x44be6e={};var _0x346b03;var _0x341894;return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x554eb3[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x24ce7f,null))[_0xc988('0x16')](function(_0x213345){if(_0x213345){_0x346b03=_0x213345;_0x44be6e['model']=_[_0xc988('0x56')](db['WhatsappInteraction'][_0xc988('0x57')]);_0x44be6e[_0xc988('0x42')]=_[_0xc988('0x56')](_0x554eb3[_0xc988('0x42')]);_0x44be6e[_0xc988('0x58')]=_[_0xc988('0x59')](_0x44be6e[_0xc988('0x54')],_0x44be6e[_0xc988('0x42')]);_0x2c3995['attributes']=_['intersection'](_0x44be6e[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x554eb3[_0xc988('0x42')][_0xc988('0xc9')]));_0x2c3995['attributes']=_0x2c3995[_0xc988('0x46')][_0xc988('0x4b')]?_0x2c3995[_0xc988('0x46')]:_0x44be6e['model'];_0x2c3995['order']=qs[_0xc988('0xcb')](_0x554eb3['query'][_0xc988('0xcb')]);_0x2c3995[_0xc988('0xcc')]=qs[_0xc988('0x58')](_[_0xc988('0xd6')](_0x554eb3['query'],_0x44be6e[_0xc988('0x58')]));if(_0x554eb3['query'][_0xc988('0x3f')]){_0x2c3995[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x2c3995[_0xc988('0xcc')],{'$or':_[_0xc988('0x32')](_0x2c3995[_0xc988('0x46')],function(_0x982c85){var _0x24c9c3={};_0x24c9c3[_0x982c85]={'$like':'%'+_0x554eb3[_0xc988('0x42')][_0xc988('0x3f')]+'%'};return _0x24c9c3;})});}_0x2c3995=_[_0xc988('0x5c')]({},_0x2c3995,_0x554eb3[_0xc988('0x5d')]);return _0x346b03[_0xc988('0xe7')](_0x2c3995);}})[_0xc988('0x16')](function(_0x35e84a){if(_0x35e84a){_0x341894=_0x35e84a[_0xc988('0x4b')];if(!_0x554eb3[_0xc988('0x42')][_0xc988('0xcd')]('nolimit')){_0x2c3995[_0xc988('0x24')]=qs['limit'](_0x554eb3[_0xc988('0x42')][_0xc988('0x24')]);_0x2c3995[_0xc988('0x22')]=qs[_0xc988('0x22')](_0x554eb3[_0xc988('0x42')][_0xc988('0x22')]);}return _0x346b03['getWhatsappInteractions'](_0x2c3995);}})[_0xc988('0x16')](function(_0x2b70c5){if(_0x2b70c5){return _0x2b70c5?{'count':_0x341894,'rows':_0x2b70c5}:null;}})[_0xc988('0x16')](respondWithResult(_0x24ce7f,null))['catch'](handleError(_0x24ce7f,null));};exports[_0xc988('0xe8')]=function(_0x297fb4,_0x111c8c,_0x2337b6){var _0x1568d0;var _0x319bcc;var _0x1e04da;var _0x4815bd=!_[_0xc988('0x6b')](_0x297fb4[_0xc988('0x53')]['id'])?_0x297fb4[_0xc988('0x53')]['id']:!_[_0xc988('0x6b')](_0x297fb4[_0xc988('0x2c')]['id'])?_0x297fb4['user']['id']:null;return db['User'][_0xc988('0x35')]({'where':{'id':_0x4815bd,'role':{'$or':['admin',_0xc988('0x2c'),_0xc988('0x2e')]}},'attributes':['id',_0xc988('0x36'),'phone',_0xc988('0xe9'),_0xc988('0x2a'),_0xc988('0x66'),_0xc988('0x9a')]})[_0xc988('0x16')](function(_0x3dc1d4){if(_0x3dc1d4){if(_0x3dc1d4['role']===_0xc988('0x2e')){_0x1568d0=_0x3dc1d4;if(_0x297fb4[_0xc988('0x61')][_0xc988('0x9c')]){_0x1e04da=util[_0xc988('0xa8')](_0xc988('0xea'),_0x1568d0[_0x297fb4['body']['interface']]);}else if(_0x297fb4[_0xc988('0x61')]['intrf']){_0x1e04da=util[_0xc988('0xa8')](_0xc988('0xa9'),_0x297fb4['body'][_0xc988('0xeb')]);}else{_0x1e04da=util[_0xc988('0xa8')](_0xc988('0xa9'),_0x1568d0[_0xc988('0x36')]);}socket['to'](util[_0xc988('0xa8')](_0xc988('0xec'),_0x1568d0['name']))[_0xc988('0x29')](_0xc988('0xed'),{'user':{'id':_0x1568d0['id'],'name':_0x1568d0[_0xc988('0x36')]},'ip':_0x297fb4[_0xc988('0xee')][_0xc988('0xef')]||_0x297fb4[_0xc988('0xf0')][_0xc988('0xf1')]||_0x297fb4[_0xc988('0xf2')][_0xc988('0xf1')]||_0x297fb4[_0xc988('0xf0')][_0xc988('0xf2')][_0xc988('0xf1')]});return db[_0xc988('0xab')][_0xc988('0x37')]({'where':{'membername':_0x1568d0['name']},'individualHooks':!![]});}}else{throw new db[(_0xc988('0x8b'))][(_0xc988('0x8c'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xc988('0x16')](function(){if(_0x1568d0){return _0x1568d0[_0xc988('0xf3')]({'raw':!![]});}})[_0xc988('0x16')](function(_0x29f148){if(_0x1568d0){if(_0x29f148){_0x319bcc=_0x29f148;if(_0x319bcc[_0xc988('0x4b')]){var _0x4e33c7=_0x319bcc[_0xc988('0x32')](function(_0x351344){var _0x3b932a={'membername':_0x1568d0[_0xc988('0x36')],'UserId':_0x1568d0['id'],'queue_name':_0x351344[_0xc988('0x36')],'VoiceQueueId':_0x351344['id'],'interface':_0x1e04da,'paused':_0x1568d0[_0xc988('0x9a')]||![],'penalty':_0x351344[_0xc988('0xf4')]||0x0};return db['UserVoiceQueueRt'][_0xc988('0xac')](_0x3b932a);});return Promise[_0xc988('0x50')](_0x4e33c7);}}}})[_0xc988('0x16')](function(){if(_0x1568d0){return db[_0xc988('0xf5')][_0xc988('0x48')]({'where':{'membername':_0x1568d0[_0xc988('0x36')],'exitAt':null}});}})[_0xc988('0x16')](function(_0x1a6eab){if(_0x1568d0){var _0x4223cd=[];_0x1a6eab[_0xc988('0xf6')](function(_0x18a49f){_0x4223cd[_0xc988('0x47')](_0x18a49f[_0xc988('0x28')]({'exitAt':moment()[_0xc988('0xa8')](_0xc988('0xf7'))}));});return Promise['all'](_0x4223cd);}})[_0xc988('0x16')](function(){if(_0x1568d0){var _0x4073a8=[];var _0x4fe43b=[];var _0x5bc0bb=utils[_0xc988('0xf8')]();var _0x4705fe={'membername':_0x1568d0['name'],'interface':_0x1e04da,'enterAt':moment()['format'](_0xc988('0xf7')),'role':_0x1568d0[_0xc988('0x2a')],'internal':_0x1568d0[_0xc988('0x66')]};_0x5bc0bb[_0xc988('0xf6')](function(_0x545489){_0x4073a8[_0xc988('0x47')](_['merge']({'channel':_0x545489,'type':'LOGIN','data1':_0x297fb4[_0xc988('0x61')][_0xc988('0xf9')],'data2':_0x1e04da},_0x4705fe));if(_0x1568d0[_0xc988('0x9a')]){_0x4fe43b[_0xc988('0x47')](_[_0xc988('0x5c')]({'channel':_0x545489,'type':_0xc988('0xfa'),'data1':_0xc988('0xfb')},_0x4705fe));}});return db[_0xc988('0xf5')]['bulkCreate'](_0x4073a8[_0xc988('0xc7')](_0x4fe43b),{'individualHooks':!![]});}})[_0xc988('0x16')](function(){if(_0x1568d0){return _0x1568d0['update']({'online':!![],'lastLoginAt':moment()[_0xc988('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1568d0[_0xc988('0x9a')]||![],'mailPause':_0x1568d0[_0xc988('0x9a')]||![],'chatPause':_0x1568d0[_0xc988('0x9a')]||![],'faxPause':_0x1568d0['loginInPause']||![],'smsPause':_0x1568d0['loginInPause']||![],'openchannelPause':_0x1568d0[_0xc988('0x9a')]||![],'whatsappPause':_0x1568d0[_0xc988('0x9a')]||![],'pauseType':_0x1568d0[_0xc988('0x9a')]?_0xc988('0xfb'):null,'interface':_0x1e04da,'lastPauseAt':moment()[_0xc988('0xa8')](_0xc988('0xf7'))});}})[_0xc988('0x16')](function(_0x40871d){if(_0x297fb4[_0xc988('0xfc')]){return _0x2337b6();}else{return Promise['resolve'](_0x40871d)[_0xc988('0x16')](respondWithResult(_0x111c8c,null));}})[_0xc988('0x51')](handleError(_0x111c8c,null));};exports[_0xc988('0xfd')]=function(_0x57a164,_0x16312d){var _0x31199e;return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x57a164[_0xc988('0x53')]['id'],'role':_0xc988('0x2e')},'attributes':['id',_0xc988('0x36'),_0xc988('0x2a')]})[_0xc988('0x16')](handleEntityNotFound(_0x16312d,null))[_0xc988('0x16')](function(_0x289601){if(_0x289601){_0x31199e=_0x289601;return db[_0xc988('0xab')][_0xc988('0x37')]({'where':{'membername':_0x31199e[_0xc988('0x36')]},'individualHooks':!![]});}})[_0xc988('0x16')](function(){return db[_0xc988('0xf5')]['findAll']({'where':{'membername':_0x31199e[_0xc988('0x36')],'exitAt':null}});})[_0xc988('0x16')](function(_0x44b977){var _0x1c42a2=[];_0x44b977[_0xc988('0xf6')](function(_0x28b0a3){_0x1c42a2[_0xc988('0x47')](_0x28b0a3[_0xc988('0x28')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x1c42a2);})['then'](function(){return _0x31199e[_0xc988('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xc988('0x16')](respondWithResult(_0x16312d,null))[_0xc988('0x51')](handleError(_0x16312d,null));};exports[_0xc988('0xfe')]=function(_0x51ab57,_0x572c16){var _0x276476;return db[_0xc988('0xab')][_0xc988('0x28')]({'paused':0x1},{'where':{'UserId':_0x51ab57[_0xc988('0x53')]['id']},'individualHooks':!![]})[_0xc988('0x16')](function(){return db[_0xc988('0x3b')]['find']({'where':{'id':_0x51ab57[_0xc988('0x53')]['id'],'role':_0xc988('0x2e')},'attributes':['id',_0xc988('0x36'),_0xc988('0x2a'),'internal','interface',_0xc988('0xa7')]});})['then'](handleEntityNotFound(_0x572c16,null))[_0xc988('0x16')](function(_0x58f444){if(_0x58f444){_0x276476=_0x58f444;return respondWithRpcPromise(_0xc988('0xff'),'pause',{'id':_0x276476['id'],'name':_0x276476[_0xc988('0x36')],'pause':!![]});}})[_0xc988('0x16')](function(){if(_0x276476){return db[_0xc988('0xf5')][_0xc988('0x48')]({'where':{'membername':_0x276476[_0xc988('0x36')],'type':_0xc988('0xfa'),'exitAt':null}});}})[_0xc988('0x16')](function(_0x414a29){if(_0x414a29[_0xc988('0x4b')]){var _0x346958=moment()[_0xc988('0xa8')](_0xc988('0xf7'));for(var _0x4ba4ec=0x0,_0x39a3be=_0x414a29[_0xc988('0x4b')];_0x4ba4ec<_0x39a3be;_0x4ba4ec++){_0x414a29[_0x4ba4ec][_0xc988('0x100')]({'exitAt':_0x346958});}}})[_0xc988('0x16')](function(){var _0x608998=[];var _0xbed6bb=utils[_0xc988('0xf8')]();_0xbed6bb[_0xc988('0xf6')](function(_0x527526){_0x608998['push']({'channel':_0x527526,'membername':_0x276476[_0xc988('0x36')],'interface':_[_0xc988('0x6b')](_0x276476[_0xc988('0x9c')])?util['format'](_0xc988('0xa9'),_0x276476[_0xc988('0x36')]):_0x276476[_0xc988('0x9c')],'type':_0xc988('0xfa'),'enterAt':moment()[_0xc988('0xa8')](_0xc988('0xf7')),'data1':_0x51ab57[_0xc988('0x61')]['type']||_0xc988('0x101'),'role':_0x276476['role'],'internal':_0x276476[_0xc988('0x66')]});});return db[_0xc988('0xf5')][_0xc988('0x102')](_0x608998,{'individualHooks':!![]});})[_0xc988('0x16')](function(){return _0x276476[_0xc988('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x51ab57['body']['type']||_0xc988('0x101'),'lastPauseAt':moment()[_0xc988('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x572c16,null))[_0xc988('0x51')](handleError(_0x572c16,null));};exports[_0xc988('0x103')]=function(_0x40a553,_0x54a244){if(_0x40a553[_0xc988('0x61')][_0xc988('0x99')]&&!utils['isValidChannel'](_0x40a553['body'][_0xc988('0x99')])){throw new APIBadRequestError(util[_0xc988('0xa8')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x40a553[_0xc988('0x61')]['channel']));}return db[_0xc988('0x3b')][_0xc988('0x35')]({'where':{'id':_0x40a553[_0xc988('0x53')]['id']},'attributes':['id',_0xc988('0x36'),_0xc988('0x2a'),'internal',_0xc988('0x9c'),_0xc988('0xa7'),_0xc988('0x9b'),'mailPause',_0xc988('0x104'),_0xc988('0x105'),'openchannelPause',_0xc988('0x106'),_0xc988('0x107'),_0xc988('0x108'),'lastPauseAt']})[_0xc988('0x16')](function(_0x2dcb4e){if(!_0x2dcb4e){throw new APINotFoundError(util[_0xc988('0xa8')](_0xc988('0x109'),_0x40a553[_0xc988('0x53')]['id']));}return _0x2dcb4e[_0xc988('0x103')](_0x40a553[_0xc988('0x61')][_0xc988('0x99')]);})[_0xc988('0x16')](respondWithResult(_0x54a244,null))['catch'](APIHandleError(_0x54a244));};exports[_0xc988('0x10a')]=function(_0x4c1b2a,_0x301810){var _0x3a956c={};var _0x50e3fe={};var _0x1ec509;var _0x2f2605;return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x4c1b2a['params']['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x301810,null))[_0xc988('0x16')](function(_0x3af88c){if(_0x3af88c){_0x1ec509=_0x3af88c;_0x50e3fe['model']=_[_0xc988('0x56')](db[_0xc988('0x10b')][_0xc988('0x57')]);_0x50e3fe[_0xc988('0x42')]=_[_0xc988('0x56')](_0x4c1b2a[_0xc988('0x42')]);_0x50e3fe[_0xc988('0x58')]=_[_0xc988('0x59')](_0x50e3fe[_0xc988('0x54')],_0x50e3fe[_0xc988('0x42')]);_0x3a956c[_0xc988('0x46')]=_['intersection'](_0x50e3fe[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x4c1b2a[_0xc988('0x42')]['fields']));_0x3a956c[_0xc988('0x46')]=_0x3a956c['attributes']['length']?_0x3a956c['attributes']:_0x50e3fe['model'];_0x3a956c[_0xc988('0xca')]=qs[_0xc988('0xcb')](_0x4c1b2a[_0xc988('0x42')]['sort']);_0x3a956c['where']=qs['filters'](_[_0xc988('0xd6')](_0x4c1b2a[_0xc988('0x42')],_0x50e3fe['filters']));if(_0x4c1b2a[_0xc988('0x42')][_0xc988('0x3f')]){_0x3a956c['where']=_['merge'](_0x3a956c[_0xc988('0xcc')],{'$or':_['map'](_0x3a956c[_0xc988('0x46')],function(_0x1e16cf){var _0x1f49a0={};_0x1f49a0[_0x1e16cf]={'$like':'%'+_0x4c1b2a[_0xc988('0x42')]['filter']+'%'};return _0x1f49a0;})});}_0x3a956c=_[_0xc988('0x5c')]({},_0x3a956c,_0x4c1b2a[_0xc988('0x5d')]);return _0x1ec509['getTeams'](_0x3a956c);}})[_0xc988('0x16')](function(_0x38b252){if(_0x38b252){_0x2f2605=_0x38b252['length'];if(!_0x4c1b2a[_0xc988('0x42')][_0xc988('0xcd')]('nolimit')){_0x3a956c[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x4c1b2a[_0xc988('0x42')]['limit']);_0x3a956c[_0xc988('0x22')]=qs[_0xc988('0x22')](_0x4c1b2a[_0xc988('0x42')]['offset']);}return _0x1ec509[_0xc988('0x10a')](_0x3a956c);}})[_0xc988('0x16')](function(_0x18c5e6){if(_0x18c5e6){return _0x18c5e6?{'count':_0x2f2605,'rows':_0x18c5e6}:null;}})[_0xc988('0x16')](respondWithResult(_0x301810,null))['catch'](handleError(_0x301810,null));};exports['addTeams']=function(_0x2e4ce4,_0x237059){var _0x28baa6=_0x2e4ce4[_0xc988('0x53')]['id'];var _0x102d35=_0x2e4ce4[_0xc988('0x61')]?_0x2e4ce4['body'][_0xc988('0x64')]:null;var _0x34a2f0=[];return Promise['resolve']()[_0xc988('0x16')](function(){if(!_0x102d35)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x28baa6}});})[_0xc988('0x16')](function(_0x5820fc){if(!_0x5820fc)throw new APINotFoundError(util[_0xc988('0xa8')](_0xc988('0x109'),_0x2e4ce4[_0xc988('0x53')]['id']));return db[_0xc988('0x6d')]['transaction'](function(_0x47e32f){return _0x5820fc['addTeams'](_0x102d35,{'transaction':_0x47e32f})['then'](function(){return db['Team'][_0xc988('0x48')]({'where':{'id':{'$in':_0x102d35}}});})[_0xc988('0x16')](function(_0x1ceb8b){var _0x46106d=_[_0xc988('0x32')](_0x1ceb8b,function(_0x39264f){return _0x39264f[_0xc988('0x10c')]();});return Promise['all'](_0x46106d);})[_0xc988('0x16')](function(_0x5294d6){_0x34a2f0=_['flattenDeep'](_0x5294d6);var _0x54dbb8=_[_0xc988('0x32')](_0x34a2f0,function(_0x1f4084){return _0x1f4084[_0xc988('0x10d')](_0x5820fc['id'],{'transaction':_0x47e32f});});return Promise[_0xc988('0x50')](_0x54dbb8);})[_0xc988('0x16')](function(){if(!_0x5820fc['online'])return;var _0x3211e6=_['filter'](_0x34a2f0,function(_0x5e0e8c){return _0x5e0e8c[_0xc988('0x10e')](_0xc988('0x99'))===_0xc988('0x10f');});var _0x4f46ca=_[_0xc988('0x32')](_0x3211e6,function(_0x365f86){return db['UserVoiceQueueRt']['upsert']({'membername':_0x5820fc[_0xc988('0x36')],'UserId':_0x5820fc['id'],'queue_name':_0x365f86[_0xc988('0x36')],'VoiceQueueId':_0x365f86['id'],'interface':_[_0xc988('0x6b')](_0x5820fc[_0xc988('0x9c')])?util[_0xc988('0xa8')](_0xc988('0xa9'),_0x5820fc[_0xc988('0x36')]):_0x5820fc[_0xc988('0x9c')],'paused':_0x5820fc[_0xc988('0x9b')]||![],'penalty':_0x5820fc[_0xc988('0xaa')]},{'transaction':_0x47e32f});});return Promise[_0xc988('0x50')](_0x4f46ca);})['then'](function(){return db[_0xc988('0x110')][_0xc988('0x48')]({'where':{'teamId':{'$in':_0x102d35}}});})[_0xc988('0x16')](function(_0x491d3a){var _0x1be876=_['map'](_0x491d3a,function(_0x1acb28){return db[_0xc988('0x111')][_0xc988('0x80')]({'UserId':_0x5820fc['id'],'VoicePrefixId':_0x1acb28[_0xc988('0x112')]},{'transaction':_0x47e32f});});return Promise[_0xc988('0x50')](_0x1be876);});});})['then'](function(){for(var _0x1e7be6=0x0;_0x1e7be6<_0x34a2f0[_0xc988('0x4b')];_0x1e7be6++){var _0x277b1b=_0x34a2f0[_0x1e7be6][_0xc988('0x10e')](_0xc988('0x99'));var _0x4461f1=_0x277b1b+_0xc988('0xa2');socket[_0xc988('0x29')](_0xc988('0x2c')+_0x277b1b+_0xc988('0xa3'),{'UserId':_0x28baa6,['queueField']:_0x34a2f0[_0x1e7be6]['id']});}})[_0xc988('0x16')](respondWithStatusCode(_0x237059,null))[_0xc988('0x51')](APIHandleError(_0x237059));};exports[_0xc988('0x113')]=function(_0x2e2c4b,_0x4f6fa3){var _0xed6a30=_0x2e2c4b[_0xc988('0x53')]['id'];var _0x2cafdd=null;if(_0x2e2c4b['query']['ids']){_0x2cafdd=_[_0xc988('0x114')](_0x2e2c4b[_0xc988('0x42')][_0xc988('0x64')])?_0x2e2c4b['query'][_0xc988('0x64')]:[_0x2e2c4b[_0xc988('0x42')][_0xc988('0x64')]];}var _0x1a01a9=[];return Promise[_0xc988('0x115')]()[_0xc988('0x16')](function(){if(!_0x2cafdd)throw new APIBadRequestError(_0xc988('0x116'));})[_0xc988('0x16')](function(){return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0xed6a30}});})[_0xc988('0x16')](function(_0x1db71d){if(!_0x1db71d)throw new APINotFoundError(util[_0xc988('0xa8')](_0xc988('0x109'),_0x2e2c4b[_0xc988('0x53')]['id']));return db[_0xc988('0x6d')]['transaction'](function(_0x5201df){return _0x1db71d[_0xc988('0x113')](_0x2cafdd,{'transaction':_0x5201df})[_0xc988('0x16')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x2cafdd}}});})[_0xc988('0x16')](function(_0x256b2f){var _0x5ab30a=_[_0xc988('0x32')](_0x256b2f,function(_0x7d0750){return _0x7d0750['getAssociatedQueues']();});return Promise[_0xc988('0x50')](_0x5ab30a);})[_0xc988('0x16')](function(_0x2b1bfb){_0x1a01a9=_[_0xc988('0x117')](_0x2b1bfb);var _0x143cd2=_[_0xc988('0x32')](_0x1a01a9,function(_0x42a160){return _0x42a160[_0xc988('0x118')](_0x1db71d['id'],{'transaction':_0x5201df});});return Promise[_0xc988('0x50')](_0x143cd2);})[_0xc988('0x16')](function(){if(!_0x1db71d[_0xc988('0xa7')])return;var _0x38dac3=_['filter'](_0x1a01a9,function(_0x310530){return _0x310530[_0xc988('0x10e')](_0xc988('0x99'))==='Voice';});var _0x2853e4=_[_0xc988('0x32')](_0x38dac3,function(_0x3c98fd){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3c98fd['id'],'UserId':_0x1db71d['id']},'transaction':_0x5201df});});return Promise[_0xc988('0x50')](_0x2853e4);})[_0xc988('0x16')](function(){return db[_0xc988('0x110')][_0xc988('0x48')]({'where':{'teamId':{'$in':_0x2cafdd}}});})[_0xc988('0x16')](function(_0x284410){var _0x283f17=_['map'](_0x284410,function(_0x44ead3){return db[_0xc988('0x111')][_0xc988('0x37')]({'where':{'UserId':_0x1db71d['id'],'VoicePrefixId':_0x44ead3[_0xc988('0x112')]}},{'transaction':_0x5201df});});return Promise[_0xc988('0x50')](_0x283f17);});});})[_0xc988('0x16')](function(){for(var _0x37249e=0x0;_0x37249e<_0x1a01a9[_0xc988('0x4b')];_0x37249e++){var _0x4ee4d9=_0x1a01a9[_0x37249e][_0xc988('0x10e')](_0xc988('0x99'));var _0x538873=_0x4ee4d9+'QueueId';socket['emit'](_0xc988('0x2c')+_0x4ee4d9+'Queue:remove',{'UserId':_0xed6a30,['queueField']:_0x1a01a9[_0x37249e]['id']});}})[_0xc988('0x16')](respondWithStatusCode(_0x4f6fa3,null))['catch'](APIHandleError(_0x4f6fa3));};exports['getLists']=function(_0x48e98d,_0x34b90a){var _0x3c32b8={};var _0x2e1720={};var _0x668a0d;var _0x1e6f65;return db[_0xc988('0x3b')][_0xc988('0x92')]({'where':{'id':_0x48e98d['params']['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x34b90a,null))[_0xc988('0x16')](function(_0x5198cb){if(_0x5198cb){_0x668a0d=_0x5198cb;_0x2e1720[_0xc988('0x54')]=_['keys'](db[_0xc988('0xce')]['rawAttributes']);_0x2e1720[_0xc988('0x42')]=_[_0xc988('0x56')](_0x48e98d[_0xc988('0x42')]);_0x2e1720['filters']=_[_0xc988('0x59')](_0x2e1720[_0xc988('0x54')],_0x2e1720[_0xc988('0x42')]);_0x3c32b8[_0xc988('0x46')]=_[_0xc988('0x59')](_0x2e1720[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x48e98d[_0xc988('0x42')][_0xc988('0xc9')]));_0x3c32b8[_0xc988('0x46')]=_0x3c32b8['attributes'][_0xc988('0x4b')]?_0x3c32b8[_0xc988('0x46')]:_0x2e1720['model'];_0x3c32b8[_0xc988('0xca')]=qs['sort'](_0x48e98d[_0xc988('0x42')][_0xc988('0xcb')]);_0x3c32b8[_0xc988('0xcc')]=qs['filters'](_[_0xc988('0xd6')](_0x48e98d['query'],_0x2e1720[_0xc988('0x58')]));if(_0x48e98d[_0xc988('0x42')][_0xc988('0x3f')]){_0x3c32b8[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x3c32b8['where'],{'$or':_['map'](_0x3c32b8[_0xc988('0x46')],function(_0x4d9477){var _0x5177fb={};_0x5177fb[_0x4d9477]={'$like':'%'+_0x48e98d[_0xc988('0x42')][_0xc988('0x3f')]+'%'};return _0x5177fb;})});}_0x3c32b8=_[_0xc988('0x5c')]({},_0x3c32b8,_0x48e98d[_0xc988('0x5d')]);return _0x668a0d['getLists'](_0x3c32b8);}})[_0xc988('0x16')](function(_0x36f5a0){if(_0x36f5a0){_0x1e6f65=_0x36f5a0['length'];if(!_0x48e98d[_0xc988('0x42')][_0xc988('0xcd')]('nolimit')){_0x3c32b8[_0xc988('0x24')]=qs[_0xc988('0x24')](_0x48e98d[_0xc988('0x42')]['limit']);_0x3c32b8[_0xc988('0x22')]=qs['offset'](_0x48e98d[_0xc988('0x42')]['offset']);}return _0x668a0d[_0xc988('0x119')](_0x3c32b8);}})[_0xc988('0x16')](function(_0x4d35fa){if(_0x4d35fa){return _0x4d35fa?{'count':_0x1e6f65,'rows':_0x4d35fa}:null;}})['then'](respondWithResult(_0x34b90a,null))['catch'](handleError(_0x34b90a,null));};exports[_0xc988('0x11a')]=function(_0x1d5713,_0x2600ec){var _0x5b70ee={};var _0x288ee1={};var _0x1d4884;return db['User']['findOne']({'where':{'id':_0x1d5713[_0xc988('0x53')]['id']}})[_0xc988('0x16')](handleEntityNotFound(_0x2600ec,null))[_0xc988('0x16')](function(_0x5aa8f1){if(_0x5aa8f1){_0x1d4884=_0x5aa8f1;_0x288ee1[_0xc988('0x54')]=_[_0xc988('0x56')](db[_0xc988('0x3b')][_0xc988('0x57')]);_0x288ee1[_0xc988('0x42')]=_[_0xc988('0x56')](_0x1d5713['query']);_0x288ee1[_0xc988('0x58')]=_[_0xc988('0x59')](_0x288ee1[_0xc988('0x54')],_0x288ee1[_0xc988('0x42')]);_0x5b70ee['attributes']=_[_0xc988('0x59')](_0x288ee1[_0xc988('0x54')],qs[_0xc988('0xc9')](_0x1d5713[_0xc988('0x42')][_0xc988('0xc9')]));_0x5b70ee[_0xc988('0x46')]=_0x5b70ee[_0xc988('0x46')][_0xc988('0x4b')]?_0x5b70ee[_0xc988('0x46')]:_0x288ee1[_0xc988('0x54')];_0x5b70ee[_0xc988('0xca')]=qs['sort'](_0x1d5713[_0xc988('0x42')][_0xc988('0xcb')]);_0x5b70ee['where']=qs['filters'](_['pick'](_0x1d5713[_0xc988('0x42')],_0x288ee1[_0xc988('0x58')]));if(_0x1d5713[_0xc988('0x42')][_0xc988('0x3f')]){_0x5b70ee[_0xc988('0xcc')]=_[_0xc988('0x5c')](_0x5b70ee['where'],{'$or':_[_0xc988('0x32')](_0x5b70ee[_0xc988('0x46')],function(_0x2412fa){var _0x306ce8={};_0x306ce8[_0x2412fa]={'$like':'%'+_0x1d5713[_0xc988('0x42')]['filter']+'%'};return _0x306ce8;})});}_0x5b70ee['model']=db[_0xc988('0x3b')];_0x5b70ee['as']=_0xc988('0x2d');_0x5b70ee=_[_0xc988('0x5c')]({},_0x5b70ee,_0x1d5713['options']);return _0x1d4884[_0xc988('0xf3')]({'include':[_0x5b70ee]});}})[_0xc988('0x16')](function(_0xf2fa4c){if(_0xf2fa4c){var _0x3cd027={},_0x7c6733=[];for(var _0x2d1036=0x0;_0x2d1036<_0xf2fa4c[_0xc988('0x4b')];_0x2d1036+=0x1){for(var _0x30796e=0x0,_0x510440;_0x30796e<_0xf2fa4c[_0x2d1036][_0xc988('0x2d')][_0xc988('0x4b')];_0x30796e+=0x1){_0x510440=_0xf2fa4c[_0x2d1036][_0xc988('0x2d')][_0x30796e][_0xc988('0xa5')]({'plain':!![]});_0x3cd027[_0x510440['id']]=_0x510440;}}_0x3cd027=_[_0xc988('0x11b')](_0x3cd027);for(var _0x1b227b=qs['offset'](_0x1d5713['query'][_0xc988('0x22')]);_0x1b227b<_0x3cd027[_0xc988('0x4b')]&&_0x7c6733[_0xc988('0x4b')]=_0xd9b3f0[_0x1be5('0x4b')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x1be5('0x15')](function(){if(_0x3bec28){return db[_0x1be5('0x24')][_0x1be5('0x44')]({'where':{'membername':_0x3bec28[_0x1be5('0x20')]},'individualHooks':!![]});}})[_0x1be5('0x15')](function(){if(_0x3bec28){return _0x3bec28[_0x1be5('0x4c')]({'raw':!![]});}})[_0x1be5('0x15')](function(_0x5e4e19){if(_0x3bec28){if(_0x5e4e19){var _0x266eaa=[];_0xb67a30=_0x5e4e19;if(_0xb67a30[_0x1be5('0x29')]){for(var _0x574e3e=0x0;_0x574e3e<_0xb67a30[_0x1be5('0x29')];_0x574e3e++){_0x266eaa[_0x1be5('0x4d')](db[_0x1be5('0x24')]['upsert']({'membername':_0x3bec28['name'],'UserId':_0x3bec28['id'],'queue_name':_0xb67a30[_0x574e3e]['name'],'VoiceQueueId':_0xb67a30[_0x574e3e]['id'],'interface':_0x4652e7,'paused':_0x3bec28[_0x1be5('0x49')]||![],'penalty':_0xb67a30[_0x574e3e]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x1be5('0x45')](_0x266eaa);}}}})[_0x1be5('0x15')](function(){if(_0x3bec28){return db['MemberReport'][_0x1be5('0x27')]({'where':{'membername':_0x3bec28[_0x1be5('0x20')],'exitAt':null}});}})['then'](function(_0x349a5c){if(_0x3bec28){if(_0x349a5c&&_0x349a5c[_0x1be5('0x29')]){var _0x1786cf=[];_0x349a5c['forEach'](function(_0x1b91d3){_0x1786cf['push'](_0x1b91d3[_0x1be5('0x25')]({'exitAt':moment()[_0x1be5('0x2c')](_0x1be5('0x2a'))}));});return BPromise['all'](_0x1786cf);}}})[_0x1be5('0x15')](function(){if(_0x3bec28){var _0x7564e4=[];var _0x259abd=[];var _0x3a9dbb=utils[_0x1be5('0x4e')]();var _0x45f183={'membername':_0x3bec28['name'],'interface':_0x4652e7,'enterAt':moment()[_0x1be5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3bec28[_0x1be5('0x21')],'internal':_0x3bec28[_0x1be5('0x22')]};_0x3a9dbb[_0x1be5('0x2b')](function(_0x46e007){_0x7564e4[_0x1be5('0x4d')](_['merge']({'channel':_0x46e007,'type':_0x1be5('0x4f'),'data1':'callysquare','data2':_0x4652e7},_0x45f183));if(_0x3bec28[_0x1be5('0x49')]){_0x259abd[_0x1be5('0x4d')](_[_0x1be5('0x50')]({'channel':_0x46e007,'type':'PAUSE','data1':'LOGININPAUSE'},_0x45f183));}});return db[_0x1be5('0x26')][_0x1be5('0x31')](_0x7564e4[_0x1be5('0x51')](_0x259abd),{'individualHooks':!![]});}})[_0x1be5('0x15')](function(){if(_0x3bec28){return _0x3bec28[_0x1be5('0x25')]({'online':!![],'lastLoginAt':moment()[_0x1be5('0x2c')](_0x1be5('0x2a')),'voicePause':_0x3bec28['loginInPause']||![],'mailPause':_0x3bec28[_0x1be5('0x49')]||![],'chatPause':_0x3bec28[_0x1be5('0x49')]||![],'faxPause':_0x3bec28[_0x1be5('0x49')]||![],'smsPause':_0x3bec28['loginInPause']||![],'openchannelPause':_0x3bec28[_0x1be5('0x49')]||![],'pauseType':_0x3bec28[_0x1be5('0x49')]?_0x1be5('0x52'):null,'lastPauseAt':moment()[_0x1be5('0x2c')](_0x1be5('0x2a')),'interface':_0x4652e7});}})[_0x1be5('0x15')](function(_0x33bde5){_0x47de65(_0x33bde5);})['catch'](function(_0x23bddb){_0x3fbeeb(_0x5868e9[_0x1be5('0x1a')](0x1f4,_0x23bddb[_0x1be5('0x1b')]));});});}; \ No newline at end of file +var _0x47fa=['raw','options','where','attributes','include','model','map','then','info','debug','stringify','catch','error','ShowUser','find','message','role','internal','interface','UserVoiceQueueRt','update','MemberReport','findAll','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','callysquare','LOGININPAUSE','concat','util','moment','bluebird','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','GetUser','User'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x47fa,0x19d));var _0xa47f=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0x47fa[_0x425b19];return _0x15ecab;};'use strict';var _=require('lodash');var util=require(_0xa47f('0x0'));var moment=require(_0xa47f('0x1'));var BPromise=require(_0xa47f('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa47f('0x3'))('rpc');var config=require(_0xa47f('0x4'));config['redis']=_[_0xa47f('0x5')](config[_0xa47f('0x6')],{'host':_0xa47f('0x7'),'port':0x18eb});var socket=require(_0xa47f('0x8'))(new Redis(config[_0xa47f('0x6')]));require(_0xa47f('0x9'))['register'](socket);exports[_0xa47f('0xa')]=function(_0x230344){var _0x28700b=this;return new Promise(function(_0x34a70b,_0x32f49e){return db[_0xa47f('0xb')]['findAll']({'raw':_0x230344['options']?_0x230344['options'][_0xa47f('0xc')]===undefined?!![]:![]:!![],'where':_0x230344[_0xa47f('0xd')]?_0x230344[_0xa47f('0xd')][_0xa47f('0xe')]||null:null,'attributes':_0x230344[_0xa47f('0xd')]?_0x230344['options'][_0xa47f('0xf')]||null:null,'limit':_0x230344[_0xa47f('0xd')]?_0x230344[_0xa47f('0xd')]['limit']||null:null,'include':_0x230344[_0xa47f('0xd')]?_0x230344['options'][_0xa47f('0x10')]?_['map'](_0x230344[_0xa47f('0xd')][_0xa47f('0x10')],function(_0xf38003){return{'model':db[_0xf38003[_0xa47f('0x11')]],'as':_0xf38003['as'],'attributes':_0xf38003['attributes'],'include':_0xf38003[_0xa47f('0x10')]?_[_0xa47f('0x12')](_0xf38003['include'],function(_0x31d830){return{'model':db[_0x31d830[_0xa47f('0x11')]],'as':_0x31d830['as'],'attributes':_0x31d830[_0xa47f('0xf')],'include':_0x31d830['include']?_[_0xa47f('0x12')](_0x31d830[_0xa47f('0x10')],function(_0x650c40){return{'model':db[_0x650c40[_0xa47f('0x11')]],'as':_0x650c40['as'],'attributes':_0x650c40['attributes']};}):[]};}):[]};}):[]:[]})[_0xa47f('0x13')](function(_0x504dc5){logger[_0xa47f('0x14')](_0xa47f('0xa'),_0x230344);logger[_0xa47f('0x15')](_0xa47f('0xa'),_0x230344,JSON[_0xa47f('0x16')](_0x504dc5));_0x34a70b(_0x504dc5);})[_0xa47f('0x17')](function(_0x2852e8){logger['error'](_0xa47f('0xa'),_0x2852e8['message'],_0x230344);_0x32f49e(_0x28700b[_0xa47f('0x18')](0x1f4,_0x2852e8['message']));});});};exports[_0xa47f('0x19')]=function(_0x31a38d){var _0x32f8bc=this;return new Promise(function(_0x3ef26a,_0x2a347a){return db[_0xa47f('0xb')][_0xa47f('0x1a')]({'raw':_0x31a38d['options']?_0x31a38d[_0xa47f('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x31a38d['options']?_0x31a38d[_0xa47f('0xd')][_0xa47f('0xe')]||null:null,'attributes':_0x31a38d[_0xa47f('0xd')]?_0x31a38d['options']['attributes']||null:null,'include':_0x31a38d[_0xa47f('0xd')]?_0x31a38d[_0xa47f('0xd')][_0xa47f('0x10')]?_[_0xa47f('0x12')](_0x31a38d[_0xa47f('0xd')]['include'],function(_0x2d7f81){return{'model':db[_0x2d7f81['model']],'as':_0x2d7f81['as'],'attributes':_0x2d7f81[_0xa47f('0xf')],'include':_0x2d7f81[_0xa47f('0x10')]?_[_0xa47f('0x12')](_0x2d7f81[_0xa47f('0x10')],function(_0xcefb2e){return{'model':db[_0xcefb2e[_0xa47f('0x11')]],'as':_0xcefb2e['as'],'attributes':_0xcefb2e[_0xa47f('0xf')],'include':_0xcefb2e['include']?_[_0xa47f('0x12')](_0xcefb2e[_0xa47f('0x10')],function(_0x40b4e4){return{'model':db[_0x40b4e4['model']],'as':_0x40b4e4['as'],'attributes':_0x40b4e4[_0xa47f('0xf')]};}):[]};}):[]};}):[]:[]})[_0xa47f('0x13')](function(_0x159c07){logger['info']('ShowUser',_0x31a38d);logger[_0xa47f('0x15')](_0xa47f('0x19'),_0x31a38d,JSON[_0xa47f('0x16')](_0x159c07));_0x3ef26a(_0x159c07);})[_0xa47f('0x17')](function(_0x12b247){logger[_0xa47f('0x18')](_0xa47f('0x19'),_0x12b247['message'],_0x31a38d);_0x2a347a(_0x32f8bc[_0xa47f('0x18')](0x1f4,_0x12b247[_0xa47f('0x1b')]));});});};exports['PauseUser']=function(_0x4c570e){var _0x3241cc=this;return new Promise(function(_0x3fb7f9,_0x35f0a6){var _0x4ce29c;return db[_0xa47f('0xb')][_0xa47f('0x1a')]({'where':_0x4c570e[_0xa47f('0xd')][_0xa47f('0xe')]||{},'attributes':['id','name',_0xa47f('0x1c'),_0xa47f('0x1d'),_0xa47f('0x1e')]})[_0xa47f('0x13')](function(_0x209b65){if(_0x209b65){_0x4ce29c=_0x209b65;return db[_0xa47f('0x1f')][_0xa47f('0x20')]({'paused':0x1},{'where':{'UserId':_0x4ce29c['id']},'individualHooks':!![]});}})[_0xa47f('0x13')](function(){if(_0x4ce29c){return db[_0xa47f('0x21')][_0xa47f('0x22')]({'where':{'membername':_0x4ce29c[_0xa47f('0x23')],'type':_0xa47f('0x24'),'exitAt':null}});}})[_0xa47f('0x13')](function(_0x1a9bad){if(_0x4ce29c){if(_0x1a9bad&&_0x1a9bad[_0xa47f('0x25')]){var _0x3d9b13=moment()[_0xa47f('0x26')](_0xa47f('0x27'));for(var _0x2b3b13=0x0,_0x44fb22=_0x1a9bad[_0xa47f('0x25')];_0x2b3b13<_0x44fb22;_0x2b3b13++){_0x1a9bad[_0x2b3b13][_0xa47f('0x28')]({'exitAt':_0x3d9b13});}}}})[_0xa47f('0x13')](function(){if(_0x4ce29c){var _0x2b700f=[];var _0x4433c8=utils[_0xa47f('0x29')]();_0x4433c8[_0xa47f('0x2a')](function(_0x10c127){_0x2b700f[_0xa47f('0x2b')]({'channel':_0x10c127,'membername':_0x4ce29c[_0xa47f('0x23')],'interface':_[_0xa47f('0x2c')](_0x4ce29c[_0xa47f('0x1e')])?util['format'](_0xa47f('0x2d'),_0x4ce29c[_0xa47f('0x23')]):_0x4ce29c['interface'],'type':_0xa47f('0x24'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4c570e[_0xa47f('0x2e')][_0xa47f('0x2f')]||_0xa47f('0x30'),'role':_0x4ce29c[_0xa47f('0x1c')],'internal':_0x4ce29c['internal'],'uniqueid':_0x4c570e[_0xa47f('0x2e')][_0xa47f('0x31')]||null});});return db['MemberReport'][_0xa47f('0x32')](_0x2b700f,{'individualHooks':!![]});}})[_0xa47f('0x13')](function(){if(_0x4ce29c){return _0x4ce29c[_0xa47f('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4c570e[_0xa47f('0x2e')][_0xa47f('0x2f')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xa47f('0x26')](_0xa47f('0x27'))});}})[_0xa47f('0x13')](function(_0x362cba){_0x3fb7f9(_0x362cba);})[_0xa47f('0x17')](function(_0x1edd50){_0x35f0a6(_0x3241cc[_0xa47f('0x18')](0x1f4,_0x1edd50[_0xa47f('0x1b')]));});});};exports[_0xa47f('0x33')]=function(_0x11a630){var _0x28fe4f=this;return new Promise(function(_0x5f3ae6,_0x3ed0b4){if(_0x11a630['body'][_0xa47f('0x34')]&&!utils[_0xa47f('0x35')](_0x11a630[_0xa47f('0x2e')]['channel'])){throw new Error(util[_0xa47f('0x26')](_0xa47f('0x36'),_0x11a630['body']['channel']));}return db['User'][_0xa47f('0x37')]({'where':_0x11a630['options'][_0xa47f('0xe')]||{},'attributes':['id','name',_0xa47f('0x1c'),'internal',_0xa47f('0x1e'),_0xa47f('0x38'),_0xa47f('0x39'),_0xa47f('0x3a'),_0xa47f('0x3b'),'faxPause',_0xa47f('0x3c'),_0xa47f('0x3d'),_0xa47f('0x3e'),_0xa47f('0x3f'),_0xa47f('0x40')]})[_0xa47f('0x13')](function(_0x5d5dfc){if(!_0x5d5dfc){throw new Error(util[_0xa47f('0x26')](_0xa47f('0x41'),_0x11a630[_0xa47f('0x42')]['id']));}return _0x5d5dfc['unpause'](_0x11a630[_0xa47f('0x2e')][_0xa47f('0x34')],'system');})[_0xa47f('0x13')](function(_0x40e466){_0x5f3ae6(_0x40e466);})[_0xa47f('0x17')](function(_0x5084ac){_0x3ed0b4(_0x28fe4f[_0xa47f('0x18')](0x1f4,_0x5084ac['message']));});});};exports[_0xa47f('0x43')]=function(_0xec1e2e){var _0x47c78d=this;return new Promise(function(_0x4556e2,_0x4e5b3c){var _0x5799ce;return db['User'][_0xa47f('0x37')]({'where':_0xec1e2e['options'][_0xa47f('0xe')]||{},'attributes':['id','name']})[_0xa47f('0x13')](function(_0x460e8e){if(_0x460e8e){_0x5799ce=_0x460e8e;return db[_0xa47f('0x1f')][_0xa47f('0x44')]({'where':{'membername':_0x5799ce[_0xa47f('0x23')]},'individualHooks':!![]});}})[_0xa47f('0x13')](function(){if(_0x5799ce){return db[_0xa47f('0x21')][_0xa47f('0x22')]({'where':{'membername':_0x5799ce[_0xa47f('0x23')],'exitAt':null}});}})['then'](function(_0x42e79e){if(_0x5799ce){if(_0x42e79e&&_0x42e79e[_0xa47f('0x25')]){var _0x2c837d=[];_0x42e79e[_0xa47f('0x2a')](function(_0x3f31d1){_0x2c837d['push'](_0x3f31d1[_0xa47f('0x20')]({'exitAt':moment()[_0xa47f('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xa47f('0x45')](_0x2c837d);}}})['then'](function(){if(_0x5799ce){return _0x5799ce[_0xa47f('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa47f('0x13')](function(_0x452ab7){_0x4556e2(_0x452ab7);})[_0xa47f('0x17')](function(_0x587030){_0x4e5b3c(_0x47c78d[_0xa47f('0x18')](0x1f4,_0x587030[_0xa47f('0x1b')]));});});};exports[_0xa47f('0x46')]=function(_0x183ecb){var _0x460fe3=this;return new Promise(function(_0x33a5a3,_0x48082a){var _0x42c343;var _0x40ee3e;var _0x35a184;var _0x4e2649;return db[_0xa47f('0xb')][_0xa47f('0x37')]({'where':_0x183ecb[_0xa47f('0xd')]['where']||{},'attributes':['id',_0xa47f('0x23'),_0xa47f('0x1c'),_0xa47f('0x47'),_0xa47f('0x48'),_0xa47f('0x1d'),_0xa47f('0x49'),_0xa47f('0x1e')]})[_0xa47f('0x13')](function(_0x59d399){if(_0x59d399){_0x42c343=_0x59d399;_0x4e2649=_0x183ecb[_0xa47f('0x2e')][_0xa47f('0x1e')]?_0x183ecb[_0xa47f('0x2e')][_0xa47f('0x1e')]:util['format'](_0xa47f('0x2d'),_0x42c343[_0xa47f('0x23')]);return db[_0xa47f('0xb')][_0xa47f('0x4a')]({'where':{'role':_0xa47f('0x4b'),'online':!![],'id':{'$ne':_0x42c343['id']}}});}})[_0xa47f('0x13')](function(_0x2c2dfc){if(_0x2c2dfc){_0x35a184=_0x2c2dfc;return require(_0xa47f('0x4c'))[_0xa47f('0x4d')]();}})[_0xa47f('0x13')](function(_0x16f959){if(_0x16f959&&_0x16f959[_0xa47f('0x4e')]&&_0x35a184>=_0x16f959[_0xa47f('0x4e')]){throw new Error(_0xa47f('0x4f'));}})[_0xa47f('0x13')](function(){if(_0x42c343){return db[_0xa47f('0x1f')]['destroy']({'where':{'membername':_0x42c343[_0xa47f('0x23')]},'individualHooks':!![]});}})[_0xa47f('0x13')](function(){if(_0x42c343){return _0x42c343['getVoiceQueues']({'raw':!![]});}})[_0xa47f('0x13')](function(_0x1e0258){if(_0x42c343){if(_0x1e0258){var _0x1dadf0=[];_0x40ee3e=_0x1e0258;if(_0x40ee3e[_0xa47f('0x25')]){for(var _0x3267ee=0x0;_0x3267ee<_0x40ee3e[_0xa47f('0x25')];_0x3267ee++){_0x1dadf0['push'](db[_0xa47f('0x1f')][_0xa47f('0x50')]({'membername':_0x42c343[_0xa47f('0x23')],'UserId':_0x42c343['id'],'queue_name':_0x40ee3e[_0x3267ee][_0xa47f('0x23')],'VoiceQueueId':_0x40ee3e[_0x3267ee]['id'],'interface':_0x4e2649,'paused':_0x42c343[_0xa47f('0x49')]||![],'penalty':_0x40ee3e[_0x3267ee][_0xa47f('0x51')]||0x0}));}return BPromise[_0xa47f('0x45')](_0x1dadf0);}}}})[_0xa47f('0x13')](function(){if(_0x42c343){return db['MemberReport'][_0xa47f('0x22')]({'where':{'membername':_0x42c343[_0xa47f('0x23')],'exitAt':null}});}})['then'](function(_0x1952bc){if(_0x42c343){if(_0x1952bc&&_0x1952bc['length']){var _0x23c00f=[];_0x1952bc['forEach'](function(_0x209c2c){_0x23c00f[_0xa47f('0x2b')](_0x209c2c[_0xa47f('0x20')]({'exitAt':moment()[_0xa47f('0x26')](_0xa47f('0x27'))}));});return BPromise['all'](_0x23c00f);}}})[_0xa47f('0x13')](function(){if(_0x42c343){var _0x32a188=[];var _0x5a9eb6=[];var _0xbc713a=utils['getChannels']();var _0x5594e6={'membername':_0x42c343[_0xa47f('0x23')],'interface':_0x4e2649,'enterAt':moment()[_0xa47f('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x42c343[_0xa47f('0x1c')],'internal':_0x42c343[_0xa47f('0x1d')]};_0xbc713a['forEach'](function(_0x425251){_0x32a188[_0xa47f('0x2b')](_['merge']({'channel':_0x425251,'type':'LOGIN','data1':_0xa47f('0x52'),'data2':_0x4e2649},_0x5594e6));if(_0x42c343[_0xa47f('0x49')]){_0x5a9eb6[_0xa47f('0x2b')](_['merge']({'channel':_0x425251,'type':_0xa47f('0x24'),'data1':_0xa47f('0x53')},_0x5594e6));}});return db['MemberReport'][_0xa47f('0x32')](_0x32a188[_0xa47f('0x54')](_0x5a9eb6),{'individualHooks':!![]});}})[_0xa47f('0x13')](function(){if(_0x42c343){return _0x42c343['update']({'online':!![],'lastLoginAt':moment()[_0xa47f('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x42c343[_0xa47f('0x49')]||![],'mailPause':_0x42c343['loginInPause']||![],'chatPause':_0x42c343['loginInPause']||![],'faxPause':_0x42c343[_0xa47f('0x49')]||![],'smsPause':_0x42c343['loginInPause']||![],'openchannelPause':_0x42c343['loginInPause']||![],'pauseType':_0x42c343[_0xa47f('0x49')]?_0xa47f('0x53'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4e2649});}})[_0xa47f('0x13')](function(_0x51f265){_0x33a5a3(_0x51f265);})['catch'](function(_0x70a476){_0x48082a(_0x460fe3['error'](0x1f4,_0x70a476['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b3f6f19..7ed81f7 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 _0x931e=['user:','save','remove','update','emit','register','length'];(function(_0x473a1d,_0x120bd1){var _0x52bd99=function(_0x55b738){while(--_0x55b738){_0x473a1d['push'](_0x473a1d['shift']());}};_0x52bd99(++_0x120bd1);}(_0x931e,0xd3));var _0xe931=function(_0x213956,_0x2c13e6){_0x213956=_0x213956-0x0;var _0x1b61d8=_0x931e[_0x213956];return _0x1b61d8;};'use strict';var UserEvents=require('./user.events');var events=[_0xe931('0x0'),_0xe931('0x1'),_0xe931('0x2')];function createListener(_0x308a56,_0x54f7d3){return function(_0x47e741){_0x54f7d3[_0xe931('0x3')](_0x308a56,_0x47e741);};}function removeListener(_0x499267,_0x42b460){return function(){UserEvents['removeListener'](_0x499267,_0x42b460);};}exports[_0xe931('0x4')]=function(_0x426996){for(var _0x1bd6b7=0x0,_0x276bb8=events[_0xe931('0x5')];_0x1bd6b7<_0x276bb8;_0x1bd6b7++){var _0x44725b=events[_0x1bd6b7];var _0x1b009f=createListener(_0xe931('0x6')+_0x44725b,_0x426996);UserEvents['on'](_0x44725b,_0x1b009f);}}; \ No newline at end of file +var _0xcd6f=['user:','save','update','emit','register','length'];(function(_0x348853,_0x5d3572){var _0x2cfbf5=function(_0x5cc408){while(--_0x5cc408){_0x348853['push'](_0x348853['shift']());}};_0x2cfbf5(++_0x5d3572);}(_0xcd6f,0x19f));var _0xfcd6=function(_0x2d7e4e,_0xaf55ad){_0x2d7e4e=_0x2d7e4e-0x0;var _0x143072=_0xcd6f[_0x2d7e4e];return _0x143072;};'use strict';var UserEvents=require('./user.events');var events=[_0xfcd6('0x0'),'remove',_0xfcd6('0x1')];function createListener(_0x1980e0,_0x3aab0b){return function(_0x4456ad){_0x3aab0b[_0xfcd6('0x2')](_0x1980e0,_0x4456ad);};}function removeListener(_0x102399,_0x2c356b){return function(){UserEvents['removeListener'](_0x102399,_0x2c356b);};}exports[_0xfcd6('0x3')]=function(_0x29cddd){for(var _0x44824c=0x0,_0x688740=events[_0xfcd6('0x4')];_0x44824c<_0x688740;_0x44824c++){var _0x28281a=events[_0x44824c];var _0x1723fa=createListener(_0xfcd6('0x5')+_0x28281a,_0x29cddd);UserEvents['on'](_0x28281a,_0x1723fa);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a5e48c2..3abac40 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3c30b3,_0x2a0fb5){var _0x2b9e75=function(_0x1d4a39){while(--_0x1d4a39){_0x3c30b3['push'](_0x3c30b3['shift']());}};_0x2b9e75(++_0x2a0fb5);}(_0x70e0,0x17b));var _0x070e=function(_0x45fa28,_0x5420d6){_0x45fa28=_0x45fa28-0x0;var _0x4e490a=_0x70e0[_0x45fa28];return _0x4e490a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x526737,_0x47294b){var _0x1087ba=function(_0x5a6b4c){while(--_0x5a6b4c){_0x526737['push'](_0x526737['shift']());}};_0x1087ba(++_0x47294b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xcb91[_0x3e6d5d];return _0x238923;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d047a94..53b81c2 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 _0xbad3=['sequelize','exports','INTEGER'];(function(_0x24980d,_0x31072d){var _0x4ebbd3=function(_0x4d50b6){while(--_0x4d50b6){_0x24980d['push'](_0x24980d['shift']());}};_0x4ebbd3(++_0x31072d);}(_0xbad3,0x13b));var _0x3bad=function(_0x3b1f57,_0x47ea2e){_0x3b1f57=_0x3b1f57-0x0;var _0x88ab38=_0xbad3[_0x3b1f57];return _0x88ab38;};'use strict';var Sequelize=require(_0x3bad('0x0'));module[_0x3bad('0x1')]={'penalty':{'type':Sequelize[_0x3bad('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc954=['INTEGER'];(function(_0x4553d2,_0xe4a0ff){var _0x176f24=function(_0x173850){while(--_0x173850){_0x4553d2['push'](_0x4553d2['shift']());}};_0x176f24(++_0xe4a0ff);}(_0xc954,0x73));var _0x4c95=function(_0x58f97a,_0x532e33){_0x58f97a=_0x58f97a-0x0;var _0x2c6c40=_0xc954[_0x58f97a];return _0x2c6c40;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x4c95('0x0')],'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 c7ba20a..9ebc6f9 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 _0x773f=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0x773f,0xd7));var _0xf773=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x773f[_0x596f6e];return _0x1e0803;};'use strict';var _=require(_0xf773('0x0'));var util=require(_0xf773('0x1'));var logger=require(_0xf773('0x2'))('api');var moment=require(_0xf773('0x3'));var BPromise=require(_0xf773('0x4'));var rp=require(_0xf773('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf773('0x6'));var config=require('../../config/environment');var attributes=require(_0xf773('0x7'));module[_0xf773('0x8')]=function(_0x469eef,_0x169e4b){return _0x469eef[_0xf773('0x9')](_0xf773('0xa'),attributes,{'tableName':_0xf773('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1901=['../../config/environment','define','UserChatQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x361098,_0x56950f){var _0x5f56f9=function(_0x4fc5b2){while(--_0x4fc5b2){_0x361098['push'](_0x361098['shift']());}};_0x5f56f9(++_0x56950f);}(_0x1901,0x6f));var _0x1190=function(_0x14510c,_0x3f66f0){_0x14510c=_0x14510c-0x0;var _0x31c5f8=_0x1901[_0x14510c];return _0x31c5f8;};'use strict';var _=require(_0x1190('0x0'));var util=require(_0x1190('0x1'));var logger=require(_0x1190('0x2'))(_0x1190('0x3'));var moment=require(_0x1190('0x4'));var BPromise=require(_0x1190('0x5'));var rp=require(_0x1190('0x6'));var fs=require('fs');var path=require(_0x1190('0x7'));var rimraf=require(_0x1190('0x8'));var config=require(_0x1190('0x9'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x34c088,_0x3af83b){return _0x34c088[_0x1190('0xa')](_0x1190('0xb'),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 b6a1be7..06f00dc 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 _0xedc3=['http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x49fcca,_0x66d29a){var _0x43ea10=function(_0x217329){while(--_0x217329){_0x49fcca['push'](_0x49fcca['shift']());}};_0x43ea10(++_0x66d29a);}(_0xedc3,0x90));var _0x3edc=function(_0x223e31,_0x221f94){_0x223e31=_0x223e31-0x0;var _0x16a644=_0xedc3[_0x223e31];return _0x16a644;};'use strict';var _=require(_0x3edc('0x0'));var util=require(_0x3edc('0x1'));var moment=require(_0x3edc('0x2'));var BPromise=require(_0x3edc('0x3'));var rs=require(_0x3edc('0x4'));var fs=require('fs');var Redis=require(_0x3edc('0x5'));var db=require(_0x3edc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3edc('0x7'))(_0x3edc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3edc('0x9')][_0x3edc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216c45,_0x5f1c90,_0xb92026){return new BPromise(function(_0x5be4ed,_0x297b6e){return client[_0x3edc('0xb')](_0x216c45,_0xb92026)[_0x3edc('0xc')](function(_0x373e60){logger['info'](_0x3edc('0xd'),_0x5f1c90,_0x3edc('0xe'));logger['debug'](_0x3edc('0xf'),_0x5f1c90,_0x3edc('0xe'),JSON['stringify'](_0x373e60));if(_0x373e60[_0x3edc('0x10')]){if(_0x373e60[_0x3edc('0x10')][_0x3edc('0x11')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5f1c90,_0x373e60[_0x3edc('0x10')]['message']);return _0x297b6e(_0x373e60['error']['message']);}logger[_0x3edc('0x10')](_0x3edc('0xd'),_0x5f1c90,_0x373e60['error'][_0x3edc('0x12')]);return _0x5be4ed(_0x373e60[_0x3edc('0x10')][_0x3edc('0x12')]);}else{logger[_0x3edc('0x13')](_0x3edc('0xd'),_0x5f1c90,_0x3edc('0xe'));_0x5be4ed(_0x373e60[_0x3edc('0x14')][_0x3edc('0x12')]);}})[_0x3edc('0x15')](function(_0x54dd1e){logger['error'](_0x3edc('0xd'),_0x5f1c90,_0x54dd1e);_0x297b6e(_0x54dd1e);});});} \ No newline at end of file +var _0xeb08=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch'];(function(_0x5a0ed0,_0xdd19f3){var _0x3f4c74=function(_0x4fa59f){while(--_0x4fa59f){_0x5a0ed0['push'](_0x5a0ed0['shift']());}};_0x3f4c74(++_0xdd19f3);}(_0xeb08,0xa1));var _0x8eb0=function(_0x597bf3,_0x3a2bd8){_0x597bf3=_0x597bf3-0x0;var _0x4db0db=_0xeb08[_0x597bf3];return _0x4db0db;};'use strict';var _=require(_0x8eb0('0x0'));var util=require(_0x8eb0('0x1'));var moment=require(_0x8eb0('0x2'));var BPromise=require(_0x8eb0('0x3'));var rs=require(_0x8eb0('0x4'));var fs=require('fs');var Redis=require(_0x8eb0('0x5'));var db=require(_0x8eb0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8eb0('0x7'));var jayson=require(_0x8eb0('0x8'));var client=jayson['client'][_0x8eb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32fc10,_0x393b30,_0x48e2da){return new BPromise(function(_0xca09c3,_0x175177){return client[_0x8eb0('0xa')](_0x32fc10,_0x48e2da)[_0x8eb0('0xb')](function(_0x14913a){logger['info'](_0x8eb0('0xc'),_0x393b30,'request\x20sent');logger[_0x8eb0('0xd')](_0x8eb0('0xe'),_0x393b30,'request\x20sent',JSON[_0x8eb0('0xf')](_0x14913a));if(_0x14913a[_0x8eb0('0x10')]){if(_0x14913a[_0x8eb0('0x10')][_0x8eb0('0x11')]===0x1f4){logger[_0x8eb0('0x10')](_0x8eb0('0xc'),_0x393b30,_0x14913a[_0x8eb0('0x10')]['message']);return _0x175177(_0x14913a['error'][_0x8eb0('0x12')]);}logger['error'](_0x8eb0('0xc'),_0x393b30,_0x14913a[_0x8eb0('0x10')][_0x8eb0('0x12')]);return _0xca09c3(_0x14913a[_0x8eb0('0x10')][_0x8eb0('0x12')]);}else{logger[_0x8eb0('0x13')](_0x8eb0('0xc'),_0x393b30,_0x8eb0('0x14'));_0xca09c3(_0x14913a[_0x8eb0('0x15')][_0x8eb0('0x12')]);}})[_0x8eb0('0x16')](function(_0x400b61){logger[_0x8eb0('0x10')](_0x8eb0('0xc'),_0x393b30,_0x400b61);_0x175177(_0x400b61);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 762116e..8a2dc36 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x573389,_0x5be387){var _0x4fc51b=function(_0x43b8c0){while(--_0x43b8c0){_0x573389['push'](_0x573389['shift']());}};_0x4fc51b(++_0x5be387);}(_0xedd9,0xfc));var _0x9edd=function(_0xe2725,_0x41bfd9){_0xe2725=_0xe2725-0x0;var _0x211821=_0xedd9[_0xe2725];return _0x211821;};'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(_0x3a51f0,_0x84e1c7){var _0x11c7c8=function(_0x20253b){while(--_0x20253b){_0x3a51f0['push'](_0x3a51f0['shift']());}};_0x11c7c8(++_0x84e1c7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 9362876..c7794d5 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 _0xbf45=['exports','INTEGER','STRING'];(function(_0x5b3b17,_0x263d3c){var _0x137955=function(_0x1d12b8){while(--_0x1d12b8){_0x5b3b17['push'](_0x5b3b17['shift']());}};_0x137955(++_0x263d3c);}(_0xbf45,0x153));var _0x5bf4=function(_0x45212,_0xa6803){_0x45212=_0x45212-0x0;var _0x42437a=_0xbf45[_0x45212];return _0x42437a;};'use strict';var Sequelize=require('sequelize');module[_0x5bf4('0x0')]={'penalty':{'type':Sequelize[_0x5bf4('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5bf4('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5bf4('0x2')]}}; \ No newline at end of file +var _0x5483=['sequelize','INTEGER','STRING'];(function(_0x569a3d,_0x3b0159){var _0x44c1ad=function(_0x377f23){while(--_0x377f23){_0x569a3d['push'](_0x569a3d['shift']());}};_0x44c1ad(++_0x3b0159);}(_0x5483,0xf3));var _0x3548=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0x5483[_0x3ef45e];return _0x69e7c;};'use strict';var Sequelize=require(_0x3548('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3548('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3548('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1b354c9..a9ac190 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 _0x69ae=['UserFaxQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x5a9340,_0x29e34d){var _0x1d247e=function(_0x2c4933){while(--_0x2c4933){_0x5a9340['push'](_0x5a9340['shift']());}};_0x1d247e(++_0x29e34d);}(_0x69ae,0xdd));var _0xe69a=function(_0x36dd8a,_0x1445e1){_0x36dd8a=_0x36dd8a-0x0;var _0x5bd49f=_0x69ae[_0x36dd8a];return _0x5bd49f;};'use strict';var _=require('lodash');var util=require(_0xe69a('0x0'));var logger=require(_0xe69a('0x1'))(_0xe69a('0x2'));var moment=require(_0xe69a('0x3'));var BPromise=require(_0xe69a('0x4'));var rp=require(_0xe69a('0x5'));var fs=require('fs');var path=require(_0xe69a('0x6'));var rimraf=require(_0xe69a('0x7'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xe69a('0x8')]=function(_0x184dbc,_0x1ea0ef){return _0x184dbc['define'](_0xe69a('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0cd=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','api','moment','bluebird'];(function(_0x2af732,_0x852a76){var _0x2f0a55=function(_0x1e87cd){while(--_0x1e87cd){_0x2af732['push'](_0x2af732['shift']());}};_0x2f0a55(++_0x852a76);}(_0xe0cd,0x1f4));var _0xde0c=function(_0xacc278,_0x364581){_0xacc278=_0xacc278-0x0;var _0x19ade4=_0xe0cd[_0xacc278];return _0x19ade4;};'use strict';var _=require(_0xde0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xde0c('0x1'));var moment=require(_0xde0c('0x2'));var BPromise=require(_0xde0c('0x3'));var rp=require(_0xde0c('0x4'));var fs=require('fs');var path=require(_0xde0c('0x5'));var rimraf=require(_0xde0c('0x6'));var config=require(_0xde0c('0x7'));var attributes=require(_0xde0c('0x8'));module[_0xde0c('0x9')]=function(_0x3471ff,_0x2abfe9){return _0x3471ff[_0xde0c('0xa')](_0xde0c('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 3c10c47..591a882 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 _0x57eb=['request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x1bd184,_0x39948f){var _0x33400d=function(_0x22911e){while(--_0x22911e){_0x1bd184['push'](_0x1bd184['shift']());}};_0x33400d(++_0x39948f);}(_0x57eb,0x134));var _0xb57e=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x57eb[_0x2bb66c];return _0x1e0f98;};'use strict';var _=require('lodash');var util=require(_0xb57e('0x0'));var moment=require('moment');var BPromise=require(_0xb57e('0x1'));var rs=require(_0xb57e('0x2'));var fs=require('fs');var Redis=require(_0xb57e('0x3'));var db=require(_0xb57e('0x4'))['db'];var utils=require(_0xb57e('0x5'));var logger=require('../../config/logger')(_0xb57e('0x6'));var config=require(_0xb57e('0x7'));var jayson=require(_0xb57e('0x8'));var client=jayson['client'][_0xb57e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e27ab,_0x1ae797,_0x12acf7){return new BPromise(function(_0x676972,_0x1825e3){return client['request'](_0x3e27ab,_0x12acf7)['then'](function(_0x22fc81){logger[_0xb57e('0xa')](_0xb57e('0xb'),_0x1ae797,_0xb57e('0xc'));logger[_0xb57e('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1ae797,'request\x20sent',JSON[_0xb57e('0xe')](_0x22fc81));if(_0x22fc81[_0xb57e('0xf')]){if(_0x22fc81[_0xb57e('0xf')][_0xb57e('0x10')]===0x1f4){logger[_0xb57e('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x1ae797,_0x22fc81[_0xb57e('0xf')]['message']);return _0x1825e3(_0x22fc81['error'][_0xb57e('0x11')]);}logger[_0xb57e('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x1ae797,_0x22fc81[_0xb57e('0xf')][_0xb57e('0x11')]);return _0x676972(_0x22fc81[_0xb57e('0xf')]['message']);}else{logger[_0xb57e('0xa')](_0xb57e('0xb'),_0x1ae797,'request\x20sent');_0x676972(_0x22fc81[_0xb57e('0x12')][_0xb57e('0x11')]);}})[_0xb57e('0x13')](function(_0x4e18ae){logger['error'](_0xb57e('0xb'),_0x1ae797,_0x4e18ae);_0x1825e3(_0x4e18ae);});});} \ No newline at end of file +var _0x0925=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x49232e,_0x4fb559){var _0x20504a=function(_0x4a46a8){while(--_0x4a46a8){_0x49232e['push'](_0x49232e['shift']());}};_0x20504a(++_0x4fb559);}(_0x0925,0x1e4));var _0x5092=function(_0x1a3d07,_0x105a71){_0x1a3d07=_0x1a3d07-0x0;var _0xd0058a=_0x0925[_0x1a3d07];return _0xd0058a;};'use strict';var _=require('lodash');var util=require(_0x5092('0x0'));var moment=require(_0x5092('0x1'));var BPromise=require(_0x5092('0x2'));var rs=require(_0x5092('0x3'));var fs=require('fs');var Redis=require(_0x5092('0x4'));var db=require(_0x5092('0x5'))['db'];var utils=require(_0x5092('0x6'));var logger=require(_0x5092('0x7'))(_0x5092('0x8'));var config=require(_0x5092('0x9'));var jayson=require(_0x5092('0xa'));var client=jayson['client'][_0x5092('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fdd7f,_0x48cdf9,_0xe75d58){return new BPromise(function(_0x3dddb7,_0x2abe78){return client['request'](_0x4fdd7f,_0xe75d58)['then'](function(_0x2183e9){logger[_0x5092('0xc')](_0x5092('0xd'),_0x48cdf9,'request\x20sent');logger[_0x5092('0xe')](_0x5092('0xf'),_0x48cdf9,_0x5092('0x10'),JSON[_0x5092('0x11')](_0x2183e9));if(_0x2183e9[_0x5092('0x12')]){if(_0x2183e9['error'][_0x5092('0x13')]===0x1f4){logger[_0x5092('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x48cdf9,_0x2183e9['error'][_0x5092('0x14')]);return _0x2abe78(_0x2183e9[_0x5092('0x12')]['message']);}logger[_0x5092('0x12')](_0x5092('0xd'),_0x48cdf9,_0x2183e9[_0x5092('0x12')][_0x5092('0x14')]);return _0x3dddb7(_0x2183e9[_0x5092('0x12')][_0x5092('0x14')]);}else{logger[_0x5092('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x48cdf9,_0x5092('0x10'));_0x3dddb7(_0x2183e9[_0x5092('0x15')][_0x5092('0x14')]);}})[_0x5092('0x16')](function(_0x14b66d){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x48cdf9,_0x14b66d);_0x2abe78(_0x14b66d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dde941a..9754d66 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x468b0e,_0x5237c4){var _0x106298=function(_0x24b4db){while(--_0x24b4db){_0x468b0e['push'](_0x468b0e['shift']());}};_0x106298(++_0x5237c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x3365e8,_0x32cb9c){_0x3365e8=_0x3365e8-0x0;var _0x163494=_0xedd9[_0x3365e8];return _0x163494;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0f5cbc5..e79f904 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 _0xc69b=['sequelize','exports'];(function(_0xa9fdbc,_0x472843){var _0x3c3ef4=function(_0x46f22a){while(--_0x46f22a){_0xa9fdbc['push'](_0xa9fdbc['shift']());}};_0x3c3ef4(++_0x472843);}(_0xc69b,0x14a));var _0xbc69=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0xc69b[_0x2eac4f];return _0x58f73b;};'use strict';var Sequelize=require(_0xbc69('0x0'));module[_0xbc69('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2da7=['INTEGER','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2da7,0x99));var _0x72da=function(_0x5e819f,_0x4fedce){_0x5e819f=_0x5e819f-0x0;var _0x13bec5=_0x2da7[_0x5e819f];return _0x13bec5;};'use strict';var Sequelize=require(_0x72da('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x72da('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 47af287..7c191d3 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 _0x60b3=['bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','lodash','../../config/logger','api','moment'];(function(_0x1aabff,_0x545391){var _0x1ac9b7=function(_0x354349){while(--_0x354349){_0x1aabff['push'](_0x1aabff['shift']());}};_0x1ac9b7(++_0x545391);}(_0x60b3,0xec));var _0x360b=function(_0x59b9d3,_0x384472){_0x59b9d3=_0x59b9d3-0x0;var _0x171163=_0x60b3[_0x59b9d3];return _0x171163;};'use strict';var _=require(_0x360b('0x0'));var util=require('util');var logger=require(_0x360b('0x1'))(_0x360b('0x2'));var moment=require(_0x360b('0x3'));var BPromise=require(_0x360b('0x4'));var rp=require(_0x360b('0x5'));var fs=require('fs');var path=require(_0x360b('0x6'));var rimraf=require(_0x360b('0x7'));var config=require(_0x360b('0x8'));var attributes=require(_0x360b('0x9'));module['exports']=function(_0x162f7f,_0x3ede40){return _0x162f7f[_0x360b('0xa')](_0x360b('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb09e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues'];(function(_0x5ea740,_0x3adda0){var _0x5b49cf=function(_0x51eb87){while(--_0x51eb87){_0x5ea740['push'](_0x5ea740['shift']());}};_0x5b49cf(++_0x3adda0);}(_0xb09e,0x78));var _0xeb09=function(_0x2f9413,_0xa937d8){_0x2f9413=_0x2f9413-0x0;var _0x499b51=_0xb09e[_0x2f9413];return _0x499b51;};'use strict';var _=require(_0xeb09('0x0'));var util=require(_0xeb09('0x1'));var logger=require(_0xeb09('0x2'))('api');var moment=require(_0xeb09('0x3'));var BPromise=require(_0xeb09('0x4'));var rp=require(_0xeb09('0x5'));var fs=require('fs');var path=require(_0xeb09('0x6'));var rimraf=require('rimraf');var config=require(_0xeb09('0x7'));var attributes=require(_0xeb09('0x8'));module[_0xeb09('0x9')]=function(_0x100664,_0x18da39){return _0x100664[_0xeb09('0xa')]('UserMailQueue',attributes,{'tableName':_0xeb09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 6dcc7e5..fbc3b6c 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x4f7cd8,_0x4d0418){var _0x1c2d76=function(_0x586616){while(--_0x586616){_0x4f7cd8['push'](_0x4f7cd8['shift']());}};_0x1c2d76(++_0x4d0418);}(_0x55ca,0x126));var _0xa55c=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x55ca[_0x459423];return _0x42ed14;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +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(_0x26f401,_0x3efd3a){var _0x590c3d=function(_0x499c3d){while(--_0x499c3d){_0x26f401['push'](_0x26f401['shift']());}};_0x590c3d(++_0x3efd3a);}(_0x3e74,0x175));var _0x43e7=function(_0x471712,_0xa54c3b){_0x471712=_0x471712-0x0;var _0x270ab8=_0x3e74[_0x471712];return _0x270ab8;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ead1233..1ed3af5 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 _0xda8b=['fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','express','Router'];(function(_0x4ca27f,_0x33e173){var _0x5e4cbc=function(_0x5d6a8a){while(--_0x5d6a8a){_0x4ca27f['push'](_0x4ca27f['shift']());}};_0x5e4cbc(++_0x33e173);}(_0xda8b,0x19e));var _0xbda8=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xda8b[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xbda8('0x0'));var util=require(_0xbda8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbda8('0x2'));var router=express[_0xbda8('0x3')]();var fs_extra=require(_0xbda8('0x4'));var auth=require(_0xbda8('0x5'));var interaction=require(_0xbda8('0x6'));var config=require('../../config/environment');var controller=require(_0xbda8('0x7'));router['post']('/',auth[_0xbda8('0x8')](),controller[_0xbda8('0x9')]);module[_0xbda8('0xa')]=router; \ No newline at end of file +var _0x34d5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','exports','multer','util','connect-timeout','express'];(function(_0x2aeb48,_0x417c89){var _0x204bd7=function(_0x5859d0){while(--_0x5859d0){_0x2aeb48['push'](_0x2aeb48['shift']());}};_0x204bd7(++_0x417c89);}(_0x34d5,0xd8));var _0x534d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x34d5[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x534d('0x0'));var util=require(_0x534d('0x1'));var path=require('path');var timeout=require(_0x534d('0x2'));var express=require(_0x534d('0x3'));var router=express['Router']();var fs_extra=require(_0x534d('0x4'));var auth=require(_0x534d('0x5'));var interaction=require(_0x534d('0x6'));var config=require(_0x534d('0x7'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x534d('0x8')](),controller['sendUserNotification']);module[_0x534d('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3e8f95f..5b76d85 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 _0x7e36=['STRING','BOOLEAN','exports','TEXT'];(function(_0x1855dd,_0x1a10c1){var _0x4cd60f=function(_0x38d5ec){while(--_0x38d5ec){_0x1855dd['push'](_0x1855dd['shift']());}};_0x4cd60f(++_0x1a10c1);}(_0x7e36,0x11a));var _0x67e3=function(_0x265773,_0x5d1b6e){_0x265773=_0x265773-0x0;var _0x4ed75d=_0x7e36[_0x265773];return _0x4ed75d;};'use strict';var Sequelize=require('sequelize');module[_0x67e3('0x0')]={'body':{'type':Sequelize[_0x67e3('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x67e3('0x1')]},'recipientsDescription':{'type':Sequelize[_0x67e3('0x2')]},'beep':{'type':Sequelize[_0x67e3('0x3')]}}; \ No newline at end of file +var _0x8904=['STRING','TEXT'];(function(_0x2eb4c6,_0x2f6ad9){var _0x2f7a94=function(_0x52fc10){while(--_0x52fc10){_0x2eb4c6['push'](_0x2eb4c6['shift']());}};_0x2f7a94(++_0x2f6ad9);}(_0x8904,0x1b5));var _0x4890=function(_0x541f26,_0x202ea7){_0x541f26=_0x541f26-0x0;var _0x9aec7=_0x8904[_0x541f26];return _0x9aec7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4890('0x0')]},'senderName':{'type':Sequelize[_0x4890('0x1')]},'recipientsId':{'type':Sequelize[_0x4890('0x0')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 1bc7992..dba21df 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 _0x176a=['send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','user','some','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','transaction','UserNotification','forEach','emit','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','ids','includes','queue','replace','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x176a,0xf3));var _0xa176=function(_0x21d410,_0x237e8b){_0x21d410=_0x21d410-0x0;var _0x1d19be=_0x176a[_0x21d410];return _0x1d19be;};'use strict';var emlformat=require(_0xa176('0x0'));var rimraf=require(_0xa176('0x1'));var zipdir=require(_0xa176('0x2'));var jsonpatch=require(_0xa176('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa176('0x4'));var Mustache=require(_0xa176('0x5'));var util=require(_0xa176('0x6'));var path=require(_0xa176('0x7'));var sox=require(_0xa176('0x8'));var csv=require(_0xa176('0x9'));var ejs=require(_0xa176('0xa'));var fs=require('fs');var fs_extra=require(_0xa176('0xb'));var _=require('lodash');var squel=require(_0xa176('0xc'));var crypto=require(_0xa176('0xd'));var jsforce=require(_0xa176('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa176('0x9'));var querystring=require(_0xa176('0xf'));var Papa=require('papaparse');var Redis=require(_0xa176('0x10'));var authService=require(_0xa176('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa176('0x12'));var hardwareService=require(_0xa176('0x13'));var logger=require('../../config/logger')(_0xa176('0x14'));var utils=require(_0xa176('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa176('0x16'))['db'];config[_0xa176('0x17')]=_[_0xa176('0x18')](config[_0xa176('0x17')],{'host':_0xa176('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa176('0x17')]));require(_0xa176('0x1a'))[_0xa176('0x1b')](socket);function respondWithStatusCode(_0x529206,_0x12a88c){_0x12a88c=_0x12a88c||0xcc;return function(_0x53c701){if(_0x53c701){return _0x529206[_0xa176('0x1c')](_0x12a88c);}return _0x529206[_0xa176('0x1d')](_0x12a88c)[_0xa176('0x1e')]();};}function respondWithResult(_0x2a9195,_0x58b980){_0x58b980=_0x58b980||0xc8;return function(_0x6a91ab){if(_0x6a91ab){return _0x2a9195[_0xa176('0x1d')](_0x58b980)[_0xa176('0x1f')](_0x6a91ab);}};}function respondWithFilteredResult(_0x1187a3,_0x3e8fc8){return function(_0x2c21d6){if(_0x2c21d6){var _0x16465c=typeof _0x3e8fc8[_0xa176('0x20')]==='undefined'&&typeof _0x3e8fc8['limit']===_0xa176('0x21');var _0x3632bc=_0x2c21d6[_0xa176('0x22')];var _0x29d002=_0x16465c?0x0:_0x3e8fc8[_0xa176('0x20')];var _0x62df7f=_0x16465c?_0x2c21d6[_0xa176('0x22')]:_0x3e8fc8[_0xa176('0x20')]+_0x3e8fc8[_0xa176('0x23')];var _0x4f7c75;if(_0x62df7f>=_0x3632bc){_0x62df7f=_0x3632bc;_0x4f7c75=0xc8;}else{_0x4f7c75=0xce;}_0x1187a3[_0xa176('0x1d')](_0x4f7c75);return _0x1187a3[_0xa176('0x24')](_0xa176('0x25'),_0x29d002+'-'+_0x62df7f+'/'+_0x3632bc)[_0xa176('0x1f')](_0x2c21d6);}return null;};}function patchUpdates(_0x495cc4){return function(_0x1cb05e){try{jsonpatch['apply'](_0x1cb05e,_0x495cc4,!![]);}catch(_0x4cc41c){return BPromise[_0xa176('0x26')](_0x4cc41c);}return _0x1cb05e[_0xa176('0x27')]();};}function saveUpdates(_0x35a988,_0x4fe655){return function(_0x51a756){if(_0x51a756){return _0x51a756[_0xa176('0x28')](_0x35a988)[_0xa176('0x29')](function(_0x19053b){return _0x19053b;});}return null;};}function removeEntity(_0x4e2b8e,_0x390a8b){return function(_0x1504d4){if(_0x1504d4){return _0x1504d4['destroy']()['then'](function(){_0x4e2b8e['status'](0xcc)[_0xa176('0x1e')]();});}};}function handleEntityNotFound(_0x21f047,_0x37a36e){return function(_0x16ecf5){if(!_0x16ecf5){_0x21f047[_0xa176('0x1c')](0x194);}return _0x16ecf5;};}function handleError(_0x283fed,_0x43022f){_0x43022f=_0x43022f||0x1f4;return function(_0x1eca4f){logger[_0xa176('0x2a')](_0x1eca4f[_0xa176('0x2b')]);if(_0x1eca4f[_0xa176('0x2c')]){delete _0x1eca4f['name'];}_0x283fed['status'](_0x43022f)[_0xa176('0x2d')](_0x1eca4f);};}exports[_0xa176('0x2e')]=function(_0x99f6cf,_0x39f4bb,_0x50afc6){if(!_0x99f6cf['body'][_0xa176('0x2f')](_0xa176('0x30'))&&!_0x99f6cf[_0xa176('0x31')][_0xa176('0x2f')](_0xa176('0x32'))){throw new db[(_0xa176('0x33'))][(_0xa176('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x99f6cf[_0xa176('0x31')][_0xa176('0x2f')]('TemplateId')&&!_0x99f6cf['body'][_0xa176('0x2f')](_0xa176('0x35'))){throw new db[(_0xa176('0x33'))][(_0xa176('0x34'))](_0xa176('0x36'));}if(!_0x99f6cf['body'][_0xa176('0x2f')]('recipients')){throw new db[(_0xa176('0x33'))][(_0xa176('0x34'))](_0xa176('0x37'));}else{try{var _0x483080=JSON[_0xa176('0x38')](_0x99f6cf[_0xa176('0x31')][_0xa176('0x39')]);}catch(_0x30bb00){logger[_0xa176('0x2a')](_0x30bb00);throw new db[(_0xa176('0x33'))][(_0xa176('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x42789c=[_0xa176('0x3a'),_0xa176('0x3b'),_0xa176('0x3c'),_0xa176('0x3d'),'smsqueue',_0xa176('0x3e'),'whatsappqueue','team',_0xa176('0x3f')];if(_[_0xa176('0x40')](_0x483080,function(_0xaa6213){return!_['includes'](_0x42789c,_0xaa6213[_0xa176('0x41')][_0xa176('0x42')]());})){throw new db[(_0xa176('0x33'))][(_0xa176('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x1f9ead={};_0x1f9ead[_0xa176('0x43')]=_0x99f6cf[_0xa176('0x31')][_0xa176('0x2f')](_0xa176('0x43'))?_0x99f6cf['body'][_0xa176('0x43')]:_0x99f6cf['user']['fullname'];_0x1f9ead[_0xa176('0x44')]=_[_0xa176('0x45')](_0x99f6cf['body'][_0xa176('0x44')])?null:_0x99f6cf[_0xa176('0x31')][_0xa176('0x44')];_0x1f9ead[_0xa176('0x46')]=_0x99f6cf[_0xa176('0x31')][_0xa176('0x46')]||![];_0x1f9ead[_0xa176('0x47')]=_0x99f6cf[_0xa176('0x3f')]['id'];return getContent(_0x99f6cf['body'])[_0xa176('0x29')](function(_0x4270b9){_0x1f9ead[_0xa176('0x31')]=_0x4270b9;return getRecipients(_0x483080);})[_0xa176('0x29')](function(_0x2e41c0){_0x1f9ead['recipientsId']=_[_0xa176('0x48')](_0x2e41c0)['join'](',');return db[_0xa176('0x49')][_0xa176('0x4a')](function(_0x5ee238){return db[_0xa176('0x4b')]['create'](_0x1f9ead,{'raw':!![],'transaction':_0x5ee238})['then'](function(_0xb46caf){var _0xce545={'sender':_0x1f9ead['senderName'],'description':_0x1f9ead[_0xa176('0x44')],'content':_0x1f9ead[_0xa176('0x31')],'beep':_0x1f9ead['beep']};_0x2e41c0[_0xa176('0x4c')](function(_0x7c6a30){_0xce545['recipient']=_0x7c6a30;socket[_0xa176('0x4d')](_0xa176('0x4e'),_0xce545);});return _0xb46caf;});});})[_0xa176('0x29')](respondWithResult(_0x39f4bb,0xc9))['catch'](handleError(_0x39f4bb,null));};function getContent(_0x274266){return new BPromise(function(_0x5030c9,_0x423ed0){if(_0x274266[_0xa176('0x30')]){_0x5030c9(_0x274266[_0xa176('0x30')]);return;}return db[_0xa176('0x4f')][_0xa176('0x50')]({'attributes':[_0xa176('0x51')],'where':{'id':_0x274266[_0xa176('0x32')]},'raw':!![]})[_0xa176('0x29')](function(_0x10f35c){if(!_0x10f35c)throw new db[(_0xa176('0x33'))][(_0xa176('0x34'))](_0xa176('0x52'));var _0x5164d1=Mustache[_0xa176('0x53')](_0x10f35c[_0xa176('0x51')],_0x274266['view']);_0x5030c9(_0x5164d1);})[_0xa176('0x54')](function(_0x4c7260){_0x423ed0(_0x4c7260);});});}function getRecipients(_0xf67d8f){return new BPromise(function(_0x267812,_0x57bd1b){var _0x57212d=[];var _0x2e338d=[];_0xf67d8f[_0xa176('0x4c')](function(_0x1d93b6){var _0x7bb016=_[_0xa176('0x55')](_0x1d93b6[_0xa176('0x41')][_0xa176('0x42')]());if(_0x7bb016===_0xa176('0x56')){_0x57212d=_['union'](_0x57212d,_0x1d93b6[_0xa176('0x57')]);}else{if(_[_0xa176('0x58')](_0x7bb016,_0xa176('0x59')))_0x7bb016=_0x7bb016[_0xa176('0x5a')]('queue','Queue');_0x1d93b6[_0xa176('0x57')][_0xa176('0x4c')](function(_0xe5c07d){_0x2e338d[_0xa176('0x5b')](getAgents(_0x7bb016,_0xe5c07d));});}});return BPromise[_0xa176('0x5c')](_0x2e338d)[_0xa176('0x29')](function(_0x552eb3){_0x57212d=_['union'](_0x57212d,_[_0xa176('0x5d')](_0x552eb3));_0x267812(_0x57212d);})[_0xa176('0x54')](function(_0x259bbc){_0x57bd1b(_0x259bbc);});});}function getAgents(_0x3baa13,_0x3b52e7){return new BPromise(function(_0x3b3d99,_0x465b54){return db[_0x3baa13]['findOne']({'where':{'id':_0x3b52e7}})[_0xa176('0x29')](function(_0x3d02b5){return _0x3d02b5[_0xa176('0x5e')]({'attributes':['id'],'raw':!![]})[_0xa176('0x29')](function(_0xb84ce2){var _0x4745fa=_[_0xa176('0x5f')](_0xb84ce2,'id');_0x3b3d99(_0x4745fa);});})[_0xa176('0x54')](function(_0x5e44e3){_0x465b54(_0x5e44e3);});});} \ No newline at end of file +var _0x035f=['SenderId','recipientsId','join','transaction','UserNotification','forEach','recipient','emit','catch','text','html','TemplateId','startCase','model','User','union','ids','queue','replace','Queue','push','flatten','findOne','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','stack','name','hasOwnProperty','body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','smsqueue','voicequeue','whatsappqueue','team','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x035f,0x120));var _0xf035=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x035f[_0x148c09];return _0x18e613;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf035('0x0'));var zipdir=require(_0xf035('0x1'));var jsonpatch=require(_0xf035('0x2'));var rp=require(_0xf035('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf035('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf035('0x5'));var csv=require(_0xf035('0x6'));var ejs=require(_0xf035('0x7'));var fs=require('fs');var fs_extra=require(_0xf035('0x8'));var _=require(_0xf035('0x9'));var squel=require('squel');var crypto=require(_0xf035('0xa'));var jsforce=require(_0xf035('0xb'));var deskjs=require(_0xf035('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf035('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf035('0xe'));var hardwareService=require(_0xf035('0xf'));var logger=require('../../config/logger')(_0xf035('0x10'));var utils=require(_0xf035('0x11'));var config=require(_0xf035('0x12'));var licenseUtil=require(_0xf035('0x13'));var db=require(_0xf035('0x14'))['db'];config['redis']=_[_0xf035('0x15')](config[_0xf035('0x16')],{'host':_0xf035('0x17'),'port':0x18eb});var socket=require(_0xf035('0x18'))(new Redis(config['redis']));require(_0xf035('0x19'))[_0xf035('0x1a')](socket);function respondWithStatusCode(_0x358618,_0x56099f){_0x56099f=_0x56099f||0xcc;return function(_0x1ea2c4){if(_0x1ea2c4){return _0x358618[_0xf035('0x1b')](_0x56099f);}return _0x358618[_0xf035('0x1c')](_0x56099f)[_0xf035('0x1d')]();};}function respondWithResult(_0x5c11cc,_0x1e007f){_0x1e007f=_0x1e007f||0xc8;return function(_0x5138f6){if(_0x5138f6){return _0x5c11cc[_0xf035('0x1c')](_0x1e007f)[_0xf035('0x1e')](_0x5138f6);}};}function respondWithFilteredResult(_0x455ab6,_0x3807db){return function(_0x12b117){if(_0x12b117){var _0x2b80cb=typeof _0x3807db[_0xf035('0x1f')]===_0xf035('0x20')&&typeof _0x3807db['limit']===_0xf035('0x20');var _0x8f4327=_0x12b117[_0xf035('0x21')];var _0x484738=_0x2b80cb?0x0:_0x3807db['offset'];var _0x1ef154=_0x2b80cb?_0x12b117['count']:_0x3807db['offset']+_0x3807db[_0xf035('0x22')];var _0x5ca2e2;if(_0x1ef154>=_0x8f4327){_0x1ef154=_0x8f4327;_0x5ca2e2=0xc8;}else{_0x5ca2e2=0xce;}_0x455ab6['status'](_0x5ca2e2);return _0x455ab6[_0xf035('0x23')](_0xf035('0x24'),_0x484738+'-'+_0x1ef154+'/'+_0x8f4327)['json'](_0x12b117);}return null;};}function patchUpdates(_0x5327a5){return function(_0xd8f497){try{jsonpatch[_0xf035('0x25')](_0xd8f497,_0x5327a5,!![]);}catch(_0x5c5aec){return BPromise['reject'](_0x5c5aec);}return _0xd8f497['save']();};}function saveUpdates(_0x435dae,_0x5868e3){return function(_0x128469){if(_0x128469){return _0x128469[_0xf035('0x26')](_0x435dae)[_0xf035('0x27')](function(_0x5c434e){return _0x5c434e;});}return null;};}function removeEntity(_0x12178a,_0x50bcf3){return function(_0xd5e04b){if(_0xd5e04b){return _0xd5e04b['destroy']()['then'](function(){_0x12178a['status'](0xcc)[_0xf035('0x1d')]();});}};}function handleEntityNotFound(_0x3b76db,_0x5674b0){return function(_0x2ac5d5){if(!_0x2ac5d5){_0x3b76db[_0xf035('0x1b')](0x194);}return _0x2ac5d5;};}function handleError(_0x5e0d2f,_0x32b327){_0x32b327=_0x32b327||0x1f4;return function(_0x47e28f){logger['error'](_0x47e28f[_0xf035('0x28')]);if(_0x47e28f[_0xf035('0x29')]){delete _0x47e28f[_0xf035('0x29')];}_0x5e0d2f[_0xf035('0x1c')](_0x32b327)['send'](_0x47e28f);};}exports['sendUserNotification']=function(_0xe0f222,_0x107b37,_0x4a37af){if(!_0xe0f222['body'][_0xf035('0x2a')]('text')&&!_0xe0f222[_0xf035('0x2b')][_0xf035('0x2a')]('TemplateId')){throw new db[(_0xf035('0x2c'))][(_0xf035('0x2d'))](_0xf035('0x2e'));}else{if(_0xe0f222['body'][_0xf035('0x2a')]('TemplateId')&&!_0xe0f222[_0xf035('0x2b')][_0xf035('0x2a')](_0xf035('0x2f'))){throw new db[(_0xf035('0x2c'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0xe0f222[_0xf035('0x2b')]['hasOwnProperty'](_0xf035('0x30'))){throw new db[(_0xf035('0x2c'))]['ValidationError'](_0xf035('0x31'));}else{try{var _0x4357b9=JSON[_0xf035('0x32')](_0xe0f222[_0xf035('0x2b')]['recipients']);}catch(_0xb970c3){logger[_0xf035('0x33')](_0xb970c3);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x2e231a=['chatqueue','faxqueue','mailqueue','openchannelqueue',_0xf035('0x34'),_0xf035('0x35'),_0xf035('0x36'),_0xf035('0x37'),_0xf035('0x38')];if(_['some'](_0x4357b9,function(_0x46f882){return!_[_0xf035('0x39')](_0x2e231a,_0x46f882['model'][_0xf035('0x3a')]());})){throw new db['Sequelize'][(_0xf035('0x2d'))](_0xf035('0x3b'));}}}var _0x4bb219={};_0x4bb219[_0xf035('0x3c')]=_0xe0f222[_0xf035('0x2b')][_0xf035('0x2a')](_0xf035('0x3c'))?_0xe0f222[_0xf035('0x2b')][_0xf035('0x3c')]:_0xe0f222[_0xf035('0x38')][_0xf035('0x3d')];_0x4bb219['recipientsDescription']=_['isEmpty'](_0xe0f222[_0xf035('0x2b')][_0xf035('0x3e')])?null:_0xe0f222[_0xf035('0x2b')][_0xf035('0x3e')];_0x4bb219[_0xf035('0x3f')]=_0xe0f222[_0xf035('0x2b')][_0xf035('0x3f')]||![];_0x4bb219[_0xf035('0x40')]=_0xe0f222[_0xf035('0x38')]['id'];return getContent(_0xe0f222['body'])[_0xf035('0x27')](function(_0x31888d){_0x4bb219[_0xf035('0x2b')]=_0x31888d;return getRecipients(_0x4357b9);})[_0xf035('0x27')](function(_0x3b2bbb){_0x4bb219[_0xf035('0x41')]=_['sortBy'](_0x3b2bbb)[_0xf035('0x42')](',');return db['sequelize'][_0xf035('0x43')](function(_0x5c571d){return db[_0xf035('0x44')]['create'](_0x4bb219,{'raw':!![],'transaction':_0x5c571d})[_0xf035('0x27')](function(_0xa07e74){var _0x290ae1={'sender':_0x4bb219[_0xf035('0x3c')],'description':_0x4bb219[_0xf035('0x3e')],'content':_0x4bb219[_0xf035('0x2b')],'beep':_0x4bb219['beep']};_0x3b2bbb[_0xf035('0x45')](function(_0x14a775){_0x290ae1[_0xf035('0x46')]=_0x14a775;socket[_0xf035('0x47')]('userNotification:send',_0x290ae1);});return _0xa07e74;});});})['then'](respondWithResult(_0x107b37,0xc9))[_0xf035('0x48')](handleError(_0x107b37,null));};function getContent(_0x1e3e3f){return new BPromise(function(_0x4ee12e,_0x11b729){if(_0x1e3e3f[_0xf035('0x49')]){_0x4ee12e(_0x1e3e3f['text']);return;}return db['Template']['findOne']({'attributes':[_0xf035('0x4a')],'where':{'id':_0x1e3e3f[_0xf035('0x4b')]},'raw':!![]})['then'](function(_0x39c578){if(!_0x39c578)throw new db[(_0xf035('0x2c'))][(_0xf035('0x2d'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2d19d5=Mustache['render'](_0x39c578[_0xf035('0x4a')],_0x1e3e3f[_0xf035('0x2f')]);_0x4ee12e(_0x2d19d5);})[_0xf035('0x48')](function(_0x3089af){_0x11b729(_0x3089af);});});}function getRecipients(_0x3c552b){return new BPromise(function(_0xc44a55,_0x3b03b1){var _0x4a059f=[];var _0x3792f0=[];_0x3c552b[_0xf035('0x45')](function(_0x9d5bc2){var _0xe736d1=_[_0xf035('0x4c')](_0x9d5bc2[_0xf035('0x4d')][_0xf035('0x3a')]());if(_0xe736d1===_0xf035('0x4e')){_0x4a059f=_[_0xf035('0x4f')](_0x4a059f,_0x9d5bc2[_0xf035('0x50')]);}else{if(_[_0xf035('0x39')](_0xe736d1,_0xf035('0x51')))_0xe736d1=_0xe736d1[_0xf035('0x52')]('queue',_0xf035('0x53'));_0x9d5bc2[_0xf035('0x50')]['forEach'](function(_0x100c5c){_0x3792f0[_0xf035('0x54')](getAgents(_0xe736d1,_0x100c5c));});}});return BPromise['all'](_0x3792f0)[_0xf035('0x27')](function(_0x595b8e){_0x4a059f=_[_0xf035('0x4f')](_0x4a059f,_[_0xf035('0x55')](_0x595b8e));_0xc44a55(_0x4a059f);})['catch'](function(_0xc94d33){_0x3b03b1(_0xc94d33);});});}function getAgents(_0x3b4047,_0x12962d){return new BPromise(function(_0xc529fc,_0x2730de){return db[_0x3b4047][_0xf035('0x56')]({'where':{'id':_0x12962d}})[_0xf035('0x27')](function(_0x4a6665){return _0x4a6665[_0xf035('0x57')]({'attributes':['id'],'raw':!![]})[_0xf035('0x27')](function(_0x21c0ff){var _0x1bbcd0=_['map'](_0x21c0ff,'id');_0xc529fc(_0x1bbcd0);});})[_0xf035('0x48')](function(_0x2256ce){_0x2730de(_0x2256ce);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 80aa4ff..4e7b5a2 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 _0x25aa=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','save','update','remove'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x25aa,0xb8));var _0xa25a=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x25aa[_0x47e93d];return _0xe86c46;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xa25a('0x0'))['db'][_0xa25a('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa25a('0x2'),'afterUpdate':_0xa25a('0x3'),'afterDestroy':_0xa25a('0x4')};function emitEvent(_0x550563){return function(_0x56a7ec,_0x450be6,_0x1c932a){UserNotificationEvents[_0xa25a('0x5')](_0x550563+':'+_0x56a7ec['id'],_0x56a7ec);UserNotificationEvents['emit'](_0x550563,_0x56a7ec);_0x1c932a(null);};}for(var e in events){if(events[_0xa25a('0x6')](e)){var event=events[e];UserNotification[_0xa25a('0x7')](e,emitEvent(event));}}module[_0xa25a('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xdc28=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','update','remove'];(function(_0x261c3d,_0x3965c3){var _0xb3f119=function(_0x27ede6){while(--_0x27ede6){_0x261c3d['push'](_0x261c3d['shift']());}};_0xb3f119(++_0x3965c3);}(_0xdc28,0xd6));var _0x8dc2=function(_0x2e10bd,_0x5ece63){_0x2e10bd=_0x2e10bd-0x0;var _0x441b4c=_0xdc28[_0x2e10bd];return _0x441b4c;};'use strict';var EventEmitter=require(_0x8dc2('0x0'));var UserNotification=require(_0x8dc2('0x1'))['db'][_0x8dc2('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8dc2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8dc2('0x4'),'afterDestroy':_0x8dc2('0x5')};function emitEvent(_0x91747e){return function(_0x41bfef,_0x3caba5,_0x17c230){UserNotificationEvents[_0x8dc2('0x6')](_0x91747e+':'+_0x41bfef['id'],_0x41bfef);UserNotificationEvents['emit'](_0x91747e,_0x41bfef);_0x17c230(null);};}for(var e in events){if(events[_0x8dc2('0x7')](e)){var event=events[e];UserNotification[_0x8dc2('0x8')](e,emitEvent(event));}}module[_0x8dc2('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 5092ac3..972d2b3 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 _0x3611=['../../config/environment','exports','define','userNotifications','lodash','api','request-promise','path','rimraf'];(function(_0x51da53,_0x1a7de8){var _0x40602d=function(_0x36c1b6){while(--_0x36c1b6){_0x51da53['push'](_0x51da53['shift']());}};_0x40602d(++_0x1a7de8);}(_0x3611,0x136));var _0x1361=function(_0xca5ed6,_0x4ded39){_0xca5ed6=_0xca5ed6-0x0;var _0x42fd10=_0x3611[_0xca5ed6];return _0x42fd10;};'use strict';var _=require(_0x1361('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1361('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1361('0x2'));var fs=require('fs');var path=require(_0x1361('0x3'));var rimraf=require(_0x1361('0x4'));var config=require(_0x1361('0x5'));var attributes=require('./userNotification.attributes');module[_0x1361('0x6')]=function(_0x304832,_0x5aa5dc){return _0x304832[_0x1361('0x7')]('UserNotification',attributes,{'tableName':_0x1361('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe866=['request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','moment','bluebird'];(function(_0x472361,_0x8a0c5){var _0x21b489=function(_0x5e34ad){while(--_0x5e34ad){_0x472361['push'](_0x472361['shift']());}};_0x21b489(++_0x8a0c5);}(_0xe866,0x17d));var _0x6e86=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe866[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x6e86('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6e86('0x1'));var BPromise=require(_0x6e86('0x2'));var rp=require(_0x6e86('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e86('0x4'));var config=require(_0x6e86('0x5'));var attributes=require(_0x6e86('0x6'));module[_0x6e86('0x7')]=function(_0x410187,_0x2a92ca){return _0x410187[_0x6e86('0x8')](_0x6e86('0x9'),attributes,{'tableName':_0x6e86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6e86('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 53e0ba0..8a14ba4 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 _0x1442=['defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x2c5435,_0x1bbff8){var _0x1f7ffe=function(_0x5c6ac3){while(--_0x5c6ac3){_0x2c5435['push'](_0x2c5435['shift']());}};_0x1f7ffe(++_0x1bbff8);}(_0x1442,0x86));var _0x2144=function(_0x222f89,_0x33159c){_0x222f89=_0x222f89-0x0;var _0x1aefaa=_0x1442[_0x222f89];return _0x1aefaa;};'use strict';var _=require('lodash');var util=require(_0x2144('0x0'));var moment=require(_0x2144('0x1'));var BPromise=require(_0x2144('0x2'));var rs=require(_0x2144('0x3'));var fs=require('fs');var Redis=require(_0x2144('0x4'));var db=require(_0x2144('0x5'))['db'];var utils=require(_0x2144('0x6'));var logger=require('../../config/logger')(_0x2144('0x7'));var config=require('../../config/environment');var jayson=require(_0x2144('0x8'));var client=jayson[_0x2144('0x9')][_0x2144('0xa')]({'port':0x232a});config['redis']=_[_0x2144('0xb')](config[_0x2144('0xc')],{'host':_0x2144('0xd'),'port':0x18eb});var socket=require(_0x2144('0xe'))(new Redis(config['redis']));require('./userNotification.socket')[_0x2144('0xf')](socket);function respondWithRpcPromise(_0x5e1ca7,_0x4aba3d,_0x55b7a1){return new BPromise(function(_0x124f3c,_0x331d7d){return client[_0x2144('0x10')](_0x5e1ca7,_0x55b7a1)[_0x2144('0x11')](function(_0x2e66c9){logger[_0x2144('0x12')](_0x2144('0x13'),_0x4aba3d,_0x2144('0x14'));logger[_0x2144('0x15')](_0x2144('0x16'),_0x4aba3d,_0x2144('0x14'),JSON[_0x2144('0x17')](_0x2e66c9));if(_0x2e66c9[_0x2144('0x18')]){if(_0x2e66c9[_0x2144('0x18')][_0x2144('0x19')]===0x1f4){logger[_0x2144('0x18')](_0x2144('0x13'),_0x4aba3d,_0x2e66c9[_0x2144('0x18')]['message']);return _0x331d7d(_0x2e66c9[_0x2144('0x18')][_0x2144('0x1a')]);}logger['error'](_0x2144('0x13'),_0x4aba3d,_0x2e66c9['error'][_0x2144('0x1a')]);return _0x124f3c(_0x2e66c9[_0x2144('0x18')][_0x2144('0x1a')]);}else{logger[_0x2144('0x12')](_0x2144('0x13'),_0x4aba3d,_0x2144('0x14'));_0x124f3c(_0x2e66c9[_0x2144('0x1b')][_0x2144('0x1a')]);}})[_0x2144('0x1c')](function(_0x14e001){logger[_0x2144('0x18')](_0x2144('0x13'),_0x4aba3d,_0x14e001);_0x331d7d(_0x14e001);});});} \ No newline at end of file +var _0x58b1=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userNotification.socket','register','request','info','request\x20sent','debug','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x58b1,0xb7));var _0x158b=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x58b1[_0x1f8053];return _0x174fd8;};'use strict';var _=require(_0x158b('0x0'));var util=require('util');var moment=require(_0x158b('0x1'));var BPromise=require(_0x158b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x158b('0x3'));var db=require(_0x158b('0x4'))['db'];var utils=require(_0x158b('0x5'));var logger=require(_0x158b('0x6'))(_0x158b('0x7'));var config=require(_0x158b('0x8'));var jayson=require(_0x158b('0x9'));var client=jayson[_0x158b('0xa')]['http']({'port':0x232a});config[_0x158b('0xb')]=_['defaults'](config[_0x158b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x158b('0xc'))(new Redis(config['redis']));require(_0x158b('0xd'))[_0x158b('0xe')](socket);function respondWithRpcPromise(_0x211e44,_0x1fdccd,_0x44a5ad){return new BPromise(function(_0x5ea016,_0x59dd58){return client[_0x158b('0xf')](_0x211e44,_0x44a5ad)['then'](function(_0x133f3f){logger[_0x158b('0x10')]('UserNotification,\x20%s,\x20%s',_0x1fdccd,_0x158b('0x11'));logger[_0x158b('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x1fdccd,_0x158b('0x11'),JSON[_0x158b('0x13')](_0x133f3f));if(_0x133f3f[_0x158b('0x14')]){if(_0x133f3f[_0x158b('0x14')][_0x158b('0x15')]===0x1f4){logger[_0x158b('0x14')](_0x158b('0x16'),_0x1fdccd,_0x133f3f['error'][_0x158b('0x17')]);return _0x59dd58(_0x133f3f['error']['message']);}logger[_0x158b('0x14')](_0x158b('0x16'),_0x1fdccd,_0x133f3f[_0x158b('0x14')]['message']);return _0x5ea016(_0x133f3f[_0x158b('0x14')][_0x158b('0x17')]);}else{logger[_0x158b('0x10')](_0x158b('0x16'),_0x1fdccd,_0x158b('0x11'));_0x5ea016(_0x133f3f[_0x158b('0x18')][_0x158b('0x17')]);}})[_0x158b('0x19')](function(_0xda0be2){logger[_0x158b('0x14')](_0x158b('0x16'),_0x1fdccd,_0xda0be2);_0x59dd58(_0xda0be2);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5ef2d41..76638fa 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 _0x365c=['./userNotification.events','remove','update','emit','register','length','userNotification:'];(function(_0x3a982f,_0x5cd1e4){var _0x5bee30=function(_0x5f5d67){while(--_0x5f5d67){_0x3a982f['push'](_0x3a982f['shift']());}};_0x5bee30(++_0x5cd1e4);}(_0x365c,0x1e3));var _0xc365=function(_0x29cc9d,_0x19a8e3){_0x29cc9d=_0x29cc9d-0x0;var _0x4a31be=_0x365c[_0x29cc9d];return _0x4a31be;};'use strict';var UserNotificationEvents=require(_0xc365('0x0'));var events=['save',_0xc365('0x1'),_0xc365('0x2')];function createListener(_0x3a0012,_0x48f211){return function(_0x14c6fa){_0x48f211[_0xc365('0x3')](_0x3a0012,_0x14c6fa);};}function removeListener(_0x304dca,_0x2d8c9e){return function(){UserNotificationEvents['removeListener'](_0x304dca,_0x2d8c9e);};}exports[_0xc365('0x4')]=function(_0x1f84b4){for(var _0x9adf6f=0x0,_0x3965cc=events[_0xc365('0x5')];_0x9adf6f<_0x3965cc;_0x9adf6f++){var _0x5b1071=events[_0x9adf6f];var _0x194680=createListener(_0xc365('0x6')+_0x5b1071,_0x1f84b4);UserNotificationEvents['on'](_0x5b1071,_0x194680);}}; \ No newline at end of file +var _0xa0f5=['emit','removeListener','register','length','./userNotification.events','save','remove','update'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0xa0f5,0x164));var _0x5a0f=function(_0x5eb92b,_0x246a36){_0x5eb92b=_0x5eb92b-0x0;var _0x22f582=_0xa0f5[_0x5eb92b];return _0x22f582;};'use strict';var UserNotificationEvents=require(_0x5a0f('0x0'));var events=[_0x5a0f('0x1'),_0x5a0f('0x2'),_0x5a0f('0x3')];function createListener(_0x1c3573,_0x2bd3df){return function(_0x4711d9){_0x2bd3df[_0x5a0f('0x4')](_0x1c3573,_0x4711d9);};}function removeListener(_0x19302f,_0x388de9){return function(){UserNotificationEvents[_0x5a0f('0x5')](_0x19302f,_0x388de9);};}exports[_0x5a0f('0x6')]=function(_0xa61777){for(var _0x484b74=0x0,_0x2b6ae8=events[_0x5a0f('0x7')];_0x484b74<_0x2b6ae8;_0x484b74++){var _0x4f4158=events[_0x484b74];var _0x554c16=createListener('userNotification:'+_0x4f4158,_0xa61777);UserNotificationEvents['on'](_0x4f4158,_0x554c16);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9992656..75a1091 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1b635f,_0x3b4d35){var _0x23503b=function(_0x5ef91a){while(--_0x5ef91a){_0x1b635f['push'](_0x1b635f['shift']());}};_0x23503b(++_0x3b4d35);}(_0xe706,0xa3));var _0x6e70=function(_0x237f45,_0x45987a){_0x237f45=_0x237f45-0x0;var _0x268b78=_0xe706[_0x237f45];return _0x268b78;};'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(_0x536256,_0x237fb5){var _0x1675f7=function(_0x339198){while(--_0x339198){_0x536256['push'](_0x536256['shift']());}};_0x1675f7(++_0x237fb5);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 69369fc..6a5daaa 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 _0xdb26=['sequelize','exports'];(function(_0x18110f,_0x59ec69){var _0x164993=function(_0x5e2645){while(--_0x5e2645){_0x18110f['push'](_0x18110f['shift']());}};_0x164993(++_0x59ec69);}(_0xdb26,0x160));var _0x6db2=function(_0xea4b97,_0x3c0f0f){_0xea4b97=_0xea4b97-0x0;var _0x5056d3=_0xdb26[_0xea4b97];return _0x5056d3;};'use strict';var Sequelize=require(_0x6db2('0x0'));module[_0x6db2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x649f=['sequelize','exports','INTEGER'];(function(_0x152ea8,_0x3fb53f){var _0x4c0ebe=function(_0x1c2641){while(--_0x1c2641){_0x152ea8['push'](_0x152ea8['shift']());}};_0x4c0ebe(++_0x3fb53f);}(_0x649f,0x8d));var _0xf649=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x649f[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0xf649('0x0'));module[_0xf649('0x1')]={'penalty':{'type':Sequelize[_0xf649('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 f858532..2cd07b4 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 _0xc3ef=['define','UserOpenchannelQueue','lodash','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xc3ef,0xcd));var _0xfc3e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc3ef[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xfc3e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc3e('0x1'));var fs=require('fs');var path=require(_0xfc3e('0x2'));var rimraf=require('rimraf');var config=require(_0xfc3e('0x3'));var attributes=require(_0xfc3e('0x4'));module['exports']=function(_0x139723,_0x48620b){return _0x139723[_0xfc3e('0x5')](_0xfc3e('0x6'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c7a=['./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x443338,_0x5c795c){var _0x37de70=function(_0xf89cf){while(--_0xf89cf){_0x443338['push'](_0x443338['shift']());}};_0x37de70(++_0x5c795c);}(_0x1c7a,0x117));var _0xa1c7=function(_0x113f4e,_0x2eb1a7){_0x113f4e=_0x113f4e-0x0;var _0x3fa4bb=_0x1c7a[_0x113f4e];return _0x3fa4bb;};'use strict';var _=require(_0xa1c7('0x0'));var util=require(_0xa1c7('0x1'));var logger=require(_0xa1c7('0x2'))('api');var moment=require(_0xa1c7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1c7('0x4'));var rimraf=require(_0xa1c7('0x5'));var config=require(_0xa1c7('0x6'));var attributes=require(_0xa1c7('0x7'));module[_0xa1c7('0x8')]=function(_0x568785,_0x52fa6e){return _0x568785[_0xa1c7('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xa1c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 58a03b7..48f3df6 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 _0xc7f5=['request','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x2c66f6,_0x2dae26){var _0x1e5894=function(_0x1da1ab){while(--_0x1da1ab){_0x2c66f6['push'](_0x2c66f6['shift']());}};_0x1e5894(++_0x2dae26);}(_0xc7f5,0x68));var _0x5c7f=function(_0x528b76,_0x284875){_0x528b76=_0x528b76-0x0;var _0x2d7f70=_0xc7f5[_0x528b76];return _0x2d7f70;};'use strict';var _=require(_0x5c7f('0x0'));var util=require(_0x5c7f('0x1'));var moment=require(_0x5c7f('0x2'));var BPromise=require(_0x5c7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c7f('0x4'));var db=require(_0x5c7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c7f('0x6'))(_0x5c7f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c7f('0x8')][_0x5c7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eaec1,_0x32ecf6,_0x3ce4d4){return new BPromise(function(_0x4f75d1,_0x4747b8){return client[_0x5c7f('0xa')](_0x5eaec1,_0x3ce4d4)['then'](function(_0x158fa9){logger['info'](_0x5c7f('0xb'),_0x32ecf6,_0x5c7f('0xc'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x32ecf6,'request\x20sent',JSON[_0x5c7f('0xd')](_0x158fa9));if(_0x158fa9[_0x5c7f('0xe')]){if(_0x158fa9[_0x5c7f('0xe')][_0x5c7f('0xf')]===0x1f4){logger[_0x5c7f('0xe')](_0x5c7f('0xb'),_0x32ecf6,_0x158fa9[_0x5c7f('0xe')][_0x5c7f('0x10')]);return _0x4747b8(_0x158fa9[_0x5c7f('0xe')][_0x5c7f('0x10')]);}logger[_0x5c7f('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32ecf6,_0x158fa9['error'][_0x5c7f('0x10')]);return _0x4f75d1(_0x158fa9[_0x5c7f('0xe')][_0x5c7f('0x10')]);}else{logger[_0x5c7f('0x11')](_0x5c7f('0xb'),_0x32ecf6,'request\x20sent');_0x4f75d1(_0x158fa9[_0x5c7f('0x12')][_0x5c7f('0x10')]);}})['catch'](function(_0x150c2e){logger['error'](_0x5c7f('0xb'),_0x32ecf6,_0x150c2e);_0x4747b8(_0x150c2e);});});} \ No newline at end of file +var _0x916c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x555c43,_0x3645f9){var _0x43a37c=function(_0x559917){while(--_0x559917){_0x555c43['push'](_0x555c43['shift']());}};_0x43a37c(++_0x3645f9);}(_0x916c,0x16e));var _0xc916=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x916c[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xc916('0x0'));var util=require(_0xc916('0x1'));var moment=require(_0xc916('0x2'));var BPromise=require(_0xc916('0x3'));var rs=require(_0xc916('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc916('0x5'))['db'];var utils=require(_0xc916('0x6'));var logger=require(_0xc916('0x7'))(_0xc916('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc916('0x9')][_0xc916('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e67e2,_0x1f4f67,_0x420621){return new BPromise(function(_0x50bfbc,_0x39aa83){return client['request'](_0x3e67e2,_0x420621)[_0xc916('0xb')](function(_0x28d643){logger[_0xc916('0xc')](_0xc916('0xd'),_0x1f4f67,_0xc916('0xe'));logger[_0xc916('0xf')](_0xc916('0x10'),_0x1f4f67,_0xc916('0xe'),JSON[_0xc916('0x11')](_0x28d643));if(_0x28d643[_0xc916('0x12')]){if(_0x28d643[_0xc916('0x12')][_0xc916('0x13')]===0x1f4){logger[_0xc916('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f4f67,_0x28d643[_0xc916('0x12')][_0xc916('0x14')]);return _0x39aa83(_0x28d643[_0xc916('0x12')][_0xc916('0x14')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f4f67,_0x28d643['error'][_0xc916('0x14')]);return _0x50bfbc(_0x28d643[_0xc916('0x12')][_0xc916('0x14')]);}else{logger['info'](_0xc916('0xd'),_0x1f4f67,_0xc916('0xe'));_0x50bfbc(_0x28d643[_0xc916('0x15')]['message']);}})[_0xc916('0x16')](function(_0x22fde2){logger[_0xc916('0x12')](_0xc916('0xd'),_0x1f4f67,_0x22fde2);_0x39aa83(_0x22fde2);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7b265b3..ed93e0b 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 _0xd2f1=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','create','/:id/clone','post','addSections','/:id/resources','put','update','delete','removeSections','removeResources','exports','multer'];(function(_0x28fc97,_0x100b6b){var _0x343985=function(_0xbc9b56){while(--_0xbc9b56){_0x28fc97['push'](_0x28fc97['shift']());}};_0x343985(++_0x100b6b);}(_0xd2f1,0xbc));var _0x1d2f=function(_0xc3e090,_0x1cf44f){_0xc3e090=_0xc3e090-0x0;var _0x4275ad=_0xd2f1[_0xc3e090];return _0x4275ad;};'use strict';var multer=require(_0x1d2f('0x0'));var util=require('util');var path=require(_0x1d2f('0x1'));var timeout=require(_0x1d2f('0x2'));var express=require(_0x1d2f('0x3'));var router=express[_0x1d2f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1d2f('0x5'));var interaction=require(_0x1d2f('0x6'));var config=require(_0x1d2f('0x7'));var controller=require(_0x1d2f('0x8'));router[_0x1d2f('0x9')]('/',auth[_0x1d2f('0xa')](),controller[_0x1d2f('0xb')]);router[_0x1d2f('0x9')]('/describe',auth[_0x1d2f('0xa')](),controller[_0x1d2f('0xc')]);router[_0x1d2f('0x9')](_0x1d2f('0xd'),auth[_0x1d2f('0xa')](),controller[_0x1d2f('0xe')]);router[_0x1d2f('0x9')](_0x1d2f('0xf'),auth[_0x1d2f('0xa')](),controller['getSections']);router['get']('/:id/resources',auth[_0x1d2f('0xa')](),controller['getResources']);router['post']('/',auth[_0x1d2f('0xa')](),controller[_0x1d2f('0x10')]);router['post'](_0x1d2f('0x11'),auth[_0x1d2f('0xa')](),controller['clone']);router[_0x1d2f('0x12')]('/:id/sections',auth['isAuthenticated'](),controller[_0x1d2f('0x13')]);router[_0x1d2f('0x12')](_0x1d2f('0x14'),auth[_0x1d2f('0xa')](),controller['addResources']);router[_0x1d2f('0x15')](_0x1d2f('0xd'),auth[_0x1d2f('0xa')](),controller[_0x1d2f('0x16')]);router[_0x1d2f('0x17')]('/:id',auth[_0x1d2f('0xa')](),controller['destroy']);router['delete'](_0x1d2f('0xf'),auth[_0x1d2f('0xa')](),controller[_0x1d2f('0x18')]);router[_0x1d2f('0x17')](_0x1d2f('0x14'),auth['isAuthenticated'](),controller[_0x1d2f('0x19')]);module[_0x1d2f('0x1a')]=router; \ No newline at end of file +var _0x7599=['/:id/clone','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','describe','get','show','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0x53a1be,_0x42dff2){var _0x38ae84=function(_0x51fa5c){while(--_0x51fa5c){_0x53a1be['push'](_0x53a1be['shift']());}};_0x38ae84(++_0x42dff2);}(_0x7599,0x102));var _0x9759=function(_0x522550,_0x105f5d){_0x522550=_0x522550-0x0;var _0x5560a4=_0x7599[_0x522550];return _0x5560a4;};'use strict';var multer=require(_0x9759('0x0'));var util=require('util');var path=require(_0x9759('0x1'));var timeout=require('connect-timeout');var express=require(_0x9759('0x2'));var router=express[_0x9759('0x3')]();var fs_extra=require(_0x9759('0x4'));var auth=require(_0x9759('0x5'));var interaction=require(_0x9759('0x6'));var config=require(_0x9759('0x7'));var controller=require(_0x9759('0x8'));router['get']('/',auth[_0x9759('0x9')](),controller[_0x9759('0xa')]);router['get'](_0x9759('0xb'),auth['isAuthenticated'](),controller[_0x9759('0xc')]);router[_0x9759('0xd')]('/:id',auth[_0x9759('0x9')](),controller[_0x9759('0xe')]);router['get'](_0x9759('0xf'),auth[_0x9759('0x9')](),controller[_0x9759('0x10')]);router['get'](_0x9759('0x11'),auth[_0x9759('0x9')](),controller[_0x9759('0x12')]);router[_0x9759('0x13')]('/',auth['isAuthenticated'](),controller[_0x9759('0x14')]);router[_0x9759('0x13')](_0x9759('0x15'),auth[_0x9759('0x9')](),controller['clone']);router[_0x9759('0x13')]('/:id/sections',auth[_0x9759('0x9')](),controller['addSections']);router[_0x9759('0x13')]('/:id/resources',auth[_0x9759('0x9')](),controller[_0x9759('0x16')]);router[_0x9759('0x17')](_0x9759('0x18'),auth[_0x9759('0x9')](),controller[_0x9759('0x19')]);router[_0x9759('0x1a')](_0x9759('0x18'),auth[_0x9759('0x9')](),controller[_0x9759('0x1b')]);router[_0x9759('0x1a')](_0x9759('0xf'),auth[_0x9759('0x9')](),controller[_0x9759('0x1c')]);router[_0x9759('0x1a')](_0x9759('0x11'),auth[_0x9759('0x9')](),controller[_0x9759('0x1d')]);module[_0x9759('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index c55755b..6ba5fdc 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 _0x96ad=['exports','STRING','name','crudPermissions','getDataValue','BOOLEAN'];(function(_0x5c4036,_0x45b03d){var _0x4143c0=function(_0x2898f4){while(--_0x2898f4){_0x5c4036['push'](_0x5c4036['shift']());}};_0x4143c0(++_0x45b03d);}(_0x96ad,0x10e));var _0xd96a=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x96ad[_0x284807];return _0x50c774;};'use strict';var Sequelize=require('sequelize');module[_0xd96a('0x0')]={'name':{'type':Sequelize[_0xd96a('0x1')],'allowNull':![],'unique':_0xd96a('0x2')},'crudPermissions':{'type':Sequelize[_0xd96a('0x1')],'set':function(_0x3ccff0){this['setDataValue']('crudPermissions',_0x3ccff0?_0x3ccff0['join'](''):[]);},'get':function(){return this['getDataValue'](_0xd96a('0x3'))?this[_0xd96a('0x4')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd96a('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd96a('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd96a('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd96a('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf2dc=['STRING','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','name'];(function(_0x1fa015,_0x1bc465){var _0x4cf131=function(_0x29c791){while(--_0x29c791){_0x1fa015['push'](_0x1fa015['shift']());}};_0x4cf131(++_0x1bc465);}(_0xf2dc,0x93));var _0xcf2d=function(_0x510afb,_0x2e81ed){_0x510afb=_0x510afb-0x0;var _0x338722=_0xf2dc[_0x510afb];return _0x338722;};'use strict';var Sequelize=require(_0xcf2d('0x0'));module[_0xcf2d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcf2d('0x2')},'crudPermissions':{'type':Sequelize[_0xcf2d('0x3')],'set':function(_0x43a9a7){this[_0xcf2d('0x4')]('crudPermissions',_0x43a9a7?_0x43a9a7[_0xcf2d('0x5')](''):[]);},'get':function(){return this[_0xcf2d('0x6')](_0xcf2d('0x7'))?this[_0xcf2d('0x6')]('crudPermissions')[_0xcf2d('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcf2d('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcf2d('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcf2d('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcf2d('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcf2d('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcf2d('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcf2d('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index fcbf96f..f94ac64 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 _0x753c=['clone','get','omit','createdAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','updatedAt','sectionId','userProfileId','Resources','describe','addSections','destroy','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','transaction','bulkCreate','removeResources','Missing\x20section\x20parameter','getResources','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','error','name','send','index','UserProfile','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x753c,0x96));var _0xc753=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x753c[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc753('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc753('0x1'));var rp=require(_0xc753('0x2'));var moment=require(_0xc753('0x3'));var BPromise=require(_0xc753('0x4'));var Mustache=require(_0xc753('0x5'));var util=require(_0xc753('0x6'));var path=require(_0xc753('0x7'));var sox=require(_0xc753('0x8'));var csv=require(_0xc753('0x9'));var ejs=require(_0xc753('0xa'));var fs=require('fs');var fs_extra=require(_0xc753('0xb'));var _=require(_0xc753('0xc'));var squel=require(_0xc753('0xd'));var crypto=require(_0xc753('0xe'));var jsforce=require(_0xc753('0xf'));var deskjs=require(_0xc753('0x10'));var toCsv=require(_0xc753('0x9'));var querystring=require(_0xc753('0x11'));var Papa=require(_0xc753('0x12'));var Redis=require(_0xc753('0x13'));var authService=require(_0xc753('0x14'));var qs=require(_0xc753('0x15'));var as=require(_0xc753('0x16'));var hardwareService=require(_0xc753('0x17'));var logger=require('../../config/logger')(_0xc753('0x18'));var utils=require(_0xc753('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc753('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc753('0x1b')]=_[_0xc753('0x1c')](config[_0xc753('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc753('0x1d'))(new Redis(config['redis']));require(_0xc753('0x1e'))['register'](socket);function respondWithStatusCode(_0x3cdf79,_0x175238){_0x175238=_0x175238||0xcc;return function(_0x288a69){if(_0x288a69){return _0x3cdf79[_0xc753('0x1f')](_0x175238);}return _0x3cdf79[_0xc753('0x20')](_0x175238)['end']();};}function respondWithResult(_0x1d4558,_0x33c647){_0x33c647=_0x33c647||0xc8;return function(_0x1f94f9){if(_0x1f94f9){return _0x1d4558[_0xc753('0x20')](_0x33c647)[_0xc753('0x21')](_0x1f94f9);}};}function respondWithFilteredResult(_0x2757cc,_0x1b4444){return function(_0x387fbf){if(_0x387fbf){var _0x5a3ea7=typeof _0x1b4444[_0xc753('0x22')]===_0xc753('0x23')&&typeof _0x1b4444[_0xc753('0x24')]===_0xc753('0x23');var _0x23c46a=_0x387fbf[_0xc753('0x25')];var _0x40a22e=_0x5a3ea7?0x0:_0x1b4444[_0xc753('0x22')];var _0xaf6367=_0x5a3ea7?_0x387fbf[_0xc753('0x25')]:_0x1b4444[_0xc753('0x22')]+_0x1b4444[_0xc753('0x24')];var _0x464e6a;if(_0xaf6367>=_0x23c46a){_0xaf6367=_0x23c46a;_0x464e6a=0xc8;}else{_0x464e6a=0xce;}_0x2757cc[_0xc753('0x20')](_0x464e6a);return _0x2757cc[_0xc753('0x26')](_0xc753('0x27'),_0x40a22e+'-'+_0xaf6367+'/'+_0x23c46a)['json'](_0x387fbf);}return null;};}function patchUpdates(_0x2c04d4){return function(_0x2283d9){try{jsonpatch['apply'](_0x2283d9,_0x2c04d4,!![]);}catch(_0x512d9c){return BPromise[_0xc753('0x28')](_0x512d9c);}return _0x2283d9[_0xc753('0x29')]();};}function saveUpdates(_0x44847a,_0x22b06a){return function(_0x1777e4){if(_0x1777e4){return _0x1777e4['update'](_0x44847a)[_0xc753('0x2a')](function(_0x254687){return _0x254687;});}return null;};}function removeEntity(_0xcadec1,_0x77a2a0){return function(_0x1ede62){if(_0x1ede62){return _0x1ede62['destroy']()[_0xc753('0x2a')](function(){_0xcadec1['status'](0xcc)[_0xc753('0x2b')]();});}};}function handleEntityNotFound(_0x114cca,_0x1bffff){return function(_0x2f5c9f){if(!_0x2f5c9f){_0x114cca['sendStatus'](0x194);}return _0x2f5c9f;};}function handleError(_0x209bbb,_0x406b86){_0x406b86=_0x406b86||0x1f4;return function(_0x5d03bb){logger[_0xc753('0x2c')](_0x5d03bb['stack']);if(_0x5d03bb[_0xc753('0x2d')]){delete _0x5d03bb['name'];}_0x209bbb['status'](_0x406b86)[_0xc753('0x2e')](_0x5d03bb);};}exports[_0xc753('0x2f')]=function(_0x540e8f,_0x3ad96f){var _0x86cb0d={},_0x1c84ad={},_0x207c85={'count':0x0,'rows':[]};var _0x3af826=_['map'](db[_0xc753('0x30')]['rawAttributes'],function(_0x15c340){return{'name':_0x15c340[_0xc753('0x31')],'type':_0x15c340[_0xc753('0x32')]['key']};});_0x1c84ad[_0xc753('0x33')]=_[_0xc753('0x34')](_0x3af826,_0xc753('0x2d'));_0x1c84ad[_0xc753('0x35')]=_[_0xc753('0x36')](_0x540e8f[_0xc753('0x35')]);_0x1c84ad[_0xc753('0x37')]=_[_0xc753('0x38')](_0x1c84ad['model'],_0x1c84ad[_0xc753('0x35')]);_0x86cb0d[_0xc753('0x39')]=_[_0xc753('0x38')](_0x1c84ad['model'],qs[_0xc753('0x3a')](_0x540e8f['query'][_0xc753('0x3a')]));_0x86cb0d[_0xc753('0x39')]=_0x86cb0d[_0xc753('0x39')][_0xc753('0x3b')]?_0x86cb0d[_0xc753('0x39')]:_0x1c84ad[_0xc753('0x33')];if(!_0x540e8f[_0xc753('0x35')][_0xc753('0x3c')](_0xc753('0x3d'))){_0x86cb0d['limit']=qs[_0xc753('0x24')](_0x540e8f['query']['limit']);_0x86cb0d[_0xc753('0x22')]=qs[_0xc753('0x22')](_0x540e8f['query'][_0xc753('0x22')]);}_0x86cb0d[_0xc753('0x3e')]=qs[_0xc753('0x3f')](_0x540e8f[_0xc753('0x35')][_0xc753('0x3f')]);_0x86cb0d[_0xc753('0x40')]=qs[_0xc753('0x37')](_['pick'](_0x540e8f['query'],_0x1c84ad[_0xc753('0x37')]),_0x3af826);if(_0x540e8f[_0xc753('0x35')][_0xc753('0x41')]){_0x86cb0d['where']=_[_0xc753('0x42')](_0x86cb0d['where'],{'$or':_[_0xc753('0x34')](_0x3af826,function(_0x3ea05d){if(_0x3ea05d[_0xc753('0x32')]!==_0xc753('0x43')){var _0x4907bf={};_0x4907bf[_0x3ea05d[_0xc753('0x2d')]]={'$like':'%'+_0x540e8f[_0xc753('0x35')][_0xc753('0x41')]+'%'};return _0x4907bf;}})});}_0x86cb0d=_['merge']({},_0x86cb0d,_0x540e8f['options']);var _0x259238={'where':_0x86cb0d[_0xc753('0x40')]};return db[_0xc753('0x30')][_0xc753('0x25')](_0x259238)['then'](function(_0x4daaef){_0x207c85[_0xc753('0x25')]=_0x4daaef;if(_0x540e8f['query'][_0xc753('0x44')]){_0x86cb0d[_0xc753('0x45')]=[{'all':!![]}];}return db[_0xc753('0x30')][_0xc753('0x46')](_0x86cb0d);})[_0xc753('0x2a')](function(_0x594b04){_0x207c85[_0xc753('0x47')]=_0x594b04;return _0x207c85;})[_0xc753('0x2a')](respondWithFilteredResult(_0x3ad96f,_0x86cb0d))[_0xc753('0x48')](handleError(_0x3ad96f,null));};exports[_0xc753('0x49')]=function(_0x1a2bc8,_0x19ce77){var _0x5b38e8={'raw':![],'where':{'id':_0x1a2bc8[_0xc753('0x4a')]['id']}},_0xe3c671={};_0xe3c671[_0xc753('0x33')]=_[_0xc753('0x36')](db[_0xc753('0x30')][_0xc753('0x4b')]);_0xe3c671[_0xc753('0x35')]=_[_0xc753('0x36')](_0x1a2bc8['query']);_0xe3c671[_0xc753('0x37')]=_[_0xc753('0x38')](_0xe3c671[_0xc753('0x33')],_0xe3c671[_0xc753('0x35')]);_0x5b38e8['attributes']=_[_0xc753('0x38')](_0xe3c671[_0xc753('0x33')],qs[_0xc753('0x3a')](_0x1a2bc8[_0xc753('0x35')]['fields']));_0x5b38e8[_0xc753('0x39')]=_0x5b38e8['attributes'][_0xc753('0x3b')]?_0x5b38e8['attributes']:_0xe3c671['model'];if(_0x1a2bc8['query'][_0xc753('0x44')]){_0x5b38e8[_0xc753('0x45')]=[{'all':!![]}];}_0x5b38e8=_[_0xc753('0x42')]({},_0x5b38e8,_0x1a2bc8[_0xc753('0x4c')]);return db[_0xc753('0x30')][_0xc753('0x4d')](_0x5b38e8)[_0xc753('0x2a')](handleEntityNotFound(_0x19ce77,null))[_0xc753('0x2a')](respondWithResult(_0x19ce77,null))['catch'](handleError(_0x19ce77,null));};exports[_0xc753('0x4e')]=function(_0x15eb1f,_0x30cb15){return db[_0xc753('0x30')][_0xc753('0x4e')](_0x15eb1f[_0xc753('0x4f')],{})['then'](respondWithResult(_0x30cb15,0xc9))['catch'](handleError(_0x30cb15,null));};exports[_0xc753('0x50')]=function(_0x24a29a,_0x337dee){var _0x55d371={'where':{'id':_0x24a29a[_0xc753('0x4a')]['id']}},_0x3e04c6={};_0x3e04c6[_0xc753('0x33')]=_[_0xc753('0x36')](db['UserProfile'][_0xc753('0x4b')]);_0x55d371[_0xc753('0x39')]=_['intersection'](_0x3e04c6[_0xc753('0x33')],qs[_0xc753('0x3a')](_0x24a29a['query'][_0xc753('0x3a')]));_0x55d371['attributes']=_0x55d371[_0xc753('0x39')][_0xc753('0x3b')]?_0x55d371[_0xc753('0x39')]:_0x3e04c6['model'];if(_0x24a29a[_0xc753('0x35')][_0xc753('0x44')]){_0x55d371[_0xc753('0x45')]=[{'all':!![]}];}_0x55d371=_[_0xc753('0x42')]({},_0x55d371,_0x24a29a['options']);return db[_0xc753('0x30')][_0xc753('0x4d')](_0x55d371)[_0xc753('0x2a')](handleEntityNotFound(_0x337dee,null))[_0xc753('0x2a')](function(_0x214e18){if(_0x214e18){var _0xbf6870=_0x214e18[_0xc753('0x51')]({'plain':!![]});_0xbf6870=qs[_0xc753('0x52')](_0xbf6870,['id',_0xc753('0x53'),'updatedAt',_0xc753('0x54')]);_0x24a29a['body']=_[_0xc753('0x52')](_0x24a29a['body'],['id',_0xc753('0x53'),'updatedAt']);return db[_0xc753('0x55')]['transaction'](function(_0xc46782){return db[_0xc753('0x30')][_0xc753('0x4e')](_[_0xc753('0x42')](_0xbf6870,_0x24a29a[_0xc753('0x4f')]),{'include':_0x24a29a[_0xc753('0x35')][_0xc753('0x44')]?[{'all':!![]}]:undefined,'transaction':_0xc46782})[_0xc753('0x2a')](function(_0x485279){var _0x4f4b8d=_0x485279[_0xc753('0x51')]({'plain':!![]});return db[_0xc753('0x56')][_0xc753('0x46')]({'where':{'userProfileId':_0x24a29a[_0xc753('0x4a')]['id']},'raw':!![]})[_0xc753('0x2a')](function(_0x5ecd5c){if(_0x5ecd5c){return BPromise[_0xc753('0x57')](_0x5ecd5c,function(_0x429df2){return new BPromise(function(_0x34b5e1,_0x517318){if(_0x429df2[_0xc753('0x58')]===null||_0x429df2[_0xc753('0x58')]===0x1)_0x34b5e1(null);return db[_0xc753('0x59')]['findAll']({'where':{'sectionId':_0x429df2['id']},'raw':!![]})[_0xc753('0x2a')](function(_0x32f27d){var _0x3c936f=_[_0xc753('0x34')](_0x32f27d,function(_0x43975a){return qs['omit'](_0x43975a,['id','createdAt',_0xc753('0x5a'),_0xc753('0x5b')]);});_0x34b5e1(_0x3c936f);})['catch'](function(_0x27f782){_0x517318(_0x27f782);});})['then'](function(_0xf4108){var _0x3f536c=qs[_0xc753('0x52')](_0x429df2,['id','createdAt','updatedAt']);_0x3f536c[_0xc753('0x5c')]=_0x4f4b8d['id'];if(_0xf4108)_0x3f536c[_0xc753('0x5d')]=_0xf4108;return _0x3f536c;})[_0xc753('0x2a')](function(_0x5061f2){return db[_0xc753('0x56')][_0xc753('0x4e')](_0x5061f2,{'include':[{'model':db[_0xc753('0x59')],'as':_0xc753('0x5d')}],'raw':!![],'transaction':_0xc46782});});})[_0xc753('0x2a')](function(){return _0x4f4b8d;});}});});});}})[_0xc753('0x2a')](respondWithResult(_0x337dee,0xc9))[_0xc753('0x48')](handleError(_0x337dee,null));};exports['update']=function(_0x420711,_0x376423){if(_0x420711[_0xc753('0x4f')]['id']){delete _0x420711[_0xc753('0x4f')]['id'];}return db['UserProfile'][_0xc753('0x4d')]({'where':{'id':_0x420711['params']['id']}})['then'](handleEntityNotFound(_0x376423,null))[_0xc753('0x2a')](saveUpdates(_0x420711[_0xc753('0x4f')],null))[_0xc753('0x2a')](respondWithResult(_0x376423,null))[_0xc753('0x48')](handleError(_0x376423,null));};exports['destroy']=function(_0x3cf7b2,_0x247687){return db['UserProfile'][_0xc753('0x4d')]({'where':{'id':_0x3cf7b2[_0xc753('0x4a')]['id']}})[_0xc753('0x2a')](handleEntityNotFound(_0x247687,null))[_0xc753('0x2a')](removeEntity(_0x247687,null))[_0xc753('0x48')](handleError(_0x247687,null));};exports[_0xc753('0x5e')]=function(_0x5189d6,_0x4174c4){return db[_0xc753('0x30')][_0xc753('0x5e')]()[_0xc753('0x2a')](respondWithResult(_0x4174c4,null))[_0xc753('0x48')](handleError(_0x4174c4,null));};exports[_0xc753('0x5f')]=function(_0x465493,_0x268fd4){var _0x5256b7=_0x465493['body'];return db[_0xc753('0x30')]['find']({'where':{'id':_0x465493[_0xc753('0x4a')]['id']}})['then'](handleEntityNotFound(_0x268fd4,null))['then'](function(_0x374531){if(_0x374531){return db[_0xc753('0x55')]['transaction'](function(_0x3860f4){return db['UserProfileSection'][_0xc753('0x60')]({'where':{'userProfileId':_0x465493[_0xc753('0x4a')]['id'],'sectionId':_['map'](_0x5256b7,function(_0x15f287){return _0x15f287[_0xc753('0x5b')];})},'transaction':_0x3860f4})[_0xc753('0x2a')](function(){var _0x12e093=_[_0xc753('0x34')](_0x5256b7,function(_0x342c00){_0x342c00[_0xc753('0x5c')]=_0x465493[_0xc753('0x4a')]['id'];return _0x342c00;});var _0x3d87ba=[];return BPromise['each'](_0x12e093,function(_0x5cd57e){return db[_0xc753('0x56')]['create'](_0x5cd57e,{'include':[{'model':db[_0xc753('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x3860f4})['then'](function(_0x5d143b){_0x3d87ba['push'](_0x5d143b[_0xc753('0x51')]({'plain':!![]}));});})['then'](function(){return _0x3d87ba;});});});}})['then'](function(_0x47e27a){return _0x47e27a;})['then'](respondWithResult(_0x268fd4,null))['catch'](handleError(_0x268fd4,null));};exports[_0xc753('0x61')]=function(_0x1e4a83,_0x3706a1){var _0x44578c;return db['UserProfile'][_0xc753('0x4d')]({'where':{'id':_0x1e4a83['params']['id']},'attributes':['id',_0xc753('0x2d')]})['then'](handleEntityNotFound(_0x3706a1,null))[_0xc753('0x2a')](function(_0x21d2a0){if(_0x21d2a0){_0x44578c=_0x21d2a0;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x1e4a83[_0xc753('0x4a')]['id'],'sectionId':_0x1e4a83[_0xc753('0x35')][_0xc753('0x62')]}});}})[_0xc753('0x2a')](function(){return _0x44578c;})[_0xc753('0x2a')](respondWithStatusCode(_0x3706a1,null))[_0xc753('0x48')](handleError(_0x3706a1,null));};exports[_0xc753('0x63')]=function(_0x5a2c22,_0x527306){var _0x3c5baf=[];var _0x73efa1=[];return db['UserProfileSection'][_0xc753('0x46')]({'where':{'userProfileId':_0x5a2c22[_0xc753('0x4a')]['id']},'raw':!![]})[_0xc753('0x2a')](function(_0x119f3a){_0x3c5baf=_['filter'](_0x119f3a,function(_0x31dd46){return _0x31dd46[_0xc753('0x64')]===0x1||_[_0xc753('0x65')]([0x3eb,0x709],_0x31dd46[_0xc753('0x5b')]);});if(!_[_0xc753('0x66')](_0x3c5baf)){return _[_0xc753('0x34')](_0x3c5baf,function(_0x3a27af){return _0x3a27af[_0xc753('0x5b')];});}else{return;}})[_0xc753('0x2a')](function(_0x9defc3){if(_0x9defc3)_0x73efa1=_0x9defc3;if(_[_0xc753('0x65')](_0x73efa1,0x64)){var _0x40c7de=_['find'](_0x3c5baf,{'sectionId':0x64});return hasDefaultDashboard(_0x40c7de)['then'](function(_0x4bc21a){return _[_0xc753('0x34')](_0x3c5baf,function(_0x2e80c0){if(_0x2e80c0[_0xc753('0x5b')]===0x64){_0x2e80c0['subsections']=_0x4bc21a;}return _0x2e80c0;});});}else{return;}})[_0xc753('0x2a')](function(_0xa384fe){if(_0xa384fe)_0x3c5baf=_0xa384fe;if(_[_0xc753('0x65')](_0x73efa1,0x3eb)){var _0x2072f7=_[_0xc753('0x4d')](_0x3c5baf,{'sectionId':0x3eb});return getCustomDashboards(_0x2072f7)[_0xc753('0x2a')](function(_0x1fdb34){return _['map'](_0x3c5baf,function(_0x62ef55){if(_0x2072f7[_0xc753('0x64')]){if(_0x62ef55[_0xc753('0x5b')]===0x3eb){_0x62ef55['subsections']=_0x1fdb34;}}else{if(_0x62ef55[_0xc753('0x5b')]===0x64){_0x62ef55[_0xc753('0x67')]=_0x1fdb34;}}return _0x62ef55;});});}else{return;}})[_0xc753('0x2a')](function(_0x286a2c){if(_0x286a2c)_0x3c5baf=_0x286a2c;if(_[_0xc753('0x65')](_0x73efa1,0x709)){var _0x522c14=_[_0xc753('0x4d')](_0x3c5baf,{'sectionId':0x709});return getPlugins(_0x522c14)['then'](function(_0x5bc10c){if(_0x522c14['enabled']){return _['map'](_0x3c5baf,function(_0x4d361a){if(_0x4d361a['sectionId']===0x709){_0x4d361a[_0xc753('0x67')]=_0x5bc10c;}return _0x4d361a;});}else{var _0x412613={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5bc10c};var _0x391ac8=_[_0xc753('0x34')](_0x3c5baf);_0x391ac8[_0xc753('0x68')](_0x412613);return _0x391ac8;}});}else{return;}})[_0xc753('0x2a')](function(_0x4f8f2b){if(_0x4f8f2b)_0x3c5baf=_0x4f8f2b;return _[_0xc753('0x41')](_0x3c5baf,[_0xc753('0x64'),0x1]);})[_0xc753('0x2a')](respondWithResult(_0x527306,null))[_0xc753('0x48')](handleError(_0x527306,null));};function hasDefaultDashboard(_0x46fd77){var _0x2989f6=[0x65];return new BPromise(function(_0x3a0fb7,_0x16f5c3){try{if(_0x46fd77[_0xc753('0x58')]){_0x3a0fb7(_0x2989f6);}else{return db[_0xc753('0x59')][_0xc753('0x69')]({'where':{'sectionId':_0x46fd77['id']},'raw':!![]})[_0xc753('0x2a')](function(_0x4d2f66){_0x4d2f66?_0x3a0fb7(_0x2989f6):_0x3a0fb7();});}}catch(_0x494881){_0x16f5c3(_0x494881);}});}function getCustomDashboards(_0x4df32d){var _0x2d319f=[];return new BPromise(function(_0x3d346f,_0x27500d){try{if(_0x4df32d[_0xc753('0x58')]){return db[_0xc753('0x6a')][_0xc753('0x46')]({'raw':!![]})['then'](function(_0x3ad7b7){_0x3ad7b7[_0xc753('0x6b')](function(_0x4f494a){_0x2d319f[_0xc753('0x68')](_0x4f494a['id']+0x1869f);});_0x3d346f(_0x2d319f);});}else{return db[_0xc753('0x59')][_0xc753('0x46')]({'where':{'sectionId':_0x4df32d['id']},'raw':!![]})['then'](function(_0x541a53){_0x541a53[_0xc753('0x6b')](function(_0x547cff){_0x2d319f[_0xc753('0x68')](_0x547cff[_0xc753('0x6c')]+0x1869f);});_0x3d346f(_0x2d319f);});}}catch(_0x495822){_0x27500d(_0x495822);}});}function getPlugins(_0x35fd6e){var _0x2a8efb=[];return new BPromise(function(_0x29ac6a,_0x1fb419){try{if(_0x35fd6e['autoAssociation']){return db[_0xc753('0x6d')][_0xc753('0x46')]({'raw':!![]})[_0xc753('0x2a')](function(_0x203c51){_0x203c51[_0xc753('0x6b')](function(_0x2d2e4a){_0x2a8efb['push'](_0x2d2e4a['id']+0x15b38);});_0x29ac6a(_0x2a8efb);});}else{return db[_0xc753('0x59')]['findAll']({'where':{'sectionId':_0x35fd6e['id']},'raw':!![]})[_0xc753('0x2a')](function(_0x1792e2){_0x1792e2[_0xc753('0x6b')](function(_0x498155){_0x2a8efb[_0xc753('0x68')](_0x498155[_0xc753('0x6c')]+0x15b38);});_0x29ac6a(_0x2a8efb);});}}catch(_0x239e7f){_0x1fb419(_0x239e7f);}});}exports['addResources']=function(_0x5a2af0,_0x310b12){return db['UserProfile'][_0xc753('0x4d')]({'where':{'id':_0x5a2af0['params']['id']}})[_0xc753('0x2a')](handleEntityNotFound(_0x310b12,null))[_0xc753('0x2a')](function(_0x33f8e0){if(_0x33f8e0){return db[_0xc753('0x55')][_0xc753('0x6e')](function(_0x87406a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5a2af0[_0xc753('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xc753('0x2a')](function(_0x4981d3){if(_0x4981d3){return db[_0xc753('0x56')][_0xc753('0x60')]({'where':{'userProfileId':_0x5a2af0[_0xc753('0x4a')]['id'],'id':_[_0xc753('0x34')](_0x4981d3,function(_0x3ddc16){return _0x3ddc16['id'];})},'transaction':_0x87406a});}})['then'](function(_0x2cb781){var _0x541548=_['map'](_0x5a2af0[_0xc753('0x4f')],function(_0x1dd02e){_0x1dd02e[_0xc753('0x5c')]=_0x5a2af0['params']['id'];return _0x1dd02e;});return db[_0xc753('0x56')][_0xc753('0x6f')](_0x541548,{'raw':!![],'transaction':_0x87406a});})[_0xc753('0x2a')](function(_0x57980c){var _0x53aee0=_['filter'](_[_0xc753('0x34')](_0x57980c,function(_0x6d2e1d){return _0x6d2e1d[_0xc753('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x53aee0){return db[_0xc753('0x56')]['findAll']({'where':{'userProfileId':_0x5a2af0[_0xc753('0x4a')]['id'],'sectionId':_[_0xc753('0x34')](_0x53aee0,function(_0x28425f){return _0x28425f[_0xc753('0x5b')];})},'attributes':['id',_0xc753('0x5b')],'raw':!![]})[_0xc753('0x2a')](function(_0x342ccf){var _0x3274d3=_[_0xc753('0x34')](_0x5a2af0[_0xc753('0x4f')],function(_0x84973e){_0x84973e[_0xc753('0x5c')]=_0x5a2af0[_0xc753('0x4a')]['id'];return _0x84973e;});return db[_0xc753('0x59')][_0xc753('0x6f')](_0x3274d3,{'raw':!![],'transaction':_0x87406a});});}})[_0xc753('0x48')](handleError(_0x310b12,null));});}})[_0xc753('0x2a')](function(_0x4b3d3a){var _0x1a6427=_[_0xc753('0x34')](_0x4b3d3a,function(_0x4249c8){return _0x4249c8[_0xc753('0x51')]({'plain':!![]});});})[_0xc753('0x2a')](respondWithResult(_0x310b12,null))[_0xc753('0x48')](handleError(_0x310b12,null));};exports['removeResources']=function(_0x1e94c1,_0xe01d3e,_0x1fe930){return db[_0xc753('0x30')][_0xc753('0x4d')]({'where':{'id':_0x1e94c1[_0xc753('0x4a')]['id']}})[_0xc753('0x2a')](handleEntityNotFound(_0xe01d3e,null))[_0xc753('0x2a')](function(_0x2bbe93){if(_0x2bbe93){return _0x2bbe93[_0xc753('0x70')](_0x1e94c1[_0xc753('0x35')][_0xc753('0x62')]);}})[_0xc753('0x2a')](respondWithStatusCode(_0xe01d3e,null))[_0xc753('0x48')](handleError(_0xe01d3e,null));};exports['getResources']=function(_0x305f88,_0xaf505b){var _0x4d569b={};if(!_0x305f88[_0xc753('0x35')]['section'])throw new Error(_0xc753('0x71'));if(!_0x305f88[_0xc753('0x35')][_0xc753('0x3c')](_0xc753('0x3d'))){_0x4d569b[_0xc753('0x24')]=qs[_0xc753('0x24')](_0x305f88[_0xc753('0x35')]['limit']);_0x4d569b[_0xc753('0x22')]=qs[_0xc753('0x22')](_0x305f88['query'][_0xc753('0x22')]);}return db[_0xc753('0x30')][_0xc753('0x4d')]({'where':{'id':_0x305f88[_0xc753('0x4a')]['id']}})[_0xc753('0x2a')](function(_0x5f2da6){if(!_0x5f2da6)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x305f88[_0xc753('0x4a')]['id']);return db[_0xc753('0x30')][_0xc753('0x72')](_0x305f88);})[_0xc753('0x2a')](respondWithFilteredResult(_0xaf505b,_0x4d569b))[_0xc753('0x48')](handleError(_0xaf505b,null));}; \ No newline at end of file +var _0x79d7=['nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','includeAll','find','create','clone','params','get','omit','updatedAt','body','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','sectionId','push','getSections','enabled','includes','subsections','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0xfbf2b5,_0x5daeb1){var _0x394ece=function(_0x3c0da6){while(--_0x3c0da6){_0xfbf2b5['push'](_0xfbf2b5['shift']());}};_0x394ece(++_0x5daeb1);}(_0x79d7,0x9c));var _0x779d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x79d7[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x779d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x779d('0x1'));var jsonpatch=require(_0x779d('0x2'));var rp=require(_0x779d('0x3'));var moment=require(_0x779d('0x4'));var BPromise=require(_0x779d('0x5'));var Mustache=require(_0x779d('0x6'));var util=require('util');var path=require(_0x779d('0x7'));var sox=require(_0x779d('0x8'));var csv=require(_0x779d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x779d('0xa'));var squel=require('squel');var crypto=require(_0x779d('0xb'));var jsforce=require(_0x779d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x779d('0xd'));var authService=require(_0x779d('0xe'));var qs=require(_0x779d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x779d('0x10'));var logger=require('../../config/logger')(_0x779d('0x11'));var utils=require('../../config/utils');var config=require(_0x779d('0x12'));var licenseUtil=require(_0x779d('0x13'));var db=require(_0x779d('0x14'))['db'];config['redis']=_[_0x779d('0x15')](config[_0x779d('0x16')],{'host':_0x779d('0x17'),'port':0x18eb});var socket=require(_0x779d('0x18'))(new Redis(config[_0x779d('0x16')]));require(_0x779d('0x19'))['register'](socket);function respondWithStatusCode(_0x3c12cb,_0x1028c6){_0x1028c6=_0x1028c6||0xcc;return function(_0x2a0678){if(_0x2a0678){return _0x3c12cb[_0x779d('0x1a')](_0x1028c6);}return _0x3c12cb[_0x779d('0x1b')](_0x1028c6)['end']();};}function respondWithResult(_0x26dfa2,_0x1e5744){_0x1e5744=_0x1e5744||0xc8;return function(_0x3755c6){if(_0x3755c6){return _0x26dfa2['status'](_0x1e5744)[_0x779d('0x1c')](_0x3755c6);}};}function respondWithFilteredResult(_0x219106,_0xd9042d){return function(_0x18900e){if(_0x18900e){var _0x6a0916=typeof _0xd9042d[_0x779d('0x1d')]===_0x779d('0x1e')&&typeof _0xd9042d[_0x779d('0x1f')]===_0x779d('0x1e');var _0x4192c=_0x18900e[_0x779d('0x20')];var _0x373abb=_0x6a0916?0x0:_0xd9042d[_0x779d('0x1d')];var _0x5b1f79=_0x6a0916?_0x18900e[_0x779d('0x20')]:_0xd9042d['offset']+_0xd9042d[_0x779d('0x1f')];var _0x4d0f40;if(_0x5b1f79>=_0x4192c){_0x5b1f79=_0x4192c;_0x4d0f40=0xc8;}else{_0x4d0f40=0xce;}_0x219106[_0x779d('0x1b')](_0x4d0f40);return _0x219106[_0x779d('0x21')](_0x779d('0x22'),_0x373abb+'-'+_0x5b1f79+'/'+_0x4192c)[_0x779d('0x1c')](_0x18900e);}return null;};}function patchUpdates(_0x599ee3){return function(_0x864506){try{jsonpatch[_0x779d('0x23')](_0x864506,_0x599ee3,!![]);}catch(_0xbe3028){return BPromise[_0x779d('0x24')](_0xbe3028);}return _0x864506[_0x779d('0x25')]();};}function saveUpdates(_0x1ddfa5,_0x2fca0a){return function(_0x42bc01){if(_0x42bc01){return _0x42bc01[_0x779d('0x26')](_0x1ddfa5)[_0x779d('0x27')](function(_0x4cbd1d){return _0x4cbd1d;});}return null;};}function removeEntity(_0x3c990c,_0x58e397){return function(_0x5d7ab5){if(_0x5d7ab5){return _0x5d7ab5[_0x779d('0x28')]()[_0x779d('0x27')](function(){_0x3c990c['status'](0xcc)[_0x779d('0x29')]();});}};}function handleEntityNotFound(_0x842638,_0x151d35){return function(_0x5b2070){if(!_0x5b2070){_0x842638[_0x779d('0x1a')](0x194);}return _0x5b2070;};}function handleError(_0x244bb4,_0x3e825a){_0x3e825a=_0x3e825a||0x1f4;return function(_0x1b7584){logger[_0x779d('0x2a')](_0x1b7584[_0x779d('0x2b')]);if(_0x1b7584['name']){delete _0x1b7584[_0x779d('0x2c')];}_0x244bb4[_0x779d('0x1b')](_0x3e825a)[_0x779d('0x2d')](_0x1b7584);};}exports[_0x779d('0x2e')]=function(_0x2a0982,_0x1ed423){var _0x22df77={},_0x2060d5={},_0xae6d6f={'count':0x0,'rows':[]};var _0xbaaec8=_['map'](db[_0x779d('0x2f')][_0x779d('0x30')],function(_0x1d33c5){return{'name':_0x1d33c5[_0x779d('0x31')],'type':_0x1d33c5[_0x779d('0x32')][_0x779d('0x33')]};});_0x2060d5[_0x779d('0x34')]=_[_0x779d('0x35')](_0xbaaec8,_0x779d('0x2c'));_0x2060d5['query']=_[_0x779d('0x36')](_0x2a0982[_0x779d('0x37')]);_0x2060d5[_0x779d('0x38')]=_['intersection'](_0x2060d5[_0x779d('0x34')],_0x2060d5[_0x779d('0x37')]);_0x22df77[_0x779d('0x39')]=_[_0x779d('0x3a')](_0x2060d5[_0x779d('0x34')],qs[_0x779d('0x3b')](_0x2a0982[_0x779d('0x37')]['fields']));_0x22df77[_0x779d('0x39')]=_0x22df77[_0x779d('0x39')][_0x779d('0x3c')]?_0x22df77['attributes']:_0x2060d5[_0x779d('0x34')];if(!_0x2a0982['query'][_0x779d('0x3d')](_0x779d('0x3e'))){_0x22df77[_0x779d('0x1f')]=qs[_0x779d('0x1f')](_0x2a0982[_0x779d('0x37')][_0x779d('0x1f')]);_0x22df77[_0x779d('0x1d')]=qs[_0x779d('0x1d')](_0x2a0982[_0x779d('0x37')][_0x779d('0x1d')]);}_0x22df77[_0x779d('0x3f')]=qs['sort'](_0x2a0982['query']['sort']);_0x22df77[_0x779d('0x40')]=qs[_0x779d('0x38')](_['pick'](_0x2a0982[_0x779d('0x37')],_0x2060d5[_0x779d('0x38')]),_0xbaaec8);if(_0x2a0982['query'][_0x779d('0x41')]){_0x22df77[_0x779d('0x40')]=_[_0x779d('0x42')](_0x22df77[_0x779d('0x40')],{'$or':_[_0x779d('0x35')](_0xbaaec8,function(_0x3eb60e){if(_0x3eb60e['type']!==_0x779d('0x43')){var _0x51958e={};_0x51958e[_0x3eb60e[_0x779d('0x2c')]]={'$like':'%'+_0x2a0982[_0x779d('0x37')][_0x779d('0x41')]+'%'};return _0x51958e;}})});}_0x22df77=_[_0x779d('0x42')]({},_0x22df77,_0x2a0982[_0x779d('0x44')]);var _0x5292e5={'where':_0x22df77[_0x779d('0x40')]};return db[_0x779d('0x2f')][_0x779d('0x20')](_0x5292e5)[_0x779d('0x27')](function(_0x44a83){_0xae6d6f[_0x779d('0x20')]=_0x44a83;if(_0x2a0982[_0x779d('0x37')]['includeAll']){_0x22df77[_0x779d('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x779d('0x46')](_0x22df77);})[_0x779d('0x27')](function(_0x1aea19){_0xae6d6f['rows']=_0x1aea19;return _0xae6d6f;})['then'](respondWithFilteredResult(_0x1ed423,_0x22df77))[_0x779d('0x47')](handleError(_0x1ed423,null));};exports['show']=function(_0x59dc0c,_0x311d6c){var _0x5a78fd={'raw':![],'where':{'id':_0x59dc0c['params']['id']}},_0x16ec97={};_0x16ec97[_0x779d('0x34')]=_['keys'](db[_0x779d('0x2f')][_0x779d('0x30')]);_0x16ec97[_0x779d('0x37')]=_[_0x779d('0x36')](_0x59dc0c[_0x779d('0x37')]);_0x16ec97[_0x779d('0x38')]=_[_0x779d('0x3a')](_0x16ec97[_0x779d('0x34')],_0x16ec97[_0x779d('0x37')]);_0x5a78fd[_0x779d('0x39')]=_[_0x779d('0x3a')](_0x16ec97['model'],qs[_0x779d('0x3b')](_0x59dc0c[_0x779d('0x37')]['fields']));_0x5a78fd['attributes']=_0x5a78fd[_0x779d('0x39')][_0x779d('0x3c')]?_0x5a78fd['attributes']:_0x16ec97[_0x779d('0x34')];if(_0x59dc0c[_0x779d('0x37')][_0x779d('0x48')]){_0x5a78fd['include']=[{'all':!![]}];}_0x5a78fd=_[_0x779d('0x42')]({},_0x5a78fd,_0x59dc0c[_0x779d('0x44')]);return db[_0x779d('0x2f')][_0x779d('0x49')](_0x5a78fd)[_0x779d('0x27')](handleEntityNotFound(_0x311d6c,null))[_0x779d('0x27')](respondWithResult(_0x311d6c,null))[_0x779d('0x47')](handleError(_0x311d6c,null));};exports[_0x779d('0x4a')]=function(_0x4563a5,_0x3152f2){return db[_0x779d('0x2f')][_0x779d('0x4a')](_0x4563a5['body'],{})['then'](respondWithResult(_0x3152f2,0xc9))[_0x779d('0x47')](handleError(_0x3152f2,null));};exports[_0x779d('0x4b')]=function(_0x4cca7a,_0x4ee07c){var _0x208867={'where':{'id':_0x4cca7a[_0x779d('0x4c')]['id']}},_0x36996f={};_0x36996f[_0x779d('0x34')]=_[_0x779d('0x36')](db['UserProfile'][_0x779d('0x30')]);_0x208867[_0x779d('0x39')]=_[_0x779d('0x3a')](_0x36996f[_0x779d('0x34')],qs[_0x779d('0x3b')](_0x4cca7a[_0x779d('0x37')]['fields']));_0x208867[_0x779d('0x39')]=_0x208867[_0x779d('0x39')][_0x779d('0x3c')]?_0x208867[_0x779d('0x39')]:_0x36996f[_0x779d('0x34')];if(_0x4cca7a[_0x779d('0x37')]['includeAll']){_0x208867[_0x779d('0x45')]=[{'all':!![]}];}_0x208867=_[_0x779d('0x42')]({},_0x208867,_0x4cca7a[_0x779d('0x44')]);return db[_0x779d('0x2f')][_0x779d('0x49')](_0x208867)[_0x779d('0x27')](handleEntityNotFound(_0x4ee07c,null))[_0x779d('0x27')](function(_0x41e706){if(_0x41e706){var _0x1b72d7=_0x41e706[_0x779d('0x4d')]({'plain':!![]});_0x1b72d7=qs[_0x779d('0x4e')](_0x1b72d7,['id','createdAt',_0x779d('0x4f'),'crudPermissions']);_0x4cca7a[_0x779d('0x50')]=_[_0x779d('0x4e')](_0x4cca7a['body'],['id',_0x779d('0x51'),_0x779d('0x4f')]);return db['sequelize'][_0x779d('0x52')](function(_0x118000){return db['UserProfile'][_0x779d('0x4a')](_[_0x779d('0x42')](_0x1b72d7,_0x4cca7a['body']),{'include':_0x4cca7a['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x118000})[_0x779d('0x27')](function(_0x32b828){var _0x203024=_0x32b828[_0x779d('0x4d')]({'plain':!![]});return db[_0x779d('0x53')][_0x779d('0x46')]({'where':{'userProfileId':_0x4cca7a[_0x779d('0x4c')]['id']},'raw':!![]})[_0x779d('0x27')](function(_0x51de2d){if(_0x51de2d){return BPromise[_0x779d('0x54')](_0x51de2d,function(_0x27d2dd){return new BPromise(function(_0x28de2a,_0x2ff0c5){if(_0x27d2dd[_0x779d('0x55')]===null||_0x27d2dd['autoAssociation']===0x1)_0x28de2a(null);return db[_0x779d('0x56')][_0x779d('0x46')]({'where':{'sectionId':_0x27d2dd['id']},'raw':!![]})[_0x779d('0x27')](function(_0x3c075b){var _0x290e3a=_[_0x779d('0x35')](_0x3c075b,function(_0x448236){return qs['omit'](_0x448236,['id','createdAt','updatedAt','sectionId']);});_0x28de2a(_0x290e3a);})[_0x779d('0x47')](function(_0x47eb6e){_0x2ff0c5(_0x47eb6e);});})[_0x779d('0x27')](function(_0xf37e24){var _0x573618=qs['omit'](_0x27d2dd,['id',_0x779d('0x51'),_0x779d('0x4f')]);_0x573618[_0x779d('0x57')]=_0x203024['id'];if(_0xf37e24)_0x573618[_0x779d('0x58')]=_0xf37e24;return _0x573618;})['then'](function(_0x33253c){return db['UserProfileSection'][_0x779d('0x4a')](_0x33253c,{'include':[{'model':db[_0x779d('0x56')],'as':_0x779d('0x58')}],'raw':!![],'transaction':_0x118000});});})[_0x779d('0x27')](function(){return _0x203024;});}});});});}})[_0x779d('0x27')](respondWithResult(_0x4ee07c,0xc9))[_0x779d('0x47')](handleError(_0x4ee07c,null));};exports[_0x779d('0x26')]=function(_0x3fe822,_0x4857a3){if(_0x3fe822[_0x779d('0x50')]['id']){delete _0x3fe822['body']['id'];}return db['UserProfile'][_0x779d('0x49')]({'where':{'id':_0x3fe822['params']['id']}})[_0x779d('0x27')](handleEntityNotFound(_0x4857a3,null))['then'](saveUpdates(_0x3fe822['body'],null))[_0x779d('0x27')](respondWithResult(_0x4857a3,null))[_0x779d('0x47')](handleError(_0x4857a3,null));};exports[_0x779d('0x28')]=function(_0x4caa10,_0x42ecc1){return db[_0x779d('0x2f')][_0x779d('0x49')]({'where':{'id':_0x4caa10['params']['id']}})[_0x779d('0x27')](handleEntityNotFound(_0x42ecc1,null))[_0x779d('0x27')](removeEntity(_0x42ecc1,null))[_0x779d('0x47')](handleError(_0x42ecc1,null));};exports[_0x779d('0x59')]=function(_0x3931c1,_0x232a69){return db[_0x779d('0x2f')][_0x779d('0x59')]()[_0x779d('0x27')](respondWithResult(_0x232a69,null))[_0x779d('0x47')](handleError(_0x232a69,null));};exports[_0x779d('0x5a')]=function(_0x2c121b,_0x32db92){var _0x374432=_0x2c121b[_0x779d('0x50')];return db[_0x779d('0x2f')]['find']({'where':{'id':_0x2c121b['params']['id']}})[_0x779d('0x27')](handleEntityNotFound(_0x32db92,null))[_0x779d('0x27')](function(_0x214dfe){if(_0x214dfe){return db[_0x779d('0x5b')][_0x779d('0x52')](function(_0x402555){return db['UserProfileSection'][_0x779d('0x28')]({'where':{'userProfileId':_0x2c121b[_0x779d('0x4c')]['id'],'sectionId':_[_0x779d('0x35')](_0x374432,function(_0x3d1fe1){return _0x3d1fe1[_0x779d('0x5c')];})},'transaction':_0x402555})[_0x779d('0x27')](function(){var _0xb81003=_[_0x779d('0x35')](_0x374432,function(_0x413cd6){_0x413cd6[_0x779d('0x57')]=_0x2c121b[_0x779d('0x4c')]['id'];return _0x413cd6;});var _0xed8e28=[];return BPromise['each'](_0xb81003,function(_0x291750){return db[_0x779d('0x53')][_0x779d('0x4a')](_0x291750,{'include':[{'model':db[_0x779d('0x56')],'as':_0x779d('0x58')}],'raw':!![],'transaction':_0x402555})[_0x779d('0x27')](function(_0x3485a2){_0xed8e28[_0x779d('0x5d')](_0x3485a2[_0x779d('0x4d')]({'plain':!![]}));});})[_0x779d('0x27')](function(){return _0xed8e28;});});});}})['then'](function(_0x3b9275){return _0x3b9275;})[_0x779d('0x27')](respondWithResult(_0x32db92,null))['catch'](handleError(_0x32db92,null));};exports['removeSections']=function(_0x4edc5b,_0x29a429){var _0x452a0c;return db[_0x779d('0x2f')]['find']({'where':{'id':_0x4edc5b[_0x779d('0x4c')]['id']},'attributes':['id','name']})[_0x779d('0x27')](handleEntityNotFound(_0x29a429,null))[_0x779d('0x27')](function(_0x362316){if(_0x362316){_0x452a0c=_0x362316;return db[_0x779d('0x53')][_0x779d('0x28')]({'where':{'userProfileId':_0x4edc5b[_0x779d('0x4c')]['id'],'sectionId':_0x4edc5b[_0x779d('0x37')]['ids']}});}})[_0x779d('0x27')](function(){return _0x452a0c;})[_0x779d('0x27')](respondWithStatusCode(_0x29a429,null))[_0x779d('0x47')](handleError(_0x29a429,null));};exports[_0x779d('0x5e')]=function(_0x34205b,_0x5e297c){var _0x2a1b69=[];var _0x54b84a=[];return db[_0x779d('0x53')][_0x779d('0x46')]({'where':{'userProfileId':_0x34205b[_0x779d('0x4c')]['id']},'raw':!![]})[_0x779d('0x27')](function(_0x453e39){_0x2a1b69=_['filter'](_0x453e39,function(_0x47dc1b){return _0x47dc1b[_0x779d('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x47dc1b[_0x779d('0x5c')]);});if(!_['isEmpty'](_0x2a1b69)){return _[_0x779d('0x35')](_0x2a1b69,function(_0x5e4f8b){return _0x5e4f8b[_0x779d('0x5c')];});}else{return;}})[_0x779d('0x27')](function(_0x478087){if(_0x478087)_0x54b84a=_0x478087;if(_[_0x779d('0x60')](_0x54b84a,0x64)){var _0x369b5f=_[_0x779d('0x49')](_0x2a1b69,{'sectionId':0x64});return hasDefaultDashboard(_0x369b5f)['then'](function(_0x3591e2){return _[_0x779d('0x35')](_0x2a1b69,function(_0x2e9fc9){if(_0x2e9fc9['sectionId']===0x64){_0x2e9fc9[_0x779d('0x61')]=_0x3591e2;}return _0x2e9fc9;});});}else{return;}})['then'](function(_0xb3f34d){if(_0xb3f34d)_0x2a1b69=_0xb3f34d;if(_[_0x779d('0x60')](_0x54b84a,0x3eb)){var _0x3addec=_['find'](_0x2a1b69,{'sectionId':0x3eb});return getCustomDashboards(_0x3addec)[_0x779d('0x27')](function(_0x246bbe){return _['map'](_0x2a1b69,function(_0x412737){if(_0x3addec['enabled']){if(_0x412737['sectionId']===0x3eb){_0x412737['subsections']=_0x246bbe;}}else{if(_0x412737[_0x779d('0x5c')]===0x64){_0x412737[_0x779d('0x61')]=_0x246bbe;}}return _0x412737;});});}else{return;}})[_0x779d('0x27')](function(_0x55d238){if(_0x55d238)_0x2a1b69=_0x55d238;if(_[_0x779d('0x60')](_0x54b84a,0x709)){var _0x20adb9=_[_0x779d('0x49')](_0x2a1b69,{'sectionId':0x709});return getPlugins(_0x20adb9)[_0x779d('0x27')](function(_0x14b922){if(_0x20adb9['enabled']){return _['map'](_0x2a1b69,function(_0x4d0e3a){if(_0x4d0e3a[_0x779d('0x5c')]===0x709){_0x4d0e3a['subsections']=_0x14b922;}return _0x4d0e3a;});}else{var _0xd87557={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14b922};var _0x5eb1b9=_[_0x779d('0x35')](_0x2a1b69);_0x5eb1b9[_0x779d('0x5d')](_0xd87557);return _0x5eb1b9;}});}else{return;}})['then'](function(_0xdb79b5){if(_0xdb79b5)_0x2a1b69=_0xdb79b5;return _['filter'](_0x2a1b69,[_0x779d('0x5f'),0x1]);})['then'](respondWithResult(_0x5e297c,null))[_0x779d('0x47')](handleError(_0x5e297c,null));};function hasDefaultDashboard(_0x1cc299){var _0x12d081=[0x65];return new BPromise(function(_0x7f6e82,_0x199a7d){try{if(_0x1cc299['autoAssociation']){_0x7f6e82(_0x12d081);}else{return db[_0x779d('0x56')]['findOne']({'where':{'sectionId':_0x1cc299['id']},'raw':!![]})['then'](function(_0x532a5e){_0x532a5e?_0x7f6e82(_0x12d081):_0x7f6e82();});}}catch(_0x2e6e5a){_0x199a7d(_0x2e6e5a);}});}function getCustomDashboards(_0x481264){var _0x1beff6=[];return new BPromise(function(_0x536ab4,_0x2378bd){try{if(_0x481264[_0x779d('0x55')]){return db[_0x779d('0x62')][_0x779d('0x46')]({'raw':!![]})[_0x779d('0x27')](function(_0x547ad0){_0x547ad0['forEach'](function(_0x5473be){_0x1beff6[_0x779d('0x5d')](_0x5473be['id']+0x1869f);});_0x536ab4(_0x1beff6);});}else{return db[_0x779d('0x56')][_0x779d('0x46')]({'where':{'sectionId':_0x481264['id']},'raw':!![]})[_0x779d('0x27')](function(_0x368bc2){_0x368bc2[_0x779d('0x63')](function(_0x25ed30){_0x1beff6[_0x779d('0x5d')](_0x25ed30[_0x779d('0x64')]+0x1869f);});_0x536ab4(_0x1beff6);});}}catch(_0x336ed3){_0x2378bd(_0x336ed3);}});}function getPlugins(_0x2ac1af){var _0x5453a2=[];return new BPromise(function(_0x34ba2a,_0x2f5a69){try{if(_0x2ac1af[_0x779d('0x55')]){return db['Plugin'][_0x779d('0x46')]({'raw':!![]})[_0x779d('0x27')](function(_0x2d2a41){_0x2d2a41[_0x779d('0x63')](function(_0x383787){_0x5453a2[_0x779d('0x5d')](_0x383787['id']+0x15b38);});_0x34ba2a(_0x5453a2);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2ac1af['id']},'raw':!![]})[_0x779d('0x27')](function(_0x414191){_0x414191[_0x779d('0x63')](function(_0x387910){_0x5453a2['push'](_0x387910[_0x779d('0x64')]+0x15b38);});_0x34ba2a(_0x5453a2);});}}catch(_0x3ed98c){_0x2f5a69(_0x3ed98c);}});}exports[_0x779d('0x65')]=function(_0x33ac4b,_0x4a26fa){return db[_0x779d('0x2f')]['find']({'where':{'id':_0x33ac4b['params']['id']}})[_0x779d('0x27')](handleEntityNotFound(_0x4a26fa,null))[_0x779d('0x27')](function(_0x5f1fff){if(_0x5f1fff){return db[_0x779d('0x5b')][_0x779d('0x52')](function(_0x23475a){return db[_0x779d('0x53')][_0x779d('0x46')]({'where':{'userProfileId':_0x33ac4b[_0x779d('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x779d('0x27')](function(_0x4243fc){if(_0x4243fc){return db[_0x779d('0x53')]['destroy']({'where':{'userProfileId':_0x33ac4b[_0x779d('0x4c')]['id'],'id':_[_0x779d('0x35')](_0x4243fc,function(_0x19d989){return _0x19d989['id'];})},'transaction':_0x23475a});}})['then'](function(_0x28e067){var _0x28cc57=_[_0x779d('0x35')](_0x33ac4b[_0x779d('0x50')],function(_0x39b474){_0x39b474[_0x779d('0x57')]=_0x33ac4b[_0x779d('0x4c')]['id'];return _0x39b474;});return db[_0x779d('0x53')]['bulkCreate'](_0x28cc57,{'raw':!![],'transaction':_0x23475a});})['then'](function(_0x3955dd){var _0x2579c8=_[_0x779d('0x41')](_['map'](_0x3955dd,function(_0x380d11){return _0x380d11[_0x779d('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x2579c8){return db[_0x779d('0x53')][_0x779d('0x46')]({'where':{'userProfileId':_0x33ac4b['params']['id'],'sectionId':_[_0x779d('0x35')](_0x2579c8,function(_0x2d4d35){return _0x2d4d35[_0x779d('0x5c')];})},'attributes':['id',_0x779d('0x5c')],'raw':!![]})['then'](function(_0x500018){var _0x919c02=_[_0x779d('0x35')](_0x33ac4b[_0x779d('0x50')],function(_0x12e8f3){_0x12e8f3[_0x779d('0x57')]=_0x33ac4b[_0x779d('0x4c')]['id'];return _0x12e8f3;});return db[_0x779d('0x56')][_0x779d('0x66')](_0x919c02,{'raw':!![],'transaction':_0x23475a});});}})[_0x779d('0x47')](handleError(_0x4a26fa,null));});}})['then'](function(_0x333282){var _0x5d6e65=_[_0x779d('0x35')](_0x333282,function(_0x54e56e){return _0x54e56e[_0x779d('0x4d')]({'plain':!![]});});})[_0x779d('0x27')](respondWithResult(_0x4a26fa,null))[_0x779d('0x47')](handleError(_0x4a26fa,null));};exports[_0x779d('0x67')]=function(_0x2ca8a1,_0x3eba0f,_0xb67711){return db[_0x779d('0x2f')][_0x779d('0x49')]({'where':{'id':_0x2ca8a1[_0x779d('0x4c')]['id']}})[_0x779d('0x27')](handleEntityNotFound(_0x3eba0f,null))[_0x779d('0x27')](function(_0x5301b1){if(_0x5301b1){return _0x5301b1[_0x779d('0x67')](_0x2ca8a1[_0x779d('0x37')][_0x779d('0x68')]);}})['then'](respondWithStatusCode(_0x3eba0f,null))[_0x779d('0x47')](handleError(_0x3eba0f,null));};exports['getResources']=function(_0x4bd44e,_0x3bae59){var _0x31a1a5={};if(!_0x4bd44e[_0x779d('0x37')][_0x779d('0x69')])throw new Error(_0x779d('0x6a'));if(!_0x4bd44e['query']['hasOwnProperty'](_0x779d('0x3e'))){_0x31a1a5[_0x779d('0x1f')]=qs[_0x779d('0x1f')](_0x4bd44e[_0x779d('0x37')][_0x779d('0x1f')]);_0x31a1a5[_0x779d('0x1d')]=qs[_0x779d('0x1d')](_0x4bd44e[_0x779d('0x37')]['offset']);}return db[_0x779d('0x2f')]['find']({'where':{'id':_0x4bd44e[_0x779d('0x4c')]['id']}})[_0x779d('0x27')](function(_0x52cd8e){if(!_0x52cd8e)throw new Error(_0x779d('0x6b')+_0x4bd44e[_0x779d('0x4c')]['id']);return db[_0x779d('0x2f')][_0x779d('0x6c')](_0x4bd44e);})[_0x779d('0x27')](respondWithFilteredResult(_0x3bae59,_0x31a1a5))[_0x779d('0x47')](handleError(_0x3bae59,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ac74d0d..33baf66 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 _0x2272=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x2227('0x0'));var UserProfile=require(_0x2227('0x1'))['db'][_0x2227('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2227('0x3')](0x0);var events={'afterCreate':_0x2227('0x4'),'afterUpdate':'update','afterDestroy':_0x2227('0x5')};function emitEvent(_0x3bb7ba){return function(_0x1f5a4a,_0x4c17c2,_0x4ebde3){UserProfileEvents[_0x2227('0x6')](_0x3bb7ba+':'+_0x1f5a4a['id'],_0x1f5a4a);UserProfileEvents[_0x2227('0x6')](_0x3bb7ba,_0x1f5a4a);_0x4ebde3(null);};}for(var e in events){if(events[_0x2227('0x7')](e)){var event=events[e];UserProfile[_0x2227('0x8')](e,emitEvent(event));}}module[_0x2227('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x15ef=['../../mysqldb','UserProfile','save','update','remove','emit','hook','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x15ef,0x80));var _0xf15e=function(_0x5da4d2,_0x30a73b){_0x5da4d2=_0x5da4d2-0x0;var _0x13ebe9=_0x15ef[_0x5da4d2];return _0x13ebe9;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf15e('0x0'))['db'][_0xf15e('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf15e('0x2'),'afterUpdate':_0xf15e('0x3'),'afterDestroy':_0xf15e('0x4')};function emitEvent(_0x347c12){return function(_0x4e7241,_0x5d456b,_0x1b9a24){UserProfileEvents[_0xf15e('0x5')](_0x347c12+':'+_0x4e7241['id'],_0x4e7241);UserProfileEvents['emit'](_0x347c12,_0x4e7241);_0x1b9a24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf15e('0x6')](e,emitEvent(event));}}module[_0xf15e('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index cbbd72d..ab2eed8 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 _0xa5cb=['CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','openTabs','true','dataValues','sms','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','name','projects','JscriptyProject','CmContact','parentSections','Lists','companies','CmCompany','ChatQueue','chatwebsites','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','inbound','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','metrics','Sequelize','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','rawAttributes','keys','intersection','attributes','fields','limit','offset','order','sort','filters','pick','key','foreignKey','forEach','merge','options','autoAssociation','includeAll','include','reportType','default','reportId','DefaultReports','custom'];(function(_0x40b44c,_0x41d333){var _0x102e88=function(_0x14a386){while(--_0x14a386){_0x40b44c['push'](_0x40b44c['shift']());}};_0x102e88(++_0x41d333);}(_0xa5cb,0xcb));var _0xba5c=function(_0x555baf,_0x3ed4ef){_0x555baf=_0x555baf-0x0;var _0xddfdb1=_0xa5cb[_0x555baf];return _0xddfdb1;};'use strict';var _=require(_0xba5c('0x0'));var attributes=require(_0xba5c('0x1'));var qs=require(_0xba5c('0x2'));var squel=require(_0xba5c('0x3'));module[_0xba5c('0x4')]=function(_0x42ef13){var _0x402eb3=_0x42ef13[_0xba5c('0x5')];function _0x47329f(_0x8c966b,_0x16b7b7){return new Promise(function(_0x46f2a2,_0x5f2dde){if(!_0x16b7b7)return _0x46f2a2(null);var _0x47ab86=_0x16b7b7[_0xba5c('0x6')]?{[_0x16b7b7[_0xba5c('0x6')][_0xba5c('0x7')]]:_0x16b7b7[_0xba5c('0x6')][_0xba5c('0x8')]}:undefined;return _0x402eb3[_0x8c966b][_0xba5c('0x9')]({'where':_0x47ab86,'raw':!![]})[_0xba5c('0xa')](function(_0x223e76){_0x16b7b7[_0xba5c('0xb')]=_[_0xba5c('0xc')](_0x223e76,'id');_0x46f2a2(_0x16b7b7);})[_0xba5c('0xd')](function(_0x718703){_0x5f2dde(_0x718703);});});}function _0x20d082(_0x2e44f7,_0x10c672){return new Promise(function(_0x48fb37,_0x51c9e3){var _0x1e01d8=_0x2e44f7[_0xba5c('0x6')]?{[_0x2e44f7[_0xba5c('0x6')]['field']]:_0x2e44f7['filter'][_0xba5c('0x8')]}:undefined;return _0x402eb3[_0x2e44f7[_0xba5c('0xe')]][_0xba5c('0x9')]({'where':_0x1e01d8,'raw':!![]})[_0xba5c('0xa')](function(_0x23fb1f){_0x10c672[_0xba5c('0xb')]=_['map'](_0x23fb1f,function(_0x1424b7){return _0x1424b7['name'];});_0x48fb37(_0x10c672);})[_0xba5c('0xd')](function(_0x4ee6c7){_0x51c9e3(_0x4ee6c7);});});}function _0x25c2ae(_0xa4ca50,_0x5c94cd,_0xa929c9){if(!_0x5c94cd)return Promise[_0xba5c('0xf')](null);return new Promise(function(_0x500e69,_0x161c27){return _0x402eb3[_0xba5c('0x10')][_0xba5c('0x9')]({'where':{'sectionId':_0x5c94cd['id']},'raw':!![]})['then'](function(_0x154575){if(_0xa4ca50[_0xba5c('0x7')]&&_0xa4ca50[_0xba5c('0x7')]!=='id'){_0x5c94cd['associatedResources']=_[_0xba5c('0xc')](_0x154575,function(_0x7e1c12){return _0x7e1c12[_0xa4ca50[_0xba5c('0x7')]];});}else{if(_0xa929c9===_0xba5c('0x11')){_0x5c94cd[_0xba5c('0xb')]=_[_0xba5c('0xc')](_0x154575,function(_0x1d7584){return{'id':_0x1d7584[_0xba5c('0x12')],'type':_0x1d7584[_0xba5c('0x13')]};});}else{_0x5c94cd['associatedResources']=_[_0xba5c('0xc')](_0x154575,function(_0x106dc2){return _0x106dc2[_0xba5c('0x12')];});}}_0x500e69(_0x5c94cd);})[_0xba5c('0xd')](function(_0x4e40c5){_0x161c27(_0x4e40c5);});});}function _0x16805a(_0x3bbb5d,_0x11e14d){var _0x5950fe={'parentSections':[]};switch(_0x3bbb5d[_0xba5c('0x14')]()){case _0xba5c('0x15'):_0x5950fe['childModel']='SquareProject';break;case _0xba5c('0x16'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x18');break;case _0xba5c('0x19'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x1a');_0x5950fe['parentSections']=[{'name':_0xba5c('0x1b'),'field':_0xba5c('0x1c'),'foreignKey':'projectName'}];break;case _0xba5c('0x1d'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x1e');break;case'contacts':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x1f');_0x5950fe[_0xba5c('0x20')]=[{'name':_0xba5c('0x21'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x5950fe[_0xba5c('0x17')]='CmList';break;case _0xba5c('0x22'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x23');break;case'globalcustomfields':_0x5950fe[_0xba5c('0x17')]='CmCustomField';break;case'chatqueues':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x24');break;case _0xba5c('0x25'):_0x5950fe['childModel']='ChatWebsite';break;case'faxqueues':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x26');break;case _0xba5c('0x27'):_0x5950fe[_0xba5c('0x17')]='FaxAccount';break;case _0xba5c('0x28'):case _0xba5c('0x29'):case _0xba5c('0x2a'):_0x5950fe['childModel']=_0xba5c('0x2b');break;case _0xba5c('0x2c'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x2d');break;case _0xba5c('0x2e'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x2f');break;case _0xba5c('0x30'):_0x5950fe[_0xba5c('0x17')]='VoiceRecording';_0x5950fe[_0xba5c('0x20')]=[{'name':_0xba5c('0x31'),'field':'name','foreignKey':_0xba5c('0x32'),'model':_0xba5c('0x33'),'filter':{'field':_0xba5c('0x34'),'value':[_0xba5c('0x35')]}},{'name':'Telephones','field':_0xba5c('0x1c'),'foreignKey':_0xba5c('0x32'),'model':'User','filter':{'field':_0xba5c('0x34'),'value':[_0xba5c('0x36')]}},{'name':_0xba5c('0x37'),'field':_0xba5c('0x1c'),'foreignKey':_0xba5c('0x38'),'model':'VoiceQueue','filter':{'field':_0xba5c('0x13'),'value':[_0xba5c('0x39')]}},{'name':'QueueCampaigns','field':_0xba5c('0x1c'),'foreignKey':_0xba5c('0x38'),'model':_0xba5c('0x3a'),'filter':{'field':_0xba5c('0x13'),'value':[_0xba5c('0x3b')]}}];break;case'musiconholds':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x3c');break;case _0xba5c('0x3d'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x3e');break;case'voiceprefixes':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x3f');break;case _0xba5c('0x40'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x41');break;case'mailqueues':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x42');break;case _0xba5c('0x43'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x44');break;case _0xba5c('0x45'):_0x5950fe['childModel']='MailSubstatus';break;case _0xba5c('0x46'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x47');break;case _0xba5c('0x48'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x49');break;case _0xba5c('0x4a'):_0x5950fe['childModel']='SmsQueue';break;case'smsaccounts':_0x5950fe[_0xba5c('0x17')]='SmsAccount';break;case _0xba5c('0x4b'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x4c');break;case _0xba5c('0x4d'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x4e');break;case _0xba5c('0x4f'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x50');break;case _0xba5c('0x51'):case _0xba5c('0x52'):_0x5950fe[_0xba5c('0x17')]='VoiceQueue';if(_0x11e14d){_0x5950fe['parentSections']=[{'name':_0xba5c('0x37')},{'name':_0xba5c('0x53')}];}break;case _0xba5c('0x54'):case _0xba5c('0x55'):case _0xba5c('0x56'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x33');if(_0x11e14d){_0x5950fe['parentSections']=[{'name':_0xba5c('0x57'),'filter':{'field':'role','value':['admin',_0xba5c('0x58')]},'ignore':!![]},{'name':_0xba5c('0x31')},{'name':_0xba5c('0x59')}];}break;case _0xba5c('0x5a'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x5b');break;case _0xba5c('0x5c'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x5d');break;case'freshdeskaccounts':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x5e');break;case _0xba5c('0x5f'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x60');break;case _0xba5c('0x61'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x62');break;case _0xba5c('0x63'):_0x5950fe['childModel']=_0xba5c('0x64');break;case _0xba5c('0x65'):_0x5950fe['childModel']='User';break;case _0xba5c('0x66'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x67');break;case _0xba5c('0x68'):_0x5950fe['childModel']='Disposition';break;case'customdashboards':_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x69');break;case _0xba5c('0x6a'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x6b');break;case _0xba5c('0x6c'):_0x5950fe['childModel']=_0xba5c('0x6d');break;case _0xba5c('0x6e'):_0x5950fe['childModel']=_0xba5c('0x6f');break;case _0xba5c('0x70'):_0x5950fe['childModel']=_0xba5c('0x71');break;case _0xba5c('0x72'):_0x5950fe[_0xba5c('0x17')]='Tag';break;case _0xba5c('0x73'):_0x5950fe['childModel']='Template';break;case _0xba5c('0x74'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x75');break;case _0xba5c('0x76'):_0x5950fe['childModel']=_0xba5c('0x77');break;case _0xba5c('0x78'):_0x5950fe[_0xba5c('0x17')]='Variable';break;case _0xba5c('0x79'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x7a');break;case _0xba5c('0x7b'):_0x5950fe[_0xba5c('0x17')]=_0xba5c('0x11');_0x5950fe[_0xba5c('0x20')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xba5c('0x7c'):_0x5950fe['childModel']='AnalyticMetric';break;}return _0x5950fe;}function _0x401e3d(_0x450fcd,_0x3b34a){var _0x12c101=_0x450fcd['charAt'](0x0)['toUpperCase']()+_0x450fcd['slice'](0x1);var _0x5bcaa2={'type':_0x402eb3[_0xba5c('0x7d')]['QueryTypes'][_0xba5c('0x7e')],'raw':!![]};return new Promise(function(_0x268c14,_0x1a9753){var _0x36c218=squel['select']()[_0xba5c('0x7')](_0xba5c('0x7f')+_0x12c101+_0xba5c('0x80'),'id')['field'](_0xba5c('0x81'))[_0xba5c('0x82')](_0xba5c('0x83')+_0x450fcd+'_interactions','ui')[_0xba5c('0x84')](_0xba5c('0x85'),_0x3b34a['id']);return _0x402eb3[_0xba5c('0x86')][_0xba5c('0x87')](_0x36c218[_0xba5c('0x88')](),_0x5bcaa2)[_0xba5c('0xa')](function(_0xc5bd55){_0x3b34a[_0x12c101+_0xba5c('0x89')]=_0xc5bd55;_0x268c14(_0xc5bd55);})['catch'](function(_0x490a0a){_0x1a9753(_0x490a0a);});});}return _0x42ef13['define']('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x29dd5f){var _0x1cc242={'raw':_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x8a')],'where':{}};var _0x428a5d={};var _0x3b8029={'count':0x0,'rows':[]};var _0x241fe6=_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x8b')];var _0x54e3ba=_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x8c')]||![];var _0x307928=_0x16805a(_0x241fe6,_0x54e3ba);if(!_0x307928[_0xba5c('0x17')])throw new Error('Invalid\x20section\x20\x27'+_0x241fe6+'\x27');var _0xe34f3b=[{'name':_0x241fe6}];if(!_[_0xba5c('0x8d')](_0x307928[_0xba5c('0x20')]))_0xe34f3b=_0x307928[_0xba5c('0x20')];var _0x5a1461=[];for(var _0x1ae53b=0x0;_0x1ae53b<_0xe34f3b[_0xba5c('0x8e')];_0x1ae53b++){_0x5a1461[_0xba5c('0x8f')](_0x402eb3[_0xba5c('0x90')][_0xba5c('0x91')]({'where':{'userProfileId':_0x29dd5f[_0xba5c('0x92')]['id'],'name':_0xe34f3b[_0x1ae53b][_0xba5c('0x1c')]},'raw':!![]}));}return Promise[_0xba5c('0x93')](_0x5a1461)['then'](function(_0x32fa89){var _0x4454e2=_[_0xba5c('0x6')](_0x32fa89,function(_0x44ea13){return _0x44ea13?_0x44ea13:undefined;});var _0x392f74=_[_0xba5c('0x6')](_0xe34f3b,['ignore',!![]]);var _0x5bb496=_[_0xba5c('0x8d')](_0x4454e2)&&_[_0xba5c('0x8d')](_0x392f74)?null:_['union'](_0x392f74,_0x4454e2);if(!_0x5bb496)return null;var _0x5e43fc=[];for(var _0x4b0dd5=0x0;_0x4b0dd5<_0x5bb496[_0xba5c('0x8e')];_0x4b0dd5++){var _0x2c4637=_[_0xba5c('0x91')](_0xe34f3b,function(_0x16d8d7){return _0x5bb496[_0x4b0dd5]?_0x16d8d7[_0xba5c('0x1c')]===_0x5bb496[_0x4b0dd5][_0xba5c('0x1c')]:null;});if(_0x2c4637){if(_0x5bb496[_0x4b0dd5][_0xba5c('0x94')]){_0x5e43fc['push'](_0x47329f(_0x307928[_0xba5c('0x17')],_0x5bb496[_0x4b0dd5]));}else{if(!_0x5bb496[_0x4b0dd5]['autoAssociation']){_0x5e43fc['push'](_0x25c2ae(_0x2c4637,_0x5bb496[_0x4b0dd5],_0x307928['childModel']));}else{if(_0x2c4637[_0xba5c('0xe')]){_0x5e43fc[_0xba5c('0x8f')](_0x20d082(_0x2c4637,_0x5bb496[_0x4b0dd5]));}}}}}return Promise['all'](_0x5e43fc);})[_0xba5c('0xa')](function(_0x18ecbf){var _0x284f86=_0x18ecbf;var _0x23ed31=null;if(_0x284f86){_0x23ed31=_0x284f86[_0xba5c('0x8e')]===0x1?_0x284f86[0x0]:null;}if(!_0x23ed31&&!_0x284f86)return _0x3b8029;var _0x467b74=_0x402eb3[_0x307928[_0xba5c('0x17')]][_0xba5c('0x95')];_0x428a5d[_0xba5c('0xe')]=_['keys'](_0x467b74);_0x428a5d[_0xba5c('0x87')]=_[_0xba5c('0x96')](_0x29dd5f[_0xba5c('0x87')]);_0x428a5d['filters']=_[_0xba5c('0x97')](_0x428a5d[_0xba5c('0xe')],_0x428a5d[_0xba5c('0x87')]);_0x1cc242[_0xba5c('0x98')]=_[_0xba5c('0x97')](_0x428a5d[_0xba5c('0xe')],qs[_0xba5c('0x99')](_0x29dd5f[_0xba5c('0x87')]['fields']));_0x1cc242[_0xba5c('0x98')]=_0x1cc242[_0xba5c('0x98')]['length']?_0x1cc242['attributes']:_0x428a5d[_0xba5c('0xe')];if(!_0x29dd5f['query']['hasOwnProperty']('nolimit')){_0x1cc242['limit']=qs['limit'](_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x9a')]);_0x1cc242['offset']=qs[_0xba5c('0x9b')](_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x9b')]);}_0x1cc242[_0xba5c('0x9c')]=qs[_0xba5c('0x9d')](_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x9d')]);_0x1cc242[_0xba5c('0x84')]=qs[_0xba5c('0x9e')](_[_0xba5c('0x9f')](_0x29dd5f[_0xba5c('0x87')],_0x428a5d['filters']));if(_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x6')]){_0x1cc242[_0xba5c('0x84')]=_['merge'](_0x1cc242[_0xba5c('0x84')],{'$or':_[_0xba5c('0xc')](_0x467b74,function(_0x38533f){if(_0x38533f[_0xba5c('0x13')][_0xba5c('0xa0')]!=='VIRTUAL'){var _0x1cd9e8={};_0x1cd9e8[_0x38533f[_0xba5c('0x7')]]={'$like':'%'+_0x29dd5f[_0xba5c('0x87')][_0xba5c('0x6')]+'%'};return _0x1cd9e8;}})});}var _0x452a44=[];var _0x311501=null;var _0x1c77f1={};if(_0x23ed31){_0x311501=_['find'](_0xe34f3b,[_0xba5c('0x1c'),_0x23ed31[_0xba5c('0x1c')]]);if(_0x311501['field']){_0x1c77f1={};if(_0x307928[_0xba5c('0x17')]===_0xba5c('0x11')){_0x1c77f1[_0x311501[_0xba5c('0xa1')]]=_[_0xba5c('0xc')](_0x23ed31[_0xba5c('0xb')],'id');}else{_0x1c77f1[_0x311501[_0xba5c('0xa1')]]=_0x23ed31['associatedResources'];}_0x452a44[_0xba5c('0x8f')](_0x1c77f1);}else{_0x1cc242[_0xba5c('0x84')]['id']=_0x23ed31[_0xba5c('0xb')];}}else{for(var _0x121b73=0x0;_0x121b73<_0x284f86[_0xba5c('0x8e')];_0x121b73++){_0x311501=_[_0xba5c('0x91')](_0xe34f3b,[_0xba5c('0x1c'),_0x284f86[_0x121b73][_0xba5c('0x1c')]]);if(_0x311501[_0xba5c('0x7')]){_0x1c77f1={};_0x1c77f1[_0x311501[_0xba5c('0xa1')]]=_0x284f86[_0x121b73][_0xba5c('0xb')];_0x452a44[_0xba5c('0x8f')](_0x1c77f1);}else{if(!_0x1cc242[_0xba5c('0x84')]['id'])_0x1cc242['where']['id']=[];_0x284f86[_0x121b73][_0xba5c('0xb')][_0xba5c('0xa2')](function(_0x4b1e92){_0x1cc242[_0xba5c('0x84')]['id'][_0xba5c('0x8f')](_0x4b1e92);});}}}if(!_[_0xba5c('0x8d')](_0x452a44)){_0x1cc242[_0xba5c('0x84')]=_[_0xba5c('0xa3')](_0x1cc242['where'],{'$and':{'$or':_0x452a44}});}_0x1cc242=_[_0xba5c('0xa3')]({},_0x1cc242,_0x29dd5f[_0xba5c('0xa4')]);if(_0x23ed31&&!_0x23ed31[_0xba5c('0xa5')]&&_0x307928['childModel']===_0xba5c('0x11')){if(_0x29dd5f[_0xba5c('0x87')][_0xba5c('0xa6')]){_0x1cc242[_0xba5c('0xa7')]=[{'all':!![]}];}return _0x402eb3[_0x307928[_0xba5c('0x17')]][_0xba5c('0x9')](_0x1cc242)[_0xba5c('0xa')](function(_0xa24a25){var _0x547abf=[];_0xa24a25[_0xba5c('0xa2')](function(_0x7557b6){var _0x5a5116;switch(_0x7557b6[_0xba5c('0xa8')]){case _0xba5c('0xa9'):_0x5a5116=_[_0xba5c('0x91')](_0x23ed31[_0xba5c('0xb')],function(_0x37e028){return _0x37e028['id']===_0x7557b6[_0xba5c('0xaa')]&&_0x37e028[_0xba5c('0x13')]===_0xba5c('0xab');});break;case _0xba5c('0xac'):_0x5a5116=_[_0xba5c('0x91')](_0x23ed31[_0xba5c('0xb')],function(_0x5a1f98){return _0x5a1f98['id']===_0x7557b6[_0xba5c('0xaa')]&&_0x5a1f98[_0xba5c('0x13')]===_0xba5c('0xad');});break;}if(_0x5a5116)_0x547abf[_0xba5c('0x8f')](_0x7557b6);});_0x3b8029[_0xba5c('0xae')]=_0x547abf[_0xba5c('0x8e')];_0x3b8029[_0xba5c('0xaf')]=_0x547abf;return _0x3b8029;});}else{if(!_[_0xba5c('0x8d')](_0x29dd5f['query']['ids'])){_0x1cc242[_0xba5c('0x84')]['id']=_0x1cc242[_0xba5c('0x84')]['id']?_[_0xba5c('0x97')](_0x1cc242['where']['id'],_0x29dd5f['query'][_0xba5c('0xb0')]):_0x29dd5f['query']['ids'];if(_0x29dd5f['query'][_0xba5c('0xb1')]){_0x1cc242[_0xba5c('0x9c')]=_0x29dd5f[_0xba5c('0x87')][_0xba5c('0xb1')];}}if(_0x29dd5f['query'][_0xba5c('0xb2')]){_0x1cc242[_0xba5c('0x84')]=_[_0xba5c('0xa3')](_0x1cc242[_0xba5c('0x84')],{'$and':_0x29dd5f[_0xba5c('0x87')][_0xba5c('0xb2')]});}return _0x402eb3[_0x307928[_0xba5c('0x17')]][_0xba5c('0xae')]({'where':_0x1cc242[_0xba5c('0x84')]})[_0xba5c('0xa')](function(_0x219d4c){_0x3b8029[_0xba5c('0xae')]=_0x219d4c;if(_0x29dd5f['query']['includeAll']){if(_0x307928[_0xba5c('0x17')]==='CmContact'){_0x1cc242[_0xba5c('0xa7')]=[{'model':_0x402eb3[_0xba5c('0xb3')],'as':_0xba5c('0xb4'),'attributes':['id',_0xba5c('0x1c'),_0xba5c('0xb5')],'required':_0x29dd5f[_0xba5c('0x87')]['tag']?!![]:![]},{'model':_0x402eb3[_0xba5c('0xb3')],'as':'ThroughTags','attributes':['id','name',_0xba5c('0xb5')],'through':_0x29dd5f[_0xba5c('0x87')][_0xba5c('0xb6')]?{'attributes':[],'where':{'TagId':_0x29dd5f[_0xba5c('0x87')][_0xba5c('0xb6')]||undefined}}:{},'required':_0x29dd5f[_0xba5c('0x87')][_0xba5c('0xb6')]?!![]:![]}];}else{_0x1cc242[_0xba5c('0xa7')]=[{'all':!![]}];}}return _0x402eb3[_0x307928['childModel']]['findAll'](_0x1cc242);})[_0xba5c('0xa')](function(_0x25c801){_0x3b8029[_0xba5c('0xaf')]=_0x25c801;if(_0x241fe6===_0xba5c('0x31')&&_0x29dd5f['query'][_0xba5c('0xb7')]===_0xba5c('0xb8')){var _0x3f92fb=[];for(var _0x5797cd=0x0;_0x5797cd<_0x3b8029[_0xba5c('0xaf')][_0xba5c('0x8e')];_0x5797cd++){_0x3f92fb[_0xba5c('0x8f')](_0x401e3d('chat',_0x3b8029[_0xba5c('0xaf')][_0x5797cd][_0xba5c('0xb9')]));_0x3f92fb['push'](_0x401e3d(_0xba5c('0xba'),_0x3b8029[_0xba5c('0xaf')][_0x5797cd]['dataValues']));_0x3f92fb[_0xba5c('0x8f')](_0x401e3d('fax',_0x3b8029[_0xba5c('0xaf')][_0x5797cd][_0xba5c('0xb9')]));_0x3f92fb[_0xba5c('0x8f')](_0x401e3d('mail',_0x3b8029[_0xba5c('0xaf')][_0x5797cd]['dataValues']));_0x3f92fb[_0xba5c('0x8f')](_0x401e3d('openchannel',_0x3b8029[_0xba5c('0xaf')][_0x5797cd][_0xba5c('0xb9')]));_0x3f92fb[_0xba5c('0x8f')](_0x401e3d(_0xba5c('0xbb'),_0x3b8029[_0xba5c('0xaf')][_0x5797cd][_0xba5c('0xb9')]));}return Promise[_0xba5c('0x93')](_0x3f92fb)[_0xba5c('0xa')](function(){return _0x3b8029;});}return _0x3b8029;});}});}}});}; \ No newline at end of file +var _0x2b4d=['Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','union','ignore','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','include','Tags','color','tag','Agents','openTabs','true','chat','dataValues','sms','mail','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','associatedResources','map','catch','model','name','then','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','childModel','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables'];(function(_0x1c1be7,_0x3c9a22){var _0x103181=function(_0x2dfbdc){while(--_0x2dfbdc){_0x1c1be7['push'](_0x1c1be7['shift']());}};_0x103181(++_0x3c9a22);}(_0x2b4d,0x109));var _0xd2b4=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x2b4d[_0x2ca9d4];return _0x258956;};'use strict';var _=require('lodash');var attributes=require(_0xd2b4('0x0'));var qs=require(_0xd2b4('0x1'));var squel=require(_0xd2b4('0x2'));module[_0xd2b4('0x3')]=function(_0x52e6de){var _0x484db9=_0x52e6de[_0xd2b4('0x4')];function _0x2f3e40(_0x2c5ac3,_0x252b45){return new Promise(function(_0x4d27ad,_0x15e188){if(!_0x252b45)return _0x4d27ad(null);var _0x4eb0c1=_0x252b45[_0xd2b4('0x5')]?{[_0x252b45[_0xd2b4('0x5')][_0xd2b4('0x6')]]:_0x252b45[_0xd2b4('0x5')]['value']}:undefined;return _0x484db9[_0x2c5ac3][_0xd2b4('0x7')]({'where':_0x4eb0c1,'raw':!![]})['then'](function(_0x1f3629){_0x252b45[_0xd2b4('0x8')]=_[_0xd2b4('0x9')](_0x1f3629,'id');_0x4d27ad(_0x252b45);})[_0xd2b4('0xa')](function(_0x420f0d){_0x15e188(_0x420f0d);});});}function _0x3c58e1(_0x5c20c6,_0x4a76dd){return new Promise(function(_0x405009,_0xce1d24){var _0x14c1ab=_0x5c20c6['filter']?{[_0x5c20c6[_0xd2b4('0x5')][_0xd2b4('0x6')]]:_0x5c20c6[_0xd2b4('0x5')]['value']}:undefined;return _0x484db9[_0x5c20c6[_0xd2b4('0xb')]][_0xd2b4('0x7')]({'where':_0x14c1ab,'raw':!![]})['then'](function(_0x581e0f){_0x4a76dd[_0xd2b4('0x8')]=_[_0xd2b4('0x9')](_0x581e0f,function(_0x5cb60c){return _0x5cb60c[_0xd2b4('0xc')];});_0x405009(_0x4a76dd);})[_0xd2b4('0xa')](function(_0x3c5e0f){_0xce1d24(_0x3c5e0f);});});}function _0x152b2a(_0x36fd88,_0x3ccd5a,_0x592775){if(!_0x3ccd5a)return Promise['resolve'](null);return new Promise(function(_0xd9e5c5,_0x22553d){return _0x484db9['UserProfileResource'][_0xd2b4('0x7')]({'where':{'sectionId':_0x3ccd5a['id']},'raw':!![]})[_0xd2b4('0xd')](function(_0x531f4d){if(_0x36fd88[_0xd2b4('0x6')]&&_0x36fd88[_0xd2b4('0x6')]!=='id'){_0x3ccd5a[_0xd2b4('0x8')]=_[_0xd2b4('0x9')](_0x531f4d,function(_0x471e8d){return _0x471e8d[_0x36fd88[_0xd2b4('0x6')]];});}else{if(_0x592775===_0xd2b4('0xe')){_0x3ccd5a[_0xd2b4('0x8')]=_['map'](_0x531f4d,function(_0x12e75d){return{'id':_0x12e75d[_0xd2b4('0xf')],'type':_0x12e75d[_0xd2b4('0x10')]};});}else{_0x3ccd5a[_0xd2b4('0x8')]=_[_0xd2b4('0x9')](_0x531f4d,function(_0x6ddd00){return _0x6ddd00['resourceId'];});}}_0xd9e5c5(_0x3ccd5a);})['catch'](function(_0x3630ee){_0x22553d(_0x3630ee);});});}function _0x1cfe7d(_0x37f9ef,_0x28507b){var _0x39afdd={'parentSections':[]};switch(_0x37f9ef[_0xd2b4('0x11')]()){case _0xd2b4('0x12'):_0x39afdd['childModel']=_0xd2b4('0x13');break;case'odbc':_0x39afdd['childModel']=_0xd2b4('0x14');break;case _0xd2b4('0x15'):_0x39afdd[_0xd2b4('0x16')]='SquareRecording';_0x39afdd['parentSections']=[{'name':'SquareProjects','field':_0xd2b4('0xc'),'foreignKey':'projectName'}];break;case _0xd2b4('0x17'):_0x39afdd['childModel']=_0xd2b4('0x18');break;case _0xd2b4('0x19'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x1a');_0x39afdd[_0xd2b4('0x1b')]=[{'name':_0xd2b4('0x1c'),'field':'id','foreignKey':_0xd2b4('0x1d')}];break;case'lists':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x1e');break;case'companies':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x1f');break;case _0xd2b4('0x20'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x21');break;case _0xd2b4('0x22'):_0x39afdd['childModel']=_0xd2b4('0x23');break;case'chatwebsites':_0x39afdd['childModel']='ChatWebsite';break;case _0xd2b4('0x24'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x25');break;case'faxaccounts':_0x39afdd['childModel']='FaxAccount';break;case'inboundroutes':case _0xd2b4('0x26'):case _0xd2b4('0x27'):_0x39afdd['childModel']=_0xd2b4('0x28');break;case _0xd2b4('0x29'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x2a');break;case _0xd2b4('0x2b'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x2c');break;case _0xd2b4('0x2d'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x2e');_0x39afdd['parentSections']=[{'name':'Agents','field':_0xd2b4('0xc'),'foreignKey':_0xd2b4('0x2f'),'model':_0xd2b4('0x30'),'filter':{'field':_0xd2b4('0x31'),'value':['agent']}},{'name':_0xd2b4('0x32'),'field':_0xd2b4('0xc'),'foreignKey':_0xd2b4('0x2f'),'model':_0xd2b4('0x30'),'filter':{'field':_0xd2b4('0x31'),'value':['telephone']}},{'name':'VoiceQueues','field':_0xd2b4('0xc'),'foreignKey':_0xd2b4('0x33'),'model':_0xd2b4('0x34'),'filter':{'field':_0xd2b4('0x10'),'value':[_0xd2b4('0x35')]}},{'name':_0xd2b4('0x36'),'field':'name','foreignKey':'queue','model':_0xd2b4('0x34'),'filter':{'field':_0xd2b4('0x10'),'value':[_0xd2b4('0x37')]}}];break;case'musiconholds':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x38');break;case _0xd2b4('0x39'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x3a');break;case _0xd2b4('0x3b'):_0x39afdd['childModel']='VoicePrefix';break;case _0xd2b4('0x3c'):_0x39afdd['childModel']=_0xd2b4('0x3d');break;case _0xd2b4('0x3e'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x3f');break;case _0xd2b4('0x40'):_0x39afdd['childModel']='MailAccount';break;case'mailsubstatuses':_0x39afdd[_0xd2b4('0x16')]='MailSubstatus';break;case _0xd2b4('0x41'):_0x39afdd['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x42');break;case _0xd2b4('0x43'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x44');break;case'smsaccounts':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x45');break;case _0xd2b4('0x46'):_0x39afdd['childModel']=_0xd2b4('0x47');break;case'whatsappaccounts':_0x39afdd[_0xd2b4('0x16')]='WhatsappAccount';break;case _0xd2b4('0x48'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x49');break;case _0xd2b4('0x4a'):case _0xd2b4('0x4b'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x34');if(_0x28507b){_0x39afdd[_0xd2b4('0x1b')]=[{'name':'VoiceQueues'},{'name':_0xd2b4('0x36')}];}break;case _0xd2b4('0x4c'):case _0xd2b4('0x4d'):case _0xd2b4('0x4e'):_0x39afdd['childModel']=_0xd2b4('0x30');if(_0x28507b){_0x39afdd['parentSections']=[{'name':_0xd2b4('0x4f'),'filter':{'field':'role','value':[_0xd2b4('0x50'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xd2b4('0x32')}];}break;case _0xd2b4('0x51'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x52');break;case _0xd2b4('0x53'):_0x39afdd[_0xd2b4('0x16')]='SalesforceAccount';break;case _0xd2b4('0x54'):_0x39afdd[_0xd2b4('0x16')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x39afdd['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x55');break;case'zohoaccounts':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x56');break;case _0xd2b4('0x57'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x30');break;case _0xd2b4('0x58'):_0x39afdd['childModel']=_0xd2b4('0x59');break;case'dispositions':_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x5a');break;case _0xd2b4('0x5b'):_0x39afdd['childModel']='Dashboard';break;case _0xd2b4('0x5c'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x5d');break;case'pauses':_0x39afdd[_0xd2b4('0x16')]='Pause';break;case _0xd2b4('0x5e'):_0x39afdd['childModel']=_0xd2b4('0x5f');break;case _0xd2b4('0x60'):_0x39afdd['childModel']=_0xd2b4('0x61');break;case _0xd2b4('0x62'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x63');break;case _0xd2b4('0x64'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x65');break;case _0xd2b4('0x66'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x67');break;case _0xd2b4('0x68'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x69');break;case _0xd2b4('0x6a'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x6b');break;case _0xd2b4('0x6c'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x6d');break;case _0xd2b4('0x6e'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0xe');_0x39afdd[_0xd2b4('0x1b')]=[{'name':_0xd2b4('0x6f'),'field':'id','foreignKey':_0xd2b4('0x70')}];break;case _0xd2b4('0x71'):_0x39afdd[_0xd2b4('0x16')]=_0xd2b4('0x72');break;}return _0x39afdd;}function _0x2972e5(_0xdde1cc,_0x41f671){var _0x127edd=_0xdde1cc[_0xd2b4('0x73')](0x0)[_0xd2b4('0x74')]()+_0xdde1cc[_0xd2b4('0x75')](0x1);var _0xf33efc={'type':_0x484db9['Sequelize'][_0xd2b4('0x76')]['SELECT'],'raw':!![]};return new Promise(function(_0x4aade1,_0x343722){var _0x15eddd=squel[_0xd2b4('0x77')]()[_0xd2b4('0x6')](_0xd2b4('0x78')+_0x127edd+_0xd2b4('0x79'),'id')[_0xd2b4('0x6')](_0xd2b4('0x7a'))[_0xd2b4('0x7b')](_0xd2b4('0x7c')+_0xdde1cc+_0xd2b4('0x7d'),'ui')[_0xd2b4('0x7e')](_0xd2b4('0x7f'),_0x41f671['id']);return _0x484db9[_0xd2b4('0x80')][_0xd2b4('0x81')](_0x15eddd[_0xd2b4('0x82')](),_0xf33efc)['then'](function(_0x7a3e52){_0x41f671[_0x127edd+_0xd2b4('0x83')]=_0x7a3e52;_0x4aade1(_0x7a3e52);})[_0xd2b4('0xa')](function(_0x1b63ce){_0x343722(_0x1b63ce);});});}return _0x52e6de[_0xd2b4('0x84')]('UserProfile',attributes,{'tableName':_0xd2b4('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1e19b5){var _0x50dcbe={'raw':_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0x86')],'where':{}};var _0x3c165b={};var _0x35d37d={'count':0x0,'rows':[]};var _0x4bc8f8=_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0x87')];var _0x116c8c=_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0x88')]||![];var _0x577de5=_0x1cfe7d(_0x4bc8f8,_0x116c8c);if(!_0x577de5[_0xd2b4('0x16')])throw new Error(_0xd2b4('0x89')+_0x4bc8f8+'\x27');var _0x351dcb=[{'name':_0x4bc8f8}];if(!_[_0xd2b4('0x8a')](_0x577de5[_0xd2b4('0x1b')]))_0x351dcb=_0x577de5[_0xd2b4('0x1b')];var _0x254ecb=[];for(var _0x1ea665=0x0;_0x1ea665<_0x351dcb[_0xd2b4('0x8b')];_0x1ea665++){_0x254ecb[_0xd2b4('0x8c')](_0x484db9[_0xd2b4('0x8d')][_0xd2b4('0x8e')]({'where':{'userProfileId':_0x1e19b5['params']['id'],'name':_0x351dcb[_0x1ea665][_0xd2b4('0xc')]},'raw':!![]}));}return Promise[_0xd2b4('0x8f')](_0x254ecb)[_0xd2b4('0xd')](function(_0x578e7c){var _0x4ad701=_[_0xd2b4('0x5')](_0x578e7c,function(_0x367901){return _0x367901?_0x367901:undefined;});var _0x1f17f8=_[_0xd2b4('0x5')](_0x351dcb,['ignore',!![]]);var _0x2f7849=_[_0xd2b4('0x8a')](_0x4ad701)&&_[_0xd2b4('0x8a')](_0x1f17f8)?null:_[_0xd2b4('0x90')](_0x1f17f8,_0x4ad701);if(!_0x2f7849)return null;var _0x544197=[];for(var _0x4aacf6=0x0;_0x4aacf6<_0x2f7849[_0xd2b4('0x8b')];_0x4aacf6++){var _0x207c31=_['find'](_0x351dcb,function(_0x1dcd3b){return _0x2f7849[_0x4aacf6]?_0x1dcd3b['name']===_0x2f7849[_0x4aacf6][_0xd2b4('0xc')]:null;});if(_0x207c31){if(_0x2f7849[_0x4aacf6][_0xd2b4('0x91')]){_0x544197['push'](_0x2f3e40(_0x577de5[_0xd2b4('0x16')],_0x2f7849[_0x4aacf6]));}else{if(!_0x2f7849[_0x4aacf6][_0xd2b4('0x92')]){_0x544197[_0xd2b4('0x8c')](_0x152b2a(_0x207c31,_0x2f7849[_0x4aacf6],_0x577de5[_0xd2b4('0x16')]));}else{if(_0x207c31[_0xd2b4('0xb')]){_0x544197[_0xd2b4('0x8c')](_0x3c58e1(_0x207c31,_0x2f7849[_0x4aacf6]));}}}}}return Promise[_0xd2b4('0x8f')](_0x544197);})[_0xd2b4('0xd')](function(_0x23dd57){var _0x2e002b=_0x23dd57;var _0x440824=null;if(_0x2e002b){_0x440824=_0x2e002b[_0xd2b4('0x8b')]===0x1?_0x2e002b[0x0]:null;}if(!_0x440824&&!_0x2e002b)return _0x35d37d;var _0x5c4d96=_0x484db9[_0x577de5['childModel']]['rawAttributes'];_0x3c165b[_0xd2b4('0xb')]=_[_0xd2b4('0x93')](_0x5c4d96);_0x3c165b[_0xd2b4('0x81')]=_[_0xd2b4('0x93')](_0x1e19b5[_0xd2b4('0x81')]);_0x3c165b[_0xd2b4('0x94')]=_[_0xd2b4('0x95')](_0x3c165b[_0xd2b4('0xb')],_0x3c165b[_0xd2b4('0x81')]);_0x50dcbe[_0xd2b4('0x96')]=_['intersection'](_0x3c165b[_0xd2b4('0xb')],qs[_0xd2b4('0x97')](_0x1e19b5[_0xd2b4('0x81')]['fields']));_0x50dcbe[_0xd2b4('0x96')]=_0x50dcbe[_0xd2b4('0x96')][_0xd2b4('0x8b')]?_0x50dcbe[_0xd2b4('0x96')]:_0x3c165b[_0xd2b4('0xb')];if(!_0x1e19b5['query'][_0xd2b4('0x98')](_0xd2b4('0x99'))){_0x50dcbe[_0xd2b4('0x9a')]=qs['limit'](_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0x9a')]);_0x50dcbe[_0xd2b4('0x9b')]=qs[_0xd2b4('0x9b')](_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0x9b')]);}_0x50dcbe[_0xd2b4('0x9c')]=qs[_0xd2b4('0x9d')](_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0x9d')]);_0x50dcbe[_0xd2b4('0x7e')]=qs['filters'](_['pick'](_0x1e19b5['query'],_0x3c165b[_0xd2b4('0x94')]));if(_0x1e19b5[_0xd2b4('0x81')]['filter']){_0x50dcbe[_0xd2b4('0x7e')]=_[_0xd2b4('0x9e')](_0x50dcbe['where'],{'$or':_[_0xd2b4('0x9')](_0x5c4d96,function(_0x4a087c){if(_0x4a087c[_0xd2b4('0x10')][_0xd2b4('0x9f')]!==_0xd2b4('0xa0')){var _0x186f77={};_0x186f77[_0x4a087c['field']]={'$like':'%'+_0x1e19b5[_0xd2b4('0x81')]['filter']+'%'};return _0x186f77;}})});}var _0x390d38=[];var _0x22afbd=null;var _0x2c9580={};if(_0x440824){_0x22afbd=_[_0xd2b4('0x8e')](_0x351dcb,[_0xd2b4('0xc'),_0x440824[_0xd2b4('0xc')]]);if(_0x22afbd[_0xd2b4('0x6')]){_0x2c9580={};if(_0x577de5['childModel']===_0xd2b4('0xe')){_0x2c9580[_0x22afbd[_0xd2b4('0xa1')]]=_[_0xd2b4('0x9')](_0x440824[_0xd2b4('0x8')],'id');}else{_0x2c9580[_0x22afbd[_0xd2b4('0xa1')]]=_0x440824[_0xd2b4('0x8')];}_0x390d38[_0xd2b4('0x8c')](_0x2c9580);}else{_0x50dcbe[_0xd2b4('0x7e')]['id']=_0x440824[_0xd2b4('0x8')];}}else{for(var _0x5e40d6=0x0;_0x5e40d6<_0x2e002b[_0xd2b4('0x8b')];_0x5e40d6++){_0x22afbd=_[_0xd2b4('0x8e')](_0x351dcb,[_0xd2b4('0xc'),_0x2e002b[_0x5e40d6][_0xd2b4('0xc')]]);if(_0x22afbd[_0xd2b4('0x6')]){_0x2c9580={};_0x2c9580[_0x22afbd[_0xd2b4('0xa1')]]=_0x2e002b[_0x5e40d6][_0xd2b4('0x8')];_0x390d38[_0xd2b4('0x8c')](_0x2c9580);}else{if(!_0x50dcbe[_0xd2b4('0x7e')]['id'])_0x50dcbe[_0xd2b4('0x7e')]['id']=[];_0x2e002b[_0x5e40d6][_0xd2b4('0x8')][_0xd2b4('0xa2')](function(_0x541c8d){_0x50dcbe[_0xd2b4('0x7e')]['id'][_0xd2b4('0x8c')](_0x541c8d);});}}}if(!_[_0xd2b4('0x8a')](_0x390d38)){_0x50dcbe[_0xd2b4('0x7e')]=_[_0xd2b4('0x9e')](_0x50dcbe[_0xd2b4('0x7e')],{'$and':{'$or':_0x390d38}});}_0x50dcbe=_['merge']({},_0x50dcbe,_0x1e19b5['options']);if(_0x440824&&!_0x440824[_0xd2b4('0x92')]&&_0x577de5['childModel']===_0xd2b4('0xe')){if(_0x1e19b5[_0xd2b4('0x81')]['includeAll']){_0x50dcbe['include']=[{'all':!![]}];}return _0x484db9[_0x577de5[_0xd2b4('0x16')]]['findAll'](_0x50dcbe)['then'](function(_0x2069fb){var _0x14db89=[];_0x2069fb[_0xd2b4('0xa2')](function(_0x1adf95){var _0x9c37e4;switch(_0x1adf95[_0xd2b4('0xa3')]){case _0xd2b4('0xa4'):_0x9c37e4=_['find'](_0x440824['associatedResources'],function(_0xaf4c71){return _0xaf4c71['id']===_0x1adf95['reportId']&&_0xaf4c71[_0xd2b4('0x10')]===_0xd2b4('0xa5');});break;case _0xd2b4('0xa6'):_0x9c37e4=_[_0xd2b4('0x8e')](_0x440824[_0xd2b4('0x8')],function(_0x145f18){return _0x145f18['id']===_0x1adf95[_0xd2b4('0x70')]&&_0x145f18[_0xd2b4('0x10')]===_0xd2b4('0xa7');});break;}if(_0x9c37e4)_0x14db89[_0xd2b4('0x8c')](_0x1adf95);});_0x35d37d[_0xd2b4('0xa8')]=_0x14db89['length'];_0x35d37d[_0xd2b4('0xa9')]=_0x14db89;return _0x35d37d;});}else{if(!_[_0xd2b4('0x8a')](_0x1e19b5['query'][_0xd2b4('0xaa')])){_0x50dcbe['where']['id']=_0x50dcbe[_0xd2b4('0x7e')]['id']?_['intersection'](_0x50dcbe[_0xd2b4('0x7e')]['id'],_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0xaa')]):_0x1e19b5[_0xd2b4('0x81')]['ids'];if(_0x1e19b5[_0xd2b4('0x81')]['customSorting']){_0x50dcbe[_0xd2b4('0x9c')]=_0x1e19b5['query'][_0xd2b4('0xab')];}}if(_0x1e19b5['query'][_0xd2b4('0xac')]){_0x50dcbe['where']=_[_0xd2b4('0x9e')](_0x50dcbe[_0xd2b4('0x7e')],{'$and':_0x1e19b5['query'][_0xd2b4('0xac')]});}return _0x484db9[_0x577de5[_0xd2b4('0x16')]]['count']({'where':_0x50dcbe[_0xd2b4('0x7e')]})['then'](function(_0x2a65c3){_0x35d37d[_0xd2b4('0xa8')]=_0x2a65c3;if(_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0xad')]){if(_0x577de5[_0xd2b4('0x16')]===_0xd2b4('0x1a')){_0x50dcbe[_0xd2b4('0xae')]=[{'model':_0x484db9[_0xd2b4('0x63')],'as':_0xd2b4('0xaf'),'attributes':['id',_0xd2b4('0xc'),_0xd2b4('0xb0')],'required':_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0xb1')]?!![]:![]},{'model':_0x484db9[_0xd2b4('0x63')],'as':'ThroughTags','attributes':['id',_0xd2b4('0xc'),'color'],'through':_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0xb1')]?{'attributes':[],'where':{'TagId':_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0xb1')]||undefined}}:{},'required':_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0xb1')]?!![]:![]}];}else{_0x50dcbe['include']=[{'all':!![]}];}}return _0x484db9[_0x577de5[_0xd2b4('0x16')]]['findAll'](_0x50dcbe);})[_0xd2b4('0xd')](function(_0x4df0c3){_0x35d37d[_0xd2b4('0xa9')]=_0x4df0c3;if(_0x4bc8f8===_0xd2b4('0xb2')&&_0x1e19b5[_0xd2b4('0x81')][_0xd2b4('0xb3')]===_0xd2b4('0xb4')){var _0x214d8e=[];for(var _0x4d0af7=0x0;_0x4d0af7<_0x35d37d[_0xd2b4('0xa9')][_0xd2b4('0x8b')];_0x4d0af7++){_0x214d8e[_0xd2b4('0x8c')](_0x2972e5(_0xd2b4('0xb5'),_0x35d37d[_0xd2b4('0xa9')][_0x4d0af7][_0xd2b4('0xb6')]));_0x214d8e[_0xd2b4('0x8c')](_0x2972e5(_0xd2b4('0xb7'),_0x35d37d[_0xd2b4('0xa9')][_0x4d0af7][_0xd2b4('0xb6')]));_0x214d8e[_0xd2b4('0x8c')](_0x2972e5('fax',_0x35d37d[_0xd2b4('0xa9')][_0x4d0af7][_0xd2b4('0xb6')]));_0x214d8e[_0xd2b4('0x8c')](_0x2972e5(_0xd2b4('0xb8'),_0x35d37d[_0xd2b4('0xa9')][_0x4d0af7][_0xd2b4('0xb6')]));_0x214d8e[_0xd2b4('0x8c')](_0x2972e5('openchannel',_0x35d37d[_0xd2b4('0xa9')][_0x4d0af7][_0xd2b4('0xb6')]));_0x214d8e[_0xd2b4('0x8c')](_0x2972e5(_0xd2b4('0xb9'),_0x35d37d[_0xd2b4('0xa9')][_0x4d0af7]['dataValues']));}return Promise[_0xd2b4('0x8f')](_0x214d8e)[_0xd2b4('0xd')](function(){return _0x35d37d;});}return _0x35d37d;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9c1591e..e341d48 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 _0x5232=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5232,0x1c9));var _0x2523=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x5232[_0x72a33d];return _0x2621d5;};'use strict';var _=require(_0x2523('0x0'));var util=require(_0x2523('0x1'));var moment=require(_0x2523('0x2'));var BPromise=require(_0x2523('0x3'));var rs=require(_0x2523('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2523('0x5'));var logger=require(_0x2523('0x6'))('rpc');var config=require(_0x2523('0x7'));var jayson=require(_0x2523('0x8'));var client=jayson[_0x2523('0x9')][_0x2523('0xa')]({'port':0x232a});config[_0x2523('0xb')]=_[_0x2523('0xc')](config[_0x2523('0xb')],{'host':_0x2523('0xd'),'port':0x18eb});var socket=require(_0x2523('0xe'))(new Redis(config[_0x2523('0xb')]));require(_0x2523('0xf'))[_0x2523('0x10')](socket);function respondWithRpcPromise(_0x55e5bb,_0x1e6087,_0x27d4fe){return new BPromise(function(_0xb076a8,_0x2f6bf5){return client[_0x2523('0x11')](_0x55e5bb,_0x27d4fe)[_0x2523('0x12')](function(_0x5856d2){logger[_0x2523('0x13')](_0x2523('0x14'),_0x1e6087,_0x2523('0x15'));logger[_0x2523('0x16')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1e6087,_0x2523('0x15'),JSON[_0x2523('0x17')](_0x5856d2));if(_0x5856d2['error']){if(_0x5856d2[_0x2523('0x18')][_0x2523('0x19')]===0x1f4){logger[_0x2523('0x18')](_0x2523('0x14'),_0x1e6087,_0x5856d2['error'][_0x2523('0x1a')]);return _0x2f6bf5(_0x5856d2['error'][_0x2523('0x1a')]);}logger[_0x2523('0x18')](_0x2523('0x14'),_0x1e6087,_0x5856d2[_0x2523('0x18')]['message']);return _0xb076a8(_0x5856d2[_0x2523('0x18')][_0x2523('0x1a')]);}else{logger[_0x2523('0x13')](_0x2523('0x14'),_0x1e6087,_0x2523('0x15'));_0xb076a8(_0x5856d2[_0x2523('0x1b')]['message']);}})[_0x2523('0x1c')](function(_0x20879d){logger['error'](_0x2523('0x14'),_0x1e6087,_0x20879d);_0x2f6bf5(_0x20879d);});});} \ No newline at end of file +var _0xfdbd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x43397b,_0xd92c45){var _0x271cea=function(_0x2e1fa5){while(--_0x2e1fa5){_0x43397b['push'](_0x43397b['shift']());}};_0x271cea(++_0xd92c45);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2c8b7a,_0x483fe0){_0x2c8b7a=_0x2c8b7a-0x0;var _0x1c1cf9=_0xfdbd[_0x2c8b7a];return _0x1c1cf9;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdfdb('0xc'),'port':0x18eb});var socket=require(_0xdfdb('0xd'))(new Redis(config['redis']));require(_0xdfdb('0xe'))[_0xdfdb('0xf')](socket);function respondWithRpcPromise(_0x24eb73,_0x27ddcd,_0x3a44a9){return new BPromise(function(_0x1ace28,_0x2bb8d4){return client['request'](_0x24eb73,_0x3a44a9)[_0xdfdb('0x10')](function(_0x1972db){logger['info'](_0xdfdb('0x11'),_0x27ddcd,_0xdfdb('0x12'));logger[_0xdfdb('0x13')](_0xdfdb('0x14'),_0x27ddcd,_0xdfdb('0x12'),JSON[_0xdfdb('0x15')](_0x1972db));if(_0x1972db[_0xdfdb('0x16')]){if(_0x1972db[_0xdfdb('0x16')]['code']===0x1f4){logger['error'](_0xdfdb('0x11'),_0x27ddcd,_0x1972db['error'][_0xdfdb('0x17')]);return _0x2bb8d4(_0x1972db[_0xdfdb('0x16')][_0xdfdb('0x17')]);}logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0x1972db[_0xdfdb('0x16')]['message']);return _0x1ace28(_0x1972db['error'][_0xdfdb('0x17')]);}else{logger[_0xdfdb('0x18')](_0xdfdb('0x11'),_0x27ddcd,'request\x20sent');_0x1ace28(_0x1972db[_0xdfdb('0x19')][_0xdfdb('0x17')]);}})[_0xdfdb('0x1a')](function(_0xd60a30){logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0xd60a30);_0x2bb8d4(_0xd60a30);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2d64a49..7e2f8e5 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 _0x86ed=['update','emit','register','length','userProfile:','./userProfile.events','save'];(function(_0x361026,_0x2375e2){var _0x37028e=function(_0x4f89e0){while(--_0x4f89e0){_0x361026['push'](_0x361026['shift']());}};_0x37028e(++_0x2375e2);}(_0x86ed,0xde));var _0xd86e=function(_0x15fc20,_0x4560bf){_0x15fc20=_0x15fc20-0x0;var _0x5d20a8=_0x86ed[_0x15fc20];return _0x5d20a8;};'use strict';var UserProfileEvents=require(_0xd86e('0x0'));var events=[_0xd86e('0x1'),'remove',_0xd86e('0x2')];function createListener(_0x8ad744,_0x2ffa27){return function(_0xb0c6b6){_0x2ffa27[_0xd86e('0x3')](_0x8ad744,_0xb0c6b6);};}function removeListener(_0x4b5d85,_0xb5ca28){return function(){UserProfileEvents['removeListener'](_0x4b5d85,_0xb5ca28);};}exports[_0xd86e('0x4')]=function(_0x16a7ec){for(var _0x5a6549=0x0,_0x3350eb=events[_0xd86e('0x5')];_0x5a6549<_0x3350eb;_0x5a6549++){var _0x1ab3e4=events[_0x5a6549];var _0x48b25b=createListener(_0xd86e('0x6')+_0x1ab3e4,_0x16a7ec);UserProfileEvents['on'](_0x1ab3e4,_0x48b25b);}}; \ No newline at end of file +var _0x247e=['update','emit','removeListener','userProfile:','./userProfile.events'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x247e,0x1ee));var _0xe247=function(_0x19e977,_0x43c88d){_0x19e977=_0x19e977-0x0;var _0x5da987=_0x247e[_0x19e977];return _0x5da987;};'use strict';var UserProfileEvents=require(_0xe247('0x0'));var events=['save','remove',_0xe247('0x1')];function createListener(_0x5b5a52,_0x384eef){return function(_0x2e081f){_0x384eef[_0xe247('0x2')](_0x5b5a52,_0x2e081f);};}function removeListener(_0x42f4c6,_0x54db73){return function(){UserProfileEvents[_0xe247('0x3')](_0x42f4c6,_0x54db73);};}exports['register']=function(_0x403a48){for(var _0x459922=0x0,_0x1b159f=events['length'];_0x459922<_0x1b159f;_0x459922++){var _0x5886ae=events[_0x459922];var _0x1a718d=createListener(_0xe247('0x4')+_0x5886ae,_0x403a48);UserProfileEvents['on'](_0x5886ae,_0x1a718d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fb7bbe0..4cbf379 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 _0x4f66=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','express'];(function(_0x4dfa58,_0x3497d8){var _0x3b9369=function(_0x49155c){while(--_0x49155c){_0x4dfa58['push'](_0x4dfa58['shift']());}};_0x3b9369(++_0x3497d8);}(_0x4f66,0x1c9));var _0x64f6=function(_0x2a1f5c,_0x49b13f){_0x2a1f5c=_0x2a1f5c-0x0;var _0x43ce3d=_0x4f66[_0x2a1f5c];return _0x43ce3d;};'use strict';var multer=require('multer');var util=require(_0x64f6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x64f6('0x1'));var router=express['Router']();var fs_extra=require(_0x64f6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x64f6('0x3'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x64f6('0x4')]('/',auth[_0x64f6('0x5')](),controller[_0x64f6('0x6')]);router[_0x64f6('0x4')](_0x64f6('0x7'),auth[_0x64f6('0x5')](),controller[_0x64f6('0x8')]);router[_0x64f6('0x4')](_0x64f6('0x9'),auth[_0x64f6('0x5')](),controller[_0x64f6('0xa')]);router['post']('/',auth[_0x64f6('0x5')](),controller[_0x64f6('0xb')]);router[_0x64f6('0xc')]('/:id',auth[_0x64f6('0x5')](),controller[_0x64f6('0xd')]);router[_0x64f6('0xe')]('/:id',auth[_0x64f6('0x5')](),controller[_0x64f6('0xf')]);module[_0x64f6('0x10')]=router; \ No newline at end of file +var _0x8b29=['update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','describe','/:id','post','put'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8b29,0xdb));var _0x98b2=function(_0x2f9599,_0x5b10cd){_0x2f9599=_0x2f9599-0x0;var _0x1b0bc9=_0x8b29[_0x2f9599];return _0x1b0bc9;};'use strict';var multer=require(_0x98b2('0x0'));var util=require(_0x98b2('0x1'));var path=require(_0x98b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x98b2('0x3'));var router=express['Router']();var fs_extra=require(_0x98b2('0x4'));var auth=require(_0x98b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98b2('0x6'));var controller=require(_0x98b2('0x7'));router['get']('/',auth[_0x98b2('0x8')](),controller[_0x98b2('0x9')]);router[_0x98b2('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x98b2('0xb')]);router[_0x98b2('0xa')](_0x98b2('0xc'),auth[_0x98b2('0x8')](),controller['show']);router[_0x98b2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x98b2('0xe')](_0x98b2('0xc'),auth['isAuthenticated'](),controller[_0x98b2('0xf')]);router[_0x98b2('0x10')]('/:id',auth[_0x98b2('0x8')](),controller['destroy']);module[_0x98b2('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 684d33a..a93dbfd 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 _0x0ccd=['STRING','INTEGER','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0ccd,0x18e));var _0xd0cc=function(_0x30fdf9,_0x89096d){_0x30fdf9=_0x30fdf9-0x0;var _0x3c43bb=_0x0ccd[_0x30fdf9];return _0x3c43bb;};'use strict';var Sequelize=require(_0xd0cc('0x0'));module[_0xd0cc('0x1')]={'name':{'type':Sequelize[_0xd0cc('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd0cc('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x12ec=['STRING','sequelize','exports'];(function(_0x120eab,_0xd01b38){var _0x5fd50e=function(_0x29fbc3){while(--_0x29fbc3){_0x120eab['push'](_0x120eab['shift']());}};_0x5fd50e(++_0xd01b38);}(_0x12ec,0xac));var _0xc12e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x12ec[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0xc12e('0x0'));module[_0xc12e('0x1')]={'name':{'type':Sequelize[_0xc12e('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xc12e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7924260..c39dc1e 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 _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x5aa252,_0x1317f7){var _0xa4adbf=function(_0x21e5a1){while(--_0x21e5a1){_0x5aa252['push'](_0x5aa252['shift']());}};_0xa4adbf(++_0x1317f7);}(_0x9582,0x95));var _0x2958=function(_0x383427,_0x57e7f0){_0x383427=_0x383427-0x0;var _0x1c9e4f=_0x9582[_0x383427];return _0x1c9e4f;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file +var _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x8ec916,_0x39b8b1){var _0x18097a=function(_0x443c0a){while(--_0x443c0a){_0x8ec916['push'](_0x8ec916['shift']());}};_0x18097a(++_0x39b8b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1da5b1,_0x2ced68){_0x1da5b1=_0x1da5b1-0x0;var _0x246e1e=_0x5f2f[_0x1da5b1];return _0x246e1e;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b908a69..f292165 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 _0xb859=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xb859,0xe0));var _0x9b85=function(_0x4f3cd1,_0x4b666e){_0x4f3cd1=_0x4f3cd1-0x0;var _0x4f304d=_0xb859[_0x4f3cd1];return _0x4f304d;};'use strict';var _=require(_0x9b85('0x0'));var util=require(_0x9b85('0x1'));var logger=require(_0x9b85('0x2'))(_0x9b85('0x3'));var moment=require(_0x9b85('0x4'));var BPromise=require(_0x9b85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b85('0x6'));var rimraf=require(_0x9b85('0x7'));var config=require(_0x9b85('0x8'));var attributes=require(_0x9b85('0x9'));module[_0x9b85('0xa')]=function(_0x5120be,_0x17f8c5){return _0x5120be[_0x9b85('0xb')](_0x9b85('0xc'),attributes,{'tableName':_0x9b85('0xd'),'paranoid':![],'indexes':[{'name':_0x9b85('0xe'),'fields':[_0x9b85('0xf'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x222a=['api','bluebird','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','util','../../config/logger'];(function(_0x341397,_0xa23365){var _0x5a8b65=function(_0x999a3){while(--_0x999a3){_0x341397['push'](_0x341397['shift']());}};_0x5a8b65(++_0xa23365);}(_0x222a,0x14e));var _0xa222=function(_0x186595,_0x9e6124){_0x186595=_0x186595-0x0;var _0x1e4a42=_0x222a[_0x186595];return _0x1e4a42;};'use strict';var _=require('lodash');var util=require(_0xa222('0x0'));var logger=require(_0xa222('0x1'))(_0xa222('0x2'));var moment=require('moment');var BPromise=require(_0xa222('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa222('0x4'));var config=require('../../config/environment');var attributes=require(_0xa222('0x5'));module[_0xa222('0x6')]=function(_0x392608,_0x5a1536){return _0x392608[_0xa222('0x7')](_0xa222('0x8'),attributes,{'tableName':_0xa222('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xa222('0xa'),_0xa222('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4bf15bd..e832695 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 _0x0b66=['http','request','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0xb06782,_0x198698){var _0x1a2f53=function(_0x147bfd){while(--_0x147bfd){_0xb06782['push'](_0xb06782['shift']());}};_0x1a2f53(++_0x198698);}(_0x0b66,0x1b9));var _0x60b6=function(_0x2f667a,_0xed51f2){_0x2f667a=_0x2f667a-0x0;var _0x1a5316=_0x0b66[_0x2f667a];return _0x1a5316;};'use strict';var _=require('lodash');var util=require(_0x60b6('0x0'));var moment=require(_0x60b6('0x1'));var BPromise=require('bluebird');var rs=require(_0x60b6('0x2'));var fs=require('fs');var Redis=require(_0x60b6('0x3'));var db=require(_0x60b6('0x4'))['db'];var utils=require(_0x60b6('0x5'));var logger=require(_0x60b6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x60b6('0x7'));var client=jayson[_0x60b6('0x8')][_0x60b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15fc3d,_0x4bdeca,_0x1f0265){return new BPromise(function(_0xac7161,_0x9e15ac){return client[_0x60b6('0xa')](_0x15fc3d,_0x1f0265)['then'](function(_0x100d80){logger[_0x60b6('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x4bdeca,_0x60b6('0xc'));logger[_0x60b6('0xd')](_0x60b6('0xe'),_0x4bdeca,_0x60b6('0xc'),JSON['stringify'](_0x100d80));if(_0x100d80['error']){if(_0x100d80['error']['code']===0x1f4){logger[_0x60b6('0xf')](_0x60b6('0x10'),_0x4bdeca,_0x100d80['error'][_0x60b6('0x11')]);return _0x9e15ac(_0x100d80['error'][_0x60b6('0x11')]);}logger['error'](_0x60b6('0x10'),_0x4bdeca,_0x100d80[_0x60b6('0xf')]['message']);return _0xac7161(_0x100d80['error']['message']);}else{logger[_0x60b6('0xb')](_0x60b6('0x10'),_0x4bdeca,'request\x20sent');_0xac7161(_0x100d80['result']['message']);}})['catch'](function(_0x1dd9de){logger[_0x60b6('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x4bdeca,_0x1dd9de);_0x9e15ac(_0x1dd9de);});});} \ No newline at end of file +var _0x417c=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x23d1f2,_0x1221b2){var _0x53bbaa=function(_0x1865fa){while(--_0x1865fa){_0x23d1f2['push'](_0x23d1f2['shift']());}};_0x53bbaa(++_0x1221b2);}(_0x417c,0xb8));var _0xc417=function(_0x486800,_0x5e0027){_0x486800=_0x486800-0x0;var _0x7f8253=_0x417c[_0x486800];return _0x7f8253;};'use strict';var _=require(_0xc417('0x0'));var util=require(_0xc417('0x1'));var moment=require(_0xc417('0x2'));var BPromise=require(_0xc417('0x3'));var rs=require(_0xc417('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc417('0x5'))['db'];var utils=require(_0xc417('0x6'));var logger=require('../../config/logger')(_0xc417('0x7'));var config=require('../../config/environment');var jayson=require(_0xc417('0x8'));var client=jayson[_0xc417('0x9')][_0xc417('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29b006,_0x208da7,_0x5e543e){return new BPromise(function(_0x112e09,_0x45788f){return client[_0xc417('0xb')](_0x29b006,_0x5e543e)[_0xc417('0xc')](function(_0x4a3efc){logger['info'](_0xc417('0xd'),_0x208da7,_0xc417('0xe'));logger[_0xc417('0xf')](_0xc417('0x10'),_0x208da7,'request\x20sent',JSON['stringify'](_0x4a3efc));if(_0x4a3efc[_0xc417('0x11')]){if(_0x4a3efc[_0xc417('0x11')][_0xc417('0x12')]===0x1f4){logger[_0xc417('0x11')](_0xc417('0xd'),_0x208da7,_0x4a3efc['error'][_0xc417('0x13')]);return _0x45788f(_0x4a3efc[_0xc417('0x11')]['message']);}logger[_0xc417('0x11')](_0xc417('0xd'),_0x208da7,_0x4a3efc[_0xc417('0x11')][_0xc417('0x13')]);return _0x112e09(_0x4a3efc[_0xc417('0x11')][_0xc417('0x13')]);}else{logger[_0xc417('0x14')](_0xc417('0xd'),_0x208da7,_0xc417('0xe'));_0x112e09(_0x4a3efc[_0xc417('0x15')][_0xc417('0x13')]);}})[_0xc417('0x16')](function(_0x3e2ec1){logger['error'](_0xc417('0xd'),_0x208da7,_0x3e2ec1);_0x45788f(_0x3e2ec1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e617192..3331ee3 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 _0x96ba=['update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','create','put','/:id'];(function(_0x110c82,_0x1f990f){var _0xcfed8a=function(_0x2c6942){while(--_0x2c6942){_0x110c82['push'](_0x110c82['shift']());}};_0xcfed8a(++_0x1f990f);}(_0x96ba,0x18f));var _0xa96b=function(_0x59c2cb,_0x671ebb){_0x59c2cb=_0x59c2cb-0x0;var _0x4d2910=_0x96ba[_0x59c2cb];return _0x4d2910;};'use strict';var multer=require(_0xa96b('0x0'));var util=require(_0xa96b('0x1'));var path=require(_0xa96b('0x2'));var timeout=require('connect-timeout');var express=require(_0xa96b('0x3'));var router=express[_0xa96b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa96b('0x5'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xa96b('0x6')]('/',auth[_0xa96b('0x7')](),controller[_0xa96b('0x8')]);router[_0xa96b('0x6')](_0xa96b('0x9'),auth[_0xa96b('0x7')](),controller[_0xa96b('0xa')]);router[_0xa96b('0x6')]('/:id',auth[_0xa96b('0x7')](),controller[_0xa96b('0xb')]);router['post']('/',auth[_0xa96b('0x7')](),controller[_0xa96b('0xc')]);router[_0xa96b('0xd')](_0xa96b('0xe'),auth[_0xa96b('0x7')](),controller[_0xa96b('0xf')]);router[_0xa96b('0x10')](_0xa96b('0xe'),auth[_0xa96b('0x7')](),controller['destroy']);module[_0xa96b('0x11')]=router; \ No newline at end of file +var _0x4b60=['get','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x4b60,0x197));var _0x04b6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4b60[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x04b6('0x0'));var path=require(_0x04b6('0x1'));var timeout=require(_0x04b6('0x2'));var express=require(_0x04b6('0x3'));var router=express['Router']();var fs_extra=require(_0x04b6('0x4'));var auth=require(_0x04b6('0x5'));var interaction=require(_0x04b6('0x6'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x04b6('0x7')]('/',auth[_0x04b6('0x8')](),controller[_0x04b6('0x9')]);router[_0x04b6('0x7')](_0x04b6('0xa'),auth[_0x04b6('0x8')](),controller['describe']);router[_0x04b6('0x7')](_0x04b6('0xb'),auth[_0x04b6('0x8')](),controller['show']);router[_0x04b6('0xc')]('/',auth[_0x04b6('0x8')](),controller[_0x04b6('0xd')]);router[_0x04b6('0xe')](_0x04b6('0xb'),auth['isAuthenticated'](),controller[_0x04b6('0xf')]);router['delete'](_0x04b6('0xb'),auth['isAuthenticated'](),controller[_0x04b6('0x10')]);module[_0x04b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ab005fe..cef21d8 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(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x4fc2,0x111));var _0x24fc=function(_0x37914d,_0x4209c0){_0x37914d=_0x37914d-0x0;var _0x2b4118=_0x4fc2[_0x37914d];return _0x2b4118;};'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 _0x96cc=['crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0x96cc,0x16c));var _0xc96c=function(_0x53874d,_0x522af1){_0x53874d=_0x53874d-0x0;var _0x391c4e=_0x96cc[_0x53874d];return _0x391c4e;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc96c('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc96c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc96c('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xc96c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc96c('0x1')],'set':function(_0x71140d){this[_0xc96c('0x4')](_0xc96c('0x5'),_0x71140d?_0x71140d[_0xc96c('0x6')](''):[]);},'get':function(){return this[_0xc96c('0x7')]('crudPermissions')?this[_0xc96c('0x7')](_0xc96c('0x5'))[_0xc96c('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f301069..718b0fd 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 _0x3c93=['findAll','show','params','length','options','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll'];(function(_0x43db43,_0x6f7330){var _0x56d90c=function(_0x5f0713){while(--_0x5f0713){_0x43db43['push'](_0x43db43['shift']());}};_0x56d90c(++_0x6f7330);}(_0x3c93,0x1df));var _0x33c9=function(_0x79e778,_0x5bce4e){_0x79e778=_0x79e778-0x0;var _0x40cb5f=_0x3c93[_0x79e778];return _0x40cb5f;};'use strict';var emlformat=require(_0x33c9('0x0'));var rimraf=require(_0x33c9('0x1'));var zipdir=require(_0x33c9('0x2'));var jsonpatch=require(_0x33c9('0x3'));var rp=require(_0x33c9('0x4'));var moment=require(_0x33c9('0x5'));var BPromise=require(_0x33c9('0x6'));var Mustache=require(_0x33c9('0x7'));var util=require('util');var path=require(_0x33c9('0x8'));var sox=require(_0x33c9('0x9'));var csv=require(_0x33c9('0xa'));var ejs=require(_0x33c9('0xb'));var fs=require('fs');var fs_extra=require(_0x33c9('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x33c9('0xd'));var deskjs=require(_0x33c9('0xe'));var toCsv=require(_0x33c9('0xa'));var querystring=require(_0x33c9('0xf'));var Papa=require(_0x33c9('0x10'));var Redis=require(_0x33c9('0x11'));var authService=require(_0x33c9('0x12'));var qs=require(_0x33c9('0x13'));var as=require(_0x33c9('0x14'));var hardwareService=require(_0x33c9('0x15'));var logger=require(_0x33c9('0x16'))(_0x33c9('0x17'));var utils=require('../../config/utils');var config=require(_0x33c9('0x18'));var licenseUtil=require(_0x33c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x573e2d,_0x53336c){_0x53336c=_0x53336c||0xcc;return function(_0x5b801c){if(_0x5b801c){return _0x573e2d[_0x33c9('0x1a')](_0x53336c);}return _0x573e2d['status'](_0x53336c)[_0x33c9('0x1b')]();};}function respondWithResult(_0x4d2bbe,_0x571794){_0x571794=_0x571794||0xc8;return function(_0x9b7b3c){if(_0x9b7b3c){return _0x4d2bbe['status'](_0x571794)[_0x33c9('0x1c')](_0x9b7b3c);}};}function respondWithFilteredResult(_0x4ae33c,_0xcd0d2e){return function(_0x3640cd){if(_0x3640cd){var _0x40e011=typeof _0xcd0d2e[_0x33c9('0x1d')]===_0x33c9('0x1e')&&typeof _0xcd0d2e[_0x33c9('0x1f')]===_0x33c9('0x1e');var _0x11413e=_0x3640cd[_0x33c9('0x20')];var _0x2c30c1=_0x40e011?0x0:_0xcd0d2e[_0x33c9('0x1d')];var _0x2e0231=_0x40e011?_0x3640cd['count']:_0xcd0d2e['offset']+_0xcd0d2e[_0x33c9('0x1f')];var _0x5ea5d1;if(_0x2e0231>=_0x11413e){_0x2e0231=_0x11413e;_0x5ea5d1=0xc8;}else{_0x5ea5d1=0xce;}_0x4ae33c[_0x33c9('0x21')](_0x5ea5d1);return _0x4ae33c['set'](_0x33c9('0x22'),_0x2c30c1+'-'+_0x2e0231+'/'+_0x11413e)[_0x33c9('0x1c')](_0x3640cd);}return null;};}function patchUpdates(_0x1c796b){return function(_0xaa0b1){try{jsonpatch[_0x33c9('0x23')](_0xaa0b1,_0x1c796b,!![]);}catch(_0x384726){return BPromise[_0x33c9('0x24')](_0x384726);}return _0xaa0b1[_0x33c9('0x25')]();};}function saveUpdates(_0x2dbe92,_0x23d3db){return function(_0xa9b8c6){if(_0xa9b8c6){return _0xa9b8c6['update'](_0x2dbe92)['then'](function(_0x4bbb76){return _0x4bbb76;});}return null;};}function removeEntity(_0x297b3c,_0x40cb57){return function(_0x3305ec){if(_0x3305ec){return _0x3305ec[_0x33c9('0x26')]()[_0x33c9('0x27')](function(){_0x297b3c['status'](0xcc)[_0x33c9('0x1b')]();});}};}function handleEntityNotFound(_0x19334f,_0x536f6e){return function(_0x2ee7c4){if(!_0x2ee7c4){_0x19334f[_0x33c9('0x1a')](0x194);}return _0x2ee7c4;};}function handleError(_0x2ca98a,_0x1b37bf){_0x1b37bf=_0x1b37bf||0x1f4;return function(_0xa64c0a){logger['error'](_0xa64c0a[_0x33c9('0x28')]);if(_0xa64c0a[_0x33c9('0x29')]){delete _0xa64c0a[_0x33c9('0x29')];}_0x2ca98a[_0x33c9('0x21')](_0x1b37bf)[_0x33c9('0x2a')](_0xa64c0a);};}exports[_0x33c9('0x2b')]=function(_0x1b1cf2,_0x1cb420){var _0x317c1f={},_0x303d56={},_0x39ed81={'count':0x0,'rows':[]};var _0x39f0c5=_[_0x33c9('0x2c')](db[_0x33c9('0x2d')][_0x33c9('0x2e')],function(_0x4e290d){return{'name':_0x4e290d[_0x33c9('0x2f')],'type':_0x4e290d['type'][_0x33c9('0x30')]};});_0x303d56[_0x33c9('0x31')]=_[_0x33c9('0x2c')](_0x39f0c5,_0x33c9('0x29'));_0x303d56[_0x33c9('0x32')]=_[_0x33c9('0x33')](_0x1b1cf2[_0x33c9('0x32')]);_0x303d56['filters']=_['intersection'](_0x303d56[_0x33c9('0x31')],_0x303d56[_0x33c9('0x32')]);_0x317c1f[_0x33c9('0x34')]=_[_0x33c9('0x35')](_0x303d56[_0x33c9('0x31')],qs[_0x33c9('0x36')](_0x1b1cf2[_0x33c9('0x32')][_0x33c9('0x36')]));_0x317c1f[_0x33c9('0x34')]=_0x317c1f['attributes']['length']?_0x317c1f['attributes']:_0x303d56[_0x33c9('0x31')];if(!_0x1b1cf2[_0x33c9('0x32')][_0x33c9('0x37')](_0x33c9('0x38'))){_0x317c1f[_0x33c9('0x1f')]=qs[_0x33c9('0x1f')](_0x1b1cf2['query'][_0x33c9('0x1f')]);_0x317c1f[_0x33c9('0x1d')]=qs[_0x33c9('0x1d')](_0x1b1cf2[_0x33c9('0x32')][_0x33c9('0x1d')]);}_0x317c1f[_0x33c9('0x39')]=qs['sort'](_0x1b1cf2[_0x33c9('0x32')][_0x33c9('0x3a')]);_0x317c1f[_0x33c9('0x3b')]=qs[_0x33c9('0x3c')](_[_0x33c9('0x3d')](_0x1b1cf2[_0x33c9('0x32')],_0x303d56[_0x33c9('0x3c')]),_0x39f0c5);if(_0x1b1cf2[_0x33c9('0x32')]['filter']){_0x317c1f['where']=_['merge'](_0x317c1f[_0x33c9('0x3b')],{'$or':_['map'](_0x39f0c5,function(_0x1274e4){if(_0x1274e4[_0x33c9('0x3e')]!==_0x33c9('0x3f')){var _0xe026f6={};_0xe026f6[_0x1274e4[_0x33c9('0x29')]]={'$like':'%'+_0x1b1cf2[_0x33c9('0x32')][_0x33c9('0x40')]+'%'};return _0xe026f6;}})});}_0x317c1f=_[_0x33c9('0x41')]({},_0x317c1f,_0x1b1cf2['options']);var _0x1404cd={'where':_0x317c1f['where']};return db['UserProfileSection']['count'](_0x1404cd)[_0x33c9('0x27')](function(_0x241808){_0x39ed81[_0x33c9('0x20')]=_0x241808;if(_0x1b1cf2[_0x33c9('0x32')][_0x33c9('0x42')]){_0x317c1f['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x33c9('0x43')](_0x317c1f);})[_0x33c9('0x27')](function(_0x3192ab){_0x39ed81['rows']=_0x3192ab;return _0x39ed81;})[_0x33c9('0x27')](respondWithFilteredResult(_0x1cb420,_0x317c1f))['catch'](handleError(_0x1cb420,null));};exports[_0x33c9('0x44')]=function(_0x447a5f,_0x1a3ab7){var _0x2b922d={'raw':![],'where':{'id':_0x447a5f[_0x33c9('0x45')]['id']}},_0x4a8424={};_0x4a8424['model']=_[_0x33c9('0x33')](db['UserProfileSection'][_0x33c9('0x2e')]);_0x4a8424['query']=_[_0x33c9('0x33')](_0x447a5f[_0x33c9('0x32')]);_0x4a8424[_0x33c9('0x3c')]=_[_0x33c9('0x35')](_0x4a8424[_0x33c9('0x31')],_0x4a8424['query']);_0x2b922d[_0x33c9('0x34')]=_[_0x33c9('0x35')](_0x4a8424[_0x33c9('0x31')],qs[_0x33c9('0x36')](_0x447a5f[_0x33c9('0x32')]['fields']));_0x2b922d[_0x33c9('0x34')]=_0x2b922d['attributes'][_0x33c9('0x46')]?_0x2b922d[_0x33c9('0x34')]:_0x4a8424[_0x33c9('0x31')];if(_0x447a5f[_0x33c9('0x32')][_0x33c9('0x42')]){_0x2b922d['include']=[{'all':!![]}];}_0x2b922d=_[_0x33c9('0x41')]({},_0x2b922d,_0x447a5f[_0x33c9('0x47')]);return db['UserProfileSection'][_0x33c9('0x48')](_0x2b922d)[_0x33c9('0x27')](handleEntityNotFound(_0x1a3ab7,null))['then'](respondWithResult(_0x1a3ab7,null))[_0x33c9('0x49')](handleError(_0x1a3ab7,null));};exports[_0x33c9('0x4a')]=function(_0x203803,_0x25b7a4){return db[_0x33c9('0x2d')][_0x33c9('0x4a')](_0x203803[_0x33c9('0x4b')],{})[_0x33c9('0x27')](respondWithResult(_0x25b7a4,0xc9))[_0x33c9('0x49')](handleError(_0x25b7a4,null));};exports[_0x33c9('0x4c')]=function(_0x2d7d48,_0x1bb52e){if(_0x2d7d48['body']['id']){delete _0x2d7d48[_0x33c9('0x4b')]['id'];}return db['UserProfileSection'][_0x33c9('0x48')]({'where':{'id':_0x2d7d48[_0x33c9('0x45')]['id']}})[_0x33c9('0x27')](handleEntityNotFound(_0x1bb52e,null))[_0x33c9('0x27')](saveUpdates(_0x2d7d48[_0x33c9('0x4b')],null))[_0x33c9('0x27')](respondWithResult(_0x1bb52e,null))['catch'](handleError(_0x1bb52e,null));};exports[_0x33c9('0x26')]=function(_0x1e6c5b,_0x317a0a){return db[_0x33c9('0x2d')][_0x33c9('0x48')]({'where':{'id':_0x1e6c5b[_0x33c9('0x45')]['id']}})[_0x33c9('0x27')](handleEntityNotFound(_0x317a0a,null))[_0x33c9('0x27')](removeEntity(_0x317a0a,null))[_0x33c9('0x49')](handleError(_0x317a0a,null));};exports[_0x33c9('0x4d')]=function(_0x453f81,_0x4fe9f4){return db[_0x33c9('0x2d')][_0x33c9('0x4d')]()[_0x33c9('0x27')](respondWithResult(_0x4fe9f4,null))[_0x33c9('0x49')](handleError(_0x4fe9f4,null));}; \ No newline at end of file +var _0x67c5=['offset','undefined','limit','count','set','Content-Range','reject','save','then','end','sendStatus','error','name','send','index','map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x67c5,0x14d));var _0x567c=function(_0x6d1a24,_0x4169a4){_0x6d1a24=_0x6d1a24-0x0;var _0x2d4a8a=_0x67c5[_0x6d1a24];return _0x2d4a8a;};'use strict';var emlformat=require(_0x567c('0x0'));var rimraf=require(_0x567c('0x1'));var zipdir=require(_0x567c('0x2'));var jsonpatch=require(_0x567c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x567c('0x4'));var Mustache=require(_0x567c('0x5'));var util=require(_0x567c('0x6'));var path=require(_0x567c('0x7'));var sox=require(_0x567c('0x8'));var csv=require(_0x567c('0x9'));var ejs=require(_0x567c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x567c('0xb'));var squel=require(_0x567c('0xc'));var crypto=require('crypto');var jsforce=require(_0x567c('0xd'));var deskjs=require(_0x567c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x567c('0xf'));var Papa=require(_0x567c('0x10'));var Redis=require(_0x567c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x567c('0x12'));var hardwareService=require(_0x567c('0x13'));var logger=require('../../config/logger')(_0x567c('0x14'));var utils=require(_0x567c('0x15'));var config=require(_0x567c('0x16'));var licenseUtil=require(_0x567c('0x17'));var db=require(_0x567c('0x18'))['db'];function respondWithStatusCode(_0x46d7c2,_0x322fc8){_0x322fc8=_0x322fc8||0xcc;return function(_0x158d66){if(_0x158d66){return _0x46d7c2['sendStatus'](_0x322fc8);}return _0x46d7c2[_0x567c('0x19')](_0x322fc8)['end']();};}function respondWithResult(_0x220272,_0x5e0bea){_0x5e0bea=_0x5e0bea||0xc8;return function(_0x53a5cc){if(_0x53a5cc){return _0x220272[_0x567c('0x19')](_0x5e0bea)[_0x567c('0x1a')](_0x53a5cc);}};}function respondWithFilteredResult(_0x4018ae,_0x3d7512){return function(_0x41c33d){if(_0x41c33d){var _0x3c8e2d=typeof _0x3d7512[_0x567c('0x1b')]===_0x567c('0x1c')&&typeof _0x3d7512[_0x567c('0x1d')]===_0x567c('0x1c');var _0x305827=_0x41c33d[_0x567c('0x1e')];var _0x259b02=_0x3c8e2d?0x0:_0x3d7512['offset'];var _0x241058=_0x3c8e2d?_0x41c33d['count']:_0x3d7512['offset']+_0x3d7512['limit'];var _0x3bb0d4;if(_0x241058>=_0x305827){_0x241058=_0x305827;_0x3bb0d4=0xc8;}else{_0x3bb0d4=0xce;}_0x4018ae['status'](_0x3bb0d4);return _0x4018ae[_0x567c('0x1f')](_0x567c('0x20'),_0x259b02+'-'+_0x241058+'/'+_0x305827)[_0x567c('0x1a')](_0x41c33d);}return null;};}function patchUpdates(_0x35f32a){return function(_0x351835){try{jsonpatch['apply'](_0x351835,_0x35f32a,!![]);}catch(_0x1eb801){return BPromise[_0x567c('0x21')](_0x1eb801);}return _0x351835[_0x567c('0x22')]();};}function saveUpdates(_0x5043d4,_0xb1a8d1){return function(_0x44b244){if(_0x44b244){return _0x44b244['update'](_0x5043d4)['then'](function(_0x42ce9d){return _0x42ce9d;});}return null;};}function removeEntity(_0x423581,_0x373028){return function(_0x2f34fb){if(_0x2f34fb){return _0x2f34fb['destroy']()[_0x567c('0x23')](function(){_0x423581[_0x567c('0x19')](0xcc)[_0x567c('0x24')]();});}};}function handleEntityNotFound(_0x25a795,_0x50f21a){return function(_0x59119e){if(!_0x59119e){_0x25a795[_0x567c('0x25')](0x194);}return _0x59119e;};}function handleError(_0x11ab8f,_0x33b6b1){_0x33b6b1=_0x33b6b1||0x1f4;return function(_0x8b23d1){logger[_0x567c('0x26')](_0x8b23d1['stack']);if(_0x8b23d1['name']){delete _0x8b23d1[_0x567c('0x27')];}_0x11ab8f['status'](_0x33b6b1)[_0x567c('0x28')](_0x8b23d1);};}exports[_0x567c('0x29')]=function(_0x859a8b,_0x8ab402){var _0x3772a1={},_0x43bcc4={},_0xa97330={'count':0x0,'rows':[]};var _0x75289e=_[_0x567c('0x2a')](db[_0x567c('0x2b')][_0x567c('0x2c')],function(_0x14d6ef){return{'name':_0x14d6ef['fieldName'],'type':_0x14d6ef[_0x567c('0x2d')][_0x567c('0x2e')]};});_0x43bcc4[_0x567c('0x2f')]=_[_0x567c('0x2a')](_0x75289e,'name');_0x43bcc4[_0x567c('0x30')]=_[_0x567c('0x31')](_0x859a8b[_0x567c('0x30')]);_0x43bcc4[_0x567c('0x32')]=_[_0x567c('0x33')](_0x43bcc4[_0x567c('0x2f')],_0x43bcc4[_0x567c('0x30')]);_0x3772a1[_0x567c('0x34')]=_[_0x567c('0x33')](_0x43bcc4[_0x567c('0x2f')],qs[_0x567c('0x35')](_0x859a8b[_0x567c('0x30')]['fields']));_0x3772a1['attributes']=_0x3772a1[_0x567c('0x34')][_0x567c('0x36')]?_0x3772a1[_0x567c('0x34')]:_0x43bcc4[_0x567c('0x2f')];if(!_0x859a8b['query'][_0x567c('0x37')](_0x567c('0x38'))){_0x3772a1[_0x567c('0x1d')]=qs[_0x567c('0x1d')](_0x859a8b[_0x567c('0x30')]['limit']);_0x3772a1[_0x567c('0x1b')]=qs[_0x567c('0x1b')](_0x859a8b[_0x567c('0x30')][_0x567c('0x1b')]);}_0x3772a1['order']=qs[_0x567c('0x39')](_0x859a8b['query']['sort']);_0x3772a1['where']=qs['filters'](_['pick'](_0x859a8b[_0x567c('0x30')],_0x43bcc4[_0x567c('0x32')]),_0x75289e);if(_0x859a8b[_0x567c('0x30')]['filter']){_0x3772a1[_0x567c('0x3a')]=_[_0x567c('0x3b')](_0x3772a1['where'],{'$or':_[_0x567c('0x2a')](_0x75289e,function(_0x2f89d4){if(_0x2f89d4[_0x567c('0x2d')]!==_0x567c('0x3c')){var _0x354d7a={};_0x354d7a[_0x2f89d4[_0x567c('0x27')]]={'$like':'%'+_0x859a8b['query']['filter']+'%'};return _0x354d7a;}})});}_0x3772a1=_['merge']({},_0x3772a1,_0x859a8b['options']);var _0x22c335={'where':_0x3772a1[_0x567c('0x3a')]};return db[_0x567c('0x2b')][_0x567c('0x1e')](_0x22c335)['then'](function(_0x2603df){_0xa97330[_0x567c('0x1e')]=_0x2603df;if(_0x859a8b['query'][_0x567c('0x3d')]){_0x3772a1['include']=[{'all':!![]}];}return db[_0x567c('0x2b')][_0x567c('0x3e')](_0x3772a1);})[_0x567c('0x23')](function(_0x4d70df){_0xa97330[_0x567c('0x3f')]=_0x4d70df;return _0xa97330;})[_0x567c('0x23')](respondWithFilteredResult(_0x8ab402,_0x3772a1))[_0x567c('0x40')](handleError(_0x8ab402,null));};exports['show']=function(_0x1ae3ef,_0x6a2783){var _0x1dce8c={'raw':![],'where':{'id':_0x1ae3ef[_0x567c('0x41')]['id']}},_0x5cf1e7={};_0x5cf1e7['model']=_[_0x567c('0x31')](db[_0x567c('0x2b')][_0x567c('0x2c')]);_0x5cf1e7[_0x567c('0x30')]=_[_0x567c('0x31')](_0x1ae3ef['query']);_0x5cf1e7[_0x567c('0x32')]=_[_0x567c('0x33')](_0x5cf1e7[_0x567c('0x2f')],_0x5cf1e7[_0x567c('0x30')]);_0x1dce8c['attributes']=_[_0x567c('0x33')](_0x5cf1e7[_0x567c('0x2f')],qs[_0x567c('0x35')](_0x1ae3ef[_0x567c('0x30')][_0x567c('0x35')]));_0x1dce8c[_0x567c('0x34')]=_0x1dce8c[_0x567c('0x34')][_0x567c('0x36')]?_0x1dce8c[_0x567c('0x34')]:_0x5cf1e7['model'];if(_0x1ae3ef['query'][_0x567c('0x3d')]){_0x1dce8c['include']=[{'all':!![]}];}_0x1dce8c=_[_0x567c('0x3b')]({},_0x1dce8c,_0x1ae3ef[_0x567c('0x42')]);return db['UserProfileSection'][_0x567c('0x43')](_0x1dce8c)[_0x567c('0x23')](handleEntityNotFound(_0x6a2783,null))[_0x567c('0x23')](respondWithResult(_0x6a2783,null))[_0x567c('0x40')](handleError(_0x6a2783,null));};exports[_0x567c('0x44')]=function(_0x31611b,_0x5b6bc1){return db['UserProfileSection'][_0x567c('0x44')](_0x31611b['body'],{})['then'](respondWithResult(_0x5b6bc1,0xc9))[_0x567c('0x40')](handleError(_0x5b6bc1,null));};exports['update']=function(_0x2c8bc6,_0x4712b4){if(_0x2c8bc6['body']['id']){delete _0x2c8bc6[_0x567c('0x45')]['id'];}return db[_0x567c('0x2b')][_0x567c('0x43')]({'where':{'id':_0x2c8bc6[_0x567c('0x41')]['id']}})[_0x567c('0x23')](handleEntityNotFound(_0x4712b4,null))[_0x567c('0x23')](saveUpdates(_0x2c8bc6['body'],null))['then'](respondWithResult(_0x4712b4,null))[_0x567c('0x40')](handleError(_0x4712b4,null));};exports[_0x567c('0x46')]=function(_0x2ab20d,_0x2b5a7a){return db[_0x567c('0x2b')]['find']({'where':{'id':_0x2ab20d[_0x567c('0x41')]['id']}})[_0x567c('0x23')](handleEntityNotFound(_0x2b5a7a,null))['then'](removeEntity(_0x2b5a7a,null))['catch'](handleError(_0x2b5a7a,null));};exports[_0x567c('0x47')]=function(_0x1d7fcb,_0x57a72e){return db[_0x567c('0x2b')][_0x567c('0x47')]()[_0x567c('0x23')](respondWithResult(_0x57a72e,null))[_0x567c('0x40')](handleError(_0x57a72e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2b92b3c..24b1595 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 _0x3705=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','../../config/logger'];(function(_0x222057,_0x42c0dd){var _0x1677a6=function(_0x8a8a31){while(--_0x8a8a31){_0x222057['push'](_0x222057['shift']());}};_0x1677a6(++_0x42c0dd);}(_0x3705,0x9b));var _0x5370=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3705[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5370('0x0'))(_0x5370('0x1'));var moment=require('moment');var BPromise=require(_0x5370('0x2'));var rp=require(_0x5370('0x3'));var fs=require('fs');var path=require(_0x5370('0x4'));var rimraf=require(_0x5370('0x5'));var config=require(_0x5370('0x6'));var attributes=require(_0x5370('0x7'));module['exports']=function(_0x1e175b,_0x3ce6bc){return _0x1e175b[_0x5370('0x8')]('UserProfileSection',attributes,{'tableName':_0x5370('0x9'),'paranoid':![],'indexes':[{'name':_0x5370('0xa'),'fields':[_0x5370('0xb'),_0x5370('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x390e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0xee1228,_0x2df586){var _0x210f17=function(_0x5b4d31){while(--_0x5b4d31){_0xee1228['push'](_0xee1228['shift']());}};_0x210f17(++_0x2df586);}(_0x390e,0x175));var _0xe390=function(_0x50cdb0,_0x192d51){_0x50cdb0=_0x50cdb0-0x0;var _0x3c739b=_0x390e[_0x50cdb0];return _0x3c739b;};'use strict';var _=require(_0xe390('0x0'));var util=require(_0xe390('0x1'));var logger=require(_0xe390('0x2'))(_0xe390('0x3'));var moment=require(_0xe390('0x4'));var BPromise=require(_0xe390('0x5'));var rp=require(_0xe390('0x6'));var fs=require('fs');var path=require(_0xe390('0x7'));var rimraf=require(_0xe390('0x8'));var config=require(_0xe390('0x9'));var attributes=require(_0xe390('0xa'));module[_0xe390('0xb')]=function(_0x5850bb,_0x3047e0){return _0x5850bb[_0xe390('0xc')](_0xe390('0xd'),attributes,{'tableName':_0xe390('0xe'),'paranoid':![],'indexes':[{'name':_0xe390('0xf'),'fields':[_0xe390('0x10'),'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 36e1e32..3de9879 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 _0x4300=['stringify','error','code','message','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1e4ecf,_0x12cdd5){var _0x330950=function(_0x241c79){while(--_0x241c79){_0x1e4ecf['push'](_0x1e4ecf['shift']());}};_0x330950(++_0x12cdd5);}(_0x4300,0x1a6));var _0x0430=function(_0x4d8ef5,_0xe7afb8){_0x4d8ef5=_0x4d8ef5-0x0;var _0x48baa=_0x4300[_0x4d8ef5];return _0x48baa;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0430('0x1'));var db=require(_0x0430('0x2'))['db'];var utils=require(_0x0430('0x3'));var logger=require(_0x0430('0x4'))(_0x0430('0x5'));var config=require('../../config/environment');var jayson=require(_0x0430('0x6'));var client=jayson['client'][_0x0430('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b03ef,_0x2388b9,_0xc83312){return new BPromise(function(_0x408b14,_0x31964e){return client[_0x0430('0x8')](_0x5b03ef,_0xc83312)[_0x0430('0x9')](function(_0x3a9dc1){logger[_0x0430('0xa')](_0x0430('0xb'),_0x2388b9,'request\x20sent');logger[_0x0430('0xc')](_0x0430('0xd'),_0x2388b9,_0x0430('0xe'),JSON[_0x0430('0xf')](_0x3a9dc1));if(_0x3a9dc1[_0x0430('0x10')]){if(_0x3a9dc1[_0x0430('0x10')][_0x0430('0x11')]===0x1f4){logger[_0x0430('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2388b9,_0x3a9dc1['error'][_0x0430('0x12')]);return _0x31964e(_0x3a9dc1[_0x0430('0x10')][_0x0430('0x12')]);}logger[_0x0430('0x10')](_0x0430('0xb'),_0x2388b9,_0x3a9dc1[_0x0430('0x10')][_0x0430('0x12')]);return _0x408b14(_0x3a9dc1['error'][_0x0430('0x12')]);}else{logger[_0x0430('0xa')](_0x0430('0xb'),_0x2388b9,_0x0430('0xe'));_0x408b14(_0x3a9dc1['result']['message']);}})['catch'](function(_0x54fbf8){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2388b9,_0x54fbf8);_0x31964e(_0x54fbf8);});});} \ No newline at end of file +var _0x87fc=['result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x87fc,0xaa));var _0xc87f=function(_0x554dea,_0x1c223a){_0x554dea=_0x554dea-0x0;var _0x4c2682=_0x87fc[_0x554dea];return _0x4c2682;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc87f('0x0'));var rs=require(_0xc87f('0x1'));var fs=require('fs');var Redis=require(_0xc87f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc87f('0x3'));var logger=require(_0xc87f('0x4'))(_0xc87f('0x5'));var config=require(_0xc87f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc87f('0x7')][_0xc87f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5013ad,_0x303153,_0x90fdfc){return new BPromise(function(_0x17f020,_0x28ce14){return client[_0xc87f('0x9')](_0x5013ad,_0x90fdfc)[_0xc87f('0xa')](function(_0x26246d){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x303153,_0xc87f('0xb'));logger[_0xc87f('0xc')](_0xc87f('0xd'),_0x303153,_0xc87f('0xb'),JSON[_0xc87f('0xe')](_0x26246d));if(_0x26246d['error']){if(_0x26246d[_0xc87f('0xf')]['code']===0x1f4){logger[_0xc87f('0xf')](_0xc87f('0x10'),_0x303153,_0x26246d['error'][_0xc87f('0x11')]);return _0x28ce14(_0x26246d[_0xc87f('0xf')][_0xc87f('0x11')]);}logger[_0xc87f('0xf')](_0xc87f('0x10'),_0x303153,_0x26246d[_0xc87f('0xf')][_0xc87f('0x11')]);return _0x17f020(_0x26246d[_0xc87f('0xf')][_0xc87f('0x11')]);}else{logger[_0xc87f('0x12')](_0xc87f('0x10'),_0x303153,_0xc87f('0xb'));_0x17f020(_0x26246d[_0xc87f('0x13')][_0xc87f('0x11')]);}})[_0xc87f('0x14')](function(_0x414a3d){logger[_0xc87f('0xf')](_0xc87f('0x10'),_0x303153,_0x414a3d);_0x28ce14(_0x414a3d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9357c9c..9ab521b 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(_0x279cae,_0x308409){var _0x416f40=function(_0x449fa7){while(--_0x449fa7){_0x279cae['push'](_0x279cae['shift']());}};_0x416f40(++_0x308409);}(_0xe706,0xa3));var _0x6e70=function(_0x11500e,_0x457be0){_0x11500e=_0x11500e-0x0;var _0x135e1a=_0xe706[_0x11500e];return _0x135e1a;};'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(_0x5b697a,_0x280202){var _0x5de43b=function(_0x2bc32f){while(--_0x2bc32f){_0x5b697a['push'](_0x5b697a['shift']());}};_0x5de43b(++_0x280202);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e8e4080..56afd4d 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 _0x96aa=['exports','sequelize'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x96aa,0x67));var _0xa96a=function(_0x3e6509,_0x1a3389){_0x3e6509=_0x3e6509-0x0;var _0x16f1a9=_0x96aa[_0x3e6509];return _0x16f1a9;};'use strict';var Sequelize=require(_0xa96a('0x0'));module[_0xa96a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb7e=['INTEGER'];(function(_0x245928,_0x2e3a98){var _0x28b34f=function(_0xe86837){while(--_0xe86837){_0x245928['push'](_0x245928['shift']());}};_0x28b34f(++_0x2e3a98);}(_0xfb7e,0x145));var _0xefb7=function(_0x272806,_0xdb783d){_0x272806=_0x272806-0x0;var _0x5da08a=_0xfb7e[_0x272806];return _0x5da08a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xefb7('0x0')],'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 e9f2c91..31e6be0 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 _0x326f=['user_has_sms_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x578aca,_0x187cae){var _0x4f5c42=function(_0x358700){while(--_0x358700){_0x578aca['push'](_0x578aca['shift']());}};_0x4f5c42(++_0x187cae);}(_0x326f,0xd1));var _0xf326=function(_0x537a68,_0x1fad4b){_0x537a68=_0x537a68-0x0;var _0x10e635=_0x326f[_0x537a68];return _0x10e635;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2581=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x507403,_0x248b0d){var _0x2feff3=function(_0x403d8e){while(--_0x403d8e){_0x507403['push'](_0x507403['shift']());}};_0x2feff3(++_0x248b0d);}(_0x2581,0xcb));var _0x1258=function(_0x334cdb,_0x3a219a){_0x334cdb=_0x334cdb-0x0;var _0x186122=_0x2581[_0x334cdb];return _0x186122;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var logger=require(_0x1258('0x2'))(_0x1258('0x3'));var moment=require(_0x1258('0x4'));var BPromise=require('bluebird');var rp=require(_0x1258('0x5'));var fs=require('fs');var path=require(_0x1258('0x6'));var rimraf=require(_0x1258('0x7'));var config=require(_0x1258('0x8'));var attributes=require(_0x1258('0x9'));module[_0x1258('0xa')]=function(_0x16c926,_0x2aeafc){return _0x16c926['define'](_0x1258('0xb'),attributes,{'tableName':_0x1258('0xc'),'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 37b61b8..1450fc8 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 _0xc582=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','../../config/logger','rpc','../../config/environment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc582,0x13f));var _0x2c58=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xc582[_0x35da42];return _0x370035;};'use strict';var _=require(_0x2c58('0x0'));var util=require(_0x2c58('0x1'));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('../../config/utils');var logger=require(_0x2c58('0x2'))(_0x2c58('0x3'));var config=require(_0x2c58('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2c58('0x5')][_0x2c58('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ac268,_0x20304b,_0x333f78){return new BPromise(function(_0x411527,_0x3865ad){return client[_0x2c58('0x7')](_0x9ac268,_0x333f78)[_0x2c58('0x8')](function(_0x46ac2f){logger[_0x2c58('0x9')](_0x2c58('0xa'),_0x20304b,_0x2c58('0xb'));logger['debug'](_0x2c58('0xc'),_0x20304b,_0x2c58('0xb'),JSON[_0x2c58('0xd')](_0x46ac2f));if(_0x46ac2f[_0x2c58('0xe')]){if(_0x46ac2f[_0x2c58('0xe')][_0x2c58('0xf')]===0x1f4){logger[_0x2c58('0xe')](_0x2c58('0xa'),_0x20304b,_0x46ac2f[_0x2c58('0xe')][_0x2c58('0x10')]);return _0x3865ad(_0x46ac2f[_0x2c58('0xe')][_0x2c58('0x10')]);}logger[_0x2c58('0xe')](_0x2c58('0xa'),_0x20304b,_0x46ac2f[_0x2c58('0xe')][_0x2c58('0x10')]);return _0x411527(_0x46ac2f['error'][_0x2c58('0x10')]);}else{logger[_0x2c58('0x9')](_0x2c58('0xa'),_0x20304b,_0x2c58('0xb'));_0x411527(_0x46ac2f[_0x2c58('0x11')][_0x2c58('0x10')]);}})['catch'](function(_0x2f53d1){logger[_0x2c58('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x20304b,_0x2f53d1);_0x3865ad(_0x2f53d1);});});} \ No newline at end of file +var _0x6794=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x6794,0x119));var _0x4679=function(_0x4e6e21,_0x4cc8ba){_0x4e6e21=_0x4e6e21-0x0;var _0x20011a=_0x6794[_0x4e6e21];return _0x20011a;};'use strict';var _=require(_0x4679('0x0'));var util=require(_0x4679('0x1'));var moment=require(_0x4679('0x2'));var BPromise=require(_0x4679('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4679('0x4'));var db=require(_0x4679('0x5'))['db'];var utils=require(_0x4679('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4679('0x7'));var jayson=require(_0x4679('0x8'));var client=jayson[_0x4679('0x9')][_0x4679('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2141f4,_0x449aa6,_0x340c53){return new BPromise(function(_0x435a37,_0x503ce5){return client[_0x4679('0xb')](_0x2141f4,_0x340c53)[_0x4679('0xc')](function(_0x24f70e){logger[_0x4679('0xd')](_0x4679('0xe'),_0x449aa6,_0x4679('0xf'));logger[_0x4679('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x449aa6,_0x4679('0xf'),JSON[_0x4679('0x11')](_0x24f70e));if(_0x24f70e[_0x4679('0x12')]){if(_0x24f70e[_0x4679('0x12')][_0x4679('0x13')]===0x1f4){logger[_0x4679('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x449aa6,_0x24f70e['error']['message']);return _0x503ce5(_0x24f70e[_0x4679('0x12')][_0x4679('0x14')]);}logger[_0x4679('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x449aa6,_0x24f70e[_0x4679('0x12')]['message']);return _0x435a37(_0x24f70e[_0x4679('0x12')]['message']);}else{logger[_0x4679('0xd')](_0x4679('0xe'),_0x449aa6,'request\x20sent');_0x435a37(_0x24f70e[_0x4679('0x15')]['message']);}})[_0x4679('0x16')](function(_0x271b43){logger[_0x4679('0x12')](_0x4679('0xe'),_0x449aa6,_0x271b43);_0x503ce5(_0x271b43);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f004fac..1eeaaec 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 _0xf5a8=['exports','INTEGER'];(function(_0x5066f6,_0xf65d45){var _0x42d488=function(_0x391377){while(--_0x391377){_0x5066f6['push'](_0x5066f6['shift']());}};_0x42d488(++_0xf65d45);}(_0xf5a8,0x134));var _0x8f5a=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0xf5a8[_0x33925b];return _0x375e21;};'use strict';var Sequelize=require('sequelize');module[_0x8f5a('0x0')]={'UserId':{'type':Sequelize[_0x8f5a('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7f76=['INTEGER','sequelize','exports'];(function(_0x995b4d,_0x32fda2){var _0x402acd=function(_0x4e2f27){while(--_0x4e2f27){_0x995b4d['push'](_0x995b4d['shift']());}};_0x402acd(++_0x32fda2);}(_0x7f76,0x6d));var _0x67f7=function(_0x59855e,_0x265e60){_0x59855e=_0x59855e-0x0;var _0x43597d=_0x7f76[_0x59855e];return _0x43597d;};'use strict';var Sequelize=require(_0x67f7('0x0'));module[_0x67f7('0x1')]={'UserId':{'type':Sequelize[_0x67f7('0x2')]},'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 ab3dac1..182bcf9 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(_0x14ee40,_0x59fc41){var _0x16770f=function(_0x5d1bc2){while(--_0x5d1bc2){_0x14ee40['push'](_0x14ee40['shift']());}};_0x16770f(++_0x59fc41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x4f2682,_0xba2c82){var _0x42dbbd=function(_0x582aec){while(--_0x582aec){_0x4f2682['push'](_0x4f2682['shift']());}};_0x42dbbd(++_0xba2c82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 6ef5af5..874d7c2 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x46b6ae,_0x2778b3){var _0x32e437=function(_0x4e2d47){while(--_0x4e2d47){_0x46b6ae['push'](_0x46b6ae['shift']());}};_0x32e437(++_0x2778b3);}(_0x70e0,0x17b));var _0x070e=function(_0x3e7847,_0xdbf9c1){_0x3e7847=_0x3e7847-0x0;var _0x2db49b=_0x70e0[_0x3e7847];return _0x2db49b;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2eadcc,_0x2b37ca){var _0x34ffaa=function(_0x26d166){while(--_0x26d166){_0x2eadcc['push'](_0x2eadcc['shift']());}};_0x34ffaa(++_0x2b37ca);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2bec204..db98da8 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 _0x8477=['sequelize'];(function(_0x272230,_0x27bcdf){var _0x2b6b23=function(_0x38b9be){while(--_0x38b9be){_0x272230['push'](_0x272230['shift']());}};_0x2b6b23(++_0x27bcdf);}(_0x8477,0xea));var _0x7847=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x8477[_0x531cb8];return _0x5cf297;};'use strict';var Sequelize=require(_0x7847('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x291c=['exports','INTEGER','sequelize'];(function(_0x131062,_0x1d4d50){var _0x41beaa=function(_0x5e8435){while(--_0x5e8435){_0x131062['push'](_0x131062['shift']());}};_0x41beaa(++_0x1d4d50);}(_0x291c,0x137));var _0xc291=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x291c[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xc291('0x0'));module[_0xc291('0x1')]={'penalty':{'type':Sequelize[_0xc291('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 2c33a6e..d6ccf5d 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 _0xf9ab=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0xf9ab,0x12d));var _0xbf9a=function(_0x20e240,_0x4a4ca0){_0x20e240=_0x20e240-0x0;var _0x57d81a=_0xf9ab[_0x20e240];return _0x57d81a;};'use strict';var _=require(_0xbf9a('0x0'));var util=require(_0xbf9a('0x1'));var logger=require(_0xbf9a('0x2'))(_0xbf9a('0x3'));var moment=require(_0xbf9a('0x4'));var BPromise=require(_0xbf9a('0x5'));var rp=require(_0xbf9a('0x6'));var fs=require('fs');var path=require(_0xbf9a('0x7'));var rimraf=require(_0xbf9a('0x8'));var config=require(_0xbf9a('0x9'));var attributes=require(_0xbf9a('0xa'));module[_0xbf9a('0xb')]=function(_0x2276be,_0x2f9d49){return _0x2276be[_0xbf9a('0xc')](_0xbf9a('0xd'),attributes,{'tableName':_0xbf9a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa562=['moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x195040,_0x15af51){var _0xbeff6d=function(_0x449d90){while(--_0x449d90){_0x195040['push'](_0x195040['shift']());}};_0xbeff6d(++_0x15af51);}(_0xa562,0x8c));var _0x2a56=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0xa562[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0x2a56('0x0'));var util=require('util');var logger=require(_0x2a56('0x1'))(_0x2a56('0x2'));var moment=require(_0x2a56('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a56('0x4'));var fs=require('fs');var path=require(_0x2a56('0x5'));var rimraf=require(_0x2a56('0x6'));var config=require(_0x2a56('0x7'));var attributes=require(_0x2a56('0x8'));module[_0x2a56('0x9')]=function(_0x33e0ac,_0x341445){return _0x33e0ac[_0x2a56('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index b092810..ed8f3be 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 _0x222e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash'];(function(_0x1cbecb,_0x505e33){var _0x4112c4=function(_0x1d1d36){while(--_0x1d1d36){_0x1cbecb['push'](_0x1cbecb['shift']());}};_0x4112c4(++_0x505e33);}(_0x222e,0x1cb));var _0xe222=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x222e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe222('0x0'));var util=require('util');var moment=require(_0xe222('0x1'));var BPromise=require(_0xe222('0x2'));var rs=require(_0xe222('0x3'));var fs=require('fs');var Redis=require(_0xe222('0x4'));var db=require(_0xe222('0x5'))['db'];var utils=require(_0xe222('0x6'));var logger=require('../../config/logger')(_0xe222('0x7'));var config=require(_0xe222('0x8'));var jayson=require(_0xe222('0x9'));var client=jayson[_0xe222('0xa')][_0xe222('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fcb00,_0x26a689,_0x43d4f6){return new BPromise(function(_0x586eb5,_0x52c52f){return client['request'](_0x4fcb00,_0x43d4f6)[_0xe222('0xc')](function(_0x122919){logger[_0xe222('0xd')](_0xe222('0xe'),_0x26a689,_0xe222('0xf'));logger[_0xe222('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x26a689,'request\x20sent',JSON['stringify'](_0x122919));if(_0x122919['error']){if(_0x122919[_0xe222('0x11')]['code']===0x1f4){logger[_0xe222('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x26a689,_0x122919[_0xe222('0x11')][_0xe222('0x12')]);return _0x52c52f(_0x122919[_0xe222('0x11')][_0xe222('0x12')]);}logger[_0xe222('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x26a689,_0x122919[_0xe222('0x11')][_0xe222('0x12')]);return _0x586eb5(_0x122919[_0xe222('0x11')][_0xe222('0x12')]);}else{logger['info'](_0xe222('0xe'),_0x26a689,_0xe222('0xf'));_0x586eb5(_0x122919[_0xe222('0x13')]['message']);}})['catch'](function(_0xc3151e){logger['error'](_0xe222('0xe'),_0x26a689,_0xc3151e);_0x52c52f(_0xc3151e);});});} \ No newline at end of file +var _0x4577=['error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4577,0x1c4));var _0x7457=function(_0x2d5934,_0x1acc4f){_0x2d5934=_0x2d5934-0x0;var _0x5807c8=_0x4577[_0x2d5934];return _0x5807c8;};'use strict';var _=require(_0x7457('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7457('0x1'));var rs=require(_0x7457('0x2'));var fs=require('fs');var Redis=require(_0x7457('0x3'));var db=require(_0x7457('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7457('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7457('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a9046,_0x5f3c7e,_0x2bbf00){return new BPromise(function(_0x4f36b8,_0x5eba57){return client['request'](_0x1a9046,_0x2bbf00)['then'](function(_0x215545){logger[_0x7457('0x7')](_0x7457('0x8'),_0x5f3c7e,_0x7457('0x9'));logger['debug'](_0x7457('0xa'),_0x5f3c7e,_0x7457('0x9'),JSON[_0x7457('0xb')](_0x215545));if(_0x215545['error']){if(_0x215545[_0x7457('0xc')][_0x7457('0xd')]===0x1f4){logger['error'](_0x7457('0x8'),_0x5f3c7e,_0x215545['error'][_0x7457('0xe')]);return _0x5eba57(_0x215545[_0x7457('0xc')][_0x7457('0xe')]);}logger[_0x7457('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x5f3c7e,_0x215545[_0x7457('0xc')][_0x7457('0xe')]);return _0x4f36b8(_0x215545[_0x7457('0xc')][_0x7457('0xe')]);}else{logger['info'](_0x7457('0x8'),_0x5f3c7e,'request\x20sent');_0x4f36b8(_0x215545[_0x7457('0xf')][_0x7457('0xe')]);}})['catch'](function(_0x11d401){logger[_0x7457('0xc')](_0x7457('0x8'),_0x5f3c7e,_0x11d401);_0x5eba57(_0x11d401);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0cd2729..9eb2f2d 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x54d5f0,_0x26ad5e){var _0xd656f5=function(_0x5d20e7){while(--_0x5d20e7){_0x54d5f0['push'](_0x54d5f0['shift']());}};_0xd656f5(++_0x26ad5e);}(_0x70e0,0x17b));var _0x070e=function(_0x433297,_0x3817ac){_0x433297=_0x433297-0x0;var _0x226d0e=_0x70e0[_0x433297];return _0x226d0e;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f8afd78..2c9676d 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 _0xe864=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe864,0x14b));var _0x4e86=function(_0x1defa5,_0x24abbd){_0x1defa5=_0x1defa5-0x0;var _0x1dbd9c=_0xe864[_0x1defa5];return _0x1dbd9c;};'use strict';var Sequelize=require(_0x4e86('0x0'));module[_0x4e86('0x1')]={'uniqueid':{'type':Sequelize[_0x4e86('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4e86('0x3')},'membername':{'type':Sequelize[_0x4e86('0x4')],'allowNull':![],'comment':_0x4e86('0x3')},'UserId':{'type':Sequelize[_0x4e86('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4e86('0x4')],'allowNull':![],'unique':_0x4e86('0x5'),'comment':_0x4e86('0x3')},'VoiceQueueId':{'type':Sequelize[_0x4e86('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4e86('0x4')],'allowNull':![],'unique':_0x4e86('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4e86('0x2')](0xb),'defaultValue':0x0,'comment':_0x4e86('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x4e86('0x3')}}; \ No newline at end of file +var _0xd406=['sequelize','exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd406,0x90));var _0x6d40=function(_0x18aa8c,_0x345c83){_0x18aa8c=_0x18aa8c-0x0;var _0x3ab186=_0xd406[_0x18aa8c];return _0x3ab186;};'use strict';var Sequelize=require(_0x6d40('0x0'));module[_0x6d40('0x1')]={'uniqueid':{'type':Sequelize[_0x6d40('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x6d40('0x3')],'allowNull':![],'comment':_0x6d40('0x4')},'UserId':{'type':Sequelize[_0x6d40('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6d40('0x3')],'allowNull':![],'unique':_0x6d40('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x6d40('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x6d40('0x3')],'allowNull':![],'unique':_0x6d40('0x5'),'comment':_0x6d40('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6d40('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5c9bf5c..4e1e5bf 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 _0x4ebc=['hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4ebc,0x161));var _0xc4eb=function(_0x4754c0,_0x34280a){_0x4754c0=_0x4754c0-0x0;var _0x399861=_0x4ebc[_0x4754c0];return _0x399861;};'use strict';var EventEmitter=require(_0xc4eb('0x0'));var UserVoiceQueueRt=require(_0xc4eb('0x1'))['db'][_0xc4eb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc4eb('0x3')](0x0);var events={'afterCreate':_0xc4eb('0x4'),'afterUpdate':'update','afterDestroy':_0xc4eb('0x5')};function emitEvent(_0x433c2a){return function(_0x17218b,_0x4be179,_0x40f6ae){UserVoiceQueueRtEvents['emit'](_0x433c2a+':'+_0x17218b['id'],_0x17218b);UserVoiceQueueRtEvents[_0xc4eb('0x6')](_0x433c2a,_0x17218b);_0x40f6ae(null);};}for(var e in events){if(events[_0xc4eb('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xf046=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x2d9131,_0x381dd9){var _0x3ef6d1=function(_0x1ce1a8){while(--_0x1ce1a8){_0x2d9131['push'](_0x2d9131['shift']());}};_0x3ef6d1(++_0x381dd9);}(_0xf046,0x7a));var _0x6f04=function(_0x1ee611,_0x377a3a){_0x1ee611=_0x1ee611-0x0;var _0x3bce0a=_0xf046[_0x1ee611];return _0x3bce0a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x6f04('0x0'))['db'][_0x6f04('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6f04('0x2')](0x0);var events={'afterCreate':_0x6f04('0x3'),'afterUpdate':_0x6f04('0x4'),'afterDestroy':_0x6f04('0x5')};function emitEvent(_0x107c82){return function(_0x46faf3,_0x4125e9,_0x699d34){UserVoiceQueueRtEvents['emit'](_0x107c82+':'+_0x46faf3['id'],_0x46faf3);UserVoiceQueueRtEvents[_0x6f04('0x6')](_0x107c82,_0x46faf3);_0x699d34(null);};}for(var e in events){if(events[_0x6f04('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6f04('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 932db52..1ec7a1d 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 _0xe342=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x4d00e5,_0x1f75d8){var _0x39c5ea=function(_0x226b52){while(--_0x226b52){_0x4d00e5['push'](_0x4d00e5['shift']());}};_0x39c5ea(++_0x1f75d8);}(_0xe342,0x1ec));var _0x2e34=function(_0x1fd7c0,_0x1d3c01){_0x1fd7c0=_0x1fd7c0-0x0;var _0x1f27d5=_0xe342[_0x1fd7c0];return _0x1f27d5;};'use strict';var _=require('lodash');var util=require(_0x2e34('0x0'));var logger=require(_0x2e34('0x1'))('api');var moment=require(_0x2e34('0x2'));var BPromise=require(_0x2e34('0x3'));var rp=require(_0x2e34('0x4'));var fs=require('fs');var path=require(_0x2e34('0x5'));var rimraf=require('rimraf');var config=require(_0x2e34('0x6'));var attributes=require(_0x2e34('0x7'));module[_0x2e34('0x8')]=function(_0x221b4e,_0x1cd9a0){return _0x221b4e[_0x2e34('0x9')](_0x2e34('0xa'),attributes,{'tableName':_0x2e34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bf5=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','request-promise','rimraf','exports','define'];(function(_0x7b9bea,_0x3e82c6){var _0x231235=function(_0x561a38){while(--_0x561a38){_0x7b9bea['push'](_0x7b9bea['shift']());}};_0x231235(++_0x3e82c6);}(_0x4bf5,0x110));var _0x54bf=function(_0x278679,_0x1eb219){_0x278679=_0x278679-0x0;var _0x4874aa=_0x4bf5[_0x278679];return _0x4874aa;};'use strict';var _=require(_0x54bf('0x0'));var util=require(_0x54bf('0x1'));var logger=require(_0x54bf('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x54bf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54bf('0x4'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x54bf('0x5')]=function(_0x55b898,_0x39b9f8){return _0x55b898[_0x54bf('0x6')](_0x54bf('0x7'),attributes,{'tableName':_0x54bf('0x8'),'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 0996ad1..00b15b6 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 _0xaab2=['raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','ioredis','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options'];(function(_0x229b99,_0xb6a166){var _0x13e10c=function(_0x166e54){while(--_0x166e54){_0x229b99['push'](_0x229b99['shift']());}};_0x13e10c(++_0xb6a166);}(_0xaab2,0x76));var _0x2aab=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xaab2[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x2aab('0x0'));var util=require(_0x2aab('0x1'));var moment=require(_0x2aab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2aab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aab('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2aab('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2aab('0x6')]['http']({'port':0x232a});config[_0x2aab('0x7')]=_[_0x2aab('0x8')](config['redis'],{'host':_0x2aab('0x9'),'port':0x18eb});var socket=require(_0x2aab('0xa'))(new Redis(config[_0x2aab('0x7')]));require(_0x2aab('0xb'))[_0x2aab('0xc')](socket);function respondWithRpcPromise(_0x53cec9,_0x3e44c3,_0x3a3ec2){return new BPromise(function(_0x34b5e7,_0x5b165a){return client[_0x2aab('0xd')](_0x53cec9,_0x3a3ec2)[_0x2aab('0xe')](function(_0x18fdb8){logger[_0x2aab('0xf')](_0x2aab('0x10'),_0x3e44c3,_0x2aab('0x11'));logger[_0x2aab('0x12')](_0x2aab('0x13'),_0x3e44c3,_0x2aab('0x11'),JSON[_0x2aab('0x14')](_0x18fdb8));if(_0x18fdb8[_0x2aab('0x15')]){if(_0x18fdb8[_0x2aab('0x15')][_0x2aab('0x16')]===0x1f4){logger[_0x2aab('0x15')](_0x2aab('0x10'),_0x3e44c3,_0x18fdb8[_0x2aab('0x15')][_0x2aab('0x17')]);return _0x5b165a(_0x18fdb8[_0x2aab('0x15')]['message']);}logger[_0x2aab('0x15')](_0x2aab('0x10'),_0x3e44c3,_0x18fdb8[_0x2aab('0x15')]['message']);return _0x34b5e7(_0x18fdb8[_0x2aab('0x15')][_0x2aab('0x17')]);}else{logger['info'](_0x2aab('0x10'),_0x3e44c3,'request\x20sent');_0x34b5e7(_0x18fdb8[_0x2aab('0x18')][_0x2aab('0x17')]);}})[_0x2aab('0x19')](function(_0x107c47){logger['error'](_0x2aab('0x10'),_0x3e44c3,_0x107c47);_0x5b165a(_0x107c47);});});}exports[_0x2aab('0x1a')]=function(_0x40e2ab){var _0x4342b0=this;return new Promise(function(_0x2b6803,_0x1337e9){return db[_0x2aab('0x1b')][_0x2aab('0x1c')]({'raw':_0x40e2ab['options']?_0x40e2ab[_0x2aab('0x1d')][_0x2aab('0x1e')]===undefined?!![]:![]:!![],'where':_0x40e2ab['options']?_0x40e2ab[_0x2aab('0x1d')][_0x2aab('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2aab('0x20'),db[_0x2aab('0x21')]['fn']('IF',db[_0x2aab('0x21')][_0x2aab('0x22')](_0x2aab('0x23')))),_0x2aab('0x24')]]})[_0x2aab('0xe')](function(_0x1e17d7){logger[_0x2aab('0xf')](_0x2aab('0x1a'),_0x40e2ab);logger['debug'](_0x2aab('0x1a'),_0x40e2ab,JSON[_0x2aab('0x14')](_0x1e17d7));_0x2b6803(_0x1e17d7);})[_0x2aab('0x19')](function(_0x8b026){logger[_0x2aab('0x15')](_0x2aab('0x1a'),_0x8b026[_0x2aab('0x17')],_0x40e2ab);_0x1337e9(_0x4342b0[_0x2aab('0x15')](0x1f4,_0x8b026[_0x2aab('0x17')]));});});}; \ No newline at end of file +var _0x1581=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','outboundQueuePauses','stringify','lodash','moment','bluebird','randomstring'];(function(_0x1b23c5,_0x1b94ec){var _0x212585=function(_0xfe116){while(--_0xfe116){_0x1b23c5['push'](_0x1b23c5['shift']());}};_0x212585(++_0x1b94ec);}(_0x1581,0x94));var _0x1158=function(_0x1713c6,_0x16b463){_0x1713c6=_0x1713c6-0x0;var _0x5b1754=_0x1581[_0x1713c6];return _0x5b1754;};'use strict';var _=require(_0x1158('0x0'));var util=require('util');var moment=require(_0x1158('0x1'));var BPromise=require(_0x1158('0x2'));var rs=require(_0x1158('0x3'));var fs=require('fs');var Redis=require(_0x1158('0x4'));var db=require(_0x1158('0x5'))['db'];var utils=require(_0x1158('0x6'));var logger=require(_0x1158('0x7'))(_0x1158('0x8'));var config=require(_0x1158('0x9'));var jayson=require(_0x1158('0xa'));var client=jayson[_0x1158('0xb')][_0x1158('0xc')]({'port':0x232a});config[_0x1158('0xd')]=_[_0x1158('0xe')](config[_0x1158('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1158('0xf'))(new Redis(config[_0x1158('0xd')]));require('./userVoiceQueueRt.socket')[_0x1158('0x10')](socket);function respondWithRpcPromise(_0x238e1c,_0x5c3770,_0x20052b){return new BPromise(function(_0x340f50,_0x4ba0e6){return client[_0x1158('0x11')](_0x238e1c,_0x20052b)[_0x1158('0x12')](function(_0x2bdd1d){logger[_0x1158('0x13')](_0x1158('0x14'),_0x5c3770,'request\x20sent');logger[_0x1158('0x15')](_0x1158('0x16'),_0x5c3770,_0x1158('0x17'),JSON['stringify'](_0x2bdd1d));if(_0x2bdd1d['error']){if(_0x2bdd1d['error']['code']===0x1f4){logger[_0x1158('0x18')](_0x1158('0x14'),_0x5c3770,_0x2bdd1d['error'][_0x1158('0x19')]);return _0x4ba0e6(_0x2bdd1d['error'][_0x1158('0x19')]);}logger[_0x1158('0x18')](_0x1158('0x14'),_0x5c3770,_0x2bdd1d[_0x1158('0x18')][_0x1158('0x19')]);return _0x340f50(_0x2bdd1d[_0x1158('0x18')]['message']);}else{logger[_0x1158('0x13')](_0x1158('0x14'),_0x5c3770,_0x1158('0x17'));_0x340f50(_0x2bdd1d[_0x1158('0x1a')][_0x1158('0x19')]);}})[_0x1158('0x1b')](function(_0x5bab89){logger[_0x1158('0x18')](_0x1158('0x14'),_0x5c3770,_0x5bab89);_0x4ba0e6(_0x5bab89);});});}exports[_0x1158('0x1c')]=function(_0x790278){var _0x2ac75b=this;return new Promise(function(_0xce1a89,_0x35b285){return db[_0x1158('0x1d')][_0x1158('0x1e')]({'raw':_0x790278[_0x1158('0x1f')]?_0x790278[_0x1158('0x1f')][_0x1158('0x20')]===undefined?!![]:![]:!![],'where':_0x790278[_0x1158('0x1f')]?_0x790278['options']['where']||null:null,'attributes':[[db[_0x1158('0x21')]['fn'](_0x1158('0x22'),db[_0x1158('0x21')]['fn']('IF',db[_0x1158('0x21')][_0x1158('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0x1158('0x24')]]})['then'](function(_0x10780b){logger[_0x1158('0x13')](_0x1158('0x1c'),_0x790278);logger[_0x1158('0x15')](_0x1158('0x1c'),_0x790278,JSON[_0x1158('0x25')](_0x10780b));_0xce1a89(_0x10780b);})[_0x1158('0x1b')](function(_0x440761){logger[_0x1158('0x18')](_0x1158('0x1c'),_0x440761['message'],_0x790278);_0x35b285(_0x2ac75b[_0x1158('0x18')](0x1f4,_0x440761['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index ff031e8..5e27752 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 _0x1c3b=['removeListener','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x1c3b,0xab));var _0xb1c3=function(_0x232351,_0x100ebb){_0x232351=_0x232351-0x0;var _0x4e72e6=_0x1c3b[_0x232351];return _0x4e72e6;};'use strict';var UserVoiceQueueRtEvents=require(_0xb1c3('0x0'));var events=[_0xb1c3('0x1'),_0xb1c3('0x2'),'update'];function createListener(_0x4eeac2,_0x28a375){return function(_0x89ce0b){_0x28a375[_0xb1c3('0x3')](_0x4eeac2,_0x89ce0b);};}function removeListener(_0x34dbb5,_0x24d4c0){return function(){UserVoiceQueueRtEvents[_0xb1c3('0x4')](_0x34dbb5,_0x24d4c0);};}exports['register']=function(_0x472813){for(var _0x62da34=0x0,_0x211254=events['length'];_0x62da34<_0x211254;_0x62da34++){var _0x504fc9=events[_0x62da34];var _0x4ed6cf=createListener('userVoiceQueueRt:'+_0x504fc9,_0x472813);UserVoiceQueueRtEvents['on'](_0x504fc9,_0x4ed6cf);}}; \ No newline at end of file +var _0xf9d5=['length','userVoiceQueueRt:','save','remove','emit','removeListener'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf9d5,0x122));var _0x5f9d=function(_0x3cb004,_0x25d5d1){_0x3cb004=_0x3cb004-0x0;var _0x343ec2=_0xf9d5[_0x3cb004];return _0x343ec2;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x5f9d('0x0'),_0x5f9d('0x1'),'update'];function createListener(_0x1b4d74,_0xe4b9ee){return function(_0x21d986){_0xe4b9ee[_0x5f9d('0x2')](_0x1b4d74,_0x21d986);};}function removeListener(_0x25fa8c,_0xdd68fd){return function(){UserVoiceQueueRtEvents[_0x5f9d('0x3')](_0x25fa8c,_0xdd68fd);};}exports['register']=function(_0x1fc74c){for(var _0x59027b=0x0,_0x24999e=events[_0x5f9d('0x4')];_0x59027b<_0x24999e;_0x59027b++){var _0x4fb9f7=events[_0x59027b];var _0x3420b2=createListener(_0x5f9d('0x5')+_0x4fb9f7,_0x1fc74c);UserVoiceQueueRtEvents['on'](_0x4fb9f7,_0x3420b2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2055368..2a328e3 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x38ddb2,_0x1141e1){var _0x22ee32=function(_0x4f48d7){while(--_0x4f48d7){_0x38ddb2['push'](_0x38ddb2['shift']());}};_0x22ee32(++_0x1141e1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a49c847..dfdc837 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 _0x23f9=['sequelize','exports','INTEGER'];(function(_0x55df29,_0x2777d1){var _0x29eaad=function(_0x12a99f){while(--_0x12a99f){_0x55df29['push'](_0x55df29['shift']());}};_0x29eaad(++_0x2777d1);}(_0x23f9,0x1d7));var _0x923f=function(_0x20d02d,_0x458b40){_0x20d02d=_0x20d02d-0x0;var _0x172078=_0x23f9[_0x20d02d];return _0x172078;};'use strict';var Sequelize=require(_0x923f('0x0'));module[_0x923f('0x1')]={'penalty':{'type':Sequelize[_0x923f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbe36=['INTEGER','sequelize'];(function(_0x466cdf,_0x277ea1){var _0x383cf1=function(_0x2d364e){while(--_0x2d364e){_0x466cdf['push'](_0x466cdf['shift']());}};_0x383cf1(++_0x277ea1);}(_0xbe36,0xd1));var _0x6be3=function(_0x400083,_0xa87d9b){_0x400083=_0x400083-0x0;var _0x590170=_0xbe36[_0x400083];return _0x590170;};'use strict';var Sequelize=require(_0x6be3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6be3('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 f7767ba..9897e50 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 _0x9fde=['../../config/logger','moment','request-promise','../../config/environment','exports','UserWhatsappQueue','lodash','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9fde,0x116));var _0xe9fd=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x9fde[_0x187279];return _0x3da59d;};'use strict';var _=require(_0xe9fd('0x0'));var util=require(_0xe9fd('0x1'));var logger=require(_0xe9fd('0x2'))('api');var moment=require(_0xe9fd('0x3'));var BPromise=require('bluebird');var rp=require(_0xe9fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe9fd('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xe9fd('0x6')]=function(_0x33de3d,_0x1772ac){return _0x33de3d['define'](_0xe9fd('0x7'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ac8=['define','UserWhatsappQueue','user_has_whatsapp_queues','util','bluebird','request-promise','path','exports'];(function(_0x5080d3,_0x3051e2){var _0x1e3e83=function(_0x5b283a){while(--_0x5b283a){_0x5080d3['push'](_0x5080d3['shift']());}};_0x1e3e83(++_0x3051e2);}(_0x6ac8,0xb3));var _0x86ac=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x6ac8[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require('lodash');var util=require(_0x86ac('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x86ac('0x1'));var rp=require(_0x86ac('0x2'));var fs=require('fs');var path=require(_0x86ac('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x86ac('0x4')]=function(_0x5c78f8,_0x18f57e){return _0x5c78f8[_0x86ac('0x5')](_0x86ac('0x6'),attributes,{'tableName':_0x86ac('0x7'),'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 1ff2332..60c639f 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 _0xd6a9=['http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0xd6a9,0x1f0));var _0x9d6a=function(_0x481a5e,_0x45e71d){_0x481a5e=_0x481a5e-0x0;var _0x4df483=_0xd6a9[_0x481a5e];return _0x4df483;};'use strict';var _=require(_0x9d6a('0x0'));var util=require(_0x9d6a('0x1'));var moment=require(_0x9d6a('0x2'));var BPromise=require(_0x9d6a('0x3'));var rs=require(_0x9d6a('0x4'));var fs=require('fs');var Redis=require(_0x9d6a('0x5'));var db=require(_0x9d6a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9d6a('0x7'));var jayson=require(_0x9d6a('0x8'));var client=jayson[_0x9d6a('0x9')][_0x9d6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d714c,_0xe784fd,_0x20229f){return new BPromise(function(_0x3a05ec,_0x2bc6fa){return client[_0x9d6a('0xb')](_0x4d714c,_0x20229f)[_0x9d6a('0xc')](function(_0x249704){logger['info'](_0x9d6a('0xd'),_0xe784fd,_0x9d6a('0xe'));logger[_0x9d6a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xe784fd,_0x9d6a('0xe'),JSON[_0x9d6a('0x10')](_0x249704));if(_0x249704['error']){if(_0x249704[_0x9d6a('0x11')][_0x9d6a('0x12')]===0x1f4){logger[_0x9d6a('0x11')](_0x9d6a('0xd'),_0xe784fd,_0x249704['error'][_0x9d6a('0x13')]);return _0x2bc6fa(_0x249704[_0x9d6a('0x11')][_0x9d6a('0x13')]);}logger['error'](_0x9d6a('0xd'),_0xe784fd,_0x249704[_0x9d6a('0x11')]['message']);return _0x3a05ec(_0x249704[_0x9d6a('0x11')][_0x9d6a('0x13')]);}else{logger[_0x9d6a('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0xe784fd,_0x9d6a('0xe'));_0x3a05ec(_0x249704['result'][_0x9d6a('0x13')]);}})[_0x9d6a('0x15')](function(_0x133efe){logger['error'](_0x9d6a('0xd'),_0xe784fd,_0x133efe);_0x2bc6fa(_0x133efe);});});} \ No newline at end of file +var _0x64d6=['rpc','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','randomstring','../../config/utils','../../config/logger'];(function(_0x621dfb,_0x11a632){var _0x253081=function(_0x3166ab){while(--_0x3166ab){_0x621dfb['push'](_0x621dfb['shift']());}};_0x253081(++_0x11a632);}(_0x64d6,0x182));var _0x664d=function(_0x24e896,_0x4296fd){_0x24e896=_0x24e896-0x0;var _0x4faf22=_0x64d6[_0x24e896];return _0x4faf22;};'use strict';var _=require(_0x664d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x664d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x664d('0x2'));var logger=require(_0x664d('0x3'))(_0x664d('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x664d('0x5')][_0x664d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3634f3,_0x41b8e4,_0x129d87){return new BPromise(function(_0x3eec58,_0x3cfb57){return client['request'](_0x3634f3,_0x129d87)[_0x664d('0x7')](function(_0x1b1f5a){logger[_0x664d('0x8')](_0x664d('0x9'),_0x41b8e4,_0x664d('0xa'));logger['debug'](_0x664d('0xb'),_0x41b8e4,_0x664d('0xa'),JSON['stringify'](_0x1b1f5a));if(_0x1b1f5a[_0x664d('0xc')]){if(_0x1b1f5a[_0x664d('0xc')][_0x664d('0xd')]===0x1f4){logger[_0x664d('0xc')](_0x664d('0x9'),_0x41b8e4,_0x1b1f5a[_0x664d('0xc')][_0x664d('0xe')]);return _0x3cfb57(_0x1b1f5a[_0x664d('0xc')][_0x664d('0xe')]);}logger[_0x664d('0xc')](_0x664d('0x9'),_0x41b8e4,_0x1b1f5a[_0x664d('0xc')][_0x664d('0xe')]);return _0x3eec58(_0x1b1f5a['error']['message']);}else{logger[_0x664d('0x8')](_0x664d('0x9'),_0x41b8e4,'request\x20sent');_0x3eec58(_0x1b1f5a['result'][_0x664d('0xe')]);}})['catch'](function(_0x589263){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x41b8e4,_0x589263);_0x3cfb57(_0x589263);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4a36244..7689119 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 _0x6183=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0xc4afb6,_0x2ae90d){var _0x409623=function(_0x3317f9){while(--_0x3317f9){_0xc4afb6['push'](_0xc4afb6['shift']());}};_0x409623(++_0x2ae90d);}(_0x6183,0x19b));var _0x3618=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x6183[_0x2261ce];return _0x524640;};'use strict';var multer=require('multer');var util=require(_0x3618('0x0'));var path=require(_0x3618('0x1'));var timeout=require(_0x3618('0x2'));var express=require('express');var router=express[_0x3618('0x3')]();var fs_extra=require(_0x3618('0x4'));var auth=require(_0x3618('0x5'));var interaction=require(_0x3618('0x6'));var config=require(_0x3618('0x7'));var controller=require(_0x3618('0x8'));router[_0x3618('0x9')]('/',auth[_0x3618('0xa')](),controller[_0x3618('0xb')]);router[_0x3618('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3618('0xc')]);router[_0x3618('0xd')]('/',auth[_0x3618('0xa')](),controller[_0x3618('0xe')]);router[_0x3618('0xf')](_0x3618('0x10'),auth[_0x3618('0xa')](),controller[_0x3618('0x11')]);router[_0x3618('0x12')](_0x3618('0x10'),auth[_0x3618('0xa')](),controller[_0x3618('0x13')]);module['exports']=router; \ No newline at end of file +var _0xef39=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x3f2b6a,_0x5bd074){var _0x34f708=function(_0x376de8){while(--_0x376de8){_0x3f2b6a['push'](_0x3f2b6a['shift']());}};_0x34f708(++_0x5bd074);}(_0xef39,0x92));var _0x9ef3=function(_0xcf12b1,_0x954270){_0xcf12b1=_0xcf12b1-0x0;var _0xcedb35=_0xef39[_0xcf12b1];return _0xcedb35;};'use strict';var multer=require('multer');var util=require(_0x9ef3('0x0'));var path=require(_0x9ef3('0x1'));var timeout=require(_0x9ef3('0x2'));var express=require(_0x9ef3('0x3'));var router=express[_0x9ef3('0x4')]();var fs_extra=require(_0x9ef3('0x5'));var auth=require(_0x9ef3('0x6'));var interaction=require(_0x9ef3('0x7'));var config=require(_0x9ef3('0x8'));var controller=require(_0x9ef3('0x9'));router[_0x9ef3('0xa')]('/',auth[_0x9ef3('0xb')](),controller['index']);router[_0x9ef3('0xa')](_0x9ef3('0xc'),auth[_0x9ef3('0xb')](),controller[_0x9ef3('0xd')]);router[_0x9ef3('0xe')]('/',auth[_0x9ef3('0xb')](),controller[_0x9ef3('0xf')]);router[_0x9ef3('0x10')](_0x9ef3('0xc'),auth[_0x9ef3('0xb')](),controller[_0x9ef3('0x11')]);router[_0x9ef3('0x12')](_0x9ef3('0xc'),auth['isAuthenticated'](),controller[_0x9ef3('0x13')]);module[_0x9ef3('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d03c67b..a3f041f 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 _0xf6bd=['name','sequelize','STRING'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0xf6bd,0x17b));var _0xdf6b=function(_0x4ac8ef,_0x5c2c6e){_0x4ac8ef=_0x4ac8ef-0x0;var _0x3a9239=_0xf6bd[_0x4ac8ef];return _0x3a9239;};'use strict';var Sequelize=require(_0xdf6b('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf6b('0x1')],'unique':_0xdf6b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x701d=['name','sequelize','exports','STRING'];(function(_0x134df7,_0x206c4d){var _0x4a36cc=function(_0x42c97d){while(--_0x42c97d){_0x134df7['push'](_0x134df7['shift']());}};_0x4a36cc(++_0x206c4d);}(_0x701d,0xb1));var _0xd701=function(_0x4e4070,_0x699370){_0x4e4070=_0x4e4070-0x0;var _0x500ae2=_0x701d[_0x4e4070];return _0x500ae2;};'use strict';var Sequelize=require(_0xd701('0x0'));module[_0xd701('0x1')]={'name':{'type':Sequelize[_0xd701('0x2')],'unique':_0xd701('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd701('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6c34f01..46a65c7 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 _0xb791=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','options','includeAll','rows','catch','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x352a20,_0x57018e){var _0x146b69=function(_0x245b72){while(--_0x245b72){_0x352a20['push'](_0x352a20['shift']());}};_0x146b69(++_0x57018e);}(_0xb791,0x95));var _0x1b79=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xb791[_0x58fc2f];return _0x3a1312;};'use strict';var emlformat=require(_0x1b79('0x0'));var rimraf=require(_0x1b79('0x1'));var zipdir=require(_0x1b79('0x2'));var jsonpatch=require(_0x1b79('0x3'));var rp=require(_0x1b79('0x4'));var moment=require('moment');var BPromise=require(_0x1b79('0x5'));var Mustache=require(_0x1b79('0x6'));var util=require(_0x1b79('0x7'));var path=require(_0x1b79('0x8'));var sox=require(_0x1b79('0x9'));var csv=require(_0x1b79('0xa'));var ejs=require(_0x1b79('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b79('0xc'));var squel=require(_0x1b79('0xd'));var crypto=require('crypto');var jsforce=require(_0x1b79('0xe'));var deskjs=require(_0x1b79('0xf'));var toCsv=require(_0x1b79('0xa'));var querystring=require(_0x1b79('0x10'));var Papa=require(_0x1b79('0x11'));var Redis=require(_0x1b79('0x12'));var authService=require(_0x1b79('0x13'));var qs=require(_0x1b79('0x14'));var as=require(_0x1b79('0x15'));var hardwareService=require(_0x1b79('0x16'));var logger=require(_0x1b79('0x17'))(_0x1b79('0x18'));var utils=require('../../config/utils');var config=require(_0x1b79('0x19'));var licenseUtil=require(_0x1b79('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x116b5e,_0x5c895f){_0x5c895f=_0x5c895f||0xcc;return function(_0x2e3ed7){if(_0x2e3ed7){return _0x116b5e[_0x1b79('0x1b')](_0x5c895f);}return _0x116b5e[_0x1b79('0x1c')](_0x5c895f)[_0x1b79('0x1d')]();};}function respondWithResult(_0x40bfce,_0x1451e6){_0x1451e6=_0x1451e6||0xc8;return function(_0x4d3f46){if(_0x4d3f46){return _0x40bfce[_0x1b79('0x1c')](_0x1451e6)[_0x1b79('0x1e')](_0x4d3f46);}};}function respondWithFilteredResult(_0x2d9879,_0x31539f){return function(_0x1a508c){if(_0x1a508c){var _0x4d8488=typeof _0x31539f[_0x1b79('0x1f')]===_0x1b79('0x20')&&typeof _0x31539f[_0x1b79('0x21')]===_0x1b79('0x20');var _0x3d574a=_0x1a508c['count'];var _0x53d2dc=_0x4d8488?0x0:_0x31539f[_0x1b79('0x1f')];var _0xa02772=_0x4d8488?_0x1a508c[_0x1b79('0x22')]:_0x31539f['offset']+_0x31539f[_0x1b79('0x21')];var _0x5aa71c;if(_0xa02772>=_0x3d574a){_0xa02772=_0x3d574a;_0x5aa71c=0xc8;}else{_0x5aa71c=0xce;}_0x2d9879['status'](_0x5aa71c);return _0x2d9879['set']('Content-Range',_0x53d2dc+'-'+_0xa02772+'/'+_0x3d574a)[_0x1b79('0x1e')](_0x1a508c);}return null;};}function patchUpdates(_0x568dca){return function(_0x3ad3db){try{jsonpatch[_0x1b79('0x23')](_0x3ad3db,_0x568dca,!![]);}catch(_0x1e306e){return BPromise['reject'](_0x1e306e);}return _0x3ad3db['save']();};}function saveUpdates(_0x19eaa1,_0x31ee7b){return function(_0x5355b7){if(_0x5355b7){return _0x5355b7[_0x1b79('0x24')](_0x19eaa1)[_0x1b79('0x25')](function(_0x52d3bc){return _0x52d3bc;});}return null;};}function removeEntity(_0x4d2d71,_0x8d2a6d){return function(_0x237a43){if(_0x237a43){return _0x237a43[_0x1b79('0x26')]()[_0x1b79('0x25')](function(){var _0x1646c6=_0x237a43[_0x1b79('0x27')]({'plain':!![]});var _0xf7fd47=_0x1b79('0x28');return db[_0x1b79('0x29')][_0x1b79('0x26')]({'where':{'type':_0xf7fd47,'resourceId':_0x1646c6['id']}})[_0x1b79('0x25')](function(){return _0x237a43;});})[_0x1b79('0x25')](function(){_0x4d2d71[_0x1b79('0x1c')](0xcc)[_0x1b79('0x1d')]();});}};}function handleEntityNotFound(_0x4b2fc6,_0x309ec4){return function(_0x44f16d){if(!_0x44f16d){_0x4b2fc6[_0x1b79('0x1b')](0x194);}return _0x44f16d;};}function handleError(_0x3c6a4f,_0x438e66){_0x438e66=_0x438e66||0x1f4;return function(_0x15d8db){logger[_0x1b79('0x2a')](_0x15d8db[_0x1b79('0x2b')]);if(_0x15d8db[_0x1b79('0x2c')]){delete _0x15d8db[_0x1b79('0x2c')];}_0x3c6a4f[_0x1b79('0x1c')](_0x438e66)['send'](_0x15d8db);};}exports[_0x1b79('0x2d')]=function(_0x489a89,_0x3fb945){var _0x2e4806={},_0x230b5a={},_0x324f46={'count':0x0,'rows':[]};var _0x91da48=_[_0x1b79('0x2e')](db[_0x1b79('0x2f')][_0x1b79('0x30')],function(_0x907a9c){return{'name':_0x907a9c['fieldName'],'type':_0x907a9c['type'][_0x1b79('0x31')]};});_0x230b5a['model']=_[_0x1b79('0x2e')](_0x91da48,_0x1b79('0x2c'));_0x230b5a[_0x1b79('0x32')]=_[_0x1b79('0x33')](_0x489a89[_0x1b79('0x32')]);_0x230b5a[_0x1b79('0x34')]=_[_0x1b79('0x35')](_0x230b5a[_0x1b79('0x36')],_0x230b5a[_0x1b79('0x32')]);_0x2e4806[_0x1b79('0x37')]=_['intersection'](_0x230b5a['model'],qs[_0x1b79('0x38')](_0x489a89[_0x1b79('0x32')][_0x1b79('0x38')]));_0x2e4806[_0x1b79('0x37')]=_0x2e4806[_0x1b79('0x37')][_0x1b79('0x39')]?_0x2e4806[_0x1b79('0x37')]:_0x230b5a['model'];if(!_0x489a89[_0x1b79('0x32')]['hasOwnProperty'](_0x1b79('0x3a'))){_0x2e4806[_0x1b79('0x21')]=qs[_0x1b79('0x21')](_0x489a89[_0x1b79('0x32')]['limit']);_0x2e4806[_0x1b79('0x1f')]=qs[_0x1b79('0x1f')](_0x489a89['query']['offset']);}_0x2e4806[_0x1b79('0x3b')]=qs['sort'](_0x489a89[_0x1b79('0x32')][_0x1b79('0x3c')]);_0x2e4806['where']=qs['filters'](_[_0x1b79('0x3d')](_0x489a89[_0x1b79('0x32')],_0x230b5a['filters']),_0x91da48);if(_0x489a89['query'][_0x1b79('0x3e')]){_0x2e4806['where']=_[_0x1b79('0x3f')](_0x2e4806[_0x1b79('0x40')],{'$or':_['map'](_0x91da48,function(_0x1aedc4){if(_0x1aedc4[_0x1b79('0x41')]!=='VIRTUAL'){var _0x4238ff={};_0x4238ff[_0x1aedc4['name']]={'$like':'%'+_0x489a89[_0x1b79('0x32')]['filter']+'%'};return _0x4238ff;}})});}_0x2e4806=_['merge']({},_0x2e4806,_0x489a89[_0x1b79('0x42')]);var _0x3b8b23={'where':_0x2e4806[_0x1b79('0x40')]};return db[_0x1b79('0x2f')][_0x1b79('0x22')](_0x3b8b23)[_0x1b79('0x25')](function(_0x43bb74){_0x324f46[_0x1b79('0x22')]=_0x43bb74;if(_0x489a89[_0x1b79('0x32')][_0x1b79('0x43')]){_0x2e4806['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x2e4806);})['then'](function(_0x2a97ba){_0x324f46[_0x1b79('0x44')]=_0x2a97ba;return _0x324f46;})[_0x1b79('0x25')](respondWithFilteredResult(_0x3fb945,_0x2e4806))[_0x1b79('0x45')](handleError(_0x3fb945,null));};exports['show']=function(_0x17dbe7,_0x45e6a4){var _0x23226d={'raw':!![],'where':{'id':_0x17dbe7['params']['id']}},_0x525059={};_0x525059[_0x1b79('0x36')]=_[_0x1b79('0x33')](db[_0x1b79('0x2f')][_0x1b79('0x30')]);_0x525059[_0x1b79('0x32')]=_[_0x1b79('0x33')](_0x17dbe7[_0x1b79('0x32')]);_0x525059[_0x1b79('0x34')]=_[_0x1b79('0x35')](_0x525059[_0x1b79('0x36')],_0x525059[_0x1b79('0x32')]);_0x23226d[_0x1b79('0x37')]=_[_0x1b79('0x35')](_0x525059[_0x1b79('0x36')],qs[_0x1b79('0x38')](_0x17dbe7[_0x1b79('0x32')][_0x1b79('0x38')]));_0x23226d[_0x1b79('0x37')]=_0x23226d['attributes'][_0x1b79('0x39')]?_0x23226d['attributes']:_0x525059[_0x1b79('0x36')];if(_0x17dbe7[_0x1b79('0x32')]['includeAll']){_0x23226d[_0x1b79('0x46')]=[{'all':!![]}];}_0x23226d=_[_0x1b79('0x3f')]({},_0x23226d,_0x17dbe7[_0x1b79('0x42')]);return db['Variable']['find'](_0x23226d)['then'](handleEntityNotFound(_0x45e6a4,null))['then'](respondWithResult(_0x45e6a4,null))[_0x1b79('0x45')](handleError(_0x45e6a4,null));};exports[_0x1b79('0x47')]=function(_0x2ed799,_0x6aea57){return db['Variable']['create'](_0x2ed799['body'],{})[_0x1b79('0x25')](function(_0x12cd22){var _0xeb71df=_0x2ed799[_0x1b79('0x48')][_0x1b79('0x27')]({'plain':!![]});if(!_0xeb71df)throw new Error(_0x1b79('0x49'));if(_0xeb71df[_0x1b79('0x4a')]===_0x1b79('0x48')){var _0x29e90b=_0x12cd22[_0x1b79('0x27')]({'plain':!![]});var _0x4d070a=_0x1b79('0x28');return db[_0x1b79('0x4b')]['find']({'where':{'name':_0x4d070a,'userProfileId':_0xeb71df['userProfileId']},'raw':!![]})[_0x1b79('0x25')](function(_0x175fb5){if(_0x175fb5&&_0x175fb5[_0x1b79('0x4c')]===0x0){return db['UserProfileResource'][_0x1b79('0x47')]({'name':_0x29e90b['name'],'resourceId':_0x29e90b['id'],'type':_0x175fb5['name'],'sectionId':_0x175fb5['id']},{})[_0x1b79('0x25')](function(){return _0x12cd22;});}else{return _0x12cd22;}})[_0x1b79('0x45')](function(_0x15fdf5){logger['error'](_0x1b79('0x4d'),_0x15fdf5);throw _0x15fdf5;});}return _0x12cd22;})[_0x1b79('0x25')](respondWithResult(_0x6aea57,0xc9))[_0x1b79('0x45')](handleError(_0x6aea57,null));};exports['update']=function(_0x7c9eae,_0x237363){if(_0x7c9eae[_0x1b79('0x4e')]['id']){delete _0x7c9eae[_0x1b79('0x4e')]['id'];}return db[_0x1b79('0x2f')][_0x1b79('0x4f')]({'where':{'id':_0x7c9eae[_0x1b79('0x50')]['id']}})[_0x1b79('0x25')](handleEntityNotFound(_0x237363,null))['then'](saveUpdates(_0x7c9eae[_0x1b79('0x4e')],null))[_0x1b79('0x25')](respondWithResult(_0x237363,null))['catch'](handleError(_0x237363,null));};exports[_0x1b79('0x26')]=function(_0x6c6684,_0x22cc10){return db['Variable'][_0x1b79('0x4f')]({'where':{'id':_0x6c6684[_0x1b79('0x50')]['id']}})[_0x1b79('0x25')](handleEntityNotFound(_0x22cc10,null))[_0x1b79('0x25')](removeEntity(_0x22cc10,null))[_0x1b79('0x45')](handleError(_0x22cc10,null));}; \ No newline at end of file +var _0xe0dd=['set','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','Variable','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','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','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count'];(function(_0x4b192f,_0x1fbd6b){var _0x473963=function(_0x97dd34){while(--_0x97dd34){_0x4b192f['push'](_0x4b192f['shift']());}};_0x473963(++_0x1fbd6b);}(_0xe0dd,0xd8));var _0xde0d=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xe0dd[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0xde0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde0d('0x1'));var jsonpatch=require(_0xde0d('0x2'));var rp=require(_0xde0d('0x3'));var moment=require(_0xde0d('0x4'));var BPromise=require(_0xde0d('0x5'));var Mustache=require(_0xde0d('0x6'));var util=require(_0xde0d('0x7'));var path=require(_0xde0d('0x8'));var sox=require(_0xde0d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde0d('0xa'));var squel=require(_0xde0d('0xb'));var crypto=require('crypto');var jsforce=require(_0xde0d('0xc'));var deskjs=require(_0xde0d('0xd'));var toCsv=require(_0xde0d('0xe'));var querystring=require(_0xde0d('0xf'));var Papa=require(_0xde0d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde0d('0x11'));var as=require(_0xde0d('0x12'));var hardwareService=require(_0xde0d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xde0d('0x14'));var config=require(_0xde0d('0x15'));var licenseUtil=require(_0xde0d('0x16'));var db=require(_0xde0d('0x17'))['db'];function respondWithStatusCode(_0x4f5e95,_0x168d38){_0x168d38=_0x168d38||0xcc;return function(_0x188413){if(_0x188413){return _0x4f5e95['sendStatus'](_0x168d38);}return _0x4f5e95[_0xde0d('0x18')](_0x168d38)['end']();};}function respondWithResult(_0x586830,_0x260966){_0x260966=_0x260966||0xc8;return function(_0x40a610){if(_0x40a610){return _0x586830[_0xde0d('0x18')](_0x260966)[_0xde0d('0x19')](_0x40a610);}};}function respondWithFilteredResult(_0x2b2c20,_0x5ebb59){return function(_0x5ecc78){if(_0x5ecc78){var _0x58cf23=typeof _0x5ebb59[_0xde0d('0x1a')]===_0xde0d('0x1b')&&typeof _0x5ebb59[_0xde0d('0x1c')]===_0xde0d('0x1b');var _0x2d6cd9=_0x5ecc78['count'];var _0x1e5afd=_0x58cf23?0x0:_0x5ebb59[_0xde0d('0x1a')];var _0x37a965=_0x58cf23?_0x5ecc78[_0xde0d('0x1d')]:_0x5ebb59[_0xde0d('0x1a')]+_0x5ebb59[_0xde0d('0x1c')];var _0x548955;if(_0x37a965>=_0x2d6cd9){_0x37a965=_0x2d6cd9;_0x548955=0xc8;}else{_0x548955=0xce;}_0x2b2c20[_0xde0d('0x18')](_0x548955);return _0x2b2c20[_0xde0d('0x1e')](_0xde0d('0x1f'),_0x1e5afd+'-'+_0x37a965+'/'+_0x2d6cd9)[_0xde0d('0x19')](_0x5ecc78);}return null;};}function patchUpdates(_0x4e9e84){return function(_0x2a026a){try{jsonpatch[_0xde0d('0x20')](_0x2a026a,_0x4e9e84,!![]);}catch(_0x1b57ea){return BPromise[_0xde0d('0x21')](_0x1b57ea);}return _0x2a026a[_0xde0d('0x22')]();};}function saveUpdates(_0x41857f,_0xfc8ab2){return function(_0x1ea3a5){if(_0x1ea3a5){return _0x1ea3a5[_0xde0d('0x23')](_0x41857f)[_0xde0d('0x24')](function(_0x46a4e9){return _0x46a4e9;});}return null;};}function removeEntity(_0x171229,_0x3600ee){return function(_0x498cc8){if(_0x498cc8){return _0x498cc8['destroy']()['then'](function(){var _0x2b45f7=_0x498cc8[_0xde0d('0x25')]({'plain':!![]});var _0xa59dba=_0xde0d('0x26');return db[_0xde0d('0x27')][_0xde0d('0x28')]({'where':{'type':_0xa59dba,'resourceId':_0x2b45f7['id']}})['then'](function(){return _0x498cc8;});})[_0xde0d('0x24')](function(){_0x171229[_0xde0d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f354e,_0x5976b4){return function(_0x3799fd){if(!_0x3799fd){_0x2f354e[_0xde0d('0x29')](0x194);}return _0x3799fd;};}function handleError(_0x54e354,_0x18c25b){_0x18c25b=_0x18c25b||0x1f4;return function(_0x58e125){logger[_0xde0d('0x2a')](_0x58e125[_0xde0d('0x2b')]);if(_0x58e125['name']){delete _0x58e125['name'];}_0x54e354['status'](_0x18c25b)[_0xde0d('0x2c')](_0x58e125);};}exports[_0xde0d('0x2d')]=function(_0xb690d5,_0x1d7895){var _0x5303b4={},_0x861f33={},_0x17ec9d={'count':0x0,'rows':[]};var _0x4f8e48=_[_0xde0d('0x2e')](db[_0xde0d('0x2f')][_0xde0d('0x30')],function(_0x408513){return{'name':_0x408513['fieldName'],'type':_0x408513['type'][_0xde0d('0x31')]};});_0x861f33[_0xde0d('0x32')]=_['map'](_0x4f8e48,_0xde0d('0x33'));_0x861f33[_0xde0d('0x34')]=_[_0xde0d('0x35')](_0xb690d5[_0xde0d('0x34')]);_0x861f33[_0xde0d('0x36')]=_[_0xde0d('0x37')](_0x861f33[_0xde0d('0x32')],_0x861f33[_0xde0d('0x34')]);_0x5303b4[_0xde0d('0x38')]=_['intersection'](_0x861f33[_0xde0d('0x32')],qs[_0xde0d('0x39')](_0xb690d5['query'][_0xde0d('0x39')]));_0x5303b4[_0xde0d('0x38')]=_0x5303b4[_0xde0d('0x38')][_0xde0d('0x3a')]?_0x5303b4[_0xde0d('0x38')]:_0x861f33[_0xde0d('0x32')];if(!_0xb690d5[_0xde0d('0x34')]['hasOwnProperty']('nolimit')){_0x5303b4['limit']=qs[_0xde0d('0x1c')](_0xb690d5[_0xde0d('0x34')][_0xde0d('0x1c')]);_0x5303b4[_0xde0d('0x1a')]=qs['offset'](_0xb690d5['query'][_0xde0d('0x1a')]);}_0x5303b4['order']=qs[_0xde0d('0x3b')](_0xb690d5[_0xde0d('0x34')][_0xde0d('0x3b')]);_0x5303b4[_0xde0d('0x3c')]=qs[_0xde0d('0x36')](_[_0xde0d('0x3d')](_0xb690d5['query'],_0x861f33['filters']),_0x4f8e48);if(_0xb690d5[_0xde0d('0x34')][_0xde0d('0x3e')]){_0x5303b4[_0xde0d('0x3c')]=_[_0xde0d('0x3f')](_0x5303b4['where'],{'$or':_[_0xde0d('0x2e')](_0x4f8e48,function(_0xf99afc){if(_0xf99afc[_0xde0d('0x40')]!==_0xde0d('0x41')){var _0x5f2df8={};_0x5f2df8[_0xf99afc[_0xde0d('0x33')]]={'$like':'%'+_0xb690d5[_0xde0d('0x34')][_0xde0d('0x3e')]+'%'};return _0x5f2df8;}})});}_0x5303b4=_[_0xde0d('0x3f')]({},_0x5303b4,_0xb690d5[_0xde0d('0x42')]);var _0x394ff1={'where':_0x5303b4[_0xde0d('0x3c')]};return db[_0xde0d('0x2f')][_0xde0d('0x1d')](_0x394ff1)[_0xde0d('0x24')](function(_0x40b470){_0x17ec9d[_0xde0d('0x1d')]=_0x40b470;if(_0xb690d5[_0xde0d('0x34')]['includeAll']){_0x5303b4[_0xde0d('0x43')]=[{'all':!![]}];}return db[_0xde0d('0x2f')][_0xde0d('0x44')](_0x5303b4);})['then'](function(_0x1b096a){_0x17ec9d[_0xde0d('0x45')]=_0x1b096a;return _0x17ec9d;})[_0xde0d('0x24')](respondWithFilteredResult(_0x1d7895,_0x5303b4))[_0xde0d('0x46')](handleError(_0x1d7895,null));};exports['show']=function(_0x363337,_0xdce741){var _0x39f2fa={'raw':!![],'where':{'id':_0x363337[_0xde0d('0x47')]['id']}},_0xa80661={};_0xa80661[_0xde0d('0x32')]=_[_0xde0d('0x35')](db[_0xde0d('0x2f')][_0xde0d('0x30')]);_0xa80661[_0xde0d('0x34')]=_[_0xde0d('0x35')](_0x363337[_0xde0d('0x34')]);_0xa80661[_0xde0d('0x36')]=_[_0xde0d('0x37')](_0xa80661['model'],_0xa80661['query']);_0x39f2fa['attributes']=_[_0xde0d('0x37')](_0xa80661[_0xde0d('0x32')],qs[_0xde0d('0x39')](_0x363337[_0xde0d('0x34')][_0xde0d('0x39')]));_0x39f2fa[_0xde0d('0x38')]=_0x39f2fa[_0xde0d('0x38')][_0xde0d('0x3a')]?_0x39f2fa[_0xde0d('0x38')]:_0xa80661[_0xde0d('0x32')];if(_0x363337[_0xde0d('0x34')][_0xde0d('0x48')]){_0x39f2fa[_0xde0d('0x43')]=[{'all':!![]}];}_0x39f2fa=_[_0xde0d('0x3f')]({},_0x39f2fa,_0x363337['options']);return db['Variable'][_0xde0d('0x49')](_0x39f2fa)['then'](handleEntityNotFound(_0xdce741,null))[_0xde0d('0x24')](respondWithResult(_0xdce741,null))[_0xde0d('0x46')](handleError(_0xdce741,null));};exports[_0xde0d('0x4a')]=function(_0x41b428,_0x3ae45e){return db[_0xde0d('0x2f')]['create'](_0x41b428[_0xde0d('0x4b')],{})['then'](function(_0x3eb19c){var _0x3b5309=_0x41b428[_0xde0d('0x4c')]['get']({'plain':!![]});if(!_0x3b5309)throw new Error(_0xde0d('0x4d'));if(_0x3b5309[_0xde0d('0x4e')]===_0xde0d('0x4c')){var _0x33adf2=_0x3eb19c[_0xde0d('0x25')]({'plain':!![]});var _0x11ffee=_0xde0d('0x26');return db['UserProfileSection'][_0xde0d('0x49')]({'where':{'name':_0x11ffee,'userProfileId':_0x3b5309[_0xde0d('0x4f')]},'raw':!![]})[_0xde0d('0x24')](function(_0x5a6256){if(_0x5a6256&&_0x5a6256[_0xde0d('0x50')]===0x0){return db[_0xde0d('0x27')][_0xde0d('0x4a')]({'name':_0x33adf2[_0xde0d('0x33')],'resourceId':_0x33adf2['id'],'type':_0x5a6256['name'],'sectionId':_0x5a6256['id']},{})[_0xde0d('0x24')](function(){return _0x3eb19c;});}else{return _0x3eb19c;}})[_0xde0d('0x46')](function(_0x34f936){logger[_0xde0d('0x2a')](_0xde0d('0x51'),_0x34f936);throw _0x34f936;});}return _0x3eb19c;})['then'](respondWithResult(_0x3ae45e,0xc9))[_0xde0d('0x46')](handleError(_0x3ae45e,null));};exports[_0xde0d('0x23')]=function(_0x231b16,_0xad85fc){if(_0x231b16[_0xde0d('0x4b')]['id']){delete _0x231b16[_0xde0d('0x4b')]['id'];}return db[_0xde0d('0x2f')]['find']({'where':{'id':_0x231b16[_0xde0d('0x47')]['id']}})['then'](handleEntityNotFound(_0xad85fc,null))[_0xde0d('0x24')](saveUpdates(_0x231b16['body'],null))['then'](respondWithResult(_0xad85fc,null))[_0xde0d('0x46')](handleError(_0xad85fc,null));};exports[_0xde0d('0x28')]=function(_0x427ae8,_0x426fd5){return db['Variable'][_0xde0d('0x49')]({'where':{'id':_0x427ae8[_0xde0d('0x47')]['id']}})[_0xde0d('0x24')](handleEntityNotFound(_0x426fd5,null))[_0xde0d('0x24')](removeEntity(_0x426fd5,null))['catch'](handleError(_0x426fd5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c2a7999..7bd062c 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 _0x0a17=['bluebird','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','util','../../config/logger','api','moment'];(function(_0x5f24e7,_0x11ad40){var _0x2af335=function(_0x46a711){while(--_0x46a711){_0x5f24e7['push'](_0x5f24e7['shift']());}};_0x2af335(++_0x11ad40);}(_0x0a17,0x13b));var _0x70a1=function(_0x217e45,_0x316b43){_0x217e45=_0x217e45-0x0;var _0x5da4a0=_0x0a17[_0x217e45];return _0x5da4a0;};'use strict';var _=require('lodash');var util=require(_0x70a1('0x0'));var logger=require(_0x70a1('0x1'))(_0x70a1('0x2'));var moment=require(_0x70a1('0x3'));var BPromise=require(_0x70a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70a1('0x5'));var config=require(_0x70a1('0x6'));var attributes=require(_0x70a1('0x7'));module[_0x70a1('0x8')]=function(_0x3d79da,_0x176159){return _0x3d79da[_0x70a1('0x9')](_0x70a1('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5692=['api','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','util'];(function(_0x2d8891,_0x1f22db){var _0x36305d=function(_0x3da964){while(--_0x3da964){_0x2d8891['push'](_0x2d8891['shift']());}};_0x36305d(++_0x1f22db);}(_0x5692,0x1b8));var _0x2569=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5692[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x2569('0x0'));var logger=require('../../config/logger')(_0x2569('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2569('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2569('0x3'));var config=require(_0x2569('0x4'));var attributes=require(_0x2569('0x5'));module[_0x2569('0x6')]=function(_0x1b8757,_0x1d8ee1){return _0x1b8757[_0x2569('0x7')]('Variable',attributes,{'tableName':_0x2569('0x8'),'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 74ea5b0..cc9f2b5 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x27251b,_0x3791ae){var _0x4f910d=function(_0x454cef){while(--_0x454cef){_0x27251b['push'](_0x27251b['shift']());}};_0x4f910d(++_0x3791ae);}(_0x7217,0x19e));var _0x7721=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x7217[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x1ecb71,_0x370253){var _0x402229=function(_0x25796a){while(--_0x25796a){_0x1ecb71['push'](_0x1ecb71['shift']());}};_0x402229(++_0x370253);}(_0x1cb9,0x14e));var _0x91cb=function(_0x90ca2d,_0x42fc3b){_0x90ca2d=_0x90ca2d-0x0;var _0x1f28bf=_0x1cb9[_0x90ca2d];return _0x1f28bf;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c2ef3a8..cb9f64a 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 _0xcdcf=['restart','exports','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull'];(function(_0x347696,_0x1d163b){var _0x4db464=function(_0x2751dd){while(--_0x2751dd){_0x347696['push'](_0x347696['shift']());}};_0x4db464(++_0x1d163b);}(_0xcdcf,0x9e));var _0xfcdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdcf[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xfcdc('0x0'));var controller=require(_0xfcdc('0x1'));router[_0xfcdc('0x2')]('/',controller[_0xfcdc('0x3')]);router[_0xfcdc('0x2')](_0xfcdc('0x4'),auth[_0xfcdc('0x5')](),auth[_0xfcdc('0x6')](),controller[_0xfcdc('0x7')]);router[_0xfcdc('0x2')]('/reset',auth[_0xfcdc('0x5')](),auth[_0xfcdc('0x6')](),controller[_0xfcdc('0x8')]);router['get'](_0xfcdc('0x9'),auth[_0xfcdc('0x5')](),auth[_0xfcdc('0x6')](),controller['pull']);router[_0xfcdc('0x2')]('/restart',auth[_0xfcdc('0x5')](),controller[_0xfcdc('0xa')]);router[_0xfcdc('0x2')]('/migrations',controller['migrations']);module[_0xfcdc('0xb')]=router; \ No newline at end of file +var _0xef21=['express','Router','./version.controller','get','/fetch','canUpdate','/reset','reset','/pull','isAuthenticated','/restart','restart','/migrations'];(function(_0x593b33,_0x1ea034){var _0x2f17a2=function(_0x2dbb16){while(--_0x2dbb16){_0x593b33['push'](_0x593b33['shift']());}};_0x2f17a2(++_0x1ea034);}(_0xef21,0x12b));var _0x1ef2=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xef21[_0x2faddb];return _0x273c05;};'use strict';var express=require(_0x1ef2('0x0'));var router=express[_0x1ef2('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1ef2('0x2'));router['get']('/',controller['index']);router[_0x1ef2('0x3')](_0x1ef2('0x4'),auth['isAuthenticated'](),auth[_0x1ef2('0x5')](),controller['fetch']);router[_0x1ef2('0x3')](_0x1ef2('0x6'),auth['isAuthenticated'](),auth[_0x1ef2('0x5')](),controller[_0x1ef2('0x7')]);router[_0x1ef2('0x3')](_0x1ef2('0x8'),auth[_0x1ef2('0x9')](),auth['canUpdate'](),controller['pull']);router[_0x1ef2('0x3')](_0x1ef2('0xa'),auth[_0x1ef2('0x9')](),controller[_0x1ef2('0xb')]);router['get'](_0x1ef2('0xc'),controller['migrations']);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 942810c..845d624 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 _0x8e95=['../../config/logger','update','simple-git','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','git\x20fetch','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','root','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb'];(function(_0x34433d,_0x5d71b4){var _0x43d48c=function(_0x3ef74){while(--_0x3ef74){_0x34433d['push'](_0x34433d['shift']());}};_0x43d48c(++_0x5d71b4);}(_0x8e95,0xcc));var _0x58e9=function(_0x2bda36,_0x34d740){_0x2bda36=_0x2bda36-0x0;var _0x2da47d=_0x8e95[_0x2bda36];return _0x2da47d;};'use strict';var Umzug=require('umzug');var path=require(_0x58e9('0x0'));var fs=require('fs');var _=require(_0x58e9('0x1'));var pkginfo=require(_0x58e9('0x2'))(module,_0x58e9('0x3'));var compareVersions=require(_0x58e9('0x4'));var exec=require(_0x58e9('0x5'))[_0x58e9('0x6')];var db=require(_0x58e9('0x7'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x58e9('0x8'))(_0x58e9('0x9'));var git=require(_0x58e9('0xa'))(config['root']);exports['index']=function(_0xae4cec,_0x31fd0f){var _0x12b6ef={'current':module[_0x58e9('0xb')][_0x58e9('0x3')],'phonebar':0x2};if(_0xae4cec[_0x58e9('0xc')]&&_0xae4cec[_0x58e9('0xc')][_0x58e9('0xd')]){return git[_0x58e9('0xe')]()['tags'](function(_0x41a0e4,_0x31b555){_0x12b6ef[_0x58e9('0xd')]=(_0x41a0e4?module[_0x58e9('0xb')][_0x58e9('0x3')]:_0x31b555['latest'])||_0x58e9('0xf');return _0x31fd0f['status'](0xc8)['json'](_0x12b6ef);});}else{return _0x31fd0f[_0x58e9('0x10')](0xc8)[_0x58e9('0x11')](_0x12b6ef);}};exports[_0x58e9('0xe')]=function(_0x323d91,_0x407a50){return git[_0x58e9('0xe')]([_0x58e9('0x12'),_0x58e9('0x13')],function(_0x521157){if(_0x521157){logger[_0x58e9('0x14')](_0x521157);return _0x407a50['status'](0x1f4)['json'](_0x521157);}logger['info'](_0x58e9('0x15'));return _0x407a50[_0x58e9('0x10')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x58e9('0x16')]=function(_0x2ce58b,_0x483975){return git[_0x58e9('0x16')]([_0x58e9('0x17'),'FETCH_HEAD'],function(_0x42340a){if(_0x42340a){logger[_0x58e9('0x14')](_0x42340a);return _0x483975[_0x58e9('0x10')](0x1f4)[_0x58e9('0x11')](_0x42340a);}logger[_0x58e9('0x18')](_0x58e9('0x19'));return _0x483975[_0x58e9('0x10')](0xc8)[_0x58e9('0x11')]({'output':_0x58e9('0x1a')});});};exports[_0x58e9('0x1b')]=function(_0xe20413,_0x1d9008){exec('npm\x20install\x20--production',function(_0x5bed89,_0x38240a,_0x4998ee){logger[_0x58e9('0x18')](_0x38240a);logger[_0x58e9('0x18')](_0x4998ee);if(_0x5bed89){logger['error'](_0x5bed89);return _0x1d9008[_0x58e9('0x10')](0x1f4)[_0x58e9('0x11')](_0x5bed89);}return _0x1d9008['status'](0xc8)['json']({'output':_0x38240a});});};exports['restart']=function(_0x401f25,_0x5ef20d){return pm2[_0x58e9('0x1c')](_0x58e9('0x1d'))[_0x58e9('0x1e')](function(_0x3ef4d4){logger[_0x58e9('0x18')](_0x58e9('0x1f'),_0x3ef4d4);return _0x5ef20d['status'](0xc8)[_0x58e9('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x58e9('0x20')](function(_0x3f10f7){logger[_0x58e9('0x14')](_0x3f10f7);return _0x5ef20d['status'](0x1f4)[_0x58e9('0x11')](_0x3f10f7);});};exports[_0x58e9('0x21')]=function(_0x1ee69c,_0x1c32bb){var _0x29f52f=fs[_0x58e9('0x22')](path[_0x58e9('0x23')](config[_0x58e9('0x24')],_0x58e9('0x25'),'migrations'));var _0x99e4a3=[];for(var _0x3d579b=0x0;_0x3d579b<_0x29f52f['length'];_0x3d579b++){var _0x483c86=_0x29f52f[_0x3d579b][_0x58e9('0x26')](_0x58e9('0x27'),'');if(compareVersions(module[_0x58e9('0xb')][_0x58e9('0x3')],_0x483c86)===-0x1){_0x99e4a3[_0x58e9('0x28')](_0x483c86);}}if(_0x99e4a3[_0x58e9('0x29')]){var _0x239446=_0x99e4a3[_0x58e9('0x2a')](compareVersions);var _0xe32322=new Umzug({'storage':_0x58e9('0x2b'),'storageOptions':{'model':db[_0x58e9('0x2c')],'modelName':_0x58e9('0x2c'),'columnName':_0x58e9('0x3')},'migrations':{'params':[db[_0x58e9('0x2b')][_0x58e9('0x2d')](),db[_0x58e9('0x2b')][_0x58e9('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x58e9('0x23')](config[_0x58e9('0x24')],_0x58e9('0x25'),_0x58e9('0x21')),'pattern':/\.js$/}});_0xe32322['up']({'migrations':_[_0x58e9('0x2f')](_0x239446,function(_0x2b31a4){return _0x2b31a4+'.js';})})[_0x58e9('0x1e')](function(){return _0x1c32bb['status'](0xc8)['json']({'output':_0x58e9('0x30')+module[_0x58e9('0xb')]['version']+_0x58e9('0x31')+_[_0x58e9('0x32')](_0x239446),'migrations':_['join'](_0x239446)});})['catch'](function(_0x574a0c){if(_0x574a0c instanceof db['sequelize'][_0x58e9('0x33')]){return _0x1c32bb[_0x58e9('0x10')](0xc8)[_0x58e9('0x11')]({'output':_0x58e9('0x34')});}else{return _0x1c32bb[_0x58e9('0x10')](0x1f4)[_0x58e9('0x11')](_0x574a0c);}});}else{return _0x1c32bb['status'](0xc8)[_0x58e9('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x62c3=['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','migrations','readdirSync','join','length','replace','.js','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','tags','latest','2.0.0','status','json','fetch','origin','master','error'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0x62c3,0x1c6));var _0x362c=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x62c3[_0x52666e];return _0x515330;};'use strict';var Umzug=require(_0x362c('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x362c('0x1'));var pkginfo=require(_0x362c('0x2'))(module,'version');var compareVersions=require(_0x362c('0x3'));var exec=require(_0x362c('0x4'))[_0x362c('0x5')];var db=require(_0x362c('0x6'))['db'];var config=require(_0x362c('0x7'));var pm2=require(_0x362c('0x8'));var logger=require(_0x362c('0x9'))(_0x362c('0xa'));var git=require(_0x362c('0xb'))(config[_0x362c('0xc')]);exports[_0x362c('0xd')]=function(_0x411833,_0x2396d1){var _0x2b4ff7={'current':module[_0x362c('0xe')][_0x362c('0xf')],'phonebar':0x2};if(_0x411833['query']&&_0x411833[_0x362c('0x10')]['latest']){return git['fetch']()[_0x362c('0x11')](function(_0x239678,_0x479199){_0x2b4ff7[_0x362c('0x12')]=(_0x239678?module[_0x362c('0xe')][_0x362c('0xf')]:_0x479199['latest'])||_0x362c('0x13');return _0x2396d1[_0x362c('0x14')](0xc8)['json'](_0x2b4ff7);});}else{return _0x2396d1[_0x362c('0x14')](0xc8)[_0x362c('0x15')](_0x2b4ff7);}};exports[_0x362c('0x16')]=function(_0x43ee02,_0x4b70bd){return git[_0x362c('0x16')]([_0x362c('0x17'),_0x362c('0x18')],function(_0x14dd2d){if(_0x14dd2d){logger[_0x362c('0x19')](_0x14dd2d);return _0x4b70bd['status'](0x1f4)[_0x362c('0x15')](_0x14dd2d);}logger[_0x362c('0x1a')](_0x362c('0x1b'));return _0x4b70bd[_0x362c('0x14')](0xc8)[_0x362c('0x15')]({'output':_0x362c('0x1c')});});};exports[_0x362c('0x1d')]=function(_0x4c2bef,_0xbb473c){return git[_0x362c('0x1d')]([_0x362c('0x1e'),_0x362c('0x1f')],function(_0x1be8b5){if(_0x1be8b5){logger[_0x362c('0x19')](_0x1be8b5);return _0xbb473c[_0x362c('0x14')](0x1f4)[_0x362c('0x15')](_0x1be8b5);}logger[_0x362c('0x1a')](_0x362c('0x20'));return _0xbb473c[_0x362c('0x14')](0xc8)['json']({'output':_0x362c('0x21')});});};exports[_0x362c('0x22')]=function(_0x2c0782,_0x4ad0a0){exec(_0x362c('0x23'),function(_0x1a4362,_0x411cd4,_0x5830b8){logger[_0x362c('0x1a')](_0x411cd4);logger[_0x362c('0x1a')](_0x5830b8);if(_0x1a4362){logger[_0x362c('0x19')](_0x1a4362);return _0x4ad0a0[_0x362c('0x14')](0x1f4)[_0x362c('0x15')](_0x1a4362);}return _0x4ad0a0[_0x362c('0x14')](0xc8)[_0x362c('0x15')]({'output':_0x411cd4});});};exports[_0x362c('0x24')]=function(_0x136e02,_0x17d003){return pm2['restart'](_0x362c('0x25'))[_0x362c('0x26')](function(_0x1b1f6c){logger['info'](_0x362c('0x27'),_0x1b1f6c);return _0x17d003[_0x362c('0x14')](0xc8)[_0x362c('0x15')]({'output':_0x362c('0x28')});})[_0x362c('0x29')](function(_0x21d5bc){logger[_0x362c('0x19')](_0x21d5bc);return _0x17d003[_0x362c('0x14')](0x1f4)[_0x362c('0x15')](_0x21d5bc);});};exports[_0x362c('0x2a')]=function(_0x378c2c,_0x34321c){var _0x30d72f=fs[_0x362c('0x2b')](path[_0x362c('0x2c')](config[_0x362c('0xc')],'server',_0x362c('0x2a')));var _0x44ad36=[];for(var _0x247860=0x0;_0x247860<_0x30d72f[_0x362c('0x2d')];_0x247860++){var _0xa56adb=_0x30d72f[_0x247860][_0x362c('0x2e')](_0x362c('0x2f'),'');if(compareVersions(module[_0x362c('0xe')][_0x362c('0xf')],_0xa56adb)===-0x1){_0x44ad36[_0x362c('0x30')](_0xa56adb);}}if(_0x44ad36[_0x362c('0x2d')]){var _0x24c5b5=_0x44ad36[_0x362c('0x31')](compareVersions);var _0x2a804b=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x362c('0x32')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x362c('0x33')][_0x362c('0x34')](),db[_0x362c('0x33')][_0x362c('0x35')],function(){throw new Error(_0x362c('0x36'));}],'path':path['join'](config[_0x362c('0xc')],_0x362c('0x37'),_0x362c('0x2a')),'pattern':/\.js$/}});_0x2a804b['up']({'migrations':_[_0x362c('0x38')](_0x24c5b5,function(_0x567e22){return _0x567e22+_0x362c('0x2f');})})[_0x362c('0x26')](function(){return _0x34321c['status'](0xc8)[_0x362c('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x362c('0xe')][_0x362c('0xf')]+_0x362c('0x39')+_[_0x362c('0x3a')](_0x24c5b5),'migrations':_[_0x362c('0x2c')](_0x24c5b5)});})[_0x362c('0x29')](function(_0x3dce76){if(_0x3dce76 instanceof db[_0x362c('0x33')]['UniqueConstraintError']){return _0x34321c[_0x362c('0x14')](0xc8)[_0x362c('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x34321c[_0x362c('0x14')](0x1f4)[_0x362c('0x15')](_0x3dce76);}});}else{return _0x34321c[_0x362c('0x14')](0xc8)[_0x362c('0x15')]({'output':_0x362c('0x3b')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f50bcbd..61698d3 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 _0xce63=['delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','show','post','put','update'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xce63,0xf0));var _0x3ce6=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0xce63[_0x25b24a];return _0x224e68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3ce6('0x0'));var timeout=require(_0x3ce6('0x1'));var express=require(_0x3ce6('0x2'));var router=express[_0x3ce6('0x3')]();var fs_extra=require(_0x3ce6('0x4'));var auth=require(_0x3ce6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ce6('0x6'));router[_0x3ce6('0x7')]('/',auth[_0x3ce6('0x8')](),controller['index']);router[_0x3ce6('0x7')](_0x3ce6('0x9'),auth[_0x3ce6('0x8')](),controller['describe']);router[_0x3ce6('0x7')](_0x3ce6('0xa'),auth[_0x3ce6('0x8')](),controller[_0x3ce6('0xb')]);router[_0x3ce6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3ce6('0xd')](_0x3ce6('0xa'),auth['isAuthenticated'](),controller[_0x3ce6('0xe')]);router[_0x3ce6('0xf')](_0x3ce6('0xa'),auth[_0x3ce6('0x8')](),controller['destroy']);module[_0x3ce6('0x10')]=router; \ No newline at end of file +var _0xf67d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf67d,0x122));var _0xdf67=function(_0x35ca5a,_0x2bb45e){_0x35ca5a=_0x35ca5a-0x0;var _0x76a87=_0xf67d[_0x35ca5a];return _0x76a87;};'use strict';var multer=require(_0xdf67('0x0'));var util=require('util');var path=require(_0xdf67('0x1'));var timeout=require('connect-timeout');var express=require(_0xdf67('0x2'));var router=express[_0xdf67('0x3')]();var fs_extra=require(_0xdf67('0x4'));var auth=require(_0xdf67('0x5'));var interaction=require(_0xdf67('0x6'));var config=require(_0xdf67('0x7'));var controller=require(_0xdf67('0x8'));router[_0xdf67('0x9')]('/',auth[_0xdf67('0xa')](),controller['index']);router[_0xdf67('0x9')](_0xdf67('0xb'),auth[_0xdf67('0xa')](),controller[_0xdf67('0xc')]);router[_0xdf67('0x9')](_0xdf67('0xd'),auth['isAuthenticated'](),controller[_0xdf67('0xe')]);router[_0xdf67('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdf67('0x10')](_0xdf67('0xd'),auth['isAuthenticated'](),controller[_0xdf67('0x11')]);router[_0xdf67('0x12')](_0xdf67('0xd'),auth[_0xdf67('0xa')](),controller[_0xdf67('0x13')]);module[_0xdf67('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 86684b8..f362d12 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 _0x5b12=['INTEGER','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5b12,0xa3));var _0x25b1=function(_0x589d2d,_0x2e3d09){_0x589d2d=_0x589d2d-0x0;var _0x216233=_0x5b12[_0x589d2d];return _0x216233;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'type':{'type':Sequelize[_0x25b1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x25b1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x25b1('0x2')]},'interface':{'type':Sequelize[_0x25b1('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x25b1('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x25b1('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x25b1('0x5')]},'agentacw':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x25b1('0x5')]},'reason':{'type':Sequelize[_0x25b1('0x2')]},'lastevent':{'type':Sequelize[_0x25b1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x25b1('0x5')]},'channelstatedesc':{'type':Sequelize[_0x25b1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x25b1('0x2')]},'connectedlinename':{'type':Sequelize[_0x25b1('0x2')]},'language':{'type':Sequelize[_0x25b1('0x2')]},'accountcode':{'type':Sequelize[_0x25b1('0x2')]},'context':{'type':Sequelize[_0x25b1('0x2')]},'exten':{'type':Sequelize[_0x25b1('0x2')]},'priority':{'type':Sequelize[_0x25b1('0x2')]},'destchannel':{'type':Sequelize[_0x25b1('0x2')]},'destchannelstate':{'type':Sequelize[_0x25b1('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x25b1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x25b1('0x2')]},'destcalleridname':{'type':Sequelize[_0x25b1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x25b1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x25b1('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x25b1('0x2')]},'destcontext':{'type':Sequelize[_0x25b1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x25b1('0x2')]},'destuniqueid':{'type':Sequelize[_0x25b1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x25b1('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x25b1('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x25b1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x25b1('0x2')]},'agententerreason':{'type':Sequelize[_0x25b1('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x88c3=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN'];(function(_0x1fb156,_0x140d9f){var _0x19fcc0=function(_0xe577b4){while(--_0xe577b4){_0x1fb156['push'](_0x1fb156['shift']());}};_0x19fcc0(++_0x140d9f);}(_0x88c3,0x1ee));var _0x388c=function(_0x249876,_0x10636e){_0x249876=_0x249876-0x0;var _0x5bda3d=_0x88c3[_0x249876];return _0x5bda3d;};'use strict';var Sequelize=require(_0x388c('0x0'));module['exports']={'type':{'type':Sequelize[_0x388c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x388c('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x388c('0x1')]},'agentcalledAt':{'type':Sequelize[_0x388c('0x2')]},'agentconnectAt':{'type':Sequelize[_0x388c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x388c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x388c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x388c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x388c('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x388c('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x388c('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x388c('0x4')]},'agentacw':{'type':Sequelize[_0x388c('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x388c('0x4')]},'reason':{'type':Sequelize[_0x388c('0x1')]},'lastevent':{'type':Sequelize[_0x388c('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x388c('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x388c('0x1')]},'language':{'type':Sequelize[_0x388c('0x1')]},'accountcode':{'type':Sequelize[_0x388c('0x1')]},'context':{'type':Sequelize[_0x388c('0x1')]},'exten':{'type':Sequelize[_0x388c('0x1')]},'priority':{'type':Sequelize[_0x388c('0x1')]},'destchannel':{'type':Sequelize[_0x388c('0x1')]},'destchannelstate':{'type':Sequelize[_0x388c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x388c('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x388c('0x1')]},'destlanguage':{'type':Sequelize[_0x388c('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x388c('0x1')]},'destexten':{'type':Sequelize[_0x388c('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x388c('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x388c('0x1')]},'transfer':{'type':Sequelize[_0x388c('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x388c('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x388c('0x1')]},'agententerreason':{'type':Sequelize[_0x388c('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 0d7abd3..022b959 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 930546f..288baa0 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 _0x6b8f=['exports','define','VoiceAgentReport','report_agent','util','api','request-promise','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x1e3692,_0x2318d7){var _0x41ee2d=function(_0x43735a){while(--_0x43735a){_0x1e3692['push'](_0x1e3692['shift']());}};_0x41ee2d(++_0x2318d7);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x2ec0e3,_0x4ba939){_0x2ec0e3=_0x2ec0e3-0x0;var _0x35e76d=_0x6b8f[_0x2ec0e3];return _0x35e76d;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe107=['../../config/logger','api','moment','request-promise','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash'];(function(_0x2ada12,_0x2ee00d){var _0x1234db=function(_0x5a4579){while(--_0x5a4579){_0x2ada12['push'](_0x2ada12['shift']());}};_0x1234db(++_0x2ee00d);}(_0xe107,0xb3));var _0x7e10=function(_0x2f202f,_0xcd2c97){_0x2f202f=_0x2f202f-0x0;var _0x4f53a0=_0xe107[_0x2f202f];return _0x4f53a0;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7e10('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 8544c13..b143132 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 _0x8f37=['CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8f37,0x86));var _0x78f3=function(_0x1f55f7,_0x57a9c6){_0x1f55f7=_0x1f55f7-0x0;var _0x3f31b2=_0x8f37[_0x1f55f7];return _0x3f31b2;};'use strict';var _=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var moment=require(_0x78f3('0x2'));var BPromise=require(_0x78f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x78f3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x78f3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x78f3('0x7')][_0x78f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b377e,_0x3c7db1,_0x42fc5c){return new BPromise(function(_0x5a0936,_0x3d5d5f){return client[_0x78f3('0x9')](_0x3b377e,_0x42fc5c)[_0x78f3('0xa')](function(_0x33ee35){logger[_0x78f3('0xb')](_0x78f3('0xc'),_0x3c7db1,_0x78f3('0xd'));logger[_0x78f3('0xe')](_0x78f3('0xf'),_0x3c7db1,_0x78f3('0xd'),JSON[_0x78f3('0x10')](_0x33ee35));if(_0x33ee35[_0x78f3('0x11')]){if(_0x33ee35[_0x78f3('0x11')]['code']===0x1f4){logger[_0x78f3('0x11')](_0x78f3('0xc'),_0x3c7db1,_0x33ee35[_0x78f3('0x11')][_0x78f3('0x12')]);return _0x3d5d5f(_0x33ee35['error'][_0x78f3('0x12')]);}logger['error'](_0x78f3('0xc'),_0x3c7db1,_0x33ee35[_0x78f3('0x11')][_0x78f3('0x12')]);return _0x5a0936(_0x33ee35[_0x78f3('0x11')][_0x78f3('0x12')]);}else{logger[_0x78f3('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x3c7db1,'request\x20sent');_0x5a0936(_0x33ee35[_0x78f3('0x13')][_0x78f3('0x12')]);}})[_0x78f3('0x14')](function(_0x218ec5){logger['error'](_0x78f3('0xc'),_0x3c7db1,_0x218ec5);_0x3d5d5f(_0x218ec5);});});}exports[_0x78f3('0x15')]=function(_0x2e6aeb){var _0xd8d70a=this;return new Promise(function(_0x48e2fb,_0x3d63aa){return db[_0x78f3('0x16')][_0x78f3('0x17')](_0x2e6aeb[_0x78f3('0x18')],{'raw':_0x2e6aeb[_0x78f3('0x19')]?_0x2e6aeb[_0x78f3('0x19')][_0x78f3('0x1a')]===undefined?!![]:![]:!![]})[_0x78f3('0xa')](function(_0xc4f387){logger['info'](_0x78f3('0x15'),_0x2e6aeb);logger['debug'](_0x78f3('0x15'),_0x2e6aeb,JSON[_0x78f3('0x10')](_0xc4f387));_0x48e2fb(_0xc4f387);})['catch'](function(_0xcb62e5){logger[_0x78f3('0x11')](_0x78f3('0x15'),_0xcb62e5[_0x78f3('0x12')],_0x2e6aeb);_0x3d63aa(_0xd8d70a['error'](0x1f4,_0xcb62e5[_0x78f3('0x12')]));});});};exports[_0x78f3('0x1b')]=function(_0xdf98cf){var _0x31cc81=this;return new Promise(function(_0xeb3a32,_0x2bf5a5){return db['VoiceAgentReport']['update'](_0xdf98cf['body'],{'raw':_0xdf98cf['options']?_0xdf98cf[_0x78f3('0x19')][_0x78f3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdf98cf[_0x78f3('0x19')]?_0xdf98cf[_0x78f3('0x19')][_0x78f3('0x1c')]||null:null,'attributes':_0xdf98cf['options']?_0xdf98cf[_0x78f3('0x19')][_0x78f3('0x1d')]||null:null,'limit':_0xdf98cf[_0x78f3('0x19')]?_0xdf98cf[_0x78f3('0x19')][_0x78f3('0x1e')]||null:null})[_0x78f3('0xa')](function(_0x411971){logger[_0x78f3('0xb')](_0x78f3('0x1b'),_0xdf98cf);logger['debug']('UpdateVoiceAgentReport',_0xdf98cf,JSON[_0x78f3('0x10')](_0x411971));_0xeb3a32(_0x411971);})[_0x78f3('0x14')](function(_0x3832e8){logger[_0x78f3('0x11')](_0x78f3('0x1b'),_0x3832e8[_0x78f3('0x12')],_0xdf98cf);_0x2bf5a5(_0x31cc81[_0x78f3('0x11')](0x1f4,_0x3832e8[_0x78f3('0x12')]));});});}; \ No newline at end of file +var _0x26e3=['catch','CreateVoiceAgentReport','options','UpdateVoiceAgentReport','VoiceAgentReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x18eb35,_0x266e44){var _0x123b1e=function(_0x32d78b){while(--_0x32d78b){_0x18eb35['push'](_0x18eb35['shift']());}};_0x123b1e(++_0x266e44);}(_0x26e3,0x1a3));var _0x326e=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x26e3[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0x326e('0x0'));var util=require(_0x326e('0x1'));var moment=require(_0x326e('0x2'));var BPromise=require(_0x326e('0x3'));var rs=require(_0x326e('0x4'));var fs=require('fs');var Redis=require(_0x326e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x326e('0x6'));var logger=require(_0x326e('0x7'))('rpc');var config=require(_0x326e('0x8'));var jayson=require(_0x326e('0x9'));var client=jayson[_0x326e('0xa')][_0x326e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fc529,_0x376df2,_0x220a75){return new BPromise(function(_0x9208cf,_0x27fad8){return client[_0x326e('0xc')](_0x3fc529,_0x220a75)[_0x326e('0xd')](function(_0x44c216){logger['info'](_0x326e('0xe'),_0x376df2,_0x326e('0xf'));logger[_0x326e('0x10')](_0x326e('0x11'),_0x376df2,_0x326e('0xf'),JSON[_0x326e('0x12')](_0x44c216));if(_0x44c216[_0x326e('0x13')]){if(_0x44c216[_0x326e('0x13')][_0x326e('0x14')]===0x1f4){logger['error'](_0x326e('0xe'),_0x376df2,_0x44c216['error']['message']);return _0x27fad8(_0x44c216['error'][_0x326e('0x15')]);}logger[_0x326e('0x13')](_0x326e('0xe'),_0x376df2,_0x44c216[_0x326e('0x13')][_0x326e('0x15')]);return _0x9208cf(_0x44c216['error']['message']);}else{logger[_0x326e('0x16')](_0x326e('0xe'),_0x376df2,_0x326e('0xf'));_0x9208cf(_0x44c216['result'][_0x326e('0x15')]);}})[_0x326e('0x17')](function(_0x497328){logger[_0x326e('0x13')](_0x326e('0xe'),_0x376df2,_0x497328);_0x27fad8(_0x497328);});});}exports[_0x326e('0x18')]=function(_0xb21189){var _0x346a9a=this;return new Promise(function(_0xb70073,_0x116fae){return db['VoiceAgentReport']['create'](_0xb21189['body'],{'raw':_0xb21189[_0x326e('0x19')]?_0xb21189['options']['raw']===undefined?!![]:![]:!![]})[_0x326e('0xd')](function(_0x5535a4){logger[_0x326e('0x16')](_0x326e('0x18'),_0xb21189);logger[_0x326e('0x10')](_0x326e('0x18'),_0xb21189,JSON[_0x326e('0x12')](_0x5535a4));_0xb70073(_0x5535a4);})[_0x326e('0x17')](function(_0x4f6e1e){logger[_0x326e('0x13')]('CreateVoiceAgentReport',_0x4f6e1e[_0x326e('0x15')],_0xb21189);_0x116fae(_0x346a9a[_0x326e('0x13')](0x1f4,_0x4f6e1e[_0x326e('0x15')]));});});};exports[_0x326e('0x1a')]=function(_0x37fd90){var _0x8de520=this;return new Promise(function(_0x30d578,_0x3347f8){return db[_0x326e('0x1b')][_0x326e('0x1c')](_0x37fd90[_0x326e('0x1d')],{'raw':_0x37fd90['options']?_0x37fd90[_0x326e('0x19')][_0x326e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37fd90[_0x326e('0x19')]?_0x37fd90[_0x326e('0x19')][_0x326e('0x1f')]||null:null,'attributes':_0x37fd90['options']?_0x37fd90['options'][_0x326e('0x20')]||null:null,'limit':_0x37fd90[_0x326e('0x19')]?_0x37fd90[_0x326e('0x19')][_0x326e('0x21')]||null:null})['then'](function(_0x28fdd3){logger['info'](_0x326e('0x1a'),_0x37fd90);logger[_0x326e('0x10')](_0x326e('0x1a'),_0x37fd90,JSON[_0x326e('0x12')](_0x28fdd3));_0x30d578(_0x28fdd3);})['catch'](function(_0x5cbe82){logger[_0x326e('0x13')]('UpdateVoiceAgentReport',_0x5cbe82['message'],_0x37fd90);_0x3347f8(_0x8de520['error'](0x1f4,_0x5cbe82[_0x326e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a15fcc2..cced769 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 _0xca9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0xca9e,0x136));var _0xeca9=function(_0x44749a,_0x20b318){_0x44749a=_0x44749a-0x0;var _0x14d061=_0xca9e[_0x44749a];return _0x14d061;};'use strict';var multer=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var path=require(_0xeca9('0x2'));var timeout=require(_0xeca9('0x3'));var express=require(_0xeca9('0x4'));var router=express[_0xeca9('0x5')]();var fs_extra=require(_0xeca9('0x6'));var auth=require(_0xeca9('0x7'));var interaction=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var controller=require(_0xeca9('0xa'));router[_0xeca9('0xb')]('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0xd')]);router['get'](_0xeca9('0xe'),auth[_0xeca9('0xc')](),controller['describe']);router['get'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x10')]);router['post']('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0x11')]);router[_0xeca9('0x12')](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x13')]);router['delete'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller['destroy']);module[_0xeca9('0x14')]=router; \ No newline at end of file +var _0x9b67=['../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x14d86f,_0x2d6c0f){var _0x4dd27b=function(_0x1a1645){while(--_0x1a1645){_0x14d86f['push'](_0x14d86f['shift']());}};_0x4dd27b(++_0x2d6c0f);}(_0x9b67,0xf6));var _0x79b6=function(_0x3976c3,_0x593b9b){_0x3976c3=_0x3976c3-0x0;var _0x566295=_0x9b67[_0x3976c3];return _0x566295;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['describe']);router[_0x79b6('0x8')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xe')]('/',auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller['update']);router['delete'](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x11')]);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 959fbb4..56535fb 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 _0xd5eb=['TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd5eb,0x183));var _0xbd5e=function(_0x5013f2,_0x3d896b){_0x5013f2=_0x5013f2-0x0;var _0x166b9f=_0xd5eb[_0x5013f2];return _0x166b9f;};'use strict';var Sequelize=require(_0xbd5e('0x0'));module[_0xbd5e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbd5e('0x2')](_0xbd5e('0x3'),_0xbd5e('0x4'),_0xbd5e('0x5'),_0xbd5e('0x6'),_0xbd5e('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xbd5e('0x8')]},'destination':{'type':Sequelize[_0xbd5e('0x8')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xbd5e('0x8')]},'channel':{'type':Sequelize[_0xbd5e('0x8')]},'destinationchannel':{'type':Sequelize[_0xbd5e('0x8')]},'lastapplication':{'type':Sequelize[_0xbd5e('0x8')]},'lastdata':{'type':Sequelize[_0xbd5e('0x9')]},'starttime':{'type':Sequelize[_0xbd5e('0xa')]},'systemanswertime':{'type':Sequelize[_0xbd5e('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbd5e('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xbd5e('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbd5e('0x8')]},'amaflags':{'type':Sequelize[_0xbd5e('0x8')]},'userfield':{'type':Sequelize[_0xbd5e('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xbd5e('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xbd5e('0x8')]},'note':{'type':Sequelize[_0xbd5e('0x8')]},'prefix':{'type':Sequelize[_0xbd5e('0x8')]},'routeid':{'type':Sequelize[_0xbd5e('0xb')]},'sipcallid':{'type':Sequelize[_0xbd5e('0x8')]}}; \ No newline at end of file +var _0x70f0=['STRING','ENUM','inbound','internal','outbound','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x1ca8dd,_0x2b2f46){var _0x26e5bf=function(_0x94e68c){while(--_0x94e68c){_0x1ca8dd['push'](_0x1ca8dd['shift']());}};_0x26e5bf(++_0x2b2f46);}(_0x70f0,0x80));var _0x070f=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x70f0[_0x1139d0];return _0xcc01a6;};'use strict';var Sequelize=require(_0x070f('0x0'));module[_0x070f('0x1')]={'uniqueid':{'type':Sequelize[_0x070f('0x2')]},'type':{'type':Sequelize[_0x070f('0x3')](_0x070f('0x4'),_0x070f('0x5'),_0x070f('0x6'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0x070f('0x2')]},'accountcode':{'type':Sequelize[_0x070f('0x2')]},'source':{'type':Sequelize[_0x070f('0x2')]},'destination':{'type':Sequelize[_0x070f('0x2')]},'destinationcontext':{'type':Sequelize[_0x070f('0x2')]},'callerid':{'type':Sequelize[_0x070f('0x2')]},'channel':{'type':Sequelize[_0x070f('0x2')]},'destinationchannel':{'type':Sequelize[_0x070f('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x070f('0x7')]},'starttime':{'type':Sequelize[_0x070f('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x070f('0x8')]},'endtime':{'type':Sequelize[_0x070f('0x8')]},'duration':{'type':Sequelize[_0x070f('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x070f('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x070f('0x2')]},'amaflags':{'type':Sequelize[_0x070f('0x2')]},'userfield':{'type':Sequelize[_0x070f('0x2')]},'userDisposition':{'type':Sequelize[_0x070f('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x070f('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x070f('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x070f('0x2')]},'routeid':{'type':Sequelize[_0x070f('0x9')]},'sipcallid':{'type':Sequelize[_0x070f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ac0399c..20bfa9c 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x28e821,_0x3fb99e){_0x28e821=_0x28e821-0x0;var _0x18e622=_0x2032[_0x28e821];return _0x18e622;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x46aa30,_0x284c93){_0x46aa30=_0x46aa30-0x0;var _0x409044=_0x2032[_0x46aa30];return _0x409044;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 220efca..ff499e3 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 _0x62ca=['moment','request-promise','path','rimraf','./voiceCallReport.attributes','exports','VoiceCallReport','report_call','lodash'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x62ca,0x179));var _0xa62c=function(_0x315820,_0x38ad23){_0x315820=_0x315820-0x0;var _0x4601ea=_0x62ca[_0x315820];return _0x4601ea;};'use strict';var _=require(_0xa62c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa62c('0x1'));var BPromise=require('bluebird');var rp=require(_0xa62c('0x2'));var fs=require('fs');var path=require(_0xa62c('0x3'));var rimraf=require(_0xa62c('0x4'));var config=require('../../config/environment');var attributes=require(_0xa62c('0x5'));module[_0xa62c('0x6')]=function(_0x586113,_0x2e805b){return _0x586113['define'](_0xa62c('0x7'),attributes,{'tableName':_0xa62c('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2be0=['api','moment','request-promise','path','rimraf','./voiceCallReport.attributes','exports','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x2be0,0x128));var _0x02be=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x2be0[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x02be('0x0'));var util=require(_0x02be('0x1'));var logger=require(_0x02be('0x2'))(_0x02be('0x3'));var moment=require(_0x02be('0x4'));var BPromise=require('bluebird');var rp=require(_0x02be('0x5'));var fs=require('fs');var path=require(_0x02be('0x6'));var rimraf=require(_0x02be('0x7'));var config=require('../../config/environment');var attributes=require(_0x02be('0x8'));module[_0x02be('0x9')]=function(_0x46392d,_0x184bf6){return _0x46392d['define'](_0x02be('0xa'),attributes,{'tableName':_0x02be('0xb'),'paranoid':![],'indexes':[{'fields':[_0x02be('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a0476b3..81f5bb0 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 _0x9f43=['GetVoiceCallReport','stringify','CreateVoiceCallReport','UpdateVoiceCallReport','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','VoiceCallReport','options','raw','where','include','map','attributes','model'];(function(_0x2c8afe,_0x100f80){var _0x982977=function(_0x5b3a44){while(--_0x5b3a44){_0x2c8afe['push'](_0x2c8afe['shift']());}};_0x982977(++_0x100f80);}(_0x9f43,0x1ef));var _0x39f4=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x9f43[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0x39f4('0x0'));var util=require(_0x39f4('0x1'));var moment=require(_0x39f4('0x2'));var BPromise=require(_0x39f4('0x3'));var rs=require(_0x39f4('0x4'));var fs=require('fs');var Redis=require(_0x39f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x39f4('0x6'));var logger=require(_0x39f4('0x7'))(_0x39f4('0x8'));var config=require('../../config/environment');var jayson=require(_0x39f4('0x9'));var client=jayson['client'][_0x39f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48e8df,_0x4c86c1,_0x40f33c){return new BPromise(function(_0x2649c2,_0xe44867){return client[_0x39f4('0xb')](_0x48e8df,_0x40f33c)[_0x39f4('0xc')](function(_0x114a1b){logger['info'](_0x39f4('0xd'),_0x4c86c1,'request\x20sent');logger[_0x39f4('0xe')](_0x39f4('0xf'),_0x4c86c1,_0x39f4('0x10'),JSON['stringify'](_0x114a1b));if(_0x114a1b['error']){if(_0x114a1b[_0x39f4('0x11')]['code']===0x1f4){logger[_0x39f4('0x11')](_0x39f4('0xd'),_0x4c86c1,_0x114a1b[_0x39f4('0x11')][_0x39f4('0x12')]);return _0xe44867(_0x114a1b['error']['message']);}logger[_0x39f4('0x11')](_0x39f4('0xd'),_0x4c86c1,_0x114a1b['error'][_0x39f4('0x12')]);return _0x2649c2(_0x114a1b[_0x39f4('0x11')][_0x39f4('0x12')]);}else{logger[_0x39f4('0x13')](_0x39f4('0xd'),_0x4c86c1,'request\x20sent');_0x2649c2(_0x114a1b[_0x39f4('0x14')][_0x39f4('0x12')]);}})[_0x39f4('0x15')](function(_0x3ef2de){logger[_0x39f4('0x11')](_0x39f4('0xd'),_0x4c86c1,_0x3ef2de);_0xe44867(_0x3ef2de);});});}exports['GetVoiceCallReport']=function(_0x267a37){var _0x2be6e3=this;return new Promise(function(_0x147a75,_0x51d450){return db[_0x39f4('0x16')]['findAll']({'raw':_0x267a37[_0x39f4('0x17')]?_0x267a37['options'][_0x39f4('0x18')]===undefined?!![]:![]:!![],'where':_0x267a37[_0x39f4('0x17')]?_0x267a37[_0x39f4('0x17')][_0x39f4('0x19')]||null:null,'attributes':_0x267a37[_0x39f4('0x17')]?_0x267a37[_0x39f4('0x17')]['attributes']||null:null,'limit':_0x267a37['options']?_0x267a37[_0x39f4('0x17')]['limit']||null:null,'include':_0x267a37[_0x39f4('0x17')]?_0x267a37[_0x39f4('0x17')][_0x39f4('0x1a')]?_[_0x39f4('0x1b')](_0x267a37[_0x39f4('0x17')][_0x39f4('0x1a')],function(_0x1ed3a4){return{'model':db[_0x1ed3a4['model']],'as':_0x1ed3a4['as'],'attributes':_0x1ed3a4[_0x39f4('0x1c')],'include':_0x1ed3a4[_0x39f4('0x1a')]?_[_0x39f4('0x1b')](_0x1ed3a4[_0x39f4('0x1a')],function(_0x4fb446){return{'model':db[_0x4fb446['model']],'as':_0x4fb446['as'],'attributes':_0x4fb446[_0x39f4('0x1c')],'include':_0x4fb446[_0x39f4('0x1a')]?_[_0x39f4('0x1b')](_0x4fb446[_0x39f4('0x1a')],function(_0x2ad887){return{'model':db[_0x2ad887[_0x39f4('0x1d')]],'as':_0x2ad887['as'],'attributes':_0x2ad887['attributes']};}):[]};}):[]};}):[]:[]})[_0x39f4('0xc')](function(_0x5a93c2){logger[_0x39f4('0x13')](_0x39f4('0x1e'),_0x267a37);logger['debug']('GetVoiceCallReport',_0x267a37,JSON[_0x39f4('0x1f')](_0x5a93c2));_0x147a75(_0x5a93c2);})[_0x39f4('0x15')](function(_0x36e62f){logger[_0x39f4('0x11')](_0x39f4('0x1e'),_0x36e62f[_0x39f4('0x12')],_0x267a37);_0x51d450(_0x2be6e3[_0x39f4('0x11')](0x1f4,_0x36e62f['message']));});});};exports[_0x39f4('0x20')]=function(_0x5f4900){var _0x303a51=this;return new Promise(function(_0x2109cc,_0xceae9c){return db['VoiceCallReport']['create'](_0x5f4900['body'],{'raw':_0x5f4900[_0x39f4('0x17')]?_0x5f4900[_0x39f4('0x17')][_0x39f4('0x18')]===undefined?!![]:![]:!![]})[_0x39f4('0xc')](function(_0x2e0baf){logger[_0x39f4('0x13')](_0x39f4('0x20'),_0x5f4900);logger[_0x39f4('0xe')](_0x39f4('0x20'),_0x5f4900,JSON[_0x39f4('0x1f')](_0x2e0baf));_0x2109cc(_0x2e0baf);})[_0x39f4('0x15')](function(_0x5a7e03){logger['error'](_0x39f4('0x20'),_0x5a7e03[_0x39f4('0x12')],_0x5f4900);_0xceae9c(_0x303a51[_0x39f4('0x11')](0x1f4,_0x5a7e03[_0x39f4('0x12')]));});});};exports[_0x39f4('0x21')]=function(_0x4f1ffd){var _0x1a5b8e=this;return new Promise(function(_0x18ed38,_0x126464){return db['VoiceCallReport']['update'](_0x4f1ffd['body'],{'raw':_0x4f1ffd[_0x39f4('0x17')]?_0x4f1ffd['options'][_0x39f4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f1ffd[_0x39f4('0x17')]?_0x4f1ffd[_0x39f4('0x17')][_0x39f4('0x19')]||null:null,'attributes':_0x4f1ffd[_0x39f4('0x17')]?_0x4f1ffd[_0x39f4('0x17')][_0x39f4('0x1c')]||null:null,'limit':_0x4f1ffd[_0x39f4('0x17')]?_0x4f1ffd[_0x39f4('0x17')][_0x39f4('0x22')]||null:null})[_0x39f4('0xc')](function(_0x5defa7){logger[_0x39f4('0x13')](_0x39f4('0x21'),_0x4f1ffd);logger[_0x39f4('0xe')](_0x39f4('0x21'),_0x4f1ffd,JSON[_0x39f4('0x1f')](_0x5defa7));_0x18ed38(_0x5defa7);})[_0x39f4('0x15')](function(_0x3eb355){logger[_0x39f4('0x11')](_0x39f4('0x21'),_0x3eb355[_0x39f4('0x12')],_0x4f1ffd);_0x126464(_0x1a5b8e[_0x39f4('0x11')](0x1f4,_0x3eb355['message']));});});}; \ No newline at end of file +var _0x377c=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','attributes','map','include','model','create','body','raw','CreateVoiceCallReport','debug','update','where','limit','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x4cebba,_0x53404b){var _0x5f2ff4=function(_0x47124f){while(--_0x47124f){_0x4cebba['push'](_0x4cebba['shift']());}};_0x5f2ff4(++_0x53404b);}(_0x377c,0xb0));var _0xc377=function(_0x1c6667,_0x568ae2){_0x1c6667=_0x1c6667-0x0;var _0x2e76d8=_0x377c[_0x1c6667];return _0x2e76d8;};'use strict';var _=require(_0xc377('0x0'));var util=require(_0xc377('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc377('0x2'));var fs=require('fs');var Redis=require(_0xc377('0x3'));var db=require(_0xc377('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc377('0x5'))(_0xc377('0x6'));var config=require(_0xc377('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc377('0x8')][_0xc377('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf4034f,_0x242854,_0x219e0f){return new BPromise(function(_0x42a04c,_0x48f2f4){return client[_0xc377('0xa')](_0xf4034f,_0x219e0f)[_0xc377('0xb')](function(_0x3dc5bf){logger[_0xc377('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x242854,_0xc377('0xd'));logger['debug'](_0xc377('0xe'),_0x242854,_0xc377('0xd'),JSON[_0xc377('0xf')](_0x3dc5bf));if(_0x3dc5bf['error']){if(_0x3dc5bf['error'][_0xc377('0x10')]===0x1f4){logger[_0xc377('0x11')](_0xc377('0x12'),_0x242854,_0x3dc5bf['error']['message']);return _0x48f2f4(_0x3dc5bf[_0xc377('0x11')][_0xc377('0x13')]);}logger[_0xc377('0x11')](_0xc377('0x12'),_0x242854,_0x3dc5bf[_0xc377('0x11')]['message']);return _0x42a04c(_0x3dc5bf[_0xc377('0x11')][_0xc377('0x13')]);}else{logger['info'](_0xc377('0x12'),_0x242854,_0xc377('0xd'));_0x42a04c(_0x3dc5bf[_0xc377('0x14')]['message']);}})[_0xc377('0x15')](function(_0x48b69f){logger[_0xc377('0x11')](_0xc377('0x12'),_0x242854,_0x48b69f);_0x48f2f4(_0x48b69f);});});}exports[_0xc377('0x16')]=function(_0x2ab42b){var _0x344674=this;return new Promise(function(_0x1ab884,_0x5d4530){return db[_0xc377('0x17')]['findAll']({'raw':_0x2ab42b[_0xc377('0x18')]?_0x2ab42b[_0xc377('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ab42b[_0xc377('0x18')]?_0x2ab42b[_0xc377('0x18')]['where']||null:null,'attributes':_0x2ab42b['options']?_0x2ab42b['options'][_0xc377('0x19')]||null:null,'limit':_0x2ab42b[_0xc377('0x18')]?_0x2ab42b['options']['limit']||null:null,'include':_0x2ab42b[_0xc377('0x18')]?_0x2ab42b[_0xc377('0x18')]['include']?_[_0xc377('0x1a')](_0x2ab42b[_0xc377('0x18')][_0xc377('0x1b')],function(_0x224616){return{'model':db[_0x224616[_0xc377('0x1c')]],'as':_0x224616['as'],'attributes':_0x224616[_0xc377('0x19')],'include':_0x224616[_0xc377('0x1b')]?_[_0xc377('0x1a')](_0x224616['include'],function(_0x33c25f){return{'model':db[_0x33c25f[_0xc377('0x1c')]],'as':_0x33c25f['as'],'attributes':_0x33c25f['attributes'],'include':_0x33c25f['include']?_[_0xc377('0x1a')](_0x33c25f[_0xc377('0x1b')],function(_0x40f22a){return{'model':db[_0x40f22a[_0xc377('0x1c')]],'as':_0x40f22a['as'],'attributes':_0x40f22a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc377('0xb')](function(_0x71acc5){logger['info'](_0xc377('0x16'),_0x2ab42b);logger['debug'](_0xc377('0x16'),_0x2ab42b,JSON[_0xc377('0xf')](_0x71acc5));_0x1ab884(_0x71acc5);})[_0xc377('0x15')](function(_0x554cc9){logger[_0xc377('0x11')](_0xc377('0x16'),_0x554cc9['message'],_0x2ab42b);_0x5d4530(_0x344674[_0xc377('0x11')](0x1f4,_0x554cc9['message']));});});};exports['CreateVoiceCallReport']=function(_0xc7d687){var _0x2aeab6=this;return new Promise(function(_0x5c50ed,_0x4d3ea1){return db['VoiceCallReport'][_0xc377('0x1d')](_0xc7d687[_0xc377('0x1e')],{'raw':_0xc7d687['options']?_0xc7d687['options'][_0xc377('0x1f')]===undefined?!![]:![]:!![]})[_0xc377('0xb')](function(_0x2ae2d6){logger[_0xc377('0xc')](_0xc377('0x20'),_0xc7d687);logger[_0xc377('0x21')](_0xc377('0x20'),_0xc7d687,JSON[_0xc377('0xf')](_0x2ae2d6));_0x5c50ed(_0x2ae2d6);})['catch'](function(_0x8185cc){logger[_0xc377('0x11')](_0xc377('0x20'),_0x8185cc['message'],_0xc7d687);_0x4d3ea1(_0x2aeab6[_0xc377('0x11')](0x1f4,_0x8185cc[_0xc377('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x334e7d){var _0x2376bb=this;return new Promise(function(_0x509f38,_0x9cfa6c){return db[_0xc377('0x17')][_0xc377('0x22')](_0x334e7d[_0xc377('0x1e')],{'raw':_0x334e7d['options']?_0x334e7d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x334e7d['options']?_0x334e7d[_0xc377('0x18')][_0xc377('0x23')]||null:null,'attributes':_0x334e7d[_0xc377('0x18')]?_0x334e7d[_0xc377('0x18')][_0xc377('0x19')]||null:null,'limit':_0x334e7d[_0xc377('0x18')]?_0x334e7d[_0xc377('0x18')][_0xc377('0x24')]||null:null})[_0xc377('0xb')](function(_0x12665e){logger[_0xc377('0xc')]('UpdateVoiceCallReport',_0x334e7d);logger[_0xc377('0x21')]('UpdateVoiceCallReport',_0x334e7d,JSON[_0xc377('0xf')](_0x12665e));_0x509f38(_0x12665e);})[_0xc377('0x15')](function(_0x4b55b1){logger[_0xc377('0x11')](_0xc377('0x25'),_0x4b55b1['message'],_0x334e7d);_0x9cfa6c(_0x2376bb[_0xc377('0x11')](0x1f4,_0x4b55b1[_0xc377('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 37ea1ef..5801a34 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 _0xa2c4=['put','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','./voiceChanSpy.controller','get','isAuthenticated','index','post','create'];(function(_0xd042d1,_0x40dc09){var _0x4b5fae=function(_0x2821f0){while(--_0x2821f0){_0xd042d1['push'](_0xd042d1['shift']());}};_0x4b5fae(++_0x40dc09);}(_0xa2c4,0x14d));var _0x4a2c=function(_0x3d2b22,_0x1f571d){_0x3d2b22=_0x3d2b22-0x0;var _0x3805dc=_0xa2c4[_0x3d2b22];return _0x3805dc;};'use strict';var multer=require(_0x4a2c('0x0'));var util=require(_0x4a2c('0x1'));var path=require('path');var timeout=require(_0x4a2c('0x2'));var express=require(_0x4a2c('0x3'));var router=express[_0x4a2c('0x4')]();var fs_extra=require(_0x4a2c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a2c('0x6'));router[_0x4a2c('0x7')]('/',auth[_0x4a2c('0x8')](),controller[_0x4a2c('0x9')]);router[_0x4a2c('0x7')]('/:id',auth[_0x4a2c('0x8')](),controller['show']);router[_0x4a2c('0xa')]('/',auth[_0x4a2c('0x8')](),controller[_0x4a2c('0xb')]);router[_0x4a2c('0xc')](_0x4a2c('0xd'),auth[_0x4a2c('0x8')](),controller['update']);router['delete'](_0x4a2c('0xd'),auth[_0x4a2c('0x8')](),controller[_0x4a2c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x001b=['isAuthenticated','index','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x001b,0x118));var _0xb001=function(_0x3f7dd0,_0x37dd45){_0x3f7dd0=_0x3f7dd0-0x0;var _0x4dc3d0=_0x001b[_0x3f7dd0];return _0x4dc3d0;};'use strict';var multer=require(_0xb001('0x0'));var util=require(_0xb001('0x1'));var path=require(_0xb001('0x2'));var timeout=require('connect-timeout');var express=require(_0xb001('0x3'));var router=express['Router']();var fs_extra=require(_0xb001('0x4'));var auth=require(_0xb001('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb001('0x6'));var controller=require(_0xb001('0x7'));router[_0xb001('0x8')]('/',auth[_0xb001('0x9')](),controller[_0xb001('0xa')]);router[_0xb001('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb001('0xb')]('/',auth[_0xb001('0x9')](),controller[_0xb001('0xc')]);router[_0xb001('0xd')]('/:id',auth[_0xb001('0x9')](),controller[_0xb001('0xe')]);router[_0xb001('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb001('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 31876d2..7445537 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 _0xe193=['BOOLEAN','STRING','name','setDataValue','options','getDataValue','split'];(function(_0x103a45,_0x2aaab4){var _0x4a1155=function(_0x1f360e){while(--_0x1f360e){_0x103a45['push'](_0x103a45['shift']());}};_0x4a1155(++_0x2aaab4);}(_0xe193,0x158));var _0x3e19=function(_0x1ed6bd,_0x19d8e1){_0x1ed6bd=_0x1ed6bd-0x0;var _0xa428cc=_0xe193[_0x1ed6bd];return _0xa428cc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x3e19('0x0')],'unique':_0x3e19('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x3e19('0x0')],'set':function(_0x595053){this[_0x3e19('0x2')](_0x3e19('0x3'),_0x595053?_0x595053['join'](''):[]);},'get':function(){return this[_0x3e19('0x4')](_0x3e19('0x3'))?this[_0x3e19('0x4')](_0x3e19('0x3'))[_0x3e19('0x5')](''):[];}},'auth':{'type':Sequelize[_0x3e19('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x3e19('0x0')]},'record':{'type':Sequelize[_0x3e19('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3e19('0x0')]},'description':{'type':Sequelize[_0x3e19('0x0')]}}; \ No newline at end of file +var _0xcb66=['options','getDataValue','BOOLEAN','exports','STRING','setDataValue'];(function(_0x3600c9,_0x40d72e){var _0x34ac75=function(_0x4fec19){while(--_0x4fec19){_0x3600c9['push'](_0x3600c9['shift']());}};_0x34ac75(++_0x40d72e);}(_0xcb66,0x111));var _0x6cb6=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xcb66[_0x49052b];return _0x48c045;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'name':{'type':Sequelize[_0x6cb6('0x1')]},'prefix':{'type':Sequelize[_0x6cb6('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x6cb6('0x1')],'set':function(_0x4fd0e0){this[_0x6cb6('0x2')]('options',_0x4fd0e0?_0x4fd0e0['join'](''):[]);},'get':function(){return this['getDataValue'](_0x6cb6('0x3'))?this[_0x6cb6('0x4')](_0x6cb6('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0x6cb6('0x5')],'defaultValue':![]},'password':{'type':Sequelize[_0x6cb6('0x1')]},'record':{'type':Sequelize[_0x6cb6('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6cb6('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7cf9187..799cb82 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 _0xcf14=['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','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','findAll','rows','catch','params','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x19b980,_0x40c574){var _0x320fd8=function(_0x58f323){while(--_0x58f323){_0x19b980['push'](_0x19b980['shift']());}};_0x320fd8(++_0x40c574);}(_0xcf14,0xa1));var _0x4cf1=function(_0x3f0882,_0x541af3){_0x3f0882=_0x3f0882-0x0;var _0x15bb8b=_0xcf14[_0x3f0882];return _0x15bb8b;};'use strict';var emlformat=require(_0x4cf1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cf1('0x1'));var jsonpatch=require(_0x4cf1('0x2'));var rp=require('request-promise');var moment=require(_0x4cf1('0x3'));var BPromise=require(_0x4cf1('0x4'));var Mustache=require(_0x4cf1('0x5'));var util=require(_0x4cf1('0x6'));var path=require('path');var sox=require(_0x4cf1('0x7'));var csv=require(_0x4cf1('0x8'));var ejs=require(_0x4cf1('0x9'));var fs=require('fs');var fs_extra=require(_0x4cf1('0xa'));var _=require(_0x4cf1('0xb'));var squel=require(_0x4cf1('0xc'));var crypto=require(_0x4cf1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4cf1('0xe'));var toCsv=require(_0x4cf1('0x8'));var querystring=require(_0x4cf1('0xf'));var Papa=require(_0x4cf1('0x10'));var Redis=require(_0x4cf1('0x11'));var authService=require(_0x4cf1('0x12'));var qs=require(_0x4cf1('0x13'));var as=require(_0x4cf1('0x14'));var hardwareService=require(_0x4cf1('0x15'));var logger=require(_0x4cf1('0x16'))(_0x4cf1('0x17'));var utils=require(_0x4cf1('0x18'));var config=require(_0x4cf1('0x19'));var licenseUtil=require(_0x4cf1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cee57,_0x5622dc){_0x5622dc=_0x5622dc||0xcc;return function(_0x1ae8fb){if(_0x1ae8fb){return _0x3cee57[_0x4cf1('0x1b')](_0x5622dc);}return _0x3cee57[_0x4cf1('0x1c')](_0x5622dc)[_0x4cf1('0x1d')]();};}function respondWithResult(_0x10abde,_0x3f365c){_0x3f365c=_0x3f365c||0xc8;return function(_0x25f091){if(_0x25f091){return _0x10abde[_0x4cf1('0x1c')](_0x3f365c)[_0x4cf1('0x1e')](_0x25f091);}};}function respondWithFilteredResult(_0xec2510,_0xcfa115){return function(_0x2a8cf7){if(_0x2a8cf7){var _0xe257a5=typeof _0xcfa115['offset']===_0x4cf1('0x1f')&&typeof _0xcfa115['limit']===_0x4cf1('0x1f');var _0x3c485a=_0x2a8cf7[_0x4cf1('0x20')];var _0x1f20c0=_0xe257a5?0x0:_0xcfa115[_0x4cf1('0x21')];var _0x48d35a=_0xe257a5?_0x2a8cf7[_0x4cf1('0x20')]:_0xcfa115[_0x4cf1('0x21')]+_0xcfa115[_0x4cf1('0x22')];var _0x4557e0;if(_0x48d35a>=_0x3c485a){_0x48d35a=_0x3c485a;_0x4557e0=0xc8;}else{_0x4557e0=0xce;}_0xec2510['status'](_0x4557e0);return _0xec2510['set'](_0x4cf1('0x23'),_0x1f20c0+'-'+_0x48d35a+'/'+_0x3c485a)[_0x4cf1('0x1e')](_0x2a8cf7);}return null;};}function patchUpdates(_0x5603ae){return function(_0x85885a){try{jsonpatch[_0x4cf1('0x24')](_0x85885a,_0x5603ae,!![]);}catch(_0x3cc036){return BPromise[_0x4cf1('0x25')](_0x3cc036);}return _0x85885a['save']();};}function saveUpdates(_0x3469ac,_0x158000){return function(_0x2338c3){if(_0x2338c3){return _0x2338c3[_0x4cf1('0x26')](_0x3469ac)[_0x4cf1('0x27')](function(_0x2945b4){return _0x2945b4;});}return null;};}function removeEntity(_0x4f14a0,_0x351ccc){return function(_0x5bb535){if(_0x5bb535){return _0x5bb535[_0x4cf1('0x28')]()[_0x4cf1('0x27')](function(){var _0x1b0ad4=_0x5bb535[_0x4cf1('0x29')]({'plain':!![]});var _0x389575=_0x4cf1('0x2a');return db[_0x4cf1('0x2b')][_0x4cf1('0x28')]({'where':{'type':_0x389575,'resourceId':_0x1b0ad4['id']}})[_0x4cf1('0x27')](function(){return _0x5bb535;});})[_0x4cf1('0x27')](function(){_0x4f14a0[_0x4cf1('0x1c')](0xcc)[_0x4cf1('0x1d')]();});}};}function handleEntityNotFound(_0x2a17ce,_0x4bcd78){return function(_0x4498b5){if(!_0x4498b5){_0x2a17ce[_0x4cf1('0x1b')](0x194);}return _0x4498b5;};}function handleError(_0x20d9d9,_0x1c7c9c){_0x1c7c9c=_0x1c7c9c||0x1f4;return function(_0x4348d0){logger[_0x4cf1('0x2c')](_0x4348d0[_0x4cf1('0x2d')]);if(_0x4348d0[_0x4cf1('0x2e')]){delete _0x4348d0[_0x4cf1('0x2e')];}_0x20d9d9[_0x4cf1('0x1c')](_0x1c7c9c)[_0x4cf1('0x2f')](_0x4348d0);};}exports['index']=function(_0x18232e,_0x167da0){var _0x59ea9f={},_0x2c8c92={},_0x54adfa={'count':0x0,'rows':[]};var _0x29f111=_[_0x4cf1('0x30')](db[_0x4cf1('0x31')][_0x4cf1('0x32')],function(_0x483f48){return{'name':_0x483f48[_0x4cf1('0x33')],'type':_0x483f48['type'][_0x4cf1('0x34')]};});_0x2c8c92[_0x4cf1('0x35')]=_[_0x4cf1('0x30')](_0x29f111,_0x4cf1('0x2e'));_0x2c8c92[_0x4cf1('0x36')]=_['keys'](_0x18232e[_0x4cf1('0x36')]);_0x2c8c92['filters']=_['intersection'](_0x2c8c92['model'],_0x2c8c92[_0x4cf1('0x36')]);_0x59ea9f[_0x4cf1('0x37')]=_[_0x4cf1('0x38')](_0x2c8c92[_0x4cf1('0x35')],qs[_0x4cf1('0x39')](_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x39')]));_0x59ea9f[_0x4cf1('0x37')]=_0x59ea9f['attributes']['length']?_0x59ea9f['attributes']:_0x2c8c92[_0x4cf1('0x35')];if(!_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x3a')](_0x4cf1('0x3b'))){_0x59ea9f[_0x4cf1('0x22')]=qs[_0x4cf1('0x22')](_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x22')]);_0x59ea9f[_0x4cf1('0x21')]=qs[_0x4cf1('0x21')](_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x21')]);}_0x59ea9f[_0x4cf1('0x3c')]=qs['sort'](_0x18232e['query'][_0x4cf1('0x3d')]);_0x59ea9f[_0x4cf1('0x3e')]=qs[_0x4cf1('0x3f')](_[_0x4cf1('0x40')](_0x18232e[_0x4cf1('0x36')],_0x2c8c92[_0x4cf1('0x3f')]),_0x29f111);if(_0x18232e[_0x4cf1('0x36')]['filter']){_0x59ea9f[_0x4cf1('0x3e')]=_[_0x4cf1('0x41')](_0x59ea9f[_0x4cf1('0x3e')],{'$or':_[_0x4cf1('0x30')](_0x29f111,function(_0x2850f7){if(_0x2850f7[_0x4cf1('0x42')]!=='VIRTUAL'){var _0x5348f5={};_0x5348f5[_0x2850f7[_0x4cf1('0x2e')]]={'$like':'%'+_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x43')]+'%'};return _0x5348f5;}})});}_0x59ea9f=_[_0x4cf1('0x41')]({},_0x59ea9f,_0x18232e[_0x4cf1('0x44')]);var _0x43d336={'where':_0x59ea9f[_0x4cf1('0x3e')]};return db[_0x4cf1('0x31')][_0x4cf1('0x20')](_0x43d336)[_0x4cf1('0x27')](function(_0x1a2869){_0x54adfa['count']=_0x1a2869;if(_0x18232e[_0x4cf1('0x36')][_0x4cf1('0x45')]){_0x59ea9f['include']=[{'all':!![]}];}return db[_0x4cf1('0x31')][_0x4cf1('0x46')](_0x59ea9f);})[_0x4cf1('0x27')](function(_0xc2b163){_0x54adfa[_0x4cf1('0x47')]=_0xc2b163;return _0x54adfa;})['then'](respondWithFilteredResult(_0x167da0,_0x59ea9f))[_0x4cf1('0x48')](handleError(_0x167da0,null));};exports['show']=function(_0x5d024c,_0x3d1464){var _0x3fb6ed={'raw':![],'where':{'id':_0x5d024c[_0x4cf1('0x49')]['id']}},_0x17f59e={};_0x17f59e[_0x4cf1('0x35')]=_[_0x4cf1('0x4a')](db[_0x4cf1('0x31')][_0x4cf1('0x32')]);_0x17f59e[_0x4cf1('0x36')]=_[_0x4cf1('0x4a')](_0x5d024c[_0x4cf1('0x36')]);_0x17f59e[_0x4cf1('0x3f')]=_[_0x4cf1('0x38')](_0x17f59e[_0x4cf1('0x35')],_0x17f59e[_0x4cf1('0x36')]);_0x3fb6ed[_0x4cf1('0x37')]=_['intersection'](_0x17f59e[_0x4cf1('0x35')],qs[_0x4cf1('0x39')](_0x5d024c[_0x4cf1('0x36')][_0x4cf1('0x39')]));_0x3fb6ed[_0x4cf1('0x37')]=_0x3fb6ed[_0x4cf1('0x37')][_0x4cf1('0x4b')]?_0x3fb6ed['attributes']:_0x17f59e[_0x4cf1('0x35')];if(_0x5d024c['query'][_0x4cf1('0x45')]){_0x3fb6ed[_0x4cf1('0x4c')]=[{'all':!![]}];}_0x3fb6ed=_[_0x4cf1('0x41')]({},_0x3fb6ed,_0x5d024c[_0x4cf1('0x44')]);return db[_0x4cf1('0x31')][_0x4cf1('0x4d')](_0x3fb6ed)['then'](handleEntityNotFound(_0x3d1464,null))['then'](respondWithResult(_0x3d1464,null))['catch'](handleError(_0x3d1464,null));};exports[_0x4cf1('0x4e')]=function(_0x18e085,_0x1cd038){return db['VoiceChanSpy'][_0x4cf1('0x4e')](_0x18e085[_0x4cf1('0x4f')],{})['then'](function(_0x28a267){var _0x3e3e5d=_0x18e085[_0x4cf1('0x50')][_0x4cf1('0x29')]({'plain':!![]});if(!_0x3e3e5d)throw new Error(_0x4cf1('0x51'));if(_0x3e3e5d['role']===_0x4cf1('0x50')){var _0x1f3c7e=_0x28a267[_0x4cf1('0x29')]({'plain':!![]});var _0x77418c=_0x4cf1('0x2a');return db['UserProfileSection'][_0x4cf1('0x4d')]({'where':{'name':_0x77418c,'userProfileId':_0x3e3e5d[_0x4cf1('0x52')]},'raw':!![]})['then'](function(_0x5b74fc){if(_0x5b74fc&&_0x5b74fc['autoAssociation']===0x0){return db[_0x4cf1('0x2b')][_0x4cf1('0x4e')]({'name':_0x1f3c7e[_0x4cf1('0x2e')],'resourceId':_0x1f3c7e['id'],'type':_0x5b74fc['name'],'sectionId':_0x5b74fc['id']},{})[_0x4cf1('0x27')](function(){return _0x28a267;});}else{return _0x28a267;}})[_0x4cf1('0x48')](function(_0x296065){logger['error'](_0x4cf1('0x53'),_0x296065);throw _0x296065;});}return _0x28a267;})[_0x4cf1('0x27')](respondWithResult(_0x1cd038,0xc9))[_0x4cf1('0x48')](handleError(_0x1cd038,null));};exports[_0x4cf1('0x26')]=function(_0x57dfb3,_0x1105cb){if(_0x57dfb3[_0x4cf1('0x4f')]['id']){delete _0x57dfb3['body']['id'];}return db[_0x4cf1('0x31')][_0x4cf1('0x4d')]({'where':{'id':_0x57dfb3[_0x4cf1('0x49')]['id']}})['then'](handleEntityNotFound(_0x1105cb,null))[_0x4cf1('0x27')](saveUpdates(_0x57dfb3[_0x4cf1('0x4f')],null))[_0x4cf1('0x27')](respondWithResult(_0x1105cb,null))[_0x4cf1('0x48')](handleError(_0x1105cb,null));};exports[_0x4cf1('0x28')]=function(_0x2e93cc,_0x2d161f){return db['VoiceChanSpy']['find']({'where':{'id':_0x2e93cc[_0x4cf1('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d161f,null))[_0x4cf1('0x27')](removeEntity(_0x2d161f,null))[_0x4cf1('0x48')](handleError(_0x2d161f,null));}; \ No newline at end of file +var _0xee11=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','map','VoiceChanSpy','rawAttributes','key','keys','filters','model','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','body','eml-format','fast-json-patch'];(function(_0x5127c2,_0x46c45f){var _0x4700cf=function(_0x2df5c8){while(--_0x2df5c8){_0x5127c2['push'](_0x5127c2['shift']());}};_0x4700cf(++_0x46c45f);}(_0xee11,0x146));var _0x1ee1=function(_0x26a169,_0x54f908){_0x26a169=_0x26a169-0x0;var _0x1f07a1=_0xee11[_0x26a169];return _0x1f07a1;};'use strict';var emlformat=require(_0x1ee1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1ee1('0x1'));var rp=require(_0x1ee1('0x2'));var moment=require(_0x1ee1('0x3'));var BPromise=require(_0x1ee1('0x4'));var Mustache=require(_0x1ee1('0x5'));var util=require(_0x1ee1('0x6'));var path=require(_0x1ee1('0x7'));var sox=require(_0x1ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x1ee1('0x9'));var fs=require('fs');var fs_extra=require(_0x1ee1('0xa'));var _=require(_0x1ee1('0xb'));var squel=require(_0x1ee1('0xc'));var crypto=require(_0x1ee1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ee1('0xe'));var querystring=require(_0x1ee1('0xf'));var Papa=require(_0x1ee1('0x10'));var Redis=require(_0x1ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ee1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ee1('0x13'));var logger=require(_0x1ee1('0x14'))(_0x1ee1('0x15'));var utils=require(_0x1ee1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1ee1('0x17'));var db=require(_0x1ee1('0x18'))['db'];function respondWithStatusCode(_0x51268c,_0x35d97c){_0x35d97c=_0x35d97c||0xcc;return function(_0xc2b64e){if(_0xc2b64e){return _0x51268c[_0x1ee1('0x19')](_0x35d97c);}return _0x51268c[_0x1ee1('0x1a')](_0x35d97c)[_0x1ee1('0x1b')]();};}function respondWithResult(_0x272cab,_0x1a23e4){_0x1a23e4=_0x1a23e4||0xc8;return function(_0xbc8577){if(_0xbc8577){return _0x272cab[_0x1ee1('0x1a')](_0x1a23e4)[_0x1ee1('0x1c')](_0xbc8577);}};}function respondWithFilteredResult(_0x2bc943,_0x443dff){return function(_0x3c64f1){if(_0x3c64f1){var _0x3a19db=typeof _0x443dff['offset']==='undefined'&&typeof _0x443dff[_0x1ee1('0x1d')]===_0x1ee1('0x1e');var _0x52aaab=_0x3c64f1[_0x1ee1('0x1f')];var _0x1e18b9=_0x3a19db?0x0:_0x443dff[_0x1ee1('0x20')];var _0x55abff=_0x3a19db?_0x3c64f1[_0x1ee1('0x1f')]:_0x443dff[_0x1ee1('0x20')]+_0x443dff['limit'];var _0x1e2073;if(_0x55abff>=_0x52aaab){_0x55abff=_0x52aaab;_0x1e2073=0xc8;}else{_0x1e2073=0xce;}_0x2bc943[_0x1ee1('0x1a')](_0x1e2073);return _0x2bc943['set']('Content-Range',_0x1e18b9+'-'+_0x55abff+'/'+_0x52aaab)[_0x1ee1('0x1c')](_0x3c64f1);}return null;};}function patchUpdates(_0x1b6cdf){return function(_0x6f623){try{jsonpatch[_0x1ee1('0x21')](_0x6f623,_0x1b6cdf,!![]);}catch(_0x47eb1a){return BPromise[_0x1ee1('0x22')](_0x47eb1a);}return _0x6f623[_0x1ee1('0x23')]();};}function saveUpdates(_0x482d0,_0x5093ff){return function(_0x1a27c4){if(_0x1a27c4){return _0x1a27c4[_0x1ee1('0x24')](_0x482d0)[_0x1ee1('0x25')](function(_0x307672){return _0x307672;});}return null;};}function removeEntity(_0x21073e,_0x353542){return function(_0x55921f){if(_0x55921f){return _0x55921f[_0x1ee1('0x26')]()['then'](function(){var _0x4932cd=_0x55921f[_0x1ee1('0x27')]({'plain':!![]});var _0x306aac='ChanSpies';return db[_0x1ee1('0x28')][_0x1ee1('0x26')]({'where':{'type':_0x306aac,'resourceId':_0x4932cd['id']}})[_0x1ee1('0x25')](function(){return _0x55921f;});})[_0x1ee1('0x25')](function(){_0x21073e[_0x1ee1('0x1a')](0xcc)[_0x1ee1('0x1b')]();});}};}function handleEntityNotFound(_0x56a1e3,_0x14f388){return function(_0x8a95d8){if(!_0x8a95d8){_0x56a1e3[_0x1ee1('0x19')](0x194);}return _0x8a95d8;};}function handleError(_0x11ce8d,_0x3d0ffc){_0x3d0ffc=_0x3d0ffc||0x1f4;return function(_0x1a2246){logger['error'](_0x1a2246[_0x1ee1('0x29')]);if(_0x1a2246['name']){delete _0x1a2246[_0x1ee1('0x2a')];}_0x11ce8d[_0x1ee1('0x1a')](_0x3d0ffc)['send'](_0x1a2246);};}exports['index']=function(_0x444ed9,_0xfd544d){var _0xf63d67={},_0x209592={},_0x49241e={'count':0x0,'rows':[]};var _0x4b9ea4=_[_0x1ee1('0x2b')](db[_0x1ee1('0x2c')][_0x1ee1('0x2d')],function(_0x3153b6){return{'name':_0x3153b6['fieldName'],'type':_0x3153b6['type'][_0x1ee1('0x2e')]};});_0x209592['model']=_[_0x1ee1('0x2b')](_0x4b9ea4,_0x1ee1('0x2a'));_0x209592['query']=_[_0x1ee1('0x2f')](_0x444ed9['query']);_0x209592[_0x1ee1('0x30')]=_['intersection'](_0x209592[_0x1ee1('0x31')],_0x209592['query']);_0xf63d67[_0x1ee1('0x32')]=_[_0x1ee1('0x33')](_0x209592['model'],qs[_0x1ee1('0x34')](_0x444ed9[_0x1ee1('0x35')][_0x1ee1('0x34')]));_0xf63d67['attributes']=_0xf63d67[_0x1ee1('0x32')][_0x1ee1('0x36')]?_0xf63d67[_0x1ee1('0x32')]:_0x209592[_0x1ee1('0x31')];if(!_0x444ed9[_0x1ee1('0x35')][_0x1ee1('0x37')](_0x1ee1('0x38'))){_0xf63d67[_0x1ee1('0x1d')]=qs[_0x1ee1('0x1d')](_0x444ed9[_0x1ee1('0x35')][_0x1ee1('0x1d')]);_0xf63d67[_0x1ee1('0x20')]=qs[_0x1ee1('0x20')](_0x444ed9[_0x1ee1('0x35')][_0x1ee1('0x20')]);}_0xf63d67[_0x1ee1('0x39')]=qs[_0x1ee1('0x3a')](_0x444ed9[_0x1ee1('0x35')][_0x1ee1('0x3a')]);_0xf63d67[_0x1ee1('0x3b')]=qs[_0x1ee1('0x30')](_[_0x1ee1('0x3c')](_0x444ed9['query'],_0x209592[_0x1ee1('0x30')]),_0x4b9ea4);if(_0x444ed9[_0x1ee1('0x35')][_0x1ee1('0x3d')]){_0xf63d67[_0x1ee1('0x3b')]=_[_0x1ee1('0x3e')](_0xf63d67[_0x1ee1('0x3b')],{'$or':_[_0x1ee1('0x2b')](_0x4b9ea4,function(_0x3390f0){if(_0x3390f0[_0x1ee1('0x3f')]!==_0x1ee1('0x40')){var _0x46eff6={};_0x46eff6[_0x3390f0[_0x1ee1('0x2a')]]={'$like':'%'+_0x444ed9['query'][_0x1ee1('0x3d')]+'%'};return _0x46eff6;}})});}_0xf63d67=_[_0x1ee1('0x3e')]({},_0xf63d67,_0x444ed9[_0x1ee1('0x41')]);var _0x447b90={'where':_0xf63d67[_0x1ee1('0x3b')]};return db[_0x1ee1('0x2c')][_0x1ee1('0x1f')](_0x447b90)['then'](function(_0x3df247){_0x49241e[_0x1ee1('0x1f')]=_0x3df247;if(_0x444ed9['query'][_0x1ee1('0x42')]){_0xf63d67['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x1ee1('0x43')](_0xf63d67);})[_0x1ee1('0x25')](function(_0x5cc8a1){_0x49241e[_0x1ee1('0x44')]=_0x5cc8a1;return _0x49241e;})[_0x1ee1('0x25')](respondWithFilteredResult(_0xfd544d,_0xf63d67))[_0x1ee1('0x45')](handleError(_0xfd544d,null));};exports[_0x1ee1('0x46')]=function(_0x1910ed,_0x5301c3){var _0x4e4e09={'raw':![],'where':{'id':_0x1910ed[_0x1ee1('0x47')]['id']}},_0x38e0aa={};_0x38e0aa[_0x1ee1('0x31')]=_[_0x1ee1('0x2f')](db[_0x1ee1('0x2c')][_0x1ee1('0x2d')]);_0x38e0aa[_0x1ee1('0x35')]=_['keys'](_0x1910ed[_0x1ee1('0x35')]);_0x38e0aa['filters']=_[_0x1ee1('0x33')](_0x38e0aa[_0x1ee1('0x31')],_0x38e0aa[_0x1ee1('0x35')]);_0x4e4e09[_0x1ee1('0x32')]=_[_0x1ee1('0x33')](_0x38e0aa[_0x1ee1('0x31')],qs[_0x1ee1('0x34')](_0x1910ed[_0x1ee1('0x35')][_0x1ee1('0x34')]));_0x4e4e09[_0x1ee1('0x32')]=_0x4e4e09['attributes'][_0x1ee1('0x36')]?_0x4e4e09[_0x1ee1('0x32')]:_0x38e0aa[_0x1ee1('0x31')];if(_0x1910ed['query'][_0x1ee1('0x42')]){_0x4e4e09[_0x1ee1('0x48')]=[{'all':!![]}];}_0x4e4e09=_[_0x1ee1('0x3e')]({},_0x4e4e09,_0x1910ed['options']);return db[_0x1ee1('0x2c')][_0x1ee1('0x49')](_0x4e4e09)[_0x1ee1('0x25')](handleEntityNotFound(_0x5301c3,null))[_0x1ee1('0x25')](respondWithResult(_0x5301c3,null))['catch'](handleError(_0x5301c3,null));};exports[_0x1ee1('0x4a')]=function(_0x4c46e4,_0x12edad){return db[_0x1ee1('0x2c')]['create'](_0x4c46e4['body'],{})[_0x1ee1('0x25')](function(_0x13462f){var _0x17369c=_0x4c46e4[_0x1ee1('0x4b')]['get']({'plain':!![]});if(!_0x17369c)throw new Error(_0x1ee1('0x4c'));if(_0x17369c[_0x1ee1('0x4d')]==='user'){var _0x1e0682=_0x13462f[_0x1ee1('0x27')]({'plain':!![]});var _0x400c27=_0x1ee1('0x4e');return db[_0x1ee1('0x4f')][_0x1ee1('0x49')]({'where':{'name':_0x400c27,'userProfileId':_0x17369c['userProfileId']},'raw':!![]})[_0x1ee1('0x25')](function(_0xb894af){if(_0xb894af&&_0xb894af[_0x1ee1('0x50')]===0x0){return db[_0x1ee1('0x28')][_0x1ee1('0x4a')]({'name':_0x1e0682[_0x1ee1('0x2a')],'resourceId':_0x1e0682['id'],'type':_0xb894af['name'],'sectionId':_0xb894af['id']},{})['then'](function(){return _0x13462f;});}else{return _0x13462f;}})[_0x1ee1('0x45')](function(_0xe93945){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe93945);throw _0xe93945;});}return _0x13462f;})[_0x1ee1('0x25')](respondWithResult(_0x12edad,0xc9))[_0x1ee1('0x45')](handleError(_0x12edad,null));};exports[_0x1ee1('0x24')]=function(_0x4af47b,_0x3791de){if(_0x4af47b[_0x1ee1('0x51')]['id']){delete _0x4af47b[_0x1ee1('0x51')]['id'];}return db[_0x1ee1('0x2c')][_0x1ee1('0x49')]({'where':{'id':_0x4af47b[_0x1ee1('0x47')]['id']}})[_0x1ee1('0x25')](handleEntityNotFound(_0x3791de,null))[_0x1ee1('0x25')](saveUpdates(_0x4af47b['body'],null))['then'](respondWithResult(_0x3791de,null))[_0x1ee1('0x45')](handleError(_0x3791de,null));};exports['destroy']=function(_0x4ac90f,_0xa00597){return db['VoiceChanSpy']['find']({'where':{'id':_0x4ac90f[_0x1ee1('0x47')]['id']}})[_0x1ee1('0x25')](handleEntityNotFound(_0xa00597,null))['then'](removeEntity(_0xa00597,null))[_0x1ee1('0x45')](handleError(_0xa00597,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 780a132..64f1440 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 _0xa4f7=['User','agent','catch','models','define','voice_chanspy','VoiceExtension','bulkCreate','then','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','system','push','Set','format','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal'];(function(_0x435915,_0x4797c5){var _0x5e2cb3=function(_0x451225){while(--_0x451225){_0x435915['push'](_0x435915['shift']());}};_0x5e2cb3(++_0x4797c5);}(_0xa4f7,0x12a));var _0x7a4f=function(_0x3f5c75,_0x560cf9){_0x3f5c75=_0x3f5c75-0x0;var _0x3066d3=_0xa4f7[_0x3f5c75];return _0x3066d3;};'use strict';var _=require(_0x7a4f('0x0'));var util=require(_0x7a4f('0x1'));var BPromise=require(_0x7a4f('0x2'));var attributes=require(_0x7a4f('0x3'));var getUserApplications=function(_0x198b47,_0x459a89,_0x19ed2f){var _0x3c43c3=0x1;var _0xfc341c=[];var _0x4db0df={'context':_0x459a89['context']||_0x7a4f('0x4'),'exten':util['format']('%s%s',_0x198b47['prefix'],_0x19ed2f),'type':_0x7a4f('0x5'),'isApp':![],'ChanSpyId':_0x198b47['id'],'UserId':_0x459a89['id']};_0xfc341c[_0x7a4f('0x6')](_['merge']({'app':_0x7a4f('0x7'),'appdata':util[_0x7a4f('0x8')]('CDR(type)=%s',_0x7a4f('0x9')),'priority':_0x3c43c3++},_0x4db0df));if(_0x198b47[_0x7a4f('0xa')]){_0xfc341c[_0x7a4f('0x6')](_[_0x7a4f('0xb')]({'app':_0x7a4f('0xc'),'appdata':util[_0x7a4f('0x8')](_0x7a4f('0xd'),_0x198b47['recordingFormat']),'priority':_0x3c43c3++},_0x4db0df));}if(_0x198b47[_0x7a4f('0xe')]){_0xfc341c[_0x7a4f('0x6')](_[_0x7a4f('0xb')]({'app':_0x7a4f('0xf'),'appdata':_0x198b47[_0x7a4f('0x10')],'priority':_0x3c43c3++},_0x4db0df));}_0xfc341c[_0x7a4f('0x6')](_[_0x7a4f('0xb')]({'app':_0x7a4f('0x11'),'appdata':util[_0x7a4f('0x8')](_0x7a4f('0x12'),_0x459a89[_0x7a4f('0x13')],_0x198b47[_0x7a4f('0x14')]?_0x198b47['options'][_0x7a4f('0x15')](''):''),'priority':_0x3c43c3++},_0x4db0df));if(_0x198b47[_0x7a4f('0xa')]){_0xfc341c[_0x7a4f('0x6')](_[_0x7a4f('0xb')]({'app':_0x7a4f('0x16'),'priority':_0x3c43c3++},_0x4db0df));}return _0xfc341c;};var getChanSpyApplications=function(_0x3a0a08,_0x3df03d){var _0x5c2633=[];for(var _0x2e77cd=0x0,_0x2dd648=0x1;_0x2e77cd<_0x3df03d[_0x7a4f('0x17')];_0x2e77cd++,_0x2dd648=0x1){_0x5c2633=_0x5c2633[_0x7a4f('0x18')](getUserApplications(_0x3a0a08,_0x3df03d[_0x2e77cd],_0x3df03d[_0x2e77cd][_0x7a4f('0x19')]));if(_0x3df03d[_0x2e77cd]['internal']!=_0x3df03d[_0x2e77cd][_0x7a4f('0x13')]){_0x5c2633=_0x5c2633['concat'](getUserApplications(_0x3a0a08,_0x3df03d[_0x2e77cd],_0x3df03d[_0x2e77cd]['name']));}}return _0x5c2633;};var getChanSpyPromise=function(_0x476e08,_0x104ed8){return new BPromise(function(_0x4882f0,_0x2d00f0){return _0x476e08[_0x7a4f('0x1a')]['findAll']({'attributes':['id',_0x7a4f('0x13'),_0x7a4f('0x19')],'where':{'role':_0x7a4f('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x276d02){if(_0x276d02){return _0x4882f0(getChanSpyApplications(_0x104ed8,_0x276d02));}return _0x4882f0([]);})[_0x7a4f('0x1c')](function(_0x495600){_0x2d00f0(_0x495600);});});};module['exports']=function(_0x46ebf8,_0x2e18c1){var _0x39dbe1=_0x46ebf8[_0x7a4f('0x1d')];return _0x46ebf8[_0x7a4f('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0x7a4f('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x335ac2,_0x22c0e4,_0x1a9f8c){return getChanSpyPromise(_0x39dbe1,_0x335ac2)['then'](function(_0x8892df){if(_0x8892df&&_0x8892df[_0x7a4f('0x17')]){return _0x39dbe1[_0x7a4f('0x20')][_0x7a4f('0x21')](_0x8892df);}})[_0x7a4f('0x22')](function(){_0x1a9f8c();})[_0x7a4f('0x1c')](function(_0x151e92){_0x1a9f8c(_0x151e92);});},'afterUpdate':function(_0x4279c7,_0x4bec85,_0x21b528){return _0x39dbe1[_0x7a4f('0x20')]['destroy']({'where':{'ChanSpyId':_0x4279c7['id']}})[_0x7a4f('0x22')](function(){return getChanSpyPromise(_0x39dbe1,_0x4279c7);})[_0x7a4f('0x22')](function(_0xa3bd12){if(_0xa3bd12&&_0xa3bd12[_0x7a4f('0x17')]){return _0x39dbe1['VoiceExtension'][_0x7a4f('0x21')](_0xa3bd12);}})[_0x7a4f('0x22')](function(){_0x21b528();})['catch'](function(_0x30b0fc){_0x21b528(_0x30b0fc);});},'afterDestroy':function(_0x490caf,_0x525d9e,_0x144d6b){return _0x39dbe1[_0x7a4f('0x20')][_0x7a4f('0x23')]({'where':{'ChanSpyId':_0x490caf['id']}})[_0x7a4f('0x22')](function(){_0x144d6b();})[_0x7a4f('0x1c')](function(_0x567068){_0x144d6b(_0x567068);});}}});}; \ No newline at end of file +var _0x07b7=['MixMonitor','auth','ChanSpy','SIP/%s,%s','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','define','VoiceChanSpy','bulkCreate','destroy','VoiceExtension','lodash','util','from-sip','%s%s','prefix','system','Set','format','CDR(type)=%s','chanspy','record','push','merge'];(function(_0x5276f5,_0x6b32a7){var _0x293778=function(_0x285b3d){while(--_0x285b3d){_0x5276f5['push'](_0x5276f5['shift']());}};_0x293778(++_0x6b32a7);}(_0x07b7,0xb9));var _0x707b=function(_0x928a02,_0x2257cd){_0x928a02=_0x928a02-0x0;var _0x30705c=_0x07b7[_0x928a02];return _0x30705c;};'use strict';var _=require(_0x707b('0x0'));var util=require(_0x707b('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5f0ba5,_0x509993,_0x7dba4e){var _0x37d8ef=0x1;var _0x285a6a=[];var _0x354052={'context':_0x509993['context']||_0x707b('0x2'),'exten':util['format'](_0x707b('0x3'),_0x5f0ba5[_0x707b('0x4')],_0x7dba4e),'type':_0x707b('0x5'),'isApp':![],'ChanSpyId':_0x5f0ba5['id'],'UserId':_0x509993['id']};_0x285a6a['push'](_['merge']({'app':_0x707b('0x6'),'appdata':util[_0x707b('0x7')](_0x707b('0x8'),_0x707b('0x9')),'priority':_0x37d8ef++},_0x354052));if(_0x5f0ba5[_0x707b('0xa')]){_0x285a6a[_0x707b('0xb')](_[_0x707b('0xc')]({'app':_0x707b('0xd'),'appdata':util[_0x707b('0x7')]('${UNIQUEID}.%s,a',_0x5f0ba5['recordingFormat']),'priority':_0x37d8ef++},_0x354052));}if(_0x5f0ba5[_0x707b('0xe')]){_0x285a6a[_0x707b('0xb')](_[_0x707b('0xc')]({'app':'Authenticate','appdata':_0x5f0ba5['password'],'priority':_0x37d8ef++},_0x354052));}_0x285a6a[_0x707b('0xb')](_[_0x707b('0xc')]({'app':_0x707b('0xf'),'appdata':util[_0x707b('0x7')](_0x707b('0x10'),_0x509993['name'],_0x5f0ba5['options']?_0x5f0ba5['options'][_0x707b('0x11')](''):''),'priority':_0x37d8ef++},_0x354052));if(_0x5f0ba5[_0x707b('0xa')]){_0x285a6a[_0x707b('0xb')](_[_0x707b('0xc')]({'app':_0x707b('0x12'),'priority':_0x37d8ef++},_0x354052));}return _0x285a6a;};var getChanSpyApplications=function(_0x58579d,_0x4edaa4){var _0x342a65=[];for(var _0x5080e5=0x0,_0x5abd63=0x1;_0x5080e5<_0x4edaa4[_0x707b('0x13')];_0x5080e5++,_0x5abd63=0x1){_0x342a65=_0x342a65[_0x707b('0x14')](getUserApplications(_0x58579d,_0x4edaa4[_0x5080e5],_0x4edaa4[_0x5080e5]['internal']));if(_0x4edaa4[_0x5080e5][_0x707b('0x15')]!=_0x4edaa4[_0x5080e5][_0x707b('0x16')]){_0x342a65=_0x342a65[_0x707b('0x14')](getUserApplications(_0x58579d,_0x4edaa4[_0x5080e5],_0x4edaa4[_0x5080e5]['name']));}}return _0x342a65;};var getChanSpyPromise=function(_0x4279ae,_0x546aed){return new BPromise(function(_0x41ac54,_0x37216e){return _0x4279ae[_0x707b('0x17')][_0x707b('0x18')]({'attributes':['id',_0x707b('0x16'),_0x707b('0x15')],'where':{'role':_0x707b('0x19'),'chanspy':!![]},'raw':!![]})[_0x707b('0x1a')](function(_0x3ccbbc){if(_0x3ccbbc){return _0x41ac54(getChanSpyApplications(_0x546aed,_0x3ccbbc));}return _0x41ac54([]);})[_0x707b('0x1b')](function(_0x5a27f8){_0x37216e(_0x5a27f8);});});};module['exports']=function(_0xbd8c4,_0x4d8021){var _0x4aaa76=_0xbd8c4['models'];return _0xbd8c4[_0x707b('0x1c')](_0x707b('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc23eec,_0x2a39bd,_0x419651){return getChanSpyPromise(_0x4aaa76,_0xc23eec)[_0x707b('0x1a')](function(_0x44d64b){if(_0x44d64b&&_0x44d64b[_0x707b('0x13')]){return _0x4aaa76['VoiceExtension'][_0x707b('0x1e')](_0x44d64b);}})[_0x707b('0x1a')](function(){_0x419651();})['catch'](function(_0xde0ea9){_0x419651(_0xde0ea9);});},'afterUpdate':function(_0x33cc9f,_0x1426f4,_0x2d0619){return _0x4aaa76['VoiceExtension'][_0x707b('0x1f')]({'where':{'ChanSpyId':_0x33cc9f['id']}})[_0x707b('0x1a')](function(){return getChanSpyPromise(_0x4aaa76,_0x33cc9f);})['then'](function(_0x10c34b){if(_0x10c34b&&_0x10c34b[_0x707b('0x13')]){return _0x4aaa76[_0x707b('0x20')]['bulkCreate'](_0x10c34b);}})[_0x707b('0x1a')](function(){_0x2d0619();})[_0x707b('0x1b')](function(_0x3ba5f7){_0x2d0619(_0x3ba5f7);});},'afterDestroy':function(_0x2330cd,_0x39ca48,_0x3a6560){return _0x4aaa76[_0x707b('0x20')]['destroy']({'where':{'ChanSpyId':_0x2330cd['id']}})['then'](function(){_0x3a6560();})[_0x707b('0x1b')](function(_0x34039d){_0x3a6560(_0x34039d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index da51c03..cd74674 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 _0x7af2=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','message','VoiceChanSpy,\x20%s,\x20%s','result'];(function(_0x23ed80,_0x30ebde){var _0xaa515a=function(_0x2b579b){while(--_0x2b579b){_0x23ed80['push'](_0x23ed80['shift']());}};_0xaa515a(++_0x30ebde);}(_0x7af2,0x119));var _0x27af=function(_0x1c29b7,_0x27a1c5){_0x1c29b7=_0x1c29b7-0x0;var _0x1da052=_0x7af2[_0x1c29b7];return _0x1da052;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});} \ No newline at end of file +var _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x276122,_0x12f843){var _0x2d15cc=function(_0x256033){while(--_0x256033){_0x276122['push'](_0x276122['shift']());}};_0x2d15cc(++_0x12f843);}(_0x222f,0x1a4));var _0xf222=function(_0x487b09,_0x349b11){_0x487b09=_0x487b09-0x0;var _0x28830b=_0x222f[_0x487b09];return _0x28830b;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index cb71229..9f82161 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 _0xb5d1=['../../components/interaction/service','./voiceContext.controller','get','index','isAuthenticated','show','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xb5d1,0xcb));var _0x1b5d=function(_0x403454,_0x4688ad){_0x403454=_0x403454-0x0;var _0x535214=_0xb5d1[_0x403454];return _0x535214;};'use strict';var multer=require(_0x1b5d('0x0'));var util=require(_0x1b5d('0x1'));var path=require(_0x1b5d('0x2'));var timeout=require(_0x1b5d('0x3'));var express=require('express');var router=express[_0x1b5d('0x4')]();var fs_extra=require(_0x1b5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1b5d('0x6'));var config=require('../../config/environment');var controller=require(_0x1b5d('0x7'));router[_0x1b5d('0x8')]('/',auth['isAuthenticated'](),controller[_0x1b5d('0x9')]);router[_0x1b5d('0x8')]('/:id',auth[_0x1b5d('0xa')](),controller[_0x1b5d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1b5d('0xc')]);router[_0x1b5d('0xd')]('/:id',auth[_0x1b5d('0xa')](),controller[_0x1b5d('0xe')]);router[_0x1b5d('0xf')](_0x1b5d('0x10'),auth['isAuthenticated'](),controller[_0x1b5d('0x11')]);module[_0x1b5d('0x12')]=router; \ No newline at end of file +var _0xcf72=['show','create','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id'];(function(_0x3e3558,_0x246ebd){var _0x4e0bbf=function(_0x39a546){while(--_0x39a546){_0x3e3558['push'](_0x3e3558['shift']());}};_0x4e0bbf(++_0x246ebd);}(_0xcf72,0x16a));var _0x2cf7=function(_0x2cbfb7,_0x3d931b){_0x2cbfb7=_0x2cbfb7-0x0;var _0x28e7ee=_0xcf72[_0x2cbfb7];return _0x28e7ee;};'use strict';var multer=require('multer');var util=require(_0x2cf7('0x0'));var path=require(_0x2cf7('0x1'));var timeout=require(_0x2cf7('0x2'));var express=require(_0x2cf7('0x3'));var router=express[_0x2cf7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2cf7('0x5'));var config=require(_0x2cf7('0x6'));var controller=require(_0x2cf7('0x7'));router[_0x2cf7('0x8')]('/',auth[_0x2cf7('0x9')](),controller[_0x2cf7('0xa')]);router[_0x2cf7('0x8')](_0x2cf7('0xb'),auth[_0x2cf7('0x9')](),controller[_0x2cf7('0xc')]);router['post']('/',auth[_0x2cf7('0x9')](),controller[_0x2cf7('0xd')]);router['put']('/:id',auth[_0x2cf7('0x9')](),controller['update']);router[_0x2cf7('0xe')](_0x2cf7('0xb'),auth['isAuthenticated'](),controller[_0x2cf7('0xf')]);module[_0x2cf7('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3e19f11..177f0ec 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 _0x0dde=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5ef045,_0x3d4ada){var _0x46e016=function(_0x19cac1){while(--_0x19cac1){_0x5ef045['push'](_0x5ef045['shift']());}};_0x46e016(++_0x3d4ada);}(_0x0dde,0xd9));var _0xe0dd=function(_0x4152fa,_0x6dc7a3){_0x4152fa=_0x4152fa-0x0;var _0x3c3779=_0x0dde[_0x4152fa];return _0x3c3779;};'use strict';var Sequelize=require(_0xe0dd('0x0'));module[_0xe0dd('0x1')]={'name':{'type':Sequelize[_0xe0dd('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xe0dd('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe0dd('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x55c0=['STRING','name','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55c0,0x140));var _0x055c=function(_0x3003fc,_0x5ac5de){_0x3003fc=_0x3003fc-0x0;var _0x22cb43=_0x55c0[_0x3003fc];return _0x22cb43;};'use strict';var Sequelize=require(_0x055c('0x0'));module['exports']={'name':{'type':Sequelize[_0x055c('0x1')],'unique':_0x055c('0x2')},'description':{'type':Sequelize[_0x055c('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 deb8e94..9ca3831 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 _0x27d1=['length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Contexts','UserProfileResource','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','index','map','VoiceContext','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x3fb5bb,_0x2e52d0){var _0x836564=function(_0x5de907){while(--_0x5de907){_0x3fb5bb['push'](_0x3fb5bb['shift']());}};_0x836564(++_0x2e52d0);}(_0x27d1,0x1a2));var _0x127d=function(_0x1139f2,_0x1940e3){_0x1139f2=_0x1139f2-0x0;var _0x557bf1=_0x27d1[_0x1139f2];return _0x557bf1;};'use strict';var emlformat=require(_0x127d('0x0'));var rimraf=require(_0x127d('0x1'));var zipdir=require(_0x127d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x127d('0x3'));var moment=require(_0x127d('0x4'));var BPromise=require(_0x127d('0x5'));var Mustache=require('mustache');var util=require(_0x127d('0x6'));var path=require('path');var sox=require(_0x127d('0x7'));var csv=require(_0x127d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x127d('0x9'));var _=require(_0x127d('0xa'));var squel=require(_0x127d('0xb'));var crypto=require(_0x127d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x127d('0x8'));var querystring=require(_0x127d('0xd'));var Papa=require('papaparse');var Redis=require(_0x127d('0xe'));var authService=require(_0x127d('0xf'));var qs=require(_0x127d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x127d('0x11'));var logger=require(_0x127d('0x12'))(_0x127d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x127d('0x14'))['db'];var jayson=require(_0x127d('0x15'));var client=jayson[_0x127d('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250251,_0x202244,_0x963590,_0x24cc7d){return new BPromise(function(_0x2f2c21,_0x310038){var _0x203afb=_0x24cc7d||client;return _0x203afb[_0x127d('0x17')](_0x250251,_0x963590)['then'](function(_0x1ce09e){logger[_0x127d('0x18')](_0x127d('0x19'),_0x202244,'request\x20sent');logger[_0x127d('0x1a')](_0x127d('0x1b'),_0x202244,_0x127d('0x1c'),JSON[_0x127d('0x1d')](_0x1ce09e));if(_0x1ce09e['error']){if(_0x1ce09e[_0x127d('0x1e')][_0x127d('0x1f')]===0x1f4){logger[_0x127d('0x1e')](_0x127d('0x19'),_0x202244,_0x1ce09e['error']['message']);return _0x310038(_0x1ce09e[_0x127d('0x1e')][_0x127d('0x20')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x202244,_0x1ce09e[_0x127d('0x1e')][_0x127d('0x20')]);return _0x2f2c21(_0x1ce09e['error'][_0x127d('0x20')]);}else{logger[_0x127d('0x18')]('VoiceContext,\x20%s,\x20%s',_0x202244,_0x127d('0x1c'));_0x2f2c21(_0x1ce09e[_0x127d('0x21')]['message']);}})[_0x127d('0x22')](function(_0x2c1ac2){logger[_0x127d('0x1e')](_0x127d('0x19'),_0x202244,_0x2c1ac2);_0x310038(_0x2c1ac2);});});}function respondWithStatusCode(_0x3595e3,_0x983345){_0x983345=_0x983345||0xcc;return function(_0x37de71){if(_0x37de71){return _0x3595e3[_0x127d('0x23')](_0x983345);}return _0x3595e3[_0x127d('0x24')](_0x983345)[_0x127d('0x25')]();};}function respondWithResult(_0x5b9a49,_0x2c955d){_0x2c955d=_0x2c955d||0xc8;return function(_0xaa608a){if(_0xaa608a){return _0x5b9a49[_0x127d('0x24')](_0x2c955d)[_0x127d('0x26')](_0xaa608a);}};}function respondWithFilteredResult(_0x3de583,_0x52bc2a){return function(_0x32097b){if(_0x32097b){var _0x31e0c0=typeof _0x52bc2a['offset']===_0x127d('0x27')&&typeof _0x52bc2a[_0x127d('0x28')]===_0x127d('0x27');var _0x1bf624=_0x32097b[_0x127d('0x29')];var _0x1e577c=_0x31e0c0?0x0:_0x52bc2a[_0x127d('0x2a')];var _0x431091=_0x31e0c0?_0x32097b[_0x127d('0x29')]:_0x52bc2a[_0x127d('0x2a')]+_0x52bc2a[_0x127d('0x28')];var _0x194528;if(_0x431091>=_0x1bf624){_0x431091=_0x1bf624;_0x194528=0xc8;}else{_0x194528=0xce;}_0x3de583[_0x127d('0x24')](_0x194528);return _0x3de583[_0x127d('0x2b')](_0x127d('0x2c'),_0x1e577c+'-'+_0x431091+'/'+_0x1bf624)[_0x127d('0x26')](_0x32097b);}return null;};}function patchUpdates(_0x2a9bb3){return function(_0x4e61ea){try{jsonpatch[_0x127d('0x2d')](_0x4e61ea,_0x2a9bb3,!![]);}catch(_0xcb7211){return BPromise[_0x127d('0x2e')](_0xcb7211);}return _0x4e61ea[_0x127d('0x2f')]();};}function saveUpdates(_0x1fd88b,_0x502c95){return function(_0x1d2de5){if(_0x1d2de5){return _0x1d2de5['update'](_0x1fd88b)[_0x127d('0x30')](function(_0x30f11b){return _0x30f11b;});}return null;};}function removeEntity(_0x4fa782,_0x1766d5){return function(_0x541668){if(_0x541668){return _0x541668[_0x127d('0x31')]()[_0x127d('0x30')](function(){var _0x517eda=_0x541668[_0x127d('0x32')]({'plain':!![]});var _0x530acc='Contexts';return db['UserProfileResource']['destroy']({'where':{'type':_0x530acc,'resourceId':_0x517eda['id']}})[_0x127d('0x30')](function(){return _0x541668;});})['then'](function(){_0x4fa782[_0x127d('0x24')](0xcc)[_0x127d('0x25')]();});}};}function handleEntityNotFound(_0x15b6f5,_0x2c9535){return function(_0xbdb593){if(!_0xbdb593){_0x15b6f5[_0x127d('0x23')](0x194);}return _0xbdb593;};}function handleError(_0x231621,_0x3dc62f){_0x3dc62f=_0x3dc62f||0x1f4;return function(_0x344ca0){logger[_0x127d('0x1e')](_0x344ca0[_0x127d('0x33')]);if(_0x344ca0['name']){delete _0x344ca0[_0x127d('0x34')];}_0x231621[_0x127d('0x24')](_0x3dc62f)[_0x127d('0x35')](_0x344ca0);};}exports[_0x127d('0x36')]=function(_0x289803,_0x5695ca){var _0x453579={},_0xbb580={},_0x49941c={'count':0x0,'rows':[]};var _0x30bf3c=_[_0x127d('0x37')](db[_0x127d('0x38')]['rawAttributes'],function(_0x1c8bc0){return{'name':_0x1c8bc0[_0x127d('0x39')],'type':_0x1c8bc0[_0x127d('0x3a')][_0x127d('0x3b')]};});_0xbb580[_0x127d('0x3c')]=_[_0x127d('0x37')](_0x30bf3c,_0x127d('0x34'));_0xbb580[_0x127d('0x3d')]=_[_0x127d('0x3e')](_0x289803['query']);_0xbb580[_0x127d('0x3f')]=_['intersection'](_0xbb580[_0x127d('0x3c')],_0xbb580[_0x127d('0x3d')]);_0x453579[_0x127d('0x40')]=_[_0x127d('0x41')](_0xbb580[_0x127d('0x3c')],qs[_0x127d('0x42')](_0x289803[_0x127d('0x3d')]['fields']));_0x453579['attributes']=_0x453579[_0x127d('0x40')][_0x127d('0x43')]?_0x453579[_0x127d('0x40')]:_0xbb580[_0x127d('0x3c')];if(!_0x289803[_0x127d('0x3d')][_0x127d('0x44')](_0x127d('0x45'))){_0x453579[_0x127d('0x28')]=qs['limit'](_0x289803[_0x127d('0x3d')][_0x127d('0x28')]);_0x453579[_0x127d('0x2a')]=qs['offset'](_0x289803[_0x127d('0x3d')][_0x127d('0x2a')]);}_0x453579['order']=qs['sort'](_0x289803[_0x127d('0x3d')][_0x127d('0x46')]);_0x453579['where']=qs['filters'](_['pick'](_0x289803[_0x127d('0x3d')],_0xbb580['filters']),_0x30bf3c);if(_0x289803['query']['filter']){_0x453579[_0x127d('0x47')]=_[_0x127d('0x48')](_0x453579[_0x127d('0x47')],{'$or':_['map'](_0x30bf3c,function(_0x32dcad){if(_0x32dcad[_0x127d('0x3a')]!==_0x127d('0x49')){var _0x446e7f={};_0x446e7f[_0x32dcad[_0x127d('0x34')]]={'$like':'%'+_0x289803[_0x127d('0x3d')][_0x127d('0x4a')]+'%'};return _0x446e7f;}})});}_0x453579=_['merge']({},_0x453579,_0x289803[_0x127d('0x4b')]);var _0x43fd7f={'where':_0x453579[_0x127d('0x47')]};return db[_0x127d('0x38')]['count'](_0x43fd7f)[_0x127d('0x30')](function(_0x2db693){_0x49941c['count']=_0x2db693;if(_0x289803[_0x127d('0x3d')][_0x127d('0x4c')]){_0x453579['include']=[{'all':!![]}];}return db[_0x127d('0x38')][_0x127d('0x4d')](_0x453579);})[_0x127d('0x30')](function(_0x51a112){_0x49941c[_0x127d('0x4e')]=_0x51a112;return _0x49941c;})[_0x127d('0x30')](respondWithFilteredResult(_0x5695ca,_0x453579))[_0x127d('0x22')](handleError(_0x5695ca,null));};exports['show']=function(_0x316397,_0x20a5e8){var _0x2903f3={'raw':![],'where':{'id':_0x316397[_0x127d('0x4f')]['id']}},_0x1d53c2={};_0x1d53c2[_0x127d('0x3c')]=_[_0x127d('0x3e')](db[_0x127d('0x38')][_0x127d('0x50')]);_0x1d53c2[_0x127d('0x3d')]=_[_0x127d('0x3e')](_0x316397[_0x127d('0x3d')]);_0x1d53c2[_0x127d('0x3f')]=_['intersection'](_0x1d53c2[_0x127d('0x3c')],_0x1d53c2[_0x127d('0x3d')]);_0x2903f3['attributes']=_[_0x127d('0x41')](_0x1d53c2[_0x127d('0x3c')],qs[_0x127d('0x42')](_0x316397[_0x127d('0x3d')][_0x127d('0x42')]));_0x2903f3[_0x127d('0x40')]=_0x2903f3[_0x127d('0x40')]['length']?_0x2903f3[_0x127d('0x40')]:_0x1d53c2[_0x127d('0x3c')];if(_0x316397[_0x127d('0x3d')][_0x127d('0x4c')]){_0x2903f3['include']=[{'all':!![]}];}_0x2903f3=_[_0x127d('0x48')]({},_0x2903f3,_0x316397[_0x127d('0x4b')]);return db[_0x127d('0x38')][_0x127d('0x51')](_0x2903f3)[_0x127d('0x30')](handleEntityNotFound(_0x20a5e8,null))[_0x127d('0x30')](respondWithResult(_0x20a5e8,null))[_0x127d('0x22')](handleError(_0x20a5e8,null));};exports[_0x127d('0x52')]=function(_0x51e626,_0x3ea635,_0x4cc53c){var _0x5a996b;return db[_0x127d('0x38')][_0x127d('0x52')](_0x51e626[_0x127d('0x53')],{'raw':!![]})['then'](function(_0x27e9bf){_0x5a996b=_0x27e9bf;return db[_0x127d('0x38')][_0x127d('0x4d')]({'raw':!![]});})['then'](function(_0x52391a){var _0x26de8e=fs[_0x127d('0x54')](path[_0x127d('0x55')](config[_0x127d('0x56')],_0x127d('0x57')),_0x127d('0x58'));var _0x5761a5=ejs[_0x127d('0x59')](_0x26de8e,{'contexts':_0x52391a||[]});fs['writeFileSync'](_0x127d('0x5a'),_0x5761a5);})[_0x127d('0x30')](function(){return respondWithRpcPromise(_0x127d('0x5b'),_0x127d('0x52'),{'module':'chan_sip.so'});})[_0x127d('0x30')](function(){var _0x58b076=_0x51e626[_0x127d('0x5c')][_0x127d('0x32')]({'plain':!![]});if(!_0x58b076)throw new Error(_0x127d('0x5d'));if(_0x58b076['role']===_0x127d('0x5c')){var _0x41e685=_0x5a996b['get']({'plain':!![]});return db[_0x127d('0x5e')]['find']({'where':{'name':_0x127d('0x5f'),'userProfileId':_0x58b076['userProfileId']},'raw':!![]})['then'](function(_0x531e79){if(_0x531e79&&_0x531e79['autoAssociation']===0x0){return db[_0x127d('0x60')]['create']({'name':_0x41e685[_0x127d('0x34')],'resourceId':_0x41e685['id'],'type':_0x531e79['name'],'sectionId':_0x531e79['id']},{})[_0x127d('0x30')](function(){return _0x5a996b;});}else{return _0x5a996b;}})[_0x127d('0x22')](function(_0x33e602){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33e602);throw _0x33e602;});}return _0x5a996b;})[_0x127d('0x30')](respondWithResult(_0x3ea635,0xc9))[_0x127d('0x22')](handleError(_0x3ea635,null));};exports['update']=function(_0x38395c,_0x4f55c3,_0x256aac){var _0x40b44e;return db['VoiceContext']['find']({'where':{'id':_0x38395c[_0x127d('0x4f')]['id']}})[_0x127d('0x30')](handleEntityNotFound(_0x4f55c3,null))[_0x127d('0x30')](saveUpdates(_0x38395c['body'],null))[_0x127d('0x30')](function(_0x3e104a){if(_0x3e104a){_0x40b44e=_0x3e104a;return db[_0x127d('0x38')][_0x127d('0x4d')]({'raw':!![]});}})[_0x127d('0x30')](function(_0x15fef9){var _0x1eaabe=fs[_0x127d('0x54')](path[_0x127d('0x55')](config[_0x127d('0x56')],_0x127d('0x57')),'utf8');var _0x297ea2=ejs[_0x127d('0x59')](_0x1eaabe,{'contexts':_0x15fef9||[]});fs['writeFileSync'](_0x127d('0x5a'),_0x297ea2);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});})[_0x127d('0x30')](function(){return _0x40b44e;})[_0x127d('0x30')](respondWithResult(_0x4f55c3,null))[_0x127d('0x22')](handleError(_0x4f55c3,null));};exports[_0x127d('0x31')]=function(_0x4c4a44,_0x7b0011,_0x5b6bb2){var _0x10f9fc;return db[_0x127d('0x38')][_0x127d('0x51')]({'where':{'id':_0x4c4a44['params']['id']}})['then'](handleEntityNotFound(_0x7b0011,null))[_0x127d('0x30')](removeEntity(_0x7b0011,null))[_0x127d('0x30')](function(){return db[_0x127d('0x38')][_0x127d('0x4d')]({'raw':!![]});})[_0x127d('0x30')](function(_0xe1c96e){var _0x3b66f4=fs[_0x127d('0x54')](path[_0x127d('0x55')](config[_0x127d('0x56')],'server/files/templates/context.ejs'),'utf8');var _0x470a2b=ejs['render'](_0x3b66f4,{'contexts':_0xe1c96e});fs['writeFileSync'](_0x127d('0x5a'),_0x470a2b);return respondWithRpcPromise(_0x127d('0x5b'),_0x127d('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x7b0011,null));}; \ No newline at end of file +var _0x2a49=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','Contexts','UserProfileResource','status','end','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','params','intersection','include','find','create','findAll','readFileSync','join','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','server/files/templates/context.ejs','writeFileSync','Reload','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x2a49,0xbe));var _0x92a4=function(_0x40c0eb,_0x1f2ca7){_0x40c0eb=_0x40c0eb-0x0;var _0x271ce6=_0x2a49[_0x40c0eb];return _0x271ce6;};'use strict';var emlformat=require(_0x92a4('0x0'));var rimraf=require(_0x92a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92a4('0x2'));var rp=require(_0x92a4('0x3'));var moment=require('moment');var BPromise=require(_0x92a4('0x4'));var Mustache=require(_0x92a4('0x5'));var util=require(_0x92a4('0x6'));var path=require('path');var sox=require(_0x92a4('0x7'));var csv=require('to-csv');var ejs=require(_0x92a4('0x8'));var fs=require('fs');var fs_extra=require(_0x92a4('0x9'));var _=require(_0x92a4('0xa'));var squel=require(_0x92a4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x92a4('0xc'));var Papa=require(_0x92a4('0xd'));var Redis=require(_0x92a4('0xe'));var authService=require(_0x92a4('0xf'));var qs=require(_0x92a4('0x10'));var as=require(_0x92a4('0x11'));var hardwareService=require(_0x92a4('0x12'));var logger=require(_0x92a4('0x13'))(_0x92a4('0x14'));var utils=require(_0x92a4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92a4('0x16'))['db'];var jayson=require(_0x92a4('0x17'));var client=jayson[_0x92a4('0x18')][_0x92a4('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2970b5,_0x52efe7,_0x48b4b0,_0x792d44){return new BPromise(function(_0x548bde,_0x300c78){var _0x154c62=_0x792d44||client;return _0x154c62[_0x92a4('0x1a')](_0x2970b5,_0x48b4b0)[_0x92a4('0x1b')](function(_0x3f147d){logger[_0x92a4('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x52efe7,_0x92a4('0x1d'));logger[_0x92a4('0x1e')](_0x92a4('0x1f'),_0x52efe7,_0x92a4('0x1d'),JSON[_0x92a4('0x20')](_0x3f147d));if(_0x3f147d[_0x92a4('0x21')]){if(_0x3f147d['error']['code']===0x1f4){logger['error'](_0x92a4('0x22'),_0x52efe7,_0x3f147d[_0x92a4('0x21')]['message']);return _0x300c78(_0x3f147d['error'][_0x92a4('0x23')]);}logger['error'](_0x92a4('0x22'),_0x52efe7,_0x3f147d[_0x92a4('0x21')][_0x92a4('0x23')]);return _0x548bde(_0x3f147d[_0x92a4('0x21')][_0x92a4('0x23')]);}else{logger[_0x92a4('0x1c')](_0x92a4('0x22'),_0x52efe7,_0x92a4('0x1d'));_0x548bde(_0x3f147d[_0x92a4('0x24')][_0x92a4('0x23')]);}})[_0x92a4('0x25')](function(_0x18b878){logger['error'](_0x92a4('0x22'),_0x52efe7,_0x18b878);_0x300c78(_0x18b878);});});}function respondWithStatusCode(_0x34f3c9,_0x160746){_0x160746=_0x160746||0xcc;return function(_0x36a75d){if(_0x36a75d){return _0x34f3c9[_0x92a4('0x26')](_0x160746);}return _0x34f3c9['status'](_0x160746)['end']();};}function respondWithResult(_0x51c7e1,_0x5c0f70){_0x5c0f70=_0x5c0f70||0xc8;return function(_0x1ca837){if(_0x1ca837){return _0x51c7e1['status'](_0x5c0f70)[_0x92a4('0x27')](_0x1ca837);}};}function respondWithFilteredResult(_0x543a7e,_0x4af838){return function(_0x2c5fe6){if(_0x2c5fe6){var _0x3be335=typeof _0x4af838[_0x92a4('0x28')]===_0x92a4('0x29')&&typeof _0x4af838[_0x92a4('0x2a')]==='undefined';var _0xaba5a3=_0x2c5fe6[_0x92a4('0x2b')];var _0xb760f0=_0x3be335?0x0:_0x4af838['offset'];var _0x26870b=_0x3be335?_0x2c5fe6[_0x92a4('0x2b')]:_0x4af838[_0x92a4('0x28')]+_0x4af838[_0x92a4('0x2a')];var _0x57ca4a;if(_0x26870b>=_0xaba5a3){_0x26870b=_0xaba5a3;_0x57ca4a=0xc8;}else{_0x57ca4a=0xce;}_0x543a7e['status'](_0x57ca4a);return _0x543a7e[_0x92a4('0x2c')](_0x92a4('0x2d'),_0xb760f0+'-'+_0x26870b+'/'+_0xaba5a3)['json'](_0x2c5fe6);}return null;};}function patchUpdates(_0x32c438){return function(_0x43f3eb){try{jsonpatch[_0x92a4('0x2e')](_0x43f3eb,_0x32c438,!![]);}catch(_0x509351){return BPromise['reject'](_0x509351);}return _0x43f3eb[_0x92a4('0x2f')]();};}function saveUpdates(_0x406dd0,_0x3a49ca){return function(_0x44268b){if(_0x44268b){return _0x44268b[_0x92a4('0x30')](_0x406dd0)[_0x92a4('0x1b')](function(_0x127f35){return _0x127f35;});}return null;};}function removeEntity(_0x64714d,_0x46b798){return function(_0x28a4f9){if(_0x28a4f9){return _0x28a4f9[_0x92a4('0x31')]()[_0x92a4('0x1b')](function(){var _0x2f3f34=_0x28a4f9[_0x92a4('0x32')]({'plain':!![]});var _0x367351=_0x92a4('0x33');return db[_0x92a4('0x34')][_0x92a4('0x31')]({'where':{'type':_0x367351,'resourceId':_0x2f3f34['id']}})['then'](function(){return _0x28a4f9;});})[_0x92a4('0x1b')](function(){_0x64714d[_0x92a4('0x35')](0xcc)[_0x92a4('0x36')]();});}};}function handleEntityNotFound(_0x4e7ede,_0x48f8d6){return function(_0x3a9b09){if(!_0x3a9b09){_0x4e7ede[_0x92a4('0x26')](0x194);}return _0x3a9b09;};}function handleError(_0x318119,_0x20d8f5){_0x20d8f5=_0x20d8f5||0x1f4;return function(_0x4b1876){logger[_0x92a4('0x21')](_0x4b1876['stack']);if(_0x4b1876[_0x92a4('0x37')]){delete _0x4b1876[_0x92a4('0x37')];}_0x318119[_0x92a4('0x35')](_0x20d8f5)['send'](_0x4b1876);};}exports[_0x92a4('0x38')]=function(_0x17d35a,_0x1324d3){var _0x22450a={},_0x986be={},_0x3c4ac0={'count':0x0,'rows':[]};var _0xc81568=_[_0x92a4('0x39')](db[_0x92a4('0x3a')][_0x92a4('0x3b')],function(_0x189ef5){return{'name':_0x189ef5[_0x92a4('0x3c')],'type':_0x189ef5[_0x92a4('0x3d')][_0x92a4('0x3e')]};});_0x986be['model']=_['map'](_0xc81568,_0x92a4('0x37'));_0x986be[_0x92a4('0x3f')]=_[_0x92a4('0x40')](_0x17d35a[_0x92a4('0x3f')]);_0x986be[_0x92a4('0x41')]=_['intersection'](_0x986be[_0x92a4('0x42')],_0x986be['query']);_0x22450a['attributes']=_['intersection'](_0x986be[_0x92a4('0x42')],qs['fields'](_0x17d35a[_0x92a4('0x3f')][_0x92a4('0x43')]));_0x22450a[_0x92a4('0x44')]=_0x22450a[_0x92a4('0x44')][_0x92a4('0x45')]?_0x22450a[_0x92a4('0x44')]:_0x986be[_0x92a4('0x42')];if(!_0x17d35a[_0x92a4('0x3f')][_0x92a4('0x46')](_0x92a4('0x47'))){_0x22450a[_0x92a4('0x2a')]=qs[_0x92a4('0x2a')](_0x17d35a[_0x92a4('0x3f')][_0x92a4('0x2a')]);_0x22450a[_0x92a4('0x28')]=qs['offset'](_0x17d35a[_0x92a4('0x3f')]['offset']);}_0x22450a[_0x92a4('0x48')]=qs[_0x92a4('0x49')](_0x17d35a[_0x92a4('0x3f')][_0x92a4('0x49')]);_0x22450a[_0x92a4('0x4a')]=qs['filters'](_[_0x92a4('0x4b')](_0x17d35a[_0x92a4('0x3f')],_0x986be[_0x92a4('0x41')]),_0xc81568);if(_0x17d35a['query'][_0x92a4('0x4c')]){_0x22450a[_0x92a4('0x4a')]=_[_0x92a4('0x4d')](_0x22450a[_0x92a4('0x4a')],{'$or':_[_0x92a4('0x39')](_0xc81568,function(_0x2ab4b8){if(_0x2ab4b8['type']!==_0x92a4('0x4e')){var _0x1f9464={};_0x1f9464[_0x2ab4b8['name']]={'$like':'%'+_0x17d35a[_0x92a4('0x3f')][_0x92a4('0x4c')]+'%'};return _0x1f9464;}})});}_0x22450a=_[_0x92a4('0x4d')]({},_0x22450a,_0x17d35a[_0x92a4('0x4f')]);var _0x52b686={'where':_0x22450a['where']};return db[_0x92a4('0x3a')][_0x92a4('0x2b')](_0x52b686)[_0x92a4('0x1b')](function(_0x2197f1){_0x3c4ac0[_0x92a4('0x2b')]=_0x2197f1;if(_0x17d35a[_0x92a4('0x3f')][_0x92a4('0x50')]){_0x22450a['include']=[{'all':!![]}];}return db[_0x92a4('0x3a')]['findAll'](_0x22450a);})[_0x92a4('0x1b')](function(_0x56eaa6){_0x3c4ac0['rows']=_0x56eaa6;return _0x3c4ac0;})['then'](respondWithFilteredResult(_0x1324d3,_0x22450a))[_0x92a4('0x25')](handleError(_0x1324d3,null));};exports[_0x92a4('0x51')]=function(_0x289695,_0x54060a){var _0x1b7f4c={'raw':![],'where':{'id':_0x289695[_0x92a4('0x52')]['id']}},_0x19a494={};_0x19a494[_0x92a4('0x42')]=_['keys'](db['VoiceContext']['rawAttributes']);_0x19a494[_0x92a4('0x3f')]=_[_0x92a4('0x40')](_0x289695['query']);_0x19a494[_0x92a4('0x41')]=_[_0x92a4('0x53')](_0x19a494[_0x92a4('0x42')],_0x19a494[_0x92a4('0x3f')]);_0x1b7f4c[_0x92a4('0x44')]=_[_0x92a4('0x53')](_0x19a494[_0x92a4('0x42')],qs[_0x92a4('0x43')](_0x289695[_0x92a4('0x3f')][_0x92a4('0x43')]));_0x1b7f4c['attributes']=_0x1b7f4c[_0x92a4('0x44')][_0x92a4('0x45')]?_0x1b7f4c[_0x92a4('0x44')]:_0x19a494[_0x92a4('0x42')];if(_0x289695['query'][_0x92a4('0x50')]){_0x1b7f4c[_0x92a4('0x54')]=[{'all':!![]}];}_0x1b7f4c=_['merge']({},_0x1b7f4c,_0x289695[_0x92a4('0x4f')]);return db[_0x92a4('0x3a')][_0x92a4('0x55')](_0x1b7f4c)['then'](handleEntityNotFound(_0x54060a,null))[_0x92a4('0x1b')](respondWithResult(_0x54060a,null))['catch'](handleError(_0x54060a,null));};exports['create']=function(_0x19dff0,_0x21021c,_0x5d5016){var _0x567ac9;return db[_0x92a4('0x3a')][_0x92a4('0x56')](_0x19dff0['body'],{'raw':!![]})[_0x92a4('0x1b')](function(_0x2599b3){_0x567ac9=_0x2599b3;return db[_0x92a4('0x3a')][_0x92a4('0x57')]({'raw':!![]});})[_0x92a4('0x1b')](function(_0xd3ec6c){var _0x5cfd14=fs[_0x92a4('0x58')](path[_0x92a4('0x59')](config[_0x92a4('0x5a')],'server/files/templates/context.ejs'),_0x92a4('0x5b'));var _0x27f502=ejs[_0x92a4('0x5c')](_0x5cfd14,{'contexts':_0xd3ec6c||[]});fs['writeFileSync'](_0x92a4('0x5d'),_0x27f502);})['then'](function(){return respondWithRpcPromise('Reload',_0x92a4('0x56'),{'module':_0x92a4('0x5e')});})[_0x92a4('0x1b')](function(){var _0xc1d289=_0x19dff0['user']['get']({'plain':!![]});if(!_0xc1d289)throw new Error(_0x92a4('0x5f'));if(_0xc1d289[_0x92a4('0x60')]===_0x92a4('0x61')){var _0x1fb200=_0x567ac9['get']({'plain':!![]});return db[_0x92a4('0x62')][_0x92a4('0x55')]({'where':{'name':_0x92a4('0x33'),'userProfileId':_0xc1d289['userProfileId']},'raw':!![]})[_0x92a4('0x1b')](function(_0x9b2664){if(_0x9b2664&&_0x9b2664['autoAssociation']===0x0){return db[_0x92a4('0x34')][_0x92a4('0x56')]({'name':_0x1fb200['name'],'resourceId':_0x1fb200['id'],'type':_0x9b2664['name'],'sectionId':_0x9b2664['id']},{})[_0x92a4('0x1b')](function(){return _0x567ac9;});}else{return _0x567ac9;}})[_0x92a4('0x25')](function(_0x2cc1b5){logger['error'](_0x92a4('0x63'),_0x2cc1b5);throw _0x2cc1b5;});}return _0x567ac9;})[_0x92a4('0x1b')](respondWithResult(_0x21021c,0xc9))[_0x92a4('0x25')](handleError(_0x21021c,null));};exports[_0x92a4('0x30')]=function(_0x1d8391,_0x3e657b,_0x4e6f6){var _0x5b1859;return db['VoiceContext'][_0x92a4('0x55')]({'where':{'id':_0x1d8391[_0x92a4('0x52')]['id']}})[_0x92a4('0x1b')](handleEntityNotFound(_0x3e657b,null))[_0x92a4('0x1b')](saveUpdates(_0x1d8391[_0x92a4('0x64')],null))[_0x92a4('0x1b')](function(_0x248b2c){if(_0x248b2c){_0x5b1859=_0x248b2c;return db[_0x92a4('0x3a')][_0x92a4('0x57')]({'raw':!![]});}})[_0x92a4('0x1b')](function(_0x34a65f){var _0x12cf4e=fs[_0x92a4('0x58')](path[_0x92a4('0x59')](config[_0x92a4('0x5a')],_0x92a4('0x65')),'utf8');var _0x159b4d=ejs['render'](_0x12cf4e,{'contexts':_0x34a65f||[]});fs[_0x92a4('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x159b4d);})['then'](function(){return respondWithRpcPromise(_0x92a4('0x67'),_0x92a4('0x30'),{'module':_0x92a4('0x5e')});})[_0x92a4('0x1b')](function(){return _0x5b1859;})[_0x92a4('0x1b')](respondWithResult(_0x3e657b,null))[_0x92a4('0x25')](handleError(_0x3e657b,null));};exports[_0x92a4('0x31')]=function(_0x322ce9,_0x5387c4,_0x2cca9f){var _0x48d96a;return db[_0x92a4('0x3a')][_0x92a4('0x55')]({'where':{'id':_0x322ce9[_0x92a4('0x52')]['id']}})[_0x92a4('0x1b')](handleEntityNotFound(_0x5387c4,null))[_0x92a4('0x1b')](removeEntity(_0x5387c4,null))[_0x92a4('0x1b')](function(){return db['VoiceContext'][_0x92a4('0x57')]({'raw':!![]});})[_0x92a4('0x1b')](function(_0x648d30){var _0x507c60=fs[_0x92a4('0x58')](path[_0x92a4('0x59')](config[_0x92a4('0x5a')],_0x92a4('0x65')),_0x92a4('0x5b'));var _0x3f3b50=ejs['render'](_0x507c60,{'contexts':_0x648d30});fs[_0x92a4('0x66')](_0x92a4('0x5d'),_0x3f3b50);return respondWithRpcPromise(_0x92a4('0x67'),_0x92a4('0x31'),{'module':_0x92a4('0x5e')});})[_0x92a4('0x25')](handleError(_0x5387c4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9af616d..c6bbb54 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 _0x623d=['VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x623d,0x109));var _0xd623=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x623d[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xd623('0x0'));var util=require(_0xd623('0x1'));var logger=require(_0xd623('0x2'))(_0xd623('0x3'));var moment=require('moment');var BPromise=require(_0xd623('0x4'));var rp=require(_0xd623('0x5'));var fs=require('fs');var path=require(_0xd623('0x6'));var rimraf=require(_0xd623('0x7'));var config=require(_0xd623('0x8'));var attributes=require(_0xd623('0x9'));module['exports']=function(_0x3d7f9c,_0x43a580){return _0x3d7f9c[_0xd623('0xa')](_0xd623('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9e2=['voice_contexts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./voiceContext.attributes','define'];(function(_0x53e540,_0x57927e){var _0x2740b2=function(_0x3340a8){while(--_0x3340a8){_0x53e540['push'](_0x53e540['shift']());}};_0x2740b2(++_0x57927e);}(_0xf9e2,0x79));var _0x2f9e=function(_0x53fbdb,_0x451417){_0x53fbdb=_0x53fbdb-0x0;var _0x2a15f2=_0xf9e2[_0x53fbdb];return _0x2a15f2;};'use strict';var _=require(_0x2f9e('0x0'));var util=require(_0x2f9e('0x1'));var logger=require(_0x2f9e('0x2'))(_0x2f9e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f9e('0x4'));var fs=require('fs');var path=require(_0x2f9e('0x5'));var rimraf=require('rimraf');var config=require(_0x2f9e('0x6'));var attributes=require(_0x2f9e('0x7'));module['exports']=function(_0x69d192,_0x47dc9f){return _0x69d192[_0x2f9e('0x8')]('VoiceContext',attributes,{'tableName':_0x2f9e('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 340a7d4..1b007f8 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 _0x720e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x5efe60,_0x39b2d4){var _0x1ea999=function(_0x5a709c){while(--_0x5a709c){_0x5efe60['push'](_0x5efe60['shift']());}};_0x1ea999(++_0x39b2d4);}(_0x720e,0x1cb));var _0xe720=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x720e[_0x33c9f8];return _0x2d7004;};'use strict';var _=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var moment=require(_0xe720('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe720('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe720('0x4'));var logger=require(_0xe720('0x5'))(_0xe720('0x6'));var config=require(_0xe720('0x7'));var jayson=require(_0xe720('0x8'));var client=jayson[_0xe720('0x9')][_0xe720('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ffe24,_0x3e38ca,_0x19642d){return new BPromise(function(_0x4e715c,_0x4a3b70){return client['request'](_0x4ffe24,_0x19642d)[_0xe720('0xb')](function(_0x2e08e7){logger[_0xe720('0xc')]('VoiceContext,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));logger[_0xe720('0xe')](_0xe720('0xf'),_0x3e38ca,_0xe720('0xd'),JSON[_0xe720('0x10')](_0x2e08e7));if(_0x2e08e7[_0xe720('0x11')]){if(_0x2e08e7['error']['code']===0x1f4){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);return _0x4a3b70(_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);}logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')]['message']);return _0x4e715c(_0x2e08e7['error'][_0xe720('0x13')]);}else{logger[_0xe720('0xc')]('VoiceContext,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));_0x4e715c(_0x2e08e7[_0xe720('0x14')]['message']);}})[_0xe720('0x15')](function(_0x5ac1e2){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x5ac1e2);_0x4a3b70(_0x5ac1e2);});});} \ No newline at end of file +var _0x9f95=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash'];(function(_0x429969,_0x118fa0){var _0x2fbb20=function(_0x1d8123){while(--_0x1d8123){_0x429969['push'](_0x429969['shift']());}};_0x2fbb20(++_0x118fa0);}(_0x9f95,0x97));var _0x59f9=function(_0x4c3c88,_0x42f102){_0x4c3c88=_0x4c3c88-0x0;var _0x1587d4=_0x9f95[_0x4c3c88];return _0x1587d4;};'use strict';var _=require(_0x59f9('0x0'));var util=require('util');var moment=require(_0x59f9('0x1'));var BPromise=require(_0x59f9('0x2'));var rs=require(_0x59f9('0x3'));var fs=require('fs');var Redis=require(_0x59f9('0x4'));var db=require(_0x59f9('0x5'))['db'];var utils=require(_0x59f9('0x6'));var logger=require(_0x59f9('0x7'))('rpc');var config=require(_0x59f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x59f9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556d82,_0x38e904,_0x2707ec){return new BPromise(function(_0x910eaa,_0x13a2ad){return client[_0x59f9('0xa')](_0x556d82,_0x2707ec)['then'](function(_0x3d7ccb){logger['info'](_0x59f9('0xb'),_0x38e904,'request\x20sent');logger[_0x59f9('0xc')](_0x59f9('0xd'),_0x38e904,'request\x20sent',JSON[_0x59f9('0xe')](_0x3d7ccb));if(_0x3d7ccb[_0x59f9('0xf')]){if(_0x3d7ccb[_0x59f9('0xf')]['code']===0x1f4){logger[_0x59f9('0xf')](_0x59f9('0xb'),_0x38e904,_0x3d7ccb[_0x59f9('0xf')][_0x59f9('0x10')]);return _0x13a2ad(_0x3d7ccb[_0x59f9('0xf')]['message']);}logger[_0x59f9('0xf')](_0x59f9('0xb'),_0x38e904,_0x3d7ccb['error'][_0x59f9('0x10')]);return _0x910eaa(_0x3d7ccb['error'][_0x59f9('0x10')]);}else{logger['info'](_0x59f9('0xb'),_0x38e904,_0x59f9('0x11'));_0x910eaa(_0x3d7ccb['result'][_0x59f9('0x10')]);}})[_0x59f9('0x12')](function(_0x109e4f){logger[_0x59f9('0xf')](_0x59f9('0xb'),_0x38e904,_0x109e4f);_0x13a2ad(_0x109e4f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 5e86dbe..c7d6557 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 _0xf491=['/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x5ce33c,_0x5c75a9){var _0x40c7d4=function(_0xdc973a){while(--_0xdc973a){_0x5ce33c['push'](_0x5ce33c['shift']());}};_0x40c7d4(++_0x5c75a9);}(_0xf491,0x178));var _0x1f49=function(_0x34ac43,_0x4ba863){_0x34ac43=_0x34ac43-0x0;var _0x4d4a7c=_0xf491[_0x34ac43];return _0x4d4a7c;};'use strict';var multer=require(_0x1f49('0x0'));var util=require(_0x1f49('0x1'));var path=require(_0x1f49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f49('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f49('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f49('0x5'));var controller=require(_0x1f49('0x6'));router[_0x1f49('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f49('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1f49('0x7')](_0x1f49('0x8'),auth[_0x1f49('0x9')](),controller['show']);router[_0x1f49('0xa')]('/',auth[_0x1f49('0x9')](),controller[_0x1f49('0xb')]);router[_0x1f49('0xc')]('/:id',auth[_0x1f49('0x9')](),controller[_0x1f49('0xd')]);router[_0x1f49('0xe')](_0x1f49('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x1f49('0xf')]=router; \ No newline at end of file +var _0x521c=['/:id','create','put','delete','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x521c,0x6b));var _0xc521=function(_0x151487,_0x20ef30){_0x151487=_0x151487-0x0;var _0x35f2b3=_0x521c[_0x151487];return _0x35f2b3;};'use strict';var multer=require('multer');var util=require(_0xc521('0x0'));var path=require(_0xc521('0x1'));var timeout=require(_0xc521('0x2'));var express=require('express');var router=express[_0xc521('0x3')]();var fs_extra=require(_0xc521('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc521('0x5'));var controller=require(_0xc521('0x6'));router[_0xc521('0x7')]('/',auth[_0xc521('0x8')](),controller[_0xc521('0x9')]);router[_0xc521('0x7')](_0xc521('0xa'),auth['isAuthenticated'](),controller[_0xc521('0xb')]);router[_0xc521('0x7')](_0xc521('0xc'),auth[_0xc521('0x8')](),controller['show']);router['post']('/',auth[_0xc521('0x8')](),controller[_0xc521('0xd')]);router[_0xc521('0xe')](_0xc521('0xc'),auth[_0xc521('0x8')](),controller['update']);router[_0xc521('0xf')](_0xc521('0xc'),auth[_0xc521('0x8')](),controller['destroy']);module[_0xc521('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 2ec5c12..eb2158f 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x5413b5,_0x50a487){var _0x2f958e=function(_0xc823e4){while(--_0xc823e4){_0x5413b5['push'](_0x5413b5['shift']());}};_0x2f958e(++_0x50a487);}(_0x34e8,0x12c));var _0x834e=function(_0x570b91,_0x118b43){_0x570b91=_0x570b91-0x0;var _0x46a341=_0x34e8[_0x570b91];return _0x46a341;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c768cb8..3808751 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 _0xc533=['describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','destroy'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0xc533,0xe5));var _0x3c53=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xc533[_0x454165];return _0x56db53;};'use strict';var emlformat=require(_0x3c53('0x0'));var rimraf=require(_0x3c53('0x1'));var zipdir=require(_0x3c53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c53('0x3'));var moment=require(_0x3c53('0x4'));var BPromise=require(_0x3c53('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3c53('0x6'));var sox=require('sox');var csv=require(_0x3c53('0x7'));var ejs=require(_0x3c53('0x8'));var fs=require('fs');var fs_extra=require(_0x3c53('0x9'));var _=require(_0x3c53('0xa'));var squel=require(_0x3c53('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c53('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c53('0x7'));var querystring=require('querystring');var Papa=require(_0x3c53('0xd'));var Redis=require(_0x3c53('0xe'));var authService=require(_0x3c53('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c53('0x10'));var logger=require(_0x3c53('0x11'))('api');var utils=require(_0x3c53('0x12'));var config=require(_0x3c53('0x13'));var licenseUtil=require(_0x3c53('0x14'));var db=require(_0x3c53('0x15'))['db'];function respondWithStatusCode(_0x3cf45d,_0x1904f1){_0x1904f1=_0x1904f1||0xcc;return function(_0x3553d3){if(_0x3553d3){return _0x3cf45d['sendStatus'](_0x1904f1);}return _0x3cf45d[_0x3c53('0x16')](_0x1904f1)[_0x3c53('0x17')]();};}function respondWithResult(_0x4faa8c,_0x46ca28){_0x46ca28=_0x46ca28||0xc8;return function(_0x5b669b){if(_0x5b669b){return _0x4faa8c['status'](_0x46ca28)[_0x3c53('0x18')](_0x5b669b);}};}function respondWithFilteredResult(_0x35c2c1,_0x503fb9){return function(_0x8be068){if(_0x8be068){var _0x8b7c74=typeof _0x503fb9[_0x3c53('0x19')]===_0x3c53('0x1a')&&typeof _0x503fb9[_0x3c53('0x1b')]===_0x3c53('0x1a');var _0x15715d=_0x8be068[_0x3c53('0x1c')];var _0x5f02c0=_0x8b7c74?0x0:_0x503fb9['offset'];var _0x6fe2dd=_0x8b7c74?_0x8be068[_0x3c53('0x1c')]:_0x503fb9[_0x3c53('0x19')]+_0x503fb9[_0x3c53('0x1b')];var _0x50bbc1;if(_0x6fe2dd>=_0x15715d){_0x6fe2dd=_0x15715d;_0x50bbc1=0xc8;}else{_0x50bbc1=0xce;}_0x35c2c1[_0x3c53('0x16')](_0x50bbc1);return _0x35c2c1[_0x3c53('0x1d')](_0x3c53('0x1e'),_0x5f02c0+'-'+_0x6fe2dd+'/'+_0x15715d)['json'](_0x8be068);}return null;};}function patchUpdates(_0x56ef5f){return function(_0x3e04a0){try{jsonpatch['apply'](_0x3e04a0,_0x56ef5f,!![]);}catch(_0x4ed653){return BPromise['reject'](_0x4ed653);}return _0x3e04a0[_0x3c53('0x1f')]();};}function saveUpdates(_0x1ddf26,_0x3fc714){return function(_0xf19b67){if(_0xf19b67){return _0xf19b67[_0x3c53('0x20')](_0x1ddf26)[_0x3c53('0x21')](function(_0x3c2636){return _0x3c2636;});}return null;};}function removeEntity(_0x87f90f,_0x1bbd1d){return function(_0x2dd61c){if(_0x2dd61c){return _0x2dd61c['destroy']()['then'](function(){_0x87f90f[_0x3c53('0x16')](0xcc)[_0x3c53('0x17')]();});}};}function handleEntityNotFound(_0xe1f9e6,_0x482a99){return function(_0x358526){if(!_0x358526){_0xe1f9e6[_0x3c53('0x22')](0x194);}return _0x358526;};}function handleError(_0x520ab1,_0x4d2429){_0x4d2429=_0x4d2429||0x1f4;return function(_0x1e26fe){logger[_0x3c53('0x23')](_0x1e26fe[_0x3c53('0x24')]);if(_0x1e26fe[_0x3c53('0x25')]){delete _0x1e26fe['name'];}_0x520ab1['status'](_0x4d2429)[_0x3c53('0x26')](_0x1e26fe);};}exports[_0x3c53('0x27')]=function(_0x26bf4a,_0x157d09){var _0x3c7e50={},_0x345172={},_0x371d77={'count':0x0,'rows':[]};var _0xf3356e=_[_0x3c53('0x28')](db[_0x3c53('0x29')][_0x3c53('0x2a')],function(_0x1a0fac){return{'name':_0x1a0fac[_0x3c53('0x2b')],'type':_0x1a0fac[_0x3c53('0x2c')][_0x3c53('0x2d')]};});_0x345172[_0x3c53('0x2e')]=_[_0x3c53('0x28')](_0xf3356e,_0x3c53('0x25'));_0x345172[_0x3c53('0x2f')]=_[_0x3c53('0x30')](_0x26bf4a[_0x3c53('0x2f')]);_0x345172[_0x3c53('0x31')]=_[_0x3c53('0x32')](_0x345172[_0x3c53('0x2e')],_0x345172['query']);_0x3c7e50[_0x3c53('0x33')]=_[_0x3c53('0x32')](_0x345172[_0x3c53('0x2e')],qs[_0x3c53('0x34')](_0x26bf4a['query'][_0x3c53('0x34')]));_0x3c7e50['attributes']=_0x3c7e50[_0x3c53('0x33')][_0x3c53('0x35')]?_0x3c7e50[_0x3c53('0x33')]:_0x345172['model'];if(!_0x26bf4a[_0x3c53('0x2f')][_0x3c53('0x36')](_0x3c53('0x37'))){_0x3c7e50[_0x3c53('0x1b')]=qs['limit'](_0x26bf4a['query'][_0x3c53('0x1b')]);_0x3c7e50[_0x3c53('0x19')]=qs[_0x3c53('0x19')](_0x26bf4a[_0x3c53('0x2f')]['offset']);}_0x3c7e50[_0x3c53('0x38')]=qs[_0x3c53('0x39')](_0x26bf4a['query']['sort']);_0x3c7e50['where']=qs['filters'](_[_0x3c53('0x3a')](_0x26bf4a[_0x3c53('0x2f')],_0x345172[_0x3c53('0x31')]),_0xf3356e);if(_0x26bf4a[_0x3c53('0x2f')][_0x3c53('0x3b')]){_0x3c7e50[_0x3c53('0x3c')]=_['merge'](_0x3c7e50[_0x3c53('0x3c')],{'$or':_[_0x3c53('0x28')](_0xf3356e,function(_0x22cfbc){if(_0x22cfbc[_0x3c53('0x2c')]!==_0x3c53('0x3d')){var _0x5c3a2d={};_0x5c3a2d[_0x22cfbc['name']]={'$like':'%'+_0x26bf4a[_0x3c53('0x2f')]['filter']+'%'};return _0x5c3a2d;}})});}_0x3c7e50=_[_0x3c53('0x3e')]({},_0x3c7e50,_0x26bf4a['options']);var _0x1b785b={'where':_0x3c7e50[_0x3c53('0x3c')]};return db[_0x3c53('0x29')]['count'](_0x1b785b)['then'](function(_0x6e37fe){_0x371d77[_0x3c53('0x1c')]=_0x6e37fe;if(_0x26bf4a[_0x3c53('0x2f')][_0x3c53('0x3f')]){_0x3c7e50[_0x3c53('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x3c53('0x41')](_0x3c7e50);})[_0x3c53('0x21')](function(_0x53a188){_0x371d77[_0x3c53('0x42')]=_0x53a188;return _0x371d77;})[_0x3c53('0x21')](respondWithFilteredResult(_0x157d09,_0x3c7e50))[_0x3c53('0x43')](handleError(_0x157d09,null));};exports[_0x3c53('0x44')]=function(_0x545c00,_0x595ed2){var _0x46bd40={'raw':!![],'where':{'id':_0x545c00[_0x3c53('0x45')]['id']}},_0xda79b2={};_0xda79b2['model']=_['keys'](db[_0x3c53('0x29')][_0x3c53('0x2a')]);_0xda79b2[_0x3c53('0x2f')]=_[_0x3c53('0x30')](_0x545c00[_0x3c53('0x2f')]);_0xda79b2[_0x3c53('0x31')]=_[_0x3c53('0x32')](_0xda79b2[_0x3c53('0x2e')],_0xda79b2[_0x3c53('0x2f')]);_0x46bd40[_0x3c53('0x33')]=_[_0x3c53('0x32')](_0xda79b2[_0x3c53('0x2e')],qs[_0x3c53('0x34')](_0x545c00[_0x3c53('0x2f')][_0x3c53('0x34')]));_0x46bd40['attributes']=_0x46bd40[_0x3c53('0x33')][_0x3c53('0x35')]?_0x46bd40[_0x3c53('0x33')]:_0xda79b2[_0x3c53('0x2e')];if(_0x545c00['query']['includeAll']){_0x46bd40[_0x3c53('0x40')]=[{'all':!![]}];}_0x46bd40=_[_0x3c53('0x3e')]({},_0x46bd40,_0x545c00[_0x3c53('0x46')]);return db['VoiceDialReport']['find'](_0x46bd40)[_0x3c53('0x21')](handleEntityNotFound(_0x595ed2,null))[_0x3c53('0x21')](respondWithResult(_0x595ed2,null))[_0x3c53('0x43')](handleError(_0x595ed2,null));};exports[_0x3c53('0x47')]=function(_0x10e44b,_0x25295c){return db['VoiceDialReport'][_0x3c53('0x47')](_0x10e44b[_0x3c53('0x48')],{})['then'](respondWithResult(_0x25295c,0xc9))[_0x3c53('0x43')](handleError(_0x25295c,null));};exports[_0x3c53('0x20')]=function(_0x23de90,_0x10b810){if(_0x23de90['body']['id']){delete _0x23de90['body']['id'];}return db[_0x3c53('0x29')][_0x3c53('0x49')]({'where':{'id':_0x23de90['params']['id']}})[_0x3c53('0x21')](handleEntityNotFound(_0x10b810,null))[_0x3c53('0x21')](saveUpdates(_0x23de90[_0x3c53('0x48')],null))['then'](respondWithResult(_0x10b810,null))[_0x3c53('0x43')](handleError(_0x10b810,null));};exports[_0x3c53('0x4a')]=function(_0x4986a3,_0x31e9d8){return db[_0x3c53('0x29')][_0x3c53('0x49')]({'where':{'id':_0x4986a3[_0x3c53('0x45')]['id']}})[_0x3c53('0x21')](handleEntityNotFound(_0x31e9d8,null))[_0x3c53('0x21')](removeEntity(_0x31e9d8,null))[_0x3c53('0x43')](handleError(_0x31e9d8,null));};exports['describe']=function(_0x5db3b3,_0x3a3621){return db[_0x3c53('0x29')][_0x3c53('0x4b')]()[_0x3c53('0x21')](respondWithResult(_0x3a3621,null))[_0x3c53('0x43')](handleError(_0x3a3621,null));}; \ No newline at end of file +var _0xc0f0=['attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','length','find','create','body','update','destroy','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject','save','then','error','stack','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','name','query','keys','intersection','model'];(function(_0x2f4631,_0x208a19){var _0x137674=function(_0x2c7d04){while(--_0x2c7d04){_0x2f4631['push'](_0x2f4631['shift']());}};_0x137674(++_0x208a19);}(_0xc0f0,0x18b));var _0x0c0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0f0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c0f('0x0'));var jsonpatch=require(_0x0c0f('0x1'));var rp=require(_0x0c0f('0x2'));var moment=require('moment');var BPromise=require(_0x0c0f('0x3'));var Mustache=require(_0x0c0f('0x4'));var util=require(_0x0c0f('0x5'));var path=require(_0x0c0f('0x6'));var sox=require(_0x0c0f('0x7'));var csv=require('to-csv');var ejs=require(_0x0c0f('0x8'));var fs=require('fs');var fs_extra=require(_0x0c0f('0x9'));var _=require(_0x0c0f('0xa'));var squel=require('squel');var crypto=require(_0x0c0f('0xb'));var jsforce=require(_0x0c0f('0xc'));var deskjs=require(_0x0c0f('0xd'));var toCsv=require(_0x0c0f('0xe'));var querystring=require('querystring');var Papa=require(_0x0c0f('0xf'));var Redis=require(_0x0c0f('0x10'));var authService=require(_0x0c0f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c0f('0x12'));var logger=require('../../config/logger')(_0x0c0f('0x13'));var utils=require(_0x0c0f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c0f('0x15'))['db'];function respondWithStatusCode(_0x131093,_0x26d9f5){_0x26d9f5=_0x26d9f5||0xcc;return function(_0x11a99a){if(_0x11a99a){return _0x131093['sendStatus'](_0x26d9f5);}return _0x131093[_0x0c0f('0x16')](_0x26d9f5)[_0x0c0f('0x17')]();};}function respondWithResult(_0x153fd8,_0x5b81a0){_0x5b81a0=_0x5b81a0||0xc8;return function(_0x323108){if(_0x323108){return _0x153fd8[_0x0c0f('0x16')](_0x5b81a0)['json'](_0x323108);}};}function respondWithFilteredResult(_0x38e510,_0x3f61cf){return function(_0x375126){if(_0x375126){var _0x448a4a=typeof _0x3f61cf[_0x0c0f('0x18')]==='undefined'&&typeof _0x3f61cf[_0x0c0f('0x19')]===_0x0c0f('0x1a');var _0x5e4256=_0x375126[_0x0c0f('0x1b')];var _0x4e1c21=_0x448a4a?0x0:_0x3f61cf[_0x0c0f('0x18')];var _0x1be20d=_0x448a4a?_0x375126[_0x0c0f('0x1b')]:_0x3f61cf['offset']+_0x3f61cf[_0x0c0f('0x19')];var _0x4c2d58;if(_0x1be20d>=_0x5e4256){_0x1be20d=_0x5e4256;_0x4c2d58=0xc8;}else{_0x4c2d58=0xce;}_0x38e510[_0x0c0f('0x16')](_0x4c2d58);return _0x38e510[_0x0c0f('0x1c')]('Content-Range',_0x4e1c21+'-'+_0x1be20d+'/'+_0x5e4256)[_0x0c0f('0x1d')](_0x375126);}return null;};}function patchUpdates(_0x13f3ae){return function(_0x31530e){try{jsonpatch[_0x0c0f('0x1e')](_0x31530e,_0x13f3ae,!![]);}catch(_0x5ab03b){return BPromise[_0x0c0f('0x1f')](_0x5ab03b);}return _0x31530e[_0x0c0f('0x20')]();};}function saveUpdates(_0x1bf48f,_0x28af10){return function(_0x1149fc){if(_0x1149fc){return _0x1149fc['update'](_0x1bf48f)[_0x0c0f('0x21')](function(_0x44f0b6){return _0x44f0b6;});}return null;};}function removeEntity(_0xdd890b,_0x55ce39){return function(_0x3a1ab8){if(_0x3a1ab8){return _0x3a1ab8['destroy']()[_0x0c0f('0x21')](function(){_0xdd890b[_0x0c0f('0x16')](0xcc)[_0x0c0f('0x17')]();});}};}function handleEntityNotFound(_0x5d1a6a,_0x1ffe32){return function(_0x2caa66){if(!_0x2caa66){_0x5d1a6a['sendStatus'](0x194);}return _0x2caa66;};}function handleError(_0x136bd8,_0x5879e6){_0x5879e6=_0x5879e6||0x1f4;return function(_0x47d698){logger[_0x0c0f('0x22')](_0x47d698[_0x0c0f('0x23')]);if(_0x47d698['name']){delete _0x47d698['name'];}_0x136bd8[_0x0c0f('0x16')](_0x5879e6)[_0x0c0f('0x24')](_0x47d698);};}exports[_0x0c0f('0x25')]=function(_0x31161d,_0x1e6960){var _0x7cc11f={},_0x3d995f={},_0x4136a5={'count':0x0,'rows':[]};var _0x2e5715=_[_0x0c0f('0x26')](db[_0x0c0f('0x27')][_0x0c0f('0x28')],function(_0x830710){return{'name':_0x830710[_0x0c0f('0x29')],'type':_0x830710[_0x0c0f('0x2a')][_0x0c0f('0x2b')]};});_0x3d995f['model']=_['map'](_0x2e5715,_0x0c0f('0x2c'));_0x3d995f[_0x0c0f('0x2d')]=_[_0x0c0f('0x2e')](_0x31161d[_0x0c0f('0x2d')]);_0x3d995f['filters']=_[_0x0c0f('0x2f')](_0x3d995f[_0x0c0f('0x30')],_0x3d995f[_0x0c0f('0x2d')]);_0x7cc11f[_0x0c0f('0x31')]=_[_0x0c0f('0x2f')](_0x3d995f[_0x0c0f('0x30')],qs['fields'](_0x31161d[_0x0c0f('0x2d')]['fields']));_0x7cc11f[_0x0c0f('0x31')]=_0x7cc11f[_0x0c0f('0x31')]['length']?_0x7cc11f['attributes']:_0x3d995f[_0x0c0f('0x30')];if(!_0x31161d[_0x0c0f('0x2d')]['hasOwnProperty'](_0x0c0f('0x32'))){_0x7cc11f[_0x0c0f('0x19')]=qs[_0x0c0f('0x19')](_0x31161d[_0x0c0f('0x2d')][_0x0c0f('0x19')]);_0x7cc11f[_0x0c0f('0x18')]=qs[_0x0c0f('0x18')](_0x31161d['query']['offset']);}_0x7cc11f[_0x0c0f('0x33')]=qs['sort'](_0x31161d[_0x0c0f('0x2d')][_0x0c0f('0x34')]);_0x7cc11f[_0x0c0f('0x35')]=qs[_0x0c0f('0x36')](_[_0x0c0f('0x37')](_0x31161d[_0x0c0f('0x2d')],_0x3d995f[_0x0c0f('0x36')]),_0x2e5715);if(_0x31161d[_0x0c0f('0x2d')][_0x0c0f('0x38')]){_0x7cc11f[_0x0c0f('0x35')]=_[_0x0c0f('0x39')](_0x7cc11f['where'],{'$or':_[_0x0c0f('0x26')](_0x2e5715,function(_0x1c03e2){if(_0x1c03e2['type']!==_0x0c0f('0x3a')){var _0x4f4ec3={};_0x4f4ec3[_0x1c03e2[_0x0c0f('0x2c')]]={'$like':'%'+_0x31161d['query'][_0x0c0f('0x38')]+'%'};return _0x4f4ec3;}})});}_0x7cc11f=_['merge']({},_0x7cc11f,_0x31161d[_0x0c0f('0x3b')]);var _0x5f2cb7={'where':_0x7cc11f['where']};return db[_0x0c0f('0x27')][_0x0c0f('0x1b')](_0x5f2cb7)[_0x0c0f('0x21')](function(_0x4e1806){_0x4136a5[_0x0c0f('0x1b')]=_0x4e1806;if(_0x31161d[_0x0c0f('0x2d')][_0x0c0f('0x3c')]){_0x7cc11f[_0x0c0f('0x3d')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x0c0f('0x3e')](_0x7cc11f);})[_0x0c0f('0x21')](function(_0x5ac443){_0x4136a5['rows']=_0x5ac443;return _0x4136a5;})['then'](respondWithFilteredResult(_0x1e6960,_0x7cc11f))[_0x0c0f('0x3f')](handleError(_0x1e6960,null));};exports[_0x0c0f('0x40')]=function(_0x5d4352,_0x2a2cbf){var _0x4b34db={'raw':!![],'where':{'id':_0x5d4352[_0x0c0f('0x41')]['id']}},_0x253596={};_0x253596[_0x0c0f('0x30')]=_[_0x0c0f('0x2e')](db[_0x0c0f('0x27')][_0x0c0f('0x28')]);_0x253596[_0x0c0f('0x2d')]=_['keys'](_0x5d4352[_0x0c0f('0x2d')]);_0x253596[_0x0c0f('0x36')]=_[_0x0c0f('0x2f')](_0x253596['model'],_0x253596[_0x0c0f('0x2d')]);_0x4b34db[_0x0c0f('0x31')]=_[_0x0c0f('0x2f')](_0x253596[_0x0c0f('0x30')],qs['fields'](_0x5d4352[_0x0c0f('0x2d')][_0x0c0f('0x42')]));_0x4b34db[_0x0c0f('0x31')]=_0x4b34db[_0x0c0f('0x31')][_0x0c0f('0x43')]?_0x4b34db[_0x0c0f('0x31')]:_0x253596[_0x0c0f('0x30')];if(_0x5d4352[_0x0c0f('0x2d')][_0x0c0f('0x3c')]){_0x4b34db[_0x0c0f('0x3d')]=[{'all':!![]}];}_0x4b34db=_[_0x0c0f('0x39')]({},_0x4b34db,_0x5d4352['options']);return db[_0x0c0f('0x27')][_0x0c0f('0x44')](_0x4b34db)[_0x0c0f('0x21')](handleEntityNotFound(_0x2a2cbf,null))[_0x0c0f('0x21')](respondWithResult(_0x2a2cbf,null))[_0x0c0f('0x3f')](handleError(_0x2a2cbf,null));};exports['create']=function(_0x5516f6,_0x44af44){return db[_0x0c0f('0x27')][_0x0c0f('0x45')](_0x5516f6[_0x0c0f('0x46')],{})['then'](respondWithResult(_0x44af44,0xc9))[_0x0c0f('0x3f')](handleError(_0x44af44,null));};exports[_0x0c0f('0x47')]=function(_0x358859,_0x5d9975){if(_0x358859[_0x0c0f('0x46')]['id']){delete _0x358859[_0x0c0f('0x46')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x358859[_0x0c0f('0x41')]['id']}})[_0x0c0f('0x21')](handleEntityNotFound(_0x5d9975,null))[_0x0c0f('0x21')](saveUpdates(_0x358859[_0x0c0f('0x46')],null))[_0x0c0f('0x21')](respondWithResult(_0x5d9975,null))[_0x0c0f('0x3f')](handleError(_0x5d9975,null));};exports[_0x0c0f('0x48')]=function(_0xb2cf24,_0x28eb81){return db[_0x0c0f('0x27')][_0x0c0f('0x44')]({'where':{'id':_0xb2cf24['params']['id']}})[_0x0c0f('0x21')](handleEntityNotFound(_0x28eb81,null))[_0x0c0f('0x21')](removeEntity(_0x28eb81,null))[_0x0c0f('0x3f')](handleError(_0x28eb81,null));};exports[_0x0c0f('0x49')]=function(_0x36c40b,_0xa65b2){return db[_0x0c0f('0x27')][_0x0c0f('0x49')]()['then'](respondWithResult(_0xa65b2,null))[_0x0c0f('0x3f')](handleError(_0xa65b2,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d971855..eeddde2 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 _0x2bd6=['VoiceDialReport','report_dial','lodash','util','api','moment','bluebird','../../config/environment','./voiceDialReport.attributes'];(function(_0x3de5e8,_0x323e91){var _0x5e7818=function(_0x1efcff){while(--_0x1efcff){_0x3de5e8['push'](_0x3de5e8['shift']());}};_0x5e7818(++_0x323e91);}(_0x2bd6,0x173));var _0x62bd=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x2bd6[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x62bd('0x0'));var util=require(_0x62bd('0x1'));var logger=require('../../config/logger')(_0x62bd('0x2'));var moment=require(_0x62bd('0x3'));var BPromise=require(_0x62bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x62bd('0x5'));var attributes=require(_0x62bd('0x6'));module['exports']=function(_0x12972c,_0x4aff9d){return _0x12972c['define'](_0x62bd('0x7'),attributes,{'tableName':_0x62bd('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa920=['report_dial','uniqueid','lodash','../../config/logger','moment','bluebird','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa920,0x110));var _0x0a92=function(_0x40e63f,_0xc08e9){_0x40e63f=_0x40e63f-0x0;var _0x1d9be5=_0xa920[_0x40e63f];return _0x1d9be5;};'use strict';var _=require(_0x0a92('0x0'));var util=require('util');var logger=require(_0x0a92('0x1'))('api');var moment=require(_0x0a92('0x2'));var BPromise=require(_0x0a92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0a92('0x4'));var attributes=require(_0x0a92('0x5'));module['exports']=function(_0x187c51,_0x2433e5){return _0x187c51[_0x0a92('0x6')](_0x0a92('0x7'),attributes,{'tableName':_0x0a92('0x8'),'paranoid':![],'indexes':[{'fields':[_0x0a92('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 3e556af..282caef 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 _0x445f=['request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','debug','body','attributes','limit','UpdateVoiceDialReport','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0x445f,0x1a6));var _0xf445=function(_0x316489,_0x3b1eed){_0x316489=_0x316489-0x0;var _0xb14740=_0x445f[_0x316489];return _0xb14740;};'use strict';var _=require(_0xf445('0x0'));var util=require(_0xf445('0x1'));var moment=require(_0xf445('0x2'));var BPromise=require(_0xf445('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf445('0x4'))['db'];var utils=require(_0xf445('0x5'));var logger=require(_0xf445('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf445('0x7'));var client=jayson[_0xf445('0x8')][_0xf445('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3805c8,_0x2a622d,_0x4b4d66){return new BPromise(function(_0x55e93c,_0x30f24c){return client['request'](_0x3805c8,_0x4b4d66)[_0xf445('0xa')](function(_0xd18657){logger[_0xf445('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2a622d,_0xf445('0xc'));logger['debug'](_0xf445('0xd'),_0x2a622d,_0xf445('0xc'),JSON[_0xf445('0xe')](_0xd18657));if(_0xd18657[_0xf445('0xf')]){if(_0xd18657[_0xf445('0xf')][_0xf445('0x10')]===0x1f4){logger[_0xf445('0xf')](_0xf445('0x11'),_0x2a622d,_0xd18657[_0xf445('0xf')][_0xf445('0x12')]);return _0x30f24c(_0xd18657[_0xf445('0xf')]['message']);}logger[_0xf445('0xf')](_0xf445('0x11'),_0x2a622d,_0xd18657[_0xf445('0xf')][_0xf445('0x12')]);return _0x55e93c(_0xd18657[_0xf445('0xf')][_0xf445('0x12')]);}else{logger[_0xf445('0xb')](_0xf445('0x11'),_0x2a622d,'request\x20sent');_0x55e93c(_0xd18657[_0xf445('0x13')]['message']);}})['catch'](function(_0x433641){logger[_0xf445('0xf')](_0xf445('0x11'),_0x2a622d,_0x433641);_0x30f24c(_0x433641);});});}exports[_0xf445('0x14')]=function(_0x22ec50){var _0x369156=this;return new Promise(function(_0x41da21,_0x6e287f){return db[_0xf445('0x15')][_0xf445('0x16')](_0x22ec50['body'],{'raw':_0x22ec50[_0xf445('0x17')]?_0x22ec50[_0xf445('0x17')][_0xf445('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x6cf5a5){logger[_0xf445('0xb')]('CreateVoiceDialReport',_0x22ec50);logger[_0xf445('0x19')](_0xf445('0x14'),_0x22ec50,JSON[_0xf445('0xe')](_0x6cf5a5));_0x41da21(_0x6cf5a5);})['catch'](function(_0x2453bf){logger[_0xf445('0xf')](_0xf445('0x14'),_0x2453bf[_0xf445('0x12')],_0x22ec50);_0x6e287f(_0x369156[_0xf445('0xf')](0x1f4,_0x2453bf['message']));});});};exports['UpdateVoiceDialReport']=function(_0x5747c9){var _0x199e28=this;return new Promise(function(_0x2472ad,_0x34792d){return db[_0xf445('0x15')]['update'](_0x5747c9[_0xf445('0x1a')],{'raw':_0x5747c9[_0xf445('0x17')]?_0x5747c9['options'][_0xf445('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5747c9[_0xf445('0x17')]?_0x5747c9['options']['where']||null:null,'attributes':_0x5747c9[_0xf445('0x17')]?_0x5747c9['options'][_0xf445('0x1b')]||null:null,'limit':_0x5747c9[_0xf445('0x17')]?_0x5747c9[_0xf445('0x17')][_0xf445('0x1c')]||null:null})[_0xf445('0xa')](function(_0x3e401a){logger[_0xf445('0xb')](_0xf445('0x1d'),_0x5747c9);logger['debug'](_0xf445('0x1d'),_0x5747c9,JSON[_0xf445('0xe')](_0x3e401a));_0x2472ad(_0x3e401a);})[_0xf445('0x1e')](function(_0x850de8){logger[_0xf445('0xf')](_0xf445('0x1d'),_0x850de8['message'],_0x5747c9);_0x34792d(_0x199e28[_0xf445('0xf')](0x1f4,_0x850de8[_0xf445('0x12')]));});});}; \ No newline at end of file +var _0x8fc2=['stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','where','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x3c1a29,_0x1aac42){var _0x46e7e6=function(_0x14213d){while(--_0x14213d){_0x3c1a29['push'](_0x3c1a29['shift']());}};_0x46e7e6(++_0x1aac42);}(_0x8fc2,0xa4));var _0x28fc=function(_0x436038,_0x30fdcb){_0x436038=_0x436038-0x0;var _0x27ba95=_0x8fc2[_0x436038];return _0x27ba95;};'use strict';var _=require('lodash');var util=require(_0x28fc('0x0'));var moment=require('moment');var BPromise=require(_0x28fc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28fc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x28fc('0x3'));var logger=require(_0x28fc('0x4'))(_0x28fc('0x5'));var config=require(_0x28fc('0x6'));var jayson=require(_0x28fc('0x7'));var client=jayson[_0x28fc('0x8')][_0x28fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb4b6ff,_0xaaa3d5,_0x4b79c6){return new BPromise(function(_0x479320,_0xa05e11){return client['request'](_0xb4b6ff,_0x4b79c6)[_0x28fc('0xa')](function(_0x567383){logger[_0x28fc('0xb')](_0x28fc('0xc'),_0xaaa3d5,_0x28fc('0xd'));logger[_0x28fc('0xe')](_0x28fc('0xf'),_0xaaa3d5,_0x28fc('0xd'),JSON[_0x28fc('0x10')](_0x567383));if(_0x567383[_0x28fc('0x11')]){if(_0x567383[_0x28fc('0x11')]['code']===0x1f4){logger['error'](_0x28fc('0xc'),_0xaaa3d5,_0x567383['error'][_0x28fc('0x12')]);return _0xa05e11(_0x567383[_0x28fc('0x11')]['message']);}logger['error'](_0x28fc('0xc'),_0xaaa3d5,_0x567383[_0x28fc('0x11')][_0x28fc('0x12')]);return _0x479320(_0x567383[_0x28fc('0x11')][_0x28fc('0x12')]);}else{logger[_0x28fc('0xb')](_0x28fc('0xc'),_0xaaa3d5,_0x28fc('0xd'));_0x479320(_0x567383[_0x28fc('0x13')]['message']);}})[_0x28fc('0x14')](function(_0x302c4d){logger[_0x28fc('0x11')](_0x28fc('0xc'),_0xaaa3d5,_0x302c4d);_0xa05e11(_0x302c4d);});});}exports[_0x28fc('0x15')]=function(_0x5c2140){var _0xa46e0=this;return new Promise(function(_0x142a98,_0x3506dc){return db[_0x28fc('0x16')][_0x28fc('0x17')](_0x5c2140[_0x28fc('0x18')],{'raw':_0x5c2140[_0x28fc('0x19')]?_0x5c2140['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x18b50f){logger[_0x28fc('0xb')]('CreateVoiceDialReport',_0x5c2140);logger[_0x28fc('0xe')](_0x28fc('0x15'),_0x5c2140,JSON['stringify'](_0x18b50f));_0x142a98(_0x18b50f);})[_0x28fc('0x14')](function(_0x7e22d3){logger[_0x28fc('0x11')](_0x28fc('0x15'),_0x7e22d3[_0x28fc('0x12')],_0x5c2140);_0x3506dc(_0xa46e0[_0x28fc('0x11')](0x1f4,_0x7e22d3[_0x28fc('0x12')]));});});};exports[_0x28fc('0x1a')]=function(_0x16710a){var _0x1fd4bb=this;return new Promise(function(_0x4779ec,_0x56b1ab){return db[_0x28fc('0x16')][_0x28fc('0x1b')](_0x16710a[_0x28fc('0x18')],{'raw':_0x16710a['options']?_0x16710a[_0x28fc('0x19')][_0x28fc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16710a[_0x28fc('0x19')]?_0x16710a[_0x28fc('0x19')][_0x28fc('0x1d')]||null:null,'attributes':_0x16710a[_0x28fc('0x19')]?_0x16710a[_0x28fc('0x19')]['attributes']||null:null,'limit':_0x16710a[_0x28fc('0x19')]?_0x16710a[_0x28fc('0x19')]['limit']||null:null})['then'](function(_0x5365d9){logger[_0x28fc('0xb')](_0x28fc('0x1a'),_0x16710a);logger['debug']('UpdateVoiceDialReport',_0x16710a,JSON[_0x28fc('0x10')](_0x5365d9));_0x4779ec(_0x5365d9);})[_0x28fc('0x14')](function(_0x344cbc){logger[_0x28fc('0x11')](_0x28fc('0x1a'),_0x344cbc[_0x28fc('0x12')],_0x16710a);_0x56b1ab(_0x1fd4bb['error'](0x1f4,_0x344cbc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8f064b1..4544326 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 _0x9bfd=['post','create','/:id/applications','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','/:id','show'];(function(_0x38ef9b,_0x27e000){var _0x4c097d=function(_0x561520){while(--_0x561520){_0x38ef9b['push'](_0x38ef9b['shift']());}};_0x4c097d(++_0x27e000);}(_0x9bfd,0x15a));var _0xd9bf=function(_0x3ef448,_0x1537bd){_0x3ef448=_0x3ef448-0x0;var _0x1359bb=_0x9bfd[_0x3ef448];return _0x1359bb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd9bf('0x0'));var express=require(_0xd9bf('0x1'));var router=express[_0xd9bf('0x2')]();var fs_extra=require(_0xd9bf('0x3'));var auth=require(_0xd9bf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd9bf('0x5'));var controller=require(_0xd9bf('0x6'));router['get']('/',auth[_0xd9bf('0x7')](),controller[_0xd9bf('0x8')]);router['get'](_0xd9bf('0x9'),auth['isAuthenticated'](),controller[_0xd9bf('0xa')]);router[_0xd9bf('0xb')]('/',auth[_0xd9bf('0x7')](),controller[_0xd9bf('0xc')]);router[_0xd9bf('0xb')](_0xd9bf('0xd'),auth[_0xd9bf('0x7')](),controller['addApplications']);router['put'](_0xd9bf('0x9'),auth[_0xd9bf('0x7')](),controller[_0xd9bf('0xe')]);router[_0xd9bf('0xf')](_0xd9bf('0x9'),auth[_0xd9bf('0x7')](),controller[_0xd9bf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4fd4=['post','create','/:id/applications','addApplications','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show'];(function(_0x1e1c1d,_0x5e5221){var _0x44d344=function(_0x5a7217){while(--_0x5a7217){_0x1e1c1d['push'](_0x1e1c1d['shift']());}};_0x44d344(++_0x5e5221);}(_0x4fd4,0x1ab));var _0x44fd=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4fd4[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x44fd('0x0'));var util=require(_0x44fd('0x1'));var path=require(_0x44fd('0x2'));var timeout=require(_0x44fd('0x3'));var express=require(_0x44fd('0x4'));var router=express[_0x44fd('0x5')]();var fs_extra=require(_0x44fd('0x6'));var auth=require(_0x44fd('0x7'));var interaction=require(_0x44fd('0x8'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x44fd('0x9')](),controller[_0x44fd('0xa')]);router[_0x44fd('0xb')]('/:id',auth[_0x44fd('0x9')](),controller[_0x44fd('0xc')]);router[_0x44fd('0xd')]('/',auth[_0x44fd('0x9')](),controller[_0x44fd('0xe')]);router[_0x44fd('0xd')](_0x44fd('0xf'),auth[_0x44fd('0x9')](),controller[_0x44fd('0x10')]);router[_0x44fd('0x11')]('/:id',auth[_0x44fd('0x9')](),controller[_0x44fd('0x12')]);router[_0x44fd('0x13')](_0x44fd('0x14'),auth['isAuthenticated'](),controller[_0x44fd('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d83ce2d..1f65023 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 _0xf84e=['system','any','*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','internal','inbound-fax','outbound-fax'];(function(_0x55cf84,_0x3f0804){var _0x253f3c=function(_0x4e3f49){while(--_0x4e3f49){_0x55cf84['push'](_0x55cf84['shift']());}};_0x253f3c(++_0x3f0804);}(_0xf84e,0xf6));var _0xef84=function(_0x1c07d8,_0x2a5c87){_0x1c07d8=_0x1c07d8-0x0;var _0x3952c9=_0xf84e[_0x1c07d8];return _0x3952c9;};'use strict';var Sequelize=require(_0xef84('0x0'));module[_0xef84('0x1')]={'context':{'type':Sequelize[_0xef84('0x2')],'allowNull':![],'unique':_0xef84('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xef84('0x2')],'allowNull':![],'unique':_0xef84('0x3')},'priority':{'type':Sequelize[_0xef84('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xef84('0x3')},'tag':{'type':Sequelize[_0xef84('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xef84('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xef84('0x5')]('inbound','outbound',_0xef84('0x6'),_0xef84('0x7'),_0xef84('0x8'),_0xef84('0x9'),_0xef84('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xef84('0x2')],'allowNull':![],'defaultValue':_0xef84('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xef84('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xef84('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xef84('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xef84('0xd')]},'recordingFormat':{'type':Sequelize[_0xef84('0x2')],'defaultValue':_0xef84('0xe')},'answer':{'type':Sequelize[_0xef84('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2420d7){return this[_0xef84('0xf')](_0xef84('0x10'));}},'alias':{'type':Sequelize[_0xef84('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9c5e=['any','*,*,*,*','INTEGER','wav','VIRTUAL','sequelize','STRING','compositeIndex','NoOp','inbound','internal','inbound-fax','system'];(function(_0x52ab17,_0xf51f71){var _0x4f420f=function(_0x269965){while(--_0x269965){_0x52ab17['push'](_0x52ab17['shift']());}};_0x4f420f(++_0xf51f71);}(_0x9c5e,0x7a));var _0xe9c5=function(_0x3657a7,_0x2395a3){_0x3657a7=_0x3657a7-0x0;var _0x4a1dc5=_0x9c5e[_0x3657a7];return _0x4a1dc5;};'use strict';var Sequelize=require(_0xe9c5('0x0'));module['exports']={'context':{'type':Sequelize[_0xe9c5('0x1')],'allowNull':![],'unique':_0xe9c5('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe9c5('0x1')],'allowNull':![],'unique':_0xe9c5('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xe9c5('0x2')},'tag':{'type':Sequelize[_0xe9c5('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe9c5('0x1')],'allowNull':![],'defaultValue':_0xe9c5('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xe9c5('0x4'),'outbound',_0xe9c5('0x5'),_0xe9c5('0x6'),'outbound-fax',_0xe9c5('0x7'),_0xe9c5('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xe9c5('0x1')]},'interval':{'type':Sequelize[_0xe9c5('0x1')],'allowNull':![],'defaultValue':_0xe9c5('0x9')},'IntervalId':{'type':Sequelize[_0xe9c5('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe9c5('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe9c5('0xa')]},'recordingFormat':{'type':Sequelize[_0xe9c5('0x1')],'defaultValue':_0xe9c5('0xb')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xe9c5('0xc')],'get':function(_0x5a3420){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xe9c5('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index e3dea1d..f288c26 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 _0xc32a=['addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','destroy','then','inbound','OutboundRoutes','InternalRoutes','internal','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','intersection','fields','length','attributes','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','body','startsWith','exten','create','user','get','userProfileId','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0xc32a,0x64));var _0xac32=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0xc32a[_0x23e6bb];return _0x1e3b4c;};'use strict';var _=require(_0xac32('0x0'));var Redis=require('ioredis');var qs=require(_0xac32('0x1'));var logger=require(_0xac32('0x2'))(_0xac32('0x3'));var config=require('../../config/environment');var db=require(_0xac32('0x4'))['db'];config[_0xac32('0x5')]=_[_0xac32('0x6')](config[_0xac32('0x5')],{'host':_0xac32('0x7'),'port':0x18eb});var socket=require(_0xac32('0x8'))(new Redis(config[_0xac32('0x5')]));require(_0xac32('0x9'))[_0xac32('0xa')](socket);function respondWithStatusCode(_0x2a7ddb,_0x3a07e2){_0x3a07e2=_0x3a07e2||0xcc;return function(_0x2a6eca){if(_0x2a6eca){return _0x2a7ddb[_0xac32('0xb')](_0x3a07e2);}return _0x2a7ddb[_0xac32('0xc')](_0x3a07e2)[_0xac32('0xd')]();};}function respondWithResult(_0x3be219,_0x352c1d){_0x352c1d=_0x352c1d||0xc8;return function(_0x455184){if(_0x455184){return _0x3be219[_0xac32('0xc')](_0x352c1d)[_0xac32('0xe')](_0x455184);}};}function respondWithFilteredResult(_0x5e81c2,_0x2648a8){return function(_0x5ed16c){if(_0x5ed16c){var _0x5bf385=typeof _0x2648a8[_0xac32('0xf')]===_0xac32('0x10')&&typeof _0x2648a8[_0xac32('0x11')]===_0xac32('0x10');var _0x1ec235=_0x5ed16c[_0xac32('0x12')];var _0x1b213f=_0x5bf385?0x0:_0x2648a8[_0xac32('0xf')];var _0x5b756b=_0x5bf385?_0x5ed16c[_0xac32('0x12')]:_0x2648a8['offset']+_0x2648a8[_0xac32('0x11')];var _0x51d708;if(_0x5b756b>=_0x1ec235){_0x5b756b=_0x1ec235;_0x51d708=0xc8;}else{_0x51d708=0xce;}_0x5e81c2[_0xac32('0xc')](_0x51d708);return _0x5e81c2['set']('Content-Range',_0x1b213f+'-'+_0x5b756b+'/'+_0x1ec235)['json'](_0x5ed16c);}return null;};}function removeEntity(_0x5cc192){return function(_0x1be599){if(_0x1be599){return _0x1be599[_0xac32('0x13')]()[_0xac32('0x14')](function(){var _0x490d6e=_0x1be599['get']({'plain':!![]});var _0x1b2d79=[{'name':'InboundRoutes','value':_0xac32('0x15'),'ignore':![]},{'name':_0xac32('0x16'),'value':'outbound','ignore':![]},{'name':_0xac32('0x17'),'value':_0xac32('0x18'),'ignore':![]}];var _0x14304b=_(_0x1b2d79)['filter']('ignore')[_0xac32('0x19')]('value')[_0xac32('0x1a')]();if(_[_0xac32('0x1b')](_0x14304b,_0x490d6e[_0xac32('0x1c')])){return;}var _0x597652=_['find'](_0x1b2d79,[_0xac32('0x1a'),_0x490d6e[_0xac32('0x1c')]])[_0xac32('0x1d')];return db[_0xac32('0x1e')][_0xac32('0x13')]({'where':{'type':_0x597652,'resourceId':_0x490d6e['id']}})[_0xac32('0x14')](function(){return _0x1be599;});})[_0xac32('0x14')](function(){_0x5cc192[_0xac32('0xc')](0xcc)[_0xac32('0xd')]();});}};}function handleEntityNotFound(_0x3b44f9){return function(_0x195d36){if(!_0x195d36){_0x3b44f9[_0xac32('0xb')](0x194);}return _0x195d36;};}function handleError(_0xde81f4,_0x153cdd){_0x153cdd=_0x153cdd||0x1f4;return function(_0x553421){logger[_0xac32('0x1f')](_0x553421[_0xac32('0x20')]);if(_0x553421[_0xac32('0x1d')]){delete _0x553421[_0xac32('0x1d')];}_0xde81f4['status'](_0x153cdd)[_0xac32('0x21')](_0x553421);};}exports[_0xac32('0x22')]=function(_0x59cd3b,_0x4994ab){var _0x1de897={},_0x10ac45={},_0xa58452={'count':0x0,'rows':[]};var _0x33c644=_[_0xac32('0x19')](db[_0xac32('0x23')][_0xac32('0x24')],function(_0x5d8996){return{'name':_0x5d8996[_0xac32('0x25')],'type':_0x5d8996[_0xac32('0x1c')][_0xac32('0x26')]};});_0x10ac45[_0xac32('0x27')]=_[_0xac32('0x19')](_0x33c644,_0xac32('0x1d'));_0x10ac45['query']=_[_0xac32('0x28')](_0x59cd3b[_0xac32('0x29')]);_0x10ac45['filters']=_[_0xac32('0x2a')](_0x10ac45['model'],_0x10ac45[_0xac32('0x29')]);_0x1de897['attributes']=_['intersection'](_0x10ac45['model'],qs['fields'](_0x59cd3b[_0xac32('0x29')][_0xac32('0x2b')]));_0x1de897['attributes']=_0x1de897['attributes'][_0xac32('0x2c')]?_0x1de897[_0xac32('0x2d')]:_0x10ac45[_0xac32('0x27')];if(!_0x59cd3b[_0xac32('0x29')]['hasOwnProperty']('nolimit')){_0x1de897[_0xac32('0x11')]=qs[_0xac32('0x11')](_0x59cd3b[_0xac32('0x29')][_0xac32('0x11')]);_0x1de897[_0xac32('0xf')]=qs['offset'](_0x59cd3b['query'][_0xac32('0xf')]);}_0x1de897['order']=qs[_0xac32('0x2e')](_0x59cd3b[_0xac32('0x29')][_0xac32('0x2e')]);_0x1de897[_0xac32('0x2f')]=qs['filters'](_[_0xac32('0x30')](_0x59cd3b[_0xac32('0x29')],_0x10ac45['filters']),_0x33c644);if(_0x59cd3b[_0xac32('0x29')][_0xac32('0x31')]){_0x1de897[_0xac32('0x2f')]=_[_0xac32('0x32')](_0x1de897[_0xac32('0x2f')],{'$or':_[_0xac32('0x19')](_0x33c644,function(_0x5b83d3){if(_0x5b83d3[_0xac32('0x1c')]!==_0xac32('0x33')){var _0x223491={};_0x223491[_0x5b83d3[_0xac32('0x1d')]]={'$like':'%'+_0x59cd3b[_0xac32('0x29')][_0xac32('0x31')]+'%'};return _0x223491;}})});}_0x1de897=_[_0xac32('0x32')]({},_0x1de897,_0x59cd3b[_0xac32('0x34')]);var _0x210553={'where':_0x1de897[_0xac32('0x2f')]};return db['VoiceExtension']['count'](_0x210553)[_0xac32('0x14')](function(_0x357e26){_0xa58452['count']=_0x357e26;if(_0x59cd3b['query'][_0xac32('0x35')]){_0x1de897[_0xac32('0x36')]=[{'all':!![]}];}return db[_0xac32('0x23')][_0xac32('0x37')](_0x1de897);})['then'](function(_0x3fee18){_0xa58452[_0xac32('0x38')]=_0x3fee18;return _0xa58452;})[_0xac32('0x14')](respondWithFilteredResult(_0x4994ab,_0x1de897))[_0xac32('0x39')](handleError(_0x4994ab,null));};exports[_0xac32('0x3a')]=function(_0x41ae78,_0x4c3a2d){var _0x5cd3b8={'raw':![],'where':{'id':_0x41ae78[_0xac32('0x3b')]['id']}},_0x5ef44a={};_0x5ef44a[_0xac32('0x27')]=_['keys'](db[_0xac32('0x23')]['rawAttributes']);_0x5ef44a[_0xac32('0x29')]=_[_0xac32('0x28')](_0x41ae78[_0xac32('0x29')]);_0x5ef44a[_0xac32('0x3c')]=_[_0xac32('0x2a')](_0x5ef44a['model'],_0x5ef44a[_0xac32('0x29')]);_0x5cd3b8[_0xac32('0x2d')]=_['intersection'](_0x5ef44a[_0xac32('0x27')],qs[_0xac32('0x2b')](_0x41ae78[_0xac32('0x29')][_0xac32('0x2b')]));_0x5cd3b8[_0xac32('0x2d')]=_0x5cd3b8[_0xac32('0x2d')][_0xac32('0x2c')]?_0x5cd3b8[_0xac32('0x2d')]:_0x5ef44a[_0xac32('0x27')];if(_0x41ae78[_0xac32('0x29')]['includeAll']){_0x5cd3b8[_0xac32('0x36')]=[{'all':!![]}];}_0x5cd3b8=_['merge']({},_0x5cd3b8,_0x41ae78[_0xac32('0x34')]);return db['VoiceExtension']['find'](_0x5cd3b8)['then'](handleEntityNotFound(_0x4c3a2d,null))['then'](respondWithResult(_0x4c3a2d,null))[_0xac32('0x39')](handleError(_0x4c3a2d,null));};exports[_0xac32('0x13')]=function(_0xf663c4,_0x21260e){return db[_0xac32('0x23')][_0xac32('0x3d')]({'where':{'id':_0xf663c4['params']['id']}})[_0xac32('0x14')](handleEntityNotFound(_0x21260e,null))['then'](removeEntity(_0x21260e,null))[_0xac32('0x39')](handleError(_0x21260e,null));};exports['create']=function(_0x851c95,_0x5dd799){if(_0x851c95[_0xac32('0x3e')]['type']==='outbound'&&!_[_0xac32('0x3f')](_0x851c95['body'][_0xac32('0x40')],'_')){_0x851c95[_0xac32('0x3e')]['exten']='_'['concat'](_0x851c95[_0xac32('0x3e')][_0xac32('0x40')]);}return db[_0xac32('0x23')][_0xac32('0x41')](_0x851c95[_0xac32('0x3e')],{'raw':![]})['then'](function(_0x269446){var _0x55e029=_0x851c95[_0xac32('0x42')][_0xac32('0x43')]({'plain':!![]});if(!_0x55e029)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55e029['role']===_0xac32('0x42')){var _0x13ce7d=_0x269446[_0xac32('0x43')]({'plain':!![]});var _0x6a43ab=[{'name':'InboundRoutes','value':_0xac32('0x15')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x485cbb=_[_0xac32('0x3d')](_0x6a43ab,['value',_0x13ce7d[_0xac32('0x1c')]])[_0xac32('0x1d')];return db['UserProfileSection'][_0xac32('0x3d')]({'where':{'name':_0x485cbb,'userProfileId':_0x55e029[_0xac32('0x44')]},'raw':!![]})['then'](function(_0x164728){if(_0x164728&&_0x164728[_0xac32('0x45')]===0x0){return db[_0xac32('0x1e')][_0xac32('0x41')]({'name':_0x13ce7d['name'],'resourceId':_0x13ce7d['id'],'type':_0x164728[_0xac32('0x1d')],'sectionId':_0x164728['id']},{})[_0xac32('0x14')](function(){return _0x269446;});}else{return _0x269446;}})[_0xac32('0x39')](function(_0x53026b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53026b);throw _0x53026b;});}return _0x269446;})[_0xac32('0x14')](respondWithResult(_0x5dd799,0xc9))[_0xac32('0x39')](handleError(_0x5dd799,null));};exports[_0xac32('0x46')]=function(_0x5ad9ee,_0x2c9fc2){if(_0x5ad9ee['body']['id']){delete _0x5ad9ee['body']['id'];}return db[_0xac32('0x23')][_0xac32('0x3d')]({'where':{'id':_0x5ad9ee[_0xac32('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2c9fc2,null))[_0xac32('0x14')](function(_0x1bf674){if(_0x1bf674){return db[_0xac32('0x23')]['update'](_['pick'](_0x5ad9ee['body'],[_0xac32('0x40'),_0xac32('0x47'),_0xac32('0x48'),_0xac32('0x49'),_0xac32('0x4a'),_0xac32('0x4b'),'alias']),{'where':{'context':_0x1bf674[_0xac32('0x47')],'exten':_0x1bf674[_0xac32('0x40')]},'individualHooks':!![]})['then'](function(_0x182b57){return _0x182b57;});}return null;})[_0xac32('0x14')](respondWithStatusCode(_0x2c9fc2,null))[_0xac32('0x39')](handleError(_0x2c9fc2,null));};exports[_0xac32('0x4c')]=function(_0x48431d,_0x5bcdcd){var _0x5dccde=_0x48431d[_0xac32('0x3b')]['id'];var _0x57189e=_0x48431d[_0xac32('0x3e')];var _0x49f2c5=0xc8;var _0x1f011e=null;return db['sequelize'][_0xac32('0x4d')]({'isolationLevel':db[_0xac32('0x4e')][_0xac32('0x4f')]['ISOLATION_LEVELS'][_0xac32('0x50')]},function(_0x421db8){return db['VoiceExtension'][_0xac32('0x51')]({'where':{'id':_0x5dccde},'transaction':_0x421db8})[_0xac32('0x14')](function(_0x6955dc){if(_0x6955dc){return db[_0xac32('0x23')][_0xac32('0x13')]({'where':{'VoiceExtensionId':_0x5dccde},'transaction':_0x421db8})['then'](function(){var _0x231fd0=_[_0xac32('0x19')](_0x57189e,function(_0xffd233){_0xffd233[_0xac32('0x52')]=_0x5dccde;_0xffd233['isApp']=!![];return _0xffd233;});return _0x6955dc[_0xac32('0x53')](_0x231fd0);})[_0xac32('0x14')](function(_0x30a252){return db[_0xac32('0x23')][_0xac32('0x54')](_0x30a252,{'transaction':_0x421db8});});}else{_0x49f2c5=0x194;_0x1f011e=[];}});})['then'](function(){if(_0x49f2c5!==0x194){return db[_0xac32('0x23')][_0xac32('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5dccde},'order':_0xac32('0x56')})[_0xac32('0x14')](function(_0x157f5e){_0x1f011e=_0x157f5e;});}})[_0xac32('0x39')](function(_0x43c4dd){_0x49f2c5=0x1f4;logger[_0xac32('0x1f')](_0x43c4dd[_0xac32('0x20')]);if(_0x43c4dd[_0xac32('0x1d')]){delete _0x43c4dd[_0xac32('0x1d')];}_0x1f011e=_0x43c4dd;})[_0xac32('0x57')](function(){if(_0x1f011e===null){_0x5bcdcd[_0xac32('0xb')](_0x49f2c5);}else{if(_0x49f2c5===0x1f4){_0x5bcdcd[_0xac32('0xc')](_0x49f2c5)['send'](_0x1f011e);}else{_0x5bcdcd['status'](_0x49f2c5)[_0xac32('0xe')](_0x1f011e);}}});}; \ No newline at end of file +var _0xbfba=['params','keys','include','outbound','startsWith','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','InboundRoutes','inbound','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','sendStatus','end','offset','undefined','count','status','set','Content-Range','json','destroy','then','get','OutboundRoutes','InternalRoutes','internal','value','includes','type','find','name','UserProfileResource','send','index','map','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','merge','options','VoiceExtension','includeAll','catch'];(function(_0x4b77d5,_0xd9ee00){var _0xb27b7=function(_0x42e421){while(--_0x42e421){_0x4b77d5['push'](_0x4b77d5['shift']());}};_0xb27b7(++_0xd9ee00);}(_0xbfba,0x7f));var _0xabfb=function(_0x4a867a,_0x27d3c2){_0x4a867a=_0x4a867a-0x0;var _0xaa5899=_0xbfba[_0x4a867a];return _0xaa5899;};'use strict';var _=require(_0xabfb('0x0'));var Redis=require(_0xabfb('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xabfb('0x2'))(_0xabfb('0x3'));var config=require(_0xabfb('0x4'));var db=require(_0xabfb('0x5'))['db'];config[_0xabfb('0x6')]=_[_0xabfb('0x7')](config['redis'],{'host':_0xabfb('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabfb('0x6')]));require(_0xabfb('0x9'))['register'](socket);function respondWithStatusCode(_0x3fcaa9,_0x70f28d){_0x70f28d=_0x70f28d||0xcc;return function(_0xfbd164){if(_0xfbd164){return _0x3fcaa9[_0xabfb('0xa')](_0x70f28d);}return _0x3fcaa9['status'](_0x70f28d)[_0xabfb('0xb')]();};}function respondWithResult(_0xade566,_0x2a0928){_0x2a0928=_0x2a0928||0xc8;return function(_0x3b32f0){if(_0x3b32f0){return _0xade566['status'](_0x2a0928)['json'](_0x3b32f0);}};}function respondWithFilteredResult(_0x44bff3,_0x36697a){return function(_0x4bdf5b){if(_0x4bdf5b){var _0x4ac8e8=typeof _0x36697a[_0xabfb('0xc')]==='undefined'&&typeof _0x36697a['limit']===_0xabfb('0xd');var _0x5c6f54=_0x4bdf5b['count'];var _0x477084=_0x4ac8e8?0x0:_0x36697a[_0xabfb('0xc')];var _0x33bbf9=_0x4ac8e8?_0x4bdf5b[_0xabfb('0xe')]:_0x36697a[_0xabfb('0xc')]+_0x36697a['limit'];var _0x5b80c9;if(_0x33bbf9>=_0x5c6f54){_0x33bbf9=_0x5c6f54;_0x5b80c9=0xc8;}else{_0x5b80c9=0xce;}_0x44bff3[_0xabfb('0xf')](_0x5b80c9);return _0x44bff3[_0xabfb('0x10')](_0xabfb('0x11'),_0x477084+'-'+_0x33bbf9+'/'+_0x5c6f54)[_0xabfb('0x12')](_0x4bdf5b);}return null;};}function removeEntity(_0x287e3e){return function(_0x294b97){if(_0x294b97){return _0x294b97[_0xabfb('0x13')]()[_0xabfb('0x14')](function(){var _0x5df16a=_0x294b97[_0xabfb('0x15')]({'plain':!![]});var _0x3f622a=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xabfb('0x16'),'value':'outbound','ignore':![]},{'name':_0xabfb('0x17'),'value':_0xabfb('0x18'),'ignore':![]}];var _0xc71d40=_(_0x3f622a)['filter']('ignore')['map'](_0xabfb('0x19'))[_0xabfb('0x19')]();if(_[_0xabfb('0x1a')](_0xc71d40,_0x5df16a[_0xabfb('0x1b')])){return;}var _0x412210=_[_0xabfb('0x1c')](_0x3f622a,[_0xabfb('0x19'),_0x5df16a[_0xabfb('0x1b')]])[_0xabfb('0x1d')];return db[_0xabfb('0x1e')][_0xabfb('0x13')]({'where':{'type':_0x412210,'resourceId':_0x5df16a['id']}})[_0xabfb('0x14')](function(){return _0x294b97;});})[_0xabfb('0x14')](function(){_0x287e3e[_0xabfb('0xf')](0xcc)[_0xabfb('0xb')]();});}};}function handleEntityNotFound(_0x158eb1){return function(_0x5c2b8a){if(!_0x5c2b8a){_0x158eb1[_0xabfb('0xa')](0x194);}return _0x5c2b8a;};}function handleError(_0x23771a,_0x2b4267){_0x2b4267=_0x2b4267||0x1f4;return function(_0x6a94a1){logger['error'](_0x6a94a1['stack']);if(_0x6a94a1['name']){delete _0x6a94a1[_0xabfb('0x1d')];}_0x23771a[_0xabfb('0xf')](_0x2b4267)[_0xabfb('0x1f')](_0x6a94a1);};}exports[_0xabfb('0x20')]=function(_0x5b98cf,_0x217cb3){var _0x4842e5={},_0x23ad27={},_0x30e25c={'count':0x0,'rows':[]};var _0xea7207=_[_0xabfb('0x21')](db['VoiceExtension'][_0xabfb('0x22')],function(_0x46f2f4){return{'name':_0x46f2f4[_0xabfb('0x23')],'type':_0x46f2f4[_0xabfb('0x1b')][_0xabfb('0x24')]};});_0x23ad27['model']=_[_0xabfb('0x21')](_0xea7207,'name');_0x23ad27['query']=_['keys'](_0x5b98cf[_0xabfb('0x25')]);_0x23ad27['filters']=_['intersection'](_0x23ad27[_0xabfb('0x26')],_0x23ad27['query']);_0x4842e5[_0xabfb('0x27')]=_[_0xabfb('0x28')](_0x23ad27[_0xabfb('0x26')],qs[_0xabfb('0x29')](_0x5b98cf[_0xabfb('0x25')][_0xabfb('0x29')]));_0x4842e5[_0xabfb('0x27')]=_0x4842e5[_0xabfb('0x27')][_0xabfb('0x2a')]?_0x4842e5[_0xabfb('0x27')]:_0x23ad27[_0xabfb('0x26')];if(!_0x5b98cf[_0xabfb('0x25')][_0xabfb('0x2b')](_0xabfb('0x2c'))){_0x4842e5[_0xabfb('0x2d')]=qs['limit'](_0x5b98cf[_0xabfb('0x25')]['limit']);_0x4842e5[_0xabfb('0xc')]=qs['offset'](_0x5b98cf[_0xabfb('0x25')][_0xabfb('0xc')]);}_0x4842e5[_0xabfb('0x2e')]=qs[_0xabfb('0x2f')](_0x5b98cf['query'][_0xabfb('0x2f')]);_0x4842e5[_0xabfb('0x30')]=qs[_0xabfb('0x31')](_[_0xabfb('0x32')](_0x5b98cf[_0xabfb('0x25')],_0x23ad27[_0xabfb('0x31')]),_0xea7207);if(_0x5b98cf[_0xabfb('0x25')]['filter']){_0x4842e5[_0xabfb('0x30')]=_['merge'](_0x4842e5['where'],{'$or':_[_0xabfb('0x21')](_0xea7207,function(_0x4fcf6d){if(_0x4fcf6d['type']!==_0xabfb('0x33')){var _0x3570c4={};_0x3570c4[_0x4fcf6d[_0xabfb('0x1d')]]={'$like':'%'+_0x5b98cf['query']['filter']+'%'};return _0x3570c4;}})});}_0x4842e5=_[_0xabfb('0x34')]({},_0x4842e5,_0x5b98cf[_0xabfb('0x35')]);var _0x3ec287={'where':_0x4842e5[_0xabfb('0x30')]};return db[_0xabfb('0x36')][_0xabfb('0xe')](_0x3ec287)[_0xabfb('0x14')](function(_0x59d88d){_0x30e25c[_0xabfb('0xe')]=_0x59d88d;if(_0x5b98cf['query'][_0xabfb('0x37')]){_0x4842e5['include']=[{'all':!![]}];}return db[_0xabfb('0x36')]['findAll'](_0x4842e5);})[_0xabfb('0x14')](function(_0x2501b3){_0x30e25c['rows']=_0x2501b3;return _0x30e25c;})[_0xabfb('0x14')](respondWithFilteredResult(_0x217cb3,_0x4842e5))[_0xabfb('0x38')](handleError(_0x217cb3,null));};exports['show']=function(_0x23c4e0,_0x2d7d47){var _0x2fee2b={'raw':![],'where':{'id':_0x23c4e0[_0xabfb('0x39')]['id']}},_0x17d031={};_0x17d031[_0xabfb('0x26')]=_[_0xabfb('0x3a')](db[_0xabfb('0x36')][_0xabfb('0x22')]);_0x17d031[_0xabfb('0x25')]=_['keys'](_0x23c4e0[_0xabfb('0x25')]);_0x17d031[_0xabfb('0x31')]=_['intersection'](_0x17d031['model'],_0x17d031[_0xabfb('0x25')]);_0x2fee2b[_0xabfb('0x27')]=_[_0xabfb('0x28')](_0x17d031[_0xabfb('0x26')],qs[_0xabfb('0x29')](_0x23c4e0[_0xabfb('0x25')][_0xabfb('0x29')]));_0x2fee2b[_0xabfb('0x27')]=_0x2fee2b[_0xabfb('0x27')][_0xabfb('0x2a')]?_0x2fee2b[_0xabfb('0x27')]:_0x17d031[_0xabfb('0x26')];if(_0x23c4e0[_0xabfb('0x25')][_0xabfb('0x37')]){_0x2fee2b[_0xabfb('0x3b')]=[{'all':!![]}];}_0x2fee2b=_[_0xabfb('0x34')]({},_0x2fee2b,_0x23c4e0[_0xabfb('0x35')]);return db[_0xabfb('0x36')][_0xabfb('0x1c')](_0x2fee2b)[_0xabfb('0x14')](handleEntityNotFound(_0x2d7d47,null))[_0xabfb('0x14')](respondWithResult(_0x2d7d47,null))[_0xabfb('0x38')](handleError(_0x2d7d47,null));};exports['destroy']=function(_0x4b8ac1,_0x37b041){return db[_0xabfb('0x36')]['find']({'where':{'id':_0x4b8ac1[_0xabfb('0x39')]['id']}})[_0xabfb('0x14')](handleEntityNotFound(_0x37b041,null))['then'](removeEntity(_0x37b041,null))[_0xabfb('0x38')](handleError(_0x37b041,null));};exports['create']=function(_0x5b93f8,_0x27542a){if(_0x5b93f8['body'][_0xabfb('0x1b')]===_0xabfb('0x3c')&&!_[_0xabfb('0x3d')](_0x5b93f8[_0xabfb('0x3e')][_0xabfb('0x3f')],'_')){_0x5b93f8['body']['exten']='_'[_0xabfb('0x40')](_0x5b93f8[_0xabfb('0x3e')][_0xabfb('0x3f')]);}return db[_0xabfb('0x36')][_0xabfb('0x41')](_0x5b93f8[_0xabfb('0x3e')],{'raw':![]})[_0xabfb('0x14')](function(_0x1fce74){var _0x46c2b1=_0x5b93f8['user']['get']({'plain':!![]});if(!_0x46c2b1)throw new Error(_0xabfb('0x42'));if(_0x46c2b1['role']===_0xabfb('0x43')){var _0x5c08fa=_0x1fce74['get']({'plain':!![]});var _0x39f2eb=[{'name':_0xabfb('0x44'),'value':_0xabfb('0x45')},{'name':_0xabfb('0x16'),'value':_0xabfb('0x3c')},{'name':_0xabfb('0x17'),'value':'internal'}];var _0x35e58c=_['find'](_0x39f2eb,[_0xabfb('0x19'),_0x5c08fa['type']])['name'];return db['UserProfileSection'][_0xabfb('0x1c')]({'where':{'name':_0x35e58c,'userProfileId':_0x46c2b1[_0xabfb('0x46')]},'raw':!![]})[_0xabfb('0x14')](function(_0x24ee32){if(_0x24ee32&&_0x24ee32[_0xabfb('0x47')]===0x0){return db['UserProfileResource'][_0xabfb('0x41')]({'name':_0x5c08fa['name'],'resourceId':_0x5c08fa['id'],'type':_0x24ee32[_0xabfb('0x1d')],'sectionId':_0x24ee32['id']},{})[_0xabfb('0x14')](function(){return _0x1fce74;});}else{return _0x1fce74;}})['catch'](function(_0x33c86e){logger[_0xabfb('0x48')](_0xabfb('0x49'),_0x33c86e);throw _0x33c86e;});}return _0x1fce74;})[_0xabfb('0x14')](respondWithResult(_0x27542a,0xc9))['catch'](handleError(_0x27542a,null));};exports[_0xabfb('0x4a')]=function(_0x107f8c,_0x57a1c4){if(_0x107f8c[_0xabfb('0x3e')]['id']){delete _0x107f8c[_0xabfb('0x3e')]['id'];}return db['VoiceExtension'][_0xabfb('0x1c')]({'where':{'id':_0x107f8c['params']['id']}})[_0xabfb('0x14')](handleEntityNotFound(_0x57a1c4,null))[_0xabfb('0x14')](function(_0x2a0876){if(_0x2a0876){return db[_0xabfb('0x36')]['update'](_[_0xabfb('0x32')](_0x107f8c[_0xabfb('0x3e')],['exten','context','description',_0xabfb('0x4b'),_0xabfb('0x4c'),_0xabfb('0x4d'),_0xabfb('0x4e')]),{'where':{'context':_0x2a0876[_0xabfb('0x4f')],'exten':_0x2a0876[_0xabfb('0x3f')]},'individualHooks':!![]})[_0xabfb('0x14')](function(_0x9287c8){return _0x9287c8;});}return null;})[_0xabfb('0x14')](respondWithStatusCode(_0x57a1c4,null))[_0xabfb('0x38')](handleError(_0x57a1c4,null));};exports[_0xabfb('0x50')]=function(_0x2f51ee,_0x5f1911){var _0x42be40=_0x2f51ee[_0xabfb('0x39')]['id'];var _0x183027=_0x2f51ee[_0xabfb('0x3e')];var _0x1a9986=0xc8;var _0x2face6=null;return db[_0xabfb('0x51')][_0xabfb('0x52')]({'isolationLevel':db[_0xabfb('0x51')][_0xabfb('0x53')][_0xabfb('0x54')][_0xabfb('0x55')]},function(_0x4ba014){return db[_0xabfb('0x36')]['findOne']({'where':{'id':_0x42be40},'transaction':_0x4ba014})[_0xabfb('0x14')](function(_0x1592b2){if(_0x1592b2){return db[_0xabfb('0x36')][_0xabfb('0x13')]({'where':{'VoiceExtensionId':_0x42be40},'transaction':_0x4ba014})[_0xabfb('0x14')](function(){var _0xb6c8e4=_[_0xabfb('0x21')](_0x183027,function(_0x4a0d63){_0x4a0d63[_0xabfb('0x56')]=_0x42be40;_0x4a0d63[_0xabfb('0x57')]=!![];return _0x4a0d63;});return _0x1592b2[_0xabfb('0x58')](_0xb6c8e4);})['then'](function(_0x56c634){return db[_0xabfb('0x36')][_0xabfb('0x59')](_0x56c634,{'transaction':_0x4ba014});});}else{_0x1a9986=0x194;_0x2face6=[];}});})[_0xabfb('0x14')](function(){if(_0x1a9986!==0x194){return db[_0xabfb('0x36')][_0xabfb('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x42be40},'order':_0xabfb('0x5b')})[_0xabfb('0x14')](function(_0x5b7415){_0x2face6=_0x5b7415;});}})[_0xabfb('0x38')](function(_0x31ec4c){_0x1a9986=0x1f4;logger[_0xabfb('0x48')](_0x31ec4c['stack']);if(_0x31ec4c[_0xabfb('0x1d')]){delete _0x31ec4c['name'];}_0x2face6=_0x31ec4c;})['finally'](function(){if(_0x2face6===null){_0x5f1911[_0xabfb('0xa')](_0x1a9986);}else{if(_0x1a9986===0x1f4){_0x5f1911[_0xabfb('0xf')](_0x1a9986)['send'](_0x2face6);}else{_0x5f1911[_0xabfb('0xf')](_0x1a9986)[_0xabfb('0x12')](_0x2face6);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index eb91b47..e2d057e 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 _0x5643=['hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5643,0x1aa));var _0x3564=function(_0x39d839,_0x3e4a9f){_0x39d839=_0x39d839-0x0;var _0x560a3e=_0x5643[_0x39d839];return _0x560a3e;};'use strict';var EventEmitter=require(_0x3564('0x0'));var VoiceExtension=require(_0x3564('0x1'))['db'][_0x3564('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3564('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3564('0x4'),'afterDestroy':'remove'};function emitEvent(_0x425396){return function(_0x3fe88a,_0x39108f,_0x1d6960){VoiceExtensionEvents['emit'](_0x425396+':'+_0x3fe88a['id'],_0x3fe88a);VoiceExtensionEvents[_0x3564('0x5')](_0x425396,_0x3fe88a);_0x1d6960(null);};}for(var e in events){if(events[_0x3564('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x3564('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3211=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','save','update','remove'];(function(_0x10e175,_0x5af560){var _0x59ab2d=function(_0x55ed16){while(--_0x55ed16){_0x10e175['push'](_0x10e175['shift']());}};_0x59ab2d(++_0x5af560);}(_0x3211,0x93));var _0x1321=function(_0x4a7abe,_0x186572){_0x4a7abe=_0x4a7abe-0x0;var _0x263d13=_0x3211[_0x4a7abe];return _0x263d13;};'use strict';var EventEmitter=require(_0x1321('0x0'));var VoiceExtension=require(_0x1321('0x1'))['db'][_0x1321('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1321('0x3'),'afterUpdate':_0x1321('0x4'),'afterDestroy':_0x1321('0x5')};function emitEvent(_0x40d07f){return function(_0x5d904a,_0x22fc70,_0x4bb037){VoiceExtensionEvents[_0x1321('0x6')](_0x40d07f+':'+_0x5d904a['id'],_0x5d904a);VoiceExtensionEvents['emit'](_0x40d07f,_0x5d904a);_0x4bb037(null);};}for(var e in events){if(events[_0x1321('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x1321('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7cc0985..1da6d2c 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 _0xb91a=['Set','CDR(type)=','context','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','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)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','catch','define','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type'];(function(_0x2925e3,_0x15824e){var _0x493a85=function(_0x1e2f58){while(--_0x1e2f58){_0x2925e3['push'](_0x2925e3['shift']());}};_0x493a85(++_0x15824e);}(_0xb91a,0xf4));var _0xab91=function(_0x5bd74c,_0x490bfe){_0x5bd74c=_0x5bd74c-0x0;var _0x292475=_0xb91a[_0x5bd74c];return _0x292475;};'use strict';var _=require(_0xab91('0x0'));var attributes=require(_0xab91('0x1'));module[_0xab91('0x2')]=function(_0x5dcf46){var _0x59b921=_0x5dcf46[_0xab91('0x3')];function _0x37cd1e(_0xb312db){var _0x439eb2=0x2;var _0x1afca9=[{'type':_0xb312db[_0xab91('0x4')],'app':_0xab91('0x5'),'appdata':_0xab91('0x6')+_0xb312db[_0xab91('0x4')],'context':_0xb312db[_0xab91('0x7')],'exten':_0xb312db['exten'],'priority':_0x439eb2++,'VoiceExtensionId':_0xb312db['id']},{'type':_0xb312db[_0xab91('0x4')],'app':_0xb312db[_0xab91('0x8')]?'Set':'NoOp','appdata':_0xb312db['alias']?_0xab91('0x9')+_0xb312db[_0xab91('0x8')]:_0xab91('0xa'),'context':_0xb312db[_0xab91('0x7')],'exten':_0xb312db[_0xab91('0xb')],'priority':_0x439eb2++,'VoiceExtensionId':_0xb312db['id']}];if(_0xb312db[_0xab91('0x4')]===_0xab91('0xc')){_0x1afca9[_0xab91('0xd')]({'type':_0xab91('0xc'),'app':_0xab91('0x5'),'appdata':_0xab91('0xe')+_0xb312db['id'],'context':_0xb312db[_0xab91('0x7')],'exten':_0xb312db[_0xab91('0xb')],'priority':_0x439eb2++,'VoiceExtensionId':_0xb312db['id']});}_0x1afca9['push']({'type':_0xb312db['type'],'app':_0xab91('0x5'),'appdata':_0xab91('0xf'),'context':_0xb312db[_0xab91('0x7')],'exten':_0xb312db[_0xab91('0xb')],'priority':_0x439eb2++,'VoiceExtensionId':_0xb312db['id']},{'type':_0xb312db[_0xab91('0x4')],'app':_0xab91('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xb312db['context'],'exten':_0xb312db[_0xab91('0xb')],'priority':_0x439eb2++,'VoiceExtensionId':_0xb312db['id']},{'type':_0xb312db[_0xab91('0x4')],'app':_0xab91('0x5'),'appdata':_0xab91('0x10'),'context':_0xb312db[_0xab91('0x7')],'exten':_0xb312db[_0xab91('0xb')],'priority':_0x439eb2++,'VoiceExtensionId':_0xb312db['id']});return _0x1afca9;}function _0x27b7d1(_0x3fc294){var _0x499daf=0x2;var _0x557c36=[{'type':_0xab91('0x11'),'app':'Set','appdata':_0xab91('0x12'),'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':'outbound','app':_0x3fc294[_0xab91('0x8')]?'Set':_0xab91('0x13'),'appdata':_0x3fc294['alias']?'CDR(routeAlias)='+_0x3fc294[_0xab91('0x8')]:'No\x20alias\x20set','context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':_0xab91('0x11'),'app':'Set','appdata':_0xab91('0x14')+(_0x3fc294[_0xab91('0x15')]?_0xab91('0x16')+_0x3fc294[_0xab91('0x15')]+'}':_0xab91('0x17')),'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':'outbound','app':'Set','appdata':_0xab91('0xe')+_0x3fc294['id'],'context':_0x3fc294['context'],'exten':_0x3fc294['exten'],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':_0xab91('0x11'),'app':_0xab91('0x18'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x499daf+0x2)+_0xab91('0x19')+(_0x499daf+0x1)+')','context':_0x3fc294['context'],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':_0xab91('0x11'),'app':'Set','appdata':_0x3fc294[_0xab91('0x15')]?_0xab91('0x1a')+_0x3fc294[_0xab91('0x15')]+'}':_0xab91('0x1b'),'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':'outbound','app':_0xab91('0x5'),'appdata':_0xab91('0xf'),'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':_0xab91('0x11'),'app':_0xab91('0x5'),'appdata':_0xab91('0x1c'),'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294['exten'],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':_0xab91('0x11'),'app':_0xab91('0x5'),'appdata':_0xab91('0x10'),'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':_0xab91('0x11'),'app':'Set','appdata':_0xab91('0x1d')+_0x3fc294['id'],'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']}];if(_0x3fc294[_0xab91('0x1e')]('recordingFormat')&&_0x3fc294[_0xab91('0x1f')]!==_0xab91('0x20')){_0x557c36[_0xab91('0xd')]({'type':'outbound','app':_0xab91('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']},{'type':'outbound','app':_0xab91('0x5'),'appdata':_0xab91('0x21')+_0x3fc294[_0xab91('0x1f')]||_0xab91('0x22'),'context':_0x3fc294[_0xab91('0x7')],'exten':_0x3fc294[_0xab91('0xb')],'priority':_0x499daf++,'VoiceExtensionId':_0x3fc294['id']});}return _0x557c36;}function _0x15d2dd(_0x576bbc,_0x584702){var _0x17e5bd=[{'name':_0xab91('0x23'),'param':0x0},{'name':_0xab91('0x24'),'param':0x1},{'name':_0xab91('0x25'),'param':0x2},{'name':_0xab91('0x26'),'param':0x3}];var _0xca2753={};var _0xa783c=_0x584702[_0xab91('0x27')](',');var _0x4787f0=[];for(var _0x286c6d=0x0;_0x286c6d<_0x17e5bd[_0xab91('0x28')];_0x286c6d++){switch(_0x17e5bd[_0x286c6d]['name']){case _0xab91('0x23'):_0xca2753['trunk']=_0xa783c[_0x17e5bd[_0x286c6d][_0xab91('0x29')]][_0xab91('0x27')]('/')[0x1];_0xca2753[_0xab91('0x2a')]=_0xa783c[_0x17e5bd[_0x286c6d][_0xab91('0x29')]]['split']('/')[0x2];_0xca2753['prefix']=_0xca2753['phone']?_0xca2753[_0xab91('0x2a')][_0xab91('0x27')]('$')[0x0]:undefined;_0xca2753['phone']=_0x576bbc[_0xab91('0x15')]?(_0xca2753[_0xab91('0x2b')]||'')+_0xab91('0x16')+_0x576bbc[_0xab91('0x15')]+'}':(_0xca2753[_0xab91('0x2b')]||'')+_0xab91('0x17');_0x4787f0[_0x17e5bd[_0x286c6d][_0xab91('0x29')]]=[_0xab91('0x2c'),_0xca2753[_0xab91('0x23')],_0xca2753[_0xab91('0x2a')]][_0xab91('0x2d')]('/');break;case _0xab91('0x25'):_0xca2753['options']=_0xa783c[_0x17e5bd[_0x286c6d][_0xab91('0x29')]];if(_0x576bbc[_0xab91('0x1f')]!==_0xab91('0x20')){if(_0xca2753[_0xab91('0x25')][_0xab91('0x2e')](_0xab91('0x2f'))<0x0){_0xca2753['options']+=_0xab91('0x2f');}}else{_0xca2753['options']=_0xca2753[_0xab91('0x25')][_0xab91('0x30')](_0xab91('0x2f'),'');}_0x4787f0[_0x17e5bd[_0x286c6d][_0xab91('0x29')]]=_0xca2753[_0xab91('0x25')];break;default:_0x4787f0[_0x17e5bd[_0x286c6d][_0xab91('0x29')]]=_0xa783c[_0x17e5bd[_0x286c6d][_0xab91('0x29')]];}}return _0x4787f0[_0xab91('0x2d')](',');}function _0x43fd94(_0x88e0ce,_0x4493a8,_0x9caf1a){return new Promise(function(_0x1aea21,_0x2ff56a){var _0x15341a=[];if(_[_0xab91('0x31')](_0x4493a8))return _0x1aea21(_0x15341a);_0x59b921[_0xab91('0x32')]['findAll']({'attributes':['id',_0xab91('0x33'),_0xab91('0x34')],'raw':!![]})[_0xab91('0x35')](function(_0x4a28bf){for(var _0x218c72=0x0,_0x69c8bc=0x0;_0x218c72<_0x4493a8['length'];_0x218c72++,_0x69c8bc=0x0){var _0x426dea=_0x4493a8[_0x218c72];var _0x1c9449=[];var _0x1732df=[];delete _0x426dea['id'];if(_0x426dea[_0xab91('0x33')]!=='*,*,*,*'){_0x426dea[_0xab91('0x36')]=[_0x426dea['interval']];}else{_0x426dea[_0xab91('0x36')]=_0x426dea['IntervalId']?_[_0xab91('0x37')](_[_0xab91('0x38')](_0x4a28bf,{'IntervalId':_0x426dea[_0xab91('0x34')]}),_0xab91('0x33')):[];}_0x426dea['context']=_0x88e0ce['context'];_0x426dea[_0xab91('0xb')]=_0x88e0ce['exten'];if(_0x426dea['type'])_0x426dea[_0xab91('0x4')]=_0x426dea[_0xab91('0x4')][_0xab91('0x39')]();if(_0x88e0ce['type']===_0xab91('0x11')){if(_0x426dea['hasOwnProperty']('tag')&&_0x426dea[_0xab91('0x3a')]&&_0x426dea[_0xab91('0x3a')]!=='--'){_0x1c9449['push']({'type':_0x426dea[_0xab91('0x4')]['toLowerCase'](),'app':_0xab91('0x5'),'appdata':_0xab91('0x3b')+_0x426dea[_0xab91('0x3a')],'context':_0x88e0ce['context'],'exten':_0x88e0ce[_0xab91('0xb')],'priority':_0x426dea[_0xab91('0x36')][_0xab91('0x28')]+_0x9caf1a+_0x69c8bc++,'VoiceExtensionId':_0x88e0ce['id']});}_0x1c9449[_0xab91('0xd')]({'type':_0x426dea[_0xab91('0x4')][_0xab91('0x39')](),'app':_0xab91('0x18'),'appdata':_0xab91('0x3c')+(_0x426dea[_0xab91('0x3d')]?_0xab91('0x3e')+_0x426dea[_0xab91('0x3d')]+')':_0xab91('0x3f')),'context':_0x88e0ce['context'],'exten':_0x88e0ce['exten'],'priority':_0x426dea[_0xab91('0x36')]['length']+_0x9caf1a+_0x69c8bc++,'VoiceExtensionId':_0x88e0ce['id']});}else{if(_0x426dea[_0xab91('0x1e')](_0xab91('0x40'))){if(['queue',_0xab91('0x41')][_0xab91('0x42')](_0x426dea[_0xab91('0x43')][_0xab91('0x39')]())&&_0x426dea[_0xab91('0x44')]!==_0xab91('0x45')){if(_0x426dea[_0xab91('0x40')]){_0x1c9449[_0xab91('0xd')]({'type':_0x426dea[_0xab91('0x4')][_0xab91('0x39')](),'app':_0xab91('0x18'),'appdata':_0xab91('0x46'),'context':_0x88e0ce[_0xab91('0x7')],'exten':_0x88e0ce[_0xab91('0xb')],'priority':_0x426dea[_0xab91('0x36')][_0xab91('0x28')]+_0x9caf1a+_0x69c8bc++,'VoiceExtensionId':_0x88e0ce['id']});_0x1c9449['push']({'type':_0x426dea[_0xab91('0x4')][_0xab91('0x39')](),'app':_0xab91('0x5'),'appdata':_0xab91('0x47'),'context':_0x88e0ce[_0xab91('0x7')],'exten':_0x88e0ce[_0xab91('0xb')],'priority':_0x426dea[_0xab91('0x36')]['length']+_0x9caf1a+_0x69c8bc++,'VoiceExtensionId':_0x88e0ce['id']});}else{_0x1c9449[_0xab91('0xd')]({'type':_0x426dea[_0xab91('0x4')][_0xab91('0x39')](),'app':_0xab91('0x18'),'appdata':_0xab91('0x48'),'context':_0x88e0ce[_0xab91('0x7')],'exten':_0x88e0ce[_0xab91('0xb')],'priority':_0x426dea[_0xab91('0x36')][_0xab91('0x28')]+_0x9caf1a+_0x69c8bc++,'VoiceExtensionId':_0x88e0ce['id']});_0x1c9449[_0xab91('0xd')]({'type':_0x426dea[_0xab91('0x4')][_0xab91('0x39')](),'app':_0xab91('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x88e0ce[_0xab91('0x7')],'exten':_0x88e0ce[_0xab91('0xb')],'priority':_0x426dea['intervals'][_0xab91('0x28')]+_0x9caf1a+_0x69c8bc++,'VoiceExtensionId':_0x88e0ce['id']});}}}}for(var _0x357e30=0x0;_0x357e30<_0x426dea[_0xab91('0x36')]['length'];_0x357e30++){var _0xc2f88c=_0x9caf1a+_0x426dea['intervals']['length'];var _0xc0632=_0x357e30===_0x426dea[_0xab91('0x36')][_0xab91('0x28')]-0x1?_0x9caf1a+_0x1c9449[_0xab91('0x28')]+_0x1732df[_0xab91('0x28')]+0x2:_0x9caf1a+_0x357e30+0x1;_0x1c9449['splice'](_0x357e30,0x0,{'type':_0x88e0ce[_0xab91('0x4')],'app':_0xab91('0x49'),'appdata':_0x426dea['intervals'][_0x357e30]+'?'+_0x88e0ce[_0xab91('0x7')]+_0xab91('0x4a')+_0xc2f88c+':'+_0x88e0ce[_0xab91('0x7')]+_0xab91('0x4a')+_0xc0632,'exten':_0x88e0ce[_0xab91('0xb')],'context':_0x88e0ce[_0xab91('0x7')],'priority':_0x9caf1a+_0x357e30,'VoiceExtensionId':_0x88e0ce['id']});}if(_0x426dea[_0xab91('0x44')]===_0xab91('0x4b'))_0x426dea[_0xab91('0x4c')]=_0x15d2dd(_0x88e0ce,_0x426dea[_0xab91('0x4c')]);_0x426dea[_0xab91('0x4d')]=_0x1c9449[_0xab91('0x28')]?_['last'](_0x1c9449)['priority']+0x1:_0x9caf1a;_0x15341a=_[_0xab91('0x4e')](_0x15341a,_0x1c9449,[_0x426dea],_0x1732df);_0x9caf1a=_['last'](_0x15341a)[_0xab91('0x4d')]+0x1;}return _0x1aea21(_0x15341a);})[_0xab91('0x4f')](function(_0xcdf879){_0x2ff56a(_0xcdf879);});});}return _0x5dcf46[_0xab91('0x50')]('VoiceExtension',attributes,{'tableName':_0xab91('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x250c86){var _0x744959=this[_0xab91('0x52')]({'plain':!![]});var _0x2c088c=_0x744959[_0xab91('0x4')]===_0xab91('0x11')?_0x27b7d1(_0x744959):_0x37cd1e(_0x744959);return _0x43fd94(_0x744959,_0x250c86,_['last'](_0x2c088c)[_0xab91('0x4d')]+0x1)[_0xab91('0x35')](function(_0x36d6f9){var _0x14ccbe=_[_0xab91('0x4e')](_0x2c088c,_0x36d6f9);_0x14ccbe['push']({'type':_0x744959[_0xab91('0x4')],'app':'Hangup','exten':_0x744959[_0xab91('0xb')],'context':_0x744959[_0xab91('0x7')],'priority':_['last'](_0x14ccbe)['priority']+0x1,'VoiceExtensionId':_0x744959['id']});return _0x14ccbe;});}}});}; \ No newline at end of file +var _0x2b67=['outbound','CDR(type)=outbound','NoOp','No\x20alias\x20set','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','url','split','length','name','trunk','param','phone','prefix','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','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)','answer','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','context','exten','alias','Set','CDR(routeAlias)=','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab'];(function(_0x174e6b,_0x124a26){var _0x10ab0e=function(_0x704225){while(--_0x704225){_0x174e6b['push'](_0x174e6b['shift']());}};_0x10ab0e(++_0x124a26);}(_0x2b67,0xf3));var _0x72b6=function(_0x27f68a,_0x15df76){_0x27f68a=_0x27f68a-0x0;var _0x1c0427=_0x2b67[_0x27f68a];return _0x1c0427;};'use strict';var _=require(_0x72b6('0x0'));var attributes=require(_0x72b6('0x1'));module[_0x72b6('0x2')]=function(_0x40cf58){var _0x5472fa=_0x40cf58[_0x72b6('0x3')];function _0x5364a8(_0x3beab6){var _0x47b18e=0x2;var _0x43adae=[{'type':_0x3beab6[_0x72b6('0x4')],'app':'Set','appdata':'CDR(type)='+_0x3beab6['type'],'context':_0x3beab6[_0x72b6('0x5')],'exten':_0x3beab6[_0x72b6('0x6')],'priority':_0x47b18e++,'VoiceExtensionId':_0x3beab6['id']},{'type':_0x3beab6[_0x72b6('0x4')],'app':_0x3beab6[_0x72b6('0x7')]?_0x72b6('0x8'):'NoOp','appdata':_0x3beab6[_0x72b6('0x7')]?_0x72b6('0x9')+_0x3beab6['alias']:'No\x20alias\x20set','context':_0x3beab6[_0x72b6('0x5')],'exten':_0x3beab6[_0x72b6('0x6')],'priority':_0x47b18e++,'VoiceExtensionId':_0x3beab6['id']}];if(_0x3beab6[_0x72b6('0x4')]===_0x72b6('0xa')){_0x43adae[_0x72b6('0xb')]({'type':'inbound','app':'Set','appdata':'CDR(routeid)='+_0x3beab6['id'],'context':_0x3beab6[_0x72b6('0x5')],'exten':_0x3beab6[_0x72b6('0x6')],'priority':_0x47b18e++,'VoiceExtensionId':_0x3beab6['id']});}_0x43adae[_0x72b6('0xb')]({'type':_0x3beab6[_0x72b6('0x4')],'app':_0x72b6('0x8'),'appdata':_0x72b6('0xc'),'context':_0x3beab6[_0x72b6('0x5')],'exten':_0x3beab6[_0x72b6('0x6')],'priority':_0x47b18e++,'VoiceExtensionId':_0x3beab6['id']},{'type':_0x3beab6[_0x72b6('0x4')],'app':_0x72b6('0x8'),'appdata':_0x72b6('0xd'),'context':_0x3beab6[_0x72b6('0x5')],'exten':_0x3beab6[_0x72b6('0x6')],'priority':_0x47b18e++,'VoiceExtensionId':_0x3beab6['id']},{'type':_0x3beab6[_0x72b6('0x4')],'app':_0x72b6('0x8'),'appdata':_0x72b6('0xe'),'context':_0x3beab6['context'],'exten':_0x3beab6[_0x72b6('0x6')],'priority':_0x47b18e++,'VoiceExtensionId':_0x3beab6['id']});return _0x43adae;}function _0x55717c(_0x2ee6f6){var _0x5cce99=0x2;var _0x339813=[{'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':_0x72b6('0x10'),'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x2ee6f6[_0x72b6('0x7')]?_0x72b6('0x8'):_0x72b6('0x11'),'appdata':_0x2ee6f6[_0x72b6('0x7')]?_0x72b6('0x9')+_0x2ee6f6[_0x72b6('0x7')]:_0x72b6('0x12'),'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':'Set','appdata':'CDR(destination)='+(_0x2ee6f6[_0x72b6('0x13')]?_0x72b6('0x14')+_0x2ee6f6[_0x72b6('0x13')]+'}':'${EXTEN}'),'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6['exten'],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':_0x72b6('0x15')+_0x2ee6f6['id'],'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x72b6('0x16'),'appdata':_0x72b6('0x17')+(_0x5cce99+0x2)+_0x72b6('0x18')+(_0x5cce99+0x1)+')','context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':_0x2ee6f6['cutdigits']?_0x72b6('0x19')+_0x2ee6f6['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6['exten'],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':_0x72b6('0xd'),'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':_0x72b6('0xe'),'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':_0x72b6('0x1a')+_0x2ee6f6['id'],'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6['exten'],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']}];if(_0x2ee6f6[_0x72b6('0x1b')](_0x72b6('0x1c'))&&_0x2ee6f6[_0x72b6('0x1c')]!==_0x72b6('0x1d')){_0x339813['push']({'type':_0x72b6('0xf'),'app':_0x72b6('0x8'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']},{'type':_0x72b6('0xf'),'app':'Set','appdata':_0x72b6('0x1e')+_0x2ee6f6[_0x72b6('0x1c')]||_0x72b6('0x1f'),'context':_0x2ee6f6[_0x72b6('0x5')],'exten':_0x2ee6f6[_0x72b6('0x6')],'priority':_0x5cce99++,'VoiceExtensionId':_0x2ee6f6['id']});}return _0x339813;}function _0x48c6c0(_0x4ae20b,_0x4333fa){var _0x1c1f28=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x72b6('0x20'),'param':0x3}];var _0x1b22de={};var _0x587443=_0x4333fa[_0x72b6('0x21')](',');var _0x48118e=[];for(var _0x4bbe4f=0x0;_0x4bbe4f<_0x1c1f28[_0x72b6('0x22')];_0x4bbe4f++){switch(_0x1c1f28[_0x4bbe4f][_0x72b6('0x23')]){case _0x72b6('0x24'):_0x1b22de[_0x72b6('0x24')]=_0x587443[_0x1c1f28[_0x4bbe4f][_0x72b6('0x25')]][_0x72b6('0x21')]('/')[0x1];_0x1b22de[_0x72b6('0x26')]=_0x587443[_0x1c1f28[_0x4bbe4f][_0x72b6('0x25')]][_0x72b6('0x21')]('/')[0x2];_0x1b22de[_0x72b6('0x27')]=_0x1b22de[_0x72b6('0x26')]?_0x1b22de[_0x72b6('0x26')][_0x72b6('0x21')]('$')[0x0]:undefined;_0x1b22de['phone']=_0x4ae20b[_0x72b6('0x13')]?(_0x1b22de[_0x72b6('0x27')]||'')+_0x72b6('0x14')+_0x4ae20b[_0x72b6('0x13')]+'}':(_0x1b22de[_0x72b6('0x27')]||'')+_0x72b6('0x28');_0x48118e[_0x1c1f28[_0x4bbe4f][_0x72b6('0x25')]]=[_0x72b6('0x29'),_0x1b22de[_0x72b6('0x24')],_0x1b22de[_0x72b6('0x26')]][_0x72b6('0x2a')]('/');break;case _0x72b6('0x2b'):_0x1b22de[_0x72b6('0x2b')]=_0x587443[_0x1c1f28[_0x4bbe4f]['param']];if(_0x4ae20b[_0x72b6('0x1c')]!==_0x72b6('0x1d')){if(_0x1b22de['options'][_0x72b6('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x1b22de[_0x72b6('0x2b')]+=_0x72b6('0x2d');}}else{_0x1b22de['options']=_0x1b22de[_0x72b6('0x2b')][_0x72b6('0x2e')](_0x72b6('0x2d'),'');}_0x48118e[_0x1c1f28[_0x4bbe4f][_0x72b6('0x25')]]=_0x1b22de['options'];break;default:_0x48118e[_0x1c1f28[_0x4bbe4f][_0x72b6('0x25')]]=_0x587443[_0x1c1f28[_0x4bbe4f][_0x72b6('0x25')]];}}return _0x48118e[_0x72b6('0x2a')](',');}function _0x1ec522(_0x5c7d9d,_0x2dc604,_0x36398f){return new Promise(function(_0x26a700,_0xd6b961){var _0x272407=[];if(_[_0x72b6('0x2f')](_0x2dc604))return _0x26a700(_0x272407);_0x5472fa[_0x72b6('0x30')][_0x72b6('0x31')]({'attributes':['id',_0x72b6('0x32'),_0x72b6('0x33')],'raw':!![]})[_0x72b6('0x34')](function(_0xfdac02){for(var _0x5e65d7=0x0,_0x5b5d99=0x0;_0x5e65d7<_0x2dc604[_0x72b6('0x22')];_0x5e65d7++,_0x5b5d99=0x0){var _0x2fdd97=_0x2dc604[_0x5e65d7];var _0x5ca5e9=[];var _0x4121db=[];delete _0x2fdd97['id'];if(_0x2fdd97['interval']!==_0x72b6('0x35')){_0x2fdd97[_0x72b6('0x36')]=[_0x2fdd97[_0x72b6('0x32')]];}else{_0x2fdd97[_0x72b6('0x36')]=_0x2fdd97[_0x72b6('0x33')]?_[_0x72b6('0x37')](_[_0x72b6('0x38')](_0xfdac02,{'IntervalId':_0x2fdd97[_0x72b6('0x33')]}),_0x72b6('0x32')):[];}_0x2fdd97[_0x72b6('0x5')]=_0x5c7d9d[_0x72b6('0x5')];_0x2fdd97['exten']=_0x5c7d9d[_0x72b6('0x6')];if(_0x2fdd97['type'])_0x2fdd97[_0x72b6('0x4')]=_0x2fdd97[_0x72b6('0x4')][_0x72b6('0x39')]();if(_0x5c7d9d[_0x72b6('0x4')]===_0x72b6('0xf')){if(_0x2fdd97[_0x72b6('0x1b')]('tag')&&_0x2fdd97[_0x72b6('0x3a')]&&_0x2fdd97['tag']!=='--'){_0x5ca5e9[_0x72b6('0xb')]({'type':_0x2fdd97[_0x72b6('0x4')][_0x72b6('0x39')](),'app':_0x72b6('0x8'),'appdata':_0x72b6('0x3b')+_0x2fdd97[_0x72b6('0x3a')],'context':_0x5c7d9d['context'],'exten':_0x5c7d9d[_0x72b6('0x6')],'priority':_0x2fdd97['intervals'][_0x72b6('0x22')]+_0x36398f+_0x5b5d99++,'VoiceExtensionId':_0x5c7d9d['id']});}_0x5ca5e9[_0x72b6('0xb')]({'type':_0x2fdd97[_0x72b6('0x4')][_0x72b6('0x39')](),'app':_0x72b6('0x16'),'appdata':_0x72b6('0x3c')+(_0x2fdd97[_0x72b6('0x3d')]?_0x72b6('0x3e')+_0x2fdd97['callerID']+')':_0x72b6('0x3f')),'context':_0x5c7d9d[_0x72b6('0x5')],'exten':_0x5c7d9d[_0x72b6('0x6')],'priority':_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')]+_0x36398f+_0x5b5d99++,'VoiceExtensionId':_0x5c7d9d['id']});}else{if(_0x2fdd97[_0x72b6('0x1b')](_0x72b6('0x40'))){if(['queue',_0x72b6('0x41')]['includes'](_0x2fdd97[_0x72b6('0x42')][_0x72b6('0x39')]())&&_0x2fdd97[_0x72b6('0x43')]!==_0x72b6('0x44')){if(_0x2fdd97['answer']){_0x5ca5e9[_0x72b6('0xb')]({'type':_0x2fdd97[_0x72b6('0x4')][_0x72b6('0x39')](),'app':'ExecIf','appdata':_0x72b6('0x45'),'context':_0x5c7d9d['context'],'exten':_0x5c7d9d[_0x72b6('0x6')],'priority':_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')]+_0x36398f+_0x5b5d99++,'VoiceExtensionId':_0x5c7d9d['id']});_0x5ca5e9[_0x72b6('0xb')]({'type':_0x2fdd97[_0x72b6('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x72b6('0x46'),'context':_0x5c7d9d[_0x72b6('0x5')],'exten':_0x5c7d9d[_0x72b6('0x6')],'priority':_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')]+_0x36398f+_0x5b5d99++,'VoiceExtensionId':_0x5c7d9d['id']});}else{_0x5ca5e9[_0x72b6('0xb')]({'type':_0x2fdd97[_0x72b6('0x4')][_0x72b6('0x39')](),'app':_0x72b6('0x16'),'appdata':_0x72b6('0x47'),'context':_0x5c7d9d['context'],'exten':_0x5c7d9d[_0x72b6('0x6')],'priority':_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')]+_0x36398f+_0x5b5d99++,'VoiceExtensionId':_0x5c7d9d['id']});_0x5ca5e9[_0x72b6('0xb')]({'type':_0x2fdd97[_0x72b6('0x4')][_0x72b6('0x39')](),'app':_0x72b6('0x8'),'appdata':_0x72b6('0x48'),'context':_0x5c7d9d[_0x72b6('0x5')],'exten':_0x5c7d9d[_0x72b6('0x6')],'priority':_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')]+_0x36398f+_0x5b5d99++,'VoiceExtensionId':_0x5c7d9d['id']});}}}}for(var _0xba69e8=0x0;_0xba69e8<_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')];_0xba69e8++){var _0x354ece=_0x36398f+_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')];var _0x8aba2e=_0xba69e8===_0x2fdd97[_0x72b6('0x36')][_0x72b6('0x22')]-0x1?_0x36398f+_0x5ca5e9['length']+_0x4121db['length']+0x2:_0x36398f+_0xba69e8+0x1;_0x5ca5e9[_0x72b6('0x49')](_0xba69e8,0x0,{'type':_0x5c7d9d[_0x72b6('0x4')],'app':_0x72b6('0x4a'),'appdata':_0x2fdd97[_0x72b6('0x36')][_0xba69e8]+'?'+_0x5c7d9d[_0x72b6('0x5')]+',${EXTEN},'+_0x354ece+':'+_0x5c7d9d['context']+_0x72b6('0x4b')+_0x8aba2e,'exten':_0x5c7d9d[_0x72b6('0x6')],'context':_0x5c7d9d['context'],'priority':_0x36398f+_0xba69e8,'VoiceExtensionId':_0x5c7d9d['id']});}if(_0x2fdd97[_0x72b6('0x43')]==='outboundDial')_0x2fdd97[_0x72b6('0x4c')]=_0x48c6c0(_0x5c7d9d,_0x2fdd97['appdata']);_0x2fdd97[_0x72b6('0x4d')]=_0x5ca5e9[_0x72b6('0x22')]?_[_0x72b6('0x4e')](_0x5ca5e9)['priority']+0x1:_0x36398f;_0x272407=_['concat'](_0x272407,_0x5ca5e9,[_0x2fdd97],_0x4121db);_0x36398f=_['last'](_0x272407)[_0x72b6('0x4d')]+0x1;}return _0x26a700(_0x272407);})[_0x72b6('0x4f')](function(_0x2ae634){_0xd6b961(_0x2ae634);});});}return _0x40cf58[_0x72b6('0x50')](_0x72b6('0x51'),attributes,{'tableName':_0x72b6('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1e385d){var _0x41ccb7=this[_0x72b6('0x53')]({'plain':!![]});var _0xcabf60=_0x41ccb7['type']==='outbound'?_0x55717c(_0x41ccb7):_0x5364a8(_0x41ccb7);return _0x1ec522(_0x41ccb7,_0x1e385d,_[_0x72b6('0x4e')](_0xcabf60)[_0x72b6('0x4d')]+0x1)[_0x72b6('0x34')](function(_0x5c567b){var _0x1045ea=_[_0x72b6('0x54')](_0xcabf60,_0x5c567b);_0x1045ea[_0x72b6('0xb')]({'type':_0x41ccb7[_0x72b6('0x4')],'app':_0x72b6('0x55'),'exten':_0x41ccb7['exten'],'context':_0x41ccb7[_0x72b6('0x5')],'priority':_[_0x72b6('0x4e')](_0x1045ea)[_0x72b6('0x4d')]+0x1,'VoiceExtensionId':_0x41ccb7['id']});return _0x1045ea;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 12a59c0..50e8968 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 _0xd47f=['result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','limit','map','include','model','attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','code','message','info'];(function(_0x1d2625,_0x3dc6ba){var _0x3295c6=function(_0x3c9439){while(--_0x3c9439){_0x1d2625['push'](_0x1d2625['shift']());}};_0x3295c6(++_0x3dc6ba);}(_0xd47f,0x1bd));var _0xfd47=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xd47f[_0x590851];return _0x3b0115;};'use strict';var _=require(_0xfd47('0x0'));var util=require('util');var moment=require(_0xfd47('0x1'));var BPromise=require(_0xfd47('0x2'));var rs=require(_0xfd47('0x3'));var fs=require('fs');var Redis=require(_0xfd47('0x4'));var db=require(_0xfd47('0x5'))['db'];var utils=require(_0xfd47('0x6'));var logger=require(_0xfd47('0x7'))(_0xfd47('0x8'));var config=require(_0xfd47('0x9'));var jayson=require(_0xfd47('0xa'));var client=jayson[_0xfd47('0xb')][_0xfd47('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfd47('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd47('0xe'))[_0xfd47('0xf')](socket);function respondWithRpcPromise(_0x180808,_0x2bd687,_0x3a174a){return new BPromise(function(_0x2cb7c2,_0x5a6644){return client['request'](_0x180808,_0x3a174a)[_0xfd47('0x10')](function(_0x5e5ad4){logger['info'](_0xfd47('0x11'),_0x2bd687,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2bd687,_0xfd47('0x12'),JSON['stringify'](_0x5e5ad4));if(_0x5e5ad4[_0xfd47('0x13')]){if(_0x5e5ad4[_0xfd47('0x13')][_0xfd47('0x14')]===0x1f4){logger['error'](_0xfd47('0x11'),_0x2bd687,_0x5e5ad4[_0xfd47('0x13')][_0xfd47('0x15')]);return _0x5a6644(_0x5e5ad4[_0xfd47('0x13')]['message']);}logger[_0xfd47('0x13')](_0xfd47('0x11'),_0x2bd687,_0x5e5ad4[_0xfd47('0x13')]['message']);return _0x2cb7c2(_0x5e5ad4['error'][_0xfd47('0x15')]);}else{logger[_0xfd47('0x16')](_0xfd47('0x11'),_0x2bd687,_0xfd47('0x12'));_0x2cb7c2(_0x5e5ad4[_0xfd47('0x17')]['message']);}})[_0xfd47('0x18')](function(_0x471472){logger[_0xfd47('0x13')](_0xfd47('0x11'),_0x2bd687,_0x471472);_0x5a6644(_0x471472);});});}exports[_0xfd47('0x19')]=function(_0x3e2d03){var _0x5d3c0f=this;return new Promise(function(_0x1af7bf,_0x59239c){return db[_0xfd47('0x1a')][_0xfd47('0x1b')]({'raw':_0x3e2d03[_0xfd47('0x1c')]?_0x3e2d03[_0xfd47('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3e2d03[_0xfd47('0x1c')]?_0x3e2d03[_0xfd47('0x1c')][_0xfd47('0x1d')]||null:null,'attributes':_0x3e2d03[_0xfd47('0x1c')]?_0x3e2d03['options']['attributes']||null:null,'limit':_0x3e2d03[_0xfd47('0x1c')]?_0x3e2d03[_0xfd47('0x1c')][_0xfd47('0x1e')]||null:null,'include':_0x3e2d03[_0xfd47('0x1c')]?_0x3e2d03[_0xfd47('0x1c')]['include']?_[_0xfd47('0x1f')](_0x3e2d03['options'][_0xfd47('0x20')],function(_0x26e5fa){return{'model':db[_0x26e5fa[_0xfd47('0x21')]],'as':_0x26e5fa['as'],'attributes':_0x26e5fa[_0xfd47('0x22')],'include':_0x26e5fa[_0xfd47('0x20')]?_[_0xfd47('0x1f')](_0x26e5fa[_0xfd47('0x20')],function(_0x504ce5){return{'model':db[_0x504ce5[_0xfd47('0x21')]],'as':_0x504ce5['as'],'attributes':_0x504ce5[_0xfd47('0x22')],'include':_0x504ce5[_0xfd47('0x20')]?_[_0xfd47('0x1f')](_0x504ce5[_0xfd47('0x20')],function(_0x4c9a78){return{'model':db[_0x4c9a78[_0xfd47('0x21')]],'as':_0x4c9a78['as'],'attributes':_0x4c9a78[_0xfd47('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfd47('0x10')](function(_0x332f6f){logger[_0xfd47('0x16')](_0xfd47('0x19'),_0x3e2d03);logger['debug'](_0xfd47('0x19'),_0x3e2d03,JSON[_0xfd47('0x23')](_0x332f6f));_0x1af7bf(_0x332f6f);})[_0xfd47('0x18')](function(_0x55bc70){logger[_0xfd47('0x13')]('GetVoiceExtension',_0x55bc70[_0xfd47('0x15')],_0x3e2d03);_0x59239c(_0x5d3c0f['error'](0x1f4,_0x55bc70[_0xfd47('0x15')]));});});}; \ No newline at end of file +var _0x00cd=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','map','include','model','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x00cd,0xee));var _0xd00c=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0x00cd[_0x580971];return _0x16d873;};'use strict';var _=require(_0xd00c('0x0'));var util=require(_0xd00c('0x1'));var moment=require(_0xd00c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd00c('0x3'));var db=require(_0xd00c('0x4'))['db'];var utils=require(_0xd00c('0x5'));var logger=require(_0xd00c('0x6'))(_0xd00c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd00c('0x8'));var client=jayson[_0xd00c('0x9')][_0xd00c('0xa')]({'port':0x232a});config[_0xd00c('0xb')]=_[_0xd00c('0xc')](config[_0xd00c('0xb')],{'host':_0xd00c('0xd'),'port':0x18eb});var socket=require(_0xd00c('0xe'))(new Redis(config[_0xd00c('0xb')]));require(_0xd00c('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b6955,_0x462615,_0x267343){return new BPromise(function(_0x3c7e4f,_0x1dee65){return client['request'](_0x5b6955,_0x267343)[_0xd00c('0x10')](function(_0x532556){logger[_0xd00c('0x11')](_0xd00c('0x12'),_0x462615,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x462615,'request\x20sent',JSON[_0xd00c('0x13')](_0x532556));if(_0x532556[_0xd00c('0x14')]){if(_0x532556[_0xd00c('0x14')]['code']===0x1f4){logger[_0xd00c('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x462615,_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);return _0x1dee65(_0x532556[_0xd00c('0x14')]['message']);}logger['error'](_0xd00c('0x12'),_0x462615,_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);return _0x3c7e4f(_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);}else{logger[_0xd00c('0x11')](_0xd00c('0x12'),_0x462615,_0xd00c('0x16'));_0x3c7e4f(_0x532556['result'][_0xd00c('0x15')]);}})[_0xd00c('0x17')](function(_0x110464){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x462615,_0x110464);_0x1dee65(_0x110464);});});}exports[_0xd00c('0x18')]=function(_0x271543){var _0x42b1b9=this;return new Promise(function(_0x29a748,_0xbced81){return db[_0xd00c('0x19')][_0xd00c('0x1a')]({'raw':_0x271543['options']?_0x271543[_0xd00c('0x1b')][_0xd00c('0x1c')]===undefined?!![]:![]:!![],'where':_0x271543[_0xd00c('0x1b')]?_0x271543[_0xd00c('0x1b')][_0xd00c('0x1d')]||null:null,'attributes':_0x271543['options']?_0x271543['options'][_0xd00c('0x1e')]||null:null,'limit':_0x271543[_0xd00c('0x1b')]?_0x271543['options']['limit']||null:null,'include':_0x271543['options']?_0x271543[_0xd00c('0x1b')]['include']?_[_0xd00c('0x1f')](_0x271543['options'][_0xd00c('0x20')],function(_0x276eef){return{'model':db[_0x276eef['model']],'as':_0x276eef['as'],'attributes':_0x276eef['attributes'],'include':_0x276eef[_0xd00c('0x20')]?_[_0xd00c('0x1f')](_0x276eef[_0xd00c('0x20')],function(_0x2f95e4){return{'model':db[_0x2f95e4['model']],'as':_0x2f95e4['as'],'attributes':_0x2f95e4[_0xd00c('0x1e')],'include':_0x2f95e4[_0xd00c('0x20')]?_[_0xd00c('0x1f')](_0x2f95e4[_0xd00c('0x20')],function(_0x4987c5){return{'model':db[_0x4987c5[_0xd00c('0x21')]],'as':_0x4987c5['as'],'attributes':_0x4987c5['attributes']};}):[]};}):[]};}):[]:[]})[_0xd00c('0x10')](function(_0x127a0b){logger[_0xd00c('0x11')](_0xd00c('0x18'),_0x271543);logger[_0xd00c('0x22')](_0xd00c('0x18'),_0x271543,JSON[_0xd00c('0x13')](_0x127a0b));_0x29a748(_0x127a0b);})[_0xd00c('0x17')](function(_0x1345dd){logger[_0xd00c('0x14')](_0xd00c('0x18'),_0x1345dd[_0xd00c('0x15')],_0x271543);_0xbced81(_0x42b1b9[_0xd00c('0x14')](0x1f4,_0x1345dd[_0xd00c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3f5fe3b..205e542 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x55c559,_0x274c77){var _0x38ffa3=function(_0x36ffe7){while(--_0x36ffe7){_0x55c559['push'](_0x55c559['shift']());}};_0x38ffa3(++_0x274c77);}(_0xf494,0x1c6));var _0x4f49=function(_0x5119d3,_0x33bfde){_0x5119d3=_0x5119d3-0x0;var _0x7c542c=_0xf494[_0x5119d3];return _0x7c542c;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1a9046,_0x35c086){var _0x4d5ce8=function(_0x2319e9){while(--_0x2319e9){_0x1a9046['push'](_0x1a9046['shift']());}};_0x4d5ce8(++_0x35c086);}(_0x53ec,0x192));var _0xc53e=function(_0x2b12b7,_0x2621a1){_0x2b12b7=_0x2b12b7-0x0;var _0x2c7af3=_0x53ec[_0x2b12b7];return _0x2c7af3;};'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 20ed299..798efd7 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 _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x26d656,_0x241077){var _0x2645dc=function(_0xc59dd8){while(--_0xc59dd8){_0x26d656['push'](_0x26d656['shift']());}};_0x2645dc(++_0x241077);}(_0x7880,0x1f4));var _0x0788=function(_0x54b9c6,_0x2c697e){_0x54b9c6=_0x54b9c6-0x0;var _0x251824=_0x7880[_0x54b9c6];return _0x251824;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','show','getMessages','post','isAuthenticated','put','delete','exports'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0xd8fb,0x99));var _0xbd8f=function(_0x213b28,_0xb7631c){_0x213b28=_0x213b28-0x0;var _0x42648e=_0xd8fb[_0x213b28];return _0x42648e;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0xc')]('/',auth[_0xbd8f('0xd')](),controller['create']);router[_0xbd8f('0xe')](_0xbd8f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xbd8f('0xf')](_0xbd8f('0x9'),auth[_0xbd8f('0xd')](),controller['destroy']);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ad79aae..a6e0123 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 _0xefab=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email'];(function(_0x231f6f,_0xf231e0){var _0xc621c4=function(_0x5c8549){while(--_0x5c8549){_0x231f6f['push'](_0x231f6f['shift']());}};_0xc621c4(++_0xf231e0);}(_0xefab,0x1cb));var _0xbefa=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0xefab[_0x53f04f];return _0x16a824;};'use strict';var Sequelize=require(_0xbefa('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xbefa('0x1')]},'context':{'type':Sequelize[_0xbefa('0x1')],'defaultValue':'from-voicemail','unique':_0xbefa('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xbefa('0x1')]},'email':{'type':Sequelize[_0xbefa('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5a3557){this[_0xbefa('0x3')](_0xbefa('0x4'),typeof _0x5a3557==='string'&&_0x5a3557['trim']()?_0x5a3557[_0xbefa('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xbefa('0x6')},'attach':{'type':Sequelize[_0xbefa('0x7')]('yes','no'),'defaultValue':_0xbefa('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbefa('0x7')](_0xbefa('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbefa('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbefa('0x7')](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbefa('0x7')](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbefa('0x7')](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbefa('0x7')](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbefa('0x7')](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbefa('0x7')]('yes','no'),'defaultValue':_0xbefa('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xbefa('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbefa('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xbefa('0x9')},'emailsubject':{'type':Sequelize[_0xbefa('0x1')]},'emailbody':{'type':Sequelize[_0xbefa('0x1')]},'maxsecs':{'type':Sequelize[_0xbefa('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbefa('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbefa('0xb')],'get':function(){return this[_0xbefa('0xc')](_0xbefa('0xd'))+_0xbefa('0xe')+this[_0xbefa('0xc')](_0xbefa('0xf'));}}}; \ No newline at end of file +var _0xd62d=['setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0xd62d,0xb0));var _0xdd62=function(_0x40fc5b,_0x4b8a46){_0x40fc5b=_0x40fc5b-0x0;var _0x5af2ce=_0xd62d[_0x40fc5b];return _0x5af2ce;};'use strict';var Sequelize=require('sequelize');module[_0xdd62('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xdd62('0x1')],'defaultValue':_0xdd62('0x2'),'unique':_0xdd62('0x3')},'mailbox':{'type':Sequelize[_0xdd62('0x1')],'defaultValue':'','allowNull':![],'unique':_0xdd62('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdd62('0x1')],'validate':{'isEmail':!![]},'set':function(_0x224e7a){this[_0xdd62('0x4')](_0xdd62('0x5'),typeof _0x224e7a===_0xdd62('0x6')&&_0x224e7a[_0xdd62('0x7')]()?_0x224e7a[_0xdd62('0x7')]():null);}},'pager':{'type':Sequelize[_0xdd62('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xdd62('0x8')},'attach':{'type':Sequelize['ENUM'](_0xdd62('0x9'),'no'),'defaultValue':_0xdd62('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xdd62('0xa')]('yes','no'),'defaultValue':_0xdd62('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xdd62('0x1')]},'callback':{'type':Sequelize[_0xdd62('0x1')]},'review':{'type':Sequelize[_0xdd62('0xa')](_0xdd62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xdd62('0xa')](_0xdd62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xdd62('0xa')](_0xdd62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xdd62('0xa')](_0xdd62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xdd62('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xdd62('0xa')](_0xdd62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xdd62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xdd62('0xa')](_0xdd62('0x9'),'no'),'defaultValue':_0xdd62('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xdd62('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xdd62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xdd62('0xa')](_0xdd62('0x9'),'no'),'defaultValue':_0xdd62('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xdd62('0x1')]},'emailbody':{'type':Sequelize[_0xdd62('0x1')]},'maxsecs':{'type':Sequelize[_0xdd62('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xdd62('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xdd62('0xd')],'get':function(){return this[_0xdd62('0xe')](_0xdd62('0xf'))+_0xdd62('0x10')+this[_0xdd62('0xe')](_0xdd62('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e23a6bb..bf16f22 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 _0x4fc2=['nolimit','mailbox','VoiceMailMessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','get','Voicemails','UserProfileResource','stack','name','send','map','VoiceMail','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne'];(function(_0x410a97,_0x6be234){var _0x35061a=function(_0x4bc23f){while(--_0x4bc23f){_0x410a97['push'](_0x410a97['shift']());}};_0x35061a(++_0x6be234);}(_0x4fc2,0x111));var _0x24fc=function(_0x50bd62,_0x217adb){_0x50bd62=_0x50bd62-0x0;var _0x3384f3=_0x4fc2[_0x50bd62];return _0x3384f3;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1b')](_0x306873);}return _0x5cc65e[_0x24fc('0x1c')](_0x306873)[_0x24fc('0x1d')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1c')](_0x537b5c)[_0x24fc('0x1e')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=typeof _0x4acd36[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x4acd36[_0x24fc('0x21')]===_0x24fc('0x20');var _0x25cb40=_0x2ac989['count'];var _0x23873c=_0x588543?0x0:_0x4acd36[_0x24fc('0x1f')];var _0x6cfa0a=_0x588543?_0x2ac989[_0x24fc('0x22')]:_0x4acd36['offset']+_0x4acd36[_0x24fc('0x21')];var _0x4073e0;if(_0x6cfa0a>=_0x25cb40){_0x6cfa0a=_0x25cb40;_0x4073e0=0xc8;}else{_0x4073e0=0xce;}_0x42cbe8[_0x24fc('0x1c')](_0x4073e0);return _0x42cbe8['set'](_0x24fc('0x23'),_0x23873c+'-'+_0x6cfa0a+'/'+_0x25cb40)[_0x24fc('0x1e')](_0x2ac989);}return null;};}function patchUpdates(_0xbf1d6b){return function(_0x2d0e3d){try{jsonpatch['apply'](_0x2d0e3d,_0xbf1d6b,!![]);}catch(_0x323beb){return BPromise['reject'](_0x323beb);}return _0x2d0e3d[_0x24fc('0x24')]();};}function saveUpdates(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x25')](_0x591c8f)['then'](function(_0x313a25){return _0x313a25;});}return null;};}function removeEntity(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(_0x2bb93a){return _0x2bb93a[_0x24fc('0x26')]()[_0x24fc('0x27')](function(){var _0x3296fc=_0x2bb93a[_0x24fc('0x28')]({'plain':!![]});var _0x3f0875=_0x24fc('0x29');return db[_0x24fc('0x2a')][_0x24fc('0x26')]({'where':{'type':_0x3f0875,'resourceId':_0x3296fc['id']}})['then'](function(){return _0x2bb93a;});})[_0x24fc('0x27')](function(){_0x552035[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x5bb4c8,_0xf2f77d){return function(_0x3d1ec8){if(!_0x3d1ec8){_0x5bb4c8[_0x24fc('0x1b')](0x194);}return _0x3d1ec8;};}function handleError(_0x290f84,_0x8f2528){_0x8f2528=_0x8f2528||0x1f4;return function(_0x443796){logger['error'](_0x443796[_0x24fc('0x2b')]);if(_0x443796[_0x24fc('0x2c')]){delete _0x443796[_0x24fc('0x2c')];}_0x290f84[_0x24fc('0x1c')](_0x8f2528)[_0x24fc('0x2d')](_0x443796);};}exports['index']=function(_0x55c27f,_0x4e6f73){var _0x3df6f4={},_0x574ba3={},_0x3f2464={'count':0x0,'rows':[]};var _0x3e6389=_[_0x24fc('0x2e')](db[_0x24fc('0x2f')]['rawAttributes'],function(_0x66eec0){return{'name':_0x66eec0[_0x24fc('0x30')],'type':_0x66eec0['type'][_0x24fc('0x31')]};});_0x574ba3[_0x24fc('0x32')]=_['map'](_0x3e6389,'name');_0x574ba3[_0x24fc('0x33')]=_['keys'](_0x55c27f[_0x24fc('0x33')]);_0x574ba3[_0x24fc('0x34')]=_['intersection'](_0x574ba3[_0x24fc('0x32')],_0x574ba3[_0x24fc('0x33')]);_0x3df6f4[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x574ba3[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x37')]));_0x3df6f4[_0x24fc('0x35')]=_0x3df6f4['attributes'][_0x24fc('0x38')]?_0x3df6f4[_0x24fc('0x35')]:_0x574ba3[_0x24fc('0x32')];if(!_0x55c27f[_0x24fc('0x33')][_0x24fc('0x39')]('nolimit')){_0x3df6f4['limit']=qs[_0x24fc('0x21')](_0x55c27f['query'][_0x24fc('0x21')]);_0x3df6f4[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x55c27f[_0x24fc('0x33')]['offset']);}_0x3df6f4[_0x24fc('0x3a')]=qs['sort'](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3b')]);_0x3df6f4[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x55c27f['query'],_0x574ba3[_0x24fc('0x34')]),_0x3e6389);if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]){_0x3df6f4[_0x24fc('0x3c')]=_['merge'](_0x3df6f4[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0x3e6389,function(_0x56306e){if(_0x56306e[_0x24fc('0x3f')]!=='VIRTUAL'){var _0x320f7b={};_0x320f7b[_0x56306e[_0x24fc('0x2c')]]={'$like':'%'+_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]+'%'};return _0x320f7b;}})});}_0x3df6f4=_[_0x24fc('0x40')]({},_0x3df6f4,_0x55c27f[_0x24fc('0x41')]);var _0x77b959={'where':_0x3df6f4[_0x24fc('0x3c')]};return db['VoiceMail'][_0x24fc('0x22')](_0x77b959)[_0x24fc('0x27')](function(_0x32f72c){_0x3f2464['count']=_0x32f72c;if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x42')]){_0x3df6f4['include']=[{'all':!![]}];}return db[_0x24fc('0x2f')][_0x24fc('0x43')](_0x3df6f4);})[_0x24fc('0x27')](function(_0x5e4e9b){_0x3f2464[_0x24fc('0x44')]=_0x5e4e9b;return _0x3f2464;})[_0x24fc('0x27')](respondWithFilteredResult(_0x4e6f73,_0x3df6f4))['catch'](handleError(_0x4e6f73,null));};exports[_0x24fc('0x45')]=function(_0x169982,_0x158f7b){var _0x2a0ac4={'raw':!![],'where':{'id':_0x169982[_0x24fc('0x46')]['id']}},_0x4c8dad={};_0x4c8dad[_0x24fc('0x32')]=_[_0x24fc('0x47')](db[_0x24fc('0x2f')][_0x24fc('0x48')]);_0x4c8dad['query']=_[_0x24fc('0x47')](_0x169982[_0x24fc('0x33')]);_0x4c8dad[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x4c8dad['model'],_0x4c8dad[_0x24fc('0x33')]);_0x2a0ac4[_0x24fc('0x35')]=_['intersection'](_0x4c8dad['model'],qs[_0x24fc('0x37')](_0x169982['query']['fields']));_0x2a0ac4[_0x24fc('0x35')]=_0x2a0ac4['attributes'][_0x24fc('0x38')]?_0x2a0ac4[_0x24fc('0x35')]:_0x4c8dad[_0x24fc('0x32')];if(_0x169982['query'][_0x24fc('0x42')]){_0x2a0ac4[_0x24fc('0x49')]=[{'all':!![]}];}_0x2a0ac4=_[_0x24fc('0x40')]({},_0x2a0ac4,_0x169982[_0x24fc('0x41')]);return db[_0x24fc('0x2f')][_0x24fc('0x4a')](_0x2a0ac4)[_0x24fc('0x27')](handleEntityNotFound(_0x158f7b,null))[_0x24fc('0x27')](respondWithResult(_0x158f7b,null))['catch'](handleError(_0x158f7b,null));};exports['create']=function(_0x266378,_0x2f1a99){return db[_0x24fc('0x2f')]['create'](_0x266378['body'],{})[_0x24fc('0x27')](function(_0x213439){var _0x179a60=_0x266378[_0x24fc('0x4b')][_0x24fc('0x28')]({'plain':!![]});if(!_0x179a60)throw new Error(_0x24fc('0x4c'));if(_0x179a60[_0x24fc('0x4d')]===_0x24fc('0x4b')){var _0x1671b0=_0x213439[_0x24fc('0x28')]({'plain':!![]});var _0x434700=_0x24fc('0x29');return db['UserProfileSection'][_0x24fc('0x4a')]({'where':{'name':_0x434700,'userProfileId':_0x179a60[_0x24fc('0x4e')]},'raw':!![]})[_0x24fc('0x27')](function(_0xb0fc00){if(_0xb0fc00&&_0xb0fc00[_0x24fc('0x4f')]===0x0){return db['UserProfileResource'][_0x24fc('0x50')]({'name':_0x1671b0['name'],'resourceId':_0x1671b0['id'],'type':_0xb0fc00[_0x24fc('0x2c')],'sectionId':_0xb0fc00['id']},{})[_0x24fc('0x27')](function(){return _0x213439;});}else{return _0x213439;}})[_0x24fc('0x51')](function(_0x41ddfb){logger[_0x24fc('0x52')](_0x24fc('0x53'),_0x41ddfb);throw _0x41ddfb;});}return _0x213439;})['then'](respondWithResult(_0x2f1a99,0xc9))[_0x24fc('0x51')](handleError(_0x2f1a99,null));};exports[_0x24fc('0x25')]=function(_0xc49d9f,_0x31a2ef){if(_0xc49d9f[_0x24fc('0x54')]['id']){delete _0xc49d9f[_0x24fc('0x54')]['id'];}return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xc49d9f[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x31a2ef,null))[_0x24fc('0x27')](saveUpdates(_0xc49d9f[_0x24fc('0x54')],null))[_0x24fc('0x27')](respondWithResult(_0x31a2ef,null))[_0x24fc('0x51')](handleError(_0x31a2ef,null));};exports['destroy']=function(_0xd673f8,_0x11690f){return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xd673f8[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x11690f,null))[_0x24fc('0x27')](removeEntity(_0x11690f,null))[_0x24fc('0x51')](handleError(_0x11690f,null));};exports[_0x24fc('0x55')]=function(_0x50302e,_0x28a44c,_0x4a0524){return db[_0x24fc('0x2f')][_0x24fc('0x56')]({'where':{'id':_0x50302e['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x28a44c,null))['then'](function(_0x1c1f74){var _0x595c47;var _0xdff811={},_0x27b612={};_0x27b612['model']=_[_0x24fc('0x47')](db['VoiceMailMessage'][_0x24fc('0x48')]);_0x27b612[_0x24fc('0x33')]=_['keys'](_0x50302e[_0x24fc('0x33')]);_0x27b612[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],_0x27b612[_0x24fc('0x33')]);_0xdff811['attributes']=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x37')]));_0xdff811['attributes']=_0xdff811['attributes'][_0x24fc('0x38')]?_0xdff811[_0x24fc('0x35')]:_0x27b612['model'];if(!_0x50302e['query'][_0x24fc('0x39')](_0x24fc('0x57'))){_0xdff811[_0x24fc('0x21')]=qs[_0x24fc('0x21')](_0x50302e['query'][_0x24fc('0x21')]);_0xdff811[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x1f')]);}_0xdff811[_0x24fc('0x3a')]=qs[_0x24fc('0x3b')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x3b')]);_0xdff811[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x50302e[_0x24fc('0x33')],_0x27b612[_0x24fc('0x34')]));if(_0x50302e[_0x24fc('0x33')]['filter']){_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0xdff811[_0x24fc('0x35')],function(_0x2eb6dc){var _0x10d148={};_0x10d148[_0x2eb6dc]={'$like':'%'+_0x50302e[_0x24fc('0x33')]['filter']+'%'};return _0x10d148;})});}_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'mailboxuser':_0x1c1f74[_0x24fc('0x58')]});_0xdff811=_['merge']({},_0xdff811,_0x50302e[_0x24fc('0x41')]);return db[_0x24fc('0x59')]['findAndCountAll'](_0xdff811)['then'](respondWithFilteredResult(_0x28a44c,_0xdff811));})['catch'](handleError(_0x28a44c,null));}; \ No newline at end of file +var _0xbee3=['map','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','rawAttributes','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','nolimit','order','mailbox','findAndCountAll','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index'];(function(_0x4ed0bb,_0xf3eb2e){var _0x427027=function(_0x407e12){while(--_0x407e12){_0x4ed0bb['push'](_0x4ed0bb['shift']());}};_0x427027(++_0xf3eb2e);}(_0xbee3,0xd5));var _0x3bee=function(_0x15e869,_0x3c536c){_0x15e869=_0x15e869-0x0;var _0x4a13eb=_0xbee3[_0x15e869];return _0x4a13eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){var _0x45249c=_0x1fed5a[_0x3bee('0x26')]({'plain':!![]});var _0x1e0111='Voicemails';return db['UserProfileResource'][_0x3bee('0x25')]({'where':{'type':_0x1e0111,'resourceId':_0x45249c['id']}})[_0x3bee('0x24')](function(){return _0x1fed5a;});})['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x27')]();});}};}function handleEntityNotFound(_0x2e666a,_0x5b1eec){return function(_0x1984c4){if(!_0x1984c4){_0x2e666a[_0x3bee('0x17')](0x194);}return _0x1984c4;};}function handleError(_0x150766,_0x4f2066){_0x4f2066=_0x4f2066||0x1f4;return function(_0x239fa4){logger[_0x3bee('0x28')](_0x239fa4[_0x3bee('0x29')]);if(_0x239fa4['name']){delete _0x239fa4[_0x3bee('0x2a')];}_0x150766[_0x3bee('0x18')](_0x4f2066)[_0x3bee('0x2b')](_0x239fa4);};}exports[_0x3bee('0x2c')]=function(_0x3433aa,_0x559c2b){var _0x564e45={},_0x3fbc8c={},_0x1e1529={'count':0x0,'rows':[]};var _0x10bae0=_[_0x3bee('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x38f93c){return{'name':_0x38f93c[_0x3bee('0x2e')],'type':_0x38f93c['type']['key']};});_0x3fbc8c[_0x3bee('0x2f')]=_[_0x3bee('0x2d')](_0x10bae0,_0x3bee('0x2a'));_0x3fbc8c[_0x3bee('0x30')]=_[_0x3bee('0x31')](_0x3433aa[_0x3bee('0x30')]);_0x3fbc8c[_0x3bee('0x32')]=_[_0x3bee('0x33')](_0x3fbc8c[_0x3bee('0x2f')],_0x3fbc8c[_0x3bee('0x30')]);_0x564e45['attributes']=_['intersection'](_0x3fbc8c[_0x3bee('0x2f')],qs['fields'](_0x3433aa['query'][_0x3bee('0x34')]));_0x564e45[_0x3bee('0x35')]=_0x564e45[_0x3bee('0x35')][_0x3bee('0x36')]?_0x564e45[_0x3bee('0x35')]:_0x3fbc8c[_0x3bee('0x2f')];if(!_0x3433aa[_0x3bee('0x30')][_0x3bee('0x37')]('nolimit')){_0x564e45[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x3433aa['query'][_0x3bee('0x1d')]);_0x564e45[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x3433aa[_0x3bee('0x30')][_0x3bee('0x1a')]);}_0x564e45['order']=qs['sort'](_0x3433aa[_0x3bee('0x30')][_0x3bee('0x38')]);_0x564e45[_0x3bee('0x39')]=qs[_0x3bee('0x32')](_[_0x3bee('0x3a')](_0x3433aa[_0x3bee('0x30')],_0x3fbc8c[_0x3bee('0x32')]),_0x10bae0);if(_0x3433aa[_0x3bee('0x30')][_0x3bee('0x3b')]){_0x564e45[_0x3bee('0x39')]=_[_0x3bee('0x3c')](_0x564e45[_0x3bee('0x39')],{'$or':_['map'](_0x10bae0,function(_0xaceed4){if(_0xaceed4[_0x3bee('0x3d')]!==_0x3bee('0x3e')){var _0x45cf81={};_0x45cf81[_0xaceed4[_0x3bee('0x2a')]]={'$like':'%'+_0x3433aa[_0x3bee('0x30')][_0x3bee('0x3b')]+'%'};return _0x45cf81;}})});}_0x564e45=_[_0x3bee('0x3c')]({},_0x564e45,_0x3433aa[_0x3bee('0x3f')]);var _0x12ba6f={'where':_0x564e45[_0x3bee('0x39')]};return db[_0x3bee('0x40')][_0x3bee('0x1c')](_0x12ba6f)['then'](function(_0x2b773d){_0x1e1529[_0x3bee('0x1c')]=_0x2b773d;if(_0x3433aa[_0x3bee('0x30')][_0x3bee('0x41')]){_0x564e45[_0x3bee('0x42')]=[{'all':!![]}];}return db[_0x3bee('0x40')][_0x3bee('0x43')](_0x564e45);})[_0x3bee('0x24')](function(_0x5d9e1b){_0x1e1529[_0x3bee('0x44')]=_0x5d9e1b;return _0x1e1529;})[_0x3bee('0x24')](respondWithFilteredResult(_0x559c2b,_0x564e45))[_0x3bee('0x45')](handleError(_0x559c2b,null));};exports['show']=function(_0x4567f2,_0x57113b){var _0x2b1677={'raw':!![],'where':{'id':_0x4567f2['params']['id']}},_0x48325e={};_0x48325e[_0x3bee('0x2f')]=_[_0x3bee('0x31')](db[_0x3bee('0x40')][_0x3bee('0x46')]);_0x48325e[_0x3bee('0x30')]=_['keys'](_0x4567f2['query']);_0x48325e[_0x3bee('0x32')]=_['intersection'](_0x48325e[_0x3bee('0x2f')],_0x48325e['query']);_0x2b1677[_0x3bee('0x35')]=_['intersection'](_0x48325e[_0x3bee('0x2f')],qs[_0x3bee('0x34')](_0x4567f2[_0x3bee('0x30')][_0x3bee('0x34')]));_0x2b1677['attributes']=_0x2b1677['attributes'][_0x3bee('0x36')]?_0x2b1677['attributes']:_0x48325e['model'];if(_0x4567f2['query'][_0x3bee('0x41')]){_0x2b1677['include']=[{'all':!![]}];}_0x2b1677=_[_0x3bee('0x3c')]({},_0x2b1677,_0x4567f2[_0x3bee('0x3f')]);return db[_0x3bee('0x40')]['find'](_0x2b1677)[_0x3bee('0x24')](handleEntityNotFound(_0x57113b,null))['then'](respondWithResult(_0x57113b,null))[_0x3bee('0x45')](handleError(_0x57113b,null));};exports['create']=function(_0x26ccd7,_0x16b096){return db[_0x3bee('0x40')]['create'](_0x26ccd7[_0x3bee('0x47')],{})[_0x3bee('0x24')](function(_0x477de2){var _0x504382=_0x26ccd7['user'][_0x3bee('0x26')]({'plain':!![]});if(!_0x504382)throw new Error(_0x3bee('0x48'));if(_0x504382[_0x3bee('0x49')]===_0x3bee('0x4a')){var _0x3b5d7a=_0x477de2[_0x3bee('0x26')]({'plain':!![]});var _0x4005a3='Voicemails';return db[_0x3bee('0x4b')][_0x3bee('0x4c')]({'where':{'name':_0x4005a3,'userProfileId':_0x504382['userProfileId']},'raw':!![]})['then'](function(_0x3730c5){if(_0x3730c5&&_0x3730c5['autoAssociation']===0x0){return db[_0x3bee('0x4d')][_0x3bee('0x4e')]({'name':_0x3b5d7a[_0x3bee('0x2a')],'resourceId':_0x3b5d7a['id'],'type':_0x3730c5['name'],'sectionId':_0x3730c5['id']},{})[_0x3bee('0x24')](function(){return _0x477de2;});}else{return _0x477de2;}})[_0x3bee('0x45')](function(_0x127cb8){logger['error'](_0x3bee('0x4f'),_0x127cb8);throw _0x127cb8;});}return _0x477de2;})[_0x3bee('0x24')](respondWithResult(_0x16b096,0xc9))['catch'](handleError(_0x16b096,null));};exports[_0x3bee('0x23')]=function(_0x14940e,_0x53c881){if(_0x14940e[_0x3bee('0x47')]['id']){delete _0x14940e[_0x3bee('0x47')]['id'];}return db[_0x3bee('0x40')][_0x3bee('0x4c')]({'where':{'id':_0x14940e[_0x3bee('0x50')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x53c881,null))[_0x3bee('0x24')](saveUpdates(_0x14940e[_0x3bee('0x47')],null))['then'](respondWithResult(_0x53c881,null))['catch'](handleError(_0x53c881,null));};exports[_0x3bee('0x25')]=function(_0x5e13e8,_0x38b82a){return db[_0x3bee('0x40')][_0x3bee('0x4c')]({'where':{'id':_0x5e13e8['params']['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x38b82a,null))[_0x3bee('0x24')](removeEntity(_0x38b82a,null))[_0x3bee('0x45')](handleError(_0x38b82a,null));};exports['getMessages']=function(_0x19cbb8,_0x52a327,_0x3cb900){return db[_0x3bee('0x40')][_0x3bee('0x51')]({'where':{'id':_0x19cbb8['params']['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x52a327,null))[_0x3bee('0x24')](function(_0x282300){var _0x526551;var _0x5d95a7={},_0xb9f53e={};_0xb9f53e[_0x3bee('0x2f')]=_[_0x3bee('0x31')](db['VoiceMailMessage']['rawAttributes']);_0xb9f53e[_0x3bee('0x30')]=_['keys'](_0x19cbb8['query']);_0xb9f53e[_0x3bee('0x32')]=_[_0x3bee('0x33')](_0xb9f53e[_0x3bee('0x2f')],_0xb9f53e['query']);_0x5d95a7['attributes']=_[_0x3bee('0x33')](_0xb9f53e[_0x3bee('0x2f')],qs['fields'](_0x19cbb8[_0x3bee('0x30')]['fields']));_0x5d95a7[_0x3bee('0x35')]=_0x5d95a7[_0x3bee('0x35')][_0x3bee('0x36')]?_0x5d95a7[_0x3bee('0x35')]:_0xb9f53e[_0x3bee('0x2f')];if(!_0x19cbb8[_0x3bee('0x30')][_0x3bee('0x37')](_0x3bee('0x52'))){_0x5d95a7[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x19cbb8[_0x3bee('0x30')]['limit']);_0x5d95a7['offset']=qs['offset'](_0x19cbb8[_0x3bee('0x30')][_0x3bee('0x1a')]);}_0x5d95a7[_0x3bee('0x53')]=qs[_0x3bee('0x38')](_0x19cbb8['query'][_0x3bee('0x38')]);_0x5d95a7[_0x3bee('0x39')]=qs['filters'](_['pick'](_0x19cbb8[_0x3bee('0x30')],_0xb9f53e[_0x3bee('0x32')]));if(_0x19cbb8[_0x3bee('0x30')]['filter']){_0x5d95a7[_0x3bee('0x39')]=_[_0x3bee('0x3c')](_0x5d95a7[_0x3bee('0x39')],{'$or':_['map'](_0x5d95a7[_0x3bee('0x35')],function(_0x412e0d){var _0x1bfb3a={};_0x1bfb3a[_0x412e0d]={'$like':'%'+_0x19cbb8[_0x3bee('0x30')]['filter']+'%'};return _0x1bfb3a;})});}_0x5d95a7['where']=_[_0x3bee('0x3c')](_0x5d95a7[_0x3bee('0x39')],{'mailboxuser':_0x282300[_0x3bee('0x54')]});_0x5d95a7=_[_0x3bee('0x3c')]({},_0x5d95a7,_0x19cbb8[_0x3bee('0x3f')]);return db['VoiceMailMessage'][_0x3bee('0x55')](_0x5d95a7)['then'](respondWithFilteredResult(_0x52a327,_0x5d95a7));})[_0x3bee('0x45')](handleError(_0x52a327,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2a2fd5e..83bcdbe 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 _0x0ba7=['VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','define'];(function(_0x4dff89,_0x247c7d){var _0x1d278c=function(_0x5551fe){while(--_0x5551fe){_0x4dff89['push'](_0x4dff89['shift']());}};_0x1d278c(++_0x247c7d);}(_0x0ba7,0x94));var _0x70ba=function(_0x389e88,_0x41a59c){_0x389e88=_0x389e88-0x0;var _0x141193=_0x0ba7[_0x389e88];return _0x141193;};'use strict';var _=require(_0x70ba('0x0'));var util=require(_0x70ba('0x1'));var logger=require(_0x70ba('0x2'))(_0x70ba('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x70ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70ba('0x5'));var config=require(_0x70ba('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x70c742,_0x473d3e){return _0x70c742[_0x70ba('0x7')](_0x70ba('0x8'),attributes,{'tableName':_0x70ba('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x70ba('0xa'),_0x70ba('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7343=['define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','request-promise','path','rimraf','./voiceMail.attributes','exports'];(function(_0x1e7a6b,_0x2fd339){var _0x2cb4f0=function(_0x17e9d2){while(--_0x17e9d2){_0x1e7a6b['push'](_0x1e7a6b['shift']());}};_0x2cb4f0(++_0x2fd339);}(_0x7343,0xe5));var _0x3734=function(_0x426323,_0x124f14){_0x426323=_0x426323-0x0;var _0x2fb03c=_0x7343[_0x426323];return _0x2fb03c;};'use strict';var _=require(_0x3734('0x0'));var util=require(_0x3734('0x1'));var logger=require(_0x3734('0x2'))(_0x3734('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3734('0x4'));var fs=require('fs');var path=require(_0x3734('0x5'));var rimraf=require(_0x3734('0x6'));var config=require('../../config/environment');var attributes=require(_0x3734('0x7'));module[_0x3734('0x8')]=function(_0x44b024,_0x5636a7){return _0x44b024[_0x3734('0x9')](_0x3734('0xa'),attributes,{'tableName':_0x3734('0xb'),'paranoid':![],'indexes':[{'name':_0x3734('0xc'),'fields':['mailbox',_0x3734('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f9680fb..c8f433c 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 _0x3ec1=['randomstring','ioredis','../../config/environment','jayson/promise','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x37d7e4,_0x3817e3){var _0xfc35d9=function(_0xff9687){while(--_0xff9687){_0x37d7e4['push'](_0x37d7e4['shift']());}};_0xfc35d9(++_0x3817e3);}(_0x3ec1,0x9e));var _0x13ec=function(_0x5d1132,_0x4a1f7a){_0x5d1132=_0x5d1132-0x0;var _0x4c5878=_0x3ec1[_0x5d1132];return _0x4c5878;};'use strict';var _=require(_0x13ec('0x0'));var util=require(_0x13ec('0x1'));var moment=require(_0x13ec('0x2'));var BPromise=require(_0x13ec('0x3'));var rs=require(_0x13ec('0x4'));var fs=require('fs');var Redis=require(_0x13ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x13ec('0x6'));var jayson=require(_0x13ec('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33f39a,_0x4c876f,_0x134c24){return new BPromise(function(_0x76b9ff,_0x758e47){return client[_0x13ec('0x8')](_0x33f39a,_0x134c24)['then'](function(_0x92fb8f){logger[_0x13ec('0x9')](_0x13ec('0xa'),_0x4c876f,_0x13ec('0xb'));logger['debug'](_0x13ec('0xc'),_0x4c876f,_0x13ec('0xb'),JSON['stringify'](_0x92fb8f));if(_0x92fb8f[_0x13ec('0xd')]){if(_0x92fb8f[_0x13ec('0xd')][_0x13ec('0xe')]===0x1f4){logger[_0x13ec('0xd')](_0x13ec('0xa'),_0x4c876f,_0x92fb8f[_0x13ec('0xd')][_0x13ec('0xf')]);return _0x758e47(_0x92fb8f[_0x13ec('0xd')][_0x13ec('0xf')]);}logger[_0x13ec('0xd')](_0x13ec('0xa'),_0x4c876f,_0x92fb8f[_0x13ec('0xd')][_0x13ec('0xf')]);return _0x76b9ff(_0x92fb8f[_0x13ec('0xd')]['message']);}else{logger[_0x13ec('0x9')](_0x13ec('0xa'),_0x4c876f,_0x13ec('0xb'));_0x76b9ff(_0x92fb8f[_0x13ec('0x10')][_0x13ec('0xf')]);}})[_0x13ec('0x11')](function(_0x1097e9){logger[_0x13ec('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4c876f,_0x1097e9);_0x758e47(_0x1097e9);});});} \ No newline at end of file +var _0x2e4f=['error','code','VoiceMail,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x2e4f,0x1d3));var _0xf2e4=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x2e4f[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0xf2e4('0x0'));var util=require('util');var moment=require(_0xf2e4('0x1'));var BPromise=require(_0xf2e4('0x2'));var rs=require(_0xf2e4('0x3'));var fs=require('fs');var Redis=require(_0xf2e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2e4('0x5'));var logger=require(_0xf2e4('0x6'))(_0xf2e4('0x7'));var config=require(_0xf2e4('0x8'));var jayson=require(_0xf2e4('0x9'));var client=jayson['client'][_0xf2e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3210ba,_0x59c3aa,_0x2e0295){return new BPromise(function(_0xf264c5,_0xf31eb4){return client[_0xf2e4('0xb')](_0x3210ba,_0x2e0295)[_0xf2e4('0xc')](function(_0x2ea1c1){logger['info']('VoiceMail,\x20%s,\x20%s',_0x59c3aa,_0xf2e4('0xd'));logger['debug'](_0xf2e4('0xe'),_0x59c3aa,_0xf2e4('0xd'),JSON[_0xf2e4('0xf')](_0x2ea1c1));if(_0x2ea1c1['error']){if(_0x2ea1c1[_0xf2e4('0x10')][_0xf2e4('0x11')]===0x1f4){logger['error'](_0xf2e4('0x12'),_0x59c3aa,_0x2ea1c1[_0xf2e4('0x10')][_0xf2e4('0x13')]);return _0xf31eb4(_0x2ea1c1[_0xf2e4('0x10')][_0xf2e4('0x13')]);}logger[_0xf2e4('0x10')](_0xf2e4('0x12'),_0x59c3aa,_0x2ea1c1[_0xf2e4('0x10')]['message']);return _0xf264c5(_0x2ea1c1[_0xf2e4('0x10')]['message']);}else{logger[_0xf2e4('0x14')]('VoiceMail,\x20%s,\x20%s',_0x59c3aa,_0xf2e4('0xd'));_0xf264c5(_0x2ea1c1[_0xf2e4('0x15')]['message']);}})[_0xf2e4('0x16')](function(_0xc4bbc5){logger['error'](_0xf2e4('0x12'),_0x59c3aa,_0xc4bbc5);_0xf31eb4(_0xc4bbc5);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 41539bf..b18442d 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 _0x1e05=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b4eb1,_0x1d007a){var _0x2dd440=function(_0x595645){while(--_0x595645){_0x2b4eb1['push'](_0x2b4eb1['shift']());}};_0x2dd440(++_0x1d007a);}(_0x1e05,0x158));var _0x51e0=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x1e05[_0x2962b4];return _0x411b7d;};'use strict';var multer=require(_0x51e0('0x0'));var util=require(_0x51e0('0x1'));var path=require(_0x51e0('0x2'));var timeout=require(_0x51e0('0x3'));var express=require(_0x51e0('0x4'));var router=express[_0x51e0('0x5')]();var fs_extra=require(_0x51e0('0x6'));var auth=require(_0x51e0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x51e0('0x8'));var controller=require(_0x51e0('0x9'));router[_0x51e0('0xa')]('/',auth[_0x51e0('0xb')](),controller[_0x51e0('0xc')]);router[_0x51e0('0xa')](_0x51e0('0xd'),auth[_0x51e0('0xb')](),controller[_0x51e0('0xe')]);router[_0x51e0('0xa')](_0x51e0('0xf'),auth[_0x51e0('0xb')](),controller[_0x51e0('0x10')]);router[_0x51e0('0x11')]('/',auth[_0x51e0('0xb')](),controller['create']);router['put'](_0x51e0('0xd'),auth[_0x51e0('0xb')](),controller[_0x51e0('0x12')]);router[_0x51e0('0x13')](_0x51e0('0xd'),auth[_0x51e0('0xb')](),controller[_0x51e0('0x14')]);module[_0x51e0('0x15')]=router; \ No newline at end of file +var _0x2bfa=['multer','util','path','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','put','delete','exports'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x2bfa,0xb0));var _0xa2bf=function(_0x14df83,_0x1f16aa){_0x14df83=_0x14df83-0x0;var _0x4e45e2=_0x2bfa[_0x14df83];return _0x4e45e2;};'use strict';var multer=require(_0xa2bf('0x0'));var util=require(_0xa2bf('0x1'));var path=require(_0xa2bf('0x2'));var timeout=require('connect-timeout');var express=require(_0xa2bf('0x3'));var router=express[_0xa2bf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa2bf('0x5'));router[_0xa2bf('0x6')]('/',auth[_0xa2bf('0x7')](),controller[_0xa2bf('0x8')]);router[_0xa2bf('0x6')](_0xa2bf('0x9'),auth[_0xa2bf('0x7')](),controller['show']);router[_0xa2bf('0x6')](_0xa2bf('0xa'),auth[_0xa2bf('0x7')](),controller[_0xa2bf('0xb')]);router[_0xa2bf('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa2bf('0xd')]('/:id',auth[_0xa2bf('0x7')](),controller['update']);router[_0xa2bf('0xe')](_0xa2bf('0x9'),auth[_0xa2bf('0x7')](),controller['destroy']);module[_0xa2bf('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a1d3a0b..2ee9194 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 _0x33e0=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x17c039,_0x133e4d){var _0x588545=function(_0x489e00){while(--_0x489e00){_0x17c039['push'](_0x17c039['shift']());}};_0x588545(++_0x133e4d);}(_0x33e0,0x1ae));var _0x033e=function(_0x2b43bb,_0x19ec84){_0x2b43bb=_0x2b43bb-0x0;var _0x1b3180=_0x33e0[_0x2b43bb];return _0x1b3180;};'use strict';var Sequelize=require(_0x033e('0x0'));module[_0x033e('0x1')]={'name':{'type':Sequelize[_0x033e('0x2')],'get':function(_0x5285ee){return this[_0x033e('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x033e('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x033e('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x033e('0x5')],'defaultValue':''},'stamp':{'type':_0x033e('0x7'),'defaultValue':Sequelize['literal'](_0x033e('0x8'))}}; \ No newline at end of file +var _0x2406=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2406,0x198));var _0x6240=function(_0x5e603e,_0x44a627){_0x5e603e=_0x5e603e-0x0;var _0x2bfb0d=_0x2406[_0x5e603e];return _0x2bfb0d;};'use strict';var Sequelize=require(_0x6240('0x0'));module[_0x6240('0x1')]={'name':{'type':Sequelize[_0x6240('0x2')],'get':function(_0x5d917a){return this[_0x6240('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6240('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x6240('0x6')](_0x6240('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6240('0x5')],'defaultValue':''},'stamp':{'type':_0x6240('0x8'),'defaultValue':Sequelize['literal'](_0x6240('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 93fa311..be66663 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 _0x504b=['set','reject','save','destroy','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','length','nolimit','order','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','update','msg_id','recording','Sequelize','ValidationError','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x1eef37,_0x3829ac){var _0x233234=function(_0x1db4ae){while(--_0x1db4ae){_0x1eef37['push'](_0x1eef37['shift']());}};_0x233234(++_0x3829ac);}(_0x504b,0x1c5));var _0xb504=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x504b[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb504('0x0'));var zipdir=require(_0xb504('0x1'));var jsonpatch=require(_0xb504('0x2'));var rp=require(_0xb504('0x3'));var moment=require(_0xb504('0x4'));var BPromise=require(_0xb504('0x5'));var Mustache=require(_0xb504('0x6'));var util=require(_0xb504('0x7'));var path=require(_0xb504('0x8'));var sox=require(_0xb504('0x9'));var csv=require(_0xb504('0xa'));var ejs=require(_0xb504('0xb'));var fs=require('fs');var fs_extra=require(_0xb504('0xc'));var _=require(_0xb504('0xd'));var squel=require(_0xb504('0xe'));var crypto=require(_0xb504('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb504('0xa'));var querystring=require(_0xb504('0x10'));var Papa=require(_0xb504('0x11'));var Redis=require(_0xb504('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb504('0x13'));var hardwareService=require(_0xb504('0x14'));var logger=require(_0xb504('0x15'))(_0xb504('0x16'));var utils=require('../../config/utils');var config=require(_0xb504('0x17'));var licenseUtil=require(_0xb504('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd7d538,_0x1deb55){_0x1deb55=_0x1deb55||0xcc;return function(_0x9efa3c){if(_0x9efa3c){return _0xd7d538[_0xb504('0x19')](_0x1deb55);}return _0xd7d538[_0xb504('0x1a')](_0x1deb55)[_0xb504('0x1b')]();};}function respondWithResult(_0x5ece3e,_0x47a508){_0x47a508=_0x47a508||0xc8;return function(_0x1a1090){if(_0x1a1090){return _0x5ece3e['status'](_0x47a508)[_0xb504('0x1c')](_0x1a1090);}};}function respondWithFilteredResult(_0x519c6c,_0x23e3f6){return function(_0x3f3138){if(_0x3f3138){var _0x1be642=typeof _0x23e3f6[_0xb504('0x1d')]===_0xb504('0x1e')&&typeof _0x23e3f6[_0xb504('0x1f')]===_0xb504('0x1e');var _0x26032c=_0x3f3138[_0xb504('0x20')];var _0x2fb16d=_0x1be642?0x0:_0x23e3f6[_0xb504('0x1d')];var _0x32ec7a=_0x1be642?_0x3f3138[_0xb504('0x20')]:_0x23e3f6[_0xb504('0x1d')]+_0x23e3f6[_0xb504('0x1f')];var _0x317bdf;if(_0x32ec7a>=_0x26032c){_0x32ec7a=_0x26032c;_0x317bdf=0xc8;}else{_0x317bdf=0xce;}_0x519c6c[_0xb504('0x1a')](_0x317bdf);return _0x519c6c[_0xb504('0x21')]('Content-Range',_0x2fb16d+'-'+_0x32ec7a+'/'+_0x26032c)[_0xb504('0x1c')](_0x3f3138);}return null;};}function patchUpdates(_0x17272b){return function(_0x368faf){try{jsonpatch['apply'](_0x368faf,_0x17272b,!![]);}catch(_0x3275b1){return BPromise[_0xb504('0x22')](_0x3275b1);}return _0x368faf[_0xb504('0x23')]();};}function saveUpdates(_0x2820b3,_0x2332e4){return function(_0x3bb445){if(_0x3bb445){return _0x3bb445['update'](_0x2820b3)['then'](function(_0x5d06c4){return _0x5d06c4;});}return null;};}function removeEntity(_0x2eb61f,_0xcaa99){return function(_0x461b28){if(_0x461b28){return _0x461b28[_0xb504('0x24')]()[_0xb504('0x25')](function(){_0x2eb61f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3f1e,_0x5ac72a){return function(_0x2cb013){if(!_0x2cb013){_0x3f3f1e['sendStatus'](0x194);}return _0x2cb013;};}function handleError(_0x30d3fd,_0x3e19b9){_0x3e19b9=_0x3e19b9||0x1f4;return function(_0x2f8b7d){logger[_0xb504('0x26')](_0x2f8b7d[_0xb504('0x27')]);if(_0x2f8b7d[_0xb504('0x28')]){delete _0x2f8b7d[_0xb504('0x28')];}_0x30d3fd['status'](_0x3e19b9)[_0xb504('0x29')](_0x2f8b7d);};}exports[_0xb504('0x2a')]=function(_0x1cbcf1,_0xc3d4f9){var _0x35a2aa={},_0x4e3824={},_0x11265d={'count':0x0,'rows':[]};var _0x200200=_[_0xb504('0x2b')](db[_0xb504('0x2c')][_0xb504('0x2d')],function(_0x18ed3f){return{'name':_0x18ed3f[_0xb504('0x2e')],'type':_0x18ed3f[_0xb504('0x2f')][_0xb504('0x30')]};});_0x4e3824[_0xb504('0x31')]=_[_0xb504('0x32')](_['map'](_0x200200,_0xb504('0x28')),[_0xb504('0x28')]);_0x4e3824[_0xb504('0x33')]=_[_0xb504('0x34')](_0x1cbcf1[_0xb504('0x33')]);_0x4e3824[_0xb504('0x35')]=_[_0xb504('0x36')](_0x4e3824[_0xb504('0x31')],_0x4e3824['query']);_0x35a2aa[_0xb504('0x37')]=_[_0xb504('0x36')](_0x4e3824[_0xb504('0x31')],qs['fields'](_0x1cbcf1['query']['fields']));_0x35a2aa['attributes']=_0x35a2aa['attributes'][_0xb504('0x38')]?_0x35a2aa[_0xb504('0x37')]:_0x4e3824[_0xb504('0x31')];if(!_0x1cbcf1[_0xb504('0x33')]['hasOwnProperty'](_0xb504('0x39'))){_0x35a2aa[_0xb504('0x1f')]=qs[_0xb504('0x1f')](_0x1cbcf1[_0xb504('0x33')][_0xb504('0x1f')]);_0x35a2aa[_0xb504('0x1d')]=qs['offset'](_0x1cbcf1[_0xb504('0x33')][_0xb504('0x1d')]);}_0x35a2aa[_0xb504('0x3a')]=qs['sort'](_0x1cbcf1[_0xb504('0x33')]['sort']);_0x35a2aa[_0xb504('0x3b')]=qs[_0xb504('0x35')](_['pick'](_0x1cbcf1[_0xb504('0x33')],_0x4e3824['filters']),_0x200200);if(_0x1cbcf1['query']['filter']){_0x35a2aa[_0xb504('0x3b')]=_[_0xb504('0x3c')](_0x35a2aa[_0xb504('0x3b')],{'$or':_[_0xb504('0x2b')](_0x200200,function(_0x2ffe6c){if(_0x2ffe6c['type']!=='VIRTUAL'){var _0x23c53f={};_0x23c53f[_0x2ffe6c['name']]={'$like':'%'+_0x1cbcf1[_0xb504('0x33')][_0xb504('0x3d')]+'%'};return _0x23c53f;}})});}_0x35a2aa=_[_0xb504('0x3c')]({},_0x35a2aa,_0x1cbcf1[_0xb504('0x3e')]);var _0x11f608={'where':_0x35a2aa[_0xb504('0x3b')]};return db['VoiceMailMessage'][_0xb504('0x20')](_0x11f608)['then'](function(_0x9800b3){_0x11265d[_0xb504('0x20')]=_0x9800b3;if(_0x1cbcf1[_0xb504('0x33')][_0xb504('0x3f')]){_0x35a2aa[_0xb504('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xb504('0x41')](_0x35a2aa);})['then'](function(_0x2ac96d){_0x11265d[_0xb504('0x42')]=_0x2ac96d;return _0x11265d;})['then'](respondWithFilteredResult(_0xc3d4f9,_0x35a2aa))[_0xb504('0x43')](handleError(_0xc3d4f9,null));};exports['show']=function(_0x1c5e73,_0x64e110){var _0x4f46a1={'raw':!![],'where':{'id':_0x1c5e73[_0xb504('0x44')]['id']}},_0x1f75a0={};_0x1f75a0[_0xb504('0x31')]=_[_0xb504('0x34')](db[_0xb504('0x2c')]['rawAttributes']);_0x1f75a0[_0xb504('0x33')]=_[_0xb504('0x34')](_0x1c5e73[_0xb504('0x33')]);_0x1f75a0[_0xb504('0x35')]=_[_0xb504('0x36')](_0x1f75a0[_0xb504('0x31')],_0x1f75a0[_0xb504('0x33')]);_0x4f46a1[_0xb504('0x37')]=_[_0xb504('0x36')](_0x1f75a0[_0xb504('0x31')],qs[_0xb504('0x45')](_0x1c5e73[_0xb504('0x33')]['fields']));_0x4f46a1['attributes']=_0x4f46a1[_0xb504('0x37')][_0xb504('0x38')]?_0x4f46a1[_0xb504('0x37')]:_0x1f75a0[_0xb504('0x31')];if(_0x1c5e73['query'][_0xb504('0x3f')]){_0x4f46a1['include']=[{'all':!![]}];}_0x4f46a1=_[_0xb504('0x3c')]({},_0x4f46a1,_0x1c5e73[_0xb504('0x3e')]);return db[_0xb504('0x2c')][_0xb504('0x46')](_0x4f46a1)['then'](handleEntityNotFound(_0x64e110,null))[_0xb504('0x25')](respondWithResult(_0x64e110,null))[_0xb504('0x43')](handleError(_0x64e110,null));};exports['create']=function(_0x50a524,_0x164752){return db[_0xb504('0x2c')][_0xb504('0x47')](_0x50a524[_0xb504('0x48')],{})[_0xb504('0x25')](respondWithResult(_0x164752,0xc9))['catch'](handleError(_0x164752,null));};exports[_0xb504('0x49')]=function(_0x55d80b,_0x4af7ce){if(_0x55d80b['body']['id']){delete _0x55d80b[_0xb504('0x48')]['id'];}return db[_0xb504('0x2c')][_0xb504('0x46')]({'where':{'id':_0x55d80b[_0xb504('0x44')]['id']}})['then'](handleEntityNotFound(_0x4af7ce,null))[_0xb504('0x25')](saveUpdates(_0x55d80b[_0xb504('0x48')],null))['then'](respondWithResult(_0x4af7ce,null))['catch'](handleError(_0x4af7ce,null));};exports[_0xb504('0x24')]=function(_0x4cac48,_0x26b1fa){return db[_0xb504('0x2c')][_0xb504('0x46')]({'where':{'id':_0x4cac48['params']['id']}})['then'](handleEntityNotFound(_0x26b1fa,null))[_0xb504('0x25')](removeEntity(_0x26b1fa,null))['catch'](handleError(_0x26b1fa,null));};exports['download']=function(_0x1823c5,_0x1935ba,_0x5623d0){return db[_0xb504('0x2c')]['find']({'where':{'id':_0x1823c5[_0xb504('0x44')]['id']},'attributes':['id','recording',_0xb504('0x4a')]})[_0xb504('0x25')](handleEntityNotFound(_0x1935ba,null))[_0xb504('0x25')](function(_0x149721){if(_0x149721){if(!_0x149721[_0xb504('0x4b')]){throw new db[(_0xb504('0x4c'))][(_0xb504('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x468f6f={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x149721[_0xb504('0x4a')]){_0x468f6f[_0xb504('0x4e')]=_0xb504('0x4f')+_0x149721['msg_id']+_0xb504('0x50');}_0x1935ba[_0xb504('0x21')](_0x468f6f);return _0x1935ba[_0xb504('0x29')](new Buffer(_0x149721[_0xb504('0x4b')]));}})['catch'](handleError(_0x1935ba,null));}; \ No newline at end of file +var _0x0ce5=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','findAll','show','params','keys','find','create','catch','body','destroy','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','filters'];(function(_0x3f952f,_0x41801d){var _0x45300c=function(_0x3c5f62){while(--_0x3c5f62){_0x3f952f['push'](_0x3f952f['shift']());}};_0x45300c(++_0x41801d);}(_0x0ce5,0x73));var _0x50ce=function(_0x3d773f,_0x3462b3){_0x3d773f=_0x3d773f-0x0;var _0x22bf3a=_0x0ce5[_0x3d773f];return _0x22bf3a;};'use strict';var emlformat=require(_0x50ce('0x0'));var rimraf=require(_0x50ce('0x1'));var zipdir=require(_0x50ce('0x2'));var jsonpatch=require(_0x50ce('0x3'));var rp=require(_0x50ce('0x4'));var moment=require(_0x50ce('0x5'));var BPromise=require(_0x50ce('0x6'));var Mustache=require(_0x50ce('0x7'));var util=require(_0x50ce('0x8'));var path=require('path');var sox=require(_0x50ce('0x9'));var csv=require(_0x50ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50ce('0xb'));var squel=require(_0x50ce('0xc'));var crypto=require(_0x50ce('0xd'));var jsforce=require(_0x50ce('0xe'));var deskjs=require(_0x50ce('0xf'));var toCsv=require(_0x50ce('0xa'));var querystring=require(_0x50ce('0x10'));var Papa=require(_0x50ce('0x11'));var Redis=require('ioredis');var authService=require(_0x50ce('0x12'));var qs=require(_0x50ce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x50ce('0x14'));var utils=require(_0x50ce('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x50ce('0x16'));var db=require(_0x50ce('0x17'))['db'];function respondWithStatusCode(_0x54dd8e,_0x2b5611){_0x2b5611=_0x2b5611||0xcc;return function(_0x612169){if(_0x612169){return _0x54dd8e[_0x50ce('0x18')](_0x2b5611);}return _0x54dd8e[_0x50ce('0x19')](_0x2b5611)[_0x50ce('0x1a')]();};}function respondWithResult(_0x5118f8,_0x5ba7aa){_0x5ba7aa=_0x5ba7aa||0xc8;return function(_0x39b0a8){if(_0x39b0a8){return _0x5118f8[_0x50ce('0x19')](_0x5ba7aa)[_0x50ce('0x1b')](_0x39b0a8);}};}function respondWithFilteredResult(_0x1c99eb,_0x22389d){return function(_0x59c97b){if(_0x59c97b){var _0x2ec4f7=typeof _0x22389d[_0x50ce('0x1c')]===_0x50ce('0x1d')&&typeof _0x22389d[_0x50ce('0x1e')]===_0x50ce('0x1d');var _0x5653d7=_0x59c97b[_0x50ce('0x1f')];var _0x25e949=_0x2ec4f7?0x0:_0x22389d[_0x50ce('0x1c')];var _0x255258=_0x2ec4f7?_0x59c97b[_0x50ce('0x1f')]:_0x22389d[_0x50ce('0x1c')]+_0x22389d['limit'];var _0x22a5a9;if(_0x255258>=_0x5653d7){_0x255258=_0x5653d7;_0x22a5a9=0xc8;}else{_0x22a5a9=0xce;}_0x1c99eb['status'](_0x22a5a9);return _0x1c99eb[_0x50ce('0x20')]('Content-Range',_0x25e949+'-'+_0x255258+'/'+_0x5653d7)[_0x50ce('0x1b')](_0x59c97b);}return null;};}function patchUpdates(_0x2bed46){return function(_0x394af3){try{jsonpatch['apply'](_0x394af3,_0x2bed46,!![]);}catch(_0xa00340){return BPromise[_0x50ce('0x21')](_0xa00340);}return _0x394af3['save']();};}function saveUpdates(_0x1adabc,_0x58f521){return function(_0x1f48c8){if(_0x1f48c8){return _0x1f48c8[_0x50ce('0x22')](_0x1adabc)[_0x50ce('0x23')](function(_0x213ca3){return _0x213ca3;});}return null;};}function removeEntity(_0x517a0a,_0x1a7c3d){return function(_0x44d020){if(_0x44d020){return _0x44d020['destroy']()[_0x50ce('0x23')](function(){_0x517a0a[_0x50ce('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ef14,_0x35c1af){return function(_0x548e8a){if(!_0x548e8a){_0x48ef14[_0x50ce('0x18')](0x194);}return _0x548e8a;};}function handleError(_0xea9a2,_0x57cd2c){_0x57cd2c=_0x57cd2c||0x1f4;return function(_0xea5649){logger[_0x50ce('0x24')](_0xea5649[_0x50ce('0x25')]);if(_0xea5649[_0x50ce('0x26')]){delete _0xea5649[_0x50ce('0x26')];}_0xea9a2[_0x50ce('0x19')](_0x57cd2c)[_0x50ce('0x27')](_0xea5649);};}exports[_0x50ce('0x28')]=function(_0x37d115,_0x11c043){var _0x31f506={},_0x56a0a0={},_0x110a7d={'count':0x0,'rows':[]};var _0x113bca=_[_0x50ce('0x29')](db[_0x50ce('0x2a')][_0x50ce('0x2b')],function(_0x33cd0f){return{'name':_0x33cd0f[_0x50ce('0x2c')],'type':_0x33cd0f['type'][_0x50ce('0x2d')]};});_0x56a0a0[_0x50ce('0x2e')]=_['differenceBy'](_[_0x50ce('0x29')](_0x113bca,_0x50ce('0x26')),['name']);_0x56a0a0[_0x50ce('0x2f')]=_['keys'](_0x37d115[_0x50ce('0x2f')]);_0x56a0a0[_0x50ce('0x30')]=_[_0x50ce('0x31')](_0x56a0a0[_0x50ce('0x2e')],_0x56a0a0[_0x50ce('0x2f')]);_0x31f506[_0x50ce('0x32')]=_['intersection'](_0x56a0a0[_0x50ce('0x2e')],qs[_0x50ce('0x33')](_0x37d115[_0x50ce('0x2f')][_0x50ce('0x33')]));_0x31f506[_0x50ce('0x32')]=_0x31f506[_0x50ce('0x32')][_0x50ce('0x34')]?_0x31f506[_0x50ce('0x32')]:_0x56a0a0['model'];if(!_0x37d115[_0x50ce('0x2f')][_0x50ce('0x35')](_0x50ce('0x36'))){_0x31f506['limit']=qs['limit'](_0x37d115['query']['limit']);_0x31f506[_0x50ce('0x1c')]=qs[_0x50ce('0x1c')](_0x37d115[_0x50ce('0x2f')]['offset']);}_0x31f506[_0x50ce('0x37')]=qs[_0x50ce('0x38')](_0x37d115[_0x50ce('0x2f')]['sort']);_0x31f506[_0x50ce('0x39')]=qs[_0x50ce('0x30')](_[_0x50ce('0x3a')](_0x37d115[_0x50ce('0x2f')],_0x56a0a0[_0x50ce('0x30')]),_0x113bca);if(_0x37d115['query'][_0x50ce('0x3b')]){_0x31f506[_0x50ce('0x39')]=_[_0x50ce('0x3c')](_0x31f506[_0x50ce('0x39')],{'$or':_[_0x50ce('0x29')](_0x113bca,function(_0x290267){if(_0x290267[_0x50ce('0x3d')]!=='VIRTUAL'){var _0x58ae22={};_0x58ae22[_0x290267[_0x50ce('0x26')]]={'$like':'%'+_0x37d115[_0x50ce('0x2f')][_0x50ce('0x3b')]+'%'};return _0x58ae22;}})});}_0x31f506=_[_0x50ce('0x3c')]({},_0x31f506,_0x37d115['options']);var _0x2df553={'where':_0x31f506['where']};return db[_0x50ce('0x2a')][_0x50ce('0x1f')](_0x2df553)[_0x50ce('0x23')](function(_0x3111fb){_0x110a7d[_0x50ce('0x1f')]=_0x3111fb;if(_0x37d115[_0x50ce('0x2f')][_0x50ce('0x3e')]){_0x31f506['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x50ce('0x3f')](_0x31f506);})[_0x50ce('0x23')](function(_0x2b4948){_0x110a7d['rows']=_0x2b4948;return _0x110a7d;})['then'](respondWithFilteredResult(_0x11c043,_0x31f506))['catch'](handleError(_0x11c043,null));};exports[_0x50ce('0x40')]=function(_0x1bd129,_0x70c5b0){var _0x57037c={'raw':!![],'where':{'id':_0x1bd129[_0x50ce('0x41')]['id']}},_0x14b50e={};_0x14b50e[_0x50ce('0x2e')]=_[_0x50ce('0x42')](db[_0x50ce('0x2a')][_0x50ce('0x2b')]);_0x14b50e[_0x50ce('0x2f')]=_[_0x50ce('0x42')](_0x1bd129[_0x50ce('0x2f')]);_0x14b50e[_0x50ce('0x30')]=_[_0x50ce('0x31')](_0x14b50e[_0x50ce('0x2e')],_0x14b50e['query']);_0x57037c[_0x50ce('0x32')]=_[_0x50ce('0x31')](_0x14b50e[_0x50ce('0x2e')],qs[_0x50ce('0x33')](_0x1bd129[_0x50ce('0x2f')][_0x50ce('0x33')]));_0x57037c[_0x50ce('0x32')]=_0x57037c['attributes'][_0x50ce('0x34')]?_0x57037c['attributes']:_0x14b50e[_0x50ce('0x2e')];if(_0x1bd129[_0x50ce('0x2f')]['includeAll']){_0x57037c['include']=[{'all':!![]}];}_0x57037c=_['merge']({},_0x57037c,_0x1bd129['options']);return db['VoiceMailMessage'][_0x50ce('0x43')](_0x57037c)[_0x50ce('0x23')](handleEntityNotFound(_0x70c5b0,null))[_0x50ce('0x23')](respondWithResult(_0x70c5b0,null))['catch'](handleError(_0x70c5b0,null));};exports['create']=function(_0x10c015,_0x466349){return db[_0x50ce('0x2a')][_0x50ce('0x44')](_0x10c015['body'],{})[_0x50ce('0x23')](respondWithResult(_0x466349,0xc9))[_0x50ce('0x45')](handleError(_0x466349,null));};exports['update']=function(_0x98144d,_0x20fca3){if(_0x98144d[_0x50ce('0x46')]['id']){delete _0x98144d[_0x50ce('0x46')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x98144d['params']['id']}})[_0x50ce('0x23')](handleEntityNotFound(_0x20fca3,null))[_0x50ce('0x23')](saveUpdates(_0x98144d['body'],null))[_0x50ce('0x23')](respondWithResult(_0x20fca3,null))[_0x50ce('0x45')](handleError(_0x20fca3,null));};exports[_0x50ce('0x47')]=function(_0x106656,_0x53be2e){return db[_0x50ce('0x2a')]['find']({'where':{'id':_0x106656['params']['id']}})['then'](handleEntityNotFound(_0x53be2e,null))[_0x50ce('0x23')](removeEntity(_0x53be2e,null))['catch'](handleError(_0x53be2e,null));};exports[_0x50ce('0x48')]=function(_0x99efea,_0x390fb6,_0x17231a){return db[_0x50ce('0x2a')][_0x50ce('0x43')]({'where':{'id':_0x99efea[_0x50ce('0x41')]['id']},'attributes':['id',_0x50ce('0x49'),'msg_id']})[_0x50ce('0x23')](handleEntityNotFound(_0x390fb6,null))['then'](function(_0x1630a5){if(_0x1630a5){if(!_0x1630a5['recording']){throw new db['Sequelize'][(_0x50ce('0x4a'))](_0x50ce('0x4b'));}var _0x48c057={'Content-Type':_0x50ce('0x4c'),'Content-Disposition':_0x50ce('0x4d')};if(_0x1630a5[_0x50ce('0x4e')]){_0x48c057[_0x50ce('0x4f')]=_0x50ce('0x50')+_0x1630a5[_0x50ce('0x4e')]+_0x50ce('0x51');}_0x390fb6['set'](_0x48c057);return _0x390fb6['send'](new Buffer(_0x1630a5[_0x50ce('0x49')]));}})[_0x50ce('0x45')](handleError(_0x390fb6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1935038..7cd7e6b 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 _0x73ac=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise','path','./voiceMailMessage.attributes','exports','define'];(function(_0x5c719a,_0x3ca0bc){var _0x1abc46=function(_0x508bb5){while(--_0x508bb5){_0x5c719a['push'](_0x5c719a['shift']());}};_0x1abc46(++_0x3ca0bc);}(_0x73ac,0x107));var _0xc73a=function(_0x18f412,_0x21e639){_0x18f412=_0x18f412-0x0;var _0x4dcb7f=_0x73ac[_0x18f412];return _0x4dcb7f;};'use strict';var _=require(_0xc73a('0x0'));var util=require(_0xc73a('0x1'));var logger=require(_0xc73a('0x2'))(_0xc73a('0x3'));var moment=require('moment');var BPromise=require(_0xc73a('0x4'));var rp=require(_0xc73a('0x5'));var fs=require('fs');var path=require(_0xc73a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc73a('0x7'));module[_0xc73a('0x8')]=function(_0x2794ba,_0x55f087){return _0x2794ba[_0xc73a('0x9')](_0xc73a('0xa'),attributes,{'tableName':_0xc73a('0xb'),'paranoid':![],'indexes':[{'name':_0xc73a('0xc'),'fields':[_0xc73a('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9d8e=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','api','moment','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0xce941a,_0x4b9017){var _0x531bd3=function(_0x552c23){while(--_0x552c23){_0xce941a['push'](_0xce941a['shift']());}};_0x531bd3(++_0x4b9017);}(_0x9d8e,0x1a9));var _0xe9d8=function(_0x12f33c,_0x463ec4){_0x12f33c=_0x12f33c-0x0;var _0x498d58=_0x9d8e[_0x12f33c];return _0x498d58;};'use strict';var _=require('lodash');var util=require(_0xe9d8('0x0'));var logger=require('../../config/logger')(_0xe9d8('0x1'));var moment=require(_0xe9d8('0x2'));var BPromise=require(_0xe9d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe9d8('0x4'));var config=require(_0xe9d8('0x5'));var attributes=require(_0xe9d8('0x6'));module[_0xe9d8('0x7')]=function(_0x11023d,_0x34488f){return _0x11023d[_0xe9d8('0x8')](_0xe9d8('0x9'),attributes,{'tableName':_0xe9d8('0xa'),'paranoid':![],'indexes':[{'name':_0xe9d8('0xb'),'fields':[_0xe9d8('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 67cb331..832ff0a 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 _0x7494=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x22e832,_0x3086d6){var _0x411511=function(_0x4914c1){while(--_0x4914c1){_0x22e832['push'](_0x22e832['shift']());}};_0x411511(++_0x3086d6);}(_0x7494,0x95));var _0x4749=function(_0x35d51d,_0x543577){_0x35d51d=_0x35d51d-0x0;var _0x1cbc2f=_0x7494[_0x35d51d];return _0x1cbc2f;};'use strict';var _=require(_0x4749('0x0'));var util=require(_0x4749('0x1'));var moment=require(_0x4749('0x2'));var BPromise=require(_0x4749('0x3'));var rs=require(_0x4749('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4749('0x5'))['db'];var utils=require(_0x4749('0x6'));var logger=require(_0x4749('0x7'))('rpc');var config=require(_0x4749('0x8'));var jayson=require(_0x4749('0x9'));var client=jayson[_0x4749('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c9afb,_0x209428,_0x580819){return new BPromise(function(_0x1028d2,_0x2adc3d){return client[_0x4749('0xb')](_0x3c9afb,_0x580819)[_0x4749('0xc')](function(_0x50640e){logger[_0x4749('0xd')](_0x4749('0xe'),_0x209428,_0x4749('0xf'));logger[_0x4749('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x209428,_0x4749('0xf'),JSON['stringify'](_0x50640e));if(_0x50640e[_0x4749('0x11')]){if(_0x50640e[_0x4749('0x11')][_0x4749('0x12')]===0x1f4){logger[_0x4749('0x11')](_0x4749('0xe'),_0x209428,_0x50640e[_0x4749('0x11')][_0x4749('0x13')]);return _0x2adc3d(_0x50640e['error'][_0x4749('0x13')]);}logger[_0x4749('0x11')](_0x4749('0xe'),_0x209428,_0x50640e['error'][_0x4749('0x13')]);return _0x1028d2(_0x50640e['error'][_0x4749('0x13')]);}else{logger[_0x4749('0xd')](_0x4749('0xe'),_0x209428,_0x4749('0xf'));_0x1028d2(_0x50640e[_0x4749('0x14')]['message']);}})['catch'](function(_0x36559b){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x209428,_0x36559b);_0x2adc3d(_0x36559b);});});} \ No newline at end of file +var _0x0096=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x2e24d4,_0x3cad21){var _0x4888ee=function(_0x2a5ba6){while(--_0x2a5ba6){_0x2e24d4['push'](_0x2e24d4['shift']());}};_0x4888ee(++_0x3cad21);}(_0x0096,0x1a0));var _0x6009=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x0096[_0x65c903];return _0x23e1d7;};'use strict';var _=require(_0x6009('0x0'));var util=require(_0x6009('0x1'));var moment=require(_0x6009('0x2'));var BPromise=require(_0x6009('0x3'));var rs=require(_0x6009('0x4'));var fs=require('fs');var Redis=require(_0x6009('0x5'));var db=require(_0x6009('0x6'))['db'];var utils=require(_0x6009('0x7'));var logger=require(_0x6009('0x8'))(_0x6009('0x9'));var config=require(_0x6009('0xa'));var jayson=require(_0x6009('0xb'));var client=jayson['client'][_0x6009('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb6c780,_0x82cc5d,_0x3bd838){return new BPromise(function(_0x3cb5a7,_0x2aa76c){return client[_0x6009('0xd')](_0xb6c780,_0x3bd838)[_0x6009('0xe')](function(_0xa7c12e){logger[_0x6009('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x82cc5d,_0x6009('0x10'));logger[_0x6009('0x11')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x82cc5d,_0x6009('0x10'),JSON['stringify'](_0xa7c12e));if(_0xa7c12e[_0x6009('0x12')]){if(_0xa7c12e[_0x6009('0x12')][_0x6009('0x13')]===0x1f4){logger[_0x6009('0x12')](_0x6009('0x14'),_0x82cc5d,_0xa7c12e[_0x6009('0x12')][_0x6009('0x15')]);return _0x2aa76c(_0xa7c12e[_0x6009('0x12')]['message']);}logger[_0x6009('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x82cc5d,_0xa7c12e['error'][_0x6009('0x15')]);return _0x3cb5a7(_0xa7c12e['error']['message']);}else{logger[_0x6009('0xf')](_0x6009('0x14'),_0x82cc5d,_0x6009('0x10'));_0x3cb5a7(_0xa7c12e[_0x6009('0x16')][_0x6009('0x15')]);}})['catch'](function(_0x2c5894){logger[_0x6009('0x12')](_0x6009('0x14'),_0x82cc5d,_0x2c5894);_0x2aa76c(_0x2c5894);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5df25d4..328c143 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 _0x912a=['isAuthenticated','show','/:id/sounds','post','addSound','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id'];(function(_0x221c14,_0x3a5b63){var _0x552397=function(_0x340585){while(--_0x340585){_0x221c14['push'](_0x221c14['shift']());}};_0x552397(++_0x3a5b63);}(_0x912a,0x12a));var _0xa912=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x912a[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0xa912('0x0'));var util=require(_0xa912('0x1'));var path=require(_0xa912('0x2'));var timeout=require(_0xa912('0x3'));var express=require(_0xa912('0x4'));var router=express[_0xa912('0x5')]();var fs_extra=require(_0xa912('0x6'));var auth=require(_0xa912('0x7'));var interaction=require(_0xa912('0x8'));var config=require(_0xa912('0x9'));var controller=require(_0xa912('0xa'));router[_0xa912('0xb')]('/',auth['isAuthenticated'](),controller[_0xa912('0xc')]);router['get'](_0xa912('0xd'),auth[_0xa912('0xe')](),controller[_0xa912('0xf')]);router[_0xa912('0xb')](_0xa912('0x10'),auth[_0xa912('0xe')](),controller['getSounds']);router[_0xa912('0x11')]('/',auth[_0xa912('0xe')](),controller['create']);router[_0xa912('0x11')](_0xa912('0x10'),auth[_0xa912('0xe')](),controller[_0xa912('0x12')]);router[_0xa912('0x13')](_0xa912('0xd'),auth[_0xa912('0xe')](),controller[_0xa912('0x14')]);router['delete'](_0xa912('0xd'),auth[_0xa912('0xe')](),controller[_0xa912('0x15')]);router[_0xa912('0x16')](_0xa912('0x17'),auth[_0xa912('0xe')](),controller[_0xa912('0x18')]);module[_0xa912('0x19')]=router; \ No newline at end of file +var _0x489d=['addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','post'];(function(_0x2394f8,_0x5f32cb){var _0x32a60b=function(_0xc8f12b){while(--_0xc8f12b){_0x2394f8['push'](_0x2394f8['shift']());}};_0x32a60b(++_0x5f32cb);}(_0x489d,0x13f));var _0xd489=function(_0x4bbec3,_0x15ec52){_0x4bbec3=_0x4bbec3-0x0;var _0x1767d3=_0x489d[_0x4bbec3];return _0x1767d3;};'use strict';var multer=require('multer');var util=require(_0xd489('0x0'));var path=require(_0xd489('0x1'));var timeout=require(_0xd489('0x2'));var express=require(_0xd489('0x3'));var router=express[_0xd489('0x4')]();var fs_extra=require(_0xd489('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd489('0x6'));var config=require(_0xd489('0x7'));var controller=require(_0xd489('0x8'));router[_0xd489('0x9')]('/',auth['isAuthenticated'](),controller[_0xd489('0xa')]);router[_0xd489('0x9')](_0xd489('0xb'),auth[_0xd489('0xc')](),controller[_0xd489('0xd')]);router[_0xd489('0x9')](_0xd489('0xe'),auth[_0xd489('0xc')](),controller[_0xd489('0xf')]);router[_0xd489('0x10')]('/',auth[_0xd489('0xc')](),controller['create']);router[_0xd489('0x10')]('/:id/sounds',auth[_0xd489('0xc')](),controller[_0xd489('0x11')]);router['put'](_0xd489('0xb'),auth[_0xd489('0xc')](),controller[_0xd489('0x12')]);router[_0xd489('0x13')](_0xd489('0xb'),auth['isAuthenticated'](),controller[_0xd489('0x14')]);router['delete'](_0xd489('0x15'),auth[_0xd489('0xc')](),controller[_0xd489('0x16')]);module[_0xd489('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 d939328..ccfac20 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 _0x6f4f=['ENUM','custom','files','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x6f4f,0x188));var _0xf6f4=function(_0x15dcc8,_0x26dfeb){_0x15dcc8=_0x15dcc8-0x0;var _0x5a0f9b=_0x6f4f[_0x15dcc8];return _0x5a0f9b;};'use strict';var Sequelize=require(_0xf6f4('0x0'));module[_0xf6f4('0x1')]={'name':{'type':Sequelize[_0xf6f4('0x2')],'allowNull':![],'unique':_0xf6f4('0x3')},'mode':{'type':Sequelize[_0xf6f4('0x4')](_0xf6f4('0x5'),_0xf6f4('0x6'),'mp3nb',_0xf6f4('0x7'),'quietmp3',_0xf6f4('0x8')),'allowNull':!![],'defaultValue':_0xf6f4('0x6')},'directory':{'type':Sequelize[_0xf6f4('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xf6f4('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xf6f4('0x2')],'allowNull':!![],'defaultValue':_0xf6f4('0x9')},'format':{'type':Sequelize[_0xf6f4('0x2')],'allowNull':!![]},'stamp':{'type':_0xf6f4('0xa')},'defaultEntry':{'type':Sequelize[_0xf6f4('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdb26=['ENUM','custom','files','mp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xdb26,0x6b));var _0x6db2=function(_0x2eb9eb,_0x4ce789){_0x2eb9eb=_0x2eb9eb-0x0;var _0x172bec=_0xdb26[_0x2eb9eb];return _0x172bec;};'use strict';var Sequelize=require(_0x6db2('0x0'));module[_0x6db2('0x1')]={'name':{'type':Sequelize[_0x6db2('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x6db2('0x3')](_0x6db2('0x4'),_0x6db2('0x5'),_0x6db2('0x6'),'quietmp3nb',_0x6db2('0x7'),_0x6db2('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x6db2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x6db2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6db2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x6db2('0x2')],'allowNull':!![]},'stamp':{'type':_0x6db2('0x9')},'defaultEntry':{'type':Sequelize[_0x6db2('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 a256df2..387cef5 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 _0x674f=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','symlinkSync','removeSound','id2','getSounds','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','Content-Range','reject','save','update','get','MusicOnHolds','destroy','then','status','error','index','map','VoiceMusicOnHold','rawAttributes','fieldName','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','body','catch','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x1a45e3,_0x385589){var _0x3615f8=function(_0x40ce0a){while(--_0x40ce0a){_0x1a45e3['push'](_0x1a45e3['shift']());}};_0x3615f8(++_0x385589);}(_0x674f,0x169));var _0xf674=function(_0x2da009,_0x2dbe20){_0x2da009=_0x2da009-0x0;var _0x5e5be4=_0x674f[_0x2da009];return _0x5e5be4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf674('0x0'));var zipdir=require(_0xf674('0x1'));var jsonpatch=require(_0xf674('0x2'));var rp=require(_0xf674('0x3'));var moment=require(_0xf674('0x4'));var BPromise=require(_0xf674('0x5'));var Mustache=require('mustache');var util=require(_0xf674('0x6'));var path=require(_0xf674('0x7'));var sox=require('sox');var csv=require(_0xf674('0x8'));var ejs=require(_0xf674('0x9'));var fs=require('fs');var fs_extra=require(_0xf674('0xa'));var _=require(_0xf674('0xb'));var squel=require(_0xf674('0xc'));var crypto=require(_0xf674('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf674('0xe'));var toCsv=require(_0xf674('0x8'));var querystring=require(_0xf674('0xf'));var Papa=require(_0xf674('0x10'));var Redis=require('ioredis');var authService=require(_0xf674('0x11'));var qs=require(_0xf674('0x12'));var as=require(_0xf674('0x13'));var hardwareService=require(_0xf674('0x14'));var logger=require(_0xf674('0x15'))(_0xf674('0x16'));var utils=require(_0xf674('0x17'));var config=require(_0xf674('0x18'));var licenseUtil=require(_0xf674('0x19'));var db=require(_0xf674('0x1a'))['db'];function respondWithStatusCode(_0x175c53,_0x577d47){_0x577d47=_0x577d47||0xcc;return function(_0xa1f02f){if(_0xa1f02f){return _0x175c53[_0xf674('0x1b')](_0x577d47);}return _0x175c53['status'](_0x577d47)[_0xf674('0x1c')]();};}function respondWithResult(_0x1271ea,_0xb56224){_0xb56224=_0xb56224||0xc8;return function(_0x730427){if(_0x730427){return _0x1271ea['status'](_0xb56224)[_0xf674('0x1d')](_0x730427);}};}function respondWithFilteredResult(_0x785c9,_0x24e6c8){return function(_0x48bdce){if(_0x48bdce){var _0x52965f=typeof _0x24e6c8[_0xf674('0x1e')]===_0xf674('0x1f')&&typeof _0x24e6c8['limit']===_0xf674('0x1f');var _0xdd3da5=_0x48bdce[_0xf674('0x20')];var _0x2d98db=_0x52965f?0x0:_0x24e6c8[_0xf674('0x1e')];var _0x536f4f=_0x52965f?_0x48bdce[_0xf674('0x20')]:_0x24e6c8[_0xf674('0x1e')]+_0x24e6c8['limit'];var _0x48a8c5;if(_0x536f4f>=_0xdd3da5){_0x536f4f=_0xdd3da5;_0x48a8c5=0xc8;}else{_0x48a8c5=0xce;}_0x785c9['status'](_0x48a8c5);return _0x785c9[_0xf674('0x21')](_0xf674('0x22'),_0x2d98db+'-'+_0x536f4f+'/'+_0xdd3da5)[_0xf674('0x1d')](_0x48bdce);}return null;};}function patchUpdates(_0x485a17){return function(_0x474f10){try{jsonpatch['apply'](_0x474f10,_0x485a17,!![]);}catch(_0x2360ca){return BPromise[_0xf674('0x23')](_0x2360ca);}return _0x474f10[_0xf674('0x24')]();};}function saveUpdates(_0x4958d7,_0x16d133){return function(_0x2d16be){if(_0x2d16be){return _0x2d16be[_0xf674('0x25')](_0x4958d7)['then'](function(_0x4bcff7){return _0x4bcff7;});}return null;};}function removeEntity(_0x273ac3,_0x47c806){return function(_0x5eed02){if(_0x5eed02){return _0x5eed02['destroy']()['then'](function(){var _0x2b7686=_0x5eed02[_0xf674('0x26')]({'plain':!![]});var _0x3f2deb=_0xf674('0x27');return db['UserProfileResource'][_0xf674('0x28')]({'where':{'type':_0x3f2deb,'resourceId':_0x2b7686['id']}})['then'](function(){return _0x5eed02;});})[_0xf674('0x29')](function(){_0x273ac3[_0xf674('0x2a')](0xcc)[_0xf674('0x1c')]();});}};}function handleEntityNotFound(_0x1a2991,_0x59f05e){return function(_0x51ce48){if(!_0x51ce48){_0x1a2991[_0xf674('0x1b')](0x194);}return _0x51ce48;};}function handleError(_0x494641,_0x2e3200){_0x2e3200=_0x2e3200||0x1f4;return function(_0x1a439f){logger[_0xf674('0x2b')](_0x1a439f['stack']);if(_0x1a439f['name']){delete _0x1a439f['name'];}_0x494641[_0xf674('0x2a')](_0x2e3200)['send'](_0x1a439f);};}exports[_0xf674('0x2c')]=function(_0x2cef0c,_0x568843){var _0x42a3ff={},_0x36a870={},_0x5e1051={'count':0x0,'rows':[]};var _0xf000d8=_[_0xf674('0x2d')](db[_0xf674('0x2e')][_0xf674('0x2f')],function(_0x2ce4a4){return{'name':_0x2ce4a4[_0xf674('0x30')],'type':_0x2ce4a4['type']['key']};});_0x36a870['model']=_['map'](_0xf000d8,_0xf674('0x31'));_0x36a870[_0xf674('0x32')]=_[_0xf674('0x33')](_0x2cef0c['query']);_0x36a870[_0xf674('0x34')]=_[_0xf674('0x35')](_0x36a870['model'],_0x36a870['query']);_0x42a3ff['attributes']=_[_0xf674('0x35')](_0x36a870[_0xf674('0x36')],qs[_0xf674('0x37')](_0x2cef0c[_0xf674('0x32')]['fields']));_0x42a3ff['attributes']=_0x42a3ff[_0xf674('0x38')][_0xf674('0x39')]?_0x42a3ff[_0xf674('0x38')]:_0x36a870['model'];if(!_0x2cef0c[_0xf674('0x32')][_0xf674('0x3a')](_0xf674('0x3b'))){_0x42a3ff['limit']=qs[_0xf674('0x3c')](_0x2cef0c[_0xf674('0x32')][_0xf674('0x3c')]);_0x42a3ff[_0xf674('0x1e')]=qs['offset'](_0x2cef0c['query'][_0xf674('0x1e')]);}_0x42a3ff['order']=qs[_0xf674('0x3d')](_0x2cef0c[_0xf674('0x32')]['sort']);delete _0x2cef0c[_0xf674('0x32')]['sort'];_0x42a3ff[_0xf674('0x3e')]=qs[_0xf674('0x34')](_[_0xf674('0x3f')](_0x2cef0c['query'],_0x36a870[_0xf674('0x34')]),_0xf000d8);if(_0x2cef0c[_0xf674('0x32')]['filter']){_0x42a3ff[_0xf674('0x3e')]=_[_0xf674('0x40')](_0x42a3ff[_0xf674('0x3e')],{'$or':_[_0xf674('0x2d')](_0xf000d8,function(_0x39e577){if(_0x39e577['type']!==_0xf674('0x41')){var _0x354478={};_0x354478[_0x39e577[_0xf674('0x31')]]={'$like':'%'+_0x2cef0c[_0xf674('0x32')][_0xf674('0x42')]+'%'};return _0x354478;}})});}_0x42a3ff=_['merge']({},_0x42a3ff,_0x2cef0c[_0xf674('0x43')]);var _0x4508c4={'where':_0x42a3ff[_0xf674('0x3e')]};return db['VoiceMusicOnHold'][_0xf674('0x20')](_0x4508c4)[_0xf674('0x29')](function(_0x22284c){_0x5e1051['count']=_0x22284c;if(_0x2cef0c[_0xf674('0x32')][_0xf674('0x44')]){_0x42a3ff[_0xf674('0x45')]=[{'all':!![]}];}return db[_0xf674('0x2e')][_0xf674('0x46')](_0x42a3ff);})[_0xf674('0x29')](function(_0x47ddd6){_0x5e1051[_0xf674('0x47')]=_0x47ddd6;return _0x5e1051;})[_0xf674('0x29')](respondWithFilteredResult(_0x568843,_0x42a3ff))['catch'](handleError(_0x568843,null));};exports[_0xf674('0x48')]=function(_0x3406ea,_0x3dfe36){var _0x2f180={'raw':![],'where':{'id':_0x3406ea[_0xf674('0x49')]['id']}},_0x4b39ec={};_0x4b39ec[_0xf674('0x36')]=_[_0xf674('0x33')](db['VoiceMusicOnHold'][_0xf674('0x2f')]);_0x4b39ec[_0xf674('0x32')]=_[_0xf674('0x33')](_0x3406ea[_0xf674('0x32')]);_0x4b39ec[_0xf674('0x34')]=_['intersection'](_0x4b39ec[_0xf674('0x36')],_0x4b39ec[_0xf674('0x32')]);_0x2f180['attributes']=_['intersection'](_0x4b39ec['model'],qs[_0xf674('0x37')](_0x3406ea[_0xf674('0x32')][_0xf674('0x37')]));_0x2f180[_0xf674('0x38')]=_0x2f180['attributes'][_0xf674('0x39')]?_0x2f180['attributes']:_0x4b39ec[_0xf674('0x36')];if(_0x3406ea[_0xf674('0x32')][_0xf674('0x44')]){_0x2f180['include']=[{'all':!![]}];}_0x2f180=_[_0xf674('0x40')]({},_0x2f180,_0x3406ea['options']);return db[_0xf674('0x2e')][_0xf674('0x4a')](_0x2f180)[_0xf674('0x29')](handleEntityNotFound(_0x3dfe36,null))['then'](respondWithResult(_0x3dfe36,null))['catch'](handleError(_0x3dfe36,null));};exports[_0xf674('0x25')]=function(_0xf5a04f,_0x1a3510){if(_0xf5a04f[_0xf674('0x4b')]['id']){delete _0xf5a04f['body']['id'];}return db[_0xf674('0x2e')]['find']({'where':{'id':_0xf5a04f[_0xf674('0x49')]['id']}})[_0xf674('0x29')](handleEntityNotFound(_0x1a3510,null))[_0xf674('0x29')](saveUpdates(_0xf5a04f['body'],null))[_0xf674('0x29')](respondWithResult(_0x1a3510,null))[_0xf674('0x4c')](handleError(_0x1a3510,null));};exports[_0xf674('0x4d')]=function(_0x58d793,_0x4bfc42,_0x1b1518){return db[_0xf674('0x4e')]['transaction'](function(_0x479ba4){if(_0x58d793[_0xf674('0x4b')][_0xf674('0x4f')]===_0xf674('0x50')){_0x58d793[_0xf674('0x4b')][_0xf674('0x51')]=path[_0xf674('0x52')](config[_0xf674('0x53')],_0xf674('0x54'),_0x58d793['body'][_0xf674('0x31')]);}return db[_0xf674('0x2e')][_0xf674('0x4d')](_0x58d793[_0xf674('0x4b')],{'transaction':_0x479ba4})[_0xf674('0x29')](function(_0x5938f6){if(_0x58d793[_0xf674('0x4b')]['mode']===_0xf674('0x50')){fs[_0xf674('0x55')](_0x5938f6[_0xf674('0x51')],parseInt(_0xf674('0x56'),0x8));}var _0x37231f=_0x58d793[_0xf674('0x57')]['get']({'plain':!![]});if(!_0x37231f)throw new Error(_0xf674('0x58'));if(_0x37231f[_0xf674('0x59')]==='user'){var _0x3b8e05=_0x5938f6[_0xf674('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xf674('0x4a')]({'where':{'name':_0xf674('0x27'),'userProfileId':_0x37231f[_0xf674('0x5a')]},'raw':!![]})['then'](function(_0x21a5e0){if(_0x21a5e0&&_0x21a5e0[_0xf674('0x5b')]===0x0){return db['UserProfileResource'][_0xf674('0x4d')]({'name':_0x3b8e05['name'],'resourceId':_0x3b8e05['id'],'type':_0x21a5e0[_0xf674('0x31')],'sectionId':_0x21a5e0['id']},{})[_0xf674('0x29')](function(){return _0x5938f6;});}else{return _0x5938f6;}})['catch'](function(_0x4379df){logger[_0xf674('0x2b')](_0xf674('0x5c'),_0x4379df);});}return _0x5938f6;});})[_0xf674('0x29')](respondWithResult(_0x4bfc42,0xc9))[_0xf674('0x4c')](handleError(_0x4bfc42,null));};exports[_0xf674('0x28')]=function(_0x49ecbb,_0x35ea12,_0xa09798){var _0x3fe9fa;return db[_0xf674('0x2e')]['find']({'where':{'id':_0x49ecbb[_0xf674('0x49')]['id']}})[_0xf674('0x29')](function(_0x2fc7a7){if(_0x2fc7a7){return db[_0xf674('0x4e')][_0xf674('0x5d')](function(_0x16820e){return _0x2fc7a7['destroy']({'transaction':_0x16820e,'raw':!![]})[_0xf674('0x29')](function(_0x2cda4a){if(_0x2cda4a['directory']){fs[_0xf674('0x5e')](_0x2cda4a[_0xf674('0x51')])[_0xf674('0x5f')](function(_0x4650f2){fs[_0xf674('0x60')](path['join'](_0x2cda4a['directory'],_0x4650f2));});fs['rmdirSync'](_0x2cda4a['directory']);}return _0x2cda4a;});})[_0xf674('0x4c')](function(_0x4846d0){throw new db[(_0xf674('0x61'))][(_0xf674('0x62'))](_0x4846d0['message']);});}})[_0xf674('0x29')](handleEntityNotFound(_0x35ea12,null))[_0xf674('0x29')](removeEntity(_0x35ea12,null))[_0xf674('0x4c')](handleError(_0x35ea12,null));};exports[_0xf674('0x63')]=function(_0x1dfdf3,_0x50b318,_0x313636){return db[_0xf674('0x4e')]['transaction'](function(_0x204d6d){var _0x1856c7;return db[_0xf674('0x2e')][_0xf674('0x4a')]({'where':{'id':_0x1dfdf3[_0xf674('0x49')]['id']}})['then'](function(_0x2ec01a){if(_0x2ec01a){_0x1856c7=_0x2ec01a;return _0x2ec01a[_0xf674('0x63')](_0x1dfdf3[_0xf674('0x4b')]['id'],{'transaction':_0x204d6d});}})[_0xf674('0x29')](function(_0x242f3b){if(_0x242f3b){return db[_0xf674('0x64')][_0xf674('0x65')]({'where':{'id':_0x1dfdf3[_0xf674('0x4b')]['id']},'attributes':['id',_0xf674('0x31'),_0xf674('0x66'),_0xf674('0x67'),_0xf674('0x68')],'raw':!![]});}})[_0xf674('0x29')](function(_0x274649){if(_0x274649){var _0x2c28c7=path[_0xf674('0x52')](config[_0xf674('0x53')],'server/files/sounds/converted',util[_0xf674('0x69')](_0xf674('0x6a'),path[_0xf674('0x6b')](_0x274649[_0xf674('0x66')],path['extname'](_0x274649[_0xf674('0x66')])),_0x274649[_0xf674('0x67')]));var _0x44be2f=path[_0xf674('0x52')](config[_0xf674('0x53')],_0xf674('0x54'),_0x1856c7['name'],util[_0xf674('0x69')](_0xf674('0x6a'),_0x274649[_0xf674('0x31')],_0x274649['converted_format']));fs[_0xf674('0x6c')](_0x2c28c7,_0x44be2f);return _0x274649;}})['catch'](function(_0x1a572f){throw new db[(_0xf674('0x61'))]['ValidationError'](_0x1a572f['message']);});})[_0xf674('0x29')](handleEntityNotFound(_0x50b318,null))[_0xf674('0x29')](respondWithResult(_0x50b318,0xc9))[_0xf674('0x4c')](handleError(_0x50b318,null));};exports['removeSound']=function(_0x43aa11,_0x46d3f5,_0x26f441){return db[_0xf674('0x4e')][_0xf674('0x5d')](function(_0x256f4d){var _0x251bdf;return db['VoiceMusicOnHold'][_0xf674('0x65')]({'where':{'id':_0x43aa11[_0xf674('0x49')]['id']}})['then'](handleEntityNotFound(_0x46d3f5,null))[_0xf674('0x29')](function(_0x37079e){if(_0x37079e){_0x251bdf=_0x37079e;return _0x37079e[_0xf674('0x6d')](_0x43aa11[_0xf674('0x49')][_0xf674('0x6e')]);}})[_0xf674('0x29')](function(_0x19a810){if(_0x19a810){return db[_0xf674('0x64')][_0xf674('0x65')]({'where':{'id':_0x43aa11[_0xf674('0x49')]['id2']},'attributes':['id',_0xf674('0x31'),_0xf674('0x66'),_0xf674('0x67'),_0xf674('0x68')],'raw':!![]});}})[_0xf674('0x29')](function(_0x25b752){if(_0x25b752){fs[_0xf674('0x60')](path[_0xf674('0x52')](_0x251bdf[_0xf674('0x51')],util[_0xf674('0x69')]('%s.%s',_0x25b752[_0xf674('0x31')],_0x25b752['converted_format'])));return _0x25b752;}})[_0xf674('0x4c')](function(_0xfc9b62){throw new db[(_0xf674('0x61'))]['ValidationError'](_0xfc9b62['message']);});})[_0xf674('0x29')](handleEntityNotFound(_0x46d3f5,null))[_0xf674('0x29')](respondWithStatusCode(_0x46d3f5,0xcc))['catch'](handleError(_0x46d3f5,null));};exports[_0xf674('0x6f')]=function(_0x4b18e6,_0x3011a7,_0x17d5ac){var _0x1a8db5={};var _0x2ecc4f={};var _0x386235;var _0xb256a3;return db[_0xf674('0x2e')][_0xf674('0x65')]({'where':{'id':_0x4b18e6['params']['id']}})[_0xf674('0x29')](handleEntityNotFound(_0x3011a7,null))[_0xf674('0x29')](function(_0x3fdc76){if(_0x3fdc76){_0x386235=_0x3fdc76;_0x2ecc4f['model']=_[_0xf674('0x33')](db[_0xf674('0x64')][_0xf674('0x2f')]);_0x2ecc4f[_0xf674('0x32')]=_[_0xf674('0x33')](_0x4b18e6[_0xf674('0x32')]);_0x2ecc4f[_0xf674('0x34')]=_[_0xf674('0x35')](_0x2ecc4f[_0xf674('0x36')],_0x2ecc4f['query']);_0x1a8db5[_0xf674('0x38')]=_[_0xf674('0x35')](_0x2ecc4f[_0xf674('0x36')],qs[_0xf674('0x37')](_0x4b18e6[_0xf674('0x32')][_0xf674('0x37')]));_0x1a8db5[_0xf674('0x38')]=_0x1a8db5[_0xf674('0x38')][_0xf674('0x39')]?_0x1a8db5[_0xf674('0x38')]:_0x2ecc4f[_0xf674('0x36')];_0x1a8db5[_0xf674('0x70')]=qs[_0xf674('0x3d')](_0x4b18e6[_0xf674('0x32')][_0xf674('0x3d')]);_0x1a8db5['where']=qs['filters'](_[_0xf674('0x3f')](_0x4b18e6[_0xf674('0x32')],_0x2ecc4f[_0xf674('0x34')]));if(_0x4b18e6[_0xf674('0x32')][_0xf674('0x42')]){_0x1a8db5[_0xf674('0x3e')]=_[_0xf674('0x40')](_0x1a8db5[_0xf674('0x3e')],{'$or':_[_0xf674('0x2d')](_0x1a8db5[_0xf674('0x38')],function(_0x32343e){var _0x983be={};_0x983be[_0x32343e]={'$like':'%'+_0x4b18e6[_0xf674('0x32')][_0xf674('0x42')]+'%'};return _0x983be;})});}_0x1a8db5=_['merge']({},_0x1a8db5,_0x4b18e6[_0xf674('0x43')]);return _0x386235[_0xf674('0x6f')](_0x1a8db5);}})[_0xf674('0x29')](function(_0x31f13d){if(_0x31f13d){_0xb256a3=_0x31f13d[_0xf674('0x39')];if(!_0x4b18e6[_0xf674('0x32')][_0xf674('0x3a')](_0xf674('0x3b'))){_0x1a8db5[_0xf674('0x3c')]=qs[_0xf674('0x3c')](_0x4b18e6['query']['limit']);_0x1a8db5[_0xf674('0x1e')]=qs[_0xf674('0x1e')](_0x4b18e6[_0xf674('0x32')][_0xf674('0x1e')]);}return _0x386235[_0xf674('0x6f')](_0x1a8db5);}})[_0xf674('0x29')](function(_0xed72cd){if(_0xed72cd){return _0xed72cd?{'count':_0xb256a3,'rows':_0xed72cd}:null;}})['then'](respondWithResult(_0x3011a7,null))[_0xf674('0x4c')](handleError(_0x3011a7,null));}; \ No newline at end of file +var _0x2a1d=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','findAll','rows','show','params','find','catch','body','create','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','unlinkSync','Sequelize','ValidationError','message','sequelize','addSound','Sound','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','removeSound','findOne','id2','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','MusicOnHolds','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x3d849c,_0x5d7423){var _0x3b22d1=function(_0x22b757){while(--_0x22b757){_0x3d849c['push'](_0x3d849c['shift']());}};_0x3b22d1(++_0x5d7423);}(_0x2a1d,0x17a));var _0xd2a1=function(_0x210f0c,_0x408813){_0x210f0c=_0x210f0c-0x0;var _0x1c41db=_0x2a1d[_0x210f0c];return _0x1c41db;};'use strict';var emlformat=require(_0xd2a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd2a1('0x1'));var jsonpatch=require(_0xd2a1('0x2'));var rp=require(_0xd2a1('0x3'));var moment=require(_0xd2a1('0x4'));var BPromise=require(_0xd2a1('0x5'));var Mustache=require(_0xd2a1('0x6'));var util=require(_0xd2a1('0x7'));var path=require(_0xd2a1('0x8'));var sox=require(_0xd2a1('0x9'));var csv=require(_0xd2a1('0xa'));var ejs=require(_0xd2a1('0xb'));var fs=require('fs');var fs_extra=require(_0xd2a1('0xc'));var _=require('lodash');var squel=require(_0xd2a1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd2a1('0xe'));var toCsv=require(_0xd2a1('0xa'));var querystring=require(_0xd2a1('0xf'));var Papa=require(_0xd2a1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd2a1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2a1('0x12'));var logger=require('../../config/logger')(_0xd2a1('0x13'));var utils=require(_0xd2a1('0x14'));var config=require(_0xd2a1('0x15'));var licenseUtil=require(_0xd2a1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50216a,_0x5ed7cb){_0x5ed7cb=_0x5ed7cb||0xcc;return function(_0x3ee01a){if(_0x3ee01a){return _0x50216a[_0xd2a1('0x17')](_0x5ed7cb);}return _0x50216a[_0xd2a1('0x18')](_0x5ed7cb)[_0xd2a1('0x19')]();};}function respondWithResult(_0x1b72f7,_0x42cedf){_0x42cedf=_0x42cedf||0xc8;return function(_0x36f644){if(_0x36f644){return _0x1b72f7[_0xd2a1('0x18')](_0x42cedf)['json'](_0x36f644);}};}function respondWithFilteredResult(_0x19bb3c,_0x11c6ed){return function(_0x39cdad){if(_0x39cdad){var _0x54a354=typeof _0x11c6ed[_0xd2a1('0x1a')]==='undefined'&&typeof _0x11c6ed[_0xd2a1('0x1b')]==='undefined';var _0x49ec19=_0x39cdad[_0xd2a1('0x1c')];var _0x451c26=_0x54a354?0x0:_0x11c6ed[_0xd2a1('0x1a')];var _0x7758ec=_0x54a354?_0x39cdad[_0xd2a1('0x1c')]:_0x11c6ed[_0xd2a1('0x1a')]+_0x11c6ed[_0xd2a1('0x1b')];var _0x1fc189;if(_0x7758ec>=_0x49ec19){_0x7758ec=_0x49ec19;_0x1fc189=0xc8;}else{_0x1fc189=0xce;}_0x19bb3c[_0xd2a1('0x18')](_0x1fc189);return _0x19bb3c[_0xd2a1('0x1d')](_0xd2a1('0x1e'),_0x451c26+'-'+_0x7758ec+'/'+_0x49ec19)[_0xd2a1('0x1f')](_0x39cdad);}return null;};}function patchUpdates(_0xb31311){return function(_0xc00e52){try{jsonpatch[_0xd2a1('0x20')](_0xc00e52,_0xb31311,!![]);}catch(_0x3184bc){return BPromise[_0xd2a1('0x21')](_0x3184bc);}return _0xc00e52[_0xd2a1('0x22')]();};}function saveUpdates(_0x21bd8e,_0xac28b4){return function(_0x5bdc1c){if(_0x5bdc1c){return _0x5bdc1c['update'](_0x21bd8e)['then'](function(_0x61bbfa){return _0x61bbfa;});}return null;};}function removeEntity(_0x5bf98e,_0x2872ed){return function(_0x4a0d5f){if(_0x4a0d5f){return _0x4a0d5f[_0xd2a1('0x23')]()[_0xd2a1('0x24')](function(){var _0x8c5360=_0x4a0d5f['get']({'plain':!![]});var _0x399cec=_0xd2a1('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x399cec,'resourceId':_0x8c5360['id']}})['then'](function(){return _0x4a0d5f;});})[_0xd2a1('0x24')](function(){_0x5bf98e[_0xd2a1('0x18')](0xcc)[_0xd2a1('0x19')]();});}};}function handleEntityNotFound(_0x41e97e,_0x56adf1){return function(_0x5de21f){if(!_0x5de21f){_0x41e97e[_0xd2a1('0x17')](0x194);}return _0x5de21f;};}function handleError(_0x29b572,_0x34e73a){_0x34e73a=_0x34e73a||0x1f4;return function(_0x110914){logger[_0xd2a1('0x26')](_0x110914['stack']);if(_0x110914[_0xd2a1('0x27')]){delete _0x110914[_0xd2a1('0x27')];}_0x29b572[_0xd2a1('0x18')](_0x34e73a)[_0xd2a1('0x28')](_0x110914);};}exports['index']=function(_0x2502c1,_0x299637){var _0x4b2198={},_0x195e65={},_0x174199={'count':0x0,'rows':[]};var _0x3f4e99=_[_0xd2a1('0x29')](db['VoiceMusicOnHold'][_0xd2a1('0x2a')],function(_0x593922){return{'name':_0x593922[_0xd2a1('0x2b')],'type':_0x593922[_0xd2a1('0x2c')][_0xd2a1('0x2d')]};});_0x195e65[_0xd2a1('0x2e')]=_[_0xd2a1('0x29')](_0x3f4e99,_0xd2a1('0x27'));_0x195e65[_0xd2a1('0x2f')]=_[_0xd2a1('0x30')](_0x2502c1[_0xd2a1('0x2f')]);_0x195e65['filters']=_[_0xd2a1('0x31')](_0x195e65[_0xd2a1('0x2e')],_0x195e65[_0xd2a1('0x2f')]);_0x4b2198['attributes']=_[_0xd2a1('0x31')](_0x195e65[_0xd2a1('0x2e')],qs[_0xd2a1('0x32')](_0x2502c1[_0xd2a1('0x2f')][_0xd2a1('0x32')]));_0x4b2198['attributes']=_0x4b2198[_0xd2a1('0x33')]['length']?_0x4b2198['attributes']:_0x195e65['model'];if(!_0x2502c1[_0xd2a1('0x2f')][_0xd2a1('0x34')](_0xd2a1('0x35'))){_0x4b2198[_0xd2a1('0x1b')]=qs[_0xd2a1('0x1b')](_0x2502c1[_0xd2a1('0x2f')][_0xd2a1('0x1b')]);_0x4b2198[_0xd2a1('0x1a')]=qs[_0xd2a1('0x1a')](_0x2502c1['query'][_0xd2a1('0x1a')]);}_0x4b2198[_0xd2a1('0x36')]=qs[_0xd2a1('0x37')](_0x2502c1[_0xd2a1('0x2f')][_0xd2a1('0x37')]);delete _0x2502c1[_0xd2a1('0x2f')][_0xd2a1('0x37')];_0x4b2198[_0xd2a1('0x38')]=qs[_0xd2a1('0x39')](_[_0xd2a1('0x3a')](_0x2502c1[_0xd2a1('0x2f')],_0x195e65[_0xd2a1('0x39')]),_0x3f4e99);if(_0x2502c1[_0xd2a1('0x2f')][_0xd2a1('0x3b')]){_0x4b2198[_0xd2a1('0x38')]=_[_0xd2a1('0x3c')](_0x4b2198[_0xd2a1('0x38')],{'$or':_[_0xd2a1('0x29')](_0x3f4e99,function(_0xc1b5e8){if(_0xc1b5e8[_0xd2a1('0x2c')]!==_0xd2a1('0x3d')){var _0x42ef77={};_0x42ef77[_0xc1b5e8[_0xd2a1('0x27')]]={'$like':'%'+_0x2502c1['query'][_0xd2a1('0x3b')]+'%'};return _0x42ef77;}})});}_0x4b2198=_[_0xd2a1('0x3c')]({},_0x4b2198,_0x2502c1[_0xd2a1('0x3e')]);var _0x1e4548={'where':_0x4b2198['where']};return db[_0xd2a1('0x3f')][_0xd2a1('0x1c')](_0x1e4548)[_0xd2a1('0x24')](function(_0x33e7c9){_0x174199[_0xd2a1('0x1c')]=_0x33e7c9;if(_0x2502c1['query'][_0xd2a1('0x40')]){_0x4b2198['include']=[{'all':!![]}];}return db[_0xd2a1('0x3f')][_0xd2a1('0x41')](_0x4b2198);})[_0xd2a1('0x24')](function(_0x43755b){_0x174199[_0xd2a1('0x42')]=_0x43755b;return _0x174199;})['then'](respondWithFilteredResult(_0x299637,_0x4b2198))['catch'](handleError(_0x299637,null));};exports[_0xd2a1('0x43')]=function(_0x27ef00,_0x158630){var _0x589a71={'raw':![],'where':{'id':_0x27ef00[_0xd2a1('0x44')]['id']}},_0x176a75={};_0x176a75[_0xd2a1('0x2e')]=_[_0xd2a1('0x30')](db[_0xd2a1('0x3f')][_0xd2a1('0x2a')]);_0x176a75[_0xd2a1('0x2f')]=_[_0xd2a1('0x30')](_0x27ef00[_0xd2a1('0x2f')]);_0x176a75[_0xd2a1('0x39')]=_[_0xd2a1('0x31')](_0x176a75[_0xd2a1('0x2e')],_0x176a75['query']);_0x589a71[_0xd2a1('0x33')]=_[_0xd2a1('0x31')](_0x176a75['model'],qs[_0xd2a1('0x32')](_0x27ef00['query']['fields']));_0x589a71[_0xd2a1('0x33')]=_0x589a71[_0xd2a1('0x33')]['length']?_0x589a71[_0xd2a1('0x33')]:_0x176a75[_0xd2a1('0x2e')];if(_0x27ef00['query']['includeAll']){_0x589a71['include']=[{'all':!![]}];}_0x589a71=_[_0xd2a1('0x3c')]({},_0x589a71,_0x27ef00['options']);return db['VoiceMusicOnHold'][_0xd2a1('0x45')](_0x589a71)['then'](handleEntityNotFound(_0x158630,null))['then'](respondWithResult(_0x158630,null))[_0xd2a1('0x46')](handleError(_0x158630,null));};exports['update']=function(_0x1ae2c3,_0x411976){if(_0x1ae2c3['body']['id']){delete _0x1ae2c3[_0xd2a1('0x47')]['id'];}return db[_0xd2a1('0x3f')]['find']({'where':{'id':_0x1ae2c3[_0xd2a1('0x44')]['id']}})[_0xd2a1('0x24')](handleEntityNotFound(_0x411976,null))['then'](saveUpdates(_0x1ae2c3[_0xd2a1('0x47')],null))[_0xd2a1('0x24')](respondWithResult(_0x411976,null))['catch'](handleError(_0x411976,null));};exports[_0xd2a1('0x48')]=function(_0x93733a,_0xa7255f,_0x371c03){return db['sequelize']['transaction'](function(_0x380aa6){if(_0x93733a[_0xd2a1('0x47')][_0xd2a1('0x49')]===_0xd2a1('0x4a')){_0x93733a[_0xd2a1('0x47')][_0xd2a1('0x4b')]=path[_0xd2a1('0x4c')](config[_0xd2a1('0x4d')],_0xd2a1('0x4e'),_0x93733a[_0xd2a1('0x47')][_0xd2a1('0x27')]);}return db[_0xd2a1('0x3f')][_0xd2a1('0x48')](_0x93733a[_0xd2a1('0x47')],{'transaction':_0x380aa6})['then'](function(_0x172608){if(_0x93733a[_0xd2a1('0x47')][_0xd2a1('0x49')]===_0xd2a1('0x4a')){fs[_0xd2a1('0x4f')](_0x172608[_0xd2a1('0x4b')],parseInt(_0xd2a1('0x50'),0x8));}var _0x5d1d0b=_0x93733a[_0xd2a1('0x51')][_0xd2a1('0x52')]({'plain':!![]});if(!_0x5d1d0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d1d0b[_0xd2a1('0x53')]===_0xd2a1('0x51')){var _0x32b049=_0x172608[_0xd2a1('0x52')]({'plain':!![]});return db[_0xd2a1('0x54')][_0xd2a1('0x45')]({'where':{'name':_0xd2a1('0x25'),'userProfileId':_0x5d1d0b[_0xd2a1('0x55')]},'raw':!![]})[_0xd2a1('0x24')](function(_0x4dfa92){if(_0x4dfa92&&_0x4dfa92[_0xd2a1('0x56')]===0x0){return db['UserProfileResource'][_0xd2a1('0x48')]({'name':_0x32b049[_0xd2a1('0x27')],'resourceId':_0x32b049['id'],'type':_0x4dfa92[_0xd2a1('0x27')],'sectionId':_0x4dfa92['id']},{})[_0xd2a1('0x24')](function(){return _0x172608;});}else{return _0x172608;}})['catch'](function(_0x2284f3){logger[_0xd2a1('0x26')](_0xd2a1('0x57'),_0x2284f3);});}return _0x172608;});})[_0xd2a1('0x24')](respondWithResult(_0xa7255f,0xc9))[_0xd2a1('0x46')](handleError(_0xa7255f,null));};exports['destroy']=function(_0x30d471,_0x4c2fbb,_0x5b0513){var _0x168567;return db[_0xd2a1('0x3f')][_0xd2a1('0x45')]({'where':{'id':_0x30d471[_0xd2a1('0x44')]['id']}})[_0xd2a1('0x24')](function(_0xb87f2d){if(_0xb87f2d){return db['sequelize'][_0xd2a1('0x58')](function(_0x230a14){return _0xb87f2d[_0xd2a1('0x23')]({'transaction':_0x230a14,'raw':!![]})[_0xd2a1('0x24')](function(_0xe6cb53){if(_0xe6cb53[_0xd2a1('0x4b')]){fs['readdirSync'](_0xe6cb53['directory'])['forEach'](function(_0x537633){fs[_0xd2a1('0x59')](path[_0xd2a1('0x4c')](_0xe6cb53[_0xd2a1('0x4b')],_0x537633));});fs['rmdirSync'](_0xe6cb53[_0xd2a1('0x4b')]);}return _0xe6cb53;});})[_0xd2a1('0x46')](function(_0x559811){throw new db[(_0xd2a1('0x5a'))][(_0xd2a1('0x5b'))](_0x559811[_0xd2a1('0x5c')]);});}})['then'](handleEntityNotFound(_0x4c2fbb,null))['then'](removeEntity(_0x4c2fbb,null))[_0xd2a1('0x46')](handleError(_0x4c2fbb,null));};exports['addSound']=function(_0x2df854,_0x2be276,_0x3bb185){return db[_0xd2a1('0x5d')]['transaction'](function(_0x1fe3df){var _0x5858fd;return db[_0xd2a1('0x3f')][_0xd2a1('0x45')]({'where':{'id':_0x2df854[_0xd2a1('0x44')]['id']}})[_0xd2a1('0x24')](function(_0x36e7b5){if(_0x36e7b5){_0x5858fd=_0x36e7b5;return _0x36e7b5[_0xd2a1('0x5e')](_0x2df854[_0xd2a1('0x47')]['id'],{'transaction':_0x1fe3df});}})[_0xd2a1('0x24')](function(_0x2fa789){if(_0x2fa789){return db[_0xd2a1('0x5f')]['findOne']({'where':{'id':_0x2df854[_0xd2a1('0x47')]['id']},'attributes':['id','name',_0xd2a1('0x60'),'converted_format',_0xd2a1('0x61')],'raw':!![]});}})[_0xd2a1('0x24')](function(_0x3d2cdc){if(_0x3d2cdc){var _0x482215=path[_0xd2a1('0x4c')](config[_0xd2a1('0x4d')],_0xd2a1('0x62'),util[_0xd2a1('0x63')](_0xd2a1('0x64'),path[_0xd2a1('0x65')](_0x3d2cdc['save_name'],path['extname'](_0x3d2cdc[_0xd2a1('0x60')])),_0x3d2cdc['converted_format']));var _0x2f701e=path[_0xd2a1('0x4c')](config[_0xd2a1('0x4d')],_0xd2a1('0x4e'),_0x5858fd[_0xd2a1('0x27')],util[_0xd2a1('0x63')](_0xd2a1('0x64'),_0x3d2cdc[_0xd2a1('0x27')],_0x3d2cdc[_0xd2a1('0x66')]));fs[_0xd2a1('0x67')](_0x482215,_0x2f701e);return _0x3d2cdc;}})['catch'](function(_0x54887){throw new db[(_0xd2a1('0x5a'))][(_0xd2a1('0x5b'))](_0x54887[_0xd2a1('0x5c')]);});})[_0xd2a1('0x24')](handleEntityNotFound(_0x2be276,null))[_0xd2a1('0x24')](respondWithResult(_0x2be276,0xc9))[_0xd2a1('0x46')](handleError(_0x2be276,null));};exports[_0xd2a1('0x68')]=function(_0x162022,_0x515d32,_0x211230){return db[_0xd2a1('0x5d')][_0xd2a1('0x58')](function(_0x5cc66f){var _0x1e81f3;return db[_0xd2a1('0x3f')][_0xd2a1('0x69')]({'where':{'id':_0x162022[_0xd2a1('0x44')]['id']}})[_0xd2a1('0x24')](handleEntityNotFound(_0x515d32,null))['then'](function(_0x338210){if(_0x338210){_0x1e81f3=_0x338210;return _0x338210['removeSound'](_0x162022[_0xd2a1('0x44')][_0xd2a1('0x6a')]);}})['then'](function(_0x410954){if(_0x410954){return db['Sound'][_0xd2a1('0x69')]({'where':{'id':_0x162022[_0xd2a1('0x44')][_0xd2a1('0x6a')]},'attributes':['id',_0xd2a1('0x27'),_0xd2a1('0x60'),_0xd2a1('0x66'),'createdAt'],'raw':!![]});}})[_0xd2a1('0x24')](function(_0x3aaf03){if(_0x3aaf03){fs[_0xd2a1('0x59')](path[_0xd2a1('0x4c')](_0x1e81f3['directory'],util[_0xd2a1('0x63')]('%s.%s',_0x3aaf03[_0xd2a1('0x27')],_0x3aaf03[_0xd2a1('0x66')])));return _0x3aaf03;}})[_0xd2a1('0x46')](function(_0xa017ae){throw new db['Sequelize'][(_0xd2a1('0x5b'))](_0xa017ae[_0xd2a1('0x5c')]);});})[_0xd2a1('0x24')](handleEntityNotFound(_0x515d32,null))[_0xd2a1('0x24')](respondWithStatusCode(_0x515d32,0xcc))[_0xd2a1('0x46')](handleError(_0x515d32,null));};exports[_0xd2a1('0x6b')]=function(_0x123266,_0x5d79d7,_0x5a78f9){var _0x10b08c={};var _0x36353d={};var _0x389493;var _0xd89d33;return db[_0xd2a1('0x3f')]['findOne']({'where':{'id':_0x123266[_0xd2a1('0x44')]['id']}})[_0xd2a1('0x24')](handleEntityNotFound(_0x5d79d7,null))['then'](function(_0x1ba021){if(_0x1ba021){_0x389493=_0x1ba021;_0x36353d[_0xd2a1('0x2e')]=_['keys'](db[_0xd2a1('0x5f')]['rawAttributes']);_0x36353d[_0xd2a1('0x2f')]=_['keys'](_0x123266[_0xd2a1('0x2f')]);_0x36353d[_0xd2a1('0x39')]=_[_0xd2a1('0x31')](_0x36353d[_0xd2a1('0x2e')],_0x36353d[_0xd2a1('0x2f')]);_0x10b08c[_0xd2a1('0x33')]=_[_0xd2a1('0x31')](_0x36353d['model'],qs[_0xd2a1('0x32')](_0x123266['query'][_0xd2a1('0x32')]));_0x10b08c['attributes']=_0x10b08c[_0xd2a1('0x33')]['length']?_0x10b08c['attributes']:_0x36353d['model'];_0x10b08c['order']=qs[_0xd2a1('0x37')](_0x123266[_0xd2a1('0x2f')][_0xd2a1('0x37')]);_0x10b08c[_0xd2a1('0x38')]=qs[_0xd2a1('0x39')](_['pick'](_0x123266['query'],_0x36353d[_0xd2a1('0x39')]));if(_0x123266[_0xd2a1('0x2f')][_0xd2a1('0x3b')]){_0x10b08c[_0xd2a1('0x38')]=_[_0xd2a1('0x3c')](_0x10b08c[_0xd2a1('0x38')],{'$or':_[_0xd2a1('0x29')](_0x10b08c[_0xd2a1('0x33')],function(_0x770a3d){var _0x4c25a1={};_0x4c25a1[_0x770a3d]={'$like':'%'+_0x123266[_0xd2a1('0x2f')][_0xd2a1('0x3b')]+'%'};return _0x4c25a1;})});}_0x10b08c=_[_0xd2a1('0x3c')]({},_0x10b08c,_0x123266['options']);return _0x389493[_0xd2a1('0x6b')](_0x10b08c);}})[_0xd2a1('0x24')](function(_0x22ee92){if(_0x22ee92){_0xd89d33=_0x22ee92['length'];if(!_0x123266[_0xd2a1('0x2f')][_0xd2a1('0x34')](_0xd2a1('0x35'))){_0x10b08c['limit']=qs[_0xd2a1('0x1b')](_0x123266[_0xd2a1('0x2f')][_0xd2a1('0x1b')]);_0x10b08c[_0xd2a1('0x1a')]=qs['offset'](_0x123266[_0xd2a1('0x2f')][_0xd2a1('0x1a')]);}return _0x389493[_0xd2a1('0x6b')](_0x10b08c);}})['then'](function(_0x1acb80){if(_0x1acb80){return _0x1acb80?{'count':_0xd89d33,'rows':_0x1acb80}:null;}})['then'](respondWithResult(_0x5d79d7,null))['catch'](handleError(_0x5d79d7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6467ede..6ca0cdc 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 _0x386f=['define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x217174,_0x385071){var _0x44b43e=function(_0x3b5e3d){while(--_0x3b5e3d){_0x217174['push'](_0x217174['shift']());}};_0x44b43e(++_0x385071);}(_0x386f,0xff));var _0xf386=function(_0x45fdf0,_0x9bc51){_0x45fdf0=_0x45fdf0-0x0;var _0x229f63=_0x386f[_0x45fdf0];return _0x229f63;};'use strict';var _=require(_0xf386('0x0'));var util=require('util');var logger=require(_0xf386('0x1'))(_0xf386('0x2'));var moment=require('moment');var BPromise=require(_0xf386('0x3'));var rp=require(_0xf386('0x4'));var fs=require('fs');var path=require(_0xf386('0x5'));var rimraf=require(_0xf386('0x6'));var config=require(_0xf386('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xf386('0x8')]=function(_0x47ffc2,_0x53b0ee){return _0x47ffc2[_0xf386('0x9')](_0xf386('0xa'),attributes,{'tableName':_0xf386('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc62=['../../config/logger','api','path','rimraf','../../config/environment','exports','voice_musiconhold','lodash','util'];(function(_0xddebe7,_0x57b936){var _0x1c9843=function(_0x363000){while(--_0x363000){_0xddebe7['push'](_0xddebe7['shift']());}};_0x1c9843(++_0x57b936);}(_0xcc62,0x1db));var _0x2cc6=function(_0x459e47,_0x5e08de){_0x459e47=_0x459e47-0x0;var _0x57594a=_0xcc62[_0x459e47];return _0x57594a;};'use strict';var _=require(_0x2cc6('0x0'));var util=require(_0x2cc6('0x1'));var logger=require(_0x2cc6('0x2'))(_0x2cc6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cc6('0x4'));var rimraf=require(_0x2cc6('0x5'));var config=require(_0x2cc6('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x2cc6('0x7')]=function(_0x3ebd6e,_0x2cd2c5){return _0x3ebd6e['define']('VoiceMusicOnHold',attributes,{'tableName':_0x2cc6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 487febe..a1ea1a5 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0xa6bb53,_0x43605d){var _0x8deac7=function(_0xa35359){while(--_0xa35359){_0xa6bb53['push'](_0xa6bb53['shift']());}};_0x8deac7(++_0x43605d);}(_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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x4b62db,_0x1b18d3){var _0x2935a0=function(_0x1c7e6e){while(--_0x1c7e6e){_0x4b62db['push'](_0x4b62db['shift']());}};_0x2935a0(++_0x1b18d3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xcb91[_0x1ebce2];return _0x4a330c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e4bcae7..df4f3ec 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 _0x96aa=['fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x5a5aca,_0x368fbb){var _0x1cb523=function(_0x43f690){while(--_0x43f690){_0x5a5aca['push'](_0x5a5aca['shift']());}};_0x1cb523(++_0x368fbb);}(_0x96aa,0x67));var _0xa96a=function(_0x2dff23,_0x519d39){_0x2dff23=_0x2dff23-0x0;var _0x5da0df=_0x96aa[_0x2dff23];return _0x5da0df;};'use strict';var multer=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var path=require('path');var timeout=require(_0xa96a('0x2'));var express=require(_0xa96a('0x3'));var router=express[_0xa96a('0x4')]();var fs_extra=require(_0xa96a('0x5'));var auth=require(_0xa96a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa96a('0x7'));var controller=require(_0xa96a('0x8'));router['get']('/',auth[_0xa96a('0x9')](),controller[_0xa96a('0xa')]);router[_0xa96a('0xb')](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller[_0xa96a('0xd')]);router[_0xa96a('0xb')](_0xa96a('0xe'),auth[_0xa96a('0x9')](),controller[_0xa96a('0xf')]);router[_0xa96a('0xb')]('/:id/users',auth[_0xa96a('0x9')](),controller['getAgents']);router[_0xa96a('0xb')](_0xa96a('0x10'),auth['isAuthenticated'](),controller[_0xa96a('0x11')]);router[_0xa96a('0x12')]('/',auth[_0xa96a('0x9')](),controller[_0xa96a('0x13')]);router[_0xa96a('0x12')](_0xa96a('0x14'),auth[_0xa96a('0x9')](),controller[_0xa96a('0x15')]);router[_0xa96a('0x12')](_0xa96a('0x10'),auth[_0xa96a('0x9')](),controller[_0xa96a('0x16')]);router['put']('/:id',auth[_0xa96a('0x9')](),controller['update']);router[_0xa96a('0x17')]('/:id',auth[_0xa96a('0x9')](),controller[_0xa96a('0x18')]);router[_0xa96a('0x17')](_0xa96a('0x14'),auth[_0xa96a('0x9')](),controller[_0xa96a('0x19')]);router['delete'](_0xa96a('0x10'),auth[_0xa96a('0x9')](),controller['removeTeams']);module[_0xa96a('0x1a')]=router; \ No newline at end of file +var _0x4fd7=['update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x4fd7,0xe6));var _0x74fd=function(_0x5a07bb,_0x477844){_0x5a07bb=_0x5a07bb-0x0;var _0x8f1f09=_0x4fd7[_0x5a07bb];return _0x8f1f09;};'use strict';var multer=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var path=require(_0x74fd('0x2'));var timeout=require(_0x74fd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x74fd('0x4'));var auth=require(_0x74fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74fd('0x6'));var controller=require('./voicePrefix.controller');router[_0x74fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x74fd('0x8')]);router[_0x74fd('0x7')]('/describe',auth[_0x74fd('0x9')](),controller[_0x74fd('0xa')]);router['get'](_0x74fd('0xb'),auth[_0x74fd('0x9')](),controller[_0x74fd('0xc')]);router[_0x74fd('0x7')](_0x74fd('0xd'),auth[_0x74fd('0x9')](),controller[_0x74fd('0xe')]);router[_0x74fd('0x7')](_0x74fd('0xf'),auth[_0x74fd('0x9')](),controller[_0x74fd('0x10')]);router[_0x74fd('0x11')]('/',auth[_0x74fd('0x9')](),controller[_0x74fd('0x12')]);router[_0x74fd('0x11')](_0x74fd('0xd'),auth['isAuthenticated'](),controller[_0x74fd('0x13')]);router[_0x74fd('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x74fd('0x14')]);router[_0x74fd('0x15')](_0x74fd('0xb'),auth[_0x74fd('0x9')](),controller[_0x74fd('0x16')]);router[_0x74fd('0x17')](_0x74fd('0xb'),auth[_0x74fd('0x9')](),controller[_0x74fd('0x18')]);router[_0x74fd('0x17')](_0x74fd('0xd'),auth['isAuthenticated'](),controller[_0x74fd('0x19')]);router[_0x74fd('0x17')]('/:id/teams',auth[_0x74fd('0x9')](),controller[_0x74fd('0x1a')]);module[_0x74fd('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 0c8f9c1..df2b9c5 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 _0x8640=['system-','getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8640,0x19b));var _0x0864=function(_0x240496,_0x1cc715){_0x240496=_0x240496-0x0;var _0x3b4c0e=_0x8640[_0x240496];return _0x3b4c0e;};'use strict';var Sequelize=require(_0x0864('0x0'));module[_0x0864('0x1')]={'name':{'type':Sequelize[_0x0864('0x2')],'allowNull':![],'unique':_0x0864('0x3')},'prefix':{'type':Sequelize[_0x0864('0x4')],'get':function(_0x4de44b){return _0x0864('0x5')+this[_0x0864('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x0864('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x0864('0x7')]}}; \ No newline at end of file +var _0x7355=['sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x2281b0,_0xa1f2f){var _0x10fcf9=function(_0x4a6f31){while(--_0x4a6f31){_0x2281b0['push'](_0x2281b0['shift']());}};_0x10fcf9(++_0xa1f2f);}(_0x7355,0x111));var _0x5735=function(_0x9e0afa,_0x482146){_0x9e0afa=_0x9e0afa-0x0;var _0x775355=_0x7355[_0x9e0afa];return _0x775355;};'use strict';var Sequelize=require(_0x5735('0x0'));module[_0x5735('0x1')]={'name':{'type':Sequelize[_0x5735('0x2')],'allowNull':![],'unique':_0x5735('0x3')},'prefix':{'type':Sequelize[_0x5735('0x4')],'get':function(_0x454ce5){return _0x5735('0x5')+this[_0x5735('0x6')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x5735('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9d1eef0..1f79734 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 _0x7916=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','rawAttributes','length','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','system-','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getTeams','Team','findAll','Agents','online','interface','flatMap','upsert','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','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','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x2dd435,_0x3605b3){var _0x3d5977=function(_0x9578f1){while(--_0x9578f1){_0x2dd435['push'](_0x2dd435['shift']());}};_0x3d5977(++_0x3605b3);}(_0x7916,0x128));var _0x6791=function(_0x99e483,_0x4dc22b){_0x99e483=_0x99e483-0x0;var _0x1612a3=_0x7916[_0x99e483];return _0x1612a3;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];config[_0x6791('0x17')]=_[_0x6791('0x18')](config[_0x6791('0x17')],{'host':_0x6791('0x19'),'port':0x18eb});var socket=require(_0x6791('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6791('0x1b')](socket);function respondWithStatusCode(_0x5122f9,_0x2a9151){_0x2a9151=_0x2a9151||0xcc;return function(_0x4c32a1){if(_0x4c32a1){return _0x5122f9[_0x6791('0x1c')](_0x2a9151);}return _0x5122f9[_0x6791('0x1d')](_0x2a9151)['end']();};}function respondWithResult(_0x3e4792,_0x4b80ed){_0x4b80ed=_0x4b80ed||0xc8;return function(_0x3856ac){if(_0x3856ac){return _0x3e4792[_0x6791('0x1d')](_0x4b80ed)['json'](_0x3856ac);}};}function respondWithFilteredResult(_0xbc35d,_0x36d7a1){return function(_0x5bec14){if(_0x5bec14){var _0x1872f5=typeof _0x36d7a1['offset']===_0x6791('0x1e')&&typeof _0x36d7a1[_0x6791('0x1f')]===_0x6791('0x1e');var _0x3a72ce=_0x5bec14[_0x6791('0x20')];var _0x2bc0ab=_0x1872f5?0x0:_0x36d7a1[_0x6791('0x21')];var _0x581d51=_0x1872f5?_0x5bec14[_0x6791('0x20')]:_0x36d7a1[_0x6791('0x21')]+_0x36d7a1['limit'];var _0x21ef16;if(_0x581d51>=_0x3a72ce){_0x581d51=_0x3a72ce;_0x21ef16=0xc8;}else{_0x21ef16=0xce;}_0xbc35d[_0x6791('0x1d')](_0x21ef16);return _0xbc35d['set'](_0x6791('0x22'),_0x2bc0ab+'-'+_0x581d51+'/'+_0x3a72ce)[_0x6791('0x23')](_0x5bec14);}return null;};}function patchUpdates(_0x15b9ab){return function(_0x12d83b){try{jsonpatch['apply'](_0x12d83b,_0x15b9ab,!![]);}catch(_0x3e17b3){return BPromise[_0x6791('0x24')](_0x3e17b3);}return _0x12d83b['save']();};}function saveUpdates(_0x53bb44,_0x4b23bc){return function(_0x372dae){if(_0x372dae){return _0x372dae['update'](_0x53bb44)[_0x6791('0x25')](function(_0x5409f1){return _0x5409f1;});}return null;};}function removeEntity(_0x54a092,_0x496273){return function(_0x5cadc){if(_0x5cadc){return _0x5cadc[_0x6791('0x26')]()[_0x6791('0x25')](function(){var _0x56a74e=_0x5cadc[_0x6791('0x27')]({'plain':!![]});var _0x30cc17='VoicePrefixes';return db[_0x6791('0x28')]['destroy']({'where':{'type':_0x30cc17,'resourceId':_0x56a74e['id']}})[_0x6791('0x25')](function(){return _0x5cadc;});})['then'](function(){_0x54a092['status'](0xcc)[_0x6791('0x29')]();});}};}function handleEntityNotFound(_0x551718,_0x2f56a2){return function(_0x34b006){if(!_0x34b006){_0x551718['sendStatus'](0x194);}return _0x34b006;};}function handleError(_0x240a9f,_0x273f79){_0x273f79=_0x273f79||0x1f4;return function(_0x234c5e){logger[_0x6791('0x2a')](_0x234c5e['stack']);if(_0x234c5e['name']){delete _0x234c5e[_0x6791('0x2b')];}_0x240a9f['status'](_0x273f79)[_0x6791('0x2c')](_0x234c5e);};}exports[_0x6791('0x2d')]=function(_0x30397e,_0x2b98b8){var _0x1d551b={},_0x127bfa={},_0x8e2101={'count':0x0,'rows':[]};var _0x14307e=_[_0x6791('0x2e')](db[_0x6791('0x2f')]['rawAttributes'],function(_0x28b3d4){return{'name':_0x28b3d4[_0x6791('0x30')],'type':_0x28b3d4[_0x6791('0x31')][_0x6791('0x32')]};});_0x127bfa[_0x6791('0x33')]=_[_0x6791('0x2e')](_0x14307e,'name');_0x127bfa['query']=_['keys'](_0x30397e[_0x6791('0x34')]);_0x127bfa[_0x6791('0x35')]=_[_0x6791('0x36')](_0x127bfa['model'],_0x127bfa['query']);_0x1d551b[_0x6791('0x37')]=_[_0x6791('0x36')](_0x127bfa[_0x6791('0x33')],qs[_0x6791('0x38')](_0x30397e['query'][_0x6791('0x38')]));_0x1d551b[_0x6791('0x37')]=_0x1d551b[_0x6791('0x37')]['length']?_0x1d551b[_0x6791('0x37')]:_0x127bfa['model'];if(!_0x30397e['query'][_0x6791('0x39')](_0x6791('0x3a'))){_0x1d551b['limit']=qs[_0x6791('0x1f')](_0x30397e[_0x6791('0x34')][_0x6791('0x1f')]);_0x1d551b[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x30397e['query'][_0x6791('0x21')]);}_0x1d551b[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x30397e['query'][_0x6791('0x3c')]);_0x1d551b[_0x6791('0x3d')]=qs[_0x6791('0x35')](_['pick'](_0x30397e[_0x6791('0x34')],_0x127bfa[_0x6791('0x35')]),_0x14307e);if(_0x30397e[_0x6791('0x34')][_0x6791('0x3e')]){_0x1d551b['where']=_[_0x6791('0x3f')](_0x1d551b[_0x6791('0x3d')],{'$or':_[_0x6791('0x2e')](_0x14307e,function(_0xd0f1c){if(_0xd0f1c[_0x6791('0x31')]!==_0x6791('0x40')){var _0x2688a9={};_0x2688a9[_0xd0f1c[_0x6791('0x2b')]]={'$like':'%'+_0x30397e[_0x6791('0x34')]['filter']+'%'};return _0x2688a9;}})});}_0x1d551b=_['merge']({},_0x1d551b,_0x30397e[_0x6791('0x41')]);var _0xe11675={'where':_0x1d551b['where']};return db[_0x6791('0x2f')][_0x6791('0x20')](_0xe11675)[_0x6791('0x25')](function(_0x3edb86){_0x8e2101[_0x6791('0x20')]=_0x3edb86;if(_0x30397e[_0x6791('0x34')][_0x6791('0x42')]){_0x1d551b['include']=[{'all':!![]}];}return db[_0x6791('0x2f')]['findAll'](_0x1d551b);})[_0x6791('0x25')](function(_0xfc170e){_0x8e2101[_0x6791('0x43')]=_0xfc170e;return _0x8e2101;})[_0x6791('0x25')](respondWithFilteredResult(_0x2b98b8,_0x1d551b))['catch'](handleError(_0x2b98b8,null));};exports[_0x6791('0x44')]=function(_0x4f0e2d,_0xeb9d45){var _0x3251e9={'raw':![],'where':{'id':_0x4f0e2d[_0x6791('0x45')]['id']}},_0x5a7fb6={};_0x5a7fb6[_0x6791('0x33')]=_[_0x6791('0x46')](db['VoicePrefix'][_0x6791('0x47')]);_0x5a7fb6[_0x6791('0x34')]=_[_0x6791('0x46')](_0x4f0e2d[_0x6791('0x34')]);_0x5a7fb6['filters']=_[_0x6791('0x36')](_0x5a7fb6[_0x6791('0x33')],_0x5a7fb6['query']);_0x3251e9[_0x6791('0x37')]=_['intersection'](_0x5a7fb6[_0x6791('0x33')],qs[_0x6791('0x38')](_0x4f0e2d[_0x6791('0x34')][_0x6791('0x38')]));_0x3251e9[_0x6791('0x37')]=_0x3251e9[_0x6791('0x37')][_0x6791('0x48')]?_0x3251e9[_0x6791('0x37')]:_0x5a7fb6[_0x6791('0x33')];if(_0x4f0e2d['query'][_0x6791('0x42')]){_0x3251e9['include']=[{'all':!![]}];}_0x3251e9=_[_0x6791('0x3f')]({},_0x3251e9,_0x4f0e2d[_0x6791('0x41')]);return db[_0x6791('0x2f')][_0x6791('0x49')](_0x3251e9)[_0x6791('0x25')](handleEntityNotFound(_0xeb9d45,null))['then'](respondWithResult(_0xeb9d45,null))[_0x6791('0x4a')](handleError(_0xeb9d45,null));};exports[_0x6791('0x26')]=function(_0x235b56,_0x3d22f3){return db[_0x6791('0x2f')]['find']({'where':{'id':_0x235b56[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x3d22f3,null))['then'](removeEntity(_0x3d22f3,null))[_0x6791('0x4a')](handleError(_0x3d22f3,null));};exports['describe']=function(_0x3d4b7e,_0x22a4d3){return db[_0x6791('0x2f')][_0x6791('0x4b')]()['then'](respondWithResult(_0x22a4d3,null))[_0x6791('0x4a')](handleError(_0x22a4d3,null));};exports[_0x6791('0x4c')]=function(_0x5655c8,_0x189b22){var _0x4370ab;return db[_0x6791('0x4d')]['transaction'](function(_0x355e97){return db[_0x6791('0x2f')]['create'](_0x5655c8[_0x6791('0x4e')],{'transaction':_0x355e97})[_0x6791('0x25')](function(_0x49d583){_0x4370ab=_0x49d583[_0x6791('0x27')]({'plain':!![]});return db[_0x6791('0x4f')][_0x6791('0x49')]({'where':{'id':_0x4370ab[_0x6791('0x50')]},'raw':!![]})['then'](function(_0x3c1076){return createVoicePrefixExtensions(_0x4370ab,_0x3c1076,_0x355e97);});});})[_0x6791('0x25')](function(){var _0x32f36b=_0x5655c8['user']['get']({'plain':!![]});if(!_0x32f36b)throw new Error(_0x6791('0x51'));if(_0x32f36b[_0x6791('0x52')]===_0x6791('0x53')){var _0x45756f=_0x4370ab;return db[_0x6791('0x54')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x32f36b[_0x6791('0x55')]},'raw':!![]})['then'](function(_0x51f071){if(_0x51f071&&_0x51f071[_0x6791('0x56')]===0x0){return db[_0x6791('0x28')][_0x6791('0x4c')]({'name':_0x45756f[_0x6791('0x2b')],'resourceId':_0x45756f['id'],'type':_0x51f071[_0x6791('0x2b')],'sectionId':_0x51f071['id']},{})[_0x6791('0x25')](function(){return _0x4370ab;});}else{return _0x4370ab;}})['catch'](function(_0x5a30f3){logger[_0x6791('0x2a')](_0x6791('0x57'),_0x5a30f3);throw _0x5a30f3;});}return _0x4370ab;})['then'](respondWithResult(_0x189b22,null))[_0x6791('0x4a')](handleError(_0x189b22,null));};function Extension(_0x535ecf,_0x473443,_0x15fb6c,_0x50cf85){this[_0x6791('0x58')]=_0x6791('0x59');this[_0x6791('0x5a')]=_0x535ecf;this['app']=_0x15fb6c;this[_0x6791('0x31')]=_0x6791('0x5b');this[_0x6791('0x5c')]=_0x6791('0x5d');this[_0x6791('0x5e')]=_0x473443;this['appdata']=_0x50cf85;}function createVoicePrefixExtensions(_0x54d0ba,_0x1a9acd,_0x13430e){return new BPromise(function(_0x5d2668,_0x329fc0){var _0x466a64=new Extension(formatPrefixName(_0x54d0ba[_0x6791('0x5f')]),0x1,_0x6791('0x60'),_0x6791('0x61'));_0x466a64[_0x6791('0x62')]=_0x54d0ba['id'];return db[_0x6791('0x4f')][_0x6791('0x4c')](_0x466a64,{'transaction':_0x13430e})['then'](function(_0x2c5f12){var _0x3b46bf=_0x2c5f12[_0x6791('0x27')]({'plain':!![]});var _0x1a9a2e=_['map'](addVoicePrefixExtensions(_0x54d0ba,_0x1a9acd),function(_0x16dff7){_0x16dff7[_0x6791('0x50')]=_0x3b46bf['id'];_0x16dff7[_0x6791('0x62')]=_0x54d0ba['id'];return _0x16dff7;});return db['VoiceExtension'][_0x6791('0x63')](_0x1a9a2e,{'transaction':_0x13430e})[_0x6791('0x25')](function(_0x99d4ee){if(!_0x99d4ee){return _0x329fc0(_0x6791('0x64'));}else{return _0x5d2668(_0x99d4ee);}})['catch'](function(_0x2c834f){return _0x329fc0(_0x2c834f);});});;});};function addVoicePrefixExtensions(_0x2843fb,_0x5522db){var _0x1114d4=[];var _0x901cc1=formatPrefixName(_0x2843fb[_0x6791('0x5f')]);_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x2,_0x6791('0x66'),_0x6791('0x67')+_0x2843fb['name']));if(_0x2843fb[_0x6791('0x68')]){_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x3,_0x6791('0x66'),'PREFIX-CALLERIDALL='+_0x2843fb[_0x6791('0x68')]));}else{_0x1114d4['push'](new Extension(_0x901cc1,0x3,_0x6791('0x60'),_0x6791('0x69')));}_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x4,_0x6791('0x6a'),_0x5522db[_0x6791('0x58')]+','+'${EXTEN:'+(0x8+_0x2843fb[_0x6791('0x2b')][_0x6791('0x48')])+'}'+','+0x1));return _0x1114d4;}function formatPrefixName(_0x375062){var _0x2accfa='_';for(var _0x5f158f=0x0;_0x5f158f<_0x375062[_0x6791('0x48')];_0x5f158f++){if(_0x375062[_0x6791('0x6b')](_0x5f158f)=='-'){_0x2accfa+=_0x375062['charAt'](_0x5f158f);}else{_0x2accfa+='['+_0x375062[_0x6791('0x6b')](_0x5f158f)+']';}}_0x2accfa+='.';return _0x2accfa;}exports[_0x6791('0x6c')]=function(_0x567302,_0x201465,_0x23b9b4){var _0x113d9f=_0x567302[_0x6791('0x4e')];_0x113d9f['prefix']=_0x6791('0x6d')+_0x113d9f[_0x6791('0x2b')]+'-';return db['sequelize'][_0x6791('0x6e')](function(_0x26c2aa){return db[_0x6791('0x2f')][_0x6791('0x6c')](_0x113d9f,{'where':{'id':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x26')]({'where':{'VoicePrefixId':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x49')]({'where':{'id':_0x113d9f[_0x6791('0x50')]},'raw':!![]})[_0x6791('0x25')](function(_0x4bbf2d){return createVoicePrefixExtensions(_0x113d9f,_0x4bbf2d,_0x26c2aa);});});});})[_0x6791('0x25')](function(){return db[_0x6791('0x2f')][_0x6791('0x6f')](_0x113d9f['id']);})[_0x6791('0x25')](respondWithResult(_0x201465,null))[_0x6791('0x4a')](handleError(_0x201465,null));};exports[_0x6791('0x70')]=function(_0x367dc9,_0x30b3e6,_0x4cca28){return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x367dc9['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x30b3e6,null))[_0x6791('0x25')](function(_0x410a66){if(_0x410a66){return _0x410a66['addAgents'](_0x367dc9[_0x6791('0x4e')]['ids'],_[_0x6791('0x71')](_0x367dc9[_0x6791('0x4e')],[_0x6791('0x72'),'id'])||{})[_0x6791('0x73')](function(_0x3a964a){for(var _0x2d15b5=0x0;_0x2d15b5<_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x6791('0x48')];_0x2d15b5+=0x1){socket[_0x6791('0x74')](_0x6791('0x75'),{'UserId':Number(_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x2d15b5]),'VoicePrefixId':Number(_0x367dc9[_0x6791('0x45')]['id'])});}return _0x3a964a;});}})[_0x6791('0x25')](respondWithResult(_0x30b3e6,null))[_0x6791('0x4a')](handleError(_0x30b3e6,null));};exports[_0x6791('0x76')]=function(_0x386bc7,_0xc6c959,_0x5cf7d7){return db['VoicePrefix']['find']({'where':{'id':_0x386bc7[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0xc6c959,null))[_0x6791('0x25')](function(_0x194a0b){if(_0x194a0b){return _0x194a0b[_0x6791('0x76')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])[_0x6791('0x25')](function(){if(_[_0x6791('0x77')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])){for(var _0x37ae6b=0x0;_0x37ae6b<_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x6791('0x48')];_0x37ae6b+=0x1){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x37ae6b]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}}else{socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6c959,null))[_0x6791('0x4a')](handleError(_0xc6c959,null));};exports['getAgents']=function(_0x8d9556,_0x11eb22,_0x4b262c){var _0x1c2864={};var _0x503041={};var _0x27e3bd;var _0x26e77c;return db['VoicePrefix'][_0x6791('0x79')]({'where':{'id':_0x8d9556[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x11eb22,null))['then'](function(_0x41fcf4){if(_0x41fcf4){_0x27e3bd=_0x41fcf4;_0x503041[_0x6791('0x33')]=_[_0x6791('0x46')](db[_0x6791('0x7a')][_0x6791('0x47')]);_0x503041[_0x6791('0x34')]=_['keys'](_0x8d9556[_0x6791('0x34')]);_0x503041[_0x6791('0x35')]=_[_0x6791('0x36')](_0x503041[_0x6791('0x33')],_0x503041[_0x6791('0x34')]);_0x1c2864[_0x6791('0x37')]=_[_0x6791('0x36')](_0x503041['model'],qs[_0x6791('0x38')](_0x8d9556['query'][_0x6791('0x38')]));_0x1c2864['attributes']=_0x1c2864[_0x6791('0x37')][_0x6791('0x48')]?_0x1c2864[_0x6791('0x37')]:_0x503041[_0x6791('0x33')];_0x1c2864[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x8d9556['query'][_0x6791('0x3c')]);_0x1c2864['where']=qs[_0x6791('0x35')](_['pick'](_0x8d9556['query'],_0x503041['filters']));if(_0x8d9556[_0x6791('0x34')][_0x6791('0x3e')]){_0x1c2864['where']=_[_0x6791('0x3f')](_0x1c2864['where'],{'$or':_[_0x6791('0x2e')](_0x1c2864[_0x6791('0x37')],function(_0x4f52c2){var _0x494435={};_0x494435[_0x4f52c2]={'$like':'%'+_0x8d9556['query'][_0x6791('0x3e')]+'%'};return _0x494435;})});}_0x1c2864=_[_0x6791('0x3f')]({},_0x1c2864,_0x8d9556[_0x6791('0x41')]);return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x20ded4){if(_0x20ded4){_0x26e77c=_0x20ded4[_0x6791('0x48')];if(!_0x8d9556[_0x6791('0x34')][_0x6791('0x39')]('nolimit')){_0x1c2864[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x8d9556[_0x6791('0x34')][_0x6791('0x1f')]);_0x1c2864[_0x6791('0x21')]=qs['offset'](_0x8d9556[_0x6791('0x34')][_0x6791('0x21')]);}return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x46aea7){if(_0x46aea7){return _0x46aea7?{'count':_0x26e77c,'rows':_0x46aea7}:null;}})[_0x6791('0x25')](respondWithResult(_0x11eb22,null))[_0x6791('0x4a')](handleError(_0x11eb22,null));};exports['getTeams']=function(_0x29e2a0,_0x1092d4,_0x370da4){var _0xdf1dd4={};var _0xa5eb83={};var _0x145814;var _0x5dcaab;return db[_0x6791('0x2f')]['findOne']({'where':{'id':_0x29e2a0['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x1092d4,null))[_0x6791('0x25')](function(_0x313d5d){if(_0x313d5d){_0x145814=_0x313d5d;_0xa5eb83['model']=_[_0x6791('0x46')](db['Team'][_0x6791('0x47')]);_0xa5eb83[_0x6791('0x34')]=_['keys'](_0x29e2a0[_0x6791('0x34')]);_0xa5eb83[_0x6791('0x35')]=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],_0xa5eb83[_0x6791('0x34')]);_0xdf1dd4['attributes']=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],qs[_0x6791('0x38')](_0x29e2a0['query']['fields']));_0xdf1dd4[_0x6791('0x37')]=_0xdf1dd4[_0x6791('0x37')]['length']?_0xdf1dd4[_0x6791('0x37')]:_0xa5eb83[_0x6791('0x33')];_0xdf1dd4[_0x6791('0x3b')]=qs['sort'](_0x29e2a0[_0x6791('0x34')]['sort']);_0xdf1dd4['where']=qs[_0x6791('0x35')](_['pick'](_0x29e2a0[_0x6791('0x34')],_0xa5eb83[_0x6791('0x35')]));if(_0x29e2a0[_0x6791('0x34')][_0x6791('0x3e')]){_0xdf1dd4[_0x6791('0x3d')]=_[_0x6791('0x3f')](_0xdf1dd4['where'],{'$or':_[_0x6791('0x2e')](_0xdf1dd4['attributes'],function(_0x221fad){var _0x4d6641={};_0x4d6641[_0x221fad]={'$like':'%'+_0x29e2a0['query'][_0x6791('0x3e')]+'%'};return _0x4d6641;})});}_0xdf1dd4=_[_0x6791('0x3f')]({},_0xdf1dd4,_0x29e2a0[_0x6791('0x41')]);return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})[_0x6791('0x25')](function(_0x11089f){if(_0x11089f){_0x5dcaab=_0x11089f[_0x6791('0x48')];if(!_0x29e2a0[_0x6791('0x34')][_0x6791('0x39')](_0x6791('0x3a'))){_0xdf1dd4[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x1f')]);_0xdf1dd4[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x21')]);}return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})['then'](function(_0xfef30e){if(_0xfef30e){return _0xfef30e?{'count':_0x5dcaab,'rows':_0xfef30e}:null;}})[_0x6791('0x25')](respondWithResult(_0x1092d4,null))[_0x6791('0x4a')](handleError(_0x1092d4,null));};exports['addTeams']=function(_0x4c6eb1,_0x4bce1d,_0x42d7fb){var _0x257efa=_0x4c6eb1['body'][_0x6791('0x72')];var _0x17c93e;return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x257efa},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id',_0x6791('0x2b'),_0x6791('0x7f'),'voicePause',_0x6791('0x80')],'raw':!![]}]})['then'](function(_0xd61243){if(_0xd61243){_0x17c93e=_0xd61243;var _0x123627=_[_0x6791('0x81')](_0xd61243,function(_0x5d5963){var _0x4d36de=_0x5d5963['get']({'plain':!![]});return _0x4d36de[_0x6791('0x7e')];});return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4c6eb1[_0x6791('0x45')]['id']}})['then'](function(_0x3b487a){return db[_0x6791('0x4d')][_0x6791('0x6e')](function(_0x3b0d8f){return _0x3b487a['addTeams'](_0x257efa,{'transaction':_0x3b0d8f})['then'](function(){return BPromise['each'](_0x17c93e,function(_0x3a7711){return db['TeamVoicePrefix'][_0x6791('0x82')]({'TeamId':_0x3a7711['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},{'transaction':_0x3b0d8f});});})[_0x6791('0x25')](function(){return BPromise[_0x6791('0x83')](_0x123627,function(_0x15a95b){return db[_0x6791('0x84')][_0x6791('0x85')]({'where':{'UserId':_0x15a95b['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},'transaction':_0x3b0d8f});});})['then'](function(){_0x123627[_0x6791('0x86')](function(_0x300c8b){socket['emit'](_0x6791('0x75'),{'UserId':_0x300c8b['id'],'VoicePrefixId':_0x3b487a['id']});});});});});}})[_0x6791('0x25')](respondWithStatusCode(_0x4bce1d,null))[_0x6791('0x4a')](handleError(_0x4bce1d,null));};exports[_0x6791('0x87')]=function(_0x4f88e4,_0x447ea6,_0x31a2c8){return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x6791('0x25')](handleEntityNotFound(_0x447ea6,null))['then'](function(_0x150a13){var _0x211721=_[_0x6791('0x2e')](_0x150a13,'id');var _0xb7986d=[];var _0x19cb72=[];var _0x5aad37=squel['select']();_0x5aad37[_0x6791('0x88')](_0x6791('0x89'))['from'](_0x6791('0x8a'),'tq')[_0x6791('0x8b')](_0x6791('0x8c'),'ut',_0x6791('0x8d'))[_0x6791('0x3d')](_0x6791('0x8e'),_0x4f88e4[_0x6791('0x45')]['id']);for(var _0x21a12c=0x0;_0x21a12c<_0x150a13[_0x6791('0x48')];_0x21a12c+=0x1){let _0x54a34f=_0x150a13[_0x21a12c];for(var _0x405e1c=0x0;_0x405e1c<_0x54a34f[_0x6791('0x7e')]['length'];_0x405e1c+=0x1){let _0x303ba8=_0x54a34f['Agents'][_0x405e1c];var _0x23bed3=_0x5aad37[_0x6791('0x8f')]();_0x23bed3[_0x6791('0x3d')](_0x6791('0x90'),_0x303ba8['id']);_0x19cb72[_0x6791('0x65')](db[_0x6791('0x4d')][_0x6791('0x34')](_0x23bed3[_0x6791('0x91')](),{'type':db[_0x6791('0x4d')][_0x6791('0x92')][_0x6791('0x93')]})[_0x6791('0x25')](function(_0x1f06d8){if(_0x1f06d8[_0x6791('0x48')]===0x1){return _0x303ba8['id'];}else{var _0x46d6ff=_[_0x6791('0x94')](_[_0x6791('0x2e')](_0x1f06d8,_0x6791('0x95')),function(_0x462e03){return _['includes'](_0x211721,_0x462e03);});if(_0x46d6ff){return _0x303ba8['id'];}}}));}}return BPromise[_0x6791('0x96')](_0x19cb72)['then'](function(_0x41385c){_0xb7986d=_(_0xb7986d)[_0x6791('0x97')](_0x41385c)[_0x6791('0x98')]()[_0x6791('0x99')]();return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4f88e4[_0x6791('0x45')]['id']}})[_0x6791('0x25')](function(_0x546bf7){return db[_0x6791('0x4d')]['transaction'](function(_0x54cf28){return _0x546bf7[_0x6791('0x87')](_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')],{'transaction':_0x54cf28})[_0x6791('0x25')](function(){if(!_[_0x6791('0x9a')](_0xb7986d)){return _0x546bf7[_0x6791('0x76')](_0xb7986d,{'transaction':_0x54cf28});}})[_0x6791('0x25')](function(){_0xb7986d['forEach'](function(_0x3b7b0f){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':_0x3b7b0f,'VoicePrefixId':_0x546bf7['id']});});});});});});})[_0x6791('0x25')](respondWithStatusCode(_0x447ea6,null))[_0x6791('0x4a')](handleError(_0x447ea6,null));}; \ No newline at end of file +var _0x896e=['userVoicePrefix:save','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','isEmpty','forEach','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','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','VoicePrefix','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','destroy','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','params','addAgents','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','order','hasOwnProperty','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate'];(function(_0x1188a8,_0x465268){var _0x3cf68b=function(_0x2c1011){while(--_0x2c1011){_0x1188a8['push'](_0x1188a8['shift']());}};_0x3cf68b(++_0x465268);}(_0x896e,0x1e9));var _0xe896=function(_0xaf045a,_0x43f0bc){_0xaf045a=_0xaf045a-0x0;var _0x165726=_0x896e[_0xaf045a];return _0x165726;};'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'];config[_0xe896('0x1a')]=_['defaults'](config[_0xe896('0x1a')],{'host':_0xe896('0x1b'),'port':0x18eb});var socket=require(_0xe896('0x1c'))(new Redis(config['redis']));require(_0xe896('0x1d'))[_0xe896('0x1e')](socket);function respondWithStatusCode(_0x1e7ef8,_0x564758){_0x564758=_0x564758||0xcc;return function(_0x5a7957){if(_0x5a7957){return _0x1e7ef8[_0xe896('0x1f')](_0x564758);}return _0x1e7ef8[_0xe896('0x20')](_0x564758)['end']();};}function respondWithResult(_0x5e78d6,_0x11f41c){_0x11f41c=_0x11f41c||0xc8;return function(_0x16e272){if(_0x16e272){return _0x5e78d6['status'](_0x11f41c)[_0xe896('0x21')](_0x16e272);}};}function respondWithFilteredResult(_0x4e062a,_0x41cbd7){return function(_0x32f86d){if(_0x32f86d){var _0x2d4cf0=typeof _0x41cbd7['offset']===_0xe896('0x22')&&typeof _0x41cbd7[_0xe896('0x23')]===_0xe896('0x22');var _0xbebbe1=_0x32f86d[_0xe896('0x24')];var _0x3ac8b8=_0x2d4cf0?0x0:_0x41cbd7[_0xe896('0x25')];var _0x32d3d3=_0x2d4cf0?_0x32f86d['count']:_0x41cbd7[_0xe896('0x25')]+_0x41cbd7['limit'];var _0x5d2c8d;if(_0x32d3d3>=_0xbebbe1){_0x32d3d3=_0xbebbe1;_0x5d2c8d=0xc8;}else{_0x5d2c8d=0xce;}_0x4e062a[_0xe896('0x20')](_0x5d2c8d);return _0x4e062a[_0xe896('0x26')](_0xe896('0x27'),_0x3ac8b8+'-'+_0x32d3d3+'/'+_0xbebbe1)[_0xe896('0x21')](_0x32f86d);}return null;};}function patchUpdates(_0x498469){return function(_0x468479){try{jsonpatch['apply'](_0x468479,_0x498469,!![]);}catch(_0x5001f7){return BPromise[_0xe896('0x28')](_0x5001f7);}return _0x468479[_0xe896('0x29')]();};}function saveUpdates(_0x1e952a,_0x2e2c10){return function(_0x20e295){if(_0x20e295){return _0x20e295[_0xe896('0x2a')](_0x1e952a)[_0xe896('0x2b')](function(_0x4b71cc){return _0x4b71cc;});}return null;};}function removeEntity(_0x390128,_0x163a75){return function(_0xc3cd05){if(_0xc3cd05){return _0xc3cd05['destroy']()[_0xe896('0x2b')](function(){var _0xd50fe2=_0xc3cd05[_0xe896('0x2c')]({'plain':!![]});var _0xe93aa0=_0xe896('0x2d');return db[_0xe896('0x2e')]['destroy']({'where':{'type':_0xe93aa0,'resourceId':_0xd50fe2['id']}})[_0xe896('0x2b')](function(){return _0xc3cd05;});})[_0xe896('0x2b')](function(){_0x390128[_0xe896('0x20')](0xcc)[_0xe896('0x2f')]();});}};}function handleEntityNotFound(_0xace03f,_0x5e0d9b){return function(_0x47c268){if(!_0x47c268){_0xace03f['sendStatus'](0x194);}return _0x47c268;};}function handleError(_0x504d7c,_0x562ddd){_0x562ddd=_0x562ddd||0x1f4;return function(_0x291290){logger[_0xe896('0x30')](_0x291290[_0xe896('0x31')]);if(_0x291290[_0xe896('0x32')]){delete _0x291290[_0xe896('0x32')];}_0x504d7c[_0xe896('0x20')](_0x562ddd)[_0xe896('0x33')](_0x291290);};}exports[_0xe896('0x34')]=function(_0x4ab96b,_0x4ce052){var _0x142d29={},_0x255dd1={},_0x29be89={'count':0x0,'rows':[]};var _0x76c0c3=_['map'](db[_0xe896('0x35')]['rawAttributes'],function(_0x57c6e8){return{'name':_0x57c6e8[_0xe896('0x36')],'type':_0x57c6e8[_0xe896('0x37')][_0xe896('0x38')]};});_0x255dd1['model']=_['map'](_0x76c0c3,'name');_0x255dd1[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x4ab96b[_0xe896('0x39')]);_0x255dd1[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x255dd1['model'],_0x255dd1[_0xe896('0x39')]);_0x142d29[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x255dd1[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x3f')]));_0x142d29[_0xe896('0x3d')]=_0x142d29['attributes'][_0xe896('0x40')]?_0x142d29[_0xe896('0x3d')]:_0x255dd1['model'];if(!_0x4ab96b[_0xe896('0x39')]['hasOwnProperty'](_0xe896('0x41'))){_0x142d29['limit']=qs[_0xe896('0x23')](_0x4ab96b['query'][_0xe896('0x23')]);_0x142d29[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x25')]);}_0x142d29['order']=qs['sort'](_0x4ab96b[_0xe896('0x39')][_0xe896('0x42')]);_0x142d29[_0xe896('0x43')]=qs[_0xe896('0x3b')](_[_0xe896('0x44')](_0x4ab96b['query'],_0x255dd1['filters']),_0x76c0c3);if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]){_0x142d29['where']=_['merge'](_0x142d29[_0xe896('0x43')],{'$or':_[_0xe896('0x46')](_0x76c0c3,function(_0x911adb){if(_0x911adb[_0xe896('0x37')]!==_0xe896('0x47')){var _0x41fa6f={};_0x41fa6f[_0x911adb[_0xe896('0x32')]]={'$like':'%'+_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x41fa6f;}})});}_0x142d29=_[_0xe896('0x48')]({},_0x142d29,_0x4ab96b[_0xe896('0x49')]);var _0x1bc76a={'where':_0x142d29['where']};return db[_0xe896('0x35')][_0xe896('0x24')](_0x1bc76a)['then'](function(_0x57366b){_0x29be89['count']=_0x57366b;if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x4a')]){_0x142d29[_0xe896('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xe896('0x4c')](_0x142d29);})[_0xe896('0x2b')](function(_0x55a8ba){_0x29be89['rows']=_0x55a8ba;return _0x29be89;})['then'](respondWithFilteredResult(_0x4ce052,_0x142d29))[_0xe896('0x4d')](handleError(_0x4ce052,null));};exports[_0xe896('0x4e')]=function(_0x16927a,_0x402aef){var _0x4452aa={'raw':![],'where':{'id':_0x16927a['params']['id']}},_0x2ae833={};_0x2ae833[_0xe896('0x3e')]=_[_0xe896('0x3a')](db['VoicePrefix'][_0xe896('0x4f')]);_0x2ae833[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x16927a[_0xe896('0x39')]);_0x2ae833['filters']=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],_0x2ae833[_0xe896('0x39')]);_0x4452aa[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],qs['fields'](_0x16927a[_0xe896('0x39')]['fields']));_0x4452aa[_0xe896('0x3d')]=_0x4452aa[_0xe896('0x3d')][_0xe896('0x40')]?_0x4452aa[_0xe896('0x3d')]:_0x2ae833[_0xe896('0x3e')];if(_0x16927a[_0xe896('0x39')]['includeAll']){_0x4452aa[_0xe896('0x4b')]=[{'all':!![]}];}_0x4452aa=_[_0xe896('0x48')]({},_0x4452aa,_0x16927a['options']);return db[_0xe896('0x35')][_0xe896('0x50')](_0x4452aa)['then'](handleEntityNotFound(_0x402aef,null))[_0xe896('0x2b')](respondWithResult(_0x402aef,null))['catch'](handleError(_0x402aef,null));};exports[_0xe896('0x51')]=function(_0xb90690,_0x3fd073){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0xb90690['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3fd073,null))[_0xe896('0x2b')](removeEntity(_0x3fd073,null))[_0xe896('0x4d')](handleError(_0x3fd073,null));};exports['describe']=function(_0x2ceae5,_0x5d205b){return db['VoicePrefix'][_0xe896('0x52')]()[_0xe896('0x2b')](respondWithResult(_0x5d205b,null))['catch'](handleError(_0x5d205b,null));};exports[_0xe896('0x53')]=function(_0x3d137b,_0x5bfd1e){var _0x58497a;return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x5b8719){return db[_0xe896('0x35')][_0xe896('0x53')](_0x3d137b[_0xe896('0x56')],{'transaction':_0x5b8719})[_0xe896('0x2b')](function(_0x16d1c8){_0x58497a=_0x16d1c8[_0xe896('0x2c')]({'plain':!![]});return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x58497a[_0xe896('0x58')]},'raw':!![]})[_0xe896('0x2b')](function(_0x357302){return createVoicePrefixExtensions(_0x58497a,_0x357302,_0x5b8719);});});})['then'](function(){var _0x1d7e31=_0x3d137b[_0xe896('0x59')][_0xe896('0x2c')]({'plain':!![]});if(!_0x1d7e31)throw new Error(_0xe896('0x5a'));if(_0x1d7e31[_0xe896('0x5b')]===_0xe896('0x59')){var _0x157946=_0x58497a;return db[_0xe896('0x5c')][_0xe896('0x50')]({'where':{'name':_0xe896('0x2d'),'userProfileId':_0x1d7e31[_0xe896('0x5d')]},'raw':!![]})[_0xe896('0x2b')](function(_0x5d8265){if(_0x5d8265&&_0x5d8265[_0xe896('0x5e')]===0x0){return db[_0xe896('0x2e')][_0xe896('0x53')]({'name':_0x157946['name'],'resourceId':_0x157946['id'],'type':_0x5d8265['name'],'sectionId':_0x5d8265['id']},{})['then'](function(){return _0x58497a;});}else{return _0x58497a;}})[_0xe896('0x4d')](function(_0x29aa11){logger[_0xe896('0x30')](_0xe896('0x5f'),_0x29aa11);throw _0x29aa11;});}return _0x58497a;})['then'](respondWithResult(_0x5bfd1e,null))[_0xe896('0x4d')](handleError(_0x5bfd1e,null));};function Extension(_0x28396c,_0x57ed84,_0x3c893a,_0x5d6c1c){this[_0xe896('0x60')]=_0xe896('0x61');this['exten']=_0x28396c;this[_0xe896('0x62')]=_0x3c893a;this[_0xe896('0x37')]='system';this['description']=_0xe896('0x63');this[_0xe896('0x64')]=_0x57ed84;this[_0xe896('0x65')]=_0x5d6c1c;}function createVoicePrefixExtensions(_0x11291a,_0x2a1858,_0x4e4092){return new BPromise(function(_0xdadb92,_0x3c82d1){var _0x113b00=new Extension(formatPrefixName(_0x11291a[_0xe896('0x66')]),0x1,'NoOp','Voice\x20Prefix');_0x113b00[_0xe896('0x67')]=_0x11291a['id'];return db[_0xe896('0x57')]['create'](_0x113b00,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0x4f2d6e){var _0x3ccaad=_0x4f2d6e[_0xe896('0x2c')]({'plain':!![]});var _0xce2b25=_[_0xe896('0x46')](addVoicePrefixExtensions(_0x11291a,_0x2a1858),function(_0x11b001){_0x11b001[_0xe896('0x58')]=_0x3ccaad['id'];_0x11b001[_0xe896('0x67')]=_0x11291a['id'];return _0x11b001;});return db[_0xe896('0x57')][_0xe896('0x68')](_0xce2b25,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0xcb329a){if(!_0xcb329a){return _0x3c82d1(_0xe896('0x69'));}else{return _0xdadb92(_0xcb329a);}})[_0xe896('0x4d')](function(_0x14d88e){return _0x3c82d1(_0x14d88e);});});;});};function addVoicePrefixExtensions(_0x468fd7,_0x33bd1b){var _0x404b42=[];var _0x26e75d=formatPrefixName(_0x468fd7[_0xe896('0x66')]);_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x2,_0xe896('0x6b'),_0xe896('0x6c')+_0x468fd7['name']));if(_0x468fd7['callerIdAll']){_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6b'),'PREFIX-CALLERIDALL='+_0x468fd7[_0xe896('0x6d')]));}else{_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6e'),_0xe896('0x6f')));}_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x4,_0xe896('0x70'),_0x33bd1b[_0xe896('0x60')]+','+_0xe896('0x71')+(0x8+_0x468fd7[_0xe896('0x32')][_0xe896('0x40')])+'}'+','+0x1));return _0x404b42;}function formatPrefixName(_0x1479c8){var _0x4e417a='_';for(var _0x3d299a=0x0;_0x3d299a<_0x1479c8[_0xe896('0x40')];_0x3d299a++){if(_0x1479c8['charAt'](_0x3d299a)=='-'){_0x4e417a+=_0x1479c8[_0xe896('0x72')](_0x3d299a);}else{_0x4e417a+='['+_0x1479c8['charAt'](_0x3d299a)+']';}}_0x4e417a+='.';return _0x4e417a;}exports['update']=function(_0x1f3e10,_0x1bbeeb,_0x4fd476){var _0x56223c=_0x1f3e10[_0xe896('0x56')];_0x56223c['prefix']='system-'+_0x56223c[_0xe896('0x32')]+'-';return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x539f6d){return db[_0xe896('0x35')][_0xe896('0x2a')](_0x56223c,{'where':{'id':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db['VoiceExtension'][_0xe896('0x51')]({'where':{'VoicePrefixId':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x56223c['VoiceExtensionId']},'raw':!![]})[_0xe896('0x2b')](function(_0x37d951){return createVoicePrefixExtensions(_0x56223c,_0x37d951,_0x539f6d);});});});})[_0xe896('0x2b')](function(){return db[_0xe896('0x35')]['findById'](_0x56223c['id']);})[_0xe896('0x2b')](respondWithResult(_0x1bbeeb,null))[_0xe896('0x4d')](handleError(_0x1bbeeb,null));};exports['addAgents']=function(_0x2d910b,_0x129ff2,_0x35ed8c){return db[_0xe896('0x35')]['find']({'where':{'id':_0x2d910b[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x129ff2,null))[_0xe896('0x2b')](function(_0x1ea3ea){if(_0x1ea3ea){return _0x1ea3ea[_0xe896('0x74')](_0x2d910b[_0xe896('0x56')]['ids'],_['omit'](_0x2d910b['body'],[_0xe896('0x75'),'id'])||{})[_0xe896('0x76')](function(_0x10421d){for(var _0x270121=0x0;_0x270121<_0x2d910b[_0xe896('0x56')][_0xe896('0x75')][_0xe896('0x40')];_0x270121+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x2d910b[_0xe896('0x56')]['ids'][_0x270121]),'VoicePrefixId':Number(_0x2d910b[_0xe896('0x73')]['id'])});}return _0x10421d;});}})['then'](respondWithResult(_0x129ff2,null))[_0xe896('0x4d')](handleError(_0x129ff2,null));};exports['removeAgents']=function(_0x2d2978,_0x36994f,_0x2ffb63){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x2d2978['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x36994f,null))[_0xe896('0x2b')](function(_0x690a75){if(_0x690a75){return _0x690a75[_0xe896('0x77')](_0x2d2978[_0xe896('0x39')][_0xe896('0x75')])[_0xe896('0x2b')](function(){if(_['isArray'](_0x2d2978[_0xe896('0x39')]['ids'])){for(var _0x2008a9=0x0;_0x2008a9<_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]['length'];_0x2008a9+=0x1){socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')][_0x2008a9]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}}else{socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}});}})[_0xe896('0x2b')](respondWithStatusCode(_0x36994f,null))['catch'](handleError(_0x36994f,null));};exports[_0xe896('0x7a')]=function(_0x317880,_0x3d3a1b,_0x3b0f36){var _0x48885e={};var _0x12f5f6={};var _0x129fe0;var _0x8089;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x317880[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3d3a1b,null))[_0xe896('0x2b')](function(_0x1f37e4){if(_0x1f37e4){_0x129fe0=_0x1f37e4;_0x12f5f6[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7c')]['rawAttributes']);_0x12f5f6[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x317880[_0xe896('0x39')]);_0x12f5f6['filters']=_[_0xe896('0x3c')](_0x12f5f6['model'],_0x12f5f6['query']);_0x48885e[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x12f5f6[_0xe896('0x3e')],qs['fields'](_0x317880[_0xe896('0x39')][_0xe896('0x3f')]));_0x48885e['attributes']=_0x48885e['attributes'][_0xe896('0x40')]?_0x48885e[_0xe896('0x3d')]:_0x12f5f6[_0xe896('0x3e')];_0x48885e[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x317880[_0xe896('0x39')][_0xe896('0x42')]);_0x48885e['where']=qs['filters'](_[_0xe896('0x44')](_0x317880['query'],_0x12f5f6['filters']));if(_0x317880[_0xe896('0x39')][_0xe896('0x45')]){_0x48885e[_0xe896('0x43')]=_[_0xe896('0x48')](_0x48885e['where'],{'$or':_[_0xe896('0x46')](_0x48885e[_0xe896('0x3d')],function(_0x487d67){var _0x13da47={};_0x13da47[_0x487d67]={'$like':'%'+_0x317880[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x13da47;})});}_0x48885e=_[_0xe896('0x48')]({},_0x48885e,_0x317880[_0xe896('0x49')]);return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x1c5812){if(_0x1c5812){_0x8089=_0x1c5812[_0xe896('0x40')];if(!_0x317880[_0xe896('0x39')][_0xe896('0x7e')](_0xe896('0x41'))){_0x48885e[_0xe896('0x23')]=qs['limit'](_0x317880[_0xe896('0x39')][_0xe896('0x23')]);_0x48885e[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x317880[_0xe896('0x39')][_0xe896('0x25')]);}return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x2bf6d5){if(_0x2bf6d5){return _0x2bf6d5?{'count':_0x8089,'rows':_0x2bf6d5}:null;}})[_0xe896('0x2b')](respondWithResult(_0x3d3a1b,null))['catch'](handleError(_0x3d3a1b,null));};exports['getTeams']=function(_0x41e6c4,_0x42c83c,_0x3822cd){var _0x56ee2d={};var _0x100804={};var _0x13b335;var _0x54f5e5;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x41e6c4['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x42c83c,null))[_0xe896('0x2b')](function(_0x20cfaf){if(_0x20cfaf){_0x13b335=_0x20cfaf;_0x100804[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7f')][_0xe896('0x4f')]);_0x100804[_0xe896('0x39')]=_['keys'](_0x41e6c4[_0xe896('0x39')]);_0x100804[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],_0x100804[_0xe896('0x39')]);_0x56ee2d['attributes']=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x41e6c4['query'][_0xe896('0x3f')]));_0x56ee2d[_0xe896('0x3d')]=_0x56ee2d[_0xe896('0x3d')][_0xe896('0x40')]?_0x56ee2d[_0xe896('0x3d')]:_0x100804[_0xe896('0x3e')];_0x56ee2d[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x41e6c4[_0xe896('0x39')]['sort']);_0x56ee2d[_0xe896('0x43')]=qs['filters'](_[_0xe896('0x44')](_0x41e6c4[_0xe896('0x39')],_0x100804[_0xe896('0x3b')]));if(_0x41e6c4[_0xe896('0x39')]['filter']){_0x56ee2d[_0xe896('0x43')]=_[_0xe896('0x48')](_0x56ee2d['where'],{'$or':_[_0xe896('0x46')](_0x56ee2d[_0xe896('0x3d')],function(_0x474924){var _0x498987={};_0x498987[_0x474924]={'$like':'%'+_0x41e6c4[_0xe896('0x39')]['filter']+'%'};return _0x498987;})});}_0x56ee2d=_['merge']({},_0x56ee2d,_0x41e6c4[_0xe896('0x49')]);return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0x1cf246){if(_0x1cf246){_0x54f5e5=_0x1cf246[_0xe896('0x40')];if(!_0x41e6c4['query']['hasOwnProperty']('nolimit')){_0x56ee2d['limit']=qs[_0xe896('0x23')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x23')]);_0x56ee2d[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x25')]);}return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0xd345d8){if(_0xd345d8){return _0xd345d8?{'count':_0x54f5e5,'rows':_0xd345d8}:null;}})[_0xe896('0x2b')](respondWithResult(_0x42c83c,null))[_0xe896('0x4d')](handleError(_0x42c83c,null));};exports[_0xe896('0x81')]=function(_0x5a254b,_0x4f4d26,_0x2f30a9){var _0x33fbb8=_0x5a254b['body']['ids'];var _0x419fc7;return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x33fbb8},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id','name',_0xe896('0x83'),_0xe896('0x84'),_0xe896('0x85')],'raw':!![]}]})['then'](function(_0x231dcd){if(_0x231dcd){_0x419fc7=_0x231dcd;var _0x219ef1=_[_0xe896('0x86')](_0x231dcd,function(_0xdeaa37){var _0x43676c=_0xdeaa37['get']({'plain':!![]});return _0x43676c[_0xe896('0x82')];});return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x5a254b['params']['id']}})[_0xe896('0x2b')](function(_0x5bfd3b){return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x1e1820){return _0x5bfd3b[_0xe896('0x81')](_0x33fbb8,{'transaction':_0x1e1820})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x419fc7,function(_0x4870d7){return db['TeamVoicePrefix'][_0xe896('0x88')]({'TeamId':_0x4870d7['id'],'VoicePrefixId':_0x5a254b['params']['id']},{'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x219ef1,function(_0x5ac4ad){return db[_0xe896('0x89')][_0xe896('0x8a')]({'where':{'UserId':_0x5ac4ad['id'],'VoicePrefixId':_0x5a254b['params']['id']},'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){_0x219ef1['forEach'](function(_0x326c67){socket[_0xe896('0x78')](_0xe896('0x8b'),{'UserId':_0x326c67['id'],'VoicePrefixId':_0x5bfd3b['id']});});});});});}})[_0xe896('0x2b')](respondWithStatusCode(_0x4f4d26,null))['catch'](handleError(_0x4f4d26,null));};exports[_0xe896('0x8c')]=function(_0x25b297,_0x111c0d,_0x22ac85){return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x25b297[_0xe896('0x39')][_0xe896('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id'],'raw':!![]}]})[_0xe896('0x2b')](handleEntityNotFound(_0x111c0d,null))[_0xe896('0x2b')](function(_0x23049d){var _0x39e735=_[_0xe896('0x46')](_0x23049d,'id');var _0xc0cb7c=[];var _0x16b398=[];var _0x4edeaf=squel[_0xe896('0x8d')]();_0x4edeaf[_0xe896('0x8e')]('tq.TeamId')['from'](_0xe896('0x8f'),'tq')[_0xe896('0x90')](_0xe896('0x91'),'ut',_0xe896('0x92'))[_0xe896('0x43')](_0xe896('0x93'),_0x25b297[_0xe896('0x73')]['id']);for(var _0x46a4f0=0x0;_0x46a4f0<_0x23049d['length'];_0x46a4f0+=0x1){let _0x13eb9a=_0x23049d[_0x46a4f0];for(var _0x3c70a3=0x0;_0x3c70a3<_0x13eb9a[_0xe896('0x82')][_0xe896('0x40')];_0x3c70a3+=0x1){let _0x59bea9=_0x13eb9a[_0xe896('0x82')][_0x3c70a3];var _0x54b2f0=_0x4edeaf['clone']();_0x54b2f0[_0xe896('0x43')](_0xe896('0x94'),_0x59bea9['id']);_0x16b398[_0xe896('0x6a')](db[_0xe896('0x54')][_0xe896('0x39')](_0x54b2f0[_0xe896('0x95')](),{'type':db[_0xe896('0x54')]['QueryTypes'][_0xe896('0x96')]})[_0xe896('0x2b')](function(_0x98bc8){if(_0x98bc8[_0xe896('0x40')]===0x1){return _0x59bea9['id'];}else{var _0xe78476=_[_0xe896('0x97')](_[_0xe896('0x46')](_0x98bc8,_0xe896('0x98')),function(_0x3c377e){return _['includes'](_0x39e735,_0x3c377e);});if(_0xe78476){return _0x59bea9['id'];}}}));}}return BPromise[_0xe896('0x99')](_0x16b398)[_0xe896('0x2b')](function(_0x4983ea){_0xc0cb7c=_(_0xc0cb7c)[_0xe896('0x9a')](_0x4983ea)['compact']()['value']();return db[_0xe896('0x35')]['find']({'where':{'id':_0x25b297['params']['id']}})[_0xe896('0x2b')](function(_0x1af1a2){return db[_0xe896('0x54')]['transaction'](function(_0x2b72af){return _0x1af1a2['removeTeams'](_0x25b297[_0xe896('0x39')][_0xe896('0x75')],{'transaction':_0x2b72af})['then'](function(){if(!_[_0xe896('0x9b')](_0xc0cb7c)){return _0x1af1a2[_0xe896('0x77')](_0xc0cb7c,{'transaction':_0x2b72af});}})['then'](function(){_0xc0cb7c[_0xe896('0x9c')](function(_0x5478f3){socket['emit']('userVoicePrefix:remove',{'UserId':_0x5478f3,'VoicePrefixId':_0x1af1a2['id']});});});});});});})[_0xe896('0x2b')](respondWithStatusCode(_0x111c0d,null))['catch'](handleError(_0x111c0d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3db490b..eee6f1a 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 _0xee1f=['events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x567925,_0x15662f){var _0x57a84c=function(_0x280b07){while(--_0x280b07){_0x567925['push'](_0x567925['shift']());}};_0x57a84c(++_0x15662f);}(_0xee1f,0xdc));var _0xfee1=function(_0x4d9505,_0x206070){_0x4d9505=_0x4d9505-0x0;var _0x584cbf=_0xee1f[_0x4d9505];return _0x584cbf;};'use strict';var EventEmitter=require(_0xfee1('0x0'));var VoicePrefix=require(_0xfee1('0x1'))['db'][_0xfee1('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfee1('0x3')](0x0);var events={'afterCreate':_0xfee1('0x4'),'afterUpdate':_0xfee1('0x5'),'afterDestroy':_0xfee1('0x6')};function emitEvent(_0x4bed01){return function(_0x5b30c2,_0x25412a,_0x2aaa69){VoicePrefixEvents['emit'](_0x4bed01+':'+_0x5b30c2['id'],_0x5b30c2);VoicePrefixEvents[_0xfee1('0x7')](_0x4bed01,_0x5b30c2);_0x2aaa69(null);};}for(var e in events){if(events[_0xfee1('0x8')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xfee1('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x3fe6=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x46ab02,_0x46f430){var _0x39d9a4=function(_0x6ec26a){while(--_0x6ec26a){_0x46ab02['push'](_0x46ab02['shift']());}};_0x39d9a4(++_0x46f430);}(_0x3fe6,0x167));var _0x63fe=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x3fe6[_0x3b1e3f];return _0x3b1cd3;};'use strict';var EventEmitter=require(_0x63fe('0x0'));var VoicePrefix=require(_0x63fe('0x1'))['db'][_0x63fe('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x63fe('0x3')](0x0);var events={'afterCreate':_0x63fe('0x4'),'afterUpdate':_0x63fe('0x5'),'afterDestroy':_0x63fe('0x6')};function emitEvent(_0x405b69){return function(_0x206088,_0x18f79a,_0x143117){VoicePrefixEvents[_0x63fe('0x7')](_0x405b69+':'+_0x206088['id'],_0x206088);VoicePrefixEvents[_0x63fe('0x7')](_0x405b69,_0x206088);_0x143117(null);};}for(var e in events){if(events[_0x63fe('0x8')](e)){var event=events[e];VoicePrefix[_0x63fe('0x9')](e,emitEvent(event));}}module[_0x63fe('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index f7268cc..1d00482 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 _0x200c=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util'];(function(_0x588601,_0x35bf89){var _0x384dbd=function(_0x37a22c){while(--_0x37a22c){_0x588601['push'](_0x588601['shift']());}};_0x384dbd(++_0x35bf89);}(_0x200c,0x17e));var _0xc200=function(_0x2c0401,_0x477765){_0x2c0401=_0x2c0401-0x0;var _0x24fe59=_0x200c[_0x2c0401];return _0x24fe59;};'use strict';var _=require(_0xc200('0x0'));var util=require(_0xc200('0x1'));var logger=require(_0xc200('0x2'))(_0xc200('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc200('0x4'));var fs=require('fs');var path=require(_0xc200('0x5'));var rimraf=require(_0xc200('0x6'));var config=require(_0xc200('0x7'));var attributes=require(_0xc200('0x8'));module[_0xc200('0x9')]=function(_0x141db3,_0x1cdc3c){return _0x141db3[_0xc200('0xa')](_0xc200('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda0b=['lodash','util','moment','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x576270,_0x5f4cf1){var _0x3e01be=function(_0x107ae3){while(--_0x107ae3){_0x576270['push'](_0x576270['shift']());}};_0x3e01be(++_0x5f4cf1);}(_0xda0b,0x6c));var _0xbda0=function(_0x58e54b,_0x4c4803){_0x58e54b=_0x58e54b-0x0;var _0x1ccb64=_0xda0b[_0x58e54b];return _0x1ccb64;};'use strict';var _=require(_0xbda0('0x0'));var util=require(_0xbda0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbda0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbda0('0x3'));var config=require(_0xbda0('0x4'));var attributes=require(_0xbda0('0x5'));module['exports']=function(_0x37a094,_0x448c35){return _0x37a094[_0xbda0('0x6')](_0xbda0('0x7'),attributes,{'tableName':_0xbda0('0x8'),'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 e0406f0..1268a8c 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 _0x1751=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x3357d7,_0x51c347){var _0x45c940=function(_0x31e0a5){while(--_0x31e0a5){_0x3357d7['push'](_0x3357d7['shift']());}};_0x45c940(++_0x51c347);}(_0x1751,0x76));var _0x1175=function(_0x131947,_0xa81ec5){_0x131947=_0x131947-0x0;var _0x502f95=_0x1751[_0x131947];return _0x502f95;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var moment=require(_0x1175('0x2'));var BPromise=require(_0x1175('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1175('0x4'));var db=require(_0x1175('0x5'))['db'];var utils=require(_0x1175('0x6'));var logger=require(_0x1175('0x7'))(_0x1175('0x8'));var config=require(_0x1175('0x9'));var jayson=require(_0x1175('0xa'));var client=jayson[_0x1175('0xb')][_0x1175('0xc')]({'port':0x232a});config[_0x1175('0xd')]=_[_0x1175('0xe')](config[_0x1175('0xd')],{'host':_0x1175('0xf'),'port':0x18eb});var socket=require(_0x1175('0x10'))(new Redis(config[_0x1175('0xd')]));require(_0x1175('0x11'))[_0x1175('0x12')](socket);function respondWithRpcPromise(_0xbd22d9,_0x1daa12,_0x216a2f){return new BPromise(function(_0x18f221,_0x34955e){return client[_0x1175('0x13')](_0xbd22d9,_0x216a2f)[_0x1175('0x14')](function(_0x2ddb0b){logger[_0x1175('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1daa12,'request\x20sent');logger[_0x1175('0x16')](_0x1175('0x17'),_0x1daa12,'request\x20sent',JSON[_0x1175('0x18')](_0x2ddb0b));if(_0x2ddb0b[_0x1175('0x19')]){if(_0x2ddb0b[_0x1175('0x19')]['code']===0x1f4){logger[_0x1175('0x19')](_0x1175('0x1a'),_0x1daa12,_0x2ddb0b[_0x1175('0x19')]['message']);return _0x34955e(_0x2ddb0b[_0x1175('0x19')]['message']);}logger[_0x1175('0x19')](_0x1175('0x1a'),_0x1daa12,_0x2ddb0b[_0x1175('0x19')][_0x1175('0x1b')]);return _0x18f221(_0x2ddb0b['error'][_0x1175('0x1b')]);}else{logger[_0x1175('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1daa12,'request\x20sent');_0x18f221(_0x2ddb0b[_0x1175('0x1c')][_0x1175('0x1b')]);}})[_0x1175('0x1d')](function(_0xe64550){logger[_0x1175('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x1daa12,_0xe64550);_0x34955e(_0xe64550);});});} \ No newline at end of file +var _0x896e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x551bc6,_0x1b9d1d){var _0x2a58a5=function(_0x51f1d7){while(--_0x51f1d7){_0x551bc6['push'](_0x551bc6['shift']());}};_0x2a58a5(++_0x1b9d1d);}(_0x896e,0x1e9));var _0xe896=function(_0x1bebf6,_0x4a74ca){_0x1bebf6=_0x1bebf6-0x0;var _0x23aa11=_0x896e[_0x1bebf6];return _0x23aa11;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1f6ff83..cff679b 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 _0xa62c=['./voicePrefix.events','save','remove','update','removeListener','register','length','voicePrefix:'];(function(_0x5da153,_0x1ba685){var _0x55f569=function(_0x589a05){while(--_0x589a05){_0x5da153['push'](_0x5da153['shift']());}};_0x55f569(++_0x1ba685);}(_0xa62c,0x70));var _0xca62=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0xa62c[_0x40822a];return _0x357420;};'use strict';var VoicePrefixEvents=require(_0xca62('0x0'));var events=[_0xca62('0x1'),_0xca62('0x2'),_0xca62('0x3')];function createListener(_0x27ee5c,_0x1eed11){return function(_0x11ad76){_0x1eed11['emit'](_0x27ee5c,_0x11ad76);};}function removeListener(_0x35180a,_0x3da6b7){return function(){VoicePrefixEvents[_0xca62('0x4')](_0x35180a,_0x3da6b7);};}exports[_0xca62('0x5')]=function(_0x1e51ba){for(var _0x31d267=0x0,_0x310378=events[_0xca62('0x6')];_0x31d267<_0x310378;_0x31d267++){var _0x5da9b9=events[_0x31d267];var _0x2160c4=createListener(_0xca62('0x7')+_0x5da9b9,_0x1e51ba);VoicePrefixEvents['on'](_0x5da9b9,_0x2160c4);}}; \ No newline at end of file +var _0x13f6=['./voicePrefix.events','save','removeListener','voicePrefix:'];(function(_0x27cb93,_0x2199ec){var _0x5eaab2=function(_0x276cf4){while(--_0x276cf4){_0x27cb93['push'](_0x27cb93['shift']());}};_0x5eaab2(++_0x2199ec);}(_0x13f6,0x124));var _0x613f=function(_0x1283e8,_0x373fde){_0x1283e8=_0x1283e8-0x0;var _0x479c50=_0x13f6[_0x1283e8];return _0x479c50;};'use strict';var VoicePrefixEvents=require(_0x613f('0x0'));var events=[_0x613f('0x1'),'remove','update'];function createListener(_0xd04cfd,_0x13b50a){return function(_0x12dc5a){_0x13b50a['emit'](_0xd04cfd,_0x12dc5a);};}function removeListener(_0x179f6e,_0x1e01e3){return function(){VoicePrefixEvents[_0x613f('0x2')](_0x179f6e,_0x1e01e3);};}exports['register']=function(_0x3f3525){for(var _0x2367b3=0x0,_0x5618fa=events['length'];_0x2367b3<_0x5618fa;_0x2367b3++){var _0x5a84f2=events[_0x2367b3];var _0x5c93c0=createListener(_0x613f('0x3')+_0x5a84f2,_0x3f3525);VoicePrefixEvents['on'](_0x5a84f2,_0x5c93c0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 07c9f24..5d1af15 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x426ec3,_0x5f590e){var _0x196999=function(_0x5e28a3){while(--_0x5e28a3){_0x426ec3['push'](_0x426ec3['shift']());}};_0x196999(++_0x5f590e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x8a13bc,_0x1f743c){var _0x3d1e3d=function(_0xf6c8d2){while(--_0xf6c8d2){_0x8a13bc['push'](_0x8a13bc['shift']());}};_0x3d1e3d(++_0x1f743c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 3714c21..2198e0b 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 _0xcdca=['booked','roundrobin','progressive','predictive','INTEGER','yes','once','TEXT','setDataValue','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','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','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','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)','#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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','strategy','getDataValue','type'];(function(_0x24c501,_0x2be25e){var _0x23c675=function(_0x175dea){while(--_0x175dea){_0x24c501['push'](_0x24c501['shift']());}};_0x23c675(++_0x2be25e);}(_0xcdca,0x94));var _0xacdc=function(_0x2f1109,_0xb4be16){_0x2f1109=_0x2f1109-0x0;var _0x41b849=_0xcdca[_0x2f1109];return _0x41b849;};'use strict';var Sequelize=require(_0xacdc('0x0'));module[_0xacdc('0x1')]={'name':{'type':Sequelize[_0xacdc('0x2')],'allowNull':![],'unique':_0xacdc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x5'),_0xacdc('0x6')),'allowNull':![],'defaultValue':_0xacdc('0x5')},'musiconhold':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xacdc('0x4')]('rr','ringall',_0xacdc('0x7'),_0xacdc('0x8'),_0xacdc('0x9'),_0xacdc('0xa'),_0xacdc('0xb'),_0xacdc('0xc'),_0xacdc('0xd')),'allowNull':![],'defaultValue':_0xacdc('0xe'),'set':function(_0x4bd9a3){this['setDataValue'](_0xacdc('0xf'),_0x4bd9a3?_0x4bd9a3:_0xacdc('0xa'));},'get':function(){var _0x2beee8=this[_0xacdc('0x10')](_0xacdc('0x11'));var _0x2a43c4=this['getDataValue']('dialMethod');var _0x475fa8=this['getDataValue'](_0xacdc('0xf'));if(_0x2beee8===_0xacdc('0x5')){return _0x475fa8;}if(_0x2a43c4===_0xacdc('0x12')&&_0x475fa8==='rrmemory'||_0x2a43c4===_0xacdc('0x12')&&_0x475fa8===_0xacdc('0x13')){return _0x475fa8;}if(_0x2a43c4===_0xacdc('0x14')||_0x2a43c4===_0xacdc('0x15')||_0x2a43c4==='power'){return _0x475fa8;}return null;}},'servicelevel':{'type':Sequelize[_0xacdc('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xacdc('0x16')](0xb)},'timeout':{'type':Sequelize[_0xacdc('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xacdc('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xacdc('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xacdc('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xacdc('0x17'),'no'),'defaultValue':_0xacdc('0x17')},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xacdc('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xacdc('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xacdc('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xacdc('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xacdc('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xacdc('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xacdc('0x4')]('yes','no'),'defaultValue':_0xacdc('0x17')},'announce_holdtime':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x17'),'no',_0xacdc('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xacdc('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xacdc('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xacdc('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xacdc('0x2')]},'queue_youarenext':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xacdc('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xacdc('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xacdc('0x2')]},'queue_less_than':{'type':Sequelize[_0xacdc('0x2')]},'periodic_announce':{'type':Sequelize[_0xacdc('0x19')],'set':function(_0x5a278f){this[_0xacdc('0x1a')](_0xacdc('0x1b'),_0x5a278f?_0x5a278f['join'](','):[]);},'get':function(){return this['getDataValue'](_0xacdc('0x1b'))?this[_0xacdc('0x10')]('periodic_announce')[_0xacdc('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':_0xacdc('0x17'),'set':function(_0x2b9436){this[_0xacdc('0x1a')](_0xacdc('0x1d'),_0x2b9436?_0x2b9436[_0xacdc('0x1e')](','):undefined);},'get':function(){return this[_0xacdc('0x10')](_0xacdc('0x1d'))?this[_0xacdc('0x10')](_0xacdc('0x1d'))[_0xacdc('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x23c755){this[_0xacdc('0x1a')](_0xacdc('0x1f'),_0x23c755?_0x23c755[_0xacdc('0x1e')](','):undefined);},'get':function(){return this[_0xacdc('0x10')]('leavewhenempty')?this[_0xacdc('0x10')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xacdc('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xacdc('0x2')]},'description':{'type':Sequelize[_0xacdc('0x2')]},'acw':{'type':Sequelize[_0xacdc('0x20')],'defaultValue':0x0,'set':function(_0x4d364b){this[_0xacdc('0x1a')](_0xacdc('0x21'),_0x4d364b);if(_0x4d364b){if(this[_0xacdc('0x10')]('wrapuptime')<0x2){this['setDataValue'](_0xacdc('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xacdc('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xacdc('0x23')},'dialMethod':{'type':Sequelize[_0xacdc('0x4')]('preview','progressive',_0xacdc('0x24'),_0xacdc('0x15'),'booked'),'defaultValue':_0xacdc('0x14'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xacdc('0x16')](0x4)[_0xacdc('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xacdc('0x26')},'dialLimitQueue':{'type':Sequelize[_0xacdc('0x16')](0x4)[_0xacdc('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xacdc('0x27')},'dialPowerLevel':{'type':Sequelize[_0xacdc('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xacdc('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xacdc('0x4')](_0xacdc('0x2a'),_0xacdc('0x2b')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xacdc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xacdc('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xacdc('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xacdc('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xacdc('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':_0xacdc('0x2f'),'comment':_0xacdc('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xacdc('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x31')},'dialQueueProject':{'type':Sequelize[_0xacdc('0x2')],'comment':_0xacdc('0x32')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacdc('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacdc('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'defaultValue':0x3,'comment':_0xacdc('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':_0xacdc('0x37')},'dialPrefix':{'type':Sequelize[_0xacdc('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xacdc('0x38'),_0xacdc('0x39'),_0xacdc('0x3a')),'defaultValue':_0xacdc('0x38')},'dialAMDActive':{'type':Sequelize[_0xacdc('0x20')],'defaultValue':0x0,'comment':_0xacdc('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xacdc('0x16')](0x9)[_0xacdc('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xacdc('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xacdc('0x16')](0x9)[_0xacdc('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xacdc('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xacdc('0x16')](0x9)[_0xacdc('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xacdc('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xacdc('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xacdc('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xacdc('0x16')](0x9)[_0xacdc('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xacdc('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xacdc('0x16')](0x9)[_0xacdc('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xacdc('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xacdc('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xacdc('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xacdc('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xacdc('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xacdc('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xacdc('0x20')],'defaultValue':0x0,'comment':_0xacdc('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xacdc('0x45'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xacdc('0x2')],'comment':_0xacdc('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xacdc('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xacdc('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xacdc('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xacdc('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xacdc('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacdc('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x4a')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacdc('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xacdc('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xacdc('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xacdc('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xacdc('0x16')](0x5)[_0xacdc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xacdc('0x16')],'allowNull':!![],'comment':_0xacdc('0x50')},'mandatoryDisposition':{'type':Sequelize[_0xacdc('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x450bc4){if(!_0x450bc4)this[_0xacdc('0x1a')](_0xacdc('0x51'),null);this['setDataValue'](_0xacdc('0x52'),_0x450bc4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xacdc('0x16')](0x3)[_0xacdc('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xacdc('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x9515=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','ENUM','outbound','inbound','leastrecent','fewestcalls','random','linear','wrandom','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','rrmemory','progressive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time'];(function(_0xab0515,_0x4b8ab2){var _0x443d59=function(_0xfd6c59){while(--_0xfd6c59){_0xab0515['push'](_0xab0515['shift']());}};_0x443d59(++_0x4b8ab2);}(_0x9515,0xac));var _0x5951=function(_0x103b63,_0x57e863){_0x103b63=_0x103b63-0x0;var _0x72de84=_0x9515[_0x103b63];return _0x72de84;};'use strict';var Sequelize=require('sequelize');module[_0x5951('0x0')]={'name':{'type':Sequelize[_0x5951('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5951('0x2')]('inbound',_0x5951('0x3')),'allowNull':![],'defaultValue':_0x5951('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x5951('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x5951('0x5'),_0x5951('0x6'),_0x5951('0x7'),'rrmemory',_0x5951('0x8'),_0x5951('0x9'),'rrordered'),'allowNull':![],'defaultValue':_0x5951('0xa'),'set':function(_0x4b78e0){this[_0x5951('0xb')](_0x5951('0xc'),_0x4b78e0?_0x4b78e0:'rrmemory');},'get':function(){var _0x82232d=this[_0x5951('0xd')](_0x5951('0xe'));var _0x4049aa=this[_0x5951('0xd')](_0x5951('0xf'));var _0x292f7e=this[_0x5951('0xd')](_0x5951('0xc'));if(_0x82232d===_0x5951('0x4')){return _0x292f7e;}if(_0x4049aa===_0x5951('0x10')&&_0x292f7e===_0x5951('0x11')||_0x4049aa===_0x5951('0x10')&&_0x292f7e==='roundrobin'){return _0x292f7e;}if(_0x4049aa===_0x5951('0x12')||_0x4049aa==='predictive'||_0x4049aa===_0x5951('0x13')){return _0x292f7e;}return null;}},'servicelevel':{'type':Sequelize[_0x5951('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5951('0x14')](0xb)},'timeout':{'type':Sequelize[_0x5951('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5951('0x1')]},'weight':{'type':Sequelize[_0x5951('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5951('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no'),'defaultValue':_0x5951('0x15')},'autopause':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no',_0x5951('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5951('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5951('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5951('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x5951('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5951('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x5951('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5951('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5951('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5951('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x5951('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5951('0x2')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no',_0x5951('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5951('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5951('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5951('0x1')]},'queue_youarenext':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5951('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x5951('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x5951('0x1')]},'queue_less_than':{'type':Sequelize[_0x5951('0x1')]},'periodic_announce':{'type':Sequelize[_0x5951('0x18')],'set':function(_0x353fd8){this[_0x5951('0xb')](_0x5951('0x19'),_0x353fd8?_0x353fd8[_0x5951('0x1a')](','):[]);},'get':function(){return this[_0x5951('0xd')](_0x5951('0x19'))?this[_0x5951('0xd')](_0x5951('0x19'))[_0x5951('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x5951('0x15'),'set':function(_0x9407b7){this[_0x5951('0xb')](_0x5951('0x1c'),_0x9407b7?_0x9407b7['join'](','):undefined);},'get':function(){return this[_0x5951('0xd')](_0x5951('0x1c'))?this[_0x5951('0xd')](_0x5951('0x1c'))[_0x5951('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5951('0x1')],'defaultValue':'no','set':function(_0x15cf64){this[_0x5951('0xb')]('leavewhenempty',_0x15cf64?_0x15cf64[_0x5951('0x1a')](','):undefined);},'get':function(){return this[_0x5951('0xd')](_0x5951('0x1d'))?this[_0x5951('0xd')](_0x5951('0x1d'))[_0x5951('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5951('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5951('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5951('0x1')]},'description':{'type':Sequelize[_0x5951('0x1')]},'acw':{'type':Sequelize[_0x5951('0x1e')],'defaultValue':0x0,'set':function(_0x595eb7){this[_0x5951('0xb')]('acw',_0x595eb7);if(_0x595eb7){if(this[_0x5951('0xd')](_0x5951('0x1f'))<0x2){this[_0x5951('0xb')](_0x5951('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5951('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5951('0x1e')],'defaultValue':0x0,'comment':_0x5951('0x20')},'dialMethod':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x21'),_0x5951('0x12'),'power',_0x5951('0x22'),_0x5951('0x10')),'defaultValue':'progressive','comment':_0x5951('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x5951('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x5951('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5951('0x25')},'dialPowerLevel':{'type':Sequelize[_0x5951('0x26')](0x2)[_0x5951('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5951('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x28'),_0x5951('0x29')),'defaultValue':_0x5951('0x29'),'comment':_0x5951('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5951('0x26')](0x2)[_0x5951('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5951('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x5951('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5951('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5951('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5951('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5951('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x5951('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x5951('0x1')],'comment':_0x5951('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5951('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5951('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5951('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5951('0x14')](0x5)[_0x5951('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'defaultValue':0x3,'comment':_0x5951('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5951('0x14')](0x5)[_0x5951('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5951('0x1')],'defaultValue':_0x5951('0x35')},'dialPrefix':{'type':Sequelize[_0x5951('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x36'),'never',_0x5951('0x37')),'defaultValue':_0x5951('0x36')},'dialAMDActive':{'type':Sequelize[_0x5951('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x5951('0x14')](0x9)[_0x5951('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5951('0x38')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5951('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5951('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5951('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5951('0x3a')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5951('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5951('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5951('0x14')](0x9)[_0x5951('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5951('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5951('0x14')](0x9)[_0x5951('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5951('0x14')](0x5)[_0x5951('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5951('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5951('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5951('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x5951('0x14')](0x5)[_0x5951('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5951('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x5951('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5951('0x2')](_0x5951('0x40'),_0x5951('0x41')),'defaultValue':_0x5951('0x40')},'dialQueueProject2':{'type':Sequelize[_0x5951('0x1')],'comment':_0x5951('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5951('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5951('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x5951('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5951('0x42')},'dialCutDigit':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5951('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5951('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5951('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x5951('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5951('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5951('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5951('0x48')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5951('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5951('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5951('0x14')](0x5)[_0x5951('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5951('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5951('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5951('0x1e')],'defaultValue':![],'comment':_0x5951('0x4b'),'set':function(_0x1f9dba){if(!_0x1f9dba)this['setDataValue'](_0x5951('0x4c'),null);this[_0x5951('0xb')]('mandatoryDisposition',_0x1f9dba);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5951('0x14')](0x3)[_0x5951('0x24')],'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 03f878c..93bfc08 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 _0xf96b=['each','TeamVoiceQueue','upsert','UserVoiceQueue','SIP/%s','forEach','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','UserVoiceQueueRt','isNil','format','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','COALESCE(phone,\x27\x27)','VoiceQueueId\x20=\x20?','CmHopperId','OrderBy','h.id','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','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save','update','then','get','inbound','QueueCampaigns','outbound','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','VoiceQueue','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','includeAll','VoiceQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','order','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction'];(function(_0x27f146,_0x5515bf){var _0xd45e2a=function(_0x51dce2){while(--_0x51dce2){_0x27f146['push'](_0x27f146['shift']());}};_0xd45e2a(++_0x5515bf);}(_0xf96b,0x109));var _0xbf96=function(_0x1b4c3a,_0x4f2578){_0x1b4c3a=_0x1b4c3a-0x0;var _0x1b9753=_0xf96b[_0x1b4c3a];return _0x1b9753;};'use strict';var emlformat=require(_0xbf96('0x0'));var rimraf=require(_0xbf96('0x1'));var zipdir=require(_0xbf96('0x2'));var jsonpatch=require(_0xbf96('0x3'));var rp=require(_0xbf96('0x4'));var moment=require(_0xbf96('0x5'));var BPromise=require(_0xbf96('0x6'));var Mustache=require(_0xbf96('0x7'));var util=require(_0xbf96('0x8'));var path=require(_0xbf96('0x9'));var sox=require(_0xbf96('0xa'));var csv=require(_0xbf96('0xb'));var ejs=require(_0xbf96('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf96('0xd'));var squel=require(_0xbf96('0xe'));var crypto=require(_0xbf96('0xf'));var jsforce=require(_0xbf96('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbf96('0xb'));var querystring=require(_0xbf96('0x11'));var Papa=require(_0xbf96('0x12'));var Redis=require(_0xbf96('0x13'));var authService=require(_0xbf96('0x14'));var qs=require(_0xbf96('0x15'));var as=require(_0xbf96('0x16'));var hardwareService=require(_0xbf96('0x17'));var logger=require('../../config/logger')(_0xbf96('0x18'));var utils=require(_0xbf96('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbf96('0x1a'));var db=require(_0xbf96('0x1b'))['db'];config[_0xbf96('0x1c')]=_['defaults'](config[_0xbf96('0x1c')],{'host':_0xbf96('0x1d'),'port':0x18eb});var socket=require(_0xbf96('0x1e'))(new Redis(config[_0xbf96('0x1c')]));require(_0xbf96('0x1f'))[_0xbf96('0x20')](socket);function respondWithStatusCode(_0x59c141,_0x186a1c){_0x186a1c=_0x186a1c||0xcc;return function(_0x218dfc){if(_0x218dfc){return _0x59c141[_0xbf96('0x21')](_0x186a1c);}return _0x59c141[_0xbf96('0x22')](_0x186a1c)[_0xbf96('0x23')]();};}function respondWithResult(_0xbb399b,_0x18d09c){_0x18d09c=_0x18d09c||0xc8;return function(_0x5c5a5e){if(_0x5c5a5e){return _0xbb399b[_0xbf96('0x22')](_0x18d09c)['json'](_0x5c5a5e);}};}function respondWithFilteredResult(_0x41254f,_0x1c2cdf){return function(_0x568425){if(_0x568425){var _0x1e9707=typeof _0x1c2cdf[_0xbf96('0x24')]==='undefined'&&typeof _0x1c2cdf[_0xbf96('0x25')]===_0xbf96('0x26');var _0x2bef74=_0x568425[_0xbf96('0x27')];var _0x473e3b=_0x1e9707?0x0:_0x1c2cdf[_0xbf96('0x24')];var _0x25705f=_0x1e9707?_0x568425['count']:_0x1c2cdf[_0xbf96('0x24')]+_0x1c2cdf['limit'];var _0xa44474;if(_0x25705f>=_0x2bef74){_0x25705f=_0x2bef74;_0xa44474=0xc8;}else{_0xa44474=0xce;}_0x41254f[_0xbf96('0x22')](_0xa44474);return _0x41254f[_0xbf96('0x28')]('Content-Range',_0x473e3b+'-'+_0x25705f+'/'+_0x2bef74)[_0xbf96('0x29')](_0x568425);}return null;};}function patchUpdates(_0x55025c){return function(_0xe12df8){try{jsonpatch[_0xbf96('0x2a')](_0xe12df8,_0x55025c,!![]);}catch(_0xdd84d9){return BPromise['reject'](_0xdd84d9);}return _0xe12df8[_0xbf96('0x2b')]();};}function saveUpdates(_0xf132af,_0x5f1385){return function(_0x496cef){if(_0x496cef){return _0x496cef[_0xbf96('0x2c')](_0xf132af)[_0xbf96('0x2d')](function(_0x363379){return _0x363379;});}return null;};}function removeEntity(_0x56d265,_0x527558){return function(_0x4f29e5){if(_0x4f29e5){return _0x4f29e5['destroy']()[_0xbf96('0x2d')](function(){var _0x30f345=_0x4f29e5[_0xbf96('0x2e')]({'plain':!![]});var _0x40b6fb=[{'name':'VoiceQueues','value':_0xbf96('0x2f'),'ignore':![]},{'name':_0xbf96('0x30'),'value':_0xbf96('0x31'),'ignore':![]}];var _0x9bdcb4=_(_0x40b6fb)['filter']('ignore')[_0xbf96('0x32')](_0xbf96('0x33'))[_0xbf96('0x33')]();if(_[_0xbf96('0x34')](_0x9bdcb4,_0x30f345[_0xbf96('0x35')])){return;}var _0x1bd652=_[_0xbf96('0x36')](_0x40b6fb,[_0xbf96('0x33'),_0x30f345['type']])[_0xbf96('0x37')];return db[_0xbf96('0x38')][_0xbf96('0x39')]({'where':{'type':_0x1bd652,'resourceId':_0x30f345['id']}})['then'](function(){return _0x4f29e5;});})['then'](function(){_0x56d265[_0xbf96('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf6f2a,_0x44bed8){return function(_0x41e2b3){if(!_0x41e2b3){_0xbf6f2a[_0xbf96('0x21')](0x194);}return _0x41e2b3;};}function handleError(_0x1593f0,_0x33fd67){_0x33fd67=_0x33fd67||0x1f4;return function(_0x31b934){logger[_0xbf96('0x3a')](_0x31b934[_0xbf96('0x3b')]);if(_0x31b934['name']){delete _0x31b934[_0xbf96('0x37')];}_0x1593f0['status'](_0x33fd67)[_0xbf96('0x3c')](_0x31b934);};}exports[_0xbf96('0x3d')]=function(_0x251510,_0x5952c8){var _0x13b20e={},_0x16c68e={},_0xb8cd93={'count':0x0,'rows':[]};var _0x18b592=_[_0xbf96('0x32')](db[_0xbf96('0x3e')][_0xbf96('0x3f')],function(_0x2ba103){return{'name':_0x2ba103['fieldName'],'type':_0x2ba103[_0xbf96('0x35')]['key']};});_0x16c68e[_0xbf96('0x40')]=_[_0xbf96('0x32')](_0x18b592,_0xbf96('0x37'));_0x16c68e[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x251510['query']);_0x16c68e[_0xbf96('0x43')]=_['intersection'](_0x16c68e[_0xbf96('0x40')],_0x16c68e[_0xbf96('0x41')]);_0x13b20e[_0xbf96('0x44')]=_[_0xbf96('0x45')](_0x16c68e[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0x251510['query'][_0xbf96('0x46')]));_0x13b20e['attributes']=_0x13b20e[_0xbf96('0x44')][_0xbf96('0x47')]?_0x13b20e[_0xbf96('0x44')]:_0x16c68e['model'];if(!_0x251510[_0xbf96('0x41')][_0xbf96('0x48')](_0xbf96('0x49'))){_0x13b20e['limit']=qs[_0xbf96('0x25')](_0x251510[_0xbf96('0x41')][_0xbf96('0x25')]);_0x13b20e[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0x251510[_0xbf96('0x41')][_0xbf96('0x24')]);}_0x13b20e['order']=qs[_0xbf96('0x4a')](_0x251510[_0xbf96('0x41')]['sort']);_0x13b20e[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_[_0xbf96('0x4c')](_0x251510[_0xbf96('0x41')],_0x16c68e['filters']),_0x18b592);if(_0x251510[_0xbf96('0x41')][_0xbf96('0x4d')]){_0x13b20e[_0xbf96('0x4b')]=_[_0xbf96('0x4e')](_0x13b20e[_0xbf96('0x4b')],{'$or':_[_0xbf96('0x32')](_0x18b592,function(_0x59af62){if(_0x59af62['type']!==_0xbf96('0x4f')){var _0x1c16c0={};_0x1c16c0[_0x59af62[_0xbf96('0x37')]]={'$like':'%'+_0x251510['query'][_0xbf96('0x4d')]+'%'};return _0x1c16c0;}})});}_0x13b20e=_[_0xbf96('0x4e')]({},_0x13b20e,_0x251510[_0xbf96('0x50')]);var _0x1712eb={'where':_0x13b20e[_0xbf96('0x4b')]};return db[_0xbf96('0x3e')][_0xbf96('0x27')](_0x1712eb)[_0xbf96('0x2d')](function(_0x2876c8){_0xb8cd93['count']=_0x2876c8;if(_0x251510[_0xbf96('0x41')]['includeAll']){_0x13b20e['include']=[{'all':!![]}];}return db[_0xbf96('0x3e')]['findAll'](_0x13b20e);})[_0xbf96('0x2d')](function(_0x5b8d10){_0xb8cd93[_0xbf96('0x51')]=_0x5b8d10;return _0xb8cd93;})[_0xbf96('0x2d')](respondWithFilteredResult(_0x5952c8,_0x13b20e))[_0xbf96('0x52')](handleError(_0x5952c8,null));};exports['show']=function(_0x1e97b0,_0x2524eb){var _0x546fd9={'raw':![],'where':{'id':_0x1e97b0['params']['id']}},_0x15b1ad={};_0x15b1ad[_0xbf96('0x40')]=_[_0xbf96('0x42')](db[_0xbf96('0x3e')][_0xbf96('0x3f')]);_0x15b1ad[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x1e97b0['query']);_0x15b1ad[_0xbf96('0x43')]=_[_0xbf96('0x45')](_0x15b1ad[_0xbf96('0x40')],_0x15b1ad['query']);_0x546fd9['attributes']=_[_0xbf96('0x45')](_0x15b1ad[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0x1e97b0[_0xbf96('0x41')][_0xbf96('0x46')]));_0x546fd9['attributes']=_0x546fd9[_0xbf96('0x44')][_0xbf96('0x47')]?_0x546fd9[_0xbf96('0x44')]:_0x15b1ad[_0xbf96('0x40')];if(_0x1e97b0['query']['includeAll']){_0x546fd9[_0xbf96('0x53')]=[{'all':!![]}];}_0x546fd9=_[_0xbf96('0x4e')]({},_0x546fd9,_0x1e97b0[_0xbf96('0x50')]);return db['VoiceQueue'][_0xbf96('0x36')](_0x546fd9)['then'](handleEntityNotFound(_0x2524eb,null))['then'](respondWithResult(_0x2524eb,null))[_0xbf96('0x52')](handleError(_0x2524eb,null));};exports[_0xbf96('0x54')]=function(_0x3aeb6f,_0x3751fa){return db[_0xbf96('0x3e')]['create'](_0x3aeb6f[_0xbf96('0x55')],{})[_0xbf96('0x2d')](function(_0x421e1a){var _0x1baac6=_0x3aeb6f[_0xbf96('0x56')][_0xbf96('0x2e')]({'plain':!![]});if(!_0x1baac6)throw new Error(_0xbf96('0x57'));if(_0x1baac6[_0xbf96('0x58')]===_0xbf96('0x56')){var _0x10b574=_0x421e1a['get']({'plain':!![]});var _0x756ae=[{'name':'VoiceQueues','value':_0xbf96('0x2f')},{'name':_0xbf96('0x30'),'value':_0xbf96('0x31')}];var _0x576e21=_[_0xbf96('0x36')](_0x756ae,[_0xbf96('0x33'),_0x10b574[_0xbf96('0x35')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x576e21,'userProfileId':_0x1baac6[_0xbf96('0x59')]},'raw':!![]})[_0xbf96('0x2d')](function(_0x3c246){if(_0x3c246&&_0x3c246[_0xbf96('0x5a')]===0x0){return db[_0xbf96('0x38')][_0xbf96('0x54')]({'name':_0x10b574[_0xbf96('0x37')],'resourceId':_0x10b574['id'],'type':_0x3c246['name'],'sectionId':_0x3c246['id']},{})[_0xbf96('0x2d')](function(){return _0x421e1a;});}else{return _0x421e1a;}})[_0xbf96('0x52')](function(_0x56c5cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56c5cd);throw _0x56c5cd;});}return _0x421e1a;})[_0xbf96('0x2d')](respondWithResult(_0x3751fa,0xc9))[_0xbf96('0x52')](handleError(_0x3751fa,null));};exports['clone']=function(_0x5e6a5c,_0x6aed71){var _0x57c323={'where':{'id':_0x5e6a5c[_0xbf96('0x5b')]['id']}},_0xebedb0={};_0xebedb0['model']=_[_0xbf96('0x42')](db[_0xbf96('0x3e')][_0xbf96('0x3f')]);_0x57c323[_0xbf96('0x44')]=_[_0xbf96('0x45')](_0xebedb0[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0x5e6a5c[_0xbf96('0x41')][_0xbf96('0x46')]));_0x57c323[_0xbf96('0x44')]=_0x57c323[_0xbf96('0x44')][_0xbf96('0x47')]?_0x57c323[_0xbf96('0x44')]:_0xebedb0['model'];if(_0x5e6a5c['query']['includeAll']){_0x57c323['include']=[{'all':!![]}];}_0x57c323=_['merge']({},_0x57c323,_0x5e6a5c[_0xbf96('0x50')]);return db[_0xbf96('0x3e')][_0xbf96('0x36')](_0x57c323)[_0xbf96('0x2d')](handleEntityNotFound(_0x6aed71,null))['then'](function(_0x1a3409){if(_0x1a3409){var _0x5fdc82=_0x1a3409[_0xbf96('0x2e')]({'plain':!![]});_0x5fdc82=qs[_0xbf96('0x5c')](_0x5fdc82,['id','createdAt','updatedAt']);_0x5e6a5c[_0xbf96('0x55')]=_[_0xbf96('0x5c')](_0x5e6a5c[_0xbf96('0x55')],['id',_0xbf96('0x5d'),_0xbf96('0x5e')]);return db[_0xbf96('0x3e')]['create'](_['merge'](_0x5fdc82,_0x5e6a5c[_0xbf96('0x55')]),{'include':_0x5e6a5c[_0xbf96('0x41')][_0xbf96('0x5f')]?[{'all':!![]}]:undefined})[_0xbf96('0x2d')](function(_0x364538){var _0xce7cec=_0x5e6a5c[_0xbf96('0x56')][_0xbf96('0x2e')]({'plain':!![]});if(!_0xce7cec)throw new Error(_0xbf96('0x57'));if(_0xce7cec[_0xbf96('0x58')]===_0xbf96('0x56')){var _0x8eb3fd=_0x364538[_0xbf96('0x2e')]({'plain':!![]});var _0x7a940c=[{'name':_0xbf96('0x60'),'value':_0xbf96('0x2f')},{'name':_0xbf96('0x30'),'value':'outbound'}];var _0x102915=_[_0xbf96('0x36')](_0x7a940c,[_0xbf96('0x33'),_0x8eb3fd[_0xbf96('0x35')]])['name'];return db[_0xbf96('0x61')][_0xbf96('0x36')]({'where':{'name':_0x102915,'userProfileId':_0xce7cec[_0xbf96('0x59')]},'raw':!![]})[_0xbf96('0x2d')](function(_0x515312){if(_0x515312&&_0x515312['autoAssociation']===0x0){return db['UserProfileResource'][_0xbf96('0x54')]({'name':_0x8eb3fd['name'],'resourceId':_0x8eb3fd['id'],'type':_0x515312['name'],'sectionId':_0x515312['id']},{})[_0xbf96('0x2d')](function(){return _0x364538;});}else{return _0x364538;}})['catch'](function(_0xb1d629){logger['error'](_0xbf96('0x62'),_0xb1d629);throw _0xb1d629;});}return _0x364538;});}})['then'](respondWithResult(_0x6aed71,0xc9))[_0xbf96('0x52')](handleError(_0x6aed71,null));};exports[_0xbf96('0x2c')]=function(_0x488715,_0x23cc02){if(_0x488715[_0xbf96('0x55')]['id']){delete _0x488715[_0xbf96('0x55')]['id'];}return db['VoiceQueue'][_0xbf96('0x36')]({'where':{'id':_0x488715[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x23cc02,null))[_0xbf96('0x2d')](saveUpdates(_0x488715['body'],null))[_0xbf96('0x2d')](respondWithResult(_0x23cc02,null))[_0xbf96('0x52')](handleError(_0x23cc02,null));};exports[_0xbf96('0x39')]=function(_0x1a5cd0,_0x4a620d){return db[_0xbf96('0x3e')][_0xbf96('0x36')]({'where':{'id':_0x1a5cd0['params']['id']}})['then'](handleEntityNotFound(_0x4a620d,null))['then'](removeEntity(_0x4a620d,null))[_0xbf96('0x52')](handleError(_0x4a620d,null));};exports['getHoppers']=function(_0x3f8551,_0x36469a,_0x57a42f){var _0x5071de={'raw':![],'where':{}};var _0x402b45={};var _0x4d675b={'count':0x0,'rows':[]};return db[_0xbf96('0x3e')][_0xbf96('0x63')]({'where':{'id':_0x3f8551[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x36469a,null))[_0xbf96('0x2d')](function(_0x33e8ea){if(_0x33e8ea){_0x402b45['model']=_[_0xbf96('0x42')](db[_0xbf96('0x64')][_0xbf96('0x3f')]);_0x402b45[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x3f8551[_0xbf96('0x41')]);_0x402b45[_0xbf96('0x43')]=_[_0xbf96('0x45')](_0x402b45[_0xbf96('0x40')],_0x402b45['query']);_0x5071de['attributes']=_[_0xbf96('0x45')](_0x402b45['model'],qs[_0xbf96('0x46')](_0x3f8551[_0xbf96('0x41')]['fields']));_0x5071de[_0xbf96('0x44')]=_0x5071de[_0xbf96('0x44')][_0xbf96('0x47')]?_0x5071de['attributes']:_0x402b45[_0xbf96('0x40')];if(!_0x3f8551[_0xbf96('0x41')][_0xbf96('0x48')](_0xbf96('0x49'))){_0x5071de[_0xbf96('0x25')]=qs[_0xbf96('0x25')](_0x3f8551[_0xbf96('0x41')][_0xbf96('0x25')]);_0x5071de[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0x3f8551[_0xbf96('0x41')][_0xbf96('0x24')]);}_0x5071de[_0xbf96('0x65')]=qs[_0xbf96('0x4a')](_0x3f8551[_0xbf96('0x41')][_0xbf96('0x4a')]);_0x5071de['where']=qs['filters'](_[_0xbf96('0x4c')](_0x3f8551[_0xbf96('0x41')],_0x402b45[_0xbf96('0x43')]));_0x5071de[_0xbf96('0x4b')][_0xbf96('0x66')]=_0x33e8ea['id'];if(_0x3f8551[_0xbf96('0x41')][_0xbf96('0x4d')]){_0x5071de[_0xbf96('0x4b')]=_['merge'](_0x5071de['where'],{'$or':_[_0xbf96('0x32')](_0x5071de[_0xbf96('0x44')],function(_0xb697b0){var _0x110574={};_0x110574[_0xb697b0]={'$like':'%'+_0x3f8551[_0xbf96('0x41')][_0xbf96('0x4d')]+'%'};return _0x110574;})});}_0x5071de=_[_0xbf96('0x4e')]({},_0x5071de,_0x3f8551[_0xbf96('0x50')]);return db['CmHopper'][_0xbf96('0x27')]({'where':_0x5071de[_0xbf96('0x4b')]})['then'](function(_0x23ab1d){_0x4d675b[_0xbf96('0x27')]=_0x23ab1d;if(_0x3f8551[_0xbf96('0x41')][_0xbf96('0x5f')]){_0x5071de[_0xbf96('0x53')]=[{'all':!![]}];}return db[_0xbf96('0x64')][_0xbf96('0x67')](_0x5071de);})[_0xbf96('0x2d')](function(_0x2c3e90){_0x4d675b['rows']=_0x2c3e90;return _0x4d675b;});}})[_0xbf96('0x2d')](respondWithFilteredResult(_0x36469a,_0x5071de))[_0xbf96('0x52')](handleError(_0x36469a,null));};exports[_0xbf96('0x68')]=function(_0x3a7186,_0x23a428,_0x2d4a8b){var _0x2bf6b9={'raw':!![],'where':{}};var _0x14274c={};var _0x1d21d6={'count':0x0,'rows':[]};return db[_0xbf96('0x3e')][_0xbf96('0x63')]({'where':{'id':_0x3a7186[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x23a428,null))[_0xbf96('0x2d')](function(_0x489ea6){if(_0x489ea6){_0x14274c['model']=_['keys'](db[_0xbf96('0x69')][_0xbf96('0x3f')]);_0x14274c[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x3a7186['query']);_0x14274c[_0xbf96('0x43')]=_[_0xbf96('0x45')](_0x14274c[_0xbf96('0x40')],_0x14274c['query']);_0x2bf6b9[_0xbf96('0x44')]=_[_0xbf96('0x45')](_0x14274c[_0xbf96('0x40')],qs['fields'](_0x3a7186[_0xbf96('0x41')]['fields']));_0x2bf6b9[_0xbf96('0x44')]=_0x2bf6b9['attributes'][_0xbf96('0x47')]?_0x2bf6b9['attributes']:_0x14274c[_0xbf96('0x40')];if(!_0x3a7186[_0xbf96('0x41')][_0xbf96('0x48')](_0xbf96('0x49'))){_0x2bf6b9[_0xbf96('0x25')]=qs[_0xbf96('0x25')](_0x3a7186[_0xbf96('0x41')][_0xbf96('0x25')]);_0x2bf6b9['offset']=qs[_0xbf96('0x24')](_0x3a7186[_0xbf96('0x41')][_0xbf96('0x24')]);}_0x2bf6b9[_0xbf96('0x65')]=qs[_0xbf96('0x4a')](_0x3a7186[_0xbf96('0x41')]['sort']);_0x2bf6b9[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_[_0xbf96('0x4c')](_0x3a7186['query'],_0x14274c[_0xbf96('0x43')]));_0x2bf6b9[_0xbf96('0x4b')][_0xbf96('0x66')]=_0x489ea6['id'];if(_0x3a7186['query'][_0xbf96('0x4d')]){_0x2bf6b9[_0xbf96('0x4b')]=_[_0xbf96('0x4e')](_0x2bf6b9[_0xbf96('0x4b')],{'$or':_[_0xbf96('0x32')](_0x2bf6b9[_0xbf96('0x44')],function(_0x467303){var _0x560383={};_0x560383[_0x467303]={'$like':'%'+_0x3a7186[_0xbf96('0x41')][_0xbf96('0x4d')]+'%'};return _0x560383;})});}_0x2bf6b9=_['merge']({},_0x2bf6b9,_0x3a7186[_0xbf96('0x50')]);return db[_0xbf96('0x69')][_0xbf96('0x27')]({'where':_0x2bf6b9[_0xbf96('0x4b')]})[_0xbf96('0x2d')](function(_0x890113){_0x1d21d6[_0xbf96('0x27')]=_0x890113;if(_0x3a7186[_0xbf96('0x41')]['includeAll']){_0x2bf6b9[_0xbf96('0x53')]=[{'all':!![]}];}return db[_0xbf96('0x69')]['findAll'](_0x2bf6b9);})[_0xbf96('0x2d')](function(_0x2e3d67){_0x1d21d6['rows']=_0x2e3d67;return _0x1d21d6;});}})[_0xbf96('0x2d')](respondWithFilteredResult(_0x23a428,_0x2bf6b9))[_0xbf96('0x52')](handleError(_0x23a428,null));};exports[_0xbf96('0x6a')]=function(_0x22c47f,_0x2c1750,_0x29d4e7){var _0x53eced={'raw':!![],'where':{}};var _0x49daaa={};var _0x31f245={'count':0x0,'rows':[]};return db[_0xbf96('0x3e')][_0xbf96('0x63')]({'where':{'id':_0x22c47f['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x2c1750,null))['then'](function(_0x13aeb3){if(_0x13aeb3){_0x49daaa[_0xbf96('0x40')]=_[_0xbf96('0x42')](db[_0xbf96('0x6b')][_0xbf96('0x3f')]);_0x49daaa[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x22c47f[_0xbf96('0x41')]);_0x49daaa[_0xbf96('0x43')]=_[_0xbf96('0x45')](_0x49daaa[_0xbf96('0x40')],_0x49daaa['query']);_0x53eced['attributes']=_[_0xbf96('0x45')](_0x49daaa[_0xbf96('0x40')],qs['fields'](_0x22c47f['query'][_0xbf96('0x46')]));_0x53eced[_0xbf96('0x44')]=_0x53eced[_0xbf96('0x44')]['length']?_0x53eced[_0xbf96('0x44')]:_0x49daaa[_0xbf96('0x40')];if(!_0x22c47f['query'][_0xbf96('0x48')]('nolimit')){_0x53eced[_0xbf96('0x25')]=qs['limit'](_0x22c47f[_0xbf96('0x41')][_0xbf96('0x25')]);_0x53eced[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0x22c47f[_0xbf96('0x41')][_0xbf96('0x24')]);}_0x53eced[_0xbf96('0x65')]=qs['sort'](_0x22c47f[_0xbf96('0x41')][_0xbf96('0x4a')]);_0x53eced[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_[_0xbf96('0x4c')](_0x22c47f[_0xbf96('0x41')],_0x49daaa['filters']));_0x53eced[_0xbf96('0x4b')][_0xbf96('0x66')]=_0x13aeb3['id'];if(_0x22c47f[_0xbf96('0x41')][_0xbf96('0x4d')]){_0x53eced[_0xbf96('0x4b')]=_[_0xbf96('0x4e')](_0x53eced[_0xbf96('0x4b')],{'$or':_['map'](_0x53eced['attributes'],function(_0x5c515a){var _0x209c1e={};_0x209c1e[_0x5c515a]={'$like':'%'+_0x22c47f['query'][_0xbf96('0x4d')]+'%'};return _0x209c1e;})});}_0x53eced=_['merge']({},_0x53eced,_0x22c47f[_0xbf96('0x50')]);return db[_0xbf96('0x6b')][_0xbf96('0x27')]({'where':_0x53eced['where']})['then'](function(_0x6757c4){_0x31f245['count']=_0x6757c4;if(_0x22c47f[_0xbf96('0x41')][_0xbf96('0x5f')]){_0x53eced['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xbf96('0x67')](_0x53eced);})[_0xbf96('0x2d')](function(_0x7afc3c){_0x31f245['rows']=_0x7afc3c;return _0x31f245;});}})[_0xbf96('0x2d')](respondWithFilteredResult(_0x2c1750,_0x53eced))[_0xbf96('0x52')](handleError(_0x2c1750,null));};exports['getHopperBlacks']=function(_0xea78a4,_0x8710c9,_0x2a47e7){var _0x37873e={'raw':!![],'where':{}};var _0x5e2ca1={};var _0x371814={'count':0x0,'rows':[]};return db[_0xbf96('0x3e')][_0xbf96('0x63')]({'where':{'id':_0xea78a4['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x8710c9,null))[_0xbf96('0x2d')](function(_0x4c7386){if(_0x4c7386){_0x5e2ca1[_0xbf96('0x40')]=_[_0xbf96('0x42')](db[_0xbf96('0x6c')][_0xbf96('0x3f')]);_0x5e2ca1[_0xbf96('0x41')]=_['keys'](_0xea78a4[_0xbf96('0x41')]);_0x5e2ca1['filters']=_['intersection'](_0x5e2ca1[_0xbf96('0x40')],_0x5e2ca1[_0xbf96('0x41')]);_0x37873e[_0xbf96('0x44')]=_['intersection'](_0x5e2ca1[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0xea78a4['query'][_0xbf96('0x46')]));_0x37873e[_0xbf96('0x44')]=_0x37873e[_0xbf96('0x44')][_0xbf96('0x47')]?_0x37873e['attributes']:_0x5e2ca1[_0xbf96('0x40')];if(!_0xea78a4['query']['hasOwnProperty']('nolimit')){_0x37873e['limit']=qs['limit'](_0xea78a4['query'][_0xbf96('0x25')]);_0x37873e[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0xea78a4['query']['offset']);}_0x37873e[_0xbf96('0x65')]=qs['sort'](_0xea78a4['query'][_0xbf96('0x4a')]);_0x37873e[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_[_0xbf96('0x4c')](_0xea78a4['query'],_0x5e2ca1[_0xbf96('0x43')]));_0x37873e[_0xbf96('0x4b')][_0xbf96('0x66')]=_0x4c7386['id'];if(_0xea78a4['query'][_0xbf96('0x4d')]){_0x37873e[_0xbf96('0x4b')]=_[_0xbf96('0x4e')](_0x37873e[_0xbf96('0x4b')],{'$or':_[_0xbf96('0x32')](_0x37873e[_0xbf96('0x44')],function(_0x4a5e07){var _0xcf5b64={};_0xcf5b64[_0x4a5e07]={'$like':'%'+_0xea78a4[_0xbf96('0x41')][_0xbf96('0x4d')]+'%'};return _0xcf5b64;})});}_0x37873e=_[_0xbf96('0x4e')]({},_0x37873e,_0xea78a4[_0xbf96('0x50')]);return db[_0xbf96('0x6c')][_0xbf96('0x27')]({'where':_0x37873e[_0xbf96('0x4b')]})[_0xbf96('0x2d')](function(_0x263993){_0x371814[_0xbf96('0x27')]=_0x263993;if(_0xea78a4['query']['includeAll']){_0x37873e[_0xbf96('0x53')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x37873e);})[_0xbf96('0x2d')](function(_0x12f159){_0x371814[_0xbf96('0x51')]=_0x12f159;return _0x371814;});}})[_0xbf96('0x2d')](respondWithFilteredResult(_0x8710c9,_0x37873e))[_0xbf96('0x52')](handleError(_0x8710c9,null));};exports['getTeams']=function(_0x2244b1,_0x16967,_0x16dcd8){var _0x3efa89={};var _0x21e385={};var _0x4c668d;var _0x33abee;return db[_0xbf96('0x3e')]['findOne']({'where':{'id':_0x2244b1['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x16967,null))[_0xbf96('0x2d')](function(_0x3928c4){if(_0x3928c4){_0x4c668d=_0x3928c4;_0x21e385[_0xbf96('0x40')]=_[_0xbf96('0x42')](db[_0xbf96('0x6d')][_0xbf96('0x3f')]);_0x21e385['query']=_[_0xbf96('0x42')](_0x2244b1[_0xbf96('0x41')]);_0x21e385['filters']=_[_0xbf96('0x45')](_0x21e385[_0xbf96('0x40')],_0x21e385[_0xbf96('0x41')]);_0x3efa89[_0xbf96('0x44')]=_[_0xbf96('0x45')](_0x21e385[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0x2244b1['query'][_0xbf96('0x46')]));_0x3efa89[_0xbf96('0x44')]=_0x3efa89['attributes'][_0xbf96('0x47')]?_0x3efa89[_0xbf96('0x44')]:_0x21e385[_0xbf96('0x40')];_0x3efa89[_0xbf96('0x65')]=qs['sort'](_0x2244b1['query'][_0xbf96('0x4a')]);_0x3efa89[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_[_0xbf96('0x4c')](_0x2244b1['query'],_0x21e385[_0xbf96('0x43')]));if(_0x2244b1[_0xbf96('0x41')][_0xbf96('0x4d')]){_0x3efa89[_0xbf96('0x4b')]=_['merge'](_0x3efa89[_0xbf96('0x4b')],{'$or':_[_0xbf96('0x32')](_0x3efa89[_0xbf96('0x44')],function(_0x3c6168){var _0x417a5b={};_0x417a5b[_0x3c6168]={'$like':'%'+_0x2244b1['query'][_0xbf96('0x4d')]+'%'};return _0x417a5b;})});}_0x3efa89=_[_0xbf96('0x4e')]({},_0x3efa89,_0x2244b1[_0xbf96('0x50')]);return _0x4c668d[_0xbf96('0x6e')](_0x3efa89);}})['then'](function(_0x344cfe){if(_0x344cfe){_0x33abee=_0x344cfe[_0xbf96('0x47')];if(!_0x2244b1[_0xbf96('0x41')][_0xbf96('0x48')]('nolimit')){_0x3efa89['limit']=qs[_0xbf96('0x25')](_0x2244b1['query'][_0xbf96('0x25')]);_0x3efa89[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0x2244b1[_0xbf96('0x41')][_0xbf96('0x24')]);}return _0x4c668d[_0xbf96('0x6e')](_0x3efa89);}})[_0xbf96('0x2d')](function(_0x24ed8b){if(_0x24ed8b){return _0x24ed8b?{'count':_0x33abee,'rows':_0x24ed8b}:null;}})['then'](respondWithResult(_0x16967,null))[_0xbf96('0x52')](handleError(_0x16967,null));};exports['addTeams']=function(_0x2bdd2a,_0x3ce800,_0x4aebeb){var _0x4ee10b=_0x2bdd2a[_0xbf96('0x55')][_0xbf96('0x6f')];var _0x2dcdf1=_['map'](_0x4ee10b,'id');return db[_0xbf96('0x6d')][_0xbf96('0x67')]({'where':{'id':_0x2dcdf1},'attributes':['id'],'include':[{'model':db[_0xbf96('0x70')],'as':_0xbf96('0x71'),'attributes':['id',_0xbf96('0x37'),_0xbf96('0x72'),_0xbf96('0x73'),_0xbf96('0x74')],'raw':!![]}]})['then'](function(_0x1f8c72){if(_0x1f8c72){var _0x35913c=_[_0xbf96('0x75')](_0x1f8c72,function(_0x5907ff){var _0x5de97a=_0x5907ff[_0xbf96('0x2e')]({'plain':!![]});_0x5de97a[_0xbf96('0x71')]['forEach'](function(_0x1babc9){_0x1babc9[_0xbf96('0x76')]=_[_0xbf96('0x36')](_0x4ee10b,{'id':_0x5de97a['id']})[_0xbf96('0x76')];});return _0x5de97a[_0xbf96('0x71')];});return db[_0xbf96('0x3e')][_0xbf96('0x36')]({'where':{'id':_0x2bdd2a[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](function(_0x71a8e9){return db[_0xbf96('0x77')][_0xbf96('0x78')](function(_0x50d8c6){return _0x71a8e9['addTeams'](_0x2dcdf1,{'transaction':_0x50d8c6})[_0xbf96('0x2d')](function(){return BPromise[_0xbf96('0x79')](_0x4ee10b,function(_0x55b999){return db[_0xbf96('0x7a')][_0xbf96('0x7b')]({'TeamId':_0x55b999['id'],'VoiceQueueId':_0x2bdd2a['params']['id'],'penalty':_0x55b999[_0xbf96('0x76')]},{'transaction':_0x50d8c6});});})[_0xbf96('0x2d')](function(){return BPromise[_0xbf96('0x79')](_0x35913c,function(_0xb0af68){return db[_0xbf96('0x7c')]['findOrCreate']({'where':{'UserId':_0xb0af68['id'],'VoiceQueueId':_0x2bdd2a[_0xbf96('0x5b')]['id']},'defaults':{'penalty':_0xb0af68[_0xbf96('0x76')]},'transaction':_0x50d8c6});});})[_0xbf96('0x2d')](function(){return BPromise['each'](_[_0xbf96('0x4d')](_0x35913c,{'online':!![]}),function(_0x5a483f){return db['UserVoiceQueueRt'][_0xbf96('0x7b')]({'membername':_0x5a483f[_0xbf96('0x37')],'UserId':_0x5a483f['id'],'queue_name':_0x71a8e9[_0xbf96('0x37')],'VoiceQueueId':_0x71a8e9['id'],'interface':_['isNil'](_0x5a483f[_0xbf96('0x74')])?util['format'](_0xbf96('0x7d'),_0x5a483f['name']):_0x5a483f[_0xbf96('0x74')],'paused':_0x5a483f[_0xbf96('0x73')]||![],'penalty':_0x5a483f[_0xbf96('0x76')]},{'transaction':_0x50d8c6});});})[_0xbf96('0x2d')](function(){_0x35913c[_0xbf96('0x7e')](function(_0xad100f){socket[_0xbf96('0x7f')](_0xbf96('0x80'),{'UserId':_0xad100f['id'],'VoiceQueueId':_0x71a8e9['id']});});});});});}})['then'](respondWithStatusCode(_0x3ce800,null))[_0xbf96('0x52')](handleError(_0x3ce800,null));};exports['removeTeams']=function(_0x4c37d6,_0x316e06,_0xe52015){return db[_0xbf96('0x6d')][_0xbf96('0x67')]({'where':{'id':_0x4c37d6[_0xbf96('0x41')][_0xbf96('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbf96('0x71'),'attributes':['id'],'raw':!![]}]})[_0xbf96('0x2d')](handleEntityNotFound(_0x316e06,null))[_0xbf96('0x2d')](function(_0x30eedb){var _0x2c785b=_[_0xbf96('0x32')](_0x30eedb,'id');var _0x1c50f1=[];var _0x1de737=[];var _0x446d1d=squel[_0xbf96('0x82')]();_0x446d1d[_0xbf96('0x83')](_0xbf96('0x84'))[_0xbf96('0x85')](_0xbf96('0x86'),'tq')[_0xbf96('0x87')](_0xbf96('0x88'),'ut',_0xbf96('0x89'))[_0xbf96('0x4b')]('VoiceQueueId\x20=\x20?',_0x4c37d6[_0xbf96('0x5b')]['id']);for(var _0x77818=0x0;_0x77818<_0x30eedb[_0xbf96('0x47')];_0x77818+=0x1){let _0x4259b9=_0x30eedb[_0x77818];for(var _0x289e8e=0x0;_0x289e8e<_0x4259b9[_0xbf96('0x71')][_0xbf96('0x47')];_0x289e8e+=0x1){let _0x38036b=_0x4259b9[_0xbf96('0x71')][_0x289e8e];var _0x4fdbe0=_0x446d1d[_0xbf96('0x8a')]();_0x4fdbe0['where']('ut.UserId\x20=\x20?',_0x38036b['id']);_0x1de737[_0xbf96('0x8b')](db[_0xbf96('0x77')]['query'](_0x4fdbe0['toString'](),{'type':db['sequelize'][_0xbf96('0x8c')]['SELECT']})['then'](function(_0x1b6394){if(_0x1b6394['length']===0x1){return _0x38036b['id'];}else{var _0x575f88=_['every'](_[_0xbf96('0x32')](_0x1b6394,_0xbf96('0x8d')),function(_0x3ca267){return _['includes'](_0x2c785b,_0x3ca267);});if(_0x575f88){return _0x38036b['id'];}}}));}}return BPromise[_0xbf96('0x8e')](_0x1de737)[_0xbf96('0x2d')](function(_0x3f7c01){_0x1c50f1=_(_0x1c50f1)[_0xbf96('0x8f')](_0x3f7c01)[_0xbf96('0x90')]()['value']();return db['VoiceQueue'][_0xbf96('0x36')]({'where':{'id':_0x4c37d6[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](function(_0x1d1be0){return db[_0xbf96('0x77')][_0xbf96('0x78')](function(_0x39ea98){return _0x1d1be0[_0xbf96('0x91')](_0x4c37d6['query'][_0xbf96('0x81')],{'transaction':_0x39ea98})[_0xbf96('0x2d')](function(){if(!_[_0xbf96('0x92')](_0x1c50f1)){return _0x1d1be0[_0xbf96('0x93')](_0x1c50f1,{'transaction':_0x39ea98})[_0xbf96('0x2d')](function(){return db['UserVoiceQueueRt'][_0xbf96('0x39')]({'where':{'VoiceQueueId':_0x4c37d6[_0xbf96('0x5b')]['id'],'UserId':_0x1c50f1},'transaction':_0x39ea98});});}})[_0xbf96('0x2d')](function(){_0x1c50f1[_0xbf96('0x7e')](function(_0x58f432){socket[_0xbf96('0x7f')]('userVoiceQueue:remove',{'UserId':_0x58f432,'VoiceQueueId':_0x1d1be0['id']});});});});});});})[_0xbf96('0x2d')](respondWithStatusCode(_0x316e06,null))[_0xbf96('0x52')](handleError(_0x316e06,null));};exports[_0xbf96('0x94')]=function(_0x3fdfc4,_0x503ef5,_0x5338a1){var _0x3de9ea,_0x2119fc;return db['VoiceQueue'][_0xbf96('0x36')]({'where':{'id':_0x3fdfc4[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x503ef5,null))[_0xbf96('0x2d')](function(_0x3bd0b1){if(_0x3bd0b1){_0x2119fc=_0x3bd0b1;return _0x3bd0b1[_0xbf96('0x94')](_0x3fdfc4[_0xbf96('0x55')][_0xbf96('0x81')],_[_0xbf96('0x5c')](_0x3fdfc4[_0xbf96('0x55')],[_0xbf96('0x81'),'id'])||{})[_0xbf96('0x95')](function(_0x2fc6c2){for(var _0x316158=0x0;_0x316158<_0x3fdfc4[_0xbf96('0x55')]['ids'][_0xbf96('0x47')];_0x316158+=0x1){socket[_0xbf96('0x7f')](_0xbf96('0x80'),{'UserId':Number(_0x3fdfc4[_0xbf96('0x55')][_0xbf96('0x81')][_0x316158]),'VoiceQueueId':Number(_0x3fdfc4[_0xbf96('0x5b')]['id'])});}return _0x2fc6c2;});}})[_0xbf96('0x2d')](function(_0x23eeab){_0x3de9ea=_0x23eeab||[];if(_0x2119fc){return db[_0xbf96('0x70')]['findAll']({'where':{'id':_0x3fdfc4[_0xbf96('0x55')][_0xbf96('0x81')]},'attributes':['id','name',_0xbf96('0x72'),_0xbf96('0x73'),_0xbf96('0x74')],'raw':!![]});}})[_0xbf96('0x2d')](function(_0x5bb400){if(!_[_0xbf96('0x92')](_0x5bb400)){var _0x22e628=[];for(var _0x105d68=0x0;_0x105d68<_0x5bb400[_0xbf96('0x47')];_0x105d68++){if(_0x5bb400[_0x105d68][_0xbf96('0x72')]){_0x22e628[_0xbf96('0x8b')](db[_0xbf96('0x96')][_0xbf96('0x7b')]({'membername':_0x5bb400[_0x105d68][_0xbf96('0x37')],'UserId':_0x5bb400[_0x105d68]['id'],'queue_name':_0x2119fc['name'],'VoiceQueueId':_0x2119fc['id'],'interface':_[_0xbf96('0x97')](_0x5bb400[_0x105d68][_0xbf96('0x74')])?util[_0xbf96('0x98')](_0xbf96('0x7d'),_0x5bb400[_0x105d68]['name']):_0x5bb400[_0x105d68][_0xbf96('0x74')],'paused':_0x5bb400[_0x105d68][_0xbf96('0x73')]||![],'penalty':_0x3fdfc4[_0xbf96('0x55')]['penalty']||0x0}));}}return BPromise[_0xbf96('0x8e')](_0x22e628);}})[_0xbf96('0x2d')](function(){return _0x3de9ea;})[_0xbf96('0x2d')](respondWithResult(_0x503ef5,null))[_0xbf96('0x52')](handleError(_0x503ef5,null));};exports['removeAgents']=function(_0x3a8613,_0x4adade,_0x3dd6cd){return db[_0xbf96('0x3e')][_0xbf96('0x36')]({'where':{'id':_0x3a8613['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x4adade,null))[_0xbf96('0x2d')](function(_0x14a1d2){if(_0x14a1d2){return _0x14a1d2['removeAgents'](_0x3a8613[_0xbf96('0x41')][_0xbf96('0x81')])[_0xbf96('0x2d')](function(){if(_[_0xbf96('0x99')](_0x3a8613[_0xbf96('0x41')]['ids'])){for(var _0x27be61=0x0;_0x27be61<_0x3a8613[_0xbf96('0x41')][_0xbf96('0x81')][_0xbf96('0x47')];_0x27be61+=0x1){socket[_0xbf96('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x3a8613[_0xbf96('0x41')][_0xbf96('0x81')][_0x27be61]),'VoiceQueueId':Number(_0x3a8613[_0xbf96('0x5b')]['id'])});}}else{socket[_0xbf96('0x7f')](_0xbf96('0x9a'),{'UserId':Number(_0x3a8613[_0xbf96('0x41')][_0xbf96('0x81')]),'VoiceQueueId':Number(_0x3a8613['params']['id'])});}});}})[_0xbf96('0x2d')](function(_0x20f131){return db[_0xbf96('0x96')][_0xbf96('0x39')]({'where':{'VoiceQueueId':_0x3a8613['params']['id'],'UserId':_0x3a8613[_0xbf96('0x41')][_0xbf96('0x81')]}})[_0xbf96('0x2d')](function(){return _0x20f131;});})['then'](respondWithStatusCode(_0x4adade,null))['catch'](handleError(_0x4adade,null));};exports['getAgents']=function(_0x574842,_0x26ad9e,_0xad31c2){var _0xb411be={};var _0x31515e={};var _0x10518b;var _0x1f839d;return db[_0xbf96('0x3e')][_0xbf96('0x63')]({'where':{'id':_0x574842[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x26ad9e,null))[_0xbf96('0x2d')](function(_0x4e563c){if(_0x4e563c){_0x10518b=_0x4e563c;_0x31515e[_0xbf96('0x40')]=_[_0xbf96('0x42')](db['User']['rawAttributes']);_0x31515e[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x574842[_0xbf96('0x41')]);_0x31515e['filters']=_['intersection'](_0x31515e[_0xbf96('0x40')],_0x31515e[_0xbf96('0x41')]);_0xb411be[_0xbf96('0x44')]=_['intersection'](_0x31515e[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0x574842[_0xbf96('0x41')]['fields']));_0xb411be[_0xbf96('0x44')]=_0xb411be[_0xbf96('0x44')]['length']?_0xb411be[_0xbf96('0x44')]:_0x31515e['model'];_0xb411be['order']=qs[_0xbf96('0x4a')](_0x574842[_0xbf96('0x41')][_0xbf96('0x4a')]);_0xb411be[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_[_0xbf96('0x4c')](_0x574842[_0xbf96('0x41')],_0x31515e[_0xbf96('0x43')]));if(_0x574842[_0xbf96('0x41')]['filter']){_0xb411be['where']=_[_0xbf96('0x4e')](_0xb411be[_0xbf96('0x4b')],{'$or':_[_0xbf96('0x32')](_0xb411be[_0xbf96('0x44')],function(_0x18df69){var _0x44910b={};_0x44910b[_0x18df69]={'$like':'%'+_0x574842[_0xbf96('0x41')]['filter']+'%'};return _0x44910b;})});}_0xb411be=_[_0xbf96('0x4e')]({},_0xb411be,_0x574842[_0xbf96('0x50')]);return _0x10518b[_0xbf96('0x9b')](_0xb411be);}})[_0xbf96('0x2d')](function(_0x517cd4){if(_0x517cd4){_0x1f839d=_0x517cd4[_0xbf96('0x47')];if(!_0x574842[_0xbf96('0x41')][_0xbf96('0x48')](_0xbf96('0x49'))){_0xb411be[_0xbf96('0x25')]=qs['limit'](_0x574842[_0xbf96('0x41')][_0xbf96('0x25')]);_0xb411be[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0x574842[_0xbf96('0x41')][_0xbf96('0x24')]);}return _0x10518b[_0xbf96('0x9b')](_0xb411be);}})[_0xbf96('0x2d')](function(_0x124db1){if(_0x124db1){return _0x124db1?{'count':_0x1f839d,'rows':_0x124db1}:null;}})[_0xbf96('0x2d')](respondWithResult(_0x26ad9e,null))[_0xbf96('0x52')](handleError(_0x26ad9e,null));};exports[_0xbf96('0x9c')]=function(_0x6e76d0,_0x137755,_0x27ee09){var _0x3ddef5={};var _0x1b223d={};var _0x35f0df;var _0x3060b4;return db[_0xbf96('0x3e')][_0xbf96('0x63')]({'where':{'id':_0x6e76d0['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x137755,null))['then'](function(_0x8d78b2){if(_0x8d78b2){_0x35f0df=_0x8d78b2;_0x1b223d['model']=_[_0xbf96('0x42')](db[_0xbf96('0x96')][_0xbf96('0x3f')]);_0x1b223d[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x6e76d0[_0xbf96('0x41')]);_0x1b223d[_0xbf96('0x43')]=_[_0xbf96('0x45')](_0x1b223d[_0xbf96('0x40')],_0x1b223d['query']);_0x3ddef5[_0xbf96('0x44')]=_[_0xbf96('0x45')](_0x1b223d[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0x6e76d0[_0xbf96('0x41')]['fields']));_0x3ddef5[_0xbf96('0x44')]=_0x3ddef5[_0xbf96('0x44')]['length']?_0x3ddef5[_0xbf96('0x44')]:_0x1b223d[_0xbf96('0x40')];_0x3ddef5['order']=qs[_0xbf96('0x4a')](_0x6e76d0[_0xbf96('0x41')][_0xbf96('0x4a')]);_0x3ddef5[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_[_0xbf96('0x4c')](_0x6e76d0[_0xbf96('0x41')],_0x1b223d[_0xbf96('0x43')]));if(_0x6e76d0['query'][_0xbf96('0x4d')]){_0x3ddef5['where']=_[_0xbf96('0x4e')](_0x3ddef5[_0xbf96('0x4b')],{'$or':_[_0xbf96('0x32')](_0x3ddef5[_0xbf96('0x44')],function(_0xccfa50){var _0x4e910f={};_0x4e910f[_0xccfa50]={'$like':'%'+_0x6e76d0[_0xbf96('0x41')]['filter']+'%'};return _0x4e910f;})});}_0x3ddef5=_[_0xbf96('0x4e')]({},_0x3ddef5,_0x6e76d0[_0xbf96('0x50')]);return _0x35f0df[_0xbf96('0x9c')](_0x3ddef5);}})[_0xbf96('0x2d')](function(_0x5c38a0){if(_0x5c38a0){_0x3060b4=_0x5c38a0[_0xbf96('0x47')];if(!_0x6e76d0[_0xbf96('0x41')]['hasOwnProperty'](_0xbf96('0x49'))){_0x3ddef5[_0xbf96('0x25')]=qs[_0xbf96('0x25')](_0x6e76d0[_0xbf96('0x41')][_0xbf96('0x25')]);_0x3ddef5['offset']=qs[_0xbf96('0x24')](_0x6e76d0[_0xbf96('0x41')][_0xbf96('0x24')]);}return _0x35f0df[_0xbf96('0x9c')](_0x3ddef5);}})[_0xbf96('0x2d')](function(_0x2b8ac4){return _0x2b8ac4?{'count':_0x3060b4,'rows':_0x2b8ac4}:null;})[_0xbf96('0x2d')](respondWithResult(_0x137755,null))[_0xbf96('0x52')](handleError(_0x137755,null));};exports[_0xbf96('0x9d')]=function(_0x28c798,_0x42ecee,_0x148989){var _0x5bba23={};var _0x21da5f={};var _0x104e2e;var _0x5ee4b2;return db['VoiceQueue'][_0xbf96('0x63')]({'where':{'id':_0x28c798['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x42ecee,null))[_0xbf96('0x2d')](function(_0x47ef2a){if(_0x47ef2a){_0x104e2e=_0x47ef2a;_0x21da5f[_0xbf96('0x40')]=_[_0xbf96('0x42')](db[_0xbf96('0x9e')][_0xbf96('0x3f')]);_0x21da5f[_0xbf96('0x41')]=_[_0xbf96('0x42')](_0x28c798[_0xbf96('0x41')]);_0x21da5f[_0xbf96('0x43')]=_[_0xbf96('0x45')](_0x21da5f['model'],_0x21da5f[_0xbf96('0x41')]);_0x5bba23['attributes']=_[_0xbf96('0x45')](_0x21da5f[_0xbf96('0x40')],qs[_0xbf96('0x46')](_0x28c798[_0xbf96('0x41')]['fields']));_0x5bba23[_0xbf96('0x44')]=_0x5bba23['attributes']['length']?_0x5bba23[_0xbf96('0x44')]:_0x21da5f[_0xbf96('0x40')];_0x5bba23[_0xbf96('0x65')]=qs['sort'](_0x28c798[_0xbf96('0x41')][_0xbf96('0x4a')]);_0x5bba23[_0xbf96('0x4b')]=qs['filters'](_['pick'](_0x28c798[_0xbf96('0x41')],_0x21da5f['filters']));if(_0x28c798['query']['filter']){_0x5bba23[_0xbf96('0x4b')]=_[_0xbf96('0x4e')](_0x5bba23[_0xbf96('0x4b')],{'$or':_[_0xbf96('0x32')](_0x5bba23['attributes'],function(_0x31c044){var _0x43db4a={};_0x43db4a[_0x31c044]={'$like':'%'+_0x28c798['query']['filter']+'%'};return _0x43db4a;})});}_0x5bba23=_[_0xbf96('0x4e')]({},_0x5bba23,_0x28c798[_0xbf96('0x50')]);return _0x104e2e['getLists'](_0x5bba23);}})[_0xbf96('0x2d')](function(_0x59a557){if(_0x59a557){_0x5ee4b2=_0x59a557[_0xbf96('0x47')];if(!_0x28c798['query'][_0xbf96('0x48')](_0xbf96('0x49'))){_0x5bba23[_0xbf96('0x25')]=qs[_0xbf96('0x25')](_0x28c798[_0xbf96('0x41')]['limit']);_0x5bba23[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0x28c798[_0xbf96('0x41')]['offset']);}return _0x104e2e['getLists'](_0x5bba23);}})[_0xbf96('0x2d')](function(_0x184a5d){if(_0x184a5d){return _0x184a5d?{'count':_0x5ee4b2,'rows':_0x184a5d}:null;}})[_0xbf96('0x2d')](respondWithResult(_0x42ecee,null))[_0xbf96('0x52')](handleError(_0x42ecee,null));};exports[_0xbf96('0x9f')]=function(_0x5a976b,_0x1cc0cd,_0x2f16ef){var _0x3ea35e=moment()['format'](_0xbf96('0xa0'));var _0x427b30,_0x12a329;return db['VoiceQueue'][_0xbf96('0x36')]({'where':{'id':_0x5a976b['params']['id']}})['then'](handleEntityNotFound(_0x1cc0cd,null))[_0xbf96('0x2d')](function(_0x31dae5){if(_0x31dae5){_0x12a329=_0x31dae5;return _0x31dae5[_0xbf96('0x9f')](_0x5a976b[_0xbf96('0x55')][_0xbf96('0x81')],_['omit'](_0x5a976b['body'],['ids','id'])||{});}return null;})[_0xbf96('0x95')](function(_0x3a96d0){var _0x58ea38;_0x427b30=_0x3a96d0||[];var _0x2ba21a=[];if(_0x3a96d0){for(var _0x244266=0x0;_0x244266<_0x3a96d0['length'];_0x244266+=0x1){var _0x16e764=_0x3a96d0[_0x244266]['get']({'plain':!![]});_0x12a329['dialCheckDuplicateType']=_0x5a976b['body'][_0xbf96('0xa1')]?_0x5a976b[_0xbf96('0x55')]['dialCheckDuplicateType']:_0x12a329[_0xbf96('0xa1')];switch(_0x12a329[_0xbf96('0xa1')]){case'always':_0x58ea38=squel[_0xbf96('0xa2')]()[_0xbf96('0xa3')]('cm_hopper')[_0xbf96('0xa4')]([_0xbf96('0xa5'),_0xbf96('0xa6'),_0xbf96('0xa7'),_0xbf96('0xa8'),_0xbf96('0x66'),'createdAt',_0xbf96('0x5e')],squel[_0xbf96('0x82')]()['field'](_0xbf96('0xa5'),_0xbf96('0xa5'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0xa6'))[_0xbf96('0x83')]('id',_0xbf96('0xa7'))[_0xbf96('0x83')](_0x16e764[_0xbf96('0xa9')]['toString'](),_0xbf96('0xa8'))[_0xbf96('0x83')](_0x5a976b['params']['id'][_0xbf96('0xaa')](),_0xbf96('0x66'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0x5d'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0x5e'))[_0xbf96('0x85')](_0xbf96('0xab'))[_0xbf96('0x4b')](_0xbf96('0xac'))[_0xbf96('0x4b')](_0xbf96('0xad'),_0x16e764['CmListId'][_0xbf96('0xaa')]())[_0xbf96('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0xbf96('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbf96('0x82')]()['field']('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x5a976b['params']['id'][_0xbf96('0xaa')]()))[_0xbf96('0x4b')](_0xbf96('0xae'),squel[_0xbf96('0x82')]()['field']('COALESCE(phone,\x27\x27)')[_0xbf96('0x85')](_0xbf96('0xaf'))[_0xbf96('0x4b')]('VoiceQueueId\x20=\x20?',_0x5a976b[_0xbf96('0x5b')]['id'][_0xbf96('0xaa')]())))[_0xbf96('0xaa')]();break;case _0xbf96('0xb0'):_0x58ea38=squel[_0xbf96('0xa2')]()['into'](_0xbf96('0xaf'))[_0xbf96('0xa4')]([_0xbf96('0xa5'),_0xbf96('0xa6'),'ContactId','ListId','VoiceQueueId',_0xbf96('0x5d'),_0xbf96('0x5e')],squel[_0xbf96('0x82')]()['field'](_0xbf96('0xa5'),'phone')['field']('\x27'+_0x3ea35e+'\x27',_0xbf96('0xa6'))[_0xbf96('0x83')]('id',_0xbf96('0xa7'))['field'](_0x16e764[_0xbf96('0xa9')][_0xbf96('0xaa')](),_0xbf96('0xa8'))['field'](_0x5a976b[_0xbf96('0x5b')]['id']['toString'](),_0xbf96('0x66'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0x5d'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0x5e'))[_0xbf96('0x85')](_0xbf96('0xab'))[_0xbf96('0x4b')](_0xbf96('0xac'))['where'](_0xbf96('0xad'),_0x16e764[_0xbf96('0xa9')]['toString']())[_0xbf96('0x4b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xbf96('0xae'),squel['select']()['field'](_0xbf96('0xb1'))['from'](_0xbf96('0xaf'))['where'](_0xbf96('0xb2'),_0x5a976b[_0xbf96('0x5b')]['id'][_0xbf96('0xaa')]())))[_0xbf96('0xaa')]();break;default:_0x58ea38=squel['insert']()[_0xbf96('0xa3')](_0xbf96('0xaf'))[_0xbf96('0xa4')]([_0xbf96('0xa5'),_0xbf96('0xa6'),_0xbf96('0xa7'),_0xbf96('0xa8'),_0xbf96('0x66'),_0xbf96('0x5d'),_0xbf96('0x5e')],squel['select']()[_0xbf96('0x83')]('phone',_0xbf96('0xa5'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0xa6'))[_0xbf96('0x83')]('id',_0xbf96('0xa7'))[_0xbf96('0x83')](_0x16e764['CmListId'][_0xbf96('0xaa')](),_0xbf96('0xa8'))[_0xbf96('0x83')](_0x5a976b[_0xbf96('0x5b')]['id'][_0xbf96('0xaa')](),_0xbf96('0x66'))['field']('\x27'+_0x3ea35e+'\x27',_0xbf96('0x5d'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27','updatedAt')['from']('cm_contacts')[_0xbf96('0x4b')](_0xbf96('0xac'))[_0xbf96('0x4b')]('ListId\x20=\x20?',_0x16e764[_0xbf96('0xa9')][_0xbf96('0xaa')]())[_0xbf96('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0xbf96('0xaa')]();}_0x2ba21a['push'](db['sequelize'][_0xbf96('0x41')](_0x58ea38));}return BPromise['all'](_0x2ba21a);}})['then'](function(){var _0x36233d=[];var _0x5a37f4=squel[_0xbf96('0xa2')]()['into']('cm_hopper_additional_phones')[_0xbf96('0xa4')]([_0xbf96('0xb3'),_0xbf96('0xa5'),_0xbf96('0xb4'),'createdAt','updatedAt'],squel[_0xbf96('0x82')]()[_0xbf96('0x83')](_0xbf96('0xb5'))[_0xbf96('0x83')]('ci.item')[_0xbf96('0x83')]('ci.OrderBy+1')[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0x5d'))[_0xbf96('0x83')]('\x27'+_0x3ea35e+'\x27',_0xbf96('0x5e'))[_0xbf96('0x85')](_0xbf96('0xb6'),'ci')['join'](_0xbf96('0xaf'),'h',_0xbf96('0xb7'))[_0xbf96('0x4b')](_0xbf96('0xb8'),_0x3ea35e)[_0xbf96('0x4b')](_0xbf96('0xb9'),_0xbf96('0xba')))[_0xbf96('0xaa')]();_0x36233d[_0xbf96('0x8b')](db[_0xbf96('0x77')]['query'](_0x5a37f4));return BPromise[_0xbf96('0x8e')](_0x36233d);})['then'](function(){return _0x427b30;})[_0xbf96('0x2d')](respondWithResult(_0x1cc0cd,null))[_0xbf96('0x52')](handleError(_0x1cc0cd,null));};exports['removeLists']=function(_0x352d38,_0x34ef40,_0x50a1ce){return db[_0xbf96('0x3e')][_0xbf96('0x36')]({'where':{'id':_0x352d38[_0xbf96('0x5b')]['id']}})['then'](handleEntityNotFound(_0x34ef40,null))['then'](function(_0x4f99f6){if(_0x4f99f6){return _0x4f99f6[_0xbf96('0xbb')](_0x352d38['query'][_0xbf96('0x81')]);}})['then'](function(_0x2cf061){if(_0x2cf061){return db['CmHopper'][_0xbf96('0x39')]({'where':{'ListId':_0x352d38[_0xbf96('0x41')][_0xbf96('0x81')],'VoiceQueueId':_0x352d38[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](function(){return _0x2cf061;});}})[_0xbf96('0x2d')](respondWithStatusCode(_0x34ef40,null))['catch'](handleError(_0x34ef40,null));};exports[_0xbf96('0xbc')]=function(_0x320e48,_0x52dbd8,_0x2abb04){var _0x3f220e={};var _0x2a301a={};var _0x46c944;var _0x50e7b0;return db['VoiceQueue'][_0xbf96('0x63')]({'where':{'id':_0x320e48[_0xbf96('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52dbd8,null))[_0xbf96('0x2d')](function(_0x18136a){if(_0x18136a){_0x46c944=_0x18136a;_0x2a301a[_0xbf96('0x40')]=_['keys'](db['CmList'][_0xbf96('0x3f')]);_0x2a301a[_0xbf96('0x41')]=_['keys'](_0x320e48['query']);_0x2a301a[_0xbf96('0x43')]=_[_0xbf96('0x45')](_0x2a301a[_0xbf96('0x40')],_0x2a301a['query']);_0x3f220e[_0xbf96('0x44')]=_[_0xbf96('0x45')](_0x2a301a['model'],qs[_0xbf96('0x46')](_0x320e48[_0xbf96('0x41')]['fields']));_0x3f220e['attributes']=_0x3f220e[_0xbf96('0x44')][_0xbf96('0x47')]?_0x3f220e[_0xbf96('0x44')]:_0x2a301a[_0xbf96('0x40')];_0x3f220e[_0xbf96('0x65')]=qs['sort'](_0x320e48[_0xbf96('0x41')][_0xbf96('0x4a')]);_0x3f220e[_0xbf96('0x4b')]=qs[_0xbf96('0x43')](_['pick'](_0x320e48[_0xbf96('0x41')],_0x2a301a['filters']));if(_0x320e48[_0xbf96('0x41')][_0xbf96('0x4d')]){_0x3f220e[_0xbf96('0x4b')]=_[_0xbf96('0x4e')](_0x3f220e['where'],{'$or':_[_0xbf96('0x32')](_0x3f220e[_0xbf96('0x44')],function(_0x14e4ae){var _0x4c152d={};_0x4c152d[_0x14e4ae]={'$like':'%'+_0x320e48['query'][_0xbf96('0x4d')]+'%'};return _0x4c152d;})});}_0x3f220e=_[_0xbf96('0x4e')]({},_0x3f220e,_0x320e48[_0xbf96('0x50')]);return _0x46c944[_0xbf96('0xbc')](_0x3f220e);}})[_0xbf96('0x2d')](function(_0x409c8a){if(_0x409c8a){_0x50e7b0=_0x409c8a[_0xbf96('0x47')];if(!_0x320e48[_0xbf96('0x41')][_0xbf96('0x48')](_0xbf96('0x49'))){_0x3f220e['limit']=qs['limit'](_0x320e48[_0xbf96('0x41')][_0xbf96('0x25')]);_0x3f220e[_0xbf96('0x24')]=qs[_0xbf96('0x24')](_0x320e48[_0xbf96('0x41')][_0xbf96('0x24')]);}return _0x46c944['getBlackLists'](_0x3f220e);}})['then'](function(_0x1a82d8){if(_0x1a82d8){return _0x1a82d8?{'count':_0x50e7b0,'rows':_0x1a82d8}:null;}})['then'](respondWithResult(_0x52dbd8,null))[_0xbf96('0x52')](handleError(_0x52dbd8,null));};exports[_0xbf96('0xbd')]=function(_0x5dcf6f,_0x1226f8,_0xff5695){var _0x7a18fa,_0x5bc391;return db[_0xbf96('0x3e')]['find']({'where':{'id':_0x5dcf6f['params']['id']}})['then'](handleEntityNotFound(_0x1226f8,null))[_0xbf96('0x2d')](function(_0x2f0797){if(_0x2f0797){_0x5bc391=_0x2f0797;return _0x2f0797['addBlackLists'](_0x5dcf6f[_0xbf96('0x55')][_0xbf96('0x81')],_[_0xbf96('0x5c')](_0x5dcf6f[_0xbf96('0x55')],[_0xbf96('0x81'),'id'])||{});}return null;})['spread'](function(_0x332fcc){var _0x569b6d;_0x7a18fa=_0x332fcc||[];var _0x546dab=[];if(_0x332fcc){for(var _0x7e2561=0x0;_0x7e2561<_0x332fcc['length'];_0x7e2561+=0x1){var _0xb83537=_0x332fcc[_0x7e2561][_0xbf96('0x2e')]({'plain':!![]});_0x569b6d=squel[_0xbf96('0xa2')]()[_0xbf96('0xa3')](_0xbf96('0xbe'))[_0xbf96('0xa4')](['phone',_0xbf96('0xa7'),_0xbf96('0xa8'),_0xbf96('0x66'),_0xbf96('0x5d'),_0xbf96('0x5e')],squel['select']()[_0xbf96('0x83')](_0xbf96('0xa5'),_0xbf96('0xa5'))['field']('id','ContactId')[_0xbf96('0x83')](_0xb83537[_0xbf96('0xa9')][_0xbf96('0xaa')](),_0xbf96('0xa8'))[_0xbf96('0x83')](_0x5dcf6f['params']['id'][_0xbf96('0xaa')](),_0xbf96('0x66'))[_0xbf96('0x83')](_0xbf96('0xbf'),_0xbf96('0x5d'))[_0xbf96('0x83')](_0xbf96('0xbf'),_0xbf96('0x5e'))[_0xbf96('0x85')](_0xbf96('0xab'))['where'](_0xbf96('0xac'))[_0xbf96('0x4b')](_0xbf96('0xad'),_0xb83537[_0xbf96('0xa9')]['toString']())[_0xbf96('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0xbf96('0xaa')]();_0x546dab[_0xbf96('0x8b')](db[_0xbf96('0x77')]['query'](_0x569b6d));}return BPromise[_0xbf96('0x8e')](_0x546dab);}})['then'](function(){return _0x7a18fa;})[_0xbf96('0x2d')](respondWithResult(_0x1226f8,null))['catch'](handleError(_0x1226f8,null));};exports[_0xbf96('0xc0')]=function(_0x1de531,_0x13dfab,_0x2fab11){return db[_0xbf96('0x3e')]['find']({'where':{'id':_0x1de531[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x13dfab,null))[_0xbf96('0x2d')](function(_0x4cc0fb){if(_0x4cc0fb){return _0x4cc0fb[_0xbf96('0xc0')](_0x1de531[_0xbf96('0x41')][_0xbf96('0x81')]);}})[_0xbf96('0x2d')](function(_0x450881){if(_0x450881){return db[_0xbf96('0x6c')][_0xbf96('0x39')]({'where':{'ListId':_0x1de531[_0xbf96('0x41')][_0xbf96('0x81')],'VoiceQueueId':_0x1de531[_0xbf96('0x5b')]['id']}})[_0xbf96('0x2d')](function(){return _0x450881;});}})[_0xbf96('0x2d')](respondWithStatusCode(_0x13dfab,null))[_0xbf96('0x52')](handleError(_0x13dfab,null));}; \ No newline at end of file +var _0x23f4=['UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','VoiceQueues','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','ids','spread','push','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','phone','ContactId','ListId','CmListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','scheduledAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','QueueCampaigns','outbound','map','value','includes','type','find','name','UserProfileResource','stack','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound'];(function(_0x4f370d,_0x471982){var _0x56b5a2=function(_0x24d294){while(--_0x24d294){_0x4f370d['push'](_0x4f370d['shift']());}};_0x56b5a2(++_0x471982);}(_0x23f4,0x1ee));var _0x423f=function(_0x217cbf,_0x3f1554){_0x217cbf=_0x217cbf-0x0;var _0x1d9360=_0x23f4[_0x217cbf];return _0x1d9360;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x423f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x423f('0x1'));var moment=require(_0x423f('0x2'));var BPromise=require(_0x423f('0x3'));var Mustache=require(_0x423f('0x4'));var util=require(_0x423f('0x5'));var path=require(_0x423f('0x6'));var sox=require(_0x423f('0x7'));var csv=require(_0x423f('0x8'));var ejs=require(_0x423f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x423f('0xa'));var squel=require(_0x423f('0xb'));var crypto=require('crypto');var jsforce=require(_0x423f('0xc'));var deskjs=require(_0x423f('0xd'));var toCsv=require(_0x423f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x423f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x423f('0xf'));var hardwareService=require(_0x423f('0x10'));var logger=require(_0x423f('0x11'))(_0x423f('0x12'));var utils=require('../../config/utils');var config=require(_0x423f('0x13'));var licenseUtil=require(_0x423f('0x14'));var db=require(_0x423f('0x15'))['db'];config[_0x423f('0x16')]=_[_0x423f('0x17')](config['redis'],{'host':_0x423f('0x18'),'port':0x18eb});var socket=require(_0x423f('0x19'))(new Redis(config[_0x423f('0x16')]));require(_0x423f('0x1a'))[_0x423f('0x1b')](socket);function respondWithStatusCode(_0x3b531d,_0x1f6423){_0x1f6423=_0x1f6423||0xcc;return function(_0x21d804){if(_0x21d804){return _0x3b531d[_0x423f('0x1c')](_0x1f6423);}return _0x3b531d[_0x423f('0x1d')](_0x1f6423)[_0x423f('0x1e')]();};}function respondWithResult(_0x276be1,_0x14cba9){_0x14cba9=_0x14cba9||0xc8;return function(_0x1fef4d){if(_0x1fef4d){return _0x276be1[_0x423f('0x1d')](_0x14cba9)[_0x423f('0x1f')](_0x1fef4d);}};}function respondWithFilteredResult(_0x3fd56d,_0x34e968){return function(_0x26b6d1){if(_0x26b6d1){var _0x5424e6=typeof _0x34e968[_0x423f('0x20')]==='undefined'&&typeof _0x34e968['limit']===_0x423f('0x21');var _0x4956e0=_0x26b6d1[_0x423f('0x22')];var _0xd7b80e=_0x5424e6?0x0:_0x34e968['offset'];var _0x45b46d=_0x5424e6?_0x26b6d1[_0x423f('0x22')]:_0x34e968['offset']+_0x34e968[_0x423f('0x23')];var _0x2ebe74;if(_0x45b46d>=_0x4956e0){_0x45b46d=_0x4956e0;_0x2ebe74=0xc8;}else{_0x2ebe74=0xce;}_0x3fd56d['status'](_0x2ebe74);return _0x3fd56d[_0x423f('0x24')](_0x423f('0x25'),_0xd7b80e+'-'+_0x45b46d+'/'+_0x4956e0)['json'](_0x26b6d1);}return null;};}function patchUpdates(_0x54f47){return function(_0x5ec3a8){try{jsonpatch[_0x423f('0x26')](_0x5ec3a8,_0x54f47,!![]);}catch(_0x3c942e){return BPromise[_0x423f('0x27')](_0x3c942e);}return _0x5ec3a8[_0x423f('0x28')]();};}function saveUpdates(_0xb82e8d,_0x39e72d){return function(_0x14ef6c){if(_0x14ef6c){return _0x14ef6c[_0x423f('0x29')](_0xb82e8d)[_0x423f('0x2a')](function(_0x36f57f){return _0x36f57f;});}return null;};}function removeEntity(_0x45889f,_0x199196){return function(_0xb91ed8){if(_0xb91ed8){return _0xb91ed8[_0x423f('0x2b')]()['then'](function(){var _0x3308dd=_0xb91ed8[_0x423f('0x2c')]({'plain':!![]});var _0x1b347a=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x423f('0x2d'),'value':_0x423f('0x2e'),'ignore':![]}];var _0x323c61=_(_0x1b347a)['filter']('ignore')[_0x423f('0x2f')](_0x423f('0x30'))['value']();if(_[_0x423f('0x31')](_0x323c61,_0x3308dd[_0x423f('0x32')])){return;}var _0x3022a5=_[_0x423f('0x33')](_0x1b347a,['value',_0x3308dd[_0x423f('0x32')]])[_0x423f('0x34')];return db[_0x423f('0x35')][_0x423f('0x2b')]({'where':{'type':_0x3022a5,'resourceId':_0x3308dd['id']}})['then'](function(){return _0xb91ed8;});})[_0x423f('0x2a')](function(){_0x45889f[_0x423f('0x1d')](0xcc)[_0x423f('0x1e')]();});}};}function handleEntityNotFound(_0x8e7bcb,_0x341728){return function(_0x29fe71){if(!_0x29fe71){_0x8e7bcb[_0x423f('0x1c')](0x194);}return _0x29fe71;};}function handleError(_0x40949b,_0x3d204a){_0x3d204a=_0x3d204a||0x1f4;return function(_0x9e562f){logger['error'](_0x9e562f[_0x423f('0x36')]);if(_0x9e562f[_0x423f('0x34')]){delete _0x9e562f[_0x423f('0x34')];}_0x40949b['status'](_0x3d204a)[_0x423f('0x37')](_0x9e562f);};}exports['index']=function(_0x228df0,_0x16fcad){var _0x2784c6={},_0x40ee34={},_0x145981={'count':0x0,'rows':[]};var _0x4a5134=_['map'](db[_0x423f('0x38')][_0x423f('0x39')],function(_0x239a49){return{'name':_0x239a49[_0x423f('0x3a')],'type':_0x239a49[_0x423f('0x32')][_0x423f('0x3b')]};});_0x40ee34[_0x423f('0x3c')]=_[_0x423f('0x2f')](_0x4a5134,_0x423f('0x34'));_0x40ee34[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x228df0[_0x423f('0x3d')]);_0x40ee34[_0x423f('0x3f')]=_['intersection'](_0x40ee34['model'],_0x40ee34[_0x423f('0x3d')]);_0x2784c6[_0x423f('0x40')]=_[_0x423f('0x41')](_0x40ee34[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x228df0['query'][_0x423f('0x42')]));_0x2784c6[_0x423f('0x40')]=_0x2784c6[_0x423f('0x40')][_0x423f('0x43')]?_0x2784c6[_0x423f('0x40')]:_0x40ee34[_0x423f('0x3c')];if(!_0x228df0[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x2784c6[_0x423f('0x23')]=qs['limit'](_0x228df0['query'][_0x423f('0x23')]);_0x2784c6[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x228df0[_0x423f('0x3d')][_0x423f('0x20')]);}_0x2784c6[_0x423f('0x46')]=qs['sort'](_0x228df0[_0x423f('0x3d')][_0x423f('0x47')]);_0x2784c6[_0x423f('0x48')]=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x228df0[_0x423f('0x3d')],_0x40ee34[_0x423f('0x3f')]),_0x4a5134);if(_0x228df0[_0x423f('0x3d')]['filter']){_0x2784c6[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x2784c6[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x4a5134,function(_0x33d324){if(_0x33d324[_0x423f('0x32')]!==_0x423f('0x4b')){var _0xbd33af={};_0xbd33af[_0x33d324[_0x423f('0x34')]]={'$like':'%'+_0x228df0['query'][_0x423f('0x4c')]+'%'};return _0xbd33af;}})});}_0x2784c6=_['merge']({},_0x2784c6,_0x228df0[_0x423f('0x4d')]);var _0x2e0fc8={'where':_0x2784c6[_0x423f('0x48')]};return db[_0x423f('0x38')][_0x423f('0x22')](_0x2e0fc8)[_0x423f('0x2a')](function(_0x3087e4){_0x145981[_0x423f('0x22')]=_0x3087e4;if(_0x228df0[_0x423f('0x3d')][_0x423f('0x4e')]){_0x2784c6[_0x423f('0x4f')]=[{'all':!![]}];}return db[_0x423f('0x38')][_0x423f('0x50')](_0x2784c6);})[_0x423f('0x2a')](function(_0xa7708c){_0x145981[_0x423f('0x51')]=_0xa7708c;return _0x145981;})[_0x423f('0x2a')](respondWithFilteredResult(_0x16fcad,_0x2784c6))[_0x423f('0x52')](handleError(_0x16fcad,null));};exports[_0x423f('0x53')]=function(_0x2145a5,_0x580db1){var _0x2e824d={'raw':![],'where':{'id':_0x2145a5[_0x423f('0x54')]['id']}},_0x47fcda={};_0x47fcda[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x38')][_0x423f('0x39')]);_0x47fcda[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x2145a5[_0x423f('0x3d')]);_0x47fcda[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x47fcda[_0x423f('0x3c')],_0x47fcda[_0x423f('0x3d')]);_0x2e824d['attributes']=_[_0x423f('0x41')](_0x47fcda[_0x423f('0x3c')],qs['fields'](_0x2145a5[_0x423f('0x3d')]['fields']));_0x2e824d[_0x423f('0x40')]=_0x2e824d['attributes']['length']?_0x2e824d[_0x423f('0x40')]:_0x47fcda[_0x423f('0x3c')];if(_0x2145a5[_0x423f('0x3d')][_0x423f('0x4e')]){_0x2e824d['include']=[{'all':!![]}];}_0x2e824d=_[_0x423f('0x4a')]({},_0x2e824d,_0x2145a5['options']);return db[_0x423f('0x38')][_0x423f('0x33')](_0x2e824d)[_0x423f('0x2a')](handleEntityNotFound(_0x580db1,null))[_0x423f('0x2a')](respondWithResult(_0x580db1,null))[_0x423f('0x52')](handleError(_0x580db1,null));};exports[_0x423f('0x55')]=function(_0x106142,_0x248f22){return db[_0x423f('0x38')]['create'](_0x106142[_0x423f('0x56')],{})[_0x423f('0x2a')](function(_0x59a117){var _0x23a96a=_0x106142['user'][_0x423f('0x2c')]({'plain':!![]});if(!_0x23a96a)throw new Error(_0x423f('0x57'));if(_0x23a96a[_0x423f('0x58')]===_0x423f('0x59')){var _0x3b92bd=_0x59a117[_0x423f('0x2c')]({'plain':!![]});var _0x54f56a=[{'name':'VoiceQueues','value':_0x423f('0x5a')},{'name':_0x423f('0x2d'),'value':_0x423f('0x2e')}];var _0x3959ce=_[_0x423f('0x33')](_0x54f56a,[_0x423f('0x30'),_0x3b92bd[_0x423f('0x32')]])[_0x423f('0x34')];return db[_0x423f('0x5b')]['find']({'where':{'name':_0x3959ce,'userProfileId':_0x23a96a[_0x423f('0x5c')]},'raw':!![]})[_0x423f('0x2a')](function(_0x50686e){if(_0x50686e&&_0x50686e[_0x423f('0x5d')]===0x0){return db['UserProfileResource'][_0x423f('0x55')]({'name':_0x3b92bd[_0x423f('0x34')],'resourceId':_0x3b92bd['id'],'type':_0x50686e[_0x423f('0x34')],'sectionId':_0x50686e['id']},{})['then'](function(){return _0x59a117;});}else{return _0x59a117;}})['catch'](function(_0x208839){logger[_0x423f('0x5e')](_0x423f('0x5f'),_0x208839);throw _0x208839;});}return _0x59a117;})['then'](respondWithResult(_0x248f22,0xc9))[_0x423f('0x52')](handleError(_0x248f22,null));};exports[_0x423f('0x60')]=function(_0x270d28,_0x46ba2b){var _0xc5f895={'where':{'id':_0x270d28[_0x423f('0x54')]['id']}},_0x3ffe6f={};_0x3ffe6f['model']=_[_0x423f('0x3e')](db['VoiceQueue'][_0x423f('0x39')]);_0xc5f895[_0x423f('0x40')]=_[_0x423f('0x41')](_0x3ffe6f[_0x423f('0x3c')],qs['fields'](_0x270d28[_0x423f('0x3d')][_0x423f('0x42')]));_0xc5f895[_0x423f('0x40')]=_0xc5f895['attributes'][_0x423f('0x43')]?_0xc5f895[_0x423f('0x40')]:_0x3ffe6f['model'];if(_0x270d28[_0x423f('0x3d')][_0x423f('0x4e')]){_0xc5f895['include']=[{'all':!![]}];}_0xc5f895=_['merge']({},_0xc5f895,_0x270d28['options']);return db[_0x423f('0x38')][_0x423f('0x33')](_0xc5f895)[_0x423f('0x2a')](handleEntityNotFound(_0x46ba2b,null))[_0x423f('0x2a')](function(_0x587682){if(_0x587682){var _0x4fa0ef=_0x587682[_0x423f('0x2c')]({'plain':!![]});_0x4fa0ef=qs[_0x423f('0x61')](_0x4fa0ef,['id','createdAt',_0x423f('0x62')]);_0x270d28[_0x423f('0x56')]=_[_0x423f('0x61')](_0x270d28[_0x423f('0x56')],['id',_0x423f('0x63'),_0x423f('0x62')]);return db[_0x423f('0x38')]['create'](_[_0x423f('0x4a')](_0x4fa0ef,_0x270d28[_0x423f('0x56')]),{'include':_0x270d28['query'][_0x423f('0x4e')]?[{'all':!![]}]:undefined})[_0x423f('0x2a')](function(_0x3e5d47){var _0x5ce420=_0x270d28[_0x423f('0x59')][_0x423f('0x2c')]({'plain':!![]});if(!_0x5ce420)throw new Error(_0x423f('0x57'));if(_0x5ce420[_0x423f('0x58')]===_0x423f('0x59')){var _0x4a161d=_0x3e5d47[_0x423f('0x2c')]({'plain':!![]});var _0x106709=[{'name':_0x423f('0x64'),'value':'inbound'},{'name':_0x423f('0x2d'),'value':_0x423f('0x2e')}];var _0x25e123=_[_0x423f('0x33')](_0x106709,['value',_0x4a161d[_0x423f('0x32')]])[_0x423f('0x34')];return db[_0x423f('0x5b')][_0x423f('0x33')]({'where':{'name':_0x25e123,'userProfileId':_0x5ce420[_0x423f('0x5c')]},'raw':!![]})[_0x423f('0x2a')](function(_0x2a77fc){if(_0x2a77fc&&_0x2a77fc['autoAssociation']===0x0){return db[_0x423f('0x35')][_0x423f('0x55')]({'name':_0x4a161d[_0x423f('0x34')],'resourceId':_0x4a161d['id'],'type':_0x2a77fc[_0x423f('0x34')],'sectionId':_0x2a77fc['id']},{})['then'](function(){return _0x3e5d47;});}else{return _0x3e5d47;}})[_0x423f('0x52')](function(_0x405811){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x405811);throw _0x405811;});}return _0x3e5d47;});}})[_0x423f('0x2a')](respondWithResult(_0x46ba2b,0xc9))[_0x423f('0x52')](handleError(_0x46ba2b,null));};exports[_0x423f('0x29')]=function(_0x599a45,_0x2dadb6){if(_0x599a45[_0x423f('0x56')]['id']){delete _0x599a45[_0x423f('0x56')]['id'];}return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x599a45[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2dadb6,null))['then'](saveUpdates(_0x599a45[_0x423f('0x56')],null))['then'](respondWithResult(_0x2dadb6,null))['catch'](handleError(_0x2dadb6,null));};exports[_0x423f('0x2b')]=function(_0x1f6750,_0x4fd2e1){return db[_0x423f('0x38')][_0x423f('0x33')]({'where':{'id':_0x1f6750['params']['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x4fd2e1,null))[_0x423f('0x2a')](removeEntity(_0x4fd2e1,null))[_0x423f('0x52')](handleError(_0x4fd2e1,null));};exports[_0x423f('0x65')]=function(_0x233afe,_0x2519b5,_0x31fc04){var _0x5b9577={'raw':![],'where':{}};var _0x4e1e04={};var _0xd9409e={'count':0x0,'rows':[]};return db[_0x423f('0x38')][_0x423f('0x66')]({'where':{'id':_0x233afe[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2519b5,null))['then'](function(_0x3583f8){if(_0x3583f8){_0x4e1e04[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x67')][_0x423f('0x39')]);_0x4e1e04[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x233afe[_0x423f('0x3d')]);_0x4e1e04[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x4e1e04[_0x423f('0x3c')],_0x4e1e04[_0x423f('0x3d')]);_0x5b9577[_0x423f('0x40')]=_['intersection'](_0x4e1e04[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x233afe[_0x423f('0x3d')][_0x423f('0x42')]));_0x5b9577[_0x423f('0x40')]=_0x5b9577['attributes'][_0x423f('0x43')]?_0x5b9577[_0x423f('0x40')]:_0x4e1e04[_0x423f('0x3c')];if(!_0x233afe[_0x423f('0x3d')]['hasOwnProperty'](_0x423f('0x45'))){_0x5b9577[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x233afe[_0x423f('0x3d')][_0x423f('0x23')]);_0x5b9577[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x233afe[_0x423f('0x3d')][_0x423f('0x20')]);}_0x5b9577[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x233afe[_0x423f('0x3d')][_0x423f('0x47')]);_0x5b9577[_0x423f('0x48')]=qs['filters'](_[_0x423f('0x49')](_0x233afe['query'],_0x4e1e04['filters']));_0x5b9577[_0x423f('0x48')][_0x423f('0x68')]=_0x3583f8['id'];if(_0x233afe[_0x423f('0x3d')][_0x423f('0x4c')]){_0x5b9577['where']=_[_0x423f('0x4a')](_0x5b9577['where'],{'$or':_[_0x423f('0x2f')](_0x5b9577[_0x423f('0x40')],function(_0x3dee3b){var _0x2da8ff={};_0x2da8ff[_0x3dee3b]={'$like':'%'+_0x233afe[_0x423f('0x3d')]['filter']+'%'};return _0x2da8ff;})});}_0x5b9577=_[_0x423f('0x4a')]({},_0x5b9577,_0x233afe['options']);return db[_0x423f('0x67')]['count']({'where':_0x5b9577[_0x423f('0x48')]})[_0x423f('0x2a')](function(_0x1990ec){_0xd9409e['count']=_0x1990ec;if(_0x233afe[_0x423f('0x3d')][_0x423f('0x4e')]){_0x5b9577[_0x423f('0x4f')]=[{'all':!![]}];}return db[_0x423f('0x67')]['findAll'](_0x5b9577);})[_0x423f('0x2a')](function(_0x376326){_0xd9409e['rows']=_0x376326;return _0xd9409e;});}})[_0x423f('0x2a')](respondWithFilteredResult(_0x2519b5,_0x5b9577))[_0x423f('0x52')](handleError(_0x2519b5,null));};exports[_0x423f('0x69')]=function(_0x3737b6,_0x36241e,_0x2bb2ba){var _0x140db1={'raw':!![],'where':{}};var _0x33d4e4={};var _0x2ede33={'count':0x0,'rows':[]};return db[_0x423f('0x38')]['findOne']({'where':{'id':_0x3737b6['params']['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x36241e,null))['then'](function(_0x25a4e1){if(_0x25a4e1){_0x33d4e4['model']=_['keys'](db[_0x423f('0x6a')][_0x423f('0x39')]);_0x33d4e4[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x3737b6[_0x423f('0x3d')]);_0x33d4e4[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x33d4e4['model'],_0x33d4e4[_0x423f('0x3d')]);_0x140db1[_0x423f('0x40')]=_['intersection'](_0x33d4e4[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x3737b6[_0x423f('0x3d')][_0x423f('0x42')]));_0x140db1['attributes']=_0x140db1['attributes'][_0x423f('0x43')]?_0x140db1[_0x423f('0x40')]:_0x33d4e4[_0x423f('0x3c')];if(!_0x3737b6[_0x423f('0x3d')]['hasOwnProperty'](_0x423f('0x45'))){_0x140db1[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x3737b6['query'][_0x423f('0x23')]);_0x140db1['offset']=qs[_0x423f('0x20')](_0x3737b6[_0x423f('0x3d')][_0x423f('0x20')]);}_0x140db1[_0x423f('0x46')]=qs['sort'](_0x3737b6[_0x423f('0x3d')][_0x423f('0x47')]);_0x140db1['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x3737b6[_0x423f('0x3d')],_0x33d4e4[_0x423f('0x3f')]));_0x140db1[_0x423f('0x48')]['VoiceQueueId']=_0x25a4e1['id'];if(_0x3737b6[_0x423f('0x3d')][_0x423f('0x4c')]){_0x140db1[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x140db1['where'],{'$or':_['map'](_0x140db1[_0x423f('0x40')],function(_0x3d3722){var _0x2ed8ed={};_0x2ed8ed[_0x3d3722]={'$like':'%'+_0x3737b6[_0x423f('0x3d')]['filter']+'%'};return _0x2ed8ed;})});}_0x140db1=_[_0x423f('0x4a')]({},_0x140db1,_0x3737b6['options']);return db[_0x423f('0x6a')][_0x423f('0x22')]({'where':_0x140db1[_0x423f('0x48')]})[_0x423f('0x2a')](function(_0x23e5a6){_0x2ede33[_0x423f('0x22')]=_0x23e5a6;if(_0x3737b6[_0x423f('0x3d')]['includeAll']){_0x140db1[_0x423f('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x140db1);})[_0x423f('0x2a')](function(_0x34d1cd){_0x2ede33[_0x423f('0x51')]=_0x34d1cd;return _0x2ede33;});}})[_0x423f('0x2a')](respondWithFilteredResult(_0x36241e,_0x140db1))[_0x423f('0x52')](handleError(_0x36241e,null));};exports[_0x423f('0x6b')]=function(_0x1c30fb,_0x42e7ec,_0x20430d){var _0x2648e6={'raw':!![],'where':{}};var _0x28c8ba={};var _0x1671d6={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1c30fb[_0x423f('0x54')]['id']}})['then'](handleEntityNotFound(_0x42e7ec,null))['then'](function(_0x63d36f){if(_0x63d36f){_0x28c8ba[_0x423f('0x3c')]=_[_0x423f('0x3e')](db['CmHopperFinal']['rawAttributes']);_0x28c8ba[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x1c30fb[_0x423f('0x3d')]);_0x28c8ba['filters']=_['intersection'](_0x28c8ba[_0x423f('0x3c')],_0x28c8ba[_0x423f('0x3d')]);_0x2648e6[_0x423f('0x40')]=_[_0x423f('0x41')](_0x28c8ba[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x1c30fb[_0x423f('0x3d')]['fields']));_0x2648e6[_0x423f('0x40')]=_0x2648e6[_0x423f('0x40')][_0x423f('0x43')]?_0x2648e6['attributes']:_0x28c8ba[_0x423f('0x3c')];if(!_0x1c30fb['query']['hasOwnProperty'](_0x423f('0x45'))){_0x2648e6[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x1c30fb[_0x423f('0x3d')][_0x423f('0x23')]);_0x2648e6[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x1c30fb[_0x423f('0x3d')][_0x423f('0x20')]);}_0x2648e6['order']=qs[_0x423f('0x47')](_0x1c30fb['query'][_0x423f('0x47')]);_0x2648e6['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x1c30fb[_0x423f('0x3d')],_0x28c8ba['filters']));_0x2648e6[_0x423f('0x48')][_0x423f('0x68')]=_0x63d36f['id'];if(_0x1c30fb['query'][_0x423f('0x4c')]){_0x2648e6['where']=_[_0x423f('0x4a')](_0x2648e6[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x2648e6[_0x423f('0x40')],function(_0x177730){var _0x2ff3fd={};_0x2ff3fd[_0x177730]={'$like':'%'+_0x1c30fb[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x2ff3fd;})});}_0x2648e6=_['merge']({},_0x2648e6,_0x1c30fb['options']);return db[_0x423f('0x6c')][_0x423f('0x22')]({'where':_0x2648e6['where']})[_0x423f('0x2a')](function(_0xcbeb5f){_0x1671d6[_0x423f('0x22')]=_0xcbeb5f;if(_0x1c30fb[_0x423f('0x3d')][_0x423f('0x4e')]){_0x2648e6[_0x423f('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x423f('0x50')](_0x2648e6);})[_0x423f('0x2a')](function(_0x2165cd){_0x1671d6[_0x423f('0x51')]=_0x2165cd;return _0x1671d6;});}})['then'](respondWithFilteredResult(_0x42e7ec,_0x2648e6))['catch'](handleError(_0x42e7ec,null));};exports[_0x423f('0x6d')]=function(_0x585e5e,_0x5aebea,_0x59a8e7){var _0x3ae7f2={'raw':!![],'where':{}};var _0x151cae={};var _0x9baaf2={'count':0x0,'rows':[]};return db[_0x423f('0x38')]['findOne']({'where':{'id':_0x585e5e[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x5aebea,null))[_0x423f('0x2a')](function(_0x2e8fce){if(_0x2e8fce){_0x151cae[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x6e')][_0x423f('0x39')]);_0x151cae[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x585e5e['query']);_0x151cae[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x151cae[_0x423f('0x3c')],_0x151cae['query']);_0x3ae7f2[_0x423f('0x40')]=_[_0x423f('0x41')](_0x151cae[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x585e5e[_0x423f('0x3d')][_0x423f('0x42')]));_0x3ae7f2[_0x423f('0x40')]=_0x3ae7f2['attributes']['length']?_0x3ae7f2[_0x423f('0x40')]:_0x151cae[_0x423f('0x3c')];if(!_0x585e5e[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x3ae7f2[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x585e5e[_0x423f('0x3d')][_0x423f('0x23')]);_0x3ae7f2[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x585e5e[_0x423f('0x3d')]['offset']);}_0x3ae7f2[_0x423f('0x46')]=qs['sort'](_0x585e5e[_0x423f('0x3d')][_0x423f('0x47')]);_0x3ae7f2['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x585e5e['query'],_0x151cae[_0x423f('0x3f')]));_0x3ae7f2[_0x423f('0x48')][_0x423f('0x68')]=_0x2e8fce['id'];if(_0x585e5e[_0x423f('0x3d')][_0x423f('0x4c')]){_0x3ae7f2[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x3ae7f2[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x3ae7f2[_0x423f('0x40')],function(_0x4019e8){var _0x6ef421={};_0x6ef421[_0x4019e8]={'$like':'%'+_0x585e5e[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x6ef421;})});}_0x3ae7f2=_[_0x423f('0x4a')]({},_0x3ae7f2,_0x585e5e[_0x423f('0x4d')]);return db[_0x423f('0x6e')]['count']({'where':_0x3ae7f2[_0x423f('0x48')]})[_0x423f('0x2a')](function(_0x4c9f0d){_0x9baaf2[_0x423f('0x22')]=_0x4c9f0d;if(_0x585e5e[_0x423f('0x3d')][_0x423f('0x4e')]){_0x3ae7f2[_0x423f('0x4f')]=[{'all':!![]}];}return db[_0x423f('0x6e')][_0x423f('0x50')](_0x3ae7f2);})['then'](function(_0x2ecd02){_0x9baaf2[_0x423f('0x51')]=_0x2ecd02;return _0x9baaf2;});}})[_0x423f('0x2a')](respondWithFilteredResult(_0x5aebea,_0x3ae7f2))[_0x423f('0x52')](handleError(_0x5aebea,null));};exports[_0x423f('0x6f')]=function(_0x322e3b,_0x14e49a,_0x56103b){var _0x5add9d={};var _0x3eda5d={};var _0xca8f07;var _0x599f92;return db[_0x423f('0x38')]['findOne']({'where':{'id':_0x322e3b[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x14e49a,null))['then'](function(_0x1874c6){if(_0x1874c6){_0xca8f07=_0x1874c6;_0x3eda5d[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x70')][_0x423f('0x39')]);_0x3eda5d[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x322e3b['query']);_0x3eda5d['filters']=_[_0x423f('0x41')](_0x3eda5d[_0x423f('0x3c')],_0x3eda5d[_0x423f('0x3d')]);_0x5add9d['attributes']=_[_0x423f('0x41')](_0x3eda5d[_0x423f('0x3c')],qs['fields'](_0x322e3b[_0x423f('0x3d')][_0x423f('0x42')]));_0x5add9d[_0x423f('0x40')]=_0x5add9d[_0x423f('0x40')][_0x423f('0x43')]?_0x5add9d[_0x423f('0x40')]:_0x3eda5d[_0x423f('0x3c')];_0x5add9d[_0x423f('0x46')]=qs['sort'](_0x322e3b[_0x423f('0x3d')]['sort']);_0x5add9d['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x322e3b['query'],_0x3eda5d['filters']));if(_0x322e3b[_0x423f('0x3d')][_0x423f('0x4c')]){_0x5add9d[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x5add9d[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x5add9d[_0x423f('0x40')],function(_0x54e3d6){var _0x6f9fb6={};_0x6f9fb6[_0x54e3d6]={'$like':'%'+_0x322e3b['query'][_0x423f('0x4c')]+'%'};return _0x6f9fb6;})});}_0x5add9d=_['merge']({},_0x5add9d,_0x322e3b[_0x423f('0x4d')]);return _0xca8f07[_0x423f('0x6f')](_0x5add9d);}})[_0x423f('0x2a')](function(_0x2e9259){if(_0x2e9259){_0x599f92=_0x2e9259[_0x423f('0x43')];if(!_0x322e3b['query']['hasOwnProperty']('nolimit')){_0x5add9d[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x322e3b[_0x423f('0x3d')][_0x423f('0x23')]);_0x5add9d[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x322e3b[_0x423f('0x3d')]['offset']);}return _0xca8f07[_0x423f('0x6f')](_0x5add9d);}})[_0x423f('0x2a')](function(_0x7a3b73){if(_0x7a3b73){return _0x7a3b73?{'count':_0x599f92,'rows':_0x7a3b73}:null;}})[_0x423f('0x2a')](respondWithResult(_0x14e49a,null))[_0x423f('0x52')](handleError(_0x14e49a,null));};exports[_0x423f('0x71')]=function(_0x7f345,_0x417943,_0x9ac571){var _0x475d10=_0x7f345['body'][_0x423f('0x72')];var _0x299fd7=_['map'](_0x475d10,'id');return db[_0x423f('0x70')]['findAll']({'where':{'id':_0x299fd7},'attributes':['id'],'include':[{'model':db[_0x423f('0x73')],'as':_0x423f('0x74'),'attributes':['id',_0x423f('0x34'),_0x423f('0x75'),_0x423f('0x76'),_0x423f('0x77')],'raw':!![]}]})['then'](function(_0x394f1b){if(_0x394f1b){var _0x15284e=_[_0x423f('0x78')](_0x394f1b,function(_0x339fd5){var _0x28996a=_0x339fd5[_0x423f('0x2c')]({'plain':!![]});_0x28996a[_0x423f('0x74')][_0x423f('0x79')](function(_0x1d95c9){_0x1d95c9[_0x423f('0x7a')]=_[_0x423f('0x33')](_0x475d10,{'id':_0x28996a['id']})['penalty'];});return _0x28996a['Agents'];});return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x7f345[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](function(_0x4af753){return db[_0x423f('0x7b')][_0x423f('0x7c')](function(_0x3f8e4f){return _0x4af753[_0x423f('0x71')](_0x299fd7,{'transaction':_0x3f8e4f})[_0x423f('0x2a')](function(){return BPromise['each'](_0x475d10,function(_0x2709e5){return db[_0x423f('0x7d')]['upsert']({'TeamId':_0x2709e5['id'],'VoiceQueueId':_0x7f345['params']['id'],'penalty':_0x2709e5[_0x423f('0x7a')]},{'transaction':_0x3f8e4f});});})[_0x423f('0x2a')](function(){return BPromise['each'](_0x15284e,function(_0x2add3e){return db[_0x423f('0x7e')][_0x423f('0x7f')]({'where':{'UserId':_0x2add3e['id'],'VoiceQueueId':_0x7f345['params']['id']},'defaults':{'penalty':_0x2add3e[_0x423f('0x7a')]},'transaction':_0x3f8e4f});});})[_0x423f('0x2a')](function(){return BPromise[_0x423f('0x80')](_[_0x423f('0x4c')](_0x15284e,{'online':!![]}),function(_0x3ae984){return db[_0x423f('0x81')][_0x423f('0x82')]({'membername':_0x3ae984[_0x423f('0x34')],'UserId':_0x3ae984['id'],'queue_name':_0x4af753[_0x423f('0x34')],'VoiceQueueId':_0x4af753['id'],'interface':_[_0x423f('0x83')](_0x3ae984['interface'])?util[_0x423f('0x84')](_0x423f('0x85'),_0x3ae984[_0x423f('0x34')]):_0x3ae984[_0x423f('0x77')],'paused':_0x3ae984[_0x423f('0x76')]||![],'penalty':_0x3ae984[_0x423f('0x7a')]},{'transaction':_0x3f8e4f});});})[_0x423f('0x2a')](function(){_0x15284e[_0x423f('0x79')](function(_0xaf7c7){socket[_0x423f('0x86')](_0x423f('0x87'),{'UserId':_0xaf7c7['id'],'VoiceQueueId':_0x4af753['id']});});});});});}})[_0x423f('0x2a')](respondWithStatusCode(_0x417943,null))[_0x423f('0x52')](handleError(_0x417943,null));};exports[_0x423f('0x88')]=function(_0x1408ca,_0x523725,_0x860d89){return db[_0x423f('0x70')][_0x423f('0x50')]({'where':{'id':_0x1408ca[_0x423f('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x423f('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x523725,null))[_0x423f('0x2a')](function(_0x17e727){var _0x1ba6cc=_[_0x423f('0x2f')](_0x17e727,'id');var _0x500a93=[];var _0x84b50b=[];var _0x3f8e22=squel[_0x423f('0x89')]();_0x3f8e22[_0x423f('0x8a')](_0x423f('0x8b'))[_0x423f('0x8c')](_0x423f('0x8d'),'tq')[_0x423f('0x8e')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x423f('0x48')](_0x423f('0x8f'),_0x1408ca['params']['id']);for(var _0x522d00=0x0;_0x522d00<_0x17e727[_0x423f('0x43')];_0x522d00+=0x1){let _0x22b244=_0x17e727[_0x522d00];for(var _0x1f33e8=0x0;_0x1f33e8<_0x22b244[_0x423f('0x74')]['length'];_0x1f33e8+=0x1){let _0x251ebd=_0x22b244[_0x423f('0x74')][_0x1f33e8];var _0x5a7904=_0x3f8e22[_0x423f('0x60')]();_0x5a7904[_0x423f('0x48')](_0x423f('0x90'),_0x251ebd['id']);_0x84b50b['push'](db[_0x423f('0x7b')]['query'](_0x5a7904[_0x423f('0x91')](),{'type':db[_0x423f('0x7b')][_0x423f('0x92')][_0x423f('0x93')]})[_0x423f('0x2a')](function(_0x28bb80){if(_0x28bb80[_0x423f('0x43')]===0x1){return _0x251ebd['id'];}else{var _0x28e792=_['every'](_['map'](_0x28bb80,_0x423f('0x94')),function(_0x6c541d){return _[_0x423f('0x31')](_0x1ba6cc,_0x6c541d);});if(_0x28e792){return _0x251ebd['id'];}}}));}}return BPromise[_0x423f('0x95')](_0x84b50b)[_0x423f('0x2a')](function(_0x476f50){_0x500a93=_(_0x500a93)['union'](_0x476f50)['compact']()[_0x423f('0x30')]();return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x1408ca[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](function(_0x4d1981){return db['sequelize'][_0x423f('0x7c')](function(_0x97c2cb){return _0x4d1981['removeTeams'](_0x1408ca[_0x423f('0x3d')]['ids'],{'transaction':_0x97c2cb})[_0x423f('0x2a')](function(){if(!_[_0x423f('0x96')](_0x500a93)){return _0x4d1981[_0x423f('0x97')](_0x500a93,{'transaction':_0x97c2cb})[_0x423f('0x2a')](function(){return db[_0x423f('0x81')][_0x423f('0x2b')]({'where':{'VoiceQueueId':_0x1408ca[_0x423f('0x54')]['id'],'UserId':_0x500a93},'transaction':_0x97c2cb});});}})[_0x423f('0x2a')](function(){_0x500a93[_0x423f('0x79')](function(_0xa78dfe){socket['emit'](_0x423f('0x98'),{'UserId':_0xa78dfe,'VoiceQueueId':_0x4d1981['id']});});});});});});})[_0x423f('0x2a')](respondWithStatusCode(_0x523725,null))[_0x423f('0x52')](handleError(_0x523725,null));};exports[_0x423f('0x99')]=function(_0x2af8cb,_0x4c3821,_0x3e3a79){var _0x5daf55,_0x451581;return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x2af8cb[_0x423f('0x54')]['id']}})['then'](handleEntityNotFound(_0x4c3821,null))[_0x423f('0x2a')](function(_0x452602){if(_0x452602){_0x451581=_0x452602;return _0x452602[_0x423f('0x99')](_0x2af8cb[_0x423f('0x56')][_0x423f('0x9a')],_[_0x423f('0x61')](_0x2af8cb['body'],[_0x423f('0x9a'),'id'])||{})[_0x423f('0x9b')](function(_0xdbb7e1){for(var _0x2c5e39=0x0;_0x2c5e39<_0x2af8cb[_0x423f('0x56')][_0x423f('0x9a')][_0x423f('0x43')];_0x2c5e39+=0x1){socket[_0x423f('0x86')](_0x423f('0x87'),{'UserId':Number(_0x2af8cb['body']['ids'][_0x2c5e39]),'VoiceQueueId':Number(_0x2af8cb['params']['id'])});}return _0xdbb7e1;});}})[_0x423f('0x2a')](function(_0x13fe13){_0x5daf55=_0x13fe13||[];if(_0x451581){return db['User']['findAll']({'where':{'id':_0x2af8cb[_0x423f('0x56')]['ids']},'attributes':['id',_0x423f('0x34'),_0x423f('0x75'),_0x423f('0x76'),_0x423f('0x77')],'raw':!![]});}})[_0x423f('0x2a')](function(_0x4f4c53){if(!_['isEmpty'](_0x4f4c53)){var _0x5b57b0=[];for(var _0x492884=0x0;_0x492884<_0x4f4c53['length'];_0x492884++){if(_0x4f4c53[_0x492884][_0x423f('0x75')]){_0x5b57b0[_0x423f('0x9c')](db[_0x423f('0x81')][_0x423f('0x82')]({'membername':_0x4f4c53[_0x492884][_0x423f('0x34')],'UserId':_0x4f4c53[_0x492884]['id'],'queue_name':_0x451581['name'],'VoiceQueueId':_0x451581['id'],'interface':_['isNil'](_0x4f4c53[_0x492884][_0x423f('0x77')])?util[_0x423f('0x84')](_0x423f('0x85'),_0x4f4c53[_0x492884][_0x423f('0x34')]):_0x4f4c53[_0x492884][_0x423f('0x77')],'paused':_0x4f4c53[_0x492884][_0x423f('0x76')]||![],'penalty':_0x2af8cb[_0x423f('0x56')][_0x423f('0x7a')]||0x0}));}}return BPromise[_0x423f('0x95')](_0x5b57b0);}})[_0x423f('0x2a')](function(){return _0x5daf55;})[_0x423f('0x2a')](respondWithResult(_0x4c3821,null))[_0x423f('0x52')](handleError(_0x4c3821,null));};exports[_0x423f('0x97')]=function(_0x411c83,_0x2724e5,_0x519c75){return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x411c83[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2724e5,null))[_0x423f('0x2a')](function(_0x1e504e){if(_0x1e504e){return _0x1e504e[_0x423f('0x97')](_0x411c83[_0x423f('0x3d')]['ids'])[_0x423f('0x2a')](function(){if(_[_0x423f('0x9d')](_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')])){for(var _0x427011=0x0;_0x427011<_0x411c83['query'][_0x423f('0x9a')][_0x423f('0x43')];_0x427011+=0x1){socket[_0x423f('0x86')]('userVoiceQueue:remove',{'UserId':Number(_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')][_0x427011]),'VoiceQueueId':Number(_0x411c83[_0x423f('0x54')]['id'])});}}else{socket[_0x423f('0x86')](_0x423f('0x98'),{'UserId':Number(_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')]),'VoiceQueueId':Number(_0x411c83[_0x423f('0x54')]['id'])});}});}})[_0x423f('0x2a')](function(_0x1a7c2d){return db[_0x423f('0x81')]['destroy']({'where':{'VoiceQueueId':_0x411c83[_0x423f('0x54')]['id'],'UserId':_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')]}})['then'](function(){return _0x1a7c2d;});})[_0x423f('0x2a')](respondWithStatusCode(_0x2724e5,null))['catch'](handleError(_0x2724e5,null));};exports['getAgents']=function(_0x459f8a,_0x112217,_0xa175cd){var _0x191c9d={};var _0x1603b7={};var _0x5e8e5b;var _0x388313;return db[_0x423f('0x38')][_0x423f('0x66')]({'where':{'id':_0x459f8a['params']['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x112217,null))[_0x423f('0x2a')](function(_0x2cb659){if(_0x2cb659){_0x5e8e5b=_0x2cb659;_0x1603b7[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x73')][_0x423f('0x39')]);_0x1603b7['query']=_['keys'](_0x459f8a['query']);_0x1603b7['filters']=_['intersection'](_0x1603b7[_0x423f('0x3c')],_0x1603b7[_0x423f('0x3d')]);_0x191c9d[_0x423f('0x40')]=_[_0x423f('0x41')](_0x1603b7['model'],qs[_0x423f('0x42')](_0x459f8a[_0x423f('0x3d')]['fields']));_0x191c9d[_0x423f('0x40')]=_0x191c9d[_0x423f('0x40')][_0x423f('0x43')]?_0x191c9d['attributes']:_0x1603b7['model'];_0x191c9d[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x459f8a[_0x423f('0x3d')][_0x423f('0x47')]);_0x191c9d['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x459f8a['query'],_0x1603b7[_0x423f('0x3f')]));if(_0x459f8a[_0x423f('0x3d')]['filter']){_0x191c9d[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x191c9d[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x191c9d['attributes'],function(_0x218a51){var _0x38cb89={};_0x38cb89[_0x218a51]={'$like':'%'+_0x459f8a[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x38cb89;})});}_0x191c9d=_[_0x423f('0x4a')]({},_0x191c9d,_0x459f8a[_0x423f('0x4d')]);return _0x5e8e5b[_0x423f('0x9e')](_0x191c9d);}})[_0x423f('0x2a')](function(_0x3e021b){if(_0x3e021b){_0x388313=_0x3e021b[_0x423f('0x43')];if(!_0x459f8a[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x191c9d[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x459f8a['query']['limit']);_0x191c9d[_0x423f('0x20')]=qs['offset'](_0x459f8a['query']['offset']);}return _0x5e8e5b['getAgents'](_0x191c9d);}})[_0x423f('0x2a')](function(_0x5229ac){if(_0x5229ac){return _0x5229ac?{'count':_0x388313,'rows':_0x5229ac}:null;}})['then'](respondWithResult(_0x112217,null))[_0x423f('0x52')](handleError(_0x112217,null));};exports['getMembers']=function(_0x2102c2,_0x4c98ea,_0x12d224){var _0x5af64f={};var _0x23494f={};var _0x3f8501;var _0x144cd0;return db['VoiceQueue']['findOne']({'where':{'id':_0x2102c2[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x4c98ea,null))[_0x423f('0x2a')](function(_0x2b23f6){if(_0x2b23f6){_0x3f8501=_0x2b23f6;_0x23494f[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x81')][_0x423f('0x39')]);_0x23494f['query']=_[_0x423f('0x3e')](_0x2102c2['query']);_0x23494f[_0x423f('0x3f')]=_['intersection'](_0x23494f[_0x423f('0x3c')],_0x23494f['query']);_0x5af64f['attributes']=_[_0x423f('0x41')](_0x23494f[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x2102c2[_0x423f('0x3d')][_0x423f('0x42')]));_0x5af64f['attributes']=_0x5af64f[_0x423f('0x40')][_0x423f('0x43')]?_0x5af64f['attributes']:_0x23494f[_0x423f('0x3c')];_0x5af64f[_0x423f('0x46')]=qs['sort'](_0x2102c2['query']['sort']);_0x5af64f[_0x423f('0x48')]=qs[_0x423f('0x3f')](_['pick'](_0x2102c2[_0x423f('0x3d')],_0x23494f[_0x423f('0x3f')]));if(_0x2102c2[_0x423f('0x3d')][_0x423f('0x4c')]){_0x5af64f[_0x423f('0x48')]=_['merge'](_0x5af64f[_0x423f('0x48')],{'$or':_['map'](_0x5af64f[_0x423f('0x40')],function(_0x23a9d3){var _0x2cb250={};_0x2cb250[_0x23a9d3]={'$like':'%'+_0x2102c2[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x2cb250;})});}_0x5af64f=_[_0x423f('0x4a')]({},_0x5af64f,_0x2102c2['options']);return _0x3f8501[_0x423f('0x9f')](_0x5af64f);}})['then'](function(_0x3782f5){if(_0x3782f5){_0x144cd0=_0x3782f5[_0x423f('0x43')];if(!_0x2102c2[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x5af64f['limit']=qs[_0x423f('0x23')](_0x2102c2['query']['limit']);_0x5af64f[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x2102c2['query'][_0x423f('0x20')]);}return _0x3f8501[_0x423f('0x9f')](_0x5af64f);}})['then'](function(_0x492dc4){return _0x492dc4?{'count':_0x144cd0,'rows':_0x492dc4}:null;})['then'](respondWithResult(_0x4c98ea,null))[_0x423f('0x52')](handleError(_0x4c98ea,null));};exports[_0x423f('0xa0')]=function(_0x5ecdbe,_0x261690,_0xdd41d7){var _0x3b4beb={};var _0x41b6ac={};var _0x236ead;var _0x336f7c;return db[_0x423f('0x38')][_0x423f('0x66')]({'where':{'id':_0x5ecdbe[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x261690,null))[_0x423f('0x2a')](function(_0xa065b3){if(_0xa065b3){_0x236ead=_0xa065b3;_0x41b6ac[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0xa1')][_0x423f('0x39')]);_0x41b6ac[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x5ecdbe[_0x423f('0x3d')]);_0x41b6ac[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x41b6ac[_0x423f('0x3c')],_0x41b6ac[_0x423f('0x3d')]);_0x3b4beb['attributes']=_[_0x423f('0x41')](_0x41b6ac['model'],qs[_0x423f('0x42')](_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x42')]));_0x3b4beb['attributes']=_0x3b4beb['attributes'][_0x423f('0x43')]?_0x3b4beb[_0x423f('0x40')]:_0x41b6ac[_0x423f('0x3c')];_0x3b4beb[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x47')]);_0x3b4beb['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x5ecdbe['query'],_0x41b6ac[_0x423f('0x3f')]));if(_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x4c')]){_0x3b4beb['where']=_[_0x423f('0x4a')](_0x3b4beb[_0x423f('0x48')],{'$or':_['map'](_0x3b4beb[_0x423f('0x40')],function(_0x29c8e6){var _0x2f49c6={};_0x2f49c6[_0x29c8e6]={'$like':'%'+_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x2f49c6;})});}_0x3b4beb=_[_0x423f('0x4a')]({},_0x3b4beb,_0x5ecdbe[_0x423f('0x4d')]);return _0x236ead[_0x423f('0xa0')](_0x3b4beb);}})[_0x423f('0x2a')](function(_0x21c99f){if(_0x21c99f){_0x336f7c=_0x21c99f['length'];if(!_0x5ecdbe[_0x423f('0x3d')]['hasOwnProperty']('nolimit')){_0x3b4beb[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x23')]);_0x3b4beb['offset']=qs[_0x423f('0x20')](_0x5ecdbe['query'][_0x423f('0x20')]);}return _0x236ead[_0x423f('0xa0')](_0x3b4beb);}})[_0x423f('0x2a')](function(_0x3edb25){if(_0x3edb25){return _0x3edb25?{'count':_0x336f7c,'rows':_0x3edb25}:null;}})[_0x423f('0x2a')](respondWithResult(_0x261690,null))['catch'](handleError(_0x261690,null));};exports[_0x423f('0xa2')]=function(_0x447809,_0x50acce,_0x385305){var _0x131de2=moment()[_0x423f('0x84')](_0x423f('0xa3'));var _0x4080e6,_0x1ffdae;return db[_0x423f('0x38')][_0x423f('0x33')]({'where':{'id':_0x447809[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x50acce,null))[_0x423f('0x2a')](function(_0x3bef9a){if(_0x3bef9a){_0x1ffdae=_0x3bef9a;return _0x3bef9a[_0x423f('0xa2')](_0x447809['body']['ids'],_[_0x423f('0x61')](_0x447809[_0x423f('0x56')],['ids','id'])||{});}return null;})[_0x423f('0x9b')](function(_0x41e33e){var _0x3d7903;_0x4080e6=_0x41e33e||[];var _0x36a02a=[];if(_0x41e33e){for(var _0x585f5a=0x0;_0x585f5a<_0x41e33e[_0x423f('0x43')];_0x585f5a+=0x1){var _0x319a0a=_0x41e33e[_0x585f5a][_0x423f('0x2c')]({'plain':!![]});_0x1ffdae[_0x423f('0xa4')]=_0x447809[_0x423f('0x56')][_0x423f('0xa4')]?_0x447809['body'][_0x423f('0xa4')]:_0x1ffdae['dialCheckDuplicateType'];switch(_0x1ffdae['dialCheckDuplicateType']){case'always':_0x3d7903=squel[_0x423f('0xa5')]()[_0x423f('0xa6')](_0x423f('0xa7'))['fromQuery']([_0x423f('0xa8'),'scheduledAt',_0x423f('0xa9'),_0x423f('0xaa'),_0x423f('0x68'),_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xa8'),_0x423f('0xa8'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27','scheduledAt')['field']('id',_0x423f('0xa9'))[_0x423f('0x8a')](_0x319a0a[_0x423f('0xab')]['toString'](),_0x423f('0xaa'))[_0x423f('0x8a')](_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')](),_0x423f('0x68'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x63'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x62'))[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')]('deletedAt\x20IS\x20NULL')[_0x423f('0x48')]('ListId\x20=\x20?',_0x319a0a[_0x423f('0xab')][_0x423f('0x91')]())[_0x423f('0x48')](_0x423f('0xad'))[_0x423f('0x48')](_0x423f('0xae'),squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xaf'))[_0x423f('0x8c')](_0x423f('0xb0'))[_0x423f('0x48')]('VoiceQueueId\x20=\x20?',_0x447809['params']['id']['toString']()))['where'](_0x423f('0xae'),squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xb1'))[_0x423f('0x8c')]('cm_hopper')[_0x423f('0x48')](_0x423f('0x8f'),_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')]())))[_0x423f('0x91')]();break;case _0x423f('0xb2'):_0x3d7903=squel['insert']()[_0x423f('0xa6')]('cm_hopper')[_0x423f('0xb3')]([_0x423f('0xa8'),_0x423f('0xb4'),_0x423f('0xa9'),'ListId',_0x423f('0x68'),_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()['field'](_0x423f('0xa8'),_0x423f('0xa8'))['field']('\x27'+_0x131de2+'\x27',_0x423f('0xb4'))[_0x423f('0x8a')]('id',_0x423f('0xa9'))[_0x423f('0x8a')](_0x319a0a[_0x423f('0xab')][_0x423f('0x91')](),_0x423f('0xaa'))['field'](_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')](),_0x423f('0x68'))['field']('\x27'+_0x131de2+'\x27',_0x423f('0x63'))['field']('\x27'+_0x131de2+'\x27',_0x423f('0x62'))[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')](_0x423f('0xb5'))[_0x423f('0x48')]('ListId\x20=\x20?',_0x319a0a[_0x423f('0xab')]['toString']())[_0x423f('0x48')](_0x423f('0xad'))[_0x423f('0x48')](_0x423f('0xae'),squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xb1'))[_0x423f('0x8c')](_0x423f('0xa7'))['where'](_0x423f('0x8f'),_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')]())))[_0x423f('0x91')]();break;default:_0x3d7903=squel[_0x423f('0xa5')]()[_0x423f('0xa6')](_0x423f('0xa7'))[_0x423f('0xb3')](['phone',_0x423f('0xb4'),_0x423f('0xa9'),_0x423f('0xaa'),'VoiceQueueId',_0x423f('0x63'),_0x423f('0x62')],squel['select']()[_0x423f('0x8a')]('phone',_0x423f('0xa8'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0xb4'))['field']('id',_0x423f('0xa9'))[_0x423f('0x8a')](_0x319a0a[_0x423f('0xab')][_0x423f('0x91')](),_0x423f('0xaa'))[_0x423f('0x8a')](_0x447809[_0x423f('0x54')]['id']['toString'](),_0x423f('0x68'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x63'))['field']('\x27'+_0x131de2+'\x27','updatedAt')[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')](_0x423f('0xb5'))['where'](_0x423f('0xb6'),_0x319a0a[_0x423f('0xab')]['toString']())['where'](_0x423f('0xad')))[_0x423f('0x91')]();}_0x36a02a['push'](db[_0x423f('0x7b')][_0x423f('0x3d')](_0x3d7903));}return BPromise[_0x423f('0x95')](_0x36a02a);}})[_0x423f('0x2a')](function(){var _0x25f119=[];var _0x24496a=squel['insert']()[_0x423f('0xa6')]('cm_hopper_additional_phones')[_0x423f('0xb3')](['CmHopperId','phone',_0x423f('0xb7'),_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()[_0x423f('0x8a')]('h.id')['field'](_0x423f('0xb8'))[_0x423f('0x8a')](_0x423f('0xb9'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x63'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27','updatedAt')[_0x423f('0x8c')](_0x423f('0xba'),'ci')[_0x423f('0x8e')](_0x423f('0xa7'),'h',_0x423f('0xbb'))[_0x423f('0x48')]('h.scheduledat=?',_0x131de2)['where']('ci.ItemClass=?',_0x423f('0xbc')))[_0x423f('0x91')]();_0x25f119[_0x423f('0x9c')](db['sequelize'][_0x423f('0x3d')](_0x24496a));return BPromise[_0x423f('0x95')](_0x25f119);})[_0x423f('0x2a')](function(){return _0x4080e6;})[_0x423f('0x2a')](respondWithResult(_0x50acce,null))[_0x423f('0x52')](handleError(_0x50acce,null));};exports[_0x423f('0xbd')]=function(_0x576c94,_0xaea05b,_0x1d112a){return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x576c94[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0xaea05b,null))[_0x423f('0x2a')](function(_0x45df44){if(_0x45df44){return _0x45df44['removeLists'](_0x576c94['query'][_0x423f('0x9a')]);}})['then'](function(_0x552d2b){if(_0x552d2b){return db[_0x423f('0x67')][_0x423f('0x2b')]({'where':{'ListId':_0x576c94[_0x423f('0x3d')][_0x423f('0x9a')],'VoiceQueueId':_0x576c94[_0x423f('0x54')]['id']}})['then'](function(){return _0x552d2b;});}})[_0x423f('0x2a')](respondWithStatusCode(_0xaea05b,null))[_0x423f('0x52')](handleError(_0xaea05b,null));};exports['getBlackLists']=function(_0x4ab25c,_0x4eb1e8,_0x1348f4){var _0x4b70dc={};var _0xb2b23={};var _0x17465a;var _0x8ceccd;return db['VoiceQueue'][_0x423f('0x66')]({'where':{'id':_0x4ab25c[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x4eb1e8,null))[_0x423f('0x2a')](function(_0x4e2a3b){if(_0x4e2a3b){_0x17465a=_0x4e2a3b;_0xb2b23[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0xa1')][_0x423f('0x39')]);_0xb2b23[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x4ab25c['query']);_0xb2b23[_0x423f('0x3f')]=_[_0x423f('0x41')](_0xb2b23[_0x423f('0x3c')],_0xb2b23[_0x423f('0x3d')]);_0x4b70dc[_0x423f('0x40')]=_[_0x423f('0x41')](_0xb2b23['model'],qs[_0x423f('0x42')](_0x4ab25c[_0x423f('0x3d')][_0x423f('0x42')]));_0x4b70dc['attributes']=_0x4b70dc[_0x423f('0x40')][_0x423f('0x43')]?_0x4b70dc[_0x423f('0x40')]:_0xb2b23[_0x423f('0x3c')];_0x4b70dc[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x4ab25c['query'][_0x423f('0x47')]);_0x4b70dc['where']=qs[_0x423f('0x3f')](_['pick'](_0x4ab25c[_0x423f('0x3d')],_0xb2b23[_0x423f('0x3f')]));if(_0x4ab25c['query']['filter']){_0x4b70dc[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x4b70dc['where'],{'$or':_[_0x423f('0x2f')](_0x4b70dc[_0x423f('0x40')],function(_0x4a3220){var _0x44d7d8={};_0x44d7d8[_0x4a3220]={'$like':'%'+_0x4ab25c[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x44d7d8;})});}_0x4b70dc=_[_0x423f('0x4a')]({},_0x4b70dc,_0x4ab25c[_0x423f('0x4d')]);return _0x17465a[_0x423f('0xbe')](_0x4b70dc);}})[_0x423f('0x2a')](function(_0x41496a){if(_0x41496a){_0x8ceccd=_0x41496a['length'];if(!_0x4ab25c[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x4b70dc[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x4ab25c[_0x423f('0x3d')][_0x423f('0x23')]);_0x4b70dc[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x4ab25c[_0x423f('0x3d')][_0x423f('0x20')]);}return _0x17465a[_0x423f('0xbe')](_0x4b70dc);}})[_0x423f('0x2a')](function(_0x48779d){if(_0x48779d){return _0x48779d?{'count':_0x8ceccd,'rows':_0x48779d}:null;}})[_0x423f('0x2a')](respondWithResult(_0x4eb1e8,null))[_0x423f('0x52')](handleError(_0x4eb1e8,null));};exports[_0x423f('0xbf')]=function(_0x269708,_0x429631,_0x4e0a65){var _0x3faed5,_0x13932e;return db[_0x423f('0x38')]['find']({'where':{'id':_0x269708[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x429631,null))[_0x423f('0x2a')](function(_0x2d5639){if(_0x2d5639){_0x13932e=_0x2d5639;return _0x2d5639[_0x423f('0xbf')](_0x269708[_0x423f('0x56')][_0x423f('0x9a')],_[_0x423f('0x61')](_0x269708[_0x423f('0x56')],[_0x423f('0x9a'),'id'])||{});}return null;})[_0x423f('0x9b')](function(_0x55ab6c){var _0x3119b2;_0x3faed5=_0x55ab6c||[];var _0x182be3=[];if(_0x55ab6c){for(var _0x421731=0x0;_0x421731<_0x55ab6c[_0x423f('0x43')];_0x421731+=0x1){var _0x307c3b=_0x55ab6c[_0x421731][_0x423f('0x2c')]({'plain':!![]});_0x3119b2=squel[_0x423f('0xa5')]()[_0x423f('0xa6')](_0x423f('0xc0'))[_0x423f('0xb3')]([_0x423f('0xa8'),'ContactId',_0x423f('0xaa'),'VoiceQueueId',_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()[_0x423f('0x8a')]('phone',_0x423f('0xa8'))['field']('id',_0x423f('0xa9'))['field'](_0x307c3b[_0x423f('0xab')][_0x423f('0x91')](),_0x423f('0xaa'))[_0x423f('0x8a')](_0x269708[_0x423f('0x54')]['id']['toString'](),_0x423f('0x68'))[_0x423f('0x8a')](_0x423f('0xc1'),'createdAt')['field'](_0x423f('0xc1'),_0x423f('0x62'))[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')](_0x423f('0xb5'))[_0x423f('0x48')](_0x423f('0xb6'),_0x307c3b[_0x423f('0xab')][_0x423f('0x91')]())[_0x423f('0x48')](_0x423f('0xad')))['toString']();_0x182be3[_0x423f('0x9c')](db[_0x423f('0x7b')][_0x423f('0x3d')](_0x3119b2));}return BPromise[_0x423f('0x95')](_0x182be3);}})[_0x423f('0x2a')](function(){return _0x3faed5;})[_0x423f('0x2a')](respondWithResult(_0x429631,null))[_0x423f('0x52')](handleError(_0x429631,null));};exports['removeBlackLists']=function(_0x59452b,_0x2d29f9,_0x1b3602){return db[_0x423f('0x38')]['find']({'where':{'id':_0x59452b[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2d29f9,null))[_0x423f('0x2a')](function(_0x4b0bfb){if(_0x4b0bfb){return _0x4b0bfb[_0x423f('0xc2')](_0x59452b[_0x423f('0x3d')][_0x423f('0x9a')]);}})[_0x423f('0x2a')](function(_0xd27f24){if(_0xd27f24){return db[_0x423f('0x6e')]['destroy']({'where':{'ListId':_0x59452b[_0x423f('0x3d')][_0x423f('0x9a')],'VoiceQueueId':_0x59452b[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](function(){return _0xd27f24;});}})[_0x423f('0x2a')](respondWithStatusCode(_0x2d29f9,null))['catch'](handleError(_0x2d29f9,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3e092ef..36c39ff 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 _0x0215=['hook','events','../../mysqldb','VoiceQueue','setMaxListeners','update','emit'];(function(_0x430890,_0x36e31e){var _0x261d21=function(_0x1ed380){while(--_0x1ed380){_0x430890['push'](_0x430890['shift']());}};_0x261d21(++_0x36e31e);}(_0x0215,0x14a));var _0x5021=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0x0215[_0x4c06a3];return _0x7ff53c;};'use strict';var EventEmitter=require(_0x5021('0x0'));var VoiceQueue=require(_0x5021('0x1'))['db'][_0x5021('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5021('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5021('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2d0acd){return function(_0x47f84a,_0x5ea79e,_0x66dd31){VoiceQueueEvents[_0x5021('0x5')](_0x2d0acd+':'+_0x47f84a['id'],_0x47f84a);VoiceQueueEvents['emit'](_0x2d0acd,_0x47f84a);_0x66dd31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x5021('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xebc7=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebc7,0x175));var _0x7ebc=function(_0x384abd,_0x4cb917){_0x384abd=_0x384abd-0x0;var _0x2de743=_0xebc7[_0x384abd];return _0x2de743;};'use strict';var EventEmitter=require(_0x7ebc('0x0'));var VoiceQueue=require(_0x7ebc('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7ebc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7ebc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ed697){return function(_0x575de8,_0x201b6b,_0x163bd9){VoiceQueueEvents[_0x7ebc('0x4')](_0x4ed697+':'+_0x575de8['id'],_0x575de8);VoiceQueueEvents[_0x7ebc('0x4')](_0x4ed697,_0x575de8);_0x163bd9(null);};}for(var e in events){if(events[_0x7ebc('0x5')](e)){var event=events[e];VoiceQueue[_0x7ebc('0x6')](e,emitEvent(event));}}module[_0x7ebc('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 98c0996..2fed3bc 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0xf6991,_0x3cc44b){var _0x96ee6e=function(_0x13447b){while(--_0x13447b){_0xf6991['push'](_0xf6991['shift']());}};_0x96ee6e(++_0x3cc44b);}(_0x34e8,0x12c));var _0x834e=function(_0x42f8bd,_0xe10252){_0x42f8bd=_0x42f8bd-0x0;var _0x479be6=_0x34e8[_0x42f8bd];return _0x479be6;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x55ca,0x126));var _0xa55c=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x55ca[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 47978c0..faf9626 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 _0x343b=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','map','model','include','info','debug','stringify','ShowVoiceQueue','find','catch','util','bluebird','randomstring','ioredis'];(function(_0x4cbce7,_0x139ba2){var _0x127bf5=function(_0x50eaf7){while(--_0x50eaf7){_0x4cbce7['push'](_0x4cbce7['shift']());}};_0x127bf5(++_0x139ba2);}(_0x343b,0xec));var _0xb343=function(_0x20b9fc,_0x5dab92){_0x20b9fc=_0x20b9fc-0x0;var _0x511a2b=_0x343b[_0x20b9fc];return _0x511a2b;};'use strict';var _=require('lodash');var util=require(_0xb343('0x0'));var moment=require('moment');var BPromise=require(_0xb343('0x1'));var rs=require(_0xb343('0x2'));var fs=require('fs');var Redis=require(_0xb343('0x3'));var db=require(_0xb343('0x4'))['db'];var utils=require(_0xb343('0x5'));var logger=require(_0xb343('0x6'))(_0xb343('0x7'));var config=require('../../config/environment');var jayson=require(_0xb343('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb343('0x9')]=_[_0xb343('0xa')](config[_0xb343('0x9')],{'host':_0xb343('0xb'),'port':0x18eb});var socket=require(_0xb343('0xc'))(new Redis(config[_0xb343('0x9')]));require(_0xb343('0xd'))[_0xb343('0xe')](socket);function respondWithRpcPromise(_0x4c609f,_0x42b34c,_0x5395d8){return new BPromise(function(_0x313b50,_0x2c3a91){return client[_0xb343('0xf')](_0x4c609f,_0x5395d8)[_0xb343('0x10')](function(_0x5c8d12){logger['info'](_0xb343('0x11'),_0x42b34c,'request\x20sent');logger['debug'](_0xb343('0x12'),_0x42b34c,_0xb343('0x13'),JSON['stringify'](_0x5c8d12));if(_0x5c8d12[_0xb343('0x14')]){if(_0x5c8d12[_0xb343('0x14')][_0xb343('0x15')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x42b34c,_0x5c8d12['error']['message']);return _0x2c3a91(_0x5c8d12['error'][_0xb343('0x16')]);}logger[_0xb343('0x14')](_0xb343('0x11'),_0x42b34c,_0x5c8d12[_0xb343('0x14')][_0xb343('0x16')]);return _0x313b50(_0x5c8d12[_0xb343('0x14')][_0xb343('0x16')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x42b34c,_0xb343('0x13'));_0x313b50(_0x5c8d12[_0xb343('0x17')][_0xb343('0x16')]);}})['catch'](function(_0x49aaa5){logger['error'](_0xb343('0x11'),_0x42b34c,_0x49aaa5);_0x2c3a91(_0x49aaa5);});});}exports[_0xb343('0x18')]=function(_0x546096){var _0x33b5b4=this;return new Promise(function(_0x455038,_0x4bbf7){return db[_0xb343('0x19')]['findAll']({'raw':_0x546096[_0xb343('0x1a')]?_0x546096[_0xb343('0x1a')][_0xb343('0x1b')]===undefined?!![]:![]:!![],'where':_0x546096['options']?_0x546096['options'][_0xb343('0x1c')]||null:null,'attributes':_0x546096[_0xb343('0x1a')]?_0x546096[_0xb343('0x1a')][_0xb343('0x1d')]||null:null,'limit':_0x546096[_0xb343('0x1a')]?_0x546096[_0xb343('0x1a')][_0xb343('0x1e')]||null:null,'include':_0x546096[_0xb343('0x1a')]?_0x546096[_0xb343('0x1a')]['include']?_[_0xb343('0x1f')](_0x546096[_0xb343('0x1a')]['include'],function(_0x4d6f2a){return{'model':db[_0x4d6f2a[_0xb343('0x20')]],'as':_0x4d6f2a['as'],'attributes':_0x4d6f2a[_0xb343('0x1d')],'include':_0x4d6f2a['include']?_[_0xb343('0x1f')](_0x4d6f2a[_0xb343('0x21')],function(_0x461046){return{'model':db[_0x461046[_0xb343('0x20')]],'as':_0x461046['as'],'attributes':_0x461046[_0xb343('0x1d')],'include':_0x461046[_0xb343('0x21')]?_[_0xb343('0x1f')](_0x461046['include'],function(_0x1e5d5b){return{'model':db[_0x1e5d5b['model']],'as':_0x1e5d5b['as'],'attributes':_0x1e5d5b[_0xb343('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb343('0x10')](function(_0x5a948b){logger[_0xb343('0x22')]('GetVoiceQueue',_0x546096);logger[_0xb343('0x23')](_0xb343('0x18'),_0x546096,JSON[_0xb343('0x24')](_0x5a948b));_0x455038(_0x5a948b);})['catch'](function(_0x2be6f8){logger['error'](_0xb343('0x18'),_0x2be6f8[_0xb343('0x16')],_0x546096);_0x4bbf7(_0x33b5b4[_0xb343('0x14')](0x1f4,_0x2be6f8[_0xb343('0x16')]));});});};exports[_0xb343('0x25')]=function(_0x4d3533){var _0x51432b=this;return new Promise(function(_0x4f3df9,_0x313c18){return db[_0xb343('0x19')][_0xb343('0x26')]({'raw':_0x4d3533[_0xb343('0x1a')]?_0x4d3533[_0xb343('0x1a')][_0xb343('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d3533['options']?_0x4d3533[_0xb343('0x1a')][_0xb343('0x1c')]||null:null,'attributes':_0x4d3533[_0xb343('0x1a')]?_0x4d3533[_0xb343('0x1a')][_0xb343('0x1d')]||null:null,'include':_0x4d3533[_0xb343('0x1a')]?_0x4d3533[_0xb343('0x1a')][_0xb343('0x21')]?_[_0xb343('0x1f')](_0x4d3533['options']['include'],function(_0x185f30){return{'model':db[_0x185f30['model']],'as':_0x185f30['as'],'attributes':_0x185f30[_0xb343('0x1d')],'include':_0x185f30[_0xb343('0x21')]?_[_0xb343('0x1f')](_0x185f30[_0xb343('0x21')],function(_0x1b5f8a){return{'model':db[_0x1b5f8a[_0xb343('0x20')]],'as':_0x1b5f8a['as'],'attributes':_0x1b5f8a[_0xb343('0x1d')],'include':_0x1b5f8a[_0xb343('0x21')]?_[_0xb343('0x1f')](_0x1b5f8a[_0xb343('0x21')],function(_0x4f7de8){return{'model':db[_0x4f7de8['model']],'as':_0x4f7de8['as'],'attributes':_0x4f7de8[_0xb343('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb343('0x10')](function(_0xfdaad3){logger[_0xb343('0x22')]('ShowVoiceQueue',_0x4d3533);logger['debug']('ShowVoiceQueue',_0x4d3533,JSON[_0xb343('0x24')](_0xfdaad3));_0x4f3df9(_0xfdaad3);})[_0xb343('0x27')](function(_0x40b4c6){logger['error'](_0xb343('0x25'),_0x40b4c6['message'],_0x4d3533);_0x313c18(_0x51432b[_0xb343('0x14')](0x1f4,_0x40b4c6[_0xb343('0x16')]));});});}; \ No newline at end of file +var _0x016b=['raw','limit','include','model','attributes','ShowVoiceQueue','VoiceQueue','find','map','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueue','options'];(function(_0x1b7ea6,_0x195a62){var _0x4fcea6=function(_0x29ace1){while(--_0x29ace1){_0x1b7ea6['push'](_0x1b7ea6['shift']());}};_0x4fcea6(++_0x195a62);}(_0x016b,0x131));var _0xb016=function(_0x543ce1,_0x483c7a){_0x543ce1=_0x543ce1-0x0;var _0x489704=_0x016b[_0x543ce1];return _0x489704;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb016('0x0'));var rs=require(_0xb016('0x1'));var fs=require('fs');var Redis=require(_0xb016('0x2'));var db=require(_0xb016('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb016('0x4'));var config=require(_0xb016('0x5'));var jayson=require(_0xb016('0x6'));var client=jayson['client'][_0xb016('0x7')]({'port':0x232a});config['redis']=_[_0xb016('0x8')](config['redis'],{'host':_0xb016('0x9'),'port':0x18eb});var socket=require(_0xb016('0xa'))(new Redis(config['redis']));require(_0xb016('0xb'))[_0xb016('0xc')](socket);function respondWithRpcPromise(_0x2eab00,_0xd05d75,_0x16abe5){return new BPromise(function(_0x29ff45,_0x341527){return client[_0xb016('0xd')](_0x2eab00,_0x16abe5)[_0xb016('0xe')](function(_0x58ae18){logger[_0xb016('0xf')](_0xb016('0x10'),_0xd05d75,_0xb016('0x11'));logger[_0xb016('0x12')](_0xb016('0x13'),_0xd05d75,_0xb016('0x11'),JSON[_0xb016('0x14')](_0x58ae18));if(_0x58ae18['error']){if(_0x58ae18['error'][_0xb016('0x15')]===0x1f4){logger[_0xb016('0x16')](_0xb016('0x10'),_0xd05d75,_0x58ae18[_0xb016('0x16')][_0xb016('0x17')]);return _0x341527(_0x58ae18[_0xb016('0x16')]['message']);}logger[_0xb016('0x16')](_0xb016('0x10'),_0xd05d75,_0x58ae18['error'][_0xb016('0x17')]);return _0x29ff45(_0x58ae18[_0xb016('0x16')][_0xb016('0x17')]);}else{logger[_0xb016('0xf')](_0xb016('0x10'),_0xd05d75,_0xb016('0x11'));_0x29ff45(_0x58ae18[_0xb016('0x18')][_0xb016('0x17')]);}})[_0xb016('0x19')](function(_0xf79e7f){logger['error'](_0xb016('0x10'),_0xd05d75,_0xf79e7f);_0x341527(_0xf79e7f);});});}exports[_0xb016('0x1a')]=function(_0x320059){var _0x56482e=this;return new Promise(function(_0x1a2f44,_0x8a9a2c){return db['VoiceQueue']['findAll']({'raw':_0x320059[_0xb016('0x1b')]?_0x320059[_0xb016('0x1b')][_0xb016('0x1c')]===undefined?!![]:![]:!![],'where':_0x320059['options']?_0x320059[_0xb016('0x1b')]['where']||null:null,'attributes':_0x320059[_0xb016('0x1b')]?_0x320059[_0xb016('0x1b')]['attributes']||null:null,'limit':_0x320059['options']?_0x320059[_0xb016('0x1b')][_0xb016('0x1d')]||null:null,'include':_0x320059[_0xb016('0x1b')]?_0x320059[_0xb016('0x1b')][_0xb016('0x1e')]?_['map'](_0x320059[_0xb016('0x1b')]['include'],function(_0x49c64e){return{'model':db[_0x49c64e[_0xb016('0x1f')]],'as':_0x49c64e['as'],'attributes':_0x49c64e[_0xb016('0x20')],'include':_0x49c64e['include']?_['map'](_0x49c64e[_0xb016('0x1e')],function(_0x948853){return{'model':db[_0x948853['model']],'as':_0x948853['as'],'attributes':_0x948853[_0xb016('0x20')],'include':_0x948853[_0xb016('0x1e')]?_['map'](_0x948853[_0xb016('0x1e')],function(_0x57d40b){return{'model':db[_0x57d40b['model']],'as':_0x57d40b['as'],'attributes':_0x57d40b[_0xb016('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb016('0xe')](function(_0x49ea7e){logger[_0xb016('0xf')](_0xb016('0x1a'),_0x320059);logger['debug'](_0xb016('0x1a'),_0x320059,JSON[_0xb016('0x14')](_0x49ea7e));_0x1a2f44(_0x49ea7e);})[_0xb016('0x19')](function(_0x4a638c){logger[_0xb016('0x16')](_0xb016('0x1a'),_0x4a638c[_0xb016('0x17')],_0x320059);_0x8a9a2c(_0x56482e[_0xb016('0x16')](0x1f4,_0x4a638c[_0xb016('0x17')]));});});};exports[_0xb016('0x21')]=function(_0x6f1264){var _0x27eddb=this;return new Promise(function(_0x3f7cef,_0x2e2fc8){return db[_0xb016('0x22')][_0xb016('0x23')]({'raw':_0x6f1264[_0xb016('0x1b')]?_0x6f1264['options'][_0xb016('0x1c')]===undefined?!![]:![]:!![],'where':_0x6f1264[_0xb016('0x1b')]?_0x6f1264['options']['where']||null:null,'attributes':_0x6f1264[_0xb016('0x1b')]?_0x6f1264[_0xb016('0x1b')][_0xb016('0x20')]||null:null,'include':_0x6f1264['options']?_0x6f1264[_0xb016('0x1b')]['include']?_['map'](_0x6f1264['options'][_0xb016('0x1e')],function(_0x49d72e){return{'model':db[_0x49d72e[_0xb016('0x1f')]],'as':_0x49d72e['as'],'attributes':_0x49d72e['attributes'],'include':_0x49d72e['include']?_[_0xb016('0x24')](_0x49d72e[_0xb016('0x1e')],function(_0x521bb8){return{'model':db[_0x521bb8[_0xb016('0x1f')]],'as':_0x521bb8['as'],'attributes':_0x521bb8[_0xb016('0x20')],'include':_0x521bb8[_0xb016('0x1e')]?_['map'](_0x521bb8[_0xb016('0x1e')],function(_0x7b5245){return{'model':db[_0x7b5245['model']],'as':_0x7b5245['as'],'attributes':_0x7b5245[_0xb016('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb016('0xe')](function(_0x55b942){logger['info']('ShowVoiceQueue',_0x6f1264);logger[_0xb016('0x12')](_0xb016('0x21'),_0x6f1264,JSON[_0xb016('0x14')](_0x55b942));_0x3f7cef(_0x55b942);})[_0xb016('0x19')](function(_0x3c9722){logger[_0xb016('0x16')](_0xb016('0x21'),_0x3c9722[_0xb016('0x17')],_0x6f1264);_0x2e2fc8(_0x27eddb[_0xb016('0x16')](0x1f4,_0x3c9722[_0xb016('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2737ac1..70c1011 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 _0x5fe4=['voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x61d9e4,_0x20b01b){var _0x4bc88f=function(_0x17a2ee){while(--_0x17a2ee){_0x61d9e4['push'](_0x61d9e4['shift']());}};_0x4bc88f(++_0x20b01b);}(_0x5fe4,0x121));var _0x45fe=function(_0x1e8c3d,_0x378458){_0x1e8c3d=_0x1e8c3d-0x0;var _0x5e29bd=_0x5fe4[_0x1e8c3d];return _0x5e29bd;};'use strict';var VoiceQueueEvents=require(_0x45fe('0x0'));var events=[_0x45fe('0x1'),_0x45fe('0x2'),_0x45fe('0x3')];function createListener(_0x432554,_0x5e9a16){return function(_0x5e806b){_0x5e9a16[_0x45fe('0x4')](_0x432554,_0x5e806b);};}function removeListener(_0x209b27,_0x89b12){return function(){VoiceQueueEvents['removeListener'](_0x209b27,_0x89b12);};}exports['register']=function(_0x3df7db){for(var _0x3e44d6=0x0,_0x2115bd=events['length'];_0x3e44d6<_0x2115bd;_0x3e44d6++){var _0x4e0943=events[_0x3e44d6];var _0x3f13e0=createListener(_0x45fe('0x5')+_0x4e0943,_0x3df7db);VoiceQueueEvents['on'](_0x4e0943,_0x3f13e0);}}; \ No newline at end of file +var _0x2be4=['removeListener','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x1ed258,_0x46a285){var _0x3ad256=function(_0x192bf9){while(--_0x192bf9){_0x1ed258['push'](_0x1ed258['shift']());}};_0x3ad256(++_0x46a285);}(_0x2be4,0xcd));var _0x42be=function(_0x2252f0,_0x28a026){_0x2252f0=_0x2252f0-0x0;var _0x2f4ccb=_0x2be4[_0x2252f0];return _0x2f4ccb;};'use strict';var VoiceQueueEvents=require(_0x42be('0x0'));var events=[_0x42be('0x1'),_0x42be('0x2'),_0x42be('0x3')];function createListener(_0x3cb8c7,_0x5592ea){return function(_0x89b278){_0x5592ea[_0x42be('0x4')](_0x3cb8c7,_0x89b278);};}function removeListener(_0x3881df,_0x3d5ff3){return function(){VoiceQueueEvents[_0x42be('0x5')](_0x3881df,_0x3d5ff3);};}exports['register']=function(_0x1412ba){for(var _0x56f708=0x0,_0x267510=events['length'];_0x56f708<_0x267510;_0x56f708++){var _0x1d81d4=events[_0x56f708];var _0x194887=createListener(_0x42be('0x6')+_0x1d81d4,_0x1412ba);VoiceQueueEvents['on'](_0x1d81d4,_0x194887);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 95ad24c..87d2ec1 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 _0xd188=['put','update','delete','destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/index','/:id','show','post','create'];(function(_0x30fc2a,_0x52cde9){var _0x46a067=function(_0x28258e){while(--_0x28258e){_0x30fc2a['push'](_0x30fc2a['shift']());}};_0x46a067(++_0x52cde9);}(_0xd188,0x148));var _0x8d18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd188[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8d18('0x0'));var util=require(_0x8d18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d18('0x2'));var router=express[_0x8d18('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8d18('0x4'));var config=require(_0x8d18('0x5'));var controller=require(_0x8d18('0x6'));router[_0x8d18('0x7')]('/',auth[_0x8d18('0x8')](),controller['index']);router[_0x8d18('0x7')]('/describe',auth[_0x8d18('0x8')](),controller['describe']);router[_0x8d18('0x7')](_0x8d18('0x9'),auth[_0x8d18('0x8')](),controller['getVoiceQueuesReport']);router[_0x8d18('0x7')](_0x8d18('0xa'),auth[_0x8d18('0x8')](),controller[_0x8d18('0xb')]);router[_0x8d18('0xc')]('/',auth[_0x8d18('0x8')](),controller[_0x8d18('0xd')]);router[_0x8d18('0xe')](_0x8d18('0xa'),auth[_0x8d18('0x8')](),controller[_0x8d18('0xf')]);router[_0x8d18('0x10')]('/:id',auth[_0x8d18('0x8')](),controller[_0x8d18('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfc53=['create','put','/:id','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','/index','isAuthenticated','getVoiceQueuesReport','show'];(function(_0x53dc45,_0x51627a){var _0x5caac6=function(_0x301a74){while(--_0x301a74){_0x53dc45['push'](_0x53dc45['shift']());}};_0x5caac6(++_0x51627a);}(_0xfc53,0x132));var _0x3fc5=function(_0x50d324,_0x1022fa){_0x50d324=_0x50d324-0x0;var _0x5469f7=_0xfc53[_0x50d324];return _0x5469f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3fc5('0x0'));var timeout=require(_0x3fc5('0x1'));var express=require('express');var router=express[_0x3fc5('0x2')]();var fs_extra=require(_0x3fc5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3fc5('0x4'));var config=require(_0x3fc5('0x5'));var controller=require(_0x3fc5('0x6'));router[_0x3fc5('0x7')]('/',auth['isAuthenticated'](),controller[_0x3fc5('0x8')]);router[_0x3fc5('0x7')](_0x3fc5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x3fc5('0x7')](_0x3fc5('0xa'),auth[_0x3fc5('0xb')](),controller[_0x3fc5('0xc')]);router[_0x3fc5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3fc5('0xd')]);router['post']('/',auth[_0x3fc5('0xb')](),controller[_0x3fc5('0xe')]);router[_0x3fc5('0xf')](_0x3fc5('0x10'),auth[_0x3fc5('0xb')](),controller[_0x3fc5('0x11')]);router[_0x3fc5('0x12')](_0x3fc5('0x10'),auth[_0x3fc5('0xb')](),controller[_0x3fc5('0x13')]);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 47b92cf..6edc7aa 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 _0xfc65=['INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue','holdtime'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0xfc65,0xd7));var _0x5fc6=function(_0x328002,_0x2a1c66){_0x328002=_0x328002-0x0;var _0xc2569b=_0xfc65[_0x328002];return _0xc2569b;};'use strict';var Sequelize=require(_0x5fc6('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x5fc6('0x1')]},'uniqueid':{'type':Sequelize[_0x5fc6('0x1')]},'calleridnum':{'type':Sequelize[_0x5fc6('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xd38393){var _0x4a1458=moment(_0xd38393);var _0x17bdbe=moment(this['getDataValue'](_0x5fc6('0x2')))[_0x5fc6('0x3')](_0x5fc6('0x4'));var _0x1124c1=_0x4a1458['diff'](_0x17bdbe,_0x5fc6('0x5'));this['setDataValue'](_0x5fc6('0x6'),_0xd38393);this[_0x5fc6('0x7')](_0x5fc6('0x8'),_0x1124c1||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x5fc6('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x5fc6('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5fc6('0xb')]},'queuecallercomplete':{'type':Sequelize[_0x5fc6('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5fc6('0xb')]},'queuecallerexit':{'type':Sequelize[_0x5fc6('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5fc6('0xb')]},'queuecallerexitreason':{'type':Sequelize[_0x5fc6('0x1')],'comment':_0x5fc6('0xc')},'originalposition':{'type':Sequelize[_0x5fc6('0x9')]},'channel':{'type':Sequelize[_0x5fc6('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5fc6('0x1')]},'connectedlinename':{'type':Sequelize[_0x5fc6('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5fc6('0x1')]},'exten':{'type':Sequelize[_0x5fc6('0x1')]},'priority':{'type':Sequelize[_0x5fc6('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5fc6('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5fc6('0x1')]},'transfer':{'type':Sequelize[_0x5fc6('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5fc6('0x1')],'comment':_0x5fc6('0xd')},'transferexten':{'type':Sequelize[_0x5fc6('0x1')]},'transferuniqueid':{'type':Sequelize[_0x5fc6('0x1')]},'disposition':{'type':Sequelize[_0x5fc6('0x1')]},'secondDisposition':{'type':Sequelize[_0x5fc6('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x5fc6('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdb8e=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x324fe8,_0x1ccb46){var _0x4a1cd9=function(_0x506af2){while(--_0x506af2){_0x324fe8['push'](_0x324fe8['shift']());}};_0x4a1cd9(++_0x1ccb46);}(_0xdb8e,0x1dc));var _0xedb8=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xdb8e[_0x29e3b6];return _0x55d4b0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xedb8('0x0')]={'type':{'type':Sequelize[_0xedb8('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xedb8('0x1')]},'calleridname':{'type':Sequelize[_0xedb8('0x1')]},'queue':{'type':Sequelize[_0xedb8('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xedb8('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x41bff6){var _0x442dad=moment(_0x41bff6);var _0x1c19bf=moment(this[_0xedb8('0x3')](_0xedb8('0x4')))['format'](_0xedb8('0x5'));var _0x4da871=_0x442dad[_0xedb8('0x6')](_0x1c19bf,_0xedb8('0x7'));this[_0xedb8('0x8')](_0xedb8('0x9'),_0x41bff6);this[_0xedb8('0x8')]('holdtime',_0x4da871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xedb8('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xedb8('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xedb8('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xedb8('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xedb8('0x1')],'comment':_0xedb8('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xedb8('0x1')]},'connectedlinenum':{'type':Sequelize[_0xedb8('0x1')]},'connectedlinename':{'type':Sequelize[_0xedb8('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xedb8('0x1')]},'exten':{'type':Sequelize[_0xedb8('0x1')]},'priority':{'type':Sequelize[_0xedb8('0x1')]},'holdtime':{'type':Sequelize[_0xedb8('0xa')]},'mohtime':{'type':Sequelize[_0xedb8('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xedb8('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xedb8('0x1')]},'transfer':{'type':Sequelize[_0xedb8('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xedb8('0x1')],'comment':_0xedb8('0xd')},'transferexten':{'type':Sequelize[_0xedb8('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xedb8('0x1')]},'secondDisposition':{'type':Sequelize[_0xedb8('0x1')]},'thirdDisposition':{'type':Sequelize[_0xedb8('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 d6ee6a0..8ad8f7e 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 _0xbc4d=['then','destroy','error','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','catch','params','create','body','find','describe','getVoiceQueuesReport','rawAttributes','hasOwnProperty','rows','eml-format','rimraf','zip-dir','request-promise','moment','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/environment','defaults','redis','./voiceQueueReport.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xbc4d,0x17d));var _0xdbc4=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0xbc4d[_0x516927];return _0x30749b;};'use strict';var emlformat=require(_0xdbc4('0x0'));var rimraf=require(_0xdbc4('0x1'));var zipdir=require(_0xdbc4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbc4('0x3'));var moment=require(_0xdbc4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbc4('0x5'));var util=require(_0xdbc4('0x6'));var path=require(_0xdbc4('0x7'));var sox=require(_0xdbc4('0x8'));var csv=require(_0xdbc4('0x9'));var ejs=require(_0xdbc4('0xa'));var fs=require('fs');var fs_extra=require(_0xdbc4('0xb'));var _=require(_0xdbc4('0xc'));var squel=require(_0xdbc4('0xd'));var crypto=require(_0xdbc4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdbc4('0xf'));var toCsv=require(_0xdbc4('0x9'));var querystring=require(_0xdbc4('0x10'));var Papa=require(_0xdbc4('0x11'));var Redis=require(_0xdbc4('0x12'));var authService=require(_0xdbc4('0x13'));var qs=require(_0xdbc4('0x14'));var as=require(_0xdbc4('0x15'));var hardwareService=require(_0xdbc4('0x16'));var logger=require(_0xdbc4('0x17'))(_0xdbc4('0x18'));var utils=require('../../config/utils');var config=require(_0xdbc4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdbc4('0x1a')](config[_0xdbc4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbc4('0x1b')]));require(_0xdbc4('0x1c'))[_0xdbc4('0x1d')](socket);function respondWithStatusCode(_0x197498,_0x39fc07){_0x39fc07=_0x39fc07||0xcc;return function(_0x62bdb5){if(_0x62bdb5){return _0x197498[_0xdbc4('0x1e')](_0x39fc07);}return _0x197498[_0xdbc4('0x1f')](_0x39fc07)[_0xdbc4('0x20')]();};}function respondWithResult(_0xcbed95,_0x4ea03d){_0x4ea03d=_0x4ea03d||0xc8;return function(_0xce8843){if(_0xce8843){return _0xcbed95[_0xdbc4('0x1f')](_0x4ea03d)['json'](_0xce8843);}};}function respondWithFilteredResult(_0x457191,_0x282865){return function(_0x49cc60){if(_0x49cc60){var _0x30c34d=typeof _0x282865['offset']===_0xdbc4('0x21')&&typeof _0x282865['limit']===_0xdbc4('0x21');var _0x142457=_0x49cc60[_0xdbc4('0x22')];var _0xc55f96=_0x30c34d?0x0:_0x282865[_0xdbc4('0x23')];var _0x22122c=_0x30c34d?_0x49cc60['count']:_0x282865[_0xdbc4('0x23')]+_0x282865[_0xdbc4('0x24')];var _0x34b9e;if(_0x22122c>=_0x142457){_0x22122c=_0x142457;_0x34b9e=0xc8;}else{_0x34b9e=0xce;}_0x457191[_0xdbc4('0x1f')](_0x34b9e);return _0x457191[_0xdbc4('0x25')](_0xdbc4('0x26'),_0xc55f96+'-'+_0x22122c+'/'+_0x142457)[_0xdbc4('0x27')](_0x49cc60);}return null;};}function patchUpdates(_0x2d222e){return function(_0x28faf4){try{jsonpatch[_0xdbc4('0x28')](_0x28faf4,_0x2d222e,!![]);}catch(_0x19ff81){return BPromise[_0xdbc4('0x29')](_0x19ff81);}return _0x28faf4[_0xdbc4('0x2a')]();};}function saveUpdates(_0x284d68,_0x3946fd){return function(_0x467a32){if(_0x467a32){return _0x467a32[_0xdbc4('0x2b')](_0x284d68)[_0xdbc4('0x2c')](function(_0x46d5d9){return _0x46d5d9;});}return null;};}function removeEntity(_0x3d69d9,_0x187cf2){return function(_0xb661d3){if(_0xb661d3){return _0xb661d3[_0xdbc4('0x2d')]()[_0xdbc4('0x2c')](function(){_0x3d69d9[_0xdbc4('0x1f')](0xcc)[_0xdbc4('0x20')]();});}};}function handleEntityNotFound(_0x1f4efb,_0x111a38){return function(_0x5803b9){if(!_0x5803b9){_0x1f4efb['sendStatus'](0x194);}return _0x5803b9;};}function handleError(_0x34afe6,_0x325a08){_0x325a08=_0x325a08||0x1f4;return function(_0x552790){logger[_0xdbc4('0x2e')](_0x552790['stack']);if(_0x552790[_0xdbc4('0x2f')]){delete _0x552790[_0xdbc4('0x2f')];}_0x34afe6[_0xdbc4('0x1f')](_0x325a08)[_0xdbc4('0x30')](_0x552790);};}exports[_0xdbc4('0x31')]=function(_0x2ced6d,_0x25e68e){var _0xf55a2f={},_0x4c6ddc={},_0x16b83e={'count':0x0,'rows':[]};var _0x43b873=_[_0xdbc4('0x32')](db['VoiceQueueReport']['rawAttributes'],function(_0x445af5){return{'name':_0x445af5[_0xdbc4('0x33')],'type':_0x445af5['type'][_0xdbc4('0x34')]};});_0x4c6ddc['model']=_[_0xdbc4('0x32')](_0x43b873,_0xdbc4('0x2f'));_0x4c6ddc[_0xdbc4('0x35')]=_[_0xdbc4('0x36')](_0x2ced6d[_0xdbc4('0x35')]);_0x4c6ddc[_0xdbc4('0x37')]=_[_0xdbc4('0x38')](_0x4c6ddc[_0xdbc4('0x39')],_0x4c6ddc[_0xdbc4('0x35')]);_0xf55a2f[_0xdbc4('0x3a')]=_[_0xdbc4('0x38')](_0x4c6ddc[_0xdbc4('0x39')],qs[_0xdbc4('0x3b')](_0x2ced6d[_0xdbc4('0x35')][_0xdbc4('0x3b')]));_0xf55a2f[_0xdbc4('0x3a')]=_0xf55a2f[_0xdbc4('0x3a')][_0xdbc4('0x3c')]?_0xf55a2f['attributes']:_0x4c6ddc[_0xdbc4('0x39')];if(!_0x2ced6d[_0xdbc4('0x35')]['hasOwnProperty'](_0xdbc4('0x3d'))){_0xf55a2f[_0xdbc4('0x24')]=qs['limit'](_0x2ced6d['query'][_0xdbc4('0x24')]);_0xf55a2f['offset']=qs[_0xdbc4('0x23')](_0x2ced6d[_0xdbc4('0x35')][_0xdbc4('0x23')]);}_0xf55a2f[_0xdbc4('0x3e')]=qs[_0xdbc4('0x3f')](_0x2ced6d['query']['sort']);_0xf55a2f[_0xdbc4('0x40')]=qs[_0xdbc4('0x37')](_[_0xdbc4('0x41')](_0x2ced6d[_0xdbc4('0x35')],_0x4c6ddc[_0xdbc4('0x37')]),_0x43b873);if(_0x2ced6d['query'][_0xdbc4('0x42')]){_0xf55a2f[_0xdbc4('0x40')]=_[_0xdbc4('0x43')](_0xf55a2f[_0xdbc4('0x40')],{'$or':_[_0xdbc4('0x32')](_0x43b873,function(_0x1425e4){if(_0x1425e4[_0xdbc4('0x44')]!==_0xdbc4('0x45')){var _0x12ab0b={};_0x12ab0b[_0x1425e4['name']]={'$like':'%'+_0x2ced6d[_0xdbc4('0x35')][_0xdbc4('0x42')]+'%'};return _0x12ab0b;}})});}_0xf55a2f=_['merge']({},_0xf55a2f,_0x2ced6d[_0xdbc4('0x46')]);var _0x32b2de={'where':_0xf55a2f[_0xdbc4('0x40')]};return db[_0xdbc4('0x47')][_0xdbc4('0x22')](_0x32b2de)[_0xdbc4('0x2c')](function(_0x55a062){_0x16b83e['count']=_0x55a062;if(_0x2ced6d['query'][_0xdbc4('0x48')]){_0xf55a2f[_0xdbc4('0x49')]=[{'all':!![]}];}return db[_0xdbc4('0x47')][_0xdbc4('0x4a')](_0xf55a2f);})[_0xdbc4('0x2c')](function(_0x10c746){_0x16b83e['rows']=_0x10c746;return _0x16b83e;})[_0xdbc4('0x2c')](respondWithFilteredResult(_0x25e68e,_0xf55a2f))[_0xdbc4('0x4b')](handleError(_0x25e68e,null));};exports['show']=function(_0x44f218,_0x4d9380){var _0x21a5ca={'raw':![],'where':{'id':_0x44f218[_0xdbc4('0x4c')]['id']}},_0x2e7dc8={};_0x2e7dc8['model']=_[_0xdbc4('0x36')](db['VoiceQueueReport']['rawAttributes']);_0x2e7dc8[_0xdbc4('0x35')]=_[_0xdbc4('0x36')](_0x44f218[_0xdbc4('0x35')]);_0x2e7dc8[_0xdbc4('0x37')]=_[_0xdbc4('0x38')](_0x2e7dc8['model'],_0x2e7dc8['query']);_0x21a5ca[_0xdbc4('0x3a')]=_[_0xdbc4('0x38')](_0x2e7dc8[_0xdbc4('0x39')],qs[_0xdbc4('0x3b')](_0x44f218['query'][_0xdbc4('0x3b')]));_0x21a5ca[_0xdbc4('0x3a')]=_0x21a5ca[_0xdbc4('0x3a')][_0xdbc4('0x3c')]?_0x21a5ca[_0xdbc4('0x3a')]:_0x2e7dc8[_0xdbc4('0x39')];if(_0x44f218[_0xdbc4('0x35')][_0xdbc4('0x48')]){_0x21a5ca[_0xdbc4('0x49')]=[{'all':!![]}];}_0x21a5ca=_[_0xdbc4('0x43')]({},_0x21a5ca,_0x44f218[_0xdbc4('0x46')]);return db[_0xdbc4('0x47')]['find'](_0x21a5ca)[_0xdbc4('0x2c')](handleEntityNotFound(_0x4d9380,null))[_0xdbc4('0x2c')](respondWithResult(_0x4d9380,null))[_0xdbc4('0x4b')](handleError(_0x4d9380,null));};exports[_0xdbc4('0x4d')]=function(_0x2e2465,_0x42f731){return db[_0xdbc4('0x47')][_0xdbc4('0x4d')](_0x2e2465[_0xdbc4('0x4e')],{})[_0xdbc4('0x2c')](respondWithResult(_0x42f731,0xc9))[_0xdbc4('0x4b')](handleError(_0x42f731,null));};exports['update']=function(_0x5a9dce,_0x315edc){if(_0x5a9dce[_0xdbc4('0x4e')]['id']){delete _0x5a9dce[_0xdbc4('0x4e')]['id'];}return db[_0xdbc4('0x47')][_0xdbc4('0x4f')]({'where':{'id':_0x5a9dce['params']['id']}})[_0xdbc4('0x2c')](handleEntityNotFound(_0x315edc,null))[_0xdbc4('0x2c')](saveUpdates(_0x5a9dce['body'],null))[_0xdbc4('0x2c')](respondWithResult(_0x315edc,null))['catch'](handleError(_0x315edc,null));};exports[_0xdbc4('0x2d')]=function(_0x2ea7cf,_0x4be0c9){return db[_0xdbc4('0x47')][_0xdbc4('0x4f')]({'where':{'id':_0x2ea7cf[_0xdbc4('0x4c')]['id']}})[_0xdbc4('0x2c')](handleEntityNotFound(_0x4be0c9,null))['then'](removeEntity(_0x4be0c9,null))[_0xdbc4('0x4b')](handleError(_0x4be0c9,null));};exports[_0xdbc4('0x50')]=function(_0x1defb9,_0x56a732){return db[_0xdbc4('0x47')][_0xdbc4('0x50')]()[_0xdbc4('0x2c')](respondWithResult(_0x56a732,null))[_0xdbc4('0x4b')](handleError(_0x56a732,null));};exports[_0xdbc4('0x51')]=function(_0x2d0bbf,_0x29b85b){var _0x5c176d={},_0x2e1a4b={},_0x30d69d={'count':0x0,'rows':[]};_0x2e1a4b['model']=_[_0xdbc4('0x36')](db['VoiceQueueReport'][_0xdbc4('0x52')]);_0x2e1a4b[_0xdbc4('0x35')]=_[_0xdbc4('0x36')](_0x2d0bbf[_0xdbc4('0x35')]);_0x2e1a4b[_0xdbc4('0x37')]=_[_0xdbc4('0x38')](_0x2e1a4b[_0xdbc4('0x39')],_0x2e1a4b[_0xdbc4('0x35')]);_0x5c176d[_0xdbc4('0x3a')]=_['intersection'](_0x2e1a4b[_0xdbc4('0x39')],qs[_0xdbc4('0x3b')](_0x2d0bbf[_0xdbc4('0x35')][_0xdbc4('0x3b')]));_0x5c176d[_0xdbc4('0x3a')]=_0x5c176d[_0xdbc4('0x3a')]['length']?_0x5c176d[_0xdbc4('0x3a')]:_0x2e1a4b['model'];if(!_0x2d0bbf['query'][_0xdbc4('0x53')](_0xdbc4('0x3d'))){_0x5c176d['limit']=qs['limit'](_0x2d0bbf[_0xdbc4('0x35')][_0xdbc4('0x24')]);_0x5c176d[_0xdbc4('0x23')]=qs['offset'](_0x2d0bbf['query']['offset']);}_0x5c176d[_0xdbc4('0x3e')]=qs[_0xdbc4('0x3f')](_0x2d0bbf[_0xdbc4('0x35')]['sort']);_0x5c176d[_0xdbc4('0x40')]=qs[_0xdbc4('0x37')](_[_0xdbc4('0x41')](_0x2d0bbf[_0xdbc4('0x35')],_0x2e1a4b[_0xdbc4('0x37')]));if(_0x2d0bbf[_0xdbc4('0x35')][_0xdbc4('0x42')]){_0x5c176d[_0xdbc4('0x40')]=_[_0xdbc4('0x43')](_0x5c176d['where'],{'$or':_[_0xdbc4('0x32')](_0x5c176d[_0xdbc4('0x3a')],function(_0x24405f){var _0x1ad025={};_0x1ad025[_0x24405f]={'$like':'%'+_0x2d0bbf[_0xdbc4('0x35')]['filter']+'%'};return _0x1ad025;})});}_0x5c176d=_[_0xdbc4('0x43')]({},_0x5c176d,_0x2d0bbf[_0xdbc4('0x46')]);var _0x653085={'where':_0x5c176d[_0xdbc4('0x40')]};return db[_0xdbc4('0x47')]['count'](_0x653085)[_0xdbc4('0x2c')](function(_0x2e66d0){_0x30d69d[_0xdbc4('0x22')]=_0x2e66d0;if(_0x2d0bbf[_0xdbc4('0x35')][_0xdbc4('0x48')]){_0x5c176d[_0xdbc4('0x49')]=[{'all':!![]}];}return db[_0xdbc4('0x47')][_0xdbc4('0x4a')](_0x5c176d);})['then'](function(_0x22f618){_0x30d69d[_0xdbc4('0x54')]=_0x22f618;return _0x30d69d;})['then'](respondWithFilteredResult(_0x29b85b,_0x5c176d,_0xdbc4('0x51')))['catch'](handleError(_0x29b85b,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x6295=['../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','VoiceQueueReport','type','key','model','query','keys','attributes','intersection','length','order','sort','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','fields','merge','create','body','find','params','destroy','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3c4830,_0xea213a){var _0x1ae3a1=function(_0x378642){while(--_0x378642){_0x3c4830['push'](_0x3c4830['shift']());}};_0x1ae3a1(++_0xea213a);}(_0x6295,0xd5));var _0x5629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6295[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5629('0x0'));var rimraf=require(_0x5629('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5629('0x2'));var util=require(_0x5629('0x3'));var path=require(_0x5629('0x4'));var sox=require(_0x5629('0x5'));var csv=require(_0x5629('0x6'));var ejs=require(_0x5629('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5629('0x8'));var squel=require(_0x5629('0x9'));var crypto=require('crypto');var jsforce=require(_0x5629('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5629('0x6'));var querystring=require(_0x5629('0xb'));var Papa=require(_0x5629('0xc'));var Redis=require(_0x5629('0xd'));var authService=require(_0x5629('0xe'));var qs=require(_0x5629('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5629('0x10'));var logger=require(_0x5629('0x11'))('api');var utils=require(_0x5629('0x12'));var config=require(_0x5629('0x13'));var licenseUtil=require(_0x5629('0x14'));var db=require('../../mysqldb')['db'];config[_0x5629('0x15')]=_[_0x5629('0x16')](config[_0x5629('0x15')],{'host':_0x5629('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5629('0x15')]));require(_0x5629('0x18'))[_0x5629('0x19')](socket);function respondWithStatusCode(_0x30782f,_0x154db2){_0x154db2=_0x154db2||0xcc;return function(_0x33e9e9){if(_0x33e9e9){return _0x30782f[_0x5629('0x1a')](_0x154db2);}return _0x30782f[_0x5629('0x1b')](_0x154db2)[_0x5629('0x1c')]();};}function respondWithResult(_0x5af85e,_0x4e5510){_0x4e5510=_0x4e5510||0xc8;return function(_0x3fbb46){if(_0x3fbb46){return _0x5af85e[_0x5629('0x1b')](_0x4e5510)['json'](_0x3fbb46);}};}function respondWithFilteredResult(_0x28215e,_0x232622){return function(_0x211994){if(_0x211994){var _0x384975=typeof _0x232622[_0x5629('0x1d')]===_0x5629('0x1e')&&typeof _0x232622['limit']===_0x5629('0x1e');var _0x1ab978=_0x211994[_0x5629('0x1f')];var _0x50df1f=_0x384975?0x0:_0x232622[_0x5629('0x1d')];var _0x31d3c9=_0x384975?_0x211994['count']:_0x232622[_0x5629('0x1d')]+_0x232622[_0x5629('0x20')];var _0x54e8e5;if(_0x31d3c9>=_0x1ab978){_0x31d3c9=_0x1ab978;_0x54e8e5=0xc8;}else{_0x54e8e5=0xce;}_0x28215e[_0x5629('0x1b')](_0x54e8e5);return _0x28215e['set'](_0x5629('0x21'),_0x50df1f+'-'+_0x31d3c9+'/'+_0x1ab978)[_0x5629('0x22')](_0x211994);}return null;};}function patchUpdates(_0x4a1e33){return function(_0x3ee778){try{jsonpatch[_0x5629('0x23')](_0x3ee778,_0x4a1e33,!![]);}catch(_0x3827b8){return BPromise[_0x5629('0x24')](_0x3827b8);}return _0x3ee778[_0x5629('0x25')]();};}function saveUpdates(_0x233af1,_0x4a0eca){return function(_0x192247){if(_0x192247){return _0x192247[_0x5629('0x26')](_0x233af1)[_0x5629('0x27')](function(_0x862ead){return _0x862ead;});}return null;};}function removeEntity(_0x8bc829,_0x11d529){return function(_0x4764b7){if(_0x4764b7){return _0x4764b7['destroy']()[_0x5629('0x27')](function(){_0x8bc829[_0x5629('0x1b')](0xcc)[_0x5629('0x1c')]();});}};}function handleEntityNotFound(_0x1430ac,_0x29c9a8){return function(_0x17d531){if(!_0x17d531){_0x1430ac[_0x5629('0x1a')](0x194);}return _0x17d531;};}function handleError(_0x387d7f,_0x18abee){_0x18abee=_0x18abee||0x1f4;return function(_0x1d1188){logger[_0x5629('0x28')](_0x1d1188['stack']);if(_0x1d1188[_0x5629('0x29')]){delete _0x1d1188[_0x5629('0x29')];}_0x387d7f['status'](_0x18abee)[_0x5629('0x2a')](_0x1d1188);};}exports[_0x5629('0x2b')]=function(_0x1d5ce3,_0x5deaf8){var _0x4021f0={},_0x31c012={},_0x44b1fa={'count':0x0,'rows':[]};var _0x4fc86a=_[_0x5629('0x2c')](db[_0x5629('0x2d')]['rawAttributes'],function(_0x54f854){return{'name':_0x54f854['fieldName'],'type':_0x54f854[_0x5629('0x2e')][_0x5629('0x2f')]};});_0x31c012[_0x5629('0x30')]=_['map'](_0x4fc86a,_0x5629('0x29'));_0x31c012[_0x5629('0x31')]=_[_0x5629('0x32')](_0x1d5ce3['query']);_0x31c012['filters']=_['intersection'](_0x31c012[_0x5629('0x30')],_0x31c012['query']);_0x4021f0[_0x5629('0x33')]=_[_0x5629('0x34')](_0x31c012[_0x5629('0x30')],qs['fields'](_0x1d5ce3[_0x5629('0x31')]['fields']));_0x4021f0[_0x5629('0x33')]=_0x4021f0[_0x5629('0x33')][_0x5629('0x35')]?_0x4021f0[_0x5629('0x33')]:_0x31c012[_0x5629('0x30')];if(!_0x1d5ce3[_0x5629('0x31')]['hasOwnProperty']('nolimit')){_0x4021f0['limit']=qs[_0x5629('0x20')](_0x1d5ce3[_0x5629('0x31')]['limit']);_0x4021f0['offset']=qs[_0x5629('0x1d')](_0x1d5ce3[_0x5629('0x31')]['offset']);}_0x4021f0[_0x5629('0x36')]=qs[_0x5629('0x37')](_0x1d5ce3['query'][_0x5629('0x37')]);_0x4021f0['where']=qs[_0x5629('0x38')](_['pick'](_0x1d5ce3[_0x5629('0x31')],_0x31c012[_0x5629('0x38')]),_0x4fc86a);if(_0x1d5ce3['query'][_0x5629('0x39')]){_0x4021f0[_0x5629('0x3a')]=_['merge'](_0x4021f0[_0x5629('0x3a')],{'$or':_['map'](_0x4fc86a,function(_0xda2769){if(_0xda2769[_0x5629('0x2e')]!==_0x5629('0x3b')){var _0x2fe2ef={};_0x2fe2ef[_0xda2769['name']]={'$like':'%'+_0x1d5ce3[_0x5629('0x31')]['filter']+'%'};return _0x2fe2ef;}})});}_0x4021f0=_['merge']({},_0x4021f0,_0x1d5ce3[_0x5629('0x3c')]);var _0x185915={'where':_0x4021f0['where']};return db[_0x5629('0x2d')][_0x5629('0x1f')](_0x185915)[_0x5629('0x27')](function(_0x4c55fe){_0x44b1fa[_0x5629('0x1f')]=_0x4c55fe;if(_0x1d5ce3[_0x5629('0x31')][_0x5629('0x3d')]){_0x4021f0[_0x5629('0x3e')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x5629('0x3f')](_0x4021f0);})['then'](function(_0x1d7e82){_0x44b1fa['rows']=_0x1d7e82;return _0x44b1fa;})['then'](respondWithFilteredResult(_0x5deaf8,_0x4021f0))[_0x5629('0x40')](handleError(_0x5deaf8,null));};exports[_0x5629('0x41')]=function(_0x4b5975,_0x52bde5){var _0x561c93={'raw':![],'where':{'id':_0x4b5975['params']['id']}},_0x1fa020={};_0x1fa020[_0x5629('0x30')]=_[_0x5629('0x32')](db[_0x5629('0x2d')][_0x5629('0x42')]);_0x1fa020[_0x5629('0x31')]=_[_0x5629('0x32')](_0x4b5975[_0x5629('0x31')]);_0x1fa020['filters']=_[_0x5629('0x34')](_0x1fa020[_0x5629('0x30')],_0x1fa020[_0x5629('0x31')]);_0x561c93[_0x5629('0x33')]=_[_0x5629('0x34')](_0x1fa020['model'],qs[_0x5629('0x43')](_0x4b5975['query'][_0x5629('0x43')]));_0x561c93[_0x5629('0x33')]=_0x561c93[_0x5629('0x33')]['length']?_0x561c93[_0x5629('0x33')]:_0x1fa020[_0x5629('0x30')];if(_0x4b5975['query'][_0x5629('0x3d')]){_0x561c93[_0x5629('0x3e')]=[{'all':!![]}];}_0x561c93=_[_0x5629('0x44')]({},_0x561c93,_0x4b5975[_0x5629('0x3c')]);return db[_0x5629('0x2d')]['find'](_0x561c93)['then'](handleEntityNotFound(_0x52bde5,null))[_0x5629('0x27')](respondWithResult(_0x52bde5,null))[_0x5629('0x40')](handleError(_0x52bde5,null));};exports[_0x5629('0x45')]=function(_0x536254,_0x5df1fd){return db['VoiceQueueReport']['create'](_0x536254[_0x5629('0x46')],{})[_0x5629('0x27')](respondWithResult(_0x5df1fd,0xc9))[_0x5629('0x40')](handleError(_0x5df1fd,null));};exports[_0x5629('0x26')]=function(_0x37dbe2,_0x41796f){if(_0x37dbe2[_0x5629('0x46')]['id']){delete _0x37dbe2[_0x5629('0x46')]['id'];}return db[_0x5629('0x2d')][_0x5629('0x47')]({'where':{'id':_0x37dbe2[_0x5629('0x48')]['id']}})[_0x5629('0x27')](handleEntityNotFound(_0x41796f,null))[_0x5629('0x27')](saveUpdates(_0x37dbe2[_0x5629('0x46')],null))[_0x5629('0x27')](respondWithResult(_0x41796f,null))[_0x5629('0x40')](handleError(_0x41796f,null));};exports[_0x5629('0x49')]=function(_0x1f0200,_0x4c3c67){return db['VoiceQueueReport']['find']({'where':{'id':_0x1f0200[_0x5629('0x48')]['id']}})[_0x5629('0x27')](handleEntityNotFound(_0x4c3c67,null))[_0x5629('0x27')](removeEntity(_0x4c3c67,null))[_0x5629('0x40')](handleError(_0x4c3c67,null));};exports['describe']=function(_0x2cb4c2,_0x49d913){return db[_0x5629('0x2d')][_0x5629('0x4a')]()[_0x5629('0x27')](respondWithResult(_0x49d913,null))[_0x5629('0x40')](handleError(_0x49d913,null));};exports[_0x5629('0x4b')]=function(_0x38fa50,_0x3332db){var _0xe86ad={},_0x5e8538={},_0x5c339a={'count':0x0,'rows':[]};_0x5e8538[_0x5629('0x30')]=_[_0x5629('0x32')](db[_0x5629('0x2d')]['rawAttributes']);_0x5e8538['query']=_[_0x5629('0x32')](_0x38fa50[_0x5629('0x31')]);_0x5e8538[_0x5629('0x38')]=_[_0x5629('0x34')](_0x5e8538[_0x5629('0x30')],_0x5e8538['query']);_0xe86ad['attributes']=_['intersection'](_0x5e8538[_0x5629('0x30')],qs[_0x5629('0x43')](_0x38fa50['query'][_0x5629('0x43')]));_0xe86ad[_0x5629('0x33')]=_0xe86ad[_0x5629('0x33')]['length']?_0xe86ad[_0x5629('0x33')]:_0x5e8538['model'];if(!_0x38fa50[_0x5629('0x31')][_0x5629('0x4c')]('nolimit')){_0xe86ad[_0x5629('0x20')]=qs[_0x5629('0x20')](_0x38fa50[_0x5629('0x31')]['limit']);_0xe86ad[_0x5629('0x1d')]=qs[_0x5629('0x1d')](_0x38fa50[_0x5629('0x31')][_0x5629('0x1d')]);}_0xe86ad[_0x5629('0x36')]=qs[_0x5629('0x37')](_0x38fa50['query'][_0x5629('0x37')]);_0xe86ad['where']=qs[_0x5629('0x38')](_['pick'](_0x38fa50[_0x5629('0x31')],_0x5e8538[_0x5629('0x38')]));if(_0x38fa50[_0x5629('0x31')][_0x5629('0x39')]){_0xe86ad[_0x5629('0x3a')]=_[_0x5629('0x44')](_0xe86ad['where'],{'$or':_[_0x5629('0x2c')](_0xe86ad[_0x5629('0x33')],function(_0x35f9b9){var _0x1bdffc={};_0x1bdffc[_0x35f9b9]={'$like':'%'+_0x38fa50[_0x5629('0x31')]['filter']+'%'};return _0x1bdffc;})});}_0xe86ad=_[_0x5629('0x44')]({},_0xe86ad,_0x38fa50[_0x5629('0x3c')]);var _0x418176={'where':_0xe86ad[_0x5629('0x3a')]};return db['VoiceQueueReport'][_0x5629('0x1f')](_0x418176)[_0x5629('0x27')](function(_0x1a2c1e){_0x5c339a[_0x5629('0x1f')]=_0x1a2c1e;if(_0x38fa50[_0x5629('0x31')][_0x5629('0x3d')]){_0xe86ad['include']=[{'all':!![]}];}return db[_0x5629('0x2d')][_0x5629('0x3f')](_0xe86ad);})[_0x5629('0x27')](function(_0x4a7f3f){_0x5c339a['rows']=_0x4a7f3f;return _0x5c339a;})[_0x5629('0x27')](respondWithFilteredResult(_0x3332db,_0xe86ad,_0x5629('0x4b')))[_0x5629('0x40')](handleError(_0x3332db,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 851c4a1..d6942f0 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 _0xa6a0=['emit','hook','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x61136,_0x222335){var _0x49f682=function(_0x393dfd){while(--_0x393dfd){_0x61136['push'](_0x61136['shift']());}};_0x49f682(++_0x222335);}(_0xa6a0,0xc2));var _0x0a6a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa6a0[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0a6a('0x0'))['db'][_0x0a6a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0a6a('0x2')](0x0);var events={'afterCreate':_0x0a6a('0x3'),'afterUpdate':_0x0a6a('0x4'),'afterDestroy':_0x0a6a('0x5')};function emitEvent(_0x3bd6d6){return function(_0x38bd50,_0x290c80,_0x40a8c0){VoiceQueueReportEvents[_0x0a6a('0x6')](_0x3bd6d6+':'+_0x38bd50['id'],_0x38bd50);VoiceQueueReportEvents[_0x0a6a('0x6')](_0x3bd6d6,_0x38bd50);_0x40a8c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x0a6a('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x946a=['save','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x946a,0xb5));var _0xa946=function(_0x29c8df,_0xe371c5){_0x29c8df=_0x29c8df-0x0;var _0x35cdb5=_0x946a[_0x29c8df];return _0x35cdb5;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa946('0x0')](0x0);var events={'afterCreate':_0xa946('0x1'),'afterUpdate':'update','afterDestroy':_0xa946('0x2')};function emitEvent(_0x74c67){return function(_0x48f715,_0x292c6d,_0x2e15ec){VoiceQueueReportEvents['emit'](_0x74c67+':'+_0x48f715['id'],_0x48f715);VoiceQueueReportEvents[_0xa946('0x3')](_0x74c67,_0x48f715);_0x2e15ec(null);};}for(var e in events){if(events[_0xa946('0x4')](e)){var event=events[e];VoiceQueueReport[_0xa946('0x5')](e,emitEvent(event));}}module[_0xa946('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 92636b1..c22c2a0 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 _0x7c5d=['../../config/environment','exports','define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3c0e33,_0x4e9903){var _0x48d10c=function(_0x227823){while(--_0x227823){_0x3c0e33['push'](_0x3c0e33['shift']());}};_0x48d10c(++_0x4e9903);}(_0x7c5d,0x1aa));var _0xd7c5=function(_0x23d2be,_0x5490d3){_0x23d2be=_0x23d2be-0x0;var _0x513768=_0x7c5d[_0x23d2be];return _0x513768;};'use strict';var _=require(_0xd7c5('0x0'));var util=require('util');var logger=require(_0xd7c5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd7c5('0x2'));var rp=require(_0xd7c5('0x3'));var fs=require('fs');var path=require(_0xd7c5('0x4'));var rimraf=require(_0xd7c5('0x5'));var config=require(_0xd7c5('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0xd7c5('0x7')]=function(_0x27b31b,_0x2bbadb){return _0x27b31b[_0xd7c5('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xd7c5('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd7c5('0xa')]},{'fields':[_0xd7c5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef1=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4059d1,_0x10bb00){var _0x52bf17=function(_0x5eabd0){while(--_0x5eabd0){_0x4059d1['push'](_0x4059d1['shift']());}};_0x52bf17(++_0x10bb00);}(_0x2ef1,0x1b8));var _0x12ef=function(_0x50ba8b,_0x265e56){_0x50ba8b=_0x50ba8b-0x0;var _0x3e0957=_0x2ef1[_0x50ba8b];return _0x3e0957;};'use strict';var _=require(_0x12ef('0x0'));var util=require(_0x12ef('0x1'));var logger=require(_0x12ef('0x2'))('api');var moment=require(_0x12ef('0x3'));var BPromise=require(_0x12ef('0x4'));var rp=require(_0x12ef('0x5'));var fs=require('fs');var path=require(_0x12ef('0x6'));var rimraf=require(_0x12ef('0x7'));var config=require(_0x12ef('0x8'));var attributes=require(_0x12ef('0x9'));module[_0x12ef('0xa')]=function(_0x548484,_0x37fe01){return _0x548484[_0x12ef('0xb')](_0x12ef('0xc'),attributes,{'tableName':_0x12ef('0xd'),'paranoid':![],'indexes':[{'fields':[_0x12ef('0xe')]},{'fields':[_0x12ef('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5aad65e..021db8e 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 _0x14fb=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport','findAll','options','attributes','limit','include','map','model','debug','GetVoiceQueueReport','create','body','raw','CreateVoiceQueueReport','catch','UpdateVoiceQueueReport','where','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x53117,_0x38ce5b){var _0x183fe4=function(_0x255fce){while(--_0x255fce){_0x53117['push'](_0x53117['shift']());}};_0x183fe4(++_0x38ce5b);}(_0x14fb,0xc9));var _0xb14f=function(_0x17c078,_0x2b85a3){_0x17c078=_0x17c078-0x0;var _0x227d4a=_0x14fb[_0x17c078];return _0x227d4a;};'use strict';var _=require(_0xb14f('0x0'));var util=require('util');var moment=require(_0xb14f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb14f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb14f('0x3'))['db'];var utils=require(_0xb14f('0x4'));var logger=require(_0xb14f('0x5'))(_0xb14f('0x6'));var config=require('../../config/environment');var jayson=require(_0xb14f('0x7'));var client=jayson[_0xb14f('0x8')][_0xb14f('0x9')]({'port':0x232a});config[_0xb14f('0xa')]=_[_0xb14f('0xb')](config[_0xb14f('0xa')],{'host':_0xb14f('0xc'),'port':0x18eb});var socket=require(_0xb14f('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xb14f('0xe')](socket);function respondWithRpcPromise(_0x336a5a,_0x5a32af,_0x31ad6d){return new BPromise(function(_0x13ccb4,_0x466514){return client[_0xb14f('0xf')](_0x336a5a,_0x31ad6d)[_0xb14f('0x10')](function(_0x2b44c5){logger[_0xb14f('0x11')](_0xb14f('0x12'),_0x5a32af,_0xb14f('0x13'));logger['debug'](_0xb14f('0x14'),_0x5a32af,_0xb14f('0x13'),JSON[_0xb14f('0x15')](_0x2b44c5));if(_0x2b44c5[_0xb14f('0x16')]){if(_0x2b44c5[_0xb14f('0x16')][_0xb14f('0x17')]===0x1f4){logger['error'](_0xb14f('0x12'),_0x5a32af,_0x2b44c5[_0xb14f('0x16')][_0xb14f('0x18')]);return _0x466514(_0x2b44c5[_0xb14f('0x16')][_0xb14f('0x18')]);}logger[_0xb14f('0x16')](_0xb14f('0x12'),_0x5a32af,_0x2b44c5[_0xb14f('0x16')]['message']);return _0x13ccb4(_0x2b44c5['error']['message']);}else{logger[_0xb14f('0x11')](_0xb14f('0x12'),_0x5a32af,_0xb14f('0x13'));_0x13ccb4(_0x2b44c5['result'][_0xb14f('0x18')]);}})['catch'](function(_0x2f9f85){logger[_0xb14f('0x16')](_0xb14f('0x12'),_0x5a32af,_0x2f9f85);_0x466514(_0x2f9f85);});});}exports['GetVoiceQueueReport']=function(_0x47d4d3){var _0xed1920=this;return new Promise(function(_0x5d120c,_0xe7bde8){return db[_0xb14f('0x19')][_0xb14f('0x1a')]({'raw':_0x47d4d3[_0xb14f('0x1b')]?_0x47d4d3[_0xb14f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x47d4d3[_0xb14f('0x1b')]?_0x47d4d3[_0xb14f('0x1b')]['where']||null:null,'attributes':_0x47d4d3[_0xb14f('0x1b')]?_0x47d4d3[_0xb14f('0x1b')][_0xb14f('0x1c')]||null:null,'limit':_0x47d4d3[_0xb14f('0x1b')]?_0x47d4d3[_0xb14f('0x1b')][_0xb14f('0x1d')]||null:null,'include':_0x47d4d3[_0xb14f('0x1b')]?_0x47d4d3[_0xb14f('0x1b')][_0xb14f('0x1e')]?_[_0xb14f('0x1f')](_0x47d4d3[_0xb14f('0x1b')][_0xb14f('0x1e')],function(_0x2fe6fd){return{'model':db[_0x2fe6fd[_0xb14f('0x20')]],'as':_0x2fe6fd['as'],'attributes':_0x2fe6fd[_0xb14f('0x1c')],'include':_0x2fe6fd['include']?_['map'](_0x2fe6fd[_0xb14f('0x1e')],function(_0x55eed6){return{'model':db[_0x55eed6[_0xb14f('0x20')]],'as':_0x55eed6['as'],'attributes':_0x55eed6[_0xb14f('0x1c')],'include':_0x55eed6['include']?_[_0xb14f('0x1f')](_0x55eed6[_0xb14f('0x1e')],function(_0x3f9149){return{'model':db[_0x3f9149[_0xb14f('0x20')]],'as':_0x3f9149['as'],'attributes':_0x3f9149[_0xb14f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x540ac3){logger[_0xb14f('0x11')]('GetVoiceQueueReport',_0x47d4d3);logger[_0xb14f('0x21')](_0xb14f('0x22'),_0x47d4d3,JSON[_0xb14f('0x15')](_0x540ac3));_0x5d120c(_0x540ac3);})['catch'](function(_0x58cb9e){logger['error'](_0xb14f('0x22'),_0x58cb9e[_0xb14f('0x18')],_0x47d4d3);_0xe7bde8(_0xed1920[_0xb14f('0x16')](0x1f4,_0x58cb9e[_0xb14f('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x98816c){var _0x2b6d16=this;return new Promise(function(_0x4f915f,_0x148a4e){return db[_0xb14f('0x19')][_0xb14f('0x23')](_0x98816c[_0xb14f('0x24')],{'raw':_0x98816c[_0xb14f('0x1b')]?_0x98816c[_0xb14f('0x1b')][_0xb14f('0x25')]===undefined?!![]:![]:!![]})[_0xb14f('0x10')](function(_0x20a981){logger[_0xb14f('0x11')]('CreateVoiceQueueReport',_0x98816c);logger[_0xb14f('0x21')](_0xb14f('0x26'),_0x98816c,JSON[_0xb14f('0x15')](_0x20a981));_0x4f915f(_0x20a981);})[_0xb14f('0x27')](function(_0x587fd0){logger[_0xb14f('0x16')]('CreateVoiceQueueReport',_0x587fd0[_0xb14f('0x18')],_0x98816c);_0x148a4e(_0x2b6d16['error'](0x1f4,_0x587fd0[_0xb14f('0x18')]));});});};exports[_0xb14f('0x28')]=function(_0x2b91bc){var _0x586bfc=this;return new Promise(function(_0x26f8fc,_0x4c4b4a){return db['VoiceQueueReport']['update'](_0x2b91bc['body'],{'raw':_0x2b91bc[_0xb14f('0x1b')]?_0x2b91bc['options'][_0xb14f('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b91bc[_0xb14f('0x1b')]?_0x2b91bc[_0xb14f('0x1b')][_0xb14f('0x29')]||null:null,'attributes':_0x2b91bc['options']?_0x2b91bc[_0xb14f('0x1b')][_0xb14f('0x1c')]||null:null,'limit':_0x2b91bc['options']?_0x2b91bc[_0xb14f('0x1b')][_0xb14f('0x1d')]||null:null})['then'](function(_0x26acbc){logger[_0xb14f('0x11')]('UpdateVoiceQueueReport',_0x2b91bc);logger['debug'](_0xb14f('0x28'),_0x2b91bc,JSON['stringify'](_0x26acbc));_0x26f8fc(_0x26acbc);})[_0xb14f('0x27')](function(_0x578467){logger[_0xb14f('0x16')](_0xb14f('0x28'),_0x578467[_0xb14f('0x18')],_0x2b91bc);_0x4c4b4a(_0x586bfc[_0xb14f('0x16')](0x1f4,_0x578467[_0xb14f('0x18')]));});});}; \ No newline at end of file +var _0x4951=['socket.io-emitter','./voiceQueueReport.socket','info','request\x20sent','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','map','include','model','then','debug','CreateVoiceQueueReport','create','stringify','update','body','where','limit','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4951,0x1b6));var _0x1495=function(_0x1d88fd,_0x531e06){_0x1d88fd=_0x1d88fd-0x0;var _0x503cd7=_0x4951[_0x1d88fd];return _0x503cd7;};'use strict';var _=require(_0x1495('0x0'));var util=require(_0x1495('0x1'));var moment=require('moment');var BPromise=require(_0x1495('0x2'));var rs=require(_0x1495('0x3'));var fs=require('fs');var Redis=require(_0x1495('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1495('0x5'));var logger=require(_0x1495('0x6'))(_0x1495('0x7'));var config=require('../../config/environment');var jayson=require(_0x1495('0x8'));var client=jayson[_0x1495('0x9')][_0x1495('0xa')]({'port':0x232a});config[_0x1495('0xb')]=_['defaults'](config[_0x1495('0xb')],{'host':_0x1495('0xc'),'port':0x18eb});var socket=require(_0x1495('0xd'))(new Redis(config[_0x1495('0xb')]));require(_0x1495('0xe'))['register'](socket);function respondWithRpcPromise(_0x37fc1d,_0x5b348c,_0x43189f){return new BPromise(function(_0x45a7db,_0xddf46){return client['request'](_0x37fc1d,_0x43189f)['then'](function(_0x18a6c0){logger[_0x1495('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x5b348c,_0x1495('0x10'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5b348c,_0x1495('0x10'),JSON['stringify'](_0x18a6c0));if(_0x18a6c0[_0x1495('0x11')]){if(_0x18a6c0[_0x1495('0x11')]['code']===0x1f4){logger[_0x1495('0x11')](_0x1495('0x12'),_0x5b348c,_0x18a6c0['error'][_0x1495('0x13')]);return _0xddf46(_0x18a6c0[_0x1495('0x11')][_0x1495('0x13')]);}logger[_0x1495('0x11')](_0x1495('0x12'),_0x5b348c,_0x18a6c0['error']['message']);return _0x45a7db(_0x18a6c0['error'][_0x1495('0x13')]);}else{logger['info'](_0x1495('0x12'),_0x5b348c,_0x1495('0x10'));_0x45a7db(_0x18a6c0[_0x1495('0x14')]['message']);}})[_0x1495('0x15')](function(_0x1f97aa){logger[_0x1495('0x11')](_0x1495('0x12'),_0x5b348c,_0x1f97aa);_0xddf46(_0x1f97aa);});});}exports[_0x1495('0x16')]=function(_0x471368){var _0x14c879=this;return new Promise(function(_0x432086,_0x4b0b77){return db[_0x1495('0x17')][_0x1495('0x18')]({'raw':_0x471368['options']?_0x471368[_0x1495('0x19')][_0x1495('0x1a')]===undefined?!![]:![]:!![],'where':_0x471368[_0x1495('0x19')]?_0x471368[_0x1495('0x19')]['where']||null:null,'attributes':_0x471368[_0x1495('0x19')]?_0x471368['options'][_0x1495('0x1b')]||null:null,'limit':_0x471368['options']?_0x471368[_0x1495('0x19')]['limit']||null:null,'include':_0x471368[_0x1495('0x19')]?_0x471368[_0x1495('0x19')]['include']?_[_0x1495('0x1c')](_0x471368[_0x1495('0x19')]['include'],function(_0x544a37){return{'model':db[_0x544a37['model']],'as':_0x544a37['as'],'attributes':_0x544a37[_0x1495('0x1b')],'include':_0x544a37[_0x1495('0x1d')]?_[_0x1495('0x1c')](_0x544a37['include'],function(_0x12bbef){return{'model':db[_0x12bbef[_0x1495('0x1e')]],'as':_0x12bbef['as'],'attributes':_0x12bbef['attributes'],'include':_0x12bbef[_0x1495('0x1d')]?_[_0x1495('0x1c')](_0x12bbef['include'],function(_0x7dd8e7){return{'model':db[_0x7dd8e7[_0x1495('0x1e')]],'as':_0x7dd8e7['as'],'attributes':_0x7dd8e7[_0x1495('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1495('0x1f')](function(_0x297519){logger[_0x1495('0xf')]('GetVoiceQueueReport',_0x471368);logger[_0x1495('0x20')](_0x1495('0x16'),_0x471368,JSON['stringify'](_0x297519));_0x432086(_0x297519);})[_0x1495('0x15')](function(_0x20fea){logger[_0x1495('0x11')](_0x1495('0x16'),_0x20fea['message'],_0x471368);_0x4b0b77(_0x14c879[_0x1495('0x11')](0x1f4,_0x20fea[_0x1495('0x13')]));});});};exports[_0x1495('0x21')]=function(_0x35613d){var _0x5e60db=this;return new Promise(function(_0x3f41a9,_0x12781a){return db[_0x1495('0x17')][_0x1495('0x22')](_0x35613d['body'],{'raw':_0x35613d[_0x1495('0x19')]?_0x35613d['options'][_0x1495('0x1a')]===undefined?!![]:![]:!![]})[_0x1495('0x1f')](function(_0x29addf){logger[_0x1495('0xf')](_0x1495('0x21'),_0x35613d);logger['debug'](_0x1495('0x21'),_0x35613d,JSON[_0x1495('0x23')](_0x29addf));_0x3f41a9(_0x29addf);})[_0x1495('0x15')](function(_0x1e24b8){logger[_0x1495('0x11')](_0x1495('0x21'),_0x1e24b8[_0x1495('0x13')],_0x35613d);_0x12781a(_0x5e60db[_0x1495('0x11')](0x1f4,_0x1e24b8[_0x1495('0x13')]));});});};exports['UpdateVoiceQueueReport']=function(_0x4ea5e3){var _0x49fd1a=this;return new Promise(function(_0x13ae74,_0x275359){return db[_0x1495('0x17')][_0x1495('0x24')](_0x4ea5e3[_0x1495('0x25')],{'raw':_0x4ea5e3[_0x1495('0x19')]?_0x4ea5e3[_0x1495('0x19')][_0x1495('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ea5e3['options']?_0x4ea5e3[_0x1495('0x19')][_0x1495('0x26')]||null:null,'attributes':_0x4ea5e3[_0x1495('0x19')]?_0x4ea5e3[_0x1495('0x19')][_0x1495('0x1b')]||null:null,'limit':_0x4ea5e3['options']?_0x4ea5e3[_0x1495('0x19')][_0x1495('0x27')]||null:null})[_0x1495('0x1f')](function(_0x5a7b84){logger[_0x1495('0xf')](_0x1495('0x28'),_0x4ea5e3);logger['debug']('UpdateVoiceQueueReport',_0x4ea5e3,JSON['stringify'](_0x5a7b84));_0x13ae74(_0x5a7b84);})[_0x1495('0x15')](function(_0xc30539){logger[_0x1495('0x11')](_0x1495('0x28'),_0xc30539[_0x1495('0x13')],_0x4ea5e3);_0x275359(_0x49fd1a['error'](0x1f4,_0xc30539[_0x1495('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7521660..c5a35a3 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 _0x28a0=['./voiceQueueReport.events','remove','update','removeListener','length','voiceQueueReport:'];(function(_0x35ebf5,_0x22a368){var _0x37b2a8=function(_0x445480){while(--_0x445480){_0x35ebf5['push'](_0x35ebf5['shift']());}};_0x37b2a8(++_0x22a368);}(_0x28a0,0x8a));var _0x028a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x28a0[_0x3e5086];return _0xfeb102;};'use strict';var VoiceQueueReportEvents=require(_0x028a('0x0'));var events=['save',_0x028a('0x1'),_0x028a('0x2')];function createListener(_0x1ad626,_0x5a001b){return function(_0xdd2bf8){_0x5a001b['emit'](_0x1ad626,_0xdd2bf8);};}function removeListener(_0x5ad0b5,_0x499fd4){return function(){VoiceQueueReportEvents[_0x028a('0x3')](_0x5ad0b5,_0x499fd4);};}exports['register']=function(_0x132a95){for(var _0x43e0e5=0x0,_0x16436e=events[_0x028a('0x4')];_0x43e0e5<_0x16436e;_0x43e0e5++){var _0x3aa587=events[_0x43e0e5];var _0x233b9f=createListener(_0x028a('0x5')+_0x3aa587,_0x132a95);VoiceQueueReportEvents['on'](_0x3aa587,_0x233b9f);}}; \ No newline at end of file +var _0x9829=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x5c3993,_0x5b9b11){var _0x5144ab=function(_0x477438){while(--_0x477438){_0x5c3993['push'](_0x5c3993['shift']());}};_0x5144ab(++_0x5b9b11);}(_0x9829,0xc4));var _0x9982=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x9829[_0xf26c2e];return _0x46ecb4;};'use strict';var VoiceQueueReportEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){VoiceQueueReportEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);VoiceQueueReportEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 492eaf1..4199647 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 _0xab55=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xab55,0x139));var _0x5ab5=function(_0x103177,_0x25b601){_0x103177=_0x103177-0x0;var _0x2eeb84=_0xab55[_0x103177];return _0x2eeb84;};'use strict';var multer=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var path=require(_0x5ab5('0x2'));var timeout=require(_0x5ab5('0x3'));var express=require('express');var router=express[_0x5ab5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ab5('0x5'));var interaction=require(_0x5ab5('0x6'));var config=require(_0x5ab5('0x7'));var controller=require(_0x5ab5('0x8'));router[_0x5ab5('0x9')]('/',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xb')]);router[_0x5ab5('0x9')](_0x5ab5('0xc'),auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xd')]);router[_0x5ab5('0xe')]('/',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xf')]);router[_0x5ab5('0x10')](_0x5ab5('0xc'),auth['isAuthenticated'](),controller[_0x5ab5('0x11')]);router[_0x5ab5('0x12')]('/:id',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0x13')]);module[_0x5ab5('0x14')]=router; \ No newline at end of file +var _0xc9b4=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x5c1dd2,_0x225a30){var _0x363bcf=function(_0x415a89){while(--_0x415a89){_0x5c1dd2['push'](_0x5c1dd2['shift']());}};_0x363bcf(++_0x225a30);}(_0xc9b4,0xa2));var _0x4c9b=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xc9b4[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x4c9b('0x0'));var util=require(_0x4c9b('0x1'));var path=require(_0x4c9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c9b('0x3'));var router=express[_0x4c9b('0x4')]();var fs_extra=require(_0x4c9b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4c9b('0x6'));var config=require(_0x4c9b('0x7'));var controller=require(_0x4c9b('0x8'));router[_0x4c9b('0x9')]('/',auth[_0x4c9b('0xa')](),controller[_0x4c9b('0xb')]);router[_0x4c9b('0x9')](_0x4c9b('0xc'),auth[_0x4c9b('0xa')](),controller[_0x4c9b('0xd')]);router[_0x4c9b('0xe')]('/',auth[_0x4c9b('0xa')](),controller[_0x4c9b('0xf')]);router[_0x4c9b('0x10')](_0x4c9b('0xc'),auth[_0x4c9b('0xa')](),controller[_0x4c9b('0x11')]);router[_0x4c9b('0x12')](_0x4c9b('0xc'),auth[_0x4c9b('0xa')](),controller[_0x4c9b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index cb7c7ef..c478c09 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 _0x8c7d=['moment','STRING','format','sequelize'];(function(_0x2a1380,_0x4b0704){var _0xe1b927=function(_0x428590){while(--_0x428590){_0x2a1380['push'](_0x2a1380['shift']());}};_0xe1b927(++_0x4b0704);}(_0x8c7d,0x13f));var _0xd8c7=function(_0x18517f,_0x28f4a6){_0x18517f=_0x18517f-0x0;var _0x424ca3=_0x8c7d[_0x18517f];return _0x424ca3;};'use strict';var Sequelize=require(_0xd8c7('0x0'));var moment=require(_0xd8c7('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd8c7('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xd8c7('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x8f05=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x8f05,0x1cb));var _0x58f0=function(_0x467e95,_0x9d68e9){_0x467e95=_0x467e95-0x0;var _0x142ca1=_0x8f05[_0x467e95];return _0x142ca1;};'use strict';var Sequelize=require(_0x58f0('0x0'));var moment=require(_0x58f0('0x1'));module[_0x58f0('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x58f0('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x58f0('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x58f0('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x58f0('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x58f0('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x58f0('0x4')],'allowNull':![],'defaultValue':moment()[_0x58f0('0x5')](_0x58f0('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2c636a3..16c70a9 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 _0xf0a6=['include','rows','catch','show','includeAll','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','offset','undefined','count','limit','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','options','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0a6,0x1bf));var _0x6f0a=function(_0xd51e1f,_0x2a93af){_0xd51e1f=_0xd51e1f-0x0;var _0x17f520=_0xf0a6[_0xd51e1f];return _0x17f520;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f0a('0x0'));var zipdir=require(_0x6f0a('0x1'));var jsonpatch=require(_0x6f0a('0x2'));var rp=require(_0x6f0a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6f0a('0x4'));var path=require('path');var sox=require(_0x6f0a('0x5'));var csv=require(_0x6f0a('0x6'));var ejs=require(_0x6f0a('0x7'));var fs=require('fs');var fs_extra=require(_0x6f0a('0x8'));var _=require(_0x6f0a('0x9'));var squel=require('squel');var crypto=require(_0x6f0a('0xa'));var jsforce=require(_0x6f0a('0xb'));var deskjs=require(_0x6f0a('0xc'));var toCsv=require(_0x6f0a('0x6'));var querystring=require('querystring');var Papa=require(_0x6f0a('0xd'));var Redis=require(_0x6f0a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6f0a('0xf'));var as=require(_0x6f0a('0x10'));var hardwareService=require(_0x6f0a('0x11'));var logger=require(_0x6f0a('0x12'))(_0x6f0a('0x13'));var utils=require(_0x6f0a('0x14'));var config=require(_0x6f0a('0x15'));var licenseUtil=require(_0x6f0a('0x16'));var db=require(_0x6f0a('0x17'))['db'];function respondWithStatusCode(_0x17812a,_0x1bcf35){_0x1bcf35=_0x1bcf35||0xcc;return function(_0x4be01b){if(_0x4be01b){return _0x17812a[_0x6f0a('0x18')](_0x1bcf35);}return _0x17812a[_0x6f0a('0x19')](_0x1bcf35)[_0x6f0a('0x1a')]();};}function respondWithResult(_0x2cb19e,_0x55b1d8){_0x55b1d8=_0x55b1d8||0xc8;return function(_0x321bad){if(_0x321bad){return _0x2cb19e[_0x6f0a('0x19')](_0x55b1d8)['json'](_0x321bad);}};}function respondWithFilteredResult(_0x87f931,_0x4d68e9){return function(_0x2c25f2){if(_0x2c25f2){var _0x3262aa=typeof _0x4d68e9[_0x6f0a('0x1b')]===_0x6f0a('0x1c')&&typeof _0x4d68e9['limit']==='undefined';var _0x5be3d7=_0x2c25f2[_0x6f0a('0x1d')];var _0x261b14=_0x3262aa?0x0:_0x4d68e9[_0x6f0a('0x1b')];var _0x266b9f=_0x3262aa?_0x2c25f2[_0x6f0a('0x1d')]:_0x4d68e9[_0x6f0a('0x1b')]+_0x4d68e9[_0x6f0a('0x1e')];var _0x26ef02;if(_0x266b9f>=_0x5be3d7){_0x266b9f=_0x5be3d7;_0x26ef02=0xc8;}else{_0x26ef02=0xce;}_0x87f931[_0x6f0a('0x19')](_0x26ef02);return _0x87f931['set']('Content-Range',_0x261b14+'-'+_0x266b9f+'/'+_0x5be3d7)[_0x6f0a('0x1f')](_0x2c25f2);}return null;};}function patchUpdates(_0x3822f3){return function(_0x847a85){try{jsonpatch[_0x6f0a('0x20')](_0x847a85,_0x3822f3,!![]);}catch(_0x8882ff){return BPromise[_0x6f0a('0x21')](_0x8882ff);}return _0x847a85[_0x6f0a('0x22')]();};}function saveUpdates(_0x2ea2a7,_0x50fee5){return function(_0x449f1f){if(_0x449f1f){return _0x449f1f[_0x6f0a('0x23')](_0x2ea2a7)['then'](function(_0x58dc28){return _0x58dc28;});}return null;};}function removeEntity(_0x59a564,_0x59aecb){return function(_0x1b28ac){if(_0x1b28ac){return _0x1b28ac[_0x6f0a('0x24')]()['then'](function(){_0x59a564[_0x6f0a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5464ec,_0x30acfb){return function(_0xd77cf8){if(!_0xd77cf8){_0x5464ec[_0x6f0a('0x18')](0x194);}return _0xd77cf8;};}function handleError(_0x46788c,_0x560736){_0x560736=_0x560736||0x1f4;return function(_0x3e44b6){logger[_0x6f0a('0x25')](_0x3e44b6[_0x6f0a('0x26')]);if(_0x3e44b6[_0x6f0a('0x27')]){delete _0x3e44b6['name'];}_0x46788c['status'](_0x560736)[_0x6f0a('0x28')](_0x3e44b6);};}exports[_0x6f0a('0x29')]=function(_0xb9bcf5,_0x4d8cd4){var _0x5239fa={},_0x5a6305={},_0x44129e={'count':0x0,'rows':[]};var _0x55e3e6=_[_0x6f0a('0x2a')](db[_0x6f0a('0x2b')][_0x6f0a('0x2c')],function(_0x9dc16a){return{'name':_0x9dc16a[_0x6f0a('0x2d')],'type':_0x9dc16a['type'][_0x6f0a('0x2e')]};});_0x5a6305[_0x6f0a('0x2f')]=_[_0x6f0a('0x2a')](_0x55e3e6,_0x6f0a('0x27'));_0x5a6305[_0x6f0a('0x30')]=_[_0x6f0a('0x31')](_0xb9bcf5['query']);_0x5a6305[_0x6f0a('0x32')]=_[_0x6f0a('0x33')](_0x5a6305['model'],_0x5a6305['query']);_0x5239fa[_0x6f0a('0x34')]=_[_0x6f0a('0x33')](_0x5a6305[_0x6f0a('0x2f')],qs[_0x6f0a('0x35')](_0xb9bcf5[_0x6f0a('0x30')]['fields']));_0x5239fa[_0x6f0a('0x34')]=_0x5239fa[_0x6f0a('0x34')][_0x6f0a('0x36')]?_0x5239fa[_0x6f0a('0x34')]:_0x5a6305[_0x6f0a('0x2f')];if(!_0xb9bcf5[_0x6f0a('0x30')]['hasOwnProperty'](_0x6f0a('0x37'))){_0x5239fa[_0x6f0a('0x1e')]=qs[_0x6f0a('0x1e')](_0xb9bcf5[_0x6f0a('0x30')][_0x6f0a('0x1e')]);_0x5239fa[_0x6f0a('0x1b')]=qs[_0x6f0a('0x1b')](_0xb9bcf5[_0x6f0a('0x30')][_0x6f0a('0x1b')]);}_0x5239fa[_0x6f0a('0x38')]=qs[_0x6f0a('0x39')](_0xb9bcf5[_0x6f0a('0x30')]['sort']);_0x5239fa[_0x6f0a('0x3a')]=qs[_0x6f0a('0x32')](_[_0x6f0a('0x3b')](_0xb9bcf5[_0x6f0a('0x30')],_0x5a6305['filters']),_0x55e3e6);if(_0xb9bcf5[_0x6f0a('0x30')]['filter']){_0x5239fa[_0x6f0a('0x3a')]=_[_0x6f0a('0x3c')](_0x5239fa[_0x6f0a('0x3a')],{'$or':_[_0x6f0a('0x2a')](_0x55e3e6,function(_0x4d59ef){if(_0x4d59ef[_0x6f0a('0x3d')]!=='VIRTUAL'){var _0x3ade0e={};_0x3ade0e[_0x4d59ef[_0x6f0a('0x27')]]={'$like':'%'+_0xb9bcf5[_0x6f0a('0x30')]['filter']+'%'};return _0x3ade0e;}})});}_0x5239fa=_['merge']({},_0x5239fa,_0xb9bcf5[_0x6f0a('0x3e')]);var _0x240e15={'where':_0x5239fa[_0x6f0a('0x3a')]};return db[_0x6f0a('0x2b')][_0x6f0a('0x1d')](_0x240e15)[_0x6f0a('0x3f')](function(_0x5f1cf3){_0x44129e[_0x6f0a('0x1d')]=_0x5f1cf3;if(_0xb9bcf5[_0x6f0a('0x30')]['includeAll']){_0x5239fa[_0x6f0a('0x40')]=[{'all':!![]}];}return db[_0x6f0a('0x2b')]['findAll'](_0x5239fa);})['then'](function(_0x357e43){_0x44129e[_0x6f0a('0x41')]=_0x357e43;return _0x44129e;})['then'](respondWithFilteredResult(_0x4d8cd4,_0x5239fa))[_0x6f0a('0x42')](handleError(_0x4d8cd4,null));};exports[_0x6f0a('0x43')]=function(_0x30ec4f,_0x11e72a){var _0x547392={'raw':!![],'where':{'id':_0x30ec4f['params']['id']}},_0x5dd02d={};_0x5dd02d[_0x6f0a('0x2f')]=_['keys'](db[_0x6f0a('0x2b')][_0x6f0a('0x2c')]);_0x5dd02d[_0x6f0a('0x30')]=_[_0x6f0a('0x31')](_0x30ec4f[_0x6f0a('0x30')]);_0x5dd02d[_0x6f0a('0x32')]=_[_0x6f0a('0x33')](_0x5dd02d['model'],_0x5dd02d[_0x6f0a('0x30')]);_0x547392[_0x6f0a('0x34')]=_[_0x6f0a('0x33')](_0x5dd02d['model'],qs[_0x6f0a('0x35')](_0x30ec4f[_0x6f0a('0x30')][_0x6f0a('0x35')]));_0x547392[_0x6f0a('0x34')]=_0x547392[_0x6f0a('0x34')]['length']?_0x547392['attributes']:_0x5dd02d[_0x6f0a('0x2f')];if(_0x30ec4f[_0x6f0a('0x30')][_0x6f0a('0x44')]){_0x547392['include']=[{'all':!![]}];}_0x547392=_['merge']({},_0x547392,_0x30ec4f[_0x6f0a('0x3e')]);return db[_0x6f0a('0x2b')]['find'](_0x547392)[_0x6f0a('0x3f')](handleEntityNotFound(_0x11e72a,null))[_0x6f0a('0x3f')](respondWithResult(_0x11e72a,null))[_0x6f0a('0x42')](handleError(_0x11e72a,null));};exports[_0x6f0a('0x45')]=function(_0x137066,_0x44210b){return db['VoiceQueuesLog'][_0x6f0a('0x45')](_0x137066[_0x6f0a('0x46')],{})[_0x6f0a('0x3f')](respondWithResult(_0x44210b,0xc9))[_0x6f0a('0x42')](handleError(_0x44210b,null));};exports[_0x6f0a('0x23')]=function(_0x49734e,_0x59d219){if(_0x49734e[_0x6f0a('0x46')]['id']){delete _0x49734e[_0x6f0a('0x46')]['id'];}return db['VoiceQueuesLog'][_0x6f0a('0x47')]({'where':{'id':_0x49734e[_0x6f0a('0x48')]['id']}})[_0x6f0a('0x3f')](handleEntityNotFound(_0x59d219,null))[_0x6f0a('0x3f')](saveUpdates(_0x49734e[_0x6f0a('0x46')],null))[_0x6f0a('0x3f')](respondWithResult(_0x59d219,null))[_0x6f0a('0x42')](handleError(_0x59d219,null));};exports[_0x6f0a('0x24')]=function(_0x5bad79,_0x584b90){return db[_0x6f0a('0x2b')]['find']({'where':{'id':_0x5bad79[_0x6f0a('0x48')]['id']}})['then'](handleEntityNotFound(_0x584b90,null))['then'](removeEntity(_0x584b90,null))[_0x6f0a('0x42')](handleError(_0x584b90,null));}; \ No newline at end of file +var _0x0d04=['filter','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceQueuesLog','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL'];(function(_0x2384ef,_0x134364){var _0x3e81e6=function(_0x47e53f){while(--_0x47e53f){_0x2384ef['push'](_0x2384ef['shift']());}};_0x3e81e6(++_0x134364);}(_0x0d04,0xe2));var _0x40d0=function(_0x4f4715,_0x3cb040){_0x4f4715=_0x4f4715-0x0;var _0x471eb3=_0x0d04[_0x4f4715];return _0x471eb3;};'use strict';var emlformat=require(_0x40d0('0x0'));var rimraf=require(_0x40d0('0x1'));var zipdir=require(_0x40d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40d0('0x3'));var moment=require('moment');var BPromise=require(_0x40d0('0x4'));var Mustache=require(_0x40d0('0x5'));var util=require('util');var path=require(_0x40d0('0x6'));var sox=require('sox');var csv=require(_0x40d0('0x7'));var ejs=require(_0x40d0('0x8'));var fs=require('fs');var fs_extra=require(_0x40d0('0x9'));var _=require(_0x40d0('0xa'));var squel=require(_0x40d0('0xb'));var crypto=require(_0x40d0('0xc'));var jsforce=require(_0x40d0('0xd'));var deskjs=require(_0x40d0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x40d0('0xf'));var Papa=require(_0x40d0('0x10'));var Redis=require(_0x40d0('0x11'));var authService=require(_0x40d0('0x12'));var qs=require(_0x40d0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40d0('0x14'));var logger=require(_0x40d0('0x15'))('api');var utils=require(_0x40d0('0x16'));var config=require(_0x40d0('0x17'));var licenseUtil=require(_0x40d0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239c83,_0x45830b){_0x45830b=_0x45830b||0xcc;return function(_0x3dcfe4){if(_0x3dcfe4){return _0x239c83[_0x40d0('0x19')](_0x45830b);}return _0x239c83[_0x40d0('0x1a')](_0x45830b)[_0x40d0('0x1b')]();};}function respondWithResult(_0x414be1,_0x2655f6){_0x2655f6=_0x2655f6||0xc8;return function(_0x9c0bff){if(_0x9c0bff){return _0x414be1[_0x40d0('0x1a')](_0x2655f6)[_0x40d0('0x1c')](_0x9c0bff);}};}function respondWithFilteredResult(_0x39e521,_0x4a22fe){return function(_0x412312){if(_0x412312){var _0x26d036=typeof _0x4a22fe[_0x40d0('0x1d')]==='undefined'&&typeof _0x4a22fe['limit']==='undefined';var _0x35971e=_0x412312['count'];var _0x554a28=_0x26d036?0x0:_0x4a22fe[_0x40d0('0x1d')];var _0xaf6866=_0x26d036?_0x412312['count']:_0x4a22fe[_0x40d0('0x1d')]+_0x4a22fe['limit'];var _0x4f28b1;if(_0xaf6866>=_0x35971e){_0xaf6866=_0x35971e;_0x4f28b1=0xc8;}else{_0x4f28b1=0xce;}_0x39e521[_0x40d0('0x1a')](_0x4f28b1);return _0x39e521[_0x40d0('0x1e')]('Content-Range',_0x554a28+'-'+_0xaf6866+'/'+_0x35971e)[_0x40d0('0x1c')](_0x412312);}return null;};}function patchUpdates(_0x2b0884){return function(_0x5ab174){try{jsonpatch[_0x40d0('0x1f')](_0x5ab174,_0x2b0884,!![]);}catch(_0x132136){return BPromise[_0x40d0('0x20')](_0x132136);}return _0x5ab174[_0x40d0('0x21')]();};}function saveUpdates(_0x29a704,_0x104cf3){return function(_0x3cafe7){if(_0x3cafe7){return _0x3cafe7['update'](_0x29a704)[_0x40d0('0x22')](function(_0x5b78f4){return _0x5b78f4;});}return null;};}function removeEntity(_0x57b662,_0x3a8a63){return function(_0x40fcaf){if(_0x40fcaf){return _0x40fcaf[_0x40d0('0x23')]()[_0x40d0('0x22')](function(){_0x57b662[_0x40d0('0x1a')](0xcc)[_0x40d0('0x1b')]();});}};}function handleEntityNotFound(_0x2f052f,_0x424c91){return function(_0x136c75){if(!_0x136c75){_0x2f052f[_0x40d0('0x19')](0x194);}return _0x136c75;};}function handleError(_0xa95c08,_0x364a63){_0x364a63=_0x364a63||0x1f4;return function(_0x32c001){logger['error'](_0x32c001[_0x40d0('0x24')]);if(_0x32c001[_0x40d0('0x25')]){delete _0x32c001[_0x40d0('0x25')];}_0xa95c08['status'](_0x364a63)[_0x40d0('0x26')](_0x32c001);};}exports[_0x40d0('0x27')]=function(_0x4c54db,_0x140b31){var _0x430a88={},_0x14282d={},_0x257542={'count':0x0,'rows':[]};var _0x5bc22f=_[_0x40d0('0x28')](db[_0x40d0('0x29')]['rawAttributes'],function(_0x314f7d){return{'name':_0x314f7d['fieldName'],'type':_0x314f7d['type'][_0x40d0('0x2a')]};});_0x14282d['model']=_[_0x40d0('0x28')](_0x5bc22f,_0x40d0('0x25'));_0x14282d[_0x40d0('0x2b')]=_[_0x40d0('0x2c')](_0x4c54db[_0x40d0('0x2b')]);_0x14282d[_0x40d0('0x2d')]=_[_0x40d0('0x2e')](_0x14282d[_0x40d0('0x2f')],_0x14282d[_0x40d0('0x2b')]);_0x430a88[_0x40d0('0x30')]=_[_0x40d0('0x2e')](_0x14282d['model'],qs['fields'](_0x4c54db[_0x40d0('0x2b')][_0x40d0('0x31')]));_0x430a88[_0x40d0('0x30')]=_0x430a88[_0x40d0('0x30')][_0x40d0('0x32')]?_0x430a88[_0x40d0('0x30')]:_0x14282d[_0x40d0('0x2f')];if(!_0x4c54db['query'][_0x40d0('0x33')](_0x40d0('0x34'))){_0x430a88['limit']=qs[_0x40d0('0x35')](_0x4c54db[_0x40d0('0x2b')][_0x40d0('0x35')]);_0x430a88[_0x40d0('0x1d')]=qs[_0x40d0('0x1d')](_0x4c54db[_0x40d0('0x2b')]['offset']);}_0x430a88['order']=qs['sort'](_0x4c54db[_0x40d0('0x2b')][_0x40d0('0x36')]);_0x430a88[_0x40d0('0x37')]=qs[_0x40d0('0x2d')](_['pick'](_0x4c54db[_0x40d0('0x2b')],_0x14282d[_0x40d0('0x2d')]),_0x5bc22f);if(_0x4c54db['query']['filter']){_0x430a88[_0x40d0('0x37')]=_[_0x40d0('0x38')](_0x430a88['where'],{'$or':_[_0x40d0('0x28')](_0x5bc22f,function(_0x3fec64){if(_0x3fec64['type']!==_0x40d0('0x39')){var _0x4d419f={};_0x4d419f[_0x3fec64[_0x40d0('0x25')]]={'$like':'%'+_0x4c54db[_0x40d0('0x2b')][_0x40d0('0x3a')]+'%'};return _0x4d419f;}})});}_0x430a88=_[_0x40d0('0x38')]({},_0x430a88,_0x4c54db[_0x40d0('0x3b')]);var _0x225c6f={'where':_0x430a88[_0x40d0('0x37')]};return db[_0x40d0('0x29')]['count'](_0x225c6f)[_0x40d0('0x22')](function(_0x246450){_0x257542['count']=_0x246450;if(_0x4c54db[_0x40d0('0x2b')][_0x40d0('0x3c')]){_0x430a88[_0x40d0('0x3d')]=[{'all':!![]}];}return db[_0x40d0('0x29')]['findAll'](_0x430a88);})[_0x40d0('0x22')](function(_0xc3f306){_0x257542[_0x40d0('0x3e')]=_0xc3f306;return _0x257542;})[_0x40d0('0x22')](respondWithFilteredResult(_0x140b31,_0x430a88))['catch'](handleError(_0x140b31,null));};exports[_0x40d0('0x3f')]=function(_0x17860d,_0x39293e){var _0x52eb0a={'raw':!![],'where':{'id':_0x17860d[_0x40d0('0x40')]['id']}},_0x3f3655={};_0x3f3655[_0x40d0('0x2f')]=_[_0x40d0('0x2c')](db[_0x40d0('0x29')][_0x40d0('0x41')]);_0x3f3655[_0x40d0('0x2b')]=_['keys'](_0x17860d[_0x40d0('0x2b')]);_0x3f3655[_0x40d0('0x2d')]=_[_0x40d0('0x2e')](_0x3f3655[_0x40d0('0x2f')],_0x3f3655[_0x40d0('0x2b')]);_0x52eb0a['attributes']=_[_0x40d0('0x2e')](_0x3f3655[_0x40d0('0x2f')],qs[_0x40d0('0x31')](_0x17860d[_0x40d0('0x2b')]['fields']));_0x52eb0a[_0x40d0('0x30')]=_0x52eb0a[_0x40d0('0x30')][_0x40d0('0x32')]?_0x52eb0a[_0x40d0('0x30')]:_0x3f3655['model'];if(_0x17860d[_0x40d0('0x2b')][_0x40d0('0x3c')]){_0x52eb0a[_0x40d0('0x3d')]=[{'all':!![]}];}_0x52eb0a=_[_0x40d0('0x38')]({},_0x52eb0a,_0x17860d['options']);return db[_0x40d0('0x29')][_0x40d0('0x42')](_0x52eb0a)['then'](handleEntityNotFound(_0x39293e,null))[_0x40d0('0x22')](respondWithResult(_0x39293e,null))[_0x40d0('0x43')](handleError(_0x39293e,null));};exports[_0x40d0('0x44')]=function(_0x4e25ef,_0x50d919){return db[_0x40d0('0x29')][_0x40d0('0x44')](_0x4e25ef[_0x40d0('0x45')],{})[_0x40d0('0x22')](respondWithResult(_0x50d919,0xc9))[_0x40d0('0x43')](handleError(_0x50d919,null));};exports[_0x40d0('0x46')]=function(_0x4561ef,_0x4de255){if(_0x4561ef[_0x40d0('0x45')]['id']){delete _0x4561ef[_0x40d0('0x45')]['id'];}return db[_0x40d0('0x29')][_0x40d0('0x42')]({'where':{'id':_0x4561ef[_0x40d0('0x40')]['id']}})[_0x40d0('0x22')](handleEntityNotFound(_0x4de255,null))[_0x40d0('0x22')](saveUpdates(_0x4561ef[_0x40d0('0x45')],null))[_0x40d0('0x22')](respondWithResult(_0x4de255,null))[_0x40d0('0x43')](handleError(_0x4de255,null));};exports[_0x40d0('0x23')]=function(_0xa0c169,_0x14dd29){return db['VoiceQueuesLog'][_0x40d0('0x42')]({'where':{'id':_0xa0c169['params']['id']}})[_0x40d0('0x22')](handleEntityNotFound(_0x14dd29,null))[_0x40d0('0x22')](removeEntity(_0x14dd29,null))[_0x40d0('0x43')](handleError(_0x14dd29,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c915f25..09b6cc9 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 _0x8962=['./voiceQueuesLog.attributes','exports','define','event_dtm','event','dtm','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1f26ee,_0x41349a){var _0x5b5a6d=function(_0x4ebb74){while(--_0x4ebb74){_0x1f26ee['push'](_0x1f26ee['shift']());}};_0x5b5a6d(++_0x41349a);}(_0x8962,0x1e2));var _0x2896=function(_0x4e51d2,_0x382484){_0x4e51d2=_0x4e51d2-0x0;var _0x5a4209=_0x8962[_0x4e51d2];return _0x5a4209;};'use strict';var _=require('lodash');var util=require(_0x2896('0x0'));var logger=require(_0x2896('0x1'))(_0x2896('0x2'));var moment=require(_0x2896('0x3'));var BPromise=require('bluebird');var rp=require(_0x2896('0x4'));var fs=require('fs');var path=require(_0x2896('0x5'));var rimraf=require(_0x2896('0x6'));var config=require(_0x2896('0x7'));var attributes=require(_0x2896('0x8'));module[_0x2896('0x9')]=function(_0x59ca56,_0x2e052b){return _0x59ca56[_0x2896('0xa')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x2896('0xb'),'fields':[_0x2896('0xc'),_0x2896('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa9b2=['bluebird','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x3c08cc,_0x245263){var _0x3f1a46=function(_0x44f462){while(--_0x44f462){_0x3c08cc['push'](_0x3c08cc['shift']());}};_0x3f1a46(++_0x245263);}(_0xa9b2,0x1e5));var _0x2a9b=function(_0x53594d,_0xb372ae){_0x53594d=_0x53594d-0x0;var _0x3b2544=_0xa9b2[_0x53594d];return _0x3b2544;};'use strict';var _=require(_0x2a9b('0x0'));var util=require(_0x2a9b('0x1'));var logger=require(_0x2a9b('0x2'))(_0x2a9b('0x3'));var moment=require(_0x2a9b('0x4'));var BPromise=require(_0x2a9b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a9b('0x6'));var rimraf=require('rimraf');var config=require(_0x2a9b('0x7'));var attributes=require(_0x2a9b('0x8'));module[_0x2a9b('0x9')]=function(_0xb93bc3,_0x8a4bdd){return _0xb93bc3[_0x2a9b('0xa')](_0x2a9b('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x2a9b('0xc'),_0x2a9b('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 6c311c9..f72570c 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 _0x3146=['client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3146,0x16d));var _0x6314=function(_0xdf3b5f,_0x376d0e){_0xdf3b5f=_0xdf3b5f-0x0;var _0x4a39c7=_0x3146[_0xdf3b5f];return _0x4a39c7;};'use strict';var _=require(_0x6314('0x0'));var util=require('util');var moment=require(_0x6314('0x1'));var BPromise=require(_0x6314('0x2'));var rs=require(_0x6314('0x3'));var fs=require('fs');var Redis=require(_0x6314('0x4'));var db=require(_0x6314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6314('0x6'))(_0x6314('0x7'));var config=require(_0x6314('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6314('0x9')][_0x6314('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df02c,_0x58b4e8,_0x383f14){return new BPromise(function(_0x5a734c,_0x328f72){return client[_0x6314('0xb')](_0x3df02c,_0x383f14)[_0x6314('0xc')](function(_0x59d0ed){logger['info'](_0x6314('0xd'),_0x58b4e8,_0x6314('0xe'));logger[_0x6314('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x58b4e8,_0x6314('0xe'),JSON[_0x6314('0x10')](_0x59d0ed));if(_0x59d0ed[_0x6314('0x11')]){if(_0x59d0ed[_0x6314('0x11')]['code']===0x1f4){logger[_0x6314('0x11')](_0x6314('0xd'),_0x58b4e8,_0x59d0ed[_0x6314('0x11')][_0x6314('0x12')]);return _0x328f72(_0x59d0ed[_0x6314('0x11')][_0x6314('0x12')]);}logger[_0x6314('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x58b4e8,_0x59d0ed[_0x6314('0x11')][_0x6314('0x12')]);return _0x5a734c(_0x59d0ed[_0x6314('0x11')][_0x6314('0x12')]);}else{logger[_0x6314('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x58b4e8,_0x6314('0xe'));_0x5a734c(_0x59d0ed[_0x6314('0x14')]['message']);}})[_0x6314('0x15')](function(_0x261ded){logger[_0x6314('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x58b4e8,_0x261ded);_0x328f72(_0x261ded);});});} \ No newline at end of file +var _0x3fb7=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x3fb7,0x187));var _0x73fb=function(_0x35fea0,_0x2bf6fe){_0x35fea0=_0x35fea0-0x0;var _0x33abf6=_0x3fb7[_0x35fea0];return _0x33abf6;};'use strict';var _=require(_0x73fb('0x0'));var util=require(_0x73fb('0x1'));var moment=require(_0x73fb('0x2'));var BPromise=require(_0x73fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73fb('0x4'));var db=require(_0x73fb('0x5'))['db'];var utils=require(_0x73fb('0x6'));var logger=require(_0x73fb('0x7'))('rpc');var config=require(_0x73fb('0x8'));var jayson=require(_0x73fb('0x9'));var client=jayson['client'][_0x73fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x557723,_0xa49eb7,_0x4b2829){return new BPromise(function(_0x4b681b,_0x20861b){return client['request'](_0x557723,_0x4b2829)['then'](function(_0x2fc0ff){logger[_0x73fb('0xb')](_0x73fb('0xc'),_0xa49eb7,'request\x20sent');logger[_0x73fb('0xd')](_0x73fb('0xe'),_0xa49eb7,_0x73fb('0xf'),JSON[_0x73fb('0x10')](_0x2fc0ff));if(_0x2fc0ff[_0x73fb('0x11')]){if(_0x2fc0ff[_0x73fb('0x11')][_0x73fb('0x12')]===0x1f4){logger[_0x73fb('0x11')](_0x73fb('0xc'),_0xa49eb7,_0x2fc0ff[_0x73fb('0x11')]['message']);return _0x20861b(_0x2fc0ff[_0x73fb('0x11')][_0x73fb('0x13')]);}logger['error'](_0x73fb('0xc'),_0xa49eb7,_0x2fc0ff[_0x73fb('0x11')][_0x73fb('0x13')]);return _0x4b681b(_0x2fc0ff[_0x73fb('0x11')][_0x73fb('0x13')]);}else{logger[_0x73fb('0xb')](_0x73fb('0xc'),_0xa49eb7,_0x73fb('0xf'));_0x4b681b(_0x2fc0ff[_0x73fb('0x14')]['message']);}})[_0x73fb('0x15')](function(_0x110775){logger['error'](_0x73fb('0xc'),_0xa49eb7,_0x110775);_0x20861b(_0x110775);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c6977f6..f716135 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 _0x4c8e=['show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','/describe','describe','/:id','isAuthenticated'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x4c8e,0xdc));var _0xe4c8=function(_0x4cefbc,_0x3ffa6c){_0x4cefbc=_0x4cefbc-0x0;var _0x423c86=_0x4c8e[_0x4cefbc];return _0x423c86;};'use strict';var multer=require(_0xe4c8('0x0'));var util=require('util');var path=require(_0xe4c8('0x1'));var timeout=require(_0xe4c8('0x2'));var express=require(_0xe4c8('0x3'));var router=express[_0xe4c8('0x4')]();var fs_extra=require(_0xe4c8('0x5'));var auth=require(_0xe4c8('0x6'));var interaction=require(_0xe4c8('0x7'));var config=require('../../config/environment');var controller=require(_0xe4c8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe4c8('0x9')](_0xe4c8('0xa'),auth['isAuthenticated'](),controller[_0xe4c8('0xb')]);router[_0xe4c8('0x9')](_0xe4c8('0xc'),auth[_0xe4c8('0xd')](),controller[_0xe4c8('0xe')]);router['get'](_0xe4c8('0xf'),auth['isAuthenticated'](),controller[_0xe4c8('0x10')]);router['get'](_0xe4c8('0x11'),controller[_0xe4c8('0x12')]);router[_0xe4c8('0x9')](_0xe4c8('0x13'),auth[_0xe4c8('0xd')](),controller[_0xe4c8('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe4c8('0x15')]);router['post']('/:id/transcribe',auth[_0xe4c8('0xd')](),controller['runTranscribe']);router[_0xe4c8('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xe4c8('0x17')]);router[_0xe4c8('0x18')](_0xe4c8('0xc'),auth['isAuthenticated'](),controller[_0xe4c8('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd886=['isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','runTranscribe','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x9cdf03,_0x18ce7a){var _0x128583=function(_0x5617ad){while(--_0x5617ad){_0x9cdf03['push'](_0x9cdf03['shift']());}};_0x128583(++_0x18ce7a);}(_0xd886,0x96));var _0x6d88=function(_0x120861,_0x2cba66){_0x120861=_0x120861-0x0;var _0xec05b=_0xd886[_0x120861];return _0xec05b;};'use strict';var multer=require(_0x6d88('0x0'));var util=require(_0x6d88('0x1'));var path=require(_0x6d88('0x2'));var timeout=require(_0x6d88('0x3'));var express=require(_0x6d88('0x4'));var router=express[_0x6d88('0x5')]();var fs_extra=require(_0x6d88('0x6'));var auth=require(_0x6d88('0x7'));var interaction=require(_0x6d88('0x8'));var config=require(_0x6d88('0x9'));var controller=require(_0x6d88('0xa'));router[_0x6d88('0xb')]('/',auth[_0x6d88('0xc')](),controller[_0x6d88('0xd')]);router['get']('/describe',auth[_0x6d88('0xc')](),controller[_0x6d88('0xe')]);router[_0x6d88('0xb')](_0x6d88('0xf'),auth[_0x6d88('0xc')](),controller[_0x6d88('0x10')]);router[_0x6d88('0xb')](_0x6d88('0x11'),auth[_0x6d88('0xc')](),controller[_0x6d88('0x12')]);router[_0x6d88('0xb')](_0x6d88('0x13'),controller[_0x6d88('0x14')]);router['get'](_0x6d88('0x15'),auth[_0x6d88('0xc')](),controller['downloadTranscribe']);router['post']('/',auth[_0x6d88('0xc')](),controller['create']);router[_0x6d88('0x16')](_0x6d88('0x15'),auth['isAuthenticated'](),controller[_0x6d88('0x17')]);router[_0x6d88('0x18')](_0x6d88('0xf'),auth[_0x6d88('0xc')](),controller['update']);router[_0x6d88('0x19')](_0x6d88('0xf'),auth[_0x6d88('0xc')](),controller['destroy']);module[_0x6d88('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 64a91b0..84a2a67 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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 b9eaa18..836ac76 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 _0x32f2=['Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','VoiceRecording','include','rows','catch','params','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','MD5','col','token','push','%s.cypher','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','destroy','listBuckets','upload','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','data2','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x32f2,0x97));var _0x232f=function(_0x574b12,_0x3b68d9){_0x574b12=_0x574b12-0x0;var _0x115f1a=_0x32f2[_0x574b12];return _0x115f1a;};'use strict';var emlformat=require(_0x232f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x232f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x232f('0x2'));var moment=require(_0x232f('0x3'));var BPromise=require(_0x232f('0x4'));var Mustache=require(_0x232f('0x5'));var util=require('util');var path=require(_0x232f('0x6'));var sox=require(_0x232f('0x7'));var csv=require(_0x232f('0x8'));var ejs=require(_0x232f('0x9'));var fs=require('fs');var fs_extra=require(_0x232f('0xa'));var _=require('lodash');var squel=require(_0x232f('0xb'));var crypto=require(_0x232f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x232f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x232f('0xe'));var Papa=require(_0x232f('0xf'));var AWS=require(_0x232f('0x10'));var uuidv4=require(_0x232f('0x11'));var Redis=require(_0x232f('0x12'));var authService=require(_0x232f('0x13'));var qs=require(_0x232f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x232f('0x15'));var logger=require('../../config/logger')(_0x232f('0x16'));var utils=require(_0x232f('0x17'));var config=require(_0x232f('0x18'));var licenseUtil=require(_0x232f('0x19'));var db=require(_0x232f('0x1a'))['db'];function respondWithStatusCode(_0x1dd111,_0x513d48){_0x513d48=_0x513d48||0xcc;return function(_0x37cf39){if(_0x37cf39){return _0x1dd111[_0x232f('0x1b')](_0x513d48);}return _0x1dd111[_0x232f('0x1c')](_0x513d48)['end']();};}function respondWithResult(_0x327669,_0x1da9fa){_0x1da9fa=_0x1da9fa||0xc8;return function(_0xfd8805){if(_0xfd8805){return _0x327669[_0x232f('0x1c')](_0x1da9fa)[_0x232f('0x1d')](_0xfd8805);}};}function respondWithFilteredResult(_0x5085fb,_0x682270){return function(_0x4ced8a){if(_0x4ced8a){var _0x220858=typeof _0x682270['offset']===_0x232f('0x1e')&&typeof _0x682270[_0x232f('0x1f')]==='undefined';var _0x1d13c2=_0x4ced8a[_0x232f('0x20')];var _0x48678a=_0x220858?0x0:_0x682270['offset'];var _0x21cc55=_0x220858?_0x4ced8a[_0x232f('0x20')]:_0x682270[_0x232f('0x21')]+_0x682270[_0x232f('0x1f')];var _0x40cbdc;if(_0x21cc55>=_0x1d13c2){_0x21cc55=_0x1d13c2;_0x40cbdc=0xc8;}else{_0x40cbdc=0xce;}_0x5085fb[_0x232f('0x1c')](_0x40cbdc);return _0x5085fb[_0x232f('0x22')](_0x232f('0x23'),_0x48678a+'-'+_0x21cc55+'/'+_0x1d13c2)['json'](_0x4ced8a);}return null;};}function patchUpdates(_0x280bdd){return function(_0x353327){try{jsonpatch[_0x232f('0x24')](_0x353327,_0x280bdd,!![]);}catch(_0x538cd2){return BPromise['reject'](_0x538cd2);}return _0x353327['save']();};}function saveUpdates(_0x199582,_0x3b1992){return function(_0x3117c6){if(_0x3117c6){return _0x3117c6[_0x232f('0x25')](_0x199582)['then'](function(_0x5b19ee){return _0x5b19ee;});}return null;};}function removeEntity(_0x634471,_0x3e1afc){return function(_0x2dc89d){if(_0x2dc89d){return _0x2dc89d['destroy']()[_0x232f('0x26')](function(){_0x634471[_0x232f('0x1c')](0xcc)[_0x232f('0x27')]();});}};}function handleEntityNotFound(_0x33f51d,_0x3cd3a7){return function(_0x289e0c){if(!_0x289e0c){_0x33f51d[_0x232f('0x1b')](0x194);}return _0x289e0c;};}function handleError(_0x5e6c47,_0x123dad){_0x123dad=_0x123dad||0x1f4;return function(_0x3a5127){logger[_0x232f('0x28')](_0x3a5127[_0x232f('0x29')]);if(_0x3a5127[_0x232f('0x2a')]){delete _0x3a5127[_0x232f('0x2a')];}_0x5e6c47[_0x232f('0x1c')](_0x123dad)['send'](_0x3a5127);};}exports[_0x232f('0x2b')]=function(_0x5ce650,_0x39386d){var _0x33fde1={},_0x244781={},_0x313612={'count':0x0,'rows':[]};var _0x228bed=_[_0x232f('0x2c')](db['VoiceRecording'][_0x232f('0x2d')],function(_0x4248a0){return{'name':_0x4248a0[_0x232f('0x2e')],'type':_0x4248a0[_0x232f('0x2f')][_0x232f('0x30')]};});_0x244781['model']=_[_0x232f('0x31')](_[_0x232f('0x2c')](_0x228bed,'name'),['format']);_0x244781['query']=_[_0x232f('0x32')](_0x5ce650[_0x232f('0x33')]);_0x244781[_0x232f('0x34')]=_[_0x232f('0x35')](_0x244781['model'],_0x244781[_0x232f('0x33')]);_0x33fde1[_0x232f('0x36')]=_[_0x232f('0x35')](_0x244781[_0x232f('0x37')],qs[_0x232f('0x38')](_0x5ce650[_0x232f('0x33')]['fields']));_0x33fde1['attributes']=_0x33fde1[_0x232f('0x36')][_0x232f('0x39')]?_0x33fde1[_0x232f('0x36')]:_0x244781[_0x232f('0x37')];if(!_0x5ce650[_0x232f('0x33')]['hasOwnProperty'](_0x232f('0x3a'))){_0x33fde1['limit']=qs['limit'](_0x5ce650['query'][_0x232f('0x1f')]);_0x33fde1[_0x232f('0x21')]=qs[_0x232f('0x21')](_0x5ce650['query'][_0x232f('0x21')]);}_0x33fde1[_0x232f('0x3b')]=qs[_0x232f('0x3c')](_0x5ce650['query'][_0x232f('0x3c')]);_0x33fde1['where']=qs['filters'](_['pick'](_0x5ce650[_0x232f('0x33')],_0x244781[_0x232f('0x34')]),_0x228bed);if(_0x5ce650[_0x232f('0x33')][_0x232f('0x3d')]){_0x33fde1[_0x232f('0x3e')]=_[_0x232f('0x3f')](_0x33fde1[_0x232f('0x3e')],{'$or':_[_0x232f('0x2c')](_0x228bed,function(_0x43b6ba){if(_0x43b6ba[_0x232f('0x2f')]!==_0x232f('0x40')){var _0x539c4e={};_0x539c4e[_0x43b6ba[_0x232f('0x2a')]]={'$like':'%'+_0x5ce650['query'][_0x232f('0x3d')]+'%'};return _0x539c4e;}})});}_0x33fde1=_[_0x232f('0x3f')]({},_0x33fde1,_0x5ce650[_0x232f('0x41')]);var _0x374983={'where':_0x33fde1[_0x232f('0x3e')]};return db[_0x232f('0x42')][_0x232f('0x20')](_0x374983)[_0x232f('0x26')](function(_0x374f6e){_0x313612['count']=_0x374f6e;if(_0x5ce650[_0x232f('0x33')]['includeAll']){_0x33fde1[_0x232f('0x43')]=[{'all':!![]}];}return db[_0x232f('0x42')]['findAll'](_0x33fde1);})[_0x232f('0x26')](function(_0xe0d781){_0x313612[_0x232f('0x44')]=_0xe0d781;return _0x313612;})[_0x232f('0x26')](respondWithFilteredResult(_0x39386d,_0x33fde1))[_0x232f('0x45')](handleError(_0x39386d,null));};exports['show']=function(_0x49b41f,_0x4e67c1){var _0x427f0c={'raw':![],'where':{'id':_0x49b41f[_0x232f('0x46')]['id']}},_0x16a556={};_0x16a556[_0x232f('0x37')]=_[_0x232f('0x32')](db[_0x232f('0x42')]['rawAttributes']);_0x16a556[_0x232f('0x33')]=_['keys'](_0x49b41f[_0x232f('0x33')]);_0x16a556[_0x232f('0x34')]=_[_0x232f('0x35')](_0x16a556[_0x232f('0x37')],_0x16a556[_0x232f('0x33')]);_0x427f0c[_0x232f('0x36')]=_[_0x232f('0x35')](_0x16a556['model'],qs[_0x232f('0x38')](_0x49b41f[_0x232f('0x33')][_0x232f('0x38')]));_0x427f0c[_0x232f('0x36')]=_0x427f0c['attributes'][_0x232f('0x39')]?_0x427f0c[_0x232f('0x36')]:_0x16a556[_0x232f('0x37')];if(_0x49b41f[_0x232f('0x33')][_0x232f('0x47')]){_0x427f0c[_0x232f('0x43')]=[{'all':!![]}];}_0x427f0c=_[_0x232f('0x3f')]({},_0x427f0c,_0x49b41f[_0x232f('0x41')]);return db[_0x232f('0x42')][_0x232f('0x48')](_0x427f0c)[_0x232f('0x26')](handleEntityNotFound(_0x4e67c1,null))[_0x232f('0x26')](respondWithResult(_0x4e67c1,null))[_0x232f('0x45')](handleError(_0x4e67c1,null));};exports[_0x232f('0x49')]=function(_0x4beff7,_0x48b6b5){return db[_0x232f('0x42')]['create'](_0x4beff7[_0x232f('0x4a')],{})[_0x232f('0x26')](respondWithResult(_0x48b6b5,0xc9))['catch'](handleError(_0x48b6b5,null));};exports[_0x232f('0x25')]=function(_0x2acc6f,_0x5f15ae){if(_0x2acc6f[_0x232f('0x4a')]['id']){delete _0x2acc6f['body']['id'];}return db[_0x232f('0x42')][_0x232f('0x48')]({'where':{'id':_0x2acc6f['params']['id']}})[_0x232f('0x26')](handleEntityNotFound(_0x5f15ae,null))[_0x232f('0x26')](saveUpdates(_0x2acc6f[_0x232f('0x4a')],null))[_0x232f('0x26')](respondWithResult(_0x5f15ae,null))[_0x232f('0x45')](handleError(_0x5f15ae,null));};exports[_0x232f('0x4b')]=function(_0x4cd792,_0x5065ee){return db[_0x232f('0x42')]['describe']()['then'](respondWithResult(_0x5065ee,null))['catch'](handleError(_0x5065ee,null));};exports[_0x232f('0x4c')]=function(_0x447e79,_0x3bc549,_0x4d1f6d){var _0x46ca3e=require(_0x232f('0x4d'));var _0xf53f62=![];var _0x472905={};if(_0x447e79[_0x232f('0x33')][_0x232f('0x2f')]&&_0x447e79[_0x232f('0x33')][_0x232f('0x2f')]===_0x232f('0x4e')){_0x472905[_0x232f('0x4e')]=_0x447e79[_0x232f('0x46')]['id'];}else{_0x472905['id']=_0x447e79['params']['id'];}return db[_0x232f('0x42')]['find']({'where':_0x472905,'attributes':['id',_0x232f('0x4f')],'raw':!![]})[_0x232f('0x26')](handleEntityNotFound(_0x3bc549,null))['then'](function(_0x4793f9){if(_0x4793f9){var _0x2663c1=_0x4793f9['value'];var _0x2ede98=util[_0x232f('0x50')]('%s.cypher',_0x2663c1);if(fs[_0x232f('0x51')](_0x2ede98)){_0xf53f62=!![];return _0x46ca3e[_0x232f('0x52')](_0x2ede98,_0x2663c1,config[_0x232f('0x53')][_0x232f('0x54')])[_0x232f('0x26')](function(){return _0x4793f9;});}return _0x4793f9;}})[_0x232f('0x26')](function(_0x27ba12){if(_0x27ba12){var _0x39c822=_0x27ba12['value'];if(!fs[_0x232f('0x51')](_0x39c822)){throw new db[(_0x232f('0x55'))][(_0x232f('0x56'))](_0x232f('0x57'));}if(_0x27ba12['filename']){return _0x3bc549['download'](_0x39c822,_0x27ba12[_0x232f('0x58')]+path[_0x232f('0x59')](_0x39c822),function(){if(_0xf53f62){fs[_0x232f('0x5a')](_0x39c822);}});}else{return _0x3bc549[_0x232f('0x4c')](_0x39c822,function(_0x1a379e){if(_0xf53f62){fs[_0x232f('0x5a')](_0x39c822);}});}}})[_0x232f('0x45')](function(_0x353935){if(_0x353935[_0x232f('0x5b')]===_0x232f('0x57')){_0x3bc549[_0x232f('0x1c')](0x194)[_0x232f('0x5c')](_0x232f('0x5d'));}else{return handleError(_0x3bc549,null);}});};exports['downloads']=function(_0x2ababb,_0x346d68,_0x25b21d){var _0x45f405=require('../../components/encryptor');var _0x42391d=![];var _0x3c124e={'$and':[db['sequelize'][_0x232f('0x3e')](db[_0x232f('0x5e')]['fn'](_0x232f('0x5f'),db['sequelize'][_0x232f('0x60')]('uniqueid')),_0x2ababb[_0x232f('0x33')][_0x232f('0x61')])]};if(_0x2ababb[_0x232f('0x33')][_0x232f('0x2f')]&&_0x2ababb[_0x232f('0x33')][_0x232f('0x2f')]===_0x232f('0x4e')){_0x3c124e['$and'][_0x232f('0x62')]({'uniqueid':_0x2ababb[_0x232f('0x46')]['id']});}else{_0x3c124e['$and']['push']({'id':_0x2ababb[_0x232f('0x46')]['id']});}return db[_0x232f('0x42')]['find']({'where':_0x3c124e,'attributes':['id',_0x232f('0x4f')],'raw':!![]})[_0x232f('0x26')](handleEntityNotFound(_0x346d68,null))[_0x232f('0x26')](function(_0x5cb632){if(_0x5cb632){var _0x1335df=util['format'](_0x232f('0x63'),_0x5cb632[_0x232f('0x4f')]);if(fs[_0x232f('0x51')](_0x1335df)){_0x42391d=!![];return _0x45f405[_0x232f('0x52')](_0x1335df,_0x5cb632[_0x232f('0x4f')],config[_0x232f('0x53')][_0x232f('0x54')])[_0x232f('0x26')](function(){return _0x5cb632;});}return _0x5cb632;}})[_0x232f('0x26')](function(_0x3f8ac0){if(_0x3f8ac0){if(!fs['existsSync'](_0x3f8ac0['value'])){throw new db[(_0x232f('0x55'))][(_0x232f('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x3f8ac0[_0x232f('0x58')]){return _0x346d68['download'](_0x3f8ac0[_0x232f('0x4f')],_0x3f8ac0['filename']+path['extname'](_0x3f8ac0[_0x232f('0x4f')]),function(){if(_0x42391d){fs[_0x232f('0x5a')](_0x3f8ac0[_0x232f('0x4f')]);}});}else{return _0x346d68['download'](_0x3f8ac0[_0x232f('0x4f')],function(_0x28ea3c){if(_0x42391d){fs[_0x232f('0x5a')](_0x3f8ac0[_0x232f('0x4f')]);}});}}})[_0x232f('0x45')](handleError(_0x346d68,null));};exports['destroy']=function(_0x544d38,_0x52a6ea){return db[_0x232f('0x42')]['find']({'where':{'id':_0x544d38[_0x232f('0x46')]['id']}})[_0x232f('0x26')](function(_0x945f6f){if(_['isNil'](_0x945f6f)){throw new ReferenceError('Entity\x20not\x20found');}return _0x945f6f;})[_0x232f('0x26')](function(_0x420203){var _0x1c6ec9=_0x420203[_0x232f('0x4f')];logger[_0x232f('0x64')](_0x232f('0x65'),_0x1c6ec9);if(!_['isNil'](_0x420203[_0x232f('0x4f')])&&fs[_0x232f('0x51')](_0x1c6ec9)){logger['info']('File:\x20\x22'+_0x1c6ec9+_0x232f('0x66'));fs['unlinkSync'](_0x1c6ec9);}_0x1c6ec9=_0x1c6ec9+'.cypher';if(!_['isNil'](_0x420203[_0x232f('0x4f')])&&fs[_0x232f('0x51')](_0x1c6ec9)){logger[_0x232f('0x64')](_0x232f('0x67')+_0x1c6ec9+_0x232f('0x66'));fs['unlinkSync'](_0x1c6ec9);}return _0x420203;})[_0x232f('0x26')](function(_0x6e3c2){if(!_0x6e3c2)throw new InternalError();return _0x6e3c2[_0x232f('0x68')]();})[_0x232f('0x26')](function(){_0x52a6ea[_0x232f('0x1c')](0xcc)[_0x232f('0x27')]();})[_0x232f('0x45')](handleError(_0x52a6ea,null));};function getBucketslist(_0xabc365,_0x45dbb4,_0x19c061){return new Promise(function(_0x11389b,_0x1decb5){var _0xaf6dba=new AWS['S3']({'accessKeyId':_0x45dbb4,'secretAccessKey':_0xabc365,'region':_0x19c061});_0xaf6dba[_0x232f('0x69')]({},function(_0x257609,_0x3561ef){if(_0x257609){return _0x1decb5(_0x257609);}else{return _0x11389b(_0x3561ef);}});});}function createBucket(_0x24e5d8,_0x35a259,_0x7ca486,_0x53c956){return new Promise(function(_0x195d31,_0x2097af){var _0x4a3eb7=new AWS['S3']({'accessKeyId':_0x35a259,'secretAccessKey':_0x24e5d8,'region':_0x7ca486});_0x4a3eb7['createBucket']({'Bucket':_0x53c956},function(_0x30840a,_0x4575bf){if(_0x30840a){return _0x2097af(_0x30840a);}else{return _0x195d31(_0x4575bf);}});});}function uploadFile(_0x52cbb8,_0x1ffac4,_0x20eb9d,_0xcc062e,_0xe86be,_0x646728){return new Promise(function(_0x3be79b,_0xe0654d){var _0x13a4f2=new AWS['S3']({'accessKeyId':_0x1ffac4,'secretAccessKey':_0x52cbb8,'region':_0x20eb9d});_0x13a4f2[_0x232f('0x6a')]({'Bucket':_0xcc062e,'Key':_0xe86be,'Body':_0x646728},function(_0x1b51f6,_0x40f4bb){if(_0x1b51f6){return _0xe0654d(_0x1b51f6);}else{return _0x3be79b(_0x40f4bb);}});});}function startTranscribe(_0x423654,_0x4bc2cb,_0x6f8f29,_0x4e31bd,_0x3c9adf,_0x246f77){return new Promise(function(_0x43530e,_0x74831a){var _0x1fde7f=new AWS[(_0x232f('0x6b'))]({'accessKeyId':_0x4bc2cb,'secretAccessKey':_0x423654,'region':_0x6f8f29});_0x1fde7f[_0x232f('0x6c')]({'TranscriptionJobName':_0x4e31bd,'LanguageCode':_0x3c9adf,'Media':{'MediaFileUri':_0x246f77}},function(_0x32ed5c,_0x4c3062){if(_0x32ed5c){return _0x74831a(_0x32ed5c);}else{return _0x43530e(_0x4c3062);}});});}function transcribe(_0x4407a1,_0x1fa003,_0x16b2ba,_0x4b36c9,_0x39962a,_0x23f4fd,_0x2ff16a){return new Promise(function(_0x34fd6e,_0x2c2171){var _0x3c1568={};logger[_0x232f('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4407a1,_0x39962a));return uploadFile(_0x1fa003,_0x16b2ba,_0x4b36c9,_0x39962a,path[_0x232f('0x6d')](_0x23f4fd),fs['readFileSync'](_0x23f4fd))[_0x232f('0x26')](function(_0x282c6f){logger[_0x232f('0x64')](util[_0x232f('0x50')](_0x232f('0x6e'),_0x4407a1,_0x39962a,_0x282c6f[_0x232f('0x6f')]));_0x3c1568[_0x232f('0x70')]=_0x282c6f['Bucket'];_0x3c1568['location']=_0x282c6f['Location'];logger[_0x232f('0x64')](util[_0x232f('0x50')](_0x232f('0x71'),_0x4407a1));return startTranscribe(_0x1fa003,_0x16b2ba,_0x4b36c9,uuidv4(),_0x2ff16a,_0x282c6f[_0x232f('0x6f')]);})[_0x232f('0x26')](function(_0x239a40){logger[_0x232f('0x64')](util[_0x232f('0x50')](_0x232f('0x72'),_0x4407a1,_0x239a40['TranscriptionJob'][_0x232f('0x73')]));_0x3c1568[_0x232f('0x74')]=_0x239a40[_0x232f('0x75')][_0x232f('0x73')];_0x3c1568[_0x232f('0x76')]=_0x239a40['TranscriptionJob'][_0x232f('0x77')];return _0x34fd6e(_0x3c1568);})[_0x232f('0x45')](function(_0x37b249){return _0x2c2171(_0x37b249);});});}exports['runTranscribe']=function(_0x366a8f,_0xdb83fa,_0x3ac6eb){var _0x5319c4;var _0x10b346;var _0x4532f9;var _0x1f9e53=require('../../components/encryptor');return db[_0x232f('0x42')][_0x232f('0x78')]({'where':{'id':_0x366a8f[_0x232f('0x46')]['id']}})[_0x232f('0x26')](function(_0x356546){if(_0x356546){var _0x5c0201=util[_0x232f('0x50')](_0x232f('0x63'),_0x356546['value']);if(fs[_0x232f('0x51')](_0x5c0201)){cypher=!![];return _0x1f9e53[_0x232f('0x52')](_0x5c0201,_0x356546[_0x232f('0x4f')],config[_0x232f('0x53')][_0x232f('0x54')])[_0x232f('0x26')](function(){return _0x356546;});}return _0x356546;}})['then'](function(_0x30fda6){if(!_0x30fda6){throw new db[(_0x232f('0x55'))]['ValidationError'](_0x232f('0x79'));}_0x10b346=_0x30fda6;return db[_0x232f('0x7a')][_0x232f('0x78')]({'where':{'id':0x1}});})[_0x232f('0x26')](handleEntityNotFound(_0xdb83fa,null))['then'](function(_0xc1121a){if(_0xc1121a){_0x5319c4=_0xc1121a;if(!_0x5319c4[_0x232f('0x7b')]||!_0x5319c4[_0x232f('0x7c')]||!_0x5319c4[_0x232f('0x7d')]||!_0x5319c4[_0x232f('0x7e')]||!_0x5319c4[_0x232f('0x70')]){throw new db[(_0x232f('0x55'))][(_0x232f('0x56'))](_0x232f('0x7f'));}if(_0x366a8f[_0x232f('0x4a')][_0x232f('0x80')]&&(!_0x5319c4[_0x232f('0x81')]||!_0x5319c4[_0x232f('0x82')]||!_0x5319c4[_0x232f('0x83')]||!_0x5319c4[_0x232f('0x7e')]||!_0x5319c4['bucket'])){throw new db[(_0x232f('0x55'))]['ValidationError'](_0x232f('0x84'));}return db['CloudProvider']['findOne']({'where':{'id':_0x5319c4[_0x232f('0x7c')]}});}})[_0x232f('0x26')](function(_0x4d9194){if(!_0x4d9194){throw new db['Sequelize'][(_0x232f('0x56'))](_0x232f('0x85'));}if(!_0x4d9194[_0x232f('0x86')]||!_0x4d9194['data2']){throw new db[(_0x232f('0x55'))][(_0x232f('0x56'))]('Cloud\x20Provider\x20not\x20configured');}_0x4532f9=_0x4d9194;return getBucketslist(_0x4532f9[_0x232f('0x86')],_0x4532f9['data2'],_0x5319c4[_0x232f('0x7d')]);})[_0x232f('0x26')](function(_0x2319f8){if(_0x2319f8&&_0x2319f8[_0x232f('0x87')]){var _0x212496=_['find'](_0x2319f8[_0x232f('0x87')],function(_0x3a19cf){return _0x3a19cf[_0x232f('0x88')]===_0x5319c4[_0x232f('0x70')];});if(!_0x212496){logger[_0x232f('0x64')](util[_0x232f('0x50')](_0x232f('0x89'),_0x366a8f[_0x232f('0x46')]['id'],_0x5319c4[_0x232f('0x70')]));return createBucket(_0x4532f9[_0x232f('0x86')],_0x4532f9['data2'],_0x5319c4[_0x232f('0x7d')],_0x5319c4[_0x232f('0x70')]);}logger['info'](util[_0x232f('0x50')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x366a8f[_0x232f('0x46')]['id'],_0x5319c4[_0x232f('0x70')]));return;}})[_0x232f('0x26')](function(_0x4a10f4){if(_0x10b346[_0x232f('0x76')]===_0x232f('0x8a')){return transcribe(_0x366a8f[_0x232f('0x46')]['id'],_0x4532f9[_0x232f('0x86')],_0x4532f9[_0x232f('0x8b')],_0x5319c4[_0x232f('0x7d')],_0x5319c4[_0x232f('0x70')],_0x10b346[_0x232f('0x4f')],_0x5319c4['language']);}else{logger['info'](util['format'](_0x232f('0x8c'),_0x366a8f[_0x232f('0x46')]['id']));return{'transcribeStatus':_0x232f('0x8d')};}})['then'](function(_0x386d0c){if(_0x386d0c){_0x386d0c[_0x232f('0x8e')]=_0x366a8f[_0x232f('0x4a')][_0x232f('0x80')];return _0x10b346[_0x232f('0x8f')](_0x386d0c);}})[_0x232f('0x26')](respondWithResult(_0xdb83fa,null))[_0x232f('0x45')](handleError(_0xdb83fa,null));};function writeFile(_0x206c10,_0x16021e){return new Promise(function(_0x25a29b,_0xa2a9f2){fs[_0x232f('0x90')](_0x16021e,_0x206c10,function(_0x156057,_0x3291dc){if(_0x156057){return _0xa2a9f2(_0x156057);}else{return _0x25a29b(_0x3291dc);}});});}exports[_0x232f('0x91')]=function(_0x5f4a32,_0x259e61,_0x13628a){return db[_0x232f('0x42')][_0x232f('0x78')]({'where':{'id':_0x5f4a32['params']['id']}})[_0x232f('0x26')](handleEntityNotFound(_0x259e61))['then'](function(_0x65c73a){if(_0x65c73a&&_0x65c73a[_0x232f('0x92')]){var _0x5c410f=_0x65c73a[_0x232f('0x92')];var _0x2c2006=config['root']+_0x232f('0x93')+_0x65c73a['id']+_0x232f('0x94');if(fs['existsSync'](_0x2c2006)){return _0x2c2006;}return writeFile(_0x5c410f,_0x2c2006)[_0x232f('0x26')](function(){return _0x2c2006;});}else{throw new db['Sequelize'][(_0x232f('0x56'))](_0x232f('0x95'));}})[_0x232f('0x26')](function(_0x8a4b0e){return _0x259e61['download'](_0x8a4b0e);})[_0x232f('0x45')](handleError(_0x259e61));}; \ No newline at end of file +var _0x6999=['IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','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','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','length','find','create','body','catch','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested'];(function(_0x2126f6,_0x436357){var _0x554b03=function(_0x1128e4){while(--_0x1128e4){_0x2126f6['push'](_0x2126f6['shift']());}};_0x554b03(++_0x436357);}(_0x6999,0x1e2));var _0x9699=function(_0x129eaf,_0x2792d8){_0x129eaf=_0x129eaf-0x0;var _0x56ead3=_0x6999[_0x129eaf];return _0x56ead3;};'use strict';var emlformat=require(_0x9699('0x0'));var rimraf=require(_0x9699('0x1'));var zipdir=require(_0x9699('0x2'));var jsonpatch=require(_0x9699('0x3'));var rp=require(_0x9699('0x4'));var moment=require(_0x9699('0x5'));var BPromise=require(_0x9699('0x6'));var Mustache=require(_0x9699('0x7'));var util=require(_0x9699('0x8'));var path=require(_0x9699('0x9'));var sox=require(_0x9699('0xa'));var csv=require(_0x9699('0xb'));var ejs=require(_0x9699('0xc'));var fs=require('fs');var fs_extra=require(_0x9699('0xd'));var _=require(_0x9699('0xe'));var squel=require(_0x9699('0xf'));var crypto=require(_0x9699('0x10'));var jsforce=require(_0x9699('0x11'));var deskjs=require(_0x9699('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9699('0x13'));var AWS=require(_0x9699('0x14'));var uuidv4=require(_0x9699('0x15'));var Redis=require(_0x9699('0x16'));var authService=require('../../components/auth/service');var qs=require(_0x9699('0x17'));var as=require(_0x9699('0x18'));var hardwareService=require(_0x9699('0x19'));var logger=require(_0x9699('0x1a'))(_0x9699('0x1b'));var utils=require(_0x9699('0x1c'));var config=require(_0x9699('0x1d'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46d123,_0x5779e3){_0x5779e3=_0x5779e3||0xcc;return function(_0x2935c7){if(_0x2935c7){return _0x46d123[_0x9699('0x1e')](_0x5779e3);}return _0x46d123[_0x9699('0x1f')](_0x5779e3)[_0x9699('0x20')]();};}function respondWithResult(_0x22782f,_0x233121){_0x233121=_0x233121||0xc8;return function(_0x3e12b6){if(_0x3e12b6){return _0x22782f['status'](_0x233121)['json'](_0x3e12b6);}};}function respondWithFilteredResult(_0x128956,_0x1ef687){return function(_0x12b6b3){if(_0x12b6b3){var _0x3e0261=typeof _0x1ef687[_0x9699('0x21')]===_0x9699('0x22')&&typeof _0x1ef687[_0x9699('0x23')]===_0x9699('0x22');var _0x418ede=_0x12b6b3[_0x9699('0x24')];var _0x83576f=_0x3e0261?0x0:_0x1ef687[_0x9699('0x21')];var _0x4063b9=_0x3e0261?_0x12b6b3[_0x9699('0x24')]:_0x1ef687[_0x9699('0x21')]+_0x1ef687[_0x9699('0x23')];var _0x501e35;if(_0x4063b9>=_0x418ede){_0x4063b9=_0x418ede;_0x501e35=0xc8;}else{_0x501e35=0xce;}_0x128956['status'](_0x501e35);return _0x128956[_0x9699('0x25')]('Content-Range',_0x83576f+'-'+_0x4063b9+'/'+_0x418ede)[_0x9699('0x26')](_0x12b6b3);}return null;};}function patchUpdates(_0x554d17){return function(_0x25e95e){try{jsonpatch[_0x9699('0x27')](_0x25e95e,_0x554d17,!![]);}catch(_0x40dd01){return BPromise[_0x9699('0x28')](_0x40dd01);}return _0x25e95e[_0x9699('0x29')]();};}function saveUpdates(_0x2ad2ef,_0x56b893){return function(_0x5d2808){if(_0x5d2808){return _0x5d2808[_0x9699('0x2a')](_0x2ad2ef)[_0x9699('0x2b')](function(_0x2cdfb9){return _0x2cdfb9;});}return null;};}function removeEntity(_0x41655d,_0x5d3dce){return function(_0x1b2679){if(_0x1b2679){return _0x1b2679[_0x9699('0x2c')]()[_0x9699('0x2b')](function(){_0x41655d[_0x9699('0x1f')](0xcc)[_0x9699('0x20')]();});}};}function handleEntityNotFound(_0x4cd4de,_0x37ca63){return function(_0x19d7a8){if(!_0x19d7a8){_0x4cd4de[_0x9699('0x1e')](0x194);}return _0x19d7a8;};}function handleError(_0x48f52a,_0x4fbe5b){_0x4fbe5b=_0x4fbe5b||0x1f4;return function(_0x25cc8d){logger['error'](_0x25cc8d[_0x9699('0x2d')]);if(_0x25cc8d['name']){delete _0x25cc8d[_0x9699('0x2e')];}_0x48f52a[_0x9699('0x1f')](_0x4fbe5b)[_0x9699('0x2f')](_0x25cc8d);};}exports[_0x9699('0x30')]=function(_0x5c6fee,_0x27f972){var _0x37c622={},_0x4f76a5={},_0x51cbd7={'count':0x0,'rows':[]};var _0x447065=_[_0x9699('0x31')](db[_0x9699('0x32')][_0x9699('0x33')],function(_0xdb4a8c){return{'name':_0xdb4a8c[_0x9699('0x34')],'type':_0xdb4a8c[_0x9699('0x35')][_0x9699('0x36')]};});_0x4f76a5['model']=_['differenceBy'](_[_0x9699('0x31')](_0x447065,_0x9699('0x2e')),[_0x9699('0x37')]);_0x4f76a5[_0x9699('0x38')]=_[_0x9699('0x39')](_0x5c6fee[_0x9699('0x38')]);_0x4f76a5[_0x9699('0x3a')]=_[_0x9699('0x3b')](_0x4f76a5[_0x9699('0x3c')],_0x4f76a5[_0x9699('0x38')]);_0x37c622[_0x9699('0x3d')]=_[_0x9699('0x3b')](_0x4f76a5[_0x9699('0x3c')],qs[_0x9699('0x3e')](_0x5c6fee[_0x9699('0x38')][_0x9699('0x3e')]));_0x37c622[_0x9699('0x3d')]=_0x37c622[_0x9699('0x3d')]['length']?_0x37c622[_0x9699('0x3d')]:_0x4f76a5[_0x9699('0x3c')];if(!_0x5c6fee[_0x9699('0x38')][_0x9699('0x3f')](_0x9699('0x40'))){_0x37c622[_0x9699('0x23')]=qs['limit'](_0x5c6fee['query'][_0x9699('0x23')]);_0x37c622[_0x9699('0x21')]=qs['offset'](_0x5c6fee[_0x9699('0x38')]['offset']);}_0x37c622['order']=qs[_0x9699('0x41')](_0x5c6fee[_0x9699('0x38')][_0x9699('0x41')]);_0x37c622[_0x9699('0x42')]=qs[_0x9699('0x3a')](_['pick'](_0x5c6fee[_0x9699('0x38')],_0x4f76a5[_0x9699('0x3a')]),_0x447065);if(_0x5c6fee['query'][_0x9699('0x43')]){_0x37c622[_0x9699('0x42')]=_['merge'](_0x37c622[_0x9699('0x42')],{'$or':_['map'](_0x447065,function(_0x24cb36){if(_0x24cb36[_0x9699('0x35')]!==_0x9699('0x44')){var _0x3646a9={};_0x3646a9[_0x24cb36['name']]={'$like':'%'+_0x5c6fee[_0x9699('0x38')]['filter']+'%'};return _0x3646a9;}})});}_0x37c622=_[_0x9699('0x45')]({},_0x37c622,_0x5c6fee[_0x9699('0x46')]);var _0x20a00f={'where':_0x37c622['where']};return db[_0x9699('0x32')]['count'](_0x20a00f)[_0x9699('0x2b')](function(_0x33a0e1){_0x51cbd7[_0x9699('0x24')]=_0x33a0e1;if(_0x5c6fee[_0x9699('0x38')][_0x9699('0x47')]){_0x37c622[_0x9699('0x48')]=[{'all':!![]}];}return db[_0x9699('0x32')][_0x9699('0x49')](_0x37c622);})[_0x9699('0x2b')](function(_0x10b3b0){_0x51cbd7[_0x9699('0x4a')]=_0x10b3b0;return _0x51cbd7;})[_0x9699('0x2b')](respondWithFilteredResult(_0x27f972,_0x37c622))['catch'](handleError(_0x27f972,null));};exports['show']=function(_0xb2c0f7,_0x5df513){var _0x55deac={'raw':![],'where':{'id':_0xb2c0f7[_0x9699('0x4b')]['id']}},_0x3e95af={};_0x3e95af[_0x9699('0x3c')]=_[_0x9699('0x39')](db[_0x9699('0x32')][_0x9699('0x33')]);_0x3e95af[_0x9699('0x38')]=_[_0x9699('0x39')](_0xb2c0f7[_0x9699('0x38')]);_0x3e95af[_0x9699('0x3a')]=_[_0x9699('0x3b')](_0x3e95af[_0x9699('0x3c')],_0x3e95af[_0x9699('0x38')]);_0x55deac[_0x9699('0x3d')]=_[_0x9699('0x3b')](_0x3e95af[_0x9699('0x3c')],qs[_0x9699('0x3e')](_0xb2c0f7[_0x9699('0x38')][_0x9699('0x3e')]));_0x55deac[_0x9699('0x3d')]=_0x55deac[_0x9699('0x3d')][_0x9699('0x4c')]?_0x55deac[_0x9699('0x3d')]:_0x3e95af[_0x9699('0x3c')];if(_0xb2c0f7[_0x9699('0x38')]['includeAll']){_0x55deac[_0x9699('0x48')]=[{'all':!![]}];}_0x55deac=_[_0x9699('0x45')]({},_0x55deac,_0xb2c0f7[_0x9699('0x46')]);return db['VoiceRecording'][_0x9699('0x4d')](_0x55deac)[_0x9699('0x2b')](handleEntityNotFound(_0x5df513,null))[_0x9699('0x2b')](respondWithResult(_0x5df513,null))['catch'](handleError(_0x5df513,null));};exports[_0x9699('0x4e')]=function(_0x48aff0,_0x137eb1){return db[_0x9699('0x32')][_0x9699('0x4e')](_0x48aff0[_0x9699('0x4f')],{})['then'](respondWithResult(_0x137eb1,0xc9))[_0x9699('0x50')](handleError(_0x137eb1,null));};exports[_0x9699('0x2a')]=function(_0x35caf7,_0x588328){if(_0x35caf7[_0x9699('0x4f')]['id']){delete _0x35caf7[_0x9699('0x4f')]['id'];}return db['VoiceRecording'][_0x9699('0x4d')]({'where':{'id':_0x35caf7[_0x9699('0x4b')]['id']}})[_0x9699('0x2b')](handleEntityNotFound(_0x588328,null))['then'](saveUpdates(_0x35caf7[_0x9699('0x4f')],null))[_0x9699('0x2b')](respondWithResult(_0x588328,null))[_0x9699('0x50')](handleError(_0x588328,null));};exports[_0x9699('0x51')]=function(_0x2c7bb5,_0x4ec625){return db['VoiceRecording']['describe']()[_0x9699('0x2b')](respondWithResult(_0x4ec625,null))[_0x9699('0x50')](handleError(_0x4ec625,null));};exports[_0x9699('0x52')]=function(_0x997656,_0x252408,_0x16a039){var _0xb1ae1b=require(_0x9699('0x53'));var _0xd3f8fe=![];var _0x24b914={};if(_0x997656[_0x9699('0x38')][_0x9699('0x35')]&&_0x997656[_0x9699('0x38')][_0x9699('0x35')]==='uniqueid'){_0x24b914[_0x9699('0x54')]=_0x997656[_0x9699('0x4b')]['id'];}else{_0x24b914['id']=_0x997656['params']['id'];}return db['VoiceRecording'][_0x9699('0x4d')]({'where':_0x24b914,'attributes':['id',_0x9699('0x55')],'raw':!![]})[_0x9699('0x2b')](handleEntityNotFound(_0x252408,null))[_0x9699('0x2b')](function(_0x1404c6){if(_0x1404c6){var _0x14d379=_0x1404c6[_0x9699('0x55')];var _0x5539a2=util[_0x9699('0x37')](_0x9699('0x56'),_0x14d379);if(fs[_0x9699('0x57')](_0x5539a2)){_0xd3f8fe=!![];return _0xb1ae1b[_0x9699('0x58')](_0x5539a2,_0x14d379,config['secrets'][_0x9699('0x59')])[_0x9699('0x2b')](function(){return _0x1404c6;});}return _0x1404c6;}})[_0x9699('0x2b')](function(_0x56c5d4){if(_0x56c5d4){var _0x19fb70=_0x56c5d4[_0x9699('0x55')];if(!fs[_0x9699('0x57')](_0x19fb70)){throw new db[(_0x9699('0x5a'))][(_0x9699('0x5b'))](_0x9699('0x5c'));}if(_0x56c5d4[_0x9699('0x5d')]){return _0x252408[_0x9699('0x52')](_0x19fb70,_0x56c5d4[_0x9699('0x5d')]+path[_0x9699('0x5e')](_0x19fb70),function(){if(_0xd3f8fe){fs[_0x9699('0x5f')](_0x19fb70);}});}else{return _0x252408[_0x9699('0x52')](_0x19fb70,function(_0x204066){if(_0xd3f8fe){fs[_0x9699('0x5f')](_0x19fb70);}});}}})[_0x9699('0x50')](function(_0x4cd74f){if(_0x4cd74f[_0x9699('0x60')]===_0x9699('0x5c')){_0x252408[_0x9699('0x1f')](0x194)[_0x9699('0x2f')](_0x9699('0x61'));}else{return handleError(_0x252408,null);}});};exports[_0x9699('0x62')]=function(_0x433b97,_0x26d649,_0x20868e){var _0x46b22c=require(_0x9699('0x53'));var _0x58fd2f=![];var _0x3e4d19={'$and':[db[_0x9699('0x63')][_0x9699('0x42')](db[_0x9699('0x63')]['fn'](_0x9699('0x64'),db[_0x9699('0x63')]['col'](_0x9699('0x54'))),_0x433b97['query'][_0x9699('0x65')])]};if(_0x433b97['query'][_0x9699('0x35')]&&_0x433b97[_0x9699('0x38')][_0x9699('0x35')]===_0x9699('0x54')){_0x3e4d19[_0x9699('0x66')][_0x9699('0x67')]({'uniqueid':_0x433b97[_0x9699('0x4b')]['id']});}else{_0x3e4d19[_0x9699('0x66')]['push']({'id':_0x433b97[_0x9699('0x4b')]['id']});}return db[_0x9699('0x32')][_0x9699('0x4d')]({'where':_0x3e4d19,'attributes':['id',_0x9699('0x55')],'raw':!![]})[_0x9699('0x2b')](handleEntityNotFound(_0x26d649,null))['then'](function(_0x8fd947){if(_0x8fd947){var _0x244582=util[_0x9699('0x37')]('%s.cypher',_0x8fd947['value']);if(fs['existsSync'](_0x244582)){_0x58fd2f=!![];return _0x46b22c[_0x9699('0x58')](_0x244582,_0x8fd947['value'],config['secrets'][_0x9699('0x59')])[_0x9699('0x2b')](function(){return _0x8fd947;});}return _0x8fd947;}})[_0x9699('0x2b')](function(_0x2cee8b){if(_0x2cee8b){if(!fs[_0x9699('0x57')](_0x2cee8b[_0x9699('0x55')])){throw new db[(_0x9699('0x5a'))]['ValidationError'](_0x9699('0x5c'));}if(_0x2cee8b[_0x9699('0x5d')]){return _0x26d649[_0x9699('0x52')](_0x2cee8b[_0x9699('0x55')],_0x2cee8b[_0x9699('0x5d')]+path[_0x9699('0x5e')](_0x2cee8b[_0x9699('0x55')]),function(){if(_0x58fd2f){fs[_0x9699('0x5f')](_0x2cee8b[_0x9699('0x55')]);}});}else{return _0x26d649[_0x9699('0x52')](_0x2cee8b[_0x9699('0x55')],function(_0x1971a2){if(_0x58fd2f){fs['unlink'](_0x2cee8b[_0x9699('0x55')]);}});}}})[_0x9699('0x50')](handleError(_0x26d649,null));};exports[_0x9699('0x2c')]=function(_0x2875bf,_0x19f9c1){return db[_0x9699('0x32')][_0x9699('0x4d')]({'where':{'id':_0x2875bf[_0x9699('0x4b')]['id']}})[_0x9699('0x2b')](function(_0x1bba70){if(_[_0x9699('0x68')](_0x1bba70)){throw new ReferenceError(_0x9699('0x69'));}return _0x1bba70;})[_0x9699('0x2b')](function(_0x4fc8e8){var _0x182aef=_0x4fc8e8[_0x9699('0x55')];logger[_0x9699('0x6a')](_0x9699('0x6b'),_0x182aef);if(!_[_0x9699('0x68')](_0x4fc8e8['value'])&&fs[_0x9699('0x57')](_0x182aef)){logger['info'](_0x9699('0x6c')+_0x182aef+_0x9699('0x6d'));fs[_0x9699('0x6e')](_0x182aef);}_0x182aef=_0x182aef+_0x9699('0x6f');if(!_['isNil'](_0x4fc8e8[_0x9699('0x55')])&&fs['existsSync'](_0x182aef)){logger[_0x9699('0x6a')](_0x9699('0x6c')+_0x182aef+_0x9699('0x6d'));fs[_0x9699('0x6e')](_0x182aef);}return _0x4fc8e8;})[_0x9699('0x2b')](function(_0x513611){if(!_0x513611)throw new InternalError();return _0x513611[_0x9699('0x2c')]();})['then'](function(){_0x19f9c1[_0x9699('0x1f')](0xcc)[_0x9699('0x20')]();})['catch'](handleError(_0x19f9c1,null));};function getBucketslist(_0x3b39c1,_0x1ea7ff,_0x55b5ed){return new Promise(function(_0x40b2f8,_0x15b8f5){var _0x3c59a5=new AWS['S3']({'accessKeyId':_0x1ea7ff,'secretAccessKey':_0x3b39c1,'region':_0x55b5ed});_0x3c59a5['listBuckets']({},function(_0x2144b6,_0x191ebd){if(_0x2144b6){return _0x15b8f5(_0x2144b6);}else{return _0x40b2f8(_0x191ebd);}});});}function createBucket(_0x2bfaf0,_0x52e733,_0x2f5e92,_0x44afc1){return new Promise(function(_0x33de60,_0x32182e){var _0x42a4a6=new AWS['S3']({'accessKeyId':_0x52e733,'secretAccessKey':_0x2bfaf0,'region':_0x2f5e92});_0x42a4a6[_0x9699('0x70')]({'Bucket':_0x44afc1},function(_0x5cebb3,_0xa9a631){if(_0x5cebb3){return _0x32182e(_0x5cebb3);}else{return _0x33de60(_0xa9a631);}});});}function uploadFile(_0x4450d3,_0x4d71ed,_0x34e0cc,_0x3a1078,_0x1e252b,_0x16a74e){return new Promise(function(_0x5838b8,_0x552477){var _0x1c6bd0=new AWS['S3']({'accessKeyId':_0x4d71ed,'secretAccessKey':_0x4450d3,'region':_0x34e0cc});_0x1c6bd0['upload']({'Bucket':_0x3a1078,'Key':_0x1e252b,'Body':_0x16a74e},function(_0x1a9188,_0xd19233){if(_0x1a9188){return _0x552477(_0x1a9188);}else{return _0x5838b8(_0xd19233);}});});}function startTranscribe(_0x4d9ea4,_0x305685,_0x163a58,_0x4dac8d,_0x4a1993,_0x57a0bc){return new Promise(function(_0x2fc58d,_0x35b579){var _0x125f3c=new AWS[(_0x9699('0x71'))]({'accessKeyId':_0x305685,'secretAccessKey':_0x4d9ea4,'region':_0x163a58});_0x125f3c[_0x9699('0x72')]({'TranscriptionJobName':_0x4dac8d,'LanguageCode':_0x4a1993,'Media':{'MediaFileUri':_0x57a0bc}},function(_0x2dbe80,_0x76f13d){if(_0x2dbe80){return _0x35b579(_0x2dbe80);}else{return _0x2fc58d(_0x76f13d);}});});}function transcribe(_0x33c30c,_0x6ecfbe,_0x40e703,_0x554170,_0x4fa751,_0x138de4,_0x3f49e9){return new Promise(function(_0xc3b63b,_0x548da4){var _0x1fcb89={};logger['info'](util[_0x9699('0x37')](_0x9699('0x73'),_0x33c30c,_0x4fa751));return uploadFile(_0x6ecfbe,_0x40e703,_0x554170,_0x4fa751,path[_0x9699('0x74')](_0x138de4),fs[_0x9699('0x75')](_0x138de4))[_0x9699('0x2b')](function(_0x332594){logger[_0x9699('0x6a')](util['format'](_0x9699('0x76'),_0x33c30c,_0x4fa751,_0x332594[_0x9699('0x77')]));_0x1fcb89[_0x9699('0x78')]=_0x332594['Bucket'];_0x1fcb89['location']=_0x332594[_0x9699('0x77')];logger['info'](util[_0x9699('0x37')](_0x9699('0x79'),_0x33c30c));return startTranscribe(_0x6ecfbe,_0x40e703,_0x554170,uuidv4(),_0x3f49e9,_0x332594[_0x9699('0x77')]);})[_0x9699('0x2b')](function(_0x567e83){logger['info'](util[_0x9699('0x37')](_0x9699('0x7a'),_0x33c30c,_0x567e83[_0x9699('0x7b')][_0x9699('0x7c')]));_0x1fcb89[_0x9699('0x7d')]=_0x567e83[_0x9699('0x7b')][_0x9699('0x7c')];_0x1fcb89['transcribeStatus']=_0x567e83[_0x9699('0x7b')][_0x9699('0x7e')];return _0xc3b63b(_0x1fcb89);})[_0x9699('0x50')](function(_0x1de506){return _0x548da4(_0x1de506);});});}exports[_0x9699('0x7f')]=function(_0x5a121d,_0x4a6339,_0x3b3713){var _0xbfa123;var _0x4386f9;var _0x2531d4;var _0x2b6a7d=require(_0x9699('0x53'));return db[_0x9699('0x32')][_0x9699('0x80')]({'where':{'id':_0x5a121d['params']['id']}})[_0x9699('0x2b')](function(_0xec03e9){if(_0xec03e9){var _0x32fc14=util[_0x9699('0x37')](_0x9699('0x56'),_0xec03e9['value']);if(fs[_0x9699('0x57')](_0x32fc14)){cypher=!![];return _0x2b6a7d[_0x9699('0x58')](_0x32fc14,_0xec03e9[_0x9699('0x55')],config[_0x9699('0x81')][_0x9699('0x59')])[_0x9699('0x2b')](function(){return _0xec03e9;});}return _0xec03e9;}})[_0x9699('0x2b')](function(_0x458d15){if(!_0x458d15){throw new db['Sequelize'][(_0x9699('0x5b'))](_0x9699('0x82'));}_0x4386f9=_0x458d15;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4a6339,null))[_0x9699('0x2b')](function(_0x517cc6){if(_0x517cc6){_0xbfa123=_0x517cc6;if(!_0xbfa123[_0x9699('0x83')]||!_0xbfa123[_0x9699('0x84')]||!_0xbfa123[_0x9699('0x85')]||!_0xbfa123['language']||!_0xbfa123[_0x9699('0x78')]){throw new db['Sequelize'][(_0x9699('0x5b'))](_0x9699('0x86'));}if(_0x5a121d[_0x9699('0x4f')][_0x9699('0x87')]&&(!_0xbfa123[_0x9699('0x88')]||!_0xbfa123[_0x9699('0x89')]||!_0xbfa123['sentimentRegion']||!_0xbfa123[_0x9699('0x8a')]||!_0xbfa123['bucket'])){throw new db[(_0x9699('0x5a'))][(_0x9699('0x5b'))](_0x9699('0x8b'));}return db['CloudProvider'][_0x9699('0x80')]({'where':{'id':_0xbfa123[_0x9699('0x84')]}});}})[_0x9699('0x2b')](function(_0x5c10b9){if(!_0x5c10b9){throw new db[(_0x9699('0x5a'))]['ValidationError'](_0x9699('0x8c'));}if(!_0x5c10b9[_0x9699('0x8d')]||!_0x5c10b9[_0x9699('0x8e')]){throw new db['Sequelize'][(_0x9699('0x5b'))]('Cloud\x20Provider\x20not\x20configured');}_0x2531d4=_0x5c10b9;return getBucketslist(_0x2531d4[_0x9699('0x8d')],_0x2531d4['data2'],_0xbfa123[_0x9699('0x85')]);})['then'](function(_0x58b44a){if(_0x58b44a&&_0x58b44a[_0x9699('0x8f')]){var _0x5d9f79=_[_0x9699('0x4d')](_0x58b44a[_0x9699('0x8f')],function(_0x1d4f36){return _0x1d4f36[_0x9699('0x90')]===_0xbfa123[_0x9699('0x78')];});if(!_0x5d9f79){logger[_0x9699('0x6a')](util[_0x9699('0x37')](_0x9699('0x91'),_0x5a121d[_0x9699('0x4b')]['id'],_0xbfa123['bucket']));return createBucket(_0x2531d4[_0x9699('0x8d')],_0x2531d4['data2'],_0xbfa123[_0x9699('0x85')],_0xbfa123[_0x9699('0x78')]);}logger[_0x9699('0x6a')](util['format'](_0x9699('0x92'),_0x5a121d[_0x9699('0x4b')]['id'],_0xbfa123['bucket']));return;}})['then'](function(_0x4b2650){if(_0x4386f9[_0x9699('0x93')]===_0x9699('0x94')){return transcribe(_0x5a121d['params']['id'],_0x2531d4[_0x9699('0x8d')],_0x2531d4[_0x9699('0x8e')],_0xbfa123[_0x9699('0x85')],_0xbfa123[_0x9699('0x78')],_0x4386f9[_0x9699('0x55')],_0xbfa123[_0x9699('0x8a')]);}else{logger[_0x9699('0x6a')](util['format'](_0x9699('0x95'),_0x5a121d[_0x9699('0x4b')]['id']));return{'transcribeStatus':_0x9699('0x96')};}})[_0x9699('0x2b')](function(_0x26573b){if(_0x26573b){_0x26573b['tempSentiment']=_0x5a121d[_0x9699('0x4f')][_0x9699('0x87')];return _0x4386f9[_0x9699('0x97')](_0x26573b);}})[_0x9699('0x2b')](respondWithResult(_0x4a6339,null))[_0x9699('0x50')](handleError(_0x4a6339,null));};function writeFile(_0xc1dad6,_0x4b1d08){return new Promise(function(_0xbaae9d,_0x223beb){fs[_0x9699('0x98')](_0x4b1d08,_0xc1dad6,function(_0x167ad2,_0x1d120f){if(_0x167ad2){return _0x223beb(_0x167ad2);}else{return _0xbaae9d(_0x1d120f);}});});}exports[_0x9699('0x99')]=function(_0x2b8232,_0x485135,_0x2e91c1){return db['VoiceRecording']['findOne']({'where':{'id':_0x2b8232[_0x9699('0x4b')]['id']}})[_0x9699('0x2b')](handleEntityNotFound(_0x485135))[_0x9699('0x2b')](function(_0xb5482a){if(_0xb5482a&&_0xb5482a[_0x9699('0x9a')]){var _0x254550=_0xb5482a[_0x9699('0x9a')];var _0x22107b=config['root']+_0x9699('0x9b')+_0xb5482a['id']+_0x9699('0x9c');if(fs[_0x9699('0x57')](_0x22107b)){return _0x22107b;}return writeFile(_0x254550,_0x22107b)[_0x9699('0x2b')](function(){return _0x22107b;});}else{throw new db[(_0x9699('0x5a'))][(_0x9699('0x5b'))](_0x9699('0x9d'));}})['then'](function(_0x560fcd){return _0x485135[_0x9699('0x52')](_0x560fcd);})[_0x9699('0x50')](handleError(_0x485135));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5124731..1cb64e8 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 _0xc91b=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x544072,_0xc41ee1){var _0x590bf6=function(_0x41107f){while(--_0x41107f){_0x544072['push'](_0x544072['shift']());}};_0x590bf6(++_0xc41ee1);}(_0xc91b,0x16f));var _0xbc91=function(_0x244db6,_0x58664c){_0x244db6=_0x244db6-0x0;var _0x2339e9=_0xc91b[_0x244db6];return _0x2339e9;};'use strict';var attributes=require(_0xbc91('0x0'));module[_0xbc91('0x1')]=function(_0x33a03d,_0xaca0fa){return _0x33a03d[_0xbc91('0x2')](_0xbc91('0x3'),attributes,{'tableName':_0xbc91('0x4'),'paranoid':![],'indexes':[{'name':_0xbc91('0x5'),'fields':['uniqueid']},{'name':_0xbc91('0x6'),'fields':[_0xbc91('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf5c=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x122c1f,_0x5814c7){_0x122c1f=_0x122c1f-0x0;var _0x20c71d=_0xbf5c[_0x122c1f];return _0x20c71d;};'use strict';var attributes=require(_0xcbf5('0x0'));module[_0xcbf5('0x1')]=function(_0x20db36,_0x5a5002){return _0x20db36[_0xcbf5('0x2')](_0xcbf5('0x3'),attributes,{'tableName':_0xcbf5('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcbf5('0x5')]},{'name':_0xcbf5('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index b13f78f..56dca2f 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 _0x7bd0=['callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceRecording','update','body','options','raw','attributes','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x7bd0,0x111));var _0x07bd=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x7bd0[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('VoiceRecording,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['UpdateVoiceRecording']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')](_0x3f9f0b[_0x07bd('0x1b')],{'raw':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['where']||null:null,'attributes':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['limit']||null:null})['then'](function(_0xbb7117){logger['info'](_0x07bd('0x1f'),_0x3f9f0b);logger['debug']('UpdateVoiceRecording',_0x3f9f0b,JSON[_0x07bd('0x13')](_0xbb7117));_0x4948f4(_0xbb7117);})[_0x07bd('0x18')](function(_0xf3b23c){logger[_0x07bd('0x14')](_0x07bd('0x1f'),_0xf3b23c[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0xf3b23c[_0x07bd('0x16')]));});});};exports[_0x07bd('0x20')]=function(_0x3db9d0){var _0x2a7202=this;return new Promise(function(_0x12ce26,_0x1c1fda){var _0x571dab=require('../../components/encryptor');var _0x5184dc;return db[_0x07bd('0x21')][_0x07bd('0x22')]({'attributes':['id',_0x07bd('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1a3aa9){_0x5184dc=_0x1a3aa9;return db[_0x07bd('0x19')][_0x07bd('0x24')](_0x3db9d0[_0x07bd('0x1b')]);})[_0x07bd('0xe')](function(_0x13bf6b){if(_0x5184dc['callRecordingEncryption']&&fs[_0x07bd('0x25')](_0x13bf6b[_0x07bd('0x26')])){var _0x4182b9=util[_0x07bd('0x27')](_0x07bd('0x28'),_0x13bf6b[_0x07bd('0x26')]);return _0x571dab[_0x07bd('0x29')](_0x13bf6b[_0x07bd('0x26')],_0x4182b9,config['secrets']['recording'])[_0x07bd('0xe')](function(){fs[_0x07bd('0x2a')](_0x13bf6b[_0x07bd('0x26')]);logger['info'](_0x07bd('0x2b'));return _0x13bf6b;});}return _0x13bf6b;})[_0x07bd('0xe')](function(_0x208aca){logger['info']('CreateVoiceRecording',_0x3db9d0);logger[_0x07bd('0x11')](_0x07bd('0x20'),_0x3db9d0,JSON[_0x07bd('0x13')](_0x208aca));_0x12ce26(_0x208aca);})[_0x07bd('0x18')](function(_0x5f29c5){logger[_0x07bd('0x14')](_0x07bd('0x20'),_0x5f29c5[_0x07bd('0x16')],_0x3db9d0);_0x1c1fda(_0x2a7202['error'](0x1f4,_0x5f29c5[_0x07bd('0x16')]));});});}; \ 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(_0x4875f9,_0x4694cd){var _0x4ad3b8=function(_0x566778){while(--_0x566778){_0x4875f9['push'](_0x4875f9['shift']());}};_0x4ad3b8(++_0x4694cd);}(_0x1623,0xab));var _0x3162=function(_0x2c4110,_0x3358fc){_0x2c4110=_0x2c4110-0x0;var _0x1dfb6a=_0x1623[_0x2c4110];return _0x1dfb6a;};'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 73ea01f..be55f9c 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 _0x11bf=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','post','update','delete','destroy'];(function(_0x174dfd,_0x5bd6f9){var _0x1037e0=function(_0x53acab){while(--_0x53acab){_0x174dfd['push'](_0x174dfd['shift']());}};_0x1037e0(++_0x5bd6f9);}(_0x11bf,0x10f));var _0xf11b=function(_0x4e936c,_0x383a85){_0x4e936c=_0x4e936c-0x0;var _0x1cfe21=_0x11bf[_0x4e936c];return _0x1cfe21;};'use strict';var multer=require(_0xf11b('0x0'));var util=require(_0xf11b('0x1'));var path=require(_0xf11b('0x2'));var timeout=require(_0xf11b('0x3'));var express=require('express');var router=express[_0xf11b('0x4')]();var fs_extra=require(_0xf11b('0x5'));var auth=require(_0xf11b('0x6'));var interaction=require(_0xf11b('0x7'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xf11b('0x8')]('/',auth[_0xf11b('0x9')](),controller[_0xf11b('0xa')]);router['get'](_0xf11b('0xb'),auth[_0xf11b('0x9')](),controller['describe']);router[_0xf11b('0x8')](_0xf11b('0xc'),auth[_0xf11b('0x9')](),controller['show']);router[_0xf11b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xf11b('0x9')](),controller[_0xf11b('0xe')]);router[_0xf11b('0xf')](_0xf11b('0xc'),auth[_0xf11b('0x9')](),controller[_0xf11b('0x10')]);module[_0xf11b('0x11')]=router; \ No newline at end of file +var _0x085a=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xdb9760,_0x577840){var _0x9309d8=function(_0x211f97){while(--_0x211f97){_0xdb9760['push'](_0xdb9760['shift']());}};_0x9309d8(++_0x577840);}(_0x085a,0x10d));var _0xa085=function(_0x53b999,_0x18c7ad){_0x53b999=_0x53b999-0x0;var _0xd31ca9=_0x085a[_0x53b999];return _0xd31ca9;};'use strict';var multer=require(_0xa085('0x0'));var util=require(_0xa085('0x1'));var path=require(_0xa085('0x2'));var timeout=require(_0xa085('0x3'));var express=require(_0xa085('0x4'));var router=express[_0xa085('0x5')]();var fs_extra=require(_0xa085('0x6'));var auth=require(_0xa085('0x7'));var interaction=require(_0xa085('0x8'));var config=require(_0xa085('0x9'));var controller=require('./voiceTransferReport.controller');router[_0xa085('0xa')]('/',auth['isAuthenticated'](),controller[_0xa085('0xb')]);router['get'](_0xa085('0xc'),auth['isAuthenticated'](),controller[_0xa085('0xd')]);router['get'](_0xa085('0xe'),auth['isAuthenticated'](),controller[_0xa085('0xf')]);router[_0xa085('0x10')]('/',auth['isAuthenticated'](),controller[_0xa085('0x11')]);router[_0xa085('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa085('0x13')]);router[_0xa085('0x14')](_0xa085('0xe'),auth['isAuthenticated'](),controller[_0xa085('0x15')]);module[_0xa085('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 874b046..93e8ca7 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 _0x25b8=['attended','STRING','ENUM','Yes','sequelize','moment','exports','blind'];(function(_0x1b1fe3,_0x2a78ac){var _0x3388fe=function(_0x4ab50d){while(--_0x4ab50d){_0x1b1fe3['push'](_0x1b1fe3['shift']());}};_0x3388fe(++_0x2a78ac);}(_0x25b8,0x1bc));var _0x825b=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x25b8[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x825b('0x0'));var moment=require(_0x825b('0x1'));module[_0x825b('0x2')]={'type':{'type':Sequelize['ENUM'](_0x825b('0x3'),_0x825b('0x4'))},'result':{'type':Sequelize[_0x825b('0x5')]},'transfererchannel':{'type':Sequelize[_0x825b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x825b('0x5')]},'transferercalleridname':{'type':Sequelize[_0x825b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x825b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x825b('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x825b('0x5')]},'transferercontext':{'type':Sequelize[_0x825b('0x5')]},'transfererexten':{'type':Sequelize[_0x825b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x825b('0x5')]},'transfereechannel':{'type':Sequelize[_0x825b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x825b('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x825b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x825b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x825b('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x825b('0x5')]},'transfereecontext':{'type':Sequelize[_0x825b('0x5')]},'transfereeexten':{'type':Sequelize[_0x825b('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x825b('0x6')](_0x825b('0x7'),'No')},'context':{'type':Sequelize[_0x825b('0x5')]},'extension':{'type':Sequelize[_0x825b('0x5')]}}; \ No newline at end of file +var _0x2936=['attended','STRING','ENUM','Yes','sequelize','moment'];(function(_0x378d61,_0x1e4533){var _0x1f6fd6=function(_0x431529){while(--_0x431529){_0x378d61['push'](_0x378d61['shift']());}};_0x1f6fd6(++_0x1e4533);}(_0x2936,0x154));var _0x6293=function(_0x1126c6,_0x16768b){_0x1126c6=_0x1126c6-0x0;var _0x5c9e86=_0x2936[_0x1126c6];return _0x5c9e86;};'use strict';var Sequelize=require(_0x6293('0x0'));var moment=require(_0x6293('0x1'));module['exports']={'type':{'type':Sequelize['ENUM']('blind',_0x6293('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x6293('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x6293('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6293('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x6293('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x6293('0x3')]},'transfereechannel':{'type':Sequelize[_0x6293('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x6293('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x6293('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6293('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6293('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x6293('0x3')]},'transfereeexten':{'type':Sequelize[_0x6293('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x6293('0x3')]},'isexternal':{'type':Sequelize[_0x6293('0x4')](_0x6293('0x5'),'No')},'context':{'type':Sequelize[_0x6293('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 b261c5d..a1e14cb 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 _0x99b7=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0xea8cc3,_0x1221c5){var _0x594900=function(_0x4a64b5){while(--_0x4a64b5){_0xea8cc3['push'](_0xea8cc3['shift']());}};_0x594900(++_0x1221c5);}(_0x99b7,0x1f2));var _0x799b=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x99b7[_0x223461];return _0x4dbe0a;};'use strict';var emlformat=require(_0x799b('0x0'));var rimraf=require(_0x799b('0x1'));var zipdir=require(_0x799b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x799b('0x3'));var moment=require('moment');var BPromise=require(_0x799b('0x4'));var Mustache=require(_0x799b('0x5'));var util=require(_0x799b('0x6'));var path=require(_0x799b('0x7'));var sox=require(_0x799b('0x8'));var csv=require(_0x799b('0x9'));var ejs=require(_0x799b('0xa'));var fs=require('fs');var fs_extra=require(_0x799b('0xb'));var _=require(_0x799b('0xc'));var squel=require('squel');var crypto=require(_0x799b('0xd'));var jsforce=require(_0x799b('0xe'));var deskjs=require(_0x799b('0xf'));var toCsv=require(_0x799b('0x9'));var querystring=require(_0x799b('0x10'));var Papa=require(_0x799b('0x11'));var Redis=require(_0x799b('0x12'));var authService=require(_0x799b('0x13'));var qs=require(_0x799b('0x14'));var as=require(_0x799b('0x15'));var hardwareService=require(_0x799b('0x16'));var logger=require(_0x799b('0x17'))(_0x799b('0x18'));var utils=require(_0x799b('0x19'));var config=require(_0x799b('0x1a'));var licenseUtil=require(_0x799b('0x1b'));var db=require(_0x799b('0x1c'))['db'];function respondWithStatusCode(_0x591839,_0x5891da){_0x5891da=_0x5891da||0xcc;return function(_0x6f4266){if(_0x6f4266){return _0x591839['sendStatus'](_0x5891da);}return _0x591839[_0x799b('0x1d')](_0x5891da)[_0x799b('0x1e')]();};}function respondWithResult(_0x1707de,_0x42983a){_0x42983a=_0x42983a||0xc8;return function(_0x94219b){if(_0x94219b){return _0x1707de[_0x799b('0x1d')](_0x42983a)[_0x799b('0x1f')](_0x94219b);}};}function respondWithFilteredResult(_0x350a7b,_0x32fcb6){return function(_0x3355bf){if(_0x3355bf){var _0x347c99=typeof _0x32fcb6[_0x799b('0x20')]==='undefined'&&typeof _0x32fcb6[_0x799b('0x21')]===_0x799b('0x22');var _0x23a842=_0x3355bf[_0x799b('0x23')];var _0x2a1635=_0x347c99?0x0:_0x32fcb6[_0x799b('0x20')];var _0x306083=_0x347c99?_0x3355bf[_0x799b('0x23')]:_0x32fcb6[_0x799b('0x20')]+_0x32fcb6[_0x799b('0x21')];var _0x970809;if(_0x306083>=_0x23a842){_0x306083=_0x23a842;_0x970809=0xc8;}else{_0x970809=0xce;}_0x350a7b[_0x799b('0x1d')](_0x970809);return _0x350a7b[_0x799b('0x24')](_0x799b('0x25'),_0x2a1635+'-'+_0x306083+'/'+_0x23a842)[_0x799b('0x1f')](_0x3355bf);}return null;};}function patchUpdates(_0x174b29){return function(_0x48aefa){try{jsonpatch[_0x799b('0x26')](_0x48aefa,_0x174b29,!![]);}catch(_0x44ec3c){return BPromise[_0x799b('0x27')](_0x44ec3c);}return _0x48aefa[_0x799b('0x28')]();};}function saveUpdates(_0x5776f9,_0x286370){return function(_0x3b59a1){if(_0x3b59a1){return _0x3b59a1[_0x799b('0x29')](_0x5776f9)[_0x799b('0x2a')](function(_0x4d913b){return _0x4d913b;});}return null;};}function removeEntity(_0x2d3ac5,_0x28fed2){return function(_0x2cc9f3){if(_0x2cc9f3){return _0x2cc9f3[_0x799b('0x2b')]()['then'](function(){_0x2d3ac5[_0x799b('0x1d')](0xcc)[_0x799b('0x1e')]();});}};}function handleEntityNotFound(_0x421fab,_0x5858a5){return function(_0x73c4e6){if(!_0x73c4e6){_0x421fab[_0x799b('0x2c')](0x194);}return _0x73c4e6;};}function handleError(_0x4c5c39,_0x332b01){_0x332b01=_0x332b01||0x1f4;return function(_0x6dab6b){logger[_0x799b('0x2d')](_0x6dab6b[_0x799b('0x2e')]);if(_0x6dab6b[_0x799b('0x2f')]){delete _0x6dab6b[_0x799b('0x2f')];}_0x4c5c39[_0x799b('0x1d')](_0x332b01)['send'](_0x6dab6b);};}exports[_0x799b('0x30')]=function(_0x1a8dfe,_0x3c079d){var _0x35d20d={},_0x3cfb5f={},_0x2b8de8={'count':0x0,'rows':[]};var _0x59baf4=_[_0x799b('0x31')](db['VoiceTransferReport'][_0x799b('0x32')],function(_0xb7fe5f){return{'name':_0xb7fe5f[_0x799b('0x33')],'type':_0xb7fe5f[_0x799b('0x34')][_0x799b('0x35')]};});_0x3cfb5f[_0x799b('0x36')]=_[_0x799b('0x31')](_0x59baf4,_0x799b('0x2f'));_0x3cfb5f[_0x799b('0x37')]=_[_0x799b('0x38')](_0x1a8dfe['query']);_0x3cfb5f[_0x799b('0x39')]=_['intersection'](_0x3cfb5f[_0x799b('0x36')],_0x3cfb5f[_0x799b('0x37')]);_0x35d20d[_0x799b('0x3a')]=_[_0x799b('0x3b')](_0x3cfb5f[_0x799b('0x36')],qs[_0x799b('0x3c')](_0x1a8dfe[_0x799b('0x37')]['fields']));_0x35d20d['attributes']=_0x35d20d['attributes'][_0x799b('0x3d')]?_0x35d20d[_0x799b('0x3a')]:_0x3cfb5f['model'];if(!_0x1a8dfe[_0x799b('0x37')][_0x799b('0x3e')](_0x799b('0x3f'))){_0x35d20d[_0x799b('0x21')]=qs[_0x799b('0x21')](_0x1a8dfe[_0x799b('0x37')]['limit']);_0x35d20d[_0x799b('0x20')]=qs[_0x799b('0x20')](_0x1a8dfe[_0x799b('0x37')]['offset']);}_0x35d20d[_0x799b('0x40')]=qs[_0x799b('0x41')](_0x1a8dfe['query']['sort']);_0x35d20d[_0x799b('0x42')]=qs[_0x799b('0x39')](_[_0x799b('0x43')](_0x1a8dfe['query'],_0x3cfb5f[_0x799b('0x39')]),_0x59baf4);if(_0x1a8dfe[_0x799b('0x37')]['filter']){_0x35d20d['where']=_[_0x799b('0x44')](_0x35d20d[_0x799b('0x42')],{'$or':_[_0x799b('0x31')](_0x59baf4,function(_0x5ca453){if(_0x5ca453[_0x799b('0x34')]!==_0x799b('0x45')){var _0x30ad03={};_0x30ad03[_0x5ca453['name']]={'$like':'%'+_0x1a8dfe['query'][_0x799b('0x46')]+'%'};return _0x30ad03;}})});}_0x35d20d=_[_0x799b('0x44')]({},_0x35d20d,_0x1a8dfe[_0x799b('0x47')]);var _0x5805b7={'where':_0x35d20d[_0x799b('0x42')]};return db[_0x799b('0x48')][_0x799b('0x23')](_0x5805b7)[_0x799b('0x2a')](function(_0x438d28){_0x2b8de8['count']=_0x438d28;if(_0x1a8dfe[_0x799b('0x37')][_0x799b('0x49')]){_0x35d20d[_0x799b('0x4a')]=[{'all':!![]}];}return db[_0x799b('0x48')][_0x799b('0x4b')](_0x35d20d);})[_0x799b('0x2a')](function(_0x1c0d6e){_0x2b8de8[_0x799b('0x4c')]=_0x1c0d6e;return _0x2b8de8;})[_0x799b('0x2a')](respondWithFilteredResult(_0x3c079d,_0x35d20d))[_0x799b('0x4d')](handleError(_0x3c079d,null));};exports[_0x799b('0x4e')]=function(_0x483ddf,_0x62cc84){var _0x4cf06c={'raw':!![],'where':{'id':_0x483ddf[_0x799b('0x4f')]['id']}},_0x5d38c0={};_0x5d38c0[_0x799b('0x36')]=_[_0x799b('0x38')](db[_0x799b('0x48')][_0x799b('0x32')]);_0x5d38c0[_0x799b('0x37')]=_[_0x799b('0x38')](_0x483ddf[_0x799b('0x37')]);_0x5d38c0[_0x799b('0x39')]=_[_0x799b('0x3b')](_0x5d38c0[_0x799b('0x36')],_0x5d38c0[_0x799b('0x37')]);_0x4cf06c[_0x799b('0x3a')]=_[_0x799b('0x3b')](_0x5d38c0[_0x799b('0x36')],qs[_0x799b('0x3c')](_0x483ddf[_0x799b('0x37')][_0x799b('0x3c')]));_0x4cf06c[_0x799b('0x3a')]=_0x4cf06c[_0x799b('0x3a')]['length']?_0x4cf06c[_0x799b('0x3a')]:_0x5d38c0[_0x799b('0x36')];if(_0x483ddf[_0x799b('0x37')][_0x799b('0x49')]){_0x4cf06c[_0x799b('0x4a')]=[{'all':!![]}];}_0x4cf06c=_['merge']({},_0x4cf06c,_0x483ddf[_0x799b('0x47')]);return db[_0x799b('0x48')][_0x799b('0x50')](_0x4cf06c)[_0x799b('0x2a')](handleEntityNotFound(_0x62cc84,null))[_0x799b('0x2a')](respondWithResult(_0x62cc84,null))[_0x799b('0x4d')](handleError(_0x62cc84,null));};exports[_0x799b('0x51')]=function(_0x2de8c4,_0x351d7f){return db[_0x799b('0x48')][_0x799b('0x51')](_0x2de8c4[_0x799b('0x52')],{})[_0x799b('0x2a')](respondWithResult(_0x351d7f,0xc9))[_0x799b('0x4d')](handleError(_0x351d7f,null));};exports[_0x799b('0x29')]=function(_0x4fa955,_0x492af8){if(_0x4fa955[_0x799b('0x52')]['id']){delete _0x4fa955[_0x799b('0x52')]['id'];}return db[_0x799b('0x48')][_0x799b('0x50')]({'where':{'id':_0x4fa955[_0x799b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x492af8,null))[_0x799b('0x2a')](saveUpdates(_0x4fa955['body'],null))['then'](respondWithResult(_0x492af8,null))[_0x799b('0x4d')](handleError(_0x492af8,null));};exports[_0x799b('0x2b')]=function(_0xf46221,_0x2fb5be){return db[_0x799b('0x48')]['find']({'where':{'id':_0xf46221[_0x799b('0x4f')]['id']}})[_0x799b('0x2a')](handleEntityNotFound(_0x2fb5be,null))[_0x799b('0x2a')](removeEntity(_0x2fb5be,null))['catch'](handleError(_0x2fb5be,null));};exports['describe']=function(_0x3a1042,_0x3dbdde){return db[_0x799b('0x48')][_0x799b('0x53')]()['then'](respondWithResult(_0x3dbdde,null))[_0x799b('0x4d')](handleError(_0x3dbdde,null));}; \ No newline at end of file +var _0x677a=['lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','rimraf','zip-dir','util','path','to-csv','ejs'];(function(_0x2a8cfa,_0x1605ac){var _0x289557=function(_0x24d729){while(--_0x24d729){_0x2a8cfa['push'](_0x2a8cfa['shift']());}};_0x289557(++_0x1605ac);}(_0x677a,0xcc));var _0xa677=function(_0x2f26ad,_0x214249){_0x2f26ad=_0x2f26ad-0x0;var _0x204370=_0x677a[_0x2f26ad];return _0x204370;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa677('0x0'));var zipdir=require(_0xa677('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa677('0x2'));var path=require(_0xa677('0x3'));var sox=require('sox');var csv=require(_0xa677('0x4'));var ejs=require(_0xa677('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa677('0x6'));var squel=require('squel');var crypto=require(_0xa677('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xa677('0x8'));var toCsv=require(_0xa677('0x4'));var querystring=require('querystring');var Papa=require(_0xa677('0x9'));var Redis=require(_0xa677('0xa'));var authService=require(_0xa677('0xb'));var qs=require(_0xa677('0xc'));var as=require(_0xa677('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa677('0xe'))('api');var utils=require(_0xa677('0xf'));var config=require(_0xa677('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xa677('0x11'))['db'];function respondWithStatusCode(_0x1b56d2,_0x494a04){_0x494a04=_0x494a04||0xcc;return function(_0x32b60b){if(_0x32b60b){return _0x1b56d2[_0xa677('0x12')](_0x494a04);}return _0x1b56d2['status'](_0x494a04)[_0xa677('0x13')]();};}function respondWithResult(_0x484fdf,_0x48a1f1){_0x48a1f1=_0x48a1f1||0xc8;return function(_0x1f6df4){if(_0x1f6df4){return _0x484fdf[_0xa677('0x14')](_0x48a1f1)['json'](_0x1f6df4);}};}function respondWithFilteredResult(_0x16c9c3,_0x2bbfc7){return function(_0x182b59){if(_0x182b59){var _0x1c38b2=typeof _0x2bbfc7['offset']===_0xa677('0x15')&&typeof _0x2bbfc7['limit']==='undefined';var _0x588fda=_0x182b59[_0xa677('0x16')];var _0x12c85f=_0x1c38b2?0x0:_0x2bbfc7[_0xa677('0x17')];var _0x28e7ab=_0x1c38b2?_0x182b59['count']:_0x2bbfc7[_0xa677('0x17')]+_0x2bbfc7[_0xa677('0x18')];var _0x2eced4;if(_0x28e7ab>=_0x588fda){_0x28e7ab=_0x588fda;_0x2eced4=0xc8;}else{_0x2eced4=0xce;}_0x16c9c3[_0xa677('0x14')](_0x2eced4);return _0x16c9c3['set'](_0xa677('0x19'),_0x12c85f+'-'+_0x28e7ab+'/'+_0x588fda)[_0xa677('0x1a')](_0x182b59);}return null;};}function patchUpdates(_0x17d57a){return function(_0x46eddf){try{jsonpatch[_0xa677('0x1b')](_0x46eddf,_0x17d57a,!![]);}catch(_0x335b35){return BPromise[_0xa677('0x1c')](_0x335b35);}return _0x46eddf[_0xa677('0x1d')]();};}function saveUpdates(_0x36f69e,_0x11d940){return function(_0x46b39f){if(_0x46b39f){return _0x46b39f[_0xa677('0x1e')](_0x36f69e)['then'](function(_0x292116){return _0x292116;});}return null;};}function removeEntity(_0x38f917,_0x10ad1b){return function(_0x2c5336){if(_0x2c5336){return _0x2c5336['destroy']()[_0xa677('0x1f')](function(){_0x38f917[_0xa677('0x14')](0xcc)[_0xa677('0x13')]();});}};}function handleEntityNotFound(_0x5b0c23,_0x397fcd){return function(_0x2c0c6f){if(!_0x2c0c6f){_0x5b0c23['sendStatus'](0x194);}return _0x2c0c6f;};}function handleError(_0x384213,_0x2e0f7b){_0x2e0f7b=_0x2e0f7b||0x1f4;return function(_0x13ba16){logger[_0xa677('0x20')](_0x13ba16[_0xa677('0x21')]);if(_0x13ba16[_0xa677('0x22')]){delete _0x13ba16[_0xa677('0x22')];}_0x384213[_0xa677('0x14')](_0x2e0f7b)[_0xa677('0x23')](_0x13ba16);};}exports['index']=function(_0x3da75d,_0x421def){var _0x563b16={},_0x5b075e={},_0x2030d1={'count':0x0,'rows':[]};var _0x3626ee=_['map'](db[_0xa677('0x24')][_0xa677('0x25')],function(_0x38171c){return{'name':_0x38171c[_0xa677('0x26')],'type':_0x38171c[_0xa677('0x27')]['key']};});_0x5b075e[_0xa677('0x28')]=_[_0xa677('0x29')](_0x3626ee,_0xa677('0x22'));_0x5b075e[_0xa677('0x2a')]=_['keys'](_0x3da75d['query']);_0x5b075e[_0xa677('0x2b')]=_[_0xa677('0x2c')](_0x5b075e['model'],_0x5b075e[_0xa677('0x2a')]);_0x563b16[_0xa677('0x2d')]=_[_0xa677('0x2c')](_0x5b075e[_0xa677('0x28')],qs['fields'](_0x3da75d['query'][_0xa677('0x2e')]));_0x563b16[_0xa677('0x2d')]=_0x563b16[_0xa677('0x2d')]['length']?_0x563b16['attributes']:_0x5b075e[_0xa677('0x28')];if(!_0x3da75d['query'][_0xa677('0x2f')](_0xa677('0x30'))){_0x563b16['limit']=qs[_0xa677('0x18')](_0x3da75d[_0xa677('0x2a')][_0xa677('0x18')]);_0x563b16[_0xa677('0x17')]=qs[_0xa677('0x17')](_0x3da75d[_0xa677('0x2a')][_0xa677('0x17')]);}_0x563b16[_0xa677('0x31')]=qs[_0xa677('0x32')](_0x3da75d[_0xa677('0x2a')]['sort']);_0x563b16[_0xa677('0x33')]=qs[_0xa677('0x2b')](_[_0xa677('0x34')](_0x3da75d[_0xa677('0x2a')],_0x5b075e[_0xa677('0x2b')]),_0x3626ee);if(_0x3da75d[_0xa677('0x2a')][_0xa677('0x35')]){_0x563b16[_0xa677('0x33')]=_[_0xa677('0x36')](_0x563b16[_0xa677('0x33')],{'$or':_['map'](_0x3626ee,function(_0x41d0f1){if(_0x41d0f1[_0xa677('0x27')]!==_0xa677('0x37')){var _0x4f0acd={};_0x4f0acd[_0x41d0f1['name']]={'$like':'%'+_0x3da75d['query'][_0xa677('0x35')]+'%'};return _0x4f0acd;}})});}_0x563b16=_[_0xa677('0x36')]({},_0x563b16,_0x3da75d[_0xa677('0x38')]);var _0x697b0f={'where':_0x563b16[_0xa677('0x33')]};return db['VoiceTransferReport'][_0xa677('0x16')](_0x697b0f)['then'](function(_0x25ae60){_0x2030d1[_0xa677('0x16')]=_0x25ae60;if(_0x3da75d[_0xa677('0x2a')][_0xa677('0x39')]){_0x563b16['include']=[{'all':!![]}];}return db[_0xa677('0x24')][_0xa677('0x3a')](_0x563b16);})[_0xa677('0x1f')](function(_0x41da05){_0x2030d1[_0xa677('0x3b')]=_0x41da05;return _0x2030d1;})['then'](respondWithFilteredResult(_0x421def,_0x563b16))[_0xa677('0x3c')](handleError(_0x421def,null));};exports[_0xa677('0x3d')]=function(_0x3275a1,_0xd9578a){var _0x302122={'raw':!![],'where':{'id':_0x3275a1[_0xa677('0x3e')]['id']}},_0x3c7d4a={};_0x3c7d4a[_0xa677('0x28')]=_[_0xa677('0x3f')](db['VoiceTransferReport'][_0xa677('0x25')]);_0x3c7d4a[_0xa677('0x2a')]=_[_0xa677('0x3f')](_0x3275a1[_0xa677('0x2a')]);_0x3c7d4a[_0xa677('0x2b')]=_['intersection'](_0x3c7d4a[_0xa677('0x28')],_0x3c7d4a[_0xa677('0x2a')]);_0x302122[_0xa677('0x2d')]=_['intersection'](_0x3c7d4a[_0xa677('0x28')],qs[_0xa677('0x2e')](_0x3275a1[_0xa677('0x2a')]['fields']));_0x302122[_0xa677('0x2d')]=_0x302122['attributes']['length']?_0x302122['attributes']:_0x3c7d4a['model'];if(_0x3275a1['query'][_0xa677('0x39')]){_0x302122[_0xa677('0x40')]=[{'all':!![]}];}_0x302122=_[_0xa677('0x36')]({},_0x302122,_0x3275a1[_0xa677('0x38')]);return db[_0xa677('0x24')][_0xa677('0x41')](_0x302122)['then'](handleEntityNotFound(_0xd9578a,null))['then'](respondWithResult(_0xd9578a,null))['catch'](handleError(_0xd9578a,null));};exports[_0xa677('0x42')]=function(_0x1ac7b0,_0xef975){return db['VoiceTransferReport'][_0xa677('0x42')](_0x1ac7b0[_0xa677('0x43')],{})[_0xa677('0x1f')](respondWithResult(_0xef975,0xc9))[_0xa677('0x3c')](handleError(_0xef975,null));};exports[_0xa677('0x1e')]=function(_0x345990,_0x108056){if(_0x345990[_0xa677('0x43')]['id']){delete _0x345990[_0xa677('0x43')]['id'];}return db[_0xa677('0x24')][_0xa677('0x41')]({'where':{'id':_0x345990['params']['id']}})[_0xa677('0x1f')](handleEntityNotFound(_0x108056,null))[_0xa677('0x1f')](saveUpdates(_0x345990[_0xa677('0x43')],null))[_0xa677('0x1f')](respondWithResult(_0x108056,null))[_0xa677('0x3c')](handleError(_0x108056,null));};exports[_0xa677('0x44')]=function(_0xb2b7c3,_0x24663f){return db[_0xa677('0x24')]['find']({'where':{'id':_0xb2b7c3[_0xa677('0x3e')]['id']}})[_0xa677('0x1f')](handleEntityNotFound(_0x24663f,null))[_0xa677('0x1f')](removeEntity(_0x24663f,null))[_0xa677('0x3c')](handleError(_0x24663f,null));};exports['describe']=function(_0x2d4427,_0x5de705){return db[_0xa677('0x24')][_0xa677('0x45')]()[_0xa677('0x1f')](respondWithResult(_0x5de705,null))[_0xa677('0x3c')](handleError(_0x5de705,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5eee9d8..7da2ce4 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 _0x2191=['path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x52bc53,_0x29d09d){var _0x36d12b=function(_0x1cd325){while(--_0x1cd325){_0x52bc53['push'](_0x52bc53['shift']());}};_0x36d12b(++_0x29d09d);}(_0x2191,0xa3));var _0x1219=function(_0x203eec,_0x563e0f){_0x203eec=_0x203eec-0x0;var _0x4fa0e6=_0x2191[_0x203eec];return _0x4fa0e6;};'use strict';var _=require(_0x1219('0x0'));var util=require(_0x1219('0x1'));var logger=require(_0x1219('0x2'))('api');var moment=require(_0x1219('0x3'));var BPromise=require(_0x1219('0x4'));var rp=require(_0x1219('0x5'));var fs=require('fs');var path=require(_0x1219('0x6'));var rimraf=require(_0x1219('0x7'));var config=require('../../config/environment');var attributes=require(_0x1219('0x8'));module[_0x1219('0x9')]=function(_0x415b4b,_0x383539){return _0x415b4b[_0x1219('0xa')](_0x1219('0xb'),attributes,{'tableName':_0x1219('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb137=['../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x295308,_0x5114b7){var _0x20773c=function(_0x4b491d){while(--_0x4b491d){_0x295308['push'](_0x295308['shift']());}};_0x20773c(++_0x5114b7);}(_0xb137,0x1b2));var _0x7b13=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0xb137[_0x121886];return _0x20ca01;};'use strict';var _=require(_0x7b13('0x0'));var util=require('util');var logger=require(_0x7b13('0x1'))(_0x7b13('0x2'));var moment=require(_0x7b13('0x3'));var BPromise=require(_0x7b13('0x4'));var rp=require(_0x7b13('0x5'));var fs=require('fs');var path=require(_0x7b13('0x6'));var rimraf=require(_0x7b13('0x7'));var config=require(_0x7b13('0x8'));var attributes=require(_0x7b13('0x9'));module['exports']=function(_0x3b8732,_0x352052){return _0x3b8732[_0x7b13('0xa')](_0x7b13('0xb'),attributes,{'tableName':_0x7b13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 7a8af4f..5fcfda4 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 _0x6a3b=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x12095d,_0x2b5671){var _0x933407=function(_0x19681d){while(--_0x19681d){_0x12095d['push'](_0x12095d['shift']());}};_0x933407(++_0x2b5671);}(_0x6a3b,0xb6));var _0xb6a3=function(_0x265619,_0x1a11c8){_0x265619=_0x265619-0x0;var _0x1b5258=_0x6a3b[_0x265619];return _0x1b5258;};'use strict';var _=require('lodash');var util=require(_0xb6a3('0x0'));var moment=require(_0xb6a3('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6a3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a3('0x3'))['db'];var utils=require(_0xb6a3('0x4'));var logger=require(_0xb6a3('0x5'))(_0xb6a3('0x6'));var config=require(_0xb6a3('0x7'));var jayson=require(_0xb6a3('0x8'));var client=jayson['client'][_0xb6a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32743c,_0x56036f,_0x2fe88d){return new BPromise(function(_0x39580f,_0x73a405){return client[_0xb6a3('0xa')](_0x32743c,_0x2fe88d)[_0xb6a3('0xb')](function(_0x57e7e0){logger[_0xb6a3('0xc')](_0xb6a3('0xd'),_0x56036f,_0xb6a3('0xe'));logger[_0xb6a3('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x56036f,_0xb6a3('0xe'),JSON['stringify'](_0x57e7e0));if(_0x57e7e0[_0xb6a3('0x10')]){if(_0x57e7e0[_0xb6a3('0x10')][_0xb6a3('0x11')]===0x1f4){logger[_0xb6a3('0x10')](_0xb6a3('0xd'),_0x56036f,_0x57e7e0[_0xb6a3('0x10')][_0xb6a3('0x12')]);return _0x73a405(_0x57e7e0[_0xb6a3('0x10')]['message']);}logger[_0xb6a3('0x10')](_0xb6a3('0xd'),_0x56036f,_0x57e7e0[_0xb6a3('0x10')]['message']);return _0x39580f(_0x57e7e0['error']['message']);}else{logger['info'](_0xb6a3('0xd'),_0x56036f,_0xb6a3('0xe'));_0x39580f(_0x57e7e0[_0xb6a3('0x13')][_0xb6a3('0x12')]);}})[_0xb6a3('0x14')](function(_0x27769e){logger[_0xb6a3('0x10')](_0xb6a3('0xd'),_0x56036f,_0x27769e);_0x73a405(_0x27769e);});});}exports[_0xb6a3('0x15')]=function(_0x10c15a){var _0x193f30=this;return new Promise(function(_0x4bd2b3,_0x3e73f9){return db[_0xb6a3('0x16')][_0xb6a3('0x17')](_0x10c15a[_0xb6a3('0x18')],{'raw':_0x10c15a[_0xb6a3('0x19')]?_0x10c15a['options']['raw']===undefined?!![]:![]:!![]})[_0xb6a3('0xb')](function(_0x257246){logger[_0xb6a3('0xc')](_0xb6a3('0x15'),_0x10c15a);logger[_0xb6a3('0xf')](_0xb6a3('0x15'),_0x10c15a,JSON['stringify'](_0x257246));_0x4bd2b3(_0x257246);})[_0xb6a3('0x14')](function(_0x552e86){logger[_0xb6a3('0x10')](_0xb6a3('0x15'),_0x552e86[_0xb6a3('0x12')],_0x10c15a);_0x3e73f9(_0x193f30[_0xb6a3('0x10')](0x1f4,_0x552e86['message']));});});}; \ No newline at end of file +var _0x3c8f=['result','catch','VoiceTransferReport','create','body','raw','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x2d64fc,_0x42b2a7){var _0x2c8556=function(_0x4b29da){while(--_0x4b29da){_0x2d64fc['push'](_0x2d64fc['shift']());}};_0x2c8556(++_0x42b2a7);}(_0x3c8f,0x180));var _0xf3c8=function(_0x392750,_0x4d10be){_0x392750=_0x392750-0x0;var _0x3686f9=_0x3c8f[_0x392750];return _0x3686f9;};'use strict';var _=require(_0xf3c8('0x0'));var util=require(_0xf3c8('0x1'));var moment=require('moment');var BPromise=require(_0xf3c8('0x2'));var rs=require(_0xf3c8('0x3'));var fs=require('fs');var Redis=require(_0xf3c8('0x4'));var db=require(_0xf3c8('0x5'))['db'];var utils=require(_0xf3c8('0x6'));var logger=require('../../config/logger')(_0xf3c8('0x7'));var config=require(_0xf3c8('0x8'));var jayson=require(_0xf3c8('0x9'));var client=jayson[_0xf3c8('0xa')][_0xf3c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412284,_0x5c05ad,_0x33dff3){return new BPromise(function(_0x4df4f6,_0x329140){return client[_0xf3c8('0xc')](_0x412284,_0x33dff3)[_0xf3c8('0xd')](function(_0x452483){logger[_0xf3c8('0xe')](_0xf3c8('0xf'),_0x5c05ad,'request\x20sent');logger[_0xf3c8('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5c05ad,_0xf3c8('0x11'),JSON[_0xf3c8('0x12')](_0x452483));if(_0x452483[_0xf3c8('0x13')]){if(_0x452483[_0xf3c8('0x13')][_0xf3c8('0x14')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5c05ad,_0x452483[_0xf3c8('0x13')][_0xf3c8('0x15')]);return _0x329140(_0x452483[_0xf3c8('0x13')]['message']);}logger[_0xf3c8('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c05ad,_0x452483[_0xf3c8('0x13')]['message']);return _0x4df4f6(_0x452483['error']['message']);}else{logger[_0xf3c8('0xe')](_0xf3c8('0xf'),_0x5c05ad,_0xf3c8('0x11'));_0x4df4f6(_0x452483[_0xf3c8('0x16')]['message']);}})[_0xf3c8('0x17')](function(_0x14d6a6){logger[_0xf3c8('0x13')](_0xf3c8('0xf'),_0x5c05ad,_0x14d6a6);_0x329140(_0x14d6a6);});});}exports['CreateVoiceTransferReport']=function(_0x40d7a0){var _0x5a7f44=this;return new Promise(function(_0x1e0a90,_0x573db0){return db[_0xf3c8('0x18')][_0xf3c8('0x19')](_0x40d7a0[_0xf3c8('0x1a')],{'raw':_0x40d7a0['options']?_0x40d7a0['options'][_0xf3c8('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x17bfc6){logger['info'](_0xf3c8('0x1c'),_0x40d7a0);logger['debug'](_0xf3c8('0x1c'),_0x40d7a0,JSON[_0xf3c8('0x12')](_0x17bfc6));_0x1e0a90(_0x17bfc6);})[_0xf3c8('0x17')](function(_0x37e4a5){logger[_0xf3c8('0x13')](_0xf3c8('0x1c'),_0x37e4a5[_0xf3c8('0x15')],_0x40d7a0);_0x573db0(_0x5a7f44[_0xf3c8('0x13')](0x1f4,_0x37e4a5[_0xf3c8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f712640..6863216 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x29b86d,_0x2e38af){var _0xc0490b=function(_0x55e077){while(--_0x55e077){_0x29b86d['push'](_0x29b86d['shift']());}};_0xc0490b(++_0x2e38af);}(_0xf109,0xce));var _0x9f10=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xf109[_0x2283dc];return _0x16db90;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe706=['/transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls'];(function(_0x395455,_0x14174d){var _0x294d86=function(_0x54582c){while(--_0x54582c){_0x395455['push'](_0x395455['shift']());}};_0x294d86(++_0x14174d);}(_0xe706,0xa3));var _0x6e70=function(_0x384dfd,_0x54bc76){_0x384dfd=_0x384dfd-0x0;var _0x5e232c=_0xe706[_0x384dfd];return _0x5e232c;};'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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4017a1e..117619f 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 _0x422f=['transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','name','status','send','request','error','code','message','result','catch','findOne','agent','then','all','filter','UserId','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','length','json','userId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','sessionId','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:'];(function(_0xf8c542,_0x5360e4){var _0x444fd3=function(_0x144c76){while(--_0x144c76){_0xf8c542['push'](_0xf8c542['shift']());}};_0x444fd3(++_0x5360e4);}(_0x422f,0x1c7));var _0xf422=function(_0x393c52,_0x3e8cf7){_0x393c52=_0x393c52-0x0;var _0x438b53=_0x422f[_0x393c52];return _0x438b53;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf422('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xf422('0x1'));var util=require(_0xf422('0x2'));var BPromise=require('bluebird');var jayson=require(_0xf422('0x3'));var amiClient=jayson[_0xf422('0x4')][_0xf422('0x5')]({'port':0x232a});var logger=require(_0xf422('0x6'))(_0xf422('0x7'));var Redis=require(_0xf422('0x8'));config[_0xf422('0x9')]=_[_0xf422('0xa')](config[_0xf422('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf422('0xb'))(new Redis(config[_0xf422('0x9')]));var Schema=require(_0xf422('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'callNumber':{'type':'string','required':[!![],_0xf422('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':'string','required':[!![],_0xf422('0x11')]},'transferNumber':{'type':_0xf422('0x10'),'required':[!![],_0xf422('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf422('0xe')]}});function emit(_0x30b70a,_0x21a35d,_0xdf4434){logger['info'](_0x30b70a,_0x21a35d,JSON[_0xf422('0x13')](_0xdf4434));io['to'](_0x30b70a)[_0xf422('0x14')](_0x21a35d,_0xdf4434);}function handleError(_0x76e4b1){return function(_0x2ae133){console[_0xf422('0x15')](_0xf422('0x16'),_0x2ae133,_0x2ae133 instanceof RangeError);logger['error'](_0x2ae133['stack']);if(_0x2ae133 instanceof RangeError){if(_0x2ae133[_0xf422('0x17')]){delete _0x2ae133[_0xf422('0x17')];}_0x76e4b1[_0xf422('0x18')](0x194)['send'](_0x2ae133);}else{if(_0x2ae133[_0xf422('0x17')]){delete _0x2ae133['name'];}_0x76e4b1[_0xf422('0x18')](0x1f4)[_0xf422('0x19')](_0x2ae133);}};}function checkError(){return function(_0x36b7e7){if(!_0x36b7e7){throw new RangeError('NotFound');}return _0x36b7e7;};}function respondWithRpcPromise(_0xf2d06b,_0x3cdd93){return new BPromise(function(_0x511529,_0x4b80a0){var _0x268575=amiClient;return _0x268575[_0xf422('0x1a')](_0xf2d06b,_0x3cdd93)['then'](function(_0x25b6a5){if(_0x25b6a5['error']){if(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1c')]===0x1f4){return _0x4b80a0(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1d')]);}return _0x511529(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1d')]);}else{_0x511529(_0x25b6a5[_0xf422('0x1e')]);}})[_0xf422('0x1f')](function(_0x5dcab4){_0x4b80a0(_0x5dcab4);});});}function getAgent(_0x1125ce){return db['User'][_0xf422('0x20')]({'where':{'id':_0x1125ce,'role':_0xf422('0x21')}})[_0xf422('0x22')](checkError());}function getAgentCheckSession(_0x3d3fe4,_0xaa3e7e){return new BPromise(function(_0x31f439,_0x2d0053){var _0x4ebfe9=respondWithRpcPromise('VoiceChannels');var _0x35d1fa=getAgent(_0x3d3fe4);Promise[_0xf422('0x23')]([_0x4ebfe9,_0x35d1fa])[_0xf422('0x22')](function(_0x33ef63){var _0xefb99e=_0x33ef63[0x0];var _0x48e0c7=_0x33ef63[0x1];var _0x6d22f1=_[_0xf422('0x24')](_0xefb99e['rows'],function(_0x5f0186){return _0x5f0186[_0xf422('0x25')]==_0x48e0c7['id']&&_0x5f0186['sessionId']==_0xaa3e7e;});if(_0x6d22f1['length']==0x1){_0x31f439(_0x48e0c7);}else{_0x2d0053(new RangeError(_0xf422('0x26')+_0xaa3e7e+_0xf422('0x27')));}});});}exports['originate']=function(_0x261e29,_0x2f5b75){logger[_0xf422('0x28')](_0xf422('0x29'),_0x261e29[_0xf422('0x2a')]);var _0x4d8670=originateValidation[_0xf422('0xc')](_0x261e29['body']);if(_0x4d8670[_0xf422('0x2b')]>0x0){return _0x2f5b75[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x4d8670);}var _0x1869a4=_0x261e29[_0xf422('0x2a')][_0xf422('0x2d')];var _0xbd95dd=_0x261e29['body']['callNumber'];var _0x2b35d2=_0x261e29[_0xf422('0x2a')]['callerId'];var _0x259bb2=_0x261e29[_0xf422('0x2a')][_0xf422('0x2e')];return getAgent(_0x1869a4)[_0xf422('0x22')](function(_0x12ddbf){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x12ddbf[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x12ddbf[_0xf422('0x17')]),_0xf422('0x32'),{'callNumber':_0xbd95dd,'callerId':_0x2b35d2,'callbackUrl':_0x259bb2});return _0x2f5b75[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x2f5b75));};exports['hangup']=function(_0x2c9861,_0x2ae7e1){logger['info'](_0xf422('0x33'),_0x2c9861['body']);var _0x774834=hangupValidation[_0xf422('0xc')](_0x2c9861['body']);if(_0x774834[_0xf422('0x2b')]>0x0){return _0x2ae7e1[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x774834);}var _0x511fc7=_0x2c9861[_0xf422('0x2a')]['userId'];var _0x567667=_0x2c9861['body'][_0xf422('0x34')];return getAgent(_0x511fc7)[_0xf422('0x22')](function(_0x2133a5){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x2133a5[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x2133a5['name']),'webbar:hangup',{'sessionId':_0x567667});return _0x2ae7e1[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x35')});})[_0xf422('0x1f')](handleError(_0x2ae7e1));};exports[_0xf422('0x36')]=function(_0x35eac8,_0x56d615){logger[_0xf422('0x28')]('answer\x20fired:',_0x35eac8[_0xf422('0x2a')]);var _0x391e3c=answerValidation['validate'](_0x35eac8[_0xf422('0x2a')]);if(_0x391e3c[_0xf422('0x2b')]>0x0){return _0x56d615[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x391e3c);}var _0x1658d0=_0x35eac8['body'][_0xf422('0x2d')];var _0x1e20a2=_0x35eac8[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x1658d0)[_0xf422('0x22')](function(_0x5ea94e){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x5ea94e['name']);emit(util[_0xf422('0x30')]('user:%s',_0x5ea94e[_0xf422('0x17')]),_0xf422('0x37'),{'sessionId':_0x1e20a2});return _0x56d615[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x38')});})[_0xf422('0x1f')](handleError(_0x56d615));};exports[_0xf422('0x39')]=function(_0xd77d9,_0x2ad164){logger[_0xf422('0x28')](_0xf422('0x3a'),_0xd77d9[_0xf422('0x2a')]);var _0x154e72=holdValidation[_0xf422('0xc')](_0xd77d9[_0xf422('0x2a')]);if(_0x154e72['length']>0x0){return _0x2ad164['status'](0x190)[_0xf422('0x2c')](_0x154e72);}var _0x2c2ce9=_0xd77d9[_0xf422('0x2a')]['userId'];var _0x15967f=_0xd77d9[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x2c2ce9)[_0xf422('0x22')](function(_0x1f3a30){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x1f3a30['name']);emit(util[_0xf422('0x30')]('user:%s',_0x1f3a30[_0xf422('0x17')]),_0xf422('0x3b'),{'sessionId':_0x15967f});return _0x2ad164['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x3c')});})[_0xf422('0x1f')](handleError(_0x2ad164));};exports[_0xf422('0x3d')]=function(_0x2df71a,_0x5c3cb8){logger['info'](_0xf422('0x3e'),_0x2df71a['body']);var _0x4429c6=unholdValidation[_0xf422('0xc')](_0x2df71a[_0xf422('0x2a')]);if(_0x4429c6[_0xf422('0x2b')]>0x0){return _0x5c3cb8['status'](0x190)['json'](_0x4429c6);}var _0x44448c=_0x2df71a[_0xf422('0x2a')][_0xf422('0x2d')];var _0xddcd6c=_0x2df71a[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x44448c)['then'](function(_0x315e79){logger['info'](_0xf422('0x2f'),_0x315e79[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x315e79['name']),'webbar:unhold',{'sessionId':_0xddcd6c});return _0x5c3cb8[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x3f')});})[_0xf422('0x1f')](handleError(_0x5c3cb8));};exports[_0xf422('0x40')]=function(_0x2ce919,_0x90f97f){logger['info'](_0xf422('0x41'),_0x90f97f[_0xf422('0x2a')]);var _0x19e687=callsValidation[_0xf422('0xc')](_0x2ce919[_0xf422('0x2a')]);if(_0x19e687[_0xf422('0x2b')]>0x0){return _0x90f97f[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x19e687);}var _0x36f8ae=_0x2ce919[_0xf422('0x2a')]['userId'];var _0x4419e6=respondWithRpcPromise(_0xf422('0x42'));var _0x23ee77=getAgent(_0x36f8ae);return Promise[_0xf422('0x23')]([_0x4419e6,_0x23ee77])[_0xf422('0x22')](function(_0x5b14dd){var _0x235fff=_0x5b14dd[0x0];var _0x2b6a57=_0x5b14dd[0x1];var _0x4fa193=_[_0xf422('0x24')](_0x235fff[_0xf422('0x43')],function(_0x39fa95){return _0x39fa95[_0xf422('0x25')]==_0x2b6a57['id'];});return _0x90f97f[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'count':_0x4fa193[_0xf422('0x2b')],'rows':_0x4fa193});})['catch'](handleError(_0x90f97f));};exports[_0xf422('0x44')]=function(_0x477a65,_0x462376){logger['info'](_0xf422('0x45'),_0x477a65[_0xf422('0x2a')]);var _0x3d9946=conferenceValidation[_0xf422('0xc')](_0x477a65[_0xf422('0x2a')]);if(_0x3d9946[_0xf422('0x2b')]>0x0){return _0x462376[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x3d9946);}var _0x3f2095=_0x477a65[_0xf422('0x2a')][_0xf422('0x2d')];return getAgent(_0x3f2095)[_0xf422('0x22')](function(_0x28c6ac){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x28c6ac[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x28c6ac[_0xf422('0x17')]),'webbar:conference');return _0x462376['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':'conference\x20executed!'});})[_0xf422('0x1f')](handleError(_0x462376));};exports[_0xf422('0x46')]=function(_0x416e40,_0x14904a){logger['info'](_0xf422('0x47'),_0x416e40[_0xf422('0x2a')]);var _0x2b1d8f=transferValidation['validate'](_0x416e40['body']);if(_0x2b1d8f[_0xf422('0x2b')]>0x0){return _0x14904a[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x2b1d8f);}var _0x23d1b5=_0x416e40['body']['userId'];var _0x53f92e=_0x416e40[_0xf422('0x2a')][_0xf422('0x34')];var _0x3de5c5=_0x416e40[_0xf422('0x2a')][_0xf422('0x48')];return getAgent(_0x23d1b5)[_0xf422('0x22')](function(_0x3f165d){logger['info']('entityFound:',_0x3f165d['name']);emit(util[_0xf422('0x30')]('user:%s',_0x3f165d[_0xf422('0x17')]),_0xf422('0x49'),{'sessionId':_0x53f92e,'transferNumber':_0x3de5c5});return _0x14904a['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x4a')});})[_0xf422('0x1f')](handleError(_0x14904a));}; \ No newline at end of file +var _0xe5b3=['string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','socket.io-emitter','validate','number','callNumber\x20is\x20required'];(function(_0x292827,_0x95f387){var _0x485407=function(_0x3096eb){while(--_0x3096eb){_0x292827['push'](_0x292827['shift']());}};_0x485407(++_0x95f387);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1e9cd3,_0x28d717){_0x1e9cd3=_0x1e9cd3-0x0;var _0x272d52=_0xe5b3[_0x1e9cd3];return _0x272d52;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3e5b('0x0'));var db=require(_0x3e5b('0x1'))['db'];var config=require(_0x3e5b('0x2'));var util=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var jayson=require(_0x3e5b('0x5'));var amiClient=jayson[_0x3e5b('0x6')][_0x3e5b('0x7')]({'port':0x232a});var logger=require(_0x3e5b('0x8'))(_0x3e5b('0x9'));var Redis=require(_0x3e5b('0xa'));config['redis']=_[_0x3e5b('0xb')](config[_0x3e5b('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x3e5b('0xd'))(new Redis(config[_0x3e5b('0xc')]));var Schema=require(_0x3e5b('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x3e5b('0x10')]},'callerId':{'type':_0x3e5b('0x11')},'callbackUrl':{'type':_0x3e5b('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x13')]},'transferNumber':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]}});function emit(_0x59ddc0,_0x56a453,_0x258d6a){logger[_0x3e5b('0x15')](_0x59ddc0,_0x56a453,JSON['stringify'](_0x258d6a));io['to'](_0x59ddc0)[_0x3e5b('0x16')](_0x56a453,_0x258d6a);}function handleError(_0x143040){return function(_0x555002){console[_0x3e5b('0x17')](_0x3e5b('0x18'),_0x555002,_0x555002 instanceof RangeError);logger['error'](_0x555002['stack']);if(_0x555002 instanceof RangeError){if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x194)[_0x3e5b('0x1b')](_0x555002);}else{if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x1f4)[_0x3e5b('0x1b')](_0x555002);}};}function checkError(){return function(_0x36c988){if(!_0x36c988){throw new RangeError(_0x3e5b('0x1c'));}return _0x36c988;};}function respondWithRpcPromise(_0x2b977c,_0x11e5cf){return new BPromise(function(_0x2d77cc,_0x402873){var _0x5b46d4=amiClient;return _0x5b46d4[_0x3e5b('0x1d')](_0x2b977c,_0x11e5cf)[_0x3e5b('0x1e')](function(_0x2146d4){if(_0x2146d4[_0x3e5b('0x1f')]){if(_0x2146d4['error'][_0x3e5b('0x20')]===0x1f4){return _0x402873(_0x2146d4['error'][_0x3e5b('0x21')]);}return _0x2d77cc(_0x2146d4[_0x3e5b('0x1f')]['message']);}else{_0x2d77cc(_0x2146d4[_0x3e5b('0x22')]);}})[_0x3e5b('0x23')](function(_0x42d7e9){_0x402873(_0x42d7e9);});});}function getAgent(_0x3c8965){return db[_0x3e5b('0x24')][_0x3e5b('0x25')]({'where':{'id':_0x3c8965,'role':_0x3e5b('0x26')}})[_0x3e5b('0x1e')](checkError());}function getAgentCheckSession(_0x4c4b89,_0x1c7278){return new BPromise(function(_0x505f40,_0xb70ab4){var _0x4fd64b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x1f6473=getAgent(_0x4c4b89);Promise[_0x3e5b('0x28')]([_0x4fd64b,_0x1f6473])[_0x3e5b('0x1e')](function(_0x10d2ed){var _0x3cfaf6=_0x10d2ed[0x0];var _0x307091=_0x10d2ed[0x1];var _0x9c2123=_[_0x3e5b('0x29')](_0x3cfaf6[_0x3e5b('0x2a')],function(_0x1e1565){return _0x1e1565['UserId']==_0x307091['id']&&_0x1e1565[_0x3e5b('0x2b')]==_0x1c7278;});if(_0x9c2123[_0x3e5b('0x2c')]==0x1){_0x505f40(_0x307091);}else{_0xb70ab4(new RangeError(_0x3e5b('0x2d')+_0x1c7278+_0x3e5b('0x2e')));}});});}exports[_0x3e5b('0x2f')]=function(_0x31e9f9,_0x345927){logger['info'](_0x3e5b('0x30'),_0x31e9f9['body']);var _0x5b9ba3=originateValidation[_0x3e5b('0xe')](_0x31e9f9[_0x3e5b('0x31')]);if(_0x5b9ba3['length']>0x0){return _0x345927[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x5b9ba3);}var _0x9d01c4=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x26f842=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x34')];var _0x2450c0=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x35')];var _0x1506f5=_0x31e9f9['body'][_0x3e5b('0x36')];return getAgent(_0x9d01c4)[_0x3e5b('0x1e')](function(_0x53caa2){logger['info'](_0x3e5b('0x37'),_0x53caa2['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x53caa2[_0x3e5b('0x19')]),_0x3e5b('0x3a'),{'callNumber':_0x26f842,'callerId':_0x2450c0,'callbackUrl':_0x1506f5});return _0x345927['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0x3e5b('0x23')](handleError(_0x345927));};exports['hangup']=function(_0x47f7c8,_0x48f414){logger[_0x3e5b('0x15')](_0x3e5b('0x3b'),_0x47f7c8[_0x3e5b('0x31')]);var _0x35cfcd=hangupValidation[_0x3e5b('0xe')](_0x47f7c8[_0x3e5b('0x31')]);if(_0x35cfcd['length']>0x0){return _0x48f414['status'](0x190)['json'](_0x35cfcd);}var _0x565319=_0x47f7c8['body']['userId'];var _0x5aad1d=_0x47f7c8[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x565319)[_0x3e5b('0x1e')](function(_0x1aafd5){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x1aafd5[_0x3e5b('0x19')]);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x1aafd5[_0x3e5b('0x19')]),_0x3e5b('0x3c'),{'sessionId':_0x5aad1d});return _0x48f414['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x3d')});})[_0x3e5b('0x23')](handleError(_0x48f414));};exports[_0x3e5b('0x3e')]=function(_0xa262e0,_0xc69499){logger[_0x3e5b('0x15')](_0x3e5b('0x3f'),_0xa262e0[_0x3e5b('0x31')]);var _0x39da3f=answerValidation[_0x3e5b('0xe')](_0xa262e0['body']);if(_0x39da3f['length']>0x0){return _0xc69499['status'](0x190)['json'](_0x39da3f);}var _0xa99d75=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x24c416=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0xa99d75)[_0x3e5b('0x1e')](function(_0x158518){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x158518['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x158518[_0x3e5b('0x19')]),_0x3e5b('0x40'),{'sessionId':_0x24c416});return _0xc69499[_0x3e5b('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0xc69499));};exports[_0x3e5b('0x41')]=function(_0x20af6a,_0x3b2319){logger['info']('hold\x20fired:',_0x20af6a[_0x3e5b('0x31')]);var _0x313c51=holdValidation[_0x3e5b('0xe')](_0x20af6a['body']);if(_0x313c51['length']>0x0){return _0x3b2319[_0x3e5b('0x1a')](0x190)['json'](_0x313c51);}var _0x14b62a=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x36abab=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x14b62a)[_0x3e5b('0x1e')](function(_0x3ea5aa){logger[_0x3e5b('0x15')]('entityFound:',_0x3ea5aa[_0x3e5b('0x19')]);emit(util['format'](_0x3e5b('0x39'),_0x3ea5aa[_0x3e5b('0x19')]),_0x3e5b('0x42'),{'sessionId':_0x36abab});return _0x3b2319[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x43')});})[_0x3e5b('0x23')](handleError(_0x3b2319));};exports[_0x3e5b('0x44')]=function(_0x2b5d3d,_0x371655){logger[_0x3e5b('0x15')](_0x3e5b('0x45'),_0x2b5d3d[_0x3e5b('0x31')]);var _0x59d311=unholdValidation[_0x3e5b('0xe')](_0x2b5d3d[_0x3e5b('0x31')]);if(_0x59d311[_0x3e5b('0x2c')]>0x0){return _0x371655[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x59d311);}var _0x2cecd3=_0x2b5d3d['body'][_0x3e5b('0x33')];var _0x1cbdf7=_0x2b5d3d[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x2cecd3)[_0x3e5b('0x1e')](function(_0x449d0f){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x449d0f['name']);emit(util[_0x3e5b('0x38')]('user:%s',_0x449d0f['name']),_0x3e5b('0x46'),{'sessionId':_0x1cbdf7});return _0x371655['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x47')});})[_0x3e5b('0x23')](handleError(_0x371655));};exports[_0x3e5b('0x48')]=function(_0x4a492b,_0x5ddeee){logger['info']('calls\x20fired:',_0x5ddeee[_0x3e5b('0x31')]);var _0x999518=callsValidation[_0x3e5b('0xe')](_0x4a492b[_0x3e5b('0x31')]);if(_0x999518[_0x3e5b('0x2c')]>0x0){return _0x5ddeee['status'](0x190)['json'](_0x999518);}var _0xa0a18d=_0x4a492b[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x325f7b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x51efbd=getAgent(_0xa0a18d);return Promise['all']([_0x325f7b,_0x51efbd])['then'](function(_0x4eaa6e){var _0x3563b0=_0x4eaa6e[0x0];var _0x3e3115=_0x4eaa6e[0x1];var _0x3088d4=_[_0x3e5b('0x29')](_0x3563b0[_0x3e5b('0x2a')],function(_0x24087b){return _0x24087b[_0x3e5b('0x49')]==_0x3e3115['id'];});return _0x5ddeee[_0x3e5b('0x1a')](0xc8)['json']({'count':_0x3088d4[_0x3e5b('0x2c')],'rows':_0x3088d4});})[_0x3e5b('0x23')](handleError(_0x5ddeee));};exports[_0x3e5b('0x4a')]=function(_0x3e784a,_0x2d2c1e){logger['info'](_0x3e5b('0x4b'),_0x3e784a['body']);var _0x45ca16=conferenceValidation[_0x3e5b('0xe')](_0x3e784a['body']);if(_0x45ca16['length']>0x0){return _0x2d2c1e['status'](0x190)[_0x3e5b('0x32')](_0x45ca16);}var _0x50f5b4=_0x3e784a[_0x3e5b('0x31')][_0x3e5b('0x33')];return getAgent(_0x50f5b4)[_0x3e5b('0x1e')](function(_0x40197c){logger[_0x3e5b('0x15')]('entityFound:',_0x40197c['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x40197c[_0x3e5b('0x19')]),'webbar:conference');return _0x2d2c1e[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x4c')});})[_0x3e5b('0x23')](handleError(_0x2d2c1e));};exports[_0x3e5b('0x4d')]=function(_0x198316,_0x455594){logger[_0x3e5b('0x15')](_0x3e5b('0x4e'),_0x198316[_0x3e5b('0x31')]);var _0x4eb336=transferValidation[_0x3e5b('0xe')](_0x198316[_0x3e5b('0x31')]);if(_0x4eb336[_0x3e5b('0x2c')]>0x0){return _0x455594[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x4eb336);}var _0x39f1f2=_0x198316[_0x3e5b('0x31')]['userId'];var _0xe5d4c5=_0x198316[_0x3e5b('0x31')]['sessionId'];var _0x177144=_0x198316[_0x3e5b('0x31')]['transferNumber'];return getAgent(_0x39f1f2)['then'](function(_0x4f67d1){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x4f67d1['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x4f67d1['name']),_0x3e5b('0x4f'),{'sessionId':_0xe5d4c5,'transferNumber':_0x177144});return _0x455594[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x50')});})[_0x3e5b('0x23')](handleError(_0x455594));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9a2b958..f5632a3 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 _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0x51f688,_0x43621a){var _0x5c7f09=function(_0x46d08b){while(--_0x46d08b){_0x51f688['push'](_0x51f688['shift']());}};_0x5c7f09(++_0x43621a);}(_0xdb28,0x106));var _0x8db2=function(_0x24ab41,_0x277eb0){_0x24ab41=_0x24ab41-0x0;var _0x1ce187=_0xdb28[_0x24ab41];return _0x1ce187;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file +var _0xda2d=['/:id','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete'];(function(_0x410aa7,_0x3d4102){var _0x37db89=function(_0x36f058){while(--_0x36f058){_0x410aa7['push'](_0x410aa7['shift']());}};_0x37db89(++_0x3d4102);}(_0xda2d,0x102));var _0xdda2=function(_0x72eb65,_0x1c0086){_0x72eb65=_0x72eb65-0x0;var _0x3389cd=_0xda2d[_0x72eb65];return _0x3389cd;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['get'](_0xdda2('0xd'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xe')]);router[_0xdda2('0x7')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xdda2('0x7')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x12')]);router[_0xdda2('0x13')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x14')]);router['post'](_0xdda2('0xd'),auth['isAuthenticated'](),controller[_0xdda2('0x15')]);router[_0xdda2('0x13')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x16')]);router['post']('/:id/users',auth[_0xdda2('0x8')](),controller['addAgents']);router[_0xdda2('0x13')](_0xdda2('0x11'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x17')]);router[_0xdda2('0x13')](_0xdda2('0x18'),controller[_0xdda2('0x19')]);router[_0xdda2('0x13')](_0xdda2('0x1a'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x1b')]);router[_0xdda2('0x1c')]('/:id',auth[_0xdda2('0x8')](),controller['update']);router[_0xdda2('0x1d')](_0xdda2('0x1e'),auth[_0xdda2('0x8')](),controller['destroy']);router[_0xdda2('0x1d')]('/:id/dispositions',auth[_0xdda2('0x8')](),controller[_0xdda2('0x1f')]);router['delete'](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x20')]);router[_0xdda2('0x1d')](_0xdda2('0x21'),auth['isAuthenticated'](),controller[_0xdda2('0x22')]);module[_0xdda2('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 78d373b..4cbfd65 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 _0xeb66=['randomstring','exports','STRING','name','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x3c829d,_0x284e6e){var _0x5ba612=function(_0x58129){while(--_0x58129){_0x3c829d['push'](_0x3c829d['shift']());}};_0x5ba612(++_0x284e6e);}(_0xeb66,0x8b));var _0x6eb6=function(_0x482965,_0x401dfe){_0x482965=_0x482965-0x0;var _0x15dd1f=_0xeb66[_0x482965];return _0x15dd1f;};'use strict';var Sequelize=require(_0x6eb6('0x0'));var rs=require(_0x6eb6('0x1'));module[_0x6eb6('0x2')]={'name':{'type':Sequelize[_0x6eb6('0x3')],'unique':_0x6eb6('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6eb6('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6eb6('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x6eb6('0x5'))},'accountSid':{'type':Sequelize[_0x6eb6('0x3')]},'baseUrl':{'type':Sequelize[_0x6eb6('0x3')]},'authToken':{'type':Sequelize[_0x6eb6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6eb6('0x6')],'defaultValue':function(){return _0x6eb6('0x7');}},'notificationSound':{'type':Sequelize[_0x6eb6('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6eb6('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6eb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6eb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6eb6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6eb6('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6eb6('0x8')],'defaultValue':![],'comment':_0x6eb6('0xb'),'set':function(_0x439101){if(!_0x439101){this[_0x6eb6('0xc')]('mandatoryDispositionPauseId',null);}this[_0x6eb6('0xc')](_0x6eb6('0xd'),_0x439101);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x86d4=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x266244,_0x4d55a4){var _0x187672=function(_0x2b63d7){while(--_0x2b63d7){_0x266244['push'](_0x266244['shift']());}};_0x187672(++_0x4d55a4);}(_0x86d4,0x68));var _0x486d=function(_0x36a487,_0x412625){_0x36a487=_0x36a487-0x0;var _0x380404=_0x86d4[_0x36a487];return _0x380404;};'use strict';var Sequelize=require(_0x486d('0x0'));var rs=require(_0x486d('0x1'));module[_0x486d('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x486d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x486d('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x486d('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x486d('0x4')],'defaultValue':function(){return rs[_0x486d('0x5')]();}},'phone':{'type':Sequelize[_0x486d('0x4')]},'type':{'type':Sequelize['ENUM'](_0x486d('0x6'),_0x486d('0x7'))},'accountSid':{'type':Sequelize[_0x486d('0x4')]},'baseUrl':{'type':Sequelize[_0x486d('0x4')]},'authToken':{'type':Sequelize[_0x486d('0x4')]},'notificationTemplate':{'type':Sequelize[_0x486d('0x8')],'defaultValue':function(){return _0x486d('0x9');}},'notificationSound':{'type':Sequelize[_0x486d('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x486d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x486d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x486d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x486d('0xb')],'comment':_0x486d('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x486d('0xa')],'defaultValue':![],'comment':_0x486d('0xd'),'set':function(_0x446722){if(!_0x446722){this['setDataValue'](_0x486d('0xe'),null);}this[_0x486d('0xf')](_0x486d('0x10'),_0x446722);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index e0009a2..7ab63b5 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 _0xdf9b=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','Pause','keys','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','findOne','rows','removeDispositions','addAnswer','WhatsappAccountId','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','timestamp','message_id','applications','orderBy','asc','CmContact','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','replace','whatsapp:','Body','messageId','MessageSid','sinch','from','notifications','isNil','Sequelize','from\x20is\x20mandatory','ValidationError','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','list','contact','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','updatedAt','DESC','List','defaults','WhatsappInteraction','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end'];(function(_0x80fad8,_0x3d10e6){var _0x51da13=function(_0x11ad02){while(--_0x11ad02){_0x80fad8['push'](_0x80fad8['shift']());}};_0x51da13(++_0x3d10e6);}(_0xdf9b,0x9b));var _0xbdf9=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xdf9b[_0x5cb1af];return _0x8d7940;};'use strict';var emlformat=require(_0xbdf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdf9('0x1'));var jsonpatch=require(_0xbdf9('0x2'));var rp=require('request-promise');var moment=require(_0xbdf9('0x3'));var BPromise=require(_0xbdf9('0x4'));var Mustache=require('mustache');var util=require(_0xbdf9('0x5'));var path=require(_0xbdf9('0x6'));var sox=require(_0xbdf9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdf9('0x8'));var _=require(_0xbdf9('0x9'));var squel=require(_0xbdf9('0xa'));var crypto=require(_0xbdf9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbdf9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbdf9('0xd'));var Papa=require(_0xbdf9('0xe'));var Redis=require('ioredis');var authService=require(_0xbdf9('0xf'));var qs=require(_0xbdf9('0x10'));var as=require(_0xbdf9('0x11'));var hardwareService=require(_0xbdf9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbdf9('0x13'));var config=require(_0xbdf9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdf9('0x15'))['db'];config[_0xbdf9('0x16')]=_['defaults'](config['redis'],{'host':_0xbdf9('0x17'),'port':0x18eb});var socket=require(_0xbdf9('0x18'))(new Redis(config[_0xbdf9('0x16')]));require(_0xbdf9('0x19'))['register'](socket);var jayson=require(_0xbdf9('0x1a'));var client=jayson[_0xbdf9('0x1b')][_0xbdf9('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0xb62bdf,_0x2d4f5e,_0x27ae2f,_0x17eeb8){return new BPromise(function(_0x349bd8,_0xa787cd){var _0x59278f=_0x17eeb8||client;return _0x59278f['request'](_0xb62bdf,_0x27ae2f)['then'](function(_0x13c967){logger[_0xbdf9('0x1d')](_0xbdf9('0x1e'),_0x2d4f5e,'request\x20sent');logger['debug'](_0xbdf9('0x1f'),_0x2d4f5e,'request\x20sent',JSON[_0xbdf9('0x20')](_0x13c967));if(_0x13c967[_0xbdf9('0x21')]){if(_0x13c967[_0xbdf9('0x21')][_0xbdf9('0x22')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2d4f5e,_0x13c967[_0xbdf9('0x21')]['message']);return _0xa787cd(_0x13c967[_0xbdf9('0x21')][_0xbdf9('0x23')]);}logger[_0xbdf9('0x21')](_0xbdf9('0x1e'),_0x2d4f5e,_0x13c967[_0xbdf9('0x21')][_0xbdf9('0x23')]);return _0x349bd8(_0x13c967[_0xbdf9('0x21')][_0xbdf9('0x23')]);}else{logger[_0xbdf9('0x1d')](_0xbdf9('0x1e'),_0x2d4f5e,_0xbdf9('0x24'));_0x349bd8(_0x13c967['result'][_0xbdf9('0x23')]);}})[_0xbdf9('0x25')](function(_0x58efc9){logger[_0xbdf9('0x21')](_0xbdf9('0x1e'),_0x2d4f5e,_0x58efc9);_0xa787cd(_0x58efc9);});});}function respondWithStatusCode(_0x4e289c,_0x71486f){_0x71486f=_0x71486f||0xcc;return function(_0x537ede){if(_0x537ede){return _0x4e289c[_0xbdf9('0x26')](_0x71486f);}return _0x4e289c[_0xbdf9('0x27')](_0x71486f)[_0xbdf9('0x28')]();};}function respondWithResult(_0x106645,_0x584f83){_0x584f83=_0x584f83||0xc8;return function(_0x768e25){if(_0x768e25){return _0x106645[_0xbdf9('0x27')](_0x584f83)[_0xbdf9('0x29')](_0x768e25);}};}function respondWithFilteredResult(_0x4a32f6,_0x592bdf){return function(_0x4e845b){if(_0x4e845b){var _0x315392=typeof _0x592bdf[_0xbdf9('0x2a')]===_0xbdf9('0x2b')&&typeof _0x592bdf[_0xbdf9('0x2c')]===_0xbdf9('0x2b');var _0x1bb8bc=_0x4e845b['count'];var _0x540e89=_0x315392?0x0:_0x592bdf[_0xbdf9('0x2a')];var _0x488914=_0x315392?_0x4e845b[_0xbdf9('0x2d')]:_0x592bdf[_0xbdf9('0x2a')]+_0x592bdf[_0xbdf9('0x2c')];var _0x28659d;if(_0x488914>=_0x1bb8bc){_0x488914=_0x1bb8bc;_0x28659d=0xc8;}else{_0x28659d=0xce;}_0x4a32f6[_0xbdf9('0x27')](_0x28659d);return _0x4a32f6[_0xbdf9('0x2e')](_0xbdf9('0x2f'),_0x540e89+'-'+_0x488914+'/'+_0x1bb8bc)[_0xbdf9('0x29')](_0x4e845b);}return null;};}function patchUpdates(_0x5912e2){return function(_0x3ac9c6){try{jsonpatch[_0xbdf9('0x30')](_0x3ac9c6,_0x5912e2,!![]);}catch(_0x562170){return BPromise[_0xbdf9('0x31')](_0x562170);}return _0x3ac9c6[_0xbdf9('0x32')]();};}function saveUpdates(_0x25b25a,_0x168087){return function(_0x5837ad){if(_0x5837ad){return _0x5837ad[_0xbdf9('0x33')](_0x25b25a)[_0xbdf9('0x34')](function(_0x2e0821){return _0x2e0821;});}return null;};}function removeEntity(_0x47f3c6,_0x11d4a3){return function(_0x310188){if(_0x310188){return _0x310188[_0xbdf9('0x35')]()[_0xbdf9('0x34')](function(){var _0xb9ea09=_0x310188[_0xbdf9('0x36')]({'plain':!![]});var _0x331d60='WhatsappAccounts';return db[_0xbdf9('0x37')][_0xbdf9('0x35')]({'where':{'type':_0x331d60,'resourceId':_0xb9ea09['id']}})[_0xbdf9('0x34')](function(){return _0x310188;});})[_0xbdf9('0x34')](function(){_0x47f3c6[_0xbdf9('0x27')](0xcc)[_0xbdf9('0x28')]();});}};}function handleEntityNotFound(_0x37d0cb,_0x2ef64b){return function(_0x43d57d){if(!_0x43d57d){_0x37d0cb[_0xbdf9('0x26')](0x194);}return _0x43d57d;};}function handleError(_0x115ff9,_0x36897c){_0x36897c=_0x36897c||0x1f4;return function(_0x5cf23f){logger['error'](_0x5cf23f[_0xbdf9('0x38')]);if(_0x5cf23f['name']){delete _0x5cf23f['name'];}_0x115ff9[_0xbdf9('0x27')](_0x36897c)[_0xbdf9('0x39')](_0x5cf23f);};}exports[_0xbdf9('0x3a')]=function(_0x35f960,_0x496a68){var _0x1bcc03={'include':[{'model':db['Pause'],'as':_0xbdf9('0x3b')}]},_0x4e2b9b={},_0x2c03c7={'count':0x0,'rows':[]};var _0x229b00=_[_0xbdf9('0x3c')](db[_0xbdf9('0x3d')][_0xbdf9('0x3e')],function(_0x537728){return{'name':_0x537728['fieldName'],'type':_0x537728[_0xbdf9('0x3f')][_0xbdf9('0x40')]};});_0x4e2b9b[_0xbdf9('0x41')]=_['map'](_0x229b00,_0xbdf9('0x42'));_0x4e2b9b['query']=_['keys'](_0x35f960[_0xbdf9('0x43')]);_0x4e2b9b[_0xbdf9('0x44')]=_[_0xbdf9('0x45')](_0x4e2b9b[_0xbdf9('0x41')],_0x4e2b9b[_0xbdf9('0x43')]);_0x1bcc03[_0xbdf9('0x46')]=_[_0xbdf9('0x45')](_0x4e2b9b[_0xbdf9('0x41')],qs[_0xbdf9('0x47')](_0x35f960[_0xbdf9('0x43')][_0xbdf9('0x47')]));_0x1bcc03[_0xbdf9('0x46')]=_0x1bcc03[_0xbdf9('0x46')][_0xbdf9('0x48')]?_0x1bcc03['attributes']:_0x4e2b9b[_0xbdf9('0x41')];if(!_0x35f960[_0xbdf9('0x43')][_0xbdf9('0x49')](_0xbdf9('0x4a'))){_0x1bcc03['limit']=qs[_0xbdf9('0x2c')](_0x35f960[_0xbdf9('0x43')][_0xbdf9('0x2c')]);_0x1bcc03[_0xbdf9('0x2a')]=qs[_0xbdf9('0x2a')](_0x35f960[_0xbdf9('0x43')][_0xbdf9('0x2a')]);}_0x1bcc03[_0xbdf9('0x4b')]=qs[_0xbdf9('0x4c')](_0x35f960[_0xbdf9('0x43')][_0xbdf9('0x4c')]);_0x1bcc03[_0xbdf9('0x4d')]=qs['filters'](_[_0xbdf9('0x4e')](_0x35f960[_0xbdf9('0x43')],_0x4e2b9b[_0xbdf9('0x44')]),_0x229b00);if(_0x35f960[_0xbdf9('0x43')][_0xbdf9('0x4f')]){_0x1bcc03[_0xbdf9('0x4d')]=_['merge'](_0x1bcc03[_0xbdf9('0x4d')],{'$or':_[_0xbdf9('0x3c')](_0x229b00,function(_0x166c7a){if(_0x166c7a['type']!==_0xbdf9('0x50')){var _0x41a06c={};_0x41a06c[_0x166c7a[_0xbdf9('0x42')]]={'$like':'%'+_0x35f960[_0xbdf9('0x43')][_0xbdf9('0x4f')]+'%'};return _0x41a06c;}})});}_0x1bcc03=_['merge']({},_0x1bcc03,_0x35f960[_0xbdf9('0x51')]);var _0x174192={'where':_0x1bcc03[_0xbdf9('0x4d')]};return db[_0xbdf9('0x3d')][_0xbdf9('0x2d')](_0x174192)['then'](function(_0x5d6b3a){_0x2c03c7[_0xbdf9('0x2d')]=_0x5d6b3a;if(_0x35f960['query'][_0xbdf9('0x52')]){_0x1bcc03[_0xbdf9('0x53')]=[{'all':!![]}];}return db[_0xbdf9('0x3d')][_0xbdf9('0x54')](_0x1bcc03);})[_0xbdf9('0x34')](function(_0x28c34f){_0x2c03c7['rows']=_0x28c34f;return _0x2c03c7;})[_0xbdf9('0x34')](respondWithFilteredResult(_0x496a68,_0x1bcc03))[_0xbdf9('0x25')](handleError(_0x496a68,null));};exports[_0xbdf9('0x55')]=function(_0x282602,_0xaf68dc){var _0x432705={'raw':![],'where':{'id':_0x282602[_0xbdf9('0x56')]['id']},'include':[{'model':db[_0xbdf9('0x57')],'as':_0xbdf9('0x3b')}]},_0x26a1c0={};_0x26a1c0[_0xbdf9('0x41')]=_[_0xbdf9('0x58')](db['WhatsappAccount'][_0xbdf9('0x3e')]);_0x26a1c0[_0xbdf9('0x43')]=_[_0xbdf9('0x58')](_0x282602[_0xbdf9('0x43')]);_0x26a1c0[_0xbdf9('0x44')]=_[_0xbdf9('0x45')](_0x26a1c0[_0xbdf9('0x41')],_0x26a1c0[_0xbdf9('0x43')]);_0x432705['attributes']=_[_0xbdf9('0x45')](_0x26a1c0[_0xbdf9('0x41')],qs[_0xbdf9('0x47')](_0x282602[_0xbdf9('0x43')]['fields']));_0x432705[_0xbdf9('0x46')]=_0x432705[_0xbdf9('0x46')][_0xbdf9('0x48')]?_0x432705['attributes']:_0x26a1c0[_0xbdf9('0x41')];if(_0x282602[_0xbdf9('0x43')][_0xbdf9('0x52')]){_0x432705[_0xbdf9('0x53')]=[{'all':!![]}];}_0x432705=_[_0xbdf9('0x59')]({},_0x432705,_0x282602[_0xbdf9('0x51')]);return db[_0xbdf9('0x3d')][_0xbdf9('0x5a')](_0x432705)[_0xbdf9('0x34')](handleEntityNotFound(_0xaf68dc,null))[_0xbdf9('0x34')](respondWithResult(_0xaf68dc,null))[_0xbdf9('0x25')](handleError(_0xaf68dc,null));};exports[_0xbdf9('0x5b')]=function(_0x590773,_0x15f186){return db[_0xbdf9('0x3d')][_0xbdf9('0x5b')](_0x590773[_0xbdf9('0x5c')],{})[_0xbdf9('0x34')](function(_0x413b78){var _0x2d3c22=_0x590773[_0xbdf9('0x5d')][_0xbdf9('0x36')]({'plain':!![]});if(!_0x2d3c22)throw new Error(_0xbdf9('0x5e'));if(_0x2d3c22['role']===_0xbdf9('0x5d')){var _0x5c5f69=_0x413b78[_0xbdf9('0x36')]({'plain':!![]});var _0x546e0f=_0xbdf9('0x5f');return db[_0xbdf9('0x60')][_0xbdf9('0x5a')]({'where':{'name':_0x546e0f,'userProfileId':_0x2d3c22[_0xbdf9('0x61')]},'raw':!![]})[_0xbdf9('0x34')](function(_0x47ca73){if(_0x47ca73&&_0x47ca73[_0xbdf9('0x62')]===0x0){return db[_0xbdf9('0x37')][_0xbdf9('0x5b')]({'name':_0x5c5f69[_0xbdf9('0x42')],'resourceId':_0x5c5f69['id'],'type':_0x47ca73[_0xbdf9('0x42')],'sectionId':_0x47ca73['id']},{})[_0xbdf9('0x34')](function(){return _0x413b78;});}else{return _0x413b78;}})['catch'](function(_0x1c420c){logger[_0xbdf9('0x21')](_0xbdf9('0x63'),_0x1c420c);throw _0x1c420c;});}return _0x413b78;})['then'](respondWithResult(_0x15f186,0xc9))[_0xbdf9('0x25')](handleError(_0x15f186,null));};exports['update']=function(_0x6fe2b8,_0x231f37){if(_0x6fe2b8[_0xbdf9('0x5c')]['id']){delete _0x6fe2b8[_0xbdf9('0x5c')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x6fe2b8[_0xbdf9('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xbdf9('0x3b')}]})['then'](handleEntityNotFound(_0x231f37,null))[_0xbdf9('0x34')](saveUpdates(_0x6fe2b8[_0xbdf9('0x5c')],null))[_0xbdf9('0x34')](respondWithResult(_0x231f37,null))[_0xbdf9('0x25')](handleError(_0x231f37,null));};exports[_0xbdf9('0x35')]=function(_0x2dd34c,_0x3a9b88){return db['WhatsappAccount'][_0xbdf9('0x5a')]({'where':{'id':_0x2dd34c['params']['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x3a9b88,null))[_0xbdf9('0x34')](removeEntity(_0x3a9b88,null))['catch'](handleError(_0x3a9b88,null));};exports['describe']=function(_0x549fc8,_0x59f0de){return db[_0xbdf9('0x3d')][_0xbdf9('0x64')]()[_0xbdf9('0x34')](respondWithResult(_0x59f0de,null))[_0xbdf9('0x25')](handleError(_0x59f0de,null));};exports['addDisposition']=function(_0x5602b4,_0x28b8ae,_0x1997d2){if(_0x5602b4[_0xbdf9('0x5c')]['id']){delete _0x5602b4['body']['id'];}return db[_0xbdf9('0x3d')]['find']({'where':{'id':_0x5602b4[_0xbdf9('0x56')]['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x28b8ae,null))[_0xbdf9('0x34')](function(_0x51e98a){if(_0x51e98a){_0x5602b4[_0xbdf9('0x5c')]['WhatsappAccountId']=_0x51e98a['id'];return db[_0xbdf9('0x65')][_0xbdf9('0x5b')](_0x5602b4[_0xbdf9('0x5c')]);}})['then'](respondWithResult(_0x28b8ae,null))[_0xbdf9('0x25')](handleError(_0x28b8ae,null));};exports['getDispositions']=function(_0x58505c,_0x145bae,_0xfcad0c){var _0x3c998f={'raw':![],'where':{}};var _0x3351c8={};var _0x2c86b5={'count':0x0,'rows':[]};return db[_0xbdf9('0x3d')][_0xbdf9('0x66')]({'where':{'id':_0x58505c[_0xbdf9('0x56')]['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x145bae,null))[_0xbdf9('0x34')](function(_0x34a286){if(_0x34a286){_0x3351c8[_0xbdf9('0x41')]=_[_0xbdf9('0x58')](db['Disposition'][_0xbdf9('0x3e')]);_0x3351c8[_0xbdf9('0x43')]=_[_0xbdf9('0x58')](_0x58505c[_0xbdf9('0x43')]);_0x3351c8['filters']=_[_0xbdf9('0x45')](_0x3351c8[_0xbdf9('0x41')],_0x3351c8['query']);_0x3c998f[_0xbdf9('0x46')]=_[_0xbdf9('0x45')](_0x3351c8[_0xbdf9('0x41')],qs[_0xbdf9('0x47')](_0x58505c[_0xbdf9('0x43')][_0xbdf9('0x47')]));_0x3c998f[_0xbdf9('0x46')]=_0x3c998f[_0xbdf9('0x46')][_0xbdf9('0x48')]?_0x3c998f['attributes']:_0x3351c8[_0xbdf9('0x41')];if(!_0x58505c[_0xbdf9('0x43')][_0xbdf9('0x49')](_0xbdf9('0x4a'))){_0x3c998f[_0xbdf9('0x2c')]=qs[_0xbdf9('0x2c')](_0x58505c['query'][_0xbdf9('0x2c')]);_0x3c998f[_0xbdf9('0x2a')]=qs[_0xbdf9('0x2a')](_0x58505c[_0xbdf9('0x43')]['offset']);}_0x3c998f[_0xbdf9('0x4b')]=qs[_0xbdf9('0x4c')](_0x58505c[_0xbdf9('0x43')][_0xbdf9('0x4c')]);_0x3c998f[_0xbdf9('0x4d')]=qs[_0xbdf9('0x44')](_[_0xbdf9('0x4e')](_0x58505c['query'],_0x3351c8[_0xbdf9('0x44')]));_0x3c998f[_0xbdf9('0x4d')]['WhatsappAccountId']=_0x34a286['id'];if(_0x58505c[_0xbdf9('0x43')]['filter']){_0x3c998f[_0xbdf9('0x4d')]=_['merge'](_0x3c998f[_0xbdf9('0x4d')],{'$or':_['map'](_0x3c998f[_0xbdf9('0x46')],function(_0x4739c2){var _0x2d0d84={};_0x2d0d84[_0x4739c2]={'$like':'%'+_0x58505c[_0xbdf9('0x43')][_0xbdf9('0x4f')]+'%'};return _0x2d0d84;})});}_0x3c998f=_['merge']({},_0x3c998f,_0x58505c['options']);return db[_0xbdf9('0x65')][_0xbdf9('0x2d')]({'where':_0x3c998f['where']})['then'](function(_0x426054){_0x2c86b5['count']=_0x426054;if(_0x58505c['query'][_0xbdf9('0x52')]){_0x3c998f[_0xbdf9('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xbdf9('0x54')](_0x3c998f);})[_0xbdf9('0x34')](function(_0x5042db){_0x2c86b5[_0xbdf9('0x67')]=_0x5042db;return _0x2c86b5;});}})['then'](respondWithFilteredResult(_0x145bae,_0x3c998f))[_0xbdf9('0x25')](handleError(_0x145bae,null));};exports[_0xbdf9('0x68')]=function(_0x4da687,_0x3edbc2,_0x21de90){return db[_0xbdf9('0x3d')][_0xbdf9('0x5a')]({'where':{'id':_0x4da687['params']['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x3edbc2,null))[_0xbdf9('0x34')](function(_0x4dd800){if(_0x4dd800){return _0x4dd800[_0xbdf9('0x68')](_0x4da687[_0xbdf9('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x3edbc2,null))[_0xbdf9('0x25')](handleError(_0x3edbc2,null));};exports[_0xbdf9('0x69')]=function(_0x3de91f,_0x58f252,_0x1a3e03){if(_0x3de91f[_0xbdf9('0x5c')]['id']){delete _0x3de91f['body']['id'];}return db[_0xbdf9('0x3d')][_0xbdf9('0x5a')]({'where':{'id':_0x3de91f['params']['id']}})['then'](handleEntityNotFound(_0x58f252,null))[_0xbdf9('0x34')](function(_0x3835f3){if(_0x3835f3){_0x3de91f[_0xbdf9('0x5c')][_0xbdf9('0x6a')]=_0x3835f3['id'];return db[_0xbdf9('0x6b')][_0xbdf9('0x5b')](_0x3de91f[_0xbdf9('0x5c')]);}})[_0xbdf9('0x34')](respondWithResult(_0x58f252,null))[_0xbdf9('0x25')](handleError(_0x58f252,null));};exports[_0xbdf9('0x6c')]=function(_0x4dc7c6,_0x1bd5df,_0x1e5e4b){var _0x917610={'raw':![],'where':{}};var _0x325b33={};var _0x1b8116={'count':0x0,'rows':[]};return db[_0xbdf9('0x3d')][_0xbdf9('0x66')]({'where':{'id':_0x4dc7c6[_0xbdf9('0x56')]['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x1bd5df,null))['then'](function(_0x27acd3){if(_0x27acd3){_0x325b33['model']=_[_0xbdf9('0x58')](db[_0xbdf9('0x6b')][_0xbdf9('0x3e')]);_0x325b33[_0xbdf9('0x43')]=_[_0xbdf9('0x58')](_0x4dc7c6[_0xbdf9('0x43')]);_0x325b33[_0xbdf9('0x44')]=_[_0xbdf9('0x45')](_0x325b33[_0xbdf9('0x41')],_0x325b33[_0xbdf9('0x43')]);_0x917610[_0xbdf9('0x46')]=_[_0xbdf9('0x45')](_0x325b33[_0xbdf9('0x41')],qs['fields'](_0x4dc7c6[_0xbdf9('0x43')][_0xbdf9('0x47')]));_0x917610[_0xbdf9('0x46')]=_0x917610[_0xbdf9('0x46')][_0xbdf9('0x48')]?_0x917610[_0xbdf9('0x46')]:_0x325b33['model'];if(!_0x4dc7c6[_0xbdf9('0x43')][_0xbdf9('0x49')](_0xbdf9('0x4a'))){_0x917610[_0xbdf9('0x2c')]=qs['limit'](_0x4dc7c6[_0xbdf9('0x43')][_0xbdf9('0x2c')]);_0x917610[_0xbdf9('0x2a')]=qs[_0xbdf9('0x2a')](_0x4dc7c6[_0xbdf9('0x43')][_0xbdf9('0x2a')]);}_0x917610[_0xbdf9('0x4b')]=qs[_0xbdf9('0x4c')](_0x4dc7c6[_0xbdf9('0x43')]['sort']);_0x917610[_0xbdf9('0x4d')]=qs[_0xbdf9('0x44')](_[_0xbdf9('0x4e')](_0x4dc7c6[_0xbdf9('0x43')],_0x325b33['filters']));_0x917610[_0xbdf9('0x4d')][_0xbdf9('0x6a')]=_0x27acd3['id'];if(_0x4dc7c6[_0xbdf9('0x43')][_0xbdf9('0x4f')]){_0x917610['where']=_['merge'](_0x917610['where'],{'$or':_[_0xbdf9('0x3c')](_0x917610[_0xbdf9('0x46')],function(_0x3bfeb2){var _0x308d62={};_0x308d62[_0x3bfeb2]={'$like':'%'+_0x4dc7c6[_0xbdf9('0x43')]['filter']+'%'};return _0x308d62;})});}_0x917610=_[_0xbdf9('0x59')]({},_0x917610,_0x4dc7c6[_0xbdf9('0x51')]);return db['CannedAnswer'][_0xbdf9('0x2d')]({'where':_0x917610['where']})[_0xbdf9('0x34')](function(_0x446be4){_0x1b8116[_0xbdf9('0x2d')]=_0x446be4;if(_0x4dc7c6[_0xbdf9('0x43')][_0xbdf9('0x52')]){_0x917610[_0xbdf9('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbdf9('0x54')](_0x917610);})[_0xbdf9('0x34')](function(_0x20b682){_0x1b8116[_0xbdf9('0x67')]=_0x20b682;return _0x1b8116;});}})['then'](respondWithFilteredResult(_0x1bd5df,_0x917610))[_0xbdf9('0x25')](handleError(_0x1bd5df,null));};exports[_0xbdf9('0x6d')]=function(_0x1eb268,_0x30da2b,_0x200bc9){return db['WhatsappAccount'][_0xbdf9('0x5a')]({'where':{'id':_0x1eb268['params']['id']}})['then'](handleEntityNotFound(_0x30da2b,null))['then'](function(_0x1ae2c0){if(_0x1ae2c0){return _0x1ae2c0[_0xbdf9('0x6d')](_0x1eb268['query'][_0xbdf9('0x6e')]);}})[_0xbdf9('0x34')](respondWithStatusCode(_0x30da2b,null))[_0xbdf9('0x25')](handleError(_0x30da2b,null));};exports[_0xbdf9('0x6f')]=function(_0x17b406,_0x21e2ba,_0x179921){return db[_0xbdf9('0x3d')][_0xbdf9('0x5a')]({'where':{'id':_0x17b406[_0xbdf9('0x56')]['id']}})['then'](handleEntityNotFound(_0x21e2ba,null))[_0xbdf9('0x34')](function(_0x1f9a3c){if(_0x1f9a3c){return _0x1f9a3c['addAgents'](_0x17b406[_0xbdf9('0x5c')][_0xbdf9('0x6e')],_[_0xbdf9('0x70')](_0x17b406['body'],['ids','id'])||{})[_0xbdf9('0x71')](function(_0x23a843){for(var _0x4e991a=0x0;_0x4e991a<_0x17b406[_0xbdf9('0x5c')][_0xbdf9('0x6e')][_0xbdf9('0x48')];_0x4e991a+=0x1){socket[_0xbdf9('0x72')](_0xbdf9('0x73'),{'UserId':Number(_0x17b406[_0xbdf9('0x5c')][_0xbdf9('0x6e')][_0x4e991a]),'WhatsappAccountId':Number(_0x17b406[_0xbdf9('0x56')]['id'])});}return _0x23a843;});}})[_0xbdf9('0x34')](respondWithResult(_0x21e2ba,null))[_0xbdf9('0x25')](handleError(_0x21e2ba,null));};exports[_0xbdf9('0x74')]=function(_0x3e3389,_0x4cbdb8,_0x472b91){return db[_0xbdf9('0x3d')][_0xbdf9('0x5a')]({'where':{'id':_0x3e3389[_0xbdf9('0x56')]['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x4cbdb8,null))[_0xbdf9('0x34')](function(_0x10ff08){if(_0x10ff08){return _0x10ff08[_0xbdf9('0x74')](_0x3e3389['query'][_0xbdf9('0x6e')])[_0xbdf9('0x34')](function(){if(_[_0xbdf9('0x75')](_0x3e3389[_0xbdf9('0x43')][_0xbdf9('0x6e')])){for(var _0x12ff91=0x0;_0x12ff91<_0x3e3389['query'][_0xbdf9('0x6e')]['length'];_0x12ff91+=0x1){socket[_0xbdf9('0x72')](_0xbdf9('0x76'),{'UserId':Number(_0x3e3389['query'][_0xbdf9('0x6e')][_0x12ff91]),'WhatsappAccountId':Number(_0x3e3389[_0xbdf9('0x56')]['id'])});}}else{socket[_0xbdf9('0x72')](_0xbdf9('0x76'),{'UserId':Number(_0x3e3389['query'][_0xbdf9('0x6e')]),'WhatsappAccountId':Number(_0x3e3389[_0xbdf9('0x56')]['id'])});}});}})[_0xbdf9('0x34')](respondWithStatusCode(_0x4cbdb8,null))[_0xbdf9('0x25')](handleError(_0x4cbdb8,null));};exports[_0xbdf9('0x77')]=function(_0x3977e4,_0x1f2ac3,_0x341a13){var _0x29cc02={};var _0xb1dcde={};var _0x37c23d;var _0x3b1190;return db[_0xbdf9('0x3d')]['findOne']({'where':{'id':_0x3977e4[_0xbdf9('0x56')]['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x1f2ac3,null))[_0xbdf9('0x34')](function(_0x31a0cd){if(_0x31a0cd){_0x37c23d=_0x31a0cd;_0xb1dcde[_0xbdf9('0x41')]=_[_0xbdf9('0x58')](db[_0xbdf9('0x78')][_0xbdf9('0x3e')]);_0xb1dcde[_0xbdf9('0x43')]=_[_0xbdf9('0x58')](_0x3977e4[_0xbdf9('0x43')]);_0xb1dcde[_0xbdf9('0x44')]=_['intersection'](_0xb1dcde['model'],_0xb1dcde[_0xbdf9('0x43')]);_0x29cc02['attributes']=_['intersection'](_0xb1dcde[_0xbdf9('0x41')],qs[_0xbdf9('0x47')](_0x3977e4['query'][_0xbdf9('0x47')]));_0x29cc02[_0xbdf9('0x46')]=_0x29cc02[_0xbdf9('0x46')][_0xbdf9('0x48')]?_0x29cc02[_0xbdf9('0x46')]:_0xb1dcde['model'];_0x29cc02[_0xbdf9('0x4b')]=qs[_0xbdf9('0x4c')](_0x3977e4[_0xbdf9('0x43')][_0xbdf9('0x4c')]);_0x29cc02['where']=qs[_0xbdf9('0x44')](_[_0xbdf9('0x4e')](_0x3977e4['query'],_0xb1dcde['filters']));if(_0x3977e4[_0xbdf9('0x43')][_0xbdf9('0x4f')]){_0x29cc02[_0xbdf9('0x4d')]=_['merge'](_0x29cc02[_0xbdf9('0x4d')],{'$or':_[_0xbdf9('0x3c')](_0x29cc02[_0xbdf9('0x46')],function(_0x216e93){var _0x174a67={};_0x174a67[_0x216e93]={'$like':'%'+_0x3977e4['query'][_0xbdf9('0x4f')]+'%'};return _0x174a67;})});}_0x29cc02=_['merge']({},_0x29cc02,_0x3977e4[_0xbdf9('0x51')]);return _0x37c23d[_0xbdf9('0x77')](_0x29cc02);}})[_0xbdf9('0x34')](function(_0x51d3b8){if(_0x51d3b8){_0x3b1190=_0x51d3b8[_0xbdf9('0x48')];if(!_0x3977e4[_0xbdf9('0x43')][_0xbdf9('0x49')](_0xbdf9('0x4a'))){_0x29cc02[_0xbdf9('0x2c')]=qs['limit'](_0x3977e4[_0xbdf9('0x43')]['limit']);_0x29cc02['offset']=qs[_0xbdf9('0x2a')](_0x3977e4[_0xbdf9('0x43')][_0xbdf9('0x2a')]);}return _0x37c23d['getAgents'](_0x29cc02);}})['then'](function(_0x1628e3){if(_0x1628e3){return _0x1628e3?{'count':_0x3b1190,'rows':_0x1628e3}:null;}})[_0xbdf9('0x34')](respondWithResult(_0x1f2ac3,null))[_0xbdf9('0x25')](handleError(_0x1f2ac3,null));};exports['addApplications']=function(_0x474a20,_0x3464d1){var _0x23e444=_0x474a20['params']['id'];var _0x35b62d=_0x474a20[_0xbdf9('0x5c')];var _0x8e399c=0xc8;var _0x40344e=null;return db[_0xbdf9('0x79')]['transaction']({'isolationLevel':db['sequelize'][_0xbdf9('0x7a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3c6a86){return db['WhatsappAccount']['findOne']({'where':{'id':_0x23e444},'transaction':_0x3c6a86})[_0xbdf9('0x34')](function(_0x464697){if(_0x464697){return db[_0xbdf9('0x7b')][_0xbdf9('0x35')]({'where':{'WhatsappAccountId':_0x23e444},'transaction':_0x3c6a86})['then'](function(){var _0x366c04=_[_0xbdf9('0x3c')](_0x35b62d,function(_0xe5a4a3){_0xe5a4a3[_0xbdf9('0x6a')]=_0x23e444;return _0xe5a4a3;});return db[_0xbdf9('0x7b')]['bulkCreate'](_0x366c04,{'transaction':_0x3c6a86});});}else{_0x8e399c=0x194;_0x40344e=[];}});})[_0xbdf9('0x34')](function(){if(_0x8e399c!==0x194){return db[_0xbdf9('0x7b')][_0xbdf9('0x7c')]({'where':{'WhatsappAccountId':_0x23e444},'order':_0xbdf9('0x7d')})[_0xbdf9('0x34')](function(_0x4e3c47){_0x40344e=_0x4e3c47;});}})[_0xbdf9('0x25')](function(_0x28d41d){_0x8e399c=0x1f4;logger[_0xbdf9('0x21')](_0x28d41d[_0xbdf9('0x38')]);if(_0x28d41d[_0xbdf9('0x42')]){delete _0x28d41d[_0xbdf9('0x42')];}_0x40344e=_0x28d41d;})[_0xbdf9('0x7e')](function(){if(_0x40344e===null){_0x3464d1[_0xbdf9('0x26')](_0x8e399c);}else{if(_0x8e399c===0x1f4){_0x3464d1[_0xbdf9('0x27')](_0x8e399c)[_0xbdf9('0x39')](_0x40344e);}else{_0x3464d1[_0xbdf9('0x27')](_0x8e399c)[_0xbdf9('0x29')](_0x40344e);}}});};exports[_0xbdf9('0x7f')]=function(_0x4216b7,_0x4aeb8a,_0x393f75){var _0x1f898b={};var _0xb2f16b={};var _0x3a456e;var _0x2540fc;return db[_0xbdf9('0x3d')]['findOne']({'where':{'id':_0x4216b7[_0xbdf9('0x56')]['id']}})[_0xbdf9('0x34')](handleEntityNotFound(_0x4aeb8a,null))[_0xbdf9('0x34')](function(_0x22d4c7){if(_0x22d4c7){_0x3a456e=_0x22d4c7;_0xb2f16b['model']=_[_0xbdf9('0x58')](db[_0xbdf9('0x7b')][_0xbdf9('0x3e')]);_0xb2f16b[_0xbdf9('0x43')]=_[_0xbdf9('0x58')](_0x4216b7['query']);_0xb2f16b[_0xbdf9('0x44')]=_[_0xbdf9('0x45')](_0xb2f16b[_0xbdf9('0x41')],_0xb2f16b[_0xbdf9('0x43')]);_0x1f898b['attributes']=_[_0xbdf9('0x45')](_0xb2f16b[_0xbdf9('0x41')],qs[_0xbdf9('0x47')](_0x4216b7['query']['fields']));_0x1f898b[_0xbdf9('0x46')]=_0x1f898b['attributes'][_0xbdf9('0x48')]?_0x1f898b[_0xbdf9('0x46')]:_0xb2f16b['model'];_0x1f898b[_0xbdf9('0x4b')]=qs[_0xbdf9('0x4c')](_0x4216b7[_0xbdf9('0x43')][_0xbdf9('0x4c')]);_0x1f898b[_0xbdf9('0x4d')]=qs[_0xbdf9('0x44')](_['pick'](_0x4216b7[_0xbdf9('0x43')],_0xb2f16b[_0xbdf9('0x44')]));if(_0x4216b7[_0xbdf9('0x43')]['filter']){_0x1f898b[_0xbdf9('0x4d')]=_[_0xbdf9('0x59')](_0x1f898b[_0xbdf9('0x4d')],{'$or':_[_0xbdf9('0x3c')](_0x1f898b[_0xbdf9('0x46')],function(_0x2a1ee9){var _0x52fb59={};_0x52fb59[_0x2a1ee9]={'$like':'%'+_0x4216b7[_0xbdf9('0x43')][_0xbdf9('0x4f')]+'%'};return _0x52fb59;})});}_0x1f898b=_[_0xbdf9('0x59')]({},_0x1f898b,_0x4216b7[_0xbdf9('0x51')]);return _0x3a456e['getApplications'](_0x1f898b);}})[_0xbdf9('0x34')](function(_0x2c6930){if(_0x2c6930){_0x2540fc=_0x2c6930['length'];if(!_0x4216b7[_0xbdf9('0x43')][_0xbdf9('0x49')](_0xbdf9('0x4a'))){_0x1f898b[_0xbdf9('0x2c')]=qs[_0xbdf9('0x2c')](_0x4216b7[_0xbdf9('0x43')][_0xbdf9('0x2c')]);_0x1f898b[_0xbdf9('0x2a')]=qs[_0xbdf9('0x2a')](_0x4216b7[_0xbdf9('0x43')]['offset']);}return _0x3a456e['getApplications'](_0x1f898b);}})[_0xbdf9('0x34')](function(_0x363d35){if(_0x363d35){return _0x363d35?{'count':_0x2540fc,'rows':_0x363d35}:null;}})[_0xbdf9('0x34')](respondWithResult(_0x4aeb8a,null))[_0xbdf9('0x25')](handleError(_0x4aeb8a,null));};exports[_0xbdf9('0x80')]=function(_0x1151a1,_0x5a6cdf,_0x252931){var _0x12c65a={'channel':_0xbdf9('0x81')};var _0x566406=[];var _0x56b012=[];var _0xecee10={};return db['WhatsappAccount']['find']({'where':{'id':_0x1151a1[_0xbdf9('0x56')]['id']},'include':[{'model':db[_0xbdf9('0x7b')],'as':_0xbdf9('0x82')}]})[_0xbdf9('0x34')](handleEntityNotFound(_0x5a6cdf,null))[_0xbdf9('0x34')](function(_0x542dfe){_0x12c65a[_0xbdf9('0x83')]=_0x542dfe;if(_0x12c65a[_0xbdf9('0x83')]&&_0x12c65a['account'][_0xbdf9('0x3f')]==='sinch'&&_0x1151a1[_0xbdf9('0x5c')]['statuses']){if(_0x1151a1[_0xbdf9('0x5c')][_0xbdf9('0x84')]['length']===0x0)return;if(_0x1151a1[_0xbdf9('0x5c')]['statuses'][0x0][_0xbdf9('0x85')]!==_0xbdf9('0x86'))return;return db['WhatsappMessage'][_0xbdf9('0x33')]({'read':!![],'readAt':_0x1151a1['body'][_0xbdf9('0x84')][0x0][_0xbdf9('0x87')]},{'where':{'messageId':_0x1151a1[_0xbdf9('0x5c')][_0xbdf9('0x84')][0x0][_0xbdf9('0x88')]},'individualHooks':!![]})[_0xbdf9('0x34')](function(_0x555cb4){return _0x5a6cdf[_0xbdf9('0x27')](0xc8)[_0xbdf9('0x29')](_0x555cb4);});}_0x12c65a[_0xbdf9('0x89')]=_[_0xbdf9('0x8a')](_0x542dfe[_0xbdf9('0x82')],[_0xbdf9('0x7d')],[_0xbdf9('0x8b')]);if(_0x12c65a['account'][_0xbdf9('0x82')]){delete _0x12c65a['account'][_0xbdf9('0x82')];}return db[_0xbdf9('0x8c')][_0xbdf9('0x64')]()['then'](function(_0x4dd5b1){if(!_0x4dd5b1){throw new db['Sequelize']['ValidationError'](_0xbdf9('0x8d'));}_0x566406=_[_0xbdf9('0x8e')](_[_0xbdf9('0x58')](_0x4dd5b1),['createdAt','updatedAt']);_0x56b012=_[_0xbdf9('0x8e')](_[_0xbdf9('0x58')](_0x4dd5b1),[_0xbdf9('0x8f'),'updatedAt',_0xbdf9('0x90'),_0xbdf9('0x91')]);_0x12c65a[_0xbdf9('0x5c')]={'mapKey':'mobile'};if(_0x12c65a[_0xbdf9('0x83')]&&_0x12c65a[_0xbdf9('0x83')][_0xbdf9('0x3f')]===_0xbdf9('0x92')){_0x12c65a[_0xbdf9('0x5c')]['from']=_0x1151a1[_0xbdf9('0x5c')]['From'][_0xbdf9('0x93')](_0xbdf9('0x94'),'');_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x5c')]=_0x1151a1[_0xbdf9('0x5c')][_0xbdf9('0x95')];_0x12c65a['body'][_0xbdf9('0x96')]=_0x1151a1[_0xbdf9('0x5c')][_0xbdf9('0x97')];}if(_0x12c65a['account']&&_0x12c65a[_0xbdf9('0x83')]['type']===_0xbdf9('0x98')){_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x99')]=_0x1151a1[_0xbdf9('0x5c')][_0xbdf9('0x9a')][0x0][_0xbdf9('0x99')];_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x5c')]=_0x1151a1[_0xbdf9('0x5c')][_0xbdf9('0x9a')][0x0][_0xbdf9('0x23')][_0xbdf9('0x5c')];_0x12c65a[_0xbdf9('0x5c')]['messageId']=_0x1151a1[_0xbdf9('0x5c')]['notifications'][0x0][_0xbdf9('0x88')];}if(_0x12c65a[_0xbdf9('0x5c')]['id']){delete _0x12c65a[_0xbdf9('0x5c')]['id'];}if(_[_0xbdf9('0x9b')](_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x99')])){throw new db[(_0xbdf9('0x9c'))]['ValidationError'](_0xbdf9('0x9d'));}if(_['isNil'](_0x12c65a['body']['body'])||_0x12c65a['body'][_0xbdf9('0x5c')]===''){throw new db[(_0xbdf9('0x9c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x12c65a['body']['mapKey'])){throw new db[(_0xbdf9('0x9c'))][(_0xbdf9('0x9e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x56b012);}if(!_[_0xbdf9('0x9f')](_0x56b012,_0x12c65a[_0xbdf9('0x5c')]['mapKey'])){throw new db[(_0xbdf9('0x9c'))]['ValidationError'](_0xbdf9('0xa0')+_0x56b012);}_0xecee10[_0x12c65a['body'][_0xbdf9('0xa1')]]=_0x12c65a[_0xbdf9('0x5c')]['from'];return db[_0xbdf9('0xa2')][_0xbdf9('0x5a')]({'where':{'id':_0x12c65a[_0xbdf9('0x83')]['ListId']},'include':[{'model':db[_0xbdf9('0x8c')],'as':_0xbdf9('0xa3'),'where':_0xecee10,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xbdf9('0x34')](handleEntityNotFound(_0x5a6cdf,null))[_0xbdf9('0x34')](function(_0x84aace){if(_0x84aace){_0x12c65a[_0xbdf9('0xa4')]=_[_0xbdf9('0x70')](_0x84aace,[_0xbdf9('0xa3')]);if(_0x84aace[_0xbdf9('0xa3')][_0xbdf9('0x48')]){return _0x84aace[_0xbdf9('0xa3')][0x0];}var _0x33db1b=_['defaults'](_0x12c65a[_0xbdf9('0x5c')],{'firstName':_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x99')],'ListId':_0x84aace['id']});_0x33db1b[_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0xa1')]]=_0x12c65a['body']['from'];return db[_0xbdf9('0x8c')][_0xbdf9('0x5b')](_0x33db1b,{'fields':_0x566406,'raw':!![]});}})[_0xbdf9('0x34')](handleEntityNotFound(_0x5a6cdf,null))[_0xbdf9('0x34')](function(_0x5b677d){if(_0x5b677d){_0x12c65a[_0xbdf9('0xa5')]=_0x5b677d;var _0x51825f={'ContactId':_0x5b677d['id'],'phone':_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x99')],'WhatsappAccountId':_0x1151a1[_0xbdf9('0x56')]['id']};var _0x181a03={'ContactId':_0x5b677d['id'],'WhatsappAccountId':_0x1151a1[_0xbdf9('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xbdf9('0x5a')]({'where':_0x181a03})[_0xbdf9('0x34')](function(_0x59e6a9){if(_0x59e6a9){return[_0x59e6a9,![]];}return db['WhatsappInteraction'][_0xbdf9('0x5b')](_0x51825f)[_0xbdf9('0x34')](function(_0x2e43be){return[_0x2e43be,!![]];});});}})['spread'](function(_0x4c69e7,_0x2e3abd){_0x12c65a[_0xbdf9('0xa6')]=_0x4c69e7[_0xbdf9('0x36')]({'plain':!![]});_0x12c65a[_0xbdf9('0xa6')]['created']=![];if(_0x2e3abd){if(_0x12c65a[_0xbdf9('0x83')][_0xbdf9('0xa7')]){_0x12c65a['applications'][_0xbdf9('0xa8')]({'id':0x0,'priority':_0x12c65a[_0xbdf9('0x89')][_0xbdf9('0x48')]+0x1,'app':_0xbdf9('0xa9'),'appdata':_0xbdf9('0xaa'),'interval':_0xbdf9('0xab')});}_0x12c65a['interaction'][_0xbdf9('0xac')]=!![];}return db[_0xbdf9('0xad')][_0xbdf9('0x5b')]({'phone':_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x99')],'messageId':_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0x96')],'body':_0x12c65a['body']['body'],'WhatsappAccountId':_0x1151a1['params']['id'],'WhatsappInteractionId':_0x4c69e7['id'],'direction':'in','ContactId':_0x4c69e7[_0xbdf9('0xae')],'AttachmentId':_0x12c65a[_0xbdf9('0x5c')][_0xbdf9('0xaf')]});})[_0xbdf9('0x34')](function(_0x590b36){_0x12c65a[_0xbdf9('0x23')]=_0x590b36;if(_0x12c65a['interaction'][_0xbdf9('0xb0')]){return db['User'][_0xbdf9('0x5a')]({'attributes':['id',_0xbdf9('0x42')],'where':{'id':_0x12c65a['interaction']['UserId']}})['then'](function(_0x49f71b){if(_0x49f71b){_0x12c65a[_0xbdf9('0x89')][_0xbdf9('0xb1')]({'id':0x0,'priority':0x0,'app':_0xbdf9('0xb2'),'appdata':_0x49f71b[_0xbdf9('0x42')]+','+(_0x12c65a[_0xbdf9('0x83')][_0xbdf9('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xbdf9('0xb4'),_0xbdf9('0xb5'),_0x12c65a);});}return respondWithRpcPromise(_0xbdf9('0xb4'),'startRouting',_0x12c65a);})[_0xbdf9('0x34')](function(_0x298457){if(_0x298457){var _0x516fdc=0xc8;var _0x240354=_0xbdf9('0xb6');logger['info'](_0xbdf9('0x1f'),_0x240354,_0x516fdc,'entity\x20found');logger[_0xbdf9('0xb7')](_0xbdf9('0xb8'),_0x240354,_0x516fdc,_0xbdf9('0xb9'),JSON['stringify'](_0x298457));if(_0x12c65a[_0xbdf9('0x83')][_0xbdf9('0x3f')]==='twilio'){return _0x5a6cdf[_0xbdf9('0x27')](_0x516fdc)['set'](_0xbdf9('0xba'),'text/xml')[_0xbdf9('0x39')](_0xbdf9('0xbb'));}else{return _0x5a6cdf[_0xbdf9('0x27')](_0x516fdc)[_0xbdf9('0x29')](_0x298457);}}});})[_0xbdf9('0x25')](handleError(_0x5a6cdf,null));};exports[_0xbdf9('0x39')]=function(_0x4c60c6,_0x1cb246,_0xdcb0ad){var _0x2cf521,_0x50ce04,_0x26667d;if(_[_0xbdf9('0x9b')](_0x4c60c6[_0xbdf9('0x5c')]['body'])||_0x4c60c6[_0xbdf9('0x5c')][_0xbdf9('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0xbdf9('0xbc'));}if(_[_0xbdf9('0x9b')](_0x4c60c6[_0xbdf9('0x5c')]['to'])){throw new db['Sequelize'][(_0xbdf9('0x9e'))]('to\x20is\x20mandatory');}_0x2cf521=_0x4c60c6[_0xbdf9('0x5c')]['to'];return db[_0xbdf9('0x3d')][_0xbdf9('0x5a')]({'where':{'id':_0x4c60c6[_0xbdf9('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xbdf9('0xa3'),'where':{'mobile':_0x2cf521},'limit':0x1,'order':[[_0xbdf9('0xbd'),_0xbdf9('0xbe')]]}]}]})[_0xbdf9('0x34')](handleEntityNotFound(_0x1cb246,null))[_0xbdf9('0x34')](function(_0x50deb2){if(_0x50deb2&&_0x50deb2[_0xbdf9('0xbf')]){_0x50ce04=_0x50deb2[_0xbdf9('0x36')]({'plain':!![]});if(_0x50ce04[_0xbdf9('0xbf')]&&_0x50ce04[_0xbdf9('0xbf')][_0xbdf9('0xa3')][_0xbdf9('0x48')]){return _0x50ce04[_0xbdf9('0xbf')][_0xbdf9('0xa3')][0x0];}return db[_0xbdf9('0x8c')][_0xbdf9('0x5b')](_[_0xbdf9('0xc0')](_0x4c60c6[_0xbdf9('0x5c')],{'firstName':_0x2cf521,'mobile':_0x2cf521,'phone':_0x2cf521,'ListId':_0x50ce04[_0xbdf9('0x91')]}));}})[_0xbdf9('0x34')](handleEntityNotFound(_0x1cb246,null))['then'](function(_0x31bbb2){if(_0x31bbb2){_0x26667d=_0x31bbb2;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x26667d['id'],'closed':![],'WhatsappAccountId':_0x50ce04['id']}})[_0xbdf9('0x34')](function(_0x57b1ee){if(_0x57b1ee){return[_0x57b1ee,![]];}return db[_0xbdf9('0xc1')][_0xbdf9('0x5b')]({'UserId':_0x4c60c6['user']['id'],'ContactId':_0x26667d['id'],'WhatsappAccountId':_0x50ce04['id'],'phone':_0x2cf521,'firstMsgDirection':'out','Messages':[_['merge'](_0x4c60c6['body'],{'read':![],'body':_0x4c60c6[_0xbdf9('0x5c')][_0xbdf9('0x5c')],'phone':_0x2cf521,'WhatsappAccountId':_0x50ce04['id'],'UserId':_0x4c60c6[_0xbdf9('0x5d')]['id'],'ContactId':_0x26667d['id']})]},{'include':[{'model':db[_0xbdf9('0xad')],'as':_0xbdf9('0xc2')}]})[_0xbdf9('0x34')](function(_0x17c40f){return[_0x17c40f,!![]];});});}})[_0xbdf9('0x71')](function(_0x48c0b6,_0x2fabb8){if(_0x2fabb8){return _0x48c0b6;}return db[_0xbdf9('0xad')][_0xbdf9('0x5b')](_[_0xbdf9('0x59')](_0x4c60c6[_0xbdf9('0x5c')],{'read':![],'body':_0x4c60c6[_0xbdf9('0x5c')][_0xbdf9('0x5c')],'phone':_0x2cf521,'WhatsappAccountId':_0x50ce04['id'],'WhatsappInteractionId':_0x48c0b6['id'],'UserId':_0x4c60c6[_0xbdf9('0x5d')]['id'],'ContactId':_0x26667d['id']}))[_0xbdf9('0x34')](function(_0x4a78da){_0x48c0b6[_0xbdf9('0xc3')][_0xbdf9('0xc2')]=[];_0x48c0b6[_0xbdf9('0xc3')][_0xbdf9('0xc2')][_0xbdf9('0xa8')](_0x4a78da[_0xbdf9('0xc3')]);return _0x48c0b6;});})[_0xbdf9('0x34')](respondWithResult(_0x1cb246,null))['catch'](handleError(_0x1cb246,null));}; \ No newline at end of file +var _0x495d=['type','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','mandatoryDispositionPause','keys','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','json','applications','orderBy','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','replace','whatsapp:','Body','messageId','MessageSid','sinch','from','notifications','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','end','status','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0x495d,0x81));var _0xd495=function(_0x30965f,_0x43e7e0){_0x30965f=_0x30965f-0x0;var _0x2d9433=_0x495d[_0x30965f];return _0x2d9433;};'use strict';var emlformat=require(_0xd495('0x0'));var rimraf=require(_0xd495('0x1'));var zipdir=require(_0xd495('0x2'));var jsonpatch=require(_0xd495('0x3'));var rp=require(_0xd495('0x4'));var moment=require(_0xd495('0x5'));var BPromise=require(_0xd495('0x6'));var Mustache=require(_0xd495('0x7'));var util=require(_0xd495('0x8'));var path=require('path');var sox=require(_0xd495('0x9'));var csv=require(_0xd495('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd495('0xb'));var squel=require(_0xd495('0xc'));var crypto=require(_0xd495('0xd'));var jsforce=require(_0xd495('0xe'));var deskjs=require(_0xd495('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd495('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd495('0x11'));var qs=require(_0xd495('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd495('0x13'));var logger=require(_0xd495('0x14'))(_0xd495('0x15'));var utils=require(_0xd495('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd495('0x17'))['db'];config[_0xd495('0x18')]=_[_0xd495('0x19')](config[_0xd495('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd495('0x1a'))(new Redis(config[_0xd495('0x18')]));require(_0xd495('0x1b'))[_0xd495('0x1c')](socket);var jayson=require(_0xd495('0x1d'));var client=jayson[_0xd495('0x1e')][_0xd495('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x321359,_0x45250e,_0x535985,_0x5c86e5){return new BPromise(function(_0x2b69a1,_0xdd6ce4){var _0x49f751=_0x5c86e5||client;return _0x49f751[_0xd495('0x20')](_0x321359,_0x535985)['then'](function(_0x3ebea0){logger[_0xd495('0x21')](_0xd495('0x22'),_0x45250e,_0xd495('0x23'));logger[_0xd495('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x45250e,_0xd495('0x23'),JSON['stringify'](_0x3ebea0));if(_0x3ebea0[_0xd495('0x25')]){if(_0x3ebea0[_0xd495('0x25')][_0xd495('0x26')]===0x1f4){logger[_0xd495('0x25')](_0xd495('0x22'),_0x45250e,_0x3ebea0[_0xd495('0x25')]['message']);return _0xdd6ce4(_0x3ebea0['error'][_0xd495('0x27')]);}logger['error'](_0xd495('0x22'),_0x45250e,_0x3ebea0[_0xd495('0x25')]['message']);return _0x2b69a1(_0x3ebea0['error']['message']);}else{logger[_0xd495('0x21')](_0xd495('0x22'),_0x45250e,_0xd495('0x23'));_0x2b69a1(_0x3ebea0['result']['message']);}})[_0xd495('0x28')](function(_0x4ad604){logger[_0xd495('0x25')](_0xd495('0x22'),_0x45250e,_0x4ad604);_0xdd6ce4(_0x4ad604);});});}function respondWithStatusCode(_0x366250,_0x4c3390){_0x4c3390=_0x4c3390||0xcc;return function(_0x13f50d){if(_0x13f50d){return _0x366250[_0xd495('0x29')](_0x4c3390);}return _0x366250['status'](_0x4c3390)[_0xd495('0x2a')]();};}function respondWithResult(_0x132d8d,_0x28f9b2){_0x28f9b2=_0x28f9b2||0xc8;return function(_0x5a11c2){if(_0x5a11c2){return _0x132d8d[_0xd495('0x2b')](_0x28f9b2)['json'](_0x5a11c2);}};}function respondWithFilteredResult(_0xc80541,_0x3032bb){return function(_0x1e9345){if(_0x1e9345){var _0x177720=typeof _0x3032bb['offset']==='undefined'&&typeof _0x3032bb[_0xd495('0x2c')]==='undefined';var _0x5822ae=_0x1e9345[_0xd495('0x2d')];var _0x30bdba=_0x177720?0x0:_0x3032bb[_0xd495('0x2e')];var _0x77d79b=_0x177720?_0x1e9345[_0xd495('0x2d')]:_0x3032bb['offset']+_0x3032bb[_0xd495('0x2c')];var _0x2d2275;if(_0x77d79b>=_0x5822ae){_0x77d79b=_0x5822ae;_0x2d2275=0xc8;}else{_0x2d2275=0xce;}_0xc80541['status'](_0x2d2275);return _0xc80541[_0xd495('0x2f')](_0xd495('0x30'),_0x30bdba+'-'+_0x77d79b+'/'+_0x5822ae)['json'](_0x1e9345);}return null;};}function patchUpdates(_0x45a8eb){return function(_0x25a48e){try{jsonpatch[_0xd495('0x31')](_0x25a48e,_0x45a8eb,!![]);}catch(_0x210807){return BPromise[_0xd495('0x32')](_0x210807);}return _0x25a48e[_0xd495('0x33')]();};}function saveUpdates(_0x22ca3c,_0x19bb6b){return function(_0x46bfbe){if(_0x46bfbe){return _0x46bfbe[_0xd495('0x34')](_0x22ca3c)['then'](function(_0x560917){return _0x560917;});}return null;};}function removeEntity(_0x2461d6,_0x151764){return function(_0x297d43){if(_0x297d43){return _0x297d43[_0xd495('0x35')]()[_0xd495('0x36')](function(){var _0x23cc54=_0x297d43[_0xd495('0x37')]({'plain':!![]});var _0x40022d=_0xd495('0x38');return db[_0xd495('0x39')][_0xd495('0x35')]({'where':{'type':_0x40022d,'resourceId':_0x23cc54['id']}})[_0xd495('0x36')](function(){return _0x297d43;});})['then'](function(){_0x2461d6[_0xd495('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2baa45,_0x3ea9d6){return function(_0x2022df){if(!_0x2022df){_0x2baa45[_0xd495('0x29')](0x194);}return _0x2022df;};}function handleError(_0x1e4ecf,_0x355add){_0x355add=_0x355add||0x1f4;return function(_0x2512af){logger[_0xd495('0x25')](_0x2512af['stack']);if(_0x2512af[_0xd495('0x3a')]){delete _0x2512af[_0xd495('0x3a')];}_0x1e4ecf[_0xd495('0x2b')](_0x355add)[_0xd495('0x3b')](_0x2512af);};}exports[_0xd495('0x3c')]=function(_0x374d06,_0x5f148e){var _0x1e0f84={'include':[{'model':db[_0xd495('0x3d')],'as':'mandatoryDispositionPause'}]},_0x3ebc71={},_0x387115={'count':0x0,'rows':[]};var _0x291fb7=_[_0xd495('0x3e')](db[_0xd495('0x3f')][_0xd495('0x40')],function(_0x1a30b1){return{'name':_0x1a30b1[_0xd495('0x41')],'type':_0x1a30b1[_0xd495('0x42')]['key']};});_0x3ebc71['model']=_['map'](_0x291fb7,_0xd495('0x3a'));_0x3ebc71[_0xd495('0x43')]=_['keys'](_0x374d06['query']);_0x3ebc71[_0xd495('0x44')]=_['intersection'](_0x3ebc71[_0xd495('0x45')],_0x3ebc71[_0xd495('0x43')]);_0x1e0f84['attributes']=_[_0xd495('0x46')](_0x3ebc71['model'],qs['fields'](_0x374d06[_0xd495('0x43')][_0xd495('0x47')]));_0x1e0f84[_0xd495('0x48')]=_0x1e0f84[_0xd495('0x48')][_0xd495('0x49')]?_0x1e0f84[_0xd495('0x48')]:_0x3ebc71[_0xd495('0x45')];if(!_0x374d06[_0xd495('0x43')][_0xd495('0x4a')]('nolimit')){_0x1e0f84[_0xd495('0x2c')]=qs[_0xd495('0x2c')](_0x374d06[_0xd495('0x43')][_0xd495('0x2c')]);_0x1e0f84[_0xd495('0x2e')]=qs[_0xd495('0x2e')](_0x374d06[_0xd495('0x43')]['offset']);}_0x1e0f84[_0xd495('0x4b')]=qs[_0xd495('0x4c')](_0x374d06[_0xd495('0x43')]['sort']);_0x1e0f84[_0xd495('0x4d')]=qs[_0xd495('0x44')](_[_0xd495('0x4e')](_0x374d06[_0xd495('0x43')],_0x3ebc71[_0xd495('0x44')]),_0x291fb7);if(_0x374d06[_0xd495('0x43')][_0xd495('0x4f')]){_0x1e0f84[_0xd495('0x4d')]=_[_0xd495('0x50')](_0x1e0f84[_0xd495('0x4d')],{'$or':_[_0xd495('0x3e')](_0x291fb7,function(_0x5aa5a5){if(_0x5aa5a5[_0xd495('0x42')]!==_0xd495('0x51')){var _0x49b2bd={};_0x49b2bd[_0x5aa5a5['name']]={'$like':'%'+_0x374d06[_0xd495('0x43')][_0xd495('0x4f')]+'%'};return _0x49b2bd;}})});}_0x1e0f84=_[_0xd495('0x50')]({},_0x1e0f84,_0x374d06[_0xd495('0x52')]);var _0x52df3d={'where':_0x1e0f84[_0xd495('0x4d')]};return db[_0xd495('0x3f')][_0xd495('0x2d')](_0x52df3d)[_0xd495('0x36')](function(_0x2dca72){_0x387115[_0xd495('0x2d')]=_0x2dca72;if(_0x374d06['query'][_0xd495('0x53')]){_0x1e0f84[_0xd495('0x54')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x1e0f84);})[_0xd495('0x36')](function(_0x3bf1e9){_0x387115[_0xd495('0x55')]=_0x3bf1e9;return _0x387115;})[_0xd495('0x36')](respondWithFilteredResult(_0x5f148e,_0x1e0f84))[_0xd495('0x28')](handleError(_0x5f148e,null));};exports['show']=function(_0x26e063,_0x1ffe8a){var _0x18d0bf={'raw':![],'where':{'id':_0x26e063[_0xd495('0x56')]['id']},'include':[{'model':db[_0xd495('0x3d')],'as':_0xd495('0x57')}]},_0x5f4870={};_0x5f4870[_0xd495('0x45')]=_[_0xd495('0x58')](db[_0xd495('0x3f')][_0xd495('0x40')]);_0x5f4870[_0xd495('0x43')]=_[_0xd495('0x58')](_0x26e063['query']);_0x5f4870['filters']=_[_0xd495('0x46')](_0x5f4870['model'],_0x5f4870[_0xd495('0x43')]);_0x18d0bf[_0xd495('0x48')]=_[_0xd495('0x46')](_0x5f4870[_0xd495('0x45')],qs['fields'](_0x26e063[_0xd495('0x43')][_0xd495('0x47')]));_0x18d0bf['attributes']=_0x18d0bf[_0xd495('0x48')][_0xd495('0x49')]?_0x18d0bf[_0xd495('0x48')]:_0x5f4870['model'];if(_0x26e063[_0xd495('0x43')][_0xd495('0x53')]){_0x18d0bf[_0xd495('0x54')]=[{'all':!![]}];}_0x18d0bf=_[_0xd495('0x50')]({},_0x18d0bf,_0x26e063[_0xd495('0x52')]);return db['WhatsappAccount']['find'](_0x18d0bf)[_0xd495('0x36')](handleEntityNotFound(_0x1ffe8a,null))[_0xd495('0x36')](respondWithResult(_0x1ffe8a,null))[_0xd495('0x28')](handleError(_0x1ffe8a,null));};exports['create']=function(_0x559d66,_0x1a3090){return db['WhatsappAccount'][_0xd495('0x59')](_0x559d66['body'],{})['then'](function(_0x22e555){var _0xc7a336=_0x559d66[_0xd495('0x5a')]['get']({'plain':!![]});if(!_0xc7a336)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc7a336[_0xd495('0x5b')]===_0xd495('0x5a')){var _0x8f0deb=_0x22e555[_0xd495('0x37')]({'plain':!![]});var _0x220794='WhatsappAccounts';return db[_0xd495('0x5c')][_0xd495('0x5d')]({'where':{'name':_0x220794,'userProfileId':_0xc7a336[_0xd495('0x5e')]},'raw':!![]})[_0xd495('0x36')](function(_0x2ec1e8){if(_0x2ec1e8&&_0x2ec1e8[_0xd495('0x5f')]===0x0){return db[_0xd495('0x39')][_0xd495('0x59')]({'name':_0x8f0deb[_0xd495('0x3a')],'resourceId':_0x8f0deb['id'],'type':_0x2ec1e8[_0xd495('0x3a')],'sectionId':_0x2ec1e8['id']},{})['then'](function(){return _0x22e555;});}else{return _0x22e555;}})['catch'](function(_0x475c2c){logger[_0xd495('0x25')](_0xd495('0x60'),_0x475c2c);throw _0x475c2c;});}return _0x22e555;})[_0xd495('0x36')](respondWithResult(_0x1a3090,0xc9))[_0xd495('0x28')](handleError(_0x1a3090,null));};exports[_0xd495('0x34')]=function(_0x5d2ac4,_0x23cc9f){if(_0x5d2ac4['body']['id']){delete _0x5d2ac4[_0xd495('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5d2ac4['params']['id']},'include':[{'model':db[_0xd495('0x3d')],'as':_0xd495('0x57')}]})[_0xd495('0x36')](handleEntityNotFound(_0x23cc9f,null))['then'](saveUpdates(_0x5d2ac4['body'],null))[_0xd495('0x36')](respondWithResult(_0x23cc9f,null))[_0xd495('0x28')](handleError(_0x23cc9f,null));};exports[_0xd495('0x35')]=function(_0x5278d4,_0x5116ab){return db[_0xd495('0x3f')][_0xd495('0x5d')]({'where':{'id':_0x5278d4[_0xd495('0x56')]['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x5116ab,null))[_0xd495('0x36')](removeEntity(_0x5116ab,null))[_0xd495('0x28')](handleError(_0x5116ab,null));};exports[_0xd495('0x62')]=function(_0xe7ea7b,_0x57723d){return db[_0xd495('0x3f')]['describe']()['then'](respondWithResult(_0x57723d,null))[_0xd495('0x28')](handleError(_0x57723d,null));};exports['addDisposition']=function(_0x543bda,_0x4aac61,_0x309ed3){if(_0x543bda['body']['id']){delete _0x543bda[_0xd495('0x61')]['id'];}return db[_0xd495('0x3f')][_0xd495('0x5d')]({'where':{'id':_0x543bda['params']['id']}})['then'](handleEntityNotFound(_0x4aac61,null))[_0xd495('0x36')](function(_0x199ab0){if(_0x199ab0){_0x543bda['body'][_0xd495('0x63')]=_0x199ab0['id'];return db[_0xd495('0x64')][_0xd495('0x59')](_0x543bda[_0xd495('0x61')]);}})[_0xd495('0x36')](respondWithResult(_0x4aac61,null))[_0xd495('0x28')](handleError(_0x4aac61,null));};exports[_0xd495('0x65')]=function(_0x1b3882,_0x51d459,_0xcc5ace){var _0x51e255={'raw':![],'where':{}};var _0xbaa6db={};var _0x24d84c={'count':0x0,'rows':[]};return db[_0xd495('0x3f')][_0xd495('0x66')]({'where':{'id':_0x1b3882[_0xd495('0x56')]['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x51d459,null))[_0xd495('0x36')](function(_0x3bbaf6){if(_0x3bbaf6){_0xbaa6db['model']=_[_0xd495('0x58')](db[_0xd495('0x64')]['rawAttributes']);_0xbaa6db['query']=_[_0xd495('0x58')](_0x1b3882['query']);_0xbaa6db[_0xd495('0x44')]=_[_0xd495('0x46')](_0xbaa6db[_0xd495('0x45')],_0xbaa6db['query']);_0x51e255['attributes']=_[_0xd495('0x46')](_0xbaa6db['model'],qs[_0xd495('0x47')](_0x1b3882[_0xd495('0x43')][_0xd495('0x47')]));_0x51e255[_0xd495('0x48')]=_0x51e255[_0xd495('0x48')][_0xd495('0x49')]?_0x51e255['attributes']:_0xbaa6db[_0xd495('0x45')];if(!_0x1b3882[_0xd495('0x43')]['hasOwnProperty']('nolimit')){_0x51e255[_0xd495('0x2c')]=qs['limit'](_0x1b3882['query'][_0xd495('0x2c')]);_0x51e255['offset']=qs[_0xd495('0x2e')](_0x1b3882[_0xd495('0x43')][_0xd495('0x2e')]);}_0x51e255['order']=qs[_0xd495('0x4c')](_0x1b3882[_0xd495('0x43')][_0xd495('0x4c')]);_0x51e255['where']=qs[_0xd495('0x44')](_[_0xd495('0x4e')](_0x1b3882[_0xd495('0x43')],_0xbaa6db[_0xd495('0x44')]));_0x51e255['where'][_0xd495('0x63')]=_0x3bbaf6['id'];if(_0x1b3882[_0xd495('0x43')][_0xd495('0x4f')]){_0x51e255['where']=_[_0xd495('0x50')](_0x51e255['where'],{'$or':_['map'](_0x51e255['attributes'],function(_0x4f0d34){var _0xf6aa37={};_0xf6aa37[_0x4f0d34]={'$like':'%'+_0x1b3882['query'][_0xd495('0x4f')]+'%'};return _0xf6aa37;})});}_0x51e255=_[_0xd495('0x50')]({},_0x51e255,_0x1b3882[_0xd495('0x52')]);return db[_0xd495('0x64')]['count']({'where':_0x51e255[_0xd495('0x4d')]})[_0xd495('0x36')](function(_0x3dbbe9){_0x24d84c[_0xd495('0x2d')]=_0x3dbbe9;if(_0x1b3882['query'][_0xd495('0x53')]){_0x51e255[_0xd495('0x54')]=[{'all':!![]}];}return db[_0xd495('0x64')][_0xd495('0x67')](_0x51e255);})[_0xd495('0x36')](function(_0x3e57f7){_0x24d84c[_0xd495('0x55')]=_0x3e57f7;return _0x24d84c;});}})[_0xd495('0x36')](respondWithFilteredResult(_0x51d459,_0x51e255))[_0xd495('0x28')](handleError(_0x51d459,null));};exports[_0xd495('0x68')]=function(_0x4af4d2,_0x18675f,_0x1e1170){return db[_0xd495('0x3f')][_0xd495('0x5d')]({'where':{'id':_0x4af4d2[_0xd495('0x56')]['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x18675f,null))[_0xd495('0x36')](function(_0xb78f69){if(_0xb78f69){return _0xb78f69[_0xd495('0x68')](_0x4af4d2['query'][_0xd495('0x69')]);}})[_0xd495('0x36')](respondWithStatusCode(_0x18675f,null))[_0xd495('0x28')](handleError(_0x18675f,null));};exports['addAnswer']=function(_0x57322a,_0x373225,_0x468414){if(_0x57322a['body']['id']){delete _0x57322a['body']['id'];}return db[_0xd495('0x3f')][_0xd495('0x5d')]({'where':{'id':_0x57322a[_0xd495('0x56')]['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x373225,null))[_0xd495('0x36')](function(_0x5cae28){if(_0x5cae28){_0x57322a[_0xd495('0x61')][_0xd495('0x63')]=_0x5cae28['id'];return db[_0xd495('0x6a')]['create'](_0x57322a[_0xd495('0x61')]);}})[_0xd495('0x36')](respondWithResult(_0x373225,null))[_0xd495('0x28')](handleError(_0x373225,null));};exports[_0xd495('0x6b')]=function(_0xa1ebf5,_0x4569c1,_0x295f28){var _0x11b1c7={'raw':![],'where':{}};var _0x30e178={};var _0x5bc6ec={'count':0x0,'rows':[]};return db[_0xd495('0x3f')][_0xd495('0x66')]({'where':{'id':_0xa1ebf5[_0xd495('0x56')]['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x4569c1,null))[_0xd495('0x36')](function(_0x190b61){if(_0x190b61){_0x30e178['model']=_['keys'](db[_0xd495('0x6a')][_0xd495('0x40')]);_0x30e178['query']=_[_0xd495('0x58')](_0xa1ebf5['query']);_0x30e178[_0xd495('0x44')]=_[_0xd495('0x46')](_0x30e178[_0xd495('0x45')],_0x30e178[_0xd495('0x43')]);_0x11b1c7['attributes']=_['intersection'](_0x30e178[_0xd495('0x45')],qs['fields'](_0xa1ebf5[_0xd495('0x43')][_0xd495('0x47')]));_0x11b1c7[_0xd495('0x48')]=_0x11b1c7[_0xd495('0x48')][_0xd495('0x49')]?_0x11b1c7[_0xd495('0x48')]:_0x30e178[_0xd495('0x45')];if(!_0xa1ebf5[_0xd495('0x43')]['hasOwnProperty'](_0xd495('0x6c'))){_0x11b1c7[_0xd495('0x2c')]=qs[_0xd495('0x2c')](_0xa1ebf5[_0xd495('0x43')][_0xd495('0x2c')]);_0x11b1c7[_0xd495('0x2e')]=qs['offset'](_0xa1ebf5[_0xd495('0x43')][_0xd495('0x2e')]);}_0x11b1c7['order']=qs[_0xd495('0x4c')](_0xa1ebf5[_0xd495('0x43')]['sort']);_0x11b1c7['where']=qs[_0xd495('0x44')](_['pick'](_0xa1ebf5['query'],_0x30e178[_0xd495('0x44')]));_0x11b1c7[_0xd495('0x4d')][_0xd495('0x63')]=_0x190b61['id'];if(_0xa1ebf5[_0xd495('0x43')][_0xd495('0x4f')]){_0x11b1c7[_0xd495('0x4d')]=_['merge'](_0x11b1c7[_0xd495('0x4d')],{'$or':_[_0xd495('0x3e')](_0x11b1c7['attributes'],function(_0x21f8a9){var _0x500cd8={};_0x500cd8[_0x21f8a9]={'$like':'%'+_0xa1ebf5['query']['filter']+'%'};return _0x500cd8;})});}_0x11b1c7=_[_0xd495('0x50')]({},_0x11b1c7,_0xa1ebf5['options']);return db[_0xd495('0x6a')][_0xd495('0x2d')]({'where':_0x11b1c7[_0xd495('0x4d')]})[_0xd495('0x36')](function(_0xd00b38){_0x5bc6ec[_0xd495('0x2d')]=_0xd00b38;if(_0xa1ebf5[_0xd495('0x43')][_0xd495('0x53')]){_0x11b1c7[_0xd495('0x54')]=[{'all':!![]}];}return db[_0xd495('0x6a')][_0xd495('0x67')](_0x11b1c7);})[_0xd495('0x36')](function(_0xd26fac){_0x5bc6ec[_0xd495('0x55')]=_0xd26fac;return _0x5bc6ec;});}})[_0xd495('0x36')](respondWithFilteredResult(_0x4569c1,_0x11b1c7))[_0xd495('0x28')](handleError(_0x4569c1,null));};exports[_0xd495('0x6d')]=function(_0x574fee,_0x5c57e0,_0x5cb692){return db[_0xd495('0x3f')][_0xd495('0x5d')]({'where':{'id':_0x574fee[_0xd495('0x56')]['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x5c57e0,null))[_0xd495('0x36')](function(_0x500183){if(_0x500183){return _0x500183[_0xd495('0x6d')](_0x574fee[_0xd495('0x43')][_0xd495('0x69')]);}})[_0xd495('0x36')](respondWithStatusCode(_0x5c57e0,null))['catch'](handleError(_0x5c57e0,null));};exports[_0xd495('0x6e')]=function(_0xff49d8,_0x5323ed,_0x12152e){return db['WhatsappAccount'][_0xd495('0x5d')]({'where':{'id':_0xff49d8[_0xd495('0x56')]['id']}})['then'](handleEntityNotFound(_0x5323ed,null))[_0xd495('0x36')](function(_0x5ac6b1){if(_0x5ac6b1){return _0x5ac6b1[_0xd495('0x6e')](_0xff49d8[_0xd495('0x61')][_0xd495('0x69')],_[_0xd495('0x6f')](_0xff49d8['body'],['ids','id'])||{})[_0xd495('0x70')](function(_0x1496bc){for(var _0x35397c=0x0;_0x35397c<_0xff49d8['body']['ids'][_0xd495('0x49')];_0x35397c+=0x1){socket[_0xd495('0x71')](_0xd495('0x72'),{'UserId':Number(_0xff49d8['body'][_0xd495('0x69')][_0x35397c]),'WhatsappAccountId':Number(_0xff49d8[_0xd495('0x56')]['id'])});}return _0x1496bc;});}})[_0xd495('0x36')](respondWithResult(_0x5323ed,null))[_0xd495('0x28')](handleError(_0x5323ed,null));};exports[_0xd495('0x73')]=function(_0x5e1589,_0x2056e5,_0x44365d){return db[_0xd495('0x3f')][_0xd495('0x5d')]({'where':{'id':_0x5e1589['params']['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x2056e5,null))[_0xd495('0x36')](function(_0x140d93){if(_0x140d93){return _0x140d93[_0xd495('0x73')](_0x5e1589['query']['ids'])['then'](function(){if(_['isArray'](_0x5e1589[_0xd495('0x43')][_0xd495('0x69')])){for(var _0x16198d=0x0;_0x16198d<_0x5e1589[_0xd495('0x43')][_0xd495('0x69')][_0xd495('0x49')];_0x16198d+=0x1){socket[_0xd495('0x71')](_0xd495('0x74'),{'UserId':Number(_0x5e1589[_0xd495('0x43')]['ids'][_0x16198d]),'WhatsappAccountId':Number(_0x5e1589['params']['id'])});}}else{socket[_0xd495('0x71')](_0xd495('0x74'),{'UserId':Number(_0x5e1589[_0xd495('0x43')][_0xd495('0x69')]),'WhatsappAccountId':Number(_0x5e1589[_0xd495('0x56')]['id'])});}});}})[_0xd495('0x36')](respondWithStatusCode(_0x2056e5,null))['catch'](handleError(_0x2056e5,null));};exports[_0xd495('0x75')]=function(_0x39afa1,_0x5cd4f0,_0x577922){var _0x5564e8={};var _0x10a25a={};var _0x28f9dd;var _0x1f5bf8;return db[_0xd495('0x3f')][_0xd495('0x66')]({'where':{'id':_0x39afa1['params']['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x5cd4f0,null))[_0xd495('0x36')](function(_0x5e3b51){if(_0x5e3b51){_0x28f9dd=_0x5e3b51;_0x10a25a[_0xd495('0x45')]=_[_0xd495('0x58')](db[_0xd495('0x76')][_0xd495('0x40')]);_0x10a25a[_0xd495('0x43')]=_[_0xd495('0x58')](_0x39afa1['query']);_0x10a25a[_0xd495('0x44')]=_['intersection'](_0x10a25a['model'],_0x10a25a[_0xd495('0x43')]);_0x5564e8[_0xd495('0x48')]=_[_0xd495('0x46')](_0x10a25a[_0xd495('0x45')],qs[_0xd495('0x47')](_0x39afa1[_0xd495('0x43')][_0xd495('0x47')]));_0x5564e8[_0xd495('0x48')]=_0x5564e8[_0xd495('0x48')][_0xd495('0x49')]?_0x5564e8[_0xd495('0x48')]:_0x10a25a[_0xd495('0x45')];_0x5564e8[_0xd495('0x4b')]=qs['sort'](_0x39afa1[_0xd495('0x43')][_0xd495('0x4c')]);_0x5564e8[_0xd495('0x4d')]=qs[_0xd495('0x44')](_['pick'](_0x39afa1['query'],_0x10a25a['filters']));if(_0x39afa1[_0xd495('0x43')][_0xd495('0x4f')]){_0x5564e8[_0xd495('0x4d')]=_[_0xd495('0x50')](_0x5564e8['where'],{'$or':_[_0xd495('0x3e')](_0x5564e8[_0xd495('0x48')],function(_0x5547f4){var _0x137c71={};_0x137c71[_0x5547f4]={'$like':'%'+_0x39afa1[_0xd495('0x43')][_0xd495('0x4f')]+'%'};return _0x137c71;})});}_0x5564e8=_[_0xd495('0x50')]({},_0x5564e8,_0x39afa1[_0xd495('0x52')]);return _0x28f9dd['getAgents'](_0x5564e8);}})[_0xd495('0x36')](function(_0x49deed){if(_0x49deed){_0x1f5bf8=_0x49deed['length'];if(!_0x39afa1['query'][_0xd495('0x4a')](_0xd495('0x6c'))){_0x5564e8['limit']=qs[_0xd495('0x2c')](_0x39afa1['query'][_0xd495('0x2c')]);_0x5564e8[_0xd495('0x2e')]=qs[_0xd495('0x2e')](_0x39afa1[_0xd495('0x43')][_0xd495('0x2e')]);}return _0x28f9dd[_0xd495('0x75')](_0x5564e8);}})[_0xd495('0x36')](function(_0x37a2e4){if(_0x37a2e4){return _0x37a2e4?{'count':_0x1f5bf8,'rows':_0x37a2e4}:null;}})[_0xd495('0x36')](respondWithResult(_0x5cd4f0,null))['catch'](handleError(_0x5cd4f0,null));};exports['addApplications']=function(_0x2317e5,_0x30d744){var _0x438464=_0x2317e5[_0xd495('0x56')]['id'];var _0x1a7595=_0x2317e5[_0xd495('0x61')];var _0x159370=0xc8;var _0x212d19=null;return db['sequelize'][_0xd495('0x77')]({'isolationLevel':db[_0xd495('0x78')][_0xd495('0x79')][_0xd495('0x7a')][_0xd495('0x7b')]},function(_0x49e5c6){return db[_0xd495('0x3f')]['findOne']({'where':{'id':_0x438464},'transaction':_0x49e5c6})['then'](function(_0x212c8a){if(_0x212c8a){return db[_0xd495('0x7c')]['destroy']({'where':{'WhatsappAccountId':_0x438464},'transaction':_0x49e5c6})[_0xd495('0x36')](function(){var _0x213104=_[_0xd495('0x3e')](_0x1a7595,function(_0x5c855e){_0x5c855e['WhatsappAccountId']=_0x438464;return _0x5c855e;});return db[_0xd495('0x7c')][_0xd495('0x7d')](_0x213104,{'transaction':_0x49e5c6});});}else{_0x159370=0x194;_0x212d19=[];}});})['then'](function(){if(_0x159370!==0x194){return db['WhatsappApplication'][_0xd495('0x7e')]({'where':{'WhatsappAccountId':_0x438464},'order':_0xd495('0x7f')})['then'](function(_0x36d996){_0x212d19=_0x36d996;});}})[_0xd495('0x28')](function(_0x73fe4){_0x159370=0x1f4;logger['error'](_0x73fe4[_0xd495('0x80')]);if(_0x73fe4[_0xd495('0x3a')]){delete _0x73fe4[_0xd495('0x3a')];}_0x212d19=_0x73fe4;})['finally'](function(){if(_0x212d19===null){_0x30d744['sendStatus'](_0x159370);}else{if(_0x159370===0x1f4){_0x30d744[_0xd495('0x2b')](_0x159370)[_0xd495('0x3b')](_0x212d19);}else{_0x30d744[_0xd495('0x2b')](_0x159370)['json'](_0x212d19);}}});};exports[_0xd495('0x81')]=function(_0x376065,_0x30c6d4,_0x1c3792){var _0x49d559={};var _0x1df3f6={};var _0x1085bd;var _0x35b1e4;return db[_0xd495('0x3f')][_0xd495('0x66')]({'where':{'id':_0x376065[_0xd495('0x56')]['id']}})[_0xd495('0x36')](handleEntityNotFound(_0x30c6d4,null))[_0xd495('0x36')](function(_0x1fc228){if(_0x1fc228){_0x1085bd=_0x1fc228;_0x1df3f6['model']=_['keys'](db[_0xd495('0x7c')]['rawAttributes']);_0x1df3f6[_0xd495('0x43')]=_[_0xd495('0x58')](_0x376065[_0xd495('0x43')]);_0x1df3f6['filters']=_['intersection'](_0x1df3f6[_0xd495('0x45')],_0x1df3f6[_0xd495('0x43')]);_0x49d559[_0xd495('0x48')]=_['intersection'](_0x1df3f6[_0xd495('0x45')],qs[_0xd495('0x47')](_0x376065[_0xd495('0x43')][_0xd495('0x47')]));_0x49d559['attributes']=_0x49d559[_0xd495('0x48')]['length']?_0x49d559[_0xd495('0x48')]:_0x1df3f6[_0xd495('0x45')];_0x49d559[_0xd495('0x4b')]=qs[_0xd495('0x4c')](_0x376065[_0xd495('0x43')]['sort']);_0x49d559['where']=qs[_0xd495('0x44')](_['pick'](_0x376065[_0xd495('0x43')],_0x1df3f6['filters']));if(_0x376065[_0xd495('0x43')][_0xd495('0x4f')]){_0x49d559['where']=_['merge'](_0x49d559[_0xd495('0x4d')],{'$or':_['map'](_0x49d559[_0xd495('0x48')],function(_0x31ce4c){var _0x1b3774={};_0x1b3774[_0x31ce4c]={'$like':'%'+_0x376065[_0xd495('0x43')][_0xd495('0x4f')]+'%'};return _0x1b3774;})});}_0x49d559=_['merge']({},_0x49d559,_0x376065['options']);return _0x1085bd[_0xd495('0x81')](_0x49d559);}})[_0xd495('0x36')](function(_0x198034){if(_0x198034){_0x35b1e4=_0x198034['length'];if(!_0x376065[_0xd495('0x43')][_0xd495('0x4a')](_0xd495('0x6c'))){_0x49d559[_0xd495('0x2c')]=qs[_0xd495('0x2c')](_0x376065[_0xd495('0x43')][_0xd495('0x2c')]);_0x49d559[_0xd495('0x2e')]=qs[_0xd495('0x2e')](_0x376065[_0xd495('0x43')][_0xd495('0x2e')]);}return _0x1085bd[_0xd495('0x81')](_0x49d559);}})[_0xd495('0x36')](function(_0x57d771){if(_0x57d771){return _0x57d771?{'count':_0x35b1e4,'rows':_0x57d771}:null;}})[_0xd495('0x36')](respondWithResult(_0x30c6d4,null))['catch'](handleError(_0x30c6d4,null));};exports['notify']=function(_0x2b7e8d,_0x4fecaf,_0x1a6247){var _0x32bf52={'channel':_0xd495('0x82')};var _0x5ad2d2=[];var _0x188012=[];var _0x9c560c={};return db[_0xd495('0x3f')][_0xd495('0x5d')]({'where':{'id':_0x2b7e8d[_0xd495('0x56')]['id']},'include':[{'model':db[_0xd495('0x7c')],'as':_0xd495('0x83')}]})[_0xd495('0x36')](handleEntityNotFound(_0x4fecaf,null))[_0xd495('0x36')](function(_0x38ef55){_0x32bf52['account']=_0x38ef55;if(_0x32bf52[_0xd495('0x84')]&&_0x32bf52[_0xd495('0x84')][_0xd495('0x42')]==='sinch'&&_0x2b7e8d['body']['statuses']){if(_0x2b7e8d[_0xd495('0x61')]['statuses'][_0xd495('0x49')]===0x0)return;if(_0x2b7e8d[_0xd495('0x61')][_0xd495('0x85')][0x0][_0xd495('0x86')]!==_0xd495('0x87'))return;return db[_0xd495('0x88')]['update']({'read':!![],'readAt':_0x2b7e8d['body'][_0xd495('0x85')][0x0][_0xd495('0x89')]},{'where':{'messageId':_0x2b7e8d[_0xd495('0x61')]['statuses'][0x0][_0xd495('0x8a')]},'individualHooks':!![]})[_0xd495('0x36')](function(_0x2eee23){return _0x4fecaf[_0xd495('0x2b')](0xc8)[_0xd495('0x8b')](_0x2eee23);});}_0x32bf52[_0xd495('0x8c')]=_[_0xd495('0x8d')](_0x38ef55[_0xd495('0x83')],[_0xd495('0x7f')],['asc']);if(_0x32bf52[_0xd495('0x84')][_0xd495('0x83')]){delete _0x32bf52[_0xd495('0x84')][_0xd495('0x83')];}return db[_0xd495('0x8e')][_0xd495('0x62')]()[_0xd495('0x36')](function(_0x75ee42){if(!_0x75ee42){throw new db[(_0xd495('0x8f'))]['ValidationError'](_0xd495('0x90'));}_0x5ad2d2=_[_0xd495('0x91')](_['keys'](_0x75ee42),[_0xd495('0x92'),_0xd495('0x93')]);_0x188012=_['difference'](_[_0xd495('0x58')](_0x75ee42),[_0xd495('0x92'),_0xd495('0x93'),'CompanyId',_0xd495('0x94')]);_0x32bf52[_0xd495('0x61')]={'mapKey':'mobile'};if(_0x32bf52[_0xd495('0x84')]&&_0x32bf52['account']['type']===_0xd495('0x95')){_0x32bf52[_0xd495('0x61')]['from']=_0x2b7e8d['body']['From'][_0xd495('0x96')](_0xd495('0x97'),'');_0x32bf52['body']['body']=_0x2b7e8d[_0xd495('0x61')][_0xd495('0x98')];_0x32bf52[_0xd495('0x61')][_0xd495('0x99')]=_0x2b7e8d[_0xd495('0x61')][_0xd495('0x9a')];}if(_0x32bf52[_0xd495('0x84')]&&_0x32bf52[_0xd495('0x84')][_0xd495('0x42')]===_0xd495('0x9b')){_0x32bf52[_0xd495('0x61')][_0xd495('0x9c')]=_0x2b7e8d[_0xd495('0x61')]['notifications'][0x0][_0xd495('0x9c')];_0x32bf52['body'][_0xd495('0x61')]=_0x2b7e8d[_0xd495('0x61')]['notifications'][0x0][_0xd495('0x27')][_0xd495('0x61')];_0x32bf52['body'][_0xd495('0x99')]=_0x2b7e8d['body'][_0xd495('0x9d')][0x0][_0xd495('0x8a')];}if(_0x32bf52[_0xd495('0x61')]['id']){delete _0x32bf52[_0xd495('0x61')]['id'];}if(_['isNil'](_0x32bf52[_0xd495('0x61')]['from'])){throw new db[(_0xd495('0x8f'))][(_0xd495('0x9e'))]('from\x20is\x20mandatory');}if(_[_0xd495('0x9f')](_0x32bf52['body'][_0xd495('0x61')])||_0x32bf52[_0xd495('0x61')]['body']===''){throw new db[(_0xd495('0x8f'))]['ValidationError'](_0xd495('0xa0'));}if(_[_0xd495('0x9f')](_0x32bf52[_0xd495('0x61')][_0xd495('0xa1')])){throw new db[(_0xd495('0x8f'))][(_0xd495('0x9e'))](_0xd495('0xa2')+_0x188012);}if(!_[_0xd495('0xa3')](_0x188012,_0x32bf52[_0xd495('0x61')][_0xd495('0xa1')])){throw new db[(_0xd495('0x8f'))]['ValidationError'](_0xd495('0xa4')+_0x188012);}_0x9c560c[_0x32bf52[_0xd495('0x61')][_0xd495('0xa1')]]=_0x32bf52['body'][_0xd495('0x9c')];return db[_0xd495('0xa5')][_0xd495('0x5d')]({'where':{'id':_0x32bf52['account'][_0xd495('0x94')]},'include':[{'model':db[_0xd495('0x8e')],'as':_0xd495('0xa6'),'where':_0x9c560c,'limit':0x1,'order':[['updatedAt',_0xd495('0xa7')]]}]});})[_0xd495('0x36')](handleEntityNotFound(_0x4fecaf,null))[_0xd495('0x36')](function(_0x5a494e){if(_0x5a494e){_0x32bf52[_0xd495('0xa8')]=_['omit'](_0x5a494e,[_0xd495('0xa6')]);if(_0x5a494e[_0xd495('0xa6')][_0xd495('0x49')]){return _0x5a494e[_0xd495('0xa6')][0x0];}var _0xf635eb=_[_0xd495('0x19')](_0x32bf52[_0xd495('0x61')],{'firstName':_0x32bf52[_0xd495('0x61')][_0xd495('0x9c')],'ListId':_0x5a494e['id']});_0xf635eb[_0x32bf52['body'][_0xd495('0xa1')]]=_0x32bf52['body']['from'];return db[_0xd495('0x8e')][_0xd495('0x59')](_0xf635eb,{'fields':_0x5ad2d2,'raw':!![]});}})[_0xd495('0x36')](handleEntityNotFound(_0x4fecaf,null))[_0xd495('0x36')](function(_0x549c97){if(_0x549c97){_0x32bf52[_0xd495('0xa9')]=_0x549c97;var _0x422db1={'ContactId':_0x549c97['id'],'phone':_0x32bf52[_0xd495('0x61')][_0xd495('0x9c')],'WhatsappAccountId':_0x2b7e8d[_0xd495('0x56')]['id']};var _0x5448e3={'ContactId':_0x549c97['id'],'WhatsappAccountId':_0x2b7e8d[_0xd495('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xd495('0x5d')]({'where':_0x5448e3})[_0xd495('0x36')](function(_0x555e35){if(_0x555e35){return[_0x555e35,![]];}return db[_0xd495('0xaa')]['create'](_0x422db1)[_0xd495('0x36')](function(_0x1a7c34){return[_0x1a7c34,!![]];});});}})[_0xd495('0x70')](function(_0x200694,_0x3ddf7f){_0x32bf52[_0xd495('0xab')]=_0x200694[_0xd495('0x37')]({'plain':!![]});_0x32bf52[_0xd495('0xab')][_0xd495('0xac')]=![];if(_0x3ddf7f){if(_0x32bf52[_0xd495('0x84')][_0xd495('0xad')]){_0x32bf52['applications'][_0xd495('0xae')]({'id':0x0,'priority':_0x32bf52[_0xd495('0x8c')][_0xd495('0x49')]+0x1,'app':_0xd495('0xaf'),'appdata':_0xd495('0xb0'),'interval':_0xd495('0xb1')});}_0x32bf52[_0xd495('0xab')][_0xd495('0xac')]=!![];}return db['WhatsappMessage'][_0xd495('0x59')]({'phone':_0x32bf52['body'][_0xd495('0x9c')],'messageId':_0x32bf52[_0xd495('0x61')][_0xd495('0x99')],'body':_0x32bf52['body'][_0xd495('0x61')],'WhatsappAccountId':_0x2b7e8d[_0xd495('0x56')]['id'],'WhatsappInteractionId':_0x200694['id'],'direction':'in','ContactId':_0x200694[_0xd495('0xb2')],'AttachmentId':_0x32bf52[_0xd495('0x61')][_0xd495('0xb3')]});})['then'](function(_0x52d4de){_0x32bf52[_0xd495('0x27')]=_0x52d4de;if(_0x32bf52[_0xd495('0xab')][_0xd495('0xb4')]){return db[_0xd495('0x76')][_0xd495('0x5d')]({'attributes':['id',_0xd495('0x3a')],'where':{'id':_0x32bf52[_0xd495('0xab')]['UserId']}})[_0xd495('0x36')](function(_0x228ea0){if(_0x228ea0){_0x32bf52[_0xd495('0x8c')][_0xd495('0xb5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x228ea0[_0xd495('0x3a')]+','+(_0x32bf52[_0xd495('0x84')][_0xd495('0xb6')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd495('0xb7'),_0xd495('0xb8'),_0x32bf52);});}return respondWithRpcPromise(_0xd495('0xb7'),'startRouting',_0x32bf52);})[_0xd495('0x36')](function(_0x8a6965){if(_0x8a6965){var _0x1c12f4=0xc8;var _0x501a1c='receiveMessage';logger[_0xd495('0x21')](_0xd495('0xb9'),_0x501a1c,_0x1c12f4,_0xd495('0xba'));logger[_0xd495('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x501a1c,_0x1c12f4,'entity\x20found',JSON[_0xd495('0xbb')](_0x8a6965));if(_0x32bf52[_0xd495('0x84')][_0xd495('0x42')]===_0xd495('0x95')){return _0x4fecaf[_0xd495('0x2b')](_0x1c12f4)[_0xd495('0x2f')](_0xd495('0xbc'),_0xd495('0xbd'))[_0xd495('0x3b')](_0xd495('0xbe'));}else{return _0x4fecaf[_0xd495('0x2b')](_0x1c12f4)[_0xd495('0x8b')](_0x8a6965);}}});})[_0xd495('0x28')](handleError(_0x4fecaf,null));};exports[_0xd495('0x3b')]=function(_0x7cb37f,_0x3d4c27,_0x4503ee){var _0x3827c4,_0x7303a3,_0x3f24a1;if(_['isNil'](_0x7cb37f[_0xd495('0x61')][_0xd495('0x61')])||_0x7cb37f[_0xd495('0x61')][_0xd495('0x61')]===''){throw new db[(_0xd495('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x7cb37f[_0xd495('0x61')]['to'])){throw new db[(_0xd495('0x8f'))][(_0xd495('0x9e'))](_0xd495('0xbf'));}_0x3827c4=_0x7cb37f['body']['to'];return db[_0xd495('0x3f')]['find']({'where':{'id':_0x7cb37f[_0xd495('0x56')]['id']},'include':[{'model':db[_0xd495('0xa5')],'as':'List','include':[{'model':db[_0xd495('0x8e')],'as':_0xd495('0xa6'),'where':{'mobile':_0x3827c4},'limit':0x1,'order':[[_0xd495('0x93'),'DESC']]}]}]})[_0xd495('0x36')](handleEntityNotFound(_0x3d4c27,null))[_0xd495('0x36')](function(_0x425446){if(_0x425446&&_0x425446[_0xd495('0xc0')]){_0x7303a3=_0x425446[_0xd495('0x37')]({'plain':!![]});if(_0x7303a3['List']&&_0x7303a3[_0xd495('0xc0')][_0xd495('0xa6')][_0xd495('0x49')]){return _0x7303a3['List'][_0xd495('0xa6')][0x0];}return db[_0xd495('0x8e')][_0xd495('0x59')](_[_0xd495('0x19')](_0x7cb37f['body'],{'firstName':_0x3827c4,'mobile':_0x3827c4,'phone':_0x3827c4,'ListId':_0x7303a3['ListId']}));}})[_0xd495('0x36')](handleEntityNotFound(_0x3d4c27,null))[_0xd495('0x36')](function(_0x22a25f){if(_0x22a25f){_0x3f24a1=_0x22a25f;return db[_0xd495('0xaa')][_0xd495('0x5d')]({'where':{'ContactId':_0x3f24a1['id'],'closed':![],'WhatsappAccountId':_0x7303a3['id']}})[_0xd495('0x36')](function(_0x1d3bdf){if(_0x1d3bdf){return[_0x1d3bdf,![]];}return db[_0xd495('0xaa')][_0xd495('0x59')]({'UserId':_0x7cb37f[_0xd495('0x5a')]['id'],'ContactId':_0x3f24a1['id'],'WhatsappAccountId':_0x7303a3['id'],'phone':_0x3827c4,'firstMsgDirection':'out','Messages':[_['merge'](_0x7cb37f[_0xd495('0x61')],{'read':![],'body':_0x7cb37f[_0xd495('0x61')][_0xd495('0x61')],'phone':_0x3827c4,'WhatsappAccountId':_0x7303a3['id'],'UserId':_0x7cb37f[_0xd495('0x5a')]['id'],'ContactId':_0x3f24a1['id']})]},{'include':[{'model':db[_0xd495('0x88')],'as':_0xd495('0xc1')}]})[_0xd495('0x36')](function(_0x30b0a5){return[_0x30b0a5,!![]];});});}})[_0xd495('0x70')](function(_0x24db79,_0x418b87){if(_0x418b87){return _0x24db79;}return db['WhatsappMessage'][_0xd495('0x59')](_[_0xd495('0x50')](_0x7cb37f['body'],{'read':![],'body':_0x7cb37f[_0xd495('0x61')][_0xd495('0x61')],'phone':_0x3827c4,'WhatsappAccountId':_0x7303a3['id'],'WhatsappInteractionId':_0x24db79['id'],'UserId':_0x7cb37f[_0xd495('0x5a')]['id'],'ContactId':_0x3f24a1['id']}))[_0xd495('0x36')](function(_0xc7bad8){_0x24db79[_0xd495('0xc2')][_0xd495('0xc1')]=[];_0x24db79[_0xd495('0xc2')]['Messages'][_0xd495('0xae')](_0xc7bad8[_0xd495('0xc2')]);return _0x24db79;});})[_0xd495('0x36')](respondWithResult(_0x3d4c27,null))[_0xd495('0x28')](handleError(_0x3d4c27,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 64b3a22..0b36d88 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 _0x7f89=['hasOwnProperty','hook','exports','../../mysqldb','save','remove','emit'];(function(_0x1982e4,_0x2797a7){var _0xa15a46=function(_0x1cbbde){while(--_0x1cbbde){_0x1982e4['push'](_0x1982e4['shift']());}};_0xa15a46(++_0x2797a7);}(_0x7f89,0x65));var _0x97f8=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x7f89[_0xdd82b4];return _0x549bb2;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x97f8('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x97f8('0x1'),'afterUpdate':'update','afterDestroy':_0x97f8('0x2')};function emitEvent(_0x16d6ac){return function(_0x58b826,_0x5af951,_0x4fd39b){WhatsappAccountEvents[_0x97f8('0x3')](_0x16d6ac+':'+_0x58b826['id'],_0x58b826);WhatsappAccountEvents[_0x97f8('0x3')](_0x16d6ac,_0x58b826);_0x4fd39b(null);};}for(var e in events){if(events[_0x97f8('0x4')](e)){var event=events[e];WhatsappAccount[_0x97f8('0x5')](e,emitEvent(event));}}module[_0x97f8('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5b51=['events','../../mysqldb','WhatsappAccount','save','remove','emit','hook','exports'];(function(_0x431967,_0x56f33b){var _0x1fd0c4=function(_0x2d3377){while(--_0x2d3377){_0x431967['push'](_0x431967['shift']());}};_0x1fd0c4(++_0x56f33b);}(_0x5b51,0x1a0));var _0x15b5=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x5b51[_0x1b349a];return _0x5d1f7c;};'use strict';var EventEmitter=require(_0x15b5('0x0'));var WhatsappAccount=require(_0x15b5('0x1'))['db'][_0x15b5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x15b5('0x3'),'afterUpdate':'update','afterDestroy':_0x15b5('0x4')};function emitEvent(_0x540e49){return function(_0x124bd4,_0x35cb80,_0x288556){WhatsappAccountEvents[_0x15b5('0x5')](_0x540e49+':'+_0x124bd4['id'],_0x124bd4);WhatsappAccountEvents[_0x15b5('0x5')](_0x540e49,_0x124bd4);_0x288556(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x15b5('0x6')](e,emitEvent(event));}}module[_0x15b5('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f7718d3..8812f75 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 _0xc3e5=['define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x24fe8e,_0x3fa991){var _0xe063e8=function(_0x4b6c33){while(--_0x4b6c33){_0x24fe8e['push'](_0x24fe8e['shift']());}};_0xe063e8(++_0x3fa991);}(_0xc3e5,0x107));var _0x5c3e=function(_0x216a68,_0x243550){_0x216a68=_0x216a68-0x0;var _0x25f497=_0xc3e5[_0x216a68];return _0x25f497;};'use strict';var _=require(_0x5c3e('0x0'));var util=require(_0x5c3e('0x1'));var logger=require('../../config/logger')(_0x5c3e('0x2'));var moment=require(_0x5c3e('0x3'));var BPromise=require(_0x5c3e('0x4'));var rp=require(_0x5c3e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c3e('0x6'));var config=require(_0x5c3e('0x7'));var attributes=require(_0x5c3e('0x8'));module[_0x5c3e('0x9')]=function(_0x140ac0,_0x2da684){return _0x140ac0[_0x5c3e('0xa')](_0x5c3e('0xb'),attributes,{'tableName':_0x5c3e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x502e=['path','../../config/environment','./whatsappAccount.attributes','whatsapp_accounts','lodash','util','api','moment','bluebird'];(function(_0x17aa78,_0x1ca1ef){var _0x4e0514=function(_0x37340c){while(--_0x37340c){_0x17aa78['push'](_0x17aa78['shift']());}};_0x4e0514(++_0x1ca1ef);}(_0x502e,0x1d8));var _0xe502=function(_0x35754c,_0xd99880){_0x35754c=_0x35754c-0x0;var _0x545a6b=_0x502e[_0x35754c];return _0x545a6b;};'use strict';var _=require(_0xe502('0x0'));var util=require(_0xe502('0x1'));var logger=require('../../config/logger')(_0xe502('0x2'));var moment=require(_0xe502('0x3'));var BPromise=require(_0xe502('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe502('0x5'));var rimraf=require('rimraf');var config=require(_0xe502('0x6'));var attributes=require(_0xe502('0x7'));module['exports']=function(_0x5342a3,_0x21cb51){return _0x5342a3['define']('WhatsappAccount',attributes,{'tableName':_0xe502('0x8'),'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 59d39f3..5448ec0 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 _0x2f2d=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','ShowWhatsappAccount','options','raw','where','include','map','attributes','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x28431f,_0x51a5d1){var _0x174ede=function(_0x21d33b){while(--_0x21d33b){_0x28431f['push'](_0x28431f['shift']());}};_0x174ede(++_0x51a5d1);}(_0x2f2d,0x17f));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd2f2('0x0'));var moment=require(_0xd2f2('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2f2('0x2'));var fs=require('fs');var Redis=require(_0xd2f2('0x3'));var db=require(_0xd2f2('0x4'))['db'];var utils=require(_0xd2f2('0x5'));var logger=require('../../config/logger')(_0xd2f2('0x6'));var config=require('../../config/environment');var jayson=require(_0xd2f2('0x7'));var client=jayson[_0xd2f2('0x8')][_0xd2f2('0x9')]({'port':0x232a});config[_0xd2f2('0xa')]=_[_0xd2f2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd2f2('0xc'))(new Redis(config[_0xd2f2('0xa')]));require(_0xd2f2('0xd'))[_0xd2f2('0xe')](socket);function respondWithRpcPromise(_0x5997bb,_0x363886,_0x357026){return new BPromise(function(_0x19413d,_0x1fca2f){return client['request'](_0x5997bb,_0x357026)['then'](function(_0x1056cd){logger[_0xd2f2('0xf')](_0xd2f2('0x10'),_0x363886,_0xd2f2('0x11'));logger[_0xd2f2('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x363886,_0xd2f2('0x11'),JSON['stringify'](_0x1056cd));if(_0x1056cd[_0xd2f2('0x13')]){if(_0x1056cd[_0xd2f2('0x13')]['code']===0x1f4){logger[_0xd2f2('0x13')](_0xd2f2('0x10'),_0x363886,_0x1056cd[_0xd2f2('0x13')][_0xd2f2('0x14')]);return _0x1fca2f(_0x1056cd[_0xd2f2('0x13')][_0xd2f2('0x14')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x363886,_0x1056cd[_0xd2f2('0x13')][_0xd2f2('0x14')]);return _0x19413d(_0x1056cd['error'][_0xd2f2('0x14')]);}else{logger[_0xd2f2('0xf')](_0xd2f2('0x10'),_0x363886,_0xd2f2('0x11'));_0x19413d(_0x1056cd['result'][_0xd2f2('0x14')]);}})[_0xd2f2('0x15')](function(_0x38c677){logger[_0xd2f2('0x13')](_0xd2f2('0x10'),_0x363886,_0x38c677);_0x1fca2f(_0x38c677);});});}exports[_0xd2f2('0x16')]=function(_0x3296fe){var _0x13000c=this;return new Promise(function(_0x2df5ca,_0x15bd02){return db['WhatsappAccount']['find']({'raw':_0x3296fe[_0xd2f2('0x17')]?_0x3296fe['options'][_0xd2f2('0x18')]===undefined?!![]:![]:!![],'where':_0x3296fe[_0xd2f2('0x17')]?_0x3296fe[_0xd2f2('0x17')][_0xd2f2('0x19')]||null:null,'attributes':_0x3296fe[_0xd2f2('0x17')]?_0x3296fe[_0xd2f2('0x17')]['attributes']||null:null,'include':_0x3296fe[_0xd2f2('0x17')]?_0x3296fe[_0xd2f2('0x17')][_0xd2f2('0x1a')]?_[_0xd2f2('0x1b')](_0x3296fe[_0xd2f2('0x17')][_0xd2f2('0x1a')],function(_0x1ff8fb){return{'model':db[_0x1ff8fb['model']],'as':_0x1ff8fb['as'],'attributes':_0x1ff8fb[_0xd2f2('0x1c')],'include':_0x1ff8fb[_0xd2f2('0x1a')]?_[_0xd2f2('0x1b')](_0x1ff8fb[_0xd2f2('0x1a')],function(_0x58e36c){return{'model':db[_0x58e36c['model']],'as':_0x58e36c['as'],'attributes':_0x58e36c[_0xd2f2('0x1c')],'include':_0x58e36c[_0xd2f2('0x1a')]?_[_0xd2f2('0x1b')](_0x58e36c[_0xd2f2('0x1a')],function(_0x8794c0){return{'model':db[_0x8794c0['model']],'as':_0x8794c0['as'],'attributes':_0x8794c0[_0xd2f2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd2f2('0x1d')](function(_0x594223){logger[_0xd2f2('0xf')](_0xd2f2('0x16'),_0x3296fe);logger[_0xd2f2('0x12')](_0xd2f2('0x16'),_0x3296fe,JSON['stringify'](_0x594223));_0x2df5ca(_0x594223);})[_0xd2f2('0x15')](function(_0x455454){logger[_0xd2f2('0x13')](_0xd2f2('0x16'),_0x455454[_0xd2f2('0x14')],_0x3296fe);_0x15bd02(_0x13000c['error'](0x1f4,_0x455454[_0xd2f2('0x14')]));});});}; \ No newline at end of file +var _0xc273=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','lodash'];(function(_0x36767f,_0x13f876){var _0x549f62=function(_0x5304c8){while(--_0x5304c8){_0x36767f['push'](_0x36767f['shift']());}};_0x549f62(++_0x13f876);}(_0xc273,0x137));var _0x3c27=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0xc273[_0x15d18f];return _0xd12bf7;};'use strict';var _=require(_0x3c27('0x0'));var util=require(_0x3c27('0x1'));var moment=require(_0x3c27('0x2'));var BPromise=require(_0x3c27('0x3'));var rs=require(_0x3c27('0x4'));var fs=require('fs');var Redis=require(_0x3c27('0x5'));var db=require(_0x3c27('0x6'))['db'];var utils=require(_0x3c27('0x7'));var logger=require(_0x3c27('0x8'))(_0x3c27('0x9'));var config=require('../../config/environment');var jayson=require(_0x3c27('0xa'));var client=jayson[_0x3c27('0xb')]['http']({'port':0x232a});config[_0x3c27('0xc')]=_[_0x3c27('0xd')](config[_0x3c27('0xc')],{'host':_0x3c27('0xe'),'port':0x18eb});var socket=require(_0x3c27('0xf'))(new Redis(config[_0x3c27('0xc')]));require(_0x3c27('0x10'))[_0x3c27('0x11')](socket);function respondWithRpcPromise(_0x202139,_0x5d98d7,_0x565b94){return new BPromise(function(_0x15ec2b,_0x338068){return client[_0x3c27('0x12')](_0x202139,_0x565b94)[_0x3c27('0x13')](function(_0x58fc90){logger[_0x3c27('0x14')](_0x3c27('0x15'),_0x5d98d7,'request\x20sent');logger[_0x3c27('0x16')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5d98d7,'request\x20sent',JSON[_0x3c27('0x17')](_0x58fc90));if(_0x58fc90['error']){if(_0x58fc90['error'][_0x3c27('0x18')]===0x1f4){logger[_0x3c27('0x19')](_0x3c27('0x15'),_0x5d98d7,_0x58fc90[_0x3c27('0x19')]['message']);return _0x338068(_0x58fc90[_0x3c27('0x19')][_0x3c27('0x1a')]);}logger[_0x3c27('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x5d98d7,_0x58fc90[_0x3c27('0x19')][_0x3c27('0x1a')]);return _0x15ec2b(_0x58fc90[_0x3c27('0x19')]['message']);}else{logger['info'](_0x3c27('0x15'),_0x5d98d7,_0x3c27('0x1b'));_0x15ec2b(_0x58fc90[_0x3c27('0x1c')][_0x3c27('0x1a')]);}})[_0x3c27('0x1d')](function(_0x4c2370){logger[_0x3c27('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x5d98d7,_0x4c2370);_0x338068(_0x4c2370);});});}exports[_0x3c27('0x1e')]=function(_0x472504){var _0x4d9eae=this;return new Promise(function(_0x1eb579,_0x2d0d9a){return db[_0x3c27('0x1f')][_0x3c27('0x20')]({'raw':_0x472504[_0x3c27('0x21')]?_0x472504['options']['raw']===undefined?!![]:![]:!![],'where':_0x472504['options']?_0x472504[_0x3c27('0x21')][_0x3c27('0x22')]||null:null,'attributes':_0x472504[_0x3c27('0x21')]?_0x472504[_0x3c27('0x21')][_0x3c27('0x23')]||null:null,'include':_0x472504['options']?_0x472504[_0x3c27('0x21')][_0x3c27('0x24')]?_[_0x3c27('0x25')](_0x472504['options']['include'],function(_0x2b365b){return{'model':db[_0x2b365b['model']],'as':_0x2b365b['as'],'attributes':_0x2b365b['attributes'],'include':_0x2b365b[_0x3c27('0x24')]?_[_0x3c27('0x25')](_0x2b365b[_0x3c27('0x24')],function(_0x3291c1){return{'model':db[_0x3291c1[_0x3c27('0x26')]],'as':_0x3291c1['as'],'attributes':_0x3291c1[_0x3c27('0x23')],'include':_0x3291c1['include']?_['map'](_0x3291c1[_0x3c27('0x24')],function(_0x61b896){return{'model':db[_0x61b896[_0x3c27('0x26')]],'as':_0x61b896['as'],'attributes':_0x61b896[_0x3c27('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3c27('0x13')](function(_0x27eb8f){logger[_0x3c27('0x14')](_0x3c27('0x1e'),_0x472504);logger[_0x3c27('0x16')](_0x3c27('0x1e'),_0x472504,JSON[_0x3c27('0x17')](_0x27eb8f));_0x1eb579(_0x27eb8f);})[_0x3c27('0x1d')](function(_0x2f04e9){logger['error'](_0x3c27('0x1e'),_0x2f04e9[_0x3c27('0x1a')],_0x472504);_0x2d0d9a(_0x4d9eae[_0x3c27('0x19')](0x1f4,_0x2f04e9[_0x3c27('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 05c3498..1d32d1c 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 _0xac94=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','length'];(function(_0x1bc7c5,_0x4af257){var _0x67dfc9=function(_0x1d3eb7){while(--_0x1d3eb7){_0x1bc7c5['push'](_0x1bc7c5['shift']());}};_0x67dfc9(++_0x4af257);}(_0xac94,0xc1));var _0x4ac9=function(_0x633f5f,_0xc497c8){_0x633f5f=_0x633f5f-0x0;var _0x50edd7=_0xac94[_0x633f5f];return _0x50edd7;};'use strict';var WhatsappAccountEvents=require(_0x4ac9('0x0'));var events=[_0x4ac9('0x1'),_0x4ac9('0x2'),'update'];function createListener(_0x117fd4,_0x28d973){return function(_0x42c272){_0x28d973[_0x4ac9('0x3')](_0x117fd4,_0x42c272);};}function removeListener(_0x1db436,_0x1cdd95){return function(){WhatsappAccountEvents['removeListener'](_0x1db436,_0x1cdd95);};}exports['register']=function(_0x363654){for(var _0x5217b8=0x0,_0x4a46b2=events[_0x4ac9('0x4')];_0x5217b8<_0x4a46b2;_0x5217b8++){var _0x3630dc=events[_0x5217b8];var _0x5dda5d=createListener(_0x4ac9('0x5')+_0x3630dc,_0x363654);WhatsappAccountEvents['on'](_0x3630dc,_0x5dda5d);}}; \ No newline at end of file +var _0x7bc5=['./whatsappAccount.events','save','removeListener','register','whatsappAccount:'];(function(_0x25f797,_0x449916){var _0x157fdd=function(_0x329fe1){while(--_0x329fe1){_0x25f797['push'](_0x25f797['shift']());}};_0x157fdd(++_0x449916);}(_0x7bc5,0x131));var _0x57bc=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x7bc5[_0x3d78d7];return _0x4b6784;};'use strict';var WhatsappAccountEvents=require(_0x57bc('0x0'));var events=[_0x57bc('0x1'),'remove','update'];function createListener(_0xbb76d5,_0x2d0f6c){return function(_0x3f1103){_0x2d0f6c['emit'](_0xbb76d5,_0x3f1103);};}function removeListener(_0x2fa0dc,_0x2d0cf0){return function(){WhatsappAccountEvents[_0x57bc('0x2')](_0x2fa0dc,_0x2d0cf0);};}exports[_0x57bc('0x3')]=function(_0xd08803){for(var _0x4755b9=0x0,_0x14bc1d=events['length'];_0x4755b9<_0x14bc1d;_0x4755b9++){var _0x45a33c=events[_0x4755b9];var _0x5ce999=createListener(_0x57bc('0x4')+_0x45a33c,_0xd08803);WhatsappAccountEvents['on'](_0x45a33c,_0x5ce999);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 22681ec..4fce488 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 _0xcb52=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xcb52,0x155));var _0x2cb5=function(_0x44a4ea,_0x2a62ca){_0x44a4ea=_0x44a4ea-0x0;var _0x4efa28=_0xcb52[_0x44a4ea];return _0x4efa28;};'use strict';var multer=require(_0x2cb5('0x0'));var util=require(_0x2cb5('0x1'));var path=require(_0x2cb5('0x2'));var timeout=require(_0x2cb5('0x3'));var express=require(_0x2cb5('0x4'));var router=express[_0x2cb5('0x5')]();var fs_extra=require(_0x2cb5('0x6'));var auth=require(_0x2cb5('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x2cb5('0x8')]('/',auth[_0x2cb5('0x9')](),controller[_0x2cb5('0xa')]);router['get'](_0x2cb5('0xb'),auth['isAuthenticated'](),controller[_0x2cb5('0xc')]);router[_0x2cb5('0xd')]('/',auth[_0x2cb5('0x9')](),controller[_0x2cb5('0xe')]);router[_0x2cb5('0xf')](_0x2cb5('0xb'),auth[_0x2cb5('0x9')](),controller[_0x2cb5('0x10')]);router[_0x2cb5('0x11')](_0x2cb5('0xb'),auth[_0x2cb5('0x9')](),controller['destroy']);module[_0x2cb5('0x12')]=router; \ No newline at end of file +var _0x302a=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1c9dc8,_0x4a6a9e){var _0x3f5394=function(_0x458e34){while(--_0x458e34){_0x1c9dc8['push'](_0x1c9dc8['shift']());}};_0x3f5394(++_0x4a6a9e);}(_0x302a,0x1d2));var _0xa302=function(_0x541bcf,_0x4a5771){_0x541bcf=_0x541bcf-0x0;var _0x1323cd=_0x302a[_0x541bcf];return _0x1323cd;};'use strict';var multer=require(_0xa302('0x0'));var util=require(_0xa302('0x1'));var path=require(_0xa302('0x2'));var timeout=require(_0xa302('0x3'));var express=require('express');var router=express[_0xa302('0x4')]();var fs_extra=require(_0xa302('0x5'));var auth=require(_0xa302('0x6'));var interaction=require(_0xa302('0x7'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0xa302('0x8')]('/',auth[_0xa302('0x9')](),controller[_0xa302('0xa')]);router[_0xa302('0x8')](_0xa302('0xb'),auth[_0xa302('0x9')](),controller[_0xa302('0xc')]);router[_0xa302('0xd')]('/',auth[_0xa302('0x9')](),controller[_0xa302('0xe')]);router[_0xa302('0xf')](_0xa302('0xb'),auth[_0xa302('0x9')](),controller['update']);router[_0xa302('0x10')](_0xa302('0xb'),auth[_0xa302('0x9')](),controller[_0xa302('0x11')]);module[_0xa302('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 4e06db4..c7f2144 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 _0xc10c=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x45289c,_0x16660c){var _0x1e2862=function(_0x2bd339){while(--_0x2bd339){_0x45289c['push'](_0x45289c['shift']());}};_0x1e2862(++_0x16660c);}(_0xc10c,0x10d));var _0xcc10=function(_0x491091,_0x5220bd){_0x491091=_0x491091-0x0;var _0x37eb35=_0xc10c[_0x491091];return _0x37eb35;};'use strict';var Sequelize=require(_0xcc10('0x0'));module[_0xcc10('0x1')]={'priority':{'type':Sequelize[_0xcc10('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcc10('0x3')],'allowNull':![],'defaultValue':_0xcc10('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcc10('0x3')],'defaultValue':_0xcc10('0x5')}}; \ No newline at end of file +var _0x6e9c=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x5d7ce2,_0x180253){var _0x358146=function(_0x1b33f9){while(--_0x1b33f9){_0x5d7ce2['push'](_0x5d7ce2['shift']());}};_0x358146(++_0x180253);}(_0x6e9c,0x153));var _0xc6e9=function(_0x5fb7d9,_0x2c8d97){_0x5fb7d9=_0x5fb7d9-0x0;var _0x116d04=_0x6e9c[_0x5fb7d9];return _0x116d04;};'use strict';var Sequelize=require(_0xc6e9('0x0'));module[_0xc6e9('0x1')]={'priority':{'type':Sequelize[_0xc6e9('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc6e9('0x3')},'appdata':{'type':Sequelize[_0xc6e9('0x4')]()},'description':{'type':Sequelize[_0xc6e9('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc6e9('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a8cba9d..049c06b 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 _0x27fb=['map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','stack','name','index','WhatsappApplication','rawAttributes','fieldName','key','model'];(function(_0x1c408b,_0x397525){var _0x154560=function(_0x54208e){while(--_0x54208e){_0x1c408b['push'](_0x1c408b['shift']());}};_0x154560(++_0x397525);}(_0x27fb,0x1de));var _0xb27f=function(_0x14e5c2,_0x5766dd){_0x14e5c2=_0x14e5c2-0x0;var _0x4f6d55=_0x27fb[_0x14e5c2];return _0x4f6d55;};'use strict';var emlformat=require(_0xb27f('0x0'));var rimraf=require(_0xb27f('0x1'));var zipdir=require(_0xb27f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb27f('0x3'));var moment=require('moment');var BPromise=require(_0xb27f('0x4'));var Mustache=require(_0xb27f('0x5'));var util=require(_0xb27f('0x6'));var path=require('path');var sox=require(_0xb27f('0x7'));var csv=require('to-csv');var ejs=require(_0xb27f('0x8'));var fs=require('fs');var fs_extra=require(_0xb27f('0x9'));var _=require(_0xb27f('0xa'));var squel=require(_0xb27f('0xb'));var crypto=require(_0xb27f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb27f('0xd'));var toCsv=require(_0xb27f('0xe'));var querystring=require('querystring');var Papa=require(_0xb27f('0xf'));var Redis=require(_0xb27f('0x10'));var authService=require(_0xb27f('0x11'));var qs=require(_0xb27f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb27f('0x13'));var logger=require(_0xb27f('0x14'))('api');var utils=require(_0xb27f('0x15'));var config=require(_0xb27f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb27f('0x17'))['db'];function respondWithStatusCode(_0x3c8e49,_0x3df902){_0x3df902=_0x3df902||0xcc;return function(_0x1971bb){if(_0x1971bb){return _0x3c8e49[_0xb27f('0x18')](_0x3df902);}return _0x3c8e49[_0xb27f('0x19')](_0x3df902)['end']();};}function respondWithResult(_0x434e15,_0x4c35a0){_0x4c35a0=_0x4c35a0||0xc8;return function(_0x1bc3b3){if(_0x1bc3b3){return _0x434e15['status'](_0x4c35a0)[_0xb27f('0x1a')](_0x1bc3b3);}};}function respondWithFilteredResult(_0x2c9fb9,_0x24dd7b){return function(_0x11155b){if(_0x11155b){var _0x33520b=typeof _0x24dd7b['offset']===_0xb27f('0x1b')&&typeof _0x24dd7b[_0xb27f('0x1c')]===_0xb27f('0x1b');var _0xfc4bd0=_0x11155b[_0xb27f('0x1d')];var _0xb126c6=_0x33520b?0x0:_0x24dd7b[_0xb27f('0x1e')];var _0x559cf4=_0x33520b?_0x11155b[_0xb27f('0x1d')]:_0x24dd7b[_0xb27f('0x1e')]+_0x24dd7b[_0xb27f('0x1c')];var _0x4b8be9;if(_0x559cf4>=_0xfc4bd0){_0x559cf4=_0xfc4bd0;_0x4b8be9=0xc8;}else{_0x4b8be9=0xce;}_0x2c9fb9[_0xb27f('0x19')](_0x4b8be9);return _0x2c9fb9[_0xb27f('0x1f')]('Content-Range',_0xb126c6+'-'+_0x559cf4+'/'+_0xfc4bd0)[_0xb27f('0x1a')](_0x11155b);}return null;};}function patchUpdates(_0x26090c){return function(_0x34b5ae){try{jsonpatch[_0xb27f('0x20')](_0x34b5ae,_0x26090c,!![]);}catch(_0x88a06d){return BPromise[_0xb27f('0x21')](_0x88a06d);}return _0x34b5ae[_0xb27f('0x22')]();};}function saveUpdates(_0x578c3d,_0x3a70c9){return function(_0x5303ac){if(_0x5303ac){return _0x5303ac[_0xb27f('0x23')](_0x578c3d)[_0xb27f('0x24')](function(_0x1e6abf){return _0x1e6abf;});}return null;};}function removeEntity(_0x56e3cd,_0xb68ac0){return function(_0x59b315){if(_0x59b315){return _0x59b315[_0xb27f('0x25')]()['then'](function(){_0x56e3cd['status'](0xcc)[_0xb27f('0x26')]();});}};}function handleEntityNotFound(_0x5b79c7,_0x41834b){return function(_0x20e85d){if(!_0x20e85d){_0x5b79c7['sendStatus'](0x194);}return _0x20e85d;};}function handleError(_0x915737,_0x3fd1a5){_0x3fd1a5=_0x3fd1a5||0x1f4;return function(_0x2bfae9){logger['error'](_0x2bfae9[_0xb27f('0x27')]);if(_0x2bfae9[_0xb27f('0x28')]){delete _0x2bfae9[_0xb27f('0x28')];}_0x915737[_0xb27f('0x19')](_0x3fd1a5)['send'](_0x2bfae9);};}exports[_0xb27f('0x29')]=function(_0x57cf52,_0xcf8c7a){var _0x443641={},_0x4ce30d={},_0x4caf5a={'count':0x0,'rows':[]};var _0x1adeec=_['map'](db[_0xb27f('0x2a')][_0xb27f('0x2b')],function(_0x13f2cc){return{'name':_0x13f2cc[_0xb27f('0x2c')],'type':_0x13f2cc['type'][_0xb27f('0x2d')]};});_0x4ce30d[_0xb27f('0x2e')]=_[_0xb27f('0x2f')](_0x1adeec,_0xb27f('0x28'));_0x4ce30d[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x57cf52[_0xb27f('0x30')]);_0x4ce30d[_0xb27f('0x32')]=_[_0xb27f('0x33')](_0x4ce30d[_0xb27f('0x2e')],_0x4ce30d[_0xb27f('0x30')]);_0x443641[_0xb27f('0x34')]=_[_0xb27f('0x33')](_0x4ce30d[_0xb27f('0x2e')],qs[_0xb27f('0x35')](_0x57cf52[_0xb27f('0x30')]['fields']));_0x443641['attributes']=_0x443641[_0xb27f('0x34')]['length']?_0x443641[_0xb27f('0x34')]:_0x4ce30d['model'];if(!_0x57cf52[_0xb27f('0x30')]['hasOwnProperty'](_0xb27f('0x36'))){_0x443641[_0xb27f('0x1c')]=qs[_0xb27f('0x1c')](_0x57cf52['query'][_0xb27f('0x1c')]);_0x443641[_0xb27f('0x1e')]=qs['offset'](_0x57cf52[_0xb27f('0x30')][_0xb27f('0x1e')]);}_0x443641[_0xb27f('0x37')]=qs[_0xb27f('0x38')](_0x57cf52[_0xb27f('0x30')]['sort']);_0x443641[_0xb27f('0x39')]=qs[_0xb27f('0x32')](_[_0xb27f('0x3a')](_0x57cf52[_0xb27f('0x30')],_0x4ce30d[_0xb27f('0x32')]),_0x1adeec);if(_0x57cf52['query'][_0xb27f('0x3b')]){_0x443641['where']=_[_0xb27f('0x3c')](_0x443641[_0xb27f('0x39')],{'$or':_[_0xb27f('0x2f')](_0x1adeec,function(_0x5a606f){if(_0x5a606f[_0xb27f('0x3d')]!==_0xb27f('0x3e')){var _0x4ab5de={};_0x4ab5de[_0x5a606f[_0xb27f('0x28')]]={'$like':'%'+_0x57cf52['query'][_0xb27f('0x3b')]+'%'};return _0x4ab5de;}})});}_0x443641=_['merge']({},_0x443641,_0x57cf52[_0xb27f('0x3f')]);var _0x47bd52={'where':_0x443641['where']};return db[_0xb27f('0x2a')][_0xb27f('0x1d')](_0x47bd52)[_0xb27f('0x24')](function(_0x2892a6){_0x4caf5a[_0xb27f('0x1d')]=_0x2892a6;if(_0x57cf52[_0xb27f('0x30')][_0xb27f('0x40')]){_0x443641[_0xb27f('0x41')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xb27f('0x42')](_0x443641);})[_0xb27f('0x24')](function(_0x3d6a2c){_0x4caf5a[_0xb27f('0x43')]=_0x3d6a2c;return _0x4caf5a;})[_0xb27f('0x24')](respondWithFilteredResult(_0xcf8c7a,_0x443641))[_0xb27f('0x44')](handleError(_0xcf8c7a,null));};exports[_0xb27f('0x45')]=function(_0x4823e8,_0x534826){var _0x31cbc2={'raw':!![],'where':{'id':_0x4823e8['params']['id']}},_0x5cd045={};_0x5cd045[_0xb27f('0x2e')]=_['keys'](db[_0xb27f('0x2a')]['rawAttributes']);_0x5cd045[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x4823e8[_0xb27f('0x30')]);_0x5cd045[_0xb27f('0x32')]=_[_0xb27f('0x33')](_0x5cd045[_0xb27f('0x2e')],_0x5cd045[_0xb27f('0x30')]);_0x31cbc2[_0xb27f('0x34')]=_[_0xb27f('0x33')](_0x5cd045[_0xb27f('0x2e')],qs[_0xb27f('0x35')](_0x4823e8[_0xb27f('0x30')][_0xb27f('0x35')]));_0x31cbc2[_0xb27f('0x34')]=_0x31cbc2[_0xb27f('0x34')][_0xb27f('0x46')]?_0x31cbc2['attributes']:_0x5cd045[_0xb27f('0x2e')];if(_0x4823e8['query'][_0xb27f('0x40')]){_0x31cbc2['include']=[{'all':!![]}];}_0x31cbc2=_['merge']({},_0x31cbc2,_0x4823e8[_0xb27f('0x3f')]);return db['WhatsappApplication'][_0xb27f('0x47')](_0x31cbc2)[_0xb27f('0x24')](handleEntityNotFound(_0x534826,null))[_0xb27f('0x24')](respondWithResult(_0x534826,null))[_0xb27f('0x44')](handleError(_0x534826,null));};exports['create']=function(_0x33ba5d,_0x56dc81){return db[_0xb27f('0x2a')][_0xb27f('0x48')](_0x33ba5d['body'],{})[_0xb27f('0x24')](respondWithResult(_0x56dc81,0xc9))[_0xb27f('0x44')](handleError(_0x56dc81,null));};exports['update']=function(_0xd9fc18,_0x2b0c77){if(_0xd9fc18[_0xb27f('0x49')]['id']){delete _0xd9fc18[_0xb27f('0x49')]['id'];}return db[_0xb27f('0x2a')][_0xb27f('0x47')]({'where':{'id':_0xd9fc18[_0xb27f('0x4a')]['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x2b0c77,null))['then'](saveUpdates(_0xd9fc18[_0xb27f('0x49')],null))[_0xb27f('0x24')](respondWithResult(_0x2b0c77,null))[_0xb27f('0x44')](handleError(_0x2b0c77,null));};exports[_0xb27f('0x25')]=function(_0x2867ff,_0x33d76f){return db[_0xb27f('0x2a')][_0xb27f('0x47')]({'where':{'id':_0x2867ff[_0xb27f('0x4a')]['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x33d76f,null))[_0xb27f('0x24')](removeEntity(_0x33d76f,null))['catch'](handleError(_0x33d76f,null));}; \ No newline at end of file +var _0xe2fe=['include','catch','show','find','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','WhatsappApplication','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['WhatsappApplication']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['WhatsappApplication']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 29f08b5..0a02e8f 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 _0xcee8=['api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x40d221,_0x2c82a6){var _0x465b82=function(_0x1f2871){while(--_0x1f2871){_0x40d221['push'](_0x40d221['shift']());}};_0x465b82(++_0x2c82a6);}(_0xcee8,0xb1));var _0x8cee=function(_0x374251,_0x1cc7fe){_0x374251=_0x374251-0x0;var _0xdd6e49=_0xcee8[_0x374251];return _0xdd6e49;};'use strict';var _=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var logger=require(_0x8cee('0x2'))(_0x8cee('0x3'));var moment=require(_0x8cee('0x4'));var BPromise=require(_0x8cee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cee('0x6'));var rimraf=require(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var attributes=require(_0x8cee('0x9'));module['exports']=function(_0x295471,_0xfea4e3){return _0x295471['define']('WhatsappApplication',attributes,{'tableName':_0x8cee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8cee('0xb')});}; \ No newline at end of file +var _0xef8b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x58a1a3,_0x5f54a8){var _0x5d5e22=function(_0x445527){while(--_0x445527){_0x58a1a3['push'](_0x58a1a3['shift']());}};_0x5d5e22(++_0x5f54a8);}(_0xef8b,0x192));var _0xbef8=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0xef8b[_0x258919];return _0xfbd68b;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require(_0xbef8('0x9'));module[_0xbef8('0xa')]=function(_0x550cb1,_0x1dd4a3){return _0x550cb1[_0xbef8('0xb')](_0xbef8('0xc'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbef8('0xd'),'collate':_0xbef8('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ac61ff9..61b19cc 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 _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1261db,_0x398a0b){var _0x4e673e=function(_0x37deb3){while(--_0x37deb3){_0x1261db['push'](_0x1261db['shift']());}};_0x4e673e(++_0x398a0b);}(_0xac9d,0x14d));var _0xdac9=function(_0x1ad07b,_0x551d55){_0x1ad07b=_0x1ad07b-0x0;var _0x2c447f=_0xac9d[_0x1ad07b];return _0x2c447f;};'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});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','WhatsappApplication,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x3b7c5c,_0x98f247){var _0x65f929=function(_0x131d80){while(--_0x131d80){_0x3b7c5c['push'](_0x3b7c5c['shift']());}};_0x65f929(++_0x98f247);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index b27675b..8e0566e 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 _0x9fd4=['../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5491e5,_0x37a869){_0x5491e5=_0x5491e5-0x0;var _0x214eb5=_0x9fd4[_0x5491e5];return _0x214eb5;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/describe',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['show']);router[_0x49fd('0x9')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x9')](_0x49fd('0x10'),auth[_0x49fd('0xa')](),controller['download']);router[_0x49fd('0x11')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);router[_0x49fd('0x11')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x13')]);router[_0x49fd('0x11')](_0x49fd('0x14'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x17')),controller[_0x49fd('0x18')]);router[_0x49fd('0x19')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x1a')),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),'whatsappinteraction:destroy'),controller[_0x49fd('0x1d')]);router[_0x49fd('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x49fd('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x5162=['whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp'];(function(_0x1828e5,_0x2ab60c){var _0x2e1d55=function(_0x2ccc3e){while(--_0x2ccc3e){_0x1828e5['push'](_0x1828e5['shift']());}};_0x2e1d55(++_0x2ab60c);}(_0x5162,0x103));var _0x2516=function(_0x3f0b2a,_0x52f963){_0x3f0b2a=_0x3f0b2a-0x0;var _0x23bd63=_0x5162[_0x3f0b2a];return _0x23bd63;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['get'](_0x2516('0xd'),auth[_0x2516('0x9')](),controller[_0x2516('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x2516('0xf')]('/',auth[_0x2516('0x9')](),controller[_0x2516('0x10')]);router[_0x2516('0xf')]('/:id/messages',auth[_0x2516('0x9')](),controller[_0x2516('0x11')]);router[_0x2516('0xf')](_0x2516('0x12'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x15')),controller[_0x2516('0x16')]);router[_0x2516('0x17')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x18')),controller['update']);router[_0x2516('0x19')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction['tracked'](_0x2516('0x14'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x2516('0x19')](_0x2516('0x12'),auth[_0x2516('0x9')](),controller[_0x2516('0x1a')]);module[_0x2516('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b236298..cf82f17 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 _0x0763=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x2e75c8,_0x43557b){var _0x4ebdd0=function(_0x308628){while(--_0x308628){_0x2e75c8['push'](_0x2e75c8['shift']());}};_0x4ebdd0(++_0x43557b);}(_0x0763,0x87));var _0x3076=function(_0x54aea3,_0xae7d81){_0x54aea3=_0x54aea3-0x0;var _0x21ae46=_0x0763[_0x54aea3];return _0x21ae46;};'use strict';var Sequelize=require(_0x3076('0x0'));var moment=require('moment');module[_0x3076('0x1')]={'closed':{'type':Sequelize[_0x3076('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3076('0x3')]},'secondDisposition':{'type':Sequelize[_0x3076('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3076('0x3')]},'note':{'type':Sequelize[_0x3076('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3076('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3076('0x5')]('in',_0x3076('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3076('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3076('0x5')]('in',_0x3076('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3076('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa1aa=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x3daae0,_0x47e6a5){var _0x38d9ba=function(_0x14f2a7){while(--_0x14f2a7){_0x3daae0['push'](_0x3daae0['shift']());}};_0x38d9ba(++_0x47e6a5);}(_0xa1aa,0x88));var _0xaa1a=function(_0x37625d,_0x570674){_0x37625d=_0x37625d-0x0;var _0x140bac=_0xa1aa[_0x37625d];return _0x140bac;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xaa1a('0x0')]={'closed':{'type':Sequelize[_0xaa1a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaa1a('0x2')]},'disposition':{'type':Sequelize[_0xaa1a('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa1a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa1a('0x3')]},'note':{'type':Sequelize[_0xaa1a('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xaa1a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xaa1a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa1a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xaa1a('0x4')]('in',_0xaa1a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaa1a('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 2568ea2..e4f906a 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 _0x6d38=['../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','end','error','stack','name','send','map','WhatsappInteraction','rawAttributes','type','key','findAll','query','user','then','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','body','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','fullname','get','mkdirSync','Whatsapp','Owner','closedAt','basename','existsSync','createReadStream','createWriteStream','System','out','value','renderFile','views','.pdf','createPdfFromHTML','download','log','err','zip-dir','moment','bluebird','ejs','ioredis'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x86d3('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x86d3('0x4'));var interaction=require(_0x86d3('0x5'));var qs=require(_0x86d3('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x86d3('0x7'))(_0x86d3('0x8'));var config=require(_0x86d3('0x9'));var db=require(_0x86d3('0xa'))['db'];config['redis']=_['defaults'](config[_0x86d3('0xb')],{'host':_0x86d3('0xc'),'port':0x18eb});var socket=require(_0x86d3('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x86d3('0xe')](socket);function respondWithStatusCode(_0x555e6d,_0x49b436){_0x49b436=_0x49b436||0xcc;return function(_0x5606eb){if(_0x5606eb){return _0x555e6d[_0x86d3('0xf')](_0x49b436);}return _0x555e6d[_0x86d3('0x10')](_0x49b436)['end']();};}function respondWithResult(_0x9fd6e8,_0x5e9606){_0x5e9606=_0x5e9606||0xc8;return function(_0x1a98e8){if(_0x1a98e8){return _0x9fd6e8[_0x86d3('0x10')](_0x5e9606)[_0x86d3('0x11')](_0x1a98e8);}};}function respondWithFilteredResult(_0x26d64c,_0xe1b3d7){return function(_0x1b8d0a){if(_0x1b8d0a){var _0xbbca86=typeof _0xe1b3d7[_0x86d3('0x12')]==='undefined'&&typeof _0xe1b3d7[_0x86d3('0x13')]===_0x86d3('0x14');var _0x356e7d=_0x1b8d0a[_0x86d3('0x15')];var _0x1ea535=_0xbbca86?0x0:_0xe1b3d7[_0x86d3('0x12')];var _0x1ff008=_0xbbca86?_0x1b8d0a[_0x86d3('0x15')]:_0xe1b3d7['offset']+_0xe1b3d7[_0x86d3('0x13')];var _0x281da0;if(_0x1ff008>=_0x356e7d){_0x1ff008=_0x356e7d;_0x281da0=0xc8;}else{_0x281da0=0xce;}_0x26d64c[_0x86d3('0x10')](_0x281da0);return _0x26d64c[_0x86d3('0x16')](_0x86d3('0x17'),_0x1ea535+'-'+_0x1ff008+'/'+_0x356e7d)[_0x86d3('0x11')](_0x1b8d0a);}return null;};}function saveUpdates(_0x33e459){return function(_0x32dee7){if(_0x32dee7){return _0x32dee7[_0x86d3('0x18')](_0x33e459)['then'](function(_0x191ba5){return _0x191ba5;});}return null;};}function removeEntity(_0x57c340){return function(_0x6ced9e){if(_0x6ced9e){return _0x6ced9e['destroy']()['then'](function(){_0x57c340[_0x86d3('0x10')](0xcc)[_0x86d3('0x19')]();});}};}function handleEntityNotFound(_0x988066){return function(_0x1720ae){if(!_0x1720ae){_0x988066['sendStatus'](0x194);}return _0x1720ae;};}function handleError(_0x2901de,_0x55e1c3){_0x55e1c3=_0x55e1c3||0x1f4;return function(_0x36e0fa){logger[_0x86d3('0x1a')](_0x36e0fa[_0x86d3('0x1b')]);if(_0x36e0fa['name']){delete _0x36e0fa[_0x86d3('0x1c')];}_0x2901de[_0x86d3('0x10')](_0x55e1c3)[_0x86d3('0x1d')](_0x36e0fa);};}exports['index']=function(_0x58ba51,_0x26262a){var _0x4d5668={};var _0x3c93d3=_[_0x86d3('0x1e')](db[_0x86d3('0x1f')][_0x86d3('0x20')],function(_0x48b3ff){return{'name':_0x48b3ff['fieldName'],'type':_0x48b3ff[_0x86d3('0x21')][_0x86d3('0x22')]};});_0x4d5668=qs['getOptions'](_0x3c93d3,_0x58ba51);return interaction[_0x86d3('0x23')]('whatsapp',_0x58ba51[_0x86d3('0x24')],_0x58ba51[_0x86d3('0x25')],_0x4d5668,_0x3c93d3)[_0x86d3('0x26')](respondWithFilteredResult(_0x26262a,_0x4d5668))[_0x86d3('0x27')](handleError(_0x26262a,null));};exports[_0x86d3('0x28')]=function(_0x14c9ff,_0x1f203e){var _0x35d708={'raw':![],'where':{'id':_0x14c9ff[_0x86d3('0x29')]['id']}},_0x303f13={};_0x303f13[_0x86d3('0x2a')]=_[_0x86d3('0x2b')](db[_0x86d3('0x1f')][_0x86d3('0x20')]);_0x303f13['query']=_[_0x86d3('0x2b')](_0x14c9ff[_0x86d3('0x24')]);_0x303f13[_0x86d3('0x2c')]=_[_0x86d3('0x2d')](_0x303f13[_0x86d3('0x2a')],_0x303f13[_0x86d3('0x24')]);_0x35d708['attributes']=_[_0x86d3('0x2d')](_0x303f13['model'],qs['fields'](_0x14c9ff[_0x86d3('0x24')][_0x86d3('0x2e')]));_0x35d708[_0x86d3('0x2f')]=_0x35d708['attributes'][_0x86d3('0x30')]?_0x35d708[_0x86d3('0x2f')]:_0x303f13['model'];if(_0x14c9ff[_0x86d3('0x24')][_0x86d3('0x31')]){_0x35d708[_0x86d3('0x32')]=[{'all':!![]}];}_0x35d708=_[_0x86d3('0x33')]({},_0x35d708,_0x14c9ff[_0x86d3('0x34')]);return db[_0x86d3('0x1f')][_0x86d3('0x35')](_0x35d708)[_0x86d3('0x26')](handleEntityNotFound(_0x1f203e,null))['then'](respondWithResult(_0x1f203e,null))['catch'](handleError(_0x1f203e,null));};exports['create']=function(_0x19cabb,_0x5990eb){return db[_0x86d3('0x1f')]['create'](_0x19cabb[_0x86d3('0x36')],{})[_0x86d3('0x26')](respondWithResult(_0x5990eb,0xc9))[_0x86d3('0x27')](handleError(_0x5990eb,null));};exports[_0x86d3('0x18')]=function(_0x1e22c2,_0x40a4ec){if(_0x1e22c2[_0x86d3('0x36')]['id']){delete _0x1e22c2['body']['id'];}return db[_0x86d3('0x1f')][_0x86d3('0x35')]({'where':{'id':_0x1e22c2['params']['id']}})[_0x86d3('0x26')](handleEntityNotFound(_0x40a4ec,null))[_0x86d3('0x26')](saveUpdates(_0x1e22c2[_0x86d3('0x36')],null))[_0x86d3('0x26')](respondWithResult(_0x40a4ec,null))['catch'](handleError(_0x40a4ec,null));};exports[_0x86d3('0x37')]=function(_0x42ac0d,_0x2e01ff){return db['WhatsappInteraction'][_0x86d3('0x35')]({'where':{'id':_0x42ac0d[_0x86d3('0x29')]['id']}})[_0x86d3('0x26')](handleEntityNotFound(_0x2e01ff,null))[_0x86d3('0x26')](removeEntity(_0x2e01ff,null))[_0x86d3('0x27')](handleError(_0x2e01ff,null));};exports[_0x86d3('0x38')]=function(_0x3666fc,_0x436065){return db['WhatsappInteraction'][_0x86d3('0x38')]()[_0x86d3('0x26')](respondWithResult(_0x436065,null))[_0x86d3('0x27')](handleError(_0x436065,null));};exports[_0x86d3('0x39')]=function(_0x5ebb4d,_0x1231ee){return db[_0x86d3('0x3a')][_0x86d3('0x35')]({'where':{'id':_0x5ebb4d[_0x86d3('0x29')]['id']}})['then'](handleEntityNotFound(_0x1231ee,null))['then'](function(_0x10978b){if(_0x10978b){return _0x10978b['addMessage'](_0x5ebb4d['body'][_0x86d3('0x3b')],_[_0x86d3('0x3c')](_0x5ebb4d[_0x86d3('0x36')],[_0x86d3('0x3b'),'id'])||{});}})[_0x86d3('0x26')](respondWithResult(_0x1231ee,null))['catch'](handleError(_0x1231ee,null));};exports[_0x86d3('0x3d')]=function(_0x3f265d,_0x190449){var _0x584dc8={'raw':![],'where':{}};var _0x39d6cd={};var _0x810d10={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x86d3('0x3e')]({'where':{'id':_0x3f265d[_0x86d3('0x29')]['id']}})['then'](handleEntityNotFound(_0x190449,null))['then'](function(_0x5b3772){if(_0x5b3772){_0x39d6cd[_0x86d3('0x2a')]=_[_0x86d3('0x2b')](db[_0x86d3('0x3a')][_0x86d3('0x20')]);_0x39d6cd[_0x86d3('0x24')]=_[_0x86d3('0x2b')](_0x3f265d['query']);_0x39d6cd[_0x86d3('0x2c')]=_[_0x86d3('0x2d')](_0x39d6cd['model'],_0x39d6cd[_0x86d3('0x24')]);_0x584dc8[_0x86d3('0x2f')]=_[_0x86d3('0x2d')](_0x39d6cd[_0x86d3('0x2a')],qs[_0x86d3('0x2e')](_0x3f265d[_0x86d3('0x24')]['fields']));_0x584dc8[_0x86d3('0x2f')]=_0x584dc8[_0x86d3('0x2f')]['length']?_0x584dc8[_0x86d3('0x2f')]:_0x39d6cd[_0x86d3('0x2a')];if(!_0x3f265d[_0x86d3('0x24')][_0x86d3('0x3f')](_0x86d3('0x40'))){_0x584dc8['limit']=qs[_0x86d3('0x13')](_0x3f265d[_0x86d3('0x24')][_0x86d3('0x13')]);_0x584dc8[_0x86d3('0x12')]=qs[_0x86d3('0x12')](_0x3f265d[_0x86d3('0x24')][_0x86d3('0x12')]);}_0x584dc8[_0x86d3('0x41')]=qs[_0x86d3('0x42')](_0x3f265d[_0x86d3('0x24')][_0x86d3('0x42')]);_0x584dc8[_0x86d3('0x43')]=qs['filters'](_[_0x86d3('0x44')](_0x3f265d[_0x86d3('0x24')],_0x39d6cd['filters']));_0x584dc8[_0x86d3('0x43')][_0x86d3('0x45')]=_0x5b3772['id'];if(_0x3f265d[_0x86d3('0x24')][_0x86d3('0x46')]){_0x584dc8[_0x86d3('0x43')]=_[_0x86d3('0x33')](_0x584dc8['where'],{'$or':_['map'](_0x584dc8['attributes'],function(_0x5bedc6){var _0x159253={};_0x159253[_0x5bedc6]={'$like':'%'+_0x3f265d[_0x86d3('0x24')][_0x86d3('0x46')]+'%'};return _0x159253;})});}if(_0x3f265d[_0x86d3('0x24')][_0x86d3('0x47')]){var _0xbfe9eb=_0x3f265d[_0x86d3('0x24')]['$gte'][_0x86d3('0x48')](',');var _0x335f96={};_0x335f96[_0xbfe9eb[0x0]]={'$gte':moment(_0xbfe9eb[0x1])[_0x86d3('0x49')](_0x86d3('0x4a'))};_0x584dc8[_0x86d3('0x43')]=_[_0x86d3('0x33')](_0x584dc8[_0x86d3('0x43')],_0x335f96);}_0x584dc8=_['merge']({},_0x584dc8,_0x3f265d[_0x86d3('0x34')]);return db['WhatsappMessage'][_0x86d3('0x15')]({'where':_0x584dc8[_0x86d3('0x43')]})[_0x86d3('0x26')](function(_0x3ffd22){_0x810d10[_0x86d3('0x15')]=_0x3ffd22;if(_0x3f265d['query'][_0x86d3('0x31')]){_0x584dc8[_0x86d3('0x32')]=[{'all':!![]}];}return db[_0x86d3('0x3a')]['findAll'](_0x584dc8);})['then'](function(_0x5f5d52){_0x810d10[_0x86d3('0x4b')]=_0x5f5d52;return _0x810d10;});}})['then'](respondWithFilteredResult(_0x190449,_0x584dc8))[_0x86d3('0x27')](handleError(_0x190449,null));};exports[_0x86d3('0x4c')]=function(_0x1fbd25,_0x319ea0){return db['WhatsappInteraction']['find']({'where':{'id':_0x1fbd25['params']['id']}})[_0x86d3('0x26')](handleEntityNotFound(_0x319ea0,null))[_0x86d3('0x26')](function(_0x5a7b69){if(_0x5a7b69){return _0x5a7b69[_0x86d3('0x4d')](_0x1fbd25[_0x86d3('0x36')][_0x86d3('0x3b')],_[_0x86d3('0x3c')](_0x1fbd25[_0x86d3('0x36')],['ids','id'])||{})[_0x86d3('0x4e')](function(){return db[_0x86d3('0x4f')][_0x86d3('0x23')]({'attributes':['id',_0x86d3('0x1c'),'color'],'where':{'id':_0x1fbd25[_0x86d3('0x36')][_0x86d3('0x3b')]}});})['then'](function(_0x2d9267){socket[_0x86d3('0x50')](_0x86d3('0x51'),{'id':Number(_0x1fbd25[_0x86d3('0x29')]['id']),'tags':_0x2d9267||[]});return{'id':Number(_0x1fbd25[_0x86d3('0x29')]['id']),'tags':_0x2d9267||[]};});}})[_0x86d3('0x26')](respondWithResult(_0x319ea0,null))[_0x86d3('0x27')](handleError(_0x319ea0,null));};exports['removeTags']=function(_0x52d0c8,_0x3876bd){return db['WhatsappInteraction']['find']({'where':{'id':_0x52d0c8['params']['id']}})[_0x86d3('0x26')](handleEntityNotFound(_0x3876bd,null))['then'](function(_0x254ac3){if(_0x254ac3){return _0x254ac3['removeTags'](_0x52d0c8[_0x86d3('0x24')][_0x86d3('0x3b')]);}})[_0x86d3('0x26')](respondWithStatusCode(_0x3876bd,null))['catch'](handleError(_0x3876bd,null));};exports['download']=function(_0x4639bb,_0xf2c179){var _0x1864bd=moment()[_0x86d3('0x52')]()[_0x86d3('0x53')]();var _0x1952af=path[_0x86d3('0x54')](config[_0x86d3('0x55')],_0x86d3('0x56'),_0x86d3('0x57'),_0x86d3('0x58'));var _0x265beb=path[_0x86d3('0x54')](config[_0x86d3('0x55')],_0x86d3('0x56'),_0x86d3('0x57'),_0x86d3('0x59'));var _0x301643=path['join'](_0x1952af,_0x1864bd);var _0x1d9561=util[_0x86d3('0x49')](_0x86d3('0x5a'),_0x4639bb['params']['id'],_0x1864bd);var _0x16bef0=path[_0x86d3('0x54')](_0x1952af,_0x1d9561);var _0x45e8d9=[];_0x45e8d9[_0x86d3('0x5b')]({'model':db['User'],'as':_0x86d3('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x45e8d9[_0x86d3('0x5b')]({'model':db[_0x86d3('0x5d')],'as':_0x86d3('0x5e'),'attributes':['id',_0x86d3('0x5f'),_0x86d3('0x60')],'raw':!![]});if(_0x4639bb['query'][_0x86d3('0x59')]){_0x45e8d9['push']({'model':db[_0x86d3('0x61')],'as':_0x86d3('0x61'),'raw':!![]});}var _0x5866fe=[{'model':db[_0x86d3('0x3a')],'as':_0x86d3('0x62'),'attributes':['id',_0x86d3('0x36'),_0x86d3('0x63'),_0x86d3('0x64'),_0x86d3('0x65'),_0x86d3('0x66')],'include':_0x45e8d9}];_0x5866fe['push']({'model':db[_0x86d3('0x67')],'as':_0x86d3('0x68'),'attributes':['id',_0x86d3('0x1c')]});_0x5866fe[_0x86d3('0x5b')]({'model':db[_0x86d3('0x5c')],'as':'Owner','attributes':['id',_0x86d3('0x69')]});return db[_0x86d3('0x1f')]['find']({'where':{'id':_0x4639bb[_0x86d3('0x29')]['id']},'include':_0x5866fe})[_0x86d3('0x26')](handleEntityNotFound(_0xf2c179,null))[_0x86d3('0x26')](function(_0x7710d8){if(_0x7710d8){var _0x1d1921=_0x7710d8[_0x86d3('0x6a')]({'plain':!![]});fs[_0x86d3('0x6b')](_0x301643);var _0x447ae6={'channel':_0x86d3('0x6c'),'account':_0x1d1921[_0x86d3('0x68')][_0x86d3('0x1c')],'agent':_0x1d1921[_0x86d3('0x6d')]?_0x1d1921[_0x86d3('0x6d')][_0x86d3('0x69')]:'N.A.','createdAt':moment(_0x1d1921[_0x86d3('0x63')])[_0x86d3('0x49')](_0x86d3('0x4a'))[_0x86d3('0x53')](),'closedAt':_0x1d1921['closed']?moment(_0x1d1921[_0x86d3('0x6e')])[_0x86d3('0x49')](_0x86d3('0x4a'))[_0x86d3('0x53')]():'','disposition':_0x1d1921['disposition'],'messages':_(_0x1d1921['Messages'])[_0x86d3('0x46')]({'secret':![]})['map'](function(_0x1869c5){if(_0x1869c5['Attachment']){var _0x4d280a=path[_0x86d3('0x54')](_0x265beb,_0x1869c5[_0x86d3('0x61')][_0x86d3('0x6f')]);if(fs[_0x86d3('0x70')](_0x4d280a)){fs[_0x86d3('0x71')](_0x4d280a)['pipe'](fs[_0x86d3('0x72')](path[_0x86d3('0x54')](_0x301643,_0x1869c5['Attachment'][_0x86d3('0x6f')])));}}return{'date':moment(_0x1869c5[_0x86d3('0x63')])['format'](_0x86d3('0x4a'))['toString'](),'sender':_0x1869c5[_0x86d3('0x64')]==='out'?_0x1869c5['User']?_0x1869c5[_0x86d3('0x5c')]['fullname']:_0x86d3('0x73'):_0x1869c5[_0x86d3('0x5e')][_0x86d3('0x5f')]+(_0x1869c5[_0x86d3('0x5e')][_0x86d3('0x60')]?'\x20'+_0x1869c5[_0x86d3('0x5e')][_0x86d3('0x60')]:''),'body':_0x1869c5[_0x86d3('0x61')]?_0x1869c5['Attachment'][_0x86d3('0x6f')]:_0x1869c5[_0x86d3('0x36')],'direction':_0x1869c5[_0x86d3('0x64')]===_0x86d3('0x74')?'A':'C','secret':_0x1869c5[_0x86d3('0x65')],'read':_0x1869c5['read'],'attachment':_0x1869c5[_0x86d3('0x61')]};})[_0x86d3('0x75')]()};return ejs[_0x86d3('0x76')](path[_0x86d3('0x54')](config[_0x86d3('0x55')],_0x86d3('0x56'),_0x86d3('0x77'),'downloadInteraction.ejs'),{'interaction':_0x447ae6})[_0x86d3('0x26')](function(_0x51884a){var _0xca2e0=path['join'](_0x301643,'transcript-'+_0x1d1921['id']+'-'+_0x1864bd+_0x86d3('0x78'));var _0x3e998f={'path':_0xca2e0,'channel':'Whatsapp','interactionId':_0x1d1921['id']};return pdf[_0x86d3('0x79')](_0x51884a,_0x3e998f);})[_0x86d3('0x26')](function(){return new BPromise(function(_0x879a8b,_0x1c1384){zipdir(_0x301643,{'saveTo':_0x16bef0},function(_0x205acd,_0x11d8c7){if(_0x205acd)return _0x1c1384(_0x205acd);return _0x879a8b(_0x11d8c7);});})[_0x86d3('0x26')](function(){return new BPromise(function(_0x5f4a38,_0x593b85){rimraf(_0x301643,function(_0x2eeddc){if(_0x2eeddc)_0x593b85(_0x2eeddc);return _0x5f4a38();});});})[_0x86d3('0x26')](function(){return _0xf2c179[_0x86d3('0x7a')](_0x16bef0,_0x1d9561,function(_0x28d98e){if(_0x28d98e){console[_0x86d3('0x7b')](_0x86d3('0x7c'),_0x28d98e);}else{fs['unlinkSync'](_0x16bef0);}});});});}else{return _0xf2c179[_0x86d3('0xf')](0xc8);}})[_0x86d3('0x27')](handleError(_0xf2c179,null));}; \ No newline at end of file +var _0x4b6b=['removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','User','CmContact','Attachment','createdAt','secret','read','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','basename','existsSync','createReadStream','createWriteStream','direction','out','Contact','firstName','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','log','err','unlinkSync','rimraf','zip-dir','bluebird','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','show','model','keys','filters','intersection','attributes','length','includeAll','merge','find','catch','create','body','params','describe','WhatsappMessage','addMessage','ids','getMessages','fields','hasOwnProperty','nolimit','order','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','omit','whatsappInteractionTags:save'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x4b6b,0x1a0));var _0xb4b6=function(_0x5aeaf8,_0x5a0f7a){_0x5aeaf8=_0x5aeaf8-0x0;var _0x3f4178=_0x4b6b[_0x5aeaf8];return _0x3f4178;};'use strict';var rimraf=require(_0xb4b6('0x0'));var zipdir=require(_0xb4b6('0x1'));var moment=require('moment');var BPromise=require(_0xb4b6('0x2'));var util=require('util');var path=require(_0xb4b6('0x3'));var ejs=require(_0xb4b6('0x4'));var fs=require('fs');var _=require(_0xb4b6('0x5'));var Redis=require(_0xb4b6('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xb4b6('0x7'));var pdf=require(_0xb4b6('0x8'));var logger=require(_0xb4b6('0x9'))(_0xb4b6('0xa'));var config=require(_0xb4b6('0xb'));var db=require(_0xb4b6('0xc'))['db'];config[_0xb4b6('0xd')]=_['defaults'](config[_0xb4b6('0xd')],{'host':_0xb4b6('0xe'),'port':0x18eb});var socket=require(_0xb4b6('0xf'))(new Redis(config['redis']));require(_0xb4b6('0x10'))['register'](socket);function respondWithStatusCode(_0x3c2e9e,_0x284638){_0x284638=_0x284638||0xcc;return function(_0x4b5774){if(_0x4b5774){return _0x3c2e9e['sendStatus'](_0x284638);}return _0x3c2e9e[_0xb4b6('0x11')](_0x284638)[_0xb4b6('0x12')]();};}function respondWithResult(_0x3a33f4,_0x667ccb){_0x667ccb=_0x667ccb||0xc8;return function(_0x2049fe){if(_0x2049fe){return _0x3a33f4['status'](_0x667ccb)[_0xb4b6('0x13')](_0x2049fe);}};}function respondWithFilteredResult(_0x59a7d4,_0x32175d){return function(_0x4ee220){if(_0x4ee220){var _0x6063a6=typeof _0x32175d['offset']===_0xb4b6('0x14')&&typeof _0x32175d[_0xb4b6('0x15')]===_0xb4b6('0x14');var _0x1178c5=_0x4ee220[_0xb4b6('0x16')];var _0x3c8403=_0x6063a6?0x0:_0x32175d[_0xb4b6('0x17')];var _0x54739d=_0x6063a6?_0x4ee220['count']:_0x32175d['offset']+_0x32175d['limit'];var _0x55e2f1;if(_0x54739d>=_0x1178c5){_0x54739d=_0x1178c5;_0x55e2f1=0xc8;}else{_0x55e2f1=0xce;}_0x59a7d4[_0xb4b6('0x11')](_0x55e2f1);return _0x59a7d4['set'](_0xb4b6('0x18'),_0x3c8403+'-'+_0x54739d+'/'+_0x1178c5)[_0xb4b6('0x13')](_0x4ee220);}return null;};}function saveUpdates(_0x3e61d7){return function(_0x45faf5){if(_0x45faf5){return _0x45faf5[_0xb4b6('0x19')](_0x3e61d7)[_0xb4b6('0x1a')](function(_0x42f257){return _0x42f257;});}return null;};}function removeEntity(_0x3c74e0){return function(_0x357f81){if(_0x357f81){return _0x357f81[_0xb4b6('0x1b')]()[_0xb4b6('0x1a')](function(){_0x3c74e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28da9c){return function(_0x4a53b4){if(!_0x4a53b4){_0x28da9c[_0xb4b6('0x1c')](0x194);}return _0x4a53b4;};}function handleError(_0x446bfc,_0x4a3a35){_0x4a3a35=_0x4a3a35||0x1f4;return function(_0x3d7b3f){logger['error'](_0x3d7b3f[_0xb4b6('0x1d')]);if(_0x3d7b3f[_0xb4b6('0x1e')]){delete _0x3d7b3f[_0xb4b6('0x1e')];}_0x446bfc[_0xb4b6('0x11')](_0x4a3a35)[_0xb4b6('0x1f')](_0x3d7b3f);};}exports[_0xb4b6('0x20')]=function(_0x485a2f,_0x328211){var _0x50410d={};var _0x28bae2=_[_0xb4b6('0x21')](db[_0xb4b6('0x22')][_0xb4b6('0x23')],function(_0x56e4fb){return{'name':_0x56e4fb[_0xb4b6('0x24')],'type':_0x56e4fb[_0xb4b6('0x25')]['key']};});_0x50410d=qs[_0xb4b6('0x26')](_0x28bae2,_0x485a2f);return interaction[_0xb4b6('0x27')](_0xb4b6('0x28'),_0x485a2f[_0xb4b6('0x29')],_0x485a2f[_0xb4b6('0x2a')],_0x50410d,_0x28bae2)[_0xb4b6('0x1a')](respondWithFilteredResult(_0x328211,_0x50410d))['catch'](handleError(_0x328211,null));};exports[_0xb4b6('0x2b')]=function(_0x7adf7f,_0x5c54e3){var _0x215358={'raw':![],'where':{'id':_0x7adf7f['params']['id']}},_0x1db35e={};_0x1db35e[_0xb4b6('0x2c')]=_[_0xb4b6('0x2d')](db[_0xb4b6('0x22')][_0xb4b6('0x23')]);_0x1db35e[_0xb4b6('0x29')]=_[_0xb4b6('0x2d')](_0x7adf7f[_0xb4b6('0x29')]);_0x1db35e[_0xb4b6('0x2e')]=_[_0xb4b6('0x2f')](_0x1db35e[_0xb4b6('0x2c')],_0x1db35e[_0xb4b6('0x29')]);_0x215358[_0xb4b6('0x30')]=_[_0xb4b6('0x2f')](_0x1db35e[_0xb4b6('0x2c')],qs['fields'](_0x7adf7f[_0xb4b6('0x29')]['fields']));_0x215358[_0xb4b6('0x30')]=_0x215358[_0xb4b6('0x30')][_0xb4b6('0x31')]?_0x215358[_0xb4b6('0x30')]:_0x1db35e[_0xb4b6('0x2c')];if(_0x7adf7f[_0xb4b6('0x29')][_0xb4b6('0x32')]){_0x215358['include']=[{'all':!![]}];}_0x215358=_[_0xb4b6('0x33')]({},_0x215358,_0x7adf7f['options']);return db[_0xb4b6('0x22')][_0xb4b6('0x34')](_0x215358)['then'](handleEntityNotFound(_0x5c54e3,null))[_0xb4b6('0x1a')](respondWithResult(_0x5c54e3,null))[_0xb4b6('0x35')](handleError(_0x5c54e3,null));};exports[_0xb4b6('0x36')]=function(_0x3c312f,_0x41b060){return db[_0xb4b6('0x22')][_0xb4b6('0x36')](_0x3c312f[_0xb4b6('0x37')],{})[_0xb4b6('0x1a')](respondWithResult(_0x41b060,0xc9))['catch'](handleError(_0x41b060,null));};exports['update']=function(_0x8f7df1,_0x5f053c){if(_0x8f7df1['body']['id']){delete _0x8f7df1['body']['id'];}return db[_0xb4b6('0x22')][_0xb4b6('0x34')]({'where':{'id':_0x8f7df1[_0xb4b6('0x38')]['id']}})[_0xb4b6('0x1a')](handleEntityNotFound(_0x5f053c,null))[_0xb4b6('0x1a')](saveUpdates(_0x8f7df1[_0xb4b6('0x37')],null))[_0xb4b6('0x1a')](respondWithResult(_0x5f053c,null))[_0xb4b6('0x35')](handleError(_0x5f053c,null));};exports[_0xb4b6('0x1b')]=function(_0x4a41d3,_0x33addd){return db[_0xb4b6('0x22')][_0xb4b6('0x34')]({'where':{'id':_0x4a41d3[_0xb4b6('0x38')]['id']}})['then'](handleEntityNotFound(_0x33addd,null))[_0xb4b6('0x1a')](removeEntity(_0x33addd,null))[_0xb4b6('0x35')](handleError(_0x33addd,null));};exports[_0xb4b6('0x39')]=function(_0x448b5d,_0x1682c2){return db[_0xb4b6('0x22')][_0xb4b6('0x39')]()[_0xb4b6('0x1a')](respondWithResult(_0x1682c2,null))[_0xb4b6('0x35')](handleError(_0x1682c2,null));};exports['addMessage']=function(_0x436f8c,_0x3d1be1){return db[_0xb4b6('0x3a')][_0xb4b6('0x34')]({'where':{'id':_0x436f8c[_0xb4b6('0x38')]['id']}})[_0xb4b6('0x1a')](handleEntityNotFound(_0x3d1be1,null))[_0xb4b6('0x1a')](function(_0x2dd776){if(_0x2dd776){return _0x2dd776[_0xb4b6('0x3b')](_0x436f8c[_0xb4b6('0x37')][_0xb4b6('0x3c')],_['omit'](_0x436f8c[_0xb4b6('0x37')],[_0xb4b6('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x3d1be1,null))[_0xb4b6('0x35')](handleError(_0x3d1be1,null));};exports[_0xb4b6('0x3d')]=function(_0x44b964,_0x5128a8){var _0x42e059={'raw':![],'where':{}};var _0x1f71b6={};var _0x3fc431={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x44b964[_0xb4b6('0x38')]['id']}})[_0xb4b6('0x1a')](handleEntityNotFound(_0x5128a8,null))['then'](function(_0x39eb5a){if(_0x39eb5a){_0x1f71b6[_0xb4b6('0x2c')]=_[_0xb4b6('0x2d')](db[_0xb4b6('0x3a')][_0xb4b6('0x23')]);_0x1f71b6[_0xb4b6('0x29')]=_[_0xb4b6('0x2d')](_0x44b964[_0xb4b6('0x29')]);_0x1f71b6[_0xb4b6('0x2e')]=_['intersection'](_0x1f71b6[_0xb4b6('0x2c')],_0x1f71b6[_0xb4b6('0x29')]);_0x42e059[_0xb4b6('0x30')]=_[_0xb4b6('0x2f')](_0x1f71b6[_0xb4b6('0x2c')],qs[_0xb4b6('0x3e')](_0x44b964['query']['fields']));_0x42e059[_0xb4b6('0x30')]=_0x42e059[_0xb4b6('0x30')][_0xb4b6('0x31')]?_0x42e059[_0xb4b6('0x30')]:_0x1f71b6['model'];if(!_0x44b964[_0xb4b6('0x29')][_0xb4b6('0x3f')](_0xb4b6('0x40'))){_0x42e059[_0xb4b6('0x15')]=qs[_0xb4b6('0x15')](_0x44b964[_0xb4b6('0x29')][_0xb4b6('0x15')]);_0x42e059['offset']=qs[_0xb4b6('0x17')](_0x44b964['query'][_0xb4b6('0x17')]);}_0x42e059[_0xb4b6('0x41')]=qs['sort'](_0x44b964['query']['sort']);_0x42e059[_0xb4b6('0x42')]=qs[_0xb4b6('0x2e')](_[_0xb4b6('0x43')](_0x44b964[_0xb4b6('0x29')],_0x1f71b6['filters']));_0x42e059['where'][_0xb4b6('0x44')]=_0x39eb5a['id'];if(_0x44b964[_0xb4b6('0x29')]['filter']){_0x42e059[_0xb4b6('0x42')]=_[_0xb4b6('0x33')](_0x42e059[_0xb4b6('0x42')],{'$or':_['map'](_0x42e059['attributes'],function(_0x27b104){var _0x3416aa={};_0x3416aa[_0x27b104]={'$like':'%'+_0x44b964[_0xb4b6('0x29')][_0xb4b6('0x45')]+'%'};return _0x3416aa;})});}if(_0x44b964[_0xb4b6('0x29')][_0xb4b6('0x46')]){var _0xba181f=_0x44b964[_0xb4b6('0x29')][_0xb4b6('0x46')][_0xb4b6('0x47')](',');var _0x269d92={};_0x269d92[_0xba181f[0x0]]={'$gte':moment(_0xba181f[0x1])[_0xb4b6('0x48')](_0xb4b6('0x49'))};_0x42e059[_0xb4b6('0x42')]=_[_0xb4b6('0x33')](_0x42e059['where'],_0x269d92);}_0x42e059=_[_0xb4b6('0x33')]({},_0x42e059,_0x44b964['options']);return db[_0xb4b6('0x3a')][_0xb4b6('0x16')]({'where':_0x42e059[_0xb4b6('0x42')]})[_0xb4b6('0x1a')](function(_0x2112d4){_0x3fc431[_0xb4b6('0x16')]=_0x2112d4;if(_0x44b964[_0xb4b6('0x29')][_0xb4b6('0x32')]){_0x42e059[_0xb4b6('0x4a')]=[{'all':!![]}];}return db[_0xb4b6('0x3a')][_0xb4b6('0x27')](_0x42e059);})[_0xb4b6('0x1a')](function(_0x4f3cdf){_0x3fc431[_0xb4b6('0x4b')]=_0x4f3cdf;return _0x3fc431;});}})[_0xb4b6('0x1a')](respondWithFilteredResult(_0x5128a8,_0x42e059))[_0xb4b6('0x35')](handleError(_0x5128a8,null));};exports[_0xb4b6('0x4c')]=function(_0x2461f8,_0x1ac2aa){return db[_0xb4b6('0x22')][_0xb4b6('0x34')]({'where':{'id':_0x2461f8['params']['id']}})[_0xb4b6('0x1a')](handleEntityNotFound(_0x1ac2aa,null))[_0xb4b6('0x1a')](function(_0x259951){if(_0x259951){return _0x259951[_0xb4b6('0x4d')](_0x2461f8['body']['ids'],_[_0xb4b6('0x4e')](_0x2461f8[_0xb4b6('0x37')],[_0xb4b6('0x3c'),'id'])||{})['spread'](function(){return db['Tag'][_0xb4b6('0x27')]({'attributes':['id',_0xb4b6('0x1e'),'color'],'where':{'id':_0x2461f8[_0xb4b6('0x37')][_0xb4b6('0x3c')]}});})['then'](function(_0x5413ae){socket['emit'](_0xb4b6('0x4f'),{'id':Number(_0x2461f8[_0xb4b6('0x38')]['id']),'tags':_0x5413ae||[]});return{'id':Number(_0x2461f8[_0xb4b6('0x38')]['id']),'tags':_0x5413ae||[]};});}})[_0xb4b6('0x1a')](respondWithResult(_0x1ac2aa,null))[_0xb4b6('0x35')](handleError(_0x1ac2aa,null));};exports[_0xb4b6('0x50')]=function(_0x4e74e8,_0x59f6dc){return db[_0xb4b6('0x22')]['find']({'where':{'id':_0x4e74e8['params']['id']}})['then'](handleEntityNotFound(_0x59f6dc,null))[_0xb4b6('0x1a')](function(_0x25d94d){if(_0x25d94d){return _0x25d94d['removeTags'](_0x4e74e8[_0xb4b6('0x29')][_0xb4b6('0x3c')]);}})['then'](respondWithStatusCode(_0x59f6dc,null))['catch'](handleError(_0x59f6dc,null));};exports[_0xb4b6('0x51')]=function(_0xbb240a,_0x1b1d20){var _0x46f4d4=moment()[_0xb4b6('0x52')]()[_0xb4b6('0x53')]();var _0xfb6d94=path[_0xb4b6('0x54')](config[_0xb4b6('0x55')],_0xb4b6('0x56'),_0xb4b6('0x57'),_0xb4b6('0x58'));var _0x5a4b4a=path[_0xb4b6('0x54')](config['root'],_0xb4b6('0x56'),_0xb4b6('0x57'),_0xb4b6('0x59'));var _0x408329=path[_0xb4b6('0x54')](_0xfb6d94,_0x46f4d4);var _0x1ce363=util['format']('transcript-%d-%s.zip',_0xbb240a[_0xb4b6('0x38')]['id'],_0x46f4d4);var _0x10e2dc=path['join'](_0xfb6d94,_0x1ce363);var _0x539bdd=[];_0x539bdd[_0xb4b6('0x5a')]({'model':db[_0xb4b6('0x5b')],'as':_0xb4b6('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x539bdd[_0xb4b6('0x5a')]({'model':db[_0xb4b6('0x5c')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0xbb240a['query'][_0xb4b6('0x59')]){_0x539bdd[_0xb4b6('0x5a')]({'model':db[_0xb4b6('0x5d')],'as':'Attachment','raw':!![]});}var _0x9e6670=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0xb4b6('0x5e'),'direction',_0xb4b6('0x5f'),_0xb4b6('0x60')],'include':_0x539bdd}];_0x9e6670[_0xb4b6('0x5a')]({'model':db[_0xb4b6('0x61')],'as':_0xb4b6('0x62'),'attributes':['id','name']});_0x9e6670[_0xb4b6('0x5a')]({'model':db['User'],'as':_0xb4b6('0x63'),'attributes':['id',_0xb4b6('0x64')]});return db[_0xb4b6('0x22')][_0xb4b6('0x34')]({'where':{'id':_0xbb240a[_0xb4b6('0x38')]['id']},'include':_0x9e6670})[_0xb4b6('0x1a')](handleEntityNotFound(_0x1b1d20,null))[_0xb4b6('0x1a')](function(_0x5d663d){if(_0x5d663d){var _0x386538=_0x5d663d[_0xb4b6('0x65')]({'plain':!![]});fs[_0xb4b6('0x66')](_0x408329);var _0xf16ad2={'channel':_0xb4b6('0x67'),'account':_0x386538[_0xb4b6('0x62')]['name'],'agent':_0x386538[_0xb4b6('0x63')]?_0x386538[_0xb4b6('0x63')][_0xb4b6('0x64')]:_0xb4b6('0x68'),'createdAt':moment(_0x386538[_0xb4b6('0x5e')])[_0xb4b6('0x48')](_0xb4b6('0x49'))[_0xb4b6('0x53')](),'closedAt':_0x386538[_0xb4b6('0x69')]?moment(_0x386538[_0xb4b6('0x6a')])[_0xb4b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb4b6('0x53')]():'','disposition':_0x386538['disposition'],'messages':_(_0x386538['Messages'])['filter']({'secret':![]})[_0xb4b6('0x21')](function(_0xbb90e3){if(_0xbb90e3['Attachment']){var _0x4e9ce1=path[_0xb4b6('0x54')](_0x5a4b4a,_0xbb90e3[_0xb4b6('0x5d')][_0xb4b6('0x6b')]);if(fs[_0xb4b6('0x6c')](_0x4e9ce1)){fs[_0xb4b6('0x6d')](_0x4e9ce1)['pipe'](fs[_0xb4b6('0x6e')](path[_0xb4b6('0x54')](_0x408329,_0xbb90e3[_0xb4b6('0x5d')][_0xb4b6('0x6b')])));}}return{'date':moment(_0xbb90e3[_0xb4b6('0x5e')])['format'](_0xb4b6('0x49'))['toString'](),'sender':_0xbb90e3[_0xb4b6('0x6f')]===_0xb4b6('0x70')?_0xbb90e3[_0xb4b6('0x5b')]?_0xbb90e3[_0xb4b6('0x5b')][_0xb4b6('0x64')]:'System':_0xbb90e3[_0xb4b6('0x71')][_0xb4b6('0x72')]+(_0xbb90e3[_0xb4b6('0x71')][_0xb4b6('0x73')]?'\x20'+_0xbb90e3[_0xb4b6('0x71')]['lastName']:''),'body':_0xbb90e3[_0xb4b6('0x5d')]?_0xbb90e3[_0xb4b6('0x5d')][_0xb4b6('0x6b')]:_0xbb90e3[_0xb4b6('0x37')],'direction':_0xbb90e3[_0xb4b6('0x6f')]==='out'?'A':'C','secret':_0xbb90e3[_0xb4b6('0x5f')],'read':_0xbb90e3[_0xb4b6('0x60')],'attachment':_0xbb90e3['Attachment']};})[_0xb4b6('0x74')]()};return ejs[_0xb4b6('0x75')](path[_0xb4b6('0x54')](config['root'],'server',_0xb4b6('0x76'),_0xb4b6('0x77')),{'interaction':_0xf16ad2})[_0xb4b6('0x1a')](function(_0x1d95d6){var _0x376969=path[_0xb4b6('0x54')](_0x408329,_0xb4b6('0x78')+_0x386538['id']+'-'+_0x46f4d4+'.pdf');var _0x41e431={'path':_0x376969,'channel':_0xb4b6('0x67'),'interactionId':_0x386538['id']};return pdf['createPdfFromHTML'](_0x1d95d6,_0x41e431);})[_0xb4b6('0x1a')](function(){return new BPromise(function(_0x53edbd,_0x27b467){zipdir(_0x408329,{'saveTo':_0x10e2dc},function(_0x23d901,_0x43469d){if(_0x23d901)return _0x27b467(_0x23d901);return _0x53edbd(_0x43469d);});})[_0xb4b6('0x1a')](function(){return new BPromise(function(_0x5dcb2c,_0xa4fb50){rimraf(_0x408329,function(_0x3862a1){if(_0x3862a1)_0xa4fb50(_0x3862a1);return _0x5dcb2c();});});})[_0xb4b6('0x1a')](function(){return _0x1b1d20[_0xb4b6('0x51')](_0x10e2dc,_0x1ce363,function(_0x36c473){if(_0x36c473){console[_0xb4b6('0x79')](_0xb4b6('0x7a'),_0x36c473);}else{fs[_0xb4b6('0x7b')](_0x10e2dc);}});});});}else{return _0x1b1d20[_0xb4b6('0x1c')](0xc8);}})[_0xb4b6('0x35')](handleError(_0x1b1d20,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0ef5bff..aa02352 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 _0xd9dc=['WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x37262d,_0x4f0e58){_0x37262d=_0x37262d-0x0;var _0x1aa3d1=_0xd9dc[_0x37262d];return _0x1aa3d1;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xcd9d('0x0'))['db'][_0xcd9d('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xcd9d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xcd9d('0x3')](0x0);var events={'afterCreate':_0xcd9d('0x4'),'afterUpdate':'update','afterDestroy':_0xcd9d('0x5')};function emitEvent(_0x12aae1){return function(_0x2c0be0,_0x15c0e2,_0x8cc2e4){_0x2c0be0['getUsers']({'attributes':['id'],'raw':!![]})[_0xcd9d('0x6')](function(_0x425858){_0x2c0be0[_0xcd9d('0x7')](_0xcd9d('0x8'),_0x425858[_0xcd9d('0x9')](function(_0x549558){return{'id':_0x549558['id']};}));return WhatsappMessage[_0xcd9d('0xa')]({'where':{'WhatsappInteractionId':_0x2c0be0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd9d('0x6')](function(_0x32dce7){_0x2c0be0[_0xcd9d('0x7')](_0xcd9d('0xb'),_0x32dce7[_0xcd9d('0xc')]);WhatsappInteractionEvents[_0xcd9d('0xd')](_0x12aae1+':'+_0x2c0be0['id'],_0x2c0be0);WhatsappInteractionEvents[_0xcd9d('0xd')](_0x12aae1,_0x2c0be0);_0x8cc2e4(null);})['catch'](_0x8cc2e4(null));};}for(var e in events){if(events[_0xcd9d('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xcd9d('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x557d=['Users','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save','update','getUsers','then'];(function(_0x46f601,_0xa7e6ea){var _0x38e2a2=function(_0x3bbabf){while(--_0x3bbabf){_0x46f601['push'](_0x46f601['shift']());}};_0x38e2a2(++_0xa7e6ea);}(_0x557d,0xcb));var _0xd557=function(_0x2baeb5,_0x45441b){_0x2baeb5=_0x2baeb5-0x0;var _0xb74a3d=_0x557d[_0x2baeb5];return _0xb74a3d;};'use strict';var EventEmitter=require(_0xd557('0x0'));var WhatsappInteraction=require(_0xd557('0x1'))['db'][_0xd557('0x2')];var WhatsappMessage=require(_0xd557('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd557('0x3'),'afterUpdate':_0xd557('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f19d7){return function(_0x479940,_0x7f3f34,_0x598348){_0x479940[_0xd557('0x5')]({'attributes':['id'],'raw':!![]})[_0xd557('0x6')](function(_0x21173d){_0x479940['setDataValue'](_0xd557('0x7'),_0x21173d['map'](function(_0x1379a1){return{'id':_0x1379a1['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x479940['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x68af0d){_0x479940[_0xd557('0x8')](_0xd557('0x9'),_0x68af0d[_0xd557('0xa')]);WhatsappInteractionEvents[_0xd557('0xb')](_0x5f19d7+':'+_0x479940['id'],_0x479940);WhatsappInteractionEvents[_0xd557('0xb')](_0x5f19d7,_0x479940);_0x598348(null);})['catch'](_0x598348(null));};}for(var e in events){if(events[_0xd557('0xc')](e)){var event=events[e];WhatsappInteraction[_0xd557('0xd')](e,emitEvent(event));}}module[_0xd557('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 15d1c03..e24c424 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 _0xc1ec=['define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x35ca16,_0x12ff71){var _0x3cad13=function(_0x5b4489){while(--_0x5b4489){_0x35ca16['push'](_0x35ca16['shift']());}};_0x3cad13(++_0x12ff71);}(_0xc1ec,0x117));var _0xcc1e=function(_0x1368cf,_0x40ca87){_0x1368cf=_0x1368cf-0x0;var _0x3093d8=_0xc1ec[_0x1368cf];return _0x3093d8;};'use strict';var _=require(_0xcc1e('0x0'));var util=require(_0xcc1e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc1e('0x2'));var BPromise=require(_0xcc1e('0x3'));var rp=require(_0xcc1e('0x4'));var fs=require('fs');var path=require(_0xcc1e('0x5'));var rimraf=require(_0xcc1e('0x6'));var config=require(_0xcc1e('0x7'));var attributes=require(_0xcc1e('0x8'));module['exports']=function(_0x42ca26,_0x37af1d){return _0x42ca26[_0xcc1e('0x9')](_0xcc1e('0xa'),attributes,{'tableName':_0xcc1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x286814,_0x217727,_0x463678){if(_0x286814[_0xcc1e('0xc')]('closed')){_0x286814[_0xcc1e('0xd')]=moment()[_0xcc1e('0xe')](_0xcc1e('0xf'));}_0x463678(null,_0x286814);}}});}; \ No newline at end of file +var _0xb0ca=['format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt'];(function(_0x58b127,_0x528578){var _0x2b7d7d=function(_0x57cf64){while(--_0x57cf64){_0x58b127['push'](_0x58b127['shift']());}};_0x2b7d7d(++_0x528578);}(_0xb0ca,0x1b2));var _0xab0c=function(_0x2a83dd,_0x595542){_0x2a83dd=_0x2a83dd-0x0;var _0x5c89f6=_0xb0ca[_0x2a83dd];return _0x5c89f6;};'use strict';var _=require('lodash');var util=require(_0xab0c('0x0'));var logger=require('../../config/logger')(_0xab0c('0x1'));var moment=require(_0xab0c('0x2'));var BPromise=require(_0xab0c('0x3'));var rp=require(_0xab0c('0x4'));var fs=require('fs');var path=require(_0xab0c('0x5'));var rimraf=require(_0xab0c('0x6'));var config=require(_0xab0c('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0xab0c('0x8')]=function(_0x14c9dc,_0x1c4dcf){return _0x14c9dc[_0xab0c('0x9')](_0xab0c('0xa'),attributes,{'tableName':_0xab0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50d3de,_0x22ebb5,_0x2e4ee2){if(_0x50d3de['changed'](_0xab0c('0xc'))){_0x50d3de[_0xab0c('0xd')]=moment()[_0xab0c('0xe')](_0xab0c('0xf'));}_0x2e4ee2(null,_0x50d3de);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 14cbcba..17948bb 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 _0xb99c=['UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2461ec,_0xd693c3){var _0x3ba75c=function(_0x5ef7eb){while(--_0x5ef7eb){_0x2461ec['push'](_0x2461ec['shift']());}};_0x3ba75c(++_0xd693c3);}(_0xb99c,0xd8));var _0xcb99=function(_0x5d5a79,_0x27c222){_0x5d5a79=_0x5d5a79-0x0;var _0x1e8a8a=_0xb99c[_0x5d5a79];return _0x1e8a8a;};'use strict';var _=require(_0xcb99('0x0'));var util=require(_0xcb99('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb99('0x2'));var fs=require('fs');var Redis=require(_0xcb99('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb99('0x4'));var logger=require(_0xcb99('0x5'))('rpc');var config=require(_0xcb99('0x6'));var jayson=require(_0xcb99('0x7'));var client=jayson[_0xcb99('0x8')][_0xcb99('0x9')]({'port':0x232a});config['redis']=_[_0xcb99('0xa')](config[_0xcb99('0xb')],{'host':_0xcb99('0xc'),'port':0x18eb});var socket=require(_0xcb99('0xd'))(new Redis(config[_0xcb99('0xb')]));require(_0xcb99('0xe'))['register'](socket);function respondWithRpcPromise(_0x4c6019,_0x883b98,_0x16a77e){return new BPromise(function(_0x45d8b6,_0x4250bf){return client[_0xcb99('0xf')](_0x4c6019,_0x16a77e)[_0xcb99('0x10')](function(_0x5acfc3){logger[_0xcb99('0x11')](_0xcb99('0x12'),_0x883b98,_0xcb99('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x883b98,_0xcb99('0x13'),JSON[_0xcb99('0x14')](_0x5acfc3));if(_0x5acfc3['error']){if(_0x5acfc3[_0xcb99('0x15')][_0xcb99('0x16')]===0x1f4){logger[_0xcb99('0x15')](_0xcb99('0x12'),_0x883b98,_0x5acfc3[_0xcb99('0x15')]['message']);return _0x4250bf(_0x5acfc3['error']['message']);}logger[_0xcb99('0x15')](_0xcb99('0x12'),_0x883b98,_0x5acfc3[_0xcb99('0x15')][_0xcb99('0x17')]);return _0x45d8b6(_0x5acfc3[_0xcb99('0x15')][_0xcb99('0x17')]);}else{logger['info'](_0xcb99('0x12'),_0x883b98,_0xcb99('0x13'));_0x45d8b6(_0x5acfc3['result'][_0xcb99('0x17')]);}})['catch'](function(_0x598867){logger[_0xcb99('0x15')](_0xcb99('0x12'),_0x883b98,_0x598867);_0x4250bf(_0x598867);});});}exports[_0xcb99('0x18')]=function(_0x2ecde8){var _0x23e05b=this;return new Promise(function(_0x181c40,_0x4bdbb3){return db[_0xcb99('0x19')][_0xcb99('0x1a')](_0x2ecde8['body'],{'raw':_0x2ecde8[_0xcb99('0x1b')]?_0x2ecde8[_0xcb99('0x1b')][_0xcb99('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ecde8[_0xcb99('0x1b')]?_0x2ecde8[_0xcb99('0x1b')][_0xcb99('0x1d')]||null:null,'attributes':_0x2ecde8['options']?_0x2ecde8['options'][_0xcb99('0x1e')]||null:null,'limit':_0x2ecde8['options']?_0x2ecde8[_0xcb99('0x1b')][_0xcb99('0x1f')]||null:null})[_0xcb99('0x10')](function(_0x4158a1){logger['info'](_0xcb99('0x18'),_0x2ecde8);logger[_0xcb99('0x20')]('UpdateWhatsappInteraction',_0x2ecde8,JSON[_0xcb99('0x14')](_0x4158a1));_0x181c40(_0x4158a1);})['catch'](function(_0x3abe35){logger[_0xcb99('0x15')]('UpdateWhatsappInteraction',_0x3abe35['message'],_0x2ecde8);_0x4bdbb3(_0x23e05b[_0xcb99('0x15')](0x1f4,_0x3abe35['message']));});});};exports[_0xcb99('0x21')]=function(_0x246cf9){return new Promise(function(_0x2c6717,_0x2b7b34){return db[_0xcb99('0x19')]['find']({'where':_0x246cf9[_0xcb99('0x1b')]?_0x246cf9[_0xcb99('0x1b')][_0xcb99('0x1d')]||null:null})[_0xcb99('0x10')](function(_0x1c9f99){if(_0x1c9f99){return _0x1c9f99[_0xcb99('0x22')](_0x246cf9[_0xcb99('0x23')][_0xcb99('0x24')],_[_0xcb99('0x25')](_0x246cf9[_0xcb99('0x23')],['ids','id'])||{});}})[_0xcb99('0x26')](function(_0x413662){logger[_0xcb99('0x11')](_0xcb99('0x27'),_0x246cf9);logger[_0xcb99('0x20')](_0xcb99('0x27'),_0x246cf9,JSON[_0xcb99('0x14')](_0x413662));_0x2c6717(_0x413662);})['catch'](function(_0xffc71f){logger['error'](_0xcb99('0x27'),_0xffc71f[_0xcb99('0x17')],_0x246cf9);_0x2b7b34(_this[_0xcb99('0x15')](0x1f4,_0xffc71f[_0xcb99('0x17')]));});});}; \ No newline at end of file +var _0xc72b=['message','result','catch','WhatsappInteraction','update','body','options','attributes','limit','info','UpdateWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xed358b,_0x4be246){var _0x108ab6=function(_0x5909b7){while(--_0x5909b7){_0xed358b['push'](_0xed358b['shift']());}};_0x108ab6(++_0x4be246);}(_0xc72b,0x198));var _0xbc72=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0xc72b[_0x42e4d7];return _0x346cd8;};'use strict';var _=require(_0xbc72('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbc72('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc72('0x2'));var db=require(_0xbc72('0x3'))['db'];var utils=require(_0xbc72('0x4'));var logger=require('../../config/logger')(_0xbc72('0x5'));var config=require(_0xbc72('0x6'));var jayson=require(_0xbc72('0x7'));var client=jayson['client'][_0xbc72('0x8')]({'port':0x232a});config[_0xbc72('0x9')]=_[_0xbc72('0xa')](config[_0xbc72('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc72('0xb'))(new Redis(config[_0xbc72('0x9')]));require(_0xbc72('0xc'))[_0xbc72('0xd')](socket);function respondWithRpcPromise(_0x2abcb2,_0x3447a0,_0x328585){return new BPromise(function(_0x113dce,_0x2d00ab){return client[_0xbc72('0xe')](_0x2abcb2,_0x328585)[_0xbc72('0xf')](function(_0x120e67){logger['info'](_0xbc72('0x10'),_0x3447a0,_0xbc72('0x11'));logger[_0xbc72('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3447a0,_0xbc72('0x11'),JSON[_0xbc72('0x13')](_0x120e67));if(_0x120e67[_0xbc72('0x14')]){if(_0x120e67['error']['code']===0x1f4){logger[_0xbc72('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x3447a0,_0x120e67['error']['message']);return _0x2d00ab(_0x120e67['error'][_0xbc72('0x15')]);}logger['error'](_0xbc72('0x10'),_0x3447a0,_0x120e67[_0xbc72('0x14')][_0xbc72('0x15')]);return _0x113dce(_0x120e67[_0xbc72('0x14')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3447a0,_0xbc72('0x11'));_0x113dce(_0x120e67[_0xbc72('0x16')][_0xbc72('0x15')]);}})[_0xbc72('0x17')](function(_0x1de5fc){logger[_0xbc72('0x14')](_0xbc72('0x10'),_0x3447a0,_0x1de5fc);_0x2d00ab(_0x1de5fc);});});}exports['UpdateWhatsappInteraction']=function(_0x1a89a9){var _0x53b96e=this;return new Promise(function(_0x2c8f31,_0x1f7df4){return db[_0xbc72('0x18')][_0xbc72('0x19')](_0x1a89a9[_0xbc72('0x1a')],{'raw':_0x1a89a9['options']?_0x1a89a9[_0xbc72('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a89a9[_0xbc72('0x1b')]?_0x1a89a9['options']['where']||null:null,'attributes':_0x1a89a9[_0xbc72('0x1b')]?_0x1a89a9[_0xbc72('0x1b')][_0xbc72('0x1c')]||null:null,'limit':_0x1a89a9[_0xbc72('0x1b')]?_0x1a89a9[_0xbc72('0x1b')][_0xbc72('0x1d')]||null:null})[_0xbc72('0xf')](function(_0x17953a){logger[_0xbc72('0x1e')](_0xbc72('0x1f'),_0x1a89a9);logger[_0xbc72('0x12')](_0xbc72('0x1f'),_0x1a89a9,JSON[_0xbc72('0x13')](_0x17953a));_0x2c8f31(_0x17953a);})['catch'](function(_0x4b8e60){logger[_0xbc72('0x14')]('UpdateWhatsappInteraction',_0x4b8e60[_0xbc72('0x15')],_0x1a89a9);_0x1f7df4(_0x53b96e[_0xbc72('0x14')](0x1f4,_0x4b8e60[_0xbc72('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x9d4075){return new Promise(function(_0x380bde,_0x56b861){return db[_0xbc72('0x18')][_0xbc72('0x20')]({'where':_0x9d4075[_0xbc72('0x1b')]?_0x9d4075[_0xbc72('0x1b')][_0xbc72('0x21')]||null:null})[_0xbc72('0xf')](function(_0x57f318){if(_0x57f318){return _0x57f318[_0xbc72('0x22')](_0x9d4075['body'][_0xbc72('0x23')],_[_0xbc72('0x24')](_0x9d4075[_0xbc72('0x1a')],[_0xbc72('0x23'),'id'])||{});}})[_0xbc72('0x25')](function(_0x2c162b){logger[_0xbc72('0x1e')](_0xbc72('0x26'),_0x9d4075);logger[_0xbc72('0x12')](_0xbc72('0x26'),_0x9d4075,JSON[_0xbc72('0x13')](_0x2c162b));_0x380bde(_0x2c162b);})[_0xbc72('0x17')](function(_0x201e7a){logger['error'](_0xbc72('0x26'),_0x201e7a[_0xbc72('0x15')],_0x9d4075);_0x56b861(_this['error'](0x1f4,_0x201e7a[_0xbc72('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e549605..307b916 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 _0xba53=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x393168,_0x36432a){var _0x22aa5d=function(_0x2d7631){while(--_0x2d7631){_0x393168['push'](_0x393168['shift']());}};_0x22aa5d(++_0x36432a);}(_0xba53,0xef));var _0x3ba5=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xba53[_0x122096];return _0x3d1966;};'use strict';var WhatsappInteractionEvents=require(_0x3ba5('0x0'));var events=['save','remove','update'];function createListener(_0x610cef,_0x50931d){return function(_0x5106c9){_0x50931d[_0x3ba5('0x1')](_0x610cef,_0x5106c9);};}function removeListener(_0xce8af6,_0x1d510c){return function(){WhatsappInteractionEvents[_0x3ba5('0x2')](_0xce8af6,_0x1d510c);};}exports[_0x3ba5('0x3')]=function(_0x1ac2f1){for(var _0x23237f=0x0,_0x165237=events['length'];_0x23237f<_0x165237;_0x23237f++){var _0x309c69=events[_0x23237f];var _0x2f3531=createListener(_0x3ba5('0x4')+_0x309c69,_0x1ac2f1);WhatsappInteractionEvents['on'](_0x309c69,_0x2f3531);}}; \ No newline at end of file +var _0x238f=['save','update','emit','length','whatsappInteraction:'];(function(_0x201ed2,_0x1042cc){var _0x138582=function(_0x682b4a){while(--_0x682b4a){_0x201ed2['push'](_0x201ed2['shift']());}};_0x138582(++_0x1042cc);}(_0x238f,0xb9));var _0xf238=function(_0x13069b,_0x12444b){_0x13069b=_0x13069b-0x0;var _0x185942=_0x238f[_0x13069b];return _0x185942;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xf238('0x0'),'remove',_0xf238('0x1')];function createListener(_0x864143,_0x5694fa){return function(_0x4d172e){_0x5694fa[_0xf238('0x2')](_0x864143,_0x4d172e);};}function removeListener(_0x819de2,_0x5cb992){return function(){WhatsappInteractionEvents['removeListener'](_0x819de2,_0x5cb992);};}exports['register']=function(_0x1af1e0){for(var _0x55b390=0x0,_0xa58596=events[_0xf238('0x3')];_0x55b390<_0xa58596;_0x55b390++){var _0x551267=events[_0x55b390];var _0x3173ae=createListener(_0xf238('0x4')+_0x551267,_0x1af1e0);WhatsappInteractionEvents['on'](_0x551267,_0x3173ae);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1a12dec..b14876d 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 _0xef6b=['get','/describe','describe','show','post','tracked','whatsappmessage:create','create','/:id/status','status','put','/:id','update','accept','reject','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0xee7cbf,_0x5c8211){var _0x6662bb=function(_0x5b42c4){while(--_0x5b42c4){_0xee7cbf['push'](_0xee7cbf['shift']());}};_0x6662bb(++_0x5c8211);}(_0xef6b,0x162));var _0xbef6=function(_0x1a211a,_0x4ff270){_0x1a211a=_0x1a211a-0x0;var _0x476c47=_0xef6b[_0x1a211a];return _0x476c47;};'use strict';var multer=require(_0xbef6('0x0'));var util=require('util');var path=require(_0xbef6('0x1'));var timeout=require(_0xbef6('0x2'));var express=require(_0xbef6('0x3'));var router=express[_0xbef6('0x4')]();var fs_extra=require(_0xbef6('0x5'));var auth=require(_0xbef6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbef6('0x7'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xbef6('0x8')](),controller[_0xbef6('0x9')]);router[_0xbef6('0xa')](_0xbef6('0xb'),auth[_0xbef6('0x8')](),controller[_0xbef6('0xc')]);router['get']('/:id',auth[_0xbef6('0x8')](),controller[_0xbef6('0xd')]);router[_0xbef6('0xe')]('/',auth[_0xbef6('0x8')](),interaction[_0xbef6('0xf')]('whatsapp',_0xbef6('0x10')),controller[_0xbef6('0x11')]);router[_0xbef6('0xe')](_0xbef6('0x12'),controller[_0xbef6('0x13')]);router[_0xbef6('0x14')](_0xbef6('0x15'),auth[_0xbef6('0x8')](),controller[_0xbef6('0x16')]);router[_0xbef6('0x14')]('/:id/accept',auth[_0xbef6('0x8')](),controller[_0xbef6('0x17')]);router['put']('/:id/reject',auth[_0xbef6('0x8')](),controller[_0xbef6('0x18')]);router['delete']('/:id',auth[_0xbef6('0x8')](),controller[_0xbef6('0x19')]);module['exports']=router; \ No newline at end of file +var _0x926c=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x926c,0x106));var _0xc926=function(_0x1dbad6,_0x39b4b1){_0x1dbad6=_0x1dbad6-0x0;var _0x1280f7=_0x926c[_0x1dbad6];return _0x1280f7;};'use strict';var multer=require(_0xc926('0x0'));var util=require(_0xc926('0x1'));var path=require(_0xc926('0x2'));var timeout=require('connect-timeout');var express=require(_0xc926('0x3'));var router=express['Router']();var fs_extra=require(_0xc926('0x4'));var auth=require(_0xc926('0x5'));var interaction=require(_0xc926('0x6'));var config=require('../../config/environment');var controller=require(_0xc926('0x7'));router[_0xc926('0x8')]('/',auth['isAuthenticated'](),controller[_0xc926('0x9')]);router['get'](_0xc926('0xa'),auth[_0xc926('0xb')](),controller[_0xc926('0xc')]);router['get']('/:id',auth[_0xc926('0xb')](),controller[_0xc926('0xd')]);router[_0xc926('0xe')]('/',auth[_0xc926('0xb')](),interaction[_0xc926('0xf')](_0xc926('0x10'),_0xc926('0x11')),controller[_0xc926('0x12')]);router[_0xc926('0xe')](_0xc926('0x13'),controller[_0xc926('0x14')]);router[_0xc926('0x15')](_0xc926('0x16'),auth[_0xc926('0xb')](),controller['update']);router[_0xc926('0x15')](_0xc926('0x17'),auth['isAuthenticated'](),controller[_0xc926('0x18')]);router[_0xc926('0x15')](_0xc926('0x19'),auth[_0xc926('0xb')](),controller[_0xc926('0x1a')]);router['delete'](_0xc926('0x16'),auth['isAuthenticated'](),controller[_0xc926('0x1b')]);module[_0xc926('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index fffdf70..faf60dd 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 _0x4161=['ENUM','out','STRING','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x512d62,_0xdff5e4){var _0x16011c=function(_0x483aa5){while(--_0x483aa5){_0x512d62['push'](_0x512d62['shift']());}};_0x16011c(++_0xdff5e4);}(_0x4161,0xbc));var _0x1416=function(_0x3f7fb6,_0x41eb7c){_0x3f7fb6=_0x3f7fb6-0x0;var _0x2305d3=_0x4161[_0x3f7fb6];return _0x2305d3;};'use strict';var Sequelize=require('sequelize');module[_0x1416('0x0')]={'body':{'type':Sequelize[_0x1416('0x1')](_0x1416('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1416('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1416('0x4')]('in',_0x1416('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1416('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1416('0x6')]},'readAt':{'type':Sequelize[_0x1416('0x7')]},'secret':{'type':Sequelize[_0x1416('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1416('0x6')]},'providerResponse':{'type':Sequelize[_0x1416('0x1')]}}; \ No newline at end of file +var _0x29a3=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports','medium'];(function(_0x1b7c39,_0x422dc5){var _0x247fa7=function(_0x4d95a3){while(--_0x4d95a3){_0x1b7c39['push'](_0x1b7c39['shift']());}};_0x247fa7(++_0x422dc5);}(_0x29a3,0x141));var _0x329a=function(_0x1bf5f6,_0x3c3180){_0x1bf5f6=_0x1bf5f6-0x0;var _0x36a39e=_0x29a3[_0x1bf5f6];return _0x36a39e;};'use strict';var Sequelize=require(_0x329a('0x0'));module[_0x329a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x329a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x329a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x329a('0x4')]('in','out'),'defaultValue':_0x329a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x329a('0x6')](0xbe)},'phone':{'type':Sequelize[_0x329a('0x6')]},'readAt':{'type':Sequelize[_0x329a('0x7')]},'secret':{'type':Sequelize[_0x329a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x329a('0x6')]},'providerResponse':{'type':Sequelize[_0x329a('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 8a994c4..3adf241 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 _0xe96f=['code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','map','WhatsappMessage','fieldName','type','key','query','filters','model','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','show','params','keys','rawAttributes','intersection','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe96f,0x64));var _0xfe96=function(_0x2a7686,_0x3ecef9){_0x2a7686=_0x2a7686-0x0;var _0x37af26=_0xe96f[_0x2a7686];return _0x37af26;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfe96('0x0'));var jsonpatch=require(_0xfe96('0x1'));var rp=require(_0xfe96('0x2'));var moment=require(_0xfe96('0x3'));var BPromise=require(_0xfe96('0x4'));var Mustache=require(_0xfe96('0x5'));var util=require(_0xfe96('0x6'));var path=require(_0xfe96('0x7'));var sox=require(_0xfe96('0x8'));var csv=require(_0xfe96('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe96('0xa'));var _=require('lodash');var squel=require(_0xfe96('0xb'));var crypto=require(_0xfe96('0xc'));var jsforce=require(_0xfe96('0xd'));var deskjs=require(_0xfe96('0xe'));var toCsv=require(_0xfe96('0x9'));var querystring=require('querystring');var Papa=require(_0xfe96('0xf'));var Redis=require(_0xfe96('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfe96('0x11'));var as=require(_0xfe96('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfe96('0x13'));var utils=require(_0xfe96('0x14'));var config=require(_0xfe96('0x15'));var licenseUtil=require(_0xfe96('0x16'));var db=require('../../mysqldb')['db'];config[_0xfe96('0x17')]=_[_0xfe96('0x18')](config[_0xfe96('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe96('0x19'))(new Redis(config[_0xfe96('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfe96('0x1a')]({'port':0x232c});var client9002=jayson[_0xfe96('0x1b')][_0xfe96('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x8b46b0,_0x14c809,_0x1c0ee0,_0x58200f){return new BPromise(function(_0x44c971,_0x5b7562){var _0x457d08=_0x58200f||client;return _0x457d08['request'](_0x8b46b0,_0x1c0ee0)[_0xfe96('0x1c')](function(_0x338dfe){logger[_0xfe96('0x1d')](_0xfe96('0x1e'),_0x14c809,'request\x20sent');logger[_0xfe96('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x14c809,_0xfe96('0x20'),JSON[_0xfe96('0x21')](_0x338dfe));if(_0x338dfe[_0xfe96('0x22')]){if(_0x338dfe[_0xfe96('0x22')][_0xfe96('0x23')]===0x1f4){logger['error'](_0xfe96('0x1e'),_0x14c809,_0x338dfe[_0xfe96('0x22')][_0xfe96('0x24')]);return _0x5b7562(_0x338dfe[_0xfe96('0x22')][_0xfe96('0x24')]);}logger[_0xfe96('0x22')](_0xfe96('0x1e'),_0x14c809,_0x338dfe[_0xfe96('0x22')][_0xfe96('0x24')]);return _0x44c971(_0x338dfe[_0xfe96('0x22')][_0xfe96('0x24')]);}else{logger[_0xfe96('0x1d')](_0xfe96('0x1e'),_0x14c809,_0xfe96('0x20'));_0x44c971(_0x338dfe[_0xfe96('0x25')][_0xfe96('0x24')]);}})[_0xfe96('0x26')](function(_0x2875a8){logger['error'](_0xfe96('0x1e'),_0x14c809,_0x2875a8);_0x5b7562(_0x2875a8);});});}function respondWithStatusCode(_0x3bfb97,_0x354675){_0x354675=_0x354675||0xcc;return function(_0x44f6a8){if(_0x44f6a8){return _0x3bfb97[_0xfe96('0x27')](_0x354675);}return _0x3bfb97[_0xfe96('0x28')](_0x354675)[_0xfe96('0x29')]();};}function respondWithResult(_0x43bdad,_0x2fba30){_0x2fba30=_0x2fba30||0xc8;return function(_0x30b944){if(_0x30b944){return _0x43bdad[_0xfe96('0x28')](_0x2fba30)['json'](_0x30b944);}};}function respondWithFilteredResult(_0x482e36,_0x3fd082){return function(_0x575b5f){if(_0x575b5f){var _0x5be4c=typeof _0x3fd082[_0xfe96('0x2a')]===_0xfe96('0x2b')&&typeof _0x3fd082[_0xfe96('0x2c')]===_0xfe96('0x2b');var _0x509048=_0x575b5f[_0xfe96('0x2d')];var _0x377579=_0x5be4c?0x0:_0x3fd082[_0xfe96('0x2a')];var _0x57e063=_0x5be4c?_0x575b5f['count']:_0x3fd082[_0xfe96('0x2a')]+_0x3fd082[_0xfe96('0x2c')];var _0x157a03;if(_0x57e063>=_0x509048){_0x57e063=_0x509048;_0x157a03=0xc8;}else{_0x157a03=0xce;}_0x482e36[_0xfe96('0x28')](_0x157a03);return _0x482e36[_0xfe96('0x2e')]('Content-Range',_0x377579+'-'+_0x57e063+'/'+_0x509048)['json'](_0x575b5f);}return null;};}function patchUpdates(_0x2e843a){return function(_0x5e7c79){try{jsonpatch[_0xfe96('0x2f')](_0x5e7c79,_0x2e843a,!![]);}catch(_0x4a0fe6){return BPromise[_0xfe96('0x30')](_0x4a0fe6);}return _0x5e7c79[_0xfe96('0x31')]();};}function saveUpdates(_0x2e5a89,_0x1c48ed){return function(_0x3abf5c){if(_0x3abf5c){return _0x3abf5c[_0xfe96('0x32')](_0x2e5a89)[_0xfe96('0x1c')](function(_0x23c985){return _0x23c985;});}return null;};}function removeEntity(_0x49fc02,_0x5e819b){return function(_0x1fb1c4){if(_0x1fb1c4){return _0x1fb1c4[_0xfe96('0x33')]()[_0xfe96('0x1c')](function(){_0x49fc02['status'](0xcc)[_0xfe96('0x29')]();});}};}function handleEntityNotFound(_0x38c6bf,_0x4451aa){return function(_0x2a020a){if(!_0x2a020a){_0x38c6bf[_0xfe96('0x27')](0x194);}return _0x2a020a;};}function handleError(_0x1191fe,_0x5dcbcd){_0x5dcbcd=_0x5dcbcd||0x1f4;return function(_0x49d260){logger['error'](_0x49d260[_0xfe96('0x34')]);if(_0x49d260['name']){delete _0x49d260[_0xfe96('0x35')];}_0x1191fe['status'](_0x5dcbcd)[_0xfe96('0x36')](_0x49d260);};}exports['index']=function(_0x3900b1,_0x4519aa){var _0x1d1fba={},_0x4f8785={},_0x1673c9={'count':0x0,'rows':[]};var _0x5cd1a0=_[_0xfe96('0x37')](db[_0xfe96('0x38')]['rawAttributes'],function(_0x134efd){return{'name':_0x134efd[_0xfe96('0x39')],'type':_0x134efd[_0xfe96('0x3a')][_0xfe96('0x3b')]};});_0x4f8785['model']=_[_0xfe96('0x37')](_0x5cd1a0,_0xfe96('0x35'));_0x4f8785[_0xfe96('0x3c')]=_['keys'](_0x3900b1[_0xfe96('0x3c')]);_0x4f8785[_0xfe96('0x3d')]=_['intersection'](_0x4f8785[_0xfe96('0x3e')],_0x4f8785['query']);_0x1d1fba['attributes']=_['intersection'](_0x4f8785[_0xfe96('0x3e')],qs[_0xfe96('0x3f')](_0x3900b1[_0xfe96('0x3c')][_0xfe96('0x3f')]));_0x1d1fba[_0xfe96('0x40')]=_0x1d1fba['attributes'][_0xfe96('0x41')]?_0x1d1fba[_0xfe96('0x40')]:_0x4f8785[_0xfe96('0x3e')];if(!_0x3900b1['query']['hasOwnProperty'](_0xfe96('0x42'))){_0x1d1fba[_0xfe96('0x2c')]=qs[_0xfe96('0x2c')](_0x3900b1[_0xfe96('0x3c')]['limit']);_0x1d1fba['offset']=qs[_0xfe96('0x2a')](_0x3900b1[_0xfe96('0x3c')][_0xfe96('0x2a')]);}_0x1d1fba['order']=qs[_0xfe96('0x43')](_0x3900b1['query'][_0xfe96('0x43')]);_0x1d1fba[_0xfe96('0x44')]=qs[_0xfe96('0x3d')](_[_0xfe96('0x45')](_0x3900b1['query'],_0x4f8785['filters']),_0x5cd1a0);if(_0x3900b1[_0xfe96('0x3c')][_0xfe96('0x46')]){_0x1d1fba[_0xfe96('0x44')]=_['merge'](_0x1d1fba[_0xfe96('0x44')],{'$or':_['map'](_0x5cd1a0,function(_0xe1c70b){if(_0xe1c70b[_0xfe96('0x3a')]!==_0xfe96('0x47')){var _0x5b43ed={};_0x5b43ed[_0xe1c70b['name']]={'$like':'%'+_0x3900b1['query']['filter']+'%'};return _0x5b43ed;}})});}_0x1d1fba=_['merge']({},_0x1d1fba,_0x3900b1[_0xfe96('0x48')]);var _0x5d7b9f={'where':_0x1d1fba['where']};return db[_0xfe96('0x38')]['count'](_0x5d7b9f)[_0xfe96('0x1c')](function(_0x480532){_0x1673c9[_0xfe96('0x2d')]=_0x480532;if(_0x3900b1[_0xfe96('0x3c')][_0xfe96('0x49')]){_0x1d1fba[_0xfe96('0x4a')]=[{'all':!![]}];}return db[_0xfe96('0x38')]['findAll'](_0x1d1fba);})[_0xfe96('0x1c')](function(_0x54b896){_0x1673c9['rows']=_0x54b896;return _0x1673c9;})[_0xfe96('0x1c')](respondWithFilteredResult(_0x4519aa,_0x1d1fba))['catch'](handleError(_0x4519aa,null));};exports[_0xfe96('0x4b')]=function(_0x39a771,_0x58f465){var _0x379cf3={'raw':!![],'where':{'id':_0x39a771[_0xfe96('0x4c')]['id']}},_0x1f9bb0={};_0x1f9bb0[_0xfe96('0x3e')]=_[_0xfe96('0x4d')](db[_0xfe96('0x38')][_0xfe96('0x4e')]);_0x1f9bb0['query']=_[_0xfe96('0x4d')](_0x39a771[_0xfe96('0x3c')]);_0x1f9bb0['filters']=_[_0xfe96('0x4f')](_0x1f9bb0[_0xfe96('0x3e')],_0x1f9bb0[_0xfe96('0x3c')]);_0x379cf3[_0xfe96('0x40')]=_[_0xfe96('0x4f')](_0x1f9bb0['model'],qs['fields'](_0x39a771[_0xfe96('0x3c')][_0xfe96('0x3f')]));_0x379cf3[_0xfe96('0x40')]=_0x379cf3[_0xfe96('0x40')][_0xfe96('0x41')]?_0x379cf3[_0xfe96('0x40')]:_0x1f9bb0[_0xfe96('0x3e')];if(_0x39a771[_0xfe96('0x3c')][_0xfe96('0x49')]){_0x379cf3[_0xfe96('0x4a')]=[{'all':!![]}];}_0x379cf3=_['merge']({},_0x379cf3,_0x39a771[_0xfe96('0x48')]);return db[_0xfe96('0x38')][_0xfe96('0x50')](_0x379cf3)['then'](handleEntityNotFound(_0x58f465,null))[_0xfe96('0x1c')](respondWithResult(_0x58f465,null))[_0xfe96('0x26')](handleError(_0x58f465,null));};exports[_0xfe96('0x51')]=function(_0x59f572,_0x24536f){return db[_0xfe96('0x38')]['create'](_0x59f572['body'],{})[_0xfe96('0x1c')](respondWithResult(_0x24536f,0xc9))[_0xfe96('0x26')](handleError(_0x24536f,null));};exports[_0xfe96('0x32')]=function(_0x4e4d95,_0x5bcaea){if(_0x4e4d95[_0xfe96('0x52')]['id']){delete _0x4e4d95['body']['id'];}return db['WhatsappMessage'][_0xfe96('0x50')]({'where':{'id':_0x4e4d95['params']['id']}})[_0xfe96('0x1c')](handleEntityNotFound(_0x5bcaea,null))[_0xfe96('0x1c')](saveUpdates(_0x4e4d95[_0xfe96('0x52')],null))[_0xfe96('0x1c')](respondWithResult(_0x5bcaea,null))[_0xfe96('0x26')](handleError(_0x5bcaea,null));};exports[_0xfe96('0x33')]=function(_0x309c33,_0x4c1d90){return db['WhatsappMessage'][_0xfe96('0x50')]({'where':{'id':_0x309c33['params']['id']}})[_0xfe96('0x1c')](handleEntityNotFound(_0x4c1d90,null))[_0xfe96('0x1c')](removeEntity(_0x4c1d90,null))[_0xfe96('0x26')](handleError(_0x4c1d90,null));};exports[_0xfe96('0x53')]=function(_0x5e9ec3,_0x5388f3){return db['WhatsappMessage']['describe']()[_0xfe96('0x1c')](respondWithResult(_0x5388f3,null))['catch'](handleError(_0x5388f3,null));};var interaction_log=require(_0xfe96('0x54'))(_0xfe96('0x55'));exports[_0xfe96('0x56')]=function(_0xc05c8e,_0x4c0d07,_0x470f52){var _0x5a6d70={'agent':{},'channel':_0xfe96('0x57')};if(_0xc05c8e[_0xfe96('0x52')]['id']){delete _0xc05c8e[_0xfe96('0x52')]['id'];}_0xc05c8e[_0xfe96('0x52')][_0xfe96('0x58')]=!![];_0xc05c8e['body'][_0xfe96('0x59')]=moment()['format'](_0xfe96('0x5a'));_0xc05c8e['body'][_0xfe96('0x5b')]=_0xc05c8e['body'][_0xfe96('0x5b')]||_0xc05c8e[_0xfe96('0x5c')]['id'];_0x5a6d70[_0xfe96('0x5d')]['id']=_0xc05c8e['body'][_0xfe96('0x5b')];return db['WhatsappMessage'][_0xfe96('0x50')]({'where':{'id':_0xc05c8e[_0xfe96('0x4c')]['id'],'UserId':null}})[_0xfe96('0x1c')](handleEntityNotFound(_0x4c0d07,null))['then'](saveUpdates(_0xc05c8e[_0xfe96('0x52')],null))[_0xfe96('0x1c')](function(_0xfd4f1c){if(_0xfd4f1c){_0x5a6d70[_0xfe96('0x24')]=_0xfd4f1c[_0xfe96('0x5e')]({'plain':!![]});return db[_0xfe96('0x5f')][_0xfe96('0x50')]({'where':{'id':_0xfd4f1c[_0xfe96('0x60')]}});}return null;})[_0xfe96('0x1c')](handleEntityNotFound(_0x4c0d07,null))[_0xfe96('0x1c')](function(_0x323ab2){if(_0x323ab2){return _0x323ab2['update']({'UserId':_0xc05c8e[_0xfe96('0x52')]['UserId'],'read1stAt':_[_0xfe96('0x61')](_0x323ab2[_0xfe96('0x62')])?moment()[_0xfe96('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfe96('0x1c')](function(_0x3e0a32){if(_0x3e0a32){_0x5a6d70[_0xfe96('0x64')]=_0x3e0a32[_0xfe96('0x5e')]({'plain':!![]});interaction_log[_0xfe96('0x1d')](_0xfe96('0x65'),_0xc05c8e[_0xfe96('0x5c')]['id'],_0xc05c8e[_0xfe96('0x5c')][_0xfe96('0x35')],_0xc05c8e[_0xfe96('0x5c')][_0xfe96('0x66')],_0x5a6d70[_0xfe96('0x64')]['id'],_0xc05c8e[_0xfe96('0x52')]?JSON[_0xfe96('0x21')](_0xc05c8e['body']):'null');return respondWithRpcPromise(_0xfe96('0x67'),_0xfe96('0x68'),_0x5a6d70);}return null;})[_0xfe96('0x1c')](function(_0x531444){var _0x28ef8f=_0xfe96('0x69')+_0x531444[_0xfe96('0x24')][_0xfe96('0x6a')];return db[_0xfe96('0x6b')]['query'](_0x28ef8f,{'type':db[_0xfe96('0x6c')][_0xfe96('0x6d')]['SELECT'],'raw':!![]})[_0xfe96('0x1c')](function(_0x33a94b){return _0x33a94b;});})['then'](function(_0x559698){if(_0x559698){_0x5a6d70[_0xfe96('0x24')][_0xfe96('0x6e')]=_0x559698[0x0];if(!_0xc05c8e[_0xfe96('0x52')][_0xfe96('0x5b')])return;return db[_0xfe96('0x6f')]['find']({'where':{'id':_0xc05c8e['body'][_0xfe96('0x5b')],'role':'agent'},'attributes':['id',_0xfe96('0x35'),_0xfe96('0x70'),_0xfe96('0x71'),'internal'],'raw':!![]});}return null;})[_0xfe96('0x1c')](function(_0x45f00c){if(!_0x45f00c)return null;_0x5a6d70['message'][_0xfe96('0x5d')]=_0x45f00c;return _0x5a6d70;})[_0xfe96('0x1c')](function(_0x368eaa){if(_0x368eaa){if(_0xc05c8e[_0xfe96('0x52')][_0xfe96('0x72')]){_0x5a6d70['message'][_0xfe96('0x73')]=util[_0xfe96('0x63')](_0xfe96('0x74'),_0xc05c8e[_0xfe96('0x5c')][_0xfe96('0x35')]);_0x5a6d70[_0xfe96('0x24')]['channel']=_0x5a6d70[_0xfe96('0x75')];_0x5a6d70[_0xfe96('0x24')][_0xfe96('0x76')]=_0x5a6d70[_0xfe96('0x75')];_0x5a6d70[_0xfe96('0x24')][_0xfe96('0x77')]=_0xfe96('0x56');return respondWithRpcPromise(_0xfe96('0x78'),_0xfe96('0x78'),{'event':_0xfe96('0x79'),'message':_0x5a6d70[_0xfe96('0x24')]},client9002)[_0xfe96('0x1c')](function(){return _0x5a6d70;});}return _0x5a6d70;}return null;})[_0xfe96('0x1c')](respondWithResult(_0x4c0d07,null))[_0xfe96('0x26')](handleError(_0x4c0d07,null));};var interaction_log=require(_0xfe96('0x54'))(_0xfe96('0x55'));exports[_0xfe96('0x30')]=function(_0x509ef6,_0xe84e6,_0x2e5593){var _0x1b7996={'agent':{},'channel':'whatsapp'};if(_0x509ef6[_0xfe96('0x52')]['id']){delete _0x509ef6[_0xfe96('0x52')]['id'];}_0x509ef6[_0xfe96('0x52')][_0xfe96('0x5b')]=_0x509ef6[_0xfe96('0x52')][_0xfe96('0x5b')]||_0x509ef6[_0xfe96('0x5c')]['id'];_0x1b7996[_0xfe96('0x5d')]['id']=_0x509ef6[_0xfe96('0x52')][_0xfe96('0x5b')];return db['WhatsappMessage'][_0xfe96('0x50')]({'where':{'id':_0x509ef6[_0xfe96('0x4c')]['id'],'UserId':null}})[_0xfe96('0x1c')](handleEntityNotFound(_0xe84e6,null))[_0xfe96('0x1c')](function(_0x42af5c){if(_0x42af5c){_0x1b7996[_0xfe96('0x24')]=_0x42af5c[_0xfe96('0x5e')]({'plain':!![]});return db[_0xfe96('0x5f')][_0xfe96('0x50')]({'where':{'id':_0x42af5c[_0xfe96('0x60')]}});}return null;})[_0xfe96('0x1c')](handleEntityNotFound(_0xe84e6,null))[_0xfe96('0x1c')](function(_0x124585){if(_0x124585){_0x1b7996[_0xfe96('0x64')]=_0x124585['get']({'plain':!![]});interaction_log[_0xfe96('0x1d')](_0xfe96('0x7a'),_0x509ef6['user']['id'],_0x509ef6[_0xfe96('0x5c')][_0xfe96('0x35')],_0x509ef6['user'][_0xfe96('0x66')],_0x1b7996[_0xfe96('0x64')]['id'],_0x509ef6[_0xfe96('0x52')]?JSON[_0xfe96('0x21')](_0x509ef6['body']):'null');return respondWithRpcPromise(_0xfe96('0x7b'),_0xfe96('0x7c'),_0x1b7996);}return null;})[_0xfe96('0x1c')](function(_0x5b2ec3){var _0x2d2a01='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5b2ec3['message'][_0xfe96('0x6a')];return db['sequelize'][_0xfe96('0x3c')](_0x2d2a01,{'type':db[_0xfe96('0x6c')][_0xfe96('0x6d')]['SELECT'],'raw':!![]})[_0xfe96('0x1c')](function(_0x26f4d0){return _0x26f4d0;});})[_0xfe96('0x1c')](function(_0x34c46d){if(_0x34c46d){_0x1b7996[_0xfe96('0x24')][_0xfe96('0x6e')]=_0x34c46d[0x0];if(!_0x509ef6[_0xfe96('0x52')]['UserId'])return;return db[_0xfe96('0x6f')]['find']({'where':{'id':_0x509ef6[_0xfe96('0x52')][_0xfe96('0x5b')],'role':_0xfe96('0x5d')},'attributes':['id',_0xfe96('0x35'),_0xfe96('0x70'),'email',_0xfe96('0x7d')],'raw':!![]});}return null;})[_0xfe96('0x1c')](function(_0x4443e0){if(!_0x4443e0)return null;_0x1b7996[_0xfe96('0x24')][_0xfe96('0x5d')]=_0x4443e0;return _0x1b7996;})[_0xfe96('0x1c')](function(_0x181d2a){if(_0x181d2a){_0x181d2a[_0xfe96('0x24')]['interface']=util['format'](_0xfe96('0x74'),_0x509ef6['user']['name']);_0x181d2a[_0xfe96('0x24')][_0xfe96('0x75')]=_0x1b7996['channel'];_0x181d2a[_0xfe96('0x24')]['motionChannel']=_0x1b7996[_0xfe96('0x75')];_0x181d2a[_0xfe96('0x24')][_0xfe96('0x77')]=_0xfe96('0x30');respondWithRpcPromise(_0xfe96('0x78'),_0xfe96('0x78'),{'event':'rejectmessage','message':_0x181d2a['message']},client9002);return _0x1b7996;}return null;})[_0xfe96('0x1c')](respondWithResult(_0xe84e6,null))[_0xfe96('0x26')](handleError(_0xe84e6,null));};exports[_0xfe96('0x28')]=function(_0x54a77e,_0x4a15cd,_0x24a9f6){if(_0x54a77e[_0xfe96('0x52')]['id']){delete _0x54a77e[_0xfe96('0x52')]['id'];}var _0x2cb6ea;return db[_0xfe96('0x38')]['find']({'where':{'id':_0x54a77e[_0xfe96('0x4c')]['id']}})[_0xfe96('0x1c')](handleEntityNotFound(_0x4a15cd,null))[_0xfe96('0x1c')](function(_0x27be63){if(_0x27be63){_0x2cb6ea=_0x27be63;return db[_0xfe96('0x7e')][_0xfe96('0x50')]({'where':{'id':_0x27be63[_0xfe96('0x7f')]}});}})[_0xfe96('0x1c')](handleEntityNotFound(_0x4a15cd,null))['then'](function(_0x4dbf7f){if(_0x4dbf7f){logger[_0xfe96('0x1f')](_0xfe96('0x80'),_0xfe96('0x28'),_0xfe96('0x81'),_0x4dbf7f[_0xfe96('0x3a')],util[_0xfe96('0x82')](_0x54a77e['body'],{'showHidden':![],'depth':null}));switch(_0x4dbf7f['type']){case _0xfe96('0x83'):if(_0x54a77e['body'][_0xfe96('0x84')]&&_0x54a77e[_0xfe96('0x52')][_0xfe96('0x84')]===_0x2cb6ea['messageId']&&_0x54a77e['body'][_0xfe96('0x85')]&&_0x54a77e['body'][_0xfe96('0x85')]===_0xfe96('0x58')){return _0x2cb6ea[_0xfe96('0x32')]({'read':!![]});}else{logger[_0xfe96('0x22')](_0xfe96('0x86'),_0xfe96('0x28'),_0xfe96('0x83'),util[_0xfe96('0x82')](_0x54a77e[_0xfe96('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x2cb6ea;}})[_0xfe96('0x1c')](respondWithResult(_0x4a15cd,null))[_0xfe96('0x26')](handleError(_0x4a15cd,null));}; \ No newline at end of file +var _0x3899=['motionChannel','event','EventManager','RejectMessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','sort','filters','pick','filter','merge','VIRTUAL','where','findAll','params','includeAll','include','options','find','create','body','describe','whatsapp-interactions','accept','whatsapp','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','interaction','user','role','stringify','null','AcceptMessage','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'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x3899,0x1a1));var _0x9389=function(_0x583162,_0x5dce58){_0x583162=_0x583162-0x0;var _0x3cad65=_0x3899[_0x583162];return _0x3cad65;};'use strict';var emlformat=require(_0x9389('0x0'));var rimraf=require(_0x9389('0x1'));var zipdir=require(_0x9389('0x2'));var jsonpatch=require(_0x9389('0x3'));var rp=require(_0x9389('0x4'));var moment=require(_0x9389('0x5'));var BPromise=require(_0x9389('0x6'));var Mustache=require(_0x9389('0x7'));var util=require(_0x9389('0x8'));var path=require('path');var sox=require(_0x9389('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9389('0xa'));var _=require(_0x9389('0xb'));var squel=require(_0x9389('0xc'));var crypto=require(_0x9389('0xd'));var jsforce=require(_0x9389('0xe'));var deskjs=require(_0x9389('0xf'));var toCsv=require(_0x9389('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9389('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9389('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9389('0x13'));var logger=require(_0x9389('0x14'))(_0x9389('0x15'));var utils=require(_0x9389('0x16'));var config=require(_0x9389('0x17'));var licenseUtil=require(_0x9389('0x18'));var db=require('../../mysqldb')['db'];config[_0x9389('0x19')]=_[_0x9389('0x1a')](config[_0x9389('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9389('0x19')]));require(_0x9389('0x1b'))['register'](socket);var jayson=require(_0x9389('0x1c'));var client=jayson[_0x9389('0x1d')][_0x9389('0x1e')]({'port':0x232c});var client9002=jayson[_0x9389('0x1d')][_0x9389('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x77e0c5,_0x4cc596,_0x570c86,_0x18436d){return new BPromise(function(_0x43935f,_0x114b0d){var _0x3791b8=_0x18436d||client;return _0x3791b8[_0x9389('0x1f')](_0x77e0c5,_0x570c86)[_0x9389('0x20')](function(_0x23915e){logger[_0x9389('0x21')](_0x9389('0x22'),_0x4cc596,_0x9389('0x23'));logger[_0x9389('0x24')](_0x9389('0x25'),_0x4cc596,_0x9389('0x23'),JSON['stringify'](_0x23915e));if(_0x23915e[_0x9389('0x26')]){if(_0x23915e[_0x9389('0x26')][_0x9389('0x27')]===0x1f4){logger['error'](_0x9389('0x22'),_0x4cc596,_0x23915e[_0x9389('0x26')]['message']);return _0x114b0d(_0x23915e['error'][_0x9389('0x28')]);}logger['error'](_0x9389('0x22'),_0x4cc596,_0x23915e['error'][_0x9389('0x28')]);return _0x43935f(_0x23915e['error'][_0x9389('0x28')]);}else{logger['info'](_0x9389('0x22'),_0x4cc596,_0x9389('0x23'));_0x43935f(_0x23915e['result'][_0x9389('0x28')]);}})[_0x9389('0x29')](function(_0xe01134){logger[_0x9389('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4cc596,_0xe01134);_0x114b0d(_0xe01134);});});}function respondWithStatusCode(_0x516dd1,_0x1ca3c9){_0x1ca3c9=_0x1ca3c9||0xcc;return function(_0x297607){if(_0x297607){return _0x516dd1[_0x9389('0x2a')](_0x1ca3c9);}return _0x516dd1[_0x9389('0x2b')](_0x1ca3c9)['end']();};}function respondWithResult(_0x35d22c,_0x427a22){_0x427a22=_0x427a22||0xc8;return function(_0xe1a7e3){if(_0xe1a7e3){return _0x35d22c[_0x9389('0x2b')](_0x427a22)[_0x9389('0x2c')](_0xe1a7e3);}};}function respondWithFilteredResult(_0x486d1f,_0x2c34d8){return function(_0x542e6e){if(_0x542e6e){var _0x246878=typeof _0x2c34d8[_0x9389('0x2d')]===_0x9389('0x2e')&&typeof _0x2c34d8['limit']===_0x9389('0x2e');var _0x59b3f6=_0x542e6e[_0x9389('0x2f')];var _0x5775a7=_0x246878?0x0:_0x2c34d8[_0x9389('0x2d')];var _0x392a82=_0x246878?_0x542e6e[_0x9389('0x2f')]:_0x2c34d8[_0x9389('0x2d')]+_0x2c34d8[_0x9389('0x30')];var _0x310920;if(_0x392a82>=_0x59b3f6){_0x392a82=_0x59b3f6;_0x310920=0xc8;}else{_0x310920=0xce;}_0x486d1f[_0x9389('0x2b')](_0x310920);return _0x486d1f[_0x9389('0x31')](_0x9389('0x32'),_0x5775a7+'-'+_0x392a82+'/'+_0x59b3f6)[_0x9389('0x2c')](_0x542e6e);}return null;};}function patchUpdates(_0x5b8273){return function(_0x5d2a2c){try{jsonpatch[_0x9389('0x33')](_0x5d2a2c,_0x5b8273,!![]);}catch(_0xdd953){return BPromise[_0x9389('0x34')](_0xdd953);}return _0x5d2a2c[_0x9389('0x35')]();};}function saveUpdates(_0x10f9ca,_0x40338d){return function(_0x52e18b){if(_0x52e18b){return _0x52e18b['update'](_0x10f9ca)[_0x9389('0x20')](function(_0x564eef){return _0x564eef;});}return null;};}function removeEntity(_0x533a7f,_0x3efa3e){return function(_0x1c7171){if(_0x1c7171){return _0x1c7171[_0x9389('0x36')]()['then'](function(){_0x533a7f[_0x9389('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a8df,_0x3bac8b){return function(_0x17c2b9){if(!_0x17c2b9){_0x41a8df['sendStatus'](0x194);}return _0x17c2b9;};}function handleError(_0x18e0a2,_0x9fd43c){_0x9fd43c=_0x9fd43c||0x1f4;return function(_0xe1c965){logger[_0x9389('0x26')](_0xe1c965[_0x9389('0x37')]);if(_0xe1c965[_0x9389('0x38')]){delete _0xe1c965[_0x9389('0x38')];}_0x18e0a2[_0x9389('0x2b')](_0x9fd43c)[_0x9389('0x39')](_0xe1c965);};}exports[_0x9389('0x3a')]=function(_0x28d3e3,_0xe9d9d5){var _0x1ede09={},_0x1614fc={},_0x583f4a={'count':0x0,'rows':[]};var _0x97556c=_[_0x9389('0x3b')](db[_0x9389('0x3c')][_0x9389('0x3d')],function(_0x2c4532){return{'name':_0x2c4532[_0x9389('0x3e')],'type':_0x2c4532[_0x9389('0x3f')][_0x9389('0x40')]};});_0x1614fc['model']=_[_0x9389('0x3b')](_0x97556c,'name');_0x1614fc[_0x9389('0x41')]=_[_0x9389('0x42')](_0x28d3e3[_0x9389('0x41')]);_0x1614fc['filters']=_[_0x9389('0x43')](_0x1614fc[_0x9389('0x44')],_0x1614fc['query']);_0x1ede09['attributes']=_[_0x9389('0x43')](_0x1614fc[_0x9389('0x44')],qs['fields'](_0x28d3e3[_0x9389('0x41')][_0x9389('0x45')]));_0x1ede09[_0x9389('0x46')]=_0x1ede09['attributes'][_0x9389('0x47')]?_0x1ede09[_0x9389('0x46')]:_0x1614fc[_0x9389('0x44')];if(!_0x28d3e3['query']['hasOwnProperty'](_0x9389('0x48'))){_0x1ede09[_0x9389('0x30')]=qs[_0x9389('0x30')](_0x28d3e3[_0x9389('0x41')][_0x9389('0x30')]);_0x1ede09[_0x9389('0x2d')]=qs['offset'](_0x28d3e3[_0x9389('0x41')][_0x9389('0x2d')]);}_0x1ede09['order']=qs['sort'](_0x28d3e3[_0x9389('0x41')][_0x9389('0x49')]);_0x1ede09['where']=qs[_0x9389('0x4a')](_[_0x9389('0x4b')](_0x28d3e3['query'],_0x1614fc['filters']),_0x97556c);if(_0x28d3e3[_0x9389('0x41')][_0x9389('0x4c')]){_0x1ede09['where']=_[_0x9389('0x4d')](_0x1ede09['where'],{'$or':_['map'](_0x97556c,function(_0x56c8c5){if(_0x56c8c5['type']!==_0x9389('0x4e')){var _0x25ae78={};_0x25ae78[_0x56c8c5['name']]={'$like':'%'+_0x28d3e3[_0x9389('0x41')][_0x9389('0x4c')]+'%'};return _0x25ae78;}})});}_0x1ede09=_[_0x9389('0x4d')]({},_0x1ede09,_0x28d3e3['options']);var _0x526dfa={'where':_0x1ede09[_0x9389('0x4f')]};return db[_0x9389('0x3c')][_0x9389('0x2f')](_0x526dfa)[_0x9389('0x20')](function(_0xdf79b0){_0x583f4a['count']=_0xdf79b0;if(_0x28d3e3[_0x9389('0x41')]['includeAll']){_0x1ede09['include']=[{'all':!![]}];}return db[_0x9389('0x3c')][_0x9389('0x50')](_0x1ede09);})[_0x9389('0x20')](function(_0x2d5c34){_0x583f4a['rows']=_0x2d5c34;return _0x583f4a;})[_0x9389('0x20')](respondWithFilteredResult(_0xe9d9d5,_0x1ede09))['catch'](handleError(_0xe9d9d5,null));};exports['show']=function(_0x4723f4,_0x5bc729){var _0x1620fc={'raw':!![],'where':{'id':_0x4723f4[_0x9389('0x51')]['id']}},_0x5a1ad5={};_0x5a1ad5[_0x9389('0x44')]=_['keys'](db[_0x9389('0x3c')][_0x9389('0x3d')]);_0x5a1ad5[_0x9389('0x41')]=_['keys'](_0x4723f4[_0x9389('0x41')]);_0x5a1ad5[_0x9389('0x4a')]=_[_0x9389('0x43')](_0x5a1ad5[_0x9389('0x44')],_0x5a1ad5[_0x9389('0x41')]);_0x1620fc[_0x9389('0x46')]=_[_0x9389('0x43')](_0x5a1ad5['model'],qs[_0x9389('0x45')](_0x4723f4['query'][_0x9389('0x45')]));_0x1620fc[_0x9389('0x46')]=_0x1620fc[_0x9389('0x46')][_0x9389('0x47')]?_0x1620fc['attributes']:_0x5a1ad5[_0x9389('0x44')];if(_0x4723f4[_0x9389('0x41')][_0x9389('0x52')]){_0x1620fc[_0x9389('0x53')]=[{'all':!![]}];}_0x1620fc=_['merge']({},_0x1620fc,_0x4723f4[_0x9389('0x54')]);return db[_0x9389('0x3c')][_0x9389('0x55')](_0x1620fc)[_0x9389('0x20')](handleEntityNotFound(_0x5bc729,null))['then'](respondWithResult(_0x5bc729,null))['catch'](handleError(_0x5bc729,null));};exports[_0x9389('0x56')]=function(_0x887256,_0x5e5b75){return db['WhatsappMessage'][_0x9389('0x56')](_0x887256[_0x9389('0x57')],{})['then'](respondWithResult(_0x5e5b75,0xc9))[_0x9389('0x29')](handleError(_0x5e5b75,null));};exports['update']=function(_0x1c70fc,_0x110476){if(_0x1c70fc[_0x9389('0x57')]['id']){delete _0x1c70fc[_0x9389('0x57')]['id'];}return db[_0x9389('0x3c')][_0x9389('0x55')]({'where':{'id':_0x1c70fc[_0x9389('0x51')]['id']}})['then'](handleEntityNotFound(_0x110476,null))[_0x9389('0x20')](saveUpdates(_0x1c70fc[_0x9389('0x57')],null))['then'](respondWithResult(_0x110476,null))[_0x9389('0x29')](handleError(_0x110476,null));};exports['destroy']=function(_0x11d809,_0x18aca9){return db['WhatsappMessage'][_0x9389('0x55')]({'where':{'id':_0x11d809[_0x9389('0x51')]['id']}})[_0x9389('0x20')](handleEntityNotFound(_0x18aca9,null))[_0x9389('0x20')](removeEntity(_0x18aca9,null))[_0x9389('0x29')](handleError(_0x18aca9,null));};exports['describe']=function(_0x2ebce6,_0x11d540){return db[_0x9389('0x3c')][_0x9389('0x58')]()[_0x9389('0x20')](respondWithResult(_0x11d540,null))[_0x9389('0x29')](handleError(_0x11d540,null));};var interaction_log=require('../../config/logger')(_0x9389('0x59'));exports[_0x9389('0x5a')]=function(_0x42b041,_0x4dabac,_0x3ac80c){var _0x2c5da9={'agent':{},'channel':_0x9389('0x5b')};if(_0x42b041['body']['id']){delete _0x42b041[_0x9389('0x57')]['id'];}_0x42b041[_0x9389('0x57')]['read']=!![];_0x42b041[_0x9389('0x57')]['readAt']=moment()[_0x9389('0x5c')](_0x9389('0x5d'));_0x42b041[_0x9389('0x57')][_0x9389('0x5e')]=_0x42b041['body'][_0x9389('0x5e')]||_0x42b041['user']['id'];_0x2c5da9[_0x9389('0x5f')]['id']=_0x42b041[_0x9389('0x57')][_0x9389('0x5e')];return db[_0x9389('0x3c')]['find']({'where':{'id':_0x42b041[_0x9389('0x51')]['id'],'UserId':null}})[_0x9389('0x20')](handleEntityNotFound(_0x4dabac,null))[_0x9389('0x20')](saveUpdates(_0x42b041[_0x9389('0x57')],null))['then'](function(_0x2e033b){if(_0x2e033b){_0x2c5da9['message']=_0x2e033b[_0x9389('0x60')]({'plain':!![]});return db[_0x9389('0x61')][_0x9389('0x55')]({'where':{'id':_0x2e033b[_0x9389('0x62')]}});}return null;})[_0x9389('0x20')](handleEntityNotFound(_0x4dabac,null))[_0x9389('0x20')](function(_0x74047f){if(_0x74047f){return _0x74047f[_0x9389('0x63')]({'UserId':_0x42b041[_0x9389('0x57')]['UserId'],'read1stAt':_[_0x9389('0x64')](_0x74047f['read1stAt'])?moment()['format'](_0x9389('0x5d')):undefined});}return null;})[_0x9389('0x20')](function(_0x2727a3){if(_0x2727a3){_0x2c5da9[_0x9389('0x65')]=_0x2727a3[_0x9389('0x60')]({'plain':!![]});interaction_log[_0x9389('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x42b041[_0x9389('0x66')]['id'],_0x42b041[_0x9389('0x66')][_0x9389('0x38')],_0x42b041[_0x9389('0x66')][_0x9389('0x67')],_0x2c5da9[_0x9389('0x65')]['id'],_0x42b041[_0x9389('0x57')]?JSON[_0x9389('0x68')](_0x42b041[_0x9389('0x57')]):_0x9389('0x69'));return respondWithRpcPromise(_0x9389('0x6a'),_0x9389('0x6b'),_0x2c5da9);}return null;})[_0x9389('0x20')](function(_0x52056b){var _0x3df7b6=_0x9389('0x6c')+_0x52056b[_0x9389('0x28')][_0x9389('0x6d')];return db[_0x9389('0x6e')][_0x9389('0x41')](_0x3df7b6,{'type':db[_0x9389('0x6f')][_0x9389('0x70')][_0x9389('0x71')],'raw':!![]})[_0x9389('0x20')](function(_0x41ddbb){return _0x41ddbb;});})[_0x9389('0x20')](function(_0x2280d2){if(_0x2280d2){_0x2c5da9['message'][_0x9389('0x72')]=_0x2280d2[0x0];if(!_0x42b041[_0x9389('0x57')]['UserId'])return;return db[_0x9389('0x73')][_0x9389('0x55')]({'where':{'id':_0x42b041[_0x9389('0x57')][_0x9389('0x5e')],'role':'agent'},'attributes':['id',_0x9389('0x38'),_0x9389('0x74'),_0x9389('0x75'),_0x9389('0x76')],'raw':!![]});}return null;})['then'](function(_0x16cf69){if(!_0x16cf69)return null;_0x2c5da9[_0x9389('0x28')][_0x9389('0x5f')]=_0x16cf69;return _0x2c5da9;})[_0x9389('0x20')](function(_0xcf0704){if(_0xcf0704){if(_0x42b041[_0x9389('0x57')][_0x9389('0x77')]){_0x2c5da9['message'][_0x9389('0x78')]=util['format'](_0x9389('0x79'),_0x42b041['user'][_0x9389('0x38')]);_0x2c5da9[_0x9389('0x28')][_0x9389('0x7a')]=_0x2c5da9[_0x9389('0x7a')];_0x2c5da9[_0x9389('0x28')][_0x9389('0x7b')]=_0x2c5da9['channel'];_0x2c5da9[_0x9389('0x28')][_0x9389('0x7c')]=_0x9389('0x5a');return respondWithRpcPromise(_0x9389('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x2c5da9['message']},client9002)[_0x9389('0x20')](function(){return _0x2c5da9;});}return _0x2c5da9;}return null;})['then'](respondWithResult(_0x4dabac,null))[_0x9389('0x29')](handleError(_0x4dabac,null));};var interaction_log=require(_0x9389('0x14'))(_0x9389('0x59'));exports[_0x9389('0x34')]=function(_0x4cc486,_0x21409a,_0x3bc4b2){var _0x1902f1={'agent':{},'channel':_0x9389('0x5b')};if(_0x4cc486[_0x9389('0x57')]['id']){delete _0x4cc486['body']['id'];}_0x4cc486[_0x9389('0x57')][_0x9389('0x5e')]=_0x4cc486['body'][_0x9389('0x5e')]||_0x4cc486[_0x9389('0x66')]['id'];_0x1902f1[_0x9389('0x5f')]['id']=_0x4cc486['body'][_0x9389('0x5e')];return db[_0x9389('0x3c')][_0x9389('0x55')]({'where':{'id':_0x4cc486[_0x9389('0x51')]['id'],'UserId':null}})[_0x9389('0x20')](handleEntityNotFound(_0x21409a,null))['then'](function(_0x54e05e){if(_0x54e05e){_0x1902f1[_0x9389('0x28')]=_0x54e05e[_0x9389('0x60')]({'plain':!![]});return db[_0x9389('0x61')][_0x9389('0x55')]({'where':{'id':_0x54e05e[_0x9389('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x21409a,null))[_0x9389('0x20')](function(_0x176fc2){if(_0x176fc2){_0x1902f1[_0x9389('0x65')]=_0x176fc2[_0x9389('0x60')]({'plain':!![]});interaction_log[_0x9389('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4cc486[_0x9389('0x66')]['id'],_0x4cc486[_0x9389('0x66')]['name'],_0x4cc486[_0x9389('0x66')]['role'],_0x1902f1[_0x9389('0x65')]['id'],_0x4cc486[_0x9389('0x57')]?JSON[_0x9389('0x68')](_0x4cc486[_0x9389('0x57')]):'null');return respondWithRpcPromise(_0x9389('0x7e'),'rejectMessage',_0x1902f1);}return null;})[_0x9389('0x20')](function(_0x3c50c4){var _0x7b686a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c50c4[_0x9389('0x28')][_0x9389('0x6d')];return db['sequelize'][_0x9389('0x41')](_0x7b686a,{'type':db[_0x9389('0x6f')][_0x9389('0x70')][_0x9389('0x71')],'raw':!![]})['then'](function(_0x162940){return _0x162940;});})[_0x9389('0x20')](function(_0x1e60d6){if(_0x1e60d6){_0x1902f1[_0x9389('0x28')][_0x9389('0x72')]=_0x1e60d6[0x0];if(!_0x4cc486[_0x9389('0x57')][_0x9389('0x5e')])return;return db[_0x9389('0x73')][_0x9389('0x55')]({'where':{'id':_0x4cc486[_0x9389('0x57')]['UserId'],'role':_0x9389('0x5f')},'attributes':['id',_0x9389('0x38'),_0x9389('0x74'),_0x9389('0x75'),_0x9389('0x76')],'raw':!![]});}return null;})['then'](function(_0x113266){if(!_0x113266)return null;_0x1902f1['message'][_0x9389('0x5f')]=_0x113266;return _0x1902f1;})[_0x9389('0x20')](function(_0x3b3e86){if(_0x3b3e86){_0x3b3e86[_0x9389('0x28')]['interface']=util[_0x9389('0x5c')](_0x9389('0x79'),_0x4cc486[_0x9389('0x66')][_0x9389('0x38')]);_0x3b3e86['message'][_0x9389('0x7a')]=_0x1902f1[_0x9389('0x7a')];_0x3b3e86[_0x9389('0x28')][_0x9389('0x7b')]=_0x1902f1['channel'];_0x3b3e86['message']['event']=_0x9389('0x34');respondWithRpcPromise(_0x9389('0x7d'),_0x9389('0x7d'),{'event':'rejectmessage','message':_0x3b3e86['message']},client9002);return _0x1902f1;}return null;})[_0x9389('0x20')](respondWithResult(_0x21409a,null))[_0x9389('0x29')](handleError(_0x21409a,null));};exports['status']=function(_0x3a7db0,_0xd493e3,_0x2c59fb){if(_0x3a7db0[_0x9389('0x57')]['id']){delete _0x3a7db0['body']['id'];}var _0x55b149;return db[_0x9389('0x3c')][_0x9389('0x55')]({'where':{'id':_0x3a7db0[_0x9389('0x51')]['id']}})[_0x9389('0x20')](handleEntityNotFound(_0xd493e3,null))[_0x9389('0x20')](function(_0x49f00f){if(_0x49f00f){_0x55b149=_0x49f00f;return db[_0x9389('0x7f')]['find']({'where':{'id':_0x49f00f['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0xd493e3,null))['then'](function(_0x2fe1a5){if(_0x2fe1a5){logger[_0x9389('0x24')](_0x9389('0x80'),_0x9389('0x2b'),_0x9389('0x81'),_0x2fe1a5['type'],util[_0x9389('0x82')](_0x3a7db0[_0x9389('0x57')],{'showHidden':![],'depth':null}));switch(_0x2fe1a5['type']){case'twilio':if(_0x3a7db0[_0x9389('0x57')]['MessageSid']&&_0x3a7db0['body'][_0x9389('0x83')]===_0x55b149[_0x9389('0x84')]&&_0x3a7db0[_0x9389('0x57')][_0x9389('0x85')]&&_0x3a7db0['body'][_0x9389('0x85')]===_0x9389('0x86')){return _0x55b149[_0x9389('0x63')]({'read':!![]});}else{logger[_0x9389('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x9389('0x82')](_0x3a7db0[_0x9389('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x55b149;}})['then'](respondWithResult(_0xd493e3,null))['catch'](handleError(_0xd493e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 590ecc4..670a03d 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 _0x41bb=['../../mysqldb','setMaxListeners','update','remove','emit','events'];(function(_0x175c42,_0x35cd40){var _0x483848=function(_0x9b95ae){while(--_0x9b95ae){_0x175c42['push'](_0x175c42['shift']());}};_0x483848(++_0x35cd40);}(_0x41bb,0xc5));var _0xb41b=function(_0x19da32,_0x25c744){_0x19da32=_0x19da32-0x0;var _0xfc20be=_0x41bb[_0x19da32];return _0xfc20be;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var WhatsappMessage=require(_0xb41b('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb41b('0x3'),'afterDestroy':_0xb41b('0x4')};function emitEvent(_0x148333){return function(_0x448c8e,_0x4ee21b,_0x12cea3){WhatsappMessageEvents[_0xb41b('0x5')](_0x148333+':'+_0x448c8e['id'],_0x448c8e);WhatsappMessageEvents[_0xb41b('0x5')](_0x148333,_0x448c8e);_0x12cea3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x93e6=['hasOwnProperty','events','setMaxListeners','update','emit'];(function(_0x329ba0,_0x2e889b){var _0x526123=function(_0x42656e){while(--_0x42656e){_0x329ba0['push'](_0x329ba0['shift']());}};_0x526123(++_0x2e889b);}(_0x93e6,0x11e));var _0x693e=function(_0x19a44e,_0x1f05dc){_0x19a44e=_0x19a44e-0x0;var _0x36e8e3=_0x93e6[_0x19a44e];return _0x36e8e3;};'use strict';var EventEmitter=require(_0x693e('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x693e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x693e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x313261){return function(_0x3fb653,_0x17cf23,_0x53e728){WhatsappMessageEvents[_0x693e('0x3')](_0x313261+':'+_0x3fb653['id'],_0x3fb653);WhatsappMessageEvents[_0x693e('0x3')](_0x313261,_0x3fb653);_0x53e728(null);};}for(var e in events){if(events[_0x693e('0x4')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index baa0fb6..f1aca11 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 _0x1ca5=['define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','toLowerCase','direction','out','isNil','findOne','then','update','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ca5,0x11d));var _0x51ca=function(_0x5b5dac,_0x87ee5d){_0x5b5dac=_0x5b5dac-0x0;var _0x3ce5a5=_0x1ca5[_0x5b5dac];return _0x3ce5a5;};'use strict';var _=require(_0x51ca('0x0'));var util=require(_0x51ca('0x1'));var logger=require(_0x51ca('0x2'))(_0x51ca('0x3'));var moment=require(_0x51ca('0x4'));var BPromise=require(_0x51ca('0x5'));var rp=require('request-promise');var fetch=require(_0x51ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51ca('0x7'));var config=require(_0x51ca('0x8'));var attributes=require(_0x51ca('0x9'));module['exports']=function(_0x296a69,_0x4e0c84){return _0x296a69[_0x51ca('0xa')](_0x51ca('0xb'),attributes,{'tableName':_0x51ca('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x51ca('0xd')]},{'name':_0x51ca('0xe'),'fields':[_0x51ca('0xf')],'type':_0x51ca('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x609c23,_0x1f478c,_0x473ed5){var _0x3a519e=_0x296a69['models'];var _0x461fc7=_0x609c23['get']({'plain':!![]});if(_0x461fc7['direction'][_0x51ca('0x11')]()==='in'||_0x461fc7[_0x51ca('0x12')][_0x51ca('0x11')]()===_0x51ca('0x13')&&!_0x461fc7['secret']&&!_[_0x51ca('0x14')](_0x461fc7['UserId'])){_0x3a519e['WhatsappInteraction'][_0x51ca('0x15')]({'where':{'id':_0x461fc7['WhatsappInteractionId']}})[_0x51ca('0x16')](function(_0x2a8237){if(_0x2a8237){_0x2a8237[_0x51ca('0x17')]({'lastMsgAt':_0x461fc7[_0x51ca('0x18')],'lastMsgDirection':_0x461fc7[_0x51ca('0x12')]['toLowerCase']()});}})[_0x51ca('0x19')](function(_0xd1663f){console['error'](_0xd1663f);});}if(_0x461fc7[_0x51ca('0x12')]===_0x51ca('0x13')&&!_0x461fc7[_0x51ca('0x1a')]){var _0x309ca6;_0x3a519e[_0x51ca('0x1b')][_0x51ca('0x1c')]({'where':{'id':_0x461fc7[_0x51ca('0x1d')]},'raw':!![]})['then'](function(_0x1434bc){_0x309ca6=_0x1434bc;if(_0x309ca6&&_0x309ca6[_0x51ca('0x1e')]){switch(_0x309ca6[_0x51ca('0x1e')]){case'twilio':var _0xefdf7d=require(_0x51ca('0x1f'));if(_0x309ca6[_0x51ca('0x20')]&&_0x309ca6[_0x51ca('0x21')]&&_0x309ca6['phone']){var _0xc1e0e2=new _0xefdf7d(_0x309ca6['accountSid'],_0x309ca6['authToken']);_0xc1e0e2[_0x51ca('0x22')][_0x51ca('0x23')]({'body':_0x461fc7['body'],'to':_0x51ca('0x24')+_0x461fc7['phone'],'from':_0x51ca('0x24')+_0x309ca6[_0x51ca('0x25')],'statusCallback':_0x309ca6[_0x51ca('0x26')]+_0x51ca('0x27')+_0x461fc7['id']+_0x51ca('0x28')+_0x309ca6['token']})[_0x51ca('0x16')](function(_0xa22f48){if(_0xa22f48[_0x51ca('0x29')]){return _0x609c23[_0x51ca('0x17')]({'messageId':_0xa22f48[_0x51ca('0x29')]});}})[_0x51ca('0x19')](function(_0x19fcab){logger[_0x51ca('0x2a')](_0x51ca('0x2b'),'afterCreate','twilio',util[_0x51ca('0x2c')](_0x19fcab,{'showHidden':![],'depth':null}));});}else{logger[_0x51ca('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x51ca('0x2d'),_0x51ca('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x51ca('0x2e'):var _0x9bd9fc=_0x309ca6[_0x51ca('0x20')];var _0x3f2392=_0x309ca6[_0x51ca('0x21')];var _0x36143e=_0x309ca6[_0x51ca('0x2f')]+_0x51ca('0x30')+_0x9bd9fc+'/messages/';var _0x4f057e={'to':[_0x461fc7[_0x51ca('0x25')]],'message':{'type':_0x51ca('0x31'),'text':_0x461fc7['body']}};var _0x554129={'method':_0x51ca('0x32'),'uri':_0x36143e,'headers':{'Authorization':_0x51ca('0x33')+_0x3f2392,'Content-Type':_0x51ca('0x34')},'body':_0x4f057e,'json':!![]};rp(_0x554129)['then'](function(_0x3e9411){if(_0x3e9411[_0x51ca('0x35')][0x0][_0x51ca('0x36')]){return _0x609c23[_0x51ca('0x17')]({'messageId':_0x3e9411[_0x51ca('0x35')][0x0]['message_id']});}})[_0x51ca('0x19')](function(_0x28f660){logger[_0x51ca('0x37')]('WhatsappMessage,\x20%s',_0x28f660);});break;}}})[_0x51ca('0x38')](function(){_0x473ed5();});}else{_0x473ed5();}}},'charset':_0x51ca('0x39'),'collate':_0x51ca('0x3a')});}; \ No newline at end of file +var _0xfbd7=['message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','findOne','then','update','createdAt','catch','error','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','create','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','/whatsapp/v1/','/messages/','POST','application/json','statuses'];(function(_0x3ded10,_0x49dbb9){var _0x4325e2=function(_0x5aca6a){while(--_0x5aca6a){_0x3ded10['push'](_0x3ded10['shift']());}};_0x4325e2(++_0x49dbb9);}(_0xfbd7,0x114));var _0x7fbd=function(_0x44d45a,_0x150d47){_0x44d45a=_0x44d45a-0x0;var _0x2e6c05=_0xfbd7[_0x44d45a];return _0x2e6c05;};'use strict';var _=require(_0x7fbd('0x0'));var util=require(_0x7fbd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7fbd('0x2'));var BPromise=require(_0x7fbd('0x3'));var rp=require(_0x7fbd('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x7fbd('0x5'));var rimraf=require('rimraf');var config=require(_0x7fbd('0x6'));var attributes=require(_0x7fbd('0x7'));module['exports']=function(_0x5b103c,_0x4561ca){return _0x5b103c[_0x7fbd('0x8')](_0x7fbd('0x9'),attributes,{'tableName':_0x7fbd('0xa'),'paranoid':![],'indexes':[{'name':_0x7fbd('0xb'),'fields':[_0x7fbd('0xb')]},{'name':_0x7fbd('0xc'),'fields':[_0x7fbd('0xd')],'type':_0x7fbd('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43e7d2,_0x5ac391,_0x3ffb8f){var _0x4b2458=_0x5b103c['models'];var _0x10ba64=_0x43e7d2[_0x7fbd('0xf')]({'plain':!![]});if(_0x10ba64[_0x7fbd('0x10')]['toLowerCase']()==='in'||_0x10ba64[_0x7fbd('0x10')][_0x7fbd('0x11')]()===_0x7fbd('0x12')&&!_0x10ba64[_0x7fbd('0x13')]&&!_['isNil'](_0x10ba64[_0x7fbd('0x14')])){_0x4b2458['WhatsappInteraction'][_0x7fbd('0x15')]({'where':{'id':_0x10ba64['WhatsappInteractionId']}})[_0x7fbd('0x16')](function(_0x57d9cc){if(_0x57d9cc){_0x57d9cc[_0x7fbd('0x17')]({'lastMsgAt':_0x10ba64[_0x7fbd('0x18')],'lastMsgDirection':_0x10ba64[_0x7fbd('0x10')][_0x7fbd('0x11')]()});}})[_0x7fbd('0x19')](function(_0x257a9a){console[_0x7fbd('0x1a')](_0x257a9a);});}if(_0x10ba64[_0x7fbd('0x10')]===_0x7fbd('0x12')&&!_0x10ba64[_0x7fbd('0x13')]){var _0x3324a2;_0x4b2458['WhatsappAccount'][_0x7fbd('0x1b')]({'where':{'id':_0x10ba64[_0x7fbd('0x1c')]},'raw':!![]})['then'](function(_0x211805){_0x3324a2=_0x211805;if(_0x3324a2&&_0x3324a2[_0x7fbd('0x1d')]){switch(_0x3324a2[_0x7fbd('0x1d')]){case _0x7fbd('0x1e'):var _0x340d0a=require(_0x7fbd('0x1e'));if(_0x3324a2[_0x7fbd('0x1f')]&&_0x3324a2['authToken']&&_0x3324a2[_0x7fbd('0x20')]){var _0xbc9a46=new _0x340d0a(_0x3324a2[_0x7fbd('0x1f')],_0x3324a2[_0x7fbd('0x21')]);_0xbc9a46['messages'][_0x7fbd('0x22')]({'body':_0x10ba64[_0x7fbd('0xd')],'to':_0x7fbd('0x23')+_0x10ba64[_0x7fbd('0x20')],'from':_0x7fbd('0x23')+_0x3324a2[_0x7fbd('0x20')],'statusCallback':_0x3324a2[_0x7fbd('0x24')]+'/api/whatsapp/messages/'+_0x10ba64['id']+_0x7fbd('0x25')+_0x3324a2[_0x7fbd('0x26')]})[_0x7fbd('0x16')](function(_0x4f36d0){if(_0x4f36d0[_0x7fbd('0x27')]){return _0x43e7d2['update']({'messageId':_0x4f36d0[_0x7fbd('0x27')]});}})['catch'](function(_0x150bc3){logger[_0x7fbd('0x1a')](_0x7fbd('0x28'),_0x7fbd('0x29'),_0x7fbd('0x1e'),util['inspect'](_0x150bc3,{'showHidden':![],'depth':null}));});}else{logger[_0x7fbd('0x1a')](_0x7fbd('0x28'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x7fbd('0x2a'):var _0x1f2207=_0x3324a2['accountSid'];var _0x500aeb=_0x3324a2[_0x7fbd('0x21')];var _0x40236d=_0x3324a2['baseUrl']+_0x7fbd('0x2b')+_0x1f2207+_0x7fbd('0x2c');var _0x3a927e={'to':[_0x10ba64[_0x7fbd('0x20')]],'message':{'type':'text','text':_0x10ba64[_0x7fbd('0xd')]}};var _0x38a77c={'method':_0x7fbd('0x2d'),'uri':_0x40236d,'headers':{'Authorization':'Bearer\x20'+_0x500aeb,'Content-Type':_0x7fbd('0x2e')},'body':_0x3a927e,'json':!![]};rp(_0x38a77c)[_0x7fbd('0x16')](function(_0x2d1268){if(_0x2d1268[_0x7fbd('0x2f')][0x0][_0x7fbd('0x30')]){return _0x43e7d2[_0x7fbd('0x17')]({'messageId':_0x2d1268[_0x7fbd('0x2f')][0x0][_0x7fbd('0x30')]});}})[_0x7fbd('0x19')](function(_0x3d1878){logger[_0x7fbd('0x31')](_0x7fbd('0x32'),_0x3d1878);});break;}}})[_0x7fbd('0x33')](function(){_0x3ffb8f();});}else{_0x3ffb8f();}}},'charset':_0x7fbd('0x34'),'collate':_0x7fbd('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 7049c12..c35c2f6 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 _0x1c9b=['request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','register'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x1c9b,0x188));var _0xb1c9=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x1c9b[_0x285824];return _0x311d7e;};'use strict';var _=require(_0xb1c9('0x0'));var util=require(_0xb1c9('0x1'));var moment=require(_0xb1c9('0x2'));var BPromise=require(_0xb1c9('0x3'));var rs=require(_0xb1c9('0x4'));var fs=require('fs');var Redis=require(_0xb1c9('0x5'));var db=require(_0xb1c9('0x6'))['db'];var utils=require(_0xb1c9('0x7'));var logger=require(_0xb1c9('0x8'))(_0xb1c9('0x9'));var config=require('../../config/environment');var jayson=require(_0xb1c9('0xa'));var client=jayson['client'][_0xb1c9('0xb')]({'port':0x232a});config[_0xb1c9('0xc')]=_[_0xb1c9('0xd')](config[_0xb1c9('0xc')],{'host':_0xb1c9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1c9('0xc')]));require('./whatsappMessage.socket')[_0xb1c9('0xf')](socket);function respondWithRpcPromise(_0x19b39e,_0x56b279,_0x49e88a){return new BPromise(function(_0x4db4ac,_0x4048fb){return client[_0xb1c9('0x10')](_0x19b39e,_0x49e88a)[_0xb1c9('0x11')](function(_0x3bbe4b){logger[_0xb1c9('0x12')](_0xb1c9('0x13'),_0x56b279,'request\x20sent');logger[_0xb1c9('0x14')](_0xb1c9('0x15'),_0x56b279,_0xb1c9('0x16'),JSON['stringify'](_0x3bbe4b));if(_0x3bbe4b[_0xb1c9('0x17')]){if(_0x3bbe4b[_0xb1c9('0x17')][_0xb1c9('0x18')]===0x1f4){logger[_0xb1c9('0x17')](_0xb1c9('0x13'),_0x56b279,_0x3bbe4b[_0xb1c9('0x17')][_0xb1c9('0x19')]);return _0x4048fb(_0x3bbe4b[_0xb1c9('0x17')][_0xb1c9('0x19')]);}logger[_0xb1c9('0x17')](_0xb1c9('0x13'),_0x56b279,_0x3bbe4b[_0xb1c9('0x17')][_0xb1c9('0x19')]);return _0x4db4ac(_0x3bbe4b[_0xb1c9('0x17')][_0xb1c9('0x19')]);}else{logger['info'](_0xb1c9('0x13'),_0x56b279,_0xb1c9('0x16'));_0x4db4ac(_0x3bbe4b['result']['message']);}})[_0xb1c9('0x1a')](function(_0x15cb1e){logger['error'](_0xb1c9('0x13'),_0x56b279,_0x15cb1e);_0x4048fb(_0x15cb1e);});});}exports[_0xb1c9('0x1b')]=function(_0x389110){var _0x578e24=this;return new Promise(function(_0x38d4c5,_0x27ce72){return db[_0xb1c9('0x1c')][_0xb1c9('0x1d')](_0x389110[_0xb1c9('0x1e')],{'raw':_0x389110['options']?_0x389110[_0xb1c9('0x1f')][_0xb1c9('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x537362){logger['info'](_0xb1c9('0x1b'),_0x389110);logger[_0xb1c9('0x14')](_0xb1c9('0x1b'),_0x389110,JSON[_0xb1c9('0x21')](_0x537362));_0x38d4c5(_0x537362);})[_0xb1c9('0x1a')](function(_0x194e8f){logger[_0xb1c9('0x17')](_0xb1c9('0x1b'),_0x194e8f[_0xb1c9('0x19')],_0x389110);_0x27ce72(_0x578e24[_0xb1c9('0x17')](0x1f4,_0x194e8f['message']));});});}; \ No newline at end of file +var _0x8b97=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8b97,0x1a9));var _0x78b9=function(_0x427ece,_0x5ce65b){_0x427ece=_0x427ece-0x0;var _0x15d0ed=_0x8b97[_0x427ece];return _0x15d0ed;};'use strict';var _=require('lodash');var util=require(_0x78b9('0x0'));var moment=require('moment');var BPromise=require(_0x78b9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78b9('0x2'))['db'];var utils=require(_0x78b9('0x3'));var logger=require(_0x78b9('0x4'))(_0x78b9('0x5'));var config=require(_0x78b9('0x6'));var jayson=require(_0x78b9('0x7'));var client=jayson[_0x78b9('0x8')]['http']({'port':0x232a});config[_0x78b9('0x9')]=_[_0x78b9('0xa')](config[_0x78b9('0x9')],{'host':_0x78b9('0xb'),'port':0x18eb});var socket=require(_0x78b9('0xc'))(new Redis(config[_0x78b9('0x9')]));require(_0x78b9('0xd'))[_0x78b9('0xe')](socket);function respondWithRpcPromise(_0x181705,_0x320e4a,_0xb3c386){return new BPromise(function(_0x5f3697,_0x15e076){return client[_0x78b9('0xf')](_0x181705,_0xb3c386)[_0x78b9('0x10')](function(_0x21be88){logger[_0x78b9('0x11')](_0x78b9('0x12'),_0x320e4a,_0x78b9('0x13'));logger[_0x78b9('0x14')](_0x78b9('0x15'),_0x320e4a,'request\x20sent',JSON[_0x78b9('0x16')](_0x21be88));if(_0x21be88[_0x78b9('0x17')]){if(_0x21be88['error'][_0x78b9('0x18')]===0x1f4){logger[_0x78b9('0x17')](_0x78b9('0x12'),_0x320e4a,_0x21be88[_0x78b9('0x17')]['message']);return _0x15e076(_0x21be88[_0x78b9('0x17')][_0x78b9('0x19')]);}logger[_0x78b9('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x320e4a,_0x21be88[_0x78b9('0x17')][_0x78b9('0x19')]);return _0x5f3697(_0x21be88[_0x78b9('0x17')][_0x78b9('0x19')]);}else{logger['info'](_0x78b9('0x12'),_0x320e4a,_0x78b9('0x13'));_0x5f3697(_0x21be88['result'][_0x78b9('0x19')]);}})[_0x78b9('0x1a')](function(_0x458ad7){logger[_0x78b9('0x17')](_0x78b9('0x12'),_0x320e4a,_0x458ad7);_0x15e076(_0x458ad7);});});}exports[_0x78b9('0x1b')]=function(_0xcb88ff){var _0x27d3fd=this;return new Promise(function(_0x28ed66,_0xc8e98f){return db[_0x78b9('0x1c')][_0x78b9('0x1d')](_0xcb88ff[_0x78b9('0x1e')],{'raw':_0xcb88ff[_0x78b9('0x1f')]?_0xcb88ff[_0x78b9('0x1f')][_0x78b9('0x20')]===undefined?!![]:![]:!![]})[_0x78b9('0x10')](function(_0x4aca01){logger[_0x78b9('0x11')]('CreateWhatsappMessage',_0xcb88ff);logger[_0x78b9('0x14')](_0x78b9('0x1b'),_0xcb88ff,JSON[_0x78b9('0x16')](_0x4aca01));_0x28ed66(_0x4aca01);})['catch'](function(_0x5916a2){logger['error'](_0x78b9('0x1b'),_0x5916a2['message'],_0xcb88ff);_0xc8e98f(_0x27d3fd[_0x78b9('0x17')](0x1f4,_0x5916a2[_0x78b9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 8416677..74bc98e 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 _0xcfb8=['save','update','emit','removeListener','register'];(function(_0x4d80cc,_0x770848){var _0x6f1103=function(_0x1557b6){while(--_0x1557b6){_0x4d80cc['push'](_0x4d80cc['shift']());}};_0x6f1103(++_0x770848);}(_0xcfb8,0x14f));var _0x8cfb=function(_0x588120,_0x56b478){_0x588120=_0x588120-0x0;var _0x16955d=_0xcfb8[_0x588120];return _0x16955d;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x8cfb('0x0'),'remove',_0x8cfb('0x1')];function createListener(_0x354f2c,_0x579a40){return function(_0x1116fb){_0x579a40[_0x8cfb('0x2')](_0x354f2c,_0x1116fb);};}function removeListener(_0x2af890,_0x18b6c9){return function(){WhatsappMessageEvents[_0x8cfb('0x3')](_0x2af890,_0x18b6c9);};}exports[_0x8cfb('0x4')]=function(_0x453c95){for(var _0x553f13=0x0,_0x42b247=events['length'];_0x553f13<_0x42b247;_0x553f13++){var _0x478534=events[_0x553f13];var _0x135946=createListener('whatsappMessage:'+_0x478534,_0x453c95);WhatsappMessageEvents['on'](_0x478534,_0x135946);}}; \ No newline at end of file +var _0x0a8e=['remove','removeListener','register','whatsappMessage:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a8e,0x194));var _0xe0a8=function(_0x4610f4,_0x429c02){_0x4610f4=_0x4610f4-0x0;var _0x6ac3de=_0x0a8e[_0x4610f4];return _0x6ac3de;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xe0a8('0x0'),_0xe0a8('0x1'),'update'];function createListener(_0x2b1382,_0x125f98){return function(_0x3362ba){_0x125f98['emit'](_0x2b1382,_0x3362ba);};}function removeListener(_0x47a40f,_0x1a81fb){return function(){WhatsappMessageEvents[_0xe0a8('0x2')](_0x47a40f,_0x1a81fb);};}exports[_0xe0a8('0x3')]=function(_0x201ddf){for(var _0x43042f=0x0,_0x491049=events['length'];_0x43042f<_0x491049;_0x43042f++){var _0x465bb0=events[_0x43042f];var _0x3ed3d9=createListener(_0xe0a8('0x4')+_0x465bb0,_0x201ddf);WhatsappMessageEvents['on'](_0x465bb0,_0x3ed3d9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index dcefb0f..34a81b3 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 _0x33ac=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','post','create','put','update','delete','/:id','removeTeams','removeAgents','exports','util','express'];(function(_0x81bb80,_0x515709){var _0x2ac870=function(_0x373114){while(--_0x373114){_0x81bb80['push'](_0x81bb80['shift']());}};_0x2ac870(++_0x515709);}(_0x33ac,0x1f2));var _0xc33a=function(_0x33c527,_0x2d0a6a){_0x33c527=_0x33c527-0x0;var _0xeea745=_0x33ac[_0x33c527];return _0xeea745;};'use strict';var multer=require('multer');var util=require(_0xc33a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc33a('0x1'));var router=express[_0xc33a('0x2')]();var fs_extra=require(_0xc33a('0x3'));var auth=require(_0xc33a('0x4'));var interaction=require(_0xc33a('0x5'));var config=require(_0xc33a('0x6'));var controller=require(_0xc33a('0x7'));router[_0xc33a('0x8')]('/',auth[_0xc33a('0x9')](),controller['index']);router['get'](_0xc33a('0xa'),auth[_0xc33a('0x9')](),controller['describe']);router[_0xc33a('0x8')]('/:id',auth[_0xc33a('0x9')](),controller[_0xc33a('0xb')]);router[_0xc33a('0x8')](_0xc33a('0xc'),auth[_0xc33a('0x9')](),controller[_0xc33a('0xd')]);router[_0xc33a('0x8')](_0xc33a('0xe'),auth[_0xc33a('0x9')](),controller['getTeams']);router['get'](_0xc33a('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0xc33a('0x10')]('/',auth[_0xc33a('0x9')](),controller[_0xc33a('0x11')]);router[_0xc33a('0x10')](_0xc33a('0xe'),auth[_0xc33a('0x9')](),controller['addTeams']);router[_0xc33a('0x10')](_0xc33a('0xf'),auth[_0xc33a('0x9')](),controller['addAgents']);router[_0xc33a('0x12')]('/:id',auth[_0xc33a('0x9')](),controller[_0xc33a('0x13')]);router[_0xc33a('0x14')](_0xc33a('0x15'),auth[_0xc33a('0x9')](),controller['destroy']);router['delete'](_0xc33a('0xe'),auth[_0xc33a('0x9')](),controller[_0xc33a('0x16')]);router[_0xc33a('0x14')](_0xc33a('0xf'),auth[_0xc33a('0x9')](),controller[_0xc33a('0x17')]);module[_0xc33a('0x18')]=router; \ No newline at end of file +var _0x501d=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','create','post','addTeams','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util'];(function(_0x4755c6,_0x5722b5){var _0x5908c6=function(_0x481a2d){while(--_0x481a2d){_0x4755c6['push'](_0x4755c6['shift']());}};_0x5908c6(++_0x5722b5);}(_0x501d,0x94));var _0xd501=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x501d[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xd501('0x0'));var util=require(_0xd501('0x1'));var path=require(_0xd501('0x2'));var timeout=require('connect-timeout');var express=require(_0xd501('0x3'));var router=express[_0xd501('0x4')]();var fs_extra=require(_0xd501('0x5'));var auth=require(_0xd501('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd501('0x7'));var controller=require(_0xd501('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd501('0x9')]);router[_0xd501('0xa')](_0xd501('0xb'),auth[_0xd501('0xc')](),controller['describe']);router[_0xd501('0xa')](_0xd501('0xd'),auth[_0xd501('0xc')](),controller[_0xd501('0xe')]);router[_0xd501('0xa')](_0xd501('0xf'),auth[_0xd501('0xc')](),controller[_0xd501('0x10')]);router[_0xd501('0xa')](_0xd501('0x11'),auth[_0xd501('0xc')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xd501('0x12')]);router['post']('/',auth[_0xd501('0xc')](),controller[_0xd501('0x13')]);router[_0xd501('0x14')](_0xd501('0x11'),auth[_0xd501('0xc')](),controller[_0xd501('0x15')]);router[_0xd501('0x14')]('/:id/users',auth[_0xd501('0xc')](),controller['addAgents']);router[_0xd501('0x16')](_0xd501('0xd'),auth['isAuthenticated'](),controller[_0xd501('0x17')]);router[_0xd501('0x18')](_0xd501('0xd'),auth['isAuthenticated'](),controller[_0xd501('0x19')]);router[_0xd501('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd501('0x1a')]);router[_0xd501('0x18')](_0xd501('0x1b'),auth[_0xd501('0xc')](),controller[_0xd501('0x1c')]);module[_0xd501('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index e85d898..d8d865d 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 _0xfbb4=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfbb4,0x186));var _0x4fbb=function(_0x530fb2,_0x4c7ac5){_0x530fb2=_0x530fb2-0x0;var _0x30f19f=_0xfbb4[_0x530fb2];return _0x30f19f;};'use strict';var Sequelize=require(_0x4fbb('0x0'));module[_0x4fbb('0x1')]={'name':{'type':Sequelize[_0x4fbb('0x2')],'unique':_0x4fbb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4fbb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4fbb('0x5')](_0x4fbb('0x6'),_0x4fbb('0x7'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1c4=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x3dc7b6,_0x5bc922){_0x3dc7b6=_0x3dc7b6-0x0;var _0x349a14=_0xc1c4[_0x3dc7b6];return _0x349a14;};'use strict';var Sequelize=require(_0x4c1c('0x0'));module[_0x4c1c('0x1')]={'name':{'type':Sequelize[_0x4c1c('0x2')],'unique':_0x4c1c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4c1c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c1c('0x5')](_0x4c1c('0x6'),'beepall',_0x4c1c('0x7'))},'description':{'type':Sequelize[_0x4c1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 366c72e..7e62637 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 _0x98ae=['sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','isEmpty','omit','spread','userWhatsappQueue:save','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../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','./whatsappQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','end','error','stack','map','WhatsappQueue','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','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','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','options','User','findAndCountAll','UserId','createdAt','format','%s/%s','SIP','whatsappPause','updatedAt','getTeams','Team','pick','addTeams','ids','Agents','interface','flatMap'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x98ae,0x9f));var _0xe98a=function(_0x511f31,_0x1da168){_0x511f31=_0x511f31-0x0;var _0x36d0d2=_0x98ae[_0x511f31];return _0x36d0d2;};'use strict';var emlformat=require(_0xe98a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe98a('0x1'));var rp=require(_0xe98a('0x2'));var moment=require(_0xe98a('0x3'));var BPromise=require(_0xe98a('0x4'));var Mustache=require(_0xe98a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe98a('0x6'));var fs=require('fs');var fs_extra=require(_0xe98a('0x7'));var _=require(_0xe98a('0x8'));var squel=require(_0xe98a('0x9'));var crypto=require(_0xe98a('0xa'));var jsforce=require(_0xe98a('0xb'));var deskjs=require(_0xe98a('0xc'));var toCsv=require(_0xe98a('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe98a('0xe'));var qs=require(_0xe98a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe98a('0x10'));var logger=require(_0xe98a('0x11'))(_0xe98a('0x12'));var utils=require(_0xe98a('0x13'));var config=require(_0xe98a('0x14'));var licenseUtil=require(_0xe98a('0x15'));var db=require(_0xe98a('0x16'))['db'];config['redis']=_[_0xe98a('0x17')](config[_0xe98a('0x18')],{'host':_0xe98a('0x19'),'port':0x18eb});var socket=require(_0xe98a('0x1a'))(new Redis(config[_0xe98a('0x18')]));require(_0xe98a('0x1b'))['register'](socket);function respondWithStatusCode(_0x4a4f12,_0x666318){_0x666318=_0x666318||0xcc;return function(_0x40ea3a){if(_0x40ea3a){return _0x4a4f12[_0xe98a('0x1c')](_0x666318);}return _0x4a4f12[_0xe98a('0x1d')](_0x666318)['end']();};}function respondWithResult(_0x5cd0fb,_0x5cdd01){_0x5cdd01=_0x5cdd01||0xc8;return function(_0x44981a){if(_0x44981a){return _0x5cd0fb['status'](_0x5cdd01)[_0xe98a('0x1e')](_0x44981a);}};}function respondWithFilteredResult(_0x12281c,_0x3b4576){return function(_0x97ca7c){if(_0x97ca7c){var _0x1f0b22=typeof _0x3b4576[_0xe98a('0x1f')]===_0xe98a('0x20')&&typeof _0x3b4576[_0xe98a('0x21')]===_0xe98a('0x20');var _0x26127c=_0x97ca7c[_0xe98a('0x22')];var _0x22deee=_0x1f0b22?0x0:_0x3b4576[_0xe98a('0x1f')];var _0x405ea8=_0x1f0b22?_0x97ca7c[_0xe98a('0x22')]:_0x3b4576[_0xe98a('0x1f')]+_0x3b4576[_0xe98a('0x21')];var _0x1b55e9;if(_0x405ea8>=_0x26127c){_0x405ea8=_0x26127c;_0x1b55e9=0xc8;}else{_0x1b55e9=0xce;}_0x12281c[_0xe98a('0x1d')](_0x1b55e9);return _0x12281c[_0xe98a('0x23')](_0xe98a('0x24'),_0x22deee+'-'+_0x405ea8+'/'+_0x26127c)[_0xe98a('0x1e')](_0x97ca7c);}return null;};}function patchUpdates(_0x596062){return function(_0x262cf1){try{jsonpatch['apply'](_0x262cf1,_0x596062,!![]);}catch(_0x4b6544){return BPromise[_0xe98a('0x25')](_0x4b6544);}return _0x262cf1['save']();};}function saveUpdates(_0x5cdcc2,_0x553124){return function(_0x5b95ae){if(_0x5b95ae){return _0x5b95ae[_0xe98a('0x26')](_0x5cdcc2)[_0xe98a('0x27')](function(_0x14026d){return _0x14026d;});}return null;};}function removeEntity(_0x5f007f,_0x554594){return function(_0xde9880){if(_0xde9880){return _0xde9880['destroy']()['then'](function(){var _0x289dd8=_0xde9880[_0xe98a('0x28')]({'plain':!![]});var _0x5ecdfc=_0xe98a('0x29');return db[_0xe98a('0x2a')][_0xe98a('0x2b')]({'where':{'type':_0x5ecdfc,'resourceId':_0x289dd8['id']}})[_0xe98a('0x27')](function(){return _0xde9880;});})[_0xe98a('0x27')](function(){_0x5f007f[_0xe98a('0x1d')](0xcc)[_0xe98a('0x2c')]();});}};}function handleEntityNotFound(_0x3ce634,_0x12123a){return function(_0x5bbddb){if(!_0x5bbddb){_0x3ce634[_0xe98a('0x1c')](0x194);}return _0x5bbddb;};}function handleError(_0x55402c,_0x3ef2ee){_0x3ef2ee=_0x3ef2ee||0x1f4;return function(_0x33b60e){logger[_0xe98a('0x2d')](_0x33b60e[_0xe98a('0x2e')]);if(_0x33b60e['name']){delete _0x33b60e['name'];}_0x55402c[_0xe98a('0x1d')](_0x3ef2ee)['send'](_0x33b60e);};}exports['index']=function(_0x222b97,_0x1e7102){var _0x4e6135={},_0x1e4275={},_0x1b709a={'count':0x0,'rows':[]};var _0x40e53b=_[_0xe98a('0x2f')](db[_0xe98a('0x30')][_0xe98a('0x31')],function(_0x471d2b){return{'name':_0x471d2b['fieldName'],'type':_0x471d2b[_0xe98a('0x32')][_0xe98a('0x33')]};});_0x1e4275[_0xe98a('0x34')]=_[_0xe98a('0x2f')](_0x40e53b,_0xe98a('0x35'));_0x1e4275[_0xe98a('0x36')]=_['keys'](_0x222b97['query']);_0x1e4275[_0xe98a('0x37')]=_[_0xe98a('0x38')](_0x1e4275[_0xe98a('0x34')],_0x1e4275['query']);_0x4e6135['attributes']=_['intersection'](_0x1e4275[_0xe98a('0x34')],qs[_0xe98a('0x39')](_0x222b97[_0xe98a('0x36')][_0xe98a('0x39')]));_0x4e6135[_0xe98a('0x3a')]=_0x4e6135['attributes'][_0xe98a('0x3b')]?_0x4e6135[_0xe98a('0x3a')]:_0x1e4275[_0xe98a('0x34')];if(!_0x222b97[_0xe98a('0x36')][_0xe98a('0x3c')](_0xe98a('0x3d'))){_0x4e6135[_0xe98a('0x21')]=qs[_0xe98a('0x21')](_0x222b97[_0xe98a('0x36')]['limit']);_0x4e6135['offset']=qs[_0xe98a('0x1f')](_0x222b97[_0xe98a('0x36')]['offset']);}_0x4e6135[_0xe98a('0x3e')]=qs[_0xe98a('0x3f')](_0x222b97[_0xe98a('0x36')]['sort']);_0x4e6135[_0xe98a('0x40')]=qs[_0xe98a('0x37')](_['pick'](_0x222b97[_0xe98a('0x36')],_0x1e4275[_0xe98a('0x37')]),_0x40e53b);if(_0x222b97['query'][_0xe98a('0x41')]){_0x4e6135['where']=_[_0xe98a('0x42')](_0x4e6135[_0xe98a('0x40')],{'$or':_['map'](_0x40e53b,function(_0x30b14e){if(_0x30b14e[_0xe98a('0x32')]!==_0xe98a('0x43')){var _0x38e590={};_0x38e590[_0x30b14e[_0xe98a('0x35')]]={'$like':'%'+_0x222b97['query'][_0xe98a('0x41')]+'%'};return _0x38e590;}})});}_0x4e6135=_[_0xe98a('0x42')]({},_0x4e6135,_0x222b97['options']);var _0x4f18cb={'where':_0x4e6135[_0xe98a('0x40')]};return db[_0xe98a('0x30')][_0xe98a('0x22')](_0x4f18cb)[_0xe98a('0x27')](function(_0xdfdcf3){_0x1b709a['count']=_0xdfdcf3;if(_0x222b97[_0xe98a('0x36')][_0xe98a('0x44')]){_0x4e6135[_0xe98a('0x45')]=[{'all':!![]}];}return db[_0xe98a('0x30')][_0xe98a('0x46')](_0x4e6135);})[_0xe98a('0x27')](function(_0x5949c7){_0x1b709a[_0xe98a('0x47')]=_0x5949c7;return _0x1b709a;})[_0xe98a('0x27')](respondWithFilteredResult(_0x1e7102,_0x4e6135))[_0xe98a('0x48')](handleError(_0x1e7102,null));};exports['show']=function(_0x56e0d0,_0x3df1dd){var _0x4b1b2c={'raw':!![],'where':{'id':_0x56e0d0['params']['id']}},_0x2f2ea8={};_0x2f2ea8['model']=_['keys'](db[_0xe98a('0x30')][_0xe98a('0x31')]);_0x2f2ea8[_0xe98a('0x36')]=_[_0xe98a('0x49')](_0x56e0d0[_0xe98a('0x36')]);_0x2f2ea8['filters']=_[_0xe98a('0x38')](_0x2f2ea8[_0xe98a('0x34')],_0x2f2ea8[_0xe98a('0x36')]);_0x4b1b2c[_0xe98a('0x3a')]=_['intersection'](_0x2f2ea8[_0xe98a('0x34')],qs['fields'](_0x56e0d0[_0xe98a('0x36')]['fields']));_0x4b1b2c[_0xe98a('0x3a')]=_0x4b1b2c[_0xe98a('0x3a')][_0xe98a('0x3b')]?_0x4b1b2c[_0xe98a('0x3a')]:_0x2f2ea8[_0xe98a('0x34')];if(_0x56e0d0[_0xe98a('0x36')][_0xe98a('0x44')]){_0x4b1b2c[_0xe98a('0x45')]=[{'all':!![]}];}_0x4b1b2c=_[_0xe98a('0x42')]({},_0x4b1b2c,_0x56e0d0['options']);return db[_0xe98a('0x30')]['find'](_0x4b1b2c)['then'](handleEntityNotFound(_0x3df1dd,null))[_0xe98a('0x27')](respondWithResult(_0x3df1dd,null))[_0xe98a('0x48')](handleError(_0x3df1dd,null));};exports[_0xe98a('0x4a')]=function(_0x315165,_0x4d44d9){return db[_0xe98a('0x30')][_0xe98a('0x4a')](_0x315165[_0xe98a('0x4b')],{})[_0xe98a('0x27')](function(_0x2764b9){var _0x2b4f1a=_0x315165[_0xe98a('0x4c')][_0xe98a('0x28')]({'plain':!![]});if(!_0x2b4f1a)throw new Error(_0xe98a('0x4d'));if(_0x2b4f1a[_0xe98a('0x4e')]===_0xe98a('0x4c')){var _0x3f31f4=_0x2764b9[_0xe98a('0x28')]({'plain':!![]});var _0x7c842e=_0xe98a('0x29');return db[_0xe98a('0x4f')][_0xe98a('0x50')]({'where':{'name':_0x7c842e,'userProfileId':_0x2b4f1a[_0xe98a('0x51')]},'raw':!![]})[_0xe98a('0x27')](function(_0x207147){if(_0x207147&&_0x207147[_0xe98a('0x52')]===0x0){return db[_0xe98a('0x2a')][_0xe98a('0x4a')]({'name':_0x3f31f4[_0xe98a('0x35')],'resourceId':_0x3f31f4['id'],'type':_0x207147[_0xe98a('0x35')],'sectionId':_0x207147['id']},{})[_0xe98a('0x27')](function(){return _0x2764b9;});}else{return _0x2764b9;}})[_0xe98a('0x48')](function(_0x433a21){logger[_0xe98a('0x2d')](_0xe98a('0x53'),_0x433a21);throw _0x433a21;});}return _0x2764b9;})[_0xe98a('0x27')](respondWithResult(_0x4d44d9,0xc9))[_0xe98a('0x48')](handleError(_0x4d44d9,null));};exports[_0xe98a('0x26')]=function(_0x309606,_0x352d0c){if(_0x309606[_0xe98a('0x4b')]['id']){delete _0x309606[_0xe98a('0x4b')]['id'];}return db[_0xe98a('0x30')]['find']({'where':{'id':_0x309606['params']['id']}})[_0xe98a('0x27')](handleEntityNotFound(_0x352d0c,null))[_0xe98a('0x27')](saveUpdates(_0x309606[_0xe98a('0x4b')],null))[_0xe98a('0x27')](respondWithResult(_0x352d0c,null))[_0xe98a('0x48')](handleError(_0x352d0c,null));};exports['destroy']=function(_0x56cc97,_0x3973ea){return db[_0xe98a('0x30')][_0xe98a('0x50')]({'where':{'id':_0x56cc97[_0xe98a('0x54')]['id']}})[_0xe98a('0x27')](handleEntityNotFound(_0x3973ea,null))[_0xe98a('0x27')](removeEntity(_0x3973ea,null))[_0xe98a('0x48')](handleError(_0x3973ea,null));};exports[_0xe98a('0x55')]=function(_0x37b000,_0xe73a27){return db['WhatsappQueue']['describe']()[_0xe98a('0x27')](respondWithResult(_0xe73a27,null))[_0xe98a('0x48')](handleError(_0xe73a27,null));};exports[_0xe98a('0x56')]=function(_0x1328f3,_0x568504,_0x5a7c54){var _0x50b298={'raw':!![],'where':{}},_0x24d744={},_0x45e7e8;return db[_0xe98a('0x30')]['findOne']({'where':{'id':_0x1328f3[_0xe98a('0x54')]['id']}})[_0xe98a('0x27')](handleEntityNotFound(_0x568504,null))[_0xe98a('0x27')](function(_0x9fe509){if(_0x9fe509){_0x45e7e8=_0x9fe509[_0xe98a('0x28')]({'plain':!![]});_0x24d744[_0xe98a('0x34')]=_['keys'](db[_0xe98a('0x57')][_0xe98a('0x31')]);_0x24d744[_0xe98a('0x36')]=_[_0xe98a('0x49')](_0x1328f3['query']);_0x24d744[_0xe98a('0x37')]=_['intersection'](_0x24d744[_0xe98a('0x34')],_0x24d744['query']);_0x50b298['attributes']=_[_0xe98a('0x38')](_0x24d744[_0xe98a('0x34')],qs[_0xe98a('0x39')](_0x1328f3[_0xe98a('0x36')][_0xe98a('0x39')]));_0x50b298[_0xe98a('0x3a')]=_0x50b298[_0xe98a('0x3a')][_0xe98a('0x3b')]?_0x50b298['attributes']:_0x24d744[_0xe98a('0x34')];if(!_0x1328f3['query'][_0xe98a('0x3c')](_0xe98a('0x3d'))){_0x50b298[_0xe98a('0x21')]=qs['limit'](_0x1328f3['query'][_0xe98a('0x21')]);_0x50b298[_0xe98a('0x1f')]=qs[_0xe98a('0x1f')](_0x1328f3[_0xe98a('0x36')]['offset']);}_0x50b298['order']=qs[_0xe98a('0x3f')](_0x1328f3[_0xe98a('0x36')][_0xe98a('0x3f')]);_0x50b298['where']=qs['filters'](_['pick'](_0x1328f3[_0xe98a('0x36')],_0x24d744[_0xe98a('0x37')]));_0x50b298[_0xe98a('0x40')][_0xe98a('0x58')]=_0x9fe509['id'];if(_0x1328f3[_0xe98a('0x36')][_0xe98a('0x41')]){_0x50b298[_0xe98a('0x40')]=_[_0xe98a('0x42')](_0x50b298[_0xe98a('0x40')],{'$or':_[_0xe98a('0x2f')](_0x50b298[_0xe98a('0x3a')],function(_0x2e5436){var _0x5dc19b={};_0x5dc19b[_0x2e5436]={'$like':'%'+_0x1328f3[_0xe98a('0x36')][_0xe98a('0x41')]+'%'};return _0x5dc19b;})});}_0x50b298=_[_0xe98a('0x42')]({},_0x50b298,_0x1328f3[_0xe98a('0x59')]);return db[_0xe98a('0x57')][_0xe98a('0x46')](_0x50b298);}})[_0xe98a('0x27')](function(_0x327b3f){if(_0x327b3f){return db[_0xe98a('0x5a')][_0xe98a('0x5b')]({'where':{'id':_['map'](_0x327b3f,_0xe98a('0x5c')),'role':'agent'},'attributes':['id',_0xe98a('0x35'),'whatsappPause','updatedAt',_0xe98a('0x5d')]});}})[_0xe98a('0x27')](function(_0x14ae01){if(_0x14ae01){return{'count':_0x14ae01['count'],'rows':_[_0xe98a('0x2f')](_0x14ae01[_0xe98a('0x47')],function(_0x4cb6a8){return{'membername':_0x4cb6a8[_0xe98a('0x35')],'UserId':_0x4cb6a8['id'],'queue_name':_0x45e7e8[_0xe98a('0x35')],'WhatsappQueueId':_0x45e7e8['id'],'interface':util[_0xe98a('0x5e')](_0xe98a('0x5f'),_0xe98a('0x60'),_0x4cb6a8[_0xe98a('0x35')]),'penalty':0x0,'paused':_0x4cb6a8[_0xe98a('0x61')],'createdAt':_0x4cb6a8[_0xe98a('0x5d')],'updatedAt':_0x4cb6a8[_0xe98a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe98a('0x27')](respondWithFilteredResult(_0x568504,_0x50b298))[_0xe98a('0x48')](handleError(_0x568504,null));};exports[_0xe98a('0x63')]=function(_0x352932,_0x1762e5,_0x5f558f){var _0x2fbcac={};var _0x3700b1={};var _0x28e58b;var _0x285102;return db[_0xe98a('0x30')]['findOne']({'where':{'id':_0x352932[_0xe98a('0x54')]['id']}})[_0xe98a('0x27')](handleEntityNotFound(_0x1762e5,null))[_0xe98a('0x27')](function(_0x528ee3){if(_0x528ee3){_0x28e58b=_0x528ee3;_0x3700b1[_0xe98a('0x34')]=_[_0xe98a('0x49')](db[_0xe98a('0x64')][_0xe98a('0x31')]);_0x3700b1[_0xe98a('0x36')]=_['keys'](_0x352932[_0xe98a('0x36')]);_0x3700b1[_0xe98a('0x37')]=_[_0xe98a('0x38')](_0x3700b1['model'],_0x3700b1[_0xe98a('0x36')]);_0x2fbcac[_0xe98a('0x3a')]=_[_0xe98a('0x38')](_0x3700b1[_0xe98a('0x34')],qs[_0xe98a('0x39')](_0x352932['query']['fields']));_0x2fbcac[_0xe98a('0x3a')]=_0x2fbcac[_0xe98a('0x3a')]['length']?_0x2fbcac[_0xe98a('0x3a')]:_0x3700b1['model'];_0x2fbcac[_0xe98a('0x3e')]=qs['sort'](_0x352932['query']['sort']);_0x2fbcac['where']=qs[_0xe98a('0x37')](_[_0xe98a('0x65')](_0x352932[_0xe98a('0x36')],_0x3700b1[_0xe98a('0x37')]));if(_0x352932[_0xe98a('0x36')][_0xe98a('0x41')]){_0x2fbcac[_0xe98a('0x40')]=_[_0xe98a('0x42')](_0x2fbcac['where'],{'$or':_[_0xe98a('0x2f')](_0x2fbcac[_0xe98a('0x3a')],function(_0x168cce){var _0x53e996={};_0x53e996[_0x168cce]={'$like':'%'+_0x352932[_0xe98a('0x36')][_0xe98a('0x41')]+'%'};return _0x53e996;})});}_0x2fbcac=_['merge']({},_0x2fbcac,_0x352932[_0xe98a('0x59')]);return _0x28e58b[_0xe98a('0x63')](_0x2fbcac);}})[_0xe98a('0x27')](function(_0x262cff){if(_0x262cff){_0x285102=_0x262cff[_0xe98a('0x3b')];if(!_0x352932[_0xe98a('0x36')][_0xe98a('0x3c')](_0xe98a('0x3d'))){_0x2fbcac[_0xe98a('0x21')]=qs[_0xe98a('0x21')](_0x352932[_0xe98a('0x36')][_0xe98a('0x21')]);_0x2fbcac[_0xe98a('0x1f')]=qs['offset'](_0x352932[_0xe98a('0x36')][_0xe98a('0x1f')]);}return _0x28e58b[_0xe98a('0x63')](_0x2fbcac);}})['then'](function(_0x57c3d8){if(_0x57c3d8){return _0x57c3d8?{'count':_0x285102,'rows':_0x57c3d8}:null;}})[_0xe98a('0x27')](respondWithResult(_0x1762e5,null))[_0xe98a('0x48')](handleError(_0x1762e5,null));};exports[_0xe98a('0x66')]=function(_0xbe96b7,_0x4cf26c,_0x21b422){var _0x1072c2=_0xbe96b7[_0xe98a('0x4b')][_0xe98a('0x67')];return db['Team'][_0xe98a('0x46')]({'where':{'id':_0x1072c2},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe98a('0x68'),'attributes':['id',_0xe98a('0x35'),'online','voicePause',_0xe98a('0x69')],'raw':!![]}]})[_0xe98a('0x27')](function(_0x164ad3){if(_0x164ad3){var _0x4c17f8=_[_0xe98a('0x6a')](_0x164ad3,function(_0x4e568d){var _0x294eab=_0x4e568d['get']({'plain':!![]});return _0x294eab[_0xe98a('0x68')];});return db['WhatsappQueue'][_0xe98a('0x50')]({'where':{'id':_0xbe96b7[_0xe98a('0x54')]['id']}})[_0xe98a('0x27')](function(_0x4dfa03){return db[_0xe98a('0x6b')][_0xe98a('0x6c')](function(_0x675da2){return _0x4dfa03[_0xe98a('0x66')](_0x1072c2,{'transaction':_0x675da2})[_0xe98a('0x27')](function(){return BPromise[_0xe98a('0x6d')](_0x4c17f8,function(_0x333ee0){return db['UserWhatsappQueue'][_0xe98a('0x6e')]({'where':{'UserId':_0x333ee0['id'],'WhatsappQueueId':_0xbe96b7['params']['id']},'transaction':_0x675da2});});})[_0xe98a('0x27')](function(){_0x4c17f8[_0xe98a('0x6f')](function(_0x4df6e0){socket[_0xe98a('0x70')]('userWhatsappQueue:save',{'UserId':_0x4df6e0['id'],'WhatsappQueueId':_0x4dfa03['id']});});});});});}})[_0xe98a('0x27')](respondWithStatusCode(_0x4cf26c,null))[_0xe98a('0x48')](handleError(_0x4cf26c,null));};exports[_0xe98a('0x71')]=function(_0x324980,_0x3c0e6a,_0x27a0e2){return db['Team'][_0xe98a('0x46')]({'where':{'id':_0x324980[_0xe98a('0x36')][_0xe98a('0x67')]},'attributes':['id'],'include':[{'model':db[_0xe98a('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3c0e6a,null))['then'](function(_0x3abade){var _0x49dab7=_['map'](_0x3abade,'id');var _0x20fede=[];var _0xd194f2=[];var _0x48cff8=squel['select']();_0x48cff8['field'](_0xe98a('0x72'))['from']('team_has_whatsapp_queues','tq')[_0xe98a('0x73')](_0xe98a('0x74'),'ut',_0xe98a('0x75'))[_0xe98a('0x40')](_0xe98a('0x76'),_0x324980[_0xe98a('0x54')]['id']);for(var _0x16f9b0=0x0;_0x16f9b0<_0x3abade['length'];_0x16f9b0+=0x1){let _0x8d070b=_0x3abade[_0x16f9b0];for(var _0x2a3431=0x0;_0x2a3431<_0x8d070b[_0xe98a('0x68')][_0xe98a('0x3b')];_0x2a3431+=0x1){let _0x1fe5c6=_0x8d070b[_0xe98a('0x68')][_0x2a3431];var _0x2da6b1=_0x48cff8[_0xe98a('0x77')]();_0x2da6b1[_0xe98a('0x40')](_0xe98a('0x78'),_0x1fe5c6['id']);_0xd194f2[_0xe98a('0x79')](db[_0xe98a('0x6b')]['query'](_0x2da6b1[_0xe98a('0x7a')](),{'type':db[_0xe98a('0x6b')]['QueryTypes'][_0xe98a('0x7b')]})[_0xe98a('0x27')](function(_0xe52ad7){if(_0xe52ad7[_0xe98a('0x3b')]===0x1){return _0x1fe5c6['id'];}else{var _0x1e24f1=_[_0xe98a('0x7c')](_['map'](_0xe52ad7,_0xe98a('0x7d')),function(_0x3371d0){return _['includes'](_0x49dab7,_0x3371d0);});if(_0x1e24f1){return _0x1fe5c6['id'];}}}));}}return BPromise['all'](_0xd194f2)[_0xe98a('0x27')](function(_0x3a0fb8){_0x20fede=_(_0x20fede)['union'](_0x3a0fb8)['compact']()['value']();return db['WhatsappQueue'][_0xe98a('0x50')]({'where':{'id':_0x324980[_0xe98a('0x54')]['id']}})[_0xe98a('0x27')](function(_0x35188b){return db[_0xe98a('0x6b')][_0xe98a('0x6c')](function(_0x418afb){return _0x35188b[_0xe98a('0x71')](_0x324980[_0xe98a('0x36')]['ids'],{'transaction':_0x418afb})['then'](function(){if(!_[_0xe98a('0x7e')](_0x20fede)){return _0x35188b['removeAgents'](_0x20fede,{'transaction':_0x418afb});}})[_0xe98a('0x27')](function(){_0x20fede[_0xe98a('0x6f')](function(_0x378223){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x378223,'WhatsappQueueId':_0x35188b['id']});});});});});});})['then'](respondWithStatusCode(_0x3c0e6a,null))[_0xe98a('0x48')](handleError(_0x3c0e6a,null));};exports['addAgents']=function(_0x22d90e,_0x1fdf9b,_0x10f269){return db[_0xe98a('0x30')][_0xe98a('0x50')]({'where':{'id':_0x22d90e['params']['id']}})[_0xe98a('0x27')](handleEntityNotFound(_0x1fdf9b,null))[_0xe98a('0x27')](function(_0x5705bc){if(_0x5705bc){return _0x5705bc['addAgents'](_0x22d90e[_0xe98a('0x4b')][_0xe98a('0x67')],_[_0xe98a('0x7f')](_0x22d90e[_0xe98a('0x4b')],[_0xe98a('0x67'),'id'])||{})[_0xe98a('0x80')](function(_0x5b0e9d){for(var _0x3bc9fa=0x0;_0x3bc9fa<_0x22d90e[_0xe98a('0x4b')][_0xe98a('0x67')][_0xe98a('0x3b')];_0x3bc9fa+=0x1){socket['emit'](_0xe98a('0x81'),{'UserId':Number(_0x22d90e['body']['ids'][_0x3bc9fa]),'WhatsappQueueId':Number(_0x22d90e[_0xe98a('0x54')]['id'])});}return _0x5b0e9d;});}})[_0xe98a('0x27')](respondWithResult(_0x1fdf9b,null))['catch'](handleError(_0x1fdf9b,null));};exports['removeAgents']=function(_0x330a6c,_0x52da01,_0x305002){return db[_0xe98a('0x30')][_0xe98a('0x50')]({'where':{'id':_0x330a6c[_0xe98a('0x54')]['id']}})[_0xe98a('0x27')](handleEntityNotFound(_0x52da01,null))[_0xe98a('0x27')](function(_0x4127d9){if(_0x4127d9){return _0x4127d9[_0xe98a('0x82')](_0x330a6c[_0xe98a('0x36')][_0xe98a('0x67')])['then'](function(){if(_['isArray'](_0x330a6c[_0xe98a('0x36')][_0xe98a('0x67')])){for(var _0x44e314=0x0;_0x44e314<_0x330a6c[_0xe98a('0x36')][_0xe98a('0x67')]['length'];_0x44e314+=0x1){socket[_0xe98a('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x330a6c[_0xe98a('0x36')]['ids'][_0x44e314]),'WhatsappQueueId':Number(_0x330a6c[_0xe98a('0x54')]['id'])});}}else{socket[_0xe98a('0x70')](_0xe98a('0x83'),{'UserId':Number(_0x330a6c[_0xe98a('0x36')][_0xe98a('0x67')]),'WhatsappQueueId':Number(_0x330a6c[_0xe98a('0x54')]['id'])});}});}})[_0xe98a('0x27')](respondWithStatusCode(_0x52da01,null))[_0xe98a('0x48')](handleError(_0x52da01,null));};exports[_0xe98a('0x84')]=function(_0x5ca5b6,_0x4784ac,_0x35ef4c){var _0x12ef3b={};var _0x44dad7={};var _0x2a155b;var _0x5ca498;return db[_0xe98a('0x30')]['findOne']({'where':{'id':_0x5ca5b6[_0xe98a('0x54')]['id']}})[_0xe98a('0x27')](handleEntityNotFound(_0x4784ac,null))[_0xe98a('0x27')](function(_0x39b447){if(_0x39b447){_0x2a155b=_0x39b447;_0x44dad7[_0xe98a('0x34')]=_['keys'](db[_0xe98a('0x5a')][_0xe98a('0x31')]);_0x44dad7[_0xe98a('0x36')]=_[_0xe98a('0x49')](_0x5ca5b6[_0xe98a('0x36')]);_0x44dad7[_0xe98a('0x37')]=_[_0xe98a('0x38')](_0x44dad7[_0xe98a('0x34')],_0x44dad7['query']);_0x12ef3b[_0xe98a('0x3a')]=_[_0xe98a('0x38')](_0x44dad7[_0xe98a('0x34')],qs[_0xe98a('0x39')](_0x5ca5b6[_0xe98a('0x36')]['fields']));_0x12ef3b['attributes']=_0x12ef3b['attributes']['length']?_0x12ef3b[_0xe98a('0x3a')]:_0x44dad7[_0xe98a('0x34')];_0x12ef3b[_0xe98a('0x3e')]=qs[_0xe98a('0x3f')](_0x5ca5b6[_0xe98a('0x36')][_0xe98a('0x3f')]);_0x12ef3b[_0xe98a('0x40')]=qs[_0xe98a('0x37')](_['pick'](_0x5ca5b6[_0xe98a('0x36')],_0x44dad7[_0xe98a('0x37')]));if(_0x5ca5b6[_0xe98a('0x36')][_0xe98a('0x41')]){_0x12ef3b['where']=_[_0xe98a('0x42')](_0x12ef3b[_0xe98a('0x40')],{'$or':_[_0xe98a('0x2f')](_0x12ef3b[_0xe98a('0x3a')],function(_0x28181b){var _0x5a2e20={};_0x5a2e20[_0x28181b]={'$like':'%'+_0x5ca5b6['query'][_0xe98a('0x41')]+'%'};return _0x5a2e20;})});}_0x12ef3b=_[_0xe98a('0x42')]({},_0x12ef3b,_0x5ca5b6[_0xe98a('0x59')]);return _0x2a155b[_0xe98a('0x84')](_0x12ef3b);}})[_0xe98a('0x27')](function(_0x277f09){if(_0x277f09){_0x5ca498=_0x277f09['length'];if(!_0x5ca5b6['query']['hasOwnProperty'](_0xe98a('0x3d'))){_0x12ef3b['limit']=qs[_0xe98a('0x21')](_0x5ca5b6[_0xe98a('0x36')][_0xe98a('0x21')]);_0x12ef3b[_0xe98a('0x1f')]=qs[_0xe98a('0x1f')](_0x5ca5b6[_0xe98a('0x36')][_0xe98a('0x1f')]);}return _0x2a155b[_0xe98a('0x84')](_0x12ef3b);}})[_0xe98a('0x27')](function(_0x4cb3c8){if(_0x4cb3c8){return _0x4cb3c8?{'count':_0x5ca498,'rows':_0x4cb3c8}:null;}})[_0xe98a('0x27')](respondWithResult(_0x4784ac,null))[_0xe98a('0x48')](handleError(_0x4784ac,null));}; \ No newline at end of file +var _0xf23c=['from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','updatedAt','format','SIP','whatsappPause','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','field','tq.TeamId'];(function(_0x557b5e,_0x302123){var _0x37733d=function(_0x4beb8f){while(--_0x4beb8f){_0x557b5e['push'](_0x557b5e['shift']());}};_0x37733d(++_0x302123);}(_0xf23c,0x1c5));var _0xcf23=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0xf23c[_0x4fa291];return _0x506d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf23('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcf23('0x1'));var moment=require(_0xcf23('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xcf23('0x3'));var util=require(_0xcf23('0x4'));var path=require(_0xcf23('0x5'));var sox=require(_0xcf23('0x6'));var csv=require(_0xcf23('0x7'));var ejs=require(_0xcf23('0x8'));var fs=require('fs');var fs_extra=require(_0xcf23('0x9'));var _=require(_0xcf23('0xa'));var squel=require('squel');var crypto=require(_0xcf23('0xb'));var jsforce=require(_0xcf23('0xc'));var deskjs=require(_0xcf23('0xd'));var toCsv=require(_0xcf23('0x7'));var querystring=require(_0xcf23('0xe'));var Papa=require(_0xcf23('0xf'));var Redis=require(_0xcf23('0x10'));var authService=require(_0xcf23('0x11'));var qs=require(_0xcf23('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf23('0x13'));var logger=require('../../config/logger')(_0xcf23('0x14'));var utils=require(_0xcf23('0x15'));var config=require(_0xcf23('0x16'));var licenseUtil=require(_0xcf23('0x17'));var db=require(_0xcf23('0x18'))['db'];config[_0xcf23('0x19')]=_[_0xcf23('0x1a')](config[_0xcf23('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf23('0x1b'))(new Redis(config[_0xcf23('0x19')]));require(_0xcf23('0x1c'))[_0xcf23('0x1d')](socket);function respondWithStatusCode(_0x2d15a7,_0x4ccbc4){_0x4ccbc4=_0x4ccbc4||0xcc;return function(_0x276ff0){if(_0x276ff0){return _0x2d15a7['sendStatus'](_0x4ccbc4);}return _0x2d15a7[_0xcf23('0x1e')](_0x4ccbc4)[_0xcf23('0x1f')]();};}function respondWithResult(_0x3dfbf4,_0x2122df){_0x2122df=_0x2122df||0xc8;return function(_0xe5b9b8){if(_0xe5b9b8){return _0x3dfbf4['status'](_0x2122df)[_0xcf23('0x20')](_0xe5b9b8);}};}function respondWithFilteredResult(_0x3383fc,_0x1f3aa7){return function(_0x3c3225){if(_0x3c3225){var _0x2e9d37=typeof _0x1f3aa7[_0xcf23('0x21')]===_0xcf23('0x22')&&typeof _0x1f3aa7[_0xcf23('0x23')]===_0xcf23('0x22');var _0x3a9fba=_0x3c3225[_0xcf23('0x24')];var _0x247fe4=_0x2e9d37?0x0:_0x1f3aa7[_0xcf23('0x21')];var _0x5a0bc7=_0x2e9d37?_0x3c3225['count']:_0x1f3aa7['offset']+_0x1f3aa7[_0xcf23('0x23')];var _0x1511c2;if(_0x5a0bc7>=_0x3a9fba){_0x5a0bc7=_0x3a9fba;_0x1511c2=0xc8;}else{_0x1511c2=0xce;}_0x3383fc[_0xcf23('0x1e')](_0x1511c2);return _0x3383fc[_0xcf23('0x25')]('Content-Range',_0x247fe4+'-'+_0x5a0bc7+'/'+_0x3a9fba)[_0xcf23('0x20')](_0x3c3225);}return null;};}function patchUpdates(_0x26505d){return function(_0x4af0f8){try{jsonpatch[_0xcf23('0x26')](_0x4af0f8,_0x26505d,!![]);}catch(_0x2222ab){return BPromise[_0xcf23('0x27')](_0x2222ab);}return _0x4af0f8[_0xcf23('0x28')]();};}function saveUpdates(_0x4cb423,_0x58aebe){return function(_0x102883){if(_0x102883){return _0x102883['update'](_0x4cb423)['then'](function(_0x17dddf){return _0x17dddf;});}return null;};}function removeEntity(_0x8f7115,_0x1f4d3e){return function(_0x58f8e2){if(_0x58f8e2){return _0x58f8e2[_0xcf23('0x29')]()[_0xcf23('0x2a')](function(){var _0x324699=_0x58f8e2[_0xcf23('0x2b')]({'plain':!![]});var _0x57fc6f=_0xcf23('0x2c');return db[_0xcf23('0x2d')]['destroy']({'where':{'type':_0x57fc6f,'resourceId':_0x324699['id']}})['then'](function(){return _0x58f8e2;});})[_0xcf23('0x2a')](function(){_0x8f7115[_0xcf23('0x1e')](0xcc)[_0xcf23('0x1f')]();});}};}function handleEntityNotFound(_0x185f6b,_0x587b06){return function(_0x52db9c){if(!_0x52db9c){_0x185f6b['sendStatus'](0x194);}return _0x52db9c;};}function handleError(_0xcea872,_0x5c5056){_0x5c5056=_0x5c5056||0x1f4;return function(_0x8d1637){logger['error'](_0x8d1637[_0xcf23('0x2e')]);if(_0x8d1637[_0xcf23('0x2f')]){delete _0x8d1637['name'];}_0xcea872[_0xcf23('0x1e')](_0x5c5056)[_0xcf23('0x30')](_0x8d1637);};}exports[_0xcf23('0x31')]=function(_0x20629e,_0x5e5760){var _0x58850d={},_0xe5be9={},_0x48dec7={'count':0x0,'rows':[]};var _0x3efe68=_[_0xcf23('0x32')](db[_0xcf23('0x33')][_0xcf23('0x34')],function(_0x4080de){return{'name':_0x4080de[_0xcf23('0x35')],'type':_0x4080de[_0xcf23('0x36')][_0xcf23('0x37')]};});_0xe5be9['model']=_['map'](_0x3efe68,_0xcf23('0x2f'));_0xe5be9[_0xcf23('0x38')]=_['keys'](_0x20629e[_0xcf23('0x38')]);_0xe5be9[_0xcf23('0x39')]=_[_0xcf23('0x3a')](_0xe5be9['model'],_0xe5be9['query']);_0x58850d[_0xcf23('0x3b')]=_['intersection'](_0xe5be9[_0xcf23('0x3c')],qs[_0xcf23('0x3d')](_0x20629e[_0xcf23('0x38')]['fields']));_0x58850d[_0xcf23('0x3b')]=_0x58850d[_0xcf23('0x3b')][_0xcf23('0x3e')]?_0x58850d[_0xcf23('0x3b')]:_0xe5be9[_0xcf23('0x3c')];if(!_0x20629e['query'][_0xcf23('0x3f')](_0xcf23('0x40'))){_0x58850d[_0xcf23('0x23')]=qs[_0xcf23('0x23')](_0x20629e[_0xcf23('0x38')]['limit']);_0x58850d[_0xcf23('0x21')]=qs[_0xcf23('0x21')](_0x20629e[_0xcf23('0x38')]['offset']);}_0x58850d[_0xcf23('0x41')]=qs[_0xcf23('0x42')](_0x20629e[_0xcf23('0x38')][_0xcf23('0x42')]);_0x58850d[_0xcf23('0x43')]=qs['filters'](_[_0xcf23('0x44')](_0x20629e['query'],_0xe5be9[_0xcf23('0x39')]),_0x3efe68);if(_0x20629e[_0xcf23('0x38')][_0xcf23('0x45')]){_0x58850d[_0xcf23('0x43')]=_[_0xcf23('0x46')](_0x58850d[_0xcf23('0x43')],{'$or':_[_0xcf23('0x32')](_0x3efe68,function(_0x234f7a){if(_0x234f7a[_0xcf23('0x36')]!==_0xcf23('0x47')){var _0x53ce46={};_0x53ce46[_0x234f7a['name']]={'$like':'%'+_0x20629e[_0xcf23('0x38')][_0xcf23('0x45')]+'%'};return _0x53ce46;}})});}_0x58850d=_[_0xcf23('0x46')]({},_0x58850d,_0x20629e[_0xcf23('0x48')]);var _0x3c76f3={'where':_0x58850d[_0xcf23('0x43')]};return db[_0xcf23('0x33')][_0xcf23('0x24')](_0x3c76f3)[_0xcf23('0x2a')](function(_0x3c139c){_0x48dec7[_0xcf23('0x24')]=_0x3c139c;if(_0x20629e[_0xcf23('0x38')][_0xcf23('0x49')]){_0x58850d['include']=[{'all':!![]}];}return db[_0xcf23('0x33')][_0xcf23('0x4a')](_0x58850d);})[_0xcf23('0x2a')](function(_0x2ecbd2){_0x48dec7[_0xcf23('0x4b')]=_0x2ecbd2;return _0x48dec7;})[_0xcf23('0x2a')](respondWithFilteredResult(_0x5e5760,_0x58850d))['catch'](handleError(_0x5e5760,null));};exports[_0xcf23('0x4c')]=function(_0x38d1f4,_0x274c07){var _0x3f7319={'raw':!![],'where':{'id':_0x38d1f4[_0xcf23('0x4d')]['id']}},_0x10d188={};_0x10d188[_0xcf23('0x3c')]=_[_0xcf23('0x4e')](db[_0xcf23('0x33')][_0xcf23('0x34')]);_0x10d188[_0xcf23('0x38')]=_[_0xcf23('0x4e')](_0x38d1f4[_0xcf23('0x38')]);_0x10d188['filters']=_[_0xcf23('0x3a')](_0x10d188['model'],_0x10d188[_0xcf23('0x38')]);_0x3f7319[_0xcf23('0x3b')]=_[_0xcf23('0x3a')](_0x10d188[_0xcf23('0x3c')],qs[_0xcf23('0x3d')](_0x38d1f4[_0xcf23('0x38')][_0xcf23('0x3d')]));_0x3f7319[_0xcf23('0x3b')]=_0x3f7319[_0xcf23('0x3b')][_0xcf23('0x3e')]?_0x3f7319[_0xcf23('0x3b')]:_0x10d188[_0xcf23('0x3c')];if(_0x38d1f4[_0xcf23('0x38')][_0xcf23('0x49')]){_0x3f7319['include']=[{'all':!![]}];}_0x3f7319=_[_0xcf23('0x46')]({},_0x3f7319,_0x38d1f4[_0xcf23('0x48')]);return db[_0xcf23('0x33')][_0xcf23('0x4f')](_0x3f7319)['then'](handleEntityNotFound(_0x274c07,null))[_0xcf23('0x2a')](respondWithResult(_0x274c07,null))[_0xcf23('0x50')](handleError(_0x274c07,null));};exports[_0xcf23('0x51')]=function(_0x492458,_0x402465){return db[_0xcf23('0x33')]['create'](_0x492458[_0xcf23('0x52')],{})[_0xcf23('0x2a')](function(_0x5b932a){var _0x380d93=_0x492458[_0xcf23('0x53')][_0xcf23('0x2b')]({'plain':!![]});if(!_0x380d93)throw new Error(_0xcf23('0x54'));if(_0x380d93[_0xcf23('0x55')]===_0xcf23('0x53')){var _0x385179=_0x5b932a['get']({'plain':!![]});var _0xda13f4=_0xcf23('0x2c');return db['UserProfileSection'][_0xcf23('0x4f')]({'where':{'name':_0xda13f4,'userProfileId':_0x380d93['userProfileId']},'raw':!![]})[_0xcf23('0x2a')](function(_0x115adc){if(_0x115adc&&_0x115adc[_0xcf23('0x56')]===0x0){return db[_0xcf23('0x2d')][_0xcf23('0x51')]({'name':_0x385179[_0xcf23('0x2f')],'resourceId':_0x385179['id'],'type':_0x115adc[_0xcf23('0x2f')],'sectionId':_0x115adc['id']},{})[_0xcf23('0x2a')](function(){return _0x5b932a;});}else{return _0x5b932a;}})['catch'](function(_0x21aadb){logger[_0xcf23('0x57')](_0xcf23('0x58'),_0x21aadb);throw _0x21aadb;});}return _0x5b932a;})[_0xcf23('0x2a')](respondWithResult(_0x402465,0xc9))[_0xcf23('0x50')](handleError(_0x402465,null));};exports[_0xcf23('0x59')]=function(_0x5dabba,_0x104265){if(_0x5dabba[_0xcf23('0x52')]['id']){delete _0x5dabba[_0xcf23('0x52')]['id'];}return db[_0xcf23('0x33')]['find']({'where':{'id':_0x5dabba[_0xcf23('0x4d')]['id']}})[_0xcf23('0x2a')](handleEntityNotFound(_0x104265,null))[_0xcf23('0x2a')](saveUpdates(_0x5dabba[_0xcf23('0x52')],null))['then'](respondWithResult(_0x104265,null))[_0xcf23('0x50')](handleError(_0x104265,null));};exports['destroy']=function(_0x134c2e,_0x4664ea){return db[_0xcf23('0x33')][_0xcf23('0x4f')]({'where':{'id':_0x134c2e[_0xcf23('0x4d')]['id']}})[_0xcf23('0x2a')](handleEntityNotFound(_0x4664ea,null))[_0xcf23('0x2a')](removeEntity(_0x4664ea,null))[_0xcf23('0x50')](handleError(_0x4664ea,null));};exports[_0xcf23('0x5a')]=function(_0x3d16be,_0x4b111d){return db[_0xcf23('0x33')][_0xcf23('0x5a')]()[_0xcf23('0x2a')](respondWithResult(_0x4b111d,null))[_0xcf23('0x50')](handleError(_0x4b111d,null));};exports['getMembers']=function(_0x27aa39,_0x1d7ab1,_0x38a05a){var _0x365ff4={'raw':!![],'where':{}},_0x46503a={},_0x32ae6d;return db[_0xcf23('0x33')]['findOne']({'where':{'id':_0x27aa39['params']['id']}})[_0xcf23('0x2a')](handleEntityNotFound(_0x1d7ab1,null))[_0xcf23('0x2a')](function(_0x43c5ac){if(_0x43c5ac){_0x32ae6d=_0x43c5ac['get']({'plain':!![]});_0x46503a[_0xcf23('0x3c')]=_['keys'](db[_0xcf23('0x5b')][_0xcf23('0x34')]);_0x46503a[_0xcf23('0x38')]=_['keys'](_0x27aa39[_0xcf23('0x38')]);_0x46503a['filters']=_[_0xcf23('0x3a')](_0x46503a[_0xcf23('0x3c')],_0x46503a[_0xcf23('0x38')]);_0x365ff4[_0xcf23('0x3b')]=_[_0xcf23('0x3a')](_0x46503a['model'],qs['fields'](_0x27aa39[_0xcf23('0x38')][_0xcf23('0x3d')]));_0x365ff4[_0xcf23('0x3b')]=_0x365ff4[_0xcf23('0x3b')][_0xcf23('0x3e')]?_0x365ff4['attributes']:_0x46503a[_0xcf23('0x3c')];if(!_0x27aa39[_0xcf23('0x38')][_0xcf23('0x3f')](_0xcf23('0x40'))){_0x365ff4['limit']=qs['limit'](_0x27aa39[_0xcf23('0x38')][_0xcf23('0x23')]);_0x365ff4['offset']=qs[_0xcf23('0x21')](_0x27aa39[_0xcf23('0x38')][_0xcf23('0x21')]);}_0x365ff4[_0xcf23('0x41')]=qs[_0xcf23('0x42')](_0x27aa39[_0xcf23('0x38')]['sort']);_0x365ff4[_0xcf23('0x43')]=qs['filters'](_['pick'](_0x27aa39[_0xcf23('0x38')],_0x46503a[_0xcf23('0x39')]));_0x365ff4[_0xcf23('0x43')][_0xcf23('0x5c')]=_0x43c5ac['id'];if(_0x27aa39[_0xcf23('0x38')][_0xcf23('0x45')]){_0x365ff4[_0xcf23('0x43')]=_[_0xcf23('0x46')](_0x365ff4[_0xcf23('0x43')],{'$or':_[_0xcf23('0x32')](_0x365ff4[_0xcf23('0x3b')],function(_0x162983){var _0x217735={};_0x217735[_0x162983]={'$like':'%'+_0x27aa39[_0xcf23('0x38')][_0xcf23('0x45')]+'%'};return _0x217735;})});}_0x365ff4=_['merge']({},_0x365ff4,_0x27aa39[_0xcf23('0x48')]);return db[_0xcf23('0x5b')][_0xcf23('0x4a')](_0x365ff4);}})[_0xcf23('0x2a')](function(_0x19fa04){if(_0x19fa04){return db[_0xcf23('0x5d')][_0xcf23('0x5e')]({'where':{'id':_['map'](_0x19fa04,_0xcf23('0x5f')),'role':'agent'},'attributes':['id',_0xcf23('0x2f'),'whatsappPause',_0xcf23('0x60'),'createdAt']});}})[_0xcf23('0x2a')](function(_0x20c50f){if(_0x20c50f){return{'count':_0x20c50f[_0xcf23('0x24')],'rows':_['map'](_0x20c50f[_0xcf23('0x4b')],function(_0x3729b2){return{'membername':_0x3729b2[_0xcf23('0x2f')],'UserId':_0x3729b2['id'],'queue_name':_0x32ae6d[_0xcf23('0x2f')],'WhatsappQueueId':_0x32ae6d['id'],'interface':util[_0xcf23('0x61')]('%s/%s',_0xcf23('0x62'),_0x3729b2[_0xcf23('0x2f')]),'penalty':0x0,'paused':_0x3729b2[_0xcf23('0x63')],'createdAt':_0x3729b2['createdAt'],'updatedAt':_0x3729b2[_0xcf23('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcf23('0x2a')](respondWithFilteredResult(_0x1d7ab1,_0x365ff4))[_0xcf23('0x50')](handleError(_0x1d7ab1,null));};exports[_0xcf23('0x64')]=function(_0x9ab821,_0x45166f,_0x17654b){var _0x5af672={};var _0x5b85df={};var _0x1674a0;var _0x180c99;return db[_0xcf23('0x33')]['findOne']({'where':{'id':_0x9ab821[_0xcf23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45166f,null))[_0xcf23('0x2a')](function(_0x3257fa){if(_0x3257fa){_0x1674a0=_0x3257fa;_0x5b85df[_0xcf23('0x3c')]=_['keys'](db[_0xcf23('0x65')][_0xcf23('0x34')]);_0x5b85df[_0xcf23('0x38')]=_[_0xcf23('0x4e')](_0x9ab821['query']);_0x5b85df[_0xcf23('0x39')]=_[_0xcf23('0x3a')](_0x5b85df[_0xcf23('0x3c')],_0x5b85df['query']);_0x5af672['attributes']=_[_0xcf23('0x3a')](_0x5b85df[_0xcf23('0x3c')],qs[_0xcf23('0x3d')](_0x9ab821['query'][_0xcf23('0x3d')]));_0x5af672[_0xcf23('0x3b')]=_0x5af672[_0xcf23('0x3b')][_0xcf23('0x3e')]?_0x5af672[_0xcf23('0x3b')]:_0x5b85df[_0xcf23('0x3c')];_0x5af672[_0xcf23('0x41')]=qs[_0xcf23('0x42')](_0x9ab821['query'][_0xcf23('0x42')]);_0x5af672['where']=qs[_0xcf23('0x39')](_[_0xcf23('0x44')](_0x9ab821['query'],_0x5b85df[_0xcf23('0x39')]));if(_0x9ab821[_0xcf23('0x38')][_0xcf23('0x45')]){_0x5af672[_0xcf23('0x43')]=_[_0xcf23('0x46')](_0x5af672[_0xcf23('0x43')],{'$or':_['map'](_0x5af672['attributes'],function(_0x5a3f75){var _0x43d59c={};_0x43d59c[_0x5a3f75]={'$like':'%'+_0x9ab821['query'][_0xcf23('0x45')]+'%'};return _0x43d59c;})});}_0x5af672=_[_0xcf23('0x46')]({},_0x5af672,_0x9ab821['options']);return _0x1674a0[_0xcf23('0x64')](_0x5af672);}})[_0xcf23('0x2a')](function(_0x16008b){if(_0x16008b){_0x180c99=_0x16008b[_0xcf23('0x3e')];if(!_0x9ab821['query']['hasOwnProperty'](_0xcf23('0x40'))){_0x5af672[_0xcf23('0x23')]=qs['limit'](_0x9ab821['query']['limit']);_0x5af672[_0xcf23('0x21')]=qs['offset'](_0x9ab821['query'][_0xcf23('0x21')]);}return _0x1674a0[_0xcf23('0x64')](_0x5af672);}})[_0xcf23('0x2a')](function(_0x44c631){if(_0x44c631){return _0x44c631?{'count':_0x180c99,'rows':_0x44c631}:null;}})['then'](respondWithResult(_0x45166f,null))[_0xcf23('0x50')](handleError(_0x45166f,null));};exports[_0xcf23('0x66')]=function(_0x3f44a9,_0x40d6e8,_0xcb0bdf){var _0x5795b7=_0x3f44a9['body'][_0xcf23('0x67')];return db[_0xcf23('0x65')]['findAll']({'where':{'id':_0x5795b7},'attributes':['id'],'include':[{'model':db[_0xcf23('0x5d')],'as':_0xcf23('0x68'),'attributes':['id',_0xcf23('0x2f'),_0xcf23('0x69'),'voicePause',_0xcf23('0x6a')],'raw':!![]}]})[_0xcf23('0x2a')](function(_0x553606){if(_0x553606){var _0x1d706a=_[_0xcf23('0x6b')](_0x553606,function(_0x2832c6){var _0x229b13=_0x2832c6[_0xcf23('0x2b')]({'plain':!![]});return _0x229b13[_0xcf23('0x68')];});return db[_0xcf23('0x33')][_0xcf23('0x4f')]({'where':{'id':_0x3f44a9['params']['id']}})[_0xcf23('0x2a')](function(_0x4aedd5){return db['sequelize']['transaction'](function(_0x1c5d84){return _0x4aedd5[_0xcf23('0x66')](_0x5795b7,{'transaction':_0x1c5d84})[_0xcf23('0x2a')](function(){return BPromise[_0xcf23('0x6c')](_0x1d706a,function(_0x417983){return db[_0xcf23('0x5b')][_0xcf23('0x6d')]({'where':{'UserId':_0x417983['id'],'WhatsappQueueId':_0x3f44a9[_0xcf23('0x4d')]['id']},'transaction':_0x1c5d84});});})['then'](function(){_0x1d706a[_0xcf23('0x6e')](function(_0x5a011c){socket['emit'](_0xcf23('0x6f'),{'UserId':_0x5a011c['id'],'WhatsappQueueId':_0x4aedd5['id']});});});});});}})[_0xcf23('0x2a')](respondWithStatusCode(_0x40d6e8,null))[_0xcf23('0x50')](handleError(_0x40d6e8,null));};exports[_0xcf23('0x70')]=function(_0x19248d,_0x2fbf11,_0x4317fa){return db[_0xcf23('0x65')]['findAll']({'where':{'id':_0x19248d[_0xcf23('0x38')][_0xcf23('0x67')]},'attributes':['id'],'include':[{'model':db[_0xcf23('0x5d')],'as':_0xcf23('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2fbf11,null))[_0xcf23('0x2a')](function(_0x429111){var _0x1f8bb1=_[_0xcf23('0x32')](_0x429111,'id');var _0x12b3f8=[];var _0x5be1f9=[];var _0x29a7e4=squel['select']();_0x29a7e4[_0xcf23('0x71')](_0xcf23('0x72'))[_0xcf23('0x73')](_0xcf23('0x74'),'tq')[_0xcf23('0x75')](_0xcf23('0x76'),'ut',_0xcf23('0x77'))[_0xcf23('0x43')]('WhatsappQueueId\x20=\x20?',_0x19248d[_0xcf23('0x4d')]['id']);for(var _0x42df78=0x0;_0x42df78<_0x429111[_0xcf23('0x3e')];_0x42df78+=0x1){let _0x1b265=_0x429111[_0x42df78];for(var _0x32c5a2=0x0;_0x32c5a2<_0x1b265[_0xcf23('0x68')][_0xcf23('0x3e')];_0x32c5a2+=0x1){let _0x35d6ee=_0x1b265[_0xcf23('0x68')][_0x32c5a2];var _0x2581db=_0x29a7e4['clone']();_0x2581db[_0xcf23('0x43')](_0xcf23('0x78'),_0x35d6ee['id']);_0x5be1f9[_0xcf23('0x79')](db[_0xcf23('0x7a')][_0xcf23('0x38')](_0x2581db[_0xcf23('0x7b')](),{'type':db[_0xcf23('0x7a')][_0xcf23('0x7c')][_0xcf23('0x7d')]})['then'](function(_0x29a4e8){if(_0x29a4e8['length']===0x1){return _0x35d6ee['id'];}else{var _0x21c0ed=_[_0xcf23('0x7e')](_[_0xcf23('0x32')](_0x29a4e8,_0xcf23('0x7f')),function(_0x1f8911){return _[_0xcf23('0x80')](_0x1f8bb1,_0x1f8911);});if(_0x21c0ed){return _0x35d6ee['id'];}}}));}}return BPromise[_0xcf23('0x81')](_0x5be1f9)[_0xcf23('0x2a')](function(_0x8ac97e){_0x12b3f8=_(_0x12b3f8)[_0xcf23('0x82')](_0x8ac97e)[_0xcf23('0x83')]()['value']();return db[_0xcf23('0x33')]['find']({'where':{'id':_0x19248d['params']['id']}})[_0xcf23('0x2a')](function(_0x23d260){return db['sequelize'][_0xcf23('0x84')](function(_0x385de3){return _0x23d260[_0xcf23('0x70')](_0x19248d['query'][_0xcf23('0x67')],{'transaction':_0x385de3})[_0xcf23('0x2a')](function(){if(!_[_0xcf23('0x85')](_0x12b3f8)){return _0x23d260[_0xcf23('0x86')](_0x12b3f8,{'transaction':_0x385de3});}})[_0xcf23('0x2a')](function(){_0x12b3f8[_0xcf23('0x6e')](function(_0x438dc0){socket[_0xcf23('0x87')](_0xcf23('0x88'),{'UserId':_0x438dc0,'WhatsappQueueId':_0x23d260['id']});});});});});});})['then'](respondWithStatusCode(_0x2fbf11,null))[_0xcf23('0x50')](handleError(_0x2fbf11,null));};exports[_0xcf23('0x89')]=function(_0x3421fd,_0x4b91c8,_0x2eb6aa){return db['WhatsappQueue']['find']({'where':{'id':_0x3421fd[_0xcf23('0x4d')]['id']}})[_0xcf23('0x2a')](handleEntityNotFound(_0x4b91c8,null))[_0xcf23('0x2a')](function(_0x264e60){if(_0x264e60){return _0x264e60[_0xcf23('0x89')](_0x3421fd['body']['ids'],_[_0xcf23('0x8a')](_0x3421fd[_0xcf23('0x52')],[_0xcf23('0x67'),'id'])||{})[_0xcf23('0x8b')](function(_0x554ffd){for(var _0x3b3912=0x0;_0x3b3912<_0x3421fd['body']['ids']['length'];_0x3b3912+=0x1){socket[_0xcf23('0x87')](_0xcf23('0x6f'),{'UserId':Number(_0x3421fd[_0xcf23('0x52')][_0xcf23('0x67')][_0x3b3912]),'WhatsappQueueId':Number(_0x3421fd['params']['id'])});}return _0x554ffd;});}})[_0xcf23('0x2a')](respondWithResult(_0x4b91c8,null))['catch'](handleError(_0x4b91c8,null));};exports[_0xcf23('0x86')]=function(_0x180a82,_0x1d65f6,_0x2894e7){return db[_0xcf23('0x33')][_0xcf23('0x4f')]({'where':{'id':_0x180a82[_0xcf23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d65f6,null))[_0xcf23('0x2a')](function(_0x15e5b3){if(_0x15e5b3){return _0x15e5b3[_0xcf23('0x86')](_0x180a82[_0xcf23('0x38')][_0xcf23('0x67')])[_0xcf23('0x2a')](function(){if(_[_0xcf23('0x8c')](_0x180a82['query'][_0xcf23('0x67')])){for(var _0x401e07=0x0;_0x401e07<_0x180a82[_0xcf23('0x38')][_0xcf23('0x67')]['length'];_0x401e07+=0x1){socket[_0xcf23('0x87')](_0xcf23('0x88'),{'UserId':Number(_0x180a82[_0xcf23('0x38')][_0xcf23('0x67')][_0x401e07]),'WhatsappQueueId':Number(_0x180a82[_0xcf23('0x4d')]['id'])});}}else{socket[_0xcf23('0x87')](_0xcf23('0x88'),{'UserId':Number(_0x180a82[_0xcf23('0x38')][_0xcf23('0x67')]),'WhatsappQueueId':Number(_0x180a82[_0xcf23('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d65f6,null))[_0xcf23('0x50')](handleError(_0x1d65f6,null));};exports[_0xcf23('0x8d')]=function(_0x5872f7,_0x34dc51,_0x59b0eb){var _0x512df1={};var _0x408d59={};var _0x135a69;var _0x553121;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5872f7[_0xcf23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34dc51,null))[_0xcf23('0x2a')](function(_0x29b06b){if(_0x29b06b){_0x135a69=_0x29b06b;_0x408d59['model']=_[_0xcf23('0x4e')](db['User']['rawAttributes']);_0x408d59[_0xcf23('0x38')]=_[_0xcf23('0x4e')](_0x5872f7['query']);_0x408d59[_0xcf23('0x39')]=_[_0xcf23('0x3a')](_0x408d59[_0xcf23('0x3c')],_0x408d59[_0xcf23('0x38')]);_0x512df1[_0xcf23('0x3b')]=_['intersection'](_0x408d59[_0xcf23('0x3c')],qs[_0xcf23('0x3d')](_0x5872f7['query']['fields']));_0x512df1[_0xcf23('0x3b')]=_0x512df1[_0xcf23('0x3b')][_0xcf23('0x3e')]?_0x512df1[_0xcf23('0x3b')]:_0x408d59[_0xcf23('0x3c')];_0x512df1[_0xcf23('0x41')]=qs[_0xcf23('0x42')](_0x5872f7[_0xcf23('0x38')][_0xcf23('0x42')]);_0x512df1[_0xcf23('0x43')]=qs[_0xcf23('0x39')](_[_0xcf23('0x44')](_0x5872f7[_0xcf23('0x38')],_0x408d59[_0xcf23('0x39')]));if(_0x5872f7[_0xcf23('0x38')][_0xcf23('0x45')]){_0x512df1[_0xcf23('0x43')]=_[_0xcf23('0x46')](_0x512df1['where'],{'$or':_[_0xcf23('0x32')](_0x512df1[_0xcf23('0x3b')],function(_0x31fd3d){var _0x50c299={};_0x50c299[_0x31fd3d]={'$like':'%'+_0x5872f7[_0xcf23('0x38')][_0xcf23('0x45')]+'%'};return _0x50c299;})});}_0x512df1=_['merge']({},_0x512df1,_0x5872f7[_0xcf23('0x48')]);return _0x135a69[_0xcf23('0x8d')](_0x512df1);}})[_0xcf23('0x2a')](function(_0x5b26be){if(_0x5b26be){_0x553121=_0x5b26be[_0xcf23('0x3e')];if(!_0x5872f7[_0xcf23('0x38')]['hasOwnProperty'](_0xcf23('0x40'))){_0x512df1[_0xcf23('0x23')]=qs[_0xcf23('0x23')](_0x5872f7[_0xcf23('0x38')][_0xcf23('0x23')]);_0x512df1[_0xcf23('0x21')]=qs[_0xcf23('0x21')](_0x5872f7['query']['offset']);}return _0x135a69[_0xcf23('0x8d')](_0x512df1);}})['then'](function(_0x472733){if(_0x472733){return _0x472733?{'count':_0x553121,'rows':_0x472733}:null;}})[_0xcf23('0x2a')](respondWithResult(_0x34dc51,null))['catch'](handleError(_0x34dc51,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 456fd08..df9697c 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 _0xb760=['hook','exports','../../mysqldb','WhatsappQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x24a737,_0x3ff299){var _0x37b618=function(_0x3f0b2f){while(--_0x3f0b2f){_0x24a737['push'](_0x24a737['shift']());}};_0x37b618(++_0x3ff299);}(_0xb760,0xbf));var _0x0b76=function(_0x27e373,_0x3080e4){_0x27e373=_0x27e373-0x0;var _0x1a21ec=_0xb760[_0x27e373];return _0x1a21ec;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x0b76('0x0'))['db'][_0x0b76('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b76('0x2'),'afterUpdate':_0x0b76('0x3'),'afterDestroy':_0x0b76('0x4')};function emitEvent(_0x1ef362){return function(_0x502f7c,_0x1aa7cd,_0x539987){WhatsappQueueEvents[_0x0b76('0x5')](_0x1ef362+':'+_0x502f7c['id'],_0x502f7c);WhatsappQueueEvents[_0x0b76('0x5')](_0x1ef362,_0x502f7c);_0x539987(null);};}for(var e in events){if(events[_0x0b76('0x6')](e)){var event=events[e];WhatsappQueue[_0x0b76('0x7')](e,emitEvent(event));}}module[_0x0b76('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4289=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5e50a7,_0x3f0a9e){var _0x57be9b=function(_0x4e5b01){while(--_0x4e5b01){_0x5e50a7['push'](_0x5e50a7['shift']());}};_0x57be9b(++_0x3f0a9e);}(_0x4289,0x9e));var _0x9428=function(_0x2be343,_0x25bd74){_0x2be343=_0x2be343-0x0;var _0x56c1a4=_0x4289[_0x2be343];return _0x56c1a4;};'use strict';var EventEmitter=require(_0x9428('0x0'));var WhatsappQueue=require(_0x9428('0x1'))['db'][_0x9428('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9428('0x3')](0x0);var events={'afterCreate':_0x9428('0x4'),'afterUpdate':_0x9428('0x5'),'afterDestroy':_0x9428('0x6')};function emitEvent(_0x20faf0){return function(_0x2e6e7d,_0x2ef77d,_0x400e7e){WhatsappQueueEvents['emit'](_0x20faf0+':'+_0x2e6e7d['id'],_0x2e6e7d);WhatsappQueueEvents[_0x9428('0x7')](_0x20faf0,_0x2e6e7d);_0x400e7e(null);};}for(var e in events){if(events[_0x9428('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x9428('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 4ee530e..44e6f7d 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 _0x39d3=['whatsapp_queues','lodash','util','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define'];(function(_0x239584,_0x1ed178){var _0x1f65b0=function(_0x3fdcdc){while(--_0x3fdcdc){_0x239584['push'](_0x239584['shift']());}};_0x1f65b0(++_0x1ed178);}(_0x39d3,0x173));var _0x339d=function(_0x5e055e,_0x36b550){_0x5e055e=_0x5e055e-0x0;var _0x4ce50d=_0x39d3[_0x5e055e];return _0x4ce50d;};'use strict';var _=require(_0x339d('0x0'));var util=require(_0x339d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x339d('0x2'));var rp=require(_0x339d('0x3'));var fs=require('fs');var path=require(_0x339d('0x4'));var rimraf=require(_0x339d('0x5'));var config=require('../../config/environment');var attributes=require(_0x339d('0x6'));module[_0x339d('0x7')]=function(_0xd68f5c,_0x432be9){return _0xd68f5c[_0x339d('0x8')]('WhatsappQueue',attributes,{'tableName':_0x339d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb71c=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','whatsapp_queues','util'];(function(_0x588981,_0x5706bd){var _0x3eb575=function(_0x3abc3d){while(--_0x3abc3d){_0x588981['push'](_0x588981['shift']());}};_0x3eb575(++_0x5706bd);}(_0xb71c,0x10d));var _0xcb71=function(_0x43b6a2,_0x510bf0){_0x43b6a2=_0x43b6a2-0x0;var _0x230afa=_0xb71c[_0x43b6a2];return _0x230afa;};'use strict';var _=require('lodash');var util=require(_0xcb71('0x0'));var logger=require(_0xcb71('0x1'))(_0xcb71('0x2'));var moment=require(_0xcb71('0x3'));var BPromise=require(_0xcb71('0x4'));var rp=require(_0xcb71('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb71('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0xcb71('0x7')]=function(_0x1c3780,_0x430942){return _0x1c3780[_0xcb71('0x8')]('WhatsappQueue',attributes,{'tableName':_0xcb71('0x9'),'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 cf86286..e37b3b4 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 _0xd84c=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','include','model','attributes','map','debug','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3b6a18,_0x24810c){var _0xcaaac9=function(_0x98457d){while(--_0x98457d){_0x3b6a18['push'](_0x3b6a18['shift']());}};_0xcaaac9(++_0x24810c);}(_0xd84c,0x1c5));var _0xcd84=function(_0xee7a92,_0x35a969){_0xee7a92=_0xee7a92-0x0;var _0x511e14=_0xd84c[_0xee7a92];return _0x511e14;};'use strict';var _=require(_0xcd84('0x0'));var util=require('util');var moment=require(_0xcd84('0x1'));var BPromise=require(_0xcd84('0x2'));var rs=require(_0xcd84('0x3'));var fs=require('fs');var Redis=require(_0xcd84('0x4'));var db=require(_0xcd84('0x5'))['db'];var utils=require(_0xcd84('0x6'));var logger=require(_0xcd84('0x7'))(_0xcd84('0x8'));var config=require(_0xcd84('0x9'));var jayson=require(_0xcd84('0xa'));var client=jayson[_0xcd84('0xb')][_0xcd84('0xc')]({'port':0x232a});config[_0xcd84('0xd')]=_['defaults'](config['redis'],{'host':_0xcd84('0xe'),'port':0x18eb});var socket=require(_0xcd84('0xf'))(new Redis(config['redis']));require(_0xcd84('0x10'))[_0xcd84('0x11')](socket);function respondWithRpcPromise(_0x5ef591,_0x273e85,_0x128559){return new BPromise(function(_0x238d2f,_0xdc19c8){return client['request'](_0x5ef591,_0x128559)[_0xcd84('0x12')](function(_0x21e8b4){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x273e85,_0xcd84('0x13'));logger['debug'](_0xcd84('0x14'),_0x273e85,_0xcd84('0x13'),JSON[_0xcd84('0x15')](_0x21e8b4));if(_0x21e8b4[_0xcd84('0x16')]){if(_0x21e8b4[_0xcd84('0x16')][_0xcd84('0x17')]===0x1f4){logger[_0xcd84('0x16')](_0xcd84('0x18'),_0x273e85,_0x21e8b4[_0xcd84('0x16')]['message']);return _0xdc19c8(_0x21e8b4[_0xcd84('0x16')][_0xcd84('0x19')]);}logger[_0xcd84('0x16')](_0xcd84('0x18'),_0x273e85,_0x21e8b4[_0xcd84('0x16')][_0xcd84('0x19')]);return _0x238d2f(_0x21e8b4[_0xcd84('0x16')][_0xcd84('0x19')]);}else{logger[_0xcd84('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0x273e85,_0xcd84('0x13'));_0x238d2f(_0x21e8b4[_0xcd84('0x1b')][_0xcd84('0x19')]);}})[_0xcd84('0x1c')](function(_0x530fb4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x273e85,_0x530fb4);_0xdc19c8(_0x530fb4);});});}exports[_0xcd84('0x1d')]=function(_0x49024e){var _0xf673cf=this;return new Promise(function(_0x4b6d87,_0x3ad541){return db[_0xcd84('0x1e')][_0xcd84('0x1f')]({'raw':_0x49024e[_0xcd84('0x20')]?_0x49024e[_0xcd84('0x20')][_0xcd84('0x21')]===undefined?!![]:![]:!![],'where':_0x49024e[_0xcd84('0x20')]?_0x49024e['options'][_0xcd84('0x22')]||null:null,'attributes':_0x49024e[_0xcd84('0x20')]?_0x49024e[_0xcd84('0x20')]['attributes']||null:null,'limit':_0x49024e[_0xcd84('0x20')]?_0x49024e[_0xcd84('0x20')]['limit']||null:null,'include':_0x49024e[_0xcd84('0x20')]?_0x49024e[_0xcd84('0x20')][_0xcd84('0x23')]?_['map'](_0x49024e['options']['include'],function(_0x2f662f){return{'model':db[_0x2f662f[_0xcd84('0x24')]],'as':_0x2f662f['as'],'attributes':_0x2f662f[_0xcd84('0x25')],'include':_0x2f662f[_0xcd84('0x23')]?_[_0xcd84('0x26')](_0x2f662f['include'],function(_0x4ed591){return{'model':db[_0x4ed591[_0xcd84('0x24')]],'as':_0x4ed591['as'],'attributes':_0x4ed591[_0xcd84('0x25')],'include':_0x4ed591[_0xcd84('0x23')]?_[_0xcd84('0x26')](_0x4ed591['include'],function(_0x193603){return{'model':db[_0x193603[_0xcd84('0x24')]],'as':_0x193603['as'],'attributes':_0x193603[_0xcd84('0x25')]};}):[]};}):[]};}):[]:[]})[_0xcd84('0x12')](function(_0x42aac7){logger['info'](_0xcd84('0x1d'),_0x49024e);logger[_0xcd84('0x27')](_0xcd84('0x1d'),_0x49024e,JSON['stringify'](_0x42aac7));_0x4b6d87(_0x42aac7);})['catch'](function(_0x3e1a5f){logger[_0xcd84('0x16')](_0xcd84('0x1d'),_0x3e1a5f[_0xcd84('0x19')],_0x49024e);_0x3ad541(_0xf673cf[_0xcd84('0x16')](0x1f4,_0x3e1a5f[_0xcd84('0x19')]));});});};exports[_0xcd84('0x28')]=function(_0x37444f){var _0x1261bf=this;return new Promise(function(_0x552d23,_0x34509b){return db[_0xcd84('0x1e')][_0xcd84('0x29')]({'raw':_0x37444f[_0xcd84('0x20')]?_0x37444f[_0xcd84('0x20')][_0xcd84('0x21')]===undefined?!![]:![]:!![],'where':_0x37444f[_0xcd84('0x20')]?_0x37444f[_0xcd84('0x20')][_0xcd84('0x22')]||null:null,'attributes':_0x37444f[_0xcd84('0x20')]?_0x37444f[_0xcd84('0x20')][_0xcd84('0x25')]||null:null,'include':_0x37444f['options']?_0x37444f[_0xcd84('0x20')]['include']?_[_0xcd84('0x26')](_0x37444f['options'][_0xcd84('0x23')],function(_0x292287){return{'model':db[_0x292287['model']],'as':_0x292287['as'],'attributes':_0x292287[_0xcd84('0x25')],'include':_0x292287[_0xcd84('0x23')]?_['map'](_0x292287[_0xcd84('0x23')],function(_0x3d8bd2){return{'model':db[_0x3d8bd2[_0xcd84('0x24')]],'as':_0x3d8bd2['as'],'attributes':_0x3d8bd2[_0xcd84('0x25')],'include':_0x3d8bd2[_0xcd84('0x23')]?_[_0xcd84('0x26')](_0x3d8bd2[_0xcd84('0x23')],function(_0x2b0c04){return{'model':db[_0x2b0c04['model']],'as':_0x2b0c04['as'],'attributes':_0x2b0c04[_0xcd84('0x25')]};}):[]};}):[]};}):[]:[]})[_0xcd84('0x12')](function(_0xdff91d){logger[_0xcd84('0x1a')]('ShowWhatsappQueue',_0x37444f);logger['debug'](_0xcd84('0x28'),_0x37444f,JSON[_0xcd84('0x15')](_0xdff91d));_0x552d23(_0xdff91d);})['catch'](function(_0x23d630){logger['error'](_0xcd84('0x28'),_0x23d630['message'],_0x37444f);_0x34509b(_0x1261bf[_0xcd84('0x16')](0x1f4,_0x23d630[_0xcd84('0x19')]));});});}; \ No newline at end of file +var _0x98be=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetWhatsappQueue','findAll','options','where','map','model','include','attributes','stringify','catch','WhatsappQueue','find','raw','ShowWhatsappQueue','lodash','util','bluebird','randomstring','ioredis'];(function(_0xfc20f8,_0x2873d1){var _0x2f1fd9=function(_0x234f11){while(--_0x234f11){_0xfc20f8['push'](_0xfc20f8['shift']());}};_0x2f1fd9(++_0x2873d1);}(_0x98be,0x195));var _0xe98b=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x98be[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xe98b('0x0'));var util=require(_0xe98b('0x1'));var moment=require('moment');var BPromise=require(_0xe98b('0x2'));var rs=require(_0xe98b('0x3'));var fs=require('fs');var Redis=require(_0xe98b('0x4'));var db=require(_0xe98b('0x5'))['db'];var utils=require(_0xe98b('0x6'));var logger=require(_0xe98b('0x7'))(_0xe98b('0x8'));var config=require(_0xe98b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe98b('0xa')][_0xe98b('0xb')]({'port':0x232a});config[_0xe98b('0xc')]=_[_0xe98b('0xd')](config[_0xe98b('0xc')],{'host':_0xe98b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe98b('0xc')]));require(_0xe98b('0xf'))[_0xe98b('0x10')](socket);function respondWithRpcPromise(_0x19ef4c,_0x2b13bb,_0x8d146c){return new BPromise(function(_0x38c983,_0x4c09af){return client['request'](_0x19ef4c,_0x8d146c)[_0xe98b('0x11')](function(_0x35f61a){logger[_0xe98b('0x12')](_0xe98b('0x13'),_0x2b13bb,_0xe98b('0x14'));logger[_0xe98b('0x15')](_0xe98b('0x16'),_0x2b13bb,_0xe98b('0x14'),JSON['stringify'](_0x35f61a));if(_0x35f61a[_0xe98b('0x17')]){if(_0x35f61a[_0xe98b('0x17')][_0xe98b('0x18')]===0x1f4){logger[_0xe98b('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x2b13bb,_0x35f61a['error'][_0xe98b('0x19')]);return _0x4c09af(_0x35f61a[_0xe98b('0x17')][_0xe98b('0x19')]);}logger[_0xe98b('0x17')](_0xe98b('0x13'),_0x2b13bb,_0x35f61a[_0xe98b('0x17')]['message']);return _0x38c983(_0x35f61a[_0xe98b('0x17')]['message']);}else{logger[_0xe98b('0x12')](_0xe98b('0x13'),_0x2b13bb,_0xe98b('0x14'));_0x38c983(_0x35f61a[_0xe98b('0x1a')]['message']);}})['catch'](function(_0x8ea9d9){logger[_0xe98b('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x2b13bb,_0x8ea9d9);_0x4c09af(_0x8ea9d9);});});}exports[_0xe98b('0x1b')]=function(_0x1f001e){var _0x4d12b2=this;return new Promise(function(_0xd13741,_0x1120fd){return db['WhatsappQueue'][_0xe98b('0x1c')]({'raw':_0x1f001e[_0xe98b('0x1d')]?_0x1f001e['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f001e[_0xe98b('0x1d')]?_0x1f001e['options'][_0xe98b('0x1e')]||null:null,'attributes':_0x1f001e[_0xe98b('0x1d')]?_0x1f001e['options']['attributes']||null:null,'limit':_0x1f001e[_0xe98b('0x1d')]?_0x1f001e[_0xe98b('0x1d')]['limit']||null:null,'include':_0x1f001e['options']?_0x1f001e['options']['include']?_[_0xe98b('0x1f')](_0x1f001e[_0xe98b('0x1d')]['include'],function(_0x16ba5b){return{'model':db[_0x16ba5b[_0xe98b('0x20')]],'as':_0x16ba5b['as'],'attributes':_0x16ba5b['attributes'],'include':_0x16ba5b['include']?_[_0xe98b('0x1f')](_0x16ba5b[_0xe98b('0x21')],function(_0xa6242d){return{'model':db[_0xa6242d[_0xe98b('0x20')]],'as':_0xa6242d['as'],'attributes':_0xa6242d[_0xe98b('0x22')],'include':_0xa6242d[_0xe98b('0x21')]?_[_0xe98b('0x1f')](_0xa6242d[_0xe98b('0x21')],function(_0x2181d2){return{'model':db[_0x2181d2[_0xe98b('0x20')]],'as':_0x2181d2['as'],'attributes':_0x2181d2[_0xe98b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe98b('0x11')](function(_0x10789d){logger['info'](_0xe98b('0x1b'),_0x1f001e);logger[_0xe98b('0x15')](_0xe98b('0x1b'),_0x1f001e,JSON[_0xe98b('0x23')](_0x10789d));_0xd13741(_0x10789d);})[_0xe98b('0x24')](function(_0x4f7d67){logger[_0xe98b('0x17')](_0xe98b('0x1b'),_0x4f7d67[_0xe98b('0x19')],_0x1f001e);_0x1120fd(_0x4d12b2['error'](0x1f4,_0x4f7d67[_0xe98b('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x123110){var _0x4e6723=this;return new Promise(function(_0x3e6c1d,_0x2990cb){return db[_0xe98b('0x25')][_0xe98b('0x26')]({'raw':_0x123110[_0xe98b('0x1d')]?_0x123110['options'][_0xe98b('0x27')]===undefined?!![]:![]:!![],'where':_0x123110[_0xe98b('0x1d')]?_0x123110[_0xe98b('0x1d')][_0xe98b('0x1e')]||null:null,'attributes':_0x123110[_0xe98b('0x1d')]?_0x123110['options']['attributes']||null:null,'include':_0x123110[_0xe98b('0x1d')]?_0x123110[_0xe98b('0x1d')][_0xe98b('0x21')]?_[_0xe98b('0x1f')](_0x123110[_0xe98b('0x1d')][_0xe98b('0x21')],function(_0x37087d){return{'model':db[_0x37087d[_0xe98b('0x20')]],'as':_0x37087d['as'],'attributes':_0x37087d[_0xe98b('0x22')],'include':_0x37087d['include']?_['map'](_0x37087d['include'],function(_0xfd914b){return{'model':db[_0xfd914b[_0xe98b('0x20')]],'as':_0xfd914b['as'],'attributes':_0xfd914b[_0xe98b('0x22')],'include':_0xfd914b[_0xe98b('0x21')]?_[_0xe98b('0x1f')](_0xfd914b[_0xe98b('0x21')],function(_0x445c47){return{'model':db[_0x445c47[_0xe98b('0x20')]],'as':_0x445c47['as'],'attributes':_0x445c47[_0xe98b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe98b('0x11')](function(_0x323851){logger[_0xe98b('0x12')](_0xe98b('0x28'),_0x123110);logger['debug'](_0xe98b('0x28'),_0x123110,JSON[_0xe98b('0x23')](_0x323851));_0x3e6c1d(_0x323851);})[_0xe98b('0x24')](function(_0x304cbf){logger[_0xe98b('0x17')](_0xe98b('0x28'),_0x304cbf['message'],_0x123110);_0x2990cb(_0x4e6723[_0xe98b('0x17')](0x1f4,_0x304cbf[_0xe98b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ba5db41..a9b0cf2 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 _0x3b0e=['emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x3b0e,0x15c));var _0xe3b0=function(_0x2915ba,_0x353dc9){_0x2915ba=_0x2915ba-0x0;var _0x214134=_0x3b0e[_0x2915ba];return _0x214134;};'use strict';var WhatsappQueueEvents=require(_0xe3b0('0x0'));var events=[_0xe3b0('0x1'),_0xe3b0('0x2'),_0xe3b0('0x3')];function createListener(_0x3d8c99,_0x31f77e){return function(_0x373a5a){_0x31f77e[_0xe3b0('0x4')](_0x3d8c99,_0x373a5a);};}function removeListener(_0x3da49f,_0x3c6c39){return function(){WhatsappQueueEvents[_0xe3b0('0x5')](_0x3da49f,_0x3c6c39);};}exports[_0xe3b0('0x6')]=function(_0x4e9ed9){for(var _0x42daf9=0x0,_0x4936cf=events['length'];_0x42daf9<_0x4936cf;_0x42daf9++){var _0x349bb5=events[_0x42daf9];var _0x5dde5b=createListener(_0xe3b0('0x7')+_0x349bb5,_0x4e9ed9);WhatsappQueueEvents['on'](_0x349bb5,_0x5dde5b);}}; \ No newline at end of file +var _0x8ae8=['length','./whatsappQueue.events','save','emit','removeListener'];(function(_0x44e0a4,_0x4dbc5a){var _0x16c53b=function(_0x460617){while(--_0x460617){_0x44e0a4['push'](_0x44e0a4['shift']());}};_0x16c53b(++_0x4dbc5a);}(_0x8ae8,0x164));var _0x88ae=function(_0x493c8c,_0x470567){_0x493c8c=_0x493c8c-0x0;var _0x17344b=_0x8ae8[_0x493c8c];return _0x17344b;};'use strict';var WhatsappQueueEvents=require(_0x88ae('0x0'));var events=[_0x88ae('0x1'),'remove','update'];function createListener(_0x49359d,_0x38f3b8){return function(_0x48b166){_0x38f3b8[_0x88ae('0x2')](_0x49359d,_0x48b166);};}function removeListener(_0x3087f0,_0x4d9cbf){return function(){WhatsappQueueEvents[_0x88ae('0x3')](_0x3087f0,_0x4d9cbf);};}exports['register']=function(_0x23ba99){for(var _0x93088a=0x0,_0x3b0171=events[_0x88ae('0x4')];_0x93088a<_0x3b0171;_0x93088a++){var _0x178dcb=events[_0x93088a];var _0x123945=createListener('whatsappQueue:'+_0x178dcb,_0x23ba99);WhatsappQueueEvents['on'](_0x178dcb,_0x123945);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f9fe384..b67eada 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 _0xf17a=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','show','post','create','put','/:id','update','destroy','exports'];(function(_0x361078,_0x5a4a9a){var _0x27a219=function(_0x7e7298){while(--_0x7e7298){_0x361078['push'](_0x361078['shift']());}};_0x27a219(++_0x5a4a9a);}(_0xf17a,0x169));var _0xaf17=function(_0x190b40,_0x5bb821){_0x190b40=_0x190b40-0x0;var _0x21c1e2=_0xf17a[_0x190b40];return _0x21c1e2;};'use strict';var multer=require(_0xaf17('0x0'));var util=require(_0xaf17('0x1'));var path=require(_0xaf17('0x2'));var timeout=require(_0xaf17('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf17('0x4'));var interaction=require(_0xaf17('0x5'));var config=require(_0xaf17('0x6'));var controller=require(_0xaf17('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaf17('0x8')](_0xaf17('0x9'),auth[_0xaf17('0xa')](),controller['describe']);router['get']('/:id',auth[_0xaf17('0xa')](),controller[_0xaf17('0xb')]);router[_0xaf17('0xc')]('/',auth[_0xaf17('0xa')](),controller[_0xaf17('0xd')]);router[_0xaf17('0xe')](_0xaf17('0xf'),auth[_0xaf17('0xa')](),controller[_0xaf17('0x10')]);router['delete'](_0xaf17('0xf'),auth[_0xaf17('0xa')](),controller[_0xaf17('0x11')]);module[_0xaf17('0x12')]=router; \ No newline at end of file +var _0x56e9=['./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x54f493,_0x385811){var _0x5f2b47=function(_0x2d2323){while(--_0x2d2323){_0x54f493['push'](_0x54f493['shift']());}};_0x5f2b47(++_0x385811);}(_0x56e9,0x129));var _0x956e=function(_0x312260,_0x5b44df){_0x312260=_0x312260-0x0;var _0x507af0=_0x56e9[_0x312260];return _0x507af0;};'use strict';var multer=require('multer');var util=require(_0x956e('0x0'));var path=require(_0x956e('0x1'));var timeout=require(_0x956e('0x2'));var express=require(_0x956e('0x3'));var router=express[_0x956e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x956e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x956e('0x6'));var controller=require(_0x956e('0x7'));router[_0x956e('0x8')]('/',auth[_0x956e('0x9')](),controller[_0x956e('0xa')]);router['get'](_0x956e('0xb'),auth[_0x956e('0x9')](),controller[_0x956e('0xc')]);router[_0x956e('0x8')]('/:id',auth[_0x956e('0x9')](),controller[_0x956e('0xd')]);router[_0x956e('0xe')]('/',auth[_0x956e('0x9')](),controller[_0x956e('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x956e('0x10')](_0x956e('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x956e('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a407da2..f94c47c 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(_0x5cc0c2,_0x12ff31){var _0x6217ba=function(_0x269b4d){while(--_0x269b4d){_0x5cc0c2['push'](_0x5cc0c2['shift']());}};_0x6217ba(++_0x12ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x534287,_0x3efac4){_0x534287=_0x534287-0x0;var _0x303ca6=_0x7a54[_0x534287];return _0x303ca6;};'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(_0x24d3a8,_0x2ae428){var _0x15505c=function(_0x2d4849){while(--_0x2d4849){_0x24d3a8['push'](_0x24d3a8['shift']());}};_0x15505c(++_0x2ae428);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 2a5859d..86871bd 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 _0x0713=['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','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','params','keys','find','catch','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x5a06f8,_0x295a76){var _0x394588=function(_0x370562){while(--_0x370562){_0x5a06f8['push'](_0x5a06f8['shift']());}};_0x394588(++_0x295a76);}(_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={},_0x292205={},_0x254fc8={'count':0x0,'rows':[]};var _0x5aba96=_['map'](db[_0x3071('0x2d')][_0x3071('0x2e')],function(_0x6ddf96){return{'name':_0x6ddf96[_0x3071('0x2f')],'type':_0x6ddf96[_0x3071('0x30')][_0x3071('0x31')]};});_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x5aba96,'name');_0x292205['query']=_['keys'](_0x177b5f[_0x3071('0x34')]);_0x292205[_0x3071('0x35')]=_['intersection'](_0x292205[_0x3071('0x32')],_0x292205[_0x3071('0x34')]);_0x32f1b4[_0x3071('0x36')]=_[_0x3071('0x37')](_0x292205['model'],qs[_0x3071('0x38')](_0x177b5f[_0x3071('0x34')][_0x3071('0x38')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x39')]?_0x32f1b4[_0x3071('0x36')]:_0x292205[_0x3071('0x32')];if(!_0x177b5f['query'][_0x3071('0x3a')]('nolimit')){_0x32f1b4['limit']=qs[_0x3071('0x20')](_0x177b5f[_0x3071('0x34')]['limit']);_0x32f1b4[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x177b5f[_0x3071('0x34')][_0x3071('0x1e')]);}_0x32f1b4[_0x3071('0x3b')]=qs[_0x3071('0x3c')](_0x177b5f['query'][_0x3071('0x3c')]);_0x32f1b4[_0x3071('0x3d')]=qs['filters'](_[_0x3071('0x3e')](_0x177b5f['query'],_0x292205[_0x3071('0x35')]),_0x5aba96);if(_0x177b5f[_0x3071('0x34')]['filter']){_0x32f1b4['where']=_[_0x3071('0x3f')](_0x32f1b4[_0x3071('0x3d')],{'$or':_[_0x3071('0x33')](_0x5aba96,function(_0x55afa6){if(_0x55afa6[_0x3071('0x30')]!=='VIRTUAL'){var _0x1ac90a={};_0x1ac90a[_0x55afa6['name']]={'$like':'%'+_0x177b5f[_0x3071('0x34')][_0x3071('0x40')]+'%'};return _0x1ac90a;}})});}_0x32f1b4=_[_0x3071('0x3f')]({},_0x32f1b4,_0x177b5f[_0x3071('0x41')]);var _0x30ab68={'where':_0x32f1b4['where']};return db['WhatsappQueueReport'][_0x3071('0x21')](_0x30ab68)[_0x3071('0x27')](function(_0x1455be){_0x254fc8[_0x3071('0x21')]=_0x1455be;if(_0x177b5f['query'][_0x3071('0x42')]){_0x32f1b4[_0x3071('0x43')]=[{'all':!![]}];}return db[_0x3071('0x2d')][_0x3071('0x44')](_0x32f1b4);})[_0x3071('0x27')](function(_0xb9a4b8){_0x254fc8['rows']=_0xb9a4b8;return _0x254fc8;})[_0x3071('0x27')](respondWithFilteredResult(_0x3921a1,_0x32f1b4))['catch'](handleError(_0x3921a1,null));};exports['show']=function(_0x4dc9d1,_0x47ceaf){var _0x2992e6={'raw':!![],'where':{'id':_0x4dc9d1[_0x3071('0x45')]['id']}},_0x1be8b6={};_0x1be8b6[_0x3071('0x32')]=_[_0x3071('0x46')](db[_0x3071('0x2d')][_0x3071('0x2e')]);_0x1be8b6[_0x3071('0x34')]=_['keys'](_0x4dc9d1[_0x3071('0x34')]);_0x1be8b6[_0x3071('0x35')]=_[_0x3071('0x37')](_0x1be8b6[_0x3071('0x32')],_0x1be8b6[_0x3071('0x34')]);_0x2992e6['attributes']=_['intersection'](_0x1be8b6[_0x3071('0x32')],qs[_0x3071('0x38')](_0x4dc9d1[_0x3071('0x34')][_0x3071('0x38')]));_0x2992e6[_0x3071('0x36')]=_0x2992e6['attributes'][_0x3071('0x39')]?_0x2992e6['attributes']:_0x1be8b6[_0x3071('0x32')];if(_0x4dc9d1['query']['includeAll']){_0x2992e6[_0x3071('0x43')]=[{'all':!![]}];}_0x2992e6=_['merge']({},_0x2992e6,_0x4dc9d1[_0x3071('0x41')]);return db['WhatsappQueueReport'][_0x3071('0x47')](_0x2992e6)[_0x3071('0x27')](handleEntityNotFound(_0x47ceaf,null))[_0x3071('0x27')](respondWithResult(_0x47ceaf,null))[_0x3071('0x48')](handleError(_0x47ceaf,null));};exports['create']=function(_0x2d70bf,_0x575c12){return db[_0x3071('0x2d')]['create'](_0x2d70bf[_0x3071('0x49')],{})[_0x3071('0x27')](respondWithResult(_0x575c12,0xc9))['catch'](handleError(_0x575c12,null));};exports[_0x3071('0x26')]=function(_0x117e73,_0x224a70){if(_0x117e73[_0x3071('0x49')]['id']){delete _0x117e73[_0x3071('0x49')]['id'];}return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x117e73['params']['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x224a70,null))[_0x3071('0x27')](saveUpdates(_0x117e73[_0x3071('0x49')],null))[_0x3071('0x27')](respondWithResult(_0x224a70,null))['catch'](handleError(_0x224a70,null));};exports[_0x3071('0x28')]=function(_0x2aea37,_0x1b832e){return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x2aea37[_0x3071('0x45')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1b832e,null))[_0x3071('0x27')](removeEntity(_0x1b832e,null))[_0x3071('0x48')](handleError(_0x1b832e,null));};exports[_0x3071('0x4a')]=function(_0x4371e7,_0x111115){return db[_0x3071('0x2d')][_0x3071('0x4a')]()[_0x3071('0x27')](respondWithResult(_0x111115,null))[_0x3071('0x48')](handleError(_0x111115,null));}; \ No newline at end of file +var _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','destroy','describe','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce'];(function(_0x82dea3,_0x3f50d9){var _0x240c13=function(_0x30a6e0){while(--_0x30a6e0){_0x82dea3['push'](_0x82dea3['shift']());}};_0x240c13(++_0x3f50d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb7e7[_0x1da04e];return _0xdd8c41;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x483c6f,_0x51d3b1){return function(_0x5dadbb){if(!_0x5dadbb){_0x483c6f[_0x7b7e('0x19')](0x194);}return _0x5dadbb;};}function handleError(_0x3c8192,_0x16a3c7){_0x16a3c7=_0x16a3c7||0x1f4;return function(_0x7aa71){logger[_0x7b7e('0x27')](_0x7aa71['stack']);if(_0x7aa71[_0x7b7e('0x28')]){delete _0x7aa71[_0x7b7e('0x28')];}_0x3c8192['status'](_0x16a3c7)['send'](_0x7aa71);};}exports['index']=function(_0x12ef0b,_0x423832){var _0x503625={},_0x3db8c4={},_0x51d4b5={'count':0x0,'rows':[]};var _0x1b4341=_[_0x7b7e('0x29')](db[_0x7b7e('0x2a')]['rawAttributes'],function(_0x3960b8){return{'name':_0x3960b8[_0x7b7e('0x2b')],'type':_0x3960b8[_0x7b7e('0x2c')][_0x7b7e('0x2d')]};});_0x3db8c4[_0x7b7e('0x2e')]=_['map'](_0x1b4341,_0x7b7e('0x28'));_0x3db8c4['query']=_[_0x7b7e('0x2f')](_0x12ef0b[_0x7b7e('0x30')]);_0x3db8c4[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x3db8c4[_0x7b7e('0x2e')],_0x3db8c4[_0x7b7e('0x30')]);_0x503625[_0x7b7e('0x33')]=_['intersection'](_0x3db8c4['model'],qs[_0x7b7e('0x34')](_0x12ef0b[_0x7b7e('0x30')]['fields']));_0x503625[_0x7b7e('0x33')]=_0x503625[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0x503625['attributes']:_0x3db8c4[_0x7b7e('0x2e')];if(!_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0x503625[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0x503625[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x1d')]);}_0x503625[_0x7b7e('0x38')]=qs[_0x7b7e('0x39')](_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x39')]);_0x503625['where']=qs[_0x7b7e('0x31')](_[_0x7b7e('0x3a')](_0x12ef0b[_0x7b7e('0x30')],_0x3db8c4[_0x7b7e('0x31')]),_0x1b4341);if(_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x503625[_0x7b7e('0x3c')]=_[_0x7b7e('0x3d')](_0x503625[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x29')](_0x1b4341,function(_0x5f3de5){if(_0x5f3de5[_0x7b7e('0x2c')]!==_0x7b7e('0x3e')){var _0x213a8c={};_0x213a8c[_0x5f3de5[_0x7b7e('0x28')]]={'$like':'%'+_0x12ef0b['query'][_0x7b7e('0x3b')]+'%'};return _0x213a8c;}})});}_0x503625=_[_0x7b7e('0x3d')]({},_0x503625,_0x12ef0b[_0x7b7e('0x3f')]);var _0x5c58c0={'where':_0x503625['where']};return db[_0x7b7e('0x2a')]['count'](_0x5c58c0)[_0x7b7e('0x26')](function(_0x3b16d7){_0x51d4b5['count']=_0x3b16d7;if(_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x40')]){_0x503625[_0x7b7e('0x41')]=[{'all':!![]}];}return db[_0x7b7e('0x2a')][_0x7b7e('0x42')](_0x503625);})[_0x7b7e('0x26')](function(_0xc888e4){_0x51d4b5[_0x7b7e('0x43')]=_0xc888e4;return _0x51d4b5;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x423832,_0x503625))['catch'](handleError(_0x423832,null));};exports['show']=function(_0x25b41e,_0x550ea6){var _0x41c8a6={'raw':!![],'where':{'id':_0x25b41e['params']['id']}},_0x5e8b5d={};_0x5e8b5d[_0x7b7e('0x2e')]=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x5e8b5d[_0x7b7e('0x30')]=_[_0x7b7e('0x2f')](_0x25b41e[_0x7b7e('0x30')]);_0x5e8b5d[_0x7b7e('0x31')]=_['intersection'](_0x5e8b5d[_0x7b7e('0x2e')],_0x5e8b5d[_0x7b7e('0x30')]);_0x41c8a6[_0x7b7e('0x33')]=_[_0x7b7e('0x32')](_0x5e8b5d[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x25b41e['query']['fields']));_0x41c8a6['attributes']=_0x41c8a6[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0x41c8a6[_0x7b7e('0x33')]:_0x5e8b5d[_0x7b7e('0x2e')];if(_0x25b41e[_0x7b7e('0x30')][_0x7b7e('0x40')]){_0x41c8a6['include']=[{'all':!![]}];}_0x41c8a6=_[_0x7b7e('0x3d')]({},_0x41c8a6,_0x25b41e[_0x7b7e('0x3f')]);return db['WhatsappQueueReport']['find'](_0x41c8a6)[_0x7b7e('0x26')](handleEntityNotFound(_0x550ea6,null))[_0x7b7e('0x26')](respondWithResult(_0x550ea6,null))[_0x7b7e('0x44')](handleError(_0x550ea6,null));};exports[_0x7b7e('0x45')]=function(_0x38b4d0,_0xb46776){return db['WhatsappQueueReport'][_0x7b7e('0x45')](_0x38b4d0['body'],{})[_0x7b7e('0x26')](respondWithResult(_0xb46776,0xc9))[_0x7b7e('0x44')](handleError(_0xb46776,null));};exports[_0x7b7e('0x25')]=function(_0x5874e2,_0x58e4e6){if(_0x5874e2[_0x7b7e('0x46')]['id']){delete _0x5874e2[_0x7b7e('0x46')]['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x5874e2[_0x7b7e('0x48')]['id']}})['then'](handleEntityNotFound(_0x58e4e6,null))[_0x7b7e('0x26')](saveUpdates(_0x5874e2[_0x7b7e('0x46')],null))[_0x7b7e('0x26')](respondWithResult(_0x58e4e6,null))[_0x7b7e('0x44')](handleError(_0x58e4e6,null));};exports[_0x7b7e('0x49')]=function(_0x5a9697,_0x1d6d18){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x5a9697[_0x7b7e('0x48')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x1d6d18,null))[_0x7b7e('0x26')](removeEntity(_0x1d6d18,null))[_0x7b7e('0x44')](handleError(_0x1d6d18,null));};exports['describe']=function(_0x433ec7,_0x5d7c89){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()['then'](respondWithResult(_0x5d7c89,null))[_0x7b7e('0x44')](handleError(_0x5d7c89,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8de7b23..f51326c 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 _0xe620=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport'];(function(_0x20c59f,_0x583d0a){var _0x2b6df8=function(_0x303e11){while(--_0x303e11){_0x20c59f['push'](_0x20c59f['shift']());}};_0x2b6df8(++_0x583d0a);}(_0xe620,0x1e2));var _0x0e62=function(_0x46f689,_0x4301a0){_0x46f689=_0x46f689-0x0;var _0xf3b853=_0xe620[_0x46f689];return _0xf3b853;};'use strict';var _=require(_0x0e62('0x0'));var util=require(_0x0e62('0x1'));var logger=require(_0x0e62('0x2'))(_0x0e62('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e62('0x4'));var rimraf=require(_0x0e62('0x5'));var config=require(_0x0e62('0x6'));var attributes=require(_0x0e62('0x7'));module[_0x0e62('0x8')]=function(_0x2a11e1,_0x16be45){return _0x2a11e1['define'](_0x0e62('0x9'),attributes,{'tableName':_0x0e62('0xa'),'paranoid':![],'indexes':[{'name':_0x0e62('0xb'),'fields':[_0x0e62('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2db0=['uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x444c70,_0x58d3d9){var _0x93886f=function(_0x103bd2){while(--_0x103bd2){_0x444c70['push'](_0x444c70['shift']());}};_0x93886f(++_0x58d3d9);}(_0x2db0,0x177));var _0x02db=function(_0x5637d8,_0x22e92e){_0x5637d8=_0x5637d8-0x0;var _0x356d36=_0x2db0[_0x5637d8];return _0x356d36;};'use strict';var _=require('lodash');var util=require(_0x02db('0x0'));var logger=require(_0x02db('0x1'))(_0x02db('0x2'));var moment=require(_0x02db('0x3'));var BPromise=require(_0x02db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02db('0x5'));var rimraf=require(_0x02db('0x6'));var config=require(_0x02db('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x2720ee,_0x44bf95){return _0x2720ee['define'](_0x02db('0x8'),attributes,{'tableName':_0x02db('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x02db('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 5877d4f..8469e5e 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 _0x6339=['../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird'];(function(_0x55414a,_0x53c18d){var _0x35732a=function(_0x4b6b58){while(--_0x4b6b58){_0x55414a['push'](_0x55414a['shift']());}};_0x35732a(++_0x53c18d);}(_0x6339,0x98));var _0x9633=function(_0x55b397,_0x5ef29c){_0x55b397=_0x55b397-0x0;var _0x2425da=_0x6339[_0x55b397];return _0x2425da;};'use strict';var _=require(_0x9633('0x0'));var util=require('util');var moment=require(_0x9633('0x1'));var BPromise=require(_0x9633('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9633('0x3'))['db'];var utils=require(_0x9633('0x4'));var logger=require(_0x9633('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9633('0x6')][_0x9633('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4599e3,_0x3a2d7e,_0xeca78d){return new BPromise(function(_0x2937d4,_0x32645f){return client[_0x9633('0x8')](_0x4599e3,_0xeca78d)[_0x9633('0x9')](function(_0x3b62e2){logger[_0x9633('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3a2d7e,_0x9633('0xb'));logger[_0x9633('0xc')](_0x9633('0xd'),_0x3a2d7e,'request\x20sent',JSON[_0x9633('0xe')](_0x3b62e2));if(_0x3b62e2[_0x9633('0xf')]){if(_0x3b62e2[_0x9633('0xf')][_0x9633('0x10')]===0x1f4){logger[_0x9633('0xf')](_0x9633('0x11'),_0x3a2d7e,_0x3b62e2[_0x9633('0xf')][_0x9633('0x12')]);return _0x32645f(_0x3b62e2[_0x9633('0xf')][_0x9633('0x12')]);}logger[_0x9633('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3a2d7e,_0x3b62e2[_0x9633('0xf')][_0x9633('0x12')]);return _0x2937d4(_0x3b62e2[_0x9633('0xf')][_0x9633('0x12')]);}else{logger[_0x9633('0xa')](_0x9633('0x11'),_0x3a2d7e,_0x9633('0xb'));_0x2937d4(_0x3b62e2['result'][_0x9633('0x12')]);}})[_0x9633('0x13')](function(_0x13cdd6){logger[_0x9633('0xf')](_0x9633('0x11'),_0x3a2d7e,_0x13cdd6);_0x32645f(_0x13cdd6);});});}exports[_0x9633('0x14')]=function(_0x4540fe){var _0x394d9f=this;return new Promise(function(_0x359c18,_0x21cc42){return db[_0x9633('0x15')][_0x9633('0x16')](_0x4540fe[_0x9633('0x17')],{'raw':_0x4540fe['options']?_0x4540fe[_0x9633('0x18')][_0x9633('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3a62f0){logger[_0x9633('0xa')](_0x9633('0x14'),_0x4540fe);logger['debug'](_0x9633('0x14'),_0x4540fe,JSON['stringify'](_0x3a62f0));_0x359c18(_0x3a62f0);})[_0x9633('0x13')](function(_0x1acd71){logger[_0x9633('0xf')](_0x9633('0x14'),_0x1acd71[_0x9633('0x12')],_0x4540fe);_0x21cc42(_0x394d9f[_0x9633('0xf')](0x1f4,_0x1acd71[_0x9633('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x58a027){var _0x330630=this;return new Promise(function(_0x158a92,_0x46df66){return db['WhatsappQueueReport'][_0x9633('0x1a')](_0x58a027[_0x9633('0x17')],{'raw':_0x58a027[_0x9633('0x18')]?_0x58a027[_0x9633('0x18')][_0x9633('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a027['options']?_0x58a027['options'][_0x9633('0x1b')]||null:null,'attributes':_0x58a027[_0x9633('0x18')]?_0x58a027['options'][_0x9633('0x1c')]||null:null,'limit':_0x58a027[_0x9633('0x18')]?_0x58a027['options'][_0x9633('0x1d')]||null:null})[_0x9633('0x9')](function(_0x56f6f1){logger[_0x9633('0xa')]('UpdateWhatsappQueueReport',_0x58a027);logger[_0x9633('0xc')](_0x9633('0x1e'),_0x58a027,JSON[_0x9633('0xe')](_0x56f6f1));_0x158a92(_0x56f6f1);})['catch'](function(_0x192eef){logger['error'](_0x9633('0x1e'),_0x192eef[_0x9633('0x12')],_0x58a027);_0x46df66(_0x330630[_0x9633('0xf')](0x1f4,_0x192eef[_0x9633('0x12')]));});});}; \ No newline at end of file +var _0xf7a5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','then','catch','UpdateWhatsappQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x44b53d,_0x2eb2bb){var _0x17ecfa=function(_0x25323b){while(--_0x25323b){_0x44b53d['push'](_0x44b53d['shift']());}};_0x17ecfa(++_0x2eb2bb);}(_0xf7a5,0x12c));var _0x5f7a=function(_0x5ad866,_0x63f8b0){_0x5ad866=_0x5ad866-0x0;var _0x231923=_0xf7a5[_0x5ad866];return _0x231923;};'use strict';var _=require(_0x5f7a('0x0'));var util=require(_0x5f7a('0x1'));var moment=require(_0x5f7a('0x2'));var BPromise=require(_0x5f7a('0x3'));var rs=require(_0x5f7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f7a('0x5'))['db'];var utils=require(_0x5f7a('0x6'));var logger=require(_0x5f7a('0x7'))(_0x5f7a('0x8'));var config=require(_0x5f7a('0x9'));var jayson=require(_0x5f7a('0xa'));var client=jayson[_0x5f7a('0xb')][_0x5f7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d3910,_0x52977e,_0x575943){return new BPromise(function(_0xb1d835,_0x171385){return client['request'](_0x1d3910,_0x575943)['then'](function(_0x4ee1e5){logger[_0x5f7a('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x52977e,_0x5f7a('0xe'));logger[_0x5f7a('0xf')](_0x5f7a('0x10'),_0x52977e,_0x5f7a('0xe'),JSON[_0x5f7a('0x11')](_0x4ee1e5));if(_0x4ee1e5[_0x5f7a('0x12')]){if(_0x4ee1e5[_0x5f7a('0x12')][_0x5f7a('0x13')]===0x1f4){logger[_0x5f7a('0x12')](_0x5f7a('0x14'),_0x52977e,_0x4ee1e5[_0x5f7a('0x12')][_0x5f7a('0x15')]);return _0x171385(_0x4ee1e5[_0x5f7a('0x12')][_0x5f7a('0x15')]);}logger[_0x5f7a('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x52977e,_0x4ee1e5[_0x5f7a('0x12')][_0x5f7a('0x15')]);return _0xb1d835(_0x4ee1e5[_0x5f7a('0x12')]['message']);}else{logger[_0x5f7a('0xd')](_0x5f7a('0x14'),_0x52977e,'request\x20sent');_0xb1d835(_0x4ee1e5[_0x5f7a('0x16')]['message']);}})['catch'](function(_0x263a0a){logger[_0x5f7a('0x12')](_0x5f7a('0x14'),_0x52977e,_0x263a0a);_0x171385(_0x263a0a);});});}exports[_0x5f7a('0x17')]=function(_0x4db654){var _0x27832a=this;return new Promise(function(_0x11abc0,_0x9221d1){return db[_0x5f7a('0x18')]['create'](_0x4db654['body'],{'raw':_0x4db654['options']?_0x4db654[_0x5f7a('0x19')][_0x5f7a('0x1a')]===undefined?!![]:![]:!![]})[_0x5f7a('0x1b')](function(_0x1bea68){logger[_0x5f7a('0xd')](_0x5f7a('0x17'),_0x4db654);logger[_0x5f7a('0xf')](_0x5f7a('0x17'),_0x4db654,JSON[_0x5f7a('0x11')](_0x1bea68));_0x11abc0(_0x1bea68);})[_0x5f7a('0x1c')](function(_0x48397e){logger[_0x5f7a('0x12')](_0x5f7a('0x17'),_0x48397e['message'],_0x4db654);_0x9221d1(_0x27832a['error'](0x1f4,_0x48397e[_0x5f7a('0x15')]));});});};exports[_0x5f7a('0x1d')]=function(_0x5c6f3e){var _0x2171d1=this;return new Promise(function(_0x36eb90,_0x1b5755){return db['WhatsappQueueReport'][_0x5f7a('0x1e')](_0x5c6f3e[_0x5f7a('0x1f')],{'raw':_0x5c6f3e['options']?_0x5c6f3e['options'][_0x5f7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c6f3e[_0x5f7a('0x19')]?_0x5c6f3e[_0x5f7a('0x19')]['where']||null:null,'attributes':_0x5c6f3e[_0x5f7a('0x19')]?_0x5c6f3e[_0x5f7a('0x19')][_0x5f7a('0x20')]||null:null,'limit':_0x5c6f3e[_0x5f7a('0x19')]?_0x5c6f3e['options'][_0x5f7a('0x21')]||null:null})[_0x5f7a('0x1b')](function(_0x42e97f){logger[_0x5f7a('0xd')](_0x5f7a('0x1d'),_0x5c6f3e);logger['debug'](_0x5f7a('0x1d'),_0x5c6f3e,JSON['stringify'](_0x42e97f));_0x36eb90(_0x42e97f);})[_0x5f7a('0x1c')](function(_0x3a526b){logger[_0x5f7a('0x12')](_0x5f7a('0x1d'),_0x3a526b[_0x5f7a('0x15')],_0x5c6f3e);_0x1b5755(_0x2171d1[_0x5f7a('0x12')](0x1f4,_0x3a526b[_0x5f7a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7d295cd..e7d14e0 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 _0x690b=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x690b,0x120));var _0xb690=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x690b[_0xe501ff];return _0x17135d;};'use strict';var multer=require(_0xb690('0x0'));var util=require(_0xb690('0x1'));var path=require(_0xb690('0x2'));var timeout=require(_0xb690('0x3'));var express=require('express');var router=express[_0xb690('0x4')]();var fs_extra=require(_0xb690('0x5'));var auth=require(_0xb690('0x6'));var interaction=require(_0xb690('0x7'));var config=require(_0xb690('0x8'));var controller=require(_0xb690('0x9'));router[_0xb690('0xa')]('/',auth[_0xb690('0xb')](),controller['index']);router[_0xb690('0xa')](_0xb690('0xc'),auth['isAuthenticated'](),controller[_0xb690('0xd')]);router[_0xb690('0xa')](_0xb690('0xe'),auth[_0xb690('0xb')](),controller['show']);router[_0xb690('0xf')]('/',auth[_0xb690('0xb')](),controller[_0xb690('0x10')]);router[_0xb690('0x11')](_0xb690('0xe'),auth[_0xb690('0xb')](),controller[_0xb690('0x12')]);router[_0xb690('0x13')](_0xb690('0xe'),auth[_0xb690('0xb')](),controller[_0xb690('0x14')]);module[_0xb690('0x15')]=router; \ No newline at end of file +var _0xbf5e=['describe','/:id','show','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4dc8c6,_0x3fba52){var _0x69ce1d=function(_0x1a726d){while(--_0x1a726d){_0x4dc8c6['push'](_0x4dc8c6['shift']());}};_0x69ce1d(++_0x3fba52);}(_0xbf5e,0x12d));var _0xebf5=function(_0x290e59,_0x26b540){_0x290e59=_0x290e59-0x0;var _0xf6e856=_0xbf5e[_0x290e59];return _0xf6e856;};'use strict';var multer=require(_0xebf5('0x0'));var util=require('util');var path=require(_0xebf5('0x1'));var timeout=require(_0xebf5('0x2'));var express=require(_0xebf5('0x3'));var router=express[_0xebf5('0x4')]();var fs_extra=require(_0xebf5('0x5'));var auth=require(_0xebf5('0x6'));var interaction=require(_0xebf5('0x7'));var config=require(_0xebf5('0x8'));var controller=require(_0xebf5('0x9'));router[_0xebf5('0xa')]('/',auth[_0xebf5('0xb')](),controller[_0xebf5('0xc')]);router['get'](_0xebf5('0xd'),auth['isAuthenticated'](),controller[_0xebf5('0xe')]);router[_0xebf5('0xa')](_0xebf5('0xf'),auth[_0xebf5('0xb')](),controller[_0xebf5('0x10')]);router['post']('/',auth[_0xebf5('0xb')](),controller[_0xebf5('0x11')]);router[_0xebf5('0x12')](_0xebf5('0xf'),auth[_0xebf5('0xb')](),controller['update']);router[_0xebf5('0x13')](_0xebf5('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xebf5('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 3458d16..056af33 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 _0x6b72=['ENUM','agent','queue','sequelize','STRING'];(function(_0xc6800a,_0x4eac70){var _0x4919d3=function(_0x1ccfa6){while(--_0x1ccfa6){_0xc6800a['push'](_0xc6800a['shift']());}};_0x4919d3(++_0x4eac70);}(_0x6b72,0x19d));var _0x26b7=function(_0x2a4d21,_0x15122d){_0x2a4d21=_0x2a4d21-0x0;var _0x4cd8a3=_0x6b72[_0x2a4d21];return _0x4cd8a3;};'use strict';var Sequelize=require(_0x26b7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x26b7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x26b7('0x2')]('account',_0x26b7('0x3'),_0x26b7('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x30fc=['ENUM','account','agent','queue','sequelize','exports'];(function(_0x296d41,_0x1dc9ba){var _0xba7db5=function(_0x11a603){while(--_0x11a603){_0x296d41['push'](_0x296d41['shift']());}};_0xba7db5(++_0x1dc9ba);}(_0x30fc,0x64));var _0xc30f=function(_0x14c68e,_0x47061d){_0x14c68e=_0x14c68e-0x0;var _0x87a0b9=_0x30fc[_0x14c68e];return _0x87a0b9;};'use strict';var Sequelize=require(_0xc30f('0x0'));module[_0xc30f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc30f('0x2')](_0xc30f('0x3'),_0xc30f('0x4'),_0xc30f('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a395c5d..5370dd4 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 _0xa937=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x39c597,_0x73872a){var _0x377268=function(_0x247a94){while(--_0x247a94){_0x39c597['push'](_0x39c597['shift']());}};_0x377268(++_0x73872a);}(_0xa937,0xde));var _0x7a93=function(_0x368245,_0x3c639a){_0x368245=_0x368245-0x0;var _0x3cee45=_0xa937[_0x368245];return _0x3cee45;};'use strict';var emlformat=require(_0x7a93('0x0'));var rimraf=require(_0x7a93('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7a93('0x2'));var moment=require(_0x7a93('0x3'));var BPromise=require(_0x7a93('0x4'));var Mustache=require(_0x7a93('0x5'));var util=require('util');var path=require(_0x7a93('0x6'));var sox=require(_0x7a93('0x7'));var csv=require(_0x7a93('0x8'));var ejs=require(_0x7a93('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a93('0xa'));var squel=require(_0x7a93('0xb'));var crypto=require(_0x7a93('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7a93('0xd'));var toCsv=require(_0x7a93('0x8'));var querystring=require('querystring');var Papa=require(_0x7a93('0xe'));var Redis=require(_0x7a93('0xf'));var authService=require(_0x7a93('0x10'));var qs=require(_0x7a93('0x11'));var as=require(_0x7a93('0x12'));var hardwareService=require(_0x7a93('0x13'));var logger=require(_0x7a93('0x14'))(_0x7a93('0x15'));var utils=require('../../config/utils');var config=require(_0x7a93('0x16'));var licenseUtil=require(_0x7a93('0x17'));var db=require(_0x7a93('0x18'))['db'];function respondWithStatusCode(_0x1856e6,_0x4bbbdf){_0x4bbbdf=_0x4bbbdf||0xcc;return function(_0xf7be44){if(_0xf7be44){return _0x1856e6[_0x7a93('0x19')](_0x4bbbdf);}return _0x1856e6[_0x7a93('0x1a')](_0x4bbbdf)[_0x7a93('0x1b')]();};}function respondWithResult(_0x1254a2,_0x58da1c){_0x58da1c=_0x58da1c||0xc8;return function(_0x5b620b){if(_0x5b620b){return _0x1254a2['status'](_0x58da1c)[_0x7a93('0x1c')](_0x5b620b);}};}function respondWithFilteredResult(_0x233a94,_0x2e4e9c){return function(_0x5140ff){if(_0x5140ff){var _0x21e6db=typeof _0x2e4e9c[_0x7a93('0x1d')]===_0x7a93('0x1e')&&typeof _0x2e4e9c[_0x7a93('0x1f')]===_0x7a93('0x1e');var _0xa11b49=_0x5140ff['count'];var _0x101a13=_0x21e6db?0x0:_0x2e4e9c[_0x7a93('0x1d')];var _0x537391=_0x21e6db?_0x5140ff[_0x7a93('0x20')]:_0x2e4e9c['offset']+_0x2e4e9c['limit'];var _0x8840cd;if(_0x537391>=_0xa11b49){_0x537391=_0xa11b49;_0x8840cd=0xc8;}else{_0x8840cd=0xce;}_0x233a94[_0x7a93('0x1a')](_0x8840cd);return _0x233a94[_0x7a93('0x21')]('Content-Range',_0x101a13+'-'+_0x537391+'/'+_0xa11b49)[_0x7a93('0x1c')](_0x5140ff);}return null;};}function patchUpdates(_0x28c557){return function(_0x4fb5c1){try{jsonpatch[_0x7a93('0x22')](_0x4fb5c1,_0x28c557,!![]);}catch(_0x27fc66){return BPromise[_0x7a93('0x23')](_0x27fc66);}return _0x4fb5c1[_0x7a93('0x24')]();};}function saveUpdates(_0x57210e,_0x3427d7){return function(_0x53844a){if(_0x53844a){return _0x53844a[_0x7a93('0x25')](_0x57210e)['then'](function(_0x3bb6f2){return _0x3bb6f2;});}return null;};}function removeEntity(_0x546081,_0x53807a){return function(_0x2e8234){if(_0x2e8234){return _0x2e8234['destroy']()[_0x7a93('0x26')](function(){_0x546081['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca1cf,_0x51b05a){return function(_0x29d69b){if(!_0x29d69b){_0x2ca1cf[_0x7a93('0x19')](0x194);}return _0x29d69b;};}function handleError(_0x20b98b,_0x55d9a9){_0x55d9a9=_0x55d9a9||0x1f4;return function(_0x5d959c){logger[_0x7a93('0x27')](_0x5d959c['stack']);if(_0x5d959c['name']){delete _0x5d959c['name'];}_0x20b98b['status'](_0x55d9a9)[_0x7a93('0x28')](_0x5d959c);};}exports[_0x7a93('0x29')]=function(_0x1e7aad,_0x58e174){var _0x39b761={},_0x2b7fb5={},_0x5a7a13={'count':0x0,'rows':[]};var _0x36a63d=_[_0x7a93('0x2a')](db[_0x7a93('0x2b')][_0x7a93('0x2c')],function(_0x391260){return{'name':_0x391260['fieldName'],'type':_0x391260[_0x7a93('0x2d')][_0x7a93('0x2e')]};});_0x2b7fb5[_0x7a93('0x2f')]=_[_0x7a93('0x2a')](_0x36a63d,_0x7a93('0x30'));_0x2b7fb5['query']=_[_0x7a93('0x31')](_0x1e7aad[_0x7a93('0x32')]);_0x2b7fb5[_0x7a93('0x33')]=_[_0x7a93('0x34')](_0x2b7fb5[_0x7a93('0x2f')],_0x2b7fb5[_0x7a93('0x32')]);_0x39b761[_0x7a93('0x35')]=_['intersection'](_0x2b7fb5[_0x7a93('0x2f')],qs[_0x7a93('0x36')](_0x1e7aad['query'][_0x7a93('0x36')]));_0x39b761[_0x7a93('0x35')]=_0x39b761['attributes'][_0x7a93('0x37')]?_0x39b761[_0x7a93('0x35')]:_0x2b7fb5[_0x7a93('0x2f')];if(!_0x1e7aad[_0x7a93('0x32')][_0x7a93('0x38')]('nolimit')){_0x39b761['limit']=qs[_0x7a93('0x1f')](_0x1e7aad[_0x7a93('0x32')][_0x7a93('0x1f')]);_0x39b761[_0x7a93('0x1d')]=qs[_0x7a93('0x1d')](_0x1e7aad[_0x7a93('0x32')][_0x7a93('0x1d')]);}_0x39b761[_0x7a93('0x39')]=qs[_0x7a93('0x3a')](_0x1e7aad[_0x7a93('0x32')][_0x7a93('0x3a')]);_0x39b761['where']=qs[_0x7a93('0x33')](_[_0x7a93('0x3b')](_0x1e7aad['query'],_0x2b7fb5[_0x7a93('0x33')]),_0x36a63d);if(_0x1e7aad[_0x7a93('0x32')]['filter']){_0x39b761[_0x7a93('0x3c')]=_['merge'](_0x39b761[_0x7a93('0x3c')],{'$or':_[_0x7a93('0x2a')](_0x36a63d,function(_0x520110){if(_0x520110[_0x7a93('0x2d')]!==_0x7a93('0x3d')){var _0x32115b={};_0x32115b[_0x520110[_0x7a93('0x30')]]={'$like':'%'+_0x1e7aad[_0x7a93('0x32')][_0x7a93('0x3e')]+'%'};return _0x32115b;}})});}_0x39b761=_[_0x7a93('0x3f')]({},_0x39b761,_0x1e7aad[_0x7a93('0x40')]);var _0x476281={'where':_0x39b761['where']};return db[_0x7a93('0x2b')][_0x7a93('0x20')](_0x476281)[_0x7a93('0x26')](function(_0x2a3b2a){_0x5a7a13['count']=_0x2a3b2a;if(_0x1e7aad[_0x7a93('0x32')][_0x7a93('0x41')]){_0x39b761[_0x7a93('0x42')]=[{'all':!![]}];}return db[_0x7a93('0x2b')]['findAll'](_0x39b761);})[_0x7a93('0x26')](function(_0x39d754){_0x5a7a13[_0x7a93('0x43')]=_0x39d754;return _0x5a7a13;})[_0x7a93('0x26')](respondWithFilteredResult(_0x58e174,_0x39b761))[_0x7a93('0x44')](handleError(_0x58e174,null));};exports[_0x7a93('0x45')]=function(_0x557983,_0x2cbab5){var _0x4bb169={'raw':!![],'where':{'id':_0x557983['params']['id']}},_0x352913={};_0x352913[_0x7a93('0x2f')]=_[_0x7a93('0x31')](db[_0x7a93('0x2b')][_0x7a93('0x2c')]);_0x352913[_0x7a93('0x32')]=_[_0x7a93('0x31')](_0x557983[_0x7a93('0x32')]);_0x352913[_0x7a93('0x33')]=_[_0x7a93('0x34')](_0x352913['model'],_0x352913[_0x7a93('0x32')]);_0x4bb169[_0x7a93('0x35')]=_[_0x7a93('0x34')](_0x352913[_0x7a93('0x2f')],qs[_0x7a93('0x36')](_0x557983[_0x7a93('0x32')]['fields']));_0x4bb169[_0x7a93('0x35')]=_0x4bb169['attributes']['length']?_0x4bb169['attributes']:_0x352913[_0x7a93('0x2f')];if(_0x557983[_0x7a93('0x32')][_0x7a93('0x41')]){_0x4bb169['include']=[{'all':!![]}];}_0x4bb169=_[_0x7a93('0x3f')]({},_0x4bb169,_0x557983[_0x7a93('0x40')]);return db['WhatsappTransferReport'][_0x7a93('0x46')](_0x4bb169)[_0x7a93('0x26')](handleEntityNotFound(_0x2cbab5,null))[_0x7a93('0x26')](respondWithResult(_0x2cbab5,null))[_0x7a93('0x44')](handleError(_0x2cbab5,null));};exports[_0x7a93('0x47')]=function(_0x35da90,_0x1227c6){return db[_0x7a93('0x2b')][_0x7a93('0x47')](_0x35da90[_0x7a93('0x48')],{})['then'](respondWithResult(_0x1227c6,0xc9))[_0x7a93('0x44')](handleError(_0x1227c6,null));};exports[_0x7a93('0x25')]=function(_0x2a5324,_0x45803a){if(_0x2a5324['body']['id']){delete _0x2a5324[_0x7a93('0x48')]['id'];}return db[_0x7a93('0x2b')][_0x7a93('0x46')]({'where':{'id':_0x2a5324[_0x7a93('0x49')]['id']}})[_0x7a93('0x26')](handleEntityNotFound(_0x45803a,null))[_0x7a93('0x26')](saveUpdates(_0x2a5324[_0x7a93('0x48')],null))[_0x7a93('0x26')](respondWithResult(_0x45803a,null))[_0x7a93('0x44')](handleError(_0x45803a,null));};exports[_0x7a93('0x4a')]=function(_0x3cfb7a,_0x59c1b8){return db[_0x7a93('0x2b')][_0x7a93('0x46')]({'where':{'id':_0x3cfb7a['params']['id']}})[_0x7a93('0x26')](handleEntityNotFound(_0x59c1b8,null))[_0x7a93('0x26')](removeEntity(_0x59c1b8,null))[_0x7a93('0x44')](handleError(_0x59c1b8,null));};exports[_0x7a93('0x4b')]=function(_0x26f8b9,_0x5e76cd){return db[_0x7a93('0x2b')]['describe']()[_0x7a93('0x26')](respondWithResult(_0x5e76cd,null))[_0x7a93('0x44')](handleError(_0x5e76cd,null));}; \ No newline at end of file +var _0x94e7=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','describe','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2af333,_0x54f43f){var _0x1f22a5=function(_0x15ff1b){while(--_0x15ff1b){_0x2af333['push'](_0x2af333['shift']());}};_0x1f22a5(++_0x54f43f);}(_0x94e7,0x7c));var _0x794e=function(_0x169d03,_0x37d240){_0x169d03=_0x169d03-0x0;var _0x294b17=_0x94e7[_0x169d03];return _0x294b17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x794e('0x0'));var zipdir=require(_0x794e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x794e('0x2'));var BPromise=require(_0x794e('0x3'));var Mustache=require(_0x794e('0x4'));var util=require('util');var path=require(_0x794e('0x5'));var sox=require(_0x794e('0x6'));var csv=require(_0x794e('0x7'));var ejs=require(_0x794e('0x8'));var fs=require('fs');var fs_extra=require(_0x794e('0x9'));var _=require(_0x794e('0xa'));var squel=require('squel');var crypto=require(_0x794e('0xb'));var jsforce=require(_0x794e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x794e('0x7'));var querystring=require('querystring');var Papa=require(_0x794e('0xd'));var Redis=require('ioredis');var authService=require(_0x794e('0xe'));var qs=require(_0x794e('0xf'));var as=require(_0x794e('0x10'));var hardwareService=require(_0x794e('0x11'));var logger=require(_0x794e('0x12'))(_0x794e('0x13'));var utils=require(_0x794e('0x14'));var config=require(_0x794e('0x15'));var licenseUtil=require(_0x794e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ffc45,_0x546471){_0x546471=_0x546471||0xcc;return function(_0x1e2f12){if(_0x1e2f12){return _0x3ffc45[_0x794e('0x17')](_0x546471);}return _0x3ffc45[_0x794e('0x18')](_0x546471)[_0x794e('0x19')]();};}function respondWithResult(_0x1448d8,_0x28b21b){_0x28b21b=_0x28b21b||0xc8;return function(_0x369a8f){if(_0x369a8f){return _0x1448d8['status'](_0x28b21b)[_0x794e('0x1a')](_0x369a8f);}};}function respondWithFilteredResult(_0x27f5d7,_0x3ebce4){return function(_0x1e3d23){if(_0x1e3d23){var _0x3c2b97=typeof _0x3ebce4[_0x794e('0x1b')]===_0x794e('0x1c')&&typeof _0x3ebce4[_0x794e('0x1d')]==='undefined';var _0xf2450b=_0x1e3d23[_0x794e('0x1e')];var _0x553358=_0x3c2b97?0x0:_0x3ebce4[_0x794e('0x1b')];var _0x575d66=_0x3c2b97?_0x1e3d23[_0x794e('0x1e')]:_0x3ebce4[_0x794e('0x1b')]+_0x3ebce4[_0x794e('0x1d')];var _0x39d612;if(_0x575d66>=_0xf2450b){_0x575d66=_0xf2450b;_0x39d612=0xc8;}else{_0x39d612=0xce;}_0x27f5d7[_0x794e('0x18')](_0x39d612);return _0x27f5d7[_0x794e('0x1f')](_0x794e('0x20'),_0x553358+'-'+_0x575d66+'/'+_0xf2450b)[_0x794e('0x1a')](_0x1e3d23);}return null;};}function patchUpdates(_0x5c9cb1){return function(_0x3c8d11){try{jsonpatch[_0x794e('0x21')](_0x3c8d11,_0x5c9cb1,!![]);}catch(_0x1d2634){return BPromise[_0x794e('0x22')](_0x1d2634);}return _0x3c8d11['save']();};}function saveUpdates(_0x3035eb,_0x1e6b76){return function(_0x49cbd0){if(_0x49cbd0){return _0x49cbd0['update'](_0x3035eb)[_0x794e('0x23')](function(_0x30394f){return _0x30394f;});}return null;};}function removeEntity(_0x28a633,_0x85bc21){return function(_0xf1ecf9){if(_0xf1ecf9){return _0xf1ecf9['destroy']()[_0x794e('0x23')](function(){_0x28a633['status'](0xcc)[_0x794e('0x19')]();});}};}function handleEntityNotFound(_0xa270ee,_0x435af0){return function(_0x5a15bd){if(!_0x5a15bd){_0xa270ee[_0x794e('0x17')](0x194);}return _0x5a15bd;};}function handleError(_0x559ed7,_0x55f0de){_0x55f0de=_0x55f0de||0x1f4;return function(_0x2dcfdc){logger[_0x794e('0x24')](_0x2dcfdc[_0x794e('0x25')]);if(_0x2dcfdc['name']){delete _0x2dcfdc[_0x794e('0x26')];}_0x559ed7[_0x794e('0x18')](_0x55f0de)[_0x794e('0x27')](_0x2dcfdc);};}exports['index']=function(_0x5e3614,_0x49e5cd){var _0x43c538={},_0x50e98a={},_0xdee2b9={'count':0x0,'rows':[]};var _0x5ebea5=_[_0x794e('0x28')](db[_0x794e('0x29')][_0x794e('0x2a')],function(_0x39318d){return{'name':_0x39318d['fieldName'],'type':_0x39318d[_0x794e('0x2b')]['key']};});_0x50e98a[_0x794e('0x2c')]=_['map'](_0x5ebea5,_0x794e('0x26'));_0x50e98a[_0x794e('0x2d')]=_[_0x794e('0x2e')](_0x5e3614[_0x794e('0x2d')]);_0x50e98a[_0x794e('0x2f')]=_[_0x794e('0x30')](_0x50e98a[_0x794e('0x2c')],_0x50e98a[_0x794e('0x2d')]);_0x43c538[_0x794e('0x31')]=_[_0x794e('0x30')](_0x50e98a['model'],qs[_0x794e('0x32')](_0x5e3614[_0x794e('0x2d')][_0x794e('0x32')]));_0x43c538[_0x794e('0x31')]=_0x43c538['attributes'][_0x794e('0x33')]?_0x43c538[_0x794e('0x31')]:_0x50e98a[_0x794e('0x2c')];if(!_0x5e3614[_0x794e('0x2d')]['hasOwnProperty'](_0x794e('0x34'))){_0x43c538[_0x794e('0x1d')]=qs[_0x794e('0x1d')](_0x5e3614['query']['limit']);_0x43c538[_0x794e('0x1b')]=qs[_0x794e('0x1b')](_0x5e3614['query'][_0x794e('0x1b')]);}_0x43c538[_0x794e('0x35')]=qs[_0x794e('0x36')](_0x5e3614[_0x794e('0x2d')]['sort']);_0x43c538[_0x794e('0x37')]=qs[_0x794e('0x2f')](_['pick'](_0x5e3614[_0x794e('0x2d')],_0x50e98a[_0x794e('0x2f')]),_0x5ebea5);if(_0x5e3614['query'][_0x794e('0x38')]){_0x43c538[_0x794e('0x37')]=_['merge'](_0x43c538['where'],{'$or':_[_0x794e('0x28')](_0x5ebea5,function(_0x2f8655){if(_0x2f8655[_0x794e('0x2b')]!==_0x794e('0x39')){var _0x1820b7={};_0x1820b7[_0x2f8655[_0x794e('0x26')]]={'$like':'%'+_0x5e3614[_0x794e('0x2d')]['filter']+'%'};return _0x1820b7;}})});}_0x43c538=_[_0x794e('0x3a')]({},_0x43c538,_0x5e3614[_0x794e('0x3b')]);var _0x2249f8={'where':_0x43c538['where']};return db[_0x794e('0x29')][_0x794e('0x1e')](_0x2249f8)[_0x794e('0x23')](function(_0x52c6c4){_0xdee2b9[_0x794e('0x1e')]=_0x52c6c4;if(_0x5e3614[_0x794e('0x2d')][_0x794e('0x3c')]){_0x43c538[_0x794e('0x3d')]=[{'all':!![]}];}return db[_0x794e('0x29')]['findAll'](_0x43c538);})[_0x794e('0x23')](function(_0x1445f2){_0xdee2b9[_0x794e('0x3e')]=_0x1445f2;return _0xdee2b9;})[_0x794e('0x23')](respondWithFilteredResult(_0x49e5cd,_0x43c538))[_0x794e('0x3f')](handleError(_0x49e5cd,null));};exports[_0x794e('0x40')]=function(_0x310fee,_0x5df390){var _0x583ff0={'raw':!![],'where':{'id':_0x310fee[_0x794e('0x41')]['id']}},_0x4535dd={};_0x4535dd['model']=_[_0x794e('0x2e')](db[_0x794e('0x29')][_0x794e('0x2a')]);_0x4535dd['query']=_['keys'](_0x310fee['query']);_0x4535dd[_0x794e('0x2f')]=_['intersection'](_0x4535dd[_0x794e('0x2c')],_0x4535dd['query']);_0x583ff0[_0x794e('0x31')]=_[_0x794e('0x30')](_0x4535dd[_0x794e('0x2c')],qs[_0x794e('0x32')](_0x310fee[_0x794e('0x2d')][_0x794e('0x32')]));_0x583ff0[_0x794e('0x31')]=_0x583ff0[_0x794e('0x31')][_0x794e('0x33')]?_0x583ff0[_0x794e('0x31')]:_0x4535dd[_0x794e('0x2c')];if(_0x310fee[_0x794e('0x2d')]['includeAll']){_0x583ff0[_0x794e('0x3d')]=[{'all':!![]}];}_0x583ff0=_['merge']({},_0x583ff0,_0x310fee[_0x794e('0x3b')]);return db[_0x794e('0x29')][_0x794e('0x42')](_0x583ff0)['then'](handleEntityNotFound(_0x5df390,null))[_0x794e('0x23')](respondWithResult(_0x5df390,null))['catch'](handleError(_0x5df390,null));};exports[_0x794e('0x43')]=function(_0x3f1b15,_0x5c41d0){return db[_0x794e('0x29')][_0x794e('0x43')](_0x3f1b15[_0x794e('0x44')],{})[_0x794e('0x23')](respondWithResult(_0x5c41d0,0xc9))[_0x794e('0x3f')](handleError(_0x5c41d0,null));};exports[_0x794e('0x45')]=function(_0x35525e,_0x528cc2){if(_0x35525e[_0x794e('0x44')]['id']){delete _0x35525e[_0x794e('0x44')]['id'];}return db[_0x794e('0x29')]['find']({'where':{'id':_0x35525e[_0x794e('0x41')]['id']}})[_0x794e('0x23')](handleEntityNotFound(_0x528cc2,null))[_0x794e('0x23')](saveUpdates(_0x35525e[_0x794e('0x44')],null))['then'](respondWithResult(_0x528cc2,null))[_0x794e('0x3f')](handleError(_0x528cc2,null));};exports[_0x794e('0x46')]=function(_0x252ce3,_0x2f2d8f){return db[_0x794e('0x29')]['find']({'where':{'id':_0x252ce3[_0x794e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f2d8f,null))[_0x794e('0x23')](removeEntity(_0x2f2d8f,null))[_0x794e('0x3f')](handleError(_0x2f2d8f,null));};exports[_0x794e('0x47')]=function(_0x2c4a46,_0x43aa2f){return db[_0x794e('0x29')][_0x794e('0x47')]()[_0x794e('0x23')](respondWithResult(_0x43aa2f,null))['catch'](handleError(_0x43aa2f,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e3922a0..ec644f6 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 _0x507d=['moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3ad39f,_0x2fb40d){var _0x583ee3=function(_0x3117ee){while(--_0x3117ee){_0x3ad39f['push'](_0x3ad39f['shift']());}};_0x583ee3(++_0x2fb40d);}(_0x507d,0xf9));var _0xd507=function(_0x3c6af9,_0x171e7c){_0x3c6af9=_0x3c6af9-0x0;var _0x4b6378=_0x507d[_0x3c6af9];return _0x4b6378;};'use strict';var _=require(_0xd507('0x0'));var util=require(_0xd507('0x1'));var logger=require(_0xd507('0x2'))('api');var moment=require(_0xd507('0x3'));var BPromise=require('bluebird');var rp=require(_0xd507('0x4'));var fs=require('fs');var path=require(_0xd507('0x5'));var rimraf=require(_0xd507('0x6'));var config=require(_0xd507('0x7'));var attributes=require(_0xd507('0x8'));module[_0xd507('0x9')]=function(_0xf3c987,_0x41e9a2){return _0xf3c987[_0xd507('0xa')](_0xd507('0xb'),attributes,{'tableName':_0xd507('0xc'),'paranoid':![],'indexes':[{'name':_0xd507('0xd'),'fields':[_0xd507('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x16f5=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x16f5,0x111));var _0x516f=function(_0x117527,_0x5af6e){_0x117527=_0x117527-0x0;var _0x52a864=_0x16f5[_0x117527];return _0x52a864;};'use strict';var _=require(_0x516f('0x0'));var util=require(_0x516f('0x1'));var logger=require(_0x516f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x516f('0x3'));var rimraf=require(_0x516f('0x4'));var config=require(_0x516f('0x5'));var attributes=require(_0x516f('0x6'));module[_0x516f('0x7')]=function(_0x28b503,_0x4a8459){return _0x28b503[_0x516f('0x8')](_0x516f('0x9'),attributes,{'tableName':_0x516f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x516f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index cc4d2ea..8ffa9ab 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 _0x11b0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3007a8,_0x1717c6){var _0x434722=function(_0x420de8){while(--_0x420de8){_0x3007a8['push'](_0x3007a8['shift']());}};_0x434722(++_0x1717c6);}(_0x11b0,0x145));var _0x011b=function(_0x1872a0,_0x25e201){_0x1872a0=_0x1872a0-0x0;var _0x1788af=_0x11b0[_0x1872a0];return _0x1788af;};'use strict';var _=require('lodash');var util=require(_0x011b('0x0'));var moment=require('moment');var BPromise=require(_0x011b('0x1'));var rs=require(_0x011b('0x2'));var fs=require('fs');var Redis=require(_0x011b('0x3'));var db=require(_0x011b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x011b('0x5'))(_0x011b('0x6'));var config=require(_0x011b('0x7'));var jayson=require(_0x011b('0x8'));var client=jayson[_0x011b('0x9')][_0x011b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3559af,_0x83e473,_0x3f7bce){return new BPromise(function(_0x324a69,_0x37c3ba){return client[_0x011b('0xb')](_0x3559af,_0x3f7bce)[_0x011b('0xc')](function(_0x58b665){logger[_0x011b('0xd')](_0x011b('0xe'),_0x83e473,'request\x20sent');logger['debug'](_0x011b('0xf'),_0x83e473,'request\x20sent',JSON[_0x011b('0x10')](_0x58b665));if(_0x58b665['error']){if(_0x58b665[_0x011b('0x11')][_0x011b('0x12')]===0x1f4){logger[_0x011b('0x11')](_0x011b('0xe'),_0x83e473,_0x58b665[_0x011b('0x11')][_0x011b('0x13')]);return _0x37c3ba(_0x58b665[_0x011b('0x11')][_0x011b('0x13')]);}logger['error'](_0x011b('0xe'),_0x83e473,_0x58b665[_0x011b('0x11')][_0x011b('0x13')]);return _0x324a69(_0x58b665[_0x011b('0x11')][_0x011b('0x13')]);}else{logger[_0x011b('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x83e473,'request\x20sent');_0x324a69(_0x58b665[_0x011b('0x14')][_0x011b('0x13')]);}})[_0x011b('0x15')](function(_0x33fdda){logger[_0x011b('0x11')](_0x011b('0xe'),_0x83e473,_0x33fdda);_0x37c3ba(_0x33fdda);});});} \ No newline at end of file +var _0x302c=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x249959,_0x2e2fb2){var _0xf595b4=function(_0x56451b){while(--_0x56451b){_0x249959['push'](_0x249959['shift']());}};_0xf595b4(++_0x2e2fb2);}(_0x302c,0x1d9));var _0xc302=function(_0x3b8c5a,_0x40116e){_0x3b8c5a=_0x3b8c5a-0x0;var _0x480d75=_0x302c[_0x3b8c5a];return _0x480d75;};'use strict';var _=require('lodash');var util=require(_0xc302('0x0'));var moment=require(_0xc302('0x1'));var BPromise=require(_0xc302('0x2'));var rs=require(_0xc302('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc302('0x4'));var logger=require(_0xc302('0x5'))(_0xc302('0x6'));var config=require(_0xc302('0x7'));var jayson=require(_0xc302('0x8'));var client=jayson[_0xc302('0x9')][_0xc302('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b2cf0,_0x13ecc2,_0x27c7b7){return new BPromise(function(_0x494c93,_0x400514){return client[_0xc302('0xb')](_0x1b2cf0,_0x27c7b7)[_0xc302('0xc')](function(_0x1e5625){logger[_0xc302('0xd')](_0xc302('0xe'),_0x13ecc2,_0xc302('0xf'));logger[_0xc302('0x10')](_0xc302('0x11'),_0x13ecc2,_0xc302('0xf'),JSON[_0xc302('0x12')](_0x1e5625));if(_0x1e5625['error']){if(_0x1e5625['error'][_0xc302('0x13')]===0x1f4){logger[_0xc302('0x14')](_0xc302('0xe'),_0x13ecc2,_0x1e5625[_0xc302('0x14')][_0xc302('0x15')]);return _0x400514(_0x1e5625['error'][_0xc302('0x15')]);}logger[_0xc302('0x14')](_0xc302('0xe'),_0x13ecc2,_0x1e5625[_0xc302('0x14')][_0xc302('0x15')]);return _0x494c93(_0x1e5625[_0xc302('0x14')][_0xc302('0x15')]);}else{logger[_0xc302('0xd')](_0xc302('0xe'),_0x13ecc2,_0xc302('0xf'));_0x494c93(_0x1e5625[_0xc302('0x16')][_0xc302('0x15')]);}})[_0xc302('0x17')](function(_0x55f181){logger[_0xc302('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x13ecc2,_0x55f181);_0x400514(_0x55f181);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9c14bf7..85fe4e8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bd8=['listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','Offline\x20apps:','status','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','default'];(function(_0x181c45,_0x5ad61f){var _0x5a0b1a=function(_0x41b530){while(--_0x41b530){_0x181c45['push'](_0x181c45['shift']());}};_0x5a0b1a(++_0x5ad61f);}(_0x2bd8,0x130));var _0x82bd=function(_0x59fd0a,_0x8184f6){_0x59fd0a=_0x59fd0a-0x0;var _0x3ed44f=_0x2bd8[_0x59fd0a];return _0x3ed44f;};'use strict';var _=require(_0x82bd('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x82bd('0x1'));var checkLicense=require(_0x82bd('0x2'));var rpc=require(_0x82bd('0x3'));var config=require(_0x82bd('0x4'));var logger=require(_0x82bd('0x5'))(_0x82bd('0x6'));var pm2=require(_0x82bd('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x82bd('0x8'));var chat=require(_0x82bd('0x9'));var whatsapp=require(_0x82bd('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x82bd('0xb'));function main(){return db[_0x82bd('0xc')][_0x82bd('0xd')]()[_0x82bd('0xe')](function(){if(config['seedDB']){return seedDb[_0x82bd('0xf')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x82bd('0x10')]();})['then'](function(_0x4c9430){logger[_0x82bd('0x11')](_0x4c9430);return chat['start']();})['then'](function(){return whatsapp[_0x82bd('0x12')]();})[_0x82bd('0xe')](function(){return schedule['start']();})[_0x82bd('0xe')](function(){return transcribe['start']();})[_0x82bd('0xe')](function(){return provider['start']();})[_0x82bd('0xe')](function(_0x3c4042){logger[_0x82bd('0x11')](_0x3c4042);return pm2[_0x82bd('0x12')](pm2Config);})['then'](function(_0x446ffc){var _0xd43e79=_0x446ffc['filter'](function(_0x3667ef){return typeof _0x3667ef['exitCode']===_0x82bd('0x13')&&_0x3667ef[_0x82bd('0x14')]>=0x0;});if(_0xd43e79[_0x82bd('0x15')]>0x0){throw new Error(_0xd43e79[_0x82bd('0x15')]+_0x82bd('0x16')+_[_0x82bd('0x17')](_0xd43e79,function(_0x387d21){return'\x22'+_0x387d21[_0x82bd('0x18')][_0x82bd('0x19')]+'\x22';}));}logger[_0x82bd('0x11')](_0x82bd('0x1a'),_[_0x82bd('0x17')](_[_0x82bd('0x1b')](_0x446ffc,{'status':_0x82bd('0x1c')}),'name')['join']());logger[_0x82bd('0x11')](_0x82bd('0x1d'),_[_0x82bd('0x17')](_[_0x82bd('0x1b')](_0x446ffc,function(_0x34899b){return _0x34899b[_0x82bd('0x1e')]!==_0x82bd('0x1c');}),_0x82bd('0x19'))[_0x82bd('0x1f')]()||_0x82bd('0x20'));console[_0x82bd('0x21')](_0x82bd('0x22'));})[_0x82bd('0x23')](function(_0x3260c4){console[_0x82bd('0x21')](_0x82bd('0x24'),_0x3260c4);logger[_0x82bd('0x25')](_0x82bd('0x26'),_0x3260c4);process[_0x82bd('0x27')](0x1);});}main(); \ No newline at end of file +var _0xff22=['sequelize','sync','then','seedDB','default','listen','start','info','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','filter','online','join','Offline\x20apps:','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider'];(function(_0x78bb4f,_0x58436d){var _0x5151b8=function(_0x20b060){while(--_0x20b060){_0x78bb4f['push'](_0x78bb4f['shift']());}};_0x5151b8(++_0x58436d);}(_0xff22,0x1a0));var _0x2ff2=function(_0x295287,_0x573cc3){_0x295287=_0x295287-0x0;var _0x136e97=_0xff22[_0x295287];return _0x136e97;};'use strict';var _=require(_0x2ff2('0x0'));var db=require(_0x2ff2('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x2ff2('0x2'));var rpc=require(_0x2ff2('0x3'));var config=require(_0x2ff2('0x4'));var logger=require(_0x2ff2('0x5'))(_0x2ff2('0x6'));var pm2=require(_0x2ff2('0x7'));var pm2Config=require(_0x2ff2('0x8'));var schedule=require(_0x2ff2('0x9'));var chat=require(_0x2ff2('0xa'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x2ff2('0xb'));var provider=require(_0x2ff2('0xc'));function main(){return db[_0x2ff2('0xd')][_0x2ff2('0xe')]()[_0x2ff2('0xf')](function(){if(config[_0x2ff2('0x10')]){return seedDb[_0x2ff2('0x11')]();}})['then'](function(){return checkLicense[_0x2ff2('0x11')]();})[_0x2ff2('0xf')](function(){return rpc[_0x2ff2('0x12')]();})[_0x2ff2('0xf')](function(_0x255028){logger['info'](_0x255028);return chat['start']();})['then'](function(){return whatsapp[_0x2ff2('0x13')]();})[_0x2ff2('0xf')](function(){return schedule[_0x2ff2('0x13')]();})[_0x2ff2('0xf')](function(){return transcribe[_0x2ff2('0x13')]();})[_0x2ff2('0xf')](function(){return provider[_0x2ff2('0x13')]();})['then'](function(_0xd6d578){logger[_0x2ff2('0x14')](_0xd6d578);return pm2[_0x2ff2('0x13')](pm2Config);})[_0x2ff2('0xf')](function(_0x1f950e){var _0x4c6a1e=_0x1f950e['filter'](function(_0x39053f){return typeof _0x39053f['exitCode']===_0x2ff2('0x15')&&_0x39053f[_0x2ff2('0x16')]>=0x0;});if(_0x4c6a1e[_0x2ff2('0x17')]>0x0){throw new Error(_0x4c6a1e[_0x2ff2('0x17')]+_0x2ff2('0x18')+_[_0x2ff2('0x19')](_0x4c6a1e,function(_0xca38d7){return'\x22'+_0xca38d7['pm2_env'][_0x2ff2('0x1a')]+'\x22';}));}logger['info'](_0x2ff2('0x1b'),_[_0x2ff2('0x19')](_[_0x2ff2('0x1c')](_0x1f950e,{'status':_0x2ff2('0x1d')}),_0x2ff2('0x1a'))[_0x2ff2('0x1e')]());logger[_0x2ff2('0x14')](_0x2ff2('0x1f'),_[_0x2ff2('0x19')](_['filter'](_0x1f950e,function(_0x4a0c0a){return _0x4a0c0a['status']!=='online';}),_0x2ff2('0x1a'))['join']()||_0x2ff2('0x20'));console['log'](_0x2ff2('0x21'));})['catch'](function(_0x55d757){console[_0x2ff2('0x22')](_0x2ff2('0x23'),_0x55d757);logger[_0x2ff2('0x24')](_0x2ff2('0x25'),_0x55d757);process[_0x2ff2('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 53803c0..bb8ec31 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 _0xa41a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','then','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','verify','secrets','session','randomBytes','now','toString','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','allowmessenger'];(function(_0x281054,_0x389bf2){var _0x261907=function(_0x1a0c1f){while(--_0x1a0c1f){_0x281054['push'](_0x281054['shift']());}};_0x261907(++_0x389bf2);}(_0xa41a,0x6b));var _0xaa41=function(_0x4ee47f,_0x44a4b3){_0x4ee47f=_0x4ee47f-0x0;var _0x555738=_0xa41a[_0x4ee47f];return _0x555738;};'use strict';var db=require(_0xaa41('0x0'))['db'];var config=require(_0xaa41('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaa41('0x2'));var encryptor=require(_0xaa41('0x3'));var _=require(_0xaa41('0x4'));var jwt=require(_0xaa41('0x5'));var expressJwt=require(_0xaa41('0x6'));var compose=require(_0xaa41('0x7'));var basicAuth=require(_0xaa41('0x8'));var crypto=require(_0xaa41('0x9'));var BPromise=require('bluebird');var util=require(_0xaa41('0xa'));var moment=require(_0xaa41('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xaa41('0xc'),_0xaa41('0xd'),'name',_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x10'),_0xaa41('0x11'),_0xaa41('0x12'),_0xaa41('0x13'),_0xaa41('0x14'),_0xaa41('0x15'),_0xaa41('0x16'),'smsPause',_0xaa41('0x17'),_0xaa41('0x18'),'showWebBar','lastLoginAt',_0xaa41('0x19'),'crudPermissions',_0xaa41('0x1a'),_0xaa41('0x1b'),_0xaa41('0x1c'),_0xaa41('0x1d'),_0xaa41('0x1e'),'phoneBarDnd',_0xaa41('0x1f'),_0xaa41('0x20'),_0xaa41('0x21'),_0xaa41('0x22'),_0xaa41('0x23'),_0xaa41('0x24'),_0xaa41('0x25'),'hotdesk',_0xaa41('0x26'),_0xaa41('0x27'),_0xaa41('0x28'),_0xaa41('0x29'),_0xaa41('0x2a'),_0xaa41('0x2b'),_0xaa41('0x2c'),_0xaa41('0x2d'),_0xaa41('0x2e'),'selectRecallMeCampaign','chatAutoanswer',_0xaa41('0x2f'),_0xaa41('0x30'),_0xaa41('0x31'),'smsAutoanswer',_0xaa41('0x32'),_0xaa41('0x33'),'openchannelAutoanswerDelay','faxAutoanswer',_0xaa41('0x34'),'whatsappAutoanswer',_0xaa41('0x35')];exports[_0xaa41('0x36')]=function(){return this[_0xaa41('0x37')](!![])[_0xaa41('0x38')](function(_0x1d623c,_0x4eb01f,_0x43c430){if(_0x1d623c[_0xaa41('0x39')]){_0x43c430();}else{return db[_0xaa41('0x3a')][_0xaa41('0x3b')]({'where':{'id':_0x1d623c[_0xaa41('0x3c')]['id']},'attributes':['id',_0xaa41('0x3d'),'disposition'],'raw':!![]})['then'](function(_0x16aec5){if(_0x16aec5&&_0x16aec5['closed']){return _0x4eb01f['status'](_0x16aec5[_0xaa41('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x16aec5[_0xaa41('0x3e')]===_0xaa41('0x3f')?_0xaa41('0x40'):_0xaa41('0x41')});}else{_0x43c430();}})[_0xaa41('0x42')](function(_0xa7269f){_0x43c430(_0xa7269f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x30a174){return compose()[_0xaa41('0x38')](function(_0x63c18c,_0x9a16e3,_0x1d8c2b){var _0x4466a3;if(_0x63c18c[_0xaa41('0x43')][_0xaa41('0x44')]){if(_['startsWith'](_0x63c18c[_0xaa41('0x43')]['authorization'],'Basic')){var _0x714537=basicAuth(_0x63c18c);db[_0xaa41('0x45')]['find']({'where':{'name':_0x714537[_0xaa41('0x46')]}})[_0xaa41('0x47')](function(_0x4e3b44){if(!_0x4e3b44||!_0x4e3b44['authenticate'](_0x714537['pass'])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x4a')});}_0x63c18c[_0xaa41('0x39')]={'id':_0x4e3b44['id']};_0x1d8c2b();})['catch'](function(_0x289c4a){_0x1d8c2b(_0x289c4a);});}else if(_[_0xaa41('0x4b')](_0x63c18c[_0xaa41('0x43')]['authorization'],_0xaa41('0x4c'))){validateJwt(_0x63c18c,_0x9a16e3,_0x1d8c2b);}else{if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x63c18c[_0xaa41('0x4d')][_0xaa41('0x4e')]){try{var _0x57fe1d={'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};verifyJwt(_0x63c18c[_0xaa41('0x4d')]['apikey'],_0x57fe1d)[_0xaa41('0x47')](function(_0x48335f){return db[_0xaa41('0x45')][_0xaa41('0x50')]({'where':{'id':_0x48335f[_0xaa41('0x51')]}})['then'](function(_0x526377){_0x4466a3=_0x526377;return db['Setting'][_0xaa41('0x3b')]({'where':{'id':0x1},'attributes':[_0xaa41('0x52'),_0xaa41('0x53')],'raw':!![]});})[_0xaa41('0x47')](function(_0x4fbb92){if(!_0x4466a3||!_['isEqual'](_0x4466a3[_0xaa41('0x54')],_0x48335f[_0xaa41('0x55')])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x56')});}if(_0x4466a3[_0xaa41('0x57')]){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}if(_0x4466a3[_0xaa41('0x59')]){if(_0x4fbb92[_0xaa41('0x53')]>0x0){if(moment(_0x4466a3[_0xaa41('0x5a')])['add'](_0x4fbb92['blockDuration'],_0xaa41('0x5b'))>moment()){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}}else{return _0x9a16e3['status'](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});}}_0x63c18c[_0xaa41('0x39')]={'id':_0x4466a3['id']};_0x1d8c2b();});})[_0xaa41('0x42')](function(){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});});}catch(_0x21f204){_0x1d8c2b(_0x21f204);}}else if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5c')});}})[_0xaa41('0x38')](function(_0x398c35,_0xc84fb8,_0x1e2eb2){if(_0x398c35['user']){db['User'][_0xaa41('0x50')]({'where':{'id':_0x398c35['user']['id']},'attributes':userAttributes})[_0xaa41('0x47')](function(_0x215896){if(!_0x215896){return _0xc84fb8[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x5d')});}_0x398c35[_0xaa41('0x39')]=_0x215896;_0x1e2eb2();})[_0xaa41('0x42')](function(_0x5ee74c){_0x1e2eb2(_0x5ee74c);});}else if(_0x30a174){_0x1e2eb2();}else{return _0xc84fb8[_0xaa41('0x48')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaa41('0x5e')]=function canUpdate(){return compose()['use'](function(_0x57240d,_0x5274c9,_0x3bad48){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x198716){if(_0x198716['update']){_0x3bad48();}else{return _0x5274c9['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})[_0xaa41('0x42')](function(_0x2af8ba){_0x3bad48(_0x2af8ba);});});};exports[_0xaa41('0x60')]=function isWebrtcLicence(){return compose()[_0xaa41('0x38')](function(_0x258096,_0x37bf5d,_0x2fa6ec){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x22d512){if(_0x22d512[_0xaa41('0x61')]){_0x2fa6ec();}else{return _0x37bf5d[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})['catch'](function(_0x406824){_0x2fa6ec(_0x406824);});});};exports[_0xaa41('0x62')]=function(_0x1f50c,_0x2288f8,_0x57d1f6){_0x1f50c[_0xaa41('0x62')]=!![];return _0x57d1f6();};exports['signToken']=function signToken(_0x49fedd){return signJwt(_0x49fedd);};exports[_0xaa41('0x63')]=function(_0xe0eec0,_0x3e16ef){if(!_0xe0eec0['user']){return _0x3e16ef[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x64')});}var _0x48fa37={'payload':{'id':_0xe0eec0[_0xaa41('0x39')]['id'],'role':_0xe0eec0[_0xaa41('0x39')][_0xaa41('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x48fa37)[_0xaa41('0x47')](function(_0x37fbe2){_0x3e16ef[_0xaa41('0x65')](_0xaa41('0x66'),_0x37fbe2);_0x3e16ef[_0xaa41('0x67')]('/dashboards/general');})[_0xaa41('0x42')](function(_0x5bef5f){return _0x3e16ef['status'](0x1f4)[_0xaa41('0x68')](_0x5bef5f);});};exports[_0xaa41('0x69')]=function(_0x3fef3e){if(_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x54')])||_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x6b')])){return null;}else{return createJwt(_0x3fef3e);}};exports[_0xaa41('0x6c')]=function(_0x519e39){_0x519e39[_0xaa41('0x54')]=generateNonce();_0x519e39[_0xaa41('0x6b')]=generateIssuedAt();return createJwt(_0x519e39);};exports[_0xaa41('0x6d')]=function(_0x4f9e92,_0x2e0f53){var _0x35f664=_0x4f9e92['query'][_0xaa41('0x4e')];if(_0x35f664){var _0xd36d1a={'nonce':_0x2e0f53[_0xaa41('0x54')],'iat':_0x2e0f53['apiKeyIat'],'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};return verifyJwt(_0x35f664,_0xd36d1a)['then'](function(){return generateApiKey(_0x2e0f53);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaa41('0x6e')]=function(_0x3cd14f){var _0x3a29d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3a29d2['test'](_0x3cd14f))throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0xaa41('0x71'));return;};exports[_0xaa41('0x72')]=function(_0x2abb78,_0x5ccdc5,_0x2ae70c){var _0x57cb70=encryptor['decryptString'](_0x5ccdc5)[_0xaa41('0x73')](',');for(var _0x52ae7f=0x0;_0x52ae7f<_0x2ae70c;_0x52ae7f++){if(!_0x57cb70[_0x52ae7f])break;if(_0x2abb78[_0xaa41('0x74')]()===_0x57cb70[_0x52ae7f][_0xaa41('0x74')]()){var _0x169ddf=util['format'](_0xaa41('0x75'),_0x2ae70c);if(_0x2ae70c===0x1){_0x169ddf=_0xaa41('0x76');}throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0x169ddf);}}return;};exports[_0xaa41('0x77')]=function(_0x332a3c,_0xc56018){var _0x337059=_0xc56018?encryptor[_0xaa41('0x78')](_0xc56018)['split'](','):[];if(_0x337059[_0xaa41('0x79')]===0x5){_0x337059[_0xaa41('0x7a')](-0x1,0x1);}_0x337059[_0xaa41('0x7b')](_0x332a3c);return encryptor['encryptString'](_0x337059[_0xaa41('0x7c')](','));};function signJwt(_0x2caf5c){var _0x157898=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x7e')],{'context':jwt});var _0xfbe748=_0x2caf5c[_0xaa41('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x5cb34d,_0x540325){_0x157898(_0x2caf5c['payload'],_0xfbe748,_0x2caf5c['options'])[_0xaa41('0x47')](function(_0x50b598){_0x5cb34d(_0x50b598);})['catch'](function(_0x24c6f3){_0x540325(_0x24c6f3);});});}function verifyJwt(_0x40a524,_0x1a877b,_0x312eee){var _0x5cabc4=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x80')],{'context':jwt});var _0x1ddb6c=_0x312eee||config[_0xaa41('0x81')][_0xaa41('0x82')];return new BPromise(function(_0x41ca40,_0x46ebcd){_0x5cabc4(_0x40a524,_0x1ddb6c,_0x1a877b)[_0xaa41('0x47')](function(_0x1795d1){_0x41ca40(_0x1795d1);})['catch'](function(_0x185600){_0x46ebcd(_0x185600);});});}function generateNonce(){return crypto[_0xaa41('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xaa41('0x84')]()/0x3e8)['toString']();}function createJwt(_0x1eac4a){var _0x5c8028={'payload':{'iat':_0x1eac4a[_0xaa41('0x6b')],'nonce':_0x1eac4a[_0xaa41('0x54')]},'options':{'algorithm':'HS512','subject':_0x1eac4a['id'][_0xaa41('0x85')](),'issuer':hardwareConf[_0xaa41('0x4f')](),'audience':hardwareConf[_0xaa41('0x4f')]()}};return signJwt(_0x5c8028)[_0xaa41('0x47')](function(_0x5a2683){return{'iat':_0x1eac4a['apiKeyIat'],'nonce':_0x1eac4a[_0xaa41('0x54')],'token':_0x5a2683};});} \ No newline at end of file +var _0x6aa7=['smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa7,0x178));var _0x76aa=function(_0x55e7c4,_0x39c3b9){_0x55e7c4=_0x55e7c4-0x0;var _0x5f5355=_0x6aa7[_0x55e7c4];return _0x5f5355;};'use strict';var db=require(_0x76aa('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x76aa('0x1'));var licenseUtil=require(_0x76aa('0x2'));var encryptor=require(_0x76aa('0x3'));var _=require(_0x76aa('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x76aa('0x5'));var compose=require(_0x76aa('0x6'));var basicAuth=require(_0x76aa('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x76aa('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x76aa('0x9')][_0x76aa('0xa')]});var userAttributes=['id',_0x76aa('0xb'),'fullname',_0x76aa('0xc'),_0x76aa('0xd'),_0x76aa('0xe'),'userpic',_0x76aa('0xf'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13'),_0x76aa('0x14'),_0x76aa('0x15'),_0x76aa('0x16'),_0x76aa('0x17'),_0x76aa('0x18'),'lastLoginAt',_0x76aa('0x19'),'crudPermissions',_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d'),_0x76aa('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x76aa('0x1f'),'phoneBarEnableSettings',_0x76aa('0x20'),_0x76aa('0x21'),'phoneBarRemoteControl',_0x76aa('0x22'),'hotdesk',_0x76aa('0x23'),'userProfileId',_0x76aa('0x24'),_0x76aa('0x25'),_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2f'),_0x76aa('0x30'),_0x76aa('0x31'),_0x76aa('0x32'),'faxAutoanswerDelay',_0x76aa('0x33'),_0x76aa('0x34')];exports[_0x76aa('0x35')]=function(){return this['isAuthenticated'](!![])[_0x76aa('0x36')](function(_0x189cb6,_0x31252f,_0x2bd2c6){if(_0x189cb6[_0x76aa('0x37')]){_0x2bd2c6();}else{return db[_0x76aa('0x38')][_0x76aa('0x39')]({'where':{'id':_0x189cb6[_0x76aa('0x3a')]['id']},'attributes':['id',_0x76aa('0x3b'),_0x76aa('0x3c')],'raw':!![]})[_0x76aa('0x3d')](function(_0x26b75e){if(_0x26b75e&&_0x26b75e[_0x76aa('0x3b')]){return _0x31252f['status'](_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?0x195:0x193)[_0x76aa('0x3f')]({'message':_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?_0x76aa('0x40'):_0x76aa('0x41')});}else{_0x2bd2c6();}})[_0x76aa('0x42')](function(_0xd12a99){_0x2bd2c6(_0xd12a99);});}});};exports[_0x76aa('0x43')]=function isAuthenticated(_0x545b06){return compose()[_0x76aa('0x36')](function(_0x5a8030,_0x994550,_0x365ff8){var _0x2dec94;if(_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')]){if(_[_0x76aa('0x46')](_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')],_0x76aa('0x47'))){var _0x3ea05a=basicAuth(_0x5a8030);db['User'][_0x76aa('0x48')]({'where':{'name':_0x3ea05a[_0x76aa('0xc')]}})[_0x76aa('0x3d')](function(_0x928ccf){if(!_0x928ccf||!_0x928ccf[_0x76aa('0x49')](_0x3ea05a[_0x76aa('0x4a')])){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x4c')});}_0x5a8030[_0x76aa('0x37')]={'id':_0x928ccf['id']};_0x365ff8();})['catch'](function(_0x2ee338){_0x365ff8(_0x2ee338);});}else if(_['startsWith'](_0x5a8030[_0x76aa('0x44')]['authorization'],_0x76aa('0x4d'))){validateJwt(_0x5a8030,_0x994550,_0x365ff8);}else{if(_0x545b06){_0x365ff8();}else{return _0x994550['status'](0x193)['json']({'message':_0x76aa('0x4e')});}}}else if(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')]){try{var _0x37dfab={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')],_0x37dfab)[_0x76aa('0x3d')](function(_0x23e2fd){return db[_0x76aa('0x51')]['find']({'where':{'id':_0x23e2fd[_0x76aa('0x52')]}})['then'](function(_0x5086f5){_0x2dec94=_0x5086f5;return db[_0x76aa('0x53')][_0x76aa('0x39')]({'where':{'id':0x1},'attributes':[_0x76aa('0x54'),_0x76aa('0x55')],'raw':!![]});})['then'](function(_0x401c07){if(!_0x2dec94||!_[_0x76aa('0x56')](_0x2dec94[_0x76aa('0x57')],_0x23e2fd['nonce'])){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x58')});}if(_0x2dec94[_0x76aa('0x59')]){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}if(_0x2dec94[_0x76aa('0x5b')]){if(_0x401c07[_0x76aa('0x55')]>0x0){if(moment(_0x2dec94['blockedAt'])[_0x76aa('0x5c')](_0x401c07[_0x76aa('0x55')],_0x76aa('0x5d'))>moment()){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}}else{return _0x994550['status'](0x191)['json']({'message':_0x76aa('0x5a')});}}_0x5a8030[_0x76aa('0x37')]={'id':_0x2dec94['id']};_0x365ff8();});})[_0x76aa('0x42')](function(){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x5a')});});}catch(_0x403084){_0x365ff8(_0x403084);}}else if(_0x545b06){_0x365ff8();}else{return _0x994550[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x4e')});}})['use'](function(_0x13dafe,_0x556f59,_0xbb3136){if(_0x13dafe['user']){db['User']['find']({'where':{'id':_0x13dafe[_0x76aa('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5cf314){if(!_0x5cf314){return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5e')});}_0x13dafe[_0x76aa('0x37')]=_0x5cf314;_0xbb3136();})[_0x76aa('0x42')](function(_0x27a52e){_0xbb3136(_0x27a52e);});}else if(_0x545b06){_0xbb3136();}else{return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5f')});}});};exports[_0x76aa('0x60')]=function canUpdate(){return compose()[_0x76aa('0x36')](function(_0x3800a4,_0x47a308,_0x2f695c){return licenseUtil[_0x76aa('0x61')]()['then'](function(_0x2d3441){if(_0x2d3441['update']){_0x2f695c();}else{return _0x47a308[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})[_0x76aa('0x42')](function(_0x2d0bc4){_0x2f695c(_0x2d0bc4);});});};exports[_0x76aa('0x63')]=function isWebrtcLicence(){return compose()[_0x76aa('0x36')](function(_0x165858,_0xb8d052,_0x3946bd){return licenseUtil['getLicense']()[_0x76aa('0x3d')](function(_0x4b8f12){if(_0x4b8f12[_0x76aa('0x64')]){_0x3946bd();}else{return _0xb8d052[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})['catch'](function(_0x5a3d9c){_0x3946bd(_0x5a3d9c);});});};exports[_0x76aa('0x65')]=function(_0x54b673,_0x8660a4,_0x302a0c){_0x54b673[_0x76aa('0x65')]=!![];return _0x302a0c();};exports[_0x76aa('0x66')]=function signToken(_0x30c577){return signJwt(_0x30c577);};exports[_0x76aa('0x67')]=function(_0x5b567b,_0x564546){if(!_0x5b567b[_0x76aa('0x37')]){return _0x564546[_0x76aa('0x4b')](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x68')});}var _0x18c679={'payload':{'id':_0x5b567b[_0x76aa('0x37')]['id'],'role':_0x5b567b['user'][_0x76aa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18c679)[_0x76aa('0x3d')](function(_0x26db69){_0x564546['cookie'](_0x76aa('0x69'),_0x26db69);_0x564546['redirect'](_0x76aa('0x6a'));})['catch'](function(_0x339b0d){return _0x564546[_0x76aa('0x4b')](0x1f4)[_0x76aa('0x6b')](_0x339b0d);});};exports[_0x76aa('0x6c')]=function(_0x37a4d9){if(_[_0x76aa('0x6d')](_0x37a4d9[_0x76aa('0x57')])||_['isNil'](_0x37a4d9[_0x76aa('0x6e')])){return null;}else{return createJwt(_0x37a4d9);}};exports['generateApiKey']=function(_0x3ee32){_0x3ee32[_0x76aa('0x57')]=generateNonce();_0x3ee32[_0x76aa('0x6e')]=generateIssuedAt();return createJwt(_0x3ee32);};exports[_0x76aa('0x6f')]=function(_0x3fa7ec,_0x28f8aa){var _0x336024=_0x3fa7ec['query'][_0x76aa('0x50')];if(_0x336024){var _0x281f73={'nonce':_0x28f8aa[_0x76aa('0x57')],'iat':_0x28f8aa[_0x76aa('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x76aa('0x70')]()};return verifyJwt(_0x336024,_0x281f73)[_0x76aa('0x3d')](function(){return generateApiKey(_0x28f8aa);});}else{throw{'message':_0x76aa('0x71')};}};exports[_0x76aa('0x72')]=function(_0x2027f8){var _0xf7732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf7732['test'](_0x2027f8))throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x76aa('0x75'));return;};exports[_0x76aa('0x76')]=function(_0x3967f3,_0x2fdc4f,_0x37babe){var _0x51893b=encryptor['decryptString'](_0x2fdc4f)[_0x76aa('0x77')](',');for(var _0x3b0d8a=0x0;_0x3b0d8a<_0x37babe;_0x3b0d8a++){if(!_0x51893b[_0x3b0d8a])break;if(_0x3967f3['toLowerCase']()===_0x51893b[_0x3b0d8a][_0x76aa('0x78')]()){var _0x1e6f3c=util['format'](_0x76aa('0x79'),_0x37babe);if(_0x37babe===0x1){_0x1e6f3c=_0x76aa('0x7a');}throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x1e6f3c);}}return;};exports[_0x76aa('0x7b')]=function(_0x1f5010,_0x3376ec){var _0x30573a=_0x3376ec?encryptor[_0x76aa('0x7c')](_0x3376ec)['split'](','):[];if(_0x30573a[_0x76aa('0x7d')]===0x5){_0x30573a['splice'](-0x1,0x1);}_0x30573a[_0x76aa('0x7e')](_0x1f5010);return encryptor[_0x76aa('0x7f')](_0x30573a[_0x76aa('0x80')](','));};function signJwt(_0x16cc85){var _0x343cf1=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x82')],{'context':jwt});var _0x431d1c=_0x16cc85[_0x76aa('0x83')]||config['secrets'][_0x76aa('0xa')];return new BPromise(function(_0x3d4025,_0x5c542b){_0x343cf1(_0x16cc85[_0x76aa('0x84')],_0x431d1c,_0x16cc85[_0x76aa('0x85')])[_0x76aa('0x3d')](function(_0x3d6d10){_0x3d4025(_0x3d6d10);})[_0x76aa('0x42')](function(_0x5546b6){_0x5c542b(_0x5546b6);});});}function verifyJwt(_0x364d05,_0x4d3ad0,_0x35bd2b){var _0x35881c=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x86')],{'context':jwt});var _0x3a82fe=_0x35bd2b||config[_0x76aa('0x9')][_0x76aa('0xa')];return new BPromise(function(_0x4a37f1,_0x9ea0af){_0x35881c(_0x364d05,_0x3a82fe,_0x4d3ad0)[_0x76aa('0x3d')](function(_0x543c1d){_0x4a37f1(_0x543c1d);})['catch'](function(_0x40429c){_0x9ea0af(_0x40429c);});});}function generateNonce(){return crypto[_0x76aa('0x87')](0x10)['toString'](_0x76aa('0x88'));}function generateIssuedAt(){return Math[_0x76aa('0x89')](Date[_0x76aa('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x446073){var _0x47f733={'payload':{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')]},'options':{'algorithm':_0x76aa('0x8b'),'subject':_0x446073['id'][_0x76aa('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x47f733)[_0x76aa('0x3d')](function(_0x4dfeb3){return{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')],'token':_0x4dfeb3};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 33252d5..5a6f92e 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter'];(function(_0x2627c1,_0x483c0e){var _0x4665a4=function(_0x259ad4){while(--_0x259ad4){_0x2627c1['push'](_0x2627c1['shift']());}};_0x4665a4(++_0x483c0e);}(_0xb10b,0x12a));var _0xbb10=function(_0x19abc7,_0x5aadb6){_0x19abc7=_0x19abc7-0x0;var _0xc24f10=_0xb10b[_0x19abc7];return _0xc24f10;};'use strict';var _=require(_0xbb10('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbb10('0x1'))['db'];exports[_0xbb10('0x2')]=function(_0x1dcb08,_0x4d688c,_0x4541ae,_0x9bbed){var _0x460981={'count':0x0,'rows':[]};var _0x22320e=sqlUtils[_0xbb10('0x3')](_0x4d688c,_0x1dcb08);if(_0x22320e){return Promise[_0xbb10('0x4')](_0x460981);}var _0x481979=sqlUtils[_0xbb10('0x5')]();var _0x3cdd53={};var _0x513741=![];var _0x1b9e94=![];return Promise[_0xbb10('0x4')]()[_0xbb10('0x6')](function(){if(_0x1dcb08[_0xbb10('0x7')]){return sqlUtils[_0xbb10('0x8')](_0x1dcb08[_0xbb10('0x7')],_0x9bbed);}else{return sqlUtils[_0xbb10('0x9')](_0x1dcb08,_0x9bbed);}})[_0xbb10('0x6')](function(_0x5ab04a){_0x481979['where'](_0x5ab04a[_0xbb10('0xa')]);_0x481979[_0xbb10('0xb')](_0x5ab04a[_0xbb10('0xc')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xd')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xe')][_0xbb10('0xf')]);_0x3cdd53=_0x5ab04a[_0xbb10('0x10')];_0x1b9e94=_0x5ab04a[_0xbb10('0xe')][_0xbb10('0x11')];return sqlUtils[_0xbb10('0x12')](_0x4d688c,_0x1dcb08,_0x1b9e94);})['then'](function(_0x26e021){_0x481979[_0xbb10('0xb')](_0x26e021);var _0x45b9d6=_0x1dcb08[_0xbb10('0x7')]?_0x3cdd53[_0xbb10('0x13')]:_0x1dcb08[_0xbb10('0x14')];_0x513741=_0x45b9d6?!![]:![];return sqlUtils[_0xbb10('0x15')](_0x481979,_0x45b9d6);})[_0xbb10('0x6')](function(_0x3e26f4){_0x460981[_0xbb10('0x16')]=_0x3e26f4;if(_0x460981['count']===0x0){return;}return sqlUtils[_0xbb10('0x17')](_0x481979,_0x1dcb08[_0xbb10('0xc')],_0x4541ae,_0x513741,_0x3cdd53[_0xbb10('0xf')],_0x1b9e94);})[_0xbb10('0x6')](function(_0x378da8){if(!_0x378da8){return[];}return sqlUtils[_0xbb10('0x18')](_0x378da8,_0x1dcb08,_0x4541ae);})[_0xbb10('0x6')](function(_0x30efc6){_0x460981[_0xbb10('0x19')]=_0x30efc6;return _0x460981;})[_0xbb10('0x1a')](function(_0x48b6e9){throw _0x48b6e9;});};exports[_0xbb10('0x1b')]=function(){var _0x19f48d={};var _0x388fab=[];return db[_0xbb10('0x1c')][_0xbb10('0x1b')]()[_0xbb10('0x6')](function(_0x4deb49){_0x19f48d=_0x4deb49;var _0x12f888=Object[_0xbb10('0x1d')](_0x19f48d)['filter'](function(_0x4c4b0d){return _[_0xbb10('0x1e')](_0x4c4b0d,_0xbb10('0x1f'))?_0x4c4b0d:undefined;});var _0x2e911d=_0x12f888[_0xbb10('0x20')](function(_0x445761){return db[_0xbb10('0x21')][_0xbb10('0x22')]({'where':{'id':_0x445761[_0xbb10('0x23')](0x3)},'raw':!![]});});return Promise[_0xbb10('0x24')](_0x2e911d);})[_0xbb10('0x6')](function(_0x3ba6cd){for(var _0x26ad93=0x0;_0x26ad93<_0x3ba6cd['length'];_0x26ad93++){if(_0x3ba6cd[_0x26ad93]){var _0x4fedac='cf_'+_0x3ba6cd[_0x26ad93]['id'];_0x19f48d[_0x4fedac][_0xbb10('0x25')]=_0x3ba6cd[_0x26ad93][_0xbb10('0x26')];}}_0x388fab=_[_0xbb10('0x20')](Object['keys'](_0x19f48d),function(_0x2fdde9){return{'name':_0x2fdde9,'type':_0x19f48d[_0x2fdde9][_0xbb10('0x26')]};});return _0x388fab;})[_0xbb10('0x1a')](function(_0x1d5e95){throw _0x1d5e95;});}; \ No newline at end of file +var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x36dd39,_0x1c3a7a){var _0x47d757=function(_0x5bfe5d){while(--_0x5bfe5d){_0x36dd39['push'](_0x36dd39['shift']());}};_0x47d757(++_0x1c3a7a);}(_0x2032,0xd9));var _0x2203=function(_0x4178dc,_0x35029b){_0x4178dc=_0x4178dc-0x0;var _0x312ad1=_0x2032[_0x4178dc];return _0x312ad1;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 00922de..c0b1e18 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ffb=['attributes','group','c.id','limit','offset','subqry.id','having','order','subqry.','DESC','findAll','color','QueryTypes','SELECT','CmContact','sequelize','query','toString','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','squel','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','fax','email','CompanyId','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','name','fieldType','datetime','castTo','DATE','buildExpression','text','value','end','Tag','map','clause','and','tags','ids','user','uc.UserId\x20=\x20?','keys','some','compact','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','filter','agent','getLists','c.ListId\x20IS\x20NULL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ffb,0xde));var _0xb0ff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ffb[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var squel=require(_0xb0ff('0x0'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0xb0ff('0x1'));var db=require(_0xb0ff('0x2'))['db'];function skipContactsQuery(_0xfaa35c,_0x5c9a4d){var _0x13ed2a=![];if(_0xfaa35c[_0xb0ff('0x3')]==='agent'&&!_0x5c9a4d[_0xb0ff('0x4')]&&!_0x5c9a4d[_0xb0ff('0x5')]&&_0x5c9a4d[_0xb0ff('0x6')]!==_0xb0ff('0x7')){_0x13ed2a=!![];}return _0x13ed2a;}function getContactsSubquery(){return squel[_0xb0ff('0x8')]()[_0xb0ff('0x9')]('cm_contacts','c')[_0xb0ff('0xa')](_0xb0ff('0xb'));}function applyJoinClauses(_0x45e890,_0x29f8e4){var _0xc209f3=_0x29f8e4?'c':_0xb0ff('0xc');_0x45e890[_0xb0ff('0xd')](_0xb0ff('0xe'),'uc',_0xb0ff('0xf')+_0xc209f3+_0xb0ff('0x10'))[_0xb0ff('0xd')](_0xb0ff('0x11'),'ct',_0xb0ff('0x12')+_0xc209f3+_0xb0ff('0x10'))[_0xb0ff('0xd')]('tools_tags','t',_0xb0ff('0x13'));return _0x45e890;}function addFieldsToQuery(_0x3faaef,_0x23d6de,_0x22839b,_0x1f0f13,_0x5d6255){var _0x2600e5=_0x5d6255?'c':_0xb0ff('0xc');if(!_0x23d6de){_0x23d6de=['id',_0xb0ff('0x14'),_0xb0ff('0x15'),'phone','mobile',_0xb0ff('0x16'),_0xb0ff('0x17'),_0xb0ff('0x5'),_0xb0ff('0x18'),'createdAt','updatedAt','deletedAt',_0xb0ff('0x19')];}else if(!_0x23d6de[_0xb0ff('0x1a')]('id')){_0x23d6de[_0xb0ff('0x1b')]('id');}var _0x157c79=_0x22839b&&_0x5d6255||!_0x22839b&&!_0x5d6255;if(_0x1f0f13){_0x157c79=_0x1f0f13&&_0x5d6255||!_0x1f0f13&&!_0x5d6255;}_0x23d6de[_0xb0ff('0x1c')](function(_0x4c8afe){if(_0x4c8afe===_0xb0ff('0x19')){if(_0x157c79){_0x3faaef[_0xb0ff('0x1d')](_0xb0ff('0x1e'),_0x4c8afe);}else if(_0x22839b||_0x1f0f13){_0x3faaef[_0xb0ff('0x1d')](_0x2600e5+'.'+_0x4c8afe);}}else{_0x3faaef[_0xb0ff('0x1d')](_0x2600e5+'.'+_0x4c8afe);}});return _0x3faaef;}function getSqlClauses(){var _0x2455a9={'default':squel[_0xb0ff('0x1f')](),'fields':squel['expr'](),'filter':squel[_0xb0ff('0x1f')](),'tags':{'clause':squel[_0xb0ff('0x1f')](),'ids':null},'user':{'clause':squel[_0xb0ff('0x1f')](),'skip':![]}};return _0x2455a9;}function parseTagParameter(_0x475f6f){var _0x5139d0=squel['expr']();if(_0x475f6f){var _0xbe131=utils[_0xb0ff('0x20')](_0x475f6f);_0xbe131['forEach'](function(_0x5e1425){_0x5139d0['or'](_0xb0ff('0x21'),'%,'+_0x5e1425+',%');});}return _0x5139d0;}function parseSearchFilter(_0xf112e7){var _0x48c4c4=squel[_0xb0ff('0x1f')]();if(_0xf112e7){var _0x531ae9=_0xf112e7[_0xb0ff('0x22')]('\x5c','\x5c\x5c')[_0xb0ff('0x22')](/'/g,'\x27\x27');if(_0x531ae9[_0xb0ff('0x23')]('\x20')[_0xb0ff('0x24')]>0x1){_0x48c4c4['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb0ff('0x25')](_0x531ae9),null);}else{if(qs['isNumeric'](_0x531ae9)){_0x48c4c4['or'](_0xb0ff('0x26'),_0x531ae9+'%');_0x48c4c4['or']('c.phone\x20LIKE\x20?',_0x531ae9+'%');_0x48c4c4['or'](_0xb0ff('0x27'),_0x531ae9+'%');_0x48c4c4['or']('c.fax\x20LIKE\x20?',_0x531ae9+'%');}else if(qs['isEmail'](_0x531ae9)){_0x48c4c4['or'](_0xb0ff('0x28'),_0x531ae9+'%');}else{_0x48c4c4['or'](_0xb0ff('0x29'),'%'+_0x531ae9+'%');_0x48c4c4['or'](_0xb0ff('0x2a'),'%'+_0x531ae9+'%');_0x48c4c4['or'](_0xb0ff('0x28'),'%'+_0x531ae9+'%');}}}return _0x48c4c4;}function parseAdvancedSearchFilter(_0x1dc660,_0x4bfe0e){var _0x1d0abb=getSqlClauses();var _0x6f648=as['parseSearch'](_0x1dc660);var _0x1b44d8=_0x6f648[_0xb0ff('0x2b')];for(var _0x22a7e8=0x0;_0x22a7e8<_0x6f648[_0xb0ff('0x2c')][_0xb0ff('0x24')];_0x22a7e8++){var _0xcf24bb=_0x6f648[_0xb0ff('0x2c')][_0x22a7e8];var _0x18291d='c';var _0x2e3a1f=_['find'](_0x4bfe0e,[_0xb0ff('0x2d'),_0xcf24bb[_0xb0ff('0x1d')]]);if(_0x2e3a1f){if(_0xcf24bb[_0xb0ff('0x1d')]==='dateOfBirth'||_0x2e3a1f[_0xb0ff('0x2e')]===_0xb0ff('0x2f')){_0xcf24bb[_0xb0ff('0x30')]=_0xb0ff('0x31');}var _0x55376c=as[_0xb0ff('0x32')](_0x18291d,_0x2e3a1f['type'],_0xcf24bb);_0x1d0abb['default'][_0x1b44d8](_0x55376c[_0xb0ff('0x33')],_0x55376c[_0xb0ff('0x34')]['start'],_0x55376c[_0xb0ff('0x34')][_0xb0ff('0x35')]);}else{if(_0xcf24bb['field']===_0xb0ff('0x36')){var _0x293dfa=_0xcf24bb[_0xb0ff('0x34')][_0xb0ff('0x23')](',')[_0xb0ff('0x37')](function(_0x135200){return Number(_0x135200);});var _0x2af3c4=parseTagParameter(_0x293dfa);_0x1d0abb['tags'][_0xb0ff('0x38')][_0xb0ff('0x39')](_0x2af3c4);_0x1d0abb[_0xb0ff('0x3a')][_0xb0ff('0x3b')]=_0x293dfa;}else if(_0xcf24bb['field']==='User'){_0x1d0abb[_0xb0ff('0x3c')][_0xb0ff('0x38')]['and'](_0xb0ff('0x3d'),_0xcf24bb[_0xb0ff('0x34')]);_0x1d0abb[_0xb0ff('0x3c')]['skip']=!![];}}}return _0x1d0abb;}function parseModelFields(_0x4e1f9b,_0x4394df){var _0x3b7090=squel['expr']();var _0x24088e=_(_0x4e1f9b)[_0xb0ff('0x3e')]()[_0xb0ff('0x37')](function(_0x591ed7){return _[_0xb0ff('0x3f')](_0x4394df,['name',_0x591ed7])?_0x591ed7:undefined;})[_0xb0ff('0x40')]()[_0xb0ff('0x34')]();if(_0x4e1f9b[_0xb0ff('0x41')]){_0x24088e[_0xb0ff('0x1b')]('Contact');}if(_0x24088e[_0xb0ff('0x24')]>0x0){_0x24088e[_0xb0ff('0x1c')](function(_0x4ef056){if(_0x4ef056===_0xb0ff('0x5')){_0x3b7090['and'](_0xb0ff('0x42'),[]['concat'](_0x4e1f9b[_0x4ef056]));}else if(_0x4ef056===_0xb0ff('0x41')){var _0x142372='%'+_0x4e1f9b[_0x4ef056]+'%';_0x3b7090[_0xb0ff('0x39')](_0xb0ff('0x43'),_0x142372);}else{_0x3b7090[_0xb0ff('0x39')]('c.'+_0x4ef056+_0xb0ff('0x44'),_0x4e1f9b[_0x4ef056]);}});}return _0x3b7090;}function parseQueryParameters(_0x1db2a6,_0x2a50f4){var _0x15301a=getSqlClauses();return Promise['resolve']()[_0xb0ff('0x45')](function(){return parseModelFields(_0x1db2a6,_0x2a50f4);})['then'](function(_0x16b602){_0x15301a[_0xb0ff('0x46')][_0xb0ff('0x39')](_0x16b602);return parseTagParameter(_0x1db2a6['tag']);})[_0xb0ff('0x45')](function(_0x456a8b){_0x15301a[_0xb0ff('0x3a')][_0xb0ff('0x38')][_0xb0ff('0x39')](_0x456a8b);return parseSearchFilter(_0x1db2a6[_0xb0ff('0x47')]);})[_0xb0ff('0x45')](function(_0x58e7c4){_0x15301a['filter']=_0x58e7c4;return _0x15301a;});}function checkListsRestrictions(_0x46be4d,_0x580e24,_0x4f5ff2){var _0x34b9ee=squel[_0xb0ff('0x1f')]();return Promise['resolve']()[_0xb0ff('0x45')](function(){if(_0x580e24['search']&&_0x46be4d[_0xb0ff('0x3')]===_0xb0ff('0x48')&&!_0x4f5ff2){return _0x46be4d[_0xb0ff('0x49')]({'attributes':['id'],'raw':!![]});}})[_0xb0ff('0x45')](function(_0x236259){if(_0x236259){if(_0x236259[_0xb0ff('0x24')]===0x0){_0x34b9ee[_0xb0ff('0x39')](_0xb0ff('0x4a'));}else{_0x34b9ee[_0xb0ff('0x39')](_0xb0ff('0x42'),_['map'](_0x236259,'id'));}}})[_0xb0ff('0x45')](function(){return _0x34b9ee;});}function buildContactsQuery(_0x159acd,_0x526055,_0x5b16ae,_0x22d578,_0x35f8ad,_0x1c6e89){if(_0x526055){_0x526055=_0x5b16ae[_0xb0ff('0x4b')];}_0x159acd=addFieldsToQuery(_0x159acd,_0x526055,_0x22d578,_0x1c6e89,!![]);var _0x1e8070=squel[_0xb0ff('0x8')]();_0x1e8070=addFieldsToQuery(_0x1e8070,_0x526055,_0x22d578,_0x1c6e89,![]);if(_0x22d578||_0x1c6e89){_0x159acd=applyJoinClauses(_0x159acd,!![]);_0x159acd[_0xb0ff('0x4c')](_0xb0ff('0x4d'));if(_0x5b16ae[_0xb0ff('0x4e')]){_0x1e8070[_0xb0ff('0x4e')](_0x5b16ae[_0xb0ff('0x4e')]);}if(_0x5b16ae[_0xb0ff('0x4f')]){_0x1e8070[_0xb0ff('0x4f')](_0x5b16ae['offset']);}}else{_0x1e8070=applyJoinClauses(_0x1e8070,![]);_0x1e8070['group'](_0xb0ff('0x50'));if(_0x5b16ae[_0xb0ff('0x4e')]){_0x159acd['limit'](_0x5b16ae[_0xb0ff('0x4e')]);}if(_0x5b16ae[_0xb0ff('0x4f')]){_0x159acd[_0xb0ff('0x4f')](_0x5b16ae[_0xb0ff('0x4f')]);}}_0x1e8070[_0xb0ff('0x51')](_0x35f8ad);if(_0x5b16ae[_0xb0ff('0x52')]){_0x5b16ae['order'][_0xb0ff('0x1c')](function(_0x13e804){_0x159acd['order']('c.'+_0x13e804[0x0],_0x13e804[0x1]==='DESC'?![]:!![]);_0x1e8070[_0xb0ff('0x52')](_0xb0ff('0x53')+_0x13e804[0x0],_0x13e804[0x1]===_0xb0ff('0x54')?![]:!![]);});}_0x1e8070[_0xb0ff('0x9')](_0x159acd,_0xb0ff('0xc'));return _0x1e8070;}function getFilteredContacts(_0x57c03f){var _0x3ecfcf=[];return db[_0xb0ff('0x36')][_0xb0ff('0x55')]({'attributes':['id',_0xb0ff('0x2d'),_0xb0ff('0x56')],'raw':!![]})['then'](function(_0x37de26){_0x3ecfcf=_['keyBy'](_0x37de26,'id');var _0x328c20={'type':db['Sequelize'][_0xb0ff('0x57')][_0xb0ff('0x58')],'model':db[_0xb0ff('0x59')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb0ff('0x5a')][_0xb0ff('0x5b')](_0x57c03f[_0xb0ff('0x5c')](),_0x328c20);})['then'](function(_0x8d9445){_0x8d9445['forEach'](function(_0x6fdc16){if(_0x6fdc16[_0xb0ff('0x19')]){_0x6fdc16['Tags']=[];_0x6fdc16[_0xb0ff('0x19')][_0xb0ff('0x23')](',')[_0xb0ff('0x1c')](function(_0x31cb0a){_0x6fdc16['Tags'][_0xb0ff('0x1b')](_0x3ecfcf[_0x31cb0a]);});}delete _0x6fdc16[_0xb0ff('0x19')];});return _0x8d9445;});}function countFilteredContacts(_0x27b325,_0x42f649){var _0x2376f5=_0x27b325[_0xb0ff('0x5d')]();_0x2376f5[_0xb0ff('0x1d')](_0xb0ff('0x5e'));_0x2376f5=applyJoinClauses(_0x2376f5,!![]);_0x27b325[_0xb0ff('0x4c')](_0xb0ff('0x4d'));var _0x445321=utils[_0xb0ff('0x20')](_0x42f649);if(!_[_0xb0ff('0x5f')](_0x445321)){_0x2376f5[_0xb0ff('0xa')](_0xb0ff('0x60'),_0x445321);}var _0x538733={'type':db[_0xb0ff('0x61')][_0xb0ff('0x57')][_0xb0ff('0x58')],'raw':!![]};return db['sequelize']['query'](_0x2376f5['toString'](),_0x538733)[_0xb0ff('0x45')](function(_0x5ed57b){return _0x5ed57b[0x0]['COUNT(*)'];});}module[_0xb0ff('0x62')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x81f0=['DESC','subqry.','from','findAll','color','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','group','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','toString','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','mobile','fax','email','createdAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','sqlOperator','conditions','name','dateOfBirth','fieldType','castTo','buildExpression','type','default','text','value','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','skip','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','tag','resolve','c.ListId\x20IN\x20?','attributes','select','c.id','limit','offset','subqry.id','having','order'];(function(_0x2de4e8,_0x3de149){var _0x261241=function(_0x33b3c4){while(--_0x33b3c4){_0x2de4e8['push'](_0x2de4e8['shift']());}};_0x261241(++_0x3de149);}(_0x81f0,0x7f));var _0x081f=function(_0x25f6e6,_0x3bb4f2){_0x25f6e6=_0x25f6e6-0x0;var _0x1b1564=_0x81f0[_0x25f6e6];return _0x1b1564;};'use strict';var _=require(_0x081f('0x0'));var squel=require(_0x081f('0x1'));var as=require(_0x081f('0x2'));var qs=require(_0x081f('0x3'));var utils=require(_0x081f('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x44d3ba,_0x46ac9e){var _0xd0b4d9=![];if(_0x44d3ba[_0x081f('0x5')]===_0x081f('0x6')&&!_0x46ac9e[_0x081f('0x7')]&&!_0x46ac9e[_0x081f('0x8')]&&_0x46ac9e[_0x081f('0x9')]!==_0x081f('0xa')){_0xd0b4d9=!![];}return _0xd0b4d9;}function getContactsSubquery(){return squel['select']()['from'](_0x081f('0xb'),'c')[_0x081f('0xc')](_0x081f('0xd'));}function applyJoinClauses(_0xc3494,_0x10d0f7){var _0x35395c=_0x10d0f7?'c':_0x081f('0xe');_0xc3494[_0x081f('0xf')](_0x081f('0x10'),'uc',_0x081f('0x11')+_0x35395c+_0x081f('0x12'))[_0x081f('0xf')](_0x081f('0x13'),'ct',_0x081f('0x14')+_0x35395c+'.id')[_0x081f('0xf')](_0x081f('0x15'),'t',_0x081f('0x16'));return _0xc3494;}function addFieldsToQuery(_0xd166dd,_0x1c4133,_0x50aae6,_0x5a0d4b,_0x1c3c13){var _0x5b2896=_0x1c3c13?'c':_0x081f('0xe');if(!_0x1c4133){_0x1c4133=['id','firstName',_0x081f('0x17'),'phone',_0x081f('0x18'),_0x081f('0x19'),_0x081f('0x1a'),_0x081f('0x8'),'CompanyId',_0x081f('0x1b'),'updatedAt',_0x081f('0x1c'),_0x081f('0x1d')];}else if(!_0x1c4133['includes']('id')){_0x1c4133[_0x081f('0x1e')]('id');}var _0x246755=_0x50aae6&&_0x1c3c13||!_0x50aae6&&!_0x1c3c13;if(_0x5a0d4b){_0x246755=_0x5a0d4b&&_0x1c3c13||!_0x5a0d4b&&!_0x1c3c13;}_0x1c4133[_0x081f('0x1f')](function(_0x3d331f){if(_0x3d331f===_0x081f('0x1d')){if(_0x246755){_0xd166dd[_0x081f('0x20')](_0x081f('0x21'),_0x3d331f);}else if(_0x50aae6||_0x5a0d4b){_0xd166dd[_0x081f('0x20')](_0x5b2896+'.'+_0x3d331f);}}else{_0xd166dd[_0x081f('0x20')](_0x5b2896+'.'+_0x3d331f);}});return _0xd166dd;}function getSqlClauses(){var _0x1377a2={'default':squel['expr'](),'fields':squel[_0x081f('0x22')](),'filter':squel[_0x081f('0x22')](),'tags':{'clause':squel[_0x081f('0x22')](),'ids':null},'user':{'clause':squel[_0x081f('0x22')](),'skip':![]}};return _0x1377a2;}function parseTagParameter(_0x552452){var _0x48b5e4=squel[_0x081f('0x22')]();if(_0x552452){var _0x53dd57=utils['getSelectedTags'](_0x552452);_0x53dd57['forEach'](function(_0x49784c){_0x48b5e4['or'](_0x081f('0x23'),'%,'+_0x49784c+',%');});}return _0x48b5e4;}function parseSearchFilter(_0x5b9706){var _0x3151c8=squel['expr']();if(_0x5b9706){var _0x1043ee=_0x5b9706[_0x081f('0x24')]('\x5c','\x5c\x5c')[_0x081f('0x24')](/'/g,'\x27\x27');if(_0x1043ee[_0x081f('0x25')]('\x20')[_0x081f('0x26')]>0x1){_0x3151c8['or'](_0x081f('0x27'),qs[_0x081f('0x28')](_0x1043ee),null);}else{if(qs['isNumeric'](_0x1043ee)){_0x3151c8['or'](_0x081f('0x29'),_0x1043ee+'%');_0x3151c8['or'](_0x081f('0x2a'),_0x1043ee+'%');_0x3151c8['or'](_0x081f('0x2b'),_0x1043ee+'%');_0x3151c8['or'](_0x081f('0x2c'),_0x1043ee+'%');}else if(qs[_0x081f('0x2d')](_0x1043ee)){_0x3151c8['or'](_0x081f('0x2e'),_0x1043ee+'%');}else{_0x3151c8['or']('c.firstName\x20LIKE\x20?','%'+_0x1043ee+'%');_0x3151c8['or']('c.lastName\x20LIKE\x20?','%'+_0x1043ee+'%');_0x3151c8['or']('c.email\x20LIKE\x20?','%'+_0x1043ee+'%');}}}return _0x3151c8;}function parseAdvancedSearchFilter(_0x10d331,_0x165e6c){var _0x1742ac=getSqlClauses();var _0x2b6609=as['parseSearch'](_0x10d331);var _0x3356e4=_0x2b6609[_0x081f('0x2f')];for(var _0x4af89c=0x0;_0x4af89c<_0x2b6609[_0x081f('0x30')][_0x081f('0x26')];_0x4af89c++){var _0x22d304=_0x2b6609[_0x081f('0x30')][_0x4af89c];var _0x2e3b1e='c';var _0x269171=_['find'](_0x165e6c,[_0x081f('0x31'),_0x22d304[_0x081f('0x20')]]);if(_0x269171){if(_0x22d304[_0x081f('0x20')]===_0x081f('0x32')||_0x269171[_0x081f('0x33')]==='datetime'){_0x22d304[_0x081f('0x34')]='DATE';}var _0x17c908=as[_0x081f('0x35')](_0x2e3b1e,_0x269171[_0x081f('0x36')],_0x22d304);_0x1742ac[_0x081f('0x37')][_0x3356e4](_0x17c908[_0x081f('0x38')],_0x17c908[_0x081f('0x39')]['start'],_0x17c908[_0x081f('0x39')][_0x081f('0x3a')]);}else{if(_0x22d304[_0x081f('0x20')]===_0x081f('0x3b')){var _0x1309c8=_0x22d304['value']['split'](',')[_0x081f('0x3c')](function(_0x54dcee){return Number(_0x54dcee);});var _0x4f7b41=parseTagParameter(_0x1309c8);_0x1742ac[_0x081f('0x3d')][_0x081f('0x3e')][_0x081f('0x3f')](_0x4f7b41);_0x1742ac['tags'][_0x081f('0x40')]=_0x1309c8;}else if(_0x22d304[_0x081f('0x20')]===_0x081f('0x41')){_0x1742ac['user'][_0x081f('0x3e')][_0x081f('0x3f')](_0x081f('0x42'),_0x22d304[_0x081f('0x39')]);_0x1742ac[_0x081f('0x43')][_0x081f('0x44')]=!![];}}}return _0x1742ac;}function parseModelFields(_0xaeb401,_0x4fc04d){var _0x1cc66b=squel['expr']();var _0x24d5dd=_(_0xaeb401)['keys']()[_0x081f('0x3c')](function(_0x21e023){return _[_0x081f('0x45')](_0x4fc04d,[_0x081f('0x31'),_0x21e023])?_0x21e023:undefined;})[_0x081f('0x46')]()[_0x081f('0x39')]();if(_0xaeb401[_0x081f('0x47')]){_0x24d5dd[_0x081f('0x1e')]('Contact');}if(_0x24d5dd[_0x081f('0x26')]>0x0){_0x24d5dd[_0x081f('0x1f')](function(_0xbc0fb8){if(_0xbc0fb8===_0x081f('0x8')){_0x1cc66b['and']('c.ListId\x20IN\x20?',[][_0x081f('0x48')](_0xaeb401[_0xbc0fb8]));}else if(_0xbc0fb8==='Contact'){var _0x5514e6='%'+_0xaeb401[_0xbc0fb8]+'%';_0x1cc66b['and'](_0x081f('0x49'),_0x5514e6);}else{_0x1cc66b[_0x081f('0x3f')]('c.'+_0xbc0fb8+_0x081f('0x4a'),_0xaeb401[_0xbc0fb8]);}});}return _0x1cc66b;}function parseQueryParameters(_0x233779,_0x48c8a5){var _0x271dd2=getSqlClauses();return Promise['resolve']()[_0x081f('0x4b')](function(){return parseModelFields(_0x233779,_0x48c8a5);})[_0x081f('0x4b')](function(_0x47484f){_0x271dd2['fields']['and'](_0x47484f);return parseTagParameter(_0x233779[_0x081f('0x4c')]);})['then'](function(_0xdadf17){_0x271dd2['tags'][_0x081f('0x3e')][_0x081f('0x3f')](_0xdadf17);return parseSearchFilter(_0x233779['filter']);})['then'](function(_0x3af49f){_0x271dd2['filter']=_0x3af49f;return _0x271dd2;});}function checkListsRestrictions(_0x691fc4,_0x11b7cf,_0x161045){var _0x3af71b=squel['expr']();return Promise[_0x081f('0x4d')]()[_0x081f('0x4b')](function(){if(_0x11b7cf[_0x081f('0x7')]&&_0x691fc4['role']===_0x081f('0x6')&&!_0x161045){return _0x691fc4['getLists']({'attributes':['id'],'raw':!![]});}})[_0x081f('0x4b')](function(_0x7fb244){if(_0x7fb244){if(_0x7fb244[_0x081f('0x26')]===0x0){_0x3af71b[_0x081f('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x3af71b[_0x081f('0x3f')](_0x081f('0x4e'),_[_0x081f('0x3c')](_0x7fb244,'id'));}}})[_0x081f('0x4b')](function(){return _0x3af71b;});}function buildContactsQuery(_0x40ee5e,_0x551e36,_0x3eb9a2,_0x434083,_0x53c43f,_0xf1fcf6){if(_0x551e36){_0x551e36=_0x3eb9a2[_0x081f('0x4f')];}_0x40ee5e=addFieldsToQuery(_0x40ee5e,_0x551e36,_0x434083,_0xf1fcf6,!![]);var _0x16c13f=squel[_0x081f('0x50')]();_0x16c13f=addFieldsToQuery(_0x16c13f,_0x551e36,_0x434083,_0xf1fcf6,![]);if(_0x434083||_0xf1fcf6){_0x40ee5e=applyJoinClauses(_0x40ee5e,!![]);_0x40ee5e['group'](_0x081f('0x51'));if(_0x3eb9a2[_0x081f('0x52')]){_0x16c13f['limit'](_0x3eb9a2['limit']);}if(_0x3eb9a2[_0x081f('0x53')]){_0x16c13f[_0x081f('0x53')](_0x3eb9a2[_0x081f('0x53')]);}}else{_0x16c13f=applyJoinClauses(_0x16c13f,![]);_0x16c13f['group'](_0x081f('0x54'));if(_0x3eb9a2[_0x081f('0x52')]){_0x40ee5e[_0x081f('0x52')](_0x3eb9a2[_0x081f('0x52')]);}if(_0x3eb9a2[_0x081f('0x53')]){_0x40ee5e[_0x081f('0x53')](_0x3eb9a2[_0x081f('0x53')]);}}_0x16c13f[_0x081f('0x55')](_0x53c43f);if(_0x3eb9a2[_0x081f('0x56')]){_0x3eb9a2['order'][_0x081f('0x1f')](function(_0x324554){_0x40ee5e[_0x081f('0x56')]('c.'+_0x324554[0x0],_0x324554[0x1]===_0x081f('0x57')?![]:!![]);_0x16c13f[_0x081f('0x56')](_0x081f('0x58')+_0x324554[0x0],_0x324554[0x1]===_0x081f('0x57')?![]:!![]);});}_0x16c13f[_0x081f('0x59')](_0x40ee5e,_0x081f('0xe'));return _0x16c13f;}function getFilteredContacts(_0x2f8202){var _0x309e91=[];return db['Tag'][_0x081f('0x5a')]({'attributes':['id',_0x081f('0x31'),_0x081f('0x5b')],'raw':!![]})['then'](function(_0x4625cb){_0x309e91=_['keyBy'](_0x4625cb,'id');var _0xc21a31={'type':db['Sequelize']['QueryTypes'][_0x081f('0x5c')],'model':db[_0x081f('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x081f('0x5e')][_0x081f('0x5f')](_0x2f8202['toString'](),_0xc21a31);})['then'](function(_0x343ba7){_0x343ba7['forEach'](function(_0x202332){if(_0x202332[_0x081f('0x1d')]){_0x202332[_0x081f('0x60')]=[];_0x202332[_0x081f('0x1d')][_0x081f('0x25')](',')['forEach'](function(_0x26db49){_0x202332[_0x081f('0x60')]['push'](_0x309e91[_0x26db49]);});}delete _0x202332[_0x081f('0x1d')];});return _0x343ba7;});}function countFilteredContacts(_0x16fe83,_0x87ce59){var _0x38daa7=_0x16fe83[_0x081f('0x61')]();_0x38daa7[_0x081f('0x20')](_0x081f('0x62'));_0x38daa7=applyJoinClauses(_0x38daa7,!![]);_0x16fe83[_0x081f('0x63')]('c.id');var _0x51bc44=utils[_0x081f('0x64')](_0x87ce59);if(!_[_0x081f('0x65')](_0x51bc44)){_0x38daa7[_0x081f('0xc')](_0x081f('0x66'),_0x51bc44);}var _0x451d71={'type':db[_0x081f('0x67')][_0x081f('0x68')][_0x081f('0x5c')],'raw':!![]};return db['sequelize'][_0x081f('0x5f')](_0x38daa7[_0x081f('0x69')](),_0x451d71)[_0x081f('0x4b')](function(_0x41a3e4){return _0x41a3e4[0x0][_0x081f('0x62')];});}module[_0x081f('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5e7256d..f95454a 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 _0x570d=['secrets','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString','base64','decryptString','secret','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x570d,0xae));var _0xd570=function(_0x27472b,_0x1e5ca1){_0x27472b=_0x27472b-0x0;var _0x249243=_0x570d[_0x27472b];return _0x249243;};'use strict';var crypto=require(_0xd570('0x0'));var fs=require('fs');var BPromise=require(_0xd570('0x1'));var _=require(_0xd570('0x2'));var config=require(_0xd570('0x3'));var logger=require(_0xd570('0x4'))(_0xd570('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xd570('0x6')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xd570('0x7')};if(config[_0xd570('0x8')]&&config[_0xd570('0x8')][_0xd570('0x9')]){var isSupported=isAlgorithmSupported(config[_0xd570('0x8')][_0xd570('0x9')]);if(isSupported){fileOptions[_0xd570('0x9')]=config[_0xd570('0x8')][_0xd570('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xd570('0xa')](',\x20');logger[_0xd570('0xb')](config[_0xd570('0x8')]['algorithm'],_0xd570('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0xc726f7){return AES_SUPPORTED_RX[_0xd570('0xd')](_0xc726f7);}function getSupportedCiphers(){return crypto[_0xd570('0xe')]()[_0xd570('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x5254d9){return getSupportedCiphers()[_0xd570('0x10')](_0x5254d9)>-0x1;}function combineOptions(_0x233708){var _0x524a61={};for(var _0x2580f5 in fileOptions){if(fileOptions[_0xd570('0x11')](_0x2580f5)){_0x524a61[_0x2580f5]=fileOptions[_0x2580f5];}}if(_0x233708){for(var _0xc11aa8 in _0x233708){if(_0x233708[_0xd570('0x11')](_0xc11aa8)){_0x524a61[_0xc11aa8]=_0x233708[_0xc11aa8];}}}return _0x524a61;}exports[_0xd570('0x12')]=function(_0x2ed61b,_0x2b8870,_0x41d9fe,_0x379b22){return new BPromise(function(_0x1144f5,_0x2acbc2){_0x379b22=combineOptions(_0x379b22);var _0x7ceec0=new Buffer(_0x41d9fe);var _0x4adeb8=fs['createReadStream'](_0x2ed61b);var _0x5ee2d3=fs[_0xd570('0x13')](_0x2b8870);var _0x203fa7=crypto[_0xd570('0x14')](_0x379b22[_0xd570('0x9')],_0x7ceec0);_0x4adeb8['on'](_0xd570('0x15'),function(_0x177ac9){var _0x2a7b0e=new Buffer(_0x203fa7[_0xd570('0x16')](_0x177ac9),_0xd570('0x17'));_0x5ee2d3[_0xd570('0x18')](_0x2a7b0e);});_0x4adeb8['on'](_0xd570('0x19'),function(){try{var _0x3fa126=new Buffer(_0x203fa7[_0xd570('0x1a')](_0xd570('0x17')),_0xd570('0x17'));_0x5ee2d3[_0xd570('0x18')](_0x3fa126);_0x5ee2d3['end']();_0x5ee2d3['on'](_0xd570('0x1b'),function(){return _0x1144f5(_0x2b8870);});}catch(_0x4740df){fs[_0xd570('0x1c')](_0x2b8870);return _0x2acbc2(_0x4740df);}});});};exports[_0xd570('0x1d')]=function(_0x56bbfb,_0x289745,_0x23b17b,_0x5c2825){return new BPromise(function(_0x51edcf,_0x49adbc){_0x5c2825=combineOptions(_0x5c2825);var _0x375480=new Buffer(_0x23b17b);var _0x33c533=fs['createReadStream'](_0x56bbfb);var _0x37346e=fs['createWriteStream'](_0x289745);var _0x1ce469=crypto[_0xd570('0x1e')](_0x5c2825['algorithm'],_0x375480);_0x33c533['on'](_0xd570('0x15'),function(_0x3ec051){var _0x2a186a=new Buffer(_0x1ce469[_0xd570('0x16')](_0x3ec051),_0xd570('0x17'));_0x37346e[_0xd570('0x18')](_0x2a186a);});_0x33c533['on'](_0xd570('0x19'),function(){try{var _0x453eb7=new Buffer(_0x1ce469[_0xd570('0x1a')](_0xd570('0x17')),_0xd570('0x17'));_0x37346e[_0xd570('0x18')](_0x453eb7);_0x37346e[_0xd570('0x19')]();_0x37346e['on'](_0xd570('0x1b'),function(){return _0x51edcf(_0x289745);});}catch(_0x286e85){fs['unlink'](_0x289745);return _0x49adbc(_0x286e85);}});});};exports[_0xd570('0x1f')]=function(_0x1f3889,_0x3181a5,_0x3f56f0){var _0x495366=_0x3f56f0||stringOptions[_0xd570('0x9')];var _0x50d78c=_0x3181a5||stringOptions['secret'];var _0x4ac5c2=crypto[_0xd570('0x14')](_0x495366,_0x50d78c);var _0x37900b=_0x4ac5c2[_0xd570('0x16')](_0x1f3889,'utf8',_0xd570('0x20'));_0x37900b+=_0x4ac5c2[_0xd570('0x1a')](_0xd570('0x20'));return _0x37900b;};exports[_0xd570('0x21')]=function(_0x19d8ba,_0x12a962,_0x351648){var _0x36efd0=_0x351648||stringOptions[_0xd570('0x9')];var _0x2c73fa=_0x12a962||stringOptions[_0xd570('0x22')];var _0x31d2de=crypto[_0xd570('0x1e')](_0x36efd0,_0x2c73fa);var _0x583a51=_0x31d2de[_0xd570('0x16')](_0x19d8ba,_0xd570('0x20'),_0xd570('0x23'));_0x583a51+=_0x31d2de[_0xd570('0x1a')](_0xd570('0x23'));return _0x583a51;}; \ No newline at end of file +var _0xee11=['decryptString','createDecipher','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','algorithm','encrypt','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','binary','write','end','final','close','unlink','decryptFile','createReadStream','data','encryptString','secret','createCipher','update','utf8','base64'];(function(_0x5f5be8,_0x56cc02){var _0x5a9a36=function(_0x3434d9){while(--_0x3434d9){_0x5f5be8['push'](_0x5f5be8['shift']());}};_0x5a9a36(++_0x56cc02);}(_0xee11,0x158));var _0x1ee1=function(_0x4359fa,_0x4d5f23){_0x4359fa=_0x4359fa-0x0;var _0x3df26d=_0xee11[_0x4359fa];return _0x3df26d;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x1ee1('0x0'));var _=require(_0x1ee1('0x1'));var config=require(_0x1ee1('0x2'));var logger=require(_0x1ee1('0x3'))(_0x1ee1('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1ee1('0x5')][_0x1ee1('0x6')],'algorithm':_0x1ee1('0x7')};const fileOptions={'algorithm':_0x1ee1('0x8')};if(config['encrypt']&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x1ee1('0x9')]);if(isSupported){fileOptions[_0x1ee1('0x9')]=config[_0x1ee1('0xa')][_0x1ee1('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1ee1('0xb')](',\x20');logger[_0x1ee1('0xc')](config['encrypt']['algorithm'],_0x1ee1('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x55c023){return AES_SUPPORTED_RX[_0x1ee1('0xe')](_0x55c023);}function getSupportedCiphers(){return crypto[_0x1ee1('0xf')]()[_0x1ee1('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x1c511a){return getSupportedCiphers()[_0x1ee1('0x11')](_0x1c511a)>-0x1;}function combineOptions(_0x4fd131){var _0x1be29e={};for(var _0x321578 in fileOptions){if(fileOptions[_0x1ee1('0x12')](_0x321578)){_0x1be29e[_0x321578]=fileOptions[_0x321578];}}if(_0x4fd131){for(var _0xd8eeb8 in _0x4fd131){if(_0x4fd131[_0x1ee1('0x12')](_0xd8eeb8)){_0x1be29e[_0xd8eeb8]=_0x4fd131[_0xd8eeb8];}}}return _0x1be29e;}exports[_0x1ee1('0x13')]=function(_0xee418b,_0x5ddc61,_0x4ca0fa,_0x2058a1){return new BPromise(function(_0x38fc5a,_0x331e51){_0x2058a1=combineOptions(_0x2058a1);var _0x58a0fa=new Buffer(_0x4ca0fa);var _0x5e1326=fs['createReadStream'](_0xee418b);var _0x1f4a89=fs[_0x1ee1('0x14')](_0x5ddc61);var _0x3cb6ec=crypto['createCipher'](_0x2058a1[_0x1ee1('0x9')],_0x58a0fa);_0x5e1326['on']('data',function(_0x47d025){var _0x291e21=new Buffer(_0x3cb6ec['update'](_0x47d025),_0x1ee1('0x15'));_0x1f4a89[_0x1ee1('0x16')](_0x291e21);});_0x5e1326['on'](_0x1ee1('0x17'),function(){try{var _0x244220=new Buffer(_0x3cb6ec[_0x1ee1('0x18')](_0x1ee1('0x15')),_0x1ee1('0x15'));_0x1f4a89[_0x1ee1('0x16')](_0x244220);_0x1f4a89[_0x1ee1('0x17')]();_0x1f4a89['on'](_0x1ee1('0x19'),function(){return _0x38fc5a(_0x5ddc61);});}catch(_0x37a5bd){fs[_0x1ee1('0x1a')](_0x5ddc61);return _0x331e51(_0x37a5bd);}});});};exports[_0x1ee1('0x1b')]=function(_0x401238,_0x562435,_0x3e62b5,_0x9541f0){return new BPromise(function(_0x221aa4,_0x5f0545){_0x9541f0=combineOptions(_0x9541f0);var _0x364308=new Buffer(_0x3e62b5);var _0x4eefe9=fs[_0x1ee1('0x1c')](_0x401238);var _0x17a489=fs[_0x1ee1('0x14')](_0x562435);var _0x5b2eb8=crypto['createDecipher'](_0x9541f0[_0x1ee1('0x9')],_0x364308);_0x4eefe9['on'](_0x1ee1('0x1d'),function(_0x589775){var _0x570467=new Buffer(_0x5b2eb8['update'](_0x589775),_0x1ee1('0x15'));_0x17a489[_0x1ee1('0x16')](_0x570467);});_0x4eefe9['on'](_0x1ee1('0x17'),function(){try{var _0x1746f1=new Buffer(_0x5b2eb8['final'](_0x1ee1('0x15')),_0x1ee1('0x15'));_0x17a489['write'](_0x1746f1);_0x17a489[_0x1ee1('0x17')]();_0x17a489['on'](_0x1ee1('0x19'),function(){return _0x221aa4(_0x562435);});}catch(_0x4fd4ae){fs[_0x1ee1('0x1a')](_0x562435);return _0x5f0545(_0x4fd4ae);}});});};exports[_0x1ee1('0x1e')]=function(_0x5f2116,_0x50a7d1,_0x5bbc8a){var _0x2b6e34=_0x5bbc8a||stringOptions['algorithm'];var _0x73c1a7=_0x50a7d1||stringOptions[_0x1ee1('0x1f')];var _0x3717bf=crypto[_0x1ee1('0x20')](_0x2b6e34,_0x73c1a7);var _0x34ed3d=_0x3717bf[_0x1ee1('0x21')](_0x5f2116,_0x1ee1('0x22'),'base64');_0x34ed3d+=_0x3717bf['final'](_0x1ee1('0x23'));return _0x34ed3d;};exports[_0x1ee1('0x24')]=function(_0x7d1284,_0x46d1a1,_0x3ccd2f){var _0x1e7d93=_0x3ccd2f||stringOptions[_0x1ee1('0x9')];var _0x52e633=_0x46d1a1||stringOptions['secret'];var _0x1ad147=crypto[_0x1ee1('0x25')](_0x1e7d93,_0x52e633);var _0x10b3cf=_0x1ad147[_0x1ee1('0x21')](_0x7d1284,'base64',_0x1ee1('0x22'));_0x10b3cf+=_0x1ad147[_0x1ee1('0x18')](_0x1ee1('0x22'));return _0x10b3cf;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d645404..53c635a 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 _0x17e8=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','exit','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv'];(function(_0x4fe496,_0x1d8673){var _0x422b24=function(_0x27a644){while(--_0x27a644){_0x4fe496['push'](_0x4fe496['shift']());}};_0x422b24(++_0x1d8673);}(_0x17e8,0x144));var _0x817e=function(_0x4036d1,_0x16abf0){_0x4036d1=_0x4036d1-0x0;var _0x329ce0=_0x17e8[_0x4036d1];return _0x329ce0;};'use strict';var util=require('util');var path=require(_0x817e('0x0'));var _=require('lodash');var csv=require(_0x817e('0x1'));var fs=require('fs');var BPromise=require(_0x817e('0x2'));var zipdir=require(_0x817e('0x3'));var rimraf=require(_0x817e('0x4'));var db=require(_0x817e('0x5'))['db'];var dbH=require(_0x817e('0x5'))[_0x817e('0x6')];var logger=require(_0x817e('0x7'))(_0x817e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x817e('0x9')][0x2]);var QUERY=process[_0x817e('0x9')][0x3];var PATH=process[_0x817e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x468bcd,_0xbaa68d){var _0x5af172={'status':_0x468bcd};var _0x536f3d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xbaa68d){_0x5af172[_0x817e('0xa')]=_0xbaa68d;}return db[_0x817e('0xb')][_0x817e('0xc')](_0x5af172,_0x536f3d);}function main(){var _0x35e45c=0x1388;var _0x51701f;logger['info'](util[_0x817e('0xd')](_0x817e('0xe'),EXTRACTED_REPORT_ID,_0x817e('0xf')));return db[_0x817e('0x10')][_0x817e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x817e('0x12')]})['then'](function(_0x74cbff){if(_0x74cbff){_0x51701f=_0x74cbff;_0x35e45c=_0x51701f['splitSizeCsv']||0x1388;}})[_0x817e('0x13')](function(){return dbH[_0x817e('0x14')][_0x817e('0x15')](util['format'](_0x817e('0x16'),QUERY),{'type':dbH[_0x817e('0x14')][_0x817e('0x17')]['SELECT']});})['then'](function(_0xfd6541){if(!_0xfd6541[0x0][_0x817e('0x18')]){return analyticExtractedReport(_0x817e('0x19'));}var _0x1d02ca=[];var _0x53cedb=0x0;if(_0x51701f[_0x817e('0x1a')]){if(_0xfd6541&&_0xfd6541[_0x817e('0x1b')]){var _0x21e729=_[_0x817e('0x1c')](_0xfd6541[0x0]['num']/_0x35e45c);var _0x46b0d6=Number[_0x817e('0x1d')](_0xfd6541[0x0][_0x817e('0x18')]/_0x35e45c)?_0xfd6541[0x0][_0x817e('0x18')]%_0x35e45c:0x0;_0x21e729[_0x817e('0x1e')](function(_0x34ecda){if(_0x34ecda>0x0){_0x53cedb+=_0x35e45c;}_0x1d02ca[_0x817e('0x1f')](dbH[_0x817e('0x14')][_0x817e('0x15')](util[_0x817e('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x35e45c,_0x53cedb),{'type':dbH[_0x817e('0x14')]['QueryTypes']['SELECT']}));});if(_0x46b0d6>0x0){_0x53cedb+=_0x35e45c;_0x1d02ca[_0x817e('0x1f')](dbH['sequelize']['query'](util[_0x817e('0xd')](_0x817e('0x20'),QUERY,_0x46b0d6,_0x53cedb),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x1d02ca[_0x817e('0x1f')](dbH[_0x817e('0x14')][_0x817e('0x15')](QUERY,{'type':dbH[_0x817e('0x14')][_0x817e('0x17')][_0x817e('0x21')]}));}var _0x321627=path[_0x817e('0x22')](PATH);var _0x4d88e9=path[_0x817e('0x23')](PATH,_0x817e('0x24'));var _0x2fbbb6=_0x51701f[_0x817e('0x1a')]&&_0x1d02ca[_0x817e('0x1b')]>0x1;var _0xa2a3be=[];if(!fs['existsSync'](path['join'](_0x321627,_0x4d88e9))&&_0x2fbbb6){fs[_0x817e('0x25')](path[_0x817e('0x26')](_0x321627,_0x4d88e9));}return BPromise[_0x817e('0x27')](_0x1d02ca,function(_0x54123e){_0xa2a3be[_0x817e('0x1f')](_0x54123e);})['then'](function(){for(var _0x2be77b=0x0;_0x2be77b<_0xa2a3be['length'];_0x2be77b+=0x1){var _0x17d6ea;var _0x512b10=_0xa2a3be[_0x2be77b];if(_0x2fbbb6){_0x17d6ea=path[_0x817e('0x26')](_0x321627,_0x4d88e9,util[_0x817e('0xd')]('%s%d.%s',_0x4d88e9,_0x2be77b,_0x817e('0x28')));}else{_0x17d6ea=path[_0x817e('0x26')](_0x321627,util[_0x817e('0xd')](_0x817e('0x29'),_0x4d88e9,_0x817e('0x28')));}fs[_0x817e('0x2a')](_0x17d6ea,csv(_0x512b10));}})[_0x817e('0x13')](function(){if(_0x2fbbb6){return new Promise(function(_0x494214){zipdir(path[_0x817e('0x26')](_0x321627,_0x4d88e9),{'saveTo':path[_0x817e('0x26')](_0x321627,util[_0x817e('0xd')](_0x817e('0x29'),_0x4d88e9,_0x817e('0x2b')))},function(_0x395db8,_0x21bd51){rimraf(path[_0x817e('0x26')](_0x321627,_0x4d88e9),function(){});_0x494214('zip\x20finished');});});}})[_0x817e('0x13')](function(){logger[_0x817e('0x2c')](util['format'](_0x817e('0x2d'),EXTRACTED_REPORT_ID,_0x817e('0xf')));return analyticExtractedReport(_0x817e('0x2e'),_0x2fbbb6?util['format']('%s.%s',_0x4d88e9,_0x2fbbb6?_0x817e('0x2b'):_0x817e('0x28')):null);});})['catch'](function(_0x46c32a){logger[_0x817e('0x2c')](util[_0x817e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x817e('0xf')),util[_0x817e('0x2f')](_0x46c32a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x817e('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5cc8=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','sequelize','query','QueryTypes','SELECT','then','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update'];(function(_0x204107,_0x443905){var _0x17bd7f=function(_0x36838e){while(--_0x36838e){_0x204107['push'](_0x204107['shift']());}};_0x17bd7f(++_0x443905);}(_0x5cc8,0x90));var _0x85cc=function(_0x13d6e1,_0x46c1ae){_0x13d6e1=_0x13d6e1-0x0;var _0x46417b=_0x5cc8[_0x13d6e1];return _0x46417b;};'use strict';var util=require('util');var path=require('path');var _=require(_0x85cc('0x0'));var csv=require(_0x85cc('0x1'));var fs=require('fs');var BPromise=require(_0x85cc('0x2'));var zipdir=require(_0x85cc('0x3'));var rimraf=require(_0x85cc('0x4'));var db=require(_0x85cc('0x5'))['db'];var dbH=require(_0x85cc('0x5'))[_0x85cc('0x6')];var logger=require(_0x85cc('0x7'))(_0x85cc('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x85cc('0x9')][0x2]);var QUERY=process[_0x85cc('0x9')][0x3];var PATH=process[_0x85cc('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3baf7f,_0x16f7b2){var _0x5e6c43={'status':_0x3baf7f};var _0x301bfc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16f7b2){_0x5e6c43['savename']=_0x16f7b2;}return db[_0x85cc('0xa')][_0x85cc('0xb')](_0x5e6c43,_0x301bfc);}function main(){var _0x37be8f=0x1388;var _0x103d08;logger[_0x85cc('0xc')](util[_0x85cc('0xd')](_0x85cc('0xe'),EXTRACTED_REPORT_ID,_0x85cc('0xf')));return db[_0x85cc('0x10')][_0x85cc('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x85cc('0x12'),'splitSizeCsv']})['then'](function(_0x166238){if(_0x166238){_0x103d08=_0x166238;_0x37be8f=_0x103d08[_0x85cc('0x13')]||0x1388;}})['then'](function(){return dbH[_0x85cc('0x14')][_0x85cc('0x15')](util[_0x85cc('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x85cc('0x14')][_0x85cc('0x16')][_0x85cc('0x17')]});})[_0x85cc('0x18')](function(_0x4947b0){if(!_0x4947b0[0x0]['num']){return analyticExtractedReport(_0x85cc('0x19'));}var _0xda7b7d=[];var _0x2b7bee=0x0;if(_0x103d08[_0x85cc('0x12')]){if(_0x4947b0&&_0x4947b0['length']){var _0x10eade=_[_0x85cc('0x1a')](_0x4947b0[0x0][_0x85cc('0x1b')]/_0x37be8f);var _0x394598=Number[_0x85cc('0x1c')](_0x4947b0[0x0]['num']/_0x37be8f)?_0x4947b0[0x0][_0x85cc('0x1b')]%_0x37be8f:0x0;_0x10eade[_0x85cc('0x1d')](function(_0x327b43){if(_0x327b43>0x0){_0x2b7bee+=_0x37be8f;}_0xda7b7d[_0x85cc('0x1e')](dbH[_0x85cc('0x14')][_0x85cc('0x15')](util[_0x85cc('0xd')](_0x85cc('0x1f'),QUERY,_0x37be8f,_0x2b7bee),{'type':dbH['sequelize'][_0x85cc('0x16')][_0x85cc('0x17')]}));});if(_0x394598>0x0){_0x2b7bee+=_0x37be8f;_0xda7b7d[_0x85cc('0x1e')](dbH[_0x85cc('0x14')]['query'](util[_0x85cc('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x394598,_0x2b7bee),{'type':dbH[_0x85cc('0x14')][_0x85cc('0x16')][_0x85cc('0x17')]}));}}}else{_0xda7b7d[_0x85cc('0x1e')](dbH[_0x85cc('0x14')][_0x85cc('0x15')](QUERY,{'type':dbH[_0x85cc('0x14')][_0x85cc('0x16')][_0x85cc('0x17')]}));}var _0x5a7f37=path[_0x85cc('0x20')](PATH);var _0x4ed4bd=path[_0x85cc('0x21')](PATH,_0x85cc('0x22'));var _0xc0c8d7=_0x103d08['split']&&_0xda7b7d[_0x85cc('0x23')]>0x1;var _0x2083e6=[];if(!fs['existsSync'](path[_0x85cc('0x24')](_0x5a7f37,_0x4ed4bd))&&_0xc0c8d7){fs[_0x85cc('0x25')](path[_0x85cc('0x24')](_0x5a7f37,_0x4ed4bd));}return BPromise[_0x85cc('0x26')](_0xda7b7d,function(_0x211c9f){_0x2083e6['push'](_0x211c9f);})['then'](function(){for(var _0x4d712e=0x0;_0x4d712e<_0x2083e6['length'];_0x4d712e+=0x1){var _0x49ea9d;var _0x2a65c4=_0x2083e6[_0x4d712e];if(_0xc0c8d7){_0x49ea9d=path[_0x85cc('0x24')](_0x5a7f37,_0x4ed4bd,util['format'](_0x85cc('0x27'),_0x4ed4bd,_0x4d712e,'csv'));}else{_0x49ea9d=path[_0x85cc('0x24')](_0x5a7f37,util[_0x85cc('0xd')](_0x85cc('0x28'),_0x4ed4bd,_0x85cc('0x29')));}fs[_0x85cc('0x2a')](_0x49ea9d,csv(_0x2a65c4));}})['then'](function(){if(_0xc0c8d7){return new Promise(function(_0x136ce6){zipdir(path[_0x85cc('0x24')](_0x5a7f37,_0x4ed4bd),{'saveTo':path[_0x85cc('0x24')](_0x5a7f37,util[_0x85cc('0xd')](_0x85cc('0x28'),_0x4ed4bd,'zip'))},function(_0x3d4820,_0x2f0f21){rimraf(path[_0x85cc('0x24')](_0x5a7f37,_0x4ed4bd),function(){});_0x136ce6(_0x85cc('0x2b'));});});}})['then'](function(){logger[_0x85cc('0xc')](util[_0x85cc('0xd')](_0x85cc('0x2c'),EXTRACTED_REPORT_ID,_0x85cc('0xf')));return analyticExtractedReport('Completed',_0xc0c8d7?util[_0x85cc('0xd')](_0x85cc('0x28'),_0x4ed4bd,_0xc0c8d7?_0x85cc('0x2d'):_0x85cc('0x29')):null);});})[_0x85cc('0x2e')](function(_0x3bf8bb){logger['info'](util['format'](_0x85cc('0x2f'),EXTRACTED_REPORT_ID,_0x85cc('0xf')),util[_0x85cc('0x30')](_0x3bf8bb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x85cc('0x31'));})[_0x85cc('0x32')](function(){process[_0x85cc('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 16f9d3b..85b2cb1 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 _0x16f2=['keys','forEach','format','startDate','endDate','length','header','before','\x20/\x20','footer','Arial','black','right','num','Setting','split','then','splitSizePdf','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','auto','body','push','chunk'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16f2,0x92));var _0x216f=function(_0x3a3d83,_0x419a5a){_0x3a3d83=_0x3a3d83-0x0;var _0x2b9c43=_0x16f2[_0x3a3d83];return _0x2b9c43;};'use strict';var _=require(_0x216f('0x0'));var fs=require('fs');var util=require(_0x216f('0x1'));var path=require(_0x216f('0x2'));var moment=require(_0x216f('0x3'));var htmlToPdfmake=require(_0x216f('0x4'));var PdfPrinter=require(_0x216f('0x5'));var zipdir=require(_0x216f('0x6'));var rimraf=require(_0x216f('0x7'));var JSDOM=require(_0x216f('0x8'))['JSDOM'];var window=new JSDOM('')[_0x216f('0x9')];var BPromise=require(_0x216f('0xa'));var db=require(_0x216f('0xb'))['db'];var dbH=require(_0x216f('0xb'))[_0x216f('0xc')];var logger=require('../../config/logger')(_0x216f('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x216f('0xe')][0x2]);var QUERY=process[_0x216f('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c6c5e,_0x1221cc){var _0x2bd402={'status':_0x2c6c5e};var _0x965330={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1221cc){_0x2bd402[_0x216f('0xf')]=_0x1221cc;}return db[_0x216f('0x10')][_0x216f('0x11')](_0x2bd402,_0x965330);}function getHeaders(_0x466d2f){return _['map'](_0x466d2f,function(_0x25739c){return{'text':_0x25739c,'style':_0x216f('0x12')};});}function getRows(_0x26d0f1,_0x4db451){return _[_0x216f('0x13')](_0x4db451,function(_0x52d4f1){return _(_0x52d4f1)[_0x216f('0x14')](_0x26d0f1)[_0x216f('0x13')](function(_0x26001d){return _0x26001d?_[_0x216f('0x15')](_0x26001d):'';})[_0x216f('0x16')]();});}function createTable(_0x5cfee0,_0x157c80){var _0x2c3f21={'widths':_[_0x216f('0x17')](Array(_0x5cfee0['length']),0x91),'heights':function(_0x1ddf57){return _0x1ddf57===0x0?_0x216f('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2d55ad=getHeaders(_0x5cfee0);_0x2c3f21[_0x216f('0x19')][_0x216f('0x1a')](_0x2d55ad);var _0x29cbb9=getRows(_0x5cfee0,_0x157c80);_0x2c3f21[_0x216f('0x19')]=_0x2c3f21[_0x216f('0x19')]['concat'](_0x29cbb9);return _0x2c3f21;}function createTables(_0x1f1a9f){var _0x31f462=[];var _0x26a339=_[_0x216f('0x1b')](Object[_0x216f('0x1c')](_0x1f1a9f[0x0]),0x5);_0x26a339[_0x216f('0x1d')](function(_0x1f264f){_0x31f462[_0x216f('0x1a')](createTable(_0x1f264f,_0x1f1a9f));});return _0x31f462;}function getPDFDocDefinition(_0x7af5f9){var _0x2671f6=util[_0x216f('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x216f('0x1f')])[_0x216f('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x216f('0x20')])[_0x216f('0x1e')](FORMAT));var _0x4a2a00=[];for(var _0x93db8b=0x0;_0x93db8b<_0x7af5f9[_0x216f('0x21')];_0x93db8b++){var _0x363795=[];if(_0x93db8b===0x0){_0x363795[_0x216f('0x1a')]({'text':_0x2671f6,'style':_0x216f('0x22')});}var _0x2f16ce={'table':_0x7af5f9[_0x93db8b]};if(_0x93db8b>0x0){_0x2f16ce['pageBreak']=_0x216f('0x23');_0x2f16ce['margin']=[0x0,0x46,0x0,0x0];}_0x363795['push'](_0x2f16ce);_0x4a2a00[_0x216f('0x1a')](_0x363795);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x4a2a00,'footer':function(_0x51fbf9,_0x40e718){return{'text':_0x51fbf9[_0x216f('0x15')]()+_0x216f('0x24')+_0x40e718,'style':_0x216f('0x25')};},'defaultStyle':{'font':_0x216f('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x216f('0x27')},'footer':{'alignment':_0x216f('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x116d32){var _0x3c3de1=0x1388;var _0x4a5ae7;if(!_0x116d32[0x0][_0x216f('0x29')]){return analyticExtractedReport('Empty');}return db[_0x216f('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x216f('0x2b'),'splitSizePdf']})[_0x216f('0x2c')](function(_0x58fc4b){if(_0x58fc4b){_0x4a5ae7=_0x58fc4b;_0x3c3de1=_0x4a5ae7[_0x216f('0x2d')]||0x3e8;}})[_0x216f('0x2c')](function(){var _0x550f15=[];var _0x23d7ae=0x0;if(_0x4a5ae7['split']){if(_0x116d32&&_0x116d32[_0x216f('0x21')]){var _0x4cc893=_['range'](_0x116d32[0x0][_0x216f('0x29')]/_0x3c3de1);var _0x646417=Number[_0x216f('0x2e')](_0x116d32[0x0][_0x216f('0x29')]/_0x3c3de1)?_0x116d32[0x0][_0x216f('0x29')]%_0x3c3de1:0x0;_0x4cc893[_0x216f('0x1d')](function(_0x4310d5){if(_0x4310d5>0x0){_0x23d7ae+=_0x3c3de1;}_0x550f15['push'](dbH[_0x216f('0x2f')][_0x216f('0x30')](util[_0x216f('0x1e')](_0x216f('0x31'),QUERY,_0x3c3de1,_0x23d7ae),{'type':dbH[_0x216f('0x2f')]['QueryTypes']['SELECT']}));});if(_0x646417>0x0){_0x23d7ae+=_0x3c3de1;_0x550f15[_0x216f('0x1a')](dbH[_0x216f('0x2f')][_0x216f('0x30')](util['format'](_0x216f('0x31'),QUERY,_0x646417,_0x23d7ae),{'type':dbH[_0x216f('0x2f')][_0x216f('0x32')][_0x216f('0x33')]}));}}}else{_0x550f15[_0x216f('0x1a')](dbH[_0x216f('0x2f')][_0x216f('0x30')](QUERY,{'type':dbH[_0x216f('0x2f')]['QueryTypes']['SELECT']}));}var _0x4778a4=path[_0x216f('0x34')](PATH);var _0x303e48=path[_0x216f('0x35')](PATH,'.pdf');var _0x343f38=_0x4a5ae7[_0x216f('0x2b')]&&_0x550f15[_0x216f('0x21')]>0x1;var _0x5675b3=[];if(!fs[_0x216f('0x36')](path[_0x216f('0x37')](_0x4778a4,_0x303e48))&&_0x343f38){fs[_0x216f('0x38')](path[_0x216f('0x37')](_0x4778a4,_0x303e48));}return BPromise['each'](_0x550f15,function(_0x20aa34){_0x5675b3['push'](_0x20aa34);})[_0x216f('0x2c')](function(){var _0x58fb18=[];for(var _0x20128b=0x0;_0x20128b<_0x5675b3[_0x216f('0x21')];_0x20128b+=0x1){var _0x260ef6=_0x5675b3[_0x20128b];var _0x5c6448=createTables(_[_0x216f('0x39')](_0x260ef6));var _0x1ae38a;var _0x268e4f=getPDFDocDefinition(_0x5c6448);var _0x246484=getPDFPrinter();var _0x468a53=_0x246484[_0x216f('0x3a')](_0x268e4f);if(_0x343f38){_0x1ae38a=path[_0x216f('0x37')](_0x4778a4,_0x303e48,util[_0x216f('0x1e')]('%s%d.%s',_0x303e48,_0x20128b,_0x216f('0x3b')));}else{_0x1ae38a=path[_0x216f('0x37')](_0x4778a4,util[_0x216f('0x1e')](_0x216f('0x3c'),_0x303e48,_0x216f('0x3b')));}_0x58fb18['push'](writePDFDocument(_0x468a53,_0x1ae38a));}return Promise['all'](_0x58fb18);})[_0x216f('0x2c')](function(){if(_0x343f38){return new Promise(function(_0x1e5a34){zipdir(path['join'](_0x4778a4,_0x303e48),{'saveTo':path['join'](_0x4778a4,util[_0x216f('0x1e')]('%s.%s',_0x303e48,_0x216f('0x3d')))},function(){rimraf(path['join'](_0x4778a4,_0x303e48),function(){});_0x1e5a34(_0x216f('0x3e'));});});}})['then'](function(){if(!_0x343f38)return;rimraf(path['join'](_0x4778a4,_0x303e48),function(){});})[_0x216f('0x2c')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x216f('0x3f')));return analyticExtractedReport(_0x216f('0x40'),_0x343f38?util[_0x216f('0x1e')](_0x216f('0x3c'),_0x303e48,_0x343f38?_0x216f('0x3d'):_0x216f('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x216f('0x41')](util[_0x216f('0x1e')](_0x216f('0x42'),EXTRACTED_REPORT_ID,_0x216f('0x3f')));return db[_0x216f('0x10')][_0x216f('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x216f('0x2c')](function(_0x336554){EXTRACTED_REPORT=_0x336554;return dbH[_0x216f('0x2f')][_0x216f('0x30')](util[_0x216f('0x1e')](_0x216f('0x44'),QUERY),{'type':dbH[_0x216f('0x2f')][_0x216f('0x32')][_0x216f('0x33')]});})[_0x216f('0x2c')](extractReport)[_0x216f('0x45')](function(_0xcac1d0){logger[_0x216f('0x41')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x216f('0x3f')),util[_0x216f('0x46')](_0xcac1d0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x216f('0x47')](function(){process[_0x216f('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4cfa66=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x216f('0x49'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x216f('0x4a')}});return _0x4cfa66;}function getPDFDocDefinitionFromHTML(_0x252e33,_0x2de59b){var _0x5d10c5=util[_0x216f('0x1e')](_0x216f('0x4b'),_0x2de59b[_0x216f('0x4c')],_0x2de59b[_0x216f('0x4d')]);var _0x4ab23f=moment()[_0x216f('0x1e')](_0x216f('0x4e'))[_0x216f('0x15')]();var _0x573939=htmlToPdfmake(_0x252e33,{'window':window,'tableAutoSize':!![]});return{'content':[_0x573939],'defaultStyle':{'font':_0x216f('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x216f('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x216f('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x216f('0x50'),'style':_0x216f('0x22')}];},'footer':function(_0x32784d,_0x206c77){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5d10c5,_0x32784d,_0x206c77,_0x4ab23f),'style':_0x216f('0x25')}];}};}function writePDFDocument(_0x262e12,_0x1e57fa){return new Promise(function(_0x585870,_0x1ddcdc){var _0x518528=_0x262e12[_0x216f('0x51')](fs[_0x216f('0x52')](_0x1e57fa));_0x518528['on'](_0x216f('0x53'),function(){_0x585870(_0x216f('0x53'));});_0x518528['on'](_0x216f('0x54'),function(_0x41599d){_0x1ddcdc(_0x41599d);});_0x262e12[_0x216f('0x55')]();});}exports[_0x216f('0x56')]=function(_0x2f8031,_0x5725e2){var _0x3de936=getPDFPrinter();var _0x56613=getPDFDocDefinitionFromHTML(_0x2f8031,_0x5725e2);var _0x15aa5d=_0x3de936[_0x216f('0x3a')](_0x56613);return writePDFDocument(_0x15aa5d,_0x5725e2[_0x216f('0x2')])[_0x216f('0x45')](function(_0x39dee7){throw _0x39dee7;});}; \ No newline at end of file +var _0x447d=['finish','error','end','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','rimraf','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','pick','value','fill','length','auto','body','push','chunk','format','name','startDate','header','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream'];(function(_0x596102,_0xf1607b){var _0x560896=function(_0x13f08f){while(--_0x13f08f){_0x596102['push'](_0x596102['shift']());}};_0x560896(++_0xf1607b);}(_0x447d,0x160));var _0xd447=function(_0x5d5de4,_0x178b20){_0x5d5de4=_0x5d5de4-0x0;var _0x4c3708=_0x447d[_0x5d5de4];return _0x4c3708;};'use strict';var _=require(_0xd447('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xd447('0x1'));var moment=require(_0xd447('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xd447('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd447('0x4'));var JSDOM=require(_0xd447('0x5'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0xd447('0x6'));var db=require(_0xd447('0x7'))['db'];var dbH=require('../../mysqldb')[_0xd447('0x8')];var logger=require(_0xd447('0x9'))(_0xd447('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd447('0xb')][0x3];var PATH=process[_0xd447('0xb')][0x4];var NAME=process[_0xd447('0xb')][0x5];var FORMAT=_0xd447('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4e80e6,_0x319bc4){var _0x2552ba={'status':_0x4e80e6};var _0x329bb5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x319bc4){_0x2552ba['savename']=_0x319bc4;}return db[_0xd447('0xd')]['update'](_0x2552ba,_0x329bb5);}function getHeaders(_0x63790d){return _[_0xd447('0xe')](_0x63790d,function(_0x3e3ed0){return{'text':_0x3e3ed0,'style':'tableHeader'};});}function getRows(_0x54b779,_0x253047){return _[_0xd447('0xe')](_0x253047,function(_0x386a0e){return _(_0x386a0e)[_0xd447('0xf')](_0x54b779)[_0xd447('0xe')](function(_0x411f2c){return _0x411f2c?_['toString'](_0x411f2c):'';})[_0xd447('0x10')]();});}function createTable(_0x62914d,_0x1aedc4){var _0x481877={'widths':_[_0xd447('0x11')](Array(_0x62914d[_0xd447('0x12')]),0x91),'heights':function(_0x2dcad3){return _0x2dcad3===0x0?_0xd447('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x23d9aa=getHeaders(_0x62914d);_0x481877[_0xd447('0x14')][_0xd447('0x15')](_0x23d9aa);var _0x45e2fc=getRows(_0x62914d,_0x1aedc4);_0x481877[_0xd447('0x14')]=_0x481877[_0xd447('0x14')]['concat'](_0x45e2fc);return _0x481877;}function createTables(_0x1e7780){var _0x26f9bf=[];var _0x20004b=_[_0xd447('0x16')](Object['keys'](_0x1e7780[0x0]),0x5);_0x20004b['forEach'](function(_0xdcff1a){_0x26f9bf[_0xd447('0x15')](createTable(_0xdcff1a,_0x1e7780));});return _0x26f9bf;}function getPDFDocDefinition(_0x2ddf3d){var _0x18d2b5=util[_0xd447('0x17')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xd447('0x18')],moment(EXTRACTED_REPORT[_0xd447('0x19')])[_0xd447('0x17')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xd447('0x17')](FORMAT));var _0x2beac3=[];for(var _0x178ad6=0x0;_0x178ad6<_0x2ddf3d[_0xd447('0x12')];_0x178ad6++){var _0x4bec8b=[];if(_0x178ad6===0x0){_0x4bec8b[_0xd447('0x15')]({'text':_0x18d2b5,'style':_0xd447('0x1a')});}var _0x30c573={'table':_0x2ddf3d[_0x178ad6]};if(_0x178ad6>0x0){_0x30c573['pageBreak']=_0xd447('0x1b');_0x30c573[_0xd447('0x1c')]=[0x0,0x46,0x0,0x0];}_0x4bec8b['push'](_0x30c573);_0x2beac3['push'](_0x4bec8b);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2beac3,'footer':function(_0x5d632d,_0x372272){return{'text':_0x5d632d['toString']()+_0xd447('0x1d')+_0x372272,'style':_0xd447('0x1e')};},'defaultStyle':{'font':_0xd447('0x1f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd447('0x20')},'footer':{'alignment':_0xd447('0x21'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3aca3a){var _0x106766=0x1388;var _0x3a33f8;if(!_0x3aca3a[0x0][_0xd447('0x22')]){return analyticExtractedReport(_0xd447('0x23'));}return db[_0xd447('0x24')][_0xd447('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd447('0x26'),'splitSizePdf']})[_0xd447('0x27')](function(_0x3dcfe8){if(_0x3dcfe8){_0x3a33f8=_0x3dcfe8;_0x106766=_0x3a33f8[_0xd447('0x28')]||0x3e8;}})[_0xd447('0x27')](function(){var _0x32650f=[];var _0x2c96ca=0x0;if(_0x3a33f8[_0xd447('0x26')]){if(_0x3aca3a&&_0x3aca3a[_0xd447('0x12')]){var _0x36f948=_[_0xd447('0x29')](_0x3aca3a[0x0][_0xd447('0x22')]/_0x106766);var _0x3e6e78=Number[_0xd447('0x2a')](_0x3aca3a[0x0]['num']/_0x106766)?_0x3aca3a[0x0][_0xd447('0x22')]%_0x106766:0x0;_0x36f948[_0xd447('0x2b')](function(_0x29d87a){if(_0x29d87a>0x0){_0x2c96ca+=_0x106766;}_0x32650f[_0xd447('0x15')](dbH[_0xd447('0x2c')][_0xd447('0x2d')](util['format'](_0xd447('0x2e'),QUERY,_0x106766,_0x2c96ca),{'type':dbH['sequelize'][_0xd447('0x2f')][_0xd447('0x30')]}));});if(_0x3e6e78>0x0){_0x2c96ca+=_0x106766;_0x32650f[_0xd447('0x15')](dbH[_0xd447('0x2c')][_0xd447('0x2d')](util[_0xd447('0x17')](_0xd447('0x2e'),QUERY,_0x3e6e78,_0x2c96ca),{'type':dbH[_0xd447('0x2c')][_0xd447('0x2f')][_0xd447('0x30')]}));}}}else{_0x32650f[_0xd447('0x15')](dbH[_0xd447('0x2c')][_0xd447('0x2d')](QUERY,{'type':dbH[_0xd447('0x2c')][_0xd447('0x2f')][_0xd447('0x30')]}));}var _0x340d20=path['dirname'](PATH);var _0x37bdea=path[_0xd447('0x31')](PATH,_0xd447('0x32'));var _0x3f44ef=_0x3a33f8['split']&&_0x32650f['length']>0x1;var _0x216d3b=[];if(!fs[_0xd447('0x33')](path['join'](_0x340d20,_0x37bdea))&&_0x3f44ef){fs[_0xd447('0x34')](path[_0xd447('0x35')](_0x340d20,_0x37bdea));}return BPromise[_0xd447('0x36')](_0x32650f,function(_0x2501f0){_0x216d3b[_0xd447('0x15')](_0x2501f0);})['then'](function(){var _0xf25919=[];for(var _0x3156d7=0x0;_0x3156d7<_0x216d3b[_0xd447('0x12')];_0x3156d7+=0x1){var _0x5b0479=_0x216d3b[_0x3156d7];var _0x34c6f8=createTables(_[_0xd447('0x37')](_0x5b0479));var _0x5d3522;var _0x57f5a4=getPDFDocDefinition(_0x34c6f8);var _0x10e8fb=getPDFPrinter();var _0x20c2b2=_0x10e8fb[_0xd447('0x38')](_0x57f5a4);if(_0x3f44ef){_0x5d3522=path[_0xd447('0x35')](_0x340d20,_0x37bdea,util[_0xd447('0x17')]('%s%d.%s',_0x37bdea,_0x3156d7,_0xd447('0x39')));}else{_0x5d3522=path[_0xd447('0x35')](_0x340d20,util[_0xd447('0x17')](_0xd447('0x3a'),_0x37bdea,_0xd447('0x39')));}_0xf25919[_0xd447('0x15')](writePDFDocument(_0x20c2b2,_0x5d3522));}return Promise['all'](_0xf25919);})[_0xd447('0x27')](function(){if(_0x3f44ef){return new Promise(function(_0x24fb75){zipdir(path[_0xd447('0x35')](_0x340d20,_0x37bdea),{'saveTo':path[_0xd447('0x35')](_0x340d20,util['format'](_0xd447('0x3a'),_0x37bdea,_0xd447('0x3b')))},function(){rimraf(path['join'](_0x340d20,_0x37bdea),function(){});_0x24fb75(_0xd447('0x3c'));});});}})[_0xd447('0x27')](function(){if(!_0x3f44ef)return;rimraf(path['join'](_0x340d20,_0x37bdea),function(){});})[_0xd447('0x27')](function(){logger['info'](util[_0xd447('0x17')](_0xd447('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xd447('0x3e'),_0x3f44ef?util[_0xd447('0x17')](_0xd447('0x3a'),_0x37bdea,_0x3f44ef?_0xd447('0x3b'):_0xd447('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd447('0x3f')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd447('0x40')));return db[_0xd447('0xd')][_0xd447('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd447('0x27')](function(_0x314e67){EXTRACTED_REPORT=_0x314e67;return dbH[_0xd447('0x2c')][_0xd447('0x2d')](util[_0xd447('0x17')](_0xd447('0x42'),QUERY),{'type':dbH[_0xd447('0x2c')][_0xd447('0x2f')][_0xd447('0x30')]});})['then'](extractReport)[_0xd447('0x43')](function(_0x2555ea){logger[_0xd447('0x3f')](util['format'](_0xd447('0x44'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x2555ea,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd447('0x45'));})[_0xd447('0x46')](function(){process[_0xd447('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x33b53d=new PdfPrinter({'Arial':{'normal':__dirname+_0xd447('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xd447('0x49'),'bolditalics':__dirname+_0xd447('0x4a')}});return _0x33b53d;}function getPDFDocDefinitionFromHTML(_0x5840dc,_0x2e66b5){var _0x4c04e8=util[_0xd447('0x17')](_0xd447('0x4b'),_0x2e66b5[_0xd447('0x4c')],_0x2e66b5[_0xd447('0x4d')]);var _0x3800d5=moment()[_0xd447('0x17')]('YYYY-MM-DD')[_0xd447('0x4e')]();var _0x1391aa=htmlToPdfmake(_0x5840dc,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1391aa],'defaultStyle':{'font':_0xd447('0x1f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd447('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd447('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd447('0x4f')}},'header':function(){return[{'text':_0xd447('0x50'),'style':_0xd447('0x1a')}];},'footer':function(_0x2f490d,_0x4a7d5a){return[{'text':util[_0xd447('0x17')](_0xd447('0x51'),_0x4c04e8,_0x2f490d,_0x4a7d5a,_0x3800d5),'style':_0xd447('0x1e')}];}};}function writePDFDocument(_0x1c9f64,_0x305e2d){return new Promise(function(_0x3ba112,_0x38726c){var _0x3dcac4=_0x1c9f64['pipe'](fs[_0xd447('0x52')](_0x305e2d));_0x3dcac4['on'](_0xd447('0x53'),function(){_0x3ba112(_0xd447('0x53'));});_0x3dcac4['on'](_0xd447('0x54'),function(_0x13243b){_0x38726c(_0x13243b);});_0x1c9f64[_0xd447('0x55')]();});}exports[_0xd447('0x56')]=function(_0x55939a,_0xa8430f){var _0x43a559=getPDFPrinter();var _0xcc7938=getPDFDocDefinitionFromHTML(_0x55939a,_0xa8430f);var _0x703cd=_0x43a559[_0xd447('0x38')](_0xcc7938);return writePDFDocument(_0x703cd,_0xa8430f['path'])['catch'](function(_0x5427b9){throw _0x5427b9;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 456890c..23dfdb6 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 _0x33b9=['Failed','exit','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Setting','find','split','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','length','isInteger','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','info','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x4f5670,_0x3ef7e4){var _0x5a7277=function(_0x1de56f){while(--_0x1de56f){_0x4f5670['push'](_0x4f5670['shift']());}};_0x5a7277(++_0x3ef7e4);}(_0x33b9,0x1ec));var _0x933b=function(_0x4af184,_0xd7fd9f){_0x4af184=_0x4af184-0x0;var _0x98391b=_0x33b9[_0x4af184];return _0x98391b;};'use strict';var util=require(_0x933b('0x0'));var path=require('path');var _=require(_0x933b('0x1'));var fs=require('fs');var json2xls=require(_0x933b('0x2'));var BPromise=require(_0x933b('0x3'));var zipdir=require(_0x933b('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x933b('0x5'))[_0x933b('0x6')];var logger=require(_0x933b('0x7'))(_0x933b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x933b('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x933b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d35bb,_0x523ed7){var _0x2429de={'status':_0x4d35bb};var _0x21abf7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x523ed7){_0x2429de[_0x933b('0xa')]=_0x523ed7;}return db[_0x933b('0xb')]['update'](_0x2429de,_0x21abf7);}function main(){var _0x1a724c=0x1388;var _0x29fb51;logger['info'](util[_0x933b('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x933b('0xd')][_0x933b('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x933b('0xf'),_0x933b('0x10')]})['then'](function(_0x51a373){if(_0x51a373){_0x29fb51=_0x51a373;_0x1a724c=_0x29fb51[_0x933b('0x10')]||0x1388;}})['then'](function(){return dbH[_0x933b('0x11')][_0x933b('0x12')](util[_0x933b('0xc')](_0x933b('0x13'),QUERY),{'type':dbH[_0x933b('0x11')][_0x933b('0x14')][_0x933b('0x15')]});})[_0x933b('0x16')](function(_0x35ab5f){if(!_0x35ab5f[0x0]['num']){return analyticExtractedReport('Empty');}var _0xfc07d5=[];var _0x1125b3=0x0;if(_0x29fb51[_0x933b('0xf')]){if(_0x35ab5f&&_0x35ab5f[_0x933b('0x17')]){var _0x1c4326=_['range'](_0x35ab5f[0x0]['num']/_0x1a724c);var _0x10ce9f=Number[_0x933b('0x18')](_0x35ab5f[0x0][_0x933b('0x19')]/_0x1a724c)?_0x35ab5f[0x0][_0x933b('0x19')]%_0x1a724c:0x0;_0x1c4326[_0x933b('0x1a')](function(_0x53760f){if(_0x53760f>0x0){_0x1125b3+=_0x1a724c;}_0xfc07d5['push'](dbH[_0x933b('0x11')][_0x933b('0x12')](util[_0x933b('0xc')](_0x933b('0x1b'),QUERY,_0x1a724c,_0x1125b3),{'type':dbH[_0x933b('0x11')]['QueryTypes'][_0x933b('0x15')]}));});if(_0x10ce9f>0x0){_0x1125b3+=_0x1a724c;_0xfc07d5[_0x933b('0x1c')](dbH[_0x933b('0x11')][_0x933b('0x12')](util[_0x933b('0xc')](_0x933b('0x1b'),QUERY,_0x10ce9f,_0x1125b3),{'type':dbH[_0x933b('0x11')][_0x933b('0x14')]['SELECT']}));}}}else{_0xfc07d5[_0x933b('0x1c')](dbH['sequelize'][_0x933b('0x12')](QUERY,{'type':dbH[_0x933b('0x11')][_0x933b('0x14')][_0x933b('0x15')]}));}var _0x377037=path[_0x933b('0x1d')](PATH);var _0x1e33f6=path['basename'](PATH,_0x933b('0x1e'));var _0x13b9a0=_0x29fb51[_0x933b('0xf')]&&_0xfc07d5[_0x933b('0x17')]>0x1;var _0x241b34=[];if(!fs[_0x933b('0x1f')](path[_0x933b('0x20')](_0x377037,_0x1e33f6))&&_0x13b9a0){fs[_0x933b('0x21')](path[_0x933b('0x20')](_0x377037,_0x1e33f6));}return BPromise[_0x933b('0x22')](_0xfc07d5,function(_0x85f163){_0x241b34['push'](_0x85f163);})['then'](function(){for(var _0x2ab9d2=0x0;_0x2ab9d2<_0x241b34[_0x933b('0x17')];_0x2ab9d2+=0x1){var _0x1772c5;var _0x261212=_0x241b34[_0x2ab9d2];if(_0x13b9a0){_0x1772c5=path['join'](_0x377037,_0x1e33f6,util[_0x933b('0xc')](_0x933b('0x23'),_0x1e33f6,_0x2ab9d2,_0x933b('0x24')));}else{_0x1772c5=path[_0x933b('0x20')](_0x377037,util[_0x933b('0xc')](_0x933b('0x25'),_0x1e33f6,_0x933b('0x24')));}fs[_0x933b('0x26')](_0x1772c5,json2xls(_0x261212),_0x933b('0x27'));}})[_0x933b('0x16')](function(){if(_0x13b9a0){return new Promise(function(_0x48255b){zipdir(path[_0x933b('0x20')](_0x377037,_0x1e33f6),{'saveTo':path['join'](_0x377037,util[_0x933b('0xc')](_0x933b('0x25'),_0x1e33f6,_0x933b('0x28')))},function(_0x1e75e1,_0xdf50a2){rimraf(path['join'](_0x377037,_0x1e33f6),function(){});_0x48255b('zip\x20finished');});});}})[_0x933b('0x16')](function(){logger[_0x933b('0x29')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x933b('0x2a')));return analyticExtractedReport(_0x933b('0x2b'),_0x13b9a0?util[_0x933b('0xc')](_0x933b('0x25'),_0x1e33f6,_0x13b9a0?_0x933b('0x28'):_0x933b('0x24')):null);});})[_0x933b('0x2c')](function(_0x2dad1c){logger[_0x933b('0x29')](util[_0x933b('0xc')](_0x933b('0x2d'),EXTRACTED_REPORT_ID,_0x933b('0x2a')),util[_0x933b('0x2e')](_0x2dad1c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x933b('0x2f'));})['finally'](function(){process[_0x933b('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x74ca=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','format','dirname','basename','existsSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','catch','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info'];(function(_0x3cb670,_0x5a0f2b){var _0x451d92=function(_0x495afa){while(--_0x495afa){_0x3cb670['push'](_0x3cb670['shift']());}};_0x451d92(++_0x5a0f2b);}(_0x74ca,0xfa));var _0xa74c=function(_0x3954f6,_0x3ecd74){_0x3954f6=_0x3954f6-0x0;var _0xc6d9b3=_0x74ca[_0x3954f6];return _0xc6d9b3;};'use strict';var util=require(_0xa74c('0x0'));var path=require(_0xa74c('0x1'));var _=require(_0xa74c('0x2'));var fs=require('fs');var json2xls=require(_0xa74c('0x3'));var BPromise=require(_0xa74c('0x4'));var zipdir=require(_0xa74c('0x5'));var rimraf=require(_0xa74c('0x6'));var db=require(_0xa74c('0x7'))['db'];var dbH=require('../../mysqldb')[_0xa74c('0x8')];var logger=require(_0xa74c('0x9'))(_0xa74c('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xa74c('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa74c('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1af46e,_0x6a3a2){var _0x9c04c9={'status':_0x1af46e};var _0x2b1e96={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x6a3a2){_0x9c04c9[_0xa74c('0xc')]=_0x6a3a2;}return db['AnalyticExtractedReport'][_0xa74c('0xd')](_0x9c04c9,_0x2b1e96);}function main(){var _0x38d1d8=0x1388;var _0x1762cd;logger[_0xa74c('0xe')](util['format'](_0xa74c('0xf'),EXTRACTED_REPORT_ID,_0xa74c('0x10')));return db[_0xa74c('0x11')][_0xa74c('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa74c('0x13'),_0xa74c('0x14')]})['then'](function(_0x393b23){if(_0x393b23){_0x1762cd=_0x393b23;_0x38d1d8=_0x1762cd['splitSizeXlsx']||0x1388;}})[_0xa74c('0x15')](function(){return dbH[_0xa74c('0x16')][_0xa74c('0x17')](util['format'](_0xa74c('0x18'),QUERY),{'type':dbH[_0xa74c('0x16')][_0xa74c('0x19')][_0xa74c('0x1a')]});})['then'](function(_0x11c0b5){if(!_0x11c0b5[0x0][_0xa74c('0x1b')]){return analyticExtractedReport(_0xa74c('0x1c'));}var _0x4d8746=[];var _0x56175b=0x0;if(_0x1762cd[_0xa74c('0x13')]){if(_0x11c0b5&&_0x11c0b5[_0xa74c('0x1d')]){var _0x26883d=_[_0xa74c('0x1e')](_0x11c0b5[0x0][_0xa74c('0x1b')]/_0x38d1d8);var _0x107b6a=Number[_0xa74c('0x1f')](_0x11c0b5[0x0][_0xa74c('0x1b')]/_0x38d1d8)?_0x11c0b5[0x0][_0xa74c('0x1b')]%_0x38d1d8:0x0;_0x26883d[_0xa74c('0x20')](function(_0x39c23d){if(_0x39c23d>0x0){_0x56175b+=_0x38d1d8;}_0x4d8746[_0xa74c('0x21')](dbH['sequelize']['query'](util['format'](_0xa74c('0x22'),QUERY,_0x38d1d8,_0x56175b),{'type':dbH[_0xa74c('0x16')][_0xa74c('0x19')]['SELECT']}));});if(_0x107b6a>0x0){_0x56175b+=_0x38d1d8;_0x4d8746[_0xa74c('0x21')](dbH[_0xa74c('0x16')]['query'](util[_0xa74c('0x23')](_0xa74c('0x22'),QUERY,_0x107b6a,_0x56175b),{'type':dbH['sequelize']['QueryTypes'][_0xa74c('0x1a')]}));}}}else{_0x4d8746['push'](dbH[_0xa74c('0x16')][_0xa74c('0x17')](QUERY,{'type':dbH['sequelize'][_0xa74c('0x19')]['SELECT']}));}var _0x1ed0f0=path[_0xa74c('0x24')](PATH);var _0x46d250=path[_0xa74c('0x25')](PATH,'.xlsx');var _0x14abed=_0x1762cd['split']&&_0x4d8746[_0xa74c('0x1d')]>0x1;var _0x53c2e7=[];if(!fs[_0xa74c('0x26')](path[_0xa74c('0x27')](_0x1ed0f0,_0x46d250))&&_0x14abed){fs['mkdirSync'](path[_0xa74c('0x27')](_0x1ed0f0,_0x46d250));}return BPromise[_0xa74c('0x28')](_0x4d8746,function(_0x336d39){_0x53c2e7[_0xa74c('0x21')](_0x336d39);})['then'](function(){for(var _0x2394fe=0x0;_0x2394fe<_0x53c2e7[_0xa74c('0x1d')];_0x2394fe+=0x1){var _0x12e636;var _0x1a6aad=_0x53c2e7[_0x2394fe];if(_0x14abed){_0x12e636=path[_0xa74c('0x27')](_0x1ed0f0,_0x46d250,util[_0xa74c('0x23')](_0xa74c('0x29'),_0x46d250,_0x2394fe,'xlsx'));}else{_0x12e636=path['join'](_0x1ed0f0,util[_0xa74c('0x23')](_0xa74c('0x2a'),_0x46d250,_0xa74c('0x2b')));}fs[_0xa74c('0x2c')](_0x12e636,json2xls(_0x1a6aad),_0xa74c('0x2d'));}})[_0xa74c('0x15')](function(){if(_0x14abed){return new Promise(function(_0x2f46d7){zipdir(path[_0xa74c('0x27')](_0x1ed0f0,_0x46d250),{'saveTo':path['join'](_0x1ed0f0,util[_0xa74c('0x23')](_0xa74c('0x2a'),_0x46d250,_0xa74c('0x2e')))},function(_0x237747,_0x4a5be8){rimraf(path['join'](_0x1ed0f0,_0x46d250),function(){});_0x2f46d7(_0xa74c('0x2f'));});});}})[_0xa74c('0x15')](function(){logger[_0xa74c('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa74c('0x10')));return analyticExtractedReport('Completed',_0x14abed?util['format'](_0xa74c('0x2a'),_0x46d250,_0x14abed?_0xa74c('0x2e'):_0xa74c('0x2b')):null);});})[_0xa74c('0x30')](function(_0x2fbc9a){logger[_0xa74c('0xe')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa74c('0x10')),util[_0xa74c('0x31')](_0x2fbc9a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa74c('0x32'));})[_0xa74c('0x33')](function(){process[_0xa74c('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0bf2d33..ed60ca6 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 _0xda71=['CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','Interval','findAll','then','intervals','models','VoiceExtension','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','extension','find','extensions','push','type','Set','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto('];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xda71,0x1c4));var _0x1da7=function(_0x10c2fb,_0x71a5bc){_0x10c2fb=_0x10c2fb-0x0;var _0x1db15b=_0xda71[_0x10c2fb];return _0x1db15b;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3d7dc4,_0x39df0e){var _0x50c3bd=this;return _0x3d7dc4['models'][_0x1da7('0x0')][_0x1da7('0x1')]({'raw':!![]})[_0x1da7('0x2')](function(_0x3f57d6){_0x50c3bd[_0x1da7('0x3')]=_0x3f57d6;return _0x3d7dc4[_0x1da7('0x4')][_0x1da7('0x5')][_0x1da7('0x1')]({'where':{'IntervalId':_0x39df0e['IntervalId']},'raw':!![]});})[_0x1da7('0x2')](function(_0x9c7a1d){return _0x3d7dc4[_0x1da7('0x4')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x1da7('0x6')](_['map'](_0x9c7a1d,_0x1da7('0x7')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x1da7('0x2')](function(_0x45a3f4){var _0x8d24be=_[_0x1da7('0x8')](_0x45a3f4,{'priority':'1'});var _0xdb6403=_['filter'](_0x45a3f4,{'isApp':0x1});var _0x260b84=_[_0x1da7('0x9')](_0xdb6403,_0x1da7('0x7'));var _0x2be6e8=[_0x1da7('0xa'),_0x1da7('0xb')];var _0x2d0f99=[];var _0x5401b1=[];for(var _0x164565 in _0x260b84){if(_0x260b84[_0x1da7('0xc')](_0x164565)){_0x50c3bd['priority']=0x2;_0x50c3bd['extensions']=[];_0x50c3bd[_0x1da7('0xd')]=_[_0x1da7('0xe')](_0x8d24be,{'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')]});_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':util['format'](_0x1da7('0x13'),_0x260b84[_0x164565][0x0][_0x1da7('0x11')]),'context':_0x260b84[_0x164565][0x0]['context'],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd['priority']++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});if(_0x260b84[_0x164565][0x0]['type']===_0x1da7('0x15')){_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':_0x1da7('0x16')+_0x260b84[_0x164565][0x0][_0x1da7('0x14')],'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0]['exten'],'priority':_0x50c3bd[_0x1da7('0x18')]++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});}else if(_0x260b84[_0x164565][0x0][_0x1da7('0x11')]===_0x1da7('0x19')){if(_0x50c3bd['extension']){_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':_0x1da7('0x1a')+(_0x50c3bd[_0x1da7('0xd')][_0x1da7('0x1b')]?_0x1da7('0x1c')+_0x50c3bd[_0x1da7('0xd')][_0x1da7('0x1b')]+'}':'${EXTEN}'),'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0]['exten'],'priority':_0x50c3bd[_0x1da7('0x18')]++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});}_0x50c3bd[_0x1da7('0xf')]['push']({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':_0x1da7('0x16')+_0x260b84[_0x164565][0x0][_0x1da7('0x14')],'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd[_0x1da7('0x18')]++,'VoiceExtensionId':_0x260b84[_0x164565][0x0]['VoiceExtensionId']});var _0x7b55b1=_0x50c3bd[_0x1da7('0x18')]++;_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x7b55b1+0x2)+_0x1da7('0x1e')+(_0x7b55b1+0x1)+')','context':_0x260b84[_0x164565][0x0]['context'],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x7b55b1,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});if(_0x50c3bd[_0x1da7('0xd')]){_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':'Set','appdata':_0x50c3bd[_0x1da7('0xd')][_0x1da7('0x1b')]?_0x1da7('0x1f')+_0x50c3bd[_0x1da7('0xd')][_0x1da7('0x1b')]+'}':_0x1da7('0x20'),'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd['priority']++,'VoiceExtensionId':_0x260b84[_0x164565][0x0]['VoiceExtensionId']});}_0x50c3bd['extensions'][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':'Set','appdata':_0x1da7('0x21')+_0x260b84[_0x164565][0x0][_0x1da7('0x14')],'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd[_0x1da7('0x18')]++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});if(_0x50c3bd[_0x1da7('0xd')]&&_0x50c3bd[_0x1da7('0xd')][_0x1da7('0xc')](_0x1da7('0x22'))&&_0x50c3bd[_0x1da7('0xd')][_0x1da7('0x22')]!==_0x1da7('0x23')){_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd['priority']++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x50c3bd[_0x1da7('0xd')][_0x1da7('0x22')]||'wav','context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd['priority']++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});}}_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0]['type'],'app':_0x1da7('0x12'),'appdata':_0x1da7('0x24'),'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd[_0x1da7('0x18')]++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});_0x50c3bd['extensions'][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'priority':_0x50c3bd['priority']++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});_0x50c3bd[_0x1da7('0xf')][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0][_0x1da7('0x11')],'app':_0x1da7('0x12'),'appdata':_0x1da7('0x25'),'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'exten':_0x260b84[_0x164565][0x0]['exten'],'priority':_0x50c3bd[_0x1da7('0x18')]++,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});for(var _0x5ab562=0x0,_0x2f8e2c=0x0;_0x5ab562<_0x260b84[_0x164565]['length'];_0x5ab562+=0x1,_0x2f8e2c=0x0){var _0x3f56b1=_0x260b84[_0x164565][_0x5ab562];if(_0x3f56b1['type']){_0x3f56b1[_0x1da7('0x11')]=_0x3f56b1['type'][_0x1da7('0x26')]();}var _0x581142=[];var _0x57a70c=[];delete _0x3f56b1['id'];delete _0x3f56b1[_0x1da7('0x27')];delete _0x3f56b1[_0x1da7('0x28')];var _0x51d6ed=_0x3f56b1[_0x1da7('0x29')]!==_0x1da7('0x2a')?[_0x3f56b1[_0x1da7('0x29')]]:_0x3f56b1[_0x1da7('0x2b')]?_[_0x1da7('0x2c')](_['filter'](_0x50c3bd[_0x1da7('0x3')],{'IntervalId':_0x3f56b1[_0x1da7('0x2b')]}),'interval'):[];if(_0x3f56b1['hasOwnProperty'](_0x1da7('0x2d'))){if(_0x3f56b1[_0x1da7('0x2d')]&&_0x3f56b1[_0x1da7('0x2d')]!=='--'){_0x581142[_0x1da7('0x10')]({'type':_0x3f56b1['type'],'app':_0x1da7('0x12'),'appdata':_0x1da7('0x2e')+_0x3f56b1[_0x1da7('0x2d')],'context':_0x3f56b1[_0x1da7('0x17')],'exten':_0x3f56b1[_0x1da7('0x7')],'priority':_0x51d6ed[_0x1da7('0x2f')]+_0x50c3bd[_0x1da7('0x18')]+_0x2f8e2c++,'VoiceExtensionId':_0x3f56b1[_0x1da7('0x14')]});}}if(_0x3f56b1['type']===_0x1da7('0x19')&&_0x3f56b1[_0x1da7('0xc')](_0x1da7('0x30'))){if(_0x3f56b1[_0x1da7('0x30')]){_0x581142[_0x1da7('0x10')]({'type':_0x3f56b1[_0x1da7('0x11')],'app':'ExecIf','appdata':_0x1da7('0x31')+_0x3f56b1[_0x1da7('0x30')]+')','context':_0x3f56b1['context'],'exten':_0x3f56b1[_0x1da7('0x7')],'priority':_0x51d6ed['length']+_0x50c3bd[_0x1da7('0x18')]+_0x2f8e2c++,'VoiceExtensionId':_0x3f56b1[_0x1da7('0x14')]});}else{_0x581142['push']({'type':_0x3f56b1[_0x1da7('0x11')],'app':_0x1da7('0x1d'),'appdata':_0x1da7('0x32'),'context':_0x3f56b1['context'],'exten':_0x3f56b1['exten'],'priority':_0x51d6ed[_0x1da7('0x2f')]+_0x50c3bd[_0x1da7('0x18')]+_0x2f8e2c++,'VoiceExtensionId':_0x3f56b1[_0x1da7('0x14')]});}}if(_0x3f56b1[_0x1da7('0xc')](_0x1da7('0x33'))){if(_0x2be6e8[_0x1da7('0x34')](_0x3f56b1[_0x1da7('0x35')][_0x1da7('0x26')]())>=0x0&&_0x3f56b1['appType']!==_0x1da7('0x36')){if(_0x3f56b1[_0x1da7('0x33')]){_0x581142['push']({'type':_0x3f56b1[_0x1da7('0x11')],'app':_0x1da7('0x1d'),'appdata':_0x1da7('0x37'),'context':_0x3f56b1[_0x1da7('0x17')],'exten':_0x3f56b1['exten'],'priority':_0x51d6ed[_0x1da7('0x2f')]+_0x50c3bd[_0x1da7('0x18')]+_0x2f8e2c++,'VoiceExtensionId':_0x3f56b1[_0x1da7('0x14')]});_0x581142['push']({'type':_0x3f56b1[_0x1da7('0x11')],'app':'Set','appdata':_0x1da7('0x38'),'context':_0x3f56b1[_0x1da7('0x17')],'exten':_0x3f56b1[_0x1da7('0x7')],'priority':_0x51d6ed[_0x1da7('0x2f')]+_0x50c3bd[_0x1da7('0x18')]+_0x2f8e2c++,'VoiceExtensionId':_0x3f56b1[_0x1da7('0x14')]});}else{_0x581142[_0x1da7('0x10')]({'type':_0x3f56b1['type'],'app':_0x1da7('0x1d'),'appdata':_0x1da7('0x39'),'context':_0x3f56b1['context'],'exten':_0x3f56b1['exten'],'priority':_0x51d6ed['length']+_0x50c3bd['priority']+_0x2f8e2c++,'VoiceExtensionId':_0x3f56b1['VoiceExtensionId']});_0x581142[_0x1da7('0x10')]({'type':_0x3f56b1['type'],'app':'Set','appdata':_0x1da7('0x3a'),'context':_0x3f56b1[_0x1da7('0x17')],'exten':_0x3f56b1[_0x1da7('0x7')],'priority':_0x51d6ed[_0x1da7('0x2f')]+_0x50c3bd[_0x1da7('0x18')]+_0x2f8e2c++,'VoiceExtensionId':_0x3f56b1['VoiceExtensionId']});}}}for(var _0x2f9da4=0x0;_0x2f9da4<_0x51d6ed[_0x1da7('0x2f')];_0x2f9da4+=0x1){var _0x303cba=_0x50c3bd[_0x1da7('0x18')]+_0x51d6ed['length'];var _0x1c3c7d=_0x2f9da4===_0x51d6ed['length']-0x1?_0x50c3bd['priority']+_0x581142['length']+_0x57a70c[_0x1da7('0x2f')]+0x2:_0x50c3bd[_0x1da7('0x18')]+_0x2f9da4+0x1;_0x581142['splice'](_0x2f9da4,0x0,{'type':_0x3f56b1[_0x1da7('0x11')],'app':_0x1da7('0x3b'),'appdata':_0x51d6ed[_0x2f9da4]+'?'+_0x3f56b1[_0x1da7('0x17')]+_0x1da7('0x3c')+_0x303cba+':'+_0x3f56b1['context']+_0x1da7('0x3c')+_0x1c3c7d,'exten':_0x3f56b1['exten'],'context':_0x3f56b1[_0x1da7('0x17')],'priority':_0x50c3bd[_0x1da7('0x18')]+_0x2f9da4,'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});}_0x3f56b1[_0x1da7('0x18')]=_0x581142['length']?_[_0x1da7('0x3d')](_0x581142)['priority']+0x1:_0x50c3bd[_0x1da7('0x18')];_0x50c3bd[_0x1da7('0x18')]=(_0x57a70c['length']?_[_0x1da7('0x3d')](_0x57a70c)[_0x1da7('0x18')]:_0x3f56b1[_0x1da7('0x18')])+0x1;_0x50c3bd[_0x1da7('0xf')]=_['concat'](_0x50c3bd[_0x1da7('0xf')],_0x581142,[_0x3f56b1],_0x57a70c);}_0x50c3bd['extensions'][_0x1da7('0x10')]({'type':_0x260b84[_0x164565][0x0]['type'],'app':_0x1da7('0x3e'),'exten':_0x260b84[_0x164565][0x0][_0x1da7('0x7')],'context':_0x260b84[_0x164565][0x0][_0x1da7('0x17')],'priority':_0x50c3bd[_0x1da7('0x18')],'VoiceExtensionId':_0x260b84[_0x164565][0x0][_0x1da7('0x14')]});_0x2d0f99[_0x1da7('0x10')](_0x260b84[_0x164565][0x0][_0x1da7('0x14')]);_0x5401b1=_['concat'](_0x5401b1,_0x50c3bd[_0x1da7('0xf')]);}}return _0x3d7dc4[_0x1da7('0x3f')](function(_0x3ab942){return _0x3d7dc4[_0x1da7('0x4')][_0x1da7('0x5')][_0x1da7('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x2d0f99}},'transaction':_0x3ab942})[_0x1da7('0x2')](function(_0x44d615){return _0x3d7dc4['models'][_0x1da7('0x5')][_0x1da7('0x41')](_[_0x1da7('0x42')](_0x5401b1,_0x1da7('0x18')),{'transaction':_0x3ab942});});});})[_0x1da7('0x43')](function(_0x46794b){console[_0x1da7('0x44')](_0x46794b);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xf1dc=['recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','push','outbound','Set','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty'];(function(_0x26b9d2,_0x4f3af1){var _0x14592e=function(_0x1b9daf){while(--_0x1b9daf){_0x26b9d2['push'](_0x26b9d2['shift']());}};_0x14592e(++_0x4f3af1);}(_0xf1dc,0x104));var _0xcf1d=function(_0xad2594,_0x200f55){_0xad2594=_0xad2594-0x0;var _0x2f617a=_0xf1dc[_0xad2594];return _0x2f617a;};'use strict';var _=require(_0xcf1d('0x0'));var util=require('util');function rewrite(_0x51715d,_0x4c28d9){var _0x762ea3=this;return _0x51715d[_0xcf1d('0x1')][_0xcf1d('0x2')][_0xcf1d('0x3')]({'raw':!![]})['then'](function(_0x1eec4f){_0x762ea3[_0xcf1d('0x4')]=_0x1eec4f;return _0x51715d['models'][_0xcf1d('0x5')][_0xcf1d('0x3')]({'where':{'IntervalId':_0x4c28d9[_0xcf1d('0x6')]},'raw':!![]});})[_0xcf1d('0x7')](function(_0x4518fc){return _0x51715d[_0xcf1d('0x1')][_0xcf1d('0x5')]['findAll']({'where':{'exten':{'$in':_[_0xcf1d('0x8')](_[_0xcf1d('0x9')](_0x4518fc,_0xcf1d('0xa')))}},'order':[{'raw':_0xcf1d('0xb')}],'raw':!![]});})[_0xcf1d('0x7')](function(_0x2a1a5e){var _0x65e435=_[_0xcf1d('0xc')](_0x2a1a5e,{'priority':'1'});var _0x3c3bb7=_[_0xcf1d('0xc')](_0x2a1a5e,{'isApp':0x1});var _0x3e0d9e=_[_0xcf1d('0xd')](_0x3c3bb7,_0xcf1d('0xa'));var _0x953b68=[_0xcf1d('0xe'),_0xcf1d('0xf')];var _0x139c04=[];var _0x45104e=[];for(var _0x5e1b8b in _0x3e0d9e){if(_0x3e0d9e['hasOwnProperty'](_0x5e1b8b)){_0x762ea3[_0xcf1d('0x10')]=0x2;_0x762ea3[_0xcf1d('0x11')]=[];_0x762ea3[_0xcf1d('0x12')]=_[_0xcf1d('0x13')](_0x65e435,{'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')]});_0x762ea3[_0xcf1d('0x11')]['push']({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':'Set','appdata':util[_0xcf1d('0x15')](_0xcf1d('0x16'),_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')]),'context':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x17')],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});if(_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')]===_0xcf1d('0x19')){_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':'Set','appdata':'CDR(routeid)='+_0x3e0d9e[_0x5e1b8b][0x0]['VoiceExtensionId'],'context':_0x3e0d9e[_0x5e1b8b][0x0]['context'],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0]['VoiceExtensionId']});}else if(_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')]===_0xcf1d('0x1b')){if(_0x762ea3[_0xcf1d('0x12')]){_0x762ea3['extensions'][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':_0xcf1d('0x1c'),'appdata':_0xcf1d('0x1d')+(_0x762ea3[_0xcf1d('0x12')][_0xcf1d('0x1e')]?_0xcf1d('0x1f')+_0x762ea3[_0xcf1d('0x12')][_0xcf1d('0x1e')]+'}':'${EXTEN}'),'context':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x17')],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});}_0x762ea3[_0xcf1d('0x11')]['push']({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':_0xcf1d('0x1c'),'appdata':_0xcf1d('0x20')+_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')],'context':_0x3e0d9e[_0x5e1b8b][0x0]['context'],'exten':_0x3e0d9e[_0x5e1b8b][0x0]['exten'],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0]['VoiceExtensionId']});var _0xa87755=_0x762ea3[_0xcf1d('0x10')]++;_0x762ea3['extensions'][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':_0xcf1d('0x21'),'appdata':_0xcf1d('0x22')+(_0xa87755+0x2)+_0xcf1d('0x23')+(_0xa87755+0x1)+')','context':_0x3e0d9e[_0x5e1b8b][0x0]['context'],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0xa87755,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0]['VoiceExtensionId']});if(_0x762ea3[_0xcf1d('0x12')]){_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':_0xcf1d('0x1c'),'appdata':_0x762ea3[_0xcf1d('0x12')][_0xcf1d('0x1e')]?_0xcf1d('0x24')+_0x762ea3[_0xcf1d('0x12')]['cutdigits']+'}':_0xcf1d('0x25'),'context':_0x3e0d9e[_0x5e1b8b][0x0]['context'],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});}_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':_0xcf1d('0x1c'),'appdata':_0xcf1d('0x26')+_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')],'context':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x17')],'exten':_0x3e0d9e[_0x5e1b8b][0x0]['exten'],'priority':_0x762ea3['priority']++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});if(_0x762ea3[_0xcf1d('0x12')]&&_0x762ea3[_0xcf1d('0x12')][_0xcf1d('0x27')](_0xcf1d('0x28'))&&_0x762ea3['extension'][_0xcf1d('0x28')]!=='none'){_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x17')],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3['priority']++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0]['type'],'app':'Set','appdata':_0xcf1d('0x29')+_0x762ea3[_0xcf1d('0x12')][_0xcf1d('0x28')]||_0xcf1d('0x2a'),'context':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x17')],'exten':_0x3e0d9e[_0x5e1b8b][0x0]['exten'],'priority':_0x762ea3['priority']++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});}}_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':'Set','appdata':_0xcf1d('0x2b'),'context':_0x3e0d9e[_0x5e1b8b][0x0]['context'],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});_0x762ea3['extensions'][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0]['type'],'app':_0xcf1d('0x1c'),'appdata':_0xcf1d('0x2c'),'context':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x17')],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0]['VoiceExtensionId']});_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':'Set','appdata':_0xcf1d('0x2d'),'context':_0x3e0d9e[_0x5e1b8b][0x0]['context'],'exten':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0xa')],'priority':_0x762ea3[_0xcf1d('0x10')]++,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});for(var _0x24aae8=0x0,_0x4faccf=0x0;_0x24aae8<_0x3e0d9e[_0x5e1b8b][_0xcf1d('0x2e')];_0x24aae8+=0x1,_0x4faccf=0x0){var _0x326b6a=_0x3e0d9e[_0x5e1b8b][_0x24aae8];if(_0x326b6a[_0xcf1d('0x14')]){_0x326b6a['type']=_0x326b6a['type'][_0xcf1d('0x2f')]();}var _0x2345ea=[];var _0x3122fb=[];delete _0x326b6a['id'];delete _0x326b6a[_0xcf1d('0x30')];delete _0x326b6a[_0xcf1d('0x31')];var _0x4d0c79=_0x326b6a[_0xcf1d('0x32')]!==_0xcf1d('0x33')?[_0x326b6a[_0xcf1d('0x32')]]:_0x326b6a[_0xcf1d('0x6')]?_['map'](_[_0xcf1d('0xc')](_0x762ea3['intervals'],{'IntervalId':_0x326b6a[_0xcf1d('0x6')]}),_0xcf1d('0x32')):[];if(_0x326b6a[_0xcf1d('0x27')]('tag')){if(_0x326b6a['tag']&&_0x326b6a[_0xcf1d('0x34')]!=='--'){_0x2345ea[_0xcf1d('0x1a')]({'type':_0x326b6a['type'],'app':'Set','appdata':'CDR(tag)='+_0x326b6a[_0xcf1d('0x34')],'context':_0x326b6a[_0xcf1d('0x17')],'exten':_0x326b6a['exten'],'priority':_0x4d0c79['length']+_0x762ea3[_0xcf1d('0x10')]+_0x4faccf++,'VoiceExtensionId':_0x326b6a[_0xcf1d('0x18')]});}}if(_0x326b6a[_0xcf1d('0x14')]===_0xcf1d('0x1b')&&_0x326b6a[_0xcf1d('0x27')](_0xcf1d('0x35'))){if(_0x326b6a[_0xcf1d('0x35')]){_0x2345ea[_0xcf1d('0x1a')]({'type':_0x326b6a[_0xcf1d('0x14')],'app':_0xcf1d('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x326b6a[_0xcf1d('0x35')]+')','context':_0x326b6a['context'],'exten':_0x326b6a['exten'],'priority':_0x4d0c79[_0xcf1d('0x2e')]+_0x762ea3[_0xcf1d('0x10')]+_0x4faccf++,'VoiceExtensionId':_0x326b6a['VoiceExtensionId']});}else{_0x2345ea['push']({'type':_0x326b6a[_0xcf1d('0x14')],'app':'ExecIf','appdata':_0xcf1d('0x36'),'context':_0x326b6a[_0xcf1d('0x17')],'exten':_0x326b6a[_0xcf1d('0xa')],'priority':_0x4d0c79[_0xcf1d('0x2e')]+_0x762ea3[_0xcf1d('0x10')]+_0x4faccf++,'VoiceExtensionId':_0x326b6a['VoiceExtensionId']});}}if(_0x326b6a[_0xcf1d('0x27')](_0xcf1d('0x37'))){if(_0x953b68[_0xcf1d('0x38')](_0x326b6a[_0xcf1d('0x39')][_0xcf1d('0x2f')]())>=0x0&&_0x326b6a[_0xcf1d('0x3a')]!=='custom'){if(_0x326b6a['answer']){_0x2345ea[_0xcf1d('0x1a')]({'type':_0x326b6a[_0xcf1d('0x14')],'app':_0xcf1d('0x21'),'appdata':_0xcf1d('0x3b'),'context':_0x326b6a['context'],'exten':_0x326b6a[_0xcf1d('0xa')],'priority':_0x4d0c79[_0xcf1d('0x2e')]+_0x762ea3['priority']+_0x4faccf++,'VoiceExtensionId':_0x326b6a[_0xcf1d('0x18')]});_0x2345ea[_0xcf1d('0x1a')]({'type':_0x326b6a[_0xcf1d('0x14')],'app':'Set','appdata':_0xcf1d('0x3c'),'context':_0x326b6a[_0xcf1d('0x17')],'exten':_0x326b6a[_0xcf1d('0xa')],'priority':_0x4d0c79['length']+_0x762ea3[_0xcf1d('0x10')]+_0x4faccf++,'VoiceExtensionId':_0x326b6a[_0xcf1d('0x18')]});}else{_0x2345ea[_0xcf1d('0x1a')]({'type':_0x326b6a['type'],'app':_0xcf1d('0x21'),'appdata':_0xcf1d('0x3d'),'context':_0x326b6a[_0xcf1d('0x17')],'exten':_0x326b6a[_0xcf1d('0xa')],'priority':_0x4d0c79[_0xcf1d('0x2e')]+_0x762ea3['priority']+_0x4faccf++,'VoiceExtensionId':_0x326b6a['VoiceExtensionId']});_0x2345ea[_0xcf1d('0x1a')]({'type':_0x326b6a[_0xcf1d('0x14')],'app':_0xcf1d('0x1c'),'appdata':_0xcf1d('0x3e'),'context':_0x326b6a[_0xcf1d('0x17')],'exten':_0x326b6a['exten'],'priority':_0x4d0c79['length']+_0x762ea3[_0xcf1d('0x10')]+_0x4faccf++,'VoiceExtensionId':_0x326b6a[_0xcf1d('0x18')]});}}}for(var _0x7ff7cf=0x0;_0x7ff7cf<_0x4d0c79['length'];_0x7ff7cf+=0x1){var _0x2678af=_0x762ea3[_0xcf1d('0x10')]+_0x4d0c79[_0xcf1d('0x2e')];var _0x4a33d0=_0x7ff7cf===_0x4d0c79[_0xcf1d('0x2e')]-0x1?_0x762ea3[_0xcf1d('0x10')]+_0x2345ea[_0xcf1d('0x2e')]+_0x3122fb[_0xcf1d('0x2e')]+0x2:_0x762ea3['priority']+_0x7ff7cf+0x1;_0x2345ea[_0xcf1d('0x3f')](_0x7ff7cf,0x0,{'type':_0x326b6a[_0xcf1d('0x14')],'app':_0xcf1d('0x40'),'appdata':_0x4d0c79[_0x7ff7cf]+'?'+_0x326b6a[_0xcf1d('0x17')]+_0xcf1d('0x41')+_0x2678af+':'+_0x326b6a[_0xcf1d('0x17')]+_0xcf1d('0x41')+_0x4a33d0,'exten':_0x326b6a[_0xcf1d('0xa')],'context':_0x326b6a[_0xcf1d('0x17')],'priority':_0x762ea3['priority']+_0x7ff7cf,'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});}_0x326b6a[_0xcf1d('0x10')]=_0x2345ea[_0xcf1d('0x2e')]?_[_0xcf1d('0x42')](_0x2345ea)[_0xcf1d('0x10')]+0x1:_0x762ea3[_0xcf1d('0x10')];_0x762ea3[_0xcf1d('0x10')]=(_0x3122fb[_0xcf1d('0x2e')]?_[_0xcf1d('0x42')](_0x3122fb)[_0xcf1d('0x10')]:_0x326b6a[_0xcf1d('0x10')])+0x1;_0x762ea3[_0xcf1d('0x11')]=_[_0xcf1d('0x43')](_0x762ea3['extensions'],_0x2345ea,[_0x326b6a],_0x3122fb);}_0x762ea3[_0xcf1d('0x11')][_0xcf1d('0x1a')]({'type':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x14')],'app':_0xcf1d('0x44'),'exten':_0x3e0d9e[_0x5e1b8b][0x0]['exten'],'context':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x17')],'priority':_0x762ea3[_0xcf1d('0x10')],'VoiceExtensionId':_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]});_0x139c04[_0xcf1d('0x1a')](_0x3e0d9e[_0x5e1b8b][0x0][_0xcf1d('0x18')]);_0x45104e=_[_0xcf1d('0x43')](_0x45104e,_0x762ea3[_0xcf1d('0x11')]);}}return _0x51715d['transaction'](function(_0x2456ed){return _0x51715d[_0xcf1d('0x1')][_0xcf1d('0x5')][_0xcf1d('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x139c04}},'transaction':_0x2456ed})[_0xcf1d('0x7')](function(_0x44e9c6){return _0x51715d[_0xcf1d('0x1')][_0xcf1d('0x5')][_0xcf1d('0x46')](_[_0xcf1d('0x47')](_0x45104e,'priority'),{'transaction':_0x2456ed});});});})[_0xcf1d('0x48')](function(_0x2dd8c8){console[_0xcf1d('0x49')](_0x2dd8c8);});}exports[_0xcf1d('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 cef6066..4a9da31 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 _0xbb3f=['find','Duplicate\x20Contact','CmContact','create','keys','then','length','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','toString','NOW()','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','id\x20IN\x20?','dialCheckDuplicateType','CmList','get','always','VoiceQueueId','onlyIfOpen','sequelize','query','all','findAll','BlackLists','Lists','CampaignId','cmContact,\x20%s,\x20%s','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','null','Missing\x20socket_timestamp\x20parameter!','error','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId'];(function(_0x5d9803,_0x1356fa){var _0x3fd95c=function(_0x4fde84){while(--_0x4fde84){_0x5d9803['push'](_0x5d9803['shift']());}};_0x3fd95c(++_0x1356fa);}(_0xbb3f,0x190));var _0xfbb3=function(_0xaa367d,_0x7888e8){_0xaa367d=_0xaa367d-0x0;var _0x42f24c=_0xbb3f[_0xaa367d];return _0x42f24c;};'use strict';var BPromise=require(_0xfbb3('0x0'));var util=require(_0xfbb3('0x1'));var _=require(_0xfbb3('0x2'));var fs=require('fs');var squel=require(_0xfbb3('0x3'));var Papa=require(_0xfbb3('0x4'));var Redis=require('ioredis');var db=require(_0xfbb3('0x5'))['db'];var config=require(_0xfbb3('0x6'));var logger=require(_0xfbb3('0x7'))(_0xfbb3('0x8'));config[_0xfbb3('0x9')]=_[_0xfbb3('0xa')](config['redis'],{'host':_0xfbb3('0xb'),'port':0x18eb});var socket=require(_0xfbb3('0xc'))(new Redis(config[_0xfbb3('0x9')]));require(_0xfbb3('0xd'))['register'](socket);try{if(!process[_0xfbb3('0xe')][0x2]||process[_0xfbb3('0xe')][0x2]===_0xfbb3('0xf')||process[_0xfbb3('0xe')][0x2]==='null'){throw new Error(_0xfbb3('0x10'));}var FILEPATH=process[_0xfbb3('0xe')][0x2];if(!process[_0xfbb3('0xe')][0x3]||process['argv'][0x3]===_0xfbb3('0xf')||process[_0xfbb3('0xe')][0x3]==='null'||!process[_0xfbb3('0xe')][0x4]||process[_0xfbb3('0xe')][0x4]===_0xfbb3('0xf')||process[_0xfbb3('0xe')][0x4]==='null'){throw new Error(_0xfbb3('0x11'));}var FIELDS=_['zipObject'](process[_0xfbb3('0xe')][0x3]['split'](','),process[_0xfbb3('0xe')][0x4][_0xfbb3('0x12')](','));if(!process[_0xfbb3('0xe')][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xfbb3('0xe')][0x5];var COMPANYID=process[_0xfbb3('0xe')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!==_0xfbb3('0x13')?process[_0xfbb3('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xfbb3('0xe')][0x7]!==_0xfbb3('0xf')&&process[_0xfbb3('0xe')][0x7]!==_0xfbb3('0x13')?process['argv'][0x7]:null;if(!process[_0xfbb3('0xe')][0x8]||process[_0xfbb3('0xe')][0x8]===_0xfbb3('0xf')||process[_0xfbb3('0xe')][0x8]===_0xfbb3('0x13')){throw new Error(_0xfbb3('0x14'));}var SOCKET_TIMESTAMP=process[_0xfbb3('0xe')][0x8];}catch(_0x3e233f){logger[_0xfbb3('0x15')](_0x3e233f);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(_0x385039,_0x421ea4,_0x11d56b,_0x2be243){var _0x47eea2={'message':_0x421ea4};_0x47eea2[_0x385039]=!![];if(_0x11d56b){_0x47eea2[_0xfbb3('0x16')]=_0x11d56b;}if(_0x2be243){_0x47eea2[_0xfbb3('0x17')]=_0x2be243;}return _0x47eea2;}function isEmail(_0x4840ae){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'](_0x4840ae);}function checkRow(_0x462d1f,_0x2e0b7c,_0x225867){return new BPromise(function(_0x38051b,_0x559d73){if(_['isNil'](_0x462d1f)){return _0x559d73(handleCheckRowError(_0xfbb3('0x15'),_0xfbb3('0x18'),null,_0x225867));}if(_0x462d1f[_0xfbb3('0x19')]&&_0x462d1f['errors']['length']){var _0x16800f=_['map'](_0x462d1f[_0xfbb3('0x19')],_0xfbb3('0x1a'))[_0xfbb3('0x1b')](';');return _0x559d73(handleCheckRowError(_0xfbb3('0x15'),_0x16800f,null,_0x225867));}var _0x5493db={};for(var _0x2a7148 in FIELDS){if(FIELDS[_0xfbb3('0x1c')](_0x2a7148)&&FIELDS[_0x2a7148]){_0x5493db[_0x2a7148]=_0x462d1f['data'][0x0][FIELDS[_0x2a7148]]||_0x462d1f[_0xfbb3('0x1d')][0x0]['\ufeff'+FIELDS[_0x2a7148]];}}if(!_0x5493db[_0xfbb3('0x1e')]){return _0x559d73(handleCheckRowError(_0xfbb3('0x15'),_0xfbb3('0x1f'),null,_0x225867));}if(!_0x5493db[_0xfbb3('0x20')]){return _0x559d73(handleCheckRowError(_0xfbb3('0x15'),_0xfbb3('0x21'),null,_0x225867));}if(_0x5493db[_0xfbb3('0x22')]){var _0x551a97=moment(_0x5493db[_0xfbb3('0x22')],_0xfbb3('0x23'));if(!_0x551a97['isValid']()){return _0x559d73(handleCheckRowError(_0xfbb3('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x225867));}}if(_0x5493db[_0xfbb3('0x24')]){if(!isEmail(_0x5493db[_0xfbb3('0x24')])){return _0x559d73(handleCheckRowError(_0xfbb3('0x15'),_0xfbb3('0x25'),null,_0x225867));}}_0x5493db[_0xfbb3('0x26')]=LISTID;_0x5493db[_0xfbb3('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2e0b7c){var _0x5f13f9={};for(var _0x3e41bd=0x0,_0x29ff26=DUPLICATES['length'];_0x3e41bd<_0x29ff26;_0x3e41bd+=0x1){_0x5f13f9[DUPLICATES[_0x3e41bd]]=_0x5493db[DUPLICATES[_0x3e41bd]];}var _0x30f15a=_[_0xfbb3('0x28')](_0x2e0b7c,_0x5f13f9);if(_0x30f15a){return _0x559d73(handleCheckRowError('duplicate',_0xfbb3('0x29'),_0x30f15a,_0x225867));}}return db[_0xfbb3('0x2a')][_0xfbb3('0x2b')](_0x5493db,{'raw':!![],'hooks':![],'fields':_[_0xfbb3('0x2c')](_0x5493db)})[_0xfbb3('0x2d')](function(_0x4ec56b){if(DUPLICATES&&DUPLICATES[_0xfbb3('0x2e')]&&_0x2e0b7c){_0x2e0b7c[_0xfbb3('0x2f')](_[_0xfbb3('0x30')](_0x5493db,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4ec56b['id'];return _0x38051b();})[_0xfbb3('0x31')](function(_0x356be8){return _0x559d73(handleCheckRowError('error',_0xfbb3('0x32')+(_0x356be8[_0xfbb3('0x1a')]||JSON[_0xfbb3('0x33')](_0x356be8)),null,_0x225867));});});}function checkHopper(){function _0x3ee719(){return function(_0x2a590e){logger[_0xfbb3('0x15')](_0xfbb3('0x34'),_0xfbb3('0x35'),util[_0xfbb3('0x36')](_0x2a590e,{'showHidden':![],'depth':null}));};}var _0x3c1f1e=function(_0x3202b5,_0x5be07a){var _0x12398d=squel[_0xfbb3('0x37')]()[_0xfbb3('0x38')](_0xfbb3('0x39'))[_0xfbb3('0x3a')]([_0xfbb3('0x20'),_0xfbb3('0x3b'),_0xfbb3('0x3c'),_0xfbb3('0x26'),_0x5be07a,_0xfbb3('0x3d'),'updatedAt'],squel[_0xfbb3('0x3e')]()[_0xfbb3('0x3f')](_0xfbb3('0x20'),_0xfbb3('0x20'))[_0xfbb3('0x3f')]('NOW()',_0xfbb3('0x3b'))[_0xfbb3('0x3f')]('id','ContactId')[_0xfbb3('0x3f')](LISTID[_0xfbb3('0x40')](),'ListId')[_0xfbb3('0x3f')](_0x3202b5['id'][_0xfbb3('0x40')](),_0x5be07a)[_0xfbb3('0x3f')](_0xfbb3('0x41'),'createdAt')[_0xfbb3('0x3f')]('NOW()',_0xfbb3('0x42'))[_0xfbb3('0x43')](_0xfbb3('0x44'))[_0xfbb3('0x45')](_0xfbb3('0x46'))[_0xfbb3('0x45')]('ListId\x20=\x20?',LISTID[_0xfbb3('0x40')]())[_0xfbb3('0x45')](_0xfbb3('0x47'))['where'](_0xfbb3('0x48'),squel['select']()[_0xfbb3('0x3f')](_0xfbb3('0x20'))['from'](_0xfbb3('0x39'))['where'](_0x5be07a+'\x20=\x20?',_0x3202b5['id'][_0xfbb3('0x40')]())))[_0xfbb3('0x40')]();return _0x12398d;};var _0x407eb0=function(_0x2c38de,_0x2b53bf){var _0x5092cb=squel['insert']()['into']('cm_hopper')[_0xfbb3('0x3a')]([_0xfbb3('0x20'),_0xfbb3('0x3b'),_0xfbb3('0x3c'),_0xfbb3('0x26'),_0x2b53bf,_0xfbb3('0x3d'),'updatedAt'],squel['select']()[_0xfbb3('0x3f')](_0xfbb3('0x20'),_0xfbb3('0x20'))[_0xfbb3('0x3f')](_0xfbb3('0x41'),_0xfbb3('0x3b'))['field']('id',_0xfbb3('0x3c'))[_0xfbb3('0x3f')](LISTID[_0xfbb3('0x40')](),_0xfbb3('0x26'))['field'](_0x2c38de['id'][_0xfbb3('0x40')](),_0x2b53bf)[_0xfbb3('0x3f')](_0xfbb3('0x41'),_0xfbb3('0x3d'))[_0xfbb3('0x3f')](_0xfbb3('0x41'),_0xfbb3('0x42'))['from'](_0xfbb3('0x44'))[_0xfbb3('0x45')](_0xfbb3('0x46'))[_0xfbb3('0x45')]('ListId\x20=\x20?',LISTID[_0xfbb3('0x40')]())[_0xfbb3('0x45')]('id\x20IN\x20?',squel[_0xfbb3('0x49')](hopperContacts))[_0xfbb3('0x45')](_0xfbb3('0x47'))[_0xfbb3('0x45')](_0xfbb3('0x48'),squel[_0xfbb3('0x3e')]()[_0xfbb3('0x3f')](_0xfbb3('0x4a'))[_0xfbb3('0x43')](_0xfbb3('0x4b'))[_0xfbb3('0x45')](_0x2b53bf+_0xfbb3('0x4c'),_0x2c38de['id'][_0xfbb3('0x40')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xfbb3('0x3e')]()[_0xfbb3('0x3f')](_0xfbb3('0x20'))[_0xfbb3('0x43')](_0xfbb3('0x39'))[_0xfbb3('0x45')](_0x2b53bf+_0xfbb3('0x4c'),_0x2c38de['id'][_0xfbb3('0x40')]())))[_0xfbb3('0x40')]();return _0x5092cb;};function _0x244e31(_0x137efc,_0x1f6554){var _0x916457=squel['insert']()['into'](_0xfbb3('0x39'))[_0xfbb3('0x3a')]([_0xfbb3('0x20'),_0xfbb3('0x3b'),_0xfbb3('0x3c'),_0xfbb3('0x26'),_0x1f6554,'createdAt',_0xfbb3('0x42')],squel[_0xfbb3('0x3e')]()[_0xfbb3('0x3f')](_0xfbb3('0x20'),'phone')[_0xfbb3('0x3f')](_0xfbb3('0x41'),_0xfbb3('0x3b'))[_0xfbb3('0x3f')]('id',_0xfbb3('0x3c'))[_0xfbb3('0x3f')](LISTID['toString'](),_0xfbb3('0x26'))[_0xfbb3('0x3f')](_0x137efc['id'][_0xfbb3('0x40')](),_0x1f6554)[_0xfbb3('0x3f')]('NOW()',_0xfbb3('0x3d'))['field'](_0xfbb3('0x41'),_0xfbb3('0x42'))[_0xfbb3('0x43')](_0xfbb3('0x44'))['where'](_0xfbb3('0x46'))[_0xfbb3('0x45')]('ListId\x20=\x20?',LISTID['toString']())[_0xfbb3('0x45')]('id\x20IN\x20?',squel[_0xfbb3('0x49')](hopperContacts))[_0xfbb3('0x45')](_0xfbb3('0x47')))['toString']();return _0x916457;}function _0x155f3d(_0xa4e22d,_0x5759a5){var _0xac0a61=squel[_0xfbb3('0x37')]()[_0xfbb3('0x38')](_0xfbb3('0x4d'))['fromQuery']([_0xfbb3('0x20'),_0xfbb3('0x3c'),_0xfbb3('0x26'),_0x5759a5,_0xfbb3('0x3d'),_0xfbb3('0x42')],squel['select']()[_0xfbb3('0x3f')]('phone',_0xfbb3('0x20'))[_0xfbb3('0x3f')]('id','ContactId')['field'](LISTID[_0xfbb3('0x40')](),'ListId')[_0xfbb3('0x3f')](_0xa4e22d['id'][_0xfbb3('0x40')](),_0x5759a5)[_0xfbb3('0x3f')](_0xfbb3('0x41'),_0xfbb3('0x3d'))[_0xfbb3('0x3f')](_0xfbb3('0x41'),_0xfbb3('0x42'))[_0xfbb3('0x43')](_0xfbb3('0x44'))[_0xfbb3('0x45')]('deletedAt\x20IS\x20NULL')[_0xfbb3('0x45')](_0xfbb3('0x4e'),LISTID[_0xfbb3('0x40')]())[_0xfbb3('0x45')](_0xfbb3('0x4f'),squel[_0xfbb3('0x49')](hopperContacts))[_0xfbb3('0x45')](_0xfbb3('0x47')))[_0xfbb3('0x40')]();return _0xac0a61;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xfbb3('0x50')],'include':[{'model':db[_0xfbb3('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xfbb3('0x2d')](function(_0x2e34b2){var _0x3994e8=[];if(_0x2e34b2){var _0x5cd1bf;for(var _0x4d3d66=0x0,_0xab1ad0;_0x4d3d66<_0x2e34b2[_0xfbb3('0x2e')];_0x4d3d66+=0x1){_0xab1ad0=_0x2e34b2[_0x4d3d66][_0xfbb3('0x52')]({'plain':!![]});switch(_0xab1ad0[_0xfbb3('0x50')]){case _0xfbb3('0x53'):_0x3994e8[_0xfbb3('0x2f')](db['sequelize']['query'](_0x407eb0(_0xab1ad0,_0xfbb3('0x54')))[_0xfbb3('0x2d')](function(){})['catch'](_0x3ee719()));break;case _0xfbb3('0x55'):_0x3994e8[_0xfbb3('0x2f')](db[_0xfbb3('0x56')][_0xfbb3('0x57')](_0x3c1f1e(_0xab1ad0,_0xfbb3('0x54')))[_0xfbb3('0x2d')](function(){})[_0xfbb3('0x31')](_0x3ee719()));break;default:_0x3994e8[_0xfbb3('0x2f')](db[_0xfbb3('0x56')]['query'](_0x244e31(_0xab1ad0,_0xfbb3('0x54')))[_0xfbb3('0x2d')](function(){})[_0xfbb3('0x31')](_0x3ee719()));}}}return _0x3994e8;})[_0xfbb3('0x58')]()[_0xfbb3('0x2d')](function(){return db['VoiceQueue'][_0xfbb3('0x59')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xfbb3('0x51')],'as':_0xfbb3('0x5a'),'where':{'id':LISTID}}]})[_0xfbb3('0x2d')](function(_0x16d9f2){var _0x566358=[];if(_0x16d9f2){var _0x557f96;for(var _0x1019a3=0x0,_0x5305aa;_0x1019a3<_0x16d9f2[_0xfbb3('0x2e')];_0x1019a3+=0x1){_0x5305aa=_0x16d9f2[_0x1019a3][_0xfbb3('0x52')]({'plain':!![]});_0x566358['push'](db[_0xfbb3('0x56')][_0xfbb3('0x57')](_0x155f3d(_0x5305aa,_0xfbb3('0x54')))[_0xfbb3('0x2d')](function(){})[_0xfbb3('0x31')](_0x3ee719()));}}return _0x566358;})[_0xfbb3('0x58')]();})['then'](function(){return db['Campaign'][_0xfbb3('0x59')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xfbb3('0x51')],'as':_0xfbb3('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x420df9){var _0x462041=[];if(_0x420df9){for(var _0x17d426=0x0,_0x3c39ea;_0x17d426<_0x420df9['length'];_0x17d426+=0x1){_0x3c39ea=_0x420df9[_0x17d426][_0xfbb3('0x52')]({'plain':!![]});switch(_0x3c39ea[_0xfbb3('0x50')]){case _0xfbb3('0x53'):_0x462041['push'](db[_0xfbb3('0x56')][_0xfbb3('0x57')](_0x407eb0(_0x3c39ea,_0xfbb3('0x5c')))[_0xfbb3('0x2d')](function(){})['catch'](_0x3ee719()));break;case _0xfbb3('0x55'):_0x462041[_0xfbb3('0x2f')](db[_0xfbb3('0x56')][_0xfbb3('0x57')](_0x3c1f1e(_0x3c39ea,_0xfbb3('0x5c')))[_0xfbb3('0x2d')](function(){})['catch'](_0x3ee719()));break;default:_0x462041[_0xfbb3('0x2f')](db[_0xfbb3('0x56')]['query'](_0x244e31(_0x3c39ea,_0xfbb3('0x5c')))[_0xfbb3('0x2d')](function(){})[_0xfbb3('0x31')](_0x3ee719()));}}}return _0x462041;})[_0xfbb3('0x58')]();})[_0xfbb3('0x2d')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0xfbb3('0x51')],'as':_0xfbb3('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x5ec485){var _0x2083f9=[];if(_0x5ec485){for(var _0x5dfd23=0x0,_0x5d38e1;_0x5dfd23<_0x5ec485['length'];_0x5dfd23+=0x1){_0x5d38e1=_0x5ec485[_0x5dfd23][_0xfbb3('0x52')]({'plain':!![]});_0x2083f9[_0xfbb3('0x2f')](db['sequelize']['query'](_0x155f3d(_0x5d38e1,_0xfbb3('0x5c')))[_0xfbb3('0x2d')](function(){})['catch'](_0x3ee719()));}}return _0x2083f9;})[_0xfbb3('0x58')]();})[_0xfbb3('0x31')](function(_0x59b6f5){logger[_0xfbb3('0x15')](_0xfbb3('0x5d'),'generalCheckHopper',_0x59b6f5[_0xfbb3('0x1a')]);});}var processPromises=function(_0x57188c){return BPromise[_0xfbb3('0x58')](promises)[_0xfbb3('0x2d')](function(_0x51d32d){})[_0xfbb3('0x31')](function(_0x41322f){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0xfbb3('0x33')](_0x41322f));})[_0xfbb3('0x5e')](function(){socket[_0xfbb3('0x5f')](_0xfbb3('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57188c){return _0x57188c[_0xfbb3('0x61')]();}});};var endCsv=function(){return BPromise[_0xfbb3('0x62')]()[_0xfbb3('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xfbb3('0x2d')](function(){socket[_0xfbb3('0x5f')](_0xfbb3('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xfbb3('0x63')](FILEPATH);}catch(_0x4770d0){logger[_0xfbb3('0x15')](_0xfbb3('0x64'),JSON[_0xfbb3('0x33')](_0x4770d0));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0xfbb3('0x65')](_0xfbb3('0x66'));endCsv();});function main(){return BPromise[_0xfbb3('0x62')]()[_0xfbb3('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xfbb3('0x12')](',');return db[_0xfbb3('0x2a')][_0xfbb3('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xfbb3('0x2d')](function(_0x143f74){var _0x1fdc01=fs[_0xfbb3('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfbb3('0x68')](_0x1fdc01,{'header':!![],'skipEmptyLines':!![],'step':function(_0x41f74b,_0x4fa962){total+=0x1;var _0x2025c5=total;promises['push'](checkRow(_0x41f74b,_0x143f74,_0x2025c5)[_0xfbb3('0x2d')](function(){success+=0x1;})[_0xfbb3('0x31')](function(_0xe693dd){if(_0xe693dd[_0xfbb3('0x15')]){errors+=0x1;delete _0xe693dd['error'];}else if(_0xe693dd[_0xfbb3('0x69')]){duplicates+=0x1;delete _0xe693dd[_0xfbb3('0x69')];}rows['push'](_0xe693dd);}));if(total%0xc8===0x0){_0x4fa962[_0xfbb3('0x6a')]();return processPromises(_0x4fa962);}},'complete':function(){return processPromises()[_0xfbb3('0x2d')](function(){logger[_0xfbb3('0x65')](_0xfbb3('0x6b'));endCsv();});},'error':function(_0x43fa8d,_0x5b0cfd){logger[_0xfbb3('0x65')](_0xfbb3('0x6c'),JSON['stringify'](_0x43fa8d));endCsv();}});})[_0xfbb3('0x31')](function(_0x3ab1e5){logger['error'](_0xfbb3('0x6d'),JSON[_0xfbb3('0x33')](_0x3ab1e5));});}main(); \ No newline at end of file +var _0x6c8a=['emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','Lists','get','always','push','sequelize','query','VoiceQueueId','then','all','findAll','BlackLists','CmList','CampaignId','onlyIfOpen','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resolve'];(function(_0x5e89d8,_0x30a21a){var _0x5c1153=function(_0x2dcba0){while(--_0x2dcba0){_0x5e89d8['push'](_0x5e89d8['shift']());}};_0x5c1153(++_0x30a21a);}(_0x6c8a,0x158));var _0xa6c8=function(_0x2425b1,_0x28cb80){_0x2425b1=_0x2425b1-0x0;var _0xfd228f=_0x6c8a[_0x2425b1];return _0xfd228f;};'use strict';var BPromise=require('bluebird');var util=require(_0xa6c8('0x0'));var _=require(_0xa6c8('0x1'));var fs=require('fs');var squel=require(_0xa6c8('0x2'));var Papa=require(_0xa6c8('0x3'));var Redis=require(_0xa6c8('0x4'));var db=require(_0xa6c8('0x5'))['db'];var config=require(_0xa6c8('0x6'));var logger=require(_0xa6c8('0x7'))(_0xa6c8('0x8'));config['redis']=_[_0xa6c8('0x9')](config[_0xa6c8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6c8('0xa')]));require(_0xa6c8('0xb'))[_0xa6c8('0xc')](socket);try{if(!process['argv'][0x2]||process[_0xa6c8('0xd')][0x2]===_0xa6c8('0xe')||process[_0xa6c8('0xd')][0x2]===_0xa6c8('0xf')){throw new Error(_0xa6c8('0x10'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xa6c8('0xd')][0x3]===_0xa6c8('0xe')||process['argv'][0x3]===_0xa6c8('0xf')||!process[_0xa6c8('0xd')][0x4]||process[_0xa6c8('0xd')][0x4]==='undefined'||process[_0xa6c8('0xd')][0x4]===_0xa6c8('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xa6c8('0x11')](process[_0xa6c8('0xd')][0x3][_0xa6c8('0x12')](','),process[_0xa6c8('0xd')][0x4][_0xa6c8('0x12')](','));if(!process['argv'][0x5]||process[_0xa6c8('0xd')][0x5]===_0xa6c8('0xe')||process['argv'][0x5]===_0xa6c8('0xf')){throw new Error(_0xa6c8('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xa6c8('0xd')][0x6]&&process[_0xa6c8('0xd')][0x6]!=='undefined'&&process[_0xa6c8('0xd')][0x6]!=='null'?process[_0xa6c8('0xd')][0x6]:null;var DUPLICATES=process[_0xa6c8('0xd')][0x7]&&process[_0xa6c8('0xd')][0x7]!==_0xa6c8('0xe')&&process[_0xa6c8('0xd')][0x7]!==_0xa6c8('0xf')?process['argv'][0x7]:null;if(!process[_0xa6c8('0xd')][0x8]||process['argv'][0x8]===_0xa6c8('0xe')||process['argv'][0x8]==='null'){throw new Error(_0xa6c8('0x14'));}var SOCKET_TIMESTAMP=process[_0xa6c8('0xd')][0x8];}catch(_0x5e031c){logger[_0xa6c8('0x15')](_0x5e031c);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(_0x22174b,_0xe0fe35,_0x5c15d8,_0x4508e0){var _0x4b1719={'message':_0xe0fe35};_0x4b1719[_0x22174b]=!![];if(_0x5c15d8){_0x4b1719[_0xa6c8('0x16')]=_0x5c15d8;}if(_0x4508e0){_0x4b1719['index']=_0x4508e0;}return _0x4b1719;}function isEmail(_0x26834e){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))*$/[_0xa6c8('0x17')](_0x26834e);}function checkRow(_0x157a4f,_0x1523a3,_0x2474ad){return new BPromise(function(_0x56dc6c,_0x4a79b9){if(_[_0xa6c8('0x18')](_0x157a4f)){return _0x4a79b9(handleCheckRowError(_0xa6c8('0x15'),_0xa6c8('0x19'),null,_0x2474ad));}if(_0x157a4f['errors']&&_0x157a4f[_0xa6c8('0x1a')][_0xa6c8('0x1b')]){var _0x2b82c5=_['map'](_0x157a4f['errors'],_0xa6c8('0x1c'))[_0xa6c8('0x1d')](';');return _0x4a79b9(handleCheckRowError(_0xa6c8('0x15'),_0x2b82c5,null,_0x2474ad));}var _0x57ac01={};for(var _0x1850c8 in FIELDS){if(FIELDS[_0xa6c8('0x1e')](_0x1850c8)&&FIELDS[_0x1850c8]){_0x57ac01[_0x1850c8]=_0x157a4f[_0xa6c8('0x1f')][0x0][FIELDS[_0x1850c8]]||_0x157a4f[_0xa6c8('0x1f')][0x0]['\ufeff'+FIELDS[_0x1850c8]];}}if(!_0x57ac01['firstName']){return _0x4a79b9(handleCheckRowError(_0xa6c8('0x15'),_0xa6c8('0x20'),null,_0x2474ad));}if(!_0x57ac01['phone']){return _0x4a79b9(handleCheckRowError('error',_0xa6c8('0x21'),null,_0x2474ad));}if(_0x57ac01['birthDate']){var _0x12a2d0=moment(_0x57ac01[_0xa6c8('0x22')],_0xa6c8('0x23'));if(!_0x12a2d0[_0xa6c8('0x24')]()){return _0x4a79b9(handleCheckRowError(_0xa6c8('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2474ad));}}if(_0x57ac01['email']){if(!isEmail(_0x57ac01[_0xa6c8('0x25')])){return _0x4a79b9(handleCheckRowError(_0xa6c8('0x15'),_0xa6c8('0x26'),null,_0x2474ad));}}_0x57ac01[_0xa6c8('0x27')]=LISTID;_0x57ac01[_0xa6c8('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1523a3){var _0x4a44f6={};for(var _0x5a9a65=0x0,_0x3c7cdc=DUPLICATES[_0xa6c8('0x1b')];_0x5a9a65<_0x3c7cdc;_0x5a9a65+=0x1){_0x4a44f6[DUPLICATES[_0x5a9a65]]=_0x57ac01[DUPLICATES[_0x5a9a65]];}var _0x55b328=_[_0xa6c8('0x29')](_0x1523a3,_0x4a44f6);if(_0x55b328){return _0x4a79b9(handleCheckRowError(_0xa6c8('0x2a'),_0xa6c8('0x2b'),_0x55b328,_0x2474ad));}}return db[_0xa6c8('0x2c')]['create'](_0x57ac01,{'raw':!![],'hooks':![],'fields':_[_0xa6c8('0x2d')](_0x57ac01)})['then'](function(_0x2e7c8e){if(DUPLICATES&&DUPLICATES[_0xa6c8('0x1b')]&&_0x1523a3){_0x1523a3['push'](_['pick'](_0x57ac01,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2e7c8e['id'];return _0x56dc6c();})[_0xa6c8('0x2e')](function(_0x511d10){return _0x4a79b9(handleCheckRowError('error',_0xa6c8('0x2f')+(_0x511d10[_0xa6c8('0x1c')]||JSON[_0xa6c8('0x30')](_0x511d10)),null,_0x2474ad));});});}function checkHopper(){function _0x5b7ef5(){return function(_0x46f5a6){logger['error'](_0xa6c8('0x31'),_0xa6c8('0x32'),util[_0xa6c8('0x33')](_0x46f5a6,{'showHidden':![],'depth':null}));};}var _0x5838af=function(_0x5862ca,_0x5cc9a5){var _0x59dfbb=squel[_0xa6c8('0x34')]()[_0xa6c8('0x35')](_0xa6c8('0x36'))[_0xa6c8('0x37')]([_0xa6c8('0x38'),_0xa6c8('0x39'),_0xa6c8('0x3a'),_0xa6c8('0x27'),_0x5cc9a5,_0xa6c8('0x3b'),_0xa6c8('0x3c')],squel['select']()[_0xa6c8('0x3d')](_0xa6c8('0x38'),_0xa6c8('0x38'))[_0xa6c8('0x3d')]('NOW()',_0xa6c8('0x39'))['field']('id',_0xa6c8('0x3a'))[_0xa6c8('0x3d')](LISTID['toString'](),_0xa6c8('0x27'))[_0xa6c8('0x3d')](_0x5862ca['id'][_0xa6c8('0x3e')](),_0x5cc9a5)[_0xa6c8('0x3d')](_0xa6c8('0x3f'),_0xa6c8('0x3b'))['field'](_0xa6c8('0x3f'),'updatedAt')[_0xa6c8('0x40')](_0xa6c8('0x41'))['where'](_0xa6c8('0x42'))[_0xa6c8('0x43')](_0xa6c8('0x44'),LISTID[_0xa6c8('0x3e')]())[_0xa6c8('0x43')](_0xa6c8('0x45'))[_0xa6c8('0x43')](_0xa6c8('0x46'),squel[_0xa6c8('0x47')]()['field'](_0xa6c8('0x38'))['from'](_0xa6c8('0x36'))[_0xa6c8('0x43')](_0x5cc9a5+_0xa6c8('0x48'),_0x5862ca['id'][_0xa6c8('0x3e')]())))[_0xa6c8('0x3e')]();return _0x59dfbb;};var _0x541fbe=function(_0x32dd1a,_0x5e941d){var _0x284502=squel[_0xa6c8('0x34')]()[_0xa6c8('0x35')]('cm_hopper')[_0xa6c8('0x37')](['phone',_0xa6c8('0x39'),_0xa6c8('0x3a'),_0xa6c8('0x27'),_0x5e941d,_0xa6c8('0x3b'),_0xa6c8('0x3c')],squel[_0xa6c8('0x47')]()[_0xa6c8('0x3d')](_0xa6c8('0x38'),_0xa6c8('0x38'))[_0xa6c8('0x3d')](_0xa6c8('0x3f'),'scheduledAt')[_0xa6c8('0x3d')]('id',_0xa6c8('0x3a'))[_0xa6c8('0x3d')](LISTID[_0xa6c8('0x3e')](),_0xa6c8('0x27'))['field'](_0x32dd1a['id'][_0xa6c8('0x3e')](),_0x5e941d)[_0xa6c8('0x3d')](_0xa6c8('0x3f'),_0xa6c8('0x3b'))[_0xa6c8('0x3d')](_0xa6c8('0x3f'),_0xa6c8('0x3c'))[_0xa6c8('0x40')](_0xa6c8('0x41'))['where'](_0xa6c8('0x42'))['where'](_0xa6c8('0x44'),LISTID[_0xa6c8('0x3e')]())['where'](_0xa6c8('0x49'),squel[_0xa6c8('0x4a')](hopperContacts))['where'](_0xa6c8('0x45'))[_0xa6c8('0x43')](_0xa6c8('0x46'),squel[_0xa6c8('0x47')]()[_0xa6c8('0x3d')]('calleridnum')[_0xa6c8('0x40')](_0xa6c8('0x4b'))[_0xa6c8('0x43')](_0x5e941d+_0xa6c8('0x48'),_0x32dd1a['id'][_0xa6c8('0x3e')]()))[_0xa6c8('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa6c8('0x47')]()[_0xa6c8('0x3d')](_0xa6c8('0x38'))[_0xa6c8('0x40')](_0xa6c8('0x36'))['where'](_0x5e941d+_0xa6c8('0x48'),_0x32dd1a['id'][_0xa6c8('0x3e')]())))['toString']();return _0x284502;};function _0x524a79(_0x1b2dac,_0x279970){var _0x3fb6ca=squel[_0xa6c8('0x34')]()[_0xa6c8('0x35')](_0xa6c8('0x36'))['fromQuery'](['phone','scheduledAt',_0xa6c8('0x3a'),_0xa6c8('0x27'),_0x279970,_0xa6c8('0x3b'),_0xa6c8('0x3c')],squel['select']()[_0xa6c8('0x3d')]('phone',_0xa6c8('0x38'))[_0xa6c8('0x3d')]('NOW()',_0xa6c8('0x39'))['field']('id','ContactId')[_0xa6c8('0x3d')](LISTID[_0xa6c8('0x3e')](),'ListId')[_0xa6c8('0x3d')](_0x1b2dac['id'][_0xa6c8('0x3e')](),_0x279970)[_0xa6c8('0x3d')](_0xa6c8('0x3f'),'createdAt')[_0xa6c8('0x3d')](_0xa6c8('0x3f'),'updatedAt')[_0xa6c8('0x40')]('cm_contacts')[_0xa6c8('0x43')]('deletedAt\x20IS\x20NULL')[_0xa6c8('0x43')](_0xa6c8('0x44'),LISTID[_0xa6c8('0x3e')]())[_0xa6c8('0x43')](_0xa6c8('0x49'),squel[_0xa6c8('0x4a')](hopperContacts))[_0xa6c8('0x43')](_0xa6c8('0x45')))[_0xa6c8('0x3e')]();return _0x3fb6ca;}function _0x2f4745(_0x123361,_0x13d04f){var _0x1a3d12=squel[_0xa6c8('0x34')]()['into'](_0xa6c8('0x4c'))[_0xa6c8('0x37')]([_0xa6c8('0x38'),_0xa6c8('0x3a'),'ListId',_0x13d04f,'createdAt',_0xa6c8('0x3c')],squel[_0xa6c8('0x47')]()[_0xa6c8('0x3d')](_0xa6c8('0x38'),'phone')[_0xa6c8('0x3d')]('id',_0xa6c8('0x3a'))[_0xa6c8('0x3d')](LISTID[_0xa6c8('0x3e')](),_0xa6c8('0x27'))[_0xa6c8('0x3d')](_0x123361['id']['toString'](),_0x13d04f)[_0xa6c8('0x3d')](_0xa6c8('0x3f'),'createdAt')['field'](_0xa6c8('0x3f'),_0xa6c8('0x3c'))['from'](_0xa6c8('0x41'))[_0xa6c8('0x43')](_0xa6c8('0x42'))[_0xa6c8('0x43')](_0xa6c8('0x44'),LISTID[_0xa6c8('0x3e')]())[_0xa6c8('0x43')](_0xa6c8('0x49'),squel[_0xa6c8('0x4a')](hopperContacts))[_0xa6c8('0x43')](_0xa6c8('0x45')))['toString']();return _0x1a3d12;}return db[_0xa6c8('0x4d')]['findAll']({'where':{'type':_0xa6c8('0x4e')},'attributes':['id',_0xa6c8('0x4f')],'include':[{'model':db['CmList'],'as':_0xa6c8('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x1f0e60){var _0xa34007=[];if(_0x1f0e60){var _0x1b12fa;for(var _0x3fc2ad=0x0,_0x382cb7;_0x3fc2ad<_0x1f0e60[_0xa6c8('0x1b')];_0x3fc2ad+=0x1){_0x382cb7=_0x1f0e60[_0x3fc2ad][_0xa6c8('0x51')]({'plain':!![]});switch(_0x382cb7['dialCheckDuplicateType']){case _0xa6c8('0x52'):_0xa34007[_0xa6c8('0x53')](db[_0xa6c8('0x54')][_0xa6c8('0x55')](_0x541fbe(_0x382cb7,_0xa6c8('0x56')))['then'](function(){})[_0xa6c8('0x2e')](_0x5b7ef5()));break;case'onlyIfOpen':_0xa34007['push'](db[_0xa6c8('0x54')][_0xa6c8('0x55')](_0x5838af(_0x382cb7,'VoiceQueueId'))['then'](function(){})[_0xa6c8('0x2e')](_0x5b7ef5()));break;default:_0xa34007[_0xa6c8('0x53')](db[_0xa6c8('0x54')]['query'](_0x524a79(_0x382cb7,_0xa6c8('0x56')))[_0xa6c8('0x57')](function(){})['catch'](_0x5b7ef5()));}}}return _0xa34007;})[_0xa6c8('0x58')]()[_0xa6c8('0x57')](function(){return db[_0xa6c8('0x4d')][_0xa6c8('0x59')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xa6c8('0x5a'),'where':{'id':LISTID}}]})[_0xa6c8('0x57')](function(_0x5b76f0){var _0x1a6459=[];if(_0x5b76f0){var _0x424d72;for(var _0x5a7de1=0x0,_0x3cf529;_0x5a7de1<_0x5b76f0['length'];_0x5a7de1+=0x1){_0x3cf529=_0x5b76f0[_0x5a7de1]['get']({'plain':!![]});_0x1a6459[_0xa6c8('0x53')](db['sequelize']['query'](_0x2f4745(_0x3cf529,_0xa6c8('0x56')))[_0xa6c8('0x57')](function(){})[_0xa6c8('0x2e')](_0x5b7ef5()));}}return _0x1a6459;})[_0xa6c8('0x58')]();})[_0xa6c8('0x57')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xa6c8('0x4f')],'include':[{'model':db[_0xa6c8('0x5b')],'as':_0xa6c8('0x50'),'where':{'id':LISTID}}]})[_0xa6c8('0x57')](function(_0x285319){var _0xa31012=[];if(_0x285319){for(var _0x3dd3f4=0x0,_0x1f9b3c;_0x3dd3f4<_0x285319[_0xa6c8('0x1b')];_0x3dd3f4+=0x1){_0x1f9b3c=_0x285319[_0x3dd3f4][_0xa6c8('0x51')]({'plain':!![]});switch(_0x1f9b3c[_0xa6c8('0x4f')]){case _0xa6c8('0x52'):_0xa31012[_0xa6c8('0x53')](db[_0xa6c8('0x54')][_0xa6c8('0x55')](_0x541fbe(_0x1f9b3c,_0xa6c8('0x5c')))[_0xa6c8('0x57')](function(){})[_0xa6c8('0x2e')](_0x5b7ef5()));break;case _0xa6c8('0x5d'):_0xa31012['push'](db['sequelize']['query'](_0x5838af(_0x1f9b3c,'CampaignId'))['then'](function(){})['catch'](_0x5b7ef5()));break;default:_0xa31012[_0xa6c8('0x53')](db['sequelize']['query'](_0x524a79(_0x1f9b3c,_0xa6c8('0x5c')))[_0xa6c8('0x57')](function(){})[_0xa6c8('0x2e')](_0x5b7ef5()));}}}return _0xa31012;})[_0xa6c8('0x58')]();})[_0xa6c8('0x57')](function(){return db[_0xa6c8('0x5e')][_0xa6c8('0x59')]({'attributes':['id'],'include':[{'model':db[_0xa6c8('0x5b')],'as':_0xa6c8('0x5a'),'where':{'id':LISTID}}]})[_0xa6c8('0x57')](function(_0x57e03c){var _0x700786=[];if(_0x57e03c){for(var _0x3f3fa9=0x0,_0x19d73c;_0x3f3fa9<_0x57e03c[_0xa6c8('0x1b')];_0x3f3fa9+=0x1){_0x19d73c=_0x57e03c[_0x3f3fa9][_0xa6c8('0x51')]({'plain':!![]});_0x700786[_0xa6c8('0x53')](db[_0xa6c8('0x54')][_0xa6c8('0x55')](_0x2f4745(_0x19d73c,_0xa6c8('0x5c')))[_0xa6c8('0x57')](function(){})[_0xa6c8('0x2e')](_0x5b7ef5()));}}return _0x700786;})['all']();})['catch'](function(_0x425ed9){logger[_0xa6c8('0x15')]('cmContact,\x20%s,\x20%s',_0xa6c8('0x5f'),_0x425ed9[_0xa6c8('0x1c')]);});}var processPromises=function(_0x23d4eb){return BPromise[_0xa6c8('0x58')](promises)[_0xa6c8('0x57')](function(_0x5e8bea){})[_0xa6c8('0x2e')](function(_0x58745c){logger[_0xa6c8('0x15')](_0xa6c8('0x60'),JSON['stringify'](_0x58745c));})[_0xa6c8('0x61')](function(){socket['emit'](_0xa6c8('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x23d4eb){return _0x23d4eb['resume']();}});};var endCsv=function(){return BPromise[_0xa6c8('0x63')]()[_0xa6c8('0x57')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xa6c8('0x64')](_0xa6c8('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa6c8('0x65')](FILEPATH);}catch(_0x248c7e){logger[_0xa6c8('0x15')](_0xa6c8('0x66'),JSON[_0xa6c8('0x30')](_0x248c7e));}finally{process[_0xa6c8('0x67')](0x0);}});};process['on']('SIGINT',function(){logger[_0xa6c8('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xa6c8('0x63')]()[_0xa6c8('0x57')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa6c8('0x12')](',');return db[_0xa6c8('0x2c')][_0xa6c8('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa6c8('0x57')](function(_0x3f3bc7){var _0x548818=fs[_0xa6c8('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa6c8('0x6a')](_0x548818,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1d6fa1,_0x5a285e){total+=0x1;var _0x20f123=total;promises[_0xa6c8('0x53')](checkRow(_0x1d6fa1,_0x3f3bc7,_0x20f123)[_0xa6c8('0x57')](function(){success+=0x1;})['catch'](function(_0x431f98){if(_0x431f98[_0xa6c8('0x15')]){errors+=0x1;delete _0x431f98[_0xa6c8('0x15')];}else if(_0x431f98[_0xa6c8('0x2a')]){duplicates+=0x1;delete _0x431f98[_0xa6c8('0x2a')];}rows[_0xa6c8('0x53')](_0x431f98);}));if(total%0xc8===0x0){_0x5a285e[_0xa6c8('0x6b')]();return processPromises(_0x5a285e);}},'complete':function(){return processPromises()[_0xa6c8('0x57')](function(){logger['info'](_0xa6c8('0x6c'));endCsv();});},'error':function(_0x42356c,_0x26e5b6){logger['info'](_0xa6c8('0x6d'),JSON[_0xa6c8('0x30')](_0x42356c));endCsv();}});})['catch'](function(_0x47bf46){logger['error'](_0xa6c8('0x6e'),JSON[_0xa6c8('0x30')](_0x47bf46));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e163a70..75fd9b7 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 _0xc247=['voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','error','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','findAll','name','_description','writeFileSync','parse','data','rows','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','replace','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','\x20LIKE\x20cm_contacts;','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','length','all','split','push','isNil','filter','CmContactHasItem','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','ContactId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.updatedAt','cm_contacts.priority','into','createdAt','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','message','exit','errors','code','sequelize','query','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','spread','voice_queues.id','voice_queues.dialTimezone'];(function(_0xf4050f,_0xefc6bb){var _0x42baab=function(_0x571abb){while(--_0x571abb){_0xf4050f['push'](_0xf4050f['shift']());}};_0x42baab(++_0xefc6bb);}(_0xc247,0xfe));var _0x7c24=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0xc247[_0x5447aa];return _0xb21e53;};'use strict';var fs=require('fs');var path=require(_0x7c24('0x0'));var _=require(_0x7c24('0x1'));var Papa=require(_0x7c24('0x2'));var util=require('util');var BPromise=require(_0x7c24('0x3'));var moment=require(_0x7c24('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x7c24('0x5'))['db'];var config=require(_0x7c24('0x6'));var shared=require(_0x7c24('0x7'));var logger=require(_0x7c24('0x8'))(_0x7c24('0x9'));config[_0x7c24('0xa')]=_[_0x7c24('0xb')](config[_0x7c24('0xa')],{'host':_0x7c24('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c24('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()[_0x7c24('0xd')](_0x7c24('0xe'));function isEmail(_0x2ac59e){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))*$/[_0x7c24('0xf')](_0x2ac59e);}function selectNotIn(_0x53e203,_0x2174b8,_0x5bc989,_0x15a11a,_0x382959){return squel[_0x7c24('0x10')]()['field'](_0x7c24('0x11'))[_0x7c24('0x12')](_0x15a11a)[_0x7c24('0x13')](_0x2174b8,null,_0x2174b8+_0x7c24('0x14')+_0x15a11a+'.'+_0x5bc989)['where'](_0x15a11a+'.'+_0x5bc989+'\x20=\x20'+_0x53e203+'.'+_0x5bc989)[_0x7c24('0x15')](_0x2174b8+_0x7c24('0x16')+_0x382959[_0x7c24('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24d143,_0x159986){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x7c24('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7c24('0x18')](function(_0x53474f){if(_0x53474f!==null){var _0x18459a=[];for(var _0x28febe=0x0;_0x28febe<_0x53474f[_0x7c24('0x19')];_0x28febe++){var _0x27803e=_0x53474f[_0x28febe];_0x18459a['push'](insertAdditionalPhones(_0x27803e));}}Promise[_0x7c24('0x1a')](_0x18459a)[_0x7c24('0x18')](function(){_0x24d143({'val':0x1});});});});}function insertAdditionalPhones(_0x29db21){return new Promise(function(_0x179d2b,_0x2c5ba1){var _0x567630=_0x29db21[_0x7c24('0x17')];var _0x53e577=_0x567630[_0x7c24('0x1b')](';');var _0x22e23a=[];orderBy=0x0;for(var _0x58272a=0x0;_0x58272a<_0x53e577['length'];_0x58272a++){_0x22e23a[_0x7c24('0x1c')](splitAdditionalPhone(_0x29db21['id'],_0x53e577[_0x58272a]));}Promise[_0x7c24('0x1a')](_0x22e23a)[_0x7c24('0x18')](function(){_0x179d2b({'val':_0x53e577[_0x7c24('0x19')]});});});}function splitAdditionalPhone(_0x4bcf7e,_0x221d8e){return new Promise(function(_0x425ee7,_0x3b98a6){var _0x1bfccf=_0x221d8e[_0x7c24('0x1b')](':');var _0x76a231=_0x1bfccf[0x0];var _0x569897=_0x1bfccf[0x1];if(!_[_0x7c24('0x1d')](_0x569897)){var _0x216909=_0x569897[_0x7c24('0x1b')]('|');var _0x41aa40=[];for(var _0x4198ca=0x0;_0x4198ca<_0x216909[_0x7c24('0x19')];_0x4198ca++){if(_0x216909[_0x4198ca]!==''){var _0xe1b5f9=_[_0x7c24('0x1e')](promisesAdditionalPhones,{'contactId':_0x4bcf7e,'phone':_0x216909[_0x4198ca]});if(_0xe1b5f9[_0x7c24('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x7c24('0x1c')]({'contactId':_0x4bcf7e,'contactTypeId':_0x76a231,'phone':_0x216909[_0x4198ca],'orderBy':orderBy});}}}_0x425ee7({'ok':0x1});}else _0x425ee7({'res':0x0});});}function createAdditionalPhone(_0x472882,_0x21b640,_0x24c02c,_0x31bfc7){var _0x27e078='';var _0x38fde7='';var _0xdcd9b9=_0x24c02c['split']('§');_0x27e078=_0xdcd9b9[0x0];if(_0xdcd9b9[_0x7c24('0x19')]==0x2)_0x38fde7=_0xdcd9b9[0x1];return new Promise(function(_0x370f72,_0x288297){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x472882,'item':_0x27e078}})[_0x7c24('0x18')](function(_0x465b56){if(_0x465b56){return db[_0x7c24('0x1f')]['update']({'ItemTypeId':_0x21b640,'description':_0x38fde7,'OrderBy':_0x31bfc7},{'where':{'CmContactId':_0x472882,'item':_0x27e078}})['then'](function(_0x1f1717){_0x370f72({'res':_0x7c24('0x20')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x472882,'item':_0x27e078,'description':_0x38fde7,'ItemTypeId':_0x21b640,'OrderBy':_0x31bfc7,'ItemClass':_0x7c24('0x21')})[_0x7c24('0x18')](function(_0x4a8f46){_0x370f72({'res':_0x7c24('0x22')});});}});});}function insertCmHopper(_0xff666c,_0x52711c,_0x47908c,_0x565e9b,_0x46d864){var _0x15afe4=[_0x7c24('0x23'),_0x7c24('0x24'),_0x7c24('0x25'),_0x7c24('0x26'),_0x52711c+'.'+_0x565e9b,_0x7c24('0x27'),'cm_contacts.updatedAt','cm_contacts.priority',_0x7c24('0x28'),'\x22'+_0x46d864+'\x22'];return squel[_0x7c24('0x29')]()['into'](_0x7c24('0x2a'))[_0x7c24('0x2b')]([_0x7c24('0x11'),_0x7c24('0x2c'),'ContactId',_0x7c24('0x2d'),_0x565e9b,'createdAt',_0x7c24('0x2e'),_0x7c24('0x2f'),_0x7c24('0x30'),_0x7c24('0x31')],squel[_0x7c24('0x10')]()[_0x7c24('0x32')](_0x15afe4)[_0x7c24('0x12')](_0x52711c)['join'](_0x7c24('0x33'),null,_0x7c24('0x34')+_0x52711c+_0x7c24('0x35'))[_0x7c24('0x13')](_0x47908c,null,_0x47908c+_0x7c24('0x14')+_0x52711c+'.'+_0x565e9b)[_0x7c24('0x15')](_0x52711c+'.CmListId\x20=\x20?',_0xff666c)[_0x7c24('0x15')](_0x7c24('0x36'),NOW)[_0x7c24('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x52711c,_0x47908c,_0x565e9b,_0x7c24('0x2a'),[_0x7c24('0x37'),_0x7c24('0x38')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x52711c,_0x47908c,_0x565e9b,_0x7c24('0x2a'),[_0x7c24('0x37')])))[_0x7c24('0x39')]();}function insertCmHopperBlack(_0x47928d,_0x46c9be,_0x1707a3,_0x4f3b71){var _0x2df690=[_0x7c24('0x23'),'cm_contacts.id',_0x7c24('0x26'),_0x46c9be+'.'+_0x4f3b71,_0x7c24('0x27'),'cm_contacts.updatedAt'];return squel[_0x7c24('0x29')]()['into']('cm_hopper_black')['fromQuery']([_0x7c24('0x11'),_0x7c24('0x3a'),_0x7c24('0x2d'),_0x4f3b71,'createdAt',_0x7c24('0x2e')],squel[_0x7c24('0x10')]()[_0x7c24('0x32')](_0x2df690)[_0x7c24('0x12')](_0x46c9be)[_0x7c24('0x13')]('cm_contacts',null,_0x7c24('0x34')+_0x46c9be+_0x7c24('0x35'))[_0x7c24('0x13')](_0x1707a3,null,_0x1707a3+'.id\x20=\x20'+_0x46c9be+'.'+_0x4f3b71)['where'](_0x46c9be+_0x7c24('0x3b'),_0x47928d)[_0x7c24('0x15')](_0x7c24('0x36'),NOW)[_0x7c24('0x15')](_0x7c24('0x3c'),squel[_0x7c24('0x10')]()[_0x7c24('0x3d')](_0x7c24('0x11'))[_0x7c24('0x12')](_0x7c24('0x3e'))[_0x7c24('0x15')](_0x7c24('0x3f'),_0x47928d)[_0x7c24('0x15')](_0x4f3b71+_0x7c24('0x40')+_0x46c9be+'.'+_0x4f3b71)))['toString']();}function insertTzCmHopper(_0xe52c7,_0x974b06,_0x41f8fd,_0x55d29b,_0x535017,_0x417ebc){var _0x1e23d8=[_0x7c24('0x23'),_0x7c24('0x41')+_0x417ebc+'.offset-cm_contacts.utcOffset\x20minute)',_0x7c24('0x25'),_0x7c24('0x26'),_0x974b06+'.'+_0x55d29b,_0x7c24('0x27'),_0x7c24('0x42'),_0x7c24('0x43'),_0x7c24('0x28'),'\x22'+_0x535017+'\x22'];var _0x31f7d5=squel[_0x7c24('0x29')]()[_0x7c24('0x44')]('cm_hopper')[_0x7c24('0x2b')]([_0x7c24('0x11'),_0x7c24('0x2c'),_0x7c24('0x3a'),_0x7c24('0x2d'),_0x55d29b,_0x7c24('0x45'),_0x7c24('0x2e'),_0x7c24('0x2f'),_0x7c24('0x30'),'recallme'],squel[_0x7c24('0x10')]()[_0x7c24('0x32')](_0x1e23d8)[_0x7c24('0x12')](_0x974b06)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x974b06+_0x7c24('0x35'))['join'](_0x41f8fd,null,_0x41f8fd+_0x7c24('0x14')+_0x974b06+'.'+_0x55d29b)[_0x7c24('0x13')](_0x417ebc,null,_0x417ebc+_0x7c24('0x14')+_0x974b06+'.'+_0x55d29b)['where'](_0x974b06+_0x7c24('0x3b'),_0xe52c7)[_0x7c24('0x15')](_0x7c24('0x36'),NOW)[_0x7c24('0x15')](_0x7c24('0x3c'),selectNotIn(_0x974b06,_0x41f8fd,_0x55d29b,_0x7c24('0x2a'),['\x22always\x22',_0x7c24('0x38')]))[_0x7c24('0x15')](_0x7c24('0x3c'),selectNotIn(_0x974b06,_0x41f8fd,_0x55d29b,'cm_hopper',[_0x7c24('0x37')])))['toString']();return _0x31f7d5;}function insertTzCmHopperBlack(_0x382642,_0x9f6619,_0x485faf,_0x1dd724){var _0xc26ecf=[_0x7c24('0x23'),_0x7c24('0x25'),_0x7c24('0x26'),_0x9f6619+'.'+_0x1dd724,_0x7c24('0x27'),_0x7c24('0x42')];return squel[_0x7c24('0x29')]()[_0x7c24('0x44')](_0x7c24('0x3e'))[_0x7c24('0x2b')]([_0x7c24('0x11'),_0x7c24('0x3a'),_0x7c24('0x2d'),_0x1dd724,_0x7c24('0x45'),_0x7c24('0x2e')],squel['select']()['fields'](_0xc26ecf)[_0x7c24('0x12')](_0x9f6619)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x9f6619+'.CmListId')['join'](_0x485faf,null,_0x485faf+'.id\x20=\x20'+_0x9f6619+'.'+_0x1dd724)[_0x7c24('0x15')](_0x9f6619+'.CmListId\x20=\x20?',_0x382642)[_0x7c24('0x15')](_0x7c24('0x36'),NOW)['where'](_0x7c24('0x3c'),squel[_0x7c24('0x10')]()[_0x7c24('0x3d')]('phone')[_0x7c24('0x12')](_0x7c24('0x3e'))[_0x7c24('0x15')](_0x7c24('0x3f'),_0x382642)['where'](_0x1dd724+'\x20=\x20'+_0x9f6619+'.'+_0x1dd724)))[_0x7c24('0x39')]();}function insertCmHopperAdditionalPhones(_0x18cc13){var _0x43a2b9=['cm_hopper.id',_0x7c24('0x46'),_0x7c24('0x47'),_0x7c24('0x48'),_0x7c24('0x49')];return squel[_0x7c24('0x29')]()[_0x7c24('0x44')](_0x7c24('0x4a'))['fromQuery']([_0x7c24('0x4b'),_0x7c24('0x11'),'OrderBy',_0x7c24('0x45'),_0x7c24('0x2e')],squel[_0x7c24('0x10')]()[_0x7c24('0x32')](_0x43a2b9)[_0x7c24('0x12')](_0x7c24('0x2a'))[_0x7c24('0x13')](_0x7c24('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x7c24('0x13')](_0x7c24('0x4c'),null,_0x7c24('0x4d'))[_0x7c24('0x15')](_0x7c24('0x4e'),_0x18cc13)[_0x7c24('0x15')](_0x7c24('0x36'),NOW))[_0x7c24('0x39')]();}function insertCmContact(_0x3e4e33,_0x5e42fb,_0x4d0d66,_0x2a8d61){var _0x28b0d1=_[_0x7c24('0x4f')](_[_0x7c24('0x50')](_0x2a8d61),[_0x7c24('0x2d'),'CompanyId','createdAt',_0x7c24('0x2e')]);return squel[_0x7c24('0x29')]()[_0x7c24('0x44')](_0x7c24('0x33'))[_0x7c24('0x2b')](_0x28b0d1,squel[_0x7c24('0x10')]()[_0x7c24('0x32')](_0x28b0d1)[_0x7c24('0x12')](_0x5e42fb)[_0x7c24('0x15')]('('+_0x4d0d66[_0x7c24('0x13')](',')+_0x7c24('0x51'),squel[_0x7c24('0x10')]()['fields'](_0x4d0d66)[_0x7c24('0x12')]('cm_contacts')[_0x7c24('0x15')](_0x7c24('0x3f'),_0x3e4e33)[_0x7c24('0x15')](_0x7c24('0x52')))['where'](_0x7c24('0x53'),squel[_0x7c24('0x10')]()[_0x7c24('0x3d')](_0x7c24('0x54'),'min_id')[_0x7c24('0x12')](_0x5e42fb)[_0x7c24('0x55')](_0x4d0d66[_0x7c24('0x13')](','))))['toString']();}function handleStop(){logger[_0x7c24('0x56')](_0x7c24('0x57'));stopped=!![];}function handleUncaughtException(_0x563079){logger['error'](_0x563079[_0x7c24('0x58')]);process[_0x7c24('0x59')](0x1);}function handleError(_0x507bbb,_0x536f86){stats[_0x7c24('0x5a')]['push']({'name':_0x536f86[_0x7c24('0x5b')],'message':_0x536f86[_0x7c24('0x58')],'row':_0x507bbb});}function handleQuery(_0x403adf){logger[_0x7c24('0x56')](_0x403adf);return db[_0x7c24('0x5c')][_0x7c24('0x5d')](_0x403adf)['spread'](function(_0x15a564){results['push'](_0x15a564);})[_0x7c24('0x5e')](function(_0x4c5107){logger['error'](_0x4c5107[_0x7c24('0x58')]);});}function updateTzCampaigns(_0x428c7e){return new Promise(function(_0x2b9316,_0x32fcab){var _0x4b4ad6=squel[_0x7c24('0x10')]()[_0x7c24('0x32')]([_0x7c24('0x5f'),'campaigns.dialTimezone'])[_0x7c24('0x12')](_0x7c24('0x60'))[_0x7c24('0x13')](_0x7c24('0x61'),null,_0x7c24('0x62'))[_0x7c24('0x15')]('campaigns_has_cm_lists.CmListId='+_0x428c7e);db[_0x7c24('0x5c')][_0x7c24('0x5d')](_0x4b4ad6[_0x7c24('0x39')]())[_0x7c24('0x63')](function(_0x2eefb6){var _0x15908f=[];for(var _0x2c2ca0=0x0;_0x2c2ca0<_0x2eefb6[_0x7c24('0x19')];_0x2c2ca0++){_0x15908f[_0x7c24('0x1c')](getTimezoneData(_0x2eefb6[_0x2c2ca0],tmp_campaigns));}BPromise[_0x7c24('0x1a')](_0x15908f)[_0x7c24('0x18')](function(){_0x2b9316({'val':0x1});});})[_0x7c24('0x5e')](function(_0x4480ad){logger['error'](_0x4480ad[_0x7c24('0x58')]);_0x2b9316({'val':0x0});});});}function updateTzVoiceQueues(_0x49d6f3){return new Promise(function(_0x194b93,_0x4a5d79){var _0x40387a=squel['select']()['fields']([_0x7c24('0x64'),_0x7c24('0x65')])[_0x7c24('0x12')](_0x7c24('0x66'))[_0x7c24('0x13')](_0x7c24('0x67'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x7c24('0x15')](_0x7c24('0x68')+_0x49d6f3);db[_0x7c24('0x5c')]['query'](_0x40387a[_0x7c24('0x39')]())['spread'](function(_0x1d05d2){var _0x94655f=[];for(var _0x4d57fb=0x0;_0x4d57fb<_0x1d05d2['length'];_0x4d57fb++){_0x94655f[_0x7c24('0x1c')](getTimezoneData(_0x1d05d2[_0x4d57fb],tmp_voice_queues));}BPromise[_0x7c24('0x1a')](_0x94655f)[_0x7c24('0x18')](function(){_0x194b93({'val':0x1});});})[_0x7c24('0x5e')](function(_0x111547){logger['error'](_0x111547[_0x7c24('0x58')]);_0x194b93({'val':0x0});});});}function getTimezoneData(_0x398ab2,_0x3b7fb2){return new Promise(function(_0x51631a,_0x5e473a){var _0xa96c51=shared[_0x7c24('0x69')];var _0x4dec12=_0xa96c51[_0x398ab2[_0x7c24('0x6a')]];if(_[_0x7c24('0x1d')](_0x4dec12)){_0x51631a({'ret':0x1});}else{var _0x11079a=_0x4dec12[_0x7c24('0x6b')];var _0x3512d2=squel[_0x7c24('0x29')]()[_0x7c24('0x44')](_0x3b7fb2)['set']('id',_0x398ab2['id'])[_0x7c24('0x6c')](_0x7c24('0x6d'),_0x11079a)[_0x7c24('0x6c')](_0x7c24('0x6a'),_0x398ab2[_0x7c24('0x6a')])[_0x7c24('0x39')]();return db['sequelize'][_0x7c24('0x5d')](_0x3512d2)[_0x7c24('0x63')](function(_0x14a976){_0x51631a({'ret':0x1});})[_0x7c24('0x5e')](function(_0x189ed0){logger[_0x7c24('0x6e')](_0x189ed0[_0x7c24('0x58')]);_0x5e473a({'ret':0x1});});}});}function handleTZQuery(_0x221261){logger[_0x7c24('0x56')](_0x221261);return db['sequelize'][_0x7c24('0x5d')](_0x221261)['spread'](function(_0x5e90ca){})[_0x7c24('0x5e')](function(_0x2e8cb8){logger[_0x7c24('0x6e')](_0x2e8cb8[_0x7c24('0x58')]);});}function main(_0x12fe61,_0x17b5c3,_0x287269,_0x44456b){logger[_0x7c24('0x56')]('main',_0x12fe61,JSON[_0x7c24('0x6f')](_0x17b5c3));process[_0x7c24('0x70')](_0x7c24('0x71'));var _0x5942b0=_0x17b5c3[_0x7c24('0x72')];var _0xef989d=_[_0x7c24('0x73')](_0x5942b0);var _0x2b3e54=_0x17b5c3[_0x7c24('0x74')];var _0x4d85d0=path[_0x7c24('0x13')](config['root'],_0x7c24('0x75'),_0x2b3e54+_0x7c24('0x76'));hasTZ=_[_0x7c24('0x50')](_0x5942b0)[_0x7c24('0x77')](_0x7c24('0x6a'));var _0xc6f803=_[_0x7c24('0x50')](_0x5942b0)['join']();logger[_0x7c24('0x56')](_0x7c24('0x78'),_0xc6f803);db[_0x7c24('0x79')][_0x7c24('0x7a')]({'raw':!![],'attributes':['id',_0x7c24('0x7b')]})['then'](function(_0x272dd6){for(var _0x360231=0x0;_0x360231<_0x272dd6[_0x7c24('0x19')];_0x360231++){if(_0x272dd6[_0x360231]['name']in _0x5942b0){contactItemTypes[_0x7c24('0x1c')](_0x272dd6[_0x360231]);delete _0xef989d[_0x272dd6[_0x360231][_0x7c24('0x7b')]];hasAdditionalPhones=!![];}for(var _0x2a0bb9 in _0x5942b0){if(_0x272dd6[_0x360231]['name']+_0x7c24('0x7c')===_0x2a0bb9){phoneDescriptions[_0x7c24('0x1c')]({'itemTypeId':_0x272dd6[_0x360231]['id'],'description':_0x2a0bb9});delete _0xef989d[_0x2a0bb9];}}}if(hasAdditionalPhones)_0xef989d['AdditionalPhones']='';var _0x37e909=_['keys'](_0xef989d)[_0x7c24('0x13')]();logger[_0x7c24('0x56')]('header',_0x37e909);fs[_0x7c24('0x7d')](_0x4d85d0,_0x37e909+'\x0a');Papa[_0x7c24('0x7e')](fs['createReadStream'](_0x12fe61),{'header':!![],'skipEmptyLines':!![],'step':function(_0x38f12b,_0x437ae1){try{for(var _0x422159=0x0,_0x133ea6=[];_0x422159<_0x38f12b[_0x7c24('0x7f')][_0x7c24('0x19')];_0x422159++){stats[_0x7c24('0x80')]+=0x1;if(_0x38f12b[_0x7c24('0x5a')][_0x422159]){handleError(_0x38f12b[_0x7c24('0x7f')][_0x422159],_0x38f12b[_0x7c24('0x5a')][_0x422159]);}else{var _0x403c45=[];var _0x2d3538=[];var _0x242816={};for(var _0xed2748 in _0x5942b0){let _0x743bc4=contactItemTypes[_0x7c24('0x81')](_0x523efb=>_0x523efb[_0x7c24('0x7b')]===_0xed2748);let _0x92c28a=contactItemTypes[_0x7c24('0x81')](_0x23106d=>_0x23106d[_0x7c24('0x7b')]+'_description'===_0xed2748);if(_[_0x7c24('0x1d')](_0x743bc4)&&_[_0x7c24('0x1d')](_0x92c28a)){if(_0x5942b0['hasOwnProperty'](_0xed2748)){if(_0x38f12b[_0x7c24('0x7f')][_0x422159][_0x5942b0[_0xed2748]]){var _0xac408f=_[_0x7c24('0x82')](_0x38f12b[_0x7c24('0x7f')][_0x422159][_0x5942b0[_0xed2748]]['replace'](/"/g,'\x27'));switch(_0xed2748){case _0x7c24('0x2c'):var _0x586cca=moment(_0xac408f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x586cca[_0x7c24('0x83')]()){_0x133ea6['push']('\x22'+_0xac408f+'\x22');}else{_0x403c45[_0x7c24('0x1c')](_0x7c24('0x84'));}break;case'priority':var _0x32f0d4=parseInt(_0xac408f);_0xac408f=_[_0x7c24('0x85')](_0x32f0d4)||_0x32f0d4<0x0||_0x32f0d4>0x4?_0x44456b?0x3:0x2:_0x32f0d4;_0x133ea6['push']('\x22'+_0xac408f+'\x22');break;case _0x7c24('0x30'):var _0x5970f3=parseInt(_0xac408f);if(_['isNumber'](_0x5970f3)&&_[_0x7c24('0x77')](_0x287269,_0x5970f3)){_0x133ea6[_0x7c24('0x1c')]('\x22'+_0x5970f3+'\x22');}else{_0x403c45[_0x7c24('0x1c')]('agent\x20not\x20exists');}break;case _0x7c24('0x86'):if(isEmail(_0xac408f)){_0x133ea6[_0x7c24('0x1c')]('\x22'+_0xac408f+'\x22');}else{_0x403c45[_0x7c24('0x1c')](_0x7c24('0x87'));}break;case'dateOfBirth':var _0x35a114=moment(_0xac408f,_0x7c24('0x88'),!![]);if(_0x35a114[_0x7c24('0x83')]()){_0x133ea6[_0x7c24('0x1c')]('\x22'+_0xac408f+'\x22');}else{_0x403c45[_0x7c24('0x1c')](_0x7c24('0x89'));}break;case _0x7c24('0x6a'):var _0x1e1b06=shared[_0x7c24('0x69')];var _0x108a21=_0x1e1b06[_0xac408f];if(!_[_0x7c24('0x1d')](_0x108a21)){var _0x60c98e=_0x108a21[_0x7c24('0x6b')];_0x133ea6[_0x7c24('0x1c')]('\x22'+_0xac408f+'\x22');_0x133ea6[_0x7c24('0x1c')]('\x22'+_0x60c98e+'\x22');}break;default:_0x133ea6['push']('\x22'+_0xac408f+'\x22');}}else{switch(_0xed2748){case _0x7c24('0x8a'):case'phone':_0x403c45[_0x7c24('0x1c')](_0xed2748+'\x20not\x20specified');break;default:_0x133ea6['push']('\x22\x22');}}}}else{var _0x472a9f='';if(!_[_0x7c24('0x1d')](_0x743bc4)){if(!_0x242816[_0x7c24('0x8b')](_0x743bc4['id'])){if(!_[_0x7c24('0x1d')](_0x38f12b[_0x7c24('0x7f')][_0x422159][_0x5942b0[_0xed2748]])){var _0xac408f=_['trim'](_0x38f12b[_0x7c24('0x7f')][_0x422159][_0x5942b0[_0xed2748]][_0x7c24('0x8c')](/"/g,'\x27'));var _0x28fbfe=phoneDescriptions[_0x7c24('0x81')](_0x1012e3=>_0x1012e3['itemTypeId']===_0x743bc4['id']);if(!_[_0x7c24('0x1d')](_0x28fbfe)){var _0x5f0eb4=_[_0x7c24('0x82')](_0x38f12b['data'][_0x422159][_0x5942b0[_0x28fbfe['description']]]['replace'](/"/g,'\x27'));if(!_[_0x7c24('0x1d')](_0x5f0eb4))_0xac408f=_0xac408f+'§'+_0x5f0eb4;}if(_0x472a9f=='')_0x472a9f=_0xac408f;else _0x472a9f+='|'+_0xac408f;}_0x2d3538[_0x7c24('0x1c')](_0x743bc4['id']+':'+_0x472a9f);_0x242816[_0x743bc4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x133ea6[_0x7c24('0x1c')]('\x22'+_0x2d3538[_0x7c24('0x13')](';')+'\x22');}if(_0x403c45[_0x7c24('0x19')]){handleError(_0x38f12b[_0x7c24('0x7f')][_0x422159],{'code':'SystemRow','message':_0x403c45['join']()});}else{fs['appendFileSync'](_0x4d85d0,_0x133ea6[_0x7c24('0x13')]()+'\x0a');}_0x133ea6=[];}if(!(stats[_0x7c24('0x80')]%0xc8)){socket[_0x7c24('0x8d')](_0x7c24('0x8e')+_0x2b3e54,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7c24('0x8f'));_0x437ae1[_0x7c24('0x90')]();}}catch(_0x1a572a){handleError(_0x38f12b[_0x7c24('0x7f')][_0x422159],{'code':_0x7c24('0x91'),'message':_0x1a572a[_0x7c24('0x58')]});logger[_0x7c24('0x6e')](_0x7c24('0x92'),_0x1a572a[_0x7c24('0x58')]);}},'complete':function(){try{var _0x55696b=[];var _0x1c761b=[];var _0x165126=_0x7c24('0x33');if(_0x17b5c3[_0x7c24('0x93')]&&_0x17b5c3[_0x7c24('0x93')]['length']){_0x165126='cm_contacts_'+_0x2b3e54;_0x55696b[_0x7c24('0x1c')]('CREATE\x20TABLE\x20'+_0x165126+_0x7c24('0x94'));}tmp_campaigns='campaigns_'+_0x2b3e54;tmp_voice_queues='voice_queues_'+_0x2b3e54;_0x1c761b[_0x7c24('0x1c')](_0x7c24('0x95')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x1c761b['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x7c24('0x96'));BPromise[_0x7c24('0x97')](_0x1c761b,handleTZQuery)[_0x7c24('0x18')](function(_0xffacdf){updateTzCampaigns(_0x17b5c3[_0x7c24('0x2d')])[_0x7c24('0x18')](function(_0x481e7e){updateTzVoiceQueues(_0x17b5c3[_0x7c24('0x2d')])['then'](function(_0x34ca81){if(hasTZ)_0x37e909=_0x37e909[_0x7c24('0x8c')](_0x7c24('0x6a'),'dialTimezone,utcOffset');var _0x4ecc7d=util[_0x7c24('0xd')](_0x7c24('0x98'),_0x4d85d0,_0x165126,_0x37e909,_0x17b5c3[_0x7c24('0x2d')],_0x17b5c3[_0x7c24('0x99')]||null,NOW,NOW);if(_[_0x7c24('0x1d')](_0x5942b0[_0x7c24('0x2c')])){_0x4ecc7d+=_0x7c24('0x9a');}_0x55696b[_0x7c24('0x1c')](_0x4ecc7d);if(_0x17b5c3['duplicates']&&_0x17b5c3[_0x7c24('0x93')][_0x7c24('0x19')]){_0x55696b['push'](insertCmContact(_0x17b5c3[_0x7c24('0x2d')],_0x165126,_0x17b5c3[_0x7c24('0x93')],_0x5942b0));_0x55696b['push'](_0x7c24('0x9b')+_0x165126+';');}BPromise[_0x7c24('0x97')](_0x55696b,handleQuery)[_0x7c24('0x18')](function(_0x334d06){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x55696b=[];for(var _0x9773b=0x0;_0x9773b\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','push','split','length','all','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.createdAt','cm_hopper_black','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','error','message','errors','code','info','query','spread','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize'];(function(_0x1710d4,_0x3846d7){var _0x1f11ee=function(_0x35b595){while(--_0x35b595){_0x1710d4['push'](_0x1710d4['shift']());}};_0x1f11ee(++_0x3846d7);}(_0x2481,0x119));var _0x1248=function(_0x21920b,_0x48ea7d){_0x21920b=_0x21920b-0x0;var _0x41c04e=_0x2481[_0x21920b];return _0x41c04e;};'use strict';var fs=require('fs');var path=require(_0x1248('0x0'));var _=require(_0x1248('0x1'));var Papa=require(_0x1248('0x2'));var util=require(_0x1248('0x3'));var BPromise=require(_0x1248('0x4'));var moment=require(_0x1248('0x5'));var squel=require(_0x1248('0x6'));var Redis=require(_0x1248('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x1248('0x8'));var shared=require(_0x1248('0x9'));var logger=require(_0x1248('0xa'))('import');config[_0x1248('0xb')]=_[_0x1248('0xc')](config['redis'],{'host':_0x1248('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1248('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x1248('0xe')](_0x1248('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x1248('0xe')](_0x1248('0xf'));function isEmail(_0x44d0df){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))*$/[_0x1248('0x10')](_0x44d0df);}function selectNotIn(_0x4716c7,_0xa3d2b4,_0x2c4703,_0x397503,_0x1c009c){return squel[_0x1248('0x11')]()[_0x1248('0x12')](_0x1248('0x13'))[_0x1248('0x14')](_0x397503)[_0x1248('0x15')](_0xa3d2b4,null,_0xa3d2b4+_0x1248('0x16')+_0x397503+'.'+_0x2c4703)[_0x1248('0x17')](_0x397503+'.'+_0x2c4703+_0x1248('0x18')+_0x4716c7+'.'+_0x2c4703)[_0x1248('0x17')](_0xa3d2b4+_0x1248('0x19')+_0x1c009c[_0x1248('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2b2282,_0x57578d){promisesAdditionalPhones=[];return db[_0x1248('0x1a')]['findAll']({'raw':!![],'attributes':['id',_0x1248('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x1248('0x1c')](function(_0x5e70e6){if(_0x5e70e6!==null){var _0x5b0034=[];for(var _0x342afb=0x0;_0x342afb<_0x5e70e6['length'];_0x342afb++){var _0x1a7941=_0x5e70e6[_0x342afb];_0x5b0034[_0x1248('0x1d')](insertAdditionalPhones(_0x1a7941));}}Promise['all'](_0x5b0034)[_0x1248('0x1c')](function(){_0x2b2282({'val':0x1});});});});}function insertAdditionalPhones(_0x237769){return new Promise(function(_0x7f0a3c,_0x189073){var _0x21dce0=_0x237769['AdditionalPhones'];var _0x5100f3=_0x21dce0[_0x1248('0x1e')](';');var _0x2d6f18=[];orderBy=0x0;for(var _0x264e13=0x0;_0x264e13<_0x5100f3[_0x1248('0x1f')];_0x264e13++){_0x2d6f18[_0x1248('0x1d')](splitAdditionalPhone(_0x237769['id'],_0x5100f3[_0x264e13]));}Promise[_0x1248('0x20')](_0x2d6f18)[_0x1248('0x1c')](function(){_0x7f0a3c({'val':_0x5100f3[_0x1248('0x1f')]});});});}function splitAdditionalPhone(_0x3b7fea,_0x39c93f){return new Promise(function(_0x3c4782,_0x586b52){var _0x4a1819=_0x39c93f['split'](':');var _0xacea0b=_0x4a1819[0x0];var _0x17ef60=_0x4a1819[0x1];if(!_[_0x1248('0x21')](_0x17ef60)){var _0x588da4=_0x17ef60[_0x1248('0x1e')]('|');var _0x3f4c15=[];for(var _0x390625=0x0;_0x390625<_0x588da4[_0x1248('0x1f')];_0x390625++){if(_0x588da4[_0x390625]!==''){var _0x156e4b=_[_0x1248('0x22')](promisesAdditionalPhones,{'contactId':_0x3b7fea,'phone':_0x588da4[_0x390625]});if(_0x156e4b['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3b7fea,'contactTypeId':_0xacea0b,'phone':_0x588da4[_0x390625],'orderBy':orderBy});}}}_0x3c4782({'ok':0x1});}else _0x3c4782({'res':0x0});});}function createAdditionalPhone(_0xdfb646,_0x37798f,_0x3934af,_0x4963ca){var _0x1ab983='';var _0x4a1696='';var _0x5f3de0=_0x3934af['split']('§');_0x1ab983=_0x5f3de0[0x0];if(_0x5f3de0['length']==0x2)_0x4a1696=_0x5f3de0[0x1];return new Promise(function(_0x1864b4,_0x3215f7){return db[_0x1248('0x23')][_0x1248('0x24')]({'where':{'CmContactId':_0xdfb646,'item':_0x1ab983}})[_0x1248('0x1c')](function(_0x13d273){if(_0x13d273){return db[_0x1248('0x23')]['update']({'ItemTypeId':_0x37798f,'description':_0x4a1696,'OrderBy':_0x4963ca},{'where':{'CmContactId':_0xdfb646,'item':_0x1ab983}})[_0x1248('0x1c')](function(_0x480e3a){_0x1864b4({'res':_0x1248('0x25')});});}else{return db[_0x1248('0x23')][_0x1248('0x26')]({'CmContactId':_0xdfb646,'item':_0x1ab983,'description':_0x4a1696,'ItemTypeId':_0x37798f,'OrderBy':_0x4963ca,'ItemClass':_0x1248('0x27')})[_0x1248('0x1c')](function(_0x687bf0){_0x1864b4({'res':'inserted'});});}});});}function insertCmHopper(_0x18fd52,_0xb6e32b,_0x18f30c,_0x2f36e6,_0x839522){var _0x31616f=[_0x1248('0x28'),_0x1248('0x29'),_0x1248('0x2a'),'cm_contacts.ListId',_0xb6e32b+'.'+_0x2f36e6,'cm_contacts.createdAt',_0x1248('0x2b'),_0x1248('0x2c'),_0x1248('0x2d'),'\x22'+_0x839522+'\x22'];return squel[_0x1248('0x2e')]()[_0x1248('0x2f')](_0x1248('0x30'))[_0x1248('0x31')]([_0x1248('0x13'),_0x1248('0x32'),_0x1248('0x33'),_0x1248('0x34'),_0x2f36e6,_0x1248('0x35'),_0x1248('0x36'),_0x1248('0x37'),_0x1248('0x38'),_0x1248('0x39')],squel['select']()[_0x1248('0x3a')](_0x31616f)['from'](_0xb6e32b)[_0x1248('0x15')](_0x1248('0x3b'),null,_0x1248('0x3c')+_0xb6e32b+_0x1248('0x3d'))[_0x1248('0x15')](_0x18f30c,null,_0x18f30c+_0x1248('0x16')+_0xb6e32b+'.'+_0x2f36e6)[_0x1248('0x17')](_0xb6e32b+_0x1248('0x3e'),_0x18fd52)['where'](_0x1248('0x3f'),NOW)[_0x1248('0x17')](_0x1248('0x40'),selectNotIn(_0xb6e32b,_0x18f30c,_0x2f36e6,'cm_hopper',[_0x1248('0x41'),'\x22onlyIfOpen\x22']))[_0x1248('0x17')](_0x1248('0x40'),selectNotIn(_0xb6e32b,_0x18f30c,_0x2f36e6,_0x1248('0x30'),[_0x1248('0x41')])))['toString']();}function insertCmHopperBlack(_0x3db1ff,_0xb34674,_0x14ae84,_0x1ed25f){var _0x4b09c=[_0x1248('0x28'),_0x1248('0x2a'),'cm_contacts.ListId',_0xb34674+'.'+_0x1ed25f,_0x1248('0x42'),_0x1248('0x2b')];return squel[_0x1248('0x2e')]()['into'](_0x1248('0x43'))['fromQuery']([_0x1248('0x13'),_0x1248('0x33'),'ListId',_0x1ed25f,_0x1248('0x35'),_0x1248('0x36')],squel[_0x1248('0x11')]()[_0x1248('0x3a')](_0x4b09c)[_0x1248('0x14')](_0xb34674)[_0x1248('0x15')](_0x1248('0x3b'),null,_0x1248('0x3c')+_0xb34674+_0x1248('0x3d'))[_0x1248('0x15')](_0x14ae84,null,_0x14ae84+_0x1248('0x16')+_0xb34674+'.'+_0x1ed25f)[_0x1248('0x17')](_0xb34674+_0x1248('0x3e'),_0x3db1ff)['where'](_0x1248('0x3f'),NOW)[_0x1248('0x17')](_0x1248('0x40'),squel[_0x1248('0x11')]()['field']('phone')[_0x1248('0x14')]('cm_hopper_black')[_0x1248('0x17')](_0x1248('0x44'),_0x3db1ff)[_0x1248('0x17')](_0x1ed25f+_0x1248('0x18')+_0xb34674+'.'+_0x1ed25f)))[_0x1248('0x45')]();}function insertTzCmHopper(_0x24744a,_0x4c2260,_0x212bc3,_0x473f64,_0x289d2d,_0x4713d1){var _0x266de5=[_0x1248('0x28'),_0x1248('0x46')+_0x4713d1+_0x1248('0x47'),_0x1248('0x2a'),_0x1248('0x48'),_0x4c2260+'.'+_0x473f64,_0x1248('0x42'),_0x1248('0x2b'),'cm_contacts.priority',_0x1248('0x2d'),'\x22'+_0x289d2d+'\x22'];var _0x5a9be1=squel[_0x1248('0x2e')]()['into']('cm_hopper')[_0x1248('0x31')]([_0x1248('0x13'),_0x1248('0x32'),_0x1248('0x33'),'ListId',_0x473f64,'createdAt','updatedAt',_0x1248('0x37'),_0x1248('0x38'),'recallme'],squel['select']()[_0x1248('0x3a')](_0x266de5)['from'](_0x4c2260)[_0x1248('0x15')](_0x1248('0x3b'),null,_0x1248('0x3c')+_0x4c2260+_0x1248('0x3d'))['join'](_0x212bc3,null,_0x212bc3+_0x1248('0x16')+_0x4c2260+'.'+_0x473f64)[_0x1248('0x15')](_0x4713d1,null,_0x4713d1+_0x1248('0x16')+_0x4c2260+'.'+_0x473f64)[_0x1248('0x17')](_0x4c2260+'.CmListId\x20=\x20?',_0x24744a)['where'](_0x1248('0x3f'),NOW)[_0x1248('0x17')](_0x1248('0x40'),selectNotIn(_0x4c2260,_0x212bc3,_0x473f64,_0x1248('0x30'),[_0x1248('0x41'),_0x1248('0x49')]))[_0x1248('0x17')](_0x1248('0x40'),selectNotIn(_0x4c2260,_0x212bc3,_0x473f64,_0x1248('0x30'),[_0x1248('0x41')])))[_0x1248('0x45')]();return _0x5a9be1;}function insertTzCmHopperBlack(_0x103ffc,_0x3e0330,_0x27878b,_0x13e63f){var _0x5efa52=[_0x1248('0x28'),_0x1248('0x2a'),_0x1248('0x48'),_0x3e0330+'.'+_0x13e63f,_0x1248('0x42'),'cm_contacts.updatedAt'];return squel['insert']()[_0x1248('0x2f')]('cm_hopper_black')[_0x1248('0x31')]([_0x1248('0x13'),_0x1248('0x33'),'ListId',_0x13e63f,_0x1248('0x35'),_0x1248('0x36')],squel[_0x1248('0x11')]()[_0x1248('0x3a')](_0x5efa52)[_0x1248('0x14')](_0x3e0330)[_0x1248('0x15')](_0x1248('0x3b'),null,_0x1248('0x3c')+_0x3e0330+'.CmListId')[_0x1248('0x15')](_0x27878b,null,_0x27878b+_0x1248('0x16')+_0x3e0330+'.'+_0x13e63f)[_0x1248('0x17')](_0x3e0330+'.CmListId\x20=\x20?',_0x103ffc)[_0x1248('0x17')](_0x1248('0x3f'),NOW)[_0x1248('0x17')](_0x1248('0x40'),squel[_0x1248('0x11')]()['field'](_0x1248('0x13'))[_0x1248('0x14')](_0x1248('0x43'))[_0x1248('0x17')](_0x1248('0x44'),_0x103ffc)[_0x1248('0x17')](_0x13e63f+_0x1248('0x18')+_0x3e0330+'.'+_0x13e63f)))['toString']();}function insertCmHopperAdditionalPhones(_0x41b37b){var _0x4e938a=[_0x1248('0x4a'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x1248('0x4b'),_0x1248('0x4c')];return squel[_0x1248('0x2e')]()[_0x1248('0x2f')](_0x1248('0x4d'))['fromQuery'](['CmHopperId',_0x1248('0x13'),_0x1248('0x4e'),_0x1248('0x35'),_0x1248('0x36')],squel[_0x1248('0x11')]()[_0x1248('0x3a')](_0x4e938a)[_0x1248('0x14')](_0x1248('0x30'))[_0x1248('0x15')](_0x1248('0x3b'),null,_0x1248('0x4f'))[_0x1248('0x15')](_0x1248('0x50'),null,_0x1248('0x51'))[_0x1248('0x17')](_0x1248('0x52'),_0x41b37b)[_0x1248('0x17')](_0x1248('0x3f'),NOW))[_0x1248('0x45')]();}function insertCmContact(_0x3fb909,_0x4d92be,_0x5717e4,_0x1b1f52){var _0x59c88c=_[_0x1248('0x53')](_[_0x1248('0x54')](_0x1b1f52),[_0x1248('0x34'),'CompanyId',_0x1248('0x35'),_0x1248('0x36')]);return squel[_0x1248('0x2e')]()[_0x1248('0x2f')](_0x1248('0x3b'))[_0x1248('0x31')](_0x59c88c,squel[_0x1248('0x11')]()['fields'](_0x59c88c)[_0x1248('0x14')](_0x4d92be)[_0x1248('0x17')]('('+_0x5717e4[_0x1248('0x15')](',')+_0x1248('0x55'),squel[_0x1248('0x11')]()['fields'](_0x5717e4)['from'](_0x1248('0x3b'))['where'](_0x1248('0x44'),_0x3fb909)['where'](_0x1248('0x56')))['where']('id\x20IN\x20?',squel[_0x1248('0x11')]()[_0x1248('0x12')](_0x1248('0x57'),'min_id')['from'](_0x4d92be)[_0x1248('0x58')](_0x5717e4[_0x1248('0x15')](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4d1918){logger[_0x1248('0x59')](_0x4d1918[_0x1248('0x5a')]);process['exit'](0x1);}function handleError(_0x7418b1,_0x5440a3){stats[_0x1248('0x5b')][_0x1248('0x1d')]({'name':_0x5440a3[_0x1248('0x5c')],'message':_0x5440a3[_0x1248('0x5a')],'row':_0x7418b1});}function handleQuery(_0x19d573){logger[_0x1248('0x5d')](_0x19d573);return db['sequelize'][_0x1248('0x5e')](_0x19d573)[_0x1248('0x5f')](function(_0x5bdb6f){results['push'](_0x5bdb6f);})[_0x1248('0x60')](function(_0x194bc){logger[_0x1248('0x59')](_0x194bc[_0x1248('0x5a')]);});}function updateTzCampaigns(_0x433561){return new Promise(function(_0x12f312,_0x5ef6ee){var _0x169786=squel[_0x1248('0x11')]()[_0x1248('0x3a')]([_0x1248('0x61'),'campaigns.dialTimezone'])[_0x1248('0x14')](_0x1248('0x62'))[_0x1248('0x15')](_0x1248('0x63'),null,_0x1248('0x64'))[_0x1248('0x17')](_0x1248('0x65')+_0x433561);db[_0x1248('0x66')]['query'](_0x169786[_0x1248('0x45')]())[_0x1248('0x5f')](function(_0x49c5c1){var _0x1fa831=[];for(var _0xb071f9=0x0;_0xb071f9<_0x49c5c1[_0x1248('0x1f')];_0xb071f9++){_0x1fa831['push'](getTimezoneData(_0x49c5c1[_0xb071f9],tmp_campaigns));}BPromise[_0x1248('0x20')](_0x1fa831)['then'](function(){_0x12f312({'val':0x1});});})[_0x1248('0x60')](function(_0x5b69e2){logger[_0x1248('0x59')](_0x5b69e2[_0x1248('0x5a')]);_0x12f312({'val':0x0});});});}function updateTzVoiceQueues(_0x1386a5){return new Promise(function(_0x34fdf0,_0x42b5a7){var _0x28357e=squel[_0x1248('0x11')]()[_0x1248('0x3a')]([_0x1248('0x67'),_0x1248('0x68')])['from'](_0x1248('0x69'))[_0x1248('0x15')](_0x1248('0x6a'),null,_0x1248('0x6b'))[_0x1248('0x17')](_0x1248('0x6c')+_0x1386a5);db[_0x1248('0x66')][_0x1248('0x5e')](_0x28357e[_0x1248('0x45')]())[_0x1248('0x5f')](function(_0x3cb4d0){var _0x483c36=[];for(var _0x56084a=0x0;_0x56084a<_0x3cb4d0[_0x1248('0x1f')];_0x56084a++){_0x483c36['push'](getTimezoneData(_0x3cb4d0[_0x56084a],tmp_voice_queues));}BPromise[_0x1248('0x20')](_0x483c36)['then'](function(){_0x34fdf0({'val':0x1});});})[_0x1248('0x60')](function(_0x436005){logger[_0x1248('0x59')](_0x436005[_0x1248('0x5a')]);_0x34fdf0({'val':0x0});});});}function getTimezoneData(_0x59603d,_0xa116f0){return new Promise(function(_0x5b0da2,_0x538ca9){var _0x430f87=shared[_0x1248('0x6d')];var _0x3c0d85=_0x430f87[_0x59603d[_0x1248('0x6e')]];if(_[_0x1248('0x21')](_0x3c0d85)){_0x5b0da2({'ret':0x1});}else{var _0x291128=_0x3c0d85[_0x1248('0x6f')];var _0x5678ac=squel['insert']()['into'](_0xa116f0)[_0x1248('0x70')]('id',_0x59603d['id'])[_0x1248('0x70')](_0x1248('0x71'),_0x291128)[_0x1248('0x70')](_0x1248('0x6e'),_0x59603d[_0x1248('0x6e')])['toString']();return db['sequelize']['query'](_0x5678ac)[_0x1248('0x5f')](function(_0xebdd82){_0x5b0da2({'ret':0x1});})[_0x1248('0x60')](function(_0x24f919){logger[_0x1248('0x59')](_0x24f919[_0x1248('0x5a')]);_0x538ca9({'ret':0x1});});}});}function handleTZQuery(_0x327b1f){logger[_0x1248('0x5d')](_0x327b1f);return db[_0x1248('0x66')][_0x1248('0x5e')](_0x327b1f)[_0x1248('0x5f')](function(_0x253506){})[_0x1248('0x60')](function(_0x5acf52){logger['error'](_0x5acf52[_0x1248('0x5a')]);});}function main(_0x2184c8,_0x187c09,_0x4fb035,_0x348ac1){logger[_0x1248('0x5d')](_0x1248('0x72'),_0x2184c8,JSON[_0x1248('0x73')](_0x187c09));process['send'](_0x1248('0x74'));var _0x4a18da=_0x187c09['binding'];var _0x59bebb=_[_0x1248('0x75')](_0x4a18da);var _0x2ae4f2=_0x187c09[_0x1248('0x76')];var _0x10cdd8=path[_0x1248('0x15')](config[_0x1248('0x77')],_0x1248('0x78'),_0x2ae4f2+'.csv');hasTZ=_[_0x1248('0x54')](_0x4a18da)[_0x1248('0x79')]('dialTimezone');var _0x4cad87=_[_0x1248('0x54')](_0x4a18da)[_0x1248('0x15')]();logger[_0x1248('0x5d')](_0x1248('0x7a'),_0x4cad87);db[_0x1248('0x7b')][_0x1248('0x7c')]({'raw':!![],'attributes':['id',_0x1248('0x7d')]})['then'](function(_0x1487fa){for(var _0x120d33=0x0;_0x120d33<_0x1487fa[_0x1248('0x1f')];_0x120d33++){if(_0x1487fa[_0x120d33][_0x1248('0x7d')]in _0x4a18da){contactItemTypes['push'](_0x1487fa[_0x120d33]);delete _0x59bebb[_0x1487fa[_0x120d33]['name']];hasAdditionalPhones=!![];}for(var _0x49e13f in _0x4a18da){if(_0x1487fa[_0x120d33][_0x1248('0x7d')]+'_description'===_0x49e13f){phoneDescriptions['push']({'itemTypeId':_0x1487fa[_0x120d33]['id'],'description':_0x49e13f});delete _0x59bebb[_0x49e13f];}}}if(hasAdditionalPhones)_0x59bebb[_0x1248('0x1b')]='';var _0x4b09b5=_['keys'](_0x59bebb)['join']();logger[_0x1248('0x5d')]('header',_0x4b09b5);fs[_0x1248('0x7e')](_0x10cdd8,_0x4b09b5+'\x0a');Papa[_0x1248('0x7f')](fs[_0x1248('0x80')](_0x2184c8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x184a59,_0x20786f){try{for(var _0x57c26d=0x0,_0x275234=[];_0x57c26d<_0x184a59[_0x1248('0x81')][_0x1248('0x1f')];_0x57c26d++){stats[_0x1248('0x82')]+=0x1;if(_0x184a59[_0x1248('0x5b')][_0x57c26d]){handleError(_0x184a59['data'][_0x57c26d],_0x184a59[_0x1248('0x5b')][_0x57c26d]);}else{var _0x149d9c=[];var _0x2d0242=[];var _0x356b76={};for(var _0x578de0 in _0x4a18da){let _0x2d8f6d=contactItemTypes[_0x1248('0x83')](_0x46f71d=>_0x46f71d[_0x1248('0x7d')]===_0x578de0);let _0x439a93=contactItemTypes[_0x1248('0x83')](_0x1efe8a=>_0x1efe8a[_0x1248('0x7d')]+_0x1248('0x84')===_0x578de0);if(_[_0x1248('0x21')](_0x2d8f6d)&&_[_0x1248('0x21')](_0x439a93)){if(_0x4a18da[_0x1248('0x85')](_0x578de0)){if(_0x184a59['data'][_0x57c26d][_0x4a18da[_0x578de0]]){var _0x5afad4=_[_0x1248('0x86')](_0x184a59['data'][_0x57c26d][_0x4a18da[_0x578de0]]['replace'](/"/g,'\x27'));switch(_0x578de0){case'scheduledat':var _0x4a7d45=moment(_0x5afad4,_0x1248('0xf'),!![]);if(_0x4a7d45[_0x1248('0x87')]()){_0x275234['push']('\x22'+_0x5afad4+'\x22');}else{_0x149d9c['push'](_0x1248('0x88'));}break;case'priority':var _0x46310c=parseInt(_0x5afad4);_0x5afad4=_[_0x1248('0x89')](_0x46310c)||_0x46310c<0x0||_0x46310c>0x4?_0x348ac1?0x3:0x2:_0x46310c;_0x275234[_0x1248('0x1d')]('\x22'+_0x5afad4+'\x22');break;case _0x1248('0x38'):var _0x5bdd51=parseInt(_0x5afad4);if(_[_0x1248('0x8a')](_0x5bdd51)&&_[_0x1248('0x79')](_0x4fb035,_0x5bdd51)){_0x275234[_0x1248('0x1d')]('\x22'+_0x5bdd51+'\x22');}else{_0x149d9c[_0x1248('0x1d')](_0x1248('0x8b'));}break;case'email':if(isEmail(_0x5afad4)){_0x275234[_0x1248('0x1d')]('\x22'+_0x5afad4+'\x22');}else{_0x149d9c[_0x1248('0x1d')]('email\x20wrong\x20format');}break;case _0x1248('0x8c'):var _0x1eeb1b=moment(_0x5afad4,_0x1248('0x8d'),!![]);if(_0x1eeb1b['isValid']()){_0x275234[_0x1248('0x1d')]('\x22'+_0x5afad4+'\x22');}else{_0x149d9c[_0x1248('0x1d')](_0x1248('0x8e'));}break;case _0x1248('0x6e'):var _0x2ecf25=shared[_0x1248('0x6d')];var _0x384ce2=_0x2ecf25[_0x5afad4];if(!_['isNil'](_0x384ce2)){var _0x405726=_0x384ce2['utcOffset'];_0x275234['push']('\x22'+_0x5afad4+'\x22');_0x275234[_0x1248('0x1d')]('\x22'+_0x405726+'\x22');}break;default:_0x275234[_0x1248('0x1d')]('\x22'+_0x5afad4+'\x22');}}else{switch(_0x578de0){case _0x1248('0x8f'):case _0x1248('0x13'):_0x149d9c[_0x1248('0x1d')](_0x578de0+_0x1248('0x90'));break;default:_0x275234[_0x1248('0x1d')]('\x22\x22');}}}}else{var _0x1c244e='';if(!_[_0x1248('0x21')](_0x2d8f6d)){if(!_0x356b76[_0x1248('0x85')](_0x2d8f6d['id'])){if(!_[_0x1248('0x21')](_0x184a59['data'][_0x57c26d][_0x4a18da[_0x578de0]])){var _0x5afad4=_[_0x1248('0x86')](_0x184a59['data'][_0x57c26d][_0x4a18da[_0x578de0]][_0x1248('0x91')](/"/g,'\x27'));var _0x1dea33=phoneDescriptions[_0x1248('0x83')](_0xada7fc=>_0xada7fc[_0x1248('0x92')]===_0x2d8f6d['id']);if(!_[_0x1248('0x21')](_0x1dea33)){var _0x4b0ac3=_[_0x1248('0x86')](_0x184a59[_0x1248('0x81')][_0x57c26d][_0x4a18da[_0x1dea33[_0x1248('0x93')]]][_0x1248('0x91')](/"/g,'\x27'));if(!_[_0x1248('0x21')](_0x4b0ac3))_0x5afad4=_0x5afad4+'§'+_0x4b0ac3;}if(_0x1c244e=='')_0x1c244e=_0x5afad4;else _0x1c244e+='|'+_0x5afad4;}_0x2d0242[_0x1248('0x1d')](_0x2d8f6d['id']+':'+_0x1c244e);_0x356b76[_0x2d8f6d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x275234[_0x1248('0x1d')]('\x22'+_0x2d0242['join'](';')+'\x22');}if(_0x149d9c['length']){handleError(_0x184a59[_0x1248('0x81')][_0x57c26d],{'code':_0x1248('0x94'),'message':_0x149d9c[_0x1248('0x15')]()});}else{fs[_0x1248('0x95')](_0x10cdd8,_0x275234[_0x1248('0x15')]()+'\x0a');}_0x275234=[];}if(!(stats[_0x1248('0x82')]%0xc8)){socket[_0x1248('0x96')](_0x1248('0x97')+_0x2ae4f2,stats);stats[_0x1248('0x5b')]=[];}}if(stopped){logger['info'](_0x1248('0x98'));_0x20786f[_0x1248('0x99')]();}}catch(_0x37fb4a){handleError(_0x184a59[_0x1248('0x81')][_0x57c26d],{'code':_0x1248('0x9a'),'message':_0x37fb4a[_0x1248('0x5a')]});logger['error'](_0x1248('0x9b'),_0x37fb4a[_0x1248('0x5a')]);}},'complete':function(){try{var _0x5e2694=[];var _0xf4d1a7=[];var _0x24f912='cm_contacts';if(_0x187c09[_0x1248('0x9c')]&&_0x187c09[_0x1248('0x9c')][_0x1248('0x1f')]){_0x24f912=_0x1248('0x9d')+_0x2ae4f2;_0x5e2694['push'](_0x1248('0x9e')+_0x24f912+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x1248('0x9f')+_0x2ae4f2;tmp_voice_queues=_0x1248('0xa0')+_0x2ae4f2;_0xf4d1a7[_0x1248('0x1d')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x1248('0xa1'));_0xf4d1a7['push'](_0x1248('0x9e')+tmp_voice_queues+_0x1248('0xa1'));BPromise[_0x1248('0xa2')](_0xf4d1a7,handleTZQuery)[_0x1248('0x1c')](function(_0x379388){updateTzCampaigns(_0x187c09[_0x1248('0x34')])[_0x1248('0x1c')](function(_0x2a680b){updateTzVoiceQueues(_0x187c09[_0x1248('0x34')])[_0x1248('0x1c')](function(_0x1c703d){if(hasTZ)_0x4b09b5=_0x4b09b5[_0x1248('0x91')](_0x1248('0x6e'),_0x1248('0xa3'));var _0x2142c1=util[_0x1248('0xe')](_0x1248('0xa4'),_0x10cdd8,_0x24f912,_0x4b09b5,_0x187c09['ListId'],_0x187c09[_0x1248('0xa5')]||null,NOW,NOW);if(_[_0x1248('0x21')](_0x4a18da['scheduledat'])){_0x2142c1+=_0x1248('0xa6');}_0x5e2694['push'](_0x2142c1);if(_0x187c09[_0x1248('0x9c')]&&_0x187c09[_0x1248('0x9c')][_0x1248('0x1f')]){_0x5e2694['push'](insertCmContact(_0x187c09['ListId'],_0x24f912,_0x187c09['duplicates'],_0x4a18da));_0x5e2694[_0x1248('0x1d')]('DROP\x20TABLE\x20'+_0x24f912+';');}BPromise[_0x1248('0xa2')](_0x5e2694,handleQuery)[_0x1248('0x1c')](function(_0x2ac2ec){BPromise['all']([handleAdditionalPhones()])[_0x1248('0x1c')](function(){_0x5e2694=[];for(var _0x131e32=0x0;_0x131e32\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','format','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','phone','push','all','then','message','AdditionalPhones','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','\x22always\x22','cm_hopper_black','ListId','fields','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_hopper.ListId\x20=\x20?','toString','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','exit','errors','code','catch','error','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','ContactItemType','name','_description','keys','header','writeFileSync','parse','createReadStream','rows','find','hasOwnProperty','data','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email\x20wrong\x20format'];(function(_0x5c1a0a,_0x5c61aa){var _0x4e78ee=function(_0x236aa0){while(--_0x236aa0){_0x5c1a0a['push'](_0x5c1a0a['shift']());}};_0x4e78ee(++_0x5c61aa);}(_0x2136,0x1eb));var _0x6213=function(_0x5a32bb,_0x2d24ca){_0x5a32bb=_0x5a32bb-0x0;var _0x594bce=_0x2136[_0x5a32bb];return _0x594bce;};'use strict';var fs=require('fs');var path=require(_0x6213('0x0'));var _=require(_0x6213('0x1'));var Papa=require(_0x6213('0x2'));var util=require(_0x6213('0x3'));var BPromise=require(_0x6213('0x4'));var moment=require(_0x6213('0x5'));var squel=require(_0x6213('0x6'));var Redis=require(_0x6213('0x7'));var db=require(_0x6213('0x8'))['db'];var config=require(_0x6213('0x9'));var logger=require('../../../config/logger')(_0x6213('0xa'));config[_0x6213('0xb')]=_[_0x6213('0xc')](config['redis'],{'host':_0x6213('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6213('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6213('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x6213('0xe')](_0x6213('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4082b0){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))*$/[_0x6213('0x10')](_0x4082b0);}function selectNotIn(_0x1d9bf2,_0x2fd8d4,_0x3d3f03,_0x58ab3f,_0xc681fd){return squel[_0x6213('0x11')]()[_0x6213('0x12')]('phone')[_0x6213('0x13')](_0x58ab3f)[_0x6213('0x14')](_0x2fd8d4,null,_0x2fd8d4+_0x6213('0x15')+_0x58ab3f+'.'+_0x3d3f03)[_0x6213('0x16')](_0x58ab3f+'.'+_0x3d3f03+_0x6213('0x17')+_0x1d9bf2+'.'+_0x3d3f03)['where'](_0x2fd8d4+_0x6213('0x18')+_0xc681fd['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x39a6f5,_0x412232){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6213('0x19')]['query'](_0x6213('0x1a')+tempTableName)[_0x6213('0x1b')](function(_0x5ef2d6){if(_0x5ef2d6!==null){var _0x509e48=[];for(var _0x159908=0x0;_0x159908<_0x5ef2d6[_0x6213('0x1c')];_0x159908++){var _0x5de3e2=_0x5ef2d6[_0x159908];if(!_[_0x6213('0x1d')](_0x5de3e2[_0x6213('0x1e')])){if(!_[_0x6213('0x1d')](_0x5de3e2['AdditionalPhones']))_0x509e48[_0x6213('0x1f')](insertAdditionalPhones(_0x5de3e2));promisesContact['push']({'contact':_0x5de3e2});}}}Promise[_0x6213('0x20')](_0x509e48)[_0x6213('0x21')](function(){_0x39a6f5({'val':0x1});});})['catch'](function(_0xe8cc03){logger['error'](_0xe8cc03[_0x6213('0x22')]);});});}function insertAdditionalPhones(_0x40f5ac){return new Promise(function(_0x1a9e97,_0x167682){var _0x2fb250=_0x40f5ac[_0x6213('0x23')];if(_[_0x6213('0x1d')](_0x2fb250))_0x167682({'val':0x0});else{var _0x239a89=_0x2fb250[_0x6213('0x24')](';');var _0x25dcac=[];orderBy=0x0;for(var _0x597b5c=0x0;_0x597b5c<_0x239a89[_0x6213('0x1c')];_0x597b5c++){_0x25dcac[_0x6213('0x1f')](splitAdditionalPhone(_0x40f5ac['id'],_0x239a89[_0x597b5c]));}Promise[_0x6213('0x20')](_0x25dcac)[_0x6213('0x21')](function(){_0x1a9e97({'val':_0x239a89[_0x6213('0x1c')]});});}});}function splitAdditionalPhone(_0x154cd3,_0x39f2e7){return new Promise(function(_0x40bf68,_0x229fb0){var _0x38cbba=_0x39f2e7[_0x6213('0x24')](':');var _0x11bb9d=_0x38cbba[0x0];var _0x3ed96a=_0x38cbba[0x1];if(_0x3ed96a!==''){var _0x5407a6=_0x3ed96a['split']('|');var _0xb07dcc=[];for(var _0x11881d=0x0;_0x11881d<_0x5407a6[_0x6213('0x1c')];_0x11881d++){if(_0x5407a6[_0x11881d]!==''){var _0x1415c1=_[_0x6213('0x25')](promisesAdditionalPhones,{'contactId':_0x154cd3,'phone':_0x5407a6[_0x11881d]});if(_0x1415c1[_0x6213('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x6213('0x1f')]({'contactId':_0x154cd3,'contactTypeId':_0x11bb9d,'phone':_0x5407a6[_0x11881d],'orderBy':orderBy});}}}_0x40bf68({'ok':0x1});}else _0x40bf68({'res':0x0});});}function createAdditionalPhone(_0x29e86e,_0x58f30b,_0xacf549,_0x14aa5c){var _0x56884a='';var _0x29674b='';var _0x224039=_0xacf549['split']('§');_0x56884a=_0x224039[0x0];if(_0x224039['length']==0x2)_0x29674b=_0x224039[0x1];return new Promise(function(_0x45e49f,_0x2df3ec){return db[_0x6213('0x26')][_0x6213('0x27')]({'where':{'CmContactId':_0x29e86e,'item':_0x56884a}})[_0x6213('0x21')](function(_0x585d79){if(_0x585d79){return db[_0x6213('0x26')][_0x6213('0x28')]({'ItemTypeId':_0x58f30b,'description':_0x29674b,'OrderBy':_0x14aa5c},{'where':{'CmContactId':_0x29e86e,'item':_0x56884a}})[_0x6213('0x21')](function(_0x2f160b){_0x45e49f({'res':_0x6213('0x29')});});}else{return db[_0x6213('0x26')][_0x6213('0x2a')]({'CmContactId':_0x29e86e,'item':_0x56884a,'ItemTypeId':_0x58f30b,'description':_0x29674b,'OrderBy':_0x14aa5c,'ItemClass':_0x6213('0x2b')})[_0x6213('0x21')](function(_0x18c994){_0x45e49f({'res':_0x6213('0x2c')});});}});});}function updateContact(_0x57d825){return new Promise(function(_0x3ec389,_0x45edcd){var _0x1e8258=_0x57d825['id'];delete _0x57d825['id'];return db[_0x6213('0x2d')][_0x6213('0x28')](_0x57d825,{'where':{'id':_0x1e8258}})[_0x6213('0x21')](function(_0x1d3b3f){updatedRows+=0x1;return db['CmHopper'][_0x6213('0x28')]({'phone':_0x57d825[_0x6213('0x1e')]},{'where':{'ContactId':_0x1e8258}})[_0x6213('0x21')](function(_0x3a630d){_0x3ec389({'ret':'OK'});});});});}function insertCmHopper(_0x28ea37,_0xa45b7b,_0x2b25eb,_0x5dc000,_0x5c2c8e){var _0x358033=[_0x6213('0x2e'),_0x6213('0x2f'),_0x6213('0x30'),_0x6213('0x31'),_0xa45b7b+'.'+_0x5dc000,_0x6213('0x32'),_0x6213('0x33'),_0x6213('0x34'),'cm_contacts.UserId','\x22'+_0x5c2c8e+'\x22'];return squel[_0x6213('0x35')]()[_0x6213('0x36')](_0x6213('0x37'))[_0x6213('0x38')]([_0x6213('0x1e'),_0x6213('0x39'),_0x6213('0x3a'),'ListId',_0x5dc000,_0x6213('0x3b'),_0x6213('0x3c'),_0x6213('0x3d'),_0x6213('0x3e'),_0x6213('0x3f')],squel[_0x6213('0x11')]()['fields'](_0x358033)[_0x6213('0x13')](_0xa45b7b)['join'](_0x6213('0x40'),null,_0x6213('0x41')+_0xa45b7b+'.CmListId')[_0x6213('0x14')](_0x2b25eb,null,_0x2b25eb+_0x6213('0x15')+_0xa45b7b+'.'+_0x5dc000)[_0x6213('0x16')](_0xa45b7b+_0x6213('0x42'),_0x28ea37)[_0x6213('0x16')](_0x6213('0x43'),NOW)[_0x6213('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xa45b7b,_0x2b25eb,_0x5dc000,_0x6213('0x37'),['\x22always\x22',_0x6213('0x44')]))[_0x6213('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xa45b7b,_0x2b25eb,_0x5dc000,_0x6213('0x37'),[_0x6213('0x45')])))['toString']();}function insertCmHopperBlack(_0x36c53d,_0x345da0,_0x56b74a,_0x6d76e5){var _0x559bba=[_0x6213('0x2e'),'cm_contacts.id',_0x6213('0x31'),_0x345da0+'.'+_0x6d76e5,_0x6213('0x32'),_0x6213('0x33')];return squel['insert']()['into'](_0x6213('0x46'))['fromQuery']([_0x6213('0x1e'),_0x6213('0x3a'),_0x6213('0x47'),_0x6d76e5,_0x6213('0x3b'),'updatedAt'],squel[_0x6213('0x11')]()[_0x6213('0x48')](_0x559bba)[_0x6213('0x13')](_0x345da0)[_0x6213('0x14')](_0x6213('0x40'),null,_0x6213('0x41')+_0x345da0+_0x6213('0x49'))['join'](_0x56b74a,null,_0x56b74a+_0x6213('0x15')+_0x345da0+'.'+_0x6d76e5)[_0x6213('0x16')](_0x345da0+'.CmListId\x20=\x20?',_0x36c53d)['where'](_0x6213('0x43'),NOW)['where'](_0x6213('0x4a'),squel[_0x6213('0x11')]()[_0x6213('0x12')](_0x6213('0x1e'))[_0x6213('0x13')](_0x6213('0x46'))[_0x6213('0x16')](_0x6213('0x4b'),_0x36c53d)[_0x6213('0x16')](_0x6d76e5+'\x20=\x20?',_0x345da0+'.'+_0x6d76e5)))['toString']();}function insertCmHopperAdditionalPhones(_0x37efb3){var _0x4c9247=['cm_hopper.id','cm_contact_has_items.item',_0x6213('0x4c'),_0x6213('0x4d'),_0x6213('0x4e')];return squel[_0x6213('0x35')]()['into'](_0x6213('0x4f'))[_0x6213('0x38')]([_0x6213('0x50'),_0x6213('0x1e'),_0x6213('0x51'),_0x6213('0x3b'),_0x6213('0x3c')],squel[_0x6213('0x11')]()[_0x6213('0x48')](_0x4c9247)['from']('cm_hopper')[_0x6213('0x14')](_0x6213('0x40'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6213('0x14')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6213('0x16')](_0x6213('0x52'),_0x37efb3)['where'](_0x6213('0x43'),NOW))[_0x6213('0x53')]();}function insertCmContact(_0x58fce6,_0x4e2ce3,_0x53c120,_0x11a116){var _0x3fed28=_[_0x6213('0x54')](_['keys'](_0x11a116),['ListId',_0x6213('0x55'),_0x6213('0x3b'),_0x6213('0x3c')]);return squel[_0x6213('0x35')]()[_0x6213('0x36')](_0x6213('0x40'))[_0x6213('0x38')](_0x3fed28,squel['select']()['fields'](_0x3fed28)[_0x6213('0x13')](_0x4e2ce3)[_0x6213('0x16')]('('+_0x53c120[_0x6213('0x14')](',')+_0x6213('0x56'),squel[_0x6213('0x11')]()['fields'](_0x53c120)[_0x6213('0x13')](_0x6213('0x40'))[_0x6213('0x16')](_0x6213('0x4b'),_0x58fce6))[_0x6213('0x16')](_0x6213('0x57'),squel['select']()['field'](_0x6213('0x58'),_0x6213('0x59'))[_0x6213('0x13')](_0x4e2ce3)[_0x6213('0x5a')](_0x53c120[_0x6213('0x14')](','))))[_0x6213('0x53')]();}function handleStop(){logger[_0x6213('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5c2174){logger['error'](_0x5c2174[_0x6213('0x22')]);process[_0x6213('0x5c')](0x1);}function handleError(_0x134a64,_0x5624f2){stats[_0x6213('0x5d')]['push']({'name':_0x5624f2[_0x6213('0x5e')],'message':_0x5624f2[_0x6213('0x22')],'row':_0x134a64});}function handleQuery(_0x5769a7){logger[_0x6213('0x5b')](_0x5769a7);return db[_0x6213('0x19')]['query'](_0x5769a7)[_0x6213('0x1b')](function(_0x2381ef){results[_0x6213('0x1f')](_0x2381ef);})[_0x6213('0x5f')](function(_0x39e12b){logger[_0x6213('0x60')](_0x39e12b['message']);});}function main(_0x2533ca,_0x225dbd,_0x10d551,_0x161c2e){logger[_0x6213('0x5b')](_0x6213('0x61'),_0x2533ca,JSON[_0x6213('0x62')](_0x225dbd));process[_0x6213('0x63')](_0x6213('0x64'));var _0x4179c2=_0x225dbd[_0x6213('0x65')];var _0x5bf8b0=_[_0x6213('0x66')](_0x4179c2);var _0x16561e=_0x225dbd['socket_timestamp'];var _0x37bad1=path[_0x6213('0x14')](config[_0x6213('0x67')],_0x6213('0x68'),_0x16561e+_0x6213('0x69'));logger[_0x6213('0x5b')]('body',_0x225dbd);db[_0x6213('0x6a')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x6213('0x21')](function(_0x4b8d2f){for(var _0x110be5=0x0;_0x110be5<_0x4b8d2f[_0x6213('0x1c')];_0x110be5++){if(_0x4b8d2f[_0x110be5][_0x6213('0x6b')]in _0x4179c2){contactItemTypes[_0x6213('0x1f')](_0x4b8d2f[_0x110be5]);delete _0x5bf8b0[_0x4b8d2f[_0x110be5]['name']];hasAdditionalPhones=!![];}for(var _0x14e94f in _0x4179c2){if(_0x4b8d2f[_0x110be5][_0x6213('0x6b')]+_0x6213('0x6c')===_0x14e94f){phoneDescriptions[_0x6213('0x1f')]({'itemTypeId':_0x4b8d2f[_0x110be5]['id'],'description':_0x14e94f});delete _0x5bf8b0[_0x14e94f];}}}if(hasAdditionalPhones)_0x5bf8b0[_0x6213('0x23')]='';var _0x13d285=_[_0x6213('0x6d')](_0x5bf8b0)[_0x6213('0x14')]();logger[_0x6213('0x5b')](_0x6213('0x6e'),_0x13d285);fs[_0x6213('0x6f')](_0x37bad1,_0x13d285+'\x0a');Papa[_0x6213('0x70')](fs[_0x6213('0x71')](_0x2533ca),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2063d4,_0x423251){try{for(var _0x3e7dc1=0x0,_0x23349b=[];_0x3e7dc1<_0x2063d4['data'][_0x6213('0x1c')];_0x3e7dc1++){stats[_0x6213('0x72')]+=0x1;if(_0x2063d4[_0x6213('0x5d')][_0x3e7dc1]){handleError(_0x2063d4['data'][_0x3e7dc1],_0x2063d4['errors'][_0x3e7dc1]);}else{var _0x37c6b4=[];var _0x54878d=[];var _0x1031db={};for(var _0x4cef5e in _0x4179c2){let _0x44ad9f=contactItemTypes['find'](_0x5eb007=>_0x5eb007[_0x6213('0x6b')]===_0x4cef5e);let _0x5a2560=contactItemTypes[_0x6213('0x73')](_0x227d18=>_0x227d18['name']+_0x6213('0x6c')===_0x4cef5e);if(_[_0x6213('0x1d')](_0x44ad9f)&&_[_0x6213('0x1d')](_0x5a2560)){if(_0x4179c2[_0x6213('0x74')](_0x4cef5e)){if(_0x2063d4[_0x6213('0x75')][_0x3e7dc1][_0x4179c2[_0x4cef5e]]){var _0x30cbc5=_[_0x6213('0x76')](_0x2063d4[_0x6213('0x75')][_0x3e7dc1][_0x4179c2[_0x4cef5e]][_0x6213('0x77')](/"/g,'\x27'));switch(_0x4cef5e){case _0x6213('0x39'):var _0x1f4efc=moment(_0x30cbc5,_0x6213('0x78'),!![]);if(_0x1f4efc['isValid']()){_0x23349b[_0x6213('0x1f')]('\x22'+_0x30cbc5+'\x22');}else{_0x37c6b4[_0x6213('0x1f')](_0x6213('0x79'));}break;case'priority':var _0x1b8bdb=parseInt(_0x30cbc5);_0x30cbc5=_['isNaN'](_0x1b8bdb)||_0x1b8bdb<0x0||_0x1b8bdb>0x4?_0x161c2e?0x3:0x2:_0x1b8bdb;_0x23349b['push']('\x22'+_0x30cbc5+'\x22');break;case _0x6213('0x3e'):var _0x14d5b7=parseInt(_0x30cbc5);if(_[_0x6213('0x7a')](_0x14d5b7)&&_[_0x6213('0x7b')](_0x10d551,_0x14d5b7)){_0x23349b[_0x6213('0x1f')]('\x22'+_0x14d5b7+'\x22');}else{_0x37c6b4[_0x6213('0x1f')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x30cbc5)){_0x23349b[_0x6213('0x1f')]('\x22'+_0x30cbc5+'\x22');}else{_0x37c6b4[_0x6213('0x1f')](_0x6213('0x7c'));}break;case'dateOfBirth':var _0x143279=moment(_0x30cbc5,_0x6213('0x7d'),!![]);if(_0x143279[_0x6213('0x7e')]()){_0x23349b[_0x6213('0x1f')]('\x22'+_0x30cbc5+'\x22');}else{_0x37c6b4[_0x6213('0x1f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x23349b[_0x6213('0x1f')]('\x22'+_0x30cbc5+'\x22');}}else{switch(_0x4cef5e){case'firstName':case _0x6213('0x1e'):_0x37c6b4[_0x6213('0x1f')](_0x4cef5e+_0x6213('0x7f'));break;default:_0x23349b['push']('\x22\x22');}}}}else{var _0x53ceb4='';if(!_['isNil'](_0x44ad9f)){if(!_0x1031db[_0x6213('0x74')](_0x44ad9f['id'])){for(var _0x463715=0x0;_0x463715<_0x4179c2[_0x4cef5e]['length'];_0x463715++){var _0x30cbc5=_['trim'](_0x2063d4[_0x6213('0x75')][_0x3e7dc1][_0x4179c2[_0x4cef5e][_0x463715]][_0x6213('0x77')](/"/g,'\x27'));var _0x4e6c22=phoneDescriptions['find'](_0x3923ef=>_0x3923ef[_0x6213('0x80')]===_0x44ad9f['id']);if(!_[_0x6213('0x1d')](_0x4e6c22)){var _0x5c886e=_['trim'](_0x2063d4[_0x6213('0x75')][_0x3e7dc1][_0x4179c2[_0x4e6c22['description']][0x0]][_0x6213('0x77')](/"/g,'\x27'));if(!_['isNil'](_0x5c886e))_0x30cbc5=_0x30cbc5+'§'+_0x5c886e;}if(_0x53ceb4=='')_0x53ceb4=_0x30cbc5;else _0x53ceb4+='|'+_0x30cbc5;}_0x54878d[_0x6213('0x1f')](_0x44ad9f['id']+':'+_0x53ceb4);_0x1031db[_0x44ad9f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x23349b[_0x6213('0x1f')]('\x22'+_0x54878d['join'](';')+'\x22');}if(_0x37c6b4['length']){handleError(_0x2063d4['data'][_0x3e7dc1],{'code':'SystemRow','message':_0x37c6b4[_0x6213('0x14')]()});}else{fs['appendFileSync'](_0x37bad1,_0x23349b['join']()+'\x0a');}_0x23349b=[];}if(!(stats[_0x6213('0x72')]%0xc8)){socket[_0x6213('0x81')](_0x6213('0x82')+_0x16561e,stats);stats[_0x6213('0x5d')]=[];}}if(stopped){logger[_0x6213('0x5b')](_0x6213('0x83'));_0x423251[_0x6213('0x84')]();}}catch(_0x146723){handleError(_0x2063d4[_0x6213('0x75')][_0x3e7dc1],{'code':_0x6213('0x85'),'message':_0x146723['message']});logger['error'](_0x6213('0x86'),_0x146723[_0x6213('0x22')]);}},'complete':function(){try{var _0x5e9d75=[];var _0x5e24bc=tempTableName;_0x5e9d75[_0x6213('0x1f')](_0x6213('0x87')+_0x5e24bc+'\x20LIKE\x20cm_contacts;');logger[_0x6213('0x5b')](_0x6213('0x88'),contactItemTypes[_0x6213('0x1c')]);var _0x3fa71d=util[_0x6213('0xe')](_0x6213('0x89'),_0x37bad1,_0x5e24bc,_0x13d285,_0x225dbd[_0x6213('0x47')],_0x225dbd[_0x6213('0x55')]||null,NOW,NOW);if(_[_0x6213('0x1d')](_0x4179c2[_0x6213('0x39')])){_0x3fa71d+=_0x6213('0x8a');}_0x5e9d75[_0x6213('0x1f')](_0x3fa71d);BPromise[_0x6213('0x8b')](_0x5e9d75,handleQuery)[_0x6213('0x21')](function(_0x22e79a){BPromise[_0x6213('0x20')]([handleAdditionalPhones()])['then'](function(){_0x5e9d75=[];for(var _0x219247=0x0;_0x219247\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','ioredis','../../../config/environment','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','isNil','all','then','catch','error','message','AdditionalPhones','split','length','filter','CmContactHasItem','findOne','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','from','cm_contacts.ListId\x20=\x20','.CmListId','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?'];(function(_0x4d150a,_0x25f904){var _0x885bd4=function(_0x552a7d){while(--_0x552a7d){_0x4d150a['push'](_0x4d150a['shift']());}};_0x885bd4(++_0x25f904);}(_0xf264,0xfd));var _0x4f26=function(_0x1ee392,_0x434efa){_0x1ee392=_0x1ee392-0x0;var _0x3eec85=_0xf264[_0x1ee392];return _0x3eec85;};'use strict';var fs=require('fs');var path=require(_0x4f26('0x0'));var _=require(_0x4f26('0x1'));var Papa=require(_0x4f26('0x2'));var util=require(_0x4f26('0x3'));var BPromise=require('bluebird');var moment=require(_0x4f26('0x4'));var squel=require('squel');var Redis=require(_0x4f26('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x4f26('0x6'));var logger=require('../../../config/logger')(_0x4f26('0x7'));config[_0x4f26('0x8')]=_[_0x4f26('0x9')](config[_0x4f26('0x8')],{'host':_0x4f26('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));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()[_0x4f26('0xb')](_0x4f26('0xc'));var tempTableName=_0x4f26('0xd')+moment()[_0x4f26('0xb')](_0x4f26('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x570aa4){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))*$/[_0x4f26('0xf')](_0x570aa4);}function selectNotIn(_0x443034,_0x56dca1,_0x5c0784,_0x47cd69,_0xf41928){return squel[_0x4f26('0x10')]()[_0x4f26('0x11')](_0x4f26('0x12'))['from'](_0x47cd69)[_0x4f26('0x13')](_0x56dca1,null,_0x56dca1+_0x4f26('0x14')+_0x47cd69+'.'+_0x5c0784)[_0x4f26('0x15')](_0x47cd69+'.'+_0x5c0784+'\x20=\x20'+_0x443034+'.'+_0x5c0784)[_0x4f26('0x15')](_0x56dca1+_0x4f26('0x16')+_0xf41928[_0x4f26('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xb068dc,_0x1bb5b6){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x4f26('0x17')](_0x4f26('0x18')+tempTableName)['spread'](function(_0x44b416){if(_0x44b416!==null){var _0x28c59c=[];for(var _0x40879c=0x0;_0x40879c<_0x44b416['length'];_0x40879c++){var _0x228b13=_0x44b416[_0x40879c];if(!_[_0x4f26('0x19')](_0x228b13[_0x4f26('0x12')])){if(!_['isNil'](_0x228b13['AdditionalPhones']))_0x28c59c['push'](insertAdditionalPhones(_0x228b13));promisesContact['push']({'contact':_0x228b13});}}}Promise[_0x4f26('0x1a')](_0x28c59c)[_0x4f26('0x1b')](function(){_0xb068dc({'val':0x1});});})[_0x4f26('0x1c')](function(_0x4c3765){logger[_0x4f26('0x1d')](_0x4c3765[_0x4f26('0x1e')]);});});}function insertAdditionalPhones(_0x5f4ee6){return new Promise(function(_0x3a4713,_0x498897){var _0x1bbb9b=_0x5f4ee6[_0x4f26('0x1f')];if(_['isNil'](_0x1bbb9b))_0x498897({'val':0x0});else{var _0xa20c88=_0x1bbb9b[_0x4f26('0x20')](';');var _0x1f02d7=[];orderBy=0x0;for(var _0xae0482=0x0;_0xae0482<_0xa20c88['length'];_0xae0482++){_0x1f02d7['push'](splitAdditionalPhone(_0x5f4ee6['id'],_0xa20c88[_0xae0482]));}Promise[_0x4f26('0x1a')](_0x1f02d7)[_0x4f26('0x1b')](function(){_0x3a4713({'val':_0xa20c88[_0x4f26('0x21')]});});}});}function splitAdditionalPhone(_0x3b0c84,_0x3cefd4){return new Promise(function(_0x3eac5f,_0x3ad5a3){var _0x8efd30=_0x3cefd4[_0x4f26('0x20')](':');var _0x1a95ff=_0x8efd30[0x0];var _0x532bea=_0x8efd30[0x1];if(_0x532bea!==''){var _0x31312c=_0x532bea[_0x4f26('0x20')]('|');var _0x15271c=[];for(var _0x39f7a8=0x0;_0x39f7a8<_0x31312c[_0x4f26('0x21')];_0x39f7a8++){if(_0x31312c[_0x39f7a8]!==''){var _0x4e076c=_[_0x4f26('0x22')](promisesAdditionalPhones,{'contactId':_0x3b0c84,'phone':_0x31312c[_0x39f7a8]});if(_0x4e076c[_0x4f26('0x21')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3b0c84,'contactTypeId':_0x1a95ff,'phone':_0x31312c[_0x39f7a8],'orderBy':orderBy});}}}_0x3eac5f({'ok':0x1});}else _0x3eac5f({'res':0x0});});}function createAdditionalPhone(_0xc6f1e1,_0x357944,_0x3c396b,_0x5ce655){var _0x4d210b='';var _0x5351b7='';var _0x4449e3=_0x3c396b[_0x4f26('0x20')]('§');_0x4d210b=_0x4449e3[0x0];if(_0x4449e3[_0x4f26('0x21')]==0x2)_0x5351b7=_0x4449e3[0x1];return new Promise(function(_0x49b125,_0x579954){return db[_0x4f26('0x23')][_0x4f26('0x24')]({'where':{'CmContactId':_0xc6f1e1,'item':_0x4d210b}})[_0x4f26('0x1b')](function(_0x58c529){if(_0x58c529){return db[_0x4f26('0x23')]['update']({'ItemTypeId':_0x357944,'description':_0x5351b7,'OrderBy':_0x5ce655},{'where':{'CmContactId':_0xc6f1e1,'item':_0x4d210b}})[_0x4f26('0x1b')](function(_0x51e9bc){_0x49b125({'res':_0x4f26('0x25')});});}else{return db[_0x4f26('0x23')][_0x4f26('0x26')]({'CmContactId':_0xc6f1e1,'item':_0x4d210b,'ItemTypeId':_0x357944,'description':_0x5351b7,'OrderBy':_0x5ce655,'ItemClass':'PHONE'})[_0x4f26('0x1b')](function(_0x3a783f){_0x49b125({'res':_0x4f26('0x27')});});}});});}function updateContact(_0x10d440){return new Promise(function(_0x48fefb,_0x1c02ab){var _0x135db7=_0x10d440['id'];delete _0x10d440['id'];return db[_0x4f26('0x28')]['update'](_0x10d440,{'where':{'id':_0x135db7}})[_0x4f26('0x1b')](function(_0x8b8863){updatedRows+=0x1;return db[_0x4f26('0x29')]['update']({'phone':_0x10d440['phone']},{'where':{'ContactId':_0x135db7}})[_0x4f26('0x1b')](function(_0x488100){_0x48fefb({'ret':'OK'});});});});}function insertCmHopper(_0x2df3dd,_0x579ba3,_0x227d1d,_0xb349d2,_0x3710a8){var _0x47d4ce=[_0x4f26('0x2a'),_0x4f26('0x2b'),_0x4f26('0x2c'),_0x4f26('0x2d'),_0x579ba3+'.'+_0xb349d2,_0x4f26('0x2e'),_0x4f26('0x2f'),'cm_contacts.priority',_0x4f26('0x30'),'\x22'+_0x3710a8+'\x22'];return squel['insert']()[_0x4f26('0x31')](_0x4f26('0x32'))[_0x4f26('0x33')](['phone',_0x4f26('0x34'),_0x4f26('0x35'),_0x4f26('0x36'),_0xb349d2,_0x4f26('0x37'),_0x4f26('0x38'),'priority',_0x4f26('0x39'),'recallme'],squel['select']()[_0x4f26('0x3a')](_0x47d4ce)['from'](_0x579ba3)[_0x4f26('0x13')](_0x4f26('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x579ba3+'.CmListId')[_0x4f26('0x13')](_0x227d1d,null,_0x227d1d+'.id\x20=\x20'+_0x579ba3+'.'+_0xb349d2)[_0x4f26('0x15')](_0x579ba3+_0x4f26('0x3c'),_0x2df3dd)[_0x4f26('0x15')](_0x4f26('0x3d'),NOW)[_0x4f26('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x579ba3,_0x227d1d,_0xb349d2,_0x4f26('0x32'),['\x22always\x22',_0x4f26('0x3e')]))[_0x4f26('0x15')](_0x4f26('0x3f'),selectNotIn(_0x579ba3,_0x227d1d,_0xb349d2,_0x4f26('0x32'),['\x22always\x22'])))[_0x4f26('0x40')]();}function insertCmHopperBlack(_0x59a15d,_0x1e6752,_0x58f222,_0x104cae){var _0x20c385=[_0x4f26('0x2a'),'cm_contacts.id',_0x4f26('0x2d'),_0x1e6752+'.'+_0x104cae,_0x4f26('0x2e'),_0x4f26('0x2f')];return squel['insert']()['into']('cm_hopper_black')[_0x4f26('0x33')](['phone',_0x4f26('0x35'),'ListId',_0x104cae,_0x4f26('0x37'),'updatedAt'],squel[_0x4f26('0x10')]()['fields'](_0x20c385)[_0x4f26('0x41')](_0x1e6752)[_0x4f26('0x13')](_0x4f26('0x3b'),null,_0x4f26('0x42')+_0x1e6752+_0x4f26('0x43'))[_0x4f26('0x13')](_0x58f222,null,_0x58f222+_0x4f26('0x14')+_0x1e6752+'.'+_0x104cae)[_0x4f26('0x15')](_0x1e6752+'.CmListId\x20=\x20?',_0x59a15d)['where'](_0x4f26('0x3d'),NOW)[_0x4f26('0x15')](_0x4f26('0x3f'),squel[_0x4f26('0x10')]()[_0x4f26('0x11')](_0x4f26('0x12'))[_0x4f26('0x41')](_0x4f26('0x44'))[_0x4f26('0x15')](_0x4f26('0x45'),_0x59a15d)[_0x4f26('0x15')](_0x104cae+_0x4f26('0x46'),_0x1e6752+'.'+_0x104cae)))['toString']();}function insertCmHopperAdditionalPhones(_0x2c4413){var _0x21aad7=[_0x4f26('0x47'),_0x4f26('0x48'),_0x4f26('0x49'),_0x4f26('0x4a'),_0x4f26('0x4b')];return squel['insert']()[_0x4f26('0x31')](_0x4f26('0x4c'))[_0x4f26('0x33')]([_0x4f26('0x4d'),'phone','OrderBy',_0x4f26('0x37'),_0x4f26('0x38')],squel[_0x4f26('0x10')]()[_0x4f26('0x3a')](_0x21aad7)[_0x4f26('0x41')]('cm_hopper')[_0x4f26('0x13')](_0x4f26('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x4f26('0x13')](_0x4f26('0x4e'),null,_0x4f26('0x4f'))[_0x4f26('0x15')](_0x4f26('0x50'),_0x2c4413)[_0x4f26('0x15')](_0x4f26('0x3d'),NOW))['toString']();}function insertCmContact(_0x5b53f5,_0x1210de,_0x2ee2a6,_0x2f88be){var _0x11e4c2=_[_0x4f26('0x51')](_[_0x4f26('0x52')](_0x2f88be),['ListId',_0x4f26('0x53'),_0x4f26('0x37'),_0x4f26('0x38')]);return squel[_0x4f26('0x54')]()[_0x4f26('0x31')](_0x4f26('0x3b'))[_0x4f26('0x33')](_0x11e4c2,squel[_0x4f26('0x10')]()[_0x4f26('0x3a')](_0x11e4c2)['from'](_0x1210de)[_0x4f26('0x15')]('('+_0x2ee2a6['join'](',')+_0x4f26('0x55'),squel[_0x4f26('0x10')]()[_0x4f26('0x3a')](_0x2ee2a6)['from'](_0x4f26('0x3b'))[_0x4f26('0x15')](_0x4f26('0x45'),_0x5b53f5))[_0x4f26('0x15')]('id\x20IN\x20?',squel['select']()[_0x4f26('0x11')](_0x4f26('0x56'),'min_id')[_0x4f26('0x41')](_0x1210de)[_0x4f26('0x57')](_0x2ee2a6[_0x4f26('0x13')](','))))[_0x4f26('0x40')]();}function handleStop(){logger[_0x4f26('0x58')](_0x4f26('0x59'));stopped=!![];}function handleUncaughtException(_0x55e07c){logger[_0x4f26('0x1d')](_0x55e07c[_0x4f26('0x1e')]);process[_0x4f26('0x5a')](0x1);}function handleError(_0x3cc1a2,_0x328994){stats[_0x4f26('0x5b')][_0x4f26('0x5c')]({'name':_0x328994[_0x4f26('0x5d')],'message':_0x328994[_0x4f26('0x1e')],'row':_0x3cc1a2});}function handleQuery(_0x186fdf){logger[_0x4f26('0x58')](_0x186fdf);return db[_0x4f26('0x5e')][_0x4f26('0x17')](_0x186fdf)[_0x4f26('0x5f')](function(_0x213969){results[_0x4f26('0x5c')](_0x213969);})[_0x4f26('0x1c')](function(_0x4a1346){logger[_0x4f26('0x1d')](_0x4a1346[_0x4f26('0x1e')]);});}function main(_0x4cd94b,_0x22b0e8,_0x565961,_0x1a578d){logger[_0x4f26('0x58')](_0x4f26('0x60'),_0x4cd94b,JSON[_0x4f26('0x61')](_0x22b0e8));process[_0x4f26('0x62')](_0x4f26('0x63'));var _0x2c8b7e=_0x22b0e8[_0x4f26('0x64')];var _0xb466da=_[_0x4f26('0x65')](_0x2c8b7e);var _0x1ea27e=_0x22b0e8[_0x4f26('0x66')];var _0x25eb3f=path[_0x4f26('0x13')](config[_0x4f26('0x67')],_0x4f26('0x68'),_0x1ea27e+_0x4f26('0x69'));logger[_0x4f26('0x58')](_0x4f26('0x6a'),_0x22b0e8);db[_0x4f26('0x6b')][_0x4f26('0x6c')]({'raw':!![],'attributes':['id','name']})[_0x4f26('0x1b')](function(_0x3a7f69){for(var _0x396012=0x0;_0x396012<_0x3a7f69[_0x4f26('0x21')];_0x396012++){if(_0x3a7f69[_0x396012][_0x4f26('0x6d')]in _0x2c8b7e){contactItemTypes[_0x4f26('0x5c')](_0x3a7f69[_0x396012]);delete _0xb466da[_0x3a7f69[_0x396012][_0x4f26('0x6d')]];hasAdditionalPhones=!![];}for(var _0x30dd79 in _0x2c8b7e){if(_0x3a7f69[_0x396012][_0x4f26('0x6d')]+_0x4f26('0x6e')===_0x30dd79){phoneDescriptions[_0x4f26('0x5c')]({'itemTypeId':_0x3a7f69[_0x396012]['id'],'description':_0x30dd79});delete _0xb466da[_0x30dd79];}}}if(hasAdditionalPhones)_0xb466da[_0x4f26('0x1f')]='';var _0x485457=_[_0x4f26('0x52')](_0xb466da)[_0x4f26('0x13')]();logger[_0x4f26('0x58')](_0x4f26('0x6f'),_0x485457);fs[_0x4f26('0x70')](_0x25eb3f,_0x485457+'\x0a');Papa['parse'](fs[_0x4f26('0x71')](_0x4cd94b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x28ef95,_0x15835d){try{for(var _0xf8f76e=0x0,_0x3f040e=[];_0xf8f76e<_0x28ef95[_0x4f26('0x72')]['length'];_0xf8f76e++){stats[_0x4f26('0x73')]+=0x1;if(_0x28ef95[_0x4f26('0x5b')][_0xf8f76e]){handleError(_0x28ef95[_0x4f26('0x72')][_0xf8f76e],_0x28ef95[_0x4f26('0x5b')][_0xf8f76e]);}else{var _0x35dfc0=[];var _0x44806c=[];var _0x2515b5={};for(var _0x221ee3 in _0x2c8b7e){let _0x916db5=contactItemTypes['find'](_0x4e71bf=>_0x4e71bf['name']===_0x221ee3);let _0x596119=contactItemTypes[_0x4f26('0x74')](_0x3ee7eb=>_0x3ee7eb[_0x4f26('0x6d')]+_0x4f26('0x6e')===_0x221ee3);if(_['isNil'](_0x916db5)&&_[_0x4f26('0x19')](_0x596119)){if(_0x2c8b7e[_0x4f26('0x75')](_0x221ee3)){if(_0x28ef95[_0x4f26('0x72')][_0xf8f76e][_0x2c8b7e[_0x221ee3]]){var _0x507c66=_[_0x4f26('0x76')](_0x28ef95[_0x4f26('0x72')][_0xf8f76e][_0x2c8b7e[_0x221ee3]][_0x4f26('0x77')](/"/g,'\x27'));switch(_0x221ee3){case'scheduledat':var _0x536826=moment(_0x507c66,_0x4f26('0xc'),!![]);if(_0x536826[_0x4f26('0x78')]()){_0x3f040e['push']('\x22'+_0x507c66+'\x22');}else{_0x35dfc0[_0x4f26('0x5c')](_0x4f26('0x79'));}break;case _0x4f26('0x7a'):var _0x403245=parseInt(_0x507c66);_0x507c66=_['isNaN'](_0x403245)||_0x403245<0x0||_0x403245>0x4?_0x1a578d?0x3:0x2:_0x403245;_0x3f040e['push']('\x22'+_0x507c66+'\x22');break;case _0x4f26('0x39'):var _0x30a50b=parseInt(_0x507c66);if(_[_0x4f26('0x7b')](_0x30a50b)&&_[_0x4f26('0x7c')](_0x565961,_0x30a50b)){_0x3f040e[_0x4f26('0x5c')]('\x22'+_0x30a50b+'\x22');}else{_0x35dfc0[_0x4f26('0x5c')](_0x4f26('0x7d'));}break;case _0x4f26('0x7e'):if(isEmail(_0x507c66)){_0x3f040e[_0x4f26('0x5c')]('\x22'+_0x507c66+'\x22');}else{_0x35dfc0['push'](_0x4f26('0x7f'));}break;case _0x4f26('0x80'):var _0x444e24=moment(_0x507c66,_0x4f26('0x81'),!![]);if(_0x444e24['isValid']()){_0x3f040e[_0x4f26('0x5c')]('\x22'+_0x507c66+'\x22');}else{_0x35dfc0[_0x4f26('0x5c')](_0x4f26('0x82'));}break;default:_0x3f040e[_0x4f26('0x5c')]('\x22'+_0x507c66+'\x22');}}else{switch(_0x221ee3){case'firstName':case _0x4f26('0x12'):_0x35dfc0['push'](_0x221ee3+_0x4f26('0x83'));break;default:_0x3f040e[_0x4f26('0x5c')]('\x22\x22');}}}}else{var _0x2edec1='';if(!_[_0x4f26('0x19')](_0x916db5)){if(!_0x2515b5['hasOwnProperty'](_0x916db5['id'])){for(var _0x59f114=0x0;_0x59f114<_0x2c8b7e[_0x221ee3][_0x4f26('0x21')];_0x59f114++){var _0x507c66=_[_0x4f26('0x76')](_0x28ef95[_0x4f26('0x72')][_0xf8f76e][_0x2c8b7e[_0x221ee3][_0x59f114]][_0x4f26('0x77')](/"/g,'\x27'));var _0x6af713=phoneDescriptions[_0x4f26('0x74')](_0x526add=>_0x526add[_0x4f26('0x84')]===_0x916db5['id']);if(!_[_0x4f26('0x19')](_0x6af713)){var _0x2f7c09=_[_0x4f26('0x76')](_0x28ef95[_0x4f26('0x72')][_0xf8f76e][_0x2c8b7e[_0x6af713[_0x4f26('0x85')]][0x0]][_0x4f26('0x77')](/"/g,'\x27'));if(!_[_0x4f26('0x19')](_0x2f7c09))_0x507c66=_0x507c66+'§'+_0x2f7c09;}if(_0x2edec1=='')_0x2edec1=_0x507c66;else _0x2edec1+='|'+_0x507c66;}_0x44806c['push'](_0x916db5['id']+':'+_0x2edec1);_0x2515b5[_0x916db5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3f040e[_0x4f26('0x5c')]('\x22'+_0x44806c['join'](';')+'\x22');}if(_0x35dfc0[_0x4f26('0x21')]){handleError(_0x28ef95[_0x4f26('0x72')][_0xf8f76e],{'code':_0x4f26('0x86'),'message':_0x35dfc0[_0x4f26('0x13')]()});}else{fs['appendFileSync'](_0x25eb3f,_0x3f040e[_0x4f26('0x13')]()+'\x0a');}_0x3f040e=[];}if(!(stats[_0x4f26('0x73')]%0xc8)){socket[_0x4f26('0x87')](_0x4f26('0x88')+_0x1ea27e,stats);stats[_0x4f26('0x5b')]=[];}}if(stopped){logger[_0x4f26('0x58')](_0x4f26('0x89'));_0x15835d[_0x4f26('0x8a')]();}}catch(_0x2430be){handleError(_0x28ef95[_0x4f26('0x72')][_0xf8f76e],{'code':_0x4f26('0x8b'),'message':_0x2430be[_0x4f26('0x1e')]});logger[_0x4f26('0x1d')](_0x4f26('0x8c'),_0x2430be[_0x4f26('0x1e')]);}},'complete':function(){try{var _0x3caec9=[];var _0x43a379=tempTableName;_0x3caec9['push'](_0x4f26('0x8d')+_0x43a379+_0x4f26('0x8e'));logger['info'](_0x4f26('0x8f'),contactItemTypes[_0x4f26('0x21')]);var _0x38157e=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x25eb3f,_0x43a379,_0x485457,_0x22b0e8[_0x4f26('0x36')],_0x22b0e8['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x2c8b7e[_0x4f26('0x34')])){_0x38157e+=_0x4f26('0x90');}_0x3caec9[_0x4f26('0x5c')](_0x38157e);BPromise[_0x4f26('0x91')](_0x3caec9,handleQuery)['then'](function(_0x322b99){BPromise[_0x4f26('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x3caec9=[];for(var _0xed5a6d=0x0;_0xed5a6d\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','isEmpty'];(function(_0x2d7c56,_0x393f0b){var _0x17fe3c=function(_0x1b2e18){while(--_0x1b2e18){_0x2d7c56['push'](_0x2d7c56['shift']());}};_0x17fe3c(++_0x393f0b);}(_0x750a,0x140));var _0xa750=function(_0x52ffea,_0x1d9542){_0x52ffea=_0x52ffea-0x0;var _0x1780c4=_0x750a[_0x52ffea];return _0x1780c4;};'use strict';var _=require('lodash');var squel=require(_0xa750('0x0'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0xa750('0x1'))[_0xa750('0x2')];var utils=require(_0xa750('0x3'));var db=require(_0xa750('0x4'))['db'];function skipInteractionsQuery(_0x457cae,_0x43d704,_0x562911){var _0x4aa8b1=![];var _0x10b4d9=utils[_0xa750('0x5')](_0x457cae);if(_0x43d704[_0xa750('0x6')]===_0xa750('0x7')&&!_0x562911[_0xa750('0x8')]&&!_0x562911[_0x10b4d9]){_0x4aa8b1=!![];}return _0x4aa8b1;}function getTagsQuery(){return squel['select']()['field']('id')[_0xa750('0x9')]('name')[_0xa750('0x9')](_0xa750('0xa'))['from'](_0xa750('0xb'));}function getUsersQuery(_0x2c2ea4,_0x5870f0){var _0x5aca9c=utils[_0xa750('0xc')](_0x2c2ea4);var _0x4b19a1=_0xa750('0xd')+_0x2c2ea4+_0xa750('0xe');var _0x4d49c3=squel[_0xa750('0xf')]()[_0xa750('0x9')](_0xa750('0x10'))['field'](_0xa750('0x11'))[_0xa750('0x9')](_0xa750('0x12')+_0x5aca9c)[_0xa750('0x13')](_0x4b19a1,'ui')[_0xa750('0x14')](_0xa750('0x15'),'u','u.id\x20=\x20ui.UserId');if(_0x5870f0[_0xa750('0x16')]>0x0){_0x4d49c3[_0xa750('0x17')](_0xa750('0x12')+_0x5aca9c+'\x20IN\x20?',_[_0xa750('0x18')](_0x5870f0,'id'));}return _0x4d49c3;}function getInteractionsQuery(_0x29480c){var _0x58639b=utils['getInteractionsTables'](_0x29480c);var _0x321eb2=utils['getAccountFK'](_0x29480c);var _0x433dbd=utils[_0xa750('0xc')](_0x29480c);return squel['select']()[_0xa750('0x13')](_0x58639b['interactions'],'i')['left_join'](_0xa750('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa750('0x14')]('users','o',_0xa750('0x1a'))['left_join'](_0x58639b[_0xa750('0x1b')],'a','a.id\x20=\x20i.'+_0x321eb2)[_0xa750('0x14')](_0x58639b['messages'],'me','me.'+_0x433dbd+_0xa750('0x1c'))['left_join'](_0x58639b[_0xa750('0x1d')],'it','it.'+_0x433dbd+'\x20=\x20i.id')['left_join']('tools_tags','t',_0xa750('0x1e'));}function getSqlClauses(){var _0x2ec6c4={'body':squel[_0xa750('0x1f')](),'contact':squel[_0xa750('0x1f')](),'default':squel[_0xa750('0x1f')](),'fields':squel[_0xa750('0x1f')](),'filter':squel[_0xa750('0x1f')](),'read':squel[_0xa750('0x1f')](),'tags':{'clause':squel[_0xa750('0x1f')](),'ids':null},'user':squel[_0xa750('0x1f')]()};return _0x2ec6c4;}function parseTagParameter(_0xe92342){var _0x27a5eb=squel[_0xa750('0x1f')]();if(_0xe92342){var _0x3f7d6d=utils[_0xa750('0x20')](_0xe92342);_0x3f7d6d['forEach'](function(_0x3d3923){_0x27a5eb['or'](_0xa750('0x21'),'%,'+_0x3d3923+',%');});}return _0x27a5eb;}function parseReadParameter(_0x21cd2c){var _0x4cceee='';if(_0x21cd2c){_0x4cceee=_0xa750('0x22');if(_0x21cd2c==='1'){_0x4cceee=_0x4cceee[_0xa750('0x23')](_0xa750('0x24'),'=');}else{_0x4cceee=_0x4cceee[_0xa750('0x23')]('{OPERATOR}','>');}}return _0x4cceee;}function parseSearchFilter(_0x297eef,_0x34d5e9){var _0x449bb7=squel[_0xa750('0x1f')]();if(_0x34d5e9){var _0x2c5253=_0x34d5e9['replace']('\x5c','\x5c\x5c')[_0xa750('0x23')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2c5253)){_0x449bb7['or'](_0xa750('0x25'),_0x2c5253+'%');if([_0xa750('0x26'),'whatsapp'][_0xa750('0x27')](_0x297eef)){_0x449bb7['or'](_0xa750('0x28'),_0x2c5253+'%');}else if(_0x297eef===_0xa750('0x29')){_0x449bb7['or'](_0xa750('0x2a'),_0x2c5253+'%');}else if(_0x297eef===_0xa750('0x2b')){_0x449bb7['or'](_0xa750('0x2c'),_0x2c5253+'%');}}else if(_0x297eef===_0xa750('0x2d')&&qs[_0xa750('0x2e')](_0x2c5253)){_0x449bb7['or']('c.email\x20LIKE\x20?',_0x2c5253+'%');}else{if(_0x297eef===_0xa750('0x2d')){_0x449bb7['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa750('0x2f')](_0x2c5253))['or'](_0xa750('0x30'),qs[_0xa750('0x2f')](_0x2c5253));}else{if(_0x297eef!==_0xa750('0x29')){_0x449bb7['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa750('0x2f')](_0x2c5253));}_0x449bb7['or'](_0xa750('0x31'),_0x2c5253+'%');}}}return _0x449bb7;}function parseAdvancedSearchFilter(_0x5c2e02,_0x3f31b5){var _0x330710=getSqlClauses();var _0x280b87=as[_0xa750('0x32')](_0x5c2e02);var _0x4b13fc=_0x280b87[_0xa750('0x33')];for(var _0x5a0bbd=0x0;_0x5a0bbd<_0x280b87['conditions'][_0xa750('0x16')];_0x5a0bbd++){var _0x146cad=_0x280b87[_0xa750('0x34')][_0x5a0bbd];var _0x5254a3='i';var _0x470089=_[_0xa750('0x35')](_0x3f31b5,[_0xa750('0x36'),_0x146cad['field']]);if(_0x470089){var _0x37abd2=as[_0xa750('0x37')](_0x5254a3,_0x470089[_0xa750('0x38')],_0x146cad);_0x330710['default'][_0x4b13fc](_0x37abd2[_0xa750('0x39')],_0x37abd2[_0xa750('0x3a')][_0xa750('0x3b')],_0x37abd2['value'][_0xa750('0x3c')]);}else{switch(_0x146cad[_0xa750('0x9')]){case _0xa750('0x3d'):var _0x10589b=parseReadParameter(_0x146cad['value']);_0x330710['read'][_0xa750('0x3e')](_0x10589b);break;case _0xa750('0x3f'):if(_0x146cad['operator']===_0xa750('0x40')){if(_0x146cad[_0xa750('0x3a')][_0xa750('0x41')]('\x20')[_0xa750('0x16')]>0x1){_0x330710[_0xa750('0x42')][_0x4b13fc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa750('0x2f')](_0x146cad[_0xa750('0x3a')]),null);}else{var _0x847081='%'+_0x146cad[_0xa750('0x3a')]+'%';_0x330710[_0xa750('0x42')][_0x4b13fc](_0xa750('0x43'),_0x847081,_0x847081,_0x847081);}}else{_0x470089=_[_0xa750('0x35')](_0x3f31b5,['name',_0xa750('0x44')]);_0x146cad['field']=_0xa750('0x44');_0x37abd2=as['buildExpression'](_0x5254a3,_0x470089[_0xa750('0x38')],_0x146cad);_0x330710[_0xa750('0x42')][_0x4b13fc](_0x37abd2[_0xa750('0x39')],_0x37abd2[_0xa750('0x3a')][_0xa750('0x3b')],_0x37abd2[_0xa750('0x3a')][_0xa750('0x3c')]);}break;case _0xa750('0x45'):var _0x42565b=_0x146cad[_0xa750('0x3a')][_0xa750('0x41')](',')[_0xa750('0x18')](function(_0x3ec860){return Number(_0x3ec860);});var _0x4607fe=parseTagParameter(_0x42565b);_0x330710[_0xa750('0x46')][_0xa750('0x47')][_0xa750('0x3e')](_0x4607fe);_0x330710[_0xa750('0x46')][_0xa750('0x48')]=_0x42565b;break;case _0xa750('0x49'):if(_0x146cad['operator']===_0xa750('0x40')){_0x330710[_0xa750('0x4a')][_0x4b13fc](_0xa750('0x4b'),'%'+_0x146cad[_0xa750('0x3a')]+'%',null);}else{_0x470089=_[_0xa750('0x35')](_0x3f31b5,[_0xa750('0x36'),_0xa750('0x4c')]);_0x146cad[_0xa750('0x9')]=_0xa750('0x4c');_0x37abd2=as['buildExpression'](_0x5254a3,_0x470089[_0xa750('0x38')],_0x146cad);_0x330710[_0xa750('0x4a')][_0x4b13fc](_0x37abd2['text'],_0x37abd2[_0xa750('0x3a')][_0xa750('0x3b')],_0x37abd2[_0xa750('0x3a')][_0xa750('0x3c')]);}break;case _0xa750('0x4d'):case _0xa750('0x4e'):_0x37abd2=as[_0xa750('0x37')]('me',null,_0x146cad);_0x330710[_0xa750('0x4d')][_0x4b13fc](_0x37abd2[_0xa750('0x39')],_0x37abd2[_0xa750('0x3a')]['start'],_0x37abd2[_0xa750('0x3a')][_0xa750('0x3c')]);break;}}}return _0x330710;}function parseModelFields(_0x58afd2,_0x93e49f,_0x2397e1){var _0x3501ee=utils['getAccountFK'](_0x58afd2);var _0x414abf=squel[_0xa750('0x1f')]();var _0x1e5a9a=_(_0x93e49f)[_0xa750('0x4f')]()['map'](function(_0x34cdae){return _[_0xa750('0x50')](_0x2397e1,[_0xa750('0x36'),_0x34cdae])?_0x34cdae:undefined;})[_0xa750('0x51')]()['value']();if(_0x1e5a9a[_0xa750('0x16')]>0x0){_0x1e5a9a[_0xa750('0x52')](function(_0x495b28){if(_0x495b28===_0x3501ee){_0x414abf[_0xa750('0x3e')]('i.'+_0x3501ee+'\x20IN\x20?',[][_0xa750('0x53')](_0x93e49f[_0x495b28]));}else if(_0x495b28===_0xa750('0x54')){var _0x4f46da=JSON['parse'](_0x93e49f[_0x495b28])['$gte'];var _0x232da4=JSON[_0xa750('0x55')](_0x93e49f[_0x495b28])['$lte'];_0x414abf[_0xa750('0x3e')](_0xa750('0x56'),_0x4f46da,_0x232da4);}else{if(_0x93e49f[_0x495b28]===_0xa750('0x57')){_0x414abf['and']('i.'+_0x495b28+'\x20IS\x20NULL');}else{_0x414abf['and']('i.'+_0x495b28+'\x20=\x20?',_0x93e49f[_0x495b28]);}}});}return _0x414abf;}function parseQueryParameters(_0x3c34d4,_0x4a1b5d,_0x46a29d){var _0x26119b=getSqlClauses();return Promise['resolve']()[_0xa750('0x58')](function(){return parseModelFields(_0x3c34d4,_0x4a1b5d,_0x46a29d);})['then'](function(_0x3e6129){_0x26119b['fields']['and'](_0x3e6129);return parseReadParameter(_0x4a1b5d['read']);})['then'](function(_0x356147){_0x26119b[_0xa750('0x59')]['and'](_0x356147);return parseTagParameter(_0x4a1b5d['tag']);})['then'](function(_0x42b238){_0x26119b[_0xa750('0x46')][_0xa750('0x47')][_0xa750('0x3e')](_0x42b238);return parseSearchFilter(_0x3c34d4,_0x4a1b5d[_0xa750('0x5a')]);})[_0xa750('0x58')](function(_0x599e7e){_0x26119b['filter']=_0x599e7e;return _0x26119b;});}function checkAccountsRestrictions(_0x440975,_0x46cf12,_0x13d729){var _0x11163d=utils[_0xa750('0x5')](_0x440975);var _0x5a3cd5=_0xa750('0x5b')+_[_0xa750('0x5c')](_0x440975)+(_0x440975===_0xa750('0x5d')?_0xa750('0x5e'):_0xa750('0x5f'));var _0x2ec84f=squel[_0xa750('0x1f')]();return Promise[_0xa750('0x60')]()['then'](function(){if(_0x13d729[_0xa750('0x8')]&&_0x46cf12[_0xa750('0x6')]===_0xa750('0x7')){return _0x46cf12[_0x5a3cd5]({'attributes':['id'],'raw':!![]});}})[_0xa750('0x58')](function(_0x58bc33){if(_0x58bc33){if(_0x58bc33['length']===0x0){_0x2ec84f[_0xa750('0x3e')]('i.'+_0x11163d+_0xa750('0x61'));}else{_0x2ec84f[_0xa750('0x3e')]('i.'+_0x11163d+_0xa750('0x62'),_[_0xa750('0x18')](_0x58bc33,'id'));}}else if(!_0x13d729[_0x11163d]){_0x2ec84f[_0xa750('0x3e')]('i.'+_0x11163d+_0xa750('0x63'));}})[_0xa750('0x58')](function(){return _0x2ec84f;});}function getClosedOrderClause(_0x4295b9,_0x26bbf5){var _0x32fd6b='';var _0x3e0ec8=[_0xa750('0x64'),_0xa750('0x65'),_0xa750('0x66')];if(_0x4295b9===_0xa750('0x2d')){_0x3e0ec8['unshift'](_0xa750('0x67'));}if(_0x26bbf5['closed']==='0'&&_0x4295b9===_0xa750('0x2d')){_0x32fd6b=_0xa750('0x67');}else{if(_0x26bbf5[_0xa750('0x68')]==='1'){_0x3e0ec8['shift']();}_0x32fd6b=_0xa750('0x69')+_0x3e0ec8[_0xa750('0x6a')](',\x20')+')';}return _0x32fd6b;}function getFilteredInteractions(_0x1630ce,_0x2922b5,_0x314787,_0x278a58){var _0x48fbd0=utils[_0xa750('0xc')](_0x1630ce);var _0x117fb5=_['capitalize'](_0x1630ce)+_0xa750('0x6b');var _0x1bdc5e=[];var _0xeaa46c=getTagsQuery();var _0xe4d85b={'type':db[_0xa750('0x6c')][_0xa750('0x6d')][_0xa750('0x6e')],'raw':!![]};var _0xc0b61b=[];var _0x1af7bb=[];return db[_0xa750('0x6f')][_0xa750('0x70')](_0xeaa46c['toString'](),_0xe4d85b)['then'](function(_0x230582){_0x1bdc5e=_[_0xa750('0x71')](_0x230582,'id');_0xe4d85b=_[_0xa750('0x72')](_0xe4d85b,{'model':db[_0x117fb5],'mapToModel':!![],'nest':!![]});if(_0x314787[_0xa750('0x73')]){_0x278a58['attributes'][_0xa750('0x52')](function(_0x67c70b){_0x2922b5[_0xa750('0x9')]('i.'+_0x67c70b);});}else{_0x2922b5[_0xa750('0x9')](_0xa750('0x74'),_0xa750('0x3d'));_0x2922b5[_0xa750('0x9')](_0xa750('0x75'),_0xa750('0x76'));_0x2922b5[_0xa750('0x9')](_0xa750('0x77'),'Account.mandatoryDisposition');if(_0x1630ce==='mail'){_0x2922b5[_0xa750('0x9')]('a.email','Account.email');_0x2922b5[_0xa750('0x9')](_0xa750('0x78'),_0xa750('0x79'));_0x2922b5[_0xa750('0x9')](_0xa750('0x7a'));_0x2922b5['field'](_0xa750('0x7b'));_0x2922b5[_0xa750('0x9')](_0xa750('0x7c'));_0x2922b5[_0xa750('0x9')](_0xa750('0x7d'));_0x2922b5[_0xa750('0x9')]('i.closedAt');_0x2922b5['field'](_0xa750('0x7e'));_0x2922b5[_0xa750('0x9')](_0xa750('0x7f'));_0x2922b5[_0xa750('0x9')](_0xa750('0x80'));_0x2922b5[_0xa750('0x9')](_0xa750('0x81'));_0x2922b5[_0xa750('0x9')]('i.disposition');_0x2922b5[_0xa750('0x9')]('i.secondDisposition');_0x2922b5['field'](_0xa750('0x64'));_0x2922b5[_0xa750('0x9')](_0xa750('0x67'));_0x2922b5[_0xa750('0x9')]('i.to');_0x2922b5[_0xa750('0x9')](_0xa750('0x82'));_0x2922b5[_0xa750('0x9')](_0xa750('0x83'));_0x2922b5['field'](_0xa750('0x84'));}else if(_0x1630ce===_0xa750('0x2b')){_0x2922b5[_0xa750('0x9')](_0xa750('0x85'),_0xa750('0x79'));}else{_0x2922b5[_0xa750('0x9')](_0xa750('0x86'),_0xa750('0x79'));}if(_0x1630ce!=='mail'){_0x2922b5['field'](_0xa750('0x87'));}_0x2922b5['field'](_0xa750('0x88'),_0xa750('0x89'));_0x2922b5['field'](_0xa750('0x8a'),'Contact.lastName');_0x2922b5[_0xa750('0x9')](_0xa750('0x8b'),_0xa750('0x8c'));_0x2922b5['field'](_0xa750('0x8d'),_0xa750('0x8e'));_0x2922b5[_0xa750('0x9')](_0xa750('0x8f'),'Contact.mobile');_0x2922b5['field']('c.fax',_0xa750('0x90'));_0x2922b5[_0xa750('0x9')]('o.fullname',_0xa750('0x91'));_0x2922b5[_0xa750('0x9')](_0xa750('0x92'),_0xa750('0x93'));_0x2922b5[_0xa750('0x9')](_0xa750('0x94'),'TagIds');}if(_0x278a58[_0xa750('0x95')]){_0x2922b5[_0xa750('0x95')](_0x278a58[_0xa750('0x95')]);}if(_0x278a58['offset']){_0x2922b5[_0xa750('0x96')](_0x278a58[_0xa750('0x96')]);}return db[_0xa750('0x6f')][_0xa750('0x70')](_0x2922b5['toString'](),_0xe4d85b);})[_0xa750('0x58')](function(_0x15552b){_0xc0b61b=_0x15552b;var _0x32b8e7=getUsersQuery(_0x1630ce,_0xc0b61b);return db['sequelize'][_0xa750('0x70')](_0x32b8e7['toString'](),_0xe4d85b);})[_0xa750('0x58')](function(_0x2e3b00){_0x1af7bb=_[_0xa750('0x97')](_0x2e3b00,_0x48fbd0);if(_0x1630ce===_0xa750('0x2d')){return db[_0xa750('0x98')]['findOne']({'attributes':[_0xa750('0x99')],'raw':!![]});}})[_0xa750('0x58')](function(_0xec315a){var _0x105ed2=_0xec315a?_0xec315a[_0xa750('0x99')]:undefined;var _0x5cf9ab=_0xc0b61b[_0xa750('0x18')](function(_0x4169cb){return updateInteraction(_0x4169cb,_0x1bdc5e,_0x1af7bb,_0x105ed2);});return Promise[_0xa750('0x9a')](_0x5cf9ab);});}function countFilteredInteractions(_0x24264c,_0x30f47f){var _0x2553f8=_0x24264c[_0xa750('0x9b')]();_0x2553f8[_0xa750('0x9')]('COUNT(*)');_0x2553f8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x40482f=utils['getSelectedTags'](_0x30f47f);if(!_[_0xa750('0x9c')](_0x40482f)){_0x2553f8[_0xa750('0x17')](_0xa750('0x9d'),_0x40482f);}var _0x21f138={'type':db[_0xa750('0x6c')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0xa750('0x6f')][_0xa750('0x70')](_0x2553f8['toString'](),_0x21f138);}module[_0xa750('0x9e')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x76dc=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','getAccountFK','search','select','field','color','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','length','where','\x20IN\x20?','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','i.id\x20LIKE\x20?','whatsapp','i.phone\x20LIKE\x20?','fax','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','sqlOperator','conditions','find','name','buildExpression','text','start','value','end','read','and','Contact','operator','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','Tag','map','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','keys','some','compact','forEach','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','resolve','then','fields','tag','tags','filter','get','capitalize','chat','Websites','Accounts','role','agent','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','closed','i.substatus','shift','Interaction','SELECT','sequelize','query','keyBy','merge','attributes','unreadMessages','a.key','Account.key','a.mandatoryDisposition','a.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.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','TagIds','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)'];(function(_0x39a048,_0x149804){var _0x1070b0=function(_0x3c34ea){while(--_0x3c34ea){_0x39a048['push'](_0x39a048['shift']());}};_0x1070b0(++_0x149804);}(_0x76dc,0x1f2));var _0xc76d=function(_0x514b51,_0x19872f){_0x514b51=_0x514b51-0x0;var _0x1379ad=_0x76dc[_0x514b51];return _0x1379ad;};'use strict';var _=require(_0xc76d('0x0'));var squel=require(_0xc76d('0x1'));var as=require(_0xc76d('0x2'));var qs=require(_0xc76d('0x3'));var updateInteraction=require('./update-interaction')[_0xc76d('0x4')];var utils=require(_0xc76d('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x300f11,_0x50ed3a,_0x507ea7){var _0x1ae435=![];var _0x29ab70=utils[_0xc76d('0x6')](_0x300f11);if(_0x50ed3a['role']==='agent'&&!_0x507ea7[_0xc76d('0x7')]&&!_0x507ea7[_0x29ab70]){_0x1ae435=!![];}return _0x1ae435;}function getTagsQuery(){return squel[_0xc76d('0x8')]()[_0xc76d('0x9')]('id')['field']('name')[_0xc76d('0x9')](_0xc76d('0xa'))['from'](_0xc76d('0xb'));}function getUsersQuery(_0x583e46,_0xd5c042){var _0x2e1807=utils[_0xc76d('0xc')](_0x583e46);var _0x95e06b=_0xc76d('0xd')+_0x583e46+_0xc76d('0xe');var _0x100181=squel[_0xc76d('0x8')]()[_0xc76d('0x9')](_0xc76d('0xf'))[_0xc76d('0x9')](_0xc76d('0x10'))[_0xc76d('0x9')](_0xc76d('0x11')+_0x2e1807)['from'](_0x95e06b,'ui')[_0xc76d('0x12')](_0xc76d('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0xd5c042[_0xc76d('0x14')]>0x0){_0x100181[_0xc76d('0x15')](_0xc76d('0x11')+_0x2e1807+_0xc76d('0x16'),_['map'](_0xd5c042,'id'));}return _0x100181;}function getInteractionsQuery(_0x32e0a8){var _0x5d881c=utils['getInteractionsTables'](_0x32e0a8);var _0x45a83e=utils[_0xc76d('0x6')](_0x32e0a8);var _0x339623=utils[_0xc76d('0xc')](_0x32e0a8);return squel[_0xc76d('0x8')]()['from'](_0x5d881c[_0xc76d('0x17')],'i')[_0xc76d('0x12')](_0xc76d('0x18'),'c',_0xc76d('0x19'))[_0xc76d('0x12')]('users','o',_0xc76d('0x1a'))[_0xc76d('0x12')](_0x5d881c['accounts'],'a',_0xc76d('0x1b')+_0x45a83e)[_0xc76d('0x12')](_0x5d881c[_0xc76d('0x1c')],'me',_0xc76d('0x1d')+_0x339623+_0xc76d('0x1e'))[_0xc76d('0x12')](_0x5d881c[_0xc76d('0x1f')],'it',_0xc76d('0x20')+_0x339623+_0xc76d('0x1e'))[_0xc76d('0x12')](_0xc76d('0xb'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x11b42f={'body':squel[_0xc76d('0x21')](),'contact':squel['expr'](),'default':squel[_0xc76d('0x21')](),'fields':squel[_0xc76d('0x21')](),'filter':squel['expr'](),'read':squel[_0xc76d('0x21')](),'tags':{'clause':squel[_0xc76d('0x21')](),'ids':null},'user':squel[_0xc76d('0x21')]()};return _0x11b42f;}function parseTagParameter(_0xd1dda0){var _0xfc4aea=squel[_0xc76d('0x21')]();if(_0xd1dda0){var _0x89ee5=utils['getSelectedTags'](_0xd1dda0);_0x89ee5['forEach'](function(_0x285430){_0xfc4aea['or'](_0xc76d('0x22'),'%,'+_0x285430+',%');});}return _0xfc4aea;}function parseReadParameter(_0x5069ea){var _0x31501a='';if(_0x5069ea){_0x31501a=_0xc76d('0x23');if(_0x5069ea==='1'){_0x31501a=_0x31501a[_0xc76d('0x24')]('{OPERATOR}','=');}else{_0x31501a=_0x31501a[_0xc76d('0x24')]('{OPERATOR}','>');}}return _0x31501a;}function parseSearchFilter(_0x13b468,_0x18a7fa){var _0x4d896c=squel[_0xc76d('0x21')]();if(_0x18a7fa){var _0x1c68f3=_0x18a7fa[_0xc76d('0x24')]('\x5c','\x5c\x5c')[_0xc76d('0x24')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1c68f3)){_0x4d896c['or'](_0xc76d('0x25'),_0x1c68f3+'%');if(['sms',_0xc76d('0x26')]['includes'](_0x13b468)){_0x4d896c['or'](_0xc76d('0x27'),_0x1c68f3+'%');}else if(_0x13b468===_0xc76d('0x28')){_0x4d896c['or']('i.fax\x20LIKE\x20?',_0x1c68f3+'%');}else if(_0x13b468==='openchannel'){_0x4d896c['or']('i.from\x20LIKE\x20?',_0x1c68f3+'%');}}else if(_0x13b468==='mail'&&qs[_0xc76d('0x29')](_0x1c68f3)){_0x4d896c['or'](_0xc76d('0x2a'),_0x1c68f3+'%');}else{if(_0x13b468===_0xc76d('0x2b')){_0x4d896c['or'](_0xc76d('0x2c'),qs[_0xc76d('0x2d')](_0x1c68f3))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc76d('0x2d')](_0x1c68f3));}else{if(_0x13b468!=='fax'){_0x4d896c['or'](_0xc76d('0x2e'),qs['getFullTextValue'](_0x1c68f3));}_0x4d896c['or'](_0xc76d('0x2f'),_0x1c68f3+'%');}}}return _0x4d896c;}function parseAdvancedSearchFilter(_0x2332f5,_0x237de9){var _0x20fe33=getSqlClauses();var _0x2aa24d=as['parseSearch'](_0x2332f5);var _0xc2765c=_0x2aa24d[_0xc76d('0x30')];for(var _0x32d04c=0x0;_0x32d04c<_0x2aa24d['conditions'][_0xc76d('0x14')];_0x32d04c++){var _0x10a6b1=_0x2aa24d[_0xc76d('0x31')][_0x32d04c];var _0x550087='i';var _0x9cbf1e=_[_0xc76d('0x32')](_0x237de9,[_0xc76d('0x33'),_0x10a6b1[_0xc76d('0x9')]]);if(_0x9cbf1e){var _0x41fcc2=as[_0xc76d('0x34')](_0x550087,_0x9cbf1e['type'],_0x10a6b1);_0x20fe33['default'][_0xc2765c](_0x41fcc2[_0xc76d('0x35')],_0x41fcc2['value'][_0xc76d('0x36')],_0x41fcc2[_0xc76d('0x37')][_0xc76d('0x38')]);}else{switch(_0x10a6b1[_0xc76d('0x9')]){case'unreadMessages':var _0x581186=parseReadParameter(_0x10a6b1[_0xc76d('0x37')]);_0x20fe33[_0xc76d('0x39')][_0xc76d('0x3a')](_0x581186);break;case _0xc76d('0x3b'):if(_0x10a6b1[_0xc76d('0x3c')]==='$substring'){if(_0x10a6b1[_0xc76d('0x37')][_0xc76d('0x3d')]('\x20')[_0xc76d('0x14')]>0x1){_0x20fe33[_0xc76d('0x3e')][_0xc2765c](_0xc76d('0x3f'),qs[_0xc76d('0x2d')](_0x10a6b1[_0xc76d('0x37')]),null);}else{var _0x341094='%'+_0x10a6b1[_0xc76d('0x37')]+'%';_0x20fe33[_0xc76d('0x3e')][_0xc2765c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x341094,_0x341094,_0x341094);}}else{_0x9cbf1e=_['find'](_0x237de9,[_0xc76d('0x33'),_0xc76d('0x40')]);_0x10a6b1[_0xc76d('0x9')]=_0xc76d('0x40');_0x41fcc2=as['buildExpression'](_0x550087,_0x9cbf1e['type'],_0x10a6b1);_0x20fe33[_0xc76d('0x3e')][_0xc2765c](_0x41fcc2[_0xc76d('0x35')],_0x41fcc2[_0xc76d('0x37')][_0xc76d('0x36')],_0x41fcc2[_0xc76d('0x37')][_0xc76d('0x38')]);}break;case _0xc76d('0x41'):var _0x2ec887=_0x10a6b1['value'][_0xc76d('0x3d')](',')[_0xc76d('0x42')](function(_0x1bf8a0){return Number(_0x1bf8a0);});var _0x243af5=parseTagParameter(_0x2ec887);_0x20fe33['tags']['clause']['and'](_0x243af5);_0x20fe33['tags']['ids']=_0x2ec887;break;case'User':if(_0x10a6b1['operator']===_0xc76d('0x43')){_0x20fe33[_0xc76d('0x44')][_0xc2765c](_0xc76d('0x45'),'%'+_0x10a6b1[_0xc76d('0x37')]+'%',null);}else{_0x9cbf1e=_[_0xc76d('0x32')](_0x237de9,[_0xc76d('0x33'),_0xc76d('0x46')]);_0x10a6b1[_0xc76d('0x9')]='UserId';_0x41fcc2=as[_0xc76d('0x34')](_0x550087,_0x9cbf1e[_0xc76d('0x47')],_0x10a6b1);_0x20fe33[_0xc76d('0x44')][_0xc2765c](_0x41fcc2[_0xc76d('0x35')],_0x41fcc2[_0xc76d('0x37')][_0xc76d('0x36')],_0x41fcc2[_0xc76d('0x37')][_0xc76d('0x38')]);}break;case _0xc76d('0x48'):case'plainBody':_0x41fcc2=as['buildExpression']('me',null,_0x10a6b1);_0x20fe33[_0xc76d('0x48')][_0xc2765c](_0x41fcc2[_0xc76d('0x35')],_0x41fcc2[_0xc76d('0x37')][_0xc76d('0x36')],_0x41fcc2[_0xc76d('0x37')]['end']);break;}}}return _0x20fe33;}function parseModelFields(_0x25fc9d,_0x1ede13,_0x5e48fe){var _0x533ba8=utils[_0xc76d('0x6')](_0x25fc9d);var _0x2c3120=squel['expr']();var _0xe44a25=_(_0x1ede13)[_0xc76d('0x49')]()[_0xc76d('0x42')](function(_0x23f4c8){return _[_0xc76d('0x4a')](_0x5e48fe,[_0xc76d('0x33'),_0x23f4c8])?_0x23f4c8:undefined;})[_0xc76d('0x4b')]()[_0xc76d('0x37')]();if(_0xe44a25[_0xc76d('0x14')]>0x0){_0xe44a25[_0xc76d('0x4c')](function(_0x56dc48){if(_0x56dc48===_0x533ba8){_0x2c3120[_0xc76d('0x3a')]('i.'+_0x533ba8+_0xc76d('0x16'),[][_0xc76d('0x4d')](_0x1ede13[_0x56dc48]));}else if(_0x56dc48==='createdAt'){var _0xbb9ef3=JSON[_0xc76d('0x4e')](_0x1ede13[_0x56dc48])['$gte'];var _0x366d43=JSON['parse'](_0x1ede13[_0x56dc48])[_0xc76d('0x4f')];_0x2c3120[_0xc76d('0x3a')](_0xc76d('0x50'),_0xbb9ef3,_0x366d43);}else{if(_0x1ede13[_0x56dc48]===_0xc76d('0x51')){_0x2c3120[_0xc76d('0x3a')]('i.'+_0x56dc48+'\x20IS\x20NULL');}else{_0x2c3120['and']('i.'+_0x56dc48+'\x20=\x20?',_0x1ede13[_0x56dc48]);}}});}return _0x2c3120;}function parseQueryParameters(_0x320483,_0x746759,_0xe72796){var _0x25cfee=getSqlClauses();return Promise[_0xc76d('0x52')]()[_0xc76d('0x53')](function(){return parseModelFields(_0x320483,_0x746759,_0xe72796);})['then'](function(_0x41cc7e){_0x25cfee[_0xc76d('0x54')][_0xc76d('0x3a')](_0x41cc7e);return parseReadParameter(_0x746759[_0xc76d('0x39')]);})[_0xc76d('0x53')](function(_0x4ce981){_0x25cfee[_0xc76d('0x39')][_0xc76d('0x3a')](_0x4ce981);return parseTagParameter(_0x746759[_0xc76d('0x55')]);})[_0xc76d('0x53')](function(_0x36b002){_0x25cfee[_0xc76d('0x56')]['clause'][_0xc76d('0x3a')](_0x36b002);return parseSearchFilter(_0x320483,_0x746759[_0xc76d('0x57')]);})['then'](function(_0x5f3973){_0x25cfee[_0xc76d('0x57')]=_0x5f3973;return _0x25cfee;});}function checkAccountsRestrictions(_0x5ddcc6,_0xcd5f35,_0x41e514){var _0x12b287=utils[_0xc76d('0x6')](_0x5ddcc6);var _0x254128=_0xc76d('0x58')+_[_0xc76d('0x59')](_0x5ddcc6)+(_0x5ddcc6===_0xc76d('0x5a')?_0xc76d('0x5b'):_0xc76d('0x5c'));var _0x12c8f9=squel[_0xc76d('0x21')]();return Promise[_0xc76d('0x52')]()[_0xc76d('0x53')](function(){if(_0x41e514['search']&&_0xcd5f35[_0xc76d('0x5d')]===_0xc76d('0x5e')){return _0xcd5f35[_0x254128]({'attributes':['id'],'raw':!![]});}})[_0xc76d('0x53')](function(_0x2bcf90){if(_0x2bcf90){if(_0x2bcf90[_0xc76d('0x14')]===0x0){_0x12c8f9['and']('i.'+_0x12b287+_0xc76d('0x5f'));}else{_0x12c8f9[_0xc76d('0x3a')]('i.'+_0x12b287+'\x20IN\x20?',_['map'](_0x2bcf90,'id'));}}else if(!_0x41e514[_0x12b287]){_0x12c8f9['and']('i.'+_0x12b287+_0xc76d('0x60'));}})[_0xc76d('0x53')](function(){return _0x12c8f9;});}function getClosedOrderClause(_0x3b4a22,_0x436ac4){var _0x2ba812='';var _0x37e9a3=[_0xc76d('0x61'),_0xc76d('0x62'),'i.disposition'];if(_0x3b4a22===_0xc76d('0x2b')){_0x37e9a3['unshift']('i.substatus');}if(_0x436ac4[_0xc76d('0x63')]==='0'&&_0x3b4a22===_0xc76d('0x2b')){_0x2ba812=_0xc76d('0x64');}else{if(_0x436ac4['closed']==='1'){_0x37e9a3[_0xc76d('0x65')]();}_0x2ba812='CONCAT_WS(\x27\x27,\x20'+_0x37e9a3['join'](',\x20')+')';}return _0x2ba812;}function getFilteredInteractions(_0x5a651d,_0x3ac663,_0x39784e,_0x513623){var _0x4267bc=utils[_0xc76d('0xc')](_0x5a651d);var _0x20d7cf=_[_0xc76d('0x59')](_0x5a651d)+_0xc76d('0x66');var _0xa81af6=[];var _0x393ef8=getTagsQuery();var _0x51430c={'type':db['Sequelize']['QueryTypes'][_0xc76d('0x67')],'raw':!![]};var _0x2e742f=[];var _0x930eb2=[];return db[_0xc76d('0x68')][_0xc76d('0x69')](_0x393ef8['toString'](),_0x51430c)[_0xc76d('0x53')](function(_0x1170ac){_0xa81af6=_[_0xc76d('0x6a')](_0x1170ac,'id');_0x51430c=_[_0xc76d('0x6b')](_0x51430c,{'model':db[_0x20d7cf],'mapToModel':!![],'nest':!![]});if(_0x39784e[_0xc76d('0x54')]){_0x513623[_0xc76d('0x6c')][_0xc76d('0x4c')](function(_0x2d791f){_0x3ac663['field']('i.'+_0x2d791f);});}else{_0x3ac663[_0xc76d('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc76d('0x6d'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x6e'),_0xc76d('0x6f'));_0x3ac663['field'](_0xc76d('0x70'),'Account.mandatoryDisposition');if(_0x5a651d==='mail'){_0x3ac663[_0xc76d('0x9')](_0xc76d('0x71'),'Account.email');_0x3ac663[_0xc76d('0x9')](_0xc76d('0x72'),'contactName');_0x3ac663[_0xc76d('0x9')](_0xc76d('0x73'));_0x3ac663['field'](_0xc76d('0x74'));_0x3ac663['field'](_0xc76d('0x75'));_0x3ac663[_0xc76d('0x9')]('i.closed');_0x3ac663[_0xc76d('0x9')](_0xc76d('0x76'));_0x3ac663['field'](_0xc76d('0x77'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x78'));_0x3ac663['field'](_0xc76d('0x79'));_0x3ac663['field']('i.subject');_0x3ac663[_0xc76d('0x9')](_0xc76d('0x7a'));_0x3ac663['field'](_0xc76d('0x62'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x61'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x64'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x7b'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x7c'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x7d'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x7e'));}else if(_0x5a651d===_0xc76d('0x7f')){_0x3ac663[_0xc76d('0x9')](_0xc76d('0x80'),_0xc76d('0x81'));}else{_0x3ac663[_0xc76d('0x9')](_0xc76d('0x82'),_0xc76d('0x81'));}if(_0x5a651d!=='mail'){_0x3ac663[_0xc76d('0x9')](_0xc76d('0x83'));}_0x3ac663[_0xc76d('0x9')](_0xc76d('0x84'),_0xc76d('0x85'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x86'),_0xc76d('0x87'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x88'),_0xc76d('0x89'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x8a'),_0xc76d('0x8b'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x8c'),_0xc76d('0x8d'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x8e'),_0xc76d('0x8f'));_0x3ac663[_0xc76d('0x9')](_0xc76d('0x90'),_0xc76d('0x91'));_0x3ac663[_0xc76d('0x9')]('o.internal',_0xc76d('0x92'));_0x3ac663[_0xc76d('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc76d('0x93'));}if(_0x513623[_0xc76d('0x94')]){_0x3ac663['limit'](_0x513623[_0xc76d('0x94')]);}if(_0x513623[_0xc76d('0x95')]){_0x3ac663[_0xc76d('0x95')](_0x513623[_0xc76d('0x95')]);}return db[_0xc76d('0x68')][_0xc76d('0x69')](_0x3ac663[_0xc76d('0x96')](),_0x51430c);})['then'](function(_0x50fd67){_0x2e742f=_0x50fd67;var _0xe6a1dc=getUsersQuery(_0x5a651d,_0x2e742f);return db[_0xc76d('0x68')]['query'](_0xe6a1dc[_0xc76d('0x96')](),_0x51430c);})[_0xc76d('0x53')](function(_0x27543b){_0x930eb2=_[_0xc76d('0x97')](_0x27543b,_0x4267bc);if(_0x5a651d===_0xc76d('0x2b')){return db[_0xc76d('0x98')][_0xc76d('0x99')]({'attributes':[_0xc76d('0x9a')],'raw':!![]});}})[_0xc76d('0x53')](function(_0x2fc595){var _0x36be2b=_0x2fc595?_0x2fc595[_0xc76d('0x9a')]:undefined;var _0x9a32b3=_0x2e742f[_0xc76d('0x42')](function(_0x2b5026){return updateInteraction(_0x2b5026,_0xa81af6,_0x930eb2,_0x36be2b);});return Promise[_0xc76d('0x9b')](_0x9a32b3);});}function countFilteredInteractions(_0x61733d,_0xdcf1cf){var _0x3ef8fc=_0x61733d[_0xc76d('0x9c')]();_0x3ef8fc['field'](_0xc76d('0x9d'));_0x3ef8fc['field'](_0xc76d('0x9e'),_0xc76d('0x6d'));var _0x418cbe=utils[_0xc76d('0x9f')](_0xdcf1cf);if(!_[_0xc76d('0xa0')](_0x418cbe)){_0x3ef8fc['where'](_0xc76d('0xa1'),_0x418cbe);}var _0x5b38b8={'type':db[_0xc76d('0xa2')][_0xc76d('0xa3')][_0xc76d('0x67')],'raw':!![]};return db[_0xc76d('0x68')][_0xc76d('0x69')](_0x3ef8fc['toString'](),_0x5b38b8);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 86bf691..2363a49 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x929b=['lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','Tags'];(function(_0x4605a6,_0x4ee25f){var _0x18bc7a=function(_0x2f1228){while(--_0x2f1228){_0x4605a6['push'](_0x4605a6['shift']());}};_0x18bc7a(++_0x4ee25f);}(_0x929b,0x138));var _0xb929=function(_0x19ae7a,_0x5d3b51){_0x19ae7a=_0x19ae7a-0x0;var _0x30d82e=_0x929b[_0x19ae7a];return _0x30d82e;};'use strict';var _=require(_0xb929('0x0'));var db=require(_0xb929('0x1'))['db'];function getInteractionUsers(_0x1e9694,_0x55ed06){return new Promise(function(_0xfb961c,_0x4e71e3){try{var _0x317950=[];if(_0x55ed06[_0x1e9694]){_0x317950=_0x55ed06[_0x1e9694][_0xb929('0x2')](function(_0x2f4177){return{'id':_0x2f4177['id'],'fullname':_0x2f4177[_0xb929('0x3')]};});}return _0xfb961c(_0x317950);}catch(_0x2284cb){_0x4e71e3(_0x2284cb);}});}function getInteractionTags(_0x3515f3,_0x893325){var _0x282a4d=[];if(_0x3515f3){_0x3515f3[_0xb929('0x4')](',')[_0xb929('0x5')](function(_0x577cc1){_0x282a4d[_0xb929('0x6')](_0x893325[_0x577cc1]);});}return _0x282a4d;}function updateWaitingCounter(_0xd6b7eb){if(_0xd6b7eb['waiting']){_0xd6b7eb['waiting']-=0x1;}}function updateInteractionCounters(_0x408e14){_0x408e14[_0xb929('0x7')]=0x0;_0x408e14[_0xb929('0x8')]=0x0;_0x408e14[_0xb929('0x9')]=0x0;_0x408e14[_0xb929('0xa')]=0x0;_0x408e14[_0xb929('0xb')]=0x0;_0x408e14[_0xb929('0xc')]=0x0;if(_0x408e14[_0xb929('0xd')]){if(_0x408e14[_0xb929('0xe')]==='abandoned'){_0x408e14[_0xb929('0xb')]+=0x1;updateWaitingCounter(_0x408e14);}if(_0x408e14['UserId']){_0x408e14[_0xb929('0x9')]+=0x1;if(_0x408e14['talking']){_0x408e14[_0xb929('0x8')]-=0x1;}}else{if(_0x408e14[_0xb929('0xe')]){_0x408e14[_0xb929('0xa')]+=0x1;updateWaitingCounter(_0x408e14);}}}else{if(!_0x408e14['UserId']){_0x408e14['waiting']+=0x1;}if(_0x408e14[_0xb929('0xf')]){_0x408e14[_0xb929('0x8')]+=0x1;updateWaitingCounter(_0x408e14);}}_0x408e14['total']+=0x1;return _0x408e14;}function getLastMessageText(_0x547904){return db[_0xb929('0x10')][_0xb929('0x11')]({'where':{'$and':[{'MailInteractionId':_0x547904['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb929('0x12')],'order':_0xb929('0x13'),'raw':!![]})[_0xb929('0x14')](function(_0x14cb1c){if(_0x14cb1c&&_0x14cb1c[_0xb929('0x12')]){_0x547904[_0xb929('0x15')]=_[_0xb929('0x16')](_0x14cb1c[_0xb929('0x12')]);}return _0x547904;})['catch'](function(_0x5dbf7d){throw _0x5dbf7d;});}exports[_0xb929('0x17')]=function(_0x4b75bd,_0x1ca830,_0x168ba6,_0x242f48){return new Promise(function(_0x52e316,_0x137f89){return getInteractionUsers(_0x4b75bd['id'],_0x168ba6)['then'](function(_0x123748){_0x4b75bd[_0xb929('0x18')]=_0x123748;return getInteractionTags(_0x4b75bd['TagIds'],_0x1ca830);})[_0xb929('0x14')](function(_0x56f47a){_0x4b75bd[_0xb929('0x19')]=_0x56f47a;delete _0x4b75bd['TagIds'];return updateInteractionCounters(_0x4b75bd);})[_0xb929('0x14')](function(_0x58005e){if(_0x242f48){return getLastMessageText(_0x58005e);}else{return _0x58005e;}})[_0xb929('0x14')](function(_0x2a9708){_0x52e316(_0x2a9708);})['catch'](function(_0xa720fe){_0x137f89(_0xa720fe);});});}; \ No newline at end of file +var _0x6791=['split','forEach','push','waiting','talking','unmanaged','abandoned','total','closed','UserId','answered','MailMessage','out','-id','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','map','fullname'];(function(_0xbbf34a,_0x50d3c4){var _0x2f29c5=function(_0x584f37){while(--_0x584f37){_0xbbf34a['push'](_0xbbf34a['shift']());}};_0x2f29c5(++_0x50d3c4);}(_0x6791,0xa6));var _0x1679=function(_0x546ac7,_0x39d9d6){_0x546ac7=_0x546ac7-0x0;var _0x318f1c=_0x6791[_0x546ac7];return _0x318f1c;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4a10eb,_0x2ff9c8){return new Promise(function(_0x1045e8,_0x43d331){try{var _0x18edae=[];if(_0x2ff9c8[_0x4a10eb]){_0x18edae=_0x2ff9c8[_0x4a10eb][_0x1679('0x0')](function(_0x4a4ef0){return{'id':_0x4a4ef0['id'],'fullname':_0x4a4ef0[_0x1679('0x1')]};});}return _0x1045e8(_0x18edae);}catch(_0xc612ad){_0x43d331(_0xc612ad);}});}function getInteractionTags(_0x30557a,_0x42828a){var _0x3afa20=[];if(_0x30557a){_0x30557a[_0x1679('0x2')](',')[_0x1679('0x3')](function(_0x34c8d5){_0x3afa20[_0x1679('0x4')](_0x42828a[_0x34c8d5]);});}return _0x3afa20;}function updateWaitingCounter(_0x573ce7){if(_0x573ce7[_0x1679('0x5')]){_0x573ce7[_0x1679('0x5')]-=0x1;}}function updateInteractionCounters(_0x499387){_0x499387[_0x1679('0x5')]=0x0;_0x499387[_0x1679('0x6')]=0x0;_0x499387['answered']=0x0;_0x499387[_0x1679('0x7')]=0x0;_0x499387[_0x1679('0x8')]=0x0;_0x499387[_0x1679('0x9')]=0x0;if(_0x499387[_0x1679('0xa')]){if(_0x499387['disposition']===_0x1679('0x8')){_0x499387[_0x1679('0x8')]+=0x1;updateWaitingCounter(_0x499387);}if(_0x499387[_0x1679('0xb')]){_0x499387[_0x1679('0xc')]+=0x1;if(_0x499387['talking']){_0x499387['talking']-=0x1;}}else{if(_0x499387['disposition']){_0x499387[_0x1679('0x7')]+=0x1;updateWaitingCounter(_0x499387);}}}else{if(!_0x499387[_0x1679('0xb')]){_0x499387[_0x1679('0x5')]+=0x1;}if(_0x499387[_0x1679('0xb')]){_0x499387[_0x1679('0x6')]+=0x1;updateWaitingCounter(_0x499387);}}_0x499387[_0x1679('0x9')]+=0x1;return _0x499387;}function getLastMessageText(_0xf3cc52){return db[_0x1679('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0xf3cc52['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1679('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x1679('0xf'),'raw':!![]})[_0x1679('0x10')](function(_0x2fea75){if(_0x2fea75&&_0x2fea75[_0x1679('0x11')]){_0xf3cc52[_0x1679('0x12')]=_[_0x1679('0x13')](_0x2fea75[_0x1679('0x11')]);}return _0xf3cc52;})[_0x1679('0x14')](function(_0x5b3f06){throw _0x5b3f06;});}exports[_0x1679('0x15')]=function(_0xfd0122,_0x3dfc01,_0x5a4338,_0xfeb728){return new Promise(function(_0x38bb6f,_0x4d36c3){return getInteractionUsers(_0xfd0122['id'],_0x5a4338)[_0x1679('0x10')](function(_0x2bf8cb){_0xfd0122[_0x1679('0x16')]=_0x2bf8cb;return getInteractionTags(_0xfd0122['TagIds'],_0x3dfc01);})[_0x1679('0x10')](function(_0x38f7c2){_0xfd0122[_0x1679('0x17')]=_0x38f7c2;delete _0xfd0122['TagIds'];return updateInteractionCounters(_0xfd0122);})[_0x1679('0x10')](function(_0x532c1d){if(_0xfeb728){return getLastMessageText(_0x532c1d);}else{return _0x532c1d;}})['then'](function(_0x1f0a4e){_0x38bb6f(_0x1f0a4e);})[_0x1679('0x14')](function(_0x3b5863){_0x4d36c3(_0x3b5863);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index d2a4e1a..1658c85 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfb2=['InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','capitalize','chat','Account'];(function(_0x12e7cb,_0x5c66e0){var _0x59d202=function(_0x14bd04){while(--_0x14bd04){_0x12e7cb['push'](_0x12e7cb['shift']());}};_0x59d202(++_0x5c66e0);}(_0xbfb2,0x14c));var _0x2bfb=function(_0x1bc36e,_0x2fb89f){_0x1bc36e=_0x1bc36e-0x0;var _0x3ef923=_0xbfb2[_0x1bc36e];return _0x3ef923;};'use strict';var _=require(_0x2bfb('0x0'));var db=require(_0x2bfb('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x2bfb('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x2bfb('0x3'))(_0x2bfb('0x4')),'sms':require(_0x2bfb('0x3'))(_0x2bfb('0x5')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0x2bfb('0x3'))('whatsapp-interactions')};function getAccountFK(_0x4aa576){return _[_0x2bfb('0x6')](_0x4aa576)+(_0x4aa576===_0x2bfb('0x7')?'Website':_0x2bfb('0x8'))+'Id';}function getInteractionFK(_0xd7d576){return _['capitalize'](_0xd7d576)+_0x2bfb('0x9');}function getInteractionId(_0x2ffe58,_0x2ff8ff,_0x50072e){if(_0x2ffe58&&_0x2ffe58[_[_0x2bfb('0xa')](_0x50072e)+_0x2bfb('0x9')]){return _0x2ffe58[_[_0x2bfb('0xa')](_0x50072e)+'InteractionId'];}else if(_0x2ffe58&&_0x2ffe58['id']){return _0x2ffe58['id'];}else if(_0x2ff8ff&&_0x2ff8ff['id']){return _0x2ff8ff['id'];}else{return _0x2bfb('0xb');}}function getInteractionsTables(_0x26643b){return{'accounts':_0x26643b+'_'+(_0x26643b===_0x2bfb('0x7')?_0x2bfb('0xc'):'accounts'),'interactions':_0x26643b+_0x2bfb('0xd'),'interactionsTags':_0x26643b+_0x2bfb('0xe'),'messages':_0x26643b+_0x2bfb('0xf'),'userInteractions':_0x2bfb('0x10')+_0x26643b+_0x2bfb('0xd')};}function getSelectedTags(_0x396de5){var _0x1a1030=[];if(_0x396de5){_0x1a1030=Array['isArray'](_0x396de5)?_0x396de5:[_0x396de5];}return _0x1a1030;}function log(_0x2ce316,_0x435245,_0x20f6a8,_0x12e4d8,_0x23c331,_0x2bbcb5){loggers[_0x23c331[_0x2bfb('0x11')]()][_0x2ce316](_0x2bfb('0x12'),_0x2bbcb5[_0x2bfb('0x13')](),_0x435245?_0x435245['id']:null,_0x435245?_0x435245[_0x2bfb('0x14')]:null,_0x435245?_0x435245[_0x2bfb('0x15')]:null,getInteractionId(_0x20f6a8,_0x12e4d8,_0x23c331),_0x20f6a8?JSON[_0x2bfb('0x16')](_0x20f6a8):_0x2bfb('0x17'));}function updateUser(_0x2a6a1f,_0x4f3940,_0x26f268,_0x544de0,_0x2ecc45){db[_[_0x2bfb('0xa')](_0x544de0)+_0x2bfb('0x18')][_0x2bfb('0x19')]({'where':{'id':getInteractionId(_0x4f3940,_0x26f268,_0x544de0)}})[_0x2bfb('0x1a')](function(_0x93b5f6){if(_0x93b5f6){return _0x93b5f6[_0x2bfb('0x1b')]({'UserId':_0x2a6a1f?_0x2a6a1f['id']:null});}})[_0x2bfb('0x1a')](function(_0x3def76){if(_0x3def76){log(_0x2bfb('0x1c'),_0x2a6a1f,_0x4f3940,_0x26f268,_0x544de0,_0x2ecc45);}})['catch'](function(){log(_0x2bfb('0x1d'),_0x2a6a1f,_0x4f3940,_0x26f268,_0x544de0,_0x2ecc45);});}module[_0x2bfb('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x07dd=['error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','update','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x07dd,0x1bc));var _0xd07d=function(_0x44b978,_0xc8ecf4){_0x44b978=_0x44b978-0x0;var _0x5cf7dd=_0x07dd[_0x44b978];return _0x5cf7dd;};'use strict';var _=require('lodash');var db=require(_0xd07d('0x0'))['db'];var loggers={'openchannel':require(_0xd07d('0x1'))(_0xd07d('0x2')),'mail':require('../../config/logger')(_0xd07d('0x3')),'fax':require(_0xd07d('0x1'))(_0xd07d('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xd07d('0x1'))(_0xd07d('0x5')),'whatsapp':require(_0xd07d('0x1'))(_0xd07d('0x6'))};function getAccountFK(_0x4798b6){return _[_0xd07d('0x7')](_0x4798b6)+(_0x4798b6===_0xd07d('0x8')?_0xd07d('0x9'):_0xd07d('0xa'))+'Id';}function getInteractionFK(_0x790b0){return _[_0xd07d('0x7')](_0x790b0)+_0xd07d('0xb');}function getInteractionId(_0xd0324c,_0x4d90ce,_0x10ef98){if(_0xd0324c&&_0xd0324c[_[_0xd07d('0xc')](_0x10ef98)+'InteractionId']){return _0xd0324c[_['upperFirst'](_0x10ef98)+_0xd07d('0xb')];}else if(_0xd0324c&&_0xd0324c['id']){return _0xd0324c['id'];}else if(_0x4d90ce&&_0x4d90ce['id']){return _0x4d90ce['id'];}else{return _0xd07d('0xd');}}function getInteractionsTables(_0x4887db){return{'accounts':_0x4887db+'_'+(_0x4887db===_0xd07d('0x8')?_0xd07d('0xe'):_0xd07d('0xf')),'interactions':_0x4887db+_0xd07d('0x10'),'interactionsTags':_0x4887db+_0xd07d('0x11'),'messages':_0x4887db+_0xd07d('0x12'),'userInteractions':_0xd07d('0x13')+_0x4887db+_0xd07d('0x10')};}function getSelectedTags(_0x46897f){var _0x43bcd0=[];if(_0x46897f){_0x43bcd0=Array[_0xd07d('0x14')](_0x46897f)?_0x46897f:[_0x46897f];}return _0x43bcd0;}function log(_0x1ad642,_0x141c24,_0x3f073e,_0x3c4334,_0xc394cb,_0x3b8904){loggers[_0xc394cb[_0xd07d('0x15')]()][_0x1ad642](_0xd07d('0x16'),_0x3b8904['toUpperCase'](),_0x141c24?_0x141c24['id']:null,_0x141c24?_0x141c24[_0xd07d('0x17')]:null,_0x141c24?_0x141c24[_0xd07d('0x18')]:null,getInteractionId(_0x3f073e,_0x3c4334,_0xc394cb),_0x3f073e?JSON[_0xd07d('0x19')](_0x3f073e):_0xd07d('0x1a'));}function updateUser(_0x207821,_0x230b27,_0x381214,_0x52736b,_0x14f1fe){db[_[_0xd07d('0xc')](_0x52736b)+_0xd07d('0x1b')][_0xd07d('0x1c')]({'where':{'id':getInteractionId(_0x230b27,_0x381214,_0x52736b)}})[_0xd07d('0x1d')](function(_0x41c329){if(_0x41c329){return _0x41c329[_0xd07d('0x1e')]({'UserId':_0x207821?_0x207821['id']:null});}})[_0xd07d('0x1d')](function(_0x5a1ddd){if(_0x5a1ddd){log('info',_0x207821,_0x230b27,_0x381214,_0x52736b,_0x14f1fe);}})[_0xd07d('0x1f')](function(){log(_0xd07d('0x20'),_0x207821,_0x230b27,_0x381214,_0x52736b,_0x14f1fe);});}module[_0xd07d('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 027e0b0..fd3cbcd 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 _0x3e83=['update','base64','final','parse','hasOwnProperty','use','License','findOne','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s'];(function(_0xa4e48c,_0x265846){var _0x215b0=function(_0x191863){while(--_0x191863){_0xa4e48c['push'](_0xa4e48c['shift']());}};_0x215b0(++_0x265846);}(_0x3e83,0x1b5));var _0x33e8=function(_0x204a83,_0x794714){_0x204a83=_0x204a83-0x0;var _0x205a5e=_0x3e83[_0x204a83];return _0x205a5e;};'use strict';var crypto=require(_0x33e8('0x0'));var util=require(_0x33e8('0x1'));var compose=require(_0x33e8('0x2'));var db=require(_0x33e8('0x3'))['db'];var config=require(_0x33e8('0x4'));function getValueFromLicense(_0x3f5ac4,_0x3837c4){if(_0x3f5ac4&&_0x3837c4){if(_0x3837c4[_0x33e8('0x5')]&&_0x3837c4[_0x33e8('0x6')]){var _0x3bdf67=_0x3837c4['data1'];var _0x5cd043=_0x3837c4['license'];var _0x30fbbf=_0x3bdf67[_0x33e8('0x7')]('-')[0x4];var _0x26652e=_0x3bdf67['split']('-')[0x0];var _0x1cd748=crypto[_0x33e8('0x8')](_0x33e8('0x9'),util['format'](_0x33e8('0xa'),_0x30fbbf,_0x3bdf67,_0x26652e));var _0x91a814=_0x1cd748[_0x33e8('0xb')](_0x5cd043,_0x33e8('0xc'),'utf8');_0x91a814+=_0x1cd748[_0x33e8('0xd')]('utf8');var _0x4593de=JSON[_0x33e8('0xe')](_0x91a814);return _0x4593de[_0x33e8('0xf')](_0x3f5ac4)?_0x4593de[_0x3f5ac4]:null;}}return null;}function isLimit(_0x4bfff4,_0x26d3bd,_0x3baac7,_0x3916e5){var _0x853a9c=_0x26d3bd;return compose()[_0x33e8('0x10')](function(_0x514787,_0x3c7f3d,_0x4c1c1c){return db[_0x33e8('0x11')][_0x33e8('0x12')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5b2192){var _0x109011=getValueFromLicense(_0x4bfff4,_0x5b2192);return _0x109011?_0x109011:_0x853a9c;})['then'](function(_0x292dbb){_0x853a9c=_0x292dbb;return _0x3baac7['count'](_0x3916e5);})[_0x33e8('0x13')](function(_0x27e095){if(_0x27e095>=_0x853a9c){return _0x3c7f3d[_0x33e8('0x14')](0x193)[_0x33e8('0x15')]({'message':util[_0x33e8('0x16')](_0x33e8('0x17'),_0x4bfff4)});}_0x4c1c1c();})['catch'](function(_0x31729e){_0x4c1c1c(_0x31729e);});});}function isUserLimit(){return isLimit(_0x33e8('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0x33e8('0x19')},{'role':_0x33e8('0x1a')}]}});}exports[_0x33e8('0x1b')]=isUserLimit; \ No newline at end of file +var _0xaf35=['License','findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use'];(function(_0x4bf226,_0x236ed8){var _0x34552c=function(_0x134aa4){while(--_0x134aa4){_0x4bf226['push'](_0x4bf226['shift']());}};_0x34552c(++_0x236ed8);}(_0xaf35,0x73));var _0x5af3=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xaf35[_0x3e3bee];return _0x3ae14c;};'use strict';var crypto=require(_0x5af3('0x0'));var util=require('util');var compose=require(_0x5af3('0x1'));var db=require(_0x5af3('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5d65d1,_0x24cefc){if(_0x5d65d1&&_0x24cefc){if(_0x24cefc[_0x5af3('0x3')]&&_0x24cefc[_0x5af3('0x4')]){var _0x383a5c=_0x24cefc[_0x5af3('0x3')];var _0x10f790=_0x24cefc[_0x5af3('0x4')];var _0xcc5ee9=_0x383a5c[_0x5af3('0x5')]('-')[0x4];var _0x1ed23c=_0x383a5c[_0x5af3('0x5')]('-')[0x0];var _0x5e42a6=crypto[_0x5af3('0x6')](_0x5af3('0x7'),util['format'](_0x5af3('0x8'),_0xcc5ee9,_0x383a5c,_0x1ed23c));var _0x1f3ed2=_0x5e42a6[_0x5af3('0x9')](_0x10f790,_0x5af3('0xa'),_0x5af3('0xb'));_0x1f3ed2+=_0x5e42a6['final'](_0x5af3('0xb'));var _0x99cf48=JSON[_0x5af3('0xc')](_0x1f3ed2);return _0x99cf48[_0x5af3('0xd')](_0x5d65d1)?_0x99cf48[_0x5d65d1]:null;}}return null;}function isLimit(_0x3d875b,_0x327d33,_0x2050fc,_0x4c2aa9){var _0x49157b=_0x327d33;return compose()[_0x5af3('0xe')](function(_0x16349a,_0x528799,_0x9a8e72){return db[_0x5af3('0xf')][_0x5af3('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x425ce4){var _0x24fc9d=getValueFromLicense(_0x3d875b,_0x425ce4);return _0x24fc9d?_0x24fc9d:_0x49157b;})[_0x5af3('0x11')](function(_0x5d0263){_0x49157b=_0x5d0263;return _0x2050fc[_0x5af3('0x12')](_0x4c2aa9);})['then'](function(_0x384be4){if(_0x384be4>=_0x49157b){return _0x528799['status'](0x193)[_0x5af3('0x13')]({'message':util[_0x5af3('0x14')](_0x5af3('0x15'),_0x3d875b)});}_0x9a8e72();})['catch'](function(_0x10b7fb){_0x9a8e72(_0x10b7fb);});});}function isUserLimit(){return isLimit(_0x5af3('0x16'),0x1,db[_0x5af3('0x17')],{'where':{'$or':[{'role':_0x5af3('0x18')},{'role':'user'}]}});}exports[_0x5af3('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 30ca8ce..0220d99 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 _0x51c2=['field','\x20AS\x20','text','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$or]','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$lte','add','days','format','YYYY-MM-DD','castTo'];(function(_0x59ef0a,_0x32159b){var _0x1a1057=function(_0x464559){while(--_0x464559){_0x59ef0a['push'](_0x59ef0a['shift']());}};_0x1a1057(++_0x32159b);}(_0x51c2,0x90));var _0x251c=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x51c2[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x251c('0x0'));var moment=require(_0x251c('0x1'));exports[_0x251c('0x2')]=function(_0x371f94){var _0x4b18ac={'conditions':[]};_0x4b18ac[_0x251c('0x3')]=_[_0x251c('0x4')](_0x371f94,'[$or]')?'or':_0x251c('0x5');var _0x52753c=_0x371f94[_0x251c('0x6')]('[$and]','')[_0x251c('0x6')](_0x251c('0x7'),'')[_0x251c('0x8')]('||');for(var _0x592822=0x0;_0x592822<_0x52753c[_0x251c('0x9')];_0x592822++){var _0x2f2ee7=_0x52753c[_0x592822][_0x251c('0x8')](':=');var _0x5e26bf=_0x2f2ee7[0x0];var _0x4cf223=_0x2f2ee7[_0x251c('0xa')](0x1);_0x4cf223[_0x251c('0xb')](function(_0x390b15){var _0xfc1468=_0x390b15[_0x251c('0x8')]('[')[_0x251c('0xc')]();var _0xadfbc9=_0x390b15[_0x251c('0xd')](/\[(.*?)\]/g);_0xadfbc9[_0x251c('0xb')](function(_0x1a4f7e){var _0xa4d169=_0x1a4f7e[_0x251c('0x8')]('[')[_0x251c('0xe')](function(_0x55e50d){return _0x55e50d[_0x251c('0xf')](']')>-0x1;})['map'](function(_0x12ead2){return _0x12ead2['split'](']')[0x0];})[0x0];_0x4b18ac[_0x251c('0x10')][_0x251c('0x11')]({'field':_0x5e26bf,'operator':_0xfc1468,'value':_0xa4d169});});});}return _0x4b18ac;};exports[_0x251c('0x12')]=function(_0x6134c0,_0x157244,_0xb71fa4){var _0x6a5d09={};if(_0x157244===_0x251c('0x13')){if(_0xb71fa4[_0x251c('0x14')]===_0x251c('0x15')){_0xb71fa4[_0x251c('0x14')]=_0x251c('0x16');_0xb71fa4[_0x251c('0x17')]+=','+_0xb71fa4[_0x251c('0x17')];}else if(_['includes'](['$gt',_0x251c('0x18')],_0xb71fa4[_0x251c('0x14')])){_0xb71fa4['value']=moment(_0xb71fa4[_0x251c('0x17')])[_0x251c('0x19')](0x1,_0x251c('0x1a'))[_0x251c('0x1b')](_0x251c('0x1c'));}}if(_0xb71fa4[_0x251c('0x1d')]){_0x157244=_0xb71fa4[_0x251c('0x1d')];_0x6a5d09['text']='CAST('+_0x6134c0+'.'+_0xb71fa4[_0x251c('0x1e')]+_0x251c('0x1f')+_0xb71fa4['castTo']+')\x20'+parseOperator(_0xb71fa4[_0x251c('0x14')]);}else{_0x6a5d09[_0x251c('0x20')]=_0x6134c0+'.'+_0xb71fa4[_0x251c('0x1e')]+'\x20'+parseOperator(_0xb71fa4[_0x251c('0x14')]);}if(_[_0x251c('0x21')](['$ne',_0x251c('0x22')],_0xb71fa4[_0x251c('0x14')]))_0x6a5d09[_0x251c('0x20')]='('+_0x6a5d09[_0x251c('0x20')]+_0x251c('0x23')+_0x6134c0+'.'+_0xb71fa4[_0x251c('0x1e')]+_0x251c('0x24');_0x6a5d09[_0x251c('0x17')]=parseValue(_0x157244,_0xb71fa4[_0x251c('0x14')],_0xb71fa4[_0x251c('0x17')]);return _0x6a5d09;};function parseOperator(_0x4097d7){var _0x11beb7;switch(_0x4097d7){case'$in':_0x11beb7=_0x251c('0x25');break;case'$notIn':_0x11beb7=_0x251c('0x26');break;case _0x251c('0x15'):_0x11beb7=_0x251c('0x27');break;case _0x251c('0x28'):_0x11beb7=_0x251c('0x29');break;case _0x251c('0x2a'):case _0x251c('0x2b'):case _0x251c('0x2c'):_0x11beb7=_0x251c('0x2d');break;case _0x251c('0x2e'):_0x11beb7=_0x251c('0x2f');break;case _0x251c('0x30'):_0x11beb7=_0x251c('0x31');break;case _0x251c('0x18'):_0x11beb7=_0x251c('0x32');break;case _0x251c('0x33'):_0x11beb7=_0x251c('0x34');break;case _0x251c('0x16'):_0x11beb7=_0x251c('0x35');break;}return _0x11beb7;}function parseValue(_0x515884,_0x4c39be,_0x513e17){var _0x3a84df={'start':undefined,'end':undefined};switch(_0x4c39be){case'$in':case _0x251c('0x22'):_0x3a84df['start']=_0x513e17[_0x251c('0x8')](',');break;case'$substring':_0x3a84df[_0x251c('0x36')]='%'+_0x513e17+'%';break;case'$startsWith':_0x3a84df['start']=_0x513e17+'%';break;case _0x251c('0x2c'):_0x3a84df['start']='%'+_0x513e17;break;case _0x251c('0x16'):var _0x33103f=_0x513e17['split'](',');var _0x513e17=_0x33103f[_0x251c('0xc')]();var _0x40c3f=_0x33103f['pop']();if(_0x515884===_0x251c('0x13')){_0x513e17=moment(_0x513e17)[_0x251c('0x37')](0x0,!![])[_0x251c('0x1b')]();_0x40c3f=moment(_0x40c3f)[_0x251c('0x37')](0x0,!![])['add'](0x17,'hours')[_0x251c('0x19')](0x3b,_0x251c('0x38'))[_0x251c('0x19')](0x3b,_0x251c('0x39'))['format']();}_0x3a84df={'start':_0x513e17,'end':_0x40c3f};break;default:_0x3a84df[_0x251c('0x36')]=_0x513e17;break;}return _0x3a84df;} \ No newline at end of file +var _0xb3f8=['parseSearch','sqlOperator','startsWith','and','[$and]','[$or]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','$between','value','includes','$gt','$lte','operator','add','days','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','format','hours','minutes'];(function(_0x3f39c8,_0x1a1ca8){var _0x285c58=function(_0x2d228b){while(--_0x2d228b){_0x3f39c8['push'](_0x3f39c8['shift']());}};_0x285c58(++_0x1a1ca8);}(_0xb3f8,0x17a));var _0x8b3f=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0xb3f8[_0x4653f7];return _0x5454da;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x8b3f('0x0')]=function(_0x31e4b8){var _0x310f53={'conditions':[]};_0x310f53[_0x8b3f('0x1')]=_[_0x8b3f('0x2')](_0x31e4b8,'[$or]')?'or':_0x8b3f('0x3');var _0x13bf12=_0x31e4b8['replace'](_0x8b3f('0x4'),'')['replace'](_0x8b3f('0x5'),'')[_0x8b3f('0x6')]('||');for(var _0x3ed615=0x0;_0x3ed615<_0x13bf12[_0x8b3f('0x7')];_0x3ed615++){var _0x18262a=_0x13bf12[_0x3ed615][_0x8b3f('0x6')](':=');var _0x4808c3=_0x18262a[0x0];var _0x1aec94=_0x18262a[_0x8b3f('0x8')](0x1);_0x1aec94[_0x8b3f('0x9')](function(_0x216f79){var _0xd82eb6=_0x216f79[_0x8b3f('0x6')]('[')[_0x8b3f('0xa')]();var _0x30b8dc=_0x216f79[_0x8b3f('0xb')](/\[(.*?)\]/g);_0x30b8dc[_0x8b3f('0x9')](function(_0x1a0b8d){var _0x2cbbce=_0x1a0b8d[_0x8b3f('0x6')]('[')[_0x8b3f('0xc')](function(_0x1e65d4){return _0x1e65d4[_0x8b3f('0xd')](']')>-0x1;})[_0x8b3f('0xe')](function(_0x5c7f68){return _0x5c7f68['split'](']')[0x0];})[0x0];_0x310f53[_0x8b3f('0xf')][_0x8b3f('0x10')]({'field':_0x4808c3,'operator':_0xd82eb6,'value':_0x2cbbce});});});}return _0x310f53;};exports[_0x8b3f('0x11')]=function(_0x152da0,_0x30956d,_0x220933){var _0x616c41={};if(_0x30956d===_0x8b3f('0x12')){if(_0x220933['operator']==='$eq'){_0x220933['operator']=_0x8b3f('0x13');_0x220933[_0x8b3f('0x14')]+=','+_0x220933['value'];}else if(_[_0x8b3f('0x15')]([_0x8b3f('0x16'),_0x8b3f('0x17')],_0x220933[_0x8b3f('0x18')])){_0x220933['value']=moment(_0x220933['value'])[_0x8b3f('0x19')](0x1,_0x8b3f('0x1a'))['format']('YYYY-MM-DD');}}if(_0x220933['castTo']){_0x30956d=_0x220933[_0x8b3f('0x1b')];_0x616c41[_0x8b3f('0x1c')]=_0x8b3f('0x1d')+_0x152da0+'.'+_0x220933[_0x8b3f('0x1e')]+_0x8b3f('0x1f')+_0x220933[_0x8b3f('0x1b')]+')\x20'+parseOperator(_0x220933['operator']);}else{_0x616c41[_0x8b3f('0x1c')]=_0x152da0+'.'+_0x220933[_0x8b3f('0x1e')]+'\x20'+parseOperator(_0x220933['operator']);}if(_[_0x8b3f('0x15')](['$ne',_0x8b3f('0x20')],_0x220933[_0x8b3f('0x18')]))_0x616c41[_0x8b3f('0x1c')]='('+_0x616c41[_0x8b3f('0x1c')]+'\x20OR\x20'+_0x152da0+'.'+_0x220933[_0x8b3f('0x1e')]+_0x8b3f('0x21');_0x616c41[_0x8b3f('0x14')]=parseValue(_0x30956d,_0x220933[_0x8b3f('0x18')],_0x220933[_0x8b3f('0x14')]);return _0x616c41;};function parseOperator(_0x35a1fb){var _0x244d71;switch(_0x35a1fb){case _0x8b3f('0x22'):_0x244d71=_0x8b3f('0x23');break;case _0x8b3f('0x20'):_0x244d71='NOT\x20IN\x20?';break;case'$eq':_0x244d71=_0x8b3f('0x24');break;case _0x8b3f('0x25'):_0x244d71='<>\x20?';break;case _0x8b3f('0x26'):case _0x8b3f('0x27'):case _0x8b3f('0x28'):_0x244d71=_0x8b3f('0x29');break;case _0x8b3f('0x2a'):_0x244d71=_0x8b3f('0x2b');break;case _0x8b3f('0x16'):_0x244d71=_0x8b3f('0x2c');break;case _0x8b3f('0x17'):_0x244d71=_0x8b3f('0x2d');break;case _0x8b3f('0x2e'):_0x244d71='>=\x20?';break;case'$between':_0x244d71=_0x8b3f('0x2f');break;}return _0x244d71;}function parseValue(_0x20e5fe,_0x5d8cf1,_0x46c53c){var _0x580b54={'start':undefined,'end':undefined};switch(_0x5d8cf1){case'$in':case'$notIn':_0x580b54[_0x8b3f('0x30')]=_0x46c53c[_0x8b3f('0x6')](',');break;case'$substring':_0x580b54['start']='%'+_0x46c53c+'%';break;case'$startsWith':_0x580b54[_0x8b3f('0x30')]=_0x46c53c+'%';break;case _0x8b3f('0x28'):_0x580b54[_0x8b3f('0x30')]='%'+_0x46c53c;break;case _0x8b3f('0x13'):var _0x5df8b8=_0x46c53c['split'](',');var _0x46c53c=_0x5df8b8[_0x8b3f('0xa')]();var _0x430b5b=_0x5df8b8[_0x8b3f('0x31')]();if(_0x20e5fe===_0x8b3f('0x12')){_0x46c53c=moment(_0x46c53c)[_0x8b3f('0x32')](0x0,!![])[_0x8b3f('0x33')]();_0x430b5b=moment(_0x430b5b)[_0x8b3f('0x32')](0x0,!![])[_0x8b3f('0x19')](0x17,_0x8b3f('0x34'))[_0x8b3f('0x19')](0x3b,_0x8b3f('0x35'))[_0x8b3f('0x19')](0x3b,'seconds')[_0x8b3f('0x33')]();}_0x580b54={'start':_0x46c53c,'end':_0x430b5b};break;default:_0x580b54['start']=_0x46c53c;break;}return _0x580b54;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index b0e4637..702647c 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 _0xe015=['cast','unsigned','substr','DESC','ASC','omit','isArray','length','isObject','isString','hasOwnProperty','isNumeric','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','nolimit','offset','order','where','pick','filter','columns','name','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','find','type','$gte','format','YYYY-MM-DD','utc','uniqueid','limit','sort','map','priority'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe015,0x13b));var _0x5e01=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe015[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5e01('0x0'));var sequelize=require(_0x5e01('0x1'));var moment=require(_0x5e01('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5811ae){var _0x51f689=['ne'];try{var _0x46ed0d=JSON['parse'](_0x5811ae);var _0x2136cf=Object[_0x5e01('0x3')](_0x46ed0d)[0x0];return _0x51f689[_0x5e01('0x4')](_0x2136cf);}catch(_0x241c0e){return![];}}function getOperatorValue(_0x4ac3f1){var _0x1814cb=JSON[_0x5e01('0x5')](_0x4ac3f1);var _0x4de678=Object['keys'](_0x1814cb)[0x0];var _0x414f73=_0x1814cb[_0x4de678];return{['$'+_0x4de678]:_0x414f73};}exports[_0x5e01('0x6')]=function(_0x1420c2){var _0x40d31f=null;if(_0x1420c2){_0x40d31f=_0x1420c2[_0x5e01('0x7')](',');}return _0x40d31f;};exports[_0x5e01('0x8')]=function(_0x5b3938,_0x1c4a44){var _0x502518={};if(!_[_0x5e01('0x9')](_0x5b3938)){_['forOwn'](_0x5b3938,function(_0x3c2ea2,_0x406b26){try{if(_0x1c4a44){var _0x553a53=_[_0x5e01('0xa')](_0x1c4a44,{'name':_0x406b26})||{};if(hasSequelizeOperator(_0x3c2ea2)){_0x502518[_0x406b26]=getOperatorValue(_0x3c2ea2);}else if(_0x553a53[_0x5e01('0xb')]==='DATE'&&_['isPlainObject'](_0x3c2ea2)){var _0x3d0b04=JSON[_0x5e01('0x5')](_0x3c2ea2);var _0x468901={'$gte':moment(moment(_0x3d0b04[_0x5e01('0xc')])[_0x5e01('0xd')](_0x5e01('0xe')))['utc']()[_0x5e01('0xd')](),'$lte':moment(moment(_0x3d0b04['$lte'])['format'](_0x5e01('0xe')))[_0x5e01('0xf')]()['subtract'](0x1,'s')[_0x5e01('0xd')]()};_0x502518[_0x406b26]=_0x468901;}else if(_0x553a53['name']===_0x5e01('0x10')){_0x502518[_0x406b26]=_0x3c2ea2;}else{_0x502518[_0x406b26]=_['isArray'](_0x3c2ea2)?_0x3c2ea2:JSON[_0x5e01('0x5')](_0x3c2ea2);}}else{_0x502518[_0x406b26]=_['isArray'](_0x3c2ea2)?_0x3c2ea2:JSON[_0x5e01('0x5')](_0x3c2ea2);}}catch(_0x5eda1d){_0x502518[_0x406b26]=_0x3c2ea2['split'](',');}});}return _0x502518;};exports[_0x5e01('0x11')]=function(_0x42b4f8){_0x42b4f8=parseInt(_0x42b4f8,0xa);if(!_0x42b4f8||_0x42b4f8<0x0){_0x42b4f8=LIMIT_VALUE;}return _0x42b4f8;};exports['offset']=function(_0xce3f3f){_0xce3f3f=parseInt(_0xce3f3f,0xa);if(!_0xce3f3f||_0xce3f3f<0x0){_0xce3f3f=0x0;}return _0xce3f3f;};exports[_0x5e01('0x12')]=function(_0x36b4a7){var _0x45e543,_0x396cf3=null;if(_0x36b4a7){_0x45e543=_0x36b4a7[_0x5e01('0x7')](',');_0x396cf3=_[_0x5e01('0x13')](_0x45e543,function(_0x153eb1){if(_0x153eb1['indexOf']('-')===0x0){return[_0x153eb1===_0x5e01('0x14')?sequelize[_0x5e01('0x15')](sequelize['col'](_0x5e01('0x14')),_0x5e01('0x16')):_0x153eb1[_0x5e01('0x17')](0x1),_0x5e01('0x18')];}else{return[_0x153eb1===_0x5e01('0x14')?sequelize[_0x5e01('0x15')](sequelize['col'](_0x5e01('0x14')),_0x5e01('0x16')):_0x153eb1,_0x5e01('0x19')];}});}return _0x396cf3;};exports[_0x5e01('0x1a')]=function(_0x514ade,_0x557f06){if(_[_0x5e01('0x9')](_0x514ade)){return _0x514ade;}if(_[_0x5e01('0x1b')](_0x514ade)){for(var _0x4f94d0=0x0;_0x4f94d0<_0x514ade[_0x5e01('0x1c')];_0x4f94d0+=0x1){_0x514ade[_0x4f94d0]=this[_0x5e01('0x1a')](_0x514ade[_0x4f94d0],_0x557f06);}return _0x514ade;}if(!_[_0x5e01('0x1d')](_0x514ade)){return _0x514ade;}if(_[_0x5e01('0x1e')](_0x557f06)){_0x557f06=[_0x557f06];}if(!_['isArray'](_0x557f06)){return _0x514ade;}for(var _0x4d0ebe=0x0;_0x4d0ebe<_0x557f06[_0x5e01('0x1c')];_0x4d0ebe+=0x1){_['unset'](_0x514ade,_0x557f06[_0x4d0ebe]);}for(var _0x14b9f5 in _0x514ade){if(_0x514ade[_0x5e01('0x1f')](_0x14b9f5)){_0x514ade[_0x14b9f5]=this[_0x5e01('0x1a')](_0x514ade[_0x14b9f5],_0x557f06);}}return _0x514ade;};exports[_0x5e01('0x20')]=function(_0x592a61){return _0x592a61['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x350ab4){return _0x350ab4['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x5e01('0x21')]=function(_0x37b32a){var _0xc6d3c2=[];_0x37b32a['split'](/[ ,]+/)[_0x5e01('0x22')](function(_0x36d7a8){_0x36d7a8=_0x36d7a8[_0x5e01('0x23')](/([^:]")"+/g,'$1');_0x36d7a8='+'+_0x36d7a8+'*';var _0x33b3b3=/[ `!@#$%^&*()_\-?~]/;if(_0x36d7a8['match'](_0x33b3b3))_0x36d7a8='\x22'+_0x36d7a8+'\x22';_0xc6d3c2['push'](_0x36d7a8);});return _0xc6d3c2[_0x5e01('0x24')]('\x20');};exports[_0x5e01('0x25')]=function(_0x308649,_0x207107,_0x350659){var _0x1a0ebe={},_0x2bc93b={};if(_0x207107[_0x5e01('0x26')][_0x5e01('0x27')]){_0x207107[_0x5e01('0x26')]['id']=_0x207107[_0x5e01('0x26')][_0x5e01('0x27')];delete _0x207107['query'][_0x5e01('0x27')];}_0x1a0ebe[_0x5e01('0x28')]=_[_0x5e01('0x13')](_0x308649,'name');_0x1a0ebe[_0x5e01('0x26')]=_[_0x5e01('0x3')](_0x207107['query']);_0x1a0ebe[_0x5e01('0x8')]=_[_0x5e01('0x29')](_0x1a0ebe[_0x5e01('0x28')],_0x1a0ebe['query']);_0x2bc93b[_0x5e01('0x2a')]=_[_0x5e01('0x29')](_0x1a0ebe[_0x5e01('0x28')],this[_0x5e01('0x6')](_0x207107[_0x5e01('0x26')][_0x5e01('0x6')]));_0x2bc93b[_0x5e01('0x2a')]=_0x2bc93b[_0x5e01('0x2a')][_0x5e01('0x1c')]?_0x2bc93b[_0x5e01('0x2a')]:_0x1a0ebe[_0x5e01('0x28')];if(!_0x207107[_0x5e01('0x26')][_0x5e01('0x1f')](_0x5e01('0x2b'))){_0x2bc93b[_0x5e01('0x11')]=this['limit'](_0x207107[_0x5e01('0x26')]['limit']);_0x2bc93b['offset']=this[_0x5e01('0x2c')](_0x207107[_0x5e01('0x26')][_0x5e01('0x2c')]);}_0x2bc93b[_0x5e01('0x2d')]=this[_0x5e01('0x12')](_0x207107['query'][_0x5e01('0x12')]);_0x2bc93b[_0x5e01('0x2e')]=this['filters'](_[_0x5e01('0x2f')](_0x207107[_0x5e01('0x26')],_0x1a0ebe[_0x5e01('0x8')]),_0x308649);if(_0x207107['query'][_0x5e01('0x30')]){var _0xfed2d2=_0x308649;var _0x503c8c=_0x207107[_0x5e01('0x26')][_0x5e01('0x30')];if(typeof _0x503c8c==='object'){_0xfed2d2=_['filter'](_0x308649,function(_0xce5f1b){return _['includes'](_0x503c8c[_0x5e01('0x31')],_0xce5f1b[_0x5e01('0x32')]);});_0x503c8c=_0x503c8c[_0x5e01('0x33')];}_0x2bc93b[_0x5e01('0x2e')]=_['merge'](_0x2bc93b[_0x5e01('0x2e')],{'$or':_[_0x5e01('0x13')](_0xfed2d2,function(_0x23275f){if(_0x23275f[_0x5e01('0xb')]!==_0x5e01('0x34')){if(_0x350659){return sequelize[_0x5e01('0x2e')](sequelize['fn'](_0x5e01('0x35'),sequelize['col'](_0x23275f[_0x5e01('0x32')])),{'$like':sequelize['fn'](_0x5e01('0x35'),'%'+_0x207107[_0x5e01('0x26')][_0x5e01('0x30')]+'%')});}else{var _0x1fb95f={};_0x1fb95f[_0x23275f['name']]={'$like':'%'+_0x207107[_0x5e01('0x26')][_0x5e01('0x30')]+'%'};return _0x1fb95f;}}})});}_0x2bc93b=_[_0x5e01('0x36')]({},_0x2bc93b,_0x207107[_0x5e01('0x37')]);return _0x2bc93b;}; \ No newline at end of file +var _0x44e8=['sort','map','indexOf','col','priority','unsigned','substr','cast','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','fields','nolimit','filter','object','columns','value','where','lower','merge','options','lodash','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','limit','offset'];(function(_0x2bdecd,_0x21805f){var _0x56116e=function(_0x297d20){while(--_0x297d20){_0x2bdecd['push'](_0x2bdecd['shift']());}};_0x56116e(++_0x21805f);}(_0x44e8,0xd7));var _0x844e=function(_0x3a0639,_0x5b9f7e){_0x3a0639=_0x3a0639-0x0;var _0x4da42c=_0x44e8[_0x3a0639];return _0x4da42c;};'use strict';var _=require(_0x844e('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b5be7){var _0x21307e=['ne'];try{var _0x2afcef=JSON[_0x844e('0x1')](_0x1b5be7);var _0x49ce1b=Object[_0x844e('0x2')](_0x2afcef)[0x0];return _0x21307e[_0x844e('0x3')](_0x49ce1b);}catch(_0x2c8b9e){return![];}}function getOperatorValue(_0x446f47){var _0x5c8f67=JSON[_0x844e('0x1')](_0x446f47);var _0x238796=Object[_0x844e('0x2')](_0x5c8f67)[0x0];var _0x11cbd6=_0x5c8f67[_0x238796];return{['$'+_0x238796]:_0x11cbd6};}exports['fields']=function(_0x31ab50){var _0x7dff16=null;if(_0x31ab50){_0x7dff16=_0x31ab50[_0x844e('0x4')](',');}return _0x7dff16;};exports[_0x844e('0x5')]=function(_0x32c6c7,_0x1f9921){var _0x536601={};if(!_[_0x844e('0x6')](_0x32c6c7)){_[_0x844e('0x7')](_0x32c6c7,function(_0x183c7e,_0x285a64){try{if(_0x1f9921){var _0x14909f=_[_0x844e('0x8')](_0x1f9921,{'name':_0x285a64})||{};if(hasSequelizeOperator(_0x183c7e)){_0x536601[_0x285a64]=getOperatorValue(_0x183c7e);}else if(_0x14909f[_0x844e('0x9')]==='DATE'&&_[_0x844e('0xa')](_0x183c7e)){var _0x23df3f=JSON['parse'](_0x183c7e);var _0x3a09d0={'$gte':moment(moment(_0x23df3f[_0x844e('0xb')])['format'](_0x844e('0xc')))[_0x844e('0xd')]()[_0x844e('0xe')](),'$lte':moment(moment(_0x23df3f['$lte'])[_0x844e('0xe')](_0x844e('0xc')))[_0x844e('0xd')]()[_0x844e('0xf')](0x1,'s')[_0x844e('0xe')]()};_0x536601[_0x285a64]=_0x3a09d0;}else if(_0x14909f[_0x844e('0x10')]===_0x844e('0x11')){_0x536601[_0x285a64]=_0x183c7e;}else{_0x536601[_0x285a64]=_[_0x844e('0x12')](_0x183c7e)?_0x183c7e:JSON['parse'](_0x183c7e);}}else{_0x536601[_0x285a64]=_[_0x844e('0x12')](_0x183c7e)?_0x183c7e:JSON['parse'](_0x183c7e);}}catch(_0x3c307f){_0x536601[_0x285a64]=_0x183c7e['split'](',');}});}return _0x536601;};exports[_0x844e('0x13')]=function(_0x55bcd6){_0x55bcd6=parseInt(_0x55bcd6,0xa);if(!_0x55bcd6||_0x55bcd6<0x0){_0x55bcd6=LIMIT_VALUE;}return _0x55bcd6;};exports[_0x844e('0x14')]=function(_0x10739f){_0x10739f=parseInt(_0x10739f,0xa);if(!_0x10739f||_0x10739f<0x0){_0x10739f=0x0;}return _0x10739f;};exports[_0x844e('0x15')]=function(_0x410325){var _0x3ea7da,_0x2b58c7=null;if(_0x410325){_0x3ea7da=_0x410325[_0x844e('0x4')](',');_0x2b58c7=_[_0x844e('0x16')](_0x3ea7da,function(_0x4ffb86){if(_0x4ffb86[_0x844e('0x17')]('-')===0x0){return[_0x4ffb86==='priority'?sequelize['cast'](sequelize[_0x844e('0x18')](_0x844e('0x19')),_0x844e('0x1a')):_0x4ffb86[_0x844e('0x1b')](0x1),'DESC'];}else{return[_0x4ffb86===_0x844e('0x19')?sequelize[_0x844e('0x1c')](sequelize['col'](_0x844e('0x19')),_0x844e('0x1a')):_0x4ffb86,_0x844e('0x1d')];}});}return _0x2b58c7;};exports[_0x844e('0x1e')]=function(_0x35236b,_0x3a65fc){if(_['isEmpty'](_0x35236b)){return _0x35236b;}if(_[_0x844e('0x12')](_0x35236b)){for(var _0xadf0d8=0x0;_0xadf0d8<_0x35236b[_0x844e('0x1f')];_0xadf0d8+=0x1){_0x35236b[_0xadf0d8]=this[_0x844e('0x1e')](_0x35236b[_0xadf0d8],_0x3a65fc);}return _0x35236b;}if(!_[_0x844e('0x20')](_0x35236b)){return _0x35236b;}if(_['isString'](_0x3a65fc)){_0x3a65fc=[_0x3a65fc];}if(!_[_0x844e('0x12')](_0x3a65fc)){return _0x35236b;}for(var _0x5080c1=0x0;_0x5080c1<_0x3a65fc['length'];_0x5080c1+=0x1){_[_0x844e('0x21')](_0x35236b,_0x3a65fc[_0x5080c1]);}for(var _0x130d87 in _0x35236b){if(_0x35236b[_0x844e('0x22')](_0x130d87)){_0x35236b[_0x130d87]=this['omit'](_0x35236b[_0x130d87],_0x3a65fc);}}return _0x35236b;};exports[_0x844e('0x23')]=function(_0x2d4acd){return _0x2d4acd[_0x844e('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x844e('0x25')]=function(_0x81d4de){return _0x81d4de[_0x844e('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x844e('0x26')]=function(_0x454b68){var _0x799cde=[];_0x454b68[_0x844e('0x4')](/[ ,]+/)[_0x844e('0x27')](function(_0x618bf6){_0x618bf6=_0x618bf6[_0x844e('0x28')](/([^:]")"+/g,'$1');_0x618bf6='+'+_0x618bf6+'*';var _0x550240=/[ `!@#$%^&*()_\-?~]/;if(_0x618bf6[_0x844e('0x24')](_0x550240))_0x618bf6='\x22'+_0x618bf6+'\x22';_0x799cde[_0x844e('0x29')](_0x618bf6);});return _0x799cde[_0x844e('0x2a')]('\x20');};exports[_0x844e('0x2b')]=function(_0x43ae36,_0x31754e,_0x27e5b3){var _0x55c488={},_0x26d6f2={};if(_0x31754e[_0x844e('0x2c')][_0x844e('0x2d')]){_0x31754e['query']['id']=_0x31754e[_0x844e('0x2c')][_0x844e('0x2d')];delete _0x31754e['query'][_0x844e('0x2d')];}_0x55c488[_0x844e('0x2e')]=_['map'](_0x43ae36,_0x844e('0x10'));_0x55c488[_0x844e('0x2c')]=_[_0x844e('0x2')](_0x31754e[_0x844e('0x2c')]);_0x55c488[_0x844e('0x5')]=_[_0x844e('0x2f')](_0x55c488[_0x844e('0x2e')],_0x55c488['query']);_0x26d6f2[_0x844e('0x30')]=_[_0x844e('0x2f')](_0x55c488[_0x844e('0x2e')],this[_0x844e('0x31')](_0x31754e[_0x844e('0x2c')][_0x844e('0x31')]));_0x26d6f2[_0x844e('0x30')]=_0x26d6f2[_0x844e('0x30')][_0x844e('0x1f')]?_0x26d6f2[_0x844e('0x30')]:_0x55c488[_0x844e('0x2e')];if(!_0x31754e['query']['hasOwnProperty'](_0x844e('0x32'))){_0x26d6f2[_0x844e('0x13')]=this[_0x844e('0x13')](_0x31754e[_0x844e('0x2c')][_0x844e('0x13')]);_0x26d6f2[_0x844e('0x14')]=this[_0x844e('0x14')](_0x31754e[_0x844e('0x2c')][_0x844e('0x14')]);}_0x26d6f2['order']=this[_0x844e('0x15')](_0x31754e['query'][_0x844e('0x15')]);_0x26d6f2['where']=this[_0x844e('0x5')](_['pick'](_0x31754e[_0x844e('0x2c')],_0x55c488[_0x844e('0x5')]),_0x43ae36);if(_0x31754e[_0x844e('0x2c')][_0x844e('0x33')]){var _0x2eb412=_0x43ae36;var _0x3b4c9e=_0x31754e[_0x844e('0x2c')][_0x844e('0x33')];if(typeof _0x3b4c9e===_0x844e('0x34')){_0x2eb412=_[_0x844e('0x33')](_0x43ae36,function(_0x3bdf19){return _['includes'](_0x3b4c9e[_0x844e('0x35')],_0x3bdf19[_0x844e('0x10')]);});_0x3b4c9e=_0x3b4c9e[_0x844e('0x36')];}_0x26d6f2['where']=_['merge'](_0x26d6f2[_0x844e('0x37')],{'$or':_[_0x844e('0x16')](_0x2eb412,function(_0x1a7817){if(_0x1a7817['type']!=='VIRTUAL'){if(_0x27e5b3){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x844e('0x18')](_0x1a7817[_0x844e('0x10')])),{'$like':sequelize['fn'](_0x844e('0x38'),'%'+_0x31754e[_0x844e('0x2c')][_0x844e('0x33')]+'%')});}else{var _0x4c756b={};_0x4c756b[_0x1a7817[_0x844e('0x10')]]={'$like':'%'+_0x31754e['query']['filter']+'%'};return _0x4c756b;}}})});}_0x26d6f2=_[_0x844e('0x39')]({},_0x26d6f2,_0x31754e[_0x844e('0x3a')]);return _0x26d6f2;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 3b479fd..5daf60e 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa486=['find','globalStatus','split','order','ASC','internal','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','openchannelStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','filterAgentAttributes','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','isArray','startCase','Queue','map','getAgents','all','flatten','uniq','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','findAll','name','fullname','smsPause'];(function(_0x49ecee,_0x1598da){var _0x515286=function(_0x116945){while(--_0x116945){_0x49ecee['push'](_0x49ecee['shift']());}};_0x515286(++_0x1598da);}(_0xa486,0x1b3));var _0x6a48=function(_0x28481b,_0x3bb08d){_0x28481b=_0x28481b-0x0;var _0x40d6de=_0xa486[_0x28481b];return _0x40d6de;};'use strict';var _=require(_0x6a48('0x0'));var jayson=require('jayson/promise');var db=require(_0x6a48('0x1'))['db'];var amiClient=jayson[_0x6a48('0x2')][_0x6a48('0x3')]({'port':0x232a});var routingClient=jayson[_0x6a48('0x2')][_0x6a48('0x3')]({'port':0x232c});function isAgentPaused(_0x5aa541,_0x30ffda){var _0x1a83a0=[_0x5aa541[_0x6a48('0x4')],_0x5aa541[_0x6a48('0x5')],_0x5aa541[_0x6a48('0x6')],_0x5aa541[_0x6a48('0x7')],_0x5aa541['smsPause'],_0x5aa541[_0x6a48('0x8')],_0x5aa541[_0x6a48('0x9')]];if(!_0x30ffda)return _[_0x6a48('0xa')](_0x1a83a0);var _0x2844a8=_['filter'](_0x1a83a0);return _0x2844a8[_0x6a48('0xb')]>0x0&&_0x2844a8[_0x6a48('0xb')]<_0x1a83a0[_0x6a48('0xb')]?!![]:![];}function isIdle(_0x965eb7){return _0x965eb7===_0x6a48('0xc')||_0x965eb7===_0x6a48('0xd')||_0x965eb7===_0x6a48('0xe')||_0x965eb7==='ringing'||_[_0x6a48('0xf')](_0x965eb7);}function isAgentIdle(_0x2391f7){if(_0x2391f7[_0x6a48('0x10')]!==_0x6a48('0xc')&&_0x2391f7[_0x6a48('0x8')]){_0x2391f7[_0x6a48('0x10')]=_0x6a48('0x11');return![];}return _['every']([_0x2391f7[_0x6a48('0x12')],_0x2391f7[_0x6a48('0x13')],_0x2391f7[_0x6a48('0x14')],_0x2391f7[_0x6a48('0x15')],_0x2391f7[_0x6a48('0x16')],_0x2391f7[_0x6a48('0x10')],_0x2391f7[_0x6a48('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x6a48('0x18'),{})['then'](function(_0x1d3de0){if(_0x1d3de0[_0x6a48('0x19')]){throw new Error(_0x6a48('0x1a'));}var _0x45dc57=_0x1d3de0[_0x6a48('0x1b')];return routingClient[_0x6a48('0x1c')](_0x6a48('0x18'),{})[_0x6a48('0x1d')](function(_0x484ccd){if(_0x484ccd[_0x6a48('0x19')]){throw new Error(_0x6a48('0x1e'));}var _0x3e4deb=_0x484ccd['result'];return _[_0x6a48('0x1f')]({},_0x45dc57,_0x3e4deb);});})[_0x6a48('0x20')](function(_0x137415){throw _0x137415;});}exports[_0x6a48('0x21')]=getRealtimeAgents;function getAgentStatus(_0x1c31fb){var _0x3e2aba=_0x6a48('0xd');if(isAgentPaused(_0x1c31fb))_0x3e2aba=_0x6a48('0x11');else if(isAgentPaused(_0x1c31fb,!![]))_0x3e2aba='*pause';else if(isAgentIdle(_0x1c31fb))_0x3e2aba='idle';else _0x3e2aba=_0x6a48('0x22');return _0x3e2aba;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x27597b,_0x179411){var _0x4e37be=_[_0x6a48('0x23')](_0x27597b)?_0x27597b:[_0x27597b];var _0x591134=_[_0x6a48('0x24')](_0x179411)+_0x6a48('0x25');var _0x42d564=_[_0x6a48('0x26')](_0x4e37be,function(_0x3238e1){return db[_0x591134]['findOne']({'where':{'id':_0x3238e1}})[_0x6a48('0x1d')](function(_0x45cdae){if(!_0x45cdae)return[];return _0x45cdae[_0x6a48('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x6a48('0x28')](_0x42d564)[_0x6a48('0x1d')](function(_0xbf3067){var _0x42a931=_(_0xbf3067)[_0x6a48('0x29')]()[_0x6a48('0x26')]('id')[_0x6a48('0x2a')]()['value']();return _0x42a931;});}exports[_0x6a48('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3c3124,_0x13e7c5,_0x517aa6){try{if(_0x13e7c5[_0x6a48('0xb')]>0x0){_0x3c3124=_0x3c3124[_0x6a48('0x2c')](function(_0xf46b5f){return _0x13e7c5[_0x6a48('0x2d')](_0xf46b5f['id']);});}var _0x73cd1f=_0x3c3124[_0x6a48('0x2c')](function(_0x2abc25){var _0xa53284=_0x6a48('0x22');if(isAgentIdle(_0x2abc25)){_0xa53284=_0x6a48('0xc');}return _0xa53284===_0x517aa6;});return _['map'](_0x73cd1f,'id');}catch(_0x51c26c){throw _0x51c26c;}}exports[_0x6a48('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x583868,_0x566afe,_0x48b7b6){return Promise['resolve']()[_0x6a48('0x1d')](function(){if(_0x566afe['length']>0x0){_0x583868=_0x583868[_0x6a48('0x2c')](function(_0x59eb48){return _0x566afe['includes'](_0x59eb48['id']);});}return _0x583868;})[_0x6a48('0x1d')](function(){return db['User'][_0x6a48('0x2f')]({'attributes':['id',_0x6a48('0x30'),_0x6a48('0x31'),'chatPause',_0x6a48('0x5'),_0x6a48('0x6'),_0x6a48('0x7'),_0x6a48('0x32'),_0x6a48('0x8'),'whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x6a48('0x26')](_0x583868,'id')}},'raw':!![]});})[_0x6a48('0x1d')](function(_0x193ad9){return _0x193ad9[_0x6a48('0x26')](function(_0x1a285e){var _0xb8fdb3=_[_0x6a48('0x33')](_0x583868,['id',_0x1a285e['id']]);var _0x16e880=filterAgentAttributes(_0xb8fdb3);_[_0x6a48('0x1f')](_0x1a285e,_0x16e880);_0x1a285e[_0x6a48('0x34')]=getAgentStatus(_0x1a285e);return _0x1a285e;});})[_0x6a48('0x1d')](function(_0x5da2f8){var _0x1528bc=sortAgentsByStatus(_0x5da2f8,_0x48b7b6);return _[_0x6a48('0x26')](_0x1528bc,'id');})['catch'](function(_0x1ae692){throw _0x1ae692;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4fd618){var _0x18a3aa={'fields':[],'order':null};var _0x4b9168=_0x4fd618[_0x6a48('0x35')](',');_0x18a3aa['fields']=_['filter'](_0x4b9168,function(_0x948de0){if(!_0x948de0['includes'](_0x6a48('0x34'))){return!![];}_0x18a3aa[_0x6a48('0x36')]=_['startsWith'](_0x948de0,'-')?'DESC':_0x6a48('0x37');return![];});return _0x18a3aa;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x3eb412){if(_0x3eb412[_0x6a48('0x2d')](_0x6a48('0x31'))&&!_0x3eb412[_0x6a48('0x2d')]('internal')){var _0x26651b=_0x3eb412['substring'](0x0,_0x3eb412['indexOf'](_0x6a48('0x31')));_0x3eb412+=','+_0x26651b+_0x6a48('0x38');}return _0x3eb412;}exports[_0x6a48('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x351b9f,_0x5c281){var _0x1b1af7=_0x351b9f[_0x6a48('0x3a')](function(_0x2721ad,_0x343aca){if(_0x2721ad[_0x6a48('0x34')]===_0x343aca[_0x6a48('0x34')]){if(_0x2721ad['globalStatus']==='pause'){if(_0x5c281===_0x6a48('0x3b')){return(_0x2721ad[_0x6a48('0x3c')]||'')<(_0x343aca[_0x6a48('0x3c')]||'')||_0x2721ad[_0x6a48('0x31')][_0x6a48('0x3d')]()>_0x343aca[_0x6a48('0x31')][_0x6a48('0x3d')]()?0x1:-0x1;}else{return(_0x2721ad[_0x6a48('0x3c')]||'')<(_0x343aca[_0x6a48('0x3c')]||'')||_0x2721ad[_0x6a48('0x31')][_0x6a48('0x3d')]()>_0x343aca['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x5c281===_0x6a48('0x3b')){return _0x2721ad[_0x6a48('0x31')]['toLowerCase']()<_0x343aca['fullname'][_0x6a48('0x3d')]()?0x1:-0x1;}else{return _0x2721ad['fullname'][_0x6a48('0x3d')]()<_0x343aca[_0x6a48('0x31')][_0x6a48('0x3d')]()?-0x1:0x1;}}}else{if(_0x5c281===_0x6a48('0x3b')){return _0x2721ad[_0x6a48('0x34')]<_0x343aca[_0x6a48('0x34')]?0x1:-0x1;}else{return _0x2721ad['globalStatus']<_0x343aca[_0x6a48('0x34')]?-0x1:0x1;}}});return _0x1b1af7;}exports[_0x6a48('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x31c783){var _0xd5d8a=[_0x6a48('0x3f'),_0x6a48('0x40'),'lastLoginAt',_0x6a48('0x41'),_0x6a48('0x3c'),_0x6a48('0x41'),_0x6a48('0x38'),_0x6a48('0x42'),'chatPause',_0x6a48('0x7'),_0x6a48('0x6'),_0x6a48('0x32'),_0x6a48('0x9'),'faxPause',_0x6a48('0x8'),_0x6a48('0x43'),_0x6a48('0x44'),'mailCapacity','smsCapacity',_0x6a48('0x45'),_0x6a48('0x46'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x6a48('0x47'),_0x6a48('0x48'),_0x6a48('0x49'),'faxCurrentCapacity',_0x6a48('0x12'),_0x6a48('0x15'),'mailStatus',_0x6a48('0x16'),_0x6a48('0x17'),'faxStatus',_0x6a48('0x10'),_0x6a48('0x4a'),_0x6a48('0x4b'),'mailStatusTime','smsStatusTime','whatsappStatusTime',_0x6a48('0x4c'),_0x6a48('0x4d'),_0x6a48('0x4e'),'destconnectedlinenum',_0x6a48('0x4f'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias'];var _0x5866e6=[_0x6a48('0x4'),_0x6a48('0x7'),_0x6a48('0x6'),_0x6a48('0x32'),_0x6a48('0x9'),_0x6a48('0x5'),_0x6a48('0x8'),_0x6a48('0x40')];var _0x484bd9=_(_0x31c783)['omit'](_0x5866e6)['pick'](_0xd5d8a)['value']();return _0x484bd9;}exports[_0x6a48('0x50')]=filterAgentAttributes; \ No newline at end of file +var _0xa3fc=['mailStatus','smsStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','filterAgentAttributes','lodash','jayson/promise','client','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','whatsappStatus','Agents','then','error','result','request','catch','getRealtimeAgents','getAgentStatus','isArray','Queue','findOne','all','map','uniq','value','getAgentIdsByQueues','busy','getAgentIdsByStatus','resolve','includes','User','findAll','name','chatPause','smsPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity'];(function(_0x22a24e,_0x52afa8){var _0x160684=function(_0x5be544){while(--_0x5be544){_0x22a24e['push'](_0x22a24e['shift']());}};_0x160684(++_0x52afa8);}(_0xa3fc,0x1d3));var _0xca3f=function(_0x73e5b0,_0x241ec0){_0x73e5b0=_0x73e5b0-0x0;var _0x23ed6f=_0xa3fc[_0x73e5b0];return _0x23ed6f;};'use strict';var _=require(_0xca3f('0x0'));var jayson=require(_0xca3f('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xca3f('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x247a94,_0x41eb71){var _0x6c608e=[_0x247a94['chatPause'],_0x247a94[_0xca3f('0x3')],_0x247a94[_0xca3f('0x4')],_0x247a94[_0xca3f('0x5')],_0x247a94['smsPause'],_0x247a94[_0xca3f('0x6')],_0x247a94[_0xca3f('0x7')]];if(!_0x41eb71)return _[_0xca3f('0x8')](_0x6c608e);var _0x1b48de=_[_0xca3f('0x9')](_0x6c608e);return _0x1b48de[_0xca3f('0xa')]>0x0&&_0x1b48de[_0xca3f('0xa')]<_0x6c608e[_0xca3f('0xa')]?!![]:![];}function isIdle(_0x856762){return _0x856762===_0xca3f('0xb')||_0x856762===_0xca3f('0xc')||_0x856762===_0xca3f('0xd')||_0x856762==='ringing'||_['isNil'](_0x856762);}function isAgentIdle(_0xfd0968){if(_0xfd0968[_0xca3f('0xe')]!==_0xca3f('0xb')&&_0xfd0968['voicePause']){_0xfd0968['voiceStatus']=_0xca3f('0xf');return![];}return _['every']([_0xfd0968[_0xca3f('0x10')],_0xfd0968[_0xca3f('0x11')],_0xfd0968['mailStatus'],_0xfd0968[_0xca3f('0x12')],_0xfd0968['smsStatus'],_0xfd0968[_0xca3f('0xe')],_0xfd0968[_0xca3f('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xca3f('0x14'),{})[_0xca3f('0x15')](function(_0x35600b){if(_0x35600b[_0xca3f('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x5c6339=_0x35600b[_0xca3f('0x17')];return routingClient[_0xca3f('0x18')]('Agents',{})[_0xca3f('0x15')](function(_0x370874){if(_0x370874[_0xca3f('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x2c7420=_0x370874[_0xca3f('0x17')];return _['merge']({},_0x5c6339,_0x2c7420);});})[_0xca3f('0x19')](function(_0x48d8fa){throw _0x48d8fa;});}exports[_0xca3f('0x1a')]=getRealtimeAgents;function getAgentStatus(_0x42f17b){var _0x960d18=_0xca3f('0xc');if(isAgentPaused(_0x42f17b))_0x960d18=_0xca3f('0xf');else if(isAgentPaused(_0x42f17b,!![]))_0x960d18='*pause';else if(isAgentIdle(_0x42f17b))_0x960d18='idle';else _0x960d18='busy';return _0x960d18;}exports[_0xca3f('0x1b')]=getAgentStatus;function getAgentIdsByQueues(_0x3a0760,_0x37b048){var _0x73fe4=_[_0xca3f('0x1c')](_0x3a0760)?_0x3a0760:[_0x3a0760];var _0x2cec85=_['startCase'](_0x37b048)+_0xca3f('0x1d');var _0x3dfbce=_['map'](_0x73fe4,function(_0x93fabb){return db[_0x2cec85][_0xca3f('0x1e')]({'where':{'id':_0x93fabb}})[_0xca3f('0x15')](function(_0x3b4e6e){if(!_0x3b4e6e)return[];return _0x3b4e6e['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xca3f('0x1f')](_0x3dfbce)['then'](function(_0x2da291){var _0x28dea8=_(_0x2da291)['flatten']()[_0xca3f('0x20')]('id')[_0xca3f('0x21')]()[_0xca3f('0x22')]();return _0x28dea8;});}exports[_0xca3f('0x23')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5d3f4a,_0x2732da,_0x5f5a34){try{if(_0x2732da[_0xca3f('0xa')]>0x0){_0x5d3f4a=_0x5d3f4a[_0xca3f('0x9')](function(_0x51b234){return _0x2732da['includes'](_0x51b234['id']);});}var _0x490e3d=_0x5d3f4a['filter'](function(_0x2d1c54){var _0x326daf=_0xca3f('0x24');if(isAgentIdle(_0x2d1c54)){_0x326daf=_0xca3f('0xb');}return _0x326daf===_0x5f5a34;});return _[_0xca3f('0x20')](_0x490e3d,'id');}catch(_0x1677ad){throw _0x1677ad;}}exports[_0xca3f('0x25')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2260e7,_0x3d0232,_0x429696){return Promise[_0xca3f('0x26')]()[_0xca3f('0x15')](function(){if(_0x3d0232[_0xca3f('0xa')]>0x0){_0x2260e7=_0x2260e7[_0xca3f('0x9')](function(_0x5157cf){return _0x3d0232[_0xca3f('0x27')](_0x5157cf['id']);});}return _0x2260e7;})['then'](function(){return db[_0xca3f('0x28')][_0xca3f('0x29')]({'attributes':['id',_0xca3f('0x2a'),'fullname',_0xca3f('0x2b'),_0xca3f('0x3'),_0xca3f('0x4'),_0xca3f('0x5'),_0xca3f('0x2c'),'voicePause',_0xca3f('0x7'),_0xca3f('0x2d')],'where':{'id':{'$in':_[_0xca3f('0x20')](_0x2260e7,'id')}},'raw':!![]});})[_0xca3f('0x15')](function(_0x58ea4b){return _0x58ea4b['map'](function(_0x37c76a){var _0x4812e5=_['find'](_0x2260e7,['id',_0x37c76a['id']]);var _0x1764c7=filterAgentAttributes(_0x4812e5);_['merge'](_0x37c76a,_0x1764c7);_0x37c76a[_0xca3f('0x2e')]=getAgentStatus(_0x37c76a);return _0x37c76a;});})['then'](function(_0x259026){var _0x4dee50=sortAgentsByStatus(_0x259026,_0x429696);return _[_0xca3f('0x20')](_0x4dee50,'id');})[_0xca3f('0x19')](function(_0x8e2130){throw _0x8e2130;});}exports[_0xca3f('0x2f')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x338078){var _0x21d50a={'fields':[],'order':null};var _0x138197=_0x338078['split'](',');_0x21d50a['fields']=_['filter'](_0x138197,function(_0x38a011){if(!_0x38a011['includes']('globalStatus')){return!![];}_0x21d50a['order']=_[_0xca3f('0x30')](_0x38a011,'-')?_0xca3f('0x31'):_0xca3f('0x32');return![];});return _0x21d50a;}exports[_0xca3f('0x33')]=getUpdatedSortOptions;function validateSortParameter(_0x313699){if(_0x313699[_0xca3f('0x27')](_0xca3f('0x34'))&&!_0x313699['includes'](_0xca3f('0x35'))){var _0x385367=_0x313699[_0xca3f('0x36')](0x0,_0x313699[_0xca3f('0x37')](_0xca3f('0x34')));_0x313699+=','+_0x385367+'internal';}return _0x313699;}exports[_0xca3f('0x38')]=validateSortParameter;function sortAgentsByStatus(_0x54b406,_0x166428){var _0x4582e8=_0x54b406[_0xca3f('0x39')](function(_0x8fb9f4,_0xc191be){if(_0x8fb9f4[_0xca3f('0x2e')]===_0xc191be[_0xca3f('0x2e')]){if(_0x8fb9f4[_0xca3f('0x2e')]==='pause'){if(_0x166428===_0xca3f('0x31')){return(_0x8fb9f4[_0xca3f('0x2d')]||'')<(_0xc191be[_0xca3f('0x2d')]||'')||_0x8fb9f4[_0xca3f('0x34')]['toLowerCase']()>_0xc191be['fullname'][_0xca3f('0x3a')]()?0x1:-0x1;}else{return(_0x8fb9f4[_0xca3f('0x2d')]||'')<(_0xc191be['pauseType']||'')||_0x8fb9f4[_0xca3f('0x34')][_0xca3f('0x3a')]()>_0xc191be[_0xca3f('0x34')][_0xca3f('0x3a')]()?-0x1:0x1;}}else{if(_0x166428==='DESC'){return _0x8fb9f4['fullname']['toLowerCase']()<_0xc191be['fullname'][_0xca3f('0x3a')]()?0x1:-0x1;}else{return _0x8fb9f4['fullname'][_0xca3f('0x3a')]()<_0xc191be[_0xca3f('0x34')][_0xca3f('0x3a')]()?-0x1:0x1;}}}else{if(_0x166428===_0xca3f('0x31')){return _0x8fb9f4[_0xca3f('0x2e')]<_0xc191be[_0xca3f('0x2e')]?0x1:-0x1;}else{return _0x8fb9f4['globalStatus']<_0xc191be[_0xca3f('0x2e')]?-0x1:0x1;}}});return _0x4582e8;}exports[_0xca3f('0x3b')]=sortAgentsByStatus;function filterAgentAttributes(_0x65f1f2){var _0x119300=[_0xca3f('0x3c'),'online',_0xca3f('0x3d'),_0xca3f('0x3e'),'pauseType',_0xca3f('0x3e'),_0xca3f('0x35'),_0xca3f('0x3f'),_0xca3f('0x2b'),_0xca3f('0x5'),_0xca3f('0x4'),_0xca3f('0x2c'),'whatsappPause',_0xca3f('0x3'),'voicePause','chatCapacity',_0xca3f('0x40'),_0xca3f('0x41'),_0xca3f('0x42'),_0xca3f('0x43'),_0xca3f('0x44'),'chatCurrentCapacity','openchannelCurrentCapacity',_0xca3f('0x45'),_0xca3f('0x46'),_0xca3f('0x47'),_0xca3f('0x48'),_0xca3f('0x10'),_0xca3f('0x12'),_0xca3f('0x49'),_0xca3f('0x4a'),_0xca3f('0x13'),_0xca3f('0x11'),'voiceStatus',_0xca3f('0x4b'),'openchannelStatusTime',_0xca3f('0x4c'),_0xca3f('0x4d'),_0xca3f('0x4e'),_0xca3f('0x4f'),_0xca3f('0x50'),_0xca3f('0x51'),_0xca3f('0x52'),_0xca3f('0x53'),_0xca3f('0x54'),_0xca3f('0x55'),_0xca3f('0x56')];var _0x5b0d98=[_0xca3f('0x2b'),_0xca3f('0x5'),_0xca3f('0x4'),_0xca3f('0x2c'),_0xca3f('0x7'),'faxPause',_0xca3f('0x6'),_0xca3f('0x57')];var _0x4cfdfe=_(_0x65f1f2)[_0xca3f('0x58')](_0x5b0d98)['pick'](_0x119300)[_0xca3f('0x22')]();return _0x4cfdfe;}exports[_0xca3f('0x59')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a585ea4..828b09e 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(_0x419c4a,_0x5d525d){var _0x4dae37=function(_0x95e7cd){while(--_0x95e7cd){_0x419c4a['push'](_0x419c4a['shift']());}};_0x4dae37(++_0x5d525d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x52fb3c,_0x2cf66e){var _0x5c9223=function(_0x56511c){while(--_0x56511c){_0x52fb3c['push'](_0x52fb3c['shift']());}};_0x5c9223(++_0x2cf66e);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 033cc51..decc8c9 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 _0x672d=['cpus','map','model','join','createHash','md5','update','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','hostname','ipAddress','digest','hex','substring','lodash','execSync','orderBy','keys','filter','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface'];(function(_0x5f23a6,_0x42aa9b){var _0x43ae29=function(_0x1d2931){while(--_0x1d2931){_0x5f23a6['push'](_0x5f23a6['shift']());}};_0x43ae29(++_0x42aa9b);}(_0x672d,0x133));var _0xd672=function(_0x50b13a,_0x46be8b){_0x50b13a=_0x50b13a-0x0;var _0x5553d4=_0x672d[_0x50b13a];return _0x5553d4;};'use strict';var _=require(_0xd672('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xd672('0x1')];var config=require('../environment');function getInterfaces(){var _0xeb1d22=[];var _0x28118b=os['networkInterfaces']();var _0x25b776=_[_0xd672('0x2')](_[_0xd672('0x3')](_0x28118b));for(var _0x640614=0x0;_0x640614<_0x25b776['length'];_0x640614++){var _0x5e6a1a=_0x28118b[_0x25b776[_0x640614]][_0xd672('0x4')](function(_0x4a3524){return _0x4a3524['family']===_0xd672('0x5')&&_0x4a3524['internal']===![];});_0xeb1d22=_0xeb1d22[_0xd672('0x6')](_0x5e6a1a);}return _0xeb1d22;}function getFirstInterface(){var _0x2f24bf=_['head'](getInterfaces());return{'macAddress':_0x2f24bf&&_0x2f24bf[_0xd672('0x7')]?_0x2f24bf[_0xd672('0x7')]:_0xd672('0x8'),'ipAddress':_0x2f24bf&&_0x2f24bf[_0xd672('0x9')]?_0x2f24bf[_0xd672('0x9')]:_0xd672('0xa')};}exports[_0xd672('0xb')]=getFirstInterface;function getCPUhash(){var _0x9de30f=_[_0xd672('0x2')](os[_0xd672('0xc')]()[_0xd672('0xd')](function(_0x470fdd){return _0x470fdd[_0xd672('0xe')];}))[_0xd672('0xf')](':');return crypto[_0xd672('0x10')](_0xd672('0x11'))[_0xd672('0x12')](_0x9de30f)['digest']('hex');}exports[_0xd672('0x13')]=function(){var _0x343a7a=os[_0xd672('0x14')]();var _0x150fa4=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x150fa4['test'](config['licenseToken'])){return config[_0xd672('0x15')];}else if(_0x343a7a==='win32'){return exec(_0xd672('0x16'),{'encoding':_0xd672('0x17')})['replace']('\x0d\x0a','');}else{var _0x45e5a8=getFirstInterface();var _0xb50c5c=getCPUhash();var _0x3c854f=_0xb50c5c+'|'+os[_0xd672('0x18')]()+'|'+_0x45e5a8['macAddress']+'|'+_0x45e5a8[_0xd672('0x19')];var _0x57bf0f=crypto[_0xd672('0x10')](_0xd672('0x11'))['update'](_0x3c854f)[_0xd672('0x1a')](_0xd672('0x1b'));return _0x57bf0f[_0xd672('0x1c')](0x0,0x8)+'-'+_0x57bf0f[_0xd672('0x1c')](0x8,0xc)+'-'+_0x57bf0f['substring'](0xc,0x10)+'-'+_0x57bf0f['substring'](0x10,0x14)+'-'+_0x57bf0f[_0xd672('0x1c')](0x14);}}; \ No newline at end of file +var _0x10c7=['filter','family','IPv4','internal','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','update','digest','substring','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x10c7,0x144));var _0x710c=function(_0x180bc5,_0x17fd8d){_0x180bc5=_0x180bc5-0x0;var _0x310566=_0x10c7[_0x180bc5];return _0x310566;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x710c('0x0'));var machine=require(_0x710c('0x1'));var exec=require(_0x710c('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x4bd887=[];var _0x29d02d=os[_0x710c('0x3')]();var _0x1eb1ed=_[_0x710c('0x4')](_[_0x710c('0x5')](_0x29d02d));for(var _0x4f911b=0x0;_0x4f911b<_0x1eb1ed['length'];_0x4f911b++){var _0x30ca7e=_0x29d02d[_0x1eb1ed[_0x4f911b]][_0x710c('0x6')](function(_0x4b12f9){return _0x4b12f9[_0x710c('0x7')]===_0x710c('0x8')&&_0x4b12f9[_0x710c('0x9')]===![];});_0x4bd887=_0x4bd887['concat'](_0x30ca7e);}return _0x4bd887;}function getFirstInterface(){var _0x4e17ea=_['head'](getInterfaces());return{'macAddress':_0x4e17ea&&_0x4e17ea[_0x710c('0xa')]?_0x4e17ea[_0x710c('0xa')]:'00:00:00:00:00:00','ipAddress':_0x4e17ea&&_0x4e17ea[_0x710c('0xb')]?_0x4e17ea['address']:_0x710c('0xc')};}exports[_0x710c('0xd')]=getFirstInterface;function getCPUhash(){var _0xdc138a=_[_0x710c('0x4')](os[_0x710c('0xe')]()[_0x710c('0xf')](function(_0x432c1f){return _0x432c1f[_0x710c('0x10')];}))[_0x710c('0x11')](':');return crypto[_0x710c('0x12')](_0x710c('0x13'))['update'](_0xdc138a)['digest'](_0x710c('0x14'));}exports['getUuid']=function(){var _0x48fe0a=os[_0x710c('0x15')]();var _0x501004=/[0-9a-f-]{36}/;if(config[_0x710c('0x16')]&&_0x501004[_0x710c('0x17')](config['licenseToken'])){return config['licenseToken'];}else if(_0x48fe0a===_0x710c('0x18')){return exec(_0x710c('0x19'),{'encoding':_0x710c('0x1a')})[_0x710c('0x1b')]('\x0d\x0a','');}else{var _0x832541=getFirstInterface();var _0x496d01=getCPUhash();var _0x29eb9d=_0x496d01+'|'+os[_0x710c('0x1c')]()+'|'+_0x832541['macAddress']+'|'+_0x832541[_0x710c('0x1d')];var _0x3347f8=crypto[_0x710c('0x12')](_0x710c('0x13'))[_0x710c('0x1e')](_0x29eb9d)[_0x710c('0x1f')](_0x710c('0x14'));return _0x3347f8['substring'](0x0,0x8)+'-'+_0x3347f8['substring'](0x8,0xc)+'-'+_0x3347f8[_0x710c('0x20')](0xc,0x10)+'-'+_0x3347f8[_0x710c('0x20')](0x10,0x14)+'-'+_0x3347f8[_0x710c('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7795a51..ceea5b2 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 _0xb2a5=['get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','error','message','getUuid','License','findOrCreate','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb2a5,0x67));var _0x5b2a=function(_0x21592e,_0x50a2da){_0x21592e=_0x21592e-0x0;var _0x216f86=_0xb2a5[_0x21592e];return _0x216f86;};'use strict';var util=require(_0x5b2a('0x0'));var moment=require(_0x5b2a('0x1'));var rp=require(_0x5b2a('0x2'));var BPromise=require(_0x5b2a('0x3'));var pkginfo=require('pkginfo')(module,_0x5b2a('0x4'));var db=require(_0x5b2a('0x5'))['db'];var encryptor=require(_0x5b2a('0x6'));var hardware=require(_0x5b2a('0x7'));var logger=require(_0x5b2a('0x8'))(_0x5b2a('0x9'));var HOST=_0x5b2a('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x427a03){return new BPromise(function(_0x1cdf25,_0x320a1b){var _0x45ecb0=util[_0x5b2a('0xb')](_0x5b2a('0xc'),HOST,_0x427a03,module['exports']['version']);if(oldToken){_0x45ecb0=util[_0x5b2a('0xb')](_0x5b2a('0xd'),HOST,_0x427a03,module[_0x5b2a('0xe')][_0x5b2a('0x4')],oldToken);}var _0x375d20={'uri':_0x45ecb0,'method':_0x5b2a('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x375d20)[_0x5b2a('0x10')](function(_0x5820b2){_0x1cdf25(_0x5820b2);})['catch'](function(_0x1d7d57){_0x320a1b(_0x1d7d57);});});}function manageLicense(_0x29ab64,_0x12f5cc){var _0x69d49e=_0x12f5cc[_0x5b2a('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x69d49e[_0x5b2a('0x12')]!==_0x29ab64&&!_0x69d49e[_0x5b2a('0x13')]){oldToken=_0x69d49e['data1'];}httpRequest(_0x29ab64)[_0x5b2a('0x10')](function(_0x1121f1){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1121f1[_0x5b2a('0x14')]){isOldTokenSent=![];if(!_0x69d49e[_0x5b2a('0x9')]&&_0x69d49e[_0x5b2a('0x9')]!=_0x1121f1[_0x5b2a('0x9')]||_0x69d49e[_0x5b2a('0x9')]&&_0x69d49e[_0x5b2a('0x13')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x69d49e[_0x5b2a('0x9')]&&!_0x69d49e['data2']&&_0x69d49e[_0x5b2a('0x9')]!=_0x1121f1[_0x5b2a('0x9')]){logger[_0x5b2a('0x15')](_0x5b2a('0x16'));}if(_0x69d49e[_0x5b2a('0x9')]&&!_0x69d49e[_0x5b2a('0x13')]&&_0x69d49e[_0x5b2a('0x9')]==_0x1121f1[_0x5b2a('0x9')]){return _0x12f5cc;}return _0x12f5cc[_0x5b2a('0x17')]({'data1':_0x29ab64,'data2':null,'license':_0x1121f1['license']});}else{if(_0x1121f1[_0x5b2a('0x9')]||_0x69d49e[_0x5b2a('0x9')]){if(!_0x69d49e[_0x5b2a('0x13')]){if(_0x69d49e[_0x5b2a('0x12')]==_0x29ab64){GRAY_PERIOD_REASON=_0x5b2a('0x18');logger['info'](_0x5b2a('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x5b2a('0x15')](_0x5b2a('0x1a'),_0x69d49e[_0x5b2a('0x12')],_0x29ab64);}logger[_0x5b2a('0x15')](_0x5b2a('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x5b2a('0xb')](_0x5b2a('0x1c')));return _0x12f5cc[_0x5b2a('0x17')]({'data2':encryptor[_0x5b2a('0x1d')](moment()[_0x5b2a('0xb')](_0x5b2a('0x1c')))});}else{if(moment()[_0x5b2a('0x1e')](encryptor[_0x5b2a('0x1f')](_0x69d49e['data2']),'days')>DAYS){logger[_0x5b2a('0x15')](_0x5b2a('0x20'),moment()[_0x5b2a('0xb')](_0x5b2a('0x1c')));isOldTokenSent=![];return _0x12f5cc[_0x5b2a('0x17')]({'data1':_0x29ab64,'data2':null,'license':null});}}}else{if(_0x69d49e[_0x5b2a('0x12')]!=_0x29ab64){logger[_0x5b2a('0x15')](_0x5b2a('0x1a'),_0x69d49e['data1'],_0x29ab64);return _0x12f5cc['update']({'data1':_0x29ab64,'data2':null,'license':null});}}}return _0x12f5cc;})[_0x5b2a('0x10')](function(_0x2a4e6c){_0x12f5cc=_0x2a4e6c;})[_0x5b2a('0x21')](function(_0x1229d3){logger[_0x5b2a('0x22')](_0x1229d3[_0x5b2a('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x5b2a('0x24')](),_0x12f5cc);},TIME);});}function defaultLicense(){var _0x4d0beb=hardware['getUuid']();if(_0x4d0beb){return db[_0x5b2a('0x25')][_0x5b2a('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x4d0beb}})['spread'](function(_0x2ecf7d,_0x559f68){logger[_0x5b2a('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4d0beb);manageLicense(_0x4d0beb,_0x2ecf7d);})['catch'](function(_0x1e3d57){logger[_0x5b2a('0x22')](_0x1e3d57['message']);});}}exports[_0x5b2a('0x27')]=defaultLicense; \ No newline at end of file +var _0x6544=['./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','request-promise','bluebird','version','../../mysqldb','../../components/encryptor'];(function(_0x5c1fae,_0x2697ef){var _0x2dd6ad=function(_0x370efb){while(--_0x370efb){_0x5c1fae['push'](_0x5c1fae['shift']());}};_0x2dd6ad(++_0x2697ef);}(_0x6544,0xa2));var _0x4654=function(_0x142be6,_0x55f613){_0x142be6=_0x142be6-0x0;var _0x3630d9=_0x6544[_0x142be6];return _0x3630d9;};'use strict';var util=require(_0x4654('0x0'));var moment=require('moment');var rp=require(_0x4654('0x1'));var BPromise=require(_0x4654('0x2'));var pkginfo=require('pkginfo')(module,_0x4654('0x3'));var db=require(_0x4654('0x4'))['db'];var encryptor=require(_0x4654('0x5'));var hardware=require(_0x4654('0x6'));var logger=require(_0x4654('0x7'))(_0x4654('0x8'));var HOST=_0x4654('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4d0fc8){return new BPromise(function(_0x51591d,_0x54656f){var _0x4fef74=util[_0x4654('0xa')](_0x4654('0xb'),HOST,_0x4d0fc8,module[_0x4654('0xc')][_0x4654('0x3')]);if(oldToken){_0x4fef74=util[_0x4654('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4d0fc8,module[_0x4654('0xc')]['version'],oldToken);}var _0x5d6369={'uri':_0x4fef74,'method':_0x4654('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5d6369)[_0x4654('0xe')](function(_0x69352e){_0x51591d(_0x69352e);})[_0x4654('0xf')](function(_0xba6ec1){_0x54656f(_0xba6ec1);});});}function manageLicense(_0x33a19b,_0x4263e1){var _0x837341=_0x4263e1[_0x4654('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x837341[_0x4654('0x11')]!==_0x33a19b&&!_0x837341[_0x4654('0x12')]){oldToken=_0x837341[_0x4654('0x11')];}httpRequest(_0x33a19b)[_0x4654('0xe')](function(_0x2ffb7c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2ffb7c[_0x4654('0x13')]){isOldTokenSent=![];if(!_0x837341['license']&&_0x837341[_0x4654('0x8')]!=_0x2ffb7c[_0x4654('0x8')]||_0x837341[_0x4654('0x8')]&&_0x837341[_0x4654('0x12')]){logger[_0x4654('0x14')](_0x4654('0x15'));}if(_0x837341[_0x4654('0x8')]&&!_0x837341[_0x4654('0x12')]&&_0x837341[_0x4654('0x8')]!=_0x2ffb7c['license']){logger[_0x4654('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x837341[_0x4654('0x8')]&&!_0x837341[_0x4654('0x12')]&&_0x837341[_0x4654('0x8')]==_0x2ffb7c[_0x4654('0x8')]){return _0x4263e1;}return _0x4263e1['update']({'data1':_0x33a19b,'data2':null,'license':_0x2ffb7c['license']});}else{if(_0x2ffb7c[_0x4654('0x8')]||_0x837341[_0x4654('0x8')]){if(!_0x837341[_0x4654('0x12')]){if(_0x837341['data1']==_0x33a19b){GRAY_PERIOD_REASON=_0x4654('0x16');logger[_0x4654('0x14')](_0x4654('0x17'));}else{GRAY_PERIOD_REASON=_0x4654('0x18');logger['info'](_0x4654('0x19'),_0x837341[_0x4654('0x11')],_0x33a19b);}logger['info'](_0x4654('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x4654('0x1b')));return _0x4263e1[_0x4654('0x1c')]({'data2':encryptor[_0x4654('0x1d')](moment()[_0x4654('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x4654('0x1e')](encryptor['decryptString'](_0x837341[_0x4654('0x12')]),_0x4654('0x1f'))>DAYS){logger[_0x4654('0x14')](_0x4654('0x20'),moment()[_0x4654('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4263e1['update']({'data1':_0x33a19b,'data2':null,'license':null});}}}else{if(_0x837341[_0x4654('0x11')]!=_0x33a19b){logger[_0x4654('0x14')](_0x4654('0x19'),_0x837341[_0x4654('0x11')],_0x33a19b);return _0x4263e1['update']({'data1':_0x33a19b,'data2':null,'license':null});}}}return _0x4263e1;})[_0x4654('0xe')](function(_0x59a69c){_0x4263e1=_0x59a69c;})[_0x4654('0xf')](function(_0xf42dd7){logger[_0x4654('0x21')](_0xf42dd7['message']);})[_0x4654('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x4654('0x23')](),_0x4263e1);},TIME);});}function defaultLicense(){var _0x1d8a11=hardware[_0x4654('0x23')]();if(_0x1d8a11){return db[_0x4654('0x24')][_0x4654('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x1d8a11}})[_0x4654('0x26')](function(_0x34f790,_0x39b2c8){logger[_0x4654('0x14')](_0x4654('0x27'),_0x1d8a11);manageLicense(_0x1d8a11,_0x34f790);})[_0x4654('0xf')](function(_0x486c4b){logger[_0x4654('0x21')](_0x486c4b[_0x4654('0x28')]);});}}exports[_0x4654('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e9031c2..b8439f8 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 _0xa775=['message','User','role','sequelize','COUNT','col','admin','telephone','users','telephones','forEach','user','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','days','grayReason','changed','disabled'];(function(_0x54981c,_0x4db7ba){var _0x375431=function(_0x23e93e){while(--_0x23e93e){_0x54981c['push'](_0x54981c['shift']());}};_0x375431(++_0x4db7ba);}(_0xa775,0x75));var _0x5a77=function(_0x17a10a,_0xe9cca0){_0x17a10a=_0x17a10a-0x0;var _0x7ae749=_0xa775[_0x17a10a];return _0x7ae749;};'use strict';var util=require(_0x5a77('0x0'));var _=require(_0x5a77('0x1'));var moment=require(_0x5a77('0x2'));var BPromise=require(_0x5a77('0x3'));var hardware=require(_0x5a77('0x4'));var encryptor=require(_0x5a77('0x5'));var db=require(_0x5a77('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5a77('0x7'),'machineUuid':hardware[_0x5a77('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5a77('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5a77('0xa'),'machineUuid':hardware[_0x5a77('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x421893){return new BPromise(function(_0x2c208e,_0x50c0b4){return db[_0x5a77('0xb')][_0x5a77('0xc')](_[_0x5a77('0xd')](_0x421893,{'raw':!![],'where':{'id':0x1}}))[_0x5a77('0xe')](function(_0x362ccb){return checkLicense(_0x362ccb,null);})[_0x5a77('0xe')](function(_0x4b4f43){_0x2c208e(_0x4b4f43);return;})['catch'](function(_0x3af302){_0x50c0b4(_0x3af302);});});}function checkLicense(_0x459b7a,_0x3065c0){if(!_0x459b7a){demoLicense['uuid']=_0x459b7a[_0x5a77('0xf')];return demoLicense;}try{var _0x40fedf=_0x3065c0||_0x459b7a[_0x5a77('0x10')];if(_[_0x5a77('0x11')](_0x40fedf)){throw new Error(_0x5a77('0x12'));}var _0x106915=_0x459b7a['data1'];var _0xab4828=_0x459b7a[_0x5a77('0x13')];var _0x361a62=_0x106915['split']('-')[0x4];var _0x22554f=_0x106915['split']('-')[0x0];var _0x4f0f40=encryptor[_0x5a77('0x14')](_0x40fedf,util[_0x5a77('0x15')](_0x5a77('0x16'),_0x361a62,_0x106915,_0x22554f));var _0x45f56a=JSON[_0x5a77('0x17')](_0x4f0f40);_0x45f56a[_0x5a77('0x18')]=![];_0x45f56a[_0x5a77('0x19')]=_0x106915;_0x45f56a[_0x5a77('0x1a')]=hardware[_0x5a77('0x8')]();if(_0xab4828){var _0x1d64bd=encryptor[_0x5a77('0x14')](_0xab4828);_0x45f56a[_0x5a77('0x1b')]=_0x1d64bd;_0x45f56a[_0x5a77('0x1c')]=moment(_0x1d64bd)['add'](0x7,_0x5a77('0x1d'))[_0x5a77('0x15')]();_0x45f56a[_0x5a77('0x1e')]=_0x45f56a[_0x5a77('0x19')]!=_0x45f56a[_0x5a77('0x1a')]?_0x5a77('0x1f'):_0x5a77('0x20');}return _0x45f56a;}catch(_0xc85734){breakingLicense[_0x5a77('0x19')]=_0x459b7a['data1'];breakingLicense[_0x5a77('0x21')]=_0xc85734[_0x5a77('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x30ae9b,_0x3abad5){getLicense()[_0x5a77('0xe')](function(_0x4cbbc1){return db[_0x5a77('0x22')]['findAll']({'attributes':[_0x5a77('0x23'),[db[_0x5a77('0x24')]['fn'](_0x5a77('0x25'),db[_0x5a77('0x24')][_0x5a77('0x26')](_0x5a77('0x23'))),'count']],'group':_0x5a77('0x23'),'where':{'role':{'$or':[_0x5a77('0x27'),'user',_0x5a77('0x28')]}},'raw':!![]})[_0x5a77('0xe')](function(_0x52f6ae){var _0x19f5f6={'user':_0x4cbbc1[_0x5a77('0x29')]||0x0,'telephone':_0x4cbbc1[_0x5a77('0x2a')]||0x0};_0x52f6ae[_0x5a77('0x2b')](function(_0x1fea77){var _0xb69c1c=_0x1fea77[_0x5a77('0x23')]===_0x5a77('0x27')?_0x5a77('0x2c'):_0x1fea77[_0x5a77('0x23')];_0x19f5f6[_0xb69c1c]-=_0x1fea77['count'];if(_0x19f5f6[_0xb69c1c]<0x0)_0x19f5f6[_0xb69c1c]=0x0;});_0x30ae9b(_0x19f5f6);return;});})[_0x5a77('0x2d')](function(_0x2e98c2){_0x3abad5(_0x2e98c2);});});}function checkUserLimits(_0x6512ec){return new BPromise(function(_0x5073b2,_0x18e538){getLimits()['then'](function(_0x4325ea){var _0x1030ca=_[_0x5a77('0x2e')](_[_0x5a77('0x2f')](_0x6512ec,_0x5a77('0x23')),[_0x5a77('0x27'),'user','telephone']);var _0x49d691=(_0x1030ca['admin']||0x0)+(_0x1030ca[_0x5a77('0x2c')]||0x0);var _0x329b58=_0x1030ca[_0x5a77('0x28')]||0x0;if(_0x49d691>_0x4325ea[_0x5a77('0x2c')])return _0x18e538(_0x5a77('0x30'));if(_0x329b58>_0x4325ea[_0x5a77('0x28')])return _0x18e538('License\x20limit\x20reached\x20for\x20telephones');return _0x5073b2();})[_0x5a77('0x2d')](function(_0x32311f){_0x18e538(_0x32311f);});});}module[_0x5a77('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7c1c=['User','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','catch','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','format','disabled'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x7c1c,0xe0));var _0xc7c1=function(_0x38f5c0,_0x57b250){_0x38f5c0=_0x38f5c0-0x0;var _0x54f13a=_0x7c1c[_0x38f5c0];return _0x54f13a;};'use strict';var util=require(_0xc7c1('0x0'));var _=require(_0xc7c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc7c1('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc7c1('0x3'),'machineUuid':hardware[_0xc7c1('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc7c1('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc7c1('0x5'),'machineUuid':hardware[_0xc7c1('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x36bc05){return new BPromise(function(_0x4ed381,_0x464fb3){return db[_0xc7c1('0x6')][_0xc7c1('0x7')](_[_0xc7c1('0x8')](_0x36bc05,{'raw':!![],'where':{'id':0x1}}))[_0xc7c1('0x9')](function(_0x43168a){return checkLicense(_0x43168a,null);})['then'](function(_0x108fa6){_0x4ed381(_0x108fa6);return;})['catch'](function(_0x54485d){_0x464fb3(_0x54485d);});});}function checkLicense(_0x4057fc,_0x5cfce3){if(!_0x4057fc){demoLicense[_0xc7c1('0xa')]=_0x4057fc['data1'];return demoLicense;}try{var _0x2562a6=_0x5cfce3||_0x4057fc[_0xc7c1('0xb')];if(_[_0xc7c1('0xc')](_0x2562a6)){throw new Error(_0xc7c1('0xd'));}var _0x41c22d=_0x4057fc[_0xc7c1('0xe')];var _0x2e23a5=_0x4057fc[_0xc7c1('0xf')];var _0x253bb2=_0x41c22d[_0xc7c1('0x10')]('-')[0x4];var _0x56f6d9=_0x41c22d[_0xc7c1('0x10')]('-')[0x0];var _0x35a015=encryptor[_0xc7c1('0x11')](_0x2562a6,util['format'](_0xc7c1('0x12'),_0x253bb2,_0x41c22d,_0x56f6d9));var _0x121a95=JSON[_0xc7c1('0x13')](_0x35a015);_0x121a95[_0xc7c1('0x14')]=![];_0x121a95['uuid']=_0x41c22d;_0x121a95[_0xc7c1('0x15')]=hardware[_0xc7c1('0x4')]();if(_0x2e23a5){var _0x3c79b5=encryptor['decryptString'](_0x2e23a5);_0x121a95[_0xc7c1('0x16')]=_0x3c79b5;_0x121a95[_0xc7c1('0x17')]=moment(_0x3c79b5)[_0xc7c1('0x18')](0x7,_0xc7c1('0x19'))[_0xc7c1('0x1a')]();_0x121a95['grayReason']=_0x121a95[_0xc7c1('0xa')]!=_0x121a95[_0xc7c1('0x15')]?'changed':_0xc7c1('0x1b');}return _0x121a95;}catch(_0x313e43){breakingLicense[_0xc7c1('0xa')]=_0x4057fc[_0xc7c1('0xe')];breakingLicense['message']=_0x313e43['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4b2f8e,_0xc5e97c){getLicense()[_0xc7c1('0x9')](function(_0x429ab6){return db[_0xc7c1('0x1c')][_0xc7c1('0x1d')]({'attributes':[_0xc7c1('0x1e'),[db[_0xc7c1('0x1f')]['fn']('COUNT',db[_0xc7c1('0x1f')][_0xc7c1('0x20')]('role')),_0xc7c1('0x21')]],'group':_0xc7c1('0x1e'),'where':{'role':{'$or':[_0xc7c1('0x22'),_0xc7c1('0x23'),_0xc7c1('0x24')]}},'raw':!![]})[_0xc7c1('0x9')](function(_0x3df308){var _0x528ca3={'user':_0x429ab6[_0xc7c1('0x25')]||0x0,'telephone':_0x429ab6[_0xc7c1('0x26')]||0x0};_0x3df308['forEach'](function(_0x128d3b){var _0x52dc78=_0x128d3b[_0xc7c1('0x1e')]===_0xc7c1('0x22')?_0xc7c1('0x23'):_0x128d3b[_0xc7c1('0x1e')];_0x528ca3[_0x52dc78]-=_0x128d3b[_0xc7c1('0x21')];if(_0x528ca3[_0x52dc78]<0x0)_0x528ca3[_0x52dc78]=0x0;});_0x4b2f8e(_0x528ca3);return;});})[_0xc7c1('0x27')](function(_0x441fb5){_0xc5e97c(_0x441fb5);});});}function checkUserLimits(_0xf54a91){return new BPromise(function(_0x25b3ed,_0x13b2e6){getLimits()[_0xc7c1('0x9')](function(_0x4182d0){var _0x352d0f=_['pick'](_[_0xc7c1('0x28')](_0xf54a91,_0xc7c1('0x1e')),[_0xc7c1('0x22'),_0xc7c1('0x23'),_0xc7c1('0x24')]);var _0x715dcc=(_0x352d0f[_0xc7c1('0x22')]||0x0)+(_0x352d0f[_0xc7c1('0x23')]||0x0);var _0x2a85d5=_0x352d0f['telephone']||0x0;if(_0x715dcc>_0x4182d0[_0xc7c1('0x23')])return _0x13b2e6('License\x20limit\x20reached\x20for\x20users');if(_0x2a85d5>_0x4182d0['telephone'])return _0x13b2e6(_0xc7c1('0x29'));return _0x25b3ed();})[_0xc7c1('0x27')](function(_0x4f99cd){_0x13b2e6(_0x4f99cd);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 1b87414..7a92ef6 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 _0xea28=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x17b536,_0x24ed23){var _0x15cde1=function(_0x13fb3d){while(--_0x13fb3d){_0x17b536['push'](_0x17b536['shift']());}};_0x15cde1(++_0x24ed23);}(_0xea28,0x13a));var _0x8ea2=function(_0x574ac9,_0x5ec97f){_0x574ac9=_0x574ac9-0x0;var _0x2e5b7e=_0xea28[_0x574ac9];return _0x2e5b7e;};'use strict';module[_0x8ea2('0x0')]={'DOMAIN':_0x8ea2('0x1'),'SESSION_SECRET':_0x8ea2('0x2'),'GOOGLE_ID':_0x8ea2('0x3'),'GOOGLE_SECRET':_0x8ea2('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x6a95=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x5796d3,_0x447d4f){var _0xd39a15=function(_0x5316e6){while(--_0x5316e6){_0x5796d3['push'](_0x5796d3['shift']());}};_0xd39a15(++_0x447d4f);}(_0x6a95,0x1db));var _0x56a9=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x6a95[_0x46aff0];return _0x9d78cf;};'use strict';module[_0x56a9('0x0')]={'DOMAIN':_0x56a9('0x1'),'SESSION_SECRET':_0x56a9('0x2'),'GOOGLE_ID':_0x56a9('0x3'),'GOOGLE_SECRET':_0x56a9('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8459deb..5cdecca 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c34=['../utils/loggers','fileLogger','exports'];(function(_0x46352f,_0xdf0ce1){var _0x3721eb=function(_0xe08c29){while(--_0xe08c29){_0x46352f['push'](_0x46352f['shift']());}};_0x3721eb(++_0xdf0ce1);}(_0x5c34,0xc9));var _0x45c3=function(_0x1b1d10,_0x44c691){_0x1b1d10=_0x1b1d10-0x0;var _0x1eeb91=_0x5c34[_0x1b1d10];return _0x1eeb91;};'use strict';var fileLogger=require(_0x45c3('0x0'))[_0x45c3('0x1')];module[_0x45c3('0x2')]=fileLogger; \ No newline at end of file +var _0x9bfd=['exports','../utils/loggers'];(function(_0x5b0c1a,_0x55e748){var _0x1ddeb4=function(_0x1d232e){while(--_0x1d232e){_0x5b0c1a['push'](_0x5b0c1a['shift']());}};_0x1ddeb4(++_0x55e748);}(_0x9bfd,0xcd));var _0xd9bf=function(_0x4fddef,_0x432fc3){_0x4fddef=_0x4fddef-0x0;var _0xb4155e=_0x9bfd[_0x4fddef];return _0xb4155e;};'use strict';var fileLogger=require(_0xd9bf('0x0'))['fileLogger'];module[_0xd9bf('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2e3e4b5..5c20692 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 _0xca13=['../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','ami','../../services/ami/index.js','agi'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca13,0xa3));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x3ca1('0x0'));var os=require('os');var config={'apps':[{'name':_0x3ca1('0x1'),'script':path[_0x3ca1('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x3ca1('0x3'),'script':path['join'](__dirname,_0x3ca1('0x4'))},{'name':_0x3ca1('0x5'),'script':path[_0x3ca1('0x2')](__dirname,_0x3ca1('0x6'))},{'name':_0x3ca1('0x7'),'script':path[_0x3ca1('0x2')](__dirname,_0x3ca1('0x8'))},{'name':'routing','script':path[_0x3ca1('0x2')](__dirname,_0x3ca1('0x9'))},{'name':_0x3ca1('0xa'),'script':path[_0x3ca1('0x2')](__dirname,_0x3ca1('0xb'))}]};module[_0x3ca1('0xc')]=config; \ No newline at end of file +var _0xa220=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x2b7ce2,_0xc6ee25){var _0x1f9a02=function(_0x361be1){while(--_0x361be1){_0x2b7ce2['push'](_0x2b7ce2['shift']());}};_0x1f9a02(++_0xc6ee25);}(_0xa220,0x1c0));var _0x0a22=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa220[_0x42cae2];return _0x5f256f;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x0a22('0x0'),'script':path[_0x0a22('0x1')](__dirname,_0x0a22('0x2'))},{'name':_0x0a22('0x3'),'script':path['join'](__dirname,_0x0a22('0x4'))},{'name':_0x0a22('0x5'),'script':path[_0x0a22('0x1')](__dirname,_0x0a22('0x6'))},{'name':_0x0a22('0x7'),'script':path[_0x0a22('0x1')](__dirname,_0x0a22('0x8'))},{'name':_0x0a22('0x9'),'script':path[_0x0a22('0x1')](__dirname,_0x0a22('0xa'))},{'name':_0x0a22('0xb'),'script':path[_0x0a22('0x1')](__dirname,_0x0a22('0xc'))}]};module[_0x0a22('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 64f57ac..88da5ac 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 _0x74f0=['list','describe','delete','dump','saved','pm2','bluebird','./config','connect','start','then','stop','restart','disconnect'];(function(_0x1d60e2,_0x4205fb){var _0x2a995f=function(_0x1a66b9){while(--_0x1a66b9){_0x1d60e2['push'](_0x1d60e2['shift']());}};_0x2a995f(++_0x4205fb);}(_0x74f0,0x19b));var _0x074f=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0x74f0[_0x509dad];return _0x21e122;};'use strict';var pm2=require(_0x074f('0x0'));var BPromise=require(_0x074f('0x1'));var config=require(_0x074f('0x2'));function connect(){return new BPromise(function(_0x4a9da0,_0x216a94){return pm2[_0x074f('0x3')](function(_0x2ee8c9){if(_0x2ee8c9){return _0x216a94(_0x2ee8c9);}return _0x4a9da0('connected');});});};exports[_0x074f('0x4')]=function(_0x1fbce7){return connect()[_0x074f('0x5')](function(){return new BPromise(function(_0x58e9eb,_0x165a8d){return pm2['start'](_0x1fbce7,function(_0x4dfac5,_0x2c8edf){if(_0x4dfac5){return _0x165a8d(_0x4dfac5);}pm2['disconnect']();return _0x58e9eb(_0x2c8edf);});});});};exports['stop']=function(_0x48b90f){return connect()[_0x074f('0x5')](function(){return new BPromise(function(_0x59a79b,_0xde454c){return pm2[_0x074f('0x6')](_0x48b90f,function(_0x2fc99c,_0x9a7cc0){if(_0x2fc99c){return _0xde454c(_0x2fc99c);}pm2['disconnect']();return _0x59a79b(_0x9a7cc0);});});});};exports[_0x074f('0x7')]=function(_0x2092ce){return connect()['then'](function(){return new BPromise(function(_0x10345d,_0x1ba7e4){return pm2[_0x074f('0x7')](_0x2092ce,function(_0x48ba28,_0xff5217){if(_0x48ba28){return _0x1ba7e4(_0x48ba28);}pm2[_0x074f('0x8')]();return _0x10345d(_0xff5217);});});});};exports[_0x074f('0x9')]=function(){return connect()[_0x074f('0x5')](function(){return new BPromise(function(_0x4e9a03,_0x490471){return pm2['list'](function(_0x6f0000,_0x5e4423){if(_0x6f0000){return _0x490471(_0x6f0000);}pm2[_0x074f('0x8')]();return _0x4e9a03(_0x5e4423);});});});};exports[_0x074f('0xa')]=function(_0x37862a){return connect()[_0x074f('0x5')](function(){return new BPromise(function(_0x521561,_0x54a381){return pm2[_0x074f('0xa')](_0x37862a,function(_0x2fbece,_0x1f0cdc){if(_0x2fbece){return _0x54a381(_0x2fbece);}pm2[_0x074f('0x8')]();return _0x521561(_0x1f0cdc);});});});};exports[_0x074f('0xb')]=function(_0x1f95dd){return connect()[_0x074f('0x5')](function(){return new BPromise(function(_0x12c738,_0x470c5d){return pm2[_0x074f('0xb')](_0x1f95dd,function(_0x438d51,_0x3b56f2){if(_0x438d51){return _0x470c5d(_0x438d51);}pm2[_0x074f('0x8')]();return _0x12c738(_0x3b56f2);});});});};exports[_0x074f('0xc')]=function(){return connect()[_0x074f('0x5')](function(){return new BPromise(function(_0x33f5df,_0x489af6){return pm2[_0x074f('0xc')](function(_0x4e9d68){if(_0x4e9d68){return _0x489af6(_0x4e9d68);}return _0x33f5df(_0x074f('0xd'));});});});}; \ No newline at end of file +var _0xfc39=['start','then','stop','restart','list','disconnect','describe','delete','dump','saved','pm2','bluebird','connect','connected'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0xfc39,0xdc));var _0x9fc3=function(_0x57bb54,_0x5a2e65){_0x57bb54=_0x57bb54-0x0;var _0x5bb1f5=_0xfc39[_0x57bb54];return _0x5bb1f5;};'use strict';var pm2=require(_0x9fc3('0x0'));var BPromise=require(_0x9fc3('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x16a927,_0x1fb136){return pm2[_0x9fc3('0x2')](function(_0x5645e4){if(_0x5645e4){return _0x1fb136(_0x5645e4);}return _0x16a927(_0x9fc3('0x3'));});});};exports[_0x9fc3('0x4')]=function(_0x13901f){return connect()[_0x9fc3('0x5')](function(){return new BPromise(function(_0x211c6c,_0x5f05b5){return pm2['start'](_0x13901f,function(_0x5c7407,_0x634690){if(_0x5c7407){return _0x5f05b5(_0x5c7407);}pm2['disconnect']();return _0x211c6c(_0x634690);});});});};exports[_0x9fc3('0x6')]=function(_0x133c57){return connect()[_0x9fc3('0x5')](function(){return new BPromise(function(_0x415cd6,_0x4910e5){return pm2['stop'](_0x133c57,function(_0xfcf8cb,_0x473211){if(_0xfcf8cb){return _0x4910e5(_0xfcf8cb);}pm2['disconnect']();return _0x415cd6(_0x473211);});});});};exports[_0x9fc3('0x7')]=function(_0x522d84){return connect()[_0x9fc3('0x5')](function(){return new BPromise(function(_0x8d58b6,_0x3a9194){return pm2['restart'](_0x522d84,function(_0x444ff9,_0xecf7c){if(_0x444ff9){return _0x3a9194(_0x444ff9);}pm2['disconnect']();return _0x8d58b6(_0xecf7c);});});});};exports[_0x9fc3('0x8')]=function(){return connect()[_0x9fc3('0x5')](function(){return new BPromise(function(_0xafa0ae,_0x323d57){return pm2[_0x9fc3('0x8')](function(_0x986dd6,_0x3565ec){if(_0x986dd6){return _0x323d57(_0x986dd6);}pm2[_0x9fc3('0x9')]();return _0xafa0ae(_0x3565ec);});});});};exports[_0x9fc3('0xa')]=function(_0x5efd66){return connect()[_0x9fc3('0x5')](function(){return new BPromise(function(_0x4b6ebf,_0x2d1135){return pm2['describe'](_0x5efd66,function(_0xa93573,_0x5f4e73){if(_0xa93573){return _0x2d1135(_0xa93573);}pm2[_0x9fc3('0x9')]();return _0x4b6ebf(_0x5f4e73);});});});};exports[_0x9fc3('0xb')]=function(_0x49f03c){return connect()[_0x9fc3('0x5')](function(){return new BPromise(function(_0x2b40c5,_0x35fb2e){return pm2[_0x9fc3('0xb')](_0x49f03c,function(_0x5b2f4d,_0x20d02a){if(_0x5b2f4d){return _0x35fb2e(_0x5b2f4d);}pm2['disconnect']();return _0x2b40c5(_0x20d02a);});});});};exports[_0x9fc3('0xc')]=function(){return connect()[_0x9fc3('0x5')](function(){return new BPromise(function(_0x3a0517,_0x24a106){return pm2[_0x9fc3('0xc')](function(_0x26fbfa){if(_0x26fbfa){return _0x24a106(_0x26fbfa);}return _0x3a0517(_0x9fc3('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index eaa2412..663517b 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 _0x39b2=['YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','subtract','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x39b2,0x9e));var _0x239b=function(_0x422ef6,_0x299f86){_0x422ef6=_0x422ef6-0x0;var _0x298b59=_0x39b2[_0x422ef6];return _0x298b59;};'use strict';var _=require('lodash');var moment=require(_0x239b('0x0'));var Redis=require('ioredis');var util=require(_0x239b('0x1'));var config=require(_0x239b('0x2'));var db=require(_0x239b('0x3'))['db'];var logger=require(_0x239b('0x4'))(_0x239b('0x5'));config[_0x239b('0x6')]=_['defaults'](config[_0x239b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x239b('0x7'))(new Redis(config[_0x239b('0x6')]));function closeInteractions(){var _0x427a5b=0x0;var _0x3c6da9=[];return db[_0x239b('0x8')][_0x239b('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x239b('0xa')](function(_0x24d834){_0x427a5b=_0x24d834[_0x239b('0xb')];if(_0x427a5b){return db[_0x239b('0xc')][_0x239b('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x239b('0xe')](_0x24d834[_0x239b('0xb')],'minutes')}}});}else{return[];}})[_0x239b('0xa')](function(_0x14038a){if(_0x14038a&&_0x14038a['length']){_0x3c6da9=_[_0x239b('0xf')](_0x14038a||[],'id');logger[_0x239b('0x10')](_0x239b('0x11'),_0x3c6da9[_0x239b('0x12')]());return db[_0x239b('0xc')][_0x239b('0x13')]({'closeReason':'system','disposition':_0x239b('0x14'),'closed':!![],'closedAt':moment()[_0x239b('0x15')](_0x239b('0x16'))},{'where':{'id':_0x3c6da9}});}})['then'](function(){if(_0x3c6da9&&_0x3c6da9[_0x239b('0x17')]){logger[_0x239b('0x10')](_0x239b('0x18'),_0x3c6da9[_0x239b('0x12')]());for(var _0x4efd88=0x0;_0x4efd88<_0x3c6da9[_0x239b('0x17')];_0x4efd88++){io['emit'](_0x239b('0x19'),{'id':_0x3c6da9[_0x4efd88],'closed':!![]});}}})[_0x239b('0x1a')](function(_0x13f5b8){logger[_0x239b('0x1b')](_0x239b('0x1c'),_0x13f5b8?util[_0x239b('0x1d')](_0x13f5b8,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe042=['defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','findAll','subtract','minutes','length','map','info','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis'];(function(_0x4f38ee,_0x12a279){var _0xe9478f=function(_0x356b19){while(--_0x356b19){_0x4f38ee['push'](_0x4f38ee['shift']());}};_0xe9478f(++_0x12a279);}(_0xe042,0x77));var _0x2e04=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xe042[_0x21cb7f];return _0x5a079a;};'use strict';var _=require(_0x2e04('0x0'));var moment=require(_0x2e04('0x1'));var Redis=require(_0x2e04('0x2'));var util=require(_0x2e04('0x3'));var config=require(_0x2e04('0x4'));var db=require(_0x2e04('0x5'))['db'];var logger=require(_0x2e04('0x6'))(_0x2e04('0x7'));config[_0x2e04('0x8')]=_[_0x2e04('0x9')](config['redis'],{'host':_0x2e04('0xa'),'port':0x18eb});var io=require(_0x2e04('0xb'))(new Redis(config[_0x2e04('0x8')]));function closeInteractions(){var _0x77aeb8=0x0;var _0x129aa5=[];return db[_0x2e04('0xc')]['find']({'raw':!![],'attributes':['id',_0x2e04('0xd')],'where':{'id':0x1}})[_0x2e04('0xe')](function(_0x3908af){_0x77aeb8=_0x3908af['chatTimeout'];if(_0x77aeb8){return db['ChatInteraction'][_0x2e04('0xf')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2e04('0x10')](_0x3908af[_0x2e04('0xd')],_0x2e04('0x11'))}}});}else{return[];}})['then'](function(_0x398ee3){if(_0x398ee3&&_0x398ee3[_0x2e04('0x12')]){_0x129aa5=_[_0x2e04('0x13')](_0x398ee3||[],'id');logger[_0x2e04('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x129aa5['join']());return db[_0x2e04('0x15')][_0x2e04('0x16')]({'closeReason':_0x2e04('0x17'),'disposition':_0x2e04('0x18'),'closed':!![],'closedAt':moment()['format'](_0x2e04('0x19'))},{'where':{'id':_0x129aa5}});}})[_0x2e04('0xe')](function(){if(_0x129aa5&&_0x129aa5[_0x2e04('0x12')]){logger['info'](_0x2e04('0x1a'),_0x129aa5['join']());for(var _0xeb0f64=0x0;_0xeb0f64<_0x129aa5['length'];_0xeb0f64++){io['emit'](_0x2e04('0x1b'),{'id':_0x129aa5[_0xeb0f64],'closed':!![]});}}})[_0x2e04('0x1c')](function(_0x37452b){logger['error'](_0x2e04('0x1d'),_0x37452b?util[_0x2e04('0x1e')](_0x37452b,{'showHidden':![],'depth':null}):'');});}exports[_0x2e04('0x1f')]=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 d11451d..ea3769d 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 _0x1000=['exports'];(function(_0x16c490,_0xc0fe83){var _0x26073c=function(_0x25ba45){while(--_0x25ba45){_0x16c490['push'](_0x16c490['shift']());}};_0x26073c(++_0xc0fe83);}(_0x1000,0x7e));var _0x0100=function(_0x27c248,_0x384dff){_0x27c248=_0x27c248-0x0;var _0x1b2fc2=_0x1000[_0x27c248];return _0x1b2fc2;};'use strict';function start(){var _0x11f8f3=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x11f8f3['startAllRefreshIntervals']();}module[_0x0100('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xfeed=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0xfeed,0xca));var _0xdfee=function(_0x71c52e,_0x4d2a03){_0x71c52e=_0x71c52e-0x0;var _0xeb0d77=_0xfeed[_0x71c52e];return _0xeb0d77;};'use strict';function start(){var _0x59af18=require(_0xdfee('0x0'));return _0x59af18['startAllRefreshIntervals']();}module[_0xdfee('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 9f8a74c..13b43f5 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 _0x4062=['../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','getSmtpOptions','name','MailAccount','email','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','savename','%s.%s','extname','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','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','error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','exists','stop','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','active','isBetween','update','update\x20cron','run','path','moment','jayson/promise','../logger','../../mysqldb'];(function(_0x145454,_0x153353){var _0x369e53=function(_0x3425ce){while(--_0x3425ce){_0x145454['push'](_0x145454['shift']());}};_0x369e53(++_0x153353);}(_0x4062,0x1ae));var _0x2406=function(_0x44a0df,_0xbbd71e){_0x44a0df=_0x44a0df-0x0;var _0xb5ee1f=_0x4062[_0x44a0df];return _0xb5ee1f;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x2406('0x0'));var _=require('lodash');var moment=require(_0x2406('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x2406('0x2'));var BPromise=require('bluebird');var logger=require(_0x2406('0x3'))('schedule');var db=require(_0x2406('0x4'))['db'];var analyticCustomReportController=require(_0x2406('0x5'));var analyticDefaultReportController=require(_0x2406('0x6'));var client=jayson[_0x2406('0x7')][_0x2406('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x33fc20,_0x4ca360){return function(){logger[_0x2406('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x33fc20['email']);var _0x2bfda8=!![];var _0x1f93d8=_0x33fc20['MailAccount'][_0x2406('0xa')]();var _0x18cafb={'account':_0x1f93d8,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x33fc20['MailAccount'][_0x2406('0xb')],_0x33fc20[_0x2406('0xc')][_0x2406('0xd')]||_0x33fc20[_0x2406('0xc')][_0x2406('0xe')][_0x2406('0xf')]),'to':_0x33fc20[_0x2406('0xd')],'cc':_0x33fc20['cc'],'bcc':_0x33fc20[_0x2406('0x10')],'subject':util[_0x2406('0x11')](_0x2406('0x12'),_0x4ca360[_0x2406('0xb')],_0x33fc20['subtractNumber'],_0x33fc20[_0x2406('0x13')])}};var _0xed0d53=path[_0x2406('0x14')](__dirname,'../../files/reports');var _0x67a713=_0x4ca360[_0x2406('0x15')];var _0x7d3691=util[_0x2406('0x11')](_0x2406('0x16'),path['basename'](_0x4ca360['savename'],path[_0x2406('0x17')](_0x4ca360[_0x2406('0x15')])),'zip');var _0x4d01c3=path[_0x2406('0x14')](_0xed0d53,_0x67a713);var _0x5ae15c=path['join'](_0xed0d53,_0x7d3691);if(fs[_0x2406('0x18')](_0x4d01c3)){_0x4ca360[_0x2406('0x19')]='Sent';_0x18cafb[_0x2406('0x1a')][_0x2406('0x1b')]=[{'filename':_0x67a713,'path':_0x4d01c3}];_0x18cafb['message'][_0x2406('0x1c')]=util['format'](_0x2406('0x1d'),JSON['stringify'](_0x4ca360,null,0x2));}else if(fs[_0x2406('0x18')](_0x5ae15c)){_0x4ca360[_0x2406('0x19')]=_0x2406('0x1e');_0x18cafb[_0x2406('0x1a')][_0x2406('0x1b')]=[{'filename':_0x7d3691,'path':_0x5ae15c}];}else{_0x18cafb['message']['text']=_0x2406('0x1f');if(!_0x33fc20[_0x2406('0x20')]){_0x2bfda8=![];logger[_0x2406('0x9')](_0x2406('0x21'));}}if(_0x2bfda8){return client[_0x2406('0x22')](_0x2406('0x23'),_0x18cafb)['then'](function(_0x3eea06){if(_0x3eea06[_0x2406('0x24')]){return logger[_0x2406('0x24')](_0x2406('0x25'),JSON[_0x2406('0x26')](_0x3eea06));}return logger[_0x2406('0x9')](_0x2406('0x27'));})[_0x2406('0x28')](function(_0x38c169){return logger[_0x2406('0x24')]('error\x20mail',JSON[_0x2406('0x26')](_0x38c169));});}};}function handleError(){return function(_0xdb9dda){return logger[_0x2406('0x24')](JSON[_0x2406('0x26')](_0xdb9dda));};}function handleResult(_0x3e5d7e){return function(_0xf393bc){logger[_0x2406('0x9')](_0x2406('0x29'),JSON['stringify'](_0xf393bc));if(_0x3e5d7e['MailAccount']&&_0x3e5d7e[_0x2406('0xc')][_0x2406('0xe')]&&!_[_0x2406('0x2a')](_0x3e5d7e[_0x2406('0xd')])){setTimeout(handleSendEmail(_0x3e5d7e,_0xf393bc),0x3c*0x3e8);}};}function handleJob(_0x2c6a5d){return function(){try{if(_[_0x2406('0x2a')](_0x2c6a5d[_0x2406('0x2b')])){return logger[_0x2406('0x9')](_0x2406('0x2c'));}if(_[_0x2406('0x2a')](_0x2c6a5d['subtractUnit'])){return logger[_0x2406('0x9')](_0x2406('0x2d'));}var _0x594a3b={'startDate':moment()[_0x2406('0x2e')](_0x2c6a5d[_0x2406('0x2b')],_0x2c6a5d[_0x2406('0x13')])[_0x2406('0x11')](_0x2406('0x2f')),'endDate':moment()[_0x2406('0x11')](_0x2406('0x2f')),'type':_0x2406('0x30'),'output':_0x2c6a5d['output'],'name':_0x2c6a5d['name']};if(!_[_0x2406('0x2a')](_0x2c6a5d['DefaultReportId'])){logger[_0x2406('0x9')](_0x2406('0x31'),_0x2c6a5d[_0x2406('0x32')]);return analyticDefaultReportController[_0x2406('0x33')]({'id':_0x2c6a5d[_0x2406('0x32')]},_0x594a3b)[_0x2406('0x34')](handleResult(_0x2c6a5d))['catch'](handleError());}if(!_[_0x2406('0x2a')](_0x2c6a5d[_0x2406('0x35')])){logger[_0x2406('0x9')](_0x2406('0x36'),_0x2c6a5d[_0x2406('0x35')]);return analyticCustomReportController['runReport']({'id':_0x2c6a5d[_0x2406('0x35')]},_0x594a3b)[_0x2406('0x34')](handleResult(_0x2c6a5d))['catch'](handleError());}}catch(_0x511ef6){logger['error'](JSON[_0x2406('0x26')](_0x511ef6));}return logger['info'](_0x2406('0x37'));};}function getJobs(_0x3c8c90){var _0x2596d1={};if(_0x3c8c90){_0x2596d1['id']=_0x3c8c90;}return db[_0x2406('0x38')][_0x2406('0x39')]({'where':_0x2596d1,'include':[{'model':db[_0x2406('0xc')],'attributes':['id',_0x2406('0xb'),'email'],'include':[{'model':db[_0x2406('0x3a')],'as':_0x2406('0xe'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})[_0x2406('0x34')](function(_0x5335f3){var _0x4fb652=_['keys'](manager[_0x2406('0x3b')]);var _0x461bac=_[_0x2406('0x3c')](_0x5335f3,function(_0x6e9eef){return _0x6e9eef['id'][_0x2406('0x3d')]();});var _0x317481=_[_0x2406('0x3e')](_0x5335f3,function(_0x1cd8ee){return _0x1cd8ee['id'][_0x2406('0x3d')]();});var _0x162129=_0x3c8c90?_0x461bac:_[_0x2406('0x3f')](_0x461bac,_0x4fb652);var _0x132b2c=_[_0x2406('0x40')](_0x461bac,_0x4fb652);var _0x2b53b4=_[_0x2406('0x3f')](_0x4fb652,_0x461bac);var _0x39aacf;var _0x84687a;for(_0x39aacf=0x0;_0x39aacf<_0x2b53b4['length']&&!_0x3c8c90;_0x39aacf+=0x1){_0x84687a=_0x2b53b4[_0x39aacf]['toString']();if(manager[_0x2406('0x41')](_0x84687a)){manager[_0x2406('0x42')](_0x84687a);manager['deleteJob'](_0x84687a);logger[_0x2406('0x9')](_0x2406('0x43'),_0x84687a);}}logger[_0x2406('0x9')](_0x2406('0x44'),JSON[_0x2406('0x26')](_0x162129));for(_0x39aacf=0x0;_0x39aacf<_0x162129[_0x2406('0x45')];_0x39aacf+=0x1){_0x84687a=_0x162129[_0x39aacf][_0x2406('0x3d')]();logger[_0x2406('0x9')](_0x2406('0x46'),_0x84687a);if(_0x3c8c90){logger[_0x2406('0x9')](_0x2406('0x47'),_0x3c8c90);logger[_0x2406('0x9')](JSON[_0x2406('0x26')](_0x317481[_0x84687a]));BPromise[_0x2406('0x48')]()[_0x2406('0x34')](handleJob(_0x317481[_0x84687a]));logger[_0x2406('0x9')](_0x2406('0x49'),_0x317481[_0x84687a]['name'],_0x317481[_0x84687a][_0x2406('0x4a')]);}else if(_0x317481[_0x84687a][_0x2406('0x4a')]&&_0x317481[_0x84687a]['active']&&moment()['isBetween'](_0x317481[_0x84687a][_0x2406('0x4b')],_0x317481[_0x84687a][_0x2406('0x4c')])){manager[_0x2406('0x4d')](_0x84687a,_0x317481[_0x84687a]['cron'],handleJob(_0x317481[_0x84687a]));manager[_0x2406('0x4e')](_0x84687a);logger[_0x2406('0x9')](_0x2406('0x4f'),_0x317481[_0x84687a][_0x2406('0xb')],_0x317481[_0x84687a][_0x2406('0x4a')]);}else if(manager['exists'](_0x84687a)){manager[_0x2406('0x42')](_0x84687a);manager[_0x2406('0x50')](_0x84687a);logger[_0x2406('0x9')](_0x2406('0x51'),_0x317481[_0x84687a][_0x2406('0xb')],_0x317481[_0x84687a][_0x2406('0x4a')]);}}for(_0x39aacf=0x0,_0x84687a;_0x39aacf<_0x132b2c[_0x2406('0x45')]&&!_0x3c8c90;_0x39aacf+=0x1){_0x84687a=_0x132b2c[_0x39aacf]['toString']();if(manager[_0x2406('0x41')](_0x84687a)){if(_0x317481[_0x84687a][_0x2406('0x4a')]&&_0x317481[_0x84687a][_0x2406('0x52')]&&moment()[_0x2406('0x53')](_0x317481[_0x84687a][_0x2406('0x4b')],_0x317481[_0x84687a][_0x2406('0x4c')])){manager[_0x2406('0x54')](_0x84687a,_0x317481[_0x84687a][_0x2406('0x4a')],handleJob(_0x317481[_0x84687a]));logger[_0x2406('0x9')](_0x2406('0x55'),_0x317481[_0x84687a][_0x2406('0xb')],_0x317481[_0x84687a][_0x2406('0x4a')]);}else{manager[_0x2406('0x42')](_0x84687a);manager[_0x2406('0x50')](_0x84687a);logger['info']('stop\x20cron',_0x317481[_0x84687a][_0x2406('0xb')],_0x317481[_0x84687a][_0x2406('0x4a')]);}}}})[_0x2406('0x28')](function(_0x325b42){logger['error'](JSON[_0x2406('0x26')](_0x325b42));});}exports[_0x2406('0x56')]=function(_0x240c47){return getJobs(_0x240c47);};exports[_0x2406('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc7fd=['deleteJob','delete\x20cron','index','my\x20id','run\x20job','cron','isBetween','endAt','add','start','add\x20cron','exists','active','startAt','update\x20cron','run','path','lodash','moment','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','difference','length','stop'];(function(_0x47d333,_0x3a772f){var _0x477b6d=function(_0x2f2d91){while(--_0x2f2d91){_0x47d333['push'](_0x47d333['shift']());}};_0x477b6d(++_0x3a772f);}(_0xc7fd,0x1b9));var _0xdc7f=function(_0x52fc3e,_0x2990f5){_0x52fc3e=_0x52fc3e-0x0;var _0x263105=_0xc7fd[_0x52fc3e];return _0x263105;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xdc7f('0x0'));var _=require(_0xdc7f('0x1'));var moment=require(_0xdc7f('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xdc7f('0x3'));var BPromise=require(_0xdc7f('0x4'));var logger=require(_0xdc7f('0x5'))('schedule');var db=require(_0xdc7f('0x6'))['db'];var analyticCustomReportController=require(_0xdc7f('0x7'));var analyticDefaultReportController=require(_0xdc7f('0x8'));var client=jayson['client'][_0xdc7f('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xd3ffb2,_0x5d0688){return function(){logger[_0xdc7f('0xa')](_0xdc7f('0xb'),_0xd3ffb2[_0xdc7f('0xc')]);var _0x169308=!![];var _0x297b34=_0xd3ffb2[_0xdc7f('0xd')]['getSmtpOptions']();var _0x31b612={'account':_0x297b34,'message':{'from':util[_0xdc7f('0xe')]('\x22%s\x22\x20<%s>',_0xd3ffb2['MailAccount']['name'],_0xd3ffb2[_0xdc7f('0xd')]['email']||_0xd3ffb2[_0xdc7f('0xd')][_0xdc7f('0xf')][_0xdc7f('0x10')]),'to':_0xd3ffb2[_0xdc7f('0xc')],'cc':_0xd3ffb2['cc'],'bcc':_0xd3ffb2[_0xdc7f('0x11')],'subject':util[_0xdc7f('0xe')](_0xdc7f('0x12'),_0x5d0688[_0xdc7f('0x13')],_0xd3ffb2['subtractNumber'],_0xd3ffb2[_0xdc7f('0x14')])}};var _0x25c9e8=path['join'](__dirname,_0xdc7f('0x15'));var _0x8d9597=_0x5d0688[_0xdc7f('0x16')];var _0x35b306=util[_0xdc7f('0xe')](_0xdc7f('0x17'),path[_0xdc7f('0x18')](_0x5d0688[_0xdc7f('0x16')],path[_0xdc7f('0x19')](_0x5d0688[_0xdc7f('0x16')])),_0xdc7f('0x1a'));var _0x5b705d=path[_0xdc7f('0x1b')](_0x25c9e8,_0x8d9597);var _0x3ee55d=path[_0xdc7f('0x1b')](_0x25c9e8,_0x35b306);if(fs[_0xdc7f('0x1c')](_0x5b705d)){_0x5d0688[_0xdc7f('0x1d')]=_0xdc7f('0x1e');_0x31b612[_0xdc7f('0x1f')][_0xdc7f('0x20')]=[{'filename':_0x8d9597,'path':_0x5b705d}];_0x31b612[_0xdc7f('0x1f')][_0xdc7f('0x21')]=util[_0xdc7f('0xe')](_0xdc7f('0x22'),JSON[_0xdc7f('0x23')](_0x5d0688,null,0x2));}else if(fs[_0xdc7f('0x1c')](_0x3ee55d)){_0x5d0688['status']=_0xdc7f('0x1e');_0x31b612['message'][_0xdc7f('0x20')]=[{'filename':_0x35b306,'path':_0x3ee55d}];}else{_0x31b612[_0xdc7f('0x1f')][_0xdc7f('0x21')]=_0xdc7f('0x24');if(!_0xd3ffb2[_0xdc7f('0x25')]){_0x169308=![];logger[_0xdc7f('0xa')](_0xdc7f('0x26'));}}if(_0x169308){return client[_0xdc7f('0x27')]('SendMail',_0x31b612)[_0xdc7f('0x28')](function(_0x44d468){if(_0x44d468[_0xdc7f('0x29')]){return logger[_0xdc7f('0x29')]('error\x20mail',JSON['stringify'](_0x44d468));}return logger['info'](_0xdc7f('0x2a'));})[_0xdc7f('0x2b')](function(_0x388232){return logger[_0xdc7f('0x29')](_0xdc7f('0x2c'),JSON[_0xdc7f('0x23')](_0x388232));});}};}function handleError(){return function(_0x48579b){return logger[_0xdc7f('0x29')](JSON[_0xdc7f('0x23')](_0x48579b));};}function handleResult(_0x339475){return function(_0x42c472){logger[_0xdc7f('0xa')](_0xdc7f('0x2d'),JSON[_0xdc7f('0x23')](_0x42c472));if(_0x339475['MailAccount']&&_0x339475[_0xdc7f('0xd')][_0xdc7f('0xf')]&&!_[_0xdc7f('0x2e')](_0x339475[_0xdc7f('0xc')])){setTimeout(handleSendEmail(_0x339475,_0x42c472),0x3c*0x3e8);}};}function handleJob(_0x5a136a){return function(){try{if(_[_0xdc7f('0x2e')](_0x5a136a[_0xdc7f('0x2f')])){return logger[_0xdc7f('0xa')](_0xdc7f('0x30'));}if(_[_0xdc7f('0x2e')](_0x5a136a[_0xdc7f('0x14')])){return logger[_0xdc7f('0xa')](_0xdc7f('0x31'));}var _0x5e365e={'startDate':moment()[_0xdc7f('0x32')](_0x5a136a[_0xdc7f('0x2f')],_0x5a136a[_0xdc7f('0x14')])[_0xdc7f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xdc7f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xdc7f('0x33'),'output':_0x5a136a[_0xdc7f('0x34')],'name':_0x5a136a[_0xdc7f('0x13')]};if(!_[_0xdc7f('0x2e')](_0x5a136a['DefaultReportId'])){logger[_0xdc7f('0xa')](_0xdc7f('0x35'),_0x5a136a[_0xdc7f('0x36')]);return analyticDefaultReportController[_0xdc7f('0x37')]({'id':_0x5a136a[_0xdc7f('0x36')]},_0x5e365e)[_0xdc7f('0x28')](handleResult(_0x5a136a))[_0xdc7f('0x2b')](handleError());}if(!_[_0xdc7f('0x2e')](_0x5a136a[_0xdc7f('0x38')])){logger['info'](_0xdc7f('0x39'),_0x5a136a[_0xdc7f('0x38')]);return analyticCustomReportController[_0xdc7f('0x37')]({'id':_0x5a136a[_0xdc7f('0x38')]},_0x5e365e)[_0xdc7f('0x28')](handleResult(_0x5a136a))['catch'](handleError());}}catch(_0x5ad6f9){logger[_0xdc7f('0x29')](JSON[_0xdc7f('0x23')](_0x5ad6f9));}return logger[_0xdc7f('0xa')]('no\x20report\x20id');};}function getJobs(_0x46b014){var _0x2d6c60={};if(_0x46b014){_0x2d6c60['id']=_0x46b014;}return db[_0xdc7f('0x3a')][_0xdc7f('0x3b')]({'where':_0x2d6c60,'include':[{'model':db[_0xdc7f('0xd')],'attributes':['id',_0xdc7f('0x13'),_0xdc7f('0xc')],'include':[{'model':db[_0xdc7f('0x3c')],'as':_0xdc7f('0xf'),'include':[{'model':db[_0xdc7f('0x3d')],'as':_0xdc7f('0x3d')}]}]}]})[_0xdc7f('0x28')](function(_0x4aeed4){var _0x34c1b1=_[_0xdc7f('0x3e')](manager[_0xdc7f('0x3f')]);var _0x141b04=_['map'](_0x4aeed4,function(_0x210ec7){return _0x210ec7['id']['toString']();});var _0x396b25=_[_0xdc7f('0x40')](_0x4aeed4,function(_0x229a0a){return _0x229a0a['id'][_0xdc7f('0x41')]();});var _0x5d30ea=_0x46b014?_0x141b04:_[_0xdc7f('0x42')](_0x141b04,_0x34c1b1);var _0x3ed2c8=_['intersection'](_0x141b04,_0x34c1b1);var _0x229be4=_['difference'](_0x34c1b1,_0x141b04);var _0x14596f;var _0x1d1e5d;for(_0x14596f=0x0;_0x14596f<_0x229be4[_0xdc7f('0x43')]&&!_0x46b014;_0x14596f+=0x1){_0x1d1e5d=_0x229be4[_0x14596f][_0xdc7f('0x41')]();if(manager['exists'](_0x1d1e5d)){manager[_0xdc7f('0x44')](_0x1d1e5d);manager[_0xdc7f('0x45')](_0x1d1e5d);logger[_0xdc7f('0xa')](_0xdc7f('0x46'),_0x1d1e5d);}}logger[_0xdc7f('0xa')]('toRun',JSON[_0xdc7f('0x23')](_0x5d30ea));for(_0x14596f=0x0;_0x14596f<_0x5d30ea[_0xdc7f('0x43')];_0x14596f+=0x1){_0x1d1e5d=_0x5d30ea[_0x14596f][_0xdc7f('0x41')]();logger[_0xdc7f('0xa')](_0xdc7f('0x47'),_0x1d1e5d);if(_0x46b014){logger[_0xdc7f('0xa')](_0xdc7f('0x48'),_0x46b014);logger[_0xdc7f('0xa')](JSON[_0xdc7f('0x23')](_0x396b25[_0x1d1e5d]));BPromise['resolve']()['then'](handleJob(_0x396b25[_0x1d1e5d]));logger['info'](_0xdc7f('0x49'),_0x396b25[_0x1d1e5d][_0xdc7f('0x13')],_0x396b25[_0x1d1e5d][_0xdc7f('0x4a')]);}else if(_0x396b25[_0x1d1e5d][_0xdc7f('0x4a')]&&_0x396b25[_0x1d1e5d]['active']&&moment()[_0xdc7f('0x4b')](_0x396b25[_0x1d1e5d]['startAt'],_0x396b25[_0x1d1e5d][_0xdc7f('0x4c')])){manager[_0xdc7f('0x4d')](_0x1d1e5d,_0x396b25[_0x1d1e5d][_0xdc7f('0x4a')],handleJob(_0x396b25[_0x1d1e5d]));manager[_0xdc7f('0x4e')](_0x1d1e5d);logger[_0xdc7f('0xa')](_0xdc7f('0x4f'),_0x396b25[_0x1d1e5d]['name'],_0x396b25[_0x1d1e5d][_0xdc7f('0x4a')]);}else if(manager[_0xdc7f('0x50')](_0x1d1e5d)){manager[_0xdc7f('0x44')](_0x1d1e5d);manager[_0xdc7f('0x45')](_0x1d1e5d);logger['info']('stop\x20cron',_0x396b25[_0x1d1e5d][_0xdc7f('0x13')],_0x396b25[_0x1d1e5d]['cron']);}}for(_0x14596f=0x0,_0x1d1e5d;_0x14596f<_0x3ed2c8[_0xdc7f('0x43')]&&!_0x46b014;_0x14596f+=0x1){_0x1d1e5d=_0x3ed2c8[_0x14596f][_0xdc7f('0x41')]();if(manager[_0xdc7f('0x50')](_0x1d1e5d)){if(_0x396b25[_0x1d1e5d][_0xdc7f('0x4a')]&&_0x396b25[_0x1d1e5d][_0xdc7f('0x51')]&&moment()[_0xdc7f('0x4b')](_0x396b25[_0x1d1e5d][_0xdc7f('0x52')],_0x396b25[_0x1d1e5d]['endAt'])){manager['update'](_0x1d1e5d,_0x396b25[_0x1d1e5d]['cron'],handleJob(_0x396b25[_0x1d1e5d]));logger[_0xdc7f('0xa')](_0xdc7f('0x53'),_0x396b25[_0x1d1e5d][_0xdc7f('0x13')],_0x396b25[_0x1d1e5d][_0xdc7f('0x4a')]);}else{manager[_0xdc7f('0x44')](_0x1d1e5d);manager[_0xdc7f('0x45')](_0x1d1e5d);logger[_0xdc7f('0xa')]('stop\x20cron',_0x396b25[_0x1d1e5d][_0xdc7f('0x13')],_0x396b25[_0x1d1e5d][_0xdc7f('0x4a')]);}}}})[_0xdc7f('0x2b')](function(_0x472741){logger[_0xdc7f('0x29')](JSON[_0xdc7f('0x23')](_0x472741));});}exports[_0xdc7f('0x54')]=function(_0x4a1e7b){return getJobs(_0x4a1e7b);};exports['start']=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 9d2a7ba..dcf8e16 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 _0x30d3=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','catch','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','update','Sentiment','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x30d3,0x9f));var _0x330d=function(_0x264301,_0x3d7d1e){_0x264301=_0x264301-0x0;var _0x105879=_0x30d3[_0x264301];return _0x105879;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var BPromise=require(_0x330d('0x2'));var db=require(_0x330d('0x3'))['db'];var logger=require(_0x330d('0x4'))(_0x330d('0x5'));function getTranscriptionJob(_0x447dbb,_0x51cee8,_0x37fe02,_0x3b3165){return new Promise(function(_0xd8503,_0x2a330f){var _0x5ee451=new AWS['TranscribeService']({'accessKeyId':_0x51cee8,'secretAccessKey':_0x447dbb,'region':_0x37fe02});_0x5ee451[_0x330d('0x6')]({'TranscriptionJobName':_0x3b3165},function(_0x410a37,_0x1342e7){if(_0x410a37){return _0x2a330f(_0x410a37);}else{return _0xd8503(_0x1342e7);}});});}function sentiment(_0x432840,_0x53bc72,_0x5f137f,_0x22a8ba,_0x151f9a){return new Promise(function(_0x39d171,_0x340980){var _0x2eb0bc=new AWS[(_0x330d('0x7'))]({'accessKeyId':_0x53bc72,'secretAccessKey':_0x432840,'region':_0x5f137f});_0x2eb0bc[_0x330d('0x8')]({'Text':_0x22a8ba,'LanguageCode':_0x151f9a['substring'](0x0,0x2)},function(_0x3b8feb,_0x548353){if(_0x3b8feb){return _0x340980(_0x3b8feb);}else{return _0x39d171(_0x548353);}});});}function checkTranscribeJob(_0x1ad0ee,_0x55eb0e,_0x416b93){var _0xb093cd;return new BPromise(function(_0x3a0f89,_0x20c90f){logger['info'](util[_0x330d('0x9')](_0x330d('0xa'),_0x1ad0ee['id'],_0x1ad0ee['transcribeName']));return getTranscriptionJob(_0x416b93[_0x330d('0xb')],_0x416b93['data2'],_0x55eb0e[_0x330d('0xc')],_0x1ad0ee[_0x330d('0xd')])[_0x330d('0xe')](function(_0x5e5baf){logger['info'](util[_0x330d('0x9')](_0x330d('0xf'),_0x1ad0ee['id'],_0x1ad0ee[_0x330d('0xd')],_0x5e5baf['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x1ad0ee['fileText']){switch(_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus']){case'COMPLETED':var _0x435083={'transcribeStatus':_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus'],'fileUri':_0x5e5baf[_0x330d('0x10')][_0x330d('0x11')][_0x330d('0x12')]};logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x1ad0ee['id']));return rp({'uri':_0x5e5baf['TranscriptionJob'][_0x330d('0x11')]['TranscriptFileUri'],'json':!![]})[_0x330d('0xe')](function(_0x2e876b){logger[_0x330d('0x13')](util['format'](_0x330d('0x14'),_0x1ad0ee['id']));if(_0x2e876b&&_0x2e876b[_0x330d('0x15')]&&_0x2e876b['results']['transcripts']&&_0x2e876b[_0x330d('0x15')][_0x330d('0x16')]['length']){_0x435083[_0x330d('0x17')]='';for(var _0x19c2f2=0x0;_0x19c2f2<_0x2e876b['results']['transcripts'][_0x330d('0x18')];_0x19c2f2++){_0x435083[_0x330d('0x17')]+=_0x2e876b[_0x330d('0x15')][_0x330d('0x16')][_0x19c2f2][_0x330d('0x19')]+'';}}return _0x1ad0ee['update'](_0x435083);})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ad0ee['id']));if(!_0x1ad0ee[_0x330d('0x1a')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x1d'));}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e['sentimentRegion']||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e['bucket']){throw new db['Sequelize'][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x435083[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x330d('0xe')](function(_0xe071ff){if(!_0xe071ff){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xe071ff[_0x330d('0xb')]||!_0xe071ff[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xe071ff;logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd['data1'],_0xb093cd['data2'],_0x55eb0e[_0x330d('0x29')],_0x435083[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x456431){logger[_0x330d('0x13')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ad0ee['id']));return _0x1ad0ee[_0x330d('0x2a')]({'sentiment':_0x456431[_0x330d('0x2b')],'sPositive':_0x456431[_0x330d('0x2c')]['Positive'],'sNegative':_0x456431[_0x330d('0x2c')]['Negative'],'sMixed':_0x456431[_0x330d('0x2c')][_0x330d('0x2d')],'sNeutral':_0x456431[_0x330d('0x2c')][_0x330d('0x2e')]});})[_0x330d('0xe')](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});case _0x330d('0x30'):return _0x1ad0ee[_0x330d('0x2a')]({'transcribeStatus':_0x330d('0x30'),'failureReason':_0x5e5baf[_0x330d('0x10')]['FailureReason']})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});default:logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x31'),_0x1ad0ee['id']));break;}}else{return BPromise[_0x330d('0x32')]()[_0x330d('0xe')](function(){if(!_0x1ad0ee['tempSentiment']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e[_0x330d('0x29')]||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e[_0x330d('0x33')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x1ad0ee[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0xd0af59){if(!_0xd0af59){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xd0af59[_0x330d('0xb')]||!_0xd0af59[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xd0af59;logger['info'](util['format'](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd[_0x330d('0xb')],_0xb093cd[_0x330d('0x26')],_0x55eb0e[_0x330d('0x29')],_0x1ad0ee[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x5dab16){logger['info'](util[_0x330d('0x9')](_0x330d('0x34'),_0x1ad0ee['id']));return _0x1ad0ee['update']({'sentiment':_0x5dab16[_0x330d('0x2b')],'sPositive':_0x5dab16[_0x330d('0x2c')][_0x330d('0x35')],'sNegative':_0x5dab16[_0x330d('0x2c')][_0x330d('0x36')],'sMixed':_0x5dab16['SentimentScore'][_0x330d('0x2d')],'sNeutral':_0x5dab16[_0x330d('0x2c')][_0x330d('0x2e')],'transcribeStatus':_0x330d('0x37')});})[_0x330d('0xe')](function(){logger['info'](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});}})['catch'](function(_0x3264d0){if(_0x3264d0){if(!_0x3264d0['name']||_0x3264d0[_0x330d('0x38')]!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x9')](_0x330d('0x3b'),_0x1ad0ee['id']),util[_0x330d('0x3c')](_0x3264d0,{'showHidden':![],'depth':null}));}}_0x3a0f89();});});}function checkTranscribe(){var _0xa802b7;var _0x36393b;var _0x460ec4;return db[_0x330d('0x3d')][_0x330d('0x3e')]({'where':{'transcribeStatus':_0x330d('0x3f')}})[_0x330d('0xe')](function(_0xadbd06){if(!_0xadbd06||!_0xadbd06[_0x330d('0x18')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x40'));}_0xa802b7=_0xadbd06;return db[_0x330d('0x41')][_0x330d('0x24')]({'where':{'id':0x1}});})[_0x330d('0xe')](function(_0x46de6d){if(!_0x46de6d){throw new db[(_0x330d('0x1b'))]['ValidationError']('Settings\x20not\x20available');}_0x36393b=_0x46de6d;if(!_0x36393b[_0x330d('0x5')]||!_0x36393b['transcribeAccountId']||!_0x36393b[_0x330d('0xc')]||!_0x36393b[_0x330d('0x20')]||!_0x36393b['bucket']){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x42'));}return db['CloudProvider'][_0x330d('0x24')]({'where':{'id':_0x36393b[_0x330d('0x43')]}});})[_0x330d('0xe')](function(_0x47dc86){if(!_0x47dc86){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0x47dc86[_0x330d('0xb')]||!_0x47dc86[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0x460ec4=_0x47dc86;var _0xc00ee8=[];_0xa802b7[_0x330d('0x44')](function(_0x438d23){_0xc00ee8[_0x330d('0x45')](checkTranscribeJob(_0x438d23,_0x36393b,_0x460ec4));});return BPromise[_0x330d('0x46')](_0xc00ee8);})[_0x330d('0x47')](function(_0x4e1998){if(_0x4e1998){if(!_0x4e1998['name']||_0x4e1998['name']!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x3c')](_0x4e1998,{'showHidden':![],'depth':null}));}}});}exports[_0x330d('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x915a=['Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','update','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve'];(function(_0xbccba3,_0x2c0c55){var _0x567728=function(_0x2a281f){while(--_0x2a281f){_0xbccba3['push'](_0xbccba3['shift']());}};_0x567728(++_0x2c0c55);}(_0x915a,0x1d2));var _0xa915=function(_0x5e9a03,_0x4366c9){_0x5e9a03=_0x5e9a03-0x0;var _0x1cd174=_0x915a[_0x5e9a03];return _0x1cd174;};var _=require(_0xa915('0x0'));var AWS=require(_0xa915('0x1'));var rp=require(_0xa915('0x2'));var util=require(_0xa915('0x3'));var BPromise=require(_0xa915('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xa915('0x5'))('transcribe');function getTranscriptionJob(_0x59bc2b,_0x1106ee,_0x422023,_0xf654ba){return new Promise(function(_0xb6900c,_0x1ed01d){var _0x3f5e00=new AWS['TranscribeService']({'accessKeyId':_0x1106ee,'secretAccessKey':_0x59bc2b,'region':_0x422023});_0x3f5e00['getTranscriptionJob']({'TranscriptionJobName':_0xf654ba},function(_0x3f5b1b,_0x43bfc9){if(_0x3f5b1b){return _0x1ed01d(_0x3f5b1b);}else{return _0xb6900c(_0x43bfc9);}});});}function sentiment(_0x173267,_0x450ff2,_0x5cfcec,_0x549502,_0x17efe8){return new Promise(function(_0x5d38c9,_0x2cdc8b){var _0x47a886=new AWS[(_0xa915('0x6'))]({'accessKeyId':_0x450ff2,'secretAccessKey':_0x173267,'region':_0x5cfcec});_0x47a886[_0xa915('0x7')]({'Text':_0x549502,'LanguageCode':_0x17efe8[_0xa915('0x8')](0x0,0x2)},function(_0x152286,_0x523c96){if(_0x152286){return _0x2cdc8b(_0x152286);}else{return _0x5d38c9(_0x523c96);}});});}function checkTranscribeJob(_0x54facc,_0x3edd93,_0x5d7c09){var _0x274f4d;return new BPromise(function(_0x563972,_0xb897e2){logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0xb'),_0x54facc['id'],_0x54facc[_0xa915('0xc')]));return getTranscriptionJob(_0x5d7c09[_0xa915('0xd')],_0x5d7c09['data2'],_0x3edd93[_0xa915('0xe')],_0x54facc[_0xa915('0xc')])[_0xa915('0xf')](function(_0x590be6){logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0x10'),_0x54facc['id'],_0x54facc[_0xa915('0xc')],_0x590be6[_0xa915('0x11')][_0xa915('0x12')]));if(!_0x54facc[_0xa915('0x13')]){switch(_0x590be6[_0xa915('0x11')][_0xa915('0x12')]){case _0xa915('0x14'):var _0xb0d073={'transcribeStatus':_0x590be6['TranscriptionJob'][_0xa915('0x12')],'fileUri':_0x590be6['TranscriptionJob'][_0xa915('0x15')][_0xa915('0x16')]};logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0x17'),_0x54facc['id']));return rp({'uri':_0x590be6['TranscriptionJob'][_0xa915('0x15')][_0xa915('0x16')],'json':!![]})[_0xa915('0xf')](function(_0x3d94d1){logger[_0xa915('0x9')](util[_0xa915('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x54facc['id']));if(_0x3d94d1&&_0x3d94d1[_0xa915('0x18')]&&_0x3d94d1[_0xa915('0x18')][_0xa915('0x19')]&&_0x3d94d1[_0xa915('0x18')]['transcripts']['length']){_0xb0d073[_0xa915('0x13')]='';for(var _0x58eb14=0x0;_0x58eb14<_0x3d94d1[_0xa915('0x18')][_0xa915('0x19')][_0xa915('0x1a')];_0x58eb14++){_0xb0d073[_0xa915('0x13')]+=_0x3d94d1[_0xa915('0x18')][_0xa915('0x19')][_0x58eb14][_0xa915('0x1b')]+'';}}return _0x54facc['update'](_0xb0d073);})[_0xa915('0xf')](function(){logger[_0xa915('0x9')](util['format'](_0xa915('0x1c'),_0x54facc['id']));if(!_0x54facc[_0xa915('0x1d')]){throw new db[(_0xa915('0x1e'))][(_0xa915('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3edd93[_0xa915('0x20')]||!_0x3edd93[_0xa915('0x21')]||!_0x3edd93['sentimentRegion']||!_0x3edd93[_0xa915('0x22')]||!_0x3edd93[_0xa915('0x23')]){throw new db[(_0xa915('0x1e'))][(_0xa915('0x1f'))](_0xa915('0x24'));}if(!_0xb0d073[_0xa915('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x3edd93[_0xa915('0x21')]===_0x5d7c09['id']){return _0x5d7c09;}else{return db[_0xa915('0x25')][_0xa915('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa915('0xf')](function(_0x31b8b7){if(!_0x31b8b7){throw new db[(_0xa915('0x1e'))]['ValidationError'](_0xa915('0x27'));}if(!_0x31b8b7[_0xa915('0xd')]||!_0x31b8b7[_0xa915('0x28')]){throw new db[(_0xa915('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x274f4d=_0x31b8b7;logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0x29'),_0x54facc['id']));return sentiment(_0x274f4d['data1'],_0x274f4d[_0xa915('0x28')],_0x3edd93['sentimentRegion'],_0xb0d073[_0xa915('0x13')],_0x3edd93[_0xa915('0x22')]);})[_0xa915('0xf')](function(_0x2c738a){logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0x2a'),_0x54facc['id']));return _0x54facc['update']({'sentiment':_0x2c738a[_0xa915('0x2b')],'sPositive':_0x2c738a[_0xa915('0x2c')][_0xa915('0x2d')],'sNegative':_0x2c738a[_0xa915('0x2c')][_0xa915('0x2e')],'sMixed':_0x2c738a[_0xa915('0x2c')]['Mixed'],'sNeutral':_0x2c738a[_0xa915('0x2c')][_0xa915('0x2f')]});})[_0xa915('0xf')](function(){logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0x1c'),_0x54facc['id']));_0x563972();});case _0xa915('0x30'):return _0x54facc['update']({'transcribeStatus':'FAILED','failureReason':_0x590be6['TranscriptionJob'][_0xa915('0x31')]})[_0xa915('0xf')](function(){logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0x1c'),_0x54facc['id']));_0x563972();});default:logger[_0xa915('0x9')](util[_0xa915('0xa')](_0xa915('0x32'),_0x54facc['id']));break;}}else{return BPromise[_0xa915('0x33')]()[_0xa915('0xf')](function(){if(!_0x54facc[_0xa915('0x1d')]){throw new db[(_0xa915('0x1e'))][(_0xa915('0x1f'))](_0xa915('0x34'));}if(!_0x3edd93[_0xa915('0x20')]||!_0x3edd93['sentimentAccountId']||!_0x3edd93[_0xa915('0x35')]||!_0x3edd93[_0xa915('0x22')]||!_0x3edd93[_0xa915('0x23')]){throw new db[(_0xa915('0x1e'))][(_0xa915('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x54facc[_0xa915('0x13')]){throw new Error(_0xa915('0x36'));}if(_0x3edd93[_0xa915('0x21')]===_0x5d7c09['id']){return _0x5d7c09;}else{return db[_0xa915('0x25')]['findOne']({'where':{'id':_settings[_0xa915('0x21')]}});}})[_0xa915('0xf')](function(_0x389719){if(!_0x389719){throw new db[(_0xa915('0x1e'))][(_0xa915('0x1f'))](_0xa915('0x27'));}if(!_0x389719[_0xa915('0xd')]||!_0x389719[_0xa915('0x28')]){throw new db['Sequelize'][(_0xa915('0x1f'))](_0xa915('0x37'));}_0x274f4d=_0x389719;logger[_0xa915('0x9')](util[_0xa915('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x54facc['id']));return sentiment(_0x274f4d[_0xa915('0xd')],_0x274f4d['data2'],_0x3edd93[_0xa915('0x35')],_0x54facc[_0xa915('0x13')],_0x3edd93['language']);})[_0xa915('0xf')](function(_0x50fb06){logger['info'](util[_0xa915('0xa')](_0xa915('0x2a'),_0x54facc['id']));return _0x54facc[_0xa915('0x38')]({'sentiment':_0x50fb06[_0xa915('0x2b')],'sPositive':_0x50fb06[_0xa915('0x2c')][_0xa915('0x2d')],'sNegative':_0x50fb06['SentimentScore'][_0xa915('0x2e')],'sMixed':_0x50fb06[_0xa915('0x2c')][_0xa915('0x39')],'sNeutral':_0x50fb06[_0xa915('0x2c')][_0xa915('0x2f')],'transcribeStatus':_0xa915('0x14')});})[_0xa915('0xf')](function(){logger[_0xa915('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x54facc['id']));_0x563972();});}})[_0xa915('0x3a')](function(_0x3d9461){if(_0x3d9461){if(!_0x3d9461[_0xa915('0x3b')]||_0x3d9461[_0xa915('0x3b')]!==_0xa915('0x3c')){logger[_0xa915('0x3d')](util['format'](_0xa915('0x3e'),_0x54facc['id']),util[_0xa915('0x3f')](_0x3d9461,{'showHidden':![],'depth':null}));}}_0x563972();});});}function checkTranscribe(){var _0x1c9bbd;var _0xb1526e;var _0x285313;return db[_0xa915('0x40')][_0xa915('0x41')]({'where':{'transcribeStatus':_0xa915('0x42')}})['then'](function(_0x367e6f){if(!_0x367e6f||!_0x367e6f[_0xa915('0x1a')]){throw new db[(_0xa915('0x1e'))][(_0xa915('0x1f'))](_0xa915('0x43'));}_0x1c9bbd=_0x367e6f;return db[_0xa915('0x44')][_0xa915('0x26')]({'where':{'id':0x1}});})[_0xa915('0xf')](function(_0x2a8f00){if(!_0x2a8f00){throw new db[(_0xa915('0x1e'))]['ValidationError']('Settings\x20not\x20available');}_0xb1526e=_0x2a8f00;if(!_0xb1526e['transcribe']||!_0xb1526e[_0xa915('0x45')]||!_0xb1526e[_0xa915('0xe')]||!_0xb1526e[_0xa915('0x22')]||!_0xb1526e[_0xa915('0x23')]){throw new db['Sequelize'][(_0xa915('0x1f'))](_0xa915('0x46'));}return db[_0xa915('0x25')][_0xa915('0x26')]({'where':{'id':_0xb1526e[_0xa915('0x45')]}});})[_0xa915('0xf')](function(_0x1fb931){if(!_0x1fb931){throw new db['Sequelize'][(_0xa915('0x1f'))](_0xa915('0x27'));}if(!_0x1fb931[_0xa915('0xd')]||!_0x1fb931[_0xa915('0x28')]){throw new db[(_0xa915('0x1e'))]['ValidationError'](_0xa915('0x37'));}_0x285313=_0x1fb931;var _0x5d15ba=[];_0x1c9bbd['forEach'](function(_0x4c6f0d){_0x5d15ba[_0xa915('0x47')](checkTranscribeJob(_0x4c6f0d,_0xb1526e,_0x285313));});return BPromise[_0xa915('0x48')](_0x5d15ba);})[_0xa915('0x3a')](function(_0x34f13b){if(_0x34f13b){if(!_0x34f13b['name']||_0x34f13b[_0xa915('0x3b')]!==_0xa915('0x3c')){logger[_0xa915('0x3d')](util[_0xa915('0x3f')](_0x34f13b,{'showHidden':![],'depth':null}));}}});}exports[_0xa915('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 7ad1e4a..861642c 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 _0x8dd2=['catch','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','join','update','system','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update'];(function(_0x3a24b7,_0x52d79c){var _0x122efa=function(_0x373f87){while(--_0x373f87){_0x3a24b7['push'](_0x3a24b7['shift']());}};_0x122efa(++_0x52d79c);}(_0x8dd2,0x106));var _0x28dd=function(_0x44e167,_0x377fc6){_0x44e167=_0x44e167-0x0;var _0x32abc6=_0x8dd2[_0x44e167];return _0x32abc6;};'use strict';var _=require(_0x28dd('0x0'));var moment=require(_0x28dd('0x1'));var Redis=require(_0x28dd('0x2'));var util=require(_0x28dd('0x3'));var config=require('../../config/environment');var db=require(_0x28dd('0x4'))['db'];var logger=require(_0x28dd('0x5'))(_0x28dd('0x6'));config[_0x28dd('0x7')]=_[_0x28dd('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x28dd('0x9'))(new Redis(config[_0x28dd('0x7')]));function closeInteractions(){var _0x202b0b=[];return db['WhatsappInteraction'][_0x28dd('0xa')]({'raw':!![],'attributes':['id',_0x28dd('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x28dd('0xc')](0x18,_0x28dd('0xd'))}}})[_0x28dd('0xe')](function(_0x1e5bdf){if(_0x1e5bdf&&_0x1e5bdf[_0x28dd('0xf')]){_0x202b0b=_[_0x28dd('0x10')](_0x1e5bdf||[],'id');logger[_0x28dd('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x202b0b[_0x28dd('0x12')]());return db['WhatsappInteraction'][_0x28dd('0x13')]({'closeReason':_0x28dd('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x28dd('0x15'))},{'where':{'id':_0x202b0b}});}})['then'](function(){if(_0x202b0b&&_0x202b0b[_0x28dd('0xf')]){logger[_0x28dd('0x11')](_0x28dd('0x16'),_0x202b0b[_0x28dd('0x12')]());for(var _0x23c302=0x0;_0x23c302<_0x202b0b['length'];_0x23c302++){io['emit'](_0x28dd('0x17'),{'id':_0x202b0b[_0x23c302],'closed':!![]});}}})[_0x28dd('0x18')](function(_0x57ddf2){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x57ddf2?util['inspect'](_0x57ddf2,{'showHidden':![],'depth':null}):'');});}exports[_0x28dd('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6a58=['catch','inspect','lodash','moment','util','../../mysqldb','schedule','redis','defaults','localhost','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update'];(function(_0x713cc6,_0x147f61){var _0x32b98c=function(_0x35352e){while(--_0x35352e){_0x713cc6['push'](_0x713cc6['shift']());}};_0x32b98c(++_0x147f61);}(_0x6a58,0x120));var _0x86a5=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x6a58[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0x86a5('0x0'));var moment=require(_0x86a5('0x1'));var Redis=require('ioredis');var util=require(_0x86a5('0x2'));var config=require('../../config/environment');var db=require(_0x86a5('0x3'))['db'];var logger=require('../logger')(_0x86a5('0x4'));config[_0x86a5('0x5')]=_[_0x86a5('0x6')](config[_0x86a5('0x5')],{'host':_0x86a5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x86a5('0x5')]));function closeInteractions(){var _0xd0a4f4=[];return db['WhatsappInteraction'][_0x86a5('0x8')]({'raw':!![],'attributes':['id',_0x86a5('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x86a5('0xa')](0x18,_0x86a5('0xb'))}}})[_0x86a5('0xc')](function(_0x3084f3){if(_0x3084f3&&_0x3084f3[_0x86a5('0xd')]){_0xd0a4f4=_[_0x86a5('0xe')](_0x3084f3||[],'id');logger[_0x86a5('0xf')](_0x86a5('0x10'),_0xd0a4f4['join']());return db['WhatsappInteraction'][_0x86a5('0x11')]({'closeReason':'system','disposition':_0x86a5('0x12'),'closed':!![],'closedAt':moment()[_0x86a5('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xd0a4f4}});}})[_0x86a5('0xc')](function(){if(_0xd0a4f4&&_0xd0a4f4[_0x86a5('0xd')]){logger['info'](_0x86a5('0x14'),_0xd0a4f4[_0x86a5('0x15')]());for(var _0x57730b=0x0;_0x57730b<_0xd0a4f4[_0x86a5('0xd')];_0x57730b++){io[_0x86a5('0x16')](_0x86a5('0x17'),{'id':_0xd0a4f4[_0x57730b],'closed':!![]});}}})[_0x86a5('0x18')](function(_0x41661c){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x41661c?util[_0x86a5('0x19')](_0x41661c,{'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 3b8dc89..f54deaa 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95f7=['innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2','catch','Innocenzo','@xcally.com','now','push','Biondo'];(function(_0xc54c54,_0x59053b){var _0x476786=function(_0x2d6a30){while(--_0x2d6a30){_0xc54c54['push'](_0xc54c54['shift']());}};_0x476786(++_0x59053b);}(_0x95f7,0x11c));var _0x795f=function(_0x5a52c4,_0x5f1315){_0x5a52c4=_0x5a52c4-0x0;var _0x34de6f=_0x95f7[_0x5a52c4];return _0x34de6f;};'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':_0x795f('0x0')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x795f('0x1')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x795f('0x2')](),'updatedAt':Date[_0x795f('0x2')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x795f('0x3')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x795f('0x4')+i,'phone':0xf879fb460+i,'email':_0x795f('0x5')+i+_0x795f('0x1')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x795f('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x795f('0x2')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x795f('0x2')]()});}db[_0x795f('0x6')][_0x795f('0x7')]({'where':{}})[_0x795f('0x8')](function(){return db['CmContact'][_0x795f('0x9')](contacts);})['then'](function(){console[_0x795f('0xa')](_0x795f('0xb'),_0x795f('0xc'));return db[_0x795f('0xd')]['destroy']({'where':{}});})[_0x795f('0x8')](function(){return db[_0x795f('0xd')][_0x795f('0x9')](hopper);})['then'](function(){console['log'](_0x795f('0xb'),'hopper1');return db[_0x795f('0x6')][_0x795f('0x9')](contacts2);})[_0x795f('0x8')](function(){console[_0x795f('0xa')](_0x795f('0xb'),_0x795f('0xe'));return db['CmHopper'][_0x795f('0x9')](hopper2);})[_0x795f('0x8')](function(){console[_0x795f('0xa')](_0x795f('0xb'),_0x795f('0xf'));})[_0x795f('0x10')](function(_0x31e8ba){console[_0x795f('0xa')](_0x31e8ba);}); \ No newline at end of file +var _0x79a2=['util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','log','CmHopper','finished\x20populating','hopper1'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x79a2,0x1c2));var _0x279a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x79a2[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x279a('0x0'));var db=require(_0x279a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x279a('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x279a('0x3')+i+_0x279a('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x279a('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x279a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x279a('0x6')](),'updatedAt':Date[_0x279a('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x279a('0x5')]({'id':i,'firstName':_0x279a('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x279a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x279a('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x279a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x279a('0x6')]()});}db[_0x279a('0x7')][_0x279a('0x8')]({'where':{}})[_0x279a('0x9')](function(){return db['CmContact'][_0x279a('0xa')](contacts);})[_0x279a('0x9')](function(){console[_0x279a('0xb')]('finished\x20populating','contacts1');return db[_0x279a('0xc')][_0x279a('0x8')]({'where':{}});})[_0x279a('0x9')](function(){return db[_0x279a('0xc')][_0x279a('0xa')](hopper);})[_0x279a('0x9')](function(){console[_0x279a('0xb')](_0x279a('0xd'),_0x279a('0xe'));return db['CmContact'][_0x279a('0xa')](contacts2);})[_0x279a('0x9')](function(){console[_0x279a('0xb')](_0x279a('0xd'),'contacts2');return db['CmHopper'][_0x279a('0xa')](hopper2);})[_0x279a('0x9')](function(){console[_0x279a('0xb')](_0x279a('0xd'),'hopper2');})['catch'](function(_0x54588d){console[_0x279a('0xb')](_0x54588d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index f69690c..185d22e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29e8=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','password','udp','wss','ulaw','yes'];(function(_0x34b2e7,_0x3ef128){var _0x23865c=function(_0x33e07a){while(--_0x33e07a){_0x34b2e7['push'](_0x34b2e7['shift']());}};_0x23865c(++_0x3ef128);}(_0x29e8,0xdf));var _0x829e=function(_0x250c95,_0x2c03d2){_0x250c95=_0x250c95-0x0;var _0x6025bf=_0x29e8[_0x250c95];return _0x6025bf;};'use strict';var util=require(_0x829e('0x0'));var db=require(_0x829e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x829e('0x2')]({'name':util[_0x829e('0x3')]('%s%s',_0x829e('0x4'),i),'fullname':util[_0x829e('0x3')](_0x829e('0x5'),'agent',i),'email':util['format']('%s%s@xcally.com',_0x829e('0x4'),i),'role':_0x829e('0x4'),'password':_0x829e('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x829e('0x7'),'ws',_0x829e('0x8')],'disallow':['all'],'allow':[_0x829e('0x9')],'defaultuser':util[_0x829e('0x3')](_0x829e('0x5'),_0x829e('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':_0x829e('0xa'),'icesupport':_0x829e('0xa'),'dtlsenable':_0x829e('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x829e('0xb'),'dtlssetup':_0x829e('0xc'),'callerid':util[_0x829e('0x3')](_0x829e('0xd'),util[_0x829e('0x3')]('%s%s','agent',i),0xfa0+i)});}db[_0x829e('0xe')]['bulkCreate'](users)['then'](function(){console[_0x829e('0xf')](_0x829e('0x10'));})[_0x829e('0x11')](function(_0x5724e4){console[_0x829e('0xf')](_0x5724e4);}); \ No newline at end of file +var _0xb82d=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','User','bulkCreate','then','log','add\x20user','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xb82d,0xdc));var _0xdb82=function(_0x1ab880,_0x42d226){_0x1ab880=_0x1ab880-0x0;var _0x199239=_0xb82d[_0x1ab880];return _0x199239;};'use strict';var util=require(_0xdb82('0x0'));var db=require(_0xdb82('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xdb82('0x2')](_0xdb82('0x3'),_0xdb82('0x4'),i),'fullname':util[_0xdb82('0x2')](_0xdb82('0x3'),_0xdb82('0x4'),i),'email':util[_0xdb82('0x2')](_0xdb82('0x5'),_0xdb82('0x4'),i),'role':_0xdb82('0x4'),'password':_0xdb82('0x6'),'internal':0xfa0+i,'type':_0xdb82('0x7'),'transport':[_0xdb82('0x8'),'ws',_0xdb82('0x9')],'disallow':[_0xdb82('0xa')],'allow':[_0xdb82('0xb')],'defaultuser':util['format']('%s%s',_0xdb82('0x4'),i),'encryption':_0xdb82('0xc'),'avpf':_0xdb82('0xc'),'force_avp':_0xdb82('0xc'),'icesupport':_0xdb82('0xc'),'dtlsenable':_0xdb82('0xc'),'dtlsverify':'no','dtlscertfile':_0xdb82('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0xdb82('0x3'),_0xdb82('0x4'),i),0xfa0+i)});}db[_0xdb82('0xe')][_0xdb82('0xf')](users)[_0xdb82('0x10')](function(){console[_0xdb82('0x11')](_0xdb82('0x12'));})['catch'](function(_0x446b87){console[_0xdb82('0x11')](_0x446b87);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f833079..46043cb 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x043b=['WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueues','ChatQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','remoteAddress','disconnect','DISCONNECTED','CONNECTED','lodash','util','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','then','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','format','%s:queue:%s','user:%s','query','find','userProfileId','handshake','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions'];(function(_0x198221,_0x5ab09e){var _0x956477=function(_0x5bb807){while(--_0x5bb807){_0x198221['push'](_0x198221['shift']());}};_0x956477(++_0x5ab09e);}(_0x043b,0xa0));var _0xb043=function(_0x2c67af,_0x367db4){_0x2c67af=_0x2c67af-0x0;var _0x56bb38=_0x043b[_0x2c67af];return _0x56bb38;};'use strict';var _=require(_0xb043('0x0'));var util=require(_0xb043('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0xb043('0x2'));var queryQueues={'attributes':['id',_0xb043('0x3')],'include':[{'as':_0xb043('0x4'),'model':db[_0xb043('0x5')],'attributes':['id',_0xb043('0x3'),_0xb043('0x6')],'raw':!![],'where':{'role':_0xb043('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xb043('0x3')],'where':{'role':_0xb043('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xb043('0x8')],'where':{'type':_0xb043('0x9')}};function getAssociatedResources(_0x2cbb46,_0x1dda19,_0x5334c5){return db[_0xb043('0xa')]['findOne']({'where':{'name':_0x2cbb46,'userProfileId':_0x1dda19},'raw':!![]})[_0xb043('0xb')](function(_0x405f9d){if(_0x405f9d){if(_0x405f9d['autoAssociation']){switch(_0x2cbb46){case'VoiceQueues':case _0xb043('0xc'):case _0xb043('0xd'):case _0xb043('0xe'):case _0xb043('0xf'):case _0xb043('0x10'):case _0xb043('0x11'):return db[_0x5334c5]['findAll'](queryQueues);case _0xb043('0x12'):return db[_0x5334c5][_0xb043('0x13')](queryTelephones);case'Trunks':return db[_0x5334c5][_0xb043('0x13')](queryTrunks);case _0xb043('0x14'):return db[_0x5334c5][_0xb043('0x13')](queryCampaigns);}}else{return db[_0xb043('0x15')][_0xb043('0x13')]({'attributes':[_0xb043('0x16')],'where':{'sectionId':_0x405f9d['id']},'raw':!![]})['then'](function(_0x364248){if(_0x364248){var _0x3da725={'where':{'id':_[_0xb043('0x17')](_0x364248,'resourceId')},'raw':!![]};switch(_0x5334c5){case _0xb043('0x5'):_0x3da725[_0xb043('0x18')][_0xb043('0x6')]=_0xb043('0x19');break;case _0xb043('0x1a'):_0x3da725[_0xb043('0x18')][_0xb043('0x8')]=_0xb043('0x9');break;}return db[_0x5334c5]['findAll'](_0x3da725);}else{return[];}});}}else{return[];}})[_0xb043('0xb')](function(_0x182a42){return _0x182a42;});}function joinOrLeaveQueues(_0x5af135,_0x319421,_0x2adae5,_0x31d6df){_0x5af135[_0x319421](util[_0xb043('0x1b')](_0xb043('0x1c'),_0x2adae5,_0x31d6df[_0xb043('0x3')]));if(_0x31d6df[_0xb043('0x4')]){for(var _0x3536d0=0x0;_0x3536d0<_0x31d6df[_0xb043('0x4')]['length'];_0x3536d0+=0x1){_0x5af135[_0x319421](util['format'](_0xb043('0x1d'),_0x31d6df['Agents'][_0x3536d0]['name']));}}}function joinOrLeave(_0x576c4e,_0x4063dc,_0xf63fe4){var _0x517c8d;if(_0x576c4e['handshake'][_0xb043('0x1e')]['id']){db[_0xb043('0x5')][_0xb043('0x1f')]({'attributes':['id',_0xb043('0x3'),_0xb043('0x6'),_0xb043('0x20')],'where':{'id':_0x576c4e[_0xb043('0x21')][_0xb043('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb043('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb043('0x23')],'as':_0xb043('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb043('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb043('0x26')],'as':_0xb043('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb043('0x28')],'as':_0xb043('0x29'),'attributes':['id'],'raw':!![]}]})[_0xb043('0xb')](function(_0x4c2321){if(_0x4c2321){_0x517c8d=_0x4c2321;_0x576c4e[_0x4063dc](util[_0xb043('0x1b')](_0xb043('0x1d'),_0x4c2321[_0xb043('0x3')]));var _0x5da867=[];switch(_0x4c2321[_0xb043('0x6')]){case _0xb043('0x2a'):_0x576c4e[_0x4063dc]('voice:inbound');_0x576c4e[_0x4063dc](_0xb043('0x2b'));if(queryQueues[_0xb043('0x2c')]('include')){delete queryQueues[_0xb043('0x2d')];}_0x5da867[_0xb043('0x2e')](db[_0xb043('0x2f')][_0xb043('0x13')](queryQueues));_0x5da867[_0xb043('0x2e')](db['ChatQueue'][_0xb043('0x13')](queryQueues));_0x5da867['push'](db[_0xb043('0x30')][_0xb043('0x13')](queryQueues));_0x5da867[_0xb043('0x2e')](db[_0xb043('0x31')][_0xb043('0x13')](queryQueues));_0x5da867['push'](db[_0xb043('0x32')][_0xb043('0x13')](queryQueues));_0x5da867[_0xb043('0x2e')](db[_0xb043('0x33')][_0xb043('0x13')](queryQueues));_0x5da867['push'](db[_0xb043('0x34')]['findAll'](queryQueues));_0x5da867[_0xb043('0x2e')](db[_0xb043('0x5')][_0xb043('0x13')](queryTelephones));_0x5da867[_0xb043('0x2e')](db[_0xb043('0x35')][_0xb043('0x13')](queryTrunks));_0x5da867[_0xb043('0x2e')](db[_0xb043('0x1a')][_0xb043('0x13')](queryCampaigns));_0x5da867['push'](db[_0xb043('0x5')][_0xb043('0x13')](queryAgents));break;case _0xb043('0x36'):_0x576c4e[_0x4063dc](_0xb043('0x37'));_0x576c4e[_0x4063dc](_0xb043('0x2b'));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0x38'),_0x4c2321[_0xb043('0x20')],_0xb043('0x2f')));_0x5da867[_0xb043('0x2e')](getAssociatedResources('ChatQueues',_0x4c2321[_0xb043('0x20')],_0xb043('0x39')));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0xd'),_0x4c2321[_0xb043('0x20')],_0xb043('0x30')));_0x5da867['push'](getAssociatedResources(_0xb043('0xe'),_0x4c2321[_0xb043('0x20')],_0xb043('0x31')));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0xf'),_0x4c2321[_0xb043('0x20')],_0xb043('0x32')));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0x10'),_0x4c2321[_0xb043('0x20')],_0xb043('0x33')));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0x11'),_0x4c2321[_0xb043('0x20')],_0xb043('0x34')));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0x12'),_0x4c2321[_0xb043('0x20')],_0xb043('0x5')));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0x3a'),_0x4c2321[_0xb043('0x20')],_0xb043('0x35')));_0x5da867[_0xb043('0x2e')](getAssociatedResources(_0xb043('0x14'),_0x4c2321[_0xb043('0x20')],_0xb043('0x1a')));_0x5da867[_0xb043('0x2e')](db['User'][_0xb043('0x13')](queryAgents));break;case'agent':_0x576c4e[_0x4063dc](_0xb043('0x37'));_0x576c4e[_0x4063dc]('voice:outbound');_0x5da867[_0xb043('0x2e')](_0x4c2321[_0xb043('0x3b')]({'attributes':['id',_0xb043('0x3')]}));_0x5da867[_0xb043('0x2e')](_0x4c2321[_0xb043('0x3c')]({'attributes':['id',_0xb043('0x3')]}));_0x5da867[_0xb043('0x2e')](_0x4c2321[_0xb043('0x3d')]({'attributes':['id',_0xb043('0x3')]}));_0x5da867[_0xb043('0x2e')](_0x4c2321[_0xb043('0x3e')]({'attributes':['id',_0xb043('0x3')]}));_0x5da867[_0xb043('0x2e')](_0x4c2321[_0xb043('0x3f')]({'attributes':['id',_0xb043('0x3')]}));_0x5da867[_0xb043('0x2e')](_0x4c2321[_0xb043('0x40')]({'attributes':['id',_0xb043('0x3')]}));_0x5da867[_0xb043('0x2e')](_0x4c2321[_0xb043('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0xb043('0x42')](_0x5da867);}})[_0xb043('0xb')](function(_0x12d75b){if(_0x12d75b&&_0x12d75b['length']){for(var _0x4f52d7=0x0;_0x4f52d7<_0x12d75b[_0xb043('0x43')];_0x4f52d7+=0x1){for(var _0x49bb42=0x0;_0x49bb42<_0x12d75b[_0x4f52d7][_0xb043('0x43')];_0x49bb42+=0x1){switch(_0x4f52d7){case 0x0:joinOrLeaveQueues(_0x576c4e,_0x4063dc,_0xb043('0x44'),_0x12d75b[_0x4f52d7][_0x49bb42]);break;case 0x1:joinOrLeaveQueues(_0x576c4e,_0x4063dc,_0xb043('0x45'),_0x12d75b[_0x4f52d7][_0x49bb42]);break;case 0x2:joinOrLeaveQueues(_0x576c4e,_0x4063dc,_0xb043('0x46'),_0x12d75b[_0x4f52d7][_0x49bb42]);break;case 0x3:joinOrLeaveQueues(_0x576c4e,_0x4063dc,'sms',_0x12d75b[_0x4f52d7][_0x49bb42]);break;case 0x4:joinOrLeaveQueues(_0x576c4e,_0x4063dc,_0xb043('0x47'),_0x12d75b[_0x4f52d7][_0x49bb42]);break;case 0x5:joinOrLeaveQueues(_0x576c4e,_0x4063dc,_0xb043('0x48'),_0x12d75b[_0x4f52d7][_0x49bb42]);break;case 0x6:joinOrLeaveQueues(_0x576c4e,_0x4063dc,_0xb043('0x49'),_0x12d75b[_0x4f52d7][_0x49bb42]);break;case 0x7:if(_0x517c8d[_0xb043('0x6')]!==_0xb043('0x7'))_0x576c4e[_0x4063dc](util['format'](_0xb043('0x4a'),_0x12d75b[_0x4f52d7][_0x49bb42][_0xb043('0x3')]));break;case 0x8:if(_0x517c8d[_0xb043('0x6')]!==_0xb043('0x7'))_0x576c4e[_0x4063dc](util[_0xb043('0x1b')]('trunk:%s',_0x12d75b[_0x4f52d7][_0x49bb42][_0xb043('0x3')]));break;case 0x9:if(_0x517c8d[_0xb043('0x6')]!=='agent')_0x576c4e[_0x4063dc](util['format'](_0xb043('0x4b'),_0x12d75b[_0x4f52d7][_0x49bb42]['type'],_0x12d75b[_0x4f52d7][_0x49bb42]['name']));break;case 0xa:_0x576c4e[_0x4063dc](util[_0xb043('0x1b')](_0xb043('0x1d'),_0x12d75b[_0x4f52d7][_0x49bb42][_0xb043('0x3')]));break;}}}}})['then'](function(){if(_0x4063dc===_0xb043('0x4c')){var _0x64c575=_[_0xb043('0x17')](_0x517c8d['ChatInteractions'],'id');return _0x517c8d[_0xb043('0x4d')](_0x64c575)['then'](function(){for(var _0x3289b4=0x0;_0x3289b4<_0x64c575[_0xb043('0x43')];_0x3289b4+=0x1){_0xf63fe4[_0xb043('0x4e')](_0xb043('0x4f'),{'ChatInteractionId':Number(_0x64c575[_0x3289b4]),'UserId':Number(_0x517c8d['id'])});}});}})[_0xb043('0xb')](function(){if(_0x4063dc===_0xb043('0x4c')){var _0x2bee2e=_[_0xb043('0x17')](_0x517c8d[_0xb043('0x50')],'id');return _0x517c8d[_0xb043('0x51')](_0x2bee2e)[_0xb043('0xb')](function(){for(var _0x166296=0x0;_0x166296<_0x2bee2e[_0xb043('0x43')];_0x166296+=0x1){_0xf63fe4['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2bee2e[_0x166296]),'UserId':Number(_0x517c8d['id'])});}});}})[_0xb043('0xb')](function(){if(_0x4063dc===_0xb043('0x4c')){var _0x2bd808=_['map'](_0x517c8d[_0xb043('0x24')],'id');return _0x517c8d[_0xb043('0x52')](_0x2bd808)[_0xb043('0xb')](function(){for(var _0x1e199d=0x0;_0x1e199d<_0x2bd808['length'];_0x1e199d+=0x1){_0xf63fe4[_0xb043('0x4e')](_0xb043('0x53'),{'FaxInteractionId':Number(_0x2bd808[_0x1e199d]),'UserId':Number(_0x517c8d['id'])});}});}})[_0xb043('0xb')](function(){if(_0x4063dc===_0xb043('0x4c')){var _0x4aaf04=_[_0xb043('0x17')](_0x517c8d[_0xb043('0x54')],'id');return _0x517c8d[_0xb043('0x55')](_0x4aaf04)[_0xb043('0xb')](function(){for(var _0x478624=0x0;_0x478624<_0x4aaf04[_0xb043('0x43')];_0x478624+=0x1){_0xf63fe4[_0xb043('0x4e')](_0xb043('0x56'),{'SmsInteractionId':Number(_0x4aaf04[_0x478624]),'UserId':Number(_0x517c8d['id'])});}});}})['then'](function(){if(_0x4063dc===_0xb043('0x4c')){var _0x49ab1d=_[_0xb043('0x17')](_0x517c8d[_0xb043('0x27')],'id');return _0x517c8d[_0xb043('0x57')](_0x49ab1d)[_0xb043('0xb')](function(){for(var _0x88bff0=0x0;_0x88bff0<_0x49ab1d[_0xb043('0x43')];_0x88bff0+=0x1){_0xf63fe4['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x49ab1d[_0x88bff0]),'UserId':Number(_0x517c8d['id'])});}});}})[_0xb043('0xb')](function(){if(_0x4063dc===_0xb043('0x4c')){var _0x405528=_[_0xb043('0x17')](_0x517c8d['WhatsappInteractions'],'id');return _0x517c8d[_0xb043('0x58')](_0x405528)[_0xb043('0xb')](function(){for(var _0x371f04=0x0;_0x371f04<_0x405528[_0xb043('0x43')];_0x371f04+=0x1){_0xf63fe4[_0xb043('0x4e')](_0xb043('0x59'),{'WhatsappInteractionId':Number(_0x405528[_0x371f04]),'UserId':Number(_0x517c8d['id'])});}});}})[_0xb043('0x5a')](function(_0x3c2a9e){_0x576c4e[_0xb043('0x5b')](_0x3c2a9e);});}}function onDisconnect(_0x5a51e5,_0x488cb9){joinOrLeave(_0x5a51e5,_0xb043('0x4c'),_0x488cb9);}function onConnect(_0x1d6233){joinOrLeave(_0x1d6233,_0xb043('0x5c'));}exports['default']=function(_0x3136ed){_0x3136ed['on'](_0xb043('0x5d'),function(_0x306cc4){_0x306cc4[_0xb043('0x5e')](0x0);_0x306cc4[_0xb043('0x5f')]=_0x306cc4['request']['connection'][_0xb043('0x60')]+':'+_0x306cc4['request'][_0xb043('0x5d')]['remotePort'];_0x306cc4['connectedAt']=new Date();_0x306cc4['log']=function(_0x54e6b9){console['log']('SocketIO\x20'+_0x306cc4['nsp'][_0xb043('0x3')]+'['+_0x306cc4['address']+']',_0x54e6b9);};_0x306cc4['on'](_0xb043('0x61'),function(){onDisconnect(_0x306cc4,_0x3136ed);_0x306cc4[_0xb043('0x5b')](_0xb043('0x62'));});onConnect(_0x306cc4);_0x306cc4[_0xb043('0x5b')](_0xb043('0x63'));});}; \ No newline at end of file +var _0x9264=['role','name','type','findOne','then','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','ivr','format','length','handshake','query','userProfileId','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','ChatQueues','FaxQueues','Trunk','agent','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','default','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','lodash','util','bluebird','../mysqldb','Agents'];(function(_0x1f4e5e,_0x14a5d5){var _0x5560f9=function(_0x5befd6){while(--_0x5befd6){_0x1f4e5e['push'](_0x1f4e5e['shift']());}};_0x5560f9(++_0x14a5d5);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var BPromise=require(_0x4926('0x2'));var db=require(_0x4926('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x4926('0x4'),'model':db['User'],'attributes':['id','name',_0x4926('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x4926('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x4926('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4926('0x6'),_0x4926('0x7')],'where':{'type':'ivr'}};function getAssociatedResources(_0x18e43d,_0x425893,_0x2a5ce3){return db['UserProfileSection'][_0x4926('0x8')]({'where':{'name':_0x18e43d,'userProfileId':_0x425893},'raw':!![]})[_0x4926('0x9')](function(_0x2affdd){if(_0x2affdd){if(_0x2affdd['autoAssociation']){switch(_0x18e43d){case _0x4926('0xa'):case'ChatQueues':case'FaxQueues':case _0x4926('0xb'):case _0x4926('0xc'):case _0x4926('0xd'):case'WhatsappQueues':return db[_0x2a5ce3][_0x4926('0xe')](queryQueues);case _0x4926('0xf'):return db[_0x2a5ce3][_0x4926('0xe')](queryTelephones);case _0x4926('0x10'):return db[_0x2a5ce3][_0x4926('0xe')](queryTrunks);case _0x4926('0x11'):return db[_0x2a5ce3][_0x4926('0xe')](queryCampaigns);}}else{return db[_0x4926('0x12')][_0x4926('0xe')]({'attributes':[_0x4926('0x13')],'where':{'sectionId':_0x2affdd['id']},'raw':!![]})[_0x4926('0x9')](function(_0x1fbb5d){if(_0x1fbb5d){var _0x3018cb={'where':{'id':_[_0x4926('0x14')](_0x1fbb5d,'resourceId')},'raw':!![]};switch(_0x2a5ce3){case _0x4926('0x15'):_0x3018cb[_0x4926('0x16')][_0x4926('0x5')]='telephone';break;case'Campaign':_0x3018cb[_0x4926('0x16')]['type']=_0x4926('0x17');break;}return db[_0x2a5ce3][_0x4926('0xe')](_0x3018cb);}else{return[];}});}}else{return[];}})['then'](function(_0xc6d161){return _0xc6d161;});}function joinOrLeaveQueues(_0x49461e,_0x37a5c5,_0x3d3fbc,_0x20bb28){_0x49461e[_0x37a5c5](util[_0x4926('0x18')]('%s:queue:%s',_0x3d3fbc,_0x20bb28['name']));if(_0x20bb28[_0x4926('0x4')]){for(var _0x588c7a=0x0;_0x588c7a<_0x20bb28['Agents'][_0x4926('0x19')];_0x588c7a+=0x1){_0x49461e[_0x37a5c5](util[_0x4926('0x18')]('user:%s',_0x20bb28[_0x4926('0x4')][_0x588c7a]['name']));}}}function joinOrLeave(_0x361476,_0x55e459,_0x10d0b2){var _0x34d600;if(_0x361476[_0x4926('0x1a')][_0x4926('0x1b')]['id']){db['User']['find']({'attributes':['id','name',_0x4926('0x5'),_0x4926('0x1c')],'where':{'id':_0x361476[_0x4926('0x1a')][_0x4926('0x1b')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4926('0x1d'),'attributes':['id'],'raw':!![]},{'model':db[_0x4926('0x1e')],'as':_0x4926('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4926('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x4926('0x21')],'as':_0x4926('0x22'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x180421){if(_0x180421){_0x34d600=_0x180421;_0x361476[_0x55e459](util[_0x4926('0x18')](_0x4926('0x23'),_0x180421[_0x4926('0x6')]));var _0x29ba12=[];switch(_0x180421[_0x4926('0x5')]){case'admin':_0x361476[_0x55e459](_0x4926('0x24'));_0x361476[_0x55e459](_0x4926('0x25'));if(queryQueues[_0x4926('0x26')](_0x4926('0x27'))){delete queryQueues[_0x4926('0x27')];}_0x29ba12[_0x4926('0x28')](db[_0x4926('0x29')]['findAll'](queryQueues));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x2a')]['findAll'](queryQueues));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x2b')][_0x4926('0xe')](queryQueues));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x2c')][_0x4926('0xe')](queryQueues));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x2d')][_0x4926('0xe')](queryQueues));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x2e')][_0x4926('0xe')](queryQueues));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x2f')]['findAll'](queryQueues));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x15')][_0x4926('0xe')](queryTelephones));_0x29ba12[_0x4926('0x28')](db['Trunk'][_0x4926('0xe')](queryTrunks));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x30')][_0x4926('0xe')](queryCampaigns));_0x29ba12[_0x4926('0x28')](db['User'][_0x4926('0xe')](queryAgents));break;case _0x4926('0x31'):_0x361476[_0x55e459](_0x4926('0x24'));_0x361476[_0x55e459]('voice:outbound');_0x29ba12[_0x4926('0x28')](getAssociatedResources(_0x4926('0xa'),_0x180421[_0x4926('0x1c')],_0x4926('0x29')));_0x29ba12[_0x4926('0x28')](getAssociatedResources(_0x4926('0x32'),_0x180421['userProfileId'],_0x4926('0x2a')));_0x29ba12[_0x4926('0x28')](getAssociatedResources(_0x4926('0x33'),_0x180421[_0x4926('0x1c')],_0x4926('0x2b')));_0x29ba12['push'](getAssociatedResources(_0x4926('0xb'),_0x180421[_0x4926('0x1c')],_0x4926('0x2c')));_0x29ba12[_0x4926('0x28')](getAssociatedResources('MailQueues',_0x180421['userProfileId'],'MailQueue'));_0x29ba12[_0x4926('0x28')](getAssociatedResources(_0x4926('0xd'),_0x180421[_0x4926('0x1c')],_0x4926('0x2e')));_0x29ba12[_0x4926('0x28')](getAssociatedResources('WhatsappQueues',_0x180421['userProfileId'],'WhatsappQueue'));_0x29ba12['push'](getAssociatedResources(_0x4926('0xf'),_0x180421[_0x4926('0x1c')],_0x4926('0x15')));_0x29ba12[_0x4926('0x28')](getAssociatedResources(_0x4926('0x10'),_0x180421['userProfileId'],_0x4926('0x34')));_0x29ba12[_0x4926('0x28')](getAssociatedResources(_0x4926('0x11'),_0x180421[_0x4926('0x1c')],_0x4926('0x30')));_0x29ba12[_0x4926('0x28')](db[_0x4926('0x15')][_0x4926('0xe')](queryAgents));break;case _0x4926('0x35'):_0x361476[_0x55e459](_0x4926('0x24'));_0x361476[_0x55e459]('voice:outbound');_0x29ba12['push'](_0x180421[_0x4926('0x36')]({'attributes':['id','name']}));_0x29ba12[_0x4926('0x28')](_0x180421[_0x4926('0x37')]({'attributes':['id',_0x4926('0x6')]}));_0x29ba12['push'](_0x180421[_0x4926('0x38')]({'attributes':['id',_0x4926('0x6')]}));_0x29ba12[_0x4926('0x28')](_0x180421[_0x4926('0x39')]({'attributes':['id',_0x4926('0x6')]}));_0x29ba12[_0x4926('0x28')](_0x180421[_0x4926('0x3a')]({'attributes':['id',_0x4926('0x6')]}));_0x29ba12[_0x4926('0x28')](_0x180421[_0x4926('0x3b')]({'attributes':['id',_0x4926('0x6')]}));_0x29ba12[_0x4926('0x28')](_0x180421[_0x4926('0x3c')]({'attributes':['id',_0x4926('0x6')]}));break;}return BPromise[_0x4926('0x3d')](_0x29ba12);}})['then'](function(_0x1ee46d){if(_0x1ee46d&&_0x1ee46d[_0x4926('0x19')]){for(var _0x596c58=0x0;_0x596c58<_0x1ee46d[_0x4926('0x19')];_0x596c58+=0x1){for(var _0x275cf8=0x0;_0x275cf8<_0x1ee46d[_0x596c58][_0x4926('0x19')];_0x275cf8+=0x1){switch(_0x596c58){case 0x0:joinOrLeaveQueues(_0x361476,_0x55e459,'voice',_0x1ee46d[_0x596c58][_0x275cf8]);break;case 0x1:joinOrLeaveQueues(_0x361476,_0x55e459,_0x4926('0x3e'),_0x1ee46d[_0x596c58][_0x275cf8]);break;case 0x2:joinOrLeaveQueues(_0x361476,_0x55e459,_0x4926('0x3f'),_0x1ee46d[_0x596c58][_0x275cf8]);break;case 0x3:joinOrLeaveQueues(_0x361476,_0x55e459,_0x4926('0x40'),_0x1ee46d[_0x596c58][_0x275cf8]);break;case 0x4:joinOrLeaveQueues(_0x361476,_0x55e459,_0x4926('0x41'),_0x1ee46d[_0x596c58][_0x275cf8]);break;case 0x5:joinOrLeaveQueues(_0x361476,_0x55e459,_0x4926('0x42'),_0x1ee46d[_0x596c58][_0x275cf8]);break;case 0x6:joinOrLeaveQueues(_0x361476,_0x55e459,_0x4926('0x43'),_0x1ee46d[_0x596c58][_0x275cf8]);break;case 0x7:if(_0x34d600[_0x4926('0x5')]!==_0x4926('0x35'))_0x361476[_0x55e459](util['format'](_0x4926('0x44'),_0x1ee46d[_0x596c58][_0x275cf8]['name']));break;case 0x8:if(_0x34d600['role']!==_0x4926('0x35'))_0x361476[_0x55e459](util[_0x4926('0x18')]('trunk:%s',_0x1ee46d[_0x596c58][_0x275cf8][_0x4926('0x6')]));break;case 0x9:if(_0x34d600[_0x4926('0x5')]!==_0x4926('0x35'))_0x361476[_0x55e459](util[_0x4926('0x18')](_0x4926('0x45'),_0x1ee46d[_0x596c58][_0x275cf8][_0x4926('0x7')],_0x1ee46d[_0x596c58][_0x275cf8]['name']));break;case 0xa:_0x361476[_0x55e459](util['format']('user:%s',_0x1ee46d[_0x596c58][_0x275cf8]['name']));break;}}}}})[_0x4926('0x9')](function(){if(_0x55e459===_0x4926('0x46')){var _0x8b0177=_[_0x4926('0x14')](_0x34d600[_0x4926('0x47')],'id');return _0x34d600[_0x4926('0x48')](_0x8b0177)['then'](function(){for(var _0xbfafec=0x0;_0xbfafec<_0x8b0177[_0x4926('0x19')];_0xbfafec+=0x1){_0x10d0b2['emit'](_0x4926('0x49'),{'ChatInteractionId':Number(_0x8b0177[_0xbfafec]),'UserId':Number(_0x34d600['id'])});}});}})[_0x4926('0x9')](function(){if(_0x55e459==='leave'){var _0x2e5163=_[_0x4926('0x14')](_0x34d600['MailInteractions'],'id');return _0x34d600[_0x4926('0x4a')](_0x2e5163)['then'](function(){for(var _0x1b0b43=0x0;_0x1b0b43<_0x2e5163[_0x4926('0x19')];_0x1b0b43+=0x1){_0x10d0b2[_0x4926('0x4b')](_0x4926('0x4c'),{'MailInteractionId':Number(_0x2e5163[_0x1b0b43]),'UserId':Number(_0x34d600['id'])});}});}})[_0x4926('0x9')](function(){if(_0x55e459==='leave'){var _0x4d1738=_[_0x4926('0x14')](_0x34d600[_0x4926('0x1f')],'id');return _0x34d600['removeFaxInteractions'](_0x4d1738)[_0x4926('0x9')](function(){for(var _0x172521=0x0;_0x172521<_0x4d1738[_0x4926('0x19')];_0x172521+=0x1){_0x10d0b2['emit'](_0x4926('0x4d'),{'FaxInteractionId':Number(_0x4d1738[_0x172521]),'UserId':Number(_0x34d600['id'])});}});}})[_0x4926('0x9')](function(){if(_0x55e459===_0x4926('0x46')){var _0x2d9b41=_['map'](_0x34d600['SmsInteractions'],'id');return _0x34d600['removeSmsInteractions'](_0x2d9b41)[_0x4926('0x9')](function(){for(var _0x391087=0x0;_0x391087<_0x2d9b41[_0x4926('0x19')];_0x391087+=0x1){_0x10d0b2[_0x4926('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2d9b41[_0x391087]),'UserId':Number(_0x34d600['id'])});}});}})['then'](function(){if(_0x55e459==='leave'){var _0x213f26=_[_0x4926('0x14')](_0x34d600[_0x4926('0x20')],'id');return _0x34d600[_0x4926('0x4e')](_0x213f26)[_0x4926('0x9')](function(){for(var _0x5ad039=0x0;_0x5ad039<_0x213f26[_0x4926('0x19')];_0x5ad039+=0x1){_0x10d0b2[_0x4926('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x213f26[_0x5ad039]),'UserId':Number(_0x34d600['id'])});}});}})['then'](function(){if(_0x55e459===_0x4926('0x46')){var _0x27ef63=_[_0x4926('0x14')](_0x34d600[_0x4926('0x22')],'id');return _0x34d600['removeWhatsappInteractions'](_0x27ef63)['then'](function(){for(var _0x53ada4=0x0;_0x53ada4<_0x27ef63[_0x4926('0x19')];_0x53ada4+=0x1){_0x10d0b2[_0x4926('0x4b')](_0x4926('0x4f'),{'WhatsappInteractionId':Number(_0x27ef63[_0x53ada4]),'UserId':Number(_0x34d600['id'])});}});}})['catch'](function(_0x2630e1){_0x361476['log'](_0x2630e1);});}}function onDisconnect(_0x1696c9,_0x1fb6f5){joinOrLeave(_0x1696c9,'leave',_0x1fb6f5);}function onConnect(_0x9c6909){joinOrLeave(_0x9c6909,'join');}exports[_0x4926('0x50')]=function(_0xb4fc17){_0xb4fc17['on']('connection',function(_0x11276d){_0x11276d[_0x4926('0x51')](0x0);_0x11276d[_0x4926('0x52')]=_0x11276d[_0x4926('0x53')]['connection'][_0x4926('0x54')]+':'+_0x11276d[_0x4926('0x53')]['connection'][_0x4926('0x55')];_0x11276d[_0x4926('0x56')]=new Date();_0x11276d[_0x4926('0x57')]=function(_0x3a88a2){console['log'](_0x4926('0x58')+_0x11276d[_0x4926('0x59')][_0x4926('0x6')]+'['+_0x11276d[_0x4926('0x52')]+']',_0x3a88a2);};_0x11276d['on']('disconnect',function(){onDisconnect(_0x11276d,_0xb4fc17);_0x11276d[_0x4926('0x57')](_0x4926('0x5a'));});onConnect(_0x11276d);_0x11276d[_0x4926('0x57')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 41374e4..865d2a0 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 _0x3bf4=['ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','closedinteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','error','code','catch','Trigger,\x20%s','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','name','agent','incomingmessage','outgoingmessage','offlineMessage','opened','sequelize','SIP/%s','AfterCreate','changed','substatus','find','email','internal','default','length','model','hook','callback','condition','util','../../mysqldb','jayson/promise','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage'];(function(_0x3b811c,_0x1e5435){var _0x126b18=function(_0x493c48){while(--_0x493c48){_0x3b811c['push'](_0x3b811c['shift']());}};_0x126b18(++_0x1e5435);}(_0x3bf4,0x11b));var _0x43bf=function(_0x55ea28,_0x3ade5f){_0x55ea28=_0x55ea28-0x0;var _0x457ac5=_0x3bf4[_0x55ea28];return _0x457ac5;};'use strict';var util=require(_0x43bf('0x0'));var db=require(_0x43bf('0x1'))['db'];var jayson=require(_0x43bf('0x2'));var logger=require('../logger')(_0x43bf('0x3'));var client=jayson[_0x43bf('0x4')][_0x43bf('0x5')]({'port':0x232a});var triggers=[{'channel':_0x43bf('0x6'),'model':_0x43bf('0x7'),'event':_0x43bf('0x8'),'condition':_0x43bf('0x9'),'callback':afterCreate},{'channel':_0x43bf('0x6'),'model':_0x43bf('0x7'),'event':_0x43bf('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x43bf('0x6'),'model':_0x43bf('0xb'),'event':_0x43bf('0x8'),'condition':_0x43bf('0xc'),'callback':afterCreateMessage},{'channel':_0x43bf('0x6'),'model':_0x43bf('0xd'),'event':_0x43bf('0x8'),'condition':_0x43bf('0xc'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x43bf('0xe'),'event':_0x43bf('0x8'),'condition':_0x43bf('0x9'),'callback':afterCreate},{'channel':_0x43bf('0xf'),'model':_0x43bf('0xe'),'event':_0x43bf('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x43bf('0x10'),'event':'afterCreate','condition':_0x43bf('0xc'),'callback':afterCreateMessage},{'channel':_0x43bf('0x11'),'model':_0x43bf('0x12'),'event':_0x43bf('0x8'),'condition':_0x43bf('0x9'),'callback':afterCreate},{'channel':_0x43bf('0x11'),'model':'WhatsappInteraction','event':_0x43bf('0xa'),'condition':_0x43bf('0x13'),'callback':afterUpdate},{'channel':_0x43bf('0x11'),'model':_0x43bf('0x14'),'event':'afterCreate','condition':_0x43bf('0xc'),'callback':afterCreateMessage},{'channel':_0x43bf('0x15'),'model':_0x43bf('0x16'),'event':_0x43bf('0x8'),'condition':_0x43bf('0x9'),'callback':afterCreate},{'channel':_0x43bf('0x15'),'model':_0x43bf('0x16'),'event':'afterUpdate','condition':_0x43bf('0x13'),'callback':afterUpdate},{'channel':_0x43bf('0x15'),'model':_0x43bf('0x17'),'event':_0x43bf('0x8'),'condition':_0x43bf('0xc'),'callback':afterCreateMessage},{'channel':_0x43bf('0x18'),'model':'MailInteraction','event':_0x43bf('0x8'),'condition':_0x43bf('0x9'),'callback':afterCreate},{'channel':_0x43bf('0x18'),'model':'MailInteraction','event':'afterUpdate','condition':_0x43bf('0x13'),'callback':afterUpdate},{'channel':_0x43bf('0x18'),'model':_0x43bf('0x19'),'event':'afterCreate','condition':_0x43bf('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x43bf('0x1a'),'event':_0x43bf('0x8'),'condition':_0x43bf('0x9'),'callback':afterCreate},{'channel':'Openchannel','model':_0x43bf('0x1a'),'event':_0x43bf('0xa'),'condition':_0x43bf('0x13'),'callback':afterUpdate},{'channel':_0x43bf('0x1b'),'model':_0x43bf('0x1c'),'event':_0x43bf('0x8'),'condition':_0x43bf('0xc'),'callback':afterCreateMessage}];function request(_0x5abb9b){return client[_0x43bf('0x1d')](_0x43bf('0x1e'),_0x5abb9b)[_0x43bf('0x1f')](function(_0x4d0357){logger[_0x43bf('0x20')]('Trigger,\x20%s','EventManager',_0x4d0357);if(_0x4d0357[_0x43bf('0x21')]){if(_0x4d0357[_0x43bf('0x21')][_0x43bf('0x22')]===0x1f4){logger[_0x43bf('0x21')]('Trigger,\x20%s',_0x43bf('0x1e'),_0x4d0357[_0x43bf('0x21')]);}}})[_0x43bf('0x23')](function(_0x5446df){logger[_0x43bf('0x21')](_0x43bf('0x24'),_0x43bf('0x1e'),_0x5446df);});}function afterCreateMessage(_0x32c689){return function(_0x492b24){_0x492b24=_0x492b24[_0x43bf('0x25')]({'plain':!![]});_0x492b24[_0x43bf('0x26')]=_0x32c689;_0x492b24[_0x43bf('0x27')]=_0x32c689;_0x492b24[_0x43bf('0x28')]=_0x492b24[_0x43bf('0x29')];Promise[_0x43bf('0x2a')]()[_0x43bf('0x1f')](function(){if(typeof _0x492b24[_0x43bf('0x2b')]===_0x43bf('0x2c'))return null;var _0x23d3bf=_0x43bf('0x2d')+_0x492b24[_0x43bf('0x2b')];return db['sequelize'][_0x43bf('0x2e')](_0x23d3bf,{'type':db[_0x43bf('0x2f')][_0x43bf('0x30')][_0x43bf('0x31')],'raw':!![]});})[_0x43bf('0x1f')](function(_0x47c07f){if(_0x47c07f){_0x492b24[_0x43bf('0x32')]=_0x47c07f[0x0];}if(typeof _0x492b24[_0x43bf('0x33')]===_0x43bf('0x2c'))return;return getAgent(_0x492b24['UserId']);})[_0x43bf('0x1f')](function(_0x31f1f9){if(_0x31f1f9){_0x492b24[_0x43bf('0x34')]=util[_0x43bf('0x35')]('SIP/%s',_0x31f1f9[_0x43bf('0x36')]);_0x492b24[_0x43bf('0x37')]=_0x31f1f9;_0x492b24[_0x43bf('0x26')]=_0x32c689;return request({'event':_0x43bf('0x38'),'message':_0x492b24});}else{return request({'event':_0x43bf('0x39'),'message':_0x492b24});}})['catch'](function(_0x389cef){logger[_0x43bf('0x21')](_0x43bf('0x24'),'AfterCreateMessage',_0x389cef);});};}function afterCreateOfflineMessage(_0x2ea6c4){return function(_0x26fd63){_0x26fd63=_0x26fd63[_0x43bf('0x25')]({'plain':!![]});_0x26fd63['channel']=_0x2ea6c4;_0x26fd63[_0x43bf('0x27')]=_0x2ea6c4;_0x26fd63[_0x43bf('0x28')]=_0x43bf('0x3a');return request({'event':_0x26fd63[_0x43bf('0x28')],'message':_0x26fd63});};}function afterCreate(_0x445432,_0xed1d4f){return function(_0x4d1ef2){_0x4d1ef2=_0x4d1ef2[_0x43bf('0x25')]({'plain':!![]});_0x4d1ef2['channel']=_0x445432;_0x4d1ef2['motionChannel']=_0x445432;_0x4d1ef2['event']=_0x43bf('0x3b');Promise['resolve']()[_0x43bf('0x1f')](function(){var _0xac5ff=_0x43bf('0x2d')+_0x4d1ef2['ContactId'];return db[_0x43bf('0x3c')][_0x43bf('0x2e')](_0xac5ff,{'type':db['Sequelize']['QueryTypes'][_0x43bf('0x31')],'raw':!![]});})[_0x43bf('0x1f')](function(_0x4f92d6){if(_0x4f92d6){_0x4d1ef2[_0x43bf('0x32')]=_0x4f92d6[0x0];}if(typeof _0x4d1ef2[_0x43bf('0x33')]===_0x43bf('0x2c'))return;return getAgent(_0x4d1ef2[_0x43bf('0x33')]);})[_0x43bf('0x1f')](function(_0x3c3a0f){if(_0x3c3a0f){_0x4d1ef2[_0x43bf('0x34')]=util[_0x43bf('0x35')](_0x43bf('0x3d'),_0x3c3a0f[_0x43bf('0x36')]);_0x4d1ef2[_0x43bf('0x37')]=_0x3c3a0f;}return request({'event':_0xed1d4f,'message':_0x4d1ef2});})['catch'](function(_0x52eec7){logger[_0x43bf('0x21')](_0x43bf('0x24'),_0x43bf('0x3e'),_0x52eec7);});};}function afterUpdate(_0x3d9ffe){return function(_0x463e3e){var _0xb21bf0=_0x463e3e[_0x43bf('0x3f')]('closed')&&_0x463e3e['closed'];var _0x4c15ba=_0x463e3e['changed'](_0x43bf('0x40'));if(_0xb21bf0||_0x4c15ba){var _0xdfbeca=_0xb21bf0?_0x43bf('0x13'):'substatus';var _0x343d6b=_0x463e3e[_0x43bf('0x25')]({'plain':!![]});_0x343d6b[_0x43bf('0x26')]=_0x3d9ffe;_0x343d6b[_0x43bf('0x27')]=_0x3d9ffe;_0x343d6b['event']=_0xb21bf0?'closed':'substatus';var _0x23c694=_0x43bf('0x2d')+_0x343d6b[_0x43bf('0x2b')];return db[_0x43bf('0x3c')][_0x43bf('0x2e')](_0x23c694,{'type':db['Sequelize'][_0x43bf('0x30')]['SELECT'],'raw':!![]})[_0x43bf('0x1f')](function(_0x478990){if(_0x478990){_0x343d6b[_0x43bf('0x32')]=_0x478990[0x0];}if(typeof _0x343d6b[_0x43bf('0x33')]===_0x43bf('0x2c'))return;return getAgent(_0x343d6b['UserId']);})[_0x43bf('0x1f')](function(_0x78d853){if(_0x78d853){_0x343d6b['interface']=util[_0x43bf('0x35')](_0x43bf('0x3d'),_0x78d853[_0x43bf('0x36')]);_0x343d6b[_0x43bf('0x37')]=_0x78d853;}return request({'event':_0xdfbeca,'message':_0x343d6b});})['catch'](function(_0x58ea59){logger[_0x43bf('0x21')](_0x43bf('0x24'),'AfterUpdate',_0x58ea59);});}};}function getAgent(_0x39d50e){return db['User'][_0x43bf('0x41')]({'where':{'id':_0x39d50e},'attributes':['id',_0x43bf('0x36'),'fullname',_0x43bf('0x42'),_0x43bf('0x43')],'raw':!![]})[_0x43bf('0x1f')](function(_0x2364e7){return _0x2364e7;});}exports[_0x43bf('0x44')]=function(){for(var _0x2d5ed3=0x0;_0x2d5ed3=_0x27b836[_0x7a33('0x16')]){throw Error(_0x7a33('0x17'));}_0x351afc(_0x26f3f3);})[_0x7a33('0x18')](function(_0xbbae3a){_0x86b76c(_0xbbae3a);});});}; \ No newline at end of file +var _0xc99b=['isValidChannel','toLowerCase','updateAttributes','getLicense','role','agent','then','agents','lodash','../mysqldb','./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels'];(function(_0x21a994,_0x5aa2f4){var _0x11ea15=function(_0x32af12){while(--_0x32af12){_0x21a994['push'](_0x21a994['shift']());}};_0x11ea15(++_0x5aa2f4);}(_0xc99b,0x128));var _0xbc99=function(_0x2dfe07,_0x2b663f){_0x2dfe07=_0x2dfe07-0x0;var _0x30aee0=_0xc99b[_0x2dfe07];return _0x30aee0;};'use strict';var _=require(_0xbc99('0x0'));var BPromise=require('bluebird');var db=require(_0xbc99('0x1'))['db'];var util=require(_0xbc99('0x2'));var channels=[_0xbc99('0x3'),_0xbc99('0x4'),_0xbc99('0x5'),'fax',_0xbc99('0x6'),_0xbc99('0x7'),_0xbc99('0x8')];exports[_0xbc99('0x9')]=function(){return channels;};exports[_0xbc99('0xa')]=function(_0x1c8737){_0x1c8737=_0x1c8737[_0xbc99('0xb')]();return _['includes'](channels,_0x1c8737);};exports['clearBlockUser']=function(_0x729866,_0x1bb4a2,_0x3a4e6a,_0x361c45){var _0x5c3709={'loginAttempts':_0x1bb4a2,'blocked':_0x3a4e6a};if(!_['isUndefined'](_0x361c45)){_0x5c3709['blockedAt']=_0x361c45;}return _0x729866[_0xbc99('0xc')](_0x5c3709);};exports[_0xbc99('0xd')]=function(_0x3b31e4){return new BPromise(function(_0x1b9d1f,_0x5e47e0){var _0x224dc1=0x0;if(_0x3b31e4[_0xbc99('0xe')]!==_0xbc99('0xf')){_0x1b9d1f(_0x3b31e4);}db['User']['count']({'where':{'role':_0xbc99('0xf'),'online':!![],'id':{'$ne':_0x3b31e4['id']}}})[_0xbc99('0x10')](function(_0x16edf4){_0x224dc1=_0x16edf4;return util[_0xbc99('0xd')]();})[_0xbc99('0x10')](function(_0x153b6c){if(_0x153b6c&&_0x153b6c[_0xbc99('0x11')]&&_0x224dc1>=_0x153b6c[_0xbc99('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1b9d1f(_0x3b31e4);})['catch'](function(_0x50a40e){_0x5e47e0(_0x50a40e);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index dfb4263..ae52a83 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','message','Not\x20Found','Forbidden','error','status','send','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3cebfc,_0x32c1c2){_0x3cebfc=_0x3cebfc-0x0;var _0x126265=_0x6f0d[_0x3cebfc];return _0x126265;};'use strict';var util=require('util');var logger=require(_0xd6f0('0x0'))(_0xd6f0('0x1'));var APIError=function(_0xd1480,_0x107a8c){this['message']=_0xd1480||_0xd6f0('0x2');this[_0xd6f0('0x3')]=_0x107a8c||_0xd6f0('0x4');util[_0xd6f0('0x5')](APIError,Error);};var APIBadRequestError=function(_0x3a757f){this['message']=_0x3a757f||_0xd6f0('0x6');this['name']=_0xd6f0('0x6');util[_0xd6f0('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x8b89a9){this[_0xd6f0('0x7')]=_0x8b89a9||'Entity\x20not\x20found';this['name']=_0xd6f0('0x8');util[_0xd6f0('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x2854cd){switch(_0x2854cd){case _0xd6f0('0x6'):return 0x190;case _0xd6f0('0x9'),'OutOfInterval':return 0x193;case _0xd6f0('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xee144c){return function(_0x329f69){logger[_0xd6f0('0xa')](_0x329f69['stack']);var _0x1ce8d5=getStatusCode(_0x329f69[_0xd6f0('0x3')]);if(_0x329f69[_0xd6f0('0x3')])delete _0x329f69[_0xd6f0('0x3')];return _0xee144c[_0xd6f0('0xb')](_0x1ce8d5)[_0xd6f0('0xc')](_0x329f69);};}module[_0xd6f0('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x0713=['Not\x20Found','Forbidden','OutOfInterval','error','stack','status','exports','api','message','Internal\x20Server\x20Error','Error','inherits','Bad\x20Request','name','Entity\x20not\x20found'];(function(_0xa79418,_0x1bc551){var _0x340166=function(_0x39ff89){while(--_0x39ff89){_0xa79418['push'](_0xa79418['shift']());}};_0x340166(++_0x1bc551);}(_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 diff --git a/server/errors/index.js b/server/errors/index.js index 0d34acd..3a77255 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13ee=['send','exports','404','status','render','json'];(function(_0x119066,_0x105799){var _0x54ebbb=function(_0x56895a){while(--_0x56895a){_0x119066['push'](_0x119066['shift']());}};_0x54ebbb(++_0x105799);}(_0x13ee,0x1f3));var _0xe13e=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x13ee[_0x5e2cb4];return _0x282902;};'use strict';module[_0xe13e('0x0')][0x194]=function pageNotFound(_0x20c286,_0x36f03e){var _0x1d18e9=_0xe13e('0x1');var _0x1528cc=0x194;var _0x362f32={'status':_0x1528cc};_0x36f03e[_0xe13e('0x2')](_0x362f32[_0xe13e('0x2')]);_0x36f03e[_0xe13e('0x3')](_0x1d18e9,{},function(_0x337f9e,_0x2af722){if(_0x337f9e){return _0x36f03e['status'](_0x362f32[_0xe13e('0x2')])[_0xe13e('0x4')](_0x362f32);}_0x36f03e[_0xe13e('0x5')](_0x2af722);});}; \ No newline at end of file +var _0x1166=['404','status','render','send','exports'];(function(_0x13d71e,_0x1ab6a1){var _0x2dc8aa=function(_0x466e63){while(--_0x466e63){_0x13d71e['push'](_0x13d71e['shift']());}};_0x2dc8aa(++_0x1ab6a1);}(_0x1166,0x1a8));var _0x6116=function(_0x1a2975,_0x106a67){_0x1a2975=_0x1a2975-0x0;var _0x5f4245=_0x1166[_0x1a2975];return _0x5f4245;};'use strict';module[_0x6116('0x0')][0x194]=function pageNotFound(_0x52921c,_0x69d25f){var _0x119d23=_0x6116('0x1');var _0x24e8a0=0x194;var _0xc05b97={'status':_0x24e8a0};_0x69d25f[_0x6116('0x2')](_0xc05b97[_0x6116('0x2')]);_0x69d25f[_0x6116('0x3')](_0x119d23,{},function(_0x55f2a3,_0x429d09){if(_0x55f2a3){return _0x69d25f['status'](_0xc05b97[_0x6116('0x2')])['json'](_0xc05b97);}_0x69d25f[_0x6116('0x4')](_0x429d09);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 62d420e..21bdbd2 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffc2=['../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','Campaign','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','userSetting','UserId','VoiceRecording','hasMany','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','UserNotification','SenderId','belongsTo','ChatGroup','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','WhatsappInteractions','VoiceQueues','VoicePrefixes','UserMailQueue','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','ChatWebsite','ChatWebsites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Teams','TeamVoiceQueue','BlackLists','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','AgentReports','Contact','MailServerIn','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','MailAccountId','Messages','Interactions','List','mandatoryDispositionPauseId','Agents','team_has_mail_queues','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','MailInteractionId','Account','ChatWebsiteId','ChatOfflineMessageId','MailApplication','TagId','ListId','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','user_has_chat_websites','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','CompanyId','HopperHistories','MailInteractions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','CampaignId','OneAll','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmField','DeskField','DeskAccount','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','MailQueues','ChatQueues','team_has_whatsapp_queues','WhatsappQueues','TeamVoicePrefix','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','userProfileId','UserProfileSection','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation'];(function(_0x1f2356,_0x16c352){var _0x1b6efa=function(_0xfa9ec9){while(--_0xfa9ec9){_0x1f2356['push'](_0x1f2356['shift']());}};_0x1b6efa(++_0x16c352);}(_0xffc2,0x17a));var _0x2ffc=function(_0xcfe0ed,_0x3feab1){_0xcfe0ed=_0xcfe0ed-0x0;var _0x15bdec=_0xffc2[_0xcfe0ed];return _0x15bdec;};'use strict';var config=require(_0x2ffc('0x0'));var Sequelize=require(_0x2ffc('0x1'));var _=require(_0x2ffc('0x2'));var jstz=require(_0x2ffc('0x3'));var timezone=jstz[_0x2ffc('0x4')]();config[_0x2ffc('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x2ffc('0x5'),'username':'xcall','password':_0x2ffc('0x6'),'options':{'host':_0x2ffc('0x7'),'port':0xcea,'dialect':_0x2ffc('0x8'),'dialectOptions':{'charset':_0x2ffc('0x9')},'logging':![],'timezone':timezone[_0x2ffc('0xa')](),'define':{'charset':_0x2ffc('0xb'),'collate':_0x2ffc('0xc')}}});config[_0x2ffc('0xd')]=_['defaultsDeep'](config[_0x2ffc('0xd')],{'database':_0x2ffc('0x5'),'username':'xcall','password':_0x2ffc('0x6'),'options':{'host':_0x2ffc('0x7'),'port':0xcea,'dialect':_0x2ffc('0x8'),'dialectOptions':{'charset':_0x2ffc('0x9')},'logging':![],'timezone':timezone[_0x2ffc('0xa')](),'define':{'charset':_0x2ffc('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2ffc('0x1')][_0x2ffc('0xe')],config[_0x2ffc('0x1')][_0x2ffc('0xf')],config[_0x2ffc('0x1')][_0x2ffc('0x10')],config['sequelize'][_0x2ffc('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2ffc('0xd')][_0x2ffc('0xe')],config[_0x2ffc('0xd')][_0x2ffc('0xf')],config[_0x2ffc('0xd')][_0x2ffc('0x10')],config[_0x2ffc('0xd')][_0x2ffc('0x11')])};db[_0x2ffc('0x12')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x14'));db[_0x2ffc('0x15')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x16'));db[_0x2ffc('0x17')]=db[_0x2ffc('0x1')]['import']('../api/voiceContext/voiceContext.model');db[_0x2ffc('0x18')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x2ffc('0x19')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0x1a'));db[_0x2ffc('0x1b')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x1c'));db['VoiceRecording']=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x2ffc('0x1d')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0x1e'));db[_0x2ffc('0x1f')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x20'));db[_0x2ffc('0x21')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x22'));db[_0x2ffc('0x23')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x24'));db['VoiceDialReport']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x25'));db[_0x2ffc('0x26')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x27'));db['VoiceQueueReport']=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x2ffc('0x28')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x29'));db[_0x2ffc('0x2a')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x2b'));db[_0x2ffc('0x2c')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x2ffc('0x2d')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x2ffc('0x2e')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x2f'));db[_0x2ffc('0x30')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x31'));db['UserMailQueue']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x32'));db[_0x2ffc('0x33')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x34'));db[_0x2ffc('0x35')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x36'));db['UserOpenchannelQueue']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x37'));db[_0x2ffc('0x38')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x39'));db['MailServerIn']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x3a'));db[_0x2ffc('0x3b')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x3c'));db[_0x2ffc('0x3d')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x3e'));db[_0x2ffc('0x3f')]=db['sequelize']['import'](_0x2ffc('0x40'));db[_0x2ffc('0x41')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x42'));db[_0x2ffc('0x43')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x44'));db['MailApplication']=db['sequelize']['import'](_0x2ffc('0x45'));db[_0x2ffc('0x46')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x47'));db[_0x2ffc('0x48')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/dashboard/dashboard.model');db[_0x2ffc('0x49')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x4a'));db[_0x2ffc('0x4b')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x4c'));db[_0x2ffc('0x4d')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/faxApplication/faxApplication.model');db[_0x2ffc('0x4e')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x4f'));db[_0x2ffc('0x50')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x51'));db[_0x2ffc('0x52')]=db['sequelize']['import'](_0x2ffc('0x53'));db[_0x2ffc('0x54')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x55'));db[_0x2ffc('0x56')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x57'));db[_0x2ffc('0x58')]=db['sequelize'][_0x2ffc('0x13')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x59'));db['SmsMessage']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x5a'));db[_0x2ffc('0x5b')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x5c'));db[_0x2ffc('0x5d')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x5e'));db['OpenchannelApplication']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x5f'));db['OpenchannelInteraction']=db[_0x2ffc('0x1')]['import'](_0x2ffc('0x60'));db[_0x2ffc('0x61')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x62'));db[_0x2ffc('0x63')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x64'));db['ChatWebsite']=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x2ffc('0x65')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x66'));db[_0x2ffc('0x67')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x68'));db[_0x2ffc('0x69')]=db['sequelize'][_0x2ffc('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x2ffc('0x6a')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x6b'));db[_0x2ffc('0x6c')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x2ffc('0x6d')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x6e'));db['ChatGroup']=db['sequelize'][_0x2ffc('0x13')]('../api/chatGroup/chatGroup.model');db[_0x2ffc('0x6f')]=db[_0x2ffc('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x2ffc('0x70')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x71'));db[_0x2ffc('0x72')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x73'));db[_0x2ffc('0x74')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x75'));db[_0x2ffc('0x76')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x77'));db[_0x2ffc('0x78')]=db['sequelize'][_0x2ffc('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x79'));db[_0x2ffc('0x7a')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x7b'));db[_0x2ffc('0x7c')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x2ffc('0x7d')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x7e'));db[_0x2ffc('0x7f')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x80'));db[_0x2ffc('0x81')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x2ffc('0x82')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/disposition/disposition.model');db[_0x2ffc('0x83')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0x84'));db[_0x2ffc('0x85')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0x86'));db['Pause']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x87'));db[_0x2ffc('0x88')]=db[_0x2ffc('0x1')]['import']('../api/cdr/cdr.model');db[_0x2ffc('0x89')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0x8a'));db[_0x2ffc('0x8b')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x8c'));db[_0x2ffc('0x8d')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x8e'));db[_0x2ffc('0x8f')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x90'));db[_0x2ffc('0x91')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0x92'));db[_0x2ffc('0x93')]=db['sequelize']['import'](_0x2ffc('0x94'));db[_0x2ffc('0x95')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x96'));db[_0x2ffc('0x97')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/template/template.model');db[_0x2ffc('0x98')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/trigger/trigger.model');db[_0x2ffc('0x99')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x9a'));db[_0x2ffc('0x9b')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x9c'));db[_0x2ffc('0x9d')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x9e'));db[_0x2ffc('0x9f')]=db[_0x2ffc('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x2ffc('0xa0')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x2ffc('0xa1')]=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x2ffc('0xa2')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xa3'));db[_0x2ffc('0xa4')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xa5'));db['AnalyticTreeReport']=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xa6'));db['SalesforceAccount']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xa7'));db[_0x2ffc('0xa8')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x2ffc('0xa9')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xaa'));db[_0x2ffc('0xab')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x2ffc('0xac')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xad'));db['SugarcrmField']=db['sequelize'][_0x2ffc('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xae'));db[_0x2ffc('0xaf')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xb0'));db['DeskField']=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xb1'));db[_0x2ffc('0xb2')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x2ffc('0xb3')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xb4'));db[_0x2ffc('0xb5')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xb6'));db[_0x2ffc('0xb7')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xb8'));db[_0x2ffc('0xb9')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xba'));db[_0x2ffc('0xbb')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xbc'));db['FreshdeskAccount']=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x2ffc('0xbd')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xbe'));db[_0x2ffc('0xbf')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x2ffc('0xc0')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xc1'));db[_0x2ffc('0xc2')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xc3'));db[_0x2ffc('0xc4')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xc5'));db[_0x2ffc('0xc6')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xc7'));db[_0x2ffc('0xc8')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xc9'));db[_0x2ffc('0xca')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0x2ffc('0xcb')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xcc'));db[_0x2ffc('0xcd')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xce'));db[_0x2ffc('0xcf')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x2ffc('0xd0')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x2ffc('0xd1')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xd2'));db[_0x2ffc('0xd3')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xd4'));db[_0x2ffc('0x9b')]=db[_0x2ffc('0x1')]['import']('../api/integration/integration.model');db[_0x2ffc('0xd5')]=db['sequelize']['import']('../api/network/network.model');db[_0x2ffc('0xd6')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xd7'));db['ChatInternalMessage']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xd8'));db['JscriptyAnswerReport']=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xd9'));db['JscriptyQuestionReport']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xda'));db[_0x2ffc('0xdb')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x2ffc('0xdc')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xdd'));db[_0x2ffc('0xde')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xdf'));db[_0x2ffc('0xe0')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xe1'));db[_0x2ffc('0xe2')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xe3'));db[_0x2ffc('0xe4')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xe5'));db['SquareOdbc']=db[_0x2ffc('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x2ffc('0xe6')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xe7'));db[_0x2ffc('0xe8')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xe9'));db[_0x2ffc('0xea')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xeb'));db['Team']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xec'));db[_0x2ffc('0xed')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/license/license.model');db[_0x2ffc('0xee')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/campaign/campaign.model');db['Migration']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xef'));db[_0x2ffc('0xf0')]=db['sequelize'][_0x2ffc('0x13')]('../api/attachment/attachment.model');db[_0x2ffc('0xf1')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xf2'));db[_0x2ffc('0xf3')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0xf4'));db[_0x2ffc('0xf5')]=db[_0x2ffc('0x1')]['import'](_0x2ffc('0xf6'));db[_0x2ffc('0xf7')]=db['sequelize'][_0x2ffc('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x2ffc('0xf8')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xf9'));db[_0x2ffc('0xfa')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xfb'));db[_0x2ffc('0xfc')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xfd'));db[_0x2ffc('0xfe')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0xff'));db[_0x2ffc('0x100')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x101'));db['UserProfileResource']=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x102'));db[_0x2ffc('0x103')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x104'));db[_0x2ffc('0x105')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0x2ffc('0x106')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x2ffc('0x107')]=db[_0x2ffc('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x108'));db[_0x2ffc('0x109')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x10a'));db[_0x2ffc('0x10b')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x10c'));db[_0x2ffc('0x10d')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x10e'));db['TeamVoiceQueue']=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x10f'));db['TeamVoicePrefix']=db[_0x2ffc('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x2ffc('0x110')]=db[_0x2ffc('0x1')][_0x2ffc('0x13')](_0x2ffc('0x111'));db[_0x2ffc('0x112')]=db['sequelize'][_0x2ffc('0x13')](_0x2ffc('0x113'));db[_0x2ffc('0x12')][_0x2ffc('0x114')](db[_0x2ffc('0x1f')],{'as':'VoiceMail','onDelete':_0x2ffc('0x115'),'foreignKey':'UserId'});db[_0x2ffc('0x12')]['hasOne'](db[_0x2ffc('0x112')],{'as':_0x2ffc('0x116'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')]['hasMany'](db[_0x2ffc('0x118')],{'as':'Recordings','foreignKey':'UserId'});db[_0x2ffc('0x12')][_0x2ffc('0x119')](db[_0x2ffc('0x2d')],{'as':'VoiceQueuesRt','foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')][_0x2ffc('0x119')](db[_0x2ffc('0x18')],{'as':_0x2ffc('0x11a'),'onDelete':_0x2ffc('0x115'),'hooks':!![]});db[_0x2ffc('0x12')][_0x2ffc('0x119')](db[_0x2ffc('0x78')],{'as':_0x2ffc('0x11b'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')]['hasMany'](db[_0x2ffc('0x11c')],{'as':_0x2ffc('0x11d'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')][_0x2ffc('0x119')](db[_0x2ffc('0x7a')],{'as':_0x2ffc('0x7a'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')][_0x2ffc('0x119')](db[_0x2ffc('0x11e')],{'as':_0x2ffc('0x11f'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')]['hasMany'](db[_0x2ffc('0x69')],{'as':_0x2ffc('0x120'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')]['hasMany'](db[_0x2ffc('0x121')],{'as':_0x2ffc('0x122'),'foreignKey':_0x2ffc('0x117')});db['User'][_0x2ffc('0x119')](db['FaxInteraction'],{'as':_0x2ffc('0x123'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')][_0x2ffc('0x119')](db[_0x2ffc('0x41')],{'as':'MailInteractions','foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')][_0x2ffc('0x119')](db[_0x2ffc('0x106')],{'as':'WhatsappInteractions','foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x12')]['hasMany'](db[_0x2ffc('0x124')],{'as':'UserNotifications','foreignKey':_0x2ffc('0x125')});db[_0x2ffc('0x12')][_0x2ffc('0x126')](db[_0x2ffc('0x100')],{'as':_0x2ffc('0x100'),'foreignKey':'userProfileId'});db[_0x2ffc('0x12')]['belongsToMany'](db[_0x2ffc('0x127')],{'as':'Groups','through':_0x2ffc('0x128')});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db['CmContact'],{'as':_0x2ffc('0x12a'),'through':_0x2ffc('0x12b')});db['User'][_0x2ffc('0x129')](db[_0x2ffc('0xfc')],{'as':'Lists','through':_0x2ffc('0x12c')});db[_0x2ffc('0x12')]['belongsToMany'](db[_0x2ffc('0x12d')],{'through':_0x2ffc('0x12e')});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x41')],{'as':'MailInteractions','through':_0x2ffc('0x12f')});db['User'][_0x2ffc('0x129')](db['ChatInteraction'],{'as':_0x2ffc('0x120'),'through':'user_has_chat_interactions'});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db['FaxInteraction'],{'as':_0x2ffc('0x123'),'through':_0x2ffc('0x130')});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db['SmsInteraction'],{'as':_0x2ffc('0x122'),'through':'user_has_sms_interactions'});db[_0x2ffc('0x12')]['belongsToMany'](db[_0x2ffc('0x11e')],{'as':_0x2ffc('0x11f'),'through':'user_has_openchannel_interactions'});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x106')],{'as':_0x2ffc('0x131'),'through':'user_has_whatsapp_interactions'});db['User'][_0x2ffc('0x129')](db[_0x2ffc('0x1b')],{'as':_0x2ffc('0x132'),'through':_0x2ffc('0x2e'),'required':![]});db['User'][_0x2ffc('0x129')](db['VoicePrefix'],{'as':_0x2ffc('0x133'),'through':_0x2ffc('0x110'),'required':![]});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x3d')],{'as':'MailQueues','through':_0x2ffc('0x134'),'required':![]});db['User'][_0x2ffc('0x129')](db['ChatQueue'],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db['FaxQueue'],{'as':_0x2ffc('0x135'),'through':'UserFaxQueue','required':![]});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x5b')],{'as':_0x2ffc('0x136'),'through':_0x2ffc('0x35'),'required':![]});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x63')],{'as':_0x2ffc('0x137'),'through':_0x2ffc('0x138'),'required':![]});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x10b')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User']['belongsToMany'](db[_0x2ffc('0xfc')],{'through':_0x2ffc('0x12c')});db['User'][_0x2ffc('0x129')](db[_0x2ffc('0x139')],{'as':_0x2ffc('0x13a'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x2ffc('0x4b')],{'as':_0x2ffc('0x13b'),'through':'user_has_fax_accounts'});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x13c')],{'as':_0x2ffc('0x13d'),'through':_0x2ffc('0x13e')});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x5d')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db['SmsAccount'],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0x103')],{'as':_0x2ffc('0x13f'),'through':_0x2ffc('0x140')});db[_0x2ffc('0x12')][_0x2ffc('0x129')](db[_0x2ffc('0xe6')],{'as':'SquareProjects','through':_0x2ffc('0x141')});db[_0x2ffc('0x15')][_0x2ffc('0x119')](db[_0x2ffc('0x18')],{'as':_0x2ffc('0x142'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x143')});db[_0x2ffc('0x17')][_0x2ffc('0x119')](db[_0x2ffc('0x18')],{'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x18')][_0x2ffc('0x119')](db[_0x2ffc('0x18')],{'as':_0x2ffc('0x144'),'onDelete':_0x2ffc('0x115')});db['VoiceMusicOnHold'][_0x2ffc('0x129')](db['Sound'],{'as':_0x2ffc('0x145'),'through':_0x2ffc('0x146')});db[_0x2ffc('0x1b')][_0x2ffc('0x119')](db[_0x2ffc('0x2d')],{'as':'Members','foreignKey':_0x2ffc('0x147')});db['VoiceQueue']['hasMany'](db['CmHopper'],{'as':_0x2ffc('0x148'),'foreignKey':'VoiceQueueId'});db[_0x2ffc('0x1b')][_0x2ffc('0x119')](db[_0x2ffc('0x78')],{'as':_0x2ffc('0x11b'),'foreignKey':_0x2ffc('0x147')});db[_0x2ffc('0x1b')]['hasMany'](db[_0x2ffc('0x11c')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x2ffc('0x7a')],{'as':_0x2ffc('0x7a'),'foreignKey':_0x2ffc('0x147')});db[_0x2ffc('0x1b')][_0x2ffc('0x119')](db[_0x2ffc('0x76')],{'as':_0x2ffc('0x149'),'foreignKey':_0x2ffc('0x147')});db['VoiceQueue'][_0x2ffc('0x119')](db[_0x2ffc('0xdb')],{'as':_0x2ffc('0x14a'),'foreignKey':_0x2ffc('0x147')});db['VoiceQueue'][_0x2ffc('0x126')](db[_0x2ffc('0x2a')],{'as':_0x2ffc('0x2a'),'foreignKey':_0x2ffc('0x14b')});db['VoiceQueue'][_0x2ffc('0x126')](db[_0x2ffc('0x2a')],{'as':_0x2ffc('0x14c'),'foreignKey':_0x2ffc('0x14d')});db[_0x2ffc('0x1b')][_0x2ffc('0x126')](db[_0x2ffc('0x85')],{'as':_0x2ffc('0x85'),'foreignKey':_0x2ffc('0x14e')});db[_0x2ffc('0x1b')][_0x2ffc('0x126')](db[_0x2ffc('0x14f')],{'as':_0x2ffc('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x2ffc('0x129')](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x151'),'through':_0x2ffc('0x152')});db['VoiceQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0x2ffc('0x2e')});db[_0x2ffc('0x1b')]['belongsToMany'](db[_0x2ffc('0x12d')],{'as':_0x2ffc('0x153'),'through':_0x2ffc('0x154')});db['VoiceQueue'][_0x2ffc('0x129')](db['CmList'],{'as':_0x2ffc('0x155'),'through':'voice_queues_has_cm_blacklists'});db[_0x2ffc('0x118')][_0x2ffc('0x126')](db['User'],{'as':_0x2ffc('0x12'),'foreignKey':'UserId'});db[_0x2ffc('0x1d')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x12'),'foreignKey':'UserId'});db[_0x2ffc('0x1f')][_0x2ffc('0x119')](db[_0x2ffc('0x21')],{'as':'Messages','onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x156'),'sourceKey':'mailbox'});db[_0x2ffc('0x21')][_0x2ffc('0x126')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x2ffc('0x157')});db[_0x2ffc('0x23')][_0x2ffc('0x119')](db[_0x2ffc('0x158')],{'as':_0x2ffc('0x159'),'foreignKey':'uniqueid','constraints':![]});db[_0x2ffc('0x23')]['hasMany'](db[_0x2ffc('0x26')],{'as':_0x2ffc('0x15a'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x2ffc('0x12')],{'as':'User','foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x23')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':'ContactId'});db[_0x2ffc('0x15c')]['belongsTo'](db[_0x2ffc('0x13c')],{'as':_0x2ffc('0x13c'),'foreignKey':'MailAccountId'});db['MailServerIn']['belongsTo'](db[_0x2ffc('0x10d')],{'as':'CloudProvider','foreignKey':_0x2ffc('0x15d'),'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x3b')][_0x2ffc('0x126')](db[_0x2ffc('0x13c')],{'as':_0x2ffc('0x13c'),'foreignKey':'MailAccountId'});db[_0x2ffc('0x3b')][_0x2ffc('0x126')](db[_0x2ffc('0x10d')],{'as':_0x2ffc('0x10d'),'foreignKey':'CloudProviderId','onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x13c')]['hasOne'](db['MailServerIn'],{'as':_0x2ffc('0x15f'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x13c')][_0x2ffc('0x114')](db['MailServerOut'],{'as':_0x2ffc('0x160'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x13c')]['hasMany'](db['Disposition'],{'as':_0x2ffc('0x161'),'foreignKey':'MailAccountId','onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x13c')][_0x2ffc('0x119')](db[_0x2ffc('0x81')],{'as':_0x2ffc('0x162'),'foreignKey':_0x2ffc('0x163')});db[_0x2ffc('0x13c')][_0x2ffc('0x119')](db[_0x2ffc('0x43')],{'as':_0x2ffc('0x164'),'foreignKey':_0x2ffc('0x163')});db[_0x2ffc('0x13c')][_0x2ffc('0x119')](db['MailInteraction'],{'as':_0x2ffc('0x165')});db[_0x2ffc('0x13c')][_0x2ffc('0x119')](db['MailApplication'],{'as':_0x2ffc('0x144')});db['MailAccount']['belongsTo'](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x166'),'foreignKey':'ListId'});db[_0x2ffc('0x13c')][_0x2ffc('0x126')](db['Template'],{'as':_0x2ffc('0x97'),'foreignKey':'TemplateId'});db[_0x2ffc('0x13c')][_0x2ffc('0x126')](db[_0x2ffc('0x14f')],{'as':_0x2ffc('0x150'),'foreignKey':_0x2ffc('0x167')});db[_0x2ffc('0x13c')][_0x2ffc('0x129')](db['User'],{'as':'Agents','through':_0x2ffc('0x13e')});db[_0x2ffc('0x3d')]['belongsToMany'](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x134')});db[_0x2ffc('0x3d')]['belongsToMany'](db[_0x2ffc('0x12d')],{'through':_0x2ffc('0x169'),'as':_0x2ffc('0x153')});db[_0x2ffc('0x41')][_0x2ffc('0x119')](db['MailMessage'],{'as':'Messages','onDelete':_0x2ffc('0x115'),'foreignKey':'MailInteractionId'});db[_0x2ffc('0x41')][_0x2ffc('0x126')](db[_0x2ffc('0x13c')],{'as':'Account','foreignKey':_0x2ffc('0x163')});db[_0x2ffc('0x41')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0x41')]['belongsTo'](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16b'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x41')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x16c'),'as':_0x2ffc('0x16d')});db[_0x2ffc('0x41')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x16c'),'as':_0x2ffc('0x16e')});db[_0x2ffc('0x41')][_0x2ffc('0x129')](db['User'],{'as':_0x2ffc('0x16f'),'through':_0x2ffc('0x12f'),'foreignKey':'MailInteractionId'});db[_0x2ffc('0x43')][_0x2ffc('0x119')](db['Attachment'],{'as':_0x2ffc('0x170'),'onDelete':'cascade'});db[_0x2ffc('0x43')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':'User'});db[_0x2ffc('0x43')][_0x2ffc('0x126')](db['CmContact'],{'onDelete':'cascade','as':_0x2ffc('0x15b')});db['MailMessage']['belongsTo'](db[_0x2ffc('0x41')],{'as':_0x2ffc('0x171'),'foreignKey':_0x2ffc('0x172')});db[_0x2ffc('0x43')][_0x2ffc('0x126')](db['MailAccount'],{'as':_0x2ffc('0x173'),'foreignKey':'MailAccountId'});db[_0x2ffc('0x43')][_0x2ffc('0x126')](db[_0x2ffc('0x139')],{'as':_0x2ffc('0x139'),'foreignKey':_0x2ffc('0x174')});db[_0x2ffc('0x43')][_0x2ffc('0x126')](db['ChatOfflineMessage'],{'as':_0x2ffc('0x6c'),'foreignKey':_0x2ffc('0x175')});db['MailApplication'][_0x2ffc('0x126')](db['User'],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x176')]['belongsTo'](db[_0x2ffc('0x3d')],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x176')][_0x2ffc('0x126')](db[_0x2ffc('0x13c')],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x176')][_0x2ffc('0x126')](db['Interval'],{'onDelete':_0x2ffc('0x15e'),'foreignKey':'IntervalId'});db['MailApplication'][_0x2ffc('0x126')](db['Tag'],{'onDelete':_0x2ffc('0x15e'),'foreignKey':_0x2ffc('0x177')});db[_0x2ffc('0x46')][_0x2ffc('0x126')](db[_0x2ffc('0x13c')],{});db[_0x2ffc('0x46')][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':'List','foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0x46')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0x46')]['belongsTo'](db[_0x2ffc('0x41')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db[_0x2ffc('0x46')][_0x2ffc('0x126')](db['User'],{});db[_0x2ffc('0x46')]['belongsTo'](db[_0x2ffc('0x3d')],{});db[_0x2ffc('0x48')][_0x2ffc('0x119')](db[_0x2ffc('0x49')],{'as':_0x2ffc('0x179'),'onDelete':_0x2ffc('0x115')});db['FaxAccount'][_0x2ffc('0x119')](db[_0x2ffc('0x82')],{'as':_0x2ffc('0x161'),'foreignKey':_0x2ffc('0x17a'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x4b')]['hasMany'](db[_0x2ffc('0x81')],{'as':_0x2ffc('0x162'),'foreignKey':_0x2ffc('0x17a')});db[_0x2ffc('0x4b')][_0x2ffc('0x119')](db[_0x2ffc('0x4e')],{'as':'Interactions'});db[_0x2ffc('0x4b')][_0x2ffc('0x119')](db[_0x2ffc('0x4d')],{'as':'Applications'});db[_0x2ffc('0x4b')][_0x2ffc('0x119')](db[_0x2ffc('0x18')],{'as':_0x2ffc('0x17b'),'onDelete':'cascade'});db[_0x2ffc('0x4b')]['hasMany'](db[_0x2ffc('0x50')],{'as':_0x2ffc('0x164')});db[_0x2ffc('0x4b')][_0x2ffc('0x126')](db[_0x2ffc('0x2a')],{'as':_0x2ffc('0x2a')});db[_0x2ffc('0x4b')][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':'List','foreignKey':'ListId'});db[_0x2ffc('0x4b')][_0x2ffc('0x126')](db[_0x2ffc('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0x2ffc('0x167')});db['FaxAccount'][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'onDelete':'restrict'});db[_0x2ffc('0x4d')][_0x2ffc('0x126')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x2ffc('0x4d')][_0x2ffc('0x126')](db[_0x2ffc('0x4b')],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x4d')]['belongsTo'](db[_0x2ffc('0x8f')],{'onDelete':_0x2ffc('0x15e'),'foreignKey':_0x2ffc('0x177')});db[_0x2ffc('0x4e')][_0x2ffc('0x119')](db[_0x2ffc('0x50')],{'as':_0x2ffc('0x164'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x17c')});db['FaxInteraction']['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x2ffc('0x17a')});db[_0x2ffc('0x4e')]['belongsTo'](db['CmContact'],{'as':_0x2ffc('0x15b'),'foreignKey':'ContactId'});db[_0x2ffc('0x4e')]['belongsTo'](db['User'],{'as':_0x2ffc('0x16b'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x4e')]['belongsToMany'](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x17d'),'as':_0x2ffc('0x16d')});db[_0x2ffc('0x4e')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x17d'),'as':_0x2ffc('0x16e')});db[_0x2ffc('0x4e')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16f'),'through':'user_has_fax_interactions','foreignKey':_0x2ffc('0x17c')});db[_0x2ffc('0x50')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'onDelete':_0x2ffc('0x115'),'as':_0x2ffc('0x12')});db[_0x2ffc('0x50')][_0x2ffc('0x126')](db['FaxInteraction'],{'as':_0x2ffc('0x171'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0x2ffc('0x72')],{'onDelete':_0x2ffc('0x115'),'as':'Contact'});db[_0x2ffc('0x50')][_0x2ffc('0x126')](db['Attachment'],{'as':_0x2ffc('0xf0'),'foreignKey':_0x2ffc('0x17e')});db[_0x2ffc('0x50')][_0x2ffc('0x126')](db[_0x2ffc('0x4b')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x17a')});db[_0x2ffc('0x52')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x33')});db[_0x2ffc('0x52')][_0x2ffc('0x129')](db[_0x2ffc('0x12d')],{'through':_0x2ffc('0x17f'),'as':_0x2ffc('0x153')});db[_0x2ffc('0x54')][_0x2ffc('0x126')](db[_0x2ffc('0x4b')],{});db['FaxQueueReport'][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0x54')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db['FaxQueueReport'][_0x2ffc('0x126')](db[_0x2ffc('0x4e')],{});db[_0x2ffc('0x54')]['belongsTo'](db[_0x2ffc('0x50')],{});db[_0x2ffc('0x54')]['belongsTo'](db['User'],{});db['FaxQueueReport'][_0x2ffc('0x126')](db['FaxQueue'],{});db['SmsAccount']['hasMany'](db[_0x2ffc('0x82')],{'as':'Dispositions','foreignKey':_0x2ffc('0x180'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x56')]['hasMany'](db[_0x2ffc('0x81')],{'as':'Answers','foreignKey':_0x2ffc('0x180')});db[_0x2ffc('0x56')]['hasMany'](db['SmsMessage'],{'as':_0x2ffc('0x164'),'foreignKey':'SmsAccountId'});db[_0x2ffc('0x56')]['hasMany'](db[_0x2ffc('0x121')],{'as':_0x2ffc('0x165')});db[_0x2ffc('0x56')][_0x2ffc('0x119')](db[_0x2ffc('0x58')],{'as':_0x2ffc('0x144')});db['SmsAccount']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0x56')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x2ffc('0x167')});db[_0x2ffc('0x56')]['belongsToMany'](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x181')});db[_0x2ffc('0x58')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'onDelete':'restrict'});db['SmsApplication'][_0x2ffc('0x126')](db['SmsQueue'],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x58')][_0x2ffc('0x126')](db['SmsAccount'],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x58')]['belongsTo'](db[_0x2ffc('0x85')],{'onDelete':_0x2ffc('0x15e'),'foreignKey':_0x2ffc('0x14e')});db[_0x2ffc('0x58')][_0x2ffc('0x126')](db['Tag'],{'onDelete':_0x2ffc('0x15e'),'foreignKey':'TagId'});db[_0x2ffc('0x121')][_0x2ffc('0x119')](db[_0x2ffc('0x182')],{'as':_0x2ffc('0x164'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x183')});db[_0x2ffc('0x121')]['belongsTo'](db['SmsAccount'],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x180')});db['SmsInteraction'][_0x2ffc('0x126')](db['CmContact'],{'as':_0x2ffc('0x15b'),'foreignKey':'ContactId'});db[_0x2ffc('0x121')][_0x2ffc('0x126')](db['User'],{'as':_0x2ffc('0x16b'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x121')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x184'),'as':_0x2ffc('0x16d')});db[_0x2ffc('0x121')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x184'),'as':_0x2ffc('0x16e')});db[_0x2ffc('0x121')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16f'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x2ffc('0x182')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x12')});db['SmsMessage'][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'onDelete':_0x2ffc('0x115'),'as':'Contact'});db[_0x2ffc('0x182')][_0x2ffc('0x126')](db[_0x2ffc('0x121')],{'onDelete':_0x2ffc('0x115'),'as':_0x2ffc('0x171'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x2ffc('0x126')](db['SmsAccount'],{'as':'Account','foreignKey':_0x2ffc('0x180')});db[_0x2ffc('0x5b')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x35'),'foreignKey':_0x2ffc('0x185')});db[_0x2ffc('0x5b')]['belongsToMany'](db[_0x2ffc('0x12d')],{'through':_0x2ffc('0x186'),'as':_0x2ffc('0x153')});db[_0x2ffc('0x5d')][_0x2ffc('0x119')](db[_0x2ffc('0x82')],{'as':_0x2ffc('0x161'),'foreignKey':_0x2ffc('0x187'),'onDelete':_0x2ffc('0x115')});db['OpenchannelAccount'][_0x2ffc('0x119')](db['CannedAnswer'],{'as':_0x2ffc('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x2ffc('0x5d')]['hasMany'](db[_0x2ffc('0x11e')],{'as':_0x2ffc('0x165'),'foreignKey':_0x2ffc('0x187')});db['OpenchannelAccount'][_0x2ffc('0x119')](db['OpenchannelMessage'],{'as':_0x2ffc('0x164'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2ffc('0x119')](db['OpenchannelApplication'],{'as':_0x2ffc('0x144'),'foreignKey':'OpenchannelAccountId'});db[_0x2ffc('0x5d')][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db['OpenchannelAccount'][_0x2ffc('0x126')](db[_0x2ffc('0x14f')],{'as':_0x2ffc('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2ffc('0x5d')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':'user_has_openchannel_accounts'});db[_0x2ffc('0x188')]['belongsTo'](db[_0x2ffc('0x12')],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x188')][_0x2ffc('0x126')](db[_0x2ffc('0x63')],{'onDelete':_0x2ffc('0x15e'),'foreignKey':'OpenchannelQueueId'});db[_0x2ffc('0x188')][_0x2ffc('0x126')](db[_0x2ffc('0x5d')],{'onDelete':_0x2ffc('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x2ffc('0x188')]['belongsTo'](db[_0x2ffc('0x85')],{'onDelete':'restrict','foreignKey':_0x2ffc('0x14e')});db[_0x2ffc('0x188')][_0x2ffc('0x126')](db['Tag'],{'onDelete':_0x2ffc('0x15e'),'foreignKey':_0x2ffc('0x177')});db['OpenchannelInteraction'][_0x2ffc('0x119')](db[_0x2ffc('0x61')],{'as':'Messages','onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x189')});db['OpenchannelInteraction'][_0x2ffc('0x126')](db[_0x2ffc('0x5d')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x187')});db[_0x2ffc('0x11e')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x2ffc('0x11e')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x11e')][_0x2ffc('0x129')](db['Tag'],{'through':_0x2ffc('0x18a'),'as':_0x2ffc('0x16d')});db['OpenchannelInteraction'][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x18a'),'as':_0x2ffc('0x16e')});db[_0x2ffc('0x11e')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16f'),'through':_0x2ffc('0x18b'),'foreignKey':_0x2ffc('0x189')});db[_0x2ffc('0x61')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'onDelete':_0x2ffc('0x115'),'as':_0x2ffc('0x12')});db[_0x2ffc('0x61')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'onDelete':_0x2ffc('0x115'),'as':_0x2ffc('0x15b')});db['OpenchannelMessage'][_0x2ffc('0x126')](db[_0x2ffc('0x11e')],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x2ffc('0x61')]['belongsTo'](db[_0x2ffc('0xf0')],{'as':'Attachment','foreignKey':_0x2ffc('0x17e')});db['OpenchannelMessage'][_0x2ffc('0x126')](db[_0x2ffc('0x5d')],{'as':_0x2ffc('0x173'),'foreignKey':'OpenchannelAccountId'});db[_0x2ffc('0x63')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x2ffc('0x18c')});db['OpenchannelQueue'][_0x2ffc('0x129')](db[_0x2ffc('0x12d')],{'through':_0x2ffc('0x18d'),'as':_0x2ffc('0x153')});db[_0x2ffc('0x139')][_0x2ffc('0x119')](db[_0x2ffc('0x82')],{'as':_0x2ffc('0x161'),'foreignKey':'ChatWebsiteId','onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x139')][_0x2ffc('0x119')](db[_0x2ffc('0x81')],{'as':_0x2ffc('0x162'),'foreignKey':_0x2ffc('0x174')});db[_0x2ffc('0x139')][_0x2ffc('0x119')](db[_0x2ffc('0x6f')],{'as':'ProactiveActions'});db[_0x2ffc('0x139')][_0x2ffc('0x119')](db[_0x2ffc('0x69')],{'as':_0x2ffc('0x165')});db['ChatWebsite'][_0x2ffc('0x119')](db['ChatApplication'],{'as':_0x2ffc('0x144')});db[_0x2ffc('0x139')][_0x2ffc('0x119')](db['ChatMessage'],{'as':_0x2ffc('0x164')});db[_0x2ffc('0x139')][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0x139')][_0x2ffc('0x126')](db[_0x2ffc('0x85')],{'as':_0x2ffc('0x85'),'foreignKey':_0x2ffc('0x14e')});db[_0x2ffc('0x139')][_0x2ffc('0x126')](db[_0x2ffc('0x13c')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x2ffc('0x139')][_0x2ffc('0x126')](db[_0x2ffc('0x14f')],{'as':_0x2ffc('0x150'),'foreignKey':_0x2ffc('0x167')});db['ChatWebsite']['belongsToMany'](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x18e')});db[_0x2ffc('0x65')][_0x2ffc('0x126')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0x65')][_0x2ffc('0x126')](db['CmContact'],{'as':'Contact','foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0x65')][_0x2ffc('0x126')](db[_0x2ffc('0x11e')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x2ffc('0x61')],{});db[_0x2ffc('0x65')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x2ffc('0x63')],{});db['ChatApplication']['belongsTo'](db[_0x2ffc('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x2ffc('0x15e')});db['ChatApplication'][_0x2ffc('0x126')](db[_0x2ffc('0x6d')],{'as':_0x2ffc('0x18f'),'foreignKey':'ChatQueueId','onDelete':_0x2ffc('0x15e')});db['ChatApplication'][_0x2ffc('0x126')](db[_0x2ffc('0x139')],{'as':_0x2ffc('0x190'),'foreignKey':_0x2ffc('0x174'),'onDelete':'restrict'});db[_0x2ffc('0x67')][_0x2ffc('0x126')](db[_0x2ffc('0x8f')],{'onDelete':'restrict','foreignKey':_0x2ffc('0x177')});db['ChatInteraction'][_0x2ffc('0x119')](db[_0x2ffc('0x6a')],{'as':_0x2ffc('0x164'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x191')});db['ChatInteraction'][_0x2ffc('0x126')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2ffc('0x174')});db[_0x2ffc('0x69')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db['ChatInteraction'][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16b'),'foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x69')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x192'),'as':_0x2ffc('0x16d')});db[_0x2ffc('0x69')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'through':'chat_interaction_has_tags','as':_0x2ffc('0x16e')});db[_0x2ffc('0x69')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16f'),'through':_0x2ffc('0x193'),'foreignKey':_0x2ffc('0x191')});db['ChatMessage'][_0x2ffc('0x126')](db['User'],{'onDelete':_0x2ffc('0x115'),'as':_0x2ffc('0x12')});db['ChatMessage'][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'onDelete':_0x2ffc('0x115'),'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db['ChatMessage'][_0x2ffc('0x126')](db['ChatInteraction'],{'onDelete':_0x2ffc('0x115'),'as':'Interaction','foreignKey':_0x2ffc('0x191')});db[_0x2ffc('0x6a')][_0x2ffc('0x126')](db['Attachment'],{'as':_0x2ffc('0xf0'),'foreignKey':_0x2ffc('0x17e')});db[_0x2ffc('0x6a')][_0x2ffc('0x126')](db['ChatWebsite'],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x174')});db[_0x2ffc('0x6c')]['hasMany'](db['Attachment'],{'as':'Attachments','foreignKey':_0x2ffc('0x175'),'onDelete':_0x2ffc('0x115'),'hooks':!![]});db[_0x2ffc('0x6c')][_0x2ffc('0x126')](db['CmContact'],{'onDelete':'cascade','as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0x6c')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2ffc('0x174')});db[_0x2ffc('0x6d')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':'Agents','through':_0x2ffc('0x30'),'hooks':!![]});db[_0x2ffc('0x6d')][_0x2ffc('0x129')](db[_0x2ffc('0x12d')],{'through':_0x2ffc('0x194'),'as':'Teams'});db[_0x2ffc('0x127')][_0x2ffc('0x119')](db[_0x2ffc('0x195')],{'as':'Messages','foreignKey':_0x2ffc('0x196'),'onDelete':_0x2ffc('0x115')});db['ChatGroup'][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x197'),'through':_0x2ffc('0x128')});db[_0x2ffc('0x6f')]['belongsTo'](db[_0x2ffc('0x139')],{'as':_0x2ffc('0x190'),'foreignKey':_0x2ffc('0x174')});db[_0x2ffc('0x70')][_0x2ffc('0x119')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x12a'),'foreignKey':_0x2ffc('0x198')});db[_0x2ffc('0x72')]['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':'CmContactId'});db[_0x2ffc('0x72')][_0x2ffc('0x119')](db['CmHopper'],{'as':_0x2ffc('0x148'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x2ffc('0x78')],{'as':_0x2ffc('0x11b'),'foreignKey':_0x2ffc('0x16a')});db['CmContact'][_0x2ffc('0x119')](db[_0x2ffc('0x11c')],{'as':_0x2ffc('0x199'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0x72')][_0x2ffc('0x119')](db[_0x2ffc('0x7a')],{'as':_0x2ffc('0x7a'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0x72')][_0x2ffc('0x119')](db[_0x2ffc('0xdb')],{'as':_0x2ffc('0x14a'),'foreignKey':_0x2ffc('0x16a')});db['CmContact'][_0x2ffc('0x119')](db[_0x2ffc('0x11e')],{'as':_0x2ffc('0x11f'),'foreignKey':_0x2ffc('0x16a'),'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x72')]['hasMany'](db[_0x2ffc('0x69')],{'as':_0x2ffc('0x120'),'foreignKey':'ContactId','onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x72')][_0x2ffc('0x119')](db[_0x2ffc('0x121')],{'as':_0x2ffc('0x122'),'foreignKey':'ContactId','onDelete':_0x2ffc('0x15e')});db['CmContact'][_0x2ffc('0x119')](db[_0x2ffc('0x4e')],{'as':'FaxInteractions','foreignKey':_0x2ffc('0x16a'),'onDelete':_0x2ffc('0x15e')});db['CmContact'][_0x2ffc('0x119')](db[_0x2ffc('0x41')],{'as':_0x2ffc('0x19a'),'foreignKey':'ContactId','onDelete':_0x2ffc('0x15e')});db['CmContact']['belongsTo'](db[_0x2ffc('0x70')],{'as':_0x2ffc('0x19b'),'foreignKey':'CompanyId'});db['CmContact'][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':'List','foreignKey':_0x2ffc('0x178'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x72')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':'Users','through':_0x2ffc('0x12b')});db[_0x2ffc('0x72')][_0x2ffc('0x129')](db[_0x2ffc('0x8f')],{'as':_0x2ffc('0x16d'),'through':_0x2ffc('0x19c')});db['CmContact']['belongsToMany'](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x19c'),'as':_0x2ffc('0x16e')});db[_0x2ffc('0x74')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x2ffc('0x19d'),'foreignKey':_0x2ffc('0x19e')});db[_0x2ffc('0x74')]['belongsTo'](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':'ContactId','onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x74')]['belongsTo'](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178'),'onDelete':_0x2ffc('0x115')});db['CmHopper'][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0x2ffc('0x74')][_0x2ffc('0x126')](db[_0x2ffc('0x1b')],{'as':'Queue','foreignKey':_0x2ffc('0x147'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x74')][_0x2ffc('0x126')](db['Campaign'],{'as':_0x2ffc('0xee'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x2ffc('0x74')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':'Owner','foreignKey':_0x2ffc('0x19f')});db['CmHopperBlack'][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x76')]['belongsTo'](db['CmList'],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178'),'onDelete':'cascade'});db[_0x2ffc('0x76')][_0x2ffc('0x126')](db[_0x2ffc('0x1b')],{'as':_0x2ffc('0x18f'),'foreignKey':_0x2ffc('0x147'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x76')][_0x2ffc('0x126')](db[_0x2ffc('0xee')],{'as':_0x2ffc('0xee'),'foreignKey':_0x2ffc('0x1a0'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0x7f')]['hasMany'](db[_0x2ffc('0x83')],{'as':{'plural':'All','singular':_0x2ffc('0x1a1')},'foreignKey':'AutomationAllId','onDelete':_0x2ffc('0x115'),'hooks':!![]});db[_0x2ffc('0x7f')]['hasMany'](db['Condition'],{'as':{'plural':_0x2ffc('0x1a2'),'singular':'OneAny'},'foreignKey':_0x2ffc('0x1a3'),'onDelete':_0x2ffc('0x115'),'hooks':!![]});db['Automation'][_0x2ffc('0x119')](db[_0x2ffc('0x7d')],{'as':_0x2ffc('0x1a4'),'foreignKey':_0x2ffc('0x1a5'),'onDelete':_0x2ffc('0x115'),'hooks':!![]});db['Disposition'][_0x2ffc('0x119')](db[_0x2ffc('0x82')],{'as':_0x2ffc('0x161'),'foreignKey':_0x2ffc('0x1a6'),'onDelete':'cascade'});db['Interval']['hasMany'](db[_0x2ffc('0x85')],{'as':_0x2ffc('0x1a7'),'foreignKey':_0x2ffc('0x14e'),'onDelete':_0x2ffc('0x115'),'hooks':!![],'required':![]});db[_0x2ffc('0x85')][_0x2ffc('0x119')](db[_0x2ffc('0x18')],{'as':_0x2ffc('0x11a'),'foreignKey':_0x2ffc('0x14e'),'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x85')][_0x2ffc('0x119')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x2ffc('0x14e')});db[_0x2ffc('0x85')][_0x2ffc('0x119')](db['ChatApplication'],{'as':_0x2ffc('0x1a8'),'foreignKey':_0x2ffc('0x14e')});db['Interval']['hasMany'](db[_0x2ffc('0x4d')],{'as':_0x2ffc('0x1a9'),'foreignKey':'IntervalId'});db[_0x2ffc('0x85')][_0x2ffc('0x119')](db[_0x2ffc('0x58')],{'as':_0x2ffc('0x1aa'),'foreignKey':'IntervalId'});db[_0x2ffc('0x8b')][_0x2ffc('0x126')](db[_0x2ffc('0x13c')],{});db[_0x2ffc('0x8b')][_0x2ffc('0x126')](db[_0x2ffc('0xa0')],{'foreignKey':_0x2ffc('0x1ab')});db[_0x2ffc('0x8b')]['belongsTo'](db[_0x2ffc('0x9f')],{'foreignKey':_0x2ffc('0x1ac')});db[_0x2ffc('0x8d')][_0x2ffc('0x129')](db[_0x2ffc('0x19')],{'as':_0x2ffc('0x1ad'),'through':_0x2ffc('0x146'),'onDelete':'restrict'});db['Tag'][_0x2ffc('0x129')](db[_0x2ffc('0x72')],{'through':_0x2ffc('0x19c')});db['Tag'][_0x2ffc('0x129')](db[_0x2ffc('0x69')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x2ffc('0x129')](db[_0x2ffc('0x41')],{'through':_0x2ffc('0x16c')});db[_0x2ffc('0x8f')][_0x2ffc('0x129')](db[_0x2ffc('0x121')],{'through':'sms_interaction_has_tags'});db[_0x2ffc('0x8f')]['belongsToMany'](db[_0x2ffc('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x2ffc('0x8f')][_0x2ffc('0x129')](db[_0x2ffc('0x11e')],{'through':_0x2ffc('0x18a')});db['Tag'][_0x2ffc('0x129')](db[_0x2ffc('0x106')],{'through':_0x2ffc('0x1ae')});db[_0x2ffc('0x93')][_0x2ffc('0x126')](db[_0x2ffc('0x91')],{'as':'ItemType','foreignKey':_0x2ffc('0x1af')});db[_0x2ffc('0x95')][_0x2ffc('0x126')](db[_0x2ffc('0x74')],{'as':_0x2ffc('0x1b0'),'foreignKey':_0x2ffc('0x19e')});db[_0x2ffc('0x93')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':'Contact','foreignKey':_0x2ffc('0x1b1')});db['Trigger'][_0x2ffc('0x119')](db['Condition'],{'as':{'plural':_0x2ffc('0x1b2'),'singular':_0x2ffc('0x1b3')},'foreignKey':_0x2ffc('0x1b4'),'onDelete':_0x2ffc('0x115'),'hooks':!![]});db[_0x2ffc('0x98')][_0x2ffc('0x119')](db[_0x2ffc('0x83')],{'as':{'plural':'AnyConditions','singular':_0x2ffc('0x1b5')},'foreignKey':_0x2ffc('0x1b6'),'onDelete':_0x2ffc('0x115'),'hooks':!![]});db[_0x2ffc('0x98')][_0x2ffc('0x119')](db[_0x2ffc('0x7d')],{'as':_0x2ffc('0x1a4'),'foreignKey':'TriggerId','onDelete':_0x2ffc('0x115'),'hooks':!![]});db['AnalyticCustomReport'][_0x2ffc('0x119')](db[_0x2ffc('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2ffc('0x1ac'),'hooks':!![]});db[_0x2ffc('0xa0')][_0x2ffc('0x119')](db['AnalyticFieldReport'],{'as':_0x2ffc('0x1b7'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1ab')});db['AnalyticMetric'][_0x2ffc('0x119')](db['AnalyticFieldReport'],{'as':_0x2ffc('0x1b7'),'onDelete':_0x2ffc('0x115'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x2ffc('0x126')](db[_0x2ffc('0xa2')],{'foreignKey':_0x2ffc('0x1b8')});db[_0x2ffc('0x1b9')][_0x2ffc('0x119')](db['SalesforceConfiguration'],{'as':_0x2ffc('0x1ba'),'onDelete':'cascade','foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xa8')][_0x2ffc('0x119')](db[_0x2ffc('0xa9')],{'as':_0x2ffc('0x1bc'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xa8')][_0x2ffc('0x119')](db[_0x2ffc('0xa9')],{'as':_0x2ffc('0x1be'),'onDelete':_0x2ffc('0x115'),'foreignKey':'DescriptionId'});db[_0x2ffc('0xa8')]['hasMany'](db[_0x2ffc('0xa9')],{'as':_0x2ffc('0x1b7'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xa8')][_0x2ffc('0x126')](db[_0x2ffc('0x1b9')],{'as':_0x2ffc('0x173'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db[_0x2ffc('0xa9')],{'as':_0x2ffc('0x1c0'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xa9')]['hasMany'](db[_0x2ffc('0xa9')],{'as':_0x2ffc('0x1c1'),'foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xa9')][_0x2ffc('0x119')](db[_0x2ffc('0xa9')],{'as':_0x2ffc('0x1c3'),'foreignKey':'FieldId'});db[_0x2ffc('0xa9')][_0x2ffc('0x126')](db['Variable'],{'as':_0x2ffc('0x99'),'foreignKey':_0x2ffc('0x1c4')});db[_0x2ffc('0xab')][_0x2ffc('0x119')](db[_0x2ffc('0xac')],{'as':'Configurations','onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xac')][_0x2ffc('0x119')](db['SugarcrmField'],{'as':_0x2ffc('0x1bc'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xac')][_0x2ffc('0x119')](db[_0x2ffc('0x1c5')],{'as':_0x2ffc('0x1be'),'onDelete':'cascade','foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xac')]['hasMany'](db[_0x2ffc('0x1c5')],{'as':_0x2ffc('0x1b7'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xac')]['belongsTo'](db[_0x2ffc('0xab')],{'as':_0x2ffc('0x173'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x2ffc('0x119')](db['SugarcrmField'],{'as':_0x2ffc('0x1c0'),'foreignKey':'SubjectId'});db[_0x2ffc('0x1c5')][_0x2ffc('0x119')](db[_0x2ffc('0x1c5')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x2ffc('0x119')](db['SugarcrmField'],{'as':_0x2ffc('0x1c3'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0x1c5')]['belongsTo'](db[_0x2ffc('0x99')],{'as':_0x2ffc('0x99'),'foreignKey':_0x2ffc('0x1c4')});db['DeskAccount'][_0x2ffc('0x119')](db['DeskConfiguration'],{'as':_0x2ffc('0x1ba'),'onDelete':_0x2ffc('0x115'),'foreignKey':'AccountId'});db[_0x2ffc('0xaf')][_0x2ffc('0x119')](db[_0x2ffc('0x1c6')],{'as':_0x2ffc('0x1bc'),'onDelete':'cascade','foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xaf')][_0x2ffc('0x119')](db[_0x2ffc('0x1c6')],{'as':_0x2ffc('0x1be'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xaf')][_0x2ffc('0x119')](db[_0x2ffc('0x1c6')],{'as':_0x2ffc('0x1b7'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xaf')]['belongsTo'](db[_0x2ffc('0x1c7')],{'as':'Account','foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xaf')]['belongsToMany'](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x1c8')});db[_0x2ffc('0x1c6')][_0x2ffc('0x119')](db[_0x2ffc('0x1c6')],{'as':'Subject','foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0x1c6')][_0x2ffc('0x119')](db[_0x2ffc('0x1c6')],{'as':'Description','foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0x1c6')]['hasMany'](db[_0x2ffc('0x1c6')],{'as':_0x2ffc('0x1c3'),'foreignKey':'FieldId'});db[_0x2ffc('0x1c6')][_0x2ffc('0x126')](db[_0x2ffc('0x99')],{'as':_0x2ffc('0x99'),'foreignKey':_0x2ffc('0x1c4')});db[_0x2ffc('0xb2')][_0x2ffc('0x119')](db[_0x2ffc('0xb3')],{'as':_0x2ffc('0x1ba'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xb3')][_0x2ffc('0x119')](db[_0x2ffc('0xb5')],{'as':_0x2ffc('0x1bc'),'onDelete':_0x2ffc('0x115'),'foreignKey':'SubjectId'});db[_0x2ffc('0xb3')][_0x2ffc('0x119')](db['ZohoField'],{'as':_0x2ffc('0x1be'),'onDelete':_0x2ffc('0x115'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x2ffc('0x119')](db['ZohoField'],{'as':_0x2ffc('0x1b7'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bf')});db['ZohoConfiguration'][_0x2ffc('0x126')](db['ZohoAccount'],{'as':_0x2ffc('0x173'),'foreignKey':'AccountId'});db['ZohoField'][_0x2ffc('0x119')](db[_0x2ffc('0xb5')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2ffc('0xb5')][_0x2ffc('0x119')](db[_0x2ffc('0xb5')],{'as':_0x2ffc('0x1c1'),'foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xb5')][_0x2ffc('0x119')](db['ZohoField'],{'as':_0x2ffc('0x1c3'),'foreignKey':_0x2ffc('0x1bf')});db['ZohoField'][_0x2ffc('0x126')](db[_0x2ffc('0x99')],{'as':_0x2ffc('0x99'),'foreignKey':_0x2ffc('0x1c4')});db[_0x2ffc('0xb7')][_0x2ffc('0x119')](db[_0x2ffc('0xb9')],{'as':'Configurations','onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xb9')][_0x2ffc('0x119')](db[_0x2ffc('0xbb')],{'as':_0x2ffc('0x1bc'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xb9')][_0x2ffc('0x119')](db['ZendeskField'],{'as':_0x2ffc('0x1be'),'foreignKey':_0x2ffc('0x1c2')});db['ZendeskConfiguration'][_0x2ffc('0x119')](db[_0x2ffc('0xbb')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x2ffc('0x126')](db[_0x2ffc('0xb7')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xb9')][_0x2ffc('0x129')](db['Tag'],{'through':_0x2ffc('0x1c9')});db[_0x2ffc('0xbb')][_0x2ffc('0x119')](db[_0x2ffc('0xbb')],{'as':_0x2ffc('0x1c0'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xbb')][_0x2ffc('0x119')](db[_0x2ffc('0xbb')],{'as':_0x2ffc('0x1c1'),'foreignKey':_0x2ffc('0x1c2')});db['ZendeskField'][_0x2ffc('0x119')](db[_0x2ffc('0xbb')],{'as':_0x2ffc('0x1c3'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xbb')]['belongsTo'](db['Variable'],{'as':_0x2ffc('0x99'),'foreignKey':_0x2ffc('0x1c4')});db[_0x2ffc('0x1ca')][_0x2ffc('0x119')](db[_0x2ffc('0xbd')],{'as':_0x2ffc('0x1ba'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xbd')]['hasMany'](db['FreshdeskField'],{'as':_0x2ffc('0x1bc'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xbd')]['hasMany'](db[_0x2ffc('0xbf')],{'as':'Descriptions','onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xbd')][_0x2ffc('0x119')](db[_0x2ffc('0xbf')],{'as':_0x2ffc('0x1b7'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xbd')]['belongsTo'](db[_0x2ffc('0x1ca')],{'as':'Account','foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xbd')][_0x2ffc('0x129')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x2ffc('0xbf')][_0x2ffc('0x119')](db[_0x2ffc('0xbf')],{'as':_0x2ffc('0x1c0'),'foreignKey':'SubjectId'});db[_0x2ffc('0xbf')][_0x2ffc('0x119')](db[_0x2ffc('0xbf')],{'as':'Description','foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xbf')][_0x2ffc('0x119')](db[_0x2ffc('0xbf')],{'as':_0x2ffc('0x1c3'),'foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x2ffc('0x99'),'foreignKey':'VariableId'});db[_0x2ffc('0xc0')][_0x2ffc('0x119')](db[_0x2ffc('0xc2')],{'as':_0x2ffc('0x1ba'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bb')});db['VtigerConfiguration'][_0x2ffc('0x119')](db[_0x2ffc('0xc4')],{'as':_0x2ffc('0x1bc'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xc2')][_0x2ffc('0x119')](db[_0x2ffc('0xc4')],{'as':_0x2ffc('0x1be'),'foreignKey':_0x2ffc('0x1c2')});db['VtigerConfiguration'][_0x2ffc('0x119')](db['VtigerField'],{'as':_0x2ffc('0x1b7'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xc2')][_0x2ffc('0x126')](db[_0x2ffc('0xc0')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x1bb')});db['VtigerField'][_0x2ffc('0x119')](db[_0x2ffc('0xc4')],{'as':_0x2ffc('0x1c0'),'foreignKey':_0x2ffc('0x1bd')});db['VtigerField'][_0x2ffc('0x119')](db[_0x2ffc('0xc4')],{'as':_0x2ffc('0x1c1'),'foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xc4')][_0x2ffc('0x119')](db[_0x2ffc('0xc4')],{'as':'Field','foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xc4')][_0x2ffc('0x126')](db[_0x2ffc('0x99')],{'as':'Variable','foreignKey':_0x2ffc('0x1c4')});db['ServicenowAccount']['hasMany'](db[_0x2ffc('0xc8')],{'as':_0x2ffc('0x1ba'),'onDelete':'cascade','foreignKey':_0x2ffc('0x1bb')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x2ffc('0x1bc'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xc8')][_0x2ffc('0x119')](db[_0x2ffc('0xca')],{'as':_0x2ffc('0x1be'),'foreignKey':_0x2ffc('0x1c2')});db['ServicenowConfiguration'][_0x2ffc('0x119')](db[_0x2ffc('0xca')],{'as':'Fields','foreignKey':_0x2ffc('0x1bf')});db['ServicenowConfiguration'][_0x2ffc('0x126')](db[_0x2ffc('0xc6')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xca')][_0x2ffc('0x119')](db[_0x2ffc('0xca')],{'as':_0x2ffc('0x1c0'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xca')]['hasMany'](db[_0x2ffc('0xca')],{'as':_0x2ffc('0x1c1'),'foreignKey':_0x2ffc('0x1c2')});db[_0x2ffc('0xca')][_0x2ffc('0x119')](db[_0x2ffc('0xca')],{'as':_0x2ffc('0x1c3'),'foreignKey':_0x2ffc('0x1bf')});db['ServicenowField'][_0x2ffc('0x126')](db[_0x2ffc('0x99')],{'as':_0x2ffc('0x99'),'foreignKey':_0x2ffc('0x1c4')});db['Dynamics365Account'][_0x2ffc('0x119')](db['Dynamics365Configuration'],{'as':_0x2ffc('0x1ba'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xcb')][_0x2ffc('0x126')](db[_0x2ffc('0x10d')],{'as':_0x2ffc('0x10d'),'foreignKey':_0x2ffc('0x15d')});db[_0x2ffc('0xcd')][_0x2ffc('0x119')](db[_0x2ffc('0xcf')],{'as':_0x2ffc('0x1bc'),'onDelete':_0x2ffc('0x115'),'foreignKey':'SubjectId'});db[_0x2ffc('0xcd')]['hasMany'](db[_0x2ffc('0xcf')],{'as':_0x2ffc('0x1be'),'onDelete':_0x2ffc('0x115'),'foreignKey':'DescriptionId'});db[_0x2ffc('0xcd')][_0x2ffc('0x119')](db[_0x2ffc('0xcf')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2ffc('0x1bf')});db['Dynamics365Configuration'][_0x2ffc('0x126')](db['Dynamics365Account'],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x1bb')});db['Dynamics365Field'][_0x2ffc('0x119')](db[_0x2ffc('0xcf')],{'as':_0x2ffc('0x1c0'),'foreignKey':_0x2ffc('0x1bd')});db[_0x2ffc('0xcf')][_0x2ffc('0x119')](db[_0x2ffc('0xcf')],{'as':_0x2ffc('0x1c1'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x2ffc('0x119')](db['Dynamics365Field'],{'as':_0x2ffc('0x1c3'),'foreignKey':'FieldId'});db[_0x2ffc('0xcf')][_0x2ffc('0x126')](db['Variable'],{'as':_0x2ffc('0x99'),'foreignKey':_0x2ffc('0x1c4')});db[_0x2ffc('0xd0')][_0x2ffc('0x119')](db[_0x2ffc('0xd1')],{'as':_0x2ffc('0x1ba'),'onDelete':'cascade','foreignKey':_0x2ffc('0x1bb')});db[_0x2ffc('0xd1')][_0x2ffc('0x119')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x2ffc('0x1bd')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x2ffc('0x1c2')});db['FreshsalesConfiguration'][_0x2ffc('0x119')](db[_0x2ffc('0xd3')],{'as':_0x2ffc('0x1b7'),'foreignKey':_0x2ffc('0x1bf')});db[_0x2ffc('0xd1')][_0x2ffc('0x126')](db[_0x2ffc('0xd0')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x1bb')});db['FreshsalesField'][_0x2ffc('0x119')](db[_0x2ffc('0xd3')],{'as':_0x2ffc('0x1c0'),'foreignKey':_0x2ffc('0x1bd')});db['FreshsalesField'][_0x2ffc('0x119')](db[_0x2ffc('0xd3')],{'as':_0x2ffc('0x1c1'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x2ffc('0xd3')],{'as':'Field','foreignKey':_0x2ffc('0x1bf')});db['FreshsalesField']['belongsTo'](db[_0x2ffc('0x99')],{'as':_0x2ffc('0x99'),'foreignKey':'VariableId'});db[_0x2ffc('0xd6')]['belongsTo'](db[_0x2ffc('0x139')],{});db[_0x2ffc('0xd6')]['belongsTo'](db['CmList'],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0xd6')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0xd6')]['belongsTo'](db[_0x2ffc('0x69')],{});db[_0x2ffc('0xd6')][_0x2ffc('0x126')](db[_0x2ffc('0x6a')],{});db[_0x2ffc('0xd6')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{});db[_0x2ffc('0xd6')][_0x2ffc('0x126')](db[_0x2ffc('0x6d')],{});db[_0x2ffc('0x195')]['belongsTo'](db[_0x2ffc('0x12')],{'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1cb')});db[_0x2ffc('0x195')]['belongsTo'](db[_0x2ffc('0x12')],{'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1cc')});db['JscriptySessionReport'][_0x2ffc('0x119')](db[_0x2ffc('0x1cd')],{'foreignKey':_0x2ffc('0x1ce'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0xdb')][_0x2ffc('0x119')](db[_0x2ffc('0x1cf')],{'foreignKey':_0x2ffc('0x1ce'),'onDelete':'cascade'});db['SmsQueueReport'][_0x2ffc('0x126')](db[_0x2ffc('0x56')],{});db[_0x2ffc('0xdc')][_0x2ffc('0x126')](db['CmList'],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0xdc')]['belongsTo'](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0xdc')][_0x2ffc('0x126')](db[_0x2ffc('0x121')],{});db[_0x2ffc('0xdc')][_0x2ffc('0x126')](db[_0x2ffc('0x182')],{});db[_0x2ffc('0xdc')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{});db[_0x2ffc('0xdc')][_0x2ffc('0x126')](db['SmsQueue'],{});db[_0x2ffc('0xe2')][_0x2ffc('0x119')](db[_0x2ffc('0xdb')],{'foreignKey':_0x2ffc('0x1d0')});db[_0x2ffc('0xe2')][_0x2ffc('0x119')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x2ffc('0x119')](db[_0x2ffc('0x1cf')],{'foreignKey':_0x2ffc('0x1d0')});db[_0x2ffc('0xe6')]['belongsToMany'](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16f'),'through':'user_has_square_projects'});db['Team'][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':'Agents','through':'user_has_teams'});db[_0x2ffc('0x12d')][_0x2ffc('0x129')](db[_0x2ffc('0x1b')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x2ffc('0x12d')][_0x2ffc('0x129')](db[_0x2ffc('0x3d')],{'through':_0x2ffc('0x169'),'as':_0x2ffc('0x1d1')});db[_0x2ffc('0x12d')][_0x2ffc('0x129')](db[_0x2ffc('0x6d')],{'through':_0x2ffc('0x194'),'as':_0x2ffc('0x1d2')});db['Team'][_0x2ffc('0x129')](db[_0x2ffc('0x52')],{'through':_0x2ffc('0x17f'),'as':_0x2ffc('0x135')});db[_0x2ffc('0x12d')][_0x2ffc('0x129')](db[_0x2ffc('0x5b')],{'through':_0x2ffc('0x186'),'as':_0x2ffc('0x136')});db[_0x2ffc('0x12d')][_0x2ffc('0x129')](db[_0x2ffc('0x63')],{'through':'team_has_openchannel_queues','as':_0x2ffc('0x137')});db[_0x2ffc('0x12d')]['belongsToMany'](db[_0x2ffc('0x10b')],{'through':_0x2ffc('0x1d3'),'as':_0x2ffc('0x1d4')});db[_0x2ffc('0x12d')]['belongsToMany'](db[_0x2ffc('0xfe')],{'through':_0x2ffc('0x1d5'),'as':_0x2ffc('0x133')});db[_0x2ffc('0xee')]['hasMany'](db[_0x2ffc('0x74')],{'as':_0x2ffc('0x148'),'foreignKey':_0x2ffc('0x1a0')});db[_0x2ffc('0xee')][_0x2ffc('0x119')](db[_0x2ffc('0x78')],{'as':_0x2ffc('0x11b'),'foreignKey':'CampaignId'});db[_0x2ffc('0xee')]['hasMany'](db[_0x2ffc('0x11c')],{'as':_0x2ffc('0x199'),'foreignKey':_0x2ffc('0x1a0')});db[_0x2ffc('0xee')][_0x2ffc('0x119')](db[_0x2ffc('0x76')],{'as':'HopperBlacks','foreignKey':_0x2ffc('0x1a0')});db[_0x2ffc('0xee')][_0x2ffc('0x126')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db['Campaign'][_0x2ffc('0x126')](db['Trunk'],{'as':_0x2ffc('0x14c'),'foreignKey':_0x2ffc('0x14d')});db[_0x2ffc('0xee')][_0x2ffc('0x126')](db[_0x2ffc('0x85')],{'as':'Interval','foreignKey':_0x2ffc('0x14e')});db[_0x2ffc('0xee')][_0x2ffc('0x126')](db['SquareProject'],{'as':_0x2ffc('0xe6'),'foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x151'),'through':_0x2ffc('0x1d6')});db[_0x2ffc('0xee')][_0x2ffc('0x129')](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x155'),'through':_0x2ffc('0x1d7')});db['Attachment'][_0x2ffc('0x126')](db[_0x2ffc('0x6c')],{'as':_0x2ffc('0x6c'),'foreignKey':_0x2ffc('0x175')});db[_0x2ffc('0xf3')][_0x2ffc('0x126')](db['MailMessage'],{});db[_0x2ffc('0xf3')]['belongsTo'](db[_0x2ffc('0x41')],{});db[_0x2ffc('0xf3')][_0x2ffc('0x126')](db[_0x2ffc('0x13c')],{'foreignKey':_0x2ffc('0x1d8'),'as':_0x2ffc('0x1d9')});db['MailTransferReport'][_0x2ffc('0x126')](db['User'],{'foreignKey':_0x2ffc('0x1da'),'as':'FromAgent'});db[_0x2ffc('0xf3')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'foreignKey':_0x2ffc('0x1db'),'as':'ToAgent'});db['MailTransferReport'][_0x2ffc('0x126')](db['MailQueue'],{'foreignKey':_0x2ffc('0x1dc'),'as':_0x2ffc('0x1dd')});db[_0x2ffc('0xf3')][_0x2ffc('0x126')](db['MailAccount'],{'foreignKey':_0x2ffc('0x1de'),'as':_0x2ffc('0x1df')});db[_0x2ffc('0xf5')][_0x2ffc('0x126')](db[_0x2ffc('0x6a')],{});db[_0x2ffc('0xf5')]['belongsTo'](db[_0x2ffc('0x69')],{});db[_0x2ffc('0xf5')][_0x2ffc('0x126')](db[_0x2ffc('0x139')],{'foreignKey':_0x2ffc('0x1e0'),'as':_0x2ffc('0x1d9')});db[_0x2ffc('0xf5')][_0x2ffc('0x126')](db['User'],{'foreignKey':_0x2ffc('0x1da'),'as':_0x2ffc('0x1e1')});db[_0x2ffc('0xf5')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'foreignKey':_0x2ffc('0x1db'),'as':_0x2ffc('0x1e2')});db[_0x2ffc('0xf5')][_0x2ffc('0x126')](db[_0x2ffc('0x6d')],{'foreignKey':'ToChatQueueId','as':_0x2ffc('0x1dd')});db[_0x2ffc('0xf5')][_0x2ffc('0x126')](db['ChatWebsite'],{'foreignKey':_0x2ffc('0x1e3'),'as':_0x2ffc('0x1df')});db[_0x2ffc('0xf7')][_0x2ffc('0x126')](db['FaxMessage'],{});db[_0x2ffc('0xf7')][_0x2ffc('0x126')](db[_0x2ffc('0x4e')],{});db[_0x2ffc('0xf7')][_0x2ffc('0x126')](db[_0x2ffc('0x4b')],{'foreignKey':_0x2ffc('0x1e4'),'as':'FromAccount'});db[_0x2ffc('0xf7')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'foreignKey':_0x2ffc('0x1da'),'as':_0x2ffc('0x1e1')});db['FaxTransferReport'][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'foreignKey':_0x2ffc('0x1db'),'as':_0x2ffc('0x1e2')});db['FaxTransferReport'][_0x2ffc('0x126')](db[_0x2ffc('0x52')],{'foreignKey':_0x2ffc('0x1e5'),'as':_0x2ffc('0x1dd')});db[_0x2ffc('0xf7')][_0x2ffc('0x126')](db[_0x2ffc('0x4b')],{'foreignKey':_0x2ffc('0x1e6'),'as':_0x2ffc('0x1df')});db[_0x2ffc('0xf8')]['belongsTo'](db[_0x2ffc('0x61')],{});db['OpenchannelTransferReport'][_0x2ffc('0x126')](db[_0x2ffc('0x11e')],{});db[_0x2ffc('0xf8')][_0x2ffc('0x126')](db[_0x2ffc('0x5d')],{'foreignKey':_0x2ffc('0x1e7'),'as':_0x2ffc('0x1d9')});db[_0x2ffc('0xf8')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2ffc('0xf8')][_0x2ffc('0x126')](db['User'],{'foreignKey':_0x2ffc('0x1db'),'as':_0x2ffc('0x1e2')});db[_0x2ffc('0xf8')][_0x2ffc('0x126')](db[_0x2ffc('0x63')],{'foreignKey':_0x2ffc('0x1e8'),'as':_0x2ffc('0x1dd')});db['OpenchannelTransferReport'][_0x2ffc('0x126')](db['OpenchannelAccount'],{'foreignKey':_0x2ffc('0x1e9'),'as':_0x2ffc('0x1df')});db[_0x2ffc('0xfa')][_0x2ffc('0x126')](db[_0x2ffc('0x182')],{});db['SmsTransferReport'][_0x2ffc('0x126')](db[_0x2ffc('0x121')],{});db[_0x2ffc('0xfa')][_0x2ffc('0x126')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x2ffc('0x1d9')});db[_0x2ffc('0xfa')]['belongsTo'](db[_0x2ffc('0x12')],{'foreignKey':_0x2ffc('0x1da'),'as':_0x2ffc('0x1e1')});db[_0x2ffc('0xfa')][_0x2ffc('0x126')](db['User'],{'foreignKey':_0x2ffc('0x1db'),'as':_0x2ffc('0x1e2')});db[_0x2ffc('0xfa')]['belongsTo'](db[_0x2ffc('0x5b')],{'foreignKey':_0x2ffc('0x1ea'),'as':_0x2ffc('0x1dd')});db[_0x2ffc('0xfa')][_0x2ffc('0x126')](db[_0x2ffc('0x56')],{'foreignKey':_0x2ffc('0x1eb'),'as':_0x2ffc('0x1df')});db[_0x2ffc('0xfc')][_0x2ffc('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x2ffc('0x178'),'onDelete':_0x2ffc('0x115')});db[_0x2ffc('0xfc')]['hasMany'](db[_0x2ffc('0x7c')],{'as':_0x2ffc('0x1ec'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0xfc')][_0x2ffc('0x119')](db['CmContact'],{'as':_0x2ffc('0x12a'),'onDelete':'cascade','foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0xfc')][_0x2ffc('0x119')](db[_0x2ffc('0x78')],{'as':_0x2ffc('0x11b'),'foreignKey':'ListId'});db[_0x2ffc('0xfc')][_0x2ffc('0x119')](db[_0x2ffc('0x11c')],{'as':_0x2ffc('0x11d'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0xfc')][_0x2ffc('0x119')](db[_0x2ffc('0x7a')],{'as':_0x2ffc('0x7a'),'foreignKey':_0x2ffc('0x178')});db['CmList'][_0x2ffc('0x129')](db[_0x2ffc('0x1b')],{'as':'Queues','through':_0x2ffc('0x152')});db[_0x2ffc('0xfc')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x12c')});db[_0x2ffc('0xfe')][_0x2ffc('0x119')](db['VoiceExtension'],{'as':_0x2ffc('0x11a'),'onDelete':'cascade'});db[_0x2ffc('0xfe')]['belongsToMany'](db['User'],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x110')});db[_0x2ffc('0xfe')][_0x2ffc('0x129')](db['Team'],{'through':'TeamVoicePrefix','as':_0x2ffc('0x153')});db[_0x2ffc('0x100')][_0x2ffc('0x119')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16f'),'foreignKey':_0x2ffc('0x1ed')});db[_0x2ffc('0x100')]['hasMany'](db[_0x2ffc('0x1ee')],{'as':'UserProfileSections','foreignKey':_0x2ffc('0x1ed'),'onDelete':'cascade'});db[_0x2ffc('0x1ee')][_0x2ffc('0x119')](db[_0x2ffc('0x1ef')],{'as':_0x2ffc('0x1f0'),'foreignKey':_0x2ffc('0x1f1'),'onDelete':'cascade'});db[_0x2ffc('0x103')][_0x2ffc('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x2ffc('0x1f2'),'onDelete':'cascade'});db[_0x2ffc('0x103')][_0x2ffc('0x119')](db[_0x2ffc('0x81')],{'as':_0x2ffc('0x162'),'foreignKey':_0x2ffc('0x1f2')});db['WhatsappAccount']['hasMany'](db[_0x2ffc('0x107')],{'as':_0x2ffc('0x164'),'foreignKey':_0x2ffc('0x1f2')});db[_0x2ffc('0x103')][_0x2ffc('0x119')](db[_0x2ffc('0x106')],{'as':'Interactions'});db[_0x2ffc('0x103')]['hasMany'](db['WhatsappApplication'],{'as':'Applications'});db['WhatsappAccount'][_0x2ffc('0x126')](db['CmList'],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db['WhatsappAccount'][_0x2ffc('0x126')](db[_0x2ffc('0x14f')],{'as':_0x2ffc('0x150'),'foreignKey':_0x2ffc('0x167')});db[_0x2ffc('0x103')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x2ffc('0x105')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x105')][_0x2ffc('0x126')](db[_0x2ffc('0x10b')],{'onDelete':'restrict'});db[_0x2ffc('0x105')]['belongsTo'](db[_0x2ffc('0x103')],{'onDelete':_0x2ffc('0x15e')});db['WhatsappApplication'][_0x2ffc('0x126')](db[_0x2ffc('0x85')],{'onDelete':_0x2ffc('0x15e'),'foreignKey':_0x2ffc('0x14e')});db[_0x2ffc('0x105')][_0x2ffc('0x126')](db['Tag'],{'onDelete':_0x2ffc('0x15e'),'foreignKey':_0x2ffc('0x177')});db[_0x2ffc('0x106')][_0x2ffc('0x119')](db[_0x2ffc('0x107')],{'as':_0x2ffc('0x164'),'onDelete':_0x2ffc('0x115'),'foreignKey':_0x2ffc('0x1f3')});db[_0x2ffc('0x106')][_0x2ffc('0x126')](db[_0x2ffc('0x103')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x1f2')});db[_0x2ffc('0x106')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db[_0x2ffc('0x106')]['belongsTo'](db[_0x2ffc('0x12')],{'as':'Owner','foreignKey':_0x2ffc('0x117')});db[_0x2ffc('0x106')]['belongsToMany'](db[_0x2ffc('0x8f')],{'through':_0x2ffc('0x1ae'),'as':_0x2ffc('0x16d')});db[_0x2ffc('0x106')][_0x2ffc('0x129')](db['Tag'],{'through':_0x2ffc('0x1ae'),'as':'ThroughTags'});db[_0x2ffc('0x106')][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x16f'),'through':_0x2ffc('0x1f4'),'foreignKey':_0x2ffc('0x1f3')});db[_0x2ffc('0x107')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x12')});db[_0x2ffc('0x107')][_0x2ffc('0x126')](db['CmContact'],{'onDelete':_0x2ffc('0x115'),'as':_0x2ffc('0x15b')});db[_0x2ffc('0x107')][_0x2ffc('0x126')](db[_0x2ffc('0x106')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x2ffc('0x1f3')});db['WhatsappMessage'][_0x2ffc('0x126')](db[_0x2ffc('0x103')],{'as':_0x2ffc('0x173'),'foreignKey':_0x2ffc('0x1f2')});db[_0x2ffc('0x1f5')]['belongsTo'](db[_0x2ffc('0x103')],{});db[_0x2ffc('0x1f5')][_0x2ffc('0x126')](db[_0x2ffc('0xfc')],{'as':_0x2ffc('0x166'),'foreignKey':_0x2ffc('0x178')});db[_0x2ffc('0x1f5')][_0x2ffc('0x126')](db[_0x2ffc('0x72')],{'as':_0x2ffc('0x15b'),'foreignKey':_0x2ffc('0x16a')});db['WhatsappQueueReport'][_0x2ffc('0x126')](db[_0x2ffc('0x106')],{});db[_0x2ffc('0x1f5')][_0x2ffc('0x126')](db[_0x2ffc('0x10b')],{});db[_0x2ffc('0x1f5')][_0x2ffc('0x126')](db['WhatsappMessage'],{});db[_0x2ffc('0x1f5')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{});db[_0x2ffc('0x109')][_0x2ffc('0x126')](db[_0x2ffc('0x107')],{});db[_0x2ffc('0x109')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x2ffc('0x109')]['belongsTo'](db[_0x2ffc('0x103')],{'foreignKey':'FromWhatsappAccountId','as':_0x2ffc('0x1d9')});db[_0x2ffc('0x109')][_0x2ffc('0x126')](db[_0x2ffc('0x103')],{'foreignKey':_0x2ffc('0x1f6'),'as':_0x2ffc('0x1df')});db[_0x2ffc('0x109')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0x2ffc('0x1dd')});db[_0x2ffc('0x109')][_0x2ffc('0x126')](db['User'],{'foreignKey':_0x2ffc('0x1da'),'as':'FromAgent'});db[_0x2ffc('0x109')][_0x2ffc('0x126')](db['User'],{'foreignKey':_0x2ffc('0x1db'),'as':_0x2ffc('0x1e2')});db['WhatsappQueue'][_0x2ffc('0x129')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x168'),'through':_0x2ffc('0x38'),'foreignKey':_0x2ffc('0x1f7')});db[_0x2ffc('0x10b')][_0x2ffc('0x129')](db[_0x2ffc('0x12d')],{'through':_0x2ffc('0x1d3'),'as':_0x2ffc('0x153')});db[_0x2ffc('0x112')][_0x2ffc('0x126')](db[_0x2ffc('0x12')],{'as':_0x2ffc('0x1f8'),'foreignKey':_0x2ffc('0x117'),'onDelete':'cascade','hooks':!![]});db[_0x2ffc('0x10d')][_0x2ffc('0x114')](db[_0x2ffc('0xcb')],{'as':_0x2ffc('0xcb'),'onDelete':'restrict'});db[_0x2ffc('0x10d')][_0x2ffc('0x114')](db[_0x2ffc('0x15c')],{'as':'Imap','onDelete':_0x2ffc('0x15e')});db[_0x2ffc('0x10d')]['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x2ffc('0x15e')});module[_0x2ffc('0x1f9')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x9dda=['Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Team','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','UserChatQueue','FaxQueues','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','ChanSpyId','VoiceContext','Applications','Sound','Sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','Trunk','TrunkId','TrunkBackup','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','ContactId','MailAccountId','restrict','MailServerOut','CloudProviderId','Smtp','Dispositions','CannedAnswer','Answers','Interactions','ListId','TemplateId','team_has_mail_queues','Teams','Account','Contact','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','ChatWebsite','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','List','Items','FaxAccountId','Exntensions','FaxMessage','FaxQueue','FaxInteractionId','fax_interaction_has_tags','Tags','AttachmentId','SmsAccountId','SmsApplication','SmsInteractionId','Owner','sms_interaction_has_tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','CompanyId','Phones','cm_contact_has_tags','AdditionalPhones','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','ItemType','ItemTypeId','CmHopperAdditionalPhone','Hopper','CmHopperId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','VariableId','SugarcrmField','AccountId','Subject','Field','DeskField','int_desk_configuration_has_tags','Description','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowField','FreshsalesConfiguration','FromId','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','user_has_teams','SmsQueues','HopperBlacks','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','Imap','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','username','password','options','database','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model'];(function(_0x4e6e5f,_0x1509d9){var _0x3f3eb7=function(_0x4c933f){while(--_0x4c933f){_0x4e6e5f['push'](_0x4e6e5f['shift']());}};_0x3f3eb7(++_0x1509d9);}(_0x9dda,0x131));var _0xa9dd=function(_0x56124d,_0x244a40){_0x56124d=_0x56124d-0x0;var _0x511726=_0x9dda[_0x56124d];return _0x511726;};'use strict';var config=require(_0xa9dd('0x0'));var Sequelize=require(_0xa9dd('0x1'));var _=require(_0xa9dd('0x2'));var jstz=require('jstz');var timezone=jstz[_0xa9dd('0x3')]();config['sequelize']=_[_0xa9dd('0x4')](config[_0xa9dd('0x1')],{'database':'motion2','username':'xcall','password':_0xa9dd('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xa9dd('0x6'),'dialectOptions':{'charset':_0xa9dd('0x7')},'logging':![],'timezone':timezone[_0xa9dd('0x8')](),'define':{'charset':_0xa9dd('0x9'),'collate':_0xa9dd('0xa')}}});config[_0xa9dd('0xb')]=_[_0xa9dd('0x4')](config[_0xa9dd('0xb')],{'database':_0xa9dd('0xc'),'username':_0xa9dd('0xd'),'password':_0xa9dd('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xa9dd('0x8')](),'define':{'charset':_0xa9dd('0x9'),'collate':_0xa9dd('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa9dd('0x1')]['database'],config['sequelize'][_0xa9dd('0xe')],config[_0xa9dd('0x1')][_0xa9dd('0xf')],config['sequelize'][_0xa9dd('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xa9dd('0x11')],config[_0xa9dd('0xb')]['username'],config[_0xa9dd('0xb')][_0xa9dd('0xf')],config['sequelizeHistory'][_0xa9dd('0x10')])};db[_0xa9dd('0x12')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x13'));db[_0xa9dd('0x14')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x16'));db['VoiceContext']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x17'));db[_0xa9dd('0x18')]=db[_0xa9dd('0x1')]['import']('../api/voiceExtension/voiceExtension.model');db[_0xa9dd('0x19')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x1a'));db[_0xa9dd('0x1b')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x1c'));db[_0xa9dd('0x1d')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x1e'));db[_0xa9dd('0x1f')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/screenRecording/screenRecording.model');db[_0xa9dd('0x20')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x21'));db[_0xa9dd('0x22')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x23'));db[_0xa9dd('0x24')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x25'));db[_0xa9dd('0x26')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x27'));db[_0xa9dd('0x28')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xa9dd('0x29')]=db['sequelize']['import'](_0xa9dd('0x2a'));db[_0xa9dd('0x2b')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x2c'));db['Trunk']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/trunk/trunk.model');db[_0xa9dd('0x2d')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x2e'));db['UserVoiceQueueRt']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xa9dd('0x2f')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x30'));db[_0xa9dd('0x31')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x32'));db[_0xa9dd('0x33')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x34'));db['UserSmsQueue']=db['sequelize'][_0xa9dd('0x15')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x35'));db[_0xa9dd('0x36')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x37'));db[_0xa9dd('0x38')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0xa9dd('0x39')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/mailAccount/mailAccount.model');db[_0xa9dd('0x3a')]=db['sequelize']['import'](_0xa9dd('0x3b'));db[_0xa9dd('0x3c')]=db[_0xa9dd('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x3d'));db[_0xa9dd('0x3e')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x3f'));db[_0xa9dd('0x40')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x41'));db[_0xa9dd('0x42')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x43'));db[_0xa9dd('0x44')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/dashboard/dashboard.model');db[_0xa9dd('0x45')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0xa9dd('0x46')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x47'));db[_0xa9dd('0x48')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x49'));db[_0xa9dd('0x4a')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x4b'));db['FaxMessage']=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x4c'));db['FaxQueue']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x4d'));db[_0xa9dd('0x4e')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x4f'));db[_0xa9dd('0x50')]=db['sequelize'][_0xa9dd('0x15')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0xa9dd('0x51')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x52'));db[_0xa9dd('0x53')]=db[_0xa9dd('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0xa9dd('0x54')]=db['sequelize'][_0xa9dd('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0xa9dd('0x55')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x56'));db[_0xa9dd('0x57')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x58'));db[_0xa9dd('0x59')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0xa9dd('0x5a')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x5b'));db['ChatWebsite']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x5c'));db[_0xa9dd('0x5d')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x5e'));db[_0xa9dd('0x5f')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x60'));db['ChatInteraction']=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x61'));db[_0xa9dd('0x62')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x63'));db['ChatOfflineMessage']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xa9dd('0x64')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x65'));db[_0xa9dd('0x66')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x67'));db['ChatProactiveAction']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x68'));db[_0xa9dd('0x69')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x6a'));db[_0xa9dd('0x6b')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x6c'));db[_0xa9dd('0x6d')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x6e'));db['CmHopperBlack']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x6f'));db[_0xa9dd('0x70')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x71'));db[_0xa9dd('0x72')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x73'));db[_0xa9dd('0x74')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x75'));db[_0xa9dd('0x76')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x77'));db[_0xa9dd('0x78')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x79'));db[_0xa9dd('0x7a')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x7b'));db['CannedAnswer']=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x7c'));db[_0xa9dd('0x7d')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x7e'));db[_0xa9dd('0x7f')]=db[_0xa9dd('0x1')]['import']('../api/condition/condition.model');db['Interval']=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x80'));db[_0xa9dd('0x81')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0x82'));db[_0xa9dd('0x83')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x84'));db['VoiceQueuesLog']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xa9dd('0x85')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/schedule/schedule.model');db['Sound']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x86'));db[_0xa9dd('0x87')]=db['sequelize'][_0xa9dd('0x15')]('../api/tag/tag.model');db[_0xa9dd('0x88')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x89'));db[_0xa9dd('0x8a')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db['sequelize']['import'](_0xa9dd('0x8b'));db[_0xa9dd('0x8c')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x8d'));db[_0xa9dd('0x8e')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/trigger/trigger.model');db[_0xa9dd('0x8f')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x90'));db[_0xa9dd('0x91')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x92'));db[_0xa9dd('0x93')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x94'));db[_0xa9dd('0x95')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x96'));db[_0xa9dd('0x97')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x98'));db['AnalyticMetric']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x99'));db[_0xa9dd('0x9a')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xa9dd('0x9b')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x9c'));db[_0xa9dd('0x9d')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x9e'));db[_0xa9dd('0x9f')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0xa0'));db[_0xa9dd('0xa1')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0xa9dd('0xa2')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xa9dd('0xa3')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xa4'));db[_0xa9dd('0xa5')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xa6'));db[_0xa9dd('0xa7')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xa8'));db[_0xa9dd('0xa9')]=db[_0xa9dd('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xa9dd('0xaa')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xab'));db[_0xa9dd('0xac')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/intZohoField/intZohoField.model');db[_0xa9dd('0xad')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xae'));db[_0xa9dd('0xaf')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xb0'));db[_0xa9dd('0xb1')]=db[_0xa9dd('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xa9dd('0xb2')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xb3'));db[_0xa9dd('0xb4')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xb5'));db[_0xa9dd('0xb6')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0xb7'));db[_0xa9dd('0xb8')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xa9dd('0xb9')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xba'));db['VtigerField']=db[_0xa9dd('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0xa9dd('0xbb')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xbc'));db[_0xa9dd('0xbd')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xbe'));db['ServicenowField']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xbf'));db[_0xa9dd('0xc0')]=db['sequelize'][_0xa9dd('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xa9dd('0xc1')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xc2'));db[_0xa9dd('0xc3')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0xc4'));db[_0xa9dd('0xc5')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xc6'));db['FreshsalesConfiguration']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xa9dd('0xc7')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xc8'));db[_0xa9dd('0x91')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0x92'));db[_0xa9dd('0xc9')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xca'));db[_0xa9dd('0xcb')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xcc'));db[_0xa9dd('0xcd')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xce'));db[_0xa9dd('0xcf')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xd0'));db[_0xa9dd('0xd1')]=db[_0xa9dd('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xa9dd('0xd2')]=db['sequelize']['import'](_0xa9dd('0xd3'));db['SmsQueueReport']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0xa9dd('0xd4')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xd5'));db['SquareDetailsReport']=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xd6'));db['JscriptyProject']=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0xd7'));db['Setting']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xd8'));db[_0xa9dd('0xd9')]=db['sequelize']['import']('../api/squareOdbc/squareOdbc.model');db[_0xa9dd('0xda')]=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xdb'));db[_0xa9dd('0xdc')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0xdd'));db['SquareMessage']=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xde'));db['License']=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xdf'));db[_0xa9dd('0xe0')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xe1'));db['Migration']=db[_0xa9dd('0x1')]['import']('../api/migration/migration.model');db[_0xa9dd('0xe2')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/attachment/attachment.model');db[_0xa9dd('0xe3')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xe4'));db[_0xa9dd('0xe5')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0xa9dd('0xe6')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xe7'));db[_0xa9dd('0xe8')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xe9'));db[_0xa9dd('0xea')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xa9dd('0xeb')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xec'));db[_0xa9dd('0xed')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/cmList/cmList.model');db[_0xa9dd('0xee')]=db[_0xa9dd('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0xa9dd('0xef')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/userProfile/userProfile.model');db[_0xa9dd('0xf0')]=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0xf1'));db[_0xa9dd('0xf2')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xf3'));db['UserNotification']=db['sequelize'][_0xa9dd('0x15')](_0xa9dd('0xf4'));db[_0xa9dd('0xf5')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0xa9dd('0xf6')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0xa9dd('0x1')]['import'](_0xa9dd('0xf7'));db[_0xa9dd('0xf8')]=db[_0xa9dd('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0xa9dd('0xf9')]=db['sequelize']['import'](_0xa9dd('0xfa'));db[_0xa9dd('0xfb')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xfc'));db['WhatsappQueue']=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0xfd'));db[_0xa9dd('0xfe')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0xa9dd('0xff')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xa9dd('0x100')]=db['sequelize'][_0xa9dd('0x15')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xa9dd('0x101')]=db[_0xa9dd('0x1')][_0xa9dd('0x15')](_0xa9dd('0x102'));db[_0xa9dd('0x103')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db[_0xa9dd('0x12')][_0xa9dd('0x104')](db[_0xa9dd('0x20')],{'as':_0xa9dd('0x20'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x106')});db['User'][_0xa9dd('0x104')](db[_0xa9dd('0x103')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x12')][_0xa9dd('0x107')](db[_0xa9dd('0x1d')],{'as':_0xa9dd('0x108'),'foreignKey':_0xa9dd('0x106')});db['User'][_0xa9dd('0x107')](db['UserVoiceQueueRt'],{'as':_0xa9dd('0x109'),'foreignKey':_0xa9dd('0x106')});db['User'][_0xa9dd('0x107')](db[_0xa9dd('0x18')],{'as':_0xa9dd('0x10a'),'onDelete':_0xa9dd('0x105'),'hooks':!![]});db[_0xa9dd('0x12')]['hasMany'](db[_0xa9dd('0x70')],{'as':_0xa9dd('0x10b'),'foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x12')][_0xa9dd('0x107')](db['CmHopperHistory'],{'as':_0xa9dd('0x10c'),'foreignKey':_0xa9dd('0x106')});db['User'][_0xa9dd('0x107')](db['ReportAgentPreview'],{'as':_0xa9dd('0x74'),'foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x12')]['hasMany'](db[_0xa9dd('0x57')],{'as':_0xa9dd('0x10d'),'foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x12')][_0xa9dd('0x107')](db[_0xa9dd('0x10e')],{'as':_0xa9dd('0x10f'),'foreignKey':'UserId'});db[_0xa9dd('0x12')]['hasMany'](db[_0xa9dd('0x110')],{'as':'SmsInteractions','foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x12')][_0xa9dd('0x107')](db[_0xa9dd('0x4a')],{'as':_0xa9dd('0x111'),'foreignKey':'UserId'});db[_0xa9dd('0x12')][_0xa9dd('0x107')](db[_0xa9dd('0x112')],{'as':_0xa9dd('0x113'),'foreignKey':_0xa9dd('0x106')});db['User']['hasMany'](db[_0xa9dd('0x114')],{'as':_0xa9dd('0x115'),'foreignKey':_0xa9dd('0x106')});db['User'][_0xa9dd('0x107')](db['UserNotification'],{'as':_0xa9dd('0x116'),'foreignKey':'SenderId'});db['User'][_0xa9dd('0x117')](db[_0xa9dd('0xef')],{'as':'UserProfile','foreignKey':_0xa9dd('0x118')});db['User']['belongsToMany'](db[_0xa9dd('0x66')],{'as':'Groups','through':_0xa9dd('0x119')});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db['CmContact'],{'as':_0xa9dd('0x11b'),'through':_0xa9dd('0x11c')});db['User']['belongsToMany'](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0xa9dd('0x11d')],{'through':'user_has_teams'});db['User'][_0xa9dd('0x11a')](db[_0xa9dd('0x112')],{'as':_0xa9dd('0x113'),'through':_0xa9dd('0x11e')});db['User']['belongsToMany'](db[_0xa9dd('0x10e')],{'as':_0xa9dd('0x10f'),'through':_0xa9dd('0x11f')});db[_0xa9dd('0x12')]['belongsToMany'](db[_0xa9dd('0x4a')],{'as':'FaxInteractions','through':_0xa9dd('0x120')});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db['SmsInteraction'],{'as':_0xa9dd('0x121'),'through':_0xa9dd('0x122')});db['User'][_0xa9dd('0x11a')](db[_0xa9dd('0x57')],{'as':_0xa9dd('0x10d'),'through':'user_has_openchannel_interactions'});db[_0xa9dd('0x12')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0xa9dd('0x115'),'through':_0xa9dd('0x123')});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db[_0xa9dd('0x1b')],{'as':_0xa9dd('0x124'),'through':_0xa9dd('0x2f'),'required':![]});db[_0xa9dd('0x12')]['belongsToMany'](db[_0xa9dd('0xee')],{'as':_0xa9dd('0x125'),'through':_0xa9dd('0x101'),'required':![]});db['User'][_0xa9dd('0x11a')](db['MailQueue'],{'as':_0xa9dd('0x126'),'through':_0xa9dd('0x31'),'required':![]});db['User'][_0xa9dd('0x11a')](db[_0xa9dd('0x64')],{'as':_0xa9dd('0x127'),'through':_0xa9dd('0x128'),'required':![],'hooks':!![]});db[_0xa9dd('0x12')]['belongsToMany'](db['FaxQueue'],{'as':_0xa9dd('0x129'),'through':_0xa9dd('0x33'),'required':![]});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db[_0xa9dd('0x53')],{'as':'SmsQueues','through':_0xa9dd('0x12a'),'required':![]});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db['OpenchannelQueue'],{'as':_0xa9dd('0x12b'),'through':_0xa9dd('0x12c'),'required':![]});db[_0xa9dd('0x12')]['belongsToMany'](db[_0xa9dd('0x12d')],{'as':_0xa9dd('0x12e'),'through':_0xa9dd('0x36'),'required':![]});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db[_0xa9dd('0xed')],{'through':_0xa9dd('0x12f')});db[_0xa9dd('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':_0xa9dd('0x130'),'through':_0xa9dd('0x131')});db['User'][_0xa9dd('0x11a')](db[_0xa9dd('0x46')],{'as':_0xa9dd('0x132'),'through':_0xa9dd('0x133')});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db['MailAccount'],{'as':_0xa9dd('0x134'),'through':_0xa9dd('0x135')});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db['OpenchannelAccount'],{'as':_0xa9dd('0x136'),'through':_0xa9dd('0x137')});db[_0xa9dd('0x12')]['belongsToMany'](db['SmsAccount'],{'as':_0xa9dd('0x138'),'through':_0xa9dd('0x139')});db['User'][_0xa9dd('0x11a')](db['WhatsappAccount'],{'as':_0xa9dd('0x13a'),'through':_0xa9dd('0x13b')});db[_0xa9dd('0x12')][_0xa9dd('0x11a')](db[_0xa9dd('0xda')],{'as':'SquareProjects','through':_0xa9dd('0x13c')});db[_0xa9dd('0x14')][_0xa9dd('0x107')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x13d')});db[_0xa9dd('0x13e')][_0xa9dd('0x107')](db[_0xa9dd('0x18')],{'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x18')][_0xa9dd('0x107')](db[_0xa9dd('0x18')],{'as':_0xa9dd('0x13f'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x19')][_0xa9dd('0x11a')](db[_0xa9dd('0x140')],{'as':_0xa9dd('0x141'),'through':'moh_has_sounds'});db[_0xa9dd('0x1b')]['hasMany'](db[_0xa9dd('0x142')],{'as':_0xa9dd('0x143'),'foreignKey':_0xa9dd('0x144')});db[_0xa9dd('0x1b')]['hasMany'](db[_0xa9dd('0x6d')],{'as':_0xa9dd('0x145'),'foreignKey':'VoiceQueueId'});db[_0xa9dd('0x1b')][_0xa9dd('0x107')](db[_0xa9dd('0x70')],{'as':_0xa9dd('0x10b'),'foreignKey':_0xa9dd('0x144')});db[_0xa9dd('0x1b')]['hasMany'](db['CmHopperHistory'],{'as':_0xa9dd('0x146'),'foreignKey':_0xa9dd('0x144')});db[_0xa9dd('0x1b')][_0xa9dd('0x107')](db[_0xa9dd('0x74')],{'as':_0xa9dd('0x74'),'foreignKey':_0xa9dd('0x144')});db[_0xa9dd('0x1b')][_0xa9dd('0x107')](db[_0xa9dd('0x147')],{'as':'HopperBlacks','foreignKey':_0xa9dd('0x144')});db['VoiceQueue']['hasMany'](db[_0xa9dd('0xd2')],{'as':_0xa9dd('0x148'),'foreignKey':_0xa9dd('0x144')});db[_0xa9dd('0x1b')][_0xa9dd('0x117')](db[_0xa9dd('0x149')],{'as':_0xa9dd('0x149'),'foreignKey':_0xa9dd('0x14a')});db[_0xa9dd('0x1b')][_0xa9dd('0x117')](db['Trunk'],{'as':_0xa9dd('0x14b'),'foreignKey':'TrunkBackupId'});db[_0xa9dd('0x1b')][_0xa9dd('0x117')](db[_0xa9dd('0x14c')],{'as':'Interval','foreignKey':_0xa9dd('0x14d')});db[_0xa9dd('0x1b')]['belongsTo'](db[_0xa9dd('0x81')],{'as':_0xa9dd('0x14e'),'foreignKey':_0xa9dd('0x14f')});db[_0xa9dd('0x1b')][_0xa9dd('0x11a')](db['CmList'],{'as':_0xa9dd('0x150'),'through':_0xa9dd('0x151')});db[_0xa9dd('0x1b')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':_0xa9dd('0x2f')});db[_0xa9dd('0x1b')][_0xa9dd('0x11a')](db[_0xa9dd('0x11d')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xa9dd('0x1b')][_0xa9dd('0x11a')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x153'),'through':_0xa9dd('0x154')});db['VoiceRecording'][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x12'),'foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x1f')]['belongsTo'](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x12'),'foreignKey':'UserId'});db['VoiceMail'][_0xa9dd('0x107')](db[_0xa9dd('0x22')],{'as':_0xa9dd('0x155'),'onDelete':_0xa9dd('0x105'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage'][_0xa9dd('0x117')](db[_0xa9dd('0x20')],{'foreignKey':_0xa9dd('0x156'),'targetKey':_0xa9dd('0x157')});db[_0xa9dd('0x24')][_0xa9dd('0x107')](db[_0xa9dd('0x29')],{'as':'QueueCalls','foreignKey':_0xa9dd('0x158'),'constraints':![]});db[_0xa9dd('0x24')][_0xa9dd('0x107')](db[_0xa9dd('0x28')],{'as':_0xa9dd('0x159'),'foreignKey':_0xa9dd('0x158'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x12'),'foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x24')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':'Contact','foreignKey':_0xa9dd('0x15a')});db['MailServerIn'][_0xa9dd('0x117')](db['MailAccount'],{'as':_0xa9dd('0x39'),'foreignKey':_0xa9dd('0x15b')});db['MailServerIn'][_0xa9dd('0x117')](db[_0xa9dd('0xfe')],{'as':_0xa9dd('0xfe'),'foreignKey':'CloudProviderId','onDelete':_0xa9dd('0x15c')});db['MailServerOut'][_0xa9dd('0x117')](db[_0xa9dd('0x39')],{'as':_0xa9dd('0x39'),'foreignKey':'MailAccountId'});db[_0xa9dd('0x15d')]['belongsTo'](db[_0xa9dd('0xfe')],{'as':_0xa9dd('0xfe'),'foreignKey':_0xa9dd('0x15e'),'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x39')]['hasOne'](db['MailServerIn'],{'as':'Imap','onDelete':'cascade'});db['MailAccount'][_0xa9dd('0x104')](db[_0xa9dd('0x15d')],{'as':_0xa9dd('0x15f'),'onDelete':_0xa9dd('0x105')});db['MailAccount']['hasMany'](db[_0xa9dd('0x7d')],{'as':_0xa9dd('0x160'),'foreignKey':'MailAccountId','onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x39')][_0xa9dd('0x107')](db[_0xa9dd('0x161')],{'as':_0xa9dd('0x162'),'foreignKey':'MailAccountId'});db[_0xa9dd('0x39')][_0xa9dd('0x107')](db['MailMessage'],{'as':_0xa9dd('0x155'),'foreignKey':_0xa9dd('0x15b')});db['MailAccount']['hasMany'](db[_0xa9dd('0x112')],{'as':_0xa9dd('0x163')});db['MailAccount'][_0xa9dd('0x107')](db['MailApplication'],{'as':_0xa9dd('0x13f')});db[_0xa9dd('0x39')]['belongsTo'](db[_0xa9dd('0xed')],{'as':'List','foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0x39')][_0xa9dd('0x117')](db['Template'],{'as':_0xa9dd('0x8c'),'foreignKey':_0xa9dd('0x165')});db['MailAccount']['belongsTo'](db['Pause'],{'as':_0xa9dd('0x14e'),'foreignKey':_0xa9dd('0x14f')});db['MailAccount'][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':'Agents','through':_0xa9dd('0x135')});db[_0xa9dd('0x3a')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db['Team'],{'through':_0xa9dd('0x166'),'as':_0xa9dd('0x167')});db[_0xa9dd('0x112')][_0xa9dd('0x107')](db[_0xa9dd('0x3e')],{'as':_0xa9dd('0x155'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xa9dd('0x112')][_0xa9dd('0x117')](db[_0xa9dd('0x39')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x15b')});db[_0xa9dd('0x112')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x112')][_0xa9dd('0x117')](db['User'],{'as':'Owner','foreignKey':_0xa9dd('0x106')});db['MailInteraction'][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x16a'),'as':'Tags'});db[_0xa9dd('0x112')]['belongsToMany'](db['Tag'],{'through':_0xa9dd('0x16a'),'as':_0xa9dd('0x16b')});db[_0xa9dd('0x112')]['belongsToMany'](db['User'],{'as':_0xa9dd('0x16c'),'through':_0xa9dd('0x11e'),'foreignKey':_0xa9dd('0x16d')});db[_0xa9dd('0x3e')][_0xa9dd('0x107')](db['Attachment'],{'as':_0xa9dd('0x16e'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x3e')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x12')});db[_0xa9dd('0x3e')][_0xa9dd('0x117')](db['CmContact'],{'onDelete':_0xa9dd('0x105'),'as':_0xa9dd('0x169')});db['MailMessage'][_0xa9dd('0x117')](db[_0xa9dd('0x112')],{'as':'Interaction','foreignKey':_0xa9dd('0x16d')});db[_0xa9dd('0x3e')]['belongsTo'](db[_0xa9dd('0x39')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x15b')});db['MailMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xa9dd('0x16f'),'foreignKey':_0xa9dd('0x170')});db['MailMessage'][_0xa9dd('0x117')](db[_0xa9dd('0x171')],{'as':_0xa9dd('0x171'),'foreignKey':_0xa9dd('0x172')});db[_0xa9dd('0x40')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x40')]['belongsTo'](db[_0xa9dd('0x3a')],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x40')]['belongsTo'](db['MailAccount'],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x40')][_0xa9dd('0x117')](db['Interval'],{'onDelete':_0xa9dd('0x15c'),'foreignKey':'IntervalId'});db[_0xa9dd('0x40')][_0xa9dd('0x117')](db[_0xa9dd('0x87')],{'onDelete':'restrict','foreignKey':_0xa9dd('0x173')});db[_0xa9dd('0x42')][_0xa9dd('0x117')](db['MailAccount'],{});db[_0xa9dd('0x42')]['belongsTo'](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0x42')]['belongsTo'](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x42')][_0xa9dd('0x117')](db[_0xa9dd('0x112')],{});db[_0xa9dd('0x42')]['belongsTo'](db[_0xa9dd('0x3e')],{});db[_0xa9dd('0x42')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{});db[_0xa9dd('0x42')][_0xa9dd('0x117')](db[_0xa9dd('0x3a')],{});db[_0xa9dd('0x44')][_0xa9dd('0x107')](db[_0xa9dd('0x45')],{'as':_0xa9dd('0x175'),'onDelete':'cascade'});db[_0xa9dd('0x46')]['hasMany'](db['Disposition'],{'as':_0xa9dd('0x160'),'foreignKey':_0xa9dd('0x176'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x46')][_0xa9dd('0x107')](db['CannedAnswer'],{'as':_0xa9dd('0x162'),'foreignKey':_0xa9dd('0x176')});db['FaxAccount']['hasMany'](db[_0xa9dd('0x4a')],{'as':_0xa9dd('0x163')});db[_0xa9dd('0x46')]['hasMany'](db[_0xa9dd('0x48')],{'as':_0xa9dd('0x13f')});db[_0xa9dd('0x46')][_0xa9dd('0x107')](db['VoiceExtension'],{'as':_0xa9dd('0x177'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x46')][_0xa9dd('0x107')](db[_0xa9dd('0x178')],{'as':'Messages'});db[_0xa9dd('0x46')]['belongsTo'](db[_0xa9dd('0x149')],{'as':_0xa9dd('0x149')});db['FaxAccount'][_0xa9dd('0x117')](db['CmList'],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0x46')][_0xa9dd('0x117')](db[_0xa9dd('0x81')],{'as':_0xa9dd('0x14e'),'foreignKey':_0xa9dd('0x14f')});db[_0xa9dd('0x46')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':_0xa9dd('0x133')});db[_0xa9dd('0x48')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'onDelete':'restrict'});db['FaxApplication'][_0xa9dd('0x117')](db[_0xa9dd('0x179')],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x48')][_0xa9dd('0x117')](db[_0xa9dd('0x46')],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x48')]['belongsTo'](db[_0xa9dd('0x87')],{'onDelete':_0xa9dd('0x15c'),'foreignKey':_0xa9dd('0x173')});db[_0xa9dd('0x4a')][_0xa9dd('0x107')](db[_0xa9dd('0x178')],{'as':_0xa9dd('0x155'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x17a')});db[_0xa9dd('0x4a')]['belongsTo'](db[_0xa9dd('0x46')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x176')});db[_0xa9dd('0x4a')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':'Contact','foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x4a')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':'Owner','foreignKey':_0xa9dd('0x106')});db['FaxInteraction'][_0xa9dd('0x11a')](db['Tag'],{'through':_0xa9dd('0x17b'),'as':_0xa9dd('0x17c')});db[_0xa9dd('0x4a')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x17b'),'as':_0xa9dd('0x16b')});db[_0xa9dd('0x4a')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xa9dd('0x17a')});db[_0xa9dd('0x178')][_0xa9dd('0x117')](db['User'],{'onDelete':'cascade','as':_0xa9dd('0x12')});db[_0xa9dd('0x178')][_0xa9dd('0x117')](db[_0xa9dd('0x4a')],{'as':'Interaction','foreignKey':_0xa9dd('0x17a')});db[_0xa9dd('0x178')][_0xa9dd('0x117')](db['CmContact'],{'onDelete':_0xa9dd('0x105'),'as':_0xa9dd('0x169')});db[_0xa9dd('0x178')]['belongsTo'](db[_0xa9dd('0xe2')],{'as':'Attachment','foreignKey':_0xa9dd('0x17d')});db[_0xa9dd('0x178')][_0xa9dd('0x117')](db['FaxAccount'],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x176')});db[_0xa9dd('0x179')]['belongsToMany'](db[_0xa9dd('0x12')],{'as':'Agents','through':_0xa9dd('0x33')});db[_0xa9dd('0x179')][_0xa9dd('0x11a')](db['Team'],{'through':'team_has_fax_queues','as':_0xa9dd('0x167')});db[_0xa9dd('0x4e')][_0xa9dd('0x117')](db[_0xa9dd('0x46')],{});db[_0xa9dd('0x4e')][_0xa9dd('0x117')](db['CmList'],{'as':_0xa9dd('0x174'),'foreignKey':'ListId'});db[_0xa9dd('0x4e')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x4e')][_0xa9dd('0x117')](db[_0xa9dd('0x4a')],{});db[_0xa9dd('0x4e')][_0xa9dd('0x117')](db['FaxMessage'],{});db[_0xa9dd('0x4e')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{});db['FaxQueueReport'][_0xa9dd('0x117')](db[_0xa9dd('0x179')],{});db[_0xa9dd('0x50')][_0xa9dd('0x107')](db[_0xa9dd('0x7d')],{'as':_0xa9dd('0x160'),'foreignKey':_0xa9dd('0x17e'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x50')]['hasMany'](db[_0xa9dd('0x161')],{'as':_0xa9dd('0x162'),'foreignKey':_0xa9dd('0x17e')});db['SmsAccount'][_0xa9dd('0x107')](db[_0xa9dd('0x51')],{'as':'Messages','foreignKey':_0xa9dd('0x17e')});db[_0xa9dd('0x50')]['hasMany'](db[_0xa9dd('0x110')],{'as':_0xa9dd('0x163')});db[_0xa9dd('0x50')][_0xa9dd('0x107')](db[_0xa9dd('0x17f')],{'as':'Applications'});db['SmsAccount'][_0xa9dd('0x117')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0x50')][_0xa9dd('0x117')](db[_0xa9dd('0x81')],{'as':_0xa9dd('0x14e'),'foreignKey':_0xa9dd('0x14f')});db[_0xa9dd('0x50')]['belongsToMany'](db[_0xa9dd('0x12')],{'as':'Agents','through':_0xa9dd('0x139')});db[_0xa9dd('0x17f')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x17f')][_0xa9dd('0x117')](db[_0xa9dd('0x53')],{'onDelete':_0xa9dd('0x15c')});db['SmsApplication']['belongsTo'](db[_0xa9dd('0x50')],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x17f')][_0xa9dd('0x117')](db[_0xa9dd('0x14c')],{'onDelete':_0xa9dd('0x15c'),'foreignKey':_0xa9dd('0x14d')});db[_0xa9dd('0x17f')][_0xa9dd('0x117')](db['Tag'],{'onDelete':_0xa9dd('0x15c'),'foreignKey':_0xa9dd('0x173')});db[_0xa9dd('0x110')][_0xa9dd('0x107')](db[_0xa9dd('0x51')],{'as':_0xa9dd('0x155'),'onDelete':'cascade','foreignKey':_0xa9dd('0x180')});db[_0xa9dd('0x110')][_0xa9dd('0x117')](db[_0xa9dd('0x50')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x17e')});db[_0xa9dd('0x110')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x110')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x181'),'foreignKey':'UserId'});db[_0xa9dd('0x110')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x182'),'as':_0xa9dd('0x17c')});db[_0xa9dd('0x110')][_0xa9dd('0x11a')](db['Tag'],{'through':_0xa9dd('0x182'),'as':_0xa9dd('0x16b')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0xa9dd('0x16c'),'through':'user_has_sms_interactions','foreignKey':_0xa9dd('0x180')});db[_0xa9dd('0x51')]['belongsTo'](db[_0xa9dd('0x12')],{'as':'User'});db[_0xa9dd('0x51')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'onDelete':_0xa9dd('0x105'),'as':_0xa9dd('0x169')});db[_0xa9dd('0x51')][_0xa9dd('0x117')](db[_0xa9dd('0x110')],{'onDelete':_0xa9dd('0x105'),'as':_0xa9dd('0x183'),'foreignKey':_0xa9dd('0x180')});db[_0xa9dd('0x51')][_0xa9dd('0x117')](db['SmsAccount'],{'as':_0xa9dd('0x168'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':_0xa9dd('0x12a'),'foreignKey':_0xa9dd('0x184')});db['SmsQueue'][_0xa9dd('0x11a')](db[_0xa9dd('0x11d')],{'through':_0xa9dd('0x185'),'as':_0xa9dd('0x167')});db['OpenchannelAccount']['hasMany'](db[_0xa9dd('0x7d')],{'as':_0xa9dd('0x160'),'foreignKey':_0xa9dd('0x186'),'onDelete':'cascade'});db[_0xa9dd('0x54')][_0xa9dd('0x107')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xa9dd('0x186')});db[_0xa9dd('0x54')][_0xa9dd('0x107')](db[_0xa9dd('0x57')],{'as':_0xa9dd('0x163'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xa9dd('0x107')](db[_0xa9dd('0x59')],{'as':_0xa9dd('0x155'),'foreignKey':_0xa9dd('0x186')});db['OpenchannelAccount'][_0xa9dd('0x107')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0xa9dd('0x186')});db[_0xa9dd('0x54')][_0xa9dd('0x117')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':'ListId'});db[_0xa9dd('0x54')][_0xa9dd('0x117')](db['Pause'],{'as':_0xa9dd('0x14e'),'foreignKey':_0xa9dd('0x14f')});db[_0xa9dd('0x54')]['belongsToMany'](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':'user_has_openchannel_accounts'});db[_0xa9dd('0x55')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xa9dd('0x117')](db[_0xa9dd('0x5a')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xa9dd('0x55')][_0xa9dd('0x117')](db[_0xa9dd('0x54')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xa9dd('0x55')][_0xa9dd('0x117')](db[_0xa9dd('0x14c')],{'onDelete':_0xa9dd('0x15c'),'foreignKey':_0xa9dd('0x14d')});db['OpenchannelApplication'][_0xa9dd('0x117')](db['Tag'],{'onDelete':_0xa9dd('0x15c'),'foreignKey':_0xa9dd('0x173')});db['OpenchannelInteraction'][_0xa9dd('0x107')](db[_0xa9dd('0x59')],{'as':'Messages','onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x187')});db[_0xa9dd('0x57')]['belongsTo'](db[_0xa9dd('0x54')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x186')});db[_0xa9dd('0x57')][_0xa9dd('0x117')](db['CmContact'],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x57')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x181'),'foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x57')]['belongsToMany'](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x188'),'as':'Tags'});db[_0xa9dd('0x57')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':'openchannel_interaction_has_tags','as':_0xa9dd('0x16b')});db['OpenchannelInteraction'][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0xa9dd('0x59')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'onDelete':'cascade','as':_0xa9dd('0x12')});db[_0xa9dd('0x59')]['belongsTo'](db[_0xa9dd('0x6b')],{'onDelete':_0xa9dd('0x105'),'as':'Contact'});db[_0xa9dd('0x59')]['belongsTo'](db[_0xa9dd('0x57')],{'onDelete':_0xa9dd('0x105'),'as':'Interaction','foreignKey':_0xa9dd('0x187')});db['OpenchannelMessage']['belongsTo'](db[_0xa9dd('0xe2')],{'as':_0xa9dd('0xe2'),'foreignKey':_0xa9dd('0x17d')});db[_0xa9dd('0x59')][_0xa9dd('0x117')](db[_0xa9dd('0x54')],{'as':_0xa9dd('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0xa9dd('0x5a')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0xa9dd('0x5a')][_0xa9dd('0x11a')](db[_0xa9dd('0x11d')],{'through':_0xa9dd('0x189'),'as':_0xa9dd('0x167')});db[_0xa9dd('0x16f')][_0xa9dd('0x107')](db[_0xa9dd('0x7d')],{'as':_0xa9dd('0x160'),'foreignKey':_0xa9dd('0x170'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x16f')][_0xa9dd('0x107')](db[_0xa9dd('0x161')],{'as':_0xa9dd('0x162'),'foreignKey':'ChatWebsiteId'});db[_0xa9dd('0x16f')]['hasMany'](db[_0xa9dd('0x18a')],{'as':_0xa9dd('0x18b')});db[_0xa9dd('0x16f')][_0xa9dd('0x107')](db['ChatInteraction'],{'as':_0xa9dd('0x163')});db['ChatWebsite'][_0xa9dd('0x107')](db[_0xa9dd('0x5f')],{'as':_0xa9dd('0x13f')});db['ChatWebsite'][_0xa9dd('0x107')](db[_0xa9dd('0x62')],{'as':_0xa9dd('0x155')});db[_0xa9dd('0x16f')][_0xa9dd('0x117')](db[_0xa9dd('0xed')],{'as':'List','foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0x16f')]['belongsTo'](db['Interval'],{'as':_0xa9dd('0x14c'),'foreignKey':_0xa9dd('0x14d')});db[_0xa9dd('0x16f')]['belongsTo'](db[_0xa9dd('0x39')],{'as':_0xa9dd('0x39'),'foreignKey':_0xa9dd('0x15b')});db[_0xa9dd('0x16f')][_0xa9dd('0x117')](db[_0xa9dd('0x81')],{'as':_0xa9dd('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa9dd('0x16f')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':_0xa9dd('0x131')});db[_0xa9dd('0x5d')][_0xa9dd('0x117')](db[_0xa9dd('0x54')],{});db[_0xa9dd('0x5d')][_0xa9dd('0x117')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0x5d')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':'ContactId'});db[_0xa9dd('0x5d')][_0xa9dd('0x117')](db[_0xa9dd('0x57')],{});db[_0xa9dd('0x5d')][_0xa9dd('0x117')](db[_0xa9dd('0x59')],{});db[_0xa9dd('0x5d')]['belongsTo'](db['User'],{});db[_0xa9dd('0x5d')][_0xa9dd('0x117')](db[_0xa9dd('0x5a')],{});db[_0xa9dd('0x5f')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':'Agent','foreignKey':_0xa9dd('0x106'),'onDelete':_0xa9dd('0x15c')});db['ChatApplication'][_0xa9dd('0x117')](db[_0xa9dd('0x64')],{'as':_0xa9dd('0x18c'),'foreignKey':_0xa9dd('0x18d'),'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x5f')]['belongsTo'](db[_0xa9dd('0x16f')],{'as':_0xa9dd('0x18e'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xa9dd('0x5f')][_0xa9dd('0x117')](db[_0xa9dd('0x87')],{'onDelete':_0xa9dd('0x15c'),'foreignKey':_0xa9dd('0x173')});db[_0xa9dd('0x10e')][_0xa9dd('0x107')](db[_0xa9dd('0x62')],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0xa9dd('0x10e')][_0xa9dd('0x117')](db[_0xa9dd('0x16f')],{'as':_0xa9dd('0x168'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0xa9dd('0x6b')],{'as':'Contact','foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x10e')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0xa9dd('0x10e')][_0xa9dd('0x11a')](db['Tag'],{'through':_0xa9dd('0x18f'),'as':_0xa9dd('0x17c')});db['ChatInteraction'][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x18f'),'as':'ThroughTags'});db['ChatInteraction'][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':'Users','through':_0xa9dd('0x11f'),'foreignKey':_0xa9dd('0x190')});db[_0xa9dd('0x62')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'onDelete':'cascade','as':_0xa9dd('0x12')});db[_0xa9dd('0x62')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'onDelete':_0xa9dd('0x105'),'as':_0xa9dd('0x169'),'foreignKey':'ContactId'});db['ChatMessage'][_0xa9dd('0x117')](db[_0xa9dd('0x10e')],{'onDelete':'cascade','as':_0xa9dd('0x183'),'foreignKey':_0xa9dd('0x190')});db['ChatMessage']['belongsTo'](db[_0xa9dd('0xe2')],{'as':_0xa9dd('0xe2'),'foreignKey':_0xa9dd('0x17d')});db[_0xa9dd('0x62')][_0xa9dd('0x117')](db['ChatWebsite'],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x170')});db[_0xa9dd('0x171')][_0xa9dd('0x107')](db[_0xa9dd('0xe2')],{'as':_0xa9dd('0x16e'),'foreignKey':_0xa9dd('0x172'),'onDelete':_0xa9dd('0x105'),'hooks':!![]});db[_0xa9dd('0x171')]['belongsTo'](db[_0xa9dd('0x6b')],{'onDelete':'cascade','as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0x171')][_0xa9dd('0x117')](db['ChatWebsite'],{'as':_0xa9dd('0x168'),'foreignKey':'ChatWebsiteId'});db[_0xa9dd('0x64')]['belongsToMany'](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':_0xa9dd('0x128'),'hooks':!![]});db[_0xa9dd('0x64')][_0xa9dd('0x11a')](db[_0xa9dd('0x11d')],{'through':_0xa9dd('0x191'),'as':'Teams'});db['ChatGroup'][_0xa9dd('0x107')](db[_0xa9dd('0xcd')],{'as':_0xa9dd('0x155'),'foreignKey':_0xa9dd('0x192'),'onDelete':'cascade'});db[_0xa9dd('0x66')][_0xa9dd('0x11a')](db['User'],{'as':_0xa9dd('0x143'),'through':_0xa9dd('0x119')});db[_0xa9dd('0x18a')][_0xa9dd('0x117')](db[_0xa9dd('0x16f')],{'as':_0xa9dd('0x18e'),'foreignKey':_0xa9dd('0x170')});db[_0xa9dd('0x69')][_0xa9dd('0x107')](db['CmContact'],{'as':_0xa9dd('0x11b'),'foreignKey':_0xa9dd('0x193')});db[_0xa9dd('0x6b')][_0xa9dd('0x107')](db['CmContactHasItem'],{'as':_0xa9dd('0x194'),'foreignKey':'CmContactId'});db['CmContact'][_0xa9dd('0x107')](db[_0xa9dd('0x6d')],{'as':_0xa9dd('0x145'),'foreignKey':'ContactId'});db[_0xa9dd('0x6b')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ContactId'});db['CmContact'][_0xa9dd('0x107')](db[_0xa9dd('0x72')],{'as':_0xa9dd('0x146'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xa9dd('0x74')],{'as':_0xa9dd('0x74'),'foreignKey':_0xa9dd('0x15a')});db['CmContact'][_0xa9dd('0x107')](db[_0xa9dd('0xd2')],{'as':_0xa9dd('0x148'),'foreignKey':_0xa9dd('0x15a')});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0xa9dd('0x10d'),'foreignKey':'ContactId','onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x6b')][_0xa9dd('0x107')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xa9dd('0x15a'),'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x6b')][_0xa9dd('0x107')](db[_0xa9dd('0x110')],{'as':'SmsInteractions','foreignKey':_0xa9dd('0x15a'),'onDelete':_0xa9dd('0x15c')});db['CmContact'][_0xa9dd('0x107')](db[_0xa9dd('0x4a')],{'as':_0xa9dd('0x111'),'foreignKey':_0xa9dd('0x15a'),'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x6b')][_0xa9dd('0x107')](db[_0xa9dd('0x112')],{'as':'MailInteractions','foreignKey':_0xa9dd('0x15a'),'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x6b')][_0xa9dd('0x117')](db[_0xa9dd('0x69')],{'as':'Company','foreignKey':_0xa9dd('0x193')});db[_0xa9dd('0x6b')][_0xa9dd('0x117')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':'ListId','onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x6b')][_0xa9dd('0x11a')](db['User'],{'as':_0xa9dd('0x16c'),'through':_0xa9dd('0x11c')});db['CmContact'][_0xa9dd('0x11a')](db['Tag'],{'as':'Tags','through':_0xa9dd('0x195')});db[_0xa9dd('0x6b')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x195'),'as':_0xa9dd('0x16b')});db[_0xa9dd('0x6d')][_0xa9dd('0x107')](db['CmHopperAdditionalPhone'],{'as':_0xa9dd('0x196'),'foreignKey':'CmHopperId'});db[_0xa9dd('0x6d')]['belongsTo'](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a'),'onDelete':_0xa9dd('0x105')});db['CmHopper'][_0xa9dd('0x117')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x6d')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x6d')][_0xa9dd('0x117')](db[_0xa9dd('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xa9dd('0x6d')][_0xa9dd('0x117')](db[_0xa9dd('0xe0')],{'as':_0xa9dd('0xe0'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xa9dd('0x6d')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x181'),'foreignKey':_0xa9dd('0x197')});db[_0xa9dd('0x147')]['belongsTo'](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a'),'onDelete':'cascade'});db[_0xa9dd('0x147')][_0xa9dd('0x117')](db['CmList'],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0xa9dd('0x1b')],{'as':_0xa9dd('0x18c'),'foreignKey':_0xa9dd('0x144'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x147')][_0xa9dd('0x117')](db[_0xa9dd('0xe0')],{'as':'Campaign','foreignKey':_0xa9dd('0x198'),'onDelete':'cascade'});db[_0xa9dd('0x7a')][_0xa9dd('0x107')](db[_0xa9dd('0x7f')],{'as':{'plural':_0xa9dd('0x199'),'singular':_0xa9dd('0x19a')},'foreignKey':_0xa9dd('0x19b'),'onDelete':_0xa9dd('0x105'),'hooks':!![]});db[_0xa9dd('0x7a')][_0xa9dd('0x107')](db[_0xa9dd('0x7f')],{'as':{'plural':_0xa9dd('0x19c'),'singular':_0xa9dd('0x19d')},'foreignKey':_0xa9dd('0x19e'),'onDelete':_0xa9dd('0x105'),'hooks':!![]});db[_0xa9dd('0x7a')][_0xa9dd('0x107')](db[_0xa9dd('0x78')],{'as':'Actions','foreignKey':_0xa9dd('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0xa9dd('0x7d')][_0xa9dd('0x107')](db[_0xa9dd('0x7d')],{'as':_0xa9dd('0x160'),'foreignKey':'ParentId','onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x14c')][_0xa9dd('0x107')](db['Interval'],{'as':_0xa9dd('0x1a0'),'foreignKey':_0xa9dd('0x14d'),'onDelete':_0xa9dd('0x105'),'hooks':!![],'required':![]});db[_0xa9dd('0x14c')]['hasMany'](db[_0xa9dd('0x18')],{'as':_0xa9dd('0x10a'),'foreignKey':_0xa9dd('0x14d'),'onDelete':'restrict'});db[_0xa9dd('0x14c')][_0xa9dd('0x107')](db['MailApplication'],{'as':_0xa9dd('0x1a1'),'foreignKey':'IntervalId'});db['Interval'][_0xa9dd('0x107')](db[_0xa9dd('0x5f')],{'as':_0xa9dd('0x1a2'),'foreignKey':_0xa9dd('0x14d')});db[_0xa9dd('0x14c')][_0xa9dd('0x107')](db[_0xa9dd('0x48')],{'as':_0xa9dd('0x1a3'),'foreignKey':_0xa9dd('0x14d')});db[_0xa9dd('0x14c')][_0xa9dd('0x107')](db[_0xa9dd('0x17f')],{'as':_0xa9dd('0x1a4'),'foreignKey':_0xa9dd('0x14d')});db[_0xa9dd('0x85')][_0xa9dd('0x117')](db[_0xa9dd('0x39')],{});db['Schedule'][_0xa9dd('0x117')](db[_0xa9dd('0x1a5')],{'foreignKey':_0xa9dd('0x1a6')});db[_0xa9dd('0x85')]['belongsTo'](db[_0xa9dd('0x95')],{'foreignKey':_0xa9dd('0x1a7')});db[_0xa9dd('0x140')]['belongsToMany'](db[_0xa9dd('0x19')],{'as':_0xa9dd('0x1a8'),'through':'moh_has_sounds','onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0x87')][_0xa9dd('0x11a')](db['CmContact'],{'through':'cm_contact_has_tags'});db['Tag'][_0xa9dd('0x11a')](db['ChatInteraction'],{'through':_0xa9dd('0x18f')});db[_0xa9dd('0x87')]['belongsToMany'](db[_0xa9dd('0x112')],{'through':_0xa9dd('0x16a')});db[_0xa9dd('0x87')][_0xa9dd('0x11a')](db[_0xa9dd('0x110')],{'through':_0xa9dd('0x182')});db[_0xa9dd('0x87')][_0xa9dd('0x11a')](db[_0xa9dd('0x4a')],{'through':_0xa9dd('0x17b')});db[_0xa9dd('0x87')][_0xa9dd('0x11a')](db[_0xa9dd('0x57')],{'through':_0xa9dd('0x188')});db[_0xa9dd('0x87')][_0xa9dd('0x11a')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem'][_0xa9dd('0x117')](db[_0xa9dd('0x88')],{'as':_0xa9dd('0x1a9'),'foreignKey':_0xa9dd('0x1aa')});db[_0xa9dd('0x1ab')][_0xa9dd('0x117')](db[_0xa9dd('0x6d')],{'as':_0xa9dd('0x1ac'),'foreignKey':_0xa9dd('0x1ad')});db[_0xa9dd('0x8a')][_0xa9dd('0x117')](db['CmContact'],{'as':_0xa9dd('0x169'),'foreignKey':'CmContactId'});db[_0xa9dd('0x8e')][_0xa9dd('0x107')](db[_0xa9dd('0x7f')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0xa9dd('0x105'),'hooks':!![]});db[_0xa9dd('0x8e')][_0xa9dd('0x107')](db['Condition'],{'as':{'plural':_0xa9dd('0x1ae'),'singular':_0xa9dd('0x1af')},'foreignKey':_0xa9dd('0x1b0'),'onDelete':_0xa9dd('0x105'),'hooks':!![]});db[_0xa9dd('0x8e')][_0xa9dd('0x107')](db[_0xa9dd('0x78')],{'as':_0xa9dd('0x1b1'),'foreignKey':_0xa9dd('0x1b2'),'onDelete':_0xa9dd('0x105'),'hooks':!![]});db[_0xa9dd('0x95')][_0xa9dd('0x107')](db[_0xa9dd('0x9a')],{'as':_0xa9dd('0x1b3'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1a7'),'hooks':!![]});db[_0xa9dd('0x1a5')][_0xa9dd('0x107')](db[_0xa9dd('0x9a')],{'as':_0xa9dd('0x1b3'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1a6')});db[_0xa9dd('0x1b4')][_0xa9dd('0x107')](db['AnalyticFieldReport'],{'as':_0xa9dd('0x1b3'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1b5')});db[_0xa9dd('0x9a')]['belongsTo'](db[_0xa9dd('0x1b4')],{'foreignKey':_0xa9dd('0x1b5')});db[_0xa9dd('0x9d')][_0xa9dd('0x107')](db[_0xa9dd('0x9f')],{'as':_0xa9dd('0x1b6'),'onDelete':'cascade','foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db[_0xa9dd('0xa1')],{'as':_0xa9dd('0x1b7'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0x9f')][_0xa9dd('0x107')](db['SalesforceField'],{'as':_0xa9dd('0x1b9'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0x9f')][_0xa9dd('0x107')](db[_0xa9dd('0xa1')],{'as':_0xa9dd('0x1b3'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0x9f')]['belongsTo'](db[_0xa9dd('0x9d')],{'as':_0xa9dd('0x168'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db[_0xa9dd('0xa1')],{'as':'Subject','foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xa1')][_0xa9dd('0x107')](db['SalesforceField'],{'as':'Description','foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0xa1')]['hasMany'](db[_0xa9dd('0xa1')],{'as':'Field','foreignKey':'FieldId'});db[_0xa9dd('0xa1')][_0xa9dd('0x117')](db[_0xa9dd('0x8f')],{'as':_0xa9dd('0x8f'),'foreignKey':_0xa9dd('0x1bc')});db['SugarcrmAccount']['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xa9dd('0x105'),'foreignKey':'AccountId'});db[_0xa9dd('0xa3')][_0xa9dd('0x107')](db['SugarcrmField'],{'as':_0xa9dd('0x1b7'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xa9dd('0xa3')]['hasMany'](db[_0xa9dd('0x1bd')],{'as':_0xa9dd('0x1b9'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1ba')});db['SugarcrmConfiguration'][_0xa9dd('0x107')](db[_0xa9dd('0x1bd')],{'as':_0xa9dd('0x1b3'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0xa3')][_0xa9dd('0x117')](db[_0xa9dd('0xa2')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1be')});db['SugarcrmField'][_0xa9dd('0x107')](db['SugarcrmField'],{'as':_0xa9dd('0x1bf'),'foreignKey':_0xa9dd('0x1b8')});db['SugarcrmField'][_0xa9dd('0x107')](db[_0xa9dd('0x1bd')],{'as':'Description','foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0x1bd')][_0xa9dd('0x107')](db[_0xa9dd('0x1bd')],{'as':_0xa9dd('0x1c0'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xa9dd('0x117')](db[_0xa9dd('0x8f')],{'as':_0xa9dd('0x8f'),'foreignKey':_0xa9dd('0x1bc')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1be')});db['DeskConfiguration'][_0xa9dd('0x107')](db['DeskField'],{'as':_0xa9dd('0x1b7'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xa7')][_0xa9dd('0x107')](db['DeskField'],{'as':_0xa9dd('0x1b9'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0xa7')][_0xa9dd('0x107')](db[_0xa9dd('0x1c1')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['DeskConfiguration'][_0xa9dd('0x117')](db[_0xa9dd('0xa5')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1be')});db['DeskConfiguration'][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x1c2')});db[_0xa9dd('0x1c1')]['hasMany'](db[_0xa9dd('0x1c1')],{'as':_0xa9dd('0x1bf'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0x1c1')][_0xa9dd('0x107')](db[_0xa9dd('0x1c1')],{'as':'Description','foreignKey':_0xa9dd('0x1ba')});db['DeskField'][_0xa9dd('0x107')](db[_0xa9dd('0x1c1')],{'as':'Field','foreignKey':_0xa9dd('0x1bb')});db['DeskField']['belongsTo'](db['Variable'],{'as':_0xa9dd('0x8f'),'foreignKey':_0xa9dd('0x1bc')});db[_0xa9dd('0xa9')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xaa')][_0xa9dd('0x107')](db['ZohoField'],{'as':_0xa9dd('0x1b7'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1b8')});db['ZohoConfiguration'][_0xa9dd('0x107')](db[_0xa9dd('0xac')],{'as':_0xa9dd('0x1b9'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xa9dd('0x107')](db[_0xa9dd('0xac')],{'as':'Fields','onDelete':_0xa9dd('0x105'),'foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0xa9dd('0xa9')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xac')][_0xa9dd('0x107')](db[_0xa9dd('0xac')],{'as':'Subject','foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xac')][_0xa9dd('0x107')](db[_0xa9dd('0xac')],{'as':_0xa9dd('0x1c3'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0xac')][_0xa9dd('0x107')](db['ZohoField'],{'as':_0xa9dd('0x1c0'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0xac')][_0xa9dd('0x117')](db['Variable'],{'as':_0xa9dd('0x8f'),'foreignKey':_0xa9dd('0x1bc')});db[_0xa9dd('0xad')][_0xa9dd('0x107')](db['ZendeskConfiguration'],{'as':_0xa9dd('0x1b6'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xaf')]['hasMany'](db[_0xa9dd('0xb1')],{'as':_0xa9dd('0x1b7'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xaf')][_0xa9dd('0x107')](db['ZendeskField'],{'as':_0xa9dd('0x1b9'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0xaf')]['hasMany'](db[_0xa9dd('0xb1')],{'as':_0xa9dd('0x1b3'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0xaf')][_0xa9dd('0x117')](db[_0xa9dd('0xad')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xaf')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x1c4')});db[_0xa9dd('0xb1')]['hasMany'](db[_0xa9dd('0xb1')],{'as':_0xa9dd('0x1bf'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xb1')][_0xa9dd('0x107')](db[_0xa9dd('0xb1')],{'as':_0xa9dd('0x1c3'),'foreignKey':'DescriptionId'});db[_0xa9dd('0xb1')]['hasMany'](db[_0xa9dd('0xb1')],{'as':_0xa9dd('0x1c0'),'foreignKey':_0xa9dd('0x1bb')});db['ZendeskField'][_0xa9dd('0x117')](db['Variable'],{'as':'Variable','foreignKey':_0xa9dd('0x1bc')});db[_0xa9dd('0xb2')]['hasMany'](db[_0xa9dd('0xb4')],{'as':_0xa9dd('0x1b6'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xb4')][_0xa9dd('0x107')](db['FreshdeskField'],{'as':_0xa9dd('0x1b7'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xb4')][_0xa9dd('0x107')](db['FreshdeskField'],{'as':_0xa9dd('0x1b9'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0xb4')][_0xa9dd('0x107')](db[_0xa9dd('0xb6')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xa9dd('0xb4')][_0xa9dd('0x117')](db['FreshdeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xa9dd('0xb4')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x1c5')});db[_0xa9dd('0xb6')][_0xa9dd('0x107')](db['FreshdeskField'],{'as':_0xa9dd('0x1bf'),'foreignKey':'SubjectId'});db[_0xa9dd('0xb6')][_0xa9dd('0x107')](db['FreshdeskField'],{'as':_0xa9dd('0x1c3'),'foreignKey':_0xa9dd('0x1ba')});db['FreshdeskField'][_0xa9dd('0x107')](db['FreshdeskField'],{'as':_0xa9dd('0x1c0'),'foreignKey':'FieldId'});db[_0xa9dd('0xb6')]['belongsTo'](db['Variable'],{'as':_0xa9dd('0x8f'),'foreignKey':'VariableId'});db[_0xa9dd('0xb8')][_0xa9dd('0x107')](db[_0xa9dd('0xb9')],{'as':_0xa9dd('0x1b6'),'onDelete':'cascade','foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xb9')][_0xa9dd('0x107')](db[_0xa9dd('0x1c6')],{'as':_0xa9dd('0x1b7'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xb9')][_0xa9dd('0x107')](db[_0xa9dd('0x1c6')],{'as':'Descriptions','foreignKey':_0xa9dd('0x1ba')});db['VtigerConfiguration'][_0xa9dd('0x107')](db[_0xa9dd('0x1c6')],{'as':_0xa9dd('0x1b3'),'foreignKey':'FieldId'});db[_0xa9dd('0xb9')][_0xa9dd('0x117')](db[_0xa9dd('0xb8')],{'as':'Account','foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0x1c6')][_0xa9dd('0x107')](db[_0xa9dd('0x1c6')],{'as':_0xa9dd('0x1bf'),'foreignKey':_0xa9dd('0x1b8')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0xa9dd('0x1c3'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0x1c6')][_0xa9dd('0x107')](db['VtigerField'],{'as':_0xa9dd('0x1c0'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0x1c6')][_0xa9dd('0x117')](db['Variable'],{'as':_0xa9dd('0x8f'),'foreignKey':_0xa9dd('0x1bc')});db[_0xa9dd('0xbb')][_0xa9dd('0x107')](db[_0xa9dd('0xbd')],{'as':'Configurations','onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xbd')][_0xa9dd('0x107')](db[_0xa9dd('0x1c7')],{'as':_0xa9dd('0x1b7'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xbd')]['hasMany'](db[_0xa9dd('0x1c7')],{'as':_0xa9dd('0x1b9'),'foreignKey':_0xa9dd('0x1ba')});db['ServicenowConfiguration'][_0xa9dd('0x107')](db[_0xa9dd('0x1c7')],{'as':_0xa9dd('0x1b3'),'foreignKey':_0xa9dd('0x1bb')});db['ServicenowConfiguration'][_0xa9dd('0x117')](db['ServicenowAccount'],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1be')});db['ServicenowField'][_0xa9dd('0x107')](db[_0xa9dd('0x1c7')],{'as':_0xa9dd('0x1bf'),'foreignKey':'SubjectId'});db[_0xa9dd('0x1c7')][_0xa9dd('0x107')](db[_0xa9dd('0x1c7')],{'as':'Description','foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0x1c7')][_0xa9dd('0x107')](db[_0xa9dd('0x1c7')],{'as':_0xa9dd('0x1c0'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0x1c7')][_0xa9dd('0x117')](db[_0xa9dd('0x8f')],{'as':'Variable','foreignKey':_0xa9dd('0x1bc')});db[_0xa9dd('0xc0')][_0xa9dd('0x107')](db[_0xa9dd('0xc1')],{'as':_0xa9dd('0x1b6'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xc0')]['belongsTo'](db[_0xa9dd('0xfe')],{'as':_0xa9dd('0xfe'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0xa9dd('0x107')](db[_0xa9dd('0xc3')],{'as':_0xa9dd('0x1b7'),'onDelete':'cascade','foreignKey':_0xa9dd('0x1b8')});db['Dynamics365Configuration']['hasMany'](db[_0xa9dd('0xc3')],{'as':_0xa9dd('0x1b9'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1ba')});db['Dynamics365Configuration'][_0xa9dd('0x107')](db[_0xa9dd('0xc3')],{'as':_0xa9dd('0x1b3'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0xc1')][_0xa9dd('0x117')](db[_0xa9dd('0xc0')],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xc3')][_0xa9dd('0x107')](db['Dynamics365Field'],{'as':_0xa9dd('0x1bf'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0xc3')][_0xa9dd('0x107')](db[_0xa9dd('0xc3')],{'as':_0xa9dd('0x1c3'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0xc3')][_0xa9dd('0x107')](db[_0xa9dd('0xc3')],{'as':_0xa9dd('0x1c0'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xa9dd('0x117')](db[_0xa9dd('0x8f')],{'as':'Variable','foreignKey':_0xa9dd('0x1bc')});db['FreshsalesAccount'][_0xa9dd('0x107')](db[_0xa9dd('0x1c8')],{'as':'Configurations','onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0x1c8')][_0xa9dd('0x107')](db[_0xa9dd('0xc7')],{'as':_0xa9dd('0x1b7'),'foreignKey':_0xa9dd('0x1b8')});db[_0xa9dd('0x1c8')]['hasMany'](db[_0xa9dd('0xc7')],{'as':'Descriptions','foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0x1c8')][_0xa9dd('0x107')](db[_0xa9dd('0xc7')],{'as':_0xa9dd('0x1b3'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0x1c8')][_0xa9dd('0x117')](db['FreshsalesAccount'],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1be')});db[_0xa9dd('0xc7')][_0xa9dd('0x107')](db[_0xa9dd('0xc7')],{'as':_0xa9dd('0x1bf'),'foreignKey':'SubjectId'});db[_0xa9dd('0xc7')][_0xa9dd('0x107')](db[_0xa9dd('0xc7')],{'as':_0xa9dd('0x1c3'),'foreignKey':_0xa9dd('0x1ba')});db[_0xa9dd('0xc7')]['hasMany'](db[_0xa9dd('0xc7')],{'as':_0xa9dd('0x1c0'),'foreignKey':_0xa9dd('0x1bb')});db[_0xa9dd('0xc7')][_0xa9dd('0x117')](db[_0xa9dd('0x8f')],{'as':_0xa9dd('0x8f'),'foreignKey':'VariableId'});db[_0xa9dd('0xcb')][_0xa9dd('0x117')](db[_0xa9dd('0x16f')],{});db['ChatQueueReport']['belongsTo'](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0xcb')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db['ChatQueueReport'][_0xa9dd('0x117')](db[_0xa9dd('0x10e')],{});db[_0xa9dd('0xcb')][_0xa9dd('0x117')](db[_0xa9dd('0x62')],{});db[_0xa9dd('0xcb')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{});db[_0xa9dd('0xcb')][_0xa9dd('0x117')](db[_0xa9dd('0x64')],{});db[_0xa9dd('0xcd')][_0xa9dd('0x117')](db['User'],{'onDelete':'cascade','foreignKey':_0xa9dd('0x1c9')});db[_0xa9dd('0xcd')][_0xa9dd('0x117')](db['User'],{'onDelete':'cascade','foreignKey':_0xa9dd('0x1ca')});db['JscriptySessionReport'][_0xa9dd('0x107')](db[_0xa9dd('0xd1')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xa9dd('0xd2')][_0xa9dd('0x107')](db[_0xa9dd('0xcf')],{'foreignKey':_0xa9dd('0x1cb'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0x1cc')]['belongsTo'](db[_0xa9dd('0x50')],{});db['SmsQueueReport'][_0xa9dd('0x117')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport'][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xa9dd('0x1cc')][_0xa9dd('0x117')](db[_0xa9dd('0x110')],{});db[_0xa9dd('0x1cc')][_0xa9dd('0x117')](db[_0xa9dd('0x51')],{});db[_0xa9dd('0x1cc')]['belongsTo'](db[_0xa9dd('0x12')],{});db['SmsQueueReport']['belongsTo'](db[_0xa9dd('0x53')],{});db[_0xa9dd('0x1cd')][_0xa9dd('0x107')](db[_0xa9dd('0xd2')],{'foreignKey':_0xa9dd('0x1ce')});db[_0xa9dd('0x1cd')][_0xa9dd('0x107')](db[_0xa9dd('0xd1')],{'foreignKey':_0xa9dd('0x1ce')});db['JscriptyProject'][_0xa9dd('0x107')](db[_0xa9dd('0xcf')],{'foreignKey':_0xa9dd('0x1ce')});db[_0xa9dd('0xda')]['belongsToMany'](db[_0xa9dd('0x12')],{'as':'Users','through':'user_has_square_projects'});db['Team'][_0xa9dd('0x11a')](db['User'],{'as':_0xa9dd('0x152'),'through':_0xa9dd('0x1cf')});db[_0xa9dd('0x11d')][_0xa9dd('0x11a')](db[_0xa9dd('0x1b')],{'through':_0xa9dd('0xff'),'as':_0xa9dd('0x124')});db[_0xa9dd('0x11d')]['belongsToMany'](db[_0xa9dd('0x3a')],{'through':_0xa9dd('0x166'),'as':'MailQueues'});db[_0xa9dd('0x11d')][_0xa9dd('0x11a')](db['ChatQueue'],{'through':_0xa9dd('0x191'),'as':_0xa9dd('0x127')});db[_0xa9dd('0x11d')][_0xa9dd('0x11a')](db[_0xa9dd('0x179')],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team'][_0xa9dd('0x11a')](db[_0xa9dd('0x53')],{'through':'team_has_sms_queues','as':_0xa9dd('0x1d0')});db[_0xa9dd('0x11d')][_0xa9dd('0x11a')](db[_0xa9dd('0x5a')],{'through':_0xa9dd('0x189'),'as':_0xa9dd('0x12b')});db[_0xa9dd('0x11d')][_0xa9dd('0x11a')](db[_0xa9dd('0x12d')],{'through':'team_has_whatsapp_queues','as':_0xa9dd('0x12e')});db[_0xa9dd('0x11d')]['belongsToMany'](db[_0xa9dd('0xee')],{'through':_0xa9dd('0x100'),'as':_0xa9dd('0x125')});db[_0xa9dd('0xe0')]['hasMany'](db[_0xa9dd('0x6d')],{'as':_0xa9dd('0x145'),'foreignKey':'CampaignId'});db[_0xa9dd('0xe0')][_0xa9dd('0x107')](db[_0xa9dd('0x70')],{'as':_0xa9dd('0x10b'),'foreignKey':'CampaignId'});db[_0xa9dd('0xe0')]['hasMany'](db[_0xa9dd('0x72')],{'as':_0xa9dd('0x146'),'foreignKey':_0xa9dd('0x198')});db[_0xa9dd('0xe0')][_0xa9dd('0x107')](db[_0xa9dd('0x147')],{'as':_0xa9dd('0x1d1'),'foreignKey':_0xa9dd('0x198')});db[_0xa9dd('0xe0')][_0xa9dd('0x117')](db['Trunk'],{'as':_0xa9dd('0x149'),'foreignKey':_0xa9dd('0x14a')});db[_0xa9dd('0xe0')][_0xa9dd('0x117')](db['Trunk'],{'as':_0xa9dd('0x14b'),'foreignKey':_0xa9dd('0x1d2')});db[_0xa9dd('0xe0')][_0xa9dd('0x117')](db[_0xa9dd('0x14c')],{'as':_0xa9dd('0x14c'),'foreignKey':_0xa9dd('0x14d')});db[_0xa9dd('0xe0')]['belongsTo'](db[_0xa9dd('0xda')],{'as':_0xa9dd('0xda'),'foreignKey':'SquareProjectId'});db[_0xa9dd('0xe0')][_0xa9dd('0x11a')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x150'),'through':_0xa9dd('0x1d3')});db[_0xa9dd('0xe0')][_0xa9dd('0x11a')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x153'),'through':_0xa9dd('0x1d4')});db[_0xa9dd('0xe2')][_0xa9dd('0x117')](db[_0xa9dd('0x171')],{'as':_0xa9dd('0x171'),'foreignKey':_0xa9dd('0x172')});db[_0xa9dd('0xe5')]['belongsTo'](db['MailMessage'],{});db['MailTransferReport'][_0xa9dd('0x117')](db[_0xa9dd('0x112')],{});db[_0xa9dd('0xe5')][_0xa9dd('0x117')](db['MailAccount'],{'foreignKey':_0xa9dd('0x1d5'),'as':_0xa9dd('0x1d6')});db[_0xa9dd('0xe5')]['belongsTo'](db['User'],{'foreignKey':_0xa9dd('0x1d7'),'as':_0xa9dd('0x1d8')});db[_0xa9dd('0xe5')]['belongsTo'](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d9'),'as':_0xa9dd('0x1da')});db['MailTransferReport'][_0xa9dd('0x117')](db['MailQueue'],{'foreignKey':_0xa9dd('0x1db'),'as':_0xa9dd('0x1dc')});db[_0xa9dd('0xe5')][_0xa9dd('0x117')](db[_0xa9dd('0x39')],{'foreignKey':_0xa9dd('0x1dd'),'as':_0xa9dd('0x1de')});db[_0xa9dd('0xe6')][_0xa9dd('0x117')](db['ChatMessage'],{});db[_0xa9dd('0xe6')]['belongsTo'](db[_0xa9dd('0x10e')],{});db[_0xa9dd('0xe6')]['belongsTo'](db[_0xa9dd('0x16f')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xa9dd('0xe6')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'foreignKey':'FromUserId','as':_0xa9dd('0x1d8')});db['ChatTransferReport'][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d9'),'as':_0xa9dd('0x1da')});db['ChatTransferReport']['belongsTo'](db[_0xa9dd('0x64')],{'foreignKey':_0xa9dd('0x1df'),'as':'ToQueue'});db['ChatTransferReport'][_0xa9dd('0x117')](db[_0xa9dd('0x16f')],{'foreignKey':_0xa9dd('0x1e0'),'as':_0xa9dd('0x1de')});db[_0xa9dd('0xe8')]['belongsTo'](db[_0xa9dd('0x178')],{});db[_0xa9dd('0xe8')][_0xa9dd('0x117')](db[_0xa9dd('0x4a')],{});db[_0xa9dd('0xe8')][_0xa9dd('0x117')](db[_0xa9dd('0x46')],{'foreignKey':_0xa9dd('0x1e1'),'as':_0xa9dd('0x1d6')});db['FaxTransferReport'][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d7'),'as':'FromAgent'});db[_0xa9dd('0xe8')]['belongsTo'](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d9'),'as':'ToAgent'});db[_0xa9dd('0xe8')][_0xa9dd('0x117')](db[_0xa9dd('0x179')],{'foreignKey':_0xa9dd('0x1e2'),'as':'ToQueue'});db[_0xa9dd('0xe8')]['belongsTo'](db[_0xa9dd('0x46')],{'foreignKey':_0xa9dd('0x1e3'),'as':_0xa9dd('0x1de')});db[_0xa9dd('0xea')]['belongsTo'](db[_0xa9dd('0x59')],{});db[_0xa9dd('0xea')]['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xa9dd('0x117')](db[_0xa9dd('0x54')],{'foreignKey':_0xa9dd('0x1e4'),'as':_0xa9dd('0x1d6')});db[_0xa9dd('0xea')]['belongsTo'](db['User'],{'foreignKey':_0xa9dd('0x1d7'),'as':_0xa9dd('0x1d8')});db[_0xa9dd('0xea')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d9'),'as':_0xa9dd('0x1da')});db[_0xa9dd('0xea')][_0xa9dd('0x117')](db[_0xa9dd('0x5a')],{'foreignKey':_0xa9dd('0x1e5'),'as':_0xa9dd('0x1dc')});db[_0xa9dd('0xea')]['belongsTo'](db[_0xa9dd('0x54')],{'foreignKey':_0xa9dd('0x1e6'),'as':_0xa9dd('0x1de')});db[_0xa9dd('0xeb')]['belongsTo'](db[_0xa9dd('0x51')],{});db[_0xa9dd('0xeb')][_0xa9dd('0x117')](db[_0xa9dd('0x110')],{});db['SmsTransferReport'][_0xa9dd('0x117')](db[_0xa9dd('0x50')],{'foreignKey':_0xa9dd('0x1e7'),'as':_0xa9dd('0x1d6')});db[_0xa9dd('0xeb')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d7'),'as':_0xa9dd('0x1d8')});db[_0xa9dd('0xeb')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d9'),'as':_0xa9dd('0x1da')});db['SmsTransferReport'][_0xa9dd('0x117')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0xa9dd('0x117')](db[_0xa9dd('0x50')],{'foreignKey':_0xa9dd('0x1e8'),'as':_0xa9dd('0x1de')});db[_0xa9dd('0xed')][_0xa9dd('0x107')](db[_0xa9dd('0x7d')],{'as':_0xa9dd('0x160'),'foreignKey':_0xa9dd('0x164'),'onDelete':_0xa9dd('0x105')});db['CmList'][_0xa9dd('0x107')](db[_0xa9dd('0x76')],{'as':_0xa9dd('0x1e9'),'foreignKey':_0xa9dd('0x164')});db['CmList']['hasMany'](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x11b'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0xed')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ListId'});db[_0xa9dd('0xed')]['hasMany'](db[_0xa9dd('0x72')],{'as':_0xa9dd('0x10c'),'foreignKey':'ListId'});db[_0xa9dd('0xed')][_0xa9dd('0x107')](db[_0xa9dd('0x74')],{'as':'ReportAgentPreview','foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0xed')][_0xa9dd('0x11a')](db[_0xa9dd('0x1b')],{'as':_0xa9dd('0x1ea'),'through':_0xa9dd('0x151')});db[_0xa9dd('0xed')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':_0xa9dd('0x12f')});db[_0xa9dd('0xee')][_0xa9dd('0x107')](db[_0xa9dd('0x18')],{'as':_0xa9dd('0x10a'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0xee')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':'Agents','through':_0xa9dd('0x101')});db['VoicePrefix'][_0xa9dd('0x11a')](db['Team'],{'through':_0xa9dd('0x100'),'as':_0xa9dd('0x167')});db[_0xa9dd('0xef')][_0xa9dd('0x107')](db['User'],{'as':'Users','foreignKey':_0xa9dd('0x118')});db['UserProfile'][_0xa9dd('0x107')](db[_0xa9dd('0xf0')],{'as':'UserProfileSections','foreignKey':_0xa9dd('0x118'),'onDelete':'cascade'});db[_0xa9dd('0xf0')][_0xa9dd('0x107')](db[_0xa9dd('0xf2')],{'as':_0xa9dd('0x1eb'),'foreignKey':'sectionId','onDelete':_0xa9dd('0x105')});db[_0xa9dd('0xf5')]['hasMany'](db[_0xa9dd('0x7d')],{'as':'Dispositions','foreignKey':_0xa9dd('0x1ec'),'onDelete':_0xa9dd('0x105')});db[_0xa9dd('0xf5')][_0xa9dd('0x107')](db['CannedAnswer'],{'as':_0xa9dd('0x162'),'foreignKey':'WhatsappAccountId'});db[_0xa9dd('0xf5')][_0xa9dd('0x107')](db[_0xa9dd('0xf8')],{'as':_0xa9dd('0x155'),'foreignKey':_0xa9dd('0x1ec')});db[_0xa9dd('0xf5')][_0xa9dd('0x107')](db[_0xa9dd('0x114')],{'as':_0xa9dd('0x163')});db[_0xa9dd('0xf5')][_0xa9dd('0x107')](db['WhatsappApplication'],{'as':_0xa9dd('0x13f')});db[_0xa9dd('0xf5')][_0xa9dd('0x117')](db['CmList'],{'as':'List','foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0xf5')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xa9dd('0x14f')});db[_0xa9dd('0xf5')]['belongsToMany'](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'onDelete':_0xa9dd('0x15c')});db['WhatsappApplication']['belongsTo'](db[_0xa9dd('0x12d')],{'onDelete':_0xa9dd('0x15c')});db['WhatsappApplication']['belongsTo'](db[_0xa9dd('0xf5')],{'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0xf6')][_0xa9dd('0x117')](db[_0xa9dd('0x14c')],{'onDelete':_0xa9dd('0x15c'),'foreignKey':_0xa9dd('0x14d')});db['WhatsappApplication']['belongsTo'](db[_0xa9dd('0x87')],{'onDelete':_0xa9dd('0x15c'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0xa9dd('0x107')](db[_0xa9dd('0xf8')],{'as':_0xa9dd('0x155'),'onDelete':_0xa9dd('0x105'),'foreignKey':_0xa9dd('0x1ed')});db[_0xa9dd('0x114')][_0xa9dd('0x117')](db['WhatsappAccount'],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1ec')});db[_0xa9dd('0x114')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db['WhatsappInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xa9dd('0x106')});db[_0xa9dd('0x114')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x1ee'),'as':_0xa9dd('0x17c')});db[_0xa9dd('0x114')][_0xa9dd('0x11a')](db[_0xa9dd('0x87')],{'through':_0xa9dd('0x1ee'),'as':_0xa9dd('0x16b')});db[_0xa9dd('0x114')][_0xa9dd('0x11a')](db['User'],{'as':_0xa9dd('0x16c'),'through':_0xa9dd('0x123'),'foreignKey':_0xa9dd('0x1ed')});db['WhatsappMessage'][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x12')});db[_0xa9dd('0xf8')]['belongsTo'](db[_0xa9dd('0x6b')],{'onDelete':'cascade','as':_0xa9dd('0x169')});db['WhatsappMessage'][_0xa9dd('0x117')](db[_0xa9dd('0x114')],{'onDelete':_0xa9dd('0x105'),'as':_0xa9dd('0x183'),'foreignKey':_0xa9dd('0x1ed')});db[_0xa9dd('0xf8')][_0xa9dd('0x117')](db['WhatsappAccount'],{'as':_0xa9dd('0x168'),'foreignKey':_0xa9dd('0x1ec')});db[_0xa9dd('0xf9')]['belongsTo'](db[_0xa9dd('0xf5')],{});db[_0xa9dd('0xf9')][_0xa9dd('0x117')](db[_0xa9dd('0xed')],{'as':_0xa9dd('0x174'),'foreignKey':_0xa9dd('0x164')});db[_0xa9dd('0xf9')][_0xa9dd('0x117')](db[_0xa9dd('0x6b')],{'as':_0xa9dd('0x169'),'foreignKey':_0xa9dd('0x15a')});db[_0xa9dd('0xf9')][_0xa9dd('0x117')](db[_0xa9dd('0x114')],{});db[_0xa9dd('0xf9')][_0xa9dd('0x117')](db[_0xa9dd('0x12d')],{});db[_0xa9dd('0xf9')]['belongsTo'](db[_0xa9dd('0xf8')],{});db['WhatsappQueueReport'][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{});db[_0xa9dd('0xfb')][_0xa9dd('0x117')](db[_0xa9dd('0xf8')],{});db[_0xa9dd('0xfb')][_0xa9dd('0x117')](db[_0xa9dd('0x114')],{});db[_0xa9dd('0xfb')][_0xa9dd('0x117')](db['WhatsappAccount'],{'foreignKey':_0xa9dd('0x1ef'),'as':'FromAccount'});db[_0xa9dd('0xfb')][_0xa9dd('0x117')](db[_0xa9dd('0xf5')],{'foreignKey':_0xa9dd('0x1f0'),'as':_0xa9dd('0x1de')});db[_0xa9dd('0xfb')][_0xa9dd('0x117')](db[_0xa9dd('0x12d')],{'foreignKey':_0xa9dd('0x1f1'),'as':_0xa9dd('0x1dc')});db[_0xa9dd('0xfb')]['belongsTo'](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d7'),'as':_0xa9dd('0x1d8')});db[_0xa9dd('0xfb')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'foreignKey':_0xa9dd('0x1d9'),'as':_0xa9dd('0x1da')});db[_0xa9dd('0x12d')][_0xa9dd('0x11a')](db[_0xa9dd('0x12')],{'as':_0xa9dd('0x152'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xa9dd('0x11a')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0xa9dd('0x167')});db[_0xa9dd('0x103')][_0xa9dd('0x117')](db[_0xa9dd('0x12')],{'as':'user','foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0xa9dd('0x104')](db[_0xa9dd('0xc0')],{'as':'Dynamics365Account','onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0xfe')]['hasOne'](db[_0xa9dd('0x38')],{'as':_0xa9dd('0x1f2'),'onDelete':_0xa9dd('0x15c')});db[_0xa9dd('0xfe')]['hasOne'](db[_0xa9dd('0x15d')],{'as':_0xa9dd('0x15f'),'onDelete':_0xa9dd('0x15c')});module[_0xa9dd('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e416030..cecca65 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cae=['/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','use','./api/user','/api/voice/contexts','/api/voice/extensions','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration'];(function(_0x21c9eb,_0x43ce02){var _0x5dcbc7=function(_0x317893){while(--_0x317893){_0x21c9eb['push'](_0x21c9eb['shift']());}};_0x5dcbc7(++_0x43ce02);}(_0x3cae,0x172));var _0xe3ca=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x3cae[_0x5c2a2b];return _0x19921f;};'use strict';var path=require('path');var express=require(_0xe3ca('0x0'));var errors=require('./errors');var config=require(_0xe3ca('0x1'));var setupLoggers=require(_0xe3ca('0x2'))['setupLoggers'];var clientSideLogs=require(_0xe3ca('0x3'));exports[_0xe3ca('0x4')]=function(_0x119223){return setupLoggers(_0x119223)['then'](function(){_0x119223[_0xe3ca('0x5')]('/api/users',require(_0xe3ca('0x6')));_0x119223[_0xe3ca('0x5')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x119223['use'](_0xe3ca('0x7'),require('./api/voiceContext'));_0x119223['use'](_0xe3ca('0x8'),require('./api/voiceExtension'));_0x119223[_0xe3ca('0x5')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x9'),require(_0xe3ca('0xa')));_0x119223[_0xe3ca('0x5')]('/api/voice/recordings',require(_0xe3ca('0xb')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xc'),require(_0xe3ca('0xd')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xe'),require(_0xe3ca('0xf')));_0x119223[_0xe3ca('0x5')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x10'),require(_0xe3ca('0x11')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x12'),require('./api/voiceDialReport'));_0x119223['use'](_0xe3ca('0x13'),require('./api/voiceAgentReport'));_0x119223['use']('/api/voice/queues/reports',require(_0xe3ca('0x14')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x15'),require(_0xe3ca('0x16')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x17'),require('./api/trunk'));_0x119223['use'](_0xe3ca('0x18'),require(_0xe3ca('0x19')));_0x119223['use'](_0xe3ca('0x1a'),require(_0xe3ca('0x1b')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x1c'),require('./api/mailAccount'));_0x119223['use'](_0xe3ca('0x1d'),require('./api/mailQueue'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x1e'),require(_0xe3ca('0x1f')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x20'),require(_0xe3ca('0x21')));_0x119223[_0xe3ca('0x5')]('/api/mail/messages',require(_0xe3ca('0x22')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x23'),require(_0xe3ca('0x24')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x25'),require(_0xe3ca('0x26')));_0x119223[_0xe3ca('0x5')]('/api/dashboards',require('./api/dashboard'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x27'),require(_0xe3ca('0x28')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x29'),require(_0xe3ca('0x2a')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x2b'),require(_0xe3ca('0x2c')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x2d'),require(_0xe3ca('0x2e')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x2f'),require('./api/faxMessage'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x30'),require('./api/faxQueue'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x31'),require(_0xe3ca('0x32')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x33'),require('./api/smsAccount'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x34'),require(_0xe3ca('0x35')));_0x119223['use'](_0xe3ca('0x36'),require('./api/smsInteraction'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x37'),require(_0xe3ca('0x38')));_0x119223['use'](_0xe3ca('0x39'),require('./api/smsQueue'));_0x119223['use'](_0xe3ca('0x3a'),require('./api/openchannelAccount'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x3b'),require('./api/openchannelApplication'));_0x119223['use'](_0xe3ca('0x3c'),require('./api/openchannelInteraction'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x3d'),require('./api/openchannelMessage'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x3e'),require(_0xe3ca('0x3f')));_0x119223['use'](_0xe3ca('0x40'),require('./api/chatWebsite'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x41'),require(_0xe3ca('0x42')));_0x119223['use']('/api/chat/applications',require('./api/chatApplication'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x43'),require(_0xe3ca('0x44')));_0x119223['use'](_0xe3ca('0x45'),require(_0xe3ca('0x46')));_0x119223['use'](_0xe3ca('0x47'),require(_0xe3ca('0x48')));_0x119223['use']('/api/chat/queues',require(_0xe3ca('0x49')));_0x119223[_0xe3ca('0x5')]('/api/chat/groups',require('./api/chatGroup'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x4a'),require(_0xe3ca('0x4b')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x4c'),require('./api/cmCompany'));_0x119223['use'](_0xe3ca('0x4d'),require(_0xe3ca('0x4e')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x4f'),require('./api/cmHopper'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x50'),require(_0xe3ca('0x51')));_0x119223['use'](_0xe3ca('0x52'),require(_0xe3ca('0x53')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x54'),require(_0xe3ca('0x55')));_0x119223[_0xe3ca('0x5')]('/api/cm/custom_fields',require(_0xe3ca('0x56')));_0x119223[_0xe3ca('0x5')]('/api/actions',require(_0xe3ca('0x57')));_0x119223['use'](_0xe3ca('0x58'),require(_0xe3ca('0x59')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x5a'),require(_0xe3ca('0x5b')));_0x119223['use'](_0xe3ca('0x5c'),require('./api/disposition'));_0x119223['use'](_0xe3ca('0x5d'),require(_0xe3ca('0x5e')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x5f'),require(_0xe3ca('0x60')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x61'),require('./api/pause'));_0x119223[_0xe3ca('0x5')]('/api/cdr',require(_0xe3ca('0x62')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x63'),require(_0xe3ca('0x64')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x65'),require(_0xe3ca('0x66')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x67'),require(_0xe3ca('0x68')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x69'),require(_0xe3ca('0x6a')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x6b'),require('./api/contactItemType'));_0x119223[_0xe3ca('0x5')]('/api/cm_contact_has_items',require(_0xe3ca('0x6c')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x6d'),require('./api/cmHopperAdditionalPhone'));_0x119223[_0xe3ca('0x5')]('/api/templates',require(_0xe3ca('0x6e')));_0x119223['use'](_0xe3ca('0x6f'),require('./api/trigger'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x70'),require(_0xe3ca('0x71')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x72'),require(_0xe3ca('0x73')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x74'),require(_0xe3ca('0x75')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x76'),require(_0xe3ca('0x77')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x78'),require(_0xe3ca('0x79')));_0x119223[_0xe3ca('0x5')]('/api/analytics/extracted_reports',require(_0xe3ca('0x7a')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x7b'),require('./api/analyticMetric'));_0x119223['use'](_0xe3ca('0x7c'),require(_0xe3ca('0x7d')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x7e'),require('./api/analyticTreeReport'));_0x119223['use']('/api/integrations/salesforce/accounts',require(_0xe3ca('0x7f')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x80'),require(_0xe3ca('0x81')));_0x119223[_0xe3ca('0x5')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x82'),require(_0xe3ca('0x83')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x84'),require('./api/intSugarcrmConfiguration'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x85'),require(_0xe3ca('0x86')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x87'),require('./api/intDeskAccount'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x88'),require(_0xe3ca('0x89')));_0x119223['use'](_0xe3ca('0x8a'),require(_0xe3ca('0x8b')));_0x119223[_0xe3ca('0x5')]('/api/integrations/zoho/accounts',require(_0xe3ca('0x8c')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x8d'),require(_0xe3ca('0x8e')));_0x119223['use']('/api/integrations/zoho/fields',require(_0xe3ca('0x8f')));_0x119223['use'](_0xe3ca('0x90'),require('./api/intZendeskAccount'));_0x119223[_0xe3ca('0x5')]('/api/integrations/zendesk/configurations',require(_0xe3ca('0x91')));_0x119223[_0xe3ca('0x5')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x119223['use']('/api/integrations/freshdesk/accounts',require(_0xe3ca('0x92')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x93'),require(_0xe3ca('0x94')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x95'),require(_0xe3ca('0x96')));_0x119223['use'](_0xe3ca('0x97'),require('./api/intVtigerAccount'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x98'),require(_0xe3ca('0x99')));_0x119223['use'](_0xe3ca('0x9a'),require(_0xe3ca('0x9b')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x9c'),require(_0xe3ca('0x9d')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0x9e'),require(_0xe3ca('0x9f')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xa0'),require('./api/intServicenowField'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xa1'),require(_0xe3ca('0xa2')));_0x119223['use'](_0xe3ca('0xa3'),require(_0xe3ca('0xa4')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xa5'),require(_0xe3ca('0xa6')));_0x119223[_0xe3ca('0x5')]('/api/integrations/freshsales/accounts',require(_0xe3ca('0xa7')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xa8'),require('./api/intFreshsalesConfiguration'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xa9'),require(_0xe3ca('0xaa')));_0x119223[_0xe3ca('0x5')]('/api/networks',require(_0xe3ca('0xab')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xac'),require(_0xe3ca('0xad')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xae'),require(_0xe3ca('0xaf')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xb0'),require(_0xe3ca('0xb1')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xb2'),require(_0xe3ca('0xb3')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xb4'),require(_0xe3ca('0xb5')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xb6'),require('./api/smsQueueReport'));_0x119223[_0xe3ca('0x5')]('/api/square/reports',require(_0xe3ca('0xb7')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xb8'),require('./api/squareReportDetail'));_0x119223['use'](_0xe3ca('0xb9'),require(_0xe3ca('0xba')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xbb'),require('./api/setting'));_0x119223[_0xe3ca('0x5')]('/api/square/odbc',require(_0xe3ca('0xbc')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xbd'),require(_0xe3ca('0xbe')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xbf'),require(_0xe3ca('0xc0')));_0x119223[_0xe3ca('0x5')]('/api/square/messages',require(_0xe3ca('0xc1')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xc2'),require('./api/team'));_0x119223[_0xe3ca('0x5')]('/api/license',require(_0xe3ca('0xc3')));_0x119223['use'](_0xe3ca('0xc4'),require(_0xe3ca('0xc5')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xc6'),require('./api/migration'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xc7'),require(_0xe3ca('0xc8')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xc9'),require('./api/plugin'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xca'),require(_0xe3ca('0xcb')));_0x119223['use'](_0xe3ca('0xcc'),require('./api/chatTransferReport'));_0x119223[_0xe3ca('0x5')]('/api/fax/reports/transfer',require(_0xe3ca('0xcd')));_0x119223['use'](_0xe3ca('0xce'),require('./api/openchannelTransferReport'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xcf'),require('./api/smsTransferReport'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xd0'),require(_0xe3ca('0xd1')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xd2'),require('./api/voicePrefix'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xd3'),require(_0xe3ca('0xd4')));_0x119223['use'](_0xe3ca('0xd5'),require('./api/userProfileSection'));_0x119223['use'](_0xe3ca('0xd6'),require(_0xe3ca('0xd7')));_0x119223['use'](_0xe3ca('0xd8'),require(_0xe3ca('0xd9')));_0x119223['use'](_0xe3ca('0xda'),require('./api/whatsappAccount'));_0x119223[_0xe3ca('0x5')]('/api/whatsapp/applications',require(_0xe3ca('0xdb')));_0x119223['use'](_0xe3ca('0xdc'),require(_0xe3ca('0xdd')));_0x119223[_0xe3ca('0x5')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xde'),require('./api/whatsappQueueReport'));_0x119223['use'](_0xe3ca('0xdf'),require(_0xe3ca('0xe0')));_0x119223['use'](_0xe3ca('0xe1'),require(_0xe3ca('0xe2')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xe3'),require(_0xe3ca('0xe4')));_0x119223[_0xe3ca('0x5')]('/api/realtime',require('./api/realtime'));_0x119223[_0xe3ca('0x5')]('/api/user-settings',require(_0xe3ca('0xe5')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xe6'),require(_0xe3ca('0xe7')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xe8'),require(_0xe3ca('0xe9')));_0x119223['use'](_0xe3ca('0xea'),require(_0xe3ca('0xeb')));_0x119223['use'](_0xe3ca('0xec'),require(_0xe3ca('0xed')));_0x119223[_0xe3ca('0x5')]('/api/rpc',require(_0xe3ca('0xee')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xef'),require('./api/version'));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xf0'),require(_0xe3ca('0xf1')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xf2'),require(_0xe3ca('0xf3')));_0x119223[_0xe3ca('0x5')]('/api/webbar',require(_0xe3ca('0xf4')));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xf5'),clientSideLogs);_0x119223[_0xe3ca('0x5')](_0xe3ca('0xf6'),express[_0xe3ca('0xf7')](path[_0xe3ca('0xf8')](config[_0xe3ca('0xf9')],_0xe3ca('0xf6'))));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xfa'),express[_0xe3ca('0xf7')](path['join'](config[_0xe3ca('0xf9')],_0xe3ca('0xfa'))));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xfb'),express[_0xe3ca('0xf7')](path['join'](config['root'],_0xe3ca('0xfb'))));_0x119223[_0xe3ca('0x5')]('/snippet',express[_0xe3ca('0xf7')](path[_0xe3ca('0xf8')](config[_0xe3ca('0xf9')],'snippet',_0xe3ca('0xfc'))));_0x119223[_0xe3ca('0x5')](_0xe3ca('0xfd'),express['static'](path[_0xe3ca('0xf8')](config['root'],_0xe3ca('0xfe'))));_0x119223[_0xe3ca('0xff')](_0xe3ca('0x100'))[_0xe3ca('0x101')](errors[0x194]);_0x119223['route']('/*')['get'](function(_0x271db6,_0xb19b39){_0xb19b39[_0xe3ca('0x102')](path[_0xe3ca('0x103')](_0x119223['get'](_0xe3ca('0x104'))+_0xe3ca('0x105')));});return _0x119223;});}; \ No newline at end of file +var _0x2835=['./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/cmHopperAdditionalPhone','./api/template','./api/trigger','/api/variables','./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/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/campaign','./api/migration','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','./config/environment','setupLoggers','./api/client-side-logs','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x2835,0x1be));var _0x5283=function(_0x19c0ea,_0x19f687){_0x19c0ea=_0x19c0ea-0x0;var _0x3db00e=_0x2835[_0x19c0ea];return _0x3db00e;};'use strict';var path=require(_0x5283('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0x5283('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x5283('0x2')];var clientSideLogs=require(_0x5283('0x3'));exports['default']=function(_0x452c19){return setupLoggers(_0x452c19)['then'](function(){_0x452c19[_0x5283('0x4')](_0x5283('0x5'),require(_0x5283('0x6')));_0x452c19[_0x5283('0x4')](_0x5283('0x7'),require(_0x5283('0x8')));_0x452c19[_0x5283('0x4')](_0x5283('0x9'),require(_0x5283('0xa')));_0x452c19[_0x5283('0x4')](_0x5283('0xb'),require(_0x5283('0xc')));_0x452c19[_0x5283('0x4')](_0x5283('0xd'),require(_0x5283('0xe')));_0x452c19[_0x5283('0x4')]('/api/voice/queues',require(_0x5283('0xf')));_0x452c19[_0x5283('0x4')](_0x5283('0x10'),require(_0x5283('0x11')));_0x452c19['use']('/api/screen/recordings',require(_0x5283('0x12')));_0x452c19[_0x5283('0x4')](_0x5283('0x13'),require(_0x5283('0x14')));_0x452c19[_0x5283('0x4')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x452c19[_0x5283('0x4')](_0x5283('0x15'),require('./api/voiceCallReport'));_0x452c19[_0x5283('0x4')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x452c19[_0x5283('0x4')](_0x5283('0x16'),require(_0x5283('0x17')));_0x452c19['use'](_0x5283('0x18'),require(_0x5283('0x19')));_0x452c19[_0x5283('0x4')](_0x5283('0x1a'),require('./api/memberReport'));_0x452c19[_0x5283('0x4')](_0x5283('0x1b'),require('./api/trunk'));_0x452c19[_0x5283('0x4')](_0x5283('0x1c'),require(_0x5283('0x1d')));_0x452c19[_0x5283('0x4')](_0x5283('0x1e'),require(_0x5283('0x1f')));_0x452c19[_0x5283('0x4')]('/api/mail/accounts',require('./api/mailAccount'));_0x452c19[_0x5283('0x4')](_0x5283('0x20'),require(_0x5283('0x21')));_0x452c19[_0x5283('0x4')](_0x5283('0x22'),require(_0x5283('0x23')));_0x452c19['use'](_0x5283('0x24'),require('./api/mailInteraction'));_0x452c19[_0x5283('0x4')](_0x5283('0x25'),require(_0x5283('0x26')));_0x452c19[_0x5283('0x4')](_0x5283('0x27'),require('./api/mailApplication'));_0x452c19['use'](_0x5283('0x28'),require(_0x5283('0x29')));_0x452c19[_0x5283('0x4')]('/api/dashboards',require('./api/dashboard'));_0x452c19[_0x5283('0x4')](_0x5283('0x2a'),require('./api/dashboardItem'));_0x452c19[_0x5283('0x4')]('/api/fax/accounts',require(_0x5283('0x2b')));_0x452c19[_0x5283('0x4')](_0x5283('0x2c'),require(_0x5283('0x2d')));_0x452c19[_0x5283('0x4')](_0x5283('0x2e'),require(_0x5283('0x2f')));_0x452c19[_0x5283('0x4')](_0x5283('0x30'),require(_0x5283('0x31')));_0x452c19['use'](_0x5283('0x32'),require('./api/faxQueue'));_0x452c19[_0x5283('0x4')](_0x5283('0x33'),require(_0x5283('0x34')));_0x452c19['use'](_0x5283('0x35'),require(_0x5283('0x36')));_0x452c19['use'](_0x5283('0x37'),require(_0x5283('0x38')));_0x452c19[_0x5283('0x4')](_0x5283('0x39'),require(_0x5283('0x3a')));_0x452c19[_0x5283('0x4')](_0x5283('0x3b'),require(_0x5283('0x3c')));_0x452c19[_0x5283('0x4')](_0x5283('0x3d'),require(_0x5283('0x3e')));_0x452c19[_0x5283('0x4')](_0x5283('0x3f'),require(_0x5283('0x40')));_0x452c19[_0x5283('0x4')](_0x5283('0x41'),require(_0x5283('0x42')));_0x452c19[_0x5283('0x4')](_0x5283('0x43'),require(_0x5283('0x44')));_0x452c19[_0x5283('0x4')](_0x5283('0x45'),require(_0x5283('0x46')));_0x452c19[_0x5283('0x4')](_0x5283('0x47'),require(_0x5283('0x48')));_0x452c19[_0x5283('0x4')](_0x5283('0x49'),require(_0x5283('0x4a')));_0x452c19['use'](_0x5283('0x4b'),require('./api/openchannelQueueReport'));_0x452c19[_0x5283('0x4')]('/api/chat/applications',require(_0x5283('0x4c')));_0x452c19[_0x5283('0x4')](_0x5283('0x4d'),require(_0x5283('0x4e')));_0x452c19[_0x5283('0x4')](_0x5283('0x4f'),require(_0x5283('0x50')));_0x452c19['use'](_0x5283('0x51'),require(_0x5283('0x52')));_0x452c19[_0x5283('0x4')](_0x5283('0x53'),require('./api/chatQueue'));_0x452c19[_0x5283('0x4')](_0x5283('0x54'),require('./api/chatGroup'));_0x452c19[_0x5283('0x4')]('/api/chat/proactive_actions',require(_0x5283('0x55')));_0x452c19['use'](_0x5283('0x56'),require(_0x5283('0x57')));_0x452c19['use'](_0x5283('0x58'),require('./api/cmContact'));_0x452c19[_0x5283('0x4')]('/api/cm/hopper',require(_0x5283('0x59')));_0x452c19[_0x5283('0x4')](_0x5283('0x5a'),require(_0x5283('0x5b')));_0x452c19[_0x5283('0x4')]('/api/cm/hopper_final',require(_0x5283('0x5c')));_0x452c19['use'](_0x5283('0x5d'),require(_0x5283('0x5e')));_0x452c19[_0x5283('0x4')](_0x5283('0x5f'),require('./api/cmCustomField'));_0x452c19[_0x5283('0x4')](_0x5283('0x60'),require(_0x5283('0x61')));_0x452c19[_0x5283('0x4')]('/api/automations',require(_0x5283('0x62')));_0x452c19[_0x5283('0x4')](_0x5283('0x63'),require(_0x5283('0x64')));_0x452c19[_0x5283('0x4')](_0x5283('0x65'),require('./api/disposition'));_0x452c19[_0x5283('0x4')](_0x5283('0x66'),require(_0x5283('0x67')));_0x452c19[_0x5283('0x4')]('/api/intervals',require(_0x5283('0x68')));_0x452c19[_0x5283('0x4')]('/api/pauses',require(_0x5283('0x69')));_0x452c19[_0x5283('0x4')](_0x5283('0x6a'),require(_0x5283('0x6b')));_0x452c19['use'](_0x5283('0x6c'),require(_0x5283('0x6d')));_0x452c19[_0x5283('0x4')](_0x5283('0x6e'),require('./api/schedule'));_0x452c19[_0x5283('0x4')](_0x5283('0x6f'),require('./api/sound'));_0x452c19[_0x5283('0x4')](_0x5283('0x70'),require(_0x5283('0x71')));_0x452c19[_0x5283('0x4')](_0x5283('0x72'),require('./api/contactItemType'));_0x452c19['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x452c19[_0x5283('0x4')]('/api/cm_hopper_additional_phones',require(_0x5283('0x73')));_0x452c19['use']('/api/templates',require(_0x5283('0x74')));_0x452c19[_0x5283('0x4')]('/api/triggers',require(_0x5283('0x75')));_0x452c19[_0x5283('0x4')](_0x5283('0x76'),require('./api/variable'));_0x452c19[_0x5283('0x4')]('/api/integrations',require('./api/integration'));_0x452c19['use']('/api/integrations/reports',require(_0x5283('0x77')));_0x452c19[_0x5283('0x4')](_0x5283('0x78'),require(_0x5283('0x79')));_0x452c19['use'](_0x5283('0x7a'),require(_0x5283('0x7b')));_0x452c19[_0x5283('0x4')](_0x5283('0x7c'),require(_0x5283('0x7d')));_0x452c19[_0x5283('0x4')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x452c19[_0x5283('0x4')](_0x5283('0x7e'),require(_0x5283('0x7f')));_0x452c19[_0x5283('0x4')](_0x5283('0x80'),require(_0x5283('0x81')));_0x452c19[_0x5283('0x4')](_0x5283('0x82'),require(_0x5283('0x83')));_0x452c19[_0x5283('0x4')](_0x5283('0x84'),require(_0x5283('0x85')));_0x452c19[_0x5283('0x4')]('/api/integrations/salesforce/fields',require(_0x5283('0x86')));_0x452c19['use'](_0x5283('0x87'),require(_0x5283('0x88')));_0x452c19[_0x5283('0x4')](_0x5283('0x89'),require(_0x5283('0x8a')));_0x452c19[_0x5283('0x4')]('/api/integrations/sugarcrm/fields',require(_0x5283('0x8b')));_0x452c19[_0x5283('0x4')]('/api/integrations/desk/accounts',require(_0x5283('0x8c')));_0x452c19['use'](_0x5283('0x8d'),require(_0x5283('0x8e')));_0x452c19[_0x5283('0x4')]('/api/integrations/desk/fields',require(_0x5283('0x8f')));_0x452c19[_0x5283('0x4')](_0x5283('0x90'),require(_0x5283('0x91')));_0x452c19[_0x5283('0x4')]('/api/integrations/zoho/configurations',require(_0x5283('0x92')));_0x452c19[_0x5283('0x4')]('/api/integrations/zoho/fields',require(_0x5283('0x93')));_0x452c19['use'](_0x5283('0x94'),require('./api/intZendeskAccount'));_0x452c19[_0x5283('0x4')](_0x5283('0x95'),require('./api/intZendeskConfiguration'));_0x452c19['use']('/api/integrations/zendesk/fields',require(_0x5283('0x96')));_0x452c19[_0x5283('0x4')](_0x5283('0x97'),require(_0x5283('0x98')));_0x452c19['use'](_0x5283('0x99'),require(_0x5283('0x9a')));_0x452c19['use'](_0x5283('0x9b'),require(_0x5283('0x9c')));_0x452c19[_0x5283('0x4')]('/api/integrations/vtiger/accounts',require(_0x5283('0x9d')));_0x452c19[_0x5283('0x4')](_0x5283('0x9e'),require(_0x5283('0x9f')));_0x452c19['use']('/api/integrations/vtiger/fields',require(_0x5283('0xa0')));_0x452c19['use']('/api/integrations/servicenow/accounts',require(_0x5283('0xa1')));_0x452c19[_0x5283('0x4')]('/api/integrations/servicenow/configurations',require(_0x5283('0xa2')));_0x452c19['use'](_0x5283('0xa3'),require(_0x5283('0xa4')));_0x452c19[_0x5283('0x4')](_0x5283('0xa5'),require(_0x5283('0xa6')));_0x452c19[_0x5283('0x4')]('/api/integrations/dynamics365/configurations',require(_0x5283('0xa7')));_0x452c19['use'](_0x5283('0xa8'),require(_0x5283('0xa9')));_0x452c19['use'](_0x5283('0xaa'),require('./api/intFreshsalesAccount'));_0x452c19[_0x5283('0x4')](_0x5283('0xab'),require(_0x5283('0xac')));_0x452c19[_0x5283('0x4')](_0x5283('0xad'),require('./api/intFreshsalesField'));_0x452c19[_0x5283('0x4')](_0x5283('0xae'),require(_0x5283('0xaf')));_0x452c19[_0x5283('0x4')](_0x5283('0xb0'),require(_0x5283('0xb1')));_0x452c19['use'](_0x5283('0xb2'),require('./api/chatInternalMessage'));_0x452c19[_0x5283('0x4')](_0x5283('0xb3'),require(_0x5283('0xb4')));_0x452c19[_0x5283('0x4')](_0x5283('0xb5'),require(_0x5283('0xb6')));_0x452c19[_0x5283('0x4')](_0x5283('0xb7'),require(_0x5283('0xb8')));_0x452c19[_0x5283('0x4')]('/api/sms/reports/queue',require(_0x5283('0xb9')));_0x452c19[_0x5283('0x4')](_0x5283('0xba'),require(_0x5283('0xbb')));_0x452c19[_0x5283('0x4')](_0x5283('0xbc'),require(_0x5283('0xbd')));_0x452c19[_0x5283('0x4')](_0x5283('0xbe'),require(_0x5283('0xbf')));_0x452c19[_0x5283('0x4')](_0x5283('0xc0'),require(_0x5283('0xc1')));_0x452c19[_0x5283('0x4')](_0x5283('0xc2'),require('./api/squareOdbc'));_0x452c19[_0x5283('0x4')](_0x5283('0xc3'),require(_0x5283('0xc4')));_0x452c19[_0x5283('0x4')](_0x5283('0xc5'),require(_0x5283('0xc6')));_0x452c19[_0x5283('0x4')](_0x5283('0xc7'),require(_0x5283('0xc8')));_0x452c19[_0x5283('0x4')](_0x5283('0xc9'),require(_0x5283('0xca')));_0x452c19[_0x5283('0x4')](_0x5283('0xcb'),require('./api/license'));_0x452c19[_0x5283('0x4')]('/api/campaigns',require(_0x5283('0xcc')));_0x452c19[_0x5283('0x4')]('/api/migrations',require(_0x5283('0xcd')));_0x452c19[_0x5283('0x4')]('/api/attachments',require(_0x5283('0xce')));_0x452c19[_0x5283('0x4')]('/api/plugins',require(_0x5283('0xcf')));_0x452c19['use']('/api/mail/reports/transfer',require(_0x5283('0xd0')));_0x452c19['use'](_0x5283('0xd1'),require('./api/chatTransferReport'));_0x452c19[_0x5283('0x4')](_0x5283('0xd2'),require(_0x5283('0xd3')));_0x452c19[_0x5283('0x4')](_0x5283('0xd4'),require('./api/openchannelTransferReport'));_0x452c19[_0x5283('0x4')](_0x5283('0xd5'),require(_0x5283('0xd6')));_0x452c19[_0x5283('0x4')](_0x5283('0xd7'),require(_0x5283('0xd8')));_0x452c19[_0x5283('0x4')](_0x5283('0xd9'),require('./api/voicePrefix'));_0x452c19['use'](_0x5283('0xda'),require(_0x5283('0xdb')));_0x452c19[_0x5283('0x4')](_0x5283('0xdc'),require('./api/userProfileSection'));_0x452c19[_0x5283('0x4')](_0x5283('0xdd'),require(_0x5283('0xde')));_0x452c19['use']('/api/userNotifications',require(_0x5283('0xdf')));_0x452c19[_0x5283('0x4')](_0x5283('0xe0'),require(_0x5283('0xe1')));_0x452c19[_0x5283('0x4')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x452c19[_0x5283('0x4')](_0x5283('0xe2'),require(_0x5283('0xe3')));_0x452c19[_0x5283('0x4')](_0x5283('0xe4'),require(_0x5283('0xe5')));_0x452c19[_0x5283('0x4')](_0x5283('0xe6'),require(_0x5283('0xe7')));_0x452c19[_0x5283('0x4')](_0x5283('0xe8'),require('./api/whatsappTransferReport'));_0x452c19[_0x5283('0x4')]('/api/whatsapp/queues',require(_0x5283('0xe9')));_0x452c19[_0x5283('0x4')](_0x5283('0xea'),require(_0x5283('0xeb')));_0x452c19[_0x5283('0x4')](_0x5283('0xec'),require('./api/realtime'));_0x452c19[_0x5283('0x4')]('/api/user-settings',require(_0x5283('0xed')));_0x452c19[_0x5283('0x4')](_0x5283('0xee'),require(_0x5283('0xef')));_0x452c19['use'](_0x5283('0xf0'),require(_0x5283('0xf1')));_0x452c19[_0x5283('0x4')](_0x5283('0xf2'),require(_0x5283('0xf3')));_0x452c19[_0x5283('0x4')](_0x5283('0xf4'),require(_0x5283('0xf5')));_0x452c19[_0x5283('0x4')](_0x5283('0xf6'),require(_0x5283('0xf7')));_0x452c19[_0x5283('0x4')](_0x5283('0xf8'),require(_0x5283('0xf9')));_0x452c19[_0x5283('0x4')]('/api/system',require(_0x5283('0xfa')));_0x452c19[_0x5283('0x4')]('/api/pm2',require(_0x5283('0xfb')));_0x452c19[_0x5283('0x4')](_0x5283('0xfc'),require(_0x5283('0xfd')));_0x452c19[_0x5283('0x4')](_0x5283('0xfe'),clientSideLogs);_0x452c19['use'](_0x5283('0xff'),express[_0x5283('0x100')](path['join'](config[_0x5283('0x101')],_0x5283('0xff'))));_0x452c19[_0x5283('0x4')](_0x5283('0x102'),express['static'](path[_0x5283('0x103')](config[_0x5283('0x101')],_0x5283('0x102'))));_0x452c19[_0x5283('0x4')](_0x5283('0x104'),express[_0x5283('0x100')](path[_0x5283('0x103')](config[_0x5283('0x101')],_0x5283('0x104'))));_0x452c19[_0x5283('0x4')]('/snippet',express[_0x5283('0x100')](path['join'](config[_0x5283('0x101')],_0x5283('0x105'),_0x5283('0x106'))));_0x452c19[_0x5283('0x4')](_0x5283('0x107'),express[_0x5283('0x100')](path[_0x5283('0x103')](config['root'],'/server/files/plugins')));_0x452c19[_0x5283('0x108')](_0x5283('0x109'))[_0x5283('0x10a')](errors[0x194]);_0x452c19['route']('/*')[_0x5283('0x10a')](function(_0x4a3e99,_0x1a6de0){_0x1a6de0[_0x5283('0x10b')](path['resolve'](_0x452c19[_0x5283('0x10a')](_0x5283('0x10c'))+_0x5283('0x10d')));});return _0x452c19;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b4ed64e..c7e7335 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3df2=['../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','../config/triggers','lodash','../config/environment','listen','../api/user/user.rpc','merge','../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/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc'];(function(_0x247d6c,_0x5c40dd){var _0x598f3e=function(_0x1dec24){while(--_0x1dec24){_0x247d6c['push'](_0x247d6c['shift']());}};_0x598f3e(++_0x5c40dd);}(_0x3df2,0x97));var _0x23df=function(_0x39e1a4,_0x4eb378){_0x39e1a4=_0x39e1a4-0x0;var _0x3342fe=_0x3df2[_0x39e1a4];return _0x3342fe;};'use strict';var jayson=require('jayson/promise');var _=require(_0x23df('0x0'));var config=require(_0x23df('0x1'));exports[_0x23df('0x2')]=function(){return new Promise(function(_0x1903a1,_0x38352b){var _0x41d26d={};_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x3')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/voiceExtension/voiceExtension.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/voiceQueue/voiceQueue.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/voiceRecording/voiceRecording.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x5')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x6')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x7')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/memberReport/memberReport.rpc'));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x8')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x9')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0xa')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0xb')));_0x41d26d=_['merge'](_0x41d26d,require('../api/mailAccount/mailAccount.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0xc')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0xd')));_0x41d26d=_['merge'](_0x41d26d,require('../api/mailMessage/mailMessage.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0xe')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0xf')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x10')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x11')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x12')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/faxQueue/faxQueue.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x13')));_0x41d26d=_['merge'](_0x41d26d,require('../api/smsInteraction/smsInteraction.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x14')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x15')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x16')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x17')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x18')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x19')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x1a')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x1b')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/cmContact/cmContact.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/cmHopper/cmHopper.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x1c')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x1d')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x1e')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x1f')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x20')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x21')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x22')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x23')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x24')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x25')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x26')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x27')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x28')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x41d26d=_['merge'](_0x41d26d,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x29')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x2a')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x41d26d=_['merge'](_0x41d26d,require('../api/squareReport/squareReport.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x2b')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require('../api/squareOdbc/squareOdbc.rpc'));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x2c')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x2d')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x2e')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x2f')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x30')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x31')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x32')));_0x41d26d=_['merge'](_0x41d26d,require(_0x23df('0x33')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x34')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x35')));_0x41d26d=_[_0x23df('0x4')](_0x41d26d,require(_0x23df('0x36')));var _0x3d2dc9=jayson[_0x23df('0x37')](_0x41d26d)[_0x23df('0x38')]();var _0x1eb221=config[_0x23df('0x39')][_0x23df('0x3a')]||config[_0x23df('0x3a')]+0x1;var _0x59a832=config['rpc']['ip']||_0x23df('0x3b');_0x3d2dc9['on'](_0x23df('0x3c'),function(_0x2a6b88){return _0x38352b(_0x2a6b88);});_0x3d2dc9[_0x23df('0x2')](_0x1eb221,_0x59a832,function(){console[_0x23df('0x3d')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x59a832,_0x1eb221);require(_0x23df('0x3e'))['default']();return _0x1903a1('RPC\x20listening\x20on\x20'+_0x59a832+':'+_0x1eb221);});});}; \ No newline at end of file +var _0x8149=['../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.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/template/template.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'];(function(_0x5aa141,_0x2d6e3a){var _0x446d2f=function(_0x11bb05){while(--_0x11bb05){_0x5aa141['push'](_0x5aa141['shift']());}};_0x446d2f(++_0x2d6e3a);}(_0x8149,0x1a3));var _0x9814=function(_0x496220,_0x4897a8){_0x496220=_0x496220-0x0;var _0x22d740=_0x8149[_0x496220];return _0x22d740;};'use strict';var jayson=require(_0x9814('0x0'));var _=require(_0x9814('0x1'));var config=require('../config/environment');exports[_0x9814('0x2')]=function(){return new Promise(function(_0x4ccf11,_0x559010){var _0x4aac97={};_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x3')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/voiceExtension/voiceExtension.rpc'));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x5')));_0x4aac97=_['merge'](_0x4aac97,require('../api/voiceRecording/voiceRecording.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x6')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x7')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x8')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x9')));_0x4aac97=_['merge'](_0x4aac97,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0xa')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0xb')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0xc')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0xd')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0xe')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0xf')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/mailApplication/mailApplication.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x10')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/faxAccount/faxAccount.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/faxApplication/faxApplication.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/faxInteraction/faxInteraction.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/faxMessage/faxMessage.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x11')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x12')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x13')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/smsInteraction/smsInteraction.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x14')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x15')));_0x4aac97=_['merge'](_0x4aac97,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4aac97=_['merge'](_0x4aac97,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x16')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x17')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x18')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x19')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/chatMessage/chatMessage.rpc'));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x1a')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/cmContact/cmContact.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x1b')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x1c')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x1d')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x1e')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x1f')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x20')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x21')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x22')));_0x4aac97=_['merge'](_0x4aac97,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x23')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/trigger/trigger.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/variable/variable.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x24')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x25')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x26')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x27')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x28')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x29')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x2a')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x2b')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x2c')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/squareReport/squareReport.rpc'));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x2d')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/setting/setting.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x2e')));_0x4aac97=_['merge'](_0x4aac97,require(_0x9814('0x2f')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x30')));_0x4aac97=_['merge'](_0x4aac97,require('../api/squareMessage/squareMessage.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require('../api/campaign/campaign.rpc'));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x31')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x32')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x33')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x34')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x35')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x36')));_0x4aac97=_[_0x9814('0x4')](_0x4aac97,require(_0x9814('0x37')));var _0x5264cc=jayson[_0x9814('0x38')](_0x4aac97)[_0x9814('0x39')]();var _0x5f2bfd=config[_0x9814('0x3a')][_0x9814('0x3b')]||config['port']+0x1;var _0x1982f3=config['rpc']['ip']||_0x9814('0x3c');_0x5264cc['on'](_0x9814('0x3d'),function(_0x8f1292){return _0x559010(_0x8f1292);});_0x5264cc[_0x9814('0x2')](_0x5f2bfd,_0x1982f3,function(){console[_0x9814('0x3e')](_0x9814('0x3f'),_0x1982f3,_0x5f2bfd);require(_0x9814('0x40'))['default']();return _0x4ccf11(_0x9814('0x41')+_0x1982f3+':'+_0x5f2bfd);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index cafcac0..e0f2552 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 _0xb397=['command','write','destroy','inherits','prototype','answer','ANSWER','getData','sendRequest','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','events','EventEmitter','./reply','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe'];(function(_0x31c075,_0x333c6a){var _0x49000c=function(_0x5bb21f){while(--_0x5bb21f){_0x31c075['push'](_0x31c075['shift']());}};_0x49000c(++_0x333c6a);}(_0xb397,0x1af));var _0x7b39=function(_0x19fa71,_0x474466){_0x19fa71=_0x19fa71-0x0;var _0x1c6a24=_0xb397[_0x19fa71];return _0x1c6a24;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x7b39('0x0'))[_0x7b39('0x1')];var AGIReply=require(_0x7b39('0x2'));var AGIError=require('./error');function AGIChannel(_0x42b3e3){var _0x1476d9=this,_0x5f52fd=new AGIReply(),_0x3cc454=![],_0x4417c7={};EventEmitter['call'](_0x1476d9);_0x42b3e3[_0x7b39('0x3')](_0x7b39('0x4'));_0x42b3e3[_0x7b39('0x5')](0x8*0x3c*0x3c*0x3e8);_0x5f52fd[_0x7b39('0x3')](_0x7b39('0x4'));_0x5f52fd['on']('headers',function(_0xa59b5a){for(var _0x32c686 in _0xa59b5a){_0x1476d9[_0x32c686]=_0xa59b5a[_0x32c686];}_0x1476d9[_0x7b39('0x6')](_0x7b39('0x7'));});_0x5f52fd['on'](_0x7b39('0x8'),function(_0x4f7dbd){if(_0x4f7dbd[_0x7b39('0x9')]()==_0x7b39('0xa')){_0x1476d9[_0x7b39('0x6')]('hangup');return;}if(_0x4f7dbd[_0x7b39('0xb')](0x0,0xb)==_0x7b39('0xc')){_0x3cc454=!![];}if(_0x3cc454){_0x4417c7['rx']+=_0x4f7dbd+'\x0a';if(_0x4f7dbd[_0x7b39('0xd')](_0x7b39('0xe'))!=-0x1){_0x3cc454=![];}}else{_0x4417c7['rx']=_0x4f7dbd;}if(_0x3cc454){return;}if(typeof _0x4417c7['cb']==_0x7b39('0xf')){var _0x115bb7=_0x4417c7['rx'][_0x7b39('0xb')](0x0,0x3),_0x15e810=null,_0x32f3b6=null;_0x115bb7=parseInt(_0x115bb7);if(isNaN(_0x115bb7)){_0x4417c7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7b39('0x10')});return;}if(_0x115bb7!=0xc8){_0x4417c7['cb'](null,{'code':_0x115bb7,'result':-0x1,'extra':'KO'});return;}_0x15e810=_0x4417c7['rx'][_0x7b39('0xb')](0x4)['replace'](_0x7b39('0x11'),'');if(_0x15e810[_0x7b39('0x12')]('\x20')!=-0x1){_0x15e810=_0x15e810['substr'](0x0,_0x15e810[_0x7b39('0x12')]('\x20'));}if(_[_0x7b39('0x13')](_0x15e810,'-1')){_0x15e810=parseInt(_0x15e810);}_0x32f3b6=_0x4417c7['rx'][_0x7b39('0x14')]('\x20');if(_0x32f3b6[_0x7b39('0x15')]==0x3){_0x32f3b6=_0x32f3b6[0x2][_0x7b39('0xb')](0x1,_0x32f3b6[0x2]['length']-0x1);}else if(_0x32f3b6[_0x7b39('0x15')]>0x3){var _0x5d525c=/\((.+)\)/;var _0x52a694=_0x4417c7['rx'][_0x7b39('0x16')](_0x5d525c);if(_0x52a694){_0x32f3b6=_0x52a694[0x1];}else{_0x32f3b6=null;}}else{_0x32f3b6=null;}_0x4417c7['cb'](null,{'code':_0x115bb7,'result':_0x15e810,'extra':_0x32f3b6});}});_0x42b3e3['on'](_0x7b39('0x17'),function(_0x863f50){_0x1476d9[_0x7b39('0x6')](_0x7b39('0x17'),new AGIError(_0x7b39('0x18'),_0x863f50[_0x7b39('0x19')]));});_0x42b3e3['on'](_0x7b39('0x1a'),function(){_0x1476d9[_0x7b39('0x6')]('close',new AGIError(_0x7b39('0x1b')));});_0x42b3e3['on'](_0x7b39('0x1c'),function(){_0x1476d9[_0x7b39('0x6')]('timeout',new AGIError(_0x7b39('0x1d')));_0x42b3e3['destroy']();});_0x42b3e3[_0x7b39('0x1e')](_0x5f52fd);this[_0x7b39('0x1f')]=function(_0x2e0a87,_0x5f35f3){var _0x2e0a87=_0x2e0a87||'',_0x5f35f3=typeof _0x5f35f3==_0x7b39('0xf')?_0x5f35f3:new Function();_0x4417c7={'tx':_0x2e0a87,'rx':'','cb':_0x5f35f3};_0x42b3e3[_0x7b39('0x20')](_0x2e0a87+'\x0a');},this[_0x7b39('0x1a')]=function(){_0x42b3e3[_0x7b39('0x21')]();};}util[_0x7b39('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x56c734){return this[_0x7b39('0x1f')]['sync'](this,_0x56c734);};AGIChannel[_0x7b39('0x23')][_0x7b39('0x24')]=function(){return this['sendRequest'](_0x7b39('0x25'));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x26')]=function(_0x5a79c4,_0x1edc91,_0x32f007){_0x5a79c4=_0x5a79c4===undefined?'beep':_0x5a79c4;_0x1edc91=_0x1edc91===undefined?'5':_0x1edc91;_0x32f007=_0x32f007===undefined?'1':_0x32f007;return this[_0x7b39('0x27')](util[_0x7b39('0x28')](_0x7b39('0x29'),_0x5a79c4,_0x1edc91*0x3e8,_0x32f007));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x2a')]=function(_0x6e550a){_0x6e550a=_0x6e550a||_0x7b39('0x2b');return this[_0x7b39('0x27')](util['format'](_0x7b39('0x2c'),_0x6e550a));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x2d')]=function(_0x1dbfed,_0x20bb84){if(_[_0x7b39('0x2e')](_0x20bb84)){return this[_0x7b39('0x27')](util[_0x7b39('0x28')](_0x7b39('0x2f'),_0x1dbfed,_0x20bb84[_0x7b39('0x30')](',')));}return this[_0x7b39('0x27')](util[_0x7b39('0x28')](_0x7b39('0x2f'),_0x1dbfed,_0x20bb84));};AGIChannel['prototype'][_0x7b39('0x31')]=function(_0x10c4bd){return this['sendRequest'](util[_0x7b39('0x28')](_0x7b39('0x32'),_0x10c4bd));};AGIChannel[_0x7b39('0x23')]['setExtension']=function(_0x4a346a){return this[_0x7b39('0x27')](util[_0x7b39('0x28')]('SET\x20EXTENSION\x20%s',_0x4a346a));};AGIChannel['prototype'][_0x7b39('0x33')]=function(_0x2b663f){return this[_0x7b39('0x27')](util['format'](_0x7b39('0x34'),_0x2b663f));};AGIChannel['prototype'][_0x7b39('0xa')]=function(){return this[_0x7b39('0x27')](_0x7b39('0x35'));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x36')]=function(_0x4d5449,_0x18b318){var _0x55cf04=_['isBoolean'](_0x18b318)||_[_0x7b39('0x37')](_0x18b318)?_0x18b318['toString']():_0x18b318;return this[_0x7b39('0x27')](util[_0x7b39('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4d5449,_0x55cf04?_0x55cf04[_0x7b39('0x38')]()[_0x7b39('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x7b39('0x3a')]=function(_0x32c056,_0x423931){return this[_0x7b39('0x27')](util[_0x7b39('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x32c056,_0x423931));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x3b')]=function(_0x499c15,_0x359d54){return this[_0x7b39('0x27')](util[_0x7b39('0x28')](_0x7b39('0x3c'),_0x499c15,_0x359d54));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x3d')]=function(_0x7e88f5,_0x4aac81){return this['sendRequest'](util[_0x7b39('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x7e88f5,_0x4aac81));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x3e')]=function(_0x1bd673,_0x181543,_0x591eeb){_0x181543=_0x181543||this[_0x7b39('0x3f')];_0x591eeb=_0x591eeb||0x1;this[_0x7b39('0x31')](_0x1bd673);this[_0x7b39('0x40')](_0x181543);this[_0x7b39('0x33')](_0x591eeb);return this[_0x7b39('0x2a')](util[_0x7b39('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x1bd673,_0x181543,_0x591eeb));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x41')]=function(_0x542ae2){return this['sendRequest'](util[_0x7b39('0x28')](_0x7b39('0x42'),_0x542ae2));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x43')]=function(_0x4f6dfa,_0x1b5802,_0x558191,_0x3ab438,_0x2d076a,_0x3220a2){_0x1b5802=_0x1b5802||_0x7b39('0x44');_0x558191=_0x558191||'';_0x3ab438=_0x3ab438===undefined?-0x1:_0x3ab438==='-1'?-0x1:_0x3ab438*0x3e8;_0x2d076a=_0x2d076a===undefined?'':'s='+_0x2d076a;_0x3220a2=_0x3220a2?_0x7b39('0x45'):'';return this[_0x7b39('0x27')](util[_0x7b39('0x28')](_0x7b39('0x46'),_0x4f6dfa,_0x1b5802,_0x558191,_0x3ab438,_0x3220a2,_0x2d076a));};AGIChannel[_0x7b39('0x23')]['streamFile']=function(_0x2766d9,_0x18b970){_0x18b970=_0x18b970||'';return this[_0x7b39('0x27')](util[_0x7b39('0x28')](_0x7b39('0x47'),_0x2766d9,_0x18b970));};AGIChannel[_0x7b39('0x23')][_0x7b39('0x48')]=function(_0x696c42){return this[_0x7b39('0x2d')](_0x7b39('0x49'),_0x696c42);};AGIChannel[_0x7b39('0x23')][_0x7b39('0x4a')]=function(_0x42b6c9){return this[_0x7b39('0x2d')](_0x7b39('0x4b'),_0x42b6c9);};AGIChannel['prototype'][_0x7b39('0x17')]=function(_0x4ffd2e,_0x5af39c){this[_0x7b39('0x2a')](util[_0x7b39('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4ffd2e['id'],_0x4ffd2e[_0x7b39('0x4c')],_0x5af39c));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x6fc2=['inherits','prototype','sync','answer','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','sayNumber','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','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','exec','WAIT','label','exports','util','lodash','events','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','command','write','destroy'];(function(_0x45d174,_0x47c6bb){var _0x3a0128=function(_0xdd4c62){while(--_0xdd4c62){_0x45d174['push'](_0x45d174['shift']());}};_0x3a0128(++_0x47c6bb);}(_0x6fc2,0x117));var _0x26fc=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x6fc2[_0x1beef3];return _0x5af964;};'use strict';var util=require(_0x26fc('0x0'));var _=require(_0x26fc('0x1'));var EventEmitter=require(_0x26fc('0x2'))['EventEmitter'];var AGIReply=require(_0x26fc('0x3'));var AGIError=require(_0x26fc('0x4'));function AGIChannel(_0x5d460c){var _0x49e08c=this,_0x5bab33=new AGIReply(),_0x2cbf9b=![],_0x31a424={};EventEmitter['call'](_0x49e08c);_0x5d460c[_0x26fc('0x5')](_0x26fc('0x6'));_0x5d460c[_0x26fc('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5bab33[_0x26fc('0x5')]('utf8');_0x5bab33['on'](_0x26fc('0x8'),function(_0x5616eb){for(var _0x5a452d in _0x5616eb){_0x49e08c[_0x5a452d]=_0x5616eb[_0x5a452d];}_0x49e08c[_0x26fc('0x9')](_0x26fc('0xa'));});_0x5bab33['on'](_0x26fc('0xb'),function(_0x500159){if(_0x500159[_0x26fc('0xc')]()==_0x26fc('0xd')){_0x49e08c[_0x26fc('0x9')](_0x26fc('0xd'));return;}if(_0x500159[_0x26fc('0xe')](0x0,0xb)==_0x26fc('0xf')){_0x2cbf9b=!![];}if(_0x2cbf9b){_0x31a424['rx']+=_0x500159+'\x0a';if(_0x500159[_0x26fc('0x10')](_0x26fc('0x11'))!=-0x1){_0x2cbf9b=![];}}else{_0x31a424['rx']=_0x500159;}if(_0x2cbf9b){return;}if(typeof _0x31a424['cb']==_0x26fc('0x12')){var _0x40fff4=_0x31a424['rx'][_0x26fc('0xe')](0x0,0x3),_0x42b440=null,_0x2d837e=null;_0x40fff4=parseInt(_0x40fff4);if(isNaN(_0x40fff4)){_0x31a424['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x26fc('0x13')});return;}if(_0x40fff4!=0xc8){_0x31a424['cb'](null,{'code':_0x40fff4,'result':-0x1,'extra':'KO'});return;}_0x42b440=_0x31a424['rx'][_0x26fc('0xe')](0x4)[_0x26fc('0x14')]('result=','');if(_0x42b440[_0x26fc('0x15')]('\x20')!=-0x1){_0x42b440=_0x42b440[_0x26fc('0x16')](0x0,_0x42b440[_0x26fc('0x15')]('\x20'));}if(_[_0x26fc('0x17')](_0x42b440,'-1')){_0x42b440=parseInt(_0x42b440);}_0x2d837e=_0x31a424['rx'][_0x26fc('0x18')]('\x20');if(_0x2d837e[_0x26fc('0x19')]==0x3){_0x2d837e=_0x2d837e[0x2][_0x26fc('0xe')](0x1,_0x2d837e[0x2][_0x26fc('0x19')]-0x1);}else if(_0x2d837e[_0x26fc('0x19')]>0x3){var _0x54f0e5=/\((.+)\)/;var _0x2d5a7c=_0x31a424['rx']['match'](_0x54f0e5);if(_0x2d5a7c){_0x2d837e=_0x2d5a7c[0x1];}else{_0x2d837e=null;}}else{_0x2d837e=null;}_0x31a424['cb'](null,{'code':_0x40fff4,'result':_0x42b440,'extra':_0x2d837e});}});_0x5d460c['on'](_0x26fc('0x1a'),function(_0x3507b1){_0x49e08c[_0x26fc('0x9')](_0x26fc('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x3507b1[_0x26fc('0x1b')]));});_0x5d460c['on'](_0x26fc('0x1c'),function(){_0x49e08c[_0x26fc('0x9')](_0x26fc('0x1c'),new AGIError(_0x26fc('0x1d')));});_0x5d460c['on']('timeout',function(){_0x49e08c['emit']('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x5d460c['destroy']();});_0x5d460c['pipe'](_0x5bab33);this[_0x26fc('0x1e')]=function(_0x529911,_0x2fb061){var _0x529911=_0x529911||'',_0x2fb061=typeof _0x2fb061==_0x26fc('0x12')?_0x2fb061:new Function();_0x31a424={'tx':_0x529911,'rx':'','cb':_0x2fb061};_0x5d460c[_0x26fc('0x1f')](_0x529911+'\x0a');},this[_0x26fc('0x1c')]=function(){_0x5d460c[_0x26fc('0x20')]();};}util[_0x26fc('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x26fc('0x22')]['sendRequest']=function(_0x346fe0){return this[_0x26fc('0x1e')][_0x26fc('0x23')](this,_0x346fe0);};AGIChannel[_0x26fc('0x22')][_0x26fc('0x24')]=function(){return this[_0x26fc('0x25')](_0x26fc('0x26'));};AGIChannel['prototype'][_0x26fc('0x27')]=function(_0x2fc858,_0x2235d8,_0xe86d74){_0x2fc858=_0x2fc858===undefined?_0x26fc('0x28'):_0x2fc858;_0x2235d8=_0x2235d8===undefined?'5':_0x2235d8;_0xe86d74=_0xe86d74===undefined?'1':_0xe86d74;return this[_0x26fc('0x25')](util['format'](_0x26fc('0x29'),_0x2fc858,_0x2235d8*0x3e8,_0xe86d74));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x2a')]=function(_0x32088c){_0x32088c=_0x32088c||_0x26fc('0x2b');return this[_0x26fc('0x25')](util[_0x26fc('0x2c')](_0x26fc('0x2d'),_0x32088c));};AGIChannel['prototype']['exec']=function(_0x47b642,_0x297e53){if(_['isArray'](_0x297e53)){return this['sendRequest'](util[_0x26fc('0x2c')](_0x26fc('0x2e'),_0x47b642,_0x297e53[_0x26fc('0x2f')](',')));}return this[_0x26fc('0x25')](util[_0x26fc('0x2c')](_0x26fc('0x2e'),_0x47b642,_0x297e53));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x30')]=function(_0x260339){return this[_0x26fc('0x25')](util['format'](_0x26fc('0x31'),_0x260339));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x32')]=function(_0x115985){return this[_0x26fc('0x25')](util[_0x26fc('0x2c')](_0x26fc('0x33'),_0x115985));};AGIChannel['prototype'][_0x26fc('0x34')]=function(_0x5c0265){return this[_0x26fc('0x25')](util[_0x26fc('0x2c')](_0x26fc('0x35'),_0x5c0265));};AGIChannel[_0x26fc('0x22')][_0x26fc('0xd')]=function(){return this['sendRequest'](_0x26fc('0x36'));};AGIChannel[_0x26fc('0x22')]['setVariable']=function(_0x1cf6f0,_0x56be15){var _0x440451=_[_0x26fc('0x37')](_0x56be15)||_[_0x26fc('0x38')](_0x56be15)?_0x56be15[_0x26fc('0x39')]():_0x56be15;return this[_0x26fc('0x25')](util[_0x26fc('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1cf6f0,_0x440451?_0x440451['toString']()[_0x26fc('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x3a')]=function(_0x1205e8,_0x4c69e4){return this[_0x26fc('0x25')](util[_0x26fc('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x1205e8,_0x4c69e4));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x3b')]=function(_0x5e4c3d,_0x53836){return this[_0x26fc('0x25')](util[_0x26fc('0x2c')]('SAY\x20DIGITS\x20%s\x20%s',_0x5e4c3d,_0x53836));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x3c')]=function(_0x4e2c58,_0x2678ee){return this['sendRequest'](util[_0x26fc('0x2c')](_0x26fc('0x3d'),_0x4e2c58,_0x2678ee));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x3e')]=function(_0x3e2017,_0x61b69,_0x1af33e){_0x61b69=_0x61b69||this[_0x26fc('0x3f')];_0x1af33e=_0x1af33e||0x1;this[_0x26fc('0x30')](_0x3e2017);this[_0x26fc('0x32')](_0x61b69);this[_0x26fc('0x34')](_0x1af33e);return this[_0x26fc('0x2a')](util['format'](_0x26fc('0x40'),_0x3e2017,_0x61b69,_0x1af33e));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x41')]=function(_0x469b2d){return this[_0x26fc('0x25')](util[_0x26fc('0x2c')](_0x26fc('0x42'),_0x469b2d));};AGIChannel['prototype']['recordFile']=function(_0xcd1c66,_0x157e0b,_0x58c80d,_0x3e6d28,_0x92ab06,_0x223dea){_0x157e0b=_0x157e0b||'wav';_0x58c80d=_0x58c80d||'';_0x3e6d28=_0x3e6d28===undefined?-0x1:_0x3e6d28==='-1'?-0x1:_0x3e6d28*0x3e8;_0x92ab06=_0x92ab06===undefined?'':'s='+_0x92ab06;_0x223dea=_0x223dea?_0x26fc('0x43'):'';return this[_0x26fc('0x25')](util[_0x26fc('0x2c')](_0x26fc('0x44'),_0xcd1c66,_0x157e0b,_0x58c80d,_0x3e6d28,_0x223dea,_0x92ab06));};AGIChannel[_0x26fc('0x22')][_0x26fc('0x45')]=function(_0x1395a8,_0x44b16e){_0x44b16e=_0x44b16e||'';return this[_0x26fc('0x25')](util[_0x26fc('0x2c')](_0x26fc('0x46'),_0x1395a8,_0x44b16e));};AGIChannel['prototype'][_0x26fc('0x47')]=function(_0x26b10d){return this['exec'](_0x26fc('0x48'),_0x26b10d);};AGIChannel[_0x26fc('0x22')][_0x26fc('0x49')]=function(_0x54b37e){return this[_0x26fc('0x4a')](_0x26fc('0x4b'),_0x54b37e);};AGIChannel[_0x26fc('0x22')][_0x26fc('0x1a')]=function(_0x182bb6,_0x4848b5){this[_0x26fc('0x2a')](util[_0x26fc('0x2c')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x182bb6['id'],_0x182bb6[_0x26fc('0x4c')],_0x4848b5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x26fc('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index b9ab2f8..bc5b5f7 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 _0xf510=['apply','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','E_AGI_UNDEFINED','push','format'];(function(_0x5b043a,_0x3959ce){var _0x439e4c=function(_0x421203){while(--_0x421203){_0x5b043a['push'](_0x5b043a['shift']());}};_0x439e4c(++_0x3959ce);}(_0xf510,0x154));var _0x0f51=function(_0x4cd004,_0x14ded8){_0x4cd004=_0x4cd004-0x0;var _0x5b72f1=_0xf510[_0x4cd004];return _0x5b72f1;};'use strict';var util=require(_0x0f51('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x0f51('0x1'),'E_AGI_SERVER_ERROR':_0x0f51('0x2'),'E_AGI_SERVER_CLOSE':_0x0f51('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0f51('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0f51('0x5'),'E_AGI_SOCKET_ERROR':_0x0f51('0x6'),'E_AGI_SOCKET_CLOSE':_0x0f51('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x4b59e5){var _0x4b59e5=_0x4b59e5||null,_0x2493a5=_0x2493a5||[],_0x2ae774=0x1,_0x46b3fd='';if(!error[_0x4b59e5]){_0x4b59e5=_0x0f51('0x8');}_0x2493a5[_0x0f51('0x9')](error[_0x4b59e5]);while(arguments[_0x2ae774]){_0x2493a5[_0x0f51('0x9')](arguments[_0x2ae774]);_0x2ae774++;}_0x46b3fd=util[_0x0f51('0xa')][_0x0f51('0xb')](util,_0x2493a5);this['message']=_0x46b3fd;this['name']=_0x4b59e5;}module[_0x0f51('0xc')]=AGIError; \ No newline at end of file +var _0x9ade=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x1cea7b,_0x37f5f4){var _0x5618d1=function(_0x7c8aa6){while(--_0x7c8aa6){_0x1cea7b['push'](_0x1cea7b['shift']());}};_0x5618d1(++_0x37f5f4);}(_0x9ade,0x14e));var _0xe9ad=function(_0x356a22,_0x241023){_0x356a22=_0x356a22-0x0;var _0x3b9add=_0x9ade[_0x356a22];return _0x3b9add;};'use strict';var util=require(_0xe9ad('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xe9ad('0x1'),'E_AGI_SERVER_ERROR':_0xe9ad('0x2'),'E_AGI_SERVER_CLOSE':_0xe9ad('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xe9ad('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xe9ad('0x5'),'E_AGI_SOCKET_ERROR':_0xe9ad('0x6'),'E_AGI_SOCKET_CLOSE':_0xe9ad('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xe9ad('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe9ad('0x9'),'E_AGI_IVR_ENTRY':_0xe9ad('0xa')};function AGIError(_0xc3148d){var _0xc3148d=_0xc3148d||null,_0x9ec21a=_0x9ec21a||[],_0xc369a0=0x1,_0x354d73='';if(!error[_0xc3148d]){_0xc3148d='E_AGI_UNDEFINED';}_0x9ec21a[_0xe9ad('0xb')](error[_0xc3148d]);while(arguments[_0xc369a0]){_0x9ec21a['push'](arguments[_0xc369a0]);_0xc369a0++;}_0x354d73=util[_0xe9ad('0xc')][_0xe9ad('0xd')](util,_0x9ec21a);this[_0xe9ad('0xe')]=_0x354d73;this[_0xe9ad('0xf')]=_0xc3148d;}module[_0xe9ad('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index e37b5a2..3c7cb79 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 _0xf981=['../../config/environment','defaults','redis','subscribe','agi','emit','error','message','E_AGI_SERVER_ERROR','exports','lodash','ioredis','./error'];(function(_0xec642,_0xa5035b){var _0xd3bf50=function(_0x2e75d0){while(--_0x2e75d0){_0xec642['push'](_0xec642['shift']());}};_0xd3bf50(++_0xa5035b);}(_0xf981,0x183));var _0x1f98=function(_0xa0039d,_0x3c96bc){_0xa0039d=_0xa0039d-0x0;var _0x4280b9=_0xf981[_0xa0039d];return _0x4280b9;};'use strict';var _=require(_0x1f98('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x1f98('0x1'));var AGIError=require(_0x1f98('0x2'));var config=require(_0x1f98('0x3'));config['redis']=_[_0x1f98('0x4')](config[_0x1f98('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x1f98('0x6')](_0x1f98('0x7'),function(_0x165b10){if(_0x165b10)return eventEmitter[_0x1f98('0x8')](_0x1f98('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x165b10));});sub['on'](_0x1f98('0xa'),function(_0x10dc1c,_0x4791a4){if(_0x10dc1c!==_0x1f98('0x7'))return;try{var _0x29940d=JSON['parse'](_0x4791a4);eventEmitter[_0x1f98('0x8')]('projectUpdate',_0x29940d);}catch(_0x2df40f){eventEmitter[_0x1f98('0x8')](_0x1f98('0x9'),new AGIError(_0x1f98('0xb'),_0x2df40f));}});module[_0x1f98('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x58c9=['../../config/environment','redis','defaults','localhost','subscribe','agi','emit','message','parse','projectUpdate','error','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','ioredis','./error'];(function(_0xde9bac,_0xf0e01e){var _0x4f01ee=function(_0x2fe676){while(--_0x2fe676){_0xde9bac['push'](_0xde9bac['shift']());}};_0x4f01ee(++_0xf0e01e);}(_0x58c9,0x1e8));var _0x958c=function(_0x404fbf,_0x22cb94){_0x404fbf=_0x404fbf-0x0;var _0x5180fb=_0x58c9[_0x404fbf];return _0x5180fb;};'use strict';var _=require(_0x958c('0x0'));var EventEmitter=require(_0x958c('0x1'))[_0x958c('0x2')];var Redis=require(_0x958c('0x3'));var AGIError=require(_0x958c('0x4'));var config=require(_0x958c('0x5'));config[_0x958c('0x6')]=_[_0x958c('0x7')](config[_0x958c('0x6')],{'host':_0x958c('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x958c('0x6')]);sub[_0x958c('0x9')](_0x958c('0xa'),function(_0x5ba685){if(_0x5ba685)return eventEmitter[_0x958c('0xb')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5ba685));});sub['on'](_0x958c('0xc'),function(_0x13b665,_0x22614b){if(_0x13b665!==_0x958c('0xa'))return;try{var _0x310aa9=JSON[_0x958c('0xd')](_0x22614b);eventEmitter[_0x958c('0xb')](_0x958c('0xe'),_0x310aa9);}catch(_0x5b2b86){eventEmitter[_0x958c('0xb')](_0x958c('0xf'),new AGIError(_0x958c('0x10'),_0x5b2b86));}});module['exports']={'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 83d7b43..ccb1b06 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 _0x49fb=['no\x20edge/s\x20available','condition','split','agicommand','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addEdge','numberOfEdges','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','stop\x20traverse','length','info'];(function(_0x227a75,_0x423984){var _0xd5e985=function(_0x260ced){while(--_0x260ced){_0x227a75['push'](_0x227a75['shift']());}};_0xd5e985(++_0x423984);}(_0x49fb,0x119));var _0xb49f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x49fb[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb49f('0x0'));var logger=require(_0xb49f('0x1'))(_0xb49f('0x2'));var verticesWithRetry=[_0xb49f('0x3'),_0xb49f('0x4'),_0xb49f('0x5')];var Graph=function(){this[_0xb49f('0x6')]={};this[_0xb49f('0x7')]={};this['numberOfEdges']=0x0;};Graph[_0xb49f('0x8')]['addVertex']=function(_0x5173c0){this[_0xb49f('0x6')][_0x5173c0['id']]=_0x5173c0;this[_0xb49f('0x7')][_0x5173c0['id']]=[];};Graph[_0xb49f('0x8')][_0xb49f('0x9')]=function(_0x54e118,_0xb15b18,_0x446ade){this['edges'][_0x54e118]['push']({'target':_0xb15b18,'condition':_0x446ade});this[_0xb49f('0xa')]+=0x1;};Graph[_0xb49f('0x8')]['size']=function(){return _[_0xb49f('0xb')](this['vertices']);};Graph[_0xb49f('0x8')][_0xb49f('0xc')]=function(){return this['numberOfEdges'];};Graph['prototype'][_0xb49f('0xd')]=function(_0x4136be){return this['vertices'][_0x4136be];};Graph[_0xb49f('0x8')][_0xb49f('0xe')]=function(_0x531f02,_0x2f959b){if(!this['vertices'][_0x531f02]){return logger['info'](_0xb49f('0xf'));}var _0x3dc29d=_0x2f959b(this['vertices'][_0x531f02]);if(!_0x3dc29d){return logger['info'](_0xb49f('0x10'));}if(this[_0xb49f('0x7')][_0x531f02][_0xb49f('0x11')]===0x0){return logger[_0xb49f('0x12')](_0xb49f('0x13'));}for(var _0x2b30a2=0x0,_0x5e0ff5=[],_0x3860ca=![];_0x2b30a2\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','find','handleNotFound','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','message','format','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport'];(function(_0x45cde4,_0x46684f){var _0x110b0a=function(_0x5a8d78){while(--_0x5a8d78){_0x45cde4['push'](_0x45cde4['shift']());}};_0x110b0a(++_0x46684f);}(_0x3260,0x138));var _0x0326=function(_0x2bd8fe,_0x4aeef7){_0x2bd8fe=_0x2bd8fe-0x0;var _0x2979e6=_0x3260[_0x2bd8fe];return _0x2979e6;};'use strict';var _=require(_0x0326('0x0'));var syncho=require(_0x0326('0x1'));var util=require(_0x0326('0x2'));var config=require('../../config/environment');var logger=require(_0x0326('0x3'))(_0x0326('0x4'));var utilLicense=require(_0x0326('0x5'));var rpc=require(_0x0326('0x6'));var Project=require(_0x0326('0x7'));var AGIEmitter=require('./events')[_0x0326('0x8')];var projects=[];config[_0x0326('0x4')]=_[_0x0326('0x9')](config[_0x0326('0x4')],{'ip':_0x0326('0xa'),'port':0x11dd});AGIEmitter['on'](_0x0326('0xb'),projectUpdateHandler);function connectionHandler(_0x5a6811){process[_0x0326('0xc')](function(){syncho(function(){try{setChannelVariables(_0x5a6811);agiHandler(_0x5a6811);}catch(_0x53cf13){logger[_0x0326('0xd')](_0x53cf13[_0x0326('0xe')]);}});});}function projectUpdateHandler(_0x31804f){try{var _0x5b4498=_['findIndex'](projects,['id',_0x31804f['id']]);if(_0x5b4498>-0x1){if(_0x31804f[_0x0326('0xf')]===!![]){projects[_0x0326('0x10')](_0x5b4498,0x1);}else{projects[_0x5b4498]=_0x31804f;}}else{projects[_0x0326('0x11')](_0x31804f);}}catch(_0x56019c){logger[_0x0326('0xd')](_0x56019c['stack']);}}function listeningHandler(){console[_0x0326('0x12')](_0x0326('0x13'),config[_0x0326('0x4')][_0x0326('0x14')]);logger[_0x0326('0x15')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x0326('0x4')]['ip'],config[_0x0326('0x4')]['port']));}function errorHandler(_0x25cc05){if(_0x25cc05&&_0x25cc05[_0x0326('0x16')]&&_0x25cc05[_0x0326('0x17')]){logger[_0x0326('0xd')](util[_0x0326('0x18')](_0x0326('0x19'),_0x25cc05[_0x0326('0x16')],_0x25cc05['message']));}else{logger['error'](util[_0x0326('0x18')](_0x0326('0x1a'),_0x25cc05['stack']));}}function closeHandler(){logger[_0x0326('0x15')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x0326('0x1b')],this[_0x0326('0x1c')],this[_0x0326('0x1d')],this[_0x0326('0x1e')],this[_0x0326('0x1f')]));try{createSquareReport(this);}catch(_0x9e97c1){logger[_0x0326('0xd')](_0x9e97c1['stack']);}}function timeoutHandler(){logger[_0x0326('0x15')](util[_0x0326('0x18')](_0x0326('0x20'),this[_0x0326('0x1b')],this[_0x0326('0x1c')],this['callerid'],this[_0x0326('0x1e')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x0326('0x18')](_0x0326('0x21'),this['arg_1'],this['calleridname'],this[_0x0326('0x1d')],this[_0x0326('0x1e')],this[_0x0326('0x1f')]));this[_0x0326('0x22')]=!![];}function createSquareReport(_0x336916,_0x49deb5){rpc[_0x0326('0x23')](_0x336916)[_0x0326('0x24')](function(_0xad9ba6){if(_0x49deb5){_0x49deb5(null,_0xad9ba6);}})[_0x0326('0x25')](function(_0x1f6914){if(_0x49deb5){_0x49deb5(null,_0x1f6914);}});}function setChannelVariables(_0x4b5447){for(var _0x48d750 in _0x4b5447){if(_0x4b5447[_0x0326('0x26')](_0x48d750)){if(_0x48d750[_0x0326('0x27')]('agi_')===0x0){_0x4b5447[_0x48d750[_0x0326('0x28')](0x4)]=_0x4b5447[_0x48d750];delete _0x4b5447[_0x48d750];}}}}function agiHandler(_0x2b6a37){logger['debug']('variables',JSON[_0x0326('0x29')](_0x2b6a37,null,0x2));logger['info'](util[_0x0326('0x18')](_0x0326('0x2a'),_0x2b6a37[_0x0326('0x1b')],_0x2b6a37['calleridname'],_0x2b6a37[_0x0326('0x1d')],_0x2b6a37[_0x0326('0x1e')],_0x2b6a37['uniqueid']));_0x2b6a37['on'](_0x0326('0xd'),errorHandler);_0x2b6a37['on']('close',closeHandler);_0x2b6a37['on'](_0x0326('0x2b'),timeoutHandler);_0x2b6a37[_0x0326('0x22')]=![];_0x2b6a37['on']('hangup',hangupHandler);var _0x1a4807=_[_0x0326('0x2c')](projects,[_0x0326('0x16'),_0x2b6a37[_0x0326('0x1b')]]);if(!_0x1a4807)return Project[_0x0326('0x2d')](_0x2b6a37);if(!_0x1a4807[_0x0326('0x2e')])return Project[_0x0326('0x2f')](_0x2b6a37);return Project[_0x0326('0x30')](_0x1a4807,_0x2b6a37);}function main(){var _0x264177;return utilLicense['getLicense']()[_0x0326('0x24')](function(_0x90fec8){if(!_0x90fec8)return;if(_0x90fec8[_0x0326('0x31')]){if(_0x90fec8[_0x0326('0x32')]&&_0x90fec8[_0x0326('0x32')]>0x0){logger['info'](util[_0x0326('0x18')](_0x0326('0x33'),_0x90fec8[_0x0326('0x32')]));_0x264177=_0x90fec8['callysquare'];}else{logger['info'](_0x0326('0x34'));}}else{logger[_0x0326('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x264177=-0x1;}})[_0x0326('0x24')](function(){return Project[_0x0326('0x35')]();})['then'](function(_0x35b9b0){projects=_0x35b9b0;return;})[_0x0326('0x25')](function(_0x1f6ce1){logger[_0x0326('0xd')](_0x0326('0x36'),_0x1f6ce1[_0x0326('0xe')]);})[_0x0326('0x37')](function(){var _0x12440a=require(_0x0326('0x38'))(config[_0x0326('0x4')][_0x0326('0x14')],config[_0x0326('0x4')]['ip'],_0x264177);_0x12440a['on'](_0x0326('0xd'),errorHandler);_0x12440a['on'](_0x0326('0x39'),listeningHandler);_0x12440a['on']('connection',connectionHandler);_0x12440a['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x3fac=['lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','stack','findIndex','deleted','splice','push','error','log','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','./server','listening','connection'];(function(_0x35f97d,_0x513c9f){var _0x3d249a=function(_0x2c2f67){while(--_0x2c2f67){_0x35f97d['push'](_0x35f97d['shift']());}};_0x3d249a(++_0x513c9f);}(_0x3fac,0x7e));var _0xc3fa=function(_0x54a826,_0x24ed0f){_0x54a826=_0x54a826-0x0;var _0x2af875=_0x3fac[_0x54a826];return _0x2af875;};'use strict';var _=require(_0xc3fa('0x0'));var syncho=require(_0xc3fa('0x1'));var util=require(_0xc3fa('0x2'));var config=require(_0xc3fa('0x3'));var logger=require(_0xc3fa('0x4'))(_0xc3fa('0x5'));var utilLicense=require(_0xc3fa('0x6'));var rpc=require(_0xc3fa('0x7'));var Project=require(_0xc3fa('0x8'));var AGIEmitter=require(_0xc3fa('0x9'))[_0xc3fa('0xa')];var projects=[];config[_0xc3fa('0x5')]=_[_0xc3fa('0xb')](config['agi'],{'ip':_0xc3fa('0xc'),'port':0x11dd});AGIEmitter['on'](_0xc3fa('0xd'),projectUpdateHandler);function connectionHandler(_0x42c6de){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x42c6de);agiHandler(_0x42c6de);}catch(_0x55cc62){logger['error'](_0x55cc62[_0xc3fa('0xe')]);}});});}function projectUpdateHandler(_0x5cbe88){try{var _0x2f4163=_[_0xc3fa('0xf')](projects,['id',_0x5cbe88['id']]);if(_0x2f4163>-0x1){if(_0x5cbe88[_0xc3fa('0x10')]===!![]){projects[_0xc3fa('0x11')](_0x2f4163,0x1);}else{projects[_0x2f4163]=_0x5cbe88;}}else{projects[_0xc3fa('0x12')](_0x5cbe88);}}catch(_0x4172a5){logger[_0xc3fa('0x13')](_0x4172a5[_0xc3fa('0xe')]);}}function listeningHandler(){console[_0xc3fa('0x14')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xc3fa('0x5')][_0xc3fa('0x15')]);logger[_0xc3fa('0x16')](util['format'](_0xc3fa('0x17'),config[_0xc3fa('0x5')]['ip'],config[_0xc3fa('0x5')][_0xc3fa('0x15')]));}function errorHandler(_0x2625cf){if(_0x2625cf&&_0x2625cf[_0xc3fa('0x18')]&&_0x2625cf[_0xc3fa('0x19')]){logger[_0xc3fa('0x13')](util[_0xc3fa('0x1a')](_0xc3fa('0x1b'),_0x2625cf[_0xc3fa('0x18')],_0x2625cf[_0xc3fa('0x19')]));}else{logger[_0xc3fa('0x13')](util[_0xc3fa('0x1a')](_0xc3fa('0x1c'),_0x2625cf[_0xc3fa('0xe')]));}}function closeHandler(){logger[_0xc3fa('0x16')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc3fa('0x1d')],this['calleridname'],this[_0xc3fa('0x1e')],this[_0xc3fa('0x1f')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3fb311){logger[_0xc3fa('0x13')](_0x3fb311[_0xc3fa('0xe')]);}}function timeoutHandler(){logger[_0xc3fa('0x16')](util[_0xc3fa('0x1a')](_0xc3fa('0x20'),this[_0xc3fa('0x1d')],this[_0xc3fa('0x21')],this[_0xc3fa('0x1e')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xc3fa('0x16')](util[_0xc3fa('0x1a')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc3fa('0x1d')],this['calleridname'],this[_0xc3fa('0x1e')],this['dnid'],this[_0xc3fa('0x22')]));this['evtHangup']=!![];}function createSquareReport(_0x50db1a,_0x127985){rpc[_0xc3fa('0x23')](_0x50db1a)['then'](function(_0x36cec2){if(_0x127985){_0x127985(null,_0x36cec2);}})[_0xc3fa('0x24')](function(_0x42ec44){if(_0x127985){_0x127985(null,_0x42ec44);}});}function setChannelVariables(_0x13f95e){for(var _0xdd817a in _0x13f95e){if(_0x13f95e[_0xc3fa('0x25')](_0xdd817a)){if(_0xdd817a[_0xc3fa('0x26')](_0xc3fa('0x27'))===0x0){_0x13f95e[_0xdd817a[_0xc3fa('0x28')](0x4)]=_0x13f95e[_0xdd817a];delete _0x13f95e[_0xdd817a];}}}}function agiHandler(_0x17cfc2){logger[_0xc3fa('0x29')](_0xc3fa('0x2a'),JSON[_0xc3fa('0x2b')](_0x17cfc2,null,0x2));logger[_0xc3fa('0x16')](util[_0xc3fa('0x1a')](_0xc3fa('0x2c'),_0x17cfc2[_0xc3fa('0x1d')],_0x17cfc2[_0xc3fa('0x21')],_0x17cfc2[_0xc3fa('0x1e')],_0x17cfc2[_0xc3fa('0x1f')],_0x17cfc2[_0xc3fa('0x22')]));_0x17cfc2['on'](_0xc3fa('0x13'),errorHandler);_0x17cfc2['on'](_0xc3fa('0x2d'),closeHandler);_0x17cfc2['on'](_0xc3fa('0x2e'),timeoutHandler);_0x17cfc2['evtHangup']=![];_0x17cfc2['on'](_0xc3fa('0x2f'),hangupHandler);var _0x3b4a1a=_[_0xc3fa('0x30')](projects,[_0xc3fa('0x18'),_0x17cfc2[_0xc3fa('0x1d')]]);if(!_0x3b4a1a)return Project[_0xc3fa('0x31')](_0x17cfc2);if(!_0x3b4a1a[_0xc3fa('0x32')])return Project[_0xc3fa('0x33')](_0x17cfc2);return Project[_0xc3fa('0x34')](_0x3b4a1a,_0x17cfc2);}function main(){var _0x5d5fec;return utilLicense[_0xc3fa('0x35')]()['then'](function(_0xdab99){if(!_0xdab99)return;if(_0xdab99[_0xc3fa('0x36')]){if(_0xdab99[_0xc3fa('0x37')]&&_0xdab99[_0xc3fa('0x37')]>0x0){logger['info'](util[_0xc3fa('0x1a')](_0xc3fa('0x38'),_0xdab99[_0xc3fa('0x37')]));_0x5d5fec=_0xdab99[_0xc3fa('0x37')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xc3fa('0x16')](_0xc3fa('0x39'));_0x5d5fec=-0x1;}})[_0xc3fa('0x3a')](function(){return Project[_0xc3fa('0x3b')]();})[_0xc3fa('0x3a')](function(_0x13410a){projects=_0x13410a;return;})[_0xc3fa('0x24')](function(_0x2d5575){logger[_0xc3fa('0x13')]('[LICENSE]',_0x2d5575[_0xc3fa('0xe')]);})['finally'](function(){var _0x3356f0=require(_0xc3fa('0x3c'))(config['agi'][_0xc3fa('0x15')],config[_0xc3fa('0x5')]['ip'],_0x5d5fec);_0x3356f0['on']('error',errorHandler);_0x3356f0['on'](_0xc3fa('0x3d'),listeningHandler);_0x3356f0['on'](_0xc3fa('0x3e'),connectionHandler);_0x3356f0['on'](_0xc3fa('0x2d'),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 86824ec..2deadb1 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 _0x64cf=['then','error','message','result','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x3bb09f,_0x6871c9){var _0x337981=function(_0x1e6c19){while(--_0x1e6c19){_0x3bb09f['push'](_0x3bb09f['shift']());}};_0x337981(++_0x6871c9);}(_0x64cf,0xf5));var _0xf64c=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x64cf[_0x278e3c];return _0x3e2d9b;};'use strict';var BPromise=require(_0xf64c('0x0'));var jayson=require(_0xf64c('0x1'));var client=jayson[_0xf64c('0x2')]['http']({'port':0x232b});function request(_0x6849cc,_0x34271d){return new BPromise(function(_0x24aabb,_0x1690de){return client['request'](_0x6849cc,_0x34271d)[_0xf64c('0x3')](function(_0x40d4ce){if(_0x40d4ce[_0xf64c('0x4')]){return _0x1690de(_0x40d4ce['error'][_0xf64c('0x5')]);}else{return _0x24aabb(_0x40d4ce[_0xf64c('0x6')]);}})['catch'](function(_0x49a94a){return _0x1690de(_0x49a94a);});});}exports[_0xf64c('0x7')]=function(_0x598990,_0x5583d1){return request('SendMail',{'account':_0x598990,'message':_0x5583d1});}; \ No newline at end of file +var _0x404c=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','error'];(function(_0x5b2da5,_0x2743c2){var _0x1ea4d1=function(_0x9f8693){while(--_0x9f8693){_0x5b2da5['push'](_0x5b2da5['shift']());}};_0x1ea4d1(++_0x2743c2);}(_0x404c,0x8b));var _0xc404=function(_0x362138,_0x4b382c){_0x362138=_0x362138-0x0;var _0x5b6692=_0x404c[_0x362138];return _0x5b6692;};'use strict';var BPromise=require(_0xc404('0x0'));var jayson=require(_0xc404('0x1'));var client=jayson['client'][_0xc404('0x2')]({'port':0x232b});function request(_0x566d59,_0xdf289f){return new BPromise(function(_0x4155d4,_0x3a40bf){return client[_0xc404('0x3')](_0x566d59,_0xdf289f)['then'](function(_0x3a1df1){if(_0x3a1df1[_0xc404('0x4')]){return _0x3a40bf(_0x3a1df1[_0xc404('0x4')]['message']);}else{return _0x4155d4(_0x3a1df1[_0xc404('0x5')]);}})[_0xc404('0x6')](function(_0xd58e74){return _0x3a40bf(_0xd58e74);});});}exports[_0xc404('0x7')]=function(_0x304545,_0x2c5221){return request(_0xc404('0x8'),{'account':_0x304545,'message':_0x2c5221});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 9c95ecb..ddd6dea 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 _0x2b35=['traverseBFS','vertex','stringify','gotoc','context','extension','priority','agicommand','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','continueAt','Project\x20%s\x20not\x20found','close','lodash','moment','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','toJson','mxGraphModel','root','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid'];(function(_0x591f8c,_0x76e65f){var _0x5a631e=function(_0x5904e0){while(--_0x5904e0){_0x591f8c['push'](_0x591f8c['shift']());}};_0x5a631e(++_0x76e65f);}(_0x2b35,0x10c));var _0x52b3=function(_0x291e93,_0x19b7c2){_0x291e93=_0x291e93-0x0;var _0xc3b0ba=_0x2b35[_0x291e93];return _0xc3b0ba;};'use strict';var _=require(_0x52b3('0x0'));var moment=require(_0x52b3('0x1'));var parser=require(_0x52b3('0x2'));var util=require('util');var logger=require(_0x52b3('0x3'))(_0x52b3('0x4'));var rpc=require(_0x52b3('0x5'));var mailRpc=require(_0x52b3('0x6'));var Graph=require(_0x52b3('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x52b3('0x8')](function(_0x5e5fa5){logger[_0x52b3('0x9')](_0x52b3('0xa'),_0x5e5fa5[_0x52b3('0xb')]);return[];});}function addVertex(_0x4dfeb0,_0x1da602,_0x4751f4){_0x1da602['agicommand']=_0x4751f4;if(_0x1da602[_0x52b3('0xc')]('retry')){_0x1da602[_0x52b3('0xd')]=parseInt(_0x1da602[_0x52b3('0xe')],0xa);}_0x4dfeb0[_0x52b3('0xf')](_[_0x52b3('0x10')](_0x1da602,_0x52b3('0x11')));}function initGraph(_0x1fb517,_0x16bdd0){var _0xbde9a2=new Graph();for(var _0x3c7a42 in _0x1fb517){if(_0x1fb517[_0x52b3('0xc')](_0x3c7a42)){if(_[_0x52b3('0x12')](_0x1fb517[_0x3c7a42])){for(var _0x1aa5b9=0x0;_0x1aa5b9<_0x1fb517[_0x3c7a42][_0x52b3('0x13')];_0x1aa5b9+=0x1){addVertex(_0xbde9a2,_0x1fb517[_0x3c7a42][_0x1aa5b9],_0x3c7a42);}}else{addVertex(_0xbde9a2,_0x1fb517[_0x3c7a42],_0x3c7a42);}}}for(var _0x51a160=0x0;_0x51a160<_0x16bdd0[_0x52b3('0x13')];_0x51a160+=0x1){if(_0x16bdd0[_0x51a160][_0x52b3('0x14')]&&_0x16bdd0[_0x51a160]['target']){_0xbde9a2[_0x52b3('0x15')](_0x16bdd0[_0x51a160][_0x52b3('0x14')],_0x16bdd0[_0x51a160][_0x52b3('0x16')],_0x16bdd0[_0x51a160][_0x52b3('0x17')]);}}return _0xbde9a2;}function getRoot(_0x2b49e5){return parser[_0x52b3('0x18')](_0x2b49e5,{'object':!![]})[_0x52b3('0x19')][_0x52b3('0x1a')];}function inspect(_0x171bcb){return util['inspect'](_0x171bcb,{'showHidden':![],'depth':null});}function initialize(_0x7b930f,_0x33c97c){var _0x4b869b=getRoot(_0x7b930f['production']);if(!_0x4b869b||!_0x4b869b[_0x52b3('0x1b')])return;var _0x3ee8c2,_0x1c071e,_0x5dc5d5;logger[_0x52b3('0x1c')](_0x52b3('0x1a'),JSON['stringify'](_0x4b869b,null,0x2));_0x33c97c[_0x52b3('0x1d')]=moment()[_0x52b3('0x1e')](_0x52b3('0x1f'));_0x3ee8c2=initGraph(_['omit'](_0x4b869b,_0x52b3('0x11')),_0x4b869b['mxCell']);_0x1c071e=new Vertices(_0x33c97c,rpc,mailRpc);logger[_0x52b3('0x20')](util[_0x52b3('0x1e')](_0x52b3('0x21'),_0x33c97c['arg_1'],_0x33c97c['calleridname'],_0x33c97c[_0x52b3('0x22')],_0x33c97c[_0x52b3('0x23')],_0x33c97c[_0x52b3('0x24')]));_0x3ee8c2[_0x52b3('0x25')](_0x4b869b[_0x52b3('0x1b')]['id'],function(_0x138fde){try{_0x138fde=_0x1c071e['clear'](_0x138fde);logger[_0x52b3('0x1c')](_0x52b3('0x26'),JSON[_0x52b3('0x27')](_0x138fde,null,0x2));if(_0x138fde['agicommand']===_0x52b3('0x28')){logger[_0x52b3('0x20')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x33c97c['context']=_0x138fde[_0x52b3('0x29')]||_0x33c97c[_0x52b3('0x29')];_0x33c97c[_0x52b3('0x2a')]=_0x138fde['extension'];_0x33c97c[_0x52b3('0x2b')]=_0x138fde['priority']?_0x138fde['priority']-0x1:0x1;return null;}else if(_0x138fde&&_0x1c071e[_0x138fde[_0x52b3('0x2c')]]){_0x5dc5d5=_0x1c071e[_0x138fde[_0x52b3('0x2c')]](_0x138fde);logger[_0x52b3('0x20')]('response',JSON[_0x52b3('0x27')](_0x5dc5d5,null,0x2));if(_0x5dc5d5&&_0x5dc5d5[_0x52b3('0x2d')]===AGI_CODE_SUCCESS&&_0x5dc5d5[_0x52b3('0x2e')]!==AGI_RESULT_ERROR&&!_0x33c97c[_0x52b3('0x2f')]){logger[_0x52b3('0x1c')](_0x52b3('0x30'),inspect(_0x5dc5d5));return _[_0x52b3('0x31')](_0x5dc5d5[_0x52b3('0x2e')])?null:_0x5dc5d5[_0x52b3('0x2e')][_0x52b3('0x32')]();}else{logger['error'](_0x52b3('0x30'),inspect(_0x5dc5d5));return null;}}else{logger[_0x52b3('0x9')](_0x52b3('0x33'));return null;}}catch(_0x42950f){logger[_0x52b3('0x9')](_0x42950f[_0x52b3('0xb')]);return null;}});if(_0x4b869b[_0x52b3('0x34')]){logger[_0x52b3('0x20')](util[_0x52b3('0x1e')](_0x52b3('0x35'),_0x33c97c[_0x52b3('0x36')],_0x33c97c['calleridname'],_0x33c97c[_0x52b3('0x22')],_0x33c97c[_0x52b3('0x23')],_0x33c97c['uniqueid']));_0x3ee8c2[_0x52b3('0x25')](_0x4b869b[_0x52b3('0x34')]['id'],function(_0x4e7769){try{_0x4e7769=_0x1c071e[_0x52b3('0x37')](_0x4e7769);logger[_0x52b3('0x1c')](_0x52b3('0x26'),JSON[_0x52b3('0x27')](_0x4e7769,null,0x2));if(_0x4e7769&&_0x1c071e[_0x4e7769[_0x52b3('0x2c')]]){_0x5dc5d5=_0x1c071e[_0x4e7769[_0x52b3('0x2c')]](_0x4e7769);if(_0x5dc5d5){logger[_0x52b3('0x1c')]('response',inspect(_0x5dc5d5));return _[_0x52b3('0x31')](_0x5dc5d5[_0x52b3('0x2e')])?null:_0x5dc5d5[_0x52b3('0x2e')][_0x52b3('0x32')]();}else{logger[_0x52b3('0x9')](_0x52b3('0x30'),inspect(_0x5dc5d5));return null;}}else{logger[_0x52b3('0x9')](_0x52b3('0x33'));return null;}}catch(_0x2babef){logger[_0x52b3('0x9')](_0x2babef[_0x52b3('0xb')]);return null;}});}logger['info'](util[_0x52b3('0x1e')](_0x52b3('0x38'),_0x33c97c[_0x52b3('0x36')],_0x33c97c[_0x52b3('0x39')],_0x33c97c[_0x52b3('0x22')],_0x33c97c[_0x52b3('0x23')],_0x33c97c[_0x52b3('0x24')]));logger['info'](util[_0x52b3('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x33c97c[_0x52b3('0x29')],_0x33c97c[_0x52b3('0x2a')],parseInt(_0x33c97c[_0x52b3('0x2b')],0xa)+0x1));_0x33c97c[_0x52b3('0x3a')](_0x33c97c[_0x52b3('0x29')],_0x33c97c[_0x52b3('0x2a')],parseInt(_0x33c97c['priority'],0xa)+0x1);_0x33c97c['close']();}function handleNotFound(_0x1b01e5){logger['error'](util[_0x52b3('0x1e')](_0x52b3('0x3b'),_0x1b01e5[_0x52b3('0x36')]));_0x1b01e5[_0x52b3('0x3a')](_0x1b01e5[_0x52b3('0x29')],_0x1b01e5[_0x52b3('0x2a')],parseInt(_0x1b01e5['priority'],0xa)+0x1);_0x1b01e5[_0x52b3('0x3c')]();}function handleUnpublished(_0x4d3739){logger[_0x52b3('0x9')](util[_0x52b3('0x1e')]('Project\x20%s\x20not\x20published',_0x4d3739['arg_1']));_0x4d3739[_0x52b3('0x3a')](_0x4d3739['context'],_0x4d3739[_0x52b3('0x2a')],parseInt(_0x4d3739[_0x52b3('0x2b')],0xa)+0x1);_0x4d3739[_0x52b3('0x3c')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x9b31=['context','extension','priority','evtHangup','response','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','inspect','production','start','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','debug','vertex','stringify'];(function(_0x2ca5b7,_0x577247){var _0x52b00f=function(_0x4f749b){while(--_0x4f749b){_0x2ca5b7['push'](_0x2ca5b7['shift']());}};_0x52b00f(++_0x577247);}(_0x9b31,0x107));var _0x19b3=function(_0x326cc0,_0x1de5b4){_0x326cc0=_0x326cc0-0x0;var _0x5d7b6a=_0x9b31[_0x326cc0];return _0x5d7b6a;};'use strict';var _=require(_0x19b3('0x0'));var moment=require(_0x19b3('0x1'));var parser=require(_0x19b3('0x2'));var util=require('util');var logger=require('../../config/logger')('agi');var rpc=require(_0x19b3('0x3'));var mailRpc=require(_0x19b3('0x4'));var Graph=require('./graph');var Vertices=require(_0x19b3('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x19b3('0x6')]()[_0x19b3('0x7')](function(_0x20bee3){logger[_0x19b3('0x8')](_0x19b3('0x9'),_0x20bee3[_0x19b3('0xa')]);return[];});}function addVertex(_0x4da4df,_0x326aba,_0x5273c0){_0x326aba[_0x19b3('0xb')]=_0x5273c0;if(_0x326aba[_0x19b3('0xc')](_0x19b3('0xd'))){_0x326aba[_0x19b3('0xe')]=parseInt(_0x326aba[_0x19b3('0xd')],0xa);}_0x4da4df[_0x19b3('0xf')](_[_0x19b3('0x10')](_0x326aba,_0x19b3('0x11')));}function initGraph(_0x2a548e,_0x5ac80f){var _0x53e7c0=new Graph();for(var _0x48b3fb in _0x2a548e){if(_0x2a548e[_0x19b3('0xc')](_0x48b3fb)){if(_[_0x19b3('0x12')](_0x2a548e[_0x48b3fb])){for(var _0x49ddb8=0x0;_0x49ddb8<_0x2a548e[_0x48b3fb][_0x19b3('0x13')];_0x49ddb8+=0x1){addVertex(_0x53e7c0,_0x2a548e[_0x48b3fb][_0x49ddb8],_0x48b3fb);}}else{addVertex(_0x53e7c0,_0x2a548e[_0x48b3fb],_0x48b3fb);}}}for(var _0x2bfed7=0x0;_0x2bfed7<_0x5ac80f[_0x19b3('0x13')];_0x2bfed7+=0x1){if(_0x5ac80f[_0x2bfed7][_0x19b3('0x14')]&&_0x5ac80f[_0x2bfed7][_0x19b3('0x15')]){_0x53e7c0[_0x19b3('0x16')](_0x5ac80f[_0x2bfed7][_0x19b3('0x14')],_0x5ac80f[_0x2bfed7][_0x19b3('0x15')],_0x5ac80f[_0x2bfed7][_0x19b3('0x17')]);}}return _0x53e7c0;}function getRoot(_0x361eb5){return parser[_0x19b3('0x18')](_0x361eb5,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x5de94c){return util[_0x19b3('0x19')](_0x5de94c,{'showHidden':![],'depth':null});}function initialize(_0x25c93d,_0x50884f){var _0x149c15=getRoot(_0x25c93d[_0x19b3('0x1a')]);if(!_0x149c15||!_0x149c15[_0x19b3('0x1b')])return;var _0x3d7417,_0x345eb5,_0xe2c7be;logger['debug']('root',JSON['stringify'](_0x149c15,null,0x2));_0x50884f[_0x19b3('0x1c')]=moment()[_0x19b3('0x1d')](_0x19b3('0x1e'));_0x3d7417=initGraph(_[_0x19b3('0x10')](_0x149c15,_0x19b3('0x11')),_0x149c15['mxCell']);_0x345eb5=new Vertices(_0x50884f,rpc,mailRpc);logger[_0x19b3('0x1f')](util[_0x19b3('0x1d')](_0x19b3('0x20'),_0x50884f[_0x19b3('0x21')],_0x50884f[_0x19b3('0x22')],_0x50884f[_0x19b3('0x23')],_0x50884f['dnid'],_0x50884f[_0x19b3('0x24')]));_0x3d7417[_0x19b3('0x25')](_0x149c15['start']['id'],function(_0x3a05ad){try{_0x3a05ad=_0x345eb5[_0x19b3('0x26')](_0x3a05ad);logger[_0x19b3('0x27')](_0x19b3('0x28'),JSON[_0x19b3('0x29')](_0x3a05ad,null,0x2));if(_0x3a05ad[_0x19b3('0xb')]==='gotoc'){logger[_0x19b3('0x1f')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x50884f['context']=_0x3a05ad[_0x19b3('0x2a')]||_0x50884f[_0x19b3('0x2a')];_0x50884f[_0x19b3('0x2b')]=_0x3a05ad[_0x19b3('0x2b')];_0x50884f[_0x19b3('0x2c')]=_0x3a05ad[_0x19b3('0x2c')]?_0x3a05ad[_0x19b3('0x2c')]-0x1:0x1;return null;}else if(_0x3a05ad&&_0x345eb5[_0x3a05ad['agicommand']]){_0xe2c7be=_0x345eb5[_0x3a05ad['agicommand']](_0x3a05ad);logger[_0x19b3('0x1f')]('response',JSON['stringify'](_0xe2c7be,null,0x2));if(_0xe2c7be&&_0xe2c7be['code']===AGI_CODE_SUCCESS&&_0xe2c7be['result']!==AGI_RESULT_ERROR&&!_0x50884f[_0x19b3('0x2d')]){logger['debug'](_0x19b3('0x2e'),inspect(_0xe2c7be));return _[_0x19b3('0x2f')](_0xe2c7be[_0x19b3('0x30')])?null:_0xe2c7be['result']['toString']();}else{logger[_0x19b3('0x8')]('response',inspect(_0xe2c7be));return null;}}else{logger[_0x19b3('0x8')](_0x19b3('0x31'));return null;}}catch(_0x582ae2){logger[_0x19b3('0x8')](_0x582ae2[_0x19b3('0xa')]);return null;}});if(_0x149c15[_0x19b3('0x32')]){logger[_0x19b3('0x1f')](util[_0x19b3('0x1d')](_0x19b3('0x33'),_0x50884f[_0x19b3('0x21')],_0x50884f['calleridname'],_0x50884f[_0x19b3('0x23')],_0x50884f[_0x19b3('0x34')],_0x50884f[_0x19b3('0x24')]));_0x3d7417[_0x19b3('0x25')](_0x149c15[_0x19b3('0x32')]['id'],function(_0x34c81c){try{_0x34c81c=_0x345eb5[_0x19b3('0x26')](_0x34c81c);logger[_0x19b3('0x27')](_0x19b3('0x28'),JSON[_0x19b3('0x29')](_0x34c81c,null,0x2));if(_0x34c81c&&_0x345eb5[_0x34c81c['agicommand']]){_0xe2c7be=_0x345eb5[_0x34c81c[_0x19b3('0xb')]](_0x34c81c);if(_0xe2c7be){logger[_0x19b3('0x27')]('response',inspect(_0xe2c7be));return _[_0x19b3('0x2f')](_0xe2c7be[_0x19b3('0x30')])?null:_0xe2c7be[_0x19b3('0x30')][_0x19b3('0x35')]();}else{logger[_0x19b3('0x8')](_0x19b3('0x2e'),inspect(_0xe2c7be));return null;}}else{logger[_0x19b3('0x8')](_0x19b3('0x31'));return null;}}catch(_0x40777f){logger['error'](_0x40777f[_0x19b3('0xa')]);return null;}});}logger['info'](util[_0x19b3('0x1d')](_0x19b3('0x36'),_0x50884f['arg_1'],_0x50884f[_0x19b3('0x22')],_0x50884f['callerid'],_0x50884f[_0x19b3('0x34')],_0x50884f[_0x19b3('0x24')]));logger['info'](util[_0x19b3('0x1d')](_0x19b3('0x37'),_0x50884f[_0x19b3('0x2a')],_0x50884f['extension'],parseInt(_0x50884f['priority'],0xa)+0x1));_0x50884f[_0x19b3('0x38')](_0x50884f[_0x19b3('0x2a')],_0x50884f['extension'],parseInt(_0x50884f[_0x19b3('0x2c')],0xa)+0x1);_0x50884f[_0x19b3('0x39')]();}function handleNotFound(_0x5c30cc){logger[_0x19b3('0x8')](util[_0x19b3('0x1d')](_0x19b3('0x3a'),_0x5c30cc[_0x19b3('0x21')]));_0x5c30cc['continueAt'](_0x5c30cc[_0x19b3('0x2a')],_0x5c30cc[_0x19b3('0x2b')],parseInt(_0x5c30cc['priority'],0xa)+0x1);_0x5c30cc['close']();}function handleUnpublished(_0x593278){logger['error'](util['format'](_0x19b3('0x3b'),_0x593278['arg_1']));_0x593278['continueAt'](_0x593278[_0x19b3('0x2a')],_0x593278[_0x19b3('0x2b')],parseInt(_0x593278[_0x19b3('0x2c')],0xa)+0x1);_0x593278[_0x19b3('0x39')]();}module[_0x19b3('0x3c')]={'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 1a05cdf..0b9fbf2 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 _0xd876=['_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','headers','line','exports','util','stream','call'];(function(_0x53f444,_0x292969){var _0x160040=function(_0x347c14){while(--_0x347c14){_0x53f444['push'](_0x53f444['shift']());}};_0x160040(++_0x292969);}(_0xd876,0xed));var _0x6d87=function(_0x5c3636,_0x1a0364){_0x5c3636=_0x5c3636-0x0;var _0x9c53c9=_0xd876[_0x5c3636];return _0x9c53c9;};'use strict';var util=require(_0x6d87('0x0'));var Transform=require(_0x6d87('0x1'))['Transform'];function AGIReply(_0x201d35){Transform[_0x6d87('0x2')](this,_0x201d35);this[_0x6d87('0x3')]='';this[_0x6d87('0x4')]=![];}util[_0x6d87('0x5')](AGIReply,Transform);AGIReply[_0x6d87('0x6')][_0x6d87('0x7')]=function(_0x22bf97,_0x3309f4,_0x3b1fa3){var _0x500178='\x0a',_0x4c57b3=['\x0a\x0a',_0x6d87('0x8')],_0x3302b7=-0x1,_0x59382b=-0x1,_0x429cb2='',_0x4d40ba=0x0,_0x3eb752='',_0x451e82='';this[_0x6d87('0x3')]+=_0x22bf97[_0x6d87('0x9')]();_0x3eb752=this[_0x6d87('0x3')];if(!this[_0x6d87('0x4')]){_0x4d40ba=0x0;while(_0x4c57b3[_0x4d40ba]){while((_0x59382b=_0x3eb752['indexOf'](_0x4c57b3[_0x4d40ba]))!=-0x1){_0x429cb2=_0x4c57b3[_0x4d40ba];_0x451e82=_0x3eb752[_0x6d87('0xa')](0x0,_0x59382b);_0x3eb752=_0x3eb752[_0x6d87('0xa')](_0x59382b+_0x429cb2[_0x6d87('0xb')]);var _0x20bb09=_0x451e82[_0x6d87('0xc')](_0x500178),_0x343281=0x0,_0x591666={},_0x17693a='',_0x2783c4='',_0x2a52ed=-0x1;while(_0x20bb09[_0x343281]){_0x2a52ed=_0x20bb09[_0x343281][_0x6d87('0xd')](':');if(_0x2a52ed!=-0x1){_0x17693a=_0x20bb09[_0x343281]['slice'](0x0,_0x2a52ed)['trim']();_0x2783c4=_0x20bb09[_0x343281][_0x6d87('0xe')](_0x2a52ed+0x1)[_0x6d87('0xf')]();if(_0x17693a[_0x6d87('0xb')]>0x0){_0x591666[_0x17693a]=_0x2783c4;}}else{}_0x343281++;}this[_0x6d87('0x10')](_0x6d87('0x11'),_0x591666);this['_inBody']=!![];}_0x4d40ba++;}this['_localBuffer']=_0x3eb752;}else{while((_0x3302b7=_0x3eb752[_0x6d87('0xd')](_0x500178))!=-0x1){_0x451e82=_0x3eb752[_0x6d87('0xa')](0x0,_0x3302b7);this[_0x6d87('0x10')](_0x6d87('0x12'),_0x451e82);_0x3eb752=_0x3eb752[_0x6d87('0xa')](_0x3302b7+_0x500178[_0x6d87('0xb')]);}this[_0x6d87('0x3')]=_0x3eb752;}_0x3b1fa3();};module[_0x6d87('0x13')]=AGIReply; \ No newline at end of file +var _0xd485=['stream','Transform','call','prototype','_transform','_localBuffer','toString','_inBody','indexOf','substring','length','split','trim','slice','headers','emit','line','exports'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xd485,0x1e6));var _0x5d48=function(_0xa2de7a,_0x284322){_0xa2de7a=_0xa2de7a-0x0;var _0x182fed=_0xd485[_0xa2de7a];return _0x182fed;};'use strict';var util=require('util');var Transform=require(_0x5d48('0x0'))[_0x5d48('0x1')];function AGIReply(_0x2241da){Transform[_0x5d48('0x2')](this,_0x2241da);this['_localBuffer']='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x5d48('0x3')][_0x5d48('0x4')]=function(_0x4c1b75,_0x5a6d41,_0x597f97){var _0x5f3270='\x0a',_0x65b891=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3f2dfd=-0x1,_0x9c5b14=-0x1,_0x407e50='',_0x2718f8=0x0,_0x5d78dc='',_0x51f443='';this[_0x5d48('0x5')]+=_0x4c1b75[_0x5d48('0x6')]();_0x5d78dc=this[_0x5d48('0x5')];if(!this[_0x5d48('0x7')]){_0x2718f8=0x0;while(_0x65b891[_0x2718f8]){while((_0x9c5b14=_0x5d78dc[_0x5d48('0x8')](_0x65b891[_0x2718f8]))!=-0x1){_0x407e50=_0x65b891[_0x2718f8];_0x51f443=_0x5d78dc[_0x5d48('0x9')](0x0,_0x9c5b14);_0x5d78dc=_0x5d78dc[_0x5d48('0x9')](_0x9c5b14+_0x407e50[_0x5d48('0xa')]);var _0x4fba6d=_0x51f443[_0x5d48('0xb')](_0x5f3270),_0x64491d=0x0,_0x226517={},_0x349839='',_0x5d5755='',_0x3930ed=-0x1;while(_0x4fba6d[_0x64491d]){_0x3930ed=_0x4fba6d[_0x64491d][_0x5d48('0x8')](':');if(_0x3930ed!=-0x1){_0x349839=_0x4fba6d[_0x64491d]['slice'](0x0,_0x3930ed)[_0x5d48('0xc')]();_0x5d5755=_0x4fba6d[_0x64491d][_0x5d48('0xd')](_0x3930ed+0x1)['trim']();if(_0x349839[_0x5d48('0xa')]>0x0){_0x226517[_0x349839]=_0x5d5755;}}else{}_0x64491d++;}this['emit'](_0x5d48('0xe'),_0x226517);this[_0x5d48('0x7')]=!![];}_0x2718f8++;}this[_0x5d48('0x5')]=_0x5d78dc;}else{while((_0x3f2dfd=_0x5d78dc[_0x5d48('0x8')](_0x5f3270))!=-0x1){_0x51f443=_0x5d78dc[_0x5d48('0x9')](0x0,_0x3f2dfd);this[_0x5d48('0xf')](_0x5d48('0x10'),_0x51f443);_0x5d78dc=_0x5d78dc[_0x5d48('0x9')](_0x3f2dfd+_0x5f3270[_0x5d48('0xa')]);}this[_0x5d48('0x5')]=_0x5d78dc;}_0x597f97();};module[_0x5d48('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 5433d55..8b47ae7 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 _0x9585=['format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','agentLogin','PauseUser','agentUnpause','UnpauseUser','moment','client','http','request','then','error','message','result','catch','getSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_2'];(function(_0x54bc68,_0x2851aa){var _0x19faee=function(_0x40c088){while(--_0x40c088){_0x54bc68['push'](_0x54bc68['shift']());}};_0x19faee(++_0x2851aa);}(_0x9585,0x15e));var _0x5958=function(_0x27048a,_0x27efdf){_0x27048a=_0x27048a-0x0;var _0x36fd16=_0x9585[_0x27048a];return _0x36fd16;};'use strict';var _=require('lodash');var moment=require(_0x5958('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x5958('0x1')][_0x5958('0x2')]({'port':0x2329});function request(_0x384f6c,_0x1a8c5e){return new Promise(function(_0x35e63f,_0x1f8027){return client[_0x5958('0x3')](_0x384f6c,_0x1a8c5e)[_0x5958('0x4')](function(_0x4ced9f){if(_0x4ced9f[_0x5958('0x5')]){return _0x1f8027(_0x4ced9f['error'][_0x5958('0x6')]);}else{return _0x35e63f(_0x4ced9f[_0x5958('0x7')]);}})[_0x5958('0x8')](function(_0x5be2d9){return _0x1f8027(_0x5be2d9);});});}exports[_0x5958('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x5958('0xa'),_0x5958('0xb')]}});};exports['getSquareProject']=function(_0x506ad1){return request(_0x5958('0xc'),{'options':{'raw':![],'where':{'name':_0x506ad1},'attributes':[_0x5958('0xb')]}});};exports[_0x5958('0xd')]=function(_0x22967b){return request(_0x5958('0xe'),{'options':{'raw':![],'where':{'id':_0x22967b},'include':[{'model':'MailServerOut','as':_0x5958('0xf'),'include':[{'model':_0x5958('0x10'),'as':_0x5958('0x10')}]}],'attributes':['id',_0x5958('0xa'),_0x5958('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x564ec5){return request(_0x5958('0xc'),{'options':{'where':{'id':_0x564ec5},'attributes':[_0x5958('0xa')]}});};exports[_0x5958('0x12')]=function(_0x4b8c0a){return request(_0x5958('0x13'),{'options':{'where':{'id':_0x4b8c0a},'attributes':[_0x5958('0xa')]}});};exports[_0x5958('0x14')]=function(_0x254811){return request('ShowVariable',{'options':{'where':{'id':_0x254811},'attributes':[_0x5958('0xa')]}});};exports[_0x5958('0x15')]=function(_0x312ef1){return request(_0x5958('0x16'),{'options':{'where':{'id':_0x312ef1},'attributes':[_0x5958('0x17')]}});};exports[_0x5958('0x18')]=function(_0x5e9e97){return request(_0x5958('0x19'),{'options':{'where':{'id':_0x5e9e97},'attributes':[_0x5958('0xa')]}});};exports[_0x5958('0x1a')]=function(_0x26c29d){return request(_0x5958('0x1b'),{'options':{'where':{'phone':_0x26c29d['phone']},'attributes':['id']}});};exports[_0x5958('0x1c')]=function(_0x19000b){return request(_0x5958('0x1d'),{'options':{'where':{'id':_0x19000b},'attributes':[_0x5958('0xa')]}});};exports[_0x5958('0x1e')]=function(_0x50dbd2){return request(_0x5958('0x1f'),{'options':{'where':{'id':_0x50dbd2},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x220f33){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x220f33},'include':[{'model':_0x5958('0x20'),'as':_0x5958('0x21')}]}});};exports[_0x5958('0x22')]=function(_0x36ff66){return request(_0x5958('0x23'),{'options':{'where':{'id':_0x36ff66},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x5c5b8a){return request(_0x5958('0x24'),{'body':_0x5c5b8a});};exports[_0x5958('0x25')]=function(_0x14380c){return request(_0x5958('0x26'),{'body':_0x14380c});};exports['createSquareReport']=function(_0x10517c){return request(_0x5958('0x27'),{'body':_[_0x5958('0x28')](_0x10517c,{'project_name':_0x10517c['arg_1'],'prev_project_name':_0x10517c[_0x5958('0x29')]||'','is_subproject':_0x10517c[_0x5958('0x29')]?!![]:![],'leaveAt':moment()[_0x5958('0x2a')](_0x5958('0x2b'))})});};exports[_0x5958('0x2c')]=function(_0x2ca399){return request(_0x5958('0x2d'),{'body':_0x2ca399});};exports['createSquareMessage']=function(_0x58f39d){return request(_0x5958('0x2e'),{'body':_0x58f39d});};exports[_0x5958('0x2f')]=function(_0x45cd86){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x45cd86[_0x5958('0x30')],'ListId':_0x45cd86[_0x5958('0x31')]}}})[_0x5958('0x4')](function(_0x3145a7){if(_0x3145a7){return _0x3145a7;}return request(_0x5958('0x32'),{'body':_0x45cd86});});};exports[_0x5958('0x33')]=function(_0x2a020e){return request('ShowPause',{'options':{'where':{'id':_0x2a020e},'attributes':['name']}});};exports[_0x5958('0x34')]=function(_0x1b65d3,_0x1bcceb){return request('LoginUser',{'body':{'interface':_0x1bcceb},'options':{'where':_0x1b65d3}});};exports['agentPause']=function(_0x440737,_0x432326,_0x341653){return request(_0x5958('0x35'),{'body':{'type':_0x432326,'uniqueid':_0x341653},'options':{'where':_0x440737}});};exports[_0x5958('0x36')]=function(_0x39a6b0){return request(_0x5958('0x37'),{'body':{},'options':{'where':_0x39a6b0}});};exports['agentLogout']=function(_0x40653e){return request('LogoutUser',{'body':{},'options':{'where':_0x40653e}});}; \ No newline at end of file +var _0x165d=['email','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','message','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider'];(function(_0x2a5c78,_0x45ece5){var _0x5c5670=function(_0x3f733d){while(--_0x3f733d){_0x2a5c78['push'](_0x2a5c78['shift']());}};_0x5c5670(++_0x45ece5);}(_0x165d,0x14a));var _0xd165=function(_0x1e3aa5,_0x4cf704){_0x1e3aa5=_0x1e3aa5-0x0;var _0x3ea61e=_0x165d[_0x1e3aa5];return _0x3ea61e;};'use strict';var _=require(_0xd165('0x0'));var moment=require(_0xd165('0x1'));var jayson=require(_0xd165('0x2'));var client=jayson[_0xd165('0x3')][_0xd165('0x4')]({'port':0x2329});function request(_0x31af22,_0x43f2f9){return new Promise(function(_0x5a4d7c,_0x405ee0){return client[_0xd165('0x5')](_0x31af22,_0x43f2f9)['then'](function(_0x58acb6){if(_0x58acb6['error']){return _0x405ee0(_0x58acb6[_0xd165('0x6')][_0xd165('0x7')]);}else{return _0x5a4d7c(_0x58acb6['result']);}})['catch'](function(_0x3fd82e){return _0x405ee0(_0x3fd82e);});});}exports[_0xd165('0x8')]=function(){return request(_0xd165('0x9'),{'options':{'raw':![],'attributes':['id',_0xd165('0xa'),_0xd165('0xb')]}});};exports[_0xd165('0xc')]=function(_0x249052){return request(_0xd165('0xd'),{'options':{'raw':![],'where':{'name':_0x249052},'attributes':['production']}});};exports[_0xd165('0xe')]=function(_0x2a37a2){return request(_0xd165('0xf'),{'options':{'raw':![],'where':{'id':_0x2a37a2},'include':[{'model':'MailServerOut','as':_0xd165('0x10'),'include':[{'model':'CloudProvider','as':_0xd165('0x11')}]}],'attributes':['id',_0xd165('0xa'),_0xd165('0x12')],'smtp':!![]}});};exports[_0xd165('0x13')]=function(_0x5a46e8){return request('ShowSquareProject',{'options':{'where':{'id':_0x5a46e8},'attributes':[_0xd165('0xa')]}});};exports[_0xd165('0x14')]=function(_0x3e586a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x3e586a},'attributes':['name']}});};exports['getVariableById']=function(_0x693c9b){return request(_0xd165('0x15'),{'options':{'where':{'id':_0x693c9b},'attributes':['name']}});};exports[_0xd165('0x16')]=function(_0x1bbcb9){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1bbcb9},'attributes':['dsn']}});};exports[_0xd165('0x17')]=function(_0x30378f){return request('ShowUser',{'options':{'where':{'id':_0x30378f},'attributes':['name']}});};exports['getContactByPhone']=function(_0x529cc9){return request(_0xd165('0x18'),{'options':{'where':{'phone':_0x529cc9[_0xd165('0x19')]},'attributes':['id']}});};exports[_0xd165('0x1a')]=function(_0x7ed688){return request(_0xd165('0x1b'),{'options':{'where':{'id':_0x7ed688},'attributes':[_0xd165('0xa')]}});};exports[_0xd165('0x1c')]=function(_0xd5b5f6){return request(_0xd165('0x1d'),{'options':{'where':{'id':_0xd5b5f6},'attributes':['save_name']}});};exports[_0xd165('0x1e')]=function(_0x492257){return request(_0xd165('0x1f'),{'options':{'raw':![],'where':{'id':_0x492257},'include':[{'model':_0xd165('0x20'),'as':'Intervals'}]}});};exports[_0xd165('0x21')]=function(_0x3a3b5a){return request('ShowSmsAccount',{'options':{'where':{'id':_0x3a3b5a},'attributes':['id',_0xd165('0xa')]}});};exports[_0xd165('0x22')]=function(_0x26ae3b){return request('CreateSmsMessage',{'body':_0x26ae3b});};exports[_0xd165('0x23')]=function(_0x13f71b){return request(_0xd165('0x24'),{'body':_0x13f71b});};exports[_0xd165('0x25')]=function(_0x1a2b32){return request(_0xd165('0x26'),{'body':_['merge'](_0x1a2b32,{'project_name':_0x1a2b32[_0xd165('0x27')],'prev_project_name':_0x1a2b32[_0xd165('0x28')]||'','is_subproject':_0x1a2b32[_0xd165('0x28')]?!![]:![],'leaveAt':moment()[_0xd165('0x29')](_0xd165('0x2a'))})});};exports[_0xd165('0x2b')]=function(_0x134506){return request('CreateSquareRecording',{'body':_0x134506});};exports[_0xd165('0x2c')]=function(_0x5c5907){return request(_0xd165('0x2d'),{'body':_0x5c5907});};exports[_0xd165('0x2e')]=function(_0xeefe8){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xeefe8[_0xd165('0x19')],'ListId':_0xeefe8[_0xd165('0x2f')]}}})[_0xd165('0x30')](function(_0x38f4d3){if(_0x38f4d3){return _0x38f4d3;}return request('CreateCmContact',{'body':_0xeefe8});});};exports[_0xd165('0x31')]=function(_0x2b4b62){return request(_0xd165('0x32'),{'options':{'where':{'id':_0x2b4b62},'attributes':[_0xd165('0xa')]}});};exports[_0xd165('0x33')]=function(_0x4235af,_0x4e4c62){return request(_0xd165('0x34'),{'body':{'interface':_0x4e4c62},'options':{'where':_0x4235af}});};exports[_0xd165('0x35')]=function(_0x4becdf,_0x191a82,_0x120c8d){return request(_0xd165('0x36'),{'body':{'type':_0x191a82,'uniqueid':_0x120c8d},'options':{'where':_0x4becdf}});};exports[_0xd165('0x37')]=function(_0x3090d9){return request(_0xd165('0x38'),{'body':{},'options':{'where':_0x3090d9}});};exports['agentLogout']=function(_0x51f38d){return request(_0xd165('0x39'),{'body':{},'options':{'where':_0x51f38d}});}; \ 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 cd12907..9698cee 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 _0xe3da=['./lex','exports','./polly'];(function(_0x19eefb,_0x1c6597){var _0x37f9cc=function(_0x517365){while(--_0x517365){_0x19eefb['push'](_0x19eefb['shift']());}};_0x37f9cc(++_0x1c6597);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};var polly=require(_0xae3d('0x0'));var lex=require(_0xae3d('0x1'));module[_0xae3d('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x96f1=['exports','./polly','./lex'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x96f1,0x19c));var _0x196f=function(_0x4134f9,_0xb72988){_0x4134f9=_0x4134f9-0x0;var _0x3989a8=_0x96f1[_0x4134f9];return _0x3989a8;};var polly=require(_0x196f('0x0'));var lex=require(_0x196f('0x1'));module[_0x196f('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 8ceab69..9a8e279 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 _0x6f7a=['./lib/api','exports'];(function(_0x892cf4,_0x110634){var _0x200631=function(_0x19b613){while(--_0x19b613){_0x892cf4['push'](_0x892cf4['shift']());}};_0x200631(++_0x110634);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x473c3a,_0x17c020){_0x473c3a=_0x473c3a-0x0;var _0x8a2ee=_0x6f7a[_0x473c3a];return _0x8a2ee;};'use strict';var lex=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]=function(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8){return lex(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8);}; \ No newline at end of file +var _0x9bde=['exports'];(function(_0x3c0ac7,_0x2e9624){var _0x37687f=function(_0x1999a0){while(--_0x1999a0){_0x3c0ac7['push'](_0x3c0ac7['shift']());}};_0x37687f(++_0x2e9624);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3e3e25,_0x287147){_0x3e3e25=_0x3e3e25-0x0;var _0x53e7c8=_0x9bde[_0x3e3e25];return _0x53e7c8;};'use strict';var lex=require('./lib/api');module[_0xe9bd('0x0')]=function(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a){return lex(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a);}; \ 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 451cab3..2c2b380 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(_0xbc4ea0,_0x173113){var _0x15ddfa=function(_0x19aed5){while(--_0x19aed5){_0xbc4ea0['push'](_0xbc4ea0['shift']());}};_0x15ddfa(++_0x173113);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x3a3a26,_0x12784b){var _0x2940f3=function(_0x39279a){while(--_0x39279a){_0x3a3a26['push'](_0x3a3a26['shift']());}};_0x2940f3(++_0x12784b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 55a2834..eb4b655 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. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x2edf7c,_0x1c9a5d,_0xfb1527,_0x32eaeb,_0x2c0d42,_0x44b516,_0xa4dec4){return polly(_0x2edf7c,_0x1c9a5d,_0xfb1527,_0x32eaeb,_0x2c0d42,_0x44b516,_0xa4dec4);}; \ No newline at end of file +var _0x7f04=['./lib/api'];(function(_0x428a3a,_0x481236){var _0x2a0ef1=function(_0x2a95d5){while(--_0x2a95d5){_0x428a3a['push'](_0x428a3a['shift']());}};_0x2a0ef1(++_0x481236);}(_0x7f04,0x107));var _0x47f0=function(_0x11c221,_0x65c6a5){_0x11c221=_0x11c221-0x0;var _0x26deef=_0x7f04[_0x11c221];return _0x26deef;};'use strict';var polly=require(_0x47f0('0x0'));module['exports']=function(_0x1c2805,_0x508376,_0x42d728,_0x509c05,_0x37a949,_0x1fc30f,_0x5df588){return polly(_0x1c2805,_0x508376,_0x42d728,_0x509c05,_0x37a949,_0x1fc30f,_0x5df588);}; \ 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 85b6c16..9a03e6d 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 _0xeab0=['randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeab0,0x76));var _0x0eab=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xeab0[_0x17b6e3];return _0x3906f3;};'use strict';var fs=require('fs');var path=require(_0x0eab('0x0'));var BPromise=require(_0x0eab('0x1'));var rs=require(_0x0eab('0x2'));var AWS=require(_0x0eab('0x3'));function pollyResult(_0x2670a4,_0x2c2653,_0x578741){return new BPromise(function(_0x60539d,_0x5a3fd6){_0x2670a4['synthesizeSpeech'](_0x2c2653,function(_0x58614e,_0x278c70){if(_0x58614e){_0x5a3fd6(_0x58614e);}else if(_0x278c70){if(_0x278c70[_0x0eab('0x4')]instanceof Buffer){fs[_0x0eab('0x5')](_0x578741,_0x278c70[_0x0eab('0x4')],function(_0x402f80){if(_0x402f80){_0x5a3fd6(_0x402f80);}else{_0x60539d();}});}else{_0x5a3fd6(new Error(_0x0eab('0x6')));}}else{_0x5a3fd6(new Error(_0x0eab('0x7')));}});});}module[_0x0eab('0x8')]=function(_0x5617c1,_0xf0ed2c,_0x4971b1,_0x303889,_0x503007,_0x2b6b85,_0x59309d){var _0xcfed1e=new AWS['Polly']({'accessKeyId':_0x5617c1,'secretAccessKey':_0xf0ed2c,'region':_0x4971b1});var _0x4ca10a={'Text':_0x503007,'TextType':_0x2b6b85||'text','OutputFormat':_0x0eab('0x9'),'VoiceId':_0x303889};return pollyResult(_0xcfed1e,_0x4ca10a,_0x59309d);}; \ No newline at end of file +var _0xc7d5=['bluebird','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0x148d11,_0x49c0c3){var _0x300a7a=function(_0x427f32){while(--_0x427f32){_0x148d11['push'](_0x148d11['shift']());}};_0x300a7a(++_0x49c0c3);}(_0xc7d5,0x19e));var _0x5c7d=function(_0x4e4197,_0x2113fa){_0x4e4197=_0x4e4197-0x0;var _0x155f96=_0xc7d5[_0x4e4197];return _0x155f96;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5c7d('0x0'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x3a1c00,_0xb06b26,_0x136471){return new BPromise(function(_0x10d2f6,_0x13d1c9){_0x3a1c00['synthesizeSpeech'](_0xb06b26,function(_0x2f0bff,_0xccbd19){if(_0x2f0bff){_0x13d1c9(_0x2f0bff);}else if(_0xccbd19){if(_0xccbd19[_0x5c7d('0x1')]instanceof Buffer){fs[_0x5c7d('0x2')](_0x136471,_0xccbd19['AudioStream'],function(_0x41be5c){if(_0x41be5c){_0x13d1c9(_0x41be5c);}else{_0x10d2f6();}});}else{_0x13d1c9(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x13d1c9(new Error(_0x5c7d('0x3')));}});});}module[_0x5c7d('0x4')]=function(_0x5eec68,_0x2d35a5,_0x5d1433,_0x1bcb51,_0x363691,_0x19c8b6,_0x4a086a){var _0x4a7445=new AWS['Polly']({'accessKeyId':_0x5eec68,'secretAccessKey':_0x2d35a5,'region':_0x5d1433});var _0x2bb808={'Text':_0x363691,'TextType':_0x19c8b6||_0x5c7d('0x5'),'OutputFormat':'mp3','VoiceId':_0x1bcb51};return pollyResult(_0x4a7445,_0x2bb808,_0x4a086a);}; \ 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 397a977..9e333e4 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 _0xe2de=['./lib/api'];(function(_0x2b7fd3,_0x17556d){var _0x1bd260=function(_0x5d82dd){while(--_0x5d82dd){_0x2b7fd3['push'](_0x2b7fd3['shift']());}};_0x1bd260(++_0x17556d);}(_0xe2de,0x140));var _0xee2d=function(_0x45f803,_0xc17e11){_0x45f803=_0x45f803-0x0;var _0x156de2=_0xe2de[_0x45f803];return _0x156de2;};'use strict';var asr=require(_0xee2d('0x0'));module['exports']=function(_0x363864,_0x1ce9ae,_0x4f7f0b,_0x364080){return asr(_0x363864,_0x1ce9ae,_0x4f7f0b);}; \ No newline at end of file +var _0x266b=['./lib/api','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x266b,0x64));var _0xb266=function(_0xfa6620,_0xa935b4){_0xfa6620=_0xfa6620-0x0;var _0x242a11=_0x266b[_0xfa6620];return _0x242a11;};'use strict';var asr=require(_0xb266('0x0'));module[_0xb266('0x1')]=function(_0x2e389b,_0x6dd1ed,_0x53394b,_0x19c7d5){return asr(_0x2e389b,_0x6dd1ed,_0x53394b);}; \ 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 2610215..9434c1b 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 _0x688a=['filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length'];(function(_0x3184be,_0x37975e){var _0x33597c=function(_0x3e8735){while(--_0x3e8735){_0x3184be['push'](_0x3184be['shift']());}};_0x33597c(++_0x37975e);}(_0x688a,0x124));var _0xa688=function(_0x476fbc,_0x1c2503){_0x476fbc=_0x476fbc-0x0;var _0x325d59=_0x688a[_0x476fbc];return _0x325d59;};'use strict';var url=require(_0xa688('0x0'));var BPromise=require(_0xa688('0x1'));var fs=require('fs');var host=_0xa688('0x2');module['exports']=function(_0x43356d,_0x53646f,_0x27bb04){return new BPromise(function(_0x7a3442,_0x517509){var _0x4a9122;if(typeof _0x43356d!==_0xa688('0x3')||_0x43356d[_0xa688('0x4')]===0x0){return _0x517509(_0xa688('0x5'));}if(typeof _0x53646f!==_0xa688('0x3')||_0x53646f[_0xa688('0x4')]===0x0){return _0x517509('key\x20should\x20be\x20a\x20string');}if(typeof _0x27bb04!=='undefined'&&(typeof _0x27bb04!==_0xa688('0x3')||_0x27bb04[_0xa688('0x4')]===0x0)){return _0x517509(_0xa688('0x6'));}try{_0x4a9122=fs['readFileSync'](_0x43356d)['toString'](_0xa688('0x7'));}catch(_0x5ce966){return _0x517509(_0x5ce966);}return _0x7a3442({'method':'POST','uri':host+_0xa688('0x8')+_0x53646f,'body':{'config':{'encoding':_0xa688('0x9'),'sampleRateHertz':_0xa688('0xa'),'languageCode':_0x27bb04},'audio':{'content':_0x4a9122}},'json':!![]});});}; \ No newline at end of file +var _0x7764=['bluebird','https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x1f39c0,_0x1b9760){var _0x212b2f=function(_0x2b1410){while(--_0x2b1410){_0x1f39c0['push'](_0x1f39c0['shift']());}};_0x212b2f(++_0x1b9760);}(_0x7764,0xa4));var _0x4776=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0x7764[_0x4854d6];return _0x3885c0;};'use strict';var url=require(_0x4776('0x0'));var BPromise=require(_0x4776('0x1'));var fs=require('fs');var host=_0x4776('0x2');module[_0x4776('0x3')]=function(_0x90273,_0x2ab0a9,_0x4638e9){return new BPromise(function(_0x424a79,_0x3b28ba){var _0x1f5638;if(typeof _0x90273!=='string'||_0x90273['length']===0x0){return _0x3b28ba(_0x4776('0x4'));}if(typeof _0x2ab0a9!==_0x4776('0x5')||_0x2ab0a9['length']===0x0){return _0x3b28ba(_0x4776('0x6'));}if(typeof _0x4638e9!==_0x4776('0x7')&&(typeof _0x4638e9!=='string'||_0x4638e9['length']===0x0)){return _0x3b28ba(_0x4776('0x8'));}try{_0x1f5638=fs['readFileSync'](_0x90273)[_0x4776('0x9')](_0x4776('0xa'));}catch(_0x2ea7b1){return _0x3b28ba(_0x2ea7b1);}return _0x424a79({'method':_0x4776('0xb'),'uri':host+_0x4776('0xc')+_0x2ab0a9,'body':{'config':{'encoding':_0x4776('0xd'),'sampleRateHertz':_0x4776('0xe'),'languageCode':_0x4638e9},'audio':{'content':_0x1f5638}},'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 0592a14..70aac44 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 _0x05ec=['exports','./asr'];(function(_0x412938,_0x55000a){var _0x49b5b1=function(_0x2f6fa2){while(--_0x2f6fa2){_0x412938['push'](_0x412938['shift']());}};_0x49b5b1(++_0x55000a);}(_0x05ec,0x1d1));var _0xc05e=function(_0xc8a6c,_0x1f46eb){_0xc8a6c=_0xc8a6c-0x0;var _0x119c12=_0x05ec[_0xc8a6c];return _0x119c12;};var asr=require(_0xc05e('0x0'));module[_0xc05e('0x1')]={'asr':asr}; \ No newline at end of file +var _0x36e7=['exports'];(function(_0x3717a0,_0x5f00c3){var _0x5a03ae=function(_0xdce66d){while(--_0xdce66d){_0x3717a0['push'](_0x3717a0['shift']());}};_0x5a03ae(++_0x5f00c3);}(_0x36e7,0x1a8));var _0x736e=function(_0x474700,_0x249df7){_0x474700=_0x474700-0x0;var _0x4f0c6e=_0x36e7[_0x474700];return _0x4f0c6e;};var asr=require('./asr');module[_0x736e('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 8b370eb..ce8090a 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 _0x7734=['audioConfig','MP3','text:synthesize','POST','.mp3','from','writeFile','chmodSync','tmp','unlink','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','textRequest','stringify','result','source','actionIncomplete','fulfillment','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','close','error','pipe','end','protocol','host','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','base64','then','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7734,0xe5));var _0x4773=function(_0x54a54a,_0x419220){_0x54a54a=_0x54a54a-0x0;var _0x2e7d09=_0x7734[_0x54a54a];return _0x2e7d09;};'use strict';var apiai=require(_0x4773('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x4773('0x1'));var https=require(_0x4773('0x2'));var md5=require(_0x4773('0x3'));var path=require(_0x4773('0x4'));var querystring=require(_0x4773('0x5'));var rp=require(_0x4773('0x6'));var rs=require(_0x4773('0x7'));var sox=require(_0x4773('0x8'));var tts=require(_0x4773('0x9'));var urlParse=require(_0x4773('0xa'))[_0x4773('0xb')];var util=require(_0x4773('0xc'));var aws=require(_0x4773('0xd'));var google=require(_0x4773('0xe'));var sestek=require(_0x4773('0xf'));var tilde=require('./tilde');var logger=require(_0x4773('0x10'))(_0x4773('0x11'));var ISPEECH_API=_0x4773('0x12');function downloadFile(_0xbf2a4,_0x132ebf){return new BPromise(function(_0x5803d9,_0x4f8f4f){var _0x2535d5=urlParse(_0xbf2a4);var _0x570389=_0x2535d5['protocol']===_0x4773('0x13')?https:http;var _0x4db3b7={'host':_0x2535d5['host'],'path':_0x2535d5[_0x4773('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x570389[_0x4773('0x14')](_0x4db3b7,function(_0x206ff2){if(_0x206ff2['statusCode']!==0xc8){logger['error'](_0x4773('0x15')+_0xbf2a4+_0x4773('0x16')+_0x206ff2[_0x4773('0x17')]+'\x20('+_0x206ff2['statusMessage']+')');_0x4f8f4f(new Error(_0x4773('0x15')+_0xbf2a4+_0x4773('0x16')+_0x206ff2[_0x4773('0x17')]+'\x20('+_0x206ff2[_0x4773('0x18')]+')'));return;}var _0x10c12a=fs[_0x4773('0x19')](_0x132ebf);_0x10c12a['on'](_0x4773('0x1a'),function(){logger[_0x4773('0x1b')]('finish\x20download\x20file');_0x10c12a[_0x4773('0x1c')](_0x5803d9);});_0x10c12a['on']('error',function(_0x2a389f){fs['unlink'](_0x132ebf);logger[_0x4773('0x1d')]('download\x20error',_0x2a389f);_0x4f8f4f(_0x2a389f);});_0x206ff2[_0x4773('0x1e')](_0x10c12a);})['on'](_0x4773('0x1d'),function(_0x1ad331){logger[_0x4773('0x1d')](_0x1ad331);_0x4f8f4f(_0x1ad331);})[_0x4773('0x1f')]();});}function uploadFile(_0x708294){return new BPromise(function(_0xd47f92,_0x4c0a4d){var _0x2fe3cb=urlParse(_0x708294);var _0x33f8b9=_0x2fe3cb[_0x4773('0x20')]==='https:'?https:http;var _0x2d043f={'host':_0x2fe3cb[_0x4773('0x21')],'path':_0x2fe3cb['path'],'headers':{'user-agent':_0x4773('0x22')}};_0x33f8b9[_0x4773('0x14')](_0x2d043f,function(_0x5574ac){if(_0x5574ac['statusCode']!==0xc8){_0x4c0a4d(new Error(_0x4773('0x15')+_0x708294+_0x4773('0x16')+_0x5574ac[_0x4773('0x17')]+'\x20('+_0x5574ac[_0x4773('0x18')]+')'));return;}var _0x55da37='';_0x5574ac['on'](_0x4773('0x23'),function(_0x7927a6){_0x55da37+=_0x7927a6;});_0x5574ac['on']('end',function(){_0xd47f92(_0x55da37);});})['on'](_0x4773('0x1d'),function(_0x48bdb6){_0x4c0a4d(_0x48bdb6);})[_0x4773('0x1f')]();});}function convertFile(_0x51e283,_0x244f22){return new BPromise(function(_0x5d4715,_0x65eca0){var _0x90e52d=sox[_0x4773('0x24')](_0x51e283,_0x244f22,{'sampleRate':0x1f40,'format':_0x4773('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x90e52d['on'](_0x4773('0x1d'),function(_0x19b5b3){logger[_0x4773('0x1d')](_0x4773('0x26'),_0x19b5b3);_0x65eca0(_0x19b5b3);});_0x90e52d['on'](_0x4773('0x1f'),function(){logger[_0x4773('0x1b')](_0x4773('0x27'));_0x5d4715();});_0x90e52d[_0x4773('0x28')]();});}function base64Decode(_0x31339e,_0x1e3a17){var _0xd4c2e2=path[_0x4773('0x29')](__dirname,'tmp',rs[_0x4773('0x2a')](0x4)+_0x4773('0x2b'));fs['writeFileSync'](_0xd4c2e2,_0x31339e,_0x4773('0x2c'));return convertFile(_0xd4c2e2,_0x1e3a17)[_0x4773('0x2d')](function(){try{fs['unlink'](_0xd4c2e2);fs['chmodSync'](_0x1e3a17,_0x4773('0x2e'));}catch(_0x384d4a){logger[_0x4773('0x1d')](_0x384d4a);}return _0x1e3a17[_0x4773('0x2f')]('.')[0x0];});}function base64Encode(_0x3fe576){var _0x7fef81=fs['readFileSync'](_0x3fe576);return new Buffer(_0x7fef81)[_0x4773('0x30')](_0x4773('0x2c'));}exports[_0x4773('0x31')]=function(_0x117625,_0x52453d,_0x85269a,_0x1aaba0,_0x567dea,_0x3c62ad){var _0x40c7b1,_0x4460d3;var _0x29d00f=_0x4773('0x32');var _0x5bdeaf=_0x4773('0x33')+_0x117625;var _0x448f50={};if(_0x52453d===_0x4773('0x34')){_0x448f50[_0x4773('0x35')]={'ssml':_0x85269a};}else{_0x448f50['input']={'text':_0x85269a};};_0x448f50[_0x4773('0x36')]={'languageCode':_0x1aaba0,'ssmlGender':_0x567dea};_0x448f50[_0x4773('0x37')]={'audioEncoding':_0x4773('0x38'),'sampleRateHertz':0x1f40};var _0x27735e={'url':_0x29d00f+_0x4773('0x39')+_0x5bdeaf,'method':_0x4773('0x3a'),'json':!![],'body':_0x448f50};return rp(_0x27735e)['then'](function(_0x2be722){return new BPromise(function(_0x33dd55,_0x59a33e){_0x40c7b1=path['resolve'](__dirname,'tmp',rs[_0x4773('0x2a')](0x4)+_0x4773('0x3b'));var _0x197a73=Buffer[_0x4773('0x3c')](_0x2be722['audioContent'],_0x4773('0x2c'));return fs[_0x4773('0x3d')](_0x40c7b1,_0x197a73,function(_0x4a833b){_0x59a33e(_0x4a833b);},function(_0x5aba37){fs[_0x4773('0x3e')](_0x40c7b1,_0x4773('0x2e'));_0x33dd55(_0x5aba37);});});})[_0x4773('0x2d')](function(_0x40c691){_0x4460d3=path['resolve'](__dirname,_0x4773('0x3f'),rs[_0x4773('0x2a')](0x4)+'.wav');return convertFile(_0x40c7b1,_0x4460d3);})[_0x4773('0x2d')](function(){try{fs[_0x4773('0x40')](_0x40c7b1);fs[_0x4773('0x3e')](_0x4460d3,_0x4773('0x2e'));}catch(_0x4558f2){logger[_0x4773('0x1d')](_0x4558f2);}logger['info'](_0x4773('0x41'),_0x4460d3[_0x4773('0x2f')]('.')[0x0]);return _0x4460d3[_0x4773('0x2f')]('.')[0x0];});};exports[_0x4773('0x42')]=function(_0x5e1b87,_0x6e5b7){var _0x422a4e=_0x4773('0x43');var _0x5a01d0,_0xf4a288;var _0x7b45db;var _0x4f0257={'encoding':_0x4773('0x44'),'method':_0x4773('0x3a'),'timeout':0x2710,'url':_0x422a4e,'headers':{'Content-Type':_0x4773('0x45')},'body':_0x4773('0x46')+encodeURIComponent(JSON['stringify']([[[_0x4773('0x47'),JSON['stringify']([_0x5e1b87,_0x6e5b7||'en',![],_0x4773('0x48')]),null,'generic']]]))};return rp(_0x4f0257)[_0x4773('0x2d')](function(_0x49ce51){try{_0x7b45db=eval(_0x49ce51[_0x4773('0x49')](0x5))[0x0][0x2];}catch(_0x4f35a6){throw new Error(_0x4773('0x4a')+_0x49ce51[_0x4773('0x23')]);}if(!_0x7b45db){if(_0x5e1b87[_0x4773('0x4b')]>0xc8){throw new Error(_0x4773('0x4c'));}else{throw new Error('lang\x20\x22'+_0x6e5b7+_0x4773('0x4d'));}}try{_0x7b45db=eval(_0x7b45db)[0x0];}catch(_0xe4530d){throw new Error(_0x4773('0x4a')+res[_0x4773('0x23')]);}const _0x2ee324=_0x7b45db;_0x5a01d0=path[_0x4773('0x29')](__dirname,'tmp',rs[_0x4773('0x2a')](0x4)+'.mp3');fs[_0x4773('0x4e')](_0x5a01d0,_0x7b45db,{'encoding':_0x4773('0x2c')});_0xf4a288=path['resolve'](__dirname,_0x4773('0x3f'),rs['generate'](0x4)+'.wav');return convertFile(_0x5a01d0,_0xf4a288);})[_0x4773('0x2d')](function(){try{fs[_0x4773('0x40')](_0x5a01d0);fs[_0x4773('0x3e')](_0xf4a288,_0x4773('0x2e'));}catch(_0x324f1a){logger['error'](_0x324f1a);}logger[_0x4773('0x1b')](_0x4773('0x4f'),_0xf4a288[_0x4773('0x2f')]('.')[0x0]);return _0xf4a288[_0x4773('0x2f')]('.')[0x0];});};exports[_0x4773('0x50')]=function(_0x48594f,_0x24b2d3,_0xe9a999){return google[_0x4773('0x51')](_0x48594f,_0x24b2d3,_0xe9a999)[_0x4773('0x2d')](function(_0x396a90){logger[_0x4773('0x1b')](_0x396a90[_0x4773('0x52')]);return rp(_0x396a90);})[_0x4773('0x2d')](function(_0x53ecf8){var _0x525a0d='';var _0x11ac92=0x0;try{fs[_0x4773('0x40')](_0x48594f);}catch(_0x33ea33){logger[_0x4773('0x1d')](_0x33ea33);}if(_0x53ecf8&&_0x53ecf8[_0x4773('0x53')]){_0x525a0d=_0x53ecf8[_0x4773('0x53')][_0x4773('0x54')](function(_0x37eb97){return _0x37eb97&&_0x37eb97[_0x4773('0x55')][0x0]&&_0x37eb97[_0x4773('0x55')][0x0][_0x4773('0x56')]?_0x37eb97['alternatives'][0x0][_0x4773('0x56')]:'';})[_0x4773('0x57')]('\x0a');_0x11ac92=_0x53ecf8[_0x4773('0x53')][_0x4773('0x54')](function(_0xeed37){return _0xeed37&&_0xeed37['alternatives'][0x0]&&_0xeed37['alternatives'][0x0]['confidence']?_0xeed37['alternatives'][0x0][_0x4773('0x58')]:0x0;})[_0x4773('0x57')]('\x0a');}logger[_0x4773('0x1b')](_0x4773('0x59'),_0x525a0d);logger['info'](_0x4773('0x5a'),_0x11ac92);return{'transcript':_0x525a0d,'confidence':_0x11ac92};})[_0x4773('0x5b')](function(_0xf5c95e){logger['error'](_0x4773('0x5c'),_0xf5c95e[_0x4773('0x17')],_0xf5c95e[_0x4773('0x5d')],_0xf5c95e['message']);});};exports['googleDialogflow']=function(_0x3f0c7b,_0x41c6f6,_0x24250b,_0x32e228){var _0x5b3866=apiai(_0x41c6f6,{'language':_0x32e228||'en'});return _0x5b3866[_0x4773('0x5e')](_0x24250b,{'sessionId':md5(_0x3f0c7b)})[_0x4773('0x2d')](function(_0x54b9e7){logger[_0x4773('0x1b')](JSON[_0x4773('0x5f')](_0x54b9e7));return{'source':_0x54b9e7[_0x4773('0x60')][_0x4773('0x61')],'resolvedQuery':_0x54b9e7[_0x4773('0x60')]['resolvedQuery'],'action':_0x54b9e7[_0x4773('0x60')]['action'],'actionIncomplete':_0x54b9e7[_0x4773('0x60')][_0x4773('0x62')],'speech':_0x54b9e7[_0x4773('0x60')][_0x4773('0x63')][_0x4773('0x64')],'score':_0x54b9e7['result']['score'],'statusCode':_0x54b9e7['status'][_0x4773('0x65')],'endConversation':_0x54b9e7[_0x4773('0x60')][_0x4773('0x66')][_0x4773('0x67')]||![],'isFallbackIntent':_0x54b9e7[_0x4773('0x60')][_0x4773('0x66')][_0x4773('0x68')]};});};exports[_0x4773('0x69')]=function(_0x3427d9,_0x1904fe,_0x5ee319,_0x32081d,_0x170239,_0x1eaca3){var _0x27cde9=_0x32081d['replace'](/\\n/g,'\x0a');var _0x37b051={'credentials':{'private_key':_0x27cde9,'client_email':_0x5ee319}};var _0x50e64f=new dialogflow[(_0x4773('0x6a'))](_0x37b051);var _0x23733d=_0x50e64f[_0x4773('0x6b')](_0x1904fe,md5(_0x3427d9));var _0x3bd0bf={'session':_0x23733d,'queryInput':{'text':{'text':_0x170239,'languageCode':_0x1eaca3}}};return _0x50e64f[_0x4773('0x6c')](_0x3bd0bf)[_0x4773('0x2d')](function(_0x1957a2){if(_0x1957a2&&_0x1957a2['length']){logger[_0x4773('0x1b')](_0x4773('0x6d'),JSON[_0x4773('0x5f')](_0x1957a2));var _0x162f81=_0x1957a2[0x0];if(_0x162f81){var _0xac3c1={'action':_0x162f81[_0x4773('0x6e')][_0x4773('0x6f')],'allRequiredParamsPresent':_0x162f81[_0x4773('0x6e')]['allRequiredParamsPresent'],'endConversation':_0x162f81[_0x4773('0x6e')][_0x4773('0x70')]&&_0x162f81[_0x4773('0x6e')][_0x4773('0x70')][_0x4773('0x71')]?_0x162f81['queryResult'][_0x4773('0x70')][_0x4773('0x71')][_0x4773('0x72')][_0x4773('0x73')]:![],'fulfillmentText':_0x162f81[_0x4773('0x6e')]['fulfillmentText'],'intentName':_0x162f81[_0x4773('0x6e')]['intent'][_0x4773('0x5d')],'intentDisplayName':_0x162f81[_0x4773('0x6e')][_0x4773('0x74')][_0x4773('0x75')],'isFallbackIntent':_0x162f81[_0x4773('0x6e')][_0x4773('0x74')][_0x4773('0x76')],'languageCode':_0x162f81['queryResult'][_0x4773('0x77')],'queryText':_0x162f81[_0x4773('0x6e')][_0x4773('0x78')],'responseId':_0x162f81['responseId'],'score':_0x162f81[_0x4773('0x6e')][_0x4773('0x79')],'speech':_0x162f81[_0x4773('0x6e')]['fulfillmentText'],'providerResponse':JSON[_0x4773('0x5f')](_0x1957a2)};return _0xac3c1;}}});};exports['tildeASR']=function(_0xe0a83f,_0x4e602c,_0x3d1beb,_0x3b1e15){return tilde['asr'](_0xe0a83f,_0x4e602c,_0x3d1beb,_0x3b1e15)[_0x4773('0x2d')](function(_0x2c17f7){try{fs['unlink'](_0xe0a83f);}catch(_0x57663b){logger['error'](_0x57663b);}logger['info'](_0x4773('0x7a'),_0x2c17f7[_0x4773('0x56')]);logger[_0x4773('0x1b')](_0x4773('0x7b'),_0x2c17f7[_0x4773('0x58')]);return _0x2c17f7;});};exports[_0x4773('0x7c')]=function(_0x24ed07,_0x29719f,_0x8e3a9f,_0x438b8f,_0x42d4db,_0x5cd540){var _0x1c0898=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x5ece13;return aws['polly'](_0x24ed07,_0x29719f,_0x8e3a9f,_0x438b8f,_0x42d4db,_0x5cd540,_0x1c0898)[_0x4773('0x2d')](function(){_0x5ece13=path[_0x4773('0x29')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x1c0898,_0x5ece13);})[_0x4773('0x2d')](function(){try{fs[_0x4773('0x40')](_0x1c0898);fs['chmodSync'](_0x5ece13,_0x4773('0x2e'));}catch(_0x3738f4){logger['error'](_0x3738f4);}return _0x5ece13[_0x4773('0x2f')]('.')[0x0];});};exports[_0x4773('0x7d')]=function(_0x45e97e,_0x2d1059,_0x56e20a,_0x1308a5,_0x513440,_0x2f2742){return aws['lex'](_0x45e97e,_0x2d1059,_0x56e20a,_0x1308a5,_0x513440,_0x2f2742)[_0x4773('0x2d')](function(_0x33295c){logger[_0x4773('0x1b')](JSON[_0x4773('0x5f')](_0x33295c));return _0x33295c;});};exports[_0x4773('0x7e')]=function(_0x59303d,_0x5a4d81,_0x2f8022,_0x2c3255){var _0x5ce942=util['format'](_0x4773('0x7f'),ISPEECH_API,_0x59303d,encodeURIComponent(_0x5a4d81),_0x2f8022,_0x2c3255);var _0x550a9e=path['resolve'](__dirname,_0x4773('0x3f'),rs[_0x4773('0x2a')](0x4)+_0x4773('0x3b'));var _0x164322;return downloadFile(_0x5ce942,_0x550a9e)[_0x4773('0x2d')](function(){_0x164322=path[_0x4773('0x29')](__dirname,_0x4773('0x3f'),rs[_0x4773('0x2a')](0x4)+_0x4773('0x2b'));return convertFile(_0x550a9e,_0x164322);})[_0x4773('0x2d')](function(){try{fs[_0x4773('0x40')](_0x550a9e);fs[_0x4773('0x3e')](_0x164322,_0x4773('0x2e'));}catch(_0x5ca57c){logger[_0x4773('0x1d')](_0x5ca57c);}return _0x164322[_0x4773('0x2f')]('.')[0x0];});};exports[_0x4773('0x80')]=function(_0x2a54f1,_0x2a7d5c,_0x2ec3df,_0x2d80e4){var _0x21db0b=util[_0x4773('0x81')](_0x4773('0x82'),ISPEECH_API,_0x2a7d5c,_0x2ec3df,base64Encode(_0x2a54f1),_0x2d80e4?util['format'](_0x4773('0x83'),encodeURIComponent(_0x2d80e4)):_0x4773('0x84'));return uploadFile(_0x21db0b)['then'](function(_0x11c1a2){return querystring[_0x4773('0xb')](_0x11c1a2);});};exports[_0x4773('0x85')]=function(_0x1e5509,_0x5ef9de){return sestek['nda'](_0x1e5509,_0x5ef9de)[_0x4773('0x2d')](function(_0x2f8cd7){logger['info'](JSON[_0x4773('0x5f')](_0x2f8cd7));var _0x429bf7={'speech':_0x2f8cd7[_0x4773('0x86')],'action':_0x2f8cd7[_0x4773('0x87')]?_0x2f8cd7[_0x4773('0x87')][_0x4773('0x88')]:undefined,'actiondata':_0x2f8cd7[_0x4773('0x87')]?_0x2f8cd7['channelData'][_0x4773('0x89')]:undefined};if(_0x2f8cd7[_0x4773('0x87')]&&_0x2f8cd7[_0x4773('0x87')][_0x4773('0x8a')]){return base64Decode(_0x2f8cd7['channelData'][_0x4773('0x8a')][_0x4773('0x8b')],path[_0x4773('0x29')](__dirname,_0x4773('0x3f'),rs[_0x4773('0x2a')](0x4)+_0x4773('0x2b')))[_0x4773('0x2d')](function(_0x1508cb){_0x429bf7[_0x4773('0x8c')]=_0x1508cb;return _0x429bf7;});}return _0x429bf7;});};exports[_0x4773('0x8d')]=function(){return __dirname;}; \ No newline at end of file +var _0x8262=['source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','score','status','endConversation','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','error','statusCode','statusMessage','request\x20to\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','\x20failed,\x20status\x20code\x20=\x20','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','then','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','join','map','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','textRequest'];(function(_0x3de277,_0x45066){var _0x41938a=function(_0xfa0e7d){while(--_0xfa0e7d){_0x3de277['push'](_0x3de277['shift']());}};_0x41938a(++_0x45066);}(_0x8262,0xb8));var _0x2826=function(_0xf6e15,_0x21684f){_0xf6e15=_0xf6e15-0x0;var _0x2ff1d6=_0x8262[_0xf6e15];return _0x2ff1d6;};'use strict';var apiai=require(_0x2826('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x2826('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x2826('0x2'));var md5=require(_0x2826('0x3'));var path=require(_0x2826('0x4'));var querystring=require(_0x2826('0x5'));var rp=require(_0x2826('0x6'));var rs=require(_0x2826('0x7'));var sox=require(_0x2826('0x8'));var tts=require(_0x2826('0x9'));var urlParse=require('url')[_0x2826('0xa')];var util=require('util');var aws=require(_0x2826('0xb'));var google=require(_0x2826('0xc'));var sestek=require(_0x2826('0xd'));var tilde=require(_0x2826('0xe'));var logger=require(_0x2826('0xf'))(_0x2826('0x10'));var ISPEECH_API=_0x2826('0x11');function downloadFile(_0x435841,_0x44b0b1){return new BPromise(function(_0x447f01,_0x179846){var _0x47bd75=urlParse(_0x435841);var _0x189896=_0x47bd75[_0x2826('0x12')]===_0x2826('0x13')?https:http;var _0x35dda0={'host':_0x47bd75['host'],'path':_0x47bd75[_0x2826('0x4')],'headers':{'user-agent':_0x2826('0x14')}};_0x189896[_0x2826('0x15')](_0x35dda0,function(_0x6a36d4){if(_0x6a36d4['statusCode']!==0xc8){logger[_0x2826('0x16')]('request\x20to\x20'+_0x435841+'\x20failed,\x20status\x20code\x20=\x20'+_0x6a36d4[_0x2826('0x17')]+'\x20('+_0x6a36d4[_0x2826('0x18')]+')');_0x179846(new Error(_0x2826('0x19')+_0x435841+'\x20failed,\x20status\x20code\x20=\x20'+_0x6a36d4[_0x2826('0x17')]+'\x20('+_0x6a36d4[_0x2826('0x18')]+')'));return;}var _0x2a610f=fs['createWriteStream'](_0x44b0b1);_0x2a610f['on'](_0x2826('0x1a'),function(){logger[_0x2826('0x1b')](_0x2826('0x1c'));_0x2a610f[_0x2826('0x1d')](_0x447f01);});_0x2a610f['on'](_0x2826('0x16'),function(_0x135dd0){fs[_0x2826('0x1e')](_0x44b0b1);logger[_0x2826('0x16')](_0x2826('0x1f'),_0x135dd0);_0x179846(_0x135dd0);});_0x6a36d4[_0x2826('0x20')](_0x2a610f);})['on']('error',function(_0x1823f7){logger[_0x2826('0x16')](_0x1823f7);_0x179846(_0x1823f7);})[_0x2826('0x21')]();});}function uploadFile(_0x46264f){return new BPromise(function(_0x4b4767,_0x383b94){var _0x455e7e=urlParse(_0x46264f);var _0x1a0593=_0x455e7e[_0x2826('0x12')]===_0x2826('0x13')?https:http;var _0x89866e={'host':_0x455e7e['host'],'path':_0x455e7e['path'],'headers':{'user-agent':_0x2826('0x14')}};_0x1a0593[_0x2826('0x15')](_0x89866e,function(_0x12f03b){if(_0x12f03b[_0x2826('0x17')]!==0xc8){_0x383b94(new Error(_0x2826('0x19')+_0x46264f+_0x2826('0x22')+_0x12f03b[_0x2826('0x17')]+'\x20('+_0x12f03b[_0x2826('0x18')]+')'));return;}var _0x2ff3d1='';_0x12f03b['on'](_0x2826('0x23'),function(_0x21c8e5){_0x2ff3d1+=_0x21c8e5;});_0x12f03b['on'](_0x2826('0x21'),function(){_0x4b4767(_0x2ff3d1);});})['on'](_0x2826('0x16'),function(_0x9582e8){_0x383b94(_0x9582e8);})[_0x2826('0x21')]();});}function convertFile(_0x1324eb,_0x358007){return new BPromise(function(_0x4a1737,_0x5a3501){var _0x5efbe1=sox['transcode'](_0x1324eb,_0x358007,{'sampleRate':0x1f40,'format':_0x2826('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5efbe1['on'](_0x2826('0x16'),function(_0x481e06){logger[_0x2826('0x16')](_0x2826('0x25'),_0x481e06);_0x5a3501(_0x481e06);});_0x5efbe1['on']('end',function(){logger[_0x2826('0x1b')](_0x2826('0x26'));_0x4a1737();});_0x5efbe1[_0x2826('0x27')]();});}function base64Decode(_0x584713,_0x578f8a){var _0x2650e9=path[_0x2826('0x28')](__dirname,_0x2826('0x29'),rs[_0x2826('0x2a')](0x4)+_0x2826('0x2b'));fs[_0x2826('0x2c')](_0x2650e9,_0x584713,_0x2826('0x2d'));return convertFile(_0x2650e9,_0x578f8a)['then'](function(){try{fs['unlink'](_0x2650e9);fs[_0x2826('0x2e')](_0x578f8a,_0x2826('0x2f'));}catch(_0x16712b){logger[_0x2826('0x16')](_0x16712b);}return _0x578f8a[_0x2826('0x30')]('.')[0x0];});}function base64Encode(_0x2a347b){var _0x40ceda=fs[_0x2826('0x31')](_0x2a347b);return new Buffer(_0x40ceda)[_0x2826('0x32')](_0x2826('0x2d'));}exports[_0x2826('0x33')]=function(_0x1f1fcb,_0x3e7a2c,_0x24a5dc,_0x597ad5,_0xad438a,_0x1f0d75){var _0x325b42,_0x10bd64;var _0x2db638=_0x2826('0x34');var _0x2f1fc0='?key='+_0x1f1fcb;var _0x4914c8={};if(_0x3e7a2c===_0x2826('0x35')){_0x4914c8['input']={'ssml':_0x24a5dc};}else{_0x4914c8[_0x2826('0x36')]={'text':_0x24a5dc};};_0x4914c8[_0x2826('0x37')]={'languageCode':_0x597ad5,'ssmlGender':_0xad438a};_0x4914c8[_0x2826('0x38')]={'audioEncoding':_0x2826('0x39'),'sampleRateHertz':0x1f40};var _0x132dcd={'url':_0x2db638+'text:synthesize'+_0x2f1fc0,'method':_0x2826('0x3a'),'json':!![],'body':_0x4914c8};return rp(_0x132dcd)[_0x2826('0x3b')](function(_0x162af3){return new BPromise(function(_0x20eea4,_0x37ca06){_0x325b42=path[_0x2826('0x28')](__dirname,_0x2826('0x29'),rs['generate'](0x4)+'.mp3');var _0x385e85=Buffer[_0x2826('0x3c')](_0x162af3[_0x2826('0x3d')],_0x2826('0x2d'));return fs[_0x2826('0x3e')](_0x325b42,_0x385e85,function(_0x4e3f72){_0x37ca06(_0x4e3f72);},function(_0x752cfa){fs['chmodSync'](_0x325b42,_0x2826('0x2f'));_0x20eea4(_0x752cfa);});});})[_0x2826('0x3b')](function(_0x5651e4){_0x10bd64=path['resolve'](__dirname,_0x2826('0x29'),rs[_0x2826('0x2a')](0x4)+_0x2826('0x2b'));return convertFile(_0x325b42,_0x10bd64);})[_0x2826('0x3b')](function(){try{fs[_0x2826('0x1e')](_0x325b42);fs['chmodSync'](_0x10bd64,'777');}catch(_0x3a9be0){logger['error'](_0x3a9be0);}logger[_0x2826('0x1b')](_0x2826('0x3f'),_0x10bd64[_0x2826('0x30')]('.')[0x0]);return _0x10bd64['split']('.')[0x0];});};exports[_0x2826('0x40')]=function(_0xeb74c3,_0x4e2758){var _0x42aff9=_0x2826('0x41');var _0x36f638,_0x220409;var _0x1b4f6c;var _0x4a1b6e={'encoding':'utf8','method':_0x2826('0x3a'),'timeout':0x2710,'url':_0x42aff9,'headers':{'Content-Type':_0x2826('0x42')},'body':_0x2826('0x43')+encodeURIComponent(JSON[_0x2826('0x44')]([[[_0x2826('0x45'),JSON[_0x2826('0x44')]([_0xeb74c3,_0x4e2758||'en',![],_0x2826('0x46')]),null,_0x2826('0x47')]]]))};return rp(_0x4a1b6e)[_0x2826('0x3b')](function(_0x190248){try{_0x1b4f6c=eval(_0x190248['slice'](0x5))[0x0][0x2];}catch(_0x34c7be){throw new Error(_0x2826('0x48')+_0x190248[_0x2826('0x23')]);}if(!_0x1b4f6c){if(_0xeb74c3['length']>0xc8){throw new Error(_0x2826('0x49'));}else{throw new Error(_0x2826('0x4a')+_0x4e2758+_0x2826('0x4b'));}}try{_0x1b4f6c=eval(_0x1b4f6c)[0x0];}catch(_0x3366ca){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2826('0x23')]);}const _0x110386=_0x1b4f6c;_0x36f638=path[_0x2826('0x28')](__dirname,_0x2826('0x29'),rs['generate'](0x4)+_0x2826('0x4c'));fs[_0x2826('0x2c')](_0x36f638,_0x1b4f6c,{'encoding':_0x2826('0x2d')});_0x220409=path[_0x2826('0x28')](__dirname,_0x2826('0x29'),rs[_0x2826('0x2a')](0x4)+_0x2826('0x2b'));return convertFile(_0x36f638,_0x220409);})[_0x2826('0x3b')](function(){try{fs[_0x2826('0x1e')](_0x36f638);fs[_0x2826('0x2e')](_0x220409,_0x2826('0x2f'));}catch(_0x335aa4){logger[_0x2826('0x16')](_0x335aa4);}logger[_0x2826('0x1b')](_0x2826('0x4d'),_0x220409['split']('.')[0x0]);return _0x220409[_0x2826('0x30')]('.')[0x0];});};exports[_0x2826('0x4e')]=function(_0x204056,_0x440c01,_0x52e57b){return google[_0x2826('0x4f')](_0x204056,_0x440c01,_0x52e57b)['then'](function(_0x3c9956){logger[_0x2826('0x1b')](_0x3c9956[_0x2826('0x50')]);return rp(_0x3c9956);})[_0x2826('0x3b')](function(_0x2b1fe1){var _0x8452f6='';var _0x5c5e83=0x0;try{fs[_0x2826('0x1e')](_0x204056);}catch(_0x472f25){logger[_0x2826('0x16')](_0x472f25);}if(_0x2b1fe1&&_0x2b1fe1[_0x2826('0x51')]){_0x8452f6=_0x2b1fe1[_0x2826('0x51')]['map'](function(_0x32e5a8){return _0x32e5a8&&_0x32e5a8[_0x2826('0x52')][0x0]&&_0x32e5a8[_0x2826('0x52')][0x0]['transcript']?_0x32e5a8[_0x2826('0x52')][0x0]['transcript']:'';})[_0x2826('0x53')]('\x0a');_0x5c5e83=_0x2b1fe1[_0x2826('0x51')][_0x2826('0x54')](function(_0x5aeaca){return _0x5aeaca&&_0x5aeaca[_0x2826('0x52')][0x0]&&_0x5aeaca[_0x2826('0x52')][0x0][_0x2826('0x55')]?_0x5aeaca[_0x2826('0x52')][0x0][_0x2826('0x55')]:0x0;})[_0x2826('0x53')]('\x0a');}logger[_0x2826('0x1b')](_0x2826('0x56'),_0x8452f6);logger[_0x2826('0x1b')]('googleASR\x20confidence',_0x5c5e83);return{'transcript':_0x8452f6,'confidence':_0x5c5e83};})['catch'](function(_0x18ce59){logger[_0x2826('0x16')](_0x2826('0x57'),_0x18ce59[_0x2826('0x17')],_0x18ce59[_0x2826('0x58')],_0x18ce59['message']);});};exports['googleDialogflow']=function(_0x51a5fe,_0x1fa3c2,_0x12f046,_0x271daf){var _0x3eaf4e=apiai(_0x1fa3c2,{'language':_0x271daf||'en'});return _0x3eaf4e[_0x2826('0x59')](_0x12f046,{'sessionId':md5(_0x51a5fe)})[_0x2826('0x3b')](function(_0x59e259){logger[_0x2826('0x1b')](JSON[_0x2826('0x44')](_0x59e259));return{'source':_0x59e259['result'][_0x2826('0x5a')],'resolvedQuery':_0x59e259['result'][_0x2826('0x5b')],'action':_0x59e259[_0x2826('0x5c')][_0x2826('0x5d')],'actionIncomplete':_0x59e259['result'][_0x2826('0x5e')],'speech':_0x59e259[_0x2826('0x5c')][_0x2826('0x5f')][_0x2826('0x60')],'score':_0x59e259[_0x2826('0x5c')][_0x2826('0x61')],'statusCode':_0x59e259[_0x2826('0x62')]['code'],'endConversation':_0x59e259[_0x2826('0x5c')]['metadata'][_0x2826('0x63')]||![],'isFallbackIntent':_0x59e259[_0x2826('0x5c')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x295dc5,_0x58adcd,_0x1e56d1,_0x5bdf76,_0x9f5da3,_0x4cbbc3){var _0x243389=_0x5bdf76[_0x2826('0x64')](/\\n/g,'\x0a');var _0x946d43={'credentials':{'private_key':_0x243389,'client_email':_0x1e56d1}};var _0x1a3ba4=new dialogflow[(_0x2826('0x65'))](_0x946d43);var _0x3284f3=_0x1a3ba4[_0x2826('0x66')](_0x58adcd,md5(_0x295dc5));var _0xbfdd24={'session':_0x3284f3,'queryInput':{'text':{'text':_0x9f5da3,'languageCode':_0x4cbbc3}}};return _0x1a3ba4[_0x2826('0x67')](_0xbfdd24)[_0x2826('0x3b')](function(_0x50fa0d){if(_0x50fa0d&&_0x50fa0d['length']){logger[_0x2826('0x1b')](_0x2826('0x68'),JSON[_0x2826('0x44')](_0x50fa0d));var _0x594fa2=_0x50fa0d[0x0];if(_0x594fa2){var _0x26ea48={'action':_0x594fa2[_0x2826('0x69')][_0x2826('0x5d')],'allRequiredParamsPresent':_0x594fa2['queryResult']['allRequiredParamsPresent'],'endConversation':_0x594fa2[_0x2826('0x69')]['diagnosticInfo']&&_0x594fa2['queryResult'][_0x2826('0x6a')][_0x2826('0x6b')]?_0x594fa2[_0x2826('0x69')][_0x2826('0x6a')]['fields']['end_conversation'][_0x2826('0x6c')]:![],'fulfillmentText':_0x594fa2[_0x2826('0x69')][_0x2826('0x6d')],'intentName':_0x594fa2['queryResult'][_0x2826('0x6e')][_0x2826('0x58')],'intentDisplayName':_0x594fa2[_0x2826('0x69')]['intent'][_0x2826('0x6f')],'isFallbackIntent':_0x594fa2[_0x2826('0x69')][_0x2826('0x6e')][_0x2826('0x70')],'languageCode':_0x594fa2[_0x2826('0x69')]['languageCode'],'queryText':_0x594fa2['queryResult'][_0x2826('0x71')],'responseId':_0x594fa2[_0x2826('0x72')],'score':_0x594fa2[_0x2826('0x69')][_0x2826('0x73')],'speech':_0x594fa2[_0x2826('0x69')][_0x2826('0x6d')],'providerResponse':JSON[_0x2826('0x44')](_0x50fa0d)};return _0x26ea48;}}});};exports[_0x2826('0x74')]=function(_0x138e74,_0x3060e4,_0x28045a,_0x41aecb){return tilde[_0x2826('0x4f')](_0x138e74,_0x3060e4,_0x28045a,_0x41aecb)[_0x2826('0x3b')](function(_0x4ccd7d){try{fs['unlink'](_0x138e74);}catch(_0x524ef9){logger[_0x2826('0x16')](_0x524ef9);}logger[_0x2826('0x1b')](_0x2826('0x75'),_0x4ccd7d[_0x2826('0x76')]);logger[_0x2826('0x1b')](_0x2826('0x77'),_0x4ccd7d[_0x2826('0x55')]);return _0x4ccd7d;});};exports[_0x2826('0x78')]=function(_0x514ec4,_0x29b4b3,_0x2cfa60,_0x2ed1f8,_0x128556,_0x239305){var _0x26fe95=path['resolve'](__dirname,_0x2826('0x29'),rs[_0x2826('0x2a')](0x4)+'.mp3');var _0x146e44;return aws[_0x2826('0x79')](_0x514ec4,_0x29b4b3,_0x2cfa60,_0x2ed1f8,_0x128556,_0x239305,_0x26fe95)['then'](function(){_0x146e44=path[_0x2826('0x28')](__dirname,_0x2826('0x29'),rs[_0x2826('0x2a')](0x4)+_0x2826('0x2b'));return convertFile(_0x26fe95,_0x146e44);})['then'](function(){try{fs[_0x2826('0x1e')](_0x26fe95);fs[_0x2826('0x2e')](_0x146e44,_0x2826('0x2f'));}catch(_0x224eec){logger[_0x2826('0x16')](_0x224eec);}return _0x146e44[_0x2826('0x30')]('.')[0x0];});};exports[_0x2826('0x7a')]=function(_0x32d80c,_0x3fc0c2,_0x492217,_0x1244ad,_0xf7440d,_0x39560a){return aws[_0x2826('0x7b')](_0x32d80c,_0x3fc0c2,_0x492217,_0x1244ad,_0xf7440d,_0x39560a)[_0x2826('0x3b')](function(_0x5bc099){logger[_0x2826('0x1b')](JSON[_0x2826('0x44')](_0x5bc099));return _0x5bc099;});};exports['ispeechTTS']=function(_0x22d620,_0x52c1fd,_0x59f892,_0x5c3a82){var _0x285519=util['format'](_0x2826('0x7c'),ISPEECH_API,_0x22d620,encodeURIComponent(_0x52c1fd),_0x59f892,_0x5c3a82);var _0x2b0023=path[_0x2826('0x28')](__dirname,_0x2826('0x29'),rs[_0x2826('0x2a')](0x4)+_0x2826('0x4c'));var _0x493f7b;return downloadFile(_0x285519,_0x2b0023)['then'](function(){_0x493f7b=path[_0x2826('0x28')](__dirname,_0x2826('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x2b0023,_0x493f7b);})[_0x2826('0x3b')](function(){try{fs['unlink'](_0x2b0023);fs[_0x2826('0x2e')](_0x493f7b,_0x2826('0x2f'));}catch(_0x5e98db){logger[_0x2826('0x16')](_0x5e98db);}return _0x493f7b[_0x2826('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0x29fc50,_0xd99142,_0x46b686,_0x1b847c){var _0x55eae=util[_0x2826('0x7d')](_0x2826('0x7e'),ISPEECH_API,_0xd99142,_0x46b686,base64Encode(_0x29fc50),_0x1b847c?util['format']('model=%s',encodeURIComponent(_0x1b847c)):_0x2826('0x7f'));return uploadFile(_0x55eae)[_0x2826('0x3b')](function(_0x2c3c74){return querystring[_0x2826('0xa')](_0x2c3c74);});};exports[_0x2826('0x80')]=function(_0x425baf,_0x82308e){return sestek['nda'](_0x425baf,_0x82308e)[_0x2826('0x3b')](function(_0x3162c5){logger[_0x2826('0x1b')](JSON['stringify'](_0x3162c5));var _0x44bc67={'speech':_0x3162c5[_0x2826('0x81')],'action':_0x3162c5[_0x2826('0x82')]?_0x3162c5['channelData'][_0x2826('0x83')]:undefined,'actiondata':_0x3162c5[_0x2826('0x82')]?_0x3162c5[_0x2826('0x82')][_0x2826('0x84')]:undefined};if(_0x3162c5['channelData']&&_0x3162c5[_0x2826('0x82')][_0x2826('0x85')]){return base64Decode(_0x3162c5[_0x2826('0x82')][_0x2826('0x85')][_0x2826('0x86')],path[_0x2826('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x2826('0x2b')))[_0x2826('0x3b')](function(_0x16b495){_0x44bc67[_0x2826('0x87')]=_0x16b495;return _0x44bc67;});}return _0x44bc67;});};exports[_0x2826('0x88')]=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 04952a5..e8b4223 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 _0x89c0=['exports'];(function(_0xe3b521,_0x315427){var _0x12b60c=function(_0x2c9f6b){while(--_0x2c9f6b){_0xe3b521['push'](_0xe3b521['shift']());}};_0x12b60c(++_0x315427);}(_0x89c0,0xef));var _0x089c=function(_0x1997b6,_0x750746){_0x1997b6=_0x1997b6-0x0;var _0x40d5c2=_0x89c0[_0x1997b6];return _0x40d5c2;};var nda=require('./nda');module[_0x089c('0x0')]={'nda':nda}; \ No newline at end of file +var _0x9855=['exports','./nda'];(function(_0x501654,_0x52730c){var _0x2640ef=function(_0x43e948){while(--_0x43e948){_0x501654['push'](_0x501654['shift']());}};_0x2640ef(++_0x52730c);}(_0x9855,0x125));var _0x5985=function(_0x26c76e,_0x43951d){_0x26c76e=_0x26c76e-0x0;var _0x5b1166=_0x9855[_0x26c76e];return _0x5b1166;};var nda=require(_0x5985('0x0'));module[_0x5985('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 9835583..bc7c5b6 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 _0x33a1=['custom_action','CustomAction','custom_action_data','info','request-promise','url','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','uniqueid','callerid','calleridname','dnid','extension','access_token','channelData','ProjectName','ndagenerate_audio','body'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x33a1,0x7c));var _0x133a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33a1[_0x2c91e9];return _0x13f0ff;};'use strict';var rp=require(_0x133a('0x0'));var url=require(_0x133a('0x1'));var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0x4bcb17,_0x2d6f40){var _0x212a37={'method':_0x133a('0x2'),'uri':url['resolve'](_0x2d6f40[_0x133a('0x3')],_0x133a('0x4')),'form':{'grant_type':_0x133a('0x5'),'username':_0x2d6f40['username'],'password':_0x2d6f40[_0x133a('0x5')]},'json':!![]};return rp(_0x212a37)[_0x133a('0x6')](function(_0x31409d){var _0x5f3a8f={'method':_0x133a('0x2'),'uri':url[_0x133a('0x7')](_0x2d6f40[_0x133a('0x8')],_0x133a('0x9')),'body':{'type':_0x2d6f40['ndaactivity_type']||'message','channelId':'Nda','conversation':{'id':_0x4bcb17[_0x133a('0xa')]},'from':{'id':_0x4bcb17[_0x133a('0xb')],'name':_0x4bcb17[_0x133a('0xc')]},'recipient':{'id':_0x4bcb17[_0x133a('0xd')],'name':_0x4bcb17[_0x133a('0xe')]},'text':_0x2d6f40['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x31409d[_0x133a('0xf')]},'json':!![]};if(_0x2d6f40['project']){_0x5f3a8f['body'][_0x133a('0x10')][_0x133a('0x11')]=_0x2d6f40['project'];}if(_0x2d6f40[_0x133a('0x12')]=='1'){_0x5f3a8f[_0x133a('0x13')][_0x133a('0x10')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2d6f40[_0x133a('0x14')]){_0x5f3a8f[_0x133a('0x13')][_0x133a('0x10')][_0x133a('0x15')]=_0x2d6f40['custom_action'];if(_0x2d6f40['custom_action_data']){_0x5f3a8f['body'][_0x133a('0x10')]['CustomActionData']=_0x2d6f40[_0x133a('0x16')];}}logger[_0x133a('0x17')](JSON['stringify'](_0x5f3a8f));return rp(_0x5f3a8f);});}; \ No newline at end of file +var _0xb6b8=['ProjectName','body','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','callerid','calleridname','dnid','text','Bearer\x20','project','channelData'];(function(_0x13a094,_0x250688){var _0xa3d083=function(_0xa272f4){while(--_0xa272f4){_0x13a094['push'](_0x13a094['shift']());}};_0xa3d083(++_0x250688);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x123725,_0x136b54){_0x123725=_0x123725-0x0;var _0x3e8a66=_0xb6b8[_0x123725];return _0x3e8a66;};'use strict';var rp=require('request-promise');var url=require(_0x8b6b('0x0'));var logger=require(_0x8b6b('0x1'))(_0x8b6b('0x2'));module[_0x8b6b('0x3')]=function(_0x1153aa,_0x387e4c){var _0x54b1f6={'method':_0x8b6b('0x4'),'uri':url[_0x8b6b('0x5')](_0x387e4c[_0x8b6b('0x6')],'/token'),'form':{'grant_type':_0x8b6b('0x7'),'username':_0x387e4c['username'],'password':_0x387e4c['password']},'json':!![]};return rp(_0x54b1f6)[_0x8b6b('0x8')](function(_0x303c21){var _0x142239={'method':_0x8b6b('0x4'),'uri':url[_0x8b6b('0x5')](_0x387e4c[_0x8b6b('0x9')],_0x8b6b('0xa')),'body':{'type':_0x387e4c[_0x8b6b('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x1153aa['uniqueid']},'from':{'id':_0x1153aa[_0x8b6b('0xc')],'name':_0x1153aa[_0x8b6b('0xd')]},'recipient':{'id':_0x1153aa[_0x8b6b('0xe')],'name':_0x1153aa['extension']},'text':_0x387e4c[_0x8b6b('0xf')],'channelData':{}},'headers':{'Authorization':_0x8b6b('0x10')+_0x303c21['access_token']},'json':!![]};if(_0x387e4c[_0x8b6b('0x11')]){_0x142239['body'][_0x8b6b('0x12')][_0x8b6b('0x13')]=_0x387e4c['project'];}if(_0x387e4c['ndagenerate_audio']=='1'){_0x142239[_0x8b6b('0x14')]['channelData'][_0x8b6b('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8b6b('0x16')};}if(_0x387e4c[_0x8b6b('0x17')]){_0x142239[_0x8b6b('0x14')][_0x8b6b('0x12')]['CustomAction']=_0x387e4c[_0x8b6b('0x17')];if(_0x387e4c[_0x8b6b('0x18')]){_0x142239[_0x8b6b('0x14')][_0x8b6b('0x12')][_0x8b6b('0x19')]=_0x387e4c[_0x8b6b('0x18')];}}logger[_0x8b6b('0x1a')](JSON['stringify'](_0x142239));return rp(_0x142239);});}; \ 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 5f660e1..c7b3a7f 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 _0xa24d=['./lib/api'];(function(_0x18f2ae,_0x1617d9){var _0x5aa282=function(_0x379e0d){while(--_0x379e0d){_0x18f2ae['push'](_0x18f2ae['shift']());}};_0x5aa282(++_0x1617d9);}(_0xa24d,0x10c));var _0xda24=function(_0x58ab22,_0x42c988){_0x58ab22=_0x58ab22-0x0;var _0x3bedba=_0xa24d[_0x58ab22];return _0x3bedba;};'use strict';var asr=require(_0xda24('0x0'));module['exports']=function(_0x2c51aa,_0x1425a2,_0x32cd46,_0x19d2c9){return asr(_0x2c51aa,_0x1425a2,_0x32cd46,_0x19d2c9);}; \ No newline at end of file +var _0xc2a1=['./lib/api'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xc2a1,0x65));var _0x1c2a=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0xc2a1[_0x5ed54b];return _0x4b58c7;};'use strict';var asr=require(_0x1c2a('0x0'));module['exports']=function(_0x245e0d,_0x3ca8c7,_0x110c2c,_0xf8bbd7){return asr(_0x245e0d,_0x3ca8c7,_0x110c2c,_0xf8bbd7);}; \ 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 3efb2fa..438dc3a 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 _0x18cf=['update','digest','hex','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','data','send','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','close','bluebird','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1'];(function(_0x2cb169,_0x38ec0a){var _0x54c758=function(_0x3f3cf4){while(--_0x3f3cf4){_0x2cb169['push'](_0x2cb169['shift']());}};_0x54c758(++_0x38ec0a);}(_0x18cf,0x127));var _0xf18c=function(_0x58688e,_0x429d03){_0x58688e=_0x58688e-0x0;var _0x2aa2f4=_0x18cf[_0x58688e];return _0x2aa2f4;};'use strict';var BPromise=require(_0xf18c('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf18c('0x1'));var crypto=require(_0xf18c('0x2'));var logger=require('../../../../../../config/logger')(_0xf18c('0x3'));module[_0xf18c('0x4')]=function(_0x238494,_0x4cda8e,_0xcc5e32,_0x1e266e){return new BPromise(function(_0x4bc256,_0x3f1008){logger[_0xf18c('0x5')](_0xf18c('0x6'),_0x1e266e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x16e70f=new WebSocket(_0x1e266e||_0xf18c('0x7'),{'perMessageDeflate':![]});var _0x224ee4='';var _0x3176f2='0';var _0x6e5bf0='1';var _0x39905d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x17381e(_0x1b04ca){var _0x115044=crypto['createHash'](_0xf18c('0x8'));_0x115044[_0xf18c('0x9')](_0x1b04ca);return _0x115044[_0xf18c('0xa')](_0xf18c('0xb'));}function _0x27a88a(){try{logger[_0xf18c('0x5')](_0xf18c('0xc'));var _0x13a9d2=moment()['unix']();var _0x77e588=_0x17381e(_0x13a9d2+_0x4cda8e+_0xcc5e32);_0x16e70f['send'](JSON[_0xf18c('0xd')]({'appID':_0x4cda8e,'timestamp':_0x13a9d2,'appKey':_0x77e588}));var _0x4af5b4=fs[_0xf18c('0xe')](_0x238494);_0x4af5b4['on'](_0xf18c('0xf'),function(_0x55b655){_0x16e70f['send'](_0x55b655);});_0x4af5b4['on']('close',function(){_0x16e70f[_0xf18c('0x10')]('EOS');});}catch(_0x22edfe){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x22edfe));_0x16e70f['terminate']();}}function _0x420efa(_0x515966){try{if(_0x515966){var _0x5aabe7=JSON[_0xf18c('0x11')](_0x515966);switch(_0x5aabe7[_0xf18c('0x12')]){case 0x0:if(_0x5aabe7[_0xf18c('0x13')]){if(_0x5aabe7[_0xf18c('0x13')]['final']){logger['info'](_0xf18c('0x14'),JSON[_0xf18c('0xd')](_0x5aabe7['result']['hypotheses']));_0x224ee4=_0x5aabe7[_0xf18c('0x13')][_0xf18c('0x15')][0x0]['transcript'];_0x3176f2=_0x5aabe7[_0xf18c('0x13')][_0xf18c('0x15')][0x0][_0xf18c('0x16')];_0x6e5bf0='0';_0x39905d=_0xf18c('0x17');_0x16e70f['terminate']();}}break;case 0x1:logger[_0xf18c('0x5')](_0xf18c('0x18'));_0x6e5bf0='1';_0x39905d=_0xf18c('0x18');break;case 0x2:logger[_0xf18c('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x6e5bf0='2';_0x39905d=_0xf18c('0x19');break;case 0x9:logger[_0xf18c('0x5')](_0xf18c('0x1a'));_0x6e5bf0='9';_0x39905d=_0xf18c('0x1a');break;case 0xa:logger[_0xf18c('0x5')](_0xf18c('0x1b'));_0x6e5bf0='10';_0x39905d=_0xf18c('0x1b');break;case 0xb:logger[_0xf18c('0x5')](_0xf18c('0x1c'));_0x6e5bf0='11';_0x39905d=_0xf18c('0x1c');}}}catch(_0x3eba34){logger[_0xf18c('0x1d')](_0xf18c('0x1e'),JSON['stringify'](_0x3eba34));_0x16e70f[_0xf18c('0x1f')]();}}function _0x1f9c8a(){logger[_0xf18c('0x5')](_0xf18c('0x20'));_0x4bc256({'transcript':_0x224ee4,'confidence':_0x3176f2,'status':_0x6e5bf0,'status_message':_0x39905d});}function _0x5879e7(_0xb7f018){logger[_0xf18c('0x1d')](_0xf18c('0x21'));if(!_['isNil'](_0xb7f018)){logger[_0xf18c('0x1d')](_[_0xf18c('0x22')](_0xb7f018)?JSON[_0xf18c('0xd')](_0xb7f018):_0xb7f018);}}_0x16e70f['on'](_0xf18c('0x23'),_0x27a88a);_0x16e70f['on'](_0xf18c('0x24'),_0x420efa);_0x16e70f['on'](_0xf18c('0x25'),_0x1f9c8a);_0x16e70f['on'](_0xf18c('0x1d'),_0x5879e7);});}; \ No newline at end of file +var _0x6f19=['agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','EOS','Tilde\x20ASR\x20send\x20error','stringify','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','isNil','isObject','message','close','bluebird','lodash','crypto','../../../../../../config/logger'];(function(_0x1ef726,_0x16fdea){var _0x4c3c66=function(_0x1bf2de){while(--_0x1bf2de){_0x1ef726['push'](_0x1ef726['shift']());}};_0x4c3c66(++_0x16fdea);}(_0x6f19,0x98));var _0x96f1=function(_0x4b387e,_0x5921e7){_0x4b387e=_0x4b387e-0x0;var _0xd3b9a7=_0x6f19[_0x4b387e];return _0xd3b9a7;};'use strict';var BPromise=require(_0x96f1('0x0'));var _=require(_0x96f1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x96f1('0x2'));var logger=require(_0x96f1('0x3'))(_0x96f1('0x4'));module[_0x96f1('0x5')]=function(_0x9094e2,_0x26681b,_0x35da25,_0x41a262){return new BPromise(function(_0x725825,_0xf295){logger[_0x96f1('0x6')]('Tilde\x20URI',_0x41a262||_0x96f1('0x7'));var _0x4f80df=new WebSocket(_0x41a262||_0x96f1('0x7'),{'perMessageDeflate':![]});var _0x5737fb='';var _0x765a82='0';var _0x4c7cf5='1';var _0x1aa167=_0x96f1('0x8');function _0x24a943(_0x383416){var _0x4883f6=crypto[_0x96f1('0x9')](_0x96f1('0xa'));_0x4883f6[_0x96f1('0xb')](_0x383416);return _0x4883f6['digest'](_0x96f1('0xc'));}function _0x10b08a(){try{logger[_0x96f1('0x6')](_0x96f1('0xd'));var _0x31511c=moment()[_0x96f1('0xe')]();var _0x23f5f1=_0x24a943(_0x31511c+_0x26681b+_0x35da25);_0x4f80df[_0x96f1('0xf')](JSON['stringify']({'appID':_0x26681b,'timestamp':_0x31511c,'appKey':_0x23f5f1}));var _0x393d66=fs[_0x96f1('0x10')](_0x9094e2);_0x393d66['on']('data',function(_0x5bf7c2){_0x4f80df['send'](_0x5bf7c2);});_0x393d66['on']('close',function(){_0x4f80df[_0x96f1('0xf')](_0x96f1('0x11'));});}catch(_0x3819af){logger['error'](_0x96f1('0x12'),JSON[_0x96f1('0x13')](_0x3819af));_0x4f80df['terminate']();}}function _0x2cbe16(_0x4d0bab){try{if(_0x4d0bab){var _0x22aaff=JSON[_0x96f1('0x14')](_0x4d0bab);switch(_0x22aaff[_0x96f1('0x15')]){case 0x0:if(_0x22aaff[_0x96f1('0x16')]){if(_0x22aaff['result']['final']){logger[_0x96f1('0x6')](_0x96f1('0x17'),JSON[_0x96f1('0x13')](_0x22aaff[_0x96f1('0x16')][_0x96f1('0x18')]));_0x5737fb=_0x22aaff[_0x96f1('0x16')][_0x96f1('0x18')][0x0][_0x96f1('0x19')];_0x765a82=_0x22aaff['result']['hypotheses'][0x0][_0x96f1('0x1a')];_0x4c7cf5='0';_0x1aa167=_0x96f1('0x1b');_0x4f80df[_0x96f1('0x1c')]();}}break;case 0x1:logger[_0x96f1('0x6')](_0x96f1('0x8'));_0x4c7cf5='1';_0x1aa167=_0x96f1('0x8');break;case 0x2:logger[_0x96f1('0x6')](_0x96f1('0x1d'));_0x4c7cf5='2';_0x1aa167=_0x96f1('0x1d');break;case 0x9:logger[_0x96f1('0x6')](_0x96f1('0x1e'));_0x4c7cf5='9';_0x1aa167=_0x96f1('0x1e');break;case 0xa:logger[_0x96f1('0x6')](_0x96f1('0x1f'));_0x4c7cf5='10';_0x1aa167=_0x96f1('0x1f');break;case 0xb:logger['info'](_0x96f1('0x20'));_0x4c7cf5='11';_0x1aa167=_0x96f1('0x20');}}}catch(_0x248d99){logger[_0x96f1('0x21')](_0x96f1('0x22'),JSON[_0x96f1('0x13')](_0x248d99));_0x4f80df[_0x96f1('0x1c')]();}}function _0x571a48(){logger[_0x96f1('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x725825({'transcript':_0x5737fb,'confidence':_0x765a82,'status':_0x4c7cf5,'status_message':_0x1aa167});}function _0x384041(_0x841377){logger[_0x96f1('0x21')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x96f1('0x23')](_0x841377)){logger['error'](_[_0x96f1('0x24')](_0x841377)?JSON[_0x96f1('0x13')](_0x841377):_0x841377);}}_0x4f80df['on']('open',_0x10b08a);_0x4f80df['on'](_0x96f1('0x25'),_0x2cbe16);_0x4f80df['on'](_0x96f1('0x26'),_0x571a48);_0x4f80df['on']('error',_0x384041);});}; \ 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 49549b7..f18d67f 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 _0xa615=['./asr'];(function(_0x1fc913,_0x54f47c){var _0x58b787=function(_0x34688e){while(--_0x34688e){_0x1fc913['push'](_0x1fc913['shift']());}};_0x58b787(++_0x54f47c);}(_0xa615,0x9b));var _0x5a61=function(_0x549b42,_0x1c4dd4){_0x549b42=_0x549b42-0x0;var _0x54f866=_0xa615[_0x549b42];return _0x54f866;};var asr=require(_0x5a61('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x4198=['./asr','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4198,0x144));var _0x8419=function(_0xa52856,_0x3361cd){_0xa52856=_0xa52856-0x0;var _0xf4049f=_0x4198[_0xa52856];return _0xf4049f;};var asr=require(_0x8419('0x0'));module[_0x8419('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 1d6748d..3e002a5 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 _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(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0xe706,0xa3));var _0x6e70=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xe706[_0x3cb3ca];return _0x214366;};'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 +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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe706,0xa3));var _0x6e70=function(_0xa05fd3,_0x4c6517){_0xa05fd3=_0xa05fd3-0x0;var _0x581738=_0xe706[_0xa05fd3];return _0x581738;};'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 9a73a8a..a5f9e98 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 _0x9147=['IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','no\x20variable\x20found','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','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>','user','bcc','subject','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','then','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','getSmsAccountById','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','uniqueid','accountcode','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','label','Wait\x20%s\x20seconds\x20before\x20answer','no\x20list\x20selected','scheduledAt','delay','add','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','no\x20user\x20selected','sip_id','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','out','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','getTrunk','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9147,0x7b));var _0x7914=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x9147[_0x433a86];return _0x23000c;};'use strict';var fs=require('fs');var util=require(_0x7914('0x0'));var _=require(_0x7914('0x1'));var sh=require('shelljs');var odbc=require(_0x7914('0x2'))();var rs=require('randomstring');var moment=require(_0x7914('0x3'));var Mustache=require(_0x7914('0x4'));var rp=require('request-promise');var logger=require(_0x7914('0x5'))(_0x7914('0x6'));var config=require(_0x7914('0x7'));var shared=require('../../config/environment/shared');var scripts=require(_0x7914('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x7914('0x9'),'rawBody'];var verticesWithRetry=[_0x7914('0xa'),_0x7914('0xb'),_0x7914('0xc')];var AGIVertices=function(_0x463e7f,_0x29fdf8,_0x23df4f){this[_0x7914('0xd')]=_0x463e7f;this[_0x7914('0xe')]=_0x29fdf8;this[_0x7914('0xf')]=_0x23df4f;};AGIVertices[_0x7914('0x10')][_0x7914('0x11')]=function(_0x1b03b6,_0x14ab3e){this[_0x7914('0xe')][_0x7914('0x12')](_0x1b03b6)['then'](function(_0x290117){_0x14ab3e(null,_0x290117?_0x290117[_0x7914('0x13')]:![]);})[_0x7914('0x14')](function(_0x1e6768){_0x14ab3e(_0x1e6768);});};AGIVertices[_0x7914('0x10')]['getVoiceQueue']=function(_0x1eaf65,_0x30d365){this[_0x7914('0xe')]['getVoiceQueueById'](_0x1eaf65)[_0x7914('0x15')](function(_0x5ec22e){_0x30d365(null,_0x5ec22e?_0x5ec22e[_0x7914('0x13')]:![]);})[_0x7914('0x14')](function(_0x57e5b1){_0x30d365(_0x57e5b1);});};AGIVertices[_0x7914('0x10')][_0x7914('0x16')]=function(_0xa225a9,_0x3a28eb){this[_0x7914('0xe')]['getSquareProjectById'](_0xa225a9)[_0x7914('0x15')](function(_0x438a91){_0x3a28eb(null,_0x438a91?_0x438a91[_0x7914('0x13')]:![]);})[_0x7914('0x14')](function(_0x52c759){_0x3a28eb(_0x52c759);});};AGIVertices['prototype'][_0x7914('0x17')]=function(_0x5098c3,_0x2b31ed){this[_0x7914('0xe')][_0x7914('0x18')](_0x5098c3)[_0x7914('0x15')](function(_0xfe14de){_0x2b31ed(null,_0xfe14de?_0xfe14de['dsn']:![]);})[_0x7914('0x14')](function(_0xca996f){_0x2b31ed(_0xca996f);});};AGIVertices[_0x7914('0x10')][_0x7914('0x19')]=function(_0x552d24,_0x46da43){this[_0x7914('0xe')]['getUserById'](_0x552d24)[_0x7914('0x15')](function(_0x7777f9){_0x46da43(null,_0x7777f9?_0x7777f9[_0x7914('0x13')]:![]);})[_0x7914('0x14')](function(_0x5ce556){_0x46da43(_0x5ce556);});};AGIVertices['prototype']['getTrunk']=function(_0x4409c3,_0x11f6e6){this[_0x7914('0xe')][_0x7914('0x1a')](_0x4409c3)['then'](function(_0x1cebc6){_0x11f6e6(null,_0x1cebc6?_0x1cebc6[_0x7914('0x13')]:![]);})[_0x7914('0x14')](function(_0x1bcd29){_0x11f6e6(_0x1bcd29);});};AGIVertices[_0x7914('0x10')][_0x7914('0x1b')]=function(_0x361a32,_0x3dc5e6){var _0x530a56=this;this[_0x7914('0xe')][_0x7914('0x1c')](_0x361a32)[_0x7914('0x15')](function(_0x2dfcf7){_0x3dc5e6(null,_0x2dfcf7?_0x530a56['getSoundPath'](_0x2dfcf7[_0x7914('0x1d')]):![]);})[_0x7914('0x14')](function(_0x473125){_0x3dc5e6(_0x473125);});};AGIVertices['prototype'][_0x7914('0x1e')]=function(_0x20c11a,_0xf19936){this[_0x7914('0xe')][_0x7914('0x1f')](_0x20c11a)[_0x7914('0x15')](function(_0x4df760){_0xf19936(null,_0x4df760?_0x4df760:![]);})[_0x7914('0x14')](function(_0x4c944f){_0xf19936(_0x4c944f);});};AGIVertices['prototype'][_0x7914('0x20')]=function(_0x3461b6,_0x2e6502,_0x36307c){this[_0x7914('0xf')]['sendMailMessage'](_0x3461b6,_0x2e6502)[_0x7914('0x15')](function(){_0x36307c(null);})[_0x7914('0x14')](function(_0x137711){_0x36307c(_0x137711);});};AGIVertices['prototype'][_0x7914('0x21')]=function(_0xf46e0f,_0x12ad3a){this[_0x7914('0xe')][_0x7914('0x22')](_0xf46e0f)[_0x7914('0x15')](function(_0x130a28){if(_0x130a28){if(_0x130a28['IntervalId']){_0x12ad3a(null,[_0x130a28[_0x7914('0x23')]]);}else{_0x12ad3a(null,_[_0x7914('0x24')](_0x130a28[_0x7914('0x25')],_0x7914('0x23')));}}else{_0x12ad3a(null,![]);}})[_0x7914('0x14')](function(_0x3d63e5){_0x12ad3a(_0x3d63e5);});};AGIVertices[_0x7914('0x10')]['getSoundPath']=function(_0x11d086){return util['format'](_0x7914('0x26'),FILES_PATH,_0x11d086);};AGIVertices[_0x7914('0x10')][_0x7914('0x27')]=function(_0x31af8a,_0x10e069,_0x50eb11){odbc[_0x7914('0x28')](_0x31af8a,function(_0x123d79){if(_0x123d79){logger[_0x7914('0x29')](_0x7914('0x2a'),_0x123d79);_0x50eb11(_0x123d79);}else{logger[_0x7914('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x7914('0x2c')](_0x10e069,function(_0x1b2fc0,_0xc8d841){if(_0x1b2fc0){logger[_0x7914('0x2b')]('Error\x20executing\x20query\x20%s',_0x10e069);_0x50eb11(_0x1b2fc0);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x10e069);odbc['close'](function(_0x4f91eb){if(_0x4f91eb){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x4f91eb);}_0x50eb11(null,_0xc8d841);});}});}});};AGIVertices[_0x7914('0x10')]['getSmsAccount']=function(_0x277c9b,_0x217213){this[_0x7914('0xe')][_0x7914('0x2d')](_0x277c9b)[_0x7914('0x15')](function(_0x27099f){_0x217213(null,_0x27099f?_0x27099f:![]);})[_0x7914('0x14')](function(_0x44a467){_0x217213(_0x44a467);});};AGIVertices[_0x7914('0x10')]['createSmsMessage']=function(_0x2eeba4,_0x5dcbd8){this[_0x7914('0xe')]['createSmsMessage'](_0x2eeba4)[_0x7914('0x15')](function(_0x2dc4f6){_0x5dcbd8(null,_0x2dc4f6);})['catch'](function(_0x32406a){_0x5dcbd8(_0x32406a);});};AGIVertices[_0x7914('0x10')][_0x7914('0x2e')]=function(_0x44c650,_0x1be449,_0x414534){this[_0x7914('0xe')][_0x7914('0x2e')]({'uniqueid':this[_0x7914('0xd')]['uniqueid'],'node':_0x44c650['label'],'application':_0x44c650[_0x7914('0x2f')],'data':_0x1be449||null,'project_name':this['channel'][_0x7914('0x30')],'callerid':this['channel'][_0x7914('0x31')]})['then'](function(_0x4095ba){if(_0x414534){_0x414534(null,_0x4095ba);}})[_0x7914('0x14')](function(_0x39f023){if(_0x414534){_0x414534(_0x39f023);}});};AGIVertices[_0x7914('0x10')][_0x7914('0x32')]=function(_0x1af456,_0x501b1b,_0x221047,_0x3eb5d8){this[_0x7914('0xe')]['createSquareRecording']({'uniqueid':this[_0x7914('0xd')][_0x7914('0x33')],'callerid':this['channel'][_0x7914('0x31')],'calleridname':this[_0x7914('0xd')]['calleridname'],'context':this[_0x7914('0xd')]['context'],'extension':this[_0x7914('0xd')]['extension'],'priority':this[_0x7914('0xd')]['priority'],'accountcode':this['channel'][_0x7914('0x34')],'dnid':this[_0x7914('0xd')]['dnid'],'projectName':this[_0x7914('0xd')]['arg_1'],'saveName':_0x501b1b,'filename':_0x1af456['file']||_0x501b1b,'savePath':_0x221047})[_0x7914('0x15')](function(_0x2ff763){_0x3eb5d8(null,_0x2ff763);})['catch'](function(_0xecbe16){_0x3eb5d8(_0xecbe16);});};AGIVertices[_0x7914('0x10')]['createSquareMessage']=function(_0x2adf57,_0x232b0f,_0x21d645,_0x43cbf4,_0x5937d0){this[_0x7914('0xe')][_0x7914('0x35')]({'uniqueid':this[_0x7914('0xd')][_0x7914('0x33')],'body':_0x2adf57,'direction':_0x232b0f,'providerName':_0x21d645,'providerResponse':_0x43cbf4})[_0x7914('0x15')](function(_0x4d77a9){if(_0x5937d0){_0x5937d0(null,_0x4d77a9);}})[_0x7914('0x14')](function(_0x560d96){if(_0x5937d0){_0x5937d0(_0x560d96);}});};AGIVertices['prototype'][_0x7914('0x36')]=function(_0x2fc471,_0x3a0393){this[_0x7914('0xe')][_0x7914('0x36')]({'firstName':_[_0x7914('0x37')](_0x2fc471[_0x7914('0x13')])||_[_0x7914('0x38')](_0x2fc471[_0x7914('0x13')])?_0x7914('0x39')+Math[_0x7914('0x3a')]():_0x2fc471['name'],'lastName':_[_0x7914('0x37')](_0x2fc471[_0x7914('0x3b')])||_['isNil'](_0x2fc471[_0x7914('0x3b')])?null:_0x2fc471[_0x7914('0x3b')],'phone':_0x2fc471[_0x7914('0x3c')],'ListId':_0x2fc471[_0x7914('0x3d')],'scheduledat':_0x2fc471['scheduledAt'],'callbackUniqueid':this[_0x7914('0xd')][_0x7914('0x33')],'tags':_0x7914('0x3e'),'description':_0x7914('0x3f')+_0x2fc471['scheduledAt'][_0x7914('0x40')](),'priority':_0x2fc471[_0x7914('0x41')]})['then'](function(_0x121392){_0x3a0393(null,_0x121392);})[_0x7914('0x14')](function(_0x1f01d6){_0x3a0393(_0x1f01d6);});};AGIVertices[_0x7914('0x10')][_0x7914('0x42')]=function(_0x1717fb,_0x1072e5){this[_0x7914('0xe')][_0x7914('0x43')](_0x1717fb)[_0x7914('0x15')](function(_0x82f97e){_0x1072e5(null,_0x82f97e?_0x82f97e[_0x7914('0x13')]:![]);})[_0x7914('0x14')](function(_0x6d4201){_0x1072e5(_0x6d4201);});};AGIVertices[_0x7914('0x10')][_0x7914('0x44')]=function(_0x53df0f,_0x544790,_0x34168f){var _0x47eda0={'role':_0x7914('0x45')};_0x47eda0[_0x53df0f]=this[_0x7914('0xd')][_0x7914('0x31')];this['rpc'][_0x7914('0x44')](_0x47eda0,_0x544790,this[_0x7914('0xd')]['uniqueid'])[_0x7914('0x15')](function(_0x522fd2){_0x34168f(null,_[_0x7914('0x38')](_0x522fd2)?![]:!![]);})['catch'](function(_0x5e6090){logger[_0x7914('0x29')](_0x5e6090);_0x34168f(null,![]);});};AGIVertices['prototype'][_0x7914('0x46')]=function(_0x3c5397,_0x4ce6b0){var _0x9b1a99={'role':'agent'};_0x9b1a99[_0x3c5397]=this['channel'][_0x7914('0x31')];this[_0x7914('0xe')]['agentUnpause'](_0x9b1a99)[_0x7914('0x15')](function(_0x4e51d3){_0x4ce6b0(null,_['isNil'](_0x4e51d3)?![]:!![]);})[_0x7914('0x14')](function(_0x3ab1bb){logger[_0x7914('0x29')](_0x3ab1bb);_0x4ce6b0(null,![]);});};AGIVertices[_0x7914('0x10')][_0x7914('0x47')]=function(_0x241ac9,_0x46919a){var _0x23a5f3={'role':_0x7914('0x45')};_0x23a5f3[_0x241ac9]=this['channel'][_0x7914('0x31')];this[_0x7914('0xe')][_0x7914('0x47')](_0x23a5f3)[_0x7914('0x15')](function(_0x1b42cc){_0x46919a(null,_[_0x7914('0x38')](_0x1b42cc)?![]:!![]);})[_0x7914('0x14')](function(_0x5bf433){logger['error'](_0x5bf433);_0x46919a(null,![]);});};AGIVertices[_0x7914('0x10')][_0x7914('0x48')]=function(_0x3aa623,_0x29672c){var _0x3f87aa={'role':_0x7914('0x45')};_0x3f87aa[_0x3aa623]=this[_0x7914('0xd')]['callerid'];var _0x34ae17=_0x3aa623!=_0x7914('0x49')?util[_0x7914('0x4a')](_0x7914('0x4b'),_0x7914('0x4c'),this[_0x7914('0xd')][_0x7914('0x31')]):undefined;this[_0x7914('0xe')][_0x7914('0x48')](_0x3f87aa,_0x34ae17)[_0x7914('0x15')](function(_0x42d471){_0x29672c(null,_[_0x7914('0x38')](_0x42d471)?![]:!![]);})['catch'](function(_0x159df6){logger[_0x7914('0x29')](_0x159df6);_0x29672c(null,![]);});};AGIVertices[_0x7914('0x10')][_0x7914('0x4d')]=function(_0x24f772,_0x24c253){sh[_0x7914('0x4e')](_[_0x7914('0x4f')](_0x24f772),function(_0x21f957,_0x157aab){var _0x588e39=_0x157aab[_0x7914('0x50')](/(\r\n|\n|\r)/gm,'');_0x24c253(null,_0x588e39);});};AGIVertices['prototype'][_0x7914('0x51')]=function(_0x1ea0ca,_0x7305e4){scripts[_0x7914('0x51')](_0x1ea0ca[_0x7914('0x52')],_0x1ea0ca[_0x7914('0x53')]||_0x7914('0x54'),_0x1ea0ca[_0x7914('0x54')],_0x1ea0ca[_0x7914('0x55')]||_0x7914('0x56'),_0x1ea0ca[_0x7914('0x57')]||_0x7914('0x58'),_0x1ea0ca[_0x7914('0x59')]||_0x7914('0x5a'))[_0x7914('0x15')](function(_0x3a5751){_0x7305e4(null,_0x3a5751);})[_0x7914('0x14')](function(_0x3ade16){_0x7305e4(_0x3ade16);});};AGIVertices[_0x7914('0x10')][_0x7914('0x5b')]=function(_0x3d6d5a,_0x12d626){scripts[_0x7914('0x5b')](_0x3d6d5a[_0x7914('0x54')],_0x3d6d5a[_0x7914('0x5c')]||'en',0x1)[_0x7914('0x15')](function(_0x29a5fc){_0x12d626(null,_0x29a5fc);})['catch'](function(_0x240d1e){_0x12d626(_0x240d1e);});};AGIVertices[_0x7914('0x10')][_0x7914('0x5d')]=function(_0x709d0d,_0x28376c){var _0x1bbb6a={'uri':_0x709d0d[_0x7914('0x5e')],'method':_0x709d0d[_0x7914('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x709d0d[_0x7914('0x60')])===_0x7914('0x61')&&parseInt(_0x709d0d[_0x7914('0x60')])>=0x1?parseInt(_0x709d0d[_0x7914('0x60')])*0x3e8:0x5*0x3e8};if(_[_0x7914('0x62')](['POST',_0x7914('0x63')],_0x1bbb6a['method']['toUpperCase']())){try{_0x1bbb6a[_0x7914('0x64')]=_0x709d0d[_0x7914('0x65')]?JSON['parse'](_0x709d0d['rawBody']):{};}catch(_0x3ffd52){logger[_0x7914('0x29')](_0x7914('0x66'),_0x3ffd52);}}try{_0x1bbb6a[_0x7914('0x67')]=_0x709d0d[_0x7914('0x9')]?JSON[_0x7914('0x68')](_0x709d0d['rawHeaders']):{};}catch(_0x2ce8aa){logger['error'](_0x7914('0x69'),_0x2ce8aa);}if(_0x709d0d[_0x7914('0x6a')]){try{var _0x2ccc98=require(_0x709d0d[_0x7914('0x6a')])[_0x7914('0x6b')](this,_0x1bbb6a);_0x1bbb6a[_0x7914('0x6c')]=Mustache[_0x7914('0x6d')](_0x709d0d[_0x7914('0x5e')],_0x2ccc98,{},['$$','$$']);if(_0x1bbb6a[_0x7914('0x67')]){_0x1bbb6a['headers']=JSON[_0x7914('0x68')](Mustache['render'](JSON[_0x7914('0x6e')](_0x1bbb6a[_0x7914('0x67')]),_0x2ccc98,{},['$$','$$']));}if(_0x1bbb6a['body']){_0x1bbb6a[_0x7914('0x64')]=JSON[_0x7914('0x68')](Mustache[_0x7914('0x6d')](JSON[_0x7914('0x6e')](_0x1bbb6a[_0x7914('0x64')]),_0x2ccc98,{},['$$','$$']));}}catch(_0x5d7e6a){logger[_0x7914('0x29')](_0x7914('0x6f'),_0x5d7e6a);}}rp(_0x1bbb6a)['then'](function(_0x2243db){var _0x26ea4a={'statusCode':_0x2243db[_0x7914('0x70')]||0xc8,'statusMessage':_0x2243db[_0x7914('0x71')]||'OK','headers':_0x2243db['headers']||{},'body':_0x2243db[_0x7914('0x64')]||{}};_0x28376c(null,_0x26ea4a);})[_0x7914('0x14')](function(_0x33e303){var _0x147aa4={'statusCode':_0x33e303[_0x7914('0x70')]||0x1f4,'statusMessage':_0x33e303[_0x7914('0x72')]||_0x7914('0x73'),'headers':_0x33e303[_0x7914('0x74')][_0x7914('0x67')]||{},'body':_0x33e303['options'][_0x7914('0x64')]||{}};_0x28376c(null,_0x147aa4);});};AGIVertices[_0x7914('0x10')][_0x7914('0x75')]=function(_0x430fae,_0x4930fc){scripts[_0x7914('0x75')](this[_0x7914('0xd')][_0x7914('0x33')],_0x430fae[_0x7914('0x76')],_0x430fae[_0x7914('0x54')],_0x430fae[_0x7914('0x77')]||'en')['then'](function(_0x2819d8){_0x4930fc(null,_0x2819d8);})[_0x7914('0x14')](function(_0x34afbd){_0x4930fc(_0x34afbd);});};AGIVertices['prototype'][_0x7914('0x78')]=function(_0x447f7a,_0xcbe67){scripts[_0x7914('0x78')](this['channel'][_0x7914('0x33')],_0x447f7a['dialogflowV2_project_id'],_0x447f7a[_0x7914('0x79')],_0x447f7a['private_key'],_0x447f7a[_0x7914('0x54')],_0x447f7a[_0x7914('0x7a')]||'en')[_0x7914('0x15')](function(_0x217ce){_0xcbe67(null,_0x217ce);})[_0x7914('0x14')](function(_0x332832){_0xcbe67(_0x332832);});};AGIVertices[_0x7914('0x10')]['sestekNDA']=function(_0x26e89c,_0x167fcb){scripts['sestekNDA'](this[_0x7914('0xd')],_0x26e89c)[_0x7914('0x15')](function(_0x1488e8){_0x167fcb(null,_0x1488e8);})[_0x7914('0x14')](function(_0x3ba2c0){_0x167fcb(_0x3ba2c0);});};AGIVertices['prototype'][_0x7914('0x7b')]=function(_0x1fff54,_0x39d3be){scripts[_0x7914('0x7b')](_0x1fff54['key'],_0x1fff54['text'],_0x1fff54[_0x7914('0x7c')]||_0x7914('0x56'),_0x1fff54[_0x7914('0x7d')])[_0x7914('0x15')](function(_0x2dfcdc){_0x39d3be(null,_0x2dfcdc);})[_0x7914('0x14')](function(_0x250fb9){_0x39d3be(_0x250fb9);});};AGIVertices[_0x7914('0x10')][_0x7914('0x7e')]=function(_0x369da1,_0x47780b,_0xd6282e){scripts[_0x7914('0x7e')](_0x47780b,_0x369da1['key'],_0x369da1['ispeech_asr_language']||_0x7914('0x56'),this[_0x7914('0x7f')](_0x369da1['model'])?_0x369da1[_0x7914('0x80')]:undefined)[_0x7914('0x15')](function(_0x14feb6){_0xd6282e(null,_0x14feb6);})[_0x7914('0x14')](function(_0x1e942d){_0xd6282e(_0x1e942d);});};AGIVertices[_0x7914('0x10')][_0x7914('0x81')]=function(_0x186200,_0x8fba5){scripts[_0x7914('0x81')](_0x186200[_0x7914('0x82')],_0x186200[_0x7914('0x83')],_0x186200[_0x7914('0x84')],_0x186200[_0x7914('0x85')]||_0x7914('0x86'),_0x186200['text'],_0x186200[_0x7914('0x87')]||_0x7914('0x54'))['then'](function(_0xd6ad9f){_0x8fba5(null,_0xd6ad9f);})[_0x7914('0x14')](function(_0x42a8c9){_0x8fba5(_0x42a8c9);});};AGIVertices[_0x7914('0x10')][_0x7914('0x88')]=function(_0x4f9392,_0x47065b){scripts[_0x7914('0x88')](this[_0x7914('0xd')]['uniqueid'],_0x4f9392[_0x7914('0x82')],_0x4f9392[_0x7914('0x83')],_0x4f9392[_0x7914('0x89')],_0x4f9392[_0x7914('0x54')],_0x4f9392[_0x7914('0x8a')])[_0x7914('0x15')](function(_0x5ae9ec){_0x47065b(null,_0x5ae9ec);})[_0x7914('0x14')](function(_0x3d1d78){_0x47065b(_0x3d1d78);});};AGIVertices[_0x7914('0x10')]['googleASR']=function(_0x5f3dea,_0x1ced98,_0xd7cf46){scripts[_0x7914('0x8b')](_0x1ced98,_0x5f3dea['key'],_0x5f3dea['google_asr_language']||_0x7914('0x56'))[_0x7914('0x15')](function(_0x410322){_0xd7cf46(null,_0x410322);})[_0x7914('0x14')](function(_0x1ee394){_0xd7cf46(_0x1ee394);});};AGIVertices['prototype'][_0x7914('0x8c')]=function(_0xfcb66a,_0x509ac5,_0x3a2a32){scripts[_0x7914('0x8c')](_0x509ac5,_0xfcb66a['appid'],_0xfcb66a[_0x7914('0x8d')],_0xfcb66a[_0x7914('0x6c')])[_0x7914('0x15')](function(_0x8a6782){_0x3a2a32(null,_0x8a6782);})['catch'](function(_0x549b49){_0x3a2a32(_0x549b49);});};AGIVertices[_0x7914('0x10')]['clear']=function(_0x12d7ba){var _0x33cec5=_[_0x7914('0x62')](verticesWithRetry,_0x12d7ba[_0x7914('0x2f')])?_0x12d7ba:_[_0x7914('0x8e')](_0x12d7ba);for(var _0x359b6d in _0x33cec5){if(_0x33cec5[_0x7914('0x8f')](_0x359b6d)){if(_0x33cec5[_0x359b6d]&&_[_0x7914('0x90')](_0x33cec5[_0x359b6d])){if(_[_0x7914('0x62')](recursiveMapAttributes,_0x359b6d)){_0x33cec5[_0x359b6d]=this[_0x7914('0x91')](_0x33cec5[_0x359b6d]);}else{_0x33cec5[_0x359b6d]=this[_0x7914('0x92')](_0x33cec5[_0x359b6d]);}}}}return _0x33cec5;};AGIVertices[_0x7914('0x10')][_0x7914('0x93')]=function(_0x1649d5){for(var _0x3a3355 in _0x1649d5){if(_0x1649d5[_0x7914('0x8f')](_0x3a3355)){if(_[_0x7914('0x94')](_0x1649d5[_0x3a3355])){this[_0x7914('0x93')](_0x1649d5[_0x3a3355]);}else if(_['isArray'](_0x1649d5[_0x3a3355])){for(var _0x3fd4ff=0x0;_0x3fd4ff<_0x1649d5[_0x3a3355][_0x7914('0x95')];_0x3fd4ff++){this[_0x7914('0x93')](_0x1649d5[_0x3a3355][_0x3fd4ff]);}}else if(_[_0x7914('0x90')](_0x1649d5[_0x3a3355])){_0x1649d5[_0x3a3355]=this[_0x7914('0x92')](_0x1649d5[_0x3a3355]);}}}};AGIVertices[_0x7914('0x10')][_0x7914('0x96')]=function(_0x5344a0,_0x5aa671){for(var _0x4987a8 in _0x5344a0){if(_0x5344a0[_0x7914('0x8f')](_0x4987a8)){if(_['isPlainObject'](_0x5344a0[_0x4987a8])){if(!_[_0x7914('0x37')](_0x5344a0[_0x4987a8])){this[_0x7914('0x96')](_0x5344a0[_0x4987a8],util['format'](_0x7914('0x97'),_0x5aa671,_0x4987a8));}}else if(_[_0x7914('0x98')](_0x5344a0[_0x4987a8])){for(var _0x1bd562=0x0;_0x1bd562<_0x5344a0[_0x4987a8][_0x7914('0x95')];_0x1bd562++){this[_0x7914('0x96')](_0x5344a0[_0x4987a8][_0x1bd562],util[_0x7914('0x4a')](_0x7914('0x97'),_0x5aa671,_0x4987a8+'['+_0x1bd562+']'));}}else{if(!_['isNil'](_0x5344a0[_0x4987a8])){this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0x97'),_0x5aa671,_0x4987a8),_0x5344a0[_0x4987a8]);}}}}};AGIVertices[_0x7914('0x10')][_0x7914('0x91')]=function(_0x2b01ad){try{var _0x4d47ef=JSON['parse'](_0x2b01ad);this['recursiveNodeIndex'](_0x4d47ef);return JSON[_0x7914('0x6e')](_0x4d47ef);}catch(_0x3b7dcc){return this[_0x7914('0x92')](_0x2b01ad);}};AGIVertices[_0x7914('0x10')][_0x7914('0x92')]=function(_0x22df6f){var _0x9eacc9=_0x22df6f[_0x7914('0x9a')]('{');for(var _0x25685d=0x1;_0x25685d<_0x9eacc9[_0x7914('0x95')];_0x25685d+=0x1){var _0xad5a2f=_0x9eacc9[_0x25685d][_0x7914('0x9a')]('}');if(_0xad5a2f[_0x7914('0x95')]>0x1){_0x22df6f=_0x22df6f[_0x7914('0x9b')]('{'+_0xad5a2f[0x0]+'}',this[_0x7914('0xd')][_0x7914('0x11')](_0xad5a2f[0x0])[_0x7914('0x9c')]||_0xad5a2f[0x0]);}}if(_0x9eacc9[_0x7914('0x95')]===0x1){return _0x22df6f['toString']();}return this[_0x7914('0x92')](_0x22df6f);};AGIVertices['prototype'][_0x7914('0x9d')]=function(_0x21ae99,_0x32717b){var _0x3b175b=this[_0x7914('0xd')]['getVariable'](_0x21ae99);if(_0x3b175b[_0x7914('0x9e')]===-0x1){return _0x3b175b;}logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x9f'),_0x32717b,_0x3b175b[_0x7914('0x9c')]));return this['channel'][_0x7914('0x99')](_0x32717b,_0x3b175b['extra']);};AGIVertices[_0x7914('0x10')]['isConfigured']=function(_0x4db5bb){return _0x4db5bb&&_0x4db5bb!=='0'&&_0x4db5bb!=='-1'&&_0x4db5bb!=='';};AGIVertices[_0x7914('0x10')][_0x7914('0xa0')]=function(_0x4bb5fd){this[_0x7914('0x2e')]['sync'](this,_0x4bb5fd,'-');_0x4bb5fd[_0x7914('0xa1')]=_0x4bb5fd[_0x7914('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x7914('0xa2')]=function(_0x237559){logger['info'](util[_0x7914('0x4a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x237559['label']));if(!this[_0x7914('0x7f')](_0x237559['text'])){return this['channel'][_0x7914('0xa3')](_0x7914('0xa4'));}var _0x4fa6fe='\x22'+_0x237559[_0x7914('0x54')]+'\x22';if(this[_0x7914('0x7f')](_0x237559[_0x7914('0x74')])){_0x4fa6fe+=','+_0x237559[_0x7914('0x74')];}var _0x217004=this[_0x7914('0xd')][_0x7914('0x4e')](_0x7914('0xa5'),_0x4fa6fe);if(_0x217004[_0x7914('0x9e')]===-0x1){return _0x217004;}return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0xa6'),_0x4fa6fe));};AGIVertices[_0x7914('0x10')][_0x7914('0xa7')]=function(_0x59245e){logger['info'](util[_0x7914('0x4a')](_0x7914('0xa8'),_0x59245e['label']));if(!this[_0x7914('0x7f')](_0x59245e[_0x7914('0xa9')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xaa'));}var _0x57a037=_0x59245e[_0x7914('0xa9')];if(this[_0x7914('0x7f')](_0x59245e[_0x7914('0x74')])){_0x57a037+=','+_0x59245e[_0x7914('0x74')];}var _0x233fcb=this[_0x7914('0xd')]['exec'](_0x7914('0xab'),_0x57a037);if(_0x233fcb[_0x7914('0x9e')]===-0x1){return _0x233fcb;}var _0x2c7d16=this['getAndSetVariable'](_0x7914('0xac'),_0x7914('0xad'));if(_0x2c7d16['result']===-0x1){return _0x2c7d16;}var _0x330636=this['getAndSetVariable']('RECOG_INPUT()',_0x7914('0xae'));if(_0x330636['result']===-0x1){return _0x330636;}var _0x56769e=this[_0x7914('0x9d')](_0x7914('0xaf'),_0x7914('0xb0'));if(_0x56769e[_0x7914('0x9e')]===-0x1){return _0x56769e;}return this[_0x7914('0xd')][_0x7914('0xa3')](util['format'](_0x7914('0xb1'),_0x57a037));};AGIVertices['prototype'][_0x7914('0x6')]=function(_0x325ca8){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xb2'),_0x325ca8['label']));return this[_0x7914('0xd')]['agi']([_0x325ca8[_0x7914('0xb3')],_0x325ca8['args']]);};AGIVertices[_0x7914('0x10')][_0x7914('0xb4')]=function(_0xf6f3ce){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xb5'),_0xf6f3ce[_0x7914('0xb6')]));if(this[_0x7914('0x7f')](_0xf6f3ce[_0x7914('0x60')])){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xb7'),_0xf6f3ce['timeout']));var _0x4f5658=this['channel']['wait'](_0xf6f3ce[_0x7914('0x60')]);if(_0x4f5658[_0x7914('0x9e')]===-0x1){return _0x4f5658;}}return this['channel'][_0x7914('0xb4')]();};AGIVertices[_0x7914('0x10')][_0x7914('0x3e')]=function(_0x21b101){logger[_0x7914('0x2b')](util[_0x7914('0x4a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x21b101[_0x7914('0xb6')]));if(!this['isConfigured'](_0x21b101['list_id'])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x21b101,_0x7914('0xb8'));}_0x21b101[_0x7914('0xb9')]=moment();if(this[_0x7914('0x7f')](_0x21b101[_0x7914('0xba')])){_0x21b101[_0x7914('0xb9')]=moment()[_0x7914('0xbb')](_0x21b101[_0x7914('0xba')],'minutes');}if(!this[_0x7914('0x7f')](_0x21b101[_0x7914('0x41')])){_0x21b101[_0x7914('0x41')]=0x2;}this[_0x7914('0x36')][_0x7914('0x6b')](this,_0x21b101);return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x21b101[_0x7914('0x3c')],_0x21b101[_0x7914('0x3d')],_0x21b101[_0x7914('0xb9')]));};AGIVertices['prototype'][_0x7914('0xbc')]=function(_0x329bb0){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xbd'),_0x329bb0[_0x7914('0xb6')]));var _0x2ab4b6=this['channel'][_0x7914('0x4e')](_0x329bb0['application'],_0x329bb0[_0x7914('0x74')]);if(_0x2ab4b6[_0x7914('0x9e')]===-0x1){return _0x2ab4b6;}return this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')]('Executed\x20command\x20%s\x20%s',_0x329bb0[_0x7914('0xbe')],_0x329bb0[_0x7914('0x74')]));};AGIVertices[_0x7914('0x10')][_0x7914('0xbf')]=function(_0x39df81){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xc0'),_0x39df81['label']));if(!this[_0x7914('0x7f')](_0x39df81['text'])){return this['channel']['noop']('no\x20text\x20configured');}var _0x587f53='\x22'+_0x39df81[_0x7914('0x54')]+'\x22';if(this['isConfigured'](_0x39df81[_0x7914('0x74')])){_0x587f53+=','+_0x39df81['options'];}var _0x487044=this['channel'][_0x7914('0x4e')](_0x7914('0xa5'),_0x587f53);if(_0x487044[_0x7914('0x9e')]===-0x1){return _0x487044;}return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x587f53));};AGIVertices[_0x7914('0x10')][_0x7914('0xc1')]=function(_0x517902){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xc2'),_0x517902['label']));if(!this[_0x7914('0x7f')](_0x517902[_0x7914('0x54')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xa4'));}var _0x5d5336='\x22'+_0x517902[_0x7914('0x54')]+'\x22';if(this[_0x7914('0x7f')](_0x517902[_0x7914('0x74')])){_0x5d5336+=','+_0x517902[_0x7914('0x74')];}var _0x1ceaf2=this[_0x7914('0xd')][_0x7914('0x4e')](_0x7914('0xa5'),_0x5d5336);if(_0x1ceaf2[_0x7914('0x9e')]===-0x1){return _0x1ceaf2;}return this[_0x7914('0xd')][_0x7914('0xa3')](util['format'](_0x7914('0xa6'),_0x5d5336));};AGIVertices['prototype']['lumenvoxasr']=function(_0x4ca313){logger[_0x7914('0x2b')](util['format'](_0x7914('0xc3'),_0x4ca313[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0x4ca313['grammar'])){return this[_0x7914('0xd')]['noop']('no\x20grammar\x20configured');}var _0x18afa9=_0x4ca313[_0x7914('0xa9')];if(this['isConfigured'](_0x4ca313[_0x7914('0x74')])){_0x18afa9+=','+_0x4ca313[_0x7914('0x74')];}var _0x3a5760=this[_0x7914('0xd')][_0x7914('0x4e')](_0x7914('0xab'),_0x18afa9);if(_0x3a5760[_0x7914('0x9e')]===-0x1){return _0x3a5760;}var _0x1274df=this[_0x7914('0x9d')]('RECOG_CONFIDENCE()',_0x7914('0xc4'));if(_0x1274df[_0x7914('0x9e')]===-0x1){return _0x1274df;}var _0x1ce06c=this[_0x7914('0x9d')](_0x7914('0xc5'),_0x7914('0xc6'));if(_0x1ce06c[_0x7914('0x9e')]===-0x1){return _0x1ce06c;}var _0x478b32=this[_0x7914('0x9d')](_0x7914('0xaf'),_0x7914('0xc7'));if(_0x478b32[_0x7914('0x9e')]===-0x1){return _0x478b32;}return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x18afa9));};AGIVertices[_0x7914('0x10')]['sestekasr']=function(_0x1ea71d){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xc8'),_0x1ea71d[_0x7914('0xb6')]));if(!this['isConfigured'](_0x1ea71d['grammar'])){return this['channel'][_0x7914('0xa3')](_0x7914('0xaa'));}var _0x13e5e5=_0x1ea71d['grammar'];if(this['isConfigured'](_0x1ea71d[_0x7914('0x74')])){_0x13e5e5+=','+_0x1ea71d[_0x7914('0x74')];}var _0x272cc3=this[_0x7914('0xd')][_0x7914('0x4e')]('MRCPRecog',_0x13e5e5);if(_0x272cc3[_0x7914('0x9e')]===-0x1){return _0x272cc3;}var _0x45dd40=this['getAndSetVariable'](_0x7914('0xac'),_0x7914('0xc9'));if(_0x45dd40[_0x7914('0x9e')]===-0x1){return _0x45dd40;}var _0x5e4434=this[_0x7914('0x9d')](_0x7914('0xc5'),_0x7914('0xca'));if(_0x5e4434['result']===-0x1){return _0x5e4434;}var _0x4486a=this[_0x7914('0x9d')]('RECOG_INSTANCE()',_0x7914('0xcb'));if(_0x4486a[_0x7914('0x9e')]===-0x1){return _0x4486a;}return this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')](_0x7914('0xb1'),_0x13e5e5));};AGIVertices[_0x7914('0x10')][_0x7914('0xcc')]=function(_0xe9fc06){logger[_0x7914('0x2b')](util['format'](_0x7914('0xcd'),_0xe9fc06[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0xe9fc06['odbc_id'])){return this[_0x7914('0xd')][_0x7914('0x29')](_0xe9fc06,_0x7914('0xce'));}var _0x5789e5=this[_0x7914('0x17')][_0x7914('0x6b')](this,_0xe9fc06[_0x7914('0xcf')]);if(!_0x5789e5){return this[_0x7914('0xd')][_0x7914('0x29')](_0xe9fc06,_0x7914('0xd0'));}if(!this[_0x7914('0x7f')](_0xe9fc06['query'])){return this['channel'][_0x7914('0x29')](_0xe9fc06,'no\x20query\x20configured');}var _0x24fc20=_0xe9fc06['query'][_0x7914('0x50')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0xd1'),_0x24fc20));var _0x203b1c=this[_0x7914('0x27')][_0x7914('0x6b')](this,_0x5789e5,_0x24fc20);this['createSquareDetailsReport'][_0x7914('0x6b')](this,_0xe9fc06,_0x24fc20);if(!this[_0x7914('0x7f')](_0xe9fc06[_0x7914('0xd2')])){return this[_0x7914('0xd')]['noop'](_0x7914('0xd3'));}var _0x2075d2=this[_0x7914('0x11')][_0x7914('0x6b')](this,_0xe9fc06[_0x7914('0xd2')]);if(!_0x2075d2){return this[_0x7914('0xd')][_0x7914('0x29')](_0xe9fc06,'no\x20variable\x20found');}var _0x1d8080=this;_0x203b1c[_0x7914('0xd4')](function(_0x5061a9,_0x5048c3){Object[_0x7914('0xd5')](_0x5061a9)['forEach'](function(_0x2028a2){_0x1d8080['channel'][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0xd6'),_0x2075d2,_0x5048c3,_0x2028a2),_0x5061a9[_0x2028a2]);});});this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0xd7'),_0x2075d2),_0x203b1c[_0x7914('0x95')]);return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0xd8'),_0x2075d2));};AGIVertices[_0x7914('0x10')][_0x7914('0xd9')]=function(_0xe27b6d){logger[_0x7914('0xda')](util[_0x7914('0x4a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xe27b6d[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0xe27b6d['sip_id'])){return this[_0x7914('0xd')][_0x7914('0x29')](_0xe27b6d,_0x7914('0xdb'));}var _0x1e619c=this['getUser'][_0x7914('0x6b')](this,_0xe27b6d[_0x7914('0xdc')]);if(!_0x1e619c){return this[_0x7914('0xd')][_0x7914('0x29')](_0xe27b6d,'no\x20user\x20found');}var _0x14ff40=this[_0x7914('0xd')][_0x7914('0x4e')]('DIAL',[util['format'](_0x7914('0xdd'),_0x1e619c),_0xe27b6d['timeout'],_0xe27b6d[_0x7914('0xde')],_0xe27b6d[_0x7914('0x5e')]]);if(_0x14ff40[_0x7914('0x9e')]===-0x1){return _0x14ff40;}return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0xdf'),_0x7914('0xe0')));};AGIVertices[_0x7914('0x10')][_0x7914('0xe1')]=function(_0x3985bc){logger[_0x7914('0x2b')](util['format'](_0x7914('0xe2'),_0x3985bc[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0x3985bc[_0x7914('0x76')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xe3'));}if(!this[_0x7914('0x7f')](_0x3985bc[_0x7914('0x54')])){return this['channel'][_0x7914('0xa3')](_0x7914('0xa4'));}this[_0x7914('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x3985bc);this[_0x7914('0x35')](_0x3985bc['text'],'in','','');this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0xe4'),_0x3985bc['text']));var _0x1614fa=this[_0x7914('0x75')]['sync'](this,_0x3985bc);if(_0x1614fa){for(var _0x195e8e in _0x1614fa){if(_0x1614fa[_0x7914('0x8f')](_0x195e8e)){this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0xe5'),_0x195e8e['toUpperCase']()),_0x1614fa[_0x195e8e]);}}this['createSquareMessage'](_0x1614fa[_0x7914('0xe6')],'out',_0x7914('0xe1'),'');return this[_0x7914('0xd')][_0x7914('0xa3')](util['format'](_0x7914('0xe7'),_0x1614fa[_0x7914('0xe6')]));}return this[_0x7914('0xd')][_0x7914('0x29')](_0x3985bc,_0x7914('0xe8'));};AGIVertices[_0x7914('0x10')][_0x7914('0xe9')]=function(_0x1dbfc4){logger['info'](util[_0x7914('0x4a')](_0x7914('0xea'),_0x1dbfc4[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0x1dbfc4[_0x7914('0xeb')])){return this['channel'][_0x7914('0xa3')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x1dbfc4[_0x7914('0x79')])){return this[_0x7914('0xd')][_0x7914('0xa3')]('no\x20client_email\x20configured');}if(!this[_0x7914('0x7f')](_0x1dbfc4[_0x7914('0xec')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xed'));}if(!this['isConfigured'](_0x1dbfc4['dialogflowV2_language'])){return this[_0x7914('0xd')]['noop'](_0x7914('0xee'));}if(!this[_0x7914('0x7f')](_0x1dbfc4['text'])){return this['channel'][_0x7914('0xa3')]('no\x20text\x20configured');}this['channel'][_0x7914('0xef')]=!![];this[_0x7914('0x2e')](_0x1dbfc4);this[_0x7914('0x35')](_0x1dbfc4[_0x7914('0x54')],'in','','');this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0xf0'),_0x1dbfc4['text']));var _0x361e8c=this[_0x7914('0x78')][_0x7914('0x6b')](this,_0x1dbfc4);if(_0x361e8c){for(var _0x9d7e57 in _0x361e8c){if(_0x361e8c['hasOwnProperty'](_0x9d7e57)){if(_0x9d7e57!==_0x7914('0xf1')){this[_0x7914('0xd')]['setVariable'](util['format'](_0x7914('0xe5'),_0x9d7e57[_0x7914('0xf2')]()),_0x361e8c[_0x9d7e57]);}}}this[_0x7914('0x35')](_0x361e8c[_0x7914('0xe6')],_0x7914('0xf3'),_0x7914('0xe9'),_0x361e8c[_0x7914('0xf1')]);return this[_0x7914('0xd')]['noop'](util['format'](_0x7914('0xf4'),_0x361e8c[_0x7914('0xe6')]));}return this['channel']['error'](_0x1dbfc4,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x7914('0xf5')]=function(_0x593ca1){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0xf6'),_0x593ca1['label']));if(!this['isConfigured'](_0x593ca1[_0x7914('0xf7')])){return this['channel'][_0x7914('0xa3')](_0x7914('0xf8'));}if(!this['isConfigured'](_0x593ca1['username'])){return this[_0x7914('0xd')]['noop'](_0x7914('0xf9'));}if(!this['isConfigured'](_0x593ca1[_0x7914('0xfa')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xfb'));}if(!this['isConfigured'](_0x593ca1[_0x7914('0xfc')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xa4'));}this[_0x7914('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x593ca1);this[_0x7914('0x35')](_0x593ca1[_0x7914('0x54')],'in','','');this[_0x7914('0xd')][_0x7914('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x593ca1[_0x7914('0x54')]));var _0x2ea023=this[_0x7914('0xfd')][_0x7914('0x6b')](this,_0x593ca1);if(_0x2ea023){for(var _0x20d92c in _0x2ea023){if(_0x2ea023[_0x7914('0x8f')](_0x20d92c)){this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0xfe'),_0x20d92c['toUpperCase']()),_0x2ea023[_0x20d92c]);}}this[_0x7914('0x35')](_0x2ea023[_0x7914('0xe6')],_0x7914('0xf3'),_0x7914('0xf5'),'');if(_0x2ea023[_0x7914('0xff')]){this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')](_0x7914('0x100'),_0x2ea023['audiofile']));var _0x4ad444=this[_0x7914('0xd')]['streamFile'](_0x2ea023['audiofile']);try{fs[_0x7914('0x101')](_0x2ea023['audiofile']+_0x7914('0x102'));}catch(_0x241d3c){logger['error'](_0x241d3c);}return _0x4ad444;}else{return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('SestekNDA\x20Result\x20%s',_0x2ea023[_0x7914('0xe6')]));}}return this[_0x7914('0xd')][_0x7914('0x29')](_0x593ca1,_0x7914('0x103'));};AGIVertices[_0x7914('0x10')][_0x7914('0x104')]=function(_0x4c9da9){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x105'),_0x4c9da9[_0x7914('0xb6')]));return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0x104'));};AGIVertices[_0x7914('0x10')][_0x7914('0x106')]=function(_0xd9154e){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x107'),_0xd9154e[_0x7914('0xb6')]));var _0x29194b='';if(_0xd9154e['trunk_id']){if(!this[_0x7914('0x7f')](_0xd9154e['trunk_id'])){return this[_0x7914('0xd')][_0x7914('0x29')](_0xd9154e,_0x7914('0x108'));}else{var _0x48051f=parseInt(_0xd9154e['trunk_id'],0xa);if(isNaN(_0x48051f)){_0x29194b=_0xd9154e[_0x7914('0x109')];}else{_0x29194b=this[_0x7914('0x10a')][_0x7914('0x6b')](this,_0xd9154e[_0x7914('0x109')]);if(!_0x29194b){return this[_0x7914('0xd')][_0x7914('0x29')](_0xd9154e,'no\x20trunk\x20found');}}}}else if(_0xd9154e[_0x7914('0x10b')]){_0x29194b=_0xd9154e[_0x7914('0x10b')];}else{return this[_0x7914('0xd')][_0x7914('0x29')](_0xd9154e,_0x7914('0x108'));}var _0x31849d=this[_0x7914('0xd')][_0x7914('0x4e')]('DIAL',[util[_0x7914('0x4a')](_0x7914('0x10c'),_0x29194b,_0xd9154e[_0x7914('0x3c')]),_0xd9154e['timeout'],_0xd9154e[_0x7914('0xde')],_0xd9154e[_0x7914('0x5e')]]);if(_0x31849d[_0x7914('0x9e')]===-0x1){return _0x31849d;}return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('Executed\x20command\x20%s',_0x7914('0xe0')));};AGIVertices[_0x7914('0x10')]['finally']=function(_0x38e71f){logger[_0x7914('0x2b')](util[_0x7914('0x4a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x38e71f[_0x7914('0xb6')]));return this[_0x7914('0xd')]['noop'](_0x7914('0x10d'));};AGIVertices[_0x7914('0x10')][_0x7914('0xb')]=function(_0x227ba6){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x10e'),_0x227ba6[_0x7914('0xb6')]));if(_0x227ba6[_0x7914('0xa1')]===0x0){return this['maxRetry'](_0x227ba6);}_0x227ba6[_0x7914('0xa1')]-=0x1;if(!this[_0x7914('0x7f')](_0x227ba6[_0x7914('0x10f')])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x227ba6,_0x7914('0x110'));}var _0x54ed99=this[_0x7914('0x1b')][_0x7914('0x6b')](this,_0x227ba6['file_id']);if(!_0x54ed99){return this[_0x7914('0xd')][_0x7914('0x29')](_0x227ba6,_0x7914('0x111'));}if(!this[_0x7914('0x7f')](_0x227ba6[_0x7914('0xd2')])){return this['channel'][_0x7914('0x29')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x57fe81=this[_0x7914('0xd')][_0x7914('0x112')](_0x54ed99,_0x227ba6[_0x7914('0x113')],_0x227ba6[_0x7914('0x114')]);var _0x131d85=_0x57fe81[_0x7914('0x9e')]?_0x57fe81['result'][_0x7914('0x40')]():'';logger['info'](_0x7914('0x115'),JSON['stringify'](_0x57fe81));if(_0x57fe81[_0x7914('0x9e')]===-0x1){this[_0x7914('0x2e')]['sync'](this,_0x227ba6,_0x131d85);return _0x57fe81;}else if(_0x57fe81['extra']==='timeout'){_0x57fe81['result']=_0x131d85[_0x7914('0x95')]>=parseInt(_0x227ba6[_0x7914('0x116')])?'x':'i';}else{_0x57fe81[_0x7914('0x9e')]=_0x131d85['length']>=parseInt(_0x227ba6[_0x7914('0x116')])&&_0x131d85[_0x7914('0x95')]<=parseInt(_0x227ba6['maxdigit'])?'x':'i';}var _0x361a29=this[_0x7914('0x11')][_0x7914('0x6b')](this,_0x227ba6[_0x7914('0xd2')]);if(!_0x361a29){return this[_0x7914('0xd')]['error'](_0x227ba6,'no\x20variable\x20found');}this['channel']['setVariable'](_0x361a29,_0x131d85);if(this[_0x7914('0x7f')](_0x227ba6['hiddendigitsnum'])){var _0x5d958c=parseInt(_0x227ba6[_0x7914('0x117')],0xa);var _0x54533a=rs[_0x7914('0x118')]({'charset':'*','length':_0x5d958c});var _0x5d6caf=_0x131d85[_0x7914('0x95')];if(_0x5d6caf>0x0){if(_0x5d6caf>_0x5d958c){this[_0x7914('0x2e')]['sync'](this,_0x227ba6,_0x227ba6[_0x7914('0x119')]===_0x7914('0x11a')?_0x54533a+_0x131d85[_0x7914('0x11b')](_0x5d958c):_0x131d85['substr'](0x0,_0x5d6caf-_0x5d958c)+_0x54533a);}else{this[_0x7914('0x2e')]['sync'](this,_0x227ba6,rs['generate']({'charset':'*','length':_0x5d6caf}));}}else{this[_0x7914('0x2e')][_0x7914('0x6b')](this,_0x227ba6,'');}}else{this['createSquareDetailsReport'][_0x7914('0x6b')](this,_0x227ba6,_0x131d85);}return _0x57fe81;};AGIVertices['prototype'][_0x7914('0xc')]=function(_0x27b1fa){logger['info'](util[_0x7914('0x4a')](_0x7914('0x11c'),_0x27b1fa[_0x7914('0xb6')]));return this[_0x7914('0xb')](_0x27b1fa);};AGIVertices['prototype'][_0x7914('0x11d')]=function(_0x34d851){logger[_0x7914('0x2b')](util[_0x7914('0x4a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x34d851[_0x7914('0xb6')]));this[_0x7914('0x2e')]['sync'](this,_0x34d851,_0x34d851[_0x7914('0x11e')]);return this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')]('GOAL\x20%s',_0x34d851[_0x7914('0x11e')]));};AGIVertices[_0x7914('0x10')][_0x7914('0x11f')]=function(_0x4fec5c){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x120'),_0x4fec5c['label']));if(!this[_0x7914('0x7f')](_0x4fec5c[_0x7914('0x82')])||!this['isConfigured'](_0x4fec5c[_0x7914('0x83')])){return this[_0x7914('0xd')][_0x7914('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7914('0x7f')](_0x4fec5c['text'])){return this['channel'][_0x7914('0xa3')](_0x7914('0xa4'));}this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')](_0x7914('0x121'),_0x4fec5c[_0x7914('0x54')]));var _0x54f7fa=this[_0x7914('0x81')][_0x7914('0x6b')](this,_0x4fec5c);if(_0x54f7fa){this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')]('aws\x20Polly\x20%s\x20file\x20created',_0x54f7fa));var _0x41b27f=this[_0x7914('0xd')][_0x7914('0x122')](_0x54f7fa);try{fs[_0x7914('0x101')](_0x54f7fa+_0x7914('0x102'));}catch(_0x108a63){logger[_0x7914('0x29')](_0x108a63);}return _0x41b27f;}return this[_0x7914('0xd')][_0x7914('0x29')](_0x4fec5c,_0x7914('0x123'));};AGIVertices[_0x7914('0x10')][_0x7914('0x124')]=function(_0x4e52a5){logger[_0x7914('0x2b')](util['format'](_0x7914('0x125'),_0x4e52a5['label']));if(!this[_0x7914('0x7f')](_0x4e52a5[_0x7914('0x82')])||!this[_0x7914('0x7f')](_0x4e52a5[_0x7914('0x83')])){return this[_0x7914('0xd')]['noop'](_0x7914('0x126'));}if(!this[_0x7914('0x7f')](_0x4e52a5[_0x7914('0x8a')])){return this['channel']['noop'](_0x7914('0x127'));}if(!this[_0x7914('0x7f')](_0x4e52a5[_0x7914('0x54')])){return this[_0x7914('0xd')][_0x7914('0xa3')]('no\x20text\x20configured');}this[_0x7914('0xd')][_0x7914('0xef')]=!![];this['createSquareDetailsReport'](_0x4e52a5);this[_0x7914('0x35')](_0x4e52a5[_0x7914('0x54')],'in','','');this[_0x7914('0xd')]['noop'](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x4e52a5['text']));var _0x1ebeb5=this[_0x7914('0x88')][_0x7914('0x6b')](this,_0x4e52a5);if(_0x1ebeb5){for(var _0x361e7d in _0x1ebeb5){if(_0x1ebeb5['hasOwnProperty'](_0x361e7d)&&_[_0x7914('0x90')](_0x1ebeb5[_0x361e7d])){this['channel'][_0x7914('0x99')](util[_0x7914('0x4a')]('AWS_LEX_%s',_0x361e7d['toUpperCase']()),_0x1ebeb5[_0x361e7d]);}}if(_[_0x7914('0x38')](_0x1ebeb5[_0x7914('0x72')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0x128'));}else{this['createSquareMessage'](_0x1ebeb5[_0x7914('0x72')],'out',_0x7914('0x129'),'');return this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')](_0x7914('0x12a'),_0x1ebeb5[_0x7914('0x72')]));}}return this[_0x7914('0xd')]['error'](_0x4e52a5,_0x7914('0x12b'));};AGIVertices[_0x7914('0x10')][_0x7914('0x12c')]=function(_0x2931f0){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x12d'),_0x2931f0[_0x7914('0xb6')],_0x2931f0[_0x7914('0x60')]));if(!this['isConfigured'](_0x2931f0[_0x7914('0x76')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xe3'));}var _0x443940=_0x7914('0x12e');var _0xde3f7d=util[_0x7914('0x4a')](_0x7914('0x12f'),FILES_PATH,rs['generate'](0x4));var _0xa0f653=util['format'](_0x7914('0x97'),_0xde3f7d,_0x443940);var _0x201340=!![];if(_0x2931f0[_0x7914('0x130')]===_0x7914('0x131')){_0x201340=![];}var _0xcbeeb1=this[_0x7914('0xd')][_0x7914('0x132')](_0xde3f7d,_0x443940,_0x2931f0[_0x7914('0x133')],_0x2931f0[_0x7914('0x60')],undefined,_0x201340);if(_0xcbeeb1[_0x7914('0x9e')]!==-0x1){this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x134'),_0xa0f653));var _0x2fe4f6=this[_0x7914('0x8b')][_0x7914('0x6b')](this,_0x2931f0,_0xa0f653);if(_0x2fe4f6){for(var _0x2e459c in _0x2fe4f6){if(_0x2fe4f6[_0x7914('0x8f')](_0x2e459c)){this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')]('GOOGLE_ASR_%s',_0x2e459c[_0x7914('0xf2')]()),_0x2fe4f6[_0x2e459c]);}}return this[_0x7914('0xd')]['noop'](util['format'](_0x7914('0x135'),JSON[_0x7914('0x6e')](_0x2fe4f6)));}}return _0xcbeeb1;};AGIVertices['prototype']['tildeasr']=function(_0x4ad436){logger['info'](util['format'](_0x7914('0x136'),_0x4ad436['label']));if(!this[_0x7914('0x7f')](_0x4ad436['appid'])){return this['channel']['noop'](_0x7914('0x137'));}if(!this['isConfigured'](_0x4ad436[_0x7914('0x8d')])){return this['channel'][_0x7914('0xa3')](_0x7914('0x138'));}var _0x5cc0b5=_0x7914('0x12e');var _0x4d710e=util[_0x7914('0x4a')](_0x7914('0x12f'),FILES_PATH,rs[_0x7914('0x118')](0x4));var _0x21c2f2=util['format']('%s.%s',_0x4d710e,_0x5cc0b5);var _0x55f5a5=!![];if(_0x4ad436['beep']==='NOBEEP'){_0x55f5a5=![];}var _0x4b3682=this[_0x7914('0xd')]['recordFile'](_0x4d710e,_0x5cc0b5,_0x4ad436[_0x7914('0x133')],_0x4ad436[_0x7914('0x60')],undefined,_0x55f5a5);if(_0x4b3682[_0x7914('0x9e')]!==-0x1){this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x139'),_0x21c2f2));var _0x1df60e=this['tildeASR'][_0x7914('0x6b')](this,_0x4ad436,_0x21c2f2);if(_0x1df60e){for(var _0x5a4bc5 in _0x1df60e){if(_0x1df60e['hasOwnProperty'](_0x5a4bc5)){this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0x13a'),_0x5a4bc5[_0x7914('0xf2')]()),_0x1df60e[_0x5a4bc5]);}}return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x13b'),JSON[_0x7914('0x6e')](_0x1df60e)));}}return _0x4b3682;};AGIVertices['prototype'][_0x7914('0x13c')]=function(_0x4c21da){logger[_0x7914('0x2b')](util['format'](_0x7914('0x13d'),_0x4c21da[_0x7914('0xb6')]));return this[_0x7914('0xd')]['continueAt'](_0x4c21da[_0x7914('0x13e')],_0x4c21da['extension'],_0x4c21da['priority']);};AGIVertices[_0x7914('0x10')][_0x7914('0x13f')]=function(_0xd0526b){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x140'),_0xd0526b[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0xd0526b[_0x7914('0x141')])){return this[_0x7914('0xd')]['error'](_0xd0526b,'no\x20condition\x20configured');}try{var _0x211ea7=eval(_0xd0526b[_0x7914('0x141')])?_0x7914('0x142'):_0x7914('0x143');this[_0x7914('0xd')][_0x7914('0xa3')](util['format'](_0x7914('0x144'),_0xd0526b['condition'],_0x211ea7));return{'code':0xc8,'result':_0x211ea7};}catch(_0x26a6ac){return{'code':0xc8,'result':_0x7914('0x143')};}};AGIVertices[_0x7914('0x10')][_0x7914('0x145')]=function(_0xd12a72){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x146'),_0xd12a72['label']));if(!this[_0x7914('0x7f')](_0xd12a72[_0x7914('0x147')])){return this[_0x7914('0xd')]['error'](_0xd12a72,_0x7914('0x148'));}var _0x438f9c=this[_0x7914('0x21')][_0x7914('0x6b')](this,_0xd12a72[_0x7914('0x147')]);if(!_0x438f9c){return this['channel']['error'](_0xd12a72,_0x7914('0x149'));}for(var _0x2b4ab3=0x0;_0x2b4ab3<_0x438f9c['length'];_0x2b4ab3+=0x1){var _0x1f26a5=this['channel'][_0x7914('0x11')](util['format'](_0x7914('0x14a'),_0x438f9c[_0x2b4ab3]));if(_0x1f26a5[_0x7914('0x9e')]===-0x1){return _0x1f26a5;}logger['info'](util[_0x7914('0x4a')](_0x7914('0x14b'),_0x438f9c[_0x2b4ab3],_0x1f26a5[_0x7914('0x9c')]));if(_0x1f26a5['extra']==='true'){logger[_0x7914('0x2b')](util['format'](_0x7914('0x14b'),_0x438f9c[_0x2b4ab3],_0x7914('0x142')));this['channel']['noop'](util[_0x7914('0x4a')](_0x7914('0x14b'),_0x438f9c[_0x2b4ab3],'true'));return{'code':0xc8,'result':_0x7914('0x142')};}else{logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x14b'),_0x438f9c[_0x2b4ab3],_0x7914('0x143')));this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')]('IFTIME\x20%s\x20%s',_0x438f9c[_0x2b4ab3],'false'));}}return{'code':0xc8,'result':_0x7914('0x143')};};AGIVertices[_0x7914('0x10')][_0x7914('0x14c')]=function(_0x28ba72){logger['info'](util[_0x7914('0x4a')](_0x7914('0x14d'),_0x28ba72[_0x7914('0xb6')]));return this[_0x7914('0xd')][_0x7914('0x14c')]();};AGIVertices['prototype'][_0x7914('0x14e')]=function(_0x426562){logger['info'](util['format'](_0x7914('0x14f'),_0x426562['label']));if(!this[_0x7914('0x7f')](_0x426562['key'])){return this['channel'][_0x7914('0xa3')](_0x7914('0xe3'));}var _0x1f6490=_0x7914('0x12e');var _0x386fb3=util[_0x7914('0x4a')](_0x7914('0x12f'),FILES_PATH,rs[_0x7914('0x118')](0x4));var _0x4a7782=util[_0x7914('0x4a')](_0x7914('0x97'),_0x386fb3,_0x1f6490);var _0x577b40=!![];if(_0x426562['beep']===_0x7914('0x131')){_0x577b40=![];}var _0x487560=this['channel'][_0x7914('0x132')](_0x386fb3,_0x1f6490,_0x426562[_0x7914('0x133')],_0x426562['timeout'],undefined,_0x577b40);if(_0x487560['result']!==-0x1){this[_0x7914('0xd')][_0x7914('0xa3')](util['format']('ispeech\x20%s\x20file\x20created',_0x4a7782));var _0x162ef0=this[_0x7914('0x7e')]['sync'](this,_0x426562,_0x4a7782);if(_0x162ef0){for(var _0x2c3b09 in _0x162ef0){if(_0x162ef0[_0x7914('0x8f')](_0x2c3b09)){this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')]('ISPEECH_ASR_%s',_0x2c3b09[_0x7914('0xf2')]()),_0x162ef0[_0x2c3b09]);}}return this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')](_0x7914('0x150'),JSON[_0x7914('0x6e')](_0x162ef0)));}}return _0x487560;};AGIVertices['prototype']['ispeechtts']=function(_0x599587){logger[_0x7914('0x2b')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x599587['label']));if(!this['isConfigured'](_0x599587[_0x7914('0x76')])){return this[_0x7914('0xd')][_0x7914('0xa3')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x599587[_0x7914('0x54')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xa4'));}this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')](_0x7914('0x151'),_0x599587[_0x7914('0x54')]));var _0x2a61e8=this[_0x7914('0x7b')]['sync'](this,_0x599587);if(_0x2a61e8){this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x152'),_0x2a61e8));var _0xc98dd6=this[_0x7914('0xd')][_0x7914('0x122')](_0x2a61e8,_0x599587[_0x7914('0x133')]);try{fs[_0x7914('0x101')](_0x2a61e8+'.wav');}catch(_0x1701c1){logger[_0x7914('0x29')](_0x1701c1);}return _0xc98dd6;}return this[_0x7914('0xd')][_0x7914('0x29')](_0x599587,_0x7914('0x153'));};AGIVertices[_0x7914('0x10')]['login']=function(_0x542527){logger[_0x7914('0x2b')](util['format'](_0x7914('0x154'),_0x542527[_0x7914('0xb6')]));if(!this['isConfigured'](_0x542527[_0x7914('0x155')])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x542527,'no\x20find\x20by\x20configured');}logger['info'](util[_0x7914('0x4a')](_0x7914('0x156'),this[_0x7914('0xd')]['callerid'],_0x542527[_0x7914('0x155')]));var _0x3029ba=this[_0x7914('0x48')]['sync'](this,_0x542527[_0x7914('0x155')]);if(_0x3029ba){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x157'),this[_0x7914('0xd')][_0x7914('0x31')],_0x542527[_0x7914('0x155')]));this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7914('0xd')][_0x7914('0x31')],_0x542527[_0x7914('0x155')]));return{'code':0xc8,'result':_0x7914('0x158')};}else{logger[_0x7914('0x2b')](util['format'](_0x7914('0x159'),this[_0x7914('0xd')][_0x7914('0x31')],_0x542527['findBy']));this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x159'),this[_0x7914('0xd')]['callerid'],_0x542527[_0x7914('0x155')]));return{'code':0xc8,'result':_0x7914('0x15a')};}};AGIVertices[_0x7914('0x10')][_0x7914('0x15b')]=function(_0x427cf9){logger['info'](util['format'](_0x7914('0x15c'),_0x427cf9[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0x427cf9[_0x7914('0x155')])){return this[_0x7914('0xd')]['error'](_0x427cf9,_0x7914('0x15d'));}logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x156'),this[_0x7914('0xd')][_0x7914('0x31')],_0x427cf9['findBy']));var _0x16716b=this[_0x7914('0x47')][_0x7914('0x6b')](this,_0x427cf9['findBy']);if(_0x16716b){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x157'),this['channel'][_0x7914('0x31')],_0x427cf9[_0x7914('0x155')]));this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7914('0xd')]['callerid'],_0x427cf9['findBy']));return{'code':0xc8,'result':_0x7914('0x158')};}else{logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x159'),this['channel'][_0x7914('0x31')],_0x427cf9['findBy']));this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x159'),this[_0x7914('0xd')][_0x7914('0x31')],_0x427cf9[_0x7914('0x155')]));return{'code':0xc8,'result':_0x7914('0x15a')};}};AGIVertices[_0x7914('0x10')][_0x7914('0x15e')]=function(_0xf4f683){logger['info'](util[_0x7914('0x4a')](_0x7914('0x15f'),_0xf4f683[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0xf4f683[_0x7914('0x160')])){return this[_0x7914('0xd')][_0x7914('0x29')](_0xf4f683,_0x7914('0x161'));}this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x162'),_0xf4f683['operation']));var _0x44ed32=eval(_0xf4f683[_0x7914('0x160')]);if(!this[_0x7914('0x7f')](_0xf4f683[_0x7914('0xd2')])){return this[_0x7914('0xd')][_0x7914('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x48a561=this[_0x7914('0x11')][_0x7914('0x6b')](this,_0xf4f683[_0x7914('0xd2')]);if(!_0x48a561){return this[_0x7914('0xd')]['error'](_0xf4f683,'no\x20variable\x20found');}if(_[_0x7914('0x98')](_0x44ed32)){var _0x56770c=this;_0x44ed32[_0x7914('0xd4')](function(_0x22a213,_0x9a37c1){_0x56770c[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0x163'),_0x48a561,_0x9a37c1),_0x22a213);});return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x164'),_0x48a561));}else{return this['channel'][_0x7914('0x99')](_0x48a561,_0x44ed32);}};AGIVertices[_0x7914('0x10')]['menu']=function(_0x1b71e1){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x165'),_0x1b71e1['label']));if(_0x1b71e1['retry']===0x0){return this['maxRetry'](_0x1b71e1);}_0x1b71e1['retry']-=0x1;if(!this[_0x7914('0x7f')](_0x1b71e1['file_id'])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x1b71e1,_0x7914('0x110'));}var _0xde2770=this[_0x7914('0x1b')][_0x7914('0x6b')](this,_0x1b71e1['file_id']);if(!_0xde2770){return this['channel']['error'](_0x1b71e1,_0x7914('0x111'));}var _0x4f5d4a=this[_0x7914('0xd')]['getData'](_0xde2770,_0x1b71e1[_0x7914('0x113')],_0x1b71e1[_0x7914('0x166')]);var _0x346c77=_0x4f5d4a[_0x7914('0x9e')];if(_0x4f5d4a[_0x7914('0x9e')]===-0x1){this[_0x7914('0x2e')][_0x7914('0x6b')](this,_0x1b71e1,'-1');return _0x4f5d4a;}else if(_0x4f5d4a[_0x7914('0x9c')]==='timeout'){_0x4f5d4a[_0x7914('0x9e')]=_0x4f5d4a[_0x7914('0x9e')]['length']>0x0?_0x4f5d4a['result']:'t';}else if(_[_0x7914('0x37')](_0x4f5d4a['result'])){_0x4f5d4a['result']='#';_0x346c77='#';}if(!this[_0x7914('0x7f')](_0x1b71e1[_0x7914('0xd2')])){this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xd3'));}else{var _0x354c42=this[_0x7914('0x11')][_0x7914('0x6b')](this,_0x1b71e1[_0x7914('0xd2')]);if(!_0x354c42){return this[_0x7914('0xd')]['error'](_0x1b71e1,_0x7914('0x167'));}this['channel'][_0x7914('0x99')](_0x354c42,_0x346c77);}this[_0x7914('0x2e')][_0x7914('0x6b')](this,_0x1b71e1,_0x346c77);return _0x4f5d4a;};AGIVertices[_0x7914('0x10')][_0x7914('0xa3')]=function(_0xda0f37){logger[_0x7914('0x2b')](util[_0x7914('0x4a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xda0f37[_0x7914('0xb6')]));return this[_0x7914('0xd')]['noop'](_0xda0f37[_0x7914('0x168')]||_0xda0f37[_0x7914('0xb6')]);};AGIVertices[_0x7914('0x10')][_0x7914('0x169')]=function(_0x319dfb){logger[_0x7914('0x2b')](util['format'](_0x7914('0x16a'),_0x319dfb['label']));if(!this[_0x7914('0x7f')](_0x319dfb[_0x7914('0x155')])){return this['channel'][_0x7914('0x29')](_0x319dfb,_0x7914('0x15d'));}logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x156'),this[_0x7914('0xd')][_0x7914('0x31')],_0x319dfb[_0x7914('0x155')]));var _0x36aba1=this[_0x7914('0x42')][_0x7914('0x6b')](this,_0x319dfb[_0x7914('0x16b')]);var _0x296dcf=this[_0x7914('0x44')][_0x7914('0x6b')](this,_0x319dfb[_0x7914('0x155')],_0x36aba1);if(_0x296dcf){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x157'),this['channel']['callerid'],_0x319dfb[_0x7914('0x155')]));this[_0x7914('0xd')][_0x7914('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x319dfb[_0x7914('0x155')]));return{'code':0xc8,'result':_0x7914('0x158')};}else{logger[_0x7914('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7914('0xd')][_0x7914('0x31')],_0x319dfb[_0x7914('0x155')]));this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x157'),this['channel'][_0x7914('0x31')],_0x319dfb['findBy']));return{'code':0xc8,'result':_0x7914('0x15a')};}};AGIVertices[_0x7914('0x10')][_0x7914('0x16c')]=function(_0xfef2ce){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x16d'),_0xfef2ce[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0xfef2ce[_0x7914('0x10f')])){return this[_0x7914('0xd')]['error'](_0xfef2ce,_0x7914('0x110'));}var _0x1f810e=this[_0x7914('0x1b')][_0x7914('0x6b')](this,_0xfef2ce['file_id']);if(!_0x1f810e){return this[_0x7914('0xd')][_0x7914('0x29')](_0xfef2ce,'no\x20file\x20audio\x20found');}var _0x169f1f=this['channel']['exec'](_0x7914('0x16e'),[_0x1f810e,_0xfef2ce['opts']]);if(_0x169f1f['result']===-0x1){return _0x169f1f;}return this['channel']['noop'](util['format'](_0x7914('0x16f'),_0x7914('0x16e'),_0x1f810e));};AGIVertices[_0x7914('0x10')][_0x7914('0x170')]=function(_0x19328b){logger[_0x7914('0x2b')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x19328b['label']));if(!this[_0x7914('0x7f')](_0x19328b[_0x7914('0x171')])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x19328b,_0x7914('0x172'));}var _0x28a6e3='';var _0x4f94ef=parseInt(_0x19328b[_0x7914('0x171')],0xa);if(isNaN(_0x4f94ef)){_0x28a6e3=_0x19328b[_0x7914('0x171')];}else{_0x28a6e3=this[_0x7914('0x173')][_0x7914('0x6b')](this,_0x19328b['queue_id']);if(!_0x28a6e3){return this[_0x7914('0xd')][_0x7914('0x29')](_0x19328b,_0x7914('0x174'));}}var _0x308631='';if(this[_0x7914('0x7f')](_0x19328b[_0x7914('0x10f')])){var _0x59c0ef=this['getSound'][_0x7914('0x6b')](this,_0x19328b['file_id']);if(_0x59c0ef){_0x308631=_0x59c0ef;}}this[_0x7914('0x2e')][_0x7914('0x6b')](this,_0x19328b,_0x28a6e3);if(_0x19328b[_0x7914('0xde')][_0x7914('0x175')]('x')<0x0){_0x19328b[_0x7914('0xde')]+='x';}if(_0x19328b[_0x7914('0xde')][_0x7914('0x175')]('X')<0x0){_0x19328b[_0x7914('0xde')]+='X';}this[_0x7914('0xd')][_0x7914('0x99')](_0x7914('0x176'),_0x28a6e3?_0x28a6e3[_0x7914('0x177')]():'');var _0x1ee896=this['channel']['exec']('QUEUE',[_0x28a6e3,_0x19328b[_0x7914('0xde')],_0x19328b[_0x7914('0x5e')],_0x308631,_0x19328b[_0x7914('0x60')],_0x19328b[_0x7914('0x6')],_0x19328b['macro'],_0x19328b[_0x7914('0x178')],'',_0x19328b['position']]);if(_0x1ee896[_0x7914('0x9e')]===-0x1){return _0x1ee896;}return this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x16f'),_0x7914('0x179'),_0x28a6e3));};AGIVertices[_0x7914('0x10')]['record']=function(_0x2535aa){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x17a'),_0x2535aa[_0x7914('0xb6')]));var _0x455c13=_0x2535aa['recordingFormat']||_0x7914('0x12e');var _0x968f3e=util['format'](_0x7914('0x17b'),this[_0x7914('0xd')]['uniqueid'],rs[_0x7914('0x118')](0x5));var _0x423f86=util[_0x7914('0x4a')](_0x7914('0x17c'),FILES_PATH,_0x968f3e,_0x455c13);var _0x4bc359=util[_0x7914('0x4a')](_0x7914('0x12f'),FILES_PATH,_0x968f3e);this[_0x7914('0x32')][_0x7914('0x6b')](this,_0x2535aa,_0x968f3e,_0x423f86);this['channel']['setVariable']('RECORDING_SAVENAME',_0x968f3e);logger[_0x7914('0x2b')](_0x7914('0x17d'),_0x4bc359,_0x455c13,_0x2535aa['escape_digits'],_0x2535aa[_0x7914('0x60')]);return this[_0x7914('0xd')][_0x7914('0x132')](_0x4bc359,_0x455c13,_0x2535aa[_0x7914('0x17e')],_0x2535aa[_0x7914('0x60')],undefined,!![]);};AGIVertices[_0x7914('0x10')][_0x7914('0x17f')]=function(_0x2339a2){logger['info'](util[_0x7914('0x4a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2339a2['label']));if(!this[_0x7914('0x7f')](_0x2339a2[_0x7914('0x5e')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0x180'));}var _0x47bc75=this[_0x7914('0x5d')][_0x7914('0x6b')](this,_0x2339a2);logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x181'),util['inspect'](_0x47bc75,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2339a2[_0x7914('0xd2')])){return this[_0x7914('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x66e788=this[_0x7914('0x11')][_0x7914('0x6b')](this,_0x2339a2[_0x7914('0xd2')]);if(!_0x66e788){return this[_0x7914('0xd')][_0x7914('0x29')](_0x2339a2,_0x7914('0x167'));}this[_0x7914('0xd')][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0x182'),_0x66e788),_0x47bc75[_0x7914('0x70')]?_0x47bc75[_0x7914('0x70')]:_0x7914('0x183'));this['channel'][_0x7914('0x99')](util[_0x7914('0x4a')](_0x7914('0x184'),_0x66e788),_0x47bc75[_0x7914('0x71')]?_0x47bc75[_0x7914('0x71')]:'OK');if(_0x47bc75[_0x7914('0x64')]){try{this[_0x7914('0x96')](_0x47bc75[_0x7914('0x64')],_0x66e788);}catch(_0x1ed357){logger[_0x7914('0x29')](util[_0x7914('0x4a')](_0x7914('0x185'),_0x66e788));}}return this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0xd8'),_0x66e788));};AGIVertices[_0x7914('0x10')][_0x7914('0x186')]=function(_0x2d4245){logger['info'](util[_0x7914('0x4a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2d4245['label']));return this[_0x7914('0xd')][_0x7914('0x187')](_0x2d4245[_0x7914('0x188')]['replace'](/\s+/g,''),_0x2d4245[_0x7914('0x17e')]);};AGIVertices[_0x7914('0x10')]['saynumber']=function(_0xe40415){logger['info'](util[_0x7914('0x4a')](_0x7914('0x189'),_0xe40415[_0x7914('0xb6')]));return this[_0x7914('0xd')]['sayNumber'](_0xe40415[_0x7914('0x61')][_0x7914('0x50')](/\s+/g,''),_0xe40415[_0x7914('0x17e')]);};AGIVertices[_0x7914('0x10')]['sayphonetic']=function(_0x381b7a){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x18a'),_0x381b7a[_0x7914('0xb6')]));return this[_0x7914('0xd')][_0x7914('0x18b')](_0x381b7a[_0x7914('0x54')],_0x381b7a[_0x7914('0x17e')]);};AGIVertices[_0x7914('0x10')][_0x7914('0x18c')]=function(_0x3abe67){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x18d'),_0x3abe67['label']));if(!this[_0x7914('0x7f')](_0x3abe67[_0x7914('0x18e')])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0x18f'));}var _0x15f5db=this['getMailAccount'][_0x7914('0x6b')](this,_0x3abe67[_0x7914('0x18e')]);if(!_0x15f5db||!_0x15f5db[_0x7914('0x190')]){return this[_0x7914('0xd')][_0x7914('0x29')](_0x3abe67,_0x7914('0x191'));}var _0x3856f0={'from':util[_0x7914('0x4a')](_0x7914('0x192'),_0x15f5db[_0x7914('0x13')],_0x15f5db['email']||_0x15f5db[_0x7914('0x190')][_0x7914('0x193')]),'to':_0x3abe67['to']||'','cc':_0x3abe67['cc']||'','bcc':_0x3abe67[_0x7914('0x194')]||'','subject':_0x3abe67[_0x7914('0x195')],'html':_0x3abe67[_0x7914('0x54')],'text':_0x3abe67[_0x7914('0x54')]};if(this[_0x7914('0x7f')](_0x3abe67[_0x7914('0x196')])){}logger['debug']('sendMail\x20message',JSON[_0x7914('0x6e')](_0x3856f0));this[_0x7914('0x2e')][_0x7914('0x6b')](this,_0x3abe67,_0x3abe67[_0x7914('0x18e')]);this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x15f5db[_0x7914('0x13')]));this[_0x7914('0x20')][_0x7914('0x6b')](this,_0x15f5db['smtpOptions'],_0x3856f0);return this['channel'][_0x7914('0xa3')](_0x7914('0x197'));};AGIVertices[_0x7914('0x10')][_0x7914('0x198')]=function(_0xe81a09){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x199'),_0xe81a09[_0x7914('0xb6')]));return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0x19a'));};AGIVertices[_0x7914('0x10')][_0x7914('0x19b')]=function(_0x4a07cf){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x19c'),_0x4a07cf[_0x7914('0xb6')]));if(!this['isConfigured'](_0x4a07cf['sms_account_id'])){return this['channel']['noop'](_0x7914('0x19d'));}var _0x1d0b6f=this[_0x7914('0x19e')][_0x7914('0x6b')](this,_0x4a07cf[_0x7914('0x19f')]);if(!_0x1d0b6f){return this[_0x7914('0xd')][_0x7914('0x29')](_0x4a07cf,_0x7914('0x1a0'));}var _0x14d17a={'body':_0x4a07cf[_0x7914('0x1a1')],'phone':_0x4a07cf['to']||'','SmsAccountId':_0x1d0b6f['id']};logger['debug'](_0x7914('0x1a2'),JSON[_0x7914('0x6e')](_0x14d17a));this['createSquareDetailsReport'][_0x7914('0x6b')](this,_0x4a07cf,_0x4a07cf[_0x7914('0x19f')]);this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x1a3'),_0x1d0b6f['name']));this[_0x7914('0x1a4')][_0x7914('0x6b')](this,_0x14d17a);return this['channel'][_0x7914('0xa3')](_0x7914('0x1a5'));};AGIVertices[_0x7914('0x10')][_0x7914('0x1a6')]=function(_0x16bb0a){logger[_0x7914('0x2b')](util[_0x7914('0x4a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x16bb0a['label']));if(!this[_0x7914('0x7f')](_0x16bb0a[_0x7914('0xd2')])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x16bb0a,_0x7914('0x1a7'));}var _0xc895a5=this['getVariable']['sync'](this,_0x16bb0a['variable_id']);if(!_0xc895a5){return this[_0x7914('0xd')][_0x7914('0x29')](_0x16bb0a,'no\x20variable\x20found');}return this[_0x7914('0xd')][_0x7914('0x99')](_0xc895a5,_0x16bb0a['variable_value']);};AGIVertices[_0x7914('0x10')][_0x7914('0x1a8')]=function(_0x2d5db1){logger['info'](util[_0x7914('0x4a')](_0x7914('0x1a9'),_0x2d5db1['label']));this['channel'][_0x7914('0xa3')](_0x7914('0x1aa'));if(_0x2d5db1[_0x7914('0xb4')]===_0x7914('0x1ab')){this['channel'][_0x7914('0xa3')](_0x7914('0x1ac'));return this[_0x7914('0xd')][_0x7914('0xb4')]();}return this['channel'][_0x7914('0xa3')]('Skipped\x20Answer');};AGIVertices[_0x7914('0x10')]['subproject']=function(_0x2f92c2){logger['info'](util['format'](_0x7914('0x1ad'),_0x2f92c2[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0x2f92c2[_0x7914('0x1ae')])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x2f92c2,_0x7914('0x1af'));}var _0x1bd261=this[_0x7914('0x16')]['sync'](this,_0x2f92c2['project_id']);if(!this[_0x7914('0x7f')](_0x1bd261)){return this['channel'][_0x7914('0x29')](_0x2f92c2,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2f92c2[_0x7914('0x1ae')]));}if(_0x1bd261===this[_0x7914('0xd')]['arg_1']){return this[_0x7914('0xd')]['error'](_0x2f92c2,_0x7914('0x1b0'));}this['createSquareDetailsReport']['sync'](this,_0x2f92c2,_0x1bd261);var _0x4726c1=this[_0x7914('0xd')][_0x7914('0x4e')](_0x7914('0x1b1'),util[_0x7914('0x4a')](_0x7914('0x1b2'),config[_0x7914('0x6')][_0x7914('0x1b3')]||'127.0.0.1',_0x1bd261,this[_0x7914('0xd')][_0x7914('0x30')]));if(_0x4726c1['result']===-0x1){return _0x4726c1;}return this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x16f'),_0x7914('0x1b1'),_0x1bd261));};AGIVertices['prototype'][_0x7914('0x1b4')]=function(_0x40ba84){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x1b5'),_0x40ba84['label']));var _0x2f3f72=this['shellCommand'][_0x7914('0x6b')](this,_0x40ba84[_0x7914('0xb3')]);this[_0x7914('0x2e')][_0x7914('0x6b')](this,_0x40ba84,_0x40ba84[_0x7914('0xb3')]);if(this[_0x7914('0x7f')](_0x40ba84[_0x7914('0xd2')])){var _0x5b3096=this[_0x7914('0x11')]['sync'](this,_0x40ba84[_0x7914('0xd2')]);if(_0x5b3096){this[_0x7914('0xd')][_0x7914('0x99')](_0x5b3096,_0x2f3f72);return this[_0x7914('0xd')]['noop'](util['format'](_0x7914('0x1b6'),_0x40ba84['command'],_0x5b3096));}}return this[_0x7914('0xd')]['noop'](util['format'](_0x7914('0x1b7'),_0x40ba84['command']));};AGIVertices[_0x7914('0x10')][_0x7914('0x1b8')]=function(_0x171435){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x1b9'),_0x171435[_0x7914('0xb6')]));_0x171435[_0x7914('0x54')]=_0x171435['text'][_0x7914('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7914('0x7f')](_0x171435[_0x7914('0x52')])){return this['channel'][_0x7914('0xa3')](_0x7914('0x1ba'));}if(!this['isConfigured'](_0x171435[_0x7914('0x54')])){return this['channel'][_0x7914('0xa3')](_0x7914('0xa4'));}this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x171435[_0x7914('0x54')]));var _0x4365b5=this[_0x7914('0x51')][_0x7914('0x6b')](this,_0x171435);if(_0x4365b5){this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')](_0x7914('0x1bb'),_0x4365b5));var _0x101e86=this[_0x7914('0xd')][_0x7914('0x122')](_0x4365b5);try{fs[_0x7914('0x101')](_0x4365b5+_0x7914('0x102'));}catch(_0x1a2de3){logger[_0x7914('0x29')](_0x1a2de3);}return _0x101e86;}return this['channel'][_0x7914('0x29')](_0x171435,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7914('0x10')]['tts']=function(_0x420a63){logger[_0x7914('0x2b')](util[_0x7914('0x4a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x420a63[_0x7914('0xb6')]));_0x420a63[_0x7914('0x54')]=_0x420a63[_0x7914('0x54')][_0x7914('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7914('0x7f')](_0x420a63['text'])){return this[_0x7914('0xd')][_0x7914('0xa3')](_0x7914('0xa4'));}this[_0x7914('0xd')]['noop'](util[_0x7914('0x4a')]('Trying\x20Google\x20TTS\x20%s',_0x420a63['text']));var _0x531d5e=this[_0x7914('0x5b')][_0x7914('0x6b')](this,_0x420a63);if(_0x531d5e){this[_0x7914('0xd')][_0x7914('0xa3')](util['format'](_0x7914('0x1bc'),_0x531d5e));var _0x363b32=this['channel'][_0x7914('0x122')](_0x531d5e);try{fs[_0x7914('0x101')](_0x531d5e+_0x7914('0x102'));}catch(_0x114d27){logger[_0x7914('0x29')](_0x114d27);}return _0x363b32;}return this[_0x7914('0xd')]['error'](_0x420a63,_0x7914('0x1bd'));};AGIVertices[_0x7914('0x10')][_0x7914('0x1be')]=function(_0x5d50d3){logger[_0x7914('0x2b')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x5d50d3[_0x7914('0xb6')]));if(!this[_0x7914('0x7f')](_0x5d50d3['findBy'])){return this[_0x7914('0xd')]['error'](_0x5d50d3,'no\x20find\x20by\x20configured');}logger['info'](util[_0x7914('0x4a')](_0x7914('0x156'),this[_0x7914('0xd')][_0x7914('0x31')],_0x5d50d3[_0x7914('0x155')]));var _0x4f39c8=this[_0x7914('0x46')][_0x7914('0x6b')](this,_0x5d50d3['findBy']);if(_0x4f39c8){logger[_0x7914('0x2b')](util['format'](_0x7914('0x157'),this[_0x7914('0xd')]['callerid'],_0x5d50d3[_0x7914('0x155')]));this[_0x7914('0xd')][_0x7914('0xa3')](util[_0x7914('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7914('0xd')][_0x7914('0x31')],_0x5d50d3['findBy']));return{'code':0xc8,'result':_0x7914('0x158')};}else{logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x159'),this['channel'][_0x7914('0x31')],_0x5d50d3['findBy']));this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x159'),this[_0x7914('0xd')][_0x7914('0x31')],_0x5d50d3['findBy']));return{'code':0xc8,'result':_0x7914('0x15a')};}};AGIVertices[_0x7914('0x10')]['voicemail']=function(_0x3addfe){logger[_0x7914('0x2b')](util[_0x7914('0x4a')](_0x7914('0x1bf'),_0x3addfe[_0x7914('0xb6')]));var _0x3535bf=this[_0x7914('0xd')]['exec'](_0x7914('0x1c0'),[_0x3addfe[_0x7914('0x1c1')],_0x3addfe[_0x7914('0x74')]]);if(_0x3535bf[_0x7914('0x9e')]===-0x1){return _0x3535bf;}return this['channel'][_0x7914('0xa3')](util[_0x7914('0x4a')](_0x7914('0x16f'),'VOICEMAIL',_0x3addfe[_0x7914('0x1c1')]));};AGIVertices[_0x7914('0x10')]['vswitch']=function(_0x32f9b6){logger[_0x7914('0x2b')](util['format'](_0x7914('0x1c2'),_0x32f9b6['label']));if(!this[_0x7914('0x7f')](_0x32f9b6[_0x7914('0xd2')])){return this[_0x7914('0xd')][_0x7914('0x29')](_0x32f9b6,_0x7914('0x1a7'));}var _0x4de5c1=this[_0x7914('0x11')][_0x7914('0x6b')](this,_0x32f9b6['variable_id']);if(!_0x4de5c1){return this[_0x7914('0xd')]['error'](_0x32f9b6,'no\x20variable\x20found');}var _0x3a239b=this[_0x7914('0xd')][_0x7914('0x11')](_0x4de5c1);return{'code':0xc8,'result':_0x3a239b[_0x7914('0x9c')]?_0x3a239b['extra']:'-'};};String[_0x7914('0x10')]['replaceAll']=function(_0x2e852f,_0x5405f1){return this['split'](_0x2e852f)[_0x7914('0x1c3')](_0x5405f1);};module[_0x7914('0x1c4')]=AGIVertices; \ No newline at end of file +var _0xc2af=['shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','getdigits','getsecretdigits','channel','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueue','getSquareProject','rpc','getSquareProjectById','getSquareOdbc','dsn','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','interval','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','calleridname','context','extension','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','agentPause','callerid','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','includes','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','%s.%s','setVariable','stringify','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','lumenvoxasr','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','test','mindigit','maxdigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','wav','%s/recordings/%s','beep','intKey','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','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','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x21548e,_0x29dede){_0x21548e=_0x21548e-0x0;var _0x9e244b=_0xc2af[_0x21548e];return _0x9e244b;};'use strict';var fs=require('fs');var util=require(_0xfc2a('0x0'));var _=require('lodash');var sh=require(_0xfc2a('0x1'));var odbc=require('odbc')();var rs=require(_0xfc2a('0x2'));var moment=require(_0xfc2a('0x3'));var Mustache=require(_0xfc2a('0x4'));var rp=require(_0xfc2a('0x5'));var logger=require(_0xfc2a('0x6'))(_0xfc2a('0x7'));var config=require(_0xfc2a('0x8'));var shared=require(_0xfc2a('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xfc2a('0xa');var recursiveMapAttributes=['rawHeaders',_0xfc2a('0xb')];var verticesWithRetry=['menu',_0xfc2a('0xc'),_0xfc2a('0xd')];var AGIVertices=function(_0x3587be,_0x913145,_0x4c826a){this[_0xfc2a('0xe')]=_0x3587be;this['rpc']=_0x913145;this[_0xfc2a('0xf')]=_0x4c826a;};AGIVertices['prototype'][_0xfc2a('0x10')]=function(_0x25c221,_0x2f6464){this['rpc']['getVariableById'](_0x25c221)[_0xfc2a('0x11')](function(_0x296471){_0x2f6464(null,_0x296471?_0x296471[_0xfc2a('0x12')]:![]);})[_0xfc2a('0x13')](function(_0x268993){_0x2f6464(_0x268993);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x15')]=function(_0xea5cd2,_0xe4b058){this['rpc']['getVoiceQueueById'](_0xea5cd2)[_0xfc2a('0x11')](function(_0x3b5033){_0xe4b058(null,_0x3b5033?_0x3b5033['name']:![]);})[_0xfc2a('0x13')](function(_0x2f311c){_0xe4b058(_0x2f311c);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x16')]=function(_0x2008fc,_0xa93aa7){this[_0xfc2a('0x17')][_0xfc2a('0x18')](_0x2008fc)[_0xfc2a('0x11')](function(_0x1e1524){_0xa93aa7(null,_0x1e1524?_0x1e1524[_0xfc2a('0x12')]:![]);})[_0xfc2a('0x13')](function(_0x27fb82){_0xa93aa7(_0x27fb82);});};AGIVertices['prototype'][_0xfc2a('0x19')]=function(_0x15ff6d,_0x5cfea6){this[_0xfc2a('0x17')]['getSquareOdbcById'](_0x15ff6d)['then'](function(_0x3e88fe){_0x5cfea6(null,_0x3e88fe?_0x3e88fe[_0xfc2a('0x1a')]:![]);})[_0xfc2a('0x13')](function(_0x40ed0b){_0x5cfea6(_0x40ed0b);});};AGIVertices[_0xfc2a('0x14')]['getUser']=function(_0x722009,_0x4908d7){this['rpc']['getUserById'](_0x722009)[_0xfc2a('0x11')](function(_0x57b67c){_0x4908d7(null,_0x57b67c?_0x57b67c['name']:![]);})[_0xfc2a('0x13')](function(_0x10396d){_0x4908d7(_0x10396d);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x1b')]=function(_0x55ed0a,_0x1c299c){this[_0xfc2a('0x17')][_0xfc2a('0x1c')](_0x55ed0a)['then'](function(_0xc3fc44){_0x1c299c(null,_0xc3fc44?_0xc3fc44[_0xfc2a('0x12')]:![]);})['catch'](function(_0x55c0bc){_0x1c299c(_0x55c0bc);});};AGIVertices[_0xfc2a('0x14')]['getSound']=function(_0xe0727b,_0x45771d){var _0x2e6066=this;this[_0xfc2a('0x17')]['getSoundById'](_0xe0727b)['then'](function(_0x5f4165){_0x45771d(null,_0x5f4165?_0x2e6066[_0xfc2a('0x1d')](_0x5f4165[_0xfc2a('0x1e')]):![]);})['catch'](function(_0xb3e787){_0x45771d(_0xb3e787);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x1f')]=function(_0xec7c14,_0x10debd){this[_0xfc2a('0x17')][_0xfc2a('0x20')](_0xec7c14)[_0xfc2a('0x11')](function(_0x33d648){_0x10debd(null,_0x33d648?_0x33d648:![]);})['catch'](function(_0x13b00a){_0x10debd(_0x13b00a);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x21')]=function(_0x45ba01,_0x3a8fbd,_0x359849){this[_0xfc2a('0xf')][_0xfc2a('0x21')](_0x45ba01,_0x3a8fbd)[_0xfc2a('0x11')](function(){_0x359849(null);})[_0xfc2a('0x13')](function(_0x454ae6){_0x359849(_0x454ae6);});};AGIVertices[_0xfc2a('0x14')]['getIntervals']=function(_0x10a863,_0x3e03c3){this[_0xfc2a('0x17')][_0xfc2a('0x22')](_0x10a863)['then'](function(_0x314f01){if(_0x314f01){if(_0x314f01['IntervalId']){_0x3e03c3(null,[_0x314f01[_0xfc2a('0x23')]]);}else{_0x3e03c3(null,_['map'](_0x314f01[_0xfc2a('0x24')],_0xfc2a('0x23')));}}else{_0x3e03c3(null,![]);}})['catch'](function(_0x51cc7a){_0x3e03c3(_0x51cc7a);});};AGIVertices['prototype']['getSoundPath']=function(_0x1ef015){return util[_0xfc2a('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x1ef015);};AGIVertices['prototype'][_0xfc2a('0x26')]=function(_0x42a59f,_0x292dee,_0x118a4a){odbc[_0xfc2a('0x27')](_0x42a59f,function(_0x5dde47){if(_0x5dde47){logger[_0xfc2a('0x28')](_0xfc2a('0x29'),_0x5dde47);_0x118a4a(_0x5dde47);}else{logger['info'](_0xfc2a('0x2a'));odbc[_0xfc2a('0x2b')](_0x292dee,function(_0x61ee96,_0x596f13){if(_0x61ee96){logger[_0xfc2a('0x2c')](_0xfc2a('0x2d'),_0x292dee);_0x118a4a(_0x61ee96);}else{logger['info'](_0xfc2a('0x2e'),_0x292dee);odbc[_0xfc2a('0x2f')](function(_0x469be5){if(_0x469be5){logger[_0xfc2a('0x28')](_0xfc2a('0x30'),_0x469be5);}_0x118a4a(null,_0x596f13);});}});}});};AGIVertices[_0xfc2a('0x14')]['getSmsAccount']=function(_0x109f04,_0x20084e){this[_0xfc2a('0x17')][_0xfc2a('0x31')](_0x109f04)[_0xfc2a('0x11')](function(_0x17ae18){_0x20084e(null,_0x17ae18?_0x17ae18:![]);})['catch'](function(_0x2f27ff){_0x20084e(_0x2f27ff);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x32')]=function(_0x363598,_0x3065de){this[_0xfc2a('0x17')]['createSmsMessage'](_0x363598)[_0xfc2a('0x11')](function(_0x3c43ca){_0x3065de(null,_0x3c43ca);})['catch'](function(_0x4c9bae){_0x3065de(_0x4c9bae);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x33')]=function(_0x5a78ee,_0x53a63a,_0x2e4c14){this[_0xfc2a('0x17')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xfc2a('0x34')],'node':_0x5a78ee[_0xfc2a('0x35')],'application':_0x5a78ee['agicommand'],'data':_0x53a63a||null,'project_name':this[_0xfc2a('0xe')][_0xfc2a('0x36')],'callerid':this[_0xfc2a('0xe')]['callerid']})[_0xfc2a('0x11')](function(_0x287d1c){if(_0x2e4c14){_0x2e4c14(null,_0x287d1c);}})[_0xfc2a('0x13')](function(_0x48c381){if(_0x2e4c14){_0x2e4c14(_0x48c381);}});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x37')]=function(_0x272e21,_0x5cc159,_0x2656c1,_0x1341b7){this[_0xfc2a('0x17')][_0xfc2a('0x37')]({'uniqueid':this[_0xfc2a('0xe')][_0xfc2a('0x34')],'callerid':this[_0xfc2a('0xe')]['callerid'],'calleridname':this[_0xfc2a('0xe')][_0xfc2a('0x38')],'context':this[_0xfc2a('0xe')][_0xfc2a('0x39')],'extension':this[_0xfc2a('0xe')][_0xfc2a('0x3a')],'priority':this['channel']['priority'],'accountcode':this['channel'][_0xfc2a('0x3b')],'dnid':this[_0xfc2a('0xe')][_0xfc2a('0x3c')],'projectName':this['channel'][_0xfc2a('0x36')],'saveName':_0x5cc159,'filename':_0x272e21['file']||_0x5cc159,'savePath':_0x2656c1})[_0xfc2a('0x11')](function(_0x37ed34){_0x1341b7(null,_0x37ed34);})[_0xfc2a('0x13')](function(_0x314dec){_0x1341b7(_0x314dec);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x3d')]=function(_0x2a038a,_0x438bee,_0x2505d4,_0x10f844,_0x554bb1){this['rpc']['createSquareMessage']({'uniqueid':this[_0xfc2a('0xe')][_0xfc2a('0x34')],'body':_0x2a038a,'direction':_0x438bee,'providerName':_0x2505d4,'providerResponse':_0x10f844})[_0xfc2a('0x11')](function(_0x556d2c){if(_0x554bb1){_0x554bb1(null,_0x556d2c);}})[_0xfc2a('0x13')](function(_0x7b8432){if(_0x554bb1){_0x554bb1(_0x7b8432);}});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x3e')]=function(_0x4273c2,_0x7a9678){this[_0xfc2a('0x17')][_0xfc2a('0x3e')]({'firstName':_[_0xfc2a('0x3f')](_0x4273c2['name'])||_[_0xfc2a('0x40')](_0x4273c2['name'])?_0xfc2a('0x41')+Math[_0xfc2a('0x42')]():_0x4273c2['name'],'lastName':_[_0xfc2a('0x3f')](_0x4273c2['lastName'])||_[_0xfc2a('0x40')](_0x4273c2['lastName'])?null:_0x4273c2[_0xfc2a('0x43')],'phone':_0x4273c2[_0xfc2a('0x44')],'ListId':_0x4273c2[_0xfc2a('0x45')],'scheduledat':_0x4273c2['scheduledAt'],'callbackUniqueid':this[_0xfc2a('0xe')][_0xfc2a('0x34')],'tags':_0xfc2a('0x46'),'description':_0xfc2a('0x47')+_0x4273c2[_0xfc2a('0x48')][_0xfc2a('0x49')](),'priority':_0x4273c2['callback_priority']})['then'](function(_0x2833c4){_0x7a9678(null,_0x2833c4);})[_0xfc2a('0x13')](function(_0x31371d){_0x7a9678(_0x31371d);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x4a')]=function(_0x575826,_0x133ea7){this[_0xfc2a('0x17')]['getPauseById'](_0x575826)['then'](function(_0x4d9d66){_0x133ea7(null,_0x4d9d66?_0x4d9d66[_0xfc2a('0x12')]:![]);})[_0xfc2a('0x13')](function(_0xb77172){_0x133ea7(_0xb77172);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x4b')]=function(_0x42003f,_0x175859,_0x165f5b){var _0xb7d563={'role':'agent'};_0xb7d563[_0x42003f]=this[_0xfc2a('0xe')][_0xfc2a('0x4c')];this[_0xfc2a('0x17')][_0xfc2a('0x4b')](_0xb7d563,_0x175859,this['channel']['uniqueid'])[_0xfc2a('0x11')](function(_0xd70b5f){_0x165f5b(null,_[_0xfc2a('0x40')](_0xd70b5f)?![]:!![]);})['catch'](function(_0x84e7b2){logger['error'](_0x84e7b2);_0x165f5b(null,![]);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x4d')]=function(_0x55b21e,_0x5044b3){var _0x1749bd={'role':_0xfc2a('0x4e')};_0x1749bd[_0x55b21e]=this[_0xfc2a('0xe')]['callerid'];this[_0xfc2a('0x17')][_0xfc2a('0x4d')](_0x1749bd)['then'](function(_0x293145){_0x5044b3(null,_['isNil'](_0x293145)?![]:!![]);})[_0xfc2a('0x13')](function(_0x438e64){logger['error'](_0x438e64);_0x5044b3(null,![]);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x4f')]=function(_0x1bb7c4,_0x325879){var _0x4a06c8={'role':'agent'};_0x4a06c8[_0x1bb7c4]=this['channel'][_0xfc2a('0x4c')];this['rpc'][_0xfc2a('0x4f')](_0x4a06c8)[_0xfc2a('0x11')](function(_0x5aeb5b){_0x325879(null,_[_0xfc2a('0x40')](_0x5aeb5b)?![]:!![]);})[_0xfc2a('0x13')](function(_0x143f11){logger[_0xfc2a('0x28')](_0x143f11);_0x325879(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x389864,_0x1c953f){var _0x248b57={'role':_0xfc2a('0x4e')};_0x248b57[_0x389864]=this[_0xfc2a('0xe')][_0xfc2a('0x4c')];var _0x173851=_0x389864!=_0xfc2a('0x50')?util['format'](_0xfc2a('0x51'),_0xfc2a('0x52'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')]):undefined;this[_0xfc2a('0x17')][_0xfc2a('0x53')](_0x248b57,_0x173851)[_0xfc2a('0x11')](function(_0x2d65a0){_0x1c953f(null,_[_0xfc2a('0x40')](_0x2d65a0)?![]:!![]);})[_0xfc2a('0x13')](function(_0x57843b){logger[_0xfc2a('0x28')](_0x57843b);_0x1c953f(null,![]);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x54')]=function(_0x16c157,_0x29bdca){sh[_0xfc2a('0x55')](_[_0xfc2a('0x56')](_0x16c157),function(_0x34d439,_0x2d2405){var _0x5d5871=_0x2d2405[_0xfc2a('0x57')](/(\r\n|\n|\r)/gm,'');_0x29bdca(null,_0x5d5871);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x58')]=function(_0x2bfb4c,_0x1b04fb){scripts[_0xfc2a('0x58')](_0x2bfb4c[_0xfc2a('0x59')],_0x2bfb4c[_0xfc2a('0x5a')]||_0xfc2a('0x5b'),_0x2bfb4c[_0xfc2a('0x5b')],_0x2bfb4c['languageCode']||_0xfc2a('0x5c'),_0x2bfb4c['ssmlGender']||_0xfc2a('0x5d'),_0x2bfb4c[_0xfc2a('0x5e')]||_0xfc2a('0x5f'))[_0xfc2a('0x11')](function(_0x40535b){_0x1b04fb(null,_0x40535b);})[_0xfc2a('0x13')](function(_0x35ec43){_0x1b04fb(_0x35ec43);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x60')]=function(_0x1c5206,_0x38c08a){scripts[_0xfc2a('0x60')](_0x1c5206[_0xfc2a('0x5b')],_0x1c5206[_0xfc2a('0x61')]||'en',0x1)[_0xfc2a('0x11')](function(_0x14f15b){_0x38c08a(null,_0x14f15b);})[_0xfc2a('0x13')](function(_0x3b2d35){_0x38c08a(_0x3b2d35);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x62')]=function(_0x86af42,_0x21624b){var _0x5958ae={'uri':_0x86af42[_0xfc2a('0x63')],'method':_0x86af42[_0xfc2a('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x86af42['timeout'])===_0xfc2a('0x65')&&parseInt(_0x86af42[_0xfc2a('0x66')])>=0x1?parseInt(_0x86af42[_0xfc2a('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xfc2a('0x67'),_0xfc2a('0x68')],_0x5958ae[_0xfc2a('0x64')][_0xfc2a('0x69')]())){try{_0x5958ae[_0xfc2a('0x6a')]=_0x86af42[_0xfc2a('0xb')]?JSON[_0xfc2a('0x6b')](_0x86af42[_0xfc2a('0xb')]):{};}catch(_0x4776f0){logger['error'](_0xfc2a('0x6c'),_0x4776f0);}}try{_0x5958ae[_0xfc2a('0x6d')]=_0x86af42[_0xfc2a('0x6e')]?JSON[_0xfc2a('0x6b')](_0x86af42[_0xfc2a('0x6e')]):{};}catch(_0xc47c1c){logger[_0xfc2a('0x28')](_0xfc2a('0x6f'),_0xc47c1c);}if(_0x86af42[_0xfc2a('0x70')]){try{var _0x231cde=require(_0x86af42[_0xfc2a('0x70')])[_0xfc2a('0x71')](this,_0x5958ae);_0x5958ae['uri']=Mustache[_0xfc2a('0x72')](_0x86af42[_0xfc2a('0x63')],_0x231cde,{},['$$','$$']);if(_0x5958ae[_0xfc2a('0x6d')]){_0x5958ae[_0xfc2a('0x6d')]=JSON['parse'](Mustache[_0xfc2a('0x72')](JSON['stringify'](_0x5958ae[_0xfc2a('0x6d')]),_0x231cde,{},['$$','$$']));}if(_0x5958ae[_0xfc2a('0x6a')]){_0x5958ae[_0xfc2a('0x6a')]=JSON[_0xfc2a('0x6b')](Mustache[_0xfc2a('0x72')](JSON['stringify'](_0x5958ae[_0xfc2a('0x6a')]),_0x231cde,{},['$$','$$']));}}catch(_0x55d127){logger[_0xfc2a('0x28')](_0xfc2a('0x73'),_0x55d127);}}rp(_0x5958ae)[_0xfc2a('0x11')](function(_0x1b6a55){var _0x5836e9={'statusCode':_0x1b6a55[_0xfc2a('0x74')]||0xc8,'statusMessage':_0x1b6a55[_0xfc2a('0x75')]||'OK','headers':_0x1b6a55[_0xfc2a('0x6d')]||{},'body':_0x1b6a55[_0xfc2a('0x6a')]||{}};_0x21624b(null,_0x5836e9);})[_0xfc2a('0x13')](function(_0x4a96cf){var _0x116554={'statusCode':_0x4a96cf[_0xfc2a('0x74')]||0x1f4,'statusMessage':_0x4a96cf[_0xfc2a('0x76')]||_0xfc2a('0x77'),'headers':_0x4a96cf[_0xfc2a('0x78')][_0xfc2a('0x6d')]||{},'body':_0x4a96cf[_0xfc2a('0x78')][_0xfc2a('0x6a')]||{}};_0x21624b(null,_0x116554);});};AGIVertices[_0xfc2a('0x14')]['googleDialogflow']=function(_0x52e46d,_0x26b75c){scripts[_0xfc2a('0x79')](this[_0xfc2a('0xe')]['uniqueid'],_0x52e46d['key'],_0x52e46d['text'],_0x52e46d[_0xfc2a('0x7a')]||'en')['then'](function(_0x290b8c){_0x26b75c(null,_0x290b8c);})[_0xfc2a('0x13')](function(_0x50b49d){_0x26b75c(_0x50b49d);});};AGIVertices['prototype'][_0xfc2a('0x7b')]=function(_0x2e58df,_0x4a62d0){scripts[_0xfc2a('0x7b')](this[_0xfc2a('0xe')][_0xfc2a('0x34')],_0x2e58df[_0xfc2a('0x7c')],_0x2e58df[_0xfc2a('0x7d')],_0x2e58df[_0xfc2a('0x7e')],_0x2e58df[_0xfc2a('0x5b')],_0x2e58df[_0xfc2a('0x7f')]||'en')['then'](function(_0x294875){_0x4a62d0(null,_0x294875);})[_0xfc2a('0x13')](function(_0x3706ef){_0x4a62d0(_0x3706ef);});};AGIVertices['prototype'][_0xfc2a('0x80')]=function(_0x2a21d0,_0x49ba7a){scripts[_0xfc2a('0x80')](this[_0xfc2a('0xe')],_0x2a21d0)[_0xfc2a('0x11')](function(_0x4531c){_0x49ba7a(null,_0x4531c);})['catch'](function(_0x53c645){_0x49ba7a(_0x53c645);});};AGIVertices['prototype'][_0xfc2a('0x81')]=function(_0x4cb4ee,_0xbff48d){scripts['ispeechTTS'](_0x4cb4ee[_0xfc2a('0x82')],_0x4cb4ee[_0xfc2a('0x5b')],_0x4cb4ee['ispeech_tts_language']||'en-US',_0x4cb4ee[_0xfc2a('0x83')])[_0xfc2a('0x11')](function(_0x34a15f){_0xbff48d(null,_0x34a15f);})[_0xfc2a('0x13')](function(_0x3c5bc1){_0xbff48d(_0x3c5bc1);});};AGIVertices['prototype'][_0xfc2a('0x84')]=function(_0x2a8952,_0x2577ea,_0x3cdefd){scripts['ispeechASR'](_0x2577ea,_0x2a8952[_0xfc2a('0x82')],_0x2a8952[_0xfc2a('0x85')]||_0xfc2a('0x5c'),this[_0xfc2a('0x86')](_0x2a8952[_0xfc2a('0x87')])?_0x2a8952[_0xfc2a('0x87')]:undefined)[_0xfc2a('0x11')](function(_0x32ba42){_0x3cdefd(null,_0x32ba42);})[_0xfc2a('0x13')](function(_0xe97319){_0x3cdefd(_0xe97319);});};AGIVertices[_0xfc2a('0x14')]['awsPolly']=function(_0x38e309,_0x1fa750){scripts[_0xfc2a('0x88')](_0x38e309[_0xfc2a('0x89')],_0x38e309['aws_secret_access_key'],_0x38e309['aws_polly_region'],_0x38e309[_0xfc2a('0x8a')]||_0xfc2a('0x8b'),_0x38e309[_0xfc2a('0x5b')],_0x38e309['aws_text_type']||_0xfc2a('0x5b'))[_0xfc2a('0x11')](function(_0x276d93){_0x1fa750(null,_0x276d93);})[_0xfc2a('0x13')](function(_0x381902){_0x1fa750(_0x381902);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x8c')]=function(_0x3a0c4f,_0x4e3dc9){scripts['awsLex'](this[_0xfc2a('0xe')][_0xfc2a('0x34')],_0x3a0c4f[_0xfc2a('0x89')],_0x3a0c4f[_0xfc2a('0x8d')],_0x3a0c4f[_0xfc2a('0x8e')],_0x3a0c4f['text'],_0x3a0c4f[_0xfc2a('0x8f')])['then'](function(_0xbbe918){_0x4e3dc9(null,_0xbbe918);})[_0xfc2a('0x13')](function(_0x33ced2){_0x4e3dc9(_0x33ced2);});};AGIVertices['prototype']['googleASR']=function(_0x3d95c9,_0x38b465,_0x5a3f36){scripts[_0xfc2a('0x90')](_0x38b465,_0x3d95c9[_0xfc2a('0x82')],_0x3d95c9['google_asr_language']||'en-US')[_0xfc2a('0x11')](function(_0x4b18e5){_0x5a3f36(null,_0x4b18e5);})['catch'](function(_0xb5069){_0x5a3f36(_0xb5069);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x91')]=function(_0x2d3c1,_0x34bb4f,_0x220060){scripts[_0xfc2a('0x91')](_0x34bb4f,_0x2d3c1[_0xfc2a('0x92')],_0x2d3c1[_0xfc2a('0x93')],_0x2d3c1[_0xfc2a('0x94')])[_0xfc2a('0x11')](function(_0x319db2){_0x220060(null,_0x319db2);})[_0xfc2a('0x13')](function(_0x237170){_0x220060(_0x237170);});};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x95')]=function(_0x701fa7){var _0x5f2d58=_[_0xfc2a('0x96')](verticesWithRetry,_0x701fa7['agicommand'])?_0x701fa7:_[_0xfc2a('0x97')](_0x701fa7);for(var _0x33d47e in _0x5f2d58){if(_0x5f2d58['hasOwnProperty'](_0x33d47e)){if(_0x5f2d58[_0x33d47e]&&_[_0xfc2a('0x98')](_0x5f2d58[_0x33d47e])){if(_[_0xfc2a('0x96')](recursiveMapAttributes,_0x33d47e)){_0x5f2d58[_0x33d47e]=this[_0xfc2a('0x99')](_0x5f2d58[_0x33d47e]);}else{_0x5f2d58[_0x33d47e]=this[_0xfc2a('0x9a')](_0x5f2d58[_0x33d47e]);}}}}return _0x5f2d58;};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x9b')]=function(_0x1f7745){for(var _0x2c79dd in _0x1f7745){if(_0x1f7745[_0xfc2a('0x9c')](_0x2c79dd)){if(_[_0xfc2a('0x9d')](_0x1f7745[_0x2c79dd])){this[_0xfc2a('0x9b')](_0x1f7745[_0x2c79dd]);}else if(_['isArray'](_0x1f7745[_0x2c79dd])){for(var _0x5a5253=0x0;_0x5a5253<_0x1f7745[_0x2c79dd][_0xfc2a('0x9e')];_0x5a5253++){this[_0xfc2a('0x9b')](_0x1f7745[_0x2c79dd][_0x5a5253]);}}else if(_[_0xfc2a('0x98')](_0x1f7745[_0x2c79dd])){_0x1f7745[_0x2c79dd]=this['replaceAllVariables'](_0x1f7745[_0x2c79dd]);}}}};AGIVertices['prototype'][_0xfc2a('0x9f')]=function(_0xb63dc7,_0x4e621c){for(var _0xd78ad6 in _0xb63dc7){if(_0xb63dc7[_0xfc2a('0x9c')](_0xd78ad6)){if(_['isPlainObject'](_0xb63dc7[_0xd78ad6])){if(!_[_0xfc2a('0x3f')](_0xb63dc7[_0xd78ad6])){this[_0xfc2a('0x9f')](_0xb63dc7[_0xd78ad6],util[_0xfc2a('0x25')]('%s.%s',_0x4e621c,_0xd78ad6));}}else if(_['isArray'](_0xb63dc7[_0xd78ad6])){for(var _0x31b415=0x0;_0x31b415<_0xb63dc7[_0xd78ad6][_0xfc2a('0x9e')];_0x31b415++){this[_0xfc2a('0x9f')](_0xb63dc7[_0xd78ad6][_0x31b415],util[_0xfc2a('0x25')](_0xfc2a('0xa0'),_0x4e621c,_0xd78ad6+'['+_0x31b415+']'));}}else{if(!_[_0xfc2a('0x40')](_0xb63dc7[_0xd78ad6])){this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')]('%s.%s',_0x4e621c,_0xd78ad6),_0xb63dc7[_0xd78ad6]);}}}}};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x99')]=function(_0x40cc83){try{var _0x2bc162=JSON['parse'](_0x40cc83);this[_0xfc2a('0x9b')](_0x2bc162);return JSON[_0xfc2a('0xa2')](_0x2bc162);}catch(_0x11f9ce){return this[_0xfc2a('0x9a')](_0x40cc83);}};AGIVertices['prototype'][_0xfc2a('0x9a')]=function(_0x13e4c7){var _0x1ee3aa=_0x13e4c7[_0xfc2a('0xa3')]('{');for(var _0x3f9423=0x1;_0x3f9423<_0x1ee3aa['length'];_0x3f9423+=0x1){var _0x1a74c9=_0x1ee3aa[_0x3f9423]['split']('}');if(_0x1a74c9[_0xfc2a('0x9e')]>0x1){_0x13e4c7=_0x13e4c7[_0xfc2a('0xa4')]('{'+_0x1a74c9[0x0]+'}',this['channel'][_0xfc2a('0x10')](_0x1a74c9[0x0])[_0xfc2a('0xa5')]||_0x1a74c9[0x0]);}}if(_0x1ee3aa['length']===0x1){return _0x13e4c7[_0xfc2a('0x49')]();}return this[_0xfc2a('0x9a')](_0x13e4c7);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xa6')]=function(_0x526e9b,_0x1f7261){var _0xf54b3=this[_0xfc2a('0xe')][_0xfc2a('0x10')](_0x526e9b);if(_0xf54b3[_0xfc2a('0xa7')]===-0x1){return _0xf54b3;}logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1f7261,_0xf54b3['extra']));return this[_0xfc2a('0xe')][_0xfc2a('0xa1')](_0x1f7261,_0xf54b3['extra']);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x86')]=function(_0x4fe632){return _0x4fe632&&_0x4fe632!=='0'&&_0x4fe632!=='-1'&&_0x4fe632!=='';};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xa8')]=function(_0x55c496){this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x55c496,'-');_0x55c496[_0xfc2a('0xa9')]=_0x55c496[_0xfc2a('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xaa')]=function(_0x3de32d){logger['info'](util['format'](_0xfc2a('0xab'),_0x3de32d[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x3de32d[_0xfc2a('0x5b')])){return this['channel'][_0xfc2a('0xac')](_0xfc2a('0xad'));}var _0x2c631e='\x22'+_0x3de32d['text']+'\x22';if(this[_0xfc2a('0x86')](_0x3de32d['options'])){_0x2c631e+=','+_0x3de32d[_0xfc2a('0x78')];}var _0x437f8c=this[_0xfc2a('0xe')]['exec']('MRCPSynth',_0x2c631e);if(_0x437f8c[_0xfc2a('0xa7')]===-0x1){return _0x437f8c;}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0xae'),_0x2c631e));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xaf')]=function(_0x339196){logger['info'](util[_0xfc2a('0x25')](_0xfc2a('0xb0'),_0x339196[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x339196[_0xfc2a('0xb1')])){return this['channel'][_0xfc2a('0xac')]('no\x20grammar\x20configured');}var _0x25f73a=_0x339196['grammar'];if(this[_0xfc2a('0x86')](_0x339196[_0xfc2a('0x78')])){_0x25f73a+=','+_0x339196[_0xfc2a('0x78')];}var _0x11ec8c=this[_0xfc2a('0xe')][_0xfc2a('0x55')]('MRCPRecog',_0x25f73a);if(_0x11ec8c[_0xfc2a('0xa7')]===-0x1){return _0x11ec8c;}var _0x17380c=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x17380c[_0xfc2a('0xa7')]===-0x1){return _0x17380c;}var _0x1f6017=this[_0xfc2a('0xa6')](_0xfc2a('0xb2'),_0xfc2a('0xb3'));if(_0x1f6017[_0xfc2a('0xa7')]===-0x1){return _0x1f6017;}var _0x1f9c73=this[_0xfc2a('0xa6')](_0xfc2a('0xb4'),_0xfc2a('0xb5'));if(_0x1f9c73[_0xfc2a('0xa7')]===-0x1){return _0x1f9c73;}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x25f73a));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x7')]=function(_0x3e4510){logger['info'](util[_0xfc2a('0x25')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3e4510[_0xfc2a('0x35')]));return this[_0xfc2a('0xe')][_0xfc2a('0x7')]([_0x3e4510[_0xfc2a('0xb6')],_0x3e4510[_0xfc2a('0xb7')]]);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xb8')]=function(_0x2f6fe9){logger['info'](util[_0xfc2a('0x25')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2f6fe9[_0xfc2a('0x35')]));if(this[_0xfc2a('0x86')](_0x2f6fe9[_0xfc2a('0x66')])){logger['info'](util[_0xfc2a('0x25')](_0xfc2a('0xb9'),_0x2f6fe9[_0xfc2a('0x66')]));var _0x590499=this[_0xfc2a('0xe')]['wait'](_0x2f6fe9[_0xfc2a('0x66')]);if(_0x590499[_0xfc2a('0xa7')]===-0x1){return _0x590499;}}return this[_0xfc2a('0xe')][_0xfc2a('0xb8')]();};AGIVertices['prototype'][_0xfc2a('0x46')]=function(_0xba9e3){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0xba'),_0xba9e3[_0xfc2a('0x35')]));if(!this['isConfigured'](_0xba9e3[_0xfc2a('0x45')])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0xba9e3,_0xfc2a('0xbb'));}_0xba9e3[_0xfc2a('0x48')]=moment();if(this[_0xfc2a('0x86')](_0xba9e3[_0xfc2a('0xbc')])){_0xba9e3[_0xfc2a('0x48')]=moment()['add'](_0xba9e3['delay'],_0xfc2a('0xbd'));}if(!this['isConfigured'](_0xba9e3[_0xfc2a('0xbe')])){_0xba9e3[_0xfc2a('0xbe')]=0x2;}this[_0xfc2a('0x3e')][_0xfc2a('0x71')](this,_0xba9e3);return this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')](_0xfc2a('0xbf'),_0xba9e3[_0xfc2a('0x44')],_0xba9e3['list_id'],_0xba9e3['scheduledAt']));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xc0')]=function(_0x168011){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0xc1'),_0x168011[_0xfc2a('0x35')]));var _0x21c36b=this[_0xfc2a('0xe')][_0xfc2a('0x55')](_0x168011[_0xfc2a('0xc2')],_0x168011[_0xfc2a('0x78')]);if(_0x21c36b['result']===-0x1){return _0x21c36b;}return this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')](_0xfc2a('0xc3'),_0x168011[_0xfc2a('0xc2')],_0x168011['options']));};AGIVertices[_0xfc2a('0x14')]['lumenvoxtts']=function(_0x1d57b4){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0xc4'),_0x1d57b4[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x1d57b4[_0xfc2a('0x5b')])){return this['channel'][_0xfc2a('0xac')](_0xfc2a('0xad'));}var _0x4eb291='\x22'+_0x1d57b4[_0xfc2a('0x5b')]+'\x22';if(this['isConfigured'](_0x1d57b4[_0xfc2a('0x78')])){_0x4eb291+=','+_0x1d57b4[_0xfc2a('0x78')];}var _0x257681=this[_0xfc2a('0xe')][_0xfc2a('0x55')](_0xfc2a('0xc5'),_0x4eb291);if(_0x257681['result']===-0x1){return _0x257681;}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0xae'),_0x4eb291));};AGIVertices['prototype'][_0xfc2a('0xc6')]=function(_0x5a1518){logger['info'](util[_0xfc2a('0x25')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5a1518[_0xfc2a('0x35')]));if(!this['isConfigured'](_0x5a1518[_0xfc2a('0x5b')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20text\x20configured');}var _0x94d473='\x22'+_0x5a1518[_0xfc2a('0x5b')]+'\x22';if(this['isConfigured'](_0x5a1518[_0xfc2a('0x78')])){_0x94d473+=','+_0x5a1518[_0xfc2a('0x78')];}var _0x941613=this[_0xfc2a('0xe')]['exec'](_0xfc2a('0xc5'),_0x94d473);if(_0x941613[_0xfc2a('0xa7')]===-0x1){return _0x941613;}return this['channel']['noop'](util[_0xfc2a('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x94d473));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xc7')]=function(_0x378281){logger[_0xfc2a('0x2c')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x378281['label']));if(!this['isConfigured'](_0x378281[_0xfc2a('0xb1')])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0xc8'));}var _0x157b30=_0x378281[_0xfc2a('0xb1')];if(this[_0xfc2a('0x86')](_0x378281[_0xfc2a('0x78')])){_0x157b30+=','+_0x378281[_0xfc2a('0x78')];}var _0x1d3af3=this['channel'][_0xfc2a('0x55')](_0xfc2a('0xc9'),_0x157b30);if(_0x1d3af3[_0xfc2a('0xa7')]===-0x1){return _0x1d3af3;}var _0x46e454=this[_0xfc2a('0xa6')](_0xfc2a('0xca'),_0xfc2a('0xcb'));if(_0x46e454[_0xfc2a('0xa7')]===-0x1){return _0x46e454;}var _0x137745=this['getAndSetVariable'](_0xfc2a('0xb2'),_0xfc2a('0xcc'));if(_0x137745[_0xfc2a('0xa7')]===-0x1){return _0x137745;}var _0x32c80b=this[_0xfc2a('0xa6')]('RECOG_INSTANCE()',_0xfc2a('0xcd'));if(_0x32c80b[_0xfc2a('0xa7')]===-0x1){return _0x32c80b;}return this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0xce'),_0x157b30));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xcf')]=function(_0x110e97){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x110e97['label']));if(!this[_0xfc2a('0x86')](_0x110e97[_0xfc2a('0xb1')])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0xc8'));}var _0x247692=_0x110e97[_0xfc2a('0xb1')];if(this[_0xfc2a('0x86')](_0x110e97[_0xfc2a('0x78')])){_0x247692+=','+_0x110e97['options'];}var _0x384459=this[_0xfc2a('0xe')]['exec']('MRCPRecog',_0x247692);if(_0x384459[_0xfc2a('0xa7')]===-0x1){return _0x384459;}var _0x2a0065=this[_0xfc2a('0xa6')](_0xfc2a('0xca'),'SESTEK_ASR_CONFIDENCE');if(_0x2a0065[_0xfc2a('0xa7')]===-0x1){return _0x2a0065;}var _0x8a92e7=this[_0xfc2a('0xa6')]('RECOG_INPUT()',_0xfc2a('0xd0'));if(_0x8a92e7[_0xfc2a('0xa7')]===-0x1){return _0x8a92e7;}var _0x561b80=this[_0xfc2a('0xa6')](_0xfc2a('0xb4'),_0xfc2a('0xd1'));if(_0x561b80['result']===-0x1){return _0x561b80;}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format'](_0xfc2a('0xce'),_0x247692));};AGIVertices['prototype']['database']=function(_0x3e90b0){logger['info'](util[_0xfc2a('0x25')](_0xfc2a('0xd2'),_0x3e90b0[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x3e90b0[_0xfc2a('0xd3')])){return this['channel']['error'](_0x3e90b0,_0xfc2a('0xd4'));}var _0x279455=this[_0xfc2a('0x19')]['sync'](this,_0x3e90b0[_0xfc2a('0xd3')]);if(!_0x279455){return this['channel'][_0xfc2a('0x28')](_0x3e90b0,'no\x20odbc\x20database\x20found');}if(!this[_0xfc2a('0x86')](_0x3e90b0[_0xfc2a('0x2b')])){return this[_0xfc2a('0xe')]['error'](_0x3e90b0,'no\x20query\x20configured');}var _0x1d6776=_0x3e90b0[_0xfc2a('0x2b')][_0xfc2a('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0xd5'),_0x1d6776));var _0x5e9518=this[_0xfc2a('0x26')][_0xfc2a('0x71')](this,_0x279455,_0x1d6776);this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x3e90b0,_0x1d6776);if(!this[_0xfc2a('0x86')](_0x3e90b0[_0xfc2a('0xd6')])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0xd7'));}var _0x1e0aa5=this[_0xfc2a('0x10')][_0xfc2a('0x71')](this,_0x3e90b0['variable_id']);if(!_0x1e0aa5){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x3e90b0,_0xfc2a('0xd8'));}var _0x5d2c3a=this;_0x5e9518['forEach'](function(_0x2b0d95,_0x35531c){Object['keys'](_0x2b0d95)['forEach'](function(_0x3e4833){_0x5d2c3a[_0xfc2a('0xe')]['setVariable'](util[_0xfc2a('0x25')](_0xfc2a('0xd9'),_0x1e0aa5,_0x35531c,_0x3e4833),_0x2b0d95[_0x3e4833]);});});this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')](_0xfc2a('0xda'),_0x1e0aa5),_0x5e9518['length']);return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0xdb'),_0x1e0aa5));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xdc')]=function(_0x51edda){logger[_0xfc2a('0xdd')](util[_0xfc2a('0x25')](_0xfc2a('0xde'),_0x51edda[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x51edda['sip_id'])){return this['channel'][_0xfc2a('0x28')](_0x51edda,_0xfc2a('0xdf'));}var _0x285d7a=this[_0xfc2a('0xe0')][_0xfc2a('0x71')](this,_0x51edda[_0xfc2a('0xe1')]);if(!_0x285d7a){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x51edda,_0xfc2a('0xe2'));}var _0x2029c8=this[_0xfc2a('0xe')][_0xfc2a('0x55')](_0xfc2a('0xe3'),[util[_0xfc2a('0x25')](_0xfc2a('0xe4'),_0x285d7a),_0x51edda['timeout'],_0x51edda['opts'],_0x51edda['url']]);if(_0x2029c8['result']===-0x1){return _0x2029c8;}return this['channel']['noop'](util['format'](_0xfc2a('0xe5'),_0xfc2a('0xe3')));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xe6')]=function(_0x3c883d){logger[_0xfc2a('0x2c')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x3c883d[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x3c883d[_0xfc2a('0x82')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xe7'));}if(!this[_0xfc2a('0x86')](_0x3c883d['text'])){return this['channel'][_0xfc2a('0xac')]('no\x20text\x20configured');}this[_0xfc2a('0xe')][_0xfc2a('0xe8')]=!![];this[_0xfc2a('0x33')](_0x3c883d);this[_0xfc2a('0x3d')](_0x3c883d['text'],'in','','');this['channel'][_0xfc2a('0xac')](util['format'](_0xfc2a('0xe9'),_0x3c883d[_0xfc2a('0x5b')]));var _0x23f6a0=this[_0xfc2a('0x79')][_0xfc2a('0x71')](this,_0x3c883d);if(_0x23f6a0){for(var _0x2e966a in _0x23f6a0){if(_0x23f6a0['hasOwnProperty'](_0x2e966a)){this[_0xfc2a('0xe')]['setVariable'](util[_0xfc2a('0x25')](_0xfc2a('0xea'),_0x2e966a[_0xfc2a('0x69')]()),_0x23f6a0[_0x2e966a]);}}this['createSquareMessage'](_0x23f6a0[_0xfc2a('0xeb')],'out',_0xfc2a('0xe6'),'');return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format'](_0xfc2a('0xec'),_0x23f6a0['speech']));}return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x3c883d,_0xfc2a('0xed'));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xee')]=function(_0x1738b2){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1738b2[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x1738b2[_0xfc2a('0x7c')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xef'));}if(!this['isConfigured'](_0x1738b2[_0xfc2a('0x7d')])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0xf0'));}if(!this['isConfigured'](_0x1738b2[_0xfc2a('0x7e')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xf1'));}if(!this[_0xfc2a('0x86')](_0x1738b2[_0xfc2a('0x7f')])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0xf2'));}if(!this[_0xfc2a('0x86')](_0x1738b2['text'])){return this['channel']['noop'](_0xfc2a('0xad'));}this[_0xfc2a('0xe')]['bot']=!![];this[_0xfc2a('0x33')](_0x1738b2);this[_0xfc2a('0x3d')](_0x1738b2[_0xfc2a('0x5b')],'in','','');this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format'](_0xfc2a('0xf3'),_0x1738b2[_0xfc2a('0x5b')]));var _0x25937b=this['googleDialogflowV2'][_0xfc2a('0x71')](this,_0x1738b2);if(_0x25937b){for(var _0x36195a in _0x25937b){if(_0x25937b[_0xfc2a('0x9c')](_0x36195a)){if(_0x36195a!=='providerResponse'){this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')]('DIALOGFLOW_%s',_0x36195a[_0xfc2a('0x69')]()),_0x25937b[_0x36195a]);}}}this['createSquareMessage'](_0x25937b[_0xfc2a('0xeb')],_0xfc2a('0xf4'),_0xfc2a('0xee'),_0x25937b[_0xfc2a('0xf5')]);return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0xf6'),_0x25937b[_0xfc2a('0xeb')]));}return this[_0xfc2a('0xe')]['error'](_0x1738b2,_0xfc2a('0xf7'));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xf8')]=function(_0x2b11af){logger[_0xfc2a('0x2c')](util['format'](_0xfc2a('0xf9'),_0x2b11af['label']));if(!this[_0xfc2a('0x86')](_0x2b11af[_0xfc2a('0xfa')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xfb'));}if(!this[_0xfc2a('0x86')](_0x2b11af[_0xfc2a('0xfc')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20username\x20configured');}if(!this[_0xfc2a('0x86')](_0x2b11af['password'])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0xfd'));}if(!this[_0xfc2a('0x86')](_0x2b11af[_0xfc2a('0xfe')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20text\x20configured');}this[_0xfc2a('0xe')][_0xfc2a('0xe8')]=!![];this[_0xfc2a('0x33')](_0x2b11af);this[_0xfc2a('0x3d')](_0x2b11af[_0xfc2a('0x5b')],'in','','');this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')]('Trying\x20SestekNDA:\x20%s',_0x2b11af['text']));var _0x3605dc=this[_0xfc2a('0x80')]['sync'](this,_0x2b11af);if(_0x3605dc){for(var _0xf0f6fb in _0x3605dc){if(_0x3605dc[_0xfc2a('0x9c')](_0xf0f6fb)){this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util['format'](_0xfc2a('0xff'),_0xf0f6fb[_0xfc2a('0x69')]()),_0x3605dc[_0xf0f6fb]);}}this['createSquareMessage'](_0x3605dc['speech'],_0xfc2a('0xf4'),_0xfc2a('0xf8'),'');if(_0x3605dc['audiofile']){this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')](_0xfc2a('0x100'),_0x3605dc[_0xfc2a('0x101')]));var _0x357fa0=this[_0xfc2a('0xe')][_0xfc2a('0x102')](_0x3605dc['audiofile']);try{fs['unlink'](_0x3605dc[_0xfc2a('0x101')]+_0xfc2a('0x103'));}catch(_0x29fc0d){logger[_0xfc2a('0x28')](_0x29fc0d);}return _0x357fa0;}else{return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x104'),_0x3605dc[_0xfc2a('0xeb')]));}}return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x2b11af,_0xfc2a('0x105'));};AGIVertices['prototype'][_0xfc2a('0x106')]=function(_0x738c60){logger[_0xfc2a('0x2c')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x738c60['label']));return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('end');};AGIVertices[_0xfc2a('0x14')]['ext_dial']=function(_0x2595b7){logger[_0xfc2a('0x2c')](util['format'](_0xfc2a('0x107'),_0x2595b7[_0xfc2a('0x35')]));var _0x40e891='';if(_0x2595b7['trunk_id']){if(!this['isConfigured'](_0x2595b7[_0xfc2a('0x108')])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x2595b7,_0xfc2a('0x109'));}else{var _0x3d3bff=parseInt(_0x2595b7[_0xfc2a('0x108')],0xa);if(isNaN(_0x3d3bff)){_0x40e891=_0x2595b7[_0xfc2a('0x108')];}else{_0x40e891=this['getTrunk'][_0xfc2a('0x71')](this,_0x2595b7['trunk_id']);if(!_0x40e891){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x2595b7,_0xfc2a('0x10a'));}}}}else if(_0x2595b7[_0xfc2a('0x10b')]){_0x40e891=_0x2595b7[_0xfc2a('0x10b')];}else{return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x2595b7,_0xfc2a('0x109'));}var _0x354681=this[_0xfc2a('0xe')]['exec'](_0xfc2a('0xe3'),[util[_0xfc2a('0x25')]('SIP/%s/%s',_0x40e891,_0x2595b7[_0xfc2a('0x44')]),_0x2595b7[_0xfc2a('0x66')],_0x2595b7[_0xfc2a('0x10c')],_0x2595b7[_0xfc2a('0x63')]]);if(_0x354681[_0xfc2a('0xa7')]===-0x1){return _0x354681;}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0xe5'),_0xfc2a('0xe3')));};AGIVertices[_0xfc2a('0x14')]['finally']=function(_0x143d62){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x10d'),_0x143d62[_0xfc2a('0x35')]));return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0x10e'));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xc')]=function(_0x2153c7){logger['info'](util['format'](_0xfc2a('0x10f'),_0x2153c7[_0xfc2a('0x35')]));if(_0x2153c7[_0xfc2a('0xa9')]===0x0){return this[_0xfc2a('0xa8')](_0x2153c7);}_0x2153c7[_0xfc2a('0xa9')]-=0x1;if(!this[_0xfc2a('0x86')](_0x2153c7['file_id'])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x2153c7,_0xfc2a('0x110'));}var _0x863bbe=this[_0xfc2a('0x111')][_0xfc2a('0x71')](this,_0x2153c7['file_id']);if(!_0x863bbe){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x2153c7,_0xfc2a('0x112'));}if(!this['isConfigured'](_0x2153c7['variable_id'])){return this[_0xfc2a('0xe')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xb4b3ab=this[_0xfc2a('0xe')]['getData'](_0x863bbe,_0x2153c7['response'],_0x2153c7['maxdigit']);var _0x90f732=_0xb4b3ab[_0xfc2a('0xa7')]?_0xb4b3ab[_0xfc2a('0xa7')][_0xfc2a('0x49')]():'';logger[_0xfc2a('0x2c')](_0xfc2a('0x113'),JSON[_0xfc2a('0xa2')](_0xb4b3ab));if(_0xb4b3ab[_0xfc2a('0xa7')]===-0x1){this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x2153c7,_0x90f732);return _0xb4b3ab;}else if(_0xb4b3ab[_0xfc2a('0xa5')]===_0xfc2a('0x66')){_0xb4b3ab[_0xfc2a('0xa7')]=_0x90f732['length']>=parseInt(_0x2153c7[_0xfc2a('0x114')])?'x':'i';}else{_0xb4b3ab[_0xfc2a('0xa7')]=_0x90f732[_0xfc2a('0x9e')]>=parseInt(_0x2153c7[_0xfc2a('0x114')])&&_0x90f732[_0xfc2a('0x9e')]<=parseInt(_0x2153c7[_0xfc2a('0x115')])?'x':'i';}var _0x26d440=this[_0xfc2a('0x10')]['sync'](this,_0x2153c7[_0xfc2a('0xd6')]);if(!_0x26d440){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x2153c7,_0xfc2a('0xd8'));}this[_0xfc2a('0xe')][_0xfc2a('0xa1')](_0x26d440,_0x90f732);if(this['isConfigured'](_0x2153c7['hiddendigitsnum'])){var _0x31ffc0=parseInt(_0x2153c7[_0xfc2a('0x116')],0xa);var _0x247e00=rs[_0xfc2a('0x117')]({'charset':'*','length':_0x31ffc0});var _0x402c6a=_0x90f732['length'];if(_0x402c6a>0x0){if(_0x402c6a>_0x31ffc0){this[_0xfc2a('0x33')]['sync'](this,_0x2153c7,_0x2153c7['hiddendigitspos']==='first'?_0x247e00+_0x90f732[_0xfc2a('0x118')](_0x31ffc0):_0x90f732[_0xfc2a('0x118')](0x0,_0x402c6a-_0x31ffc0)+_0x247e00);}else{this[_0xfc2a('0x33')]['sync'](this,_0x2153c7,rs[_0xfc2a('0x117')]({'charset':'*','length':_0x402c6a}));}}else{this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x2153c7,'');}}else{this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x2153c7,_0x90f732);}return _0xb4b3ab;};AGIVertices[_0xfc2a('0x14')]['getsecretdigits']=function(_0x377b02){logger['info'](util['format'](_0xfc2a('0x119'),_0x377b02[_0xfc2a('0x35')]));return this[_0xfc2a('0xc')](_0x377b02);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x11a')]=function(_0x4be08b){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x11b'),_0x4be08b[_0xfc2a('0x35')]));this['createSquareDetailsReport'][_0xfc2a('0x71')](this,_0x4be08b,_0x4be08b[_0xfc2a('0x11c')]);return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x11d'),_0x4be08b[_0xfc2a('0x11c')]));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x11e')]=function(_0x1a1fb1){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x11f'),_0x1a1fb1[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x1a1fb1[_0xfc2a('0x89')])||!this[_0xfc2a('0x86')](_0x1a1fb1[_0xfc2a('0x8d')])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0x120'));}if(!this[_0xfc2a('0x86')](_0x1a1fb1['text'])){return this[_0xfc2a('0xe')]['noop']('no\x20text\x20configured');}this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x121'),_0x1a1fb1[_0xfc2a('0x5b')]));var _0x30b42b=this[_0xfc2a('0x88')][_0xfc2a('0x71')](this,_0x1a1fb1);if(_0x30b42b){this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x122'),_0x30b42b));var _0x1626b1=this[_0xfc2a('0xe')][_0xfc2a('0x102')](_0x30b42b);try{fs[_0xfc2a('0x123')](_0x30b42b+'.wav');}catch(_0x362b06){logger[_0xfc2a('0x28')](_0x362b06);}return _0x1626b1;}return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x1a1fb1,_0xfc2a('0x124'));};AGIVertices[_0xfc2a('0x14')]['awslex']=function(_0x64c1c4){logger['info'](util['format'](_0xfc2a('0x125'),_0x64c1c4[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x64c1c4['aws_access_key_id'])||!this[_0xfc2a('0x86')](_0x64c1c4[_0xfc2a('0x8d')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xfc2a('0x86')](_0x64c1c4[_0xfc2a('0x8f')])){return this['channel']['noop'](_0xfc2a('0x126'));}if(!this['isConfigured'](_0x64c1c4[_0xfc2a('0x5b')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xad'));}this[_0xfc2a('0xe')][_0xfc2a('0xe8')]=!![];this['createSquareDetailsReport'](_0x64c1c4);this['createSquareMessage'](_0x64c1c4[_0xfc2a('0x5b')],'in','','');this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')]('Trying\x20Amazon\x20Lex:\x20%s',_0x64c1c4[_0xfc2a('0x5b')]));var _0xa65353=this[_0xfc2a('0x8c')][_0xfc2a('0x71')](this,_0x64c1c4);if(_0xa65353){for(var _0x43d46e in _0xa65353){if(_0xa65353['hasOwnProperty'](_0x43d46e)&&_[_0xfc2a('0x98')](_0xa65353[_0x43d46e])){this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')]('AWS_LEX_%s',_0x43d46e[_0xfc2a('0x69')]()),_0xa65353[_0x43d46e]);}}if(_[_0xfc2a('0x40')](_0xa65353['message'])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0x127'));}else{this[_0xfc2a('0x3d')](_0xa65353[_0xfc2a('0x76')],'out',_0xfc2a('0x128'),'');return this[_0xfc2a('0xe')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0xa65353[_0xfc2a('0x76')]));}}return this[_0xfc2a('0xe')]['error'](_0x64c1c4,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xfc2a('0x14')]['googleasr']=function(_0x25f9b8){logger['info'](util[_0xfc2a('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x25f9b8['label'],_0x25f9b8[_0xfc2a('0x66')]));if(!this[_0xfc2a('0x86')](_0x25f9b8[_0xfc2a('0x82')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xe7'));}var _0xe21de7=_0xfc2a('0x129');var _0x478c50=util[_0xfc2a('0x25')](_0xfc2a('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x128ffb=util[_0xfc2a('0x25')](_0xfc2a('0xa0'),_0x478c50,_0xe21de7);var _0x469a7f=!![];if(_0x25f9b8[_0xfc2a('0x12b')]==='NOBEEP'){_0x469a7f=![];}var _0x2ef5c3=this['channel']['recordFile'](_0x478c50,_0xe21de7,_0x25f9b8[_0xfc2a('0x12c')],_0x25f9b8[_0xfc2a('0x66')],undefined,_0x469a7f);if(_0x2ef5c3[_0xfc2a('0xa7')]!==-0x1){this['channel']['noop'](util['format']('google\x20%s\x20file\x20created',_0x128ffb));var _0x41db91=this[_0xfc2a('0x90')][_0xfc2a('0x71')](this,_0x25f9b8,_0x128ffb);if(_0x41db91){for(var _0x7d89a in _0x41db91){if(_0x41db91[_0xfc2a('0x9c')](_0x7d89a)){this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')]('GOOGLE_ASR_%s',_0x7d89a[_0xfc2a('0x69')]()),_0x41db91[_0x7d89a]);}}return this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')]('GoogleASR\x20Result\x20%s',JSON[_0xfc2a('0xa2')](_0x41db91)));}}return _0x2ef5c3;};AGIVertices[_0xfc2a('0x14')]['tildeasr']=function(_0x5c14d9){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5c14d9[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x5c14d9[_0xfc2a('0x92')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x5c14d9['appsecret'])){return this['channel'][_0xfc2a('0xac')](_0xfc2a('0x12d'));}var _0x58b4d0=_0xfc2a('0x129');var _0x4e954b=util[_0xfc2a('0x25')](_0xfc2a('0x12a'),FILES_PATH,rs[_0xfc2a('0x117')](0x4));var _0x590353=util[_0xfc2a('0x25')](_0xfc2a('0xa0'),_0x4e954b,_0x58b4d0);var _0x3501f8=!![];if(_0x5c14d9['beep']===_0xfc2a('0x12e')){_0x3501f8=![];}var _0x3a32f1=this['channel']['recordFile'](_0x4e954b,_0x58b4d0,_0x5c14d9['intKey'],_0x5c14d9[_0xfc2a('0x66')],undefined,_0x3501f8);if(_0x3a32f1[_0xfc2a('0xa7')]!==-0x1){this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x12f'),_0x590353));var _0x35ff04=this['tildeASR']['sync'](this,_0x5c14d9,_0x590353);if(_0x35ff04){for(var _0xc7c49a in _0x35ff04){if(_0x35ff04[_0xfc2a('0x9c')](_0xc7c49a)){this['channel']['setVariable'](util['format'](_0xfc2a('0x130'),_0xc7c49a[_0xfc2a('0x69')]()),_0x35ff04[_0xc7c49a]);}}return this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x131'),JSON[_0xfc2a('0xa2')](_0x35ff04)));}}return _0x3a32f1;};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x132')]=function(_0xdadf1c){logger['info'](util['format'](_0xfc2a('0x133'),_0xdadf1c[_0xfc2a('0x35')]));return this[_0xfc2a('0xe')]['continueAt'](_0xdadf1c[_0xfc2a('0x39')],_0xdadf1c['extension'],_0xdadf1c[_0xfc2a('0x134')]);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x135')]=function(_0x594f9a){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x136'),_0x594f9a['label']));if(!this['isConfigured'](_0x594f9a[_0xfc2a('0x137')])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x594f9a,_0xfc2a('0x138'));}try{var _0x2d6e63=eval(_0x594f9a[_0xfc2a('0x137')])?_0xfc2a('0x139'):_0xfc2a('0x13a');this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x13b'),_0x594f9a['condition'],_0x2d6e63));return{'code':0xc8,'result':_0x2d6e63};}catch(_0x4f95b7){return{'code':0xc8,'result':_0xfc2a('0x13a')};}};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x13c')]=function(_0xf9f9c3){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x13d'),_0xf9f9c3['label']));if(!this[_0xfc2a('0x86')](_0xf9f9c3['interval_id'])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0xf9f9c3,_0xfc2a('0x13e'));}var _0x10a3b6=this[_0xfc2a('0x13f')]['sync'](this,_0xf9f9c3['interval_id']);if(!_0x10a3b6){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0xf9f9c3,_0xfc2a('0x140'));}for(var _0x3d4201=0x0;_0x3d4201<_0x10a3b6[_0xfc2a('0x9e')];_0x3d4201+=0x1){var _0xe5c58=this[_0xfc2a('0xe')]['getVariable'](util[_0xfc2a('0x25')]('IFTIME(%s?true:false)',_0x10a3b6[_0x3d4201]));if(_0xe5c58[_0xfc2a('0xa7')]===-0x1){return _0xe5c58;}logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('IFTIME\x20%s\x20%s',_0x10a3b6[_0x3d4201],_0xe5c58[_0xfc2a('0xa5')]));if(_0xe5c58[_0xfc2a('0xa5')]===_0xfc2a('0x139')){logger[_0xfc2a('0x2c')](util['format'](_0xfc2a('0x141'),_0x10a3b6[_0x3d4201],_0xfc2a('0x139')));this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x141'),_0x10a3b6[_0x3d4201],_0xfc2a('0x139')));return{'code':0xc8,'result':_0xfc2a('0x139')};}else{logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x141'),_0x10a3b6[_0x3d4201],_0xfc2a('0x13a')));this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x141'),_0x10a3b6[_0x3d4201],_0xfc2a('0x13a')));}}return{'code':0xc8,'result':_0xfc2a('0x13a')};};AGIVertices['prototype']['hangup']=function(_0x5284c6){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5284c6['label']));return this[_0xfc2a('0xe')][_0xfc2a('0x142')]();};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x143')]=function(_0x5493a9){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x144'),_0x5493a9[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x5493a9['key'])){return this['channel'][_0xfc2a('0xac')](_0xfc2a('0xe7'));}var _0x11d2f1=_0xfc2a('0x129');var _0x1ce40f=util[_0xfc2a('0x25')](_0xfc2a('0x12a'),FILES_PATH,rs[_0xfc2a('0x117')](0x4));var _0x42ad73=util['format'](_0xfc2a('0xa0'),_0x1ce40f,_0x11d2f1);var _0x1970f2=!![];if(_0x5493a9[_0xfc2a('0x12b')]==='NOBEEP'){_0x1970f2=![];}var _0x363526=this['channel'][_0xfc2a('0x145')](_0x1ce40f,_0x11d2f1,_0x5493a9[_0xfc2a('0x12c')],_0x5493a9[_0xfc2a('0x66')],undefined,_0x1970f2);if(_0x363526[_0xfc2a('0xa7')]!==-0x1){this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x146'),_0x42ad73));var _0x12bab4=this[_0xfc2a('0x84')][_0xfc2a('0x71')](this,_0x5493a9,_0x42ad73);if(_0x12bab4){for(var _0x323f3f in _0x12bab4){if(_0x12bab4[_0xfc2a('0x9c')](_0x323f3f)){this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util['format'](_0xfc2a('0x147'),_0x323f3f[_0xfc2a('0x69')]()),_0x12bab4[_0x323f3f]);}}return this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x148'),JSON[_0xfc2a('0xa2')](_0x12bab4)));}}return _0x363526;};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x149')]=function(_0x285628){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x14a'),_0x285628[_0xfc2a('0x35')]));if(!this['isConfigured'](_0x285628['key'])){return this['channel'][_0xfc2a('0xac')](_0xfc2a('0xe7'));}if(!this[_0xfc2a('0x86')](_0x285628[_0xfc2a('0x5b')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20text\x20configured');}this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x285628[_0xfc2a('0x5b')]));var _0x4c6465=this[_0xfc2a('0x81')][_0xfc2a('0x71')](this,_0x285628);if(_0x4c6465){this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')](_0xfc2a('0x146'),_0x4c6465));var _0x1c9a0d=this[_0xfc2a('0xe')]['streamFile'](_0x4c6465,_0x285628['intKey']);try{fs[_0xfc2a('0x123')](_0x4c6465+_0xfc2a('0x103'));}catch(_0x223fa9){logger['error'](_0x223fa9);}return _0x1c9a0d;}return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x285628,_0xfc2a('0x14b'));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x14c')]=function(_0x122ba7){logger[_0xfc2a('0x2c')](util['format'](_0xfc2a('0x14d'),_0x122ba7[_0xfc2a('0x35')]));if(!this['isConfigured'](_0x122ba7[_0xfc2a('0x14e')])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x122ba7,'no\x20find\x20by\x20configured');}logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x14f'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x122ba7['findBy']));var _0x199612=this[_0xfc2a('0x53')]['sync'](this,_0x122ba7[_0xfc2a('0x14e')]);if(_0x199612){logger['info'](util[_0xfc2a('0x25')](_0xfc2a('0x150'),this[_0xfc2a('0xe')]['callerid'],_0x122ba7[_0xfc2a('0x14e')]));this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x150'),this[_0xfc2a('0xe')]['callerid'],_0x122ba7[_0xfc2a('0x14e')]));return{'code':0xc8,'result':_0xfc2a('0x151')};}else{logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x152'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x122ba7[_0xfc2a('0x14e')]));this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format'](_0xfc2a('0x152'),this['channel']['callerid'],_0x122ba7[_0xfc2a('0x14e')]));return{'code':0xc8,'result':_0xfc2a('0x153')};}};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x154')]=function(_0x2f7909){logger['info'](util[_0xfc2a('0x25')](_0xfc2a('0x155'),_0x2f7909[_0xfc2a('0x35')]));if(!this['isConfigured'](_0x2f7909[_0xfc2a('0x14e')])){return this[_0xfc2a('0xe')]['error'](_0x2f7909,_0xfc2a('0x156'));}logger[_0xfc2a('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2f7909['findBy']));var _0x3cbee6=this[_0xfc2a('0x4f')]['sync'](this,_0x2f7909[_0xfc2a('0x14e')]);if(_0x3cbee6){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x150'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2f7909['findBy']));this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x150'),this['channel']['callerid'],_0x2f7909[_0xfc2a('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfc2a('0x2c')](util['format'](_0xfc2a('0x152'),this[_0xfc2a('0xe')]['callerid'],_0x2f7909[_0xfc2a('0x14e')]));this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x152'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2f7909['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xfc2a('0x157')]=function(_0x50dd00){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x158'),_0x50dd00['label']));if(!this[_0xfc2a('0x86')](_0x50dd00[_0xfc2a('0x159')])){return this['channel'][_0xfc2a('0x28')](_0x50dd00,'no\x20operation\x20configured');}this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x15a'),_0x50dd00[_0xfc2a('0x159')]));var _0x4bdbc7=eval(_0x50dd00[_0xfc2a('0x159')]);if(!this[_0xfc2a('0x86')](_0x50dd00[_0xfc2a('0xd6')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xd7'));}var _0x425675=this[_0xfc2a('0x10')]['sync'](this,_0x50dd00[_0xfc2a('0xd6')]);if(!_0x425675){return this['channel'][_0xfc2a('0x28')](_0x50dd00,_0xfc2a('0xd8'));}if(_['isArray'](_0x4bdbc7)){var _0x1e5753=this;_0x4bdbc7[_0xfc2a('0x15b')](function(_0x5ebb57,_0x3ef231){_0x1e5753[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')](_0xfc2a('0x15c'),_0x425675,_0x3ef231),_0x5ebb57);});return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x15d'),_0x425675));}else{return this[_0xfc2a('0xe')][_0xfc2a('0xa1')](_0x425675,_0x4bdbc7);}};AGIVertices['prototype'][_0xfc2a('0x15e')]=function(_0x25ae43){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x15f'),_0x25ae43[_0xfc2a('0x35')]));if(_0x25ae43[_0xfc2a('0xa9')]===0x0){return this[_0xfc2a('0xa8')](_0x25ae43);}_0x25ae43[_0xfc2a('0xa9')]-=0x1;if(!this[_0xfc2a('0x86')](_0x25ae43[_0xfc2a('0x160')])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x25ae43,_0xfc2a('0x110'));}var _0x55b736=this['getSound'][_0xfc2a('0x71')](this,_0x25ae43[_0xfc2a('0x160')]);if(!_0x55b736){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x25ae43,_0xfc2a('0x112'));}var _0x32df58=this[_0xfc2a('0xe')][_0xfc2a('0x161')](_0x55b736,_0x25ae43[_0xfc2a('0x162')],_0x25ae43[_0xfc2a('0x163')]);var _0x36b21e=_0x32df58[_0xfc2a('0xa7')];if(_0x32df58['result']===-0x1){this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x25ae43,'-1');return _0x32df58;}else if(_0x32df58[_0xfc2a('0xa5')]==='timeout'){_0x32df58[_0xfc2a('0xa7')]=_0x32df58[_0xfc2a('0xa7')][_0xfc2a('0x9e')]>0x0?_0x32df58[_0xfc2a('0xa7')]:'t';}else if(_['isEmpty'](_0x32df58[_0xfc2a('0xa7')])){_0x32df58[_0xfc2a('0xa7')]='#';_0x36b21e='#';}if(!this['isConfigured'](_0x25ae43[_0xfc2a('0xd6')])){this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0xd7'));}else{var _0x44027d=this[_0xfc2a('0x10')]['sync'](this,_0x25ae43[_0xfc2a('0xd6')]);if(!_0x44027d){return this['channel']['error'](_0x25ae43,'no\x20variable\x20found');}this[_0xfc2a('0xe')][_0xfc2a('0xa1')](_0x44027d,_0x36b21e);}this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x25ae43,_0x36b21e);return _0x32df58;};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0xac')]=function(_0x20d472){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x164'),_0x20d472['label']));return this['channel'][_0xfc2a('0xac')](_0x20d472['output']||_0x20d472[_0xfc2a('0x35')]);};AGIVertices['prototype']['pause']=function(_0x2a525f){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x165'),_0x2a525f['label']));if(!this[_0xfc2a('0x86')](_0x2a525f[_0xfc2a('0x14e')])){return this['channel'][_0xfc2a('0x28')](_0x2a525f,_0xfc2a('0x156'));}logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x14f'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2a525f[_0xfc2a('0x14e')]));var _0x15fcfb=this['getPause'][_0xfc2a('0x71')](this,_0x2a525f['pause_id']);var _0x2dc12d=this[_0xfc2a('0x4b')]['sync'](this,_0x2a525f[_0xfc2a('0x14e')],_0x15fcfb);if(_0x2dc12d){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x150'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2a525f[_0xfc2a('0x14e')]));this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format'](_0xfc2a('0x150'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2a525f[_0xfc2a('0x14e')]));return{'code':0xc8,'result':_0xfc2a('0x151')};}else{logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x152'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2a525f['findBy']));this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x150'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x2a525f['findBy']));return{'code':0xc8,'result':_0xfc2a('0x153')};}};AGIVertices[_0xfc2a('0x14')]['playback']=function(_0x1700a5){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x166'),_0x1700a5[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x1700a5['file_id'])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x1700a5,'no\x20file\x20audio\x20selected');}var _0x364ffb=this[_0xfc2a('0x111')][_0xfc2a('0x71')](this,_0x1700a5['file_id']);if(!_0x364ffb){return this['channel'][_0xfc2a('0x28')](_0x1700a5,_0xfc2a('0x112'));}var _0x39d114=this[_0xfc2a('0xe')]['exec'](_0xfc2a('0x167'),[_0x364ffb,_0x1700a5[_0xfc2a('0x10c')]]);if(_0x39d114[_0xfc2a('0xa7')]===-0x1){return _0x39d114;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xfc2a('0x167'),_0x364ffb));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x168')]=function(_0x3f5469){logger[_0xfc2a('0x2c')](util['format'](_0xfc2a('0x169'),_0x3f5469['label']));if(!this['isConfigured'](_0x3f5469[_0xfc2a('0x16a')])){return this['channel'][_0xfc2a('0x28')](_0x3f5469,_0xfc2a('0x16b'));}var _0x269902='';var _0x109f39=parseInt(_0x3f5469[_0xfc2a('0x16a')],0xa);if(isNaN(_0x109f39)){_0x269902=_0x3f5469['queue_id'];}else{_0x269902=this[_0xfc2a('0x15')]['sync'](this,_0x3f5469['queue_id']);if(!_0x269902){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x3f5469,_0xfc2a('0x16c'));}}var _0x5c820f='';if(this[_0xfc2a('0x86')](_0x3f5469[_0xfc2a('0x160')])){var _0x542a15=this[_0xfc2a('0x111')][_0xfc2a('0x71')](this,_0x3f5469['file_id']);if(_0x542a15){_0x5c820f=_0x542a15;}}this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x3f5469,_0x269902);if(_0x3f5469[_0xfc2a('0x10c')][_0xfc2a('0x16d')]('x')<0x0){_0x3f5469[_0xfc2a('0x10c')]+='x';}if(_0x3f5469[_0xfc2a('0x10c')]['indexOf']('X')<0x0){_0x3f5469[_0xfc2a('0x10c')]+='X';}this['channel']['setVariable'](_0xfc2a('0x16e'),_0x269902?_0x269902[_0xfc2a('0x16f')]():'');var _0x90a3fa=this['channel'][_0xfc2a('0x55')](_0xfc2a('0x170'),[_0x269902,_0x3f5469[_0xfc2a('0x10c')],_0x3f5469[_0xfc2a('0x63')],_0x5c820f,_0x3f5469['timeout'],_0x3f5469[_0xfc2a('0x7')],_0x3f5469[_0xfc2a('0x171')],_0x3f5469['gosub'],'',_0x3f5469[_0xfc2a('0x172')]]);if(_0x90a3fa[_0xfc2a('0xa7')]===-0x1){return _0x90a3fa;}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format'](_0xfc2a('0xc3'),_0xfc2a('0x170'),_0x269902));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x173')]=function(_0x4cceaf){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4cceaf[_0xfc2a('0x35')]));var _0x405827=_0x4cceaf[_0xfc2a('0x174')]||_0xfc2a('0x129');var _0x2b6bce=util['format']('%s_%s',this[_0xfc2a('0xe')][_0xfc2a('0x34')],rs['generate'](0x5));var _0x3ef161=util[_0xfc2a('0x25')](_0xfc2a('0x175'),FILES_PATH,_0x2b6bce,_0x405827);var _0x3c31b5=util[_0xfc2a('0x25')](_0xfc2a('0x12a'),FILES_PATH,_0x2b6bce);this[_0xfc2a('0x37')][_0xfc2a('0x71')](this,_0x4cceaf,_0x2b6bce,_0x3ef161);this['channel'][_0xfc2a('0xa1')]('RECORDING_SAVENAME',_0x2b6bce);logger['info'](_0xfc2a('0x176'),_0x3c31b5,_0x405827,_0x4cceaf[_0xfc2a('0x177')],_0x4cceaf[_0xfc2a('0x66')]);return this['channel'][_0xfc2a('0x145')](_0x3c31b5,_0x405827,_0x4cceaf[_0xfc2a('0x177')],_0x4cceaf[_0xfc2a('0x66')],undefined,!![]);};AGIVertices['prototype'][_0xfc2a('0x178')]=function(_0x67acaf){logger['info'](util[_0xfc2a('0x25')](_0xfc2a('0x179'),_0x67acaf['label']));if(!this[_0xfc2a('0x86')](_0x67acaf['url'])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0x17a'));}var _0xe06ed0=this[_0xfc2a('0x62')]['sync'](this,_0x67acaf);logger['info'](util['format'](_0xfc2a('0x17b'),util[_0xfc2a('0x17c')](_0xe06ed0,{'showHidden':![],'depth':null})));if(!this[_0xfc2a('0x86')](_0x67acaf[_0xfc2a('0xd6')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0x17d'));}var _0x293b36=this[_0xfc2a('0x10')]['sync'](this,_0x67acaf['variable_id']);if(!_0x293b36){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x67acaf,_0xfc2a('0xd8'));}this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')]('%s_STATUS_CODE',_0x293b36),_0xe06ed0[_0xfc2a('0x74')]?_0xe06ed0[_0xfc2a('0x74')]:_0xfc2a('0x17e'));this[_0xfc2a('0xe')][_0xfc2a('0xa1')](util[_0xfc2a('0x25')](_0xfc2a('0x17f'),_0x293b36),_0xe06ed0[_0xfc2a('0x75')]?_0xe06ed0['statusMessage']:'OK');if(_0xe06ed0[_0xfc2a('0x6a')]){try{this[_0xfc2a('0x9f')](_0xe06ed0['body'],_0x293b36);}catch(_0x248d2d){logger['error'](util['format'](_0xfc2a('0x180'),_0x293b36));}}return this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')]('variable\x20%s\x20set',_0x293b36));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x181')]=function(_0x5c193a){logger[_0xfc2a('0x2c')](util['format'](_0xfc2a('0x182'),_0x5c193a[_0xfc2a('0x35')]));return this['channel'][_0xfc2a('0x183')](_0x5c193a[_0xfc2a('0x184')][_0xfc2a('0x57')](/\s+/g,''),_0x5c193a[_0xfc2a('0x177')]);};AGIVertices['prototype'][_0xfc2a('0x185')]=function(_0x127049){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x186'),_0x127049[_0xfc2a('0x35')]));return this[_0xfc2a('0xe')][_0xfc2a('0x187')](_0x127049['number'][_0xfc2a('0x57')](/\s+/g,''),_0x127049['escape_digits']);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x188')]=function(_0x27c597){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x189'),_0x27c597[_0xfc2a('0x35')]));return this[_0xfc2a('0xe')][_0xfc2a('0x18a')](_0x27c597[_0xfc2a('0x5b')],_0x27c597[_0xfc2a('0x177')]);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x18b')]=function(_0x404a9f){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x18c'),_0x404a9f['label']));if(!this['isConfigured'](_0x404a9f[_0xfc2a('0x18d')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0x18e'));}var _0x2eab00=this[_0xfc2a('0x1f')][_0xfc2a('0x71')](this,_0x404a9f[_0xfc2a('0x18d')]);if(!_0x2eab00||!_0x2eab00['Smtp']){return this[_0xfc2a('0xe')]['error'](_0x404a9f,'no\x20mail\x20account\x20found');}var _0x1f4388={'from':util[_0xfc2a('0x25')](_0xfc2a('0x18f'),_0x2eab00[_0xfc2a('0x12')],_0x2eab00['email']||_0x2eab00['Smtp'][_0xfc2a('0x190')]),'to':_0x404a9f['to']||'','cc':_0x404a9f['cc']||'','bcc':_0x404a9f[_0xfc2a('0x191')]||'','subject':_0x404a9f[_0xfc2a('0x192')],'html':_0x404a9f[_0xfc2a('0x5b')],'text':_0x404a9f[_0xfc2a('0x5b')]};if(this[_0xfc2a('0x86')](_0x404a9f[_0xfc2a('0x193')])){}logger[_0xfc2a('0xdd')](_0xfc2a('0x194'),JSON[_0xfc2a('0xa2')](_0x1f4388));this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x404a9f,_0x404a9f[_0xfc2a('0x18d')]);this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x195'),_0x2eab00[_0xfc2a('0x12')]));this[_0xfc2a('0x21')][_0xfc2a('0x71')](this,_0x2eab00[_0xfc2a('0x196')],_0x1f4388);return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xfc2a('0x197')]=function(_0x22bc24){logger[_0xfc2a('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x22bc24[_0xfc2a('0x35')]));return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xfc2a('0x14')]['sendSMS']=function(_0xaeed23){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x198'),_0xaeed23[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0xaeed23[_0xfc2a('0x199')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20sms\x20account\x20configured');}var _0x198a88=this[_0xfc2a('0x19a')][_0xfc2a('0x71')](this,_0xaeed23['sms_account_id']);if(!_0x198a88){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0xaeed23,_0xfc2a('0x19b'));}var _0x5e4b5c={'body':_0xaeed23[_0xfc2a('0x19c')],'phone':_0xaeed23['to']||'','SmsAccountId':_0x198a88['id']};logger['debug'](_0xfc2a('0x19d'),JSON[_0xfc2a('0xa2')](_0x5e4b5c));this[_0xfc2a('0x33')]['sync'](this,_0xaeed23,_0xaeed23[_0xfc2a('0x199')]);this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')](_0xfc2a('0x19e'),_0x198a88['name']));this[_0xfc2a('0x32')][_0xfc2a('0x71')](this,_0x5e4b5c);return this['channel'][_0xfc2a('0xac')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x19f')]=function(_0x5ce6d9){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x1a0'),_0x5ce6d9[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x5ce6d9[_0xfc2a('0xd6')])){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x5ce6d9,_0xfc2a('0x1a1'));}var _0x3a8fb3=this[_0xfc2a('0x10')][_0xfc2a('0x71')](this,_0x5ce6d9['variable_id']);if(!_0x3a8fb3){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x5ce6d9,_0xfc2a('0xd8'));}return this[_0xfc2a('0xe')][_0xfc2a('0xa1')](_0x3a8fb3,_0x5ce6d9[_0xfc2a('0x1a2')]);};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x1a3')]=function(_0x3b3a4b){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3b3a4b[_0xfc2a('0x35')]));this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0x1a4'));if(_0x3b3a4b['answer']===_0xfc2a('0x1a5')){this[_0xfc2a('0xe')]['noop']('Answer');return this[_0xfc2a('0xe')]['answer']();}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](_0xfc2a('0x1a6'));};AGIVertices['prototype'][_0xfc2a('0x1a7')]=function(_0x5644ba){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x1a8'),_0x5644ba[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x5644ba['project_id'])){return this[_0xfc2a('0xe')]['error'](_0x5644ba,'no\x20subproject\x20selected');}var _0x26cddb=this['getSquareProject'][_0xfc2a('0x71')](this,_0x5644ba[_0xfc2a('0x1a9')]);if(!this['isConfigured'](_0x26cddb)){return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x5644ba,util[_0xfc2a('0x25')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5644ba[_0xfc2a('0x1a9')]));}if(_0x26cddb===this['channel'][_0xfc2a('0x36')]){return this[_0xfc2a('0xe')]['error'](_0x5644ba,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xfc2a('0x33')][_0xfc2a('0x71')](this,_0x5644ba,_0x26cddb);var _0x31fad8=this[_0xfc2a('0xe')][_0xfc2a('0x55')](_0xfc2a('0x1aa'),util[_0xfc2a('0x25')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xfc2a('0x7')][_0xfc2a('0x1ab')]||_0xfc2a('0x1ac'),_0x26cddb,this[_0xfc2a('0xe')][_0xfc2a('0x36')]));if(_0x31fad8[_0xfc2a('0xa7')]===-0x1){return _0x31fad8;}return this['channel']['noop'](util[_0xfc2a('0x25')](_0xfc2a('0xc3'),_0xfc2a('0x1aa'),_0x26cddb));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x1ad')]=function(_0x345ec8){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x1ae'),_0x345ec8[_0xfc2a('0x35')]));var _0x2249f9=this[_0xfc2a('0x54')][_0xfc2a('0x71')](this,_0x345ec8[_0xfc2a('0xb6')]);this['createSquareDetailsReport'][_0xfc2a('0x71')](this,_0x345ec8,_0x345ec8[_0xfc2a('0xb6')]);if(this['isConfigured'](_0x345ec8['variable_id'])){var _0x499952=this['getVariable'][_0xfc2a('0x71')](this,_0x345ec8['variable_id']);if(_0x499952){this['channel']['setVariable'](_0x499952,_0x2249f9);return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x1af'),_0x345ec8[_0xfc2a('0xb6')],_0x499952));}}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x1b0'),_0x345ec8['command']));};AGIVertices[_0xfc2a('0x14')]['google_cloud_tts']=function(_0x53fb28){logger['info'](util[_0xfc2a('0x25')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x53fb28[_0xfc2a('0x35')]));_0x53fb28['text']=_0x53fb28[_0xfc2a('0x5b')][_0xfc2a('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfc2a('0x86')](_0x53fb28[_0xfc2a('0x59')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x53fb28[_0xfc2a('0x5b')])){return this[_0xfc2a('0xe')][_0xfc2a('0xac')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xfc2a('0x25')](_0xfc2a('0x1b1'),_0x53fb28[_0xfc2a('0x5b')]));var _0x223846=this[_0xfc2a('0x58')][_0xfc2a('0x71')](this,_0x53fb28);if(_0x223846){this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x223846));var _0x417aee=this['channel'][_0xfc2a('0x102')](_0x223846);try{fs[_0xfc2a('0x123')](_0x223846+_0xfc2a('0x103'));}catch(_0x40682c){logger['error'](_0x40682c);}return _0x417aee;}return this[_0xfc2a('0xe')][_0xfc2a('0x28')](_0x53fb28,_0xfc2a('0x1b2'));};AGIVertices[_0xfc2a('0x14')][_0xfc2a('0x1b3')]=function(_0x588fef){logger['info'](util[_0xfc2a('0x25')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x588fef['label']));_0x588fef['text']=_0x588fef[_0xfc2a('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfc2a('0x86')](_0x588fef[_0xfc2a('0x5b')])){return this[_0xfc2a('0xe')]['noop'](_0xfc2a('0xad'));}this[_0xfc2a('0xe')][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x1b4'),_0x588fef['text']));var _0x3da102=this[_0xfc2a('0x60')][_0xfc2a('0x71')](this,_0x588fef);if(_0x3da102){this['channel'][_0xfc2a('0xac')](util[_0xfc2a('0x25')](_0xfc2a('0x1b5'),_0x3da102));var _0x211f54=this['channel'][_0xfc2a('0x102')](_0x3da102);try{fs['unlink'](_0x3da102+'.wav');}catch(_0x2f01a0){logger[_0xfc2a('0x28')](_0x2f01a0);}return _0x211f54;}return this['channel'][_0xfc2a('0x28')](_0x588fef,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['unpause']=function(_0x1e868f){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x1b6'),_0x1e868f[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x1e868f[_0xfc2a('0x14e')])){return this['channel'][_0xfc2a('0x28')](_0x1e868f,_0xfc2a('0x156'));}logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x14f'),this['channel'][_0xfc2a('0x4c')],_0x1e868f[_0xfc2a('0x14e')]));var _0x174b72=this['agentUnpause'][_0xfc2a('0x71')](this,_0x1e868f[_0xfc2a('0x14e')]);if(_0x174b72){logger[_0xfc2a('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x1e868f[_0xfc2a('0x14e')]));this['channel'][_0xfc2a('0xac')](util['format'](_0xfc2a('0x150'),this[_0xfc2a('0xe')][_0xfc2a('0x4c')],_0x1e868f[_0xfc2a('0x14e')]));return{'code':0xc8,'result':_0xfc2a('0x151')};}else{logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x152'),this['channel'][_0xfc2a('0x4c')],_0x1e868f['findBy']));this[_0xfc2a('0xe')]['noop'](util[_0xfc2a('0x25')](_0xfc2a('0x152'),this['channel'][_0xfc2a('0x4c')],_0x1e868f[_0xfc2a('0x14e')]));return{'code':0xc8,'result':_0xfc2a('0x153')};}};AGIVertices['prototype'][_0xfc2a('0x1b7')]=function(_0x398bb6){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x398bb6[_0xfc2a('0x35')]));var _0x11b1f8=this[_0xfc2a('0xe')][_0xfc2a('0x55')]('VOICEMAIL',[_0x398bb6[_0xfc2a('0x1b8')],_0x398bb6[_0xfc2a('0x78')]]);if(_0x11b1f8[_0xfc2a('0xa7')]===-0x1){return _0x11b1f8;}return this[_0xfc2a('0xe')][_0xfc2a('0xac')](util['format']('Executed\x20command\x20%s\x20%s',_0xfc2a('0x1b9'),_0x398bb6[_0xfc2a('0x1b8')]));};AGIVertices[_0xfc2a('0x14')]['vswitch']=function(_0x3ee487){logger[_0xfc2a('0x2c')](util[_0xfc2a('0x25')](_0xfc2a('0x1ba'),_0x3ee487[_0xfc2a('0x35')]));if(!this[_0xfc2a('0x86')](_0x3ee487[_0xfc2a('0xd6')])){return this[_0xfc2a('0xe')]['error'](_0x3ee487,'no\x20variable\x20selected');}var _0x3d8a33=this[_0xfc2a('0x10')]['sync'](this,_0x3ee487['variable_id']);if(!_0x3d8a33){return this['channel'][_0xfc2a('0x28')](_0x3ee487,_0xfc2a('0xd8'));}var _0x3c9917=this[_0xfc2a('0xe')][_0xfc2a('0x10')](_0x3d8a33);return{'code':0xc8,'result':_0x3c9917['extra']?_0x3c9917['extra']:'-'};};String[_0xfc2a('0x14')][_0xfc2a('0xa4')]=function(_0x2b6260,_0x163d9e){return this[_0xfc2a('0xa3')](_0x2b6260)[_0xfc2a('0x1bb')](_0x163d9e);};module[_0xfc2a('0x1bc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index a8ad6ed..db0c008 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 _0x7fb8=['info','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','interface','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','queue','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fb8,0x1b4));var _0x87fb=function(_0x10f67f,_0x362f78){_0x10f67f=_0x10f67f-0x0;var _0x2b4ea2=_0x7fb8[_0x10f67f];return _0x2b4ea2;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x87fb('0x0'));var ami=require('../ami');var logger=require(_0x87fb('0x1'))('acw');var RpcUser=require(_0x87fb('0x2'));var RpcVoiceAgentReport=require(_0x87fb('0x3'));function Acw(_0x1d1804){this[_0x87fb('0x4')]=_0x1d1804['voiceQueues'];this[_0x87fb('0x5')]=_0x1d1804[_0x87fb('0x5')];this['timers']=_0x1d1804[_0x87fb('0x6')];this[_0x87fb('0x7')]={};ami['on'](_0x87fb('0x8'),this[_0x87fb('0x9')][_0x87fb('0xa')](this));ami['on'](_0x87fb('0xb'),this[_0x87fb('0xc')][_0x87fb('0xa')](this));ami['on'](_0x87fb('0xd'),this['syncHangup'][_0x87fb('0xa')](this));ami['on'](_0x87fb('0xe'),this[_0x87fb('0xf')]['bind'](this));ami['on'](_0x87fb('0x10'),this[_0x87fb('0x11')]['bind'](this));ami['on']('blindtransfer',this[_0x87fb('0x12')][_0x87fb('0xa')](this));ami['on'](_0x87fb('0x13'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0xf7c0ab){var _0x31dc11=moment()['milliseconds'](0x0);var _0x116c37=moment(_0xf7c0ab)[_0x87fb('0x14')](0x0);return _0x31dc11[_0x87fb('0x15')](_0x116c37,_0x87fb('0x16'));}Acw['prototype']['startAcw']=function(_0x37e0ee){try{var _0x39ca50=this;var _0x433dd2=this['channels'][_0x37e0ee]['interface'];var _0x9523f1=this[_0x87fb('0x7')][_0x37e0ee][_0x87fb('0x17')];var _0x38b129=this[_0x87fb('0x4')][_0x9523f1];var _0x1ae831=![];var _0x44d91d='ACW';if(_0x38b129[_0x87fb('0x18')]){if(_0x38b129[_0x87fb('0x19')]['name']){_0x1ae831=!![];_0x44d91d=_0x38b129[_0x87fb('0x19')][_0x87fb('0x1a')];}}ami['Action']({'action':'QueuePause','interface':_0x433dd2,'paused':!![],'reason':_0x44d91d})[_0x87fb('0x1b')](function(_0x5be649){if(_0x39ca50['agents'][_0x433dd2]){return RpcUser[_0x87fb('0x1c')](_0x39ca50[_0x87fb('0x5')][_0x433dd2]['id'])[_0x87fb('0x1b')](function(_0x1a202c){if(_0x1a202c&&!_0x1a202c[_0x87fb('0x1d')]){logger['info'](_0x87fb('0x1e'),_0x37e0ee,_0x433dd2,_0x9523f1);var _0x38da6c=_0x39ca50[_0x87fb('0x7')][_0x37e0ee][_0x87fb('0x1f')]&&_0x39ca50[_0x87fb('0x7')][_0x37e0ee][_0x87fb('0x20')]?_0x39ca50[_0x87fb('0x7')][_0x37e0ee][_0x87fb('0x20')]:_0x37e0ee;return RpcUser[_0x87fb('0x21')](_0x39ca50[_0x87fb('0x5')][_0x433dd2],_0x44d91d,_0x38da6c)[_0x87fb('0x1b')](function(_0x1345a5){if(!_0x1ae831){_0x39ca50[_0x87fb('0x6')][_0x433dd2]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x37e0ee,_0x39ca50[_0x87fb('0x4')][_0x9523f1][_0x87fb('0x22')],_0x433dd2,_0x9523f1);_0x39ca50[_0x87fb('0x6')][_0x433dd2]['timer']=setTimeout(_0x39ca50[_0x87fb('0x23')][_0x87fb('0xa')](_0x39ca50,_0x433dd2),_0x39ca50[_0x87fb('0x4')][_0x9523f1][_0x87fb('0x22')]*0x3e8);_0x39ca50['timers'][_0x433dd2][_0x87fb('0x24')]=moment()[_0x87fb('0x25')](_0x87fb('0x26'));_0x39ca50[_0x87fb('0x6')][_0x433dd2][_0x87fb('0x27')]=_0x37e0ee;_0x39ca50['timers'][_0x433dd2][_0x87fb('0x17')]=_0x9523f1;_0x39ca50[_0x87fb('0x6')][_0x433dd2]['updateAcw']=function(){var _0xdbd630=getDiff(_0x39ca50['timers'][_0x433dd2]['lastPauseAt']);clearTimeout(_0x39ca50[_0x87fb('0x6')][_0x433dd2]['timer']);_0x39ca50[_0x87fb('0x6')][_0x433dd2]['timer']=![];RpcVoiceAgentReport[_0x87fb('0x28')]({'acwtime':_0xdbd630},_0x39ca50[_0x87fb('0x6')][_0x433dd2][_0x87fb('0x27')],_0x433dd2)[_0x87fb('0x1b')](function(_0x489388){logger['info'](_0x87fb('0x29'),_0x37e0ee,_0xdbd630,_0x489388);})['catch'](function(_0x3d0b6b){logger[_0x87fb('0x2a')](_0x87fb('0x2b'),_0x37e0ee,_0x3d0b6b);});delete _0x39ca50['timers'][_0x433dd2];};}});}else{logger[_0x87fb('0x2c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x37e0ee,_0x433dd2,_0x9523f1);}});}})[_0x87fb('0x2d')](function(_0x3b0a52){logger['error'](_0x87fb('0x2e'),_0x37e0ee,_0x39ca50['voiceQueues'][_0x9523f1]['acwTimeout'],_0x433dd2,_0x9523f1);})['finally'](function(){delete _0x39ca50[_0x87fb('0x7')][_0x37e0ee];});}catch(_0x319c44){logger['error'](_0x87fb('0x2f'),_0x319c44[_0x87fb('0x30')]);}};Acw[_0x87fb('0x31')][_0x87fb('0x23')]=function(_0x2b9a28){try{var _0xa40291=this;if(_0xa40291[_0x87fb('0x6')][_0x2b9a28]){_0xa40291['timers'][_0x2b9a28]['timer']=![];var _0x46e49d=_0xa40291[_0x87fb('0x6')][_0x2b9a28][_0x87fb('0x27')];var _0xce9c09=_0xa40291[_0x87fb('0x6')][_0x2b9a28][_0x87fb('0x17')];var _0x242c73=_0xa40291[_0x87fb('0x4')][_0xce9c09][_0x87fb('0x22')];logger[_0x87fb('0x2c')](_0x87fb('0x32'),_0x46e49d,_0x2b9a28);RpcUser[_0x87fb('0x33')](this[_0x87fb('0x5')][_0x2b9a28]);RpcVoiceAgentReport[_0x87fb('0x28')]({'acwtime':_0x242c73,'agentacw':!![]},_0x46e49d,_0x2b9a28)[_0x87fb('0x1b')](function(_0x12d85f){logger[_0x87fb('0x2c')]('[%s][UPDATE][ACWTIME:%s]',_0x46e49d,_0x242c73,_0x12d85f);})[_0x87fb('0x2d')](function(_0x2097be){logger['error'](_0x87fb('0x2b'),_0x46e49d,_0x2097be);});}else{logger['error'](_0x87fb('0x34'),_0x2b9a28);if(_0xa40291[_0x87fb('0x6')]){logger[_0x87fb('0x2c')](_0x87fb('0x35'),JSON['stringify'](_0xa40291[_0x87fb('0x6')]));}}}catch(_0x6622c4){logger[_0x87fb('0x2a')](_0x87fb('0x36'),_0x6622c4[_0x87fb('0x30')]);}};Acw[_0x87fb('0x31')]['syncAgentConnect']=function(_0x317c97){try{if(this[_0x87fb('0x4')][_0x317c97['queue']]&&(this[_0x87fb('0x4')][_0x317c97['queue']][_0x87fb('0x37')]||this[_0x87fb('0x4')][_0x317c97[_0x87fb('0x17')]][_0x87fb('0x18')])){if(this[_0x87fb('0x5')][_0x317c97[_0x87fb('0x38')]]){this[_0x87fb('0x7')][_0x317c97[_0x87fb('0x27')]]={'queue':_0x317c97[_0x87fb('0x17')],'interface':_0x317c97[_0x87fb('0x38')],'destlinkedid':_0x317c97['destlinkedid']};}}}catch(_0x267db3){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x267db3[_0x87fb('0x30')]);}};Acw[_0x87fb('0x31')][_0x87fb('0x39')]=function(_0x93f03e){try{if(this[_0x87fb('0x4')][_0x93f03e[_0x87fb('0x17')]]&&(this[_0x87fb('0x4')][_0x93f03e['queue']][_0x87fb('0x37')]||this[_0x87fb('0x4')][_0x93f03e[_0x87fb('0x17')]]['mandatoryDisposition'])){if(this[_0x87fb('0x5')][_0x93f03e['interface']]){this[_0x87fb('0x7')][_0x93f03e[_0x87fb('0x27')]]={'queue':_0x93f03e[_0x87fb('0x17')],'interface':_0x93f03e['interface']};}}}catch(_0x4a383d){logger[_0x87fb('0x2a')](_0x87fb('0x3a'),_0x4a383d['message']);}};Acw['prototype'][_0x87fb('0xc')]=function(_0x319858){try{if(this[_0x87fb('0x7')][_0x319858['uniqueid']]&&_[_0x87fb('0x3b')](this[_0x87fb('0x7')][_0x319858[_0x87fb('0x27')]][_0x87fb('0x1f')])){logger[_0x87fb('0x2c')]('[%s][HANGUP:UNIQUEID]',_0x319858[_0x87fb('0x27')]);this[_0x87fb('0x3c')](_0x319858[_0x87fb('0x27')]);}else if(this[_0x87fb('0x7')][_0x319858['linkedid']]&&_[_0x87fb('0x3b')](this['channels'][_0x319858[_0x87fb('0x3d')]]['attended'])){logger[_0x87fb('0x2c')](_0x87fb('0x3e'),_0x319858[_0x87fb('0x3d')]);this['startAcw'](_0x319858['linkedid']);}}catch(_0xabcd69){logger['error'](_0x87fb('0x3f'),_0xabcd69[_0x87fb('0x30')]);}};Acw[_0x87fb('0x31')][_0x87fb('0x40')]=function(_0x33bc6f){try{if(this[_0x87fb('0x7')][_0x33bc6f['uniqueid']]&&this[_0x87fb('0x7')][_0x33bc6f[_0x87fb('0x27')]]['attended']){logger['info'](_0x87fb('0x41'),_0x33bc6f['uniqueid']);this[_0x87fb('0x3c')](_0x33bc6f['uniqueid']);}else if(this[_0x87fb('0x7')][_0x33bc6f[_0x87fb('0x3d')]]&&this['channels'][_0x33bc6f[_0x87fb('0x3d')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x33bc6f[_0x87fb('0x3d')]);this[_0x87fb('0x3c')](_0x33bc6f[_0x87fb('0x3d')]);}}catch(_0x4e4497){logger[_0x87fb('0x2a')](_0x87fb('0x42'),_0x4e4497[_0x87fb('0x30')]);}};Acw[_0x87fb('0x31')]['syncAttendedTransfer']=function(_0x38b9fc){try{if(!_['isNil'](this[_0x87fb('0x7')][_0x38b9fc[_0x87fb('0x43')]])){this[_0x87fb('0x3c')](_0x38b9fc[_0x87fb('0x43')]);if(this['channels'][_0x38b9fc['secondtransfereruniqueid']]){this[_0x87fb('0x7')][_0x38b9fc[_0x87fb('0x44')]][_0x87fb('0x1f')]=!![];this[_0x87fb('0x7')][_0x38b9fc[_0x87fb('0x45')]]=this[_0x87fb('0x7')][_0x38b9fc[_0x87fb('0x44')]];delete this[_0x87fb('0x7')][_0x38b9fc[_0x87fb('0x44')]];}}else if(!_['isNil'](this[_0x87fb('0x7')][_0x38b9fc[_0x87fb('0x45')]])){this['startAcw'](_0x38b9fc[_0x87fb('0x45')]);if(this['channels'][_0x38b9fc[_0x87fb('0x46')]]){this[_0x87fb('0x7')][_0x38b9fc[_0x87fb('0x46')]][_0x87fb('0x1f')]=!![];this[_0x87fb('0x7')][_0x38b9fc['transfereeuniqueid']]=this['channels'][_0x38b9fc[_0x87fb('0x46')]];delete this['channels'][_0x38b9fc[_0x87fb('0x46')]];}}}catch(_0x48e701){logger[_0x87fb('0x2a')](_0x87fb('0x47'),_0x48e701[_0x87fb('0x30')]);}};Acw[_0x87fb('0x31')]['syncBlindTransfer']=function(_0x5d9eb0){try{if(this[_0x87fb('0x7')][_0x5d9eb0[_0x87fb('0x48')]]){logger[_0x87fb('0x2c')](_0x87fb('0x49'),JSON[_0x87fb('0x4a')](_0x5d9eb0['transfereruniqueid']));this[_0x87fb('0x3c')](_0x5d9eb0[_0x87fb('0x48')]);}else if(this['channels'][_0x5d9eb0[_0x87fb('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x87fb('0x4a')](_0x5d9eb0[_0x87fb('0x4b')]));this[_0x87fb('0x3c')](_0x5d9eb0[_0x87fb('0x4b')]);}}catch(_0x19f523){logger[_0x87fb('0x2a')]('[ACW][syncBlindTransfer]\x20%s',_0x19f523['message']);}};Acw[_0x87fb('0x31')][_0x87fb('0xf')]=function(_0x266dd2){try{if(this[_0x87fb('0x4')][_0x266dd2[_0x87fb('0x17')]]&&this['voiceQueues'][_0x266dd2[_0x87fb('0x17')]][_0x87fb('0x4c')]===_0x87fb('0x4d')){if(this[_0x87fb('0x5')][_0x266dd2[_0x87fb('0x38')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x266dd2[_0x87fb('0x27')],_0x266dd2[_0x87fb('0x38')],_0x266dd2[_0x87fb('0x17')]);return RpcUser['savePause'](this[_0x87fb('0x5')][_0x266dd2[_0x87fb('0x38')]],_0x87fb('0x4e'),_0x266dd2[_0x87fb('0x27')]);}}}catch(_0x2d37b0){logger[_0x87fb('0x2a')](_0x87fb('0x4f'),_0x2d37b0[_0x87fb('0x30')]);}};module['exports']=Acw; \ No newline at end of file +var _0x59aa=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','acw','interface','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch','error'];(function(_0x40128d,_0x429c3a){var _0x2df122=function(_0x48d48c){while(--_0x48d48c){_0x40128d['push'](_0x40128d['shift']());}};_0x2df122(++_0x429c3a);}(_0x59aa,0x7c));var _0xa59a=function(_0x5b3e2d,_0x16c3b2){_0x5b3e2d=_0x5b3e2d-0x0;var _0x18f614=_0x59aa[_0x5b3e2d];return _0x18f614;};'use strict';var util=require(_0xa59a('0x0'));var _=require(_0xa59a('0x1'));var moment=require('moment');var ami=require(_0xa59a('0x2'));var logger=require(_0xa59a('0x3'))('acw');var RpcUser=require(_0xa59a('0x4'));var RpcVoiceAgentReport=require(_0xa59a('0x5'));function Acw(_0xf7da8c){this[_0xa59a('0x6')]=_0xf7da8c[_0xa59a('0x6')];this[_0xa59a('0x7')]=_0xf7da8c[_0xa59a('0x7')];this[_0xa59a('0x8')]=_0xf7da8c['timers'];this[_0xa59a('0x9')]={};ami['on'](_0xa59a('0xa'),this['syncAgentConnect'][_0xa59a('0xb')](this));ami['on'](_0xa59a('0xc'),this[_0xa59a('0xd')][_0xa59a('0xb')](this));ami['on'](_0xa59a('0xe'),this[_0xa59a('0xf')][_0xa59a('0xb')](this));ami['on'](_0xa59a('0x10'),this['syncAgentRingNoAnswer'][_0xa59a('0xb')](this));ami['on'](_0xa59a('0x11'),this[_0xa59a('0x12')][_0xa59a('0xb')](this));ami['on'](_0xa59a('0x13'),this[_0xa59a('0x14')]['bind'](this));ami['on'](_0xa59a('0x15'),this['syncAgentConnectPreview'][_0xa59a('0xb')](this));}function getDiff(_0x5c6390){var _0x554a5a=moment()[_0xa59a('0x16')](0x0);var _0x2ac0ff=moment(_0x5c6390)[_0xa59a('0x16')](0x0);return _0x554a5a[_0xa59a('0x17')](_0x2ac0ff,'seconds');}Acw['prototype'][_0xa59a('0x18')]=function(_0x4caf30){try{var _0x9cc5b2=this;var _0x593e43=this[_0xa59a('0x9')][_0x4caf30]['interface'];var _0x505e74=this['channels'][_0x4caf30][_0xa59a('0x19')];var _0x3e630e=this[_0xa59a('0x6')][_0x505e74];var _0x8c32c1=![];var _0x2b5660='ACW';if(_0x3e630e[_0xa59a('0x1a')]){if(_0x3e630e[_0xa59a('0x1b')][_0xa59a('0x1c')]){_0x8c32c1=!![];_0x2b5660=_0x3e630e['mandatoryDispositionPause'][_0xa59a('0x1c')];}}ami[_0xa59a('0x1d')]({'action':'QueuePause','interface':_0x593e43,'paused':!![],'reason':_0x2b5660})[_0xa59a('0x1e')](function(_0x5eae1c){if(_0x9cc5b2[_0xa59a('0x7')][_0x593e43]){return RpcUser[_0xa59a('0x1f')](_0x9cc5b2['agents'][_0x593e43]['id'])[_0xa59a('0x1e')](function(_0x51b234){if(_0x51b234&&!_0x51b234[_0xa59a('0x20')]){logger[_0xa59a('0x21')](_0xa59a('0x22'),_0x4caf30,_0x593e43,_0x505e74);var _0x4781eb=_0x9cc5b2[_0xa59a('0x9')][_0x4caf30][_0xa59a('0x23')]&&_0x9cc5b2[_0xa59a('0x9')][_0x4caf30][_0xa59a('0x24')]?_0x9cc5b2[_0xa59a('0x9')][_0x4caf30][_0xa59a('0x24')]:_0x4caf30;return RpcUser[_0xa59a('0x25')](_0x9cc5b2[_0xa59a('0x7')][_0x593e43],_0x2b5660,_0x4781eb)[_0xa59a('0x1e')](function(_0x1af09d){if(!_0x8c32c1){_0x9cc5b2['timers'][_0x593e43]={};logger[_0xa59a('0x21')](_0xa59a('0x26'),_0x4caf30,_0x9cc5b2[_0xa59a('0x6')][_0x505e74][_0xa59a('0x27')],_0x593e43,_0x505e74);_0x9cc5b2[_0xa59a('0x8')][_0x593e43]['timer']=setTimeout(_0x9cc5b2[_0xa59a('0x28')][_0xa59a('0xb')](_0x9cc5b2,_0x593e43),_0x9cc5b2[_0xa59a('0x6')][_0x505e74][_0xa59a('0x27')]*0x3e8);_0x9cc5b2[_0xa59a('0x8')][_0x593e43][_0xa59a('0x29')]=moment()[_0xa59a('0x2a')](_0xa59a('0x2b'));_0x9cc5b2['timers'][_0x593e43][_0xa59a('0x2c')]=_0x4caf30;_0x9cc5b2['timers'][_0x593e43]['queue']=_0x505e74;_0x9cc5b2[_0xa59a('0x8')][_0x593e43][_0xa59a('0x2d')]=function(){var _0x2b731b=getDiff(_0x9cc5b2[_0xa59a('0x8')][_0x593e43][_0xa59a('0x29')]);clearTimeout(_0x9cc5b2[_0xa59a('0x8')][_0x593e43][_0xa59a('0x2e')]);_0x9cc5b2[_0xa59a('0x8')][_0x593e43][_0xa59a('0x2e')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2b731b},_0x9cc5b2[_0xa59a('0x8')][_0x593e43][_0xa59a('0x2c')],_0x593e43)[_0xa59a('0x1e')](function(_0x5d22b6){logger[_0xa59a('0x21')](_0xa59a('0x2f'),_0x4caf30,_0x2b731b,_0x5d22b6);})[_0xa59a('0x30')](function(_0x3a841b){logger[_0xa59a('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x4caf30,_0x3a841b);});delete _0x9cc5b2[_0xa59a('0x8')][_0x593e43];};}});}else{logger[_0xa59a('0x21')](_0xa59a('0x32'),_0x4caf30,_0x593e43,_0x505e74);}});}})[_0xa59a('0x30')](function(_0x2bc5a7){logger[_0xa59a('0x31')](_0xa59a('0x26'),_0x4caf30,_0x9cc5b2[_0xa59a('0x6')][_0x505e74]['acwTimeout'],_0x593e43,_0x505e74);})[_0xa59a('0x33')](function(){delete _0x9cc5b2['channels'][_0x4caf30];});}catch(_0x9ca440){logger['error'](_0xa59a('0x34'),_0x9ca440['message']);}};Acw[_0xa59a('0x35')][_0xa59a('0x28')]=function(_0x487dac){try{var _0x152c32=this;if(_0x152c32[_0xa59a('0x8')][_0x487dac]){_0x152c32['timers'][_0x487dac][_0xa59a('0x2e')]=![];var _0x1fef76=_0x152c32[_0xa59a('0x8')][_0x487dac][_0xa59a('0x2c')];var _0x41c93c=_0x152c32[_0xa59a('0x8')][_0x487dac][_0xa59a('0x19')];var _0x57ab1e=_0x152c32['voiceQueues'][_0x41c93c][_0xa59a('0x27')];logger[_0xa59a('0x21')](_0xa59a('0x36'),_0x1fef76,_0x487dac);RpcUser[_0xa59a('0x37')](this[_0xa59a('0x7')][_0x487dac]);RpcVoiceAgentReport[_0xa59a('0x38')]({'acwtime':_0x57ab1e,'agentacw':!![]},_0x1fef76,_0x487dac)[_0xa59a('0x1e')](function(_0x1e28a9){logger[_0xa59a('0x21')](_0xa59a('0x2f'),_0x1fef76,_0x57ab1e,_0x1e28a9);})[_0xa59a('0x30')](function(_0xa47b95){logger[_0xa59a('0x31')](_0xa59a('0x39'),_0x1fef76,_0xa47b95);});}else{logger[_0xa59a('0x31')](_0xa59a('0x3a'),_0x487dac);if(_0x152c32[_0xa59a('0x8')]){logger[_0xa59a('0x21')]('[ACW][TIMERS]',JSON[_0xa59a('0x3b')](_0x152c32[_0xa59a('0x8')]));}}}catch(_0x4a46b1){logger[_0xa59a('0x31')](_0xa59a('0x3c'),_0x4a46b1[_0xa59a('0x3d')]);}};Acw[_0xa59a('0x35')][_0xa59a('0x3e')]=function(_0x4bafd2){try{if(this[_0xa59a('0x6')][_0x4bafd2[_0xa59a('0x19')]]&&(this[_0xa59a('0x6')][_0x4bafd2[_0xa59a('0x19')]][_0xa59a('0x3f')]||this['voiceQueues'][_0x4bafd2[_0xa59a('0x19')]][_0xa59a('0x1a')])){if(this[_0xa59a('0x7')][_0x4bafd2[_0xa59a('0x40')]]){this[_0xa59a('0x9')][_0x4bafd2[_0xa59a('0x2c')]]={'queue':_0x4bafd2[_0xa59a('0x19')],'interface':_0x4bafd2['interface'],'destlinkedid':_0x4bafd2[_0xa59a('0x24')]};}}}catch(_0x5bd21f){logger[_0xa59a('0x31')](_0xa59a('0x41'),_0x5bd21f[_0xa59a('0x3d')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x17f471){try{if(this[_0xa59a('0x6')][_0x17f471[_0xa59a('0x19')]]&&(this['voiceQueues'][_0x17f471[_0xa59a('0x19')]][_0xa59a('0x3f')]||this[_0xa59a('0x6')][_0x17f471[_0xa59a('0x19')]][_0xa59a('0x1a')])){if(this['agents'][_0x17f471['interface']]){this[_0xa59a('0x9')][_0x17f471[_0xa59a('0x2c')]]={'queue':_0x17f471['queue'],'interface':_0x17f471['interface']};}}}catch(_0x45bf3a){logger[_0xa59a('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x45bf3a[_0xa59a('0x3d')]);}};Acw[_0xa59a('0x35')][_0xa59a('0xd')]=function(_0x34fdeb){try{if(this[_0xa59a('0x9')][_0x34fdeb[_0xa59a('0x2c')]]&&_[_0xa59a('0x42')](this[_0xa59a('0x9')][_0x34fdeb[_0xa59a('0x2c')]][_0xa59a('0x23')])){logger[_0xa59a('0x21')](_0xa59a('0x43'),_0x34fdeb[_0xa59a('0x2c')]);this['startAcw'](_0x34fdeb[_0xa59a('0x2c')]);}else if(this[_0xa59a('0x9')][_0x34fdeb['linkedid']]&&_[_0xa59a('0x42')](this[_0xa59a('0x9')][_0x34fdeb[_0xa59a('0x44')]][_0xa59a('0x23')])){logger[_0xa59a('0x21')]('[%s][HANGUP:LINKEDID]',_0x34fdeb[_0xa59a('0x44')]);this[_0xa59a('0x18')](_0x34fdeb[_0xa59a('0x44')]);}}catch(_0x167239){logger['error'](_0xa59a('0x45'),_0x167239[_0xa59a('0x3d')]);}};Acw['prototype'][_0xa59a('0xf')]=function(_0x4d9e45){try{if(this['channels'][_0x4d9e45[_0xa59a('0x2c')]]&&this[_0xa59a('0x9')][_0x4d9e45['uniqueid']][_0xa59a('0x23')]){logger[_0xa59a('0x21')](_0xa59a('0x46'),_0x4d9e45[_0xa59a('0x2c')]);this[_0xa59a('0x18')](_0x4d9e45['uniqueid']);}else if(this['channels'][_0x4d9e45[_0xa59a('0x44')]]&&this[_0xa59a('0x9')][_0x4d9e45[_0xa59a('0x44')]][_0xa59a('0x23')]){logger['info'](_0xa59a('0x47'),_0x4d9e45[_0xa59a('0x44')]);this['startAcw'](_0x4d9e45[_0xa59a('0x44')]);}}catch(_0x17891d){logger['error'](_0xa59a('0x48'),_0x17891d['message']);}};Acw[_0xa59a('0x35')][_0xa59a('0x12')]=function(_0x3d5ebf){try{if(!_['isNil'](this['channels'][_0x3d5ebf['transfereeuniqueid']])){this[_0xa59a('0x18')](_0x3d5ebf[_0xa59a('0x49')]);if(this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x4a')]]){this['channels'][_0x3d5ebf[_0xa59a('0x4a')]][_0xa59a('0x23')]=!![];this['channels'][_0x3d5ebf['transfertargetuniqueid']]=this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x4a')]];delete this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x4a')]];}}else if(!_['isNil'](this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x4b')]])){this[_0xa59a('0x18')](_0x3d5ebf[_0xa59a('0x4b')]);if(this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x4c')]]){this['channels'][_0x3d5ebf[_0xa59a('0x4c')]][_0xa59a('0x23')]=!![];this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x49')]]=this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x4c')]];delete this[_0xa59a('0x9')][_0x3d5ebf[_0xa59a('0x4c')]];}}}catch(_0x4006c9){logger[_0xa59a('0x31')](_0xa59a('0x4d'),_0x4006c9[_0xa59a('0x3d')]);}};Acw[_0xa59a('0x35')][_0xa59a('0x14')]=function(_0x8b4936){try{if(this[_0xa59a('0x9')][_0x8b4936['transfereruniqueid']]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xa59a('0x3b')](_0x8b4936['transfereruniqueid']));this[_0xa59a('0x18')](_0x8b4936['transfereruniqueid']);}else if(this[_0xa59a('0x9')][_0x8b4936[_0xa59a('0x4e')]]){logger[_0xa59a('0x21')](_0xa59a('0x4f'),JSON['stringify'](_0x8b4936['transfererlinkedid']));this['startAcw'](_0x8b4936[_0xa59a('0x4e')]);}}catch(_0x16b087){logger[_0xa59a('0x31')](_0xa59a('0x50'),_0x16b087[_0xa59a('0x3d')]);}};Acw[_0xa59a('0x35')][_0xa59a('0x51')]=function(_0x44eeee){try{if(this['voiceQueues'][_0x44eeee[_0xa59a('0x19')]]&&this[_0xa59a('0x6')][_0x44eeee['queue']][_0xa59a('0x52')]===_0xa59a('0x53')){if(this[_0xa59a('0x7')][_0x44eeee[_0xa59a('0x40')]]){logger[_0xa59a('0x21')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x44eeee['uniqueid'],_0x44eeee['interface'],_0x44eeee[_0xa59a('0x19')]);return RpcUser[_0xa59a('0x25')](this[_0xa59a('0x7')][_0x44eeee['interface']],_0xa59a('0x54'),_0x44eeee[_0xa59a('0x2c')]);}}}catch(_0xb22b37){logger[_0xa59a('0x31')](_0xa59a('0x55'),_0xb22b37[_0xa59a('0x3d')]);}};module[_0xa59a('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 2ec6d87..4546aba 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2032,0xd9));var _0x2203=function(_0x25ddee,_0x37acb0){_0x25ddee=_0x25ddee-0x0;var _0x31e2e0=_0x2032[_0x25ddee];return _0x31e2e0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0x0713=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error'];(function(_0x2bebc8,_0x2595ee){var _0x5eb85c=function(_0x36ae73){while(--_0x36ae73){_0x2bebc8['push'](_0x2bebc8['shift']());}};_0x5eb85c(++_0x2595ee);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var _=require(_0x3071('0x2'));var logger=require(_0x3071('0x3'))(_0x3071('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3071('0x5')][_0x3071('0x6')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')][_0x3071('0x8')],!![]);ami[_0x3071('0x9')]();ami[_0x3071('0xa')]=BPromise[_0x3071('0xb')](ami[_0x3071('0xc')]);function error(_0x2fce7a){logger[_0x3071('0xd')](util['format'](_0x3071('0xe'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')]['port'],util[_0x3071('0xf')](_0x2fce7a,![],null)));}function close(){logger[_0x3071('0xd')](util[_0x3071('0x10')](_0x3071('0x11'),config[_0x3071('0x5')]['username'],config['asterisk']['ip'],config[_0x3071('0x5')]['port']));}ami[_0x3071('0x12')]=function(){return function(){return ami[_0x3071('0xa')]({'action':'sipshowregistry'});};};ami[_0x3071('0x13')]=function(){return function(){return ami['Action']({'action':_0x3071('0x14')});};};ami[_0x3071('0x15')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x16')});};};ami[_0x3071('0x17')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x18')});};};ami[_0x3071('0x19')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x1a')});};};function connect(_0x5f3c22){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x1c'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));ami['once'](_0x3071('0xd'),error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x3071('0x1f'),function(_0x5cd80d){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x20'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')],util['inspect'](_0x5cd80d,![],null)));});ami['on']('fullybooted',function(_0x2ce48a){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x21'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));return BPromise['resolve']()[_0x3071('0x22')](ami[_0x3071('0x12')]())[_0x3071('0x22')](ami['actionDeviceStateList']())[_0x3071('0x22')](ami[_0x3071('0x15')]())[_0x3071('0x22')](ami[_0x3071('0x17')]())[_0x3071('0x22')](ami[_0x3071('0x19')]())[_0x3071('0x23')](function(_0x3921a1){logger[_0x3071('0xd')](_0x3071('0x24'),util[_0x3071('0xf')](_0x3921a1,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);module[_0x3071('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 00a672b..693ff43 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 _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x56c4b8,_0x17f78d){var _0x222836=function(_0x256120){while(--_0x256120){_0x56c4b8['push'](_0x56c4b8['shift']());}};_0x222836(++_0x17f78d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x45735b,_0x15bf2f){var _0x1c7553=function(_0x2e9713){while(--_0x2e9713){_0x45735b['push'](_0x45735b['shift']());}};_0x1c7553(++_0x15bf2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index da492f8..e28b8e1 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 _0x8ce5=['callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','voiceQueue','util','moment','isNil','string','uniqueid','name','Contact','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callbackuniqueid'];(function(_0x43cc3b,_0x2f3963){var _0x44fe5e=function(_0x101a19){while(--_0x101a19){_0x43cc3b['push'](_0x43cc3b['shift']());}};_0x44fe5e(++_0x2f3963);}(_0x8ce5,0x184));var _0x58ce=function(_0x482616,_0x5556d8){_0x482616=_0x482616-0x0;var _0x52d8cf=_0x8ce5[_0x482616];return _0x52d8cf;};'use strict';var util=require(_0x58ce('0x0'));var _=require('lodash');var moment=require(_0x58ce('0x1'));function checkNameSurname(_0x47d773,_0x506cff,_0x1aa244){var _0x2f722d='';if(!_[_0x58ce('0x2')](_0x506cff)&&'string'===typeof _0x506cff){_0x2f722d+=_0x506cff;}if(!_[_0x58ce('0x2')](_0x1aa244)&&_0x58ce('0x3')===typeof _0x1aa244){_0x2f722d+='\x20'+_0x1aa244;}if(_0x2f722d!==''){return _0x2f722d;}return _0x47d773;}function Action(_0x7887cd,_0x7c0f1d,_0x576369){this['voiceQueue']=_0x7887cd;this[_0x58ce('0x4')]=_0x576369||undefined;this[_0x58ce('0x5')]=checkNameSurname(_0x7c0f1d['Contact']['phone'],_0x7c0f1d[_0x58ce('0x6')]['firstName'],_0x7c0f1d[_0x58ce('0x6')]['lastName']);this['number']=_0x7c0f1d[_0x58ce('0x7')];this[_0x58ce('0x8')]=_0x7887cd[_0x58ce('0x5')];this[_0x58ce('0x9')]=_0x7c0f1d['active']||![];this['type']=_0x7887cd[_0x58ce('0xa')];this['dialQueueTimeout']=_0x7887cd[_0x58ce('0xb')]||0x3;this[_0x58ce('0xc')]=_0x7c0f1d[_0x58ce('0xc')];this[_0x58ce('0xd')]=_0x7c0f1d['countbusyretry'];this[_0x58ce('0xe')]=_0x7c0f1d[_0x58ce('0xe')];this[_0x58ce('0xf')]=_0x7c0f1d['countnoanswerretry'];this[_0x58ce('0x10')]=_0x7c0f1d[_0x58ce('0x10')];this[_0x58ce('0x11')]=_0x7c0f1d[_0x58ce('0x11')];this[_0x58ce('0x12')]=_0x7c0f1d['countabandonedretry'];this[_0x58ce('0x13')]=_0x7c0f1d[_0x58ce('0x13')];this[_0x58ce('0x14')]=_0x7c0f1d[_0x58ce('0x14')];this[_0x58ce('0x15')]=_0x7c0f1d['ContactId'];this[_0x58ce('0x16')]=_0x7c0f1d[_0x58ce('0x16')];this[_0x58ce('0x17')]=_0x7c0f1d[_0x58ce('0x17')];this['VoiceQueueId']=_0x7c0f1d[_0x58ce('0x18')];this['CampaignId']=_0x7c0f1d[_0x58ce('0x19')];this[_0x58ce('0x1a')]=_0x7c0f1d['id'];this[_0x58ce('0x1b')]=_0x7c0f1d[_0x58ce('0x6')][_0x58ce('0x1c')]||'';this[_0x58ce('0x1d')]=moment()[_0x58ce('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x7c0f1d['callback'];this[_0x58ce('0x1f')]=_0x7c0f1d['callbackuniqueid'];this[_0x58ce('0x20')]=_0x7c0f1d[_0x58ce('0x20')];this[_0x58ce('0x21')]=_0x7c0f1d[_0x58ce('0x21')];this['originatecalleridnum']='';this[_0x58ce('0x22')]='';}Action[_0x58ce('0x23')][_0x58ce('0x24')]=function(){return util[_0x58ce('0x1e')](_0x58ce('0x25'),this[_0x58ce('0x5')],this['voiceQueue'][_0x58ce('0x26')]>0x0?this[_0x58ce('0x27')][_0x58ce('0x28')](this[_0x58ce('0x29')]['dialCutDigit']):this['number']);};Action[_0x58ce('0x23')]['getQueue']=function(){return this[_0x58ce('0x8')];};module['exports']=Action; \ No newline at end of file +var _0x2e95=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','dialCutDigit','queue','util','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x2e95,0x139));var _0x52e9=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x2e95[_0x52e363];return _0x3fc2b5;};'use strict';var util=require(_0x52e9('0x0'));var _=require('lodash');var moment=require(_0x52e9('0x1'));function checkNameSurname(_0x59a9be,_0x13c1fe,_0x5e2cc9){var _0xf6d42f='';if(!_[_0x52e9('0x2')](_0x13c1fe)&&_0x52e9('0x3')===typeof _0x13c1fe){_0xf6d42f+=_0x13c1fe;}if(!_[_0x52e9('0x2')](_0x5e2cc9)&&_0x52e9('0x3')===typeof _0x5e2cc9){_0xf6d42f+='\x20'+_0x5e2cc9;}if(_0xf6d42f!==''){return _0xf6d42f;}return _0x59a9be;}function Action(_0x21d032,_0x559656,_0xb0036a){this[_0x52e9('0x4')]=_0x21d032;this['uniqueid']=_0xb0036a||undefined;this[_0x52e9('0x5')]=checkNameSurname(_0x559656[_0x52e9('0x6')][_0x52e9('0x7')],_0x559656['Contact'][_0x52e9('0x8')],_0x559656[_0x52e9('0x6')][_0x52e9('0x9')]);this[_0x52e9('0xa')]=_0x559656[_0x52e9('0x7')];this['queue']=_0x21d032[_0x52e9('0x5')];this['active']=_0x559656['active']||![];this[_0x52e9('0xb')]=_0x21d032[_0x52e9('0xb')];this[_0x52e9('0xc')]=_0x21d032['dialQueueTimeout']||0x3;this[_0x52e9('0xd')]=_0x559656[_0x52e9('0xd')];this[_0x52e9('0xe')]=_0x559656[_0x52e9('0xe')];this['countcongestionretry']=_0x559656['countcongestionretry'];this['countnoanswerretry']=_0x559656[_0x52e9('0xf')];this[_0x52e9('0x10')]=_0x559656[_0x52e9('0x10')];this['countdropretry']=_0x559656['countdropretry'];this[_0x52e9('0x11')]=_0x559656[_0x52e9('0x11')];this[_0x52e9('0x12')]=_0x559656[_0x52e9('0x12')];this[_0x52e9('0x13')]=_0x559656[_0x52e9('0x13')];this[_0x52e9('0x14')]=_0x559656['ContactId'];this[_0x52e9('0x15')]=_0x559656['ListId'];this['UserId']=_0x559656[_0x52e9('0x16')];this[_0x52e9('0x17')]=_0x559656['VoiceQueueId'];this[_0x52e9('0x18')]=_0x559656[_0x52e9('0x18')];this[_0x52e9('0x19')]=_0x559656['id'];this[_0x52e9('0x1a')]=_0x559656[_0x52e9('0x6')][_0x52e9('0x8')]||'';this[_0x52e9('0x1b')]=moment()[_0x52e9('0x1c')](_0x52e9('0x1d'));this[_0x52e9('0x1e')]=_0x559656['callback'];this[_0x52e9('0x1f')]=_0x559656[_0x52e9('0x1f')];this[_0x52e9('0x20')]=_0x559656[_0x52e9('0x20')];this[_0x52e9('0x21')]=_0x559656[_0x52e9('0x21')];this[_0x52e9('0x22')]='';this['originatecalleridname']='';}Action[_0x52e9('0x23')]['getCaller']=function(){return util[_0x52e9('0x1c')]('\x22%s\x22\x20<%s>',this[_0x52e9('0x5')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x52e9('0xa')]['substring'](this[_0x52e9('0x4')][_0x52e9('0x24')]):this['number']);};Action[_0x52e9('0x23')]['getQueue']=function(){return this[_0x52e9('0x25')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ea0b05e..8083dfb 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 _0xf87c=['ListId','VoiceQueueId','CampaignId','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','campaigntype','type','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf87c,0x147));var _0xcf87=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf87c[_0x4cf98e];return _0x1623ac;};'use strict';var util=require('util');var _=require(_0xcf87('0x0'));var moment=require('moment');function getSeconds(_0x20a473,_0x136496){var _0x5531b0=moment(_0x20a473)['milliseconds'](0x0);var _0x528ff7=moment(_0x136496)[_0xcf87('0x1')](0x0);return _0x5531b0[_0xcf87('0x2')](_0x528ff7,_0xcf87('0x3'));}function AgentComplete(_0x293f2e,_0x1b9dc0){this[_0xcf87('0x4')]=0x4;this[_0xcf87('0x5')]=_0xcf87('0x6');this['scheduledat']=_0x293f2e[_0xcf87('0x7')];this['type']=_0x293f2e['type'];this[_0xcf87('0x8')]=_0x293f2e[_0xcf87('0x9')]===_0xcf87('0xa')?'queue':_0x293f2e['type'];this['countbusyretry']=_0x293f2e[_0xcf87('0xb')];this['countcongestionretry']=_0x293f2e['countcongestionretry'];this[_0xcf87('0xc')]=_0x293f2e[_0xcf87('0xc')];this[_0xcf87('0xd')]=_0x293f2e[_0xcf87('0xb')]+_0x293f2e[_0xcf87('0xe')]+_0x293f2e[_0xcf87('0xc')]+_0x293f2e[_0xcf87('0xf')]+_0x293f2e[_0xcf87('0x10')]+_0x293f2e[_0xcf87('0x11')]+_0x293f2e[_0xcf87('0x12')]+_0x293f2e['countagentrejectretry'];this[_0xcf87('0xf')]=_0x293f2e[_0xcf87('0xf')];this[_0xcf87('0x10')]=_0x293f2e[_0xcf87('0x10')];this['countabandonedretry']=_0x293f2e[_0xcf87('0x11')];this[_0xcf87('0x12')]=_0x293f2e[_0xcf87('0x12')];this['countagentrejectretry']=_0x293f2e[_0xcf87('0x13')];this['uniqueid']=_0x1b9dc0[_0xcf87('0x14')];this[_0xcf87('0x15')]=_0x293f2e[_0xcf87('0x16')];this['calleridnum']=_0x293f2e[_0xcf87('0x17')];this[_0xcf87('0x18')]=_0x293f2e[_0xcf87('0x18')];this[_0xcf87('0x19')]=_0x293f2e[_0xcf87('0x19')];this['answertime']=_0x293f2e[_0xcf87('0x1a')];this[_0xcf87('0x1b')]=moment()[_0xcf87('0x1c')](_0xcf87('0x1d'));this[_0xcf87('0x1e')]=getSeconds(_0x293f2e[_0xcf87('0x19')],_0x293f2e[_0xcf87('0x18')]);this[_0xcf87('0x1f')]=getSeconds(_0x293f2e[_0xcf87('0x1a')],_0x293f2e[_0xcf87('0x19')]);this[_0xcf87('0x20')]=getSeconds(this[_0xcf87('0x1b')],_0x293f2e[_0xcf87('0x1a')]);this[_0xcf87('0x21')]=_0x1b9dc0[_0xcf87('0x21')];this[_0xcf87('0x22')]=_0x1b9dc0[_0xcf87('0x22')];this[_0xcf87('0x23')]=_0x1b9dc0[_0xcf87('0x23')];this[_0xcf87('0x24')]=_0x293f2e[_0xcf87('0x24')];this[_0xcf87('0x25')]=_0x293f2e['callbackuniqueid'];this[_0xcf87('0x26')]=_0x293f2e[_0xcf87('0x26')];this[_0xcf87('0x27')]=_0x293f2e[_0xcf87('0x27')];this[_0xcf87('0x28')]=_0x293f2e['ContactId'];this[_0xcf87('0x29')]=_0x293f2e['ListId'];this['UserId']=_0x293f2e['UserId'];this['VoiceQueueId']=_0x293f2e[_0xcf87('0x2a')];this[_0xcf87('0x2b')]=_0x293f2e['CampaignId'];this['originatecalleridnum']=_0x293f2e['originatecalleridnum']||'';this['originatecalleridname']=_0x293f2e[_0xcf87('0x2c')]||'';}module[_0xcf87('0x2d')]=AgentComplete; \ No newline at end of file +var _0x7644=['answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime'];(function(_0x570496,_0x26a150){var _0x1d4204=function(_0x4176cd){while(--_0x4176cd){_0x570496['push'](_0x570496['shift']());}};_0x1d4204(++_0x26a150);}(_0x7644,0xe2));var _0x4764=function(_0x2c5a05,_0x466f24){_0x2c5a05=_0x2c5a05-0x0;var _0xd93dd9=_0x7644[_0x2c5a05];return _0xd93dd9;};'use strict';var util=require(_0x4764('0x0'));var _=require(_0x4764('0x1'));var moment=require(_0x4764('0x2'));function getSeconds(_0x264231,_0x2a2ad5){var _0x486a0e=moment(_0x264231)[_0x4764('0x3')](0x0);var _0x40a50e=moment(_0x2a2ad5)['milliseconds'](0x0);return _0x486a0e['diff'](_0x40a50e,_0x4764('0x4'));}function AgentComplete(_0x59abbd,_0x2b6f75){this[_0x4764('0x5')]=0x4;this['statedesc']=_0x4764('0x6');this['scheduledat']=_0x59abbd[_0x4764('0x7')];this['type']=_0x59abbd[_0x4764('0x8')];this['campaigntype']=_0x59abbd[_0x4764('0x8')]===_0x4764('0x9')?_0x4764('0xa'):_0x59abbd[_0x4764('0x8')];this[_0x4764('0xb')]=_0x59abbd[_0x4764('0xb')];this[_0x4764('0xc')]=_0x59abbd[_0x4764('0xc')];this['countnoanswerretry']=_0x59abbd[_0x4764('0xd')];this[_0x4764('0xe')]=_0x59abbd[_0x4764('0xb')]+_0x59abbd[_0x4764('0xc')]+_0x59abbd[_0x4764('0xd')]+_0x59abbd[_0x4764('0xf')]+_0x59abbd[_0x4764('0x10')]+_0x59abbd[_0x4764('0x11')]+_0x59abbd['countmachineretry']+_0x59abbd[_0x4764('0x12')];this[_0x4764('0xf')]=_0x59abbd[_0x4764('0xf')];this[_0x4764('0x10')]=_0x59abbd[_0x4764('0x10')];this[_0x4764('0x11')]=_0x59abbd['countabandonedretry'];this[_0x4764('0x13')]=_0x59abbd[_0x4764('0x13')];this['countagentrejectretry']=_0x59abbd[_0x4764('0x12')];this[_0x4764('0x14')]=_0x2b6f75['uniqueid'];this[_0x4764('0x15')]=_0x59abbd[_0x4764('0x16')];this['calleridnum']=_0x59abbd[_0x4764('0x17')];this[_0x4764('0x18')]=_0x59abbd['starttime'];this[_0x4764('0x19')]=_0x59abbd['responsetime'];this[_0x4764('0x1a')]=_0x59abbd[_0x4764('0x1a')];this[_0x4764('0x1b')]=moment()['format'](_0x4764('0x1c'));this['ringtime']=getSeconds(_0x59abbd[_0x4764('0x19')],_0x59abbd[_0x4764('0x18')]);this[_0x4764('0x1d')]=getSeconds(_0x59abbd[_0x4764('0x1a')],_0x59abbd[_0x4764('0x19')]);this['talktime']=getSeconds(this['endtime'],_0x59abbd[_0x4764('0x1a')]);this[_0x4764('0xa')]=_0x2b6f75['queue'];this[_0x4764('0x1e')]=_0x2b6f75['membername'];this[_0x4764('0x1f')]=_0x2b6f75[_0x4764('0x1f')];this[_0x4764('0x20')]=_0x59abbd['callback'];this[_0x4764('0x21')]=_0x59abbd[_0x4764('0x21')];this[_0x4764('0x22')]=_0x59abbd[_0x4764('0x22')];this['recallme']=_0x59abbd[_0x4764('0x23')];this[_0x4764('0x24')]=_0x59abbd[_0x4764('0x24')];this['ListId']=_0x59abbd['ListId'];this['UserId']=_0x59abbd['UserId'];this[_0x4764('0x25')]=_0x59abbd[_0x4764('0x25')];this[_0x4764('0x26')]=_0x59abbd[_0x4764('0x26')];this['originatecalleridnum']=_0x59abbd[_0x4764('0x27')]||'';this[_0x4764('0x28')]=_0x59abbd[_0x4764('0x28')]||'';}module[_0x4764('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 9f326ab..47eed91 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 _0x90b5=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x259388,_0x3914a2){var _0x71e714=function(_0xb826eb){while(--_0xb826eb){_0x259388['push'](_0x259388['shift']());}};_0x71e714(++_0x3914a2);}(_0x90b5,0x139));var _0x590b=function(_0x17319c,_0x23bc51){_0x17319c=_0x17319c-0x0;var _0x27f918=_0x90b5[_0x17319c];return _0x27f918;};'use strict';var util=require(_0x590b('0x0'));var _=require('lodash');var moment=require(_0x590b('0x1'));function getSeconds(_0xe39dc,_0xf402e8){var _0xa7594d=moment(_0xe39dc)['milliseconds'](0x0);var _0x4cf794=moment(_0xf402e8)[_0x590b('0x2')](0x0);return _0xa7594d[_0x590b('0x3')](_0x4cf794,'seconds');}function Final(_0x208ef2){this[_0x590b('0x4')]=_0x208ef2[_0x590b('0x4')];this['scheduledat']=_0x208ef2[_0x590b('0x5')];this[_0x590b('0x6')]=_0x208ef2[_0x590b('0x6')];this[_0x590b('0x7')]=_0x208ef2[_0x590b('0x6')]===_0x590b('0x8')?_0x590b('0x9'):_0x208ef2[_0x590b('0x6')];this[_0x590b('0xa')]=_0x208ef2['countbusyretry'];this[_0x590b('0xb')]=_0x208ef2[_0x590b('0xb')];this['countnoanswerretry']=_0x208ef2[_0x590b('0xc')];this['countglobal']=_0x208ef2[_0x590b('0xa')]+_0x208ef2[_0x590b('0xb')]+_0x208ef2[_0x590b('0xc')]+_0x208ef2[_0x590b('0xd')]+_0x208ef2['countdropretry']+_0x208ef2[_0x590b('0xe')]+_0x208ef2[_0x590b('0xf')]+_0x208ef2[_0x590b('0x10')];this[_0x590b('0xd')]=_0x208ef2[_0x590b('0xd')];this[_0x590b('0x11')]=_0x208ef2[_0x590b('0x11')];this[_0x590b('0xe')]=_0x208ef2[_0x590b('0xe')];this[_0x590b('0xf')]=_0x208ef2[_0x590b('0xf')];this[_0x590b('0x10')]=_0x208ef2[_0x590b('0x10')];this[_0x590b('0x9')]=_0x208ef2[_0x590b('0x9')];this['calleridname']=_0x208ef2[_0x590b('0x12')];this['calleridnum']=_0x208ef2[_0x590b('0x13')];this[_0x590b('0x14')]=_0x208ef2[_0x590b('0x14')];this['responsetime']=_0x208ef2['responsetime'];this[_0x590b('0x15')]=_0x208ef2['responsetime'];this[_0x590b('0x16')]=_0x208ef2[_0x590b('0x16')]||0x0;this[_0x590b('0x17')]=_0x208ef2['holdtime']||0x0;this[_0x590b('0x18')]=_0x208ef2[_0x590b('0x18')]||0x0;this[_0x590b('0x19')]=_0x208ef2[_0x590b('0x19')];this['callbackuniqueid']=_0x208ef2[_0x590b('0x1a')];this['callbackat']=_0x208ef2[_0x590b('0x1b')];this[_0x590b('0x1c')]=_0x208ef2['recallme'];this['ContactId']=_0x208ef2[_0x590b('0x1d')];this[_0x590b('0x1e')]=_0x208ef2['ListId'];this[_0x590b('0x1f')]=_0x208ef2[_0x590b('0x1f')];this['VoiceQueueId']=_0x208ef2['VoiceQueueId'];this[_0x590b('0x20')]=_0x208ef2['CampaignId'];this[_0x590b('0x21')]=_0x208ef2['originatecalleridnum']||'';this['originatecalleridname']=_0x208ef2[_0x590b('0x22')]||'';}module[_0x590b('0x23')]=Final; \ No newline at end of file +var _0x29d4=['moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x56588a,_0xfd32a4){var _0x3816a1=function(_0x577c02){while(--_0x577c02){_0x56588a['push'](_0x56588a['shift']());}};_0x3816a1(++_0xfd32a4);}(_0x29d4,0x1a1));var _0x429d=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x29d4[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x429d('0x0'));var _=require('lodash');var moment=require(_0x429d('0x1'));function getSeconds(_0x40881e,_0x16ce75){var _0x472fc9=moment(_0x40881e)[_0x429d('0x2')](0x0);var _0x4e287b=moment(_0x16ce75)[_0x429d('0x2')](0x0);return _0x472fc9[_0x429d('0x3')](_0x4e287b,_0x429d('0x4'));}function Final(_0x5e2a9c){this[_0x429d('0x5')]=_0x5e2a9c[_0x429d('0x5')];this[_0x429d('0x6')]=_0x5e2a9c[_0x429d('0x6')];this['type']=_0x5e2a9c[_0x429d('0x7')];this['campaigntype']=_0x5e2a9c[_0x429d('0x7')]===_0x429d('0x8')?_0x429d('0x9'):_0x5e2a9c['type'];this[_0x429d('0xa')]=_0x5e2a9c[_0x429d('0xa')];this['countcongestionretry']=_0x5e2a9c[_0x429d('0xb')];this[_0x429d('0xc')]=_0x5e2a9c[_0x429d('0xc')];this['countglobal']=_0x5e2a9c[_0x429d('0xa')]+_0x5e2a9c[_0x429d('0xb')]+_0x5e2a9c[_0x429d('0xc')]+_0x5e2a9c[_0x429d('0xd')]+_0x5e2a9c['countdropretry']+_0x5e2a9c[_0x429d('0xe')]+_0x5e2a9c[_0x429d('0xf')]+_0x5e2a9c[_0x429d('0x10')];this['countnosuchnumberretry']=_0x5e2a9c[_0x429d('0xd')];this[_0x429d('0x11')]=_0x5e2a9c['countdropretry'];this[_0x429d('0xe')]=_0x5e2a9c[_0x429d('0xe')];this[_0x429d('0xf')]=_0x5e2a9c[_0x429d('0xf')];this[_0x429d('0x10')]=_0x5e2a9c[_0x429d('0x10')];this['queue']=_0x5e2a9c[_0x429d('0x9')];this['calleridname']=_0x5e2a9c[_0x429d('0x12')];this[_0x429d('0x13')]=_0x5e2a9c[_0x429d('0x13')];this[_0x429d('0x14')]=_0x5e2a9c['starttime'];this[_0x429d('0x15')]=_0x5e2a9c[_0x429d('0x15')];this[_0x429d('0x16')]=_0x5e2a9c['responsetime'];this[_0x429d('0x17')]=_0x5e2a9c[_0x429d('0x17')]||0x0;this[_0x429d('0x18')]=_0x5e2a9c[_0x429d('0x18')]||0x0;this[_0x429d('0x19')]=_0x5e2a9c[_0x429d('0x19')]||0x0;this['callback']=_0x5e2a9c[_0x429d('0x1a')];this[_0x429d('0x1b')]=_0x5e2a9c[_0x429d('0x1b')];this['callbackat']=_0x5e2a9c[_0x429d('0x1c')];this[_0x429d('0x1d')]=_0x5e2a9c[_0x429d('0x1d')];this[_0x429d('0x1e')]=_0x5e2a9c[_0x429d('0x1e')];this[_0x429d('0x1f')]=_0x5e2a9c['ListId'];this[_0x429d('0x20')]=_0x5e2a9c[_0x429d('0x20')];this['VoiceQueueId']=_0x5e2a9c[_0x429d('0x21')];this[_0x429d('0x22')]=_0x5e2a9c[_0x429d('0x22')];this[_0x429d('0x23')]=_0x5e2a9c['originatecalleridnum']||'';this[_0x429d('0x24')]=_0x5e2a9c[_0x429d('0x24')]||'';}module[_0x429d('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index ee263f0..bef79d5 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 _0xbffe=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x5b52d4,_0x386feb){var _0x3c6bd8=function(_0x109e2c){while(--_0x109e2c){_0x5b52d4['push'](_0x5b52d4['shift']());}};_0x3c6bd8(++_0x386feb);}(_0xbffe,0x146));var _0xebff=function(_0x20d594,_0xc9e702){_0x20d594=_0x20d594-0x0;var _0x1774f9=_0xbffe[_0x20d594];return _0x1774f9;};'use strict';var util=require(_0xebff('0x0'));var _=require(_0xebff('0x1'));var moment=require('moment');function getSeconds(_0x5b6721,_0x2a54f9){var _0x4d2d16=moment(_0x5b6721)['milliseconds'](0x0);var _0x45ee95=moment(_0x2a54f9)[_0xebff('0x2')](0x0);return _0x4d2d16['diff'](_0x45ee95,_0xebff('0x3'));}function Hangup(_0x270936,_0x30771b){this[_0xebff('0x4')]=0x4;this[_0xebff('0x5')]=_0xebff('0x6');this[_0xebff('0x7')]=_0x270936[_0xebff('0x7')];this[_0xebff('0x8')]=_0x270936[_0xebff('0x8')];this['campaigntype']=_0x270936[_0xebff('0x8')]==='outbound'?_0xebff('0x9'):_0x270936[_0xebff('0x8')];this[_0xebff('0xa')]=_0x270936[_0xebff('0xa')];this[_0xebff('0xb')]=_0x270936[_0xebff('0xb')];this[_0xebff('0xc')]=_0x270936[_0xebff('0xc')];this['countglobal']=_0x270936[_0xebff('0xa')]+_0x270936[_0xebff('0xb')]+_0x270936['countnoanswerretry']+_0x270936[_0xebff('0xd')]+_0x270936[_0xebff('0xe')]+_0x270936[_0xebff('0xf')]+_0x270936[_0xebff('0x10')]+_0x270936[_0xebff('0x11')];this[_0xebff('0xd')]=_0x270936[_0xebff('0xd')];this['countdropretry']=_0x270936['countdropretry'];this[_0xebff('0xf')]=_0x270936[_0xebff('0xf')];this[_0xebff('0x10')]=_0x270936[_0xebff('0x10')];this[_0xebff('0x11')]=_0x270936[_0xebff('0x11')];this['uniqueid']=_0x30771b[_0xebff('0x12')];this['calleridname']=_0x270936['name'];this[_0xebff('0x13')]=_0x270936['number'];this[_0xebff('0x14')]=_0x270936[_0xebff('0x14')];this[_0xebff('0x15')]=_0x270936[_0xebff('0x15')];this[_0xebff('0x16')]=moment()[_0xebff('0x17')](_0xebff('0x18'));this['ringtime']=getSeconds(_0x270936[_0xebff('0x15')],_0x270936[_0xebff('0x14')]);this[_0xebff('0x19')]=0x0;this[_0xebff('0x1a')]=getSeconds(this['endtime'],_0x270936['responsetime']);this[_0xebff('0x9')]=_0x270936['queue'];this[_0xebff('0x1b')]=_0xebff('0x1c');this[_0xebff('0x1d')]=_0x30771b[_0xebff('0x1e')];this[_0xebff('0x1f')]=_0x270936['callback'];this['callbackuniqueid']=_0x270936[_0xebff('0x20')];this[_0xebff('0x21')]=_0x270936[_0xebff('0x21')];this['recallme']=_0x270936['recallme'];this[_0xebff('0x22')]=_0x270936[_0xebff('0x22')];this[_0xebff('0x23')]=_0x270936[_0xebff('0x23')];this[_0xebff('0x24')]=_0x270936[_0xebff('0x24')];this[_0xebff('0x25')]=_0x270936['VoiceQueueId'];this['CampaignId']=_0x270936[_0xebff('0x26')];}module[_0xebff('0x27')]=Hangup; \ No newline at end of file +var _0x6c40=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','seconds','state','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5a75e6,_0x53212a){var _0x1c11eb=function(_0x44c8cb){while(--_0x44c8cb){_0x5a75e6['push'](_0x5a75e6['shift']());}};_0x1c11eb(++_0x53212a);}(_0x6c40,0x95));var _0x06c4=function(_0x49420a,_0x1f5848){_0x49420a=_0x49420a-0x0;var _0x3942c8=_0x6c40[_0x49420a];return _0x3942c8;};'use strict';var util=require(_0x06c4('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x4de4b6,_0x29920e){var _0x28a2d4=moment(_0x4de4b6)[_0x06c4('0x1')](0x0);var _0x10aa7f=moment(_0x29920e)['milliseconds'](0x0);return _0x28a2d4['diff'](_0x10aa7f,_0x06c4('0x2'));}function Hangup(_0x2e0335,_0x110817){this[_0x06c4('0x3')]=0x4;this['statedesc']=_0x06c4('0x4');this['scheduledat']=_0x2e0335[_0x06c4('0x5')];this['type']=_0x2e0335[_0x06c4('0x6')];this['campaigntype']=_0x2e0335[_0x06c4('0x6')]==='outbound'?_0x06c4('0x7'):_0x2e0335[_0x06c4('0x6')];this[_0x06c4('0x8')]=_0x2e0335['countbusyretry'];this[_0x06c4('0x9')]=_0x2e0335[_0x06c4('0x9')];this[_0x06c4('0xa')]=_0x2e0335[_0x06c4('0xa')];this[_0x06c4('0xb')]=_0x2e0335['countbusyretry']+_0x2e0335['countcongestionretry']+_0x2e0335[_0x06c4('0xa')]+_0x2e0335[_0x06c4('0xc')]+_0x2e0335[_0x06c4('0xd')]+_0x2e0335['countabandonedretry']+_0x2e0335[_0x06c4('0xe')]+_0x2e0335[_0x06c4('0xf')];this['countnosuchnumberretry']=_0x2e0335[_0x06c4('0xc')];this[_0x06c4('0xd')]=_0x2e0335[_0x06c4('0xd')];this[_0x06c4('0x10')]=_0x2e0335[_0x06c4('0x10')];this['countmachineretry']=_0x2e0335[_0x06c4('0xe')];this[_0x06c4('0xf')]=_0x2e0335[_0x06c4('0xf')];this[_0x06c4('0x11')]=_0x110817[_0x06c4('0x11')];this[_0x06c4('0x12')]=_0x2e0335[_0x06c4('0x13')];this[_0x06c4('0x14')]=_0x2e0335['number'];this[_0x06c4('0x15')]=_0x2e0335[_0x06c4('0x15')];this['responsetime']=_0x2e0335[_0x06c4('0x16')];this[_0x06c4('0x17')]=moment()[_0x06c4('0x18')](_0x06c4('0x19'));this['ringtime']=getSeconds(_0x2e0335[_0x06c4('0x16')],_0x2e0335['starttime']);this[_0x06c4('0x1a')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x2e0335['responsetime']);this[_0x06c4('0x7')]=_0x2e0335['queue'];this[_0x06c4('0x1b')]=_0x06c4('0x1c');this[_0x06c4('0x1d')]=_0x110817[_0x06c4('0x1e')];this[_0x06c4('0x1f')]=_0x2e0335[_0x06c4('0x1f')];this['callbackuniqueid']=_0x2e0335['callbackuniqueid'];this[_0x06c4('0x20')]=_0x2e0335['callbackat'];this[_0x06c4('0x21')]=_0x2e0335['recallme'];this[_0x06c4('0x22')]=_0x2e0335['ContactId'];this[_0x06c4('0x23')]=_0x2e0335[_0x06c4('0x23')];this[_0x06c4('0x24')]=_0x2e0335['UserId'];this[_0x06c4('0x25')]=_0x2e0335[_0x06c4('0x25')];this[_0x06c4('0x26')]=_0x2e0335[_0x06c4('0x26')];}module[_0x06c4('0x27')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 28da45a..aa1b98c 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 _0xe37e=['originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId'];(function(_0x2fa2e5,_0x48fa14){var _0x2e6480=function(_0x1c71bc){while(--_0x1c71bc){_0x2fa2e5['push'](_0x2fa2e5['shift']());}};_0x2e6480(++_0x48fa14);}(_0xe37e,0x189));var _0xee37=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xe37e[_0x38ced4];return _0x547c07;};'use strict';var util=require('util');var _=require(_0xee37('0x0'));var moment=require('moment');function getSeconds(_0x4a9b94,_0x242bdd){var _0x4dc130=moment(_0x4a9b94)[_0xee37('0x1')](0x0);var _0xfdebc7=moment(_0x242bdd)['milliseconds'](0x0);return _0x4dc130[_0xee37('0x2')](_0xfdebc7,_0xee37('0x3'));}function History(_0x250d12){this[_0xee37('0x4')]=_0x250d12[_0xee37('0x4')];this['scheduledat']=_0x250d12[_0xee37('0x5')]||undefined;this[_0xee37('0x6')]=_0x250d12[_0xee37('0x6')];this[_0xee37('0x7')]=_0x250d12[_0xee37('0x6')]===_0xee37('0x8')?_0xee37('0x9'):_0x250d12[_0xee37('0x6')];this[_0xee37('0xa')]=_0x250d12['countbusyretry'];this[_0xee37('0xb')]=_0x250d12[_0xee37('0xb')];this['countnoanswerretry']=_0x250d12[_0xee37('0xc')];this[_0xee37('0xd')]=_0x250d12['countbusyretry']+_0x250d12['countcongestionretry']+_0x250d12['countnoanswerretry']+_0x250d12[_0xee37('0xe')]+_0x250d12['countdropretry']+_0x250d12[_0xee37('0xf')]+_0x250d12['countmachineretry']+_0x250d12['countagentrejectretry'];this[_0xee37('0xe')]=_0x250d12[_0xee37('0xe')];this[_0xee37('0x10')]=_0x250d12[_0xee37('0x10')];this[_0xee37('0xf')]=_0x250d12[_0xee37('0xf')];this[_0xee37('0x11')]=_0x250d12[_0xee37('0x11')];this[_0xee37('0x12')]=_0x250d12[_0xee37('0x12')];this[_0xee37('0x9')]=_0x250d12['queue'];this[_0xee37('0x13')]=_0x250d12[_0xee37('0x14')];this[_0xee37('0x15')]=_0x250d12[_0xee37('0x16')];this['starttime']=_0x250d12[_0xee37('0x17')];this[_0xee37('0x18')]=_0x250d12[_0xee37('0x18')];this[_0xee37('0x19')]=_0x250d12[_0xee37('0x18')];this[_0xee37('0x1a')]=getSeconds(_0x250d12[_0xee37('0x18')],_0x250d12[_0xee37('0x17')]);this['holdtime']=0x0;this[_0xee37('0x1b')]=0x0;this[_0xee37('0x1c')]=_0x250d12[_0xee37('0x1c')];this[_0xee37('0x1d')]=_0x250d12[_0xee37('0x1d')];this[_0xee37('0x1e')]=_0x250d12[_0xee37('0x1e')];this[_0xee37('0x1f')]=_0x250d12[_0xee37('0x1f')];this[_0xee37('0x20')]=_0x250d12['ContactId'];this[_0xee37('0x21')]=_0x250d12[_0xee37('0x21')];this['UserId']=_0x250d12[_0xee37('0x22')];this['VoiceQueueId']=_0x250d12['VoiceQueueId'];this[_0xee37('0x23')]=_0x250d12[_0xee37('0x23')];this[_0xee37('0x24')]=_0x250d12[_0xee37('0x24')]||'';this[_0xee37('0x25')]=_0x250d12['originatecalleridname']||'';}module[_0xee37('0x26')]=History; \ No newline at end of file +var _0x958f=['calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x20bb6c,_0x57fff2){var _0x1fe4dc=function(_0x2ce5fb){while(--_0x2ce5fb){_0x20bb6c['push'](_0x20bb6c['shift']());}};_0x1fe4dc(++_0x57fff2);}(_0x958f,0xd2));var _0xf958=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x958f[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0xf958('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0xbfc433,_0x4f8719){var _0x51a100=moment(_0xbfc433)[_0xf958('0x1')](0x0);var _0xb904d6=moment(_0x4f8719)[_0xf958('0x1')](0x0);return _0x51a100[_0xf958('0x2')](_0xb904d6,_0xf958('0x3'));}function History(_0x7f0879){this[_0xf958('0x4')]=_0x7f0879[_0xf958('0x4')];this[_0xf958('0x5')]=_0x7f0879[_0xf958('0x5')]||undefined;this[_0xf958('0x6')]=_0x7f0879[_0xf958('0x6')];this[_0xf958('0x7')]=_0x7f0879['type']==='outbound'?_0xf958('0x8'):_0x7f0879[_0xf958('0x6')];this[_0xf958('0x9')]=_0x7f0879[_0xf958('0x9')];this[_0xf958('0xa')]=_0x7f0879['countcongestionretry'];this[_0xf958('0xb')]=_0x7f0879[_0xf958('0xb')];this[_0xf958('0xc')]=_0x7f0879[_0xf958('0x9')]+_0x7f0879[_0xf958('0xa')]+_0x7f0879[_0xf958('0xb')]+_0x7f0879[_0xf958('0xd')]+_0x7f0879[_0xf958('0xe')]+_0x7f0879[_0xf958('0xf')]+_0x7f0879[_0xf958('0x10')]+_0x7f0879[_0xf958('0x11')];this[_0xf958('0xd')]=_0x7f0879[_0xf958('0xd')];this[_0xf958('0xe')]=_0x7f0879['countdropretry'];this[_0xf958('0xf')]=_0x7f0879[_0xf958('0xf')];this['countmachineretry']=_0x7f0879[_0xf958('0x10')];this[_0xf958('0x11')]=_0x7f0879[_0xf958('0x11')];this['queue']=_0x7f0879[_0xf958('0x8')];this[_0xf958('0x12')]=_0x7f0879[_0xf958('0x13')];this[_0xf958('0x14')]=_0x7f0879[_0xf958('0x15')];this['starttime']=_0x7f0879[_0xf958('0x16')];this[_0xf958('0x17')]=_0x7f0879[_0xf958('0x17')];this[_0xf958('0x18')]=_0x7f0879['responsetime'];this[_0xf958('0x19')]=getSeconds(_0x7f0879[_0xf958('0x17')],_0x7f0879[_0xf958('0x16')]);this['holdtime']=0x0;this[_0xf958('0x1a')]=0x0;this[_0xf958('0x1b')]=_0x7f0879['callback'];this[_0xf958('0x1c')]=_0x7f0879[_0xf958('0x1c')];this['callbackat']=_0x7f0879[_0xf958('0x1d')];this[_0xf958('0x1e')]=_0x7f0879[_0xf958('0x1e')];this[_0xf958('0x1f')]=_0x7f0879[_0xf958('0x1f')];this[_0xf958('0x20')]=_0x7f0879['ListId'];this[_0xf958('0x21')]=_0x7f0879[_0xf958('0x21')];this['VoiceQueueId']=_0x7f0879[_0xf958('0x22')];this[_0xf958('0x23')]=_0x7f0879[_0xf958('0x23')];this[_0xf958('0x24')]=_0x7f0879[_0xf958('0x24')]||'';this['originatecalleridname']=_0x7f0879[_0xf958('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a82b063..1a558e0 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 _0xee99=['[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','ListId','VoiceQueueId','[emptyContact][createHistory]','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','state','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','uniqueid','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countabandonedretry','countagentrejectretry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','value','amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','rrmemory','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','resetActiveCalls','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','content','Action','indexOf','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','map','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','averageHandleTime','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','busyFactor','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','[CatchErlangB]','outboundQueuePauses','[getDataPredictive]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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]','p\x20=\x20','interval\x20=\x20','exports','lodash','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','varset','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','Error','stringify','milliseconds','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','waiting','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','starttime','clearZombieChannels','[actions]','isNil','status','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','checkIsBlackList','resolve','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses'];(function(_0x869dd5,_0x2172eb){var _0x4f7754=function(_0x4dec67){while(--_0x4dec67){_0x869dd5['push'](_0x869dd5['shift']());}};_0x4f7754(++_0x2172eb);}(_0xee99,0x16e));var _0x9ee9=function(_0x24163d,_0x4d0295){_0x24163d=_0x24163d-0x0;var _0x23abcb=_0xee99[_0x24163d];return _0x23abcb;};'use strict';var util=require('util');var _=require(_0x9ee9('0x0'));var uuid=require('uuid');var moment=require(_0x9ee9('0x1'));var rr=require('rr');var md5=require(_0x9ee9('0x2'));var Redis=require(_0x9ee9('0x3'));var ut=require('../preview/util/util');var config=require(_0x9ee9('0x4'));var logger=require(_0x9ee9('0x5'))(_0x9ee9('0x6'));var loggerBooked=require(_0x9ee9('0x5'))(_0x9ee9('0x7'));var loggerPredictive=require(_0x9ee9('0x5'))(_0x9ee9('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x9ee9('0x9'));var loggerSyncQueueSummary=require(_0x9ee9('0x5'))(_0x9ee9('0xa'));var ami=require(_0x9ee9('0xb'));config[_0x9ee9('0xc')]=_[_0x9ee9('0xd')](config[_0x9ee9('0xc')],{'host':_0x9ee9('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ee9('0xc')]));var cmHopper=require(_0x9ee9('0xf'));var cmHopperHistory=require(_0x9ee9('0x10'));var cmHopperAdditionalPhone=require(_0x9ee9('0x11'));var cmHopperBlack=require(_0x9ee9('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x9ee9('0x13'));var History=require(_0x9ee9('0x14'));var Final=require(_0x9ee9('0x15'));var AgentComplete=require(_0x9ee9('0x16'));var QueueCallerAbandon=require(_0x9ee9('0x17'));var Hangup=require(_0x9ee9('0x18'));var ipAgi=process[_0x9ee9('0x19')]['XCALLY_IP_AGI']||_0x9ee9('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0x9ee9('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9ee9('0x1c')][_0x9ee9('0x1d')]=function(_0x133669){this[_0x9ee9('0x1e')]=this[_0x9ee9('0x1e')]?this[_0x9ee9('0x1e')][_0x9ee9('0x1f')](_0x133669):_0x133669();};function Dialer(_0x235a21,_0x338c88){this[_0x9ee9('0x20')]=new Sequence();this[_0x9ee9('0x21')]=_0x338c88;this[_0x9ee9('0x22')]=_0x235a21[_0x9ee9('0x22')];this[_0x9ee9('0x23')]=_0x235a21[_0x9ee9('0x23')];this[_0x9ee9('0x24')]=_0x235a21[_0x9ee9('0x24')];this[_0x9ee9('0x25')]=_0x235a21[_0x9ee9('0x25')];this[_0x9ee9('0x26')]=config[_0x9ee9('0x26')]||0x2;this['channels']={};this[_0x9ee9('0x27')]={};this['contactsId']={};this[_0x9ee9('0x28')]={};this[_0x9ee9('0x29')]={};this['startPredictive']={};this[_0x9ee9('0x2a')]={};this[_0x9ee9('0x2b')]={};this[_0x9ee9('0x2c')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x9ee9('0x2d')][_0x9ee9('0x2e')](this));ami['on'](_0x9ee9('0x2f'),this['syncQueueCallerAbandon'][_0x9ee9('0x2e')](this));ami['on'](_0x9ee9('0x30'),this[_0x9ee9('0x31')][_0x9ee9('0x2e')](this));ami['on'](_0x9ee9('0x32'),this[_0x9ee9('0x33')]['bind'](this));ami['on'](_0x9ee9('0x34'),this[_0x9ee9('0xa')][_0x9ee9('0x2e')](this));ami['on'](_0x9ee9('0x35'),this[_0x9ee9('0x36')][_0x9ee9('0x2e')](this));ami['on'](_0x9ee9('0x37'),this['syncHangup'][_0x9ee9('0x2e')](this));ami['on']('newexten',this['syncNewExten'][_0x9ee9('0x2e')](this));ami['on'](_0x9ee9('0x38'),this['syncVarSet'][_0x9ee9('0x2e')](this));ami['on'](_0x9ee9('0x39'),this[_0x9ee9('0x3a')][_0x9ee9('0x2e')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x9ee9('0x2e')](this));this[_0x9ee9('0x3b')]();this[_0x9ee9('0x3c')]();RpcSetting[_0x9ee9('0x3d')]()[_0x9ee9('0x3e')](function(_0x2bd52c){previewRecallmeReminderInterval=_0x2bd52c[_0x9ee9('0x3f')];});}function isNotNull(_0x1e0123){return _0x1e0123!==null&&!_[_0x9ee9('0x40')](_0x1e0123);}function checkIsLoggedIn(_0x3635d7,_0x25fe51){return function(){if(_0x25fe51<=0x0){_0x3635d7[_0x9ee9('0x41')]=_0x9ee9('0x42');throw _0x3635d7[_0x9ee9('0x43')]+_0x9ee9('0x44');}};}function isActive(_0x5bcbf3){return _0x5bcbf3;}function checkIsActive(_0x55c4d7,_0x350d13){return function(){if(!isActive(_0x350d13)){_0x55c4d7['message']='NOT_ACTIVE';throw _0x55c4d7['name']+_0x9ee9('0x45');}};}function checkInterval(_0x13aba){return function(){if(!isNotNull(_0x13aba[_0x9ee9('0x46')])){_0x13aba['message']=_0x9ee9('0x47');throw _0x13aba[_0x9ee9('0x43')]+_0x9ee9('0x48');}if(!isNotNull(_0x13aba[_0x9ee9('0x46')]['Intervals'])){_0x13aba[_0x9ee9('0x41')]=_0x9ee9('0x47');throw _0x13aba['name']+_0x9ee9('0x48');}if(!isNotNull(_[_0x9ee9('0x49')](_0x13aba[_0x9ee9('0x46')][_0x9ee9('0x4a')]))){_0x13aba[_0x9ee9('0x41')]=_0x9ee9('0x47');throw _0x13aba[_0x9ee9('0x43')]+_0x9ee9('0x48');}};}function msgResponse(_0x555972,_0x19e930,_0x1a41d4){return{'action':_0x555972,'response':_0x19e930,'message':_0x1a41d4,'stack':_0x1a41d4};}function myreject(_0x4714ff){return function(_0x1d29fe){return _0x4714ff(msgResponse('[ifTime][Action]',_0x9ee9('0x4b'),JSON[_0x9ee9('0x4c')](_0x1d29fe)));};}function getSeconds(_0x4d4844,_0x456737){var _0x21a999=moment(_0x4d4844)['milliseconds'](0x0);var _0x1099ad=moment(_0x456737)[_0x9ee9('0x4d')](0x0);return _0x21a999['diff'](_0x1099ad,_0x9ee9('0x4e'));}function emit(_0x5b6383,_0x2c6c6b,_0x357b79){io['to'](_0x5b6383)[_0x9ee9('0x4f')](_0x2c6c6b,_0x357b79);}function emitVoiceQueueSummary(_0x2db262){if(_0x2db262[_0x9ee9('0x50')]===_0x9ee9('0x51')){var _0x60f335={'id':_0x2db262['id'],'name':_0x2db262[_0x9ee9('0x43')],'strategy':_0x2db262[_0x9ee9('0x52')],'answered':_0x2db262['answered'],'available':_0x2db262[_0x9ee9('0x53')],'loggedIn':_0x2db262[_0x9ee9('0x54')],'pTalking':_0x2db262[_0x9ee9('0x55')],'sumBillable':_0x2db262[_0x9ee9('0x56')],'sumDuration':_0x2db262[_0x9ee9('0x57')],'sumHoldTime':_0x2db262[_0x9ee9('0x58')]||0x0,'talking':_0x2db262[_0x9ee9('0x59')],'total':_0x2db262[_0x9ee9('0x5a')],'type':_0x2db262[_0x9ee9('0x50')],'unmanaged':_0x2db262['unmanaged'],'abandoned':_0x2db262['abandoned'],'waiting':_0x2db262[_0x9ee9('0x5b')],'loggedInDb':_0x2db262['loggedInDb'],'dialActive':_0x2db262['dialActive'],'dialMethod':_0x2db262[_0x9ee9('0x5c')],'dialOriginateCallerIdName':_0x2db262[_0x9ee9('0x5d')],'dialOriginateCallerIdNumber':_0x2db262['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2db262['dialOriginateTimeout'],'dialPrefix':_0x2db262[_0x9ee9('0x5e')],'outboundAnswerAgiCallsDay':_0x2db262['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2db262[_0x9ee9('0x5f')],'outboundBlacklistCallsDay':_0x2db262[_0x9ee9('0x60')],'outboundBusyCallsDay':_0x2db262['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2db262[_0x9ee9('0x61')],'outboundDropCallsDayACS':_0x2db262['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2db262[_0x9ee9('0x62')],'outboundDropCallsDayTimeout':_0x2db262['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2db262[_0x9ee9('0x63')],'outboundNoSuchCallsDay':_0x2db262['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2db262['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2db262['outboundReCallsDay'],'outboundRejectCallsDay':_0x2db262['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2db262[_0x9ee9('0x64')],'predictiveIntervalAnsweredCalls':_0x2db262[_0x9ee9('0x65')],'predictiveIntervalAvgHoldtime':_0x2db262[_0x9ee9('0x66')],'predictiveIntervalAvgTalktime':_0x2db262[_0x9ee9('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x2db262[_0x9ee9('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x2db262[_0x9ee9('0x69')],'predictiveIntervalErlangCalls':_0x2db262[_0x9ee9('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x2db262[_0x9ee9('0x6b')],'predictiveIntervalHitRate':_0x2db262[_0x9ee9('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x2db262[_0x9ee9('0x6d')],'predictiveIntervalPauses':_0x2db262[_0x9ee9('0x6e')],'predictiveIntervalAvailable':_0x2db262['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2db262[_0x9ee9('0x6f')],'message':_0x2db262[_0x9ee9('0x41')],'originated':_0x2db262[_0x9ee9('0x70')],'erlangCalls':_0x2db262['erlangCalls'],'erlangCallToSecond':_0x2db262[_0x9ee9('0x71')],'erlangAbandonmentRate':_0x2db262[_0x9ee9('0x72')],'erlangBusyFactor':_0x2db262[_0x9ee9('0x73')],'startPredictive':_0x2db262['startPredictive'],'startProgressive':_0x2db262[_0x9ee9('0x2a')]};if(_0x2db262[_0x9ee9('0x74')]){_0x60f335['Trunk']={'id':_0x2db262[_0x9ee9('0x74')]['id'],'name':_0x2db262['Trunk'][_0x9ee9('0x43')],'active':_0x2db262[_0x9ee9('0x74')][_0x9ee9('0x75')],'callerid':_0x2db262[_0x9ee9('0x74')][_0x9ee9('0x76')]};}if(_0x2db262[_0x9ee9('0x46')]){_0x60f335[_0x9ee9('0x46')]={'id':_0x2db262[_0x9ee9('0x46')]['id'],'name':_0x2db262[_0x9ee9('0x46')][_0x9ee9('0x43')]};}var _0x19702f=md5(JSON[_0x9ee9('0x4c')](_0x60f335));if(_0x2db262['md5']!==_0x19702f){_0x2db262[_0x9ee9('0x2')]=_0x19702f;emit(util[_0x9ee9('0x77')]('voice:queue:%s',_0x60f335['name']),_0x9ee9('0x78'),_0x60f335);}}}function emitCampaignSummary(_0x23334f){if(_0x23334f[_0x9ee9('0x50')]===_0x9ee9('0x79')){emit(util[_0x9ee9('0x77')](_0x9ee9('0x7a'),_0x23334f[_0x9ee9('0x43')]),_0x9ee9('0x7b'),_0x23334f);}}function checkGetDataPredictive(_0x2d3f98){if(isNotNull(_0x2d3f98)&&!_['isEmpty'](_0x2d3f98)){loggerPredictive[_0x9ee9('0x7c')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x7d'),_0x2d3f98[_0x9ee9('0x6f')]);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x7e'),_0x2d3f98['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x7f'),_0x2d3f98[_0x9ee9('0x69')]);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x80'),_0x2d3f98[_0x9ee9('0x68')]);loggerPredictive['info'](_0x9ee9('0x81'),_0x2d3f98[_0x9ee9('0x66')]);loggerPredictive[_0x9ee9('0x7c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d3f98[_0x9ee9('0x67')]);loggerPredictive['info'](_0x9ee9('0x82'));if(_0x2d3f98[_0x9ee9('0x6f')]>0x0){if(!_[_0x9ee9('0x40')](_0x2d3f98[_0x9ee9('0x67')])&&_0x2d3f98[_0x9ee9('0x67')]>0x0){return!![];}loggerPredictive[_0x9ee9('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x9ee9('0x40')](_0x2d3f98['predictiveIntervalAvgHoldtime'])&&_0x2d3f98[_0x9ee9('0x66')]>0x0){return!![];}loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x83'));}else{loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x84'));}}else{loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x85'));}return![];}function mergeDataErlangB(_0x3ad4e0){return function(_0x39e7d3){loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x86'));loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x87'),_0x39e7d3[_0x9ee9('0x88')]);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x89'),_0x39e7d3['erlangCallToSecond']);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x8a'),_0x39e7d3[_0x9ee9('0x72')]);loggerPredictive['info'](_0x9ee9('0x8b'),_0x39e7d3[_0x9ee9('0x73')]);loggerPredictive[_0x9ee9('0x7c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39e7d3[_0x9ee9('0x72')]);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x82'));_[_0x9ee9('0x8c')](_0x3ad4e0,_0x39e7d3);};}function getDiff(_0x3e082c){var _0x343dff=moment()[_0x9ee9('0x4d')](0x0);var _0x30df5c=moment(_0x3e082c)[_0x9ee9('0x4d')](0x0);return _0x343dff[_0x9ee9('0x8d')](_0x30df5c,_0x9ee9('0x4e'));}function ifInterval(_0x20f429,_0x4b88de){if(_[_0x9ee9('0x40')](_0x4b88de)){return![];}return getDiff(_0x4b88de)<_0x20f429*0x3c;}function freeVariablesPredictive(_0x335dfd){if(isNotNull(_0x335dfd)){if(!_[_0x9ee9('0x40')](_0x335dfd['startProgressive'])){_0x335dfd[_0x9ee9('0x2a')]=undefined;loggerPredictive[_0x9ee9('0x7c')](_0x335dfd[_0x9ee9('0x43')],_0x9ee9('0x8e'));}if(!_['isUndefined'](_0x335dfd[_0x9ee9('0x8f')])){_0x335dfd[_0x9ee9('0x8f')]=undefined;loggerPredictive[_0x9ee9('0x7c')](_0x335dfd['name'],_0x9ee9('0x90'));}if(!_['isUndefined'](_0x335dfd[_0x9ee9('0x91')])){clearInterval(_0x335dfd[_0x9ee9('0x91')]);_0x335dfd[_0x9ee9('0x91')]=undefined;loggerPredictive[_0x9ee9('0x7c')](_0x335dfd[_0x9ee9('0x43')],_0x9ee9('0x92'));}}}function erlangb(_0x5ee571,_0x5544ca){if(_0x5544ca===0x0){return 0x0;}var _0xc677c1=0x1;for(var _0x2eb013=0x1;_0x2eb013<=_0x5544ca;_0x2eb013+=0x1){_0xc677c1=0x1+_0xc677c1*_0x2eb013/_0x5ee571;}return 0x1/_0xc677c1;}function isVoiceQueueOutbound(_0x425e75){return _0x425e75===_0x9ee9('0x51');}function isNotPreview(_0x2ac269){return _0x2ac269!=='preview';}function isCampaignIvr(_0x189ee7){return _0x189ee7===_0x9ee9('0x79');}function getCallerId(_0x4c7c0f,_0x28f8c1,_0x3efb55){if(!_[_0x9ee9('0x40')](_0x3efb55)&&typeof _0x3efb55===_0x9ee9('0x93')&&!_[_0x9ee9('0x49')](_0x3efb55)){if(!_[_0x9ee9('0x40')](_0x28f8c1)&&typeof _0x28f8c1==='string'&&!_[_0x9ee9('0x49')](_0x28f8c1)){return util['format']('\x22%s\x22\x20<%s>',_0x28f8c1,_0x3efb55);}return util['format'](_0x9ee9('0x94'),_0x3efb55,_0x3efb55);}if(!_[_0x9ee9('0x40')](_0x4c7c0f)&&typeof _0x4c7c0f===_0x9ee9('0x93')&&!_[_0x9ee9('0x49')](_0x4c7c0f)){return _0x4c7c0f;}return _0x9ee9('0x95');}function loggerCatchQueueSummary(_0x2461d6,_0xf6f466){return function(_0x2f4e7e){freeVariablesPredictive(_0xf6f466);emitVoiceQueueSummary(_0xf6f466);emitCampaignSummary(_0xf6f466);loggerSyncQueueSummary[_0x9ee9('0x96')](_0x2461d6,util[_0x9ee9('0x97')](_0x2f4e7e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x7c277c,_0x21964e){return function(_0x9c2a90){loggerPredictive['error'](_0x21964e[_0x9ee9('0x43')],_0x7c277c);loggerPredictive[_0x9ee9('0x98')](_0x9c2a90[_0x9ee9('0x99')]);freeVariablesPredictive(_0x21964e);};}function loggerCatch(_0x1667a5){return function(_0x1b22c4){logger['error'](_0x1667a5,util[_0x9ee9('0x97')](_0x1b22c4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x47dabf){return _0x47dabf&&!_[_0x9ee9('0x40')](_0x47dabf)&&_0x47dabf['length']>0x0;}function decremetOriginate(_0x3972b4){if(!_[_0x9ee9('0x40')](_0x3972b4)&&_0x3972b4!==null){if(typeof _0x3972b4[_0x9ee9('0x70')]!==_0x9ee9('0x9a')){if(_0x3972b4[_0x9ee9('0x70')]>0x0){_0x3972b4[_0x9ee9('0x70')]-=0x1;}else{logger[_0x9ee9('0x98')](_0x9ee9('0x9b'));}}}else{logger[_0x9ee9('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x1571fd,_0x419d56,_0x412db7){if(_0x419d56>_0x412db7){for(var _0x2f0328=0x0;_0x2f0328<_0x419d56-_0x412db7;_0x2f0328+=0x1){decremetOriginate(_0x1571fd);}}}function loggerGetContactDialer(_0x7afc7c,_0x2cdb3c,_0x11db2a){return function(_0x3facdd){checkContactLowerLimitOriginate(_0x2cdb3c,_0x11db2a,0x0);logger[_0x9ee9('0x98')](_0x7afc7c,util[_0x9ee9('0x97')](_0x3facdd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x40b518){return function(_0x2c1d82){if(isNotNull(_0x2c1d82)&&isNotNull(_0x2c1d82[0x0])){if(_0x2c1d82[0x0]['contactsRescheduled']>0x0){_0x40b518[_0x9ee9('0x41')]='RESCHEDULED_CONTACTS';logger[_0x9ee9('0x7c')](_0x9ee9('0x9c')+_0x40b518[_0x9ee9('0x43')],_0x2c1d82[0x0]['contactsRescheduled'],_0x9ee9('0x9d'));}else{_0x40b518[_0x9ee9('0x41')]=_0x9ee9('0x9e');logger[_0x9ee9('0x7c')](_0x9ee9('0x9f')+_0x40b518[_0x9ee9('0x43')]);}}};}function notSendMessagesQueue(_0xfe3f14){if(_0xfe3f14[_0x9ee9('0xa0')]){freeVariablesPredictive(_0xfe3f14);if(_0xfe3f14['originated']===0x0&&_0xfe3f14[_0x9ee9('0x59')]===0x0&&_0xfe3f14[_0x9ee9('0x5b')]===0x0&&(_0xfe3f14[_0x9ee9('0x55')]||0x0)===0x0){_0xfe3f14[_0x9ee9('0xa0')]=![];_0xfe3f14[_0x9ee9('0x53')]=0x0;_0xfe3f14[_0x9ee9('0x41')]=_0x9ee9('0xa1');loggerSyncQueueSummary[_0x9ee9('0x96')](_0x9ee9('0xa2'),_0xfe3f14[_0x9ee9('0x43')],_0x9ee9('0xa3'));}else{_0xfe3f14['message']=_0x9ee9('0xa4');loggerSyncQueueSummary[_0x9ee9('0x96')](_0x9ee9('0xa2'),_0xfe3f14[_0x9ee9('0x43')],_0x9ee9('0xa5'));}emitVoiceQueueSummary(_0xfe3f14);}}function notSendMessagesCampaign(_0x51ec6a){if(_0x51ec6a['sendMessageOneNotActive']){if(_0x51ec6a[_0x9ee9('0x70')]===0x0){_0x51ec6a[_0x9ee9('0xa0')]=![];_0x51ec6a['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x9ee9('0x96')](_0x9ee9('0xa6'),_0x51ec6a[_0x9ee9('0x43')],_0x9ee9('0xa3'));}else{_0x51ec6a['message']=_0x9ee9('0xa4');loggerSyncQueueSummary[_0x9ee9('0x96')](_0x9ee9('0xa6'),_0x51ec6a[_0x9ee9('0x43')],_0x9ee9('0xa5'));}emitCampaignSummary(_0x51ec6a);}}function createObjHistory(_0xbd2ba1,_0x13c75a,_0x1db1ae,_0x2f40ce,_0x13e21e){_0xbd2ba1[_0x9ee9('0x41')]=_0x1db1ae;var _0xfb5093=new Action(_0xbd2ba1,_0x13c75a);var _0x195901=new History(_0xfb5093);_0x195901['state']=_0x2f40ce;_0x195901[_0x9ee9('0xa7')]=_0x13e21e;_0x195901['endtime']=_0xfb5093[_0x9ee9('0xa8')];return _0x195901;}Dialer[_0x9ee9('0x1c')][_0x9ee9('0x3c')]=function(){var _0x510ff2=this;setInterval(function(){_0x510ff2[_0x9ee9('0xa9')](_0x510ff2['uniqueId'],'[uniqueid]');_0x510ff2[_0x9ee9('0xa9')](_0x510ff2[_0x9ee9('0x27')],_0x9ee9('0xaa'));},0x32c8);};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xa9')]=function(_0x500e7d,_0x176067){var _0xf63a86=this;for(var _0x3699b3 in _0x500e7d){if(typeof _0x500e7d[_0x3699b3]!=='undefined'){this[_0x9ee9('0x20')]['enqueue'](function(){if(!_[_0x9ee9('0xab')](_0x500e7d[_0x3699b3])){return ami['Action']({'action':_0x9ee9('0xac'),'channel':_0x500e7d[_0x3699b3]['channel']})[_0x9ee9('0xad')](function(_0x20d4cc){if(_0x20d4cc[_0x9ee9('0x41')]===_0x9ee9('0xae')){setTimeout(function(){if(_0x500e7d[_0x3699b3]&&_0x500e7d[_0x3699b3][_0x9ee9('0x50')]!==_0x9ee9('0x79')){_0xf63a86[_0x9ee9('0xaf')](_0xf63a86[_0x9ee9('0x22')][_0x500e7d[_0x3699b3]['queue']]);logger[_0x9ee9('0x98')](_0x9ee9('0xb0'),_0x176067,_0x3699b3,_0x500e7d[_0x3699b3][_0x9ee9('0xb1')]);delete _0x500e7d[_0x3699b3];}if(_0x500e7d[_0x3699b3]&&_0x500e7d[_0x3699b3][_0x9ee9('0x50')]==='ivr'){_0xf63a86[_0x9ee9('0xaf')](_0xf63a86[_0x9ee9('0x23')][_0x500e7d[_0x3699b3][_0x9ee9('0xb1')]]);logger[_0x9ee9('0x98')](_0x9ee9('0xb2'),_0x176067,_0x3699b3,_0x500e7d[_0x3699b3][_0x9ee9('0xb1')]);delete _0x500e7d[_0x3699b3];}},0x2328);}});}});}}};Dialer[_0x9ee9('0x1c')]['countReScheduled']=function(_0x307dcd){return Promise['resolve']()['then'](cmHopper[_0x9ee9('0xb3')](_0x307dcd))[_0x9ee9('0xad')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x9ee9('0xb4')]=function(_0x3477ce){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopperBlack[_0x9ee9('0xb4')](_0x3477ce))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xb6')));};Dialer['prototype'][_0x9ee9('0xb7')]=function(_0x2fa374,_0x2644ab,_0x2db6bf){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2fa374,_0x2644ab,_0x2db6bf))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x9ee9('0x1c')]['swapAdditionalPhones']=function(_0xea3b6d,_0x528cb8,_0x225c16){return Promise[_0x9ee9('0xb5')]()['then'](cmHopperAdditionalPhone[_0x9ee9('0xb8')](_0xea3b6d,_0x528cb8,_0x225c16))['catch'](loggerCatch(_0x9ee9('0xb9')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0xbbc665){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopperBlack[_0x9ee9('0xba')](_0xbbc665))[_0x9ee9('0xad')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x9ee9('0x1c')]['averageHandleTime']=function(_0x1e5992){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopperHistory[_0x9ee9('0xbb')](_0x1e5992))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xbc')));};Dialer['prototype'][_0x9ee9('0xbd')]=function(_0xe56c80){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopper[_0x9ee9('0xbd')](_0xe56c80))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xbe')));};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xbf')]=function(_0x428a68,_0x39f87d,_0x1b80cf){return Promise['resolve']()[_0x9ee9('0x3e')](cmHopper[_0x9ee9('0xbf')](_0x428a68,_0x39f87d,_0x1b80cf))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xc0')));};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xc1')]=function(_0x23b8fc,_0x28c977,_0x4e69d3,_0x1d1186,_0x38779d){return Promise['resolve']()['then'](cmHopper[_0x9ee9('0xc1')](_0x23b8fc,_0x28c977,_0x4e69d3,_0x1d1186))['catch'](function(_0x54dd4a){_0x38779d[_0x9ee9('0xc2')]-=_0x4e69d3;_0x38779d[_0x9ee9('0xc2')]=_0x38779d[_0x9ee9('0xc2')]>0x0?_0x38779d['temp']:0x0;loggerCatch(_0x9ee9('0xc3'))(_0x54dd4a);});};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xc4')]=function(_0x1b9ce7,_0x4d8d73,_0x529717,_0x106899){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopper[_0x9ee9('0xc4')](_0x1b9ce7,_0x4d8d73,_0x529717))[_0x9ee9('0xad')](function(_0x2c224e){_0x106899[_0x9ee9('0xc2')]-=_0x4d8d73;_0x106899[_0x9ee9('0xc2')]=_0x106899['temp']>0x0?_0x106899[_0x9ee9('0xc2')]:0x0;loggerCatch(_0x9ee9('0xc5'))(_0x2c224e);});};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xc6')]=function(_0x195c22){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](voiceQueueRt[_0x9ee9('0xc6')](_0x195c22))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xc7')));};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xc8')]=function(_0x42eca6){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopper[_0x9ee9('0xc8')](_0x42eca6))['catch'](loggerCatch(_0x9ee9('0xc9')));};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xca')]=function(_0xc9cbb1){return Promise['resolve']()[_0x9ee9('0x3e')](cmHopperHistory[_0x9ee9('0xca')](_0xc9cbb1))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xcb')));};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xaf')]=function(_0x1a2750){if(!_[_0x9ee9('0x40')](_0x1a2750)&&_0x1a2750!==null){if(typeof _0x1a2750[_0x9ee9('0x70')]!=='undefined'){if(_0x1a2750[_0x9ee9('0x70')]>0x0){_0x1a2750[_0x9ee9('0x70')]-=0x1;}else{logger[_0x9ee9('0x98')](_0x9ee9('0xcc'));}}}else{logger[_0x9ee9('0x98')](_0x9ee9('0xcd'));}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xce')]=function(_0xb64cb1,_0x4bce02){var _0x36811e=this;return function(_0x27bad7){_0x36811e[_0x9ee9('0xaf')](_0x4bce02);logger['error'](_0xb64cb1,util[_0x9ee9('0x97')](_0x27bad7,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x9ee9('0xcf')]=function(_0x55bc93,_0xe66109,_0xf5b485){var _0x72ee2c={'state':0x19,'statedesc':_0x9ee9('0xd0')};this[_0x9ee9('0xaf')](_0xe66109);this['saveInDb'](_['merge'](_0x72ee2c,_['pick'](_0xf5b485,[_0x9ee9('0xd1'),_0x9ee9('0xd2'),'UserId',_0x9ee9('0xd3'),'CampaignId'])),_0x9ee9('0xd4'),'[emptyContact]');logger[_0x9ee9('0x98')](_0x55bc93);};Dialer[_0x9ee9('0x1c')]['isSuccess']=function(_0x169fe8){return _0x169fe8===_0x9ee9('0xd5');};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xd6')]=function(_0x7ffe83){return!_['isUndefined'](_0x7ffe83)&&_0x7ffe83&&!_[_0x9ee9('0x40')](_0x7ffe83[_0x9ee9('0x43')])&&!_['isUndefined'](_0x7ffe83['active'])&&_0x7ffe83[_0x9ee9('0x75')]&&(this['trunks'][util[_0x9ee9('0x77')](_0x9ee9('0xd7'),_0x7ffe83['name'])][_0x9ee9('0xac')]===_0x9ee9('0xd8')||this[_0x9ee9('0x25')][util[_0x9ee9('0x77')]('SIP/%s',_0x7ffe83[_0x9ee9('0x43')])][_0x9ee9('0xac')]===_0x9ee9('0xd9'));};Dialer[_0x9ee9('0x1c')]['saveInDb']=function(_0xfcaefb,_0x5c2915,_0x4a4607){this['createHistory'](_0xfcaefb)[_0x9ee9('0xad')](loggerCatch(_0x5c2915));this[_0x9ee9('0xc8')](_0xfcaefb)[_0x9ee9('0xad')](loggerCatch(_0x4a4607));};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xda')]=function(_0x1e6e46){var _0x41652b=this;var _0x50f032=this[_0x9ee9('0x28')][_0x1e6e46['uniqueid']];var _0x44ac6c;if(!_[_0x9ee9('0xab')](_0x1e6e46)&&!_['isNil'](_0x1e6e46[_0x9ee9('0xdb')])&&!_['isNil'](_0x1e6e46[_0x9ee9('0xdb')][_0x9ee9('0xdc')])&&_0x1e6e46['exten']===_0x9ee9('0xdd')&&_0x50f032){if(_0x50f032[_0x9ee9('0x50')]!==_0x9ee9('0x79')&&this[_0x9ee9('0x22')][_0x50f032[_0x9ee9('0xb1')]][_0x9ee9('0xde')]&&_0x1e6e46['value']===_0x9ee9('0xdf')){delete this[_0x9ee9('0x28')][_0x1e6e46['uniqueid']];this[_0x9ee9('0xaf')](this[_0x9ee9('0x22')][_0x50f032['queue']]);this[_0x9ee9('0x22')][_0x50f032[_0x9ee9('0xb1')]][_0x9ee9('0x5f')]+=0x1;this[_0x9ee9('0x22')][_0x50f032['queue']][_0x9ee9('0xe0')]+=0x1;_0x44ac6c=new Hangup(_0x50f032,_0x1e6e46);_0x44ac6c[_0x9ee9('0xe1')]=0x12;_0x44ac6c[_0x9ee9('0xa7')]=_0x9ee9('0xe2');_0x44ac6c[_0x9ee9('0xe3')]=_0x9ee9('0xe4');ami['emit'](_0x9ee9('0xe5'),ut[_0x9ee9('0xe6')](_0x44ac6c,'amd'));this[_0x9ee9('0xe7')](_0x44ac6c,_0x9ee9('0xe8'),_0x9ee9('0xe9'));}if(_0x50f032['type']!==_0x9ee9('0x79')&&this['voiceQueues'][_0x50f032['queue']][_0x9ee9('0xde')]&&_0x1e6e46['value']===_0x9ee9('0xea')){return new Promise(function(_0x1bd471,_0x5f27cf){delete _0x41652b[_0x9ee9('0x28')][_0x1e6e46[_0x9ee9('0xeb')]];_0x41652b[_0x9ee9('0xaf')](_0x41652b[_0x9ee9('0x22')][_0x50f032['queue']]);_0x41652b[_0x9ee9('0x22')][_0x50f032[_0x9ee9('0xb1')]][_0x9ee9('0x5f')]+=0x1;_0x41652b[_0x9ee9('0x22')][_0x50f032[_0x9ee9('0xb1')]][_0x9ee9('0xe0')]+=0x1;var _0x497239=_0x41652b[_0x9ee9('0x22')][_0x50f032[_0x9ee9('0xb1')]];var _0x2683c2=new Hangup(_0x50f032,_0x1e6e46);_0x2683c2[_0x9ee9('0xe1')]=0x13;_0x2683c2[_0x9ee9('0xa7')]=_0x9ee9('0xec');_0x2683c2[_0x9ee9('0xe3')]=_0x9ee9('0xe4');_0x2683c2[_0x9ee9('0xed')]+=0x1;_0x2683c2['countglobal']+=0x1;_0x2683c2['amd']=!![];ami['emit'](_0x9ee9('0xe5'),ut[_0x9ee9('0xe6')](_0x2683c2,'amd'));_0x41652b['createHistory'](_0x2683c2)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xee')));if(_0x2683c2[_0x9ee9('0xef')]+_0x2683c2[_0x9ee9('0xf0')]+_0x2683c2['countnoanswerretry']+_0x2683c2['countnosuchnumberretry']+_0x2683c2['countdropretry']+_0x2683c2[_0x9ee9('0xf1')]+_0x2683c2[_0x9ee9('0xed')]+_0x2683c2[_0x9ee9('0xf2')]>=_0x497239['dialGlobalMaxRetry']){_0x41652b['stateGlobal'](_0x2683c2,_0x1bd471,_0x5f27cf,'reason19\x20machine....');}else{if(_0x2683c2[_0x9ee9('0xed')]>=_0x497239['dialMachineMaxRetry']){_0x41652b[_0x9ee9('0xf3')](_0x2683c2,_0x1bd471,_0x5f27cf,_0x9ee9('0xf4'));}else{_0x41652b[_0x9ee9('0xbd')]({'active':![],'countmachineretry':_0x2683c2[_0x9ee9('0xed')],'scheduledat':moment()[_0x9ee9('0xf5')](_0x497239['dialMachineRetryFrequency'],_0x9ee9('0xf6'))['format'](_0x9ee9('0xf7')),'ContactId':_0x2683c2['ContactId'],'ListId':_0x2683c2['ListId'],'VoiceQueueId':_0x2683c2[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x2683c2[_0x9ee9('0xf8')]||undefined})['catch'](loggerCatch(_0x9ee9('0xf9')));_0x1bd471({'reschedule':0x1});}}});}if(_0x50f032[_0x9ee9('0x50')]===_0x9ee9('0x79')&&this['campaigns'][_0x50f032['queue']][_0x9ee9('0xde')]&&_0x1e6e46[_0x9ee9('0xfa')]===_0x9ee9('0xdf')){delete this['uniqueId'][_0x1e6e46[_0x9ee9('0xeb')]];this[_0x9ee9('0xaf')](this[_0x9ee9('0x23')][_0x50f032['queue']]);_0x44ac6c=new Hangup(_0x50f032,_0x1e6e46);_0x44ac6c[_0x9ee9('0xe1')]=0x12;_0x44ac6c['statedesc']=_0x9ee9('0xe2');_0x44ac6c[_0x9ee9('0xe3')]=_0x9ee9('0xe4');ami[_0x9ee9('0x4f')](_0x9ee9('0xe5'),ut[_0x9ee9('0xe6')](_0x44ac6c,_0x9ee9('0xfb')));this['saveInDb'](_0x44ac6c,_0x9ee9('0xfc'),_0x9ee9('0xfd'));}if(_0x50f032[_0x9ee9('0x50')]===_0x9ee9('0x79')&&this[_0x9ee9('0x23')][_0x50f032[_0x9ee9('0xb1')]][_0x9ee9('0xde')]&&_0x1e6e46[_0x9ee9('0xfa')]===_0x9ee9('0xea')){return new Promise(function(_0x35eade,_0x2aef36){delete _0x41652b[_0x9ee9('0x28')][_0x1e6e46[_0x9ee9('0xeb')]];_0x41652b[_0x9ee9('0xaf')](_0x41652b[_0x9ee9('0x23')][_0x50f032[_0x9ee9('0xb1')]]);_0x41652b[_0x9ee9('0x23')][_0x50f032[_0x9ee9('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x41652b[_0x9ee9('0x23')][_0x50f032[_0x9ee9('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x47d595=_0x41652b[_0x9ee9('0x23')][_0x50f032[_0x9ee9('0xb1')]];var _0x483ec8=new Hangup(_0x50f032,_0x1e6e46);_0x483ec8['state']=0x13;_0x483ec8[_0x9ee9('0xa7')]=_0x9ee9('0xec');_0x483ec8[_0x9ee9('0xe3')]='AMD';_0x483ec8[_0x9ee9('0xed')]+=0x1;_0x483ec8[_0x9ee9('0xfe')]+=0x1;_0x483ec8[_0x9ee9('0xfb')]=!![];ami[_0x9ee9('0x4f')](_0x9ee9('0xe5'),ut['buildObj'](_0x483ec8,_0x9ee9('0xfb')));_0x41652b['createHistory'](_0x483ec8)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xee')));if(_0x483ec8[_0x9ee9('0xef')]+_0x483ec8['countcongestionretry']+_0x483ec8[_0x9ee9('0xff')]+_0x483ec8[_0x9ee9('0x100')]+_0x483ec8[_0x9ee9('0x101')]+_0x483ec8[_0x9ee9('0xf1')]+_0x483ec8[_0x9ee9('0xed')]+_0x483ec8['countagentrejectretry']>=_0x47d595['dialGlobalMaxRetry']){_0x41652b[_0x9ee9('0x102')](_0x483ec8,_0x35eade,_0x2aef36,_0x9ee9('0x103'));}else{if(_0x483ec8[_0x9ee9('0xed')]>=_0x47d595[_0x9ee9('0x104')]){_0x41652b['createStateFinal'](_0x483ec8,_0x35eade,_0x2aef36,'reason\x2019\x20machine....');}else{_0x41652b[_0x9ee9('0xbd')]({'active':![],'countmachineretry':_0x483ec8[_0x9ee9('0xed')],'scheduledat':moment()['add'](_0x47d595['dialMachineRetryFrequency'],_0x9ee9('0xf6'))['format'](_0x9ee9('0xf7')),'ContactId':_0x483ec8[_0x9ee9('0xd1')],'ListId':_0x483ec8[_0x9ee9('0xd2')],'VoiceQueueId':_0x483ec8[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x483ec8[_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xf9')));_0x35eade({'reschedule':0x1});}}});}}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x105')]=function(_0x14272c){var _0x1355a9=this[_0x9ee9('0x28')][_0x14272c[_0x9ee9('0xeb')]];var _0x3c8285;if(_0x1355a9&&_0x1355a9[_0x9ee9('0x50')]===_0x9ee9('0x79')){delete this[_0x9ee9('0x28')][_0x14272c[_0x9ee9('0xeb')]];this[_0x9ee9('0xaf')](this[_0x9ee9('0x23')][_0x1355a9[_0x9ee9('0xb1')]]);this[_0x9ee9('0x23')][_0x1355a9[_0x9ee9('0xb1')]][_0x9ee9('0x106')]+=0x1;_0x3c8285=new Hangup(_0x1355a9,_0x14272c);this[_0x9ee9('0xca')](_0x3c8285)['catch'](loggerCatch(_0x9ee9('0x107')));this['moveContactManagedDialer'](_0x3c8285)['catch'](loggerCatch(_0x9ee9('0x108')));}if(_0x1355a9&&_0x1355a9[_0x9ee9('0x50')]!=='ivr'&&isNotNull(this[_0x9ee9('0x22')][_0x1355a9[_0x9ee9('0xb1')]]['dialQueueProject'])){delete this[_0x9ee9('0x28')][_0x14272c[_0x9ee9('0xeb')]];this[_0x9ee9('0xaf')](this[_0x9ee9('0x22')][_0x1355a9[_0x9ee9('0xb1')]]);this[_0x9ee9('0x22')][_0x1355a9[_0x9ee9('0xb1')]][_0x9ee9('0x5f')]+=0x1;this[_0x9ee9('0x22')][_0x1355a9[_0x9ee9('0xb1')]][_0x9ee9('0xe0')]+=0x1;_0x3c8285=new Hangup(_0x1355a9,_0x14272c);_0x3c8285['state']=0x10;_0x3c8285[_0x9ee9('0xa7')]=_0x9ee9('0x109');_0x3c8285['membername']=_0x9ee9('0x10a');this[_0x9ee9('0xca')](_0x3c8285)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x9ee9('0xc8')](_0x3c8285)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x108')));}if(_0x1355a9&&_0x1355a9[_0x9ee9('0x50')]!==_0x9ee9('0x79')&&!isNotNull(this['voiceQueues'][_0x1355a9['queue']][_0x9ee9('0x10b')])){delete this[_0x9ee9('0x28')][_0x14272c[_0x9ee9('0xeb')]];this['updateOriginated'](this[_0x9ee9('0x22')][_0x1355a9[_0x9ee9('0xb1')]]);this[_0x9ee9('0x22')][_0x1355a9[_0x9ee9('0xb1')]][_0x9ee9('0x64')]+=0x1;_0x3c8285=new Hangup(_0x1355a9,_0x14272c);_0x3c8285['state']=0xc;_0x3c8285[_0x9ee9('0xa7')]=_0x14272c[_0x9ee9('0x10c')];_0x3c8285[_0x9ee9('0xe3')]=_0x9ee9('0x10d');this[_0x9ee9('0xca')](_0x3c8285)[_0x9ee9('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x9ee9('0xc8')](_0x3c8285)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x108')));}};Dialer[_0x9ee9('0x1c')]['syncAgentComplete']=function(_0x484807){var _0x38f735=this['uniqueId'][_0x484807[_0x9ee9('0xeb')]];if(this[_0x9ee9('0x22')][_0x484807[_0x9ee9('0xb1')]]){if(_0x38f735&&_0x38f735[_0x9ee9('0x50')]!==_0x9ee9('0x79')){delete this['uniqueId'][_0x484807[_0x9ee9('0xeb')]];this['voiceQueues'][_0x484807[_0x9ee9('0xb1')]][_0x9ee9('0x5f')]+=0x1;var _0x3d722e=new AgentComplete(_0x38f735,_0x484807);if(_0x484807[_0x9ee9('0x10e')]==='agent'){_0x3d722e[_0x9ee9('0x10f')]=this['voiceQueues'][_0x484807[_0x9ee9('0xb1')]][_0x9ee9('0x110')]&&this[_0x9ee9('0x22')][_0x484807[_0x9ee9('0xb1')]][_0x9ee9('0x111')]?moment()[_0x9ee9('0x77')](_0x9ee9('0xf7')):undefined;}this[_0x9ee9('0xca')](_0x3d722e)['catch'](loggerCatch(_0x9ee9('0x112')));this[_0x9ee9('0xc8')](_0x3d722e)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x2d')]=function(_0x1d39ad){if(this['voiceQueues'][_0x1d39ad['queue']]){if(this[_0x9ee9('0x28')][_0x1d39ad[_0x9ee9('0xeb')]]&&this[_0x9ee9('0x28')][_0x1d39ad[_0x9ee9('0xeb')]][_0x9ee9('0x50')]!==_0x9ee9('0x79')){this[_0x9ee9('0xaf')](this[_0x9ee9('0x22')][_0x1d39ad[_0x9ee9('0xb1')]]);this[_0x9ee9('0x28')][_0x1d39ad[_0x9ee9('0xeb')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x113')]=function(_0x297187,_0x44d7f6){this[_0x9ee9('0xca')](_0x297187)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x112')));if(_0x44d7f6==0x0){this[_0x9ee9('0xc8')](_0x297187)['catch'](loggerCatch(_0x9ee9('0x114')));}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x115')]=function(_0x258990){var _0x227291=this[_0x9ee9('0x28')][_0x258990[_0x9ee9('0xeb')]];var _0x2d47b4=this;var _0x10ee0e=![];var _0x1f3c46;var _0xc1190c;if(this[_0x9ee9('0x22')][_0x258990['queue']]){if(_0x227291&&_0x227291['type']!==_0x9ee9('0x79')){delete this[_0x9ee9('0x28')][_0x258990[_0x9ee9('0xeb')]];this[_0x9ee9('0xaf')](this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]]);_0x227291['droptime']=moment()[_0x9ee9('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2f2a79=new QueueCallerAbandon(_0x227291,_0x258990);if(getSeconds(_0x227291[_0x9ee9('0x116')],_0x227291[_0x9ee9('0x117')])>=_0x227291[_0x9ee9('0x118')]){this['voiceQueues'][_0x258990[_0x9ee9('0xb1')]][_0x9ee9('0x69')]+=0x1;this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]][_0x9ee9('0x119')]+=0x1;this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]][_0x9ee9('0x6b')]+=0x1;_0x2f2a79[_0x9ee9('0xe1')]=0xa;_0x2f2a79[_0x9ee9('0xa7')]=_0x9ee9('0x11a');_0x2f2a79[_0x9ee9('0x11b')]=_0x9ee9('0x11c');_0x2f2a79[_0x9ee9('0x10f')]=this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]][_0x9ee9('0x110')]?moment()[_0x9ee9('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2f2a79[_0x9ee9('0x101')]+=0x1;_0x2f2a79[_0x9ee9('0xfe')]+=0x1;_0x1f3c46=this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]]['dialDropRetryFrequency'];_0xc1190c=this[_0x9ee9('0x22')][_0x258990['queue']][_0x9ee9('0x11d')];_0x2d47b4[_0x9ee9('0xb7')](_0x2f2a79,_0x2f2a79[_0x9ee9('0xe1')],_0x227291[_0x9ee9('0x11e')])[_0x9ee9('0x3e')](function(_0x4f62b0){_0x10ee0e=_0x4f62b0[_0x9ee9('0x11f')]==0x1;if(_0x2f2a79[_0x9ee9('0x101')]>=_0x2d47b4[_0x9ee9('0x22')][_0x258990['queue']]['dialDropMaxRetry']){_0x2d47b4[_0x9ee9('0x113')](_0x2f2a79,_0x4f62b0[_0x9ee9('0x11f')]);}else{_0x2d47b4[_0x9ee9('0xbd')]({'active':![],'countdropretry':_0x2f2a79[_0x9ee9('0x101')],'scheduledat':moment()[_0x9ee9('0xf5')](_0x2d47b4[_0x9ee9('0x22')][_0x258990['queue']][_0x9ee9('0x120')],_0x9ee9('0xf6'))['format'](_0x9ee9('0xf7')),'ContactId':_0x227291[_0x9ee9('0xd1')],'ListId':_0x227291[_0x9ee9('0xd2')],'VoiceQueueId':_0x227291[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x227291[_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x121')));var _0x812647=new History(_0x2f2a79);_0x812647['state']=0xa;_0x812647[_0x9ee9('0xa7')]=_0x9ee9('0x11a');_0x812647[_0x9ee9('0xa8')]=moment()[_0x9ee9('0x77')](_0x9ee9('0xf7'));_0x812647[_0x9ee9('0x122')]=_0x812647['starttime'];_0x812647[_0x9ee9('0x123')]=_0x2f2a79['calleridname'];_0x812647[_0x9ee9('0x124')]=_0x2f2a79[_0x9ee9('0x124')];_0x2d47b4['createHistory'](_0x812647)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x125')));}})[_0x9ee9('0x3e')](function(){if(_0x10ee0e)_0x2d47b4[_0x9ee9('0xb8')](_0x2f2a79,_0x1f3c46,_0xc1190c)[_0x9ee9('0x3e')](function(){return 0x1;});});}else{this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]][_0x9ee9('0x68')]+=0x1;this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]][_0x9ee9('0x62')]+=0x1;_0x2f2a79[_0x9ee9('0xe1')]=0xb;_0x2f2a79[_0x9ee9('0xa7')]=_0x9ee9('0x126');_0x2f2a79[_0x9ee9('0x11b')]='CALLEREXIT';_0x2f2a79[_0x9ee9('0xf1')]+=0x1;_0x2f2a79[_0x9ee9('0xfe')]+=0x1;_0x1f3c46=this[_0x9ee9('0x22')][_0x258990[_0x9ee9('0xb1')]]['dialAbandonedRetryFrequency'];_0xc1190c=this[_0x9ee9('0x22')][_0x258990['queue']][_0x9ee9('0x11d')];_0x2d47b4[_0x9ee9('0xb7')](_0x2f2a79,_0x2f2a79[_0x9ee9('0xe1')],_0x227291[_0x9ee9('0x11e')])[_0x9ee9('0x3e')](function(_0x450841){if(_0x2f2a79[_0x9ee9('0xf1')]>=_0x2d47b4['voiceQueues'][_0x258990['queue']][_0x9ee9('0x127')]){_0x2d47b4['queueCallerAbandonCreateState'](_0x2f2a79,_0x450841[_0x9ee9('0x11f')]);}else{_0x2d47b4[_0x9ee9('0xbd')]({'active':![],'countabandonedretry':_0x2f2a79[_0x9ee9('0xf1')],'scheduledat':moment()[_0x9ee9('0xf5')](_0x2d47b4[_0x9ee9('0x22')][_0x258990['queue']][_0x9ee9('0x128')],_0x9ee9('0xf6'))[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x227291[_0x9ee9('0xd1')],'ListId':_0x227291[_0x9ee9('0xd2')],'VoiceQueueId':_0x227291['VoiceQueueId']||undefined,'CampaignId':_0x227291['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x536864=new History(_0x2f2a79);_0x536864[_0x9ee9('0xe1')]=0xb;_0x536864[_0x9ee9('0xa7')]=_0x9ee9('0x126');_0x536864['starttime']=moment()[_0x9ee9('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x536864[_0x9ee9('0x122')]=_0x536864[_0x9ee9('0xa8')];_0x536864['calleridname']=_0x2f2a79['calleridname'];_0x536864[_0x9ee9('0x124')]=_0x2f2a79['calleridnum'];_0x2d47b4[_0x9ee9('0xca')](_0x536864)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x129')));}})['then'](function(){if(_0x10ee0e)_0x2d47b4['swapAdditionalPhones'](_0x2f2a79,_0x1f3c46,_0xc1190c)[_0x9ee9('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x9ee9('0x1c')]['syncNewExten']=function(_0xfa09c0){if(this[_0x9ee9('0x27')][_0xfa09c0['uniqueid']]){this['actions'][_0xfa09c0[_0x9ee9('0xeb')]][_0x9ee9('0x12a')]=_0xfa09c0[_0x9ee9('0x12a')];}if(this[_0x9ee9('0x28')][_0xfa09c0[_0x9ee9('0xeb')]]){this[_0x9ee9('0x28')][_0xfa09c0[_0x9ee9('0xeb')]][_0x9ee9('0x12a')]=_0xfa09c0[_0x9ee9('0x12a')];}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x3a')]=function(_0x3a91a2){if(strategy[this[_0x9ee9('0x22')][this[_0x9ee9('0x27')][_0x3a91a2['actionid']][_0x9ee9('0xb1')]][_0x9ee9('0x52')]]===_0x9ee9('0x1b')){if(this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]]&&_['isNil'](this[_0x9ee9('0x27')][_0x3a91a2['actionid']][_0x9ee9('0x12c')])&&_0x3a91a2[_0x9ee9('0xac')]==='1'&&_0x3a91a2[_0x9ee9('0x12d')]==='0'){if(this[_0x9ee9('0x24')][_0x3a91a2[_0x9ee9('0x12e')]]){if(!this[_0x9ee9('0x24')][_0x3a91a2[_0x9ee9('0x12e')]][_0x9ee9('0x12c')]){this[_0x9ee9('0x24')][_0x3a91a2[_0x9ee9('0x12e')]][_0x9ee9('0x12c')]=!![];this[_0x9ee9('0x27')][_0x3a91a2['actionid']][_0x9ee9('0x12c')]=!![];this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]]['stateinterface']=_0x3a91a2[_0x9ee9('0x12e')];}}}}else if((strategy[this['voiceQueues'][this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]][_0x9ee9('0x52')]]||_0x9ee9('0x12f'))===_0x9ee9('0x12f')){if(this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]]){if(this[_0x9ee9('0x24')][_0x3a91a2['stateinterface']]){this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]]['stateinterface']=_0x3a91a2[_0x9ee9('0x12e')];if(_[_0x9ee9('0xab')](this['queueBooked'][this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]]['queue']])){this[_0x9ee9('0x2c')][this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]=[];}this[_0x9ee9('0x2c')][this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]['push'](_[_0x9ee9('0x8c')](_[_0x9ee9('0x130')](this[_0x9ee9('0x27')][_0x3a91a2[_0x9ee9('0x12b')]],[_0x9ee9('0x131'),'stateinterface']),{'status':_0x3a91a2[_0x9ee9('0xac')],'paused':_0x3a91a2[_0x9ee9('0x12d')]}));}}}};function unlockQueueStatus(_0x1460e5,_0x97f89e){setTimeout(function(){if(_['isUndefined'](_0x1460e5[_0x9ee9('0x132')])){loggerBooked[_0x9ee9('0x98')](_0x9ee9('0x133'),_0x97f89e);}_0x1460e5[_0x9ee9('0x132')]=!![];loggerBooked[_0x9ee9('0x7c')](_0x9ee9('0x134'),_0x97f89e,JSON[_0x9ee9('0x4c')](_[_0x9ee9('0x130')](_0x1460e5,['name',_0x9ee9('0x132')])));},0x1f3);}Dialer[_0x9ee9('0x1c')][_0x9ee9('0x135')]=function(_0x10e8e3){var _0x216650=this;var _0x5df673=_0x216650[_0x9ee9('0x22')][_0x216650['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]];if(strategy[this[_0x9ee9('0x22')][this[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]['strategy']]===_0x9ee9('0x1b')){if(this[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]]&&this[_0x9ee9('0x27')][_0x10e8e3['actionid']][_0x9ee9('0x12e')]){this[_0x9ee9('0x21')][_0x9ee9('0x136')](this['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0x131')],this['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0x12e')])['catch'](function(_0x3484c8){logger[_0x9ee9('0x98')](_0x9ee9('0x137'),util[_0x9ee9('0x97')](_0x3484c8,{'showHidden':![],'depth':null}));})[_0x9ee9('0x1f')](function(){_0x216650[_0x9ee9('0xaf')](_0x216650['voiceQueues'][_0x216650['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]);_0x216650[_0x9ee9('0x24')][_0x216650[_0x9ee9('0x27')][_0x10e8e3['actionid']]['stateinterface']][_0x9ee9('0x12c')]=![];delete _0x216650[_0x9ee9('0x27')][_0x10e8e3['actionid']];unlockQueueStatus(_0x5df673);});}else{this['updateOriginated'](this[_0x9ee9('0x22')][this[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]);this[_0x9ee9('0xbd')]({'active':![],'ContactId':this[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]]['ContactId'],'ListId':this[_0x9ee9('0x27')][_0x10e8e3['actionid']][_0x9ee9('0xd2')],'VoiceQueueId':this[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xd3')]||undefined,'CampaignId':this['actions'][_0x10e8e3['actionid']]['CampaignId']||undefined})[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x138')));delete this[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]];unlockQueueStatus(_0x5df673);}}else if((strategy[this[_0x9ee9('0x22')][this['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]['strategy']]||_0x9ee9('0x12f'))===_0x9ee9('0x12f')){var _0x15d736;if(this[_0x9ee9('0x27')][_0x10e8e3['actionid']]&&!_[_0x9ee9('0x49')](this['queueBooked'][this['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]])){if(this[_0x9ee9('0x139')][_0x216650['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]){this[_0x9ee9('0x139')][_0x216650[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]=this[_0x9ee9('0x139')][this[_0x9ee9('0x27')][_0x10e8e3['actionid']]['queue']]?this[_0x9ee9('0x139')][this[_0x9ee9('0x27')][_0x10e8e3['actionid']][_0x9ee9('0xb1')]]:this['queueBooked'][this['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]]?this['queueBooked'][this[_0x9ee9('0x27')][_0x10e8e3[_0x9ee9('0x12b')]]['queue']][_0x9ee9('0x13a')]||0x0:0x0;}this[_0x9ee9('0x2c')][this[_0x9ee9('0x27')][_0x10e8e3['actionid']][_0x9ee9('0xb1')]]['_rr']=this[_0x9ee9('0x139')][this['actions'][_0x10e8e3[_0x9ee9('0x12b')]][_0x9ee9('0xb1')]];for(var _0x431dd8=0x0;_0x431dd8=0x0;})[_0x9ee9('0xad')](myreject(_0x1c0d7c)));}}else{_0x1a0916[_0x9ee9('0x153')](ami[_0x9ee9('0x157')]({'action':_0x9ee9('0x154'),'command':util[_0x9ee9('0x77')]('iftime\x20%s,%s',_0x179f0d,!_[_0x9ee9('0x40')](config[_0x9ee9('0x14e')][_0x3e4d16])?_0x3e4d16:'')})[_0x9ee9('0x3e')](function(_0x44a73c){return _0x44a73c[_0x9ee9('0x156')][_0x9ee9('0x158')]('true')>=0x0;})[_0x9ee9('0xad')](myreject(_0x1c0d7c)));}Promise[_0x9ee9('0x159')](_0x1a0916)[_0x9ee9('0x3e')](function(_0x50f48d){var _0x480e77=_[_0x9ee9('0x15a')](_0x50f48d);if(_0x480e77){return _0x3a0bde(_0x480e77);}else{_0x5227c2[_0x9ee9('0x41')]=_0x541fb0?'GLOBAL_INTERVAL_IS_OVERTIME':_0x9ee9('0x15b');return _0x1c0d7c(msgResponse(_0x9ee9('0x15c'),_0x9ee9('0x14a'),_0x9ee9('0x15d')+_0x541fb0+'\x20'+_0x49b961+_0x9ee9('0x15e')+util[_0x9ee9('0x97')](_0x179f0d,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3e4d16));}})['catch'](function(_0x174140){return _0x1c0d7c(msgResponse('ifTime',_0x9ee9('0x14a'),JSON['stringify'](_0x174140)));});});};Dialer['prototype'][_0x9ee9('0x15f')]=function(_0x1c600a){var _0x5b7149=this;return function(){switch(_0x1c600a[_0x9ee9('0x5c')]){case _0x9ee9('0x160'):freeVariablesPredictive(_0x1c600a);_0x5b7149[_0x9ee9('0x161')](_0x1c600a,0x1);break;case _0x9ee9('0x162'):freeVariablesPredictive(_0x1c600a);_0x5b7149[_0x9ee9('0x161')](_0x1c600a,_0x1c600a[_0x9ee9('0x163')]);break;case _0x9ee9('0x8'):_0x5b7149[_0x9ee9('0x8')](_0x1c600a);break;case _0x9ee9('0x7'):freeVariablesPredictive(_0x1c600a);_0x5b7149[_0x9ee9('0x161')](_0x1c600a,0x1);break;default:freeVariablesPredictive(_0x1c600a);logger['error'](_0x9ee9('0x164'),_0x1c600a['name'],_0x9ee9('0x165'));}};};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x166')]=function(_0x5aba6b){return Promise[_0x9ee9('0xb5')]()[_0x9ee9('0x3e')](cmHopper[_0x9ee9('0x167')](_0x5aba6b['id'],previewRecallmeReminderInterval))[_0x9ee9('0x3e')](function(_0x2d6be6){for(var _0x3d3976=0x0;_0x3d3976<_0x2d6be6[_0x9ee9('0x152')];_0x3d3976++){var _0x15b9fe=_0x2d6be6[_0x3d3976][_0x9ee9('0x168')]['name'];if(_0x15b9fe)io['to'](util['format'](_0x9ee9('0x169'),_0x15b9fe))[_0x9ee9('0x4f')](_0x9ee9('0x16a'),{'hopper':_0x2d6be6[_0x3d3976]});}})['catch'](function(){});};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x16b')]=function(_0xbc4270){var _0x80ddb=this;return function(){_0x80ddb[_0x9ee9('0x16c')](_0xbc4270);};};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xa')]=function(_0x19f688){var _0x2ebf1f=this;if(isNotPreview(_0x19f688[_0x9ee9('0x5c')])){if(isVoiceQueueOutbound(_0x19f688['type'])&&isActive(_0x19f688[_0x9ee9('0x16d')])){_0x19f688[_0x9ee9('0xa0')]=!![];Promise['resolve']()[_0x9ee9('0x3e')](checkIsLoggedIn(_0x19f688,_0x19f688[_0x9ee9('0x54')]))['then'](checkIsActive(_0x19f688,_0x19f688[_0x9ee9('0x16d')]))['then'](checkInterval(_0x19f688))[_0x9ee9('0x3e')](_0x2ebf1f[_0x9ee9('0x144')](_0x19f688))[_0x9ee9('0x3e')](_0x2ebf1f[_0x9ee9('0x147')](_0x19f688[_0x9ee9('0x16e')],_0x19f688['dialTimezone'],_0x19f688[_0x9ee9('0x43')],_0x19f688))[_0x9ee9('0x3e')](_0x2ebf1f['checkIfTimeIntervals'](_0x19f688['Interval'],_0x19f688[_0x9ee9('0x16f')],_0x19f688[_0x9ee9('0x43')],_0x19f688))[_0x9ee9('0x3e')](_0x2ebf1f[_0x9ee9('0x15f')](_0x19f688))[_0x9ee9('0xad')](loggerCatchQueueSummary(_0x9ee9('0x170'),_0x19f688));}else{notSendMessagesQueue(_0x19f688);}}else{freeVariablesPredictive(_0x19f688);}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x36')]=_[_0x9ee9('0x171')](function(){var _0x10949b=_[_0x9ee9('0x172')](this[_0x9ee9('0x22')],function(_0x234aa0){return _0x234aa0[_0x9ee9('0x173')];});var _0x3196d1=_[_0x9ee9('0x172')](this[_0x9ee9('0x24')],function(_0x1072f3){return _0x1072f3['online']&&_0x1072f3[_0x9ee9('0xac')]===_0x9ee9('0xd8');});if(_0x10949b[_0x9ee9('0x152')]>0x0&&_0x3196d1[_0x9ee9('0x152')]>0x0){return Promise['resolve']()[_0x9ee9('0x3e')](cmHopper[_0x9ee9('0x167')](_[_0x9ee9('0x174')](_0x10949b,'id'),previewRecallmeReminderInterval,_['map'](_0x3196d1,'id')))[_0x9ee9('0x3e')](function(_0x5da86b){for(var _0xedbdc5=0x0;_0xedbdc5<_0x5da86b[_0x9ee9('0x152')];_0xedbdc5++){var _0x3c8357=_0x5da86b[_0xedbdc5]['Agent'][_0x9ee9('0x43')];if(_0x3c8357)io['to'](util[_0x9ee9('0x77')]('user:%s',_0x3c8357))[_0x9ee9('0x4f')](_0x9ee9('0x16a'),{'hopper':_0x5da86b[_0xedbdc5]});}})[_0x9ee9('0xad')](function(_0xaf2a57){logger[_0x9ee9('0x98')](_0x9ee9('0x166'),_0xaf2a57);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9ee9('0x1c')][_0x9ee9('0x175')]=function(){var _0x145c2f=this;var _0x192bae;for(var _0x18685f in this['campaigns']){if(typeof this[_0x9ee9('0x23')][_0x18685f]!==_0x9ee9('0x9a')){_0x192bae=this['campaigns'][_0x18685f];if(isCampaignIvr(_0x192bae['type'])&&isActive(_0x192bae[_0x9ee9('0x75')])){_0x192bae[_0x9ee9('0xa0')]=!![];Promise['resolve']()[_0x9ee9('0x3e')](checkIsActive(_0x192bae,_0x192bae['active']))[_0x9ee9('0x3e')](checkInterval(_0x192bae))['then'](_0x145c2f[_0x9ee9('0x144')](_0x192bae))['then'](_0x145c2f['checkIfTime'](_0x192bae['dialGlobalInterval'],_0x192bae[_0x9ee9('0x16f')],_0x192bae[_0x9ee9('0x43')],_0x192bae))[_0x9ee9('0x3e')](_0x145c2f['checkIfTimeIntervals'](_0x192bae[_0x9ee9('0x46')],_0x192bae[_0x9ee9('0x16f')],_0x192bae[_0x9ee9('0x43')],_0x192bae))[_0x9ee9('0x3e')](_0x145c2f[_0x9ee9('0x16b')](_0x192bae))[_0x9ee9('0xad')](loggerCatchQueueSummary(_0x9ee9('0x176'),_0x192bae));}else{notSendMessagesCampaign(_0x192bae);}}}};function getCallerIdRandom(_0x5d5946,_0x5b0f2b){var _0x50737a;var _0x5e1cb1;var _0x34d710;if(_0x5b0f2b<=0x0){_0x5b0f2b=0x1;}_0x50737a=new RegExp(_0x9ee9('0x177')+_0x5b0f2b+'}$');_0x5e1cb1=Math[_0x9ee9('0x178')](0xa,_0x5b0f2b-0x1);_0x34d710=Math['pow'](0xa,_0x5b0f2b)-0x1;return util[_0x9ee9('0x77')]('%s',_[_0x9ee9('0x179')](_0x5d5946,_0x50737a,_[_0x9ee9('0x17a')](_0x5e1cb1,_0x34d710)));}function extractCalleridName(_0xa7fb57){var _0x92bd74=_0xa7fb57['match'](/"(.*?)"/);return _0x92bd74?_0x92bd74[0x1]:_0xa7fb57;}Dialer['prototype'][_0x9ee9('0x17b')]=function(_0x4b847d,_0xfb09e7){var _0x4600c8=this;var _0x528aaa=uuid['v4']();this[_0x9ee9('0x27')][_0x528aaa]=new Action(_0x4b847d,_0xfb09e7,_0x528aaa);return new Promise(function(_0x158c39,_0x9660ed){if(_['isUndefined'](_0x4b847d)&&typeof _0x4b847d!=='object'){return _0x9660ed(msgResponse(_0x9ee9('0x17c'),_0x9ee9('0x14a'),_0x9ee9('0x17d')));}if(_['isUndefined'](_0xfb09e7['phone'])||_0xfb09e7[_0x9ee9('0x17e')]===null){return _0x9660ed(msgResponse(_0x9ee9('0x17c'),_0x9ee9('0x14a'),_0x9ee9('0x17f')));}var _0x1cb50e={'XMD-CALLERID':_0x4600c8[_0x9ee9('0x27')][_0x528aaa]['getCaller'](),'XMD-AGI':_0x4b847d[_0x9ee9('0x10b')]?util[_0x9ee9('0x77')](_0x9ee9('0x180'),ipAgi,_0x4b847d[_0x9ee9('0x10b')]):_0x9ee9('0x181'),'XMD-AGIAFTER':_0x4b847d[_0x9ee9('0x110')]?util[_0x9ee9('0x77')](_0x9ee9('0x180'),ipAgi,_0x4b847d[_0x9ee9('0x110')]):'NONE','XMD-QUEUE':_0x4b847d['type']===_0x9ee9('0x51')?util[_0x9ee9('0x77')](_0x9ee9('0x182'),_0x4b847d[_0x9ee9('0x43')],_0x4b847d[_0x9ee9('0x183')]||'',_0x4b847d[_0x9ee9('0x111')]?'c':'',_0x4b847d[_0x9ee9('0x118')]||0x3):'NONE','XMD-CONTACTID':_0xfb09e7['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4600c8[_0x9ee9('0x27')][_0x528aaa][_0x9ee9('0x184')](),'XMD-AMD':_0x4b847d[_0x9ee9('0xde')]?_0x9ee9('0x185'):'NONE','XMD-DESTINATION':_0x9ee9('0xdd')};if(_0x4b847d[_0x9ee9('0xde')]){_0x1cb50e[_0x9ee9('0x186')]=_0x4b847d['dialAMDInitialSilence']||0x9c4;_0x1cb50e[_0x9ee9('0x187')]=_0x4b847d[_0x9ee9('0x188')]||0x5dc;_0x1cb50e[_0x9ee9('0x189')]=_0x4b847d[_0x9ee9('0x18a')]||0x320;_0x1cb50e[_0x9ee9('0x18b')]=_0x4b847d['dialAMDTotalAnalysisTime']||0x1388;_0x1cb50e[_0x9ee9('0x18c')]=_0x4b847d[_0x9ee9('0x18d')]||0x64;_0x1cb50e[_0x9ee9('0x18e')]=_0x4b847d[_0x9ee9('0x18f')]||0x32;_0x1cb50e[_0x9ee9('0x190')]=_0x4b847d[_0x9ee9('0x191')]||0x3;_0x1cb50e[_0x9ee9('0x192')]=_0x4b847d['dialAMDSilenceThreshold']||0x100;_0x1cb50e['XMD-AMDMAXIMUMWORDLENGTH']=_0x4b847d[_0x9ee9('0x193')]||0x1388;}if(_0x4b847d['type']==='outbound'){_0x1cb50e[_0x9ee9('0x194')]=_0xfb09e7[_0x9ee9('0xd3')];}else{_0x1cb50e[_0x9ee9('0x195')]=_0xfb09e7[_0x9ee9('0xf8')];}for(var _0x3efb2b in _0xfb09e7[_0x9ee9('0x196')]){if(typeof _0xfb09e7[_0x9ee9('0x196')][_0x3efb2b]!=='undefined'){if(isNotNull(_0xfb09e7[_0x9ee9('0x196')][_0x3efb2b])&&_0x3efb2b!=='id'&&_0x3efb2b!==_0x9ee9('0x197')&&_0x3efb2b!==_0x9ee9('0x198')&&_0x3efb2b!==_0x9ee9('0x199')){_0x1cb50e[util[_0x9ee9('0x77')](_0x9ee9('0x19a'),_0x9ee9('0x19b'),_[_0x9ee9('0x19c')](_0x3efb2b))]=_0xfb09e7[_0x9ee9('0x196')][_0x3efb2b];}}}var _0x312268=_0x4600c8[_0x9ee9('0xd6')](_0x4b847d['Trunk'])?getCallerId(_0x4b847d[_0x9ee9('0x74')][_0x9ee9('0x76')],_0x4b847d[_0x9ee9('0x5d')],_0x4b847d['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4b847d[_0x9ee9('0x19d')],_0x4b847d[_0x9ee9('0x19e')]):_0x4b847d[_0x9ee9('0x19d')]):getCallerId(_[_0x9ee9('0xab')](_0x4b847d[_0x9ee9('0x145')])?_0x4b847d[_0x9ee9('0x74')][_0x9ee9('0x76')]:_0x4b847d[_0x9ee9('0x145')][_0x9ee9('0x76')],_0x4b847d['dialOriginateCallerIdName'],_0x4b847d[_0x9ee9('0x19e')]>0x0?getCallerIdRandom(_0x4b847d[_0x9ee9('0x19d')],_0x4b847d['dialRandomLastDigitCallerIdNumber']):_0x4b847d['dialOriginateCallerIdNumber']);if(_0x312268){_0x1cb50e[_0x9ee9('0x19f')]=_0x4600c8[_0x9ee9('0x27')][_0x528aaa][_0x9ee9('0x1a0')]=extractCalleridName(_0x312268);_0x1cb50e[_0x9ee9('0x1a1')]=_0xfb09e7[_0x9ee9('0x17e')];}_0x4b847d[_0x9ee9('0x1a2')]=_0x1cb50e;return ami[_0x9ee9('0x157')]({'actionid':_0x528aaa,'action':_0x9ee9('0x17c'),'channel':_0x4600c8[_0x9ee9('0xd6')](_0x4b847d[_0x9ee9('0x74')])?util['format']('SIP/%s/%s%s',_0x4b847d[_0x9ee9('0x74')][_0x9ee9('0x43')],isNotNull(_0x4b847d[_0x9ee9('0x5e')])?_0x4b847d[_0x9ee9('0x5e')][_0x9ee9('0x1a3')]()||'':'',_0x4b847d[_0x9ee9('0x1a4')]>0x0?_0xfb09e7['phone'][_0x9ee9('0x1a5')](_0x4b847d[_0x9ee9('0x1a4')]):_0xfb09e7[_0x9ee9('0x17e')]):util[_0x9ee9('0x77')](_0x9ee9('0x1a6'),_[_0x9ee9('0xab')](_0x4b847d[_0x9ee9('0x145')])?_0x4b847d['Trunk'][_0x9ee9('0x43')]:_0x4b847d['TrunkBackup'][_0x9ee9('0x43')],isNotNull(_0x4b847d[_0x9ee9('0x5e')])?_0x4b847d[_0x9ee9('0x5e')]['trim']()||'':'',_0x4b847d[_0x9ee9('0x1a4')]>0x0?_0xfb09e7[_0x9ee9('0x17e')][_0x9ee9('0x1a5')](_0x4b847d[_0x9ee9('0x1a4')]):_0xfb09e7[_0x9ee9('0x17e')]),'callerid':_0x312268,'Exten':_0x9ee9('0xdd'),'Context':_0x9ee9('0x1a7'),'Priority':'1','variable':_0x1cb50e,'timeout':(_0x4b847d['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x528aaa})[_0x9ee9('0x3e')](function(_0x2d033c){return _0x158c39(_0x2d033c);})[_0x9ee9('0xad')](function(_0x316c11){_0x4b847d[_0x9ee9('0x1a8')]+=0x1;var _0x2935d3=new History(_0x4600c8['actions'][_0x528aaa]);logger['error'](util[_0x9ee9('0x77')](_0x9ee9('0x1a9'),JSON['stringify'](_0x316c11)));_0x2935d3['state']=0xe;_0x2935d3['statedesc']=_0x9ee9('0x1aa');_0x2935d3['starttime']=moment()['format'](_0x9ee9('0xf7'));_0x2935d3[_0x9ee9('0x122')]=_0x2935d3[_0x9ee9('0xa8')];_0x4600c8['createHistory'](_0x2935d3)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1ab')));_0x4600c8[_0x9ee9('0xc8')](_0x2935d3)['catch'](loggerCatch(_0x9ee9('0x1ab')))['finally'](function(){delete _0x4600c8[_0x9ee9('0x27')][_0x528aaa];return _0x9660ed(msgResponse(_0x9ee9('0x17c'),_0x9ee9('0x4b'),_0x9ee9('0x1ac')));});});});};Dialer['prototype'][_0x9ee9('0x31')]=function(_0x5b05a7){var _0x141120=this[_0x9ee9('0x27')][_0x5b05a7[_0x9ee9('0x12b')]];if(_0x141120){delete this[_0x9ee9('0x27')][_0x5b05a7[_0x9ee9('0x12b')]];_0x141120['responsetime']=moment()[_0x9ee9('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x29bc84=_0x141120[_0x9ee9('0x50')]===_0x9ee9('0x79')?this[_0x9ee9('0x23')][_0x141120[_0x9ee9('0xb1')]]:this['voiceQueues'][_0x141120[_0x9ee9('0x1ad')]()];if(!this['isSuccess'](_0x5b05a7['response'])){this[_0x9ee9('0xaf')](_0x29bc84);return this[_0x9ee9('0x1ae')](_0x141120,_0x29bc84,_0x5b05a7)[_0x9ee9('0xad')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x9ee9('0x28')][_0x5b05a7[_0x9ee9('0xeb')]]=_0x141120;}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x1af')]=function(_0x53c2e5,_0x30b4c6,_0x4b60b1){var _0x27b8e8=new History(_0x30b4c6);if(_0x27b8e8[_0x9ee9('0xef')]+_0x27b8e8[_0x9ee9('0xf0')]+_0x27b8e8[_0x9ee9('0xff')]+_0x27b8e8[_0x9ee9('0x100')]+_0x27b8e8[_0x9ee9('0x101')]+_0x27b8e8[_0x9ee9('0xf1')]+_0x27b8e8[_0x9ee9('0xed')]+_0x27b8e8[_0x9ee9('0xf2')]>=_0x4b60b1[_0x9ee9('0x1b0')]-0x1){return!![];}switch(_0x53c2e5){case 0x3:if(_0x27b8e8[_0x9ee9('0xff')]>=_0x4b60b1[_0x9ee9('0x1b1')]-0x1){return!![];}this[_0x9ee9('0xbd')]({'active':![],'countnoanswerretry':_0x27b8e8[_0x9ee9('0xff')]+=0x1,'scheduledat':moment()[_0x9ee9('0xf5')](_0x4b60b1['dialNoAnswerRetryFrequency'],'minutes')[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x27b8e8[_0x9ee9('0xd1')],'ListId':_0x27b8e8[_0x9ee9('0xd2')],'VoiceQueueId':_0x27b8e8[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1b2')));break;case 0x5:if(_0x27b8e8[_0x9ee9('0xef')]>=_0x4b60b1[_0x9ee9('0x1b3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x27b8e8[_0x9ee9('0xef')]+=0x1,'scheduledat':moment()[_0x9ee9('0xf5')](_0x4b60b1[_0x9ee9('0x1b4')],'minutes')[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x27b8e8[_0x9ee9('0xd1')],'ListId':_0x27b8e8['ListId'],'VoiceQueueId':_0x27b8e8['VoiceQueueId']||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1b5')));break;case 0x8:if(_0x27b8e8[_0x9ee9('0xf0')]>=_0x4b60b1[_0x9ee9('0x1b6')]-0x1){return!![];}this[_0x9ee9('0xbd')]({'active':![],'countcongestionretry':_0x27b8e8[_0x9ee9('0xf0')]+=0x1,'scheduledat':moment()[_0x9ee9('0xf5')](_0x4b60b1[_0x9ee9('0x1b7')],_0x9ee9('0xf6'))[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x27b8e8['ContactId'],'ListId':_0x27b8e8[_0x9ee9('0xd2')],'VoiceQueueId':_0x27b8e8['VoiceQueueId']||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})['catch'](loggerCatch(_0x9ee9('0x1b8')));break;case 0x0:if(_0x27b8e8[_0x9ee9('0x100')]>=_0x4b60b1[_0x9ee9('0x1b9')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x27b8e8['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x4b60b1['dialNoSuchNumberRetryFrequency'],'minutes')[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x27b8e8['ContactId'],'ListId':_0x27b8e8[_0x9ee9('0xd2')],'VoiceQueueId':_0x27b8e8[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x27b8e8[_0x9ee9('0x101')]>=_0x4b60b1[_0x9ee9('0x1ba')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x27b8e8[_0x9ee9('0x101')]+=0x1,'scheduledat':moment()[_0x9ee9('0xf5')](_0x4b60b1[_0x9ee9('0x120')],'minutes')[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x27b8e8[_0x9ee9('0xd1')],'ListId':_0x27b8e8[_0x9ee9('0xd2')],'VoiceQueueId':_0x27b8e8[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})['catch'](loggerCatch(_0x9ee9('0x121')));break;case 0xb:if(_0x27b8e8[_0x9ee9('0xf1')]>=_0x4b60b1[_0x9ee9('0x127')]-0x1){return!![];}this[_0x9ee9('0xbd')]({'active':![],'countabandonedretry':_0x27b8e8[_0x9ee9('0xf1')]+=0x1,'scheduledat':moment()[_0x9ee9('0xf5')](_0x4b60b1['dialAbandonedRetryFrequency'],'minutes')[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x27b8e8[_0x9ee9('0xd1')],'ListId':_0x27b8e8['ListId'],'VoiceQueueId':_0x27b8e8['VoiceQueueId']||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})['catch'](loggerCatch(_0x9ee9('0x1bb')));break;case 0x13:if(_0x27b8e8[_0x9ee9('0xed')]>=_0x4b60b1[_0x9ee9('0x104')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x27b8e8[_0x9ee9('0xed')]+=0x1,'scheduledat':moment()[_0x9ee9('0xf5')](_0x4b60b1[_0x9ee9('0x1bc')],_0x9ee9('0xf6'))[_0x9ee9('0x77')](_0x9ee9('0xf7')),'ContactId':_0x27b8e8[_0x9ee9('0xd1')],'ListId':_0x27b8e8['ListId'],'VoiceQueueId':_0x27b8e8[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xf9')));break;case 0x14:if(_0x27b8e8[_0x9ee9('0xf2')]>=_0x4b60b1[_0x9ee9('0x1bd')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x27b8e8[_0x9ee9('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x4b60b1[_0x9ee9('0x1be')],_0x9ee9('0xf6'))['format'](_0x9ee9('0xf7')),'ContactId':_0x27b8e8['ContactId'],'ListId':_0x27b8e8[_0x9ee9('0xd2')],'VoiceQueueId':_0x27b8e8[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x27b8e8[_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x1ae')]=function(_0x5abc79,_0xb8a4bc,_0x32b926){var _0x2533ff=this;var _0x4f790a=new History(_0x5abc79);var _0x1d6908=![];var _0x6f318;var _0x1bf551;return new Promise(function(_0x204105,_0x2a2895){if(_[_0x9ee9('0x40')](_0xb8a4bc)&&typeof _0xb8a4bc!==_0x9ee9('0x1bf')){return _0x2a2895(msgResponse(_0x9ee9('0x1c0'),_0x9ee9('0x14a'),_0x9ee9('0x1c1')));}if(_[_0x9ee9('0x40')](_0x32b926)&&typeof _0x32b926!==_0x9ee9('0x1bf')){return _0x2a2895(msgResponse('[callProgressDetecting]',_0x9ee9('0x14a'),'evt\x20is\x20undefine'));}_0x2533ff[_0x9ee9('0xb7')](_0x4f790a,_0x32b926[_0x9ee9('0x10e')],_0xb8a4bc)[_0x9ee9('0x3e')](function(_0x26fbba){if(_0x26fbba[_0x9ee9('0x11f')]==0x1)_0x1d6908=!![];switch(_0x32b926[_0x9ee9('0x10e')]){case'0':_0xb8a4bc[_0x9ee9('0x1c2')]+=0x1;_0x4f790a[_0x9ee9('0xe1')]=0x0;_0x4f790a[_0x9ee9('0xa7')]=_0x9ee9('0x1c3');_0x4f790a['countnosuchnumberretry']+=0x1;_0x4f790a[_0x9ee9('0xfe')]+=0x1;ami[_0x9ee9('0x4f')](_0x9ee9('0x1c4'),ut[_0x9ee9('0xe6')](_0x5abc79,'nosuchnumber'));_0x6f318=_0xb8a4bc['dialNoSuchNumberRetryFrequency'];_0x1bf551=_0xb8a4bc[_0x9ee9('0x11d')];_0x2533ff[_0x9ee9('0xca')](_0x4f790a)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0xee')));if(_0x2533ff[_0x9ee9('0x1af')](0x0,_0x5abc79,_0xb8a4bc)&&!_0x1d6908){if(_0x4f790a[_0x9ee9('0x100')]>=_0xb8a4bc[_0x9ee9('0x1b9')]){_0x2533ff[_0x9ee9('0xf3')](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1c5'));}else{_0x2533ff['stateGlobal'](_0x4f790a,_0x204105,_0x2a2895,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xb8a4bc['outboundNoAnswerCallsDay']+=0x1;_0x4f790a[_0x9ee9('0xe1')]=0x3;_0x4f790a[_0x9ee9('0xa7')]='NoAnswer';_0x4f790a['countnoanswerretry']+=0x1;_0x4f790a['countglobal']+=0x1;var _0x1d9a65=ut[_0x9ee9('0x1c6')](_0x5abc79,_0xb8a4bc);ami[_0x9ee9('0x4f')](_0x9ee9('0x1c7'),_0x1d9a65);_0x6f318=_0xb8a4bc['dialNoAnswerRetryFrequency'];_0x1bf551=_0xb8a4bc['callAdditionalPhoneAfterMin'];_0x2533ff[_0x9ee9('0xca')](_0x4f790a)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1c8')));if(_0x2533ff[_0x9ee9('0x1af')](0x3,_0x5abc79,_0xb8a4bc)&&!_0x1d6908){if(_0x4f790a[_0x9ee9('0xff')]>=_0xb8a4bc[_0x9ee9('0x1b1')]){_0x2533ff[_0x9ee9('0xf3')](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1c9'));}else{_0x2533ff[_0x9ee9('0x102')](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1c9'));}}break;case'5':_0xb8a4bc[_0x9ee9('0x1ca')]+=0x1;_0x4f790a[_0x9ee9('0xe1')]=0x5;_0x4f790a[_0x9ee9('0xa7')]=_0x9ee9('0x1cb');_0x4f790a[_0x9ee9('0xef')]+=0x1;_0x4f790a['countglobal']+=0x1;ami[_0x9ee9('0x4f')](_0x9ee9('0x1cc'),ut[_0x9ee9('0xe6')](_0x5abc79,_0x9ee9('0x1cd')));_0x6f318=_0xb8a4bc[_0x9ee9('0x1b4')];_0x1bf551=_0xb8a4bc[_0x9ee9('0x11d')];_0x2533ff[_0x9ee9('0xca')](_0x4f790a)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1ce')));if(_0x2533ff['checkRetriveMax'](0x5,_0x5abc79,_0xb8a4bc)&&!_0x1d6908){if(_0x4f790a[_0x9ee9('0xef')]>=_0xb8a4bc[_0x9ee9('0x1b3')]){_0x2533ff[_0x9ee9('0xf3')](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1cf'));}else{_0x2533ff['stateGlobal'](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1cf'));}}break;case'8':_0xb8a4bc[_0x9ee9('0x61')]+=0x1;_0x4f790a[_0x9ee9('0xe1')]=0x8;_0x4f790a[_0x9ee9('0xa7')]=_0x9ee9('0x1d0');_0x4f790a['countcongestionretry']+=0x1;_0x4f790a[_0x9ee9('0xfe')]+=0x1;_0x6f318=_0xb8a4bc[_0x9ee9('0x1b7')];_0x1bf551=_0xb8a4bc[_0x9ee9('0x11d')];ami[_0x9ee9('0x4f')](_0x9ee9('0x1d1'),ut['buildObj'](_0x5abc79,_0x9ee9('0x1d2')));_0x2533ff[_0x9ee9('0xca')](_0x4f790a)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1d3')));if(_0x2533ff['checkRetriveMax'](0x8,_0x5abc79,_0xb8a4bc)&&!_0x1d6908){if(_0x4f790a[_0x9ee9('0xf0')]>=_0xb8a4bc[_0x9ee9('0x1b6')]){_0x2533ff[_0x9ee9('0xf3')](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1d4'));}else{_0x2533ff['stateGlobal'](_0x4f790a,_0x204105,_0x2a2895,'reason\x208\x20congestion');}}break;case'11':_0xb8a4bc[_0x9ee9('0x1d5')]+=0x1;_0x4f790a['state']=0xb;_0x4f790a[_0x9ee9('0xa7')]='Abandoned';_0x4f790a['countabandonedretry']+=0x1;_0x4f790a[_0x9ee9('0xfe')]+=0x1;_0x6f318=_0xb8a4bc[_0x9ee9('0x128')];_0x1bf551=_0xb8a4bc[_0x9ee9('0x11d')];_0x2533ff[_0x9ee9('0xca')](_0x4f790a)['catch'](loggerCatch(_0x9ee9('0x129')));if(_0x2533ff['checkRetriveMax'](0xb,_0x5abc79,_0xb8a4bc)&&!_0x1d6908){if(_0x4f790a[_0x9ee9('0xf1')]>=_0xb8a4bc[_0x9ee9('0x127')]){_0x2533ff[_0x9ee9('0xf3')](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1d6'));}else{_0x2533ff[_0x9ee9('0x102')](_0x4f790a,_0x204105,_0x2a2895,'reason\x2011\x20abandoned');}}break;case'20':_0xb8a4bc['outboundRejectCallsDay']+=0x1;_0x4f790a[_0x9ee9('0xe1')]=0x14;_0x4f790a[_0x9ee9('0xa7')]='AgentReject';_0x4f790a[_0x9ee9('0xf2')]+=0x1;_0x4f790a[_0x9ee9('0xfe')]+=0x1;_0x6f318=_0xb8a4bc[_0x9ee9('0x1be')];_0x1bf551=_0xb8a4bc[_0x9ee9('0x11d')];ami['emit'](_0x9ee9('0x1d7'),ut[_0x9ee9('0xe6')](_0x5abc79,_0x9ee9('0x1d8')));_0x2533ff['createHistory'](_0x4f790a)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1d9')));if(_0x2533ff[_0x9ee9('0x1af')](0x14,_0x5abc79,_0xb8a4bc)&&!_0x1d6908){if(_0x4f790a['countagentrejectretry']>=_0xb8a4bc[_0x9ee9('0x1bd')]){_0x2533ff[_0x9ee9('0xf3')](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1da'));}else{_0x2533ff['stateGlobal'](_0x4f790a,_0x204105,_0x2a2895,_0x9ee9('0x1da'));}}break;default:_0xb8a4bc[_0x9ee9('0x64')]+=0x1;_0x4f790a['state']=0xc;_0x4f790a[_0x9ee9('0xa7')]=_0x32b926[_0x9ee9('0x10e')];_0x6f318=_0xb8a4bc[_0x9ee9('0x1be')];_0x1bf551=_0xb8a4bc[_0x9ee9('0x11d')];_0x2533ff['createHistory'](_0x4f790a)[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x1db')));if(_0x2533ff['checkRetriveMax'](_0x32b926['reason'],_0x5abc79,_0xb8a4bc)&&!_0x1d6908){if(_0x4f790a[_0x9ee9('0xef')]+_0x4f790a[_0x9ee9('0xf0')]+_0x4f790a[_0x9ee9('0xff')]+_0x4f790a['countnosuchnumberretry']+_0x4f790a[_0x9ee9('0x101')]+_0x4f790a[_0x9ee9('0xf1')]+_0x4f790a[_0x9ee9('0xed')]+_0x4f790a[_0x9ee9('0xf2')]>=_0xb8a4bc[_0x9ee9('0x1b0')]){_0x2533ff['stateGlobal'](_0x4f790a,_0x204105,_0x2a2895,_0x32b926[_0x9ee9('0x10e')]);}else{_0x2533ff[_0x9ee9('0xf3')](_0x4f790a,_0x204105,_0x2a2895,_0x32b926[_0x9ee9('0x10e')]);}}}})[_0x9ee9('0x3e')](function(){if(_0x1d6908){_0x2533ff['swapAdditionalPhones'](_0x4f790a,_0x6f318,_0x1bf551)[_0x9ee9('0x3e')](function(){return _0x204105(0x1);});}});});};Dialer[_0x9ee9('0x1c')]['stateGlobal']=function(_0x3383f1,_0x4385be,_0x290a4c,_0x16b33e){var _0x2bf444=new Final(_0x3383f1);_0x2bf444[_0x9ee9('0xe1')]=0xf;_0x2bf444[_0x9ee9('0xa7')]=_0x9ee9('0x1dc');this[_0x9ee9('0xf3')](_0x2bf444,_0x4385be,_0x290a4c,_0x16b33e);};Dialer[_0x9ee9('0x1c')][_0x9ee9('0xf3')]=function(_0x2c84bd,_0x2d858d,_0x4c026b,_0x345abd){this[_0x9ee9('0xc8')](_0x2c84bd)[_0x9ee9('0x3e')](function(){return _0x2d858d(msgResponse('[callProgressDetecting]','Success',_0x345abd));})[_0x9ee9('0xad')](function(){return _0x4c026b(msgResponse(_0x9ee9('0x1dd'),'Failure',_0x9ee9('0x1de')));});};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x8')]=function(_0x1696d7){var _0x45da32=_0x1696d7[_0x9ee9('0x1df')]/0x64;var _0x35b86d=_0x1696d7[_0x9ee9('0x119')]/(_0x1696d7['outboundDropCallsDayTimeout']+_0x1696d7[_0x9ee9('0x5f')]);var _0x4de650=Math['round'](_0x1696d7[_0x9ee9('0x1e0')]*(_0x1696d7[_0x9ee9('0x1e1')]/0x64));var _0x3e71d7=Math['round'](_0x1696d7[_0x9ee9('0x1e0')]*(_0x1696d7[_0x9ee9('0x1e2')]/0x64));var _0xf95ef3=_0x1696d7[_0x9ee9('0x53')]+_0x1696d7[_0x9ee9('0x59')];var _0x407ba1=Math['floor'](_0x1696d7['erlangCalls']*_0x1696d7['erlangAbandonmentRate']*_0x1696d7[_0x9ee9('0x6c')]*_0x1696d7[_0x9ee9('0x6d')]);if(_['isUndefined'](_0x1696d7['startProgressive'])){if(!_['isUndefined'](_0x1696d7[_0x9ee9('0x8f')])){_0x1696d7['startPredictive']=undefined;loggerPredictive[_0x9ee9('0x98')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x9ee9('0x40')](_0x1696d7[_0x9ee9('0x91')])){loggerPredictive[_0x9ee9('0x98')](_0x9ee9('0x1e3'),_0x9ee9('0x1e4'));clearInterval(_0x1696d7[_0x9ee9('0x91')]);_0x1696d7[_0x9ee9('0x91')]=undefined;}_0x1696d7[_0x9ee9('0x2a')]=moment()[_0x9ee9('0x77')](_0x9ee9('0xf7'));loggerPredictive[_0x9ee9('0x7c')](_0x1696d7[_0x9ee9('0x43')],_0x9ee9('0x1e5'),_0x1696d7['startProgressive']);this[_0x9ee9('0x161')](_0x1696d7,0x1);}else if(ifInterval(_0x1696d7[_0x9ee9('0x1e6')],_0x1696d7[_0x9ee9('0x2a')])){this[_0x9ee9('0x161')](_0x1696d7,0x1);loggerPredictiveCalls[_0x9ee9('0x7c')](_0x9ee9('0x1e7'),_0x1696d7[_0x9ee9('0x2a')],_0x1696d7[_0x9ee9('0x43')]);_0x1696d7[_0x9ee9('0x88')]=0x0;_0x1696d7[_0x9ee9('0x6b')]=0x0;}else if(_0x45da32<_0x35b86d&&_0x1696d7[_0x9ee9('0x1e8')]===_0x9ee9('0x1e9')){freeVariablesPredictive(_0x1696d7);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x1ea'),_0x9ee9('0x1eb'),_0x35b86d,_0x9ee9('0x2a'),_0x1696d7[_0x9ee9('0x43')]);}else if(_0x407ba1<_0x1696d7['predictiveIntervalErlangCallsDroppedCalls']&&_0x1696d7[_0x9ee9('0x1e8')]===_0x9ee9('0x1e9')){freeVariablesPredictive(_0x1696d7);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x1ec'),_0x9ee9('0x1ed'),_0x407ba1,'Drop\x20in\x20this\x20interval',_0x1696d7[_0x9ee9('0x6b')],'startProgressive',_0x1696d7['name']);}else if(!ifInterval(_0x1696d7[_0x9ee9('0x1e6')],_0x1696d7['startProgressive'])&&_[_0x9ee9('0x40')](_0x1696d7['startPredictive'])&&!_[_0x9ee9('0x40')](_0x1696d7[_0x9ee9('0x2a')])){_0x1696d7[_0x9ee9('0x8f')]=moment()[_0x9ee9('0x77')](_0x9ee9('0xf7'));loggerPredictive[_0x9ee9('0x7c')](_0x1696d7[_0x9ee9('0x43')],_0x9ee9('0x1ee'),_0x1696d7[_0x9ee9('0x8f')]);this['averageHandleTime'](_0x1696d7[_0x9ee9('0x1e6')])[_0x9ee9('0x3e')](this[_0x9ee9('0x1ef')](_0x1696d7))['then'](mergeDataErlangB(_0x1696d7))[_0x9ee9('0x3e')](this[_0x9ee9('0x1f0')](_0x1696d7))[_0x9ee9('0xad')](loggerCatchPredictive(_0x9ee9('0x1f1'),_0x1696d7));}else if(!ifInterval(_0x1696d7[_0x9ee9('0x1e6')],_0x1696d7['startPredictive'])){_0x1696d7['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1696d7[_0x9ee9('0x8f')]=moment()[_0x9ee9('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x1696d7['name'],'recalculate\x20predictive\x20at',_0x1696d7['startPredictive']);clearInterval(_0x1696d7[_0x9ee9('0x91')]);_0x1696d7[_0x9ee9('0x91')]=undefined;this[_0x9ee9('0x1f2')](_0x1696d7[_0x9ee9('0x1e6')])['then'](this['getDataPredictive'](_0x1696d7))[_0x9ee9('0x3e')](mergeDataErlangB(_0x1696d7))['then'](this[_0x9ee9('0x1f0')](_0x1696d7))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1696d7));}else if(_0x1696d7[_0x9ee9('0x1e0')]&&_0xf95ef3<_0x1696d7[_0x9ee9('0x1e0')]-_0x3e71d7){freeVariablesPredictive(_0x1696d7);loggerPredictive[_0x9ee9('0x7c')](_0x1696d7[_0x9ee9('0x43')],_0x9ee9('0x1f3'),_0xf95ef3,_0x9ee9('0x1f4'),_0x1696d7[_0x9ee9('0x1e0')],'-',_0x3e71d7,'=',_0x1696d7[_0x9ee9('0x1e0')]-_0x3e71d7,')');}else if(_0x1696d7['predictiveIntervalAvailable']&&_0xf95ef3>_0x1696d7[_0x9ee9('0x1e0')]+_0x4de650){freeVariablesPredictive(_0x1696d7);loggerPredictive[_0x9ee9('0x7c')](_0x1696d7[_0x9ee9('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xf95ef3,_0x9ee9('0x1f5'),_0x1696d7[_0x9ee9('0x1e0')],'+',_0x4de650,'=',_0x1696d7[_0x9ee9('0x1e0')]+_0x4de650,')');}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x1ef')]=function(_0xdd160f){var _0x40ec9c=this;return function(_0x459dde){return new Promise(function(_0x9fafb2,_0x4b9c36){_[_0x9ee9('0x8c')](_0xdd160f,_0x459dde[0x0]);if(checkGetDataPredictive(_0x459dde[0x0])){var _0x17b776=_0xdd160f[_0x9ee9('0x1e0')]=_0xdd160f[_0x9ee9('0x59')]+_0xdd160f['available'];var _0x27e168=_0xdd160f[_0x9ee9('0x1e6')]*0x3c;var _0x261e1b=_0x459dde[0x0]['predictiveIntervalAvgTalktime']+_0x459dde[0x0]['predictiveIntervalAvgHoldtime'];var _0x55aa9a=(_0x459dde[0x0]['predictiveIntervalAnsweredCalls']+_0x459dde[0x0][_0x9ee9('0x69')]+_0x459dde[0x0][_0x9ee9('0x68')])/_0x459dde[0x0][_0x9ee9('0x6f')];_0xdd160f[_0x9ee9('0x6c')]=_0x55aa9a>0x0?_0x55aa9a:0x1;switch(_0xdd160f[_0x9ee9('0x1e8')]){case'dropRate':var _0x4f5266=_0xdd160f[_0x9ee9('0x1df')]/0x64;return _0x40ec9c['abandonmentRate'](_0x17b776,_0x27e168,_0x261e1b,_0x55aa9a,_0x4f5266)[_0x9ee9('0x3e')](function(_0x5d3b23){return _0x9fafb2(_0x5d3b23);});case'agentBusyFactor':var _0x50c947=_0xdd160f[_0x9ee9('0x1df')]/0x64;return _0x40ec9c[_0x9ee9('0x1f6')](_0x17b776,_0x27e168,_0x261e1b,_0x55aa9a,_0x50c947)[_0x9ee9('0x3e')](function(_0x2f3ca1){return _0x9fafb2(_0x2f3ca1);});default:return _0x4b9c36(msgResponse('[getDataPredictive]',_0x9ee9('0x14a'),_0x9ee9('0x1f7')));}}else{return _0x4b9c36(msgResponse('[getDataPredictive]',_0x9ee9('0x14a'),_0x9ee9('0x1f8')));}});};};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x1f9')]=function(_0x22d90f){var _0x38279d=this;return function(_0x410cf2){return new Promise(function(_0x50882c,_0x1819d4){_[_0x9ee9('0x8c')](_0x22d90f,_0x410cf2[0x0]);if(checkGetDataPredictive(_0x410cf2[0x0])){loggerPredictive[_0x9ee9('0x7c')](JSON[_0x9ee9('0x4c')](_0x410cf2[0x0]));if(_0x22d90f['dialPredictiveOptimization']===_0x9ee9('0x1e9')){return _0x38279d['getVoiceQueueRtPauses'](_0x22d90f['id'])[_0x9ee9('0x3e')](function(_0x45bb3f){var _0x309233=_0x22d90f[_0x9ee9('0x54')]-_0x45bb3f[0x0]['outboundQueuePauses'];var _0x297e7c=_0x22d90f[_0x9ee9('0x1e6')]*0x3c;var _0x1f9959=_0x410cf2[0x0][_0x9ee9('0x67')]+_0x410cf2[0x0][_0x9ee9('0x66')];var _0x1f9bf7=(_0x410cf2[0x0][_0x9ee9('0x65')]+_0x410cf2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x410cf2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x410cf2[0x0][_0x9ee9('0x6f')];var _0x674fe2=_0x22d90f[_0x9ee9('0x1df')]/0x64;_0x22d90f['predictiveIntervalPauses']=_0x45bb3f[0x0]['outboundQueuePauses']||0x0;_0x22d90f[_0x9ee9('0x6c')]=_0x1f9bf7>0x0?_0x1f9bf7:0x1;return _0x38279d['abandonmentRate'](_0x309233,_0x297e7c,_0x1f9959,_0x1f9bf7,_0x674fe2);})[_0x9ee9('0x3e')](function(_0x2a5206){return _0x50882c(_0x2a5206);})['catch'](function(_0x2140fe){return _0x1819d4(msgResponse(_0x9ee9('0x1fa'),'Failure',JSON[_0x9ee9('0x4c')](_0x2140fe)));});}if(_0x22d90f[_0x9ee9('0x1e8')]==='agentBusyFactor'){return _0x38279d['getVoiceQueueRtPauses'](_0x22d90f['id'])['then'](function(_0x507106){var _0x1d8007=_0x22d90f['loggedIn']-_0x507106[0x0][_0x9ee9('0x1fb')];var _0x945b97=_0x22d90f[_0x9ee9('0x1e6')]*0x3c;var _0x33fc6b=_0x410cf2[0x0]['predictiveIntervalAvgTalktime']+_0x410cf2[0x0]['predictiveIntervalAvgHoldtime'];var _0xce139a=(_0x410cf2[0x0][_0x9ee9('0x65')]+_0x410cf2[0x0][_0x9ee9('0x69')]+_0x410cf2[0x0][_0x9ee9('0x68')])/_0x410cf2[0x0][_0x9ee9('0x6f')];var _0x5eb70b=_0x22d90f[_0x9ee9('0x1df')]/0x64;_0x22d90f[_0x9ee9('0x6e')]=_0x507106[0x0][_0x9ee9('0x1fb')]||0x0;_0x22d90f[_0x9ee9('0x6c')]=_0xce139a>0x0?_0xce139a:0x1;return _0x38279d[_0x9ee9('0x1f6')](_0x1d8007,_0x945b97,_0x33fc6b,_0xce139a,_0x5eb70b);})[_0x9ee9('0x3e')](function(_0x4a0b4d){return _0x50882c(_0x4a0b4d);})[_0x9ee9('0xad')](function(_0x3b05e1){return _0x1819d4(msgResponse(_0x9ee9('0x1fa'),_0x9ee9('0x14a'),JSON[_0x9ee9('0x4c')](_0x3b05e1)));});}}else{return _0x1819d4(msgResponse(_0x9ee9('0x1fc'),_0x9ee9('0x14a'),_0x9ee9('0x1f8')));}});};};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x1f0')]=function(_0x381424){var _0x36d17c=this;return function(){var _0x56c809=0x0;var _0x4d6c96=Math[_0x9ee9('0x1fd')](_0x381424['erlangCallToSecond']*0x3e8);if(_0x4d6c96>0x0){_0x4d6c96=_0x4d6c96<0x64?0x64:_0x4d6c96;loggerPredictive[_0x9ee9('0x7c')](_0x381424[_0x9ee9('0x43')],_0x9ee9('0x1fe'),_0x4d6c96,_0x9ee9('0x4d'));_0x381424[_0x9ee9('0x91')]=setInterval(function(){_0x36d17c[_0x9ee9('0x91')](_0x381424);loggerPredictiveCalls['info'](_0x9ee9('0x1ff'),_0x56c809+=0x1);},_0x4d6c96);}else{loggerPredictive[_0x9ee9('0x7c')](_0x381424[_0x9ee9('0x43')],_0x9ee9('0x200'));}};};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x201')]=function(_0x5e77,_0x1b4a61){var _0x581ff1=this;return function(_0xbd8ae9){if(_[_0x9ee9('0x49')](_0xbd8ae9)){if(_[_0x9ee9('0xab')](_0x1b4a61[_0x9ee9('0x202')])||!_0x1b4a61[_0x9ee9('0x203')]){if(_0x5e77[_0x9ee9('0x5c')]===_0x9ee9('0x7')){_0x5e77['queueStatusComplete']=_[_0x9ee9('0x40')](_0x5e77[_0x9ee9('0x132')])?!![]:_0x5e77['queueStatusComplete'];var _0x18be57=uuid['v4']();_0x581ff1[_0x9ee9('0x27')][_0x18be57]=new Action(_0x5e77,_0x1b4a61,_0x18be57);loggerBooked[_0x9ee9('0x7c')](_0x9ee9('0x204'),_0x18be57,'queueStatusComplete:\x20',JSON[_0x9ee9('0x4c')](_0x5e77[_0x9ee9('0x132')]),_0x9ee9('0x205'),_0x5e77['name']);if(_0x5e77[_0x9ee9('0x132')]){_0x5e77[_0x9ee9('0x132')]=![];_0x581ff1[_0x9ee9('0x2c')][_0x581ff1[_0x9ee9('0x27')][_0x18be57][_0x9ee9('0xb1')]]=[];ami[_0x9ee9('0x157')]({'actionid':_0x18be57,'action':_0x9ee9('0x206'),'queue':_0x5e77[_0x9ee9('0x43')]})[_0x9ee9('0xad')](function(){_0x581ff1['updateOriginated'](_0x5e77);_0x581ff1['rescheduleContact']({'active':![],'ContactId':_0x581ff1[_0x9ee9('0x27')][_0x18be57][_0x9ee9('0xd1')],'ListId':_0x581ff1['actions'][_0x18be57]['ListId'],'VoiceQueueId':_0x581ff1['actions'][_0x18be57][_0x9ee9('0xd3')]||undefined,'CampaignId':_0x581ff1[_0x9ee9('0x27')][_0x18be57][_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x581ff1['actions'][_0x18be57];});}else{loggerBooked[_0x9ee9('0x7c')](_0x9ee9('0x207'),JSON['stringify'](_0x5e77[_0x9ee9('0x132')]),'Queue:\x20',_0x5e77[_0x9ee9('0x43')]);_0x581ff1[_0x9ee9('0xaf')](_0x5e77);_0x581ff1['rescheduleContact']({'active':![],'ContactId':_0x581ff1[_0x9ee9('0x27')][_0x18be57][_0x9ee9('0xd1')],'ListId':_0x581ff1['actions'][_0x18be57][_0x9ee9('0xd2')],'VoiceQueueId':_0x581ff1[_0x9ee9('0x27')][_0x18be57]['VoiceQueueId']||undefined,'CampaignId':_0x581ff1[_0x9ee9('0x27')][_0x18be57][_0x9ee9('0xf8')]||undefined})[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x208')));delete _0x581ff1[_0x9ee9('0x27')][_0x18be57];}}else{return _0x581ff1['actionOriginate'](_0x5e77,_0x1b4a61);}}else{if(getDiff(_0x1b4a61['scheduledat'])<_0x5e77[_0x9ee9('0x209')]*0x3c){if(_0x1b4a61[_0x9ee9('0x168')]&&!_0x1b4a61['Agent']['voicePause']){_0x581ff1[_0x9ee9('0x21')][_0x9ee9('0x136')](_0x1b4a61['id'])[_0x9ee9('0x1f')](function(){_0x581ff1['updateOriginated'](_0x5e77);});}else{_0x581ff1[_0x9ee9('0xbf')]({'active':![]},_0x1b4a61['id'],0x1)[_0x9ee9('0x1f')](function(){_0x581ff1[_0x9ee9('0xaf')](_0x5e77);});}}else{_0x5e77[_0x9ee9('0x20a')]+=0x1;_0x581ff1[_0x9ee9('0xaf')](_0x5e77);if(_0x5e77['dialRecallInQueue']){_0x581ff1['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b4a61[_0x9ee9('0xd1')],'ListId':_0x1b4a61['ListId'],'VoiceQueueId':_0x1b4a61[_0x9ee9('0xd3')]||undefined,'CampaignId':_0x1b4a61[_0x9ee9('0xf8')]||undefined})['catch'](loggerCatch(_0x9ee9('0x20b')));_0x581ff1['createHistory'](createObjHistory(_0x5e77,_0x1b4a61,_0x9ee9('0x20c'),0x17,'RecallInQueue'))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x20d')));}else{_0x581ff1[_0x9ee9('0xe7')](createObjHistory(_0x5e77,_0x1b4a61,_0x9ee9('0x20e'),0x16,_0x9ee9('0x20f')),_0x9ee9('0x210'),_0x9ee9('0x211'));}}}}else{_0x5e77['outboundBlacklistCallsDay']+=0x1;_0x581ff1['saveInDb'](createObjHistory(_0x5e77,_0x1b4a61,_0x9ee9('0x212'),0xd,_0x9ee9('0x213')),'[Originate][historyBlacklist]',_0x9ee9('0x214'));throw'inBlackList';}};};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x16c')]=function(_0x527c8c){var _0x3ecfb8=this;var _0x21c084=_0x527c8c[_0x9ee9('0x215')]-_0x527c8c[_0x9ee9('0x70')]-_0x527c8c[_0x9ee9('0xc2')];emitCampaignSummary(_0x527c8c);if(_0x21c084>0x0){if(_0x21c084>this[_0x9ee9('0x26')]){_0x21c084=this[_0x9ee9('0x26')];}_0x527c8c[_0x9ee9('0xc2')]+=_0x21c084;this[_0x9ee9('0xc4')](_0x527c8c['id'],_0x21c084,_0x527c8c['dialOrderByScheduledAt'],_0x527c8c)[_0x9ee9('0x3e')](function(_0x2164b0){_0x527c8c[_0x9ee9('0xc2')]-=_0x21c084;_0x527c8c[_0x9ee9('0xc2')]=_0x527c8c[_0x9ee9('0xc2')]>0x0?_0x527c8c['temp']:0x0;if(!checkContactEmpty(_0x2164b0)){_0x527c8c[_0x9ee9('0x41')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x9ee9('0x216')+_0x527c8c[_0x9ee9('0x43')]);}else{_0x527c8c['originated']+=_0x2164b0[_0x9ee9('0x152')];_0x527c8c['message']=_0x9ee9('0x217');for(var _0x412f11=0x0;_0x412f11<_0x2164b0[_0x9ee9('0x152')];_0x412f11+=0x1){_0x527c8c[_0x9ee9('0x218')]+=0x1;if(_[_0x9ee9('0xab')](_0x2164b0[_0x412f11])||_[_0x9ee9('0xab')](_0x2164b0[_0x412f11][_0x9ee9('0x196')])||_[_0x9ee9('0xab')](_0x2164b0[_0x412f11][_0x9ee9('0x17e')])){_0x3ecfb8[_0x9ee9('0xcf')](_0x9ee9('0x219'),_0x527c8c,_0x2164b0[_0x412f11]);}else{_0x3ecfb8[_0x9ee9('0xba')](_[_0x9ee9('0x130')](_0x2164b0[_0x412f11],[_0x9ee9('0xf8'),_0x9ee9('0x17e')]))[_0x9ee9('0x3e')](_0x3ecfb8[_0x9ee9('0x201')](_0x527c8c,_0x2164b0[_0x412f11]))['catch'](_0x3ecfb8[_0x9ee9('0xce')](_0x9ee9('0x21a'),_0x527c8c));}}}})[_0x9ee9('0xad')](loggerGetContactDialer(_0x9ee9('0x21b'),_0x527c8c,_0x21c084));}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x161')]=function(_0x2aa14d,_0x3c3003){var _0x43ebce=this;var _0x3f368=[];var _0x1fcd3a=_0x3c3003>=0x1?_0x3c3003:0x1;if(_0x2aa14d['dialMethod']==='booked'){_0x1fcd3a=0x1;}var _0x2ccd38=Math['floor'](_0x2aa14d[_0x9ee9('0x53')]*_0x1fcd3a)-_0x2aa14d[_0x9ee9('0x70')]-_0x2aa14d[_0x9ee9('0xc2')];emitVoiceQueueSummary(_0x2aa14d);if(_0x2aa14d['dialLimitQueue']>0x0){var _0x309be2=_0x2aa14d[_0x9ee9('0x21c')]-_0x2aa14d[_0x9ee9('0x70')]-_0x2aa14d['talking']-_0x2aa14d[_0x9ee9('0xc2')]-_0x2aa14d[_0x9ee9('0x55')];if(_0x2ccd38>_0x309be2){_0x2ccd38=_0x309be2;}}if(_0x2ccd38>0x0){if(_0x2aa14d[_0x9ee9('0x5c')]===_0x9ee9('0x7')){_0x2ccd38=0x1;}if(_0x2ccd38>this['maxNumberOriginate']){_0x2ccd38=this[_0x9ee9('0x26')];}_0x2aa14d['temp']+=_0x2ccd38;for(var _0x578f5b in this[_0x9ee9('0x24')]){if(typeof this[_0x9ee9('0x24')][_0x578f5b]!==_0x9ee9('0x9a')){if(this[_0x9ee9('0x24')][_0x578f5b][_0x9ee9('0xe1')]==='not_inuse'&&this[_0x9ee9('0x24')][_0x578f5b][_0x9ee9('0xac')]==='reachable'){_0x3f368[_0x9ee9('0x153')](this[_0x9ee9('0x24')][_0x578f5b]['id']);}}}this[_0x9ee9('0xc1')](_0x2aa14d['id'],_0x3f368,_0x2ccd38,_0x2aa14d[_0x9ee9('0x21d')],_0x2aa14d)[_0x9ee9('0x3e')](function(_0x6d1a30){_0x2aa14d['temp']-=_0x2ccd38;_0x2aa14d[_0x9ee9('0xc2')]=_0x2aa14d['temp']>0x0?_0x2aa14d[_0x9ee9('0xc2')]:0x0;if(!checkContactEmpty(_0x6d1a30)){_0x43ebce['countReScheduled'](_0x2aa14d)[_0x9ee9('0x3e')](sendMessageReschedule(_0x2aa14d))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x21e')));}else{_0x2aa14d[_0x9ee9('0x70')]+=_0x6d1a30[_0x9ee9('0x152')];_0x2aa14d[_0x9ee9('0x41')]=_0x2aa14d[_0x9ee9('0x5c')]===_0x9ee9('0x7')?_0x9ee9('0x185'):_0x9ee9('0x217');for(var _0x544ebb=0x0;_0x544ebb<_0x6d1a30[_0x9ee9('0x152')];_0x544ebb+=0x1){if(_[_0x9ee9('0xab')](_0x6d1a30[_0x544ebb])||_[_0x9ee9('0xab')](_0x6d1a30[_0x544ebb][_0x9ee9('0x196')])||_['isNil'](_0x6d1a30[_0x544ebb][_0x9ee9('0x17e')])){_0x43ebce[_0x9ee9('0xcf')](_0x9ee9('0x219'),_0x2aa14d,_0x6d1a30[_0x544ebb]);}else{_0x43ebce[_0x9ee9('0xb4')](_[_0x9ee9('0x130')](_0x6d1a30[_0x544ebb],['VoiceQueueId','phone']))[_0x9ee9('0x3e')](_0x43ebce['checkContactBlack'](_0x2aa14d,_0x6d1a30[_0x544ebb]))['catch'](_0x43ebce[_0x9ee9('0xce')](_0x9ee9('0x219'),_0x2aa14d));}}}})[_0x9ee9('0xad')](loggerGetContactDialer(_0x9ee9('0x21f'),_0x2aa14d,_0x2ccd38));}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x91')]=function(_0x293bb1){if(_0x293bb1[_0x9ee9('0x21c')]>0x0){var _0x1aa1ef=_0x293bb1[_0x9ee9('0x21c')]-_0x293bb1[_0x9ee9('0x70')]-_0x293bb1[_0x9ee9('0x59')];if(_0x1aa1ef>0x0){this[_0x9ee9('0x220')](_0x293bb1);}else{loggerPredictiveCalls['info'](_0x9ee9('0x221'));}}else{this['tryOriginatePredictive'](_0x293bb1);}};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x220')]=function(_0x435aa9){var _0x398e16=this;var _0x1a3a72=[];_0x435aa9[_0x9ee9('0x70')]+=0x1;for(var _0xa44fa6 in this['agents']){if(typeof this[_0x9ee9('0x24')][_0xa44fa6]!==_0x9ee9('0x9a')){if(this[_0x9ee9('0x24')][_0xa44fa6][_0x9ee9('0xe1')]===_0x9ee9('0x222')&&this[_0x9ee9('0x24')][_0xa44fa6][_0x9ee9('0xac')]===_0x9ee9('0xd8')){_0x1a3a72['push'](this[_0x9ee9('0x24')][_0xa44fa6]['id']);}}}this[_0x9ee9('0xc1')](_0x435aa9['id'],_0x1a3a72,0x1,_0x435aa9[_0x9ee9('0x21d')],_0x435aa9)[_0x9ee9('0x3e')](function(_0x2e50f){if(!checkContactEmpty(_0x2e50f)){checkContactLowerLimitOriginate(_0x435aa9,0x1,0x0);_0x398e16['countReScheduled'](_0x435aa9)['then'](sendMessageReschedule(_0x435aa9))[_0x9ee9('0xad')](loggerCatch(_0x9ee9('0x21e')));}else{_0x435aa9[_0x9ee9('0x41')]=_0x9ee9('0x217');if(_[_0x9ee9('0xab')](_0x2e50f[0x0])||_[_0x9ee9('0xab')](_0x2e50f[0x0][_0x9ee9('0x196')])||_[_0x9ee9('0xab')](_0x2e50f[0x0]['phone'])){_0x398e16[_0x9ee9('0xcf')](_0x9ee9('0x219'),_0x435aa9,_0x2e50f[0x0]);}else{_0x398e16[_0x9ee9('0xb4')](_[_0x9ee9('0x130')](_0x2e50f[0x0],[_0x9ee9('0xd3'),_0x9ee9('0x17e')]))[_0x9ee9('0x3e')](_0x398e16[_0x9ee9('0x201')](_0x435aa9,_0x2e50f[0x0]))[_0x9ee9('0xad')](_0x398e16['loggerHandler'](_0x9ee9('0x223'),_0x435aa9));}}})[_0x9ee9('0xad')](loggerGetContactDialer(_0x9ee9('0x224'),_0x435aa9,0x1));emitVoiceQueueSummary(_0x435aa9);};Dialer[_0x9ee9('0x1c')]['abandonmentRate']=function(_0x2146bb,_0xe50f55,_0x145657,_0x3499a9,_0x673269,_0x4f93fa){loggerPredictive['info'](_0x9ee9('0x225'));loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x226'),_0x2146bb);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x227'),_0xe50f55);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x228'),_0x145657);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x229'),_0x3499a9);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x22a'),_0x673269);loggerPredictive[_0x9ee9('0x7c')]('---------------------------');return new Promise(function(_0x49517e,_0xf7c497){if(_0x2146bb<=0x0||isNaN(_0x2146bb)){return _0xf7c497(msgResponse(_0x9ee9('0x22b'),_0x9ee9('0x4b'),_0x9ee9('0x22c')+_0x2146bb));}if(_0x145657<=0x0||isNaN(_0x145657)){return _0xf7c497(msgResponse(_0x9ee9('0x22b'),_0x9ee9('0x4b'),_0x9ee9('0x22d')+_0x145657));}if(_0x3499a9<=0x0||isNaN(_0x3499a9)){return _0xf7c497(msgResponse(_0x9ee9('0x22b'),_0x9ee9('0x4b'),'p\x20=\x20'+_0x3499a9));}if(_0xe50f55<=0x0||isNaN(_0xe50f55)){return _0xf7c497(msgResponse(_0x9ee9('0x22b'),_0x9ee9('0x4b'),'interval\x20=\x20'+_0xe50f55));}if(_0x673269<=0x0||isNaN(_0x673269)){return _0xf7c497(msgResponse('[abandonmentRate]','Error',_0x9ee9('0x22e')+_0x673269));}_0x4f93fa=_0x4f93fa||0x0;var _0x175e56=0x1/_0x145657;var _0xde459d=0x0;var _0x42664f=0x0;var _0x10ad65=0x0;var _0x4d26e1=0x0;for(var _0x180c27=0x0;_0x10ad65<_0x673269;_0x180c27+=0x1){_0x42664f=_0x180c27/_0xe50f55;_0xde459d=(_0x3499a9*_0x42664f+_0x4f93fa)/_0x175e56;_0x10ad65=erlangb(_0xde459d,_0x2146bb);_0x4d26e1=_0xde459d/_0x2146bb*(0x1-erlangb(_0xde459d,_0x2146bb));}return _0x49517e({'erlangCalls':_0x180c27,'erlangCallToSecond':_0xe50f55/_0x180c27,'erlangAbandonmentRate':_0x10ad65,'erlangBusyFactor':_0x4d26e1});});};Dialer[_0x9ee9('0x1c')][_0x9ee9('0x1f6')]=function(_0x5452e0,_0x4fcb49,_0x37ab72,_0x38548f,_0x113c51,_0x5e027b){loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x22f'));loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x226'),_0x5452e0);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x227'),_0x4fcb49);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',_0x37ab72);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x229'),_0x38548f);loggerPredictive[_0x9ee9('0x7c')](_0x9ee9('0x230'),_0x113c51);loggerPredictive['info'](_0x9ee9('0x82'));return new Promise(function(_0x21b9a7,_0x4750d7){if(_0x5452e0<=0x0||isNaN(_0x5452e0)){return _0x4750d7(msgResponse(_0x9ee9('0x231'),_0x9ee9('0x4b'),_0x9ee9('0x22c')+_0x5452e0));}if(_0x37ab72<=0x0||isNaN(_0x37ab72)){return _0x4750d7(msgResponse(_0x9ee9('0x231'),_0x9ee9('0x4b'),_0x9ee9('0x22d')+_0x37ab72));}if(_0x38548f<=0x0||isNaN(_0x38548f)){return _0x4750d7(msgResponse(_0x9ee9('0x231'),_0x9ee9('0x4b'),_0x9ee9('0x232')+_0x38548f));}if(_0x4fcb49<=0x0||isNaN(_0x4fcb49)){return _0x4750d7(msgResponse('[busyFactor]','Error',_0x9ee9('0x233')+_0x4fcb49));}if(_0x113c51<=0x0||isNaN(_0x113c51)){return _0x4750d7(msgResponse('[busyFactor]',_0x9ee9('0x4b'),'Umin\x20=\x20'+_0x113c51));}_0x5e027b=_0x5e027b||0x0;var _0x34ed4b=0x1/_0x37ab72;var _0x17368b=0x0;var _0xf4826a=0x0;var _0x537f73=0x0;var _0xa5412f=0x0;for(var _0x41ef13=0x0;_0xa5412f<_0x113c51;_0x41ef13+=0x1){_0xf4826a=_0x41ef13/_0x4fcb49;_0x17368b=(_0x38548f*_0xf4826a+_0x5e027b)/_0x34ed4b;_0x537f73=erlangb(_0x17368b,_0x5452e0);_0xa5412f=_0x17368b/_0x5452e0*(0x1-erlangb(_0x17368b,_0x5452e0));}return _0x21b9a7({'erlangCalls':_0x41ef13,'erlangCallToSecond':_0x4fcb49/_0x41ef13,'erlangAbandonmentRate':_0x537f73,'erlangBusyFactor':_0xa5412f});});};module[_0x9ee9('0x234')]=Dialer; \ No newline at end of file +var _0xa7dd=['[rescheduleContact][Abandoned]','syncNewExten','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','filter','online','handlePreviewRecallNotifications','user:%s','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','getCaller','ACTIVE','xcally-motion-dialer','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','outbound','XMD-VOICEQUEUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originate','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAbandonedMaxRetry','countabandonedretry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','dialRecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','floor','dialLimitQueue','not_inuse','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20NOT\x20Active','INTERVAL_IS_NULL','Interval','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','seconds','emit','type','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\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','---------------------------','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','prototype','loopClearZombieChannels','[uniqueid]','[actions]','clearZombieChannels','undefined','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','HANGUP','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x2019\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','campaigns','HangupInAMD','[syncHangupInAMDIvr]','countbusyretry','countnoanswerretry','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','Unknow','syncAgentComplete','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','dialAbandonedRetryFrequency'];(function(_0x3a2d75,_0x3fc383){var _0x1dcb6b=function(_0xe6c255){while(--_0xe6c255){_0x3a2d75['push'](_0x3a2d75['shift']());}};_0x1dcb6b(++_0x3fc383);}(_0xa7dd,0xf9));var _0xda7d=function(_0x4d333f,_0x2ae8a9){_0x4d333f=_0x4d333f-0x0;var _0x239871=_0xa7dd[_0x4d333f];return _0x239871;};'use strict';var util=require(_0xda7d('0x0'));var _=require(_0xda7d('0x1'));var uuid=require(_0xda7d('0x2'));var moment=require(_0xda7d('0x3'));var rr=require('rr');var md5=require(_0xda7d('0x4'));var Redis=require(_0xda7d('0x5'));var ut=require(_0xda7d('0x6'));var config=require('../../../config/environment/');var logger=require(_0xda7d('0x7'))(_0xda7d('0x8'));var loggerBooked=require(_0xda7d('0x7'))(_0xda7d('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0xda7d('0xa'));var loggerSyncQueueSummary=require(_0xda7d('0x7'))(_0xda7d('0xb'));var ami=require(_0xda7d('0xc'));config['redis']=_[_0xda7d('0xd')](config[_0xda7d('0xe')],{'host':_0xda7d('0xf'),'port':0x18eb});var io=require(_0xda7d('0x10'))(new Redis(config[_0xda7d('0xe')]));var cmHopper=require(_0xda7d('0x11'));var cmHopperHistory=require(_0xda7d('0x12'));var cmHopperAdditionalPhone=require(_0xda7d('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xda7d('0x14'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0xda7d('0x15'));var Final=require('./final');var AgentComplete=require(_0xda7d('0x16'));var QueueCallerAbandon=require(_0xda7d('0x17'));var Hangup=require(_0xda7d('0x18'));var ipAgi=process[_0xda7d('0x19')][_0xda7d('0x1a')]||_0xda7d('0x1b');var strategy={'rrmemory':_0xda7d('0x1c'),'roundrobin':_0xda7d('0x1d')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xda7d('0x1e')]=function(_0x4d2e02){this[_0xda7d('0x1f')]=this[_0xda7d('0x1f')]?this[_0xda7d('0x1f')][_0xda7d('0x20')](_0x4d2e02):_0x4d2e02();};function Dialer(_0x3917ab,_0x16d8b6){this[_0xda7d('0x21')]=new Sequence();this[_0xda7d('0x22')]=_0x16d8b6;this[_0xda7d('0x23')]=_0x3917ab[_0xda7d('0x23')];this['campaigns']=_0x3917ab['campaigns'];this['agents']=_0x3917ab[_0xda7d('0x24')];this[_0xda7d('0x25')]=_0x3917ab[_0xda7d('0x25')];this[_0xda7d('0x26')]=config[_0xda7d('0x26')]||0x2;this[_0xda7d('0x27')]={};this[_0xda7d('0x28')]={};this[_0xda7d('0x29')]={};this[_0xda7d('0x2a')]={};this['optionPredictive']={};this[_0xda7d('0x2b')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xda7d('0x2c')]={};this[_0xda7d('0x2d')]={};ami['on'](_0xda7d('0x2e'),this[_0xda7d('0x2f')]['bind'](this));ami['on'](_0xda7d('0x30'),this[_0xda7d('0x31')]['bind'](this));ami['on'](_0xda7d('0x32'),this[_0xda7d('0x33')][_0xda7d('0x34')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xda7d('0x34')](this));ami['on'](_0xda7d('0x35'),this['syncQueueSummary'][_0xda7d('0x34')](this));ami['on'](_0xda7d('0x36'),this[_0xda7d('0x37')][_0xda7d('0x34')](this));ami['on'](_0xda7d('0x38'),this[_0xda7d('0x39')]['bind'](this));ami['on'](_0xda7d('0x3a'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xda7d('0x3b')]['bind'](this));ami['on'](_0xda7d('0x3c'),this[_0xda7d('0x3d')][_0xda7d('0x34')](this));ami['on'](_0xda7d('0x3e'),this[_0xda7d('0x3f')][_0xda7d('0x34')](this));this[_0xda7d('0x40')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0xda7d('0x41')](function(_0x5c516d){previewRecallmeReminderInterval=_0x5c516d[_0xda7d('0x42')];});}function isNotNull(_0x54e9be){return _0x54e9be!==null&&!_[_0xda7d('0x43')](_0x54e9be);}function checkIsLoggedIn(_0x5bdd61,_0x3e8506){return function(){if(_0x3e8506<=0x0){_0x5bdd61[_0xda7d('0x44')]=_0xda7d('0x45');throw _0x5bdd61[_0xda7d('0x46')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x5164af){return _0x5164af;}function checkIsActive(_0x7655c6,_0x366878){return function(){if(!isActive(_0x366878)){_0x7655c6[_0xda7d('0x44')]='NOT_ACTIVE';throw _0x7655c6[_0xda7d('0x46')]+_0xda7d('0x47');}};}function checkInterval(_0x1eaa3c){return function(){if(!isNotNull(_0x1eaa3c['Interval'])){_0x1eaa3c[_0xda7d('0x44')]=_0xda7d('0x48');throw _0x1eaa3c[_0xda7d('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1eaa3c[_0xda7d('0x49')]['Intervals'])){_0x1eaa3c[_0xda7d('0x44')]=_0xda7d('0x48');throw _0x1eaa3c[_0xda7d('0x46')]+_0xda7d('0x4a');}if(!isNotNull(_['isEmpty'](_0x1eaa3c['Interval'][_0xda7d('0x4b')]))){_0x1eaa3c[_0xda7d('0x44')]=_0xda7d('0x48');throw _0x1eaa3c['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4f901b,_0xd256e4,_0x3ed79d){return{'action':_0x4f901b,'response':_0xd256e4,'message':_0x3ed79d,'stack':_0x3ed79d};}function myreject(_0x399619){return function(_0x280708){return _0x399619(msgResponse('[ifTime][Action]',_0xda7d('0x4c'),JSON[_0xda7d('0x4d')](_0x280708)));};}function getSeconds(_0x59bfc5,_0x3f34c6){var _0xa7fbaa=moment(_0x59bfc5)[_0xda7d('0x4e')](0x0);var _0x182f38=moment(_0x3f34c6)[_0xda7d('0x4e')](0x0);return _0xa7fbaa['diff'](_0x182f38,_0xda7d('0x4f'));}function emit(_0x74e3c5,_0x43988a,_0x2029b1){io['to'](_0x74e3c5)[_0xda7d('0x50')](_0x43988a,_0x2029b1);}function emitVoiceQueueSummary(_0x1da42b){if(_0x1da42b[_0xda7d('0x51')]==='outbound'){var _0x3ba9ca={'id':_0x1da42b['id'],'name':_0x1da42b[_0xda7d('0x46')],'strategy':_0x1da42b[_0xda7d('0x52')],'answered':_0x1da42b[_0xda7d('0x53')],'available':_0x1da42b[_0xda7d('0x54')],'loggedIn':_0x1da42b[_0xda7d('0x55')],'pTalking':_0x1da42b[_0xda7d('0x56')],'sumBillable':_0x1da42b['sumBillable'],'sumDuration':_0x1da42b[_0xda7d('0x57')],'sumHoldTime':_0x1da42b[_0xda7d('0x58')]||0x0,'talking':_0x1da42b[_0xda7d('0x59')],'total':_0x1da42b[_0xda7d('0x5a')],'type':_0x1da42b[_0xda7d('0x51')],'unmanaged':_0x1da42b[_0xda7d('0x5b')],'abandoned':_0x1da42b[_0xda7d('0x5c')],'waiting':_0x1da42b[_0xda7d('0x5d')],'loggedInDb':_0x1da42b[_0xda7d('0x5e')],'dialActive':_0x1da42b[_0xda7d('0x5f')],'dialMethod':_0x1da42b[_0xda7d('0x60')],'dialOriginateCallerIdName':_0x1da42b[_0xda7d('0x61')],'dialOriginateCallerIdNumber':_0x1da42b[_0xda7d('0x62')],'dialOriginateTimeout':_0x1da42b['dialOriginateTimeout'],'dialPrefix':_0x1da42b['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1da42b[_0xda7d('0x63')],'outboundAnswerCallsDay':_0x1da42b[_0xda7d('0x64')],'outboundBlacklistCallsDay':_0x1da42b['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1da42b['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1da42b['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1da42b[_0xda7d('0x65')],'outboundDropCallsDayCallersExit':_0x1da42b[_0xda7d('0x66')],'outboundDropCallsDayTimeout':_0x1da42b[_0xda7d('0x67')],'outboundNoAnswerCallsDay':_0x1da42b['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1da42b[_0xda7d('0x68')],'outboundOriginateFailureCallsDay':_0x1da42b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1da42b[_0xda7d('0x69')],'outboundRejectCallsDay':_0x1da42b[_0xda7d('0x6a')],'outboundUnknownCallsDay':_0x1da42b[_0xda7d('0x6b')],'predictiveIntervalAnsweredCalls':_0x1da42b[_0xda7d('0x6c')],'predictiveIntervalAvgHoldtime':_0x1da42b[_0xda7d('0x6d')],'predictiveIntervalAvgTalktime':_0x1da42b['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1da42b[_0xda7d('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x1da42b[_0xda7d('0x6f')],'predictiveIntervalErlangCalls':_0x1da42b['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1da42b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1da42b[_0xda7d('0x70')],'predictiveIntervalMultiplicativeFactor':_0x1da42b[_0xda7d('0x71')],'predictiveIntervalPauses':_0x1da42b[_0xda7d('0x72')],'predictiveIntervalAvailable':_0x1da42b[_0xda7d('0x73')],'predictiveIntervalTotalCalls':_0x1da42b['predictiveIntervalTotalCalls'],'message':_0x1da42b[_0xda7d('0x44')],'originated':_0x1da42b['originated'],'erlangCalls':_0x1da42b[_0xda7d('0x74')],'erlangCallToSecond':_0x1da42b[_0xda7d('0x75')],'erlangAbandonmentRate':_0x1da42b['erlangAbandonmentRate'],'erlangBusyFactor':_0x1da42b[_0xda7d('0x76')],'startPredictive':_0x1da42b[_0xda7d('0x2b')],'startProgressive':_0x1da42b['startProgressive']};if(_0x1da42b[_0xda7d('0x77')]){_0x3ba9ca[_0xda7d('0x77')]={'id':_0x1da42b[_0xda7d('0x77')]['id'],'name':_0x1da42b[_0xda7d('0x77')][_0xda7d('0x46')],'active':_0x1da42b[_0xda7d('0x77')][_0xda7d('0x78')],'callerid':_0x1da42b[_0xda7d('0x77')][_0xda7d('0x79')]};}if(_0x1da42b['Interval']){_0x3ba9ca[_0xda7d('0x49')]={'id':_0x1da42b['Interval']['id'],'name':_0x1da42b['Interval']['name']};}var _0x69948f=md5(JSON['stringify'](_0x3ba9ca));if(_0x1da42b[_0xda7d('0x4')]!==_0x69948f){_0x1da42b[_0xda7d('0x4')]=_0x69948f;emit(util[_0xda7d('0x7a')](_0xda7d('0x7b'),_0x3ba9ca[_0xda7d('0x46')]),_0xda7d('0x7c'),_0x3ba9ca);}}}function emitCampaignSummary(_0x2634e3){if(_0x2634e3[_0xda7d('0x51')]===_0xda7d('0x7d')){emit(util[_0xda7d('0x7a')]('campaign:ivr:%s',_0x2634e3[_0xda7d('0x46')]),_0xda7d('0x7e'),_0x2634e3);}}function checkGetDataPredictive(_0xdf9a57){if(isNotNull(_0xdf9a57)&&!_[_0xda7d('0x7f')](_0xdf9a57)){loggerPredictive[_0xda7d('0x80')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0xda7d('0x81'),_0xdf9a57['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0xda7d('0x82'),_0xdf9a57[_0xda7d('0x6c')]);loggerPredictive[_0xda7d('0x80')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xdf9a57[_0xda7d('0x6f')]);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x83'),_0xdf9a57[_0xda7d('0x6e')]);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x84'),_0xdf9a57[_0xda7d('0x6d')]);loggerPredictive[_0xda7d('0x80')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xdf9a57['predictiveIntervalAvgTalktime']);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x85'));if(_0xdf9a57[_0xda7d('0x86')]>0x0){if(!_[_0xda7d('0x43')](_0xdf9a57[_0xda7d('0x87')])&&_0xdf9a57[_0xda7d('0x87')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0xdf9a57[_0xda7d('0x6d')])&&_0xdf9a57['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xda7d('0x80')](_0xda7d('0x88'));}else{loggerPredictive[_0xda7d('0x80')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x42fbb6){return function(_0x574a2f){loggerPredictive[_0xda7d('0x80')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xda7d('0x80')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x574a2f[_0xda7d('0x74')]);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x89'),_0x574a2f[_0xda7d('0x75')]);loggerPredictive['info'](_0xda7d('0x8a'),_0x574a2f[_0xda7d('0x8b')]);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x8c'),_0x574a2f[_0xda7d('0x76')]);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x8a'),_0x574a2f[_0xda7d('0x8b')]);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x85'));_[_0xda7d('0x8d')](_0x42fbb6,_0x574a2f);};}function getDiff(_0x5bdef5){var _0x31d334=moment()['milliseconds'](0x0);var _0x22bb7c=moment(_0x5bdef5)[_0xda7d('0x4e')](0x0);return _0x31d334['diff'](_0x22bb7c,'seconds');}function ifInterval(_0x2ce977,_0xfe5b66){if(_['isUndefined'](_0xfe5b66)){return![];}return getDiff(_0xfe5b66)<_0x2ce977*0x3c;}function freeVariablesPredictive(_0x2107a8){if(isNotNull(_0x2107a8)){if(!_['isUndefined'](_0x2107a8['startProgressive'])){_0x2107a8[_0xda7d('0x8e')]=undefined;loggerPredictive['info'](_0x2107a8[_0xda7d('0x46')],_0xda7d('0x8f'));}if(!_['isUndefined'](_0x2107a8[_0xda7d('0x2b')])){_0x2107a8[_0xda7d('0x2b')]=undefined;loggerPredictive[_0xda7d('0x80')](_0x2107a8[_0xda7d('0x46')],_0xda7d('0x90'));}if(!_[_0xda7d('0x43')](_0x2107a8[_0xda7d('0x91')])){clearInterval(_0x2107a8['handlePredictive']);_0x2107a8[_0xda7d('0x91')]=undefined;loggerPredictive[_0xda7d('0x80')](_0x2107a8[_0xda7d('0x46')],_0xda7d('0x92'));}}}function erlangb(_0x4e12cd,_0x1703a1){if(_0x1703a1===0x0){return 0x0;}var _0x1cc61d=0x1;for(var _0x530ed7=0x1;_0x530ed7<=_0x1703a1;_0x530ed7+=0x1){_0x1cc61d=0x1+_0x1cc61d*_0x530ed7/_0x4e12cd;}return 0x1/_0x1cc61d;}function isVoiceQueueOutbound(_0x1f6b91){return _0x1f6b91==='outbound';}function isNotPreview(_0xc596c4){return _0xc596c4!==_0xda7d('0x22');}function isCampaignIvr(_0x32dcfb){return _0x32dcfb===_0xda7d('0x7d');}function getCallerId(_0x40e265,_0x163c62,_0x12ca47){if(!_['isUndefined'](_0x12ca47)&&typeof _0x12ca47===_0xda7d('0x93')&&!_[_0xda7d('0x7f')](_0x12ca47)){if(!_[_0xda7d('0x43')](_0x163c62)&&typeof _0x163c62===_0xda7d('0x93')&&!_['isEmpty'](_0x163c62)){return util[_0xda7d('0x7a')](_0xda7d('0x94'),_0x163c62,_0x12ca47);}return util['format'](_0xda7d('0x94'),_0x12ca47,_0x12ca47);}if(!_[_0xda7d('0x43')](_0x40e265)&&typeof _0x40e265==='string'&&!_[_0xda7d('0x7f')](_0x40e265)){return _0x40e265;}return _0xda7d('0x95');}function loggerCatchQueueSummary(_0x396fb6,_0x131f56){return function(_0x13334c){freeVariablesPredictive(_0x131f56);emitVoiceQueueSummary(_0x131f56);emitCampaignSummary(_0x131f56);loggerSyncQueueSummary[_0xda7d('0x96')](_0x396fb6,util[_0xda7d('0x97')](_0x13334c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x43304a,_0x127350){return function(_0x45fd5b){loggerPredictive[_0xda7d('0x98')](_0x127350[_0xda7d('0x46')],_0x43304a);loggerPredictive['error'](_0x45fd5b[_0xda7d('0x99')]);freeVariablesPredictive(_0x127350);};}function loggerCatch(_0x47eb4a){return function(_0x32409a){logger[_0xda7d('0x98')](_0x47eb4a,util[_0xda7d('0x97')](_0x32409a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4b4532){return _0x4b4532&&!_[_0xda7d('0x43')](_0x4b4532)&&_0x4b4532[_0xda7d('0x9a')]>0x0;}function decremetOriginate(_0x299db7){if(!_[_0xda7d('0x43')](_0x299db7)&&_0x299db7!==null){if(typeof _0x299db7[_0xda7d('0x9b')]!=='undefined'){if(_0x299db7[_0xda7d('0x9b')]>0x0){_0x299db7[_0xda7d('0x9b')]-=0x1;}else{logger[_0xda7d('0x98')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xda7d('0x98')](_0xda7d('0x9c'));}}function checkContactLowerLimitOriginate(_0x426e9a,_0x50c79a,_0x50a65f){if(_0x50c79a>_0x50a65f){for(var _0x50ea57=0x0;_0x50ea57<_0x50c79a-_0x50a65f;_0x50ea57+=0x1){decremetOriginate(_0x426e9a);}}}function loggerGetContactDialer(_0xcb57eb,_0x5c3e9c,_0x3cdb89){return function(_0x1920fe){checkContactLowerLimitOriginate(_0x5c3e9c,_0x3cdb89,0x0);logger[_0xda7d('0x98')](_0xcb57eb,util[_0xda7d('0x97')](_0x1920fe,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x12bd9f){return function(_0x23614d){if(isNotNull(_0x23614d)&&isNotNull(_0x23614d[0x0])){if(_0x23614d[0x0][_0xda7d('0x9d')]>0x0){_0x12bd9f['message']='RESCHEDULED_CONTACTS';logger[_0xda7d('0x80')](_0xda7d('0x9e')+_0x12bd9f[_0xda7d('0x46')],_0x23614d[0x0][_0xda7d('0x9d')],_0xda7d('0x9f'));}else{_0x12bd9f[_0xda7d('0x44')]=_0xda7d('0xa0');logger[_0xda7d('0x80')]('[getContactDialer2][Empty]'+_0x12bd9f[_0xda7d('0x46')]);}}};}function notSendMessagesQueue(_0x1f0507){if(_0x1f0507['sendMessageOneNotActive']){freeVariablesPredictive(_0x1f0507);if(_0x1f0507[_0xda7d('0x9b')]===0x0&&_0x1f0507[_0xda7d('0x59')]===0x0&&_0x1f0507[_0xda7d('0x5d')]===0x0&&(_0x1f0507[_0xda7d('0x56')]||0x0)===0x0){_0x1f0507[_0xda7d('0xa1')]=![];_0x1f0507[_0xda7d('0x54')]=0x0;_0x1f0507[_0xda7d('0x44')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xda7d('0x96')](_0xda7d('0xa2'),_0x1f0507[_0xda7d('0x46')],_0xda7d('0xa3'));}else{_0x1f0507[_0xda7d('0x44')]=_0xda7d('0xa4');loggerSyncQueueSummary[_0xda7d('0x96')](_0xda7d('0xa2'),_0x1f0507['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x1f0507);}}function notSendMessagesCampaign(_0x1dee09){if(_0x1dee09[_0xda7d('0xa1')]){if(_0x1dee09[_0xda7d('0x9b')]===0x0){_0x1dee09[_0xda7d('0xa1')]=![];_0x1dee09['message']=_0xda7d('0xa5');loggerSyncQueueSummary[_0xda7d('0x96')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1dee09[_0xda7d('0x46')],_0xda7d('0xa3'));}else{_0x1dee09[_0xda7d('0x44')]=_0xda7d('0xa4');loggerSyncQueueSummary[_0xda7d('0x96')](_0xda7d('0xa6'),_0x1dee09['name'],'is\x20disactive');}emitCampaignSummary(_0x1dee09);}}function createObjHistory(_0x493b88,_0x476ba8,_0x120b48,_0x18a60b,_0x2081eb){_0x493b88[_0xda7d('0x44')]=_0x120b48;var _0x55a892=new Action(_0x493b88,_0x476ba8);var _0x1f1702=new History(_0x55a892);_0x1f1702[_0xda7d('0xa7')]=_0x18a60b;_0x1f1702[_0xda7d('0xa8')]=_0x2081eb;_0x1f1702[_0xda7d('0xa9')]=_0x55a892['starttime'];return _0x1f1702;}Dialer[_0xda7d('0xaa')][_0xda7d('0xab')]=function(){var _0x3ccc6b=this;setInterval(function(){_0x3ccc6b['clearZombieChannels'](_0x3ccc6b['uniqueId'],_0xda7d('0xac'));_0x3ccc6b['clearZombieChannels'](_0x3ccc6b[_0xda7d('0x28')],_0xda7d('0xad'));},0x32c8);};Dialer[_0xda7d('0xaa')][_0xda7d('0xae')]=function(_0xa7b21b,_0x571c94){var _0x54d326=this;for(var _0x8c7ae in _0xa7b21b){if(typeof _0xa7b21b[_0x8c7ae]!==_0xda7d('0xaf')){this[_0xda7d('0x21')]['enqueue'](function(){if(!_[_0xda7d('0xb0')](_0xa7b21b[_0x8c7ae])){return ami[_0xda7d('0xb1')]({'action':_0xda7d('0xb2'),'channel':_0xa7b21b[_0x8c7ae][_0xda7d('0xb3')]})['catch'](function(_0xff14cc){if(_0xff14cc['message']===_0xda7d('0xb4')){setTimeout(function(){if(_0xa7b21b[_0x8c7ae]&&_0xa7b21b[_0x8c7ae][_0xda7d('0x51')]!=='ivr'){_0x54d326[_0xda7d('0xb5')](_0x54d326['voiceQueues'][_0xa7b21b[_0x8c7ae][_0xda7d('0xb6')]]);logger[_0xda7d('0x98')](_0xda7d('0xb7'),_0x571c94,_0x8c7ae,_0xa7b21b[_0x8c7ae][_0xda7d('0xb6')]);delete _0xa7b21b[_0x8c7ae];}if(_0xa7b21b[_0x8c7ae]&&_0xa7b21b[_0x8c7ae][_0xda7d('0x51')]===_0xda7d('0x7d')){_0x54d326[_0xda7d('0xb5')](_0x54d326['campaigns'][_0xa7b21b[_0x8c7ae]['queue']]);logger[_0xda7d('0x98')](_0xda7d('0xb8'),_0x571c94,_0x8c7ae,_0xa7b21b[_0x8c7ae][_0xda7d('0xb6')]);delete _0xa7b21b[_0x8c7ae];}},0x2328);}});}});}}};Dialer[_0xda7d('0xaa')][_0xda7d('0xb9')]=function(_0x18eb61){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopper['countReScheduled'](_0x18eb61))[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xbc')));};Dialer[_0xda7d('0xaa')][_0xda7d('0xbd')]=function(_0x144e64){return Promise['resolve']()[_0xda7d('0x41')](cmHopperBlack['checkIsBlackList'](_0x144e64))[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xbe')));};Dialer[_0xda7d('0xaa')][_0xda7d('0xbf')]=function(_0x3234a6,_0x2142b6,_0x281c71){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopperAdditionalPhone[_0xda7d('0xbf')](_0x3234a6,_0x2142b6,_0x281c71))[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xc0')));};Dialer['prototype']['swapAdditionalPhones']=function(_0x15c97c,_0x7df6b3,_0x93eea7){return Promise[_0xda7d('0xba')]()['then'](cmHopperAdditionalPhone[_0xda7d('0xc1')](_0x15c97c,_0x7df6b3,_0x93eea7))[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xc2')));};Dialer['prototype'][_0xda7d('0xc3')]=function(_0x4c42fc){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopperBlack[_0xda7d('0xc3')](_0x4c42fc))[_0xda7d('0xbb')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xda7d('0xaa')][_0xda7d('0xc4')]=function(_0x5a5256){return Promise['resolve']()[_0xda7d('0x41')](cmHopperHistory[_0xda7d('0xc5')](_0x5a5256))[_0xda7d('0xbb')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xda7d('0xaa')][_0xda7d('0xc6')]=function(_0x20d503){return Promise['resolve']()['then'](cmHopper['rescheduleContact'](_0x20d503))['catch'](loggerCatch(_0xda7d('0xc7')));};Dialer['prototype'][_0xda7d('0xc8')]=function(_0x2285dd,_0x32d561,_0x2c39a3){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopper['unlockContact'](_0x2285dd,_0x32d561,_0x2c39a3))[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xc9')));};Dialer[_0xda7d('0xaa')][_0xda7d('0xca')]=function(_0x44d06e,_0x5f2040,_0x34db24,_0x6ad6b8,_0x1f1322){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopper['getContactDialer'](_0x44d06e,_0x5f2040,_0x34db24,_0x6ad6b8))[_0xda7d('0xbb')](function(_0x52f4c5){_0x1f1322[_0xda7d('0xcb')]-=_0x34db24;_0x1f1322[_0xda7d('0xcb')]=_0x1f1322[_0xda7d('0xcb')]>0x0?_0x1f1322[_0xda7d('0xcb')]:0x0;loggerCatch(_0xda7d('0xcc'))(_0x52f4c5);});};Dialer[_0xda7d('0xaa')][_0xda7d('0xcd')]=function(_0x1d4958,_0x4a83ed,_0x4ae63c,_0x58f7ac){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopper[_0xda7d('0xcd')](_0x1d4958,_0x4a83ed,_0x4ae63c))['catch'](function(_0x233d6e){_0x58f7ac[_0xda7d('0xcb')]-=_0x4a83ed;_0x58f7ac[_0xda7d('0xcb')]=_0x58f7ac[_0xda7d('0xcb')]>0x0?_0x58f7ac[_0xda7d('0xcb')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x233d6e);});};Dialer[_0xda7d('0xaa')][_0xda7d('0xce')]=function(_0x140ed5){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](voiceQueueRt[_0xda7d('0xce')](_0x140ed5))['catch'](loggerCatch(_0xda7d('0xcf')));};Dialer['prototype'][_0xda7d('0xd0')]=function(_0x5b4099){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopper[_0xda7d('0xd0')](_0x5b4099))[_0xda7d('0xbb')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xda7d('0xaa')]['createHistory']=function(_0x2cb28b){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopperHistory[_0xda7d('0xd1')](_0x2cb28b))[_0xda7d('0xbb')](loggerCatch('[createHistory]\x20'));};Dialer[_0xda7d('0xaa')]['updateOriginated']=function(_0x5268ba){if(!_[_0xda7d('0x43')](_0x5268ba)&&_0x5268ba!==null){if(typeof _0x5268ba[_0xda7d('0x9b')]!==_0xda7d('0xaf')){if(_0x5268ba[_0xda7d('0x9b')]>0x0){_0x5268ba['originated']-=0x1;}else{logger[_0xda7d('0x98')](_0xda7d('0xd2'));}}}else{logger['error'](_0xda7d('0xd3'));}};Dialer[_0xda7d('0xaa')][_0xda7d('0xd4')]=function(_0x5793d2,_0x43382b){var _0x24068c=this;return function(_0x414ec1){_0x24068c['updateOriginated'](_0x43382b);logger['error'](_0x5793d2,util[_0xda7d('0x97')](_0x414ec1,{'showHidden':![],'depth':null}));};};Dialer[_0xda7d('0xaa')][_0xda7d('0xd5')]=function(_0x2ba274,_0x2aba86,_0x1c033d){var _0x2868c4={'state':0x19,'statedesc':_0xda7d('0xd6')};this[_0xda7d('0xb5')](_0x2aba86);this[_0xda7d('0xd7')](_[_0xda7d('0x8d')](_0x2868c4,_[_0xda7d('0xd8')](_0x1c033d,[_0xda7d('0xd9'),_0xda7d('0xda'),_0xda7d('0xdb'),_0xda7d('0xdc'),_0xda7d('0xdd')])),_0xda7d('0xde'),_0xda7d('0xdf'));logger['error'](_0x2ba274);};Dialer[_0xda7d('0xaa')][_0xda7d('0xe0')]=function(_0x5d4194){return _0x5d4194===_0xda7d('0xe1');};Dialer['prototype']['isTrunkReachable']=function(_0x3472ae){return!_['isUndefined'](_0x3472ae)&&_0x3472ae&&!_[_0xda7d('0x43')](_0x3472ae[_0xda7d('0x46')])&&!_[_0xda7d('0x43')](_0x3472ae[_0xda7d('0x78')])&&_0x3472ae['active']&&(this[_0xda7d('0x25')][util['format'](_0xda7d('0xe2'),_0x3472ae[_0xda7d('0x46')])][_0xda7d('0xb2')]===_0xda7d('0xe3')||this[_0xda7d('0x25')][util[_0xda7d('0x7a')](_0xda7d('0xe2'),_0x3472ae[_0xda7d('0x46')])]['status']===_0xda7d('0xe4'));};Dialer[_0xda7d('0xaa')][_0xda7d('0xd7')]=function(_0x19733d,_0x3e88ae,_0x5c0758){this[_0xda7d('0xd1')](_0x19733d)['catch'](loggerCatch(_0x3e88ae));this[_0xda7d('0xd0')](_0x19733d)['catch'](loggerCatch(_0x5c0758));};Dialer[_0xda7d('0xaa')]['syncVarSet']=function(_0x487d36){var _0x1fa41e=this;var _0x224fd2=this[_0xda7d('0x2a')][_0x487d36[_0xda7d('0xe5')]];var _0x3bde40;if(!_[_0xda7d('0xb0')](_0x487d36)&&!_[_0xda7d('0xb0')](_0x487d36[_0xda7d('0xe6')])&&!_[_0xda7d('0xb0')](_0x487d36[_0xda7d('0xe6')][_0xda7d('0xe7')])&&_0x487d36[_0xda7d('0xe8')]==='xcally-motion-dialer'&&_0x224fd2){if(_0x224fd2[_0xda7d('0x51')]!==_0xda7d('0x7d')&&this[_0xda7d('0x23')][_0x224fd2[_0xda7d('0xb6')]][_0xda7d('0xe9')]&&_0x487d36['value']===_0xda7d('0xea')){delete this['uniqueId'][_0x487d36[_0xda7d('0xe5')]];this['updateOriginated'](this[_0xda7d('0x23')][_0x224fd2['queue']]);this[_0xda7d('0x23')][_0x224fd2[_0xda7d('0xb6')]]['outboundAnswerCallsDay']+=0x1;this[_0xda7d('0x23')][_0x224fd2[_0xda7d('0xb6')]][_0xda7d('0x63')]+=0x1;_0x3bde40=new Hangup(_0x224fd2,_0x487d36);_0x3bde40[_0xda7d('0xa7')]=0x12;_0x3bde40[_0xda7d('0xa8')]='HangupInAMD';_0x3bde40['membername']='AMD';ami['emit'](_0xda7d('0xeb'),ut[_0xda7d('0xec')](_0x3bde40,_0xda7d('0xed')));this[_0xda7d('0xd7')](_0x3bde40,_0xda7d('0xee'),_0xda7d('0xef'));}if(_0x224fd2['type']!=='ivr'&&this[_0xda7d('0x23')][_0x224fd2[_0xda7d('0xb6')]][_0xda7d('0xe9')]&&_0x487d36[_0xda7d('0xf0')]===_0xda7d('0xf1')){return new Promise(function(_0xe7903d,_0x4a42c9){delete _0x1fa41e['uniqueId'][_0x487d36[_0xda7d('0xe5')]];_0x1fa41e['updateOriginated'](_0x1fa41e['voiceQueues'][_0x224fd2[_0xda7d('0xb6')]]);_0x1fa41e['voiceQueues'][_0x224fd2[_0xda7d('0xb6')]][_0xda7d('0x64')]+=0x1;_0x1fa41e[_0xda7d('0x23')][_0x224fd2[_0xda7d('0xb6')]][_0xda7d('0x63')]+=0x1;var _0x476265=_0x1fa41e['voiceQueues'][_0x224fd2[_0xda7d('0xb6')]];var _0x306855=new Hangup(_0x224fd2,_0x487d36);_0x306855[_0xda7d('0xa7')]=0x13;_0x306855[_0xda7d('0xa8')]=_0xda7d('0xf2');_0x306855[_0xda7d('0xf3')]=_0xda7d('0xf4');_0x306855[_0xda7d('0xf5')]+=0x1;_0x306855[_0xda7d('0xf6')]+=0x1;_0x306855[_0xda7d('0xed')]=!![];ami[_0xda7d('0x50')](_0xda7d('0xeb'),ut[_0xda7d('0xec')](_0x306855,_0xda7d('0xed')));_0x1fa41e['createHistory'](_0x306855)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xf7')));if(_0x306855['countbusyretry']+_0x306855[_0xda7d('0xf8')]+_0x306855['countnoanswerretry']+_0x306855[_0xda7d('0xf9')]+_0x306855[_0xda7d('0xfa')]+_0x306855['countabandonedretry']+_0x306855[_0xda7d('0xf5')]+_0x306855[_0xda7d('0xfb')]>=_0x476265[_0xda7d('0xfc')]){_0x1fa41e[_0xda7d('0xfd')](_0x306855,_0xe7903d,_0x4a42c9,'reason19\x20machine....');}else{if(_0x306855[_0xda7d('0xf5')]>=_0x476265['dialMachineMaxRetry']){_0x1fa41e[_0xda7d('0xfe')](_0x306855,_0xe7903d,_0x4a42c9,_0xda7d('0xff'));}else{_0x1fa41e[_0xda7d('0xc6')]({'active':![],'countmachineretry':_0x306855['countmachineretry'],'scheduledat':moment()[_0xda7d('0x100')](_0x476265['dialMachineRetryFrequency'],'minutes')[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x306855[_0xda7d('0xd9')],'ListId':_0x306855[_0xda7d('0xda')],'VoiceQueueId':_0x306855[_0xda7d('0xdc')]||undefined,'CampaignId':_0x306855[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x102')));_0xe7903d({'reschedule':0x1});}}});}if(_0x224fd2[_0xda7d('0x51')]===_0xda7d('0x7d')&&this[_0xda7d('0x103')][_0x224fd2[_0xda7d('0xb6')]][_0xda7d('0xe9')]&&_0x487d36[_0xda7d('0xf0')]===_0xda7d('0xea')){delete this[_0xda7d('0x2a')][_0x487d36[_0xda7d('0xe5')]];this[_0xda7d('0xb5')](this[_0xda7d('0x103')][_0x224fd2['queue']]);_0x3bde40=new Hangup(_0x224fd2,_0x487d36);_0x3bde40['state']=0x12;_0x3bde40['statedesc']=_0xda7d('0x104');_0x3bde40[_0xda7d('0xf3')]=_0xda7d('0xf4');ami[_0xda7d('0x50')](_0xda7d('0xeb'),ut[_0xda7d('0xec')](_0x3bde40,_0xda7d('0xed')));this[_0xda7d('0xd7')](_0x3bde40,'[syncHangupInAMDIvr][createHistory]',_0xda7d('0x105'));}if(_0x224fd2[_0xda7d('0x51')]===_0xda7d('0x7d')&&this['campaigns'][_0x224fd2[_0xda7d('0xb6')]]['dialAMDActive']&&_0x487d36['value']==='MACHINE'){return new Promise(function(_0x49ce8e,_0x5aace1){delete _0x1fa41e['uniqueId'][_0x487d36[_0xda7d('0xe5')]];_0x1fa41e[_0xda7d('0xb5')](_0x1fa41e[_0xda7d('0x103')][_0x224fd2[_0xda7d('0xb6')]]);_0x1fa41e['campaigns'][_0x224fd2[_0xda7d('0xb6')]][_0xda7d('0x64')]+=0x1;_0x1fa41e[_0xda7d('0x103')][_0x224fd2[_0xda7d('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5394f1=_0x1fa41e[_0xda7d('0x103')][_0x224fd2[_0xda7d('0xb6')]];var _0x3e952a=new Hangup(_0x224fd2,_0x487d36);_0x3e952a['state']=0x13;_0x3e952a[_0xda7d('0xa8')]=_0xda7d('0xf2');_0x3e952a[_0xda7d('0xf3')]='AMD';_0x3e952a['countmachineretry']+=0x1;_0x3e952a[_0xda7d('0xf6')]+=0x1;_0x3e952a[_0xda7d('0xed')]=!![];ami[_0xda7d('0x50')](_0xda7d('0xeb'),ut[_0xda7d('0xec')](_0x3e952a,'amd'));_0x1fa41e[_0xda7d('0xd1')](_0x3e952a)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xf7')));if(_0x3e952a[_0xda7d('0x106')]+_0x3e952a['countcongestionretry']+_0x3e952a[_0xda7d('0x107')]+_0x3e952a['countnosuchnumberretry']+_0x3e952a[_0xda7d('0xfa')]+_0x3e952a['countabandonedretry']+_0x3e952a[_0xda7d('0xf5')]+_0x3e952a[_0xda7d('0xfb')]>=_0x5394f1[_0xda7d('0xfc')]){_0x1fa41e[_0xda7d('0xfd')](_0x3e952a,_0x49ce8e,_0x5aace1,_0xda7d('0x108'));}else{if(_0x3e952a[_0xda7d('0xf5')]>=_0x5394f1[_0xda7d('0x109')]){_0x1fa41e['createStateFinal'](_0x3e952a,_0x49ce8e,_0x5aace1,_0xda7d('0xff'));}else{_0x1fa41e[_0xda7d('0xc6')]({'active':![],'countmachineretry':_0x3e952a['countmachineretry'],'scheduledat':moment()['add'](_0x5394f1[_0xda7d('0x10a')],_0xda7d('0x10b'))['format'](_0xda7d('0x101')),'ContactId':_0x3e952a[_0xda7d('0xd9')],'ListId':_0x3e952a['ListId'],'VoiceQueueId':_0x3e952a[_0xda7d('0xdc')]||undefined,'CampaignId':_0x3e952a[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x102')));_0x49ce8e({'reschedule':0x1});}}});}}};Dialer[_0xda7d('0xaa')]['syncHangup']=function(_0x527262){var _0x219f5b=this['uniqueId'][_0x527262[_0xda7d('0xe5')]];var _0x19188d;if(_0x219f5b&&_0x219f5b[_0xda7d('0x51')]===_0xda7d('0x7d')){delete this['uniqueId'][_0x527262['uniqueid']];this[_0xda7d('0xb5')](this['campaigns'][_0x219f5b[_0xda7d('0xb6')]]);this['campaigns'][_0x219f5b[_0xda7d('0xb6')]][_0xda7d('0x10c')]+=0x1;_0x19188d=new Hangup(_0x219f5b,_0x527262);this['createHistory'](_0x19188d)['catch'](loggerCatch(_0xda7d('0x10d')));this[_0xda7d('0xd0')](_0x19188d)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x10e')));}if(_0x219f5b&&_0x219f5b[_0xda7d('0x51')]!==_0xda7d('0x7d')&&isNotNull(this[_0xda7d('0x23')][_0x219f5b[_0xda7d('0xb6')]]['dialQueueProject'])){delete this[_0xda7d('0x2a')][_0x527262[_0xda7d('0xe5')]];this['updateOriginated'](this['voiceQueues'][_0x219f5b[_0xda7d('0xb6')]]);this[_0xda7d('0x23')][_0x219f5b[_0xda7d('0xb6')]][_0xda7d('0x64')]+=0x1;this[_0xda7d('0x23')][_0x219f5b[_0xda7d('0xb6')]][_0xda7d('0x63')]+=0x1;_0x19188d=new Hangup(_0x219f5b,_0x527262);_0x19188d[_0xda7d('0xa7')]=0x10;_0x19188d[_0xda7d('0xa8')]=_0xda7d('0x10f');_0x19188d[_0xda7d('0xf3')]=_0xda7d('0x110');this['createHistory'](_0x19188d)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x19188d)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x10e')));}if(_0x219f5b&&_0x219f5b['type']!==_0xda7d('0x7d')&&!isNotNull(this['voiceQueues'][_0x219f5b[_0xda7d('0xb6')]][_0xda7d('0x111')])){delete this['uniqueId'][_0x527262[_0xda7d('0xe5')]];this[_0xda7d('0xb5')](this[_0xda7d('0x23')][_0x219f5b['queue']]);this[_0xda7d('0x23')][_0x219f5b['queue']][_0xda7d('0x6b')]+=0x1;_0x19188d=new Hangup(_0x219f5b,_0x527262);_0x19188d['state']=0xc;_0x19188d['statedesc']=_0x527262['cause-txt'];_0x19188d[_0xda7d('0xf3')]=_0xda7d('0x112');this[_0xda7d('0xd1')](_0x19188d)[_0xda7d('0xbb')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xda7d('0xd0')](_0x19188d)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x10e')));}};Dialer[_0xda7d('0xaa')][_0xda7d('0x113')]=function(_0x5b032e){var _0x4be59b=this[_0xda7d('0x2a')][_0x5b032e[_0xda7d('0xe5')]];if(this[_0xda7d('0x23')][_0x5b032e[_0xda7d('0xb6')]]){if(_0x4be59b&&_0x4be59b['type']!==_0xda7d('0x7d')){delete this[_0xda7d('0x2a')][_0x5b032e['uniqueid']];this[_0xda7d('0x23')][_0x5b032e[_0xda7d('0xb6')]][_0xda7d('0x64')]+=0x1;var _0xe38966=new AgentComplete(_0x4be59b,_0x5b032e);if(_0x5b032e['reason']===_0xda7d('0x114')){_0xe38966[_0xda7d('0x115')]=this[_0xda7d('0x23')][_0x5b032e['queue']][_0xda7d('0x116')]&&this[_0xda7d('0x23')][_0x5b032e['queue']]['dialAgiAfterHangupAgent']?moment()['format'](_0xda7d('0x101')):undefined;}this[_0xda7d('0xd1')](_0xe38966)['catch'](loggerCatch(_0xda7d('0x117')));this[_0xda7d('0xd0')](_0xe38966)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x118')));}}};Dialer['prototype'][_0xda7d('0x2f')]=function(_0x3a6802){if(this[_0xda7d('0x23')][_0x3a6802[_0xda7d('0xb6')]]){if(this[_0xda7d('0x2a')][_0x3a6802[_0xda7d('0xe5')]]&&this[_0xda7d('0x2a')][_0x3a6802['uniqueid']]['type']!=='ivr'){this[_0xda7d('0xb5')](this[_0xda7d('0x23')][_0x3a6802['queue']]);this[_0xda7d('0x2a')][_0x3a6802['uniqueid']][_0xda7d('0x119')]=moment()[_0xda7d('0x7a')](_0xda7d('0x101'));}}};Dialer[_0xda7d('0xaa')][_0xda7d('0x11a')]=function(_0x35140b,_0x20bf50){this[_0xda7d('0xd1')](_0x35140b)['catch'](loggerCatch(_0xda7d('0x117')));if(_0x20bf50==0x0){this[_0xda7d('0xd0')](_0x35140b)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x11b')));}};Dialer[_0xda7d('0xaa')][_0xda7d('0x31')]=function(_0x6900b3){var _0x5a039e=this['uniqueId'][_0x6900b3[_0xda7d('0xe5')]];var _0x489cfb=this;var _0x201171=![];var _0x2a0caa;var _0x2c9f1a;if(this['voiceQueues'][_0x6900b3[_0xda7d('0xb6')]]){if(_0x5a039e&&_0x5a039e[_0xda7d('0x51')]!==_0xda7d('0x7d')){delete this[_0xda7d('0x2a')][_0x6900b3[_0xda7d('0xe5')]];this[_0xda7d('0xb5')](this[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]]);_0x5a039e[_0xda7d('0x11c')]=moment()[_0xda7d('0x7a')](_0xda7d('0x101'));var _0x57145f=new QueueCallerAbandon(_0x5a039e,_0x6900b3);if(getSeconds(_0x5a039e[_0xda7d('0x11c')],_0x5a039e[_0xda7d('0x11d')])>=_0x5a039e[_0xda7d('0x11e')]){this[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]][_0xda7d('0x67')]+=0x1;this['voiceQueues'][_0x6900b3[_0xda7d('0xb6')]][_0xda7d('0x11f')]+=0x1;_0x57145f[_0xda7d('0xa7')]=0xa;_0x57145f[_0xda7d('0xa8')]=_0xda7d('0x120');_0x57145f[_0xda7d('0x121')]=_0xda7d('0x122');_0x57145f[_0xda7d('0x115')]=this[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]][_0xda7d('0x116')]?moment()[_0xda7d('0x7a')](_0xda7d('0x101')):undefined;_0x57145f[_0xda7d('0xfa')]+=0x1;_0x57145f['countglobal']+=0x1;_0x2a0caa=this[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]]['dialDropRetryFrequency'];_0x2c9f1a=this[_0xda7d('0x23')][_0x6900b3['queue']][_0xda7d('0x123')];_0x489cfb[_0xda7d('0xbf')](_0x57145f,_0x57145f[_0xda7d('0xa7')],_0x5a039e[_0xda7d('0x124')])[_0xda7d('0x41')](function(_0x32673a){_0x201171=_0x32673a[_0xda7d('0x125')]==0x1;if(_0x57145f['countdropretry']>=_0x489cfb[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]][_0xda7d('0x126')]){_0x489cfb[_0xda7d('0x11a')](_0x57145f,_0x32673a[_0xda7d('0x125')]);}else{_0x489cfb[_0xda7d('0xc6')]({'active':![],'countdropretry':_0x57145f['countdropretry'],'scheduledat':moment()[_0xda7d('0x100')](_0x489cfb[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]]['dialDropRetryFrequency'],_0xda7d('0x10b'))[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x5a039e[_0xda7d('0xd9')],'ListId':_0x5a039e[_0xda7d('0xda')],'VoiceQueueId':_0x5a039e['VoiceQueueId']||undefined,'CampaignId':_0x5a039e[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x127')));var _0x2fee18=new History(_0x57145f);_0x2fee18[_0xda7d('0xa7')]=0xa;_0x2fee18['statedesc']='Drop';_0x2fee18[_0xda7d('0x128')]=moment()[_0xda7d('0x7a')](_0xda7d('0x101'));_0x2fee18['endtime']=_0x2fee18[_0xda7d('0x128')];_0x2fee18['calleridname']=_0x57145f[_0xda7d('0x129')];_0x2fee18[_0xda7d('0x12a')]=_0x57145f[_0xda7d('0x12a')];_0x489cfb['createHistory'](_0x2fee18)[_0xda7d('0xbb')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xda7d('0x41')](function(){if(_0x201171)_0x489cfb['swapAdditionalPhones'](_0x57145f,_0x2a0caa,_0x2c9f1a)[_0xda7d('0x41')](function(){return 0x1;});});}else{this[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x6900b3[_0xda7d('0xb6')]][_0xda7d('0x66')]+=0x1;_0x57145f[_0xda7d('0xa7')]=0xb;_0x57145f[_0xda7d('0xa8')]='Abandoned';_0x57145f[_0xda7d('0x121')]='CALLEREXIT';_0x57145f['countabandonedretry']+=0x1;_0x57145f[_0xda7d('0xf6')]+=0x1;_0x2a0caa=this[_0xda7d('0x23')][_0x6900b3['queue']][_0xda7d('0x12b')];_0x2c9f1a=this[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]][_0xda7d('0x123')];_0x489cfb['verifyAdditionalPhones'](_0x57145f,_0x57145f[_0xda7d('0xa7')],_0x5a039e['voiceQueue'])['then'](function(_0x1b735a){if(_0x57145f['countabandonedretry']>=_0x489cfb[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]]['dialAbandonedMaxRetry']){_0x489cfb[_0xda7d('0x11a')](_0x57145f,_0x1b735a['additional']);}else{_0x489cfb[_0xda7d('0xc6')]({'active':![],'countabandonedretry':_0x57145f['countabandonedretry'],'scheduledat':moment()[_0xda7d('0x100')](_0x489cfb[_0xda7d('0x23')][_0x6900b3[_0xda7d('0xb6')]][_0xda7d('0x12b')],_0xda7d('0x10b'))[_0xda7d('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a039e[_0xda7d('0xd9')],'ListId':_0x5a039e[_0xda7d('0xda')],'VoiceQueueId':_0x5a039e[_0xda7d('0xdc')]||undefined,'CampaignId':_0x5a039e['CampaignId']||undefined})['catch'](loggerCatch(_0xda7d('0x12c')));var _0x1095a2=new History(_0x57145f);_0x1095a2[_0xda7d('0xa7')]=0xb;_0x1095a2[_0xda7d('0xa8')]='Abandoned';_0x1095a2['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1095a2['endtime']=_0x1095a2[_0xda7d('0x128')];_0x1095a2[_0xda7d('0x129')]=_0x57145f[_0xda7d('0x129')];_0x1095a2[_0xda7d('0x12a')]=_0x57145f['calleridnum'];_0x489cfb[_0xda7d('0xd1')](_0x1095a2)[_0xda7d('0xbb')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xda7d('0x41')](function(){if(_0x201171)_0x489cfb[_0xda7d('0xc1')](_0x57145f,_0x2a0caa,_0x2c9f1a)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0xda7d('0x12d')]=function(_0x2706af){if(this['actions'][_0x2706af[_0xda7d('0xe5')]]){this[_0xda7d('0x28')][_0x2706af[_0xda7d('0xe5')]]['channel']=_0x2706af['channel'];}if(this['uniqueId'][_0x2706af[_0xda7d('0xe5')]]){this[_0xda7d('0x2a')][_0x2706af['uniqueid']][_0xda7d('0xb3')]=_0x2706af['channel'];}};Dialer[_0xda7d('0xaa')][_0xda7d('0x3d')]=function(_0x4fbbd3){if(strategy[this[_0xda7d('0x23')][this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]]['queue']][_0xda7d('0x52')]]===_0xda7d('0x1d')){if(this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]]&&_[_0xda7d('0xb0')](this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]]['locked'])&&_0x4fbbd3[_0xda7d('0xb2')]==='1'&&_0x4fbbd3[_0xda7d('0x12f')]==='0'){if(this[_0xda7d('0x24')][_0x4fbbd3[_0xda7d('0x130')]]){if(!this[_0xda7d('0x24')][_0x4fbbd3['stateinterface']][_0xda7d('0x131')]){this['agents'][_0x4fbbd3[_0xda7d('0x130')]][_0xda7d('0x131')]=!![];this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]][_0xda7d('0x131')]=!![];this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]]['stateinterface']=_0x4fbbd3[_0xda7d('0x130')];}}}}else if((strategy[this[_0xda7d('0x23')][this['actions'][_0x4fbbd3[_0xda7d('0x12e')]][_0xda7d('0xb6')]][_0xda7d('0x52')]]||'rrmemory')===_0xda7d('0x1c')){if(this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]]){if(this[_0xda7d('0x24')][_0x4fbbd3['stateinterface']]){this[_0xda7d('0x28')][_0x4fbbd3['actionid']]['stateinterface']=_0x4fbbd3[_0xda7d('0x130')];if(_['isNil'](this[_0xda7d('0x2c')][this[_0xda7d('0x28')][_0x4fbbd3['actionid']][_0xda7d('0xb6')]])){this[_0xda7d('0x2c')][this['actions'][_0x4fbbd3[_0xda7d('0x12e')]][_0xda7d('0xb6')]]=[];}this[_0xda7d('0x2c')][this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]][_0xda7d('0xb6')]][_0xda7d('0x132')](_[_0xda7d('0x8d')](_[_0xda7d('0xd8')](this[_0xda7d('0x28')][_0x4fbbd3[_0xda7d('0x12e')]],[_0xda7d('0x133'),_0xda7d('0x130')]),{'status':_0x4fbbd3[_0xda7d('0xb2')],'paused':_0x4fbbd3[_0xda7d('0x12f')]}));}}}};function unlockQueueStatus(_0x1b10f8,_0x3decb1){setTimeout(function(){if(_[_0xda7d('0x43')](_0x1b10f8[_0xda7d('0x134')])){loggerBooked[_0xda7d('0x98')]('[unlockQueueStatus][undefined]',_0x3decb1);}_0x1b10f8[_0xda7d('0x134')]=!![];loggerBooked[_0xda7d('0x80')](_0xda7d('0x135'),_0x3decb1,JSON[_0xda7d('0x4d')](_[_0xda7d('0xd8')](_0x1b10f8,[_0xda7d('0x46'),_0xda7d('0x134')])));},0x1f3);}Dialer[_0xda7d('0xaa')]['syncQueueStatusComplete']=function(_0x50cbc9){var _0x1bfd79=this;var _0x2513b4=_0x1bfd79['voiceQueues'][_0x1bfd79['actions'][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]];if(strategy[this[_0xda7d('0x23')][this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]][_0xda7d('0x52')]]===_0xda7d('0x1d')){if(this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]]&&this['actions'][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0x130')]){this[_0xda7d('0x22')][_0xda7d('0x136')](this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0x133')],this[_0xda7d('0x28')][_0x50cbc9['actionid']][_0xda7d('0x130')])[_0xda7d('0xbb')](function(_0x4e052a){logger[_0xda7d('0x98')](_0xda7d('0x137'),util['inspect'](_0x4e052a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1bfd79[_0xda7d('0xb5')](_0x1bfd79[_0xda7d('0x23')][_0x1bfd79['actions'][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]]);_0x1bfd79[_0xda7d('0x24')][_0x1bfd79[_0xda7d('0x28')][_0x50cbc9['actionid']][_0xda7d('0x130')]][_0xda7d('0x131')]=![];delete _0x1bfd79[_0xda7d('0x28')][_0x50cbc9['actionid']];unlockQueueStatus(_0x2513b4);});}else{this[_0xda7d('0xb5')](this[_0xda7d('0x23')][this[_0xda7d('0x28')][_0x50cbc9['actionid']][_0xda7d('0xb6')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xda7d('0x28')][_0x50cbc9['actionid']][_0xda7d('0xd9')],'ListId':this[_0xda7d('0x28')][_0x50cbc9['actionid']][_0xda7d('0xda')],'VoiceQueueId':this[_0xda7d('0x28')][_0x50cbc9['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xdd')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xda7d('0x28')][_0x50cbc9['actionid']];unlockQueueStatus(_0x2513b4);}}else if((strategy[this['voiceQueues'][this['actions'][_0x50cbc9['actionid']][_0xda7d('0xb6')]][_0xda7d('0x52')]]||_0xda7d('0x1c'))==='rrmemory'){var _0x22ad74;if(this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]]&&!_[_0xda7d('0x7f')](this[_0xda7d('0x2c')][this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]])){if(this[_0xda7d('0x2d')][_0x1bfd79[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]]){this[_0xda7d('0x2d')][_0x1bfd79['actions'][_0x50cbc9['actionid']][_0xda7d('0xb6')]]=this['queueBookedRR'][this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]]?this[_0xda7d('0x2d')][this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]]['queue']]:this['queueBooked'][this['actions'][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]]?this[_0xda7d('0x2c')][this['actions'][_0x50cbc9[_0xda7d('0x12e')]]['queue']][_0xda7d('0x138')]||0x0:0x0;}this[_0xda7d('0x2c')][this['actions'][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]][_0xda7d('0x138')]=this[_0xda7d('0x2d')][this[_0xda7d('0x28')][_0x50cbc9[_0xda7d('0x12e')]][_0xda7d('0xb6')]];for(var _0x43f3fc=0x0;_0x43f3fc=0x0;})[_0xda7d('0xbb')](myreject(_0x2bafd3)));}}else{_0x5777ed[_0xda7d('0x132')](ami[_0xda7d('0xb1')]({'action':_0xda7d('0x152'),'command':util[_0xda7d('0x7a')](_0xda7d('0x153'),_0x253181,!_[_0xda7d('0x43')](config[_0xda7d('0x14f')][_0x11c107])?_0x11c107:'')})[_0xda7d('0x41')](function(_0x460076){return _0x460076['content'][_0xda7d('0x156')]('true')>=0x0;})['catch'](myreject(_0x2bafd3)));}Promise[_0xda7d('0x158')](_0x5777ed)[_0xda7d('0x41')](function(_0x4deb35){var _0x11d6bf=_[_0xda7d('0x159')](_0x4deb35);if(_0x11d6bf){return _0x2eef0f(_0x11d6bf);}else{_0xb87f56[_0xda7d('0x44')]=_0x1ccca2?'GLOBAL_INTERVAL_IS_OVERTIME':_0xda7d('0x15a');return _0x2bafd3(msgResponse(_0xda7d('0x15b'),_0xda7d('0x14b'),_0xda7d('0x15c')+_0x1ccca2+'\x20'+_0x5147d1+_0xda7d('0x15d')+util[_0xda7d('0x97')](_0x253181,{'showHidden':![],'depth':null})+_0xda7d('0x15e')+_0x11c107));}})[_0xda7d('0xbb')](function(_0x651a6e){return _0x2bafd3(msgResponse(_0xda7d('0x14a'),_0xda7d('0x14b'),JSON[_0xda7d('0x4d')](_0x651a6e)));});});};Dialer[_0xda7d('0xaa')][_0xda7d('0x15f')]=function(_0x4942e5){var _0x22d01c=this;return function(){switch(_0x4942e5['dialMethod']){case'progressive':freeVariablesPredictive(_0x4942e5);_0x22d01c[_0xda7d('0x160')](_0x4942e5,0x1);break;case _0xda7d('0x161'):freeVariablesPredictive(_0x4942e5);_0x22d01c[_0xda7d('0x160')](_0x4942e5,_0x4942e5[_0xda7d('0x162')]);break;case _0xda7d('0x163'):_0x22d01c[_0xda7d('0x163')](_0x4942e5);break;case _0xda7d('0x9'):freeVariablesPredictive(_0x4942e5);_0x22d01c[_0xda7d('0x160')](_0x4942e5,0x1);break;default:freeVariablesPredictive(_0x4942e5);logger[_0xda7d('0x98')](_0xda7d('0x164'),_0x4942e5[_0xda7d('0x46')],_0xda7d('0x165'));}};};Dialer[_0xda7d('0xaa')][_0xda7d('0x166')]=function(_0x3bf4f1){return Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](cmHopper['handlePreviewRecallNotifications'](_0x3bf4f1['id'],previewRecallmeReminderInterval))['then'](function(_0x1cc4f9){for(var _0x5dade3=0x0;_0x5dade3<_0x1cc4f9[_0xda7d('0x9a')];_0x5dade3++){var _0x299005=_0x1cc4f9[_0x5dade3][_0xda7d('0x167')][_0xda7d('0x46')];if(_0x299005)io['to'](util[_0xda7d('0x7a')]('user:%s',_0x299005))[_0xda7d('0x50')]('user:dialPreviewRecallReminder',{'hopper':_0x1cc4f9[_0x5dade3]});}})[_0xda7d('0xbb')](function(){});};Dialer['prototype'][_0xda7d('0x168')]=function(_0x17a160){var _0x5031af=this;return function(){_0x5031af['handleIvr'](_0x17a160);};};Dialer['prototype'][_0xda7d('0xb')]=function(_0x16fa99){var _0x288d6d=this;if(isNotPreview(_0x16fa99[_0xda7d('0x60')])){if(isVoiceQueueOutbound(_0x16fa99[_0xda7d('0x51')])&&isActive(_0x16fa99[_0xda7d('0x5f')])){_0x16fa99[_0xda7d('0xa1')]=!![];Promise['resolve']()[_0xda7d('0x41')](checkIsLoggedIn(_0x16fa99,_0x16fa99[_0xda7d('0x55')]))[_0xda7d('0x41')](checkIsActive(_0x16fa99,_0x16fa99[_0xda7d('0x5f')]))[_0xda7d('0x41')](checkInterval(_0x16fa99))[_0xda7d('0x41')](_0x288d6d[_0xda7d('0x143')](_0x16fa99))[_0xda7d('0x41')](_0x288d6d[_0xda7d('0x148')](_0x16fa99[_0xda7d('0x169')],_0x16fa99['dialTimezone'],_0x16fa99[_0xda7d('0x46')],_0x16fa99))[_0xda7d('0x41')](_0x288d6d[_0xda7d('0x149')](_0x16fa99[_0xda7d('0x49')],_0x16fa99[_0xda7d('0x16a')],_0x16fa99[_0xda7d('0x46')],_0x16fa99))[_0xda7d('0x41')](_0x288d6d['checkDialMethod'](_0x16fa99))['catch'](loggerCatchQueueSummary(_0xda7d('0x16b'),_0x16fa99));}else{notSendMessagesQueue(_0x16fa99);}}else{freeVariablesPredictive(_0x16fa99);}};Dialer[_0xda7d('0xaa')][_0xda7d('0x37')]=_['throttle'](function(){var _0x21eea3=_[_0xda7d('0x16c')](this['voiceQueues'],function(_0x5881fa){return _0x5881fa['dialPreviewRecallmeReminder'];});var _0x7dc165=_[_0xda7d('0x16c')](this[_0xda7d('0x24')],function(_0x51e528){return _0x51e528[_0xda7d('0x16d')]&&_0x51e528['status']===_0xda7d('0xe3');});if(_0x21eea3[_0xda7d('0x9a')]>0x0&&_0x7dc165[_0xda7d('0x9a')]>0x0){return Promise[_0xda7d('0xba')]()['then'](cmHopper[_0xda7d('0x16e')](_['map'](_0x21eea3,'id'),previewRecallmeReminderInterval,_['map'](_0x7dc165,'id')))['then'](function(_0x597299){for(var _0x273a3b=0x0;_0x273a3b<_0x597299['length'];_0x273a3b++){var _0x477005=_0x597299[_0x273a3b][_0xda7d('0x167')]['name'];if(_0x477005)io['to'](util[_0xda7d('0x7a')](_0xda7d('0x16f'),_0x477005))[_0xda7d('0x50')]('user:dialPreviewRecallReminder',{'hopper':_0x597299[_0x273a3b]});}})['catch'](function(_0x13497f){logger['error']('checkPreviewRecallReminder',_0x13497f);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xda7d('0x142')]=function(){var _0x297471=this;var _0x5735e8;for(var _0x480992 in this[_0xda7d('0x103')]){if(typeof this['campaigns'][_0x480992]!=='undefined'){_0x5735e8=this[_0xda7d('0x103')][_0x480992];if(isCampaignIvr(_0x5735e8[_0xda7d('0x51')])&&isActive(_0x5735e8[_0xda7d('0x78')])){_0x5735e8[_0xda7d('0xa1')]=!![];Promise[_0xda7d('0xba')]()[_0xda7d('0x41')](checkIsActive(_0x5735e8,_0x5735e8[_0xda7d('0x78')]))[_0xda7d('0x41')](checkInterval(_0x5735e8))[_0xda7d('0x41')](_0x297471[_0xda7d('0x143')](_0x5735e8))[_0xda7d('0x41')](_0x297471['checkIfTime'](_0x5735e8['dialGlobalInterval'],_0x5735e8[_0xda7d('0x16a')],_0x5735e8[_0xda7d('0x46')],_0x5735e8))[_0xda7d('0x41')](_0x297471[_0xda7d('0x149')](_0x5735e8[_0xda7d('0x49')],_0x5735e8['dialTimezone'],_0x5735e8[_0xda7d('0x46')],_0x5735e8))[_0xda7d('0x41')](_0x297471['launchHandleIvr'](_0x5735e8))[_0xda7d('0xbb')](loggerCatchQueueSummary(_0xda7d('0x170'),_0x5735e8));}else{notSendMessagesCampaign(_0x5735e8);}}}};function getCallerIdRandom(_0x4f9622,_0x112cb5){var _0x59563e;var _0x11f85c;var _0x261201;if(_0x112cb5<=0x0){_0x112cb5=0x1;}_0x59563e=new RegExp(_0xda7d('0x171')+_0x112cb5+'}$');_0x11f85c=Math['pow'](0xa,_0x112cb5-0x1);_0x261201=Math[_0xda7d('0x172')](0xa,_0x112cb5)-0x1;return util[_0xda7d('0x7a')]('%s',_[_0xda7d('0x173')](_0x4f9622,_0x59563e,_[_0xda7d('0x174')](_0x11f85c,_0x261201)));}function extractCalleridName(_0x4f2a75){var _0x3794f0=_0x4f2a75[_0xda7d('0x175')](/"(.*?)"/);return _0x3794f0?_0x3794f0[0x1]:_0x4f2a75;}Dialer[_0xda7d('0xaa')][_0xda7d('0x176')]=function(_0x22b0cf,_0x1ee4c5){var _0x16a312=this;var _0x297d7f=uuid['v4']();this[_0xda7d('0x28')][_0x297d7f]=new Action(_0x22b0cf,_0x1ee4c5,_0x297d7f);return new Promise(function(_0x56fa34,_0x3ebfae){if(_[_0xda7d('0x43')](_0x22b0cf)&&typeof _0x22b0cf!==_0xda7d('0x177')){return _0x3ebfae(msgResponse('originate',_0xda7d('0x14b'),_0xda7d('0x178')));}if(_[_0xda7d('0x43')](_0x1ee4c5[_0xda7d('0x179')])||_0x1ee4c5[_0xda7d('0x179')]===null){return _0x3ebfae(msgResponse('originate',_0xda7d('0x14b'),'contact\x20is\x20undefine'));}var _0x5da202={'XMD-CALLERID':_0x16a312[_0xda7d('0x28')][_0x297d7f]['getCaller'](),'XMD-AGI':_0x22b0cf['dialQueueProject']?util[_0xda7d('0x7a')](_0xda7d('0x17a'),ipAgi,_0x22b0cf[_0xda7d('0x111')]):_0xda7d('0x17b'),'XMD-AGIAFTER':_0x22b0cf['dialQueueProject2']?util[_0xda7d('0x7a')](_0xda7d('0x17a'),ipAgi,_0x22b0cf[_0xda7d('0x116')]):'NONE','XMD-QUEUE':_0x22b0cf[_0xda7d('0x51')]==='outbound'?util[_0xda7d('0x7a')]('\x22%s,%s%s,,,%s\x22',_0x22b0cf[_0xda7d('0x46')],_0x22b0cf[_0xda7d('0x17c')]||'',_0x22b0cf['dialAgiAfterHangupAgent']?'c':'',_0x22b0cf[_0xda7d('0x11e')]||0x3):_0xda7d('0x17b'),'XMD-CONTACTID':_0x1ee4c5[_0xda7d('0xd9')],'XMD-CDRTYPE':_0xda7d('0x8'),'CALLERID(all)':_0x16a312[_0xda7d('0x28')][_0x297d7f][_0xda7d('0x17d')](),'XMD-AMD':_0x22b0cf[_0xda7d('0xe9')]?_0xda7d('0x17e'):_0xda7d('0x17b'),'XMD-DESTINATION':_0xda7d('0x17f')};if(_0x22b0cf[_0xda7d('0xe9')]){_0x5da202['XMD-AMDINITIALSILENCE']=_0x22b0cf['dialAMDInitialSilence']||0x9c4;_0x5da202[_0xda7d('0x180')]=_0x22b0cf[_0xda7d('0x181')]||0x5dc;_0x5da202[_0xda7d('0x182')]=_0x22b0cf[_0xda7d('0x183')]||0x320;_0x5da202[_0xda7d('0x184')]=_0x22b0cf['dialAMDTotalAnalysisTime']||0x1388;_0x5da202['XMD-AMDMINWORDLENGTH']=_0x22b0cf[_0xda7d('0x185')]||0x64;_0x5da202[_0xda7d('0x186')]=_0x22b0cf['dialAMDBetweenWordsSilence']||0x32;_0x5da202[_0xda7d('0x187')]=_0x22b0cf['dialAMDMaximumNumberOfWords']||0x3;_0x5da202[_0xda7d('0x188')]=_0x22b0cf[_0xda7d('0x189')]||0x100;_0x5da202[_0xda7d('0x18a')]=_0x22b0cf[_0xda7d('0x18b')]||0x1388;}if(_0x22b0cf[_0xda7d('0x51')]===_0xda7d('0x18c')){_0x5da202[_0xda7d('0x18d')]=_0x1ee4c5[_0xda7d('0xdc')];}else{_0x5da202['XMD-CAMPAIGNID']=_0x1ee4c5[_0xda7d('0xdd')];}for(var _0x1a00bf in _0x1ee4c5[_0xda7d('0x18e')]){if(typeof _0x1ee4c5['Contact'][_0x1a00bf]!==_0xda7d('0xaf')){if(isNotNull(_0x1ee4c5[_0xda7d('0x18e')][_0x1a00bf])&&_0x1a00bf!=='id'&&_0x1a00bf!==_0xda7d('0x18f')&&_0x1a00bf!==_0xda7d('0x190')&&_0x1a00bf!==_0xda7d('0x191')){_0x5da202[util['format'](_0xda7d('0x192'),_0xda7d('0x193'),_[_0xda7d('0x194')](_0x1a00bf))]=_0x1ee4c5['Contact'][_0x1a00bf];}}}var _0x2da9d7=_0x16a312[_0xda7d('0x144')](_0x22b0cf['Trunk'])?getCallerId(_0x22b0cf[_0xda7d('0x77')][_0xda7d('0x79')],_0x22b0cf[_0xda7d('0x61')],_0x22b0cf[_0xda7d('0x195')]>0x0?getCallerIdRandom(_0x22b0cf[_0xda7d('0x62')],_0x22b0cf['dialRandomLastDigitCallerIdNumber']):_0x22b0cf['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x22b0cf['TrunkBackup'])?_0x22b0cf[_0xda7d('0x77')][_0xda7d('0x79')]:_0x22b0cf['TrunkBackup'][_0xda7d('0x79')],_0x22b0cf['dialOriginateCallerIdName'],_0x22b0cf['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x22b0cf[_0xda7d('0x62')],_0x22b0cf[_0xda7d('0x195')]):_0x22b0cf[_0xda7d('0x62')]);if(_0x2da9d7){_0x5da202[_0xda7d('0x196')]=_0x16a312[_0xda7d('0x28')][_0x297d7f][_0xda7d('0x197')]=extractCalleridName(_0x2da9d7);_0x5da202[_0xda7d('0x198')]=_0x1ee4c5[_0xda7d('0x179')];}_0x22b0cf['variables']=_0x5da202;return ami[_0xda7d('0xb1')]({'actionid':_0x297d7f,'action':_0xda7d('0x199'),'channel':_0x16a312[_0xda7d('0x144')](_0x22b0cf[_0xda7d('0x77')])?util[_0xda7d('0x7a')]('SIP/%s/%s%s',_0x22b0cf[_0xda7d('0x77')][_0xda7d('0x46')],isNotNull(_0x22b0cf['dialPrefix'])?_0x22b0cf[_0xda7d('0x19a')][_0xda7d('0x19b')]()||'':'',_0x22b0cf['dialCutDigit']>0x0?_0x1ee4c5['phone'][_0xda7d('0x19c')](_0x22b0cf[_0xda7d('0x19d')]):_0x1ee4c5[_0xda7d('0x179')]):util[_0xda7d('0x7a')](_0xda7d('0x19e'),_[_0xda7d('0xb0')](_0x22b0cf[_0xda7d('0x145')])?_0x22b0cf[_0xda7d('0x77')]['name']:_0x22b0cf[_0xda7d('0x145')][_0xda7d('0x46')],isNotNull(_0x22b0cf['dialPrefix'])?_0x22b0cf[_0xda7d('0x19a')][_0xda7d('0x19b')]()||'':'',_0x22b0cf[_0xda7d('0x19d')]>0x0?_0x1ee4c5[_0xda7d('0x179')][_0xda7d('0x19c')](_0x22b0cf[_0xda7d('0x19d')]):_0x1ee4c5[_0xda7d('0x179')]),'callerid':_0x2da9d7,'Exten':_0xda7d('0x17f'),'Context':_0xda7d('0x19f'),'Priority':'1','variable':_0x5da202,'timeout':(_0x22b0cf['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x297d7f})['then'](function(_0x5034d5){return _0x56fa34(_0x5034d5);})['catch'](function(_0x40402b){_0x22b0cf[_0xda7d('0x1a0')]+=0x1;var _0x560114=new History(_0x16a312[_0xda7d('0x28')][_0x297d7f]);logger[_0xda7d('0x98')](util[_0xda7d('0x7a')](_0xda7d('0x1a1'),JSON[_0xda7d('0x4d')](_0x40402b)));_0x560114['state']=0xe;_0x560114[_0xda7d('0xa8')]=_0xda7d('0x1a2');_0x560114[_0xda7d('0x128')]=moment()[_0xda7d('0x7a')](_0xda7d('0x101'));_0x560114['endtime']=_0x560114['starttime'];_0x16a312[_0xda7d('0xd1')](_0x560114)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1a3')));_0x16a312[_0xda7d('0xd0')](_0x560114)['catch'](loggerCatch(_0xda7d('0x1a3')))['finally'](function(){delete _0x16a312[_0xda7d('0x28')][_0x297d7f];return _0x3ebfae(msgResponse(_0xda7d('0x199'),_0xda7d('0x4c'),'originate\x20action\x20Error'));});});});};Dialer[_0xda7d('0xaa')]['syncOriginateResponse']=function(_0x2f7186){var _0x1e342f=this['actions'][_0x2f7186[_0xda7d('0x12e')]];if(_0x1e342f){delete this[_0xda7d('0x28')][_0x2f7186[_0xda7d('0x12e')]];_0x1e342f[_0xda7d('0x11d')]=moment()['format'](_0xda7d('0x101'));var _0x590de4=_0x1e342f[_0xda7d('0x51')]===_0xda7d('0x7d')?this[_0xda7d('0x103')][_0x1e342f[_0xda7d('0xb6')]]:this[_0xda7d('0x23')][_0x1e342f['getQueue']()];if(!this[_0xda7d('0xe0')](_0x2f7186[_0xda7d('0x1a4')])){this[_0xda7d('0xb5')](_0x590de4);return this[_0xda7d('0x1a5')](_0x1e342f,_0x590de4,_0x2f7186)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1a6')));}this[_0xda7d('0x2a')][_0x2f7186[_0xda7d('0xe5')]]=_0x1e342f;}};Dialer[_0xda7d('0xaa')]['checkRetriveMax']=function(_0x388209,_0x5af957,_0x50cb4f){var _0x5dd8e9=new History(_0x5af957);if(_0x5dd8e9[_0xda7d('0x106')]+_0x5dd8e9[_0xda7d('0xf8')]+_0x5dd8e9[_0xda7d('0x107')]+_0x5dd8e9['countnosuchnumberretry']+_0x5dd8e9[_0xda7d('0xfa')]+_0x5dd8e9['countabandonedretry']+_0x5dd8e9[_0xda7d('0xf5')]+_0x5dd8e9[_0xda7d('0xfb')]>=_0x50cb4f[_0xda7d('0xfc')]-0x1){return!![];}switch(_0x388209){case 0x3:if(_0x5dd8e9[_0xda7d('0x107')]>=_0x50cb4f[_0xda7d('0x1a7')]-0x1){return!![];}this[_0xda7d('0xc6')]({'active':![],'countnoanswerretry':_0x5dd8e9[_0xda7d('0x107')]+=0x1,'scheduledat':moment()[_0xda7d('0x100')](_0x50cb4f[_0xda7d('0x1a8')],'minutes')[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x5dd8e9['ContactId'],'ListId':_0x5dd8e9['ListId'],'VoiceQueueId':_0x5dd8e9[_0xda7d('0xdc')]||undefined,'CampaignId':_0x5dd8e9['CampaignId']||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1a9')));break;case 0x5:if(_0x5dd8e9[_0xda7d('0x106')]>=_0x50cb4f[_0xda7d('0x1aa')]-0x1){return!![];}this[_0xda7d('0xc6')]({'active':![],'countbusyretry':_0x5dd8e9[_0xda7d('0x106')]+=0x1,'scheduledat':moment()['add'](_0x50cb4f[_0xda7d('0x1ab')],_0xda7d('0x10b'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5dd8e9[_0xda7d('0xd9')],'ListId':_0x5dd8e9[_0xda7d('0xda')],'VoiceQueueId':_0x5dd8e9['VoiceQueueId']||undefined,'CampaignId':_0x5dd8e9[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1ac')));break;case 0x8:if(_0x5dd8e9[_0xda7d('0xf8')]>=_0x50cb4f['dialCongestionMaxRetry']-0x1){return!![];}this[_0xda7d('0xc6')]({'active':![],'countcongestionretry':_0x5dd8e9[_0xda7d('0xf8')]+=0x1,'scheduledat':moment()[_0xda7d('0x100')](_0x50cb4f['dialCongestionRetryFrequency'],_0xda7d('0x10b'))[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x5dd8e9[_0xda7d('0xd9')],'ListId':_0x5dd8e9[_0xda7d('0xda')],'VoiceQueueId':_0x5dd8e9[_0xda7d('0xdc')]||undefined,'CampaignId':_0x5dd8e9['CampaignId']||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1ad')));break;case 0x0:if(_0x5dd8e9[_0xda7d('0xf9')]>=_0x50cb4f[_0xda7d('0x1ae')]-0x1){return!![];}else{this[_0xda7d('0xc6')]({'active':![],'countnosuchnumberretry':_0x5dd8e9[_0xda7d('0xf9')]+=0x1,'scheduledat':moment()[_0xda7d('0x100')](_0x50cb4f[_0xda7d('0x1af')],_0xda7d('0x10b'))[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x5dd8e9[_0xda7d('0xd9')],'ListId':_0x5dd8e9['ListId'],'VoiceQueueId':_0x5dd8e9[_0xda7d('0xdc')]||undefined,'CampaignId':_0x5dd8e9[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1b0')));}break;case 0xa:if(_0x5dd8e9['countdropretry']>=_0x50cb4f[_0xda7d('0x126')]-0x1){return!![];}this[_0xda7d('0xc6')]({'active':![],'countdropretry':_0x5dd8e9['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x50cb4f[_0xda7d('0x1b1')],'minutes')[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x5dd8e9[_0xda7d('0xd9')],'ListId':_0x5dd8e9[_0xda7d('0xda')],'VoiceQueueId':_0x5dd8e9[_0xda7d('0xdc')]||undefined,'CampaignId':_0x5dd8e9[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x127')));break;case 0xb:if(_0x5dd8e9['countabandonedretry']>=_0x50cb4f[_0xda7d('0x1b2')]-0x1){return!![];}this[_0xda7d('0xc6')]({'active':![],'countabandonedretry':_0x5dd8e9[_0xda7d('0x1b3')]+=0x1,'scheduledat':moment()[_0xda7d('0x100')](_0x50cb4f[_0xda7d('0x12b')],'minutes')[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x5dd8e9[_0xda7d('0xd9')],'ListId':_0x5dd8e9[_0xda7d('0xda')],'VoiceQueueId':_0x5dd8e9['VoiceQueueId']||undefined,'CampaignId':_0x5dd8e9[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x12c')));break;case 0x13:if(_0x5dd8e9[_0xda7d('0xf5')]>=_0x50cb4f[_0xda7d('0x109')]-0x1){return!![];}this[_0xda7d('0xc6')]({'active':![],'countmachineretry':_0x5dd8e9[_0xda7d('0xf5')]+=0x1,'scheduledat':moment()[_0xda7d('0x100')](_0x50cb4f[_0xda7d('0x10a')],_0xda7d('0x10b'))['format'](_0xda7d('0x101')),'ContactId':_0x5dd8e9[_0xda7d('0xd9')],'ListId':_0x5dd8e9[_0xda7d('0xda')],'VoiceQueueId':_0x5dd8e9['VoiceQueueId']||undefined,'CampaignId':_0x5dd8e9[_0xda7d('0xdd')]||undefined})['catch'](loggerCatch(_0xda7d('0x102')));break;case 0x14:if(_0x5dd8e9['countagentrejectretry']>=_0x50cb4f['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xda7d('0xc6')]({'active':![],'countagentrejectretry':_0x5dd8e9[_0xda7d('0xfb')]+=0x1,'scheduledat':moment()[_0xda7d('0x100')](_0x50cb4f[_0xda7d('0x1b4')],_0xda7d('0x10b'))[_0xda7d('0x7a')](_0xda7d('0x101')),'ContactId':_0x5dd8e9[_0xda7d('0xd9')],'ListId':_0x5dd8e9['ListId'],'VoiceQueueId':_0x5dd8e9[_0xda7d('0xdc')]||undefined,'CampaignId':_0x5dd8e9[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1b5')));break;default:return!![];}};Dialer[_0xda7d('0xaa')][_0xda7d('0x1a5')]=function(_0x5f2ee0,_0x1e2c30,_0xa23db9){var _0x31f9ec=this;var _0x3cd62c=new History(_0x5f2ee0);var _0x258464=![];var _0x5d705d;var _0x5d75bc;return new Promise(function(_0xeb7162,_0x3ed3e1){if(_['isUndefined'](_0x1e2c30)&&typeof _0x1e2c30!==_0xda7d('0x177')){return _0x3ed3e1(msgResponse(_0xda7d('0x1b6'),'Failure','entity\x20is\x20undefine'));}if(_[_0xda7d('0x43')](_0xa23db9)&&typeof _0xa23db9!==_0xda7d('0x177')){return _0x3ed3e1(msgResponse('[callProgressDetecting]',_0xda7d('0x14b'),_0xda7d('0x1b7')));}_0x31f9ec[_0xda7d('0xbf')](_0x3cd62c,_0xa23db9['reason'],_0x1e2c30)[_0xda7d('0x41')](function(_0x40d62d){if(_0x40d62d[_0xda7d('0x125')]==0x1)_0x258464=!![];switch(_0xa23db9[_0xda7d('0x1b8')]){case'0':_0x1e2c30['outboundNoSuchCallsDay']+=0x1;_0x3cd62c['state']=0x0;_0x3cd62c[_0xda7d('0xa8')]=_0xda7d('0x1b9');_0x3cd62c[_0xda7d('0xf9')]+=0x1;_0x3cd62c[_0xda7d('0xf6')]+=0x1;ami[_0xda7d('0x50')](_0xda7d('0x1ba'),ut[_0xda7d('0xec')](_0x5f2ee0,'nosuchnumber'));_0x5d705d=_0x1e2c30[_0xda7d('0x1af')];_0x5d75bc=_0x1e2c30['callAdditionalPhoneAfterMin'];_0x31f9ec[_0xda7d('0xd1')](_0x3cd62c)[_0xda7d('0xbb')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x31f9ec['checkRetriveMax'](0x0,_0x5f2ee0,_0x1e2c30)&&!_0x258464){if(_0x3cd62c['countnosuchnumberretry']>=_0x1e2c30[_0xda7d('0x1ae')]){_0x31f9ec[_0xda7d('0xfe')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1bb'));}else{_0x31f9ec[_0xda7d('0xfd')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1bb'));}}break;case'3':_0x1e2c30[_0xda7d('0x1bc')]+=0x1;_0x3cd62c[_0xda7d('0xa7')]=0x3;_0x3cd62c[_0xda7d('0xa8')]=_0xda7d('0x1bd');_0x3cd62c[_0xda7d('0x107')]+=0x1;_0x3cd62c[_0xda7d('0xf6')]+=0x1;var _0xe9eb22=ut['buildNoAnswerEventPayload'](_0x5f2ee0,_0x1e2c30);ami[_0xda7d('0x50')]('custom:agentnoanswer',_0xe9eb22);_0x5d705d=_0x1e2c30[_0xda7d('0x1a8')];_0x5d75bc=_0x1e2c30[_0xda7d('0x123')];_0x31f9ec[_0xda7d('0xd1')](_0x3cd62c)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1be')));if(_0x31f9ec[_0xda7d('0x1bf')](0x3,_0x5f2ee0,_0x1e2c30)&&!_0x258464){if(_0x3cd62c['countnoanswerretry']>=_0x1e2c30['dialNoAnswerMaxRetry']){_0x31f9ec[_0xda7d('0xfe')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1c0'));}else{_0x31f9ec[_0xda7d('0xfd')](_0x3cd62c,_0xeb7162,_0x3ed3e1,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1e2c30['outboundBusyCallsDay']+=0x1;_0x3cd62c[_0xda7d('0xa7')]=0x5;_0x3cd62c[_0xda7d('0xa8')]=_0xda7d('0x1c1');_0x3cd62c[_0xda7d('0x106')]+=0x1;_0x3cd62c[_0xda7d('0xf6')]+=0x1;ami[_0xda7d('0x50')](_0xda7d('0x1c2'),ut['buildObj'](_0x5f2ee0,_0xda7d('0x1c3')));_0x5d705d=_0x1e2c30[_0xda7d('0x1ab')];_0x5d75bc=_0x1e2c30[_0xda7d('0x123')];_0x31f9ec[_0xda7d('0xd1')](_0x3cd62c)['catch'](loggerCatch(_0xda7d('0x1c4')));if(_0x31f9ec[_0xda7d('0x1bf')](0x5,_0x5f2ee0,_0x1e2c30)&&!_0x258464){if(_0x3cd62c[_0xda7d('0x106')]>=_0x1e2c30[_0xda7d('0x1aa')]){_0x31f9ec[_0xda7d('0xfe')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1c5'));}else{_0x31f9ec[_0xda7d('0xfd')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1c5'));}}break;case'8':_0x1e2c30['outboundCongestionCallsDay']+=0x1;_0x3cd62c['state']=0x8;_0x3cd62c['statedesc']=_0xda7d('0x1c6');_0x3cd62c[_0xda7d('0xf8')]+=0x1;_0x3cd62c[_0xda7d('0xf6')]+=0x1;_0x5d705d=_0x1e2c30['dialCongestionRetryFrequency'];_0x5d75bc=_0x1e2c30[_0xda7d('0x123')];ami[_0xda7d('0x50')](_0xda7d('0x1c7'),ut[_0xda7d('0xec')](_0x5f2ee0,_0xda7d('0x1c8')));_0x31f9ec[_0xda7d('0xd1')](_0x3cd62c)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1c9')));if(_0x31f9ec[_0xda7d('0x1bf')](0x8,_0x5f2ee0,_0x1e2c30)&&!_0x258464){if(_0x3cd62c[_0xda7d('0xf8')]>=_0x1e2c30['dialCongestionMaxRetry']){_0x31f9ec[_0xda7d('0xfe')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1ca'));}else{_0x31f9ec[_0xda7d('0xfd')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1ca'));}}break;case'11':_0x1e2c30[_0xda7d('0x1cb')]+=0x1;_0x3cd62c[_0xda7d('0xa7')]=0xb;_0x3cd62c[_0xda7d('0xa8')]=_0xda7d('0x1cc');_0x3cd62c[_0xda7d('0x1b3')]+=0x1;_0x3cd62c[_0xda7d('0xf6')]+=0x1;_0x5d705d=_0x1e2c30[_0xda7d('0x12b')];_0x5d75bc=_0x1e2c30[_0xda7d('0x123')];_0x31f9ec[_0xda7d('0xd1')](_0x3cd62c)['catch'](loggerCatch(_0xda7d('0x1cd')));if(_0x31f9ec['checkRetriveMax'](0xb,_0x5f2ee0,_0x1e2c30)&&!_0x258464){if(_0x3cd62c[_0xda7d('0x1b3')]>=_0x1e2c30[_0xda7d('0x1b2')]){_0x31f9ec[_0xda7d('0xfe')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1ce'));}else{_0x31f9ec[_0xda7d('0xfd')](_0x3cd62c,_0xeb7162,_0x3ed3e1,'reason\x2011\x20abandoned');}}break;case'20':_0x1e2c30[_0xda7d('0x6a')]+=0x1;_0x3cd62c[_0xda7d('0xa7')]=0x14;_0x3cd62c[_0xda7d('0xa8')]=_0xda7d('0x1cf');_0x3cd62c[_0xda7d('0xfb')]+=0x1;_0x3cd62c[_0xda7d('0xf6')]+=0x1;_0x5d705d=_0x1e2c30[_0xda7d('0x1b4')];_0x5d75bc=_0x1e2c30[_0xda7d('0x123')];ami[_0xda7d('0x50')](_0xda7d('0x1d0'),ut['buildObj'](_0x5f2ee0,_0xda7d('0x1d1')));_0x31f9ec[_0xda7d('0xd1')](_0x3cd62c)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1d2')));if(_0x31f9ec[_0xda7d('0x1bf')](0x14,_0x5f2ee0,_0x1e2c30)&&!_0x258464){if(_0x3cd62c[_0xda7d('0xfb')]>=_0x1e2c30[_0xda7d('0x1d3')]){_0x31f9ec['createStateFinal'](_0x3cd62c,_0xeb7162,_0x3ed3e1,'reason\x2020\x20agentreject');}else{_0x31f9ec[_0xda7d('0xfd')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xda7d('0x1d4'));}}break;default:_0x1e2c30['outboundUnknownCallsDay']+=0x1;_0x3cd62c[_0xda7d('0xa7')]=0xc;_0x3cd62c['statedesc']=_0xa23db9['reason'];_0x5d705d=_0x1e2c30[_0xda7d('0x1b4')];_0x5d75bc=_0x1e2c30[_0xda7d('0x123')];_0x31f9ec[_0xda7d('0xd1')](_0x3cd62c)[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1d5')));if(_0x31f9ec[_0xda7d('0x1bf')](_0xa23db9[_0xda7d('0x1b8')],_0x5f2ee0,_0x1e2c30)&&!_0x258464){if(_0x3cd62c[_0xda7d('0x106')]+_0x3cd62c['countcongestionretry']+_0x3cd62c['countnoanswerretry']+_0x3cd62c['countnosuchnumberretry']+_0x3cd62c[_0xda7d('0xfa')]+_0x3cd62c[_0xda7d('0x1b3')]+_0x3cd62c[_0xda7d('0xf5')]+_0x3cd62c[_0xda7d('0xfb')]>=_0x1e2c30[_0xda7d('0xfc')]){_0x31f9ec[_0xda7d('0xfd')](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xa23db9['reason']);}else{_0x31f9ec['createStateFinal'](_0x3cd62c,_0xeb7162,_0x3ed3e1,_0xa23db9[_0xda7d('0x1b8')]);}}}})['then'](function(){if(_0x258464){_0x31f9ec['swapAdditionalPhones'](_0x3cd62c,_0x5d705d,_0x5d75bc)[_0xda7d('0x41')](function(){return _0xeb7162(0x1);});}});});};Dialer[_0xda7d('0xaa')][_0xda7d('0xfd')]=function(_0x5d97d1,_0x52ccec,_0x2f9e2c,_0x7fc92e){var _0x3f5e2a=new Final(_0x5d97d1);_0x3f5e2a[_0xda7d('0xa7')]=0xf;_0x3f5e2a[_0xda7d('0xa8')]=_0xda7d('0x1d6');this['createStateFinal'](_0x3f5e2a,_0x52ccec,_0x2f9e2c,_0x7fc92e);};Dialer[_0xda7d('0xaa')][_0xda7d('0xfe')]=function(_0x15ef0d,_0x2aed9b,_0xac8d2c,_0x5bb284){this[_0xda7d('0xd0')](_0x15ef0d)[_0xda7d('0x41')](function(){return _0x2aed9b(msgResponse('[callProgressDetecting]',_0xda7d('0xe1'),_0x5bb284));})[_0xda7d('0xbb')](function(){return _0xac8d2c(msgResponse(_0xda7d('0x1d7'),_0xda7d('0x14b'),_0xda7d('0x1d8')));});};Dialer['prototype']['predictive']=function(_0xc8c9bc){var _0xb99df9=_0xc8c9bc[_0xda7d('0x1d9')]/0x64;var _0x1148e0=_0xc8c9bc['outboundDropCallsDayTimeout']/(_0xc8c9bc[_0xda7d('0x67')]+_0xc8c9bc[_0xda7d('0x64')]);var _0x49b2a1=Math[_0xda7d('0x1da')](_0xc8c9bc[_0xda7d('0x73')]*(_0xc8c9bc['predictiveIntervalMaxThreshold']/0x64));var _0x527744=Math['round'](_0xc8c9bc[_0xda7d('0x73')]*(_0xc8c9bc[_0xda7d('0x1db')]/0x64));var _0x15789d=_0xc8c9bc['available']+_0xc8c9bc['talking'];var _0xfd1eb9=Math['floor'](_0xc8c9bc['erlangCalls']*_0xc8c9bc[_0xda7d('0x8b')]*_0xc8c9bc['predictiveIntervalHitRate']*_0xc8c9bc[_0xda7d('0x71')]);if(_['isUndefined'](_0xc8c9bc[_0xda7d('0x8e')])){if(!_[_0xda7d('0x43')](_0xc8c9bc[_0xda7d('0x2b')])){_0xc8c9bc['startPredictive']=undefined;loggerPredictive['error'](_0xda7d('0x1dc'),_0xda7d('0x1dd'));}if(!_[_0xda7d('0x43')](_0xc8c9bc[_0xda7d('0x91')])){loggerPredictive[_0xda7d('0x98')]('[startMethodPredictive][StartProgressive]',_0xda7d('0x1de'));clearInterval(_0xc8c9bc[_0xda7d('0x91')]);_0xc8c9bc[_0xda7d('0x91')]=undefined;}_0xc8c9bc[_0xda7d('0x8e')]=moment()[_0xda7d('0x7a')](_0xda7d('0x101'));loggerPredictive[_0xda7d('0x80')](_0xc8c9bc[_0xda7d('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0xc8c9bc['startProgressive']);this['handlePower'](_0xc8c9bc,0x1);}else if(ifInterval(_0xc8c9bc['dialPredictiveInterval'],_0xc8c9bc[_0xda7d('0x8e')])){this[_0xda7d('0x160')](_0xc8c9bc,0x1);loggerPredictiveCalls[_0xda7d('0x80')]('[startMethodPredictive][StartProgressive][Loop]',_0xc8c9bc[_0xda7d('0x8e')],_0xc8c9bc['name']);_0xc8c9bc[_0xda7d('0x74')]=0x0;_0xc8c9bc[_0xda7d('0x11f')]=0x0;}else if(_0xb99df9<_0x1148e0&&_0xc8c9bc[_0xda7d('0x1df')]==='dropRate'){freeVariablesPredictive(_0xc8c9bc);loggerPredictive['info'](_0xda7d('0x1e0'),_0xda7d('0x1e1'),_0x1148e0,'startProgressive',_0xc8c9bc['name']);}else if(_0xfd1eb9<_0xc8c9bc[_0xda7d('0x11f')]&&_0xc8c9bc[_0xda7d('0x1df')]==='dropRate'){freeVariablesPredictive(_0xc8c9bc);loggerPredictive[_0xda7d('0x80')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xda7d('0x1e2'),_0xfd1eb9,_0xda7d('0x1e3'),_0xc8c9bc[_0xda7d('0x11f')],_0xda7d('0x8e'),_0xc8c9bc[_0xda7d('0x46')]);}else if(!ifInterval(_0xc8c9bc[_0xda7d('0x1e4')],_0xc8c9bc[_0xda7d('0x8e')])&&_[_0xda7d('0x43')](_0xc8c9bc['startPredictive'])&&!_[_0xda7d('0x43')](_0xc8c9bc[_0xda7d('0x8e')])){_0xc8c9bc['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xda7d('0x80')](_0xc8c9bc[_0xda7d('0x46')],_0xda7d('0x1e5'),_0xc8c9bc[_0xda7d('0x2b')]);this[_0xda7d('0xc4')](_0xc8c9bc[_0xda7d('0x1e4')])['then'](this[_0xda7d('0x1e6')](_0xc8c9bc))['then'](mergeDataErlangB(_0xc8c9bc))['then'](this[_0xda7d('0x1e7')](_0xc8c9bc))[_0xda7d('0xbb')](loggerCatchPredictive(_0xda7d('0x1e8'),_0xc8c9bc));}else if(!ifInterval(_0xc8c9bc[_0xda7d('0x1e4')],_0xc8c9bc[_0xda7d('0x2b')])){_0xc8c9bc[_0xda7d('0x11f')]=0x0;_0xc8c9bc[_0xda7d('0x2b')]=moment()[_0xda7d('0x7a')](_0xda7d('0x101'));loggerPredictive['info'](_0xc8c9bc[_0xda7d('0x46')],_0xda7d('0x1e9'),_0xc8c9bc[_0xda7d('0x2b')]);clearInterval(_0xc8c9bc[_0xda7d('0x91')]);_0xc8c9bc['handlePredictive']=undefined;this[_0xda7d('0xc4')](_0xc8c9bc['dialPredictiveInterval'])[_0xda7d('0x41')](this[_0xda7d('0x1e6')](_0xc8c9bc))[_0xda7d('0x41')](mergeDataErlangB(_0xc8c9bc))['then'](this['startMethodPredictive'](_0xc8c9bc))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xc8c9bc));}else if(_0xc8c9bc[_0xda7d('0x73')]&&_0x15789d<_0xc8c9bc[_0xda7d('0x73')]-_0x527744){freeVariablesPredictive(_0xc8c9bc);loggerPredictive[_0xda7d('0x80')](_0xc8c9bc[_0xda7d('0x46')],_0xda7d('0x1ea'),_0x15789d,')\x20are\x20less\x20than\x20threshold\x20(',_0xc8c9bc['predictiveIntervalAvailable'],'-',_0x527744,'=',_0xc8c9bc[_0xda7d('0x73')]-_0x527744,')');}else if(_0xc8c9bc[_0xda7d('0x73')]&&_0x15789d>_0xc8c9bc[_0xda7d('0x73')]+_0x49b2a1){freeVariablesPredictive(_0xc8c9bc);loggerPredictive[_0xda7d('0x80')](_0xc8c9bc[_0xda7d('0x46')],_0xda7d('0x1ea'),_0x15789d,_0xda7d('0x1eb'),_0xc8c9bc[_0xda7d('0x73')],'+',_0x49b2a1,'=',_0xc8c9bc[_0xda7d('0x73')]+_0x49b2a1,')');}};Dialer[_0xda7d('0xaa')][_0xda7d('0x1e6')]=function(_0x4f4bbc){var _0x54c475=this;return function(_0x11b7f0){return new Promise(function(_0x5d53f8,_0x2abda){_[_0xda7d('0x8d')](_0x4f4bbc,_0x11b7f0[0x0]);if(checkGetDataPredictive(_0x11b7f0[0x0])){var _0x275070=_0x4f4bbc[_0xda7d('0x73')]=_0x4f4bbc[_0xda7d('0x59')]+_0x4f4bbc[_0xda7d('0x54')];var _0x44f7c5=_0x4f4bbc[_0xda7d('0x1e4')]*0x3c;var _0x27afa1=_0x11b7f0[0x0][_0xda7d('0x87')]+_0x11b7f0[0x0][_0xda7d('0x6d')];var _0x279aac=(_0x11b7f0[0x0][_0xda7d('0x6c')]+_0x11b7f0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x11b7f0[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x11b7f0[0x0][_0xda7d('0x86')];_0x4f4bbc[_0xda7d('0x70')]=_0x279aac>0x0?_0x279aac:0x1;switch(_0x4f4bbc[_0xda7d('0x1df')]){case'dropRate':var _0x512c8a=_0x4f4bbc[_0xda7d('0x1d9')]/0x64;return _0x54c475[_0xda7d('0x1ec')](_0x275070,_0x44f7c5,_0x27afa1,_0x279aac,_0x512c8a)[_0xda7d('0x41')](function(_0x43215e){return _0x5d53f8(_0x43215e);});case _0xda7d('0x1ed'):var _0x3ae635=_0x4f4bbc[_0xda7d('0x1d9')]/0x64;return _0x54c475[_0xda7d('0x1ee')](_0x275070,_0x44f7c5,_0x27afa1,_0x279aac,_0x3ae635)[_0xda7d('0x41')](function(_0x2845e8){return _0x5d53f8(_0x2845e8);});default:return _0x2abda(msgResponse('[getDataPredictive]',_0xda7d('0x14b'),'Unknown\x20Predictive'));}}else{return _0x2abda(msgResponse(_0xda7d('0x1ef'),_0xda7d('0x14b'),_0xda7d('0x1f0')));}});};};Dialer['prototype'][_0xda7d('0x1f1')]=function(_0x10eab4){var _0x43d6d3=this;return function(_0x2e4837){return new Promise(function(_0x418dcb,_0x7964dc){_[_0xda7d('0x8d')](_0x10eab4,_0x2e4837[0x0]);if(checkGetDataPredictive(_0x2e4837[0x0])){loggerPredictive['info'](JSON[_0xda7d('0x4d')](_0x2e4837[0x0]));if(_0x10eab4[_0xda7d('0x1df')]==='dropRate'){return _0x43d6d3['getVoiceQueueRtPauses'](_0x10eab4['id'])[_0xda7d('0x41')](function(_0x4b75cf){var _0x5203b5=_0x10eab4[_0xda7d('0x55')]-_0x4b75cf[0x0][_0xda7d('0x1f2')];var _0x3a74fd=_0x10eab4[_0xda7d('0x1e4')]*0x3c;var _0x4989a3=_0x2e4837[0x0][_0xda7d('0x87')]+_0x2e4837[0x0][_0xda7d('0x6d')];var _0x492f4d=(_0x2e4837[0x0][_0xda7d('0x6c')]+_0x2e4837[0x0][_0xda7d('0x6f')]+_0x2e4837[0x0][_0xda7d('0x6e')])/_0x2e4837[0x0]['predictiveIntervalTotalCalls'];var _0x194bf7=_0x10eab4['dialPredictiveOptimizationPercentage']/0x64;_0x10eab4[_0xda7d('0x72')]=_0x4b75cf[0x0][_0xda7d('0x1f2')]||0x0;_0x10eab4['predictiveIntervalHitRate']=_0x492f4d>0x0?_0x492f4d:0x1;return _0x43d6d3['abandonmentRate'](_0x5203b5,_0x3a74fd,_0x4989a3,_0x492f4d,_0x194bf7);})[_0xda7d('0x41')](function(_0x4e71e5){return _0x418dcb(_0x4e71e5);})[_0xda7d('0xbb')](function(_0x3821eb){return _0x7964dc(msgResponse(_0xda7d('0x1f3'),_0xda7d('0x14b'),JSON[_0xda7d('0x4d')](_0x3821eb)));});}if(_0x10eab4['dialPredictiveOptimization']==='agentBusyFactor'){return _0x43d6d3['getVoiceQueueRtPauses'](_0x10eab4['id'])[_0xda7d('0x41')](function(_0x121bab){var _0x226e00=_0x10eab4[_0xda7d('0x55')]-_0x121bab[0x0]['outboundQueuePauses'];var _0x39f591=_0x10eab4[_0xda7d('0x1e4')]*0x3c;var _0x14ade3=_0x2e4837[0x0][_0xda7d('0x87')]+_0x2e4837[0x0][_0xda7d('0x6d')];var _0x5dbf0e=(_0x2e4837[0x0]['predictiveIntervalAnsweredCalls']+_0x2e4837[0x0][_0xda7d('0x6f')]+_0x2e4837[0x0][_0xda7d('0x6e')])/_0x2e4837[0x0][_0xda7d('0x86')];var _0x4e6dab=_0x10eab4[_0xda7d('0x1d9')]/0x64;_0x10eab4[_0xda7d('0x72')]=_0x121bab[0x0][_0xda7d('0x1f2')]||0x0;_0x10eab4['predictiveIntervalHitRate']=_0x5dbf0e>0x0?_0x5dbf0e:0x1;return _0x43d6d3[_0xda7d('0x1ee')](_0x226e00,_0x39f591,_0x14ade3,_0x5dbf0e,_0x4e6dab);})['then'](function(_0x1f557d){return _0x418dcb(_0x1f557d);})[_0xda7d('0xbb')](function(_0x208ebc){return _0x7964dc(msgResponse(_0xda7d('0x1f3'),'Failure',JSON[_0xda7d('0x4d')](_0x208ebc)));});}}else{return _0x7964dc(msgResponse('[getDataPredictive]','Failure',_0xda7d('0x1f0')));}});};};Dialer['prototype'][_0xda7d('0x1e7')]=function(_0x47f97e){var _0x44ac39=this;return function(){var _0x1fd8ef=0x0;var _0x3fbba8=Math['floor'](_0x47f97e['erlangCallToSecond']*0x3e8);if(_0x3fbba8>0x0){_0x3fbba8=_0x3fbba8<0x64?0x64:_0x3fbba8;loggerPredictive['info'](_0x47f97e[_0xda7d('0x46')],_0xda7d('0x1f4'),_0x3fbba8,_0xda7d('0x4e'));_0x47f97e[_0xda7d('0x91')]=setInterval(function(){_0x44ac39['handlePredictive'](_0x47f97e);loggerPredictiveCalls[_0xda7d('0x80')]('[handlePredictive]',_0x1fd8ef+=0x1);},_0x3fbba8);}else{loggerPredictive['info'](_0x47f97e[_0xda7d('0x46')],_0xda7d('0x1f5'));}};};Dialer['prototype'][_0xda7d('0x1f6')]=function(_0x150651,_0x11cc5d){var _0x572291=this;return function(_0x45a2f9){if(_[_0xda7d('0x7f')](_0x45a2f9)){if(_[_0xda7d('0xb0')](_0x11cc5d[_0xda7d('0xdb')])||!_0x11cc5d[_0xda7d('0x1f7')]){if(_0x150651[_0xda7d('0x60')]==='booked'){_0x150651[_0xda7d('0x134')]=_[_0xda7d('0x43')](_0x150651[_0xda7d('0x134')])?!![]:_0x150651['queueStatusComplete'];var _0x44dee3=uuid['v4']();_0x572291[_0xda7d('0x28')][_0x44dee3]=new Action(_0x150651,_0x11cc5d,_0x44dee3);loggerBooked[_0xda7d('0x80')](_0xda7d('0x1f8'),_0x44dee3,_0xda7d('0x1f9'),JSON[_0xda7d('0x4d')](_0x150651[_0xda7d('0x134')]),_0xda7d('0x1fa'),_0x150651[_0xda7d('0x46')]);if(_0x150651[_0xda7d('0x134')]){_0x150651[_0xda7d('0x134')]=![];_0x572291[_0xda7d('0x2c')][_0x572291['actions'][_0x44dee3][_0xda7d('0xb6')]]=[];ami[_0xda7d('0xb1')]({'actionid':_0x44dee3,'action':'queuestatus','queue':_0x150651[_0xda7d('0x46')]})[_0xda7d('0xbb')](function(){_0x572291[_0xda7d('0xb5')](_0x150651);_0x572291[_0xda7d('0xc6')]({'active':![],'ContactId':_0x572291[_0xda7d('0x28')][_0x44dee3][_0xda7d('0xd9')],'ListId':_0x572291[_0xda7d('0x28')][_0x44dee3][_0xda7d('0xda')],'VoiceQueueId':_0x572291[_0xda7d('0x28')][_0x44dee3]['VoiceQueueId']||undefined,'CampaignId':_0x572291['actions'][_0x44dee3][_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1fb')));delete _0x572291[_0xda7d('0x28')][_0x44dee3];});}else{loggerBooked[_0xda7d('0x80')]('[booked][checkContactBlack][else]',JSON[_0xda7d('0x4d')](_0x150651[_0xda7d('0x134')]),'Queue:\x20',_0x150651['name']);_0x572291[_0xda7d('0xb5')](_0x150651);_0x572291[_0xda7d('0xc6')]({'active':![],'ContactId':_0x572291[_0xda7d('0x28')][_0x44dee3][_0xda7d('0xd9')],'ListId':_0x572291['actions'][_0x44dee3]['ListId'],'VoiceQueueId':_0x572291[_0xda7d('0x28')][_0x44dee3][_0xda7d('0xdc')]||undefined,'CampaignId':_0x572291[_0xda7d('0x28')][_0x44dee3][_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch(_0xda7d('0x1fb')));delete _0x572291[_0xda7d('0x28')][_0x44dee3];}}else{return _0x572291['actionOriginate'](_0x150651,_0x11cc5d);}}else{if(getDiff(_0x11cc5d[_0xda7d('0x1fc')])<_0x150651['dialRecallMeTimeout']*0x3c){if(_0x11cc5d['Agent']&&!_0x11cc5d['Agent'][_0xda7d('0x1fd')]){_0x572291[_0xda7d('0x22')]['run'](_0x11cc5d['id'])['finally'](function(){_0x572291['updateOriginated'](_0x150651);});}else{_0x572291[_0xda7d('0xc8')]({'active':![]},_0x11cc5d['id'],0x1)[_0xda7d('0x20')](function(){_0x572291['updateOriginated'](_0x150651);});}}else{_0x150651[_0xda7d('0x69')]+=0x1;_0x572291[_0xda7d('0xb5')](_0x150651);if(_0x150651[_0xda7d('0x1fe')]){_0x572291[_0xda7d('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x11cc5d['ContactId'],'ListId':_0x11cc5d[_0xda7d('0xda')],'VoiceQueueId':_0x11cc5d['VoiceQueueId']||undefined,'CampaignId':_0x11cc5d[_0xda7d('0xdd')]||undefined})[_0xda7d('0xbb')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x572291[_0xda7d('0xd1')](createObjHistory(_0x150651,_0x11cc5d,'RECALLINQUEUE',0x17,'RecallInQueue'))[_0xda7d('0xbb')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x572291['saveInDb'](createObjHistory(_0x150651,_0x11cc5d,_0xda7d('0x1ff'),0x16,'RecallFailedTimeout'),_0xda7d('0x200'),_0xda7d('0x201'));}}}}else{_0x150651[_0xda7d('0x202')]+=0x1;_0x572291[_0xda7d('0xd7')](createObjHistory(_0x150651,_0x11cc5d,_0xda7d('0x203'),0xd,_0xda7d('0x204')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0xda7d('0x205');}};};Dialer[_0xda7d('0xaa')][_0xda7d('0x206')]=function(_0x13ce14){var _0x3f80a8=this;var _0x202f2d=_0x13ce14[_0xda7d('0x207')]-_0x13ce14[_0xda7d('0x9b')]-_0x13ce14[_0xda7d('0xcb')];emitCampaignSummary(_0x13ce14);if(_0x202f2d>0x0){if(_0x202f2d>this[_0xda7d('0x26')]){_0x202f2d=this[_0xda7d('0x26')];}_0x13ce14[_0xda7d('0xcb')]+=_0x202f2d;this['getContactDialerIvr'](_0x13ce14['id'],_0x202f2d,_0x13ce14[_0xda7d('0x208')],_0x13ce14)[_0xda7d('0x41')](function(_0x47edb4){_0x13ce14['temp']-=_0x202f2d;_0x13ce14[_0xda7d('0xcb')]=_0x13ce14[_0xda7d('0xcb')]>0x0?_0x13ce14['temp']:0x0;if(!checkContactEmpty(_0x47edb4)){_0x13ce14['message']=_0xda7d('0xa0');logger[_0xda7d('0x80')](_0xda7d('0x209')+_0x13ce14[_0xda7d('0x46')]);}else{_0x13ce14[_0xda7d('0x9b')]+=_0x47edb4['length'];_0x13ce14[_0xda7d('0x44')]=_0xda7d('0x20a');for(var _0x492593=0x0;_0x492593<_0x47edb4['length'];_0x492593+=0x1){_0x13ce14[_0xda7d('0x20b')]+=0x1;if(_['isNil'](_0x47edb4[_0x492593])||_[_0xda7d('0xb0')](_0x47edb4[_0x492593][_0xda7d('0x18e')])||_[_0xda7d('0xb0')](_0x47edb4[_0x492593][_0xda7d('0x179')])){_0x3f80a8[_0xda7d('0xd5')](_0xda7d('0x20c'),_0x13ce14,_0x47edb4[_0x492593]);}else{_0x3f80a8[_0xda7d('0xc3')](_[_0xda7d('0xd8')](_0x47edb4[_0x492593],[_0xda7d('0xdd'),'phone']))[_0xda7d('0x41')](_0x3f80a8[_0xda7d('0x1f6')](_0x13ce14,_0x47edb4[_0x492593]))[_0xda7d('0xbb')](_0x3f80a8[_0xda7d('0xd4')]('[actionOriginateIvr]\x20',_0x13ce14));}}}})[_0xda7d('0xbb')](loggerGetContactDialer('[getContactCampaign2]',_0x13ce14,_0x202f2d));}};Dialer[_0xda7d('0xaa')][_0xda7d('0x160')]=function(_0x10377a,_0x295213){var _0x45a6e8=this;var _0x58890f=[];var _0x324488=_0x295213>=0x1?_0x295213:0x1;if(_0x10377a['dialMethod']===_0xda7d('0x9')){_0x324488=0x1;}var _0x2ac6ef=Math[_0xda7d('0x20d')](_0x10377a['available']*_0x324488)-_0x10377a[_0xda7d('0x9b')]-_0x10377a['temp'];emitVoiceQueueSummary(_0x10377a);if(_0x10377a[_0xda7d('0x20e')]>0x0){var _0x2e510e=_0x10377a[_0xda7d('0x20e')]-_0x10377a['originated']-_0x10377a[_0xda7d('0x59')]-_0x10377a[_0xda7d('0xcb')]-_0x10377a[_0xda7d('0x56')];if(_0x2ac6ef>_0x2e510e){_0x2ac6ef=_0x2e510e;}}if(_0x2ac6ef>0x0){if(_0x10377a[_0xda7d('0x60')]===_0xda7d('0x9')){_0x2ac6ef=0x1;}if(_0x2ac6ef>this[_0xda7d('0x26')]){_0x2ac6ef=this[_0xda7d('0x26')];}_0x10377a[_0xda7d('0xcb')]+=_0x2ac6ef;for(var _0xa0a01d in this[_0xda7d('0x24')]){if(typeof this['agents'][_0xa0a01d]!==_0xda7d('0xaf')){if(this['agents'][_0xa0a01d][_0xda7d('0xa7')]===_0xda7d('0x20f')&&this[_0xda7d('0x24')][_0xa0a01d][_0xda7d('0xb2')]===_0xda7d('0xe3')){_0x58890f['push'](this[_0xda7d('0x24')][_0xa0a01d]['id']);}}}this[_0xda7d('0xca')](_0x10377a['id'],_0x58890f,_0x2ac6ef,_0x10377a[_0xda7d('0x208')],_0x10377a)[_0xda7d('0x41')](function(_0x26d183){_0x10377a[_0xda7d('0xcb')]-=_0x2ac6ef;_0x10377a['temp']=_0x10377a[_0xda7d('0xcb')]>0x0?_0x10377a[_0xda7d('0xcb')]:0x0;if(!checkContactEmpty(_0x26d183)){_0x45a6e8[_0xda7d('0xb9')](_0x10377a)[_0xda7d('0x41')](sendMessageReschedule(_0x10377a))[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xbc')));}else{_0x10377a[_0xda7d('0x9b')]+=_0x26d183[_0xda7d('0x9a')];_0x10377a[_0xda7d('0x44')]=_0x10377a[_0xda7d('0x60')]===_0xda7d('0x9')?'ACTIVE':_0xda7d('0x20a');for(var _0x545680=0x0;_0x545680<_0x26d183[_0xda7d('0x9a')];_0x545680+=0x1){if(_[_0xda7d('0xb0')](_0x26d183[_0x545680])||_[_0xda7d('0xb0')](_0x26d183[_0x545680][_0xda7d('0x18e')])||_[_0xda7d('0xb0')](_0x26d183[_0x545680]['phone'])){_0x45a6e8[_0xda7d('0xd5')](_0xda7d('0x20c'),_0x10377a,_0x26d183[_0x545680]);}else{_0x45a6e8[_0xda7d('0xbd')](_[_0xda7d('0xd8')](_0x26d183[_0x545680],[_0xda7d('0xdc'),_0xda7d('0x179')]))[_0xda7d('0x41')](_0x45a6e8[_0xda7d('0x1f6')](_0x10377a,_0x26d183[_0x545680]))[_0xda7d('0xbb')](_0x45a6e8[_0xda7d('0xd4')](_0xda7d('0x20c'),_0x10377a));}}}})[_0xda7d('0xbb')](loggerGetContactDialer(_0xda7d('0x210'),_0x10377a,_0x2ac6ef));}};Dialer['prototype'][_0xda7d('0x91')]=function(_0x1c7d63){if(_0x1c7d63[_0xda7d('0x20e')]>0x0){var _0x109d2c=_0x1c7d63['dialLimitQueue']-_0x1c7d63[_0xda7d('0x9b')]-_0x1c7d63[_0xda7d('0x59')];if(_0x109d2c>0x0){this['tryOriginatePredictive'](_0x1c7d63);}else{loggerPredictiveCalls[_0xda7d('0x80')](_0xda7d('0x211'));}}else{this[_0xda7d('0x212')](_0x1c7d63);}};Dialer[_0xda7d('0xaa')][_0xda7d('0x212')]=function(_0x165939){var _0x2c79f5=this;var _0x1271a2=[];_0x165939['originated']+=0x1;for(var _0x37430f in this[_0xda7d('0x24')]){if(typeof this[_0xda7d('0x24')][_0x37430f]!==_0xda7d('0xaf')){if(this[_0xda7d('0x24')][_0x37430f]['state']===_0xda7d('0x20f')&&this[_0xda7d('0x24')][_0x37430f][_0xda7d('0xb2')]===_0xda7d('0xe3')){_0x1271a2['push'](this['agents'][_0x37430f]['id']);}}}this[_0xda7d('0xca')](_0x165939['id'],_0x1271a2,0x1,_0x165939[_0xda7d('0x208')],_0x165939)[_0xda7d('0x41')](function(_0x27af6d){if(!checkContactEmpty(_0x27af6d)){checkContactLowerLimitOriginate(_0x165939,0x1,0x0);_0x2c79f5[_0xda7d('0xb9')](_0x165939)[_0xda7d('0x41')](sendMessageReschedule(_0x165939))[_0xda7d('0xbb')](loggerCatch(_0xda7d('0xbc')));}else{_0x165939[_0xda7d('0x44')]='RUNNING';if(_['isNil'](_0x27af6d[0x0])||_[_0xda7d('0xb0')](_0x27af6d[0x0][_0xda7d('0x18e')])||_[_0xda7d('0xb0')](_0x27af6d[0x0][_0xda7d('0x179')])){_0x2c79f5['emptyContact'](_0xda7d('0x20c'),_0x165939,_0x27af6d[0x0]);}else{_0x2c79f5['checkIsBlackList'](_[_0xda7d('0xd8')](_0x27af6d[0x0],[_0xda7d('0xdc'),_0xda7d('0x179')]))[_0xda7d('0x41')](_0x2c79f5[_0xda7d('0x1f6')](_0x165939,_0x27af6d[0x0]))['catch'](_0x2c79f5[_0xda7d('0xd4')](_0xda7d('0x213'),_0x165939));}}})[_0xda7d('0xbb')](loggerGetContactDialer(_0xda7d('0x214'),_0x165939,0x1));emitVoiceQueueSummary(_0x165939);};Dialer[_0xda7d('0xaa')][_0xda7d('0x1ec')]=function(_0x36b22a,_0x511728,_0x2c9b79,_0x41a49f,_0x4eec33,_0x597a16){loggerPredictive[_0xda7d('0x80')](_0xda7d('0x215'));loggerPredictive[_0xda7d('0x80')](_0xda7d('0x216'),_0x36b22a);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x217'),_0x511728);loggerPredictive['info'](_0xda7d('0x218'),_0x2c9b79);loggerPredictive[_0xda7d('0x80')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41a49f);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x219'),_0x4eec33);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x85'));return new Promise(function(_0x295195,_0x5bb7e2){if(_0x36b22a<=0x0||isNaN(_0x36b22a)){return _0x5bb7e2(msgResponse(_0xda7d('0x21a'),_0xda7d('0x4c'),_0xda7d('0x21b')+_0x36b22a));}if(_0x2c9b79<=0x0||isNaN(_0x2c9b79)){return _0x5bb7e2(msgResponse(_0xda7d('0x21a'),_0xda7d('0x4c'),_0xda7d('0x21c')+_0x2c9b79));}if(_0x41a49f<=0x0||isNaN(_0x41a49f)){return _0x5bb7e2(msgResponse('[abandonmentRate]',_0xda7d('0x4c'),'p\x20=\x20'+_0x41a49f));}if(_0x511728<=0x0||isNaN(_0x511728)){return _0x5bb7e2(msgResponse(_0xda7d('0x21a'),_0xda7d('0x4c'),_0xda7d('0x21d')+_0x511728));}if(_0x4eec33<=0x0||isNaN(_0x4eec33)){return _0x5bb7e2(msgResponse(_0xda7d('0x21a'),_0xda7d('0x4c'),_0xda7d('0x21e')+_0x4eec33));}_0x597a16=_0x597a16||0x0;var _0x554323=0x1/_0x2c9b79;var _0xe2cb71=0x0;var _0x2b2df3=0x0;var _0x56e572=0x0;var _0x3a54a5=0x0;for(var _0x40f617=0x0;_0x56e572<_0x4eec33;_0x40f617+=0x1){_0x2b2df3=_0x40f617/_0x511728;_0xe2cb71=(_0x41a49f*_0x2b2df3+_0x597a16)/_0x554323;_0x56e572=erlangb(_0xe2cb71,_0x36b22a);_0x3a54a5=_0xe2cb71/_0x36b22a*(0x1-erlangb(_0xe2cb71,_0x36b22a));}return _0x295195({'erlangCalls':_0x40f617,'erlangCallToSecond':_0x511728/_0x40f617,'erlangAbandonmentRate':_0x56e572,'erlangBusyFactor':_0x3a54a5});});};Dialer[_0xda7d('0xaa')][_0xda7d('0x1ee')]=function(_0x5964ff,_0x234b0d,_0x2edd7c,_0x426d8e,_0x5a198c,_0x28178e){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xda7d('0x80')]('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',_0x5964ff);loggerPredictive['info'](_0xda7d('0x217'),_0x234b0d);loggerPredictive[_0xda7d('0x80')]('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',_0x2edd7c);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x21f'),_0x426d8e);loggerPredictive[_0xda7d('0x80')](_0xda7d('0x220'),_0x5a198c);loggerPredictive['info'](_0xda7d('0x85'));return new Promise(function(_0x4571e7,_0x2acef4){if(_0x5964ff<=0x0||isNaN(_0x5964ff)){return _0x2acef4(msgResponse(_0xda7d('0x221'),'Error',_0xda7d('0x21b')+_0x5964ff));}if(_0x2edd7c<=0x0||isNaN(_0x2edd7c)){return _0x2acef4(msgResponse('[busyFactor]',_0xda7d('0x4c'),_0xda7d('0x21c')+_0x2edd7c));}if(_0x426d8e<=0x0||isNaN(_0x426d8e)){return _0x2acef4(msgResponse(_0xda7d('0x221'),_0xda7d('0x4c'),_0xda7d('0x222')+_0x426d8e));}if(_0x234b0d<=0x0||isNaN(_0x234b0d)){return _0x2acef4(msgResponse(_0xda7d('0x221'),_0xda7d('0x4c'),_0xda7d('0x21d')+_0x234b0d));}if(_0x5a198c<=0x0||isNaN(_0x5a198c)){return _0x2acef4(msgResponse('[busyFactor]','Error',_0xda7d('0x223')+_0x5a198c));}_0x28178e=_0x28178e||0x0;var _0x3b1e3a=0x1/_0x2edd7c;var _0x21fa96=0x0;var _0x2a6292=0x0;var _0x133215=0x0;var _0x337e7d=0x0;for(var _0x53abe5=0x0;_0x337e7d<_0x5a198c;_0x53abe5+=0x1){_0x2a6292=_0x53abe5/_0x234b0d;_0x21fa96=(_0x426d8e*_0x2a6292+_0x28178e)/_0x3b1e3a;_0x133215=erlangb(_0x21fa96,_0x5964ff);_0x337e7d=_0x21fa96/_0x5964ff*(0x1-erlangb(_0x21fa96,_0x5964ff));}return _0x4571e7({'erlangCalls':_0x53abe5,'erlangCallToSecond':_0x234b0d/_0x53abe5,'erlangAbandonmentRate':_0x133215,'erlangBusyFactor':_0x337e7d});});};module[_0xda7d('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 7fdff7c..01be0c6 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 _0x00c6=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x00c6,0xcc));var _0x600c=function(_0x2dc09d,_0x12d07a){_0x2dc09d=_0x2dc09d-0x0;var _0x1f4dd1=_0x00c6[_0x2dc09d];return _0x1f4dd1;};'use strict';var util=require(_0x600c('0x0'));var _=require(_0x600c('0x1'));var moment=require(_0x600c('0x2'));function getSeconds(_0x167898,_0x56d2de){var _0xb0cd3=moment(_0x167898)[_0x600c('0x3')](0x0);var _0x2f2a01=moment(_0x56d2de)[_0x600c('0x3')](0x0);return _0xb0cd3[_0x600c('0x4')](_0x2f2a01,'seconds');}function QueueCallerAbandon(_0x174842,_0xd833a6){this[_0x600c('0x5')]=_0x174842['scheduledat'];this['type']=_0x174842['type'];this['campaigntype']=_0x174842[_0x600c('0x6')]===_0x600c('0x7')?'queue':_0x174842[_0x600c('0x6')];this[_0x600c('0x8')]=_0x174842[_0x600c('0x8')];this[_0x600c('0x9')]=_0x174842[_0x600c('0x9')];this[_0x600c('0xa')]=_0x174842['countnoanswerretry'];this[_0x600c('0xb')]=_0x174842['countbusyretry']+_0x174842[_0x600c('0x9')]+_0x174842[_0x600c('0xa')]+_0x174842[_0x600c('0xc')]+_0x174842['countdropretry']+_0x174842[_0x600c('0xd')]+_0x174842[_0x600c('0xe')]+_0x174842[_0x600c('0xf')];this[_0x600c('0xc')]=_0x174842[_0x600c('0xc')];this[_0x600c('0x10')]=_0x174842[_0x600c('0x10')];this[_0x600c('0xd')]=_0x174842[_0x600c('0xd')];this['countmachineretry']=_0x174842[_0x600c('0xe')];this['countagentrejectretry']=_0x174842[_0x600c('0xf')];this[_0x600c('0x11')]=_0xd833a6['uniqueid'];this['calleridname']=_0x174842[_0x600c('0x12')];this[_0x600c('0x13')]=_0x174842[_0x600c('0x14')];this[_0x600c('0x15')]=_0x174842[_0x600c('0x15')];this[_0x600c('0x16')]=_0x174842[_0x600c('0x16')];this[_0x600c('0x17')]=_0x174842[_0x600c('0x17')];this[_0x600c('0x18')]=this[_0x600c('0x17')];this['ringtime']=getSeconds(_0x174842[_0x600c('0x16')],_0x174842[_0x600c('0x15')]);this[_0x600c('0x19')]=getSeconds(this[_0x600c('0x17')],_0x174842[_0x600c('0x16')]);this[_0x600c('0x1a')]=0x0;this['queue']=_0xd833a6[_0x600c('0x1b')];this[_0x600c('0x1c')]=_0xd833a6[_0x600c('0x1d')];this[_0x600c('0x1e')]=_0xd833a6[_0x600c('0x1e')];this[_0x600c('0x1f')]=_0x174842[_0x600c('0x1f')];this['callbackuniqueid']=_0x174842[_0x600c('0x20')];this[_0x600c('0x21')]=_0x174842['callbackat'];this[_0x600c('0x22')]=_0x174842[_0x600c('0x22')];this['ContactId']=_0x174842[_0x600c('0x23')];this['ListId']=_0x174842[_0x600c('0x24')];this[_0x600c('0x25')]=_0x174842[_0x600c('0x25')];this['VoiceQueueId']=_0x174842[_0x600c('0x26')];this[_0x600c('0x27')]=_0x174842[_0x600c('0x27')];this['originatecalleridnum']=_0x174842[_0x600c('0x28')]||'';this[_0x600c('0x29')]=_0x174842[_0x600c('0x29')]||'';}module[_0x600c('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xcaaf=['calleridnum','number','starttime','droptime','endtime','ringtime','responsetime','holdtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','moment','milliseconds','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x555e79,_0x9ee00e){var _0x36cb67=function(_0x207ec7){while(--_0x207ec7){_0x555e79['push'](_0x555e79['shift']());}};_0x36cb67(++_0x9ee00e);}(_0xcaaf,0x66));var _0xfcaa=function(_0x781a1d,_0x5981ba){_0x781a1d=_0x781a1d-0x0;var _0x515247=_0xcaaf[_0x781a1d];return _0x515247;};'use strict';var util=require(_0xfcaa('0x0'));var _=require('lodash');var moment=require(_0xfcaa('0x1'));function getSeconds(_0x514aaf,_0x4e0557){var _0x2b2669=moment(_0x514aaf)[_0xfcaa('0x2')](0x0);var _0x4b8844=moment(_0x4e0557)[_0xfcaa('0x2')](0x0);return _0x2b2669['diff'](_0x4b8844,'seconds');}function QueueCallerAbandon(_0x3011eb,_0x83f91d){this[_0xfcaa('0x3')]=_0x3011eb[_0xfcaa('0x3')];this[_0xfcaa('0x4')]=_0x3011eb[_0xfcaa('0x4')];this[_0xfcaa('0x5')]=_0x3011eb['type']===_0xfcaa('0x6')?'queue':_0x3011eb[_0xfcaa('0x4')];this['countbusyretry']=_0x3011eb[_0xfcaa('0x7')];this['countcongestionretry']=_0x3011eb['countcongestionretry'];this[_0xfcaa('0x8')]=_0x3011eb['countnoanswerretry'];this[_0xfcaa('0x9')]=_0x3011eb[_0xfcaa('0x7')]+_0x3011eb[_0xfcaa('0xa')]+_0x3011eb[_0xfcaa('0x8')]+_0x3011eb[_0xfcaa('0xb')]+_0x3011eb[_0xfcaa('0xc')]+_0x3011eb[_0xfcaa('0xd')]+_0x3011eb[_0xfcaa('0xe')]+_0x3011eb['countagentrejectretry'];this[_0xfcaa('0xb')]=_0x3011eb[_0xfcaa('0xb')];this[_0xfcaa('0xc')]=_0x3011eb[_0xfcaa('0xc')];this['countabandonedretry']=_0x3011eb[_0xfcaa('0xd')];this[_0xfcaa('0xe')]=_0x3011eb[_0xfcaa('0xe')];this[_0xfcaa('0xf')]=_0x3011eb['countagentrejectretry'];this[_0xfcaa('0x10')]=_0x83f91d[_0xfcaa('0x10')];this[_0xfcaa('0x11')]=_0x3011eb['name'];this[_0xfcaa('0x12')]=_0x3011eb[_0xfcaa('0x13')];this['starttime']=_0x3011eb[_0xfcaa('0x14')];this['responsetime']=_0x3011eb['responsetime'];this[_0xfcaa('0x15')]=_0x3011eb[_0xfcaa('0x15')];this[_0xfcaa('0x16')]=this[_0xfcaa('0x15')];this[_0xfcaa('0x17')]=getSeconds(_0x3011eb[_0xfcaa('0x18')],_0x3011eb[_0xfcaa('0x14')]);this[_0xfcaa('0x19')]=getSeconds(this[_0xfcaa('0x15')],_0x3011eb[_0xfcaa('0x18')]);this['talktime']=0x0;this[_0xfcaa('0x1a')]=_0x83f91d[_0xfcaa('0x1a')];this[_0xfcaa('0x1b')]=_0x83f91d[_0xfcaa('0x1c')];this[_0xfcaa('0x1d')]=_0x83f91d[_0xfcaa('0x1d')];this[_0xfcaa('0x1e')]=_0x3011eb[_0xfcaa('0x1e')];this[_0xfcaa('0x1f')]=_0x3011eb['callbackuniqueid'];this[_0xfcaa('0x20')]=_0x3011eb[_0xfcaa('0x20')];this[_0xfcaa('0x21')]=_0x3011eb['recallme'];this[_0xfcaa('0x22')]=_0x3011eb['ContactId'];this[_0xfcaa('0x23')]=_0x3011eb[_0xfcaa('0x23')];this[_0xfcaa('0x24')]=_0x3011eb[_0xfcaa('0x24')];this[_0xfcaa('0x25')]=_0x3011eb[_0xfcaa('0x25')];this[_0xfcaa('0x26')]=_0x3011eb[_0xfcaa('0x26')];this[_0xfcaa('0x27')]=_0x3011eb['originatecalleridnum']||'';this['originatecalleridname']=_0x3011eb['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 865271b..62c0fce 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(_0x77744f,_0x1ade19){var _0x3df6ee=function(_0x523958){while(--_0x523958){_0x77744f['push'](_0x77744f['shift']());}};_0x3df6ee(++_0x1ade19);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x1aaf92,_0x145e72){var _0x1fecf9=function(_0x1131f9){while(--_0x1131f9){_0x1aaf92['push'](_0x1aaf92['shift']());}};_0x1fecf9(++_0x145e72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 8aaa7d9..1b445c8 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 _0x84d1=['syncOriginateResponse','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','from-voip-provider','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','syncFaxStatus','operation','status','localstationid','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x84d1,0xa4));var _0x184d=function(_0x2ea8fe,_0x13a71f){_0x2ea8fe=_0x2ea8fe-0x0;var _0x138e9f=_0x84d1[_0x2ea8fe];return _0x138e9f;};'use strict';var util=require(_0x184d('0x0'));var _=require(_0x184d('0x1'));var BPromise=require('bluebird');var uuid=require(_0x184d('0x2'));var moment=require(_0x184d('0x3'));var path=require(_0x184d('0x4'));var tiff2pdf=require(_0x184d('0x5'));var gs=require(_0x184d('0x6'));var logger=require('../../../config/logger')(_0x184d('0x7'));var ami=require(_0x184d('0x8'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x184d('0x9'));var Action=require(_0x184d('0xa'));var faxAccount=require(_0x184d('0xb'));var attachment=require(_0x184d('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x25979a){this[_0x184d('0xd')]={};this[_0x184d('0xe')]=_0x25979a['faxAccounts'];this[_0x184d('0xf')]=_0x25979a[_0x184d('0xf')];this[_0x184d('0x10')]={};ami['on']('newchannel',this[_0x184d('0x11')][_0x184d('0x12')](this));ami['on']('varset',this[_0x184d('0x13')][_0x184d('0x12')](this));ami['on']('newstate',this[_0x184d('0x14')][_0x184d('0x12')](this));ami['on'](_0x184d('0x15'),this[_0x184d('0x16')][_0x184d('0x12')](this));ami['on'](_0x184d('0x17'),this['syncFaxStatus'][_0x184d('0x12')](this));ami['on'](_0x184d('0x18'),this[_0x184d('0x19')]['bind'](this));ami['on']('hangup',this[_0x184d('0x1a')][_0x184d('0x12')](this));ami['on'](_0x184d('0x1b'),this['syncOriginateResponse'][_0x184d('0x12')](this));}Fax[_0x184d('0x1c')]['syncNewchannel']=function(_0x2be8ad){if(_0x2be8ad[_0x184d('0x1d')]===_0x184d('0x1e')){for(var _0x3257ca in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x3257ca)){if(_0x2be8ad[_0x184d('0x1f')]===this[_0x184d('0xe')][_0x3257ca]['localstationid']){this[_0x184d('0xd')][_0x2be8ad[_0x184d('0x20')]]={};this[_0x184d('0xd')][_0x2be8ad[_0x184d('0x20')]]['channel']=_0x2be8ad[_0x184d('0x21')];this['channels'][_0x2be8ad[_0x184d('0x20')]]['id']=this[_0x184d('0xe')][_0x3257ca]['id'];this[_0x184d('0xd')][_0x2be8ad[_0x184d('0x20')]][_0x184d('0x22')]=this[_0x184d('0xe')][_0x3257ca][_0x184d('0x22')];logger[_0x184d('0x23')](_0x2be8ad['uniqueid'],_0x184d('0x24'));}}}}if(this[_0x184d('0x10')][_0x2be8ad[_0x184d('0x20')]]){this['channels'][_0x2be8ad[_0x184d('0x20')]]={};this[_0x184d('0xd')][_0x2be8ad[_0x184d('0x20')]][_0x184d('0x21')]=_0x2be8ad['channel'];logger['info'](_0x2be8ad['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x184d('0x1c')][_0x184d('0x13')]=function(_0x498b58){if(this['channels'][_0x498b58[_0x184d('0x20')]]){for(var _0x1fced4 in _0x498b58['variable']){if(_0x498b58[_0x184d('0x25')]['hasOwnProperty'](_0x1fced4)){this['channels'][_0x498b58[_0x184d('0x20')]][_0x1fced4]=_0x498b58[_0x184d('0x26')];}}}};Fax['prototype'][_0x184d('0x14')]=function(_0x1f8121){if(this['channels'][_0x1f8121[_0x184d('0x20')]]){this[_0x184d('0xd')][_0x1f8121[_0x184d('0x20')]][_0x184d('0x27')]=_0x1f8121[_0x184d('0x27')];this[_0x184d('0xd')][_0x1f8121[_0x184d('0x20')]][_0x184d('0x28')]=_0x1f8121[_0x184d('0x28')];}};Fax['prototype'][_0x184d('0x16')]=function(_0x13f972){if(this[_0x184d('0xd')][_0x13f972[_0x184d('0x20')]]){for(var _0x1588bd in _0x13f972['variable']){if(_0x13f972['variable'][_0x184d('0x29')](_0x1588bd)){this[_0x184d('0xd')][_0x13f972[_0x184d('0x20')]][_0x1588bd]=_0x13f972[_0x184d('0x26')];}}}};Fax[_0x184d('0x1c')][_0x184d('0x2a')]=function(_0x4a48f8){if(this[_0x184d('0xd')][_0x4a48f8['uniqueid']]){this[_0x184d('0xd')][_0x4a48f8[_0x184d('0x20')]]['operation']=_0x4a48f8[_0x184d('0x2b')];this[_0x184d('0xd')][_0x4a48f8['uniqueid']][_0x184d('0x2c')]=_0x4a48f8[_0x184d('0x2c')];this['channels'][_0x4a48f8['uniqueid']][_0x184d('0x2d')]=_0x4a48f8[_0x184d('0x2d')];this['channels'][_0x4a48f8[_0x184d('0x20')]]['filename']=_0x4a48f8['filename'];logger[_0x184d('0x23')](_0x4a48f8[_0x184d('0x20')],_0x184d('0x2e'));}};Fax[_0x184d('0x1c')][_0x184d('0x19')]=function(_0x3c010c){var _0x54ef4=this;if(this[_0x184d('0xd')][_0x3c010c[_0x184d('0x20')]]){var _0x49a090=this[_0x184d('0xd')][_0x3c010c[_0x184d('0x20')]]['id'];this['channels'][_0x3c010c[_0x184d('0x20')]]['remotestationid']=_0x3c010c['remotestationid'];this[_0x184d('0xd')][_0x3c010c[_0x184d('0x20')]][_0x184d('0x2f')]=_0x3c010c[_0x184d('0x2f')];this[_0x184d('0xd')][_0x3c010c[_0x184d('0x20')]][_0x184d('0x2d')]=_0x3c010c[_0x184d('0x2d')];this[_0x184d('0xd')][_0x3c010c['uniqueid']][_0x184d('0x30')]=_0x3c010c[_0x184d('0x30')];this['channels'][_0x3c010c[_0x184d('0x20')]][_0x184d('0x31')]=_0x3c010c['transferrate'];this['channels'][_0x3c010c[_0x184d('0x20')]][_0x184d('0x32')]=_0x3c010c[_0x184d('0x32')];this['channels'][_0x3c010c[_0x184d('0x20')]][_0x184d('0x33')]=_0x3c010c[_0x184d('0x33')];if(this[_0x184d('0xd')][_0x3c010c[_0x184d('0x20')]][_0x184d('0x2f')]>0x0){tiff2pdf(_0x3c010c[_0x184d('0x32')],_0x184d('0x34'),function(_0xe9983a){logger[_0x184d('0x23')](_0x3c010c[_0x184d('0x20')],_0x184d('0x35'),_0xe9983a[_0x184d('0x36')]);attachment[_0x184d('0x37')]({'name':path[_0x184d('0x38')](_0x3c010c[_0x184d('0x32')])[_0x184d('0x22')],'basename':path[_0x184d('0x38')](_0x3c010c[_0x184d('0x32')])[_0x184d('0x22')]+_0x184d('0x39'),'type':_0x184d('0x3a')})[_0x184d('0x3b')](function(_0x4f873a){faxAccount[_0x184d('0x3c')](_0x49a090,{'from':_0x3c010c[_0x184d('0x33')],'mapKey':_0x184d('0x7'),'body':path[_0x184d('0x38')](_0x3c010c[_0x184d('0x32')])[_0x184d('0x22')]+_0x184d('0x39'),'AttachmentId':_0x4f873a['id']})['catch'](function(_0x15b6c0){logger[_0x184d('0x3d')](_0x3c010c[_0x184d('0x20')],_0x184d('0x3e'),JSON[_0x184d('0x3f')](_0x15b6c0));});})[_0x184d('0x40')](function(_0x3605cc){logger[_0x184d('0x3d')](_0x3c010c[_0x184d('0x20')],_0x184d('0x41'),JSON[_0x184d('0x3f')](_0x3605cc));});});}logger['info'](_0x3c010c[_0x184d('0x20')],_0x184d('0x41'));}};Fax['prototype'][_0x184d('0x42')]=function(_0x32265d){if(this[_0x184d('0x10')][_0x32265d[_0x184d('0x20')]]){_[_0x184d('0x43')](this[_0x184d('0xd')][_0x32265d[_0x184d('0x20')]],_[_0x184d('0x44')](_0x32265d,['response',_0x184d('0x45')]));}};function updateStatus(_0x1b0471){if(_0x1b0471[_0x184d('0x46')]){faxMessage['update'](_0x1b0471['AttachmentId'],{'failMessage':_0x184d('0x47')})[_0x184d('0x3b')](function(_0x23da91){ut[_0x184d('0x48')](_0x184d('0x49'),_0x23da91);})[_0x184d('0x40')](function(_0x453342){ut[_0x184d('0x48')](_0x184d('0x4a'),_0x453342);});}else{ut[_0x184d('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x184d('0x1c')][_0x184d('0x4b')]=function(_0xc224bc,_0x2d0e3a,_0x50bea7){var _0x2df164=this;var _0x1deda4={};if(_0x2d0e3a){_0x1deda4={'read':_0x2d0e3a};}else{_0x1deda4={'failMessage':_0x50bea7};}if(this[_0x184d('0x10')][_0xc224bc][_0x184d('0x46')]){faxMessage[_0x184d('0x4c')](this['actions'][_0xc224bc][_0x184d('0x46')],_0x1deda4)[_0x184d('0x3b')](function(_0x2d0b02){ut[_0x184d('0x48')](_0x184d('0x4d'),_0x2d0b02);})[_0x184d('0x40')](function(_0x16dc22){ut['logger']('[Fax][Message][NoUpdate1]',_0x16dc22);})[_0x184d('0x4e')](function(){delete _0x2df164['channels'][_0xc224bc];delete _0x2df164[_0x184d('0x10')][_0xc224bc];});}else{ut['logger'](_0x184d('0x4f'));delete this['channels'][_0xc224bc];delete this[_0x184d('0x10')][_0xc224bc];}};Fax[_0x184d('0x1c')][_0x184d('0x1a')]=function(_0x2b87e8){var _0x28e779=this;if(this[_0x184d('0xd')][_0x2b87e8[_0x184d('0x20')]]){if(this[_0x184d('0x10')][_0x2b87e8[_0x184d('0x20')]]){this['channels'][_0x2b87e8[_0x184d('0x20')]]['id']=this['actions'][_0x2b87e8['uniqueid']]['id'];this[_0x184d('0xd')][_0x2b87e8[_0x184d('0x20')]][_0x184d('0x22')]=this[_0x184d('0x10')][_0x2b87e8[_0x184d('0x20')]][_0x184d('0x22')];}logger[_0x184d('0x23')](_0x2b87e8[_0x184d('0x20')],this[_0x184d('0x10')][_0x2b87e8[_0x184d('0x20')]]?_0x184d('0x50'):_0x184d('0x51'),JSON[_0x184d('0x3f')](this[_0x184d('0xd')][_0x2b87e8['uniqueid']]));if(this[_0x184d('0x10')][_0x2b87e8['uniqueid']]){if(this[_0x184d('0xd')][_0x2b87e8[_0x184d('0x20')]]['faxpages']>0x0&&this['channels'][_0x2b87e8[_0x184d('0x20')]][_0x184d('0x17')]==='SUCCESS'){this[_0x184d('0x4b')](_0x2b87e8[_0x184d('0x20')],!![]);}else{this[_0x184d('0x4b')](_0x2b87e8[_0x184d('0x20')],![],this[_0x184d('0xd')][_0x2b87e8[_0x184d('0x20')]][_0x184d('0x52')]?_0x184d('0x53')+this[_0x184d('0xd')][_0x2b87e8[_0x184d('0x20')]][_0x184d('0x52')]:_0x184d('0x54'));}}}};Fax['prototype'][_0x184d('0x55')]=function(_0x48b7ec){var _0x528f9d=this;return new BPromise(function(_0x2cea7a,_0x544bda){_0x528f9d[_0x184d('0x56')](_0x48b7ec,_0x528f9d['faxAccounts'][_0x48b7ec['FaxAccountId']])['then'](function(_0x1f9286){ut['logger'](_0x184d('0x57'),_0x1f9286);_0x2cea7a(ut[_0x184d('0x36')](_0x184d('0x58')));})[_0x184d('0x40')](function(_0x4dbf82){ut[_0x184d('0x48')]('[Fax][execOriginate][failure]',_0x4dbf82);updateStatus(_0x48b7ec);_0x544bda(ut[_0x184d('0x36')](_0x184d('0x59')));});});};Fax[_0x184d('0x1c')][_0x184d('0x5a')]=function(_0x251603){var _0x1c55c5=this;return new BPromise(function(_0x175bc9,_0x338f11){var _0xcec60a=_0x1c55c5[_0x184d('0x5b')](_0x1c55c5[_0x184d('0xe')][_0x251603[_0x184d('0x5c')]]['Trunk'],_0x251603);if(_0xcec60a['isValid']){_0x175bc9(ut[_0x184d('0x36')](_0x184d('0x5d')));}else{_0x338f11(ut[_0x184d('0x36')](_0xcec60a[_0x184d('0x36')]));}});};function originate(_0x21d9fc,_0x133f16,_0x41e48a){return new BPromise(function(_0x6baeb2,_0x5c9e7a){if(_0x41e48a){var _0x1f7cc5=util[_0x184d('0x5e')](_0x184d('0x5f'),path[_0x184d('0x38')](_0x21d9fc[_0x184d('0x4')])[_0x184d('0x22')],_0x21d9fc[_0x184d('0x4')]);gs[_0x184d('0x60')](_0x1f7cc5)[_0x184d('0x3b')](function(){_0x21d9fc[_0x184d('0x4')]=util['format']('%s/%s.tif',path['parse'](_0x21d9fc[_0x184d('0x4')])[_0x184d('0x61')],path[_0x184d('0x38')](_0x21d9fc[_0x184d('0x4')])['name']);_0x133f16['XMF-PATH']=_0x21d9fc[_0x184d('0x4')];ut[_0x184d('0x48')](_0x184d('0x62'),'');ami['Action'](ut[_0x184d('0x63')](_0x21d9fc,_0x133f16))[_0x184d('0x3b')](function(_0x33c9a5){_0x6baeb2(_0x33c9a5);})[_0x184d('0x40')](function(_0x42bdaa){_0x5c9e7a(_0x42bdaa);});})['catch'](function(_0x3d7e50){_0x5c9e7a(_0x3d7e50);});}else{ami[_0x184d('0x64')](ut[_0x184d('0x63')](_0x21d9fc,_0x133f16))[_0x184d('0x3b')](function(_0x4a0de0){_0x6baeb2(_0x4a0de0);})[_0x184d('0x40')](function(_0x508bd7){_0x5c9e7a(_0x508bd7);});}});}Fax['prototype']['execOriginate']=function(_0x289252,_0x3f2009){var _0x4b699c=this;return new BPromise(function(_0x3c8220,_0x3686bc){var _0x3669dc=uuid['v4']();var _0xfddd9e=ut[_0x184d('0x65')](_0x289252,_0x3f2009);_0x4b699c[_0x184d('0x10')][_0x3669dc]=new Action(_0x3669dc,_0x3f2009,_0x289252);var _0x893114=_0x4b699c[_0x184d('0x10')][_0x3669dc];if(path[_0x184d('0x38')](_0x289252[_0x184d('0x4')])[_0x184d('0x66')]===_0x184d('0x39')){originate(_0x893114,_0xfddd9e,!![])[_0x184d('0x3b')](function(_0x3d4dd8){_0x3c8220(_0x3d4dd8);})[_0x184d('0x40')](function(_0x23083a){_0x3686bc(_0x23083a);});}else{originate(_0x893114,_0xfddd9e,![])['then'](function(_0x2f5438){_0x3c8220(_0x2f5438);})[_0x184d('0x40')](function(_0x3bbfca){_0x3686bc(_0x3bbfca);});}});};Fax[_0x184d('0x1c')]['isTrunkReachable']=function(_0x29e4bf){return!_[_0x184d('0x67')](_0x29e4bf)&&!_[_0x184d('0x67')](_0x29e4bf[_0x184d('0x22')])&&!_[_0x184d('0x67')](_0x29e4bf[_0x184d('0x68')])&&_0x29e4bf[_0x184d('0x68')]&&!_[_0x184d('0x67')](this[_0x184d('0xf')][util[_0x184d('0x5e')](_0x184d('0x69'),_0x29e4bf[_0x184d('0x22')])])&&!_[_0x184d('0x67')](this[_0x184d('0xf')][util[_0x184d('0x5e')](_0x184d('0x69'),_0x29e4bf[_0x184d('0x22')])][_0x184d('0x2c')])&&(this[_0x184d('0xf')][util[_0x184d('0x5e')](_0x184d('0x69'),_0x29e4bf[_0x184d('0x22')])]['status']===_0x184d('0x6a')||this[_0x184d('0xf')][util['format'](_0x184d('0x69'),_0x29e4bf[_0x184d('0x22')])][_0x184d('0x2c')]===_0x184d('0x6b'));};Fax['prototype'][_0x184d('0x5b')]=function(_0x194e32,_0x589404){if(!this[_0x184d('0x6c')](_0x194e32)){ut[_0x184d('0x48')](_0x184d('0x6d'),_[_0x184d('0x67')](_0x194e32)?'':_0x194e32[_0x184d('0x22')]+_0x184d('0x6e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x184d('0x67')](_0x589404[_0x184d('0x7')])){ut[_0x184d('0x48')](_0x184d('0x6f'),JSON[_0x184d('0x3f')](_0x589404));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x589404['path'])){ut[_0x184d('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x184d('0x3f')](_0x589404));return{'isValid':![],'message':_0x184d('0x70')};}return{'isValid':!![],'message':_0x184d('0x71')};};module[_0x184d('0x72')]=Fax; \ No newline at end of file +var _0x012d=['hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','application/pdf','then','notify','parse','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','uuid','moment','tiff2pdf','../../../config/logger','fax','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax'];(function(_0x34303a,_0x2c7c09){var _0x46cf61=function(_0x268658){while(--_0x268658){_0x34303a['push'](_0x34303a['shift']());}};_0x46cf61(++_0x2c7c09);}(_0x012d,0x14e));var _0xd012=function(_0x294b60,_0xad61cb){_0x294b60=_0x294b60-0x0;var _0x3ccff3=_0x012d[_0x294b60];return _0x3ccff3;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xd012('0x0'));var moment=require(_0xd012('0x1'));var path=require('path');var tiff2pdf=require(_0xd012('0x2'));var gs=require('./util/gs');var logger=require(_0xd012('0x3'))(_0xd012('0x4'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xd012('0x5'));var Action=require(_0xd012('0x6'));var faxAccount=require(_0xd012('0x7'));var attachment=require(_0xd012('0x8'));var faxMessage=require(_0xd012('0x9'));function Fax(_0x3c9813){this[_0xd012('0xa')]={};this[_0xd012('0xb')]=_0x3c9813[_0xd012('0xb')];this[_0xd012('0xc')]=_0x3c9813[_0xd012('0xc')];this[_0xd012('0xd')]={};ami['on']('newchannel',this[_0xd012('0xe')][_0xd012('0xf')](this));ami['on'](_0xd012('0x10'),this['syncVarSet'][_0xd012('0xf')](this));ami['on'](_0xd012('0x11'),this[_0xd012('0x12')][_0xd012('0xf')](this));ami['on'](_0xd012('0x13'),this['syncNewExten']['bind'](this));ami['on'](_0xd012('0x14'),this[_0xd012('0x15')][_0xd012('0xf')](this));ami['on'](_0xd012('0x16'),this['syncReceiveFax'][_0xd012('0xf')](this));ami['on'](_0xd012('0x17'),this[_0xd012('0x18')][_0xd012('0xf')](this));ami['on'](_0xd012('0x19'),this[_0xd012('0x1a')][_0xd012('0xf')](this));}Fax[_0xd012('0x1b')][_0xd012('0xe')]=function(_0x2e5042){if(_0x2e5042[_0xd012('0x1c')]===_0xd012('0x1d')){for(var _0x269975 in this[_0xd012('0xb')]){if(this[_0xd012('0xb')][_0xd012('0x1e')](_0x269975)){if(_0x2e5042[_0xd012('0x1f')]===this[_0xd012('0xb')][_0x269975][_0xd012('0x20')]){this[_0xd012('0xa')][_0x2e5042[_0xd012('0x21')]]={};this['channels'][_0x2e5042['uniqueid']][_0xd012('0x22')]=_0x2e5042[_0xd012('0x22')];this[_0xd012('0xa')][_0x2e5042[_0xd012('0x21')]]['id']=this[_0xd012('0xb')][_0x269975]['id'];this[_0xd012('0xa')][_0x2e5042['uniqueid']]['name']=this['faxAccounts'][_0x269975][_0xd012('0x23')];logger[_0xd012('0x24')](_0x2e5042['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0xd012('0xd')][_0x2e5042[_0xd012('0x21')]]){this[_0xd012('0xa')][_0x2e5042[_0xd012('0x21')]]={};this[_0xd012('0xa')][_0x2e5042[_0xd012('0x21')]][_0xd012('0x22')]=_0x2e5042['channel'];logger['info'](_0x2e5042[_0xd012('0x21')],_0xd012('0x25'));}};Fax[_0xd012('0x1b')][_0xd012('0x26')]=function(_0x466951){if(this[_0xd012('0xa')][_0x466951[_0xd012('0x21')]]){for(var _0x380236 in _0x466951['variable']){if(_0x466951[_0xd012('0x27')]['hasOwnProperty'](_0x380236)){this[_0xd012('0xa')][_0x466951[_0xd012('0x21')]][_0x380236]=_0x466951[_0xd012('0x28')];}}}};Fax[_0xd012('0x1b')][_0xd012('0x12')]=function(_0x52a5e1){if(this['channels'][_0x52a5e1['uniqueid']]){this['channels'][_0x52a5e1[_0xd012('0x21')]][_0xd012('0x29')]=_0x52a5e1[_0xd012('0x29')];this['channels'][_0x52a5e1[_0xd012('0x21')]][_0xd012('0x2a')]=_0x52a5e1[_0xd012('0x2a')];}};Fax['prototype'][_0xd012('0x2b')]=function(_0x6495bf){if(this[_0xd012('0xa')][_0x6495bf['uniqueid']]){for(var _0x5c6003 in _0x6495bf['variable']){if(_0x6495bf['variable'][_0xd012('0x1e')](_0x5c6003)){this[_0xd012('0xa')][_0x6495bf['uniqueid']][_0x5c6003]=_0x6495bf[_0xd012('0x28')];}}}};Fax['prototype'][_0xd012('0x15')]=function(_0x1c86d7){if(this['channels'][_0x1c86d7[_0xd012('0x21')]]){this[_0xd012('0xa')][_0x1c86d7[_0xd012('0x21')]][_0xd012('0x2c')]=_0x1c86d7[_0xd012('0x2c')];this[_0xd012('0xa')][_0x1c86d7['uniqueid']][_0xd012('0x2d')]=_0x1c86d7['status'];this['channels'][_0x1c86d7[_0xd012('0x21')]][_0xd012('0x20')]=_0x1c86d7['localstationid'];this[_0xd012('0xa')][_0x1c86d7[_0xd012('0x21')]][_0xd012('0x2e')]=_0x1c86d7['filename'];logger['info'](_0x1c86d7[_0xd012('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0xd012('0x1b')][_0xd012('0x2f')]=function(_0x19f139){var _0x383150=this;if(this[_0xd012('0xa')][_0x19f139[_0xd012('0x21')]]){var _0x757d62=this['channels'][_0x19f139[_0xd012('0x21')]]['id'];this['channels'][_0x19f139[_0xd012('0x21')]][_0xd012('0x30')]=_0x19f139[_0xd012('0x30')];this[_0xd012('0xa')][_0x19f139[_0xd012('0x21')]][_0xd012('0x31')]=_0x19f139['pagestransferred'];this[_0xd012('0xa')][_0x19f139[_0xd012('0x21')]]['localstationid']=_0x19f139[_0xd012('0x20')];this[_0xd012('0xa')][_0x19f139['uniqueid']]['resolution']=_0x19f139[_0xd012('0x32')];this[_0xd012('0xa')][_0x19f139[_0xd012('0x21')]]['transferrate']=_0x19f139['transferrate'];this['channels'][_0x19f139[_0xd012('0x21')]][_0xd012('0x2e')]=_0x19f139[_0xd012('0x2e')];this[_0xd012('0xa')][_0x19f139['uniqueid']][_0xd012('0x33')]=_0x19f139[_0xd012('0x33')];if(this['channels'][_0x19f139[_0xd012('0x21')]][_0xd012('0x31')]>0x0){tiff2pdf(_0x19f139[_0xd012('0x2e')],_0xd012('0x34'),function(_0x4cc047){logger['info'](_0x19f139[_0xd012('0x21')],_0xd012('0x35'),_0x4cc047[_0xd012('0x36')]);attachment[_0xd012('0x37')]({'name':path['parse'](_0x19f139['filename'])[_0xd012('0x23')],'basename':path['parse'](_0x19f139[_0xd012('0x2e')])[_0xd012('0x23')]+'.pdf','type':_0xd012('0x38')})[_0xd012('0x39')](function(_0x3560f0){faxAccount[_0xd012('0x3a')](_0x757d62,{'from':_0x19f139[_0xd012('0x33')],'mapKey':_0xd012('0x4'),'body':path[_0xd012('0x3b')](_0x19f139[_0xd012('0x2e')])[_0xd012('0x23')]+'.pdf','AttachmentId':_0x3560f0['id']})['catch'](function(_0x5c165c){logger[_0xd012('0x3c')](_0x19f139[_0xd012('0x21')],_0xd012('0x3d'),JSON['stringify'](_0x5c165c));});})[_0xd012('0x3e')](function(_0x23f69b){logger[_0xd012('0x3c')](_0x19f139['uniqueid'],_0xd012('0x3f'),JSON[_0xd012('0x40')](_0x23f69b));});});}logger[_0xd012('0x24')](_0x19f139[_0xd012('0x21')],_0xd012('0x3f'));}};Fax[_0xd012('0x1b')][_0xd012('0x1a')]=function(_0xb37f67){if(this['actions'][_0xb37f67[_0xd012('0x21')]]){_[_0xd012('0x41')](this['channels'][_0xb37f67['uniqueid']],_['pick'](_0xb37f67,['response',_0xd012('0x42')]));}};function updateStatus(_0x520f3f){if(_0x520f3f['AttachmentId']){faxMessage[_0xd012('0x43')](_0x520f3f[_0xd012('0x44')],{'failMessage':_0xd012('0x45')})[_0xd012('0x39')](function(_0x1d9e33){ut[_0xd012('0x46')](_0xd012('0x47'),_0x1d9e33);})['catch'](function(_0x389142){ut[_0xd012('0x46')](_0xd012('0x48'),_0x389142);});}else{ut['logger'](_0xd012('0x49'));}}Fax[_0xd012('0x1b')][_0xd012('0x4a')]=function(_0x405c40,_0x362397,_0x1e8067){var _0x208eb8=this;var _0x1875af={};if(_0x362397){_0x1875af={'read':_0x362397};}else{_0x1875af={'failMessage':_0x1e8067};}if(this[_0xd012('0xd')][_0x405c40][_0xd012('0x44')]){faxMessage[_0xd012('0x43')](this[_0xd012('0xd')][_0x405c40][_0xd012('0x44')],_0x1875af)[_0xd012('0x39')](function(_0x19dccd){ut[_0xd012('0x46')](_0xd012('0x4b'),_0x19dccd);})[_0xd012('0x3e')](function(_0x5c0ee8){ut['logger'](_0xd012('0x4c'),_0x5c0ee8);})['finally'](function(){delete _0x208eb8[_0xd012('0xa')][_0x405c40];delete _0x208eb8['actions'][_0x405c40];});}else{ut[_0xd012('0x46')](_0xd012('0x4d'));delete this['channels'][_0x405c40];delete this[_0xd012('0xd')][_0x405c40];}};Fax[_0xd012('0x1b')][_0xd012('0x18')]=function(_0x2b2d7a){var _0x112355=this;if(this[_0xd012('0xa')][_0x2b2d7a[_0xd012('0x21')]]){if(this[_0xd012('0xd')][_0x2b2d7a[_0xd012('0x21')]]){this[_0xd012('0xa')][_0x2b2d7a['uniqueid']]['id']=this[_0xd012('0xd')][_0x2b2d7a[_0xd012('0x21')]]['id'];this[_0xd012('0xa')][_0x2b2d7a['uniqueid']]['name']=this[_0xd012('0xd')][_0x2b2d7a[_0xd012('0x21')]][_0xd012('0x23')];}logger[_0xd012('0x24')](_0x2b2d7a['uniqueid'],this[_0xd012('0xd')][_0x2b2d7a[_0xd012('0x21')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x2b2d7a[_0xd012('0x21')]]));if(this[_0xd012('0xd')][_0x2b2d7a[_0xd012('0x21')]]){if(this[_0xd012('0xa')][_0x2b2d7a[_0xd012('0x21')]][_0xd012('0x4e')]>0x0&&this[_0xd012('0xa')][_0x2b2d7a['uniqueid']][_0xd012('0x14')]===_0xd012('0x4f')){this[_0xd012('0x4a')](_0x2b2d7a[_0xd012('0x21')],!![]);}else{this[_0xd012('0x4a')](_0x2b2d7a[_0xd012('0x21')],![],this[_0xd012('0xa')][_0x2b2d7a[_0xd012('0x21')]][_0xd012('0x50')]?_0xd012('0x51')+this[_0xd012('0xa')][_0x2b2d7a['uniqueid']]['faxstatusstring']:_0xd012('0x52'));}}}};Fax[_0xd012('0x1b')][_0xd012('0x53')]=function(_0x1e89a1){var _0x5f443b=this;return new BPromise(function(_0x599635,_0x3b5627){_0x5f443b[_0xd012('0x54')](_0x1e89a1,_0x5f443b[_0xd012('0xb')][_0x1e89a1['FaxAccountId']])['then'](function(_0x4a1f9d){ut[_0xd012('0x46')]('[Fax][execOriginate][success]',_0x4a1f9d);_0x599635(ut['message']('Fax\x20received'));})['catch'](function(_0x3750b3){ut[_0xd012('0x46')](_0xd012('0x55'),_0x3750b3);updateStatus(_0x1e89a1);_0x3b5627(ut['message']('Fax\x20failed'));});});};Fax[_0xd012('0x1b')][_0xd012('0x56')]=function(_0xde71c8){var _0x2eec1e=this;return new BPromise(function(_0xdbbcc0,_0x2f3d63){var _0x45c43d=_0x2eec1e[_0xd012('0x57')](_0x2eec1e[_0xd012('0xb')][_0xde71c8[_0xd012('0x58')]][_0xd012('0x59')],_0xde71c8);if(_0x45c43d[_0xd012('0x5a')]){_0xdbbcc0(ut[_0xd012('0x36')](_0xd012('0x5b')));}else{_0x2f3d63(ut[_0xd012('0x36')](_0x45c43d[_0xd012('0x36')]));}});};function originate(_0x311f53,_0x2f2b95,_0x47799b){return new BPromise(function(_0xf6c09e,_0x5bb33e){if(_0x47799b){var _0x19033f=util[_0xd012('0x5c')](_0xd012('0x5d'),path['parse'](_0x311f53[_0xd012('0x5e')])['name'],_0x311f53['path']);gs[_0xd012('0x5f')](_0x19033f)['then'](function(){_0x311f53[_0xd012('0x5e')]=util[_0xd012('0x5c')](_0xd012('0x60'),path[_0xd012('0x3b')](_0x311f53['path'])[_0xd012('0x61')],path[_0xd012('0x3b')](_0x311f53[_0xd012('0x5e')])['name']);_0x2f2b95[_0xd012('0x62')]=_0x311f53[_0xd012('0x5e')];ut[_0xd012('0x46')](_0xd012('0x63'),'');ami[_0xd012('0x64')](ut[_0xd012('0x65')](_0x311f53,_0x2f2b95))[_0xd012('0x39')](function(_0x5d2ded){_0xf6c09e(_0x5d2ded);})[_0xd012('0x3e')](function(_0x2f80ec){_0x5bb33e(_0x2f80ec);});})[_0xd012('0x3e')](function(_0x319d75){_0x5bb33e(_0x319d75);});}else{ami[_0xd012('0x64')](ut[_0xd012('0x65')](_0x311f53,_0x2f2b95))[_0xd012('0x39')](function(_0x1f19f1){_0xf6c09e(_0x1f19f1);})[_0xd012('0x3e')](function(_0x166e80){_0x5bb33e(_0x166e80);});}});}Fax[_0xd012('0x1b')][_0xd012('0x54')]=function(_0x228a05,_0x4f8f23){var _0xcfd9d9=this;return new BPromise(function(_0x468bfb,_0x521f76){var _0x34e4c6=uuid['v4']();var _0x3b665b=ut[_0xd012('0x66')](_0x228a05,_0x4f8f23);_0xcfd9d9[_0xd012('0xd')][_0x34e4c6]=new Action(_0x34e4c6,_0x4f8f23,_0x228a05);var _0x4ad143=_0xcfd9d9[_0xd012('0xd')][_0x34e4c6];if(path[_0xd012('0x3b')](_0x228a05[_0xd012('0x5e')])[_0xd012('0x67')]===_0xd012('0x68')){originate(_0x4ad143,_0x3b665b,!![])['then'](function(_0x4a3fd4){_0x468bfb(_0x4a3fd4);})[_0xd012('0x3e')](function(_0x17e86e){_0x521f76(_0x17e86e);});}else{originate(_0x4ad143,_0x3b665b,![])['then'](function(_0xebd4e0){_0x468bfb(_0xebd4e0);})[_0xd012('0x3e')](function(_0x353415){_0x521f76(_0x353415);});}});};Fax[_0xd012('0x1b')][_0xd012('0x69')]=function(_0x145dfc){return!_[_0xd012('0x6a')](_0x145dfc)&&!_[_0xd012('0x6a')](_0x145dfc['name'])&&!_[_0xd012('0x6a')](_0x145dfc['active'])&&_0x145dfc[_0xd012('0x6b')]&&!_['isNil'](this[_0xd012('0xc')][util[_0xd012('0x5c')](_0xd012('0x6c'),_0x145dfc[_0xd012('0x23')])])&&!_[_0xd012('0x6a')](this[_0xd012('0xc')][util[_0xd012('0x5c')]('SIP/%s',_0x145dfc[_0xd012('0x23')])][_0xd012('0x2d')])&&(this[_0xd012('0xc')][util[_0xd012('0x5c')]('SIP/%s',_0x145dfc[_0xd012('0x23')])][_0xd012('0x2d')]===_0xd012('0x6d')||this[_0xd012('0xc')][util[_0xd012('0x5c')](_0xd012('0x6c'),_0x145dfc[_0xd012('0x23')])][_0xd012('0x2d')]==='unmonitored');};Fax[_0xd012('0x1b')][_0xd012('0x57')]=function(_0x49ea23,_0x57214d){if(!this['isTrunkReachable'](_0x49ea23)){ut[_0xd012('0x46')](_0xd012('0x6e'),_[_0xd012('0x6a')](_0x49ea23)?'':_0x49ea23[_0xd012('0x23')]+_0xd012('0x6f'));return{'isValid':![],'message':_0xd012('0x70')};}if(_[_0xd012('0x6a')](_0x57214d[_0xd012('0x4')])){ut[_0xd012('0x46')](_0xd012('0x71'),JSON[_0xd012('0x40')](_0x57214d));return{'isValid':![],'message':_0xd012('0x72')};}if(_[_0xd012('0x6a')](_0x57214d[_0xd012('0x5e')])){ut[_0xd012('0x46')](_0xd012('0x73'),JSON['stringify'](_0x57214d));return{'isValid':![],'message':_0xd012('0x74')};}return{'isValid':!![],'message':_0xd012('0x75')};};module[_0xd012('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 823d345..de8c28a 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 _0xf8c7=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x10181e,_0x40aac0){var _0x3bb825=function(_0x47d0af){while(--_0x47d0af){_0x10181e['push'](_0x10181e['shift']());}};_0x3bb825(++_0x40aac0);}(_0xf8c7,0xf7));var _0x7f8c=function(_0x47adde,_0x5490be){_0x47adde=_0x47adde-0x0;var _0x3df5d9=_0xf8c7[_0x47adde];return _0x3df5d9;};'use strict';var util=require(_0x7f8c('0x0'));var BPromise=require(_0x7f8c('0x1'));var logger=require(_0x7f8c('0x2'))(_0x7f8c('0x3'));var _=require(_0x7f8c('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x4095cf){return function(_0x210b56){logger[_0x7f8c('0x5')](_0x4095cf,util[_0x7f8c('0x6')](_0x210b56,{'showHidden':![],'depth':null}));};}exports[_0x7f8c('0x7')]=function(_0x5e25c7,_0x2b53f1){return BPromise[_0x7f8c('0x8')]()[_0x7f8c('0x9')](faxAccount['notify'](_0x5e25c7,_0x2b53f1))[_0x7f8c('0xa')](loggerCatch(_0x7f8c('0xb')));}; \ No newline at end of file +var _0x9dbc=['bluebird','../../../config/logger','lodash','error','inspect','notify','resolve','then','catch','util'];(function(_0x20a835,_0x16f6e2){var _0x18e355=function(_0x5da829){while(--_0x5da829){_0x20a835['push'](_0x20a835['shift']());}};_0x18e355(++_0x16f6e2);}(_0x9dbc,0xb3));var _0xc9db=function(_0x2852e9,_0x41ad33){_0x2852e9=_0x2852e9-0x0;var _0x1414e7=_0x9dbc[_0x2852e9];return _0x1414e7;};'use strict';var util=require(_0xc9db('0x0'));var BPromise=require(_0xc9db('0x1'));var logger=require(_0xc9db('0x2'))('preview');var _=require(_0xc9db('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x42cb36){return function(_0x310ffd){logger[_0xc9db('0x4')](_0x42cb36,util[_0xc9db('0x5')](_0x310ffd,{'showHidden':![],'depth':null}));};}exports[_0xc9db('0x6')]=function(_0x326402,_0x51b71a){return BPromise[_0xc9db('0x7')]()[_0xc9db('0x8')](faxAccount[_0xc9db('0x6')](_0x326402,_0x51b71a))[_0xc9db('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 67ede0a..76f914e 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 _0x34e4=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','bluebird','child_process'];(function(_0x202254,_0x2621fc){var _0x49385e=function(_0x3a744d){while(--_0x3a744d){_0x202254['push'](_0x202254['shift']());}};_0x49385e(++_0x2621fc);}(_0x34e4,0xde));var _0x434e=function(_0x201b7c,_0x59db92){_0x201b7c=_0x201b7c-0x0;var _0x1252c4=_0x34e4[_0x201b7c];return _0x1252c4;};'use strict';var util=require('util');var logger=require(_0x434e('0x0'))('fax');var BPromise=require(_0x434e('0x1'));var exec=require(_0x434e('0x2'))[_0x434e('0x3')];exports[_0x434e('0x4')]=function(_0x2e3fbc){return new BPromise(function(_0x3e6cc7,_0x3ee946){exec(_0x2e3fbc,function(_0x234c67,_0x5c4986,_0x46b607){logger[_0x434e('0x5')]('Exec\x20gs',_0x5c4986);if(_0x234c67){logger[_0x434e('0x5')](_0x434e('0x6'),_0x434e('0x7'),util[_0x434e('0x8')](_0x234c67,{'showHidden':![],'depth':null}),_0x5c4986,_0x46b607);_0x3ee946(_0x234c67);}_0x3e6cc7(_0x5c4986);});});}; \ No newline at end of file +var _0xe9dd=['../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x30e88e,_0x2fa164){var _0xa9e1e8=function(_0x449768){while(--_0x449768){_0x30e88e['push'](_0x30e88e['shift']());}};_0xa9e1e8(++_0x2fa164);}(_0xe9dd,0x167));var _0xde9d=function(_0x2497ba,_0x3bf4b5){_0x2497ba=_0x2497ba-0x0;var _0x306a03=_0xe9dd[_0x2497ba];return _0x306a03;};'use strict';var util=require(_0xde9d('0x0'));var logger=require(_0xde9d('0x1'))(_0xde9d('0x2'));var BPromise=require(_0xde9d('0x3'));var exec=require(_0xde9d('0x4'))[_0xde9d('0x5')];exports[_0xde9d('0x6')]=function(_0x170373){return new BPromise(function(_0x3c48ec,_0x29b4b4){exec(_0x170373,function(_0x5ac966,_0x13ab5d,_0x12f101){logger[_0xde9d('0x7')]('Exec\x20gs',_0x13ab5d);if(_0x5ac966){logger[_0xde9d('0x7')](_0xde9d('0x8'),_0xde9d('0x9'),util['inspect'](_0x5ac966,{'showHidden':![],'depth':null}),_0x13ab5d,_0x12f101);_0x29b4b4(_0x5ac966);}_0x3c48ec(_0x13ab5d);});});}; \ 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 af16b44..16e384b 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 _0x9099=['t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','modem','faxdetect'];(function(_0x95fc72,_0x5676a1){var _0x1928fa=function(_0x453f44){while(--_0x453f44){_0x95fc72['push'](_0x95fc72['shift']());}};_0x1928fa(++_0x5676a1);}(_0x9099,0x1ac));var _0x9909=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x9099[_0x292f93];return _0x5a94b1;};'use strict';var util=require(_0x9909('0x0'));var _=require('lodash');var moment=require(_0x9909('0x1'));var logger=require(_0x9909('0x2'))(_0x9909('0x3'));exports[_0x9909('0x4')]=function(_0x3fd4b4){return{'message':_0x3fd4b4};};exports[_0x9909('0x5')]=function(_0x2168ff,_0x6eb0ac){logger[_0x9909('0x6')](_0x2168ff,util[_0x9909('0x7')](_0x6eb0ac,{'showHidden':![],'depth':null}));};exports[_0x9909('0x8')]=function(_0x41c07e,_0x3b7391){var _0x3dc2dd={'XMF-ECM':_0x3b7391['ecm'],'XMF-HEADERINFO':_0x3b7391[_0x9909('0x9')],'XMF-MINRATE':_0x3b7391['minrate'],'XMF-MAXRATE':_0x3b7391['maxrate'],'XMF-MODEM':util['format']('\x22%s\x22',_0x3b7391[_0x9909('0xa')]),'XMF-GATEWAY':_0x3b7391['gateway'],'XMF-FAXDETECT':_0x3b7391[_0x9909('0xb')],'XMF-T38TIMEOUT':_0x3b7391[_0x9909('0xc')],'XMF-LOCALSTATIONID':_0x3b7391[_0x9909('0xd')],'XMF-PATH':_0x41c07e['path']};return _0x3dc2dd;};exports[_0x9909('0xe')]=function(_0x489397,_0x1d3add){return{'actionid':_0x489397[_0x9909('0xf')],'action':_0x9909('0x10'),'channel':_0x489397[_0x9909('0x11')],'Exten':_0x9909('0x12'),'Context':_0x9909('0x13'),'Priority':'1','callerid':util[_0x9909('0x14')](_0x9909('0x15'),_0x489397[_0x9909('0x9')]?_0x489397[_0x9909('0x9')]:'',_0x489397[_0x9909('0xd')]),'variable':_0x1d3add,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x489397[_0x9909('0xf')]};}; \ No newline at end of file +var _0x61b6=['addVariables','ecm','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','channel','xcally-motion-fax','headerinfo','uniqueid','lodash','../../../../config/logger','message','logger','inspect'];(function(_0x3daffc,_0x535d44){var _0x3f793f=function(_0x4cdafe){while(--_0x4cdafe){_0x3daffc['push'](_0x3daffc['shift']());}};_0x3f793f(++_0x535d44);}(_0x61b6,0x19f));var _0x661b=function(_0x5c7dca,_0x23e377){_0x5c7dca=_0x5c7dca-0x0;var _0x42b69e=_0x61b6[_0x5c7dca];return _0x42b69e;};'use strict';var util=require('util');var _=require(_0x661b('0x0'));var moment=require('moment');var logger=require(_0x661b('0x1'))('fax');exports[_0x661b('0x2')]=function(_0x3c9cff){return{'message':_0x3c9cff};};exports[_0x661b('0x3')]=function(_0x38be40,_0x158c8e){logger['info'](_0x38be40,util[_0x661b('0x4')](_0x158c8e,{'showHidden':![],'depth':null}));};exports[_0x661b('0x5')]=function(_0x220aa0,_0x268d98){var _0x4d6a72={'XMF-ECM':_0x268d98[_0x661b('0x6')],'XMF-HEADERINFO':_0x268d98['headerinfo'],'XMF-MINRATE':_0x268d98['minrate'],'XMF-MAXRATE':_0x268d98['maxrate'],'XMF-MODEM':util[_0x661b('0x7')](_0x661b('0x8'),_0x268d98[_0x661b('0x9')]),'XMF-GATEWAY':_0x268d98[_0x661b('0xa')],'XMF-FAXDETECT':_0x268d98[_0x661b('0xb')],'XMF-T38TIMEOUT':_0x268d98[_0x661b('0xc')],'XMF-LOCALSTATIONID':_0x268d98[_0x661b('0xd')],'XMF-PATH':_0x220aa0[_0x661b('0xe')]};return _0x4d6a72;};exports[_0x661b('0xf')]=function(_0x55b4eb,_0x25cd2f){return{'actionid':_0x55b4eb['uniqueid'],'action':'originate','channel':_0x55b4eb[_0x661b('0x10')],'Exten':_0x661b('0x11'),'Context':'from-sip','Priority':'1','callerid':util[_0x661b('0x7')]('\x22%s\x22\x20<%s>',_0x55b4eb[_0x661b('0x12')]?_0x55b4eb[_0x661b('0x12')]:'',_0x55b4eb[_0x661b('0xd')]),'variable':_0x25cd2f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x55b4eb[_0x661b('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a2b8f18..6628a69 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 _0xdfaa=['./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport'];(function(_0x565910,_0x1e741c){var _0x405ed4=function(_0x12d974){while(--_0x12d974){_0x565910['push'](_0x565910['shift']());}};_0x405ed4(++_0x1e741c);}(_0xdfaa,0x1c6));var _0xadfa=function(_0x25ef52,_0x1338d5){_0x25ef52=_0x25ef52-0x0;var _0x1beab8=_0xdfaa[_0x25ef52];return _0x1beab8;};'use strict';var BPromise=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var moment=require(_0xadfa('0x2'));var server=require('./server');var Realtime=require(_0xadfa('0x3'));var Report=require(_0xadfa('0x4'));var Acw=require(_0xadfa('0x5'));var Trigger=require(_0xadfa('0x6'));var Dialer=require(_0xadfa('0x7'));var Preview=require(_0xadfa('0x8'));var Fax=require(_0xadfa('0x9'));var user=require(_0xadfa('0xa'));var voiceQueue=require(_0xadfa('0xb'));var voiceQueueReport=require(_0xadfa('0xc'));var voiceCallReport=require(_0xadfa('0xd'));var trunk=require(_0xadfa('0xe'));var trigger=require(_0xadfa('0xf'));var template=require(_0xadfa('0x10'));var cmHopperHistory=require(_0xadfa('0x11'));var campaign=require(_0xadfa('0x12'));var voiceExtension=require(_0xadfa('0x13'));var faxAccount=require(_0xadfa('0x14'));var zendesk=require(_0xadfa('0x15'));var salesforce=require(_0xadfa('0x16'));var sugarcrm=require(_0xadfa('0x17'));var freshdesk=require(_0xadfa('0x18'));var desk=require(_0xadfa('0x19'));var zoho=require(_0xadfa('0x1a'));var vtiger=require(_0xadfa('0x1b'));var freshsales=require(_0xadfa('0x1c'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xadfa('0x1d'));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(_0xadfa('0x1e'))(_0xadfa('0x1f'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xadfa('0x20')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xadfa('0x20')](_0xadfa('0x21'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xadfa('0x22')]()[_0xadfa('0x23')](user[_0xadfa('0x24')]())[_0xadfa('0x23')](realtime['initAgents']())[_0xadfa('0x23')](user[_0xadfa('0x25')]())[_0xadfa('0x23')](realtime['initTelephones']())[_0xadfa('0x23')](trunk['getTrunks']())['then'](realtime[_0xadfa('0x26')]())[_0xadfa('0x23')](voiceQueue[_0xadfa('0x27')]())[_0xadfa('0x23')](realtime[_0xadfa('0x28')]())[_0xadfa('0x23')](trigger[_0xadfa('0x29')]())['then'](realtime[_0xadfa('0x2a')]())[_0xadfa('0x23')](template[_0xadfa('0x2b')]())['then'](realtime[_0xadfa('0x2c')]())[_0xadfa('0x23')](zendesk[_0xadfa('0x2d')]())[_0xadfa('0x23')](realtime[_0xadfa('0x2e')]())[_0xadfa('0x23')](salesforce[_0xadfa('0x2f')]())[_0xadfa('0x23')](realtime[_0xadfa('0x30')]())['then'](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xadfa('0x31')]())[_0xadfa('0x23')](freshdesk[_0xadfa('0x32')]())[_0xadfa('0x23')](realtime['initFreshdeskAccounts']())[_0xadfa('0x23')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0xadfa('0x23')](zoho[_0xadfa('0x33')]())[_0xadfa('0x23')](realtime[_0xadfa('0x34')]())['then'](vtiger[_0xadfa('0x35')]())['then'](realtime[_0xadfa('0x36')]())['then'](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xadfa('0x37')]())[_0xadfa('0x23')](servicenow[_0xadfa('0x38')]())[_0xadfa('0x23')](realtime[_0xadfa('0x39')]())[_0xadfa('0x23')](dynamics365[_0xadfa('0x3a')]())['then'](realtime[_0xadfa('0x3b')]())[_0xadfa('0x23')](campaign[_0xadfa('0x3c')]())[_0xadfa('0x23')](realtime[_0xadfa('0x3d')]())[_0xadfa('0x23')](voiceExtension[_0xadfa('0x3e')]())['then'](realtime[_0xadfa('0x3f')]())['then'](faxAccount['getFaxAccounts']())[_0xadfa('0x23')](realtime[_0xadfa('0x40')]())[_0xadfa('0x23')](function(){return realtime;});}function initParams(){return BPromise[_0xadfa('0x22')]()[_0xadfa('0x23')](voiceQueueReport['getVoiceQueueReports']())[_0xadfa('0x23')](realtime[_0xadfa('0x41')]())[_0xadfa('0x23')](cmHopperHistory[_0xadfa('0x42')]())[_0xadfa('0x23')](realtime[_0xadfa('0x43')]())['then'](cmHopperHistory[_0xadfa('0x44')]())['then'](realtime[_0xadfa('0x45')]())[_0xadfa('0x23')](voiceCallReport[_0xadfa('0x46')]())[_0xadfa('0x23')](realtime[_0xadfa('0x47')]())[_0xadfa('0x48')](function(_0x4169ac){logger[_0xadfa('0x49')](_0xadfa('0x4a'),util[_0xadfa('0x4b')](_0x4169ac,{'showHidden':![],'depth':null}));});}function main(){return server[_0xadfa('0x4c')](realtime,preview,fax)['then'](function(_0x582dde){return initRealtime();})[_0xadfa('0x23')](function(){return initParams();})[_0xadfa('0x23')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xadfa('0x48')](function(_0x576e9e){logger['error'](_0xadfa('0x4d'),util[_0xadfa('0x4b')](_0x576e9e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x6ffc=['./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents','initAgents','then','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','[index.js][initParams]','listen','sync','catch','[index.js][main]','inspect','util','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow'];(function(_0x3c8543,_0xd2a77b){var _0x5dc4b9=function(_0x406159){while(--_0x406159){_0x3c8543['push'](_0x3c8543['shift']());}};_0x5dc4b9(++_0xd2a77b);}(_0x6ffc,0x184));var _0xc6ff=function(_0x170694,_0x30f86f){_0x170694=_0x170694-0x0;var _0x4b1cff=_0x6ffc[_0x170694];return _0x4b1cff;};'use strict';var BPromise=require('bluebird');var util=require(_0xc6ff('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xc6ff('0x1'));var Acw=require(_0xc6ff('0x2'));var Trigger=require(_0xc6ff('0x3'));var Dialer=require(_0xc6ff('0x4'));var Preview=require(_0xc6ff('0x5'));var Fax=require(_0xc6ff('0x6'));var user=require(_0xc6ff('0x7'));var voiceQueue=require(_0xc6ff('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc6ff('0x9'));var trunk=require(_0xc6ff('0xa'));var trigger=require('./rpc/trigger');var template=require(_0xc6ff('0xb'));var cmHopperHistory=require(_0xc6ff('0xc'));var campaign=require(_0xc6ff('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xc6ff('0xe'));var salesforce=require(_0xc6ff('0xf'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xc6ff('0x10'));var zoho=require(_0xc6ff('0x11'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xc6ff('0x12'));var servicenow=require(_0xc6ff('0x13'));var dynamics365=require(_0xc6ff('0x14'));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(_0xc6ff('0x15'))(_0xc6ff('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc6ff('0x17')](_0xc6ff('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc6ff('0x19')]()['then'](user[_0xc6ff('0x1a')]())['then'](realtime[_0xc6ff('0x1b')]())[_0xc6ff('0x1c')](user[_0xc6ff('0x1d')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x1e')]())[_0xc6ff('0x1c')](trunk['getTrunks']())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x1f')]())[_0xc6ff('0x1c')](voiceQueue[_0xc6ff('0x20')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x21')]())[_0xc6ff('0x1c')](trigger[_0xc6ff('0x22')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x23')]())[_0xc6ff('0x1c')](template[_0xc6ff('0x24')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x25')]())[_0xc6ff('0x1c')](zendesk[_0xc6ff('0x26')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x27')]())[_0xc6ff('0x1c')](salesforce['getSalesforceAccounts']())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x28')]())[_0xc6ff('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x29')]())['then'](freshdesk[_0xc6ff('0x2a')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x2b')]())[_0xc6ff('0x1c')](desk['getDeskAccounts']())['then'](realtime[_0xc6ff('0x2c')]())[_0xc6ff('0x1c')](zoho['getZohoAccounts']())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x2d')]())[_0xc6ff('0x1c')](vtiger[_0xc6ff('0x2e')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x2f')]())['then'](freshsales[_0xc6ff('0x30')]())[_0xc6ff('0x1c')](realtime['initFreshsalesAccounts']())[_0xc6ff('0x1c')](servicenow['getServicenowAccounts']())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x31')]())[_0xc6ff('0x1c')](dynamics365[_0xc6ff('0x32')]())['then'](realtime[_0xc6ff('0x33')]())[_0xc6ff('0x1c')](campaign[_0xc6ff('0x34')]())['then'](realtime[_0xc6ff('0x35')]())[_0xc6ff('0x1c')](voiceExtension[_0xc6ff('0x36')]())[_0xc6ff('0x1c')](realtime['initVoiceExtensions']())[_0xc6ff('0x1c')](faxAccount[_0xc6ff('0x37')]())[_0xc6ff('0x1c')](realtime['initFaxAccounts']())[_0xc6ff('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xc6ff('0x19')]()[_0xc6ff('0x1c')](voiceQueueReport[_0xc6ff('0x38')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x39')]())[_0xc6ff('0x1c')](cmHopperHistory[_0xc6ff('0x3a')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xc6ff('0x1c')](cmHopperHistory[_0xc6ff('0x3b')]())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x3c')]())[_0xc6ff('0x1c')](voiceCallReport['getVoiceCallReports']())[_0xc6ff('0x1c')](realtime[_0xc6ff('0x3d')]())['catch'](function(_0x474de1){logger['error'](_0xc6ff('0x3e'),util['inspect'](_0x474de1,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc6ff('0x3f')](realtime,preview,fax)[_0xc6ff('0x1c')](function(_0x58839e){return initRealtime();})['then'](function(){return initParams();})[_0xc6ff('0x1c')](function(){report[_0xc6ff('0x40')]();setInterval(initRealtime,0x1388);})[_0xc6ff('0x41')](function(_0x190333){logger['error'](_0xc6ff('0x42'),util[_0xc6ff('0x43')](_0x190333,{'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 01c710f..8dc8622 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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0xcba81,_0x2d4fe8){var _0x2f4468=function(_0x51821c){while(--_0x51821c){_0xcba81['push'](_0xcba81['shift']());}};_0x2f4468(++_0x2d4fe8);}(_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 moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +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(_0x102e08,_0x18a2b5){var _0x34b4f9=function(_0x15b7d9){while(--_0x15b7d9){_0x102e08['push'](_0x102e08['shift']());}};_0x34b4f9(++_0x18a2b5);}(_0x70e0,0x17b));var _0x070e=function(_0x3f8fe8,_0x10071f){_0x3f8fe8=_0x3f8fe8-0x0;var _0x2133c7=_0x70e0[_0x3f8fe8];return _0x2133c7;};'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 diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a7d74f6..3f175ac 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 _0xc3fb=['originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc3fb,0x91));var _0xbc3f=function(_0x46660a,_0x2ba7e1){_0x46660a=_0x46660a-0x0;var _0x2a8f0f=_0xc3fb[_0x46660a];return _0x2a8f0f;};'use strict';function Campaign(_0x1f0fc2){this['id']=_0x1f0fc2['id']||0x0;this[_0xbc3f('0x0')]=_0x1f0fc2['name']||'';this['type']=_0x1f0fc2['type']||_0xbc3f('0x1');this[_0xbc3f('0x2')]=0x0;this[_0xbc3f('0x3')]=0x0;this[_0xbc3f('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xbc3f('0x5')]=!![];this[_0xbc3f('0x6')]=_0x1f0fc2[_0xbc3f('0x6')];this[_0xbc3f('0x7')]=_0x1f0fc2['limitCalls'];this[_0xbc3f('0x8')]=_0x1f0fc2[_0xbc3f('0x8')]||null;this['dialGlobalInterval']=_0x1f0fc2[_0xbc3f('0x9')]?_0x1f0fc2[_0xbc3f('0x9')]:null;this[_0xbc3f('0xa')]=_0x1f0fc2[_0xbc3f('0xa')];this[_0xbc3f('0xb')]=_0x1f0fc2[_0xbc3f('0xb')];this['dialOriginateTimeout']=_0x1f0fc2[_0xbc3f('0xc')]||0x1e;this[_0xbc3f('0xd')]=_0x1f0fc2['dialCongestionMaxRetry'];this[_0xbc3f('0xe')]=_0x1f0fc2[_0xbc3f('0xe')];this['dialBusyMaxRetry']=_0x1f0fc2[_0xbc3f('0xf')];this['dialBusyRetryFrequency']=_0x1f0fc2[_0xbc3f('0x10')];this[_0xbc3f('0x11')]=_0x1f0fc2[_0xbc3f('0x11')];this[_0xbc3f('0x12')]=_0x1f0fc2[_0xbc3f('0x12')];this['dialGlobalMaxRetry']=_0x1f0fc2['dialGlobalMaxRetry'];this[_0xbc3f('0x13')]=_0x1f0fc2[_0xbc3f('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1f0fc2[_0xbc3f('0x14')]||0x96;this[_0xbc3f('0x15')]=_0x1f0fc2[_0xbc3f('0x15')]||0x3;this[_0xbc3f('0x16')]=_0x1f0fc2[_0xbc3f('0x16')]||0x96;this[_0xbc3f('0x17')]=_0x1f0fc2[_0xbc3f('0x17')]||0x3;this[_0xbc3f('0x18')]=_0x1f0fc2[_0xbc3f('0x18')]||0x96;this[_0xbc3f('0x19')]=_0x1f0fc2['dialMachineMaxRetry']||0x3;this[_0xbc3f('0x1a')]=_0x1f0fc2[_0xbc3f('0x1a')]||0x96;this[_0xbc3f('0x1b')]=_0x1f0fc2[_0xbc3f('0x1b')]||0x3;this[_0xbc3f('0x1c')]=_0x1f0fc2[_0xbc3f('0x1c')]||0x96;this[_0xbc3f('0x1d')]=_0x1f0fc2[_0xbc3f('0x1d')]||_0xbc3f('0x1e');this[_0xbc3f('0x1f')]=_0x1f0fc2['dialPrefix']||undefined;this[_0xbc3f('0x20')]=_0x1f0fc2[_0xbc3f('0x20')]||undefined;this[_0xbc3f('0x21')]=_0x1f0fc2[_0xbc3f('0x21')]||undefined;this[_0xbc3f('0x22')]=_0x1f0fc2[_0xbc3f('0x22')]?_0x1f0fc2[_0xbc3f('0x22')]:undefined;this[_0xbc3f('0x23')]=_0x1f0fc2[_0xbc3f('0x23')]?_0x1f0fc2[_0xbc3f('0x23')]:undefined;this['Interval']=_0x1f0fc2[_0xbc3f('0x24')]?_0x1f0fc2[_0xbc3f('0x24')]:undefined;this[_0xbc3f('0x25')]=_0x1f0fc2[_0xbc3f('0x25')]?_0x1f0fc2[_0xbc3f('0x25')]:undefined;this['dialQueueProject']=_0x1f0fc2[_0xbc3f('0x25')]?_0x1f0fc2[_0xbc3f('0x25')]['name']:undefined;this[_0xbc3f('0x26')]=_0x1f0fc2[_0xbc3f('0x26')]||![];this[_0xbc3f('0x27')]=_0x1f0fc2['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1f0fc2[_0xbc3f('0x28')];this[_0xbc3f('0x29')]=_0x1f0fc2['dialAMDAfterGreetingSilence'];this[_0xbc3f('0x2a')]=_0x1f0fc2[_0xbc3f('0x2a')];this[_0xbc3f('0x2b')]=_0x1f0fc2['dialAMDMinWordLength'];this[_0xbc3f('0x2c')]=_0x1f0fc2[_0xbc3f('0x2c')];this[_0xbc3f('0x2d')]=_0x1f0fc2[_0xbc3f('0x2d')];this[_0xbc3f('0x2e')]=_0x1f0fc2['dialAMDSilenceThreshold'];this[_0xbc3f('0x2f')]=_0x1f0fc2[_0xbc3f('0x2f')];}module[_0xbc3f('0x30')]=Campaign; \ No newline at end of file +var _0x7cb9=['active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive'];(function(_0xf3da04,_0x124930){var _0x1def09=function(_0x5a1d9c){while(--_0x5a1d9c){_0xf3da04['push'](_0xf3da04['shift']());}};_0x1def09(++_0x124930);}(_0x7cb9,0x1c3));var _0x97cb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7cb9[_0x122ef9];return _0x42fba0;};'use strict';function Campaign(_0x1c5c54){this['id']=_0x1c5c54['id']||0x0;this[_0x97cb('0x0')]=_0x1c5c54[_0x97cb('0x0')]||'';this[_0x97cb('0x1')]=_0x1c5c54[_0x97cb('0x1')]||_0x97cb('0x2');this[_0x97cb('0x3')]=0x0;this[_0x97cb('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x97cb('0x5')]=0x0;this[_0x97cb('0x6')]='';this[_0x97cb('0x7')]=!![];this[_0x97cb('0x8')]=_0x1c5c54[_0x97cb('0x8')];this[_0x97cb('0x9')]=_0x1c5c54[_0x97cb('0x9')];this[_0x97cb('0xa')]=_0x1c5c54['dialTimezone']||null;this[_0x97cb('0xb')]=_0x1c5c54[_0x97cb('0xb')]?_0x1c5c54[_0x97cb('0xb')]:null;this['dialOriginateCallerIdName']=_0x1c5c54[_0x97cb('0xc')];this[_0x97cb('0xd')]=_0x1c5c54[_0x97cb('0xd')];this[_0x97cb('0xe')]=_0x1c5c54[_0x97cb('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x1c5c54[_0x97cb('0xf')];this[_0x97cb('0x10')]=_0x1c5c54['dialCongestionRetryFrequency'];this[_0x97cb('0x11')]=_0x1c5c54[_0x97cb('0x11')];this['dialBusyRetryFrequency']=_0x1c5c54[_0x97cb('0x12')];this[_0x97cb('0x13')]=_0x1c5c54[_0x97cb('0x13')];this[_0x97cb('0x14')]=_0x1c5c54['dialNoAnswerRetryFrequency'];this[_0x97cb('0x15')]=_0x1c5c54[_0x97cb('0x15')];this['dialNoSuchNumberMaxRetry']=_0x1c5c54[_0x97cb('0x16')]||0x3;this[_0x97cb('0x17')]=_0x1c5c54[_0x97cb('0x17')]||0x96;this[_0x97cb('0x18')]=_0x1c5c54[_0x97cb('0x18')]||0x3;this[_0x97cb('0x19')]=_0x1c5c54['dialDropRetryFrequency']||0x96;this[_0x97cb('0x1a')]=_0x1c5c54[_0x97cb('0x1a')]||0x3;this[_0x97cb('0x1b')]=_0x1c5c54['dialAbandonedRetryFrequency']||0x96;this[_0x97cb('0x1c')]=_0x1c5c54['dialMachineMaxRetry']||0x3;this[_0x97cb('0x1d')]=_0x1c5c54[_0x97cb('0x1d')]||0x96;this[_0x97cb('0x1e')]=_0x1c5c54[_0x97cb('0x1e')]||0x3;this[_0x97cb('0x1f')]=_0x1c5c54[_0x97cb('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x1c5c54[_0x97cb('0x20')]||_0x97cb('0x21');this[_0x97cb('0x22')]=_0x1c5c54[_0x97cb('0x22')]||undefined;this[_0x97cb('0x23')]=_0x1c5c54[_0x97cb('0x23')]||undefined;this[_0x97cb('0x24')]=_0x1c5c54['dialCutDigit']||undefined;this[_0x97cb('0x25')]=_0x1c5c54[_0x97cb('0x25')]?_0x1c5c54[_0x97cb('0x25')]:undefined;this['Trunk']=_0x1c5c54[_0x97cb('0x26')]?_0x1c5c54[_0x97cb('0x26')]:undefined;this[_0x97cb('0x27')]=_0x1c5c54['Interval']?_0x1c5c54[_0x97cb('0x27')]:undefined;this[_0x97cb('0x28')]=_0x1c5c54[_0x97cb('0x28')]?_0x1c5c54['SquareProject']:undefined;this['dialQueueProject']=_0x1c5c54[_0x97cb('0x28')]?_0x1c5c54['SquareProject'][_0x97cb('0x0')]:undefined;this[_0x97cb('0x29')]=_0x1c5c54[_0x97cb('0x29')]||![];this[_0x97cb('0x2a')]=_0x1c5c54[_0x97cb('0x2a')];this[_0x97cb('0x2b')]=_0x1c5c54[_0x97cb('0x2b')];this[_0x97cb('0x2c')]=_0x1c5c54[_0x97cb('0x2c')];this[_0x97cb('0x2d')]=_0x1c5c54['dialAMDTotalAnalysisTime'];this[_0x97cb('0x2e')]=_0x1c5c54['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x1c5c54[_0x97cb('0x2f')];this[_0x97cb('0x30')]=_0x1c5c54[_0x97cb('0x30')];this[_0x97cb('0x31')]=_0x1c5c54['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1c5c54['dialAMDMaximumWordLength'];}module[_0x97cb('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a040b6b..6300697 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 _0xb78e=['monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x437d31,_0x8d5d96){var _0x13ae20=function(_0x1f6d11){while(--_0x1f6d11){_0x437d31['push'](_0x437d31['shift']());}};_0x13ae20(++_0x8d5d96);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3e3328,_0x5846c3){_0x3e3328=_0x3e3328-0x0;var _0x566471=_0xb78e[_0x3e3328];return _0x566471;};'use strict';function Channel(){this[_0xeb78('0x0')]=null;this[_0xeb78('0x1')]='';this['destinationchannel']='';this[_0xeb78('0x2')]=0x0;this[_0xeb78('0x3')]='';this[_0xeb78('0x4')]=undefined;this[_0xeb78('0x5')]=undefined;this[_0xeb78('0x6')]=0x0;this[_0xeb78('0x7')]='';this[_0xeb78('0x8')]=0x0;this[_0xeb78('0x9')]=0x0;this['exten']=0x0;this[_0xeb78('0xa')]=![];this[_0xeb78('0xb')]=null;this[_0xeb78('0xc')]=null;this[_0xeb78('0xd')]=![];this[_0xeb78('0xe')]=![];this[_0xeb78('0xf')]='';this[_0xeb78('0x10')]='';this['duration']=0x0;this[_0xeb78('0x11')]=0x0;this[_0xeb78('0x12')]=0x0;this[_0xeb78('0x13')]=null;this[_0xeb78('0x14')]=null;this[_0xeb78('0x15')]=null;this[_0xeb78('0x16')]=![];this[_0xeb78('0x17')]=null;this[_0xeb78('0x18')]=null;this[_0xeb78('0x19')]=[];this['transfercalleridnum']=undefined;this[_0xeb78('0x1a')]=undefined;this[_0xeb78('0x1b')]=undefined;this[_0xeb78('0x1c')]=0x0;}module[_0xeb78('0x1d')]=Channel; \ No newline at end of file +var _0x1a4d=['accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename'];(function(_0x142e7a,_0x579b2d){var _0x531140=function(_0x330a21){while(--_0x330a21){_0x142e7a['push'](_0x142e7a['shift']());}};_0x531140(++_0x579b2d);}(_0x1a4d,0x12e));var _0xd1a4=function(_0x489f39,_0x5e1b3d){_0x489f39=_0x489f39-0x0;var _0x886cc0=_0x1a4d[_0x489f39];return _0x886cc0;};'use strict';function Channel(){this[_0xd1a4('0x0')]=null;this[_0xd1a4('0x1')]='';this[_0xd1a4('0x2')]='';this[_0xd1a4('0x3')]=0x0;this['calleridname']='';this[_0xd1a4('0x4')]=undefined;this[_0xd1a4('0x5')]=undefined;this[_0xd1a4('0x6')]=0x0;this[_0xd1a4('0x7')]='';this[_0xd1a4('0x8')]=0x0;this['linkedid']=0x0;this[_0xd1a4('0x9')]=0x0;this[_0xd1a4('0xa')]=![];this[_0xd1a4('0xb')]=null;this[_0xd1a4('0xc')]=null;this[_0xd1a4('0xd')]=![];this['abandoned']=![];this['lastapplication']='';this[_0xd1a4('0xe')]='';this[_0xd1a4('0xf')]=0x0;this['billableseconds']=0x0;this[_0xd1a4('0x10')]=0x0;this[_0xd1a4('0x11')]=null;this[_0xd1a4('0x12')]=null;this[_0xd1a4('0x13')]=null;this[_0xd1a4('0x14')]=![];this[_0xd1a4('0x15')]=null;this[_0xd1a4('0x16')]=null;this[_0xd1a4('0x17')]=[];this[_0xd1a4('0x18')]=undefined;this[_0xd1a4('0x19')]=undefined;this[_0xd1a4('0x1a')]=undefined;this[_0xd1a4('0x1b')]=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 9f0ee35..579808f 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 _0xc283=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xc283,0xd1));var _0x3c28=function(_0x4b8071,_0x157332){_0x4b8071=_0x4b8071-0x0;var _0x44d37e=_0xc283[_0x4b8071];return _0x44d37e;};'use strict';function DeskAccount(_0x53d7fc){this['id']=_0x53d7fc['id']||0x0;this[_0x3c28('0x0')]=_0x53d7fc['name']||'';this[_0x3c28('0x1')]=_0x53d7fc[_0x3c28('0x1')]||'';this[_0x3c28('0x2')]=_0x53d7fc[_0x3c28('0x2')]||'';this[_0x3c28('0x3')]=_0x53d7fc[_0x3c28('0x3')]||'';this[_0x3c28('0x4')]=_0x53d7fc['password']||'';this[_0x3c28('0x5')]=_0x53d7fc[_0x3c28('0x5')]||'';this[_0x3c28('0x6')]=_0x53d7fc[_0x3c28('0x6')]||'';this[_0x3c28('0x7')]=_0x53d7fc[_0x3c28('0x7')]||'';this['tokenSecret']=_0x53d7fc[_0x3c28('0x8')]||'';this[_0x3c28('0x9')]=_0x53d7fc[_0x3c28('0x9')]||'';this[_0x3c28('0xa')]=_0x53d7fc[_0x3c28('0xa')]||'';this[_0x3c28('0xb')]=_0x53d7fc[_0x3c28('0xb')]||{};}module[_0x3c28('0xc')]=DeskAccount; \ No newline at end of file +var _0xd37f=['consumerKey','consumerSecret','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x1ba57f,_0xb81938){var _0x5a7f02=function(_0x32b234){while(--_0x32b234){_0x1ba57f['push'](_0x1ba57f['shift']());}};_0x5a7f02(++_0xb81938);}(_0xd37f,0x103));var _0xfd37=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xd37f[_0x47a7d0];return _0xb9bd08;};'use strict';function DeskAccount(_0x5b66a6){this['id']=_0x5b66a6['id']||0x0;this[_0xfd37('0x0')]=_0x5b66a6['name']||'';this[_0xfd37('0x1')]=_0x5b66a6[_0xfd37('0x1')]||'';this[_0xfd37('0x2')]=_0x5b66a6['remoteUri']||'';this[_0xfd37('0x3')]=_0x5b66a6[_0xfd37('0x3')]||'';this[_0xfd37('0x4')]=_0x5b66a6[_0xfd37('0x4')]||'';this[_0xfd37('0x5')]=_0x5b66a6[_0xfd37('0x5')]||'';this[_0xfd37('0x6')]=_0x5b66a6[_0xfd37('0x6')]||'';this['token']=_0x5b66a6['token']||'';this[_0xfd37('0x7')]=_0x5b66a6[_0xfd37('0x7')]||'';this[_0xfd37('0x8')]=_0x5b66a6[_0xfd37('0x8')]||'';this['serverUrl']=_0x5b66a6[_0xfd37('0x9')]||'';this[_0xfd37('0xa')]=_0x5b66a6['Configurations']||{};}module[_0xfd37('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index fcc1757..f7d0838 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 _0x2a23=['modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x555785,_0x591956){var _0x311187=function(_0x7d285d){while(--_0x7d285d){_0x555785['push'](_0x555785['shift']());}};_0x311187(++_0x591956);}(_0x2a23,0x12c));var _0x32a2=function(_0x3f174f,_0x420f5b){_0x3f174f=_0x3f174f-0x0;var _0x34d37b=_0x2a23[_0x3f174f];return _0x34d37b;};'use strict';function Dynamics365Account(_0x4ba215){this['id']=_0x4ba215['id']||0x0;this[_0x32a2('0x0')]=_0x4ba215['name']||'';this['username']=_0x4ba215[_0x32a2('0x1')]||'';this['password']=_0x4ba215[_0x32a2('0x2')]||'';this[_0x32a2('0x3')]=_0x4ba215['remoteUri']||'';this[_0x32a2('0x4')]=_0x4ba215[_0x32a2('0x4')]||'';this[_0x32a2('0x5')]=_0x4ba215['clientId']||'';this[_0x32a2('0x6')]=_0x4ba215[_0x32a2('0x6')]||{};this[_0x32a2('0x7')]=_0x4ba215['serverUrl']||'';this[_0x32a2('0x8')]=_0x4ba215[_0x32a2('0x8')]||![];this[_0x32a2('0x9')]=_0x4ba215[_0x32a2('0x9')]||{};this[_0x32a2('0xa')]=_0x4ba215['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x9d57=['tenantId','clientId','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x9d57,0x1c8));var _0x79d5=function(_0x4b9a4a,_0x297e66){_0x4b9a4a=_0x4b9a4a-0x0;var _0x51fa6f=_0x9d57[_0x4b9a4a];return _0x51fa6f;};'use strict';function Dynamics365Account(_0x3f5acd){this['id']=_0x3f5acd['id']||0x0;this[_0x79d5('0x0')]=_0x3f5acd[_0x79d5('0x0')]||'';this[_0x79d5('0x1')]=_0x3f5acd[_0x79d5('0x1')]||'';this['password']=_0x3f5acd[_0x79d5('0x2')]||'';this[_0x79d5('0x3')]=_0x3f5acd[_0x79d5('0x3')]||'';this[_0x79d5('0x4')]=_0x3f5acd[_0x79d5('0x4')]||'';this['clientId']=_0x3f5acd[_0x79d5('0x5')]||'';this['clientSecret']=_0x3f5acd['clientSecret']||{};this['serverUrl']=_0x3f5acd[_0x79d5('0x6')]||'';this[_0x79d5('0x7')]=_0x3f5acd[_0x79d5('0x7')]||![];this[_0x79d5('0x8')]=_0x3f5acd[_0x79d5('0x8')]||{};this[_0x79d5('0x9')]=_0x3f5acd[_0x79d5('0x9')]||{};}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 a51127b..52cc74b 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 _0x03d4=['minrate','maxrate','modem','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x6bf383,_0x376de0){var _0xde0da3=function(_0x3a7e52){while(--_0x3a7e52){_0x6bf383['push'](_0x6bf383['shift']());}};_0xde0da3(++_0x376de0);}(_0x03d4,0x1bb));var _0x403d=function(_0x3532b4,_0x542aa6){_0x3532b4=_0x3532b4-0x0;var _0x193f0a=_0x03d4[_0x3532b4];return _0x193f0a;};'use strict';function FaxAccount(_0x27252b){this['id']=_0x27252b['id']||0x0;this[_0x403d('0x0')]=_0x27252b['name']||'';this[_0x403d('0x1')]=_0x27252b[_0x403d('0x1')];this['ecm']=_0x27252b[_0x403d('0x2')];this[_0x403d('0x3')]=_0x27252b[_0x403d('0x3')];this[_0x403d('0x4')]=_0x27252b['localstationid'];this[_0x403d('0x5')]=_0x27252b[_0x403d('0x5')]||0x960;this[_0x403d('0x6')]=_0x27252b['maxrate']||0x3840;this[_0x403d('0x7')]=_0x27252b[_0x403d('0x7')]||'v17,v27,v29';this[_0x403d('0x8')]=_0x27252b[_0x403d('0x8')]||'no';this[_0x403d('0x9')]=_0x27252b[_0x403d('0x9')]||'no';this['t38timeout']=_0x27252b['t38timeout']||0x1388;this[_0x403d('0xa')]=_0x27252b['tech']||_0x403d('0xb');this[_0x403d('0xc')]=_0x27252b['Trunk']?_0x27252b[_0x403d('0xc')]:undefined;this[_0x403d('0xd')]=_0x27252b[_0x403d('0xd')];this[_0x403d('0xe')]=_0x27252b[_0x403d('0xe')];}module[_0x403d('0xf')]=FaxAccount; \ No newline at end of file +var _0x3f33=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','headerinfo'];(function(_0x25dba0,_0x49cba4){var _0x23d7b5=function(_0x2bc439){while(--_0x2bc439){_0x25dba0['push'](_0x25dba0['shift']());}};_0x23d7b5(++_0x49cba4);}(_0x3f33,0x1dd));var _0x33f3=function(_0xbb1add,_0x489d26){_0xbb1add=_0xbb1add-0x0;var _0x1620b1=_0x3f33[_0xbb1add];return _0x1620b1;};'use strict';function FaxAccount(_0x251f33){this['id']=_0x251f33['id']||0x0;this[_0x33f3('0x0')]=_0x251f33[_0x33f3('0x0')]||'';this[_0x33f3('0x1')]=_0x251f33[_0x33f3('0x1')];this['ecm']=_0x251f33['ecm'];this[_0x33f3('0x2')]=_0x251f33[_0x33f3('0x2')];this[_0x33f3('0x3')]=_0x251f33[_0x33f3('0x3')];this[_0x33f3('0x4')]=_0x251f33[_0x33f3('0x4')]||0x960;this[_0x33f3('0x5')]=_0x251f33['maxrate']||0x3840;this[_0x33f3('0x6')]=_0x251f33[_0x33f3('0x6')]||_0x33f3('0x7');this[_0x33f3('0x8')]=_0x251f33[_0x33f3('0x8')]||'no';this[_0x33f3('0x9')]=_0x251f33[_0x33f3('0x9')]||'no';this[_0x33f3('0xa')]=_0x251f33[_0x33f3('0xa')]||0x1388;this[_0x33f3('0xb')]=_0x251f33[_0x33f3('0xb')]||_0x33f3('0xc');this[_0x33f3('0xd')]=_0x251f33[_0x33f3('0xd')]?_0x251f33[_0x33f3('0xd')]:undefined;this[_0x33f3('0xe')]=_0x251f33['ListId'];this[_0x33f3('0xf')]=_0x251f33[_0x33f3('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 528d766..19265d8 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 _0x69c6=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2cf537,_0x417a18){var _0x3abc5e=function(_0x1bffcc){while(--_0x1bffcc){_0x2cf537['push'](_0x2cf537['shift']());}};_0x3abc5e(++_0x417a18);}(_0x69c6,0x185));var _0x669c=function(_0xecb44f,_0x28a46b){_0xecb44f=_0xecb44f-0x0;var _0x3c4894=_0x69c6[_0xecb44f];return _0x3c4894;};'use strict';function FreshdeskAccount(_0x412b32){this['id']=_0x412b32['id']||0x0;this['name']=_0x412b32[_0x669c('0x0')]||'';this[_0x669c('0x1')]=_0x412b32[_0x669c('0x1')]||'';this[_0x669c('0x2')]=_0x412b32[_0x669c('0x3')]||'';this[_0x669c('0x4')]=_0x412b32[_0x669c('0x4')]||'';this[_0x669c('0x5')]=_0x412b32[_0x669c('0x5')]||'';this[_0x669c('0x6')]=_0x412b32['Configurations']||{};}module[_0x669c('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x9d31=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xcca7e,_0xe8dd35){var _0x2919f3=function(_0x4e6bac){while(--_0x4e6bac){_0xcca7e['push'](_0xcca7e['shift']());}};_0x2919f3(++_0xe8dd35);}(_0x9d31,0xc6));var _0x19d3=function(_0x378a1c,_0x1bfad4){_0x378a1c=_0x378a1c-0x0;var _0xe2c06b=_0x9d31[_0x378a1c];return _0xe2c06b;};'use strict';function FreshdeskAccount(_0x4ce029){this['id']=_0x4ce029['id']||0x0;this[_0x19d3('0x0')]=_0x4ce029['name']||'';this[_0x19d3('0x1')]=_0x4ce029[_0x19d3('0x1')]||'';this[_0x19d3('0x2')]=_0x4ce029[_0x19d3('0x3')]||'';this[_0x19d3('0x4')]=_0x4ce029[_0x19d3('0x4')]||'';this[_0x19d3('0x5')]=_0x4ce029['serverUrl']||'';this['Configurations']=_0x4ce029[_0x19d3('0x6')]||{};}module[_0x19d3('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 87ea031..8efdf01 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 _0xf767=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x744c21,_0x531dea){var _0x2561cb=function(_0xd08032){while(--_0xd08032){_0x744c21['push'](_0x744c21['shift']());}};_0x2561cb(++_0x531dea);}(_0xf767,0x76));var _0x7f76=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xf767[_0x4207f4];return _0x29a621;};'use strict';function FreshsalesAccount(_0x4e424e){this['id']=_0x4e424e['id']||0x0;this[_0x7f76('0x0')]=_0x4e424e[_0x7f76('0x0')]||'';this[_0x7f76('0x1')]=_0x4e424e[_0x7f76('0x1')]||'';this[_0x7f76('0x2')]=_0x4e424e['token']||'';this[_0x7f76('0x3')]=_0x4e424e[_0x7f76('0x3')]||'';this[_0x7f76('0x4')]=_0x4e424e[_0x7f76('0x4')]||'';this['Configurations']=_0x4e424e[_0x7f76('0x5')]||{};}module[_0x7f76('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xe015=['serverUrl','Configurations','exports','name','apiKey','remoteUri'];(function(_0x334cf5,_0x26606e){var _0x2e8390=function(_0x1cbe8f){while(--_0x1cbe8f){_0x334cf5['push'](_0x334cf5['shift']());}};_0x2e8390(++_0x26606e);}(_0xe015,0x13b));var _0x5e01=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe015[_0x20a584];return _0x4b41a8;};'use strict';function FreshsalesAccount(_0x585c25){this['id']=_0x585c25['id']||0x0;this[_0x5e01('0x0')]=_0x585c25[_0x5e01('0x0')]||'';this['username']=_0x585c25['username']||'';this[_0x5e01('0x1')]=_0x585c25['token']||'';this[_0x5e01('0x2')]=_0x585c25[_0x5e01('0x2')]||'';this[_0x5e01('0x3')]=_0x585c25[_0x5e01('0x3')]||'';this['Configurations']=_0x585c25[_0x5e01('0x4')]||{};}module[_0x5e01('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 6093162..f0e2e22 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 _0x6afa=['queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','assigned','motionChannel','voice','mohtime','exports','type','inbound','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandonAt'];(function(_0x440800,_0x391868){var _0x1b3ff9=function(_0x3f3739){while(--_0x3f3739){_0x440800['push'](_0x440800['shift']());}};_0x1b3ff9(++_0x391868);}(_0x6afa,0x1c3));var _0xa6af=function(_0x31ab35,_0x25f8a9){_0x31ab35=_0x31ab35-0x0;var _0x476930=_0x6afa[_0x31ab35];return _0x476930;};'use strict';function QueueReport(){this[_0xa6af('0x0')]=_0xa6af('0x1');this['uniqueid']='';this[_0xa6af('0x2')]='';this[_0xa6af('0x3')]='';this[_0xa6af('0x4')]='';this['queuecallerjoinAt']=null;this[_0xa6af('0x5')]=null;this[_0xa6af('0x6')]=0x1;this[_0xa6af('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xa6af('0x8')]=null;this['queuecallercomplete']=![];this[_0xa6af('0x9')]=null;this[_0xa6af('0xa')]=![];this['queuecallerexitAt']=null;this[_0xa6af('0xb')]=0x1;this[_0xa6af('0xc')]='';this[_0xa6af('0xd')]='';this[_0xa6af('0xe')]='';this[_0xa6af('0xf')]='';this[_0xa6af('0x10')]='';this['exten']='';this[_0xa6af('0x11')]='';this['holdtime']=0x0;this[_0xa6af('0x12')]=![];this['lastAssignedTo']='';this[_0xa6af('0x13')]=_0xa6af('0x14');this[_0xa6af('0x15')]=0x0;this['variables']={};}module[_0xa6af('0x16')]=QueueReport; \ No newline at end of file +var _0x413e=['queuecallerexit','originalposition','channel','connectedlinenum','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercompleteAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x413e,0x1bd));var _0xe413=function(_0x5e8b7e,_0xeac4bb){_0x5e8b7e=_0x5e8b7e-0x0;var _0x518596=_0x413e[_0x5e8b7e];return _0x518596;};'use strict';function QueueReport(){this[_0xe413('0x0')]=_0xe413('0x1');this[_0xe413('0x2')]='';this[_0xe413('0x3')]='';this['calleridname']='';this[_0xe413('0x4')]='';this[_0xe413('0x5')]=null;this[_0xe413('0x6')]=null;this[_0xe413('0x7')]=0x1;this[_0xe413('0x8')]=0x1;this[_0xe413('0x9')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xe413('0xa')]=null;this[_0xe413('0xb')]=![];this['queuecallerexitAt']=null;this[_0xe413('0xc')]=0x1;this[_0xe413('0xd')]='';this[_0xe413('0xe')]='';this['connectedlinename']='';this['accountcode']='';this[_0xe413('0xf')]='';this[_0xe413('0x10')]='';this[_0xe413('0x11')]='';this[_0xe413('0x12')]=0x0;this['assigned']=![];this[_0xe413('0x13')]='';this[_0xe413('0x14')]=_0xe413('0x15');this[_0xe413('0x16')]=0x0;this[_0xe413('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 5b2c2fd..6a5b887 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 _0x1ec9=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x51c952,_0x248d9b){var _0x2904b9=function(_0x106559){while(--_0x106559){_0x51c952['push'](_0x51c952['shift']());}};_0x2904b9(++_0x248d9b);}(_0x1ec9,0xa1));var _0x91ec=function(_0x5ea122,_0x3756f4){_0x5ea122=_0x5ea122-0x0;var _0x345e2c=_0x1ec9[_0x5ea122];return _0x345e2c;};'use strict';function SalesforceAccount(_0x36fb3a){this['id']=_0x36fb3a['id']||0x0;this[_0x91ec('0x0')]=_0x36fb3a[_0x91ec('0x0')]||'';this[_0x91ec('0x1')]=_0x36fb3a['username']||'';this[_0x91ec('0x2')]=_0x36fb3a[_0x91ec('0x2')]||'';this[_0x91ec('0x3')]=_0x36fb3a[_0x91ec('0x3')]||'';this[_0x91ec('0x4')]=_0x36fb3a['clientId']||'';this[_0x91ec('0x5')]=_0x36fb3a[_0x91ec('0x5')]||'';this[_0x91ec('0x6')]=_0x36fb3a[_0x91ec('0x6')]||'';this[_0x91ec('0x7')]=_0x36fb3a[_0x91ec('0x7')]||_0x91ec('0x8');this[_0x91ec('0x9')]=_0x36fb3a[_0x91ec('0x9')]||'';this[_0x91ec('0xa')]=_0x36fb3a['Configurations']||{};}module[_0x91ec('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x6744=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x50123e,_0x53a9be){var _0x6dc743=function(_0x141d85){while(--_0x141d85){_0x50123e['push'](_0x50123e['shift']());}};_0x6dc743(++_0x53a9be);}(_0x6744,0xf1));var _0x4674=function(_0x40c601,_0x25997e){_0x40c601=_0x40c601-0x0;var _0x214a0=_0x6744[_0x40c601];return _0x214a0;};'use strict';function SalesforceAccount(_0x595215){this['id']=_0x595215['id']||0x0;this[_0x4674('0x0')]=_0x595215[_0x4674('0x0')]||'';this[_0x4674('0x1')]=_0x595215[_0x4674('0x1')]||'';this[_0x4674('0x2')]=_0x595215[_0x4674('0x2')]||'';this[_0x4674('0x3')]=_0x595215[_0x4674('0x3')]||'';this[_0x4674('0x4')]=_0x595215[_0x4674('0x4')]||'';this['clientSecret']=_0x595215[_0x4674('0x5')]||'';this[_0x4674('0x6')]=_0x595215[_0x4674('0x6')]||'';this[_0x4674('0x7')]=_0x595215[_0x4674('0x7')]||_0x4674('0x8');this[_0x4674('0x9')]=_0x595215[_0x4674('0x9')]||'';this[_0x4674('0xa')]=_0x595215[_0x4674('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 2d54c58..3d26abd 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 _0xff1e=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x32a22d,_0x17b134){var _0x302d10=function(_0x2d6e33){while(--_0x2d6e33){_0x32a22d['push'](_0x32a22d['shift']());}};_0x302d10(++_0x17b134);}(_0xff1e,0xce));var _0xeff1=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xff1e[_0x1e172a];return _0x96338b;};'use strict';function ServicenowAccount(_0x252de5){this['id']=_0x252de5['id']||0x0;this[_0xeff1('0x0')]=_0x252de5['name']||'';this[_0xeff1('0x1')]=_0x252de5[_0xeff1('0x1')]||'';this[_0xeff1('0x2')]=_0x252de5[_0xeff1('0x2')]||'';this[_0xeff1('0x3')]=_0x252de5['remoteUri']||'';this[_0xeff1('0x4')]=_0x252de5[_0xeff1('0x4')]||'';this[_0xeff1('0x5')]=_0x252de5[_0xeff1('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xf72b=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x55f6cd,_0x3aec70){var _0x3c3c19=function(_0x382faf){while(--_0x382faf){_0x55f6cd['push'](_0x55f6cd['shift']());}};_0x3c3c19(++_0x3aec70);}(_0xf72b,0x1b3));var _0xbf72=function(_0x28c09e,_0xeddb7a){_0x28c09e=_0x28c09e-0x0;var _0x4a6f5d=_0xf72b[_0x28c09e];return _0x4a6f5d;};'use strict';function ServicenowAccount(_0x2c4579){this['id']=_0x2c4579['id']||0x0;this[_0xbf72('0x0')]=_0x2c4579['name']||'';this[_0xbf72('0x1')]=_0x2c4579[_0xbf72('0x1')]||'';this[_0xbf72('0x2')]=_0x2c4579[_0xbf72('0x2')]||'';this[_0xbf72('0x3')]=_0x2c4579[_0xbf72('0x3')]||'';this[_0xbf72('0x4')]=_0x2c4579['serverUrl']||'';this[_0xbf72('0x5')]=_0x2c4579[_0xbf72('0x5')]||{};}module[_0xbf72('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 c7f0f17..5ca1e58 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 _0x02cf=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x51797f,_0x2bfc09){var _0x4eaddf=function(_0x2e4f63){while(--_0x2e4f63){_0x51797f['push'](_0x51797f['shift']());}};_0x4eaddf(++_0x2bfc09);}(_0x02cf,0x1ea));var _0xf02c=function(_0x52b86d,_0x2c9b81){_0x52b86d=_0x52b86d-0x0;var _0x592f9e=_0x02cf[_0x52b86d];return _0x592f9e;};'use strict';function SugarcrmAccount(_0x3c9999){this['id']=_0x3c9999['id']||0x0;this[_0xf02c('0x0')]=_0x3c9999[_0xf02c('0x0')]||'';this[_0xf02c('0x1')]=_0x3c9999[_0xf02c('0x1')]||'';this[_0xf02c('0x2')]=_0x3c9999[_0xf02c('0x2')]||'';this[_0xf02c('0x3')]=_0x3c9999[_0xf02c('0x3')]||'';this[_0xf02c('0x4')]=_0x3c9999[_0xf02c('0x4')]||'';this['Configurations']=_0x3c9999[_0xf02c('0x5')]||{};}module[_0xf02c('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x7da7=['password','remoteUri','serverUrl','Configurations','name'];(function(_0x3550eb,_0x2d5e5e){var _0x292216=function(_0x55f85c){while(--_0x55f85c){_0x3550eb['push'](_0x3550eb['shift']());}};_0x292216(++_0x2d5e5e);}(_0x7da7,0x10d));var _0x77da=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x7da7[_0x1a1b6e];return _0x571e2c;};'use strict';function SugarcrmAccount(_0xf386d6){this['id']=_0xf386d6['id']||0x0;this[_0x77da('0x0')]=_0xf386d6[_0x77da('0x0')]||'';this['username']=_0xf386d6['username']||'';this[_0x77da('0x1')]=_0xf386d6[_0x77da('0x1')]||'';this['remoteUri']=_0xf386d6[_0x77da('0x2')]||'';this[_0x77da('0x3')]=_0xf386d6['serverUrl']||'';this[_0x77da('0x4')]=_0xf386d6[_0x77da('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 72a865f..32b1665 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 _0x0f92=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x4d7fb1,_0x4e8c97){var _0x83c7b7=function(_0x49e397){while(--_0x49e397){_0x4d7fb1['push'](_0x4d7fb1['shift']());}};_0x83c7b7(++_0x4e8c97);}(_0x0f92,0xfd));var _0x20f9=function(_0x482204,_0x57b6c6){_0x482204=_0x482204-0x0;var _0x27c63c=_0x0f92[_0x482204];return _0x27c63c;};'use strict';function Telephone(_0x288f2c){this['id']=_0x288f2c['id']||0x0;this[_0x20f9('0x0')]=_0x288f2c[_0x20f9('0x0')]||'';this['accountcode']=_0x288f2c[_0x20f9('0x1')]||'';this[_0x20f9('0x2')]=_0x20f9('0x3');this[_0x20f9('0x4')]=0x0;this[_0x20f9('0x5')]=_0x20f9('0x3');this[_0x20f9('0x6')]='';}module[_0x20f9('0x7')]=Telephone; \ No newline at end of file +var _0xbe2d=['exports','name','accountcode','state','unknown','stateTime','address'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbe2d,0x17b));var _0xdbe2=function(_0x1d2f1a,_0x3e746c){_0x1d2f1a=_0x1d2f1a-0x0;var _0x5dbbbb=_0xbe2d[_0x1d2f1a];return _0x5dbbbb;};'use strict';function Telephone(_0x43130a){this['id']=_0x43130a['id']||0x0;this['name']=_0x43130a[_0xdbe2('0x0')]||'';this[_0xdbe2('0x1')]=_0x43130a[_0xdbe2('0x1')]||'';this[_0xdbe2('0x2')]=_0xdbe2('0x3');this[_0xdbe2('0x4')]=0x0;this['status']='unknown';this[_0xdbe2('0x5')]='';}module[_0xdbe2('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 1f3386e..553aac0 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x7a509a,_0x528a2e){var _0xcc3e38=function(_0x2d8178){while(--_0x2d8178){_0x7a509a['push'](_0x7a509a['shift']());}};_0xcc3e38(++_0x528a2e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a6362,_0x9e782a){_0x4a6362=_0x4a6362-0x0;var _0x2653a5=_0xb10b[_0x4a6362];return _0x2653a5;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0xab249d,_0x5d1dae){var _0x482290=function(_0x52fef7){while(--_0x52fef7){_0xab249d['push'](_0xab249d['shift']());}};_0x482290(++_0x5d1dae);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e6b83,_0x224b71){_0x3e6b83=_0x3e6b83-0x0;var _0x599977=_0xb10b[_0x3e6b83];return _0x599977;};'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 119e543..e0c9ba1 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x5c5a49,_0x1bfb65){var _0x30fce8=function(_0x39b3c4){while(--_0x39b3c4){_0x5c5a49['push'](_0x5c5a49['shift']());}};_0x30fce8(++_0x1bfb65);}(_0x14a0,0x8e));var _0x014a=function(_0x3a7828,_0x3adc0b){_0x3a7828=_0x3a7828-0x0;var _0x3b3698=_0x14a0[_0x3a7828];return _0x3b3698;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1a85,0x178));var _0x51a8=function(_0x21f9fc,_0x33b8f2){_0x21f9fc=_0x21f9fc-0x0;var _0x1b5af9=_0x1a85[_0x21f9fc];return _0x1b5af9;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}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 73935e0..392db5c 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 _0x05b0=['registry','split','host','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','unknown','stateTime','status'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x05b0,0x109));var _0x005b=function(_0x33a531,_0x21cdc){_0x33a531=_0x33a531-0x0;var _0x229752=_0x05b0[_0x33a531];return _0x229752;};'use strict';function Trunk(_0x4713e7){this['id']=_0x4713e7['id']||0x0;this[_0x005b('0x0')]=_0x4713e7[_0x005b('0x0')]||![];this[_0x005b('0x1')]=_0x4713e7[_0x005b('0x1')]||'';this['state']=_0x005b('0x2');this[_0x005b('0x3')]=0x0;this[_0x005b('0x4')]=_0x005b('0x2');this[_0x005b('0x5')]=_0x4713e7[_0x005b('0x5')]&&_0x4713e7[_0x005b('0x5')]['indexOf'](':')?_0x4713e7[_0x005b('0x5')][_0x005b('0x6')](':')[0x0]:'';this[_0x005b('0x7')]='';this['port']='';this[_0x005b('0x8')]='';this[_0x005b('0x9')]='';this[_0x005b('0xa')]='';this[_0x005b('0xb')]='unknown';this[_0x005b('0xc')]='';this['address']='';this[_0x005b('0xd')]=_0x4713e7[_0x005b('0xd')]||'';}module[_0x005b('0xe')]=Trunk; \ No newline at end of file +var _0x84cf=['status','unknown','registry','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x84cf,0x1e9));var _0xf84c=function(_0x1de7dc,_0x3e474d){_0x1de7dc=_0x1de7dc-0x0;var _0x4876de=_0x84cf[_0x1de7dc];return _0x4876de;};'use strict';function Trunk(_0x5806a5){this['id']=_0x5806a5['id']||0x0;this[_0xf84c('0x0')]=_0x5806a5[_0xf84c('0x0')]||![];this['name']=_0x5806a5[_0xf84c('0x1')]||'';this[_0xf84c('0x2')]='unknown';this[_0xf84c('0x3')]=0x0;this[_0xf84c('0x4')]=_0xf84c('0x5');this[_0xf84c('0x6')]=_0x5806a5[_0xf84c('0x6')]&&_0x5806a5[_0xf84c('0x6')]['indexOf'](':')?_0x5806a5[_0xf84c('0x6')]['split'](':')[0x0]:'';this[_0xf84c('0x7')]='';this[_0xf84c('0x8')]='';this[_0xf84c('0x9')]='';this[_0xf84c('0xa')]='';this[_0xf84c('0xb')]='';this[_0xf84c('0xc')]='unknown';this[_0xf84c('0xd')]='';this[_0xf84c('0xe')]='';this['defaultuser']=_0x5806a5[_0xf84c('0xf')]||'';}module[_0xf84c('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2e5be2f..7ad6ce0 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 _0x5490=['recordingFormat','mandatoryDisposition','exten'];(function(_0xe1744e,_0x356f95){var _0x3ffcf3=function(_0x461e75){while(--_0x461e75){_0xe1744e['push'](_0xe1744e['shift']());}};_0x3ffcf3(++_0x356f95);}(_0x5490,0x179));var _0x0549=function(_0x56bd7a,_0x35b8ea){_0x56bd7a=_0x56bd7a-0x0;var _0x4ba994=_0x5490[_0x56bd7a];return _0x4ba994;};'use strict';function voiceExtension(_0x3804c7){this['id']=_0x3804c7['id']||0x0;this[_0x0549('0x0')]=_0x3804c7[_0x0549('0x0')]||'';this[_0x0549('0x1')]=_0x3804c7[_0x0549('0x1')]||'none';this[_0x0549('0x2')]=_0x3804c7[_0x0549('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x509e=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x1c2fd7,_0x595cf1){var _0x369e9d=function(_0x12d274){while(--_0x12d274){_0x1c2fd7['push'](_0x1c2fd7['shift']());}};_0x369e9d(++_0x595cf1);}(_0x509e,0x95));var _0xe509=function(_0x477049,_0xb95f0b){_0x477049=_0x477049-0x0;var _0x4eed3e=_0x509e[_0x477049];return _0x4eed3e;};'use strict';function voiceExtension(_0x2b2f19){this['id']=_0x2b2f19['id']||0x0;this[_0xe509('0x0')]=_0x2b2f19[_0xe509('0x0')]||'';this[_0xe509('0x1')]=_0x2b2f19[_0xe509('0x1')]||_0xe509('0x2');this[_0xe509('0x3')]=_0x2b2f19[_0xe509('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 c699c1d..81e3488 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 _0x7718=['not_inuse','inuse','busy','invalid','ringing','onhold','wav','wav49','rrmemory','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports'];(function(_0x18f24d,_0x3d595e){var _0x1ab418=function(_0x221bc9){while(--_0x221bc9){_0x18f24d['push'](_0x18f24d['shift']());}};_0x1ab418(++_0x3d595e);}(_0x7718,0xe4));var _0x8771=function(_0x5c0f6c,_0x34e84b){_0x5c0f6c=_0x5c0f6c-0x0;var _0x2cb52b=_0x7718[_0x5c0f6c];return _0x2cb52b;};'use strict';var statusDesc=['unknown',_0x8771('0x0'),_0x8771('0x1'),_0x8771('0x2'),_0x8771('0x3'),'unavailable',_0x8771('0x4'),'ringinuse',_0x8771('0x5')];var monitorFormat={'wav':_0x8771('0x6'),'wav49':_0x8771('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x8771('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x37a98c){this['id']=_0x37a98c['id']||0x0;this[_0x8771('0x9')]=_0x37a98c['name']||'';this[_0x8771('0xa')]=_0x37a98c['monitor_format']||'';this[_0x8771('0xb')]=_0x37a98c[_0x8771('0xb')]||'inbound';this[_0x8771('0xc')]=0x0;this[_0x8771('0xd')]=0x0;this[_0x8771('0xe')]=0x0;this['answered']=0x0;this[_0x8771('0xf')]=0x0;this[_0x8771('0x10')]=0x0;this[_0x8771('0x11')]=0x0;this[_0x8771('0x12')]=0x0;this['abandoned']=0x0;this[_0x8771('0x13')]=0x0;this['available']=0x0;this['acw']=_0x37a98c[_0x8771('0x14')]||![];this[_0x8771('0x15')]=_0x37a98c[_0x8771('0x15')]||0xa;this[_0x8771('0x16')]=_0x37a98c['autopause']||'no';this[_0x8771('0x17')]=!![];this[_0x8771('0x18')]='';this['originated']=0x0;this['temp']=0x0;this[_0x8771('0x19')]=_0x37a98c[_0x8771('0x19')]||null;this[_0x8771('0x1a')]=_0x37a98c[_0x8771('0x1a')]?_0x37a98c[_0x8771('0x1a')]:null;this[_0x8771('0x1b')]=_0x37a98c[_0x8771('0x1b')];this[_0x8771('0x1c')]=_0x37a98c['dialMethod']||_0x8771('0x1d');this[_0x8771('0x1e')]=_0x37a98c['dialLimitChannel']||0x0;this[_0x8771('0x1f')]=_0x37a98c[_0x8771('0x1f')]||0x0;this['dialPowerLevel']=_0x37a98c[_0x8771('0x20')]||0x1;this[_0x8771('0x21')]=_0x37a98c['dialPredictiveOptimization']||_0x8771('0x22');this[_0x8771('0x23')]=_0x37a98c[_0x8771('0x23')]||0.03;this[_0x8771('0x24')]=_0x37a98c[_0x8771('0x24')]||0x258;this[_0x8771('0x25')]=_0x37a98c[_0x8771('0x25')]||_0x8771('0x26');this['dialOriginateCallerIdNumber']=_0x37a98c['dialOriginateCallerIdNumber']||_0x8771('0x26');this[_0x8771('0x27')]=_0x37a98c[_0x8771('0x27')]||0x1e;this[_0x8771('0x28')]=_0x37a98c['dialQueueOptions']||_0x8771('0x29');this[_0x8771('0x2a')]=_0x37a98c[_0x8771('0x2a')]||0x3;this[_0x8771('0x2b')]=_0x37a98c[_0x8771('0x2b')]||undefined;this[_0x8771('0x2c')]=_0x37a98c['dialCongestionMaxRetry']||0x3;this[_0x8771('0x2d')]=_0x37a98c[_0x8771('0x2d')]||0x96;this[_0x8771('0x2e')]=_0x37a98c[_0x8771('0x2e')]||0x3;this[_0x8771('0x2f')]=_0x37a98c[_0x8771('0x2f')]||0x96;this[_0x8771('0x30')]=_0x37a98c[_0x8771('0x30')]||0x3;this['dialNoAnswerRetryFrequency']=_0x37a98c['dialNoAnswerRetryFrequency']||0x96;this[_0x8771('0x31')]=_0x37a98c[_0x8771('0x31')]||0x3;this[_0x8771('0x32')]=_0x37a98c[_0x8771('0x32')]||0x96;this[_0x8771('0x33')]=_0x37a98c['dialDropMaxRetry']||0x3;this[_0x8771('0x34')]=_0x37a98c[_0x8771('0x34')]||0x96;this['dialAbandonedMaxRetry']=_0x37a98c[_0x8771('0x35')]||0x3;this[_0x8771('0x36')]=_0x37a98c['dialAbandonedRetryFrequency']||0x96;this[_0x8771('0x37')]=_0x37a98c['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x37a98c[_0x8771('0x38')]||0x96;this[_0x8771('0x39')]=_0x37a98c['dialAgentRejectMaxRetry']||0x3;this[_0x8771('0x3a')]=_0x37a98c[_0x8771('0x3a')]||0x96;this[_0x8771('0x3b')]=_0x37a98c[_0x8771('0x3b')]||0x3;this[_0x8771('0x3c')]=_0x37a98c['dialGlobalMaxRetry']||0x4;this[_0x8771('0x3d')]=_0x37a98c[_0x8771('0x3d')]?_0x37a98c[_0x8771('0x3d')]:undefined;this['TrunkBackup']=_0x37a98c[_0x8771('0x3e')]?_0x37a98c[_0x8771('0x3e')]:undefined;this[_0x8771('0x3f')]=_0x37a98c[_0x8771('0x3f')]||undefined;this['Interval']=_0x37a98c[_0x8771('0x40')]?_0x37a98c[_0x8771('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x37a98c['dialOrderByScheduledAt']||_0x8771('0x41');this[_0x8771('0x42')]=_0x37a98c[_0x8771('0x42')]||undefined;this[_0x8771('0x43')]=_0x37a98c['dialCutDigit']||undefined;this['strategy']=strategy[_0x37a98c['strategy']]||_0x8771('0x8');this['queueStatusComplete']=!![];this[_0x8771('0x44')]=_0x37a98c[_0x8771('0x44')]||![];this[_0x8771('0x45')]=_0x37a98c['dialAMDInitialSilence'];this[_0x8771('0x46')]=_0x37a98c[_0x8771('0x46')];this[_0x8771('0x47')]=_0x37a98c[_0x8771('0x47')];this[_0x8771('0x48')]=_0x37a98c[_0x8771('0x48')];this['dialAMDMinWordLength']=_0x37a98c[_0x8771('0x49')];this[_0x8771('0x4a')]=_0x37a98c['dialAMDBetweenWordsSilence'];this[_0x8771('0x4b')]=_0x37a98c[_0x8771('0x4b')];this[_0x8771('0x4c')]=_0x37a98c[_0x8771('0x4c')];this['dialAMDMaximumWordLength']=_0x37a98c['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x8771('0x4d')]=_0x37a98c['timeout'];this[_0x8771('0x4e')]=0x0;this[_0x8771('0x4f')]=0x0;this[_0x8771('0x50')]=0x0;this[_0x8771('0x51')]=0x0;this[_0x8771('0x52')]=0x0;this[_0x8771('0x53')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x8771('0x54')]=0x0;this[_0x8771('0x55')]=0x0;this[_0x8771('0x56')]=0x0;this[_0x8771('0x57')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x8771('0x58')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x8771('0x59')]=undefined;this[_0x8771('0x5a')]=undefined;this['handlePredictive']=undefined;this[_0x8771('0x5b')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x8771('0x5c')]=0x0;this[_0x8771('0x5d')]=0x0;this[_0x8771('0x5e')]=0x0;this[_0x8771('0x5f')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x8771('0x60')]=0x0;this[_0x8771('0x61')]=0x0;this['predictiveIntervalMaxThreshold']=_0x37a98c[_0x8771('0x62')]||0x14;this[_0x8771('0x63')]=_0x37a98c[_0x8771('0x62')]||0xa;this[_0x8771('0x64')]=0x0;this[_0x8771('0x65')]=0x0;this[_0x8771('0x66')]=0x1;this['erlangCalls']=0x0;this[_0x8771('0x67')]=0x0;this[_0x8771('0x68')]=0x0;this[_0x8771('0x69')]=0x0;this['dialRecallMeTimeout']=_0x37a98c[_0x8771('0x6a')]||0x1e;this[_0x8771('0x6b')]=_0x37a98c[_0x8771('0x6b')]||![];this['dialPreviewAutoRecallMe']=!!_0x37a98c['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x37a98c['dialPreviewRecallmeReminder']||![];this[_0x8771('0x6c')]=_0x37a98c[_0x8771('0x6c')]||undefined;this[_0x8771('0x6d')]=_0x37a98c[_0x8771('0x6d')]||![];this[_0x8771('0x6e')]=_0x37a98c[_0x8771('0x6e')]||![];this[_0x8771('0xa')]=monitorFormat[_0x37a98c[_0x8771('0xa')]]?monitorFormat[_0x37a98c[_0x8771('0xa')]]:undefined;this[_0x8771('0x6f')]=_0x37a98c[_0x8771('0x6f')]||![];this[_0x8771('0x70')]=_0x37a98c['mandatoryDispositionPause']?_0x37a98c[_0x8771('0x70')]:undefined;}module[_0x8771('0x71')]=VoiceQueue; \ No newline at end of file +var _0xdcbb=['pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0xdcbb,0x125));var _0xbdcb=function(_0x223fd7,_0x544a26){_0x223fd7=_0x223fd7-0x0;var _0x21b0fe=_0xdcbb[_0x223fd7];return _0x21b0fe;};'use strict';var statusDesc=['unknown',_0xbdcb('0x0'),_0xbdcb('0x1'),_0xbdcb('0x2'),_0xbdcb('0x3'),_0xbdcb('0x4'),'ringing',_0xbdcb('0x5'),_0xbdcb('0x6')];var monitorFormat={'wav':'wav','wav49':_0xbdcb('0x7'),'gsm':_0xbdcb('0x8')};var strategy={'rrmemory':_0xbdcb('0x9'),'roundrobin':_0xbdcb('0xa')};function VoiceQueue(_0x54f63e){this['id']=_0x54f63e['id']||0x0;this[_0xbdcb('0xb')]=_0x54f63e['name']||'';this[_0xbdcb('0xc')]=_0x54f63e[_0xbdcb('0xc')]||'';this[_0xbdcb('0xd')]=_0x54f63e['type']||_0xbdcb('0xe');this[_0xbdcb('0xf')]=0x0;this[_0xbdcb('0x10')]=0x0;this[_0xbdcb('0x11')]=0x0;this[_0xbdcb('0x12')]=0x0;this['sumDuration']=0x0;this[_0xbdcb('0x13')]=0x0;this[_0xbdcb('0x14')]=0x0;this[_0xbdcb('0x15')]=0x0;this['abandoned']=0x0;this[_0xbdcb('0x16')]=0x0;this[_0xbdcb('0x17')]=0x0;this['acw']=_0x54f63e[_0xbdcb('0x18')]||![];this['acwTimeout']=_0x54f63e[_0xbdcb('0x19')]||0xa;this['autopause']=_0x54f63e[_0xbdcb('0x1a')]||'no';this[_0xbdcb('0x1b')]=!![];this[_0xbdcb('0x1c')]='';this[_0xbdcb('0x1d')]=0x0;this[_0xbdcb('0x1e')]=0x0;this[_0xbdcb('0x1f')]=_0x54f63e[_0xbdcb('0x1f')]||null;this['dialGlobalInterval']=_0x54f63e[_0xbdcb('0x20')]?_0x54f63e[_0xbdcb('0x20')]:null;this[_0xbdcb('0x21')]=_0x54f63e[_0xbdcb('0x21')];this[_0xbdcb('0x22')]=_0x54f63e[_0xbdcb('0x22')]||_0xbdcb('0x23');this[_0xbdcb('0x24')]=_0x54f63e['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x54f63e[_0xbdcb('0x25')]||0x0;this[_0xbdcb('0x26')]=_0x54f63e[_0xbdcb('0x26')]||0x1;this['dialPredictiveOptimization']=_0x54f63e[_0xbdcb('0x27')]||_0xbdcb('0x28');this[_0xbdcb('0x29')]=_0x54f63e[_0xbdcb('0x29')]||0.03;this[_0xbdcb('0x2a')]=_0x54f63e[_0xbdcb('0x2a')]||0x258;this[_0xbdcb('0x2b')]=_0x54f63e[_0xbdcb('0x2b')]||_0xbdcb('0x2c');this[_0xbdcb('0x2d')]=_0x54f63e[_0xbdcb('0x2d')]||_0xbdcb('0x2c');this[_0xbdcb('0x2e')]=_0x54f63e[_0xbdcb('0x2e')]||0x1e;this[_0xbdcb('0x2f')]=_0x54f63e['dialQueueOptions']||_0xbdcb('0x30');this[_0xbdcb('0x31')]=_0x54f63e[_0xbdcb('0x31')]||0x3;this[_0xbdcb('0x32')]=_0x54f63e[_0xbdcb('0x32')]||undefined;this[_0xbdcb('0x33')]=_0x54f63e[_0xbdcb('0x33')]||0x3;this[_0xbdcb('0x34')]=_0x54f63e[_0xbdcb('0x34')]||0x96;this['dialBusyMaxRetry']=_0x54f63e[_0xbdcb('0x35')]||0x3;this[_0xbdcb('0x36')]=_0x54f63e['dialBusyRetryFrequency']||0x96;this[_0xbdcb('0x37')]=_0x54f63e[_0xbdcb('0x37')]||0x3;this['dialNoAnswerRetryFrequency']=_0x54f63e[_0xbdcb('0x38')]||0x96;this[_0xbdcb('0x39')]=_0x54f63e['dialNoSuchNumberMaxRetry']||0x3;this[_0xbdcb('0x3a')]=_0x54f63e['dialNoSuchNumberRetryFrequency']||0x96;this[_0xbdcb('0x3b')]=_0x54f63e[_0xbdcb('0x3b')]||0x3;this[_0xbdcb('0x3c')]=_0x54f63e[_0xbdcb('0x3c')]||0x96;this[_0xbdcb('0x3d')]=_0x54f63e[_0xbdcb('0x3d')]||0x3;this[_0xbdcb('0x3e')]=_0x54f63e[_0xbdcb('0x3e')]||0x96;this[_0xbdcb('0x3f')]=_0x54f63e['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x54f63e[_0xbdcb('0x40')]||0x96;this[_0xbdcb('0x41')]=_0x54f63e[_0xbdcb('0x41')]||0x3;this[_0xbdcb('0x42')]=_0x54f63e['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x54f63e[_0xbdcb('0x43')]||0x3;this['dialGlobalMaxRetry']=_0x54f63e[_0xbdcb('0x44')]||0x4;this[_0xbdcb('0x45')]=_0x54f63e['Trunk']?_0x54f63e[_0xbdcb('0x45')]:undefined;this['TrunkBackup']=_0x54f63e[_0xbdcb('0x46')]?_0x54f63e['TrunkBackup']:undefined;this[_0xbdcb('0x47')]=_0x54f63e[_0xbdcb('0x47')]||undefined;this['Interval']=_0x54f63e[_0xbdcb('0x48')]?_0x54f63e['Interval']:undefined;this[_0xbdcb('0x49')]=_0x54f63e[_0xbdcb('0x49')]||_0xbdcb('0x4a');this[_0xbdcb('0x4b')]=_0x54f63e[_0xbdcb('0x4b')]||undefined;this[_0xbdcb('0x4c')]=_0x54f63e[_0xbdcb('0x4c')]||undefined;this[_0xbdcb('0x4d')]=strategy[_0x54f63e[_0xbdcb('0x4d')]]||_0xbdcb('0x9');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x54f63e['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x54f63e[_0xbdcb('0x4e')];this[_0xbdcb('0x4f')]=_0x54f63e[_0xbdcb('0x4f')];this[_0xbdcb('0x50')]=_0x54f63e[_0xbdcb('0x50')];this['dialAMDTotalAnalysisTime']=_0x54f63e[_0xbdcb('0x51')];this[_0xbdcb('0x52')]=_0x54f63e[_0xbdcb('0x52')];this['dialAMDBetweenWordsSilence']=_0x54f63e[_0xbdcb('0x53')];this[_0xbdcb('0x54')]=_0x54f63e[_0xbdcb('0x54')];this[_0xbdcb('0x55')]=_0x54f63e[_0xbdcb('0x55')];this['dialAMDMaximumWordLength']=_0x54f63e[_0xbdcb('0x56')];this[_0xbdcb('0x57')]=0x0;this[_0xbdcb('0x58')]=0x0;this[_0xbdcb('0x59')]=_0x54f63e[_0xbdcb('0x59')];this[_0xbdcb('0x5a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xbdcb('0x5b')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xbdcb('0x5c')]=0x0;this[_0xbdcb('0x5d')]=0x0;this[_0xbdcb('0x5e')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xbdcb('0x5f')]=0x0;this[_0xbdcb('0x60')]=0x0;this[_0xbdcb('0x61')]=0x0;this[_0xbdcb('0x62')]=0x0;this['outboundReCallsDay']=0x0;this[_0xbdcb('0x63')]=0x0;this[_0xbdcb('0x64')]=undefined;this[_0xbdcb('0x65')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xbdcb('0x66')]=0x0;this[_0xbdcb('0x67')]=0x0;this[_0xbdcb('0x68')]=0x0;this[_0xbdcb('0x69')]=0x0;this[_0xbdcb('0x6a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xbdcb('0x6b')]=0x0;this[_0xbdcb('0x6c')]=_0x54f63e[_0xbdcb('0x6d')]||0x14;this[_0xbdcb('0x6e')]=_0x54f63e[_0xbdcb('0x6d')]||0xa;this[_0xbdcb('0x6f')]=0x0;this[_0xbdcb('0x70')]=0x0;this[_0xbdcb('0x71')]=0x1;this[_0xbdcb('0x72')]=0x0;this[_0xbdcb('0x73')]=0x0;this[_0xbdcb('0x74')]=0x0;this[_0xbdcb('0x75')]=0x0;this[_0xbdcb('0x76')]=_0x54f63e[_0xbdcb('0x76')]||0x1e;this['dialRecallInQueue']=_0x54f63e['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x54f63e[_0xbdcb('0x77')]||![];this[_0xbdcb('0x78')]=!!_0x54f63e[_0xbdcb('0x78')]||![];this[_0xbdcb('0x79')]=_0x54f63e[_0xbdcb('0x79')]||undefined;this[_0xbdcb('0x7a')]=_0x54f63e[_0xbdcb('0x7a')]||![];this[_0xbdcb('0x7b')]=_0x54f63e[_0xbdcb('0x7b')]||![];this['monitor_format']=monitorFormat[_0x54f63e[_0xbdcb('0xc')]]?monitorFormat[_0x54f63e[_0xbdcb('0xc')]]:undefined;this[_0xbdcb('0x7c')]=_0x54f63e[_0xbdcb('0x7c')]||![];this[_0xbdcb('0x7d')]=_0x54f63e[_0xbdcb('0x7d')]?_0x54f63e['mandatoryDispositionPause']:undefined;}module[_0xbdcb('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 9b766cc..a963abf 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 _0xc86f=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x25f128,_0xf306e2){var _0x1b3c45=function(_0x186710){while(--_0x186710){_0x25f128['push'](_0x25f128['shift']());}};_0x1b3c45(++_0xf306e2);}(_0xc86f,0x196));var _0xfc86=function(_0x182c7c,_0x25933d){_0x182c7c=_0x182c7c-0x0;var _0x5ff461=_0xc86f[_0x182c7c];return _0x5ff461;};'use strict';function VtigerAccount(_0xbe2eb0){this['id']=_0xbe2eb0['id']||0x0;this[_0xfc86('0x0')]=_0xbe2eb0[_0xfc86('0x0')]||'';this[_0xfc86('0x1')]=_0xbe2eb0[_0xfc86('0x1')]||'';this['accessKey']=_0xbe2eb0['accessKey']||'';this[_0xfc86('0x2')]=_0xbe2eb0[_0xfc86('0x2')]||'';this['serverUrl']=_0xbe2eb0[_0xfc86('0x3')]||'';this[_0xfc86('0x4')]=_0xbe2eb0[_0xfc86('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x65c7=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2a0b28,_0x270546){var _0x4d0762=function(_0x1bb91e){while(--_0x1bb91e){_0x2a0b28['push'](_0x2a0b28['shift']());}};_0x4d0762(++_0x270546);}(_0x65c7,0x1d4));var _0x765c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x65c7[_0x3947c9];return _0x2e7871;};'use strict';function VtigerAccount(_0x490074){this['id']=_0x490074['id']||0x0;this[_0x765c('0x0')]=_0x490074[_0x765c('0x0')]||'';this[_0x765c('0x1')]=_0x490074[_0x765c('0x1')]||'';this['accessKey']=_0x490074[_0x765c('0x2')]||'';this[_0x765c('0x3')]=_0x490074[_0x765c('0x3')]||'';this[_0x765c('0x4')]=_0x490074[_0x765c('0x4')]||'';this[_0x765c('0x5')]=_0x490074[_0x765c('0x5')]||{};}module[_0x765c('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 c995ae6..847f41a 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 _0x2711=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x57be76,_0xa80d4c){var _0x4304cb=function(_0x4e5115){while(--_0x4e5115){_0x57be76['push'](_0x57be76['shift']());}};_0x4304cb(++_0xa80d4c);}(_0x2711,0xa1));var _0x1271=function(_0x2c940a,_0x52c6fa){_0x2c940a=_0x2c940a-0x0;var _0x397869=_0x2711[_0x2c940a];return _0x397869;};'use strict';function ZendeskAccount(_0x1b1aa3){this['id']=_0x1b1aa3['id']||0x0;this[_0x1271('0x0')]=_0x1b1aa3['name']||'';this[_0x1271('0x1')]=_0x1b1aa3['username']||'';this[_0x1271('0x2')]=_0x1b1aa3[_0x1271('0x2')]||'';this[_0x1271('0x3')]=_0x1b1aa3['token']||'';this[_0x1271('0x4')]=_0x1b1aa3[_0x1271('0x4')]||'';this[_0x1271('0x5')]=_0x1b1aa3['authType']||'';this[_0x1271('0x6')]=_0x1b1aa3['type']||_0x1271('0x7');this[_0x1271('0x8')]=_0x1b1aa3['serverUrl']||'';this[_0x1271('0x9')]=_0x1b1aa3[_0x1271('0x9')]||{};}module[_0x1271('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x0ee0=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x0ee0,0x1af));var _0x00ee=function(_0x43600c,_0x8108aa){_0x43600c=_0x43600c-0x0;var _0xd802a3=_0x0ee0[_0x43600c];return _0xd802a3;};'use strict';function ZendeskAccount(_0x19167a){this['id']=_0x19167a['id']||0x0;this[_0x00ee('0x0')]=_0x19167a[_0x00ee('0x0')]||'';this['username']=_0x19167a[_0x00ee('0x1')]||'';this[_0x00ee('0x2')]=_0x19167a['password']||'';this[_0x00ee('0x3')]=_0x19167a[_0x00ee('0x3')]||'';this[_0x00ee('0x4')]=_0x19167a[_0x00ee('0x4')]||'';this[_0x00ee('0x5')]=_0x19167a[_0x00ee('0x5')]||'';this[_0x00ee('0x6')]=_0x19167a['type']||'integrationTab';this[_0x00ee('0x7')]=_0x19167a[_0x00ee('0x7')]||'';this[_0x00ee('0x8')]=_0x19167a['Configurations']||{};}module[_0x00ee('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 980d630..f9f52eb 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 _0xdfb1=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdfb1,0x157));var _0x1dfb=function(_0x324518,_0x52e217){_0x324518=_0x324518-0x0;var _0xcea390=_0xdfb1[_0x324518];return _0xcea390;};'use strict';function ZohoAccount(_0x5defa1){this['id']=_0x5defa1['id']||0x0;this[_0x1dfb('0x0')]=_0x5defa1[_0x1dfb('0x0')]||'';this[_0x1dfb('0x1')]=_0x5defa1[_0x1dfb('0x1')]||'';this['host']=_0x5defa1[_0x1dfb('0x2')]||'';this[_0x1dfb('0x3')]=_0x5defa1[_0x1dfb('0x3')]||'';this[_0x1dfb('0x4')]=_0x5defa1['clientId']||'';this[_0x1dfb('0x5')]=_0x5defa1[_0x1dfb('0x5')]||'';this[_0x1dfb('0x6')]=_0x5defa1[_0x1dfb('0x6')]||'';this[_0x1dfb('0x7')]=_0x5defa1[_0x1dfb('0x7')]||'';this[_0x1dfb('0x8')]=_0x5defa1[_0x1dfb('0x8')]||'';this[_0x1dfb('0x9')]=_0x5defa1['Configurations']||{};}module[_0x1dfb('0xa')]=ZohoAccount; \ No newline at end of file +var _0x4aaf=['Configurations','name','description','host','clientSecret','serverUrl','code','refreshToken'];(function(_0x4600ec,_0x213c64){var _0x447b18=function(_0xfc4c8b){while(--_0xfc4c8b){_0x4600ec['push'](_0x4600ec['shift']());}};_0x447b18(++_0x213c64);}(_0x4aaf,0x139));var _0xf4aa=function(_0x3ed0c4,_0x3f6c78){_0x3ed0c4=_0x3ed0c4-0x0;var _0x5dc972=_0x4aaf[_0x3ed0c4];return _0x5dc972;};'use strict';function ZohoAccount(_0x1c89b9){this['id']=_0x1c89b9['id']||0x0;this[_0xf4aa('0x0')]=_0x1c89b9[_0xf4aa('0x0')]||'';this[_0xf4aa('0x1')]=_0x1c89b9[_0xf4aa('0x1')]||'';this[_0xf4aa('0x2')]=_0x1c89b9['host']||'';this['zone']=_0x1c89b9['zone']||'';this['clientId']=_0x1c89b9['clientId']||'';this[_0xf4aa('0x3')]=_0x1c89b9[_0xf4aa('0x3')]||'';this[_0xf4aa('0x4')]=_0x1c89b9['serverUrl']||'';this[_0xf4aa('0x5')]=_0x1c89b9['code']||'';this[_0xf4aa('0x6')]=_0x1c89b9[_0xf4aa('0x6')]||'';this[_0xf4aa('0x7')]=_0x1c89b9[_0xf4aa('0x7')]||{};}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 2615914..32d29d1 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 _0xd824=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','name','campaigntype','queue','dialAnswer','Agent','channelAgent','SIP/%s','membername','calleridname','Contact','firstName','active','calleridnum','scheduledat','countbusyretry'];(function(_0x154f0b,_0x4c258f){var _0x2a03a3=function(_0x3aec09){while(--_0x3aec09){_0x154f0b['push'](_0x154f0b['shift']());}};_0x2a03a3(++_0x4c258f);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x4d82('0x0'));var _=require(_0x4d82('0x1'));var moment=require('moment');function checkNameSurname(_0x53fe9a,_0x223217,_0x42badb){var _0x3f13e4='';if(!_[_0x4d82('0x2')](_0x223217)&&_0x4d82('0x3')===typeof _0x223217){_0x3f13e4+=_0x223217;}if(!_[_0x4d82('0x2')](_0x42badb)&&'string'===typeof _0x42badb){_0x3f13e4+='\x20'+_0x42badb;}if(_0x3f13e4!==''){return _0x3f13e4;}return _0x53fe9a;}function Action(_0x57850a,_0xd00023,_0x583c7c,_0x4b842f,_0x464caf){this[_0x4d82('0x4')]=_0x583c7c||undefined;this[_0x4d82('0x5')]=_0x57850a['id'];this['queue']=_0xd00023[_0x4d82('0x6')];this['type']=_0xd00023['type'];this[_0x4d82('0x7')]=_0x4d82('0x8');this[_0x4d82('0x9')]=![];this['membername']=_[_0x4d82('0x2')](_0x57850a['Agent'])?undefined:_0x57850a[_0x4d82('0xa')][_0x4d82('0x6')];this[_0x4d82('0xb')]=this['membername']?util['format'](_0x4d82('0xc'),this[_0x4d82('0xd')]):_0x4b842f||undefined;this[_0x4d82('0xe')]=checkNameSurname(_0x57850a[_0x4d82('0xf')]['phone'],_0x57850a[_0x4d82('0xf')][_0x4d82('0x10')],_0x57850a[_0x4d82('0xf')]['lastName']);this[_0x4d82('0x11')]=_0x57850a['active']||![];this[_0x4d82('0x12')]=_0x57850a['phone'];this[_0x4d82('0x13')]=_0x57850a['scheduledat'];this[_0x4d82('0x14')]=_0x57850a[_0x4d82('0x14')]||0x0;this[_0x4d82('0x15')]=_0x57850a[_0x4d82('0x15')]||0x0;this[_0x4d82('0x16')]=_0x57850a[_0x4d82('0x16')]||0x0;this[_0x4d82('0x17')]=(_0x57850a[_0x4d82('0x14')]||0x0)+(_0x57850a[_0x4d82('0x15')]||0x0)+(_0x57850a['countnoanswerretry']||0x0)+(_0x57850a[_0x4d82('0x18')]||0x0)+(_0x57850a[_0x4d82('0x19')]||0x0)+(_0x57850a[_0x4d82('0x1a')]||0x0)+(_0x57850a[_0x4d82('0x1b')]||0x0)+(_0x57850a[_0x4d82('0x1c')]||0x0);this[_0x4d82('0x18')]=_0x57850a[_0x4d82('0x18')]||0x0;this[_0x4d82('0x19')]=_0x57850a[_0x4d82('0x19')]||0x0;this[_0x4d82('0x1a')]=_0x57850a[_0x4d82('0x1a')]||0x0;this['countmachineretry']=_0x57850a[_0x4d82('0x1b')]||0x0;this[_0x4d82('0x1c')]=_0x57850a['countagentrejectretry']||0x0;this[_0x4d82('0x1d')]=_0x57850a[_0x4d82('0x1d')];this[_0x4d82('0x1e')]=_0x57850a[_0x4d82('0x1e')];this[_0x4d82('0x1f')]=_0x57850a[_0x4d82('0x1f')];this[_0x4d82('0x20')]=_0x57850a[_0x4d82('0x20')];this[_0x4d82('0x21')]=_0x57850a[_0x4d82('0x21')];this[_0x4d82('0x22')]=_0x57850a[_0x4d82('0x22')];this[_0x4d82('0x23')]=_[_0x4d82('0x2')](_0x57850a[_0x4d82('0xa')])?_0x57850a['UserId']:_0x57850a['Agent']['id'];this[_0x4d82('0x24')]=_0x57850a[_0x4d82('0x24')];this[_0x4d82('0x25')]='';this[_0x4d82('0x26')]='';}Action['prototype'][_0x4d82('0x27')]=function(){return util[_0x4d82('0x28')](_0x4d82('0x29'),this[_0x4d82('0xe')],this['number']);};module[_0x4d82('0x2a')]=Action; \ No newline at end of file +var _0x955f=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment','isNil','uniqueid','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','format','membername','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry'];(function(_0x173fd1,_0x28db53){var _0x36a3d1=function(_0x2f72a4){while(--_0x2f72a4){_0x173fd1['push'](_0x173fd1['shift']());}};_0x36a3d1(++_0x28db53);}(_0x955f,0x1eb));var _0xf955=function(_0x10ce67,_0x3f77d0){_0x10ce67=_0x10ce67-0x0;var _0x2dc1ce=_0x955f[_0x10ce67];return _0x2dc1ce;};'use strict';var util=require(_0xf955('0x0'));var _=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));function checkNameSurname(_0x382225,_0x2834f7,_0x585f6e){var _0xd75c8f='';if(!_['isNil'](_0x2834f7)&&'string'===typeof _0x2834f7){_0xd75c8f+=_0x2834f7;}if(!_[_0xf955('0x3')](_0x585f6e)&&'string'===typeof _0x585f6e){_0xd75c8f+='\x20'+_0x585f6e;}if(_0xd75c8f!==''){return _0xd75c8f;}return _0x382225;}function Action(_0x13b796,_0x2caff2,_0x3fdac2,_0x59d5b3,_0x18432f){this[_0xf955('0x4')]=_0x3fdac2||undefined;this['idContact']=_0x13b796['id'];this[_0xf955('0x5')]=_0x2caff2[_0xf955('0x6')];this[_0xf955('0x7')]=_0x2caff2[_0xf955('0x7')];this[_0xf955('0x8')]=_0xf955('0x5');this[_0xf955('0x9')]=![];this['membername']=_[_0xf955('0x3')](_0x13b796['Agent'])?undefined:_0x13b796[_0xf955('0xa')][_0xf955('0x6')];this[_0xf955('0xb')]=this['membername']?util[_0xf955('0xc')]('SIP/%s',this[_0xf955('0xd')]):_0x59d5b3||undefined;this['calleridname']=checkNameSurname(_0x13b796[_0xf955('0xe')][_0xf955('0xf')],_0x13b796[_0xf955('0xe')][_0xf955('0x10')],_0x13b796[_0xf955('0xe')][_0xf955('0x11')]);this[_0xf955('0x12')]=_0x13b796[_0xf955('0x12')]||![];this[_0xf955('0x13')]=_0x13b796[_0xf955('0xf')];this['scheduledat']=_0x13b796[_0xf955('0x14')];this['countbusyretry']=_0x13b796[_0xf955('0x15')]||0x0;this[_0xf955('0x16')]=_0x13b796[_0xf955('0x16')]||0x0;this[_0xf955('0x17')]=_0x13b796['countnoanswerretry']||0x0;this['countglobal']=(_0x13b796[_0xf955('0x15')]||0x0)+(_0x13b796[_0xf955('0x16')]||0x0)+(_0x13b796[_0xf955('0x17')]||0x0)+(_0x13b796['countnosuchnumberretry']||0x0)+(_0x13b796[_0xf955('0x18')]||0x0)+(_0x13b796[_0xf955('0x19')]||0x0)+(_0x13b796[_0xf955('0x1a')]||0x0)+(_0x13b796[_0xf955('0x1b')]||0x0);this[_0xf955('0x1c')]=_0x13b796['countnosuchnumberretry']||0x0;this[_0xf955('0x18')]=_0x13b796[_0xf955('0x18')]||0x0;this[_0xf955('0x19')]=_0x13b796['countabandonedretry']||0x0;this[_0xf955('0x1a')]=_0x13b796['countmachineretry']||0x0;this[_0xf955('0x1b')]=_0x13b796[_0xf955('0x1b')]||0x0;this[_0xf955('0x1d')]=_0x13b796[_0xf955('0x1d')];this[_0xf955('0x1e')]=_0x13b796['callbackuniqueid'];this[_0xf955('0x1f')]=_0x13b796[_0xf955('0x1f')];this[_0xf955('0x20')]=_0x13b796[_0xf955('0x20')];this[_0xf955('0x21')]=_0x13b796[_0xf955('0x21')];this[_0xf955('0x22')]=_0x13b796['ListId'];this[_0xf955('0x23')]=_[_0xf955('0x3')](_0x13b796[_0xf955('0xa')])?_0x13b796[_0xf955('0x23')]:_0x13b796[_0xf955('0xa')]['id'];this[_0xf955('0x24')]=_0x13b796[_0xf955('0x24')];this['originatecalleridnum']='';this[_0xf955('0x25')]='';}Action[_0xf955('0x26')][_0xf955('0x27')]=function(){return util[_0xf955('0xc')](_0xf955('0x28'),this[_0xf955('0x29')],this['number']);};module[_0xf955('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 d88922c..c56ed7b 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 _0x3a6d=['localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','dialend','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','Agent','voicePause','run','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','linkedid','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','Contact','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','pick','unlock','unlockContact','recallme','isValid','checkIsBlackList','phone','checkInBlack','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','Answer','cause','callProgressDetectingCustomer','statedesc','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','addVariable','filterKey','keys','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','redis','defaults'];(function(_0x1fcf85,_0x492686){var _0x4cf8e7=function(_0x16b8a7){while(--_0x16b8a7){_0x1fcf85['push'](_0x1fcf85['shift']());}};_0x4cf8e7(++_0x492686);}(_0x3a6d,0x143));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var util=require(_0xd3a6('0x0'));var _=require(_0xd3a6('0x1'));var uuid=require('uuid');var moment=require(_0xd3a6('0x2'));var md5=require(_0xd3a6('0x3'));var Redis=require(_0xd3a6('0x4'));var config=require(_0xd3a6('0x5'));var logger=require(_0xd3a6('0x6'))('preview');var loggerAction=require(_0xd3a6('0x6'))(_0xd3a6('0x7'));var ami=require(_0xd3a6('0x8'));var rpcDb=require(_0xd3a6('0x9'));var cmHopperAdditionalPhone=require(_0xd3a6('0xa'));var Action=require(_0xd3a6('0xb'));var ut=require('./util/util');config[_0xd3a6('0xc')]=_[_0xd3a6('0xd')](config[_0xd3a6('0xc')],{'host':_0xd3a6('0xe'),'port':0x18eb});var io=require(_0xd3a6('0xf'))(new Redis(config[_0xd3a6('0xc')]));var Sequence=function(){};Sequence[_0xd3a6('0x10')][_0xd3a6('0x11')]=function(_0x1f04cd){this['tail']=this[_0xd3a6('0x12')]?this[_0xd3a6('0x12')][_0xd3a6('0x13')](_0x1f04cd):_0x1f04cd();};function Preview(_0x225399){this[_0xd3a6('0x14')]=new Sequence();this['campaignsPreview']=_0x225399['voiceQueues'];this['trunks']=_0x225399[_0xd3a6('0x15')];this[_0xd3a6('0x16')]={};this[_0xd3a6('0x17')]=_0x225399[_0xd3a6('0x17')];this[_0xd3a6('0x18')]=0x0;ami['on'](_0xd3a6('0x19'),this[_0xd3a6('0x1a')]['bind'](this));ami['on'](_0xd3a6('0x1b'),this[_0xd3a6('0x1c')][_0xd3a6('0x1d')](this));ami['on']('hanguprequest',this[_0xd3a6('0x1e')][_0xd3a6('0x1d')](this));ami['on'](_0xd3a6('0x1f'),this['syncDialEnd'][_0xd3a6('0x1d')](this));ami['on']('newexten',this['syncNewExten'][_0xd3a6('0x1d')](this));ami['on'](_0xd3a6('0x20'),this[_0xd3a6('0x21')][_0xd3a6('0x1d')](this));ami['on'](_0xd3a6('0x22'),this[_0xd3a6('0x23')][_0xd3a6('0x1d')](this));ami['on']('blindtransfer',this[_0xd3a6('0x24')]['bind'](this));this[_0xd3a6('0x25')](this[_0xd3a6('0x26')]);}function emit(_0x12f2c1,_0x20a34e,_0x465d25){io['to'](_0x12f2c1)[_0xd3a6('0x27')](_0x20a34e,_0x465d25);}function emitCampaignPreview(_0x54c193){if(_0x54c193[_0xd3a6('0x28')]===_0xd3a6('0x29')){var _0x57cf15={'id':_0x54c193['id'],'name':_0x54c193['name'],'strategy':_0x54c193['strategy'],'answered':_0x54c193['answered'],'available':_0x54c193['available'],'loggedIn':_0x54c193[_0xd3a6('0x2a')],'pTalking':_0x54c193[_0xd3a6('0x2b')],'sumBillable':_0x54c193[_0xd3a6('0x2c')],'sumDuration':_0x54c193['sumDuration'],'sumHoldTime':_0x54c193[_0xd3a6('0x2d')]||0x0,'talking':_0x54c193['talking'],'total':_0x54c193[_0xd3a6('0x2e')],'type':_0x54c193[_0xd3a6('0x28')],'unmanaged':_0x54c193[_0xd3a6('0x2f')],'abandoned':_0x54c193['abandoned'],'waiting':_0x54c193[_0xd3a6('0x30')],'loggedInDb':_0x54c193[_0xd3a6('0x31')],'dialActive':_0x54c193[_0xd3a6('0x32')],'dialMethod':_0x54c193[_0xd3a6('0x33')],'dialOriginateCallerIdName':_0x54c193[_0xd3a6('0x34')],'dialOriginateCallerIdNumber':_0x54c193[_0xd3a6('0x35')],'dialOriginateTimeout':_0x54c193['dialOriginateTimeout'],'dialPrefix':_0x54c193[_0xd3a6('0x36')],'outboundAnswerAgiCallsDay':_0x54c193[_0xd3a6('0x37')],'outboundAnswerCallsDay':_0x54c193[_0xd3a6('0x38')],'outboundBlacklistCallsDay':_0x54c193[_0xd3a6('0x39')],'outboundBusyCallsDay':_0x54c193[_0xd3a6('0x3a')],'outboundCongestionCallsDay':_0x54c193[_0xd3a6('0x3b')],'outboundDropCallsDayACS':_0x54c193['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x54c193['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x54c193[_0xd3a6('0x3c')],'outboundNoAnswerCallsDay':_0x54c193[_0xd3a6('0x3d')],'outboundNoSuchCallsDay':_0x54c193[_0xd3a6('0x3e')],'outboundOriginateFailureCallsDay':_0x54c193[_0xd3a6('0x3f')],'outboundReCallsDay':_0x54c193['outboundReCallsDay'],'outboundRejectCallsDay':_0x54c193[_0xd3a6('0x40')],'outboundUnknownCallsDay':_0x54c193[_0xd3a6('0x41')],'outboundAbandonedCallsDay':_0x54c193['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x54c193[_0xd3a6('0x42')],'predictiveIntervalAvgHoldtime':_0x54c193['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x54c193[_0xd3a6('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x54c193[_0xd3a6('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x54c193[_0xd3a6('0x45')],'predictiveIntervalErlangCalls':_0x54c193[_0xd3a6('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x54c193[_0xd3a6('0x47')],'predictiveIntervalHitRate':_0x54c193[_0xd3a6('0x48')],'predictiveIntervalMultiplicativeFactor':_0x54c193[_0xd3a6('0x49')],'predictiveIntervalPauses':_0x54c193['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x54c193['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x54c193[_0xd3a6('0x4a')],'message':_0x54c193[_0xd3a6('0x4b')],'originated':_0x54c193[_0xd3a6('0x4c')],'erlangCalls':_0x54c193['erlangCalls'],'erlangCallToSecond':_0x54c193[_0xd3a6('0x4d')],'erlangAbandonmentRate':_0x54c193[_0xd3a6('0x4e')],'erlangBusyFactor':_0x54c193[_0xd3a6('0x4f')],'startPredictive':_0x54c193[_0xd3a6('0x50')],'startProgressive':_0x54c193[_0xd3a6('0x51')]};if(_0x54c193[_0xd3a6('0x52')]){_0x57cf15[_0xd3a6('0x52')]={'id':_0x54c193[_0xd3a6('0x52')]['id'],'name':_0x54c193['Trunk'][_0xd3a6('0x53')],'active':_0x54c193[_0xd3a6('0x52')][_0xd3a6('0x54')],'callerid':_0x54c193[_0xd3a6('0x52')][_0xd3a6('0x55')]};}if(_0x54c193[_0xd3a6('0x56')]){_0x57cf15['Interval']={'id':_0x54c193[_0xd3a6('0x56')]['id'],'name':_0x54c193['Interval'][_0xd3a6('0x53')]};}var _0x459e78=md5(JSON[_0xd3a6('0x57')](_0x57cf15));if(_0x54c193[_0xd3a6('0x3')]!==_0x459e78){_0x54c193['md5']=_0x459e78;emit(util['format'](_0xd3a6('0x58'),_0x57cf15[_0xd3a6('0x53')]),_0xd3a6('0x59'),_0x57cf15);}}}function emitVoiceQueueChannelRemove(_0x5188e1){logger[_0xd3a6('0x5a')](_0xd3a6('0x5b'),JSON['stringify'](_0x5188e1));emit(util[_0xd3a6('0x5c')]('voice:queue:%s',_0x5188e1[_0xd3a6('0x53')]),_0xd3a6('0x5d'),_0x5188e1);io['emit'](_0xd3a6('0x5e'),_0x5188e1);}function notSendMessagesQueue(_0x570fb4){if(_0x570fb4[_0xd3a6('0x5f')]){if(_0x570fb4[_0xd3a6('0x4c')]===0x0&&_0x570fb4['pTalking']===0x0){_0x570fb4[_0xd3a6('0x5f')]=![];_0x570fb4[_0xd3a6('0x60')]=0x0;_0x570fb4[_0xd3a6('0x61')]=0x0;_0x570fb4[_0xd3a6('0x4b')]='NOT_ACTIVE';ut[_0xd3a6('0x62')](_0xd3a6('0x63'),_0x570fb4[_0xd3a6('0x53')]+_0xd3a6('0x64'));}else{_0x570fb4[_0xd3a6('0x4b')]='DEACTIVATED';ut[_0xd3a6('0x62')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x570fb4[_0xd3a6('0x53')]+_0xd3a6('0x65'));}emitCampaignPreview(_0x570fb4);}}Preview[_0xd3a6('0x10')]['loopCampaigns']=function(){var _0x74242e=this;setInterval(function(){_0x74242e['syncCampaigns']();},0x7cf);};Preview[_0xd3a6('0x10')]['syncCampaigns']=function(){var _0x448213=this[_0xd3a6('0x26')];this[_0xd3a6('0x18')]+=0x1;for(var _0x1e393e in _0x448213){if(_0x448213[_0xd3a6('0x66')](_0x1e393e)&&(_0x448213[_0x1e393e][_0xd3a6('0x33')]===_0xd3a6('0x67')||_0x448213[_0x1e393e]['dialMethod']===_0xd3a6('0x68'))&&_0x448213[_0x1e393e][_0xd3a6('0x28')]===_0xd3a6('0x29')){if(this[_0xd3a6('0x18')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xd3a6('0x69')]();}}if(_0x448213[_0xd3a6('0x66')](_0x1e393e)&&_0x448213[_0x1e393e][_0xd3a6('0x33')]===_0xd3a6('0x67')&&_0x448213[_0x1e393e][_0xd3a6('0x28')]===_0xd3a6('0x29')){if(_0x448213[_0x1e393e][_0xd3a6('0x32')]){this[_0xd3a6('0x6a')](_0x448213[_0x1e393e]);if(_0x448213[_0x1e393e]['dialPreviewAutoRecallMe'])this[_0xd3a6('0x6b')](_0x448213[_0x1e393e]);}else{notSendMessagesQueue(_0x448213[_0x1e393e]);}}}};Preview[_0xd3a6('0x10')][_0xd3a6('0x6c')]=function(_0x339496){var _0xea6f87=this;this['sequence'][_0xd3a6('0x11')](function(){if(!_[_0xd3a6('0x6d')](_0xea6f87[_0xd3a6('0x16')][_0x339496])){loggerAction[_0xd3a6('0x5a')](_0xd3a6('0x6e'),_0x339496,_0xd3a6('0x6f'),_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x70')],'originated:\x20',JSON[_0xd3a6('0x57')](_0xea6f87['campaignsPreview'][_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x70')]]['originated']),_0xd3a6('0x71'),JSON[_0xd3a6('0x57')](_0xea6f87[_0xd3a6('0x26')][_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x70')]][_0xd3a6('0x2b')]),JSON[_0xd3a6('0x57')](_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x72')]),JSON[_0xd3a6('0x57')](_['pick'](_0xea6f87[_0xd3a6('0x16')][_0x339496],[_0xd3a6('0x73'),_0xd3a6('0x74'),_0xd3a6('0x75'),_0xd3a6('0x76')])));return ami[_0xd3a6('0x77')]({'action':_0xd3a6('0x78'),'channel':_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x79')]})[_0xd3a6('0x7a')](function(_0x5c5ea2){if(_0x5c5ea2[_0xd3a6('0x4b')]===_0xd3a6('0x7b')){setTimeout(function(){if(_0xea6f87[_0xd3a6('0x16')][_0x339496]){ut['updateOriginated'](_0xea6f87[_0xd3a6('0x26')][_0xea6f87['actions'][_0x339496]['queue']],'[clearZombieChannel]');if(_0xea6f87['actions'][_0x339496][_0xd3a6('0x72')]===!![]){ut[_0xd3a6('0x7c')](_0xea6f87[_0xd3a6('0x26')][_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x70')]],_0xd3a6('0x7d'));ut[_0xd3a6('0x7e')](_0xd3a6('0x7f')+_0x339496,_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x70')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x339496,_0xea6f87[_0xd3a6('0x16')][_0x339496][_0xd3a6('0x70')]);delete _0xea6f87[_0xd3a6('0x16')][_0x339496];}},0x2328);}});}});};Preview[_0xd3a6('0x10')][_0xd3a6('0x69')]=function(){var _0x5a0817=this;loggerAction[_0xd3a6('0x5a')](_0xd3a6('0x80'),_[_0xd3a6('0x81')](this[_0xd3a6('0x16')]));for(var _0x54d121 in this['actions']){if(_0x5a0817[_0xd3a6('0x16')][_0xd3a6('0x66')](_0x54d121)){_0x5a0817['clearZombieChannel'](_0x54d121);}}};Preview[_0xd3a6('0x10')][_0xd3a6('0x6b')]=function(_0xba901c){var _0x4b021d=this;rpcDb[_0xd3a6('0x82')](_0xba901c['id'],ut[_0xd3a6('0x83')](this['agents']))[_0xd3a6('0x84')](function(_0x3c4fa9){if(!_['isNil'](_0x3c4fa9)){for(var _0x4c315b=0x0;_0x4c315b<_0x3c4fa9[_0xd3a6('0x85')];_0x4c315b+=0x1){if(ut[_0xd3a6('0x86')](_0x3c4fa9[_0x4c315b]['scheduledat'])<_0xba901c['dialRecallMeTimeout']*0x3c){if(_0x3c4fa9[_0x4c315b][_0xd3a6('0x87')]&&!_0x3c4fa9[_0x4c315b]['Agent'][_0xd3a6('0x88')]){_0x4b021d[_0xd3a6('0x89')](_0x3c4fa9[_0x4c315b]['id'])['then'](ut[_0xd3a6('0x8a')]('[RecallMe]'))['catch'](ut[_0xd3a6('0x8a')]('[RecallMe]'));}else{rpcDb[_0xd3a6('0x8b')](_0x3c4fa9[_0x4c315b]['id']);}}else{var _0x1140e1=new Action(_0x3c4fa9[_0x4c315b],_0xba901c);_0x1140e1[_0xd3a6('0x8c')]=moment()[_0xd3a6('0x5c')](_0xd3a6('0x8d'));_0xba901c['outboundReCallsDay']+=0x1;ut[_0xd3a6('0x8e')](_0x1140e1,0x17,_0xd3a6('0x8f'));if(_0xba901c[_0xd3a6('0x90')]){rpcDb[_0xd3a6('0x91')](ut['createBody'](_0x3c4fa9[_0x4c315b]));rpcDb[_0xd3a6('0x92')](_0x1140e1,_0xd3a6('0x93'));}else{ut[_0xd3a6('0x8e')](_0x1140e1,0x16,_0xd3a6('0x94'));rpcDb[_0xd3a6('0x92')](_0x1140e1,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x1140e1,_0xd3a6('0x95'));}}}}})['catch'](ut[_0xd3a6('0x8a')](_0xd3a6('0x96')));};Preview[_0xd3a6('0x10')][_0xd3a6('0x6a')]=function(_0x3c6b26){_0x3c6b26['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3c6b26[_0xd3a6('0x2a')])){_0x3c6b26['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0xd3a6('0x97')](_0x3c6b26[_0xd3a6('0x32')])){_0x3c6b26[_0xd3a6('0x4b')]=_0xd3a6('0x98');}else if(!this[_0xd3a6('0x99')](_0x3c6b26[_0xd3a6('0x52')])){if(!this['isTrunkReachable'](_0x3c6b26[_0xd3a6('0x9a')])){_0x3c6b26[_0xd3a6('0x4b')]=_0xd3a6('0x9b');}else{_0x3c6b26['message']=_0xd3a6('0x9c');}}else{_0x3c6b26[_0xd3a6('0x4b')]='ACTIVE';}emitCampaignPreview(_0x3c6b26);};Preview[_0xd3a6('0x10')]['callProgressDetectingCustomer']=function(_0x37415f,_0x2c3b55,_0x26748e){var _0x56c9d4=this;var _0x26a091=this['actions'][_0x2c3b55];var _0x49e826=this[_0xd3a6('0x26')][_0x26a091[_0xd3a6('0x70')]];var _0x5287f0;var _0x17cb54=![];var _0x221de9=0x2;var _0x532b07=0x3;if(_0x49e826){switch(_0x26748e){case'1':_0x49e826[_0xd3a6('0x3e')]+=0x1;_0x26a091[_0xd3a6('0x9d')]+=0x1;_0x26a091[_0xd3a6('0x9e')]=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x0,_0xd3a6('0xa0'));ami['emit']('custom:agentnosuchnumber',ut[_0xd3a6('0xa1')](_0x26a091,_0xd3a6('0xa2')));rpcDb[_0xd3a6('0x92')](_0x26a091,_0xd3a6('0xa3'));_0x56c9d4['verifyAdditionalPhones'](_0x26a091,'0',_0x49e826)[_0xd3a6('0x84')](function(_0x2a1495){_0x17cb54=_0x2a1495[_0xd3a6('0xa4')]==0x1;_0x221de9=_0x49e826[_0xd3a6('0xa5')];_0x532b07=_0x49e826['callAdditionalPhoneAfterMin'];if(!_0x17cb54){if(ut[_0xd3a6('0x9f')](_0x26a091)>=_0x49e826['dialGlobalMaxRetry']){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0xf,_0xd3a6('0xa7'));rpcDb[_0xd3a6('0xa8')](_0x5287f0,_0xd3a6('0xa9'));}else{if(_0x26a091[_0xd3a6('0x9d')]>=_0x49e826[_0xd3a6('0xaa')]){rpcDb[_0xd3a6('0xa8')](_0x26a091,_0xd3a6('0xa9'));}else{rpcDb[_0xd3a6('0xab')](ut[_0xd3a6('0xac')](_0x26a091,_0xd3a6('0x9d'),_0x49e826[_0xd3a6('0xa5')]),_0x26a091['unlockAgent'],_0x26a091[_0xd3a6('0xad')]);}}delete this['actions'][_0x37415f[_0xd3a6('0xae')]];}else{_0x26a091[_0xd3a6('0x9d')]++;logger[_0xd3a6('0x5a')]('actioncountonusuch',_0x26a091[_0xd3a6('0x9d')]);logger[_0xd3a6('0x5a')]('id',_0x26a091['idContact']);_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091[_0xd3a6('0xb0')],'field':{'countnosuchnumberretry':_0x26a091[_0xd3a6('0x9d')]}})[_0xd3a6('0x84')](function(){_0x56c9d4[_0xd3a6('0xb1')](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});});}});break;case _0xd3a6('0xb2'):var _0x3479fc=moment()['format'](_0xd3a6('0x8d'));_0x26a091[_0xd3a6('0xb3')]=_0x3479fc;_0x26a091[_0xd3a6('0xb4')]=_0x3479fc;_0x26a091[_0xd3a6('0x72')]=!![];_0x49e826[_0xd3a6('0x2b')]+=0x1;logger[_0xd3a6('0x5a')](_0xd3a6('0xb5'),_0x26a091[_0xd3a6('0xb6')],_0xd3a6('0xb7'),_0x49e826[_0xd3a6('0x53')],_0xd3a6('0x71'),_0x49e826['pTalking']);ami[_0xd3a6('0x27')]('custom:agentconnect',ut[_0xd3a6('0xa1')](_0x26a091,_0xd3a6('0xb8'),this['campaignsPreview'][_0x26a091[_0xd3a6('0x70')]]));if(_0x49e826[_0xd3a6('0xb9')]){ami[_0xd3a6('0x27')](_0xd3a6('0xba'),ut[_0xd3a6('0xbb')](_0x26a091));}break;case'16':ami[_0xd3a6('0x27')](_0xd3a6('0xbc'),ut[_0xd3a6('0xa1')](_0x26a091,_0xd3a6('0xbd'),this[_0xd3a6('0x26')][_0x26a091[_0xd3a6('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x26a091,_0xd3a6('0xbd')));_0x49e826[_0xd3a6('0x38')]+=0x1;_0x49e826[_0xd3a6('0x2e')]+=0x1;_0x49e826[_0xd3a6('0xbe')]+=0x1;ut[_0xd3a6('0x7c')](_0x49e826,_0xd3a6('0xbf'));_0x26a091['countglobal']=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x4,'Answer');rpcDb[_0xd3a6('0x92')](_0x26a091,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xd3a6('0xa8')](_0x26a091,_0xd3a6('0xc0'));rpcDb['crateCustomerReportQueue'](_0x26a091);_0x49e826[_0xd3a6('0xc1')]+=_0x26a091[_0xd3a6('0xc2')];_0x49e826[_0xd3a6('0x2c')]+=_0x26a091[_0xd3a6('0xc2')];logger['info']('[syncHangup][talking][decrement]',_0x26a091[_0xd3a6('0xb6')],_0xd3a6('0xb7'),_0x49e826[_0xd3a6('0x53')],_0xd3a6('0x71'),_0x49e826[_0xd3a6('0x2b')]);delete this['actions'][_0x37415f[_0xd3a6('0xae')]];break;case _0xd3a6('0xc3'):_0x49e826[_0xd3a6('0x3a')]+=0x1;_0x26a091[_0xd3a6('0xc4')]+=0x1;_0x26a091[_0xd3a6('0x9e')]=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x5,_0xd3a6('0xc5'));_0x221de9=_0x49e826[_0xd3a6('0xc6')];_0x532b07=_0x49e826[_0xd3a6('0xc7')];ami[_0xd3a6('0x27')](_0xd3a6('0xc8'),ut['buildObj'](_0x26a091,'busy'));rpcDb['createCustomerHistory'](_0x26a091,_0xd3a6('0xc9'));_0x56c9d4[_0xd3a6('0xca')](_0x26a091,'5',_0x49e826)['then'](function(_0x1f69f4){_0x17cb54=_0x1f69f4[_0xd3a6('0xa4')]==0x1;if(!_0x17cb54){if(ut[_0xd3a6('0x9f')](_0x26a091)>=_0x49e826['dialGlobalMaxRetry']){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0xf,_0xd3a6('0xa7'));rpcDb[_0xd3a6('0xa8')](_0x5287f0,_0xd3a6('0xcb'));}else{if(_0x26a091['countbusyretry']>=_0x49e826['dialBusyMaxRetry']){rpcDb[_0xd3a6('0xa8')](_0x26a091,_0xd3a6('0xc9'));}else{rpcDb[_0xd3a6('0xab')](ut['scheduledAt'](_0x26a091,'countbusyretry',_0x49e826[_0xd3a6('0xc6')]),_0x26a091[_0xd3a6('0xcc')],_0x26a091[_0xd3a6('0xad')]);}}}else{_0x26a091['countbusyretry']++;_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091[_0xd3a6('0xb0')],'field':{'countbusyretry':_0x26a091['countbusyretry']}})[_0xd3a6('0x84')](function(){_0x56c9d4['swapAdditionalPhones'](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});});}});break;case _0xd3a6('0xcd'):_0x49e826[_0xd3a6('0x3d')]+=0x1;_0x26a091[_0xd3a6('0xce')]+=0x1;_0x26a091['countglobal']=ut['totalGlobal'](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x3,_0xd3a6('0xcf'));_0x221de9=_0x49e826[_0xd3a6('0xd0')];_0x532b07=_0x49e826['callAdditionalPhoneAfterMin'];var _0x4e2f67=ut[_0xd3a6('0xd1')](_0x26a091,_0x49e826);ami['emit'](_0xd3a6('0xd2'),_0x4e2f67);rpcDb['createCustomerHistory'](_0x26a091,_0xd3a6('0xd3'));_0x56c9d4[_0xd3a6('0xca')](_0x26a091,'3',_0x49e826)[_0xd3a6('0x84')](function(_0x1a4438){_0x17cb54=_0x1a4438[_0xd3a6('0xa4')]==0x1;if(!_0x17cb54){if(ut[_0xd3a6('0x9f')](_0x26a091)>=_0x49e826[_0xd3a6('0xd4')]){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0xf,_0xd3a6('0xa7'));rpcDb['createCustomerFinal'](_0x5287f0,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x26a091['countnoanswerretry']>=_0x49e826[_0xd3a6('0xd5')]){rpcDb[_0xd3a6('0xa8')](_0x26a091,_0xd3a6('0xd3'));}else{rpcDb[_0xd3a6('0xab')](ut[_0xd3a6('0xac')](_0x26a091,_0xd3a6('0xce'),_0x49e826['dialNoAnswerRetryFrequency']),_0x26a091[_0xd3a6('0xcc')],_0x26a091[_0xd3a6('0xad')]);}}}else{_0x26a091['countnoanswerretry']++;_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091[_0xd3a6('0xb0')],'field':{'countnoanswerretry':_0x26a091[_0xd3a6('0xce')]}})[_0xd3a6('0x84')](function(){_0x56c9d4[_0xd3a6('0xb1')](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});});}});break;case _0xd3a6('0xd6'):_0x49e826[_0xd3a6('0x3b')]+=0x1;_0x26a091[_0xd3a6('0xd7')]+=0x1;_0x26a091[_0xd3a6('0x9e')]=ut['totalGlobal'](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x8,'Congestion');_0x221de9=_0x49e826[_0xd3a6('0xd8')];_0x532b07=_0x49e826['callAdditionalPhoneAfterMin'];ami['emit'](_0xd3a6('0xd9'),ut[_0xd3a6('0xa1')](_0x26a091,'congestion'));rpcDb[_0xd3a6('0x92')](_0x26a091,'[callProgressDetectingCustomer][logCongestion]');_0x56c9d4[_0xd3a6('0xca')](_0x26a091,'8',_0x49e826)[_0xd3a6('0x84')](function(_0x379ff0){_0x17cb54=_0x379ff0[_0xd3a6('0xa4')]==0x1;if(!_0x17cb54){if(ut['totalGlobal'](_0x26a091)>=_0x49e826[_0xd3a6('0xd4')]){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0xf,_0xd3a6('0xa7'));rpcDb[_0xd3a6('0xa8')](_0x5287f0,_0xd3a6('0xda'));}else{if(_0x26a091['countcongestionretry']>=_0x49e826[_0xd3a6('0xdb')]){rpcDb[_0xd3a6('0xa8')](_0x26a091,_0xd3a6('0xdc'));}else{rpcDb[_0xd3a6('0xab')](ut['scheduledAt'](_0x26a091,_0xd3a6('0xd7'),_0x49e826[_0xd3a6('0xc6')]),_0x26a091[_0xd3a6('0xcc')],_0x26a091[_0xd3a6('0xad')]);}}}else{_0x26a091[_0xd3a6('0xd7')]++;_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091['idContact'],'field':{'countcongestionretry':_0x26a091[_0xd3a6('0xd7')]}})[_0xd3a6('0x84')](function(){_0x56c9d4['swapAdditionalPhones'](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});});}});break;case'CANCEL':_0x49e826[_0xd3a6('0x40')]+=0x1;_0x26a091[_0xd3a6('0xdd')]+=0x1;_0x26a091['countglobal']=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x14,_0xd3a6('0xde'));_0x221de9=_0x49e826[_0xd3a6('0xdf')];_0x532b07=_0x49e826[_0xd3a6('0xc7')];ami[_0xd3a6('0x27')](_0xd3a6('0xe0'),ut['buildObj'](_0x26a091,_0xd3a6('0xe1')));rpcDb[_0xd3a6('0x92')](_0x26a091,_0xd3a6('0xe2'));_0x56c9d4[_0xd3a6('0xca')](_0x26a091,'20',_0x49e826)[_0xd3a6('0x84')](function(_0x441975){_0x17cb54=_0x441975[_0xd3a6('0xa4')]==0x1;if(!_0x17cb54){if(ut['totalGlobal'](_0x26a091)>=_0x49e826[_0xd3a6('0xd4')]){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0x14,_0xd3a6('0xde'));rpcDb[_0xd3a6('0xa8')](_0x5287f0,_0xd3a6('0xe3'));}else{if(_0x26a091['countagentrejectretry']>=_0x49e826[_0xd3a6('0xe4')]){rpcDb[_0xd3a6('0xa8')](_0x26a091,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xd3a6('0xab')](ut['scheduledAt'](_0x26a091,_0xd3a6('0xdd'),_0x49e826[_0xd3a6('0xdf')]),_0x26a091[_0xd3a6('0xcc')],_0x26a091[_0xd3a6('0xad')]);}}}else{_0x26a091[_0xd3a6('0xce')]++;_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091['idContact'],'field':{'countnoanswerretry':_0x26a091[_0xd3a6('0xce')]}})[_0xd3a6('0x84')](function(){_0x56c9d4[_0xd3a6('0xb1')](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});});}});break;case _0xd3a6('0xe5'):_0x49e826[_0xd3a6('0xe6')]+=0x1;_0x26a091[_0xd3a6('0xe7')]+=0x1;_0x26a091[_0xd3a6('0x9e')]=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0xb,'Abandoned');rpcDb[_0xd3a6('0x92')](_0x26a091,_0xd3a6('0xe8'));_0x56c9d4['verifyAdditionalPhones'](_0x26a091,'11',_0x49e826)[_0xd3a6('0x84')](function(_0x24dfb8){_0x17cb54=_0x24dfb8['additional']==0x1;if(!_0x17cb54){if(ut[_0xd3a6('0x9f')](_0x26a091)>=_0x49e826[_0xd3a6('0xd4')]){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0xf,_0xd3a6('0xa7'));rpcDb[_0xd3a6('0xa8')](_0x5287f0,_0xd3a6('0xe8'));}else{if(_0x26a091[_0xd3a6('0xe9')]>=_0x49e826['dialAbandonedMaxRety']){rpcDb[_0xd3a6('0xa8')](_0x26a091,_0xd3a6('0xe8'));}else{rpcDb[_0xd3a6('0xab')](ut[_0xd3a6('0xac')](_0x26a091,_0xd3a6('0xe7'),_0x49e826[_0xd3a6('0xea')]),_0x26a091['unlockAgent'],_0x26a091[_0xd3a6('0xad')]);}}}else{_0x26a091[_0xd3a6('0xce')]++;_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091['idContact'],'field':{'countnoanswerretry':_0x26a091[_0xd3a6('0xce')]}})['then'](function(){_0x56c9d4[_0xd3a6('0xb1')](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});});}});break;case'18':_0x49e826['outboundUnknownCallsDay']+=0x1;_0x26a091[_0xd3a6('0xeb')]+=0x1;_0x26a091[_0xd3a6('0x9e')]=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x12,_0x37415f[_0xd3a6('0xec')]||_0x37415f[_0xd3a6('0xed')]);ami[_0xd3a6('0x27')](_0xd3a6('0xee'),ut[_0xd3a6('0xa1')](_0x26a091,_0xd3a6('0xef')));rpcDb[_0xd3a6('0x92')](_0x26a091,'[callProgressDetectingCustomer][hangupInAMD]');_0x56c9d4[_0xd3a6('0xca')](_0x26a091,'18',_0x49e826)[_0xd3a6('0x84')](function(_0x2ff821){_0x17cb54=_0x2ff821[_0xd3a6('0xa4')]==0x1;if(!_0x17cb54){if(ut['totalGlobal'](_0x26a091)>=_0x49e826[_0xd3a6('0xd4')]){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0x12,_0xd3a6('0xa7'));rpcDb[_0xd3a6('0xa8')](_0x5287f0,_0xd3a6('0xf0'));}else{rpcDb['createCustomerFinal'](_0x26a091,_0xd3a6('0xf0'));}}else{_0x26a091[_0xd3a6('0xce')]++;_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091['idContact'],'field':{'countnoanswerretry':_0x26a091[_0xd3a6('0xce')]}})[_0xd3a6('0x84')](function(){_0x56c9d4[_0xd3a6('0xb1')](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});});}});delete this[_0xd3a6('0x16')][_0x37415f[_0xd3a6('0xae')]];break;case'19':_0x49e826[_0xd3a6('0x41')]+=0x1;_0x26a091[_0xd3a6('0x9e')]=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0x13,_0x37415f[_0xd3a6('0xec')]||_0x37415f[_0xd3a6('0xed')]);ami['emit']('custom:amd',ut[_0xd3a6('0xa1')](_0x26a091,'amd'));rpcDb[_0xd3a6('0x92')](_0x26a091,'[callProgressDetectingCustomer][machine]');_0x56c9d4[_0xd3a6('0xca')](_0x26a091,'18',_0x49e826)[_0xd3a6('0x84')](function(_0x12d0c1){_0x17cb54=_0x12d0c1[_0xd3a6('0xa4')]==0x1;if(!_0x17cb54){if(ut[_0xd3a6('0x9f')](_0x26a091)>=_0x49e826[_0xd3a6('0xd4')]){_0x5287f0=ut['cloneAction'](_0x26a091,0xf,'Global');rpcDb['createCustomerFinal'](_0x5287f0,_0xd3a6('0xf1'));}else{rpcDb[_0xd3a6('0xa8')](_0x26a091,_0xd3a6('0xf1'));}}else{_0x26a091[_0xd3a6('0xce')]++;_0x56c9d4[_0xd3a6('0xaf')]({'id':_0x26a091[_0xd3a6('0xb0')],'field':{'countnoanswerretry':_0x26a091[_0xd3a6('0xce')]}})[_0xd3a6('0x84')](function(){_0x56c9d4[_0xd3a6('0xb1')](_0x26a091,_0x221de9,_0x532b07)['then'](function(){});});}});delete this[_0xd3a6('0x16')][_0x37415f[_0xd3a6('0xae')]];break;default:if(_0x26a091[_0xd3a6('0x72')]){ut[_0xd3a6('0x7c')](_0x49e826,_0xd3a6('0xf2'));ut[_0xd3a6('0x7e')](_0xd3a6('0xf3')+_0x49e826['name'],_0x37415f);}_0x49e826[_0xd3a6('0x41')]+=0x1;_0x26a091[_0xd3a6('0x9e')]=ut[_0xd3a6('0x9f')](_0x26a091);ut[_0xd3a6('0x8e')](_0x26a091,0xc,_0x37415f['cause-txt']||_0x37415f['dialstatus']);_0x221de9=_0x49e826[_0xd3a6('0xdf')];_0x532b07=_0x49e826[_0xd3a6('0xc7')];rpcDb[_0xd3a6('0x92')](_0x26a091,_0xd3a6('0xf4'));_0x56c9d4[_0xd3a6('0xca')](_0x26a091,'20',_0x49e826)[_0xd3a6('0x84')](function(_0x17febb){_0x17cb54=_0x17febb[_0xd3a6('0xa4')]==0x1;if(!_0x17cb54){if(ut[_0xd3a6('0x9f')](_0x26a091)>=_0x49e826['dialGlobalMaxRetry']){_0x5287f0=ut[_0xd3a6('0xa6')](_0x26a091,0xf,_0xd3a6('0xa7'));rpcDb['createCustomerFinal'](_0x5287f0,_0xd3a6('0xf5'));}else{rpcDb['createCustomerFinal'](_0x26a091,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x37415f[_0xd3a6('0xae')]];}else{_0x56c9d4[_0xd3a6('0xb1')](_0x26a091,_0x221de9,_0x532b07)[_0xd3a6('0x84')](function(){});}});}if(!(_0x26a091[_0xd3a6('0x72')]&&_0x26748e==='16')){ut[_0xd3a6('0xf6')](_0x49e826,'[callProgressDetectingCustomer]');logger['info'](_0xd3a6('0xf7'),_0x26a091['uniqueid'],_0xd3a6('0xb7'),_0x49e826['name'],_0xd3a6('0xf8'),_0x49e826['originated']);}if(_0x26748e!==_0xd3a6('0xb2')){delete this[_0xd3a6('0x16')][_0x37415f[_0xd3a6('0xae')]];delete this[_0xd3a6('0x16')][_0x37415f['destlinkedid']];}}};Preview[_0xd3a6('0x10')][_0xd3a6('0xf9')]=function(_0x1a67d5,_0x40cfd0,_0x6e4d11){if(_[_0xd3a6('0xfa')](_0x40cfd0)&&_0xd3a6('0xfb')!==typeof _0x40cfd0){return;}if(_[_0xd3a6('0xfa')](_0x6e4d11)&&_0xd3a6('0xfb')!==typeof _0x6e4d11){return;}switch(_0x6e4d11[_0xd3a6('0xfc')]){case'0':ut[_0xd3a6('0xfd')](_0x1a67d5,0x0,_0xd3a6('0xa0'));rpcDb['createAgentHistory'](_0x1a67d5,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x1a67d5,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x1a67d5,_0xd3a6('0xfe'));break;case'5':ut[_0xd3a6('0xfd')](_0x1a67d5,0x5,_0xd3a6('0xc5'));rpcDb[_0xd3a6('0xff')](_0x1a67d5,_0xd3a6('0x100'));break;case'8':ut[_0xd3a6('0xfd')](_0x1a67d5,0x8,_0xd3a6('0x101'));rpcDb[_0xd3a6('0xff')](_0x1a67d5,_0xd3a6('0x102'));break;case'22':ut[_0xd3a6('0xfd')](_0x1a67d5,0x16,'AnswerAGI');rpcDb[_0xd3a6('0xff')](_0x1a67d5,_0xd3a6('0x103'));break;default:ut['logAgent'](_0x1a67d5,0xc,_0x6e4d11[_0xd3a6('0xfc')]);rpcDb['createAgentHistory'](_0x1a67d5,'[callProgressDetectingAgent][logCongestion]');}ut[_0xd3a6('0xf6')](_0x40cfd0,_0xd3a6('0x104'));logger[_0xd3a6('0x5a')]('[originated][decrement][callProgressDetectingAgent]',_0x1a67d5[_0xd3a6('0xb6')],_0xd3a6('0xb7'),_0x40cfd0[_0xd3a6('0x53')],_0xd3a6('0xf8'),_0x40cfd0[_0xd3a6('0x4c')]);delete this[_0xd3a6('0x16')][_0x1a67d5['uniqueid']];};Preview[_0xd3a6('0x10')][_0xd3a6('0xca')]=function(_0x54dae4,_0x580573,_0x1158d7){return Promise[_0xd3a6('0x105')]()[_0xd3a6('0x84')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x54dae4,_0x580573,_0x1158d7))['catch'](logger[_0xd3a6('0x5a')](_0xd3a6('0x106')));};Preview[_0xd3a6('0x10')]['swapAdditionalPhones']=function(_0x2e87a2,_0x57a390,_0x3f3b3f){return Promise[_0xd3a6('0x105')]()[_0xd3a6('0x84')](cmHopperAdditionalPhone[_0xd3a6('0xb1')](_0x2e87a2,_0x57a390,_0x3f3b3f))[_0xd3a6('0x7a')](logger[_0xd3a6('0x5a')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xd3a6('0xaf')]=function(_0x2d7f8b){return Promise[_0xd3a6('0x105')]()['then'](cmHopperAdditionalPhone[_0xd3a6('0xaf')](_0x2d7f8b))[_0xd3a6('0x7a')](logger[_0xd3a6('0x5a')]('[incrementPreviewCounters]\x20'));};Preview[_0xd3a6('0x10')]['checkInBlack']=function(_0x2f8d88,_0x5dd069,_0x3d9173,_0x257f9a,_0x3ff5e9){var _0x8fb132=this;return new Promise(function(_0x4c0238,_0x23448c){if(_[_0xd3a6('0x6d')](_0x5dd069)||_[_0xd3a6('0x6d')](_0x5dd069[_0xd3a6('0x107')])||_['isNil'](_0x5dd069['phone'])||_[_0xd3a6('0x6d')](_0x5dd069[_0xd3a6('0x75')])){_0x23448c(ut[_0xd3a6('0x4b')](_0xd3a6('0x108'),_0x257f9a,_0x3ff5e9));return;}var _0x24a3ca=uuid['v4']();var _0x1ec86f=_0x8fb132[_0xd3a6('0x26')][_0x5dd069[_0xd3a6('0x6f')][_0xd3a6('0x53')]];var _0x16449a=_0x3d9173?_0x8fb132[_0xd3a6('0x17')][_0x3d9173]['id']:undefined;_0x8fb132[_0xd3a6('0x16')][_0x24a3ca]=new Action(_0x5dd069,_0x1ec86f,_0x24a3ca,_0x3d9173,_0x16449a);var _0x2d871b=_0x8fb132['actions'][_0x24a3ca];_0x2d871b['unlockAgent']=_0x257f9a;_0x2d871b[_0xd3a6('0xad')]=_0x3ff5e9;_0x2d871b[_0xd3a6('0x109')]=_0x3d9173;if(_['isEmpty'](_0x2f8d88)){_0x8fb132[_0xd3a6('0x10a')](_0x2d871b,_0x1ec86f,_0x5dd069,_0x3d9173)[_0xd3a6('0x84')](function(_0x1faae8){logger[_0xd3a6('0x5a')](_0xd3a6('0x10b'),'Queue:\x20'+_0x2d871b[_0xd3a6('0x70')]+_0xd3a6('0x10c')+_0x2d871b[_0xd3a6('0xb0')],JSON['stringify'](_0x1faae8));ami[_0xd3a6('0x27')]('custom:agentcalled',ut[_0xd3a6('0xa1')](_0x2d871b,_0xd3a6('0x10d'),_0x8fb132[_0xd3a6('0x26')][_0x2d871b[_0xd3a6('0x70')]]));_0x4c0238(ut['message'](_0xd3a6('0x10e')));})[_0xd3a6('0x7a')](function(_0x57794e){ut[_0xd3a6('0x62')](_0xd3a6('0x10f'),_0x57794e);_0x23448c(ut[_0xd3a6('0x4b')](_0xd3a6('0x110'),_0x257f9a,_0x3ff5e9));});}else{_0x1ec86f['outboundBlacklistCallsDay']+=0x1;ut[_0xd3a6('0x111')](_0x2d871b);rpcDb[_0xd3a6('0x112')](_0x2d871b,'[Blacklist][error]');delete _0x8fb132['actions'][_0x24a3ca];_0x23448c(ut[_0xd3a6('0x4b')](_0xd3a6('0x113'),_0x257f9a,_0x3ff5e9));}});};Preview[_0xd3a6('0x10')]['isTrunkReachable']=function(_0x11d9bc){return!_[_0xd3a6('0x6d')](_0x11d9bc)&&!_[_0xd3a6('0x6d')](_0x11d9bc[_0xd3a6('0x53')])&&!_['isNil'](_0x11d9bc[_0xd3a6('0x54')])&&_0x11d9bc[_0xd3a6('0x54')]&&!_[_0xd3a6('0x6d')](this[_0xd3a6('0x15')][util[_0xd3a6('0x5c')]('SIP/%s',_0x11d9bc[_0xd3a6('0x53')])])&&!_['isNil'](this[_0xd3a6('0x15')][util[_0xd3a6('0x5c')](_0xd3a6('0x114'),_0x11d9bc['name'])]['status'])&&(this[_0xd3a6('0x15')][util['format']('SIP/%s',_0x11d9bc[_0xd3a6('0x53')])]['status']===_0xd3a6('0x115')||this[_0xd3a6('0x15')][util[_0xd3a6('0x5c')](_0xd3a6('0x114'),_0x11d9bc[_0xd3a6('0x53')])]['status']===_0xd3a6('0x116'));};Preview[_0xd3a6('0x10')][_0xd3a6('0x89')]=function(_0x3d60c1,_0x73e834){return this['execRun'](_0x3d60c1,_0x73e834)['then'](function(_0xcb6c80){return _[_0xd3a6('0x117')](_0xcb6c80,[_0xd3a6('0x4b')]);})[_0xd3a6('0x7a')](function(_0x4236e0){if(_0x4236e0[_0xd3a6('0x118')]){rpcDb[_0xd3a6('0x119')](_0x3d60c1);}if(_0x4236e0[_0xd3a6('0x54')]){rpcDb[_0xd3a6('0x8b')](_0x3d60c1);}throw _[_0xd3a6('0x117')](_0x4236e0,['message']);});};Preview[_0xd3a6('0x10')]['execRun']=function(_0x503468,_0x28fc0b){var _0x572cf8=this;var _0x26ccee,_0x592a69;return rpcDb['getContactPreview'](_0x503468)[_0xd3a6('0x84')](function(_0x29babe){if(!_[_0xd3a6('0x6d')](_0x29babe[0x0])){_0x592a69=_0x29babe[0x0][_0xd3a6('0x11a')]?![]:!![];_0x26ccee=_0x29babe[0x0][_0xd3a6('0x11a')]?!![]:![];_0x26ccee=_0x28fc0b?!![]:_0x26ccee;}var _0x20bf6c=_0x572cf8['validateContact'](_0x29babe);if(_0x20bf6c[_0xd3a6('0x11b')]){rpcDb[_0xd3a6('0x11c')](_['pick'](_0x29babe[0x0],[_0xd3a6('0x75'),_0xd3a6('0x11d')]))[_0xd3a6('0x84')](function(_0x506f2b){_0x572cf8[_0xd3a6('0x11e')](_0x506f2b,_0x29babe[0x0],_0x28fc0b,_0x592a69,_0x26ccee)['then'](function(_0x54cf38){return _0x54cf38;})[_0xd3a6('0x7a')](function(_0xb62524){throw _0xb62524;});})[_0xd3a6('0x7a')](function(_0x4729a9){ut[_0xd3a6('0x62')]('[Preview][checkIsBlackList]',_0x4729a9);throw ut['message']('Call\x20unsuccessful',_0x592a69,_0x26ccee);});}else{throw ut[_0xd3a6('0x4b')](_0x20bf6c[_0xd3a6('0x4b')],_0x592a69,_0x26ccee);}})[_0xd3a6('0x7a')](function(_0x3c6fc5){ut[_0xd3a6('0x62')](_0xd3a6('0x11f'),_0x3c6fc5);throw ut[_0xd3a6('0x4b')](_0xd3a6('0x120'),![],!![]);});};Preview[_0xd3a6('0x10')][_0xd3a6('0x121')]=function(_0x33c037){if(_[_0xd3a6('0x6d')](_0x33c037)||_[_0xd3a6('0x122')](_0x33c037)||!_['isNil'](_0x33c037[0x0][_0xd3a6('0x87')])&&_['isNil'](_0x33c037[0x0]['Agent'][_0xd3a6('0x53')])){ut['logger'](_0xd3a6('0x123'),_0x33c037);return{'isValid':![],'message':_0xd3a6('0x124')};}var _0x831411=this[_0xd3a6('0x26')][_0x33c037[0x0][_0xd3a6('0x6f')][_0xd3a6('0x53')]];_0x831411['message']=_0xd3a6('0x9c');if(_[_0xd3a6('0x6d')](_0x831411)){ut[_0xd3a6('0x62')]('[Preview][validateContact][Empty\x20Campaign]',_0x831411);return{'isValid':![],'message':_0xd3a6('0x125')};}if(!this[_0xd3a6('0x99')](_0x831411[_0xd3a6('0x52')])){ut[_0xd3a6('0x62')](_0xd3a6('0x126'),_0xd3a6('0x127')+_0x831411[_0xd3a6('0x53')]+_0xd3a6('0x128'));if(!this[_0xd3a6('0x99')](_0x831411[_0xd3a6('0x9a')])){ut[_0xd3a6('0x62')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x831411[_0xd3a6('0x53')]+_0xd3a6('0x129'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x831411[_0xd3a6('0x32')])){ut[_0xd3a6('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x831411[_0xd3a6('0x53')]+_0xd3a6('0x12a'));return{'isValid':![],'message':_0xd3a6('0x127')+_0x831411[_0xd3a6('0x53')]+_0xd3a6('0x12a')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xd3a6('0x10')][_0xd3a6('0x10a')]=function(_0x288b7b,_0x5042fb,_0xaf8a75,_0x4f2d7c){var _0x420b1a=this;return new Promise(function(_0xea5a6b,_0x1b9742){var _0x302a7b=_0x288b7b[_0xd3a6('0xb6')];var _0x16d8c4=_0x420b1a[_0xd3a6('0x99')](_0x5042fb['Trunk'])?util[_0xd3a6('0x5c')]('SIP/%s/%s%s',_0x5042fb[_0xd3a6('0x52')]['name'],_['isNil'](_0x5042fb[_0xd3a6('0x36')])?'':_0x5042fb[_0xd3a6('0x36')][_0xd3a6('0x12b')]()||'',_0x5042fb[_0xd3a6('0x12c')]>0x0?_0xaf8a75[_0xd3a6('0x11d')][_0xd3a6('0x12d')](_0x5042fb[_0xd3a6('0x12c')]):_0xaf8a75[_0xd3a6('0x11d')]):util[_0xd3a6('0x5c')](_0xd3a6('0x12e'),_[_0xd3a6('0x6d')](_0x5042fb[_0xd3a6('0x9a')])?_0x5042fb[_0xd3a6('0x52')][_0xd3a6('0x53')]:_0x5042fb[_0xd3a6('0x9a')][_0xd3a6('0x53')],_[_0xd3a6('0x6d')](_0x5042fb[_0xd3a6('0x36')])?'':_0x5042fb['dialPrefix'][_0xd3a6('0x12b')]()||'',_0x5042fb[_0xd3a6('0x12c')]>0x0?_0xaf8a75[_0xd3a6('0x11d')][_0xd3a6('0x12d')](_0x5042fb[_0xd3a6('0x12c')]):_0xaf8a75[_0xd3a6('0x11d')]);var _0x4891fc=_0x420b1a['isTrunkReachable'](_0x5042fb['Trunk'])?ut[_0xd3a6('0x12f')](_0x5042fb[_0xd3a6('0x52')][_0xd3a6('0x55')],_0x5042fb[_0xd3a6('0x34')],_0x5042fb[_0xd3a6('0x130')]>0x0?ut['getCallerIdRandom'](_0x5042fb[_0xd3a6('0x35')],_0x5042fb[_0xd3a6('0x130')]):_0x5042fb[_0xd3a6('0x35')]):ut['getCallerId'](_[_0xd3a6('0x6d')](_0x5042fb[_0xd3a6('0x9a')])?_0x5042fb[_0xd3a6('0x52')][_0xd3a6('0x55')]:_0x5042fb[_0xd3a6('0x9a')][_0xd3a6('0x55')],_0x5042fb[_0xd3a6('0x34')],_0x5042fb[_0xd3a6('0x130')]>0x0?ut[_0xd3a6('0x131')](_0x5042fb[_0xd3a6('0x35')],_0x5042fb[_0xd3a6('0x130')]):_0x5042fb[_0xd3a6('0x35')]);if(_0x4891fc){_0x288b7b[_0xd3a6('0x132')]=ut['extractCalleridName'](_0x4891fc);_0x288b7b[_0xd3a6('0x133')]=ut[_0xd3a6('0x134')](_0x4891fc);}var _0x13e5e5=ut[_0xd3a6('0x135')](_0x5042fb,_0xaf8a75,_0x16d8c4,_0x4891fc,_0x302a7b,_0x288b7b);_['merge'](_0x288b7b,ut['toLowerVariables'](_0x13e5e5));_0x288b7b['starttime']=moment()[_0xd3a6('0x5c')](_0xd3a6('0x8d'));_0x5042fb[_0xd3a6('0x136')]=_0x13e5e5;ami[_0xd3a6('0x77')](ut[_0xd3a6('0x137')](_0x288b7b,_0x5042fb,_0x13e5e5,_0x288b7b['activeContact'],_0x4f2d7c))[_0xd3a6('0x84')](function(_0x9c771f){_0x5042fb[_0xd3a6('0x4c')]+=0x1;logger[_0xd3a6('0x5a')](_0xd3a6('0x138'),_0x302a7b,_0xd3a6('0xb7'),_0x5042fb[_0xd3a6('0x53')],_0xd3a6('0xf8'),_0x5042fb[_0xd3a6('0x4c')]);_0xea5a6b(_0x9c771f);})[_0xd3a6('0x7a')](function(_0x4a4fc0){ut[_0xd3a6('0xfd')](_0x288b7b,0xe,'OriginateError');rpcDb[_0xd3a6('0xff')](_0x288b7b,_0xd3a6('0x139'));_0x1b9742(_0x4a4fc0);});});};Preview[_0xd3a6('0x10')][_0xd3a6('0x13a')]=function(_0x562d92){if(this[_0xd3a6('0x16')][_0x562d92[_0xd3a6('0xae')]]){this[_0xd3a6('0x16')][_0x562d92[_0xd3a6('0xae')]][_0xd3a6('0x79')]=_0x562d92[_0xd3a6('0x79')];}};Preview[_0xd3a6('0x10')]['syncOriginateResponse']=function(_0x5a6a71){var _0x5c4bcd=this;var _0x309c0e=this[_0xd3a6('0x16')][_0x5a6a71[_0xd3a6('0x13b')]];if(_0x309c0e){if(_0x309c0e['lookAgent']&&this[_0xd3a6('0x17')][_0x309c0e['lookAgent']]){ut[_0xd3a6('0x13c')](_0x309c0e,this['agents'][_0x309c0e[_0xd3a6('0x109')]][_0xd3a6('0x53')],this[_0xd3a6('0x17')][_0x309c0e['lookAgent']]['id']);}var _0x444b76=_[_0xd3a6('0x13d')](_0x309c0e);_0x444b76[_0xd3a6('0xb3')]=moment()[_0xd3a6('0x5c')](_0xd3a6('0x8d'));var _0x1355fc=_0x5c4bcd[_0xd3a6('0x26')][_0x309c0e['queue']];if(ut[_0xd3a6('0x13e')](_0x5a6a71[_0xd3a6('0x13f')])){if(_0x309c0e['unlockAgent']){rpcDb[_0xd3a6('0x119')](_0x309c0e[_0xd3a6('0xb0')]);}if(_0x309c0e['activeContact']){rpcDb[_0xd3a6('0x8b')](_0x309c0e['idContact']);}ami[_0xd3a6('0x27')]('custom:agentringnoanswer',ut['buildObj'](_0x309c0e,'rejected',this[_0xd3a6('0x26')][_0x309c0e[_0xd3a6('0x70')]]));this[_0xd3a6('0xf9')](_0x444b76,_0x1355fc,_0x5a6a71);}else{_0x309c0e[_0xd3a6('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x444b76,0x4,_0xd3a6('0x140'));rpcDb['createAgentHistory'](_0x444b76,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0xd3a6('0x1c')]=function(_0x30f471){var _0x1bbe47=this['actions'][_0x30f471[_0xd3a6('0xae')]];var _0x519ffe;if(_0x1bbe47){_0x519ffe=this[_0xd3a6('0x26')][_0x1bbe47[_0xd3a6('0x70')]];logger[_0xd3a6('0x5a')]('[syncHangup][talking]',_0x30f471[_0xd3a6('0xae')],_0xd3a6('0xb7'),_0x519ffe[_0xd3a6('0x53')],_0xd3a6('0x71'),_0x519ffe['pTalking']);}if(this[_0xd3a6('0x16')][_0x30f471['linkedid']]&&_0x30f471['linkedid']!==_0x30f471[_0xd3a6('0xb6')]){if(_0x30f471[_0xd3a6('0x141')]==='16'&&this[_0xd3a6('0x16')][_0x30f471['linkedid']][_0xd3a6('0x72')]){this['callProgressDetectingCustomer'](_0x30f471,_0x30f471[_0xd3a6('0xae')],_0x30f471[_0xd3a6('0x141')]);}else if(this[_0xd3a6('0x16')][_0x30f471['linkedid']][_0xd3a6('0x72')]){logger[_0xd3a6('0x5a')]('[syncHangup][talking][cause]',_0x30f471['linkedid'],_0x30f471[_0xd3a6('0x141')],'\x20Queue',_0x519ffe[_0xd3a6('0x53')],_0xd3a6('0x71'),_0x519ffe[_0xd3a6('0x2b')]);this[_0xd3a6('0x142')](_0x30f471,_0x30f471['linkedid'],_0x30f471[_0xd3a6('0x141')]);}}else if(_0x1bbe47&&_[_0xd3a6('0x6d')](_0x1bbe47[_0xd3a6('0x143')])&&_0x519ffe['dialQueueProject']&&_0x30f471[_0xd3a6('0xae')]===_0x30f471[_0xd3a6('0xb6')]&&_[_0xd3a6('0x6d')](_0x30f471[_0xd3a6('0xfc')])&&_0x30f471[_0xd3a6('0x141')]==='16'&&_0x30f471['channelstate']==='6'&&_[_0xd3a6('0xfa')](_0x1bbe47['transfer'])){if(_0x1bbe47[_0xd3a6('0xcc')]){rpcDb['unlockContact'](_0x1bbe47[_0xd3a6('0xb0')]);}if(_0x1bbe47[_0xd3a6('0xad')]){rpcDb[_0xd3a6('0x8b')](_0x1bbe47[_0xd3a6('0xb0')]);}_0x30f471[_0xd3a6('0xfc')]='22';this['callProgressDetectingAgent'](_0x1bbe47,_0x519ffe,_0x30f471);}else if(_0x1bbe47&&_0x1bbe47[_0xd3a6('0x144')]){if(_0x30f471[_0xd3a6('0x141')]==='16'&&this[_0xd3a6('0x16')][_0x30f471[_0xd3a6('0xae')]][_0xd3a6('0x72')]){logger[_0xd3a6('0x5a')](_0xd3a6('0x145'),_0x30f471['linkedid'],_0x30f471['cause'],_0xd3a6('0xb7'),_0x519ffe[_0xd3a6('0x53')],_0xd3a6('0x71'),_0x519ffe['pTalking']);this['callProgressDetectingCustomer'](_0x30f471,_0x30f471['linkedid'],_0x30f471[_0xd3a6('0x141')]);}else if(this[_0xd3a6('0x16')][_0x30f471[_0xd3a6('0xae')]][_0xd3a6('0x72')]){logger[_0xd3a6('0x5a')]('[syncHangup][talking][cause]',_0x30f471['linkedid'],_0x30f471[_0xd3a6('0x141')],'\x20Queue',_0x519ffe[_0xd3a6('0x53')],_0xd3a6('0x71'),_0x519ffe['pTalking']);this[_0xd3a6('0x142')](_0x30f471,_0x30f471[_0xd3a6('0xae')],_0x30f471['cause']);}}};Preview[_0xd3a6('0x10')][_0xd3a6('0x146')]=function(_0x230f5c){if(this[_0xd3a6('0x16')][_0x230f5c[_0xd3a6('0x147')]]&&_0x230f5c[_0xd3a6('0x147')]!==_0x230f5c[_0xd3a6('0x148')]){this[_0xd3a6('0x142')](_0x230f5c,_0x230f5c['destlinkedid'],_0x230f5c['dialstatus']);}};Preview['prototype'][_0xd3a6('0x1e')]=function(_0x3f562d){if(this['actions'][_0x3f562d['linkedid']]&&_0x3f562d[_0xd3a6('0xae')]!==_0x3f562d[_0xd3a6('0xb6')]&&!this['actions'][_0x3f562d['linkedid']][_0xd3a6('0x72')]){if(_0x3f562d[_0xd3a6('0x141')]==='1'){this['callProgressDetectingCustomer'](_0x3f562d,_0x3f562d[_0xd3a6('0xae')],_0x3f562d[_0xd3a6('0x141')]);}}};Preview['prototype'][_0xd3a6('0x149')]=function(_0xaaa80c,_0x26136e,_0x3cc9c6){if(this['actions'][_0xaaa80c]){if(_[_0xd3a6('0x6d')](this[_0xd3a6('0x16')][_0xaaa80c][_0xd3a6('0x136')])){this['actions'][_0xaaa80c]['variables']={};}this[_0xd3a6('0x16')][_0xaaa80c]['variables'][_0x26136e]=_0x3cc9c6;}};Preview[_0xd3a6('0x10')][_0xd3a6('0x21')]=function(_0xc6b2f2){try{if(!_[_0xd3a6('0x6d')](_0xc6b2f2)){if(ut[_0xd3a6('0x14a')](_[_0xd3a6('0x14b')](_0xc6b2f2['variable'])[0x0])){this[_0xd3a6('0x149')](_0xc6b2f2[_0xd3a6('0xb6')],_[_0xd3a6('0x14b')](_0xc6b2f2['variable'])[0x0],_0xc6b2f2[_0xd3a6('0x14c')]);}}}catch(_0x15d55c){logger['error'](_0xd3a6('0x14d'),util['inspect'](_0x15d55c,{'showHidden':![],'depth':null}));}};Preview[_0xd3a6('0x10')][_0xd3a6('0x23')]=function(_0x4730ad){if(_0x4730ad){if(this[_0xd3a6('0x16')][_0x4730ad[_0xd3a6('0x14e')]]){this[_0xd3a6('0x16')][_0x4730ad['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xd3a6('0x10')][_0xd3a6('0x24')]=function(_0x59fe94){if(_0x59fe94){if(this[_0xd3a6('0x16')][_0x59fe94['transfererlinkedid']]){this[_0xd3a6('0x16')][_0x59fe94[_0xd3a6('0x14f')]][_0xd3a6('0x144')]=!![];}}};module[_0xd3a6('0x150')]=Preview; \ No newline at end of file +var _0x7e4b=['dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','execRun','pick','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[action]','size','getContactRecallMe','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','buildAcw','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','countbusyretry','[callProgressDetectingCustomer][logBusy]','Global','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','verifyAdditionalPhones','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e4b,0x84));var _0xb7e4=function(_0x211e7c,_0x32c859){_0x211e7c=_0x211e7c-0x0;var _0x2f18f0=_0x7e4b[_0x211e7c];return _0x2f18f0;};'use strict';var util=require(_0xb7e4('0x0'));var _=require(_0xb7e4('0x1'));var uuid=require('uuid');var moment=require(_0xb7e4('0x2'));var md5=require(_0xb7e4('0x3'));var Redis=require('ioredis');var config=require(_0xb7e4('0x4'));var logger=require(_0xb7e4('0x5'))(_0xb7e4('0x6'));var loggerAction=require(_0xb7e4('0x5'))(_0xb7e4('0x7'));var ami=require(_0xb7e4('0x8'));var rpcDb=require(_0xb7e4('0x9'));var cmHopperAdditionalPhone=require(_0xb7e4('0xa'));var Action=require(_0xb7e4('0xb'));var ut=require('./util/util');config[_0xb7e4('0xc')]=_['defaults'](config[_0xb7e4('0xc')],{'host':_0xb7e4('0xd'),'port':0x18eb});var io=require(_0xb7e4('0xe'))(new Redis(config[_0xb7e4('0xc')]));var Sequence=function(){};Sequence[_0xb7e4('0xf')][_0xb7e4('0x10')]=function(_0x1c5eb8){this[_0xb7e4('0x11')]=this[_0xb7e4('0x11')]?this[_0xb7e4('0x11')][_0xb7e4('0x12')](_0x1c5eb8):_0x1c5eb8();};function Preview(_0x23c9f5){this[_0xb7e4('0x13')]=new Sequence();this['campaignsPreview']=_0x23c9f5['voiceQueues'];this[_0xb7e4('0x14')]=_0x23c9f5[_0xb7e4('0x14')];this['actions']={};this[_0xb7e4('0x15')]=_0x23c9f5[_0xb7e4('0x15')];this[_0xb7e4('0x16')]=0x0;ami['on'](_0xb7e4('0x17'),this[_0xb7e4('0x18')][_0xb7e4('0x19')](this));ami['on'](_0xb7e4('0x1a'),this[_0xb7e4('0x1b')][_0xb7e4('0x19')](this));ami['on'](_0xb7e4('0x1c'),this[_0xb7e4('0x1d')][_0xb7e4('0x19')](this));ami['on'](_0xb7e4('0x1e'),this[_0xb7e4('0x1f')]['bind'](this));ami['on'](_0xb7e4('0x20'),this[_0xb7e4('0x21')][_0xb7e4('0x19')](this));ami['on'](_0xb7e4('0x22'),this[_0xb7e4('0x23')][_0xb7e4('0x19')](this));ami['on'](_0xb7e4('0x24'),this[_0xb7e4('0x25')][_0xb7e4('0x19')](this));ami['on'](_0xb7e4('0x26'),this['syncBlindTransfer'][_0xb7e4('0x19')](this));this[_0xb7e4('0x27')](this[_0xb7e4('0x28')]);}function emit(_0x59044f,_0x37c71a,_0x517165){io['to'](_0x59044f)[_0xb7e4('0x29')](_0x37c71a,_0x517165);}function emitCampaignPreview(_0x172329){if(_0x172329[_0xb7e4('0x2a')]===_0xb7e4('0x2b')){var _0x18e4fb={'id':_0x172329['id'],'name':_0x172329[_0xb7e4('0x2c')],'strategy':_0x172329['strategy'],'answered':_0x172329[_0xb7e4('0x2d')],'available':_0x172329[_0xb7e4('0x2e')],'loggedIn':_0x172329[_0xb7e4('0x2f')],'pTalking':_0x172329[_0xb7e4('0x30')],'sumBillable':_0x172329['sumBillable'],'sumDuration':_0x172329[_0xb7e4('0x31')],'sumHoldTime':_0x172329[_0xb7e4('0x32')]||0x0,'talking':_0x172329['talking'],'total':_0x172329[_0xb7e4('0x33')],'type':_0x172329[_0xb7e4('0x2a')],'unmanaged':_0x172329[_0xb7e4('0x34')],'abandoned':_0x172329['abandoned'],'waiting':_0x172329[_0xb7e4('0x35')],'loggedInDb':_0x172329[_0xb7e4('0x36')],'dialActive':_0x172329['dialActive'],'dialMethod':_0x172329[_0xb7e4('0x37')],'dialOriginateCallerIdName':_0x172329[_0xb7e4('0x38')],'dialOriginateCallerIdNumber':_0x172329['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x172329[_0xb7e4('0x39')],'dialPrefix':_0x172329[_0xb7e4('0x3a')],'outboundAnswerAgiCallsDay':_0x172329[_0xb7e4('0x3b')],'outboundAnswerCallsDay':_0x172329['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x172329[_0xb7e4('0x3c')],'outboundBusyCallsDay':_0x172329[_0xb7e4('0x3d')],'outboundCongestionCallsDay':_0x172329[_0xb7e4('0x3e')],'outboundDropCallsDayACS':_0x172329[_0xb7e4('0x3f')],'outboundDropCallsDayCallersExit':_0x172329[_0xb7e4('0x40')],'outboundDropCallsDayTimeout':_0x172329[_0xb7e4('0x41')],'outboundNoAnswerCallsDay':_0x172329[_0xb7e4('0x42')],'outboundNoSuchCallsDay':_0x172329[_0xb7e4('0x43')],'outboundOriginateFailureCallsDay':_0x172329[_0xb7e4('0x44')],'outboundReCallsDay':_0x172329[_0xb7e4('0x45')],'outboundRejectCallsDay':_0x172329[_0xb7e4('0x46')],'outboundUnknownCallsDay':_0x172329[_0xb7e4('0x47')],'outboundAbandonedCallsDay':_0x172329[_0xb7e4('0x48')],'predictiveIntervalAnsweredCalls':_0x172329['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x172329[_0xb7e4('0x49')],'predictiveIntervalAvgTalktime':_0x172329[_0xb7e4('0x4a')],'predictiveIntervalDroppedCallsCallersExit':_0x172329[_0xb7e4('0x4b')],'predictiveIntervalDroppedCallsTimeout':_0x172329[_0xb7e4('0x4c')],'predictiveIntervalErlangCalls':_0x172329['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x172329[_0xb7e4('0x4d')],'predictiveIntervalHitRate':_0x172329[_0xb7e4('0x4e')],'predictiveIntervalMultiplicativeFactor':_0x172329[_0xb7e4('0x4f')],'predictiveIntervalPauses':_0x172329[_0xb7e4('0x50')],'predictiveIntervalAvailable':_0x172329[_0xb7e4('0x51')],'predictiveIntervalTotalCalls':_0x172329['predictiveIntervalTotalCalls'],'message':_0x172329[_0xb7e4('0x52')],'originated':_0x172329['originated'],'erlangCalls':_0x172329[_0xb7e4('0x53')],'erlangCallToSecond':_0x172329[_0xb7e4('0x54')],'erlangAbandonmentRate':_0x172329[_0xb7e4('0x55')],'erlangBusyFactor':_0x172329[_0xb7e4('0x56')],'startPredictive':_0x172329[_0xb7e4('0x57')],'startProgressive':_0x172329[_0xb7e4('0x58')]};if(_0x172329[_0xb7e4('0x59')]){_0x18e4fb[_0xb7e4('0x59')]={'id':_0x172329[_0xb7e4('0x59')]['id'],'name':_0x172329['Trunk'][_0xb7e4('0x2c')],'active':_0x172329[_0xb7e4('0x59')][_0xb7e4('0x5a')],'callerid':_0x172329[_0xb7e4('0x59')][_0xb7e4('0x5b')]};}if(_0x172329['Interval']){_0x18e4fb[_0xb7e4('0x5c')]={'id':_0x172329[_0xb7e4('0x5c')]['id'],'name':_0x172329['Interval'][_0xb7e4('0x2c')]};}var _0x5dc0ce=md5(JSON['stringify'](_0x18e4fb));if(_0x172329[_0xb7e4('0x3')]!==_0x5dc0ce){_0x172329[_0xb7e4('0x3')]=_0x5dc0ce;emit(util['format'](_0xb7e4('0x5d'),_0x18e4fb[_0xb7e4('0x2c')]),_0xb7e4('0x5e'),_0x18e4fb);}}}function emitVoiceQueueChannelRemove(_0x2365f1){logger[_0xb7e4('0x5f')](_0xb7e4('0x60'),JSON[_0xb7e4('0x61')](_0x2365f1));emit(util[_0xb7e4('0x62')]('voice:queue:%s',_0x2365f1['name']),_0xb7e4('0x63'),_0x2365f1);io[_0xb7e4('0x29')](_0xb7e4('0x64'),_0x2365f1);}function notSendMessagesQueue(_0x4cf4ea){if(_0x4cf4ea[_0xb7e4('0x65')]){if(_0x4cf4ea[_0xb7e4('0x66')]===0x0&&_0x4cf4ea['pTalking']===0x0){_0x4cf4ea[_0xb7e4('0x65')]=![];_0x4cf4ea['available']=0x0;_0x4cf4ea[_0xb7e4('0x67')]=0x0;_0x4cf4ea['message']=_0xb7e4('0x68');ut[_0xb7e4('0x69')](_0xb7e4('0x6a'),_0x4cf4ea[_0xb7e4('0x2c')]+'\x20is\x20not\x20active');}else{_0x4cf4ea[_0xb7e4('0x52')]='DEACTIVATED';ut[_0xb7e4('0x69')](_0xb7e4('0x6a'),_0x4cf4ea['name']+_0xb7e4('0x6b'));}emitCampaignPreview(_0x4cf4ea);}}Preview[_0xb7e4('0xf')][_0xb7e4('0x27')]=function(){var _0x50cd00=this;setInterval(function(){_0x50cd00[_0xb7e4('0x6c')]();},0x7cf);};Preview[_0xb7e4('0xf')]['syncCampaigns']=function(){var _0x1ebc1c=this[_0xb7e4('0x28')];this['clockClearZombieChannels']+=0x1;for(var _0x33393e in _0x1ebc1c){if(_0x1ebc1c['hasOwnProperty'](_0x33393e)&&(_0x1ebc1c[_0x33393e]['dialMethod']===_0xb7e4('0x6')||_0x1ebc1c[_0x33393e][_0xb7e4('0x37')]==='booked')&&_0x1ebc1c[_0x33393e][_0xb7e4('0x2a')]===_0xb7e4('0x2b')){if(this[_0xb7e4('0x16')]>0x7){this[_0xb7e4('0x16')]=0x0;this[_0xb7e4('0x6d')]();}}if(_0x1ebc1c[_0xb7e4('0x6e')](_0x33393e)&&_0x1ebc1c[_0x33393e][_0xb7e4('0x37')]==='preview'&&_0x1ebc1c[_0x33393e][_0xb7e4('0x2a')]===_0xb7e4('0x2b')){if(_0x1ebc1c[_0x33393e][_0xb7e4('0x6f')]){this[_0xb7e4('0x70')](_0x1ebc1c[_0x33393e]);if(_0x1ebc1c[_0x33393e]['dialPreviewAutoRecallMe'])this[_0xb7e4('0x71')](_0x1ebc1c[_0x33393e]);}else{notSendMessagesQueue(_0x1ebc1c[_0x33393e]);}}}};Preview[_0xb7e4('0xf')][_0xb7e4('0x72')]=function(_0xb12285){var _0x1c45b1=this;this[_0xb7e4('0x13')][_0xb7e4('0x10')](function(){if(!_[_0xb7e4('0x73')](_0x1c45b1[_0xb7e4('0x74')][_0xb12285])){loggerAction[_0xb7e4('0x5f')](_0xb7e4('0x75'),_0xb12285,_0xb7e4('0x76'),_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x77')],_0xb7e4('0x78'),JSON['stringify'](_0x1c45b1[_0xb7e4('0x28')][_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x77')]][_0xb7e4('0x66')]),_0xb7e4('0x79'),JSON[_0xb7e4('0x61')](_0x1c45b1[_0xb7e4('0x28')][_0x1c45b1['actions'][_0xb12285][_0xb7e4('0x77')]]['pTalking']),JSON[_0xb7e4('0x61')](_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x7a')]),JSON[_0xb7e4('0x61')](_['pick'](_0x1c45b1[_0xb7e4('0x74')][_0xb12285],[_0xb7e4('0x7b'),_0xb7e4('0x7c'),_0xb7e4('0x7d'),_0xb7e4('0x7e')])));return ami[_0xb7e4('0x7f')]({'action':'status','channel':_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x80')]})[_0xb7e4('0x81')](function(_0xe3c060){if(_0xe3c060[_0xb7e4('0x52')]===_0xb7e4('0x82')){setTimeout(function(){if(_0x1c45b1[_0xb7e4('0x74')][_0xb12285]){ut[_0xb7e4('0x83')](_0x1c45b1['campaignsPreview'][_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x77')]],'[clearZombieChannel]');if(_0x1c45b1[_0xb7e4('0x74')][_0xb12285]['dialAnswer']===!![]){ut[_0xb7e4('0x84')](_0x1c45b1[_0xb7e4('0x28')][_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x77')]],_0xb7e4('0x85'));ut['loggerError'](_0xb7e4('0x86')+_0xb12285,_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x77')]);}ut[_0xb7e4('0x87')]('[Dialer][checkChannel][Preview]'+_0xb12285,_0x1c45b1[_0xb7e4('0x74')][_0xb12285][_0xb7e4('0x77')]);delete _0x1c45b1[_0xb7e4('0x74')][_0xb12285];}},0x2328);}});}});};Preview[_0xb7e4('0xf')][_0xb7e4('0x6d')]=function(){var _0x5da9b8=this;loggerAction[_0xb7e4('0x5f')](_0xb7e4('0x88'),_[_0xb7e4('0x89')](this[_0xb7e4('0x74')]));for(var _0x594072 in this['actions']){if(_0x5da9b8[_0xb7e4('0x74')][_0xb7e4('0x6e')](_0x594072)){_0x5da9b8[_0xb7e4('0x72')](_0x594072);}}};Preview[_0xb7e4('0xf')]['recallMe']=function(_0x4859f9){var _0x50af79=this;rpcDb[_0xb7e4('0x8a')](_0x4859f9['id'],ut['agentReadyId'](this[_0xb7e4('0x15')]))[_0xb7e4('0x8b')](function(_0x2f6d40){if(!_[_0xb7e4('0x73')](_0x2f6d40)){for(var _0x1f10c3=0x0;_0x1f10c3<_0x2f6d40[_0xb7e4('0x8c')];_0x1f10c3+=0x1){if(ut[_0xb7e4('0x8d')](_0x2f6d40[_0x1f10c3]['scheduledat'])<_0x4859f9[_0xb7e4('0x8e')]*0x3c){if(_0x2f6d40[_0x1f10c3][_0xb7e4('0x8f')]&&!_0x2f6d40[_0x1f10c3][_0xb7e4('0x8f')]['voicePause']){_0x50af79[_0xb7e4('0x90')](_0x2f6d40[_0x1f10c3]['id'])[_0xb7e4('0x8b')](ut[_0xb7e4('0x91')]('[RecallMe]'))['catch'](ut[_0xb7e4('0x91')](_0xb7e4('0x92')));}else{rpcDb[_0xb7e4('0x93')](_0x2f6d40[_0x1f10c3]['id']);}}else{var _0xf2dcaa=new Action(_0x2f6d40[_0x1f10c3],_0x4859f9);_0xf2dcaa[_0xb7e4('0x94')]=moment()['format'](_0xb7e4('0x95'));_0x4859f9['outboundReCallsDay']+=0x1;ut[_0xb7e4('0x96')](_0xf2dcaa,0x17,'RecallInQueue');if(_0x4859f9[_0xb7e4('0x97')]){rpcDb[_0xb7e4('0x98')](ut[_0xb7e4('0x99')](_0x2f6d40[_0x1f10c3]));rpcDb[_0xb7e4('0x9a')](_0xf2dcaa,_0xb7e4('0x9b'));}else{ut[_0xb7e4('0x96')](_0xf2dcaa,0x16,_0xb7e4('0x9c'));rpcDb[_0xb7e4('0x9a')](_0xf2dcaa,_0xb7e4('0x9d'));rpcDb[_0xb7e4('0x9e')](_0xf2dcaa,_0xb7e4('0x9d'));}}}}})['catch'](ut[_0xb7e4('0x91')](_0xb7e4('0x9f')));};Preview[_0xb7e4('0xf')][_0xb7e4('0x70')]=function(_0x474545){_0x474545['sendMessageOneNotActive']=!![];if(ut[_0xb7e4('0xa0')](_0x474545[_0xb7e4('0x2f')])){_0x474545['message']=_0xb7e4('0xa1');}else if(!ut[_0xb7e4('0xa2')](_0x474545[_0xb7e4('0x6f')])){_0x474545[_0xb7e4('0x52')]=_0xb7e4('0x68');}else if(!this['isTrunkReachable'](_0x474545[_0xb7e4('0x59')])){if(!this[_0xb7e4('0xa3')](_0x474545['TrunkBackup'])){_0x474545[_0xb7e4('0x52')]=_0xb7e4('0xa4');}else{_0x474545[_0xb7e4('0x52')]=_0xb7e4('0xa5');}}else{_0x474545[_0xb7e4('0x52')]=_0xb7e4('0xa5');}emitCampaignPreview(_0x474545);};Preview['prototype'][_0xb7e4('0xa6')]=function(_0x1790e1,_0x1acfe8,_0xe6e0d5){var _0x1925a1=this;var _0x45f279=this['actions'][_0x1acfe8];var _0x133b97=this[_0xb7e4('0x28')][_0x45f279['queue']];var _0x8fe0f;var _0x95f54a=![];var _0x2dd900=0x2;var _0x108fd2=0x3;if(_0x133b97){switch(_0xe6e0d5){case'1':_0x133b97['outboundNoSuchCallsDay']+=0x1;_0x45f279[_0xb7e4('0xa7')]+=0x1;_0x45f279[_0xb7e4('0xa8')]=ut[_0xb7e4('0xa9')](_0x45f279);ut[_0xb7e4('0x96')](_0x45f279,0x0,_0xb7e4('0xaa'));ami[_0xb7e4('0x29')](_0xb7e4('0xab'),ut['buildObj'](_0x45f279,'nosuchnumber'));rpcDb[_0xb7e4('0x9a')](_0x45f279,_0xb7e4('0xac'));_0x1925a1['verifyAdditionalPhones'](_0x45f279,'0',_0x133b97)[_0xb7e4('0x8b')](function(_0x233f9c){_0x95f54a=_0x233f9c[_0xb7e4('0xad')]==0x1;_0x2dd900=_0x133b97[_0xb7e4('0xae')];_0x108fd2=_0x133b97[_0xb7e4('0xaf')];if(!_0x95f54a){if(ut['totalGlobal'](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut[_0xb7e4('0xb1')](_0x45f279,0xf,'Global');rpcDb['createCustomerFinal'](_0x8fe0f,_0xb7e4('0xb2'));}else{if(_0x45f279[_0xb7e4('0xa7')]>=_0x133b97['dialNoSuchNumberMaxRetry']){rpcDb[_0xb7e4('0x9e')](_0x45f279,_0xb7e4('0xb2'));}else{rpcDb['rescheduleContact'](ut[_0xb7e4('0xb3')](_0x45f279,_0xb7e4('0xa7'),_0x133b97[_0xb7e4('0xae')]),_0x45f279['unlockAgent'],_0x45f279[_0xb7e4('0xb4')]);}}delete this[_0xb7e4('0x74')][_0x1790e1[_0xb7e4('0xb5')]];}else{_0x45f279[_0xb7e4('0xa7')]++;logger[_0xb7e4('0x5f')](_0xb7e4('0xb6'),_0x45f279[_0xb7e4('0xa7')]);logger['info']('id',_0x45f279['idContact']);_0x1925a1[_0xb7e4('0xb7')]({'id':_0x45f279[_0xb7e4('0xb8')],'field':{'countnosuchnumberretry':_0x45f279['countnosuchnumberretry']}})[_0xb7e4('0x8b')](function(){_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)[_0xb7e4('0x8b')](function(){});});}});break;case _0xb7e4('0xba'):var _0x392633=moment()[_0xb7e4('0x62')](_0xb7e4('0x95'));_0x45f279['responsetime']=_0x392633;_0x45f279['answertime']=_0x392633;_0x45f279['dialAnswer']=!![];_0x133b97[_0xb7e4('0x30')]+=0x1;logger[_0xb7e4('0x5f')](_0xb7e4('0xbb'),_0x45f279[_0xb7e4('0xbc')],_0xb7e4('0xbd'),_0x133b97[_0xb7e4('0x2c')],_0xb7e4('0x79'),_0x133b97[_0xb7e4('0x30')]);ami['emit'](_0xb7e4('0xbe'),ut[_0xb7e4('0xbf')](_0x45f279,_0xb7e4('0xc0'),this[_0xb7e4('0x28')][_0x45f279[_0xb7e4('0x77')]]));if(_0x133b97[_0xb7e4('0xc1')]){ami[_0xb7e4('0x29')]('custom:agentConnectPreview',ut[_0xb7e4('0xc2')](_0x45f279));}break;case'16':ami[_0xb7e4('0x29')]('custom:agentcomplete',ut[_0xb7e4('0xbf')](_0x45f279,'complete',this[_0xb7e4('0x28')][_0x45f279[_0xb7e4('0x77')]]));emitVoiceQueueChannelRemove(ut[_0xb7e4('0xbf')](_0x45f279,_0xb7e4('0xc3')));_0x133b97[_0xb7e4('0xc4')]+=0x1;_0x133b97[_0xb7e4('0x33')]+=0x1;_0x133b97['answered']+=0x1;ut[_0xb7e4('0x84')](_0x133b97,_0xb7e4('0xc5'));_0x45f279[_0xb7e4('0xa8')]=ut[_0xb7e4('0xa9')](_0x45f279);ut[_0xb7e4('0x96')](_0x45f279,0x4,_0xb7e4('0xc6'));rpcDb[_0xb7e4('0x9a')](_0x45f279,_0xb7e4('0xc7'));rpcDb['createCustomerFinal'](_0x45f279,_0xb7e4('0xc8'));rpcDb['crateCustomerReportQueue'](_0x45f279);_0x133b97[_0xb7e4('0x31')]+=_0x45f279[_0xb7e4('0xc9')];_0x133b97[_0xb7e4('0xca')]+=_0x45f279['talktime'];logger[_0xb7e4('0x5f')]('[syncHangup][talking][decrement]',_0x45f279[_0xb7e4('0xbc')],_0xb7e4('0xbd'),_0x133b97[_0xb7e4('0x2c')],_0xb7e4('0x79'),_0x133b97[_0xb7e4('0x30')]);delete this[_0xb7e4('0x74')][_0x1790e1[_0xb7e4('0xb5')]];break;case'BUSY':_0x133b97[_0xb7e4('0x3d')]+=0x1;_0x45f279[_0xb7e4('0xcb')]+=0x1;_0x45f279['countglobal']=ut[_0xb7e4('0xa9')](_0x45f279);ut[_0xb7e4('0x96')](_0x45f279,0x5,'Busy');_0x2dd900=_0x133b97['dialBusyRetryFrequency'];_0x108fd2=_0x133b97[_0xb7e4('0xaf')];ami[_0xb7e4('0x29')]('custom:agentbusy',ut[_0xb7e4('0xbf')](_0x45f279,'busy'));rpcDb[_0xb7e4('0x9a')](_0x45f279,_0xb7e4('0xcc'));_0x1925a1['verifyAdditionalPhones'](_0x45f279,'5',_0x133b97)[_0xb7e4('0x8b')](function(_0x1f8336){_0x95f54a=_0x1f8336[_0xb7e4('0xad')]==0x1;if(!_0x95f54a){if(ut[_0xb7e4('0xa9')](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut[_0xb7e4('0xb1')](_0x45f279,0xf,_0xb7e4('0xcd'));rpcDb['createCustomerFinal'](_0x8fe0f,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x45f279[_0xb7e4('0xcb')]>=_0x133b97['dialBusyMaxRetry']){rpcDb[_0xb7e4('0x9e')](_0x45f279,_0xb7e4('0xcc'));}else{rpcDb[_0xb7e4('0xce')](ut[_0xb7e4('0xb3')](_0x45f279,_0xb7e4('0xcb'),_0x133b97[_0xb7e4('0xcf')]),_0x45f279[_0xb7e4('0xd0')],_0x45f279[_0xb7e4('0xb4')]);}}}else{_0x45f279[_0xb7e4('0xcb')]++;_0x1925a1[_0xb7e4('0xb7')]({'id':_0x45f279[_0xb7e4('0xb8')],'field':{'countbusyretry':_0x45f279['countbusyretry']}})['then'](function(){_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)[_0xb7e4('0x8b')](function(){});});}});break;case _0xb7e4('0xd1'):_0x133b97[_0xb7e4('0x42')]+=0x1;_0x45f279[_0xb7e4('0xd2')]+=0x1;_0x45f279['countglobal']=ut['totalGlobal'](_0x45f279);ut[_0xb7e4('0x96')](_0x45f279,0x3,'NoAnswer');_0x2dd900=_0x133b97[_0xb7e4('0xd3')];_0x108fd2=_0x133b97[_0xb7e4('0xaf')];var _0x4df169=ut[_0xb7e4('0xd4')](_0x45f279,_0x133b97);ami['emit'](_0xb7e4('0xd5'),_0x4df169);rpcDb[_0xb7e4('0x9a')](_0x45f279,'[callProgressDetectingCustomer][logNoAnswer]');_0x1925a1[_0xb7e4('0xd6')](_0x45f279,'3',_0x133b97)[_0xb7e4('0x8b')](function(_0x72b33b){_0x95f54a=_0x72b33b[_0xb7e4('0xad')]==0x1;if(!_0x95f54a){if(ut[_0xb7e4('0xa9')](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut[_0xb7e4('0xb1')](_0x45f279,0xf,'Global');rpcDb[_0xb7e4('0x9e')](_0x8fe0f,_0xb7e4('0xd7'));}else{if(_0x45f279['countnoanswerretry']>=_0x133b97[_0xb7e4('0xd8')]){rpcDb['createCustomerFinal'](_0x45f279,_0xb7e4('0xd9'));}else{rpcDb[_0xb7e4('0xce')](ut[_0xb7e4('0xb3')](_0x45f279,_0xb7e4('0xd2'),_0x133b97['dialNoAnswerRetryFrequency']),_0x45f279[_0xb7e4('0xd0')],_0x45f279[_0xb7e4('0xb4')]);}}}else{_0x45f279[_0xb7e4('0xd2')]++;_0x1925a1[_0xb7e4('0xb7')]({'id':_0x45f279[_0xb7e4('0xb8')],'field':{'countnoanswerretry':_0x45f279[_0xb7e4('0xd2')]}})['then'](function(){_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)[_0xb7e4('0x8b')](function(){});});}});break;case _0xb7e4('0xda'):_0x133b97[_0xb7e4('0x3e')]+=0x1;_0x45f279[_0xb7e4('0xdb')]+=0x1;_0x45f279['countglobal']=ut[_0xb7e4('0xa9')](_0x45f279);ut['logCustomer'](_0x45f279,0x8,_0xb7e4('0xdc'));_0x2dd900=_0x133b97[_0xb7e4('0xdd')];_0x108fd2=_0x133b97[_0xb7e4('0xaf')];ami[_0xb7e4('0x29')]('custom:agentcongestion',ut[_0xb7e4('0xbf')](_0x45f279,_0xb7e4('0xde')));rpcDb['createCustomerHistory'](_0x45f279,_0xb7e4('0xdf'));_0x1925a1['verifyAdditionalPhones'](_0x45f279,'8',_0x133b97)[_0xb7e4('0x8b')](function(_0x40ac45){_0x95f54a=_0x40ac45['additional']==0x1;if(!_0x95f54a){if(ut[_0xb7e4('0xa9')](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut[_0xb7e4('0xb1')](_0x45f279,0xf,'Global');rpcDb[_0xb7e4('0x9e')](_0x8fe0f,_0xb7e4('0xe0'));}else{if(_0x45f279['countcongestionretry']>=_0x133b97[_0xb7e4('0xe1')]){rpcDb['createCustomerFinal'](_0x45f279,_0xb7e4('0xdf'));}else{rpcDb[_0xb7e4('0xce')](ut[_0xb7e4('0xb3')](_0x45f279,'countcongestionretry',_0x133b97['dialBusyRetryFrequency']),_0x45f279[_0xb7e4('0xd0')],_0x45f279[_0xb7e4('0xb4')]);}}}else{_0x45f279['countcongestionretry']++;_0x1925a1[_0xb7e4('0xb7')]({'id':_0x45f279['idContact'],'field':{'countcongestionretry':_0x45f279['countcongestionretry']}})[_0xb7e4('0x8b')](function(){_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)[_0xb7e4('0x8b')](function(){});});}});break;case _0xb7e4('0xe2'):_0x133b97[_0xb7e4('0x46')]+=0x1;_0x45f279[_0xb7e4('0xe3')]+=0x1;_0x45f279['countglobal']=ut[_0xb7e4('0xa9')](_0x45f279);ut[_0xb7e4('0x96')](_0x45f279,0x14,_0xb7e4('0xe4'));_0x2dd900=_0x133b97['dialAgentRejectRetryFrequency'];_0x108fd2=_0x133b97[_0xb7e4('0xaf')];ami['emit'](_0xb7e4('0xe5'),ut['buildObj'](_0x45f279,_0xb7e4('0xe6')));rpcDb[_0xb7e4('0x9a')](_0x45f279,_0xb7e4('0xe7'));_0x1925a1[_0xb7e4('0xd6')](_0x45f279,'20',_0x133b97)[_0xb7e4('0x8b')](function(_0x2cf0d8){_0x95f54a=_0x2cf0d8[_0xb7e4('0xad')]==0x1;if(!_0x95f54a){if(ut[_0xb7e4('0xa9')](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut['cloneAction'](_0x45f279,0x14,'AgentReject');rpcDb[_0xb7e4('0x9e')](_0x8fe0f,_0xb7e4('0xe8'));}else{if(_0x45f279['countagentrejectretry']>=_0x133b97[_0xb7e4('0xe9')]){rpcDb[_0xb7e4('0x9e')](_0x45f279,_0xb7e4('0xe8'));}else{rpcDb[_0xb7e4('0xce')](ut[_0xb7e4('0xb3')](_0x45f279,_0xb7e4('0xe3'),_0x133b97[_0xb7e4('0xea')]),_0x45f279[_0xb7e4('0xd0')],_0x45f279[_0xb7e4('0xb4')]);}}}else{_0x45f279[_0xb7e4('0xd2')]++;_0x1925a1['incrementPreviewCounters']({'id':_0x45f279['idContact'],'field':{'countnoanswerretry':_0x45f279[_0xb7e4('0xd2')]}})['then'](function(){_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)['then'](function(){});});}});break;case _0xb7e4('0xeb'):_0x133b97[_0xb7e4('0x48')]+=0x1;_0x45f279[_0xb7e4('0xec')]+=0x1;_0x45f279['countglobal']=ut['totalGlobal'](_0x45f279);ut[_0xb7e4('0x96')](_0x45f279,0xb,_0xb7e4('0xed'));rpcDb[_0xb7e4('0x9a')](_0x45f279,_0xb7e4('0xee'));_0x1925a1[_0xb7e4('0xd6')](_0x45f279,'11',_0x133b97)[_0xb7e4('0x8b')](function(_0x3a00bf){_0x95f54a=_0x3a00bf[_0xb7e4('0xad')]==0x1;if(!_0x95f54a){if(ut[_0xb7e4('0xa9')](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut['cloneAction'](_0x45f279,0xf,_0xb7e4('0xcd'));rpcDb['createCustomerFinal'](_0x8fe0f,_0xb7e4('0xee'));}else{if(_0x45f279[_0xb7e4('0xef')]>=_0x133b97[_0xb7e4('0xf0')]){rpcDb[_0xb7e4('0x9e')](_0x45f279,_0xb7e4('0xee'));}else{rpcDb[_0xb7e4('0xce')](ut[_0xb7e4('0xb3')](_0x45f279,_0xb7e4('0xec'),_0x133b97['dialAbandonedRetryFrequency']),_0x45f279[_0xb7e4('0xd0')],_0x45f279[_0xb7e4('0xb4')]);}}}else{_0x45f279[_0xb7e4('0xd2')]++;_0x1925a1[_0xb7e4('0xb7')]({'id':_0x45f279['idContact'],'field':{'countnoanswerretry':_0x45f279['countnoanswerretry']}})[_0xb7e4('0x8b')](function(){_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)['then'](function(){});});}});break;case'18':_0x133b97['outboundUnknownCallsDay']+=0x1;_0x45f279[_0xb7e4('0xf1')]+=0x1;_0x45f279[_0xb7e4('0xa8')]=ut['totalGlobal'](_0x45f279);ut['logCustomer'](_0x45f279,0x12,_0x1790e1[_0xb7e4('0xf2')]||_0x1790e1[_0xb7e4('0xf3')]);ami[_0xb7e4('0x29')]('custom:amd',ut[_0xb7e4('0xbf')](_0x45f279,_0xb7e4('0xf4')));rpcDb[_0xb7e4('0x9a')](_0x45f279,_0xb7e4('0xf5'));_0x1925a1['verifyAdditionalPhones'](_0x45f279,'18',_0x133b97)[_0xb7e4('0x8b')](function(_0xe2a683){_0x95f54a=_0xe2a683[_0xb7e4('0xad')]==0x1;if(!_0x95f54a){if(ut[_0xb7e4('0xa9')](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut[_0xb7e4('0xb1')](_0x45f279,0x12,'Global');rpcDb[_0xb7e4('0x9e')](_0x8fe0f,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb7e4('0x9e')](_0x45f279,_0xb7e4('0xf5'));}}else{_0x45f279[_0xb7e4('0xd2')]++;_0x1925a1['incrementPreviewCounters']({'id':_0x45f279[_0xb7e4('0xb8')],'field':{'countnoanswerretry':_0x45f279[_0xb7e4('0xd2')]}})['then'](function(){_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)['then'](function(){});});}});delete this[_0xb7e4('0x74')][_0x1790e1[_0xb7e4('0xb5')]];break;case'19':_0x133b97[_0xb7e4('0x47')]+=0x1;_0x45f279[_0xb7e4('0xa8')]=ut[_0xb7e4('0xa9')](_0x45f279);ut[_0xb7e4('0x96')](_0x45f279,0x13,_0x1790e1[_0xb7e4('0xf2')]||_0x1790e1['dialstatus']);ami['emit'](_0xb7e4('0xf6'),ut[_0xb7e4('0xbf')](_0x45f279,_0xb7e4('0xf4')));rpcDb[_0xb7e4('0x9a')](_0x45f279,_0xb7e4('0xf7'));_0x1925a1[_0xb7e4('0xd6')](_0x45f279,'18',_0x133b97)[_0xb7e4('0x8b')](function(_0x315666){_0x95f54a=_0x315666[_0xb7e4('0xad')]==0x1;if(!_0x95f54a){if(ut['totalGlobal'](_0x45f279)>=_0x133b97['dialGlobalMaxRetry']){_0x8fe0f=ut['cloneAction'](_0x45f279,0xf,_0xb7e4('0xcd'));rpcDb[_0xb7e4('0x9e')](_0x8fe0f,_0xb7e4('0xf7'));}else{rpcDb[_0xb7e4('0x9e')](_0x45f279,_0xb7e4('0xf7'));}}else{_0x45f279[_0xb7e4('0xd2')]++;_0x1925a1[_0xb7e4('0xb7')]({'id':_0x45f279['idContact'],'field':{'countnoanswerretry':_0x45f279['countnoanswerretry']}})[_0xb7e4('0x8b')](function(){_0x1925a1['swapAdditionalPhones'](_0x45f279,_0x2dd900,_0x108fd2)[_0xb7e4('0x8b')](function(){});});}});delete this[_0xb7e4('0x74')][_0x1790e1[_0xb7e4('0xb5')]];break;default:if(_0x45f279['dialAnswer']){ut[_0xb7e4('0x84')](_0x133b97,'[default]');ut['loggerError'](_0xb7e4('0xf8')+_0x133b97[_0xb7e4('0x2c')],_0x1790e1);}_0x133b97[_0xb7e4('0x47')]+=0x1;_0x45f279[_0xb7e4('0xa8')]=ut[_0xb7e4('0xa9')](_0x45f279);ut['logCustomer'](_0x45f279,0xc,_0x1790e1['cause-txt']||_0x1790e1[_0xb7e4('0xf3')]);_0x2dd900=_0x133b97[_0xb7e4('0xea')];_0x108fd2=_0x133b97[_0xb7e4('0xaf')];rpcDb['createCustomerHistory'](_0x45f279,_0xb7e4('0xf9'));_0x1925a1[_0xb7e4('0xd6')](_0x45f279,'20',_0x133b97)[_0xb7e4('0x8b')](function(_0x5d4231){_0x95f54a=_0x5d4231[_0xb7e4('0xad')]==0x1;if(!_0x95f54a){if(ut[_0xb7e4('0xa9')](_0x45f279)>=_0x133b97[_0xb7e4('0xb0')]){_0x8fe0f=ut[_0xb7e4('0xb1')](_0x45f279,0xf,_0xb7e4('0xcd'));rpcDb['createCustomerFinal'](_0x8fe0f,_0xb7e4('0xfa'));}else{rpcDb[_0xb7e4('0x9e')](_0x45f279,_0xb7e4('0xfa'));}delete this[_0xb7e4('0x74')][_0x1790e1['linkedid']];}else{_0x1925a1[_0xb7e4('0xb9')](_0x45f279,_0x2dd900,_0x108fd2)[_0xb7e4('0x8b')](function(){});}});}if(!(_0x45f279[_0xb7e4('0x7a')]&&_0xe6e0d5==='16')){ut[_0xb7e4('0x83')](_0x133b97,'[callProgressDetectingCustomer]');logger[_0xb7e4('0x5f')](_0xb7e4('0xfb'),_0x45f279[_0xb7e4('0xbc')],_0xb7e4('0xbd'),_0x133b97['name'],_0xb7e4('0x78'),_0x133b97['originated']);}if(_0xe6e0d5!==_0xb7e4('0xba')){delete this['actions'][_0x1790e1[_0xb7e4('0xb5')]];delete this['actions'][_0x1790e1['destlinkedid']];}}};Preview[_0xb7e4('0xf')]['callProgressDetectingAgent']=function(_0x14662a,_0x5a0d66,_0x24d5c4){if(_[_0xb7e4('0xfc')](_0x5a0d66)&&_0xb7e4('0xfd')!==typeof _0x5a0d66){return;}if(_[_0xb7e4('0xfc')](_0x24d5c4)&&'object'!==typeof _0x24d5c4){return;}switch(_0x24d5c4[_0xb7e4('0xfe')]){case'0':ut['logAgent'](_0x14662a,0x0,_0xb7e4('0xaa'));rpcDb[_0xb7e4('0xff')](_0x14662a,_0xb7e4('0x100'));break;case'3':ut[_0xb7e4('0x101')](_0x14662a,0x3,'NoAnswer');rpcDb[_0xb7e4('0xff')](_0x14662a,_0xb7e4('0x102'));break;case'5':ut['logAgent'](_0x14662a,0x5,'Busy');rpcDb['createAgentHistory'](_0x14662a,_0xb7e4('0x103'));break;case'8':ut['logAgent'](_0x14662a,0x8,_0xb7e4('0xdc'));rpcDb['createAgentHistory'](_0x14662a,_0xb7e4('0x104'));break;case'22':ut[_0xb7e4('0x101')](_0x14662a,0x16,_0xb7e4('0x105'));rpcDb[_0xb7e4('0xff')](_0x14662a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xb7e4('0x101')](_0x14662a,0xc,_0x24d5c4[_0xb7e4('0xfe')]);rpcDb['createAgentHistory'](_0x14662a,_0xb7e4('0x104'));}ut[_0xb7e4('0x83')](_0x5a0d66,_0xb7e4('0x106'));logger[_0xb7e4('0x5f')](_0xb7e4('0x107'),_0x14662a['uniqueid'],_0xb7e4('0xbd'),_0x5a0d66[_0xb7e4('0x2c')],'originated:\x20',_0x5a0d66[_0xb7e4('0x66')]);delete this['actions'][_0x14662a[_0xb7e4('0xbc')]];};Preview[_0xb7e4('0xf')][_0xb7e4('0xd6')]=function(_0x199571,_0x92bdb3,_0x22e4aa){return Promise[_0xb7e4('0x108')]()[_0xb7e4('0x8b')](cmHopperAdditionalPhone[_0xb7e4('0xd6')](_0x199571,_0x92bdb3,_0x22e4aa))['catch'](logger[_0xb7e4('0x5f')](_0xb7e4('0x109')));};Preview[_0xb7e4('0xf')][_0xb7e4('0xb9')]=function(_0x364ec7,_0x5b9c23,_0x2c4c5c){return Promise[_0xb7e4('0x108')]()[_0xb7e4('0x8b')](cmHopperAdditionalPhone[_0xb7e4('0xb9')](_0x364ec7,_0x5b9c23,_0x2c4c5c))['catch'](logger['info'](_0xb7e4('0x10a')));};Preview[_0xb7e4('0xf')]['incrementPreviewCounters']=function(_0x28fd44){return Promise['resolve']()[_0xb7e4('0x8b')](cmHopperAdditionalPhone[_0xb7e4('0xb7')](_0x28fd44))[_0xb7e4('0x81')](logger[_0xb7e4('0x5f')](_0xb7e4('0x10b')));};Preview['prototype']['checkInBlack']=function(_0x1d3375,_0x29923a,_0x4bdd43,_0x5dbc56,_0x89b0da){var _0x36497e=this;return new Promise(function(_0xc94235,_0x53bb2c){if(_[_0xb7e4('0x73')](_0x29923a)||_[_0xb7e4('0x73')](_0x29923a[_0xb7e4('0x10c')])||_[_0xb7e4('0x73')](_0x29923a['phone'])||_[_0xb7e4('0x73')](_0x29923a[_0xb7e4('0x7d')])){_0x53bb2c(ut[_0xb7e4('0x52')](_0xb7e4('0x10d'),_0x5dbc56,_0x89b0da));return;}var _0x2660f3=uuid['v4']();var _0x34acaa=_0x36497e[_0xb7e4('0x28')][_0x29923a[_0xb7e4('0x76')]['name']];var _0x45a5aa=_0x4bdd43?_0x36497e['agents'][_0x4bdd43]['id']:undefined;_0x36497e['actions'][_0x2660f3]=new Action(_0x29923a,_0x34acaa,_0x2660f3,_0x4bdd43,_0x45a5aa);var _0xdf8d86=_0x36497e[_0xb7e4('0x74')][_0x2660f3];_0xdf8d86[_0xb7e4('0xd0')]=_0x5dbc56;_0xdf8d86[_0xb7e4('0xb4')]=_0x89b0da;_0xdf8d86[_0xb7e4('0x10e')]=_0x4bdd43;if(_[_0xb7e4('0x10f')](_0x1d3375)){_0x36497e[_0xb7e4('0x110')](_0xdf8d86,_0x34acaa,_0x29923a,_0x4bdd43)[_0xb7e4('0x8b')](function(_0x3bc1af){logger[_0xb7e4('0x5f')](_0xb7e4('0x111'),_0xb7e4('0x112')+_0xdf8d86[_0xb7e4('0x77')]+_0xb7e4('0x113')+_0xdf8d86[_0xb7e4('0xb8')],JSON['stringify'](_0x3bc1af));ami[_0xb7e4('0x29')](_0xb7e4('0x114'),ut[_0xb7e4('0xbf')](_0xdf8d86,_0xb7e4('0x115'),_0x36497e[_0xb7e4('0x28')][_0xdf8d86[_0xb7e4('0x77')]]));_0xc94235(ut[_0xb7e4('0x52')](_0xb7e4('0x116')));})[_0xb7e4('0x81')](function(_0x1977f6){ut[_0xb7e4('0x69')](_0xb7e4('0x117'),_0x1977f6);_0x53bb2c(ut[_0xb7e4('0x52')](_0xb7e4('0x118'),_0x5dbc56,_0x89b0da));});}else{_0x34acaa[_0xb7e4('0x3c')]+=0x1;ut['logBlacklist'](_0xdf8d86);rpcDb['createHistory'](_0xdf8d86,_0xb7e4('0x119'));delete _0x36497e[_0xb7e4('0x74')][_0x2660f3];_0x53bb2c(ut[_0xb7e4('0x52')](_0xb7e4('0x11a'),_0x5dbc56,_0x89b0da));}});};Preview[_0xb7e4('0xf')][_0xb7e4('0xa3')]=function(_0x1babe3){return!_['isNil'](_0x1babe3)&&!_['isNil'](_0x1babe3[_0xb7e4('0x2c')])&&!_[_0xb7e4('0x73')](_0x1babe3['active'])&&_0x1babe3[_0xb7e4('0x5a')]&&!_[_0xb7e4('0x73')](this[_0xb7e4('0x14')][util['format'](_0xb7e4('0x11b'),_0x1babe3[_0xb7e4('0x2c')])])&&!_[_0xb7e4('0x73')](this[_0xb7e4('0x14')][util[_0xb7e4('0x62')](_0xb7e4('0x11b'),_0x1babe3['name'])][_0xb7e4('0x11c')])&&(this[_0xb7e4('0x14')][util['format'](_0xb7e4('0x11b'),_0x1babe3[_0xb7e4('0x2c')])][_0xb7e4('0x11c')]===_0xb7e4('0x11d')||this[_0xb7e4('0x14')][util[_0xb7e4('0x62')](_0xb7e4('0x11b'),_0x1babe3[_0xb7e4('0x2c')])]['status']==='unmonitored');};Preview[_0xb7e4('0xf')][_0xb7e4('0x90')]=function(_0x4b0e11,_0x2b3b24){return this[_0xb7e4('0x11e')](_0x4b0e11,_0x2b3b24)[_0xb7e4('0x8b')](function(_0x730a57){return _[_0xb7e4('0x11f')](_0x730a57,[_0xb7e4('0x52')]);})[_0xb7e4('0x81')](function(_0x5e68a3){if(_0x5e68a3[_0xb7e4('0x120')]){rpcDb[_0xb7e4('0x121')](_0x4b0e11);}if(_0x5e68a3[_0xb7e4('0x5a')]){rpcDb[_0xb7e4('0x93')](_0x4b0e11);}throw _[_0xb7e4('0x11f')](_0x5e68a3,['message']);});};Preview[_0xb7e4('0xf')][_0xb7e4('0x11e')]=function(_0x3e8cfa,_0x2598fc){var _0x2415c9=this;var _0x1b62b5,_0x1bed1d;return rpcDb['getContactPreview'](_0x3e8cfa)[_0xb7e4('0x8b')](function(_0x32a9db){if(!_[_0xb7e4('0x73')](_0x32a9db[0x0])){_0x1bed1d=_0x32a9db[0x0][_0xb7e4('0x122')]?![]:!![];_0x1b62b5=_0x32a9db[0x0][_0xb7e4('0x122')]?!![]:![];_0x1b62b5=_0x2598fc?!![]:_0x1b62b5;}var _0xadc2ba=_0x2415c9[_0xb7e4('0x123')](_0x32a9db);if(_0xadc2ba['isValid']){rpcDb[_0xb7e4('0x124')](_[_0xb7e4('0x11f')](_0x32a9db[0x0],[_0xb7e4('0x7d'),_0xb7e4('0x125')]))[_0xb7e4('0x8b')](function(_0xbd5c79){_0x2415c9[_0xb7e4('0x126')](_0xbd5c79,_0x32a9db[0x0],_0x2598fc,_0x1bed1d,_0x1b62b5)[_0xb7e4('0x8b')](function(_0x18efd3){return _0x18efd3;})[_0xb7e4('0x81')](function(_0x18a77b){throw _0x18a77b;});})[_0xb7e4('0x81')](function(_0x8451d2){ut['logger'](_0xb7e4('0x127'),_0x8451d2);throw ut['message'](_0xb7e4('0x128'),_0x1bed1d,_0x1b62b5);});}else{throw ut[_0xb7e4('0x52')](_0xadc2ba['message'],_0x1bed1d,_0x1b62b5);}})[_0xb7e4('0x81')](function(_0x569854){ut[_0xb7e4('0x69')](_0xb7e4('0x129'),_0x569854);throw ut['message'](_0xb7e4('0x128'),![],!![]);});};Preview[_0xb7e4('0xf')][_0xb7e4('0x123')]=function(_0x10e802){if(_[_0xb7e4('0x73')](_0x10e802)||_['isEmpty'](_0x10e802)||!_['isNil'](_0x10e802[0x0][_0xb7e4('0x8f')])&&_[_0xb7e4('0x73')](_0x10e802[0x0][_0xb7e4('0x8f')]['name'])){ut['logger'](_0xb7e4('0x12a'),_0x10e802);return{'isValid':![],'message':_0xb7e4('0x12b')};}var _0x415505=this[_0xb7e4('0x28')][_0x10e802[0x0][_0xb7e4('0x76')][_0xb7e4('0x2c')]];_0x415505[_0xb7e4('0x52')]=_0xb7e4('0xa5');if(_[_0xb7e4('0x73')](_0x415505)){ut[_0xb7e4('0x69')](_0xb7e4('0x12c'),_0x415505);return{'isValid':![],'message':_0xb7e4('0x12d')};}if(!this['isTrunkReachable'](_0x415505['Trunk'])){ut[_0xb7e4('0x69')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x415505[_0xb7e4('0x2c')]+_0xb7e4('0x12e'));if(!this['isTrunkReachable'](_0x415505[_0xb7e4('0x12f')])){ut[_0xb7e4('0x69')](_0xb7e4('0x130'),_0x415505[_0xb7e4('0x2c')]+_0xb7e4('0x131'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xb7e4('0xa2')](_0x415505['dialActive'])){ut['logger'](_0xb7e4('0x132'),_0x415505[_0xb7e4('0x2c')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xb7e4('0x133')+_0x415505[_0xb7e4('0x2c')]+_0xb7e4('0x134')};}return{'isValid':!![],'message':_0xb7e4('0x135')};};Preview[_0xb7e4('0xf')][_0xb7e4('0x110')]=function(_0x21e180,_0x363e94,_0x214a26,_0x3407c4){var _0x4c54a1=this;return new Promise(function(_0x53ec5f,_0x3ede48){var _0x168339=_0x21e180['uniqueid'];var _0x2dc7dc=_0x4c54a1['isTrunkReachable'](_0x363e94['Trunk'])?util[_0xb7e4('0x62')]('SIP/%s/%s%s',_0x363e94[_0xb7e4('0x59')][_0xb7e4('0x2c')],_[_0xb7e4('0x73')](_0x363e94[_0xb7e4('0x3a')])?'':_0x363e94['dialPrefix'][_0xb7e4('0x136')]()||'',_0x363e94[_0xb7e4('0x137')]>0x0?_0x214a26['phone'][_0xb7e4('0x138')](_0x363e94[_0xb7e4('0x137')]):_0x214a26[_0xb7e4('0x125')]):util[_0xb7e4('0x62')](_0xb7e4('0x139'),_[_0xb7e4('0x73')](_0x363e94[_0xb7e4('0x12f')])?_0x363e94[_0xb7e4('0x59')]['name']:_0x363e94[_0xb7e4('0x12f')][_0xb7e4('0x2c')],_[_0xb7e4('0x73')](_0x363e94[_0xb7e4('0x3a')])?'':_0x363e94[_0xb7e4('0x3a')]['trim']()||'',_0x363e94[_0xb7e4('0x137')]>0x0?_0x214a26[_0xb7e4('0x125')]['substring'](_0x363e94['dialCutDigit']):_0x214a26[_0xb7e4('0x125')]);var _0x2e3dfb=_0x4c54a1['isTrunkReachable'](_0x363e94['Trunk'])?ut[_0xb7e4('0x13a')](_0x363e94[_0xb7e4('0x59')][_0xb7e4('0x5b')],_0x363e94[_0xb7e4('0x38')],_0x363e94['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb7e4('0x13b')](_0x363e94[_0xb7e4('0x13c')],_0x363e94[_0xb7e4('0x13d')]):_0x363e94[_0xb7e4('0x13c')]):ut['getCallerId'](_['isNil'](_0x363e94['TrunkBackup'])?_0x363e94[_0xb7e4('0x59')]['callerid']:_0x363e94['TrunkBackup'][_0xb7e4('0x5b')],_0x363e94['dialOriginateCallerIdName'],_0x363e94[_0xb7e4('0x13d')]>0x0?ut['getCallerIdRandom'](_0x363e94[_0xb7e4('0x13c')],_0x363e94[_0xb7e4('0x13d')]):_0x363e94['dialOriginateCallerIdNumber']);if(_0x2e3dfb){_0x21e180[_0xb7e4('0x13e')]=ut['extractCalleridName'](_0x2e3dfb);_0x21e180[_0xb7e4('0x13f')]=ut[_0xb7e4('0x140')](_0x2e3dfb);}var _0x48e618=ut[_0xb7e4('0x141')](_0x363e94,_0x214a26,_0x2dc7dc,_0x2e3dfb,_0x168339,_0x21e180);_['merge'](_0x21e180,ut[_0xb7e4('0x142')](_0x48e618));_0x21e180['starttime']=moment()[_0xb7e4('0x62')](_0xb7e4('0x95'));_0x363e94[_0xb7e4('0x143')]=_0x48e618;ami[_0xb7e4('0x7f')](ut['variablesAction'](_0x21e180,_0x363e94,_0x48e618,_0x21e180[_0xb7e4('0xb4')],_0x3407c4))[_0xb7e4('0x8b')](function(_0x2d7ea6){_0x363e94[_0xb7e4('0x66')]+=0x1;logger['info'](_0xb7e4('0x144'),_0x168339,_0xb7e4('0xbd'),_0x363e94[_0xb7e4('0x2c')],_0xb7e4('0x78'),_0x363e94[_0xb7e4('0x66')]);_0x53ec5f(_0x2d7ea6);})[_0xb7e4('0x81')](function(_0x88963c){ut['logAgent'](_0x21e180,0xe,_0xb7e4('0x145'));rpcDb[_0xb7e4('0xff')](_0x21e180,_0xb7e4('0x146'));_0x3ede48(_0x88963c);});});};Preview[_0xb7e4('0xf')][_0xb7e4('0x21')]=function(_0x35d759){if(this[_0xb7e4('0x74')][_0x35d759[_0xb7e4('0xb5')]]){this[_0xb7e4('0x74')][_0x35d759[_0xb7e4('0xb5')]][_0xb7e4('0x80')]=_0x35d759[_0xb7e4('0x80')];}};Preview[_0xb7e4('0xf')]['syncOriginateResponse']=function(_0x634a4){var _0x2dd395=this;var _0xfcf3ef=this[_0xb7e4('0x74')][_0x634a4['actionid']];if(_0xfcf3ef){if(_0xfcf3ef['lookAgent']&&this[_0xb7e4('0x15')][_0xfcf3ef[_0xb7e4('0x10e')]]){ut[_0xb7e4('0x147')](_0xfcf3ef,this[_0xb7e4('0x15')][_0xfcf3ef[_0xb7e4('0x10e')]][_0xb7e4('0x2c')],this[_0xb7e4('0x15')][_0xfcf3ef[_0xb7e4('0x10e')]]['id']);}var _0x5310cb=_[_0xb7e4('0x148')](_0xfcf3ef);_0x5310cb[_0xb7e4('0x149')]=moment()['format'](_0xb7e4('0x95'));var _0x1097e8=_0x2dd395[_0xb7e4('0x28')][_0xfcf3ef[_0xb7e4('0x77')]];if(ut[_0xb7e4('0x14a')](_0x634a4[_0xb7e4('0x14b')])){if(_0xfcf3ef['unlockAgent']){rpcDb[_0xb7e4('0x121')](_0xfcf3ef[_0xb7e4('0xb8')]);}if(_0xfcf3ef['activeContact']){rpcDb[_0xb7e4('0x93')](_0xfcf3ef[_0xb7e4('0xb8')]);}ami[_0xb7e4('0x29')](_0xb7e4('0x14c'),ut[_0xb7e4('0xbf')](_0xfcf3ef,_0xb7e4('0x14d'),this[_0xb7e4('0x28')][_0xfcf3ef[_0xb7e4('0x77')]]));this[_0xb7e4('0x14e')](_0x5310cb,_0x1097e8,_0x634a4);}else{_0xfcf3ef[_0xb7e4('0x94')]=moment()[_0xb7e4('0x62')](_0xb7e4('0x95'));ut[_0xb7e4('0x101')](_0x5310cb,0x4,_0xb7e4('0xc6'));rpcDb[_0xb7e4('0xff')](_0x5310cb,_0xb7e4('0x14f'));}}};Preview[_0xb7e4('0xf')][_0xb7e4('0x1b')]=function(_0x5b5841){var _0x5deabe=this[_0xb7e4('0x74')][_0x5b5841[_0xb7e4('0xb5')]];var _0x26c99a;if(_0x5deabe){_0x26c99a=this[_0xb7e4('0x28')][_0x5deabe[_0xb7e4('0x77')]];logger['info'](_0xb7e4('0x150'),_0x5b5841[_0xb7e4('0xb5')],_0xb7e4('0xbd'),_0x26c99a[_0xb7e4('0x2c')],'pTalking:\x20',_0x26c99a[_0xb7e4('0x30')]);}if(this['actions'][_0x5b5841[_0xb7e4('0xb5')]]&&_0x5b5841[_0xb7e4('0xb5')]!==_0x5b5841[_0xb7e4('0xbc')]){if(_0x5b5841['cause']==='16'&&this[_0xb7e4('0x74')][_0x5b5841[_0xb7e4('0xb5')]][_0xb7e4('0x7a')]){this[_0xb7e4('0xa6')](_0x5b5841,_0x5b5841['linkedid'],_0x5b5841[_0xb7e4('0x151')]);}else if(this['actions'][_0x5b5841[_0xb7e4('0xb5')]][_0xb7e4('0x7a')]){logger['info'](_0xb7e4('0x152'),_0x5b5841[_0xb7e4('0xb5')],_0x5b5841[_0xb7e4('0x151')],_0xb7e4('0xbd'),_0x26c99a[_0xb7e4('0x2c')],_0xb7e4('0x79'),_0x26c99a[_0xb7e4('0x30')]);this['callProgressDetectingCustomer'](_0x5b5841,_0x5b5841[_0xb7e4('0xb5')],_0x5b5841[_0xb7e4('0x151')]);}}else if(_0x5deabe&&_[_0xb7e4('0x73')](_0x5deabe['statedesc'])&&_0x26c99a[_0xb7e4('0x153')]&&_0x5b5841[_0xb7e4('0xb5')]===_0x5b5841[_0xb7e4('0xbc')]&&_['isNil'](_0x5b5841[_0xb7e4('0xfe')])&&_0x5b5841[_0xb7e4('0x151')]==='16'&&_0x5b5841['channelstate']==='6'&&_[_0xb7e4('0xfc')](_0x5deabe[_0xb7e4('0x154')])){if(_0x5deabe[_0xb7e4('0xd0')]){rpcDb[_0xb7e4('0x121')](_0x5deabe[_0xb7e4('0xb8')]);}if(_0x5deabe['activeContact']){rpcDb['disableContact'](_0x5deabe[_0xb7e4('0xb8')]);}_0x5b5841[_0xb7e4('0xfe')]='22';this['callProgressDetectingAgent'](_0x5deabe,_0x26c99a,_0x5b5841);}else if(_0x5deabe&&_0x5deabe[_0xb7e4('0x154')]){if(_0x5b5841[_0xb7e4('0x151')]==='16'&&this[_0xb7e4('0x74')][_0x5b5841[_0xb7e4('0xb5')]][_0xb7e4('0x7a')]){logger[_0xb7e4('0x5f')](_0xb7e4('0x155'),_0x5b5841['linkedid'],_0x5b5841[_0xb7e4('0x151')],'\x20Queue',_0x26c99a[_0xb7e4('0x2c')],_0xb7e4('0x79'),_0x26c99a[_0xb7e4('0x30')]);this[_0xb7e4('0xa6')](_0x5b5841,_0x5b5841[_0xb7e4('0xb5')],_0x5b5841[_0xb7e4('0x151')]);}else if(this[_0xb7e4('0x74')][_0x5b5841['linkedid']]['dialAnswer']){logger[_0xb7e4('0x5f')](_0xb7e4('0x152'),_0x5b5841['linkedid'],_0x5b5841['cause'],_0xb7e4('0xbd'),_0x26c99a[_0xb7e4('0x2c')],'pTalking:\x20',_0x26c99a[_0xb7e4('0x30')]);this[_0xb7e4('0xa6')](_0x5b5841,_0x5b5841[_0xb7e4('0xb5')],_0x5b5841[_0xb7e4('0x151')]);}}};Preview[_0xb7e4('0xf')][_0xb7e4('0x1f')]=function(_0x42cceb){if(this['actions'][_0x42cceb['destlinkedid']]&&_0x42cceb[_0xb7e4('0x156')]!==_0x42cceb['destuniqueid']){this[_0xb7e4('0xa6')](_0x42cceb,_0x42cceb[_0xb7e4('0x156')],_0x42cceb['dialstatus']);}};Preview[_0xb7e4('0xf')][_0xb7e4('0x1d')]=function(_0x45dd3a){if(this['actions'][_0x45dd3a[_0xb7e4('0xb5')]]&&_0x45dd3a[_0xb7e4('0xb5')]!==_0x45dd3a[_0xb7e4('0xbc')]&&!this[_0xb7e4('0x74')][_0x45dd3a[_0xb7e4('0xb5')]][_0xb7e4('0x7a')]){if(_0x45dd3a[_0xb7e4('0x151')]==='1'){this[_0xb7e4('0xa6')](_0x45dd3a,_0x45dd3a[_0xb7e4('0xb5')],_0x45dd3a[_0xb7e4('0x151')]);}}};Preview[_0xb7e4('0xf')]['addVariable']=function(_0x523eb6,_0x50e114,_0x3f9910){if(this['actions'][_0x523eb6]){if(_[_0xb7e4('0x73')](this[_0xb7e4('0x74')][_0x523eb6][_0xb7e4('0x143')])){this['actions'][_0x523eb6]['variables']={};}this['actions'][_0x523eb6][_0xb7e4('0x143')][_0x50e114]=_0x3f9910;}};Preview[_0xb7e4('0xf')][_0xb7e4('0x23')]=function(_0x70ffb0){try{if(!_[_0xb7e4('0x73')](_0x70ffb0)){if(ut['filterKey'](_[_0xb7e4('0x157')](_0x70ffb0[_0xb7e4('0x158')])[0x0])){this[_0xb7e4('0x159')](_0x70ffb0[_0xb7e4('0xbc')],_[_0xb7e4('0x157')](_0x70ffb0[_0xb7e4('0x158')])[0x0],_0x70ffb0[_0xb7e4('0x15a')]);}}}catch(_0x1c8177){logger[_0xb7e4('0x15b')](_0xb7e4('0x15c'),util[_0xb7e4('0x15d')](_0x1c8177,{'showHidden':![],'depth':null}));}};Preview[_0xb7e4('0xf')]['syncAttendedTransfer']=function(_0x2de2b3){if(_0x2de2b3){if(this[_0xb7e4('0x74')][_0x2de2b3[_0xb7e4('0x15e')]]){this['actions'][_0x2de2b3[_0xb7e4('0x15e')]][_0xb7e4('0x154')]=!![];}}};Preview[_0xb7e4('0xf')]['syncBlindTransfer']=function(_0x43fd21){if(_0x43fd21){if(this[_0xb7e4('0x74')][_0x43fd21[_0xb7e4('0x15f')]]){this['actions'][_0x43fd21[_0xb7e4('0x15f')]]['transfer']=!![];}}};module[_0xb7e4('0x160')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 75f5879..14e124f 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 _0xa012=['error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0x26fd7d,_0x456e94){var _0x442827=function(_0xadb5f){while(--_0xadb5f){_0x26fd7d['push'](_0x26fd7d['shift']());}};_0x442827(++_0x456e94);}(_0xa012,0x189));var _0x2a01=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0xa012[_0x2f32c4];return _0x3f3018;};'use strict';var util=require(_0x2a01('0x0'));var BPromise=require('bluebird');var logger=require(_0x2a01('0x1'))('preview');var _=require(_0x2a01('0x2'));var cmHopper=require(_0x2a01('0x3'));var cmHopperFinal=require(_0x2a01('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x2a01('0x5'));var voiceQueueReport=require(_0x2a01('0x6'));function loggerCatch(_0x2c476a){return function(_0x46ee63){logger[_0x2a01('0x7')](_0x2c476a,util[_0x2a01('0x8')](_0x46ee63,{'showHidden':![],'depth':null}));};}function create(_0x7cd6e){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopperHistory[_0x2a01('0xb')](_0x7cd6e))[_0x2a01('0xc')](loggerCatch(_0x2a01('0xd')));}function createAgent(_0x254957){return BPromise[_0x2a01('0x9')]()['then'](agentReportPreview['createHistory'](_0x254957))[_0x2a01('0xc')](loggerCatch(_0x2a01('0xd')));}function moveContact(_0x48a05f){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper['moveContactManagedDialer'](_0x48a05f,!![]))[_0x2a01('0xc')](loggerCatch(_0x2a01('0xe')));}exports[_0x2a01('0xf')]=function(_0x1c6cca){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopperBlack[_0x2a01('0xf')](_0x1c6cca))[_0x2a01('0xc')](loggerCatch(_0x2a01('0x10')));};exports['getContactPreview']=function(_0x21e459){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper['getContactPreview'](_0x21e459))['catch'](loggerCatch(_0x2a01('0x11')));};exports[_0x2a01('0xb')]=function(_0x9aa770,_0x1eac7e){create(_0x9aa770)[_0x2a01('0xc')](loggerCatch(_0x1eac7e));moveContact(_0x9aa770)[_0x2a01('0xc')](loggerCatch(_0x1eac7e));};exports[_0x2a01('0x12')]=function(_0x131c2b,_0xc5e3c2){createAgent(_0x131c2b)[_0x2a01('0xc')](loggerCatch(_0xc5e3c2));};exports[_0x2a01('0x13')]=function(_0x5c7d6c,_0x5ae7a9){create(_0x5c7d6c)[_0x2a01('0xc')](loggerCatch(_0x5ae7a9));};exports[_0x2a01('0x14')]=function(_0x5d8dae,_0x3713a7){moveContact(_0x5d8dae)[_0x2a01('0xc')](loggerCatch(_0x3713a7));};exports[_0x2a01('0x15')]=function(_0x2a288b,_0x1344c4,_0x37aada){if(_0x1344c4){_0x2a288b[_0x2a01('0x16')]=null;}if(_0x37aada){_0x2a288b['active']=![];}return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper[_0x2a01('0x15')](_0x2a288b))[_0x2a01('0xc')](loggerCatch(_0x2a01('0x17')));};exports[_0x2a01('0x18')]=function(_0x495dda){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper[_0x2a01('0x18')](_0x495dda))[_0x2a01('0xc')](loggerCatch(_0x2a01('0x19')));};exports['unlockContact']=function(_0x5a141e){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper['unlockContact']({'UserId':null},_0x5a141e,0x1))['catch'](loggerCatch(_0x2a01('0x1a')));};exports['disableContact']=function(_0x104d59){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper['unlockContact']({'active':![]},_0x104d59,0x1))['catch'](loggerCatch(_0x2a01('0x1b')));};exports[_0x2a01('0x1c')]=function(_0x56525e){var _0xdfa7a2={};_0xdfa7a2[_0x2a01('0x1d')]=_0x56525e[_0x2a01('0x1d')];_0xdfa7a2[_0x2a01('0x1e')]=_0x56525e[_0x2a01('0x1e')];_0xdfa7a2[_0x2a01('0x1f')]=_0x56525e[_0x2a01('0x1f')];_0xdfa7a2[_0x2a01('0x20')]=_0x56525e[_0x2a01('0x20')];_0xdfa7a2['queue']=_0x56525e[_0x2a01('0x21')];_0xdfa7a2['queuecallerjoinAt']=_0x56525e[_0x2a01('0x22')];_0xdfa7a2[_0x2a01('0x23')]=_0x56525e[_0x2a01('0x22')];_0xdfa7a2['queuecallercomplete']=0x1;_0xdfa7a2[_0x2a01('0x24')]=_0x56525e[_0x2a01('0x25')];_0xdfa7a2[_0x2a01('0x26')]=_0x56525e[_0x2a01('0x27')];_0xdfa7a2['context']=_0x2a01('0x28');_0xdfa7a2['exten']=_0x2a01('0x29');_0xdfa7a2['holdtime']=0x0;_0xdfa7a2[_0x2a01('0x2a')]=0x1;_0xdfa7a2[_0x2a01('0x2b')]=_0x56525e['membername'];_0xdfa7a2[_0x2a01('0x2c')]=_0x2a01('0x2d');return BPromise['resolve']()['then'](voiceQueueReport['create'](_0xdfa7a2))['catch'](loggerCatch(_0x2a01('0x2e')));};exports[_0x2a01('0x2f')]=function(_0x40cb0f,_0x48b28e){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper[_0x2a01('0x2f')](_0x40cb0f,_0x48b28e))[_0x2a01('0xc')](loggerCatch(_0x2a01('0x30')));};exports[_0x2a01('0x31')]=function(_0xa74de){return BPromise[_0x2a01('0x9')]()[_0x2a01('0xa')](cmHopper[_0x2a01('0x15')](_0xa74de,!![],!![]))[_0x2a01('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xe702=['[createHistory]\x20','createHistory','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch'];(function(_0x45c971,_0x3a57ed){var _0x4f5a29=function(_0x485363){while(--_0x485363){_0x45c971['push'](_0x45c971['shift']());}};_0x4f5a29(++_0x3a57ed);}(_0xe702,0x191));var _0x2e70=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xe702[_0x4709c0];return _0x13348b;};'use strict';var util=require(_0x2e70('0x0'));var BPromise=require(_0x2e70('0x1'));var logger=require(_0x2e70('0x2'))(_0x2e70('0x3'));var _=require('lodash');var cmHopper=require(_0x2e70('0x4'));var cmHopperFinal=require(_0x2e70('0x5'));var cmHopperHistory=require(_0x2e70('0x6'));var cmHopperBlack=require(_0x2e70('0x7'));var voiceQueueRt=require(_0x2e70('0x8'));var agentReportPreview=require(_0x2e70('0x9'));var voiceQueueReport=require(_0x2e70('0xa'));function loggerCatch(_0x4cfcf){return function(_0x2a1ede){logger[_0x2e70('0xb')](_0x4cfcf,util['inspect'](_0x2a1ede,{'showHidden':![],'depth':null}));};}function create(_0x2fe1b1){return BPromise[_0x2e70('0xc')]()[_0x2e70('0xd')](cmHopperHistory['createHistory'](_0x2fe1b1))[_0x2e70('0xe')](loggerCatch(_0x2e70('0xf')));}function createAgent(_0x944b09){return BPromise[_0x2e70('0xc')]()['then'](agentReportPreview[_0x2e70('0x10')](_0x944b09))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4b275b){return BPromise[_0x2e70('0xc')]()[_0x2e70('0xd')](cmHopper['moveContactManagedDialer'](_0x4b275b,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x2e70('0x11')]=function(_0x56da71){return BPromise[_0x2e70('0xc')]()['then'](cmHopperBlack[_0x2e70('0x11')](_0x56da71))[_0x2e70('0xe')](loggerCatch(_0x2e70('0x12')));};exports[_0x2e70('0x13')]=function(_0x45203b){return BPromise[_0x2e70('0xc')]()[_0x2e70('0xd')](cmHopper[_0x2e70('0x13')](_0x45203b))[_0x2e70('0xe')](loggerCatch('[getContactPreview]\x20'));};exports[_0x2e70('0x10')]=function(_0x349470,_0x26736f){create(_0x349470)[_0x2e70('0xe')](loggerCatch(_0x26736f));moveContact(_0x349470)[_0x2e70('0xe')](loggerCatch(_0x26736f));};exports[_0x2e70('0x14')]=function(_0x5c7c72,_0x337862){createAgent(_0x5c7c72)[_0x2e70('0xe')](loggerCatch(_0x337862));};exports[_0x2e70('0x15')]=function(_0xa3420e,_0x27bb43){create(_0xa3420e)[_0x2e70('0xe')](loggerCatch(_0x27bb43));};exports[_0x2e70('0x16')]=function(_0x2ce4bb,_0x4b3cf0){moveContact(_0x2ce4bb)[_0x2e70('0xe')](loggerCatch(_0x4b3cf0));};exports['rescheduleContact']=function(_0x51ff4b,_0x3ba145,_0x1cf4f0){if(_0x3ba145){_0x51ff4b[_0x2e70('0x17')]=null;}if(_0x1cf4f0){_0x51ff4b['active']=![];}return BPromise[_0x2e70('0xc')]()['then'](cmHopper[_0x2e70('0x18')](_0x51ff4b))[_0x2e70('0xe')](loggerCatch(_0x2e70('0x19')));};exports['countReScheduled']=function(_0x511b7f){return BPromise['resolve']()['then'](cmHopper[_0x2e70('0x1a')](_0x511b7f))[_0x2e70('0xe')](loggerCatch(_0x2e70('0x1b')));};exports[_0x2e70('0x1c')]=function(_0x350740){return BPromise[_0x2e70('0xc')]()[_0x2e70('0xd')](cmHopper[_0x2e70('0x1c')]({'UserId':null},_0x350740,0x1))[_0x2e70('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x2e70('0x1d')]=function(_0x35a864){return BPromise[_0x2e70('0xc')]()[_0x2e70('0xd')](cmHopper[_0x2e70('0x1c')]({'active':![]},_0x35a864,0x1))[_0x2e70('0xe')](loggerCatch(_0x2e70('0x1e')));};exports[_0x2e70('0x1f')]=function(_0x53a6e1){var _0x2511cc={};_0x2511cc['type']=_0x53a6e1['type'];_0x2511cc[_0x2e70('0x20')]=_0x53a6e1['uniqueid'];_0x2511cc[_0x2e70('0x21')]=_0x53a6e1[_0x2e70('0x21')];_0x2511cc[_0x2e70('0x22')]=_0x53a6e1[_0x2e70('0x22')];_0x2511cc[_0x2e70('0x23')]=_0x53a6e1[_0x2e70('0x23')];_0x2511cc[_0x2e70('0x24')]=_0x53a6e1[_0x2e70('0x25')];_0x2511cc[_0x2e70('0x26')]=_0x53a6e1[_0x2e70('0x25')];_0x2511cc[_0x2e70('0x27')]=0x1;_0x2511cc[_0x2e70('0x28')]=_0x53a6e1['endtime'];_0x2511cc[_0x2e70('0x29')]=_0x53a6e1[_0x2e70('0x2a')];_0x2511cc[_0x2e70('0x2b')]='from-sip';_0x2511cc['exten']=_0x2e70('0x2c');_0x2511cc[_0x2e70('0x2d')]=0x0;_0x2511cc['assigned']=0x1;_0x2511cc[_0x2e70('0x2e')]=_0x53a6e1[_0x2e70('0x2a')];_0x2511cc[_0x2e70('0x2f')]=_0x2e70('0x30');return BPromise[_0x2e70('0xc')]()[_0x2e70('0xd')](voiceQueueReport[_0x2e70('0x31')](_0x2511cc))[_0x2e70('0xe')](loggerCatch(_0x2e70('0x32')));};exports['getContactRecallMe']=function(_0x11b666,_0x1e6dd6){return BPromise['resolve']()[_0x2e70('0xd')](cmHopper['getContactRecallMe'](_0x11b666,_0x1e6dd6))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x918600){return BPromise[_0x2e70('0xc')]()[_0x2e70('0xd')](cmHopper[_0x2e70('0x18')](_0x918600,!![],!![]))['catch'](loggerCatch(_0x2e70('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 42ac758..6dcad4c 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 _0xee3c=['RECALL','BOOKED','uniqueid','channelAgent','calleridnum','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','inspect','logger','error','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xee3c,0x176));var _0xcee3=function(_0x9d57d2,_0x4dffca){_0x9d57d2=_0x9d57d2-0x0;var _0x4710b3=_0xee3c[_0x9d57d2];return _0x4710b3;};'use strict';var util=require(_0xcee3('0x0'));var _=require('lodash');var moment=require(_0xcee3('0x1'));var logger=require(_0xcee3('0x2'))(_0xcee3('0x3'));var ipAgi=process[_0xcee3('0x4')]['XCALLY_IP_AGI']||_0xcee3('0x5');function getSeconds(_0x1823eb,_0x447c8d){var _0x3ac7dc=moment(_0x1823eb)[_0xcee3('0x6')](0x0);var _0xf508b=moment(_0x447c8d)[_0xcee3('0x6')](0x0);return _0x3ac7dc[_0xcee3('0x7')](_0xf508b,'seconds');}exports['loggerCatch']=function(_0x3c5e06){return function(_0x50f19c){logger['error'](_0x3c5e06,util[_0xcee3('0x8')](_0x50f19c,{'showHidden':![],'depth':null}));};};exports[_0xcee3('0x9')]=function(_0x23b91f,_0x35e431){logger['info'](_0x23b91f,util[_0xcee3('0x8')](_0x35e431,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x6203d,_0x249fa1){logger[_0xcee3('0xa')](_0x6203d,util['inspect'](_0x249fa1,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x41c74d){return function(_0x149433){logger['info'](_0x41c74d,util[_0xcee3('0x8')](_0x149433,{'showHidden':![],'depth':null}));};};exports[_0xcee3('0xb')]=function(_0x7bd5ce,_0x544f15,_0x29acf8){return{'message':_0x7bd5ce,'unlock':_0x544f15,'active':_0x29acf8};};exports[_0xcee3('0xc')]=function(_0x5d90bc,_0x3feb06,_0x58a3e4){if(!_[_0xcee3('0xd')](_0x58a3e4)&&'string'===typeof _0x58a3e4&&!_[_0xcee3('0xe')](_0x58a3e4)){if(!_['isUndefined'](_0x3feb06)&&'string'===typeof _0x3feb06&&!_['isEmpty'](_0x3feb06)){return util[_0xcee3('0xf')](_0xcee3('0x10'),_0x3feb06,_0x58a3e4);}return util[_0xcee3('0xf')](_0xcee3('0x10'),_0x58a3e4,_0x58a3e4);}if(!_[_0xcee3('0xd')](_0x5d90bc)&&_0xcee3('0x11')===typeof _0x5d90bc&&!_[_0xcee3('0xe')](_0x5d90bc)){return _0x5d90bc;}return _0xcee3('0x12');};exports[_0xcee3('0x13')]=function(_0x3cbf1b){if(_[_0xcee3('0x14')](_0x3cbf1b)){return![];}return _0x3cbf1b;};exports[_0xcee3('0x15')]=function(_0x16a8a8,_0x3e7804,_0x45563f,_0x22950a,_0x36003b,_0x3a83a3){var _0x35f61b={'XMD-QUEUE':_0x3e7804[_0xcee3('0x16')]?_0x3e7804[_0xcee3('0x16')][_0xcee3('0x17')]:'','XMD-CALLERID':_0x22950a,'XMD-CALLERID-PREVIEW':_0x3a83a3?util[_0xcee3('0xf')](_0xcee3('0x10'),_0x3a83a3[_0xcee3('0x18')],_0x3a83a3['calleridnum']):_0x22950a,'XMD-DIALID':_0x36003b,'XMD-CONTACTID':_0x3e7804[_0xcee3('0x19')],'XMD-CDRTYPE':_0xcee3('0x1a'),'CALLERID(all)':_0x22950a,'XMD-VOICEQUEUEID':_0x3e7804[_0xcee3('0x1b')],'XMD-DIALCHANNEL':_0x45563f,'XMD-DIALTIMEOUT':_0x16a8a8[_0xcee3('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xcee3('0xf')](_0xcee3('0x1d'),_0x16a8a8[_0xcee3('0x1e')]?'g':'',_['isEmpty'](_0x16a8a8['monitor_format'])?'':_0xcee3('0x1f')),'XMD-DIALURL':_0x16a8a8['dialPreviewUrl']||'','XMD-AGI':_0x16a8a8['dialQueueProject']?util[_0xcee3('0xf')](_0xcee3('0x20'),ipAgi,_0x16a8a8['dialQueueProject']):_0xcee3('0x21'),'XMD-AGIAFTER':_0x16a8a8[_0xcee3('0x1e')]?util[_0xcee3('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x16a8a8['dialQueueProject2']):_0xcee3('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x3a83a3?_0x3a83a3[_0xcee3('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x3a83a3?_0x3a83a3[_0xcee3('0x23')]:'','XMD-DESTINATION':_0xcee3('0x24'),'SIPADDHEADER':_0xcee3('0x25')};if(!_['isEmpty'](_0x16a8a8[_0xcee3('0x26')])){_0x35f61b[util[_0xcee3('0xf')]('%s',_0xcee3('0x27'))]=_0x16a8a8['monitor_format'];_0x35f61b[util['format']('%s',_0xcee3('0x28'))]=_0x36003b;}if(_0x3e7804&&_0x3e7804[_0xcee3('0x29')]){for(var _0x29d324 in _0x3e7804[_0xcee3('0x29')]){if(_0x3e7804['Contact'][_0xcee3('0x2a')](_0x29d324)){if(!_[_0xcee3('0x14')](_0x3e7804[_0xcee3('0x29')][_0x29d324])&&_0x29d324!=='id'&&_0x29d324!==_0xcee3('0x2b')&&_0x29d324!=='createdAt'&&_0x29d324!==_0xcee3('0x2c')){_0x35f61b[util[_0xcee3('0xf')](_0xcee3('0x2d'),'XMD-',_[_0xcee3('0x2e')](_0x29d324))]=_0x3e7804[_0xcee3('0x29')][_0x29d324];}}}}return _0x35f61b;};exports[_0xcee3('0x2f')]=function(_0xfc403b){var _0x312af1={};for(var _0x27fa79 in _0xfc403b){if(_0xfc403b[_0xcee3('0x2a')](_0x27fa79)){_0x312af1[util[_0xcee3('0xf')]('%s',_[_0xcee3('0x30')](_0x27fa79))]=_0xfc403b[_0x27fa79];}}return{'variables':_0x312af1};};exports[_0xcee3('0x31')]=function(_0x54cfa6,_0x29bc4f){if(!_[_0xcee3('0x14')](_0x54cfa6)){if(_0x54cfa6['hasOwnProperty'](_0xcee3('0x32'))){if(_0x54cfa6['originated']>0x0){_0x54cfa6['originated']-=0x1;}else{logger[_0xcee3('0xa')](_0xcee3('0x33'),_0x29bc4f);}}}else{logger['error'](_0xcee3('0x34'),_0x29bc4f);}};exports[_0xcee3('0x35')]=function(_0x54a3e4){var _0x3908bb=moment()[_0xcee3('0xf')](_0xcee3('0x36'));_0x54a3e4[_0xcee3('0x37')]=0xd;_0x54a3e4[_0xcee3('0x38')]=_0xcee3('0x39');_0x54a3e4[_0xcee3('0x3a')]=_0x3908bb;_0x54a3e4[_0xcee3('0x3b')]=_0x3908bb;_0x54a3e4[_0xcee3('0x3c')]=_0x3908bb;};exports[_0xcee3('0x3d')]=function(_0xd5c65d,_0x3fb5d1,_0x3b247e){var _0x30e1ce=moment()['format'](_0xcee3('0x36'));_0xd5c65d[_0xcee3('0x37')]=_0x3fb5d1;_0xd5c65d[_0xcee3('0x38')]=_0x3b247e;_0xd5c65d[_0xcee3('0x3b')]=_0x30e1ce;_0xd5c65d[_0xcee3('0x3e')]=getSeconds(_0xd5c65d['responsetime'],_0xd5c65d['starttime']);};exports[_0xcee3('0x3f')]=function(_0x224072,_0x438aa8,_0x3009e9){_0x224072[_0xcee3('0x40')]=_0x438aa8;_0x224072[_0xcee3('0x41')]=_0x3009e9;};exports[_0xcee3('0x42')]=function(_0x402f6d,_0x23d8ac,_0x277059){var _0x2d1356=moment()[_0xcee3('0xf')](_0xcee3('0x36'));_0x402f6d[_0xcee3('0x37')]=_0x23d8ac;_0x402f6d[_0xcee3('0x38')]=_0x277059;_0x402f6d[_0xcee3('0x3b')]=_0x402f6d['responsetime']?_0x402f6d[_0xcee3('0x3b')]:_0x2d1356;_0x402f6d['endtime']=_0x402f6d['endtime']?_0x402f6d[_0xcee3('0x3c')]:_0x2d1356;_0x402f6d[_0xcee3('0x3e')]=getSeconds(_0x402f6d[_0xcee3('0x3b')]||0x0,_0x402f6d[_0xcee3('0x3a')]||0x0);_0x402f6d[_0xcee3('0x43')]=_0x402f6d[_0xcee3('0x44')]?getSeconds(_0x402f6d[_0xcee3('0x3c')],_0x402f6d[_0xcee3('0x44')]):0x0;};exports[_0xcee3('0x45')]=function(_0x3a30a1){return _0x3a30a1==='Failure';};exports['variablesAction']=function(_0x39163a,_0x102f90,_0xfa4ad2,_0x3abe1b,_0x508819){var _0x3a902c=_0x3abe1b?_0xcee3('0x46'):_0x39163a[_0xcee3('0x18')];_0x3a902c=_0x508819?_0xcee3('0x47'):_0x3a902c;return{'actionid':_0x39163a[_0xcee3('0x48')],'action':'originate','channel':_0x39163a[_0xcee3('0x49')],'callerid':util[_0xcee3('0xf')](_0xcee3('0x10'),_0x3a902c,_0x39163a[_0xcee3('0x4a')]),'Exten':'xcally-motion-preview','Context':_0xcee3('0x4b'),'Priority':'1','variable':_0xfa4ad2,'timeout':(_0x102f90[_0xcee3('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x39163a[_0xcee3('0x48')]};};exports['totalGlobal']=function(_0x2b6bf2){return _0x2b6bf2[_0xcee3('0x4d')]+_0x2b6bf2[_0xcee3('0x4e')]+_0x2b6bf2[_0xcee3('0x4f')]+_0x2b6bf2[_0xcee3('0x50')]+_0x2b6bf2['countnosuchnumberretry'];};exports[_0xcee3('0x51')]=function(_0x589150){var _0xd2575b=_[_0xcee3('0x52')](_0x589150);_0xd2575b[_0xcee3('0x37')]=0xf;_0xd2575b[_0xcee3('0x38')]=_0xcee3('0x53');return _0xd2575b;};exports[_0xcee3('0x54')]=function(_0x238899,_0x5caa5f,_0x389049){var _0x29525c={};_0x29525c[_0x5caa5f]=_0x238899[_0x5caa5f];_0x29525c[_0xcee3('0x55')]=![];_0x29525c[_0xcee3('0x56')]=moment()[_0xcee3('0x57')](_0x389049,'minutes')[_0xcee3('0xf')](_0xcee3('0x36'));_0x29525c[_0xcee3('0x19')]=_0x238899[_0xcee3('0x19')];_0x29525c[_0xcee3('0x58')]=_0x238899[_0xcee3('0x58')];_0x29525c[_0xcee3('0x1b')]=_0x238899['VoiceQueueId']||undefined;return _0x29525c;};exports[_0xcee3('0x59')]=function(_0x2bd2dd,_0x68fdf3){if(!_[_0xcee3('0x14')](_0x2bd2dd)){if(_0x2bd2dd[_0xcee3('0x5a')]>0x0){_0x2bd2dd[_0xcee3('0x5a')]-=0x1;}else{logger[_0xcee3('0xa')](_0x68fdf3,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x68fdf3,_0xcee3('0x5b'));}};exports[_0xcee3('0x5c')]=function(_0x1f711c){if(_0x1f711c<=0x0){return!![];}return![];};function buildObj(_0x23867e,_0x4fda64,_0x524677){_0x23867e[_0xcee3('0x5d')]=_0x4fda64;_0x23867e[_0xcee3('0x17')]=_0x23867e[_0xcee3('0x5e')];_0x23867e[_0xcee3('0x5f')]=_0x23867e[_0xcee3('0x49')];_0x23867e['motionChannel']=_0xcee3('0x60');if(_0x524677){_0x23867e[_0xcee3('0x61')]=_0x524677[_0xcee3('0x61')];}return _0x23867e;}exports['buildObj']=buildObj;exports[_0xcee3('0x62')]=function(_0xdaf00a){var _0x15b465={};_0x15b465[_0xcee3('0x5e')]=_0xdaf00a[_0xcee3('0x5e')];_0x15b465[_0xcee3('0x5f')]=_0xdaf00a['channelAgent'];_0x15b465[_0xcee3('0x48')]=_0xdaf00a[_0xcee3('0x48')];return _0x15b465;};exports[_0xcee3('0x63')]=function(_0x3b6e4b){var _0x544683=[];for(var _0xa8f06e in _0x3b6e4b){if(_0x3b6e4b[_0xcee3('0x2a')](_0xa8f06e)){if(!_[_0xcee3('0x14')](_0x3b6e4b[_0xa8f06e])&&_0x3b6e4b[_0xa8f06e]['state']===_0xcee3('0x64')&&_0x3b6e4b[_0xa8f06e][_0xcee3('0x65')]===_0xcee3('0x66')){_0x544683[_0xcee3('0x67')](_0x3b6e4b[_0xa8f06e]['id']);}}}return _0x544683;};exports[_0xcee3('0x68')]=function(_0x3f177a){var _0x1584fe=moment()[_0xcee3('0x6')](0x0);var _0x355e23=moment(_0x3f177a)['milliseconds'](0x0);return _0x1584fe[_0xcee3('0x7')](_0x355e23,'seconds');};exports[_0xcee3('0x69')]=function(_0x569a2c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x569a2c[_0xcee3('0x19')],'ListId':_0x569a2c[_0xcee3('0x58')],'VoiceQueueId':_0x569a2c[_0xcee3('0x1b')]||undefined,'CampaignId':_0x569a2c[_0xcee3('0x6a')]||undefined};};exports[_0xcee3('0x6b')]=function(_0x3b4a96){if(_0x3b4a96===_0xcee3('0x48')||_0x3b4a96===_0xcee3('0x6c')||_0x3b4a96==='queue'||_0x3b4a96===_0xcee3('0x6d')||_0x3b4a96===_0xcee3('0x6e')||_0x3b4a96===_0xcee3('0x6f')||_0x3b4a96===_0xcee3('0x40')||_0x3b4a96==='channelAgent'||_0x3b4a96===_0xcee3('0x18')||_0x3b4a96===_0xcee3('0x55')||_0x3b4a96===_0xcee3('0x4a')||_0x3b4a96===_0xcee3('0x56')||_0x3b4a96===_0xcee3('0x4d')||_0x3b4a96===_0xcee3('0x4e')||_0x3b4a96==='countnoanswerretry'||_0x3b4a96===_0xcee3('0x70')||_0x3b4a96===_0xcee3('0x71')||_0x3b4a96===_0xcee3('0x72')||_0x3b4a96===_0xcee3('0x73')||_0x3b4a96===_0xcee3('0x74')||_0x3b4a96==='ContactId'||_0x3b4a96==='ListId'||_0x3b4a96===_0xcee3('0x41')||_0x3b4a96===_0xcee3('0x1b')||_0x3b4a96==='sipcallid'||_0x3b4a96===_0xcee3('0x75')||_0x3b4a96===_0xcee3('0x76')||_0x3b4a96===_0xcee3('0x77')||_0x3b4a96===_0xcee3('0x78')||_0x3b4a96===_0xcee3('0x79')||_0x3b4a96===_0xcee3('0x7a')||_0x3b4a96==='xmd-dialoptions'||_0x3b4a96==='xmd-dialid'||_0x3b4a96===_0xcee3('0x7b')||_0x3b4a96===_0xcee3('0x7c')||_0x3b4a96==='xmd-cdrtype'||_0x3b4a96===_0xcee3('0x7d')||_0x3b4a96===_0xcee3('0x7e')||_0x3b4a96===_0xcee3('0x7f')||_0x3b4a96==='rtpaudioqos'||_0x3b4a96===_0xcee3('0x80')||_0x3b4a96==='rtpaudioqosjitter'||_0x3b4a96===_0xcee3('0x81')||_0x3b4a96===_0xcee3('0x82')||_0x3b4a96===_0xcee3('0x83')||_0x3b4a96===_0xcee3('0x84')||_0x3b4a96===_0xcee3('0x85')||_0x3b4a96===_0xcee3('0x86')||_0x3b4a96===_0xcee3('0x80')||_0x3b4a96===_0xcee3('0x87')||_0x3b4a96===_0xcee3('0x81')||_0x3b4a96===_0xcee3('0x82')||_0x3b4a96==='rtpaudioqoslossbridged'||_0x3b4a96==='rtpaudioqosrtt'||_0x3b4a96===_0xcee3('0x85')||_0x3b4a96===_0xcee3('0x88')||_0x3b4a96==='bridgepvtcallid'||_0x3b4a96==='state'||_0x3b4a96===_0xcee3('0x38')){return![];}return!![];};exports[_0xcee3('0x89')]=function(_0x2c6eb1,_0x4bcb80){var _0x3b80ff,_0x37d05d,_0x5ea4f8;if(_0x4bcb80<=0x0){_0x4bcb80=0x1;}_0x3b80ff=new RegExp(_0xcee3('0x8a')+_0x4bcb80+'}$');_0x37d05d=Math['pow'](0xa,_0x4bcb80-0x1);_0x5ea4f8=Math[_0xcee3('0x8b')](0xa,_0x4bcb80)-0x1;return util[_0xcee3('0xf')]('%s',_[_0xcee3('0x8c')](_0x2c6eb1,_0x3b80ff,_[_0xcee3('0x8d')](_0x37d05d,_0x5ea4f8)));};exports['extractCalleridName']=function(_0x1c2216){var _0x6be67f=_0x1c2216[_0xcee3('0x8e')](/"(.*?)"/);return _0x6be67f?_0x6be67f[0x1]:_0x1c2216;};exports['extractCalleridNumber']=function(_0x259cc9){var _0x1cce6b=_0x259cc9[_0xcee3('0x8e')](/<(.*?)>/);return _0x1cce6b?_0x1cce6b[0x1]:_0x259cc9;};function buildNoAnswerEventPayload(_0x339c2c,_0x349af5){var _0x485189=buildObj(_0x339c2c,_0xcee3('0x8f'));if(!_['isEmpty'](_0x349af5[_0xcee3('0x90')])){Object[_0xcee3('0x91')](_0x349af5[_0xcee3('0x90')])[_0xcee3('0x92')](function(_0x5aea2c){_0x485189[_0x5aea2c['toLowerCase']()]=_0x349af5[_0xcee3('0x90')][_0x5aea2c];});}return _0x485189;}exports[_0xcee3('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xdf27=['addVariables','Queue','calleridname','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','%s%s','toUpper','toLowerVariables','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','logLookAgent','membername','UserId','logCustomer','ringtime','answertime','isFailure','Failure','variablesAction','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','ContactId','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','name','queue','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','getDiff','filterKey','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','preview','milliseconds','diff','seconds','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive'];(function(_0x281eae,_0x518de9){var _0x2640da=function(_0x430fa4){while(--_0x430fa4){_0x281eae['push'](_0x281eae['shift']());}};_0x2640da(++_0x518de9);}(_0xdf27,0x104));var _0x7df2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdf27[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x7df2('0x0'));var _=require(_0x7df2('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x7df2('0x2'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x15c07b,_0x2d5376){var _0x2178f1=moment(_0x15c07b)[_0x7df2('0x3')](0x0);var _0x1ae69d=moment(_0x2d5376)[_0x7df2('0x3')](0x0);return _0x2178f1[_0x7df2('0x4')](_0x1ae69d,_0x7df2('0x5'));}exports['loggerCatch']=function(_0x5856e1){return function(_0x28eccd){logger['error'](_0x5856e1,util['inspect'](_0x28eccd,{'showHidden':![],'depth':null}));};};exports[_0x7df2('0x6')]=function(_0x3eac44,_0x51815b){logger[_0x7df2('0x7')](_0x3eac44,util[_0x7df2('0x8')](_0x51815b,{'showHidden':![],'depth':null}));};exports[_0x7df2('0x9')]=function(_0x523a40,_0x4931d3){logger['error'](_0x523a40,util[_0x7df2('0x8')](_0x4931d3,{'showHidden':![],'depth':null}));};exports[_0x7df2('0xa')]=function(_0x5410a6){return function(_0x5bfabe){logger[_0x7df2('0x7')](_0x5410a6,util[_0x7df2('0x8')](_0x5bfabe,{'showHidden':![],'depth':null}));};};exports[_0x7df2('0xb')]=function(_0x4c595a,_0x5e704d,_0x1f8669){return{'message':_0x4c595a,'unlock':_0x5e704d,'active':_0x1f8669};};exports[_0x7df2('0xc')]=function(_0x44f314,_0x358ae2,_0x2e7919){if(!_[_0x7df2('0xd')](_0x2e7919)&&_0x7df2('0xe')===typeof _0x2e7919&&!_[_0x7df2('0xf')](_0x2e7919)){if(!_[_0x7df2('0xd')](_0x358ae2)&&_0x7df2('0xe')===typeof _0x358ae2&&!_[_0x7df2('0xf')](_0x358ae2)){return util['format'](_0x7df2('0x10'),_0x358ae2,_0x2e7919);}return util[_0x7df2('0x11')](_0x7df2('0x10'),_0x2e7919,_0x2e7919);}if(!_[_0x7df2('0xd')](_0x44f314)&&'string'===typeof _0x44f314&&!_[_0x7df2('0xf')](_0x44f314)){return _0x44f314;}return _0x7df2('0x12');};exports[_0x7df2('0x13')]=function(_0x314e22){if(_['isNil'](_0x314e22)){return![];}return _0x314e22;};exports[_0x7df2('0x14')]=function(_0x3e6ec1,_0x5d85e6,_0x5080a0,_0x487042,_0x4eb0b0,_0x2b0890){var _0xf50c6e={'XMD-QUEUE':_0x5d85e6[_0x7df2('0x15')]?_0x5d85e6[_0x7df2('0x15')]['name']:'','XMD-CALLERID':_0x487042,'XMD-CALLERID-PREVIEW':_0x2b0890?util[_0x7df2('0x11')]('\x22%s\x22\x20<%s>',_0x2b0890[_0x7df2('0x16')],_0x2b0890[_0x7df2('0x17')]):_0x487042,'XMD-DIALID':_0x4eb0b0,'XMD-CONTACTID':_0x5d85e6['ContactId'],'XMD-CDRTYPE':_0x7df2('0x18'),'CALLERID(all)':_0x487042,'XMD-VOICEQUEUEID':_0x5d85e6['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5080a0,'XMD-DIALTIMEOUT':_0x3e6ec1[_0x7df2('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x7df2('0x11')](_0x7df2('0x1a'),_0x3e6ec1[_0x7df2('0x1b')]?'g':'',_['isEmpty'](_0x3e6ec1[_0x7df2('0x1c')])?'':_0x7df2('0x1d')),'XMD-DIALURL':_0x3e6ec1[_0x7df2('0x1e')]||'','XMD-AGI':_0x3e6ec1[_0x7df2('0x1f')]?util[_0x7df2('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3e6ec1['dialQueueProject']):_0x7df2('0x20'),'XMD-AGIAFTER':_0x3e6ec1['dialQueueProject2']?util['format'](_0x7df2('0x21'),ipAgi,_0x3e6ec1['dialQueueProject2']):_0x7df2('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x2b0890?_0x2b0890[_0x7df2('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2b0890?_0x2b0890[_0x7df2('0x23')]:'','XMD-DESTINATION':_0x7df2('0x24'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x7df2('0xf')](_0x3e6ec1[_0x7df2('0x1c')])){_0xf50c6e[util[_0x7df2('0x11')]('%s',_0x7df2('0x25'))]=_0x3e6ec1[_0x7df2('0x1c')];_0xf50c6e[util[_0x7df2('0x11')]('%s',_0x7df2('0x26'))]=_0x4eb0b0;}if(_0x5d85e6&&_0x5d85e6[_0x7df2('0x27')]){for(var _0x2323b1 in _0x5d85e6[_0x7df2('0x27')]){if(_0x5d85e6[_0x7df2('0x27')][_0x7df2('0x28')](_0x2323b1)){if(!_[_0x7df2('0x29')](_0x5d85e6[_0x7df2('0x27')][_0x2323b1])&&_0x2323b1!=='id'&&_0x2323b1!==_0x7df2('0x2a')&&_0x2323b1!=='createdAt'&&_0x2323b1!=='updatedAt'){_0xf50c6e[util['format'](_0x7df2('0x2b'),'XMD-',_[_0x7df2('0x2c')](_0x2323b1))]=_0x5d85e6[_0x7df2('0x27')][_0x2323b1];}}}}return _0xf50c6e;};exports[_0x7df2('0x2d')]=function(_0xf0cdd2){var _0x34cf0f={};for(var _0x3fb06e in _0xf0cdd2){if(_0xf0cdd2[_0x7df2('0x28')](_0x3fb06e)){_0x34cf0f[util[_0x7df2('0x11')]('%s',_['toLower'](_0x3fb06e))]=_0xf0cdd2[_0x3fb06e];}}return{'variables':_0x34cf0f};};exports[_0x7df2('0x2e')]=function(_0x2660b8,_0x22ffd2){if(!_[_0x7df2('0x29')](_0x2660b8)){if(_0x2660b8['hasOwnProperty'](_0x7df2('0x2f'))){if(_0x2660b8[_0x7df2('0x2f')]>0x0){_0x2660b8['originated']-=0x1;}else{logger[_0x7df2('0x30')](_0x7df2('0x31'),_0x22ffd2);}}}else{logger[_0x7df2('0x30')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x22ffd2);}};exports[_0x7df2('0x32')]=function(_0xe5147c){var _0x20951a=moment()[_0x7df2('0x11')](_0x7df2('0x33'));_0xe5147c[_0x7df2('0x34')]=0xd;_0xe5147c[_0x7df2('0x35')]=_0x7df2('0x36');_0xe5147c[_0x7df2('0x37')]=_0x20951a;_0xe5147c[_0x7df2('0x38')]=_0x20951a;_0xe5147c[_0x7df2('0x39')]=_0x20951a;};exports[_0x7df2('0x3a')]=function(_0x2c9f73,_0x11de79,_0x3ba6d5){var _0x3acd8b=moment()[_0x7df2('0x11')](_0x7df2('0x33'));_0x2c9f73[_0x7df2('0x34')]=_0x11de79;_0x2c9f73[_0x7df2('0x35')]=_0x3ba6d5;_0x2c9f73['responsetime']=_0x3acd8b;_0x2c9f73['ringtime']=getSeconds(_0x2c9f73['responsetime'],_0x2c9f73['starttime']);};exports[_0x7df2('0x3b')]=function(_0x209833,_0x5ba7fe,_0x25c91b){_0x209833[_0x7df2('0x3c')]=_0x5ba7fe;_0x209833[_0x7df2('0x3d')]=_0x25c91b;};exports[_0x7df2('0x3e')]=function(_0x440615,_0xbb1b9c,_0x349233){var _0x338863=moment()[_0x7df2('0x11')](_0x7df2('0x33'));_0x440615['state']=_0xbb1b9c;_0x440615[_0x7df2('0x35')]=_0x349233;_0x440615[_0x7df2('0x38')]=_0x440615[_0x7df2('0x38')]?_0x440615[_0x7df2('0x38')]:_0x338863;_0x440615['endtime']=_0x440615['endtime']?_0x440615[_0x7df2('0x39')]:_0x338863;_0x440615[_0x7df2('0x3f')]=getSeconds(_0x440615[_0x7df2('0x38')]||0x0,_0x440615[_0x7df2('0x37')]||0x0);_0x440615['talktime']=_0x440615[_0x7df2('0x40')]?getSeconds(_0x440615[_0x7df2('0x39')],_0x440615[_0x7df2('0x40')]):0x0;};exports[_0x7df2('0x41')]=function(_0x1de9aa){return _0x1de9aa===_0x7df2('0x42');};exports[_0x7df2('0x43')]=function(_0x55ce53,_0x5caa33,_0x67c06f,_0x3c18c1,_0x36fd11){var _0x4b82f3=_0x3c18c1?'RECALL':_0x55ce53[_0x7df2('0x16')];_0x4b82f3=_0x36fd11?'BOOKED':_0x4b82f3;return{'actionid':_0x55ce53[_0x7df2('0x44')],'action':_0x7df2('0x45'),'channel':_0x55ce53['channelAgent'],'callerid':util[_0x7df2('0x11')](_0x7df2('0x10'),_0x4b82f3,_0x55ce53[_0x7df2('0x17')]),'Exten':_0x7df2('0x24'),'Context':_0x7df2('0x46'),'Priority':'1','variable':_0x67c06f,'timeout':(_0x5caa33['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x55ce53[_0x7df2('0x44')]};};exports[_0x7df2('0x47')]=function(_0x12a6de){return _0x12a6de[_0x7df2('0x48')]+_0x12a6de[_0x7df2('0x49')]+_0x12a6de['countnoanswerretry']+_0x12a6de[_0x7df2('0x4a')]+_0x12a6de['countnosuchnumberretry'];};exports[_0x7df2('0x4b')]=function(_0x3cae32){var _0x516895=_[_0x7df2('0x4c')](_0x3cae32);_0x516895['state']=0xf;_0x516895[_0x7df2('0x35')]=_0x7df2('0x4d');return _0x516895;};exports[_0x7df2('0x4e')]=function(_0x132c74,_0x27e600,_0x4c6f4d){var _0x8d3004={};_0x8d3004[_0x27e600]=_0x132c74[_0x27e600];_0x8d3004[_0x7df2('0x4f')]=![];_0x8d3004[_0x7df2('0x50')]=moment()['add'](_0x4c6f4d,'minutes')[_0x7df2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x8d3004[_0x7df2('0x51')]=_0x132c74[_0x7df2('0x51')];_0x8d3004[_0x7df2('0x52')]=_0x132c74[_0x7df2('0x52')];_0x8d3004[_0x7df2('0x53')]=_0x132c74[_0x7df2('0x53')]||undefined;return _0x8d3004;};exports['decrementTalkink']=function(_0x34cec8,_0x181e6c){if(!_['isNil'](_0x34cec8)){if(_0x34cec8[_0x7df2('0x54')]>0x0){_0x34cec8['pTalking']-=0x1;}else{logger[_0x7df2('0x30')](_0x181e6c,_0x7df2('0x55'));}}else{logger[_0x7df2('0x30')](_0x181e6c,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x7df2('0x56')]=function(_0x480580){if(_0x480580<=0x0){return!![];}return![];};function buildObj(_0x43fc1f,_0x4c1e95,_0x1f7cb5){_0x43fc1f[_0x7df2('0x57')]=_0x4c1e95;_0x43fc1f[_0x7df2('0x58')]=_0x43fc1f[_0x7df2('0x59')];_0x43fc1f['interface']=_0x43fc1f[_0x7df2('0x5a')];_0x43fc1f['motionChannel']='voice';if(_0x1f7cb5){_0x43fc1f[_0x7df2('0x5b')]=_0x1f7cb5[_0x7df2('0x5b')];}return _0x43fc1f;}exports['buildObj']=buildObj;exports[_0x7df2('0x5c')]=function(_0x156982){var _0x4de35={};_0x4de35[_0x7df2('0x59')]=_0x156982[_0x7df2('0x59')];_0x4de35['interface']=_0x156982['channelAgent'];_0x4de35['uniqueid']=_0x156982[_0x7df2('0x44')];return _0x4de35;};exports[_0x7df2('0x5d')]=function(_0x28af69){var _0x3f8bad=[];for(var _0x1b9a40 in _0x28af69){if(_0x28af69['hasOwnProperty'](_0x1b9a40)){if(!_[_0x7df2('0x29')](_0x28af69[_0x1b9a40])&&_0x28af69[_0x1b9a40][_0x7df2('0x34')]===_0x7df2('0x5e')&&_0x28af69[_0x1b9a40][_0x7df2('0x5f')]==='reachable'){_0x3f8bad['push'](_0x28af69[_0x1b9a40]['id']);}}}return _0x3f8bad;};exports[_0x7df2('0x60')]=function(_0x17f597){var _0x4cd326=moment()['milliseconds'](0x0);var _0x5cdf6f=moment(_0x17f597)[_0x7df2('0x3')](0x0);return _0x4cd326[_0x7df2('0x4')](_0x5cdf6f,'seconds');};exports['createBody']=function(_0x5bada5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5bada5['ContactId'],'ListId':_0x5bada5['ListId'],'VoiceQueueId':_0x5bada5[_0x7df2('0x53')]||undefined,'CampaignId':_0x5bada5['CampaignId']||undefined};};exports[_0x7df2('0x61')]=function(_0x35a7ef){if(_0x35a7ef===_0x7df2('0x44')||_0x35a7ef===_0x7df2('0x62')||_0x35a7ef==='queue'||_0x35a7ef===_0x7df2('0x63')||_0x35a7ef===_0x7df2('0x64')||_0x35a7ef===_0x7df2('0x65')||_0x35a7ef==='membername'||_0x35a7ef==='channelAgent'||_0x35a7ef===_0x7df2('0x16')||_0x35a7ef==='active'||_0x35a7ef==='calleridnum'||_0x35a7ef===_0x7df2('0x50')||_0x35a7ef===_0x7df2('0x48')||_0x35a7ef===_0x7df2('0x49')||_0x35a7ef===_0x7df2('0x66')||_0x35a7ef===_0x7df2('0x67')||_0x35a7ef===_0x7df2('0x68')||_0x35a7ef===_0x7df2('0x69')||_0x35a7ef===_0x7df2('0x6a')||_0x35a7ef===_0x7df2('0x6b')||_0x35a7ef==='ContactId'||_0x35a7ef===_0x7df2('0x52')||_0x35a7ef===_0x7df2('0x3d')||_0x35a7ef==='VoiceQueueId'||_0x35a7ef===_0x7df2('0x6c')||_0x35a7ef===_0x7df2('0x6d')||_0x35a7ef===_0x7df2('0x6e')||_0x35a7ef===_0x7df2('0x6f')||_0x35a7ef==='xmd-listid'||_0x35a7ef==='xmd-dialurl'||_0x35a7ef==='xmd-dialtimeout'||_0x35a7ef===_0x7df2('0x70')||_0x35a7ef==='xmd-dialid'||_0x35a7ef===_0x7df2('0x71')||_0x35a7ef===_0x7df2('0x72')||_0x35a7ef===_0x7df2('0x73')||_0x35a7ef===_0x7df2('0x74')||_0x35a7ef===_0x7df2('0x75')||_0x35a7ef===_0x7df2('0x76')||_0x35a7ef===_0x7df2('0x77')||_0x35a7ef==='rtpaudioqosbridged'||_0x35a7ef===_0x7df2('0x78')||_0x35a7ef===_0x7df2('0x79')||_0x35a7ef===_0x7df2('0x7a')||_0x35a7ef===_0x7df2('0x7b')||_0x35a7ef==='rtpaudioqosrtt'||_0x35a7ef===_0x7df2('0x7c')||_0x35a7ef===_0x7df2('0x77')||_0x35a7ef===_0x7df2('0x7d')||_0x35a7ef===_0x7df2('0x78')||_0x35a7ef===_0x7df2('0x79')||_0x35a7ef===_0x7df2('0x7a')||_0x35a7ef===_0x7df2('0x7b')||_0x35a7ef===_0x7df2('0x7e')||_0x35a7ef===_0x7df2('0x7c')||_0x35a7ef===_0x7df2('0x7f')||_0x35a7ef===_0x7df2('0x80')||_0x35a7ef==='state'||_0x35a7ef==='statedesc'){return![];}return!![];};exports[_0x7df2('0x81')]=function(_0x4ed826,_0x5da34d){var _0x52bdc8,_0x3b28c5,_0x11513c;if(_0x5da34d<=0x0){_0x5da34d=0x1;}_0x52bdc8=new RegExp(_0x7df2('0x82')+_0x5da34d+'}$');_0x3b28c5=Math['pow'](0xa,_0x5da34d-0x1);_0x11513c=Math['pow'](0xa,_0x5da34d)-0x1;return util[_0x7df2('0x11')]('%s',_['replace'](_0x4ed826,_0x52bdc8,_['random'](_0x3b28c5,_0x11513c)));};exports[_0x7df2('0x83')]=function(_0xae91c0){var _0x2632a5=_0xae91c0[_0x7df2('0x84')](/"(.*?)"/);return _0x2632a5?_0x2632a5[0x1]:_0xae91c0;};exports[_0x7df2('0x85')]=function(_0xba15ec){var _0x5837c8=_0xba15ec['match'](/<(.*?)>/);return _0x5837c8?_0x5837c8[0x1]:_0xba15ec;};function buildNoAnswerEventPayload(_0x3ffc43,_0x80ad79){var _0x593b11=buildObj(_0x3ffc43,_0x7df2('0x86'));if(!_[_0x7df2('0xf')](_0x80ad79[_0x7df2('0x87')])){Object[_0x7df2('0x88')](_0x80ad79[_0x7df2('0x87')])[_0x7df2('0x89')](function(_0x315eab){_0x593b11[_0x315eab[_0x7df2('0x8a')]()]=_0x80ad79[_0x7df2('0x87')][_0x315eab];});}return _0x593b11;}exports[_0x7df2('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f6fabfc..6714360 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 _0xda04=['string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x2c4fb8,_0x44a47d){var _0xd707fa=function(_0x1f6fe6){while(--_0x1f6fe6){_0x2c4fb8['push'](_0x2c4fb8['shift']());}};_0xd707fa(++_0x44a47d);}(_0xda04,0x185));var _0x4da0=function(_0x4c95df,_0x11a35f){_0x4c95df=_0x4c95df-0x0;var _0xc66c67=_0xda04[_0x4c95df];return _0xc66c67;};'use strict';exports[_0x4da0('0x0')]={'queue':{'type':_0x4da0('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x4da0('0x1'),'required':!![]},'penalty':{'type':_0x4da0('0x2'),'required':![]},'paused':{'type':_0x4da0('0x3'),'required':![]}};exports[_0x4da0('0x4')]={'queue':{'type':_0x4da0('0x1'),'required':!![]},'interface':{'type':_0x4da0('0x1'),'required':!![]}};exports[_0x4da0('0x5')]={'interface':{'type':_0x4da0('0x1'),'required':!![]},'paused':{'type':_0x4da0('0x3')},'reason':{'type':_0x4da0('0x1'),'required':![]}};exports[_0x4da0('0x6')]={'module':{'type':_0x4da0('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x4da0('0x1'),'required':!![]}};exports[_0x4da0('0x7')]={'uniqueid':{'type':_0x4da0('0x1'),'required':!![]},'filename':{'type':_0x4da0('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x4da0('0x1')}};exports[_0x4da0('0x8')]={'uniqueid':{'type':_0x4da0('0x1'),'required':!![]}};exports[_0x4da0('0x9')]={'uniqueid':{'type':_0x4da0('0x1'),'required':!![]},'exten':{'type':_0x4da0('0x1'),'required':!![]},'context':{'type':_0x4da0('0x1')}}; \ No newline at end of file +var _0xdd8c=['reload','voicequeuechannel','voicechannel','string','number','queuepause','boolean'];(function(_0x58b56c,_0x208153){var _0x2656fe=function(_0x27472f){while(--_0x27472f){_0x58b56c['push'](_0x58b56c['shift']());}};_0x2656fe(++_0x208153);}(_0xdd8c,0xea));var _0xcdd8=function(_0x2fcf0b,_0x2a74dd){_0x2fcf0b=_0x2fcf0b-0x0;var _0x14d4ee=_0xdd8c[_0x2fcf0b];return _0x14d4ee;};'use strict';exports['queueadd']={'queue':{'type':_0xcdd8('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xcdd8('0x0'),'required':!![]},'penalty':{'type':_0xcdd8('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xcdd8('0x0'),'required':!![]},'interface':{'type':_0xcdd8('0x0'),'required':!![]}};exports[_0xcdd8('0x2')]={'interface':{'type':_0xcdd8('0x0'),'required':!![]},'paused':{'type':_0xcdd8('0x3')},'reason':{'type':'string','required':![]}};exports[_0xcdd8('0x4')]={'module':{'type':_0xcdd8('0x0'),'required':![]}};exports[_0xcdd8('0x5')]={'uniqueid':{'type':_0xcdd8('0x0'),'required':!![]}};exports[_0xcdd8('0x6')]={'uniqueid':{'type':_0xcdd8('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xcdd8('0x0')},'mixmonitorid':{'type':_0xcdd8('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xcdd8('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xcdd8('0x0'),'required':!![]},'exten':{'type':_0xcdd8('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 faf0437..914383c 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 _0xcedf=['prototype','mergeFromDatabase','agents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/zohoAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumDuration','sumBillable','isEmpty','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcedf,0x1b6));var _0xfced=function(_0x1fe967,_0x28e67e){_0x1fe967=_0x1fe967-0x0;var _0x20dfbc=_0xcedf[_0x1fe967];return _0x20dfbc;};'use strict';var util=require(_0xfced('0x0'));var _=require(_0xfced('0x1'));var moment=require(_0xfced('0x2'));var Agent=require(_0xfced('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xfced('0x4'));var VoiceQueue=require(_0xfced('0x5'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0xfced('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xfced('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xfced('0x8'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xfced('0x9'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xfced('0xa'));var Dynamics365Account=require(_0xfced('0xb'));var FreshsalesAccount=require(_0xfced('0xc'));var FaxAccount=require(_0xfced('0xd'));var Realtime=function(){this['agents']={};this[_0xfced('0xe')]={};this[_0xfced('0xf')]={};this[_0xfced('0x10')]={};this[_0xfced('0x11')]={};this[_0xfced('0x12')]={};this[_0xfced('0x13')]={};this[_0xfced('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfced('0x15')]={};this[_0xfced('0x16')]={};this['queueChannels']={};this[_0xfced('0x17')]={};this['timers']={};this[_0xfced('0x18')]={};this[_0xfced('0x19')]={};this[_0xfced('0x1a')]={};this[_0xfced('0x1b')]={};this['freshdeskAccounts']={};this[_0xfced('0x1c')]={};this[_0xfced('0x1d')]={};this[_0xfced('0x1e')]={};this[_0xfced('0x1f')]={};this[_0xfced('0x20')]={};this[_0xfced('0x21')]={};this[_0xfced('0x22')]={};};function freeIsNotKey(_0xe3a203,_0x486519,_0x95b06f){var _0x5f1ac5=_[_0xfced('0x23')](_0xe3a203,function(_0x2111ce,_0x194805){return _0x2111ce[_0x95b06f];});for(var _0x2d00dc in _0x486519){if(_0x486519[_0xfced('0x24')](_0x2d00dc)){if(!_0x5f1ac5[_0x2d00dc]){delete _0x486519[_0x2d00dc];}}}}function freeIsNotKeySip(_0x27e988,_0x3dc86c){var _0x31ea41=_[_0xfced('0x23')](_0x27e988,function(_0x16d442,_0x4dc7ba){return util[_0xfced('0x25')](_0xfced('0x26'),_0x16d442[_0xfced('0x27')]);});for(var _0x1b5f20 in _0x3dc86c){if(_0x3dc86c[_0xfced('0x24')](_0x1b5f20)){if(!_0x31ea41[_0x1b5f20]){delete _0x3dc86c[_0x1b5f20];}}}}function freeIsNotKeyAgent(_0x5ee366,_0x595036){var _0x395048=_[_0xfced('0x23')](_0x5ee366,function(_0x481ff4,_0x12f832){var _0x445862=_[_0xfced('0x28')](_0x481ff4[_0xfced('0x29')])?util[_0xfced('0x25')](_0xfced('0x26'),_0x481ff4['name']):_0x481ff4[_0xfced('0x29')];return _0x445862;});for(var _0x2722d9 in _0x595036){if(_0x595036[_0xfced('0x24')](_0x2722d9)){if(!_0x395048[_0x2722d9]){delete _0x595036[_0x2722d9];}}}}function clearVoiceCallReports(_0x11b5ff){_0x11b5ff[_0xfced('0x2a')]=0x0;_0x11b5ff['answered']=0x0;_0x11b5ff['sumHoldTime']=0x0;_0x11b5ff[_0xfced('0x2b')]=0x0;_0x11b5ff[_0xfced('0x2c')]=0x0;}function clearCampaigns(_0x3edc30){if(!_[_0xfced('0x2d')](_0x3edc30)){for(var _0x4d67bf in _0x3edc30){if(_0x3edc30[_0xfced('0x24')](_0x4d67bf)){_0x3edc30[_0x4d67bf]['ivrTotalCallsDays']=0x0;_0x3edc30[_0x4d67bf]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x328cf1){if(!_[_0xfced('0x2d')](_0x328cf1)){for(var _0x4de26e in _0x328cf1){if(_0x328cf1[_0xfced('0x24')](_0x4de26e)){_0x328cf1[_0x4de26e]['total']=0x0;_0x328cf1[_0x4de26e][_0xfced('0x2e')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x2f')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x30')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x31')]=0x0;_0x328cf1[_0x4de26e]['sumDuration']=0x0;_0x328cf1[_0x4de26e][_0xfced('0x2c')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x32')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x33')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x34')]=0x0;_0x328cf1[_0x4de26e]['outboundCongestionCallsDay']=0x0;_0x328cf1[_0x4de26e][_0xfced('0x35')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x36')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x37')]=0x0;_0x328cf1[_0x4de26e]['outboundDropCallsDayCallersExit']=0x0;_0x328cf1[_0x4de26e][_0xfced('0x38')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x39')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x3a')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x3b')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x32')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x3c')]=0x0;_0x328cf1[_0x4de26e][_0xfced('0x3d')]=!![];}}}}Realtime[_0xfced('0x3e')][_0xfced('0x3f')]=function(_0x10c5da,_0x8e6529){for(var _0x22862d in _0x8e6529){if(_0x10c5da[_0xfced('0x24')](_0x22862d)){_0x10c5da[_0x22862d]=_0x8e6529[_0x22862d];}}};Realtime['prototype']['initAgents']=function(){var _0x51cc61=this;return function(_0x97f070){if(_0x97f070){freeIsNotKeyAgent(_0x97f070,_0x51cc61[_0xfced('0x40')]);for(var _0x3d462d=0x0,_0x421f09={},_0xe017fd={};_0x3d462d<_0x97f070['length'];_0x3d462d+=0x1){_0x421f09=_0x97f070[_0x3d462d];var _0x173c1f=_[_0xfced('0x28')](_0x421f09[_0xfced('0x29')])?util[_0xfced('0x25')](_0xfced('0x26'),_0x421f09['name']):_0x421f09['interface'];if(_[_0xfced('0x41')](_0x51cc61['agents'][_0x173c1f])){_0x51cc61[_0xfced('0x40')][_0x173c1f]=new Agent(_0x421f09);}else{_0x51cc61[_0xfced('0x3f')](_0x51cc61['agents'][_0x173c1f],_0x421f09);}}}return _0x51cc61[_0xfced('0x40')];};};Realtime['prototype'][_0xfced('0x42')]=function(){var _0x1af749=this;return function(_0x2524d2){if(_0x2524d2){freeIsNotKeySip(_0x2524d2,_0x1af749[_0xfced('0xe')]);for(var _0x22e449=0x0,_0x461527={},_0x34b688={};_0x22e449<_0x2524d2[_0xfced('0x43')];_0x22e449+=0x1){_0x461527=_0x2524d2[_0x22e449];if(_[_0xfced('0x41')](_0x1af749['telephones'][util[_0xfced('0x25')](_0xfced('0x26'),_0x461527[_0xfced('0x27')])])){_0x1af749[_0xfced('0xe')][util[_0xfced('0x25')](_0xfced('0x26'),_0x461527[_0xfced('0x27')])]=new Telephone(_0x461527);}else{_0x1af749[_0xfced('0x3f')](_0x1af749[_0xfced('0xe')][util[_0xfced('0x25')](_0xfced('0x26'),_0x461527[_0xfced('0x27')])],_0x461527);}}}return _0x1af749[_0xfced('0xe')];};};Realtime[_0xfced('0x3e')][_0xfced('0x44')]=function(){var _0x1ffcaa=this;return function(_0xdd4cba){if(_0xdd4cba){freeIsNotKeySip(_0xdd4cba,_0x1ffcaa[_0xfced('0xf')]);for(var _0x5173ab=0x0,_0x1e85d8={},_0x1bc3ec={};_0x5173ab<_0xdd4cba[_0xfced('0x43')];_0x5173ab+=0x1){_0x1e85d8=_0xdd4cba[_0x5173ab];if(_[_0xfced('0x41')](_0x1ffcaa[_0xfced('0xf')][util[_0xfced('0x25')](_0xfced('0x26'),_0x1e85d8[_0xfced('0x27')])])){_0x1ffcaa[_0xfced('0xf')][util[_0xfced('0x25')](_0xfced('0x26'),_0x1e85d8['name'])]=new Trunk(_0x1e85d8);}else{_0x1ffcaa['mergeFromDatabase'](_0x1ffcaa['trunks'][util['format'](_0xfced('0x26'),_0x1e85d8['name'])],_0x1e85d8);}}}return _0x1ffcaa[_0xfced('0xf')];};};Realtime['prototype'][_0xfced('0x45')]=function(){var _0x2f38ab=this;return function(_0x4d5e72){if(_0x4d5e72){freeIsNotKey(_0x4d5e72,_0x2f38ab[_0xfced('0x10')],_0xfced('0x27'));for(var _0x33661e=0x0,_0xa1f386={},_0x19da77={};_0x33661e<_0x4d5e72[_0xfced('0x43')];_0x33661e+=0x1){_0xa1f386=_0x4d5e72[_0x33661e];if(_[_0xfced('0x41')](_0x2f38ab[_0xfced('0x10')][_0xa1f386[_0xfced('0x27')]])){_0x2f38ab['voiceQueues'][_0xa1f386[_0xfced('0x27')]]=new VoiceQueue(_0xa1f386);}else{_0x2f38ab[_0xfced('0x3f')](_0x2f38ab[_0xfced('0x10')][_0xa1f386[_0xfced('0x27')]],_0xa1f386);}}}return _0x2f38ab[_0xfced('0x10')];};};Realtime[_0xfced('0x3e')][_0xfced('0x46')]=function(){var _0xb9c2b6=this;return function(_0x5dc9c5){if(_0x5dc9c5){freeIsNotKey(_0x5dc9c5,_0xb9c2b6[_0xfced('0x11')],'id');for(var _0x322dca=0x0,_0x1f1a0c={},_0x375319={};_0x322dca<_0x5dc9c5['length'];_0x322dca+=0x1){_0x1f1a0c=_0x5dc9c5[_0x322dca];if(_[_0xfced('0x41')](_0xb9c2b6[_0xfced('0x11')][_0x1f1a0c['id']])){_0xb9c2b6[_0xfced('0x11')][_0x1f1a0c['id']]=new Trigger(_0x1f1a0c);}else{_0xb9c2b6[_0xfced('0x3f')](_0xb9c2b6[_0xfced('0x11')][_0x1f1a0c['id']],_0x1f1a0c);}}}return _0xb9c2b6['triggers'];};};Realtime[_0xfced('0x3e')]['initTemplates']=function(){var _0x3d1176=this;return function(_0x4dcbc4){if(_0x4dcbc4){freeIsNotKey(_0x4dcbc4,_0x3d1176[_0xfced('0x13')],'id');for(var _0x5c2f34=0x0,_0xc104fd={},_0x5a3fe7={};_0x5c2f34<_0x4dcbc4['length'];_0x5c2f34+=0x1){_0xc104fd=_0x4dcbc4[_0x5c2f34];if(_['isUndefined'](_0x3d1176[_0xfced('0x13')][_0xc104fd['id']])){_0x3d1176[_0xfced('0x13')][_0xc104fd['id']]=new Template(_0xc104fd);}else{_0x3d1176[_0xfced('0x3f')](_0x3d1176[_0xfced('0x13')][_0xc104fd['id']],_0xc104fd);}}}return _0x3d1176[_0xfced('0x13')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x23e79a=this;return function(_0x25613a){if(_0x25613a){freeIsNotKey(_0x25613a,_0x23e79a[_0xfced('0x19')],'id');for(var _0x306909=0x0,_0x20beb2={},_0x551e03={};_0x306909<_0x25613a[_0xfced('0x43')];_0x306909+=0x1){_0x20beb2=_0x25613a[_0x306909];if(_['isUndefined'](_0x23e79a[_0xfced('0x19')][_0x20beb2['id']])){_0x23e79a['zendeskAccounts'][_0x20beb2['id']]=new ZendeskAccount(_0x20beb2);}else{_0x23e79a[_0xfced('0x3f')](_0x23e79a[_0xfced('0x19')][_0x20beb2['id']],_0x20beb2);}}}return _0x23e79a[_0xfced('0x19')];};};Realtime[_0xfced('0x3e')]['initSalesforceAccounts']=function(){var _0x24f1c8=this;return function(_0x3fc9e9){if(_0x3fc9e9){freeIsNotKey(_0x3fc9e9,_0x24f1c8[_0xfced('0x1a')],'id');for(var _0x6ef61a=0x0,_0x26d7b2={},_0x33dd6c={};_0x6ef61a<_0x3fc9e9[_0xfced('0x43')];_0x6ef61a+=0x1){_0x26d7b2=_0x3fc9e9[_0x6ef61a];if(_[_0xfced('0x41')](_0x24f1c8[_0xfced('0x1a')][_0x26d7b2['id']])){_0x24f1c8[_0xfced('0x1a')][_0x26d7b2['id']]=new SalesforceAccount(_0x26d7b2);}else{_0x24f1c8['mergeFromDatabase'](_0x24f1c8[_0xfced('0x1a')][_0x26d7b2['id']],_0x26d7b2);}}}return _0x24f1c8['salesforceAccounts'];};};Realtime[_0xfced('0x3e')][_0xfced('0x47')]=function(){var _0x4f17b8=this;return function(_0x3add43){if(_0x3add43){freeIsNotKey(_0x3add43,_0x4f17b8[_0xfced('0x48')],'id');for(var _0x2ffde4=0x0,_0x2e3f7b={},_0x1138b5={};_0x2ffde4<_0x3add43[_0xfced('0x43')];_0x2ffde4+=0x1){_0x2e3f7b=_0x3add43[_0x2ffde4];if(_[_0xfced('0x41')](_0x4f17b8[_0xfced('0x48')][_0x2e3f7b['id']])){_0x4f17b8[_0xfced('0x48')][_0x2e3f7b['id']]=new FreshdeskAccount(_0x2e3f7b);}else{_0x4f17b8[_0xfced('0x3f')](_0x4f17b8[_0xfced('0x48')][_0x2e3f7b['id']],_0x2e3f7b);}}}return _0x4f17b8[_0xfced('0x48')];};};Realtime[_0xfced('0x3e')][_0xfced('0x49')]=function(){var _0x527dc8=this;return function(_0x323b43){if(_0x323b43){freeIsNotKey(_0x323b43,_0x527dc8[_0xfced('0x1c')],'id');for(var _0x206995=0x0,_0x538753={},_0x4245b2={};_0x206995<_0x323b43['length'];_0x206995+=0x1){_0x538753=_0x323b43[_0x206995];if(_[_0xfced('0x41')](_0x527dc8[_0xfced('0x1c')][_0x538753['id']])){_0x527dc8[_0xfced('0x1c')][_0x538753['id']]=new ZohoAccount(_0x538753);}else{_0x527dc8[_0xfced('0x3f')](_0x527dc8[_0xfced('0x1c')][_0x538753['id']],_0x538753);}}}return _0x527dc8[_0xfced('0x1c')];};};Realtime[_0xfced('0x3e')][_0xfced('0x4a')]=function(){var _0x1f3bd2=this;return function(_0x1af1be){if(_0x1af1be){freeIsNotKey(_0x1af1be,_0x1f3bd2[_0xfced('0x1d')],'id');for(var _0x27dd3d=0x0,_0x3206a3={},_0x146bd0={};_0x27dd3d<_0x1af1be[_0xfced('0x43')];_0x27dd3d+=0x1){_0x3206a3=_0x1af1be[_0x27dd3d];if(_[_0xfced('0x41')](_0x1f3bd2['deskAccounts'][_0x3206a3['id']])){_0x1f3bd2[_0xfced('0x1d')][_0x3206a3['id']]=new DeskAccount(_0x3206a3);}else{_0x1f3bd2[_0xfced('0x3f')](_0x1f3bd2[_0xfced('0x1d')][_0x3206a3['id']],_0x3206a3);}}}return _0x1f3bd2[_0xfced('0x1d')];};};Realtime[_0xfced('0x3e')][_0xfced('0x4b')]=function(){var _0x20fe8c=this;return function(_0x467d96){if(_0x467d96){freeIsNotKey(_0x467d96,_0x20fe8c[_0xfced('0x1b')],'id');for(var _0x840cd7=0x0,_0x28b871={},_0x5a434b={};_0x840cd7<_0x467d96[_0xfced('0x43')];_0x840cd7+=0x1){_0x28b871=_0x467d96[_0x840cd7];if(_[_0xfced('0x41')](_0x20fe8c[_0xfced('0x1b')][_0x28b871['id']])){_0x20fe8c[_0xfced('0x1b')][_0x28b871['id']]=new SugarcrmAccount(_0x28b871);}else{_0x20fe8c['mergeFromDatabase'](_0x20fe8c[_0xfced('0x1b')][_0x28b871['id']],_0x28b871);}}}return _0x20fe8c[_0xfced('0x1b')];};};Realtime[_0xfced('0x3e')]['initVtigerAccounts']=function(){var _0x4a465c=this;return function(_0xb505dc){if(_0xb505dc){freeIsNotKey(_0xb505dc,_0x4a465c[_0xfced('0x1e')],'id');for(var _0x3800bb=0x0,_0x34026c={},_0x261720={};_0x3800bb<_0xb505dc[_0xfced('0x43')];_0x3800bb+=0x1){_0x34026c=_0xb505dc[_0x3800bb];if(_[_0xfced('0x41')](_0x4a465c['vtigerAccounts'][_0x34026c['id']])){_0x4a465c[_0xfced('0x1e')][_0x34026c['id']]=new VtigerAccount(_0x34026c);}else{_0x4a465c[_0xfced('0x3f')](_0x4a465c[_0xfced('0x1e')][_0x34026c['id']],_0x34026c);}}}return _0x4a465c['vtigerAccounts'];};};Realtime['prototype'][_0xfced('0x4c')]=function(){var _0x8d7d9b=this;return function(_0x41e379){if(_0x41e379){freeIsNotKey(_0x41e379,_0x8d7d9b[_0xfced('0x1f')],'id');for(var _0x5362cf=0x0,_0x54ef0d={},_0x482f8e={};_0x5362cf<_0x41e379[_0xfced('0x43')];_0x5362cf+=0x1){_0x54ef0d=_0x41e379[_0x5362cf];if(_[_0xfced('0x41')](_0x8d7d9b[_0xfced('0x1f')][_0x54ef0d['id']])){_0x8d7d9b['servicenowAccounts'][_0x54ef0d['id']]=new ServicenowAccount(_0x54ef0d);}else{_0x8d7d9b['mergeFromDatabase'](_0x8d7d9b['servicenowAccounts'][_0x54ef0d['id']],_0x54ef0d);}}}return _0x8d7d9b['servicenowAccounts'];};};Realtime[_0xfced('0x3e')]['initDynamics365Accounts']=function(){var _0x1d8a59=this;return function(_0x9c7ac6){if(_0x9c7ac6){freeIsNotKey(_0x9c7ac6,_0x1d8a59[_0xfced('0x20')],'id');for(var _0x208cfd=0x0,_0x3e80d4={},_0x4076fc={};_0x208cfd<_0x9c7ac6[_0xfced('0x43')];_0x208cfd+=0x1){_0x3e80d4=_0x9c7ac6[_0x208cfd];if(_['isUndefined'](_0x1d8a59[_0xfced('0x20')][_0x3e80d4['id']])){_0x1d8a59['dynamics365Accounts'][_0x3e80d4['id']]=new Dynamics365Account(_0x3e80d4);}else{_0x1d8a59[_0xfced('0x3f')](_0x1d8a59['dynamics365Accounts'][_0x3e80d4['id']],_0x3e80d4);}}}return _0x1d8a59[_0xfced('0x20')];};};Realtime['prototype'][_0xfced('0x4d')]=function(){var _0x8eedf8=this;return function(_0x470b42){if(_0x470b42){freeIsNotKey(_0x470b42,_0x8eedf8[_0xfced('0x21')],'id');for(var _0x3e48c7=0x0,_0x27fc4c={},_0x1247eb={};_0x3e48c7<_0x470b42['length'];_0x3e48c7+=0x1){_0x27fc4c=_0x470b42[_0x3e48c7];if(_[_0xfced('0x41')](_0x8eedf8[_0xfced('0x21')][_0x27fc4c['id']])){_0x8eedf8[_0xfced('0x21')][_0x27fc4c['id']]=new FreshsalesAccount(_0x27fc4c);}else{_0x8eedf8[_0xfced('0x3f')](_0x8eedf8[_0xfced('0x21')][_0x27fc4c['id']],_0x27fc4c);}}}return _0x8eedf8[_0xfced('0x21')];};};Realtime[_0xfced('0x3e')][_0xfced('0x4e')]=function(){var _0x3daf70=this;return function(_0x4fd4b9){for(var _0x44c477=0x0;_0x44c477<_0x4fd4b9['length'];_0x44c477+=0x1){_[_0xfced('0x4f')](_0x3daf70[_0xfced('0x10')][_0x4fd4b9[_0x44c477][_0xfced('0x27')]],_0x4fd4b9[_0x44c477]);}return _0x3daf70[_0xfced('0x10')];};};Realtime[_0xfced('0x3e')][_0xfced('0x50')]=function(){var _0x5a0d6d=this;return function(_0x18a921){clearVoiceQueues(_0x5a0d6d[_0xfced('0x10')]);if(_0x18a921){_0x18a921=_['groupBy'](_0x18a921,_0xfced('0x51'));for(var _0x1aec3b in _0x18a921){if(_0x18a921[_0xfced('0x24')](_0x1aec3b)){var _0x367eae={};for(var _0x32b4ba=0x0;_0x32b4ba<_0x18a921[_0x1aec3b][_0xfced('0x43')];_0x32b4ba+=0x1){var _0x541db3=_0x18a921[_0x1aec3b][_0x32b4ba][_0xfced('0x52')];if(_0x5a0d6d[_0xfced('0x10')][_0x541db3]){if(_0x18a921[_0x1aec3b][_0x32b4ba][_0xfced('0x53')]){_0x5a0d6d[_0xfced('0x10')][_0x541db3][_0xfced('0x2f')]+=0x1;}if(_0x18a921[_0x1aec3b][_0x32b4ba]['queuecallerabandon']){_0x5a0d6d[_0xfced('0x10')][_0x541db3][_0xfced('0x30')]+=0x1;}_0x5a0d6d[_0xfced('0x10')][_0x541db3][_0xfced('0x31')]+=moment(_0x18a921[_0x1aec3b][_0x32b4ba][_0xfced('0x54')])[_0xfced('0x55')](moment(_0x18a921[_0x1aec3b][_0x32b4ba]['queuecallerjoinAt']),_0xfced('0x56'))||0x0;if(_0x32b4ba===_0x18a921[_0x1aec3b][_0xfced('0x43')]-0x1){_0x5a0d6d[_0xfced('0x10')][_0x541db3][_0xfced('0x2b')]+=moment(_0x18a921[_0x1aec3b][_0x32b4ba]['queuecallercompleteAt']||_0x18a921[_0x1aec3b][_0x32b4ba]['queuecallerabandonAt']||_0x18a921[_0x1aec3b][_0x32b4ba][_0xfced('0x57')])[_0xfced('0x55')](moment(_0x18a921[_0x1aec3b][_0x32b4ba][_0xfced('0x58')]),_0xfced('0x56'))||0x0;_0x5a0d6d[_0xfced('0x10')][_0x541db3][_0xfced('0x2a')]+=0x1;if(_0x18a921[_0x1aec3b][_0x32b4ba][_0xfced('0x59')]){_0x5a0d6d[_0xfced('0x10')][_0x541db3][_0xfced('0x2e')]+=0x1;_0x5a0d6d[_0xfced('0x10')][_0x541db3][_0xfced('0x2c')]+=moment(_0x18a921[_0x1aec3b][_0x32b4ba]['queuecallercompleteAt'])[_0xfced('0x55')](moment(_0x18a921[_0x1aec3b][_0x32b4ba][_0xfced('0x54')]),'seconds')||0x0;}}else{_0x5a0d6d['voiceQueues'][_0x541db3][_0xfced('0x2b')]+=_0x5a0d6d['voiceQueues'][_0x541db3][_0xfced('0x31')]||0x0;}}}}}}return _0x5a0d6d[_0xfced('0x10')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x220a42=this;return function(_0x56b0c0){clearVoiceCallReports(_0x220a42[_0xfced('0x14')]);if(_0x56b0c0){for(var _0x1b256c=0x0;_0x1b256c<_0x56b0c0[_0xfced('0x43')];_0x1b256c+=0x1){_0x220a42[_0xfced('0x14')][_0xfced('0x2a')]+=0x1;_0x220a42[_0xfced('0x14')][_0xfced('0x2b')]+=_0x56b0c0[_0x1b256c][_0xfced('0x5a')];if(_0x56b0c0[_0x1b256c][_0xfced('0x5b')]===_0xfced('0x5c')){_0x220a42[_0xfced('0x14')][_0xfced('0x2e')]+=0x1;_0x220a42[_0xfced('0x14')]['sumHoldTime']+=_0x56b0c0[_0x1b256c]['duration']-_0x56b0c0[_0x1b256c]['billableseconds']||0x0;_0x220a42[_0xfced('0x14')][_0xfced('0x2c')]+=_0x56b0c0[_0x1b256c]['billableseconds'];}}}return _0x220a42[_0xfced('0x14')];};};Realtime[_0xfced('0x3e')][_0xfced('0x5d')]=function(){var _0x5e7343=this;return function(_0xc0c861){if(_0xc0c861){freeIsNotKey(_0xc0c861,_0x5e7343['campaigns'],'name');for(var _0x13c9ce=0x0,_0x5b9184={};_0x13c9ce<_0xc0c861[_0xfced('0x43')];_0x13c9ce+=0x1){_0x5b9184=_0xc0c861[_0x13c9ce];if(_[_0xfced('0x41')](_0x5e7343[_0xfced('0x12')][_0x5b9184[_0xfced('0x27')]])){_0x5e7343[_0xfced('0x12')][_0x5b9184[_0xfced('0x27')]]=new Campaign(_0x5b9184);}else{_0x5e7343[_0xfced('0x3f')](_0x5e7343[_0xfced('0x12')][_0x5b9184[_0xfced('0x27')]],_0x5b9184);_0x5e7343[_0xfced('0x12')][_0x5b9184['name']][_0xfced('0x5e')]=_0x5b9184['SquareProject']?_0x5b9184[_0xfced('0x5f')][_0xfced('0x27')]:undefined;}}}return _0x5e7343[_0xfced('0x12')];};};Realtime[_0xfced('0x3e')][_0xfced('0x60')]=function(){var _0x21fbd5=this;return function(_0x1d25f8){if(_0x1d25f8){freeIsNotKey(_0x1d25f8,_0x21fbd5['voiceExtensions'],'id');for(var _0x3d7b9e=0x0,_0x1d034c={};_0x3d7b9e<_0x1d25f8[_0xfced('0x43')];_0x3d7b9e+=0x1){_0x1d034c=_0x1d25f8[_0x3d7b9e];if(_['isUndefined'](_0x21fbd5[_0xfced('0x15')][_0x1d034c['id']])){_0x21fbd5['voiceExtensions'][_0x1d034c['id']]=new VoiceExtension(_0x1d034c);}else{_0x21fbd5[_0xfced('0x3f')](_0x21fbd5['voiceExtensions'][_0x1d034c['id']],_0x1d034c);}}}return _0x21fbd5[_0xfced('0x15')];};};Realtime[_0xfced('0x3e')][_0xfced('0x61')]=function(){var _0x50a3f4=this;return function(_0xb8b8ae){clearCampaigns(_0x50a3f4['campaigns']);for(var _0x55eb18=0x0;_0x55eb18<_0xb8b8ae[_0xfced('0x43')];_0x55eb18+=0x1){_['merge'](_0x50a3f4['campaigns'][_0xb8b8ae[_0x55eb18][_0xfced('0x27')]],_0xb8b8ae[_0x55eb18]);}return _0x50a3f4[_0xfced('0x12')];};};Realtime[_0xfced('0x3e')][_0xfced('0x62')]=function(){var _0x16c3b7=this;return function(_0x2a20bf){if(_0x2a20bf){freeIsNotKey(_0x2a20bf,_0x16c3b7[_0xfced('0x22')],'id');for(var _0x4aebe5=0x0,_0x40247b={},_0x4ffa14={};_0x4aebe5<_0x2a20bf['length'];_0x4aebe5+=0x1){_0x40247b=_0x2a20bf[_0x4aebe5];if(_[_0xfced('0x41')](_0x16c3b7[_0xfced('0x22')][_0x40247b['id']])){_0x16c3b7[_0xfced('0x22')][_0x40247b['id']]=new FaxAccount(_0x40247b);}else{_0x16c3b7['mergeFromDatabase'](_0x16c3b7[_0xfced('0x22')][_0x40247b['id']],_0x40247b);}}}return _0x16c3b7['faxAccounts'];};};module[_0xfced('0x63')]=Realtime; \ No newline at end of file +var _0x7eff=['freshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','answered','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','exports','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','triggers','templates','queueChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','hasOwnProperty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','isNil','isUndefined','initTelephones','length','trunks','initVoiceQueues','voiceQueues','initTemplates','initZendeskAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts'];(function(_0x34d667,_0x2ef2af){var _0x4145fb=function(_0x3b63fa){while(--_0x3b63fa){_0x34d667['push'](_0x34d667['shift']());}};_0x4145fb(++_0x2ef2af);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require(_0xf7ef('0x0'));var moment=require(_0xf7ef('0x1'));var Agent=require(_0xf7ef('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0xf7ef('0x3'));var VoiceQueue=require(_0xf7ef('0x4'));var Trigger=require(_0xf7ef('0x5'));var Template=require(_0xf7ef('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xf7ef('0x7'));var SalesforceAccount=require(_0xf7ef('0x8'));var FreshdeskAccount=require(_0xf7ef('0x9'));var SugarcrmAccount=require(_0xf7ef('0xa'));var ZohoAccount=require(_0xf7ef('0xb'));var DeskAccount=require(_0xf7ef('0xc'));var VtigerAccount=require(_0xf7ef('0xd'));var ServicenowAccount=require(_0xf7ef('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xf7ef('0xf'));var FaxAccount=require(_0xf7ef('0x10'));var Realtime=function(){this['agents']={};this[_0xf7ef('0x11')]={};this['trunks']={};this['voiceQueues']={};this[_0xf7ef('0x12')]={};this['campaigns']={};this[_0xf7ef('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0xf7ef('0x14')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this[_0xf7ef('0x15')]={};this[_0xf7ef('0x16')]={};this[_0xf7ef('0x17')]={};this[_0xf7ef('0x18')]={};this['zohoAccounts']={};this[_0xf7ef('0x19')]={};this['vtigerAccounts']={};this[_0xf7ef('0x1a')]={};this[_0xf7ef('0x1b')]={};this['freshsalesAccounts']={};this[_0xf7ef('0x1c')]={};};function freeIsNotKey(_0x4856bd,_0x148942,_0x16a102){var _0x1695c1=_[_0xf7ef('0x1d')](_0x4856bd,function(_0x15ad8c,_0x28c9ce){return _0x15ad8c[_0x16a102];});for(var _0x466612 in _0x148942){if(_0x148942['hasOwnProperty'](_0x466612)){if(!_0x1695c1[_0x466612]){delete _0x148942[_0x466612];}}}}function freeIsNotKeySip(_0x4fa0c6,_0x4bc8ff){var _0x3138a3=_['mapKeys'](_0x4fa0c6,function(_0x371688,_0x3d1401){return util[_0xf7ef('0x1e')](_0xf7ef('0x1f'),_0x371688[_0xf7ef('0x20')]);});for(var _0x29cbf1 in _0x4bc8ff){if(_0x4bc8ff['hasOwnProperty'](_0x29cbf1)){if(!_0x3138a3[_0x29cbf1]){delete _0x4bc8ff[_0x29cbf1];}}}}function freeIsNotKeyAgent(_0x49e49a,_0x578525){var _0x1f7e4e=_[_0xf7ef('0x1d')](_0x49e49a,function(_0x1a95c6,_0x20c27b){var _0x5d70f5=_['isNil'](_0x1a95c6[_0xf7ef('0x21')])?util[_0xf7ef('0x1e')](_0xf7ef('0x1f'),_0x1a95c6[_0xf7ef('0x20')]):_0x1a95c6[_0xf7ef('0x21')];return _0x5d70f5;});for(var _0x1ee788 in _0x578525){if(_0x578525['hasOwnProperty'](_0x1ee788)){if(!_0x1f7e4e[_0x1ee788]){delete _0x578525[_0x1ee788];}}}}function clearVoiceCallReports(_0xeb86b3){_0xeb86b3[_0xf7ef('0x22')]=0x0;_0xeb86b3['answered']=0x0;_0xeb86b3[_0xf7ef('0x23')]=0x0;_0xeb86b3[_0xf7ef('0x24')]=0x0;_0xeb86b3[_0xf7ef('0x25')]=0x0;}function clearCampaigns(_0x205aaa){if(!_[_0xf7ef('0x26')](_0x205aaa)){for(var _0xaa0cc4 in _0x205aaa){if(_0x205aaa[_0xf7ef('0x27')](_0xaa0cc4)){_0x205aaa[_0xaa0cc4][_0xf7ef('0x28')]=0x0;_0x205aaa[_0xaa0cc4][_0xf7ef('0x29')]=0x0;}}}}function clearVoiceQueues(_0x4ad9b9){if(!_[_0xf7ef('0x26')](_0x4ad9b9)){for(var _0x24c84f in _0x4ad9b9){if(_0x4ad9b9[_0xf7ef('0x27')](_0x24c84f)){_0x4ad9b9[_0x24c84f][_0xf7ef('0x22')]=0x0;_0x4ad9b9[_0x24c84f]['answered']=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x2a')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x2b')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x23')]=0x0;_0x4ad9b9[_0x24c84f]['sumDuration']=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x25')]=0x0;_0x4ad9b9[_0x24c84f]['outboundAnswerAgiCallsDay']=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x2c')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x2d')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x2e')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x2f')]=0x0;_0x4ad9b9[_0x24c84f]['outboundUnknownCallsDay']=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x30')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x31')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x32')]=0x0;_0x4ad9b9[_0x24c84f]['outboundOriginateFailureCallsDay']=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x33')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x34')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x35')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x36')]=0x0;_0x4ad9b9[_0x24c84f][_0xf7ef('0x37')]=!![];}}}}Realtime[_0xf7ef('0x38')][_0xf7ef('0x39')]=function(_0x138db8,_0x2843fd){for(var _0x522dcc in _0x2843fd){if(_0x138db8[_0xf7ef('0x27')](_0x522dcc)){_0x138db8[_0x522dcc]=_0x2843fd[_0x522dcc];}}};Realtime[_0xf7ef('0x38')][_0xf7ef('0x3a')]=function(){var _0x445964=this;return function(_0x34fc2c){if(_0x34fc2c){freeIsNotKeyAgent(_0x34fc2c,_0x445964[_0xf7ef('0x3b')]);for(var _0x90e4a1=0x0,_0x4cbb7a={},_0x223f0e={};_0x90e4a1<_0x34fc2c['length'];_0x90e4a1+=0x1){_0x4cbb7a=_0x34fc2c[_0x90e4a1];var _0x540b1d=_[_0xf7ef('0x3c')](_0x4cbb7a[_0xf7ef('0x21')])?util[_0xf7ef('0x1e')](_0xf7ef('0x1f'),_0x4cbb7a[_0xf7ef('0x20')]):_0x4cbb7a[_0xf7ef('0x21')];if(_[_0xf7ef('0x3d')](_0x445964[_0xf7ef('0x3b')][_0x540b1d])){_0x445964['agents'][_0x540b1d]=new Agent(_0x4cbb7a);}else{_0x445964[_0xf7ef('0x39')](_0x445964[_0xf7ef('0x3b')][_0x540b1d],_0x4cbb7a);}}}return _0x445964['agents'];};};Realtime['prototype'][_0xf7ef('0x3e')]=function(){var _0x3ea37f=this;return function(_0x419116){if(_0x419116){freeIsNotKeySip(_0x419116,_0x3ea37f[_0xf7ef('0x11')]);for(var _0x39783a=0x0,_0x3fbb9f={},_0x3eede6={};_0x39783a<_0x419116[_0xf7ef('0x3f')];_0x39783a+=0x1){_0x3fbb9f=_0x419116[_0x39783a];if(_['isUndefined'](_0x3ea37f['telephones'][util[_0xf7ef('0x1e')]('SIP/%s',_0x3fbb9f[_0xf7ef('0x20')])])){_0x3ea37f[_0xf7ef('0x11')][util[_0xf7ef('0x1e')](_0xf7ef('0x1f'),_0x3fbb9f[_0xf7ef('0x20')])]=new Telephone(_0x3fbb9f);}else{_0x3ea37f[_0xf7ef('0x39')](_0x3ea37f[_0xf7ef('0x11')][util[_0xf7ef('0x1e')](_0xf7ef('0x1f'),_0x3fbb9f['name'])],_0x3fbb9f);}}}return _0x3ea37f[_0xf7ef('0x11')];};};Realtime[_0xf7ef('0x38')]['initTrunks']=function(){var _0x3da22e=this;return function(_0x46995a){if(_0x46995a){freeIsNotKeySip(_0x46995a,_0x3da22e[_0xf7ef('0x40')]);for(var _0x16171d=0x0,_0x69d4c7={},_0x41f1bd={};_0x16171d<_0x46995a[_0xf7ef('0x3f')];_0x16171d+=0x1){_0x69d4c7=_0x46995a[_0x16171d];if(_[_0xf7ef('0x3d')](_0x3da22e[_0xf7ef('0x40')][util[_0xf7ef('0x1e')]('SIP/%s',_0x69d4c7['name'])])){_0x3da22e['trunks'][util[_0xf7ef('0x1e')]('SIP/%s',_0x69d4c7[_0xf7ef('0x20')])]=new Trunk(_0x69d4c7);}else{_0x3da22e[_0xf7ef('0x39')](_0x3da22e[_0xf7ef('0x40')][util['format'](_0xf7ef('0x1f'),_0x69d4c7['name'])],_0x69d4c7);}}}return _0x3da22e[_0xf7ef('0x40')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x41')]=function(){var _0x30e539=this;return function(_0x156e3b){if(_0x156e3b){freeIsNotKey(_0x156e3b,_0x30e539[_0xf7ef('0x42')],_0xf7ef('0x20'));for(var _0x38a2ef=0x0,_0x318261={},_0x1f504f={};_0x38a2ef<_0x156e3b[_0xf7ef('0x3f')];_0x38a2ef+=0x1){_0x318261=_0x156e3b[_0x38a2ef];if(_[_0xf7ef('0x3d')](_0x30e539[_0xf7ef('0x42')][_0x318261[_0xf7ef('0x20')]])){_0x30e539[_0xf7ef('0x42')][_0x318261[_0xf7ef('0x20')]]=new VoiceQueue(_0x318261);}else{_0x30e539[_0xf7ef('0x39')](_0x30e539[_0xf7ef('0x42')][_0x318261[_0xf7ef('0x20')]],_0x318261);}}}return _0x30e539[_0xf7ef('0x42')];};};Realtime[_0xf7ef('0x38')]['initTriggers']=function(){var _0x43697b=this;return function(_0x19c5f3){if(_0x19c5f3){freeIsNotKey(_0x19c5f3,_0x43697b[_0xf7ef('0x12')],'id');for(var _0x536936=0x0,_0x131914={},_0x324136={};_0x536936<_0x19c5f3[_0xf7ef('0x3f')];_0x536936+=0x1){_0x131914=_0x19c5f3[_0x536936];if(_[_0xf7ef('0x3d')](_0x43697b[_0xf7ef('0x12')][_0x131914['id']])){_0x43697b[_0xf7ef('0x12')][_0x131914['id']]=new Trigger(_0x131914);}else{_0x43697b[_0xf7ef('0x39')](_0x43697b[_0xf7ef('0x12')][_0x131914['id']],_0x131914);}}}return _0x43697b[_0xf7ef('0x12')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x43')]=function(){var _0x5670c8=this;return function(_0x507949){if(_0x507949){freeIsNotKey(_0x507949,_0x5670c8['templates'],'id');for(var _0x432736=0x0,_0x4a4cae={},_0x395824={};_0x432736<_0x507949[_0xf7ef('0x3f')];_0x432736+=0x1){_0x4a4cae=_0x507949[_0x432736];if(_[_0xf7ef('0x3d')](_0x5670c8[_0xf7ef('0x13')][_0x4a4cae['id']])){_0x5670c8[_0xf7ef('0x13')][_0x4a4cae['id']]=new Template(_0x4a4cae);}else{_0x5670c8['mergeFromDatabase'](_0x5670c8['templates'][_0x4a4cae['id']],_0x4a4cae);}}}return _0x5670c8[_0xf7ef('0x13')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x44')]=function(){var _0x7ec6a=this;return function(_0x1a25e1){if(_0x1a25e1){freeIsNotKey(_0x1a25e1,_0x7ec6a['zendeskAccounts'],'id');for(var _0xca3d3c=0x0,_0x2ce37f={},_0x5ce5b7={};_0xca3d3c<_0x1a25e1[_0xf7ef('0x3f')];_0xca3d3c+=0x1){_0x2ce37f=_0x1a25e1[_0xca3d3c];if(_[_0xf7ef('0x3d')](_0x7ec6a[_0xf7ef('0x15')][_0x2ce37f['id']])){_0x7ec6a[_0xf7ef('0x15')][_0x2ce37f['id']]=new ZendeskAccount(_0x2ce37f);}else{_0x7ec6a[_0xf7ef('0x39')](_0x7ec6a['zendeskAccounts'][_0x2ce37f['id']],_0x2ce37f);}}}return _0x7ec6a[_0xf7ef('0x15')];};};Realtime[_0xf7ef('0x38')]['initSalesforceAccounts']=function(){var _0x3f71df=this;return function(_0x43d2fd){if(_0x43d2fd){freeIsNotKey(_0x43d2fd,_0x3f71df['salesforceAccounts'],'id');for(var _0x1aacea=0x0,_0x3a42ee={},_0x320a24={};_0x1aacea<_0x43d2fd[_0xf7ef('0x3f')];_0x1aacea+=0x1){_0x3a42ee=_0x43d2fd[_0x1aacea];if(_[_0xf7ef('0x3d')](_0x3f71df['salesforceAccounts'][_0x3a42ee['id']])){_0x3f71df[_0xf7ef('0x16')][_0x3a42ee['id']]=new SalesforceAccount(_0x3a42ee);}else{_0x3f71df[_0xf7ef('0x39')](_0x3f71df[_0xf7ef('0x16')][_0x3a42ee['id']],_0x3a42ee);}}}return _0x3f71df[_0xf7ef('0x16')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x45')]=function(){var _0x30153b=this;return function(_0x32ae73){if(_0x32ae73){freeIsNotKey(_0x32ae73,_0x30153b[_0xf7ef('0x18')],'id');for(var _0x206bfc=0x0,_0x80a9fb={},_0x30392e={};_0x206bfc<_0x32ae73[_0xf7ef('0x3f')];_0x206bfc+=0x1){_0x80a9fb=_0x32ae73[_0x206bfc];if(_[_0xf7ef('0x3d')](_0x30153b['freshdeskAccounts'][_0x80a9fb['id']])){_0x30153b[_0xf7ef('0x18')][_0x80a9fb['id']]=new FreshdeskAccount(_0x80a9fb);}else{_0x30153b[_0xf7ef('0x39')](_0x30153b[_0xf7ef('0x18')][_0x80a9fb['id']],_0x80a9fb);}}}return _0x30153b[_0xf7ef('0x18')];};};Realtime[_0xf7ef('0x38')]['initZohoAccounts']=function(){var _0xc393ef=this;return function(_0x207f95){if(_0x207f95){freeIsNotKey(_0x207f95,_0xc393ef[_0xf7ef('0x46')],'id');for(var _0x2b7725=0x0,_0x3581a8={},_0x588533={};_0x2b7725<_0x207f95['length'];_0x2b7725+=0x1){_0x3581a8=_0x207f95[_0x2b7725];if(_[_0xf7ef('0x3d')](_0xc393ef[_0xf7ef('0x46')][_0x3581a8['id']])){_0xc393ef[_0xf7ef('0x46')][_0x3581a8['id']]=new ZohoAccount(_0x3581a8);}else{_0xc393ef[_0xf7ef('0x39')](_0xc393ef[_0xf7ef('0x46')][_0x3581a8['id']],_0x3581a8);}}}return _0xc393ef[_0xf7ef('0x46')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x47')]=function(){var _0x5395ab=this;return function(_0x2130e6){if(_0x2130e6){freeIsNotKey(_0x2130e6,_0x5395ab[_0xf7ef('0x19')],'id');for(var _0x33d061=0x0,_0xe000e9={},_0x26e9f6={};_0x33d061<_0x2130e6['length'];_0x33d061+=0x1){_0xe000e9=_0x2130e6[_0x33d061];if(_[_0xf7ef('0x3d')](_0x5395ab[_0xf7ef('0x19')][_0xe000e9['id']])){_0x5395ab[_0xf7ef('0x19')][_0xe000e9['id']]=new DeskAccount(_0xe000e9);}else{_0x5395ab['mergeFromDatabase'](_0x5395ab['deskAccounts'][_0xe000e9['id']],_0xe000e9);}}}return _0x5395ab[_0xf7ef('0x19')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x48')]=function(){var _0x325ece=this;return function(_0x487366){if(_0x487366){freeIsNotKey(_0x487366,_0x325ece[_0xf7ef('0x17')],'id');for(var _0x360a67=0x0,_0x51db7d={},_0x251f71={};_0x360a67<_0x487366[_0xf7ef('0x3f')];_0x360a67+=0x1){_0x51db7d=_0x487366[_0x360a67];if(_[_0xf7ef('0x3d')](_0x325ece[_0xf7ef('0x17')][_0x51db7d['id']])){_0x325ece[_0xf7ef('0x17')][_0x51db7d['id']]=new SugarcrmAccount(_0x51db7d);}else{_0x325ece['mergeFromDatabase'](_0x325ece[_0xf7ef('0x17')][_0x51db7d['id']],_0x51db7d);}}}return _0x325ece['sugarcrmAccounts'];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x49')]=function(){var _0xe0363a=this;return function(_0x3947a0){if(_0x3947a0){freeIsNotKey(_0x3947a0,_0xe0363a['vtigerAccounts'],'id');for(var _0xdc43b9=0x0,_0x472fb9={},_0x384a7b={};_0xdc43b9<_0x3947a0[_0xf7ef('0x3f')];_0xdc43b9+=0x1){_0x472fb9=_0x3947a0[_0xdc43b9];if(_[_0xf7ef('0x3d')](_0xe0363a[_0xf7ef('0x4a')][_0x472fb9['id']])){_0xe0363a[_0xf7ef('0x4a')][_0x472fb9['id']]=new VtigerAccount(_0x472fb9);}else{_0xe0363a[_0xf7ef('0x39')](_0xe0363a[_0xf7ef('0x4a')][_0x472fb9['id']],_0x472fb9);}}}return _0xe0363a[_0xf7ef('0x4a')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x4b')]=function(){var _0x108430=this;return function(_0xe4bffe){if(_0xe4bffe){freeIsNotKey(_0xe4bffe,_0x108430[_0xf7ef('0x1a')],'id');for(var _0x33b4da=0x0,_0x5ea4c1={},_0x1c5d9c={};_0x33b4da<_0xe4bffe[_0xf7ef('0x3f')];_0x33b4da+=0x1){_0x5ea4c1=_0xe4bffe[_0x33b4da];if(_[_0xf7ef('0x3d')](_0x108430[_0xf7ef('0x1a')][_0x5ea4c1['id']])){_0x108430[_0xf7ef('0x1a')][_0x5ea4c1['id']]=new ServicenowAccount(_0x5ea4c1);}else{_0x108430[_0xf7ef('0x39')](_0x108430[_0xf7ef('0x1a')][_0x5ea4c1['id']],_0x5ea4c1);}}}return _0x108430['servicenowAccounts'];};};Realtime['prototype'][_0xf7ef('0x4c')]=function(){var _0x494ba3=this;return function(_0x54f64f){if(_0x54f64f){freeIsNotKey(_0x54f64f,_0x494ba3[_0xf7ef('0x1b')],'id');for(var _0x545ec6=0x0,_0xc6d757={},_0x1c1a83={};_0x545ec6<_0x54f64f[_0xf7ef('0x3f')];_0x545ec6+=0x1){_0xc6d757=_0x54f64f[_0x545ec6];if(_[_0xf7ef('0x3d')](_0x494ba3[_0xf7ef('0x1b')][_0xc6d757['id']])){_0x494ba3['dynamics365Accounts'][_0xc6d757['id']]=new Dynamics365Account(_0xc6d757);}else{_0x494ba3[_0xf7ef('0x39')](_0x494ba3[_0xf7ef('0x1b')][_0xc6d757['id']],_0xc6d757);}}}return _0x494ba3['dynamics365Accounts'];};};Realtime['prototype'][_0xf7ef('0x4d')]=function(){var _0x50abd6=this;return function(_0x2859cf){if(_0x2859cf){freeIsNotKey(_0x2859cf,_0x50abd6[_0xf7ef('0x4e')],'id');for(var _0x1df2bc=0x0,_0x2788c3={},_0x3e5d31={};_0x1df2bc<_0x2859cf['length'];_0x1df2bc+=0x1){_0x2788c3=_0x2859cf[_0x1df2bc];if(_['isUndefined'](_0x50abd6[_0xf7ef('0x4e')][_0x2788c3['id']])){_0x50abd6['freshsalesAccounts'][_0x2788c3['id']]=new FreshsalesAccount(_0x2788c3);}else{_0x50abd6['mergeFromDatabase'](_0x50abd6['freshsalesAccounts'][_0x2788c3['id']],_0x2788c3);}}}return _0x50abd6[_0xf7ef('0x4e')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x4f')]=function(){var _0x338c8c=this;return function(_0x27a435){for(var _0x162c6d=0x0;_0x162c6d<_0x27a435[_0xf7ef('0x3f')];_0x162c6d+=0x1){_[_0xf7ef('0x50')](_0x338c8c['voiceQueues'][_0x27a435[_0x162c6d][_0xf7ef('0x20')]],_0x27a435[_0x162c6d]);}return _0x338c8c[_0xf7ef('0x42')];};};Realtime[_0xf7ef('0x38')]['initVoiceQueueReports']=function(){var _0x5cf8f5=this;return function(_0x35bf65){clearVoiceQueues(_0x5cf8f5[_0xf7ef('0x42')]);if(_0x35bf65){_0x35bf65=_[_0xf7ef('0x51')](_0x35bf65,_0xf7ef('0x52'));for(var _0x4ff671 in _0x35bf65){if(_0x35bf65[_0xf7ef('0x27')](_0x4ff671)){var _0x375a3e={};for(var _0x1b702c=0x0;_0x1b702c<_0x35bf65[_0x4ff671][_0xf7ef('0x3f')];_0x1b702c+=0x1){var _0x49b0e3=_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x53')];if(_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3]){if(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x54')]){_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3]['unmanaged']+=0x1;}if(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x55')]){_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3][_0xf7ef('0x2b')]+=0x1;}_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3][_0xf7ef('0x23')]+=moment(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x56')])[_0xf7ef('0x57')](moment(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x58')]),_0xf7ef('0x59'))||0x0;if(_0x1b702c===_0x35bf65[_0x4ff671]['length']-0x1){_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3][_0xf7ef('0x24')]+=moment(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x5a')]||_0x35bf65[_0x4ff671][_0x1b702c]['queuecallerabandonAt']||_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x5b')])[_0xf7ef('0x57')](moment(_0x35bf65[_0x4ff671][_0x1b702c]['queuecallerjoinAt']),_0xf7ef('0x59'))||0x0;_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3][_0xf7ef('0x22')]+=0x1;if(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x5c')]){_0x5cf8f5['voiceQueues'][_0x49b0e3][_0xf7ef('0x5d')]+=0x1;_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3][_0xf7ef('0x25')]+=moment(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x5a')])[_0xf7ef('0x57')](moment(_0x35bf65[_0x4ff671][_0x1b702c][_0xf7ef('0x56')]),'seconds')||0x0;}}else{_0x5cf8f5[_0xf7ef('0x42')][_0x49b0e3][_0xf7ef('0x24')]+=_0x5cf8f5['voiceQueues'][_0x49b0e3][_0xf7ef('0x23')]||0x0;}}}}}}return _0x5cf8f5[_0xf7ef('0x42')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x5e')]=function(){var _0x1e9ead=this;return function(_0x3cb730){clearVoiceCallReports(_0x1e9ead[_0xf7ef('0x5f')]);if(_0x3cb730){for(var _0x506b58=0x0;_0x506b58<_0x3cb730[_0xf7ef('0x3f')];_0x506b58+=0x1){_0x1e9ead[_0xf7ef('0x5f')][_0xf7ef('0x22')]+=0x1;_0x1e9ead[_0xf7ef('0x5f')][_0xf7ef('0x24')]+=_0x3cb730[_0x506b58][_0xf7ef('0x60')];if(_0x3cb730[_0x506b58][_0xf7ef('0x61')]===_0xf7ef('0x62')){_0x1e9ead['outbound'][_0xf7ef('0x5d')]+=0x1;_0x1e9ead[_0xf7ef('0x5f')][_0xf7ef('0x23')]+=_0x3cb730[_0x506b58][_0xf7ef('0x60')]-_0x3cb730[_0x506b58]['billableseconds']||0x0;_0x1e9ead[_0xf7ef('0x5f')][_0xf7ef('0x25')]+=_0x3cb730[_0x506b58][_0xf7ef('0x63')];}}}return _0x1e9ead[_0xf7ef('0x5f')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x64')]=function(){var _0x3862e0=this;return function(_0x216d26){if(_0x216d26){freeIsNotKey(_0x216d26,_0x3862e0[_0xf7ef('0x65')],_0xf7ef('0x20'));for(var _0x3fe779=0x0,_0x37dfa0={};_0x3fe779<_0x216d26[_0xf7ef('0x3f')];_0x3fe779+=0x1){_0x37dfa0=_0x216d26[_0x3fe779];if(_[_0xf7ef('0x3d')](_0x3862e0[_0xf7ef('0x65')][_0x37dfa0[_0xf7ef('0x20')]])){_0x3862e0[_0xf7ef('0x65')][_0x37dfa0[_0xf7ef('0x20')]]=new Campaign(_0x37dfa0);}else{_0x3862e0[_0xf7ef('0x39')](_0x3862e0[_0xf7ef('0x65')][_0x37dfa0[_0xf7ef('0x20')]],_0x37dfa0);_0x3862e0[_0xf7ef('0x65')][_0x37dfa0[_0xf7ef('0x20')]][_0xf7ef('0x66')]=_0x37dfa0[_0xf7ef('0x67')]?_0x37dfa0[_0xf7ef('0x67')][_0xf7ef('0x20')]:undefined;}}}return _0x3862e0[_0xf7ef('0x65')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x68')]=function(){var _0x2b073b=this;return function(_0x2ab235){if(_0x2ab235){freeIsNotKey(_0x2ab235,_0x2b073b[_0xf7ef('0x69')],'id');for(var _0x2ee125=0x0,_0x30a54f={};_0x2ee125<_0x2ab235[_0xf7ef('0x3f')];_0x2ee125+=0x1){_0x30a54f=_0x2ab235[_0x2ee125];if(_[_0xf7ef('0x3d')](_0x2b073b['voiceExtensions'][_0x30a54f['id']])){_0x2b073b[_0xf7ef('0x69')][_0x30a54f['id']]=new VoiceExtension(_0x30a54f);}else{_0x2b073b[_0xf7ef('0x39')](_0x2b073b[_0xf7ef('0x69')][_0x30a54f['id']],_0x30a54f);}}}return _0x2b073b[_0xf7ef('0x69')];};};Realtime[_0xf7ef('0x38')][_0xf7ef('0x6a')]=function(){var _0x4dab03=this;return function(_0x35e478){clearCampaigns(_0x4dab03[_0xf7ef('0x65')]);for(var _0x19414c=0x0;_0x19414c<_0x35e478[_0xf7ef('0x3f')];_0x19414c+=0x1){_[_0xf7ef('0x50')](_0x4dab03[_0xf7ef('0x65')][_0x35e478[_0x19414c][_0xf7ef('0x20')]],_0x35e478[_0x19414c]);}return _0x4dab03[_0xf7ef('0x65')];};};Realtime[_0xf7ef('0x38')]['initFaxAccounts']=function(){var _0x2dd8b1=this;return function(_0x23cef8){if(_0x23cef8){freeIsNotKey(_0x23cef8,_0x2dd8b1['faxAccounts'],'id');for(var _0x13cdf1=0x0,_0x274cd9={},_0x2f3544={};_0x13cdf1<_0x23cef8[_0xf7ef('0x3f')];_0x13cdf1+=0x1){_0x274cd9=_0x23cef8[_0x13cdf1];if(_[_0xf7ef('0x3d')](_0x2dd8b1[_0xf7ef('0x1c')][_0x274cd9['id']])){_0x2dd8b1[_0xf7ef('0x1c')][_0x274cd9['id']]=new FaxAccount(_0x274cd9);}else{_0x2dd8b1[_0xf7ef('0x39')](_0x2dd8b1[_0xf7ef('0x1c')][_0x274cd9['id']],_0x274cd9);}}}return _0x2dd8b1[_0xf7ef('0x1c')];};};module[_0xf7ef('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 55cffd4..f6d6ad3 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 _0x3d11=['queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','split','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','phone','substring','lastIndexOf','attendedTransfer','exports','lodash','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','lastAssignedTo','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','outbound','internal','destination','exten','type','dialer','lastapplication'];(function(_0x3a2531,_0x335dd3){var _0x3376a8=function(_0x16595f){while(--_0x16595f){_0x3a2531['push'](_0x3a2531['shift']());}};_0x3376a8(++_0x335dd3);}(_0x3d11,0x140));var _0x13d1=function(_0x24f6f0,_0x572645){_0x24f6f0=_0x24f6f0-0x0;var _0x5550c6=_0x3d11[_0x24f6f0];return _0x5550c6;};'use strict';var _=require(_0x13d1('0x0'));var moment=require(_0x13d1('0x1'));var util=require(_0x13d1('0x2'));var config=require('../../../config/environment');var ami=require(_0x13d1('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x13d1('0x4'));var RpcVoiceDialReport=require(_0x13d1('0x5'));var RpcMemberReport=require(_0x13d1('0x6'));var RpcVoiceQueueReport=require(_0x13d1('0x7'));var RpcVoiceRecording=require(_0x13d1('0x8'));var RpcVoiceTransferReport=require(_0x13d1('0x9'));var VoiceQueueReport=require(_0x13d1('0xa'));var VoiceCallReport=require(_0x13d1('0xb'));var VoiceAgentReport=require(_0x13d1('0xc'));var VoiceDialReport=require(_0x13d1('0xd'));var UserReport=require('./userReport');function Report(_0x484944){this[_0x13d1('0xe')]=_0x484944;this[_0x13d1('0xf')]=_0x484944[_0x13d1('0xf')];this[_0x13d1('0x10')]=_0x484944[_0x13d1('0x10')];}Report[_0x13d1('0x11')][_0x13d1('0x12')]=function(_0x3783bc){var _0x4121c1=new VoiceQueueReport(this[_0x13d1('0xe')]);var _0x5e223e=new VoiceAgentReport(this[_0x13d1('0xe')]);var _0x3df3b1=new VoiceDialReport(this[_0x13d1('0xe')]);var _0x1daaac=new VoiceCallReport(this[_0x13d1('0xe')]);var _0x505df5=new UserReport(this[_0x13d1('0xe')]);if(config[_0x13d1('0x13')]&&config[_0x13d1('0x13')][_0x13d1('0x14')]){ami['on'](_0x13d1('0x15'),this[_0x13d1('0x16')][_0x13d1('0x17')](this));ami['on'](_0x13d1('0x18'),this[_0x13d1('0x19')][_0x13d1('0x17')](this));ami['on'](_0x13d1('0x1a'),this[_0x13d1('0x1b')][_0x13d1('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x13d1('0x1c')]['bind'](this));ami['on']('blindtransfer',this[_0x13d1('0x1d')][_0x13d1('0x17')](this));ami['on'](_0x13d1('0x1e'),this['attendedTransfer'][_0x13d1('0x17')](this));}};Report['prototype'][_0x13d1('0x1f')]=function(_0x55f02e){var _0x1d0926;_0x1d0926=_[_0x13d1('0x20')](this[_0x13d1('0xf')],function(_0x5ba9c3){return _0x5ba9c3[_0x13d1('0x21')]==_0x55f02e||_0x5ba9c3[_0x13d1('0x22')]==_0x55f02e;});if(_[_0x13d1('0x23')](_0x1d0926)){var _0x167274=_['find'](this[_0x13d1('0x10')],function(_0x5578eb){return _0x5578eb[_0x13d1('0x21')]==_0x55f02e||_0x5578eb['name']==_0x55f02e;});if(_0x167274){_0x1d0926=_[_0x13d1('0x20')](this[_0x13d1('0xf')],function(_0x2dcf9b){return _0x2dcf9b[_0x13d1('0x24')]==util[_0x13d1('0x25')](_0x13d1('0x26'),_0x167274[_0x13d1('0x22')]);});}}return _0x1d0926;};Report[_0x13d1('0x11')]['voiceQueueReport']=function(_0xac9c86){for(var _0x372ad3=0x0;_0x372ad3<_0xac9c86[_0x13d1('0x27')];_0x372ad3+=0x1){var _0x4df05e=this[_0x13d1('0x1f')](_0xac9c86[_0x372ad3]['connectedlinenum']);if(_0x4df05e){_0xac9c86[_0x372ad3][_0x13d1('0x21')]=_0x4df05e[_0x13d1('0x21')];_0xac9c86[_0x372ad3]['assigned']=!![];_0xac9c86[_0x372ad3][_0x13d1('0x28')]=_0x4df05e[_0x13d1('0x22')];_0xac9c86[_0x372ad3][_0x13d1('0x24')]=_['isNil'](_0x4df05e[_0x13d1('0x24')])?util[_0x13d1('0x25')](_0x13d1('0x26'),_0x4df05e[_0x13d1('0x22')]):_0x4df05e[_0x13d1('0x24')];if(_0xac9c86[_0x372ad3]['queuecallercomplete']){_0xac9c86[_0x372ad3]['queuecallercompleteAt']=moment()[_0x13d1('0x25')](_0x13d1('0x29'));}if(_0xac9c86[_0x372ad3][_0x13d1('0x2a')]){_0xac9c86[_0x372ad3][_0x13d1('0x2b')]=moment()[_0x13d1('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x13d1('0x16')](_0xac9c86[_0x372ad3]);}RpcVoiceQueueReport['create'](_0xac9c86[_0x372ad3]);}};function extractCalleridNumber(_0x434f05){var _0x5c3db1=_0x434f05[_0x13d1('0x2c')](/<(.*?)>/);return _0x5c3db1?_0x5c3db1[0x1]:_0x434f05;}Report['prototype'][_0x13d1('0x2d')]=function(_0x5b1bc4){for(var _0x2150c5=0x0;_0x2150c5','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','type','getCallType','UserId','membername','create','monitorFilename','monitors','filename','createdAt','exten','connectedlinename','isArray','startsWith','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceAgentReport','./userReport','realtime','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','agents','accountcode','name','interface','format','SIP/%s','length','assigned','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','getAgentByInternal','keys','channel','split','voiceCallReport','destination','dialer','queue','lastdata','context','from-voip-provider'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x6936,0x76));var _0x6693=function(_0x33a6ed,_0x4989c6){_0x33a6ed=_0x33a6ed-0x0;var _0xec8856=_0x6936[_0x33a6ed];return _0xec8856;};'use strict';var _=require(_0x6693('0x0'));var moment=require(_0x6693('0x1'));var util=require(_0x6693('0x2'));var config=require('../../../config/environment');var ami=require(_0x6693('0x3'));var RpcVoiceAgentReport=require(_0x6693('0x4'));var RpcVoiceCallReport=require(_0x6693('0x5'));var RpcVoiceDialReport=require(_0x6693('0x6'));var RpcMemberReport=require(_0x6693('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x6693('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x6693('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x6693('0xa'));function Report(_0x240b9e){this[_0x6693('0xb')]=_0x240b9e;this['agents']=_0x240b9e['agents'];this[_0x6693('0xc')]=_0x240b9e[_0x6693('0xc')];}Report['prototype'][_0x6693('0xd')]=function(_0xca5c3a){var _0x45945c=new VoiceQueueReport(this['realtime']);var _0x1f420a=new VoiceAgentReport(this[_0x6693('0xb')]);var _0xb4cbed=new VoiceDialReport(this[_0x6693('0xb')]);var _0x53451e=new VoiceCallReport(this[_0x6693('0xb')]);var _0xf03442=new UserReport(this[_0x6693('0xb')]);if(config[_0x6693('0xe')]&&config[_0x6693('0xe')][_0x6693('0xf')]){ami['on'](_0x6693('0x10'),this[_0x6693('0x11')]['bind'](this));ami['on'](_0x6693('0x12'),this['voiceCallReport'][_0x6693('0x13')](this));ami['on'](_0x6693('0x14'),this['voiceAgentReport'][_0x6693('0x13')](this));ami['on'](_0x6693('0x15'),this[_0x6693('0x16')][_0x6693('0x13')](this));ami['on'](_0x6693('0x17'),this['blindTransfer'][_0x6693('0x13')](this));ami['on'](_0x6693('0x18'),this[_0x6693('0x19')][_0x6693('0x13')](this));}};Report[_0x6693('0x1a')][_0x6693('0x1b')]=function(_0x1ce8d9){var _0x3f6505;_0x3f6505=_[_0x6693('0x1c')](this[_0x6693('0x1d')],function(_0x45e73f){return _0x45e73f[_0x6693('0x1e')]==_0x1ce8d9||_0x45e73f[_0x6693('0x1f')]==_0x1ce8d9;});if(_['isNil'](_0x3f6505)){var _0x220517=_[_0x6693('0x1c')](this[_0x6693('0xc')],function(_0xe03b61){return _0xe03b61[_0x6693('0x1e')]==_0x1ce8d9||_0xe03b61[_0x6693('0x1f')]==_0x1ce8d9;});if(_0x220517){_0x3f6505=_[_0x6693('0x1c')](this[_0x6693('0x1d')],function(_0x11a9cd){return _0x11a9cd[_0x6693('0x20')]==util[_0x6693('0x21')](_0x6693('0x22'),_0x220517['name']);});}}return _0x3f6505;};Report[_0x6693('0x1a')]['voiceQueueReport']=function(_0x1fd7fa){for(var _0x11633a=0x0;_0x11633a<_0x1fd7fa[_0x6693('0x23')];_0x11633a+=0x1){var _0x54fd1c=this['findAgent'](_0x1fd7fa[_0x11633a]['connectedlinenum']);if(_0x54fd1c){_0x1fd7fa[_0x11633a][_0x6693('0x1e')]=_0x54fd1c[_0x6693('0x1e')];_0x1fd7fa[_0x11633a][_0x6693('0x24')]=!![];_0x1fd7fa[_0x11633a]['lastAssignedTo']=_0x54fd1c[_0x6693('0x1f')];_0x1fd7fa[_0x11633a][_0x6693('0x20')]=_[_0x6693('0x25')](_0x54fd1c['interface'])?util[_0x6693('0x21')](_0x6693('0x22'),_0x54fd1c[_0x6693('0x1f')]):_0x54fd1c['interface'];if(_0x1fd7fa[_0x11633a][_0x6693('0x26')]){_0x1fd7fa[_0x11633a][_0x6693('0x27')]=moment()['format'](_0x6693('0x28'));}if(_0x1fd7fa[_0x11633a]['queuecallerexit']){_0x1fd7fa[_0x11633a][_0x6693('0x29')]=moment()[_0x6693('0x21')](_0x6693('0x28'));}RpcMemberReport[_0x6693('0x11')](_0x1fd7fa[_0x11633a]);}RpcVoiceQueueReport['create'](_0x1fd7fa[_0x11633a]);}};function extractCalleridNumber(_0x742fcc){var _0x2f5878=_0x742fcc[_0x6693('0x2a')](/<(.*?)>/);return _0x2f5878?_0x2f5878[0x1]:_0x742fcc;}Report[_0x6693('0x1a')][_0x6693('0x2b')]=function(_0x351a91){for(var _0x521d7c=0x0;_0x521d7c0x0?_0x16cf59:0x0;this['voiceQueues'][_0x207f6f['queue']][_0x16b6('0x56')]=this['voiceQueues'][_0x207f6f[_0x16b6('0x66')]][_0x16b6('0x56')]>_[_0x16b6('0x6d')](_0x207f6f[_0x16b6('0x6b')])?_[_0x16b6('0x6d')](_0x207f6f[_0x16b6('0x6b')]):this[_0x16b6('0x12')][_0x207f6f[_0x16b6('0x66')]][_0x16b6('0x56')];this[_0x16b6('0x51')](this[_0x16b6('0x12')][_0x207f6f[_0x16b6('0x66')]],_0x16b6('0x15'));}logger[_0x16b6('0x4e')](_0x16b6('0x6e'),util['inspect'](this[_0x16b6('0x12')][_0x207f6f['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x16b6('0x6f'),this[_0x16b6('0x12')][_0x207f6f[_0x16b6('0x66')]]);}}}catch(_0xb49694){logger[_0x16b6('0x39')](_0x16b6('0x64'),util[_0x16b6('0x3b')](_0xb49694,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16b6('0x32')]['syncQueueSummaryComplete']=function(_0x5119e0){logger[_0x16b6('0x4e')](_0x16b6('0x70'),util[_0x16b6('0x3b')](_0x5119e0,{'showHidden':![],'depth':null}));ami[_0x16b6('0x45')]('custom:queuesummarycomplete',{});this[_0x16b6('0x13')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x5bd572){try{if(this[_0x16b6('0x65')](_0x5bd572)){logger[_0x16b6('0x4e')](_0x16b6('0x71'),_0x5bd572['uniqueid'],util['inspect'](_0x5bd572,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x16b6('0xf')][_0x5bd572[_0x16b6('0x48')]]))this['queueReports'][_0x5bd572['uniqueid']]=[];if(_[_0x16b6('0x5f')](this['channels'][_0x5bd572['uniqueid']]))this[_0x16b6('0x10')][_0x5bd572[_0x16b6('0x48')]]={};var _0x3126dd=new QueueReport();_0x3126dd[_0x16b6('0x4b')]=_0x5bd572[_0x16b6('0x66')];_0x3126dd[_0x16b6('0x52')]=this[_0x16b6('0x12')][_0x3126dd[_0x16b6('0x4b')]]&&this[_0x16b6('0x12')][_0x3126dd['name']][_0x16b6('0x52')]?this[_0x16b6('0x12')][_0x3126dd[_0x16b6('0x4b')]][_0x16b6('0x52')]||_0x16b6('0x72'):'inbound';_0x3126dd[_0x16b6('0x66')]=_0x5bd572[_0x16b6('0x66')];_0x3126dd[_0x16b6('0x73')]=moment()[_0x16b6('0x49')](_0x16b6('0x74'));_0x3126dd['position']=_0x5bd572[_0x16b6('0x75')];_0x3126dd['count']=_0x5bd572[_0x16b6('0x76')];_0x3126dd[_0x16b6('0x48')]=_0x5bd572[_0x16b6('0x48')];_0x3126dd['routealias']=this[_0x16b6('0x10')][_0x5bd572[_0x16b6('0x48')]]['routealias'];logger[_0x16b6('0x68')](_0x16b6('0x77'),_0x3126dd['name'],_0x3126dd[_0x16b6('0x52')]);_[_0x16b6('0x78')](_0x3126dd,_[_0x16b6('0x79')](_0x5bd572,_[_0x16b6('0x7a')](_0x3126dd)));this[_0x16b6('0xf')][_0x5bd572[_0x16b6('0x48')]][_0x16b6('0x7b')](_0x3126dd);this['channels'][_0x5bd572[_0x16b6('0x48')]]=_0x3126dd;this[_0x16b6('0x7c')](_0x3126dd,'queuecallerjoin');}}catch(_0x433f80){logger[_0x16b6('0x39')](_0x16b6('0x71'),_0x5bd572[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x433f80,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16b6('0x32')][_0x16b6('0x1c')]=function(_0x4057e1){try{if(this[_0x16b6('0x65')](_0x4057e1)){logger[_0x16b6('0x4e')](_0x16b6('0x7d'),_0x4057e1['uniqueid'],util[_0x16b6('0x3b')](_0x4057e1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4057e1['uniqueid']]){var _0x210415=_['last'](this[_0x16b6('0xf')][_0x4057e1[_0x16b6('0x48')]]);_0x210415['queuecallercomplete']=![];_0x210415[_0x16b6('0x7e')]=null;_0x210415[_0x16b6('0x7f')]=_0x4057e1[_0x16b6('0x7f')];_0x210415['originalposition']=_0x4057e1[_0x16b6('0x80')];_0x210415[_0x16b6('0x1b')]=!![];_0x210415[_0x16b6('0x81')]=moment()[_0x16b6('0x49')](_0x16b6('0x74'));_0x210415[_0x16b6('0x50')]='ABANDONED';_0x210415[_0x16b6('0x82')]=null;logger[_0x16b6('0x68')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x210415[_0x16b6('0x4b')],_0x210415[_0x16b6('0x52')]);this[_0x16b6('0x10')][_0x4057e1[_0x16b6('0x48')]]=_0x210415;this[_0x16b6('0x43')](_0x210415,_0x16b6('0x1b'));}}}catch(_0x22e8e0){logger[_0x16b6('0x39')](_0x16b6('0x7d'),_0x4057e1[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x22e8e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16b6('0x1e')]=function(_0x272f9b){try{if(this[_0x16b6('0x65')](_0x272f9b)){logger['debug'](_0x16b6('0x83'),_0x272f9b[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x272f9b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x272f9b['uniqueid']]){var _0x530c95=_['last'](this[_0x16b6('0xf')][_0x272f9b[_0x16b6('0x48')]]);_0x530c95[_0x16b6('0x84')]=moment()['format'](_0x16b6('0x74'));_0x530c95['connectedlinenum']=_0x272f9b[_0x16b6('0x85')];_0x530c95[_0x16b6('0x86')]=_0x272f9b['connectedlinename'];logger[_0x16b6('0x68')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x530c95[_0x16b6('0x4b')],_0x530c95['type'],_0x272f9b[_0x16b6('0x85')],_0x272f9b[_0x16b6('0x86')]);this[_0x16b6('0x10')][_0x272f9b['uniqueid']]=_0x530c95;this[_0x16b6('0x7c')](_0x530c95,'queuecallerleave');}}}catch(_0x172f70){logger[_0x16b6('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0x272f9b['uniqueid'],util[_0x16b6('0x3b')](_0x172f70,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16b6('0x32')]['syncAgentConnect']=function(_0x5edca9){try{if(this[_0x16b6('0x65')](_0x5edca9)){logger['debug'](_0x16b6('0x87'),_0x5edca9[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x5edca9,{'showHidden':![],'depth':null}));if(this[_0x16b6('0xf')][_0x5edca9[_0x16b6('0x48')]]){var _0x5a0be2=_[_0x16b6('0x88')](this[_0x16b6('0xf')][_0x5edca9['uniqueid']]);_0x5a0be2[_0x16b6('0x89')]=!![];_0x5a0be2[_0x16b6('0x50')]='COMPLETEDBYAGENT';logger[_0x16b6('0x68')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5a0be2[_0x16b6('0x4b')],_0x5a0be2['type']);}}}catch(_0x317679){logger[_0x16b6('0x39')](_0x16b6('0x87'),_0x5edca9[_0x16b6('0x48')],util['inspect'](_0x317679,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16b6('0x32')][_0x16b6('0x20')]=function(_0x470624){try{if(this['isNotNull'](_0x470624)){logger['debug'](_0x16b6('0x8a'),_0x470624[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x470624,{'showHidden':![],'depth':null}));if(this[_0x16b6('0xf')][_0x470624[_0x16b6('0x48')]]){var _0x454d36=_['last'](this['queueReports'][_0x470624[_0x16b6('0x48')]]);_0x454d36['queuecallerabandon']=![];_0x454d36[_0x16b6('0x81')]=null;_0x454d36[_0x16b6('0x8b')]=!![];_0x454d36['lastAssignedTo']=_0x470624[_0x16b6('0x8c')];_0x454d36['holdtime']=_0x470624[_0x16b6('0x7f')];_0x454d36[_0x16b6('0x89')]=!![];_0x454d36[_0x16b6('0x8d')]=![];_0x454d36[_0x16b6('0x8e')]=null;if(!_0x454d36[_0x16b6('0x8f')]){if(_0x470624[_0x16b6('0x90')]==_0x16b6('0x8f')){_0x454d36[_0x16b6('0x50')]=_0x16b6('0x91');logger[_0x16b6('0x68')](_0x16b6('0x92'),_0x454d36['name'],_0x454d36['type']);}else{if(_[_0x16b6('0x93')](_0x470624[_0x16b6('0x35')][_0x16b6('0x94')](),'local/')){if(this[_0x16b6('0xf')][_0x470624[_0x16b6('0x95')]]){var _0x4d3b76=_[_0x16b6('0x88')](this[_0x16b6('0xf')][_0x470624[_0x16b6('0x95')]]);_0x4d3b76['queuecallercomplete']=![];_0x4d3b76['queuecallerexit']=!![];_0x4d3b76[_0x16b6('0x8e')]=moment(_0x454d36[_0x16b6('0x73')])[_0x16b6('0x96')](_0x470624[_0x16b6('0x7f')],_0x16b6('0x97'))['format'](_0x16b6('0x74'));_0x4d3b76[_0x16b6('0x50')]='FORWARDTRANSFER';_0x4d3b76[_0x16b6('0x8f')]=!![];_0x4d3b76[_0x16b6('0x98')]=_0x16b6('0x99');_0x4d3b76[_0x16b6('0x9a')]=_0x470624[_0x16b6('0x9b')];_0x4d3b76[_0x16b6('0x9c')]=_0x470624['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4d3b76[_0x16b6('0x4b')],_0x4d3b76[_0x16b6('0x52')]);var _0x2f1b3f=this['queueReports'][_0x470624[_0x16b6('0x95')]];this[_0x16b6('0xf')][_0x470624['linkedid']]=this[_0x16b6('0xf')][_0x470624[_0x16b6('0x48')]];this['queueReports'][_0x470624[_0x16b6('0x48')]]=_0x2f1b3f;}}else{_0x454d36[_0x16b6('0x50')]=_0x16b6('0x9d')+_0x470624[_0x16b6('0x90')]['toUpperCase']();logger[_0x16b6('0x68')](_0x16b6('0x9e'),_0x454d36['name'],_0x454d36[_0x16b6('0x52')],_0x454d36[_0x16b6('0x50')]);}}}this[_0x16b6('0x10')][_0x470624['uniqueid']]=_0x454d36;this[_0x16b6('0x43')](_0x454d36,_0x16b6('0x1f'));}}}catch(_0x32901b){logger[_0x16b6('0x39')](_0x16b6('0x8a'),_0x470624[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x32901b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16b6('0x32')][_0x16b6('0x22')]=function(_0x334ebc){try{if(this[_0x16b6('0x65')](_0x334ebc)){logger[_0x16b6('0x4e')](_0x16b6('0x9f'),_0x334ebc[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x334ebc,{'showHidden':![],'depth':null}));this[_0x16b6('0xa0')](_0x334ebc[_0x16b6('0x48')],_[_0x16b6('0x7a')](_0x334ebc[_0x16b6('0xa1')])[0x0],_0x334ebc[_0x16b6('0xa2')]);if(this['queueReports'][_0x334ebc['uniqueid']]){var _0x5da127=_[_0x16b6('0x88')](this['queueReports'][_0x334ebc[_0x16b6('0x48')]]);if(_0x5da127){if(this['isNotNull'](_0x334ebc['variable'])&&this[_0x16b6('0x65')](_0x334ebc[_0x16b6('0xa1')][_0x16b6('0xa3')])){switch(_0x334ebc['value']){case _0x16b6('0xa4'):_0x5da127[_0x16b6('0x8d')]=![];_0x5da127['queuecallerexitAt']=null;break;case _0x16b6('0xa5'):_0x5da127[_0x16b6('0xa6')]=_0x16b6('0xa7');_0x5da127[_0x16b6('0x8d')]=!![];_0x5da127[_0x16b6('0x8e')]=moment()[_0x16b6('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x5da127[_0x16b6('0x84')]=moment()['format'](_0x16b6('0x74'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x334ebc['uniqueid'],util[_0x16b6('0x3b')](_0x5da127,{'showHidden':![],'depth':null}));ami['emit'](_0x16b6('0xa8'),_0x5da127);break;default:_0x5da127[_0x16b6('0x8d')]=!![];_0x5da127['queuecallerexitAt']=moment()[_0x16b6('0x49')](_0x16b6('0x74'));_0x5da127[_0x16b6('0x84')]=moment()[_0x16b6('0x49')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5da127[_0x16b6('0x1b')]=![];_0x5da127[_0x16b6('0x81')]=null;_0x5da127[_0x16b6('0x50')]=_0x334ebc[_0x16b6('0xa2')];this[_0x16b6('0x10')][_0x334ebc['uniqueid']]=_0x5da127;this[_0x16b6('0x43')](_0x5da127,_0x16b6('0xa9'));}else if(this[_0x16b6('0x65')](_0x334ebc[_0x16b6('0xa1')])&&this[_0x16b6('0x65')](_0x334ebc[_0x16b6('0xa1')][_0x16b6('0xaa')])){if(!_0x5da127['queuecallerabandon']){_0x5da127['queuecallerexit']=!![];_0x5da127['queuecallerexitAt']=moment()[_0x16b6('0x49')](_0x16b6('0x74'));_0x5da127['queuecallerexitreason']=_0x16b6('0xab');_0x5da127[_0x16b6('0x84')]=moment()[_0x16b6('0x49')](_0x16b6('0x74'));this[_0x16b6('0x10')][_0x334ebc[_0x16b6('0x48')]]=_0x5da127;}}logger['info'](_0x16b6('0xac'),_0x334ebc[_0x16b6('0x48')],_0x5da127[_0x16b6('0x4b')],_0x5da127[_0x16b6('0x52')],_[_0x16b6('0x7a')](_0x334ebc[_0x16b6('0xa1')])[0x0],_0x334ebc[_0x16b6('0xa2')]);_0x5da127['variables']=this[_0x16b6('0x3d')][_0x334ebc['uniqueid']];}}}}catch(_0x1c2ef8){logger[_0x16b6('0x39')]('[%s][voiceQueueReport][varset]',_0x334ebc[_0x16b6('0x48')],util[_0x16b6('0x3b')](_0x1c2ef8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16b6('0x32')][_0x16b6('0xa0')]=function(_0x2c835a,_0x5ca746,_0x762bbb){var _0x2da872=[_0x16b6('0xad'),_0x16b6('0xae'),'rtpaudioqosjitter',_0x16b6('0xaf'),_0x16b6('0xb0'),_0x16b6('0xb1'),_0x16b6('0xb2'),_0x16b6('0xb3'),'sipcallid',_0x16b6('0xb4'),_0x16b6('0xb5'),'bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall',_0x16b6('0x8c'),_0x16b6('0xb6'),_0x16b6('0xb7')];if(!_[_0x16b6('0x34')](_0x5ca746)&&!_['includes'](_0x2da872,_0x5ca746)){if(_[_0x16b6('0x5f')](this[_0x16b6('0x3d')][_0x2c835a])){this['variables'][_0x2c835a]={};}this[_0x16b6('0x3d')][_0x2c835a][_0x5ca746]=_0x762bbb;}};VoiceQueueReport['prototype'][_0x16b6('0xb8')]=function(_0x5e157c,_0x3817a9,_0x1c2319){var _0x29aa0d={};for(var _0x38d2a2=0x0;_0x38d2a20x0?_0x5ea0c2:0x0;this[_0xe147('0x12')][_0x54084b[_0xe147('0x6c')]][_0xe147('0x5c')]=this[_0xe147('0x12')][_0x54084b[_0xe147('0x6c')]]['talking']>_[_0xe147('0x70')](_0x54084b[_0xe147('0x71')])?_['toNumber'](_0x54084b[_0xe147('0x71')]):this[_0xe147('0x12')][_0x54084b[_0xe147('0x6c')]]['talking'];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x54084b[_0xe147('0x6c')]],_0xe147('0x6a'));}logger[_0xe147('0x4a')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0xe147('0x12')][_0x54084b['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0xe147('0x73'),this[_0xe147('0x12')][_0x54084b[_0xe147('0x6c')]]);}}}catch(_0x5a4a86){logger[_0xe147('0x40')](_0xe147('0x6b'),util[_0xe147('0x3e')](_0x5a4a86,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe147('0xb')][_0xe147('0x17')]=function(_0x130630){logger['debug'](_0xe147('0x74'),util[_0xe147('0x3e')](_0x130630,{'showHidden':![],'depth':null}));ami[_0xe147('0x48')](_0xe147('0x75'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0xe147('0xb')][_0xe147('0x19')]=function(_0x34f393){try{if(this[_0xe147('0x64')](_0x34f393)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x34f393[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x34f393,{'showHidden':![],'depth':null}));if(_[_0xe147('0x65')](this['queueReports'][_0x34f393[_0xe147('0x4d')]]))this[_0xe147('0x3f')][_0x34f393[_0xe147('0x4d')]]=[];if(_['isUndefined'](this[_0xe147('0x35')][_0x34f393['uniqueid']]))this['channels'][_0x34f393[_0xe147('0x4d')]]={};var _0x2fcbb4=new QueueReport();_0x2fcbb4[_0xe147('0x53')]=_0x34f393[_0xe147('0x6c')];_0x2fcbb4[_0xe147('0x76')]=this[_0xe147('0x12')][_0x2fcbb4[_0xe147('0x53')]]&&this[_0xe147('0x12')][_0x2fcbb4[_0xe147('0x53')]][_0xe147('0x76')]?this[_0xe147('0x12')][_0x2fcbb4['name']][_0xe147('0x76')]||_0xe147('0x56'):_0xe147('0x56');_0x2fcbb4[_0xe147('0x6c')]=_0x34f393['queue'];_0x2fcbb4[_0xe147('0x77')]=moment()['format'](_0xe147('0x78'));_0x2fcbb4['position']=_0x34f393[_0xe147('0x79')];_0x2fcbb4[_0xe147('0x7a')]=_0x34f393[_0xe147('0x7a')];_0x2fcbb4[_0xe147('0x4d')]=_0x34f393[_0xe147('0x4d')];_0x2fcbb4['routealias']=this[_0xe147('0x35')][_0x34f393[_0xe147('0x4d')]][_0xe147('0x7b')];logger[_0xe147('0x6d')](_0xe147('0x7c'),_0x2fcbb4[_0xe147('0x53')],_0x2fcbb4[_0xe147('0x76')]);_[_0xe147('0x7d')](_0x2fcbb4,_[_0xe147('0x7e')](_0x34f393,_[_0xe147('0x7f')](_0x2fcbb4)));this[_0xe147('0x3f')][_0x34f393[_0xe147('0x4d')]]['push'](_0x2fcbb4);this[_0xe147('0x35')][_0x34f393['uniqueid']]=_0x2fcbb4;this['emitVoiceQueueChannelSave'](_0x2fcbb4,_0xe147('0x18'));}}catch(_0x4b7783){logger[_0xe147('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x34f393[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x4b7783,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe147('0xb')]['syncQueueCallerAbandon']=function(_0xcb0d2f){try{if(this[_0xe147('0x64')](_0xcb0d2f)){logger[_0xe147('0x4a')](_0xe147('0x80'),_0xcb0d2f[_0xe147('0x4d')],util[_0xe147('0x3e')](_0xcb0d2f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xcb0d2f[_0xe147('0x4d')]]){var _0x559918=_[_0xe147('0x81')](this[_0xe147('0x3f')][_0xcb0d2f[_0xe147('0x4d')]]);_0x559918[_0xe147('0x82')]=![];_0x559918[_0xe147('0x83')]=null;_0x559918[_0xe147('0x84')]=_0xcb0d2f['holdtime'];_0x559918['originalposition']=_0xcb0d2f[_0xe147('0x85')];_0x559918[_0xe147('0x1a')]=!![];_0x559918[_0xe147('0x86')]=moment()[_0xe147('0x4e')](_0xe147('0x78'));_0x559918['queuecallerexitreason']='ABANDONED';_0x559918['lastAssignedTo']=null;logger[_0xe147('0x6d')](_0xe147('0x87'),_0x559918[_0xe147('0x53')],_0x559918[_0xe147('0x76')]);this[_0xe147('0x35')][_0xcb0d2f[_0xe147('0x4d')]]=_0x559918;this['emitVoiceQueueChannelRemove'](_0x559918,_0xe147('0x1a'));}}}catch(_0x216014){logger[_0xe147('0x40')](_0xe147('0x80'),_0xcb0d2f[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x216014,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe147('0xb')][_0xe147('0x88')]=function(_0x442d9c){try{if(this[_0xe147('0x64')](_0x442d9c)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x442d9c[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x442d9c,{'showHidden':![],'depth':null}));if(this[_0xe147('0x3f')][_0x442d9c[_0xe147('0x4d')]]){var _0x1e2aa6=_[_0xe147('0x81')](this[_0xe147('0x3f')][_0x442d9c[_0xe147('0x4d')]]);_0x1e2aa6[_0xe147('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1e2aa6[_0xe147('0x8a')]=_0x442d9c[_0xe147('0x8a')];_0x1e2aa6[_0xe147('0x8b')]=_0x442d9c[_0xe147('0x8b')];logger[_0xe147('0x6d')](_0xe147('0x8c'),_0x1e2aa6[_0xe147('0x53')],_0x1e2aa6[_0xe147('0x76')],_0x442d9c[_0xe147('0x8a')],_0x442d9c['connectedlinename']);this[_0xe147('0x35')][_0x442d9c[_0xe147('0x4d')]]=_0x1e2aa6;this[_0xe147('0x49')](_0x1e2aa6,_0xe147('0x1c'));}}}catch(_0x24f718){logger[_0xe147('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x442d9c[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x24f718,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe147('0xb')]['syncAgentConnect']=function(_0x176232){try{if(this[_0xe147('0x64')](_0x176232)){logger['debug'](_0xe147('0x8d'),_0x176232[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x176232,{'showHidden':![],'depth':null}));if(this[_0xe147('0x3f')][_0x176232['uniqueid']]){var _0x46c8f3=_[_0xe147('0x81')](this[_0xe147('0x3f')][_0x176232[_0xe147('0x4d')]]);_0x46c8f3['queuecallercomplete']=!![];_0x46c8f3['queuecallerexitreason']=_0xe147('0x8e');logger[_0xe147('0x6d')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x46c8f3[_0xe147('0x53')],_0x46c8f3['type']);}}}catch(_0x572f5c){logger['error'](_0xe147('0x8d'),_0x176232[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x572f5c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe147('0xb')][_0xe147('0x1e')]=function(_0x591674){try{if(this[_0xe147('0x64')](_0x591674)){logger[_0xe147('0x4a')](_0xe147('0x8f'),_0x591674[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x591674,{'showHidden':![],'depth':null}));if(this[_0xe147('0x3f')][_0x591674['uniqueid']]){var _0x40c479=_[_0xe147('0x81')](this['queueReports'][_0x591674['uniqueid']]);_0x40c479[_0xe147('0x1a')]=![];_0x40c479[_0xe147('0x86')]=null;_0x40c479[_0xe147('0x90')]=!![];_0x40c479['lastAssignedTo']=_0x591674[_0xe147('0x91')];_0x40c479[_0xe147('0x84')]=_0x591674[_0xe147('0x84')];_0x40c479[_0xe147('0x82')]=!![];_0x40c479[_0xe147('0x92')]=![];_0x40c479[_0xe147('0x93')]=null;if(!_0x40c479['transfer']){if(_0x591674['reason']==_0xe147('0x94')){_0x40c479['queuecallerexitreason']='COMPLETED';logger['info'](_0xe147('0x95'),_0x40c479['name'],_0x40c479[_0xe147('0x76')]);}else{if(_[_0xe147('0x96')](_0x591674[_0xe147('0x39')][_0xe147('0x97')](),_0xe147('0x98'))){if(this[_0xe147('0x3f')][_0x591674[_0xe147('0x99')]]){var _0x408e09=_[_0xe147('0x81')](this['queueReports'][_0x591674['linkedid']]);_0x408e09['queuecallercomplete']=![];_0x408e09[_0xe147('0x92')]=!![];_0x408e09[_0xe147('0x93')]=moment(_0x40c479[_0xe147('0x77')])['add'](_0x591674[_0xe147('0x84')],_0xe147('0x9a'))[_0xe147('0x4e')](_0xe147('0x78'));_0x408e09[_0xe147('0x9b')]='FORWARDTRANSFER';_0x408e09[_0xe147('0x94')]=!![];_0x408e09[_0xe147('0x9c')]=_0xe147('0x9d');_0x408e09[_0xe147('0x9e')]=_0x591674['destexten'];_0x408e09['transferuniqueid']=_0x591674['uniqueid'];logger[_0xe147('0x6d')](_0xe147('0x9f'),_0x408e09[_0xe147('0x53')],_0x408e09[_0xe147('0x76')]);var _0x11f3d0=this[_0xe147('0x3f')][_0x591674[_0xe147('0x99')]];this['queueReports'][_0x591674['linkedid']]=this[_0xe147('0x3f')][_0x591674[_0xe147('0x4d')]];this[_0xe147('0x3f')][_0x591674[_0xe147('0x4d')]]=_0x11f3d0;}}else{_0x40c479[_0xe147('0x9b')]='COMPLETEDBY'+_0x591674[_0xe147('0xa0')][_0xe147('0xa1')]();logger[_0xe147('0x6d')](_0xe147('0xa2'),_0x40c479[_0xe147('0x53')],_0x40c479['type'],_0x40c479[_0xe147('0x9b')]);}}}this[_0xe147('0x35')][_0x591674['uniqueid']]=_0x40c479;this[_0xe147('0x46')](_0x40c479,_0xe147('0x1d'));}}}catch(_0x539816){logger[_0xe147('0x40')](_0xe147('0x8f'),_0x591674[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x539816,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe147('0x21')]=function(_0x5bead3){try{if(this[_0xe147('0x64')](_0x5bead3)){logger[_0xe147('0x4a')]('[%s][voiceQueueReport][varset]',_0x5bead3[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x5bead3,{'showHidden':![],'depth':null}));this[_0xe147('0xa3')](_0x5bead3['uniqueid'],_[_0xe147('0x7f')](_0x5bead3[_0xe147('0xa4')])[0x0],_0x5bead3[_0xe147('0xa5')]);if(this['queueReports'][_0x5bead3[_0xe147('0x4d')]]){var _0x586e18=_[_0xe147('0x81')](this[_0xe147('0x3f')][_0x5bead3[_0xe147('0x4d')]]);if(_0x586e18){if(this[_0xe147('0x64')](_0x5bead3[_0xe147('0xa4')])&&this[_0xe147('0x64')](_0x5bead3[_0xe147('0xa4')]['queuestatus'])){switch(_0x5bead3[_0xe147('0xa5')]){case _0xe147('0xa6'):_0x586e18[_0xe147('0x92')]=![];_0x586e18[_0xe147('0x93')]=null;break;case _0xe147('0xa7'):_0x586e18['lastevent']=_0xe147('0xa8');_0x586e18[_0xe147('0x92')]=!![];_0x586e18[_0xe147('0x93')]=moment()['format'](_0xe147('0x78'));_0x586e18[_0xe147('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xe147('0x4a')](_0xe147('0xa9'),_0x5bead3[_0xe147('0x4d')],util[_0xe147('0x3e')](_0x586e18,{'showHidden':![],'depth':null}));ami['emit'](_0xe147('0xaa'),_0x586e18);break;default:_0x586e18['queuecallerexit']=!![];_0x586e18[_0xe147('0x93')]=moment()[_0xe147('0x4e')](_0xe147('0x78'));_0x586e18[_0xe147('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x586e18[_0xe147('0x1a')]=![];_0x586e18['queuecallerabandonAt']=null;_0x586e18[_0xe147('0x9b')]=_0x5bead3[_0xe147('0xa5')];this[_0xe147('0x35')][_0x5bead3['uniqueid']]=_0x586e18;this[_0xe147('0x46')](_0x586e18,_0xe147('0x20'));}else if(this[_0xe147('0x64')](_0x5bead3[_0xe147('0xa4')])&&this['isNotNull'](_0x5bead3['variable'][_0xe147('0xab')])){if(!_0x586e18[_0xe147('0x1a')]){_0x586e18[_0xe147('0x92')]=!![];_0x586e18[_0xe147('0x93')]=moment()[_0xe147('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x586e18[_0xe147('0x9b')]=_0xe147('0xac');_0x586e18['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe147('0x35')][_0x5bead3[_0xe147('0x4d')]]=_0x586e18;}}logger[_0xe147('0x6d')](_0xe147('0xad'),_0x5bead3[_0xe147('0x4d')],_0x586e18[_0xe147('0x53')],_0x586e18['type'],_[_0xe147('0x7f')](_0x5bead3[_0xe147('0xa4')])[0x0],_0x5bead3[_0xe147('0xa5')]);_0x586e18[_0xe147('0x42')]=this['variables'][_0x5bead3['uniqueid']];}}}}catch(_0x82483e){logger['error'](_0xe147('0xae'),_0x5bead3[_0xe147('0x4d')],util['inspect'](_0x82483e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x26cb9f,_0xbbff0,_0x44bdda){var _0x936c08=[_0xe147('0xaf'),_0xe147('0xb0'),_0xe147('0xb1'),_0xe147('0xb2'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0xe147('0xb3'),'rtpaudioqosrttbridged',_0xe147('0xb4'),_0xe147('0xb5'),_0xe147('0xb6'),_0xe147('0xb7'),'membercalls',_0xe147('0xb8'),'memberinterface',_0xe147('0xb9'),_0xe147('0x91'),_0xe147('0xba'),'memberrealtime'];if(!_[_0xe147('0x37')](_0xbbff0)&&!_[_0xe147('0xbb')](_0x936c08,_0xbbff0)){if(_['isUndefined'](this['variables'][_0x26cb9f])){this[_0xe147('0x42')][_0x26cb9f]={};}this[_0xe147('0x42')][_0x26cb9f][_0xbbff0]=_0x44bdda;}};VoiceQueueReport['prototype'][_0xe147('0xbc')]=function(_0x401b72,_0x3f94d4,_0x5c6567){var _0xb8ae51={};for(var _0xa80a7e=0x0;_0xa80a7e=0x0?moment(_0x58bd4e[_0xa091('0x18')])[_0xa091('0xf')](_0x58bd4e['starttime'],_0xa091('0x19')):null,'data1':_0xa091('0x1a'),'data2':_0x58bd4e[_0xa091('0x14')],'data3':_0x58bd4e[_0xa091('0x12')],'data4':_0x58bd4e[_0xa091('0x1b')]||null,'role':_0xa091('0x1c'),'internal':_0x58bd4e['accountcode']?_['toNumber'](_0x58bd4e[_0xa091('0x14')]):undefined,'uniqueid':_0x58bd4e[_0xa091('0x1d')]},'log':_0xa091('0x8')});}; \ No newline at end of file +var _0xa4fe=['agent','accountcode','toNumber','uniqueid','voiceDialReport','CreateMemberReport','membername','starttime','endtime','seconds','outbound','dialstring','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','calleridnum','exten'];(function(_0x3fe61b,_0xcb54c8){var _0x1584d9=function(_0x5a9b06){while(--_0x5a9b06){_0x3fe61b['push'](_0x3fe61b['shift']());}};_0x1584d9(++_0xcb54c8);}(_0xa4fe,0x1f2));var _0xea4f=function(_0x18a691,_0x14c811){_0x18a691=_0x18a691-0x0;var _0x3c9f41=_0xa4fe[_0x18a691];return _0x3c9f41;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xea4f('0x0'));var client=require('../client');exports[_0xea4f('0x1')]=function(_0x1957e6){var _0x457031=_0x1957e6[_0xea4f('0x2')]||_0x1957e6[_0xea4f('0x3')];return client[_0xea4f('0x4')]('CreateMemberReport',{'body':{'channel':_0xea4f('0x5'),'membername':_0x1957e6[_0xea4f('0x6')],'interface':_[_0xea4f('0x7')](_0x1957e6[_0xea4f('0x8')])?util['format'](_0xea4f('0x9'),_0x1957e6[_0xea4f('0x6')]):_0x1957e6[_0xea4f('0x8')],'type':_0xea4f('0xa'),'enterAt':_0x1957e6[_0xea4f('0xb')],'exitAt':_0x457031,'duration':moment(_0x457031)[_0xea4f('0xc')](_0x1957e6[_0xea4f('0xb')],'seconds'),'data1':'inbound','data2':_0x1957e6[_0xea4f('0xd')],'data3':_0x1957e6[_0xea4f('0xe')],'data4':null,'data5':_0x1957e6['queue'],'role':_0xea4f('0xf'),'internal':_0x1957e6[_0xea4f('0x10')]?_[_0xea4f('0x11')](_0x1957e6['accountcode']):undefined,'uniqueid':_0x1957e6[_0xea4f('0x12')]},'log':'CreateMemberReport'});};exports[_0xea4f('0x13')]=function(_0x1e6fda){return client[_0xea4f('0x4')](_0xea4f('0x14'),{'body':{'channel':_0xea4f('0x5'),'membername':_0x1e6fda[_0xea4f('0x15')],'interface':_0x1e6fda[_0xea4f('0x8')],'type':_0xea4f('0xa'),'enterAt':_0x1e6fda[_0xea4f('0x16')],'exitAt':_0x1e6fda[_0xea4f('0x17')],'duration':moment(_0x1e6fda[_0xea4f('0x17')])[_0xea4f('0xc')](_0x1e6fda[_0xea4f('0x16')],'seconds')>=0x0?moment(_0x1e6fda[_0xea4f('0x17')])[_0xea4f('0xc')](_0x1e6fda[_0xea4f('0x16')],_0xea4f('0x18')):null,'data1':_0xea4f('0x19'),'data2':_0x1e6fda[_0xea4f('0x10')],'data3':_0x1e6fda[_0xea4f('0xe')],'data4':_0x1e6fda[_0xea4f('0x1a')]||null,'role':'agent','internal':_0x1e6fda['accountcode']?_[_0xea4f('0x11')](_0x1e6fda[_0xea4f('0x10')]):undefined,'uniqueid':_0x1e6fda['uniqueid']},'log':_0xea4f('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 0f09fe2..6525e10 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 _0x60ca=['GetSettings','../client','getSettings','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x3d3a08,_0x543dd1){var _0x4cfa0b=function(_0x19cc6a){while(--_0x19cc6a){_0x3d3a08['push'](_0x3d3a08['shift']());}};_0x4cfa0b(++_0x543dd1);}(_0x60ca,0x92));var _0xa60c=function(_0x1abc19,_0x29a0e8){_0x1abc19=_0x1abc19-0x0;var _0x2434cd=_0x60ca[_0x1abc19];return _0x2434cd;};'use strict';var client=require(_0xa60c('0x0'));exports[_0xa60c('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa60c('0x2'),_0xa60c('0x3')]},'log':_0xa60c('0x4')});}; \ No newline at end of file +var _0x2f8b=['../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x566da5,_0x4e6ba4){var _0x24f5b6=function(_0x586e8c){while(--_0x586e8c){_0x566da5['push'](_0x566da5['shift']());}};_0x24f5b6(++_0x4e6ba4);}(_0x2f8b,0x96));var _0xb2f8=function(_0xa76466,_0x16fe49){_0xa76466=_0xa76466-0x0;var _0x4439df=_0x2f8b[_0xa76466];return _0x4439df;};'use strict';var client=require(_0xb2f8('0x0'));exports[_0xb2f8('0x1')]=function(){return client['Request'](_0xb2f8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb2f8('0x3'),_0xb2f8('0x4')]},'log':_0xb2f8('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0a553fc..0effe61 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 _0xc924=['../client','getTemplates','name','html','GetTemplate'];(function(_0x49905e,_0x1c9791){var _0x57d5dd=function(_0x84e957){while(--_0x84e957){_0x49905e['push'](_0x49905e['shift']());}};_0x57d5dd(++_0x1c9791);}(_0xc924,0x136));var _0x4c92=function(_0x1ad1a8,_0x3aa47d){_0x1ad1a8=_0x1ad1a8-0x0;var _0x32339b=_0xc924[_0x1ad1a8];return _0x32339b;};'use strict';var client=require(_0x4c92('0x0'));exports[_0x4c92('0x1')]=function(_0x406c5f){return function(_0x5556d9){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x4c92('0x2'),_0x4c92('0x3')]},'log':_0x4c92('0x4')});};}; \ No newline at end of file +var _0x4d32=['html','../client','Request','GetTemplate'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x4d32,0x1b9));var _0x24d3=function(_0x2042a4,_0x16f91e){_0x2042a4=_0x2042a4-0x0;var _0x233995=_0x4d32[_0x2042a4];return _0x233995;};'use strict';var client=require(_0x24d3('0x0'));exports['getTemplates']=function(_0x1a9bdd){return function(_0x4938d6){return client[_0x24d3('0x1')](_0x24d3('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x24d3('0x3')]},'log':_0x24d3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 57d3055..1887a73 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 _0xf4b1=['Actions','action','data1','data2','data3','data4','data6','../client','getTriggers','Request','GetTrigger','name','status','Condition','field','value','AnyConditions','operator','Action'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xf4b1,0x15d));var _0x1f4b=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xf4b1[_0x4709c0];return _0x13348b;};'use strict';var client=require(_0x1f4b('0x0'));exports[_0x1f4b('0x1')]=function(_0x1802e6){return function(_0x29d16f){return client[_0x1f4b('0x2')](_0x1f4b('0x3'),{'options':{'raw':![],'attributes':['id',_0x1f4b('0x4'),'channel',_0x1f4b('0x5')],'include':[{'model':_0x1f4b('0x6'),'as':'AllConditions','attributes':['id',_0x1f4b('0x7'),'operator',_0x1f4b('0x8')]},{'model':_0x1f4b('0x6'),'as':_0x1f4b('0x9'),'attributes':['id',_0x1f4b('0x7'),_0x1f4b('0xa'),_0x1f4b('0x8')]},{'model':_0x1f4b('0xb'),'as':_0x1f4b('0xc'),'attributes':['id',_0x1f4b('0xd'),_0x1f4b('0xe'),_0x1f4b('0xf'),_0x1f4b('0x10'),_0x1f4b('0x11'),'data5',_0x1f4b('0x12'),'data7']}]},'log':_0x1f4b('0x3')});};}; \ No newline at end of file +var _0xbef5=['../client','getTriggers','Request','GetTrigger','status','Condition','field','value','Action','Actions','data2','data4','data5','data6','data7'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbef5,0x1e0));var _0x5bef=function(_0x211409,_0x56651c){_0x211409=_0x211409-0x0;var _0x1d562=_0xbef5[_0x211409];return _0x1d562;};'use strict';var client=require(_0x5bef('0x0'));exports[_0x5bef('0x1')]=function(_0x1c5cd8){return function(_0x44c0a6){return client[_0x5bef('0x2')](_0x5bef('0x3'),{'options':{'raw':![],'attributes':['id','name','channel',_0x5bef('0x4')],'include':[{'model':_0x5bef('0x5'),'as':'AllConditions','attributes':['id',_0x5bef('0x6'),'operator',_0x5bef('0x7')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x5bef('0x6'),'operator','value']},{'model':_0x5bef('0x8'),'as':_0x5bef('0x9'),'attributes':['id','action','data1',_0x5bef('0xa'),'data3',_0x5bef('0xb'),_0x5bef('0xc'),_0x5bef('0xd'),_0x5bef('0xe')]}]},'log':_0x5bef('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 9e23de2..49a25d6 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 _0x3ed9=['getTrunks','Request','GetTrunk','registry','../client'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x3ed9,0xe0));var _0x93ed=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x3ed9[_0x12b8ec];return _0x21af77;};'use strict';var client=require(_0x93ed('0x0'));exports[_0x93ed('0x1')]=function(_0x3dddc5){return function(_0x38b805){return client[_0x93ed('0x2')](_0x93ed('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x93ed('0x4'),'defaultuser']},'log':_0x93ed('0x3')});};}; \ No newline at end of file +var _0xa882=['GetTrunk','../client','getTrunks','Request','name','registry','defaultuser'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xa882,0x135));var _0x2a88=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0xa882[_0x4bb145];return _0x4db596;};'use strict';var client=require(_0x2a88('0x0'));exports[_0x2a88('0x1')]=function(_0x4408e7){return function(_0x56402a){return client[_0x2a88('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2a88('0x3'),_0x2a88('0x4'),_0x2a88('0x5')]},'log':_0x2a88('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 14197b4..05302e4 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3ab8be,_0x350301){var _0xa42cc3=function(_0x194c1d){while(--_0x194c1d){_0x3ab8be['push'](_0x3ab8be['shift']());}};_0xa42cc3(++_0x350301);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +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(_0x5352d1,_0x2f4bb4){var _0x41b3b7=function(_0x16ac3d){while(--_0x16ac3d){_0x5352d1['push'](_0x5352d1['shift']());}};_0x41b3b7(++_0x2f4bb4);}(_0xedd9,0xfc));var _0x9edd=function(_0x2be49f,_0x219b2b){_0x2be49f=_0x2be49f-0x0;var _0x326063=_0xedd9[_0x2be49f];return _0x326063;};'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 cd95964..f5bfe5b 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 _0x02ae=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x3e6791,_0x26bf29){var _0x1ade81=function(_0x17b4c4){while(--_0x17b4c4){_0x3e6791['push'](_0x3e6791['shift']());}};_0x1ade81(++_0x26bf29);}(_0x02ae,0x12f));var _0xe02a=function(_0x3a8362,_0x2ad17f){_0x3a8362=_0x3a8362-0x0;var _0x4f68cb=_0x02ae[_0x3a8362];return _0x4f68cb;};'use strict';var client=require(_0xe02a('0x0'));exports[_0xe02a('0x1')]=function(_0x44e503){return client[_0xe02a('0x2')](_0xe02a('0x3'),{'body':_0x44e503,'log':_0xe02a('0x3')});};exports[_0xe02a('0x4')]=function(_0x35df63,_0x52fa12,_0x232659){return client[_0xe02a('0x2')]('UpdateVoiceAgentReport',{'body':_0x35df63,'options':{'where':{'uniqueid':_0x52fa12,'interface':_0x232659,'agentcomplete':!![]}},'log':_0xe02a('0x5')});}; \ No newline at end of file +var _0x97c0=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x97c0,0x97));var _0x097c=function(_0x3047be,_0x103c9f){_0x3047be=_0x3047be-0x0;var _0x289cc5=_0x97c0[_0x3047be];return _0x289cc5;};'use strict';var client=require(_0x097c('0x0'));exports[_0x097c('0x1')]=function(_0x3f494a){return client[_0x097c('0x2')](_0x097c('0x3'),{'body':_0x3f494a,'log':_0x097c('0x3')});};exports[_0x097c('0x4')]=function(_0x3ba689,_0x5b3ace,_0xea4b36){return client['Request'](_0x097c('0x5'),{'body':_0x3ba689,'options':{'where':{'uniqueid':_0x5b3ace,'interface':_0xea4b36,'agentcomplete':!![]}},'log':_0x097c('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b53c98e..957a40a 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 _0xb948=['YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','day','format'];(function(_0x4a02de,_0x21fc8a){var _0x13d931=function(_0x5a3541){while(--_0x5a3541){_0x4a02de['push'](_0x4a02de['shift']());}};_0x13d931(++_0x21fc8a);}(_0xb948,0x7d));var _0x8b94=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0xb948[_0x5bc5fe];return _0x298ea7;};'use strict';var moment=require('moment');var util=require(_0x8b94('0x0'));var _=require(_0x8b94('0x1'));var client=require(_0x8b94('0x2'));exports['create']=function(_0x3c3121){return client['Request'](_0x8b94('0x3'),{'body':_[_0x8b94('0x4')](_0x3c3121,{'source':_0x3c3121[_0x8b94('0x5')],'destinationcontext':_0x3c3121[_0x8b94('0x6')],'callerid':_0x3c3121[_0x8b94('0x7')],'amaflags':_0x8b94('0x8')}),'log':_0x8b94('0x3')});};exports[_0x8b94('0x9')]=function(){return function(){return client[_0x8b94('0xa')](_0x8b94('0xb'),{'options':{'where':{'type':[_0x8b94('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x8b94('0xd'))[_0x8b94('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')['format'](_0x8b94('0xf'))]}},'attributes':[_0x8b94('0x10'),'disposition',_0x8b94('0x11'),_0x8b94('0x12')]},'log':_0x8b94('0x13')});};}; \ No newline at end of file +var _0x0f7b=['billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition'];(function(_0x1ba798,_0x592e35){var _0x2a3c58=function(_0x5f1d8a){while(--_0x5f1d8a){_0x1ba798['push'](_0x1ba798['shift']());}};_0x2a3c58(++_0x592e35);}(_0x0f7b,0x10a));var _0xb0f7=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x0f7b[_0x476bf4];return _0x788ffe;};'use strict';var moment=require(_0xb0f7('0x0'));var util=require(_0xb0f7('0x1'));var _=require(_0xb0f7('0x2'));var client=require(_0xb0f7('0x3'));exports[_0xb0f7('0x4')]=function(_0x13ebba){return client[_0xb0f7('0x5')](_0xb0f7('0x6'),{'body':_[_0xb0f7('0x7')](_0x13ebba,{'source':_0x13ebba['calleridnum'],'destinationcontext':_0x13ebba[_0xb0f7('0x8')],'callerid':_0x13ebba[_0xb0f7('0x9')],'amaflags':_0xb0f7('0xa')}),'log':_0xb0f7('0x6')});};exports[_0xb0f7('0xb')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xb0f7('0xc')],'createdAt':{'$between':[moment()[_0xb0f7('0xd')](_0xb0f7('0xe'))[_0xb0f7('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb0f7('0x10')](_0xb0f7('0xe'))['format'](_0xb0f7('0x11'))]}},'attributes':[_0xb0f7('0x12'),_0xb0f7('0x13'),'duration',_0xb0f7('0x14')]},'log':_0xb0f7('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 80c7a7b..c473144 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 _0xbcc7=['../client','create','Request','CreateVoiceDialReport'];(function(_0x49a54d,_0x50ac45){var _0x873c65=function(_0x504558){while(--_0x504558){_0x49a54d['push'](_0x49a54d['shift']());}};_0x873c65(++_0x50ac45);}(_0xbcc7,0x100));var _0x7bcc=function(_0x1c865f,_0x49abeb){_0x1c865f=_0x1c865f-0x0;var _0xf59ad0=_0xbcc7[_0x1c865f];return _0xf59ad0;};'use strict';var client=require(_0x7bcc('0x0'));exports[_0x7bcc('0x1')]=function(_0x1d28d0){return client[_0x7bcc('0x2')](_0x7bcc('0x3'),{'body':_0x1d28d0,'log':_0x7bcc('0x3')});}; \ No newline at end of file +var _0xefb6=['CreateVoiceDialReport','../client','create','Request'];(function(_0x3f25da,_0x171ad5){var _0x411000=function(_0x1d419b){while(--_0x1d419b){_0x3f25da['push'](_0x3f25da['shift']());}};_0x411000(++_0x171ad5);}(_0xefb6,0xed));var _0x6efb=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xefb6[_0x2d89ce];return _0x3fad10;};'use strict';var client=require(_0x6efb('0x0'));exports[_0x6efb('0x1')]=function(_0x4373d2){return client[_0x6efb('0x2')](_0x6efb('0x3'),{'body':_0x4373d2,'log':_0x6efb('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 4c0ee05..30516a9 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 _0x70e0=['getVoiceExtensions','Request','recordingFormat','../client'];(function(_0x36c86e,_0xb13ec2){var _0x161cf3=function(_0x492a42){while(--_0x492a42){_0x36c86e['push'](_0x36c86e['shift']());}};_0x161cf3(++_0xb13ec2);}(_0x70e0,0x17b));var _0x070e=function(_0x59d6ad,_0x2040f1){_0x59d6ad=_0x59d6ad-0x0;var _0x2e827c=_0x70e0[_0x59d6ad];return _0x2e827c;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x070e('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0x063c=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x50fc0f,_0x18c8bf){var _0xc9a6b5=function(_0x403898){while(--_0x403898){_0x50fc0f['push'](_0x50fc0f['shift']());}};_0xc9a6b5(++_0x18c8bf);}(_0x063c,0xba));var _0xc063=function(_0x143320,_0x4ac064){_0x143320=_0x143320-0x0;var _0x18925a=_0x063c[_0x143320];return _0x18925a;};'use strict';var client=require('../client');exports[_0xc063('0x0')]=function(){return function(){return client[_0xc063('0x1')](_0xc063('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc063('0x3'),_0xc063('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc063('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index f8c0d32..9e59373 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 _0xfe21=['dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','active','Pause','mandatoryDispositionPause','callerid','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','dialActive','dialLimitQueue','dialPowerLevel'];(function(_0x33de82,_0x1900b4){var _0x96fad4=function(_0x1f4401){while(--_0x1f4401){_0x33de82['push'](_0x33de82['shift']());}};_0x96fad4(++_0x1900b4);}(_0xfe21,0x131));var _0x1fe2=function(_0x4d2a19,_0x5d6693){_0x4d2a19=_0x4d2a19-0x0;var _0x1f8ea8=_0xfe21[_0x4d2a19];return _0x1f8ea8;};'use strict';var client=require(_0x1fe2('0x0'));exports[_0x1fe2('0x1')]=function(){return function(){return client[_0x1fe2('0x2')](_0x1fe2('0x3'),{'options':{'raw':![],'attributes':['id',_0x1fe2('0x4'),_0x1fe2('0x5'),'acwTimeout',_0x1fe2('0x6'),'monitor_format','type',_0x1fe2('0x7'),'dialMethod','dialLimitChannel',_0x1fe2('0x8'),_0x1fe2('0x9'),_0x1fe2('0xa'),_0x1fe2('0xb'),_0x1fe2('0xc'),_0x1fe2('0xd'),_0x1fe2('0xe'),_0x1fe2('0xf'),_0x1fe2('0x10'),'dialQueueTimeout',_0x1fe2('0x11'),_0x1fe2('0x12'),_0x1fe2('0x13'),'dialBusyMaxRetry',_0x1fe2('0x14'),_0x1fe2('0x15'),_0x1fe2('0x16'),_0x1fe2('0x17'),_0x1fe2('0x18'),'dialGlobalInterval',_0x1fe2('0x19'),_0x1fe2('0x1a'),_0x1fe2('0x1b'),'dialAMDInitialSilence',_0x1fe2('0x1c'),_0x1fe2('0x1d'),_0x1fe2('0x1e'),_0x1fe2('0x1f'),_0x1fe2('0x20'),_0x1fe2('0x21'),_0x1fe2('0x22'),'dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0x1fe2('0x23'),_0x1fe2('0x24'),_0x1fe2('0x25'),_0x1fe2('0x26'),'dialQueueProject2',_0x1fe2('0x27'),_0x1fe2('0x28'),'dialRandomLastDigitCallerIdNumber',_0x1fe2('0x29'),'dialNoSuchNumberMaxRetry',_0x1fe2('0x2a'),'dialDropMaxRetry',_0x1fe2('0x2b'),_0x1fe2('0x2c'),_0x1fe2('0x2d'),_0x1fe2('0x2e'),_0x1fe2('0x2f'),_0x1fe2('0x30'),_0x1fe2('0x31'),_0x1fe2('0x32'),_0x1fe2('0x33'),_0x1fe2('0x34'),_0x1fe2('0x35'),_0x1fe2('0x36'),_0x1fe2('0x37')],'include':[{'model':_0x1fe2('0x38'),'as':_0x1fe2('0x38'),'attributes':['id',_0x1fe2('0x4'),'callerid',_0x1fe2('0x39')]},{'model':_0x1fe2('0x3a'),'as':_0x1fe2('0x3b'),'attributes':['id',_0x1fe2('0x4')]},{'model':_0x1fe2('0x38'),'as':'TrunkBackup','attributes':['id',_0x1fe2('0x4'),_0x1fe2('0x3c'),_0x1fe2('0x39')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1fe2('0x4')],'include':[{'model':'Interval','as':_0x1fe2('0x3d'),'attributes':['id','name',_0x1fe2('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x26c8=['dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialQueueOptions'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0x26c8,0x1d9));var _0x826c=function(_0x32ee78,_0x128dff){_0x32ee78=_0x32ee78-0x0;var _0x73c2e=_0x26c8[_0x32ee78];return _0x73c2e;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x826c('0x0'),{'options':{'raw':![],'attributes':['id',_0x826c('0x1'),'acw',_0x826c('0x2'),_0x826c('0x3'),_0x826c('0x4'),_0x826c('0x5'),_0x826c('0x6'),_0x826c('0x7'),_0x826c('0x8'),_0x826c('0x9'),_0x826c('0xa'),_0x826c('0xb'),_0x826c('0xc'),_0x826c('0xd'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout',_0x826c('0xe'),_0x826c('0xf'),_0x826c('0x10'),'dialCongestionMaxRetry',_0x826c('0x11'),_0x826c('0x12'),_0x826c('0x13'),_0x826c('0x14'),_0x826c('0x15'),_0x826c('0x16'),_0x826c('0x17'),_0x826c('0x18'),'dialPrefix',_0x826c('0x19'),_0x826c('0x1a'),_0x826c('0x1b'),'dialAMDGreeting',_0x826c('0x1c'),_0x826c('0x1d'),_0x826c('0x1e'),_0x826c('0x1f'),'dialAMDMaximumNumberOfWords',_0x826c('0x20'),_0x826c('0x21'),_0x826c('0x22'),'dialRecallMeTimeout',_0x826c('0x23'),_0x826c('0x24'),_0x826c('0x25'),_0x826c('0x26'),'dialQueueProject2','monitor_format',_0x826c('0x27'),_0x826c('0x28'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x826c('0x29'),'dialDropMaxRetry',_0x826c('0x2a'),_0x826c('0x2b'),_0x826c('0x2c'),_0x826c('0x2d'),_0x826c('0x2e'),_0x826c('0x2f'),_0x826c('0x30'),'mandatoryDisposition',_0x826c('0x31'),'dialPredictiveIntervalMinThreshold',_0x826c('0x32'),_0x826c('0x33'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0x826c('0x34'),'as':_0x826c('0x34'),'attributes':['id','name',_0x826c('0x35'),_0x826c('0x36')]},{'model':_0x826c('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x826c('0x1')]},{'model':'Trunk','as':_0x826c('0x38'),'attributes':['id',_0x826c('0x1'),'callerid',_0x826c('0x36')]},{'model':_0x826c('0x39'),'as':_0x826c('0x39'),'attributes':['id','name'],'include':[{'model':_0x826c('0x39'),'as':_0x826c('0x3a'),'attributes':['id',_0x826c('0x1'),_0x826c('0x3b')]}]}]},'log':_0x826c('0x3c')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4058cb1..00cc556 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(_0xdc4514,_0x56d74c){var _0x1611c4=function(_0x1e5043){while(--_0x1e5043){_0xdc4514['push'](_0xdc4514['shift']());}};_0x1611c4(++_0x56d74c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x22662f,_0x5608e3){var _0x4c1d43=function(_0x121c20){while(--_0x121c20){_0x22662f['push'](_0x22662f['shift']());}};_0x4c1d43(++_0x5608e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 df51aec..bd66959 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 _0x41fa=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x4c46b4,_0x5799af){var _0x24f5c7=function(_0x16420e){while(--_0x16420e){_0x4c46b4['push'](_0x4c46b4['shift']());}};_0x24f5c7(++_0x5799af);}(_0x41fa,0x69));var _0xa41f=function(_0x3116d6,_0x2d574f){_0x3116d6=_0x3116d6-0x0;var _0x18729d=_0x41fa[_0x3116d6];return _0x18729d;};'use strict';var client=require(_0xa41f('0x0'));exports['getVoiceQueueRtPauses']=function(_0x2000ab){return function(){return client[_0xa41f('0x1')](_0xa41f('0x2'),{'options':{'where':{'VoiceQueueId':_0x2000ab,'paused':!![]},'raw':!![]},'log':_0xa41f('0x3')});};}; \ No newline at end of file +var _0x18df=['Request','getVoiceQueueRtPauses','../client'];(function(_0xf19c77,_0x133556){var _0x280085=function(_0x2aebcf){while(--_0x2aebcf){_0xf19c77['push'](_0xf19c77['shift']());}};_0x280085(++_0x133556);}(_0x18df,0xb6));var _0xf18d=function(_0x3214df,_0x390104){_0x3214df=_0x3214df-0x0;var _0x33d237=_0x18df[_0x3214df];return _0x33d237;};'use strict';var client=require(_0xf18d('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4084df){return function(){return client[_0xf18d('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4084df,'paused':!![]},'raw':!![]},'log':_0xf18d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 5d6105c..1a84450 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x373e56,_0x151120){var _0x108b0e=function(_0xbf6605){while(--_0xbf6605){_0x373e56['push'](_0x373e56['shift']());}};_0x108b0e(++_0x151120);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x12902f,_0x29699c){var _0x1b0287=function(_0x5e569b){while(--_0x5e569b){_0x12902f['push'](_0x12902f['shift']());}};_0x1b0287(++_0x29699c);}(_0x7a54,0x106));var _0x47a5=function(_0x546bed,_0x43e0ce){_0x546bed=_0x546bed-0x0;var _0x194d0d=_0x7a54[_0x546bed];return _0x194d0d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8e753aa..e506d93 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 _0x623a=['transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x623a,0x10c));var _0xa623=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x623a[_0xdea41a];return _0x15d0d8;};'use strict';var client=require(_0xa623('0x0'));exports[_0xa623('0x1')]={};exports[_0xa623('0x2')]=function(_0x1c184f){return client[_0xa623('0x3')](_0xa623('0x4'),{'body':{'result':_0x1c184f[_0xa623('0x5')],'transfererchannel':_0x1c184f[_0xa623('0x6')],'transferercalleridnum':_0x1c184f[_0xa623('0x7')],'transferercalleridname':_0x1c184f[_0xa623('0x8')],'transfererconnectedlinenum':_0x1c184f[_0xa623('0x9')],'transfererconnectedlinename':_0x1c184f[_0xa623('0xa')],'transfereraccountcode':_0x1c184f[_0xa623('0xb')],'transferercontext':_0x1c184f[_0xa623('0xc')],'transfererexten':_0x1c184f[_0xa623('0xd')],'transfererlinkedid':_0x1c184f[_0xa623('0xe')],'transfereechannel':_0x1c184f['transfereechannel'],'transfereecalleridnum':_0x1c184f[_0xa623('0xf')],'transfereecalleridname':_0x1c184f['transfereecalleridname'],'transfereeconnectedlinenum':_0x1c184f['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1c184f[_0xa623('0x10')],'transfereeaccountcode':_0x1c184f[_0xa623('0x11')],'transfereecontext':_0x1c184f[_0xa623('0x12')],'transfereeexten':_0x1c184f['transfereeexten'],'transfereelinkedid':_0x1c184f[_0xa623('0x13')],'isexternal':_0x1c184f[_0xa623('0x14')],'context':_0x1c184f[_0xa623('0x15')],'extension':_0x1c184f[_0xa623('0x16')],'type':_0xa623('0x17')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x4e6c75){return client[_0xa623('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x4e6c75['result'],'transfererchannel':_0x4e6c75[_0xa623('0x18')],'transferercalleridnum':_0x4e6c75[_0xa623('0x19')],'transferercalleridname':_0x4e6c75[_0xa623('0x1a')],'transfererconnectedlinenum':_0x4e6c75['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4e6c75['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4e6c75[_0xa623('0x1b')],'transferercontext':_0x4e6c75[_0xa623('0x1c')],'transfererexten':_0x4e6c75['secondtransfererexten'],'transfererlinkedid':_0x4e6c75[_0xa623('0x1d')],'transfereechannel':_0x4e6c75[_0xa623('0x1e')],'transfereecalleridnum':_0x4e6c75[_0xa623('0x1f')],'transfereecalleridname':_0x4e6c75[_0xa623('0x20')],'transfereeconnectedlinenum':_0x4e6c75[_0xa623('0x21')],'transfereeconnectedlinename':_0x4e6c75[_0xa623('0x22')],'transfereeaccountcode':_0x4e6c75[_0xa623('0x23')],'transfereecontext':_0x4e6c75[_0xa623('0x24')],'transfereeexten':_0x4e6c75[_0xa623('0x25')],'transfereelinkedid':_0x4e6c75[_0xa623('0x26')],'isexternal':_0x4e6c75['isexternal'],'context':_0x4e6c75['origtransferercontext'],'extension':_0x4e6c75[_0xa623('0x27')],'type':_0xa623('0x28')},'log':_0xa623('0x4')});}; \ No newline at end of file +var _0x81ad=['blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','extension'];(function(_0x3a5ba3,_0x59e617){var _0x3ba6dd=function(_0x4d2c19){while(--_0x4d2c19){_0x3a5ba3['push'](_0x3a5ba3['shift']());}};_0x3ba6dd(++_0x59e617);}(_0x81ad,0x110));var _0xd81a=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x81ad[_0x59ee41];return _0x3ecd3e;};'use strict';var client=require(_0xd81a('0x0'));exports[_0xd81a('0x1')]={};exports[_0xd81a('0x2')]=function(_0x3776c9){return client['Request'](_0xd81a('0x3'),{'body':{'result':_0x3776c9[_0xd81a('0x4')],'transfererchannel':_0x3776c9[_0xd81a('0x5')],'transferercalleridnum':_0x3776c9[_0xd81a('0x6')],'transferercalleridname':_0x3776c9[_0xd81a('0x7')],'transfererconnectedlinenum':_0x3776c9[_0xd81a('0x8')],'transfererconnectedlinename':_0x3776c9['transfererconnectedlinename'],'transfereraccountcode':_0x3776c9['transfereraccountcode'],'transferercontext':_0x3776c9[_0xd81a('0x9')],'transfererexten':_0x3776c9[_0xd81a('0xa')],'transfererlinkedid':_0x3776c9[_0xd81a('0xb')],'transfereechannel':_0x3776c9[_0xd81a('0xc')],'transfereecalleridnum':_0x3776c9[_0xd81a('0xd')],'transfereecalleridname':_0x3776c9[_0xd81a('0xe')],'transfereeconnectedlinenum':_0x3776c9[_0xd81a('0xf')],'transfereeconnectedlinename':_0x3776c9[_0xd81a('0x10')],'transfereeaccountcode':_0x3776c9[_0xd81a('0x11')],'transfereecontext':_0x3776c9[_0xd81a('0x12')],'transfereeexten':_0x3776c9['transfereeexten'],'transfereelinkedid':_0x3776c9[_0xd81a('0x13')],'isexternal':_0x3776c9[_0xd81a('0x14')],'context':_0x3776c9['context'],'extension':_0x3776c9[_0xd81a('0x15')],'type':_0xd81a('0x16')},'log':_0xd81a('0x3')});};exports[_0xd81a('0x17')]=function(_0x35e9ce){return client[_0xd81a('0x18')](_0xd81a('0x3'),{'body':{'result':_0x35e9ce[_0xd81a('0x4')],'transfererchannel':_0x35e9ce[_0xd81a('0x19')],'transferercalleridnum':_0x35e9ce[_0xd81a('0x1a')],'transferercalleridname':_0x35e9ce['origtransferercalleridname'],'transfererconnectedlinenum':_0x35e9ce[_0xd81a('0x1b')],'transfererconnectedlinename':_0x35e9ce[_0xd81a('0x1c')],'transfereraccountcode':_0x35e9ce[_0xd81a('0x1d')],'transferercontext':_0x35e9ce[_0xd81a('0x1e')],'transfererexten':_0x35e9ce[_0xd81a('0x1f')],'transfererlinkedid':_0x35e9ce[_0xd81a('0x20')],'transfereechannel':_0x35e9ce[_0xd81a('0x21')],'transfereecalleridnum':_0x35e9ce[_0xd81a('0x22')],'transfereecalleridname':_0x35e9ce['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x35e9ce[_0xd81a('0x23')],'transfereeconnectedlinename':_0x35e9ce['transfertargetconnectedlinename'],'transfereeaccountcode':_0x35e9ce['transfertargetaccountcode'],'transfereecontext':_0x35e9ce[_0xd81a('0x24')],'transfereeexten':_0x35e9ce[_0xd81a('0x25')],'transfereelinkedid':_0x35e9ce[_0xd81a('0x26')],'isexternal':_0x35e9ce[_0xd81a('0x14')],'context':_0x35e9ce[_0xd81a('0x27')],'extension':_0x35e9ce[_0xd81a('0x28')],'type':_0xd81a('0x29')},'log':_0xd81a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 17f0872..e8ace3b 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 _0x9c2c=['MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','campaigns','event','emit','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action','then','catch','command','Command','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','undefined','values','channels','voicechannel','validate','length','map','uniqueid','channel','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec'];(function(_0x4b1e60,_0x4a2e1c){var _0x27f958=function(_0x3570d2){while(--_0x3570d2){_0x4b1e60['push'](_0x4b1e60['shift']());}};_0x27f958(++_0x4a2e1c);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var moment=require('moment');var config=require(_0xc9c2('0x2'));var properties=require('../properties');var ami=require(_0xc9c2('0x3'));exports[_0xc9c2('0x4')]=function(_0x5bf334,_0x4db342,_0x35818b){return new Promise(function(_0x5140a8,_0x30f3d6){var _0x17b5e8={'QueuePause':function(_0x711f3d){return new Promise(function(_0x18a815){var _0x270572=util[_0xc9c2('0x5')](_0xc9c2('0x6'),_0xc9c2('0x7'),_0x711f3d[_0xc9c2('0x8')]);if(_0x5bf334['timers']&&_0x5bf334[_0xc9c2('0x9')][_0x270572]&&_0x5bf334['timers'][_0x270572][_0xc9c2('0xa')]){_0x5bf334[_0xc9c2('0x9')][_0x270572][_0xc9c2('0xb')]();}if(_0x5bf334[_0xc9c2('0xc')][_0x270572]){_0x5bf334['agents'][_0x270572]['updateStatusRealtime']({'statePause':_0x711f3d[_0xc9c2('0xd')]?!![]:![]});}_0x18a815({'code':0xc8,'message':_0xc9c2('0xe')});});},'Reload':function(_0x568f69){var _0x7ec780=this;return new Promise(function(_0x1f08a7,_0x3e7cfb){if(ami[_0xc9c2('0xf')]()==![]){return _0x3e7cfb(_0x7ec780[_0xc9c2('0x10')](0x1f4,[config[_0xc9c2('0x11')]['ip'],config[_0xc9c2('0x11')][_0xc9c2('0x12')],_0xc9c2('0x13')][_0xc9c2('0x14')]('\x20')));}_0x568f69=_[_0xc9c2('0x15')](_0x568f69,_[_0xc9c2('0x16')](properties['module']));_0x568f69[_0xc9c2('0x17')]=_0xc9c2('0x18');return ami[_0xc9c2('0x19')](_0x568f69)[_0xc9c2('0x1a')](function(_0x21fd6d){_0x1f08a7({'code':0xc8,'message':_0x21fd6d['message']});})[_0xc9c2('0x1b')](function(_0x37c027){_0x3e7cfb(_0x7ec780[_0xc9c2('0x10')](0x1f5,_0x37c027['message']));});});},'Command':function(_0x1c3b09){var _0x7de09c=this;return new Promise(function(_0x55dbb1,_0x484ca3){if(ami[_0xc9c2('0xf')]()==![]){return _0x484ca3(_0x7de09c[_0xc9c2('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xc9c2('0x12')],'ami\x20disconnected'][_0xc9c2('0x14')]('\x20')));}_0x1c3b09=_[_0xc9c2('0x15')](_0x1c3b09,_0xc9c2('0x1c'));_0x1c3b09[_0xc9c2('0x17')]=_0xc9c2('0x1d');return ami['Action'](_0x1c3b09)[_0xc9c2('0x1a')](function(_0x20cf26){_0x55dbb1({'code':0xc8,'message':_0x20cf26[_0xc9c2('0x1e')]});})[_0xc9c2('0x1b')](function(_0x32c372){_0x484ca3(_0x7de09c[_0xc9c2('0x10')](0x1f5,_0x32c372['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x38c957){var _0x20ca3b=[];for(var _0x5e47c2 in _0x5bf334[_0xc9c2('0x1f')]){if(_0x5bf334['voiceQueues'][_0xc9c2('0x20')](_0x5e47c2)){var _0xd803e9=_0x5bf334[_0xc9c2('0x1f')][_0x5e47c2];var _0x2222e4={'id':_0xd803e9['id'],'name':_0xd803e9['name'],'strategy':_0xd803e9[_0xc9c2('0x21')],'answered':_0xd803e9['answered'],'available':_0xd803e9[_0xc9c2('0x22')],'loggedIn':_0xd803e9[_0xc9c2('0x23')],'pTalking':_0xd803e9[_0xc9c2('0x24')],'sumBillable':_0xd803e9[_0xc9c2('0x25')],'sumDuration':_0xd803e9[_0xc9c2('0x26')],'sumHoldTime':_0xd803e9['sumHoldTime']||0x0,'talking':_0xd803e9[_0xc9c2('0x27')],'total':_0xd803e9[_0xc9c2('0x28')],'type':_0xd803e9[_0xc9c2('0x29')],'unmanaged':_0xd803e9[_0xc9c2('0x2a')],'abandoned':_0xd803e9[_0xc9c2('0x2b')],'waiting':_0xd803e9[_0xc9c2('0x2c')],'loggedInDb':_0xd803e9[_0xc9c2('0x2d')]};if(_0xd803e9['type']===_0xc9c2('0x2e')){_0x2222e4['dialActive']=_0xd803e9[_0xc9c2('0x2f')];_0x2222e4[_0xc9c2('0x30')]=_0xd803e9['dialMethod'];_0x2222e4[_0xc9c2('0x31')]=_0xd803e9[_0xc9c2('0x31')];_0x2222e4[_0xc9c2('0x32')]=_0xd803e9[_0xc9c2('0x32')];_0x2222e4['dialOriginateTimeout']=_0xd803e9[_0xc9c2('0x33')];_0x2222e4[_0xc9c2('0x34')]=_0xd803e9['dialPrefix'];_0x2222e4['temp']=_0xd803e9[_0xc9c2('0x35')];_0x2222e4[_0xc9c2('0x36')]=_0xd803e9[_0xc9c2('0x36')];_0x2222e4['outboundAnswerCallsDay']=_0xd803e9['outboundAnswerCallsDay'];_0x2222e4[_0xc9c2('0x37')]=_0xd803e9[_0xc9c2('0x37')];_0x2222e4['outboundBusyCallsDay']=_0xd803e9[_0xc9c2('0x38')];_0x2222e4['outboundCongestionCallsDay']=_0xd803e9[_0xc9c2('0x39')];_0x2222e4[_0xc9c2('0x3a')]=_0xd803e9[_0xc9c2('0x3a')];_0x2222e4[_0xc9c2('0x3b')]=_0xd803e9[_0xc9c2('0x3b')];_0x2222e4[_0xc9c2('0x3c')]=_0xd803e9[_0xc9c2('0x3c')];_0x2222e4[_0xc9c2('0x3d')]=_0xd803e9[_0xc9c2('0x3d')];_0x2222e4['outboundNoSuchCallsDay']=_0xd803e9[_0xc9c2('0x3e')];_0x2222e4['outboundOriginateFailureCallsDay']=_0xd803e9[_0xc9c2('0x3f')];_0x2222e4[_0xc9c2('0x40')]=_0xd803e9['outboundReCallsDay'];_0x2222e4[_0xc9c2('0x41')]=_0xd803e9[_0xc9c2('0x41')];_0x2222e4['outboundUnknownCallsDay']=_0xd803e9[_0xc9c2('0x42')];_0x2222e4[_0xc9c2('0x43')]=_0xd803e9[_0xc9c2('0x43')];_0x2222e4['predictiveIntervalAvgHoldtime']=_0xd803e9[_0xc9c2('0x44')];_0x2222e4['predictiveIntervalAvgTalktime']=_0xd803e9[_0xc9c2('0x45')];_0x2222e4[_0xc9c2('0x46')]=_0xd803e9['predictiveIntervalDroppedCallsCallersExit'];_0x2222e4[_0xc9c2('0x47')]=_0xd803e9[_0xc9c2('0x47')];_0x2222e4[_0xc9c2('0x48')]=_0xd803e9[_0xc9c2('0x48')];_0x2222e4[_0xc9c2('0x49')]=_0xd803e9[_0xc9c2('0x49')];_0x2222e4[_0xc9c2('0x4a')]=_0xd803e9[_0xc9c2('0x4a')];_0x2222e4[_0xc9c2('0x4b')]=_0xd803e9[_0xc9c2('0x4b')];_0x2222e4[_0xc9c2('0x4c')]=_0xd803e9['predictiveIntervalPauses'];_0x2222e4['predictiveIntervalAvailable']=_0xd803e9[_0xc9c2('0x4d')];_0x2222e4[_0xc9c2('0x4e')]=_0xd803e9[_0xc9c2('0x4e')];_0x2222e4[_0xc9c2('0x4f')]=_0xd803e9[_0xc9c2('0x4f')];_0x2222e4[_0xc9c2('0x50')]=_0xd803e9['originated'];_0x2222e4[_0xc9c2('0x51')]=_0xd803e9[_0xc9c2('0x51')];_0x2222e4[_0xc9c2('0x52')]=_0xd803e9[_0xc9c2('0x52')];_0x2222e4[_0xc9c2('0x53')]=_0xd803e9['erlangAbandonmentRate'];_0x2222e4[_0xc9c2('0x54')]=_0xd803e9[_0xc9c2('0x54')];_0x2222e4[_0xc9c2('0x55')]=_0xd803e9['startPredictive'];_0x2222e4[_0xc9c2('0x56')]=_0xd803e9[_0xc9c2('0x56')];}if(_0xd803e9[_0xc9c2('0x57')]){_0x2222e4[_0xc9c2('0x57')]={'id':_0xd803e9[_0xc9c2('0x57')]['id'],'name':_0xd803e9['Trunk']['name'],'active':_0xd803e9[_0xc9c2('0x57')][_0xc9c2('0x58')],'callerid':_0xd803e9['Trunk'][_0xc9c2('0x59')]};}if(_0xd803e9[_0xc9c2('0x5a')]){_0x2222e4[_0xc9c2('0x5a')]={'id':_0xd803e9[_0xc9c2('0x5a')]['id'],'name':_0xd803e9[_0xc9c2('0x5a')][_0xc9c2('0x8')]};}_0x20ca3b[_0xc9c2('0x5b')](_0x2222e4);}}_0x38c957({'count':_0x20ca3b['length'],'rows':_0x20ca3b});});},'UpdateVoiceQueue':function(_0x182431){return new Promise(function(_0x592905,_0x2d14d9){var _0x479ecf=_[_0xc9c2('0x5c')](_0x5bf334['voiceQueues'],{'id':parseInt(_0x182431['id'])});var _0x3cffef=_['omit'](_0x182431,['id']);if(_0x479ecf){for(var _0x1a9ac7 in _0x3cffef){if(typeof _0x3cffef[_0x1a9ac7]!==_0xc9c2('0x5d')&&typeof _0x479ecf[_0x1a9ac7]!==_0xc9c2('0x5d')){_0x479ecf[_0x1a9ac7]=_0x3cffef[_0x1a9ac7];}}_0x592905(_0x479ecf);}else{_0x2d14d9();}});},'VoiceChannels':function(){return new Promise(function(_0x1b2805){var _0x1009bb=_[_0xc9c2('0x5e')](_0x5bf334[_0xc9c2('0x5f')]);_0x1b2805({'count':_0x1009bb['length'],'rows':_0x1009bb});});},'VoiceChannelMixMonitor':function(_0x2ef319){var _0x4285e1=this;return new Promise(function(_0x412df0,_0xad73d4){if(ami[_0xc9c2('0xf')]()==![]){return _0xad73d4(_0x4285e1[_0xc9c2('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xc9c2('0x11')][_0xc9c2('0x12')],_0xc9c2('0x13')][_0xc9c2('0x14')]('\x20')));}var _0x2e9925=schema(properties[_0xc9c2('0x60')])[_0xc9c2('0x61')](_0x2ef319);if(_0x2e9925[_0xc9c2('0x62')]>0x0){return _0xad73d4(_0x4285e1['error'](0x1f4,_[_0xc9c2('0x63')](_0x2e9925,_0xc9c2('0x4f'))[_0xc9c2('0x14')](',\x20')));}var _0x3ac7fd=_[_0xc9c2('0x5c')](_0x5bf334['channels'],{'uniqueid':_0x2ef319[_0xc9c2('0x64')]});if(_0x3ac7fd&&_0x3ac7fd[_0xc9c2('0x65')]){var _0xdedc7c=util['format'](_0xc9c2('0x66'),_0x2ef319['filename']||_0x2ef319[_0xc9c2('0x64')],_0x2ef319['format']||'wav');return ami[_0xc9c2('0x19')]({'action':_0xc9c2('0x67'),'channel':_0x3ac7fd[_0xc9c2('0x65')],'file':_0xdedc7c,'options':_0xc9c2('0x68')})[_0xc9c2('0x1a')](function(_0x3228f3){var _0x24f285=_[_0xc9c2('0x5c')](_0x3ac7fd[_0xc9c2('0x69')],{'filename':_0xc9c2('0x6a')+_0xdedc7c[_0xc9c2('0x6b')]()});if(_['isNil'](_0x24f285)){_0x3ac7fd[_0xc9c2('0x69')][_0xc9c2('0x5b')]({'filename':'/var/spool/asterisk/monitor/'+_0xdedc7c[_0xc9c2('0x6b')](),'createdAt':moment()[_0xc9c2('0x5')](_0xc9c2('0x6c')),'mixmonitorid':_0x3228f3['mixmonitorid'],'status':'rec'});}else{_0x24f285[_0xc9c2('0x6d')]=_0x3228f3[_0xc9c2('0x6d')];_0x24f285[_0xc9c2('0x6e')]=_0xc9c2('0x6f');}_0x412df0({'code':0xc8,'message':[_0x2ef319[_0xc9c2('0x64')],_0xc9c2('0x70'),_0x3228f3[_0xc9c2('0x6d')]][_0xc9c2('0x14')]('\x20'),'mixmonitorid':_0x3228f3[_0xc9c2('0x6d')]});})[_0xc9c2('0x1b')](function(_0x19feae){_0xad73d4(_0x4285e1[_0xc9c2('0x10')](0x1f5,[_0x2ef319[_0xc9c2('0x64')],_0x19feae[_0xc9c2('0x4f')][_0xc9c2('0x6b')]()]['join']('\x20')));});}else{return _0xad73d4(_0x4285e1[_0xc9c2('0x10')](0x1f5,_0xc9c2('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x46c37f){var _0x542371=this;return new Promise(function(_0xb9f0d7,_0x85a090){if(ami[_0xc9c2('0xf')]()==![]){return _0x85a090(_0x542371['error'](0x1f4,[config['asterisk']['ip'],config[_0xc9c2('0x11')][_0xc9c2('0x12')],_0xc9c2('0x13')][_0xc9c2('0x14')]('\x20')));}var _0x3e2edd=schema(properties[_0xc9c2('0x60')])[_0xc9c2('0x61')](_0x46c37f);if(_0x3e2edd[_0xc9c2('0x62')]>0x0){return _0x85a090(_0x542371['error'](0x1f4,_[_0xc9c2('0x63')](_0x3e2edd,_0xc9c2('0x4f'))[_0xc9c2('0x14')](',\x20')));}var _0x1df09c=_[_0xc9c2('0x5c')](_0x5bf334[_0xc9c2('0x5f')],{'uniqueid':_0x46c37f[_0xc9c2('0x64')]});if(_0x1df09c){return Promise[_0xc9c2('0x72')]()[_0xc9c2('0x1a')](function(){if(_0x1df09c[_0xc9c2('0x65')]){return ami[_0xc9c2('0x19')]({'action':_0xc9c2('0x73'),'channel':_0x1df09c['channel'],'mixmonitorid':_0x46c37f[_0xc9c2('0x6d')]})['catch'](function(){});}})[_0xc9c2('0x1a')](function(){if(_0x1df09c[_0xc9c2('0x74')]){return ami[_0xc9c2('0x19')]({'action':'StopMixMonitor','channel':_0x1df09c[_0xc9c2('0x74')],'mixmonitorid':_0x46c37f[_0xc9c2('0x6d')]})[_0xc9c2('0x1b')](function(){});}})['then'](function(){var _0x3c7ed5=_[_0xc9c2('0x5c')](_0x1df09c['monitors'],{'mixmonitorid':_0x46c37f[_0xc9c2('0x6d')]});if(_0x3c7ed5){_0x3c7ed5['status']=_0xc9c2('0x75');}})[_0xc9c2('0x1a')](function(){var _0x3b2cd1=util['format'](_0xc9c2('0x66'),_0x46c37f['filename']||_0x46c37f[_0xc9c2('0x64')],_0x46c37f[_0xc9c2('0x5')]||_0xc9c2('0x76'));var _0x513d3f=_[_0xc9c2('0x5c')](_0x1df09c[_0xc9c2('0x69')],{'filename':_0xc9c2('0x6a')+_0x3b2cd1[_0xc9c2('0x6b')]()});if(_0x513d3f){_0x513d3f[_0xc9c2('0x6e')]=_0xc9c2('0x75');}})[_0xc9c2('0x1a')](function(){_0xb9f0d7({'code':0xc8,'message':[_0x46c37f[_0xc9c2('0x64')],_0xc9c2('0x77')][_0xc9c2('0x14')]('\x20')});})[_0xc9c2('0x1b')](function(_0x52c25c){_0x85a090(_0x542371['error'](0x1f5,[_0x46c37f['uniqueid'],_0x52c25c['message'][_0xc9c2('0x6b')]()][_0xc9c2('0x14')]('\x20')));});}else{return _0x85a090(_0x542371[_0xc9c2('0x10')](0x1f5,_0xc9c2('0x71')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x48939f){var _0x26ed38=_[_0xc9c2('0x5e')](_0x5bf334['queueChannels']);_0x48939f({'count':_0x26ed38[_0xc9c2('0x62')],'rows':_0x26ed38});});},'VoiceQueuesChannel':function(_0x54cb12){var _0x230cbf=this;return new Promise(function(_0x2b8300,_0x4669b0){var _0x480adc=schema(properties[_0xc9c2('0x78')])[_0xc9c2('0x61')](_0x54cb12);if(_0x480adc[_0xc9c2('0x62')]>0x0){return _0x4669b0(_0x230cbf['error'](0x1f4,_['map'](_0x480adc,'message')[_0xc9c2('0x14')](',\x20')));}var _0x2ea6ad=_[_0xc9c2('0x5c')](_0x5bf334['queueChannels'],{'uniqueid':_0x54cb12[_0xc9c2('0x64')]});if(_0x2ea6ad){_0x2b8300(_0x2ea6ad);}else{return _0x4669b0(_0x230cbf[_0xc9c2('0x10')](0x1f5,_0xc9c2('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x322c34){var _0x3e329d=this;return new Promise(function(_0x114dc6,_0x53e0cc){if(ami[_0xc9c2('0xf')]()==![]){return _0x53e0cc(_0x3e329d['error'](0x1f4,[config['asterisk']['ip'],config[_0xc9c2('0x11')][_0xc9c2('0x12')],_0xc9c2('0x13')][_0xc9c2('0x14')]('\x20')));}var _0x1d0faa=schema(properties['voicequeuechannelhangup'])[_0xc9c2('0x61')](_0x322c34);if(_0x1d0faa[_0xc9c2('0x62')]>0x0){return _0x53e0cc(_0x3e329d[_0xc9c2('0x10')](0x1f4,_[_0xc9c2('0x63')](_0x1d0faa,_0xc9c2('0x4f'))[_0xc9c2('0x14')](',\x20')));}var _0x101c90=_[_0xc9c2('0x5c')](_0x5bf334[_0xc9c2('0x79')],{'uniqueid':_0x322c34[_0xc9c2('0x64')]});if(_0x101c90&&_0x101c90[_0xc9c2('0x65')]){return ami[_0xc9c2('0x19')]({'action':_0xc9c2('0x7a'),'channel':_0x101c90['channel']})['then'](function(_0x1a6c28){_0x114dc6({'code':0xc8,'message':[_0x322c34[_0xc9c2('0x64')],_0x1a6c28['message']['toLowerCase']()][_0xc9c2('0x14')]('\x20')});})['catch'](function(_0x59b7b9){_0x53e0cc(_0x3e329d[_0xc9c2('0x10')](0x1f5,[_0x322c34[_0xc9c2('0x64')],_0x59b7b9['message'][_0xc9c2('0x6b')]()]['join']('\x20')));});}else{return _0x53e0cc(_0x3e329d[_0xc9c2('0x10')](0x1f5,_0xc9c2('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x39b816){var _0x52c0ce=this;return new Promise(function(_0xa65382,_0x330b80){if(ami[_0xc9c2('0xf')]()==![]){return _0x330b80(_0x52c0ce[_0xc9c2('0x10')](0x1f4,[config[_0xc9c2('0x11')]['ip'],config[_0xc9c2('0x11')][_0xc9c2('0x12')],_0xc9c2('0x13')][_0xc9c2('0x14')]('\x20')));}var _0x29654f=schema(properties[_0xc9c2('0x7b')])[_0xc9c2('0x61')](_0x39b816);if(_0x29654f['length']>0x0){return _0x330b80(_0x52c0ce[_0xc9c2('0x10')](0x1f4,_[_0xc9c2('0x63')](_0x29654f,_0xc9c2('0x4f'))[_0xc9c2('0x14')](',\x20')));}var _0x483de8=_[_0xc9c2('0x5c')](_0x5bf334[_0xc9c2('0x79')],{'uniqueid':_0x39b816['uniqueid']});if(_0x483de8&&_0x483de8[_0xc9c2('0x65')]){return ami[_0xc9c2('0x19')]({'action':_0xc9c2('0x7c'),'channel':_0x483de8[_0xc9c2('0x65')],'exten':_0x39b816[_0xc9c2('0x7d')],'context':_0x39b816['context']||_0x483de8[_0xc9c2('0x7e')],'priority':0x1})['then'](function(_0x48fb29){_0xa65382({'code':0xc8,'message':[_0x39b816[_0xc9c2('0x64')],_0x48fb29[_0xc9c2('0x4f')][_0xc9c2('0x6b')]()][_0xc9c2('0x14')]('\x20')});})[_0xc9c2('0x1b')](function(_0xa93d14){_0x330b80(_0x52c0ce[_0xc9c2('0x10')](0x1f5,[_0x39b816[_0xc9c2('0x64')],_0xa93d14[_0xc9c2('0x4f')]['toLowerCase']()]['join']('\x20')));});}else{return _0x330b80(_0x52c0ce[_0xc9c2('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2d2fb6){return new Promise(function(_0x1ed831){var _0x4286c8=_[_0xc9c2('0x5e')](_0x5bf334['agents']);if(_0x2d2fb6&&_0x2d2fb6['id']){var _0x3b2bb7=_[_0xc9c2('0x5c')](_0x4286c8,function(_0x4326e2){return _0x4326e2['id']===_0x2d2fb6['id'];});_0x1ed831(_0x3b2bb7);}else{_0x1ed831({'count':_0x4286c8[_0xc9c2('0x62')],'rows':_0x4286c8});}});},'Telephones':function(){return new Promise(function(_0x1103be){var _0x392a54=_[_0xc9c2('0x5e')](_0x5bf334[_0xc9c2('0x7f')]);_0x1103be({'count':_0x392a54[_0xc9c2('0x62')],'rows':_0x392a54});});},'Trunks':function(){return new Promise(function(_0x488c84){var _0x47e4ea=_[_0xc9c2('0x5e')](_0x5bf334['trunks']);_0x488c84({'count':_0x47e4ea[_0xc9c2('0x62')],'rows':_0x47e4ea});});},'OutboundChannels':function(){return new Promise(function(_0x21100a){var _0x594062=_['values'](_0x5bf334[_0xc9c2('0x80')]);_0x21100a({'count':_0x594062[_0xc9c2('0x62')],'rows':_0x594062});});},'Outbound':function(){return new Promise(function(_0x3dab5f){_0x3dab5f(_0x5bf334['outbound']);});},'Campaigns':function(){return new Promise(function(_0x17e489){var _0x3b7e76=_[_0xc9c2('0x5e')](_0x5bf334[_0xc9c2('0x81')]);_0x17e489({'count':_0x3b7e76['length'],'rows':_0x3b7e76});});},'VoiceQueuesPreview':function(_0x2f59de){var _0x94b28f=this;return new Promise(function(_0x126947,_0xb20f7a){_0x4db342['run'](_0x2f59de['id'])[_0xc9c2('0x1a')](function(_0x33965c){_0x126947({'code':0xc8,'message':_0x33965c['message']});})[_0xc9c2('0x1b')](function(_0x4cd726){_0xb20f7a(_0x94b28f[_0xc9c2('0x10')](0x1f4,_0x4cd726[_0xc9c2('0x4f')]));});});},'EventManager':function(_0x1f1c77){var _0x356652=this;return new Promise(function(_0x4f8e24,_0x3afb6d){if(!_0x1f1c77[_0xc9c2('0x82')]){return _0x3afb6d(_0x356652['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xc9c2('0x83')]('custom:'+_0x1f1c77[_0xc9c2('0x82')],_0x1f1c77[_0xc9c2('0x4f')]);_0x4f8e24({'code':0xc8,'message':_0x1f1c77});});},'FaxAccounts':function(){return new Promise(function(_0x190dac){var _0x79d8db=_[_0xc9c2('0x5e')](_0x5bf334[_0xc9c2('0x84')]);_0x190dac({'count':_0x79d8db['length'],'rows':_0x79d8db});});},'SendFax':function(_0xa5862){var _0x384ae7=this;return new Promise(function(_0x12e3e8,_0x5ba454){_0x35818b[_0xc9c2('0x85')](_0xa5862)[_0xc9c2('0x1a')](function(_0x225a11){_0x12e3e8({'code':0xc8,'message':_0x225a11[_0xc9c2('0x4f')]});})[_0xc9c2('0x1b')](function(_0x3da14c){_0x5ba454(_0x384ae7[_0xc9c2('0x10')](0x1f4,_0x3da14c[_0xc9c2('0x4f')]));});});},'CheckAfterSend':function(_0x3fc5d9){var _0x21e826=this;return new Promise(function(_0x161f0b,_0x490898){_0x35818b[_0xc9c2('0x86')](_0x3fc5d9)[_0xc9c2('0x1a')](function(_0x4392d7){_0x161f0b({'code':0xc8,'message':_0x4392d7[_0xc9c2('0x4f')]});})['catch'](function(_0x5e237a){_0x490898(_0x21e826[_0xc9c2('0x10')](0x1f4,_0x5e237a[_0xc9c2('0x4f')]));});});}};var _0x4b957e=jayson['server'](_0x17b5e8)[_0xc9c2('0x87')]();_0x4b957e['on'](_0xc9c2('0x10'),function(_0x25bbfd){return _0x30f3d6(_0x25bbfd);});_0x4b957e[_0xc9c2('0x4')](0x232a,_0xc9c2('0x88'),function(){console[_0xc9c2('0x89')](_0xc9c2('0x8a'),0x232a);return _0x5140a8(_0xc9c2('0x8b')+0x232a);});});}; \ No newline at end of file +var _0x263f=['Action','message','catch','ami\x20disconnected','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumDuration','talking','total','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','uniqueid','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','Redirect','exten','context','telephones','trunks','outboundChannels','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../ami','listen','format','SIP','name','timers','timer','agents','updateStatusRealtime','isConnected','error','asterisk','username','join','pick','keys','module','action','Reload'];(function(_0x5148da,_0x52b82e){var _0x3abe9d=function(_0xae515c){while(--_0xae515c){_0x5148da['push'](_0x5148da['shift']());}};_0x3abe9d(++_0x52b82e);}(_0x263f,0x182));var _0xf263=function(_0x8d28bd,_0xbfbd9d){_0x8d28bd=_0x8d28bd-0x0;var _0x5d6b5e=_0x263f[_0x8d28bd];return _0x5d6b5e;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var jayson=require(_0xf263('0x2'));var schema=require(_0xf263('0x3'));var moment=require(_0xf263('0x4'));var config=require(_0xf263('0x5'));var properties=require('../properties');var ami=require(_0xf263('0x6'));exports[_0xf263('0x7')]=function(_0x453b6e,_0x528b98,_0xbd1369){return new Promise(function(_0xdb2fc1,_0x4c7ab2){var _0x4fded6={'QueuePause':function(_0xa2b1b0){return new Promise(function(_0x9644ab){var _0xa2e77e=util[_0xf263('0x8')]('%s/%s',_0xf263('0x9'),_0xa2b1b0[_0xf263('0xa')]);if(_0x453b6e[_0xf263('0xb')]&&_0x453b6e[_0xf263('0xb')][_0xa2e77e]&&_0x453b6e[_0xf263('0xb')][_0xa2e77e][_0xf263('0xc')]){_0x453b6e[_0xf263('0xb')][_0xa2e77e]['updateAcw']();}if(_0x453b6e[_0xf263('0xd')][_0xa2e77e]){_0x453b6e['agents'][_0xa2e77e][_0xf263('0xe')]({'statePause':_0xa2b1b0['pause']?!![]:![]});}_0x9644ab({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x2fc9f0){var _0x2b1145=this;return new Promise(function(_0x17471d,_0xd7a907){if(ami[_0xf263('0xf')]()==![]){return _0xd7a907(_0x2b1145[_0xf263('0x10')](0x1f4,[config[_0xf263('0x11')]['ip'],config['asterisk'][_0xf263('0x12')],'ami\x20disconnected'][_0xf263('0x13')]('\x20')));}_0x2fc9f0=_[_0xf263('0x14')](_0x2fc9f0,_[_0xf263('0x15')](properties[_0xf263('0x16')]));_0x2fc9f0[_0xf263('0x17')]=_0xf263('0x18');return ami[_0xf263('0x19')](_0x2fc9f0)['then'](function(_0x501a78){_0x17471d({'code':0xc8,'message':_0x501a78[_0xf263('0x1a')]});})[_0xf263('0x1b')](function(_0x325a84){_0xd7a907(_0x2b1145[_0xf263('0x10')](0x1f5,_0x325a84[_0xf263('0x1a')]));});});},'Command':function(_0x56bd2d){var _0x1adb66=this;return new Promise(function(_0x523061,_0x39205b){if(ami[_0xf263('0xf')]()==![]){return _0x39205b(_0x1adb66[_0xf263('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xf263('0x11')][_0xf263('0x12')],_0xf263('0x1c')]['join']('\x20')));}_0x56bd2d=_[_0xf263('0x14')](_0x56bd2d,_0xf263('0x1d'));_0x56bd2d[_0xf263('0x17')]=_0xf263('0x1e');return ami[_0xf263('0x19')](_0x56bd2d)[_0xf263('0x1f')](function(_0x43cb61){_0x523061({'code':0xc8,'message':_0x43cb61[_0xf263('0x20')]});})[_0xf263('0x1b')](function(_0xe32b07){_0x39205b(_0x1adb66[_0xf263('0x10')](0x1f5,_0xe32b07['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x54f4e4){var _0x5dc48f=[];for(var _0x2de7aa in _0x453b6e[_0xf263('0x21')]){if(_0x453b6e[_0xf263('0x21')][_0xf263('0x22')](_0x2de7aa)){var _0x36df8e=_0x453b6e[_0xf263('0x21')][_0x2de7aa];var _0x16af55={'id':_0x36df8e['id'],'name':_0x36df8e[_0xf263('0xa')],'strategy':_0x36df8e[_0xf263('0x23')],'answered':_0x36df8e[_0xf263('0x24')],'available':_0x36df8e[_0xf263('0x25')],'loggedIn':_0x36df8e['loggedIn'],'pTalking':_0x36df8e[_0xf263('0x26')],'sumBillable':_0x36df8e['sumBillable'],'sumDuration':_0x36df8e[_0xf263('0x27')],'sumHoldTime':_0x36df8e['sumHoldTime']||0x0,'talking':_0x36df8e[_0xf263('0x28')],'total':_0x36df8e[_0xf263('0x29')],'type':_0x36df8e['type'],'unmanaged':_0x36df8e['unmanaged'],'abandoned':_0x36df8e[_0xf263('0x2a')],'waiting':_0x36df8e[_0xf263('0x2b')],'loggedInDb':_0x36df8e[_0xf263('0x2c')]};if(_0x36df8e[_0xf263('0x2d')]===_0xf263('0x2e')){_0x16af55[_0xf263('0x2f')]=_0x36df8e[_0xf263('0x2f')];_0x16af55[_0xf263('0x30')]=_0x36df8e['dialMethod'];_0x16af55[_0xf263('0x31')]=_0x36df8e[_0xf263('0x31')];_0x16af55[_0xf263('0x32')]=_0x36df8e[_0xf263('0x32')];_0x16af55[_0xf263('0x33')]=_0x36df8e[_0xf263('0x33')];_0x16af55[_0xf263('0x34')]=_0x36df8e[_0xf263('0x34')];_0x16af55[_0xf263('0x35')]=_0x36df8e['temp'];_0x16af55[_0xf263('0x36')]=_0x36df8e['outboundAnswerAgiCallsDay'];_0x16af55['outboundAnswerCallsDay']=_0x36df8e[_0xf263('0x37')];_0x16af55[_0xf263('0x38')]=_0x36df8e['outboundBlacklistCallsDay'];_0x16af55[_0xf263('0x39')]=_0x36df8e[_0xf263('0x39')];_0x16af55['outboundCongestionCallsDay']=_0x36df8e[_0xf263('0x3a')];_0x16af55[_0xf263('0x3b')]=_0x36df8e[_0xf263('0x3b')];_0x16af55[_0xf263('0x3c')]=_0x36df8e[_0xf263('0x3c')];_0x16af55[_0xf263('0x3d')]=_0x36df8e['outboundDropCallsDayTimeout'];_0x16af55[_0xf263('0x3e')]=_0x36df8e[_0xf263('0x3e')];_0x16af55['outboundNoSuchCallsDay']=_0x36df8e['outboundNoSuchCallsDay'];_0x16af55[_0xf263('0x3f')]=_0x36df8e[_0xf263('0x3f')];_0x16af55[_0xf263('0x40')]=_0x36df8e[_0xf263('0x40')];_0x16af55['outboundRejectCallsDay']=_0x36df8e[_0xf263('0x41')];_0x16af55[_0xf263('0x42')]=_0x36df8e[_0xf263('0x42')];_0x16af55[_0xf263('0x43')]=_0x36df8e[_0xf263('0x43')];_0x16af55['predictiveIntervalAvgHoldtime']=_0x36df8e[_0xf263('0x44')];_0x16af55[_0xf263('0x45')]=_0x36df8e[_0xf263('0x45')];_0x16af55['predictiveIntervalDroppedCallsCallersExit']=_0x36df8e[_0xf263('0x46')];_0x16af55[_0xf263('0x47')]=_0x36df8e[_0xf263('0x47')];_0x16af55[_0xf263('0x48')]=_0x36df8e[_0xf263('0x48')];_0x16af55['predictiveIntervalErlangCallsDroppedCalls']=_0x36df8e[_0xf263('0x49')];_0x16af55[_0xf263('0x4a')]=_0x36df8e[_0xf263('0x4a')];_0x16af55['predictiveIntervalMultiplicativeFactor']=_0x36df8e[_0xf263('0x4b')];_0x16af55[_0xf263('0x4c')]=_0x36df8e[_0xf263('0x4c')];_0x16af55['predictiveIntervalAvailable']=_0x36df8e[_0xf263('0x4d')];_0x16af55['predictiveIntervalTotalCalls']=_0x36df8e[_0xf263('0x4e')];_0x16af55[_0xf263('0x1a')]=_0x36df8e[_0xf263('0x1a')];_0x16af55['originated']=_0x36df8e['originated'];_0x16af55['erlangCalls']=_0x36df8e[_0xf263('0x4f')];_0x16af55[_0xf263('0x50')]=_0x36df8e['erlangCallToSecond'];_0x16af55['erlangAbandonmentRate']=_0x36df8e[_0xf263('0x51')];_0x16af55[_0xf263('0x52')]=_0x36df8e[_0xf263('0x52')];_0x16af55[_0xf263('0x53')]=_0x36df8e[_0xf263('0x53')];_0x16af55['startProgressive']=_0x36df8e[_0xf263('0x54')];}if(_0x36df8e[_0xf263('0x55')]){_0x16af55[_0xf263('0x55')]={'id':_0x36df8e[_0xf263('0x55')]['id'],'name':_0x36df8e[_0xf263('0x55')]['name'],'active':_0x36df8e[_0xf263('0x55')][_0xf263('0x56')],'callerid':_0x36df8e[_0xf263('0x55')]['callerid']};}if(_0x36df8e['Interval']){_0x16af55[_0xf263('0x57')]={'id':_0x36df8e['Interval']['id'],'name':_0x36df8e['Interval'][_0xf263('0xa')]};}_0x5dc48f[_0xf263('0x58')](_0x16af55);}}_0x54f4e4({'count':_0x5dc48f[_0xf263('0x59')],'rows':_0x5dc48f});});},'UpdateVoiceQueue':function(_0x5c01d5){return new Promise(function(_0x360268,_0x10f12f){var _0x513044=_[_0xf263('0x5a')](_0x453b6e[_0xf263('0x21')],{'id':parseInt(_0x5c01d5['id'])});var _0x51db8f=_[_0xf263('0x5b')](_0x5c01d5,['id']);if(_0x513044){for(var _0x1ed1cd in _0x51db8f){if(typeof _0x51db8f[_0x1ed1cd]!=='undefined'&&typeof _0x513044[_0x1ed1cd]!==_0xf263('0x5c')){_0x513044[_0x1ed1cd]=_0x51db8f[_0x1ed1cd];}}_0x360268(_0x513044);}else{_0x10f12f();}});},'VoiceChannels':function(){return new Promise(function(_0xac51d){var _0x2d7a2b=_[_0xf263('0x5d')](_0x453b6e[_0xf263('0x5e')]);_0xac51d({'count':_0x2d7a2b[_0xf263('0x59')],'rows':_0x2d7a2b});});},'VoiceChannelMixMonitor':function(_0xd5f916){var _0x5995c9=this;return new Promise(function(_0x11eb85,_0x2e8cbe){if(ami[_0xf263('0xf')]()==![]){return _0x2e8cbe(_0x5995c9[_0xf263('0x10')](0x1f4,[config[_0xf263('0x11')]['ip'],config[_0xf263('0x11')][_0xf263('0x12')],_0xf263('0x1c')]['join']('\x20')));}var _0x8993f7=schema(properties[_0xf263('0x5f')])[_0xf263('0x3')](_0xd5f916);if(_0x8993f7[_0xf263('0x59')]>0x0){return _0x2e8cbe(_0x5995c9['error'](0x1f4,_[_0xf263('0x60')](_0x8993f7,'message')[_0xf263('0x13')](',\x20')));}var _0x159852=_[_0xf263('0x5a')](_0x453b6e['channels'],{'uniqueid':_0xd5f916['uniqueid']});if(_0x159852&&_0x159852['channel']){var _0x4f5578=util['format'](_0xf263('0x61'),_0xd5f916[_0xf263('0x62')]||_0xd5f916['uniqueid'],_0xd5f916[_0xf263('0x8')]||_0xf263('0x63'));return ami[_0xf263('0x19')]({'action':_0xf263('0x64'),'channel':_0x159852[_0xf263('0x65')],'file':_0x4f5578,'options':_0xf263('0x66')})[_0xf263('0x1f')](function(_0x3bc40a){var _0x34afc5=_[_0xf263('0x5a')](_0x159852[_0xf263('0x67')],{'filename':_0xf263('0x68')+_0x4f5578['toLowerCase']()});if(_[_0xf263('0x69')](_0x34afc5)){_0x159852['monitors']['push']({'filename':_0xf263('0x68')+_0x4f5578['toLowerCase'](),'createdAt':moment()['format'](_0xf263('0x6a')),'mixmonitorid':_0x3bc40a[_0xf263('0x6b')],'status':'rec'});}else{_0x34afc5[_0xf263('0x6b')]=_0x3bc40a['mixmonitorid'];_0x34afc5[_0xf263('0x6c')]=_0xf263('0x6d');}_0x11eb85({'code':0xc8,'message':[_0xd5f916['uniqueid'],_0xf263('0x6e'),_0x3bc40a[_0xf263('0x6b')]]['join']('\x20'),'mixmonitorid':_0x3bc40a[_0xf263('0x6b')]});})['catch'](function(_0x2530ba){_0x2e8cbe(_0x5995c9[_0xf263('0x10')](0x1f5,[_0xd5f916[_0xf263('0x6f')],_0x2530ba[_0xf263('0x1a')][_0xf263('0x70')]()][_0xf263('0x13')]('\x20')));});}else{return _0x2e8cbe(_0x5995c9[_0xf263('0x10')](0x1f5,_0xf263('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x21aa3b){var _0x9afc96=this;return new Promise(function(_0x26a06f,_0x393159){if(ami[_0xf263('0xf')]()==![]){return _0x393159(_0x9afc96[_0xf263('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf263('0x12')],'ami\x20disconnected'][_0xf263('0x13')]('\x20')));}var _0x1a0e10=schema(properties[_0xf263('0x5f')])[_0xf263('0x3')](_0x21aa3b);if(_0x1a0e10[_0xf263('0x59')]>0x0){return _0x393159(_0x9afc96[_0xf263('0x10')](0x1f4,_[_0xf263('0x60')](_0x1a0e10,_0xf263('0x1a'))['join'](',\x20')));}var _0x1790e5=_[_0xf263('0x5a')](_0x453b6e[_0xf263('0x5e')],{'uniqueid':_0x21aa3b[_0xf263('0x6f')]});if(_0x1790e5){return Promise[_0xf263('0x72')]()['then'](function(){if(_0x1790e5[_0xf263('0x65')]){return ami['Action']({'action':_0xf263('0x73'),'channel':_0x1790e5['channel'],'mixmonitorid':_0x21aa3b[_0xf263('0x6b')]})[_0xf263('0x1b')](function(){});}})['then'](function(){if(_0x1790e5[_0xf263('0x74')]){return ami[_0xf263('0x19')]({'action':_0xf263('0x73'),'channel':_0x1790e5[_0xf263('0x74')],'mixmonitorid':_0x21aa3b['mixmonitorid']})['catch'](function(){});}})[_0xf263('0x1f')](function(){var _0x11bfcd=_[_0xf263('0x5a')](_0x1790e5[_0xf263('0x67')],{'mixmonitorid':_0x21aa3b[_0xf263('0x6b')]});if(_0x11bfcd){_0x11bfcd[_0xf263('0x6c')]='stop';}})['then'](function(){var _0x53d979=util['format'](_0xf263('0x61'),_0x21aa3b[_0xf263('0x62')]||_0x21aa3b['uniqueid'],_0x21aa3b[_0xf263('0x8')]||_0xf263('0x63'));var _0x3a3d3c=_['find'](_0x1790e5[_0xf263('0x67')],{'filename':_0xf263('0x68')+_0x53d979[_0xf263('0x70')]()});if(_0x3a3d3c){_0x3a3d3c[_0xf263('0x6c')]=_0xf263('0x75');}})[_0xf263('0x1f')](function(){_0x26a06f({'code':0xc8,'message':[_0x21aa3b[_0xf263('0x6f')],_0xf263('0x76')]['join']('\x20')});})[_0xf263('0x1b')](function(_0x1170c5){_0x393159(_0x9afc96[_0xf263('0x10')](0x1f5,[_0x21aa3b['uniqueid'],_0x1170c5[_0xf263('0x1a')][_0xf263('0x70')]()][_0xf263('0x13')]('\x20')));});}else{return _0x393159(_0x9afc96[_0xf263('0x10')](0x1f5,_0xf263('0x71')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0xcde174){var _0x4a8813=_[_0xf263('0x5d')](_0x453b6e['queueChannels']);_0xcde174({'count':_0x4a8813[_0xf263('0x59')],'rows':_0x4a8813});});},'VoiceQueuesChannel':function(_0x25a8ea){var _0x291238=this;return new Promise(function(_0xae54e5,_0x299e52){var _0x240ad3=schema(properties[_0xf263('0x77')])[_0xf263('0x3')](_0x25a8ea);if(_0x240ad3['length']>0x0){return _0x299e52(_0x291238[_0xf263('0x10')](0x1f4,_[_0xf263('0x60')](_0x240ad3,_0xf263('0x1a'))['join'](',\x20')));}var _0x393b2d=_['find'](_0x453b6e[_0xf263('0x78')],{'uniqueid':_0x25a8ea[_0xf263('0x6f')]});if(_0x393b2d){_0xae54e5(_0x393b2d);}else{return _0x299e52(_0x291238['error'](0x1f5,_0xf263('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x21ebd1){var _0x5c1645=this;return new Promise(function(_0x391b71,_0xb7fe43){if(ami[_0xf263('0xf')]()==![]){return _0xb7fe43(_0x5c1645['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf263('0x12')],_0xf263('0x1c')][_0xf263('0x13')]('\x20')));}var _0x4b5575=schema(properties['voicequeuechannelhangup'])[_0xf263('0x3')](_0x21ebd1);if(_0x4b5575[_0xf263('0x59')]>0x0){return _0xb7fe43(_0x5c1645[_0xf263('0x10')](0x1f4,_['map'](_0x4b5575,_0xf263('0x1a'))['join'](',\x20')));}var _0xfbec5f=_[_0xf263('0x5a')](_0x453b6e[_0xf263('0x78')],{'uniqueid':_0x21ebd1[_0xf263('0x6f')]});if(_0xfbec5f&&_0xfbec5f[_0xf263('0x65')]){return ami['Action']({'action':'Hangup','channel':_0xfbec5f[_0xf263('0x65')]})[_0xf263('0x1f')](function(_0x4f6a2d){_0x391b71({'code':0xc8,'message':[_0x21ebd1[_0xf263('0x6f')],_0x4f6a2d[_0xf263('0x1a')][_0xf263('0x70')]()][_0xf263('0x13')]('\x20')});})[_0xf263('0x1b')](function(_0x2ad3e4){_0xb7fe43(_0x5c1645[_0xf263('0x10')](0x1f5,[_0x21ebd1['uniqueid'],_0x2ad3e4[_0xf263('0x1a')][_0xf263('0x70')]()][_0xf263('0x13')]('\x20')));});}else{return _0xb7fe43(_0x5c1645[_0xf263('0x10')](0x1f5,_0xf263('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x47af3f){var _0x10b1e9=this;return new Promise(function(_0x593aad,_0x43a70c){if(ami[_0xf263('0xf')]()==![]){return _0x43a70c(_0x10b1e9[_0xf263('0x10')](0x1f4,[config[_0xf263('0x11')]['ip'],config[_0xf263('0x11')]['username'],_0xf263('0x1c')]['join']('\x20')));}var _0x5d9bf9=schema(properties['voicequeuechannelredirect'])['validate'](_0x47af3f);if(_0x5d9bf9[_0xf263('0x59')]>0x0){return _0x43a70c(_0x10b1e9[_0xf263('0x10')](0x1f4,_[_0xf263('0x60')](_0x5d9bf9,_0xf263('0x1a'))[_0xf263('0x13')](',\x20')));}var _0x1e1909=_[_0xf263('0x5a')](_0x453b6e['queueChannels'],{'uniqueid':_0x47af3f[_0xf263('0x6f')]});if(_0x1e1909&&_0x1e1909['channel']){return ami[_0xf263('0x19')]({'action':_0xf263('0x79'),'channel':_0x1e1909[_0xf263('0x65')],'exten':_0x47af3f[_0xf263('0x7a')],'context':_0x47af3f['context']||_0x1e1909[_0xf263('0x7b')],'priority':0x1})[_0xf263('0x1f')](function(_0x426e3e){_0x593aad({'code':0xc8,'message':[_0x47af3f[_0xf263('0x6f')],_0x426e3e[_0xf263('0x1a')]['toLowerCase']()][_0xf263('0x13')]('\x20')});})[_0xf263('0x1b')](function(_0x174a4a){_0x43a70c(_0x10b1e9[_0xf263('0x10')](0x1f5,[_0x47af3f[_0xf263('0x6f')],_0x174a4a[_0xf263('0x1a')][_0xf263('0x70')]()][_0xf263('0x13')]('\x20')));});}else{return _0x43a70c(_0x10b1e9['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x176def){return new Promise(function(_0x316ab4){var _0x2a90f8=_['values'](_0x453b6e[_0xf263('0xd')]);if(_0x176def&&_0x176def['id']){var _0x550bc2=_[_0xf263('0x5a')](_0x2a90f8,function(_0xfe8b6){return _0xfe8b6['id']===_0x176def['id'];});_0x316ab4(_0x550bc2);}else{_0x316ab4({'count':_0x2a90f8['length'],'rows':_0x2a90f8});}});},'Telephones':function(){return new Promise(function(_0x178f6c){var _0x443a6b=_[_0xf263('0x5d')](_0x453b6e[_0xf263('0x7c')]);_0x178f6c({'count':_0x443a6b[_0xf263('0x59')],'rows':_0x443a6b});});},'Trunks':function(){return new Promise(function(_0x3d9252){var _0x18b979=_[_0xf263('0x5d')](_0x453b6e[_0xf263('0x7d')]);_0x3d9252({'count':_0x18b979[_0xf263('0x59')],'rows':_0x18b979});});},'OutboundChannels':function(){return new Promise(function(_0x54cf50){var _0x5a98d1=_['values'](_0x453b6e[_0xf263('0x7e')]);_0x54cf50({'count':_0x5a98d1[_0xf263('0x59')],'rows':_0x5a98d1});});},'Outbound':function(){return new Promise(function(_0x4f8d94){_0x4f8d94(_0x453b6e[_0xf263('0x2e')]);});},'Campaigns':function(){return new Promise(function(_0x5af311){var _0x5172bd=_[_0xf263('0x5d')](_0x453b6e['campaigns']);_0x5af311({'count':_0x5172bd[_0xf263('0x59')],'rows':_0x5172bd});});},'VoiceQueuesPreview':function(_0x2eaead){var _0x39b80d=this;return new Promise(function(_0x24a1aa,_0x39858f){_0x528b98[_0xf263('0x7f')](_0x2eaead['id'])[_0xf263('0x1f')](function(_0x287e47){_0x24a1aa({'code':0xc8,'message':_0x287e47[_0xf263('0x1a')]});})[_0xf263('0x1b')](function(_0x14f414){_0x39858f(_0x39b80d['error'](0x1f4,_0x14f414[_0xf263('0x1a')]));});});},'EventManager':function(_0x31dcef){var _0x17dd5d=this;return new Promise(function(_0x2fec90,_0x221784){if(!_0x31dcef['event']){return _0x221784(_0x17dd5d['error'](0x1f4,_0xf263('0x80')));}ami[_0xf263('0x81')](_0xf263('0x82')+_0x31dcef[_0xf263('0x83')],_0x31dcef['message']);_0x2fec90({'code':0xc8,'message':_0x31dcef});});},'FaxAccounts':function(){return new Promise(function(_0x22fae2){var _0x5d0468=_['values'](_0x453b6e[_0xf263('0x84')]);_0x22fae2({'count':_0x5d0468[_0xf263('0x59')],'rows':_0x5d0468});});},'SendFax':function(_0x49a067){var _0x1fb7fd=this;return new Promise(function(_0x2a0425,_0x5ad7d1){_0xbd1369[_0xf263('0x85')](_0x49a067)[_0xf263('0x1f')](function(_0x16dd33){_0x2a0425({'code':0xc8,'message':_0x16dd33['message']});})[_0xf263('0x1b')](function(_0x214e20){_0x5ad7d1(_0x1fb7fd[_0xf263('0x10')](0x1f4,_0x214e20[_0xf263('0x1a')]));});});},'CheckAfterSend':function(_0x31b1f6){var _0x3b3b91=this;return new Promise(function(_0x501149,_0x487c07){_0xbd1369[_0xf263('0x86')](_0x31b1f6)[_0xf263('0x1f')](function(_0x2a6916){_0x501149({'code':0xc8,'message':_0x2a6916[_0xf263('0x1a')]});})[_0xf263('0x1b')](function(_0x442750){_0x487c07(_0x3b3b91[_0xf263('0x10')](0x1f4,_0x442750[_0xf263('0x1a')]));});});}};var _0x46d24e=jayson['server'](_0x4fded6)['http']();_0x46d24e['on'](_0xf263('0x10'),function(_0x3061d5){return _0x4c7ab2(_0x3061d5);});_0x46d24e['listen'](0x232a,'127.0.0.1',function(){console['log'](_0xf263('0x87'),0x232a);return _0xdb2fc1(_0xf263('0x88')+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 c57670d..1822cef 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 _0xfc5f=['exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','emit'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xfc5f,0xa1));var _0xffc5=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xfc5f[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xffc5('0x0'));var BPromise=require(_0xffc5('0x1'));var Redis=require(_0xffc5('0x2'));var util=require(_0xffc5('0x3'));var config=require(_0xffc5('0x4'));var logger=require(_0xffc5('0x5'))(_0xffc5('0x6'));var cmContactRpc=require(_0xffc5('0x7'));config['redis']=_['defaults'](config[_0xffc5('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xffc5('0x8')]));function emit(_0x58241c,_0x1f6c5e,_0x319217,_0x4cc6c2,_0x13564d){logger['info']('[CM][%s][%s]',_0x58241c,_0x1f6c5e['id'],_0x319217,_0x4cc6c2,JSON['stringify'](_0x13564d));io['to'](_0x319217)[_0xffc5('0x9')](_0x4cc6c2,_0x13564d);}exports[_0xffc5('0xa')]=function(_0x535f57,_0x54e5cc,_0x482214,_0x49a122){var _0x1db5b7,_0x40dd9c;var _0xfd05f0={};var _0x11c1b0;var _0x52bb37=Number(_0x482214[_0xffc5('0xb')]);var _0x38dbe3=_0x482214[_0xffc5('0xc')]?Boolean(Number(_0x482214[_0xffc5('0xc')])):![];var _0x3c84f;var _0x50274f=![];if(!_[_0xffc5('0xd')](_0x482214['data5'])){if(_0x482214[_0xffc5('0xe')]=='1')_0x50274f=!![];}if(!_0x50274f){if(_0x49a122[_0xffc5('0xf')]){_0xfd05f0['id']=_0x49a122['xmd-contactid'];}}if(!_0xfd05f0['id']){_0xfd05f0['ListId']=_0x52bb37;_0x3c84f=_0x482214[_0xffc5('0x10')]&&_0x482214[_0xffc5('0x10')]!=='0'?_0x482214[_0xffc5('0x10')][_0xffc5('0x11')](','):[_0xffc5('0x12')];_0xfd05f0[_0xffc5('0x13')]=_[_0xffc5('0x14')](_0x3c84f,function(_0x2e6493){var _0x3b4ae7={};_0x3b4ae7[_0x2e6493]=_0x49a122[_0xffc5('0x15')]?_0x49a122[_0xffc5('0x16')]:_0x49a122['calleridnum'];return _0x3b4ae7;});_0x11c1b0=_0x49a122[_0xffc5('0x15')]?_0x49a122['destcalleridnum']:_0x49a122[_0xffc5('0x17')];}var _0x49a316=['id','firstName',_0xffc5('0x18'),_0xffc5('0x12'),_0xffc5('0x19'),_0xffc5('0x1a'),_0xffc5('0x1b'),_0xffc5('0x1c'),_0xffc5('0x1d'),_0xffc5('0x1e')];var _0xa5f8b=_[_0xffc5('0x1f')](_0x49a316,_0x3c84f);BPromise[_0xffc5('0x20')]()[_0xffc5('0x21')](cmContactRpc[_0xffc5('0x22')]({'attributes':_0xa5f8b,'where':_0xfd05f0,'phone':_0x11c1b0}))[_0xffc5('0x21')](function(_0x21be36){_0x40dd9c=_0x21be36;if(!_['isEmpty'](_0x40dd9c)){if(_0x40dd9c[_0xffc5('0x23')]===0x1){_0x1db5b7=_0x40dd9c[0x0];logger[_0xffc5('0x24')](_0xffc5('0x25'),_0x49a122[_0xffc5('0x26')],_0x54e5cc['id'],_0x1db5b7['id']);}else{logger[_0xffc5('0x24')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x49a122[_0xffc5('0x26')],_0x54e5cc['id'],_[_0xffc5('0x14')](_0x40dd9c,'id')[_0xffc5('0x27')](','));}return;}else{logger[_0xffc5('0x24')](_0xffc5('0x28'),_0x49a122[_0xffc5('0x26')],_0x54e5cc['id']);var _0x400286={'ListId':_0x52bb37};var _0x9df4af=_0x482214[_0xffc5('0x29')]&&_0x482214[_0xffc5('0x29')]!=='0'?_0x482214[_0xffc5('0x29')]:_0xffc5('0x12');if(_0x38dbe3){logger[_0xffc5('0x24')](_0xffc5('0x2a'),_0x49a122[_0xffc5('0x26')],_0x54e5cc['id']);_0x400286[_0x9df4af]=_[_0xffc5('0xd')](_0x49a122[_0xffc5('0x15')])?_0x49a122['calleridnum']:_0x49a122[_0xffc5('0x16')];if(_[_0xffc5('0xd')](_0x49a122['routeId'])){_0x400286[_0xffc5('0x2b')]=_0x49a122[_0xffc5('0x2c')]&&_0x49a122['calleridname']!==''?_0x49a122[_0xffc5('0x2c')]:_0xffc5('0x2d');}else{_0x400286[_0xffc5('0x2b')]=_0x49a122['destcalleridname']&&_0x49a122[_0xffc5('0x2e')]!==''?_0x49a122['destcalleridname']:_0xffc5('0x2d');}return BPromise[_0xffc5('0x20')]()[_0xffc5('0x21')](cmContactRpc['createContact'](_0x400286))[_0xffc5('0x21')](function(_0x1973a9){_0x1db5b7=_0x1973a9;_0x40dd9c[_0xffc5('0x2f')](_0x1973a9);if(_0x1db5b7){logger[_0xffc5('0x24')](_0xffc5('0x30'),_0x49a122['uniqueid'],_0x54e5cc['id'],_0x1db5b7['id']);}return;});}else{logger['info'](_0xffc5('0x31'),_0x49a122[_0xffc5('0x26')],_0x54e5cc['id']);_0x400286[_0x9df4af]=_['isNil'](_0x49a122[_0xffc5('0x15')])?_0x49a122['calleridnum']:_0x49a122[_0xffc5('0x16')];if(_['isNil'](_0x49a122['routeId'])){_0x400286[_0xffc5('0x2b')]=_0x49a122['calleridname']&&_0x49a122[_0xffc5('0x2c')]!==_0xffc5('0x32')?_0x49a122['calleridname']:_0xffc5('0x2d');}else{_0x400286[_0xffc5('0x2b')]=_0x49a122[_0xffc5('0x2e')]&&_0x49a122[_0xffc5('0x2e')]!==_0xffc5('0x32')?_0x49a122[_0xffc5('0x2e')]:_0xffc5('0x2d');}_0x1db5b7=_0x400286;_0x40dd9c['push'](_0x400286);return;}}})[_0xffc5('0x21')](function(){if(_0x535f57){emit(_0x49a122[_0xffc5('0x26')],_0x54e5cc,util['format'](_0xffc5('0x33'),_0x535f57[_0xffc5('0x34')]),util['format'](_0xffc5('0x35'),_0x482214[_0xffc5('0x36')][_0xffc5('0x37')]()),{'evt':_[_0xffc5('0x38')](_0x49a122,{'autoCreate':_0x38dbe3}),'contact':_0x1db5b7===undefined?{}:_0x1db5b7,'contacts':_0x40dd9c['length']===0x0?undefined:_0x40dd9c});}});}; \ No newline at end of file +var _0x184d=['user:%s','trigger:%s','action','toLowerCase','length','bluebird','trigger','../../rpc/cmContact','redis','defaults','localhost','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','updatedAt','union','resolve','then','getContacts','info','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format'];(function(_0x202ea3,_0x38ab41){var _0x58787b=function(_0x1dce0b){while(--_0x1dce0b){_0x202ea3['push'](_0x202ea3['shift']());}};_0x58787b(++_0x38ab41);}(_0x184d,0x1d0));var _0xd184=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x184d[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var BPromise=require(_0xd184('0x0'));var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd184('0x1'));var cmContactRpc=require(_0xd184('0x2'));config[_0xd184('0x3')]=_[_0xd184('0x4')](config[_0xd184('0x3')],{'host':_0xd184('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x49f8e8,_0x1d8044,_0x4449a5,_0x5b9977,_0x28a01a){logger['info']('[CM][%s][%s]',_0x49f8e8,_0x1d8044['id'],_0x4449a5,_0x5b9977,JSON[_0xd184('0x6')](_0x28a01a));io['to'](_0x4449a5)[_0xd184('0x7')](_0x5b9977,_0x28a01a);}exports[_0xd184('0x8')]=function(_0x4eaee2,_0x40933b,_0x2569ac,_0x4d2ced){var _0x30ac4c,_0x155bda;var _0x16a5b3={};var _0x5eb8fc;var _0x9cb460=Number(_0x2569ac['data1']);var _0x33b94c=_0x2569ac[_0xd184('0x9')]?Boolean(Number(_0x2569ac[_0xd184('0x9')])):![];var _0x3fbe29;var _0x11cb5a=![];if(!_[_0xd184('0xa')](_0x2569ac['data5'])){if(_0x2569ac[_0xd184('0xb')]=='1')_0x11cb5a=!![];}if(!_0x11cb5a){if(_0x4d2ced[_0xd184('0xc')]){_0x16a5b3['id']=_0x4d2ced[_0xd184('0xc')];}}if(!_0x16a5b3['id']){_0x16a5b3[_0xd184('0xd')]=_0x9cb460;_0x3fbe29=_0x2569ac[_0xd184('0xe')]&&_0x2569ac[_0xd184('0xe')]!=='0'?_0x2569ac[_0xd184('0xe')][_0xd184('0xf')](','):[_0xd184('0x10')];_0x16a5b3[_0xd184('0x11')]=_['map'](_0x3fbe29,function(_0x48203f){var _0x573a68={};_0x573a68[_0x48203f]=_0x4d2ced[_0xd184('0x12')]?_0x4d2ced[_0xd184('0x13')]:_0x4d2ced[_0xd184('0x14')];return _0x573a68;});_0x5eb8fc=_0x4d2ced[_0xd184('0x12')]?_0x4d2ced[_0xd184('0x13')]:_0x4d2ced[_0xd184('0x14')];}var _0x2f9f39=['id','firstName',_0xd184('0x15'),_0xd184('0x10'),_0xd184('0x16'),_0xd184('0x17'),_0xd184('0xd'),_0xd184('0x18'),'scheduledAt',_0xd184('0x19')];var _0x565c38=_[_0xd184('0x1a')](_0x2f9f39,_0x3fbe29);BPromise[_0xd184('0x1b')]()[_0xd184('0x1c')](cmContactRpc[_0xd184('0x1d')]({'attributes':_0x565c38,'where':_0x16a5b3,'phone':_0x5eb8fc}))[_0xd184('0x1c')](function(_0x1aeafb){_0x155bda=_0x1aeafb;if(!_['isEmpty'](_0x155bda)){if(_0x155bda['length']===0x1){_0x30ac4c=_0x155bda[0x0];logger[_0xd184('0x1e')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4d2ced['uniqueid'],_0x40933b['id'],_0x30ac4c['id']);}else{logger[_0xd184('0x1e')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4d2ced[_0xd184('0x1f')],_0x40933b['id'],_[_0xd184('0x20')](_0x155bda,'id')[_0xd184('0x21')](','));}return;}else{logger['info'](_0xd184('0x22'),_0x4d2ced[_0xd184('0x1f')],_0x40933b['id']);var _0x40a239={'ListId':_0x9cb460};var _0x40c4e6=_0x2569ac[_0xd184('0x23')]&&_0x2569ac[_0xd184('0x23')]!=='0'?_0x2569ac[_0xd184('0x23')]:_0xd184('0x10');if(_0x33b94c){logger[_0xd184('0x1e')](_0xd184('0x24'),_0x4d2ced['uniqueid'],_0x40933b['id']);_0x40a239[_0x40c4e6]=_[_0xd184('0xa')](_0x4d2ced['routeId'])?_0x4d2ced[_0xd184('0x14')]:_0x4d2ced[_0xd184('0x13')];if(_['isNil'](_0x4d2ced[_0xd184('0x12')])){_0x40a239[_0xd184('0x25')]=_0x4d2ced[_0xd184('0x26')]&&_0x4d2ced[_0xd184('0x26')]!==_0xd184('0x27')?_0x4d2ced['calleridname']:_0xd184('0x28');}else{_0x40a239[_0xd184('0x25')]=_0x4d2ced['destcalleridname']&&_0x4d2ced[_0xd184('0x29')]!==_0xd184('0x27')?_0x4d2ced[_0xd184('0x29')]:_0xd184('0x28');}return BPromise[_0xd184('0x1b')]()[_0xd184('0x1c')](cmContactRpc[_0xd184('0x2a')](_0x40a239))[_0xd184('0x1c')](function(_0x1d3a1a){_0x30ac4c=_0x1d3a1a;_0x155bda[_0xd184('0x2b')](_0x1d3a1a);if(_0x30ac4c){logger[_0xd184('0x1e')](_0xd184('0x2c'),_0x4d2ced[_0xd184('0x1f')],_0x40933b['id'],_0x30ac4c['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x4d2ced[_0xd184('0x1f')],_0x40933b['id']);_0x40a239[_0x40c4e6]=_[_0xd184('0xa')](_0x4d2ced[_0xd184('0x12')])?_0x4d2ced[_0xd184('0x14')]:_0x4d2ced[_0xd184('0x13')];if(_[_0xd184('0xa')](_0x4d2ced['routeId'])){_0x40a239[_0xd184('0x25')]=_0x4d2ced['calleridname']&&_0x4d2ced[_0xd184('0x26')]!==''?_0x4d2ced[_0xd184('0x26')]:_0xd184('0x28');}else{_0x40a239['firstName']=_0x4d2ced[_0xd184('0x29')]&&_0x4d2ced[_0xd184('0x29')]!==_0xd184('0x27')?_0x4d2ced[_0xd184('0x29')]:_0xd184('0x28');}_0x30ac4c=_0x40a239;_0x155bda[_0xd184('0x2b')](_0x40a239);return;}}})['then'](function(){if(_0x4eaee2){emit(_0x4d2ced['uniqueid'],_0x40933b,util[_0xd184('0x2d')](_0xd184('0x2e'),_0x4eaee2['name']),util[_0xd184('0x2d')](_0xd184('0x2f'),_0x2569ac[_0xd184('0x30')][_0xd184('0x31')]()),{'evt':_['merge'](_0x4d2ced,{'autoCreate':_0x33b94c}),'contact':_0x30ac4c===undefined?{}:_0x30ac4c,'contacts':_0x155bda[_0xd184('0x32')]===0x0?undefined:_0x155bda});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index cf0543e..dcca0dc 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 _0x8c7a=['windowWidth','data5','windowHeight','600','data6','winApplication','format','name','toLowerCase','jscripty','trigger:%s','user:%s','exec','integration','queue','routeId','urlforward','search','replace','channel','AllConditions','length','every','checkConditions','AnyConditions','field','account','ChatWebsiteId','upperFirst','AccountId','operator','interaction','message','event','value','membername','lastevent','substatus','offlineMessage','created','equals','util','lodash','url','mustache','ioredis','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','freshdeskAccounts','custom:agentcalled','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','syncCustomEvent','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','clone','motionChannel','undefined','voice','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','Actions','action','contactmanager','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation'];(function(_0x42b535,_0x14d5df){var _0x8d05fb=function(_0x330901){while(--_0x330901){_0x42b535['push'](_0x42b535['shift']());}};_0x8d05fb(++_0x14d5df);}(_0x8c7a,0x197));var _0xa8c7=function(_0x1c55a2,_0x279392){_0x1c55a2=_0x1c55a2-0x0;var _0x22d307=_0x8c7a[_0x1c55a2];return _0x22d307;};'use strict';var util=require(_0xa8c7('0x0'));var _=require(_0xa8c7('0x1'));var url=require(_0xa8c7('0x2'));var Mustache=require(_0xa8c7('0x3'));var Redis=require(_0xa8c7('0x4'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0xa8c7('0x5'));var config=require(_0xa8c7('0x6'));var logger=require(_0xa8c7('0x7'))(_0xa8c7('0x8'));var ami=require('../ami');config[_0xa8c7('0x9')]=_[_0xa8c7('0xa')](config[_0xa8c7('0x9')],{'host':_0xa8c7('0xb'),'port':0x18eb});var io=require(_0xa8c7('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0xa2cd18,_0x46ed47){return _0xa2cd18==_0x46ed47;},'not_equals':function(_0x19d302,_0x326694){return _0x19d302!=_0x326694;}};var barAndWebActions=[_0xa8c7('0xd'),_0xa8c7('0x2'),_0xa8c7('0xe')];function Trigger(_0x444ba1){this[_0xa8c7('0xf')]=_0x444ba1[_0xa8c7('0xf')];this[_0xa8c7('0x10')]=_0x444ba1[_0xa8c7('0x10')];this['voiceQueues']=_0x444ba1[_0xa8c7('0x11')];this['templates']=_0x444ba1[_0xa8c7('0x12')];this['voiceExtensions']=_0x444ba1[_0xa8c7('0x13')];this['zendeskAccounts']=_0x444ba1[_0xa8c7('0x14')];this['freshdeskAccounts']=_0x444ba1['freshdeskAccounts'];this['salesforceAccounts']=_0x444ba1['salesforceAccounts'];this[_0xa8c7('0x15')]=_0x444ba1[_0xa8c7('0x15')];this[_0xa8c7('0x16')]=_0x444ba1[_0xa8c7('0x16')];this[_0xa8c7('0x17')]=_0x444ba1['deskAccounts'];this[_0xa8c7('0x18')]=_0x444ba1['vtigerAccounts'];this['servicenowAccounts']=_0x444ba1[_0xa8c7('0x19')];this['dynamics365Accounts']=_0x444ba1[_0xa8c7('0x1a')];this['freshsalesAccounts']=_0x444ba1[_0xa8c7('0x1b')];this[_0xa8c7('0x1c')]={'zendesk':this[_0xa8c7('0x14')],'salesforce':this[_0xa8c7('0x1d')],'freshdesk':this[_0xa8c7('0x1e')],'sugarcrm':this[_0xa8c7('0x15')],'zoho':this[_0xa8c7('0x16')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xa8c7('0x1b')],'servicenow':this[_0xa8c7('0x19')]};ami['on'](_0xa8c7('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0xa8c7('0x20'),this['syncCustomEvent'][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0xa8c7('0x23'),this['syncCustomEvent'][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x24'),this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on']('custom:agentnoanswer',this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x26'),this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x27'),this[_0xa8c7('0x25')]['bind'](this));ami['on'](_0xa8c7('0x28'),this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x29'),this[_0xa8c7('0x25')]['bind'](this));ami['on'](_0xa8c7('0x2a'),this['syncCustomEvent'][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x2b'),this['syncCustomEvent'][_0xa8c7('0x21')](this));ami['on']('custom:dialbegin',this[_0xa8c7('0x2c')][_0xa8c7('0x21')](this));ami['on']('custom:dialconnect',this[_0xa8c7('0x2c')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x2d'),this['syncAgentDial'][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x2e'),this['syncCustomEvent'][_0xa8c7('0x21')](this));ami['on']('custom:closedinteraction',this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x2f'),this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x30'),this[_0xa8c7('0x25')]['bind'](this));ami['on'](_0xa8c7('0x31'),this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x32'),this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on']('custom:rejectmessage',this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));ami['on'](_0xa8c7('0x33'),this[_0xa8c7('0x25')][_0xa8c7('0x21')](this));}Trigger[_0xa8c7('0x34')]['emit']=function(_0x14833c,_0x423a28,_0x1400ea){logger['info'](_0x14833c,_0x423a28,JSON['stringify'](_0x1400ea));io['to'](_0x14833c)[_0xa8c7('0x35')](_0x423a28,_0x1400ea);};Trigger[_0xa8c7('0x34')]['syncCustomEvent']=function(_0x2bbebf){var _0x4ee7b1=_[_0xa8c7('0x36')](_0x2bbebf);if(typeof _0x4ee7b1[_0xa8c7('0x37')]===_0xa8c7('0x38')){_0x4ee7b1[_0xa8c7('0x37')]=_0xa8c7('0x39');}this['checkTriggers'](_0x4ee7b1);};Trigger[_0xa8c7('0x34')]['syncAgentDial']=function(_0x170af6){if(this[_0xa8c7('0x10')][_0x170af6[_0xa8c7('0x3a')]]){this['syncCustomEvent'](_0x170af6);}};Trigger['prototype'][_0xa8c7('0x3b')]=function(_0x13a07e){var _0x18a38f;for(var _0x3f4b46 in this[_0xa8c7('0xf')]){if(this[_0xa8c7('0xf')][_0xa8c7('0x3c')](_0x3f4b46)){if(this[_0xa8c7('0xf')][_0x3f4b46][_0xa8c7('0x3d')]){_0x18a38f=this[_0xa8c7('0x3e')](this['triggers'][_0x3f4b46],_0x13a07e);if(_0x18a38f){_[_0xa8c7('0x3f')](_0x13a07e,_0x13a07e['variables']);for(var _0x377e2b=0x0,_0x548817,_0xf60c94,_0x1cb780;_0x377e2b0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x4e946b,_0x8a77af){_0x4e946b=_0x4e946b-0x0;var _0xeccdae=_0xe14b[_0x4e946b];return _0xeccdae;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 9861cbd..d1a6f02 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 _0x1f27=['ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','stripTrailingSlash','serverUrl','unmanaged','modernAuthentication','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','username','destcalleridnum','calleridnum','POST','contacts','headers','odata-entityid','lastIndexOf','enduserId','toLowerCase','outbound','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','value','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','nameField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f27,0x1b5));var _0x71f2=function(_0x1b4c11,_0x30c8c7){_0x1b4c11=_0x1b4c11-0x0;var _0x134f71=_0x1f27[_0x1b4c11];return _0x134f71;};'use strict';var _=require('lodash');var rp=require(_0x71f2('0x0'));var util=require(_0x71f2('0x1'));var intUtil=require(_0x71f2('0x2'));var md5=require(_0x71f2('0x3'));var Redis=require(_0x71f2('0x4'));var logger=require('../../../../config/logger')(_0x71f2('0x5'));var config=require(_0x71f2('0x6'));config['redis']=_['defaults'](config[_0x71f2('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x71f2('0x8'))(new Redis(config[_0x71f2('0x7')]));function getAuthToken(_0x2b4194,_0x483846,_0x305c6f){if(_0x2b4194['modernAuthentication']){_0x2b4194[_0x71f2('0x9')]=_0x2b4194[_0x71f2('0xa')][_0x71f2('0xb')];_0x2b4194[_0x71f2('0xc')]=_0x2b4194['CloudProvider'][_0x71f2('0xd')];return Promise[_0x71f2('0xe')](_0x2b4194[_0x71f2('0xa')][_0x71f2('0xf')]);}var _0x2ce63b={'method':'POST','uri':_0x483846,'form':{'client_id':_0x2b4194['clientId'],'resource':_0x2b4194['remoteUri'],'username':_0x2b4194['username'],'password':_0x2b4194[_0x71f2('0x10')],'grant_type':_0x71f2('0x10'),'client_secret':_0x2b4194[_0x71f2('0x11')]},'json':!![]};return rp(_0x2ce63b)['then'](function(_0xb7608f){return _0xb7608f['access_token'];})[_0x71f2('0x12')](function(_0x105df5){logger[_0x71f2('0x13')]('['+[_0x305c6f[_0x71f2('0x14')]()]+_0x71f2('0x15'));return _0x105df5[_0x71f2('0x16')];});}function getUser(_0x4194a6,_0x3eaa5e,_0x3d47d,_0x5e8ead,_0x50c573,_0x4f79da){return new Promise(function(_0x5874b5,_0x56542a){return getAuthToken(_0x3eaa5e,_0x5e8ead,_0x4f79da)[_0x71f2('0x17')](function(_0x1c69e8){var _0x201614={'method':_0x71f2('0x18'),'uri':_0x50c573+_0x71f2('0x19'),'headers':{'Authorization':_0x71f2('0x1a')+_0x1c69e8,'OData-Version':_0x71f2('0x1b')},'json':!![]};return rp(_0x201614);})[_0x71f2('0x17')](function(_0x4dc9b8){var _0x3ed70b=_0x4dc9b8['value'];var _0x1b5735=![];var _0x374b4a=null;if(!_[_0x71f2('0x1c')](_0x3d47d)){if(intUtil[_0x71f2('0x1d')](_0x3d47d[_0x71f2('0x1e')])){_0x4194a6[_0x71f2('0x1f')]=_0x3d47d['email'];for(_0x374b4a=0x0;_0x374b4a<_0x3ed70b[_0x71f2('0x20')];_0x374b4a++){if(_0x3ed70b[_0x374b4a]['internalemailaddress']===_0x3d47d['email']&&!_0x3ed70b[_0x374b4a][_0x71f2('0x21')]){_0x1b5735=!![];logger[_0x71f2('0x22')]('['+[_0x4f79da[_0x71f2('0x14')]()]+_0x71f2('0x23')+_0x3ed70b[_0x374b4a][_0x71f2('0x24')]+'!');_0x4194a6[_0x71f2('0x25')]=_0x3ed70b[_0x374b4a][_0x71f2('0x24')];}}}}if(!_0x1b5735){logger[_0x71f2('0x22')]('['+[_0x4f79da['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4194a6[_0x71f2('0x1f')]=_0x3eaa5e[_0x71f2('0x26')];for(_0x374b4a=0x0;_0x374b4a<_0x3ed70b['length'];_0x374b4a++){if(_0x3ed70b[_0x374b4a]['internalemailaddress']===_0x3eaa5e['username']){_0x4194a6[_0x71f2('0x25')]=_0x3ed70b[_0x374b4a][_0x71f2('0x24')];}}}_0x5874b5(_0x4194a6);})[_0x71f2('0x12')](function(_0xac6b1c){_0x56542a(_0xac6b1c[_0x71f2('0x16')]);});});}function createEndUser(_0x4732ac,_0x38f425,_0x285353,_0x23dbcf,_0x2c39b9,_0x5d5fcb,_0x5ee4f6){return new Promise(function(_0x4de88e,_0x58162a){return getAuthToken(_0x38f425,_0x285353,_0x5d5fcb)['then'](function(_0x137814){var _0x556a89=_0x5d5fcb['toLowerCase']()==='outbound'?_0x2c39b9[_0x71f2('0x27')]:_0x2c39b9[_0x71f2('0x28')];var _0x1e8e6c={'method':_0x71f2('0x29'),'uri':_0x23dbcf+_0x71f2('0x2a'),'body':{'fullname':_0x556a89,'firstname':_0x556a89,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4732ac[_0x71f2('0x25')]+')'},'headers':{'Authorization':_0x71f2('0x1a')+_0x137814,'OData-Version':_0x71f2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x1e8e6c['body'][_0x5ee4f6]=_0x556a89;return rp(_0x1e8e6c);})[_0x71f2('0x17')](function(_0x2a6ceb){var _0x1f4bb0=_0x2a6ceb[_0x71f2('0x2b')][_0x71f2('0x2c')];var _0x584628=_0x1f4bb0['substring'](_0x1f4bb0[_0x71f2('0x2d')]('(')+0x1,_0x1f4bb0['lastIndexOf'](')'));_0x4732ac[_0x71f2('0x2e')]=_0x584628;_0x4de88e(_0x4732ac);})['catch'](function(_0xda873f){_0x58162a(_0xda873f[_0x71f2('0x16')]);});});}function getEndUser(_0x202f41,_0x33da30,_0x10d5fa,_0x10555e,_0x4dcfe6,_0x35ff0e,_0x2fa514,_0x4a43fd){var _0x24e3e5=_0x35ff0e[_0x71f2('0x2f')]()===_0x71f2('0x30')?_0x4dcfe6[_0x71f2('0x27')]:_0x4dcfe6[_0x71f2('0x28')];return getAuthToken(_0x33da30,_0x10d5fa,_0x35ff0e)['then'](function(_0x25798c){_0x4a43fd=_0x4a43fd?_0x4a43fd:'telephone1';var _0xbaf9d={'method':_0x71f2('0x18'),'uri':_0x10555e+_0x71f2('0x31')+_0x4a43fd+_0x71f2('0x32')+_0x4a43fd+_0x71f2('0x33')+_0x24e3e5[_0x71f2('0x34')]('+','%2b')+'\x27','headers':{'Authorization':_0x71f2('0x1a')+_0x25798c,'If-None-Match':null,'OData-Version':_0x71f2('0x1b')},'json':!![]};return rp(_0xbaf9d);})['then'](function(_0x4e16ef){var _0x7c3de2=![];if(!_0x4e16ef)return _0x7c3de2;var _0x2624d2=_0x4e16ef[_0x71f2('0x35')];for(var _0x1347fd=0x0;_0x1347fd<_0x2624d2[_0x71f2('0x20')];_0x1347fd++){if(_0x2624d2[_0x1347fd][_0x4a43fd]===_0x24e3e5){_0x7c3de2=!![];_0x202f41[_0x71f2('0x2e')]=_0x2624d2[_0x1347fd][_0x71f2('0x36')];}}return _0x7c3de2;})[_0x71f2('0x17')](function(_0x151fb5){if(_0x151fb5)return _0x202f41;if(_0x2fa514==='nothing'){logger['info']('['+[_0x35ff0e[_0x71f2('0x14')]()]+_0x71f2('0x37'));return _0x202f41;}return createEndUser(_0x202f41,_0x33da30,_0x10d5fa,_0x10555e,_0x4dcfe6,_0x35ff0e,_0x4a43fd)[_0x71f2('0x17')](function(_0x517cf5){logger['info']('['+[_0x35ff0e[_0x71f2('0x14')]()]+']\x20Enduser\x20created!',_0x517cf5['enduserId']);return _0x517cf5;});});}function getCustomFields(_0x23480d,_0x4b19d0,_0x13a18a){var _0x51b188={};if(_0x23480d['length']>0x0){_['forEach'](_0x23480d,function(_0x1f2704){if(_[_0x71f2('0x38')]([_0x71f2('0x39'),_0x71f2('0x3a')],_0x1f2704['type'])&&_0x1f2704[_0x71f2('0x3b')]&&!_0x1f2704['customField']){var _0x331205=_0x1f2704[_0x71f2('0x3c')][_0x71f2('0x2f')]();var _0x21028f=_0x331205[_0x71f2('0x3d')](0x0,_0x331205[_0x71f2('0x3e')]('_'));var _0x562b5a=_0x331205[_0x71f2('0x3d')](_0x331205[_0x71f2('0x3e')]('_')+0x1);if(_0x21028f===_0x13a18a){_0x51b188[_0x562b5a]=_0x1f2704[_0x71f2('0x3f')];}}});}return _0x51b188;}function getTicket(_0x2e6611,_0x30980c,_0xdf1dc3,_0x42128b,_0x2143c3,_0x3325fd,_0x28a8ff){return new Promise(function(_0x869c34,_0x3f1abf){var _0x19ebc0;return getAuthToken(_0x30980c,_0xdf1dc3,_0x28a8ff)[_0x71f2('0x17')](function(_0x29baba){if(_0x3325fd[_0x71f2('0x40')]===_0x71f2('0x41')){_0x19ebc0={'method':_0x71f2('0x29'),'uri':_0x42128b+_0x71f2('0x42'),'body':Object[_0x71f2('0x43')]({},{'title':intUtil[_0x71f2('0x44')](_0x3325fd[_0x71f2('0x45')],_0x2143c3,'\x20'),'description':intUtil[_0x71f2('0x44')](_0x3325fd[_0x71f2('0x46')],_0x2143c3,'\x0a'),'customerid_contact@odata.bind':_0x2e6611[_0x71f2('0x2e')]?_0x71f2('0x47')+_0x2e6611['enduserId']+')':undefined,'ownerid@odata.bind':_0x71f2('0x48')+_0x2e6611[_0x71f2('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x3325fd[_0x71f2('0x49')],_0x2143c3,_0x3325fd['ticketType'])),'headers':{'Authorization':_0x71f2('0x1a')+_0x29baba,'OData-Version':_0x71f2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3325fd['ticketType']===_0x71f2('0x4a')){var _0xea2490=_0x2e6611[_0x71f2('0x2e')]?[{'partyid_systemuser@odata.bind':_0x71f2('0x48')+_0x2e6611[_0x71f2('0x25')]+')','participationtypemask':_0x2e6611[_0x71f2('0x4b')]===_0x71f2('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x71f2('0x47')+_0x2e6611[_0x71f2('0x2e')]+')','participationtypemask':_0x2e6611[_0x71f2('0x4b')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2e6611[_0x71f2('0x25')]+')','participationtypemask':_0x2e6611[_0x71f2('0x4b')]==='queue'?0x2:0x1}];_0x19ebc0={'method':'POST','uri':_0x42128b+_0x71f2('0x4d'),'body':Object[_0x71f2('0x43')]({},{'subject':intUtil['getString'](_0x3325fd[_0x71f2('0x45')],_0x2143c3,'\x20'),'phonenumber':String(_0x2143c3[_0x71f2('0x28')]),'description':intUtil[_0x71f2('0x44')](_0x3325fd[_0x71f2('0x46')],_0x2143c3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2e6611[_0x71f2('0x2e')]?_0x71f2('0x47')+_0x2e6611[_0x71f2('0x2e')]+')':undefined,'ownerid@odata.bind':_0x71f2('0x48')+_0x2e6611['userId']+')','directioncode':_0x2e6611[_0x71f2('0x4b')]===_0x71f2('0x4c')?![]:!![],'phonecall_activity_parties':_0xea2490},getCustomFields(_0x3325fd[_0x71f2('0x49')],_0x2143c3,_0x3325fd[_0x71f2('0x40')])),'headers':{'Authorization':_0x71f2('0x1a')+_0x29baba,'OData-Version':_0x71f2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x19ebc0);})[_0x71f2('0x17')](function(_0x48f92f){var _0x120b13=_0x48f92f[_0x71f2('0x2b')]['odata-entityid'];var _0x4a74b3=_0x120b13[_0x71f2('0x3d')](_0x120b13[_0x71f2('0x2d')]('(')+0x1,_0x120b13[_0x71f2('0x2d')](')'));_0x2e6611[_0x71f2('0x4e')]=_0x4a74b3;_0x869c34(_0x2e6611);})[_0x71f2('0x12')](function(_0x18d3e3){_0x3f1abf(_0x18d3e3[_0x71f2('0x16')]);});});}function emit(_0x5a7299,_0x29cf59,_0x548ecc,_0x5d2f81){var _0xc4e07b={'uri':util['format'](_0x71f2('0x4f'),_0x5a7299,_0x548ecc,_0x5d2f81)};io['to'](util[_0x71f2('0x50')]('user:%s',_0x29cf59))[_0x71f2('0x51')]('trigger:browser:url',_0xc4e07b);}exports['cs']=function(_0x453732,_0x10ed99,_0x37d75f,_0x207b95,_0x2b9187,_0x2de9ef,_0x18a358,_0x9b339d){var _0xfae925={};_0x2de9ef['remoteUri']=_0x2de9ef['modernAuthentication']?intUtil[_0x71f2('0x52')](_0x2de9ef[_0x71f2('0xa')]['data7']):intUtil['stripTrailingSlash'](_0x2de9ef[_0x71f2('0x9')]);_0x2de9ef['serverUrl']=intUtil['stripTrailingSlash'](_0x2de9ef[_0x71f2('0x53')]);_0xfae925[_0x71f2('0x4b')]=_0x9b339d===_0x71f2('0x4c')||_0x9b339d===_0x71f2('0x54')?'queue':_0x71f2('0x30');var _0x1f172d=_0x2de9ef[_0x71f2('0x55')]?util[_0x71f2('0x50')](_0x71f2('0x56'),_0x2de9ef[_0x71f2('0xa')][_0x71f2('0xb')]):util[_0x71f2('0x50')](_0x71f2('0x56'),_0x2de9ef[_0x71f2('0x9')]);var _0x407b83=util[_0x71f2('0x50')](_0x71f2('0x57'),_0x2de9ef[_0x71f2('0xc')]);var _0x2f14a6=util[_0x71f2('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2de9ef[_0x71f2('0x53')],_0x10ed99[_0x71f2('0x58')],md5(_0x10ed99[_0x71f2('0x58')]));if(_0x2b9187&&_0x2b9187[_0x71f2('0x59')]){logger['info']('[QUEUE]',_0x71f2('0x5a'));_0x10ed99[_0x71f2('0x5b')]=_0x2f14a6;}else if(_0x18a358&&_0x18a358['recordingFormat']&&_0x18a358[_0x71f2('0x5c')]!==_0x71f2('0x5d')){logger[_0x71f2('0x22')]('[OUTBOUND]',_0x71f2('0x5a'));_0x10ed99['recordingURL']=_0x2f14a6;}else{_0x10ed99[_0x71f2('0x5b')]='';}return getUser(_0xfae925,_0x2de9ef,_0x207b95,_0x407b83,_0x1f172d,_0x9b339d)['then'](function(_0x529e5f){logger[_0x71f2('0x22')]('['+_0x9b339d[_0x71f2('0x14')]()+_0x71f2('0x5e'),_0x529e5f[_0x71f2('0x25')]);logger[_0x71f2('0x22')]('['+_0x9b339d[_0x71f2('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x529e5f['userEmail']);return getEndUser(_0x529e5f,_0x2de9ef,_0x407b83,_0x1f172d,_0x10ed99,_0x9b339d,_0x37d75f[_0x71f2('0x5f')],_0x37d75f[_0x71f2('0x60')]);})[_0x71f2('0x17')](function(_0x13d6f3){logger[_0x71f2('0x22')]('['+_0x9b339d[_0x71f2('0x14')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x13d6f3[_0x71f2('0x2e')]);logger[_0x71f2('0x22')]('['+_0x9b339d[_0x71f2('0x14')]()+_0x71f2('0x61'),_0x10ed99[_0x71f2('0x28')]);return getTicket(_0x13d6f3,_0x2de9ef,_0x407b83,_0x1f172d,_0x10ed99,_0x37d75f,_0x9b339d);})[_0x71f2('0x17')](function(_0x50b21b){logger[_0x71f2('0x22')](util[_0x71f2('0x50')]('['+_0x9b339d[_0x71f2('0x14')]()+_0x71f2('0x62'),_0x37d75f[_0x71f2('0x40')],_0x50b21b[_0x71f2('0x4e')]));logger['info'](util['format']('['+_0x9b339d[_0x71f2('0x14')]()+_0x71f2('0x63'),_0x9b339d));if(_0x9b339d!==_0x71f2('0x54')&&_0x37d75f[_0x71f2('0x64')]){logger[_0x71f2('0x22')]('['+_0x9b339d['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2de9ef[_0x71f2('0x9')],_0x207b95[_0x71f2('0x65')],_0x37d75f['ticketType'],_0x50b21b['ticketId']);}})[_0x71f2('0x12')](function(_0x3f6081){logger[_0x71f2('0x13')]('['+_0x9b339d[_0x71f2('0x14')]()+_0x71f2('0x66'),_0x3f6081[_0x71f2('0x16')]);console[_0x71f2('0x13')]('Error\x20running\x20Dynamics365\x20integration',_0x3f6081);});}; \ No newline at end of file +var _0x68d6=['format','user:%s','emit','trigger:browser:url','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!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','data5','POST','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','outbound','destcalleridnum','contacts','Bearer\x20','headers','odata-entityid','lastIndexOf','enduserId','toLowerCase','calleridnum','GET','&$filter=','\x20eq\x20\x27','%2b','contactid','nothing','forEach','includes','string','type','customField','idField','substring','indexOf','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','queue','callDirection','phonecalls','ticketId'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x68d6,0xeb));var _0x668d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x68d6[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var rp=require(_0x668d('0x0'));var util=require(_0x668d('0x1'));var intUtil=require(_0x668d('0x2'));var md5=require(_0x668d('0x3'));var Redis=require(_0x668d('0x4'));var logger=require('../../../../config/logger')(_0x668d('0x5'));var config=require(_0x668d('0x6'));config[_0x668d('0x7')]=_['defaults'](config[_0x668d('0x7')],{'host':_0x668d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x668d('0x7')]));function getAuthToken(_0x30bf9d,_0x425909,_0x1b20fc){if(_0x30bf9d[_0x668d('0x9')]){_0x30bf9d[_0x668d('0xa')]=_0x30bf9d[_0x668d('0xb')][_0x668d('0xc')];_0x30bf9d['tenantId']=_0x30bf9d[_0x668d('0xb')][_0x668d('0xd')];return Promise[_0x668d('0xe')](_0x30bf9d[_0x668d('0xb')][_0x668d('0xf')]);}var _0x22426e={'method':_0x668d('0x10'),'uri':_0x425909,'form':{'client_id':_0x30bf9d[_0x668d('0x11')],'resource':_0x30bf9d[_0x668d('0xa')],'username':_0x30bf9d[_0x668d('0x12')],'password':_0x30bf9d[_0x668d('0x13')],'grant_type':_0x668d('0x13'),'client_secret':_0x30bf9d[_0x668d('0x14')]},'json':!![]};return rp(_0x22426e)['then'](function(_0x32b379){return _0x32b379[_0x668d('0x15')];})[_0x668d('0x16')](function(_0x305757){logger[_0x668d('0x17')]('['+[_0x1b20fc[_0x668d('0x18')]()]+']\x20Wrong\x20credentials!');return _0x305757[_0x668d('0x19')];});}function getUser(_0x4c9be7,_0x405d2f,_0x51475f,_0x329e67,_0x20ec4a,_0x56271b){return new Promise(function(_0x58e91a,_0x5698e1){return getAuthToken(_0x405d2f,_0x329e67,_0x56271b)[_0x668d('0x1a')](function(_0x2e2584){var _0x2134bb={'method':'GET','uri':_0x20ec4a+_0x668d('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x2e2584,'OData-Version':_0x668d('0x1c')},'json':!![]};return rp(_0x2134bb);})[_0x668d('0x1a')](function(_0x4f5b2e){var _0x4d9a10=_0x4f5b2e[_0x668d('0x1d')];var _0x364d1d=![];var _0x9ad2e8=null;if(!_[_0x668d('0x1e')](_0x51475f)){if(intUtil[_0x668d('0x1f')](_0x51475f[_0x668d('0x20')])){_0x4c9be7[_0x668d('0x21')]=_0x51475f[_0x668d('0x20')];for(_0x9ad2e8=0x0;_0x9ad2e8<_0x4d9a10[_0x668d('0x22')];_0x9ad2e8++){if(_0x4d9a10[_0x9ad2e8][_0x668d('0x23')]===_0x51475f['email']&&!_0x4d9a10[_0x9ad2e8][_0x668d('0x24')]){_0x364d1d=!![];logger[_0x668d('0x25')]('['+[_0x56271b[_0x668d('0x18')]()]+_0x668d('0x26')+_0x4d9a10[_0x9ad2e8][_0x668d('0x27')]+'!');_0x4c9be7['userId']=_0x4d9a10[_0x9ad2e8][_0x668d('0x27')];}}}}if(!_0x364d1d){logger['info']('['+[_0x56271b[_0x668d('0x18')]()]+_0x668d('0x28'));_0x4c9be7[_0x668d('0x21')]=_0x405d2f[_0x668d('0x12')];for(_0x9ad2e8=0x0;_0x9ad2e8<_0x4d9a10[_0x668d('0x22')];_0x9ad2e8++){if(_0x4d9a10[_0x9ad2e8][_0x668d('0x23')]===_0x405d2f[_0x668d('0x12')]){_0x4c9be7[_0x668d('0x29')]=_0x4d9a10[_0x9ad2e8][_0x668d('0x27')];}}}_0x58e91a(_0x4c9be7);})[_0x668d('0x16')](function(_0x4928ce){_0x5698e1(_0x4928ce[_0x668d('0x19')]);});});}function createEndUser(_0x4e9360,_0x257922,_0x68a4f7,_0x441b8f,_0xcee51f,_0x34b289,_0x3e19fa){return new Promise(function(_0x53942e,_0x306edc){return getAuthToken(_0x257922,_0x68a4f7,_0x34b289)[_0x668d('0x1a')](function(_0x1fa10b){var _0x42f421=_0x34b289['toLowerCase']()===_0x668d('0x2a')?_0xcee51f[_0x668d('0x2b')]:_0xcee51f['calleridnum'];var _0x3ca6a9={'method':_0x668d('0x10'),'uri':_0x441b8f+_0x668d('0x2c'),'body':{'fullname':_0x42f421,'firstname':_0x42f421,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4e9360[_0x668d('0x29')]+')'},'headers':{'Authorization':_0x668d('0x2d')+_0x1fa10b,'OData-Version':_0x668d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x3ca6a9['body'][_0x3e19fa]=_0x42f421;return rp(_0x3ca6a9);})[_0x668d('0x1a')](function(_0x3d86d2){var _0x104e7a=_0x3d86d2[_0x668d('0x2e')][_0x668d('0x2f')];var _0x2580ef=_0x104e7a['substring'](_0x104e7a['lastIndexOf']('(')+0x1,_0x104e7a[_0x668d('0x30')](')'));_0x4e9360[_0x668d('0x31')]=_0x2580ef;_0x53942e(_0x4e9360);})[_0x668d('0x16')](function(_0x18e4f9){_0x306edc(_0x18e4f9[_0x668d('0x19')]);});});}function getEndUser(_0x115c5a,_0x44f7d3,_0x38f4ad,_0x59ed89,_0x5b3e7c,_0x23c0f0,_0x7ab847,_0xb6b91b){var _0x38c0e9=_0x23c0f0[_0x668d('0x32')]()===_0x668d('0x2a')?_0x5b3e7c[_0x668d('0x2b')]:_0x5b3e7c[_0x668d('0x33')];return getAuthToken(_0x44f7d3,_0x38f4ad,_0x23c0f0)['then'](function(_0x4c1a26){_0xb6b91b=_0xb6b91b?_0xb6b91b:'telephone1';var _0x244cb1={'method':_0x668d('0x34'),'uri':_0x59ed89+'contacts?$select='+_0xb6b91b+_0x668d('0x35')+_0xb6b91b+_0x668d('0x36')+_0x38c0e9['replace']('+',_0x668d('0x37'))+'\x27','headers':{'Authorization':_0x668d('0x2d')+_0x4c1a26,'If-None-Match':null,'OData-Version':_0x668d('0x1c')},'json':!![]};return rp(_0x244cb1);})[_0x668d('0x1a')](function(_0x3b7184){var _0x1d1250=![];if(!_0x3b7184)return _0x1d1250;var _0x2c2298=_0x3b7184[_0x668d('0x1d')];for(var _0x377e16=0x0;_0x377e16<_0x2c2298[_0x668d('0x22')];_0x377e16++){if(_0x2c2298[_0x377e16][_0xb6b91b]===_0x38c0e9){_0x1d1250=!![];_0x115c5a[_0x668d('0x31')]=_0x2c2298[_0x377e16][_0x668d('0x38')];}}return _0x1d1250;})['then'](function(_0x4d78bb){if(_0x4d78bb)return _0x115c5a;if(_0x7ab847===_0x668d('0x39')){logger[_0x668d('0x25')]('['+[_0x23c0f0[_0x668d('0x18')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x115c5a;}return createEndUser(_0x115c5a,_0x44f7d3,_0x38f4ad,_0x59ed89,_0x5b3e7c,_0x23c0f0,_0xb6b91b)[_0x668d('0x1a')](function(_0x5d383a){logger['info']('['+[_0x23c0f0[_0x668d('0x18')]()]+']\x20Enduser\x20created!',_0x5d383a['enduserId']);return _0x5d383a;});});}function getCustomFields(_0xdd2ffa,_0xf84946,_0x3c4162){var _0x3b464f={};if(_0xdd2ffa[_0x668d('0x22')]>0x0){_[_0x668d('0x3a')](_0xdd2ffa,function(_0x4a21e3){if(_[_0x668d('0x3b')]([_0x668d('0x3c'),'picklist'],_0x4a21e3[_0x668d('0x3d')])&&_0x4a21e3['nameField']&&!_0x4a21e3[_0x668d('0x3e')]){var _0x477dfe=_0x4a21e3[_0x668d('0x3f')][_0x668d('0x32')]();var _0x52cdd7=_0x477dfe[_0x668d('0x40')](0x0,_0x477dfe['indexOf']('_'));var _0x52ed10=_0x477dfe[_0x668d('0x40')](_0x477dfe[_0x668d('0x41')]('_')+0x1);if(_0x52cdd7===_0x3c4162){_0x3b464f[_0x52ed10]=_0x4a21e3['content'];}}});}return _0x3b464f;}function getTicket(_0x507f10,_0x333103,_0x54641b,_0x18491a,_0x1c2468,_0x3451d6,_0x36606d){return new Promise(function(_0xd55bb0,_0x5a368a){var _0x1cf478;return getAuthToken(_0x333103,_0x54641b,_0x36606d)[_0x668d('0x1a')](function(_0x47ff80){if(_0x3451d6[_0x668d('0x42')]===_0x668d('0x43')){_0x1cf478={'method':_0x668d('0x10'),'uri':_0x18491a+'incidents','body':Object[_0x668d('0x44')]({},{'title':intUtil[_0x668d('0x45')](_0x3451d6[_0x668d('0x46')],_0x1c2468,'\x20'),'description':intUtil[_0x668d('0x45')](_0x3451d6[_0x668d('0x47')],_0x1c2468,'\x0a'),'customerid_contact@odata.bind':_0x507f10['enduserId']?_0x668d('0x48')+_0x507f10['enduserId']+')':undefined,'ownerid@odata.bind':_0x668d('0x49')+_0x507f10[_0x668d('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x3451d6[_0x668d('0x4a')],_0x1c2468,_0x3451d6[_0x668d('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x47ff80,'OData-Version':_0x668d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3451d6[_0x668d('0x42')]===_0x668d('0x4b')){var _0x1f805e=_0x507f10[_0x668d('0x31')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x507f10[_0x668d('0x29')]+')','participationtypemask':_0x507f10['callDirection']===_0x668d('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x668d('0x48')+_0x507f10['enduserId']+')','participationtypemask':_0x507f10['callDirection']===_0x668d('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x668d('0x49')+_0x507f10[_0x668d('0x29')]+')','participationtypemask':_0x507f10[_0x668d('0x4d')]===_0x668d('0x4c')?0x2:0x1}];_0x1cf478={'method':_0x668d('0x10'),'uri':_0x18491a+_0x668d('0x4e'),'body':Object[_0x668d('0x44')]({},{'subject':intUtil[_0x668d('0x45')](_0x3451d6[_0x668d('0x46')],_0x1c2468,'\x20'),'phonenumber':String(_0x1c2468[_0x668d('0x33')]),'description':intUtil['getString'](_0x3451d6['Descriptions'],_0x1c2468,'\x0a'),'regardingobjectid_contact@odata.bind':_0x507f10[_0x668d('0x31')]?_0x668d('0x48')+_0x507f10[_0x668d('0x31')]+')':undefined,'ownerid@odata.bind':_0x668d('0x49')+_0x507f10[_0x668d('0x29')]+')','directioncode':_0x507f10[_0x668d('0x4d')]===_0x668d('0x4c')?![]:!![],'phonecall_activity_parties':_0x1f805e},getCustomFields(_0x3451d6[_0x668d('0x4a')],_0x1c2468,_0x3451d6[_0x668d('0x42')])),'headers':{'Authorization':_0x668d('0x2d')+_0x47ff80,'OData-Version':_0x668d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1cf478);})['then'](function(_0x24de96){var _0x326de2=_0x24de96[_0x668d('0x2e')][_0x668d('0x2f')];var _0x5ce996=_0x326de2[_0x668d('0x40')](_0x326de2[_0x668d('0x30')]('(')+0x1,_0x326de2[_0x668d('0x30')](')'));_0x507f10[_0x668d('0x4f')]=_0x5ce996;_0xd55bb0(_0x507f10);})['catch'](function(_0x20e7b5){_0x5a368a(_0x20e7b5[_0x668d('0x19')]);});});}function emit(_0x9b9f7d,_0x1d2fcc,_0x4ee963,_0x439869){var _0xcecdfd={'uri':util[_0x668d('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x9b9f7d,_0x4ee963,_0x439869)};io['to'](util[_0x668d('0x50')](_0x668d('0x51'),_0x1d2fcc))[_0x668d('0x52')](_0x668d('0x53'),_0xcecdfd);}exports['cs']=function(_0x476362,_0x14a8fd,_0x51cd29,_0x4c8683,_0x38b1bd,_0x2fc0de,_0x3d625e,_0x3c3cd1){var _0x390804={};_0x2fc0de['remoteUri']=_0x2fc0de[_0x668d('0x9')]?intUtil[_0x668d('0x54')](_0x2fc0de[_0x668d('0xb')][_0x668d('0xc')]):intUtil[_0x668d('0x54')](_0x2fc0de[_0x668d('0xa')]);_0x2fc0de[_0x668d('0x55')]=intUtil[_0x668d('0x54')](_0x2fc0de[_0x668d('0x55')]);_0x390804[_0x668d('0x4d')]=_0x3c3cd1==='queue'||_0x3c3cd1===_0x668d('0x56')?_0x668d('0x4c'):_0x668d('0x2a');var _0x4e1b00=_0x2fc0de[_0x668d('0x9')]?util['format'](_0x668d('0x57'),_0x2fc0de[_0x668d('0xb')][_0x668d('0xc')]):util[_0x668d('0x50')]('%s/api/data/v9.0/',_0x2fc0de[_0x668d('0xa')]);var _0x4b0ef8=util[_0x668d('0x50')](_0x668d('0x58'),_0x2fc0de['tenantId']);var _0x1d1e2a=util[_0x668d('0x50')](_0x668d('0x59'),_0x2fc0de['serverUrl'],_0x14a8fd[_0x668d('0x5a')],md5(_0x14a8fd[_0x668d('0x5a')]));if(_0x38b1bd&&_0x38b1bd[_0x668d('0x5b')]){logger[_0x668d('0x25')](_0x668d('0x5c'),_0x668d('0x5d'));_0x14a8fd[_0x668d('0x5e')]=_0x1d1e2a;}else if(_0x3d625e&&_0x3d625e[_0x668d('0x5f')]&&_0x3d625e['recordingFormat']!==_0x668d('0x60')){logger[_0x668d('0x25')](_0x668d('0x61'),_0x668d('0x5d'));_0x14a8fd[_0x668d('0x5e')]=_0x1d1e2a;}else{_0x14a8fd[_0x668d('0x5e')]='';}return getUser(_0x390804,_0x2fc0de,_0x4c8683,_0x4b0ef8,_0x4e1b00,_0x3c3cd1)[_0x668d('0x1a')](function(_0x4b4700){logger['info']('['+_0x3c3cd1['toUpperCase']()+_0x668d('0x62'),_0x4b4700[_0x668d('0x29')]);logger['info']('['+_0x3c3cd1[_0x668d('0x18')]()+']\x20The\x20User\x20email\x20is:',_0x4b4700[_0x668d('0x21')]);return getEndUser(_0x4b4700,_0x2fc0de,_0x4b0ef8,_0x4e1b00,_0x14a8fd,_0x3c3cd1,_0x51cd29['moduleCreate'],_0x51cd29[_0x668d('0x63')]);})[_0x668d('0x1a')](function(_0x2f1440){logger[_0x668d('0x25')]('['+_0x3c3cd1[_0x668d('0x18')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2f1440['enduserId']);logger['info']('['+_0x3c3cd1[_0x668d('0x18')]()+_0x668d('0x64'),_0x14a8fd['calleridnum']);return getTicket(_0x2f1440,_0x2fc0de,_0x4b0ef8,_0x4e1b00,_0x14a8fd,_0x51cd29,_0x3c3cd1);})[_0x668d('0x1a')](function(_0x26b2da){logger[_0x668d('0x25')](util[_0x668d('0x50')]('['+_0x3c3cd1[_0x668d('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x51cd29[_0x668d('0x42')],_0x26b2da[_0x668d('0x4f')]));logger[_0x668d('0x25')](util[_0x668d('0x50')]('['+_0x3c3cd1['toUpperCase']()+_0x668d('0x65'),_0x3c3cd1));if(_0x3c3cd1!==_0x668d('0x56')&&_0x51cd29['openNewTab']){logger[_0x668d('0x25')]('['+_0x3c3cd1[_0x668d('0x18')]()+']',_0x668d('0x66'));emit(_0x2fc0de[_0x668d('0xa')],_0x4c8683[_0x668d('0x67')],_0x51cd29[_0x668d('0x42')],_0x26b2da[_0x668d('0x4f')]);}})[_0x668d('0x16')](function(_0x2bb5f3){logger[_0x668d('0x17')]('['+_0x3c3cd1[_0x668d('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x2bb5f3[_0x668d('0x19')]);console[_0x668d('0x17')](_0x668d('0x68'),_0x2bb5f3);});}; \ 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 8c14737..18cd12b 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 _0x4d44=['push','type','variable','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','%s/helpdesk/tickets/%d','monitor_format','lastevent','toUpperCase','md5','util','./util','../../../../config/environment','redis','defaults','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','nameField','toLowerCase','content','picklist','idField','customField'];(function(_0x4137fc,_0x4dee4f){var _0x51f7ea=function(_0x518f7d){while(--_0x518f7d){_0x4137fc['push'](_0x4137fc['shift']());}};_0x51f7ea(++_0x4dee4f);}(_0x4d44,0x77));var _0x44d4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4d44[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x44d4('0x0'));var util=require(_0x44d4('0x1'));var Redis=require('ioredis');var intUtil=require(_0x44d4('0x2'));var config=require(_0x44d4('0x3'));var logger=require('../../../../config/logger')('freshdesk');config[_0x44d4('0x4')]=_[_0x44d4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x44d4('0x6'),'Accept':_0x44d4('0x6')};function emit(_0xc135d7,_0x3a4cad,_0x23ec2){io['to'](_0xc135d7)[_0x44d4('0x7')](_0x3a4cad,_0x23ec2);}function getTicket(_0x59b245,_0x510556,_0x1d5be1,_0x1ee964,_0x3a639e){logger['info'](_0x44d4('0x8'));var _0x326188=_[_0x44d4('0x9')]({'responder_id':_0x510556['id'],'requester_id':_0x1d5be1['id'],'name':util[_0x44d4('0xa')](_0x44d4('0xb'),_0x3a639e['calleridname']),'phone':_0x3a639e[_0x44d4('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x44d4('0xd')](_0x1ee964[_0x44d4('0xe')],_0x3a639e,'\x20'),'description':intUtil[_0x44d4('0xd')](_0x1ee964['Descriptions'],_0x3a639e,_0x44d4('0xf')),'tags':getTags(_0x1ee964[_0x44d4('0x10')],'name')},getCustomFields(_0x1ee964[_0x44d4('0x11')],_0x3a639e));_0x326188[_0x44d4('0x12')]=_[_0x44d4('0x13')](_[_0x44d4('0x14')](_0x326188[_0x44d4('0x12')],'id'),_0x44d4('0x15'));return request({'uri':util['format']('%s/api/v2/tickets',_0x59b245[_0x44d4('0x16')]),'method':_0x44d4('0x17'),'body':_0x326188})[_0x44d4('0x18')](function(_0x462116){logger[_0x44d4('0x19')](_0x44d4('0x1a'));return _0x462116;});}function getUser(_0x71bcf8,_0x148079){if(intUtil[_0x44d4('0x1b')](_0x148079)){return request({'uri':util[_0x44d4('0xa')]('%s/api/v2/agents',_0x71bcf8[_0x44d4('0x16')]),'qs':{'email':_0x148079}})[_0x44d4('0x18')](function(_0x532673){if(_0x532673[_0x44d4('0x1c')]){logger[_0x44d4('0x19')](_0x44d4('0x1d'));return _['find'](_0x532673,function(_0x4e5da9){return _0x4e5da9[_0x44d4('0x1e')][_0x44d4('0x1f')]===_0x148079;});}else{logger[_0x44d4('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x44d4('0xa')](_0x44d4('0x20'),_0x71bcf8[_0x44d4('0x16')])})[_0x44d4('0x18')](function(_0x97dfc0){logger['info'](_0x44d4('0x21'));return _0x97dfc0;});}});}else{logger['info'](_0x44d4('0x22'));return request({'uri':util[_0x44d4('0xa')](_0x44d4('0x20'),_0x71bcf8['remoteUri'])})[_0x44d4('0x18')](function(_0x3207a9){logger[_0x44d4('0x19')](_0x44d4('0x21'));return _0x3207a9;});}}function getEndUser(_0x150d9e,_0x4e2c45,_0x2a1568){logger[_0x44d4('0x19')](_0x44d4('0x23'),_0x2a1568);return request({'uri':util[_0x44d4('0xa')](_0x44d4('0x24'),_0x150d9e[_0x44d4('0x16')]),'qs':{'phone':_0x2a1568}})[_0x44d4('0x18')](function(_0x517a67){if(_0x517a67['length']){logger[_0x44d4('0x19')](_0x44d4('0x25'));return _[_0x44d4('0x26')](_0x517a67,{'phone':_0x2a1568});}else{logger[_0x44d4('0x19')](_0x44d4('0x27'));return request({'uri':util[_0x44d4('0xa')]('%s/api/v2/contacts',_0x150d9e['remoteUri']),'method':_0x44d4('0x17'),'body':{'name':_0x4e2c45,'phone':_0x2a1568}})[_0x44d4('0x18')](function(_0xfe54c1){logger[_0x44d4('0x19')](_0x44d4('0x28'));return _0xfe54c1;});}});}function getAuth(_0x4517d3){return util['format']('Basic\x20%s',new Buffer(_0x4517d3[_0x44d4('0x29')]+':X')[_0x44d4('0x2a')](_0x44d4('0x2b')));}function request(_0x270b05){logger[_0x44d4('0x2c')](_0x44d4('0x2d'),JSON[_0x44d4('0x2e')](_0x270b05));return rp(_['defaults'](_0x270b05,{'method':_0x44d4('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x2eb379,_0x3a5179){var _0x2fcccc=[];if(_0x2eb379&&_0x2eb379[_0x44d4('0x1c')]>0x0){_0x2fcccc=_[_0x44d4('0x30')](_0x2eb379,_0x3a5179);}return _0x2fcccc;}function getCustomFields(_0x473792,_0x1b9a11){var _0x443834=[];var _0x27804c={'custom_fields':[]};if(_0x473792[_0x44d4('0x1c')]>0x0){_['forEach'](_0x473792,function(_0x508c3c){if(_[_0x44d4('0x31')]([_0x44d4('0x32'),'picklist'],_0x508c3c['type'])&&_0x508c3c[_0x44d4('0x33')]&&!_0x508c3c['customField']){_0x27804c[_0x508c3c[_0x44d4('0x33')][_0x44d4('0x34')]()]=_0x508c3c[_0x44d4('0x35')]['toString']();}else if(_['includes']([_0x44d4('0x32'),_0x44d4('0x36')],_0x508c3c['type'])&&_0x508c3c[_0x44d4('0x37')]&&_0x508c3c[_0x44d4('0x38')]){_0x27804c['custom_fields'][_0x44d4('0x39')]({'id':_0x508c3c['idField'],'value':_0x508c3c['content'][_0x44d4('0x2a')]()});}else if(_0x508c3c[_0x44d4('0x3a')]===_0x44d4('0x3b')&&_0x508c3c[_0x44d4('0x3c')]&&_0x508c3c['idField']&&_0x508c3c[_0x44d4('0x38')]){_0x1b9a11[_0x508c3c[_0x44d4('0x3c')]]&&_0x27804c['custom_fields'][_0x44d4('0x39')]({'id':_0x508c3c[_0x44d4('0x37')],'value':_0x1b9a11[_0x508c3c[_0x44d4('0x3c')]][_0x44d4('0x2a')]()});}else if(_0x508c3c['type']===_0x44d4('0x3d')&&_0x508c3c[_0x44d4('0x3e')]&&_0x508c3c['Variable'][_0x44d4('0x3f')]&&_0x508c3c[_0x44d4('0x37')]&&_0x508c3c['customField']){_0x1b9a11[_0x508c3c[_0x44d4('0x3e')][_0x44d4('0x3f')]['toLowerCase']()]&&_0x27804c[_0x44d4('0x12')]['push']({'id':_0x508c3c['idField'],'value':_0x1b9a11[_0x508c3c[_0x44d4('0x3e')][_0x44d4('0x3f')][_0x44d4('0x34')]()][_0x44d4('0x2a')]()});}});}return _0x27804c;}exports[_0x44d4('0x40')]=function(_0x134340,_0x387f7f,_0x315e54,_0x3eef2c,_0x111573,_0xe0c68a){var _0x2e8262,_0x54ce74;_0xe0c68a[_0x44d4('0x16')]=intUtil['stripTrailingSlash'](_0xe0c68a[_0x44d4('0x16')]);_0xe0c68a[_0x44d4('0x41')]=intUtil[_0x44d4('0x42')](_0xe0c68a[_0x44d4('0x41')]);if(_0x111573&&_0x111573['monitor_format']){logger[_0x44d4('0x19')](_0x44d4('0x43'),_0x44d4('0x44'));_0x387f7f[_0x44d4('0x45')]=util[_0x44d4('0xa')](_0x44d4('0x46'),_0xe0c68a[_0x44d4('0x41')],_0x387f7f[_0x44d4('0x47')],md5(_0x387f7f[_0x44d4('0x47')]));}else{_0x387f7f[_0x44d4('0x45')]='';}headers[_0x44d4('0x48')]=getAuth(_0xe0c68a);return getUser(_0xe0c68a,_0x3eef2c[_0x44d4('0x1f')])[_0x44d4('0x18')](function(_0x345f0d){_0x2e8262=_0x345f0d;logger['info']('The\x20User\x20ID\x20is:',_0x2e8262['id']);return getEndUser(_0xe0c68a,_0x387f7f['calleridname'],_0x387f7f['calleridnum']);})[_0x44d4('0x18')](function(_0x2eb151){_0x54ce74=_0x2eb151;logger[_0x44d4('0x19')]('The\x20Enduser\x20ID\x20is:',_0x54ce74['id']);return getTicket(_0xe0c68a,_0x2e8262,_0x54ce74,_0x315e54,_0x387f7f);})[_0x44d4('0x18')](function(_0x1ec39f){if(_0x1ec39f&&_0x1ec39f['id']){logger[_0x44d4('0x19')]('Ticket\x20created!');logger[_0x44d4('0x19')](_0x44d4('0x49'),_0x1ec39f['id']);logger[_0x44d4('0x19')](_0x44d4('0x43'),_0x44d4('0x4a'));emit(util[_0x44d4('0xa')](_0x44d4('0x4b'),_0x3eef2c[_0x44d4('0x3f')]),_0x44d4('0x4c'),{'uri':util[_0x44d4('0xa')]('%s/helpdesk/tickets/%d',_0xe0c68a[_0x44d4('0x16')],_0x1ec39f['id'])});}})[_0x44d4('0x4d')](function(_0x1b778b){logger[_0x44d4('0x4e')](_0x44d4('0x43'),JSON['stringify'](_0x1b778b));});};exports[_0x44d4('0x4f')]=function(_0x2d8f30,_0x42fe9a,_0x589a44,_0x3ca672,_0x52d912,_0x4b0ee7,_0x271938){var _0x3c0018,_0x2cf179;_0x4b0ee7['remoteUri']=intUtil[_0x44d4('0x42')](_0x4b0ee7[_0x44d4('0x16')]);_0x4b0ee7[_0x44d4('0x41')]=intUtil[_0x44d4('0x42')](_0x4b0ee7[_0x44d4('0x41')]);if(_0x271938&&_0x271938[_0x44d4('0x50')]&&_0x271938[_0x44d4('0x50')]!=='none'){logger[_0x44d4('0x19')]('[OUTBOUND]',_0x44d4('0x44'));_0x42fe9a[_0x44d4('0x45')]=util['format'](_0x44d4('0x46'),_0x4b0ee7[_0x44d4('0x41')],_0x42fe9a[_0x44d4('0x47')],md5(_0x42fe9a[_0x44d4('0x47')]));}headers[_0x44d4('0x48')]=getAuth(_0x4b0ee7);return getUser(_0x4b0ee7,_0x3ca672[_0x44d4('0x1f')])['then'](function(_0x35f102){_0x3c0018=_0x35f102;logger[_0x44d4('0x19')](_0x44d4('0x51'),_0x3c0018['id']);return getEndUser(_0x4b0ee7,_0x42fe9a['destcalleridname'],_0x42fe9a['destcalleridnum']);})[_0x44d4('0x18')](function(_0x579953){_0x2cf179=_0x579953;logger['info'](_0x44d4('0x52'),_0x2cf179['id']);return getTicket(_0x4b0ee7,_0x3c0018,_0x2cf179,_0x589a44,_0x42fe9a);})[_0x44d4('0x18')](function(_0x9549ab){if(_0x9549ab&&_0x9549ab['id']){logger[_0x44d4('0x19')](_0x44d4('0x1a'));logger[_0x44d4('0x19')]('The\x20Ticket\x20ID\x20is:',_0x9549ab['id']);logger['info'](_0x44d4('0x53'),_0x44d4('0x4a'));emit(util[_0x44d4('0xa')](_0x44d4('0x4b'),_0x3ca672[_0x44d4('0x3f')]),_0x44d4('0x4c'),{'uri':util[_0x44d4('0xa')](_0x44d4('0x54'),_0x4b0ee7[_0x44d4('0x16')],_0x9549ab['id'])});}})['catch'](function(_0xc05bec){logger[_0x44d4('0x4e')](_0x44d4('0x53'),JSON[_0x44d4('0x2e')](_0xc05bec));});};exports['unmanaged']=function(_0xf82186,_0x1a4831,_0x55b63c,_0x38e76b,_0x4a1ed7,_0x1c9d24){var _0x487784,_0x14d888;_0x1c9d24[_0x44d4('0x16')]=intUtil[_0x44d4('0x42')](_0x1c9d24['remoteUri']);_0x1c9d24[_0x44d4('0x41')]=intUtil[_0x44d4('0x42')](_0x1c9d24[_0x44d4('0x41')]);if(_0x4a1ed7&&_0x4a1ed7[_0x44d4('0x55')]){logger['info']('['+_0x1a4831[_0x44d4('0x56')]['toUpperCase']()+']',_0x44d4('0x44'));_0x1a4831[_0x44d4('0x45')]=util['format'](_0x44d4('0x46'),_0x1c9d24[_0x44d4('0x41')],_0x1a4831['uniqueid'],md5(_0x1a4831[_0x44d4('0x47')]));}else{_0x1a4831[_0x44d4('0x45')]='';}headers[_0x44d4('0x48')]=getAuth(_0x1c9d24);return getUser(_0x1c9d24,'')[_0x44d4('0x18')](function(_0x51488e){_0x487784=_0x51488e;logger[_0x44d4('0x19')]('The\x20User\x20ID\x20is:',_0x487784['id']);return getEndUser(_0x1c9d24,_0x1a4831['calleridname'],_0x1a4831[_0x44d4('0xc')]);})[_0x44d4('0x18')](function(_0x2a371a){_0x14d888=_0x2a371a;logger[_0x44d4('0x19')](_0x44d4('0x52'),_0x14d888['id']);return getTicket(_0x1c9d24,_0x487784,_0x14d888,_0x55b63c,_0x1a4831);})['then'](function(_0x107ea3){if(_0x107ea3){logger['info'](_0x44d4('0x1a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x107ea3['id']);}})[_0x44d4('0x4d')](function(_0x4ce957){logger[_0x44d4('0x4e')]('['+_0x1a4831['lastevent'][_0x44d4('0x57')]()+']',JSON[_0x44d4('0x2e')](_0x4ce957));});}; \ No newline at end of file +var _0xb676=['picklist','type','nameField','customField','toLowerCase','push','content','variable','variableName','idField','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%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...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','user:%s','unmanaged','lastevent','error','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xb676,0x19d));var _0x6b67=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xb676[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x6b67('0x0'));var rp=require(_0x6b67('0x1'));var md5=require(_0x6b67('0x2'));var util=require(_0x6b67('0x3'));var Redis=require('ioredis');var intUtil=require(_0x6b67('0x4'));var config=require(_0x6b67('0x5'));var logger=require('../../../../config/logger')(_0x6b67('0x6'));config[_0x6b67('0x7')]=_[_0x6b67('0x8')](config['redis'],{'host':_0x6b67('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x6b67('0xa'),'Accept':'application/json'};function emit(_0xe68676,_0x4fef4b,_0x40356c){io['to'](_0xe68676)[_0x6b67('0xb')](_0x4fef4b,_0x40356c);}function getTicket(_0x53e225,_0x4d3a9a,_0x261f7c,_0x430b96,_0x968955){logger['info'](_0x6b67('0xc'));var _0x2d1106=_['merge']({'responder_id':_0x4d3a9a['id'],'requester_id':_0x261f7c['id'],'name':util[_0x6b67('0xd')](_0x6b67('0xe'),_0x968955[_0x6b67('0xf')]),'phone':_0x968955[_0x6b67('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6b67('0x11')](_0x430b96[_0x6b67('0x12')],_0x968955,'\x20'),'description':intUtil[_0x6b67('0x11')](_0x430b96[_0x6b67('0x13')],_0x968955,'
'),'tags':getTags(_0x430b96[_0x6b67('0x14')],_0x6b67('0x15'))},getCustomFields(_0x430b96[_0x6b67('0x16')],_0x968955));_0x2d1106[_0x6b67('0x17')]=_['mapValues'](_[_0x6b67('0x18')](_0x2d1106['custom_fields'],'id'),'value');return request({'uri':util[_0x6b67('0xd')](_0x6b67('0x19'),_0x53e225[_0x6b67('0x1a')]),'method':_0x6b67('0x1b'),'body':_0x2d1106})[_0x6b67('0x1c')](function(_0x598a6f){logger[_0x6b67('0x1d')](_0x6b67('0x1e'));return _0x598a6f;});}function getUser(_0x58b0fd,_0x469495){if(intUtil[_0x6b67('0x1f')](_0x469495)){return request({'uri':util['format'](_0x6b67('0x20'),_0x58b0fd[_0x6b67('0x1a')]),'qs':{'email':_0x469495}})['then'](function(_0x390988){if(_0x390988[_0x6b67('0x21')]){logger[_0x6b67('0x1d')](_0x6b67('0x22'));return _[_0x6b67('0x23')](_0x390988,function(_0x5a0c94){return _0x5a0c94[_0x6b67('0x24')][_0x6b67('0x25')]===_0x469495;});}else{logger[_0x6b67('0x1d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6b67('0xd')](_0x6b67('0x26'),_0x58b0fd[_0x6b67('0x1a')])})[_0x6b67('0x1c')](function(_0x13325f){logger[_0x6b67('0x1d')](_0x6b67('0x27'));return _0x13325f;});}});}else{logger[_0x6b67('0x1d')](_0x6b67('0x28'));return request({'uri':util[_0x6b67('0xd')](_0x6b67('0x26'),_0x58b0fd[_0x6b67('0x1a')])})[_0x6b67('0x1c')](function(_0x6092af){logger['info'](_0x6b67('0x27'));return _0x6092af;});}}function getEndUser(_0x395a8e,_0x4ba5cd,_0x2e5d6a){logger[_0x6b67('0x1d')](_0x6b67('0x29'),_0x2e5d6a);return request({'uri':util[_0x6b67('0xd')](_0x6b67('0x2a'),_0x395a8e['remoteUri']),'qs':{'phone':_0x2e5d6a}})[_0x6b67('0x1c')](function(_0x3a5958){if(_0x3a5958[_0x6b67('0x21')]){logger['info'](_0x6b67('0x2b'));return _['find'](_0x3a5958,{'phone':_0x2e5d6a});}else{logger[_0x6b67('0x1d')](_0x6b67('0x2c'));return request({'uri':util[_0x6b67('0xd')]('%s/api/v2/contacts',_0x395a8e[_0x6b67('0x1a')]),'method':'POST','body':{'name':_0x4ba5cd,'phone':_0x2e5d6a}})['then'](function(_0x1495fc){logger[_0x6b67('0x1d')](_0x6b67('0x2d'));return _0x1495fc;});}});}function getAuth(_0x5aad7b){return util[_0x6b67('0xd')](_0x6b67('0x2e'),new Buffer(_0x5aad7b[_0x6b67('0x2f')]+':X')[_0x6b67('0x30')](_0x6b67('0x31')));}function request(_0x44fa07){logger['debug'](_0x6b67('0x32'),JSON[_0x6b67('0x33')](_0x44fa07));return rp(_['defaults'](_0x44fa07,{'method':_0x6b67('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x8f05c5,_0x3ee188){var _0x5746df=[];if(_0x8f05c5&&_0x8f05c5[_0x6b67('0x21')]>0x0){_0x5746df=_[_0x6b67('0x35')](_0x8f05c5,_0x3ee188);}return _0x5746df;}function getCustomFields(_0x5d2de7,_0x582242){var _0x47e317=[];var _0x4f056a={'custom_fields':[]};if(_0x5d2de7['length']>0x0){_[_0x6b67('0x36')](_0x5d2de7,function(_0x22383b){if(_[_0x6b67('0x37')]([_0x6b67('0x38'),_0x6b67('0x39')],_0x22383b[_0x6b67('0x3a')])&&_0x22383b[_0x6b67('0x3b')]&&!_0x22383b[_0x6b67('0x3c')]){_0x4f056a[_0x22383b[_0x6b67('0x3b')][_0x6b67('0x3d')]()]=_0x22383b['content'][_0x6b67('0x30')]();}else if(_[_0x6b67('0x37')]([_0x6b67('0x38'),_0x6b67('0x39')],_0x22383b[_0x6b67('0x3a')])&&_0x22383b['idField']&&_0x22383b['customField']){_0x4f056a[_0x6b67('0x17')][_0x6b67('0x3e')]({'id':_0x22383b['idField'],'value':_0x22383b[_0x6b67('0x3f')][_0x6b67('0x30')]()});}else if(_0x22383b[_0x6b67('0x3a')]===_0x6b67('0x40')&&_0x22383b[_0x6b67('0x41')]&&_0x22383b[_0x6b67('0x42')]&&_0x22383b[_0x6b67('0x3c')]){_0x582242[_0x22383b[_0x6b67('0x41')]]&&_0x4f056a[_0x6b67('0x17')][_0x6b67('0x3e')]({'id':_0x22383b[_0x6b67('0x42')],'value':_0x582242[_0x22383b['variableName']][_0x6b67('0x30')]()});}else if(_0x22383b[_0x6b67('0x3a')]==='customVariable'&&_0x22383b['Variable']&&_0x22383b['Variable'][_0x6b67('0x15')]&&_0x22383b['idField']&&_0x22383b[_0x6b67('0x3c')]){_0x582242[_0x22383b['Variable'][_0x6b67('0x15')][_0x6b67('0x3d')]()]&&_0x4f056a['custom_fields'][_0x6b67('0x3e')]({'id':_0x22383b[_0x6b67('0x42')],'value':_0x582242[_0x22383b['Variable'][_0x6b67('0x15')][_0x6b67('0x3d')]()][_0x6b67('0x30')]()});}});}return _0x4f056a;}exports['queue']=function(_0x23ca6f,_0x764e69,_0x518df0,_0x350ab9,_0x18c9bc,_0x3404e9){var _0x41e6dc,_0x476f48;_0x3404e9[_0x6b67('0x1a')]=intUtil[_0x6b67('0x43')](_0x3404e9[_0x6b67('0x1a')]);_0x3404e9['serverUrl']=intUtil[_0x6b67('0x43')](_0x3404e9[_0x6b67('0x44')]);if(_0x18c9bc&&_0x18c9bc[_0x6b67('0x45')]){logger[_0x6b67('0x1d')](_0x6b67('0x46'),_0x6b67('0x47'));_0x764e69['recordingURL']=util[_0x6b67('0xd')](_0x6b67('0x48'),_0x3404e9[_0x6b67('0x44')],_0x764e69[_0x6b67('0x49')],md5(_0x764e69[_0x6b67('0x49')]));}else{_0x764e69['recordingURL']='';}headers[_0x6b67('0x4a')]=getAuth(_0x3404e9);return getUser(_0x3404e9,_0x350ab9[_0x6b67('0x25')])['then'](function(_0xf6eec8){_0x41e6dc=_0xf6eec8;logger[_0x6b67('0x1d')](_0x6b67('0x4b'),_0x41e6dc['id']);return getEndUser(_0x3404e9,_0x764e69[_0x6b67('0xf')],_0x764e69['calleridnum']);})['then'](function(_0x23c875){_0x476f48=_0x23c875;logger[_0x6b67('0x1d')](_0x6b67('0x4c'),_0x476f48['id']);return getTicket(_0x3404e9,_0x41e6dc,_0x476f48,_0x518df0,_0x764e69);})[_0x6b67('0x1c')](function(_0x5f5c5b){if(_0x5f5c5b&&_0x5f5c5b['id']){logger[_0x6b67('0x1d')](_0x6b67('0x1e'));logger[_0x6b67('0x1d')](_0x6b67('0x4d'),_0x5f5c5b['id']);logger['info'](_0x6b67('0x46'),_0x6b67('0x4e'));emit(util[_0x6b67('0xd')]('user:%s',_0x350ab9['name']),_0x6b67('0x4f'),{'uri':util[_0x6b67('0xd')](_0x6b67('0x50'),_0x3404e9[_0x6b67('0x1a')],_0x5f5c5b['id'])});}})[_0x6b67('0x51')](function(_0x5957ae){logger['error']('[QUEUE]',JSON[_0x6b67('0x33')](_0x5957ae));});};exports[_0x6b67('0x52')]=function(_0x31cd29,_0x29d1a2,_0x3f98b3,_0x2335c0,_0x396aef,_0x30024e,_0x5d8257){var _0x3885db,_0x3bdef0;_0x30024e[_0x6b67('0x1a')]=intUtil[_0x6b67('0x43')](_0x30024e['remoteUri']);_0x30024e[_0x6b67('0x44')]=intUtil[_0x6b67('0x43')](_0x30024e[_0x6b67('0x44')]);if(_0x5d8257&&_0x5d8257[_0x6b67('0x53')]&&_0x5d8257[_0x6b67('0x53')]!==_0x6b67('0x54')){logger[_0x6b67('0x1d')](_0x6b67('0x55'),_0x6b67('0x47'));_0x29d1a2[_0x6b67('0x56')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30024e[_0x6b67('0x44')],_0x29d1a2['uniqueid'],md5(_0x29d1a2[_0x6b67('0x49')]));}headers['Authorization']=getAuth(_0x30024e);return getUser(_0x30024e,_0x2335c0['email'])[_0x6b67('0x1c')](function(_0x4c3afb){_0x3885db=_0x4c3afb;logger['info']('The\x20User\x20ID\x20is:',_0x3885db['id']);return getEndUser(_0x30024e,_0x29d1a2[_0x6b67('0x57')],_0x29d1a2[_0x6b67('0x58')]);})[_0x6b67('0x1c')](function(_0x427ac0){_0x3bdef0=_0x427ac0;logger[_0x6b67('0x1d')](_0x6b67('0x4c'),_0x3bdef0['id']);return getTicket(_0x30024e,_0x3885db,_0x3bdef0,_0x3f98b3,_0x29d1a2);})[_0x6b67('0x1c')](function(_0x1df872){if(_0x1df872&&_0x1df872['id']){logger[_0x6b67('0x1d')](_0x6b67('0x1e'));logger[_0x6b67('0x1d')](_0x6b67('0x4d'),_0x1df872['id']);logger[_0x6b67('0x1d')](_0x6b67('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6b67('0xd')](_0x6b67('0x59'),_0x2335c0['name']),_0x6b67('0x4f'),{'uri':util['format'](_0x6b67('0x50'),_0x30024e['remoteUri'],_0x1df872['id'])});}})[_0x6b67('0x51')](function(_0x3dcae9){logger['error'](_0x6b67('0x55'),JSON[_0x6b67('0x33')](_0x3dcae9));});};exports[_0x6b67('0x5a')]=function(_0x3bebd3,_0x494d8b,_0x2b5dc0,_0x19d4dd,_0x368796,_0x3f94d6){var _0x4bf355,_0x2c3a77;_0x3f94d6[_0x6b67('0x1a')]=intUtil[_0x6b67('0x43')](_0x3f94d6[_0x6b67('0x1a')]);_0x3f94d6[_0x6b67('0x44')]=intUtil['stripTrailingSlash'](_0x3f94d6[_0x6b67('0x44')]);if(_0x368796&&_0x368796['monitor_format']){logger[_0x6b67('0x1d')]('['+_0x494d8b[_0x6b67('0x5b')]['toUpperCase']()+']',_0x6b67('0x47'));_0x494d8b[_0x6b67('0x56')]=util[_0x6b67('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f94d6[_0x6b67('0x44')],_0x494d8b[_0x6b67('0x49')],md5(_0x494d8b[_0x6b67('0x49')]));}else{_0x494d8b[_0x6b67('0x56')]='';}headers[_0x6b67('0x4a')]=getAuth(_0x3f94d6);return getUser(_0x3f94d6,'')[_0x6b67('0x1c')](function(_0x2ab1ae){_0x4bf355=_0x2ab1ae;logger[_0x6b67('0x1d')](_0x6b67('0x4b'),_0x4bf355['id']);return getEndUser(_0x3f94d6,_0x494d8b[_0x6b67('0xf')],_0x494d8b[_0x6b67('0x10')]);})[_0x6b67('0x1c')](function(_0x34481b){_0x2c3a77=_0x34481b;logger[_0x6b67('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x2c3a77['id']);return getTicket(_0x3f94d6,_0x4bf355,_0x2c3a77,_0x2b5dc0,_0x494d8b);})[_0x6b67('0x1c')](function(_0x1c6daf){if(_0x1c6daf){logger[_0x6b67('0x1d')](_0x6b67('0x1e'));logger[_0x6b67('0x1d')](_0x6b67('0x4d'),_0x1c6daf['id']);}})['catch'](function(_0xb3a5b9){logger[_0x6b67('0x5c')]('['+_0x494d8b['lastevent'][_0x6b67('0x5d')]()+']',JSON[_0x6b67('0x33')](_0xb3a5b9));});}; \ 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 1e72d80..803093b 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 _0x7785=['../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','socket.io-emitter','redis','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','catch','message','&f=','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','request-promise','md5','util','moment','ioredis','./util'];(function(_0x5c1e98,_0x15e3d8){var _0x514cf1=function(_0x3dcd1d){while(--_0x3dcd1d){_0x5c1e98['push'](_0x5c1e98['shift']());}};_0x514cf1(++_0x15e3d8);}(_0x7785,0xf3));var _0x5778=function(_0x152210,_0x334e4d){_0x152210=_0x152210-0x0;var _0x1f3094=_0x7785[_0x152210];return _0x1f3094;};'use strict';var _=require('lodash');var rp=require(_0x5778('0x0'));var md5=require(_0x5778('0x1'));var util=require(_0x5778('0x2'));var moment=require(_0x5778('0x3'));var Promise=require('bluebird');var Redis=require(_0x5778('0x4'));var intUtil=require(_0x5778('0x5'));var config=require(_0x5778('0x6'));var logger=require(_0x5778('0x7'))(_0x5778('0x8'));config['redis']=_[_0x5778('0x9')](config['redis'],{'host':_0x5778('0xa'),'port':0x18eb});var io=require(_0x5778('0xb'))(new Redis(config[_0x5778('0xc')]));function getAdminId(_0x185a8d,_0x259441,_0x14a99b,_0x1196e){return new Promise(function(_0x56c5a9,_0x4c82ff){var _0x145ae2=![];var _0x255223={'method':_0x5778('0xd'),'uri':_0x1196e+_0x5778('0xe'),'json':!![]};_0x255223[_0x5778('0xf')]=_0x14a99b;logger[_0x5778('0x10')](_0x5778('0x11'));return rp(_0x255223)[_0x5778('0x12')](function(_0x5e1e83){if(_0x5e1e83){var _0x16ec43=_0x5e1e83[_0x5778('0x13')];var _0x1791a0=null;for(_0x1791a0=0x0;_0x1791a0<_0x16ec43[_0x5778('0x14')];_0x1791a0++){if(_0x16ec43[_0x1791a0][_0x5778('0x15')]===_0x185a8d[_0x5778('0x16')]){_0x185a8d[_0x5778('0x17')]=_0x16ec43[_0x1791a0]['id'];_0x145ae2=!![];}}if(_0x145ae2){logger['info'](_0x5778('0x18'),_0x185a8d['adminId']);_0x56c5a9(_0x185a8d);}else{_0x4c82ff({'statusCode':0x194,'message':_0x5778('0x19')});}}else{_0x4c82ff({'statusCode':0x194,'message':_0x5778('0x19')});}})['catch'](function(_0x44dfd7){logger[_0x5778('0x1a')]('['+[_0x259441[_0x5778('0x1b')]()]+']',_0x44dfd7['message']);_0x4c82ff(_0x44dfd7);});});}function getUser(_0x524033,_0x21fce7,_0x5f212a){return function(_0x2d2cf2){return new Promise(function(_0x163d48,_0x560b18){var _0x10c770={'method':_0x5778('0xd'),'uri':_0x5f212a+_0x5778('0xe'),'json':!![]};_0x10c770[_0x5778('0xf')]=_0x21fce7;logger[_0x5778('0x10')]('Getting\x20user\x20list');return rp(_0x10c770)['then'](function(_0x1de816){if(_0x1de816){var _0x5338c6=_0x1de816[_0x5778('0x13')];var _0x4dcc95=![];var _0x23ef7f=null;if(_0x2d2cf2[_0x5778('0x1c')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x2d2cf2[_0x5778('0x1c')]);_0x2d2cf2[_0x5778('0x1d')]=_0x2d2cf2[_0x5778('0x1c')];for(_0x23ef7f=0x0;_0x23ef7f<_0x5338c6[_0x5778('0x14')];_0x23ef7f++){if(_0x5338c6[_0x23ef7f][_0x5778('0x15')]===_0x2d2cf2[_0x5778('0x1c')]){_0x4dcc95=!![];_0x2d2cf2[_0x5778('0x1e')]=_0x5338c6[_0x23ef7f]['id'];logger['info'](_0x5778('0x1f'),_0x2d2cf2['userId']);}}}if(!_0x4dcc95){logger['info'](_0x5778('0x20'));_0x2d2cf2['userEmail']=_0x2d2cf2['adminEmail'];_0x2d2cf2[_0x5778('0x1e')]=_0x2d2cf2['adminId'];_0x4dcc95=!![];}if(_0x4dcc95){_0x163d48(_0x2d2cf2);}else{_0x560b18({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x560b18({'statusCode':0x194,'message':_0x5778('0x19')});}})[_0x5778('0x21')](function(_0xffbda9){logger[_0x5778('0x1a')]('['+[_0x524033['toUpperCase']()]+']',_0xffbda9[_0x5778('0x22')]);_0x560b18(_0xffbda9);});});};}function searchContact(_0x2b065c,_0x3af7cf,_0x55d410,_0x350075){return new Promise(function(_0xf96d1,_0xcfad1a){var _0x25fdab={'method':_0x5778('0xd'),'headers':_0x3af7cf,'uri':_0x2b065c+'/api/lookup?q='+_0x350075+_0x5778('0x23')+_0x55d410+'&entities=contact','json':!![]};rp(_0x25fdab)[_0x5778('0x12')](function(_0x324a97){var _0x4596bd=_['find'](_0x324a97[_0x5778('0x24')]['contacts'],[_0x55d410,_0x350075]);_0xf96d1(_0x4596bd);})[_0x5778('0x21')](function(_0x43e8c8){_0xcfad1a(_0x43e8c8);});});}function getEndUser(_0x47e536,_0x1f16bd,_0x242b88){return function(_0x29dc22){return new Promise(function(_0x209fa5,_0x3e4473){logger[_0x5778('0x10')](util['format'](_0x5778('0x25'),_0x29dc22[_0x5778('0x26')]));searchContact(_0x242b88,_0x1f16bd,_0x5778('0x27'),_0x29dc22[_0x5778('0x26')])[_0x5778('0x12')](function(_0x2a387e){if(_0x2a387e){_0x29dc22[_0x5778('0x28')]=_0x2a387e['id'];logger[_0x5778('0x10')](_0x5778('0x29'),_0x29dc22[_0x5778('0x28')]);return _0x209fa5(_0x29dc22);}searchContact(_0x242b88,_0x1f16bd,_0x5778('0x2a'),_0x29dc22['contactNumber'])[_0x5778('0x12')](function(_0x5aa3bf){if(_0x5aa3bf){_0x29dc22[_0x5778('0x28')]=_0x5aa3bf['id'];logger[_0x5778('0x10')](_0x5778('0x2b'),_0x29dc22[_0x5778('0x28')]);return _0x209fa5(_0x29dc22);}createEndUser(_0x29dc22,_0x47e536,_0x1f16bd,_0x242b88)[_0x5778('0x12')](function(_0x113656){logger[_0x5778('0x10')]('Contact\x20created:',_0x113656[_0x5778('0x28')]);return _0x209fa5(_0x113656);});});})['catch'](function(_0x26a559){_0x3e4473(_0x26a559);});});};}function createEndUser(_0x2f2a7b,_0x24de80,_0x5229bf,_0x45c2c1){return new Promise(function(_0x4cc7dd,_0x113537){var _0x5004cf=moment();var _0x29ffa1={'method':_0x5778('0x2c'),'uri':_0x45c2c1+'/api/contacts','body':{'contact':{'last_name':_0x2f2a7b[_0x5778('0x26')],'work_number':_0x2f2a7b['contactNumber'],'mobile_number':_0x2f2a7b['contactNumber'],'owner_id':_0x2f2a7b[_0x5778('0x1e')],'created_at':_0x5004cf[_0x5778('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x29ffa1[_0x5778('0xf')]=_0x5229bf;logger['info'](_0x5778('0x2e'));return rp(_0x29ffa1)[_0x5778('0x12')](function(_0x117ae8){_0x2f2a7b[_0x5778('0x28')]=_0x117ae8[_0x5778('0x2f')]['id'];_0x4cc7dd(_0x2f2a7b);})[_0x5778('0x21')](function(_0x2af8da){logger['error']('['+[_0x24de80['toUpperCase']()]+']',_0x2af8da['message']);_0x113537(_0x2af8da[_0x5778('0x22')]);});});}function getTicket(_0x206452,_0x4a17da,_0x461f35,_0x20a867,_0x5d03cc){return function(_0x2c6129){logger[_0x5778('0x10')](_0x5778('0x30'));return new Promise(function(_0x3db222,_0x191817){var _0x352f0a=moment();var _0x2184a4={'method':_0x5778('0x2c'),'uri':_0x461f35+_0x5778('0x31'),'body':{'title':intUtil[_0x5778('0x32')](_0x20a867[_0x5778('0x33')],_0x5d03cc,'\x20'),'description':intUtil[_0x5778('0x32')](_0x20a867[_0x5778('0x34')],_0x5d03cc,'\x0a'),'owner_id':_0x2c6129[_0x5778('0x1e')],'creater_id':_0x2c6129[_0x5778('0x17')],'targetable_id':_0x2c6129[_0x5778('0x28')],'targetable_type':_0x5778('0x35'),'created_at':_0x352f0a[_0x5778('0x2d')](_0x5778('0x36')),'due_date':_0x352f0a[_0x5778('0x37')](0x1e,'m')[_0x5778('0x2d')](_0x5778('0x36'))},'json':!![]};_0x2184a4[_0x5778('0xf')]=_0x4a17da;return rp(_0x2184a4)[_0x5778('0x12')](function(_0x3f35a4){_0x2c6129[_0x5778('0x38')]=_0x3f35a4[_0x5778('0x39')]['id'];logger[_0x5778('0x10')](_0x5778('0x3a'),_0x2c6129[_0x5778('0x38')]);_0x3db222(_0x2c6129);})[_0x5778('0x21')](function(_0x2c5a2f){logger[_0x5778('0x1a')]('['+[_0x206452[_0x5778('0x1b')]()]+']',_0x2c5a2f[_0x5778('0x22')]);_0x191817(_0x2c5a2f['message']);});});};}function emit(_0x3f19a5,_0x2f6749,_0x8a5ee6){var _0x47f5d6={'uri':_0x3f19a5+_0x5778('0x3b')+_0x8a5ee6};io['to'](util['format'](_0x5778('0x3c'),_0x2f6749))[_0x5778('0x3d')](_0x5778('0x3e'),_0x47f5d6);}exports['cs']=function(_0x1327df,_0x1cc17d,_0x14f75c,_0x3cd516,_0x4b4e0c,_0x45b72f,_0x410774,_0x7538db){var _0x288e24={};var _0x3b527a={'Authorization':_0x5778('0x3f')+_0x45b72f[_0x5778('0x40')]};_0x45b72f[_0x5778('0x41')]=intUtil['stripTrailingSlash'](_0x45b72f['remoteUri']);_0x45b72f[_0x5778('0x42')]=intUtil[_0x5778('0x43')](_0x45b72f[_0x5778('0x42')]);var _0x3d2e55=_0x45b72f[_0x5778('0x41')];_0x288e24[_0x5778('0x16')]=_0x45b72f[_0x5778('0x44')];_0x288e24[_0x5778('0x26')]=_0x7538db[_0x5778('0x45')]()==='outbound'?_0x1cc17d['destcalleridnum']:_0x1cc17d[_0x5778('0x46')];_0x288e24['callDirection']=_0x7538db===_0x5778('0x47')||_0x7538db===_0x5778('0x48')?_0x5778('0x47'):_0x5778('0x49');if(_0x3cd516){_0x288e24[_0x5778('0x1c')]=_0x3cd516[_0x5778('0x15')];}var _0x48875f=util[_0x5778('0x2d')](_0x5778('0x4a'),_0x45b72f[_0x5778('0x42')],_0x1cc17d['uniqueid'],md5(_0x1cc17d[_0x5778('0x4b')]));if(_0x4b4e0c&&_0x4b4e0c['monitor_format']){logger[_0x5778('0x10')](_0x5778('0x4c'),'Recording\x20is\x20enabled!');_0x1cc17d[_0x5778('0x4d')]=_0x48875f;}else if(_0x410774&&_0x410774[_0x5778('0x4e')]&&_0x410774['recordingFormat']!==_0x5778('0x4f')){logger[_0x5778('0x10')]('[OUTBOUND]',_0x5778('0x50'));_0x1cc17d[_0x5778('0x4d')]=_0x48875f;}else{_0x1cc17d['recordingURL']='';}return getAdminId(_0x288e24,_0x7538db,_0x3b527a,_0x3d2e55)['then'](getUser(_0x7538db,_0x3b527a,_0x3d2e55))[_0x5778('0x12')](getEndUser(_0x7538db,_0x3b527a,_0x3d2e55))['then'](getTicket(_0x7538db,_0x3b527a,_0x3d2e55,_0x14f75c,_0x1cc17d))[_0x5778('0x12')](function(_0x417848){logger[_0x5778('0x10')](util[_0x5778('0x2d')](_0x5778('0x51'),_0x417848[_0x5778('0x38')]));if(_0x7538db!==_0x5778('0x48')){logger[_0x5778('0x10')]('['+[_0x7538db['toUpperCase']()]+']',_0x5778('0x52'));emit(_0x3d2e55,_0x3cd516['name'],_0x417848[_0x5778('0x28')]);}})[_0x5778('0x21')](function(_0x184382){logger[_0x5778('0x1a')]('['+[_0x7538db[_0x5778('0x1b')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x184382,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x52e5=['/api/lookup?q=','&f=','&entities=contact','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Admin\x20found:','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','userId','Admin\x20selected','Requested\x20Resource\x20not\x20Found','catch'];(function(_0xfe5f32,_0x54d16b){var _0x4e5501=function(_0x35d3b8){while(--_0x35d3b8){_0xfe5f32['push'](_0xfe5f32['shift']());}};_0x4e5501(++_0x54d16b);}(_0x52e5,0x1e0));var _0x552e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x52e5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x552e('0x0'));var rp=require(_0x552e('0x1'));var md5=require(_0x552e('0x2'));var util=require('util');var moment=require(_0x552e('0x3'));var Promise=require('bluebird');var Redis=require(_0x552e('0x4'));var intUtil=require(_0x552e('0x5'));var config=require(_0x552e('0x6'));var logger=require(_0x552e('0x7'))(_0x552e('0x8'));config[_0x552e('0x9')]=_[_0x552e('0xa')](config[_0x552e('0x9')],{'host':_0x552e('0xb'),'port':0x18eb});var io=require(_0x552e('0xc'))(new Redis(config[_0x552e('0x9')]));function getAdminId(_0x54d74d,_0x12764c,_0x1844fb,_0x3bf8fd){return new Promise(function(_0xad3da5,_0x33f55f){var _0x4f8463=![];var _0x29d75e={'method':_0x552e('0xd'),'uri':_0x3bf8fd+_0x552e('0xe'),'json':!![]};_0x29d75e[_0x552e('0xf')]=_0x1844fb;logger['info'](_0x552e('0x10'));return rp(_0x29d75e)[_0x552e('0x11')](function(_0x48dc64){if(_0x48dc64){var _0x1efc38=_0x48dc64[_0x552e('0x12')];var _0x4d64c3=null;for(_0x4d64c3=0x0;_0x4d64c3<_0x1efc38[_0x552e('0x13')];_0x4d64c3++){if(_0x1efc38[_0x4d64c3]['email']===_0x54d74d[_0x552e('0x14')]){_0x54d74d[_0x552e('0x15')]=_0x1efc38[_0x4d64c3]['id'];_0x4f8463=!![];}}if(_0x4f8463){logger[_0x552e('0x16')](_0x552e('0x17'),_0x54d74d[_0x552e('0x15')]);_0xad3da5(_0x54d74d);}else{_0x33f55f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x33f55f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1c1523){logger[_0x552e('0x18')]('['+[_0x12764c[_0x552e('0x19')]()]+']',_0x1c1523[_0x552e('0x1a')]);_0x33f55f(_0x1c1523);});});}function getUser(_0x3f6008,_0x4a0621,_0x1d08eb){return function(_0x546722){return new Promise(function(_0x29c478,_0x5b5a08){var _0x437e7f={'method':'GET','uri':_0x1d08eb+_0x552e('0xe'),'json':!![]};_0x437e7f[_0x552e('0xf')]=_0x4a0621;logger['info']('Getting\x20user\x20list');return rp(_0x437e7f)[_0x552e('0x11')](function(_0x23710c){if(_0x23710c){var _0x3f2fb3=_0x23710c['users'];var _0x3f91d4=![];var _0xe69316=null;if(_0x546722[_0x552e('0x1b')]!==null){logger[_0x552e('0x16')](_0x552e('0x1c'),_0x546722[_0x552e('0x1b')]);_0x546722[_0x552e('0x1d')]=_0x546722[_0x552e('0x1b')];for(_0xe69316=0x0;_0xe69316<_0x3f2fb3[_0x552e('0x13')];_0xe69316++){if(_0x3f2fb3[_0xe69316][_0x552e('0x1e')]===_0x546722[_0x552e('0x1b')]){_0x3f91d4=!![];_0x546722['userId']=_0x3f2fb3[_0xe69316]['id'];logger[_0x552e('0x16')](_0x552e('0x1f'),_0x546722[_0x552e('0x20')]);}}}if(!_0x3f91d4){logger['info'](_0x552e('0x21'));_0x546722[_0x552e('0x1d')]=_0x546722['adminEmail'];_0x546722[_0x552e('0x20')]=_0x546722[_0x552e('0x15')];_0x3f91d4=!![];}if(_0x3f91d4){_0x29c478(_0x546722);}else{_0x5b5a08({'statusCode':0x194,'message':_0x552e('0x22')});}}else{_0x5b5a08({'statusCode':0x194,'message':_0x552e('0x22')});}})[_0x552e('0x23')](function(_0x449d2d){logger[_0x552e('0x18')]('['+[_0x3f6008[_0x552e('0x19')]()]+']',_0x449d2d['message']);_0x5b5a08(_0x449d2d);});});};}function searchContact(_0x61b062,_0x4a4fec,_0x5ec1e7,_0x1357b8){return new Promise(function(_0x2496ef,_0x487b72){var _0x2ba9e0={'method':_0x552e('0xd'),'headers':_0x4a4fec,'uri':_0x61b062+_0x552e('0x24')+_0x1357b8+_0x552e('0x25')+_0x5ec1e7+_0x552e('0x26'),'json':!![]};rp(_0x2ba9e0)[_0x552e('0x11')](function(_0x1bb839){var _0x5f15eb=_['find'](_0x1bb839['contacts']['contacts'],[_0x5ec1e7,_0x1357b8]);_0x2496ef(_0x5f15eb);})[_0x552e('0x23')](function(_0x337953){_0x487b72(_0x337953);});});}function getEndUser(_0x4dec0c,_0x37d6be,_0xda9a7a){return function(_0xf097f3){return new Promise(function(_0x2daf85,_0x38b066){logger[_0x552e('0x16')](util[_0x552e('0x27')](_0x552e('0x28'),_0xf097f3[_0x552e('0x29')]));searchContact(_0xda9a7a,_0x37d6be,_0x552e('0x2a'),_0xf097f3[_0x552e('0x29')])[_0x552e('0x11')](function(_0x331d45){if(_0x331d45){_0xf097f3['endUserId']=_0x331d45['id'];logger['info'](_0x552e('0x2b'),_0xf097f3[_0x552e('0x2c')]);return _0x2daf85(_0xf097f3);}searchContact(_0xda9a7a,_0x37d6be,'work_number',_0xf097f3[_0x552e('0x29')])[_0x552e('0x11')](function(_0x5e34db){if(_0x5e34db){_0xf097f3['endUserId']=_0x5e34db['id'];logger['info'](_0x552e('0x2d'),_0xf097f3['endUserId']);return _0x2daf85(_0xf097f3);}createEndUser(_0xf097f3,_0x4dec0c,_0x37d6be,_0xda9a7a)[_0x552e('0x11')](function(_0x4a8e0d){logger[_0x552e('0x16')](_0x552e('0x2e'),_0x4a8e0d[_0x552e('0x2c')]);return _0x2daf85(_0x4a8e0d);});});})['catch'](function(_0xe88763){_0x38b066(_0xe88763);});});};}function createEndUser(_0x2ea0f1,_0xfd3bd8,_0x4c93bc,_0x1fd33e){return new Promise(function(_0x1b1e1f,_0x34deca){var _0xd56cde=moment();var _0x90c61c={'method':_0x552e('0x2f'),'uri':_0x1fd33e+_0x552e('0x30'),'body':{'contact':{'last_name':_0x2ea0f1[_0x552e('0x29')],'work_number':_0x2ea0f1[_0x552e('0x29')],'mobile_number':_0x2ea0f1[_0x552e('0x29')],'owner_id':_0x2ea0f1[_0x552e('0x20')],'created_at':_0xd56cde['format'](_0x552e('0x31'))}},'json':!![]};_0x90c61c[_0x552e('0xf')]=_0x4c93bc;logger[_0x552e('0x16')](_0x552e('0x32'));return rp(_0x90c61c)[_0x552e('0x11')](function(_0x40d6f7){_0x2ea0f1[_0x552e('0x2c')]=_0x40d6f7['contact']['id'];_0x1b1e1f(_0x2ea0f1);})[_0x552e('0x23')](function(_0x3b3027){logger[_0x552e('0x18')]('['+[_0xfd3bd8[_0x552e('0x19')]()]+']',_0x3b3027[_0x552e('0x1a')]);_0x34deca(_0x3b3027[_0x552e('0x1a')]);});});}function getTicket(_0x27a146,_0x560990,_0x44ec75,_0x5da9a2,_0x5a2b32){return function(_0x2295c7){logger[_0x552e('0x16')](_0x552e('0x33'));return new Promise(function(_0x13507b,_0x3af62e){var _0x4d10a4=moment();var _0x213903={'method':'POST','uri':_0x44ec75+_0x552e('0x34'),'body':{'title':intUtil[_0x552e('0x35')](_0x5da9a2['Subjects'],_0x5a2b32,'\x20'),'description':intUtil[_0x552e('0x35')](_0x5da9a2[_0x552e('0x36')],_0x5a2b32,'\x0a'),'owner_id':_0x2295c7[_0x552e('0x20')],'creater_id':_0x2295c7[_0x552e('0x15')],'targetable_id':_0x2295c7[_0x552e('0x2c')],'targetable_type':_0x552e('0x37'),'created_at':_0x4d10a4[_0x552e('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4d10a4[_0x552e('0x38')](0x1e,'m')[_0x552e('0x27')](_0x552e('0x31'))},'json':!![]};_0x213903['headers']=_0x560990;return rp(_0x213903)[_0x552e('0x11')](function(_0x2c6688){_0x2295c7[_0x552e('0x39')]=_0x2c6688[_0x552e('0x3a')]['id'];logger['info'](_0x552e('0x3b'),_0x2295c7[_0x552e('0x39')]);_0x13507b(_0x2295c7);})[_0x552e('0x23')](function(_0x380480){logger[_0x552e('0x18')]('['+[_0x27a146[_0x552e('0x19')]()]+']',_0x380480['message']);_0x3af62e(_0x380480['message']);});});};}function emit(_0x1bedff,_0x105604,_0x5a2cd0){var _0x4d4406={'uri':_0x1bedff+_0x552e('0x3c')+_0x5a2cd0};io['to'](util[_0x552e('0x27')](_0x552e('0x3d'),_0x105604))['emit'](_0x552e('0x3e'),_0x4d4406);}exports['cs']=function(_0x5f1555,_0x48c764,_0x8bd530,_0xd3fa79,_0x377205,_0x316ed5,_0x2471c9,_0x361126){var _0x12873b={};var _0x430fa0={'Authorization':_0x552e('0x3f')+_0x316ed5[_0x552e('0x40')]};_0x316ed5[_0x552e('0x41')]=intUtil[_0x552e('0x42')](_0x316ed5[_0x552e('0x41')]);_0x316ed5[_0x552e('0x43')]=intUtil[_0x552e('0x42')](_0x316ed5[_0x552e('0x43')]);var _0x2d1a15=_0x316ed5[_0x552e('0x41')];_0x12873b['adminEmail']=_0x316ed5[_0x552e('0x44')];_0x12873b[_0x552e('0x29')]=_0x361126['toLowerCase']()===_0x552e('0x45')?_0x48c764[_0x552e('0x46')]:_0x48c764['calleridnum'];_0x12873b[_0x552e('0x47')]=_0x361126===_0x552e('0x48')||_0x361126==='unmanaged'?_0x552e('0x48'):_0x552e('0x45');if(_0xd3fa79){_0x12873b[_0x552e('0x1b')]=_0xd3fa79['email'];}var _0x23c0d4=util[_0x552e('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x316ed5['serverUrl'],_0x48c764['uniqueid'],md5(_0x48c764[_0x552e('0x49')]));if(_0x377205&&_0x377205[_0x552e('0x4a')]){logger[_0x552e('0x16')](_0x552e('0x4b'),_0x552e('0x4c'));_0x48c764[_0x552e('0x4d')]=_0x23c0d4;}else if(_0x2471c9&&_0x2471c9[_0x552e('0x4e')]&&_0x2471c9['recordingFormat']!==_0x552e('0x4f')){logger[_0x552e('0x16')](_0x552e('0x50'),_0x552e('0x4c'));_0x48c764[_0x552e('0x4d')]=_0x23c0d4;}else{_0x48c764[_0x552e('0x4d')]='';}return getAdminId(_0x12873b,_0x361126,_0x430fa0,_0x2d1a15)[_0x552e('0x11')](getUser(_0x361126,_0x430fa0,_0x2d1a15))[_0x552e('0x11')](getEndUser(_0x361126,_0x430fa0,_0x2d1a15))[_0x552e('0x11')](getTicket(_0x361126,_0x430fa0,_0x2d1a15,_0x8bd530,_0x48c764))[_0x552e('0x11')](function(_0x36629a){logger[_0x552e('0x16')](util[_0x552e('0x27')](_0x552e('0x51'),_0x36629a['ticketId']));if(_0x361126!=='unmanaged'){logger['info']('['+[_0x361126['toUpperCase']()]+']',_0x552e('0x52'));emit(_0x2d1a15,_0xd3fa79[_0x552e('0x53')],_0x36629a[_0x552e('0x2c')]);}})['catch'](function(_0x42829c){logger[_0x552e('0x18')]('['+[_0x361126[_0x552e('0x19')]()]+_0x552e('0x54'),util[_0x552e('0x55')](_0x42829c,{'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 6043c7c..996abe2 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 _0x995c=['servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','zendesk'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x995c,0x76));var _0xc995=function(_0x1e4d14,_0x1f712b){_0x1e4d14=_0x1e4d14-0x0;var _0xef499=_0x995c[_0x1e4d14];return _0xef499;};'use strict';var _=require(_0xc995('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xc995('0x1'));var sugarcrm=require(_0xc995('0x2'));var freshdesk=require(_0xc995('0x3'));var zoho=require(_0xc995('0x4'));var desk=require(_0xc995('0x5'));var vtiger=require(_0xc995('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0xc995('0x7'));var freshsales=require(_0xc995('0x8'));var integrations=['zendesk',_0xc995('0x9'),_0xc995('0xa'),_0xc995('0xb'),_0xc995('0xc'),_0xc995('0xd'),_0xc995('0xe'),_0xc995('0xf'),_0xc995('0x10'),'servicenow'];exports[_0xc995('0x11')]=function(_0x252fd2,_0x427ddf,_0x1c6d07,_0x38e182,_0x568676,_0x309cba){if(_0x1c6d07){if(_['includes'](integrations,_0x252fd2['data1']['toLowerCase']())){try{var _0x15045e=null;var _0x22251c='';var _0x302e81=_0x1c6d07[_0x252fd2['data1'][_0xc995('0x12')]()];if(_0x302e81){var _0x633901=_0x302e81[_0x252fd2[_0xc995('0x13')]];if(_0x633901){var _0x3de75a=_[_0xc995('0x14')](_0x633901[_0xc995('0x15')],{'id':parseInt(_0x252fd2[_0xc995('0x16')],0xa)});if(_0x3de75a){if(_0x38e182){if(_0x568676&&_0x427ddf['queue']){_0x22251c=_0xc995('0x17');}else if(_0x427ddf['routeId']){_0x22251c=_0xc995('0x18');}else{console[_0xc995('0x19')](_0xc995('0x1a'),_0x427ddf);}}else{_0x22251c=_0xc995('0x1b');}switch(_0x252fd2[_0xc995('0x1c')][_0xc995('0x12')]()){case _0xc995('0x1d'):zendesk[_0x22251c](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba);break;case _0xc995('0x9'):salesforce[_0x22251c](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba);break;case _0xc995('0xa'):sugarcrm[_0x22251c](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba);break;case _0xc995('0xb'):freshdesk[_0x22251c](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba);break;case _0xc995('0xc'):zoho[_0x22251c](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba);break;case _0xc995('0xd'):desk[_0x22251c](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba);break;case _0xc995('0xe'):vtiger[_0x22251c](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba);break;case _0xc995('0x10'):freshsales['cs'](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba,_0x22251c);break;case _0xc995('0x1e'):servicenow['cs'](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba,_0x22251c);break;case _0xc995('0xf'):dynamics365['cs'](_0x252fd2,_0x427ddf,_0x3de75a,_0x38e182,_0x568676,_0x633901,_0x309cba,_0x22251c);break;default:console[_0xc995('0x19')](_0xc995('0x1f'));}}else{_0x15045e=require(_0xc995('0x20'))(_0x252fd2[_0xc995('0x1c')][_0xc995('0x12')]());_0x15045e['error'](_0xc995('0x21'),util['format'](_0xc995('0x22'),_0x252fd2[_0xc995('0x1c')][_0xc995('0x12')](),_0x252fd2['data3']));}}else{_0x15045e=require(_0xc995('0x20'))(_0x252fd2[_0xc995('0x1c')]['toLowerCase']());_0x15045e['error'](_0xc995('0x21'),util[_0xc995('0x23')](_0xc995('0x24'),_0x252fd2['data1'][_0xc995('0x12')](),_0x252fd2[_0xc995('0x13')]));}}else{}}catch(_0x17b336){console['error'](_0x17b336);}}}}; \ No newline at end of file +var _0xb155=['toLowerCase','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','vtiger','servicenow','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','data2','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','exec','data1'];(function(_0xdd9041,_0x33985b){var _0x4769a4=function(_0x3c3075){while(--_0x3c3075){_0xdd9041['push'](_0xdd9041['shift']());}};_0x4769a4(++_0x33985b);}(_0xb155,0x1cd));var _0x5b15=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0xb155[_0x368bba];return _0x409f8f;};'use strict';var _=require('lodash');var util=require(_0x5b15('0x0'));var zendesk=require(_0x5b15('0x1'));var salesforce=require(_0x5b15('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x5b15('0x3'));var zoho=require(_0x5b15('0x4'));var desk=require(_0x5b15('0x5'));var vtiger=require(_0x5b15('0x6'));var servicenow=require(_0x5b15('0x7'));var dynamics365=require(_0x5b15('0x8'));var freshsales=require(_0x5b15('0x9'));var integrations=[_0x5b15('0xa'),_0x5b15('0xb'),_0x5b15('0xc'),_0x5b15('0xd'),_0x5b15('0xe'),_0x5b15('0xf'),'vtiger',_0x5b15('0x10'),_0x5b15('0x11'),'servicenow'];exports[_0x5b15('0x12')]=function(_0x16aebc,_0x14f9d6,_0x2b68af,_0x3f546a,_0x1238ee,_0x5e81e2){if(_0x2b68af){if(_['includes'](integrations,_0x16aebc[_0x5b15('0x13')][_0x5b15('0x14')]())){try{var _0x440c17=null;var _0x7f361b='';var _0x3a08ca=_0x2b68af[_0x16aebc['data1']['toLowerCase']()];if(_0x3a08ca){var _0x8e548e=_0x3a08ca[_0x16aebc['data2']];if(_0x8e548e){var _0x5f3719=_['find'](_0x8e548e[_0x5b15('0x15')],{'id':parseInt(_0x16aebc[_0x5b15('0x16')],0xa)});if(_0x5f3719){if(_0x3f546a){if(_0x1238ee&&_0x14f9d6['queue']){_0x7f361b=_0x5b15('0x17');}else if(_0x14f9d6[_0x5b15('0x18')]){_0x7f361b=_0x5b15('0x19');}else{console[_0x5b15('0x1a')](_0x5b15('0x1b'),_0x14f9d6);}}else{_0x7f361b=_0x5b15('0x1c');}switch(_0x16aebc['data1'][_0x5b15('0x14')]()){case _0x5b15('0xa'):zendesk[_0x7f361b](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2);break;case _0x5b15('0xb'):salesforce[_0x7f361b](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2);break;case _0x5b15('0xc'):sugarcrm[_0x7f361b](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2);break;case'freshdesk':freshdesk[_0x7f361b](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2);break;case _0x5b15('0xe'):zoho[_0x7f361b](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2);break;case _0x5b15('0xf'):desk[_0x7f361b](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2);break;case _0x5b15('0x1d'):vtiger[_0x7f361b](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2);break;case _0x5b15('0x11'):freshsales['cs'](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2,_0x7f361b);break;case _0x5b15('0x1e'):servicenow['cs'](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2,_0x7f361b);break;case'dynamics365':dynamics365['cs'](_0x16aebc,_0x14f9d6,_0x5f3719,_0x3f546a,_0x1238ee,_0x8e548e,_0x5e81e2,_0x7f361b);break;default:console[_0x5b15('0x1a')](_0x5b15('0x1f'));}}else{_0x440c17=require('../../../../config/logger')(_0x16aebc[_0x5b15('0x13')]['toLowerCase']());_0x440c17[_0x5b15('0x20')](_0x5b15('0x21'),util[_0x5b15('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x16aebc['data1']['toLowerCase'](),_0x16aebc['data3']));}}else{_0x440c17=require(_0x5b15('0x23'))(_0x16aebc[_0x5b15('0x13')][_0x5b15('0x14')]());_0x440c17[_0x5b15('0x20')]('[EXEC]',util[_0x5b15('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x16aebc[_0x5b15('0x13')][_0x5b15('0x14')](),_0x16aebc[_0x5b15('0x24')]));}}else{}}catch(_0x59524e){console[_0x5b15('0x20')](_0x59524e);}}}}; \ 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 9a0fb73..e8f6ae9 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 _0xa965=[']\x20Ticket\x20%s\x20created.','lastevent','catch','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','additionalSearchAccount','Lead','Account','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','forEach','includes','content','variableName','idField','toString','customVariable','Variable','name','password','securityToken','Connection','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','toUpperCase'];(function(_0xdf1479,_0x2dcb53){var _0x32bdbc=function(_0xec275c){while(--_0xec275c){_0xdf1479['push'](_0xdf1479['shift']());}};_0x32bdbc(++_0x2dcb53);}(_0xa965,0x7f));var _0x5a96=function(_0x3c7936,_0x4bf3ec){_0x3c7936=_0x3c7936-0x0;var _0x56df6c=_0xa965[_0x3c7936];return _0x56df6c;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5a96('0x0'));var md5=require('md5');var jsforce=require(_0x5a96('0x1'));var util=require(_0x5a96('0x2'));var Redis=require(_0x5a96('0x3'));var intUtil=require(_0x5a96('0x4'));var config=require(_0x5a96('0x5'));var logger=require(_0x5a96('0x6'))(_0x5a96('0x7'));config[_0x5a96('0x8')]=_['defaults'](config[_0x5a96('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5a96('0x9'))(new Redis(config[_0x5a96('0x8')]));function emit(_0x3dac84,_0x3fb104,_0x4123c9){io['to'](_0x3dac84)[_0x5a96('0xa')](_0x3fb104,_0x4123c9);}function getTicket(_0x5e7ed2,_0x45d8bd,_0x1fea9a,_0x2b4c79,_0x4920f4,_0x2b6e22,_0x5db87c,_0x8ac374){var _0x3b44f0=Object[_0x5a96('0xb')]({},{'OwnerId':_0x45d8bd['id'],'Subject':intUtil['getString'](_0x2b4c79[_0x5a96('0xc')],_0x4920f4,'\x20'),'Description':intUtil[_0x5a96('0xd')](_0x2b4c79[_0x5a96('0xe')],_0x4920f4,'\x0a')},getCustomFields(_0x2b6e22,_0x4920f4));if(_0x1fea9a){if(_0x2b4c79['ticketType']==='Task'){_0x3b44f0['ActivityDate']=moment[_0x5a96('0xf')]();_0x3b44f0[_0x5a96('0x10')]=![];_0x3b44f0[_0x5a96('0x11')]=![];if(_0x1fea9a[_0x5a96('0x12')]===_0x5a96('0x13')||_0x1fea9a[_0x5a96('0x12')]===_0x5a96('0x14')){_0x3b44f0[_0x5a96('0x15')]=_0x1fea9a['id'];}else if(_0x1fea9a[_0x5a96('0x12')]===_0x5a96('0x16')){_0x3b44f0[_0x5a96('0x17')]=_0x1fea9a['id'];}}else if(_0x2b4c79[_0x5a96('0x18')]===_0x5a96('0x19')){if(_0x1fea9a[_0x5a96('0x12')]===_0x5a96('0x13')){_0x3b44f0[_0x5a96('0x1a')]=_0x1fea9a['id'];}else if(_0x1fea9a[_0x5a96('0x12')]===_0x5a96('0x16')){_0x3b44f0[_0x5a96('0x1b')]=_0x1fea9a['id'];}else if(_0x1fea9a['endUserType']==='lead'&&_0x2b4c79[_0x5a96('0x1c')]){_0x3b44f0[_0x2b4c79[_0x5a96('0x1c')]]=_0x1fea9a['id'];}else{logger[_0x5a96('0x1d')](_0x5a96('0x1e'));}}}return _0x5db87c[_0x5a96('0x1f')](_0x2b4c79[_0x5a96('0x18')])[_0x5a96('0x20')](_0x3b44f0);}function getUser(_0x34199b,_0x47161a,_0x25398b){if(!_[_0x5a96('0x21')](_0x47161a)&&intUtil[_0x5a96('0x22')](_0x47161a)){var _0x17a28e={'Email':_0x47161a};var _0x1e1731={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x25398b['sobject'](_0x5a96('0x23'))[_0x5a96('0x24')](_0x17a28e,_0x1e1731)[_0x5a96('0x25')]()[_0x5a96('0x26')](function(_0x5257bf){if(_0x5257bf[_0x5a96('0x27')]){var _0x35f7f3=_[_0x5a96('0x24')](_0x5257bf,function(_0xd2bf74){return _0xd2bf74[_0x5a96('0x28')]===_0x47161a;});if(_0x35f7f3){logger['info'](_0x5a96('0x29'),_0x47161a);return BPromise['resolve']({'id':_0x35f7f3['Id'],'name':_0x35f7f3[_0x5a96('0x2a')]});}}else{logger[_0x5a96('0x1d')](_0x5a96('0x2b'),_0x47161a);return _0x25398b['identity']()[_0x5a96('0x26')](function(_0x3e1f00){return BPromise[_0x5a96('0x2c')]({'id':_0x3e1f00[_0x5a96('0x2d')],'name':_0x3e1f00[_0x5a96('0x2e')]});});}});}else{logger[_0x5a96('0x1d')](_0x5a96('0x2b'),_0x47161a);return _0x25398b[_0x5a96('0x2f')]()[_0x5a96('0x26')](function(_0x7f5f52){return BPromise['resolve']({'id':_0x7f5f52[_0x5a96('0x2d')],'name':_0x7f5f52['display_name']});});}}function getEndUser(_0x48ed8a,_0x3da3fb,_0xd37abd,_0x63f90c,_0x3e7cb9){var _0x1ef000={'$or':{'Phone':_0x63f90c}};var _0x3bc955={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5a96('0x2c')]()['then'](function(){logger['info'](_0x5a96('0x30'),_0x63f90c,_0x3da3fb[_0x5a96('0x31')]);switch(_0x3da3fb[_0x5a96('0x31')]){case _0x5a96('0x32'):var _0x312917=_[_0x5a96('0x33')](_0x1ef000);if(_0x3da3fb[_0x5a96('0x34')]){var _0x318748={};_0x318748[_0x3da3fb[_0x5a96('0x34')]]=_0x63f90c;_[_0x5a96('0x35')](_0x312917['$or'],_0x318748);}return _0x3e7cb9[_0x5a96('0x1f')](_0x5a96('0x36'))[_0x5a96('0x24')](_0x312917,_0x3bc955)[_0x5a96('0x25')]()[_0x5a96('0x26')](function(_0x345184){if(_0x345184&&_0x345184[_0x5a96('0x27')]){return _0x345184;}else{var _0x4fb0e4=_[_0x5a96('0x33')](_0x1ef000);if(_0x3da3fb['additionalSearchLead']){var _0x1dc3b2={};_0x1dc3b2[_0x3da3fb[_0x5a96('0x37')]]=_0x63f90c;_[_0x5a96('0x35')](_0x4fb0e4[_0x5a96('0x38')],_0x1dc3b2);}return _0x3e7cb9[_0x5a96('0x1f')]('Lead')[_0x5a96('0x24')](_0x4fb0e4,_0x3bc955);}});case'account_contact_lead':var _0x29d398=_[_0x5a96('0x33')](_0x1ef000);if(_0x3da3fb[_0x5a96('0x39')]){var _0x318748={};_0x318748[_0x3da3fb[_0x5a96('0x39')]]=_0x63f90c;_['merge'](_0x29d398[_0x5a96('0x38')],_0x318748);}return _0x3e7cb9[_0x5a96('0x1f')]('Account')[_0x5a96('0x24')](_0x29d398,_0x3bc955)['execute']()['then'](function(_0x145787){if(_0x145787&&_0x145787[_0x5a96('0x27')]){return _0x145787;}else{var _0x317e71=_[_0x5a96('0x33')](_0x1ef000);if(_0x3da3fb[_0x5a96('0x34')]){var _0x3736f3={};_0x3736f3[_0x3da3fb[_0x5a96('0x34')]]=_0x63f90c;_[_0x5a96('0x35')](_0x317e71[_0x5a96('0x38')],_0x3736f3);}return _0x3e7cb9[_0x5a96('0x1f')](_0x5a96('0x36'))['find'](_0x317e71,_0x3bc955)[_0x5a96('0x26')](function(_0x2b3100){if(_0x2b3100&&_0x2b3100[_0x5a96('0x27')]){return _0x2b3100;}else{var _0xd7dd08=_[_0x5a96('0x33')](_0x1ef000);if(_0x3da3fb['additionalSearchLead']){var _0x1dbb99={};_0x1dbb99[_0x3da3fb['additionalSearchLead']]=_0x63f90c;_['merge'](_0xd7dd08[_0x5a96('0x38')],_0x1dbb99);}return _0x3e7cb9[_0x5a96('0x1f')](_0x5a96('0x3a'))[_0x5a96('0x24')](_0xd7dd08,_0x3bc955);}});}});case _0x5a96('0x13'):var _0x312917=_[_0x5a96('0x33')](_0x1ef000);if(_0x3da3fb[_0x5a96('0x34')]){var _0x318748={};_0x318748[_0x3da3fb['additionalSearchContact']]=_0x63f90c;_[_0x5a96('0x35')](_0x312917[_0x5a96('0x38')],_0x318748);}return _0x3e7cb9[_0x5a96('0x1f')](_0x5a96('0x36'))[_0x5a96('0x24')](_0x312917,_0x3bc955)[_0x5a96('0x25')]();case _0x5a96('0x14'):var _0x50ee33=_['cloneDeep'](_0x1ef000);if(_0x3da3fb[_0x5a96('0x37')]){var _0x318748={};_0x318748[_0x3da3fb[_0x5a96('0x37')]]=_0x63f90c;_['merge'](_0x50ee33['$or'],_0x318748);}return _0x3e7cb9[_0x5a96('0x1f')](_0x5a96('0x3a'))[_0x5a96('0x24')](_0x50ee33,_0x3bc955);case _0x5a96('0x16'):var _0x29d398=_[_0x5a96('0x33')](_0x1ef000);if(_0x3da3fb['additionalSearchAccount']){var _0x318748={};_0x318748[_0x3da3fb[_0x5a96('0x39')]]=_0x63f90c;_[_0x5a96('0x35')](_0x29d398[_0x5a96('0x38')],_0x318748);}return _0x3e7cb9[_0x5a96('0x1f')](_0x5a96('0x3b'))[_0x5a96('0x24')](_0x29d398,_0x3bc955);default:return null;}})[_0x5a96('0x26')](function(_0x324268){if(_0x324268&&_0x324268['length']){var _0x20ca3d=_['first'](_0x324268);if(_0x20ca3d){return BPromise[_0x5a96('0x2c')]({'id':_0x20ca3d['Id'],'name':_0x20ca3d['Name'],'phone':_0x20ca3d[_0x5a96('0x3c')],'endUserType':_0x20ca3d[_0x5a96('0x3d')][_0x5a96('0x3e')][_0x5a96('0x3f')]()});}}})[_0x5a96('0x26')](function(_0xaff20e){if(_0xaff20e){logger['info'](_0x5a96('0x40'),_0xaff20e[_0x5a96('0x12')],_0x63f90c);return BPromise[_0x5a96('0x2c')](_0xaff20e);}else{logger[_0x5a96('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x63f90c);var _0x221e27={'Phone':_0x63f90c};if(_0x3da3fb['moduleCreate']){if(_0x3da3fb[_0x5a96('0x41')]==='contact'){logger['info'](_0x5a96('0x42'),_0x63f90c,_0x3da3fb['moduleCreate']);_0x221e27[_0x5a96('0x43')]=_0xd37abd!==_0x5a96('0x44')?_0xd37abd:util[_0x5a96('0x45')](_0x5a96('0x46'),_0x63f90c);}else if(_0x3da3fb[_0x5a96('0x41')]===_0x5a96('0x14')){logger[_0x5a96('0x1d')](_0x5a96('0x42'),_0x63f90c,_0x3da3fb['moduleCreate']);_0x221e27['LastName']=_0xd37abd!==_0x5a96('0x44')?_0xd37abd:util['format'](_0x5a96('0x46'),_0x63f90c);_0x221e27[_0x5a96('0x47')]='No\x20Company';}else if(_0x3da3fb['moduleCreate']==='account'){logger[_0x5a96('0x1d')](_0x5a96('0x42'),_0x63f90c,_0x3da3fb[_0x5a96('0x41')]);_0x221e27['Name']=_0xd37abd!==_0x5a96('0x44')?_0xd37abd:util['format'](_0x5a96('0x46'),_0x63f90c);}else{return null;}}return _0x3e7cb9[_0x5a96('0x1f')](_['upperFirst'](_0x3da3fb['moduleCreate']))[_0x5a96('0x20')](_0x221e27)[_0x5a96('0x26')](function(_0x46c2f9){return BPromise[_0x5a96('0x2c')]({'id':_0x46c2f9['id'],'endUserType':_0x3da3fb['moduleCreate']});});}});}function getCustomFields(_0x1df1cd,_0x21bead){var _0x17f1a4={};if(_0x1df1cd[_0x5a96('0x27')]>0x0){_[_0x5a96('0x48')](_0x1df1cd,function(_0x2a8273){if(_[_0x5a96('0x49')](['string','picklist'],_0x2a8273[_0x5a96('0x3e')])&&_0x2a8273['idField']){_0x17f1a4[_0x2a8273['idField']]=_0x2a8273[_0x5a96('0x4a')]['toString']();}else if(_0x2a8273['type']==='variable'&&_0x2a8273[_0x5a96('0x4b')]&&_0x2a8273[_0x5a96('0x4c')]){_0x21bead[_0x2a8273[_0x5a96('0x4b')]]&&(_0x17f1a4[_0x2a8273[_0x5a96('0x4c')]]=_0x21bead[_0x2a8273[_0x5a96('0x4b')]][_0x5a96('0x4d')]());}else if(_0x2a8273['type']===_0x5a96('0x4e')&&_0x2a8273[_0x5a96('0x4f')]&&_0x2a8273['Variable'][_0x5a96('0x50')]&&_0x2a8273[_0x5a96('0x4c')]){_0x21bead[_0x2a8273[_0x5a96('0x4f')][_0x5a96('0x50')][_0x5a96('0x3f')]()]&&(_0x17f1a4[_0x2a8273['idField']]=_0x21bead[_0x2a8273[_0x5a96('0x4f')][_0x5a96('0x50')]['toLowerCase']()][_0x5a96('0x4d')]());}});}return _0x17f1a4;}function getConnection(_0x347cc9){var _0x32668f=_0x347cc9[_0x5a96('0x51')]['concat'](_0x347cc9[_0x5a96('0x52')]);var _0x442f18=new jsforce[(_0x5a96('0x53'))]({'oauth2':{'loginUrl':_0x347cc9['remoteUri']||_0x5a96('0x54'),'clientId':_0x347cc9[_0x5a96('0x55')],'clientSecret':_0x347cc9['clientSecret']}});return _0x442f18[_0x5a96('0x56')](_0x347cc9[_0x5a96('0x57')],_0x32668f)[_0x5a96('0x26')](function(){logger[_0x5a96('0x1d')](_0x5a96('0x58'));return _0x442f18;});}exports[_0x5a96('0x59')]=function(_0x375d49,_0x3d8a29,_0x53ed39,_0x412960,_0x4fdb85,_0x320d47){var _0x126661,_0x515306,_0x1ff69e,_0x189ddc;_0x320d47[_0x5a96('0x5a')]=intUtil[_0x5a96('0x5b')](_0x320d47[_0x5a96('0x5a')]);_0x320d47['remoteUri']=intUtil[_0x5a96('0x5b')](_0x320d47[_0x5a96('0x5c')]);if(_0x4fdb85&&_0x4fdb85['monitor_format']){logger[_0x5a96('0x1d')](_0x5a96('0x5d'),_0x5a96('0x5e'));_0x3d8a29[_0x5a96('0x5f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x320d47[_0x5a96('0x5a')],_0x3d8a29['uniqueid'],md5(_0x3d8a29[_0x5a96('0x60')]));}else{_0x3d8a29[_0x5a96('0x5f')]='';}return getConnection(_0x320d47)[_0x5a96('0x26')](function(_0x544dd5){_0x189ddc=_0x544dd5;return getUser(_0x320d47,_0x412960['email'],_0x189ddc);})['then'](function(_0x3956a0){_0x126661=_0x3956a0;return getEndUser(_0x320d47,_0x53ed39,_0x3d8a29[_0x5a96('0x61')],_0x3d8a29[_0x5a96('0x62')],_0x189ddc);})[_0x5a96('0x26')](function(_0x21aedf){_0x515306=_0x21aedf;return getTicket(_0x320d47,_0x126661,_0x515306,_0x53ed39,_0x3d8a29,_0x53ed39[_0x5a96('0x63')],_0x189ddc,'queue');})[_0x5a96('0x26')](function(_0x16ccca){_0x1ff69e=_0x16ccca;logger[_0x5a96('0x1d')](_0x5a96('0x64'),_0x1ff69e['id']);logger[_0x5a96('0x1d')](_0x5a96('0x65'),_0x1ff69e['id'],_0x412960[_0x5a96('0x50')],_0x320d47['type']);switch(_0x320d47[_0x5a96('0x3e')]){case _0x5a96('0x66'):emit(util[_0x5a96('0x45')](_0x5a96('0x67'),_0x412960[_0x5a96('0x50')]),_0x5a96('0x68'),{'recordId':_0x1ff69e['id']});break;case _0x5a96('0x69'):emit(util[_0x5a96('0x45')](_0x5a96('0x67'),_0x412960['name']),_0x5a96('0x6a'),{'uri':util[_0x5a96('0x45')]('%s/%s/e',_0x189ddc['instanceUrl'],_0x1ff69e['id'])});break;default:logger[_0x5a96('0x6b')](_0x5a96('0x6c'));}})['catch'](function(_0x3cc95b){logger[_0x5a96('0x6b')]('[QUEUE]',_0x3cc95b);});};exports[_0x5a96('0x6d')]=function(_0x2f6ce3,_0x3d2571,_0x32a856,_0x3a520f,_0x455a9d,_0x5d8a86,_0x35ffb4){var _0x418c72,_0x2f7ab5,_0x16fe8c,_0x3d7532;_0x5d8a86[_0x5a96('0x5a')]=intUtil[_0x5a96('0x5b')](_0x5d8a86['serverUrl']);_0x5d8a86['remoteUri']=intUtil[_0x5a96('0x5b')](_0x5d8a86[_0x5a96('0x5c')]);if(_0x35ffb4&&_0x35ffb4[_0x5a96('0x6e')]&&_0x35ffb4[_0x5a96('0x6e')]!==_0x5a96('0x6f')){logger['info'](_0x5a96('0x70'),_0x5a96('0x5e'));_0x3d2571[_0x5a96('0x5f')]=util[_0x5a96('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d8a86[_0x5a96('0x5a')],_0x3d2571[_0x5a96('0x60')],md5(_0x3d2571[_0x5a96('0x60')]));}return getConnection(_0x5d8a86)[_0x5a96('0x26')](function(_0x259000){_0x3d7532=_0x259000;return getUser(_0x5d8a86,_0x3a520f[_0x5a96('0x71')],_0x3d7532);})['then'](function(_0x315a85){_0x418c72=_0x315a85;return getEndUser(_0x5d8a86,_0x32a856,_0x3d2571[_0x5a96('0x72')],_0x3d2571[_0x5a96('0x73')],_0x3d7532);})[_0x5a96('0x26')](function(_0x566a3e){_0x2f7ab5=_0x566a3e;return getTicket(_0x5d8a86,_0x418c72,_0x2f7ab5,_0x32a856,_0x3d2571,_0x32a856[_0x5a96('0x63')],_0x3d7532,'outbound');})['then'](function(_0x18019f){_0x16fe8c=_0x18019f;logger[_0x5a96('0x1d')](_0x5a96('0x74'),_0x16fe8c['id']);logger['info'](_0x5a96('0x75'),_0x16fe8c['id'],_0x3a520f[_0x5a96('0x50')],_0x5d8a86[_0x5a96('0x3e')]);switch(_0x5d8a86[_0x5a96('0x3e')]){case'integrationTab':emit(util[_0x5a96('0x45')](_0x5a96('0x67'),_0x3a520f[_0x5a96('0x50')]),_0x5a96('0x68'),{'recordId':_0x16fe8c['id']});break;case _0x5a96('0x69'):emit(util[_0x5a96('0x45')](_0x5a96('0x67'),_0x3a520f['name']),'trigger:browser:url',{'uri':util[_0x5a96('0x45')]('%s/%s/e',_0x3d7532['instanceUrl'],_0x16fe8c['id'])});break;default:logger[_0x5a96('0x6b')](_0x5a96('0x70'),_0x5a96('0x76'));}})['catch'](function(_0x3b0bb7){logger['error'](_0x5a96('0x70'),_0x3b0bb7);});};exports['unmanaged']=function(_0x3b0962,_0x5c97a8,_0x234efe,_0xdde015,_0x2c4e70,_0x6d4fee){var _0x4ecebf,_0x387a1f,_0x3b425d,_0x1bc307;_0x6d4fee['serverUrl']=intUtil[_0x5a96('0x5b')](_0x6d4fee[_0x5a96('0x5a')]);_0x6d4fee[_0x5a96('0x5c')]=intUtil[_0x5a96('0x5b')](_0x6d4fee[_0x5a96('0x5c')]);if(_0x2c4e70&&_0x2c4e70[_0x5a96('0x77')]){logger[_0x5a96('0x1d')]('['+_0x5c97a8['lastevent'][_0x5a96('0x78')]()+']','Recording\x20is\x20enabled!');_0x5c97a8[_0x5a96('0x5f')]=util[_0x5a96('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6d4fee[_0x5a96('0x5a')],_0x5c97a8[_0x5a96('0x60')],md5(_0x5c97a8[_0x5a96('0x60')]));}else{_0x5c97a8['recordingURL']='';}return getConnection(_0x6d4fee)[_0x5a96('0x26')](function(_0x3f4d5e){_0x1bc307=_0x3f4d5e;if(!_['isNil'](_0xdde015)){return getUser(_0x6d4fee,_0xdde015['name'],_0x1bc307);}else{return getUser(_0x6d4fee,null,_0x1bc307);}})['then'](function(_0x50f9c2){_0x4ecebf=_0x50f9c2;return getEndUser(_0x6d4fee,_0x234efe,_0x5c97a8['calleridname'],_0x5c97a8['calleridnum'],_0x1bc307);})[_0x5a96('0x26')](function(_0x74de20){_0x387a1f=_0x74de20;return getTicket(_0x6d4fee,_0x4ecebf,_0x387a1f,_0x234efe,_0x5c97a8,_0x234efe[_0x5a96('0x63')],_0x1bc307);})['then'](function(_0x3268dd){_0x3b425d=_0x3268dd;logger[_0x5a96('0x1d')]('['+_0x5c97a8['lastevent'][_0x5a96('0x78')]()+_0x5a96('0x79'),_0x3b425d['id']);logger['info']('['+_0x5c97a8[_0x5a96('0x7a')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x6d4fee[_0x5a96('0x3e')]);})[_0x5a96('0x7b')](function(_0x3f58d4){logger[_0x5a96('0x6b')]('['+_0x5c97a8[_0x5a96('0x7a')][_0x5a96('0x78')]()+']',_0x3f58d4);});}; \ No newline at end of file +var _0x4656=['redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','WhatId','Case','ContactId','account','leadId','info','sobject','create','isNil','validateEmail','execute','then','length','find','resolve','Name','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.','cloneDeep','additionalSearchContact','$or','additionalSearchLead','merge','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','first','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.','LastName','','format','Caller\x20-\x20%s','No\x20Company','forEach','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','recordingURL','uniqueid','email','calleridname','calleridnum','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger'];(function(_0x46fc40,_0x12a7f9){var _0x110de0=function(_0x3f30de){while(--_0x3f30de){_0x46fc40['push'](_0x46fc40['shift']());}};_0x110de0(++_0x12a7f9);}(_0x4656,0xef));var _0x6465=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x4656[_0x3eb713];return _0x1d7128;};'use strict';var _=require(_0x6465('0x0'));var rp=require('request-promise');var moment=require(_0x6465('0x1'));var BPromise=require(_0x6465('0x2'));var md5=require('md5');var jsforce=require(_0x6465('0x3'));var util=require(_0x6465('0x4'));var Redis=require(_0x6465('0x5'));var intUtil=require(_0x6465('0x6'));var config=require(_0x6465('0x7'));var logger=require(_0x6465('0x8'))('salesforce');config[_0x6465('0x9')]=_[_0x6465('0xa')](config[_0x6465('0x9')],{'host':_0x6465('0xb'),'port':0x18eb});var io=require(_0x6465('0xc'))(new Redis(config[_0x6465('0x9')]));function emit(_0x298871,_0x176c9a,_0x3ee0f9){io['to'](_0x298871)[_0x6465('0xd')](_0x176c9a,_0x3ee0f9);}function getTicket(_0x26e994,_0xa38114,_0x1679cf,_0x4991a9,_0x508112,_0x4d2f17,_0x74a55d,_0x424afc){var _0x1c7bda=Object[_0x6465('0xe')]({},{'OwnerId':_0xa38114['id'],'Subject':intUtil['getString'](_0x4991a9[_0x6465('0xf')],_0x508112,'\x20'),'Description':intUtil[_0x6465('0x10')](_0x4991a9['Descriptions'],_0x508112,'\x0a')},getCustomFields(_0x4d2f17,_0x508112));if(_0x1679cf){if(_0x4991a9[_0x6465('0x11')]===_0x6465('0x12')){_0x1c7bda[_0x6465('0x13')]=moment[_0x6465('0x14')]();_0x1c7bda[_0x6465('0x15')]=![];_0x1c7bda[_0x6465('0x16')]=![];if(_0x1679cf['endUserType']===_0x6465('0x17')||_0x1679cf[_0x6465('0x18')]===_0x6465('0x19')){_0x1c7bda[_0x6465('0x1a')]=_0x1679cf['id'];}else if(_0x1679cf[_0x6465('0x18')]==='account'){_0x1c7bda[_0x6465('0x1b')]=_0x1679cf['id'];}}else if(_0x4991a9['ticketType']===_0x6465('0x1c')){if(_0x1679cf[_0x6465('0x18')]==='contact'){_0x1c7bda[_0x6465('0x1d')]=_0x1679cf['id'];}else if(_0x1679cf['endUserType']===_0x6465('0x1e')){_0x1c7bda['AccountId']=_0x1679cf['id'];}else if(_0x1679cf[_0x6465('0x18')]==='lead'&&_0x4991a9[_0x6465('0x1f')]){_0x1c7bda[_0x4991a9['leadId']]=_0x1679cf['id'];}else{logger[_0x6465('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x74a55d[_0x6465('0x21')](_0x4991a9[_0x6465('0x11')])[_0x6465('0x22')](_0x1c7bda);}function getUser(_0x38ef03,_0x899844,_0x8d2bd1){if(!_[_0x6465('0x23')](_0x899844)&&intUtil[_0x6465('0x24')](_0x899844)){var _0x19d3ec={'Email':_0x899844};var _0x101448={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x8d2bd1['sobject']('User')['find'](_0x19d3ec,_0x101448)[_0x6465('0x25')]()[_0x6465('0x26')](function(_0x6f9d72){if(_0x6f9d72[_0x6465('0x27')]){var _0x4a9fc5=_[_0x6465('0x28')](_0x6f9d72,function(_0x342a4b){return _0x342a4b['Email']===_0x899844;});if(_0x4a9fc5){logger[_0x6465('0x20')]('Agent\x20%s\x20found.',_0x899844);return BPromise[_0x6465('0x29')]({'id':_0x4a9fc5['Id'],'name':_0x4a9fc5[_0x6465('0x2a')]});}}else{logger[_0x6465('0x20')](_0x6465('0x2b'),_0x899844);return _0x8d2bd1[_0x6465('0x2c')]()['then'](function(_0x149dd6){return BPromise['resolve']({'id':_0x149dd6[_0x6465('0x2d')],'name':_0x149dd6[_0x6465('0x2e')]});});}});}else{logger[_0x6465('0x20')](_0x6465('0x2b'),_0x899844);return _0x8d2bd1[_0x6465('0x2c')]()[_0x6465('0x26')](function(_0x49e0ff){return BPromise['resolve']({'id':_0x49e0ff[_0x6465('0x2d')],'name':_0x49e0ff[_0x6465('0x2e')]});});}}function getEndUser(_0x5396b3,_0x4a141d,_0x110206,_0x2ba1e5,_0x5048fd){var _0x264acd={'$or':{'Phone':_0x2ba1e5}};var _0x14339c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6465('0x29')]()[_0x6465('0x26')](function(){logger['info'](_0x6465('0x2f'),_0x2ba1e5,_0x4a141d['moduleSearch']);switch(_0x4a141d['moduleSearch']){case'contact_lead':var _0x3d9e61=_[_0x6465('0x30')](_0x264acd);if(_0x4a141d[_0x6465('0x31')]){var _0x328462={};_0x328462[_0x4a141d[_0x6465('0x31')]]=_0x2ba1e5;_['merge'](_0x3d9e61[_0x6465('0x32')],_0x328462);}return _0x5048fd['sobject']('Contact')['find'](_0x3d9e61,_0x14339c)[_0x6465('0x25')]()[_0x6465('0x26')](function(_0x31a342){if(_0x31a342&&_0x31a342[_0x6465('0x27')]){return _0x31a342;}else{var _0x5e166a=_['cloneDeep'](_0x264acd);if(_0x4a141d[_0x6465('0x33')]){var _0x3b57cd={};_0x3b57cd[_0x4a141d[_0x6465('0x33')]]=_0x2ba1e5;_[_0x6465('0x34')](_0x5e166a[_0x6465('0x32')],_0x3b57cd);}return _0x5048fd[_0x6465('0x21')]('Lead')[_0x6465('0x28')](_0x5e166a,_0x14339c);}});case _0x6465('0x35'):var _0x10367e=_[_0x6465('0x30')](_0x264acd);if(_0x4a141d[_0x6465('0x36')]){var _0x328462={};_0x328462[_0x4a141d[_0x6465('0x36')]]=_0x2ba1e5;_[_0x6465('0x34')](_0x10367e['$or'],_0x328462);}return _0x5048fd[_0x6465('0x21')](_0x6465('0x37'))['find'](_0x10367e,_0x14339c)[_0x6465('0x25')]()[_0x6465('0x26')](function(_0x5b926b){if(_0x5b926b&&_0x5b926b[_0x6465('0x27')]){return _0x5b926b;}else{var _0x3f7dfa=_[_0x6465('0x30')](_0x264acd);if(_0x4a141d['additionalSearchContact']){var _0x47316d={};_0x47316d[_0x4a141d[_0x6465('0x31')]]=_0x2ba1e5;_[_0x6465('0x34')](_0x3f7dfa[_0x6465('0x32')],_0x47316d);}return _0x5048fd[_0x6465('0x21')](_0x6465('0x38'))[_0x6465('0x28')](_0x3f7dfa,_0x14339c)[_0x6465('0x26')](function(_0x5bb991){if(_0x5bb991&&_0x5bb991[_0x6465('0x27')]){return _0x5bb991;}else{var _0x30d18d=_[_0x6465('0x30')](_0x264acd);if(_0x4a141d[_0x6465('0x33')]){var _0x1f1f40={};_0x1f1f40[_0x4a141d[_0x6465('0x33')]]=_0x2ba1e5;_['merge'](_0x30d18d[_0x6465('0x32')],_0x1f1f40);}return _0x5048fd[_0x6465('0x21')](_0x6465('0x39'))[_0x6465('0x28')](_0x30d18d,_0x14339c);}});}});case _0x6465('0x17'):var _0x3d9e61=_['cloneDeep'](_0x264acd);if(_0x4a141d[_0x6465('0x31')]){var _0x328462={};_0x328462[_0x4a141d[_0x6465('0x31')]]=_0x2ba1e5;_[_0x6465('0x34')](_0x3d9e61[_0x6465('0x32')],_0x328462);}return _0x5048fd['sobject']('Contact')[_0x6465('0x28')](_0x3d9e61,_0x14339c)[_0x6465('0x25')]();case _0x6465('0x19'):var _0x4110a1=_[_0x6465('0x30')](_0x264acd);if(_0x4a141d[_0x6465('0x33')]){var _0x328462={};_0x328462[_0x4a141d['additionalSearchLead']]=_0x2ba1e5;_[_0x6465('0x34')](_0x4110a1[_0x6465('0x32')],_0x328462);}return _0x5048fd['sobject'](_0x6465('0x39'))[_0x6465('0x28')](_0x4110a1,_0x14339c);case _0x6465('0x1e'):var _0x10367e=_['cloneDeep'](_0x264acd);if(_0x4a141d[_0x6465('0x36')]){var _0x328462={};_0x328462[_0x4a141d[_0x6465('0x36')]]=_0x2ba1e5;_[_0x6465('0x34')](_0x10367e['$or'],_0x328462);}return _0x5048fd[_0x6465('0x21')](_0x6465('0x37'))[_0x6465('0x28')](_0x10367e,_0x14339c);default:return null;}})[_0x6465('0x26')](function(_0x5503a2){if(_0x5503a2&&_0x5503a2['length']){var _0x5464dc=_[_0x6465('0x3a')](_0x5503a2);if(_0x5464dc){return BPromise[_0x6465('0x29')]({'id':_0x5464dc['Id'],'name':_0x5464dc['Name'],'phone':_0x5464dc[_0x6465('0x3b')],'endUserType':_0x5464dc[_0x6465('0x3c')]['type'][_0x6465('0x3d')]()});}}})[_0x6465('0x26')](function(_0x5b08d8){if(_0x5b08d8){logger[_0x6465('0x20')](_0x6465('0x3e'),_0x5b08d8[_0x6465('0x18')],_0x2ba1e5);return BPromise['resolve'](_0x5b08d8);}else{logger[_0x6465('0x20')](_0x6465('0x3f'),_0x2ba1e5);var _0x1c3098={'Phone':_0x2ba1e5};if(_0x4a141d[_0x6465('0x40')]){if(_0x4a141d[_0x6465('0x40')]===_0x6465('0x17')){logger['info'](_0x6465('0x41'),_0x2ba1e5,_0x4a141d[_0x6465('0x40')]);_0x1c3098[_0x6465('0x42')]=_0x110206!==_0x6465('0x43')?_0x110206:util[_0x6465('0x44')](_0x6465('0x45'),_0x2ba1e5);}else if(_0x4a141d['moduleCreate']===_0x6465('0x19')){logger[_0x6465('0x20')](_0x6465('0x41'),_0x2ba1e5,_0x4a141d[_0x6465('0x40')]);_0x1c3098[_0x6465('0x42')]=_0x110206!==_0x6465('0x43')?_0x110206:util[_0x6465('0x44')]('Caller\x20-\x20%s',_0x2ba1e5);_0x1c3098['Company']=_0x6465('0x46');}else if(_0x4a141d['moduleCreate']===_0x6465('0x1e')){logger[_0x6465('0x20')](_0x6465('0x41'),_0x2ba1e5,_0x4a141d[_0x6465('0x40')]);_0x1c3098[_0x6465('0x2a')]=_0x110206!==_0x6465('0x43')?_0x110206:util[_0x6465('0x44')](_0x6465('0x45'),_0x2ba1e5);}else{return null;}}return _0x5048fd[_0x6465('0x21')](_['upperFirst'](_0x4a141d['moduleCreate']))[_0x6465('0x22')](_0x1c3098)[_0x6465('0x26')](function(_0x1256bd){return BPromise[_0x6465('0x29')]({'id':_0x1256bd['id'],'endUserType':_0x4a141d[_0x6465('0x40')]});});}});}function getCustomFields(_0xa67350,_0x3e52a8){var _0x2d405a={};if(_0xa67350['length']>0x0){_[_0x6465('0x47')](_0xa67350,function(_0x2c1c11){if(_['includes']([_0x6465('0x48'),_0x6465('0x49')],_0x2c1c11[_0x6465('0x4a')])&&_0x2c1c11[_0x6465('0x4b')]){_0x2d405a[_0x2c1c11[_0x6465('0x4b')]]=_0x2c1c11[_0x6465('0x4c')][_0x6465('0x4d')]();}else if(_0x2c1c11['type']===_0x6465('0x4e')&&_0x2c1c11['variableName']&&_0x2c1c11[_0x6465('0x4b')]){_0x3e52a8[_0x2c1c11[_0x6465('0x4f')]]&&(_0x2d405a[_0x2c1c11[_0x6465('0x4b')]]=_0x3e52a8[_0x2c1c11[_0x6465('0x4f')]][_0x6465('0x4d')]());}else if(_0x2c1c11[_0x6465('0x4a')]==='customVariable'&&_0x2c1c11[_0x6465('0x50')]&&_0x2c1c11[_0x6465('0x50')][_0x6465('0x51')]&&_0x2c1c11['idField']){_0x3e52a8[_0x2c1c11[_0x6465('0x50')][_0x6465('0x51')][_0x6465('0x3d')]()]&&(_0x2d405a[_0x2c1c11[_0x6465('0x4b')]]=_0x3e52a8[_0x2c1c11[_0x6465('0x50')][_0x6465('0x51')]['toLowerCase']()][_0x6465('0x4d')]());}});}return _0x2d405a;}function getConnection(_0x4091ef){var _0x4b2b2f=_0x4091ef[_0x6465('0x52')]['concat'](_0x4091ef[_0x6465('0x53')]);var _0x21c36a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4091ef[_0x6465('0x54')]||_0x6465('0x55'),'clientId':_0x4091ef[_0x6465('0x56')],'clientSecret':_0x4091ef[_0x6465('0x57')]}});return _0x21c36a[_0x6465('0x58')](_0x4091ef[_0x6465('0x59')],_0x4b2b2f)[_0x6465('0x26')](function(){logger[_0x6465('0x20')](_0x6465('0x5a'));return _0x21c36a;});}exports[_0x6465('0x5b')]=function(_0x5bf4b2,_0x442db9,_0x3d89db,_0x44733e,_0x50cc88,_0x5006a8){var _0x1e8d56,_0x33e889,_0xa3e62c,_0x89b342;_0x5006a8[_0x6465('0x5c')]=intUtil[_0x6465('0x5d')](_0x5006a8[_0x6465('0x5c')]);_0x5006a8[_0x6465('0x54')]=intUtil[_0x6465('0x5d')](_0x5006a8[_0x6465('0x54')]);if(_0x50cc88&&_0x50cc88[_0x6465('0x5e')]){logger[_0x6465('0x20')]('[QUEUE]','Recording\x20is\x20enabled!');_0x442db9[_0x6465('0x5f')]=util[_0x6465('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5006a8[_0x6465('0x5c')],_0x442db9[_0x6465('0x60')],md5(_0x442db9[_0x6465('0x60')]));}else{_0x442db9[_0x6465('0x5f')]='';}return getConnection(_0x5006a8)['then'](function(_0x150043){_0x89b342=_0x150043;return getUser(_0x5006a8,_0x44733e[_0x6465('0x61')],_0x89b342);})[_0x6465('0x26')](function(_0x44d971){_0x1e8d56=_0x44d971;return getEndUser(_0x5006a8,_0x3d89db,_0x442db9[_0x6465('0x62')],_0x442db9[_0x6465('0x63')],_0x89b342);})['then'](function(_0x14a129){_0x33e889=_0x14a129;return getTicket(_0x5006a8,_0x1e8d56,_0x33e889,_0x3d89db,_0x442db9,_0x3d89db['Fields'],_0x89b342,_0x6465('0x5b'));})[_0x6465('0x26')](function(_0x58c7ef){_0xa3e62c=_0x58c7ef;logger[_0x6465('0x20')]('[QUEUE]\x20Ticket\x20%s\x20created',_0xa3e62c['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xa3e62c['id'],_0x44733e['name'],_0x5006a8[_0x6465('0x4a')]);switch(_0x5006a8[_0x6465('0x4a')]){case _0x6465('0x64'):emit(util[_0x6465('0x44')](_0x6465('0x65'),_0x44733e[_0x6465('0x51')]),_0x6465('0x66'),{'recordId':_0xa3e62c['id']});break;case _0x6465('0x67'):emit(util['format']('user:%s',_0x44733e[_0x6465('0x51')]),_0x6465('0x68'),{'uri':util[_0x6465('0x44')](_0x6465('0x69'),_0x89b342[_0x6465('0x6a')],_0xa3e62c['id'])});break;default:logger[_0x6465('0x6b')](_0x6465('0x6c'));}})[_0x6465('0x6d')](function(_0x21eab7){logger[_0x6465('0x6b')]('[QUEUE]',_0x21eab7);});};exports[_0x6465('0x6e')]=function(_0x2275a5,_0x611994,_0x3a26e3,_0x2cafbe,_0xe31ed3,_0x1ada6f,_0x463b49){var _0x3bdb3c,_0x2c0168,_0x3ed845,_0x6a48ed;_0x1ada6f[_0x6465('0x5c')]=intUtil[_0x6465('0x5d')](_0x1ada6f[_0x6465('0x5c')]);_0x1ada6f[_0x6465('0x54')]=intUtil['stripTrailingSlash'](_0x1ada6f['remoteUri']);if(_0x463b49&&_0x463b49[_0x6465('0x6f')]&&_0x463b49[_0x6465('0x6f')]!==_0x6465('0x70')){logger[_0x6465('0x20')](_0x6465('0x71'),'Recording\x20is\x20enabled!');_0x611994[_0x6465('0x5f')]=util[_0x6465('0x44')](_0x6465('0x72'),_0x1ada6f['serverUrl'],_0x611994['uniqueid'],md5(_0x611994[_0x6465('0x60')]));}return getConnection(_0x1ada6f)['then'](function(_0x25e597){_0x6a48ed=_0x25e597;return getUser(_0x1ada6f,_0x2cafbe[_0x6465('0x61')],_0x6a48ed);})[_0x6465('0x26')](function(_0x4b0561){_0x3bdb3c=_0x4b0561;return getEndUser(_0x1ada6f,_0x3a26e3,_0x611994[_0x6465('0x73')],_0x611994['destcalleridnum'],_0x6a48ed);})[_0x6465('0x26')](function(_0x2125cb){_0x2c0168=_0x2125cb;return getTicket(_0x1ada6f,_0x3bdb3c,_0x2c0168,_0x3a26e3,_0x611994,_0x3a26e3['Fields'],_0x6a48ed,_0x6465('0x6e'));})['then'](function(_0x2a1410){_0x3ed845=_0x2a1410;logger['info'](_0x6465('0x74'),_0x3ed845['id']);logger[_0x6465('0x20')](_0x6465('0x75'),_0x3ed845['id'],_0x2cafbe[_0x6465('0x51')],_0x1ada6f[_0x6465('0x4a')]);switch(_0x1ada6f['type']){case _0x6465('0x64'):emit(util[_0x6465('0x44')](_0x6465('0x65'),_0x2cafbe['name']),'trigger:salesforce:display',{'recordId':_0x3ed845['id']});break;case _0x6465('0x67'):emit(util[_0x6465('0x44')](_0x6465('0x65'),_0x2cafbe[_0x6465('0x51')]),_0x6465('0x68'),{'uri':util[_0x6465('0x44')](_0x6465('0x69'),_0x6a48ed['instanceUrl'],_0x3ed845['id'])});break;default:logger[_0x6465('0x6b')](_0x6465('0x71'),_0x6465('0x76'));}})[_0x6465('0x6d')](function(_0x6f6e0c){logger[_0x6465('0x6b')]('[OUTBOUND]',_0x6f6e0c);});};exports[_0x6465('0x77')]=function(_0x53ec41,_0x2e9762,_0x42e792,_0x5a313d,_0x291124,_0x28bd54){var _0xf1dad8,_0x3a1ac1,_0x3d5b6c,_0x43a346;_0x28bd54[_0x6465('0x5c')]=intUtil['stripTrailingSlash'](_0x28bd54[_0x6465('0x5c')]);_0x28bd54[_0x6465('0x54')]=intUtil[_0x6465('0x5d')](_0x28bd54[_0x6465('0x54')]);if(_0x291124&&_0x291124[_0x6465('0x5e')]){logger[_0x6465('0x20')]('['+_0x2e9762[_0x6465('0x78')][_0x6465('0x79')]()+']',_0x6465('0x7a'));_0x2e9762['recordingURL']=util[_0x6465('0x44')](_0x6465('0x72'),_0x28bd54[_0x6465('0x5c')],_0x2e9762[_0x6465('0x60')],md5(_0x2e9762['uniqueid']));}else{_0x2e9762[_0x6465('0x5f')]='';}return getConnection(_0x28bd54)[_0x6465('0x26')](function(_0x13ae46){_0x43a346=_0x13ae46;if(!_['isNil'](_0x5a313d)){return getUser(_0x28bd54,_0x5a313d[_0x6465('0x51')],_0x43a346);}else{return getUser(_0x28bd54,null,_0x43a346);}})[_0x6465('0x26')](function(_0x3ffee6){_0xf1dad8=_0x3ffee6;return getEndUser(_0x28bd54,_0x42e792,_0x2e9762[_0x6465('0x62')],_0x2e9762[_0x6465('0x63')],_0x43a346);})['then'](function(_0x27f80c){_0x3a1ac1=_0x27f80c;return getTicket(_0x28bd54,_0xf1dad8,_0x3a1ac1,_0x42e792,_0x2e9762,_0x42e792['Fields'],_0x43a346);})[_0x6465('0x26')](function(_0xdf9199){_0x3d5b6c=_0xdf9199;logger[_0x6465('0x20')]('['+_0x2e9762[_0x6465('0x78')][_0x6465('0x79')]()+_0x6465('0x7b'),_0x3d5b6c['id']);logger['info']('['+_0x2e9762[_0x6465('0x78')][_0x6465('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x28bd54[_0x6465('0x4a')]);})[_0x6465('0x6d')](function(_0x2c721d){logger['error']('['+_0x2e9762[_0x6465('0x78')][_0x6465('0x79')]()+']',_0x2c721d);});}; \ 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 a3068b1..f961211 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 _0x5781=['nameField','content','toString','customField','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','isNil','email','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','format','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','string','picklist','type'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5781,0x10e));var _0x1578=function(_0x1f990b,_0x494864){_0x1f990b=_0x1f990b-0x0;var _0x5b480b=_0x5781[_0x1f990b];return _0x5b480b;};'use strict';var _=require('lodash');var Promise=require(_0x1578('0x0'));var rp=require('request-promise');var util=require(_0x1578('0x1'));var md5=require(_0x1578('0x2'));var Redis=require(_0x1578('0x3'));var intUtil=require(_0x1578('0x4'));var config=require('../../../../config/environment');var logger=require(_0x1578('0x5'))('servicenow');config[_0x1578('0x6')]=_[_0x1578('0x7')](config[_0x1578('0x6')],{'host':_0x1578('0x8'),'port':0x18eb});var io=require(_0x1578('0x9'))(new Redis(config[_0x1578('0x6')]));function getAdminUser(_0x15eb35,_0x2fd9ae,_0x3ad6f1,_0x545c3d,_0x1e688f,_0x44616e){return new Promise(function(_0x167a98,_0x25864){var _0x7bef87={'method':_0x1578('0xa'),'uri':_0x545c3d+_0x1578('0xb')+'&'+_0x1e688f+'&'+_0x44616e,'auth':_0x2fd9ae,'json':!![]};return rp(_0x7bef87)[_0x1578('0xc')](function(_0x4cf411){if(_0x4cf411[_0x1578('0xd')][_0x1578('0xe')]>0x0){_0x3ad6f1[_0x1578('0xf')]=_0x4cf411[_0x1578('0xd')][0x0][_0x1578('0x10')];}logger['info']('['+[_0x15eb35[_0x1578('0x11')]()]+_0x1578('0x12'),_0x3ad6f1);_0x167a98(_0x3ad6f1);})[_0x1578('0x13')](function(_0x4df7c3){logger[_0x1578('0x14')]('['+[_0x15eb35[_0x1578('0x11')]()]+']',_0x4df7c3[_0x1578('0x15')]);_0x25864(_0x4df7c3[_0x1578('0x15')]);});});}function getUser(_0x264dab,_0x39601b,_0x9b849,_0x2a02fc,_0x25d02d){return function(_0x2beddd){logger[_0x1578('0x16')]('['+[_0x264dab[_0x1578('0x11')]()]+_0x1578('0x17'),_0x2beddd);return new Promise(function(_0x5632e1,_0x3a5f41){if(intUtil[_0x1578('0x18')](_0x2beddd[_0x1578('0x19')])){var _0x56a76b={'method':_0x1578('0xa'),'uri':_0x9b849+_0x1578('0x1a')+_0x2beddd[_0x1578('0x19')]+'&'+_0x2a02fc+'&'+_0x25d02d,'auth':_0x39601b,'json':!![]};logger['info']('['+[_0x264dab['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x56a76b);return rp(_0x56a76b)[_0x1578('0xc')](function(_0x393fe6){logger[_0x1578('0x16')]('['+[_0x264dab['toUpperCase']()]+_0x1578('0x1b'),_0x393fe6);if(_0x393fe6[_0x1578('0xd')][_0x1578('0xe')]>0x0&&String(_0x393fe6[_0x1578('0xd')][0x0][_0x1578('0x1c')])==='true'){_0x2beddd[_0x1578('0x1d')]=_0x393fe6[_0x1578('0xd')][0x0][_0x1578('0x10')];}else{_0x2beddd[_0x1578('0x1d')]=_0x2beddd['adminId'];_0x2beddd['userEmail']=_0x2beddd[_0x1578('0x1e')];}logger['info']('['+[_0x264dab['toUpperCase']()]+_0x1578('0x1f'),_0x2beddd);_0x5632e1(_0x2beddd);})['catch'](function(_0x3b18dc){logger[_0x1578('0x14')]('['+[_0x264dab[_0x1578('0x11')]()]+']',_0x3b18dc[_0x1578('0x15')]);_0x3a5f41(_0x3b18dc[_0x1578('0x15')]);});}else{logger[_0x1578('0x16')]('['+[_0x264dab[_0x1578('0x11')]()]+']\x20using\x20admin\x20profile');_0x2beddd[_0x1578('0x1d')]=_0x2beddd[_0x1578('0xf')];_0x2beddd[_0x1578('0x19')]=_0x2beddd[_0x1578('0x1e')];_0x5632e1(_0x2beddd);}});};}function createEndUser(_0x307b49,_0x4fe82a,_0x3c8fea,_0x110828,_0x592c25){logger[_0x1578('0x16')]('['+[_0x307b49[_0x1578('0x11')]()]+_0x1578('0x20'),_0x3c8fea);return new Promise(function(_0x5944a6,_0x2c4406){var _0x388ecf={'method':_0x1578('0x21'),'uri':_0x110828+_0x1578('0x22')+_0x592c25,'body':{'user_name':_0x3c8fea[_0x1578('0x23')],'roles':_0x1578('0x24'),'first_name':_0x3c8fea['endUserNumber'],'active':'true','date_format':'System','phone':_0x3c8fea[_0x1578('0x23')]},'auth':_0x4fe82a,'json':!![]};return rp(_0x388ecf)[_0x1578('0xc')](function(_0x3622f8){logger[_0x1578('0x16')]('['+[_0x307b49['toUpperCase']()]+_0x1578('0x25'),_0x3622f8['result']);_0x3c8fea[_0x1578('0x26')]=_0x3622f8[_0x1578('0xd')][_0x1578('0x10')];_0x5944a6(_0x3c8fea);})['catch'](function(_0x29c19f){logger[_0x1578('0x14')]('['+[_0x307b49[_0x1578('0x11')]()]+']',_0x29c19f['message']);_0x2c4406(_0x29c19f[_0x1578('0x15')]);});});}function getEndUser(_0x20429e,_0x404e0c,_0x4c648d,_0x2fc939,_0x4ef2b6){return function(_0x128af2){logger[_0x1578('0x16')]('['+[_0x20429e['toUpperCase']()]+_0x1578('0x27'),_0x128af2);return new Promise(function(_0x6d8f28,_0x3ab62c){var _0x3b5344={'method':'GET','uri':_0x4c648d+_0x1578('0x28')+_0x128af2[_0x1578('0x23')]+'&'+_0x2fc939+'&'+_0x4ef2b6,'auth':_0x404e0c,'json':!![]};return rp(_0x3b5344)[_0x1578('0xc')](function(_0x214135){if(_0x214135['result'][_0x1578('0xe')]>0x0){_0x128af2[_0x1578('0x26')]=_0x214135[_0x1578('0xd')][0x0][_0x1578('0x10')];logger[_0x1578('0x16')]('['+[_0x20429e[_0x1578('0x11')]()]+'],\x20getEndUser\x20crm',_0x128af2);_0x6d8f28(_0x128af2);}else{return createEndUser(_0x20429e,_0x404e0c,_0x128af2,_0x4c648d,_0x2fc939)[_0x1578('0xc')](function(_0x3641f4){logger[_0x1578('0x16')]('['+[_0x20429e[_0x1578('0x11')]()]+'],\x20createEndUser\x20crm',_0x3641f4);_0x6d8f28(_0x3641f4);});}})['catch'](function(_0x41f9f0){logger[_0x1578('0x14')]('['+[_0x20429e['toUpperCase']()]+']',_0x41f9f0[_0x1578('0x15')]);_0x3ab62c(_0x41f9f0[_0x1578('0x15')]);});});};}function getCustomFields(_0x92c540,_0x254e35){var _0x34bcb4={};if(_0x92c540['length']>0x0){_[_0x1578('0x29')](_0x92c540,function(_0x2d0dbe){if(_['includes']([_0x1578('0x2a'),_0x1578('0x2b')],_0x2d0dbe[_0x1578('0x2c')])&&_0x2d0dbe[_0x1578('0x2d')]&&!_0x2d0dbe['customField']){_0x34bcb4[_0x2d0dbe['nameField']['toLowerCase']()]=_0x2d0dbe[_0x1578('0x2e')][_0x1578('0x2f')]();}else if(_['includes']([_0x1578('0x2a'),_0x1578('0x2b')],_0x2d0dbe['type'])&&_0x2d0dbe['idField']&&_0x2d0dbe[_0x1578('0x30')]){_0x34bcb4[_0x2d0dbe[_0x1578('0x31')][_0x1578('0x32')]()]=_0x2d0dbe[_0x1578('0x2e')][_0x1578('0x2f')]();}else if(_0x2d0dbe[_0x1578('0x2c')]===_0x1578('0x33')&&_0x2d0dbe[_0x1578('0x34')]&&_0x2d0dbe[_0x1578('0x31')]&&_0x2d0dbe[_0x1578('0x30')]){_0x34bcb4[_0x2d0dbe[_0x1578('0x31')][_0x1578('0x32')]()]=_0x254e35[_0x2d0dbe[_0x1578('0x34')]][_0x1578('0x2f')]();}else if(_0x2d0dbe['type']===_0x1578('0x35')&&_0x2d0dbe['Variable']&&_0x2d0dbe[_0x1578('0x36')][_0x1578('0x37')]&&_0x2d0dbe['idField']&&_0x2d0dbe[_0x1578('0x30')]){_0x34bcb4[_0x2d0dbe[_0x1578('0x31')][_0x1578('0x32')]()]=_0x254e35[_0x2d0dbe[_0x1578('0x36')][_0x1578('0x37')]['toLowerCase']()]['toString']();}});}return _0x34bcb4;}function getTicket(_0x414b71,_0x2c98f8,_0x2ca450,_0x1aa378,_0x29eded,_0x20efd5){return function(_0x18de32){logger[_0x1578('0x16')]('['+[_0x414b71[_0x1578('0x11')]()]+_0x1578('0x38'),_0x18de32);return new Promise(function(_0x2b4b8f,_0x1cf75d){var _0xce1b13=_0x414b71[_0x1578('0x32')]()===_0x1578('0x39')?_0x18de32[_0x1578('0x1d')]:_0x18de32[_0x1578('0x26')];var _0x1fdb7e={'method':_0x1578('0x21'),'uri':_0x2ca450+_0x1578('0x3a')+'?'+_0x20efd5,'body':Object[_0x1578('0x3b')]({},{'active':_0x1578('0x3c'),'caller_id':_0xce1b13,'assigned_to':_0x18de32['userId'],'short_description':intUtil[_0x1578('0x3d')](_0x1aa378[_0x1578('0x3e')],_0x29eded,'\x20'),'description':intUtil['getString'](_0x1aa378[_0x1578('0x3f')],_0x29eded,'\x0a')},getCustomFields(_0x1aa378[_0x1578('0x40')],_0x29eded)),'auth':_0x2c98f8,'json':!![]};return rp(_0x1fdb7e)[_0x1578('0xc')](function(_0x28ca42){logger[_0x1578('0x16')]('['+[_0x414b71[_0x1578('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x28ca42[_0x1578('0xd')]);_0x18de32[_0x1578('0x41')]=_0x28ca42[_0x1578('0xd')][_0x1578('0x10')];_0x18de32[_0x1578('0x42')]=_0x28ca42['result'][_0x1578('0x43')];logger[_0x1578('0x16')]('['+[_0x414b71[_0x1578('0x11')]()]+_0x1578('0x44'),_0x18de32);_0x2b4b8f(_0x18de32);})[_0x1578('0x13')](function(_0x7b23c5){logger[_0x1578('0x14')]('['+[_0x414b71['toUpperCase']()]+']',_0x7b23c5[_0x1578('0x15')]);_0x1cf75d(_0x7b23c5[_0x1578('0x15')]);});});};}function createRemoteTag(_0x58e37a,_0x7ee0e1,_0x2bbb42,_0x2a7ba2){return new Promise(function(_0xbc6fc2,_0x2a52c5){var _0x5b24d2={'method':_0x1578('0x21'),'uri':_0x2bbb42+_0x1578('0x45')+'?'+_0x2a7ba2,'body':{'short_description':_0x58e37a,'global':!![],'active':!![],'name':_0x58e37a},'auth':_0x7ee0e1,'json':!![]};return rp(_0x5b24d2)['then'](function(_0x7311e6){var _0x3a8426=_0x7311e6['result'][_0x1578('0x10')];_0xbc6fc2(_0x3a8426);});});}function getRemoteTag(_0x315b03,_0x1f136f,_0x4ffbca,_0x58ae21,_0x264e27){return new Promise(function(_0x3ed9b3,_0x2d2535){var _0x28aac4={'method':_0x1578('0xa'),'uri':_0x4ffbca+_0x1578('0x45')+_0x1578('0x46')+_0x315b03+'&'+_0x58ae21,'auth':_0x1f136f,'json':!![]};return rp(_0x28aac4)[_0x1578('0xc')](function(_0x4f7342){if(_0x4f7342['result'][_0x1578('0xe')]>0x0){var _0x43f967=_0x4f7342[_0x1578('0xd')][0x0][_0x1578('0x10')];_0x3ed9b3(_0x43f967);}else{return createRemoteTag(_0x315b03,_0x1f136f,_0x4ffbca,_0x58ae21)[_0x1578('0xc')](function(_0x2f0c1e){_0x3ed9b3(_0x2f0c1e);});}});});}function assignTagToIncident(_0x74cfa2,_0x1c9fdc,_0x395a49,_0x3bc0ae,_0x3da944){return new Promise(function(_0x3a712e,_0x292711){var _0x4f91e2={'method':_0x1578('0x21'),'uri':_0x395a49+'label_entry'+'?'+_0x3da944,'body':{'label':_0x74cfa2,'table':_0x1578('0x3a'),'id_type':'Incident','table_key':_0x3bc0ae[_0x1578('0x41')],'title':_0x1578('0x47')+_0x3bc0ae['ticketNumber'],'id_display':_0x3bc0ae['ticketNumber']},'auth':_0x1c9fdc,'json':!![]};return rp(_0x4f91e2)[_0x1578('0xc')](function(_0x175037){_0x3a712e();})[_0x1578('0x13')](function(){_0x3a712e();});});}function manageTags(_0x32fc6e,_0x41e611,_0x30fdd7,_0x53980a,_0x5c3a43,_0x103071,_0x33ef3c){return new Promise(function(_0x3d6121,_0x1e1fc6){var _0x3dbeee=[];_0x41e611['forEach'](function(_0x50f219){_0x3dbeee[_0x1578('0x48')](getRemoteTag(_0x50f219,_0x30fdd7,_0x53980a,_0x103071,_0x33ef3c));});return Promise['all'](_0x3dbeee)[_0x1578('0xc')](function(_0x4fb4cd){if(_0x4fb4cd['length']){logger[_0x1578('0x16')]('['+[_0x32fc6e[_0x1578('0x11')]()]+_0x1578('0x49'),_0x4fb4cd);var _0x16f31d=[];_0x4fb4cd[_0x1578('0x29')](function(_0x19081a){_0x16f31d[_0x1578('0x48')](assignTagToIncident(_0x19081a,_0x30fdd7,_0x53980a,_0x5c3a43,_0x103071));});return Promise['all'](_0x16f31d)[_0x1578('0xc')](function(){_0x3d6121();})[_0x1578('0x13')](function(){_0x3d6121();});}else{_0x3d6121();}});});}function getTags(_0x5d8334,_0x298bd5,_0x3bc518,_0x158e09,_0x565016,_0x1c32ca){return function(_0x4b2555){return new Promise(function(_0x782e95,_0xa6cbb1){var _0x216da7=[];var _0x581fae=_0x158e09['Tags'];if(_0x581fae&&_0x581fae[_0x1578('0xe')]>0x0){_0x216da7=_[_0x1578('0x4a')](_0x581fae,_0x1578('0x37'));}if(_0x216da7[_0x1578('0xe')]>0x0){return manageTags(_0x5d8334,_0x216da7,_0x298bd5,_0x3bc518,_0x4b2555,_0x565016,_0x1c32ca)[_0x1578('0xc')](function(){_0x782e95(_0x4b2555);});}else{_0x782e95(_0x4b2555);}});};}function emit(_0x52d905,_0x475a28,_0x53ea9e){var _0x565b63=_0x1578('0x4b')+_0x1578('0x4c')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x1578('0x4d');var _0x39af7b={'uri':_0x52d905+_0x1578('0x4e')+_0x53ea9e+_0x565b63};io['to'](util['format'](_0x1578('0x4f'),_0x475a28))['emit']('trigger:browser:url',_0x39af7b);}exports['cs']=function(_0xf4604,_0x9cb83d,_0x5c7bc5,_0x378067,_0x561192,_0x1cd3b1,_0x3ff0d8,_0x25a757){var _0x247aaf={};var _0x258502={'user':_0x1cd3b1[_0x1578('0x50')],'pass':_0x1cd3b1['password']};var _0x19caef=_0x1578('0x51');var _0x26a1c5=_0x1578('0x52');_0x1cd3b1[_0x1578('0x53')]=intUtil['stripTrailingSlash'](_0x1cd3b1[_0x1578('0x53')]);_0x1cd3b1['serverUrl']=intUtil[_0x1578('0x54')](_0x1cd3b1['serverUrl']);var _0x4814b9=util['format']('%s/api/now/table/',_0x1cd3b1[_0x1578('0x53')]);_0x247aaf['userEmail']=!_[_0x1578('0x55')](_0x378067)?_0x378067[_0x1578('0x56')]:null;_0x247aaf[_0x1578('0x1e')]=_0x1cd3b1[_0x1578('0x56')];_0x247aaf['endUserNumber']=_0x25a757[_0x1578('0x32')]()===_0x1578('0x39')?_0x9cb83d['destcalleridnum']:_0x9cb83d[_0x1578('0x57')];_0x247aaf[_0x1578('0x58')]=_0x25a757==='queue'||_0x25a757==='unmanaged'?_0x1578('0x59'):'outbound';var _0x2ffa45=util['format'](_0x1578('0x5a'),_0x1cd3b1[_0x1578('0x5b')],_0x9cb83d[_0x1578('0x5c')],md5(_0x9cb83d[_0x1578('0x5c')]));if(_0x561192&&_0x561192[_0x1578('0x5d')]){logger['info'](_0x1578('0x5e'),'Recording\x20is\x20enabled!');_0x9cb83d[_0x1578('0x5f')]=_0x2ffa45;}else if(_0x3ff0d8&&_0x3ff0d8[_0x1578('0x60')]&&_0x3ff0d8['recordingFormat']!==_0x1578('0x61')){logger[_0x1578('0x16')](_0x1578('0x62'),_0x1578('0x63'));_0x9cb83d[_0x1578('0x5f')]=_0x2ffa45;}else{_0x9cb83d['recordingURL']='';}return getAdminUser(_0x25a757,_0x258502,_0x247aaf,_0x4814b9,_0x26a1c5,_0x19caef)[_0x1578('0xc')](getUser(_0x25a757,_0x258502,_0x4814b9,_0x26a1c5,_0x19caef))[_0x1578('0xc')](getEndUser(_0x25a757,_0x258502,_0x4814b9,_0x26a1c5,_0x19caef))[_0x1578('0xc')](getTicket(_0x25a757,_0x258502,_0x4814b9,_0x5c7bc5,_0x9cb83d,_0x26a1c5))['then'](function(_0x2506a4){logger[_0x1578('0x16')](util[_0x1578('0x64')](_0x1578('0x65'),_0x2506a4[_0x1578('0x41')]));logger['info'](util['format']('call\x20direction:\x20%s',_0x25a757));if(_0x25a757!=='unmanaged'){logger[_0x1578('0x16')]('['+[_0x25a757['toUpperCase']()]+']',_0x1578('0x66'));emit(_0x1cd3b1[_0x1578('0x53')],_0x378067[_0x1578('0x37')],_0x2506a4[_0x1578('0x41')]);}})[_0x1578('0x13')](function(_0x5c2c00){logger[_0x1578('0x14')]('['+[_0x25a757[_0x1578('0x11')]()]+_0x1578('0x67'),util[_0x1578('0x68')](_0x5c2c00,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1441=['%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','user:%s','emit','username','password','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','adminEmail','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','content','toString','customField','idField','toLowerCase','variable','variableName','name','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all'];(function(_0x4fdb8a,_0x49c8b3){var _0x57f10c=function(_0x3b9f69){while(--_0x3b9f69){_0x4fdb8a['push'](_0x4fdb8a['shift']());}};_0x57f10c(++_0x49c8b3);}(_0x1441,0x8d));var _0x1144=function(_0x254635,_0x472b4c){_0x254635=_0x254635-0x0;var _0x35293c=_0x1441[_0x254635];return _0x35293c;};'use strict';var _=require(_0x1144('0x0'));var Promise=require(_0x1144('0x1'));var rp=require('request-promise');var util=require(_0x1144('0x2'));var md5=require(_0x1144('0x3'));var Redis=require(_0x1144('0x4'));var intUtil=require(_0x1144('0x5'));var config=require(_0x1144('0x6'));var logger=require(_0x1144('0x7'))(_0x1144('0x8'));config[_0x1144('0x9')]=_['defaults'](config[_0x1144('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1144('0x9')]));function getAdminUser(_0x376f6d,_0xc066eb,_0x1aa7c4,_0xa9b673,_0x434801,_0x4041ea){return new Promise(function(_0x602f9c,_0x390ebe){var _0x15cb8c={'method':_0x1144('0xa'),'uri':_0xa9b673+_0x1144('0xb')+'&'+_0x434801+'&'+_0x4041ea,'auth':_0xc066eb,'json':!![]};return rp(_0x15cb8c)[_0x1144('0xc')](function(_0x3e758e){if(_0x3e758e[_0x1144('0xd')][_0x1144('0xe')]>0x0){_0x1aa7c4[_0x1144('0xf')]=_0x3e758e[_0x1144('0xd')][0x0][_0x1144('0x10')];}logger[_0x1144('0x11')]('['+[_0x376f6d[_0x1144('0x12')]()]+_0x1144('0x13'),_0x1aa7c4);_0x602f9c(_0x1aa7c4);})[_0x1144('0x14')](function(_0x8e858d){logger[_0x1144('0x15')]('['+[_0x376f6d['toUpperCase']()]+']',_0x8e858d[_0x1144('0x16')]);_0x390ebe(_0x8e858d['message']);});});}function getUser(_0x4e80ea,_0x478ba6,_0x26527f,_0x5daa51,_0x206972){return function(_0x505306){logger[_0x1144('0x11')]('['+[_0x4e80ea[_0x1144('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x505306);return new Promise(function(_0x756f28,_0x210830){if(intUtil[_0x1144('0x17')](_0x505306[_0x1144('0x18')])){var _0x43c591={'method':_0x1144('0xa'),'uri':_0x26527f+_0x1144('0x19')+_0x505306['userEmail']+'&'+_0x5daa51+'&'+_0x206972,'auth':_0x478ba6,'json':!![]};logger[_0x1144('0x11')]('['+[_0x4e80ea[_0x1144('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x43c591);return rp(_0x43c591)[_0x1144('0xc')](function(_0x591884){logger[_0x1144('0x11')]('['+[_0x4e80ea['toUpperCase']()]+'],\x20getUser\x20entity',_0x591884);if(_0x591884[_0x1144('0xd')][_0x1144('0xe')]>0x0&&String(_0x591884['result'][0x0][_0x1144('0x1a')])==='true'){_0x505306['userId']=_0x591884[_0x1144('0xd')][0x0][_0x1144('0x10')];}else{_0x505306[_0x1144('0x1b')]=_0x505306[_0x1144('0xf')];_0x505306[_0x1144('0x18')]=_0x505306['adminEmail'];}logger[_0x1144('0x11')]('['+[_0x4e80ea[_0x1144('0x12')]()]+_0x1144('0x1c'),_0x505306);_0x756f28(_0x505306);})['catch'](function(_0x55018b){logger[_0x1144('0x15')]('['+[_0x4e80ea['toUpperCase']()]+']',_0x55018b['message']);_0x210830(_0x55018b[_0x1144('0x16')]);});}else{logger[_0x1144('0x11')]('['+[_0x4e80ea[_0x1144('0x12')]()]+_0x1144('0x1d'));_0x505306[_0x1144('0x1b')]=_0x505306['adminId'];_0x505306['userEmail']=_0x505306['adminEmail'];_0x756f28(_0x505306);}});};}function createEndUser(_0xa9b7cb,_0x37f7bc,_0x28887e,_0x335f64,_0x5b2ee3){logger['info']('['+[_0xa9b7cb[_0x1144('0x12')]()]+_0x1144('0x1e'),_0x28887e);return new Promise(function(_0x3ab258,_0xe2e9c2){var _0x127622={'method':_0x1144('0x1f'),'uri':_0x335f64+_0x1144('0x20')+_0x5b2ee3,'body':{'user_name':_0x28887e['endUserNumber'],'roles':'user','first_name':_0x28887e['endUserNumber'],'active':'true','date_format':_0x1144('0x21'),'phone':_0x28887e[_0x1144('0x22')]},'auth':_0x37f7bc,'json':!![]};return rp(_0x127622)[_0x1144('0xc')](function(_0x347b83){logger[_0x1144('0x11')]('['+[_0xa9b7cb[_0x1144('0x12')]()]+_0x1144('0x23'),_0x347b83[_0x1144('0xd')]);_0x28887e[_0x1144('0x24')]=_0x347b83['result'][_0x1144('0x10')];_0x3ab258(_0x28887e);})['catch'](function(_0x6796a6){logger[_0x1144('0x15')]('['+[_0xa9b7cb[_0x1144('0x12')]()]+']',_0x6796a6[_0x1144('0x16')]);_0xe2e9c2(_0x6796a6[_0x1144('0x16')]);});});}function getEndUser(_0x418ae4,_0x4ece66,_0x2f71d5,_0x45c2cc,_0x359556){return function(_0x5384cb){logger[_0x1144('0x11')]('['+[_0x418ae4[_0x1144('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x5384cb);return new Promise(function(_0x589543,_0x23efb8){var _0x4407f2={'method':_0x1144('0xa'),'uri':_0x2f71d5+'sys_user?sysparm_query=phone%3D'+_0x5384cb[_0x1144('0x22')]+'&'+_0x45c2cc+'&'+_0x359556,'auth':_0x4ece66,'json':!![]};return rp(_0x4407f2)[_0x1144('0xc')](function(_0x4afa40){if(_0x4afa40['result'][_0x1144('0xe')]>0x0){_0x5384cb[_0x1144('0x24')]=_0x4afa40[_0x1144('0xd')][0x0][_0x1144('0x10')];logger['info']('['+[_0x418ae4[_0x1144('0x12')]()]+_0x1144('0x25'),_0x5384cb);_0x589543(_0x5384cb);}else{return createEndUser(_0x418ae4,_0x4ece66,_0x5384cb,_0x2f71d5,_0x45c2cc)[_0x1144('0xc')](function(_0xc7e065){logger[_0x1144('0x11')]('['+[_0x418ae4[_0x1144('0x12')]()]+_0x1144('0x26'),_0xc7e065);_0x589543(_0xc7e065);});}})['catch'](function(_0x3bc8fd){logger['error']('['+[_0x418ae4[_0x1144('0x12')]()]+']',_0x3bc8fd[_0x1144('0x16')]);_0x23efb8(_0x3bc8fd[_0x1144('0x16')]);});});};}function getCustomFields(_0x23d082,_0x2f5db3){var _0xbb7a4b={};if(_0x23d082[_0x1144('0xe')]>0x0){_[_0x1144('0x27')](_0x23d082,function(_0x26410b){if(_[_0x1144('0x28')]([_0x1144('0x29'),_0x1144('0x2a')],_0x26410b[_0x1144('0x2b')])&&_0x26410b[_0x1144('0x2c')]&&!_0x26410b['customField']){_0xbb7a4b[_0x26410b[_0x1144('0x2c')]['toLowerCase']()]=_0x26410b[_0x1144('0x2d')][_0x1144('0x2e')]();}else if(_[_0x1144('0x28')]([_0x1144('0x29'),_0x1144('0x2a')],_0x26410b[_0x1144('0x2b')])&&_0x26410b['idField']&&_0x26410b[_0x1144('0x2f')]){_0xbb7a4b[_0x26410b[_0x1144('0x30')][_0x1144('0x31')]()]=_0x26410b[_0x1144('0x2d')]['toString']();}else if(_0x26410b[_0x1144('0x2b')]===_0x1144('0x32')&&_0x26410b[_0x1144('0x33')]&&_0x26410b[_0x1144('0x30')]&&_0x26410b[_0x1144('0x2f')]){_0xbb7a4b[_0x26410b['idField']['toLowerCase']()]=_0x2f5db3[_0x26410b['variableName']]['toString']();}else if(_0x26410b[_0x1144('0x2b')]==='customVariable'&&_0x26410b['Variable']&&_0x26410b['Variable'][_0x1144('0x34')]&&_0x26410b[_0x1144('0x30')]&&_0x26410b['customField']){_0xbb7a4b[_0x26410b[_0x1144('0x30')][_0x1144('0x31')]()]=_0x2f5db3[_0x26410b[_0x1144('0x35')]['name'][_0x1144('0x31')]()][_0x1144('0x2e')]();}});}return _0xbb7a4b;}function getTicket(_0x2c6f67,_0x4d86c9,_0x159b28,_0x18b182,_0x12e65d,_0x21eb7b){return function(_0xee94c3){logger[_0x1144('0x11')]('['+[_0x2c6f67[_0x1144('0x12')]()]+_0x1144('0x36'),_0xee94c3);return new Promise(function(_0x3647d4,_0xd2841c){var _0x3dc7b3=_0x2c6f67[_0x1144('0x31')]()===_0x1144('0x37')?_0xee94c3[_0x1144('0x1b')]:_0xee94c3['endUserId'];var _0x3de356={'method':_0x1144('0x1f'),'uri':_0x159b28+_0x1144('0x38')+'?'+_0x21eb7b,'body':Object[_0x1144('0x39')]({},{'active':_0x1144('0x3a'),'caller_id':_0x3dc7b3,'assigned_to':_0xee94c3['userId'],'short_description':intUtil[_0x1144('0x3b')](_0x18b182[_0x1144('0x3c')],_0x12e65d,'\x20'),'description':intUtil[_0x1144('0x3b')](_0x18b182[_0x1144('0x3d')],_0x12e65d,'\x0a')},getCustomFields(_0x18b182[_0x1144('0x3e')],_0x12e65d)),'auth':_0x4d86c9,'json':!![]};return rp(_0x3de356)[_0x1144('0xc')](function(_0x4fd30a){logger[_0x1144('0x11')]('['+[_0x2c6f67['toUpperCase']()]+_0x1144('0x3f'),_0x4fd30a['result']);_0xee94c3[_0x1144('0x40')]=_0x4fd30a[_0x1144('0xd')][_0x1144('0x10')];_0xee94c3[_0x1144('0x41')]=_0x4fd30a[_0x1144('0xd')]['number'];logger[_0x1144('0x11')]('['+[_0x2c6f67[_0x1144('0x12')]()]+']\x20getTicket\x20crm',_0xee94c3);_0x3647d4(_0xee94c3);})[_0x1144('0x14')](function(_0x1bb297){logger[_0x1144('0x15')]('['+[_0x2c6f67[_0x1144('0x12')]()]+']',_0x1bb297[_0x1144('0x16')]);_0xd2841c(_0x1bb297[_0x1144('0x16')]);});});};}function createRemoteTag(_0x392002,_0x555bb6,_0x280523,_0x424643){return new Promise(function(_0x4fd10a,_0x149847){var _0x5d872b={'method':_0x1144('0x1f'),'uri':_0x280523+_0x1144('0x42')+'?'+_0x424643,'body':{'short_description':_0x392002,'global':!![],'active':!![],'name':_0x392002},'auth':_0x555bb6,'json':!![]};return rp(_0x5d872b)[_0x1144('0xc')](function(_0x1bf69d){var _0x2c26ce=_0x1bf69d['result'][_0x1144('0x10')];_0x4fd10a(_0x2c26ce);});});}function getRemoteTag(_0x823b28,_0x23a86e,_0x48e420,_0x21cd39,_0x354492){return new Promise(function(_0x1a284f,_0x3e4260){var _0x44ee32={'method':_0x1144('0xa'),'uri':_0x48e420+'label'+_0x1144('0x43')+_0x823b28+'&'+_0x21cd39,'auth':_0x23a86e,'json':!![]};return rp(_0x44ee32)[_0x1144('0xc')](function(_0x11547e){if(_0x11547e[_0x1144('0xd')][_0x1144('0xe')]>0x0){var _0x51b940=_0x11547e['result'][0x0]['sys_id'];_0x1a284f(_0x51b940);}else{return createRemoteTag(_0x823b28,_0x23a86e,_0x48e420,_0x21cd39)[_0x1144('0xc')](function(_0x4279a9){_0x1a284f(_0x4279a9);});}});});}function assignTagToIncident(_0x2104a6,_0x4e7d03,_0x5dda3a,_0x39042d,_0x5ec4f6){return new Promise(function(_0x125c64,_0x2fc081){var _0x4d9409={'method':'POST','uri':_0x5dda3a+_0x1144('0x44')+'?'+_0x5ec4f6,'body':{'label':_0x2104a6,'table':_0x1144('0x38'),'id_type':_0x1144('0x45'),'table_key':_0x39042d[_0x1144('0x40')],'title':_0x1144('0x46')+_0x39042d[_0x1144('0x41')],'id_display':_0x39042d[_0x1144('0x41')]},'auth':_0x4e7d03,'json':!![]};return rp(_0x4d9409)[_0x1144('0xc')](function(_0x12e98f){_0x125c64();})[_0x1144('0x14')](function(){_0x125c64();});});}function manageTags(_0x4b828d,_0x423e7d,_0x55af85,_0xb80e20,_0x3f20f0,_0x9dd2b9,_0x53a239){return new Promise(function(_0x390429,_0x21b65a){var _0x299706=[];_0x423e7d[_0x1144('0x27')](function(_0xee8b1e){_0x299706['push'](getRemoteTag(_0xee8b1e,_0x55af85,_0xb80e20,_0x9dd2b9,_0x53a239));});return Promise['all'](_0x299706)['then'](function(_0x940f4a){if(_0x940f4a[_0x1144('0xe')]){logger['info']('['+[_0x4b828d['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x940f4a);var _0x36dbe2=[];_0x940f4a['forEach'](function(_0x5eaa65){_0x36dbe2[_0x1144('0x47')](assignTagToIncident(_0x5eaa65,_0x55af85,_0xb80e20,_0x3f20f0,_0x9dd2b9));});return Promise[_0x1144('0x48')](_0x36dbe2)['then'](function(){_0x390429();})['catch'](function(){_0x390429();});}else{_0x390429();}});});}function getTags(_0xff4b2a,_0x9e69e5,_0x34672a,_0x21e039,_0x709156,_0x23b683){return function(_0xbb958a){return new Promise(function(_0x1c8580,_0x1c3a10){var _0x138eb1=[];var _0x265ba2=_0x21e039['Tags'];if(_0x265ba2&&_0x265ba2[_0x1144('0xe')]>0x0){_0x138eb1=_['map'](_0x265ba2,_0x1144('0x34'));}if(_0x138eb1[_0x1144('0xe')]>0x0){return manageTags(_0xff4b2a,_0x138eb1,_0x9e69e5,_0x34672a,_0xbb958a,_0x709156,_0x23b683)[_0x1144('0xc')](function(){_0x1c8580(_0xbb958a);});}else{_0x1c8580(_0xbb958a);}});};}function emit(_0x309255,_0x341365,_0x1afed5){var _0x320f26=_0x1144('0x49')+_0x1144('0x4a')+_0x1144('0x4b')+_0x1144('0x4c');var _0x2a0ae1={'uri':_0x309255+_0x1144('0x4d')+_0x1afed5+_0x320f26};io['to'](util['format'](_0x1144('0x4e'),_0x341365))[_0x1144('0x4f')]('trigger:browser:url',_0x2a0ae1);}exports['cs']=function(_0x46f203,_0x5645c2,_0x40007d,_0x4c8dc2,_0x16ccba,_0x4b7076,_0x486a03,_0x3629f8){var _0x2d5915={};var _0x5d5fe1={'user':_0x4b7076[_0x1144('0x50')],'pass':_0x4b7076[_0x1144('0x51')]};var _0x1cf881='sysparm_limit=1';var _0x1c284b='sysparm_display_value=true';_0x4b7076[_0x1144('0x52')]=intUtil[_0x1144('0x53')](_0x4b7076[_0x1144('0x52')]);_0x4b7076[_0x1144('0x54')]=intUtil['stripTrailingSlash'](_0x4b7076[_0x1144('0x54')]);var _0x55a679=util[_0x1144('0x55')]('%s/api/now/table/',_0x4b7076[_0x1144('0x52')]);_0x2d5915[_0x1144('0x18')]=!_[_0x1144('0x56')](_0x4c8dc2)?_0x4c8dc2[_0x1144('0x57')]:null;_0x2d5915[_0x1144('0x58')]=_0x4b7076[_0x1144('0x57')];_0x2d5915[_0x1144('0x22')]=_0x3629f8[_0x1144('0x31')]()===_0x1144('0x37')?_0x5645c2[_0x1144('0x59')]:_0x5645c2[_0x1144('0x5a')];_0x2d5915[_0x1144('0x5b')]=_0x3629f8===_0x1144('0x5c')||_0x3629f8===_0x1144('0x5d')?'queue':_0x1144('0x37');var _0x7f2ebf=util[_0x1144('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b7076[_0x1144('0x54')],_0x5645c2[_0x1144('0x5e')],md5(_0x5645c2[_0x1144('0x5e')]));if(_0x16ccba&&_0x16ccba[_0x1144('0x5f')]){logger[_0x1144('0x11')](_0x1144('0x60'),_0x1144('0x61'));_0x5645c2['recordingURL']=_0x7f2ebf;}else if(_0x486a03&&_0x486a03[_0x1144('0x62')]&&_0x486a03['recordingFormat']!==_0x1144('0x63')){logger['info'](_0x1144('0x64'),'Recording\x20is\x20enabled!');_0x5645c2['recordingURL']=_0x7f2ebf;}else{_0x5645c2[_0x1144('0x65')]='';}return getAdminUser(_0x3629f8,_0x5d5fe1,_0x2d5915,_0x55a679,_0x1c284b,_0x1cf881)[_0x1144('0xc')](getUser(_0x3629f8,_0x5d5fe1,_0x55a679,_0x1c284b,_0x1cf881))[_0x1144('0xc')](getEndUser(_0x3629f8,_0x5d5fe1,_0x55a679,_0x1c284b,_0x1cf881))[_0x1144('0xc')](getTicket(_0x3629f8,_0x5d5fe1,_0x55a679,_0x40007d,_0x5645c2,_0x1c284b))['then'](function(_0x1205e4){logger[_0x1144('0x11')](util[_0x1144('0x55')](_0x1144('0x66'),_0x1205e4['ticketId']));logger[_0x1144('0x11')](util[_0x1144('0x55')](_0x1144('0x67'),_0x3629f8));if(_0x3629f8!==_0x1144('0x5d')){logger['info']('['+[_0x3629f8[_0x1144('0x12')]()]+']',_0x1144('0x68'));emit(_0x4b7076[_0x1144('0x52')],_0x4c8dc2[_0x1144('0x34')],_0x1205e4[_0x1144('0x40')]);}})[_0x1144('0x14')](function(_0x3b7eee){logger['error']('['+[_0x3629f8[_0x1144('0x12')]()]+_0x1144('0x69'),util[_0x1144('0x6a')](_0x3b7eee,{'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 7959466..37df26d 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 _0x3f2e=['Outbound','user:%s','unmanaged','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','name','getString','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','value','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','length','map','string','nameField','customField','toLowerCase','content','custom_fields','type','customVariable','Variable','POST','password','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','[QUEUE]','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname'];(function(_0x15552d,_0x36f6f3){var _0x575563=function(_0x533229){while(--_0x533229){_0x15552d['push'](_0x15552d['shift']());}};_0x575563(++_0x36f6f3);}(_0x3f2e,0xf2));var _0xe3f2=function(_0x41a457,_0x4a8e30){_0x41a457=_0x41a457-0x0;var _0x84b15f=_0x3f2e[_0x41a457];return _0x84b15f;};'use strict';var _=require(_0xe3f2('0x0'));var rp=require(_0xe3f2('0x1'));var BPromise=require(_0xe3f2('0x2'));var md5=require(_0xe3f2('0x3'));var util=require(_0xe3f2('0x4'));var Redis=require(_0xe3f2('0x5'));var intUtil=require('./util');var config=require(_0xe3f2('0x6'));var logger=require(_0xe3f2('0x7'))(_0xe3f2('0x8'));config[_0xe3f2('0x9')]=_[_0xe3f2('0xa')](config['redis'],{'host':_0xe3f2('0xb'),'port':0x18eb});var io=require(_0xe3f2('0xc'))(new Redis(config[_0xe3f2('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x2c8dbb,_0x138792,_0x475986){io['to'](_0x2c8dbb)[_0xe3f2('0xd')](_0x138792,_0x475986);}function getTicket(_0x262a6b,_0x479ae1,_0x5bd908,_0x4ade61,_0x1aba6f,_0x25c857,_0x3f7f3c,_0x41312e){logger[_0xe3f2('0xe')]('Creating\x20new\x20ticket...');var _0x85e7d5=new Date();var _0x2c80dc=[{'name':_0xe3f2('0xf'),'value':intUtil[_0xe3f2('0x10')](_0x4ade61['Subjects'],_0x1aba6f,'\x20')},{'name':'assigned_user_id','value':_0x479ae1['id']},{'name':_0xe3f2('0x11'),'value':_0x479ae1['id']},{'name':'description','value':intUtil[_0xe3f2('0x10')](_0x4ade61[_0xe3f2('0x12')],_0x1aba6f,'\x0a')},{'name':_0xe3f2('0x13'),'value':_0x85e7d5[_0xe3f2('0x14')]()[_0xe3f2('0x15')](0x0,0x13)[_0xe3f2('0x16')]('T','\x20')},{'name':_0xe3f2('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xe3f2('0x18'),'value':_0x5bd908['id']},{'name':'parent_type','value':_0xe3f2('0x19')},{'name':_0xe3f2('0x1a'),'value':_0x5bd908[_0xe3f2('0xf')]},{'name':_0xe3f2('0x1b'),'value':_0x41312e}];if(_0x25c857['length']){_[_0xe3f2('0x1c')](_0x25c857,function(_0x56e779){if(_0x1aba6f[_0x56e779[_0xe3f2('0x1d')]]){_0x2c80dc[_0xe3f2('0x1e')]({'name':_0x56e779[_0xe3f2('0x1f')],'value':_0x1aba6f[_0x56e779['variableName']]});}});}return request({'form':{'method':_0xe3f2('0x20'),'input_type':_0xe3f2('0x21'),'response_type':_0xe3f2('0x21'),'rest_data':JSON['stringify']({'session':_0x3f7f3c['id'],'module_name':_0xe3f2('0x22'),'name_value_list':_0x2c80dc})}});}function getAuth(_0x4506ad){return util[_0xe3f2('0x23')](_0xe3f2('0x24'),new Buffer(_0x4506ad[_0xe3f2('0x25')]+':X')[_0xe3f2('0x26')]('base64'));}function getServerInfo(_0x429c6e){return request({'form':{'method':'get_server_info','input_type':_0xe3f2('0x21'),'response_type':_0xe3f2('0x21'),'rest_data':JSON[_0xe3f2('0x27')]({'session':_0x429c6e['id']})}});}function getUser(_0x32bab9,_0x343e49,_0x4d821f){if(!_[_0xe3f2('0x28')](_0x343e49)){logger[_0xe3f2('0xe')](_0xe3f2('0x29'),_0x343e49);return request({'form':{'method':_0xe3f2('0x2a'),'input_type':_0xe3f2('0x21'),'response_type':'JSON','rest_data':JSON[_0xe3f2('0x27')]({'session':_0x4d821f['id'],'module_name':_0xe3f2('0x2b'),'query':util['format'](_0xe3f2('0x2c'),_0x343e49),'order_by':'','offset':'0','select_fields':['id',_0xe3f2('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe3f2('0x2d')](function(_0x1d9339){if(_0x1d9339[_0xe3f2('0x2e')]['length']){var _0x3dd549=_[_0xe3f2('0x2f')](_0x1d9339[_0xe3f2('0x2e')],function(_0x4b2496){return _0x4b2496[_0xe3f2('0x30')][_0xe3f2('0x31')]['value']===_0x343e49;});if(_0x3dd549){logger[_0xe3f2('0xe')]('Agent\x20found!');return BPromise[_0xe3f2('0x32')]({'id':_0x3dd549[_0xe3f2('0x30')]['id']['value'],'name':_0x3dd549[_0xe3f2('0x30')]['name']['value']});}}logger[_0xe3f2('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4d821f[_0xe3f2('0x30')]['user_id']['value'],'name':_0x4d821f[_0xe3f2('0x30')][_0xe3f2('0x31')]['value']});});}else{logger[_0xe3f2('0xe')](_0xe3f2('0x33'));return BPromise[_0xe3f2('0x32')]({'id':_0x4d821f['name_value_list']['user_id'][_0xe3f2('0x34')],'name':_0x4d821f[_0xe3f2('0x30')]['user_name'][_0xe3f2('0x34')]});}}function getEndUser(_0x5c5417,_0x1ef8e7,_0x2597e0,_0x5381a1){logger[_0xe3f2('0xe')](_0xe3f2('0x35'),_0x2597e0);return request({'form':{'method':_0xe3f2('0x2a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe3f2('0x27')]({'session':_0x5381a1['id'],'module_name':_0xe3f2('0x19'),'query':util[_0xe3f2('0x23')](_0xe3f2('0x36'),_0x2597e0),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x8e28b4){if(_0x8e28b4[_0xe3f2('0x2e')]['length']){var _0x3274a5=_[_0xe3f2('0x2f')](_0x8e28b4[_0xe3f2('0x2e')],function(_0x47dd7a){return _0x47dd7a[_0xe3f2('0x30')]['phone_home'][_0xe3f2('0x34')]===_0x2597e0;});if(_0x3274a5){logger[_0xe3f2('0xe')](_0xe3f2('0x37'));return BPromise[_0xe3f2('0x32')]({'id':_0x3274a5[_0xe3f2('0x30')]['id']['value'],'name':_0x3274a5[_0xe3f2('0x30')]['name'][_0xe3f2('0x34')],'phone':_0x3274a5['name_value_list'][_0xe3f2('0x38')][_0xe3f2('0x34')]});}}else{logger[_0xe3f2('0xe')](_0xe3f2('0x39'));return request({'form':{'method':_0xe3f2('0x20'),'input_type':_0xe3f2('0x21'),'response_type':_0xe3f2('0x21'),'rest_data':JSON[_0xe3f2('0x27')]({'session':_0x5381a1['id'],'module_name':_0xe3f2('0x19'),'name_value_list':[{'name':_0xe3f2('0x3a'),'value':_0x1ef8e7!==_0xe3f2('0x3b')?_0x1ef8e7:util[_0xe3f2('0x23')](_0xe3f2('0x3c'),_0x2597e0)},{'name':_0xe3f2('0x38'),'value':_0x2597e0}]})}})[_0xe3f2('0x2d')](function(_0x5f4bd0){logger[_0xe3f2('0xe')](_0xe3f2('0x3d'));return BPromise[_0xe3f2('0x32')]({'id':_0x5f4bd0['id'],'name':_0x5f4bd0[_0xe3f2('0x2e')][_0xe3f2('0x3a')][_0xe3f2('0x34')],'phone':_0x5f4bd0[_0xe3f2('0x2e')][_0xe3f2('0x38')]['value']});});}});}function request(_0x4ec7e3){logger['debug'](_0xe3f2('0x3e'),JSON[_0xe3f2('0x27')](_0x4ec7e3));return rp(_[_0xe3f2('0x3f')](def,_0x4ec7e3));}function getTags(_0x4bb8f9,_0x2dd079){var _0x52b70b=[];if(_0x4bb8f9&&_0x4bb8f9[_0xe3f2('0x40')]>0x0){_0x52b70b=_[_0xe3f2('0x41')](_0x4bb8f9,_0x2dd079);}return _0x52b70b;}function getCustomFields(_0x335c82,_0x3f554c){var _0x3bd44a=[];var _0x495cdc={'custom_fields':[]};if(_0x335c82[_0xe3f2('0x40')]>0x0){_[_0xe3f2('0x1c')](_0x335c82,function(_0x4ac230){if(_0x4ac230['type']===_0xe3f2('0x42')&&_0x4ac230[_0xe3f2('0x43')]&&!_0x4ac230[_0xe3f2('0x44')]){_0x495cdc[_0x4ac230[_0xe3f2('0x43')][_0xe3f2('0x45')]()]=_0x4ac230[_0xe3f2('0x46')][_0xe3f2('0x26')]();}else if(_0x4ac230['type']===_0xe3f2('0x42')&&_0x4ac230['idField']&&_0x4ac230[_0xe3f2('0x44')]){_0x495cdc[_0xe3f2('0x47')]['push']({'id':_0x4ac230['idField'],'value':_0x4ac230[_0xe3f2('0x46')]['toString']()});}else if(_0x4ac230[_0xe3f2('0x48')]==='variable'&&_0x4ac230[_0xe3f2('0x1d')]&&_0x4ac230[_0xe3f2('0x1f')]&&_0x4ac230[_0xe3f2('0x44')]){_0x3f554c[_0x4ac230[_0xe3f2('0x1d')]]&&_0x495cdc[_0xe3f2('0x47')][_0xe3f2('0x1e')]({'id':_0x4ac230[_0xe3f2('0x1f')],'value':_0x3f554c[_0x4ac230[_0xe3f2('0x1d')]][_0xe3f2('0x26')]()});}else if(_0x4ac230[_0xe3f2('0x48')]===_0xe3f2('0x49')&&_0x4ac230['Variable']&&_0x4ac230[_0xe3f2('0x4a')][_0xe3f2('0xf')]&&_0x4ac230['idField']&&_0x4ac230['customField']){_0x3f554c[_0x4ac230[_0xe3f2('0x4a')][_0xe3f2('0xf')][_0xe3f2('0x45')]()]&&_0x495cdc['custom_fields']['push']({'id':_0x4ac230[_0xe3f2('0x1f')],'value':_0x3f554c[_0x4ac230[_0xe3f2('0x4a')][_0xe3f2('0xf')]['toLowerCase']()]['toString']()});}});}return _0x495cdc;}function getConnection(_0x293e54){return request({'method':_0xe3f2('0x4b'),'form':{'method':'login','input_type':'JSON','response_type':_0xe3f2('0x21'),'rest_data':JSON[_0xe3f2('0x27')]({'user_auth':{'user_name':_0x293e54['username'],'password':_0x293e54[_0xe3f2('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x55b2a7){var _0x2ed2f5=_0x55b2a7;if(_0x2ed2f5['id']){def[_0xe3f2('0x4d')]=_0x2ed2f5['id'];return BPromise[_0xe3f2('0x32')](_0x2ed2f5);}else{throw new Error(util[_0xe3f2('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x293e54['id']));}});}function setRelationship(_0x334976,_0x543e6e,_0x4706a7,_0x31d058){return request({'form':{'method':_0xe3f2('0x4e'),'input_type':_0xe3f2('0x21'),'response_type':'JSON','rest_data':JSON[_0xe3f2('0x27')]({'session':_0x334976['id'],'module_name':_0xe3f2('0x22'),'module_id':_0x4706a7['id'],'link_field_name':_0x31d058,'related_ids':[_0x543e6e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe3f2('0x4f')]=function(_0x290842,_0x434557,_0x2c55ac,_0x437bd9,_0x1b7ecf,_0x49e290){var _0x1f1ee2,_0x26ae0e,_0x2d9110,_0x2272a8;_0x49e290[_0xe3f2('0x50')]=intUtil['stripTrailingSlash'](_0x49e290['remoteUri']);_0x49e290['serverUrl']=intUtil[_0xe3f2('0x51')](_0x49e290[_0xe3f2('0x52')]);def[_0xe3f2('0x53')]=util[_0xe3f2('0x23')](_0xe3f2('0x54'),_0x49e290['remoteUri']);if(_0x1b7ecf&&_0x1b7ecf[_0xe3f2('0x55')]){logger[_0xe3f2('0xe')]('[QUEUE]',_0xe3f2('0x56'));_0x434557[_0xe3f2('0x57')]=util[_0xe3f2('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49e290['serverUrl'],_0x434557[_0xe3f2('0x58')],md5(_0x434557['uniqueid']));}else{_0x434557['recordingURL']='';}return getConnection(_0x49e290)['then'](function(_0x176f37){_0x2272a8=_0x176f37;return getUser(_0x49e290,_0x437bd9['name'],_0x2272a8);})['then'](function(_0x3b74eb){_0x1f1ee2=_0x3b74eb;logger[_0xe3f2('0xe')](_0xe3f2('0x59'),_0x1f1ee2['id']);return getEndUser(_0x49e290,_0x434557['calleridname'],_0x434557[_0xe3f2('0x5a')],_0x2272a8);})['then'](function(_0x3179be){_0x26ae0e=_0x3179be;logger[_0xe3f2('0xe')](_0xe3f2('0x5b'),_0x26ae0e['id']);return getTicket(_0x49e290,_0x1f1ee2,_0x26ae0e,_0x2c55ac,_0x434557,_0x2c55ac[_0xe3f2('0x5c')],_0x2272a8,_0xe3f2('0x5d'));})['then'](function(_0x5838fd){_0x2d9110=_0x5838fd;logger['info'](_0xe3f2('0x5e'));logger[_0xe3f2('0xe')](_0xe3f2('0x5f'),_0x2d9110['id']);return setRelationship(_0x2272a8,_0x1f1ee2,_0x2d9110,_0xe3f2('0x60'));})['then'](function(){return setRelationship(_0x2272a8,_0x26ae0e,_0x2d9110,_0xe3f2('0x61'));})[_0xe3f2('0x2d')](function(){return getServerInfo(_0x2272a8);})[_0xe3f2('0x2d')](function(_0x5b4261){var _0x39d60f=parseInt(_0x5b4261[_0xe3f2('0x62')][_0xe3f2('0x63')](0x0));var _0x3dc0c5=util[_0xe3f2('0x23')](_0xe3f2('0x64'),_0x49e290[_0xe3f2('0x50')],_0x2d9110['id']);if(_0x39d60f>0x6){_0x3dc0c5=util[_0xe3f2('0x23')](_0xe3f2('0x65'),_0x49e290[_0xe3f2('0x50')],_0x2d9110['id']);}logger[_0xe3f2('0xe')]('[QUEUE]',_0xe3f2('0x66'));emit(util[_0xe3f2('0x23')]('user:%s',_0x437bd9['name']),_0xe3f2('0x67'),{'uri':_0x3dc0c5});})[_0xe3f2('0x68')](function(_0x3f1a7a){logger[_0xe3f2('0x69')](_0xe3f2('0x6a'),JSON['stringify'](_0x3f1a7a));});};exports['outbound']=function(_0x30595e,_0x4b4e43,_0x98d1cf,_0x93bacd,_0x1464ff,_0x165b19,_0x1e49c4){var _0x4533a9,_0x4b47a9,_0x544c13,_0x142ad3;_0x165b19[_0xe3f2('0x50')]=intUtil[_0xe3f2('0x51')](_0x165b19[_0xe3f2('0x50')]);_0x165b19[_0xe3f2('0x52')]=intUtil[_0xe3f2('0x51')](_0x165b19[_0xe3f2('0x52')]);def[_0xe3f2('0x53')]=util[_0xe3f2('0x23')](_0xe3f2('0x54'),_0x165b19[_0xe3f2('0x50')]);if(_0x1e49c4&&_0x1e49c4[_0xe3f2('0x6b')]&&_0x1e49c4['recordingFormat']!==_0xe3f2('0x6c')){logger[_0xe3f2('0xe')](_0xe3f2('0x6d'),_0xe3f2('0x56'));_0x4b4e43[_0xe3f2('0x57')]=util['format'](_0xe3f2('0x6e'),_0x165b19['serverUrl'],_0x4b4e43[_0xe3f2('0x58')],md5(_0x4b4e43[_0xe3f2('0x58')]));}return getConnection(_0x165b19)[_0xe3f2('0x2d')](function(_0x57a09c){_0x142ad3=_0x57a09c;return getUser(_0x165b19,_0x93bacd['name'],_0x142ad3);})[_0xe3f2('0x2d')](function(_0x44d808){_0x4533a9=_0x44d808;logger[_0xe3f2('0xe')](_0xe3f2('0x59'),_0x4533a9['id']);return getEndUser(_0x165b19,_0x4b4e43[_0xe3f2('0x6f')],_0x4b4e43['destcalleridnum'],_0x142ad3);})[_0xe3f2('0x2d')](function(_0x509ee1){_0x4b47a9=_0x509ee1;logger[_0xe3f2('0xe')](_0xe3f2('0x5b'),_0x4b47a9['id']);return getTicket(_0x165b19,_0x4533a9,_0x4b47a9,_0x98d1cf,_0x4b4e43,_0x98d1cf[_0xe3f2('0x5c')],_0x142ad3,_0xe3f2('0x70'));})[_0xe3f2('0x2d')](function(_0x5d2947){_0x544c13=_0x5d2947;logger[_0xe3f2('0xe')](_0xe3f2('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x544c13['id']);return setRelationship(_0x142ad3,_0x4533a9,_0x544c13,_0xe3f2('0x60'));})[_0xe3f2('0x2d')](function(){return setRelationship(_0x142ad3,_0x4b47a9,_0x544c13,_0xe3f2('0x61'));})[_0xe3f2('0x2d')](function(){return getServerInfo(_0x142ad3);})['then'](function(_0xc8e1a5){var _0x1b77d5=parseInt(_0xc8e1a5[_0xe3f2('0x62')]['charAt'](0x0));var _0x120f0b=util[_0xe3f2('0x23')](_0xe3f2('0x64'),_0x165b19[_0xe3f2('0x50')],_0x544c13['id']);if(_0x1b77d5>0x6){_0x120f0b=util[_0xe3f2('0x23')](_0xe3f2('0x65'),_0x165b19['remoteUri'],_0x544c13['id']);}logger[_0xe3f2('0xe')](_0xe3f2('0x6d'),_0xe3f2('0x66'));emit(util[_0xe3f2('0x23')](_0xe3f2('0x71'),_0x93bacd[_0xe3f2('0xf')]),'trigger:browser:url',{'uri':_0x120f0b});})[_0xe3f2('0x68')](function(_0x2963fe){logger[_0xe3f2('0x69')](_0xe3f2('0x6d'),JSON[_0xe3f2('0x27')](_0x2963fe));});};exports[_0xe3f2('0x72')]=function(_0x1e2d08,_0x1a02ef,_0x42d8c4,_0x531903,_0x2ca3e8,_0x5e5753){var _0x59dd9c,_0x101d25,_0x1629e1,_0x1fae7a;_0x5e5753['remoteUri']=intUtil[_0xe3f2('0x51')](_0x5e5753[_0xe3f2('0x50')]);_0x5e5753[_0xe3f2('0x52')]=intUtil[_0xe3f2('0x51')](_0x5e5753[_0xe3f2('0x52')]);def[_0xe3f2('0x53')]=util[_0xe3f2('0x23')](_0xe3f2('0x54'),_0x5e5753[_0xe3f2('0x50')]);if(_0x2ca3e8&&_0x2ca3e8[_0xe3f2('0x55')]){logger[_0xe3f2('0xe')]('['+_0x1a02ef['lastevent'][_0xe3f2('0x73')]()+']',_0xe3f2('0x56'));_0x1a02ef['recordingURL']=util[_0xe3f2('0x23')](_0xe3f2('0x6e'),_0x5e5753['serverUrl'],_0x1a02ef['uniqueid'],md5(_0x1a02ef[_0xe3f2('0x58')]));}else{_0x1a02ef[_0xe3f2('0x57')]='';}return getConnection(_0x5e5753)[_0xe3f2('0x2d')](function(_0x1da8fa){_0x1fae7a=_0x1da8fa;if(!_[_0xe3f2('0x28')](_0x531903)){return getUser(_0x5e5753,_0x531903[_0xe3f2('0xf')],_0x1fae7a);}else{return getUser(_0x5e5753,null,_0x1fae7a);}})[_0xe3f2('0x2d')](function(_0x6383cf){_0x59dd9c=_0x6383cf;logger['info'](_0xe3f2('0x59'),_0x59dd9c['id']);return getEndUser(_0x5e5753,_0x1a02ef[_0xe3f2('0x74')],_0x1a02ef[_0xe3f2('0x5a')],_0x1fae7a);})[_0xe3f2('0x2d')](function(_0x4635bf){_0x101d25=_0x4635bf;logger['info'](_0xe3f2('0x5b'),_0x101d25['id']);return getTicket(_0x5e5753,_0x59dd9c,_0x101d25,_0x42d8c4,_0x1a02ef,_0x42d8c4[_0xe3f2('0x5c')],_0x1fae7a,'Inbound');})[_0xe3f2('0x2d')](function(_0x3c4223){_0x1629e1=_0x3c4223;logger[_0xe3f2('0xe')](_0xe3f2('0x5e'));logger[_0xe3f2('0xe')](_0xe3f2('0x5f'),_0x1629e1['id']);return setRelationship(_0x1fae7a,_0x59dd9c,_0x1629e1,_0xe3f2('0x60'));})[_0xe3f2('0x2d')](function(){return setRelationship(_0x1fae7a,_0x101d25,_0x1629e1,_0xe3f2('0x61'));})[_0xe3f2('0x2d')](function(){return getServerInfo(_0x1fae7a);})['catch'](function(_0x5303a9){logger['error']('['+_0x1a02ef[_0xe3f2('0x75')][_0xe3f2('0x73')]()+']',JSON['stringify'](_0x5303a9));});}; \ No newline at end of file +var _0xc1aa=['duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','toString','custom_fields','content','variable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','unmanaged','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','POST','emit','info','getString','assigned_user_id','description','date_start','toISOString','slice','replace'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xc1aa,0x152));var _0xac1a=function(_0x1ba091,_0x2f0fc8){_0x1ba091=_0x1ba091-0x0;var _0x5d5355=_0xc1aa[_0x1ba091];return _0x5d5355;};'use strict';var _=require(_0xac1a('0x0'));var rp=require(_0xac1a('0x1'));var BPromise=require(_0xac1a('0x2'));var md5=require(_0xac1a('0x3'));var util=require('util');var Redis=require(_0xac1a('0x4'));var intUtil=require(_0xac1a('0x5'));var config=require(_0xac1a('0x6'));var logger=require(_0xac1a('0x7'))(_0xac1a('0x8'));config['redis']=_[_0xac1a('0x9')](config[_0xac1a('0xa')],{'host':_0xac1a('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xac1a('0xc'),'json':!![]};function emit(_0x40f3c0,_0x2cd48a,_0x70ddc8){io['to'](_0x40f3c0)[_0xac1a('0xd')](_0x2cd48a,_0x70ddc8);}function getTicket(_0x53f109,_0x59ab9c,_0x511e67,_0x5a296e,_0x5c46ff,_0xc1bf16,_0x196de5,_0x4c3aed){logger[_0xac1a('0xe')]('Creating\x20new\x20ticket...');var _0x488361=new Date();var _0x8c1559=[{'name':'name','value':intUtil[_0xac1a('0xf')](_0x5a296e['Subjects'],_0x5c46ff,'\x20')},{'name':_0xac1a('0x10'),'value':_0x59ab9c['id']},{'name':'created_by','value':_0x59ab9c['id']},{'name':_0xac1a('0x11'),'value':intUtil[_0xac1a('0xf')](_0x5a296e['Descriptions'],_0x5c46ff,'\x0a')},{'name':_0xac1a('0x12'),'value':_0x488361[_0xac1a('0x13')]()[_0xac1a('0x14')](0x0,0x13)[_0xac1a('0x15')]('T','\x20')},{'name':_0xac1a('0x16'),'value':'0'},{'name':_0xac1a('0x17'),'value':'15'},{'name':_0xac1a('0x18'),'value':_0x511e67['id']},{'name':_0xac1a('0x19'),'value':_0xac1a('0x1a')},{'name':_0xac1a('0x1b'),'value':_0x511e67[_0xac1a('0x1c')]},{'name':'direction','value':_0x4c3aed}];if(_0xc1bf16[_0xac1a('0x1d')]){_[_0xac1a('0x1e')](_0xc1bf16,function(_0x1a0eaf){if(_0x5c46ff[_0x1a0eaf[_0xac1a('0x1f')]]){_0x8c1559[_0xac1a('0x20')]({'name':_0x1a0eaf[_0xac1a('0x21')],'value':_0x5c46ff[_0x1a0eaf[_0xac1a('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xac1a('0x22'),'response_type':'JSON','rest_data':JSON[_0xac1a('0x23')]({'session':_0x196de5['id'],'module_name':_0xac1a('0x24'),'name_value_list':_0x8c1559})}});}function getAuth(_0x3a16b6){return util[_0xac1a('0x25')](_0xac1a('0x26'),new Buffer(_0x3a16b6['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x3dc1d1){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0xac1a('0x22'),'rest_data':JSON[_0xac1a('0x23')]({'session':_0x3dc1d1['id']})}});}function getUser(_0x533d46,_0x1ec62e,_0x36fa8b){if(!_[_0xac1a('0x27')](_0x1ec62e)){logger[_0xac1a('0xe')](_0xac1a('0x28'),_0x1ec62e);return request({'form':{'method':'get_entry_list','input_type':_0xac1a('0x22'),'response_type':_0xac1a('0x22'),'rest_data':JSON[_0xac1a('0x23')]({'session':_0x36fa8b['id'],'module_name':_0xac1a('0x29'),'query':util[_0xac1a('0x25')](_0xac1a('0x2a'),_0x1ec62e),'order_by':'','offset':'0','select_fields':['id',_0xac1a('0x1c'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xac1a('0x2b')](function(_0x30e2bb){if(_0x30e2bb['entry_list'][_0xac1a('0x1d')]){var _0x1f90be=_['find'](_0x30e2bb[_0xac1a('0x2c')],function(_0x5ce075){return _0x5ce075[_0xac1a('0x2d')]['user_name'][_0xac1a('0x2e')]===_0x1ec62e;});if(_0x1f90be){logger[_0xac1a('0xe')]('Agent\x20found!');return BPromise[_0xac1a('0x2f')]({'id':_0x1f90be[_0xac1a('0x2d')]['id'][_0xac1a('0x2e')],'name':_0x1f90be[_0xac1a('0x2d')]['name']['value']});}}logger[_0xac1a('0xe')](_0xac1a('0x30'));return BPromise[_0xac1a('0x2f')]({'id':_0x36fa8b[_0xac1a('0x2d')][_0xac1a('0x31')][_0xac1a('0x2e')],'name':_0x36fa8b[_0xac1a('0x2d')]['user_name'][_0xac1a('0x2e')]});});}else{logger[_0xac1a('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xac1a('0x2f')]({'id':_0x36fa8b[_0xac1a('0x2d')][_0xac1a('0x31')]['value'],'name':_0x36fa8b[_0xac1a('0x2d')][_0xac1a('0x32')][_0xac1a('0x2e')]});}}function getEndUser(_0x11febb,_0x131d76,_0x12a3cb,_0x157b9c){logger[_0xac1a('0xe')](_0xac1a('0x33'),_0x12a3cb);return request({'form':{'method':_0xac1a('0x34'),'input_type':_0xac1a('0x22'),'response_type':_0xac1a('0x22'),'rest_data':JSON['stringify']({'session':_0x157b9c['id'],'module_name':_0xac1a('0x1a'),'query':util[_0xac1a('0x25')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x12a3cb),'order_by':'','offset':'0','select_fields':['id',_0xac1a('0x1c'),_0xac1a('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xac1a('0x2b')](function(_0x9d418b){if(_0x9d418b[_0xac1a('0x2c')]['length']){var _0x2c9920=_[_0xac1a('0x36')](_0x9d418b[_0xac1a('0x2c')],function(_0x2899ef){return _0x2899ef[_0xac1a('0x2d')][_0xac1a('0x35')]['value']===_0x12a3cb;});if(_0x2c9920){logger[_0xac1a('0xe')](_0xac1a('0x37'));return BPromise[_0xac1a('0x2f')]({'id':_0x2c9920[_0xac1a('0x2d')]['id'][_0xac1a('0x2e')],'name':_0x2c9920[_0xac1a('0x2d')][_0xac1a('0x1c')][_0xac1a('0x2e')],'phone':_0x2c9920[_0xac1a('0x2d')][_0xac1a('0x35')][_0xac1a('0x2e')]});}}else{logger[_0xac1a('0xe')](_0xac1a('0x38'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x157b9c['id'],'module_name':_0xac1a('0x1a'),'name_value_list':[{'name':_0xac1a('0x39'),'value':_0x131d76!==''?_0x131d76:util[_0xac1a('0x25')](_0xac1a('0x3a'),_0x12a3cb)},{'name':_0xac1a('0x35'),'value':_0x12a3cb}]})}})[_0xac1a('0x2b')](function(_0x3803d2){logger[_0xac1a('0xe')](_0xac1a('0x3b'));return BPromise['resolve']({'id':_0x3803d2['id'],'name':_0x3803d2['entry_list']['first_name'][_0xac1a('0x2e')],'phone':_0x3803d2[_0xac1a('0x2c')][_0xac1a('0x35')]['value']});});}});}function request(_0x400ef2){logger[_0xac1a('0x3c')](_0xac1a('0x3d'),JSON['stringify'](_0x400ef2));return rp(_[_0xac1a('0x3e')](def,_0x400ef2));}function getTags(_0x39a647,_0x2ed272){var _0x2ccf4c=[];if(_0x39a647&&_0x39a647['length']>0x0){_0x2ccf4c=_[_0xac1a('0x3f')](_0x39a647,_0x2ed272);}return _0x2ccf4c;}function getCustomFields(_0xac2e85,_0x17ca44){var _0x2a2d39=[];var _0x32a8e2={'custom_fields':[]};if(_0xac2e85[_0xac1a('0x1d')]>0x0){_[_0xac1a('0x1e')](_0xac2e85,function(_0x2b5351){if(_0x2b5351[_0xac1a('0x40')]===_0xac1a('0x41')&&_0x2b5351[_0xac1a('0x42')]&&!_0x2b5351[_0xac1a('0x43')]){_0x32a8e2[_0x2b5351[_0xac1a('0x42')][_0xac1a('0x44')]()]=_0x2b5351['content'][_0xac1a('0x45')]();}else if(_0x2b5351[_0xac1a('0x40')]===_0xac1a('0x41')&&_0x2b5351[_0xac1a('0x21')]&&_0x2b5351[_0xac1a('0x43')]){_0x32a8e2[_0xac1a('0x46')][_0xac1a('0x20')]({'id':_0x2b5351['idField'],'value':_0x2b5351[_0xac1a('0x47')]['toString']()});}else if(_0x2b5351[_0xac1a('0x40')]===_0xac1a('0x48')&&_0x2b5351['variableName']&&_0x2b5351[_0xac1a('0x21')]&&_0x2b5351[_0xac1a('0x43')]){_0x17ca44[_0x2b5351[_0xac1a('0x1f')]]&&_0x32a8e2[_0xac1a('0x46')][_0xac1a('0x20')]({'id':_0x2b5351[_0xac1a('0x21')],'value':_0x17ca44[_0x2b5351['variableName']][_0xac1a('0x45')]()});}else if(_0x2b5351[_0xac1a('0x40')]==='customVariable'&&_0x2b5351['Variable']&&_0x2b5351[_0xac1a('0x49')][_0xac1a('0x1c')]&&_0x2b5351[_0xac1a('0x21')]&&_0x2b5351[_0xac1a('0x43')]){_0x17ca44[_0x2b5351['Variable'][_0xac1a('0x1c')]['toLowerCase']()]&&_0x32a8e2['custom_fields'][_0xac1a('0x20')]({'id':_0x2b5351['idField'],'value':_0x17ca44[_0x2b5351[_0xac1a('0x49')][_0xac1a('0x1c')][_0xac1a('0x44')]()][_0xac1a('0x45')]()});}});}return _0x32a8e2;}function getConnection(_0x5f6c64){return request({'method':'POST','form':{'method':_0xac1a('0x4a'),'input_type':'JSON','response_type':_0xac1a('0x22'),'rest_data':JSON[_0xac1a('0x23')]({'user_auth':{'user_name':_0x5f6c64[_0xac1a('0x4b')],'password':_0x5f6c64[_0xac1a('0x4c')],'encryption':'PLAIN'},'application':_0xac1a('0x4d')})}})[_0xac1a('0x2b')](function(_0xe868ee){var _0x1ca9d3=_0xe868ee;if(_0x1ca9d3['id']){def[_0xac1a('0x4e')]=_0x1ca9d3['id'];return BPromise[_0xac1a('0x2f')](_0x1ca9d3);}else{throw new Error(util[_0xac1a('0x25')](_0xac1a('0x4f'),_0x5f6c64['id']));}});}function setRelationship(_0x435760,_0x49a968,_0xc8bab,_0x4ced86){return request({'form':{'method':_0xac1a('0x50'),'input_type':_0xac1a('0x22'),'response_type':_0xac1a('0x22'),'rest_data':JSON['stringify']({'session':_0x435760['id'],'module_name':_0xac1a('0x24'),'module_id':_0xc8bab['id'],'link_field_name':_0x4ced86,'related_ids':[_0x49a968['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5f2661,_0x145c30,_0x1cc1ed,_0x2344e0,_0x378255,_0x51ca48){var _0x38243d,_0x23b4e7,_0x47b0ab,_0x48e698;_0x51ca48[_0xac1a('0x51')]=intUtil[_0xac1a('0x52')](_0x51ca48[_0xac1a('0x51')]);_0x51ca48[_0xac1a('0x53')]=intUtil[_0xac1a('0x52')](_0x51ca48[_0xac1a('0x53')]);def[_0xac1a('0x54')]=util['format'](_0xac1a('0x55'),_0x51ca48['remoteUri']);if(_0x378255&&_0x378255[_0xac1a('0x56')]){logger[_0xac1a('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x145c30[_0xac1a('0x57')]=util[_0xac1a('0x25')](_0xac1a('0x58'),_0x51ca48['serverUrl'],_0x145c30['uniqueid'],md5(_0x145c30[_0xac1a('0x59')]));}else{_0x145c30[_0xac1a('0x57')]='';}return getConnection(_0x51ca48)[_0xac1a('0x2b')](function(_0x25cdc7){_0x48e698=_0x25cdc7;return getUser(_0x51ca48,_0x2344e0[_0xac1a('0x1c')],_0x48e698);})[_0xac1a('0x2b')](function(_0x372a1){_0x38243d=_0x372a1;logger['info'](_0xac1a('0x5a'),_0x38243d['id']);return getEndUser(_0x51ca48,_0x145c30[_0xac1a('0x5b')],_0x145c30[_0xac1a('0x5c')],_0x48e698);})[_0xac1a('0x2b')](function(_0xba6e77){_0x23b4e7=_0xba6e77;logger['info'](_0xac1a('0x5d'),_0x23b4e7['id']);return getTicket(_0x51ca48,_0x38243d,_0x23b4e7,_0x1cc1ed,_0x145c30,_0x1cc1ed[_0xac1a('0x5e')],_0x48e698,_0xac1a('0x5f'));})['then'](function(_0x3ee70c){_0x47b0ab=_0x3ee70c;logger[_0xac1a('0xe')]('Ticket\x20created!');logger[_0xac1a('0xe')]('The\x20Ticket\x20ID\x20is:',_0x47b0ab['id']);return setRelationship(_0x48e698,_0x38243d,_0x47b0ab,_0xac1a('0x60'));})[_0xac1a('0x2b')](function(){return setRelationship(_0x48e698,_0x23b4e7,_0x47b0ab,_0xac1a('0x61'));})[_0xac1a('0x2b')](function(){return getServerInfo(_0x48e698);})[_0xac1a('0x2b')](function(_0x1a58cb){var _0x261481=parseInt(_0x1a58cb[_0xac1a('0x62')][_0xac1a('0x63')](0x0));var _0x411474=util[_0xac1a('0x25')](_0xac1a('0x64'),_0x51ca48['remoteUri'],_0x47b0ab['id']);if(_0x261481>0x6){_0x411474=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x51ca48['remoteUri'],_0x47b0ab['id']);}logger[_0xac1a('0xe')](_0xac1a('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xac1a('0x66'),_0x2344e0[_0xac1a('0x1c')]),'trigger:browser:url',{'uri':_0x411474});})['catch'](function(_0x201531){logger[_0xac1a('0x67')](_0xac1a('0x65'),JSON['stringify'](_0x201531));});};exports[_0xac1a('0x68')]=function(_0x16c982,_0x921df2,_0x3fd84f,_0x3f6205,_0x433e63,_0x34525b,_0x21935c){var _0x2b0561,_0x5461de,_0x550fbb,_0xc05f75;_0x34525b[_0xac1a('0x51')]=intUtil[_0xac1a('0x52')](_0x34525b[_0xac1a('0x51')]);_0x34525b[_0xac1a('0x53')]=intUtil['stripTrailingSlash'](_0x34525b['serverUrl']);def[_0xac1a('0x54')]=util[_0xac1a('0x25')](_0xac1a('0x55'),_0x34525b[_0xac1a('0x51')]);if(_0x21935c&&_0x21935c[_0xac1a('0x69')]&&_0x21935c['recordingFormat']!==_0xac1a('0x6a')){logger['info'](_0xac1a('0x6b'),_0xac1a('0x6c'));_0x921df2[_0xac1a('0x57')]=util[_0xac1a('0x25')](_0xac1a('0x58'),_0x34525b[_0xac1a('0x53')],_0x921df2['uniqueid'],md5(_0x921df2[_0xac1a('0x59')]));}return getConnection(_0x34525b)[_0xac1a('0x2b')](function(_0x5ca147){_0xc05f75=_0x5ca147;return getUser(_0x34525b,_0x3f6205[_0xac1a('0x1c')],_0xc05f75);})[_0xac1a('0x2b')](function(_0x3fc312){_0x2b0561=_0x3fc312;logger[_0xac1a('0xe')](_0xac1a('0x5a'),_0x2b0561['id']);return getEndUser(_0x34525b,_0x921df2[_0xac1a('0x6d')],_0x921df2[_0xac1a('0x6e')],_0xc05f75);})[_0xac1a('0x2b')](function(_0xf5640f){_0x5461de=_0xf5640f;logger[_0xac1a('0xe')](_0xac1a('0x5d'),_0x5461de['id']);return getTicket(_0x34525b,_0x2b0561,_0x5461de,_0x3fd84f,_0x921df2,_0x3fd84f[_0xac1a('0x5e')],_0xc05f75,'Outbound');})[_0xac1a('0x2b')](function(_0x28bfc0){_0x550fbb=_0x28bfc0;logger[_0xac1a('0xe')](_0xac1a('0x6f'));logger[_0xac1a('0xe')]('The\x20Ticket\x20ID\x20is:',_0x550fbb['id']);return setRelationship(_0xc05f75,_0x2b0561,_0x550fbb,_0xac1a('0x60'));})[_0xac1a('0x2b')](function(){return setRelationship(_0xc05f75,_0x5461de,_0x550fbb,_0xac1a('0x61'));})[_0xac1a('0x2b')](function(){return getServerInfo(_0xc05f75);})[_0xac1a('0x2b')](function(_0xf00d20){var _0x418300=parseInt(_0xf00d20['version']['charAt'](0x0));var _0x1e3317=util['format'](_0xac1a('0x64'),_0x34525b[_0xac1a('0x51')],_0x550fbb['id']);if(_0x418300>0x6){_0x1e3317=util[_0xac1a('0x25')](_0xac1a('0x70'),_0x34525b['remoteUri'],_0x550fbb['id']);}logger['info'](_0xac1a('0x6b'),_0xac1a('0x71'));emit(util[_0xac1a('0x25')](_0xac1a('0x66'),_0x3f6205['name']),_0xac1a('0x72'),{'uri':_0x1e3317});})[_0xac1a('0x73')](function(_0x2a8713){logger[_0xac1a('0x67')](_0xac1a('0x6b'),JSON[_0xac1a('0x23')](_0x2a8713));});};exports[_0xac1a('0x74')]=function(_0x4df464,_0x221171,_0x19e3ca,_0x2b1510,_0xe605d4,_0xf83b66){var _0x645dd5,_0x16ced4,_0x100c67,_0x2db989;_0xf83b66['remoteUri']=intUtil[_0xac1a('0x52')](_0xf83b66[_0xac1a('0x51')]);_0xf83b66[_0xac1a('0x53')]=intUtil[_0xac1a('0x52')](_0xf83b66[_0xac1a('0x53')]);def[_0xac1a('0x54')]=util[_0xac1a('0x25')](_0xac1a('0x55'),_0xf83b66[_0xac1a('0x51')]);if(_0xe605d4&&_0xe605d4[_0xac1a('0x56')]){logger['info']('['+_0x221171['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x221171[_0xac1a('0x57')]=util[_0xac1a('0x25')](_0xac1a('0x58'),_0xf83b66[_0xac1a('0x53')],_0x221171[_0xac1a('0x59')],md5(_0x221171['uniqueid']));}else{_0x221171['recordingURL']='';}return getConnection(_0xf83b66)[_0xac1a('0x2b')](function(_0x30c994){_0x2db989=_0x30c994;if(!_[_0xac1a('0x27')](_0x2b1510)){return getUser(_0xf83b66,_0x2b1510[_0xac1a('0x1c')],_0x2db989);}else{return getUser(_0xf83b66,null,_0x2db989);}})[_0xac1a('0x2b')](function(_0x29363e){_0x645dd5=_0x29363e;logger[_0xac1a('0xe')](_0xac1a('0x5a'),_0x645dd5['id']);return getEndUser(_0xf83b66,_0x221171['calleridname'],_0x221171[_0xac1a('0x5c')],_0x2db989);})[_0xac1a('0x2b')](function(_0x3000b0){_0x16ced4=_0x3000b0;logger[_0xac1a('0xe')](_0xac1a('0x5d'),_0x16ced4['id']);return getTicket(_0xf83b66,_0x645dd5,_0x16ced4,_0x19e3ca,_0x221171,_0x19e3ca['Fields'],_0x2db989,_0xac1a('0x5f'));})[_0xac1a('0x2b')](function(_0x268534){_0x100c67=_0x268534;logger[_0xac1a('0xe')](_0xac1a('0x6f'));logger[_0xac1a('0xe')](_0xac1a('0x75'),_0x100c67['id']);return setRelationship(_0x2db989,_0x645dd5,_0x100c67,_0xac1a('0x60'));})[_0xac1a('0x2b')](function(){return setRelationship(_0x2db989,_0x16ced4,_0x100c67,'contacts');})[_0xac1a('0x2b')](function(){return getServerInfo(_0x2db989);})[_0xac1a('0x73')](function(_0xa6de9a){logger['error']('['+_0x221171[_0xac1a('0x76')][_0xac1a('0x77')]()+']',JSON[_0xac1a('0x23')](_0xa6de9a));});}; \ 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 d085e2c..ad54464 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 _0xe6a5=['push','content','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash','substring','lastIndexOf','test','lodash','util','getString','sortBy','length','type','string'];(function(_0xff1a1,_0x3616f5){var _0x391159=function(_0x10f12d){while(--_0x10f12d){_0xff1a1['push'](_0xff1a1['shift']());}};_0x391159(++_0x3616f5);}(_0xe6a5,0x122));var _0x5e6a=function(_0x5988ff,_0x31d957){_0x5988ff=_0x5988ff-0x0;var _0x5742e4=_0xe6a5[_0x5988ff];return _0x5742e4;};'use strict';var _=require(_0x5e6a('0x0'));var util=require(_0x5e6a('0x1'));exports[_0x5e6a('0x2')]=function(_0x5c4af1,_0x52e4d5,_0x5de1ea){var _0xd07178=[];if(_0x5c4af1['length']>0x0){var _0x322749=_[_0x5e6a('0x3')](_0x5c4af1,['id']);for(var _0x5082a6=0x0;_0x5082a6<_0x322749[_0x5e6a('0x4')];_0x5082a6++){var _0x4bfcb6=_0x322749[_0x5082a6];if(_0x4bfcb6[_0x5e6a('0x5')]===_0x5e6a('0x6')){_0xd07178[_0x5e6a('0x7')](_0x4bfcb6[_0x5e6a('0x8')]);}else if(_0x4bfcb6[_0x5e6a('0x5')]===_0x5e6a('0x9')&&_0x4bfcb6['variableName']){_0x52e4d5[_0x4bfcb6['variableName']]&&_0xd07178['push'](_0x52e4d5[_0x4bfcb6[_0x5e6a('0xa')]]['toString']());}else if(_0x4bfcb6[_0x5e6a('0x5')]==='customVariable'&&_0x4bfcb6[_0x5e6a('0xb')]&&_0x4bfcb6[_0x5e6a('0xb')][_0x5e6a('0xc')]){_0x52e4d5[_0x4bfcb6['Variable']['name'][_0x5e6a('0xd')]()]&&_0xd07178[_0x5e6a('0x7')](_0x52e4d5[_0x4bfcb6[_0x5e6a('0xb')][_0x5e6a('0xc')]['toLowerCase']()][_0x5e6a('0xe')]());}else if(_0x4bfcb6[_0x5e6a('0x5')]===_0x5e6a('0xf')){if(_0x4bfcb6[_0x5e6a('0x10')]===_0x5e6a('0x6')&&_0x4bfcb6[_0x5e6a('0x11')]){_0xd07178[_0x5e6a('0x7')](util[_0x5e6a('0x12')](_0x5e6a('0x13'),_0x4bfcb6[_0x5e6a('0x11')],_0x4bfcb6[_0x5e6a('0x14')]));}else if(_0x4bfcb6[_0x5e6a('0x10')]==='variable'&&_0x4bfcb6[_0x5e6a('0xa')]&&_0x4bfcb6[_0x5e6a('0x11')]){_0x52e4d5[_0x4bfcb6[_0x5e6a('0xa')]]&&_0xd07178[_0x5e6a('0x7')](util['format']('%s:\x20%s',_0x4bfcb6[_0x5e6a('0x11')],_0x52e4d5[_0x4bfcb6['variableName']]));}else if(_0x4bfcb6['keyType']===_0x5e6a('0x15')&&_0x4bfcb6[_0x5e6a('0xb')]&&_0x4bfcb6[_0x5e6a('0xb')]['name']&&_0x4bfcb6[_0x5e6a('0x11')]){_0x52e4d5[_0x4bfcb6[_0x5e6a('0xb')]['name'][_0x5e6a('0xd')]()]&&_0xd07178['push'](util['format'](_0x5e6a('0x13'),_0x4bfcb6[_0x5e6a('0x11')],_0x52e4d5[_0x4bfcb6[_0x5e6a('0xb')][_0x5e6a('0xc')][_0x5e6a('0xd')]()]));}}}}return _0xd07178[_0x5e6a('0x16')](_0x5de1ea);};exports[_0x5e6a('0x17')]=function(_0x2b6e0f){var _0x5cd265=_0x2b6e0f['slice'](-0x1);if(_0x5cd265==='/'){_0x2b6e0f=_0x2b6e0f[_0x5e6a('0x18')](0x0,_0x2b6e0f[_0x5e6a('0x19')](_0x5cd265));}return _0x2b6e0f;};exports['validateEmail']=function(_0x19b3a9){if(!_['isNil'](_0x19b3a9)&&_0x19b3a9!==''){var _0x4225cd=/^(([^<>()\[\]\\.,;:\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 _0x4225cd[_0x5e6a('0x1a')](String(_0x19b3a9)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x6e54=['content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','format','%s:\x20%s','key','keyContent','keyType','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','getString','length','sortBy','type','string','push'];(function(_0x4c76d8,_0x116cd0){var _0x506d91=function(_0xce25a7){while(--_0xce25a7){_0x4c76d8['push'](_0x4c76d8['shift']());}};_0x506d91(++_0x116cd0);}(_0x6e54,0x18a));var _0x46e5=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x6e54[_0x5a2285];return _0x48f6ed;};'use strict';var _=require('lodash');var util=require('util');exports[_0x46e5('0x0')]=function(_0x2e04d4,_0x165b60,_0x7e30b9){var _0x37ac82=[];if(_0x2e04d4[_0x46e5('0x1')]>0x0){var _0x31efc9=_[_0x46e5('0x2')](_0x2e04d4,['id']);for(var _0x34a09c=0x0;_0x34a09c<_0x31efc9[_0x46e5('0x1')];_0x34a09c++){var _0x513708=_0x31efc9[_0x34a09c];if(_0x513708[_0x46e5('0x3')]===_0x46e5('0x4')){_0x37ac82[_0x46e5('0x5')](_0x513708[_0x46e5('0x6')]);}else if(_0x513708[_0x46e5('0x3')]===_0x46e5('0x7')&&_0x513708[_0x46e5('0x8')]){_0x165b60[_0x513708[_0x46e5('0x8')]]&&_0x37ac82[_0x46e5('0x5')](_0x165b60[_0x513708['variableName']][_0x46e5('0x9')]());}else if(_0x513708[_0x46e5('0x3')]===_0x46e5('0xa')&&_0x513708[_0x46e5('0xb')]&&_0x513708[_0x46e5('0xb')][_0x46e5('0xc')]){_0x165b60[_0x513708[_0x46e5('0xb')][_0x46e5('0xc')][_0x46e5('0xd')]()]&&_0x37ac82['push'](_0x165b60[_0x513708['Variable'][_0x46e5('0xc')][_0x46e5('0xd')]()]['toString']());}else if(_0x513708[_0x46e5('0x3')]==='keyValue'){if(_0x513708['keyType']===_0x46e5('0x4')&&_0x513708['key']){_0x37ac82[_0x46e5('0x5')](util[_0x46e5('0xe')](_0x46e5('0xf'),_0x513708[_0x46e5('0x10')],_0x513708[_0x46e5('0x11')]));}else if(_0x513708[_0x46e5('0x12')]===_0x46e5('0x7')&&_0x513708[_0x46e5('0x8')]&&_0x513708['key']){_0x165b60[_0x513708[_0x46e5('0x8')]]&&_0x37ac82[_0x46e5('0x5')](util[_0x46e5('0xe')](_0x46e5('0xf'),_0x513708[_0x46e5('0x10')],_0x165b60[_0x513708[_0x46e5('0x8')]]));}else if(_0x513708[_0x46e5('0x12')]==='customVariable'&&_0x513708[_0x46e5('0xb')]&&_0x513708['Variable']['name']&&_0x513708[_0x46e5('0x10')]){_0x165b60[_0x513708['Variable']['name'][_0x46e5('0xd')]()]&&_0x37ac82['push'](util[_0x46e5('0xe')]('%s:\x20%s',_0x513708[_0x46e5('0x10')],_0x165b60[_0x513708['Variable'][_0x46e5('0xc')][_0x46e5('0xd')]()]));}}}}return _0x37ac82['join'](_0x7e30b9);};exports[_0x46e5('0x13')]=function(_0x4c56f4){var _0x5e6e78=_0x4c56f4[_0x46e5('0x14')](-0x1);if(_0x5e6e78==='/'){_0x4c56f4=_0x4c56f4[_0x46e5('0x15')](0x0,_0x4c56f4[_0x46e5('0x16')](_0x5e6e78));}return _0x4c56f4;};exports['validateEmail']=function(_0x43ffcf){if(!_[_0x46e5('0x17')](_0x43ffcf)&&_0x43ffcf!==''){var _0x73c65=/^(([^<>()\[\]\\.,;:\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 _0x73c65[_0x46e5('0x18')](String(_0x43ffcf)['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 33f3ec7..5db285c 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 _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(_0x5505a6,_0x3ecff8){var _0x95632=function(_0x5a8b33){while(--_0x5a8b33){_0x5505a6['push'](_0x5505a6['shift']());}};_0x95632(++_0x3ecff8);}(_0xe706,0xa3));var _0x6e70=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xe706[_0x445101];return _0x3c3d04;};'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 +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(_0x281a3b,_0x1df435){var _0x387721=function(_0x3efe71){while(--_0x3efe71){_0x281a3b['push'](_0x281a3b['shift']());}};_0x387721(++_0x1df435);}(_0xe706,0xa3));var _0x6e70=function(_0x58e2a5,_0x4e822c){_0x58e2a5=_0x58e2a5-0x0;var _0x440ba0=_0xe706[_0x58e2a5];return _0x440ba0;};'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 4f50670..442bb7f 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 _0x44a1=['calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','results','end-user','first','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','custom_fields','variable','variableName','customVariable','Variable','push','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname'];(function(_0xc9ba3f,_0x2e4836){var _0x41bf87=function(_0x4f985b){while(--_0x4f985b){_0xc9ba3f['push'](_0xc9ba3f['shift']());}};_0x41bf87(++_0x2e4836);}(_0x44a1,0x1e6));var _0x144a=function(_0xcf9bf2,_0x2845af){_0xcf9bf2=_0xcf9bf2-0x0;var _0x60d46c=_0x44a1[_0xcf9bf2];return _0x60d46c;};'use strict';var _=require(_0x144a('0x0'));var rp=require(_0x144a('0x1'));var md5=require(_0x144a('0x2'));var util=require(_0x144a('0x3'));var Redis=require(_0x144a('0x4'));var intUtil=require(_0x144a('0x5'));var config=require(_0x144a('0x6'));var logger=require('../../../../config/logger')(_0x144a('0x7'));config['redis']=_[_0x144a('0x8')](config[_0x144a('0x9')],{'host':_0x144a('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x32066a,_0x4b9b7b,_0x368f62){io['to'](_0x32066a)[_0x144a('0xb')](_0x4b9b7b,_0x368f62);}var headers={'Content-Type':_0x144a('0xc'),'Accept':_0x144a('0xc')};function getTicket(_0x14a1be,_0x38e1b0,_0x3333ef,_0x159c7d,_0x21d981){logger[_0x144a('0xd')](_0x144a('0xe'));return request({'uri':util[_0x144a('0xf')](_0x144a('0x10'),_0x14a1be[_0x144a('0x11')]),'method':_0x144a('0x12'),'body':{'ticket':_[_0x144a('0x13')]({'requester_id':_0x3333ef['id'],'submitter_id':_0x38e1b0?_0x38e1b0['id']:undefined,'assignee_id':_0x38e1b0?_0x38e1b0['id']:undefined,'tags':getTags(_0x159c7d[_0x144a('0x14')],_0x144a('0x15')),'subject':intUtil[_0x144a('0x16')](_0x159c7d[_0x144a('0x17')],_0x21d981,'\x20'),'description':intUtil['getString'](_0x159c7d[_0x144a('0x18')],_0x21d981,'\x0a'),'comment':{'public':![],'body':intUtil[_0x144a('0x16')](_0x159c7d['Descriptions'],_0x21d981,'\x0a')}},getCustomFields(_0x159c7d[_0x144a('0x19')],_0x21d981))}})[_0x144a('0x1a')](function(_0x1e1275){logger[_0x144a('0xd')](_0x144a('0x1b'));return _0x1e1275[_0x144a('0x1c')];});}function getUser(_0x15b75b,_0x26d37c){if(intUtil[_0x144a('0x1d')](_0x26d37c)){logger['info'](_0x144a('0x1e'),_0x26d37c);return request({'uri':util[_0x144a('0xf')](_0x144a('0x1f'),_0x15b75b[_0x144a('0x11')]),'qs':{'query':util[_0x144a('0xf')](_0x144a('0x20'),_0x26d37c)}})[_0x144a('0x1a')](function(_0x368f5a){if(_0x368f5a[_0x144a('0x21')]){logger['info'](_0x144a('0x22'));return _[_0x144a('0x23')](_0x368f5a['results'],{'email':_0x26d37c,'role':_0x144a('0x24')});}else{logger['info'](_0x144a('0x25'));return request({'uri':util[_0x144a('0xf')](_0x144a('0x26'),_0x15b75b[_0x144a('0x11')])})[_0x144a('0x1a')](function(_0x3528f0){logger[_0x144a('0xd')]('Admin\x20account\x20selected.');return _0x3528f0[_0x144a('0x27')];});}});}else{logger[_0x144a('0xd')](_0x144a('0x25'));return request({'uri':util[_0x144a('0xf')](_0x144a('0x26'),_0x15b75b['remoteUri'])})[_0x144a('0x1a')](function(_0x19c952){logger[_0x144a('0xd')]('Admin\x20account\x20selected.');return _0x19c952[_0x144a('0x27')];});}}function getEndUser(_0x235885,_0x19a5e5,_0x2e1ff5){logger[_0x144a('0xd')](_0x144a('0x28'),_0x2e1ff5);return request({'uri':util[_0x144a('0xf')]('%s/search.json',_0x235885['remoteUri']),'qs':{'query':util[_0x144a('0xf')](_0x144a('0x29'),_0x2e1ff5)}})[_0x144a('0x1a')](function(_0x56b3f2){var _0x102b62;if(_0x56b3f2['results'][_0x144a('0x2a')]){_0x56b3f2['results']=_[_0x144a('0x2b')](_0x56b3f2[_0x144a('0x2c')],{'suspended':![],'role':_0x144a('0x2d')});if(_0x56b3f2[_0x144a('0x2c')]['length']){_0x102b62=_[_0x144a('0x2e')](_0x56b3f2[_0x144a('0x2c')]);}}if(_0x102b62){logger['info']('Enduser\x20found!');return _0x102b62;}else{logger[_0x144a('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x144a('0xf')](_0x144a('0x2f'),_0x235885[_0x144a('0x11')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0x144a('0x30'),_0x19a5e5||_0x2e1ff5),'phone':_0x2e1ff5}}})['then'](function(_0x404d1e){logger[_0x144a('0xd')](_0x144a('0x31'));return _0x404d1e[_0x144a('0x27')];});}});}function getAuth(_0xfb0584){var _0xc48ce6;if(_0xfb0584[_0x144a('0x32')]===_0x144a('0x33')){_0xc48ce6=util[_0x144a('0xf')]('%s:%s',_0xfb0584[_0x144a('0x34')],_0xfb0584[_0x144a('0x33')]);}else if(_0xfb0584[_0x144a('0x32')]===_0x144a('0x35')){_0xc48ce6=util['format'](_0x144a('0x36'),_0xfb0584[_0x144a('0x34')],_0xfb0584[_0x144a('0x35')]);}return util[_0x144a('0xf')](_0x144a('0x37'),new Buffer(_0xc48ce6)[_0x144a('0x38')](_0x144a('0x39')));}function request(_0x3feb09){logger['debug'](_0x144a('0x3a'),JSON[_0x144a('0x3b')](_0x3feb09));return rp(_['defaults'](_0x3feb09,{'method':_0x144a('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x5b9581,_0x7523ba){var _0x55b9fa=[];if(_0x5b9581&&_0x5b9581[_0x144a('0x2a')]>0x0){_0x55b9fa=_[_0x144a('0x3d')](_0x5b9581,_0x7523ba);}return _0x55b9fa;}function getCustomFields(_0x4e266e,_0x62e1d0){var _0x3fc133=[];var _0x5de509={'custom_fields':[]};if(_0x4e266e[_0x144a('0x2a')]>0x0){_[_0x144a('0x3e')](_0x4e266e,function(_0x20f5c3){if(_[_0x144a('0x3f')]([_0x144a('0x40'),'picklist'],_0x20f5c3[_0x144a('0x41')])&&_0x20f5c3[_0x144a('0x42')]&&!_0x20f5c3[_0x144a('0x43')]){_0x5de509[_0x20f5c3[_0x144a('0x42')][_0x144a('0x44')]()]=_0x20f5c3[_0x144a('0x45')][_0x144a('0x38')]();}else if(_[_0x144a('0x3f')]([_0x144a('0x40'),_0x144a('0x46')],_0x20f5c3[_0x144a('0x41')])&&_0x20f5c3[_0x144a('0x47')]&&_0x20f5c3[_0x144a('0x43')]){_0x5de509[_0x144a('0x48')]['push']({'id':_0x20f5c3[_0x144a('0x47')],'value':_0x20f5c3[_0x144a('0x45')][_0x144a('0x38')]()});}else if(_0x20f5c3['type']===_0x144a('0x49')&&_0x20f5c3[_0x144a('0x4a')]&&_0x20f5c3[_0x144a('0x47')]&&_0x20f5c3[_0x144a('0x43')]){_0x62e1d0[_0x20f5c3[_0x144a('0x4a')]]&&_0x5de509[_0x144a('0x48')]['push']({'id':_0x20f5c3[_0x144a('0x47')],'value':_0x62e1d0[_0x20f5c3[_0x144a('0x4a')]][_0x144a('0x38')]()});}else if(_0x20f5c3[_0x144a('0x41')]===_0x144a('0x4b')&&_0x20f5c3[_0x144a('0x4c')]&&_0x20f5c3['Variable'][_0x144a('0x15')]&&_0x20f5c3[_0x144a('0x47')]&&_0x20f5c3['customField']){_0x62e1d0[_0x20f5c3[_0x144a('0x4c')][_0x144a('0x15')][_0x144a('0x44')]()]&&_0x5de509[_0x144a('0x48')][_0x144a('0x4d')]({'id':_0x20f5c3['idField'],'value':_0x62e1d0[_0x20f5c3['Variable'][_0x144a('0x15')]['toLowerCase']()]['toString']()});}});}return _0x5de509;}exports[_0x144a('0x4e')]=function(_0x14b798,_0x5e13fe,_0x48bc6f,_0x560c9e,_0x27d5bb,_0xf05fa5){var _0x1f4cb6,_0x198bd0;_0xf05fa5['remoteUri']=intUtil['stripTrailingSlash'](_0xf05fa5[_0x144a('0x11')]);_0xf05fa5[_0x144a('0x4f')]=intUtil[_0x144a('0x50')](_0xf05fa5[_0x144a('0x4f')]);if(_0x27d5bb&&_0x27d5bb[_0x144a('0x51')]){logger['info'](_0x144a('0x52'),_0x144a('0x53'));_0x5e13fe[_0x144a('0x54')]=util[_0x144a('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf05fa5[_0x144a('0x4f')],_0x5e13fe[_0x144a('0x55')],md5(_0x5e13fe[_0x144a('0x55')]));}else{_0x5e13fe[_0x144a('0x54')]='';}headers['Authorization']=getAuth(_0xf05fa5);return getUser(_0xf05fa5,_0x560c9e[_0x144a('0x56')])['then'](function(_0x572f33){_0x1f4cb6=_0x572f33;logger[_0x144a('0xd')](_0x144a('0x57'),_0x1f4cb6['id']);return getEndUser(_0xf05fa5,_0x5e13fe[_0x144a('0x58')],_0x5e13fe[_0x144a('0x59')]);})['then'](function(_0x2b1e82){_0x198bd0=_0x2b1e82;logger[_0x144a('0xd')](_0x144a('0x5a'),_0x198bd0['id']);return getTicket(_0xf05fa5,_0x1f4cb6,_0x198bd0,_0x48bc6f,_0x5e13fe);})[_0x144a('0x1a')](function(_0x39677f){if(_0x39677f){logger[_0x144a('0xd')](_0x144a('0x5b'),_0x39677f['id']);switch(_0xf05fa5[_0x144a('0x41')]){case _0x144a('0x5c'):logger['info'](_0x144a('0x52'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x144a('0xf')](_0x144a('0x5d'),_0xf05fa5[_0x144a('0x11')],_0x1f4cb6['id'],_0x39677f['id']),'method':'POST'});case _0x144a('0x5e'):logger[_0x144a('0xd')]('[QUEUE]',_0x144a('0x5f'));emit(util[_0x144a('0xf')](_0x144a('0x60'),_0x560c9e[_0x144a('0x15')]),'trigger:browser:url',{'uri':util[_0x144a('0xf')]('%s/agent/tickets/%s',_0xf05fa5[_0x144a('0x11')][_0x144a('0x61')]('/api/v2',''),_0x39677f['id'])});break;default:logger[_0x144a('0x62')](_0x144a('0x52'),_0x144a('0x63'));}}})[_0x144a('0x64')](function(_0x1de878){logger[_0x144a('0x62')](_0x144a('0x65'),util[_0x144a('0x66')](_0x1de878,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3321f8,_0x18c456,_0x31c14e,_0x4b4011,_0x1e3312,_0x33d93e,_0x4fb7e6){var _0x15fdbd,_0x223510;_0x33d93e[_0x144a('0x11')]=intUtil[_0x144a('0x50')](_0x33d93e[_0x144a('0x11')]);_0x33d93e[_0x144a('0x4f')]=intUtil[_0x144a('0x50')](_0x33d93e[_0x144a('0x4f')]);if(_0x4fb7e6&&_0x4fb7e6[_0x144a('0x67')]&&_0x4fb7e6[_0x144a('0x67')]!==_0x144a('0x68')){logger[_0x144a('0xd')](_0x144a('0x69'),_0x144a('0x53'));_0x18c456['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x33d93e[_0x144a('0x4f')],_0x18c456[_0x144a('0x55')],md5(_0x18c456[_0x144a('0x55')]));}headers[_0x144a('0x6a')]=getAuth(_0x33d93e);return getUser(_0x33d93e,_0x4b4011[_0x144a('0x56')])[_0x144a('0x1a')](function(_0x31d0e3){_0x15fdbd=_0x31d0e3;logger[_0x144a('0xd')]('The\x20User\x20ID\x20is:',_0x15fdbd['id']);return getEndUser(_0x33d93e,_0x18c456[_0x144a('0x6b')],_0x18c456[_0x144a('0x6c')]);})[_0x144a('0x1a')](function(_0x2499ba){_0x223510=_0x2499ba;logger['info']('The\x20Enduser\x20ID\x20is:',_0x223510['id']);return getTicket(_0x33d93e,_0x15fdbd,_0x223510,_0x31c14e,_0x18c456);})[_0x144a('0x1a')](function(_0x17530d){if(_0x17530d){logger[_0x144a('0xd')](_0x144a('0x5b'),_0x17530d['id']);switch(_0x33d93e[_0x144a('0x41')]){case'integrationTab':logger[_0x144a('0xd')](_0x144a('0x69'),_0x144a('0x6d'));return request({'uri':util['format'](_0x144a('0x5d'),_0x33d93e[_0x144a('0x11')],_0x15fdbd['id'],_0x17530d['id']),'method':_0x144a('0x12')});case _0x144a('0x5e'):logger[_0x144a('0xd')](_0x144a('0x69'),_0x144a('0x5f'));emit(util[_0x144a('0xf')](_0x144a('0x60'),_0x4b4011[_0x144a('0x15')]),'trigger:browser:url',{'uri':util[_0x144a('0xf')](_0x144a('0x6e'),_0x33d93e[_0x144a('0x11')][_0x144a('0x61')]('/api/v2',''),_0x17530d['id'])});break;default:logger[_0x144a('0x62')](_0x144a('0x69'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x56e6e5){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x56e6e5,{'showHidden':!![],'depth':null}));});};exports[_0x144a('0x6f')]=function(_0x2f01ed,_0x53d56a,_0x2730b5,_0x4a73bd,_0x1bdd49,_0x48de18){var _0x25160f,_0x432dbf;_0x48de18[_0x144a('0x11')]=intUtil['stripTrailingSlash'](_0x48de18[_0x144a('0x11')]);_0x48de18[_0x144a('0x4f')]=intUtil[_0x144a('0x50')](_0x48de18[_0x144a('0x4f')]);if(_0x1bdd49&&_0x1bdd49['monitor_format']){logger['info']('['+_0x53d56a['lastevent']['toUpperCase']()+']',_0x144a('0x53'));_0x53d56a[_0x144a('0x54')]=util['format'](_0x144a('0x70'),_0x48de18[_0x144a('0x4f')],_0x53d56a['uniqueid'],md5(_0x53d56a[_0x144a('0x55')]));}else{_0x53d56a[_0x144a('0x54')]='';}headers['Authorization']=getAuth(_0x48de18);return getUser(_0x48de18)[_0x144a('0x1a')](function(_0x907f98){_0x25160f=_0x907f98;logger['info'](_0x144a('0x57'),_0x25160f['id']);return getEndUser(_0x48de18,_0x53d56a['calleridname'],_0x53d56a[_0x144a('0x59')]);})[_0x144a('0x1a')](function(_0x46fb18){_0x432dbf=_0x46fb18;logger[_0x144a('0xd')](_0x144a('0x5a'),_0x432dbf['id']);return getTicket(_0x48de18,_0x25160f,_0x432dbf,_0x2730b5,_0x53d56a);})[_0x144a('0x1a')](function(_0x43633c){if(_0x43633c){logger[_0x144a('0xd')](_0x144a('0x5b'),_0x43633c['id']);}})['catch'](function(_0x2af700){logger[_0x144a('0x62')]('['+_0x53d56a['lastevent'][_0x144a('0x71')]()+']'+_0x144a('0x72'),util['inspect'](_0x2af700,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x81a5=['The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','[QUEUE]','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','calleridname','error','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','POST','Tags','name','getString','Subjects','Descriptions','Fields','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','format','type:user\x20role:agent\x20email:%s','then','count','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','Enduser\x20found!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','length','forEach','includes','picklist','content','string','idField','customField','push','type','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email'];(function(_0x2ed1ad,_0x1fb8a1){var _0x1deb5e=function(_0x4a5d76){while(--_0x4a5d76){_0x2ed1ad['push'](_0x2ed1ad['shift']());}};_0x1deb5e(++_0x1fb8a1);}(_0x81a5,0x1d7));var _0x581a=function(_0x4006f4,_0x3c0444){_0x4006f4=_0x4006f4-0x0;var _0x45ba18=_0x81a5[_0x4006f4];return _0x45ba18;};'use strict';var _=require(_0x581a('0x0'));var rp=require(_0x581a('0x1'));var md5=require('md5');var util=require(_0x581a('0x2'));var Redis=require(_0x581a('0x3'));var intUtil=require(_0x581a('0x4'));var config=require(_0x581a('0x5'));var logger=require('../../../../config/logger')(_0x581a('0x6'));config[_0x581a('0x7')]=_[_0x581a('0x8')](config[_0x581a('0x7')],{'host':_0x581a('0x9'),'port':0x18eb});var io=require(_0x581a('0xa'))(new Redis(config[_0x581a('0x7')]));function emit(_0x1f56a1,_0x5b4ffb,_0x5912f9){io['to'](_0x1f56a1)['emit'](_0x5b4ffb,_0x5912f9);}var headers={'Content-Type':_0x581a('0xb'),'Accept':'application/json'};function getTicket(_0x59132d,_0x3d6b4b,_0x482b5a,_0x3528f0,_0x23140f){logger['info'](_0x581a('0xc'));return request({'uri':util['format']('%s/tickets.json',_0x59132d['remoteUri']),'method':_0x581a('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x482b5a['id'],'submitter_id':_0x3d6b4b?_0x3d6b4b['id']:undefined,'assignee_id':_0x3d6b4b?_0x3d6b4b['id']:undefined,'tags':getTags(_0x3528f0[_0x581a('0xe')],_0x581a('0xf')),'subject':intUtil[_0x581a('0x10')](_0x3528f0[_0x581a('0x11')],_0x23140f,'\x20'),'description':intUtil[_0x581a('0x10')](_0x3528f0[_0x581a('0x12')],_0x23140f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x581a('0x10')](_0x3528f0['Descriptions'],_0x23140f,'\x0a')}},getCustomFields(_0x3528f0[_0x581a('0x13')],_0x23140f))}})['then'](function(_0x909695){logger[_0x581a('0x14')]('Ticket\x20created!');return _0x909695[_0x581a('0x15')];});}function getUser(_0x4553dc,_0x5f4bab){if(intUtil[_0x581a('0x16')](_0x5f4bab)){logger[_0x581a('0x14')](_0x581a('0x17'),_0x5f4bab);return request({'uri':util['format'](_0x581a('0x18'),_0x4553dc[_0x581a('0x19')]),'qs':{'query':util[_0x581a('0x1a')](_0x581a('0x1b'),_0x5f4bab)}})[_0x581a('0x1c')](function(_0x4ec00e){if(_0x4ec00e[_0x581a('0x1d')]){logger[_0x581a('0x14')]('Agent\x20found!');return _[_0x581a('0x1e')](_0x4ec00e[_0x581a('0x1f')],{'email':_0x5f4bab,'role':'agent'});}else{logger[_0x581a('0x14')](_0x581a('0x20'));return request({'uri':util[_0x581a('0x1a')](_0x581a('0x21'),_0x4553dc[_0x581a('0x19')])})[_0x581a('0x1c')](function(_0x5f53a4){logger['info'](_0x581a('0x22'));return _0x5f53a4[_0x581a('0x23')];});}});}else{logger[_0x581a('0x14')](_0x581a('0x20'));return request({'uri':util['format']('%s/users/me.json',_0x4553dc[_0x581a('0x19')])})['then'](function(_0x1fb40){logger[_0x581a('0x14')]('Admin\x20account\x20selected.');return _0x1fb40[_0x581a('0x23')];});}}function getEndUser(_0x470e96,_0x3082ef,_0xf3c061){logger['info'](_0x581a('0x24'),_0xf3c061);return request({'uri':util[_0x581a('0x1a')](_0x581a('0x18'),_0x470e96['remoteUri']),'qs':{'query':util[_0x581a('0x1a')](_0x581a('0x25'),_0xf3c061)}})[_0x581a('0x1c')](function(_0x49e84f){var _0x3cd9ac;if(_0x49e84f['results']['length']){_0x49e84f[_0x581a('0x1f')]=_[_0x581a('0x26')](_0x49e84f['results'],{'suspended':![],'role':_0x581a('0x27')});if(_0x49e84f['results']['length']){_0x3cd9ac=_['first'](_0x49e84f['results']);}}if(_0x3cd9ac){logger['info'](_0x581a('0x28'));return _0x3cd9ac;}else{logger[_0x581a('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x581a('0x1a')]('%s/users.json',_0x470e96[_0x581a('0x19')]),'method':_0x581a('0xd'),'body':{'user':{'role':_0x581a('0x27'),'name':util['format'](_0x581a('0x29'),_0x3082ef||_0xf3c061),'phone':_0xf3c061}}})['then'](function(_0x416dd7){logger[_0x581a('0x14')]('Enduser\x20created.');return _0x416dd7['user'];});}});}function getAuth(_0x4a193a){var _0x2a3cdc;if(_0x4a193a[_0x581a('0x2a')]===_0x581a('0x2b')){_0x2a3cdc=util[_0x581a('0x1a')](_0x581a('0x2c'),_0x4a193a['username'],_0x4a193a['password']);}else if(_0x4a193a['authType']==='token'){_0x2a3cdc=util[_0x581a('0x1a')]('%s/token:%s',_0x4a193a[_0x581a('0x2d')],_0x4a193a[_0x581a('0x2e')]);}return util[_0x581a('0x1a')](_0x581a('0x2f'),new Buffer(_0x2a3cdc)[_0x581a('0x30')]('base64'));}function request(_0x306738){logger[_0x581a('0x31')](_0x581a('0x32'),JSON[_0x581a('0x33')](_0x306738));return rp(_['defaults'](_0x306738,{'method':_0x581a('0x34'),'headers':headers,'json':!![]}));}function getTags(_0xbdd8e9,_0x2626a2){var _0x50b955=[];if(_0xbdd8e9&&_0xbdd8e9['length']>0x0){_0x50b955=_[_0x581a('0x35')](_0xbdd8e9,_0x2626a2);}return _0x50b955;}function getCustomFields(_0x18d2e2,_0x2fc5f7){var _0x4927af=[];var _0x1d8ca6={'custom_fields':[]};if(_0x18d2e2[_0x581a('0x36')]>0x0){_[_0x581a('0x37')](_0x18d2e2,function(_0x154d97){if(_[_0x581a('0x38')](['string',_0x581a('0x39')],_0x154d97['type'])&&_0x154d97['nameField']&&!_0x154d97['customField']){_0x1d8ca6[_0x154d97['nameField']['toLowerCase']()]=_0x154d97[_0x581a('0x3a')][_0x581a('0x30')]();}else if(_[_0x581a('0x38')]([_0x581a('0x3b'),_0x581a('0x39')],_0x154d97['type'])&&_0x154d97[_0x581a('0x3c')]&&_0x154d97[_0x581a('0x3d')]){_0x1d8ca6['custom_fields'][_0x581a('0x3e')]({'id':_0x154d97[_0x581a('0x3c')],'value':_0x154d97[_0x581a('0x3a')]['toString']()});}else if(_0x154d97[_0x581a('0x3f')]===_0x581a('0x40')&&_0x154d97[_0x581a('0x41')]&&_0x154d97[_0x581a('0x3c')]&&_0x154d97['customField']){_0x2fc5f7[_0x154d97['variableName']]&&_0x1d8ca6[_0x581a('0x42')][_0x581a('0x3e')]({'id':_0x154d97['idField'],'value':_0x2fc5f7[_0x154d97[_0x581a('0x41')]][_0x581a('0x30')]()});}else if(_0x154d97[_0x581a('0x3f')]===_0x581a('0x43')&&_0x154d97[_0x581a('0x44')]&&_0x154d97[_0x581a('0x44')][_0x581a('0xf')]&&_0x154d97[_0x581a('0x3c')]&&_0x154d97[_0x581a('0x3d')]){_0x2fc5f7[_0x154d97[_0x581a('0x44')][_0x581a('0xf')][_0x581a('0x45')]()]&&_0x1d8ca6[_0x581a('0x42')]['push']({'id':_0x154d97[_0x581a('0x3c')],'value':_0x2fc5f7[_0x154d97[_0x581a('0x44')][_0x581a('0xf')]['toLowerCase']()][_0x581a('0x30')]()});}});}return _0x1d8ca6;}exports[_0x581a('0x46')]=function(_0x268c6c,_0x164648,_0x37e6ff,_0x1486bd,_0x1d5d5e,_0x1d9f51){var _0x2f1239,_0x511515;_0x1d9f51[_0x581a('0x19')]=intUtil[_0x581a('0x47')](_0x1d9f51['remoteUri']);_0x1d9f51['serverUrl']=intUtil['stripTrailingSlash'](_0x1d9f51[_0x581a('0x48')]);if(_0x1d5d5e&&_0x1d5d5e['monitor_format']){logger[_0x581a('0x14')]('[QUEUE]',_0x581a('0x49'));_0x164648['recordingURL']=util[_0x581a('0x1a')](_0x581a('0x4a'),_0x1d9f51[_0x581a('0x48')],_0x164648[_0x581a('0x4b')],md5(_0x164648[_0x581a('0x4b')]));}else{_0x164648[_0x581a('0x4c')]='';}headers[_0x581a('0x4d')]=getAuth(_0x1d9f51);return getUser(_0x1d9f51,_0x1486bd[_0x581a('0x4e')])[_0x581a('0x1c')](function(_0x47792b){_0x2f1239=_0x47792b;logger[_0x581a('0x14')](_0x581a('0x4f'),_0x2f1239['id']);return getEndUser(_0x1d9f51,_0x164648['calleridname'],_0x164648[_0x581a('0x50')]);})[_0x581a('0x1c')](function(_0x86d616){_0x511515=_0x86d616;logger[_0x581a('0x14')](_0x581a('0x51'),_0x511515['id']);return getTicket(_0x1d9f51,_0x2f1239,_0x511515,_0x37e6ff,_0x164648);})[_0x581a('0x1c')](function(_0x48d310){if(_0x48d310){logger[_0x581a('0x14')](_0x581a('0x52'),_0x48d310['id']);switch(_0x1d9f51[_0x581a('0x3f')]){case'integrationTab':logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x581a('0x1a')](_0x581a('0x53'),_0x1d9f51[_0x581a('0x19')],_0x2f1239['id'],_0x48d310['id']),'method':_0x581a('0xd')});case'newTab':logger[_0x581a('0x14')]('[QUEUE]',_0x581a('0x54'));emit(util[_0x581a('0x1a')](_0x581a('0x55'),_0x1486bd[_0x581a('0xf')]),_0x581a('0x56'),{'uri':util[_0x581a('0x1a')](_0x581a('0x57'),_0x1d9f51[_0x581a('0x19')][_0x581a('0x58')]('/api/v2',''),_0x48d310['id'])});break;default:logger['error'](_0x581a('0x59'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x581a('0x5a')](function(_0x4f3739){logger['error'](_0x581a('0x5b'),util['inspect'](_0x4f3739,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x341a64,_0x1df420,_0xc8a91b,_0x7d2d67,_0x735304,_0x125d80,_0x4cca24){var _0x55ebba,_0x21a9f7;_0x125d80[_0x581a('0x19')]=intUtil[_0x581a('0x47')](_0x125d80[_0x581a('0x19')]);_0x125d80[_0x581a('0x48')]=intUtil[_0x581a('0x47')](_0x125d80[_0x581a('0x48')]);if(_0x4cca24&&_0x4cca24[_0x581a('0x5c')]&&_0x4cca24['recordingFormat']!==_0x581a('0x5d')){logger['info'](_0x581a('0x5e'),_0x581a('0x49'));_0x1df420['recordingURL']=util['format'](_0x581a('0x4a'),_0x125d80[_0x581a('0x48')],_0x1df420[_0x581a('0x4b')],md5(_0x1df420[_0x581a('0x4b')]));}headers[_0x581a('0x4d')]=getAuth(_0x125d80);return getUser(_0x125d80,_0x7d2d67['email'])[_0x581a('0x1c')](function(_0x213479){_0x55ebba=_0x213479;logger['info'](_0x581a('0x4f'),_0x55ebba['id']);return getEndUser(_0x125d80,_0x1df420[_0x581a('0x5f')],_0x1df420[_0x581a('0x60')]);})[_0x581a('0x1c')](function(_0x9bf719){_0x21a9f7=_0x9bf719;logger[_0x581a('0x14')](_0x581a('0x51'),_0x21a9f7['id']);return getTicket(_0x125d80,_0x55ebba,_0x21a9f7,_0xc8a91b,_0x1df420);})[_0x581a('0x1c')](function(_0x4ba600){if(_0x4ba600){logger['info'](_0x581a('0x52'),_0x4ba600['id']);switch(_0x125d80[_0x581a('0x3f')]){case _0x581a('0x61'):logger[_0x581a('0x14')](_0x581a('0x5e'),_0x581a('0x62'));return request({'uri':util[_0x581a('0x1a')](_0x581a('0x53'),_0x125d80[_0x581a('0x19')],_0x55ebba['id'],_0x4ba600['id']),'method':_0x581a('0xd')});case _0x581a('0x63'):logger[_0x581a('0x14')](_0x581a('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x581a('0x1a')](_0x581a('0x55'),_0x7d2d67[_0x581a('0xf')]),_0x581a('0x56'),{'uri':util[_0x581a('0x1a')](_0x581a('0x57'),_0x125d80[_0x581a('0x19')][_0x581a('0x58')](_0x581a('0x64'),''),_0x4ba600['id'])});break;default:logger['error']('[OUTBOUND]',_0x581a('0x65'));}}})[_0x581a('0x5a')](function(_0x3ea2f9){logger['error'](_0x581a('0x66'),util[_0x581a('0x67')](_0x3ea2f9,{'showHidden':!![],'depth':null}));});};exports[_0x581a('0x68')]=function(_0x2d8e4d,_0x563fbc,_0x53d9b4,_0x3e4ba1,_0x1aac34,_0x48b539){var _0x127eb7,_0x25d95f;_0x48b539[_0x581a('0x19')]=intUtil[_0x581a('0x47')](_0x48b539[_0x581a('0x19')]);_0x48b539[_0x581a('0x48')]=intUtil['stripTrailingSlash'](_0x48b539['serverUrl']);if(_0x1aac34&&_0x1aac34[_0x581a('0x69')]){logger[_0x581a('0x14')]('['+_0x563fbc['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x563fbc[_0x581a('0x4c')]=util[_0x581a('0x1a')](_0x581a('0x4a'),_0x48b539[_0x581a('0x48')],_0x563fbc[_0x581a('0x4b')],md5(_0x563fbc[_0x581a('0x4b')]));}else{_0x563fbc['recordingURL']='';}headers[_0x581a('0x4d')]=getAuth(_0x48b539);return getUser(_0x48b539)[_0x581a('0x1c')](function(_0x357f19){_0x127eb7=_0x357f19;logger['info']('The\x20User\x20ID\x20is:',_0x127eb7['id']);return getEndUser(_0x48b539,_0x563fbc[_0x581a('0x6a')],_0x563fbc[_0x581a('0x50')]);})['then'](function(_0x391caf){_0x25d95f=_0x391caf;logger[_0x581a('0x14')](_0x581a('0x51'),_0x25d95f['id']);return getTicket(_0x48b539,_0x127eb7,_0x25d95f,_0x53d9b4,_0x563fbc);})[_0x581a('0x1c')](function(_0x274f58){if(_0x274f58){logger[_0x581a('0x14')]('The\x20Ticket\x20ID\x20is:',_0x274f58['id']);}})[_0x581a('0x5a')](function(_0x51f9c3){logger[_0x581a('0x6b')]('['+_0x563fbc['lastevent'][_0x581a('0x6c')]()+']'+_0x581a('0x6d'),util[_0x581a('0x67')](_0x51f9c3,{'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 a063e12..a804e57 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 _0x3575=['info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','contact_lead','Contacts','uri','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Who_Id','First_Name','Last_Name','Leads','Full_Name','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','calleridname','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','debug','[HTTP]','stringify','length','string','picklist','type','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','add','seconds','error','Failing\x20creating\x20the\x20access_token'];(function(_0x5ac5e8,_0xc333d2){var _0x5eb1ff=function(_0x2c4802){while(--_0x2c4802){_0x5ac5e8['push'](_0x5ac5e8['shift']());}};_0x5eb1ff(++_0xc333d2);}(_0x3575,0x69));var _0x5357=function(_0x5072a2,_0x443c5b){_0x5072a2=_0x5072a2-0x0;var _0x4b7214=_0x3575[_0x5072a2];return _0x4b7214;};'use strict';var _=require(_0x5357('0x0'));var rp=require(_0x5357('0x1'));var md5=require(_0x5357('0x2'));var util=require(_0x5357('0x3'));var intUtil=require('./util');var moment=require(_0x5357('0x4'));var Redis=require(_0x5357('0x5'));var BPromise=require('bluebird');var config=require(_0x5357('0x6'));var logger=require(_0x5357('0x7'))(_0x5357('0x8'));config[_0x5357('0x9')]=_[_0x5357('0xa')](config[_0x5357('0x9')],{'host':_0x5357('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5357('0x9')]));function emit(_0x5e6be2,_0x1664b1,_0x35e956){io['to'](_0x5e6be2)['emit'](_0x1664b1,_0x35e956);}function request(_0x15e096){logger[_0x5357('0xc')](_0x5357('0xd'),JSON[_0x5357('0xe')](_0x15e096));return rp(_0x15e096);}function getCustomFields(_0x27be98,_0x2108ec){var _0x2e43aa={};if(_0x27be98[_0x5357('0xf')]>0x0){_['forEach'](_0x27be98,function(_0x5b06e6){if(_['includes']([_0x5357('0x10'),_0x5357('0x11')],_0x5b06e6[_0x5357('0x12')])&&_0x5b06e6['idField']){_0x2e43aa[_0x5b06e6['idField']]=_0x5b06e6['content'][_0x5357('0x13')]();}else if(_0x5b06e6['type']===_0x5357('0x14')&&_0x5b06e6[_0x5357('0x15')]&&_0x5b06e6[_0x5357('0x16')]&&_0x2108ec[_0x5b06e6[_0x5357('0x15')]]){_0x2e43aa[_0x5b06e6[_0x5357('0x16')]]=_0x2108ec[_0x5b06e6[_0x5357('0x15')]][_0x5357('0x13')]();}else if(_0x5b06e6[_0x5357('0x12')]===_0x5357('0x17')&&_0x5b06e6['Variable']&&_0x5b06e6[_0x5357('0x18')][_0x5357('0x19')]&&_0x5b06e6[_0x5357('0x16')]&&_0x2108ec[_0x5b06e6['Variable']['name'][_0x5357('0x1a')]()]){_0x2e43aa[_0x5b06e6[_0x5357('0x16')]]=_0x2108ec[_0x5b06e6[_0x5357('0x18')][_0x5357('0x19')][_0x5357('0x1a')]()][_0x5357('0x13')]();}});}return _0x2e43aa;}function getName(_0x56acfc){if(_0x56acfc[_0x5357('0x1b')]('\x20')>0x0){var _0x354db6=_0x56acfc[_0x5357('0x1c')](/ (.+)/);if(_0x354db6[0x1]){return _0x354db6;}}return[_0x56acfc,_0x56acfc];}var accountsTokens={};function getAccessToken(_0x446184){return new Promise(function(_0x58f2ec,_0xee309f){if(!_['isNil'](accountsTokens[_0x446184['id']])&&!_[_0x5357('0x1d')](accountsTokens[_0x446184['id']][_0x5357('0x1e')])){if(moment()[_0x5357('0x1f')](accountsTokens[_0x446184['id']]['expires_in'])){_0x58f2ec(accountsTokens[_0x446184['id']]['access_token']);}}var _0x35cdaa;switch(_0x446184['zone']){case'US':_0x35cdaa=_0x5357('0x20');break;case'AU':_0x35cdaa=_0x5357('0x21');break;case'EU':_0x35cdaa=_0x5357('0x22');break;case'IN':_0x35cdaa=_0x5357('0x23');break;case'CN':_0x35cdaa=_0x5357('0x24');break;default:_0x35cdaa='https://accounts.zoho.eu';break;}var _0x4c7cd5={'method':_0x5357('0x25'),'uri':_0x35cdaa+_0x5357('0x26'),'qs':{'refresh_token':_0x446184['refreshToken'],'client_id':_0x446184[_0x5357('0x27')],'client_secret':_0x446184[_0x5357('0x28')],'grant_type':_0x5357('0x29')},'json':!![]};return rp(_0x4c7cd5)['then'](function(_0x3b4137){accountsTokens[_0x446184['id']]={'access_token':_0x3b4137[_0x5357('0x1e')],'expires_in':moment()[_0x5357('0x2a')](_0x3b4137['expires_in'],_0x5357('0x2b'))};_0x58f2ec(_0x3b4137['access_token']);})['catch'](function(_0x25ac8e){logger[_0x5357('0x2c')](_0x5357('0x2d'),_0x25ac8e['stack']);_0xee309f(_0x25ac8e);});});}function getUser(_0x5e4ea0,_0xef35c6,_0x32527d,_0x1903a0){logger[_0x5357('0x2e')](_0x5357('0x2f'));return request({'method':_0x5357('0x30'),'uri':util[_0x5357('0x31')](_0x5357('0x32'),_0xef35c6),'qs':{'type':_0x5357('0x33')},'headers':{'Authorization':_0x5357('0x34')+_0x5e4ea0},'json':!![]})[_0x5357('0x35')](function(_0xcdec50){if(_0xcdec50[_0x5357('0x36')]){var _0x1fd8c5=-0x1;if(_['isArrayLikeObject'](_0xcdec50['users'])){if(!_['isNil'](_0x1903a0)){_0x1fd8c5=_[_0x5357('0x37')](_0xcdec50['users'],function(_0x4c9d16){return _0x4c9d16[_0x5357('0x38')]===_0x1903a0;});}if(_0x1fd8c5>=0x0){logger[_0x5357('0x2e')](_0x5357('0x39'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x1fd8c5=_[_0x5357('0x37')](_0xcdec50[_0x5357('0x36')],function(_0x3f5a3f){return _0x3f5a3f[_0x5357('0x3a')]['name']===_0x5357('0x3b');});}return _0xcdec50[_0x5357('0x36')][_0x1fd8c5];}else{if(_0xcdec50['user'][_0x5357('0x3a')]['name']===_0x5357('0x3b')){logger['info'](_0x5357('0x3c'));user=_0xcdec50['user'];return user;}else{logger[_0x5357('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x5357('0xe')](_0xcdec50));throw new Error(_0x5357('0x3d')+JSON[_0x5357('0xe')](_0xcdec50));}}}else{logger['error'](_0x5357('0x3e'),JSON[_0x5357('0xe')](_0xcdec50));throw new Error(_0x5357('0x3d')+JSON[_0x5357('0xe')](_0xcdec50));}})[_0x5357('0x3f')](function(_0xf53244){console[_0x5357('0x2c')](_0xf53244);});}function getZohoUser(_0x349e99,_0x1565e9){return new BPromise(function(_0x21e180,_0x545edd){request(_0x349e99)[_0x5357('0x35')](function(_0x1702fb){var _0x4d6063=null;if(_0x1702fb){_0x4d6063=_0x1702fb[_0x5357('0x40')][0x0];_0x4d6063[_0x5357('0x41')]=_0x1565e9;}_0x21e180(_0x4d6063);})[_0x5357('0x3f')](function(_0x471c45){_0x545edd(_0x471c45);});});}function createEndUser(_0x53e5b5,_0x2fa0d4,_0x4015f4,_0x192dd4,_0x224212,_0x2fdc59){var _0x4015f4=getName(_0x4015f4);return request({'method':_0x5357('0x25'),'uri':_0x5357('0x42')+_0x2fa0d4+_0x5357('0x43')+_[_0x5357('0x44')](_0x2fdc59[_0x5357('0x45')])+'s','body':{'data':[{'Last_Name':_0x4015f4[0x1],'First_Name':_0x4015f4[0x0],'Phone':_0x192dd4,'Owner':{'name':!_[_0x5357('0x1d')](_0x224212[_0x5357('0x46')][_0x5357('0x19')])?_0x224212[_0x5357('0x46')]['name']:!_[_0x5357('0x1d')](_0x224212[_0x5357('0x47')])?_0x224212[_0x5357('0x47')]+'\x20'+_0x224212[_0x5357('0x48')]:_0x224212[_0x5357('0x48')],'id':_0x224212['id']}}]},'headers':{'Authorization':_0x5357('0x34')+_0x53e5b5},'json':!![]})[_0x5357('0x35')](function(_0x1158ae){if(_0x1158ae&&_0x1158ae[_0x5357('0x40')][0x0][_0x5357('0x49')]===_0x5357('0x4a')){var _0x4e3cf5=_0x1158ae['data'][0x0][_0x5357('0x4b')];_0x4e3cf5[_0x5357('0x41')]=_['startCase'](_0x2fdc59[_0x5357('0x45')])+'s';return _0x4e3cf5;}logger[_0x5357('0x2c')](_0x5357('0x3e'),JSON[_0x5357('0xe')](data));throw new Error(_0x5357('0x4c')+JSON['stringify'](data));})[_0x5357('0x3f')](function(_0x1743ea){console['log'](_0x5357('0x4d'),_0x1743ea);});}function getEndUser(_0x2714fa,_0x21195d,_0x10976d,_0x14a315,_0x445d19,_0x5489bc,_0x3b34aa){var _0xb84b9a={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2714fa},'json':!![]};switch(_0x3b34aa['moduleSearch']){case _0x5357('0x4e'):_0xb84b9a['uri']=_0x5357('0x42')+_0x21195d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x445d19+'))';return getZohoUser(_0xb84b9a,_0x5357('0x4f'))[_0x5357('0x35')](function(_0x341ec4){if(_0x341ec4)return _0x341ec4;_0xb84b9a[_0x5357('0x50')]=_0x5357('0x42')+_0x21195d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x445d19+'))';return getZohoUser(_0xb84b9a,'Leads')['then'](function(_0x4f2dda){if(_0x4f2dda)return _0x4f2dda;if(_0x3b34aa[_0x5357('0x45')]!=_0x5357('0x51')){return createEndUser(_0x2714fa,_0x21195d,_0x14a315,_0x445d19,_0x5489bc,_0x3b34aa);}else{return{};}});});break;case'contact':_0xb84b9a['uri']=_0x5357('0x42')+_0x21195d+_0x5357('0x52')+_0x445d19+'))';return getZohoUser(_0xb84b9a,_0x5357('0x4f'))[_0x5357('0x35')](function(_0x1ee74b){if(_0x1ee74b)return _0x1ee74b;if(_0x3b34aa['moduleCreate']!=_0x5357('0x51')){return createEndUser(_0x2714fa,_0x21195d,_0x14a315,_0x445d19,_0x5489bc,_0x3b34aa);}else{return{};}});break;case _0x5357('0x53'):_0xb84b9a[_0x5357('0x50')]=_0x5357('0x42')+_0x21195d+_0x5357('0x54')+_0x445d19+'))';return getZohoUser(_0xb84b9a,'Leads')[_0x5357('0x35')](function(_0x3774f3){if(_0x3774f3)return _0x3774f3;if(_0x3b34aa['moduleCreate']!=_0x5357('0x51')){return createEndUser(_0x2714fa,_0x21195d,_0x14a315,_0x445d19,_0x5489bc,_0x3b34aa);}else{return{};}});break;}}function getCall(_0xdce188,_0x53494b,_0x40bb4d,_0x547bc3,_0x3306d9,_0x14aef0,_0x544fe8,_0x4e8733){logger[_0x5357('0x2e')](_0x5357('0x55'));var _0x4b1390={};_0x4b1390['Owner']={'name':!_['isNil'](_0x547bc3[_0x5357('0x46')][_0x5357('0x19')])&&!_[_0x5357('0x1d')](_0x547bc3[_0x5357('0x3a')][_0x5357('0x19')])&&_0x547bc3[_0x5357('0x3a')]['name']===_0x5357('0x56')?_0x547bc3[_0x5357('0x46')][_0x5357('0x19')]:!_[_0x5357('0x1d')](_0x547bc3[_0x5357('0x47')])?_0x547bc3[_0x5357('0x47')]+'\x20'+_0x547bc3['last_name']:_0x547bc3['last_name'],'id':_0x547bc3['id']};_0x4b1390[_0x5357('0x57')]=intUtil['getString'](_0x14aef0['Subjects'],_0x544fe8,'\x20');_0x4b1390['Description']=intUtil[_0x5357('0x58')](_0x14aef0['Descriptions'],_0x544fe8,'\x0a');if(_0x3306d9[_0x5357('0x41')]===_0x5357('0x4f')){_0x4b1390[_0x5357('0x59')]={'name':!_[_0x5357('0x1d')](_0x3306d9['Full_Name'])?_0x3306d9['Full_Name']:!_[_0x5357('0x1d')](_0x3306d9[_0x5357('0x5a')])?_0x3306d9[_0x5357('0x5a')]+'\x20'+_0x3306d9[_0x5357('0x5b')]:_0x3306d9['Last_Name'],'id':_0x3306d9['id']};}if(_0x3306d9['enduserType']===_0x5357('0x5c')){_0x4b1390['What_Id']={'name':!_[_0x5357('0x1d')](_0x3306d9[_0x5357('0x5d')])?_0x3306d9[_0x5357('0x5d')]:!_[_0x5357('0x1d')](_0x3306d9['First_Name'])?_0x3306d9[_0x5357('0x5a')]+'\x20'+_0x3306d9[_0x5357('0x5b')]:_0x3306d9[_0x5357('0x5b')],'id':_0x3306d9['id']};_0x4b1390['$se_module']=_[_0x5357('0x44')](_0x3306d9[_0x5357('0x41')]);}if(_0x544fe8[_0x5357('0x5e')]){_0x4b1390['Call_Duration']=moment[_0x5357('0x5f')](parseInt(_0x544fe8[_0x5357('0x5e')])*0x3e8)[_0x5357('0x31')](_0x5357('0x60'));}else if(_0x544fe8[_0x5357('0x61')]&&_0x544fe8[_0x5357('0x62')]){_0x4b1390[_0x5357('0x63')]=moment['utc'](moment(_0x544fe8[_0x5357('0x62')],_0x5357('0x64'))[_0x5357('0x65')](moment(_0x544fe8[_0x5357('0x66')],_0x5357('0x64'))))[_0x5357('0x31')](_0x5357('0x60'));}switch(_0x544fe8[_0x5357('0x67')]){case _0x5357('0x68'):_0x4b1390[_0x5357('0x69')]='Called';break;case'complete':case _0x5357('0x6a'):_0x4b1390[_0x5357('0x69')]=_0x5357('0x6b');break;case _0x5357('0x6c'):_0x4b1390[_0x5357('0x69')]=_0x5357('0x6d');break;case'abandoned':_0x4b1390['Call_Result']=_0x5357('0x6e');break;case _0x5357('0x6f'):_0x4b1390[_0x5357('0x69')]=_0x5357('0x70');default:}_0x4b1390[_0x5357('0x71')]=(_0x4e8733===_0x5357('0x72')?moment(_0x544fe8[_0x5357('0x66')])[_0x5357('0x31')](_0x5357('0x64')):moment(_0x544fe8[_0x5357('0x73')])['format'](_0x5357('0x64')))||moment()[_0x5357('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x4b1390['Call_Type']=_0x4e8733||_0x5357('0x74');_0x4b1390=_[_0x5357('0x75')](_0x4b1390,getCustomFields(_0x14aef0[_0x5357('0x76')],_0x544fe8));return request({'method':_0x5357('0x25'),'uri':'https://www.zohoapis.'+_0x53494b+_0x5357('0x77'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xdce188},'body':{'data':[_0x4b1390]},'json':!![]})['then'](function(_0x13a8cf){if(_0x13a8cf&&_0x13a8cf[_0x5357('0x40')][0x0][_0x5357('0x49')]===_0x5357('0x4a')){logger[_0x5357('0x2e')](_0x5357('0x78'));return{'id':_0x13a8cf[_0x5357('0x40')][0x0]['details']['id']};}})[_0x5357('0x3f')](function(_0x3a3356){logger['info'](_0x5357('0x79'),_0x3a3356['stack']);console['log'](_0x5357('0x79'),_0x3a3356);});}exports[_0x5357('0x7a')]=function(_0x57958a,_0x5a4dcf,_0x494e73,_0xf4a2b7,_0xbde5cd,_0x555bb2){var _0x1317e2,_0x506f83,_0x29afdf;_0x555bb2[_0x5357('0x7b')]=intUtil[_0x5357('0x7c')](_0x555bb2[_0x5357('0x7b')]);_0x555bb2[_0x5357('0x7d')]=intUtil['stripTrailingSlash'](_0x555bb2[_0x5357('0x7d')]);if(_0xbde5cd&&_0xbde5cd[_0x5357('0x7e')]){logger[_0x5357('0x2e')](_0x5357('0x7f'),_0x5357('0x80'));_0x5a4dcf[_0x5357('0x81')]=_0x555bb2['serverUrl']+_0x5357('0x82')+_0x5a4dcf[_0x5357('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x5a4dcf['uniqueid']);}else{_0x5a4dcf[_0x5357('0x81')]='';}var _0x332bc6=_0x555bb2[_0x5357('0x7b')]===_0x5357('0x84')?'eu':_0x5357('0x85');return getAccessToken(_0x555bb2)[_0x5357('0x35')](function(_0x33272b){_0x29afdf=_0x33272b;return getUser(_0x29afdf,_0x332bc6,_0x555bb2,_0xf4a2b7[_0x5357('0x38')]);})[_0x5357('0x35')](function(_0x1c15b3){_0x1317e2=_0x1c15b3;logger['info'](_0x5357('0x86'),_0x1317e2['id']);return getEndUser(_0x29afdf,_0x332bc6,_0x555bb2,_0x5a4dcf['calleridname'],_0x5a4dcf[_0x5357('0x87')],_0x1317e2,_0x494e73);})['then'](function(_0x5b73f8){_0x506f83=_0x5b73f8;return getCall(_0x29afdf,_0x332bc6,_0x555bb2,_0x1317e2,_0x506f83,_0x494e73,_0x5a4dcf,_0x5357('0x74'));})['then'](function(_0x53b81e){if(_0x53b81e){logger[_0x5357('0x2e')](_0x5357('0x88'),_0x53b81e['id']);logger[_0x5357('0x2e')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5357('0x31')]('user:%s',_0xf4a2b7['name']),_0x5357('0x89'),{'uri':_0x5357('0x8a')+_0x555bb2[_0x5357('0x7b')]+_0x5357('0x8b')+_0x53b81e['id']});}})[_0x5357('0x3f')](function(_0x1126ea){logger[_0x5357('0x2c')]('[QUEUE]',JSON['stringify'](_0x1126ea));});};exports[_0x5357('0x72')]=function(_0x53d4b1,_0x2b6df7,_0x36afa6,_0x44531e,_0x11f392,_0x5bc6ec,_0x8cac35){var _0x3585b3,_0x50ee54,_0x148968;_0x5bc6ec['host']=intUtil[_0x5357('0x7c')](_0x5bc6ec['host']);_0x5bc6ec[_0x5357('0x7d')]=intUtil[_0x5357('0x7c')](_0x5bc6ec[_0x5357('0x7d')]);if(_0x8cac35&&_0x8cac35['recordingFormat']&&_0x8cac35[_0x5357('0x8c')]!==_0x5357('0x8d')){logger[_0x5357('0x2e')](_0x5357('0x8e'),_0x5357('0x80'));_0x2b6df7['recordingURL']=_0x5bc6ec['serverUrl']+_0x5357('0x82')+_0x2b6df7[_0x5357('0x83')]+_0x5357('0x8f')+md5(_0x2b6df7[_0x5357('0x83')]);}var _0x571fee=_0x5bc6ec[_0x5357('0x7b')]===_0x5357('0x84')?'eu':_0x5357('0x85');return getAccessToken(_0x5bc6ec)[_0x5357('0x35')](function(_0x5b6bf4){_0x148968=_0x5b6bf4;return getUser(_0x148968,_0x571fee,_0x5bc6ec,_0x44531e[_0x5357('0x38')]);})['then'](function(_0x5e3932){_0x3585b3=_0x5e3932;logger[_0x5357('0x2e')](_0x5357('0x86'),_0x3585b3['id']);return getEndUser(_0x148968,_0x571fee,_0x5bc6ec,_0x2b6df7[_0x5357('0x90')],_0x2b6df7[_0x5357('0x91')],_0x3585b3,_0x36afa6);})['then'](function(_0x315213){_0x50ee54=_0x315213;return getCall(_0x148968,_0x571fee,_0x5bc6ec,_0x3585b3,_0x50ee54,_0x36afa6,_0x2b6df7,_0x5357('0x92'));})[_0x5357('0x35')](function(_0x5d1a4d){if(_0x5d1a4d){logger[_0x5357('0x2e')](_0x5357('0x88'),_0x5d1a4d['id']);logger['info']('[OUTBOUND]',_0x5357('0x93'));emit(util[_0x5357('0x31')](_0x5357('0x94'),_0x44531e['name']),_0x5357('0x89'),{'uri':_0x5357('0x8a')+_0x5bc6ec[_0x5357('0x7b')]+_0x5357('0x8b')+_0x5d1a4d['id']});}})[_0x5357('0x3f')](function(_0x55d58d){logger[_0x5357('0x2c')]('[OUTBOUND]',JSON[_0x5357('0xe')](_0x55d58d));});};exports[_0x5357('0x95')]=function(_0x112283,_0xdf68f7,_0x217f38,_0x2ee9b,_0x345de7,_0x513e17){var _0x256d4d,_0x39294d,_0x38346a;_0x513e17[_0x5357('0x7b')]=intUtil['stripTrailingSlash'](_0x513e17[_0x5357('0x7b')]);_0x513e17[_0x5357('0x7d')]=intUtil[_0x5357('0x7c')](_0x513e17[_0x5357('0x7d')]);if(_0x345de7&&_0x345de7[_0x5357('0x7e')]){logger[_0x5357('0x2e')]('['+_0xdf68f7[_0x5357('0x67')]['toUpperCase']()+']',_0x5357('0x80'));_0xdf68f7['recordingURL']=_0x513e17['serverUrl']+_0x5357('0x82')+_0xdf68f7['uniqueid']+_0x5357('0x8f')+md5(_0xdf68f7[_0x5357('0x83')]);}else{_0xdf68f7['recordingURL']='';}var _0x2790a6=_0x513e17[_0x5357('0x7b')]===_0x5357('0x84')?'eu':_0x5357('0x85');return getAccessToken(_0x513e17)['then'](function(_0x50db9f){_0x38346a=_0x50db9f;return getUser(_0x38346a,_0x2790a6,_0x513e17);})[_0x5357('0x35')](function(_0x38eb02){_0x256d4d=_0x38eb02;logger['info'](_0x5357('0x86'),_0x256d4d['id']);return getEndUser(_0x38346a,_0x2790a6,_0x513e17,_0xdf68f7[_0x5357('0x96')],_0xdf68f7[_0x5357('0x87')],_0x256d4d,_0x217f38);})[_0x5357('0x35')](function(_0x4c54d3){_0x39294d=_0x4c54d3;return getCall(_0x38346a,_0x2790a6,_0x513e17,_0x256d4d,_0x39294d,_0x217f38,_0xdf68f7,'Inbound');})[_0x5357('0x35')](function(_0x2043b5){if(_0x2043b5){logger[_0x5357('0x2e')](_0x5357('0x88'),_0x2043b5['id']);}})[_0x5357('0x3f')](function(_0x35db27){logger['error']('['+_0xdf68f7['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x35db27));});}; \ No newline at end of file +var _0x78b6=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20Call\x20ID\x20is:','user:%s','https://crm.','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','calleridname','calleridnum','lastevent','lodash','request-promise','md5','moment','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','add','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','Subject','Subjects','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','mm:ss','called','Call_Result','Called','complete','Answered','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','stack','queue','host','stripTrailingSlash'];(function(_0x45b3b7,_0x2b645e){var _0x2849dd=function(_0x2e79bd){while(--_0x2e79bd){_0x45b3b7['push'](_0x45b3b7['shift']());}};_0x2849dd(++_0x2b645e);}(_0x78b6,0x1e5));var _0x678b=function(_0x2378ef,_0x1b182e){_0x2378ef=_0x2378ef-0x0;var _0x9dc6fb=_0x78b6[_0x2378ef];return _0x9dc6fb;};'use strict';var _=require(_0x678b('0x0'));var rp=require(_0x678b('0x1'));var md5=require(_0x678b('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0x678b('0x3'));var Redis=require('ioredis');var BPromise=require(_0x678b('0x4'));var config=require('../../../../config/environment');var logger=require(_0x678b('0x5'))(_0x678b('0x6'));config[_0x678b('0x7')]=_[_0x678b('0x8')](config[_0x678b('0x7')],{'host':_0x678b('0x9'),'port':0x18eb});var io=require(_0x678b('0xa'))(new Redis(config['redis']));function emit(_0x117610,_0x24b6f6,_0x54edcb){io['to'](_0x117610)[_0x678b('0xb')](_0x24b6f6,_0x54edcb);}function request(_0x5b6b6c){logger[_0x678b('0xc')](_0x678b('0xd'),JSON[_0x678b('0xe')](_0x5b6b6c));return rp(_0x5b6b6c);}function getCustomFields(_0x27ea06,_0x31415f){var _0x3c12de={};if(_0x27ea06['length']>0x0){_['forEach'](_0x27ea06,function(_0x6d1629){if(_[_0x678b('0xf')](['string',_0x678b('0x10')],_0x6d1629['type'])&&_0x6d1629['idField']){_0x3c12de[_0x6d1629[_0x678b('0x11')]]=_0x6d1629[_0x678b('0x12')][_0x678b('0x13')]();}else if(_0x6d1629[_0x678b('0x14')]===_0x678b('0x15')&&_0x6d1629[_0x678b('0x16')]&&_0x6d1629[_0x678b('0x11')]&&_0x31415f[_0x6d1629['variableName']]){_0x3c12de[_0x6d1629[_0x678b('0x11')]]=_0x31415f[_0x6d1629[_0x678b('0x16')]][_0x678b('0x13')]();}else if(_0x6d1629[_0x678b('0x14')]===_0x678b('0x17')&&_0x6d1629[_0x678b('0x18')]&&_0x6d1629[_0x678b('0x18')][_0x678b('0x19')]&&_0x6d1629[_0x678b('0x11')]&&_0x31415f[_0x6d1629['Variable'][_0x678b('0x19')][_0x678b('0x1a')]()]){_0x3c12de[_0x6d1629[_0x678b('0x11')]]=_0x31415f[_0x6d1629[_0x678b('0x18')]['name'][_0x678b('0x1a')]()]['toString']();}});}return _0x3c12de;}function getName(_0xb6ef24){if(_0xb6ef24[_0x678b('0x1b')]('\x20')>0x0){var _0x56e489=_0xb6ef24[_0x678b('0x1c')](/ (.+)/);if(_0x56e489[0x1]){return _0x56e489;}}return[_0xb6ef24,_0xb6ef24];}var accountsTokens={};function getAccessToken(_0x2e14ac){return new Promise(function(_0x56c878,_0x4b5af8){if(!_['isNil'](accountsTokens[_0x2e14ac['id']])&&!_[_0x678b('0x1d')](accountsTokens[_0x2e14ac['id']][_0x678b('0x1e')])){if(moment()[_0x678b('0x1f')](accountsTokens[_0x2e14ac['id']][_0x678b('0x20')])){_0x56c878(accountsTokens[_0x2e14ac['id']][_0x678b('0x1e')]);}}var _0x18e03f;switch(_0x2e14ac[_0x678b('0x21')]){case'US':_0x18e03f=_0x678b('0x22');break;case'AU':_0x18e03f=_0x678b('0x23');break;case'EU':_0x18e03f='https://accounts.zoho.eu';break;case'IN':_0x18e03f=_0x678b('0x24');break;case'CN':_0x18e03f=_0x678b('0x25');break;default:_0x18e03f=_0x678b('0x26');break;}var _0x8edc6c={'method':_0x678b('0x27'),'uri':_0x18e03f+_0x678b('0x28'),'qs':{'refresh_token':_0x2e14ac['refreshToken'],'client_id':_0x2e14ac[_0x678b('0x29')],'client_secret':_0x2e14ac[_0x678b('0x2a')],'grant_type':_0x678b('0x2b')},'json':!![]};return rp(_0x8edc6c)['then'](function(_0x48744a){accountsTokens[_0x2e14ac['id']]={'access_token':_0x48744a[_0x678b('0x1e')],'expires_in':moment()[_0x678b('0x2c')](_0x48744a[_0x678b('0x20')],'seconds')};_0x56c878(_0x48744a[_0x678b('0x1e')]);})[_0x678b('0x2d')](function(_0x3b3fbf){logger['error'](_0x678b('0x2e'),_0x3b3fbf['stack']);_0x4b5af8(_0x3b3fbf);});});}function getUser(_0x15fa3c,_0x5e0d2a,_0x3c9aad,_0x144447){logger[_0x678b('0x2f')](_0x678b('0x30'));return request({'method':_0x678b('0x31'),'uri':util[_0x678b('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x5e0d2a),'qs':{'type':_0x678b('0x33')},'headers':{'Authorization':_0x678b('0x34')+_0x15fa3c},'json':!![]})[_0x678b('0x35')](function(_0x517b4c){if(_0x517b4c[_0x678b('0x36')]){var _0x3d83d8=-0x1;if(_[_0x678b('0x37')](_0x517b4c[_0x678b('0x36')])){if(!_[_0x678b('0x1d')](_0x144447)){_0x3d83d8=_[_0x678b('0x38')](_0x517b4c[_0x678b('0x36')],function(_0x100b44){return _0x100b44[_0x678b('0x39')]===_0x144447;});}if(_0x3d83d8>=0x0){logger[_0x678b('0x2f')]('Agent\x20found!');}else{logger[_0x678b('0x2f')](_0x678b('0x3a'));_0x3d83d8=_[_0x678b('0x38')](_0x517b4c[_0x678b('0x36')],function(_0x19327d){return _0x19327d[_0x678b('0x3b')][_0x678b('0x19')]===_0x678b('0x3c');});}return _0x517b4c[_0x678b('0x36')][_0x3d83d8];}else{if(_0x517b4c[_0x678b('0x3d')]['profile'][_0x678b('0x19')]==='Administrator'){logger[_0x678b('0x2f')](_0x678b('0x3a'));user=_0x517b4c[_0x678b('0x3d')];return user;}else{logger[_0x678b('0x3e')](_0x678b('0x3f'),JSON[_0x678b('0xe')](_0x517b4c));throw new Error(_0x678b('0x40')+JSON[_0x678b('0xe')](_0x517b4c));}}}else{logger[_0x678b('0x3e')](_0x678b('0x3f'),JSON[_0x678b('0xe')](_0x517b4c));throw new Error(_0x678b('0x40')+JSON[_0x678b('0xe')](_0x517b4c));}})[_0x678b('0x2d')](function(_0x29a30d){console[_0x678b('0x3e')](_0x29a30d);});}function getZohoUser(_0x1a402b,_0x554e9b){return new BPromise(function(_0x1014f0,_0x49d46d){request(_0x1a402b)[_0x678b('0x35')](function(_0x340d07){var _0x2365a5=null;if(_0x340d07){_0x2365a5=_0x340d07[_0x678b('0x41')][0x0];_0x2365a5[_0x678b('0x42')]=_0x554e9b;}_0x1014f0(_0x2365a5);})[_0x678b('0x2d')](function(_0x1531da){_0x49d46d(_0x1531da);});});}function createEndUser(_0x47e153,_0x27531a,_0xa606ea,_0x3a87b1,_0x37f7dd,_0x4e1e78){var _0xa606ea=getName(_0xa606ea);return request({'method':_0x678b('0x27'),'uri':_0x678b('0x43')+_0x27531a+'/crm/v2/'+_[_0x678b('0x44')](_0x4e1e78[_0x678b('0x45')])+'s','body':{'data':[{'Last_Name':_0xa606ea[0x1],'First_Name':_0xa606ea[0x0],'Phone':_0x3a87b1,'Owner':{'name':!_[_0x678b('0x1d')](_0x37f7dd[_0x678b('0x46')][_0x678b('0x19')])?_0x37f7dd[_0x678b('0x46')][_0x678b('0x19')]:!_['isNil'](_0x37f7dd['first_name'])?_0x37f7dd[_0x678b('0x47')]+'\x20'+_0x37f7dd[_0x678b('0x48')]:_0x37f7dd['last_name'],'id':_0x37f7dd['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x47e153},'json':!![]})[_0x678b('0x35')](function(_0x592742){if(_0x592742&&_0x592742['data'][0x0]['code']===_0x678b('0x49')){var _0x4a8225=_0x592742[_0x678b('0x41')][0x0][_0x678b('0x4a')];_0x4a8225['enduserType']=_[_0x678b('0x44')](_0x4e1e78[_0x678b('0x45')])+'s';return _0x4a8225;}logger['error'](_0x678b('0x3f'),JSON['stringify'](data));throw new Error(_0x678b('0x4b')+JSON[_0x678b('0xe')](data));})['catch'](function(_0x2c3231){console[_0x678b('0x4c')](_0x678b('0x4d'),_0x2c3231);});}function getEndUser(_0x5490bb,_0xcca61a,_0x32e6e2,_0x1872bc,_0x543c21,_0x275c82,_0x25d8f7){var _0x1c94e5={'method':_0x678b('0x31'),'uri':'','headers':{'Authorization':_0x678b('0x34')+_0x5490bb},'json':!![]};switch(_0x25d8f7[_0x678b('0x4e')]){case _0x678b('0x4f'):_0x1c94e5[_0x678b('0x50')]=_0x678b('0x43')+_0xcca61a+_0x678b('0x51')+_0x543c21+'))';return getZohoUser(_0x1c94e5,_0x678b('0x52'))[_0x678b('0x35')](function(_0x4ff941){if(_0x4ff941)return _0x4ff941;_0x1c94e5[_0x678b('0x50')]=_0x678b('0x43')+_0xcca61a+_0x678b('0x53')+_0x543c21+'))';return getZohoUser(_0x1c94e5,_0x678b('0x54'))[_0x678b('0x35')](function(_0x551ae){if(_0x551ae)return _0x551ae;if(_0x25d8f7[_0x678b('0x45')]!=_0x678b('0x55')){return createEndUser(_0x5490bb,_0xcca61a,_0x1872bc,_0x543c21,_0x275c82,_0x25d8f7);}else{return{};}});});break;case _0x678b('0x56'):_0x1c94e5[_0x678b('0x50')]=_0x678b('0x43')+_0xcca61a+_0x678b('0x51')+_0x543c21+'))';return getZohoUser(_0x1c94e5,_0x678b('0x52'))['then'](function(_0x589878){if(_0x589878)return _0x589878;if(_0x25d8f7[_0x678b('0x45')]!='nothing'){return createEndUser(_0x5490bb,_0xcca61a,_0x1872bc,_0x543c21,_0x275c82,_0x25d8f7);}else{return{};}});break;case _0x678b('0x57'):_0x1c94e5[_0x678b('0x50')]='https://www.zohoapis.'+_0xcca61a+_0x678b('0x53')+_0x543c21+'))';return getZohoUser(_0x1c94e5,_0x678b('0x54'))[_0x678b('0x35')](function(_0x3742b2){if(_0x3742b2)return _0x3742b2;if(_0x25d8f7[_0x678b('0x45')]!=_0x678b('0x55')){return createEndUser(_0x5490bb,_0xcca61a,_0x1872bc,_0x543c21,_0x275c82,_0x25d8f7);}else{return{};}});break;}}function getCall(_0x3007a9,_0x2591d6,_0x556ce5,_0x85d139,_0x11a0c6,_0x2adb2b,_0x4b2eed,_0x33cf5e){logger['info'](_0x678b('0x58'));var _0xfc41b1={};_0xfc41b1[_0x678b('0x59')]={'name':!_[_0x678b('0x1d')](_0x85d139[_0x678b('0x46')][_0x678b('0x19')])&&!_[_0x678b('0x1d')](_0x85d139[_0x678b('0x3b')][_0x678b('0x19')])&&_0x85d139[_0x678b('0x3b')][_0x678b('0x19')]==='administrator'?_0x85d139[_0x678b('0x46')][_0x678b('0x19')]:!_[_0x678b('0x1d')](_0x85d139[_0x678b('0x47')])?_0x85d139[_0x678b('0x47')]+'\x20'+_0x85d139['last_name']:_0x85d139[_0x678b('0x48')],'id':_0x85d139['id']};_0xfc41b1[_0x678b('0x5a')]=intUtil['getString'](_0x2adb2b[_0x678b('0x5b')],_0x4b2eed,'\x20');_0xfc41b1['Description']=intUtil[_0x678b('0x5c')](_0x2adb2b[_0x678b('0x5d')],_0x4b2eed,'\x0a');if(_0x11a0c6[_0x678b('0x42')]==='Contacts'){_0xfc41b1['Who_Id']={'name':!_['isNil'](_0x11a0c6[_0x678b('0x5e')])?_0x11a0c6[_0x678b('0x5e')]:!_[_0x678b('0x1d')](_0x11a0c6[_0x678b('0x5f')])?_0x11a0c6[_0x678b('0x5f')]+'\x20'+_0x11a0c6[_0x678b('0x60')]:_0x11a0c6[_0x678b('0x60')],'id':_0x11a0c6['id']};}if(_0x11a0c6['enduserType']==='Leads'){_0xfc41b1[_0x678b('0x61')]={'name':!_['isNil'](_0x11a0c6[_0x678b('0x5e')])?_0x11a0c6[_0x678b('0x5e')]:!_[_0x678b('0x1d')](_0x11a0c6[_0x678b('0x5f')])?_0x11a0c6['First_Name']+'\x20'+_0x11a0c6['Last_Name']:_0x11a0c6['Last_Name'],'id':_0x11a0c6['id']};_0xfc41b1[_0x678b('0x62')]=_[_0x678b('0x44')](_0x11a0c6['enduserType']);}if(_0x4b2eed[_0x678b('0x63')]){_0xfc41b1[_0x678b('0x64')]=moment[_0x678b('0x65')](parseInt(_0x4b2eed['talktime'])*0x3e8)[_0x678b('0x32')]('mm:ss');}else if(_0x4b2eed['answertime']&&_0x4b2eed[_0x678b('0x66')]){_0xfc41b1[_0x678b('0x64')]=moment[_0x678b('0x65')](moment(_0x4b2eed['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x678b('0x67')](moment(_0x4b2eed[_0x678b('0x68')],_0x678b('0x69'))))[_0x678b('0x32')](_0x678b('0x6a'));}switch(_0x4b2eed['lastevent']){case _0x678b('0x6b'):_0xfc41b1[_0x678b('0x6c')]=_0x678b('0x6d');break;case _0x678b('0x6e'):case'connect':_0xfc41b1[_0x678b('0x6c')]=_0x678b('0x6f');break;case'rejected':_0xfc41b1['Call_Result']=_0x678b('0x70');break;case'abandoned':_0xfc41b1[_0x678b('0x6c')]=_0x678b('0x71');break;case _0x678b('0x72'):_0xfc41b1[_0x678b('0x6c')]=_0x678b('0x73');default:}_0xfc41b1['Call_Start_Time']=(_0x33cf5e===_0x678b('0x74')?moment(_0x4b2eed[_0x678b('0x68')])[_0x678b('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x4b2eed[_0x678b('0x75')])[_0x678b('0x32')](_0x678b('0x69')))||moment()[_0x678b('0x32')](_0x678b('0x69'));_0xfc41b1['Call_Type']=_0x33cf5e||_0x678b('0x76');_0xfc41b1=_[_0x678b('0x77')](_0xfc41b1,getCustomFields(_0x2adb2b['Fields'],_0x4b2eed));return request({'method':_0x678b('0x27'),'uri':_0x678b('0x43')+_0x2591d6+_0x678b('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3007a9},'body':{'data':[_0xfc41b1]},'json':!![]})[_0x678b('0x35')](function(_0x3481fa){if(_0x3481fa&&_0x3481fa[_0x678b('0x41')][0x0][_0x678b('0x79')]===_0x678b('0x49')){logger[_0x678b('0x2f')](_0x678b('0x7a'));return{'id':_0x3481fa[_0x678b('0x41')][0x0][_0x678b('0x4a')]['id']};}})['catch'](function(_0x520f00){logger[_0x678b('0x2f')]('err',_0x520f00[_0x678b('0x7b')]);console['log']('err',_0x520f00);});}exports[_0x678b('0x7c')]=function(_0x2d3bd4,_0x5cb646,_0x42b2d4,_0x9a4468,_0x1c6427,_0x38b140){var _0x2da5e5,_0x3446b6,_0x229757;_0x38b140[_0x678b('0x7d')]=intUtil[_0x678b('0x7e')](_0x38b140['host']);_0x38b140['serverUrl']=intUtil[_0x678b('0x7e')](_0x38b140['serverUrl']);if(_0x1c6427&&_0x1c6427[_0x678b('0x7f')]){logger[_0x678b('0x2f')](_0x678b('0x80'),_0x678b('0x81'));_0x5cb646[_0x678b('0x82')]=_0x38b140[_0x678b('0x83')]+_0x678b('0x84')+_0x5cb646[_0x678b('0x85')]+_0x678b('0x86')+md5(_0x5cb646[_0x678b('0x85')]);}else{_0x5cb646[_0x678b('0x82')]='';}var _0x2751ae=_0x38b140[_0x678b('0x7d')]===_0x678b('0x87')?'eu':_0x678b('0x88');return getAccessToken(_0x38b140)[_0x678b('0x35')](function(_0x2524f6){_0x229757=_0x2524f6;return getUser(_0x229757,_0x2751ae,_0x38b140,_0x9a4468[_0x678b('0x39')]);})['then'](function(_0x238928){_0x2da5e5=_0x238928;logger[_0x678b('0x2f')]('The\x20User\x20ID\x20is:',_0x2da5e5['id']);return getEndUser(_0x229757,_0x2751ae,_0x38b140,_0x5cb646['calleridname'],_0x5cb646['calleridnum'],_0x2da5e5,_0x42b2d4);})['then'](function(_0x21721e){_0x3446b6=_0x21721e;return getCall(_0x229757,_0x2751ae,_0x38b140,_0x2da5e5,_0x3446b6,_0x42b2d4,_0x5cb646,'Inbound');})[_0x678b('0x35')](function(_0x2173c8){if(_0x2173c8){logger[_0x678b('0x2f')](_0x678b('0x89'),_0x2173c8['id']);logger[_0x678b('0x2f')](_0x678b('0x80'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x678b('0x8a'),_0x9a4468[_0x678b('0x19')]),'trigger:browser:url',{'uri':_0x678b('0x8b')+_0x38b140['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2173c8['id']});}})[_0x678b('0x2d')](function(_0x2f609e){logger[_0x678b('0x3e')](_0x678b('0x80'),JSON[_0x678b('0xe')](_0x2f609e));});};exports['outbound']=function(_0x1ce010,_0x474cee,_0xf6ae14,_0x1b236b,_0x1303b3,_0x23508d,_0x41703d){var _0x3f4665,_0x40bf76,_0xbffa74;_0x23508d['host']=intUtil[_0x678b('0x7e')](_0x23508d[_0x678b('0x7d')]);_0x23508d[_0x678b('0x83')]=intUtil[_0x678b('0x7e')](_0x23508d[_0x678b('0x83')]);if(_0x41703d&&_0x41703d['recordingFormat']&&_0x41703d[_0x678b('0x8c')]!==_0x678b('0x8d')){logger[_0x678b('0x2f')](_0x678b('0x8e'),_0x678b('0x81'));_0x474cee['recordingURL']=_0x23508d['serverUrl']+_0x678b('0x84')+_0x474cee['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x474cee[_0x678b('0x85')]);}var _0x338a7b=_0x23508d['host']===_0x678b('0x87')?'eu':_0x678b('0x88');return getAccessToken(_0x23508d)['then'](function(_0x47aaca){_0xbffa74=_0x47aaca;return getUser(_0xbffa74,_0x338a7b,_0x23508d,_0x1b236b[_0x678b('0x39')]);})[_0x678b('0x35')](function(_0x4b3a97){_0x3f4665=_0x4b3a97;logger[_0x678b('0x2f')](_0x678b('0x8f'),_0x3f4665['id']);return getEndUser(_0xbffa74,_0x338a7b,_0x23508d,_0x474cee[_0x678b('0x90')],_0x474cee[_0x678b('0x91')],_0x3f4665,_0xf6ae14);})['then'](function(_0x12f7d1){_0x40bf76=_0x12f7d1;return getCall(_0xbffa74,_0x338a7b,_0x23508d,_0x3f4665,_0x40bf76,_0xf6ae14,_0x474cee,_0x678b('0x92'));})[_0x678b('0x35')](function(_0x3e8f4f){if(_0x3e8f4f){logger[_0x678b('0x2f')](_0x678b('0x89'),_0x3e8f4f['id']);logger[_0x678b('0x2f')](_0x678b('0x8e'),_0x678b('0x93'));emit(util[_0x678b('0x32')]('user:%s',_0x1b236b[_0x678b('0x19')]),'trigger:browser:url',{'uri':_0x678b('0x8b')+_0x23508d[_0x678b('0x7d')]+_0x678b('0x94')+_0x3e8f4f['id']});}})['catch'](function(_0x34463b){logger[_0x678b('0x3e')](_0x678b('0x8e'),JSON[_0x678b('0xe')](_0x34463b));});};exports[_0x678b('0x95')]=function(_0x2d49f5,_0x3918a6,_0x19f65a,_0x169913,_0x47f673,_0x1cc03b){var _0x157b96,_0x4d1620,_0x5f4cb9;_0x1cc03b['host']=intUtil[_0x678b('0x7e')](_0x1cc03b[_0x678b('0x7d')]);_0x1cc03b['serverUrl']=intUtil[_0x678b('0x7e')](_0x1cc03b[_0x678b('0x83')]);if(_0x47f673&&_0x47f673[_0x678b('0x7f')]){logger['info']('['+_0x3918a6['lastevent']['toUpperCase']()+']',_0x678b('0x81'));_0x3918a6[_0x678b('0x82')]=_0x1cc03b[_0x678b('0x83')]+'/api/voice/recordings/'+_0x3918a6[_0x678b('0x85')]+_0x678b('0x86')+md5(_0x3918a6[_0x678b('0x85')]);}else{_0x3918a6[_0x678b('0x82')]='';}var _0x4fb690=_0x1cc03b[_0x678b('0x7d')]===_0x678b('0x87')?'eu':'com';return getAccessToken(_0x1cc03b)[_0x678b('0x35')](function(_0x2db75c){_0x5f4cb9=_0x2db75c;return getUser(_0x5f4cb9,_0x4fb690,_0x1cc03b);})[_0x678b('0x35')](function(_0x5ce5ed){_0x157b96=_0x5ce5ed;logger[_0x678b('0x2f')](_0x678b('0x8f'),_0x157b96['id']);return getEndUser(_0x5f4cb9,_0x4fb690,_0x1cc03b,_0x3918a6[_0x678b('0x96')],_0x3918a6[_0x678b('0x97')],_0x157b96,_0x19f65a);})[_0x678b('0x35')](function(_0x5b1a4d){_0x4d1620=_0x5b1a4d;return getCall(_0x5f4cb9,_0x4fb690,_0x1cc03b,_0x157b96,_0x4d1620,_0x19f65a,_0x3918a6,_0x678b('0x76'));})[_0x678b('0x35')](function(_0x20af32){if(_0x20af32){logger[_0x678b('0x2f')](_0x678b('0x89'),_0x20af32['id']);}})[_0x678b('0x2d')](function(_0x6f6819){logger[_0x678b('0x3e')]('['+_0x3918a6[_0x678b('0x98')]['toUpperCase']()+']',JSON[_0x678b('0xe')](_0x6f6819));});}; \ 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 b6298f9..2afe9fd 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 _0x329e=['error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','Script','data3','render'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x329e,0x75));var _0xe329=function(_0x387ff8,_0x3a30dc){_0x387ff8=_0x387ff8-0x0;var _0x5f3a0f=_0x329e[_0x387ff8];return _0x5f3a0f;};'use strict';var util=require(_0xe329('0x0'));var sh=require(_0xe329('0x1'));var Mustache=require(_0xe329('0x2'));var logger=require('../../../../config/logger')(_0xe329('0x3'));exports[_0xe329('0x4')]=function(_0x19c011,_0x22d201){var _0x2e1999=_0x19c011[_0xe329('0x5')]?_0x19c011[_0xe329('0x5')]:_0xe329('0x6');var _0x3d55c9=_0x19c011[_0xe329('0x7')]?Mustache[_0xe329('0x8')](_0x19c011[_0xe329('0x7')],_0x22d201):_0x22d201;sh[_0xe329('0x4')](_0x3d55c9,function(_0x3c458c,_0x4ae411,_0x585ced){if(_0x3c458c!==0x0){logger[_0xe329('0x9')](util['format'](_0xe329('0xa'),_0x2e1999,_0x3d55c9,_0x3c458c,_0x585ced));}else{logger[_0xe329('0xb')](util[_0xe329('0xc')](_0xe329('0xd'),_0x2e1999,_0x3d55c9,_0x4ae411));}});}; \ No newline at end of file +var _0x7010=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','trigger','data2','Script','data3','render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x115763,_0x42f8d8){var _0x3fb5c5=function(_0x47fc02){while(--_0x47fc02){_0x115763['push'](_0x115763['shift']());}};_0x3fb5c5(++_0x42f8d8);}(_0x7010,0xfe));var _0x0701=function(_0x4777dc,_0xbce636){_0x4777dc=_0x4777dc-0x0;var _0x16d933=_0x7010[_0x4777dc];return _0x16d933;};'use strict';var util=require(_0x0701('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x0701('0x1'));exports['exec']=function(_0x45707e,_0x5adbc9){var _0x189394=_0x45707e[_0x0701('0x2')]?_0x45707e[_0x0701('0x2')]:_0x0701('0x3');var _0x2970cb=_0x45707e[_0x0701('0x4')]?Mustache[_0x0701('0x5')](_0x45707e[_0x0701('0x4')],_0x5adbc9):_0x5adbc9;sh[_0x0701('0x6')](_0x2970cb,function(_0x22f8a6,_0x5d6b1f,_0x5edc94){if(_0x22f8a6!==0x0){logger['error'](util[_0x0701('0x7')](_0x0701('0x8'),_0x189394,_0x2970cb,_0x22f8a6,_0x5edc94));}else{logger[_0x0701('0x9')](util[_0x0701('0x7')](_0x0701('0xa'),_0x189394,_0x2970cb,_0x5d6b1f));}});}; \ 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 d9139c6..a5b276b 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 _0x3629=['trigger','exec','data1','render','data2','data5','number','headers','parse','data6','error','stack','toUpperCase','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','mustache','../../../../config/logger'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x3629,0x188));var _0x9362=function(_0x46b765,_0x2071cd){_0x46b765=_0x46b765-0x0;var _0x3ec196=_0x3629[_0x46b765];return _0x3ec196;};'use strict';var rp=require('request-promise');var util=require(_0x9362('0x0'));var _=require(_0x9362('0x1'));var Mustache=require(_0x9362('0x2'));var logger=require(_0x9362('0x3'))(_0x9362('0x4'));exports[_0x9362('0x5')]=function(_0x2983c9,_0x3df32a){var _0x295954,_0x396cc6;var _0x52e3b6={'method':_0x2983c9[_0x9362('0x6')]['toUpperCase'](),'uri':Mustache[_0x9362('0x7')](_0x2983c9[_0x9362('0x8')],_0x3df32a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2983c9[_0x9362('0x9')])===_0x9362('0xa')&&parseInt(_0x2983c9[_0x9362('0x9')])>=0x1&&parseInt(_0x2983c9['data5'])<=0xa?parseInt(_0x2983c9[_0x9362('0x9')])*0x3e8:0x5*0x3e8};try{_0x52e3b6[_0x9362('0xb')]=_0x2983c9['data6']?JSON[_0x9362('0xc')](Mustache['render'](_0x2983c9[_0x9362('0xd')],_0x3df32a)):{};}catch(_0x289c61){logger[_0x9362('0xe')](_0x289c61[_0x9362('0xf')]);}switch(_0x2983c9[_0x9362('0x6')][_0x9362('0x10')]()){case'GET':case'DELETE':_0x295954=null;_0x52e3b6['qs']=_0x3df32a;break;case'POST':case'PUT':if(_0x2983c9[_0x9362('0x11')]){try{_0x295954=JSON['parse'](Mustache[_0x9362('0x7')](_0x2983c9[_0x9362('0x11')],_0x3df32a));_0x52e3b6['body']=_0x295954;}catch(_0x1012d7){logger[_0x9362('0xe')](_0x1012d7['stack']);logger[_0x9362('0xe')](_0x9362('0x12'));}}else{_0x295954=_0x3df32a;_0x52e3b6[_0x9362('0x13')]=_0x295954;}break;}logger[_0x9362('0x14')](util[_0x9362('0x15')](_0x9362('0x16'),_0x2983c9['data1'],_0x2983c9[_0x9362('0x8')],JSON['stringify'](_0x52e3b6)));rp(_0x52e3b6)['then'](function(_0x3c18cd){_0x295954=!_[_0x9362('0x17')](_0x295954)?_0x9362('0x18')+_0x295954:'';_0x396cc6=typeof _0x3c18cd[_0x9362('0x13')]===_0x9362('0x19')?JSON[_0x9362('0x1a')](_0x3c18cd[_0x9362('0x13')]):_0x3c18cd[_0x9362('0x13')];logger[_0x9362('0x14')](util[_0x9362('0x15')](_0x9362('0x1b'),_0x2983c9[_0x9362('0x6')],_0x2983c9[_0x9362('0x8')],_0x3c18cd[_0x9362('0x1c')],_0x396cc6));})[_0x9362('0x1d')](function(_0x1bbc18){logger[_0x9362('0xe')](util[_0x9362('0x15')](_0x9362('0x1e'),_0x2983c9[_0x9362('0x6')],_0x2983c9[_0x9362('0x8')],_0x1bbc18[_0x9362('0x1c')],_0x1bbc18[_0x9362('0x1f')],_0x1bbc18[_0x9362('0x20')]));});}; \ No newline at end of file +var _0x1505=['util','lodash','mustache','exec','data1','toUpperCase','render','data2','data5','number','headers','parse','error','GET','DELETE','POST','PUT','data7','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x1505,0x13f));var _0x5150=function(_0x7dd6b7,_0x4eb302){_0x7dd6b7=_0x7dd6b7-0x0;var _0x5a6916=_0x1505[_0x7dd6b7];return _0x5a6916;};'use strict';var rp=require(_0x5150('0x0'));var util=require(_0x5150('0x1'));var _=require(_0x5150('0x2'));var Mustache=require(_0x5150('0x3'));var logger=require('../../../../config/logger')('trigger');exports[_0x5150('0x4')]=function(_0x2f2b52,_0x34c56b){var _0x25749e,_0x15beb5;var _0xca311b={'method':_0x2f2b52[_0x5150('0x5')][_0x5150('0x6')](),'uri':Mustache[_0x5150('0x7')](_0x2f2b52[_0x5150('0x8')],_0x34c56b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f2b52[_0x5150('0x9')])===_0x5150('0xa')&&parseInt(_0x2f2b52['data5'])>=0x1&&parseInt(_0x2f2b52[_0x5150('0x9')])<=0xa?parseInt(_0x2f2b52[_0x5150('0x9')])*0x3e8:0x5*0x3e8};try{_0xca311b[_0x5150('0xb')]=_0x2f2b52['data6']?JSON[_0x5150('0xc')](Mustache['render'](_0x2f2b52['data6'],_0x34c56b)):{};}catch(_0x34b4e5){logger[_0x5150('0xd')](_0x34b4e5['stack']);}switch(_0x2f2b52[_0x5150('0x5')][_0x5150('0x6')]()){case _0x5150('0xe'):case _0x5150('0xf'):_0x25749e=null;_0xca311b['qs']=_0x34c56b;break;case _0x5150('0x10'):case _0x5150('0x11'):if(_0x2f2b52[_0x5150('0x12')]){try{_0x25749e=JSON[_0x5150('0xc')](Mustache[_0x5150('0x7')](_0x2f2b52['data7'],_0x34c56b));_0xca311b['body']=_0x25749e;}catch(_0x521544){logger['error'](_0x521544[_0x5150('0x13')]);logger[_0x5150('0xd')](_0x5150('0x14'));}}else{_0x25749e=_0x34c56b;_0xca311b[_0x5150('0x15')]=_0x25749e;}break;}logger['info'](util[_0x5150('0x16')](_0x5150('0x17'),_0x2f2b52[_0x5150('0x5')],_0x2f2b52['data2'],JSON[_0x5150('0x18')](_0xca311b)));rp(_0xca311b)['then'](function(_0x415eed){_0x25749e=!_[_0x5150('0x19')](_0x25749e)?_0x5150('0x1a')+_0x25749e:'';_0x15beb5=typeof _0x415eed[_0x5150('0x15')]==='object'?JSON[_0x5150('0x18')](_0x415eed[_0x5150('0x15')]):_0x415eed[_0x5150('0x15')];logger[_0x5150('0x1b')](util[_0x5150('0x16')](_0x5150('0x1c'),_0x2f2b52[_0x5150('0x5')],_0x2f2b52[_0x5150('0x8')],_0x415eed['statusCode'],_0x15beb5));})[_0x5150('0x1d')](function(_0x442aa0){logger[_0x5150('0xd')](util[_0x5150('0x16')](_0x5150('0x1e'),_0x2f2b52[_0x5150('0x5')],_0x2f2b52[_0x5150('0x8')],_0x442aa0['statusCode'],_0x442aa0[_0x5150('0x1f')],_0x442aa0['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index cdec4b2..62eb915 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 _0xb8a5=['result','exports','jayson/promise','../../config/logger','client','Request','then','debug','rpc','routing','error','message'];(function(_0x1cdad2,_0x56e5fc){var _0x1814a7=function(_0x2cbcef){while(--_0x2cbcef){_0x1cdad2['push'](_0x1cdad2['shift']());}};_0x1814a7(++_0x56e5fc);}(_0xb8a5,0x18e));var _0x5b8a=function(_0x5ca3e3,_0x3dede2){_0x5ca3e3=_0x5ca3e3-0x0;var _0x3cddae=_0xb8a5[_0x5ca3e3];return _0x3cddae;};'use strict';var jayson=require(_0x5b8a('0x0'));var BPromise=require('bluebird');var logger=require(_0x5b8a('0x1'))('routing');var client=jayson[_0x5b8a('0x2')]['http']({'port':0x2329});client[_0x5b8a('0x3')]=function(_0x5256f9,_0x4e16c6){return new BPromise(function(_0x173b95,_0x3ba53f){return client['request'](_0x5256f9,_0x4e16c6)[_0x5b8a('0x4')](function(_0x306892){logger[_0x5b8a('0x5')](_0x5b8a('0x6'),_0x5b8a('0x7'),_0x5256f9,_0x4e16c6,_0x306892);if(_0x306892[_0x5b8a('0x8')]){logger['error']('rpc',_0x5b8a('0x7'),_0x5256f9,_0x306892[_0x5b8a('0x8')][_0x5b8a('0x9')],_0x4e16c6);return _0x3ba53f(_0x306892[_0x5b8a('0x8')][_0x5b8a('0x9')]);}else{return _0x173b95(_0x306892[_0x5b8a('0xa')]);}})['catch'](function(_0x550086){logger[_0x5b8a('0x8')](_0x5b8a('0x6'),'routing',_0x5256f9,_0x550086,_0x4e16c6);return _0x3ba53f(_0x550086);});});};module[_0x5b8a('0xb')]=client; \ No newline at end of file +var _0x17c5=['exports','jayson/promise','bluebird','../../config/logger','Request','request','rpc','routing','error','message'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x17c5,0x83));var _0x517c=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0x17c5[_0x18d50f];return _0x8ce385;};'use strict';var jayson=require(_0x517c('0x0'));var BPromise=require(_0x517c('0x1'));var logger=require(_0x517c('0x2'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x517c('0x3')]=function(_0x94e886,_0x4f3f00){return new BPromise(function(_0x3e46d2,_0x1f4b82){return client[_0x517c('0x4')](_0x94e886,_0x4f3f00)['then'](function(_0x3b555f){logger['debug'](_0x517c('0x5'),_0x517c('0x6'),_0x94e886,_0x4f3f00,_0x3b555f);if(_0x3b555f[_0x517c('0x7')]){logger[_0x517c('0x7')]('rpc',_0x517c('0x6'),_0x94e886,_0x3b555f[_0x517c('0x7')][_0x517c('0x8')],_0x4f3f00);return _0x1f4b82(_0x3b555f[_0x517c('0x7')][_0x517c('0x8')]);}else{return _0x3e46d2(_0x3b555f['result']);}})['catch'](function(_0x3125c2){logger[_0x517c('0x7')](_0x517c('0x5'),_0x517c('0x6'),_0x94e886,_0x3125c2,_0x4f3f00);return _0x1f4b82(_0x3125c2);});});};module[_0x517c('0x9')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4460bf6..ce61e8f 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 _0x8255=['./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','./server','./realtime'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x8255,0x85));var _0x5825=function(_0x8bcc4,_0x5688c0){_0x8bcc4=_0x8bcc4-0x0;var _0x3ff54d=_0x8255[_0x8bcc4];return _0x3ff54d;};'use strict';var server=require(_0x5825('0x0'));var Realtime=require(_0x5825('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x5825('0x2'));var setting=require(_0x5825('0x3'));var logger=require(_0x5825('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x5825('0x5')]()[_0x5825('0x6')](mailAccount[_0x5825('0x7')]())[_0x5825('0x6')](realtime[_0x5825('0x8')]())[_0x5825('0x6')](function(){email[_0x5825('0x9')](realtime[_0x5825('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x5825('0x6')](function(){return initRealtime();})[_0x5825('0x6')](function(){return setting[_0x5825('0xb')]();})['then'](function(_0x1bc835){return setInterval(initRealtime,_0x1bc835[_0x5825('0xc')]*0x3e8);})[_0x5825('0xd')](function(_0x546157){logger[_0x5825('0xe')]('Email\x20service\x20initialization',_0x546157);});}main(); \ No newline at end of file +var _0x43da=['listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x440c5d,_0x3cae2e){var _0x3cccb6=function(_0x12acf5){while(--_0x12acf5){_0x440c5d['push'](_0x440c5d['shift']());}};_0x3cccb6(++_0x3cae2e);}(_0x43da,0x1c8));var _0xa43d=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x43da[_0x3fba9f];return _0x192cf1;};'use strict';var server=require('./server');var Realtime=require(_0xa43d('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xa43d('0x1'));var setting=require('./rpc/setting');var logger=require(_0xa43d('0x2'))(_0xa43d('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa43d('0x4')]()[_0xa43d('0x5')](mailAccount[_0xa43d('0x6')]())['then'](realtime[_0xa43d('0x7')]())['then'](function(){email[_0xa43d('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xa43d('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0xa43d('0x5')](function(){return setting[_0xa43d('0xa')]();})[_0xa43d('0x5')](function(_0x203b53){return setInterval(initRealtime,_0x203b53[_0xa43d('0xb')]*0x3e8);})[_0xa43d('0xc')](function(_0x5ab926){logger[_0xa43d('0xd')](_0xa43d('0xe'),_0x5ab926);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d5e1a7c..95aa508 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 _0x5ee3=['handleImapEmail','handleImapEnd','error','handleImapError','isNil','disabled','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','then','messageStatus','verify','exports','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','status','Imap','total','stringify','md5','mailAccount:update','refresh','hasOwnProperty','active','provider','custom','service','imapAccounts','handleImapBox','bind'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5ee3,0xfa));var _0x35ee=function(_0x4a7906,_0x3ef77d){_0x4a7906=_0x4a7906-0x0;var _0x558373=_0x5ee3[_0x4a7906];return _0x558373;};'use strict';var _=require('lodash');var moment=require(_0x35ee('0x0'));var BPromise=require(_0x35ee('0x1'));var md5=require('md5');var Redis=require(_0x35ee('0x2'));var config=require(_0x35ee('0x3'));var logger=require(_0x35ee('0x4'))(_0x35ee('0x5'));config[_0x35ee('0x6')]=_[_0x35ee('0x7')](config['redis'],{'host':_0x35ee('0x8'),'port':0x18eb});var io=require(_0x35ee('0x9'))(new Redis(config[_0x35ee('0x6')]));var EmailImap=require(_0x35ee('0xa'));var EmailSmtp=require(_0x35ee('0xb'));var mailAccount=require(_0x35ee('0xc'));var md5Accounts={};function EmailChannel(_0x4cb0fb){logger[_0x35ee('0xd')](_0x35ee('0xe'));this[_0x35ee('0xf')]=_0x4cb0fb[_0x35ee('0xf')];this['imapAccounts']={};this[_0x35ee('0x10')]=new EmailSmtp();}EmailChannel[_0x35ee('0x11')][_0x35ee('0x12')]=function(_0x30bf5c){var _0x27eb93=this[_0x35ee('0xf')][_0x30bf5c];var _0x3e4932={'id':_0x27eb93['id'],'name':_0x27eb93[_0x35ee('0x13')],'key':_0x27eb93['key'],'active':_0x27eb93['active'],'Imap':{'status':_0x27eb93['Imap'][_0x35ee('0x14')],'messageStatus':_0x27eb93['Imap']['messageStatus'],'total':_0x27eb93[_0x35ee('0x15')][_0x35ee('0x16')]}};if(_['isNil'](md5Accounts[_0x30bf5c])){md5Accounts[_0x30bf5c]={};}var _0x1abaee=md5(JSON[_0x35ee('0x17')](_0x3e4932));if(md5Accounts[_0x30bf5c][_0x35ee('0x18')]!==_0x1abaee){md5Accounts[_0x30bf5c][_0x35ee('0x18')]=_0x1abaee;io[_0x35ee('0x12')](_0x35ee('0x19'),_0x3e4932);}};EmailChannel[_0x35ee('0x11')][_0x35ee('0x1a')]=function(_0x11eaa3){for(var _0x18cb2d in _0x11eaa3){if(_0x11eaa3[_0x35ee('0x1b')](_0x18cb2d)){if(_0x11eaa3[_0x18cb2d][_0x35ee('0x15')]&&_0x11eaa3[_0x18cb2d][_0x35ee('0x1c')]){var _0x8ad446=_0x11eaa3[_0x18cb2d][_0x35ee('0x15')];if(!_0x8ad446['service']&&_0x11eaa3[_0x18cb2d][_0x35ee('0x1d')]!==_0x35ee('0x1e'))_0x8ad446[_0x35ee('0x1f')]=_0x11eaa3[_0x18cb2d][_0x35ee('0x1d')];if(!this[_0x35ee('0x20')][_0x35ee('0x1b')](_0x8ad446['id'])){this[_0x35ee('0x20')][_0x8ad446['id']]=new EmailImap(_0x8ad446,_0x11eaa3[_0x18cb2d][_0x35ee('0x5')]);this[_0x35ee('0x20')][_0x8ad446['id']]['on']('box',this[_0x35ee('0x21')][_0x35ee('0x22')](this,_0x18cb2d));this[_0x35ee('0x20')][_0x8ad446['id']]['on'](_0x35ee('0x5'),this[_0x35ee('0x23')][_0x35ee('0x22')](this,_0x18cb2d));this[_0x35ee('0x20')][_0x8ad446['id']]['on']('end',this[_0x35ee('0x24')]['bind'](this,_0x18cb2d));this[_0x35ee('0x20')][_0x8ad446['id']]['on'](_0x35ee('0x25'),this[_0x35ee('0x26')][_0x35ee('0x22')](this,_0x18cb2d));}}else{if(_[_0x35ee('0x27')](this[_0x35ee('0xf')][_0x18cb2d][_0x35ee('0x15')])){this[_0x35ee('0xf')][_0x18cb2d][_0x35ee('0x15')]={};}this[_0x35ee('0xf')][_0x18cb2d]['Imap'][_0x35ee('0x14')]=_0x35ee('0x28');this[_0x35ee('0xf')][_0x18cb2d]['Imap']['messageStatus']='';this['emit'](_0x18cb2d);}}}};EmailChannel[_0x35ee('0x11')][_0x35ee('0x21')]=function(_0x371af2,_0x355d94){if(this['mailAccounts'][_0x371af2]){this['mailAccounts'][_0x371af2][_0x35ee('0x15')]['status']=_0x35ee('0x29');this[_0x35ee('0xf')][_0x371af2][_0x35ee('0x15')]['messageStatus']=_0x355d94[_0x35ee('0x13')];if(_0x355d94['messages']){this[_0x35ee('0xf')][_0x371af2][_0x35ee('0x15')][_0x35ee('0x16')]=_0x355d94['messages'][_0x35ee('0x16')];}return this[_0x35ee('0x12')](_0x371af2);}};EmailChannel[_0x35ee('0x11')][_0x35ee('0x23')]=function(_0x3540ef,_0x460783){logger[_0x35ee('0xd')](_0x35ee('0x2a'),_0x460783['firstName'],_0x460783[_0x35ee('0x2b')],_0x460783[_0x35ee('0x2c')],_0x3540ef);if(this['mailAccounts'][_0x3540ef]){return mailAccount['notify'](_0x3540ef,_0x460783)['then'](function(_0xc7c195){if(_0xc7c195){logger[_0x35ee('0xd')](_0x35ee('0x2d'));}})[_0x35ee('0x2e')](function(_0x3f2e8d){logger['error'](_0x35ee('0x2f'),JSON[_0x35ee('0x17')](_0x3f2e8d));});}};EmailChannel[_0x35ee('0x11')][_0x35ee('0x24')]=function(_0x3a7d9b){if(this[_0x35ee('0xf')][_0x3a7d9b]&&this[_0x35ee('0xf')][_0x3a7d9b][_0x35ee('0x15')]){if(this[_0x35ee('0x20')][this[_0x35ee('0xf')][_0x3a7d9b][_0x35ee('0x15')]['id']]){delete this[_0x35ee('0x20')][this['mailAccounts'][_0x3a7d9b][_0x35ee('0x15')]['id']];}this['mailAccounts'][_0x3a7d9b][_0x35ee('0x15')][_0x35ee('0x30')]=moment();this['emit'](_0x3a7d9b);}};EmailChannel['prototype'][_0x35ee('0x26')]=function(_0x19cd3e,_0x5aa2c7){if(this[_0x35ee('0xf')][_0x19cd3e]){this[_0x35ee('0xf')][_0x19cd3e]['Imap'][_0x35ee('0x14')]=_0x35ee('0x25');this[_0x35ee('0xf')][_0x19cd3e][_0x35ee('0x15')]['messageStatus']=_0x5aa2c7;return this['emit'](_0x19cd3e);}};EmailChannel['prototype'][_0x35ee('0x31')]=function(_0x32041c,_0x273dd9){return this[_0x35ee('0x10')][_0x35ee('0x32')](_0x32041c,_0x273dd9);};EmailChannel[_0x35ee('0x11')][_0x35ee('0x33')]=function(_0x1ddf22){var _0x2cfbb7=this;if(this['mailAccounts'][_0x1ddf22['id']]){if(_['isNil'](this[_0x35ee('0xf')][_0x1ddf22['id']][_0x35ee('0x34')])){this[_0x35ee('0xf')][_0x1ddf22['id']][_0x35ee('0x34')]={};}this[_0x35ee('0xf')][_0x1ddf22['id']]['Smtp'][_0x35ee('0x30')]=moment();return new BPromise(function(_0x4f4560,_0x57aa79){return _0x2cfbb7[_0x35ee('0x10')]['verify'](_0x1ddf22)[_0x35ee('0x35')](function(_0x13e0d2){_0x2cfbb7[_0x35ee('0xf')][_0x1ddf22['id']][_0x35ee('0x34')]['status']='verified';_0x2cfbb7[_0x35ee('0xf')][_0x1ddf22['id']][_0x35ee('0x34')][_0x35ee('0x36')]='';_0x2cfbb7['emit'](_0x1ddf22['id']);_0x4f4560(_0x13e0d2);})[_0x35ee('0x2e')](function(_0x44a12b){_0x2cfbb7[_0x35ee('0xf')][_0x1ddf22['id']][_0x35ee('0x34')]['status']=_0x35ee('0x25');_0x2cfbb7[_0x35ee('0xf')][_0x1ddf22['id']][_0x35ee('0x34')][_0x35ee('0x36')]=_0x44a12b;_0x2cfbb7[_0x35ee('0x12')](_0x1ddf22['id']);_0x57aa79(_0x44a12b);});});}return this['smtp'][_0x35ee('0x37')](_0x1ddf22);};module[_0x35ee('0x38')]=EmailChannel; \ No newline at end of file +var _0xda24=['../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','send','verifySmtp','Smtp','lastSync','verify','exports','moment','md5','ioredis'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xda24,0x1cd));var _0x4da2=function(_0x503d48,_0x42e5a9){_0x503d48=_0x503d48-0x0;var _0x59743e=_0xda24[_0x503d48];return _0x59743e;};'use strict';var _=require('lodash');var moment=require(_0x4da2('0x0'));var BPromise=require('bluebird');var md5=require(_0x4da2('0x1'));var Redis=require(_0x4da2('0x2'));var config=require(_0x4da2('0x3'));var logger=require(_0x4da2('0x4'))(_0x4da2('0x5'));config[_0x4da2('0x6')]=_[_0x4da2('0x7')](config['redis'],{'host':_0x4da2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4da2('0x6')]));var EmailImap=require(_0x4da2('0x9'));var EmailSmtp=require(_0x4da2('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2a3898){logger[_0x4da2('0xb')](_0x4da2('0xc'));this[_0x4da2('0xd')]=_0x2a3898[_0x4da2('0xd')];this[_0x4da2('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x4da2('0xf')][_0x4da2('0x10')]=function(_0x65146f){var _0x3b4ee9=this[_0x4da2('0xd')][_0x65146f];var _0x5c29eb={'id':_0x3b4ee9['id'],'name':_0x3b4ee9[_0x4da2('0x11')],'key':_0x3b4ee9[_0x4da2('0x12')],'active':_0x3b4ee9[_0x4da2('0x13')],'Imap':{'status':_0x3b4ee9[_0x4da2('0x14')][_0x4da2('0x15')],'messageStatus':_0x3b4ee9[_0x4da2('0x14')][_0x4da2('0x16')],'total':_0x3b4ee9['Imap']['total']}};if(_[_0x4da2('0x17')](md5Accounts[_0x65146f])){md5Accounts[_0x65146f]={};}var _0x172619=md5(JSON['stringify'](_0x5c29eb));if(md5Accounts[_0x65146f][_0x4da2('0x1')]!==_0x172619){md5Accounts[_0x65146f]['md5']=_0x172619;io[_0x4da2('0x10')](_0x4da2('0x18'),_0x5c29eb);}};EmailChannel[_0x4da2('0xf')][_0x4da2('0x19')]=function(_0x2c689d){for(var _0x523ac1 in _0x2c689d){if(_0x2c689d[_0x4da2('0x1a')](_0x523ac1)){if(_0x2c689d[_0x523ac1]['Imap']&&_0x2c689d[_0x523ac1]['active']){var _0x18f30c=_0x2c689d[_0x523ac1][_0x4da2('0x14')];if(!_0x18f30c['service']&&_0x2c689d[_0x523ac1][_0x4da2('0x1b')]!==_0x4da2('0x1c'))_0x18f30c[_0x4da2('0x1d')]=_0x2c689d[_0x523ac1]['provider'];if(!this[_0x4da2('0xe')][_0x4da2('0x1a')](_0x18f30c['id'])){this[_0x4da2('0xe')][_0x18f30c['id']]=new EmailImap(_0x18f30c,_0x2c689d[_0x523ac1][_0x4da2('0x5')]);this[_0x4da2('0xe')][_0x18f30c['id']]['on'](_0x4da2('0x1e'),this[_0x4da2('0x1f')]['bind'](this,_0x523ac1));this['imapAccounts'][_0x18f30c['id']]['on'](_0x4da2('0x5'),this[_0x4da2('0x20')]['bind'](this,_0x523ac1));this[_0x4da2('0xe')][_0x18f30c['id']]['on'](_0x4da2('0x21'),this[_0x4da2('0x22')][_0x4da2('0x23')](this,_0x523ac1));this[_0x4da2('0xe')][_0x18f30c['id']]['on'](_0x4da2('0x24'),this[_0x4da2('0x25')][_0x4da2('0x23')](this,_0x523ac1));}}else{if(_['isNil'](this['mailAccounts'][_0x523ac1]['Imap'])){this[_0x4da2('0xd')][_0x523ac1][_0x4da2('0x14')]={};}this[_0x4da2('0xd')][_0x523ac1][_0x4da2('0x14')][_0x4da2('0x15')]=_0x4da2('0x26');this['mailAccounts'][_0x523ac1]['Imap'][_0x4da2('0x16')]='';this[_0x4da2('0x10')](_0x523ac1);}}}};EmailChannel[_0x4da2('0xf')]['handleImapBox']=function(_0x4aebb8,_0x2d510b){if(this[_0x4da2('0xd')][_0x4aebb8]){this[_0x4da2('0xd')][_0x4aebb8][_0x4da2('0x14')][_0x4da2('0x15')]=_0x4da2('0x27');this[_0x4da2('0xd')][_0x4aebb8][_0x4da2('0x14')]['messageStatus']=_0x2d510b[_0x4da2('0x11')];if(_0x2d510b[_0x4da2('0x28')]){this[_0x4da2('0xd')][_0x4aebb8]['Imap']['total']=_0x2d510b[_0x4da2('0x28')][_0x4da2('0x29')];}return this[_0x4da2('0x10')](_0x4aebb8);}};EmailChannel[_0x4da2('0xf')][_0x4da2('0x20')]=function(_0x4ea8d2,_0x1da3ba){logger[_0x4da2('0xb')](_0x4da2('0x2a'),_0x1da3ba[_0x4da2('0x2b')],_0x1da3ba[_0x4da2('0x2c')],_0x1da3ba[_0x4da2('0x2d')],_0x4ea8d2);if(this['mailAccounts'][_0x4ea8d2]){return mailAccount[_0x4da2('0x2e')](_0x4ea8d2,_0x1da3ba)[_0x4da2('0x2f')](function(_0x3fe4fe){if(_0x3fe4fe){logger[_0x4da2('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x4da2('0x30')](function(_0x4e8684){logger['error'](_0x4da2('0x31'),JSON['stringify'](_0x4e8684));});}};EmailChannel['prototype'][_0x4da2('0x22')]=function(_0x49a906){if(this[_0x4da2('0xd')][_0x49a906]&&this[_0x4da2('0xd')][_0x49a906][_0x4da2('0x14')]){if(this[_0x4da2('0xe')][this['mailAccounts'][_0x49a906][_0x4da2('0x14')]['id']]){delete this[_0x4da2('0xe')][this[_0x4da2('0xd')][_0x49a906][_0x4da2('0x14')]['id']];}this[_0x4da2('0xd')][_0x49a906]['Imap']['lastSync']=moment();this[_0x4da2('0x10')](_0x49a906);}};EmailChannel[_0x4da2('0xf')][_0x4da2('0x25')]=function(_0x425a75,_0x189f06){if(this[_0x4da2('0xd')][_0x425a75]){this[_0x4da2('0xd')][_0x425a75][_0x4da2('0x14')]['status']='error';this['mailAccounts'][_0x425a75][_0x4da2('0x14')]['messageStatus']=_0x189f06;return this['emit'](_0x425a75);}};EmailChannel['prototype'][_0x4da2('0x32')]=function(_0x54a1bb,_0x1d3222){return this[_0x4da2('0x33')][_0x4da2('0x34')](_0x54a1bb,_0x1d3222);};EmailChannel[_0x4da2('0xf')][_0x4da2('0x35')]=function(_0x31aace){var _0x16edb9=this;if(this[_0x4da2('0xd')][_0x31aace['id']]){if(_[_0x4da2('0x17')](this[_0x4da2('0xd')][_0x31aace['id']][_0x4da2('0x36')])){this[_0x4da2('0xd')][_0x31aace['id']][_0x4da2('0x36')]={};}this['mailAccounts'][_0x31aace['id']][_0x4da2('0x36')][_0x4da2('0x37')]=moment();return new BPromise(function(_0x35257a,_0x3a3e2a){return _0x16edb9[_0x4da2('0x33')][_0x4da2('0x38')](_0x31aace)[_0x4da2('0x2f')](function(_0x7afde2){_0x16edb9[_0x4da2('0xd')][_0x31aace['id']]['Smtp'][_0x4da2('0x15')]='verified';_0x16edb9[_0x4da2('0xd')][_0x31aace['id']][_0x4da2('0x36')][_0x4da2('0x16')]='';_0x16edb9[_0x4da2('0x10')](_0x31aace['id']);_0x35257a(_0x7afde2);})[_0x4da2('0x30')](function(_0x7ddb77){_0x16edb9['mailAccounts'][_0x31aace['id']][_0x4da2('0x36')][_0x4da2('0x15')]='error';_0x16edb9[_0x4da2('0xd')][_0x31aace['id']][_0x4da2('0x36')][_0x4da2('0x16')]=_0x7ddb77;_0x16edb9[_0x4da2('0x10')](_0x31aace['id']);_0x3a3e2a(_0x7ddb77);});});}return this[_0x4da2('0x33')]['verify'](_0x31aace);};module[_0x4da2('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 77d88c5..d9ff1e7 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 _0x90ba=['mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','getAccount','account','once','handleReady','bind','handleEnd','error','handleError','connect','prototype','connTimeout','user','xoauth2','data5','password','email','anonymous@xcally.com','host','port','tls','autotls','openBox','handleOpenBox','emit','end','readUnseen','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','lodash','imap'];(function(_0x18e189,_0x2cc1d8){var _0x1901e4=function(_0x5e1702){while(--_0x5e1702){_0x18e189['push'](_0x18e189['shift']());}};_0x1901e4(++_0x2cc1d8);}(_0x90ba,0xa0));var _0xa90b=function(_0x5c8797,_0x1e9a59){_0x5c8797=_0x5c8797-0x0;var _0x5eb792=_0x90ba[_0x5c8797];return _0x5eb792;};'use strict';var _=require(_0xa90b('0x0'));var util=require('util');var Imap=require(_0xa90b('0x1'));var simpleParser=require(_0xa90b('0x2'))[_0xa90b('0x3')];var Iconv=require('iconv')[_0xa90b('0x4')];var EventEmitter=require(_0xa90b('0x5'))[_0xa90b('0x6')];var utils=require(_0xa90b('0x7'));var logger=require(_0xa90b('0x8'))('email');function EmailImap(_0x1b8e71,_0x1ebb27){this[_0xa90b('0x9')]='INBOX';this['account']=this[_0xa90b('0xa')](_0x1b8e71,_0x1ebb27);this['imap']=new Imap(this[_0xa90b('0xb')]);this[_0xa90b('0x1')][_0xa90b('0xc')]('ready',this[_0xa90b('0xd')][_0xa90b('0xe')](this));this[_0xa90b('0x1')][_0xa90b('0xc')]('end',this[_0xa90b('0xf')][_0xa90b('0xe')](this));this['imap']['on'](_0xa90b('0x10'),this[_0xa90b('0x11')][_0xa90b('0xe')](this));this[_0xa90b('0x1')][_0xa90b('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xa90b('0x13')][_0xa90b('0xa')]=function(_0x5d917b,_0x369468){var _0x387349={'connTimeout':_0x5d917b[_0xa90b('0x14')]?_0x5d917b['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5d917b['authTimeout']?_0x5d917b['authTimeout']*0x3e8:0x1388};if(_0x5d917b['service']){_0x387349[_0xa90b('0x15')]=_0x5d917b[_0xa90b('0x15')];if(_0x5d917b['modernAuthentication']){_0x387349[_0xa90b('0x16')]=utils['generateXOAuth2Token'](_0x5d917b['CloudProvider'][_0xa90b('0x17')],_0x5d917b[_0xa90b('0x15')]);}else{_0x387349[_0xa90b('0x18')]=_0x5d917b[_0xa90b('0x18')];}}else{if(_0x5d917b['authentication']){_0x387349[_0xa90b('0x15')]=_0x5d917b['user'];_0x387349['password']=_0x5d917b[_0xa90b('0x18')];}}_0x387349[_0xa90b('0x19')]=_0x369468||_0x5d917b[_0xa90b('0x15')]||_0xa90b('0x1a');_0x387349[_0xa90b('0x1b')]=_0x5d917b[_0xa90b('0x1b')];_0x387349[_0xa90b('0x1c')]=_0x5d917b[_0xa90b('0x1c')]||0x3e1;if(_0x5d917b[_0xa90b('0x1d')]){_0x387349[_0xa90b('0x1d')]=!![];}else{_0x387349[_0xa90b('0x1d')]=![];_0x387349[_0xa90b('0x1e')]='required';}return _0x387349;};EmailImap[_0xa90b('0x13')][_0xa90b('0xd')]=function(){this[_0xa90b('0x1')][_0xa90b('0x1f')](this[_0xa90b('0x9')],![],this[_0xa90b('0x20')][_0xa90b('0xe')](this));};EmailImap['prototype'][_0xa90b('0x20')]=function(_0xbc8867,_0xe074b7){if(_0xbc8867){this[_0xa90b('0x11')](_0xbc8867,!![]);}else{this[_0xa90b('0x21')]('box',_0xe074b7);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0xfbc534){if(_0xfbc534){this[_0xa90b('0x11')](_0xfbc534,!![]);}else{this['imap'][_0xa90b('0x22')]();}};EmailImap['prototype'][_0xa90b('0x23')]=function(){this[_0xa90b('0x1')]['search'](['UNSEEN'],this[_0xa90b('0x24')][_0xa90b('0xe')](this));};EmailImap[_0xa90b('0x13')][_0xa90b('0x24')]=function(_0x38f815,_0x46a9c8){if(_0x38f815){this[_0xa90b('0x11')](_0x38f815,!![]);}else{if(_0x46a9c8[_0xa90b('0x25')]){try{var _0x24a816=this[_0xa90b('0x1')][_0xa90b('0x26')](_0x46a9c8,{'bodies':'','markSeen':!![]});_0x24a816['on']('message',this[_0xa90b('0x27')][_0xa90b('0xe')](this));_0x24a816[_0xa90b('0xc')]('error',this[_0xa90b('0x28')][_0xa90b('0xe')](this));_0x24a816[_0xa90b('0xc')](_0xa90b('0x22'),this[_0xa90b('0x29')][_0xa90b('0xe')](this));}catch(_0x53dfea){logger['error'](_0x53dfea);}}else{this[_0xa90b('0x1')][_0xa90b('0x2a')](!![],this[_0xa90b('0x2b')][_0xa90b('0xe')](this));}}};EmailImap[_0xa90b('0x13')][_0xa90b('0x27')]=function(_0x40655e){_0x40655e['on'](_0xa90b('0x2c'),this['handleMessageBody'][_0xa90b('0xe')](this));_0x40655e[_0xa90b('0xc')]('attributes',this[_0xa90b('0x2d')][_0xa90b('0xe')](this));_0x40655e[_0xa90b('0xc')](_0xa90b('0x22'),this[_0xa90b('0x2e')][_0xa90b('0xe')](this));};EmailImap[_0xa90b('0x13')][_0xa90b('0x2f')]=function(_0x33e50e){simpleParser(_0x33e50e,{'Iconv':Iconv},this['handleSimpleParser'][_0xa90b('0xe')](this));};EmailImap['prototype'][_0xa90b('0x2d')]=function(){};EmailImap['prototype'][_0xa90b('0x2e')]=function(){};EmailImap['prototype'][_0xa90b('0x30')]=function(_0x3df349,_0x1eed6b){if(_0x3df349){logger['error'](_0x3df349);}else{var _0x5a1949=this;utils[_0xa90b('0x31')](this[_0xa90b('0xb')],_0x1eed6b,function(_0x439c87){_0x5a1949['emit'](_0xa90b('0x19'),_0x439c87);});}};EmailImap[_0xa90b('0x13')][_0xa90b('0x29')]=function(){this[_0xa90b('0x1')]['closeBox'](!![],this[_0xa90b('0x2b')][_0xa90b('0xe')](this));};EmailImap[_0xa90b('0x13')][_0xa90b('0x28')]=function(_0x1a23ad){this[_0xa90b('0x11')](_0x1a23ad);this[_0xa90b('0x1')]['closeBox'](!![],this[_0xa90b('0x2b')][_0xa90b('0xe')](this));};EmailImap[_0xa90b('0x13')][_0xa90b('0xf')]=function(){this[_0xa90b('0x21')]('end');};EmailImap['prototype'][_0xa90b('0x11')]=function(_0x39c979,_0x45a6d3){logger[_0xa90b('0x10')](_0xa90b('0x11'),this[_0xa90b('0xb')][_0xa90b('0x19')],JSON[_0xa90b('0x32')](_0x39c979));var _0x357b4a='';if(_0x39c979){if(_0x39c979[_0xa90b('0x33')]){_0x357b4a=_0x39c979[_0xa90b('0x33')];}else{for(var _0x2b05bc in _0x39c979){if(_0x39c979[_0xa90b('0x34')](_0x2b05bc)){_0x357b4a+=_[_0xa90b('0x35')](_0x2b05bc)+':\x20'+_0x39c979[_0x2b05bc]+'\x0a';}}}}if(_0x45a6d3){this[_0xa90b('0x1')][_0xa90b('0x22')]();}else{this[_0xa90b('0x21')](_0xa90b('0x10'),_0x357b4a);this['emit']('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x0fa0=['handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','openBox','mailbox','handleOpenBox','box','handleCloseBox','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleEnd','textCode','hasOwnProperty','emit','exports','util','mailparser','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','imap','ready','handleReady','once','end','bind','error'];(function(_0x2add1c,_0x50f7c7){var _0x304af0=function(_0x324103){while(--_0x324103){_0x2add1c['push'](_0x2add1c['shift']());}};_0x304af0(++_0x50f7c7);}(_0x0fa0,0xb1));var _0x00fa=function(_0x4eb4ed,_0x1f8fa1){_0x4eb4ed=_0x4eb4ed-0x0;var _0x10ef20=_0x0fa0[_0x4eb4ed];return _0x10ef20;};'use strict';var _=require('lodash');var util=require(_0x00fa('0x0'));var Imap=require('imap');var simpleParser=require(_0x00fa('0x1'))[_0x00fa('0x2')];var Iconv=require('iconv')[_0x00fa('0x3')];var EventEmitter=require('events')[_0x00fa('0x4')];var utils=require(_0x00fa('0x5'));var logger=require(_0x00fa('0x6'))(_0x00fa('0x7'));function EmailImap(_0x24d38a,_0xd62b68){this['mailbox']=_0x00fa('0x8');this[_0x00fa('0x9')]=this[_0x00fa('0xa')](_0x24d38a,_0xd62b68);this[_0x00fa('0xb')]=new Imap(this[_0x00fa('0x9')]);this[_0x00fa('0xb')]['once'](_0x00fa('0xc'),this[_0x00fa('0xd')]['bind'](this));this['imap'][_0x00fa('0xe')](_0x00fa('0xf'),this['handleEnd'][_0x00fa('0x10')](this));this[_0x00fa('0xb')]['on'](_0x00fa('0x11'),this[_0x00fa('0x12')][_0x00fa('0x10')](this));this[_0x00fa('0xb')][_0x00fa('0x13')]();}util[_0x00fa('0x14')](EmailImap,EventEmitter);EmailImap[_0x00fa('0x15')][_0x00fa('0xa')]=function(_0x578826,_0x34db20){var _0x1b8c02={'connTimeout':_0x578826[_0x00fa('0x16')]?_0x578826[_0x00fa('0x16')]*0x3e8:0x2710,'authTimeout':_0x578826['authTimeout']?_0x578826[_0x00fa('0x17')]*0x3e8:0x1388};if(_0x578826[_0x00fa('0x18')]){_0x1b8c02[_0x00fa('0x19')]=_0x578826[_0x00fa('0x19')];if(_0x578826[_0x00fa('0x1a')]){_0x1b8c02[_0x00fa('0x1b')]=utils[_0x00fa('0x1c')](_0x578826[_0x00fa('0x1d')][_0x00fa('0x1e')],_0x578826[_0x00fa('0x19')]);}else{_0x1b8c02[_0x00fa('0x1f')]=_0x578826['password'];}}else{if(_0x578826[_0x00fa('0x20')]){_0x1b8c02[_0x00fa('0x19')]=_0x578826[_0x00fa('0x19')];_0x1b8c02['password']=_0x578826['password'];}}_0x1b8c02[_0x00fa('0x7')]=_0x34db20||_0x578826[_0x00fa('0x19')]||_0x00fa('0x21');_0x1b8c02[_0x00fa('0x22')]=_0x578826[_0x00fa('0x22')];_0x1b8c02[_0x00fa('0x23')]=_0x578826['port']||0x3e1;if(_0x578826[_0x00fa('0x24')]){_0x1b8c02[_0x00fa('0x24')]=!![];}else{_0x1b8c02[_0x00fa('0x24')]=![];_0x1b8c02['autotls']=_0x00fa('0x25');}return _0x1b8c02;};EmailImap[_0x00fa('0x15')][_0x00fa('0xd')]=function(){this[_0x00fa('0xb')][_0x00fa('0x26')](this[_0x00fa('0x27')],![],this[_0x00fa('0x28')][_0x00fa('0x10')](this));};EmailImap[_0x00fa('0x15')]['handleOpenBox']=function(_0xc94492,_0x477343){if(_0xc94492){this['handleError'](_0xc94492,!![]);}else{this['emit'](_0x00fa('0x29'),_0x477343);this['readUnseen']();}};EmailImap[_0x00fa('0x15')][_0x00fa('0x2a')]=function(_0x23d1a6){if(_0x23d1a6){this[_0x00fa('0x12')](_0x23d1a6,!![]);}else{this[_0x00fa('0xb')]['end']();}};EmailImap['prototype'][_0x00fa('0x2b')]=function(){this[_0x00fa('0xb')]['search']([_0x00fa('0x2c')],this[_0x00fa('0x2d')][_0x00fa('0x10')](this));};EmailImap[_0x00fa('0x15')][_0x00fa('0x2d')]=function(_0x2bb534,_0x3b5040){if(_0x2bb534){this['handleError'](_0x2bb534,!![]);}else{if(_0x3b5040[_0x00fa('0x2e')]){try{var _0x3b9eba=this[_0x00fa('0xb')][_0x00fa('0x2f')](_0x3b5040,{'bodies':'','markSeen':!![]});_0x3b9eba['on'](_0x00fa('0x30'),this[_0x00fa('0x31')][_0x00fa('0x10')](this));_0x3b9eba[_0x00fa('0xe')](_0x00fa('0x11'),this[_0x00fa('0x32')][_0x00fa('0x10')](this));_0x3b9eba[_0x00fa('0xe')](_0x00fa('0xf'),this[_0x00fa('0x33')][_0x00fa('0x10')](this));}catch(_0x77654){logger['error'](_0x77654);}}else{this[_0x00fa('0xb')][_0x00fa('0x34')](!![],this[_0x00fa('0x2a')]['bind'](this));}}};EmailImap[_0x00fa('0x15')][_0x00fa('0x31')]=function(_0x186dce){_0x186dce['on'](_0x00fa('0x35'),this['handleMessageBody'][_0x00fa('0x10')](this));_0x186dce[_0x00fa('0xe')](_0x00fa('0x36'),this['handleMessageAttributes'][_0x00fa('0x10')](this));_0x186dce[_0x00fa('0xe')](_0x00fa('0xf'),this['handleMessageEnd'][_0x00fa('0x10')](this));};EmailImap['prototype'][_0x00fa('0x37')]=function(_0x1021b7){simpleParser(_0x1021b7,{'Iconv':Iconv},this['handleSimpleParser'][_0x00fa('0x10')](this));};EmailImap[_0x00fa('0x15')][_0x00fa('0x38')]=function(){};EmailImap[_0x00fa('0x15')][_0x00fa('0x39')]=function(){};EmailImap[_0x00fa('0x15')][_0x00fa('0x3a')]=function(_0x195a8d,_0x3507d5){if(_0x195a8d){logger[_0x00fa('0x11')](_0x195a8d);}else{var _0x498f73=this;utils[_0x00fa('0x3b')](this[_0x00fa('0x9')],_0x3507d5,function(_0x2b5518){_0x498f73['emit'](_0x00fa('0x7'),_0x2b5518);});}};EmailImap[_0x00fa('0x15')]['handleFetchEnd']=function(){this[_0x00fa('0xb')][_0x00fa('0x34')](!![],this[_0x00fa('0x2a')][_0x00fa('0x10')](this));};EmailImap['prototype']['handleFetchError']=function(_0x9efe9f){this[_0x00fa('0x12')](_0x9efe9f);this[_0x00fa('0xb')]['closeBox'](!![],this[_0x00fa('0x2a')]['bind'](this));};EmailImap[_0x00fa('0x15')][_0x00fa('0x3c')]=function(){this['emit']('end');};EmailImap[_0x00fa('0x15')][_0x00fa('0x12')]=function(_0x16a172,_0xb6bd95){logger['error']('handleError',this[_0x00fa('0x9')]['email'],JSON['stringify'](_0x16a172));var _0x156e38='';if(_0x16a172){if(_0x16a172[_0x00fa('0x3d')]){_0x156e38=_0x16a172['textCode'];}else{for(var _0x207671 in _0x16a172){if(_0x16a172[_0x00fa('0x3e')](_0x207671)){_0x156e38+=_['upperFirst'](_0x207671)+':\x20'+_0x16a172[_0x207671]+'\x0a';}}}}if(_0xb6bd95){this[_0x00fa('0xb')][_0x00fa('0xf')]();}else{this[_0x00fa('0x3f')](_0x00fa('0x11'),_0x156e38);this[_0x00fa('0x3f')](_0x00fa('0xf'));}};module[_0x00fa('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 85a1cd5..07ea361 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 _0x9404=['send','use','compile','sendMail','toString','createTransport','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype'];(function(_0x356f2a,_0x44420d){var _0x570af9=function(_0x41511c){while(--_0x41511c){_0x356f2a['push'](_0x356f2a['shift']());}};_0x570af9(++_0x44420d);}(_0x9404,0x148));var _0x4940=function(_0x3dc142,_0x375bdc){_0x3dc142=_0x3dc142-0x0;var _0x1bd1ae=_0x9404[_0x3dc142];return _0x1bd1ae;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x4940('0x0'));function EmailSmtp(){}EmailSmtp[_0x4940('0x1')][_0x4940('0x2')]=function(_0x524eb3,_0x525cad){return new Promise(function(_0x279dc7,_0x22085d){var _0x2e1dd7=nodemailer['createTransport'](_0x524eb3);_0x2e1dd7[_0x4940('0x3')](_0x4940('0x4'),inlineBase64());_0x2e1dd7[_0x4940('0x5')](_0x525cad,function(_0x511d26,_0x1a640f){if(_0x511d26){_0x22085d(_0x511d26[_0x4940('0x6')]());}else{_0x279dc7(_0x1a640f);}});});};EmailSmtp[_0x4940('0x1')]['verify']=function(_0x13c86a){return new Promise(function(_0x4f294c,_0x29814a){var _0x2a24c4=nodemailer[_0x4940('0x7')](_0x13c86a);_0x2a24c4[_0x4940('0x8')](function(_0x30ad33,_0x51f6b9){if(_0x30ad33){_0x29814a(_0x30ad33[_0x4940('0x6')]());}else{if(_0x51f6b9){_0x4f294c(_0x51f6b9);}else{_0x29814a(_0x4940('0x9'));}}});});};module[_0x4940('0xa')]=EmailSmtp; \ No newline at end of file +var _0xf44c=['exports','nodemailer','send','createTransport','use','compile','sendMail','toString','prototype','Not\x20verifired'];(function(_0x40ec5f,_0x441009){var _0x136919=function(_0x14cace){while(--_0x14cace){_0x40ec5f['push'](_0x40ec5f['shift']());}};_0x136919(++_0x441009);}(_0xf44c,0x12d));var _0xcf44=function(_0x26fa9d,_0x46e6d6){_0x26fa9d=_0x26fa9d-0x0;var _0x29ed36=_0xf44c[_0x26fa9d];return _0x29ed36;};'use strict';var nodemailer=require(_0xcf44('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xcf44('0x1')]=function(_0x16b09c,_0x114e71){return new Promise(function(_0x3b9869,_0x124c46){var _0x1d05a2=nodemailer[_0xcf44('0x2')](_0x16b09c);_0x1d05a2[_0xcf44('0x3')](_0xcf44('0x4'),inlineBase64());_0x1d05a2[_0xcf44('0x5')](_0x114e71,function(_0x498f58,_0x5624ec){if(_0x498f58){_0x124c46(_0x498f58[_0xcf44('0x6')]());}else{_0x3b9869(_0x5624ec);}});});};EmailSmtp[_0xcf44('0x7')]['verify']=function(_0x3e5b78){return new Promise(function(_0x48a618,_0x226e06){var _0x3ca351=nodemailer[_0xcf44('0x2')](_0x3e5b78);_0x3ca351['verify'](function(_0x30972d,_0x22c704){if(_0x30972d){_0x226e06(_0x30972d[_0xcf44('0x6')]());}else{if(_0x22c704){_0x48a618(_0x22c704);}else{_0x226e06(_0xcf44('0x8'));}}});});};module[_0xcf44('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index fbfd38e..110316e 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 _0x96be=['_SRC','_IMG','\x20[Attachment:\x20','body','message','bcc','attachments','type','attachment','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','date','textAsHtml','filter','application/ms-tnef','info','messageId','parseBuffer','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','0x1?_0x4cfe6e[_0xe96b('0x10')](0x0,-0x1)[_0xe96b('0x11')]('\x20'):_0x40e68f[_0xe96b('0xd')];}return _0xe96b('0x12');}function getLastName(_0x575325){var _0x5013b0=_['head'](_0x575325[_0xe96b('0x8')]);if(_0x5013b0&&_0x5013b0[_0xe96b('0xd')]){var _0x42e4f4=_0x5013b0[_0xe96b('0xd')][_0xe96b('0xe')](/\s+/);return _0x42e4f4[_0xe96b('0xf')]>0x1?_0x42e4f4[_0xe96b('0x13')]():'';}return'';}function getMails(_0x25c0f1,_0x1ff647){var _0x1710c5='';for(var _0x37ebf7=0x0;_0x37ebf7<_0x1ff647[_0xe96b('0x8')]['length'];_0x37ebf7+=0x1){if(_0x1ff647[_0xe96b('0x8')][_0x37ebf7][_0xe96b('0x9')]!==_0x25c0f1){if(!_[_0xe96b('0x14')](_0x1710c5)){_0x1710c5+=',';}_0x1710c5+=_0x1ff647[_0xe96b('0x8')][_0x37ebf7]['name']||_0x1ff647[_0xe96b('0x8')][_0x37ebf7][_0xe96b('0x9')]||'';_0x1710c5+='\x20<';_0x1710c5+=_0x1ff647[_0xe96b('0x8')][_0x37ebf7][_0xe96b('0x9')]?_0x1ff647[_0xe96b('0x8')][_0x37ebf7][_0xe96b('0x9')]:_0xe96b('0xa')+random[_0xe96b('0xb')](0x6)+_0xe96b('0xc');_0x1710c5+='>';}}return _0x1710c5;}function parseEmail(_0x5b2162,_0x1f4bfa,_0x187947){if(_0x1f4bfa[_0xe96b('0x15')]){var _0x17ce76=/)<[^<]*)*<\/script>/gi;while(_0x17ce76[_0xe96b('0x16')](_0x1f4bfa[_0xe96b('0x15')])){_0x1f4bfa[_0xe96b('0x15')]=_0x1f4bfa[_0xe96b('0x15')][_0xe96b('0x17')](_0x17ce76,'');}if(_0x1f4bfa[_0xe96b('0x15')][_0xe96b('0x18')](_0xe96b('0x19'))){var _0x1d3bf5=[];_0x1f4bfa['attachments']['forEach'](_0x71ed96=>{_0x1d3bf5[_0xe96b('0x1a')](_0x71ed96[_0xe96b('0x1b')]);});var _0x4cc525=/]+>/g;var _0x2cddc=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x553806=_0x1f4bfa[_0xe96b('0x15')][_0xe96b('0x17')](_0x2cddc,_0xe96b('0x1c'));var _0x2186e6=_0x553806[_0xe96b('0x17')](_0x4cc525,_0xe96b('0x1d'));for(let _0x3699d9=0x0;_0x3699d9<_0x1d3bf5[_0xe96b('0xf')];_0x3699d9++){var _0x4b1e5e=_0x2186e6[_0xe96b('0x17')](_0xe96b('0x1d'),_0xe96b('0x1e')+_0x1d3bf5[_0x3699d9]+'\x20]');_0x2186e6=_0x4b1e5e;}_0x1f4bfa[_0xe96b('0x15')]=_0x2186e6;}_0x187947[_0xe96b('0x1f')]=_0x1f4bfa[_0xe96b('0x15')];}else{_0x187947[_0xe96b('0x1f')]=_0x1f4bfa['textAsHtml'];}if(_0x187947['body']){_0x187947[_0xe96b('0x1f')]=_0x187947[_0xe96b('0x1f')][_0xe96b('0x17')](/0x0){var _0x2e37bc=[_0xe96b('0x2e'),_0xe96b('0x2f'),_0xe96b('0x30')];for(var _0x4dfd9a=0x0;_0x4dfd9a<_0x1f4bfa[_0xe96b('0x2d')]['length'];_0x4dfd9a++){var _0x588311=_[_0xe96b('0x31')](_0x2e37bc,_0x1f4bfa[_0xe96b('0x2d')][_0x4dfd9a][_0xe96b('0x32')]);if(_0x588311>=0x0){_0x187947[_0xe96b('0x33')]=!![];}}}return _0x187947;}exports[_0xe96b('0x34')]=function(_0x59ea84,_0x3acea3,_0x299ca3){var _0x4eea04={'from':getAddress(_0x3acea3[_0xe96b('0x35')]),'firstName':getFirstName(_0x3acea3[_0xe96b('0x35')]),'lastName':getLastName(_0x3acea3['from']),'mapKey':_0xe96b('0x5'),'message':{'from':getMails(_0x59ea84[_0xe96b('0x5')],_0x3acea3[_0xe96b('0x35')]),'to':_0x59ea84[_0xe96b('0x5')],'cc':'','subject':_0x3acea3['subject']||'','messageId':_0x3acea3['messageId'],'inReplyTo':_0x3acea3['inReplyTo'],'sentAt':moment(_0x3acea3[_0xe96b('0x36')])[_0xe96b('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3acea3[_0xe96b('0x15')]&&!_0x3acea3[_0xe96b('0x37')]){var _0x1ecff5=_[_0xe96b('0x38')](_0x3acea3[_0xe96b('0x22')],{'contentType':_0xe96b('0x39')});if(_0x1ecff5['length']){logger[_0xe96b('0x3a')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3acea3[_0xe96b('0x3b')]));tnef[_0xe96b('0x3c')](_[_0xe96b('0x3d')](_0x1ecff5)[_0xe96b('0x2b')],function(_0x289719,_0x39ae24){if(_0x39ae24){_0x3acea3['html']=_0x39ae24['BodyHTML']||_0xe96b('0x3e');if(_0x39ae24['Attachments']){for(var _0x44d7a1=0x0;_0x44d7a1<_0x39ae24['Attachments']['length'];_0x44d7a1++){var _0x492ed0=_0x39ae24[_0xe96b('0x3f')][_0x44d7a1];_0x4eea04[_0xe96b('0x20')]['attachments'][_0xe96b('0x1a')]({'filename':_0x492ed0[_0xe96b('0x40')],'content':Buffer[_0xe96b('0x35')](_0x492ed0[_0xe96b('0x41')])});}}}_0x299ca3(parseEmail(_0x59ea84,_0x3acea3,_0x4eea04));});}else{_0x3acea3['html']=_0xe96b('0x3e');_0x299ca3(parseEmail(_0x59ea84,_0x3acea3,_0x4eea04));}}else{_0x299ca3(parseEmail(_0x59ea84,_0x3acea3,_0x4eea04));}};exports[_0xe96b('0x42')]=function(_0x4b1d4f,_0x41767d){var _0x504ab2=['user='+(_0x41767d||''),_0xe96b('0x43')+_0x4b1d4f,'',''];return Buffer[_0xe96b('0x35')](_0x504ab2[_0xe96b('0x11')](''),'utf-8')[_0xe96b('0x44')](_0xe96b('0x45'));}; \ No newline at end of file +var _0x56e8=['email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','indexOf','split','length','slice','join','Anonymous','isEmpty','html','replace','includes','','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','base64','lodash','moment','randomstring','util','node-tnef'];(function(_0x49d80e,_0x4e6ea2){var _0x4e8551=function(_0x75bd4e){while(--_0x75bd4e){_0x49d80e['push'](_0x49d80e['shift']());}};_0x4e8551(++_0x4e6ea2);}(_0x56e8,0x117));var _0x856e=function(_0x3b0589,_0x23fe23){_0x3b0589=_0x3b0589-0x0;var _0x422788=_0x56e8[_0x3b0589];return _0x422788;};'use strict';var _=require(_0x856e('0x0'));var moment=require(_0x856e('0x1'));var random=require(_0x856e('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x856e('0x3'));var tnef=require(_0x856e('0x4'));var logger=require('../../../config/logger')(_0x856e('0x5'));var config=require(_0x856e('0x6'));function getAddress(_0x1da088){var _0x393b65=_['head'](_0x1da088[_0x856e('0x7')]);return _0x393b65&&_0x393b65[_0x856e('0x8')]?_0x393b65[_0x856e('0x8')]:_0x856e('0x9')+random[_0x856e('0xa')](0x6)+_0x856e('0xb');}function getFirstName(_0xe68c9){var _0x38cab2=_[_0x856e('0xc')](_0xe68c9[_0x856e('0x7')]);if(_0x38cab2&&_0x38cab2[_0x856e('0xd')]){if(_0x38cab2[_0x856e('0xd')]==_0x38cab2[_0x856e('0x8')]){return _0x38cab2['name']['substring'](0x0,_0x38cab2['name'][_0x856e('0xe')]('@'));}var _0x255909=_0x38cab2[_0x856e('0xd')][_0x856e('0xf')](/\s+/);return _0x255909[_0x856e('0x10')]>0x1?_0x255909[_0x856e('0x11')](0x0,-0x1)[_0x856e('0x12')]('\x20'):_0x38cab2[_0x856e('0xd')];}return _0x856e('0x13');}function getLastName(_0x3b1588){var _0xf3760e=_['head'](_0x3b1588['value']);if(_0xf3760e&&_0xf3760e[_0x856e('0xd')]){var _0x52c53b=_0xf3760e[_0x856e('0xd')][_0x856e('0xf')](/\s+/);return _0x52c53b[_0x856e('0x10')]>0x1?_0x52c53b['pop']():'';}return'';}function getMails(_0x39835e,_0x12fcc8){var _0x56c905='';for(var _0x6c87d7=0x0;_0x6c87d7<_0x12fcc8['value'][_0x856e('0x10')];_0x6c87d7+=0x1){if(_0x12fcc8[_0x856e('0x7')][_0x6c87d7][_0x856e('0x8')]!==_0x39835e){if(!_[_0x856e('0x14')](_0x56c905)){_0x56c905+=',';}_0x56c905+=_0x12fcc8[_0x856e('0x7')][_0x6c87d7][_0x856e('0xd')]||_0x12fcc8[_0x856e('0x7')][_0x6c87d7]['address']||'';_0x56c905+='\x20<';_0x56c905+=_0x12fcc8[_0x856e('0x7')][_0x6c87d7]['address']?_0x12fcc8[_0x856e('0x7')][_0x6c87d7][_0x856e('0x8')]:_0x856e('0x9')+random[_0x856e('0xa')](0x6)+_0x856e('0xb');_0x56c905+='>';}}return _0x56c905;}function parseEmail(_0x5ba8f1,_0x387b53,_0x114689){if(_0x387b53[_0x856e('0x15')]){var _0x4ee26a=/)<[^<]*)*<\/script>/gi;while(_0x4ee26a['test'](_0x387b53[_0x856e('0x15')])){_0x387b53[_0x856e('0x15')]=_0x387b53['html'][_0x856e('0x16')](_0x4ee26a,'');}if(_0x387b53[_0x856e('0x15')][_0x856e('0x17')](_0x856e('0x18'))){var _0x8f694=[];_0x387b53[_0x856e('0x19')]['forEach'](_0x25dad0=>{_0x8f694[_0x856e('0x1a')](_0x25dad0['filename']);});var _0x4c1422=/]+>/g;var _0x24f06a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3c3ca9=_0x387b53[_0x856e('0x15')]['replace'](_0x24f06a,_0x856e('0x1b'));var _0x5df0ef=_0x3c3ca9[_0x856e('0x16')](_0x4c1422,_0x856e('0x1c'));for(let _0x50841a=0x0;_0x50841a<_0x8f694[_0x856e('0x10')];_0x50841a++){var _0x4ef673=_0x5df0ef[_0x856e('0x16')](_0x856e('0x1c'),'\x20[Attachment:\x20'+_0x8f694[_0x50841a]+_0x856e('0x1d'));_0x5df0ef=_0x4ef673;}_0x387b53[_0x856e('0x15')]=_0x5df0ef;}_0x114689[_0x856e('0x1e')]=_0x387b53['html'];}else{_0x114689[_0x856e('0x1e')]=_0x387b53['textAsHtml'];}if(_0x114689[_0x856e('0x1e')]){_0x114689[_0x856e('0x1e')]=_0x114689[_0x856e('0x1e')][_0x856e('0x16')](/0x0){var _0x16df42=[_0x856e('0x31'),_0x856e('0x32'),_0x856e('0x33')];for(var _0x2681be=0x0;_0x2681be<_0x387b53[_0x856e('0x30')][_0x856e('0x10')];_0x2681be++){var _0x4bb927=_[_0x856e('0xe')](_0x16df42,_0x387b53[_0x856e('0x30')][_0x2681be][_0x856e('0x34')]);if(_0x4bb927>=0x0){_0x114689[_0x856e('0x35')]=!![];}}}return _0x114689;}exports['parser']=function(_0x2c380f,_0x3e9c05,_0x2d20a4){var _0x4ae287={'from':getAddress(_0x3e9c05[_0x856e('0x36')]),'firstName':getFirstName(_0x3e9c05[_0x856e('0x36')]),'lastName':getLastName(_0x3e9c05['from']),'mapKey':'email','message':{'from':getMails(_0x2c380f[_0x856e('0x5')],_0x3e9c05['from']),'to':_0x2c380f['email'],'cc':'','subject':_0x3e9c05[_0x856e('0x37')]||'','messageId':_0x3e9c05[_0x856e('0x38')],'inReplyTo':_0x3e9c05[_0x856e('0x39')],'sentAt':moment(_0x3e9c05['date'])[_0x856e('0x28')](_0x856e('0x3a')),'attach':![],'attachments':[]}};if(!_0x3e9c05[_0x856e('0x15')]&&!_0x3e9c05['textAsHtml']){var _0x55a907=_[_0x856e('0x3b')](_0x3e9c05['attachments'],{'contentType':_0x856e('0x3c')});if(_0x55a907[_0x856e('0x10')]){logger['info'](util[_0x856e('0x28')](_0x856e('0x3d'),_0x3e9c05[_0x856e('0x38')]));tnef['parseBuffer'](_[_0x856e('0x3e')](_0x55a907)[_0x856e('0x2e')],function(_0x5c7457,_0x5292a0){if(_0x5292a0){_0x3e9c05['html']=_0x5292a0['BodyHTML']||_0x856e('0x3f');if(_0x5292a0['Attachments']){for(var _0x292453=0x0;_0x292453<_0x5292a0[_0x856e('0x40')][_0x856e('0x10')];_0x292453++){var _0xcb2fc1=_0x5292a0['Attachments'][_0x292453];_0x4ae287[_0x856e('0x20')][_0x856e('0x19')][_0x856e('0x1a')]({'filename':_0xcb2fc1[_0x856e('0x41')],'content':Buffer[_0x856e('0x36')](_0xcb2fc1[_0x856e('0x42')])});}}}_0x2d20a4(parseEmail(_0x2c380f,_0x3e9c05,_0x4ae287));});}else{_0x3e9c05[_0x856e('0x15')]=_0x856e('0x3f');_0x2d20a4(parseEmail(_0x2c380f,_0x3e9c05,_0x4ae287));}}else{_0x2d20a4(parseEmail(_0x2c380f,_0x3e9c05,_0x4ae287));}};exports[_0x856e('0x43')]=function(_0x59a347,_0x1d26a1){var _0x522041=[_0x856e('0x44')+(_0x1d26a1||''),_0x856e('0x45')+_0x59a347,'',''];return Buffer[_0x856e('0x36')](_0x522041[_0x856e('0x12')](''),'utf-8')['toString'](_0x856e('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e288254..6eff459 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 _0xb875=['Service','key','SERV','active','Imap','Smtp','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb875,0x1c6));var _0x5b87=function(_0x18123f,_0x17c3e7){_0x18123f=_0x18123f-0x0;var _0x32a03d=_0xb875[_0x18123f];return _0x32a03d;};'use strict';var _=require('lodash');function MailAccount(_0x241eab){this['id']=_0x241eab['id']||0x0;this[_0x5b87('0x0')]=_0x241eab['name']||_0x5b87('0x1');this[_0x5b87('0x2')]=_0x241eab[_0x5b87('0x2')]||_0x5b87('0x3');this[_0x5b87('0x4')]=_0x241eab[_0x5b87('0x4')]||![];this[_0x5b87('0x5')]=_0x241eab[_0x5b87('0x5')]||[];this[_0x5b87('0x6')]=_0x241eab['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xbf25=['active','Imap','Smtp','exports','lodash','name','Service','SERV'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xbf25,0x18c));var _0x5bf2=function(_0x4f2d2c,_0x4f8716){_0x4f2d2c=_0x4f2d2c-0x0;var _0x554efc=_0xbf25[_0x4f2d2c];return _0x554efc;};'use strict';var _=require(_0x5bf2('0x0'));function MailAccount(_0x22409c){this['id']=_0x22409c['id']||0x0;this[_0x5bf2('0x1')]=_0x22409c[_0x5bf2('0x1')]||_0x5bf2('0x2');this['key']=_0x22409c['key']||_0x5bf2('0x3');this[_0x5bf2('0x4')]=_0x22409c[_0x5bf2('0x4')]||![];this[_0x5bf2('0x5')]=_0x22409c[_0x5bf2('0x5')]||[];this['Smtp']=_0x22409c[_0x5bf2('0x6')]||[];}module[_0x5bf2('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 345b824..d364932 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 _0xe3e6=['mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','exports','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe3e6,0x15f));var _0x6e3e=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0xe3e6[_0x39e164];return _0x13fa6b;};'use strict';var _=require(_0x6e3e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x6e3e('0x1')]={};};function freeIsNotKey(_0x28fdbc,_0x390547,_0x5ed208){var _0x123c8a=_[_0x6e3e('0x2')](_0x28fdbc,function(_0x196799,_0x253ffa){return _0x196799[_0x5ed208];});for(var _0x3e0206 in _0x390547){if(_0x390547[_0x6e3e('0x3')](_0x3e0206)){if(!_0x123c8a[_0x3e0206]){delete _0x390547[_0x3e0206];}}}}Realtime[_0x6e3e('0x4')]['mergeFromDatabase']=function(_0x832ef7,_0x21df18){for(var _0x19fce5 in _0x21df18){if(_0x832ef7[_0x6e3e('0x3')](_0x19fce5)){_0x832ef7[_0x19fce5]=_0x21df18[_0x19fce5];}}};Realtime['prototype'][_0x6e3e('0x5')]=function(){var _0x3c4a03=this;return function(_0x148e48){if(_0x148e48){freeIsNotKey(_0x148e48,_0x3c4a03[_0x6e3e('0x1')],'id');for(var _0x57751c=0x0,_0x49ee4e={},_0x530e29={};_0x57751c<_0x148e48[_0x6e3e('0x6')];_0x57751c+=0x1){_0x49ee4e=_0x148e48[_0x57751c];if(_['isUndefined'](_0x3c4a03[_0x6e3e('0x1')][_0x49ee4e['id']])){_0x3c4a03['mailAccounts'][_0x49ee4e['id']]=new MailAccount(_0x49ee4e);}else{_['merge'](_0x3c4a03[_0x6e3e('0x1')][_0x49ee4e['id']],_0x49ee4e);}}}return _0x3c4a03[_0x6e3e('0x1')];};};module[_0x6e3e('0x7')]=Realtime; \ No newline at end of file +var _0x03fb=['mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x1e4177,_0x26a73a){var _0xa6e76c=function(_0x3a422e){while(--_0x3a422e){_0x1e4177['push'](_0x1e4177['shift']());}};_0xa6e76c(++_0x26a73a);}(_0x03fb,0x1db));var _0xb03f=function(_0x5de369,_0x27e31c){_0x5de369=_0x5de369-0x0;var _0x24ccbb=_0x03fb[_0x5de369];return _0x24ccbb;};'use strict';var _=require(_0xb03f('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xb03f('0x1')]={};};function freeIsNotKey(_0x397855,_0x44413a,_0x52f6dd){var _0xb74144=_[_0xb03f('0x2')](_0x397855,function(_0x4d49a3,_0x37e9bb){return _0x4d49a3[_0x52f6dd];});for(var _0xc12b34 in _0x44413a){if(_0x44413a[_0xb03f('0x3')](_0xc12b34)){if(!_0xb74144[_0xc12b34]){delete _0x44413a[_0xc12b34];}}}}Realtime[_0xb03f('0x4')][_0xb03f('0x5')]=function(_0x45c8e2,_0x3b3afc){for(var _0xdaaad1 in _0x3b3afc){if(_0x45c8e2[_0xb03f('0x3')](_0xdaaad1)){_0x45c8e2[_0xdaaad1]=_0x3b3afc[_0xdaaad1];}}};Realtime[_0xb03f('0x4')][_0xb03f('0x6')]=function(){var _0x538d55=this;return function(_0xce2c2b){if(_0xce2c2b){freeIsNotKey(_0xce2c2b,_0x538d55[_0xb03f('0x1')],'id');for(var _0x1e2ffc=0x0,_0x48cff7={},_0x42784e={};_0x1e2ffc<_0xce2c2b[_0xb03f('0x7')];_0x1e2ffc+=0x1){_0x48cff7=_0xce2c2b[_0x1e2ffc];if(_[_0xb03f('0x8')](_0x538d55[_0xb03f('0x1')][_0x48cff7['id']])){_0x538d55[_0xb03f('0x1')][_0x48cff7['id']]=new MailAccount(_0x48cff7);}else{_[_0xb03f('0x9')](_0x538d55[_0xb03f('0x1')][_0x48cff7['id']],_0x48cff7);}}}return _0x538d55[_0xb03f('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 42681b1..930212d 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 _0xea21=['../client','Request','GetMailAccount','name','service','active','key','ListId','TemplateId','Imap','CloudProvider','data5','Smtp','type','notify','NotifyMailAccount'];(function(_0x34e38e,_0x2fda66){var _0x523066=function(_0x10ffc3){while(--_0x10ffc3){_0x34e38e['push'](_0x34e38e['shift']());}};_0x523066(++_0x2fda66);}(_0xea21,0x80));var _0x1ea2=function(_0x1b71ad,_0x38fcaf){_0x1b71ad=_0x1b71ad-0x0;var _0x1419b3=_0xea21[_0x1b71ad];return _0x1419b3;};'use strict';var client=require(_0x1ea2('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x1ea2('0x1')](_0x1ea2('0x2'),{'options':{'attributes':['id',_0x1ea2('0x3'),'provider',_0x1ea2('0x4'),'email',_0x1ea2('0x5'),_0x1ea2('0x6'),_0x1ea2('0x7'),_0x1ea2('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x1ea2('0x9'),'include':[{'model':_0x1ea2('0xa'),'attributes':['id',_0x1ea2('0x3'),_0x1ea2('0x4'),'type',_0x1ea2('0xb')],'as':_0x1ea2('0xa')}]},{'model':'MailServerOut','as':_0x1ea2('0xc'),'include':[{'model':_0x1ea2('0xa'),'attributes':['id',_0x1ea2('0x3'),_0x1ea2('0x4'),_0x1ea2('0xd'),_0x1ea2('0xb')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x1ea2('0xe')]=function(_0x1a98b2,_0x2a16f7){return client[_0x1ea2('0x1')](_0x1ea2('0xf'),{'account':{'id':_0x1a98b2},'body':_0x2a16f7,'log':_0x1ea2('0xf')});}; \ No newline at end of file +var _0x7c71=['GetMailAccount','provider','service','email','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','data5','MailServerOut','Smtp','type','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x3dc5a8,_0x5ac770){var _0x5327cc=function(_0x2d6ae7){while(--_0x2d6ae7){_0x3dc5a8['push'](_0x3dc5a8['shift']());}};_0x5327cc(++_0x5ac770);}(_0x7c71,0x177));var _0x17c7=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x7c71[_0x1f9f37];return _0x21c080;};'use strict';var client=require(_0x17c7('0x0'));exports[_0x17c7('0x1')]=function(){return function(){return client[_0x17c7('0x2')](_0x17c7('0x3'),{'options':{'attributes':['id','name',_0x17c7('0x4'),_0x17c7('0x5'),_0x17c7('0x6'),'active','key',_0x17c7('0x7'),_0x17c7('0x8')],'raw':![],'include':[{'model':_0x17c7('0x9'),'as':_0x17c7('0xa'),'include':[{'model':_0x17c7('0xb'),'attributes':['id',_0x17c7('0xc'),_0x17c7('0x5'),'type',_0x17c7('0xd')],'as':_0x17c7('0xb')}]},{'model':_0x17c7('0xe'),'as':_0x17c7('0xf'),'include':[{'model':_0x17c7('0xb'),'attributes':['id',_0x17c7('0xc'),_0x17c7('0x5'),_0x17c7('0x10'),_0x17c7('0xd')],'as':_0x17c7('0xb')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x328463,_0x15b780){return client['Request'](_0x17c7('0x11'),{'account':{'id':_0x328463},'body':_0x15b780,'log':_0x17c7('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 5d3d886..106b42a 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 _0xbccf=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x9af93,_0x42d2ca){var _0x3cd026=function(_0x374797){while(--_0x374797){_0x9af93['push'](_0x9af93['shift']());}};_0x3cd026(++_0x42d2ca);}(_0xbccf,0x83));var _0xfbcc=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xbccf[_0x2b5513];return _0x578fd2;};'use strict';var client=require(_0xfbcc('0x0'));exports[_0xfbcc('0x1')]=function(){return client[_0xfbcc('0x2')](_0xfbcc('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfbcc('0x4')]},'log':_0xfbcc('0x5')});}; \ No newline at end of file +var _0x9953=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x1877d0,_0x4fc2ec){var _0x5d5778=function(_0x34e1c2){while(--_0x34e1c2){_0x1877d0['push'](_0x1877d0['shift']());}};_0x5d5778(++_0x4fc2ec);}(_0x9953,0xa9));var _0x3995=function(_0x1c7ad0,_0x448315){_0x1c7ad0=_0x1c7ad0-0x0;var _0x27314b=_0x9953[_0x1c7ad0];return _0x27314b;};'use strict';var client=require(_0x3995('0x0'));exports[_0x3995('0x1')]=function(){return client[_0x3995('0x2')](_0x3995('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3995('0x4')]},'log':_0x3995('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 413548a..d4dcb17 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 2e4a531..0bb357d 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 _0x8ab6=['websocket','polling','redis','defaults','localhost','adapter','default','../../config/socketio','../../config/express','listening','log','lodash','http','sticky-session','ioredis','createServer','timeout','listen','port','socket.io'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x8ab6,0x1c3));var _0x68ab=function(_0x1c958d,_0x5a6275){_0x1c958d=_0x1c958d-0x0;var _0xb2cef5=_0x8ab6[_0x1c958d];return _0xb2cef5;};'use strict';var _=require(_0x68ab('0x0'));var http=require(_0x68ab('0x1'));var express=require('express');var sticky=require(_0x68ab('0x2'));var Redis=require(_0x68ab('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x68ab('0x4')](app);server[_0x68ab('0x5')]=0xdbba0;if(sticky[_0x68ab('0x6')](server,config[_0x68ab('0x7')])){var socketio=require(_0x68ab('0x8'))(server,{'transports':[_0x68ab('0x9'),_0x68ab('0xa')]});config[_0x68ab('0xb')]=_[_0x68ab('0xc')](config[_0x68ab('0xb')],{'host':_0x68ab('0xd'),'port':0x18eb});socketio[_0x68ab('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0x68ab('0xb')]),'subClient':new Redis(config[_0x68ab('0xb')])}));require('../../config/triggers')[_0x68ab('0xf')]();require(_0x68ab('0x10'))[_0x68ab('0xf')](socketio);require(_0x68ab('0x11'))[_0x68ab('0xf')](app);require('../../routes')[_0x68ab('0xf')](app);}else{server['once'](_0x68ab('0x12'),function(){console[_0x68ab('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x68ab('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x1b6d=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','../../config/environment','listen','port','socket.io','polling','redis','defaults','localhost','default','../../config/express','../../routes'];(function(_0x1a54de,_0x1189a8){var _0x163e76=function(_0x43e672){while(--_0x43e672){_0x1a54de['push'](_0x1a54de['shift']());}};_0x163e76(++_0x1189a8);}(_0x1b6d,0xd6));var _0xd1b6=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1b6d[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var http=require(_0xd1b6('0x0'));var express=require(_0xd1b6('0x1'));var sticky=require(_0xd1b6('0x2'));var Redis=require('ioredis');var config=require(_0xd1b6('0x3'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xd1b6('0x4')](server,config[_0xd1b6('0x5')])){var socketio=require(_0xd1b6('0x6'))(server,{'transports':['websocket',_0xd1b6('0x7')]});config[_0xd1b6('0x8')]=_[_0xd1b6('0x9')](config[_0xd1b6('0x8')],{'host':_0xd1b6('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xd1b6('0x8')]),'subClient':new Redis(config[_0xd1b6('0x8')])}));require('../../config/triggers')[_0xd1b6('0xb')]();require('../../config/socketio')[_0xd1b6('0xb')](socketio);require(_0xd1b6('0xc'))[_0xd1b6('0xb')](app);require(_0xd1b6('0xd'))['default'](app);}else{server[_0xd1b6('0xe')](_0xd1b6('0xf'),function(){console[_0xd1b6('0x10')](_0xd1b6('0x11'),config['port']);});}exports=module[_0xd1b6('0x12')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d73b29a..53792ae 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 _0xaebd=['routing','client','http','Request','request','then','debug','rpc','error','message','result','bluebird','../../config/logger'];(function(_0x5b6ec7,_0x4d7271){var _0x5ba252=function(_0x403a73){while(--_0x403a73){_0x5b6ec7['push'](_0x5b6ec7['shift']());}};_0x5ba252(++_0x4d7271);}(_0xaebd,0x9a));var _0xdaeb=function(_0x2c622f,_0x90b3a8){_0x2c622f=_0x2c622f-0x0;var _0x41fae5=_0xaebd[_0x2c622f];return _0x41fae5;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xdaeb('0x0'));var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var client=jayson[_0xdaeb('0x3')][_0xdaeb('0x4')]({'port':0x2329});client[_0xdaeb('0x5')]=function(_0x3a8f51,_0x2afdbc){return new BPromise(function(_0x57e646,_0x1e06a7){return client[_0xdaeb('0x6')](_0x3a8f51,_0x2afdbc)[_0xdaeb('0x7')](function(_0x5e01f0){logger[_0xdaeb('0x8')](_0xdaeb('0x9'),_0xdaeb('0x2'),_0x3a8f51,_0x2afdbc,_0x5e01f0);if(_0x5e01f0[_0xdaeb('0xa')]){logger[_0xdaeb('0xa')](_0xdaeb('0x9'),_0xdaeb('0x2'),_0x3a8f51,_0x5e01f0['error'][_0xdaeb('0xb')],_0x2afdbc);return _0x1e06a7(_0x5e01f0[_0xdaeb('0xa')][_0xdaeb('0xb')]);}else{return _0x57e646(_0x5e01f0[_0xdaeb('0xc')]);}})['catch'](function(_0x122f3a){logger['error'](_0xdaeb('0x9'),_0xdaeb('0x2'),_0x3a8f51,_0x122f3a,_0x2afdbc);return _0x1e06a7(_0x122f3a);});});};module['exports']=client; \ No newline at end of file +var _0x3838=['../../config/logger','routing','client','http','Request','then','debug','error','rpc','message','result','catch','jayson/promise'];(function(_0x1c0fa2,_0x3f144d){var _0x1c1ba9=function(_0x4e39e2){while(--_0x4e39e2){_0x1c0fa2['push'](_0x1c0fa2['shift']());}};_0x1c1ba9(++_0x3f144d);}(_0x3838,0xf6));var _0x8383=function(_0x387e88,_0x172f5e){_0x387e88=_0x387e88-0x0;var _0x114462=_0x3838[_0x387e88];return _0x114462;};'use strict';var jayson=require(_0x8383('0x0'));var BPromise=require('bluebird');var logger=require(_0x8383('0x1'))(_0x8383('0x2'));var client=jayson[_0x8383('0x3')][_0x8383('0x4')]({'port':0x2329});client[_0x8383('0x5')]=function(_0xeeca45,_0x4010f0){return new BPromise(function(_0xc38937,_0x53a8f4){return client['request'](_0xeeca45,_0x4010f0)[_0x8383('0x6')](function(_0x245fe3){logger[_0x8383('0x7')]('rpc',_0x8383('0x2'),_0xeeca45,_0x4010f0,_0x245fe3);if(_0x245fe3[_0x8383('0x8')]){logger[_0x8383('0x8')](_0x8383('0x9'),_0x8383('0x2'),_0xeeca45,_0x245fe3['error'][_0x8383('0xa')],_0x4010f0);return _0x53a8f4(_0x245fe3[_0x8383('0x8')][_0x8383('0xa')]);}else{return _0xc38937(_0x245fe3[_0x8383('0xb')]);}})[_0x8383('0xc')](function(_0x149615){logger['error'](_0x8383('0x9'),_0x8383('0x2'),_0xeeca45,_0x149615,_0x4010f0);return _0x53a8f4(_0x149615);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 6e9bbf9..e7dd6d1 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 _0x6b21=['./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue'];(function(_0x1e4dba,_0x15b030){var _0x144cc1=function(_0x1a75c5){while(--_0x1a75c5){_0x1e4dba['push'](_0x1e4dba['shift']());}};_0x144cc1(++_0x15b030);}(_0x6b21,0x86));var _0x16b2=function(_0xf27c7c,_0x5e60cf){_0xf27c7c=_0xf27c7c-0x0;var _0x1a2c9a=_0x6b21[_0xf27c7c];return _0x1a2c9a;};'use strict';var BPromise=require(_0x16b2('0x0'));var server=require(_0x16b2('0x1'));var Realtime=require(_0x16b2('0x2'));var user=require(_0x16b2('0x3'));var interval=require(_0x16b2('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x16b2('0x5'));var smsQueue=require(_0x16b2('0x6'));var mailQueue=require(_0x16b2('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x16b2('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x16b2('0x9')]()['then'](user[_0x16b2('0xa')]())[_0x16b2('0xb')](realtime[_0x16b2('0xc')]())['then'](interval[_0x16b2('0xd')]())['then'](realtime[_0x16b2('0xe')]())[_0x16b2('0xb')](openchannelQueue['getOpenchannelQueues']())[_0x16b2('0xb')](realtime[_0x16b2('0xf')]())[_0x16b2('0xb')](chatQueue[_0x16b2('0x10')]())[_0x16b2('0xb')](realtime[_0x16b2('0x11')]())[_0x16b2('0xb')](smsQueue[_0x16b2('0x12')]())[_0x16b2('0xb')](realtime[_0x16b2('0x13')]())[_0x16b2('0xb')](mailQueue[_0x16b2('0x14')]())[_0x16b2('0xb')](realtime[_0x16b2('0x15')]())[_0x16b2('0xb')](faxQueue[_0x16b2('0x16')]())[_0x16b2('0xb')](realtime[_0x16b2('0x17')]())[_0x16b2('0xb')](whatsappQueue[_0x16b2('0x18')]())[_0x16b2('0xb')](realtime[_0x16b2('0x19')]())[_0x16b2('0xb')](function(){return realtime;});}function main(){return server[_0x16b2('0x1a')](realtime)[_0x16b2('0xb')](function(_0x42edad){return initRealtime();})[_0x16b2('0xb')](function(_0x2ddeae){return setInterval(initRealtime,0x1388);})[_0x16b2('0x1b')](function(_0x23478b){console['log'](_0x23478b);});}main(); \ No newline at end of file +var _0x399d=['catch','log','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen'];(function(_0x4fefbe,_0x28eae8){var _0x30611b=function(_0x3e4386){while(--_0x3e4386){_0x4fefbe['push'](_0x4fefbe['shift']());}};_0x30611b(++_0x28eae8);}(_0x399d,0xb1));var _0xd399=function(_0x4de845,_0x12b321){_0x4de845=_0x4de845-0x0;var _0x433aea=_0x399d[_0x4de845];return _0x433aea;};'use strict';var BPromise=require('bluebird');var server=require(_0xd399('0x0'));var Realtime=require(_0xd399('0x1'));var user=require(_0xd399('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xd399('0x3'));var smsQueue=require(_0xd399('0x4'));var mailQueue=require(_0xd399('0x5'));var faxQueue=require(_0xd399('0x6'));var whatsappQueue=require(_0xd399('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd399('0x8')]()[_0xd399('0x9')](user[_0xd399('0xa')]())[_0xd399('0x9')](realtime[_0xd399('0xb')]())['then'](interval[_0xd399('0xc')]())[_0xd399('0x9')](realtime[_0xd399('0xd')]())[_0xd399('0x9')](openchannelQueue['getOpenchannelQueues']())[_0xd399('0x9')](realtime['initOpenchannelQueues']())[_0xd399('0x9')](chatQueue[_0xd399('0xe')]())[_0xd399('0x9')](realtime['initChatQueues']())[_0xd399('0x9')](smsQueue[_0xd399('0xf')]())[_0xd399('0x9')](realtime[_0xd399('0x10')]())['then'](mailQueue[_0xd399('0x11')]())[_0xd399('0x9')](realtime[_0xd399('0x12')]())['then'](faxQueue['getFaxQueues']())[_0xd399('0x9')](realtime[_0xd399('0x13')]())['then'](whatsappQueue[_0xd399('0x14')]())[_0xd399('0x9')](realtime[_0xd399('0x15')]())[_0xd399('0x9')](function(){return realtime;});}function main(){return server[_0xd399('0x16')](realtime)[_0xd399('0x9')](function(_0x339c24){return initRealtime();})['then'](function(_0x373309){return setInterval(initRealtime,0x1388);})[_0xd399('0x17')](function(_0x2a93bd){console[_0xd399('0x18')](_0x2a93bd);});}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 660a75b..6798371 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 _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x37c566,_0x432e1b){var _0x43bed5=function(_0x54ae08){while(--_0x54ae08){_0x37c566['push'](_0x37c566['shift']());}};_0x43bed5(++_0x432e1b);}(_0x2ef3,0xba));var _0x32ef=function(_0x11086e,_0x36795e){_0x11086e=_0x11086e-0x0;var _0x377cc8=_0x2ef3[_0x11086e];return _0x377cc8;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0xc0b102,_0x37d03f){var _0x20d953=function(_0x1995ba){while(--_0x1995ba){_0xc0b102['push'](_0xc0b102['shift']());}};_0x20d953(++_0x37d03f);}(_0xe14b,0x93));var _0xbe14=function(_0x55b8a7,_0x56fa6c){_0x55b8a7=_0x55b8a7-0x0;var _0x13abd8=_0xe14b[_0x55b8a7];return _0x13abd8;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index ceec989..2b77d94 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 _0x691f=['error','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','then'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x691f,0x1d4));var _0xf691=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x691f[_0x4cfc1d];return _0x1c01a0;};'use strict';var BPromise=require(_0xf691('0x0'));var jayson=require(_0xf691('0x1'));var client=jayson[_0xf691('0x2')]['http']({'port':0x232b});function request(_0x234314,_0x26eb6b){return new BPromise(function(_0x2d84b2,_0x59a3fa){return client['request'](_0x234314,_0x26eb6b)[_0xf691('0x3')](function(_0x5d5b3d){if(_0x5d5b3d[_0xf691('0x4')]){return _0x59a3fa(_0x5d5b3d[_0xf691('0x4')]['message']);}else{return _0x2d84b2(_0x5d5b3d['result']);}})[_0xf691('0x5')](function(_0x30e5bf){return _0x59a3fa(_0x30e5bf);});});}exports[_0xf691('0x6')]=function(_0x285992,_0xba0fcb){return request(_0xf691('0x7'),{'account':_0x285992,'message':_0xba0fcb});}; \ No newline at end of file +var _0x90fe=['request','error','message','result','sendMailMessage','http'];(function(_0x4f5a95,_0x23c870){var _0xdb3484=function(_0x4e6963){while(--_0x4e6963){_0x4f5a95['push'](_0x4f5a95['shift']());}};_0xdb3484(++_0x23c870);}(_0x90fe,0x89));var _0xe90f=function(_0x481ddf,_0x1be6f9){_0x481ddf=_0x481ddf-0x0;var _0x161be4=_0x90fe[_0x481ddf];return _0x161be4;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0xe90f('0x0')]({'port':0x232b});function request(_0x5a536,_0x580d63){return new BPromise(function(_0x5b08bc,_0x3057c8){return client[_0xe90f('0x1')](_0x5a536,_0x580d63)['then'](function(_0x154348){if(_0x154348[_0xe90f('0x2')]){return _0x3057c8(_0x154348[_0xe90f('0x2')][_0xe90f('0x3')]);}else{return _0x5b08bc(_0x154348[_0xe90f('0x4')]);}})['catch'](function(_0x411d8b){return _0x3057c8(_0x411d8b);});});}exports[_0xe90f('0x5')]=function(_0x4d46b1,_0xd090b4){return request('SendMail',{'account':_0x4d46b1,'message':_0xd090b4});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2c40a3d..4627f27 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 _0x0176=['unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','faxStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','stringify','user:save','exports','lodash','md5','../../../config/environment','defaults','redis','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus'];(function(_0x29d882,_0x4f3dc4){var _0x2b3ba8=function(_0x471bd0){while(--_0x471bd0){_0x29d882['push'](_0x29d882['shift']());}};_0x2b3ba8(++_0x4f3dc4);}(_0x0176,0x14f));var _0x6017=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0176[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6017('0x0'));var moment=require('moment');var md5=require(_0x6017('0x1'));var Redis=require('ioredis');var config=require(_0x6017('0x2'));config['redis']=_[_0x6017('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6017('0x4')]));function Agent(_0x1695e0){this['id']=_0x1695e0['id']||0x0;this[_0x6017('0x5')]=_0x1695e0[_0x6017('0x5')]||'';this['online']=_0x1695e0[_0x6017('0x6')]||!![];this[_0x6017('0x7')]=_0x1695e0['voicePause']||![];this['chatPause']=_0x1695e0['chatPause']||![];this[_0x6017('0x8')]=_0x1695e0[_0x6017('0x8')]||![];this[_0x6017('0x9')]=_0x1695e0[_0x6017('0x9')]||![];this[_0x6017('0xa')]=_0x1695e0['smsPause']||![];this['openchannelPause']=_0x1695e0[_0x6017('0xb')]||![];this[_0x6017('0xc')]=_0x6017('0xd');this[_0x6017('0xe')]=0x0;this[_0x6017('0xf')]=_0x1695e0['chatCapacity']||0x0;this[_0x6017('0x10')]=0x0;this[_0x6017('0x11')]=_0x6017('0xd');this[_0x6017('0x12')]=0x0;this[_0x6017('0x13')]=_0x1695e0['mailCapacity']||0x0;this[_0x6017('0x14')]=0x0;this['faxStatus']=_0x6017('0xd');this[_0x6017('0x15')]=0x0;this[_0x6017('0x16')]=_0x1695e0[_0x6017('0x16')]||0x0;this[_0x6017('0x17')]=0x0;this[_0x6017('0x18')]=_0x6017('0xd');this[_0x6017('0x19')]=0x0;this['smsCapacity']=_0x1695e0[_0x6017('0x1a')]||0x0;this[_0x6017('0x1b')]=0x0;this[_0x6017('0x1c')]='unknown';this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x1695e0['whatsappCapacity']||0x0;this[_0x6017('0x1d')]=0x0;this['openchannelStatus']=_0x6017('0xd');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x1695e0[_0x6017('0x1e')]||0x0;this[_0x6017('0x1f')]=0x0;this[_0x6017('0x20')]=![];this[_0x6017('0x21')]=undefined;this[_0x6017('0x1')]='';this[_0x6017('0x22')]();}Agent[_0x6017('0x23')][_0x6017('0x24')]=function(_0x2eb181){if(this[_0x2eb181+_0x6017('0x25')]>0x0){if(this[_0x2eb181+_0x6017('0x26')]>0x0&&this[_0x2eb181+'CurrentCapacity']>=this[_0x2eb181+_0x6017('0x26')]){return _0x6017('0x27');}else{return'working';}}else{return'idle';}};Agent[_0x6017('0x23')][_0x6017('0x22')]=function(){var _0x259701=['mail',_0x6017('0x28'),_0x6017('0x29'),_0x6017('0x2a'),_0x6017('0x2b'),_0x6017('0x2c')];for(var _0x28a467=0x0;_0x28a467<_0x259701[_0x6017('0x2d')];_0x28a467+=0x1){var _0x39a651=this[_0x6017('0x24')](_0x259701[_0x28a467]);if(this[_0x259701[_0x28a467]+_0x6017('0x2e')]!==_0x39a651){this[_0x259701[_0x28a467]+_0x6017('0x2f')]=_[_0x6017('0x30')](moment()[_0x6017('0x31')]('x'));}this[_0x259701[_0x28a467]+_0x6017('0x2e')]=_0x39a651;}var _0x3b9332={'id':this['id'],'name':this['name'],'online':this[_0x6017('0x6')],'voicePause':this[_0x6017('0x7')],'chatPause':this[_0x6017('0x32')],'mailPause':this[_0x6017('0x8')],'smsPause':this[_0x6017('0xa')],'faxPause':this['faxPause'],'openchannelPause':this[_0x6017('0xb')],'chatStatus':this[_0x6017('0xc')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x6017('0x10')],'mailStatus':this[_0x6017('0x11')],'mailStatusTime':this[_0x6017('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x6017('0x14')],'faxStatus':this[_0x6017('0x33')],'faxStatusTime':this[_0x6017('0x15')],'faxCapacity':this[_0x6017('0x16')],'faxCurrentCapacity':this[_0x6017('0x17')],'smsStatus':this[_0x6017('0x18')],'smsStatusTime':this[_0x6017('0x19')],'smsCapacity':this[_0x6017('0x1a')],'smsCurrentCapacity':this[_0x6017('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x6017('0x34')],'whatsappCapacity':this[_0x6017('0x35')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x6017('0x36')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x6017('0x1e')],'openchannelCurrentCapacity':this[_0x6017('0x1f')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x2fa4d7=md5(JSON[_0x6017('0x37')](_0x3b9332));if(this[_0x6017('0x1')]!==_0x2fa4d7){this[_0x6017('0x1')]=_0x2fa4d7;io['emit'](_0x6017('0x38'),_0x3b9332);}};module[_0x6017('0x39')]=Agent; \ No newline at end of file +var _0x80e4=['whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','whatsapp','Status','toNumber','mailStatus','smsStatus','whatsappStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity'];(function(_0x5528ce,_0x2a8c7b){var _0x30846b=function(_0x436f07){while(--_0x436f07){_0x5528ce['push'](_0x5528ce['shift']());}};_0x30846b(++_0x2a8c7b);}(_0x80e4,0x103));var _0x480e=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x80e4[_0xa3c06b];return _0x33aa1d;};'use strict';var _=require(_0x480e('0x0'));var moment=require(_0x480e('0x1'));var md5=require(_0x480e('0x2'));var Redis=require('ioredis');var config=require(_0x480e('0x3'));config[_0x480e('0x4')]=_[_0x480e('0x5')](config[_0x480e('0x4')],{'host':_0x480e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x480e('0x4')]));function Agent(_0x621c93){this['id']=_0x621c93['id']||0x0;this[_0x480e('0x7')]=_0x621c93[_0x480e('0x7')]||'';this[_0x480e('0x8')]=_0x621c93[_0x480e('0x8')]||!![];this[_0x480e('0x9')]=_0x621c93[_0x480e('0x9')]||![];this[_0x480e('0xa')]=_0x621c93[_0x480e('0xa')]||![];this[_0x480e('0xb')]=_0x621c93[_0x480e('0xb')]||![];this['faxPause']=_0x621c93[_0x480e('0xc')]||![];this[_0x480e('0xd')]=_0x621c93[_0x480e('0xd')]||![];this[_0x480e('0xe')]=_0x621c93[_0x480e('0xe')]||![];this[_0x480e('0xf')]='unknown';this[_0x480e('0x10')]=0x0;this[_0x480e('0x11')]=_0x621c93[_0x480e('0x11')]||0x0;this[_0x480e('0x12')]=0x0;this['mailStatus']=_0x480e('0x13');this[_0x480e('0x14')]=0x0;this[_0x480e('0x15')]=_0x621c93[_0x480e('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x480e('0x16')]='unknown';this[_0x480e('0x17')]=0x0;this[_0x480e('0x18')]=_0x621c93[_0x480e('0x18')]||0x0;this[_0x480e('0x19')]=0x0;this['smsStatus']=_0x480e('0x13');this[_0x480e('0x1a')]=0x0;this[_0x480e('0x1b')]=_0x621c93[_0x480e('0x1b')]||0x0;this[_0x480e('0x1c')]=0x0;this[_0x480e('0x1d')]=_0x480e('0x13');this['whatsappStatusTime']=0x0;this[_0x480e('0x1e')]=_0x621c93['whatsappCapacity']||0x0;this[_0x480e('0x1f')]=0x0;this[_0x480e('0x20')]=_0x480e('0x13');this[_0x480e('0x21')]=0x0;this[_0x480e('0x22')]=_0x621c93[_0x480e('0x22')]||0x0;this[_0x480e('0x23')]=0x0;this[_0x480e('0x24')]=![];this[_0x480e('0x25')]=undefined;this[_0x480e('0x2')]='';this['updateRealtime']();}Agent[_0x480e('0x26')][_0x480e('0x27')]=function(_0x3534f9){if(this[_0x3534f9+_0x480e('0x28')]>0x0){if(this[_0x3534f9+'Capacity']>0x0&&this[_0x3534f9+_0x480e('0x28')]>=this[_0x3534f9+_0x480e('0x29')]){return _0x480e('0x2a');}else{return _0x480e('0x2b');}}else{return _0x480e('0x2c');}};Agent[_0x480e('0x26')][_0x480e('0x2d')]=function(){var _0x53fb1b=['mail',_0x480e('0x2e'),_0x480e('0x2f'),'fax','sms',_0x480e('0x30')];for(var _0x1f095d=0x0;_0x1f095d<_0x53fb1b['length'];_0x1f095d+=0x1){var _0x712e65=this['getChannelStatus'](_0x53fb1b[_0x1f095d]);if(this[_0x53fb1b[_0x1f095d]+_0x480e('0x31')]!==_0x712e65){this[_0x53fb1b[_0x1f095d]+'StatusTime']=_[_0x480e('0x32')](moment()['format']('x'));}this[_0x53fb1b[_0x1f095d]+_0x480e('0x31')]=_0x712e65;}var _0x3bc0b0={'id':this['id'],'name':this['name'],'online':this[_0x480e('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x480e('0xa')],'mailPause':this[_0x480e('0xb')],'smsPause':this[_0x480e('0xd')],'faxPause':this[_0x480e('0xc')],'openchannelPause':this[_0x480e('0xe')],'chatStatus':this[_0x480e('0xf')],'chatStatusTime':this[_0x480e('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x480e('0x33')],'mailStatusTime':this[_0x480e('0x14')],'mailCapacity':this[_0x480e('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x480e('0x16')],'faxStatusTime':this[_0x480e('0x17')],'faxCapacity':this[_0x480e('0x18')],'faxCurrentCapacity':this[_0x480e('0x19')],'smsStatus':this[_0x480e('0x34')],'smsStatusTime':this[_0x480e('0x1a')],'smsCapacity':this[_0x480e('0x1b')],'smsCurrentCapacity':this[_0x480e('0x1c')],'whatsappStatus':this[_0x480e('0x1d')],'whatsappStatusTime':this[_0x480e('0x35')],'whatsappCapacity':this[_0x480e('0x1e')],'whatsappCurrentCapacity':this[_0x480e('0x1f')],'openchannelStatus':this[_0x480e('0x20')],'openchannelStatusTime':this[_0x480e('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x480e('0x23')],'busy':this[_0x480e('0x24')],'busyQueue':this['busyQueue']};var _0x8152bc=md5(JSON[_0x480e('0x36')](_0x3bc0b0));if(this[_0x480e('0x2')]!==_0x8152bc){this['md5']=_0x8152bc;io[_0x480e('0x37')](_0x480e('0x38'),_0x3bc0b0);}};module[_0x480e('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index de70858..5cdd527 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 _0x25de=['updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','chat:queue:%s','emit','chat_queue:save','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x57cc32,_0xf29926){var _0x27d3ad=function(_0x1c1869){while(--_0x1c1869){_0x57cc32['push'](_0x57cc32['shift']());}};_0x27d3ad(++_0xf29926);}(_0x25de,0xdb));var _0xe25d=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x25de[_0x5fa520];return _0x1bf6c4;};'use strict';var _=require('lodash');var md5=require(_0xe25d('0x0'));var util=require(_0xe25d('0x1'));var Redis=require(_0xe25d('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xe25d('0x3')](config[_0xe25d('0x4')],{'host':_0xe25d('0x5'),'port':0x18eb});var io=require(_0xe25d('0x6'))(new Redis(config[_0xe25d('0x4')]));function ChatQueue(_0x56fb93){this['id']=_0x56fb93['id']||0x0;this['name']=_0x56fb93[_0xe25d('0x7')]||'';this['timeout']=_0x56fb93[_0xe25d('0x8')]||0xa;this[_0xe25d('0x9')]=_0x56fb93[_0xe25d('0x9')]||_0xe25d('0xa');this[_0xe25d('0xb')]=_0x56fb93[_0xe25d('0xb')];this[_0xe25d('0xc')]={};this[_0xe25d('0xd')]=0x0;this[_0xe25d('0x0')]='';this[_0xe25d('0xe')]();this[_0xe25d('0xf')]();}ChatQueue[_0xe25d('0x10')][_0xe25d('0xe')]=function(){var _0x4c63af=this['mapAgentsId'][_0xe25d('0x11')];this[_0xe25d('0xc')]=_['map'](this['Agents'],'id');this[_0xe25d('0xc')][_0xe25d('0x11')]=_0x4c63af;};ChatQueue['prototype'][_0xe25d('0xf')]=function(){this[_0xe25d('0x12')]=0x0;this[_0xe25d('0x13')]=0x0;for(var _0x10896d=0x0;_0x10896d=0x0?this[_0xe25d('0x16')]:0x0;var _0x518e95={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe25d('0x12')],'name':this[_0xe25d('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x1768f3=md5(JSON['stringify'](_0x518e95));if(this[_0xe25d('0x0')]!==_0x1768f3){this['md5']=_0x1768f3;io['to'](util['format'](_0xe25d('0x17'),_0x518e95[_0xe25d('0x7')]))[_0xe25d('0x18')](_0xe25d('0x19'),_0x518e95);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xba04=['stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','online','chatPause','paused','loggedIn','available'];(function(_0x35ad2b,_0x40800c){var _0x18569c=function(_0x347148){while(--_0x347148){_0x35ad2b['push'](_0x35ad2b['shift']());}};_0x18569c(++_0x40800c);}(_0xba04,0x128));var _0x4ba0=function(_0xe1150a,_0x199580){_0xe1150a=_0xe1150a-0x0;var _0xf98e7c=_0xba04[_0xe1150a];return _0xf98e7c;};'use strict';var _=require(_0x4ba0('0x0'));var md5=require(_0x4ba0('0x1'));var util=require(_0x4ba0('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4ba0('0x3')]=_[_0x4ba0('0x4')](config[_0x4ba0('0x3')],{'host':_0x4ba0('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ba0('0x3')]));function ChatQueue(_0x49e3a5){this['id']=_0x49e3a5['id']||0x0;this[_0x4ba0('0x6')]=_0x49e3a5[_0x4ba0('0x6')]||'';this[_0x4ba0('0x7')]=_0x49e3a5['timeout']||0xa;this[_0x4ba0('0x8')]=_0x49e3a5['strategy']||_0x4ba0('0x9');this['Agents']=_0x49e3a5[_0x4ba0('0xa')];this['mapAgentsId']={};this[_0x4ba0('0xb')]=0x0;this[_0x4ba0('0x1')]='';this[_0x4ba0('0xc')]();this['updateRealtime']();}ChatQueue[_0x4ba0('0xd')][_0x4ba0('0xc')]=function(){var _0x2727e8=this[_0x4ba0('0xe')][_0x4ba0('0xf')];this['mapAgentsId']=_[_0x4ba0('0x10')](this[_0x4ba0('0xa')],'id');this[_0x4ba0('0xe')][_0x4ba0('0xf')]=_0x2727e8;};ChatQueue[_0x4ba0('0xd')][_0x4ba0('0x11')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x22b5a1=0x0;_0x22b5a1=0x0?this[_0x4ba0('0x16')]:0x0;var _0x4a1a7e={'id':this['id'],'available':this[_0x4ba0('0x16')],'loggedIn':this[_0x4ba0('0x15')],'name':this['name'],'paused':this[_0x4ba0('0x14')],'waiting':this[_0x4ba0('0xb')]};var _0x19ceb3=md5(JSON[_0x4ba0('0x17')](_0x4a1a7e));if(this[_0x4ba0('0x1')]!==_0x19ceb3){this[_0x4ba0('0x1')]=_0x19ceb3;io['to'](util[_0x4ba0('0x18')](_0x4ba0('0x19'),_0x4a1a7e[_0x4ba0('0x6')]))[_0x4ba0('0x1a')](_0x4ba0('0x1b'),_0x4a1a7e);}};module[_0x4ba0('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 56eba73..55dd5f5 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 _0x8b3a=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','available','stringify','format','fax:queue:%s','emit'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8b3a,0x106));var _0xa8b3=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x8b3a[_0x14d250];return _0xb991d8;};'use strict';var _=require(_0xa8b3('0x0'));var md5=require(_0xa8b3('0x1'));var util=require(_0xa8b3('0x2'));var Redis=require(_0xa8b3('0x3'));var config=require(_0xa8b3('0x4'));config[_0xa8b3('0x5')]=_[_0xa8b3('0x6')](config['redis'],{'host':_0xa8b3('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x514e10){this['id']=_0x514e10['id']||0x0;this[_0xa8b3('0x8')]=_0x514e10[_0xa8b3('0x8')]||'';this[_0xa8b3('0x9')]=_0x514e10['timeout']||0xa;this[_0xa8b3('0xa')]=_0x514e10[_0xa8b3('0xa')]||_0xa8b3('0xb');this[_0xa8b3('0xc')]=_0x514e10[_0xa8b3('0xc')];this['mapAgentsId']={};this[_0xa8b3('0xd')]=0x0;this['md5']='';this[_0xa8b3('0xe')]();this[_0xa8b3('0xf')]();}FaxQueue[_0xa8b3('0x10')][_0xa8b3('0xe')]=function(){var _0x28de98=this[_0xa8b3('0x11')][_0xa8b3('0x12')];this[_0xa8b3('0x11')]=_[_0xa8b3('0x13')](this['Agents'],'id');this[_0xa8b3('0x11')][_0xa8b3('0x12')]=_0x28de98;};FaxQueue[_0xa8b3('0x10')][_0xa8b3('0xf')]=function(){this[_0xa8b3('0x14')]=0x0;this[_0xa8b3('0x15')]=0x0;for(var _0x5874dd=0x0;_0x5874dd=0x0?this[_0xa8b3('0x17')]:0x0;var _0x5a2ad5={'id':this['id'],'available':this[_0xa8b3('0x17')],'loggedIn':this[_0xa8b3('0x14')],'name':this['name'],'paused':this[_0xa8b3('0x15')],'waiting':this[_0xa8b3('0xd')]};var _0x2d5de7=md5(JSON[_0xa8b3('0x18')](_0x5a2ad5));if(this[_0xa8b3('0x1')]!==_0x2d5de7){this[_0xa8b3('0x1')]=_0x2d5de7;io['to'](util[_0xa8b3('0x19')](_0xa8b3('0x1a'),_0x5a2ad5[_0xa8b3('0x8')]))[_0xa8b3('0x1b')]('fax_queue:save',_0x5a2ad5);}};module[_0xa8b3('0x1c')]=FaxQueue; \ No newline at end of file +var _0x23f8=['md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','emit','fax_queue:save','lodash'];(function(_0x102e57,_0x397c85){var _0x37c564=function(_0x3c7f3a){while(--_0x3c7f3a){_0x102e57['push'](_0x102e57['shift']());}};_0x37c564(++_0x397c85);}(_0x23f8,0x95));var _0x823f=function(_0x1d5efd,_0x375b46){_0x1d5efd=_0x1d5efd-0x0;var _0x42e446=_0x23f8[_0x1d5efd];return _0x42e446;};'use strict';var _=require(_0x823f('0x0'));var md5=require(_0x823f('0x1'));var util=require(_0x823f('0x2'));var Redis=require(_0x823f('0x3'));var config=require(_0x823f('0x4'));config[_0x823f('0x5')]=_[_0x823f('0x6')](config[_0x823f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x823f('0x7'))(new Redis(config[_0x823f('0x5')]));function FaxQueue(_0x32295e){this['id']=_0x32295e['id']||0x0;this[_0x823f('0x8')]=_0x32295e[_0x823f('0x8')]||'';this['timeout']=_0x32295e[_0x823f('0x9')]||0xa;this[_0x823f('0xa')]=_0x32295e['strategy']||_0x823f('0xb');this['Agents']=_0x32295e[_0x823f('0xc')];this[_0x823f('0xd')]={};this[_0x823f('0xe')]=0x0;this[_0x823f('0x1')]='';this[_0x823f('0xf')]();this[_0x823f('0x10')]();}FaxQueue[_0x823f('0x11')][_0x823f('0xf')]=function(){var _0x1ebfaf=this[_0x823f('0xd')][_0x823f('0x12')];this[_0x823f('0xd')]=_[_0x823f('0x13')](this[_0x823f('0xc')],'id');this[_0x823f('0xd')][_0x823f('0x12')]=_0x1ebfaf;};FaxQueue[_0x823f('0x11')][_0x823f('0x10')]=function(){this[_0x823f('0x14')]=0x0;this[_0x823f('0x15')]=0x0;for(var _0x3b2881=0x0;_0x3b2881=0x0?this[_0x823f('0x19')]:0x0;var _0xc19e33={'id':this['id'],'available':this[_0x823f('0x19')],'loggedIn':this[_0x823f('0x14')],'name':this[_0x823f('0x8')],'paused':this[_0x823f('0x15')],'waiting':this['waiting']};var _0x1a5976=md5(JSON[_0x823f('0x1a')](_0xc19e33));if(this[_0x823f('0x1')]!==_0x1a5976){this['md5']=_0x1a5976;io['to'](util[_0x823f('0x1b')]('fax:queue:%s',_0xc19e33[_0x823f('0x8')]))[_0x823f('0x1c')](_0x823f('0x1d'),_0xc19e33);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a137ca2..976dd76 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 _0x660a=['name','Intervals'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x660a,0x88));var _0xa660=function(_0x2bb2ad,_0x1b5f00){_0x2bb2ad=_0x2bb2ad-0x0;var _0x131cc3=_0x660a[_0x2bb2ad];return _0x131cc3;};'use strict';function Interval(_0x4933f5){this['id']=_0x4933f5['id']||0x0;this[_0xa660('0x0')]=_0x4933f5['name']||'';this[_0xa660('0x1')]=_0x4933f5['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xfe39=['Intervals','exports','name'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xfe39,0x182));var _0x9fe3=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xfe39[_0x35885a];return _0xe86249;};'use strict';function Interval(_0x4eb8d1){this['id']=_0x4eb8d1['id']||0x0;this[_0x9fe3('0x0')]=_0x4eb8d1[_0x9fe3('0x0')]||'';this['Intervals']=_0x4eb8d1[_0x9fe3('0x1')]||{};}module[_0x9fe3('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 7c37501..98bcbfa 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 _0xe36f=['updateRealtime','prototype','mapAgentsId','map','Agents','_rr','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting'];(function(_0x26e27a,_0x2aa519){var _0x19b616=function(_0x106949){while(--_0x106949){_0x26e27a['push'](_0x26e27a['shift']());}};_0x19b616(++_0x2aa519);}(_0xe36f,0xff));var _0xfe36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe36f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfe36('0x0'));var md5=require(_0xfe36('0x1'));var util=require(_0xfe36('0x2'));var Redis=require(_0xfe36('0x3'));var config=require(_0xfe36('0x4'));config[_0xfe36('0x5')]=_[_0xfe36('0x6')](config[_0xfe36('0x5')],{'host':_0xfe36('0x7'),'port':0x18eb});var io=require(_0xfe36('0x8'))(new Redis(config[_0xfe36('0x5')]));function MailQueue(_0x47dd35){this['id']=_0x47dd35['id']||0x0;this[_0xfe36('0x9')]=_0x47dd35[_0xfe36('0x9')]||'';this[_0xfe36('0xa')]=_0x47dd35[_0xfe36('0xa')]||0xa;this['strategy']=_0x47dd35[_0xfe36('0xb')]||_0xfe36('0xc');this['Agents']=_0x47dd35['Agents'];this['mapAgentsId']={};this[_0xfe36('0xd')]=0x0;this['md5']='';this[_0xfe36('0xe')]();this[_0xfe36('0xf')]();}MailQueue[_0xfe36('0x10')][_0xfe36('0xe')]=function(){var _0x188277=this[_0xfe36('0x11')]['_rr'];this[_0xfe36('0x11')]=_[_0xfe36('0x12')](this[_0xfe36('0x13')],'id');this[_0xfe36('0x11')][_0xfe36('0x14')]=_0x188277;};MailQueue[_0xfe36('0x10')][_0xfe36('0xf')]=function(){this[_0xfe36('0x15')]=0x0;this[_0xfe36('0x16')]=0x0;for(var _0x40580c=0x0;_0x40580c=0x0?this[_0xfe36('0x19')]:0x0;var _0x563811={'id':this['id'],'available':this[_0xfe36('0x19')],'loggedIn':this[_0xfe36('0x15')],'name':this[_0xfe36('0x9')],'paused':this[_0xfe36('0x16')],'waiting':this[_0xfe36('0xd')]};var _0x187d76=md5(JSON[_0xfe36('0x1a')](_0x563811));if(this[_0xfe36('0x1')]!==_0x187d76){this[_0xfe36('0x1')]=_0x187d76;io['to'](util[_0xfe36('0x1b')](_0xfe36('0x1c'),_0x563811[_0xfe36('0x9')]))['emit'](_0xfe36('0x1d'),_0x563811);}};module['exports']=MailQueue; \ No newline at end of file +var _0x8166=['mapAgentsId','map','Agents','_rr','loggedIn','paused','length','mailPause','available','waiting','stringify','format','emit','mail_queue:save','exports','lodash','redis','defaults','localhost','name','timeout','strategy','md5','updateRouting','updateRealtime','prototype'];(function(_0x2ca1ef,_0xc2bb6b){var _0x2eeb95=function(_0xaa790c){while(--_0xaa790c){_0x2ca1ef['push'](_0x2ca1ef['shift']());}};_0x2eeb95(++_0xc2bb6b);}(_0x8166,0x12d));var _0x6816=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8166[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x6816('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6816('0x1')]=_[_0x6816('0x2')](config[_0x6816('0x1')],{'host':_0x6816('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6816('0x1')]));function MailQueue(_0x7e796){this['id']=_0x7e796['id']||0x0;this[_0x6816('0x4')]=_0x7e796['name']||'';this['timeout']=_0x7e796[_0x6816('0x5')]||0xa;this[_0x6816('0x6')]=_0x7e796[_0x6816('0x6')]||'beepall';this['Agents']=_0x7e796['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x6816('0x7')]='';this[_0x6816('0x8')]();this[_0x6816('0x9')]();}MailQueue[_0x6816('0xa')][_0x6816('0x8')]=function(){var _0xfbede8=this[_0x6816('0xb')]['_rr'];this[_0x6816('0xb')]=_[_0x6816('0xc')](this[_0x6816('0xd')],'id');this[_0x6816('0xb')][_0x6816('0xe')]=_0xfbede8;};MailQueue[_0x6816('0xa')]['updateRealtime']=function(){this[_0x6816('0xf')]=0x0;this[_0x6816('0x10')]=0x0;for(var _0x2e203b=0x0;_0x2e203b=0x0?this[_0x6816('0x13')]:0x0;var _0x16a8fd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6816('0xf')],'name':this[_0x6816('0x4')],'paused':this[_0x6816('0x10')],'waiting':this[_0x6816('0x14')]};var _0x3ac7f9=md5(JSON[_0x6816('0x15')](_0x16a8fd));if(this[_0x6816('0x7')]!==_0x3ac7f9){this[_0x6816('0x7')]=_0x3ac7f9;io['to'](util[_0x6816('0x16')]('mail:queue:%s',_0x16a8fd['name']))[_0x6816('0x17')](_0x6816('0x18'),_0x16a8fd);}};module[_0x6816('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 eba087c..3c197a2 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=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(_0x3e8de2,_0x468431){var _0x56b736=function(_0x32da9b){while(--_0x32da9b){_0x3e8de2['push'](_0x3e8de2['shift']());}};_0x56b736(++_0x468431);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0x5fc3[_0x4d180c];return _0x49b57e;};'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 7797b7f..dd1a373 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 _0xdb76=['updateRouting','updateRealtime','map','_rr','prototype','paused','length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x2e8775,_0x310049){var _0x4cbf35=function(_0x103483){while(--_0x103483){_0x2e8775['push'](_0x2e8775['shift']());}};_0x4cbf35(++_0x310049);}(_0xdb76,0x1be));var _0x6db7=function(_0x307e10,_0x226085){_0x307e10=_0x307e10-0x0;var _0x18e964=_0xdb76[_0x307e10];return _0x18e964;};'use strict';var _=require(_0x6db7('0x0'));var md5=require(_0x6db7('0x1'));var util=require(_0x6db7('0x2'));var Redis=require(_0x6db7('0x3'));var config=require(_0x6db7('0x4'));config['redis']=_[_0x6db7('0x5')](config[_0x6db7('0x6')],{'host':_0x6db7('0x7'),'port':0x18eb});var io=require(_0x6db7('0x8'))(new Redis(config['redis']));function SmsQueue(_0x117f1c){this['id']=_0x117f1c['id']||0x0;this[_0x6db7('0x9')]=_0x117f1c[_0x6db7('0x9')]||'';this[_0x6db7('0xa')]=_0x117f1c[_0x6db7('0xa')]||0xa;this['strategy']=_0x117f1c[_0x6db7('0xb')]||_0x6db7('0xc');this['Agents']=_0x117f1c[_0x6db7('0xd')];this[_0x6db7('0xe')]={};this[_0x6db7('0xf')]=0x0;this[_0x6db7('0x1')]='';this[_0x6db7('0x10')]();this[_0x6db7('0x11')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x17277a=this[_0x6db7('0xe')]['_rr'];this[_0x6db7('0xe')]=_[_0x6db7('0x12')](this[_0x6db7('0xd')],'id');this[_0x6db7('0xe')][_0x6db7('0x13')]=_0x17277a;};SmsQueue[_0x6db7('0x14')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x6db7('0x15')]=0x0;for(var _0x348ccf=0x0;_0x348ccf=0x0?this[_0x6db7('0x1a')]:0x0;var _0x53ea04={'id':this['id'],'available':this[_0x6db7('0x1a')],'loggedIn':this[_0x6db7('0x18')],'name':this[_0x6db7('0x9')],'paused':this[_0x6db7('0x15')],'waiting':this[_0x6db7('0xf')]};var _0x3b0c56=md5(JSON[_0x6db7('0x1b')](_0x53ea04));if(this[_0x6db7('0x1')]!==_0x3b0c56){this['md5']=_0x3b0c56;io['to'](util[_0x6db7('0x1c')](_0x6db7('0x1d'),_0x53ea04[_0x6db7('0x9')]))[_0x6db7('0x1e')](_0x6db7('0x1f'),_0x53ea04);}};module[_0x6db7('0x20')]=SmsQueue; \ No newline at end of file +var _0xfa2f=['loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','_rr','map','prototype','length','online'];(function(_0x1c74c9,_0x4403d1){var _0x1f3664=function(_0x277e5b){while(--_0x277e5b){_0x1c74c9['push'](_0x1c74c9['shift']());}};_0x1f3664(++_0x4403d1);}(_0xfa2f,0xe8));var _0xffa2=function(_0x2e60cd,_0x8a0987){_0x2e60cd=_0x2e60cd-0x0;var _0x17f8dd=_0xfa2f[_0x2e60cd];return _0x17f8dd;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xffa2('0x0'));var Redis=require('ioredis');var config=require(_0xffa2('0x1'));config[_0xffa2('0x2')]=_[_0xffa2('0x3')](config['redis'],{'host':_0xffa2('0x4'),'port':0x18eb});var io=require(_0xffa2('0x5'))(new Redis(config[_0xffa2('0x2')]));function SmsQueue(_0x14787c){this['id']=_0x14787c['id']||0x0;this[_0xffa2('0x6')]=_0x14787c[_0xffa2('0x6')]||'';this[_0xffa2('0x7')]=_0x14787c['timeout']||0xa;this['strategy']=_0x14787c[_0xffa2('0x8')]||_0xffa2('0x9');this[_0xffa2('0xa')]=_0x14787c[_0xffa2('0xa')];this[_0xffa2('0xb')]={};this[_0xffa2('0xc')]=0x0;this[_0xffa2('0xd')]='';this['updateRouting']();this[_0xffa2('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x2eb5bb=this[_0xffa2('0xb')][_0xffa2('0xf')];this[_0xffa2('0xb')]=_[_0xffa2('0x10')](this['Agents'],'id');this[_0xffa2('0xb')][_0xffa2('0xf')]=_0x2eb5bb;};SmsQueue[_0xffa2('0x11')][_0xffa2('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32e54e=0x0;_0x32e54e=0x0?this[_0xffa2('0x17')]:0x0;var _0x2ae03f={'id':this['id'],'available':this[_0xffa2('0x17')],'loggedIn':this[_0xffa2('0x14')],'name':this[_0xffa2('0x6')],'paused':this[_0xffa2('0x16')],'waiting':this[_0xffa2('0xc')]};var _0xc10cfb=md5(JSON[_0xffa2('0x18')](_0x2ae03f));if(this[_0xffa2('0xd')]!==_0xc10cfb){this['md5']=_0xc10cfb;io['to'](util[_0xffa2('0x19')](_0xffa2('0x1a'),_0x2ae03f[_0xffa2('0x6')]))['emit'](_0xffa2('0x1b'),_0x2ae03f);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 282806f..0552855 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 _0x861e=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','updateRealtime','loggedIn','length','online','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x3a2d8d,_0x15f797){var _0x33f19f=function(_0x1e9ca0){while(--_0x1e9ca0){_0x3a2d8d['push'](_0x3a2d8d['shift']());}};_0x33f19f(++_0x15f797);}(_0x861e,0x19b));var _0xe861=function(_0x5a4dce,_0x58ee90){_0x5a4dce=_0x5a4dce-0x0;var _0x2d12b4=_0x861e[_0x5a4dce];return _0x2d12b4;};'use strict';var _=require(_0xe861('0x0'));var md5=require('md5');var util=require(_0xe861('0x1'));var Redis=require(_0xe861('0x2'));var config=require(_0xe861('0x3'));config[_0xe861('0x4')]=_[_0xe861('0x5')](config['redis'],{'host':_0xe861('0x6'),'port':0x18eb});var io=require(_0xe861('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x5d2fda){this['id']=_0x5d2fda['id']||0x0;this[_0xe861('0x8')]=_0x5d2fda[_0xe861('0x8')]||'';this[_0xe861('0x9')]=_0x5d2fda[_0xe861('0x9')]||0xa;this[_0xe861('0xa')]=_0x5d2fda[_0xe861('0xa')]||_0xe861('0xb');this[_0xe861('0xc')]=_0x5d2fda[_0xe861('0xc')];this[_0xe861('0xd')]={};this[_0xe861('0xe')]=0x0;this[_0xe861('0xf')]='';this[_0xe861('0x10')]();this['updateRealtime']();}WhatsappQueue[_0xe861('0x11')][_0xe861('0x10')]=function(){var _0x3825e5=this[_0xe861('0xd')]['_rr'];this['mapAgentsId']=_['map'](this[_0xe861('0xc')],'id');this[_0xe861('0xd')]['_rr']=_0x3825e5;};WhatsappQueue[_0xe861('0x11')][_0xe861('0x12')]=function(){this[_0xe861('0x13')]=0x0;this['paused']=0x0;for(var _0x2b9320=0x0;_0x2b9320=0x0?this['available']:0x0;var _0x37eee7={'id':this['id'],'available':this[_0xe861('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xe861('0x8')],'paused':this['paused'],'waiting':this[_0xe861('0xe')]};var _0x1358b5=md5(JSON[_0xe861('0x18')](_0x37eee7));if(this['md5']!==_0x1358b5){this['md5']=_0x1358b5;io['to'](util[_0xe861('0x19')](_0xe861('0x1a'),_0x37eee7['name']))[_0xe861('0x1b')](_0xe861('0x1c'),_0x37eee7);}};module[_0xe861('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x76a5=['lodash','md5','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x23f5b4,_0x482179){var _0x22c4df=function(_0x3999de){while(--_0x3999de){_0x23f5b4['push'](_0x23f5b4['shift']());}};_0x22c4df(++_0x482179);}(_0x76a5,0x118));var _0x576a=function(_0xb39e3b,_0x2be5df){_0xb39e3b=_0xb39e3b-0x0;var _0x40515c=_0x76a5[_0xb39e3b];return _0x40515c;};'use strict';var _=require(_0x576a('0x0'));var md5=require(_0x576a('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x576a('0x2'));config[_0x576a('0x3')]=_[_0x576a('0x4')](config['redis'],{'host':_0x576a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x576a('0x3')]));function WhatsappQueue(_0x544f5e){this['id']=_0x544f5e['id']||0x0;this[_0x576a('0x6')]=_0x544f5e[_0x576a('0x6')]||'';this[_0x576a('0x7')]=_0x544f5e['timeout']||0xa;this[_0x576a('0x8')]=_0x544f5e['strategy']||_0x576a('0x9');this[_0x576a('0xa')]=_0x544f5e[_0x576a('0xa')];this[_0x576a('0xb')]={};this[_0x576a('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x576a('0xd')]['updateRouting']=function(){var _0x7d5d47=this[_0x576a('0xb')][_0x576a('0xe')];this[_0x576a('0xb')]=_[_0x576a('0xf')](this['Agents'],'id');this[_0x576a('0xb')]['_rr']=_0x7d5d47;};WhatsappQueue[_0x576a('0xd')][_0x576a('0x10')]=function(){this[_0x576a('0x11')]=0x0;this[_0x576a('0x12')]=0x0;for(var _0xa6cb2e=0x0;_0xa6cb2e=0x0?this['available']:0x0;var _0x269a4f={'id':this['id'],'available':this[_0x576a('0x15')],'loggedIn':this[_0x576a('0x11')],'name':this[_0x576a('0x6')],'paused':this[_0x576a('0x12')],'waiting':this[_0x576a('0xc')]};var _0x182747=md5(JSON[_0x576a('0x16')](_0x269a4f));if(this[_0x576a('0x1')]!==_0x182747){this['md5']=_0x182747;io['to'](util[_0x576a('0x17')](_0x576a('0x18'),_0x269a4f['name']))[_0x576a('0x19')](_0x576a('0x1a'),_0x269a4f);}};module[_0x576a('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index ebf6919..1e7d49d 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 74089ea..0f8f08a 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 _0x0312=['AddTagsToChatInteraction','Request','addTags'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x0312,0x109));var _0x2031=function(_0x579b6c,_0x2a0544){_0x579b6c=_0x579b6c-0x0;var _0x2e2fc9=_0x0312[_0x579b6c];return _0x2e2fc9;};'use strict';var client=require('../client');exports['update']=function(_0x5d67df,_0x331496){return client[_0x2031('0x0')]('UpdateChatInteraction',{'body':_0x331496,'options':{'where':{'id':_0x5d67df}},'log':'updateChatInteraction'});};exports[_0x2031('0x1')]=function(_0x49d7d8,_0x4aea88){return client[_0x2031('0x0')](_0x2031('0x2'),{'body':_0x4aea88,'options':{'where':{'id':_0x49d7d8}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x8d91=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x8d91,0xa0));var _0x18d9=function(_0x4534ce,_0x3e6d97){_0x4534ce=_0x4534ce-0x0;var _0x43b0bb=_0x8d91[_0x4534ce];return _0x43b0bb;};'use strict';var client=require(_0x18d9('0x0'));exports['update']=function(_0x323b9d,_0x19b2ba){return client[_0x18d9('0x1')](_0x18d9('0x2'),{'body':_0x19b2ba,'options':{'where':{'id':_0x323b9d}},'log':_0x18d9('0x3')});};exports[_0x18d9('0x4')]=function(_0x2bdccd,_0x5529f7){return client['Request'](_0x18d9('0x5'),{'body':_0x5529f7,'options':{'where':{'id':_0x2bdccd}},'log':_0x18d9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 638f0a7..41eef30 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 _0xe67d=['CreateChatMessage','createChatMessage','create'];(function(_0x5416e4,_0x5409c0){var _0x22a8af=function(_0x43470f){while(--_0x43470f){_0x5416e4['push'](_0x5416e4['shift']());}};_0x22a8af(++_0x5409c0);}(_0xe67d,0x1d3));var _0xde67=function(_0x47d1ae,_0x41e056){_0x47d1ae=_0x47d1ae-0x0;var _0x47328a=_0xe67d[_0x47d1ae];return _0x47328a;};'use strict';var client=require('../client');exports[_0xde67('0x0')]=function(_0x16798a){return client['Request'](_0xde67('0x1'),{'body':_0x16798a,'log':_0xde67('0x2')});}; \ No newline at end of file +var _0x20fa=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x20fa,0x1bb));var _0xa20f=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x20fa[_0x374ccf];return _0x443cde;};'use strict';var client=require(_0xa20f('0x0'));exports[_0xa20f('0x1')]=function(_0x36e982){return client[_0xa20f('0x2')](_0xa20f('0x3'),{'body':_0x36e982,'log':_0xa20f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 514248f..11c04e2 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 _0xef8b=['online','chatPause','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x21d7ec,_0x4dccab){var _0x15973d=function(_0x192fb3){while(--_0x192fb3){_0x21d7ec['push'](_0x21d7ec['shift']());}};_0x15973d(++_0x4dccab);}(_0xef8b,0x192));var _0xbef8=function(_0x485865,_0x11d29a){_0x485865=_0x485865-0x0;var _0x11ef06=_0xef8b[_0x485865];return _0x11ef06;};'use strict';var client=require('../client');exports[_0xbef8('0x0')]=function(){return function(){return client[_0xbef8('0x1')](_0xbef8('0x2'),{'options':{'raw':![],'attributes':['id',_0xbef8('0x3'),_0xbef8('0x4'),_0xbef8('0x5')],'include':[{'model':_0xbef8('0x6'),'as':_0xbef8('0x7'),'attributes':['id',_0xbef8('0x3'),_0xbef8('0x8'),_0xbef8('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x0845=['online','chatPause','getChatQueues','../client','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x155033,_0x8484c2){var _0x1fa8b7=function(_0x2fa32a){while(--_0x2fa32a){_0x155033['push'](_0x155033['shift']());}};_0x1fa8b7(++_0x8484c2);}(_0x0845,0x125));var _0x5084=function(_0xeae396,_0x10f634){_0xeae396=_0xeae396-0x0;var _0x523898=_0x0845[_0xeae396];return _0x523898;};'use strict';var client=require(_0x5084('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x5084('0x1'),{'options':{'raw':![],'attributes':['id',_0x5084('0x2'),_0x5084('0x3'),_0x5084('0x4')],'include':[{'model':_0x5084('0x5'),'as':_0x5084('0x6'),'attributes':['id','name',_0x5084('0x7'),_0x5084('0x8')]}]},'log':_0x5084('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index b7193aa..b104333 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 _0xd5b6=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x571aa6,_0x19655a){var _0x54dd95=function(_0x3a96b6){while(--_0x3a96b6){_0x571aa6['push'](_0x571aa6['shift']());}};_0x54dd95(++_0x19655a);}(_0xd5b6,0x73));var _0x6d5b=function(_0x37a834,_0x323659){_0x37a834=_0x37a834-0x0;var _0x5c3d7a=_0xd5b6[_0x37a834];return _0x5c3d7a;};'use strict';var client=require(_0x6d5b('0x0'));exports[_0x6d5b('0x1')]=function(_0x22d01e){return client[_0x6d5b('0x2')](_0x6d5b('0x3'),{'body':_0x22d01e,'log':_0x6d5b('0x3')});};exports[_0x6d5b('0x4')]=function(_0x3fb583,_0x558202){return client[_0x6d5b('0x2')](_0x6d5b('0x5'),{'body':_0x558202,'options':{'where':{'uniqueid':_0x3fb583},'order':[['id',_0x6d5b('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x37f8=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3bf3f1,_0x5b8238){var _0x5a0c0c=function(_0x303fac){while(--_0x303fac){_0x3bf3f1['push'](_0x3bf3f1['shift']());}};_0x5a0c0c(++_0x5b8238);}(_0x37f8,0xd2));var _0x837f=function(_0x48beb6,_0x1725cc){_0x48beb6=_0x48beb6-0x0;var _0x40797d=_0x37f8[_0x48beb6];return _0x40797d;};'use strict';var client=require('../client');exports[_0x837f('0x0')]=function(_0x3755bc){return client[_0x837f('0x1')](_0x837f('0x2'),{'body':_0x3755bc,'log':'CreateChatQueueReport'});};exports[_0x837f('0x3')]=function(_0x5184ad,_0x5f2d01){return client['Request']('UpdateChatQueueReport',{'body':_0x5f2d01,'options':{'where':{'uniqueid':_0x5184ad},'order':[['id','DESC']],'limit':0x1},'log':_0x837f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index fc72089..48ef7df 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(_0x367e47,_0x3a82fd){var _0x587eb0=function(_0x274ae9){while(--_0x274ae9){_0x367e47['push'](_0x367e47['shift']());}};_0x587eb0(++_0x3a82fd);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x500944,_0xcb4f26){var _0x2ba81a=function(_0x517afb){while(--_0x517afb){_0x500944['push'](_0x500944['shift']());}};_0x2ba81a(++_0xcb4f26);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 8f09caa..989f761 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 _0x9ef7=['CreateFaxMessage','create','Request'];(function(_0x220ec1,_0xf90e44){var _0x59f7d8=function(_0x293b1e){while(--_0x293b1e){_0x220ec1['push'](_0x220ec1['shift']());}};_0x59f7d8(++_0xf90e44);}(_0x9ef7,0x115));var _0x79ef=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9ef7[_0x502c7d];return _0x30b7ed;};'use strict';var client=require('../client');exports[_0x79ef('0x0')]=function(_0x2967a0){return client[_0x79ef('0x1')](_0x79ef('0x2'),{'body':_0x2967a0,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xbeb9=['../client','Request','createFaxMessage'];(function(_0x237dfd,_0x138284){var _0x34eb74=function(_0x149e42){while(--_0x149e42){_0x237dfd['push'](_0x237dfd['shift']());}};_0x34eb74(++_0x138284);}(_0xbeb9,0xdb));var _0x9beb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbeb9[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x9beb('0x0'));exports['create']=function(_0x162bc4){return client[_0x9beb('0x1')]('CreateFaxMessage',{'body':_0x162bc4,'log':_0x9beb('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index bfc78a1..177373b 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 _0x4dae=['User','Agents','faxPause','getFaxQueues','Request','name','timeout','strategy'];(function(_0x5e48f8,_0x54ea70){var _0x15f1da=function(_0x2ae67f){while(--_0x2ae67f){_0x5e48f8['push'](_0x5e48f8['shift']());}};_0x15f1da(++_0x54ea70);}(_0x4dae,0x7b));var _0xe4da=function(_0x4cee5b,_0x477943){_0x4cee5b=_0x4cee5b-0x0;var _0x57e704=_0x4dae[_0x4cee5b];return _0x57e704;};'use strict';var client=require('../client');exports[_0xe4da('0x0')]=function(){return function(){return client[_0xe4da('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xe4da('0x2'),_0xe4da('0x3'),_0xe4da('0x4')],'include':[{'model':_0xe4da('0x5'),'as':_0xe4da('0x6'),'attributes':['id','name','online',_0xe4da('0x7')]}]},'log':_0xe4da('0x0')});};}; \ No newline at end of file +var _0xe677=['online','../client','getFaxQueues','GetFaxQueue','name','timeout','Agents'];(function(_0x4d1101,_0x415b12){var _0x4fe135=function(_0x2266c1){while(--_0x2266c1){_0x4d1101['push'](_0x4d1101['shift']());}};_0x4fe135(++_0x415b12);}(_0xe677,0x19e));var _0x7e67=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0xe677[_0x1b4002];return _0x1716f3;};'use strict';var client=require(_0x7e67('0x0'));exports[_0x7e67('0x1')]=function(){return function(){return client['Request'](_0x7e67('0x2'),{'options':{'raw':![],'attributes':['id',_0x7e67('0x3'),_0x7e67('0x4'),'strategy'],'include':[{'model':'User','as':_0x7e67('0x5'),'attributes':['id',_0x7e67('0x3'),_0x7e67('0x6'),'faxPause']}]},'log':_0x7e67('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2b35588..d7f4880 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 _0x2e11=['Request','DESC','../client','create','CreateFaxQueueReport','update'];(function(_0x42b8f5,_0x4b9730){var _0x31ca50=function(_0x2060a){while(--_0x2060a){_0x42b8f5['push'](_0x42b8f5['shift']());}};_0x31ca50(++_0x4b9730);}(_0x2e11,0x194));var _0x12e1=function(_0x56c394,_0x5e9757){_0x56c394=_0x56c394-0x0;var _0x1eeb36=_0x2e11[_0x56c394];return _0x1eeb36;};'use strict';var client=require(_0x12e1('0x0'));exports[_0x12e1('0x1')]=function(_0x282caf){return client['Request'](_0x12e1('0x2'),{'body':_0x282caf,'log':_0x12e1('0x2')});};exports[_0x12e1('0x3')]=function(_0x534b99,_0x5b449a){return client[_0x12e1('0x4')]('UpdateFaxQueueReport',{'body':_0x5b449a,'options':{'where':{'uniqueid':_0x534b99},'order':[['id',_0x12e1('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xb245=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x3efdf3,_0x6e053b){var _0x22fb3f=function(_0x3cc304){while(--_0x3cc304){_0x3efdf3['push'](_0x3efdf3['shift']());}};_0x22fb3f(++_0x6e053b);}(_0xb245,0x185));var _0x5b24=function(_0x4286b3,_0x273233){_0x4286b3=_0x4286b3-0x0;var _0x45289e=_0xb245[_0x4286b3];return _0x45289e;};'use strict';var client=require(_0x5b24('0x0'));exports[_0x5b24('0x1')]=function(_0x4fdc69){return client[_0x5b24('0x2')](_0x5b24('0x3'),{'body':_0x4fdc69,'log':'CreateFaxQueueReport'});};exports[_0x5b24('0x4')]=function(_0x1dd9fe,_0x18a07d){return client[_0x5b24('0x2')](_0x5b24('0x5'),{'body':_0x18a07d,'options':{'where':{'uniqueid':_0x1dd9fe},'order':[['id',_0x5b24('0x6')]],'limit':0x1},'log':_0x5b24('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 797f824..fc61116 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 _0x3aaf=['GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x486eff,_0x5cb3b0){var _0x95293b=function(_0x25b947){while(--_0x25b947){_0x486eff['push'](_0x486eff['shift']());}};_0x95293b(++_0x5cb3b0);}(_0x3aaf,0x1c2));var _0xf3aa=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x3aaf[_0x55e08b];return _0xd1a7ff;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client['Request'](_0xf3aa('0x0'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf3aa('0x1')],'include':[{'model':_0xf3aa('0x2'),'as':_0xf3aa('0x3'),'attributes':['id','name',_0xf3aa('0x4')]}]},'log':_0xf3aa('0x5')});};}; \ No newline at end of file +var _0xbbe1=['name','interval','../client','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x47dc52,_0x57459f){var _0x31748f=function(_0x54a3a1){while(--_0x54a3a1){_0x47dc52['push'](_0x47dc52['shift']());}};_0x31748f(++_0x57459f);}(_0xbbe1,0x1c2));var _0x1bbe=function(_0xd6f6f5,_0x1b2345){_0xd6f6f5=_0xd6f6f5-0x0;var _0xe61908=_0xbbe1[_0xd6f6f5];return _0xe61908;};'use strict';var client=require(_0x1bbe('0x0'));exports[_0x1bbe('0x1')]=function(){return function(){return client[_0x1bbe('0x2')](_0x1bbe('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1bbe('0x4'),'as':_0x1bbe('0x5'),'attributes':['id',_0x1bbe('0x6'),_0x1bbe('0x7')]}]},'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 5a9e405..8b60e59 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 _0x5b12=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x138055,_0x4a0f51){var _0x2ee1ae=function(_0x331cd1){while(--_0x331cd1){_0x138055['push'](_0x138055['shift']());}};_0x2ee1ae(++_0x4a0f51);}(_0x5b12,0xa3));var _0x25b1=function(_0x5f3f28,_0x241627){_0x5f3f28=_0x5f3f28-0x0;var _0x296345=_0x5b12[_0x5f3f28];return _0x296345;};'use strict';var client=require(_0x25b1('0x0'));exports[_0x25b1('0x1')]=function(_0x1fe5c1,_0x569948){return client[_0x25b1('0x2')]('UpdateMailInteraction',{'body':_0x569948,'options':{'where':{'id':_0x1fe5c1}},'log':_0x25b1('0x3')});};exports[_0x25b1('0x4')]=function(_0x47995b,_0x31f3fc){return client['Request']('AddTagsToMailInteraction',{'body':_0x31f3fc,'options':{'where':{'id':_0x47995b}},'log':_0x25b1('0x5')});}; \ No newline at end of file +var _0x57ca=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request'];(function(_0x1d3948,_0x370807){var _0x3f2780=function(_0x755379){while(--_0x755379){_0x1d3948['push'](_0x1d3948['shift']());}};_0x3f2780(++_0x370807);}(_0x57ca,0x108));var _0xa57c=function(_0x390aa1,_0x221a6e){_0x390aa1=_0x390aa1-0x0;var _0x51a130=_0x57ca[_0x390aa1];return _0x51a130;};'use strict';var client=require('../client');exports[_0xa57c('0x0')]=function(_0x4ad696,_0x4b1712){return client[_0xa57c('0x1')](_0xa57c('0x2'),{'body':_0x4b1712,'options':{'where':{'id':_0x4ad696}},'log':_0xa57c('0x3')});};exports[_0xa57c('0x4')]=function(_0x1da469,_0x48be2d){return client[_0xa57c('0x1')](_0xa57c('0x5'),{'body':_0x48be2d,'options':{'where':{'id':_0x1da469}},'log':_0xa57c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d6b48d6..f87e227 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 _0x21db=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x3181a8,_0x3c91a6){var _0x55b787=function(_0x1264b8){while(--_0x1264b8){_0x3181a8['push'](_0x3181a8['shift']());}};_0x55b787(++_0x3c91a6);}(_0x21db,0xb7));var _0xb21d=function(_0x3c74cc,_0x27c651){_0x3c74cc=_0x3c74cc-0x0;var _0x104af7=_0x21db[_0x3c74cc];return _0x104af7;};'use strict';var client=require(_0xb21d('0x0'));exports[_0xb21d('0x1')]=function(_0x84016b){return client[_0xb21d('0x2')](_0xb21d('0x3'),{'body':_0x84016b,'log':_0xb21d('0x4')});}; \ No newline at end of file +var _0x9b15=['createMailMessage','../client','create','Request'];(function(_0x584f20,_0x4f0d39){var _0x15c2b9=function(_0x3f681d){while(--_0x3f681d){_0x584f20['push'](_0x584f20['shift']());}};_0x15c2b9(++_0x4f0d39);}(_0x9b15,0x1ad));var _0x59b1=function(_0xf8cb11,_0x3c9b0c){_0xf8cb11=_0xf8cb11-0x0;var _0x4b68a2=_0x9b15[_0xf8cb11];return _0x4b68a2;};'use strict';var client=require(_0x59b1('0x0'));exports[_0x59b1('0x1')]=function(_0x4af217){return client[_0x59b1('0x2')]('CreateMailMessage',{'body':_0x4af217,'log':_0x59b1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4203250..0314b18 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 _0xad17=['../client','getMailQueues','Request','GetMailQueue','name','User','online','mailPause'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xad17,0xb8));var _0x7ad1=function(_0x2efd1d,_0x44f696){_0x2efd1d=_0x2efd1d-0x0;var _0x1ef3f6=_0xad17[_0x2efd1d];return _0x1ef3f6;};'use strict';var client=require(_0x7ad1('0x0'));exports[_0x7ad1('0x1')]=function(){return function(){return client[_0x7ad1('0x2')](_0x7ad1('0x3'),{'options':{'raw':![],'attributes':['id',_0x7ad1('0x4'),'timeout','strategy'],'include':[{'model':_0x7ad1('0x5'),'as':'Agents','attributes':['id','name',_0x7ad1('0x6'),_0x7ad1('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xb25e=['User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x23531b,_0x252e36){var _0x4fcbc2=function(_0x144d36){while(--_0x144d36){_0x23531b['push'](_0x23531b['shift']());}};_0x4fcbc2(++_0x252e36);}(_0xb25e,0x180));var _0xeb25=function(_0x9e5d51,_0x596c52){_0x9e5d51=_0x9e5d51-0x0;var _0xcc871a=_0xb25e[_0x9e5d51];return _0xcc871a;};'use strict';var client=require(_0xeb25('0x0'));exports[_0xeb25('0x1')]=function(){return function(){return client[_0xeb25('0x2')](_0xeb25('0x3'),{'options':{'raw':![],'attributes':['id',_0xeb25('0x4'),'timeout',_0xeb25('0x5')],'include':[{'model':_0xeb25('0x6'),'as':_0xeb25('0x7'),'attributes':['id',_0xeb25('0x4'),_0xeb25('0x8'),_0xeb25('0x9')]}]},'log':_0xeb25('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6e53657..812273a 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 _0x5053=['DESC','UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','update'];(function(_0x1c0312,_0x3a9b84){var _0x50cb1a=function(_0x211970){while(--_0x211970){_0x1c0312['push'](_0x1c0312['shift']());}};_0x50cb1a(++_0x3a9b84);}(_0x5053,0x128));var _0x3505=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x5053[_0x57645b];return _0xe82f00;};'use strict';var client=require(_0x3505('0x0'));exports[_0x3505('0x1')]=function(_0xcb4523){return client[_0x3505('0x2')](_0x3505('0x3'),{'body':_0xcb4523,'log':_0x3505('0x3')});};exports[_0x3505('0x4')]=function(_0x380273,_0x464018){return client[_0x3505('0x2')]('UpdateMailQueueReport',{'body':_0x464018,'options':{'where':{'uniqueid':_0x380273},'order':[['id',_0x3505('0x5')]],'limit':0x1},'log':_0x3505('0x6')});}; \ No newline at end of file +var _0xc073=['Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport','create'];(function(_0x124419,_0xe9a2e0){var _0x23d913=function(_0x4517f4){while(--_0x4517f4){_0x124419['push'](_0x124419['shift']());}};_0x23d913(++_0xe9a2e0);}(_0xc073,0xdd));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x3c07('0x0')]=function(_0x1a7200){return client[_0x3c07('0x1')](_0x3c07('0x2'),{'body':_0x1a7200,'log':'CreateMailQueueReport'});};exports[_0x3c07('0x3')]=function(_0x44f0a3,_0x4bbd3e){return client[_0x3c07('0x1')]('UpdateMailQueueReport',{'body':_0x4bbd3e,'options':{'where':{'uniqueid':_0x44f0a3},'order':[['id',_0x3c07('0x4')]],'limit':0x1},'log':_0x3c07('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e169732..bb88522 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 _0xb01d=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xb01d,0xb5));var _0xdb01=function(_0x97a47d,_0x12267a){_0x97a47d=_0x97a47d-0x0;var _0x20e064=_0xb01d[_0x97a47d];return _0x20e064;};'use strict';var client=require('../client');exports[_0xdb01('0x0')]=function(_0x64aa40,_0x13a248){return client['Request'](_0xdb01('0x1'),{'body':_0x13a248,'options':{'where':{'id':_0x64aa40}},'log':_0xdb01('0x2')});};exports[_0xdb01('0x3')]=function(_0x3fce59,_0x261455){return client[_0xdb01('0x4')](_0xdb01('0x5'),{'body':_0x261455,'options':{'where':{'id':_0x3fce59}},'log':_0xdb01('0x6')});}; \ No newline at end of file +var _0xc0fc=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x53de55,_0x5221d1){var _0x1e41ad=function(_0x3b4028){while(--_0x3b4028){_0x53de55['push'](_0x53de55['shift']());}};_0x1e41ad(++_0x5221d1);}(_0xc0fc,0xf0));var _0xcc0f=function(_0x3ea563,_0x58e8d9){_0x3ea563=_0x3ea563-0x0;var _0x5cb470=_0xc0fc[_0x3ea563];return _0x5cb470;};'use strict';var client=require('../client');exports[_0xcc0f('0x0')]=function(_0x2164ef,_0x1e99ad){return client[_0xcc0f('0x1')](_0xcc0f('0x2'),{'body':_0x1e99ad,'options':{'where':{'id':_0x2164ef}},'log':_0xcc0f('0x3')});};exports[_0xcc0f('0x4')]=function(_0xdf7cf2,_0x308b07){return client[_0xcc0f('0x1')](_0xcc0f('0x5'),{'body':_0x308b07,'options':{'where':{'id':_0xdf7cf2}},'log':_0xcc0f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f007328..fb4faac 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 _0x28da=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x28da,0x1cc));var _0xa28d=function(_0x39584e,_0x497966){_0x39584e=_0x39584e-0x0;var _0x37e0a3=_0x28da[_0x39584e];return _0x37e0a3;};'use strict';var client=require(_0xa28d('0x0'));exports[_0xa28d('0x1')]=function(_0x5ae91e){return client[_0xa28d('0x2')](_0xa28d('0x3'),{'body':_0x5ae91e,'log':_0xa28d('0x4')});}; \ No newline at end of file +var _0xdedc=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0xdedc,0x10a));var _0xcded=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0xdedc[_0x21b706];return _0x13b94a;};'use strict';var client=require(_0xcded('0x0'));exports[_0xcded('0x1')]=function(_0x4028a2){return client[_0xcded('0x2')](_0xcded('0x3'),{'body':_0x4028a2,'log':_0xcded('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 1b6e880..8c44177 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 _0x365a=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','User','name','online'];(function(_0x2f2913,_0x930696){var _0x1a3f27=function(_0x5296e1){while(--_0x5296e1){_0x2f2913['push'](_0x2f2913['shift']());}};_0x1a3f27(++_0x930696);}(_0x365a,0x18d));var _0xa365=function(_0x22e025,_0x4e3b6a){_0x22e025=_0x22e025-0x0;var _0x10f83f=_0x365a[_0x22e025];return _0x10f83f;};'use strict';var client=require(_0xa365('0x0'));exports[_0xa365('0x1')]=function(){return function(){return client[_0xa365('0x2')](_0xa365('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xa365('0x4')],'include':[{'model':_0xa365('0x5'),'as':'Agents','attributes':['id',_0xa365('0x6'),_0xa365('0x7'),_0xa365('0x8')]}]},'log':_0xa365('0x1')});};}; \ No newline at end of file +var _0xdb53=['name','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','Agents'];(function(_0x158771,_0x3b2086){var _0x50aa04=function(_0x385ad1){while(--_0x385ad1){_0x158771['push'](_0x158771['shift']());}};_0x50aa04(++_0x3b2086);}(_0xdb53,0x142));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3db5('0x0'));exports[_0x3db5('0x1')]=function(){return function(){return client[_0x3db5('0x2')](_0x3db5('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3db5('0x4'),_0x3db5('0x5')],'include':[{'model':_0x3db5('0x6'),'as':_0x3db5('0x7'),'attributes':['id',_0x3db5('0x8'),'online',_0x3db5('0x9')]}]},'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 3b17ebb..501c62c 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 _0xa7eb=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x322acf,_0x4203cf){var _0x4b2c50=function(_0xf8eb96){while(--_0xf8eb96){_0x322acf['push'](_0x322acf['shift']());}};_0x4b2c50(++_0x4203cf);}(_0xa7eb,0x1d5));var _0xba7e=function(_0x5e594e,_0x291a21){_0x5e594e=_0x5e594e-0x0;var _0x9dfa46=_0xa7eb[_0x5e594e];return _0x9dfa46;};'use strict';var client=require(_0xba7e('0x0'));exports['create']=function(_0xe053bb){return client[_0xba7e('0x1')](_0xba7e('0x2'),{'body':_0xe053bb,'log':_0xba7e('0x2')});};exports[_0xba7e('0x3')]=function(_0x2bda8b,_0x61cc12){return client[_0xba7e('0x1')](_0xba7e('0x4'),{'body':_0x61cc12,'options':{'where':{'uniqueid':_0x2bda8b},'order':[['id','DESC']],'limit':0x1},'log':_0xba7e('0x4')});}; \ No newline at end of file +var _0xa9cd=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x43b807,_0x30882d){var _0x37befd=function(_0x4772cb){while(--_0x4772cb){_0x43b807['push'](_0x43b807['shift']());}};_0x37befd(++_0x30882d);}(_0xa9cd,0x187));var _0xda9c=function(_0x271107,_0x40af78){_0x271107=_0x271107-0x0;var _0x2dd948=_0xa9cd[_0x271107];return _0x2dd948;};'use strict';var client=require(_0xda9c('0x0'));exports[_0xda9c('0x1')]=function(_0x312f90){return client[_0xda9c('0x2')](_0xda9c('0x3'),{'body':_0x312f90,'log':_0xda9c('0x3')});};exports[_0xda9c('0x4')]=function(_0x5b83fe,_0x58e4cc){return client[_0xda9c('0x2')](_0xda9c('0x5'),{'body':_0x58e4cc,'options':{'where':{'uniqueid':_0x5b83fe},'order':[['id',_0xda9c('0x6')]],'limit':0x1},'log':_0xda9c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e9ead3b..55c469b 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 _0xb138=['UpdateSmsInteraction','updateSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x389fb1,_0x431673){var _0x3d3520=function(_0x2dcab7){while(--_0x2dcab7){_0x389fb1['push'](_0x389fb1['shift']());}};_0x3d3520(++_0x431673);}(_0xb138,0x1dd));var _0x8b13=function(_0x186817,_0x2ab481){_0x186817=_0x186817-0x0;var _0x279a2e=_0xb138[_0x186817];return _0x279a2e;};'use strict';var client=require(_0x8b13('0x0'));exports[_0x8b13('0x1')]=function(_0x42aad6,_0x33f214){return client[_0x8b13('0x2')](_0x8b13('0x3'),{'body':_0x33f214,'options':{'where':{'id':_0x42aad6}},'log':_0x8b13('0x4')});};exports['addTags']=function(_0x4411a0,_0x241acb){return client[_0x8b13('0x2')]('AddTagsToSmsInteraction',{'body':_0x241acb,'options':{'where':{'id':_0x4411a0}},'log':_0x8b13('0x5')});}; \ No newline at end of file +var _0x4491=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client'];(function(_0x1bc993,_0x4111ba){var _0x4cccde=function(_0x426635){while(--_0x426635){_0x1bc993['push'](_0x1bc993['shift']());}};_0x4cccde(++_0x4111ba);}(_0x4491,0x1bb));var _0x1449=function(_0x34e0aa,_0x6bd6b8){_0x34e0aa=_0x34e0aa-0x0;var _0x332021=_0x4491[_0x34e0aa];return _0x332021;};'use strict';var client=require(_0x1449('0x0'));exports['update']=function(_0x4257f6,_0x47cccd){return client[_0x1449('0x1')](_0x1449('0x2'),{'body':_0x47cccd,'options':{'where':{'id':_0x4257f6}},'log':_0x1449('0x3')});};exports[_0x1449('0x4')]=function(_0x1ff47f,_0x1b2870){return client['Request'](_0x1449('0x5'),{'body':_0x1b2870,'options':{'where':{'id':_0x1ff47f}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7b43120..2713ae4 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 _0xbf2e=['create','Request','CreateSmsMessage','../client'];(function(_0x2c8efc,_0x71d66c){var _0xc7dbed=function(_0x4acde8){while(--_0x4acde8){_0x2c8efc['push'](_0x2c8efc['shift']());}};_0xc7dbed(++_0x71d66c);}(_0xbf2e,0xe7));var _0xebf2=function(_0x594fc0,_0xf525e7){_0x594fc0=_0x594fc0-0x0;var _0x485c8c=_0xbf2e[_0x594fc0];return _0x485c8c;};'use strict';var client=require(_0xebf2('0x0'));exports[_0xebf2('0x1')]=function(_0x520c29){return client[_0xebf2('0x2')](_0xebf2('0x3'),{'body':_0x520c29,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x2a61=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x1ddd54,_0x280a93){var _0x32b1e9=function(_0x293c98){while(--_0x293c98){_0x1ddd54['push'](_0x1ddd54['shift']());}};_0x32b1e9(++_0x280a93);}(_0x2a61,0x1c5));var _0x12a6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2a61[_0x432682];return _0x463d05;};'use strict';var client=require(_0x12a6('0x0'));exports[_0x12a6('0x1')]=function(_0x4a6a60){return client[_0x12a6('0x2')](_0x12a6('0x3'),{'body':_0x4a6a60,'log':_0x12a6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index bcce6cf..ccaf8bf 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0xefa8cb,_0x232cae){var _0x35a4c2=function(_0x248858){while(--_0x248858){_0xefa8cb['push'](_0xefa8cb['shift']());}};_0x35a4c2(++_0x232cae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x41aa8c,_0x103cb5){var _0x4c99bb=function(_0x1106b4){while(--_0x1106b4){_0x41aa8c['push'](_0x41aa8c['shift']());}};_0x4c99bb(++_0x103cb5);}(_0xe706,0xa3));var _0x6e70=function(_0x27889f,_0x4809b9){_0x27889f=_0x27889f-0x0;var _0x201713=_0xe706[_0x27889f];return _0x201713;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c29a381..ed86fca 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c460a,_0x192714){_0x4c460a=_0x4c460a-0x0;var _0xfb1474=_0xedd9[_0x4c460a];return _0xfb1474;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xedd9,0xfc));var _0x9edd=function(_0x343f8b,_0x2af219){_0x343f8b=_0x343f8b-0x0;var _0x174c2b=_0xedd9[_0x343f8b];return _0x174c2b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c558bc8..c19eb97 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(_0x2361d4,_0x2b889a){var _0x40b27a=function(_0x546ae6){while(--_0x546ae6){_0x2361d4['push'](_0x2361d4['shift']());}};_0x40b27a(++_0x2b889a);}(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x49e9c5,_0x42ff22){var _0x521e7b=function(_0x5c0c9a){while(--_0x5c0c9a){_0x49e9c5['push'](_0x49e9c5['shift']());}};_0x521e7b(++_0x42ff22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 ba510ab..9506a49 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 _0xac6a=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x30ddeb,_0x227942){var _0x13707e=function(_0x1478a6){while(--_0x1478a6){_0x30ddeb['push'](_0x30ddeb['shift']());}};_0x13707e(++_0x227942);}(_0xac6a,0xc2));var _0xaac6=function(_0x4fa716,_0x3279fd){_0x4fa716=_0x4fa716-0x0;var _0x5c5fc3=_0xac6a[_0x4fa716];return _0x5c5fc3;};'use strict';var client=require(_0xaac6('0x0'));exports[_0xaac6('0x1')]=function(_0x2e9ec8,_0x10ccdc){return client[_0xaac6('0x2')]('UpdateWhatsappInteraction',{'body':_0x10ccdc,'options':{'where':{'id':_0x2e9ec8}},'log':_0xaac6('0x3')});};exports['addTags']=function(_0x9dc043,_0x1a0d76){return client[_0xaac6('0x2')](_0xaac6('0x4'),{'body':_0x1a0d76,'options':{'where':{'id':_0x9dc043}},'log':_0xaac6('0x5')});}; \ No newline at end of file +var _0xd819=['update','Request','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x1a146d,_0x156795){var _0x18e7b3=function(_0x4f25cf){while(--_0x4f25cf){_0x1a146d['push'](_0x1a146d['shift']());}};_0x18e7b3(++_0x156795);}(_0xd819,0x181));var _0x9d81=function(_0x2862b1,_0x51a367){_0x2862b1=_0x2862b1-0x0;var _0x817ee6=_0xd819[_0x2862b1];return _0x817ee6;};'use strict';var client=require('../client');exports[_0x9d81('0x0')]=function(_0x1a7f0f,_0xeda5e){return client[_0x9d81('0x1')]('UpdateWhatsappInteraction',{'body':_0xeda5e,'options':{'where':{'id':_0x1a7f0f}},'log':_0x9d81('0x2')});};exports['addTags']=function(_0x301265,_0x53ff09){return client[_0x9d81('0x1')](_0x9d81('0x3'),{'body':_0x53ff09,'options':{'where':{'id':_0x301265}},'log':_0x9d81('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b4be37f..e20b04d 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 _0x1dd6=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x44bf7d,_0x591902){var _0x10eb72=function(_0x32934b){while(--_0x32934b){_0x44bf7d['push'](_0x44bf7d['shift']());}};_0x10eb72(++_0x591902);}(_0x1dd6,0x147));var _0x61dd=function(_0x359beb,_0x4a4ef9){_0x359beb=_0x359beb-0x0;var _0xfafdc4=_0x1dd6[_0x359beb];return _0xfafdc4;};'use strict';var client=require('../client');exports[_0x61dd('0x0')]=function(_0x4236ff){return client['Request'](_0x61dd('0x1'),{'body':_0x4236ff,'log':_0x61dd('0x2')});}; \ No newline at end of file +var _0x7269=['Request','CreateWhatsappMessage','../client'];(function(_0x2c6176,_0x44b1b0){var _0x34c56f=function(_0x5a9ba1){while(--_0x5a9ba1){_0x2c6176['push'](_0x2c6176['shift']());}};_0x34c56f(++_0x44b1b0);}(_0x7269,0x191));var _0x9726=function(_0xf38006,_0x406a02){_0xf38006=_0xf38006-0x0;var _0x3748b8=_0x7269[_0xf38006];return _0x3748b8;};'use strict';var client=require(_0x9726('0x0'));exports['create']=function(_0x4686c6){return client[_0x9726('0x1')](_0x9726('0x2'),{'body':_0x4686c6,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7938d2f..9cc301a 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 _0x8cc4=['timeout','strategy','User','Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x1155f4,_0x107a57){var _0x5da85b=function(_0x333064){while(--_0x333064){_0x1155f4['push'](_0x1155f4['shift']());}};_0x5da85b(++_0x107a57);}(_0x8cc4,0x91));var _0x48cc=function(_0x78409a,_0x15cdd1){_0x78409a=_0x78409a-0x0;var _0xabcc52=_0x8cc4[_0x78409a];return _0xabcc52;};'use strict';var client=require(_0x48cc('0x0'));exports[_0x48cc('0x1')]=function(){return function(){return client[_0x48cc('0x2')](_0x48cc('0x3'),{'options':{'raw':![],'attributes':['id',_0x48cc('0x4'),_0x48cc('0x5'),_0x48cc('0x6')],'include':[{'model':_0x48cc('0x7'),'as':_0x48cc('0x8'),'attributes':['id','name','online',_0x48cc('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xf0ab=['GetWhatsappQueue','name','strategy','User','online','whatsappPause','getWhatsappQueues'];(function(_0x1952ee,_0x3150f5){var _0x14a866=function(_0x3a5422){while(--_0x3a5422){_0x1952ee['push'](_0x1952ee['shift']());}};_0x14a866(++_0x3150f5);}(_0xf0ab,0xf4));var _0xbf0a=function(_0x97b0f4,_0x4ac8f6){_0x97b0f4=_0x97b0f4-0x0;var _0x3c4ee1=_0xf0ab[_0x97b0f4];return _0x3c4ee1;};'use strict';var client=require('../client');exports[_0xbf0a('0x0')]=function(){return function(){return client['Request'](_0xbf0a('0x1'),{'options':{'raw':![],'attributes':['id',_0xbf0a('0x2'),'timeout',_0xbf0a('0x3')],'include':[{'model':_0xbf0a('0x4'),'as':'Agents','attributes':['id',_0xbf0a('0x2'),_0xbf0a('0x5'),_0xbf0a('0x6')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0dd0a5b..ea80bb2 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 _0x835f=['UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update','Request'];(function(_0x5b11b8,_0xe6b9a9){var _0x5aab03=function(_0x3423af){while(--_0x3423af){_0x5b11b8['push'](_0x5b11b8['shift']());}};_0x5aab03(++_0xe6b9a9);}(_0x835f,0x1a5));var _0xf835=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x835f[_0x5e6ea3];return _0x4048b5;};'use strict';var client=require(_0xf835('0x0'));exports[_0xf835('0x1')]=function(_0x3843f6){return client['Request'](_0xf835('0x2'),{'body':_0x3843f6,'log':_0xf835('0x2')});};exports[_0xf835('0x3')]=function(_0x56aea3,_0x94c2fd){return client[_0xf835('0x4')](_0xf835('0x5'),{'body':_0x94c2fd,'options':{'where':{'uniqueid':_0x56aea3},'order':[['id','DESC']],'limit':0x1},'log':_0xf835('0x5')});}; \ No newline at end of file +var _0xf4fd=['../client','CreateWhatsappQueueReport','update','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4fd,0x1c0));var _0xdf4f=function(_0x1732a1,_0x4b8b9b){_0x1732a1=_0x1732a1-0x0;var _0x1c17d8=_0xf4fd[_0x1732a1];return _0x1c17d8;};'use strict';var client=require(_0xdf4f('0x0'));exports['create']=function(_0x4d8bbc){return client['Request'](_0xdf4f('0x1'),{'body':_0x4d8bbc,'log':'CreateWhatsappQueueReport'});};exports[_0xdf4f('0x2')]=function(_0x2167fa,_0x410c11){return client[_0xdf4f('0x3')]('UpdateWhatsappQueueReport',{'body':_0x410c11,'options':{'where':{'uniqueid':_0x2167fa},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 6059948..966361a 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 _0xec29=['name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','agents','timeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format'];(function(_0x3add17,_0x201ac7){var _0xb365d6=function(_0x364dfe){while(--_0x364dfe){_0x3add17['push'](_0x3add17['shift']());}};_0xb365d6(++_0x201ac7);}(_0xec29,0x1ca));var _0x9ec2=function(_0x106bab,_0x366803){_0x106bab=_0x106bab-0x0;var _0x49fcd9=_0xec29[_0x106bab];return _0x49fcd9;};'use strict';var schema=require(_0x9ec2('0x0'));var _=require(_0x9ec2('0x1'));var util=require(_0x9ec2('0x2'));var seqqueue=require(_0x9ec2('0x3'));var logger=require(_0x9ec2('0x4'))(_0x9ec2('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x9ec2('0x6')},'timeout':{'type':_0x9ec2('0x7'),'message':_0x9ec2('0x8')}});function writeLog(_0x1b8fb2,_0x378d71,_0x4090eb){return logger['info'](util[_0x9ec2('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1b8fb2,_0x378d71[_0x9ec2('0xa')],_0x4090eb));}function handleFindAgent(_0x23fbea){return function(_0x2787c2){return _0x2787c2[_0x9ec2('0xa')]['toLowerCase']()===_0x23fbea[_0x9ec2('0xb')]();};}exports[_0x9ec2('0xc')]=function(_0x10beb5,_0x44dcc6,_0x1906a9,_0x23556f){return function(_0x5353e5){try{var _0x49c6d0={'name':_0x44dcc6[0x0],'timeout':_0x44dcc6[0x1]};var _0x4ae6c7=queue[_0x9ec2('0x0')](_0x49c6d0,{'typecast':!![]});if(_0x4ae6c7[_0x9ec2('0xd')]){logger[_0x9ec2('0xe')](_0x9ec2('0xf'),_0x10beb5,_[_0x9ec2('0x10')](_0x4ae6c7,_0x9ec2('0x11'))[_0x9ec2('0x12')](',\x20'));_0x5353e5['stop']();}else{var _0x3ddc0b=_['find'](_0x1906a9[_0x9ec2('0x13')],handleFindAgent(_0x49c6d0[_0x9ec2('0xa')]));if(_0x3ddc0b){var _0x34c9b7=(_0x49c6d0[_0x9ec2('0x14')]||0xa)*0x3e8;var _0x5cbc66,_0xccfa6a;var _0x296f55=seqqueue['createQueue'](_0x34c9b7);_0x296f55['id']=_0x10beb5;_0x296f55['atimeout']=_0x34c9b7;_0x296f55[_0x9ec2('0x15')]=_0x23556f[_0x9ec2('0x15')];writeLog(_0x10beb5,_0x3ddc0b,util[_0x9ec2('0x9')]('START:%s',_0x34c9b7));_0x1906a9[_0x9ec2('0x16')][_0x10beb5]['on'](_0x9ec2('0x17'),function(){logger[_0x9ec2('0x18')](_0x9ec2('0x19'),_0x10beb5);clearTimeout(_0xccfa6a);_0xccfa6a=undefined;_0x296f55['close']();if(_0x1906a9[_0x9ec2('0x16')][_0x10beb5]){delete _0x1906a9[_0x9ec2('0x16')][_0x10beb5];}_0x5353e5[_0x9ec2('0x1a')]();});_0x1906a9[_0x9ec2('0x16')][_0x10beb5]['on'](_0x9ec2('0x1b'),function(){if(_0x1906a9[_0x9ec2('0x16')][_0x10beb5]){delete _0x1906a9[_0x9ec2('0x16')][_0x10beb5];}});_0xccfa6a=setTimeout(function(){logger['info'](_0x9ec2('0x1c'),_0x10beb5);clearTimeout(_0xccfa6a);_0x296f55[_0x9ec2('0x1d')]();_0x5353e5[_0x9ec2('0x1e')]();},_0x34c9b7);strategy[_0x9ec2('0x1f')](_0x296f55,_0x3ddc0b,_0x1906a9,_0x23556f);}else{logger['error'](_0x9ec2('0x20'),_0x10beb5,_0x49c6d0[_0x9ec2('0xa')]);_0x5353e5[_0x9ec2('0x1a')]();}}}catch(_0x38d5ec){console[_0x9ec2('0x21')](_0x38d5ec);logger[_0x9ec2('0xe')](_0x9ec2('0x22'),_0x10beb5,_0x38d5ec[_0x9ec2('0x23')]);_0x5353e5[_0x9ec2('0x1a')]();}};}; \ No newline at end of file +var _0x695f=['consequence','error','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x24f58d,_0x4bb4ee){var _0x3f2961=function(_0x1b37b3){while(--_0x1b37b3){_0x24f58d['push'](_0x24f58d['shift']());}};_0x3f2961(++_0x4bb4ee);}(_0x695f,0x15b));var _0xf695=function(_0x3a6ad5,_0x3af4da){_0x3a6ad5=_0x3a6ad5-0x0;var _0x159212=_0x695f[_0x3a6ad5];return _0x159212;};'use strict';var schema=require(_0xf695('0x0'));var _=require(_0xf695('0x1'));var util=require(_0xf695('0x2'));var seqqueue=require(_0xf695('0x3'));var logger=require('../../../../config/logger')(_0xf695('0x4'));var strategy=require(_0xf695('0x5'));var queue=schema({'name':{'type':_0xf695('0x6'),'required':!![],'message':_0xf695('0x7')},'timeout':{'type':_0xf695('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x158885,_0x44fc07,_0x18ed6f){return logger[_0xf695('0x9')](util['format'](_0xf695('0xa'),_0x158885,_0x44fc07[_0xf695('0xb')],_0x18ed6f));}function handleFindAgent(_0x59d88b){return function(_0x5daad5){return _0x5daad5[_0xf695('0xb')][_0xf695('0xc')]()===_0x59d88b[_0xf695('0xc')]();};}exports[_0xf695('0xd')]=function(_0x24019b,_0xd25527,_0x557164,_0x1d0334){return function(_0x26713c){try{var _0x2cf72f={'name':_0xd25527[0x0],'timeout':_0xd25527[0x1]};var _0x1acb46=queue[_0xf695('0x0')](_0x2cf72f,{'typecast':!![]});if(_0x1acb46['length']){logger[_0xf695('0xe')]('[%s][AGENT]\x20%s',_0x24019b,_[_0xf695('0xf')](_0x1acb46,_0xf695('0x10'))[_0xf695('0x11')](',\x20'));_0x26713c[_0xf695('0x12')]();}else{var _0x527429=_[_0xf695('0x13')](_0x557164[_0xf695('0x14')],handleFindAgent(_0x2cf72f[_0xf695('0xb')]));if(_0x527429){var _0x335f35=(_0x2cf72f[_0xf695('0x15')]||0xa)*0x3e8;var _0x1142f2,_0x32692d;var _0x5d5816=seqqueue[_0xf695('0x16')](_0x335f35);_0x5d5816['id']=_0x24019b;_0x5d5816[_0xf695('0x17')]=_0x335f35;_0x5d5816[_0xf695('0x18')]=_0x1d0334[_0xf695('0x18')];writeLog(_0x24019b,_0x527429,util['format'](_0xf695('0x19'),_0x335f35));_0x557164[_0xf695('0x1a')][_0x24019b]['on'](_0xf695('0x1b'),function(){logger[_0xf695('0x9')](_0xf695('0x1c'),_0x24019b);clearTimeout(_0x32692d);_0x32692d=undefined;_0x5d5816[_0xf695('0x1d')]();if(_0x557164['rules'][_0x24019b]){delete _0x557164[_0xf695('0x1a')][_0x24019b];}_0x26713c[_0xf695('0x12')]();});_0x557164[_0xf695('0x1a')][_0x24019b]['on']('complete',function(){if(_0x557164['rules'][_0x24019b]){delete _0x557164[_0xf695('0x1a')][_0x24019b];}});_0x32692d=setTimeout(function(){logger[_0xf695('0x9')](_0xf695('0x1e'),_0x24019b);clearTimeout(_0x32692d);_0x5d5816[_0xf695('0x1d')]();_0x26713c['next']();},_0x335f35);strategy[_0xf695('0x1f')](_0x5d5816,_0x527429,_0x557164,_0x1d0334);}else{logger['error'](_0xf695('0x20'),_0x24019b,_0x2cf72f[_0xf695('0xb')]);_0x26713c[_0xf695('0x12')]();}}}catch(_0x2932a3){console[_0xf695('0x21')](_0x2932a3);logger[_0xf695('0xe')](_0xf695('0x22'),_0x24019b,_0x2932a3[_0xf695('0x23')]);_0x26713c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index df323cf..da14478 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 _0x493e=['$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','aws-sdk','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x307bfb,_0x4a61ac){var _0x472052=function(_0x1fb58d){while(--_0x1fb58d){_0x307bfb['push'](_0x307bfb['shift']());}};_0x472052(++_0x4a61ac);}(_0x493e,0x1d5));var _0xe493=function(_0x4bb531,_0x17458f){_0x4bb531=_0x4bb531-0x0;var _0x25f793=_0x493e[_0x4bb531];return _0x25f793;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xe493('0x0'));var utils=require('./utils');var logger=require(_0xe493('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe493('0x2')),'mailMessage':require(_0xe493('0x3')),'smsMessage':require(_0xe493('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe493('0x5'))};exports[_0xe493('0x6')]=function(_0x4ee8a4,_0xd6d01d){return function(_0x51775d){try{if(!_[_0xe493('0x7')](this[_0xe493('0x8')]['UserId'])){logger[_0xe493('0x9')]('[%s][AMAZONLEX]\x20%s',_0x4ee8a4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x51775d[_0xe493('0xa')]();}var _0x1af923={'ContactId':this[_0xe493('0xb')]['id'],'sentAt':moment()['format'](_0xe493('0xc')),'direction':_0xe493('0xd')};if(this[_0xe493('0xe')]===_0xe493('0xf')||this['channel']===_0xe493('0x10')){_0x1af923[_0xe493('0x11')]=this[_0xe493('0x8')]['phone'];}var _0x536701=this[_0xe493('0xe')];if(_0x536701===_0xe493('0x12')){_0x1af923[_0xe493('0x13')]=this[_0xe493('0x14')]['id'];}else{_0x1af923[_['upperFirst'](_0x536701)+_0xe493('0x15')]=this[_0xe493('0x14')]['id'];}_0x1af923[_[_0xe493('0x16')](_0x536701)+_0xe493('0x17')]=this[_0xe493('0x8')]['id'];if(this[_0xe493('0x8')]['created']){var _0x22e9c2=_0xd6d01d[0x4];if(!_['isEmpty'](_0x22e9c2)){_0x1af923[_0xe493('0x18')]=utils[_0xe493('0x19')](_0x22e9c2,this);return rpc[_0x536701+_0xe493('0x1a')][_0xe493('0x1b')](_0x1af923)[_0xe493('0x1c')](function(_0x21d4d2){logger[_0xe493('0x9')](_0xe493('0x1d'),_0x4ee8a4,_0x1af923['body']);})[_0xe493('0x1e')](function(_0x203add){logger[_0xe493('0x1f')](_0xe493('0x1d'),_0x4ee8a4,JSON[_0xe493('0x20')](_0x203add));})[_0xe493('0x21')](function(){logger[_0xe493('0x9')](_0xe493('0x22'),_0x4ee8a4);_0x51775d[_0xe493('0x23')]();});}else{logger[_0xe493('0x9')](_0xe493('0x24'),_0x4ee8a4);_0x51775d[_0xe493('0x23')]();}}else{var _0x5a0cf0=this;var _0x402112=new AWS['LexRuntime']({'accessKeyId':_0xd6d01d[0x0],'secretAccessKey':_0xd6d01d[0x1],'region':_0xd6d01d[0x2]});var _0xc33b52={'botAlias':_0xe493('0x25'),'botName':_0xd6d01d[0x3],'inputText':this[_0xe493('0x26')][_0xe493('0x18')],'userId':this[_0xe493('0xe')]+':'+this[_0xe493('0x8')]['id'][_0xe493('0x27')]()};_0x402112[_0xe493('0x28')](_0xc33b52,function(_0x5f5668,_0xc29d5d){if(_0x5f5668){logger['error'](_0xe493('0x1d'),_0x4ee8a4,_0x5f5668['message']);_0x51775d[_0xe493('0xa')]();}else if(_0xc29d5d&&_0xc29d5d[_0xe493('0x26')]){_0x5a0cf0['body'][_0xe493('0x29')]=_0xc29d5d;_0x1af923[_0xe493('0x18')]=_0xc29d5d[_0xe493('0x26')];_0x1af923[_0xe493('0x2a')]=_0xe493('0x29');_0x1af923[_0xe493('0x2b')]=JSON[_0xe493('0x20')](_0xc29d5d);return rpc[_0x536701+_0xe493('0x1a')][_0xe493('0x1b')](_0x1af923)[_0xe493('0x1c')](function(_0x1faed7){logger[_0xe493('0x9')](_0xe493('0x1d'),_0x4ee8a4,_0x1af923[_0xe493('0x18')]);if(_0xc29d5d[_0xe493('0x2c')]==_0xe493('0x2d')){_0x51775d['next']();}else{_0x51775d[_0xe493('0x23')]();}})[_0xe493('0x1e')](function(_0x565f28){logger[_0xe493('0x1f')](_0xe493('0x1d'),_0x4ee8a4,JSON[_0xe493('0x20')](_0x565f28));_0x51775d[_0xe493('0xa')]();});}else{_0x51775d[_0xe493('0xa')]();}});}}catch(_0x2d2917){logger[_0xe493('0x1f')](_0xe493('0x1d'),_0x4ee8a4,JSON[_0xe493('0x20')](_0x2d2917));_0x51775d[_0xe493('0x23')]();}};}; \ No newline at end of file +var _0x6b8b=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','then','body','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Message','create','dialogState','Failed','catch','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','sms','whatsapp','phone','channel'];(function(_0x1abcd6,_0x368ee3){var _0x8ac9c2=function(_0x438da5){while(--_0x438da5){_0x1abcd6['push'](_0x1abcd6['shift']());}};_0x8ac9c2(++_0x368ee3);}(_0x6b8b,0x7f));var _0xb6b8=function(_0x53cf83,_0xc3f0a1){_0x53cf83=_0x53cf83-0x0;var _0x494cd9=_0x6b8b[_0x53cf83];return _0x494cd9;};'use strict';var _=require('lodash');var moment=require(_0xb6b8('0x0'));var AWS=require(_0xb6b8('0x1'));var utils=require(_0xb6b8('0x2'));var logger=require(_0xb6b8('0x3'))(_0xb6b8('0x4'));var rpc={'chatMessage':require(_0xb6b8('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb6b8('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb6b8('0x7'))};exports['consequence']=function(_0x4850f5,_0x57deb9){return function(_0x29e9b6){try{if(!_[_0xb6b8('0x8')](this[_0xb6b8('0x9')][_0xb6b8('0xa')])){logger['info'](_0xb6b8('0xb'),_0x4850f5,_0xb6b8('0xc'));return _0x29e9b6[_0xb6b8('0xd')]();}var _0x2d39f6={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb6b8('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xb6b8('0xf')};if(this['channel']===_0xb6b8('0x10')||this['channel']===_0xb6b8('0x11')){_0x2d39f6[_0xb6b8('0x12')]=this[_0xb6b8('0x9')][_0xb6b8('0x12')];}var _0x578851=this[_0xb6b8('0x13')];if(_0x578851==='chat'){_0x2d39f6[_0xb6b8('0x14')]=this[_0xb6b8('0x15')]['id'];}else{_0x2d39f6[_[_0xb6b8('0x16')](_0x578851)+_0xb6b8('0x17')]=this[_0xb6b8('0x15')]['id'];}_0x2d39f6[_['upperFirst'](_0x578851)+_0xb6b8('0x18')]=this[_0xb6b8('0x9')]['id'];if(this[_0xb6b8('0x9')]['created']){var _0x2150d4=_0x57deb9[0x4];if(!_[_0xb6b8('0x19')](_0x2150d4)){_0x2d39f6['body']=utils[_0xb6b8('0x1a')](_0x2150d4,this);return rpc[_0x578851+'Message']['create'](_0x2d39f6)[_0xb6b8('0x1b')](function(_0x5916ea){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4850f5,_0x2d39f6[_0xb6b8('0x1c')]);})['catch'](function(_0x22a286){logger[_0xb6b8('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x4850f5,JSON[_0xb6b8('0x1e')](_0x22a286));})[_0xb6b8('0x1f')](function(){logger[_0xb6b8('0x20')](_0xb6b8('0x21'),_0x4850f5);_0x29e9b6[_0xb6b8('0x22')]();});}else{logger[_0xb6b8('0x20')](_0xb6b8('0x23'),_0x4850f5);_0x29e9b6[_0xb6b8('0x22')]();}}else{var _0x542b82=this;var _0x3ca77c=new AWS[(_0xb6b8('0x24'))]({'accessKeyId':_0x57deb9[0x0],'secretAccessKey':_0x57deb9[0x1],'region':_0x57deb9[0x2]});var _0xe8c05e={'botAlias':_0xb6b8('0x25'),'botName':_0x57deb9[0x3],'inputText':this[_0xb6b8('0x26')][_0xb6b8('0x1c')],'userId':this['channel']+':'+this[_0xb6b8('0x9')]['id'][_0xb6b8('0x27')]()};_0x3ca77c[_0xb6b8('0x28')](_0xe8c05e,function(_0x1288ad,_0x28d7ba){if(_0x1288ad){logger[_0xb6b8('0x1d')](_0xb6b8('0xb'),_0x4850f5,_0x1288ad[_0xb6b8('0x26')]);_0x29e9b6[_0xb6b8('0xd')]();}else if(_0x28d7ba&&_0x28d7ba[_0xb6b8('0x26')]){_0x542b82[_0xb6b8('0x1c')][_0xb6b8('0x29')]=_0x28d7ba;_0x2d39f6[_0xb6b8('0x1c')]=_0x28d7ba[_0xb6b8('0x26')];_0x2d39f6[_0xb6b8('0x2a')]=_0xb6b8('0x29');_0x2d39f6[_0xb6b8('0x2b')]=JSON['stringify'](_0x28d7ba);return rpc[_0x578851+_0xb6b8('0x2c')][_0xb6b8('0x2d')](_0x2d39f6)['then'](function(_0x5a5ebb){logger['info'](_0xb6b8('0xb'),_0x4850f5,_0x2d39f6[_0xb6b8('0x1c')]);if(_0x28d7ba[_0xb6b8('0x2e')]==_0xb6b8('0x2f')){_0x29e9b6[_0xb6b8('0xd')]();}else{_0x29e9b6[_0xb6b8('0x22')]();}})[_0xb6b8('0x30')](function(_0xe63df2){logger[_0xb6b8('0x1d')](_0xb6b8('0xb'),_0x4850f5,JSON['stringify'](_0xe63df2));_0x29e9b6['next']();});}else{_0x29e9b6['next']();}});}}catch(_0x4fbaf9){logger[_0xb6b8('0x1d')](_0xb6b8('0xb'),_0x4850f5,JSON['stringify'](_0x4fbaf9));_0x29e9b6[_0xb6b8('0x22')]();}};}; \ 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 c57a1d4..cb74f18 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 _0x7ac1=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','channel','mail','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x7ac1,0x1c6));var _0x17ac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7ac1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x17ac('0x0'));var moment=require('moment');var utils=require(_0x17ac('0x1'));var logger=require(_0x17ac('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x17ac('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x17ac('0x4')),'faxMessage':require(_0x17ac('0x5')),'whatsappMessage':require(_0x17ac('0x6')),'chatInteraction':require(_0x17ac('0x7')),'openchannelInteraction':require(_0x17ac('0x8')),'mailInteraction':require(_0x17ac('0x9')),'smsInteraction':require(_0x17ac('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x17ac('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x17ac('0xc')]=function(_0x1d113d,_0x5c6878,_0x2d7097,_0x3d323a){return function(_0x36302f){try{var _0x39b8cf=this['channel'];if(_0x39b8cf==='mail'&&_0x3d323a[_0x17ac('0xd')][_0x17ac('0xe')]){logger['info'](_0x17ac('0xf'),_0x1d113d,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x36302f[_0x17ac('0x10')]();}if(_0x5c6878[0x0]==='1'&&(_[_0x17ac('0x11')](this[_0x17ac('0x12')][_0x17ac('0x13')])||!this[_0x17ac('0x12')]['created'])){logger[_0x17ac('0x14')]('[%s][AUTOREPLY]\x20%s',_0x1d113d,_0x17ac('0x15'));return _0x36302f[_0x17ac('0x10')]();}if(_0x5c6878[0x0]==='2'&&this[_0x17ac('0x12')]['autoreplyExecuted']){logger[_0x17ac('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1d113d,_0x17ac('0x16'));return _0x36302f[_0x17ac('0x10')]();}var _0x300b10={'ContactId':this[_0x17ac('0x17')]['id'],'sentAt':moment()[_0x17ac('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']==='mail'){_0x300b10['body']=utils[_0x17ac('0x19')](_0x5c6878[0x2],this);}else{_0x300b10[_0x17ac('0xd')]=utils[_0x17ac('0x19')](_0x5c6878[0x1],this);}if(this[_0x17ac('0x1a')]){_0x300b10['to']=this[_0x17ac('0x1a')][_0x17ac('0x1b')]||'';if(this[_0x17ac('0x1c')]===_0x17ac('0x1d')&&_0x5c6878[0x1]==='1'){_0x300b10['cc']=this[_0x17ac('0x1a')]['cc']||'';}_0x300b10[_0x17ac('0x1b')]=this[_0x17ac('0x1a')]['to']||'';_0x300b10['phone']=this['message'][_0x17ac('0x1e')]||'';_0x300b10[_0x17ac('0x1f')]=!![];if(this[_0x17ac('0x1a')][_0x17ac('0x20')]){_0x300b10[_0x17ac('0x20')]='';_0x300b10[_0x17ac('0x20')]+=_[_0x17ac('0x21')](this['message'][_0x17ac('0x20')],_0x17ac('0x22'))?'':'Re:\x20';_0x300b10[_0x17ac('0x20')]+=this['message'][_0x17ac('0x20')];}}if(this[_0x17ac('0x1c')]===_0x17ac('0x23')){_0x300b10[_0x17ac('0x24')]=this[_0x17ac('0x25')]['id'];}else{_0x300b10[_[_0x17ac('0x26')](this[_0x17ac('0x1c')])+_0x17ac('0x27')]=this['account']['id'];}_0x300b10[_[_0x17ac('0x26')](this[_0x17ac('0x1c')])+_0x17ac('0x28')]=this[_0x17ac('0x12')]['id'];var _0x1db32d=this[_0x17ac('0x12')];if(rpc[this[_0x17ac('0x1c')]+_0x17ac('0x29')]){if(this[_0x17ac('0x1c')]==='mail'){_0x300b10[_0x17ac('0x2a')]=this[_0x17ac('0x1a')][_0x17ac('0x2b')];_0x300b10['html']=_0x17ac('0x2c')+_[_0x17ac('0x2d')](_0x300b10['body'],_0x17ac('0x2e'),_0x17ac('0x2f'))+_0x17ac('0x30');_0x300b10[_0x17ac('0x31')]={'Auto-Submitted':_0x17ac('0x32'),'X-Auto-Response-Suppress':_0x17ac('0x33'),'Precedence':_0x17ac('0x34')};return mailRpc['sendMailMessage'](this[_0x17ac('0x25')]['smtpOptions'],_0x300b10)[_0x17ac('0x35')](function(_0x18438a){logger[_0x17ac('0x14')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1d113d);_0x300b10['messageId']=_0x18438a[_0x17ac('0x1a')][_0x17ac('0x2b')];return rpc[_0x39b8cf+_0x17ac('0x29')][_0x17ac('0x36')](_0x300b10);})[_0x17ac('0x35')](function(_0x41e5c5){logger[_0x17ac('0x14')](_0x17ac('0xf'),_0x1d113d,JSON[_0x17ac('0x37')](_0x41e5c5));})[_0x17ac('0x38')](function(_0x141546){logger[_0x17ac('0x39')](_0x17ac('0x3a'),_0x1d113d,JSON[_0x17ac('0x37')](_0x141546));})[_0x17ac('0x3b')](function(){Promise[_0x17ac('0x3c')]()[_0x17ac('0x35')](function(){if(_0x5c6878[0x0]!=='2'||_0x1db32d[_0x17ac('0x3d')])return;return rpc[_0x39b8cf+'Interaction']['update'](_0x1db32d['id'],{'autoreplyExecuted':!![]})[_0x17ac('0x35')](function(_0x9b1f08){logger[_0x17ac('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1d113d,JSON[_0x17ac('0x37')](_0x9b1f08));})['catch'](function(_0x12266f){logger[_0x17ac('0x39')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1d113d,JSON[_0x17ac('0x37')](_0x12266f));});})['then'](function(){_0x36302f['next']();});});}else{return rpc[this['channel']+'Message']['create'](_0x300b10)['then'](function(){logger[_0x17ac('0x14')]('[%s][AUTOREPLY]\x20%s',_0x1d113d,_0x300b10[_0x17ac('0xd')]);})['catch'](function(_0x40d866){logger[_0x17ac('0x39')]('[%s][AUTOREPLY]\x20%s',_0x1d113d,JSON[_0x17ac('0x37')](_0x40d866));})[_0x17ac('0x3b')](function(){Promise[_0x17ac('0x3c')]()[_0x17ac('0x35')](function(){if(_0x5c6878[0x0]!=='2'||_0x1db32d[_0x17ac('0x3d')])return;return rpc[_0x39b8cf+'Interaction'][_0x17ac('0x3e')](_0x1db32d['id'],{'autoreplyExecuted':!![]})[_0x17ac('0x35')](function(_0x14e150){logger[_0x17ac('0x14')](_0x17ac('0x3f'),_0x1d113d,JSON[_0x17ac('0x37')](_0x14e150));})[_0x17ac('0x38')](function(_0x5ca82d){logger[_0x17ac('0x39')](_0x17ac('0x40'),_0x1d113d,JSON[_0x17ac('0x37')](_0x5ca82d));});})[_0x17ac('0x35')](function(){_0x36302f[_0x17ac('0x10')]();});});}}}catch(_0x29536d){logger[_0x17ac('0x39')]('[%s][AUTOREPLY]\x20%s',_0x1d113d,JSON['stringify'](_0x29536d));_0x36302f[_0x17ac('0x41')]();}};}; \ No newline at end of file +var _0x702a=['','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','catch','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','channel','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','AccountId','account','InteractionId','Message','inReplyTo','',']+(>|$)/g,''),'priorityTrue':_0x424faf[0x1],'priorityFalse':_0x424faf[0x2]};var _0x24a226=gotoif[_0x4b12('0x0')](_0x27a57d,{'typecast':!![]});if(_0x24a226[_0x4b12('0xb')]){logger[_0x4b12('0xc')]('[%s][GOTOIF]\x20%s',_0xb6e8b6,_['map'](_0x24a226,_0x4b12('0xd'))[_0x4b12('0xe')](',\x20'));_0x1ced57[_0x4b12('0xf')]();}else{try{var _0x4e2792=eval('('+_0x27a57d['condition']+')');var _0x3eb3b7=_0x4e2792?_0x27a57d[_0x4b12('0x10')]:_0x27a57d[_0x4b12('0x11')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xb6e8b6,_0x27a57d[_0x4b12('0x12')],_0x4e2792,_0x3eb3b7||_0x4b12('0x13'));if(_0x3eb3b7){var _0x10b9a8=_[_0x4b12('0x14')](_0x1ced57[_0x4b12('0x15')](),{'p':_0x3eb3b7});if(_0x10b9a8>=0x0){logger['info'](_0x4b12('0x16'),_0xb6e8b6,_0x3eb3b7||_0x4b12('0x13'),_0x10b9a8);_0x1ced57['next'](_0x10b9a8);}else{logger[_0x4b12('0x17')](_0x4b12('0x18'),_0xb6e8b6,_0x3eb3b7||_0x4b12('0x13'));_0x1ced57[_0x4b12('0xf')]();}}else{_0x1ced57[_0x4b12('0x13')]();}}catch(_0x931ea9){logger[_0x4b12('0xc')](_0x4b12('0x19'),_0xb6e8b6,_0x931ea9[_0x4b12('0xd')]);_0x1ced57[_0x4b12('0xf')]();}}}catch(_0x506b47){logger[_0x4b12('0xc')](_0x4b12('0x1a'),_0xb6e8b6,JSON[_0x4b12('0x1b')](_0x506b47));_0x1ced57[_0x4b12('0xf')]();}};}; \ No newline at end of file +var _0x5e16=['stringify','validate','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5e16,0x187));var _0x65e1=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x5e16[_0xabbd2f];return _0x34a040;};'use strict';var schema=require(_0x65e1('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x65e1('0x1'));var logger=require('../../../../config/logger')(_0x65e1('0x2'));var gotoif=schema({'condition':{'type':_0x65e1('0x3'),'required':!![],'message':_0x65e1('0x4')},'priorityTrue':{'type':_0x65e1('0x5'),'message':_0x65e1('0x6')},'priorityFalse':{'type':'number','message':_0x65e1('0x7')}});exports['consequence']=function(_0x38caf7,_0xc8c80a){return function(_0x59ccb3){try{var _0x5123cb={'condition':htmlToText[_0x65e1('0x8')](utils[_0x65e1('0x9')](_0xc8c80a[0x0],this),{'wordwrap':![]})[_0x65e1('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xc8c80a[0x1],'priorityFalse':_0xc8c80a[0x2]};var _0x2acfed=gotoif[_0x65e1('0x0')](_0x5123cb,{'typecast':!![]});if(_0x2acfed[_0x65e1('0xb')]){logger['error'](_0x65e1('0xc'),_0x38caf7,_[_0x65e1('0xd')](_0x2acfed,'message')[_0x65e1('0xe')](',\x20'));_0x59ccb3[_0x65e1('0xf')]();}else{try{var _0x151723=eval('('+_0x5123cb[_0x65e1('0x10')]+')');var _0xd9387=_0x151723?_0x5123cb[_0x65e1('0x11')]:_0x5123cb[_0x65e1('0x12')];logger[_0x65e1('0x13')](_0x65e1('0x14'),_0x38caf7,_0x5123cb['condition'],_0x151723,_0xd9387||_0x65e1('0x15'));if(_0xd9387){var _0x1a192f=_[_0x65e1('0x16')](_0x59ccb3[_0x65e1('0x17')](),{'p':_0xd9387});if(_0x1a192f>=0x0){logger['info'](_0x65e1('0x18'),_0x38caf7,_0xd9387||_0x65e1('0x15'),_0x1a192f);_0x59ccb3[_0x65e1('0x15')](_0x1a192f);}else{logger[_0x65e1('0x13')](_0x65e1('0x19'),_0x38caf7,_0xd9387||'next');_0x59ccb3[_0x65e1('0xf')]();}}else{_0x59ccb3[_0x65e1('0x15')]();}}catch(_0x48362f){logger[_0x65e1('0x1a')](_0x65e1('0x1b'),_0x38caf7,_0x48362f[_0x65e1('0x1c')]);_0x59ccb3[_0x65e1('0xf')]();}}}catch(_0x8eb8a8){logger[_0x65e1('0x1a')](_0x65e1('0xc'),_0x38caf7,JSON[_0x65e1('0x1d')](_0x8eb8a8));_0x59ccb3[_0x65e1('0xf')]();}};}; \ 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 ce37d69..8b79fab 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 _0x1cdc=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','lodash','../../../../config/logger'];(function(_0x53ec76,_0x394d0d){var _0x3919e4=function(_0x1b58ae){while(--_0x1b58ae){_0x53ec76['push'](_0x53ec76['shift']());}};_0x3919e4(++_0x394d0d);}(_0x1cdc,0x8a));var _0xc1cd=function(_0x3ebe5b,_0x2aafb0){_0x3ebe5b=_0x3ebe5b-0x0;var _0x49b9ad=_0x1cdc[_0x3ebe5b];return _0x49b9ad;};'use strict';var schema=require('validate');var _=require(_0xc1cd('0x0'));var logger=require(_0xc1cd('0x1'))(_0xc1cd('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xc1cd('0x3')}});exports['consequence']=function(_0x34f96,_0x4cf0bb){return function(_0xa61fb4){try{var _0x27d961={'priority':_0x4cf0bb[0x0]};var _0xfad3a8=gotop[_0xc1cd('0x4')](_0x27d961,{'typecast':!![]});if(_0xfad3a8[_0xc1cd('0x5')]){logger[_0xc1cd('0x6')]('[%s][GOTOP]\x20%s',_0x34f96,_[_0xc1cd('0x7')](_0xfad3a8,_0xc1cd('0x8'))[_0xc1cd('0x9')](',\x20'));_0xa61fb4[_0xc1cd('0xa')]();}else{logger[_0xc1cd('0xb')](_0xc1cd('0xc'),_0x34f96,_0x27d961[_0xc1cd('0xd')]);if(_0x27d961['priority']){var _0x128d8d=_[_0xc1cd('0xe')](_0xa61fb4[_0xc1cd('0xf')](),{'p':_0x27d961[_0xc1cd('0xd')]});if(_0x128d8d>=0x0){logger[_0xc1cd('0xb')](_0xc1cd('0x10'),_0x34f96,_0x27d961[_0xc1cd('0xd')]||_0xc1cd('0x11'),_0x128d8d);_0xa61fb4[_0xc1cd('0x11')](_0x128d8d);}else{logger['info'](_0xc1cd('0x12'),_0x34f96,_0x27d961[_0xc1cd('0xd')]||_0xc1cd('0x11'));_0xa61fb4[_0xc1cd('0xa')]();}}else{_0xa61fb4[_0xc1cd('0x11')]();}}}catch(_0x3c4cbb){logger[_0xc1cd('0x6')](_0xc1cd('0x13'),_0x34f96,JSON['stringify'](_0x3c4cbb));_0xa61fb4['stop']();}};}; \ No newline at end of file +var _0x87d2=['info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','join','stop'];(function(_0x4dff9a,_0x28fe12){var _0x469c33=function(_0x99b0a){while(--_0x99b0a){_0x4dff9a['push'](_0x4dff9a['shift']());}};_0x469c33(++_0x28fe12);}(_0x87d2,0x150));var _0x287d=function(_0xf659b9,_0x4e686f){_0xf659b9=_0xf659b9-0x0;var _0x554601=_0x87d2[_0xf659b9];return _0x554601;};'use strict';var schema=require(_0x287d('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x287d('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x287d('0x2')}});exports[_0x287d('0x3')]=function(_0x225f83,_0x2f9f9f){return function(_0x518825){try{var _0x2ff341={'priority':_0x2f9f9f[0x0]};var _0x29e548=gotop[_0x287d('0x0')](_0x2ff341,{'typecast':!![]});if(_0x29e548['length']){logger[_0x287d('0x4')](_0x287d('0x5'),_0x225f83,_[_0x287d('0x6')](_0x29e548,'message')[_0x287d('0x7')](',\x20'));_0x518825[_0x287d('0x8')]();}else{logger[_0x287d('0x9')](_0x287d('0xa'),_0x225f83,_0x2ff341[_0x287d('0xb')]);if(_0x2ff341[_0x287d('0xb')]){var _0x2d7285=_['findIndex'](_0x518825[_0x287d('0xc')](),{'p':_0x2ff341[_0x287d('0xb')]});if(_0x2d7285>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x225f83,_0x2ff341[_0x287d('0xb')]||_0x287d('0xd'),_0x2d7285);_0x518825[_0x287d('0xd')](_0x2d7285);}else{logger[_0x287d('0x9')](_0x287d('0xe'),_0x225f83,_0x2ff341[_0x287d('0xb')]||_0x287d('0xd'));_0x518825[_0x287d('0x8')]();}}else{_0x518825[_0x287d('0xd')]();}}}catch(_0x5e1c37){logger['error']('[%s][GOTOP]\x20%s',_0x225f83,JSON['stringify'](_0x5e1c37));_0x518825[_0x287d('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 f4f8ae2..95d27d1 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 _0xdca3=['lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0xdca3,0x64));var _0x3dca=function(_0x465206,_0x5a0fbc){_0x465206=_0x465206-0x0;var _0xfebf11=_0xdca3[_0x465206];return _0xfebf11;};'use strict';var _=require(_0x3dca('0x0'));var utils=require('./utils');var logger=require(_0x3dca('0x1'))(_0x3dca('0x2'));var rpc={'chatMessage':require(_0x3dca('0x3')),'openchannelMessage':require(_0x3dca('0x4')),'mailMessage':require(_0x3dca('0x5')),'smsMessage':require(_0x3dca('0x6')),'faxMessage':require(_0x3dca('0x7')),'whatsappMessage':require(_0x3dca('0x8'))};exports[_0x3dca('0x9')]=function(_0x10c46f,_0x3e2811){return function(_0x5cfa9a){try{var _0x4234a1={'body':utils['getMustacheRender'](_0x3e2811[0x0],this),'ContactId':this['contact']['id']};if(this[_0x3dca('0xa')]==='chat'){_0x4234a1[_0x3dca('0xb')]=this[_0x3dca('0xc')]['id'];}else{_0x4234a1[_[_0x3dca('0xd')](this[_0x3dca('0xa')])+'AccountId']=this[_0x3dca('0xc')]['id'];}_0x4234a1[_[_0x3dca('0xd')](this[_0x3dca('0xa')])+_0x3dca('0xe')]=this[_0x3dca('0xf')]['id'];if(rpc[this[_0x3dca('0xa')]+'Message']){return rpc[this[_0x3dca('0xa')]+'Message']['create'](_0x4234a1)[_0x3dca('0x10')](function(_0x11f54e){logger[_0x3dca('0x11')](_0x3dca('0x12'),_0x10c46f,_0x4234a1[_0x3dca('0x13')]);_0x5cfa9a[_0x3dca('0x14')]();})[_0x3dca('0x15')](function(_0xf1350d){logger[_0x3dca('0x16')](_0x3dca('0x12'),_0x10c46f,JSON[_0x3dca('0x17')](_0xf1350d));_0x5cfa9a[_0x3dca('0x18')]();});}}catch(_0x1b5906){logger['error']('[%s][MESSAGE]\x20%s',_0x10c46f,JSON[_0x3dca('0x17')](_0x1b5906));_0x5cfa9a[_0x3dca('0x18')]();}};}; \ No newline at end of file +var _0x0be2=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','stringify','stop','../../../../config/logger'];(function(_0x54c8bd,_0x32bba4){var _0xd36153=function(_0x1e7e24){while(--_0x1e7e24){_0x54c8bd['push'](_0x54c8bd['shift']());}};_0xd36153(++_0x32bba4);}(_0x0be2,0x8f));var _0x20be=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x0be2[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x20be('0x0'))(_0x20be('0x1'));var rpc={'chatMessage':require(_0x20be('0x2')),'openchannelMessage':require(_0x20be('0x3')),'mailMessage':require(_0x20be('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x20be('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x20be('0x6')]=function(_0x1479a2,_0x14f8c2){return function(_0x2c5262){try{var _0x494951={'body':utils[_0x20be('0x7')](_0x14f8c2[0x0],this),'ContactId':this[_0x20be('0x8')]['id']};if(this[_0x20be('0x9')]===_0x20be('0xa')){_0x494951['ChatWebsiteId']=this[_0x20be('0xb')]['id'];}else{_0x494951[_[_0x20be('0xc')](this['channel'])+_0x20be('0xd')]=this['account']['id'];}_0x494951[_[_0x20be('0xc')](this[_0x20be('0x9')])+_0x20be('0xe')]=this[_0x20be('0xf')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x20be('0x9')]+_0x20be('0x10')][_0x20be('0x11')](_0x494951)['then'](function(_0x3f1022){logger[_0x20be('0x12')](_0x20be('0x13'),_0x1479a2,_0x494951[_0x20be('0x14')]);_0x2c5262[_0x20be('0x15')]();})['catch'](function(_0x87210b){logger['error'](_0x20be('0x13'),_0x1479a2,JSON[_0x20be('0x16')](_0x87210b));_0x2c5262[_0x20be('0x17')]();});}}catch(_0x499c28){logger['error']('[%s][MESSAGE]\x20%s',_0x1479a2,JSON[_0x20be('0x16')](_0x499c28));_0x2c5262[_0x20be('0x17')]();}};}; \ 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 6b0c40c..087cddc 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 _0x9199=['[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','consequence','info','getMustacheRender','next'];(function(_0x3f4143,_0x55751c){var _0x4987ca=function(_0x5d6269){while(--_0x5d6269){_0x3f4143['push'](_0x3f4143['shift']());}};_0x4987ca(++_0x55751c);}(_0x9199,0x1e9));var _0x9919=function(_0x4c00a3,_0x2d23e2){_0x4c00a3=_0x4c00a3-0x0;var _0x893854=_0x9199[_0x4c00a3];return _0x893854;};'use strict';var utils=require(_0x9919('0x0'));var logger=require(_0x9919('0x1'))('routing');exports[_0x9919('0x2')]=function(_0x5d5f62,_0x4166ef){return function(_0xd57aaf){try{logger[_0x9919('0x3')]('[%s][NOOP]\x20%s',_0x5d5f62,utils[_0x9919('0x4')](_0x4166ef[0x0],this));_0xd57aaf[_0x9919('0x5')]();}catch(_0x20a056){logger['error'](_0x9919('0x6'),_0x5d5f62,JSON[_0x9919('0x7')](_0x20a056));_0xd57aaf[_0x9919('0x8')]();}};}; \ No newline at end of file +var _0xe975=['stringify','stop','routing','info','getMustacheRender','next','error','[%s][NOOP]\x20%s'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xe975,0x12a));var _0x5e97=function(_0x4025b4,_0x24acdf){_0x4025b4=_0x4025b4-0x0;var _0x5dcf38=_0xe975[_0x4025b4];return _0x5dcf38;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5e97('0x0'));exports['consequence']=function(_0x10e548,_0x57c3ea){return function(_0x495bca){try{logger[_0x5e97('0x1')]('[%s][NOOP]\x20%s',_0x10e548,utils[_0x5e97('0x2')](_0x57c3ea[0x0],this));_0x495bca[_0x5e97('0x3')]();}catch(_0x2f0abc){logger[_0x5e97('0x4')](_0x5e97('0x5'),_0x10e548,JSON[_0x5e97('0x6')](_0x2f0abc));_0x495bca[_0x5e97('0x7')]();}};}; \ 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 312bc06..5dcb647 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 _0x95f8=['util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','socket.io-emitter','account','queue','emit','queue_id','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','map','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stop','[%s][QUEUE]\x20%s','stack','validate'];(function(_0x10c480,_0x350480){var _0x446021=function(_0x994bcf){while(--_0x994bcf){_0x10c480['push'](_0x10c480['shift']());}};_0x446021(++_0x350480);}(_0x95f8,0x1a9));var _0x895f=function(_0x2f8000,_0x37c02b){_0x2f8000=_0x2f8000-0x0;var _0x25cfee=_0x95f8[_0x2f8000];return _0x25cfee;};'use strict';var schema=require(_0x895f('0x0'));var _=require('lodash');var util=require(_0x895f('0x1'));var seqqueue=require(_0x895f('0x2'));var moment=require(_0x895f('0x3'));var Redis=require(_0x895f('0x4'));var config=require(_0x895f('0x5'));var logger=require('../../../../config/logger')(_0x895f('0x6'));var strategy=require(_0x895f('0x7'));config[_0x895f('0x8')]=_[_0x895f('0x9')](config[_0x895f('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x895f('0xa'))(new Redis(config[_0x895f('0x8')]));var attributes=['id','queue_id',_0x895f('0xb'),_0x895f('0xc'),'from','joinAt'];function emit(_0x3b2ed0,_0x581096,_0x1019ae){io['to'](_0x3b2ed0)[_0x895f('0xd')](_0x581096,_0x1019ae);}function emitChannelQueueInteraction(_0x3bb9f5,_0x1f9b58,_0x1c7f8b,_0x1f37b9,_0x2d5a62,_0x35a761,_0x390a38,_0x29643e){var _0x1ef430=_['clone'](_0x1c7f8b);_0x1ef430[_0x895f('0xe')]=_0x29643e;_0x1ef430[_0x895f('0xc')]=_0x1f9b58;_0x1ef430[_0x895f('0xb')]=_0x1f37b9;_0x1ef430['id']=_0x2d5a62;if(_0x35a761){_0x390a38[util[_0x895f('0xf')](_0x895f('0x10'),_0x3bb9f5)][_0x2d5a62]=_[_0x895f('0x11')](_0x1ef430,attributes);}else{delete _0x390a38[util['format']('%sQueuesWaitingInteractions',_0x3bb9f5)][_0x2d5a62];}emit(util[_0x895f('0xf')]('%s:queue:%s',_0x3bb9f5,_0x1f9b58),util[_0x895f('0xf')](_0x895f('0x12'),_0x3bb9f5,_0x35a761?_0x895f('0x13'):_0x895f('0x14')),_['pick'](_0x1ef430,attributes));}var rpc={'openchannelQueueReport':require(_0x895f('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x895f('0x16'))};var queue=schema({'name':{'type':_0x895f('0x17'),'required':!![],'message':_0x895f('0x18')},'timeout':{'type':_0x895f('0x19'),'message':_0x895f('0x1a')}});function startRouting(_0x2d7d7b,_0x214e05,_0x2d317a,_0x184652){if(_0x2d7d7b&&_0x214e05&&_0x2d317a){_0x214e05[_0x895f('0x1b')]+=0x1;var _0xcb0392={'uniqueid':_0x2d7d7b,'from':_0x2d317a['body']?_0x2d317a[_0x895f('0x1c')]['from']:'','joinAt':moment()[_0x895f('0xf')](_0x895f('0x1d')),'ContactId':_0x2d317a[_0x895f('0x1e')]?_0x2d317a[_0x895f('0x1e')]['id']:null,'ListId':_0x2d317a['list']?_0x2d317a[_0x895f('0x1f')]['id']:null};_0xcb0392[_[_0x895f('0x20')](_0x2d317a[_0x895f('0x21')])+_0x895f('0x22')]=_0x214e05['id']||null;_0xcb0392[_[_0x895f('0x20')](_0x2d317a[_0x895f('0x21')])+_0x895f('0x23')]=_0x2d317a[_0x895f('0x24')]?_0x2d317a['interaction']['id']:null;_0xcb0392[_[_0x895f('0x20')](_0x2d317a['channel'])+_0x895f('0x25')]=_0x2d317a[_0x895f('0x26')]?_0x2d317a['message']['id']:null;_0xcb0392[_[_0x895f('0x20')](_0x2d317a[_0x895f('0x21')])+(_0x2d317a['channel']!==_0x895f('0x27')?'AccountId':_0x895f('0x28'))]=_0x2d317a[_0x895f('0xb')]?_0x2d317a[_0x895f('0xb')]['id']:null;logger[_0x895f('0x29')](util[_0x895f('0xf')](_0x895f('0x2a'),_0x2d7d7b,_0x214e05[_0x895f('0x2b')]));emitChannelQueueInteraction(_0x2d317a['channel'],_0x214e05[_0x895f('0x2b')],_0xcb0392,_0x2d317a[_0x895f('0xb')]['name'],_0x2d317a[_0x895f('0x26')]['id'],!![],_0x184652,_0x214e05['id']);if(rpc[_0x2d317a[_0x895f('0x21')]+_0x895f('0x2c')]){return rpc[_0x2d317a[_0x895f('0x21')]+'QueueReport'][_0x895f('0x2d')](_0xcb0392)[_0x895f('0x2e')](function(_0x550849){logger[_0x895f('0x2f')]('create\x20queue\x20report');});}}}function stopRouting(_0x2a8ab3,_0x33ac8d,_0x29e81e,_0xc67066){if(_0x2a8ab3&&_0x33ac8d){_0x33ac8d[_0x895f('0x1b')]-=0x1;var _0x2c38b4={'leaveAt':moment()[_0x895f('0xf')](_0x895f('0x1d')),'acceptAt':moment()[_0x895f('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x895f('0x30')};logger[_0x895f('0x29')](util[_0x895f('0xf')](_0x895f('0x31'),_0x2a8ab3,_0x33ac8d[_0x895f('0x2b')]));emitChannelQueueInteraction(_0x29e81e[_0x895f('0x21')],_0x33ac8d['name'],_0x29e81e[_0x895f('0x1c')],_0x29e81e[_0x895f('0xb')][_0x895f('0x2b')],_0x29e81e[_0x895f('0x26')]['id'],![],_0xc67066,_0x33ac8d['id']);if(rpc[_0x29e81e['channel']+_0x895f('0x2c')]){return rpc[_0x29e81e[_0x895f('0x21')]+_0x895f('0x2c')][_0x895f('0x32')](_0x2a8ab3,_0x2c38b4)[_0x895f('0x2e')](function(_0x4446a8){logger[_0x895f('0x2f')](_0x895f('0x33'));});}}}function endRouting(_0x1d86f1,_0x4b86a7,_0x4db2e0,_0x3cab0e){if(_0x1d86f1&&_0x4b86a7){_0x4b86a7[_0x895f('0x1b')]-=0x1;var _0x5c6aea={'leaveAt':moment()[_0x895f('0xf')](_0x895f('0x1d')),'exitAt':moment()[_0x895f('0xf')](_0x895f('0x1d')),'reason':_0x895f('0x34')};logger[_0x895f('0x29')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x1d86f1,_0x4b86a7['name']));emitChannelQueueInteraction(_0x4db2e0[_0x895f('0x21')],_0x4b86a7[_0x895f('0x2b')],_0x4db2e0[_0x895f('0x1c')],_0x4db2e0[_0x895f('0xb')]['name'],_0x4db2e0[_0x895f('0x26')]['id'],![],_0x3cab0e);if(rpc[_0x4db2e0[_0x895f('0x21')]+_0x895f('0x2c')]){return rpc[_0x4db2e0[_0x895f('0x21')]+_0x895f('0x2c')][_0x895f('0x32')](_0x1d86f1,_0x5c6aea)['catch'](function(_0xf5aa3f){logger['error'](_0x895f('0x33'));});}}}function handleFindQueue(_0x2fc781){return function(_0x199ea0){return _0x199ea0[_0x895f('0x2b')][_0x895f('0x35')]()===_0x2fc781[_0x895f('0x35')]();};}exports['consequence']=function(_0x5bef05,_0x47cbdb,_0x3dd8df,_0x4b0f58){return function(_0x12bc8e){try{var _0x67e9b7={'name':_0x47cbdb[0x0],'timeout':_0x47cbdb[0x1]};var _0x23600f=queue['validate'](_0x67e9b7,{'typecast':!![]});if(_0x23600f[_0x895f('0x36')]){logger['error']('[%s][QUEUE]\x20%s',_0x5bef05,_[_0x895f('0x37')](_0x23600f,_0x895f('0x26'))['join'](',\x20'));_0x12bc8e['stop']();}else{var _0x37e5bb=_[_0x895f('0x38')](_0x3dd8df[_0x4b0f58['channel']+'Queues'],handleFindQueue(_0x67e9b7[_0x895f('0x2b')]));if(_0x37e5bb){startRouting(_0x5bef05,_0x37e5bb,_0x4b0f58,_0x3dd8df);var _0xd1f3f3=(_0x37e5bb[_0x895f('0x34')]||0xa)*0x3e8;var _0x4a1cdd=(_0x67e9b7[_0x895f('0x34')]||0x14)*0x3e8;var _0xd7224,_0x595932;if(_0xd1f3f3>_0x4a1cdd){_0x4a1cdd=_0xd1f3f3;}var _0x53b219=seqqueue['createQueue'](_0xd1f3f3);_0x53b219['id']=_0x5bef05;_0x53b219[_0x895f('0x39')]=_0xd1f3f3;_0x53b219[_0x895f('0x3a')]=_0x4a1cdd;_0x53b219[_0x895f('0x21')]=_0x4b0f58[_0x895f('0x21')];_0x3dd8df[_0x895f('0x3b')][_0x5bef05]['on'](_0x895f('0x3c'),function(){logger[_0x895f('0x29')](_0x895f('0x3d'),_0x5bef05);stopRouting(_0x5bef05,_0x37e5bb,_0x4b0f58,_0x3dd8df);clearTimeout(_0xd7224);_0xd7224=undefined;_0x53b219[_0x895f('0x3e')](!![]);if(_0x3dd8df[_0x895f('0x3b')][_0x5bef05]){delete _0x3dd8df['rules'][_0x5bef05];}_0x12bc8e['stop']();});_0x3dd8df[_0x895f('0x3b')][_0x5bef05]['on'](_0x895f('0x3f'),function(){if(_0x3dd8df[_0x895f('0x3b')][_0x5bef05]){delete _0x3dd8df['rules'][_0x5bef05];}});_0xd7224=setTimeout(function(){logger[_0x895f('0x29')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x5bef05);endRouting(_0x5bef05,_0x37e5bb,_0x4b0f58,_0x3dd8df);clearTimeout(_0xd7224);_0x53b219[_0x895f('0x3e')](!![]);_0x12bc8e[_0x895f('0x40')]();},_0x4a1cdd);switch(_0x37e5bb['strategy']){case _0x895f('0x41'):strategy['rrmemory'](_0x53b219,_0x37e5bb,_0x3dd8df,_0x4b0f58);break;default:strategy[_0x895f('0x42')](_0x53b219,_0x37e5bb,_0x3dd8df,_0x4b0f58);}}else{logger[_0x895f('0x2f')](_0x895f('0x43'),_0x5bef05,_0x67e9b7['name']);_0x12bc8e[_0x895f('0x44')]();}}}catch(_0x176e0f){console['log'](_0x176e0f);logger[_0x895f('0x2f')](_0x895f('0x45'),_0x5bef05,_0x176e0f[_0x895f('0x46')]);_0x12bc8e[_0x895f('0x44')]();}};}; \ No newline at end of file +var _0x11f0=['redis','defaults','localhost','socket.io-emitter','queue','joinAt','clone','queue_id','account','format','pick','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','ioredis','../../../../config/environment','../../../../config/logger'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x11f0,0x164));var _0x011f=function(_0x3bbbd7,_0x451624){_0x3bbbd7=_0x3bbbd7-0x0;var _0x2716e4=_0x11f0[_0x3bbbd7];return _0x2716e4;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x011f('0x0'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x011f('0x1'));var config=require(_0x011f('0x2'));var logger=require(_0x011f('0x3'))('routing');var strategy=require('./strategy');config[_0x011f('0x4')]=_[_0x011f('0x5')](config['redis'],{'host':_0x011f('0x6'),'port':0x18eb});var io=require(_0x011f('0x7'))(new Redis(config[_0x011f('0x4')]));var attributes=['id','queue_id','account',_0x011f('0x8'),'from',_0x011f('0x9')];function emit(_0x3a3dce,_0x5a8fb3,_0x4e2d8a){io['to'](_0x3a3dce)['emit'](_0x5a8fb3,_0x4e2d8a);}function emitChannelQueueInteraction(_0x440a4c,_0x44b815,_0x5c410d,_0x4c389c,_0x513a61,_0x138d14,_0x398e0d,_0x41175d){var _0x7b110c=_[_0x011f('0xa')](_0x5c410d);_0x7b110c[_0x011f('0xb')]=_0x41175d;_0x7b110c['queue']=_0x44b815;_0x7b110c[_0x011f('0xc')]=_0x4c389c;_0x7b110c['id']=_0x513a61;if(_0x138d14){_0x398e0d[util[_0x011f('0xd')]('%sQueuesWaitingInteractions',_0x440a4c)][_0x513a61]=_[_0x011f('0xe')](_0x7b110c,attributes);}else{delete _0x398e0d[util[_0x011f('0xd')]('%sQueuesWaitingInteractions',_0x440a4c)][_0x513a61];}emit(util['format'](_0x011f('0xf'),_0x440a4c,_0x44b815),util[_0x011f('0xd')]('%s_queue_waiting_interaction:%s',_0x440a4c,_0x138d14?_0x011f('0x10'):_0x011f('0x11')),_['pick'](_0x7b110c,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x011f('0x12')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x011f('0x13')),'faxQueueReport':require(_0x011f('0x14')),'whatsappQueueReport':require(_0x011f('0x15'))};var queue=schema({'name':{'type':_0x011f('0x16'),'required':!![],'message':_0x011f('0x17')},'timeout':{'type':_0x011f('0x18'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x198a12,_0x54e4ca,_0x4f3114,_0x33e65e){if(_0x198a12&&_0x54e4ca&&_0x4f3114){_0x54e4ca[_0x011f('0x19')]+=0x1;var _0x384e9b={'uniqueid':_0x198a12,'from':_0x4f3114[_0x011f('0x1a')]?_0x4f3114[_0x011f('0x1a')]['from']:'','joinAt':moment()['format'](_0x011f('0x1b')),'ContactId':_0x4f3114[_0x011f('0x1c')]?_0x4f3114[_0x011f('0x1c')]['id']:null,'ListId':_0x4f3114[_0x011f('0x1d')]?_0x4f3114[_0x011f('0x1d')]['id']:null};_0x384e9b[_[_0x011f('0x1e')](_0x4f3114['channel'])+_0x011f('0x1f')]=_0x54e4ca['id']||null;_0x384e9b[_['upperFirst'](_0x4f3114[_0x011f('0x20')])+_0x011f('0x21')]=_0x4f3114[_0x011f('0x22')]?_0x4f3114[_0x011f('0x22')]['id']:null;_0x384e9b[_['upperFirst'](_0x4f3114[_0x011f('0x20')])+_0x011f('0x23')]=_0x4f3114[_0x011f('0x24')]?_0x4f3114[_0x011f('0x24')]['id']:null;_0x384e9b[_[_0x011f('0x1e')](_0x4f3114[_0x011f('0x20')])+(_0x4f3114[_0x011f('0x20')]!==_0x011f('0x25')?'AccountId':_0x011f('0x26'))]=_0x4f3114[_0x011f('0xc')]?_0x4f3114[_0x011f('0xc')]['id']:null;logger[_0x011f('0x27')](util[_0x011f('0xd')](_0x011f('0x28'),_0x198a12,_0x54e4ca[_0x011f('0x29')]));emitChannelQueueInteraction(_0x4f3114[_0x011f('0x20')],_0x54e4ca[_0x011f('0x29')],_0x384e9b,_0x4f3114[_0x011f('0xc')][_0x011f('0x29')],_0x4f3114[_0x011f('0x24')]['id'],!![],_0x33e65e,_0x54e4ca['id']);if(rpc[_0x4f3114[_0x011f('0x20')]+_0x011f('0x2a')]){return rpc[_0x4f3114[_0x011f('0x20')]+_0x011f('0x2a')]['create'](_0x384e9b)[_0x011f('0x2b')](function(_0x2948d3){logger['error'](_0x011f('0x2c'));});}}}function stopRouting(_0x48ba33,_0x3a4632,_0x13fda6,_0x2aedef){if(_0x48ba33&&_0x3a4632){_0x3a4632[_0x011f('0x19')]-=0x1;var _0x4fe9f9={'leaveAt':moment()[_0x011f('0xd')](_0x011f('0x1b')),'acceptAt':moment()[_0x011f('0xd')](_0x011f('0x1b')),'reason':'accepted'};logger['info'](util['format'](_0x011f('0x2d'),_0x48ba33,_0x3a4632[_0x011f('0x29')]));emitChannelQueueInteraction(_0x13fda6[_0x011f('0x20')],_0x3a4632[_0x011f('0x29')],_0x13fda6[_0x011f('0x1a')],_0x13fda6[_0x011f('0xc')][_0x011f('0x29')],_0x13fda6[_0x011f('0x24')]['id'],![],_0x2aedef,_0x3a4632['id']);if(rpc[_0x13fda6['channel']+_0x011f('0x2a')]){return rpc[_0x13fda6[_0x011f('0x20')]+'QueueReport']['update'](_0x48ba33,_0x4fe9f9)[_0x011f('0x2b')](function(_0x1d7e0e){logger[_0x011f('0x2e')](_0x011f('0x2f'));});}}}function endRouting(_0x420efa,_0x204e5e,_0x2a1f08,_0x2e61f4){if(_0x420efa&&_0x204e5e){_0x204e5e[_0x011f('0x19')]-=0x1;var _0xb8c16c={'leaveAt':moment()['format'](_0x011f('0x1b')),'exitAt':moment()[_0x011f('0xd')](_0x011f('0x1b')),'reason':_0x011f('0x30')};logger[_0x011f('0x27')](util[_0x011f('0xd')](_0x011f('0x31'),_0x420efa,_0x204e5e[_0x011f('0x29')]));emitChannelQueueInteraction(_0x2a1f08[_0x011f('0x20')],_0x204e5e['name'],_0x2a1f08[_0x011f('0x1a')],_0x2a1f08[_0x011f('0xc')][_0x011f('0x29')],_0x2a1f08[_0x011f('0x24')]['id'],![],_0x2e61f4);if(rpc[_0x2a1f08['channel']+_0x011f('0x2a')]){return rpc[_0x2a1f08['channel']+_0x011f('0x2a')]['update'](_0x420efa,_0xb8c16c)[_0x011f('0x2b')](function(_0x314780){logger[_0x011f('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x4875ac){return function(_0x17a3d4){return _0x17a3d4[_0x011f('0x29')][_0x011f('0x32')]()===_0x4875ac['toLowerCase']();};}exports[_0x011f('0x33')]=function(_0x1a89be,_0x278905,_0x4dca3f,_0xed06fa){return function(_0x405761){try{var _0x32031a={'name':_0x278905[0x0],'timeout':_0x278905[0x1]};var _0x5a3a3b=queue[_0x011f('0x34')](_0x32031a,{'typecast':!![]});if(_0x5a3a3b[_0x011f('0x35')]){logger[_0x011f('0x2e')](_0x011f('0x36'),_0x1a89be,_[_0x011f('0x37')](_0x5a3a3b,_0x011f('0x24'))[_0x011f('0x38')](',\x20'));_0x405761[_0x011f('0x39')]();}else{var _0x438545=_[_0x011f('0x3a')](_0x4dca3f[_0xed06fa[_0x011f('0x20')]+'Queues'],handleFindQueue(_0x32031a[_0x011f('0x29')]));if(_0x438545){startRouting(_0x1a89be,_0x438545,_0xed06fa,_0x4dca3f);var _0x2de030=(_0x438545[_0x011f('0x30')]||0xa)*0x3e8;var _0x228d71=(_0x32031a[_0x011f('0x30')]||0x14)*0x3e8;var _0x2be916,_0x569ac6;if(_0x2de030>_0x228d71){_0x228d71=_0x2de030;}var _0x5bbe9c=seqqueue['createQueue'](_0x2de030);_0x5bbe9c['id']=_0x1a89be;_0x5bbe9c[_0x011f('0x3b')]=_0x2de030;_0x5bbe9c[_0x011f('0x3c')]=_0x228d71;_0x5bbe9c[_0x011f('0x20')]=_0xed06fa[_0x011f('0x20')];_0x4dca3f[_0x011f('0x3d')][_0x1a89be]['on'](_0x011f('0x3e'),function(){logger[_0x011f('0x27')](_0x011f('0x3f'),_0x1a89be);stopRouting(_0x1a89be,_0x438545,_0xed06fa,_0x4dca3f);clearTimeout(_0x2be916);_0x2be916=undefined;_0x5bbe9c[_0x011f('0x40')](!![]);if(_0x4dca3f['rules'][_0x1a89be]){delete _0x4dca3f[_0x011f('0x3d')][_0x1a89be];}_0x405761[_0x011f('0x39')]();});_0x4dca3f[_0x011f('0x3d')][_0x1a89be]['on'](_0x011f('0x41'),function(){if(_0x4dca3f['rules'][_0x1a89be]){delete _0x4dca3f[_0x011f('0x3d')][_0x1a89be];}});_0x2be916=setTimeout(function(){logger[_0x011f('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x1a89be);endRouting(_0x1a89be,_0x438545,_0xed06fa,_0x4dca3f);clearTimeout(_0x2be916);_0x5bbe9c[_0x011f('0x40')](!![]);_0x405761[_0x011f('0x42')]();},_0x228d71);switch(_0x438545['strategy']){case _0x011f('0x43'):strategy['rrmemory'](_0x5bbe9c,_0x438545,_0x4dca3f,_0xed06fa);break;default:strategy[_0x011f('0x44')](_0x5bbe9c,_0x438545,_0x4dca3f,_0xed06fa);}}else{logger['error'](_0x011f('0x45'),_0x1a89be,_0x32031a['name']);_0x405761[_0x011f('0x39')]();}}}catch(_0x2d9043){console[_0x011f('0x46')](_0x2d9043);logger[_0x011f('0x2e')](_0x011f('0x36'),_0x1a89be,_0x2d9043[_0x011f('0x47')]);_0x405761[_0x011f('0x39')]();}};}; \ 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 c0e3550..672f315 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 _0x19a2=['timeout','drained','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout'];(function(_0x353847,_0x5c84de){var _0x40d8a6=function(_0x221958){while(--_0x221958){_0x353847['push'](_0x353847['shift']());}};_0x40d8a6(++_0x5c84de);}(_0x19a2,0x126));var _0x219a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x19a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x219a('0x0'));var uuid=require(_0x219a('0x1'));var util=require(_0x219a('0x2'));var logger=require('../../../../../config/logger')(_0x219a('0x3'));var Agent=function(_0x6f0d68,_0x5597b7,_0x16f191,_0x5b4cc2){this[_0x219a('0x4')]=uuid['v4']();this[_0x219a('0x5')]=_0x6f0d68;this[_0x219a('0x6')]=_0x5597b7;this[_0x219a('0x7')]=_0x16f191;this[_0x219a('0x3')]=_0x5b4cc2;this[_0x219a('0x5')][_0x219a('0x8')](this[_0x219a('0x9')][_0x219a('0xa')](this),this[_0x219a('0xb')][_0x219a('0xa')](this));this['squeue']['on'](_0x219a('0xc'),this[_0x219a('0xb')][_0x219a('0xa')](this));this[_0x219a('0x5')]['on'](_0x219a('0xd'),this['handleDrained']['bind'](this));};Agent[_0x219a('0xe')]['push']=function(){this['squeue']['push'](this[_0x219a('0x9')][_0x219a('0xa')](this),this['handleTimeout']['bind'](this));};Agent[_0x219a('0xe')][_0x219a('0xf')]=function(){this[_0x219a('0xb')](!![]);};Agent['prototype']['handleRun']=function(){logger[_0x219a('0x10')](_0x219a('0x11'),this[_0x219a('0x5')]['id'],this[_0x219a('0x6')]['id']);if(_['isNil'](this[_0x219a('0x7')][_0x219a('0x12')][this[_0x219a('0x6')]['id']])){logger[_0x219a('0x10')](_0x219a('0x13'),this[_0x219a('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x219a('0x8')][_0x219a('0xa')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x219a('0x14')](this[_0x219a('0x5')]['id'],this[_0x219a('0x7')]['agents'][this[_0x219a('0x6')]['id']],this['squeue'][_0x219a('0x15')],![])){this[_0x219a('0x7')]['agents'][this[_0x219a('0x6')]['id']]['busy']=!![];this[_0x219a('0x7')]['agents'][this['agent']['id']][_0x219a('0x16')]=undefined;util[_0x219a('0x17')](this[_0x219a('0x4')],this[_0x219a('0x5')]['id'],this['realtime']['agents'][this[_0x219a('0x6')]['id']],null,this[_0x219a('0x3')]);util[_0x219a('0x18')](this['squeue']['id'],this[_0x219a('0x7')]['agents'][this[_0x219a('0x6')]['id']],_0x219a('0x19')+(this['routing']['forcedOwnership']?_0x219a('0x1a'):''));}else{logger[_0x219a('0x10')](_0x219a('0x1b'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x219a('0x8')]['bind'](this),0x3e8);}}};Agent[_0x219a('0xe')][_0x219a('0xb')]=function(_0x29d3df){if(_[_0x219a('0x1c')](this[_0x219a('0x7')][_0x219a('0x12')][this[_0x219a('0x6')]['id']])){return logger[_0x219a('0x10')](_0x219a('0x13'),this[_0x219a('0x5')]['id'],this[_0x219a('0x6')]['id']);}else{logger[_0x219a('0x10')](_0x219a('0x1d'),this['squeue']['id'],this[_0x219a('0x6')]['id']);util[_0x219a('0x1e')](this[_0x219a('0x4')],this[_0x219a('0x5')]['id'],this[_0x219a('0x7')][_0x219a('0x12')][this[_0x219a('0x6')]['id']],null,this[_0x219a('0x3')]);this[_0x219a('0x7')][_0x219a('0x12')][this['agent']['id']]['busy']=![];this[_0x219a('0x7')][_0x219a('0x12')][this['agent']['id']][_0x219a('0x16')]=undefined;util[_0x219a('0x18')](this[_0x219a('0x5')]['id'],this[_0x219a('0x7')][_0x219a('0x12')][this[_0x219a('0x6')]['id']],_0x29d3df?_0x219a('0x1f'):_0x219a('0x20'));}if(!_0x29d3df){setTimeout(this[_0x219a('0x8')][_0x219a('0xa')](this),0x3e8);}};function agent(_0x3b11e4,_0x21e8cb,_0x4bf7e1,_0x325ad2){return new Agent(_0x3b11e4,_0x21e8cb,_0x4bf7e1,_0x325ad2);}module[_0x219a('0x21')]=agent; \ No newline at end of file +var _0x83e1=['agent','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','routing','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','notificationId','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','squeue'];(function(_0x119611,_0x13fb78){var _0x2c4c74=function(_0x2665fb){while(--_0x2665fb){_0x119611['push'](_0x119611['shift']());}};_0x2c4c74(++_0x13fb78);}(_0x83e1,0x104));var _0x183e=function(_0x3fa224,_0x5db036){_0x3fa224=_0x3fa224-0x0;var _0x33ae08=_0x83e1[_0x3fa224];return _0x33ae08;};'use strict';var _=require('lodash');var uuid=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var logger=require(_0x183e('0x2'))('routing');var Agent=function(_0x14e79e,_0x2edf91,_0x3e1be6,_0x2d96a7){this['notificationId']=uuid['v4']();this[_0x183e('0x3')]=_0x14e79e;this[_0x183e('0x4')]=_0x2edf91;this['realtime']=_0x3e1be6;this['routing']=_0x2d96a7;this[_0x183e('0x3')]['push'](this[_0x183e('0x5')][_0x183e('0x6')](this),this[_0x183e('0x7')]['bind'](this));this[_0x183e('0x3')]['on'](_0x183e('0x8'),this[_0x183e('0x7')][_0x183e('0x6')](this));this[_0x183e('0x3')]['on'](_0x183e('0x9'),this['handleDrained'][_0x183e('0x6')](this));};Agent[_0x183e('0xa')][_0x183e('0xb')]=function(){this[_0x183e('0x3')][_0x183e('0xb')](this[_0x183e('0x5')][_0x183e('0x6')](this),this[_0x183e('0x7')][_0x183e('0x6')](this));};Agent[_0x183e('0xa')][_0x183e('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x183e('0x5')]=function(){logger[_0x183e('0xd')](_0x183e('0xe'),this[_0x183e('0x3')]['id'],this[_0x183e('0x4')]['id']);if(_[_0x183e('0xf')](this[_0x183e('0x10')]['agents'][this[_0x183e('0x4')]['id']])){logger[_0x183e('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x183e('0x4')]['id']);setTimeout(this[_0x183e('0xb')][_0x183e('0x6')](this),0x3e8);}else{if(this[_0x183e('0x11')][_0x183e('0x12')]||util[_0x183e('0x13')](this['squeue']['id'],this['realtime'][_0x183e('0x14')][this[_0x183e('0x4')]['id']],this['squeue']['channel'],![])){this['realtime'][_0x183e('0x14')][this[_0x183e('0x4')]['id']][_0x183e('0x15')]=!![];this[_0x183e('0x10')][_0x183e('0x14')][this[_0x183e('0x4')]['id']][_0x183e('0x16')]=undefined;util['showNotification'](this[_0x183e('0x17')],this[_0x183e('0x3')]['id'],this[_0x183e('0x10')]['agents'][this['agent']['id']],null,this[_0x183e('0x11')]);util['writeLog'](this[_0x183e('0x3')]['id'],this[_0x183e('0x10')][_0x183e('0x14')][this[_0x183e('0x4')]['id']],_0x183e('0x18')+(this[_0x183e('0x11')][_0x183e('0x12')]?':FORCED':''));}else{logger[_0x183e('0xd')](_0x183e('0x19'),this[_0x183e('0x3')]['id'],this[_0x183e('0x4')]['id']);setTimeout(this[_0x183e('0xb')][_0x183e('0x6')](this),0x3e8);}}};Agent[_0x183e('0xa')]['handleTimeout']=function(_0x132818){if(_[_0x183e('0xf')](this[_0x183e('0x10')][_0x183e('0x14')][this[_0x183e('0x4')]['id']])){return logger[_0x183e('0xd')](_0x183e('0x1a'),this[_0x183e('0x3')]['id'],this['agent']['id']);}else{logger[_0x183e('0xd')](_0x183e('0x1b'),this[_0x183e('0x3')]['id'],this[_0x183e('0x4')]['id']);util[_0x183e('0x1c')](this[_0x183e('0x17')],this['squeue']['id'],this['realtime'][_0x183e('0x14')][this[_0x183e('0x4')]['id']],null,this[_0x183e('0x11')]);this[_0x183e('0x10')][_0x183e('0x14')][this[_0x183e('0x4')]['id']][_0x183e('0x15')]=![];this[_0x183e('0x10')]['agents'][this[_0x183e('0x4')]['id']]['busyQueue']=undefined;util[_0x183e('0x1d')](this[_0x183e('0x3')]['id'],this[_0x183e('0x10')][_0x183e('0x14')][this[_0x183e('0x4')]['id']],_0x132818?_0x183e('0x1e'):_0x183e('0x1f'));}if(!_0x132818){setTimeout(this[_0x183e('0xb')][_0x183e('0x6')](this),0x3e8);}};function agent(_0x34a589,_0x58274c,_0x3d1381,_0x43eb7a){return new Agent(_0x34a589,_0x58274c,_0x3d1381,_0x43eb7a);}module[_0x183e('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 8f36d95..befc2d1 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 _0x0434=['notificationId','squeue','queue','realtime','push','handleTimeout','bind','timeout','drained','prototype','handleDrained','handleRun','isNil','Agents','length','agents','debug','channel','writeLog','busyQueue','name','showNotification','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x3b90ae,_0x2af042){var _0x309e21=function(_0x3e7382){while(--_0x3e7382){_0x3b90ae['push'](_0x3b90ae['shift']());}};_0x309e21(++_0x2af042);}(_0x0434,0x1ad));var _0x4043=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x0434[_0x57db49];return _0xd0636f;};'use strict';var _=require(_0x4043('0x0'));var uuid=require(_0x4043('0x1'));var util=require(_0x4043('0x2'));var logger=require(_0x4043('0x3'))(_0x4043('0x4'));var Beepall=function(_0x56e8f3,_0x4ca779,_0x2e6bdf,_0xfa9ae8){this[_0x4043('0x5')]=uuid['v4']();this[_0x4043('0x6')]=_0x56e8f3;this[_0x4043('0x7')]=_0x4ca779;this[_0x4043('0x8')]=_0x2e6bdf;this['routing']=_0xfa9ae8;this[_0x4043('0x6')][_0x4043('0x9')](this['handleRun']['bind'](this),this[_0x4043('0xa')][_0x4043('0xb')](this));this[_0x4043('0x6')]['on'](_0x4043('0xc'),this[_0x4043('0xa')][_0x4043('0xb')](this));this[_0x4043('0x6')]['on'](_0x4043('0xd'),this['handleDrained'][_0x4043('0xb')](this));};Beepall[_0x4043('0xe')][_0x4043('0x9')]=function(){this[_0x4043('0x6')][_0x4043('0x9')](this['handleRun'][_0x4043('0xb')](this),this[_0x4043('0xa')][_0x4043('0xb')](this));};Beepall[_0x4043('0xe')][_0x4043('0xf')]=function(){this['handleTimeout'](!![]);};Beepall[_0x4043('0xe')][_0x4043('0x10')]=function(){var _0x3d91ee=!![];if(!_[_0x4043('0x11')](this[_0x4043('0x7')])&&!_[_0x4043('0x11')](this[_0x4043('0x7')][_0x4043('0x12')])&&this[_0x4043('0x7')][_0x4043('0x12')][_0x4043('0x13')]>0x0){for(var _0x38aefa=0x0,_0x560602;_0x38aefa0x0){for(var _0xb08628=0x0,_0x5da535;_0xb086280x0&&_0x90eff8[_0x2fbe3b+_0xbd8f('0x24')]>=_0x90eff8[_0x2fbe3b+_0xbd8f('0x25')]){writeLog(_0x24cff5,_0x90eff8,_0x2fbe3b[_0xbd8f('0x26')]()+_0xbd8f('0x27'));return![];}}return!![];};exports[_0xbd8f('0x28')]=function(_0x4ea554,_0x40cb43,_0x421f3e,_0x5a3a8c,_0x339df7){return sendNotification(!![],_0x4ea554,_0x40cb43,_0x421f3e,_0x5a3a8c,_0x339df7);};exports['hideNotification']=function(_0x41b2a6,_0x30d62e,_0x991401,_0x202126,_0x2aefa2){return sendNotification(![],_0x41b2a6,_0x30d62e,_0x991401,_0x202126,_0x2aefa2);};exports[_0xbd8f('0x29')]=writeLog; \ No newline at end of file +var _0xf2ca=['body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','user:%s','emit','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','format','name','user:save','split','account','notificationSound','notificationShake'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x496590,_0x3426e9){_0x496590=_0x496590-0x0;var _0x585ebc=_0xf2ca[_0x496590];return _0x585ebc;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var utils=require(_0xaf2c('0x2'));var Redis=require('ioredis');var config=require(_0xaf2c('0x3'));var logger=require(_0xaf2c('0x4'))(_0xaf2c('0x5'));config[_0xaf2c('0x6')]=_[_0xaf2c('0x7')](config[_0xaf2c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xaf2c('0x8'))(new Redis(config[_0xaf2c('0x6')]));function sendNotification(_0x297740,_0x1f9531,_0x58351f,_0x37fedd,_0x3c0421,_0x4a7397){io['to'](util[_0xaf2c('0x9')]('user:%s',_0x37fedd[_0xaf2c('0xa')]))['emit'](_0xaf2c('0xb'),_0x37fedd);var _0x144a7a=_0x4a7397||{};var _0x2e04e5=_0x58351f[_0xaf2c('0xc')]('.');var _0x5ad9b0={'uniqueid':_0x1f9531,'channel':_0x2e04e5[0x0],'id':_0x2e04e5[0x1],'title':_0x2e04e5[0x0]+'\x20interaction','interactionId':_0x2e04e5[0x2],'queue':_0x3c0421?_0x3c0421[_0xaf2c('0xa')]:null,'sound':_0x144a7a[_0xaf2c('0xd')][_0xaf2c('0xe')],'shake':_0x144a7a[_0xaf2c('0xd')][_0xaf2c('0xf')]};try{if(!_0x144a7a['body']){_0x144a7a['body']={};}if(_0x3c0421){_0x144a7a[_0xaf2c('0x10')][_0xaf2c('0x11')]=_0x3c0421;}else if(_0x144a7a[_0xaf2c('0x10')][_0xaf2c('0x11')]){delete _0x144a7a[_0xaf2c('0x10')][_0xaf2c('0x11')];}_0x5ad9b0[_0xaf2c('0x12')]=utils[_0xaf2c('0x13')](_0x144a7a[_0xaf2c('0xd')][_0xaf2c('0x14')],_0x144a7a);}catch(_0x6ac8e){_0x5ad9b0[_0xaf2c('0x12')]=_0xaf2c('0x15');logger[_0xaf2c('0x16')](util[_0xaf2c('0x9')]('[%s][QUEUE]\x20%s',_0x1f9531,_0x6ac8e[_0xaf2c('0x17')]));}io['to'](util['format'](_0xaf2c('0x18'),_0x37fedd[_0xaf2c('0xa')]))[_0xaf2c('0x19')](util['format'](_0xaf2c('0x1a'),_0x297740?_0xaf2c('0x1b'):_0xaf2c('0x1c')),_0x5ad9b0);}function writeLog(_0x20000b,_0x3f977c,_0x1b7f07){return logger['debug'](util[_0xaf2c('0x9')](_0xaf2c('0x1d'),_0x20000b,_0x3f977c[_0xaf2c('0xa')],_0x1b7f07));}exports[_0xaf2c('0x1e')]=function(_0x237318,_0x486de2,_0x396646,_0xbf6f62){if(_0x486de2[_0xaf2c('0x1f')]){writeLog(_0x237318,_0x486de2,'BUSY');return![];}if(!_0x486de2['online']){writeLog(_0x237318,_0x486de2,_0xaf2c('0x20'));return![];}if(_0x486de2[_0x396646+_0xaf2c('0x21')]){writeLog(_0x237318,_0x486de2,_0xaf2c('0x22'));return![];}if(_0xbf6f62&&_0x486de2[_0xaf2c('0x23')](_0x396646+'Capacity')&&_0x486de2[_0xaf2c('0x23')](_0x396646+_0xaf2c('0x24'))){if(_0x486de2[_0x396646+_0xaf2c('0x25')]>0x0&&_0x486de2[_0x396646+_0xaf2c('0x24')]>=_0x486de2[_0x396646+_0xaf2c('0x25')]){writeLog(_0x237318,_0x486de2,_0x396646[_0xaf2c('0x26')]()+_0xaf2c('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x29f8b0,_0x2051be,_0x36f37c,_0x410536,_0x4b7cf2){return sendNotification(!![],_0x29f8b0,_0x2051be,_0x36f37c,_0x410536,_0x4b7cf2);};exports[_0xaf2c('0x28')]=function(_0x589d47,_0x38db1b,_0x42f980,_0x15466b,_0x5d685a){return sendNotification(![],_0x589d47,_0x38db1b,_0x42f980,_0x15466b,_0x5d685a);};exports[_0xaf2c('0x29')]=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 2e58886..72380bf 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 _0x1111=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','validate','shelljs','lodash','./utils','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info'];(function(_0x5215a0,_0x384c8f){var _0x106fad=function(_0x3292d0){while(--_0x3292d0){_0x5215a0['push'](_0x5215a0['shift']());}};_0x106fad(++_0x384c8f);}(_0x1111,0x195));var _0x1111=function(_0x5382b4,_0x4ec152){_0x5382b4=_0x5382b4-0x0;var _0x294740=_0x1111[_0x5382b4];return _0x294740;};'use strict';var schema=require(_0x1111('0x0'));var sh=require(_0x1111('0x1'));var _=require(_0x1111('0x2'));var utils=require(_0x1111('0x3'));var logger=require('../../../../config/logger')(_0x1111('0x4'));var system=schema({'command':{'type':_0x1111('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1111('0x6')]=function(_0x4abd99,_0x203188){return function(_0x3fb501){try{var _0x753c9d={'command':_0x203188[0x0]};var _0x550a0b=system[_0x1111('0x0')](_0x753c9d,{'typecast':!![]});if(_0x550a0b[_0x1111('0x7')]){logger[_0x1111('0x8')](_0x1111('0x9'),_0x4abd99,_[_0x1111('0xa')](_0x550a0b,_0x1111('0xb'))['join'](',\x20'));logger[_0x1111('0xc')](_0x1111('0xd'),_0x4abd99);_0x3fb501[_0x1111('0xe')]();}else{var _0x3023e8=this;var _0x3cab2f=utils[_0x1111('0xf')](_0x203188[0x0],this);logger[_0x1111('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4abd99,_0x3cab2f);sh['exec'](_[_0x1111('0x10')](_0x3cab2f),function(_0xa56bb6,_0x4d6b0f){logger[_0x1111('0xc')](_0x1111('0x11'),_0x4abd99,_0xa56bb6);if(_0xa56bb6==0x0){var _0x56a984=_0x4d6b0f[_0x1111('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x203188[0x1])||_[_0x1111('0x13')](_0x203188[0x1])){logger[_0x1111('0xc')](_0x1111('0x14'),_0x4abd99);_0x3023e8['body'][_0x203188[0x1]]=_0x56a984;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4abd99,_0x203188[0x1],_0x56a984);_0x3023e8[_0x1111('0x15')][_0x203188[0x1]]=_0x56a984;}}_0x3fb501[_0x1111('0xe')]();});}}catch(_0x2e0871){logger[_0x1111('0x8')](_0x1111('0x9'),_0x4abd99,_['isObject'](_0x2e0871)?JSON['stringify'](_0x2e0871):_0x2e0871);logger[_0x1111('0xc')](_0x1111('0xd'),_0x4abd99);_0x3fb501[_0x1111('0xe')]();}};}; \ No newline at end of file +var _0x014b=['message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','error','map'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x014b,0x7a));var _0xb014=function(_0x133ee3,_0x2ca52f){_0x133ee3=_0x133ee3-0x0;var _0x41c6a0=_0x014b[_0x133ee3];return _0x41c6a0;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xb014('0x0'));var utils=require(_0xb014('0x1'));var logger=require(_0xb014('0x2'))(_0xb014('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xb014('0x4')}});exports['consequence']=function(_0x5d4474,_0x45ff6d){return function(_0x555bae){try{var _0x20dee0={'command':_0x45ff6d[0x0]};var _0x2c631d=system[_0xb014('0x5')](_0x20dee0,{'typecast':!![]});if(_0x2c631d['length']){logger[_0xb014('0x6')]('[%s][SYSTEM]\x20%s',_0x5d4474,_[_0xb014('0x7')](_0x2c631d,_0xb014('0x8'))[_0xb014('0x9')](',\x20'));logger[_0xb014('0xa')](_0xb014('0xb'),_0x5d4474);_0x555bae[_0xb014('0xc')]();}else{var _0x1c20ce=this;var _0x17756b=utils[_0xb014('0xd')](_0x45ff6d[0x0],this);logger[_0xb014('0xa')](_0xb014('0xe'),_0x5d4474,_0x17756b);sh[_0xb014('0xf')](_[_0xb014('0x10')](_0x17756b),function(_0x13448a,_0x198963){logger[_0xb014('0xa')](_0xb014('0x11'),_0x5d4474,_0x13448a);if(_0x13448a==0x0){var _0x165017=_0x198963['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xb014('0x12')](_0x45ff6d[0x1])||_[_0xb014('0x13')](_0x45ff6d[0x1])){logger[_0xb014('0xa')](_0xb014('0x14'),_0x5d4474);_0x1c20ce[_0xb014('0x15')][_0x45ff6d[0x1]]=_0x165017;}else{logger[_0xb014('0xa')](_0xb014('0x16'),_0x5d4474,_0x45ff6d[0x1],_0x165017);_0x1c20ce['body'][_0x45ff6d[0x1]]=_0x165017;}}_0x555bae[_0xb014('0xc')]();});}}catch(_0x3db1da){logger['error'](_0xb014('0x17'),_0x5d4474,_[_0xb014('0x18')](_0x3db1da)?JSON[_0xb014('0x19')](_0x3db1da):_0x3db1da);logger[_0xb014('0xa')](_0xb014('0xb'),_0x5d4474);_0x555bae[_0xb014('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 9b70a58..f258b6d 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 _0x8607=['channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x2f5f7a,_0x1bbd9f){var _0x5f1294=function(_0x599479){while(--_0x599479){_0x2f5f7a['push'](_0x2f5f7a['shift']());}};_0x5f1294(++_0x1bbd9f);}(_0x8607,0x118));var _0x7860=function(_0x4df6bd,_0x30d543){_0x4df6bd=_0x4df6bd-0x0;var _0x322dcb=_0x8607[_0x4df6bd];return _0x322dcb;};'use strict';var schema=require(_0x7860('0x0'));var _=require(_0x7860('0x1'));var rpc={'chatInteraction':require(_0x7860('0x2')),'openchannelInteraction':require(_0x7860('0x3')),'smsInteraction':require(_0x7860('0x4')),'mailInteraction':require(_0x7860('0x5')),'faxInteraction':require(_0x7860('0x6')),'whatsappInteraction':require(_0x7860('0x7'))};var logger=require(_0x7860('0x8'))(_0x7860('0x9'));var tag=schema({'tag':{'type':_0x7860('0xa'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x7860('0xb')]=function(_0x4568e1,_0x100264,_0x3bbe7b,_0x12a925){return function(_0x178122){try{var _0xaf7e5e={'tag':_0x100264[0x0]};var _0x40fb99=tag[_0x7860('0x0')](_0xaf7e5e,{'typecast':!![]});if(_0x40fb99[_0x7860('0xc')]){logger[_0x7860('0xd')](_0x7860('0xe'),_0x4568e1,_[_0x7860('0xf')](_0x40fb99,_0x7860('0x10'))['join'](',\x20'));logger[_0x7860('0x11')](_0x7860('0x12'),_0x4568e1);_0x178122[_0x7860('0x13')]();}else{var _0x349b80={'ids':[_0x100264[0x0]]};if(rpc[_0x12a925[_0x7860('0x14')]+_0x7860('0x15')]){rpc[_0x12a925[_0x7860('0x14')]+_0x7860('0x15')][_0x7860('0x16')](_0x12a925[_0x7860('0x17')]['id'],_0x349b80)[_0x7860('0x18')](function(_0x9c208d){logger[_0x7860('0x11')](_0x7860('0x19'),_0x4568e1,_0x100264[0x1],_0x12a925[_0x7860('0x14')],_0x12a925[_0x7860('0x17')]['id']);})[_0x7860('0x1a')](function(_0x21637c){logger['error'](_0x7860('0xe'),_0x4568e1,JSON[_0x7860('0x1b')](_0x21637c));logger[_0x7860('0x11')](_0x7860('0x12'),_0x4568e1);})[_0x7860('0x1c')](function(){_0x178122[_0x7860('0x13')]();});}}}catch(_0x3aa419){logger['error'](_0x7860('0xe'),_0x4568e1,_[_0x7860('0x1d')](_0x3aa419)?JSON['stringify'](_0x3aa419):_0x3aa419);logger[_0x7860('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4568e1);_0x178122[_0x7860('0x13')]();}};}; \ No newline at end of file +var _0xb6d5=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','next','channel','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../../../config/logger','routing'];(function(_0x35f473,_0x2bf580){var _0x4cdc83=function(_0x4eed30){while(--_0x4eed30){_0x35f473['push'](_0x35f473['shift']());}};_0x4cdc83(++_0x2bf580);}(_0xb6d5,0x125));var _0x5b6d=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0xb6d5[_0x4f6f84];return _0x20d989;};'use strict';var schema=require(_0x5b6d('0x0'));var _=require(_0x5b6d('0x1'));var rpc={'chatInteraction':require(_0x5b6d('0x2')),'openchannelInteraction':require(_0x5b6d('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5b6d('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x5b6d('0x5'))(_0x5b6d('0x6'));var tag=schema({'tag':{'type':_0x5b6d('0x7'),'required':!![],'message':_0x5b6d('0x8')}});exports[_0x5b6d('0x9')]=function(_0x4a38ee,_0x34d0fd,_0x21b630,_0x1fa364){return function(_0x4e8b6f){try{var _0x55f610={'tag':_0x34d0fd[0x0]};var _0x2271e9=tag[_0x5b6d('0x0')](_0x55f610,{'typecast':!![]});if(_0x2271e9[_0x5b6d('0xa')]){logger[_0x5b6d('0xb')]('[%s][TAG]\x20%s',_0x4a38ee,_[_0x5b6d('0xc')](_0x2271e9,_0x5b6d('0xd'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4a38ee);_0x4e8b6f[_0x5b6d('0xe')]();}else{var _0x279ff2={'ids':[_0x34d0fd[0x0]]};if(rpc[_0x1fa364[_0x5b6d('0xf')]+'Interaction']){rpc[_0x1fa364['channel']+'Interaction']['addTags'](_0x1fa364[_0x5b6d('0x10')]['id'],_0x279ff2)[_0x5b6d('0x11')](function(_0x3ddf9a){logger[_0x5b6d('0x12')](_0x5b6d('0x13'),_0x4a38ee,_0x34d0fd[0x1],_0x1fa364[_0x5b6d('0xf')],_0x1fa364[_0x5b6d('0x10')]['id']);})[_0x5b6d('0x14')](function(_0x21607d){logger[_0x5b6d('0xb')](_0x5b6d('0x15'),_0x4a38ee,JSON['stringify'](_0x21607d));logger[_0x5b6d('0x12')](_0x5b6d('0x16'),_0x4a38ee);})[_0x5b6d('0x17')](function(){_0x4e8b6f[_0x5b6d('0xe')]();});}}}catch(_0x431a9a){logger[_0x5b6d('0xb')](_0x5b6d('0x15'),_0x4a38ee,_['isObject'](_0x431a9a)?JSON[_0x5b6d('0x18')](_0x431a9a):_0x431a9a);logger[_0x5b6d('0x12')](_0x5b6d('0x16'),_0x4a38ee);_0x4e8b6f[_0x5b6d('0xe')]();}};}; \ 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 cb7b5b0..e7300a7 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 _0x5068=['Unable\x20to\x20login\x20with\x20TVox\x20application','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','stringify','utf8','POST','application/json-rpc','result','logged'];(function(_0x52a2be,_0x4bd252){var _0x246f1d=function(_0x410395){while(--_0x410395){_0x52a2be['push'](_0x52a2be['shift']());}};_0x246f1d(++_0x4bd252);}(_0x5068,0x140));var _0x8506=function(_0x5b26d8,_0xd18e3e){_0x5b26d8=_0x5b26d8-0x0;var _0x553a6e=_0x5068[_0x5b26d8];return _0x553a6e;};'use strict';var rp=require(_0x8506('0x0'));var logger=require(_0x8506('0x1'))('routing');var _=require(_0x8506('0x2'));var arr=[];exports[_0x8506('0x3')]=function(_0x163124,_0xdc0385){return function(_0x4b4956){var _0x38a854=_0xdc0385[0xa];var _0x4ebf44=_0xdc0385[0xb];var _0x1092b5=_0xdc0385[0xc];var _0x3ffc0a=_0xdc0385[0xd];var _0xfaac73=_0xdc0385[0xe];var _0x3ec493=_0xdc0385[0xf]['replace'](/\n/g,_0x8506('0x4'));var _0x1782c2=_0xdc0385[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x8506('0x5')](_0x4ebf44)){arr[_0x8506('0x6')](_0x4ebf44);var _0x52325c=_0xdc0385[0x3];var _0x30a5fe=_0xdc0385[0x4];var _0x492c5d=_0xdc0385[0x1];var _0x79aa6d=_0xdc0385[0x0];var _0x121e4f={};_0x121e4f[_0x8506('0x7')]=_0xdc0385[0x8]+_0x8506('0x8')+_0x1092b5+'|'+_0x38a854+'|'+_0x3ffc0a+'|'+_0x4ebf44+'|'+_0xfaac73;_0x121e4f[_0x8506('0x9')]=_0xdc0385[0x7]+_0x8506('0x8')+_0x1092b5+'|'+_0x38a854+'|'+_0x3ffc0a+'|'+_0x4ebf44+'|'+_0xfaac73+'|'+_0x3ec493+'|'+_0x1782c2;_0x121e4f[_0x8506('0xa')]=_0xdc0385[0x9];var _0x29c6ab={};_0x29c6ab[_0x8506('0xb')]=_0x8506('0xc');_0x29c6ab[_0x8506('0xd')]=_0x8506('0xe');var _0x2eb5a4=[];_0x2eb5a4[_0x8506('0x6')](_0xdc0385[0x2]);_0x2eb5a4['push'](_0xdc0385[0x5]);_0x2eb5a4[_0x8506('0x6')](_0xdc0385[0x6]);_0x29c6ab['params']=_0x2eb5a4;_0x29c6ab['id']=0x1;var _0x3bd4de=JSON[_0x8506('0xf')](_0x29c6ab);var _0x11e859={'encoding':_0x8506('0x10'),'method':_0x8506('0x11'),'timeout':0x2710,'url':_0x52325c,'headers':{'Content-Type':_0x8506('0x12')},'body':_0x3bd4de};return rp(_0x11e859)['then'](function(_0xa1a33a){const _0x34afb2=JSON['parse'](_0xa1a33a);if(!_0x34afb2[_0x8506('0x13')][_0x8506('0x14')]){throw new Error(_0x8506('0x15'));}var _0x106199=_0x4ebf44;var _0x435276='channelId='+_0x492c5d+'&serviceId='+_0x79aa6d+'&sessionId='+_0x106199+'&data='+JSON[_0x8506('0xf')](_0x121e4f);var _0x666ed6=_0x30a5fe+'?'+_0x435276;return rp(_0x666ed6);})[_0x8506('0x16')](function(_0x24cb01){logger['info'](_0x8506('0x17'),_0x163124,_0x24cb01);_0x4b4956[_0x8506('0x18')]();})['catch'](function(_0x42e728){logger[_0x8506('0x19')](_0x8506('0x1a'),_0x163124,_[_0x8506('0x1b')](_0x42e728)?JSON['stringify'](_0x42e728):_0x42e728);_0x4b4956[_0x8506('0x18')]();});}else{logger[_0x8506('0x1c')](_0x8506('0x1d'),_0x163124);_0x4b4956[_0x8506('0x1e')]();}};}; \ No newline at end of file +var _0x0899=['catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','stringify','application/json-rpc','then','parse','result','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop'];(function(_0x2f4afc,_0x1d0f82){var _0x47490c=function(_0x597cb0){while(--_0x597cb0){_0x2f4afc['push'](_0x2f4afc['shift']());}};_0x47490c(++_0x1d0f82);}(_0x0899,0x1e6));var _0x9089=function(_0x559434,_0x2f9870){_0x559434=_0x559434-0x0;var _0x252834=_0x0899[_0x559434];return _0x252834;};'use strict';var rp=require(_0x9089('0x0'));var logger=require(_0x9089('0x1'))(_0x9089('0x2'));var _=require('lodash');var arr=[];exports[_0x9089('0x3')]=function(_0x3e0cf5,_0x3104e7){return function(_0x93e845){var _0x50d1da=_0x3104e7[0xa];var _0x11aa6e=_0x3104e7[0xb];var _0x40b7cd=_0x3104e7[0xc];var _0x52d59e=_0x3104e7[0xd];var _0x45ca44=_0x3104e7[0xe];var _0x320eb6=_0x3104e7[0xf]['replace'](/\n/g,_0x9089('0x4'));var _0xa8e057=_0x3104e7[0x10][_0x9089('0x5')](/\n/g,'\x20');if(!arr[_0x9089('0x6')](_0x11aa6e)){arr[_0x9089('0x7')](_0x11aa6e);var _0x58e43e=_0x3104e7[0x3];var _0x1b0375=_0x3104e7[0x4];var _0x42bc1b=_0x3104e7[0x1];var _0x3f23bd=_0x3104e7[0x0];var _0x1e08ac={};_0x1e08ac[_0x9089('0x8')]=_0x3104e7[0x8]+_0x9089('0x9')+_0x40b7cd+'|'+_0x50d1da+'|'+_0x52d59e+'|'+_0x11aa6e+'|'+_0x45ca44;_0x1e08ac[_0x9089('0xa')]=_0x3104e7[0x7]+_0x9089('0x9')+_0x40b7cd+'|'+_0x50d1da+'|'+_0x52d59e+'|'+_0x11aa6e+'|'+_0x45ca44+'|'+_0x320eb6+'|'+_0xa8e057;_0x1e08ac[_0x9089('0xb')]=_0x3104e7[0x9];var _0x3feca1={};_0x3feca1[_0x9089('0xc')]=_0x9089('0xd');_0x3feca1[_0x9089('0xe')]=_0x9089('0xf');var _0x3d60ec=[];_0x3d60ec[_0x9089('0x7')](_0x3104e7[0x2]);_0x3d60ec[_0x9089('0x7')](_0x3104e7[0x5]);_0x3d60ec[_0x9089('0x7')](_0x3104e7[0x6]);_0x3feca1['params']=_0x3d60ec;_0x3feca1['id']=0x1;var _0x5e6b0b=JSON[_0x9089('0x10')](_0x3feca1);var _0x22c24f={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x58e43e,'headers':{'Content-Type':_0x9089('0x11')},'body':_0x5e6b0b};return rp(_0x22c24f)[_0x9089('0x12')](function(_0x25ca9){const _0x45b00f=JSON[_0x9089('0x13')](_0x25ca9);if(!_0x45b00f[_0x9089('0x14')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x252e12=_0x11aa6e;var _0x23702d='channelId='+_0x42bc1b+'&serviceId='+_0x3f23bd+_0x9089('0x15')+_0x252e12+_0x9089('0x16')+JSON['stringify'](_0x1e08ac);var _0xd3859a=_0x1b0375+'?'+_0x23702d;return rp(_0xd3859a);})[_0x9089('0x12')](function(_0x386dc5){logger[_0x9089('0x17')](_0x9089('0x18'),_0x3e0cf5,_0x386dc5);_0x93e845[_0x9089('0x19')]();})[_0x9089('0x1a')](function(_0x41371e){logger[_0x9089('0x1b')](_0x9089('0x1c'),_0x3e0cf5,_[_0x9089('0x1d')](_0x41371e)?JSON['stringify'](_0x41371e):_0x41371e);_0x93e845[_0x9089('0x19')]();});}else{logger[_0x9089('0x17')](_0x9089('0x1e'),_0x3e0cf5);_0x93e845[_0x9089('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 87d9dcb..54bb8e1 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x1d41f7,_0x2ea5d7){var _0x5afeb9=function(_0x4cb1cb){while(--_0x4cb1cb){_0x1d41f7['push'](_0x1d41f7['shift']());}};_0x5afeb9(++_0x2ea5d7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x309da1,_0x306e0a){var _0x10f341=function(_0x5566d2){while(--_0x5566d2){_0x309da1['push'](_0x309da1['shift']());}};_0x10f341(++_0x306e0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index acf9fe3..2875600 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 _0x22fb=['stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','tag','TagId','tvox','account','body','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','stringify','matchPath','emit','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report'];(function(_0x133fc0,_0x1edda8){var _0x4ce619=function(_0x308be5){while(--_0x308be5){_0x133fc0['push'](_0x133fc0['shift']());}};_0x4ce619(++_0x1edda8);}(_0x22fb,0x192));var _0xb22f=function(_0x24f713,_0x1b7cf7){_0x24f713=_0x24f713-0x0;var _0x3250dc=_0x22fb[_0x24f713];return _0x3250dc;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0xb22f('0x0'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb22f('0x1'));var utils=require(_0xb22f('0x2'));var logger=require(_0xb22f('0x3'))(_0xb22f('0x4'));var rpc={'openchannelQueueReport':require(_0xb22f('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xb22f('0x6')),'smsQueueReport':require(_0xb22f('0x7')),'faxQueueReport':require(_0xb22f('0x8')),'whatsappQueueReport':require(_0xb22f('0x9'))};var RuleEngine=require(_0xb22f('0xa'));function getId(_0x367d4b,_0x47f61a,_0x34433b){return util[_0xb22f('0xb')](_0xb22f('0xc'),_0x367d4b,_0x47f61a||0x0,_0x34433b||0x0);}function getIntervals(_0x391e11,_0x1a3aae){var _0x3593fb=[];if(!_[_0xb22f('0xd')](_0x1a3aae[_0xb22f('0xe')])&&!_[_0xb22f('0xd')](_0x391e11[_0x1a3aae[_0xb22f('0xe')]])&&!_[_0xb22f('0xd')](_0x391e11[_0x1a3aae['IntervalId']]['Intervals'])){_0x3593fb=_['map'](_0x391e11[_0x1a3aae[_0xb22f('0xe')]]['Intervals'],'interval');}else if(!_['isNil'](_0x1a3aae[_0xb22f('0xf')])){_0x3593fb=[_0x1a3aae[_0xb22f('0xf')]];}return _0x3593fb;}exports[_0xb22f('0x10')]=function(_0x2f046d){_0x2f046d[_0xb22f('0x11')]={};return new BPromise(function(_0x32d796,_0x5c6ccf){var _0x318a39={'Start':function(_0x5f1590){var _0x36e2a8=this;return new Promise(function(_0x4f9108,_0x2187fc){if(_0x5f1590){try{var _0x514a8f=[];var _0x160417=getId(_0x5f1590[_0xb22f('0x12')],_0x5f1590[_0xb22f('0x13')]?_0x5f1590['message']['id']:0x0,_0x5f1590[_0xb22f('0x14')]?_0x5f1590['interaction']['id']:0x0);if(_0x5f1590[_0xb22f('0x15')]&&_[_0xb22f('0x16')](_0x5f1590[_0xb22f('0x15')])&&_0x5f1590[_0xb22f('0x15')][_0xb22f('0x17')]){for(var _0x2d52e4=0x0;_0x2d52e4<_0x5f1590['applications'][_0xb22f('0x17')];_0x2d52e4+=0x1){var _0x4b4510=_0x5f1590[_0xb22f('0x15')][_0x2d52e4];if(fs[_0xb22f('0x18')](path[_0xb22f('0x19')](__dirname,_0xb22f('0x15'),_0x4b4510[_0xb22f('0x1a')]+'.js'))){var _0x47d5cf=[];switch(_0x4b4510[_0xb22f('0x1a')][_0xb22f('0x1b')]()){case _0xb22f('0x1c'):var _0x16e465=_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')](',');if(_0x5f1590[_0xb22f('0x12')]===_0xb22f('0x1f')){_0x47d5cf['push'](_0x16e465[0x0]);_0x47d5cf['push'](_0x16e465[0x1]);_0x47d5cf[_0xb22f('0x20')](_0x16e465[_0xb22f('0x21')](0x2,_0x16e465['length'])[_0xb22f('0x19')](','));}else{_0x47d5cf[_0xb22f('0x20')](_0x16e465[0x0]);_0x47d5cf['push'](_0x16e465[_0xb22f('0x21')](0x1,_0x16e465[_0xb22f('0x17')])['join'](','));}break;case _0xb22f('0x22'):var _0x2c4a9e=_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')](',');_0x47d5cf[_0xb22f('0x20')](_0x2c4a9e[0x0]);_0x47d5cf[_0xb22f('0x20')](_0x2c4a9e[0x1]);_0x47d5cf[_0xb22f('0x20')](_0x2c4a9e[_0xb22f('0x21')](0x2,_0x2c4a9e['length'])['join'](','));break;case'dialogflowv2':var _0x2f6b97=_0x4b4510['appdata'][_0xb22f('0x1e')](',');_0x47d5cf[_0xb22f('0x20')](_0x2f6b97[0x0]);_0x47d5cf[_0xb22f('0x20')](_0x2f6b97[0x1]);_0x47d5cf[_0xb22f('0x20')](_0x2f6b97[0x2]);_0x47d5cf[_0xb22f('0x20')](_0x2f6b97[0x3]);_0x47d5cf['push'](_0x2f6b97['slice'](0x4,_0x2f6b97[_0xb22f('0x17')])[_0xb22f('0x19')](','));break;case _0xb22f('0x23'):var _0xe9bb83=_0x4b4510['appdata'][_0xb22f('0x1e')](',');_0x47d5cf[_0xb22f('0x20')](_0xe9bb83[0x0]);_0x47d5cf['push'](_0xe9bb83[0x1]);_0x47d5cf[_0xb22f('0x20')](_0xe9bb83[0x2]);_0x47d5cf[_0xb22f('0x20')](_0xe9bb83[0x3]);_0x47d5cf[_0xb22f('0x20')](_0xe9bb83[_0xb22f('0x21')](0x4,_0xe9bb83[_0xb22f('0x17')])['join'](','));break;case'message':_0x47d5cf[_0xb22f('0x20')](_0x4b4510[_0xb22f('0x1d')]);break;case _0xb22f('0x24'):_0x47d5cf[_0xb22f('0x20')](_0x4b4510[_0xb22f('0x25')]);_0x47d5cf[_0xb22f('0x20')](_0x4b4510[_0xb22f('0x1d')]);break;case _0xb22f('0x26'):var _0x1016df=utils['getMustacheRender'](_0x5f1590[_0xb22f('0x27')]['notificationTemplate'],_0x5f1590);var _0x5f0d7a=_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')](',');_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x0]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x1]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x2]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x3]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x4]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x5]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x6]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x7]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x8]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0x9]);_0x47d5cf[_0xb22f('0x20')](_0x5f0d7a[0xa]);_0x47d5cf['push'](_0x5f1590['interaction']['id']);_0x47d5cf[_0xb22f('0x20')](_0x5f1590[_0xb22f('0x13')]['id']);_0x47d5cf[_0xb22f('0x20')](_0x4b4510['ChatWebsiteId']);_0x47d5cf[_0xb22f('0x20')](_0x5f1590[_0xb22f('0x14')]['ContactId']);_0x47d5cf['push'](_0x5f1590[_0xb22f('0x28')]['body']);_0x47d5cf[_0xb22f('0x20')](_0x1016df);break;default:_0x47d5cf=_['isNil'](_0x4b4510[_0xb22f('0x1d')])?[]:_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')](',');}var _0x52a3c7={'id':util[_0xb22f('0xb')](_0xb22f('0x29'),_0x160417,_0x4b4510['id'],_0x4b4510[_0xb22f('0x1a')]),'condition':require('./interval')[_0xb22f('0x2a')](_0x160417,getIntervals(_0x2f046d[_0xb22f('0x2b')],_0x4b4510),_0x2f046d),'consequence':require(_0xb22f('0x2c')+_0x4b4510[_0xb22f('0x1a')])[_0xb22f('0x2d')](_0x160417,_0x47d5cf,_0x2f046d,_0x5f1590),'p':_0x4b4510[_0xb22f('0x2e')]||0x0};logger[_0xb22f('0x2f')](_0xb22f('0x30'),_0x52a3c7['id'],_0xb22f('0x31'),getIntervals(_0x2f046d[_0xb22f('0x2b')],_0x4b4510)['join'](_0xb22f('0x32')));_0x514a8f[_0xb22f('0x20')](_0x52a3c7);}else{logger['error'](_0xb22f('0x33'),path['join'](__dirname,'applications',_0x4b4510[_0xb22f('0x1a')]+_0xb22f('0x34')));}}_0x2f046d[_0xb22f('0x11')][_0x160417]=new RuleEngine(_0x514a8f);_0x2f046d[_0xb22f('0x11')][_0x160417]['execute'](_0x5f1590,function(_0x1475d1){logger['info'](_0xb22f('0x35'),JSON[_0xb22f('0x36')](_0x1475d1[_0xb22f('0x37')]));if(_0x2f046d[_0xb22f('0x11')][_0x160417]){_0x2f046d[_0xb22f('0x11')][_0x160417][_0xb22f('0x38')]('complete');}});return _0x4f9108({'code':0xc8,'message':_0x5f1590});}else{logger[_0xb22f('0x2f')]('No\x20applications\x20to\x20execute');return _0x4f9108({'code':0xc8,'message':_0x5f1590});}}catch(_0x25b158){logger[_0xb22f('0x39')](_0x25b158['stack']);return _0x2187fc(_0x36e2a8[_0xb22f('0x39')](0x1f4,_0x25b158));}}return _0x2187fc(_0xb22f('0x3a'));});},'AcceptMessage':function(_0x5f306a){var _0x48f94e=this;return new Promise(function(_0x402901,_0x577416){if(_0x5f306a[_0xb22f('0x3b')]&&_0x5f306a[_0xb22f('0x3b')]['id']){if(_0x2f046d[_0xb22f('0x3c')][_0x5f306a[_0xb22f('0x3b')]['id']]){_0x2f046d['agents'][_0x5f306a[_0xb22f('0x3b')]['id']][_0xb22f('0x3d')]=![];_0x2f046d['agents'][_0x5f306a[_0xb22f('0x3b')]['id']][_0xb22f('0x3e')]=undefined;}}if(_0x5f306a[_0xb22f('0x13')]&&_0x5f306a[_0xb22f('0x13')]['id']){try{var _0x43a774=getId(_0x5f306a['channel'],_0x5f306a[_0xb22f('0x13')]?_0x5f306a['message']['id']:0x0,_0x5f306a['interaction']?_0x5f306a[_0xb22f('0x14')]['id']:0x0);if(_0x2f046d[_0xb22f('0x11')][_0x43a774]){_0x2f046d[_0xb22f('0x11')][_0x43a774][_0xb22f('0x38')](_0xb22f('0x3f'));if(rpc[_0x5f306a['channel']+_0xb22f('0x40')]){rpc[_0x5f306a['channel']+_0xb22f('0x40')]['update'](_0x43a774,{'UserId':_0x5f306a[_0xb22f('0x13')][_0xb22f('0x41')]})[_0xb22f('0x42')](function(){logger['error'](_0xb22f('0x43'));});}}return _0x402901({'code':0xc8,'message':_0x5f306a});}catch(_0x436425){logger['error'](_0x436425[_0xb22f('0x44')]);return _0x577416(_0x48f94e[_0xb22f('0x39')](0x1f4,_0x436425));}}logger['error']('message\x20is\x20empty');return _0x577416(_0x48f94e[_0xb22f('0x39')](0x1f4,_0xb22f('0x45')));});},'RejectMessage':function(_0x5af426){var _0xba9da8=this;return new Promise(function(_0x26bc0d,_0x5b89c3){if(_0x5af426['agent']&&_0x5af426[_0xb22f('0x3b')]['id']){try{if(_0x2f046d[_0xb22f('0x3c')][_0x5af426['agent']['id']]){_0x2f046d[_0xb22f('0x3c')][_0x5af426[_0xb22f('0x3b')]['id']][_0xb22f('0x3d')]=![];_0x2f046d[_0xb22f('0x3c')][_0x5af426['agent']['id']][_0xb22f('0x3e')]=undefined;}return _0x26bc0d({'code':0xc8,'message':_0x5af426});}catch(_0x2b7922){logger['error'](_0x2b7922['stack']);return _0x5b89c3(_0xba9da8[_0xb22f('0x39')](0x1f4,_0x2b7922));}}logger[_0xb22f('0x39')](_0xb22f('0x45'));return _0x5b89c3(_0xba9da8[_0xb22f('0x39')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x29523c){var _0x2257b8=this;return new Promise(function(_0x4dc970,_0x1e1390){if(_0x29523c[_0xb22f('0x12')]&&_0x29523c[_0xb22f('0x14')]&&_0x29523c[_0xb22f('0x14')]['id']){try{var _0x4310e0=getId(_0x29523c[_0xb22f('0x12')],_0x29523c[_0xb22f('0x13')]?_0x29523c['message']['id']:0x0,_0x29523c[_0xb22f('0x14')]?_0x29523c[_0xb22f('0x14')]['id']:0x0);if(_0x2f046d[_0xb22f('0x11')][_0x4310e0]){_0x2f046d[_0xb22f('0x11')][_0x4310e0][_0xb22f('0x38')]('end');}return _0x4dc970({'code':0xc8,'message':_0x29523c});}catch(_0x49a6a2){logger[_0xb22f('0x39')](_0x49a6a2[_0xb22f('0x44')]);return _0x1e1390(_0x2257b8[_0xb22f('0x39')](0x1f4,_0x49a6a2));}}logger['error'](_0xb22f('0x45'));return _0x1e1390(_0x2257b8[_0xb22f('0x39')](0x1f4,_0xb22f('0x45')));});},'AgentCapacity':function(_0x321d5f){var _0x248dec=this;return new Promise(function(_0x9bd0df,_0x5ea324){if(_0x2f046d[_0xb22f('0x3c')]['hasOwnProperty'](_0x321d5f['id'])){for(var _0x552624 in _0x321d5f[_0xb22f('0x46')]){if(_0x321d5f[_0xb22f('0x46')]['hasOwnProperty'](_0x552624)){if(_0x2f046d['agents'][_0x321d5f['id']][_0xb22f('0x47')](_0x552624+_0xb22f('0x48'))){_0x2f046d['agents'][_0x321d5f['id']][_0x552624+'CurrentCapacity']=parseInt(_0x321d5f[_0xb22f('0x46')][_0x552624],0xa);}}}_0x2f046d['agents'][_0x321d5f['id']][_0xb22f('0x49')]();return _0x9bd0df({'code':0xc8,'message':_0x2f046d[_0xb22f('0x3c')][_0x321d5f['id']]});}else{return _0x5ea324(_0x248dec[_0xb22f('0x39')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5469f7){return new Promise(function(_0x14db56){var _0x5cff10=_[_0xb22f('0x4a')](_0x2f046d[_0xb22f('0x3c')]);if(_0x5469f7&&_0x5469f7['id']){var _0x31485a=_['find'](_0x5cff10,function(_0x55fdf1){return _0x55fdf1['id']===_0x5469f7['id'];});_0x14db56(_0x31485a);}else{_0x14db56({'count':_0x5cff10[_0xb22f('0x17')],'rows':_0x5cff10});}});},'ChatQueues':function(){return new Promise(function(_0x58e5e6){var _0xce79e9=[];for(var _0x186108 in _0x2f046d[_0xb22f('0x4b')]){if(_0x2f046d['chatQueues'][_0xb22f('0x47')](_0x186108)){var _0x497238=_0x2f046d[_0xb22f('0x4b')][_0x186108];var _0x408fa2={'id':_0x497238['id'],'available':_0x497238[_0xb22f('0x4c')],'loggedIn':_0x497238[_0xb22f('0x4d')],'name':_0x497238[_0xb22f('0x4e')],'paused':_0x497238[_0xb22f('0x4f')],'waiting':_0x497238[_0xb22f('0x50')]};_0xce79e9[_0xb22f('0x20')](_0x408fa2);}}_0x58e5e6({'count':_0xce79e9[_0xb22f('0x17')],'rows':_0xce79e9});});},'MailQueues':function(){return new Promise(function(_0x5d1a62){var _0x631832=[];for(var _0x1487e7 in _0x2f046d[_0xb22f('0x51')]){if(_0x2f046d['mailQueues'][_0xb22f('0x47')](_0x1487e7)){var _0x3765a1=_0x2f046d[_0xb22f('0x51')][_0x1487e7];var _0x194490={'id':_0x3765a1['id'],'available':_0x3765a1['available'],'loggedIn':_0x3765a1['loggedIn'],'name':_0x3765a1[_0xb22f('0x4e')],'paused':_0x3765a1['paused'],'waiting':_0x3765a1[_0xb22f('0x50')]};_0x631832[_0xb22f('0x20')](_0x194490);}}_0x5d1a62({'count':_0x631832[_0xb22f('0x17')],'rows':_0x631832});});},'OpenchannelQueues':function(){return new Promise(function(_0x231d23){var _0x29c533=[];for(var _0x1e7059 in _0x2f046d[_0xb22f('0x52')]){if(_0x2f046d[_0xb22f('0x52')][_0xb22f('0x47')](_0x1e7059)){var _0x1f62b7=_0x2f046d[_0xb22f('0x52')][_0x1e7059];var _0x2247a4={'id':_0x1f62b7['id'],'available':_0x1f62b7[_0xb22f('0x4c')],'loggedIn':_0x1f62b7['loggedIn'],'name':_0x1f62b7[_0xb22f('0x4e')],'paused':_0x1f62b7[_0xb22f('0x4f')],'waiting':_0x1f62b7[_0xb22f('0x50')]};_0x29c533[_0xb22f('0x20')](_0x2247a4);}}_0x231d23({'count':_0x29c533[_0xb22f('0x17')],'rows':_0x29c533});});},'SmsQueues':function(){return new Promise(function(_0xfcc097){var _0x40875e=[];for(var _0x202346 in _0x2f046d[_0xb22f('0x53')]){if(_0x2f046d[_0xb22f('0x53')][_0xb22f('0x47')](_0x202346)){var _0x203e28=_0x2f046d['smsQueues'][_0x202346];var _0x4b0c77={'id':_0x203e28['id'],'available':_0x203e28['available'],'loggedIn':_0x203e28[_0xb22f('0x4d')],'name':_0x203e28[_0xb22f('0x4e')],'paused':_0x203e28['paused'],'waiting':_0x203e28[_0xb22f('0x50')]};_0x40875e[_0xb22f('0x20')](_0x4b0c77);}}_0xfcc097({'count':_0x40875e['length'],'rows':_0x40875e});});},'FaxQueues':function(){return new Promise(function(_0xe4c7a0){var _0x9fc368=[];for(var _0x1af012 in _0x2f046d[_0xb22f('0x54')]){if(_0x2f046d[_0xb22f('0x54')]['hasOwnProperty'](_0x1af012)){var _0x5927b9=_0x2f046d['faxQueues'][_0x1af012];var _0x19b534={'id':_0x5927b9['id'],'available':_0x5927b9[_0xb22f('0x4c')],'loggedIn':_0x5927b9[_0xb22f('0x4d')],'name':_0x5927b9['name'],'paused':_0x5927b9[_0xb22f('0x4f')],'waiting':_0x5927b9[_0xb22f('0x50')]};_0x9fc368['push'](_0x19b534);}}_0xe4c7a0({'count':_0x9fc368[_0xb22f('0x17')],'rows':_0x9fc368});});},'WhatsappQueues':function(){return new Promise(function(_0xb0231){var _0x7007e2=[];for(var _0x3f110d in _0x2f046d[_0xb22f('0x55')]){if(_0x2f046d[_0xb22f('0x55')][_0xb22f('0x47')](_0x3f110d)){var _0x30c7a7=_0x2f046d[_0xb22f('0x55')][_0x3f110d];var _0x253622={'id':_0x30c7a7['id'],'available':_0x30c7a7['available'],'loggedIn':_0x30c7a7[_0xb22f('0x4d')],'name':_0x30c7a7[_0xb22f('0x4e')],'paused':_0x30c7a7[_0xb22f('0x4f')],'waiting':_0x30c7a7[_0xb22f('0x50')]};_0x7007e2[_0xb22f('0x20')](_0x253622);}}_0xb0231({'count':_0x7007e2[_0xb22f('0x17')],'rows':_0x7007e2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2e00ab){var _0x4ba979=_[_0xb22f('0x4a')](_0x2f046d[_0xb22f('0x56')]);_0x2e00ab({'count':_0x4ba979[_0xb22f('0x17')],'rows':_0x4ba979});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x182abe){var _0x29c732=_[_0xb22f('0x4a')](_0x2f046d['mailQueuesWaitingInteractions']);_0x182abe({'count':_0x29c732[_0xb22f('0x17')],'rows':_0x29c732});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x83cc7e){var _0x5edfc7=_[_0xb22f('0x4a')](_0x2f046d['openchannelQueuesWaitingInteractions']);_0x83cc7e({'count':_0x5edfc7['length'],'rows':_0x5edfc7});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5deaac){var _0x317c49=_['values'](_0x2f046d[_0xb22f('0x57')]);_0x5deaac({'count':_0x317c49['length'],'rows':_0x317c49});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4a7dc8){var _0x348981=_[_0xb22f('0x4a')](_0x2f046d['faxQueuesWaitingInteractions']);_0x4a7dc8({'count':_0x348981['length'],'rows':_0x348981});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4442e3){var _0x258343=_['values'](_0x2f046d[_0xb22f('0x58')]);_0x4442e3({'count':_0x258343['length'],'rows':_0x258343});});}};var _0x5c1499=jayson[_0xb22f('0x59')](_0x318a39)[_0xb22f('0x5a')]();_0x5c1499['on'](_0xb22f('0x39'),function(_0x50e573){logger['error'](JSON['stringify'](_0x50e573));return _0x5c6ccf(_0x50e573);});_0x5c1499[_0xb22f('0x10')](0x232c,_0xb22f('0x5b'),function(){console[_0xb22f('0x5c')](_0xb22f('0x5d'),0x232c);return _0x32d796('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xb469=['update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','values','find','chatQueues','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','Intervals','map','interval','listen','rules','message','interaction','applications','app','.js','toLowerCase','appdata','channel','push','slice','length','join','dialogflow','split','dialogflowv2','amazonlex','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agents','agent','busy','busyQueue','end','QueueReport'];(function(_0x1e1c24,_0x22c586){var _0x590e8c=function(_0x2f5bcd){while(--_0x2f5bcd){_0x1e1c24['push'](_0x1e1c24['shift']());}};_0x590e8c(++_0x22c586);}(_0xb469,0x13b));var _0x9b46=function(_0xb38289,_0x9c6f7f){_0xb38289=_0xb38289-0x0;var _0x24ac84=_0xb469[_0xb38289];return _0x24ac84;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var fs=require('fs');var jayson=require(_0x9b46('0x3'));var BPromise=require(_0x9b46('0x4'));var utils=require(_0x9b46('0x5'));var logger=require(_0x9b46('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x9b46('0x7')),'mailQueueReport':require(_0x9b46('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9b46('0x9')),'faxQueueReport':require(_0x9b46('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x9b46('0xb'));function getId(_0x5bd834,_0x4c1ed9,_0x34c0de){return util['format'](_0x9b46('0xc'),_0x5bd834,_0x4c1ed9||0x0,_0x34c0de||0x0);}function getIntervals(_0xb9d1b5,_0x43a112){var _0x47adeb=[];if(!_[_0x9b46('0xd')](_0x43a112['IntervalId'])&&!_[_0x9b46('0xd')](_0xb9d1b5[_0x43a112['IntervalId']])&&!_[_0x9b46('0xd')](_0xb9d1b5[_0x43a112['IntervalId']][_0x9b46('0xe')])){_0x47adeb=_[_0x9b46('0xf')](_0xb9d1b5[_0x43a112['IntervalId']][_0x9b46('0xe')],_0x9b46('0x10'));}else if(!_['isNil'](_0x43a112[_0x9b46('0x10')])){_0x47adeb=[_0x43a112[_0x9b46('0x10')]];}return _0x47adeb;}exports[_0x9b46('0x11')]=function(_0x467086){_0x467086[_0x9b46('0x12')]={};return new BPromise(function(_0x35c5c1,_0x2136bc){var _0x2e70c3={'Start':function(_0x3f2b28){var _0x178293=this;return new Promise(function(_0xbc1ba6,_0x135cc2){if(_0x3f2b28){try{var _0x1e6911=[];var _0x559bdf=getId(_0x3f2b28['channel'],_0x3f2b28['message']?_0x3f2b28[_0x9b46('0x13')]['id']:0x0,_0x3f2b28[_0x9b46('0x14')]?_0x3f2b28[_0x9b46('0x14')]['id']:0x0);if(_0x3f2b28['applications']&&_['isArray'](_0x3f2b28[_0x9b46('0x15')])&&_0x3f2b28['applications']['length']){for(var _0xfeb1b9=0x0;_0xfeb1b9<_0x3f2b28[_0x9b46('0x15')]['length'];_0xfeb1b9+=0x1){var _0x2fd8f9=_0x3f2b28[_0x9b46('0x15')][_0xfeb1b9];if(fs['existsSync'](path['join'](__dirname,_0x9b46('0x15'),_0x2fd8f9[_0x9b46('0x16')]+_0x9b46('0x17')))){var _0x4e4c7d=[];switch(_0x2fd8f9['app'][_0x9b46('0x18')]()){case'autoreply':var _0x21dacb=_0x2fd8f9[_0x9b46('0x19')]['split'](',');if(_0x3f2b28[_0x9b46('0x1a')]==='mail'){_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[0x1]);_0x4e4c7d['push'](_0x21dacb[_0x9b46('0x1c')](0x2,_0x21dacb[_0x9b46('0x1d')])[_0x9b46('0x1e')](','));}else{_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[_0x9b46('0x1c')](0x1,_0x21dacb[_0x9b46('0x1d')])['join'](','));}break;case _0x9b46('0x1f'):var _0x3ac37e=_0x2fd8f9[_0x9b46('0x19')][_0x9b46('0x20')](',');_0x4e4c7d[_0x9b46('0x1b')](_0x3ac37e[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x3ac37e[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x3ac37e['slice'](0x2,_0x3ac37e[_0x9b46('0x1d')])[_0x9b46('0x1e')](','));break;case _0x9b46('0x21'):var _0x376ccc=_0x2fd8f9[_0x9b46('0x19')][_0x9b46('0x20')](',');_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x2]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x3]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc['slice'](0x4,_0x376ccc[_0x9b46('0x1d')])[_0x9b46('0x1e')](','));break;case _0x9b46('0x22'):var _0x1ce069=_0x2fd8f9[_0x9b46('0x19')][_0x9b46('0x20')](',');_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x2]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x3]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069['slice'](0x4,_0x1ce069[_0x9b46('0x1d')])['join'](','));break;case _0x9b46('0x13'):_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x19')]);break;case'tag':_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x23')]);_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x19')]);break;case _0x9b46('0x24'):var _0x5cb73f=utils['getMustacheRender'](_0x3f2b28[_0x9b46('0x25')][_0x9b46('0x26')],_0x3f2b28);var _0x47367a=_0x2fd8f9[_0x9b46('0x19')]['split'](',');_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x0]);_0x4e4c7d['push'](_0x47367a[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x2]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x3]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x4]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x5]);_0x4e4c7d['push'](_0x47367a[0x6]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x7]);_0x4e4c7d['push'](_0x47367a[0x8]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x9]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0xa]);_0x4e4c7d[_0x9b46('0x1b')](_0x3f2b28[_0x9b46('0x14')]['id']);_0x4e4c7d[_0x9b46('0x1b')](_0x3f2b28[_0x9b46('0x13')]['id']);_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x27')]);_0x4e4c7d[_0x9b46('0x1b')](_0x3f2b28[_0x9b46('0x14')][_0x9b46('0x28')]);_0x4e4c7d['push'](_0x3f2b28[_0x9b46('0x29')]['body']);_0x4e4c7d[_0x9b46('0x1b')](_0x5cb73f);break;default:_0x4e4c7d=_[_0x9b46('0xd')](_0x2fd8f9['appdata'])?[]:_0x2fd8f9[_0x9b46('0x19')]['split'](',');}var _0x416538={'id':util['format'](_0x9b46('0x2a'),_0x559bdf,_0x2fd8f9['id'],_0x2fd8f9[_0x9b46('0x16')]),'condition':require(_0x9b46('0x2b'))[_0x9b46('0x2c')](_0x559bdf,getIntervals(_0x467086[_0x9b46('0x2d')],_0x2fd8f9),_0x467086),'consequence':require('./applications/'+_0x2fd8f9['app'])[_0x9b46('0x2e')](_0x559bdf,_0x4e4c7d,_0x467086,_0x3f2b28),'p':_0x2fd8f9['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x416538['id'],'on\x20interval',getIntervals(_0x467086[_0x9b46('0x2d')],_0x2fd8f9)['join'](_0x9b46('0x2f')));_0x1e6911['push'](_0x416538);}else{logger[_0x9b46('0x30')](_0x9b46('0x31'),path[_0x9b46('0x1e')](__dirname,_0x9b46('0x15'),_0x2fd8f9[_0x9b46('0x16')]+_0x9b46('0x17')));}}_0x467086[_0x9b46('0x12')][_0x559bdf]=new RuleEngine(_0x1e6911);_0x467086[_0x9b46('0x12')][_0x559bdf][_0x9b46('0x32')](_0x3f2b28,function(_0x5602a9){logger[_0x9b46('0x33')](_0x9b46('0x34'),JSON[_0x9b46('0x35')](_0x5602a9[_0x9b46('0x36')]));if(_0x467086[_0x9b46('0x12')][_0x559bdf]){_0x467086[_0x9b46('0x12')][_0x559bdf][_0x9b46('0x37')](_0x9b46('0x38'));}});return _0xbc1ba6({'code':0xc8,'message':_0x3f2b28});}else{logger[_0x9b46('0x33')](_0x9b46('0x39'));return _0xbc1ba6({'code':0xc8,'message':_0x3f2b28});}}catch(_0x1f3b2b){logger[_0x9b46('0x30')](_0x1f3b2b[_0x9b46('0x3a')]);return _0x135cc2(_0x178293[_0x9b46('0x30')](0x1f4,_0x1f3b2b));}}return _0x135cc2('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4a62c6){var _0xf81543=this;return new Promise(function(_0x23df60,_0x309a4f){if(_0x4a62c6['agent']&&_0x4a62c6['agent']['id']){if(_0x467086[_0x9b46('0x3b')][_0x4a62c6[_0x9b46('0x3c')]['id']]){_0x467086[_0x9b46('0x3b')][_0x4a62c6[_0x9b46('0x3c')]['id']][_0x9b46('0x3d')]=![];_0x467086[_0x9b46('0x3b')][_0x4a62c6['agent']['id']][_0x9b46('0x3e')]=undefined;}}if(_0x4a62c6[_0x9b46('0x13')]&&_0x4a62c6[_0x9b46('0x13')]['id']){try{var _0x47a938=getId(_0x4a62c6[_0x9b46('0x1a')],_0x4a62c6['message']?_0x4a62c6[_0x9b46('0x13')]['id']:0x0,_0x4a62c6[_0x9b46('0x14')]?_0x4a62c6[_0x9b46('0x14')]['id']:0x0);if(_0x467086['rules'][_0x47a938]){_0x467086[_0x9b46('0x12')][_0x47a938][_0x9b46('0x37')](_0x9b46('0x3f'));if(rpc[_0x4a62c6[_0x9b46('0x1a')]+_0x9b46('0x40')]){rpc[_0x4a62c6[_0x9b46('0x1a')]+'QueueReport'][_0x9b46('0x41')](_0x47a938,{'UserId':_0x4a62c6[_0x9b46('0x13')][_0x9b46('0x42')]})[_0x9b46('0x43')](function(){logger[_0x9b46('0x30')](_0x9b46('0x44'));});}}return _0x23df60({'code':0xc8,'message':_0x4a62c6});}catch(_0x4a1df0){logger[_0x9b46('0x30')](_0x4a1df0['stack']);return _0x309a4f(_0xf81543[_0x9b46('0x30')](0x1f4,_0x4a1df0));}}logger[_0x9b46('0x30')](_0x9b46('0x45'));return _0x309a4f(_0xf81543[_0x9b46('0x30')](0x1f4,_0x9b46('0x45')));});},'RejectMessage':function(_0x5f5ce9){var _0x15dbb0=this;return new Promise(function(_0x1c7e5d,_0x3d65ad){if(_0x5f5ce9[_0x9b46('0x3c')]&&_0x5f5ce9[_0x9b46('0x3c')]['id']){try{if(_0x467086[_0x9b46('0x3b')][_0x5f5ce9[_0x9b46('0x3c')]['id']]){_0x467086[_0x9b46('0x3b')][_0x5f5ce9[_0x9b46('0x3c')]['id']][_0x9b46('0x3d')]=![];_0x467086[_0x9b46('0x3b')][_0x5f5ce9['agent']['id']]['busyQueue']=undefined;}return _0x1c7e5d({'code':0xc8,'message':_0x5f5ce9});}catch(_0x496006){logger[_0x9b46('0x30')](_0x496006['stack']);return _0x3d65ad(_0x15dbb0[_0x9b46('0x30')](0x1f4,_0x496006));}}logger['error'](_0x9b46('0x45'));return _0x3d65ad(_0x15dbb0['error'](0x1f4,_0x9b46('0x45')));});},'AbandonInteraction':function(_0x443ccd){var _0x15e3d6=this;return new Promise(function(_0x52463b,_0x35f71d){if(_0x443ccd['channel']&&_0x443ccd[_0x9b46('0x14')]&&_0x443ccd[_0x9b46('0x14')]['id']){try{var _0x2c77d2=getId(_0x443ccd[_0x9b46('0x1a')],_0x443ccd[_0x9b46('0x13')]?_0x443ccd['message']['id']:0x0,_0x443ccd['interaction']?_0x443ccd[_0x9b46('0x14')]['id']:0x0);if(_0x467086[_0x9b46('0x12')][_0x2c77d2]){_0x467086[_0x9b46('0x12')][_0x2c77d2][_0x9b46('0x37')](_0x9b46('0x3f'));}return _0x52463b({'code':0xc8,'message':_0x443ccd});}catch(_0x164167){logger[_0x9b46('0x30')](_0x164167[_0x9b46('0x3a')]);return _0x35f71d(_0x15e3d6['error'](0x1f4,_0x164167));}}logger[_0x9b46('0x30')](_0x9b46('0x45'));return _0x35f71d(_0x15e3d6[_0x9b46('0x30')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x46dffa){var _0x145200=this;return new Promise(function(_0x1aa8c6,_0x12d825){if(_0x467086[_0x9b46('0x3b')][_0x9b46('0x46')](_0x46dffa['id'])){for(var _0x4b79a4 in _0x46dffa[_0x9b46('0x47')]){if(_0x46dffa[_0x9b46('0x47')][_0x9b46('0x46')](_0x4b79a4)){if(_0x467086[_0x9b46('0x3b')][_0x46dffa['id']][_0x9b46('0x46')](_0x4b79a4+_0x9b46('0x48'))){_0x467086['agents'][_0x46dffa['id']][_0x4b79a4+_0x9b46('0x48')]=parseInt(_0x46dffa['capacity'][_0x4b79a4],0xa);}}}_0x467086[_0x9b46('0x3b')][_0x46dffa['id']]['updateRealtime']();return _0x1aa8c6({'code':0xc8,'message':_0x467086[_0x9b46('0x3b')][_0x46dffa['id']]});}else{return _0x12d825(_0x145200[_0x9b46('0x30')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x171ad2){return new Promise(function(_0x1cc2f3){var _0x3abe23=_[_0x9b46('0x49')](_0x467086[_0x9b46('0x3b')]);if(_0x171ad2&&_0x171ad2['id']){var _0x5b9ec2=_[_0x9b46('0x4a')](_0x3abe23,function(_0x343a1e){return _0x343a1e['id']===_0x171ad2['id'];});_0x1cc2f3(_0x5b9ec2);}else{_0x1cc2f3({'count':_0x3abe23['length'],'rows':_0x3abe23});}});},'ChatQueues':function(){return new Promise(function(_0x4cf4ba){var _0x3aca4b=[];for(var _0x2801bb in _0x467086[_0x9b46('0x4b')]){if(_0x467086[_0x9b46('0x4b')][_0x9b46('0x46')](_0x2801bb)){var _0x1a6516=_0x467086[_0x9b46('0x4b')][_0x2801bb];var _0x19aa34={'id':_0x1a6516['id'],'available':_0x1a6516['available'],'loggedIn':_0x1a6516['loggedIn'],'name':_0x1a6516[_0x9b46('0x4c')],'paused':_0x1a6516[_0x9b46('0x4d')],'waiting':_0x1a6516['waiting']};_0x3aca4b[_0x9b46('0x1b')](_0x19aa34);}}_0x4cf4ba({'count':_0x3aca4b['length'],'rows':_0x3aca4b});});},'MailQueues':function(){return new Promise(function(_0x33d1ab){var _0x501544=[];for(var _0xf6f92 in _0x467086[_0x9b46('0x4e')]){if(_0x467086[_0x9b46('0x4e')]['hasOwnProperty'](_0xf6f92)){var _0x271ae8=_0x467086[_0x9b46('0x4e')][_0xf6f92];var _0xad2666={'id':_0x271ae8['id'],'available':_0x271ae8['available'],'loggedIn':_0x271ae8[_0x9b46('0x4f')],'name':_0x271ae8[_0x9b46('0x4c')],'paused':_0x271ae8[_0x9b46('0x4d')],'waiting':_0x271ae8[_0x9b46('0x50')]};_0x501544[_0x9b46('0x1b')](_0xad2666);}}_0x33d1ab({'count':_0x501544['length'],'rows':_0x501544});});},'OpenchannelQueues':function(){return new Promise(function(_0x5321c1){var _0x5386ef=[];for(var _0x533a4f in _0x467086['openchannelQueues']){if(_0x467086[_0x9b46('0x51')][_0x9b46('0x46')](_0x533a4f)){var _0x11243a=_0x467086[_0x9b46('0x51')][_0x533a4f];var _0x368cd2={'id':_0x11243a['id'],'available':_0x11243a[_0x9b46('0x52')],'loggedIn':_0x11243a[_0x9b46('0x4f')],'name':_0x11243a[_0x9b46('0x4c')],'paused':_0x11243a['paused'],'waiting':_0x11243a[_0x9b46('0x50')]};_0x5386ef[_0x9b46('0x1b')](_0x368cd2);}}_0x5321c1({'count':_0x5386ef['length'],'rows':_0x5386ef});});},'SmsQueues':function(){return new Promise(function(_0xb3e39e){var _0x4ea405=[];for(var _0x1f3e9e in _0x467086[_0x9b46('0x53')]){if(_0x467086[_0x9b46('0x53')][_0x9b46('0x46')](_0x1f3e9e)){var _0x453a53=_0x467086['smsQueues'][_0x1f3e9e];var _0x4e1175={'id':_0x453a53['id'],'available':_0x453a53[_0x9b46('0x52')],'loggedIn':_0x453a53['loggedIn'],'name':_0x453a53[_0x9b46('0x4c')],'paused':_0x453a53[_0x9b46('0x4d')],'waiting':_0x453a53['waiting']};_0x4ea405['push'](_0x4e1175);}}_0xb3e39e({'count':_0x4ea405['length'],'rows':_0x4ea405});});},'FaxQueues':function(){return new Promise(function(_0x2978aa){var _0x4a4e9a=[];for(var _0x56b870 in _0x467086[_0x9b46('0x54')]){if(_0x467086[_0x9b46('0x54')][_0x9b46('0x46')](_0x56b870)){var _0x1fa19d=_0x467086['faxQueues'][_0x56b870];var _0x46a294={'id':_0x1fa19d['id'],'available':_0x1fa19d[_0x9b46('0x52')],'loggedIn':_0x1fa19d[_0x9b46('0x4f')],'name':_0x1fa19d['name'],'paused':_0x1fa19d['paused'],'waiting':_0x1fa19d[_0x9b46('0x50')]};_0x4a4e9a[_0x9b46('0x1b')](_0x46a294);}}_0x2978aa({'count':_0x4a4e9a[_0x9b46('0x1d')],'rows':_0x4a4e9a});});},'WhatsappQueues':function(){return new Promise(function(_0x4fa1ad){var _0x2f60a3=[];for(var _0x3a1e1e in _0x467086['whatsappQueues']){if(_0x467086[_0x9b46('0x55')][_0x9b46('0x46')](_0x3a1e1e)){var _0x346a6c=_0x467086[_0x9b46('0x55')][_0x3a1e1e];var _0x4de02d={'id':_0x346a6c['id'],'available':_0x346a6c['available'],'loggedIn':_0x346a6c[_0x9b46('0x4f')],'name':_0x346a6c['name'],'paused':_0x346a6c[_0x9b46('0x4d')],'waiting':_0x346a6c[_0x9b46('0x50')]};_0x2f60a3['push'](_0x4de02d);}}_0x4fa1ad({'count':_0x2f60a3['length'],'rows':_0x2f60a3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x536083){var _0x8bf222=_['values'](_0x467086[_0x9b46('0x56')]);_0x536083({'count':_0x8bf222[_0x9b46('0x1d')],'rows':_0x8bf222});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1f52c5){var _0x18006a=_['values'](_0x467086[_0x9b46('0x57')]);_0x1f52c5({'count':_0x18006a[_0x9b46('0x1d')],'rows':_0x18006a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xf1bc8d){var _0x195cf0=_[_0x9b46('0x49')](_0x467086['openchannelQueuesWaitingInteractions']);_0xf1bc8d({'count':_0x195cf0[_0x9b46('0x1d')],'rows':_0x195cf0});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x591820){var _0x254c71=_[_0x9b46('0x49')](_0x467086['smsQueuesWaitingInteractions']);_0x591820({'count':_0x254c71[_0x9b46('0x1d')],'rows':_0x254c71});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4ffaee){var _0x3c0b46=_[_0x9b46('0x49')](_0x467086['faxQueuesWaitingInteractions']);_0x4ffaee({'count':_0x3c0b46[_0x9b46('0x1d')],'rows':_0x3c0b46});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x526e70){var _0x2cbca2=_[_0x9b46('0x49')](_0x467086[_0x9b46('0x58')]);_0x526e70({'count':_0x2cbca2['length'],'rows':_0x2cbca2});});}};var _0xe27fd6=jayson[_0x9b46('0x59')](_0x2e70c3)[_0x9b46('0x5a')]();_0xe27fd6['on'](_0x9b46('0x30'),function(_0x48f236){logger[_0x9b46('0x30')](JSON['stringify'](_0x48f236));return _0x2136bc(_0x48f236);});_0xe27fd6[_0x9b46('0x11')](0x232c,_0x9b46('0x5b'),function(){console[_0x9b46('0x5c')](_0x9b46('0x5d'),0x232c);return _0x35c5c1(_0x9b46('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 92c57f8..91ccd61 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 _0x6499=['../../../config/logger','client','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stop','util','bluebird','jayson/promise','lodash'];(function(_0x511991,_0x50de85){var _0x2ccb92=function(_0x3e98ed){while(--_0x3e98ed){_0x511991['push'](_0x511991['shift']());}};_0x2ccb92(++_0x50de85);}(_0x6499,0x11c));var _0x9649=function(_0x33607d,_0x5264bb){_0x33607d=_0x33607d-0x0;var _0x9e30cd=_0x6499[_0x33607d];return _0x9e30cd;};'use strict';var util=require(_0x9649('0x0'));var BPromise=require(_0x9649('0x1'));var jayson=require(_0x9649('0x2'));var _=require(_0x9649('0x3'));var logger=require(_0x9649('0x4'))('routing');var client=jayson[_0x9649('0x5')]['http']({'port':0x232a});function request(_0x58ac69,_0x84b173){return new BPromise(function(_0x41d31c,_0x139342){return client[_0x9649('0x6')](_0x58ac69,_0x84b173)[_0x9649('0x7')](function(_0x3e59f7){if(_0x3e59f7[_0x9649('0x8')]){return _0x139342(_0x3e59f7[_0x9649('0x8')]['message']);}else{return _0x41d31c(_0x3e59f7[_0x9649('0x9')]);}})[_0x9649('0xa')](function(_0x359123){return _0x139342(_0x359123);});});}exports[_0x9649('0xb')]=function(_0x1eb74f,_0x3c924f,_0x790c7d){return function(_0x5df4b6){if(_0x790c7d[_0x9649('0xc')]&&!_0x790c7d[_0x9649('0xc')][_0x1eb74f]){logger[_0x9649('0xd')](_0x9649('0xe'),_0x1eb74f);return _0x5df4b6['stop']();}var _0x2cd659=[];for(var _0x558343=0x0;_0x558343<_0x3c924f[_0x9649('0xf')];_0x558343+=0x1){_0x2cd659[_0x9649('0x10')](request(_0x9649('0x11'),{'command':util[_0x9649('0x12')](_0x9649('0x13'),_0x3c924f[_0x558343])})[_0x9649('0x7')](function(_0x4975d8){return _0x4975d8&&_0x4975d8[_0x9649('0x14')]&&_0x4975d8[_0x9649('0x14')][_0x9649('0x15')](_0x9649('0x16'))>=0x0?!![]:![];})[_0x9649('0xa')](function(_0x3baf5d){logger[_0x9649('0x8')](_0x9649('0x17'),_0x1eb74f,_0x3c924f[_0x558343]);}));}BPromise[_0x9649('0x18')](_0x2cd659)[_0x9649('0x7')](function(_0x353e72){var _0x5f248b=_[_0x9649('0x19')](_0x353e72);logger['info'](_0x9649('0x1a'),_0x1eb74f,_0x3c924f[_0x9649('0x1b')]('\x20|\x20'),_0x5f248b);_0x5df4b6[_0x9649('0x1c')](_0x5f248b);})[_0x9649('0xa')](function(_0x12f0e7){console[_0x9649('0x1d')](_0x12f0e7);logger[_0x9649('0x8')](_0x9649('0x1a'),_0x1eb74f,_0x3c924f[_0x9649('0x1b')](_0x9649('0x1e')),_0x12f0e7['stack']);_0x5df4b6[_0x9649('0x1f')]();});};}; \ No newline at end of file +var _0x252a=['client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','bluebird','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x46878a,_0x4c5716){var _0x55e594=function(_0x203b21){while(--_0x203b21){_0x46878a['push'](_0x46878a['shift']());}};_0x55e594(++_0x4c5716);}(_0x252a,0x145));var _0xa252=function(_0x1cbc7b,_0x48b419){_0x1cbc7b=_0x1cbc7b-0x0;var _0x20a922=_0x252a[_0x1cbc7b];return _0x20a922;};'use strict';var util=require('util');var BPromise=require(_0xa252('0x0'));var jayson=require(_0xa252('0x1'));var _=require(_0xa252('0x2'));var logger=require(_0xa252('0x3'))(_0xa252('0x4'));var client=jayson[_0xa252('0x5')][_0xa252('0x6')]({'port':0x232a});function request(_0x120b35,_0x43ee0f){return new BPromise(function(_0x1e754f,_0x537053){return client[_0xa252('0x7')](_0x120b35,_0x43ee0f)[_0xa252('0x8')](function(_0x4a73f9){if(_0x4a73f9[_0xa252('0x9')]){return _0x537053(_0x4a73f9[_0xa252('0x9')]['message']);}else{return _0x1e754f(_0x4a73f9[_0xa252('0xa')]);}})[_0xa252('0xb')](function(_0x2ce4bc){return _0x537053(_0x2ce4bc);});});}exports[_0xa252('0xc')]=function(_0x1946b6,_0x58d958,_0x4e95ae){return function(_0x1da42a){if(_0x4e95ae['rules']&&!_0x4e95ae[_0xa252('0xd')][_0x1946b6]){logger[_0xa252('0xe')](_0xa252('0xf'),_0x1946b6);return _0x1da42a[_0xa252('0x10')]();}var _0x55ba9f=[];for(var _0x5115ce=0x0;_0x5115ce<_0x58d958[_0xa252('0x11')];_0x5115ce+=0x1){_0x55ba9f[_0xa252('0x12')](request(_0xa252('0x13'),{'command':util['format']('iftime\x20%s',_0x58d958[_0x5115ce])})[_0xa252('0x8')](function(_0x50b8ac){return _0x50b8ac&&_0x50b8ac[_0xa252('0x14')]&&_0x50b8ac[_0xa252('0x14')][_0xa252('0x15')](_0xa252('0x16'))>=0x0?!![]:![];})['catch'](function(_0x1d9037){logger[_0xa252('0x9')](_0xa252('0x17'),_0x1946b6,_0x58d958[_0x5115ce]);}));}BPromise[_0xa252('0x18')](_0x55ba9f)[_0xa252('0x8')](function(_0x24cbda){var _0x2868be=_[_0xa252('0x19')](_0x24cbda);logger['info'](_0xa252('0x1a'),_0x1946b6,_0x58d958[_0xa252('0x1b')](_0xa252('0x1c')),_0x2868be);_0x1da42a['when'](_0x2868be);})[_0xa252('0xb')](function(_0x4b0c7b){console[_0xa252('0x1d')](_0x4b0c7b);logger[_0xa252('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x1946b6,_0x58d958[_0xa252('0x1b')](_0xa252('0x1c')),_0x4b0c7b['stack']);_0x1da42a[_0xa252('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 3f1b477..6cb8f17 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 _0x593e=['answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','agentconnectAt','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','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','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','acw','acwtime','agentacw','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','talktime','[%s][agents][agentconnect]','connect','answered_elsewhere'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x593e,0xcb));var _0xe593=function(_0x309f6f,_0xd5371c){_0x309f6f=_0x309f6f-0x0;var _0x29da49=_0x593e[_0x309f6f];return _0x29da49;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var utils=require(_0xe593('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x28f28c,_0x43dabb){utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x5'),_0x28f28c['uniqueid'],_0x28f28c[_0xe593('0x6')],_0x28f28c[_0xe593('0x7')],_0x28f28c[_0xe593('0x8')],_0x28f28c[_0xe593('0x9')],_0x28f28c[_0xe593('0xa')],_0x28f28c[_0xe593('0xb')],_0x28f28c[_0xe593('0xc')]));if(_0x28f28c[_0xe593('0x7')]){utils[_0xe593('0xd')](_0x28f28c[_0xe593('0x7')])['then'](function(_0x38c470){if(_0x38c470){_0x28f28c[_0xe593('0xe')]=_0x38c470[_0xe593('0xe')];_0x28f28c['agentacw']=_0x28f28c['agentcomplete']?_0x38c470[_0xe593('0xf')]:![];_0x28f28c[_0xe593('0x10')]=_0x28f28c[_0xe593('0x11')]?_0x38c470['acwTimeout']:0x0;}utils[_0xe593('0x12')](_0xe593('0x13'),_0x28f28c);});}else{utils[_0xe593('0x12')](_0xe593('0x13'),_0x28f28c);}if(_0x43dabb){delete transfers[_0x28f28c[_0xe593('0x14')]];}else{delete agents[_0x28f28c[_0xe593('0x15')]];}}exports[_0xe593('0x16')]=function(_0xa4d5e9){try{utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][agentcalled]',_0xa4d5e9[_0xe593('0x14')]),_0xa4d5e9);agents[_0xa4d5e9[_0xe593('0x15')]]=_0xa4d5e9;agents[_0xa4d5e9['destuniqueid']][_0xe593('0x18')]=utils[_0xe593('0x19')]();agents[_0xa4d5e9['destuniqueid']][_0xe593('0xc')]=_0xe593('0x1a');agents[_0xa4d5e9[_0xe593('0x15')]][_0xe593('0xb')]=null;agents[_0xa4d5e9[_0xe593('0x15')]][_0xe593('0x1b')]=null;utils['info'](util[_0xe593('0x4')](_0xe593('0x1c'),_0xa4d5e9['uniqueid'],agents[_0xa4d5e9[_0xe593('0x15')]][_0xe593('0x8')],_0xa4d5e9['destuniqueid']));}catch(_0x1c94aa){utils[_0xe593('0x1d')](util[_0xe593('0x4')](_0xe593('0x1e'),_0xa4d5e9[_0xe593('0x14')]),_0x1c94aa);}};exports[_0xe593('0x1f')]=function(_0x3d2a51){try{if(!_['isNil'](agents[_0x3d2a51['destuniqueid']])){utils[_0xe593('0x17')](util['format']('[%s][agents][agentringnoanswer]',_0x3d2a51[_0xe593('0x14')]),_0x3d2a51);utils[_0xe593('0x3')](util['format'](_0xe593('0x20'),_0x3d2a51['uniqueid'],agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x8')],_0x3d2a51[_0xe593('0x15')]));agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x1f')]=!![];agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x21')]=utils[_0xe593('0x19')]();agents[_0x3d2a51['destuniqueid']][_0xe593('0xc')]=_0xe593('0x22');agents[_0x3d2a51['destuniqueid']]['reason']=_0xe593('0x22');agents[_0x3d2a51[_0xe593('0x15')]][_0xe593('0x23')]=_0x3d2a51[_0xe593('0x24')]?parseInt(_0x3d2a51[_0xe593('0x24')])/0x3e8:0x0;agents[_0x3d2a51[_0xe593('0x15')]]['talktime']=0x0;unanswered[_0xe593('0x25')](_0x3d2a51['destuniqueid']);}}catch(_0x1dacf6){utils[_0xe593('0x1d')](util['format'](_0xe593('0x26'),_0x3d2a51['uniqueid']),_0x1dacf6);}};exports[_0xe593('0x27')]=function(_0x1c147b){try{_[_0xe593('0x28')](agents,function(_0x501e54,_0x1ae8d9){if(_0x501e54[_0xe593('0x14')]==_0x1c147b[_0xe593('0x14')]&&!_[_0xe593('0x29')](unanswered,_0x501e54[_0xe593('0x15')])){utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][queuecallerabandon]',_0x1c147b[_0xe593('0x14')]),_0x1c147b);utils[_0xe593('0x3')](util['format'](_0xe593('0x2a'),_0x1c147b['uniqueid'],_0x501e54[_0xe593('0x8')],_0x501e54[_0xe593('0x15')]));_0x501e54[_0xe593('0x1f')]=!![];_0x501e54[_0xe593('0x21')]=utils[_0xe593('0x19')]();_0x501e54[_0xe593('0xc')]=_0xe593('0x2b');_0x501e54[_0xe593('0x2c')]=_0xe593('0x2b');_0x501e54[_0xe593('0x23')]=_0x1c147b['holdtime'];_0x501e54[_0xe593('0x2d')]=0x0;writeDB(_0x501e54);}});}catch(_0x2c0a30){utils[_0xe593('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x1c147b[_0xe593('0x14')]),_0x2c0a30);}};exports['agentconnect']=function(_0x232bf1){try{if(agents[_0x232bf1[_0xe593('0x15')]]){utils[_0xe593('0x17')](util[_0xe593('0x4')](_0xe593('0x2e'),_0x232bf1[_0xe593('0x14')]),_0x232bf1);utils[_0xe593('0x3')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x232bf1[_0xe593('0x14')],agents[_0x232bf1['destuniqueid']][_0xe593('0x8')],_0x232bf1['destuniqueid']));agents[_0x232bf1[_0xe593('0x15')]]['agentconnectAt']=utils['now']();agents[_0x232bf1[_0xe593('0x15')]][_0xe593('0xb')]=_0x232bf1[_0xe593('0xb')];agents[_0x232bf1['destuniqueid']]['connectedlinename']=_0x232bf1['connectedlinename'];agents[_0x232bf1[_0xe593('0x15')]]['holdtime']=_0x232bf1[_0xe593('0x24')];agents[_0x232bf1[_0xe593('0x15')]][_0xe593('0xc')]=_0xe593('0x2f');_['forIn'](agents,function(_0x196325,_0x53ed3c){if(_0x196325[_0xe593('0x15')]!=_0x232bf1['destuniqueid']&&_0x196325['uniqueid']==_0x232bf1['uniqueid']){_0x196325[_0xe593('0x2d')]=0x0;_0x196325['holdtime']=_0x232bf1[_0xe593('0x24')];_0x196325[_0xe593('0x1f')]=!![];_0x196325[_0xe593('0x21')]=utils['now']();_0x196325[_0xe593('0xc')]=_0xe593('0x30');_0x196325[_0xe593('0x2c')]=_0xe593('0x30');_0x196325[_0xe593('0x31')]=_0x232bf1[_0xe593('0x15')];_0x196325[_0xe593('0x32')]=_0x232bf1[_0xe593('0x8')];writeDB(_0x196325);}});}}catch(_0x4b36e1){utils[_0xe593('0x1d')](util[_0xe593('0x4')](_0xe593('0x2e'),_0x232bf1[_0xe593('0x14')]),_0x4b36e1);}};exports[_0xe593('0x33')]=function(_0x4d3018){try{if(!_['isNil'](agents[_0x4d3018[_0xe593('0x15')]])){utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][agentcomplete]',_0x4d3018[_0xe593('0x14')]),_0x4d3018);utils[_0xe593('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4d3018[_0xe593('0x14')],agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x8')],_0x4d3018['destuniqueid']));agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x33')]=!![];agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x34')]=utils['now']();agents[_0x4d3018['destuniqueid']]['talktime']=utils['diffTime'](agents[_0x4d3018[_0xe593('0x15')]]['agentcompleteAt'],agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x35')]);agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0x2c')]=_0x4d3018[_0xe593('0x2c')];agents[_0x4d3018[_0xe593('0x15')]][_0xe593('0xc')]=_0xe593('0x36');writeDB(agents[_0x4d3018['destuniqueid']]);}}catch(_0x3dbb46){utils[_0xe593('0x1d')](util[_0xe593('0x4')]('[%s][agents][agentcomplete]',_0x4d3018[_0xe593('0x14')]),_0x3dbb46);}};exports['blindtransfer']=function(_0x39ec9e){try{if(!_[_0xe593('0x37')](agents[_0x39ec9e[_0xe593('0x38')]])){utils['debug'](util['format'](_0xe593('0x39'),_0x39ec9e[_0xe593('0x14')]),_0x39ec9e);utils['info'](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x39ec9e['uniqueid'],agents[_0x39ec9e['transfereruniqueid']][_0xe593('0x8')],agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x14')]));agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3a')]=!![];agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3b')]=_0xe593('0x3c');agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3d')]=_0x39ec9e[_0xe593('0x3e')];agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x3f')]=agents[_0x39ec9e[_0xe593('0x38')]][_0xe593('0x14')];}}catch(_0x46544d){utils['error'](util[_0xe593('0x4')](_0xe593('0x39'),_0x39ec9e[_0xe593('0x14')]),_0x46544d);}};exports[_0xe593('0x40')]=function(_0x1204d8){try{utils[_0xe593('0x17')](util[_0xe593('0x4')](_0xe593('0x41'),_0x1204d8[_0xe593('0x42')]),_0x1204d8);if(_0x1204d8[_0xe593('0x42')]==_0x1204d8[_0xe593('0x43')]){if(!_[_0xe593('0x37')](agents[_0x1204d8[_0xe593('0x44')]])){utils[_0xe593('0x3')](util[_0xe593('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1204d8[_0xe593('0x42')],agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x8')]));agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x3a')]=!![];agents[_0x1204d8['secondtransfereruniqueid']]['transfertype']=_0xe593('0x45');agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x3d')]=_0x1204d8[_0xe593('0x46')];agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x3f')]=_0x1204d8[_0xe593('0x42')];}if(_0x1204d8['transfereeuniqueid']&&agents[_0x1204d8['transfereeuniqueid']]){agents[_0x1204d8[_0xe593('0x47')]][_0xe593('0x48')]=0x1;transfers[_0x1204d8['transfereeuniqueid']]=_[_0xe593('0x49')](agents[_0x1204d8[_0xe593('0x47')]]);transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0xa')]=agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0xa')];transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0x4a')]=agents[_0x1204d8[_0xe593('0x44')]][_0xe593('0x4a')];transfers[_0x1204d8['transfereeuniqueid']][_0xe593('0x18')]=utils[_0xe593('0x19')]();transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0x35')]=utils[_0xe593('0x19')]();transfers[_0x1204d8[_0xe593('0x47')]][_0xe593('0x23')]=0x0;transfers[_0x1204d8['transfereeuniqueid']][_0xe593('0x48')]=0x2;}}else if(_0x1204d8[_0xe593('0x44')]==_0x1204d8[_0xe593('0x4b')]){if(!_[_0xe593('0x37')](agents[_0x1204d8['origtransfereruniqueid']])){utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x4c'),_0x1204d8[_0xe593('0x42')],agents[_0x1204d8[_0xe593('0x42')]]['membername']));agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x3a')]=!![];agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x3b')]=_0xe593('0x45');agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x3d')]=_0x1204d8[_0xe593('0x4d')];agents[_0x1204d8['origtransfereruniqueid']][_0xe593('0x3f')]=_0x1204d8[_0xe593('0x44')];}if(_0x1204d8[_0xe593('0x4e')]&&agents[_0x1204d8[_0xe593('0x4e')]]){agents[_0x1204d8[_0xe593('0x4e')]][_0xe593('0x48')]=0x1;transfers[_0x1204d8[_0xe593('0x4e')]]=_[_0xe593('0x49')](agents[_0x1204d8[_0xe593('0x4e')]]);transfers[_0x1204d8[_0xe593('0x4e')]]['calleridnum']=agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0xa')];transfers[_0x1204d8[_0xe593('0x4e')]]['calleridname']=agents[_0x1204d8[_0xe593('0x42')]][_0xe593('0x4a')];transfers[_0x1204d8[_0xe593('0x4e')]][_0xe593('0x18')]=utils[_0xe593('0x19')]();transfers[_0x1204d8['transfertargetuniqueid']][_0xe593('0x35')]=utils[_0xe593('0x19')]();transfers[_0x1204d8['transfertargetuniqueid']][_0xe593('0x23')]=0x0;transfers[_0x1204d8[_0xe593('0x4e')]][_0xe593('0x48')]=0x2;}}}catch(_0x3486b3){utils['error'](util[_0xe593('0x4')](_0xe593('0x41'),_0x1204d8[_0xe593('0x42')]),_0x3486b3);}};exports['hangup']=function(_0x43dcb0){try{utils[_0xe593('0x17')](util[_0xe593('0x4')]('[%s][agents][hangup]',_0x43dcb0[_0xe593('0x14')]),_0x43dcb0);if(agents[_0x43dcb0[_0xe593('0x14')]]&&agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]===_0xe593('0x22')){if(_0x43dcb0['cause']==='21'){agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]=_0xe593('0x4f');agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]=_0xe593('0x4f');}utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x50'),_0x43dcb0[_0xe593('0x14')],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x8')],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')],agents[_0x43dcb0['uniqueid']][_0xe593('0xc')]));writeDB(agents[_0x43dcb0[_0xe593('0x14')]]);var _0x9427d6=unanswered[_0xe593('0x51')](_0x43dcb0[_0xe593('0x14')]);if(_0x9427d6>-0x1){unanswered[_0xe593('0x52')](_0x9427d6,0x1);}}if(transfers[_0x43dcb0[_0xe593('0x14')]]){transfers[_0x43dcb0[_0xe593('0x14')]]['agentcomplete']=!![];transfers[_0x43dcb0['uniqueid']]['agentcompleteAt']=utils[_0xe593('0x19')]();transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2d')]=utils['diffTime'](transfers[_0x43dcb0['uniqueid']][_0xe593('0x34')],transfers[_0x43dcb0['uniqueid']][_0xe593('0x35')]);transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]='agent';transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]=_0xe593('0x36');utils[_0xe593('0x3')](util[_0xe593('0x4')](_0xe593('0x50'),_0x43dcb0[_0xe593('0x14')],transfers[_0x43dcb0['uniqueid']][_0xe593('0x8')],transfers[_0x43dcb0[_0xe593('0x14')]]['reason'],transfers[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]));writeDB(transfers[_0x43dcb0[_0xe593('0x14')]],!![]);}if(agents[_0x43dcb0['uniqueid']]&&agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x35')]){agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x33')]=!![];agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x34')]=utils['now']();agents[_0x43dcb0['uniqueid']][_0xe593('0x2d')]=utils['diffTime'](agents[_0x43dcb0['uniqueid']]['agentcompleteAt'],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x35')]);agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0x2c')]=agents[_0x43dcb0[_0xe593('0x14')]]['transfer']?'transfer':_0xe593('0x53');agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]=_0xe593('0x36');utils['info'](util[_0xe593('0x4')](_0xe593('0x50'),_0x43dcb0[_0xe593('0x14')],agents[_0x43dcb0['uniqueid']][_0xe593('0x8')],agents[_0x43dcb0[_0xe593('0x14')]]['reason'],agents[_0x43dcb0[_0xe593('0x14')]][_0xe593('0xc')]));writeDB(agents[_0x43dcb0['uniqueid']]);}}catch(_0x5bb9e2){utils['error'](util['format']('[%s][agents][hangup]',_0x43dcb0['uniqueid']),_0x5bb9e2);}}; \ No newline at end of file +var _0x0102=['agentringnoanswerAt','now','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','util','./utils','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]'];(function(_0x82e902,_0x22084e){var _0x2d69a4=function(_0x4b2e21){while(--_0x4b2e21){_0x82e902['push'](_0x82e902['shift']());}};_0x2d69a4(++_0x22084e);}(_0x0102,0x186));var _0x2010=function(_0x2aa927,_0x175b23){_0x2aa927=_0x2aa927-0x0;var _0x3ae692=_0x0102[_0x2aa927];return _0x3ae692;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var utils=require(_0x2010('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34c31e,_0x9ae519){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34c31e['uniqueid'],_0x34c31e['channel'],_0x34c31e[_0x2010('0x2')],_0x34c31e[_0x2010('0x3')],_0x34c31e[_0x2010('0x4')],_0x34c31e[_0x2010('0x5')],_0x34c31e['connectedlinenum'],_0x34c31e[_0x2010('0x6')]));if(_0x34c31e['queue']){utils[_0x2010('0x7')](_0x34c31e[_0x2010('0x2')])['then'](function(_0x1f94ca){if(_0x1f94ca){_0x34c31e[_0x2010('0x8')]=_0x1f94ca[_0x2010('0x8')];_0x34c31e[_0x2010('0x9')]=_0x34c31e[_0x2010('0xa')]?_0x1f94ca[_0x2010('0xb')]:![];_0x34c31e[_0x2010('0xc')]=_0x34c31e[_0x2010('0x9')]?_0x1f94ca[_0x2010('0xd')]:0x0;}utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);});}else{utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);}if(_0x9ae519){delete transfers[_0x34c31e[_0x2010('0x10')]];}else{delete agents[_0x34c31e[_0x2010('0x11')]];}}exports[_0x2010('0x12')]=function(_0x528a38){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38[_0x2010('0x10')]),_0x528a38);agents[_0x528a38[_0x2010('0x11')]]=_0x528a38;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x15')]=utils['now']();agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x6')]='called';agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x16')]=null;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x17')]=null;utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x19'),_0x528a38[_0x2010('0x10')],agents[_0x528a38[_0x2010('0x11')]]['membername'],_0x528a38['destuniqueid']));}catch(_0x3c72a8){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38['uniqueid']),_0x3c72a8);}};exports['agentringnoanswer']=function(_0x22c252){try{if(!_[_0x2010('0x1b')](agents[_0x22c252[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x1d'),_0x22c252['uniqueid']),_0x22c252);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x22c252['uniqueid'],agents[_0x22c252['destuniqueid']][_0x2010('0x3')],_0x22c252['destuniqueid']));agents[_0x22c252[_0x2010('0x11')]]['agentringnoanswer']=!![];agents[_0x22c252['destuniqueid']][_0x2010('0x1e')]=utils[_0x2010('0x1f')]();agents[_0x22c252['destuniqueid']][_0x2010('0x6')]='timeout';agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x20')]=_0x2010('0x21');agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x22')]=_0x22c252[_0x2010('0x23')]?parseInt(_0x22c252[_0x2010('0x23')])/0x3e8:0x0;agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x24')]=0x0;unanswered[_0x2010('0x25')](_0x22c252[_0x2010('0x11')]);}}catch(_0x2ebdbb){utils['error'](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]',_0x22c252[_0x2010('0x10')]),_0x2ebdbb);}};exports[_0x2010('0x26')]=function(_0xd16c04){try{_[_0x2010('0x27')](agents,function(_0x564a64,_0x554f66){if(_0x564a64[_0x2010('0x10')]==_0xd16c04['uniqueid']&&!_[_0x2010('0x28')](unanswered,_0x564a64[_0x2010('0x11')])){utils['debug'](util[_0x2010('0x13')](_0x2010('0x29'),_0xd16c04[_0x2010('0x10')]),_0xd16c04);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd16c04[_0x2010('0x10')],_0x564a64[_0x2010('0x3')],_0x564a64[_0x2010('0x11')]));_0x564a64['agentringnoanswer']=!![];_0x564a64['agentringnoanswerAt']=utils[_0x2010('0x1f')]();_0x564a64[_0x2010('0x6')]=_0x2010('0x2a');_0x564a64['reason']='abandoned';_0x564a64[_0x2010('0x22')]=_0xd16c04[_0x2010('0x22')];_0x564a64[_0x2010('0x24')]=0x0;writeDB(_0x564a64);}});}catch(_0x339fd2){utils[_0x2010('0x1a')](util['format']('[%s][agents][queuecallerabandon]',_0xd16c04['uniqueid']),_0x339fd2);}};exports[_0x2010('0x2b')]=function(_0x447eed){try{if(agents[_0x447eed[_0x2010('0x11')]]){utils['debug'](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x447eed);utils[_0x2010('0x18')](util['format'](_0x2010('0x2d'),_0x447eed[_0x2010('0x10')],agents[_0x447eed[_0x2010('0x11')]]['membername'],_0x447eed[_0x2010('0x11')]));agents[_0x447eed['destuniqueid']][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x16')]=_0x447eed[_0x2010('0x16')];agents[_0x447eed[_0x2010('0x11')]]['connectedlinename']=_0x447eed[_0x2010('0x17')];agents[_0x447eed['destuniqueid']][_0x2010('0x22')]=_0x447eed[_0x2010('0x23')];agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x2f');_[_0x2010('0x27')](agents,function(_0x398f10,_0x36ff3e){if(_0x398f10[_0x2010('0x11')]!=_0x447eed[_0x2010('0x11')]&&_0x398f10[_0x2010('0x10')]==_0x447eed[_0x2010('0x10')]){_0x398f10[_0x2010('0x24')]=0x0;_0x398f10[_0x2010('0x22')]=_0x447eed['ringtime'];_0x398f10['agentringnoanswer']=!![];_0x398f10[_0x2010('0x1e')]=utils[_0x2010('0x1f')]();_0x398f10[_0x2010('0x6')]=_0x2010('0x30');_0x398f10[_0x2010('0x20')]=_0x2010('0x30');_0x398f10[_0x2010('0x31')]=_0x447eed['destuniqueid'];_0x398f10[_0x2010('0x32')]=_0x447eed['membername'];writeDB(_0x398f10);}});}}catch(_0x27fd64){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x27fd64);}};exports['agentcomplete']=function(_0x364338){try{if(!_[_0x2010('0x1b')](agents[_0x364338[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util['format'](_0x2010('0x33'),_0x364338['uniqueid']),_0x364338);utils['info'](util['format'](_0x2010('0x34'),_0x364338[_0x2010('0x10')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x3')],_0x364338[_0x2010('0x11')]));agents[_0x364338[_0x2010('0x11')]]['agentcomplete']=!![];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();agents[_0x364338['destuniqueid']]['talktime']=utils[_0x2010('0x36')](agents[_0x364338['destuniqueid']][_0x2010('0x35')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x2e')]);agents[_0x364338[_0x2010('0x11')]]['reason']=_0x364338[_0x2010('0x20')];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x37');writeDB(agents[_0x364338[_0x2010('0x11')]]);}}catch(_0x2a53b3){utils['error'](util[_0x2010('0x13')](_0x2010('0x33'),_0x364338[_0x2010('0x10')]),_0x2a53b3);}};exports['blindtransfer']=function(_0x30e5d0){try{if(!_[_0x2010('0x1b')](agents[_0x30e5d0['transfereruniqueid']])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x30e5d0);utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x39'),_0x30e5d0[_0x2010('0x10')],agents[_0x30e5d0['transfereruniqueid']]['membername'],agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')]));agents[_0x30e5d0['transfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3c')]=_0x2010('0x3d');agents[_0x30e5d0[_0x2010('0x3a')]]['transferexten']=_0x30e5d0['extension'];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3e')]=agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')];}}catch(_0x38e596){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x38e596);}};exports[_0x2010('0x3f')]=function(_0x1cc164){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x40'),_0x1cc164['origtransfereruniqueid']),_0x1cc164);if(_0x1cc164[_0x2010('0x41')]==_0x1cc164[_0x2010('0x42')]){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x43')]])){utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3')]));agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3b')]=!![];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x46')]=_0x1cc164[_0x2010('0x47')];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3e')]=_0x1cc164[_0x2010('0x41')];}if(_0x1cc164[_0x2010('0x48')]&&agents[_0x1cc164[_0x2010('0x48')]]){agents[_0x1cc164['transfereeuniqueid']][_0x2010('0x49')]=0x1;transfers[_0x1cc164['transfereeuniqueid']]=_['clone'](agents[_0x1cc164[_0x2010('0x48')]]);transfers[_0x1cc164[_0x2010('0x48')]]['calleridnum']=agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x4a')]=agents[_0x1cc164['secondtransfereruniqueid']][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x15')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164['transfereeuniqueid']][_0x2010('0x2e')]=utils['now']();transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x49')]=0x2;}}else if(_0x1cc164['secondtransfereruniqueid']==_0x1cc164['secondtransfererlinkedid']){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x41')]])){utils['info'](util['format'](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3')]));agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x46')]=_0x1cc164['secondtransfererexten'];agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3e')]=_0x1cc164['secondtransfereruniqueid'];}if(_0x1cc164[_0x2010('0x4b')]&&agents[_0x1cc164[_0x2010('0x4b')]]){agents[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x49')]=0x1;transfers[_0x1cc164[_0x2010('0x4b')]]=_[_0x2010('0x4c')](agents[_0x1cc164[_0x2010('0x4b')]]);transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x5')]=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x4b')]]['calleridname']=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x4b')]]['agentcalledAt']=utils['now']();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x4b')]]['agententerreason']=0x2;}}}catch(_0xe37cef){utils[_0x2010('0x1a')](util[_0x2010('0x13')]('[%s][agents][attendedtransfer]',_0x1cc164[_0x2010('0x41')]),_0xe37cef);}};exports[_0x2010('0x4d')]=function(_0x13d06d){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x4e'),_0x13d06d['uniqueid']),_0x13d06d);if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]]['reason']==='timeout'){if(_0x13d06d[_0x2010('0x4f')]==='21'){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')]=_0x2010('0x50');agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x50');}utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3')],agents[_0x13d06d['uniqueid']][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d[_0x2010('0x10')]]);var _0x517afa=unanswered[_0x2010('0x52')](_0x13d06d[_0x2010('0x10')]);if(_0x517afa>-0x1){unanswered['splice'](_0x517afa,0x1);}}if(transfers[_0x13d06d['uniqueid']]){transfers[_0x13d06d[_0x2010('0x10')]]['agentcomplete']=!![];transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x24')]=utils[_0x2010('0x36')](transfers[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]);transfers[_0x13d06d[_0x2010('0x10')]]['reason']=_0x2010('0x53');transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d[_0x2010('0x10')],transfers[_0x13d06d['uniqueid']][_0x2010('0x3')],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],transfers[_0x13d06d['uniqueid']][_0x2010('0x6')]));writeDB(transfers[_0x13d06d[_0x2010('0x10')]],!![]);}if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0xa')]=!![];agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt']=utils[_0x2010('0x1f')]();agents[_0x13d06d[_0x2010('0x10')]]['talktime']=utils[_0x2010('0x36')](agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],agents[_0x13d06d[_0x2010('0x10')]]['agentconnectAt']);agents[_0x13d06d['uniqueid']][_0x2010('0x20')]=agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3b')]?_0x2010('0x3b'):_0x2010('0x53');agents[_0x13d06d[_0x2010('0x10')]]['lastevent']=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]]['membername'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d['uniqueid']]);}}catch(_0x496280){utils['error'](util[_0x2010('0x13')]('[%s][agents][hangup]',_0x13d06d[_0x2010('0x10')]),_0x496280);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e545426..d9484db 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 _0x0958=['set','startsWith','appdata','toLowerCase','cdr','split','lastIndexOf','includes','hangup','execif','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','blinds','recording','newchannel','[%s][calls][newchannel]','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','answertime','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x377f32,_0x2b032c){var _0x43a1b0=function(_0x485f4c){while(--_0x485f4c){_0x377f32['push'](_0x377f32['shift']());}};_0x43a1b0(++_0x2b032c);}(_0x0958,0x7c));var _0x8095=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0958[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var utils=require(_0x8095('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x8095('0x3'),_0x8095('0x4'),'FAILED','NO\x20ANSWER',_0x8095('0x3'),_0x8095('0x3'),'ANSWERED','BUSY',_0x8095('0x4'),_0x8095('0x4'),_0x8095('0x4')];var channels={};function writeDB(_0x1dac39){var _0x1fac84;if(transfers['blinds'][_0x1dac39['uniqueid']]){_0x1fac84=_0x1dac39[_0x8095('0x5')];_0x1dac39[_0x8095('0x5')]=transfers['blinds'][_0x1dac39['uniqueid']][_0x8095('0x6')];}utils['info'](util[_0x8095('0x7')](_0x8095('0x8'),_0x1dac39[_0x8095('0x5')],_0x1dac39[_0x8095('0x9')],_0x1dac39[_0x8095('0xa')],_0x1dac39['membername'],_0x1dac39[_0x8095('0xb')],_0x1dac39['calleridnum'],_0x1dac39[_0x8095('0xc')],_0x1dac39[_0x8095('0xd')]));if(_0x1dac39[_0x8095('0xe')]){utils[_0x8095('0xf')](_0x1dac39[_0x8095('0xe')])[_0x8095('0x10')](function(_0x5cfc5f){if(_0x5cfc5f){_0x1dac39[_0x8095('0x11')]=_0x5cfc5f['id'];}utils[_0x8095('0x12')](_0x8095('0x13'),_0x1dac39);});}else{utils['request'](_0x8095('0x13'),_0x1dac39);}if(channels[_0x1dac39[_0x8095('0x5')]]){delete channels[_0x1dac39[_0x8095('0x5')]];}else if(_0x1fac84&&channels[_0x1fac84]){if(!transfers[_0x8095('0x14')][_0x1fac84][_0x8095('0x15')])delete transfers['blinds'][_0x1fac84];delete channels[_0x1fac84];}}exports[_0x8095('0x16')]=function(_0x463d6e){try{utils['debug'](util['format'](_0x8095('0x17'),_0x463d6e['uniqueid']),_0x463d6e);if(_0x463d6e[_0x8095('0x5')]==_0x463d6e[_0x8095('0x18')]&&_0x463d6e[_0x8095('0x9')]!='OutgoingSpoolFailed'){utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x1a'),_0x463d6e['uniqueid'],_0x463d6e[_0x8095('0x1b')],_0x463d6e[_0x8095('0x1c')]));channels[_0x463d6e[_0x8095('0x5')]]={'uniqueid':_0x463d6e['uniqueid'],'accountcode':_0x463d6e[_0x8095('0xe')],'source':_0x463d6e['calleridnum'],'destination':_0x463d6e[_0x8095('0x1c')],'destinationcontext':_0x463d6e[_0x8095('0x1b')],'channel':_0x463d6e[_0x8095('0x9')],'starttime':utils[_0x8095('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x8095('0x3'),'amaflags':_0x8095('0x1e')};}}catch(_0x2a7bb6){utils[_0x8095('0x1f')](util[_0x8095('0x7')](_0x8095('0x17'),_0x463d6e[_0x8095('0x5')]),_0x2a7bb6);}};exports[_0x8095('0x20')]=function(_0x33397a){try{utils[_0x8095('0x21')](util['format']('[%s][calls][newstate]',_0x33397a[_0x8095('0x5')]),_0x33397a);if(!_[_0x8095('0x22')](channels[_0x33397a[_0x8095('0x5')]])&&_0x33397a[_0x8095('0x23')]==0x6){utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x24'),_0x33397a[_0x8095('0x5')],_0x33397a[_0x8095('0x1b')],_0x33397a[_0x8095('0x9')]));if(_[_0x8095('0x22')](channels[_0x33397a[_0x8095('0x5')]][_0x8095('0x25')])){channels[_0x33397a[_0x8095('0x5')]][_0x8095('0x25')]=utils[_0x8095('0x1d')]();}}else if(!_[_0x8095('0x22')](channels[_0x33397a[_0x8095('0x18')]])&&_0x33397a['channelstate']==0x6&&_0x33397a[_0x8095('0x1b')]!=_0x8095('0x26')){utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x27'),_0x33397a[_0x8095('0x5')],_0x33397a[_0x8095('0x18')],_0x33397a['context'],_0x33397a['channel']));channels[_0x33397a['linkedid']][_0x8095('0xe')]=_0x33397a['accountcode'];channels[_0x33397a[_0x8095('0x18')]][_0x8095('0x28')]=_0x33397a[_0x8095('0x9')];if(_[_0x8095('0x22')](channels[_0x33397a[_0x8095('0x18')]]['answertime'])){channels[_0x33397a['linkedid']]['answertime']=utils[_0x8095('0x1d')]();}channels[_0x33397a[_0x8095('0x18')]][_0x8095('0x29')]=dispositions[_[_0x8095('0x2a')](_0x33397a[_0x8095('0x23')])]||'ANSWERED';}}catch(_0xf83cdc){utils[_0x8095('0x1f')](util['format'](_0x8095('0x2b'),_0x33397a[_0x8095('0x5')]),_0xf83cdc);}};exports['hangup']=function(_0x6ce708){try{if(!_[_0x8095('0x22')](channels[_0x6ce708[_0x8095('0x5')]])){utils[_0x8095('0x21')](util['format'](_0x8095('0x2c'),_0x6ce708[_0x8095('0x5')]),_0x6ce708);if(_[_0x8095('0x22')](channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x2d')])){channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x2d')]=_0x6ce708['calleridname']+'\x20<'+_0x6ce708[_0x8095('0x2e')]+'>';}utils[_0x8095('0x19')](util['format'](_0x8095('0x2f'),_0x6ce708[_0x8095('0x5')],channels[_0x6ce708[_0x8095('0x5')]]['callerid'],_0x6ce708[_0x8095('0x30')]));channels[_0x6ce708[_0x8095('0x5')]]['endtime']=utils[_0x8095('0x1d')]();channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x31')]=utils[_0x8095('0x32')](channels[_0x6ce708['uniqueid']][_0x8095('0x33')],channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x34')]);channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x35')]=channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x36')]?utils['diffTime'](channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x33')],channels[_0x6ce708[_0x8095('0x5')]][_0x8095('0x36')]):0x0;writeDB(channels[_0x6ce708['uniqueid']]);}}catch(_0x202a0f){utils[_0x8095('0x1f')](util['format'](_0x8095('0x2c'),_0x6ce708['uniqueid']),_0x202a0f);}};exports[_0x8095('0x37')]=function(_0x2aeac2){try{if(!_[_0x8095('0x22')](channels[_0x2aeac2[_0x8095('0x38')]])){utils[_0x8095('0x21')](util['format']('[%s][calls][attendedtransfer]',_0x2aeac2['origtransfereruniqueid']),_0x2aeac2);if(channels[_0x2aeac2[_0x8095('0x38')]][_0x8095('0x9')]==_0x2aeac2[_0x8095('0x39')]){utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x3a'),_0x2aeac2[_0x8095('0x3b')],_0x2aeac2[_0x8095('0x38')],_0x2aeac2[_0x8095('0x3c')]));channels[_0x2aeac2[_0x8095('0x38')]][_0x8095('0x28')]=_0x2aeac2[_0x8095('0x3c')];channels[_0x2aeac2[_0x8095('0x38')]]['userfield']=_0x8095('0x3d');}else if(channels[_0x2aeac2[_0x8095('0x38')]]['channel']=_0x2aeac2[_0x8095('0x3e')]){utils['info'](util[_0x8095('0x7')](_0x8095('0x3a'),_0x2aeac2[_0x8095('0x3b')],_0x2aeac2[_0x8095('0x38')],_0x2aeac2[_0x8095('0x3f')]));channels[_0x2aeac2[_0x8095('0x38')]][_0x8095('0x28')]=_0x2aeac2[_0x8095('0x3f')];channels[_0x2aeac2['localtwolinkedid']][_0x8095('0x40')]=_0x8095('0x3d');}}}catch(_0x27d78f){utils[_0x8095('0x1f')](util[_0x8095('0x7')](_0x8095('0x41'),_0x2aeac2[_0x8095('0x3b')]),_0x27d78f);}};exports[_0x8095('0x42')]=function(_0x2893aa){try{if(!_[_0x8095('0x22')](channels[_0x2893aa[_0x8095('0x5')]])){utils[_0x8095('0x21')](util['format'](_0x8095('0x43'),_0x2893aa['uniqueid']),_0x2893aa);channels[_0x2893aa['uniqueid']][_0x8095('0x44')]=utils[_0x8095('0x1d')]();utils['info'](util['format'](_0x8095('0x45'),_0x2893aa[_0x8095('0x5')],channels[_0x2893aa['uniqueid']][_0x8095('0x44')]));}}catch(_0x238962){utils[_0x8095('0x1f')](util[_0x8095('0x7')](_0x8095('0x43'),_0x2893aa[_0x8095('0x5')]),_0x238962);}};exports[_0x8095('0x46')]=function(_0x5e6764){try{if(!_['isNil'](channels[_0x5e6764[_0x8095('0x5')]])){utils['debug'](util[_0x8095('0x7')]('[%s][calls][musiconholdstop]',_0x5e6764[_0x8095('0x5')]),_0x5e6764);if(!_[_0x8095('0x22')](channels[_0x5e6764['uniqueid']][_0x8095('0x44')])){channels[_0x5e6764[_0x8095('0x5')]]['mohtime']+=utils[_0x8095('0x32')](utils['now'](),channels[_0x5e6764[_0x8095('0x5')]]['musiconholdstartAt']);utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x47'),_0x5e6764[_0x8095('0x5')],channels[_0x5e6764[_0x8095('0x5')]][_0x8095('0x48')]));delete channels[_0x5e6764['uniqueid']][_0x8095('0x44')];}}}catch(_0x33fec2){utils[_0x8095('0x1f')](util[_0x8095('0x7')](_0x8095('0x49'),_0x5e6764['uniqueid']),_0x33fec2);}};exports[_0x8095('0x4a')]=function(_0x3f80c0){try{if(!_[_0x8095('0x22')](channels[_0x3f80c0[_0x8095('0x5')]])){utils[_0x8095('0x21')](util['format'](_0x8095('0x4b'),_0x3f80c0['uniqueid']),_0x3f80c0);if(!_[_0x8095('0x22')](_0x3f80c0['variable']['xmd-originatecalleridnum'])){utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x4c'),_0x3f80c0[_0x8095('0x5')],_0x3f80c0[_0x8095('0x4d')]));channels[_0x3f80c0[_0x8095('0x5')]]['source']=_0x3f80c0[_0x8095('0x4d')];}if(!_[_0x8095('0x22')](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x4f')])){utils['info'](util[_0x8095('0x7')](_0x8095('0x50'),_0x3f80c0['uniqueid'],_0x3f80c0[_0x8095('0x4d')]));channels[_0x3f80c0[_0x8095('0x5')]][_0x8095('0x51')]=_0x3f80c0[_0x8095('0x4d')];channels[_0x3f80c0[_0x8095('0x5')]][_0x8095('0x2d')]='\x22'+_0x3f80c0[_0x8095('0x4d')]+_0x8095('0x52')+_0x3f80c0[_0x8095('0x4d')]+'>';}if(!_[_0x8095('0x22')](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x53')])||!_[_0x8095('0x22')](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x54')])){utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x55'),_0x3f80c0[_0x8095('0x5')],!_[_0x8095('0x22')](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x53')])?_0x8095('0x53'):_0x8095('0x54'),_0x3f80c0[_0x8095('0x4d')]));channels[_0x3f80c0['uniqueid']][_0x8095('0x2d')]=_0x3f80c0['value'];}if(!_[_0x8095('0x22')](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x56')])||!_['isNil'](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x57')])){utils['info'](util[_0x8095('0x7')](_0x8095('0x55'),_0x3f80c0[_0x8095('0x5')],!_[_0x8095('0x22')](_0x3f80c0['variable'][_0x8095('0x56')])?_0x8095('0x56'):'xmcs-queue',_0x3f80c0[_0x8095('0x4d')]));channels[_0x3f80c0[_0x8095('0x5')]][_0x8095('0x58')]='Queue';channels[_0x3f80c0['uniqueid']]['lastdata']=_0x3f80c0[_0x8095('0x4d')];channels[_0x3f80c0[_0x8095('0x5')]][_0x8095('0xa')]=!![];}if(!_['isNil'](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x59')])){utils['info'](util[_0x8095('0x7')](_0x8095('0x5a'),_0x3f80c0['uniqueid'],_0x3f80c0[_0x8095('0x4d')]));channels[_0x3f80c0['uniqueid']][_0x8095('0x5b')]=_0x3f80c0[_0x8095('0x4d')];}if(!_[_0x8095('0x22')](_0x3f80c0[_0x8095('0x4e')][_0x8095('0x5c')])){utils[_0x8095('0x19')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3f80c0[_0x8095('0x5')],_0x3f80c0[_0x8095('0x4d')]));channels[_0x3f80c0[_0x8095('0x5')]][_0x8095('0x5d')]=_0x3f80c0[_0x8095('0x4d')];}if(!_['isNil'](_0x3f80c0[_0x8095('0x4e')]['outboundrouteid'])){utils['info'](util[_0x8095('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x3f80c0[_0x8095('0x5')],_0x3f80c0['value']));channels[_0x3f80c0[_0x8095('0x5')]][_0x8095('0x5e')]=_0x3f80c0[_0x8095('0x4d')];}if(!_[_0x8095('0x22')](_0x3f80c0[_0x8095('0x4e')]['sipcallid'])){utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x5f'),_0x3f80c0['uniqueid'],_0x3f80c0[_0x8095('0x4d')]));channels[_0x3f80c0[_0x8095('0x5')]][_0x8095('0x60')]=_0x3f80c0['value'];}}}catch(_0x17a5c6){utils['error'](util[_0x8095('0x7')]('[%s][calls][varset]',_0x3f80c0['uniqueid']),_0x17a5c6);}};exports['newexten']=function(_0x48840a){try{if(!_[_0x8095('0x22')](channels[_0x48840a[_0x8095('0x5')]])){utils[_0x8095('0x21')](util[_0x8095('0x7')](_0x8095('0x61'),_0x48840a[_0x8095('0x5')]),_0x48840a);utils[_0x8095('0x19')](util[_0x8095('0x7')](_0x8095('0x62'),_0x48840a['uniqueid'],_0x48840a['application'],_0x48840a['appdata']));if(_0x48840a[_0x8095('0x63')]['toLowerCase']()==_0x8095('0x64')&&_[_0x8095('0x65')](_0x48840a[_0x8095('0x66')][_0x8095('0x67')](),_0x8095('0x68'))){var _0x103a10=_0x48840a[_0x8095('0x66')][_0x8095('0x69')]('=');var _0x44019e=_0x103a10[0x0]['substring'](_0x103a10[0x0][_0x8095('0x6a')]('(')+0x1,_0x103a10[0x0][_0x8095('0x6a')](')'));var _0x501785=_0x103a10[0x1];channels[_0x48840a[_0x8095('0x5')]][_0x44019e]=_0x501785;}if(!_[_0x8095('0x6b')]([_0x8095('0x6c'),'noop',_0x8095('0x6d'),_0x8095('0x64'),_0x8095('0x6e')],_0x48840a[_0x8095('0x63')]['toLowerCase']())){channels[_0x48840a[_0x8095('0x5')]]['lastapplication']=_0x48840a['application'];channels[_0x48840a[_0x8095('0x5')]][_0x8095('0x6f')]=_0x48840a[_0x8095('0x66')];}}}catch(_0x4a1427){utils[_0x8095('0x1f')](util[_0x8095('0x7')](_0x8095('0x61'),_0x48840a[_0x8095('0x5')]),_0x4a1427);}}; \ No newline at end of file +var _0x4d0a=['error','[%s][calls][newchannel]','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','channelstate','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','noop','execif','lastdata','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','interface','calleridnum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten','now'];(function(_0x21a96a,_0x30cd97){var _0x12ed92=function(_0x4f3f04){while(--_0x4f3f04){_0x21a96a['push'](_0x21a96a['shift']());}};_0x12ed92(++_0x30cd97);}(_0x4d0a,0x176));var _0xa4d0=function(_0x48370f,_0x1625c7){_0x48370f=_0x48370f-0x0;var _0x403bc0=_0x4d0a[_0x48370f];return _0x403bc0;};'use strict';var _=require(_0xa4d0('0x0'));var util=require(_0xa4d0('0x1'));var utils=require(_0xa4d0('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xa4d0('0x3'),'FAILED','FAILED',_0xa4d0('0x3'),_0xa4d0('0x3'),_0xa4d0('0x3'),_0xa4d0('0x4'),_0xa4d0('0x5'),_0xa4d0('0x6'),_0xa4d0('0x6'),_0xa4d0('0x6')];var channels={};function writeDB(_0x651319){var _0xa93428;if(transfers[_0xa4d0('0x7')][_0x651319[_0xa4d0('0x8')]]){_0xa93428=_0x651319['uniqueid'];_0x651319[_0xa4d0('0x8')]=transfers[_0xa4d0('0x7')][_0x651319[_0xa4d0('0x8')]][_0xa4d0('0x9')];}utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x651319[_0xa4d0('0x8')],_0x651319[_0xa4d0('0xc')],_0x651319[_0xa4d0('0xd')],_0x651319[_0xa4d0('0xe')],_0x651319[_0xa4d0('0xf')],_0x651319[_0xa4d0('0x10')],_0x651319['connectedlinenum'],_0x651319[_0xa4d0('0x11')]));if(_0x651319[_0xa4d0('0x12')]){utils['getUserByInternal'](_0x651319[_0xa4d0('0x12')])[_0xa4d0('0x13')](function(_0x447e68){if(_0x447e68){_0x651319[_0xa4d0('0x14')]=_0x447e68['id'];}utils['request'](_0xa4d0('0x15'),_0x651319);});}else{utils[_0xa4d0('0x16')](_0xa4d0('0x15'),_0x651319);}if(channels[_0x651319[_0xa4d0('0x8')]]){delete channels[_0x651319[_0xa4d0('0x8')]];}else if(_0xa93428&&channels[_0xa93428]){if(!transfers['blinds'][_0xa93428]['recording'])delete transfers[_0xa4d0('0x7')][_0xa93428];delete channels[_0xa93428];}}exports[_0xa4d0('0x17')]=function(_0x59390d){try{utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')]('[%s][calls][newchannel]',_0x59390d[_0xa4d0('0x8')]),_0x59390d);if(_0x59390d[_0xa4d0('0x8')]==_0x59390d[_0xa4d0('0x19')]&&_0x59390d[_0xa4d0('0xc')]!=_0xa4d0('0x1a')){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x59390d[_0xa4d0('0x8')],_0x59390d[_0xa4d0('0x1b')],_0x59390d[_0xa4d0('0x1c')]));channels[_0x59390d[_0xa4d0('0x8')]]={'uniqueid':_0x59390d[_0xa4d0('0x8')],'accountcode':_0x59390d[_0xa4d0('0x12')],'source':_0x59390d[_0xa4d0('0x10')],'destination':_0x59390d['exten'],'destinationcontext':_0x59390d[_0xa4d0('0x1b')],'channel':_0x59390d[_0xa4d0('0xc')],'starttime':utils[_0xa4d0('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa4d0('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x5c2a4a){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x1f'),_0x59390d[_0xa4d0('0x8')]),_0x5c2a4a);}};exports['newstate']=function(_0x21f83a){try{utils['debug'](util[_0xa4d0('0xb')]('[%s][calls][newstate]',_0x21f83a['uniqueid']),_0x21f83a);if(!_[_0xa4d0('0x20')](channels[_0x21f83a[_0xa4d0('0x8')]])&&_0x21f83a['channelstate']==0x6){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x21f83a[_0xa4d0('0x8')],_0x21f83a[_0xa4d0('0x1b')],_0x21f83a[_0xa4d0('0xc')]));if(_[_0xa4d0('0x20')](channels[_0x21f83a['uniqueid']][_0xa4d0('0x21')])){channels[_0x21f83a['uniqueid']][_0xa4d0('0x21')]=utils[_0xa4d0('0x1d')]();}}else if(!_['isNil'](channels[_0x21f83a['linkedid']])&&_0x21f83a['channelstate']==0x6&&_0x21f83a[_0xa4d0('0x1b')]!=_0xa4d0('0x22')){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x23'),_0x21f83a['uniqueid'],_0x21f83a[_0xa4d0('0x19')],_0x21f83a[_0xa4d0('0x1b')],_0x21f83a[_0xa4d0('0xc')]));channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x12')]=_0x21f83a[_0xa4d0('0x12')];channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x24')]=_0x21f83a[_0xa4d0('0xc')];if(_[_0xa4d0('0x20')](channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x25')])){channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x25')]=utils['now']();}channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x26')]=dispositions[_[_0xa4d0('0x27')](_0x21f83a[_0xa4d0('0x28')])]||_0xa4d0('0x4');}}catch(_0x11c104){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x29'),_0x21f83a[_0xa4d0('0x8')]),_0x11c104);}};exports[_0xa4d0('0x2a')]=function(_0x109068){try{if(!_[_0xa4d0('0x20')](channels[_0x109068[_0xa4d0('0x8')]])){utils['debug'](util['format'](_0xa4d0('0x2b'),_0x109068[_0xa4d0('0x8')]),_0x109068);if(_[_0xa4d0('0x20')](channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x2c')])){channels[_0x109068['uniqueid']]['callerid']=_0x109068[_0xa4d0('0x2d')]+'\x20<'+_0x109068['calleridnum']+'>';}utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x2e'),_0x109068['uniqueid'],channels[_0x109068['uniqueid']]['callerid'],_0x109068['cause-txt']));channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x2f')]=utils['now']();channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x30')]=utils[_0xa4d0('0x31')](channels[_0x109068['uniqueid']][_0xa4d0('0x2f')],channels[_0x109068[_0xa4d0('0x8')]]['starttime']);channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x32')]=channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x25')]?utils[_0xa4d0('0x31')](channels[_0x109068['uniqueid']][_0xa4d0('0x2f')],channels[_0x109068[_0xa4d0('0x8')]]['answertime']):0x0;writeDB(channels[_0x109068[_0xa4d0('0x8')]]);}}catch(_0x169092){utils['error'](util['format'](_0xa4d0('0x2b'),_0x109068[_0xa4d0('0x8')]),_0x169092);}};exports['attendedtransfer']=function(_0x2315da){try{if(!_['isNil'](channels[_0x2315da[_0xa4d0('0x33')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x34'),_0x2315da[_0xa4d0('0x35')]),_0x2315da);if(channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0xc')]==_0x2315da[_0xa4d0('0x36')]){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x37'),_0x2315da['origtransfereruniqueid'],_0x2315da[_0xa4d0('0x33')],_0x2315da[_0xa4d0('0x38')]));channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x24')]=_0x2315da[_0xa4d0('0x38')];channels[_0x2315da[_0xa4d0('0x33')]]['userfield']='_attended';}else if(channels[_0x2315da[_0xa4d0('0x33')]]['channel']=_0x2315da[_0xa4d0('0x39')]){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x37'),_0x2315da[_0xa4d0('0x35')],_0x2315da['localtwolinkedid'],_0x2315da[_0xa4d0('0x3a')]));channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x24')]=_0x2315da[_0xa4d0('0x3a')];channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x3b')]=_0xa4d0('0x3c');}}}catch(_0x53227d){utils[_0xa4d0('0x1e')](util['format'](_0xa4d0('0x34'),_0x2315da['origtransfereruniqueid']),_0x53227d);}};exports['musiconholdstart']=function(_0x3637e4){try{if(!_[_0xa4d0('0x20')](channels[_0x3637e4['uniqueid']])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstart]',_0x3637e4[_0xa4d0('0x8')]),_0x3637e4);channels[_0x3637e4[_0xa4d0('0x8')]][_0xa4d0('0x3d')]=utils[_0xa4d0('0x1d')]();utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3637e4[_0xa4d0('0x8')],channels[_0x3637e4['uniqueid']][_0xa4d0('0x3d')]));}}catch(_0x639164){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x3e'),_0x3637e4[_0xa4d0('0x8')]),_0x639164);}};exports[_0xa4d0('0x3f')]=function(_0x39363e){try{if(!_['isNil'](channels[_0x39363e[_0xa4d0('0x8')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x40'),_0x39363e[_0xa4d0('0x8')]),_0x39363e);if(!_[_0xa4d0('0x20')](channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')])){channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x41')]+=utils['diffTime'](utils[_0xa4d0('0x1d')](),channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')]);utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x39363e[_0xa4d0('0x8')],channels[_0x39363e[_0xa4d0('0x8')]]['mohtime']));delete channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')];}}}catch(_0x27a45b){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x40'),_0x39363e[_0xa4d0('0x8')]),_0x27a45b);}};exports['varset']=function(_0x21e148){try{if(!_[_0xa4d0('0x20')](channels[_0x21e148[_0xa4d0('0x8')]])){utils['debug'](util[_0xa4d0('0xb')](_0xa4d0('0x42'),_0x21e148[_0xa4d0('0x8')]),_0x21e148);if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x44')])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x46')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmd-phone'])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x47'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x48')]=_0x21e148[_0xa4d0('0x45')];channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x2c')]='\x22'+_0x21e148['value']+'\x22\x20<'+_0x21e148['value']+'>';}if(!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x49')])||!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x4a')])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x21e148[_0xa4d0('0x8')],!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x49')])?_0xa4d0('0x49'):_0xa4d0('0x4a'),_0x21e148['value']));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x2c')]=_0x21e148['value'];}if(!_['isNil'](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x4b')])||!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmcs-queue'])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x4c'),_0x21e148[_0xa4d0('0x8')],!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmd-queue'])?_0xa4d0('0x4b'):'xmcs-queue',_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']][_0xa4d0('0x4d')]=_0xa4d0('0x4e');channels[_0x21e148[_0xa4d0('0x8')]]['lastdata']=_0x21e148['value'];channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0xd')]=!![];}if(!_['isNil'](_0x21e148[_0xa4d0('0x43')]['xmd-contactid'])){utils['info'](util[_0xa4d0('0xb')](_0xa4d0('0x4f'),_0x21e148['uniqueid'],_0x21e148['value']));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x50')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x51')])){utils[_0xa4d0('0xa')](util['format'](_0xa4d0('0x52'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']]['type']=_0x21e148['value'];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x53')])){utils['info'](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x21e148['uniqueid'],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x54')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x55')])){utils['info'](util[_0xa4d0('0xb')](_0xa4d0('0x56'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']][_0xa4d0('0x55')]=_0x21e148['value'];}}}catch(_0x591a64){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x42'),_0x21e148[_0xa4d0('0x8')]),_0x591a64);}};exports[_0xa4d0('0x57')]=function(_0x2c6064){try{if(!_[_0xa4d0('0x20')](channels[_0x2c6064[_0xa4d0('0x8')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x58'),_0x2c6064['uniqueid']),_0x2c6064);utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x59'),_0x2c6064[_0xa4d0('0x8')],_0x2c6064[_0xa4d0('0x5a')],_0x2c6064[_0xa4d0('0x5b')]));if(_0x2c6064[_0xa4d0('0x5a')][_0xa4d0('0x5c')]()==_0xa4d0('0x5d')&&_[_0xa4d0('0x5e')](_0x2c6064[_0xa4d0('0x5b')]['toLowerCase'](),'cdr')){var _0x21d246=_0x2c6064[_0xa4d0('0x5b')][_0xa4d0('0x5f')]('=');var _0x4d78f0=_0x21d246[0x0][_0xa4d0('0x60')](_0x21d246[0x0][_0xa4d0('0x61')]('(')+0x1,_0x21d246[0x0]['lastIndexOf'](')'));var _0x5820c4=_0x21d246[0x1];channels[_0x2c6064[_0xa4d0('0x8')]][_0x4d78f0]=_0x5820c4;}if(!_['includes']([_0xa4d0('0x2a'),_0xa4d0('0x62'),_0xa4d0('0x63'),_0xa4d0('0x5d'),'gotoif'],_0x2c6064[_0xa4d0('0x5a')][_0xa4d0('0x5c')]())){channels[_0x2c6064[_0xa4d0('0x8')]]['lastapplication']=_0x2c6064[_0xa4d0('0x5a')];channels[_0x2c6064[_0xa4d0('0x8')]][_0xa4d0('0x64')]=_0x2c6064[_0xa4d0('0x5b')];}}}catch(_0x63afb5){utils['error'](util[_0xa4d0('0xb')]('[%s][calls][newexten]',_0x2c6064[_0xa4d0('0x8')]),_0x63afb5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 2fa596e..1b30ae5 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 _0x56f9=['[core]\x20shutdown','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','connect','[core]\x20connected','shutdown'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x56f9,0x97));var _0x956f=function(_0x2f09d5,_0x312ae1){_0x2f09d5=_0x2f09d5-0x0;var _0x3f6460=_0x56f9[_0x2f09d5];return _0x3f6460;};'use strict';var utils=require('./utils');exports[_0x956f('0x0')]=function(){utils['info'](_0x956f('0x1'));};exports[_0x956f('0x2')]=function(){utils['info'](_0x956f('0x3'));};exports[_0x956f('0x4')]=function(){utils[_0x956f('0x5')](_0x956f('0x6'));};exports[_0x956f('0x7')]=function(_0x45c10c){utils[_0x956f('0x7')](_0x956f('0x8'),_0x45c10c);};exports[_0x956f('0x9')]=function(){utils[_0x956f('0x5')]('[core]\x20close');};exports[_0x956f('0xa')]=function(_0xeec56d){}; \ No newline at end of file +var _0x9b23=['close','[core]\x20close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x9b64bd,_0x1ebf44){var _0x1c5b64=function(_0x535826){while(--_0x535826){_0x9b64bd['push'](_0x9b64bd['shift']());}};_0x1c5b64(++_0x1ebf44);}(_0x9b23,0x16b));var _0x39b2=function(_0x164721,_0x46a3c7){_0x164721=_0x164721-0x0;var _0xe7e228=_0x9b23[_0x164721];return _0xe7e228;};'use strict';var utils=require(_0x39b2('0x0'));exports[_0x39b2('0x1')]=function(){utils[_0x39b2('0x2')]('[core]\x20connected');};exports[_0x39b2('0x3')]=function(){utils['info'](_0x39b2('0x4'));};exports[_0x39b2('0x5')]=function(){utils[_0x39b2('0x2')](_0x39b2('0x6'));};exports['error']=function(_0x58c9d8){utils[_0x39b2('0x7')](_0x39b2('0x8'),_0x58c9d8);};exports[_0x39b2('0x9')]=function(){utils[_0x39b2('0x2')](_0x39b2('0xa'));};exports[_0x39b2('0xb')]=function(_0x14c51c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 70e764b..1d41eb3 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 _0xbe31=['[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','billableseconds','answertime','[%s][dials][hangup]','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','assign','now','lastevent','called','starttime','[%s][dials][dialbegin]','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup'];(function(_0x326876,_0x4bea84){var _0x44dfef=function(_0x3d6f8a){while(--_0x3d6f8a){_0x326876['push'](_0x326876['shift']());}};_0x44dfef(++_0x4bea84);}(_0xbe31,0xe0));var _0x1be3=function(_0x1d830c,_0x13565f){_0x1d830c=_0x1d830c-0x0;var _0x4b638c=_0xbe31[_0x1d830c];return _0x4b638c;};'use strict';var _=require(_0x1be3('0x0'));var util=require(_0x1be3('0x1'));var utils=require(_0x1be3('0x2'));var dials={};function writeDB(_0x3c9008){utils[_0x1be3('0x3')](util['format'](_0x1be3('0x4'),_0x3c9008['uniqueid'],_0x3c9008[_0x1be3('0x5')],_0x3c9008['dialstring'],_0x3c9008['calleridnum'],_0x3c9008['connectedlinenum'],_0x3c9008[_0x1be3('0x6')]));utils[_0x1be3('0x7')](_0x1be3('0x8'),_0x3c9008);delete dials[_0x3c9008[_0x1be3('0x9')]];}exports[_0x1be3('0xa')]=function(_0x3aec82){try{utils[_0x1be3('0xb')](util['format'](_0x1be3('0xc'),_0x3aec82['uniqueid']),_0x3aec82);utils['info'](util[_0x1be3('0xd')](_0x1be3('0xe'),_0x3aec82[_0x1be3('0x9')],_0x3aec82[_0x1be3('0xf')],_0x3aec82[_0x1be3('0x10')]));if(_0x3aec82[_0x1be3('0xf')]['toLowerCase']()==_0x1be3('0x11')&&_[_0x1be3('0x12')](_0x3aec82[_0x1be3('0x10')][_0x1be3('0x13')](),_0x1be3('0x14'))){var _0x945930=_0x3aec82['appdata'][_0x1be3('0x15')]('=');dials[_0x3aec82[_0x1be3('0x9')]]={'routeId':_0x945930[0x1]};}}catch(_0x8bcf16){utils[_0x1be3('0x16')](util[_0x1be3('0xd')](_0x1be3('0xc'),_0x3aec82[_0x1be3('0x9')]),_0x8bcf16);}};exports[_0x1be3('0x17')]=function(_0x40b487){try{utils[_0x1be3('0xb')](util[_0x1be3('0xd')](_0x1be3('0x18'),_0x40b487['uniqueid']),_0x40b487);if(!_[_0x1be3('0x19')](_0x40b487[_0x1be3('0x1a')][_0x1be3('0x1b')])){utils[_0x1be3('0x3')](util[_0x1be3('0xd')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x40b487[_0x1be3('0x9')],_0x40b487[_0x1be3('0x1c')]));dials[_0x40b487[_0x1be3('0x9')]]={'routeId':_0x40b487[_0x1be3('0x1c')]};}}catch(_0x43696a){utils[_0x1be3('0x16')](util[_0x1be3('0xd')](_0x1be3('0x18'),_0x40b487[_0x1be3('0x9')]),_0x43696a);}};exports['dialbegin']=function(_0x3dc2b9){try{if(!_[_0x1be3('0x19')](dials[_0x3dc2b9[_0x1be3('0x9')]])){utils[_0x1be3('0xb')](util['format']('[%s][dials][dialbegin]',_0x3dc2b9[_0x1be3('0x9')]),_0x3dc2b9);dials[_0x3dc2b9['uniqueid']]=_[_0x1be3('0x1d')](dials[_0x3dc2b9['uniqueid']],_0x3dc2b9);dials[_0x3dc2b9[_0x1be3('0x9')]]['starttime']=utils[_0x1be3('0x1e')]();dials[_0x3dc2b9[_0x1be3('0x9')]][_0x1be3('0x1f')]=_0x1be3('0x20');utils['info'](util[_0x1be3('0xd')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3dc2b9[_0x1be3('0x9')],dials[_0x3dc2b9[_0x1be3('0x9')]][_0x1be3('0x21')]));}}catch(_0x4c0062){utils['error'](util[_0x1be3('0xd')](_0x1be3('0x22'),_0x3dc2b9[_0x1be3('0x9')]),_0x4c0062);}};exports['dialend']=function(_0x40cc6e){try{if(!_[_0x1be3('0x19')](dials[_0x40cc6e['uniqueid']])){utils[_0x1be3('0xb')](util[_0x1be3('0xd')](_0x1be3('0x23'),_0x40cc6e[_0x1be3('0x9')]),_0x40cc6e);dials[_0x40cc6e['uniqueid']]['dialstatus']=_0x40cc6e[_0x1be3('0x6')];if(_0x40cc6e[_0x1be3('0x6')]==_0x1be3('0x24')){dials[_0x40cc6e[_0x1be3('0x9')]]=_[_0x1be3('0x1d')](dials[_0x40cc6e['uniqueid']],_0x40cc6e);dials[_0x40cc6e['uniqueid']]['answertime']=utils['now']();dials[_0x40cc6e[_0x1be3('0x9')]][_0x1be3('0x1f')]=_0x1be3('0x25');utils[_0x1be3('0x3')](util[_0x1be3('0xd')](_0x1be3('0x26'),_0x40cc6e[_0x1be3('0x9')],_0x40cc6e['dialstatus'],dials[_0x40cc6e[_0x1be3('0x9')]]['answertime']));}else{utils[_0x1be3('0x3')](util[_0x1be3('0xd')](_0x1be3('0x27'),_0x40cc6e[_0x1be3('0x9')],_0x40cc6e['dialstatus']));}}}catch(_0x36df83){utils[_0x1be3('0x16')](util[_0x1be3('0xd')](_0x1be3('0x23'),_0x40cc6e['uniqueid']),_0x36df83);}};exports[_0x1be3('0x28')]=function(_0xc00cc){try{if(!_['isNil'](dials[_0xc00cc[_0x1be3('0x9')]])){utils['debug'](util[_0x1be3('0xd')]('[%s][dials][hangup]',_0xc00cc[_0x1be3('0x9')]),_0xc00cc);utils['info'](util[_0x1be3('0xd')](_0x1be3('0x29'),_0xc00cc[_0x1be3('0x9')],_0xc00cc[_0x1be3('0x2a')],_0xc00cc[_0x1be3('0x2b')],_0xc00cc[_0x1be3('0x2c')]));dials[_0xc00cc[_0x1be3('0x9')]]=_['assign'](dials[_0xc00cc[_0x1be3('0x9')]],{'endtime':utils['now'](),'lastevent':_0x1be3('0x2d')});dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x2e')]=utils[_0x1be3('0x2f')](dials[_0xc00cc['uniqueid']]['endtime'],dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x21')]);dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x30')]=utils['diffTime'](dials[_0xc00cc[_0x1be3('0x9')]]['answertime']||dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x31')],dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x21')]);dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x32')]=dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x33')]?utils[_0x1be3('0x2f')](dials[_0xc00cc['uniqueid']][_0x1be3('0x31')],dials[_0xc00cc[_0x1be3('0x9')]][_0x1be3('0x33')]):0x0;writeDB(dials[_0xc00cc[_0x1be3('0x9')]]);}}catch(_0x17fafb){utils[_0x1be3('0x16')](util[_0x1be3('0xd')](_0x1be3('0x34'),_0xc00cc[_0x1be3('0x9')]),_0x17fafb);}}; \ No newline at end of file +var _0x4bbe=['connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','appdata','application','toLowerCase','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','debug','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4bbe,0x1a6));var _0xe4bb=function(_0x52f3d1,_0x56b3e3){_0x52f3d1=_0x52f3d1-0x0;var _0x55511d=_0x4bbe[_0x52f3d1];return _0x55511d;};'use strict';var _=require(_0xe4bb('0x0'));var util=require(_0xe4bb('0x1'));var utils=require(_0xe4bb('0x2'));var dials={};function writeDB(_0x1d5f42){utils[_0xe4bb('0x3')](util[_0xe4bb('0x4')](_0xe4bb('0x5'),_0x1d5f42[_0xe4bb('0x6')],_0x1d5f42[_0xe4bb('0x7')],_0x1d5f42[_0xe4bb('0x8')],_0x1d5f42[_0xe4bb('0x9')],_0x1d5f42[_0xe4bb('0xa')],_0x1d5f42[_0xe4bb('0xb')]));utils[_0xe4bb('0xc')](_0xe4bb('0xd'),_0x1d5f42);delete dials[_0x1d5f42[_0xe4bb('0x6')]];}exports[_0xe4bb('0xe')]=function(_0x1d6c63){try{utils['debug'](util[_0xe4bb('0x4')](_0xe4bb('0xf'),_0x1d6c63['uniqueid']),_0x1d6c63);utils[_0xe4bb('0x3')](util[_0xe4bb('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1d6c63[_0xe4bb('0x6')],_0x1d6c63['application'],_0x1d6c63[_0xe4bb('0x10')]));if(_0x1d6c63[_0xe4bb('0x11')][_0xe4bb('0x12')]()=='set'&&_['startsWith'](_0x1d6c63['appdata'][_0xe4bb('0x12')](),'cdr(routeid)')){var _0x36d571=_0x1d6c63[_0xe4bb('0x10')][_0xe4bb('0x13')]('=');dials[_0x1d6c63[_0xe4bb('0x6')]]={'routeId':_0x36d571[0x1]};}}catch(_0x11afcf){utils[_0xe4bb('0x14')](util[_0xe4bb('0x4')](_0xe4bb('0xf'),_0x1d6c63[_0xe4bb('0x6')]),_0x11afcf);}};exports['varset']=function(_0x4f5218){try{utils['debug'](util['format'](_0xe4bb('0x15'),_0x4f5218[_0xe4bb('0x6')]),_0x4f5218);if(!_[_0xe4bb('0x16')](_0x4f5218[_0xe4bb('0x17')][_0xe4bb('0x18')])){utils[_0xe4bb('0x3')](util[_0xe4bb('0x4')](_0xe4bb('0x19'),_0x4f5218[_0xe4bb('0x6')],_0x4f5218[_0xe4bb('0x1a')]));dials[_0x4f5218[_0xe4bb('0x6')]]={'routeId':_0x4f5218[_0xe4bb('0x1a')]};}}catch(_0x44c515){utils[_0xe4bb('0x14')](util[_0xe4bb('0x4')](_0xe4bb('0x15'),_0x4f5218[_0xe4bb('0x6')]),_0x44c515);}};exports['dialbegin']=function(_0x33c4ae){try{if(!_[_0xe4bb('0x16')](dials[_0x33c4ae[_0xe4bb('0x6')]])){utils[_0xe4bb('0x1b')](util['format'](_0xe4bb('0x1c'),_0x33c4ae[_0xe4bb('0x6')]),_0x33c4ae);dials[_0x33c4ae['uniqueid']]=_[_0xe4bb('0x1d')](dials[_0x33c4ae[_0xe4bb('0x6')]],_0x33c4ae);dials[_0x33c4ae['uniqueid']][_0xe4bb('0x1e')]=utils[_0xe4bb('0x1f')]();dials[_0x33c4ae[_0xe4bb('0x6')]][_0xe4bb('0x20')]=_0xe4bb('0x21');utils[_0xe4bb('0x3')](util['format'](_0xe4bb('0x22'),_0x33c4ae['uniqueid'],dials[_0x33c4ae[_0xe4bb('0x6')]]['starttime']));}}catch(_0x4a7983){utils[_0xe4bb('0x14')](util[_0xe4bb('0x4')](_0xe4bb('0x1c'),_0x33c4ae['uniqueid']),_0x4a7983);}};exports[_0xe4bb('0x23')]=function(_0x4cd95b){try{if(!_[_0xe4bb('0x16')](dials[_0x4cd95b[_0xe4bb('0x6')]])){utils[_0xe4bb('0x1b')](util[_0xe4bb('0x4')](_0xe4bb('0x24'),_0x4cd95b['uniqueid']),_0x4cd95b);dials[_0x4cd95b[_0xe4bb('0x6')]][_0xe4bb('0xb')]=_0x4cd95b[_0xe4bb('0xb')];if(_0x4cd95b[_0xe4bb('0xb')]=='ANSWER'){dials[_0x4cd95b[_0xe4bb('0x6')]]=_[_0xe4bb('0x1d')](dials[_0x4cd95b[_0xe4bb('0x6')]],_0x4cd95b);dials[_0x4cd95b['uniqueid']]['answertime']=utils[_0xe4bb('0x1f')]();dials[_0x4cd95b[_0xe4bb('0x6')]]['lastevent']=_0xe4bb('0x25');utils[_0xe4bb('0x3')](util['format'](_0xe4bb('0x26'),_0x4cd95b[_0xe4bb('0x6')],_0x4cd95b['dialstatus'],dials[_0x4cd95b['uniqueid']][_0xe4bb('0x27')]));}else{utils[_0xe4bb('0x3')](util[_0xe4bb('0x4')](_0xe4bb('0x28'),_0x4cd95b[_0xe4bb('0x6')],_0x4cd95b[_0xe4bb('0xb')]));}}}catch(_0x3760ed){utils[_0xe4bb('0x14')](util[_0xe4bb('0x4')](_0xe4bb('0x24'),_0x4cd95b['uniqueid']),_0x3760ed);}};exports[_0xe4bb('0x29')]=function(_0x1044c2){try{if(!_['isNil'](dials[_0x1044c2[_0xe4bb('0x6')]])){utils[_0xe4bb('0x1b')](util[_0xe4bb('0x4')](_0xe4bb('0x2a'),_0x1044c2[_0xe4bb('0x6')]),_0x1044c2);utils[_0xe4bb('0x3')](util[_0xe4bb('0x4')](_0xe4bb('0x2b'),_0x1044c2[_0xe4bb('0x6')],_0x1044c2[_0xe4bb('0x9')],_0x1044c2[_0xe4bb('0x2c')],_0x1044c2[_0xe4bb('0x2d')]));dials[_0x1044c2[_0xe4bb('0x6')]]=_['assign'](dials[_0x1044c2['uniqueid']],{'endtime':utils[_0xe4bb('0x1f')](),'lastevent':_0xe4bb('0x2e')});dials[_0x1044c2[_0xe4bb('0x6')]][_0xe4bb('0x2f')]=utils[_0xe4bb('0x30')](dials[_0x1044c2[_0xe4bb('0x6')]][_0xe4bb('0x31')],dials[_0x1044c2[_0xe4bb('0x6')]]['starttime']);dials[_0x1044c2[_0xe4bb('0x6')]][_0xe4bb('0x32')]=utils[_0xe4bb('0x30')](dials[_0x1044c2[_0xe4bb('0x6')]][_0xe4bb('0x27')]||dials[_0x1044c2[_0xe4bb('0x6')]][_0xe4bb('0x31')],dials[_0x1044c2[_0xe4bb('0x6')]]['starttime']);dials[_0x1044c2[_0xe4bb('0x6')]]['billableseconds']=dials[_0x1044c2[_0xe4bb('0x6')]]['answertime']?utils['diffTime'](dials[_0x1044c2['uniqueid']]['endtime'],dials[_0x1044c2[_0xe4bb('0x6')]][_0xe4bb('0x27')]):0x0;writeDB(dials[_0x1044c2[_0xe4bb('0x6')]]);}}catch(_0x4dcbe8){utils['error'](util[_0xe4bb('0x4')](_0xe4bb('0x2a'),_0x1044c2[_0xe4bb('0x6')]),_0x4dcbe8);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 03f7282..6c767c6 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 _0xd0fc=['close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','fullybooted','error'];(function(_0x1081a3,_0x2ac784){var _0x5696a2=function(_0x23d2f6){while(--_0x23d2f6){_0x1081a3['push'](_0x1081a3['shift']());}};_0x5696a2(++_0x2ac784);}(_0xd0fc,0x18c));var _0xcd0f=function(_0x4d753d,_0x35b5bc){_0x4d753d=_0x4d753d-0x0;var _0x520601=_0xd0fc[_0x4d753d];return _0x520601;};var AsteriskManager=require(_0xcd0f('0x0'));var config=require(_0xcd0f('0x1'));var utils=require(_0xcd0f('0x2'));var util=require(_0xcd0f('0x3'));var isXDREnabled=config[_0xcd0f('0x4')]&&config[_0xcd0f('0x4')]['disabled']?!config['xdr'][_0xcd0f('0x5')]:!![];var isProduction=config[_0xcd0f('0x6')]===_0xcd0f('0x7')||![];var isLocalAsterisk=config[_0xcd0f('0x4')]&&config['xdr'][_0xcd0f('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xcd0f('0x9')][_0xcd0f('0xa')],config[_0xcd0f('0x9')]['ip'],config[_0xcd0f('0x9')]['username'],config[_0xcd0f('0x9')][_0xcd0f('0xb')],!![]);ami[_0xcd0f('0xc')]();if(!isXDREnabled){utils[_0xcd0f('0xd')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xcd0f('0xe'));}else{var agents=require(_0xcd0f('0xf'));var calls=require(_0xcd0f('0x10'));var queues=require(_0xcd0f('0x11'));var recordings=require(_0xcd0f('0x12'));var members=require(_0xcd0f('0x13'));var dials=require(_0xcd0f('0x14'));var transfers=require(_0xcd0f('0x15'));var core=require('./core.controller');ami['on']('connect',core['connect']);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0xcd0f('0x16')]);ami['on'](_0xcd0f('0x17'),core[_0xcd0f('0x17')]);ami['on'](_0xcd0f('0x18'),core[_0xcd0f('0x18')]);ami['on'](_0xcd0f('0x19'),core['managerevent']);ami['on'](_0xcd0f('0x1a'),function(_0x5061af){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x1d'),_0x5061af['device']),_0x5061af);members[_0xcd0f('0x1a')](_0x5061af);}catch(_0x241f74){utils[_0xcd0f('0x17')](util['format'](_0xcd0f('0x1d'),_0x5061af['device']),_0x241f74);}});ami['on'](_0xcd0f('0x1e'),function(_0xcdabeb){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x1f'),_0xcdabeb[_0xcd0f('0x20')]),_0xcdabeb);agents[_0xcd0f('0x1e')](_0xcdabeb);}catch(_0x4b8bf1){utils[_0xcd0f('0x17')](util['format'](_0xcd0f('0x1f'),_0xcdabeb[_0xcd0f('0x20')]),_0x4b8bf1);}});ami['on'](_0xcd0f('0x21'),function(_0x25d0cd){try{utils[_0xcd0f('0x1b')](util['format'](_0xcd0f('0x22'),_0x25d0cd[_0xcd0f('0x20')]),_0x25d0cd);agents[_0xcd0f('0x21')](_0x25d0cd);}catch(_0x4ca133){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x22'),_0x25d0cd[_0xcd0f('0x20')]),_0x4ca133);}});ami['on'](_0xcd0f('0x23'),function(_0x3b35da){try{utils[_0xcd0f('0x1b')](util['format'](_0xcd0f('0x24'),_0x3b35da['uniqueid']),_0x3b35da);agents['agentconnect'](_0x3b35da);queues[_0xcd0f('0x23')](_0x3b35da);}catch(_0x42827d){utils['error'](util['format'](_0xcd0f('0x24'),_0x3b35da[_0xcd0f('0x20')]),_0x42827d);}});ami['on'](_0xcd0f('0x25'),function(_0x15b8c7){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x26'),_0x15b8c7[_0xcd0f('0x20')]),_0x15b8c7);agents[_0xcd0f('0x25')](_0x15b8c7);queues['agentcomplete'](_0x15b8c7);members[_0xcd0f('0x25')](_0x15b8c7);}catch(_0x3dd90c){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x26'),_0x15b8c7[_0xcd0f('0x20')]),_0x3dd90c);}});ami['on'](_0xcd0f('0x27'),function(_0xa2226e){try{utils['debug'](util[_0xcd0f('0x1c')]('[%s][index][queuecallerabandon]',_0xa2226e[_0xcd0f('0x20')]),_0xa2226e);agents[_0xcd0f('0x27')](_0xa2226e);queues[_0xcd0f('0x27')](_0xa2226e);}catch(_0x1f613d){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x28'),_0xa2226e[_0xcd0f('0x20')]),_0x1f613d);}});ami['on'](_0xcd0f('0x29'),function(_0x47a288){try{utils['debug'](util['format'](_0xcd0f('0x2a'),_0x47a288[_0xcd0f('0x20')]),_0x47a288);queues['queuecallerjoin'](_0x47a288);recordings[_0xcd0f('0x29')](_0x47a288);}catch(_0x2ce965){utils[_0xcd0f('0x17')](util['format'](_0xcd0f('0x2a'),_0x47a288[_0xcd0f('0x20')]),_0x2ce965);}});ami['on'](_0xcd0f('0x2b'),function(_0x1272a4){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x2c'),_0x1272a4['uniqueid']),_0x1272a4);queues[_0xcd0f('0x2b')](_0x1272a4);}catch(_0x56a45d){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x2c'),_0x1272a4['uniqueid']),_0x56a45d);}});ami['on'](_0xcd0f('0x2d'),function(_0x152c9d){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')]('[%s][index][musiconholdstart]',_0x152c9d[_0xcd0f('0x20')]),_0x152c9d);queues[_0xcd0f('0x2d')](_0x152c9d);calls[_0xcd0f('0x2d')](_0x152c9d);}catch(_0x349764){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x2e'),_0x152c9d[_0xcd0f('0x20')]),_0x349764);}});ami['on'](_0xcd0f('0x2f'),function(_0x4b91a1){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x30'),_0x4b91a1[_0xcd0f('0x20')]),_0x4b91a1);queues[_0xcd0f('0x2f')](_0x4b91a1);calls[_0xcd0f('0x2f')](_0x4b91a1);}catch(_0xb3b7ba){utils[_0xcd0f('0x17')](util['format'](_0xcd0f('0x30'),_0x4b91a1['uniqueid']),_0xb3b7ba);}});ami['on']('newstate',function(_0x1e78ba){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x31'),_0x1e78ba['uniqueid']),_0x1e78ba);calls[_0xcd0f('0x32')](_0x1e78ba);recordings[_0xcd0f('0x32')](_0x1e78ba);}catch(_0x82fdc1){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')]('[%s][index][newstate]',_0x1e78ba[_0xcd0f('0x20')]),_0x82fdc1);}});ami['on'](_0xcd0f('0x33'),function(_0x449e8d){try{utils['debug'](util[_0xcd0f('0x1c')](_0xcd0f('0x34'),_0x449e8d['uniqueid']),_0x449e8d);calls['hangup'](_0x449e8d);recordings['hangup'](_0x449e8d);dials[_0xcd0f('0x33')](_0x449e8d);agents[_0xcd0f('0x33')](_0x449e8d);queues[_0xcd0f('0x33')](_0x449e8d);}catch(_0x3e4e44){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')]('[%s][index][hangup]',_0x449e8d[_0xcd0f('0x20')]),_0x3e4e44);}});ami['on'](_0xcd0f('0x35'),function(_0x156104){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x36'),_0x156104[_0xcd0f('0x20')]),_0x156104);members[_0xcd0f('0x35')](_0x156104);}catch(_0x3aeb11){utils['error'](util['format'](_0xcd0f('0x36'),_0x156104['uniqueid']),_0x3aeb11);}});ami['on'](_0xcd0f('0x37'),function(_0x441bbe){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x38'),_0x441bbe[_0xcd0f('0x20')]),_0x441bbe);queues['blindtransfer'](_0x441bbe);agents[_0xcd0f('0x37')](_0x441bbe);transfers[_0xcd0f('0x37')](_0x441bbe);recordings[_0xcd0f('0x37')](_0x441bbe);}catch(_0x2fbd68){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')]('[%s][index][blindtransfer]',_0x441bbe[_0xcd0f('0x20')]),_0x2fbd68);}});ami['on']('attendedtransfer',function(_0x18b4a0){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x39'),_0x18b4a0[_0xcd0f('0x3a')]),_0x18b4a0);queues[_0xcd0f('0x3b')](_0x18b4a0);transfers[_0xcd0f('0x3b')](_0x18b4a0);agents[_0xcd0f('0x3b')](_0x18b4a0);calls[_0xcd0f('0x3b')](_0x18b4a0);}catch(_0x63c71e){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x39'),_0x18b4a0[_0xcd0f('0x3a')]),_0x63c71e);}});ami['on']('varset',function(_0x1d0b5f){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x3c'),_0x1d0b5f['uniqueid']),_0x1d0b5f);queues[_0xcd0f('0x3d')](_0x1d0b5f);recordings[_0xcd0f('0x3d')](_0x1d0b5f);calls[_0xcd0f('0x3d')](_0x1d0b5f);dials[_0xcd0f('0x3d')](_0x1d0b5f);}catch(_0x43abf7){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x3c'),_0x1d0b5f['uniqueid']),_0x43abf7);}});ami['on']('newexten',function(_0x3b0462){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')]('[%s][index][newexten]',_0x3b0462[_0xcd0f('0x20')]),_0x3b0462);calls[_0xcd0f('0x3e')](_0x3b0462);recordings[_0xcd0f('0x3e')](_0x3b0462);dials[_0xcd0f('0x3e')](_0x3b0462);}catch(_0x30224a){utils['error'](util[_0xcd0f('0x1c')](_0xcd0f('0x3f'),_0x3b0462[_0xcd0f('0x20')]),_0x30224a);}});ami['on']('newchannel',function(_0x40b0fa){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')](_0xcd0f('0x40'),_0x40b0fa[_0xcd0f('0x20')]),_0x40b0fa);calls[_0xcd0f('0x41')](_0x40b0fa);recordings[_0xcd0f('0x41')](_0x40b0fa);}catch(_0x144ba3){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x40'),_0x40b0fa['uniqueid']),_0x144ba3);}});ami['on'](_0xcd0f('0x42'),function(_0x2f9fec){try{utils[_0xcd0f('0x1b')](util[_0xcd0f('0x1c')]('[%s][index][dialbegin]',_0x2f9fec[_0xcd0f('0x20')]),_0x2f9fec);dials['dialbegin'](_0x2f9fec);}catch(_0x4085cc){utils[_0xcd0f('0x17')](util[_0xcd0f('0x1c')](_0xcd0f('0x43'),_0x2f9fec[_0xcd0f('0x20')]),_0x4085cc);}});ami['on'](_0xcd0f('0x44'),function(_0x5253b3){try{utils[_0xcd0f('0x1b')](util['format']('[%s][index][dialend]',_0x5253b3[_0xcd0f('0x20')]),_0x5253b3);dials[_0xcd0f('0x44')](_0x5253b3);}catch(_0x1a5b4e){utils['error'](util['format'](_0xcd0f('0x45'),_0x5253b3[_0xcd0f('0x20')]),_0x1a5b4e);}});} \ No newline at end of file +var _0x364f=['./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x364f,0x15b));var _0xf364=function(_0x1d00c7,_0x9b96b2){_0x1d00c7=_0x1d00c7-0x0;var _0x5b4f51=_0x364f[_0x1d00c7];return _0x5b4f51;};var AsteriskManager=require(_0xf364('0x0'));var config=require(_0xf364('0x1'));var utils=require(_0xf364('0x2'));var util=require(_0xf364('0x3'));var isXDREnabled=config['xdr']&&config[_0xf364('0x4')][_0xf364('0x5')]?!config['xdr']['disabled']:!![];var isProduction=config[_0xf364('0x6')]===_0xf364('0x7')||![];var isLocalAsterisk=config[_0xf364('0x4')]&&config[_0xf364('0x4')][_0xf364('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xf364('0x9')][_0xf364('0xa')],config[_0xf364('0x9')]['ip'],config['asterisk'][_0xf364('0xb')],config[_0xf364('0x9')]['password'],!![]);ami[_0xf364('0xc')]();if(!isXDREnabled){utils[_0xf364('0xd')](_0xf364('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xf364('0xd')](_0xf364('0xf'));}else{var agents=require(_0xf364('0x10'));var calls=require('./calls.controller');var queues=require(_0xf364('0x11'));var recordings=require(_0xf364('0x12'));var members=require(_0xf364('0x13'));var dials=require(_0xf364('0x14'));var transfers=require(_0xf364('0x15'));var core=require(_0xf364('0x16'));ami['on']('connect',core[_0xf364('0x17')]);ami['on']('shutdown',core[_0xf364('0x18')]);ami['on']('fullybooted',core[_0xf364('0x19')]);ami['on']('error',core[_0xf364('0x1a')]);ami['on'](_0xf364('0x1b'),core[_0xf364('0x1b')]);ami['on'](_0xf364('0x1c'),core[_0xf364('0x1c')]);ami['on'](_0xf364('0x1d'),function(_0x1ca9f9){try{utils['debug'](util[_0xf364('0x1e')]('[%s][index][devicestatechange]',_0x1ca9f9[_0xf364('0x1f')]),_0x1ca9f9);members[_0xf364('0x1d')](_0x1ca9f9);}catch(_0x4e7221){utils[_0xf364('0x1a')](util['format'](_0xf364('0x20'),_0x1ca9f9['device']),_0x4e7221);}});ami['on'](_0xf364('0x21'),function(_0x551667){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x23'),_0x551667['uniqueid']),_0x551667);agents['agentcalled'](_0x551667);}catch(_0x243d47){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x23'),_0x551667[_0xf364('0x24')]),_0x243d47);}});ami['on']('agentringnoanswer',function(_0x4f8e02){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')]('[%s][index][agentringnoanswer]',_0x4f8e02[_0xf364('0x24')]),_0x4f8e02);agents[_0xf364('0x25')](_0x4f8e02);}catch(_0x304c97){utils[_0xf364('0x1a')](util[_0xf364('0x1e')]('[%s][index][agentringnoanswer]',_0x4f8e02[_0xf364('0x24')]),_0x304c97);}});ami['on']('agentconnect',function(_0x3e983e){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')]('[%s][index][agentconnect]',_0x3e983e[_0xf364('0x24')]),_0x3e983e);agents[_0xf364('0x26')](_0x3e983e);queues[_0xf364('0x26')](_0x3e983e);}catch(_0x35c22a){utils['error'](util[_0xf364('0x1e')](_0xf364('0x27'),_0x3e983e[_0xf364('0x24')]),_0x35c22a);}});ami['on'](_0xf364('0x28'),function(_0x8a4b82){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x29'),_0x8a4b82[_0xf364('0x24')]),_0x8a4b82);agents[_0xf364('0x28')](_0x8a4b82);queues[_0xf364('0x28')](_0x8a4b82);members[_0xf364('0x28')](_0x8a4b82);}catch(_0x14fd01){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x29'),_0x8a4b82[_0xf364('0x24')]),_0x14fd01);}});ami['on'](_0xf364('0x2a'),function(_0x3fcfd7){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x2b'),_0x3fcfd7[_0xf364('0x24')]),_0x3fcfd7);agents['queuecallerabandon'](_0x3fcfd7);queues['queuecallerabandon'](_0x3fcfd7);}catch(_0x5c57a6){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x2b'),_0x3fcfd7[_0xf364('0x24')]),_0x5c57a6);}});ami['on'](_0xf364('0x2c'),function(_0x1ed974){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x2d'),_0x1ed974[_0xf364('0x24')]),_0x1ed974);queues['queuecallerjoin'](_0x1ed974);recordings[_0xf364('0x2c')](_0x1ed974);}catch(_0x229474){utils[_0xf364('0x1a')](util[_0xf364('0x1e')]('[%s][index][queuecallerjoin]',_0x1ed974['uniqueid']),_0x229474);}});ami['on'](_0xf364('0x2e'),function(_0x3e402a){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')]('[%s][index][queuecallerleave]',_0x3e402a[_0xf364('0x24')]),_0x3e402a);queues[_0xf364('0x2e')](_0x3e402a);}catch(_0x159785){utils[_0xf364('0x1a')](util['format'](_0xf364('0x2f'),_0x3e402a[_0xf364('0x24')]),_0x159785);}});ami['on'](_0xf364('0x30'),function(_0x2f71a0){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')]('[%s][index][musiconholdstart]',_0x2f71a0['uniqueid']),_0x2f71a0);queues['musiconholdstart'](_0x2f71a0);calls['musiconholdstart'](_0x2f71a0);}catch(_0xa84b7){utils[_0xf364('0x1a')](util[_0xf364('0x1e')]('[%s][index][musiconholdstart]',_0x2f71a0[_0xf364('0x24')]),_0xa84b7);}});ami['on'](_0xf364('0x31'),function(_0x534e20){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x32'),_0x534e20[_0xf364('0x24')]),_0x534e20);queues[_0xf364('0x31')](_0x534e20);calls[_0xf364('0x31')](_0x534e20);}catch(_0x25c3ed){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x534e20[_0xf364('0x24')]),_0x25c3ed);}});ami['on']('newstate',function(_0x1b6c38){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x33'),_0x1b6c38[_0xf364('0x24')]),_0x1b6c38);calls['newstate'](_0x1b6c38);recordings[_0xf364('0x34')](_0x1b6c38);}catch(_0x14541e){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x33'),_0x1b6c38['uniqueid']),_0x14541e);}});ami['on'](_0xf364('0x35'),function(_0x31a199){try{utils['debug'](util[_0xf364('0x1e')](_0xf364('0x36'),_0x31a199[_0xf364('0x24')]),_0x31a199);calls[_0xf364('0x35')](_0x31a199);recordings[_0xf364('0x35')](_0x31a199);dials[_0xf364('0x35')](_0x31a199);agents[_0xf364('0x35')](_0x31a199);queues['hangup'](_0x31a199);}catch(_0x3d7116){utils[_0xf364('0x1a')](util[_0xf364('0x1e')]('[%s][index][hangup]',_0x31a199[_0xf364('0x24')]),_0x3d7116);}});ami['on'](_0xf364('0x37'),function(_0x4e861c){try{utils[_0xf364('0x22')](util['format'](_0xf364('0x38'),_0x4e861c[_0xf364('0x24')]),_0x4e861c);members[_0xf364('0x37')](_0x4e861c);}catch(_0x188835){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x38'),_0x4e861c[_0xf364('0x24')]),_0x188835);}});ami['on'](_0xf364('0x39'),function(_0x2a5649){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')]('[%s][index][blindtransfer]',_0x2a5649[_0xf364('0x24')]),_0x2a5649);queues[_0xf364('0x39')](_0x2a5649);agents[_0xf364('0x39')](_0x2a5649);transfers[_0xf364('0x39')](_0x2a5649);recordings['blindtransfer'](_0x2a5649);}catch(_0x55e223){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x3a'),_0x2a5649[_0xf364('0x24')]),_0x55e223);}});ami['on'](_0xf364('0x3b'),function(_0x465436){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x3c'),_0x465436[_0xf364('0x3d')]),_0x465436);queues[_0xf364('0x3b')](_0x465436);transfers[_0xf364('0x3b')](_0x465436);agents[_0xf364('0x3b')](_0x465436);calls[_0xf364('0x3b')](_0x465436);}catch(_0x5da7ea){utils[_0xf364('0x1a')](util['format'](_0xf364('0x3c'),_0x465436[_0xf364('0x3d')]),_0x5da7ea);}});ami['on'](_0xf364('0x3e'),function(_0x2c744d){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x3f'),_0x2c744d[_0xf364('0x24')]),_0x2c744d);queues[_0xf364('0x3e')](_0x2c744d);recordings[_0xf364('0x3e')](_0x2c744d);calls[_0xf364('0x3e')](_0x2c744d);dials[_0xf364('0x3e')](_0x2c744d);}catch(_0x50e387){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x3f'),_0x2c744d[_0xf364('0x24')]),_0x50e387);}});ami['on'](_0xf364('0x40'),function(_0x989d1a){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x41'),_0x989d1a[_0xf364('0x24')]),_0x989d1a);calls[_0xf364('0x40')](_0x989d1a);recordings[_0xf364('0x40')](_0x989d1a);dials['newexten'](_0x989d1a);}catch(_0x3aaf59){utils[_0xf364('0x1a')](util['format'](_0xf364('0x41'),_0x989d1a[_0xf364('0x24')]),_0x3aaf59);}});ami['on'](_0xf364('0x42'),function(_0x540d53){try{utils[_0xf364('0x22')](util[_0xf364('0x1e')](_0xf364('0x43'),_0x540d53['uniqueid']),_0x540d53);calls[_0xf364('0x42')](_0x540d53);recordings['newchannel'](_0x540d53);}catch(_0x3e39d0){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x43'),_0x540d53['uniqueid']),_0x3e39d0);}});ami['on'](_0xf364('0x44'),function(_0x550093){try{utils[_0xf364('0x22')](util['format'](_0xf364('0x45'),_0x550093['uniqueid']),_0x550093);dials[_0xf364('0x44')](_0x550093);}catch(_0x13c86f){utils['error'](util[_0xf364('0x1e')](_0xf364('0x46'),_0x550093['uniqueid']),_0x13c86f);}});ami['on'](_0xf364('0x47'),function(_0x40bb17){try{utils['debug'](util[_0xf364('0x1e')](_0xf364('0x48'),_0x40bb17['uniqueid']),_0x40bb17);dials[_0xf364('0x47')](_0x40bb17);}catch(_0x565c33){utils[_0xf364('0x1a')](util[_0xf364('0x1e')](_0xf364('0x48'),_0x40bb17[_0xf364('0x24')]),_0x565c33);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a09bd12..4e1517b 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 _0x53f7=['[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','destination','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','error','format','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','agent','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]'];(function(_0x397b26,_0x23f37b){var _0x1383e5=function(_0x1bb35e){while(--_0x1bb35e){_0x397b26['push'](_0x397b26['shift']());}};_0x1383e5(++_0x23f37b);}(_0x53f7,0x12c));var _0x753f=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x53f7[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require(_0x753f('0x0'));var util=require(_0x753f('0x1'));var utils=require(_0x753f('0x2'));var members={};var exclude=[_0x753f('0x3'),_0x753f('0x4')];function writeDB(_0x334d2f){utils[_0x753f('0x5')](util['format'](_0x753f('0x6'),_0x334d2f[_0x753f('0x7')],_0x334d2f[_0x753f('0x8')],_0x334d2f[_0x753f('0x9')],_0x334d2f[_0x753f('0xa')],_0x334d2f[_0x753f('0xb')],_0x334d2f[_0x753f('0xc')]));if(_0x334d2f[_0x753f('0x8')]){utils[_0x753f('0xd')](_0x334d2f['interface'])['then'](function(_0x58547b){if(_0x58547b){_0x334d2f[_0x753f('0xb')]=_0x58547b[_0x753f('0xe')];_0x334d2f[_0x753f('0xf')]=_0x58547b[_0x753f('0xf')];utils[_0x753f('0x10')](_0x753f('0x11'),_0x334d2f);}else{utils[_0x753f('0x12')](_0x334d2f[_0x753f('0x8')][_0x753f('0x13')]('/')[0x1])['then'](function(_0x582855){if(_0x582855){_0x334d2f['membername']=_0x582855[_0x753f('0xe')];_0x334d2f[_0x753f('0xf')]=_0x582855[_0x753f('0xf')];utils[_0x753f('0x10')](_0x753f('0x11'),_0x334d2f);}});}})['catch'](function(_0x38467f){utils[_0x753f('0x14')](util[_0x753f('0x15')]('[%s][members][writeDB]',_0x334d2f[_0x753f('0x7')]),_0x38467f);});}delete members[_0x334d2f[_0x753f('0x8')]];}function startsWith(_0x1dfaa0,_0x34f4a3){return _[_0x753f('0x16')](_0x1dfaa0,function(_0x20dff1){return _['startsWith'](_0x34f4a3,_0x20dff1);});}exports['devicestatechange']=function(_0x20f89a){try{utils[_0x753f('0x17')](util[_0x753f('0x15')](_0x753f('0x18'),members[_0x20f89a[_0x753f('0x19')]]?members[_0x20f89a['device']][_0x753f('0x7')]:_0x20f89a['device']),_0x20f89a);utils['info'](util['format'](_0x753f('0x1a'),members[_0x20f89a['device']]?members[_0x20f89a[_0x753f('0x19')]]['uniqueid']:_0x20f89a['device'],_0x20f89a[_0x753f('0x1b')],_0x20f89a[_0x753f('0x19')]));switch(_0x20f89a['state']){case _0x753f('0x1c'):case'BUSY':if(!startsWith(exclude,_0x20f89a[_0x753f('0x19')])){members[_0x20f89a[_0x753f('0x19')]]={'channel':_0x753f('0x1d'),'interface':_0x20f89a['device'],'type':'TALKING','enterAt':utils[_0x753f('0x1e')](),'role':_0x753f('0x1f')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x20f89a[_0x753f('0x19')]])){members[_0x20f89a[_0x753f('0x19')]]['exitAt']=utils[_0x753f('0x1e')]();members[_0x20f89a[_0x753f('0x19')]]['duration']=utils['diffTime'](members[_0x20f89a[_0x753f('0x19')]]['exitAt'],members[_0x20f89a[_0x753f('0x19')]][_0x753f('0x20')]);if(members[_0x20f89a[_0x753f('0x19')]]['uniqueid']){writeDB(members[_0x20f89a['device']]);}}break;default:break;}}catch(_0x304c79){utils[_0x753f('0x14')](util[_0x753f('0x15')](_0x753f('0x18'),members[_0x20f89a[_0x753f('0x19')]]?members[_0x20f89a[_0x753f('0x19')]][_0x753f('0x7')]:_0x20f89a[_0x753f('0x19')]),_0x304c79);}};exports[_0x753f('0x21')]=function(_0x1769c0){try{if(!_[_0x753f('0x22')](members[_0x1769c0['interface']])){utils[_0x753f('0x17')](util[_0x753f('0x15')](_0x753f('0x23'),_0x1769c0[_0x753f('0x7')]),_0x1769c0);utils[_0x753f('0x5')](util[_0x753f('0x15')](_0x753f('0x24'),_0x1769c0[_0x753f('0x7')],_0x1769c0['interface'],_0x1769c0[_0x753f('0x25')]));members[_0x1769c0[_0x753f('0x8')]]=_[_0x753f('0x26')](members[_0x1769c0[_0x753f('0x8')]],{'data4':_0x1769c0[_0x753f('0x25')],'uniqueid':_0x1769c0[_0x753f('0x7')]});}}catch(_0x2a1b19){utils['error'](util[_0x753f('0x15')]('[%s][members][agentcomplete]',_0x1769c0[_0x753f('0x7')]),_0x2a1b19);}};exports[_0x753f('0x27')]=function(_0x35d05f){try{utils[_0x753f('0x17')](util[_0x753f('0x15')]('[%s][members][cdr]',_0x35d05f[_0x753f('0x7')]),_0x35d05f);if(_0x35d05f[_0x753f('0x9')]){var _0x24b6c4=_0x35d05f[_0x753f('0x9')][_0x753f('0x13')]('-')[0x0];if(!_['isNil'](members[_0x24b6c4])){members[_0x24b6c4]=_[_0x753f('0x26')](members[_0x24b6c4],{'data1':members[_0x24b6c4][_0x753f('0x28')]||_0x35d05f[_0x753f('0xc')],'data2':members[_0x24b6c4][_0x753f('0xa')]||_0x35d05f[_0x753f('0x29')],'data3':members[_0x24b6c4][_0x753f('0x2a')]||_0x35d05f['destination'],'uniqueid':members[_0x24b6c4]['uniqueid']||_0x35d05f['uniqueid']});utils[_0x753f('0x5')](util[_0x753f('0x15')](_0x753f('0x2b'),_0x35d05f[_0x753f('0x7')],members[_0x24b6c4]['data1'],members[_0x24b6c4]['data2'],members[_0x24b6c4][_0x753f('0x2a')]));if(members[_0x24b6c4][_0x753f('0x2c')]){writeDB(members[_0x24b6c4]);}}}if(_0x35d05f[_0x753f('0x2d')]){var _0x37f349=_0x35d05f[_0x753f('0x2d')][_0x753f('0x13')]('-')[0x0];if(!_[_0x753f('0x22')](members[_0x37f349])){members[_0x37f349]=_[_0x753f('0x26')](members[_0x37f349],{'data1':members[_0x37f349][_0x753f('0x28')]||_0x35d05f[_0x753f('0xc')],'data2':members[_0x37f349][_0x753f('0xa')]||_0x35d05f['source'],'data3':members[_0x37f349]['data3']||_0x35d05f[_0x753f('0x2e')],'uniqueid':members[_0x37f349][_0x753f('0x7')]||_0x35d05f[_0x753f('0x7')]});utils[_0x753f('0x5')](util[_0x753f('0x15')](_0x753f('0x2b'),_0x35d05f[_0x753f('0x7')],members[_0x37f349][_0x753f('0x28')],members[_0x37f349][_0x753f('0xa')],members[_0x37f349][_0x753f('0x2a')]));if(members[_0x37f349][_0x753f('0x2c')]){writeDB(members[_0x37f349]);}}}}catch(_0x4f0d82){utils[_0x753f('0x14')](util[_0x753f('0x15')](_0x753f('0x2f'),_0x35d05f['uniqueid']),_0x4f0d82);}}; \ No newline at end of file +var _0xca07=['CreateMemberReport','getUserByName','split','name','request','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','NOT_INUSE','isNil','exitAt','now','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','type','data2','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','util','Local/_attended@transfer','info','format','uniqueid','interface','channel','getUserByInterface','then','membername','internal'];(function(_0x46d235,_0x595716){var _0xaab0c=function(_0x2e58f6){while(--_0x2e58f6){_0x46d235['push'](_0x46d235['shift']());}};_0xaab0c(++_0x595716);}(_0xca07,0xb1));var _0x7ca0=function(_0x3a34f6,_0x586397){_0x3a34f6=_0x3a34f6-0x0;var _0x99473a=_0xca07[_0x3a34f6];return _0x99473a;};'use strict';var _=require('lodash');var util=require(_0x7ca0('0x0'));var utils=require('./utils');var members={};var exclude=[_0x7ca0('0x1'),'Queue:'];function writeDB(_0x24113d){utils[_0x7ca0('0x2')](util[_0x7ca0('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x24113d[_0x7ca0('0x4')],_0x24113d[_0x7ca0('0x5')],_0x24113d[_0x7ca0('0x6')],_0x24113d['data2'],_0x24113d['membername'],_0x24113d['type']));if(_0x24113d[_0x7ca0('0x5')]){utils[_0x7ca0('0x7')](_0x24113d['interface'])[_0x7ca0('0x8')](function(_0x49d8ae){if(_0x49d8ae){_0x24113d[_0x7ca0('0x9')]=_0x49d8ae['name'];_0x24113d['internal']=_0x49d8ae[_0x7ca0('0xa')];utils['request'](_0x7ca0('0xb'),_0x24113d);}else{utils[_0x7ca0('0xc')](_0x24113d[_0x7ca0('0x5')][_0x7ca0('0xd')]('/')[0x1])[_0x7ca0('0x8')](function(_0x4c91cc){if(_0x4c91cc){_0x24113d[_0x7ca0('0x9')]=_0x4c91cc[_0x7ca0('0xe')];_0x24113d[_0x7ca0('0xa')]=_0x4c91cc[_0x7ca0('0xa')];utils[_0x7ca0('0xf')]('CreateMemberReport',_0x24113d);}});}})[_0x7ca0('0x10')](function(_0x26ccc7){utils[_0x7ca0('0x11')](util[_0x7ca0('0x3')](_0x7ca0('0x12'),_0x24113d[_0x7ca0('0x4')]),_0x26ccc7);});}delete members[_0x24113d[_0x7ca0('0x5')]];}function startsWith(_0x4d6352,_0x5c7b84){return _['some'](_0x4d6352,function(_0xcb51e2){return _[_0x7ca0('0x13')](_0x5c7b84,_0xcb51e2);});}exports[_0x7ca0('0x14')]=function(_0x1cbd1d){try{utils[_0x7ca0('0x15')](util[_0x7ca0('0x3')](_0x7ca0('0x16'),members[_0x1cbd1d['device']]?members[_0x1cbd1d[_0x7ca0('0x17')]][_0x7ca0('0x4')]:_0x1cbd1d['device']),_0x1cbd1d);utils[_0x7ca0('0x2')](util[_0x7ca0('0x3')](_0x7ca0('0x18'),members[_0x1cbd1d[_0x7ca0('0x17')]]?members[_0x1cbd1d['device']][_0x7ca0('0x4')]:_0x1cbd1d[_0x7ca0('0x17')],_0x1cbd1d[_0x7ca0('0x19')],_0x1cbd1d['device']));switch(_0x1cbd1d[_0x7ca0('0x19')]){case _0x7ca0('0x1a'):case _0x7ca0('0x1b'):if(!startsWith(exclude,_0x1cbd1d[_0x7ca0('0x17')])){members[_0x1cbd1d[_0x7ca0('0x17')]]={'channel':_0x7ca0('0x1c'),'interface':_0x1cbd1d['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0x7ca0('0x1d')};}break;case _0x7ca0('0x1e'):if(!_[_0x7ca0('0x1f')](members[_0x1cbd1d[_0x7ca0('0x17')]])){members[_0x1cbd1d[_0x7ca0('0x17')]][_0x7ca0('0x20')]=utils[_0x7ca0('0x21')]();members[_0x1cbd1d[_0x7ca0('0x17')]]['duration']=utils['diffTime'](members[_0x1cbd1d[_0x7ca0('0x17')]][_0x7ca0('0x20')],members[_0x1cbd1d[_0x7ca0('0x17')]]['enterAt']);if(members[_0x1cbd1d[_0x7ca0('0x17')]][_0x7ca0('0x4')]){writeDB(members[_0x1cbd1d[_0x7ca0('0x17')]]);}}break;default:break;}}catch(_0xce8611){utils[_0x7ca0('0x11')](util['format'](_0x7ca0('0x16'),members[_0x1cbd1d[_0x7ca0('0x17')]]?members[_0x1cbd1d[_0x7ca0('0x17')]][_0x7ca0('0x4')]:_0x1cbd1d[_0x7ca0('0x17')]),_0xce8611);}};exports['agentcomplete']=function(_0x13087e){try{if(!_[_0x7ca0('0x1f')](members[_0x13087e[_0x7ca0('0x5')]])){utils[_0x7ca0('0x15')](util['format']('[%s][members][agentcomplete]',_0x13087e[_0x7ca0('0x4')]),_0x13087e);utils[_0x7ca0('0x2')](util[_0x7ca0('0x3')](_0x7ca0('0x22'),_0x13087e['uniqueid'],_0x13087e['interface'],_0x13087e[_0x7ca0('0x23')]));members[_0x13087e[_0x7ca0('0x5')]]=_['assign'](members[_0x13087e[_0x7ca0('0x5')]],{'data4':_0x13087e[_0x7ca0('0x23')],'uniqueid':_0x13087e[_0x7ca0('0x4')]});}}catch(_0x3b720f){utils[_0x7ca0('0x11')](util[_0x7ca0('0x3')]('[%s][members][agentcomplete]',_0x13087e['uniqueid']),_0x3b720f);}};exports[_0x7ca0('0x24')]=function(_0x4c421d){try{utils['debug'](util[_0x7ca0('0x3')](_0x7ca0('0x25'),_0x4c421d[_0x7ca0('0x4')]),_0x4c421d);if(_0x4c421d['channel']){var _0x4c91cf=_0x4c421d[_0x7ca0('0x6')][_0x7ca0('0xd')]('-')[0x0];if(!_['isNil'](members[_0x4c91cf])){members[_0x4c91cf]=_[_0x7ca0('0x26')](members[_0x4c91cf],{'data1':members[_0x4c91cf][_0x7ca0('0x27')]||_0x4c421d[_0x7ca0('0x28')],'data2':members[_0x4c91cf][_0x7ca0('0x29')]||_0x4c421d[_0x7ca0('0x2a')],'data3':members[_0x4c91cf]['data3']||_0x4c421d['destination'],'uniqueid':members[_0x4c91cf][_0x7ca0('0x4')]||_0x4c421d[_0x7ca0('0x4')]});utils['info'](util[_0x7ca0('0x3')](_0x7ca0('0x2b'),_0x4c421d[_0x7ca0('0x4')],members[_0x4c91cf][_0x7ca0('0x27')],members[_0x4c91cf]['data2'],members[_0x4c91cf][_0x7ca0('0x2c')]));if(members[_0x4c91cf]['exitAt']){writeDB(members[_0x4c91cf]);}}}if(_0x4c421d[_0x7ca0('0x2d')]){var _0x5dfa73=_0x4c421d[_0x7ca0('0x2d')][_0x7ca0('0xd')]('-')[0x0];if(!_[_0x7ca0('0x1f')](members[_0x5dfa73])){members[_0x5dfa73]=_['assign'](members[_0x5dfa73],{'data1':members[_0x5dfa73][_0x7ca0('0x27')]||_0x4c421d['type'],'data2':members[_0x5dfa73][_0x7ca0('0x29')]||_0x4c421d[_0x7ca0('0x2a')],'data3':members[_0x5dfa73][_0x7ca0('0x2c')]||_0x4c421d[_0x7ca0('0x2e')],'uniqueid':members[_0x5dfa73][_0x7ca0('0x4')]||_0x4c421d[_0x7ca0('0x4')]});utils['info'](util[_0x7ca0('0x3')](_0x7ca0('0x2b'),_0x4c421d['uniqueid'],members[_0x5dfa73][_0x7ca0('0x27')],members[_0x5dfa73][_0x7ca0('0x29')],members[_0x5dfa73]['data3']));if(members[_0x5dfa73][_0x7ca0('0x20')]){writeDB(members[_0x5dfa73]);}}}}catch(_0x35d0d3){utils[_0x7ca0('0x11')](util[_0x7ca0('0x3')](_0x7ca0('0x25'),_0x4c421d[_0x7ca0('0x4')]),_0x35d0d3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ec6047f..e93d79b 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 _0x97db=['queuecallerabandon','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexit','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','connectedlinename','holdtime','count','connectedlinenum','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','membername','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%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','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','calleridnum','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','queuecallerleaveAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x97db,0x17b));var _0xb97d=function(_0x46aa0a,_0x1e5438){_0x46aa0a=_0x46aa0a-0x0;var _0x592ca8=_0x97db[_0x46aa0a];return _0x592ca8;};'use strict';var _=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var utils=require(_0xb97d('0x2'));var queues={};function writeDB(_0x37ff4e){utils[_0xb97d('0x3')](util['format'](_0xb97d('0x4'),_0x37ff4e[_0xb97d('0x5')],_0x37ff4e[_0xb97d('0x6')],_0x37ff4e['queue'],_0x37ff4e['lastAssignedTo'],_0x37ff4e[_0xb97d('0x7')],_0x37ff4e['accountcode'],_0x37ff4e['queuecallerexitreason']));if(_0x37ff4e['queue']){utils[_0xb97d('0x8')](_0x37ff4e[_0xb97d('0x9')])[_0xb97d('0xa')](function(_0x5c26da){if(_0x5c26da){_0x37ff4e[_0xb97d('0xb')]=_0x5c26da['type'];}utils[_0xb97d('0xc')](_0xb97d('0xd'),_0x37ff4e);});}else{utils['request'](_0xb97d('0xd'),_0x37ff4e);}if(_0x37ff4e[_0xb97d('0xe')]){delete queues[_0x37ff4e[_0xb97d('0xe')]];}else{delete queues[_0x37ff4e[_0xb97d('0x5')]];}}exports[_0xb97d('0xf')]=function(_0x4ff8a6){try{utils[_0xb97d('0x10')](util['format'](_0xb97d('0x11'),_0x4ff8a6[_0xb97d('0x5')]),_0x4ff8a6);utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x13'),_0x4ff8a6[_0xb97d('0x5')],_0x4ff8a6[_0xb97d('0x9')],_0x4ff8a6[_0xb97d('0x14')]));queues[_0x4ff8a6['uniqueid']]=_['assign'](_0x4ff8a6,{'originalposition':_0x4ff8a6[_0xb97d('0x14')],'queuecallerjoinAt':utils[_0xb97d('0x15')](),'mohtime':0x0});}catch(_0xe7e842){utils[_0xb97d('0x16')](util[_0xb97d('0x12')](_0xb97d('0x11'),_0x4ff8a6[_0xb97d('0x5')]),_0xe7e842);}};exports[_0xb97d('0x17')]=function(_0x455425){try{if(!_['isNil'](queues[_0x455425[_0xb97d('0x5')]])){utils['debug'](util[_0xb97d('0x12')]('[%s][queues][hangup]',_0x455425['uniqueid']),_0x455425);if(queues[_0x455425[_0xb97d('0x5')]][_0xb97d('0x18')]){if(!queues[_0x455425[_0xb97d('0x5')]][_0xb97d('0x19')]&&!queues[_0x455425[_0xb97d('0x5')]]['queuecallerexit']){queues[_0x455425[_0xb97d('0x5')]][_0xb97d('0x1a')]=!![];queues[_0x455425['uniqueid']]['queuecallercompleteAt']=utils[_0xb97d('0x15')]();queues[_0x455425['uniqueid']][_0xb97d('0x1b')]=_0xb97d('0x1c');}utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x1d'),_0x455425['uniqueid'],queues[_0x455425[_0xb97d('0x5')]][_0xb97d('0x1e')],queues[_0x455425[_0xb97d('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x455425[_0xb97d('0x5')]]);}else if(queues[_0x455425[_0xb97d('0x5')]][_0xb97d('0xe')]){utils[_0xb97d('0x3')](util[_0xb97d('0x12')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x455425[_0xb97d('0x5')],queues[_0x455425[_0xb97d('0x5')]]['name'],queues[_0x455425['uniqueid']][_0xb97d('0xe')]));queues[queues[_0x455425[_0xb97d('0x5')]][_0xb97d('0xe')]]=queues[_0x455425['uniqueid']];queues[queues[_0x455425[_0xb97d('0x5')]][_0xb97d('0xe')]][_0xb97d('0x1f')]=0x2;delete queues[_0x455425['uniqueid']];}}}catch(_0x286248){utils[_0xb97d('0x16')](util[_0xb97d('0x12')]('[%s][queues][hangup]',_0x455425[_0xb97d('0x5')]),_0x286248);}};exports[_0xb97d('0x20')]=function(_0x4a996a){try{utils[_0xb97d('0x10')](util[_0xb97d('0x12')]('[%s][queues][varset]',_0x4a996a[_0xb97d('0x5')]),_0x4a996a);if(!_[_0xb97d('0x21')](_0x4a996a[_0xb97d('0x22')][_0xb97d('0x23')])&&_0x4a996a[_0xb97d('0x24')][_0xb97d('0x25')]()!==_0xb97d('0x26')){if(!_[_0xb97d('0x21')](queues[_0x4a996a['uniqueid']])){queues[_0x4a996a['uniqueid']][_0xb97d('0x19')]=![];queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x27')]=null;queues[_0x4a996a['uniqueid']]['queuecallerexit']=!![];queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x28')]=utils['now']();queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x1b')]=_0x4a996a[_0xb97d('0x24')][_0xb97d('0x25')]();utils['info'](util[_0xb97d('0x12')](_0xb97d('0x29'),_0x4a996a[_0xb97d('0x5')],queues[_0x4a996a['uniqueid']][_0xb97d('0x1e')],_0x4a996a['value'],queues[_0x4a996a[_0xb97d('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4a996a['uniqueid']]);}}else if(!_[_0xb97d('0x21')](_0x4a996a['variable'][_0xb97d('0x2a')])){if(!_[_0xb97d('0x21')](queues[_0x4a996a[_0xb97d('0x5')]])&&!queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x19')]){queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x19')]=![];queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x27')]=null;queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x2b')]=!![];queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x28')]=utils[_0xb97d('0x15')]();queues[_0x4a996a[_0xb97d('0x5')]]['queuecallerexitreason']=_0xb97d('0x2c');utils['info'](util['format'](_0xb97d('0x2d'),_0x4a996a[_0xb97d('0x5')],queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x1e')],_0x4a996a[_0xb97d('0x24')],queues[_0x4a996a[_0xb97d('0x5')]][_0xb97d('0x1b')]));}}}catch(_0x154608){utils['error'](util['format'](_0xb97d('0x2e'),_0x4a996a[_0xb97d('0x5')]),_0x154608);}};exports['queuecallerabandon']=function(_0x454e47){try{if(!_[_0xb97d('0x21')](queues[_0x454e47[_0xb97d('0x5')]])){utils[_0xb97d('0x10')](util['format']('[%s][queues][queuecallerabandon]',_0x454e47[_0xb97d('0x5')]),_0x454e47);queues[_0x454e47[_0xb97d('0x5')]][_0xb97d('0x2b')]=![];queues[_0x454e47[_0xb97d('0x5')]][_0xb97d('0x28')]=null;queues[_0x454e47[_0xb97d('0x5')]][_0xb97d('0x19')]=!![];queues[_0x454e47[_0xb97d('0x5')]][_0xb97d('0x27')]=utils[_0xb97d('0x15')]();queues[_0x454e47[_0xb97d('0x5')]][_0xb97d('0x1b')]='ABANDONED';utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x2f'),_0x454e47[_0xb97d('0x5')],queues[_0x454e47[_0xb97d('0x5')]][_0xb97d('0x1e')],queues[_0x454e47['uniqueid']][_0xb97d('0x1b')]));}}catch(_0x3b05f8){utils[_0xb97d('0x16')](util['format'](_0xb97d('0x30'),_0x454e47[_0xb97d('0x5')]),_0x3b05f8);}};exports[_0xb97d('0x31')]=function(_0x4c8455){try{if(!_[_0xb97d('0x21')](queues[_0x4c8455['uniqueid']])){utils[_0xb97d('0x10')](util[_0xb97d('0x12')]('[%s][queues][queuecallerleave]',_0x4c8455[_0xb97d('0x5')]),_0x4c8455);utils[_0xb97d('0x3')](util[_0xb97d('0x12')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4c8455[_0xb97d('0x5')],queues[_0x4c8455[_0xb97d('0x5')]]['name'],_0x4c8455['connectedlinenum'],_0x4c8455[_0xb97d('0x32')]));queues[_0x4c8455[_0xb97d('0x5')]][_0xb97d('0x31')]=!![];queues[_0x4c8455[_0xb97d('0x5')]][_0xb97d('0x18')]=utils[_0xb97d('0x15')]();queues[_0x4c8455['uniqueid']][_0xb97d('0x33')]=utils['diffTime'](queues[_0x4c8455[_0xb97d('0x5')]][_0xb97d('0x18')],queues[_0x4c8455[_0xb97d('0x5')]]['queuecallerjoinAt']);queues[_0x4c8455[_0xb97d('0x5')]][_0xb97d('0x14')]=_0x4c8455[_0xb97d('0x14')];queues[_0x4c8455[_0xb97d('0x5')]][_0xb97d('0x34')]=_0x4c8455[_0xb97d('0x34')];queues[_0x4c8455['uniqueid']]['connectedlinenum']=_0x4c8455[_0xb97d('0x35')];queues[_0x4c8455[_0xb97d('0x5')]]['connectedlinename']=_0x4c8455[_0xb97d('0x32')];}}catch(_0x5752bc){utils['error'](util[_0xb97d('0x12')](_0xb97d('0x36'),_0x4c8455[_0xb97d('0x5')]),_0x5752bc);}};exports['agentconnect']=function(_0x34e349){try{if(!_[_0xb97d('0x21')](queues[_0x34e349[_0xb97d('0x5')]])){utils[_0xb97d('0x10')](util['format'](_0xb97d('0x37'),_0x34e349[_0xb97d('0x5')]),_0x34e349);utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x38'),_0x34e349[_0xb97d('0x5')],queues[_0x34e349[_0xb97d('0x5')]]['name'],_0x34e349['membername'],_0x34e349[_0xb97d('0x39')]));queues[_0x34e349[_0xb97d('0x5')]][_0xb97d('0x19')]=![];queues[_0x34e349[_0xb97d('0x5')]][_0xb97d('0x19')]=![];queues[_0x34e349[_0xb97d('0x5')]]['queuecallerabandonAt']=null;queues[_0x34e349[_0xb97d('0x5')]]['queuecallerexit']=![];queues[_0x34e349[_0xb97d('0x5')]]['queuecallerexitreason']=null;queues[_0x34e349[_0xb97d('0x5')]]['queuecallerexitAt']=null;queues[_0x34e349[_0xb97d('0x5')]][_0xb97d('0x3a')]=!![];queues[_0x34e349[_0xb97d('0x5')]][_0xb97d('0x3b')]=_0x34e349[_0xb97d('0x39')];queues[_0x34e349[_0xb97d('0x5')]]['lastAssignedTo']=_0x34e349[_0xb97d('0x3c')];}}catch(_0x15f09f){utils[_0xb97d('0x16')](util[_0xb97d('0x12')](_0xb97d('0x37'),_0x34e349[_0xb97d('0x5')]),_0x15f09f);}};exports['agentcomplete']=function(_0x21a68b){try{if(!_[_0xb97d('0x21')](queues[_0x21a68b[_0xb97d('0x5')]])){if(queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x18')]){utils[_0xb97d('0x10')](util[_0xb97d('0x12')](_0xb97d('0x3d'),_0x21a68b[_0xb97d('0x5')]),_0x21a68b);queues[_0x21a68b['uniqueid']][_0xb97d('0x19')]=![];queues[_0x21a68b[_0xb97d('0x5')]]['queuecallerabandon']=![];queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x27')]=null;queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x2b')]=![];queues[_0x21a68b['uniqueid']][_0xb97d('0x28')]=null;queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x3a')]=!![];queues[_0x21a68b[_0xb97d('0x5')]]['lastAssignedTo']=_0x21a68b[_0xb97d('0x3c')];queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x1a')]=!![];queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x3e')]=utils[_0xb97d('0x15')]();if(_0x21a68b['reason']==_0xb97d('0x3f')){if(!queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x3f')]){queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x1b')]='TRANSFER';}}else{queues[_0x21a68b['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x21a68b[_0xb97d('0x40')][_0xb97d('0x25')]();}utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x41'),_0x21a68b['uniqueid'],queues[_0x21a68b[_0xb97d('0x5')]][_0xb97d('0x1e')],_0x21a68b[_0xb97d('0x3c')],queues[_0x21a68b['uniqueid']][_0xb97d('0x1b')]));writeDB(queues[_0x21a68b['uniqueid']]);}}}catch(_0x5b78fa){utils['error'](util[_0xb97d('0x12')](_0xb97d('0x3d'),_0x21a68b[_0xb97d('0x5')]),_0x5b78fa);}};exports[_0xb97d('0x42')]=function(_0x4bcc1e){try{if(!_['isNil'](queues[_0x4bcc1e[_0xb97d('0x43')]])){utils['debug'](util[_0xb97d('0x12')](_0xb97d('0x44'),_0x4bcc1e[_0xb97d('0x5')]),_0x4bcc1e);queues[_0x4bcc1e[_0xb97d('0x43')]][_0xb97d('0x3f')]=!![];queues[_0x4bcc1e[_0xb97d('0x43')]][_0xb97d('0x45')]='BLIND';queues[_0x4bcc1e[_0xb97d('0x43')]][_0xb97d('0x46')]=_0x4bcc1e[_0xb97d('0x47')];queues[_0x4bcc1e[_0xb97d('0x43')]]['transferuniqueid']=_0x4bcc1e[_0xb97d('0x43')];queues[_0x4bcc1e[_0xb97d('0x43')]][_0xb97d('0x1b')]=_0xb97d('0x48');utils[_0xb97d('0x3')](util[_0xb97d('0x12')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4bcc1e[_0xb97d('0x5')],queues[_0x4bcc1e[_0xb97d('0x43')]]['name'],_0x4bcc1e[_0xb97d('0x43')],_0x4bcc1e[_0xb97d('0x47')]));}}catch(_0x2da3bb){utils[_0xb97d('0x16')](util['format'](_0xb97d('0x44'),_0x4bcc1e[_0xb97d('0x5')]),_0x2da3bb);}};exports[_0xb97d('0x49')]=function(_0x5e1a60){try{utils[_0xb97d('0x10')](util['format'](_0xb97d('0x4a'),_0x5e1a60['origtransfereruniqueid']),_0x5e1a60);if(_0x5e1a60[_0xb97d('0x4b')]==_0x5e1a60[_0xb97d('0x4c')]){if(!_[_0xb97d('0x21')](queues[_0x5e1a60['secondtransfererlinkedid']])){utils[_0xb97d('0x3')](util[_0xb97d('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5e1a60['origtransfereruniqueid'],queues[_0x5e1a60[_0xb97d('0x4d')]][_0xb97d('0x1e')],_0x5e1a60['origtransfererexten']));queues[_0x5e1a60[_0xb97d('0x4d')]]['transfer']=!![];queues[_0x5e1a60[_0xb97d('0x4d')]]['transfertype']=_0xb97d('0x4e');queues[_0x5e1a60[_0xb97d('0x4d')]][_0xb97d('0x46')]=_0x5e1a60[_0xb97d('0x4f')];queues[_0x5e1a60['secondtransfererlinkedid']][_0xb97d('0x50')]=_0x5e1a60[_0xb97d('0x4b')];queues[_0x5e1a60[_0xb97d('0x4d')]][_0xb97d('0x1b')]=_0xb97d('0x51');}if(!_[_0xb97d('0x21')](queues[_0x5e1a60[_0xb97d('0x4c')]])){if(_0x5e1a60['transfereelinkedid']&&queues[_0x5e1a60[_0xb97d('0x52')]]){queues[_0x5e1a60[_0xb97d('0x52')]][_0xb97d('0x1f')]=0x1;queues[_0x5e1a60[_0xb97d('0x43')]]=_[_0xb97d('0x53')](queues[_0x5e1a60[_0xb97d('0x52')]]);queues[_0x5e1a60['transfereeuniqueid']]['transfereduniqueid']=_0x5e1a60['transfertargetuniqueid'];queues[_0x5e1a60[_0xb97d('0x43')]][_0xb97d('0x1f')]=0x2;queues[_0x5e1a60['transfereeuniqueid']]['calleridnum']=queues[_0x5e1a60[_0xb97d('0x4d')]][_0xb97d('0x7')];queues[_0x5e1a60[_0xb97d('0x43')]][_0xb97d('0x54')]=queues[_0x5e1a60[_0xb97d('0x4d')]][_0xb97d('0x54')];queues[_0x5e1a60[_0xb97d('0x43')]][_0xb97d('0x55')]=utils[_0xb97d('0x15')]();queues[_0x5e1a60[_0xb97d('0x43')]][_0xb97d('0x18')]=utils[_0xb97d('0x15')]();queues[_0x5e1a60['transfereeuniqueid']]['holdtime']=0x0;queues[_0x5e1a60[_0xb97d('0x43')]]['mohtime']=0x0;utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x56'),_0x5e1a60[_0xb97d('0x4b')],queues[_0x5e1a60[_0xb97d('0x43')]][_0xb97d('0x1e')],queues[_0x5e1a60[_0xb97d('0x43')]]['calleridnum'],queues[_0x5e1a60[_0xb97d('0x43')]][_0xb97d('0x54')]));}else{utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x57'),_0x5e1a60[_0xb97d('0x4b')],queues[_0x5e1a60[_0xb97d('0x4c')]]['name'],_0x5e1a60[_0xb97d('0x4d')]));queues[_0x5e1a60['origtransfererlinkedid']][_0xb97d('0xe')]=_0x5e1a60[_0xb97d('0x4d')];}}}else if(_0x5e1a60['secondtransfereruniqueid']==_0x5e1a60[_0xb97d('0x4d')]){if(!_[_0xb97d('0x21')](queues[_0x5e1a60['origtransfererlinkedid']])){utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x58'),_0x5e1a60[_0xb97d('0x4b')],queues[_0x5e1a60[_0xb97d('0x4c')]]['name'],_0x5e1a60['secondtransfereruniqueid'],_0x5e1a60[_0xb97d('0x59')]));queues[_0x5e1a60[_0xb97d('0x4c')]]['transfer']=!![];queues[_0x5e1a60[_0xb97d('0x4c')]][_0xb97d('0x45')]=_0xb97d('0x4e');queues[_0x5e1a60[_0xb97d('0x4c')]][_0xb97d('0x46')]=_0x5e1a60[_0xb97d('0x59')];queues[_0x5e1a60['origtransfererlinkedid']][_0xb97d('0x50')]=_0x5e1a60[_0xb97d('0x5a')];queues[_0x5e1a60[_0xb97d('0x4c')]][_0xb97d('0x1b')]=_0xb97d('0x51');}if(!_[_0xb97d('0x21')](queues[_0x5e1a60[_0xb97d('0x4d')]])){if(_0x5e1a60[_0xb97d('0x5b')]&&queues[_0x5e1a60['transfertargetlinkedid']]){queues[_0x5e1a60[_0xb97d('0x5b')]][_0xb97d('0x1f')]=0x1;queues[_0x5e1a60[_0xb97d('0x5c')]]=_[_0xb97d('0x53')](queues[_0x5e1a60[_0xb97d('0x5b')]]);queues[_0x5e1a60[_0xb97d('0x5c')]][_0xb97d('0xe')]=_0x5e1a60[_0xb97d('0x5c')];queues[_0x5e1a60[_0xb97d('0x5c')]][_0xb97d('0x1f')]=0x2;queues[_0x5e1a60[_0xb97d('0x5c')]][_0xb97d('0x7')]=queues[_0x5e1a60['origtransfererlinkedid']][_0xb97d('0x7')];queues[_0x5e1a60[_0xb97d('0x5c')]]['calleridname']=queues[_0x5e1a60['origtransfererlinkedid']][_0xb97d('0x54')];queues[_0x5e1a60[_0xb97d('0x5c')]]['queuecallerjoinAt']=utils['now']();queues[_0x5e1a60[_0xb97d('0x5c')]][_0xb97d('0x18')]=utils[_0xb97d('0x15')]();queues[_0x5e1a60['transfertargetuniqueid']][_0xb97d('0x33')]=0x0;queues[_0x5e1a60[_0xb97d('0x5c')]][_0xb97d('0x5d')]=0x0;utils['info'](util[_0xb97d('0x12')](_0xb97d('0x5e'),_0x5e1a60[_0xb97d('0x4b')],queues[_0x5e1a60[_0xb97d('0x5c')]]['name'],queues[_0x5e1a60[_0xb97d('0x5c')]]['transfereduniqueid'],queues[_0x5e1a60[_0xb97d('0x5c')]][_0xb97d('0x7')],queues[_0x5e1a60[_0xb97d('0x5c')]][_0xb97d('0x54')]));}else{utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x57'),_0x5e1a60[_0xb97d('0x4b')],queues[_0x5e1a60[_0xb97d('0x4d')]]['name'],_0x5e1a60['origtransfererlinkedid']));queues[_0x5e1a60[_0xb97d('0x4d')]][_0xb97d('0xe')]=_0x5e1a60[_0xb97d('0x4c')];}}}}catch(_0x47dde3){utils[_0xb97d('0x16')](util['format']('[%s][queues][attendedtransfer]',_0x5e1a60[_0xb97d('0x4b')]),_0x47dde3);}};exports[_0xb97d('0x5f')]=function(_0x3bcfa7){try{if(!_[_0xb97d('0x21')](queues[_0x3bcfa7[_0xb97d('0x5')]])){utils[_0xb97d('0x10')](util[_0xb97d('0x12')](_0xb97d('0x60'),_0x3bcfa7[_0xb97d('0x5')]),_0x3bcfa7);queues[_0x3bcfa7[_0xb97d('0x5')]][_0xb97d('0x61')]=utils['now']();utils['info'](util[_0xb97d('0x12')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3bcfa7['uniqueid'],queues[_0x3bcfa7[_0xb97d('0x5')]][_0xb97d('0x1e')],queues[_0x3bcfa7[_0xb97d('0x5')]]['musiconholdstartAt']));}}catch(_0x38c2a0){utils[_0xb97d('0x16')](util[_0xb97d('0x12')](_0xb97d('0x60'),_0x3bcfa7[_0xb97d('0x5')]),_0x38c2a0);}};exports[_0xb97d('0x62')]=function(_0x5816e8){try{if(!_[_0xb97d('0x21')](queues[_0x5816e8[_0xb97d('0x5')]])){if(!_[_0xb97d('0x21')](queues[_0x5816e8['uniqueid']][_0xb97d('0x61')])){utils[_0xb97d('0x10')](util[_0xb97d('0x12')](_0xb97d('0x63'),_0x5816e8[_0xb97d('0x5')]),_0x5816e8);queues[_0x5816e8['uniqueid']][_0xb97d('0x5d')]+=utils['diffTime'](utils[_0xb97d('0x15')](),queues[_0x5816e8[_0xb97d('0x5')]][_0xb97d('0x61')]);utils[_0xb97d('0x3')](util[_0xb97d('0x12')](_0xb97d('0x64'),_0x5816e8[_0xb97d('0x5')],queues[_0x5816e8[_0xb97d('0x5')]][_0xb97d('0x1e')],queues[_0x5816e8[_0xb97d('0x5')]][_0xb97d('0x5d')]));delete queues[_0x5816e8[_0xb97d('0x5')]]['musiconholdstartAt'];}}}catch(_0x5a5dca){utils[_0xb97d('0x16')](util['format'](_0xb97d('0x63'),_0x5816e8[_0xb97d('0x5')]),_0x5a5dca);}}; \ No newline at end of file +var _0xbb87=['queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%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','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallercompleteAt','now','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','value','CONTINUE','isNil','queuecallerabandon','queuecallerexit'];(function(_0x5288cb,_0x3d0d52){var _0x577882=function(_0x568823){while(--_0x568823){_0x5288cb['push'](_0x5288cb['shift']());}};_0x577882(++_0x3d0d52);}(_0xbb87,0x174));var _0x7bb8=function(_0x335f15,_0x48e11e){_0x335f15=_0x335f15-0x0;var _0x50864c=_0xbb87[_0x335f15];return _0x50864c;};'use strict';var _=require(_0x7bb8('0x0'));var util=require(_0x7bb8('0x1'));var utils=require(_0x7bb8('0x2'));var queues={};function writeDB(_0x2795e0){utils['info'](util[_0x7bb8('0x3')](_0x7bb8('0x4'),_0x2795e0[_0x7bb8('0x5')],_0x2795e0[_0x7bb8('0x6')],_0x2795e0['queue'],_0x2795e0['lastAssignedTo'],_0x2795e0[_0x7bb8('0x7')],_0x2795e0[_0x7bb8('0x8')],_0x2795e0[_0x7bb8('0x9')]));if(_0x2795e0[_0x7bb8('0xa')]){utils[_0x7bb8('0xb')](_0x2795e0[_0x7bb8('0xa')])[_0x7bb8('0xc')](function(_0x39911b){if(_0x39911b){_0x2795e0[_0x7bb8('0xd')]=_0x39911b[_0x7bb8('0xd')];}utils[_0x7bb8('0xe')](_0x7bb8('0xf'),_0x2795e0);});}else{utils['request'](_0x7bb8('0xf'),_0x2795e0);}if(_0x2795e0['transfereduniqueid']){delete queues[_0x2795e0[_0x7bb8('0x10')]];}else{delete queues[_0x2795e0[_0x7bb8('0x5')]];}}exports[_0x7bb8('0x11')]=function(_0x458885){try{utils[_0x7bb8('0x12')](util['format']('[%s][queues][queuecallerjoin]',_0x458885[_0x7bb8('0x5')]),_0x458885);utils['info'](util['format'](_0x7bb8('0x13'),_0x458885['uniqueid'],_0x458885[_0x7bb8('0xa')],_0x458885[_0x7bb8('0x14')]));queues[_0x458885['uniqueid']]=_[_0x7bb8('0x15')](_0x458885,{'originalposition':_0x458885[_0x7bb8('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x6b31a2){utils[_0x7bb8('0x16')](util[_0x7bb8('0x3')](_0x7bb8('0x17'),_0x458885[_0x7bb8('0x5')]),_0x6b31a2);}};exports['hangup']=function(_0x176553){try{if(!_['isNil'](queues[_0x176553[_0x7bb8('0x5')]])){utils[_0x7bb8('0x12')](util[_0x7bb8('0x3')](_0x7bb8('0x18'),_0x176553[_0x7bb8('0x5')]),_0x176553);if(queues[_0x176553[_0x7bb8('0x5')]][_0x7bb8('0x19')]){if(!queues[_0x176553[_0x7bb8('0x5')]]['queuecallerabandon']&&!queues[_0x176553[_0x7bb8('0x5')]]['queuecallerexit']){queues[_0x176553[_0x7bb8('0x5')]]['queuecallercomplete']=!![];queues[_0x176553[_0x7bb8('0x5')]][_0x7bb8('0x1a')]=utils[_0x7bb8('0x1b')]();queues[_0x176553[_0x7bb8('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x1d'),_0x176553[_0x7bb8('0x5')],queues[_0x176553[_0x7bb8('0x5')]][_0x7bb8('0x1e')],queues[_0x176553[_0x7bb8('0x5')]][_0x7bb8('0x9')]));writeDB(queues[_0x176553[_0x7bb8('0x5')]]);}else if(queues[_0x176553[_0x7bb8('0x5')]][_0x7bb8('0x10')]){utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x1f'),_0x176553[_0x7bb8('0x5')],queues[_0x176553[_0x7bb8('0x5')]]['name'],queues[_0x176553[_0x7bb8('0x5')]]['transfereduniqueid']));queues[queues[_0x176553[_0x7bb8('0x5')]]['transfereduniqueid']]=queues[_0x176553['uniqueid']];queues[queues[_0x176553[_0x7bb8('0x5')]][_0x7bb8('0x10')]][_0x7bb8('0x20')]=0x2;delete queues[_0x176553[_0x7bb8('0x5')]];}}}catch(_0xf9eb41){utils[_0x7bb8('0x16')](util[_0x7bb8('0x3')](_0x7bb8('0x18'),_0x176553[_0x7bb8('0x5')]),_0xf9eb41);}};exports[_0x7bb8('0x21')]=function(_0x559e74){try{utils[_0x7bb8('0x12')](util['format'](_0x7bb8('0x22'),_0x559e74[_0x7bb8('0x5')]),_0x559e74);if(!_['isNil'](_0x559e74['variable']['queuestatus'])&&_0x559e74[_0x7bb8('0x23')]['toUpperCase']()!==_0x7bb8('0x24')){if(!_[_0x7bb8('0x25')](queues[_0x559e74[_0x7bb8('0x5')]])){queues[_0x559e74['uniqueid']][_0x7bb8('0x26')]=![];queues[_0x559e74[_0x7bb8('0x5')]]['queuecallerabandonAt']=null;queues[_0x559e74[_0x7bb8('0x5')]][_0x7bb8('0x27')]=!![];queues[_0x559e74[_0x7bb8('0x5')]][_0x7bb8('0x28')]=utils[_0x7bb8('0x1b')]();queues[_0x559e74['uniqueid']][_0x7bb8('0x9')]=_0x559e74[_0x7bb8('0x23')][_0x7bb8('0x29')]();utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x2a'),_0x559e74[_0x7bb8('0x5')],queues[_0x559e74[_0x7bb8('0x5')]][_0x7bb8('0x1e')],_0x559e74['value'],queues[_0x559e74['uniqueid']][_0x7bb8('0x9')]));writeDB(queues[_0x559e74[_0x7bb8('0x5')]]);}}else if(!_[_0x7bb8('0x25')](_0x559e74[_0x7bb8('0x2b')]['queueposition'])){if(!_[_0x7bb8('0x25')](queues[_0x559e74[_0x7bb8('0x5')]])&&!queues[_0x559e74[_0x7bb8('0x5')]][_0x7bb8('0x26')]){queues[_0x559e74[_0x7bb8('0x5')]][_0x7bb8('0x26')]=![];queues[_0x559e74[_0x7bb8('0x5')]]['queuecallerabandonAt']=null;queues[_0x559e74[_0x7bb8('0x5')]][_0x7bb8('0x27')]=!![];queues[_0x559e74['uniqueid']][_0x7bb8('0x28')]=utils['now']();queues[_0x559e74['uniqueid']][_0x7bb8('0x9')]=_0x7bb8('0x2c');utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x2d'),_0x559e74[_0x7bb8('0x5')],queues[_0x559e74[_0x7bb8('0x5')]][_0x7bb8('0x1e')],_0x559e74[_0x7bb8('0x23')],queues[_0x559e74['uniqueid']][_0x7bb8('0x9')]));}}}catch(_0x53b979){utils[_0x7bb8('0x16')](util[_0x7bb8('0x3')](_0x7bb8('0x22'),_0x559e74[_0x7bb8('0x5')]),_0x53b979);}};exports[_0x7bb8('0x26')]=function(_0x1b512c){try{if(!_[_0x7bb8('0x25')](queues[_0x1b512c[_0x7bb8('0x5')]])){utils[_0x7bb8('0x12')](util[_0x7bb8('0x3')](_0x7bb8('0x2e'),_0x1b512c['uniqueid']),_0x1b512c);queues[_0x1b512c['uniqueid']][_0x7bb8('0x27')]=![];queues[_0x1b512c[_0x7bb8('0x5')]][_0x7bb8('0x28')]=null;queues[_0x1b512c[_0x7bb8('0x5')]][_0x7bb8('0x26')]=!![];queues[_0x1b512c[_0x7bb8('0x5')]][_0x7bb8('0x2f')]=utils[_0x7bb8('0x1b')]();queues[_0x1b512c['uniqueid']][_0x7bb8('0x9')]=_0x7bb8('0x30');utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x31'),_0x1b512c[_0x7bb8('0x5')],queues[_0x1b512c['uniqueid']][_0x7bb8('0x1e')],queues[_0x1b512c['uniqueid']][_0x7bb8('0x9')]));}}catch(_0x795c0){utils[_0x7bb8('0x16')](util[_0x7bb8('0x3')](_0x7bb8('0x2e'),_0x1b512c[_0x7bb8('0x5')]),_0x795c0);}};exports[_0x7bb8('0x32')]=function(_0xeb82c3){try{if(!_['isNil'](queues[_0xeb82c3[_0x7bb8('0x5')]])){utils[_0x7bb8('0x12')](util['format'](_0x7bb8('0x33'),_0xeb82c3[_0x7bb8('0x5')]),_0xeb82c3);utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xeb82c3[_0x7bb8('0x5')],queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x1e')],_0xeb82c3[_0x7bb8('0x34')],_0xeb82c3[_0x7bb8('0x35')]));queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x32')]=!![];queues[_0xeb82c3['uniqueid']][_0x7bb8('0x19')]=utils[_0x7bb8('0x1b')]();queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x36')]=utils[_0x7bb8('0x37')](queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x19')],queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x38')]);queues[_0xeb82c3[_0x7bb8('0x5')]]['position']=_0xeb82c3[_0x7bb8('0x14')];queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x39')]=_0xeb82c3['count'];queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x34')]=_0xeb82c3[_0x7bb8('0x34')];queues[_0xeb82c3[_0x7bb8('0x5')]][_0x7bb8('0x35')]=_0xeb82c3[_0x7bb8('0x35')];}}catch(_0x39bb96){utils[_0x7bb8('0x16')](util[_0x7bb8('0x3')](_0x7bb8('0x33'),_0xeb82c3[_0x7bb8('0x5')]),_0x39bb96);}};exports[_0x7bb8('0x3a')]=function(_0xb05b04){try{if(!_[_0x7bb8('0x25')](queues[_0xb05b04[_0x7bb8('0x5')]])){utils[_0x7bb8('0x12')](util[_0x7bb8('0x3')](_0x7bb8('0x3b'),_0xb05b04['uniqueid']),_0xb05b04);utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x3c'),_0xb05b04[_0x7bb8('0x5')],queues[_0xb05b04[_0x7bb8('0x5')]]['name'],_0xb05b04[_0x7bb8('0x3d')],_0xb05b04[_0x7bb8('0x3e')]));queues[_0xb05b04['uniqueid']][_0x7bb8('0x26')]=![];queues[_0xb05b04[_0x7bb8('0x5')]]['queuecallerabandon']=![];queues[_0xb05b04['uniqueid']]['queuecallerabandonAt']=null;queues[_0xb05b04[_0x7bb8('0x5')]][_0x7bb8('0x27')]=![];queues[_0xb05b04[_0x7bb8('0x5')]][_0x7bb8('0x9')]=null;queues[_0xb05b04[_0x7bb8('0x5')]]['queuecallerexitAt']=null;queues[_0xb05b04['uniqueid']][_0x7bb8('0x3f')]=!![];queues[_0xb05b04['uniqueid']][_0x7bb8('0x8')]=_0xb05b04[_0x7bb8('0x3e')];queues[_0xb05b04['uniqueid']][_0x7bb8('0x40')]=_0xb05b04[_0x7bb8('0x3d')];}}catch(_0x11eb1f){utils[_0x7bb8('0x16')](util['format'](_0x7bb8('0x3b'),_0xb05b04[_0x7bb8('0x5')]),_0x11eb1f);}};exports['agentcomplete']=function(_0x5373ce){try{if(!_[_0x7bb8('0x25')](queues[_0x5373ce['uniqueid']])){if(queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x19')]){utils[_0x7bb8('0x12')](util['format'](_0x7bb8('0x41'),_0x5373ce['uniqueid']),_0x5373ce);queues[_0x5373ce['uniqueid']]['queuecallerabandon']=![];queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x26')]=![];queues[_0x5373ce['uniqueid']][_0x7bb8('0x2f')]=null;queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x27')]=![];queues[_0x5373ce[_0x7bb8('0x5')]]['queuecallerexitAt']=null;queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x3f')]=!![];queues[_0x5373ce['uniqueid']][_0x7bb8('0x40')]=_0x5373ce[_0x7bb8('0x3d')];queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x42')]=!![];queues[_0x5373ce['uniqueid']][_0x7bb8('0x1a')]=utils[_0x7bb8('0x1b')]();if(_0x5373ce[_0x7bb8('0x43')]==_0x7bb8('0x44')){if(!queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x44')]){queues[_0x5373ce['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x9')]=_0x7bb8('0x45')+_0x5373ce[_0x7bb8('0x43')]['toUpperCase']();}utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x46'),_0x5373ce[_0x7bb8('0x5')],queues[_0x5373ce['uniqueid']]['name'],_0x5373ce['membername'],queues[_0x5373ce[_0x7bb8('0x5')]][_0x7bb8('0x9')]));writeDB(queues[_0x5373ce[_0x7bb8('0x5')]]);}}}catch(_0x137788){utils['error'](util[_0x7bb8('0x3')](_0x7bb8('0x41'),_0x5373ce[_0x7bb8('0x5')]),_0x137788);}};exports['blindtransfer']=function(_0x208fcb){try{if(!_[_0x7bb8('0x25')](queues[_0x208fcb[_0x7bb8('0x47')]])){utils[_0x7bb8('0x12')](util[_0x7bb8('0x3')]('[%s][queues][blindtransfer]',_0x208fcb[_0x7bb8('0x5')]),_0x208fcb);queues[_0x208fcb[_0x7bb8('0x47')]]['transfer']=!![];queues[_0x208fcb[_0x7bb8('0x47')]][_0x7bb8('0x48')]='BLIND';queues[_0x208fcb[_0x7bb8('0x47')]][_0x7bb8('0x49')]=_0x208fcb[_0x7bb8('0x4a')];queues[_0x208fcb[_0x7bb8('0x47')]][_0x7bb8('0x4b')]=_0x208fcb[_0x7bb8('0x47')];queues[_0x208fcb['transfereeuniqueid']][_0x7bb8('0x9')]=_0x7bb8('0x4c');utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x4d'),_0x208fcb[_0x7bb8('0x5')],queues[_0x208fcb['transfereeuniqueid']]['name'],_0x208fcb[_0x7bb8('0x47')],_0x208fcb[_0x7bb8('0x4a')]));}}catch(_0x49d1dc){utils[_0x7bb8('0x16')](util[_0x7bb8('0x3')](_0x7bb8('0x4e'),_0x208fcb['uniqueid']),_0x49d1dc);}};exports[_0x7bb8('0x4f')]=function(_0x5ba7f6){try{utils[_0x7bb8('0x12')](util[_0x7bb8('0x3')]('[%s][queues][attendedtransfer]',_0x5ba7f6[_0x7bb8('0x50')]),_0x5ba7f6);if(_0x5ba7f6['origtransfereruniqueid']==_0x5ba7f6['origtransfererlinkedid']){if(!_[_0x7bb8('0x25')](queues[_0x5ba7f6[_0x7bb8('0x51')]])){utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x52'),_0x5ba7f6[_0x7bb8('0x50')],queues[_0x5ba7f6[_0x7bb8('0x51')]][_0x7bb8('0x1e')],_0x5ba7f6[_0x7bb8('0x53')]));queues[_0x5ba7f6[_0x7bb8('0x51')]][_0x7bb8('0x44')]=!![];queues[_0x5ba7f6['secondtransfererlinkedid']][_0x7bb8('0x48')]=_0x7bb8('0x54');queues[_0x5ba7f6['secondtransfererlinkedid']][_0x7bb8('0x49')]=_0x5ba7f6[_0x7bb8('0x53')];queues[_0x5ba7f6['secondtransfererlinkedid']]['transferuniqueid']=_0x5ba7f6[_0x7bb8('0x50')];queues[_0x5ba7f6[_0x7bb8('0x51')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x7bb8('0x25')](queues[_0x5ba7f6[_0x7bb8('0x55')]])){if(_0x5ba7f6[_0x7bb8('0x56')]&&queues[_0x5ba7f6[_0x7bb8('0x56')]]){queues[_0x5ba7f6[_0x7bb8('0x56')]][_0x7bb8('0x20')]=0x1;queues[_0x5ba7f6[_0x7bb8('0x47')]]=_[_0x7bb8('0x57')](queues[_0x5ba7f6[_0x7bb8('0x56')]]);queues[_0x5ba7f6[_0x7bb8('0x47')]][_0x7bb8('0x10')]=_0x5ba7f6[_0x7bb8('0x58')];queues[_0x5ba7f6[_0x7bb8('0x47')]]['queuecallerenterreason']=0x2;queues[_0x5ba7f6[_0x7bb8('0x47')]][_0x7bb8('0x7')]=queues[_0x5ba7f6[_0x7bb8('0x51')]][_0x7bb8('0x7')];queues[_0x5ba7f6['transfereeuniqueid']][_0x7bb8('0x59')]=queues[_0x5ba7f6[_0x7bb8('0x51')]][_0x7bb8('0x59')];queues[_0x5ba7f6['transfereeuniqueid']][_0x7bb8('0x38')]=utils['now']();queues[_0x5ba7f6[_0x7bb8('0x47')]][_0x7bb8('0x19')]=utils[_0x7bb8('0x1b')]();queues[_0x5ba7f6[_0x7bb8('0x47')]][_0x7bb8('0x36')]=0x0;queues[_0x5ba7f6[_0x7bb8('0x47')]]['mohtime']=0x0;utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x5a'),_0x5ba7f6['origtransfereruniqueid'],queues[_0x5ba7f6[_0x7bb8('0x47')]]['name'],queues[_0x5ba7f6[_0x7bb8('0x47')]]['calleridnum'],queues[_0x5ba7f6[_0x7bb8('0x47')]][_0x7bb8('0x59')]));}else{utils[_0x7bb8('0x1c')](util['format'](_0x7bb8('0x5b'),_0x5ba7f6[_0x7bb8('0x50')],queues[_0x5ba7f6[_0x7bb8('0x55')]][_0x7bb8('0x1e')],_0x5ba7f6[_0x7bb8('0x51')]));queues[_0x5ba7f6[_0x7bb8('0x55')]][_0x7bb8('0x10')]=_0x5ba7f6[_0x7bb8('0x51')];}}}else if(_0x5ba7f6[_0x7bb8('0x5c')]==_0x5ba7f6[_0x7bb8('0x51')]){if(!_[_0x7bb8('0x25')](queues[_0x5ba7f6[_0x7bb8('0x55')]])){utils[_0x7bb8('0x1c')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5ba7f6[_0x7bb8('0x50')],queues[_0x5ba7f6['origtransfererlinkedid']][_0x7bb8('0x1e')],_0x5ba7f6[_0x7bb8('0x5c')],_0x5ba7f6[_0x7bb8('0x5d')]));queues[_0x5ba7f6[_0x7bb8('0x55')]][_0x7bb8('0x44')]=!![];queues[_0x5ba7f6['origtransfererlinkedid']][_0x7bb8('0x48')]=_0x7bb8('0x54');queues[_0x5ba7f6[_0x7bb8('0x55')]]['transferexten']=_0x5ba7f6['secondtransfererexten'];queues[_0x5ba7f6['origtransfererlinkedid']][_0x7bb8('0x4b')]=_0x5ba7f6[_0x7bb8('0x5c')];queues[_0x5ba7f6[_0x7bb8('0x55')]][_0x7bb8('0x9')]=_0x7bb8('0x5e');}if(!_['isNil'](queues[_0x5ba7f6['secondtransfererlinkedid']])){if(_0x5ba7f6[_0x7bb8('0x5f')]&&queues[_0x5ba7f6[_0x7bb8('0x5f')]]){queues[_0x5ba7f6[_0x7bb8('0x5f')]][_0x7bb8('0x20')]=0x1;queues[_0x5ba7f6[_0x7bb8('0x58')]]=_['clone'](queues[_0x5ba7f6[_0x7bb8('0x5f')]]);queues[_0x5ba7f6[_0x7bb8('0x58')]][_0x7bb8('0x10')]=_0x5ba7f6[_0x7bb8('0x58')];queues[_0x5ba7f6[_0x7bb8('0x58')]]['queuecallerenterreason']=0x2;queues[_0x5ba7f6[_0x7bb8('0x58')]]['calleridnum']=queues[_0x5ba7f6[_0x7bb8('0x55')]][_0x7bb8('0x7')];queues[_0x5ba7f6[_0x7bb8('0x58')]]['calleridname']=queues[_0x5ba7f6[_0x7bb8('0x55')]]['calleridname'];queues[_0x5ba7f6[_0x7bb8('0x58')]][_0x7bb8('0x38')]=utils['now']();queues[_0x5ba7f6['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x7bb8('0x1b')]();queues[_0x5ba7f6[_0x7bb8('0x58')]][_0x7bb8('0x36')]=0x0;queues[_0x5ba7f6[_0x7bb8('0x58')]][_0x7bb8('0x60')]=0x0;utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x61'),_0x5ba7f6[_0x7bb8('0x50')],queues[_0x5ba7f6[_0x7bb8('0x58')]][_0x7bb8('0x1e')],queues[_0x5ba7f6[_0x7bb8('0x58')]][_0x7bb8('0x10')],queues[_0x5ba7f6[_0x7bb8('0x58')]]['calleridnum'],queues[_0x5ba7f6[_0x7bb8('0x58')]]['calleridname']));}else{utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x5b'),_0x5ba7f6['origtransfereruniqueid'],queues[_0x5ba7f6[_0x7bb8('0x51')]]['name'],_0x5ba7f6[_0x7bb8('0x55')]));queues[_0x5ba7f6['secondtransfererlinkedid']][_0x7bb8('0x10')]=_0x5ba7f6[_0x7bb8('0x55')];}}}}catch(_0x1e6bba){utils[_0x7bb8('0x16')](util[_0x7bb8('0x3')](_0x7bb8('0x62'),_0x5ba7f6[_0x7bb8('0x50')]),_0x1e6bba);}};exports[_0x7bb8('0x63')]=function(_0x45dfde){try{if(!_['isNil'](queues[_0x45dfde['uniqueid']])){utils[_0x7bb8('0x12')](util['format']('[%s][queues][musiconholdstart]',_0x45dfde[_0x7bb8('0x5')]),_0x45dfde);queues[_0x45dfde[_0x7bb8('0x5')]]['musiconholdstartAt']=utils[_0x7bb8('0x1b')]();utils[_0x7bb8('0x1c')](util[_0x7bb8('0x3')](_0x7bb8('0x64'),_0x45dfde[_0x7bb8('0x5')],queues[_0x45dfde[_0x7bb8('0x5')]][_0x7bb8('0x1e')],queues[_0x45dfde[_0x7bb8('0x5')]][_0x7bb8('0x65')]));}}catch(_0x3205da){utils['error'](util[_0x7bb8('0x3')]('[%s][queues][musiconholdstart]',_0x45dfde['uniqueid']),_0x3205da);}};exports['musiconholdstop']=function(_0x2317b9){try{if(!_['isNil'](queues[_0x2317b9[_0x7bb8('0x5')]])){if(!_['isNil'](queues[_0x2317b9[_0x7bb8('0x5')]][_0x7bb8('0x65')])){utils[_0x7bb8('0x12')](util['format']('[%s][queues][musiconholdstop]',_0x2317b9[_0x7bb8('0x5')]),_0x2317b9);queues[_0x2317b9['uniqueid']][_0x7bb8('0x60')]+=utils[_0x7bb8('0x37')](utils[_0x7bb8('0x1b')](),queues[_0x2317b9[_0x7bb8('0x5')]][_0x7bb8('0x65')]);utils['info'](util[_0x7bb8('0x3')](_0x7bb8('0x66'),_0x2317b9[_0x7bb8('0x5')],queues[_0x2317b9[_0x7bb8('0x5')]][_0x7bb8('0x1e')],queues[_0x2317b9[_0x7bb8('0x5')]][_0x7bb8('0x60')]));delete queues[_0x2317b9[_0x7bb8('0x5')]][_0x7bb8('0x65')];}}}catch(_0x416e55){utils['error'](util[_0x7bb8('0x3')]('[%s][queues][musiconholdstop]',_0x2317b9[_0x7bb8('0x5')]),_0x416e55);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 12f8ba5..2839032 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 _0x82ce=['recording','lodash','./utils','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','exten','context','error','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','outbound','connectedlinename','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid'];(function(_0x2e82ba,_0x121e6a){var _0x11a788=function(_0x5bc960){while(--_0x5bc960){_0x2e82ba['push'](_0x2e82ba['shift']());}};_0x11a788(++_0x121e6a);}(_0x82ce,0x91));var _0xe82c=function(_0x26e1cf,_0x409b14){_0x26e1cf=_0x26e1cf-0x0;var _0x46fc60=_0x82ce[_0x26e1cf];return _0x46fc60;};'use strict';var _=require(_0xe82c('0x0'));var util=require('util');var utils=require(_0xe82c('0x1'));var transfers=require(_0xe82c('0x2'));var recordings={};function writeDB(_0x56505e){var _0x29995a;utils[_0xe82c('0x3')](util['format'](_0xe82c('0x4'),_0x56505e[_0xe82c('0x5')]));if(transfers[_0xe82c('0x6')][_0x56505e['uniqueid']]){_0x29995a=_0x56505e[_0xe82c('0x5')];_0x56505e['uniqueid']=transfers[_0xe82c('0x6')][_0x56505e[_0xe82c('0x5')]][_0xe82c('0x7')];}if(_0x56505e[_0xe82c('0x8')]){utils[_0xe82c('0x9')](_0x56505e[_0xe82c('0x8')])[_0xe82c('0xa')](function(_0x10a993){if(_0x10a993){_0x56505e[_0xe82c('0xb')]=_0x10a993[_0xe82c('0xc')];_0x56505e[_0xe82c('0xd')]=_0x10a993['id'];}utils['request'](_0xe82c('0xe'),_0x56505e);});}else{utils[_0xe82c('0xf')](_0xe82c('0xe'),_0x56505e);}if(_0x29995a)delete transfers['blinds'][_0x29995a];}exports[_0xe82c('0x10')]=function(_0x33be74){try{utils[_0xe82c('0x11')](util[_0xe82c('0x12')](_0xe82c('0x13'),_0x33be74[_0xe82c('0x5')]),_0x33be74);if(_0x33be74[_0xe82c('0x5')]==_0x33be74[_0xe82c('0x14')]){utils[_0xe82c('0x3')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x33be74[_0xe82c('0x5')],_0x33be74['context'],_0x33be74[_0xe82c('0x15')]));recordings[_0x33be74['uniqueid']]={'uniqueid':_0x33be74[_0xe82c('0x5')],'accountcode':_0x33be74['accountcode'],'exten':_0x33be74['exten'],'context':_0x33be74[_0xe82c('0x16')],'channel':_0x33be74['channel'],'monitors':[]};}}catch(_0x204480){utils[_0xe82c('0x17')](util[_0xe82c('0x12')](_0xe82c('0x13'),_0x33be74[_0xe82c('0x5')]),_0x204480);}};exports[_0xe82c('0x18')]=function(_0x575862){try{utils['debug'](util[_0xe82c('0x12')]('[%s][recordings][newstate]',_0x575862[_0xe82c('0x5')]),_0x575862);if(!_[_0xe82c('0x19')](recordings[_0x575862[_0xe82c('0x5')]])&&_0x575862['channelstate']==0x6){utils[_0xe82c('0x3')](util[_0xe82c('0x12')](_0xe82c('0x1a'),_0x575862['uniqueid'],_0x575862[_0xe82c('0x16')],_0x575862['channel']));}else if(!_[_0xe82c('0x19')](recordings[_0x575862[_0xe82c('0x14')]])&&_0x575862[_0xe82c('0x1b')]==0x6&&_0x575862[_0xe82c('0x16')]!=_0xe82c('0x1c')){utils[_0xe82c('0x3')](util[_0xe82c('0x12')](_0xe82c('0x1d'),_0x575862['uniqueid'],_0x575862['linkedid'],_0x575862[_0xe82c('0x16')],_0x575862[_0xe82c('0x1e')]));recordings[_0x575862[_0xe82c('0x14')]][_0xe82c('0x8')]=_0x575862[_0xe82c('0x8')];}}catch(_0x1eb9c7){utils['error'](util[_0xe82c('0x12')](_0xe82c('0x1f'),_0x575862[_0xe82c('0x5')]),_0x1eb9c7);}};exports[_0xe82c('0x20')]=function(_0xfdcc75){try{if(!_[_0xe82c('0x19')](_0xfdcc75[_0xe82c('0x21')])&&!_[_0xe82c('0x19')](_0xfdcc75[_0xe82c('0x21')]['mixmonitor_filename'])){utils[_0xe82c('0x11')](util['format'](_0xe82c('0x22'),_0xfdcc75['uniqueid']),_0xfdcc75);utils[_0xe82c('0x3')](util[_0xe82c('0x12')](_0xe82c('0x23'),_0xfdcc75[_0xe82c('0x5')],_0xfdcc75['variable'],_0xfdcc75['value']));if(_[_0xe82c('0x24')](_0xfdcc75[_0xe82c('0x25')],_0xe82c('0x26'))){_0xfdcc75[_0xe82c('0x25')]=_0xfdcc75[_0xe82c('0x25')][_0xe82c('0x27')](_0xe82c('0x26'),'.WAV');}if(recordings[_0xfdcc75['linkedid']]){var _0x1acf41=_[_0xe82c('0x28')](recordings[_0xfdcc75[_0xe82c('0x14')]]['monitors'],{'value':_0xfdcc75[_0xe82c('0x25')]});if(_['isNil'](_0x1acf41)){recordings[_0xfdcc75[_0xe82c('0x14')]][_0xe82c('0x29')][_0xe82c('0x2a')]({'value':_0xfdcc75['value']});}}}}catch(_0x13e55d){utils[_0xe82c('0x17')](util['format'](_0xe82c('0x22'),_0xfdcc75[_0xe82c('0x5')]),_0x13e55d);}};exports[_0xe82c('0x2b')]=function(_0x24de7d){try{if(!_[_0xe82c('0x19')](recordings[_0x24de7d['uniqueid']])){utils[_0xe82c('0x11')](util[_0xe82c('0x12')](_0xe82c('0x2c'),_0x24de7d[_0xe82c('0x5')]),_0x24de7d);utils['info'](util[_0xe82c('0x12')](_0xe82c('0x2d'),_0x24de7d[_0xe82c('0x5')],_0x24de7d[_0xe82c('0x2e')],_0x24de7d[_0xe82c('0x2f')],_0x24de7d['cause-txt']));recordings[_0x24de7d[_0xe82c('0x5')]][_0xe82c('0x2e')]=_0x24de7d[_0xe82c('0x2e')];recordings[_0x24de7d['uniqueid']][_0xe82c('0x2f')]=_0x24de7d[_0xe82c('0x2f')];recordings[_0x24de7d[_0xe82c('0x5')]][_0xe82c('0x30')]=_0x24de7d[_0xe82c('0x30')];recordings[_0x24de7d[_0xe82c('0x5')]]['connectedlinename']=_0x24de7d['connectedlinename'];if(recordings[_0x24de7d[_0xe82c('0x5')]]['type']==_0xe82c('0x31')&&recordings[_0x24de7d['uniqueid']]['accountcode']){recordings[_0x24de7d[_0xe82c('0x5')]][_0xe82c('0x30')]=recordings[_0x24de7d[_0xe82c('0x5')]][_0xe82c('0x8')];recordings[_0x24de7d['uniqueid']][_0xe82c('0x32')]='';}recordings[_0x24de7d['uniqueid']][_0xe82c('0x29')]['forEach'](function(_0x279fe1){var _0x353f2d=_[_0xe82c('0x33')](recordings[_0x24de7d[_0xe82c('0x5')]]);_0x353f2d['value']=_0x279fe1[_0xe82c('0x25')];writeDB(_0x353f2d);});delete recordings[_0x24de7d[_0xe82c('0x5')]];}}catch(_0xa3f6ea){utils['error'](util[_0xe82c('0x12')](_0xe82c('0x2c'),_0x24de7d[_0xe82c('0x5')]),_0xa3f6ea);}};exports[_0xe82c('0x34')]=function(_0x53ca4e){try{if(!_[_0xe82c('0x19')](recordings[_0x53ca4e[_0xe82c('0x5')]])){utils['debug'](util[_0xe82c('0x12')](_0xe82c('0x35'),_0x53ca4e[_0xe82c('0x5')]),_0x53ca4e);utils[_0xe82c('0x3')](util['format'](_0xe82c('0x36'),_0x53ca4e[_0xe82c('0x5')],_0x53ca4e['application'],_0x53ca4e[_0xe82c('0x37')]));if(_0x53ca4e[_0xe82c('0x38')][_0xe82c('0x39')]()==_0xe82c('0x3a')&&_[_0xe82c('0x3b')](_0x53ca4e[_0xe82c('0x37')]['toLowerCase'](),_0xe82c('0x3c'))){var _0x374a82=_0x53ca4e[_0xe82c('0x37')][_0xe82c('0x3d')]('=');var _0xaaed75=_0x374a82[0x0]['substring'](_0x374a82[0x0]['lastIndexOf']('(')+0x1,_0x374a82[0x0]['lastIndexOf'](')'));var _0x32d79e=_0x374a82[0x1];recordings[_0x53ca4e[_0xe82c('0x5')]][_0xaaed75]=_0x32d79e;}}}catch(_0x54a2c5){utils['error'](util[_0xe82c('0x12')](_0xe82c('0x35'),_0x53ca4e[_0xe82c('0x5')]),_0x54a2c5);}};exports['queuecallerjoin']=function(_0x434e00){try{if(!_[_0xe82c('0x19')](recordings[_0x434e00['uniqueid']])){utils['debug'](util[_0xe82c('0x12')]('[%s][recordings][queuecallerjoin]',_0x434e00['uniqueid']),_0x434e00);utils[_0xe82c('0x3')](util[_0xe82c('0x12')](_0xe82c('0x3e'),_0x434e00[_0xe82c('0x5')],_0x434e00[_0xe82c('0x3f')]));recordings[_0x434e00[_0xe82c('0x5')]][_0xe82c('0x3f')]=_0x434e00[_0xe82c('0x3f')];}}catch(_0x2e5c25){utils['error'](util[_0xe82c('0x12')](_0xe82c('0x40'),_0x434e00[_0xe82c('0x5')]),_0x2e5c25);}};exports[_0xe82c('0x41')]=function(_0x504f37){try{utils['debug'](util['format'](_0xe82c('0x42'),_0x504f37['uniqueid']),_0x504f37);utils['info'](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x504f37[_0xe82c('0x5')],_0x504f37[_0xe82c('0x43')],_0x504f37['transferercalleridname'],_0x504f37[_0xe82c('0x44')],_0x504f37[_0xe82c('0x45')]));if(recordings[_0x504f37[_0xe82c('0x46')]]&&transfers['blinds'][_0x504f37[_0xe82c('0x46')]]){transfers[_0xe82c('0x6')][_0x504f37['transfereruniqueid']][_0xe82c('0x47')]=!![];}}catch(_0x54d8a3){utils[_0xe82c('0x17')](util[_0xe82c('0x12')](_0xe82c('0x42'),_0x504f37['uniqueid']),_0x54d8a3);}}; \ No newline at end of file +var _0x8580=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','error','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','debug','[%s][recordings][newstate]','isNil','channel','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename'];(function(_0x8a463,_0x25f49f){var _0x406d8c=function(_0x32c820){while(--_0x32c820){_0x8a463['push'](_0x8a463['shift']());}};_0x406d8c(++_0x25f49f);}(_0x8580,0x76));var _0x0858=function(_0x5a3735,_0x2d5b3b){_0x5a3735=_0x5a3735-0x0;var _0x48f35b=_0x8580[_0x5a3735];return _0x48f35b;};'use strict';var _=require(_0x0858('0x0'));var util=require('util');var utils=require(_0x0858('0x1'));var transfers=require(_0x0858('0x2'));var recordings={};function writeDB(_0x43b47a){var _0x40ac36;utils[_0x0858('0x3')](util[_0x0858('0x4')](_0x0858('0x5'),_0x43b47a[_0x0858('0x6')]));if(transfers[_0x0858('0x7')][_0x43b47a[_0x0858('0x6')]]){_0x40ac36=_0x43b47a[_0x0858('0x6')];_0x43b47a[_0x0858('0x6')]=transfers['blinds'][_0x43b47a[_0x0858('0x6')]][_0x0858('0x8')];}if(_0x43b47a[_0x0858('0x9')]){utils[_0x0858('0xa')](_0x43b47a[_0x0858('0x9')])['then'](function(_0x15e272){if(_0x15e272){_0x43b47a[_0x0858('0xb')]=_0x15e272[_0x0858('0xc')];_0x43b47a[_0x0858('0xd')]=_0x15e272['id'];}utils[_0x0858('0xe')](_0x0858('0xf'),_0x43b47a);});}else{utils[_0x0858('0xe')](_0x0858('0xf'),_0x43b47a);}if(_0x40ac36)delete transfers[_0x0858('0x7')][_0x40ac36];}exports[_0x0858('0x10')]=function(_0x13c1b9){try{utils['debug'](util[_0x0858('0x4')](_0x0858('0x11'),_0x13c1b9[_0x0858('0x6')]),_0x13c1b9);if(_0x13c1b9[_0x0858('0x6')]==_0x13c1b9[_0x0858('0x12')]){utils['info'](util[_0x0858('0x4')](_0x0858('0x13'),_0x13c1b9[_0x0858('0x6')],_0x13c1b9[_0x0858('0x14')],_0x13c1b9[_0x0858('0x15')]));recordings[_0x13c1b9[_0x0858('0x6')]]={'uniqueid':_0x13c1b9[_0x0858('0x6')],'accountcode':_0x13c1b9[_0x0858('0x9')],'exten':_0x13c1b9[_0x0858('0x15')],'context':_0x13c1b9[_0x0858('0x14')],'channel':_0x13c1b9['channel'],'monitors':[]};}}catch(_0x54ce65){utils['error'](util[_0x0858('0x4')]('[%s][recordings][newchannel]',_0x13c1b9[_0x0858('0x6')]),_0x54ce65);}};exports[_0x0858('0x16')]=function(_0x46ca8f){try{utils[_0x0858('0x17')](util[_0x0858('0x4')](_0x0858('0x18'),_0x46ca8f['uniqueid']),_0x46ca8f);if(!_[_0x0858('0x19')](recordings[_0x46ca8f[_0x0858('0x6')]])&&_0x46ca8f['channelstate']==0x6){utils[_0x0858('0x3')](util[_0x0858('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x46ca8f[_0x0858('0x6')],_0x46ca8f['context'],_0x46ca8f[_0x0858('0x1a')]));}else if(!_['isNil'](recordings[_0x46ca8f[_0x0858('0x12')]])&&_0x46ca8f[_0x0858('0x1b')]==0x6&&_0x46ca8f[_0x0858('0x14')]!='transfer'){utils[_0x0858('0x3')](util[_0x0858('0x4')](_0x0858('0x1c'),_0x46ca8f['uniqueid'],_0x46ca8f[_0x0858('0x12')],_0x46ca8f['context'],_0x46ca8f[_0x0858('0x1a')]));recordings[_0x46ca8f[_0x0858('0x12')]][_0x0858('0x9')]=_0x46ca8f[_0x0858('0x9')];}}catch(_0x1e2613){utils['error'](util[_0x0858('0x4')]('[%s][recordings][newstate]',_0x46ca8f[_0x0858('0x6')]),_0x1e2613);}};exports[_0x0858('0x1d')]=function(_0x48b4a1){try{if(!_[_0x0858('0x19')](_0x48b4a1[_0x0858('0x1e')])&&!_[_0x0858('0x19')](_0x48b4a1[_0x0858('0x1e')][_0x0858('0x1f')])){utils[_0x0858('0x17')](util[_0x0858('0x4')](_0x0858('0x20'),_0x48b4a1[_0x0858('0x6')]),_0x48b4a1);utils[_0x0858('0x3')](util[_0x0858('0x4')](_0x0858('0x21'),_0x48b4a1[_0x0858('0x6')],_0x48b4a1['variable'],_0x48b4a1[_0x0858('0x22')]));if(_[_0x0858('0x23')](_0x48b4a1['value'],_0x0858('0x24'))){_0x48b4a1['value']=_0x48b4a1[_0x0858('0x22')][_0x0858('0x25')](_0x0858('0x24'),_0x0858('0x26'));}if(recordings[_0x48b4a1[_0x0858('0x12')]]){var _0x119d8a=_[_0x0858('0x27')](recordings[_0x48b4a1[_0x0858('0x12')]]['monitors'],{'value':_0x48b4a1[_0x0858('0x22')]});if(_['isNil'](_0x119d8a)){recordings[_0x48b4a1[_0x0858('0x12')]][_0x0858('0x28')][_0x0858('0x29')]({'value':_0x48b4a1[_0x0858('0x22')]});}}}}catch(_0x293377){utils[_0x0858('0x2a')](util[_0x0858('0x4')](_0x0858('0x20'),_0x48b4a1['uniqueid']),_0x293377);}};exports[_0x0858('0x2b')]=function(_0x337f7f){try{if(!_['isNil'](recordings[_0x337f7f[_0x0858('0x6')]])){utils['debug'](util['format'](_0x0858('0x2c'),_0x337f7f['uniqueid']),_0x337f7f);utils['info'](util[_0x0858('0x4')](_0x0858('0x2d'),_0x337f7f[_0x0858('0x6')],_0x337f7f[_0x0858('0x2e')],_0x337f7f[_0x0858('0x2f')],_0x337f7f[_0x0858('0x30')]));recordings[_0x337f7f[_0x0858('0x6')]][_0x0858('0x2e')]=_0x337f7f[_0x0858('0x2e')];recordings[_0x337f7f['uniqueid']]['calleridname']=_0x337f7f[_0x0858('0x2f')];recordings[_0x337f7f[_0x0858('0x6')]][_0x0858('0x31')]=_0x337f7f[_0x0858('0x31')];recordings[_0x337f7f[_0x0858('0x6')]]['connectedlinename']=_0x337f7f['connectedlinename'];if(recordings[_0x337f7f[_0x0858('0x6')]][_0x0858('0x32')]==_0x0858('0x33')&&recordings[_0x337f7f[_0x0858('0x6')]][_0x0858('0x9')]){recordings[_0x337f7f['uniqueid']]['connectedlinenum']=recordings[_0x337f7f[_0x0858('0x6')]][_0x0858('0x9')];recordings[_0x337f7f[_0x0858('0x6')]]['connectedlinename']='';}recordings[_0x337f7f[_0x0858('0x6')]][_0x0858('0x28')]['forEach'](function(_0x4e127e){var _0x5be369=_[_0x0858('0x34')](recordings[_0x337f7f[_0x0858('0x6')]]);_0x5be369['value']=_0x4e127e[_0x0858('0x22')];writeDB(_0x5be369);});delete recordings[_0x337f7f[_0x0858('0x6')]];}}catch(_0x1de6ef){utils['error'](util[_0x0858('0x4')](_0x0858('0x2c'),_0x337f7f[_0x0858('0x6')]),_0x1de6ef);}};exports[_0x0858('0x35')]=function(_0x38c361){try{if(!_[_0x0858('0x19')](recordings[_0x38c361['uniqueid']])){utils['debug'](util[_0x0858('0x4')](_0x0858('0x36'),_0x38c361[_0x0858('0x6')]),_0x38c361);utils[_0x0858('0x3')](util['format'](_0x0858('0x37'),_0x38c361[_0x0858('0x6')],_0x38c361['application'],_0x38c361[_0x0858('0x38')]));if(_0x38c361[_0x0858('0x39')]['toLowerCase']()==_0x0858('0x3a')&&_[_0x0858('0x3b')](_0x38c361[_0x0858('0x38')][_0x0858('0x3c')](),_0x0858('0x3d'))){var _0x20d8f1=_0x38c361[_0x0858('0x38')][_0x0858('0x3e')]('=');var _0x360ac5=_0x20d8f1[0x0][_0x0858('0x3f')](_0x20d8f1[0x0][_0x0858('0x40')]('(')+0x1,_0x20d8f1[0x0][_0x0858('0x40')](')'));var _0x56fc0f=_0x20d8f1[0x1];recordings[_0x38c361['uniqueid']][_0x360ac5]=_0x56fc0f;}}}catch(_0x3f4988){utils[_0x0858('0x2a')](util[_0x0858('0x4')](_0x0858('0x36'),_0x38c361[_0x0858('0x6')]),_0x3f4988);}};exports[_0x0858('0x41')]=function(_0x519685){try{if(!_['isNil'](recordings[_0x519685['uniqueid']])){utils[_0x0858('0x17')](util[_0x0858('0x4')](_0x0858('0x42'),_0x519685[_0x0858('0x6')]),_0x519685);utils[_0x0858('0x3')](util[_0x0858('0x4')](_0x0858('0x43'),_0x519685[_0x0858('0x6')],_0x519685['queue']));recordings[_0x519685[_0x0858('0x6')]][_0x0858('0x44')]=_0x519685[_0x0858('0x44')];}}catch(_0x304efc){utils[_0x0858('0x2a')](util[_0x0858('0x4')]('[%s][recordings][queuecallerjoin]',_0x519685[_0x0858('0x6')]),_0x304efc);}};exports['blindtransfer']=function(_0x2df933){try{utils[_0x0858('0x17')](util[_0x0858('0x4')](_0x0858('0x45'),_0x2df933[_0x0858('0x6')]),_0x2df933);utils[_0x0858('0x3')](util['format'](_0x0858('0x46'),_0x2df933[_0x0858('0x6')],_0x2df933[_0x0858('0x47')],_0x2df933[_0x0858('0x48')],_0x2df933[_0x0858('0x49')],_0x2df933['transfereecalleridname']));if(recordings[_0x2df933['transfereruniqueid']]&&transfers[_0x0858('0x7')][_0x2df933[_0x0858('0x4a')]]){transfers[_0x0858('0x7')][_0x2df933[_0x0858('0x4a')]]['recording']=!![];}}catch(_0x3350b7){utils[_0x0858('0x2a')](util[_0x0858('0x4')](_0x0858('0x45'),_0x2df933[_0x0858('0x6')]),_0x3350b7);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index e1f59f9..3ca7cc6 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 _0xc6a0=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','blinds','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xc6a0,0x18f));var _0x0c6a=function(_0x20833d,_0x29b9e4){_0x20833d=_0x20833d-0x0;var _0x62fb78=_0xc6a0[_0x20833d];return _0x62fb78;};'use strict';var _=require(_0x0c6a('0x0'));var util=require(_0x0c6a('0x1'));var utils=require(_0x0c6a('0x2'));function writeDB(_0x4f3d56){utils[_0x0c6a('0x3')](util[_0x0c6a('0x4')](_0x0c6a('0x5'),_0x4f3d56[_0x0c6a('0x6')]==='attended'?_0x4f3d56[_0x0c6a('0x7')]:_0x4f3d56['uniqueid'],_0x4f3d56[_0x0c6a('0x6')]));utils[_0x0c6a('0x8')]('CreateVoiceTransferReport',_0x4f3d56);}exports[_0x0c6a('0x9')]={};exports['blindtransfer']=function(_0x87f026){try{utils[_0x0c6a('0xa')](util[_0x0c6a('0x4')](_0x0c6a('0xb'),_0x87f026[_0x0c6a('0xc')]),_0x87f026);utils[_0x0c6a('0x3')](util[_0x0c6a('0x4')](_0x0c6a('0xd'),_0x87f026['uniqueid'],_0x87f026[_0x0c6a('0xe')],_0x87f026[_0x0c6a('0xf')],_0x87f026['transfereecalleridnum'],_0x87f026[_0x0c6a('0x10')]));_0x87f026[_0x0c6a('0x6')]=_0x0c6a('0x11');exports[_0x0c6a('0x9')][_0x87f026[_0x0c6a('0x12')]]=_0x87f026;writeDB(_0x87f026);}catch(_0x34c2bc){utils[_0x0c6a('0x13')](util[_0x0c6a('0x4')](_0x0c6a('0xb'),_0x87f026[_0x0c6a('0xc')]),_0x34c2bc);}};exports[_0x0c6a('0x14')]=function(_0xc0823){try{utils['debug'](util[_0x0c6a('0x4')](_0x0c6a('0x15'),_0xc0823[_0x0c6a('0x7')]),_0xc0823);utils['info'](util['format'](_0x0c6a('0x16'),_0xc0823[_0x0c6a('0x7')],_0xc0823[_0x0c6a('0x17')],_0xc0823[_0x0c6a('0x18')],_0xc0823[_0x0c6a('0x19')],_0xc0823['transfertargetcalleridname']));_0xc0823=_[_0x0c6a('0x1a')](_0xc0823,{'transfererchannel':_0xc0823['origtransfererchannel'],'transferercalleridnum':_0xc0823['origtransferercalleridnum'],'transferercalleridname':_0xc0823[_0x0c6a('0x18')],'transfererconnectedlinenum':_0xc0823[_0x0c6a('0x1b')],'transfererconnectedlinename':_0xc0823[_0x0c6a('0x1c')],'transfereraccountcode':_0xc0823['origtransfereraccountcode'],'transferercontext':_0xc0823[_0x0c6a('0x1d')],'transfererexten':_0xc0823[_0x0c6a('0x1e')],'transfererlinkedid':_0xc0823['origtransfererlinkedid'],'context':_0xc0823[_0x0c6a('0x1f')],'extension':_0xc0823['origtransfererexten'],'type':_0x0c6a('0x20')});if(_[_0x0c6a('0x21')](_0xc0823[_0x0c6a('0x22')])){_0xc0823=_[_0x0c6a('0x1a')](_0xc0823,{'transfereechannel':_0xc0823[_0x0c6a('0x23')],'transfereecalleridnum':_0xc0823['transfertargetcalleridnum'],'transfereecalleridname':_0xc0823[_0x0c6a('0x24')],'transfereeconnectedlinenum':_0xc0823[_0x0c6a('0x25')],'transfereeconnectedlinename':_0xc0823[_0x0c6a('0x26')],'transfereeaccountcode':_0xc0823[_0x0c6a('0x27')],'transfereecontext':_0xc0823[_0x0c6a('0x28')],'transfereeexten':_0xc0823[_0x0c6a('0x29')],'transfereelinkedid':_0xc0823['transfertargetlinkedid']});}writeDB(_0xc0823);}catch(_0x2de6f2){utils[_0x0c6a('0x13')](util[_0x0c6a('0x4')](_0x0c6a('0x15'),_0xc0823['origtransfereruniqueid']),_0x2de6f2);}}; \ No newline at end of file +var _0x6f23=['blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request'];(function(_0xb342c0,_0x57c0dd){var _0x191031=function(_0x114f92){while(--_0x114f92){_0xb342c0['push'](_0xb342c0['shift']());}};_0x191031(++_0x57c0dd);}(_0x6f23,0x182));var _0x36f2=function(_0x1fa165,_0x3c556e){_0x1fa165=_0x1fa165-0x0;var _0x40201d=_0x6f23[_0x1fa165];return _0x40201d;};'use strict';var _=require(_0x36f2('0x0'));var util=require(_0x36f2('0x1'));var utils=require('./utils');function writeDB(_0x226faa){utils[_0x36f2('0x2')](util[_0x36f2('0x3')](_0x36f2('0x4'),_0x226faa[_0x36f2('0x5')]===_0x36f2('0x6')?_0x226faa[_0x36f2('0x7')]:_0x226faa[_0x36f2('0x8')],_0x226faa[_0x36f2('0x5')]));utils[_0x36f2('0x9')]('CreateVoiceTransferReport',_0x226faa);}exports[_0x36f2('0xa')]={};exports[_0x36f2('0xb')]=function(_0x2ed170){try{utils[_0x36f2('0xc')](util[_0x36f2('0x3')](_0x36f2('0xd'),_0x2ed170['uniqueid']),_0x2ed170);utils[_0x36f2('0x2')](util['format'](_0x36f2('0xe'),_0x2ed170[_0x36f2('0x8')],_0x2ed170[_0x36f2('0xf')],_0x2ed170['transferercalleridname'],_0x2ed170[_0x36f2('0x10')],_0x2ed170[_0x36f2('0x11')]));_0x2ed170[_0x36f2('0x5')]=_0x36f2('0x12');exports[_0x36f2('0xa')][_0x2ed170[_0x36f2('0x13')]]=_0x2ed170;writeDB(_0x2ed170);}catch(_0x2cb37b){utils[_0x36f2('0x14')](util[_0x36f2('0x3')]('[%s][transfers][blindtransfer]',_0x2ed170[_0x36f2('0x8')]),_0x2cb37b);}};exports[_0x36f2('0x15')]=function(_0x37e084){try{utils[_0x36f2('0xc')](util[_0x36f2('0x3')]('[%s][transfers][attendedtransfer]',_0x37e084[_0x36f2('0x7')]),_0x37e084);utils[_0x36f2('0x2')](util[_0x36f2('0x3')](_0x36f2('0x16'),_0x37e084['origtransfereruniqueid'],_0x37e084[_0x36f2('0x17')],_0x37e084[_0x36f2('0x18')],_0x37e084[_0x36f2('0x19')],_0x37e084[_0x36f2('0x1a')]));_0x37e084=_[_0x36f2('0x1b')](_0x37e084,{'transfererchannel':_0x37e084[_0x36f2('0x1c')],'transferercalleridnum':_0x37e084[_0x36f2('0x17')],'transferercalleridname':_0x37e084[_0x36f2('0x18')],'transfererconnectedlinenum':_0x37e084[_0x36f2('0x1d')],'transfererconnectedlinename':_0x37e084[_0x36f2('0x1e')],'transfereraccountcode':_0x37e084['origtransfereraccountcode'],'transferercontext':_0x37e084[_0x36f2('0x1f')],'transfererexten':_0x37e084['secondtransfererexten'],'transfererlinkedid':_0x37e084[_0x36f2('0x20')],'context':_0x37e084[_0x36f2('0x21')],'extension':_0x37e084[_0x36f2('0x22')],'type':_0x36f2('0x6')});if(_[_0x36f2('0x23')](_0x37e084[_0x36f2('0x24')])){_0x37e084=_[_0x36f2('0x1b')](_0x37e084,{'transfereechannel':_0x37e084[_0x36f2('0x25')],'transfereecalleridnum':_0x37e084['transfertargetcalleridnum'],'transfereecalleridname':_0x37e084[_0x36f2('0x1a')],'transfereeconnectedlinenum':_0x37e084[_0x36f2('0x26')],'transfereeconnectedlinename':_0x37e084[_0x36f2('0x27')],'transfereeaccountcode':_0x37e084['transfertargetaccountcode'],'transfereecontext':_0x37e084[_0x36f2('0x28')],'transfereeexten':_0x37e084[_0x36f2('0x29')],'transfereelinkedid':_0x37e084[_0x36f2('0x2a')]});}writeDB(_0x37e084);}catch(_0x178e74){utils[_0x36f2('0x14')](util['format'](_0x36f2('0x2b'),_0x37e084[_0x36f2('0x7')]),_0x178e74);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b8cf553..ffbfb6d 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 _0x1aa0=['[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','http','../../config/logger','info','debug','error','request','then','catch','inspect','internal','name','interface','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s'];(function(_0x2f9513,_0x34bdd0){var _0x3d6627=function(_0x30f878){while(--_0x30f878){_0x2f9513['push'](_0x2f9513['shift']());}};_0x3d6627(++_0x34bdd0);}(_0x1aa0,0x141));var _0x01aa=function(_0x3038be,_0x425d69){_0x3038be=_0x3038be-0x0;var _0x581d4e=_0x1aa0[_0x3038be];return _0x581d4e;};'use strict';var BPromise=require(_0x01aa('0x0'));var jayson=require(_0x01aa('0x1'));var moment=require(_0x01aa('0x2'));var util=require('util');var client=jayson['client'][_0x01aa('0x3')]({'port':0x2329});var logger=require(_0x01aa('0x4'))('xdr');exports['info']=function(_0x20d017,_0x37c749){logger[_0x01aa('0x5')](_0x20d017,_0x37c749?util['inspect'](_0x37c749,{'showHidden':![],'depth':null}):'');};exports[_0x01aa('0x6')]=function(_0x2e8ff7,_0x5018b4){logger[_0x01aa('0x6')](_0x2e8ff7,_0x5018b4?util['inspect'](_0x5018b4,{'showHidden':![],'depth':null}):'');};exports[_0x01aa('0x7')]=function(_0x436ae4,_0x498a73){logger[_0x01aa('0x7')](_0x436ae4,_0x498a73?util['inspect'](_0x498a73,{'showHidden':![],'depth':null}):'');};exports[_0x01aa('0x8')]=function(_0x4e0e2c,_0x137cec){return client[_0x01aa('0x8')](_0x4e0e2c,{'body':_0x137cec})[_0x01aa('0x9')](function(_0x38a41f){logger[_0x01aa('0x6')]('[utils][request]\x20name:%s',_0x4e0e2c,_0x38a41f?util['inspect'](_0x38a41f,{'showHidden':![],'depth':null}):'');})[_0x01aa('0xa')](function(_0x5b902d){logger[_0x01aa('0x7')]('[utils][request]\x20name:%s',_0x4e0e2c,_0x5b902d?util[_0x01aa('0xb')](_0x5b902d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x599cdc){return client[_0x01aa('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x01aa('0xc'),_0x01aa('0xd'),_0x01aa('0xe')],'where':_0x599cdc,'limit':0x1}})['then'](function(_0x5f091c){logger[_0x01aa('0x6')]('[utils][getUser]\x20where:%s',JSON[_0x01aa('0xf')](_0x599cdc),_0x5f091c?util['inspect'](_0x5f091c,{'showHidden':![],'depth':null}):'');return _0x5f091c[_0x01aa('0x10')][_0x01aa('0x11')]?_0x5f091c['result'][0x0]:null;});}exports[_0x01aa('0x12')]=function(_0x384b3d){return new BPromise(function(_0x10c686,_0x927125){if(_0x384b3d){return getUser({'internal':_0x384b3d})[_0x01aa('0x9')](function(_0x51bbb3){logger[_0x01aa('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x384b3d,_0x51bbb3?_0x01aa('0x13'):_0x01aa('0x14'));return _0x10c686(_0x51bbb3);})[_0x01aa('0xa')](function(_0xdcda9){logger[_0x01aa('0x7')](_0x01aa('0x15'),_0xdcda9?util[_0x01aa('0xb')](_0xdcda9,{'showHidden':![],'depth':null}):'');return _0x10c686(null);});}return _0x10c686(null);});};exports[_0x01aa('0x16')]=function(_0x1b3f7b){return new BPromise(function(_0x36a3,_0x3cf381){if(_0x1b3f7b){return getUser({'interface':_0x1b3f7b})[_0x01aa('0x9')](function(_0x5b8401){logger['info'](_0x01aa('0x17'),_0x1b3f7b,_0x5b8401?_0x01aa('0x13'):'notfound');return _0x36a3(_0x5b8401);})[_0x01aa('0xa')](function(_0x177972){logger[_0x01aa('0x7')](_0x01aa('0x18'),_0x177972?util['inspect'](_0x177972,{'showHidden':![],'depth':null}):'');return _0x36a3(null);});}return _0x36a3(null);});};exports[_0x01aa('0x19')]=function(_0x2808a3){return new BPromise(function(_0x1609c5,_0x522819){if(_0x2808a3){return getUser({'name':_0x2808a3})['then'](function(_0x56f48b){logger[_0x01aa('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2808a3,_0x56f48b?_0x01aa('0x13'):_0x01aa('0x14'));return _0x1609c5(_0x56f48b);})['catch'](function(_0x500a0e){logger[_0x01aa('0x7')]('[utils][getUserByName]',_0x500a0e?util['inspect'](_0x500a0e,{'showHidden':![],'depth':null}):'');return _0x1609c5(null);});}return _0x1609c5(null);});};exports[_0x01aa('0x1a')]=function(_0x437015){return new BPromise(function(_0x161ce1,_0x198eae){if(_0x437015){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x01aa('0x1b'),_0x01aa('0x1c'),_0x01aa('0x1d')],'where':{'name':_0x437015},'limit':0x1}})[_0x01aa('0x9')](function(_0x1e01e1){logger[_0x01aa('0x6')](_0x01aa('0x1e'),_0x437015,_0x1e01e1?util[_0x01aa('0xb')](_0x1e01e1,{'showHidden':![],'depth':null}):'');logger[_0x01aa('0x5')](_0x01aa('0x1f'),_0x437015,_0x1e01e1?_0x01aa('0x13'):_0x01aa('0x14'));return _0x161ce1(_0x1e01e1[_0x01aa('0x10')][_0x01aa('0x11')]?_0x1e01e1['result'][0x0]:null);})['catch'](function(_0x4fc34e){logger[_0x01aa('0x7')](_0x01aa('0x20'),_0x4fc34e?util[_0x01aa('0xb')](_0x4fc34e,{'showHidden':![],'depth':null}):'');return _0x161ce1(null);});}return _0x161ce1(null);});};exports['addTime']=function(_0x20d46d,_0x502f45){return moment(_0x20d46d)[_0x01aa('0x21')](_0x502f45,_0x01aa('0x22'))[_0x01aa('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x01aa('0x24')]=function(_0x659687,_0x58ab84){return moment(_0x659687)['subtract'](_0x58ab84,_0x01aa('0x22'))[_0x01aa('0x23')](_0x01aa('0x25'));};exports[_0x01aa('0x26')]=function(_0x20ec70,_0x13d34c){return moment(_0x20ec70)[_0x01aa('0x27')](moment(_0x13d34c),_0x01aa('0x22'));};exports[_0x01aa('0x28')]=function(_0x314da5,_0x2d1e78){return parseInt(_0x314da5,0xa)+parseInt(_0x2d1e78,0xa);};exports[_0x01aa('0x29')]=function(){return moment()[_0x01aa('0x23')](_0x01aa('0x25'));};exports['isAfter']=function(_0x52075b,_0x2dbe9f){if(_0x2dbe9f){return moment(_0x52075b)[_0x01aa('0x2a')](_0x2dbe9f);}return!![];};exports[_0x01aa('0x2b')]=function(_0x530848,_0x165a31){if(_0x165a31){return moment(_0x530848)[_0x01aa('0x2b')](_0x165a31);}else if(_0x530848){return!![];}return![];}; \ No newline at end of file +var _0xcbe7=['[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','info','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','inspect','debug','error','request','then'];(function(_0x22aac0,_0x56d85d){var _0x2757a7=function(_0x1156c7){while(--_0x1156c7){_0x22aac0['push'](_0x22aac0['shift']());}};_0x2757a7(++_0x56d85d);}(_0xcbe7,0x152));var _0x7cbe=function(_0x6b497a,_0x509300){_0x6b497a=_0x6b497a-0x0;var _0x4ba133=_0xcbe7[_0x6b497a];return _0x4ba133;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7cbe('0x0'));var moment=require(_0x7cbe('0x1'));var util=require(_0x7cbe('0x2'));var client=jayson[_0x7cbe('0x3')][_0x7cbe('0x4')]({'port':0x2329});var logger=require(_0x7cbe('0x5'))(_0x7cbe('0x6'));exports['info']=function(_0x108c8b,_0x5d2522){logger['info'](_0x108c8b,_0x5d2522?util[_0x7cbe('0x7')](_0x5d2522,{'showHidden':![],'depth':null}):'');};exports[_0x7cbe('0x8')]=function(_0x415bff,_0xb5e670){logger['debug'](_0x415bff,_0xb5e670?util['inspect'](_0xb5e670,{'showHidden':![],'depth':null}):'');};exports[_0x7cbe('0x9')]=function(_0x4196ea,_0x6b96fe){logger[_0x7cbe('0x9')](_0x4196ea,_0x6b96fe?util[_0x7cbe('0x7')](_0x6b96fe,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x32c29d,_0x5292ca){return client[_0x7cbe('0xa')](_0x32c29d,{'body':_0x5292ca})[_0x7cbe('0xb')](function(_0x239332){logger['debug'](_0x7cbe('0xc'),_0x32c29d,_0x239332?util[_0x7cbe('0x7')](_0x239332,{'showHidden':![],'depth':null}):'');})[_0x7cbe('0xd')](function(_0x80bf15){logger[_0x7cbe('0x9')](_0x7cbe('0xc'),_0x32c29d,_0x80bf15?util[_0x7cbe('0x7')](_0x80bf15,{'showHidden':![],'depth':null}):'');});};function getUser(_0x21978f){return client['request'](_0x7cbe('0xe'),{'options':{'raw':!![],'attributes':['id',_0x7cbe('0xf'),_0x7cbe('0x10'),_0x7cbe('0x11')],'where':_0x21978f,'limit':0x1}})[_0x7cbe('0xb')](function(_0x352073){logger['debug'](_0x7cbe('0x12'),JSON[_0x7cbe('0x13')](_0x21978f),_0x352073?util[_0x7cbe('0x7')](_0x352073,{'showHidden':![],'depth':null}):'');return _0x352073[_0x7cbe('0x14')][_0x7cbe('0x15')]?_0x352073[_0x7cbe('0x14')][0x0]:null;});}exports[_0x7cbe('0x16')]=function(_0x3ee943){return new BPromise(function(_0x32773c,_0x3020cd){if(_0x3ee943){return getUser({'internal':_0x3ee943})[_0x7cbe('0xb')](function(_0x509206){logger['info'](_0x7cbe('0x17'),_0x3ee943,_0x509206?_0x7cbe('0x18'):_0x7cbe('0x19'));return _0x32773c(_0x509206);})[_0x7cbe('0xd')](function(_0x106466){logger['error'](_0x7cbe('0x1a'),_0x106466?util[_0x7cbe('0x7')](_0x106466,{'showHidden':![],'depth':null}):'');return _0x32773c(null);});}return _0x32773c(null);});};exports[_0x7cbe('0x1b')]=function(_0x7e6a38){return new BPromise(function(_0x3e87c5,_0xddf660){if(_0x7e6a38){return getUser({'interface':_0x7e6a38})[_0x7cbe('0xb')](function(_0x543365){logger[_0x7cbe('0x1c')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x7e6a38,_0x543365?_0x7cbe('0x18'):_0x7cbe('0x19'));return _0x3e87c5(_0x543365);})[_0x7cbe('0xd')](function(_0x3f9bf1){logger[_0x7cbe('0x9')]('[utils][getUserByInterface]',_0x3f9bf1?util[_0x7cbe('0x7')](_0x3f9bf1,{'showHidden':![],'depth':null}):'');return _0x3e87c5(null);});}return _0x3e87c5(null);});};exports[_0x7cbe('0x1d')]=function(_0xae6415){return new BPromise(function(_0xdf861e,_0x2a737a){if(_0xae6415){return getUser({'name':_0xae6415})['then'](function(_0xacc421){logger[_0x7cbe('0x1c')](_0x7cbe('0x1e'),_0xae6415,_0xacc421?_0x7cbe('0x18'):_0x7cbe('0x19'));return _0xdf861e(_0xacc421);})[_0x7cbe('0xd')](function(_0x1daa8f){logger['error']('[utils][getUserByName]',_0x1daa8f?util[_0x7cbe('0x7')](_0x1daa8f,{'showHidden':![],'depth':null}):'');return _0xdf861e(null);});}return _0xdf861e(null);});};exports[_0x7cbe('0x1f')]=function(_0x26e1f8){return new BPromise(function(_0x20bdb9,_0xd181){if(_0x26e1f8){return client[_0x7cbe('0xa')](_0x7cbe('0x20'),{'options':{'raw':!![],'attributes':['id',_0x7cbe('0x10'),_0x7cbe('0x21'),_0x7cbe('0x22'),_0x7cbe('0x23')],'where':{'name':_0x26e1f8},'limit':0x1}})['then'](function(_0x4dafeb){logger[_0x7cbe('0x8')](_0x7cbe('0x24'),_0x26e1f8,_0x4dafeb?util[_0x7cbe('0x7')](_0x4dafeb,{'showHidden':![],'depth':null}):'');logger['info'](_0x7cbe('0x25'),_0x26e1f8,_0x4dafeb?_0x7cbe('0x18'):_0x7cbe('0x19'));return _0x20bdb9(_0x4dafeb[_0x7cbe('0x14')][_0x7cbe('0x15')]?_0x4dafeb[_0x7cbe('0x14')][0x0]:null);})[_0x7cbe('0xd')](function(_0xfaedfa){logger['error'](_0x7cbe('0x26'),_0xfaedfa?util[_0x7cbe('0x7')](_0xfaedfa,{'showHidden':![],'depth':null}):'');return _0x20bdb9(null);});}return _0x20bdb9(null);});};exports[_0x7cbe('0x27')]=function(_0x346ad6,_0x142aed){return moment(_0x346ad6)['add'](_0x142aed,_0x7cbe('0x28'))[_0x7cbe('0x29')](_0x7cbe('0x2a'));};exports[_0x7cbe('0x2b')]=function(_0x26c252,_0x52d918){return moment(_0x26c252)[_0x7cbe('0x2c')](_0x52d918,_0x7cbe('0x28'))['format'](_0x7cbe('0x2a'));};exports[_0x7cbe('0x2d')]=function(_0x27a193,_0xf56f2){return moment(_0x27a193)[_0x7cbe('0x2e')](moment(_0xf56f2),_0x7cbe('0x28'));};exports['sumTime']=function(_0x20db4b,_0x44dea2){return parseInt(_0x20db4b,0xa)+parseInt(_0x44dea2,0xa);};exports[_0x7cbe('0x2f')]=function(){return moment()[_0x7cbe('0x29')](_0x7cbe('0x2a'));};exports[_0x7cbe('0x30')]=function(_0x574d2f,_0x1d9094){if(_0x1d9094){return moment(_0x574d2f)[_0x7cbe('0x30')](_0x1d9094);}return!![];};exports[_0x7cbe('0x31')]=function(_0x1341fb,_0x5ed7b1){if(_0x5ed7b1){return moment(_0x1341fb)[_0x7cbe('0x31')](_0x5ed7b1);}else if(_0x1341fb){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 a803855..088e4d4 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 _0xbafa=['fs-extra','lodash','express-winston','path','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','log','join','client','name','ensureDir','then','catch','user','no-user','timestamp','error','api','auth','set','client-side-logger','isEmpty','body','format','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','device','other','agent_name','test','url'];(function(_0x2ce185,_0xc0446d){var _0x207213=function(_0x209ffc){while(--_0x209ffc){_0x2ce185['push'](_0x2ce185['shift']());}};_0x207213(++_0xc0446d);}(_0xbafa,0x1d9));var _0xabaf=function(_0x29947d,_0x86939d){_0x29947d=_0x29947d-0x0;var _0x228f7a=_0xbafa[_0x29947d];return _0x228f7a;};var fs=require(_0xabaf('0x0'));var _=require(_0xabaf('0x1'));var ewinston=require(_0xabaf('0x2'));var path=require(_0xabaf('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0xabaf('0x4')];var safeTemplate=require('./safe-template')[_0xabaf('0x5')];var maskSensitiveData=require(_0xabaf('0x6'))[_0xabaf('0x7')];function ClientSideLogger(){function _0x3017bf(_0x3991a5){var _0x423cc7=path['join']('/var',_0xabaf('0x8'),'xcally');var _0x303a40=path[_0xabaf('0x9')](_0xabaf('0xa'),_0x3991a5['role']+'-'+_0x3991a5[_0xabaf('0xb')]);return fs[_0xabaf('0xc')](path[_0xabaf('0x9')](_0x423cc7,_0x303a40))[_0xabaf('0xd')](function(){var _0x4da1bb=fileLogger('client',path[_0xabaf('0x9')](_0x423cc7,_0x303a40));return _0x4da1bb;})[_0xabaf('0xe')](function(_0x450fe0){throw _0x450fe0;});}this[_0xabaf('0x8')]=function(_0x489d60,_0x2065fe,_0x42f0ed,_0x1a4749){return _0x3017bf(_0x489d60['user'])['then'](function(_0x4040ea){var _0x569e99=_0x4040ea[_0x2065fe];return _0x569e99;})[_0xabaf('0xd')](function(_0x56e6d7){var _0x5a6244=_0x489d60['user']?_0x489d60[_0xabaf('0xf')]['id']:_0xabaf('0x10');var _0x14c952=_0x1a4749['data'];var _0x35cac8=_0x1a4749[_0xabaf('0x11')];var _0x2d65ed=new Date(Number(_0x35cac8));return _0x56e6d7(_0x5a6244,_0x2d65ed,_0x42f0ed,_0x14c952);})['catch'](function(_0x5486f6){fileLogger('client')[_0xabaf('0x12')](_0x5486f6);});};}function setupLoggers(_0x10fcc2){return new Promise(function(_0x1698f8){var _0x37adaa=new ClientSideLogger();var _0x24b779=fileLogger(_0xabaf('0x13'));var _0x469b25=fileLogger(_0xabaf('0x14'));_0x10fcc2[_0xabaf('0x15')](_0xabaf('0x16'),_0x37adaa);_0x10fcc2['use'](ewinston['logger']({'winstonInstance':_0x24b779,'meta':![],'statusLevels':!![],'msg':function(_0x5e8824,_0x253cac){var _0x15cdf7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xabaf('0x17')](_0x5e8824[_0xabaf('0x18')])){_0x15cdf7+='\x20body=%s';var _0x4c4582=_0x5e8824[_0xabaf('0x18')];maskSensitiveData(_0x4c4582);}return safeTemplate(util[_0xabaf('0x19')](_0x15cdf7,_0x5e8824['method'],_0x5e8824['headers'][_0xabaf('0x1a')]?_0x5e8824[_0xabaf('0x1b')][_0xabaf('0x1a')]:_0x5e8824[_0xabaf('0x1c')][_0xabaf('0x1d')]||_0x5e8824['ip'],_0x5e8824['url'],_0x253cac[_0xabaf('0x1e')],_0x253cac[_0xabaf('0x1f')],_0x5e8824[_0xabaf('0xf')]?_0x5e8824[_0xabaf('0xf')]['id']:null,_0x5e8824[_0xabaf('0xf')]?_0x5e8824['user']['name']:null,_0x5e8824[_0xabaf('0xf')]?_0x5e8824['user'][_0xabaf('0x20')]:null,_0x4c4582?util[_0xabaf('0x21')](_0x4c4582,![],null):''));}}));_0x10fcc2['use'](ewinston['logger']({'winstonInstance':_0x469b25,'meta':![],'statusLevels':!![],'msg':function(_0x187eeb,_0x14204d){var _0xeabdf0=_0xabaf('0x22');if(_0x187eeb[_0xabaf('0x18')]&&_0x187eeb[_0xabaf('0x18')]['device']&&_0x187eeb[_0xabaf('0x18')][_0xabaf('0x23')]){_0xeabdf0=_0xabaf('0x24');}return util[_0xabaf('0x19')](_0xeabdf0,_0x187eeb[_0xabaf('0x25')],_0x187eeb[_0xabaf('0x1b')]['x-forwarded-for']?_0x187eeb[_0xabaf('0x1b')][_0xabaf('0x1a')]:_0x187eeb[_0xabaf('0x1c')][_0xabaf('0x1d')]||_0x187eeb['ip'],_0x187eeb['url'],_0x14204d[_0xabaf('0x1e')],_0x14204d[_0xabaf('0x1f')],_0x187eeb[_0xabaf('0xf')]?_0x187eeb[_0xabaf('0xf')]['id']:null,_0x187eeb['user']?_0x187eeb['user'][_0xabaf('0xb')]:null,_0x187eeb['user']?_0x187eeb[_0xabaf('0xf')][_0xabaf('0x20')]:null,_0x187eeb[_0xabaf('0x18')]&&_0x187eeb['body'][_0xabaf('0x26')]?_0x187eeb[_0xabaf('0x18')][_0xabaf('0x26')]:_0xabaf('0x27'),_0x187eeb['body']&&_0x187eeb[_0xabaf('0x18')][_0xabaf('0x23')]?_0x187eeb[_0xabaf('0x18')][_0xabaf('0x23')]:'',_0x187eeb[_0xabaf('0x18')]&&_0x187eeb[_0xabaf('0x18')][_0xabaf('0x28')]?_0x187eeb[_0xabaf('0x18')][_0xabaf('0x28')]:'');},'ignoreRoute':function(_0x2270ef){var _0x5c52fc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5c52fc[_0xabaf('0x29')](_0x2270ef[_0xabaf('0x2a')]);}}));return _0x1698f8();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x35c4=['\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','role','device','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','name','ensureDir','then','client','catch','user','no-user','data','timestamp','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body'];(function(_0xcd13ec,_0x2b9db5){var _0x11bc04=function(_0x2b8b74){while(--_0x2b8b74){_0xcd13ec['push'](_0xcd13ec['shift']());}};_0x11bc04(++_0x2b9db5);}(_0x35c4,0x70));var _0x435c=function(_0x4e4370,_0xc21e13){_0x4e4370=_0x4e4370-0x0;var _0x468a39=_0x35c4[_0x4e4370];return _0x468a39;};var fs=require(_0x435c('0x0'));var _=require(_0x435c('0x1'));var ewinston=require(_0x435c('0x2'));var path=require(_0x435c('0x3'));var util=require(_0x435c('0x4'));var fileLogger=require('./loggers')[_0x435c('0x5')];var safeTemplate=require('./safe-template')[_0x435c('0x6')];var maskSensitiveData=require(_0x435c('0x7'))[_0x435c('0x8')];function ClientSideLogger(){function _0x145826(_0x4e3dcd){var _0x40c990=path[_0x435c('0x9')]('/var',_0x435c('0xa'),'xcally');var _0x2414be=path[_0x435c('0x9')]('client',_0x4e3dcd['role']+'-'+_0x4e3dcd[_0x435c('0xb')]);return fs[_0x435c('0xc')](path[_0x435c('0x9')](_0x40c990,_0x2414be))[_0x435c('0xd')](function(){var _0x95685=fileLogger(_0x435c('0xe'),path[_0x435c('0x9')](_0x40c990,_0x2414be));return _0x95685;})[_0x435c('0xf')](function(_0x239d12){throw _0x239d12;});}this[_0x435c('0xa')]=function(_0x29d023,_0x468fe1,_0x448b16,_0x47ed1f){return _0x145826(_0x29d023[_0x435c('0x10')])['then'](function(_0x101b5e){var _0x3983ec=_0x101b5e[_0x468fe1];return _0x3983ec;})['then'](function(_0x2f4ba9){var _0x513673=_0x29d023[_0x435c('0x10')]?_0x29d023[_0x435c('0x10')]['id']:_0x435c('0x11');var _0x5d9e5c=_0x47ed1f[_0x435c('0x12')];var _0x5b814e=_0x47ed1f[_0x435c('0x13')];var _0x2acd05=new Date(Number(_0x5b814e));return _0x2f4ba9(_0x513673,_0x2acd05,_0x448b16,_0x5d9e5c);})[_0x435c('0xf')](function(_0x1a7f8d){fileLogger(_0x435c('0xe'))['error'](_0x1a7f8d);});};}function setupLoggers(_0x3dad81){return new Promise(function(_0x553e33){var _0x4bf3ea=new ClientSideLogger();var _0x5ef8ea=fileLogger('api');var _0x2a3375=fileLogger('auth');_0x3dad81[_0x435c('0x14')](_0x435c('0x15'),_0x4bf3ea);_0x3dad81['use'](ewinston[_0x435c('0x16')]({'winstonInstance':_0x5ef8ea,'meta':![],'statusLevels':!![],'msg':function(_0x5f5789,_0x1b5db9){var _0x5d4e97=_0x435c('0x17');if(!_[_0x435c('0x18')](_0x5f5789[_0x435c('0x19')])){_0x5d4e97+=_0x435c('0x1a');var _0x1d612a=_0x5f5789[_0x435c('0x19')];maskSensitiveData(_0x1d612a);}return safeTemplate(util['format'](_0x5d4e97,_0x5f5789[_0x435c('0x1b')],_0x5f5789[_0x435c('0x1c')][_0x435c('0x1d')]?_0x5f5789[_0x435c('0x1c')][_0x435c('0x1d')]:_0x5f5789[_0x435c('0x1e')][_0x435c('0x1f')]||_0x5f5789['ip'],_0x5f5789[_0x435c('0x20')],_0x1b5db9[_0x435c('0x21')],_0x1b5db9['responseTime'],_0x5f5789[_0x435c('0x10')]?_0x5f5789[_0x435c('0x10')]['id']:null,_0x5f5789[_0x435c('0x10')]?_0x5f5789[_0x435c('0x10')][_0x435c('0xb')]:null,_0x5f5789[_0x435c('0x10')]?_0x5f5789['user']['role']:null,_0x1d612a?util[_0x435c('0x22')](_0x1d612a,![],null):''));}}));_0x3dad81[_0x435c('0x23')](ewinston['logger']({'winstonInstance':_0x2a3375,'meta':![],'statusLevels':!![],'msg':function(_0x5f3774,_0x15e923){var _0x3e2c0c=_0x435c('0x24');if(_0x5f3774['body']&&_0x5f3774[_0x435c('0x19')]['device']&&_0x5f3774[_0x435c('0x19')][_0x435c('0x25')]){_0x3e2c0c=_0x435c('0x26');}return util['format'](_0x3e2c0c,_0x5f3774[_0x435c('0x1b')],_0x5f3774[_0x435c('0x1c')][_0x435c('0x1d')]?_0x5f3774[_0x435c('0x1c')][_0x435c('0x1d')]:_0x5f3774[_0x435c('0x1e')][_0x435c('0x1f')]||_0x5f3774['ip'],_0x5f3774[_0x435c('0x20')],_0x15e923[_0x435c('0x21')],_0x15e923[_0x435c('0x27')],_0x5f3774[_0x435c('0x10')]?_0x5f3774['user']['id']:null,_0x5f3774['user']?_0x5f3774[_0x435c('0x10')]['name']:null,_0x5f3774[_0x435c('0x10')]?_0x5f3774[_0x435c('0x10')][_0x435c('0x28')]:null,_0x5f3774['body']&&_0x5f3774[_0x435c('0x19')]['device']?_0x5f3774[_0x435c('0x19')][_0x435c('0x29')]:_0x435c('0x2a'),_0x5f3774[_0x435c('0x19')]&&_0x5f3774[_0x435c('0x19')][_0x435c('0x25')]?_0x5f3774[_0x435c('0x19')]['agent_id']:'',_0x5f3774['body']&&_0x5f3774[_0x435c('0x19')]['agent_name']?_0x5f3774[_0x435c('0x19')][_0x435c('0x2b')]:'');},'ignoreRoute':function(_0x200688){var _0xab242b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xab242b[_0x435c('0x2c')](_0x200688['url']);}}));return _0x553e33();});}exports[_0x435c('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 033e448..db59c8b 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c4e=['fileLogger','util','../config/environment','toLowerCase','info','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','addColors','join','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','Logger','Console','warn','transports','%s-%s','error','File','consoleLogger'];(function(_0x43b7f5,_0x548b10){var _0x3ccd49=function(_0x1536df){while(--_0x1536df){_0x43b7f5['push'](_0x43b7f5['shift']());}};_0x3ccd49(++_0x548b10);}(_0x3c4e,0x1cf));var _0xe3c4=function(_0x29d050,_0x549919){_0x29d050=_0x29d050-0x0;var _0x1d829f=_0x3c4e[_0x29d050];return _0x1d829f;};'use strict';var path=require('path');var util=require(_0xe3c4('0x0'));var moment=require('moment');var winston=require('winston');var config=require(_0xe3c4('0x1'));var debugLevel=config['debugLevel']?config['debugLevel'][_0xe3c4('0x2')]():_0xe3c4('0x3');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0xe3c4('0x4'),'info':_0xe3c4('0x5'),'print':_0xe3c4('0x6'),'success':_0xe3c4('0x7'),'http':_0xe3c4('0x8'),'verbose':_0xe3c4('0x9'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xe3c4('0xa')](XC_LOG_COLORS);function getLogFileName(_0x289522,_0x263381,_0x5ba026){var _0x14b411=_0x289522||'/var/log/xcally';return path[_0xe3c4('0xb')](_0x14b411,util[_0xe3c4('0xc')]('%s-%s.log',_0x263381,_0x5ba026));}function formatter(_0x486aca,_0x5b0f24){_0x5b0f24[_0xe3c4('0xd')]=_0x5b0f24[_0xe3c4('0xd')]['replace'](/@@{/g,_0xe3c4('0xe'))[_0xe3c4('0xf')](/}@@/g,_0xe3c4('0x10'))['replace'](/@{/g,'{{')[_0xe3c4('0xf')](/}@/g,'}}');return util[_0xe3c4('0xc')](_0xe3c4('0x11'),moment()['format'](_0xe3c4('0x12')),_0x5b0f24[_0xe3c4('0x13')][_0xe3c4('0x14')](),_0x486aca,_0x5b0f24['message']);}function fileFormat(_0x41d91a,_0x2a8d8d){_0x2a8d8d[_0xe3c4('0xd')]=_0x2a8d8d[_0xe3c4('0xd')][_0xe3c4('0xf')](/@@{/g,_0xe3c4('0xe'))[_0xe3c4('0xf')](/}@@/g,_0xe3c4('0x10'))[_0xe3c4('0xf')](/@{/g,'{{')[_0xe3c4('0xf')](/}@/g,'}}');var _0x425378=_0x2a8d8d[_0xe3c4('0x15')]&&Object['keys'](_0x2a8d8d[_0xe3c4('0x15')])[_0xe3c4('0x16')]?'\x0a\x09'+JSON[_0xe3c4('0x17')](_0x2a8d8d[_0xe3c4('0x15')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xe3c4('0xc')](_0xe3c4('0x12')),_0x2a8d8d[_0xe3c4('0x13')]['toUpperCase'](),_0x41d91a,_0x2a8d8d[_0xe3c4('0xd')],_0x425378);}function consoleLogger(){var _0x3bb4ff=new winston[(_0xe3c4('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xe3c4('0x19'))]({'level':_0xe3c4('0x1a'),'json':![],'formatter':function(_0x4ac271){return formatter('',_0x4ac271);}})]});return _0x3bb4ff;}function fileLogger(_0x33b7c3,_0x1c6c0a){var _0x66f3bd=new winston[(_0xe3c4('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe3c4('0x1b'))]['File']({'name':util[_0xe3c4('0xc')](_0xe3c4('0x1c'),_0x33b7c3,'error'),'filename':getLogFileName(_0x1c6c0a,_0x33b7c3,_0xe3c4('0x1d')),'level':_0xe3c4('0x1d'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x14a3a4){return fileFormat(_0x33b7c3,_0x14a3a4);}}),new winston['transports'][(_0xe3c4('0x1e'))]({'name':util[_0xe3c4('0xc')](_0xe3c4('0x1c'),_0x33b7c3,debugLevel),'filename':getLogFileName(_0x1c6c0a,_0x33b7c3,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x38ca7c){return fileFormat(_0x33b7c3,_0x38ca7c);}}),new winston[(_0xe3c4('0x1b'))][(_0xe3c4('0x19'))]({'level':'warn','json':![],'formatter':function(_0x41b94f){return fileFormat(_0x33b7c3,_0x41b94f);}})]});return _0x66f3bd;}exports[_0xe3c4('0x1f')]=consoleLogger;exports[_0xe3c4('0x20')]=fileLogger; \ No newline at end of file +var _0x6049=['{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','}}}','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','join','format','%s-%s.log','message','replace'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x6049,0x1a3));var _0x9604=function(_0x2801a9,_0x329041){_0x2801a9=_0x2801a9-0x0;var _0x2f1a3a=_0x6049[_0x2801a9];return _0x2f1a3a;};'use strict';var path=require(_0x9604('0x0'));var util=require(_0x9604('0x1'));var moment=require(_0x9604('0x2'));var winston=require(_0x9604('0x3'));var config=require(_0x9604('0x4'));var debugLevel=config[_0x9604('0x5')]?config[_0x9604('0x5')][_0x9604('0x6')]():_0x9604('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x9604('0x8'),'error':_0x9604('0x9'),'warn':_0x9604('0xa'),'info':'white','print':_0x9604('0xb'),'success':'bold\x20green','http':_0x9604('0xc'),'verbose':_0x9604('0xd'),'debug':_0x9604('0xe'),'silly':_0x9604('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x87503a,_0x4d9af2,_0x1ac783){var _0xdc3c7=_0x87503a||'/var/log/xcally';return path[_0x9604('0x10')](_0xdc3c7,util[_0x9604('0x11')](_0x9604('0x12'),_0x4d9af2,_0x1ac783));}function formatter(_0x250574,_0x7b9d67){_0x7b9d67[_0x9604('0x13')]=_0x7b9d67[_0x9604('0x13')][_0x9604('0x14')](/@@{/g,_0x9604('0x15'))['replace'](/}@@/g,'}}}')[_0x9604('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x9604('0x16'),moment()[_0x9604('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x7b9d67[_0x9604('0x17')][_0x9604('0x18')](),_0x250574,_0x7b9d67[_0x9604('0x13')]);}function fileFormat(_0x561cfe,_0x1e18fb){_0x1e18fb[_0x9604('0x13')]=_0x1e18fb[_0x9604('0x13')][_0x9604('0x14')](/@@{/g,_0x9604('0x15'))[_0x9604('0x14')](/}@@/g,_0x9604('0x19'))['replace'](/@{/g,'{{')[_0x9604('0x14')](/}@/g,'}}');var _0x545467=_0x1e18fb[_0x9604('0x1a')]&&Object[_0x9604('0x1b')](_0x1e18fb[_0x9604('0x1a')])[_0x9604('0x1c')]?'\x0a\x09'+JSON['stringify'](_0x1e18fb[_0x9604('0x1a')]):'';return util[_0x9604('0x11')](_0x9604('0x1d'),moment()[_0x9604('0x11')](_0x9604('0x1e')),_0x1e18fb[_0x9604('0x17')][_0x9604('0x18')](),_0x561cfe,_0x1e18fb[_0x9604('0x13')],_0x545467);}function consoleLogger(){var _0x1c0dc8=new winston[(_0x9604('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9604('0x20'))][(_0x9604('0x21'))]({'level':'warn','json':![],'formatter':function(_0x5f0aff){return formatter('',_0x5f0aff);}})]});return _0x1c0dc8;}function fileLogger(_0x906b9e,_0x48b2b1){var _0x853d52=new winston[(_0x9604('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9604('0x20'))][(_0x9604('0x22'))]({'name':util['format'](_0x9604('0x23'),_0x906b9e,_0x9604('0x24')),'filename':getLogFileName(_0x48b2b1,_0x906b9e,_0x9604('0x24')),'level':_0x9604('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e64f3){return fileFormat(_0x906b9e,_0x1e64f3);}}),new winston['transports'][(_0x9604('0x22'))]({'name':util[_0x9604('0x11')](_0x9604('0x23'),_0x906b9e,debugLevel),'filename':getLogFileName(_0x48b2b1,_0x906b9e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x281678){return fileFormat(_0x906b9e,_0x281678);}}),new winston[(_0x9604('0x20'))][(_0x9604('0x21'))]({'level':_0x9604('0x25'),'json':![],'formatter':function(_0x5271cf){return fileFormat(_0x906b9e,_0x5271cf);}})]});return _0x853d52;}exports[_0x9604('0x26')]=consoleLogger;exports[_0x9604('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index dd37990..488f0c6 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x430476,_0x1ba437){var _0x588af1=function(_0x197025){while(--_0x197025){_0x430476['push'](_0x430476['shift']());}};_0x588af1(++_0x1ba437);}(_0xadb5,0xad));var _0x5adb=function(_0x571dd6,_0x530e20){_0x571dd6=_0x571dd6-0x0;var _0xaee792=_0xadb5[_0x571dd6];return _0xaee792;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb28,0x106));var _0x8db2=function(_0x1847a4,_0xdd36ba){_0x1847a4=_0x1847a4-0x0;var _0x3b1bd4=_0xdb28[_0x1847a4];return _0x3b1bd4;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 337c7d3..76e0666 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 _0xb7e7=['reduce','safeTemplate','lodash','{\x20{\x20','string','isArray','map'];(function(_0x26da18,_0x18874b){var _0x2181f8=function(_0xa7e2c0){while(--_0xa7e2c0){_0x26da18['push'](_0x26da18['shift']());}};_0x2181f8(++_0x18874b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb7e7[_0x3305de];return _0x3b5a84;};var _=require(_0x7b7e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x545d7d){return _0x545d7d==='{{'?_0x7b7e('0x1'):'\x20}\x20}';}function safeTemplate(_0x1b7cc7){var _0x54a37f=_0x1b7cc7;if(typeof _0x1b7cc7===_0x7b7e('0x2')){_0x54a37f=_0x1b7cc7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x7b7e('0x3')](_0x1b7cc7)){_0x54a37f=_0x1b7cc7[_0x7b7e('0x4')](function(_0x1d9384){return safeTemplate(_0x1d9384);});}else if(_['isPlainObject'](_0x1b7cc7)){_0x54a37f=Object['keys'](_0x1b7cc7)[_0x7b7e('0x5')](function(_0x372bde,_0x7f87e0){_0x372bde[_0x7f87e0]=safeTemplate(_0x1b7cc7[_0x7f87e0]);return _0x372bde;},{});}return _0x54a37f;}module['exports'][_0x7b7e('0x6')]=safeTemplate; \ No newline at end of file +var _0x896e=['map','isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x4f403e,_0x38ff74){var _0x3e1d38=function(_0x1e108b){while(--_0x1e108b){_0x4f403e['push'](_0x4f403e['shift']());}};_0x3e1d38(++_0x38ff74);}(_0x896e,0x1e9));var _0xe896=function(_0xae9721,_0x2d49ff){_0xae9721=_0xae9721-0x0;var _0x171854=_0x896e[_0xae9721];return _0x171854;};var _=require(_0xe896('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1bab19){return _0x1bab19==='{{'?_0xe896('0x1'):_0xe896('0x2');}function safeTemplate(_0x36085e){var _0x26d296=_0x36085e;if(typeof _0x36085e===_0xe896('0x3')){_0x26d296=_0x36085e[_0xe896('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe896('0x5')](_0x36085e)){_0x26d296=_0x36085e[_0xe896('0x6')](function(_0x244f68){return safeTemplate(_0x244f68);});}else if(_[_0xe896('0x7')](_0x36085e)){_0x26d296=Object['keys'](_0x36085e)[_0xe896('0x8')](function(_0x7a0721,_0x3b902c){_0x7a0721[_0x3b902c]=safeTemplate(_0x36085e[_0x3b902c]);return _0x7a0721;},{});}return _0x26d296;}module[_0xe896('0x9')][_0xe896('0xa')]=safeTemplate; \ No newline at end of file